summaryrefslogtreecommitdiffstats
path: root/Source/JavaScriptCore
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2011-05-06 11:45:16 +0100
committerSteve Block <steveblock@google.com>2011-05-12 13:44:10 +0100
commitcad810f21b803229eb11403f9209855525a25d57 (patch)
tree29a6fd0279be608e0fe9ffe9841f722f0f4e4269 /Source/JavaScriptCore
parent121b0cf4517156d0ac5111caf9830c51b69bae8f (diff)
downloadexternal_webkit-cad810f21b803229eb11403f9209855525a25d57.zip
external_webkit-cad810f21b803229eb11403f9209855525a25d57.tar.gz
external_webkit-cad810f21b803229eb11403f9209855525a25d57.tar.bz2
Merge WebKit at r75315: Initial merge by git.
Change-Id: I570314b346ce101c935ed22a626b48c2af266b84
Diffstat (limited to 'Source/JavaScriptCore')
-rw-r--r--Source/JavaScriptCore/API/APICast.h153
-rw-r--r--Source/JavaScriptCore/API/APIShims.h101
-rw-r--r--Source/JavaScriptCore/API/JSBase.cpp113
-rw-r--r--Source/JavaScriptCore/API/JSBase.h132
-rw-r--r--Source/JavaScriptCore/API/JSBasePrivate.h52
-rw-r--r--Source/JavaScriptCore/API/JSCallbackConstructor.cpp89
-rw-r--r--Source/JavaScriptCore/API/JSCallbackConstructor.h60
-rw-r--r--Source/JavaScriptCore/API/JSCallbackFunction.cpp80
-rw-r--r--Source/JavaScriptCore/API/JSCallbackFunction.h58
-rw-r--r--Source/JavaScriptCore/API/JSCallbackObject.cpp42
-rw-r--r--Source/JavaScriptCore/API/JSCallbackObject.h201
-rw-r--r--Source/JavaScriptCore/API/JSCallbackObjectFunctions.h607
-rw-r--r--Source/JavaScriptCore/API/JSClassRef.cpp266
-rw-r--r--Source/JavaScriptCore/API/JSClassRef.h122
-rw-r--r--Source/JavaScriptCore/API/JSContextRef.cpp175
-rw-r--r--Source/JavaScriptCore/API/JSContextRef.h132
-rw-r--r--Source/JavaScriptCore/API/JSContextRefPrivate.h53
-rw-r--r--Source/JavaScriptCore/API/JSObjectRef.cpp544
-rw-r--r--Source/JavaScriptCore/API/JSObjectRef.h694
-rw-r--r--Source/JavaScriptCore/API/JSObjectRefPrivate.h74
-rw-r--r--Source/JavaScriptCore/API/JSProfilerPrivate.cpp46
-rw-r--r--Source/JavaScriptCore/API/JSProfilerPrivate.h63
-rw-r--r--Source/JavaScriptCore/API/JSRetainPtr.h208
-rw-r--r--Source/JavaScriptCore/API/JSStringRef.cpp112
-rw-r--r--Source/JavaScriptCore/API/JSStringRef.h145
-rw-r--r--Source/JavaScriptCore/API/JSStringRefBSTR.cpp42
-rw-r--r--Source/JavaScriptCore/API/JSStringRefBSTR.h62
-rw-r--r--Source/JavaScriptCore/API/JSStringRefCF.cpp57
-rw-r--r--Source/JavaScriptCore/API/JSStringRefCF.h60
-rw-r--r--Source/JavaScriptCore/API/JSValueRef.cpp334
-rw-r--r--Source/JavaScriptCore/API/JSValueRef.h301
-rw-r--r--Source/JavaScriptCore/API/JSWeakObjectMapRefInternal.h68
-rw-r--r--Source/JavaScriptCore/API/JSWeakObjectMapRefPrivate.cpp83
-rw-r--r--Source/JavaScriptCore/API/JSWeakObjectMapRefPrivate.h95
-rw-r--r--Source/JavaScriptCore/API/JavaScript.h36
-rw-r--r--Source/JavaScriptCore/API/JavaScriptCore.h32
-rw-r--r--Source/JavaScriptCore/API/OpaqueJSString.cpp55
-rw-r--r--Source/JavaScriptCore/API/OpaqueJSString.h81
-rw-r--r--Source/JavaScriptCore/API/WebKitAvailability.h904
-rw-r--r--Source/JavaScriptCore/API/tests/JSNode.c196
-rw-r--r--Source/JavaScriptCore/API/tests/JSNode.h37
-rw-r--r--Source/JavaScriptCore/API/tests/JSNodeList.c123
-rw-r--r--Source/JavaScriptCore/API/tests/JSNodeList.h34
-rw-r--r--Source/JavaScriptCore/API/tests/Node.c85
-rw-r--r--Source/JavaScriptCore/API/tests/Node.h50
-rw-r--r--Source/JavaScriptCore/API/tests/NodeList.c81
-rw-r--r--Source/JavaScriptCore/API/tests/NodeList.h42
-rw-r--r--Source/JavaScriptCore/API/tests/minidom.c126
-rw-r--r--Source/JavaScriptCore/API/tests/minidom.html9
-rw-r--r--Source/JavaScriptCore/API/tests/minidom.js110
-rw-r--r--Source/JavaScriptCore/API/tests/testapi.c1458
-rw-r--r--Source/JavaScriptCore/API/tests/testapi.js251
-rw-r--r--Source/JavaScriptCore/AUTHORS2
-rw-r--r--Source/JavaScriptCore/AllInOneFile.cpp0
-rw-r--r--Source/JavaScriptCore/Android.mk253
-rw-r--r--Source/JavaScriptCore/Android.v8.wtf.mk87
-rw-r--r--Source/JavaScriptCore/CMakeLists.txt258
-rw-r--r--Source/JavaScriptCore/CMakeListsEfl.txt20
-rw-r--r--Source/JavaScriptCore/CMakeListsWinCE.txt5
-rw-r--r--Source/JavaScriptCore/COPYING.LIB488
-rw-r--r--Source/JavaScriptCore/ChangeLog18229
-rw-r--r--Source/JavaScriptCore/ChangeLog-2002-12-032271
-rw-r--r--Source/JavaScriptCore/ChangeLog-2003-10-251483
-rw-r--r--Source/JavaScriptCore/ChangeLog-2007-10-1426221
-rw-r--r--Source/JavaScriptCore/ChangeLog-2008-08-1031482
-rw-r--r--Source/JavaScriptCore/ChangeLog-2009-06-1639978
-rw-r--r--Source/JavaScriptCore/ChangeLog-2010-05-2428211
-rw-r--r--Source/JavaScriptCore/Configurations/Base.xcconfig141
-rw-r--r--Source/JavaScriptCore/Configurations/DebugRelease.xcconfig50
-rw-r--r--Source/JavaScriptCore/Configurations/FeatureDefines.xcconfig124
-rw-r--r--Source/JavaScriptCore/Configurations/JavaScriptCore.xcconfig53
-rw-r--r--Source/JavaScriptCore/Configurations/Version.xcconfig58
-rw-r--r--Source/JavaScriptCore/DerivedSources.make82
-rw-r--r--Source/JavaScriptCore/DerivedSources.pro100
-rw-r--r--Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/APICast.h1
-rw-r--r--Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSBase.h1
-rw-r--r--Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSContextRef.h1
-rw-r--r--Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSObjectRef.h1
-rw-r--r--Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSRetainPtr.h1
-rw-r--r--Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSStringRef.h1
-rw-r--r--Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSStringRefCF.h1
-rw-r--r--Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSValueRef.h1
-rw-r--r--Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JavaScript.h1
-rw-r--r--Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JavaScriptCore.h1
-rw-r--r--Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/OpaqueJSString.h1
-rw-r--r--Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/WebKitAvailability.h1
-rw-r--r--Source/JavaScriptCore/GNUmakefile.am696
-rw-r--r--Source/JavaScriptCore/Info.plist24
-rw-r--r--Source/JavaScriptCore/JavaScriptCore.JSVALUE32_64only.exp2
-rw-r--r--Source/JavaScriptCore/JavaScriptCore.JSVALUE32only.exp2
-rw-r--r--Source/JavaScriptCore/JavaScriptCore.JSVALUE64only.exp2
-rw-r--r--Source/JavaScriptCore/JavaScriptCore.exp595
-rw-r--r--Source/JavaScriptCore/JavaScriptCore.gyp/JavaScriptCore.gyp216
-rw-r--r--Source/JavaScriptCore/JavaScriptCore.gypi504
-rw-r--r--Source/JavaScriptCore/JavaScriptCore.order2135
-rw-r--r--Source/JavaScriptCore/JavaScriptCore.pri111
-rw-r--r--Source/JavaScriptCore/JavaScriptCore.pro226
-rw-r--r--Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore.make38
-rw-r--r--Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore.resources/Info.plist24
-rw-r--r--Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore.sln95
-rw-r--r--Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def361
-rw-r--r--Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.rc47
-rw-r--r--Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj1968
-rw-r--r--Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCF.vsprops11
-rw-r--r--Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCFLite.vsprops11
-rw-r--r--Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops20
-rw-r--r--Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make58
-rw-r--r--Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.vcproj100
-rw-r--r--Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGeneratedCommon.vsprops15
-rw-r--r--Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCorePGOOptimize.vsprops15
-rw-r--r--Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCorePostBuild.cmd1
-rw-r--r--Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCorePreBuild.cmd8
-rw-r--r--Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCorePreLink.cmd9
-rwxr-xr-xSource/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/build-generated-files.sh47
-rw-r--r--Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/react-to-vsprops-changes.py37
-rw-r--r--Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCoreSubmit.sln83
-rw-r--r--Source/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTF.vcproj978
-rw-r--r--Source/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTFCommon.vsprops20
-rw-r--r--Source/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTFPostBuild.cmd1
-rw-r--r--Source/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTFPreBuild.cmd6
-rw-r--r--Source/JavaScriptCore/JavaScriptCore.vcproj/jsc/jsc.vcproj473
-rw-r--r--Source/JavaScriptCore/JavaScriptCore.vcproj/jsc/jscCommon.vsprops20
-rw-r--r--Source/JavaScriptCore/JavaScriptCore.vcproj/jsc/jscPostBuild.cmd25
-rw-r--r--Source/JavaScriptCore/JavaScriptCore.vcproj/jsc/jscPreBuild.cmd6
-rw-r--r--Source/JavaScriptCore/JavaScriptCore.vcproj/jsc/jscPreLink.cmd9
-rw-r--r--Source/JavaScriptCore/JavaScriptCore.vcproj/testapi/testapi.vcproj448
-rw-r--r--Source/JavaScriptCore/JavaScriptCore.vcproj/testapi/testapiCommon.vsprops20
-rw-r--r--Source/JavaScriptCore/JavaScriptCore.vcproj/testapi/testapiPostBuild.cmd3
-rw-r--r--Source/JavaScriptCore/JavaScriptCore.vcproj/testapi/testapiPreBuild.cmd6
-rw-r--r--Source/JavaScriptCore/JavaScriptCore.vcproj/testapi/testapiPreLink.cmd9
-rw-r--r--Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj3197
-rw-r--r--Source/JavaScriptCore/JavaScriptCorePrefix.h36
-rw-r--r--Source/JavaScriptCore/Makefile2
-rw-r--r--Source/JavaScriptCore/THANKS8
-rw-r--r--Source/JavaScriptCore/assembler/ARMAssembler.cpp378
-rw-r--r--Source/JavaScriptCore/assembler/ARMAssembler.h948
-rw-r--r--Source/JavaScriptCore/assembler/ARMv7Assembler.cpp41
-rw-r--r--Source/JavaScriptCore/assembler/ARMv7Assembler.h2358
-rw-r--r--Source/JavaScriptCore/assembler/AbstractMacroAssembler.h549
-rw-r--r--Source/JavaScriptCore/assembler/AssemblerBuffer.h173
-rw-r--r--Source/JavaScriptCore/assembler/AssemblerBufferWithConstantPool.h317
-rw-r--r--Source/JavaScriptCore/assembler/CodeLocation.h184
-rw-r--r--Source/JavaScriptCore/assembler/LinkBuffer.h350
-rw-r--r--Source/JavaScriptCore/assembler/MIPSAssembler.h984
-rw-r--r--Source/JavaScriptCore/assembler/MacroAssembler.h347
-rw-r--r--Source/JavaScriptCore/assembler/MacroAssemblerARM.cpp99
-rw-r--r--Source/JavaScriptCore/assembler/MacroAssemblerARM.h1044
-rw-r--r--Source/JavaScriptCore/assembler/MacroAssemblerARMv7.h1374
-rw-r--r--Source/JavaScriptCore/assembler/MacroAssemblerCodeRef.h192
-rw-r--r--Source/JavaScriptCore/assembler/MacroAssemblerMIPS.h1873
-rw-r--r--Source/JavaScriptCore/assembler/MacroAssemblerX86.h203
-rw-r--r--Source/JavaScriptCore/assembler/MacroAssemblerX86Common.h1092
-rw-r--r--Source/JavaScriptCore/assembler/MacroAssemblerX86_64.h460
-rw-r--r--Source/JavaScriptCore/assembler/RepatchBuffer.h134
-rw-r--r--Source/JavaScriptCore/assembler/X86Assembler.h2100
-rw-r--r--Source/JavaScriptCore/bytecode/CodeBlock.cpp1708
-rw-r--r--Source/JavaScriptCore/bytecode/CodeBlock.h691
-rw-r--r--Source/JavaScriptCore/bytecode/EvalCodeCache.h78
-rw-r--r--Source/JavaScriptCore/bytecode/Instruction.h169
-rw-r--r--Source/JavaScriptCore/bytecode/JumpTable.cpp47
-rw-r--r--Source/JavaScriptCore/bytecode/JumpTable.h103
-rw-r--r--Source/JavaScriptCore/bytecode/Opcode.cpp191
-rw-r--r--Source/JavaScriptCore/bytecode/Opcode.h276
-rw-r--r--Source/JavaScriptCore/bytecode/SamplingTool.cpp406
-rw-r--r--Source/JavaScriptCore/bytecode/SamplingTool.h414
-rw-r--r--Source/JavaScriptCore/bytecode/StructureStubInfo.cpp80
-rw-r--r--Source/JavaScriptCore/bytecode/StructureStubInfo.h185
-rw-r--r--Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp2233
-rw-r--r--Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h588
-rw-r--r--Source/JavaScriptCore/bytecompiler/Label.h90
-rw-r--r--Source/JavaScriptCore/bytecompiler/LabelScope.h79
-rw-r--r--Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp2076
-rw-r--r--Source/JavaScriptCore/bytecompiler/RegisterID.h121
-rw-r--r--Source/JavaScriptCore/config.h99
-rwxr-xr-xSource/JavaScriptCore/create_hash_table296
-rw-r--r--Source/JavaScriptCore/create_jit_stubs85
-rw-r--r--Source/JavaScriptCore/create_regex_tables112
-rw-r--r--Source/JavaScriptCore/debugger/Debugger.cpp119
-rw-r--r--Source/JavaScriptCore/debugger/Debugger.h65
-rw-r--r--Source/JavaScriptCore/debugger/DebuggerActivation.cpp104
-rw-r--r--Source/JavaScriptCore/debugger/DebuggerActivation.h66
-rw-r--r--Source/JavaScriptCore/debugger/DebuggerCallFrame.cpp106
-rw-r--r--Source/JavaScriptCore/debugger/DebuggerCallFrame.h67
-rwxr-xr-xSource/JavaScriptCore/docs/make-bytecode-docs.pl43
-rw-r--r--Source/JavaScriptCore/headers.pri9
-rw-r--r--Source/JavaScriptCore/icu/LICENSE25
-rw-r--r--Source/JavaScriptCore/icu/README4
-rw-r--r--Source/JavaScriptCore/icu/unicode/parseerr.h88
-rw-r--r--Source/JavaScriptCore/icu/unicode/platform.h267
-rw-r--r--Source/JavaScriptCore/icu/unicode/putil.h180
-rw-r--r--Source/JavaScriptCore/icu/unicode/uchar.h2798
-rw-r--r--Source/JavaScriptCore/icu/unicode/ucnv.h1817
-rw-r--r--Source/JavaScriptCore/icu/unicode/ucnv_err.h456
-rw-r--r--Source/JavaScriptCore/icu/unicode/ucol.h1219
-rw-r--r--Source/JavaScriptCore/icu/unicode/uconfig.h186
-rw-r--r--Source/JavaScriptCore/icu/unicode/uenum.h129
-rw-r--r--Source/JavaScriptCore/icu/unicode/uiter.h707
-rw-r--r--Source/JavaScriptCore/icu/unicode/uloc.h917
-rw-r--r--Source/JavaScriptCore/icu/unicode/umachine.h371
-rw-r--r--Source/JavaScriptCore/icu/unicode/unorm.h575
-rw-r--r--Source/JavaScriptCore/icu/unicode/urename.h1468
-rw-r--r--Source/JavaScriptCore/icu/unicode/uset.h745
-rw-r--r--Source/JavaScriptCore/icu/unicode/ustring.h1320
-rw-r--r--Source/JavaScriptCore/icu/unicode/utf.h221
-rw-r--r--Source/JavaScriptCore/icu/unicode/utf16.h605
-rw-r--r--Source/JavaScriptCore/icu/unicode/utf8.h627
-rw-r--r--Source/JavaScriptCore/icu/unicode/utf_old.h1
-rw-r--r--Source/JavaScriptCore/icu/unicode/utypes.h745
-rw-r--r--Source/JavaScriptCore/icu/unicode/uversion.h216
-rw-r--r--Source/JavaScriptCore/interpreter/CachedCall.h76
-rw-r--r--Source/JavaScriptCore/interpreter/CallFrame.cpp53
-rw-r--r--Source/JavaScriptCore/interpreter/CallFrame.h167
-rw-r--r--Source/JavaScriptCore/interpreter/CallFrameClosure.h60
-rw-r--r--Source/JavaScriptCore/interpreter/Interpreter.cpp4921
-rw-r--r--Source/JavaScriptCore/interpreter/Interpreter.h170
-rw-r--r--Source/JavaScriptCore/interpreter/Register.h218
-rw-r--r--Source/JavaScriptCore/interpreter/RegisterFile.cpp93
-rw-r--r--Source/JavaScriptCore/interpreter/RegisterFile.h211
-rw-r--r--Source/JavaScriptCore/jit/ExecutableAllocator.cpp128
-rw-r--r--Source/JavaScriptCore/jit/ExecutableAllocator.h362
-rw-r--r--Source/JavaScriptCore/jit/ExecutableAllocatorFixedVMPool.cpp470
-rw-r--r--Source/JavaScriptCore/jit/JIT.cpp670
-rw-r--r--Source/JavaScriptCore/jit/JIT.h1046
-rw-r--r--Source/JavaScriptCore/jit/JITArithmetic.cpp1244
-rw-r--r--Source/JavaScriptCore/jit/JITArithmetic32_64.cpp1424
-rw-r--r--Source/JavaScriptCore/jit/JITCall.cpp261
-rw-r--r--Source/JavaScriptCore/jit/JITCall32_64.cpp356
-rw-r--r--Source/JavaScriptCore/jit/JITCode.h117
-rw-r--r--Source/JavaScriptCore/jit/JITInlineMethods.h809
-rw-r--r--Source/JavaScriptCore/jit/JITOpcodes.cpp1775
-rw-r--r--Source/JavaScriptCore/jit/JITOpcodes32_64.cpp1834
-rw-r--r--Source/JavaScriptCore/jit/JITPropertyAccess.cpp1101
-rw-r--r--Source/JavaScriptCore/jit/JITPropertyAccess32_64.cpp1186
-rw-r--r--Source/JavaScriptCore/jit/JITStubCall.h237
-rw-r--r--Source/JavaScriptCore/jit/JITStubs.cpp3638
-rw-r--r--Source/JavaScriptCore/jit/JITStubs.h416
-rw-r--r--Source/JavaScriptCore/jit/JSInterfaceJIT.h292
-rw-r--r--Source/JavaScriptCore/jit/SpecializedThunkJIT.h165
-rw-r--r--Source/JavaScriptCore/jit/ThunkGenerators.cpp162
-rw-r--r--Source/JavaScriptCore/jit/ThunkGenerators.h45
-rw-r--r--Source/JavaScriptCore/jsc.cpp568
-rw-r--r--Source/JavaScriptCore/jsc.pro41
-rwxr-xr-xSource/JavaScriptCore/make-generated-sources.sh12
-rw-r--r--Source/JavaScriptCore/os-win32/WinMain.cpp81
-rw-r--r--Source/JavaScriptCore/os-win32/inttypes.h261
-rw-r--r--Source/JavaScriptCore/os-win32/stdbool.h45
-rw-r--r--Source/JavaScriptCore/os-win32/stdint.h67
-rw-r--r--Source/JavaScriptCore/parser/ASTBuilder.h967
-rw-r--r--Source/JavaScriptCore/parser/JSParser.cpp1907
-rw-r--r--Source/JavaScriptCore/parser/JSParser.h164
-rw-r--r--Source/JavaScriptCore/parser/Keywords.table72
-rw-r--r--Source/JavaScriptCore/parser/Lexer.cpp1196
-rw-r--r--Source/JavaScriptCore/parser/Lexer.h158
-rw-r--r--Source/JavaScriptCore/parser/NodeConstructors.h908
-rw-r--r--Source/JavaScriptCore/parser/NodeInfo.h63
-rw-r--r--Source/JavaScriptCore/parser/Nodes.cpp196
-rw-r--r--Source/JavaScriptCore/parser/Nodes.h1617
-rw-r--r--Source/JavaScriptCore/parser/Parser.cpp85
-rw-r--r--Source/JavaScriptCore/parser/Parser.h128
-rw-r--r--Source/JavaScriptCore/parser/ParserArena.cpp125
-rw-r--r--Source/JavaScriptCore/parser/ParserArena.h130
-rw-r--r--Source/JavaScriptCore/parser/ResultType.h182
-rw-r--r--Source/JavaScriptCore/parser/SourceCode.h92
-rw-r--r--Source/JavaScriptCore/parser/SourceProvider.h87
-rw-r--r--Source/JavaScriptCore/parser/SyntaxChecker.h217
-rw-r--r--Source/JavaScriptCore/pcre/AUTHORS12
-rw-r--r--Source/JavaScriptCore/pcre/COPYING35
-rwxr-xr-xSource/JavaScriptCore/pcre/dftables273
-rw-r--r--Source/JavaScriptCore/pcre/pcre.h68
-rw-r--r--Source/JavaScriptCore/pcre/pcre.pri12
-rw-r--r--Source/JavaScriptCore/pcre/pcre_compile.cpp2708
-rw-r--r--Source/JavaScriptCore/pcre/pcre_exec.cpp2177
-rw-r--r--Source/JavaScriptCore/pcre/pcre_internal.h455
-rw-r--r--Source/JavaScriptCore/pcre/pcre_tables.cpp72
-rw-r--r--Source/JavaScriptCore/pcre/pcre_ucp_searchfuncs.cpp99
-rw-r--r--Source/JavaScriptCore/pcre/pcre_xclass.cpp115
-rw-r--r--Source/JavaScriptCore/pcre/ucpinternal.h126
-rw-r--r--Source/JavaScriptCore/pcre/ucptable.cpp2968
-rw-r--r--Source/JavaScriptCore/profiler/CallIdentifier.h100
-rw-r--r--Source/JavaScriptCore/profiler/Profile.cpp136
-rw-r--r--Source/JavaScriptCore/profiler/Profile.h72
-rw-r--r--Source/JavaScriptCore/profiler/ProfileGenerator.cpp181
-rw-r--r--Source/JavaScriptCore/profiler/ProfileGenerator.h79
-rw-r--r--Source/JavaScriptCore/profiler/ProfileNode.cpp351
-rw-r--r--Source/JavaScriptCore/profiler/ProfileNode.h172
-rw-r--r--Source/JavaScriptCore/profiler/Profiler.cpp172
-rw-r--r--Source/JavaScriptCore/profiler/Profiler.h77
-rw-r--r--Source/JavaScriptCore/profiler/ProfilerServer.h35
-rw-r--r--Source/JavaScriptCore/profiler/ProfilerServer.mm115
-rw-r--r--Source/JavaScriptCore/qt/ChangeLog447
-rw-r--r--Source/JavaScriptCore/qt/api/QtScript.pro51
-rw-r--r--Source/JavaScriptCore/qt/api/qscriptconverter_p.h146
-rw-r--r--Source/JavaScriptCore/qt/api/qscriptengine.cpp426
-rw-r--r--Source/JavaScriptCore/qt/api/qscriptengine.h82
-rw-r--r--Source/JavaScriptCore/qt/api/qscriptengine_p.cpp167
-rw-r--r--Source/JavaScriptCore/qt/api/qscriptengine_p.h259
-rw-r--r--Source/JavaScriptCore/qt/api/qscriptfunction.cpp145
-rw-r--r--Source/JavaScriptCore/qt/api/qscriptfunction_p.h57
-rw-r--r--Source/JavaScriptCore/qt/api/qscriptoriginalglobalobject_p.h209
-rw-r--r--Source/JavaScriptCore/qt/api/qscriptprogram.cpp136
-rw-r--r--Source/JavaScriptCore/qt/api/qscriptprogram.h53
-rw-r--r--Source/JavaScriptCore/qt/api/qscriptprogram_p.h133
-rw-r--r--Source/JavaScriptCore/qt/api/qscriptstring.cpp131
-rw-r--r--Source/JavaScriptCore/qt/api/qscriptstring.h58
-rw-r--r--Source/JavaScriptCore/qt/api/qscriptstring_p.h124
-rw-r--r--Source/JavaScriptCore/qt/api/qscriptsyntaxcheckresult.cpp148
-rw-r--r--Source/JavaScriptCore/qt/api/qscriptsyntaxcheckresult.h50
-rw-r--r--Source/JavaScriptCore/qt/api/qscriptsyntaxcheckresult_p.h73
-rw-r--r--Source/JavaScriptCore/qt/api/qscriptvalue.cpp802
-rw-r--r--Source/JavaScriptCore/qt/api/qscriptvalue.h140
-rw-r--r--Source/JavaScriptCore/qt/api/qscriptvalue_p.h1220
-rw-r--r--Source/JavaScriptCore/qt/api/qscriptvalueiterator.cpp226
-rw-r--r--Source/JavaScriptCore/qt/api/qscriptvalueiterator.h63
-rw-r--r--Source/JavaScriptCore/qt/api/qscriptvalueiterator_p.h172
-rw-r--r--Source/JavaScriptCore/qt/api/qtscriptglobal.h43
-rw-r--r--Source/JavaScriptCore/qt/benchmarks/benchmarks.pri19
-rw-r--r--Source/JavaScriptCore/qt/benchmarks/benchmarks.pro4
-rw-r--r--Source/JavaScriptCore/qt/benchmarks/qscriptengine/qscriptengine.pro13
-rw-r--r--Source/JavaScriptCore/qt/benchmarks/qscriptengine/tst_qscriptengine.cpp142
-rw-r--r--Source/JavaScriptCore/qt/benchmarks/qscriptvalue/qscriptvalue.pro9
-rw-r--r--Source/JavaScriptCore/qt/benchmarks/qscriptvalue/tst_qscriptvalue.cpp442
-rw-r--r--Source/JavaScriptCore/qt/tests/qscriptengine/qscriptengine.pro8
-rw-r--r--Source/JavaScriptCore/qt/tests/qscriptengine/tst_qscriptengine.cpp734
-rw-r--r--Source/JavaScriptCore/qt/tests/qscriptstring/qscriptstring.pro7
-rw-r--r--Source/JavaScriptCore/qt/tests/qscriptstring/tst_qscriptstring.cpp175
-rw-r--r--Source/JavaScriptCore/qt/tests/qscriptvalue/qscriptvalue.pro15
-rw-r--r--Source/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue.cpp1296
-rw-r--r--Source/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue.h143
-rw-r--r--Source/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue_generated_comparison.cpp1799
-rw-r--r--Source/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue_generated_init.cpp169
-rw-r--r--Source/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue_generated_istype.cpp622
-rw-r--r--Source/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue_generated_totype.cpp1786
-rw-r--r--Source/JavaScriptCore/qt/tests/qscriptvalueiterator/qscriptvalueiterator.pro7
-rw-r--r--Source/JavaScriptCore/qt/tests/qscriptvalueiterator/tst_qscriptvalueiterator.cpp531
-rw-r--r--Source/JavaScriptCore/qt/tests/tests.pri19
-rw-r--r--Source/JavaScriptCore/qt/tests/tests.pro5
-rw-r--r--Source/JavaScriptCore/runtime/ArgList.cpp79
-rw-r--r--Source/JavaScriptCore/runtime/ArgList.h245
-rw-r--r--Source/JavaScriptCore/runtime/Arguments.cpp352
-rw-r--r--Source/JavaScriptCore/runtime/Arguments.h255
-rw-r--r--Source/JavaScriptCore/runtime/ArrayConstructor.cpp100
-rw-r--r--Source/JavaScriptCore/runtime/ArrayConstructor.h40
-rw-r--r--Source/JavaScriptCore/runtime/ArrayPrototype.cpp1098
-rw-r--r--Source/JavaScriptCore/runtime/ArrayPrototype.h50
-rw-r--r--Source/JavaScriptCore/runtime/BatchedTransitionOptimizer.h55
-rw-r--r--Source/JavaScriptCore/runtime/BooleanConstructor.cpp79
-rw-r--r--Source/JavaScriptCore/runtime/BooleanConstructor.h44
-rw-r--r--Source/JavaScriptCore/runtime/BooleanObject.cpp35
-rw-r--r--Source/JavaScriptCore/runtime/BooleanObject.h51
-rw-r--r--Source/JavaScriptCore/runtime/BooleanPrototype.cpp86
-rw-r--r--Source/JavaScriptCore/runtime/BooleanPrototype.h35
-rw-r--r--Source/JavaScriptCore/runtime/CachedTranscendentalFunction.h103
-rw-r--r--Source/JavaScriptCore/runtime/CallData.cpp41
-rw-r--r--Source/JavaScriptCore/runtime/CallData.h65
-rw-r--r--Source/JavaScriptCore/runtime/ClassInfo.h62
-rw-r--r--Source/JavaScriptCore/runtime/Collector.cpp1100
-rw-r--r--Source/JavaScriptCore/runtime/Collector.h336
-rw-r--r--Source/JavaScriptCore/runtime/CollectorHeapIterator.h140
-rw-r--r--Source/JavaScriptCore/runtime/CommonIdentifiers.cpp40
-rw-r--r--Source/JavaScriptCore/runtime/CommonIdentifiers.h106
-rw-r--r--Source/JavaScriptCore/runtime/Completion.cpp76
-rw-r--r--Source/JavaScriptCore/runtime/Completion.h63
-rw-r--r--Source/JavaScriptCore/runtime/ConstructData.cpp42
-rw-r--r--Source/JavaScriptCore/runtime/ConstructData.h64
-rw-r--r--Source/JavaScriptCore/runtime/DateConstructor.cpp203
-rw-r--r--Source/JavaScriptCore/runtime/DateConstructor.h43
-rw-r--r--Source/JavaScriptCore/runtime/DateConversion.cpp105
-rw-r--r--Source/JavaScriptCore/runtime/DateConversion.h63
-rw-r--r--Source/JavaScriptCore/runtime/DateInstance.cpp87
-rw-r--r--Source/JavaScriptCore/runtime/DateInstance.h82
-rw-r--r--Source/JavaScriptCore/runtime/DateInstanceCache.h94
-rw-r--r--Source/JavaScriptCore/runtime/DatePrototype.cpp1094
-rw-r--r--Source/JavaScriptCore/runtime/DatePrototype.h52
-rw-r--r--Source/JavaScriptCore/runtime/Error.cpp211
-rw-r--r--Source/JavaScriptCore/runtime/Error.h78
-rw-r--r--Source/JavaScriptCore/runtime/ErrorConstructor.cpp68
-rw-r--r--Source/JavaScriptCore/runtime/ErrorConstructor.h42
-rw-r--r--Source/JavaScriptCore/runtime/ErrorInstance.cpp54
-rw-r--r--Source/JavaScriptCore/runtime/ErrorInstance.h53
-rw-r--r--Source/JavaScriptCore/runtime/ErrorPrototype.cpp65
-rw-r--r--Source/JavaScriptCore/runtime/ErrorPrototype.h37
-rw-r--r--Source/JavaScriptCore/runtime/ExceptionHelpers.cpp145
-rw-r--r--Source/JavaScriptCore/runtime/ExceptionHelpers.h62
-rw-r--r--Source/JavaScriptCore/runtime/Executable.cpp313
-rw-r--r--Source/JavaScriptCore/runtime/Executable.h410
-rw-r--r--Source/JavaScriptCore/runtime/FunctionConstructor.cpp119
-rw-r--r--Source/JavaScriptCore/runtime/FunctionConstructor.h44
-rw-r--r--Source/JavaScriptCore/runtime/FunctionPrototype.cpp150
-rw-r--r--Source/JavaScriptCore/runtime/FunctionPrototype.h46
-rw-r--r--Source/JavaScriptCore/runtime/GCActivityCallback.cpp54
-rw-r--r--Source/JavaScriptCore/runtime/GCActivityCallback.h72
-rw-r--r--Source/JavaScriptCore/runtime/GCActivityCallbackCF.cpp98
-rw-r--r--Source/JavaScriptCore/runtime/GCHandle.cpp86
-rw-r--r--Source/JavaScriptCore/runtime/GCHandle.h116
-rw-r--r--Source/JavaScriptCore/runtime/GetterSetter.cpp46
-rw-r--r--Source/JavaScriptCore/runtime/GetterSetter.h74
-rw-r--r--Source/JavaScriptCore/runtime/GlobalEvalFunction.cpp48
-rw-r--r--Source/JavaScriptCore/runtime/GlobalEvalFunction.h54
-rw-r--r--Source/JavaScriptCore/runtime/Identifier.cpp312
-rw-r--r--Source/JavaScriptCore/runtime/Identifier.h148
-rw-r--r--Source/JavaScriptCore/runtime/InitializeThreading.cpp78
-rw-r--r--Source/JavaScriptCore/runtime/InitializeThreading.h40
-rw-r--r--Source/JavaScriptCore/runtime/InternalFunction.cpp77
-rw-r--r--Source/JavaScriptCore/runtime/InternalFunction.h70
-rw-r--r--Source/JavaScriptCore/runtime/JSAPIValueWrapper.cpp31
-rw-r--r--Source/JavaScriptCore/runtime/JSAPIValueWrapper.h62
-rw-r--r--Source/JavaScriptCore/runtime/JSActivation.cpp223
-rw-r--r--Source/JavaScriptCore/runtime/JSActivation.h115
-rw-r--r--Source/JavaScriptCore/runtime/JSArray.cpp1322
-rw-r--r--Source/JavaScriptCore/runtime/JSArray.h284
-rw-r--r--Source/JavaScriptCore/runtime/JSByteArray.cpp116
-rw-r--r--Source/JavaScriptCore/runtime/JSByteArray.h116
-rw-r--r--Source/JavaScriptCore/runtime/JSCell.cpp217
-rw-r--r--Source/JavaScriptCore/runtime/JSCell.h376
-rw-r--r--Source/JavaScriptCore/runtime/JSFunction.cpp343
-rw-r--r--Source/JavaScriptCore/runtime/JSFunction.h123
-rw-r--r--Source/JavaScriptCore/runtime/JSGlobalData.cpp365
-rw-r--r--Source/JavaScriptCore/runtime/JSGlobalData.h269
-rw-r--r--Source/JavaScriptCore/runtime/JSGlobalObject.cpp476
-rw-r--r--Source/JavaScriptCore/runtime/JSGlobalObject.h484
-rw-r--r--Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp600
-rw-r--r--Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.h62
-rw-r--r--Source/JavaScriptCore/runtime/JSImmediate.cpp26
-rw-r--r--Source/JavaScriptCore/runtime/JSImmediate.h568
-rw-r--r--Source/JavaScriptCore/runtime/JSLock.cpp260
-rw-r--r--Source/JavaScriptCore/runtime/JSLock.h106
-rw-r--r--Source/JavaScriptCore/runtime/JSNotAnObject.cpp122
-rw-r--r--Source/JavaScriptCore/runtime/JSNotAnObject.h79
-rw-r--r--Source/JavaScriptCore/runtime/JSNumberCell.cpp38
-rw-r--r--Source/JavaScriptCore/runtime/JSNumberCell.h171
-rw-r--r--Source/JavaScriptCore/runtime/JSONObject.cpp877
-rw-r--r--Source/JavaScriptCore/runtime/JSONObject.h61
-rw-r--r--Source/JavaScriptCore/runtime/JSObject.cpp722
-rw-r--r--Source/JavaScriptCore/runtime/JSObject.h771
-rw-r--r--Source/JavaScriptCore/runtime/JSObjectWithGlobalObject.cpp46
-rw-r--r--Source/JavaScriptCore/runtime/JSObjectWithGlobalObject.h58
-rw-r--r--Source/JavaScriptCore/runtime/JSPropertyNameIterator.cpp108
-rw-r--r--Source/JavaScriptCore/runtime/JSPropertyNameIterator.h109
-rw-r--r--Source/JavaScriptCore/runtime/JSStaticScopeObject.cpp82
-rw-r--r--Source/JavaScriptCore/runtime/JSStaticScopeObject.h72
-rw-r--r--Source/JavaScriptCore/runtime/JSString.cpp328
-rw-r--r--Source/JavaScriptCore/runtime/JSString.h647
-rw-r--r--Source/JavaScriptCore/runtime/JSStringBuilder.h134
-rw-r--r--Source/JavaScriptCore/runtime/JSType.h44
-rw-r--r--Source/JavaScriptCore/runtime/JSTypeInfo.h80
-rw-r--r--Source/JavaScriptCore/runtime/JSValue.cpp197
-rw-r--r--Source/JavaScriptCore/runtime/JSValue.h770
-rw-r--r--Source/JavaScriptCore/runtime/JSVariableObject.cpp71
-rw-r--r--Source/JavaScriptCore/runtime/JSVariableObject.h169
-rw-r--r--Source/JavaScriptCore/runtime/JSWrapperObject.cpp36
-rw-r--r--Source/JavaScriptCore/runtime/JSWrapperObject.h69
-rw-r--r--Source/JavaScriptCore/runtime/JSZombie.cpp48
-rw-r--r--Source/JavaScriptCore/runtime/JSZombie.h77
-rw-r--r--Source/JavaScriptCore/runtime/LiteralParser.cpp462
-rw-r--r--Source/JavaScriptCore/runtime/LiteralParser.h110
-rw-r--r--Source/JavaScriptCore/runtime/Lookup.cpp96
-rw-r--r--Source/JavaScriptCore/runtime/Lookup.h338
-rw-r--r--Source/JavaScriptCore/runtime/MarkStack.cpp40
-rw-r--r--Source/JavaScriptCore/runtime/MarkStack.h190
-rw-r--r--Source/JavaScriptCore/runtime/MarkStackPosix.cpp43
-rw-r--r--Source/JavaScriptCore/runtime/MarkStackSymbian.cpp38
-rw-r--r--Source/JavaScriptCore/runtime/MarkStackWin.cpp44
-rw-r--r--Source/JavaScriptCore/runtime/MathObject.cpp241
-rw-r--r--Source/JavaScriptCore/runtime/MathObject.h49
-rw-r--r--Source/JavaScriptCore/runtime/MemoryStatistics.cpp55
-rw-r--r--Source/JavaScriptCore/runtime/MemoryStatistics.h46
-rw-r--r--Source/JavaScriptCore/runtime/NativeErrorConstructor.cpp71
-rw-r--r--Source/JavaScriptCore/runtime/NativeErrorConstructor.h51
-rw-r--r--Source/JavaScriptCore/runtime/NativeErrorPrototype.cpp42
-rw-r--r--Source/JavaScriptCore/runtime/NativeErrorPrototype.h36
-rw-r--r--Source/JavaScriptCore/runtime/NativeFunctionWrapper.h39
-rw-r--r--Source/JavaScriptCore/runtime/NumberConstructor.cpp129
-rw-r--r--Source/JavaScriptCore/runtime/NumberConstructor.h59
-rw-r--r--Source/JavaScriptCore/runtime/NumberObject.cpp51
-rw-r--r--Source/JavaScriptCore/runtime/NumberObject.h52
-rw-r--r--Source/JavaScriptCore/runtime/NumberPrototype.cpp310
-rw-r--r--Source/JavaScriptCore/runtime/NumberPrototype.h35
-rw-r--r--Source/JavaScriptCore/runtime/NumericStrings.h98
-rw-r--r--Source/JavaScriptCore/runtime/ObjectConstructor.cpp320
-rw-r--r--Source/JavaScriptCore/runtime/ObjectConstructor.h41
-rw-r--r--Source/JavaScriptCore/runtime/ObjectPrototype.cpp165
-rw-r--r--Source/JavaScriptCore/runtime/ObjectPrototype.h43
-rw-r--r--Source/JavaScriptCore/runtime/Operations.cpp111
-rw-r--r--Source/JavaScriptCore/runtime/Operations.h489
-rw-r--r--Source/JavaScriptCore/runtime/PropertyDescriptor.cpp195
-rw-r--r--Source/JavaScriptCore/runtime/PropertyDescriptor.h80
-rw-r--r--Source/JavaScriptCore/runtime/PropertyMapHashTable.h90
-rw-r--r--Source/JavaScriptCore/runtime/PropertyNameArray.cpp53
-rw-r--r--Source/JavaScriptCore/runtime/PropertyNameArray.h99
-rw-r--r--Source/JavaScriptCore/runtime/PropertySlot.cpp40
-rw-r--r--Source/JavaScriptCore/runtime/PropertySlot.h268
-rw-r--r--Source/JavaScriptCore/runtime/Protect.h215
-rw-r--r--Source/JavaScriptCore/runtime/PrototypeFunction.cpp57
-rw-r--r--Source/JavaScriptCore/runtime/PrototypeFunction.h45
-rw-r--r--Source/JavaScriptCore/runtime/PutPropertySlot.h80
-rw-r--r--Source/JavaScriptCore/runtime/RegExp.cpp248
-rw-r--r--Source/JavaScriptCore/runtime/RegExp.h86
-rw-r--r--Source/JavaScriptCore/runtime/RegExpCache.cpp77
-rw-r--r--Source/JavaScriptCore/runtime/RegExpCache.h68
-rw-r--r--Source/JavaScriptCore/runtime/RegExpConstructor.cpp361
-rw-r--r--Source/JavaScriptCore/runtime/RegExpConstructor.h133
-rw-r--r--Source/JavaScriptCore/runtime/RegExpKey.h120
-rw-r--r--Source/JavaScriptCore/runtime/RegExpMatchesArray.h94
-rw-r--r--Source/JavaScriptCore/runtime/RegExpObject.cpp177
-rw-r--r--Source/JavaScriptCore/runtime/RegExpObject.h87
-rw-r--r--Source/JavaScriptCore/runtime/RegExpPrototype.cpp127
-rw-r--r--Source/JavaScriptCore/runtime/RegExpPrototype.h36
-rw-r--r--Source/JavaScriptCore/runtime/RopeImpl.cpp62
-rw-r--r--Source/JavaScriptCore/runtime/RopeImpl.h97
-rw-r--r--Source/JavaScriptCore/runtime/ScopeChain.cpp68
-rw-r--r--Source/JavaScriptCore/runtime/ScopeChain.h242
-rw-r--r--Source/JavaScriptCore/runtime/ScopeChainMark.h36
-rw-r--r--Source/JavaScriptCore/runtime/SmallStrings.cpp142
-rw-r--r--Source/JavaScriptCore/runtime/SmallStrings.h78
-rw-r--r--Source/JavaScriptCore/runtime/StrictEvalActivation.cpp51
-rw-r--r--Source/JavaScriptCore/runtime/StrictEvalActivation.h43
-rw-r--r--Source/JavaScriptCore/runtime/StringConstructor.cpp96
-rw-r--r--Source/JavaScriptCore/runtime/StringConstructor.h40
-rw-r--r--Source/JavaScriptCore/runtime/StringObject.cpp99
-rw-r--r--Source/JavaScriptCore/runtime/StringObject.h69
-rw-r--r--Source/JavaScriptCore/runtime/StringObjectThatMasqueradesAsUndefined.h57
-rw-r--r--Source/JavaScriptCore/runtime/StringPrototype.cpp1155
-rw-r--r--Source/JavaScriptCore/runtime/StringPrototype.h43
-rw-r--r--Source/JavaScriptCore/runtime/Structure.cpp1270
-rw-r--r--Source/JavaScriptCore/runtime/Structure.h296
-rw-r--r--Source/JavaScriptCore/runtime/StructureChain.cpp49
-rw-r--r--Source/JavaScriptCore/runtime/StructureChain.h53
-rw-r--r--Source/JavaScriptCore/runtime/StructureTransitionTable.h71
-rw-r--r--Source/JavaScriptCore/runtime/SymbolTable.h133
-rw-r--r--Source/JavaScriptCore/runtime/Terminator.h47
-rw-r--r--Source/JavaScriptCore/runtime/TimeoutChecker.cpp158
-rw-r--r--Source/JavaScriptCore/runtime/TimeoutChecker.h86
-rw-r--r--Source/JavaScriptCore/runtime/Tracing.d40
-rw-r--r--Source/JavaScriptCore/runtime/Tracing.h50
-rw-r--r--Source/JavaScriptCore/runtime/UString.cpp366
-rw-r--r--Source/JavaScriptCore/runtime/UString.h263
-rw-r--r--Source/JavaScriptCore/runtime/UStringBuilder.h43
-rw-r--r--Source/JavaScriptCore/runtime/UStringConcatenate.h125
-rw-r--r--Source/JavaScriptCore/runtime/WeakGCMap.h123
-rw-r--r--Source/JavaScriptCore/runtime/WeakGCPtr.h153
-rw-r--r--Source/JavaScriptCore/runtime/WeakRandom.h86
-rw-r--r--Source/JavaScriptCore/shell/CMakeLists.txt25
-rw-r--r--Source/JavaScriptCore/shell/CMakeListsEfl.txt8
-rw-r--r--Source/JavaScriptCore/shell/CMakeListsWinCE.txt3
-rw-r--r--Source/JavaScriptCore/tests/mozilla/Getopt/Mixed.pm754
-rw-r--r--Source/JavaScriptCore/tests/mozilla/Makefile3
-rw-r--r--Source/JavaScriptCore/tests/mozilla/README-jsDriver.html344
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4-1.js126
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4-2.js83
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.1.1.js88
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.1.2.js98
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.1.3.js86
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.1.js133
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.2.1-1.js92
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.2.1-2.js83
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.2.1-3.js112
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.2.2-1.js124
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.2.2-2.js89
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.2.3.js74
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.3.1-2.js66
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.3.2.js57
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.3.js63
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.4.1.js57
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.4.2.js83
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.4.3-1.js159
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.4.4-1.js272
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.4.4-2.js163
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.4.5-1.js223
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.4.5-2.js224
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.4.5-3.js181
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.4.js77
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.5.1-1.js172
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.5.1-2.js150
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.5.2-1.js93
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.5.2-2.js123
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.1.js96
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.2.js160
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.3.1-1.js72
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.3.1-2.js69
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.3.1-3.js69
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.3.1-4.js79
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.3.1-5.js61
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.3.1.js72
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.3.js67
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4-1.js73
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4-2.js67
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.1.js65
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.2-1.js97
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.2-2.js79
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.2-3.js67
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.2-4-n.js70
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.3-1.js91
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.3-2.js67
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.3-3.js71
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.3-4-n.js71
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.3.js97
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.js77
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.1.1-1.js87
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.1.1-2.js82
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.1.js108
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.2-1.js105
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.2-2.js99
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.2-3.js92
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.2-4.js85
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.2-5.js78
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.2-6.js72
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.1-1.js274
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.1-2.js231
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.1-3.js209
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.1-4.js193
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.1-5.js170
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.2-1.js241
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.2-2.js219
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.2-3.js205
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.2-4.js188
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.2-5.js170
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.8-1.js300
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.8-2.js275
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.8-3.js253
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.8-4.js222
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.8-5.js190
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.4.2-1.js63
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.4.2.js213
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.4.3.js209
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.1.js59
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-1.js115
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-10.js102
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-11.js101
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-12.js100
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-13.js97
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-2.js110
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-3.js109
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-4.js107
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-5.js107
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-6.js106
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-7.js105
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-8.js104
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-9.js103
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-1.js99
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-2.js96
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-3.js95
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-4.js95
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-5.js95
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-6.js96
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-7.js98
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-1.js110
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-2.js104
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-3.js103
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-4.js102
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-5.js101
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-6.js100
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-7.js98
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-8.js95
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-1.js78
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-2.js75
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-3.js75
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-4.js75
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-5.js75
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-6.js78
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-7.js80
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-8.js95
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.14.js96
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.15.js97
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.16.js96
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.17.js97
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.18.js97
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.19.js97
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.2-1.js152
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.2-2-n.js77
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.2.js152
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.20.js97
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-1.js97
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-2.js95
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-3.js78
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-4.js78
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-5.js78
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-6.js79
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-7.js78
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-8.js86
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-1.js100
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-2.js99
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-3.js98
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-4.js97
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-5.js96
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-6.js95
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-7.js93
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-8.js90
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-1.js157
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-10.js156
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-11.js155
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-12.js153
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-13.js150
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-14.js148
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-15.js144
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-16.js143
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-17.js142
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-18.js139
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-2.js111
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-3-n.js70
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-4.js122
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-5.js122
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-6.js122
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-7.js122
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-8.js111
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-9.js112
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-1.js151
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-2.js150
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-3.js149
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-4.js148
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-5.js141
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-6.js140
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-7.js139
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-8.js135
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.25-1.js190
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.26-1.js203
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.27-1.js202
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.28-1.js216
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.29-1.js210
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.3-1-n.js73
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.3-2.js107
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.30-1.js215
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.31-1.js212
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.32-1.js157
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.33-1.js156
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.34-1.js220
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.35-1.js143
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-1.js245
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-2.js231
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-3.js218
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-4.js205
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-5.js192
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-6.js179
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-7.js164
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.37-1.js235
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.37-2.js209
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.37-3.js195
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.37-4.js177
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.37-5.js160
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.4-1.js96
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.4-2-n.js67
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.5.js123
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.6.js114
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.7.js114
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.8.js120
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.9.js120
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.js81
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.3-1.js107
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.3.js160
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.4-1.js100
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.4-10.js94
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.4-2.js102
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.4-3.js98
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.4-4.js101
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.4-5.js101
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.4-6.js83
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.4-7.js100
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.4-8.js101
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.4-9.js98
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.5-1.js118
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.5-2.js101
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.5-3.js119
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.5-4.js94
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.6.js124
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.8-1.js132
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.8-2.js117
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.2.1.js82
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.2.2-1.js119
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.2.2-2.js105
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.2.3-1.js83
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.2.3-2.js89
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.1.1.js135
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.10-1.js270
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.10-2.js269
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.10-3.js268
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.12-1.js86
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.12-2-n.js71
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.12-3.js71
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.12-4.js71
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.13.1.js70
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.13.2-1.js122
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.13.2-2.js136
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.13.2-3.js149
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.13.2-4.js137
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.13.2-5.js137
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.13.js86
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.14-1.js73
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.1-1.js268
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.1-2.js124
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.1-3-n.js120
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.1-4-n.js120
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.1-5.js124
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-1-n.js98
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-1.js99
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-10-n.js96
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-11.js99
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-2-n.js98
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-3-n.js98
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-4-n.js98
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-5-n.js98
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-6-n.js81
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-7-n.js98
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-8-n.js98
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-9-n.js98
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.3-1.js121
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.3-2-n.js90
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.3-3-n.js81
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.3-4-n.js81
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.3-5.js81
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.3.1.js154
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.3.2.js154
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.4.1.js95
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.4.2.js85
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.4.3.js109
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.4.4.js156
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.4.5.js154
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.4.6.js299
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.4.8.js215
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.4.9.js90
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.5.1.js115
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.5.2.js154
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.5.3.js160
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.6.1-1.js211
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.6.1-2.js203
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.6.1-3.js181
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.6.2-1.js199
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.6.3.js116
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.7.1.js229
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.7.2.js246
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.7.3.js230
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.8.1.js121
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.8.2.js122
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.8.3.js120
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.8.4.js122
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.9.1.js162
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.9.2.js161
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.9.3.js161
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.1.1-1.js90
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.1.1-2.js118
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.1.1-3.js96
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.2.1-1.js94
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.2.1-2.js111
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.2.1-3.js96
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.3.1-1.js62
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.3.1-2.js70
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.3.1-3.js79
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.3.1-4.js70
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.3.2.js60
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.4-1.js80
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.4.1.js62
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.4.js79
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.5-1.js118
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.5-2.js92
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.5.1.js80
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.5.3.js75
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1-1-n.js65
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1-2-n.js63
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.1.1.js65
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.1.2.js66
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.1-1.js91
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.1-2.js66
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.2-1.js291
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.2-2.js232
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.3-1.js444
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.3-2.js295
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.4.js206
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.5-1.js207
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.5-2.js184
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.5-3.js207
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.6.js127
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.7.js131
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.1-1.js86
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.1-2.js74
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.1-3.js92
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.2-1.js75
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.2-2-n.js80
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.2-3-n.js83
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.2-4-n.js82
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.2-5-n.js85
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.2-6.js70
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-1.js79
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-10.js67
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-11.js66
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-12.js66
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-13-n.js66
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-2.js67
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-3.js67
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-4.js67
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-5.js66
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-6.js68
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-7.js68
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-8.js67
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-9.js66
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.1-1-n.js71
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.1-2-n.js70
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.1-3-n.js70
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-1-n.js76
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-10-n.js76
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-11-n.js76
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-12-n.js77
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-13-n.js76
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-14-n.js76
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-15-n.js77
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-16-n.js76
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-2-n.js75
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-3-n.js75
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-4-n.js76
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-5-n.js76
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-6-n.js76
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-7-n.js73
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-8-n.js73
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-9-n.js76
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-1-n.js71
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-10-n.js71
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-11-n.js70
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-12-n.js72
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-13-n.js72
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-14-n.js70
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-15-n.js72
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-16-n.js69
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-2-n.js72
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-3-n.js72
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-4-n.js72
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-5-n.js70
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-6-n.js70
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-7-n.js70
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-8-n.js70
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-9-n.js70
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.5-1.js65
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.5-10-n.js70
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.5-2-n.js65
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.5-3-n.js65
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.5-4-n.js65
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.5-5-n.js65
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.5-6.js65
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.5-7.js65
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.5-8-n.js65
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.5-9-n.js70
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.6.js309
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.7.1.js72
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.7.2.js75
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.7.3-1.js197
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.7.3-2.js93
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.7.3.js337
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.7.4.js275
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.8.2-n.js48
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8-1.js84
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8-2-n.js83
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8-3-n.js81
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.1-1.js62
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.1-2.js65
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.2-1.js62
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.2-2.js63
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.3-1.js63
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.3-2.js69
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.4-1.js64
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.4-2.js65
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.5-1.js67
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.5-2.js66
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.6-1.js63
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.6-2.js64
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.7-1.js64
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.7-2.js64
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.8-1.js64
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.8-2.js63
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.8-3.js61
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.js86
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.1.js103
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.10.js86
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.11.js98
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.12.js96
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.13.js132
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.14.js83
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.15.js113
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.16.js78
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.17.js99
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.18.js98
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.2.js86
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.3.js90
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.4.js88
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.5.js105
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.6.js108
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.7.js111
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.8.js84
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.9.js105
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/NativeObjects/15-1.js95
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/NativeObjects/15-2.js78
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.1.js90
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.2.js173
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.1-1.js68
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.1-2.js75
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.1-3.js70
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.2-1.js63
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.2-2.js64
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.2-3.js66
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.2-4.js66
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.3-1.js64
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.3-2.js66
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.3-3.js67
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.3-4.js69
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.4-1.js63
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.4-2.js67
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.4-3.js71
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.4-4.js71
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.5-1.js61
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.5-2.js72
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.5-3.js67
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.5-4.js68
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.6-1.js60
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.6-2.js64
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.6-3.js68
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.6-4.js66
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.js68
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.4-1.js63
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.4.1.js64
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.4.2-1.js80
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.4.2-2-n.js70
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.4.2-3-n.js68
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.4.2-4.js68
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.4.3-1.js72
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.4.3-2.js63
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.4.3-3-n.js66
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.4.js86
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.1.1.js151
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.1.2.js85
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.2.1.js139
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.2.2.js81
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.3-1.js65
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.3.1-1.js68
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.3.1-2.js70
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.3.1-3.js69
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.3.1-4.js70
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.3.js68
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.4.1.js63
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.4.2.js128
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.4.3.js115
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.4.js60
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/SourceText/6-1.js124
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/SourceText/6-2.js129
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.10-1.js151
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.10.js64
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.2-1.js70
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.5-1.js98
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.5-2.js96
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.1-1.js68
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.2-1.js75
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.2-2.js76
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.2-3.js67
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.2-4.js66
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.2-5.js71
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.2-6.js75
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.2-7.js72
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.2-8.js69
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.2-9-n.js65
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-1.js71
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-10.js112
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-11.js93
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-12.js100
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-19.js114
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-2.js66
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-3.js70
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-4.js193
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-5-n.js102
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-6-n.js102
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-7-n.js102
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-8-n.js102
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-9-n.js102
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.7-1-n.js67
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.8-1-n.js69
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.9-1-n.js64
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.1.js137
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.2.js112
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.3.1-1.js73
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.3.1-2.js70
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.3.1-3.js67
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.3.1-4.js68
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.3.2-1.js195
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.3.2-2.js80
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.3.2-3.js122
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.3.js74
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.1.js66
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.10-1.js218
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.11-1.js514
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.11-2.js633
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.11-3.js509
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.11-4.js508
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.11-5.js514
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.11-6.js511
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.12-1.js527
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.12-2.js514
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.12-3.js556
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.12-4.js511
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.12-5.js523
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.2-1.js70
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.2-2-n.js74
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.2-3.js87
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.2.js92
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.3-1.js70
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.3-2.js89
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.3-3-n.js72
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.4-1.js87
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.4-2.js141
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.4-3.js117
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.4-4.js159
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.5-1.js89
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.5-2.js128
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.5-3.js136
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.5-4.js80
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.5-5.js111
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.5-6.js97
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.6-1.js158
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.6-2.js259
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.7-1.js221
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.7-2.js220
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.7-3.js166
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.8-1.js234
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.8-2.js248
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.8-3.js205
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.9-1.js202
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.js74
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.5.1.js90
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.2.js111
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.3-1.js96
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.3.1-1.js323
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.3.1-2.js89
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.3.1-3.js726
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.3.js89
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.4-1.js120
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.4-2.js120
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.5-2.js171
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.6.js139
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.7.js158
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.8.1.js166
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.9-1.js143
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Types/8.1.js71
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Types/8.4.js125
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/Types/8.6.2.1-1.js105
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/browser.js80
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/jsref.js669
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma/shell.js712
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/boolean-001.js43
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/boolean-002.js47
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/date-001.js57
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/date-002.js51
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/date-003.js53
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/date-004.js47
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-001.js42
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-002.js42
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-003.js46
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-004.js42
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-005.js42
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-006.js53
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-007.js54
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-008.js41
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-009.js50
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-010-n.js36
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-011-n.js35
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-001.js47
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-002.js57
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-003.js52
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-004.js46
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-005.js38
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-006.js43
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-007.js41
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-008.js38
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-009.js39
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-010.js40
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-011.js40
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-012.js41
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-013.js41
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-014.js43
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-015.js37
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-016.js37
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-017.js37
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-019.js41
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/function-001.js64
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/global-001.js43
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/global-002.js43
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-001.js49
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-002.js49
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-003.js41
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-004.js49
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-005.js50
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-006.js55
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-007.js48
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-008.js50
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-009.js49
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-010.js48
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-011.js50
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-012.js50
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-013.js49
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-014.js50
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-015.js50
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-016.js48
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-017.js50
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-018.js50
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-019.js50
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-020.js50
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-021.js50
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-022.js50
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-023.js49
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-024.js56
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-025.js56
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-026.js56
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-027.js58
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-028.js56
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-029.js56
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-030.js56
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-031.js56
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-032.js56
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-033.js56
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-034.js55
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-035.js56
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-036.js56
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-037.js56
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-038.js56
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-039.js43
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-040.js43
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-041.js45
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-042.js46
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-047.js47
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-048.js41
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-049.js46
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-050.js42
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-051.js42
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-052.js44
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-053.js42
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-054.js43
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/number-001.js52
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/number-002.js45
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/number-003.js47
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/statement-001.js44
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/statement-002.js66
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/statement-003.js77
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/statement-004.js49
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/statement-005.js48
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/statement-006.js48
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/statement-007.js39
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/statement-008.js39
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/statement-009.js38
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/string-001.js50
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/string-002.js49
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Expressions/StrictEquality-001.js70
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Expressions/instanceof-001.js117
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Expressions/instanceof-002.js124
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Expressions/instanceof-003-n.js93
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Expressions/instanceof-004-n.js92
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Expressions/instanceof-005-n.js84
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Expressions/instanceof-006.js83
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/FunctionObjects/apply-001-n.js39
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/FunctionObjects/call-1.js40
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/LexicalConventions/keywords-001.js31
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/LexicalConventions/regexp-literals-001.js38
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/LexicalConventions/regexp-literals-002.js22
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/constructor-001.js66
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/exec-001.js34
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/exec-002.js182
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/function-001.js66
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/hex-001.js63
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/multiline-001.js62
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/octal-001.js72
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/octal-002.js87
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/octal-003.js81
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/properties-001.js85
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/properties-002.js125
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/regexp-enumerate-001.js98
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/regress-001.js39
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/unicode-001.js53
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/dowhile-001.js41
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/dowhile-002.js68
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/dowhile-003.js60
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/dowhile-004.js64
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/dowhile-005.js70
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/dowhile-006.js86
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/dowhile-007.js94
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/forin-001.js294
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/forin-002.js73
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/if-001.js39
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/label-001.js39
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/label-002.js53
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/switch-001.js64
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/switch-002.js60
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/switch-003.js54
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/switch-004.js91
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/try-001.js82
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/try-003.js79
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/try-004.js51
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/try-005.js54
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/try-006.js84
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/try-007.js89
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/try-008.js56
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/try-009.js63
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/try-010.js70
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/try-012.js92
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/while-001.js39
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/while-002.js83
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/while-003.js84
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/while-004.js214
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/String/match-001.js100
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/String/match-002.js168
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/String/match-003.js126
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/String/match-004.js167
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/String/replace-001.js60
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/String/split-001.js106
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/String/split-002.js264
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/String/split-003.js117
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/browser.js83
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/instanceof/instanceof-001.js31
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/instanceof/instanceof-002.js61
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/instanceof/instanceof-003.js57
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/instanceof/regress-7635.js70
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/jsref.js629
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/shell.js216
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/template.js39
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/Array/15.4.4.3-1.js66
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/Array/15.4.4.4-001.js148
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/Array/regress-101488.js151
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/Array/regress-130451.js214
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/Date/15.9.5.3.js149
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/Date/15.9.5.4.js194
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/Date/15.9.5.5.js94
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/Date/15.9.5.6.js149
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/Date/15.9.5.7.js211
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/Date/shell.js676
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.1.1.js132
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.4.4-1.js169
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.7.6-001.js125
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.7.6-002.js120
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.7.6-003.js120
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/binding-001.js106
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/regress-181654.js150
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/regress-181914.js189
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/regress-58946.js56
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/regress-95101.js97
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/ExecutionContexts/10.1.3-1.js196
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/ExecutionContexts/10.1.3-2.js157
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/ExecutionContexts/10.1.3.js55
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/ExecutionContexts/10.1.4-1.js58
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/ExecutionContexts/regress-23346.js53
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/Expressions/11.6.1-1.js171
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/Expressions/11.9.6-1.js208
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/FunExpr/fe-001-n.js37
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/FunExpr/fe-001.js39
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/FunExpr/fe-002.js43
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/Function/15.3.4.3-1.js205
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/Function/15.3.4.4-1.js180
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/Function/arguments-001.js148
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/Function/call-001.js131
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-104584.js56
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-131964.js191
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-137181.js108
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-193555.js131
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-49286.js116
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-58274.js221
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-85880.js152
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-94506.js142
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-97921.js131
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/Function/scope-001.js249
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/Function/scope-002.js224
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/Number/15.7.4.5-1.js124
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/Number/15.7.4.6-1.js113
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/Number/15.7.4.7-1.js118
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/NumberFormatting/tostring-001.js42
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/Object/8.6.2.6-001.js108
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/Object/class-001.js128
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/Object/class-002.js124
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/Object/class-003.js118
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/Object/class-004.js117
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/Object/class-005.js102
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/Object/regress-72773.js75
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/Object/regress-79129-001.js58
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/Object/shell.js81
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/Operators/11.13.1-001.js147
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/Operators/11.4.1-001.js115
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.2-1.js176
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.3.1-1.js115
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.3.1-2.js123
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.4.1-1.js111
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.4.1-2.js117
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.4.1-3.js124
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.4.1-4.js130
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.4.1-5-n.js113
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.6.2-1.js119
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.6.2-2.js362
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/octal-001.js131
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/octal-002.js213
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/perlstress-001.js3225
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/perlstress-002.js1837
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-100199.js286
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-103087.js155
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-105972.js136
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-119909.js86
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-122076.js103
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-123437.js107
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-165353.js117
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-169497.js100
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-169534.js90
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-187133.js137
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-188206.js282
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-191479.js193
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-202564.js96
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-209067.js1101
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-209919.js169
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-216591.js112
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-220367-001.js99
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-220367-002.js107
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-24712.js42
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-28686.js39
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-31316.js75
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-57572.js129
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-57631.js128
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-67773.js190
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-72964.js100
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-76683.js93
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-78156.js102
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-85721.js271
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-87231.js124
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-98306.js77
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/shell.js230
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-121744.js212
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-131348.js179
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-157509.js106
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-194364.js134
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-74474-001.js118
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-74474-002.js9076
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-74474-003.js9078
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-83532-001.js48
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-83532-002.js51
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/switch-001.js122
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/String/regress-104375.js95
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/String/regress-189898.js152
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/String/regress-83293.js193
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-001-n.js44
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-001.js38
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-002-n.js38
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-002.js42
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-003.js53
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-004.js47
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-005.js271
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_3/shell.js180
-rw-r--r--Source/JavaScriptCore/tests/mozilla/expected.html461
-rw-r--r--Source/JavaScriptCore/tests/mozilla/importList.html69
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_1/browser.js80
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_1/jsref.js170
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_1/regress/function-001.js76
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_1/shell.js143
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/Array/array_split_1.js72
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/Array/general1.js62
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/Array/general2.js78
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/Array/slice.js123
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/Array/splice1.js152
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/Array/splice2.js150
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/Array/tostring_1.js138
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/Array/tostring_2.js96
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/Objects/toString-001.js117
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/String/charCodeAt.js71
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/String/concat.js96
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/String/match.js62
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/String/slice.js123
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/browser.js83
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/function/Function_object.js85
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/function/Number.js98
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/function/String.js99
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/function/definition-1.js73
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/function/function-001-n.js74
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/function/length.js93
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/function/nesting-1.js61
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/function/nesting.js83
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/function/regexparg-1.js98
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/function/regexparg-2-n.js66
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/function/tostring-1.js143
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/function/tostring-2.js185
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/jsref.js215
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/operator/equality.js72
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/operator/strictEquality.js92
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_dollar_number.js108
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_input.js102
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_input_as_array.js102
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_lastIndex.js83
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_lastMatch.js85
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_lastMatch_as_array.js85
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_lastParen.js100
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_lastParen_as_array.js100
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_leftContext.js90
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_leftContext_as_array.js90
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_multiline.js129
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_multiline_as_array.js129
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_object.js88
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_rightContext.js90
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_rightContext_as_array.js90
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/regexp/alphanumeric.js129
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/regexp/asterisk.js105
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/regexp/backslash.js79
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/regexp/backspace.js79
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/regexp/beginLine.js80
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/regexp/character_class.js107
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/regexp/compile.js94
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/regexp/control_characters.js71
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/regexp/digit.js119
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/regexp/dot.js95
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/regexp/endLine.js80
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/regexp/everything.js80
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/regexp/exec.js77
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/regexp/flags.js84
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/regexp/global.js95
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/regexp/hexadecimal.js108
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/regexp/ignoreCase.js111
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/regexp/interval.js115
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/regexp/octal.js108
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/regexp/parentheses.js107
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/regexp/plus.js87
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/regexp/question_mark.js99
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/regexp/regress-6359.js68
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/regexp/regress-9141.js86
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/regexp/simple_form.js90
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/regexp/source.js87
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/regexp/special_characters.js157
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/regexp/string_replace.js80
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/regexp/string_search.js87
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/regexp/string_split.js91
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/regexp/test.js87
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/regexp/toString.js75
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/regexp/vertical_bar.js95
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/regexp/whitespace.js122
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/regexp/word_boundary.js119
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/regress/regress-144834.js76
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/regress/regress-7703.js83
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/shell.js147
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/statements/break.js162
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/statements/continue.js175
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/statements/do_while.js68
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/statements/switch.js127
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/statements/switch2.js188
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/version120/boolean-001.js73
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/version120/regress-99663.js172
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_2/version120/shell.js24
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_3/Boolean/boolean-001.js73
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_3/Script/delete-001.js79
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_3/Script/function-001-n.js74
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_3/Script/function-002.js75
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_3/Script/in-001.js52
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_3/Script/new-001.js120
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_3/Script/script-001.js159
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_3/Script/switch-001.js80
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_1.js166
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_10.js152
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_11.js115
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_12.js142
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_2.js122
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_3.js103
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_4.js156
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_5.js146
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_6.js171
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_7.js125
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_8.js123
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_9.js101
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_3/jsref.js198
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_3/regress/delete-001.js79
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_3/regress/function-001-n.js74
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_3/regress/function-002.js75
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_3/regress/in-001.js66
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_3/regress/new-001.js120
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_3/regress/switch-001.js80
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_3/shell.js163
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_3/template.js44
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_4/Eval/eval-001.js75
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_4/Eval/eval-002.js80
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_4/Eval/eval-003.js85
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_4/Functions/function-001.js106
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_4/Regress/date-001-n.js55
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_4/Regress/function-001.js79
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_4/Regress/function-002.js123
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_4/Regress/function-003.js77
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_4/Regress/function-004-n.js51
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_4/Regress/regress-7224.js72
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_4/Regress/toString-001-n.js53
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_4/browser.js80
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_4/jsref.js169
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_4/shell.js138
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Array/array-001.js101
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Array/regress-101964.js98
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Array/regress-107138.js190
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Array/regress-108440.js103
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Array/regress-154338.js119
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Array/regress-157652.js136
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Array/regress-178722.js175
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Array/regress-94257.js99
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Exceptions/catchguard-001-n.js57
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Exceptions/catchguard-001.js64
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Exceptions/catchguard-002-n.js46
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Exceptions/catchguard-002.js60
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Exceptions/catchguard-003-n.js53
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Exceptions/catchguard-003.js69
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Exceptions/errstack-001.js274
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Exceptions/regress-121658.js152
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Exceptions/regress-123002.js129
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Exceptions/regress-50447.js146
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Expressions/regress-192288.js114
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Expressions/regress-96526-argsub.js120
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Expressions/regress-96526-delelem.js120
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Expressions/regress-96526-noargsub.js120
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Expressions/shell.js113
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/GetSet/getset-001.js72
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/GetSet/getset-002.js68
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/GetSet/getset-003.js190
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/GetSet/getset-004.js190
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/GetSet/getset-005.js199
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/GetSet/getset-006.js173
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/LexicalConventions/lexical-001.js161
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/LexicalConventions/regress-177314.js105
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Object/regress-137000.js235
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Object/regress-192105.js178
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Object/regress-90596-001.js278
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Object/regress-90596-002.js278
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Object/regress-90596-003.js290
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Object/regress-96284-001.js161
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Object/regress-96284-002.js161
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-102725.js77
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-103602.js162
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-104077.js635
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-110286.js151
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-111557.js10960
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-114491.js101
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-114493.js109
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-118849.js181
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-127557.js113
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-131510-001.js68
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-140974.js135
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-146596.js154
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-152646.js121
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-156354.js126
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-159334.js124
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-168347.js215
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-170193.js106
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-172699.js94
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-179524.js363
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-185165.js96
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-191633.js102
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-191668.js99
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-192414.js117
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-192465.js152
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-193418.js99
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-203402.js90
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-203841.js159
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-204210.js143
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-210682.js96
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-216320.js1033
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-31255.js108
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-39309.js105
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-44009.js63
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-57043.js88
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-68498-001.js56
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-68498-002.js80
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-68498-003.js84
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-68498-004.js112
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-69607.js53
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-71107.js60
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-76054.js139
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-80981.js3137
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-82306.js59
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-89443.js2130
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-89474.js62
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-90445.js306
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-96128-n.js64
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-96526-001.js530
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-96526-002.js56
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-96526-003.js4431
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-154693.js96
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-181834.js178
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-184107.js124
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-185485.js158
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-191276.js123
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-192226.js120
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-202678-001.js131
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-202678-002.js132
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-208496-001.js169
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-208496-002.js161
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-220362.js111
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-220584.js132
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-77578-001.js154
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Scope/scope-001.js110
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Scope/scope-002.js121
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Scope/scope-003.js122
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/Scope/scope-004.js204
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/String/regress-107771.js104
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/String/regress-179068.js154
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_5/shell.js180
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_6/Array/browser.js1
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_6/Array/regress-290592.js693
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_6/Array/regress-304828.js270
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_6/Array/regress-305002.js56
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_6/Array/regress-310425-01.js58
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_6/Array/regress-310425-02.js48
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_6/Array/regress-320887.js55
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_6/Array/shell.js1
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_6/README1
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_6/Regress/browser.js1
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_6/Regress/regress-301574.js67
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_6/Regress/regress-309242.js75
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_6/Regress/regress-311157-01.js55
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_6/Regress/regress-311157-02.js55
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_6/Regress/regress-314887.js51
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_6/Regress/regress-320172.js56
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_6/Regress/shell.js1
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_6/String/browser.js1
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_6/String/regress-306591.js95
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_6/String/shell.js1
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_6/browser.js147
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_6/shell.js477
-rw-r--r--Source/JavaScriptCore/tests/mozilla/js1_6/template.js57
-rw-r--r--Source/JavaScriptCore/tests/mozilla/jsDriver.pl1335
-rw-r--r--Source/JavaScriptCore/tests/mozilla/menufoot.html8
-rw-r--r--Source/JavaScriptCore/tests/mozilla/menuhead.html138
-rw-r--r--Source/JavaScriptCore/tests/mozilla/mkhtml.pl84
-rw-r--r--Source/JavaScriptCore/tests/mozilla/mklistpage.pl261
-rw-r--r--Source/JavaScriptCore/tests/mozilla/runtests.pl495
-rw-r--r--Source/JavaScriptCore/tests/mozilla/template.js55
-rw-r--r--Source/JavaScriptCore/tests/perf/bench-allocate-nonretained.js6
-rw-r--r--Source/JavaScriptCore/tests/perf/bench-allocate-retained.js10
-rw-r--r--Source/JavaScriptCore/wscript84
-rw-r--r--Source/JavaScriptCore/wtf/ASCIICType.h179
-rw-r--r--Source/JavaScriptCore/wtf/AVLTree.h960
-rw-r--r--Source/JavaScriptCore/wtf/AlwaysInline.h75
-rw-r--r--Source/JavaScriptCore/wtf/Assertions.cpp249
-rw-r--r--Source/JavaScriptCore/wtf/Assertions.h336
-rw-r--r--Source/JavaScriptCore/wtf/Atomics.h117
-rw-r--r--Source/JavaScriptCore/wtf/Bitmap.h131
-rw-r--r--Source/JavaScriptCore/wtf/BumpPointerAllocator.h250
-rw-r--r--Source/JavaScriptCore/wtf/ByteArray.cpp39
-rw-r--r--Source/JavaScriptCore/wtf/ByteArray.h104
-rw-r--r--Source/JavaScriptCore/wtf/CMakeLists.txt154
-rw-r--r--Source/JavaScriptCore/wtf/CMakeListsEfl.txt46
-rw-r--r--Source/JavaScriptCore/wtf/CMakeListsWinCE.txt27
-rw-r--r--Source/JavaScriptCore/wtf/CONTRIBUTORS.pthreads-win32137
-rw-r--r--Source/JavaScriptCore/wtf/Complex.h49
-rw-r--r--Source/JavaScriptCore/wtf/CrossThreadRefCounted.h174
-rw-r--r--Source/JavaScriptCore/wtf/CurrentTime.cpp297
-rw-r--r--Source/JavaScriptCore/wtf/CurrentTime.h68
-rw-r--r--Source/JavaScriptCore/wtf/DateMath.cpp1154
-rw-r--r--Source/JavaScriptCore/wtf/DateMath.h231
-rw-r--r--Source/JavaScriptCore/wtf/DecimalNumber.cpp199
-rw-r--r--Source/JavaScriptCore/wtf/DecimalNumber.h108
-rw-r--r--Source/JavaScriptCore/wtf/Decoder.h57
-rw-r--r--Source/JavaScriptCore/wtf/Deque.h678
-rw-r--r--Source/JavaScriptCore/wtf/DisallowCType.h74
-rw-r--r--Source/JavaScriptCore/wtf/Encoder.h57
-rw-r--r--Source/JavaScriptCore/wtf/FastAllocBase.h416
-rw-r--r--Source/JavaScriptCore/wtf/FastMalloc.cpp4523
-rw-r--r--Source/JavaScriptCore/wtf/FastMalloc.h241
-rw-r--r--Source/JavaScriptCore/wtf/FixedArray.h58
-rw-r--r--Source/JavaScriptCore/wtf/Forward.h64
-rw-r--r--Source/JavaScriptCore/wtf/GetPtr.h33
-rw-r--r--Source/JavaScriptCore/wtf/HashCountedSet.h228
-rw-r--r--Source/JavaScriptCore/wtf/HashFunctions.h183
-rw-r--r--Source/JavaScriptCore/wtf/HashIterators.h216
-rw-r--r--Source/JavaScriptCore/wtf/HashMap.h410
-rw-r--r--Source/JavaScriptCore/wtf/HashSet.h259
-rw-r--r--Source/JavaScriptCore/wtf/HashTable.cpp69
-rw-r--r--Source/JavaScriptCore/wtf/HashTable.h1179
-rw-r--r--Source/JavaScriptCore/wtf/HashTraits.h115
-rw-r--r--Source/JavaScriptCore/wtf/ListHashSet.h617
-rw-r--r--Source/JavaScriptCore/wtf/ListRefPtr.h70
-rw-r--r--Source/JavaScriptCore/wtf/Locker.h47
-rw-r--r--Source/JavaScriptCore/wtf/MD5.cpp308
-rw-r--r--Source/JavaScriptCore/wtf/MD5.h61
-rw-r--r--Source/JavaScriptCore/wtf/MainThread.cpp239
-rw-r--r--Source/JavaScriptCore/wtf/MainThread.h71
-rw-r--r--Source/JavaScriptCore/wtf/MallocZoneSupport.h65
-rw-r--r--Source/JavaScriptCore/wtf/MathExtras.h215
-rw-r--r--Source/JavaScriptCore/wtf/MessageQueue.h218
-rw-r--r--Source/JavaScriptCore/wtf/NonCopyingSort.h89
-rw-r--r--Source/JavaScriptCore/wtf/Noncopyable.h63
-rw-r--r--Source/JavaScriptCore/wtf/NotFound.h37
-rw-r--r--Source/JavaScriptCore/wtf/NullPtr.cpp35
-rw-r--r--Source/JavaScriptCore/wtf/NullPtr.h52
-rw-r--r--Source/JavaScriptCore/wtf/OSAllocator.h100
-rw-r--r--Source/JavaScriptCore/wtf/OSAllocatorPosix.cpp121
-rw-r--r--Source/JavaScriptCore/wtf/OSAllocatorSymbian.cpp56
-rw-r--r--Source/JavaScriptCore/wtf/OSAllocatorWin.cpp80
-rw-r--r--Source/JavaScriptCore/wtf/OwnArrayPtr.h179
-rw-r--r--Source/JavaScriptCore/wtf/OwnArrayPtrCommon.h40
-rw-r--r--Source/JavaScriptCore/wtf/OwnFastMallocPtr.h52
-rw-r--r--Source/JavaScriptCore/wtf/OwnPtr.h178
-rw-r--r--Source/JavaScriptCore/wtf/OwnPtrCommon.h84
-rw-r--r--Source/JavaScriptCore/wtf/PageAllocation.h122
-rw-r--r--Source/JavaScriptCore/wtf/PageAllocationAligned.cpp87
-rw-r--r--Source/JavaScriptCore/wtf/PageAllocationAligned.h70
-rw-r--r--Source/JavaScriptCore/wtf/PageBlock.cpp84
-rw-r--r--Source/JavaScriptCore/wtf/PageBlock.h83
-rw-r--r--Source/JavaScriptCore/wtf/PageReservation.h141
-rw-r--r--Source/JavaScriptCore/wtf/PassOwnArrayPtr.h219
-rw-r--r--Source/JavaScriptCore/wtf/PassOwnPtr.h218
-rw-r--r--Source/JavaScriptCore/wtf/PassRefPtr.h313
-rw-r--r--Source/JavaScriptCore/wtf/Platform.h1149
-rw-r--r--Source/JavaScriptCore/wtf/PossiblyNull.h59
-rw-r--r--Source/JavaScriptCore/wtf/RandomNumber.cpp123
-rw-r--r--Source/JavaScriptCore/wtf/RandomNumber.h39
-rw-r--r--Source/JavaScriptCore/wtf/RandomNumberSeed.h81
-rw-r--r--Source/JavaScriptCore/wtf/RefCounted.h169
-rw-r--r--Source/JavaScriptCore/wtf/RefCountedLeakCounter.cpp100
-rw-r--r--Source/JavaScriptCore/wtf/RefCountedLeakCounter.h48
-rw-r--r--Source/JavaScriptCore/wtf/RefPtr.h231
-rw-r--r--Source/JavaScriptCore/wtf/RefPtrHashMap.h336
-rw-r--r--Source/JavaScriptCore/wtf/RetainPtr.h257
-rw-r--r--Source/JavaScriptCore/wtf/SegmentedVector.h255
-rw-r--r--Source/JavaScriptCore/wtf/SizeLimits.cpp57
-rw-r--r--Source/JavaScriptCore/wtf/StackBounds.cpp283
-rw-r--r--Source/JavaScriptCore/wtf/StackBounds.h114
-rw-r--r--Source/JavaScriptCore/wtf/StaticConstructors.h80
-rw-r--r--Source/JavaScriptCore/wtf/StdLibExtras.h119
-rw-r--r--Source/JavaScriptCore/wtf/StringExtras.cpp62
-rw-r--r--Source/JavaScriptCore/wtf/StringExtras.h127
-rw-r--r--Source/JavaScriptCore/wtf/StringHasher.h170
-rw-r--r--Source/JavaScriptCore/wtf/TCPackedCache.h234
-rw-r--r--Source/JavaScriptCore/wtf/TCPageMap.h316
-rw-r--r--Source/JavaScriptCore/wtf/TCSpinLock.h284
-rw-r--r--Source/JavaScriptCore/wtf/TCSystemAlloc.cpp521
-rw-r--r--Source/JavaScriptCore/wtf/TCSystemAlloc.h75
-rw-r--r--Source/JavaScriptCore/wtf/ThreadFunctionInvocation.h49
-rw-r--r--Source/JavaScriptCore/wtf/ThreadIdentifierDataPthreads.cpp97
-rw-r--r--Source/JavaScriptCore/wtf/ThreadIdentifierDataPthreads.h77
-rw-r--r--Source/JavaScriptCore/wtf/ThreadSafeShared.h148
-rw-r--r--Source/JavaScriptCore/wtf/ThreadSpecific.h329
-rw-r--r--Source/JavaScriptCore/wtf/ThreadSpecificWin.cpp54
-rw-r--r--Source/JavaScriptCore/wtf/Threading.cpp98
-rw-r--r--Source/JavaScriptCore/wtf/Threading.h118
-rw-r--r--Source/JavaScriptCore/wtf/ThreadingNone.cpp63
-rw-r--r--Source/JavaScriptCore/wtf/ThreadingPrimitives.h155
-rw-r--r--Source/JavaScriptCore/wtf/ThreadingPthreads.cpp388
-rw-r--r--Source/JavaScriptCore/wtf/ThreadingWin.cpp487
-rw-r--r--Source/JavaScriptCore/wtf/TypeTraits.cpp142
-rw-r--r--Source/JavaScriptCore/wtf/TypeTraits.h386
-rw-r--r--Source/JavaScriptCore/wtf/UnusedParam.h37
-rw-r--r--Source/JavaScriptCore/wtf/VMTags.h90
-rw-r--r--Source/JavaScriptCore/wtf/ValueCheck.h53
-rw-r--r--Source/JavaScriptCore/wtf/Vector.h1157
-rw-r--r--Source/JavaScriptCore/wtf/VectorTraits.h103
-rw-r--r--Source/JavaScriptCore/wtf/WTFThreadData.cpp58
-rw-r--r--Source/JavaScriptCore/wtf/WTFThreadData.h168
-rw-r--r--Source/JavaScriptCore/wtf/android/AndroidThreading.h39
-rw-r--r--Source/JavaScriptCore/wtf/android/MainThreadAndroid.cpp42
-rw-r--r--Source/JavaScriptCore/wtf/brew/MainThreadBrew.cpp45
-rw-r--r--Source/JavaScriptCore/wtf/brew/OwnPtrBrew.cpp81
-rw-r--r--Source/JavaScriptCore/wtf/brew/RefPtrBrew.h59
-rw-r--r--Source/JavaScriptCore/wtf/brew/ShellBrew.h70
-rw-r--r--Source/JavaScriptCore/wtf/brew/StringBrew.cpp43
-rw-r--r--Source/JavaScriptCore/wtf/brew/SystemMallocBrew.h65
-rw-r--r--Source/JavaScriptCore/wtf/chromium/ChromiumThreading.h44
-rw-r--r--Source/JavaScriptCore/wtf/chromium/MainThreadChromium.cpp73
-rw-r--r--Source/JavaScriptCore/wtf/dtoa.cpp1831
-rw-r--r--Source/JavaScriptCore/wtf/dtoa.h51
-rw-r--r--Source/JavaScriptCore/wtf/efl/MainThreadEfl.cpp57
-rw-r--r--Source/JavaScriptCore/wtf/gobject/GOwnPtr.cpp71
-rw-r--r--Source/JavaScriptCore/wtf/gobject/GOwnPtr.h143
-rw-r--r--Source/JavaScriptCore/wtf/gobject/GRefPtr.cpp86
-rw-r--r--Source/JavaScriptCore/wtf/gobject/GRefPtr.h229
-rw-r--r--Source/JavaScriptCore/wtf/gobject/GTypedefs.h98
-rw-r--r--Source/JavaScriptCore/wtf/gtk/MainThreadGtk.cpp52
-rw-r--r--Source/JavaScriptCore/wtf/gtk/ThreadingGtk.cpp248
-rw-r--r--Source/JavaScriptCore/wtf/haiku/MainThreadHaiku.cpp48
-rw-r--r--Source/JavaScriptCore/wtf/haiku/StringHaiku.cpp51
-rw-r--r--Source/JavaScriptCore/wtf/mac/MainThreadMac.mm144
-rw-r--r--Source/JavaScriptCore/wtf/qt/MainThreadQt.cpp77
-rw-r--r--Source/JavaScriptCore/wtf/qt/StringQt.cpp73
-rw-r--r--Source/JavaScriptCore/wtf/qt/ThreadingQt.cpp288
-rw-r--r--Source/JavaScriptCore/wtf/text/AtomicString.cpp389
-rw-r--r--Source/JavaScriptCore/wtf/text/AtomicString.h185
-rw-r--r--Source/JavaScriptCore/wtf/text/AtomicStringHash.h62
-rw-r--r--Source/JavaScriptCore/wtf/text/AtomicStringImpl.h38
-rw-r--r--Source/JavaScriptCore/wtf/text/CString.cpp104
-rw-r--r--Source/JavaScriptCore/wtf/text/CString.h87
-rw-r--r--Source/JavaScriptCore/wtf/text/StringBuffer.h86
-rw-r--r--Source/JavaScriptCore/wtf/text/StringBuilder.cpp172
-rw-r--r--Source/JavaScriptCore/wtf/text/StringBuilder.h139
-rw-r--r--Source/JavaScriptCore/wtf/text/StringConcatenate.h493
-rw-r--r--Source/JavaScriptCore/wtf/text/StringHash.h194
-rw-r--r--Source/JavaScriptCore/wtf/text/StringImpl.cpp1073
-rw-r--r--Source/JavaScriptCore/wtf/text/StringImpl.h408
-rw-r--r--Source/JavaScriptCore/wtf/text/StringImplBase.h103
-rw-r--r--Source/JavaScriptCore/wtf/text/StringStatics.cpp80
-rw-r--r--Source/JavaScriptCore/wtf/text/TextPosition.h150
-rw-r--r--Source/JavaScriptCore/wtf/text/WTFString.cpp1003
-rw-r--r--Source/JavaScriptCore/wtf/text/WTFString.h502
-rw-r--r--Source/JavaScriptCore/wtf/unicode/Collator.h67
-rw-r--r--Source/JavaScriptCore/wtf/unicode/CollatorDefault.cpp75
-rw-r--r--Source/JavaScriptCore/wtf/unicode/UTF8.cpp401
-rw-r--r--Source/JavaScriptCore/wtf/unicode/UTF8.h80
-rw-r--r--Source/JavaScriptCore/wtf/unicode/Unicode.h44
-rw-r--r--Source/JavaScriptCore/wtf/unicode/UnicodeMacrosFromICU.h100
-rw-r--r--Source/JavaScriptCore/wtf/unicode/brew/UnicodeBrew.cpp181
-rw-r--r--Source/JavaScriptCore/wtf/unicode/brew/UnicodeBrew.h194
-rw-r--r--Source/JavaScriptCore/wtf/unicode/glib/UnicodeGLib.cpp192
-rw-r--r--Source/JavaScriptCore/wtf/unicode/glib/UnicodeGLib.h243
-rw-r--r--Source/JavaScriptCore/wtf/unicode/icu/CollatorICU.cpp149
-rw-r--r--Source/JavaScriptCore/wtf/unicode/icu/UnicodeIcu.h235
-rw-r--r--Source/JavaScriptCore/wtf/unicode/qt4/UnicodeQt4.h375
-rw-r--r--Source/JavaScriptCore/wtf/unicode/wince/UnicodeWinCE.cpp181
-rw-r--r--Source/JavaScriptCore/wtf/unicode/wince/UnicodeWinCE.h177
-rw-r--r--Source/JavaScriptCore/wtf/url/api/ParsedURL.cpp90
-rw-r--r--Source/JavaScriptCore/wtf/url/api/ParsedURL.h62
-rw-r--r--Source/JavaScriptCore/wtf/url/api/URLString.h55
-rw-r--r--Source/JavaScriptCore/wtf/url/src/RawURLBuffer.h71
-rw-r--r--Source/JavaScriptCore/wtf/url/src/URLBuffer.h136
-rw-r--r--Source/JavaScriptCore/wtf/url/src/URLCharacterTypes.cpp173
-rw-r--r--Source/JavaScriptCore/wtf/url/src/URLCharacterTypes.h61
-rw-r--r--Source/JavaScriptCore/wtf/url/src/URLComponent.h77
-rw-r--r--Source/JavaScriptCore/wtf/url/src/URLEscape.cpp39
-rw-r--r--Source/JavaScriptCore/wtf/url/src/URLEscape.h49
-rw-r--r--Source/JavaScriptCore/wtf/url/src/URLParser.h575
-rw-r--r--Source/JavaScriptCore/wtf/url/src/URLQueryCanonicalizer.h107
-rw-r--r--Source/JavaScriptCore/wtf/url/src/URLSegments.cpp110
-rw-r--r--Source/JavaScriptCore/wtf/url/src/URLSegments.h105
-rw-r--r--Source/JavaScriptCore/wtf/url/wtfurl.gyp58
-rw-r--r--Source/JavaScriptCore/wtf/win/MainThreadWin.cpp90
-rw-r--r--Source/JavaScriptCore/wtf/win/OwnPtrWin.cpp76
-rw-r--r--Source/JavaScriptCore/wtf/wince/FastMallocWinCE.h175
-rw-r--r--Source/JavaScriptCore/wtf/wince/MemoryManager.cpp171
-rw-r--r--Source/JavaScriptCore/wtf/wince/MemoryManager.h80
-rw-r--r--Source/JavaScriptCore/wtf/wince/mt19937ar.c170
-rw-r--r--Source/JavaScriptCore/wtf/wtf.pri51
-rw-r--r--Source/JavaScriptCore/wtf/wx/MainThreadWx.cpp66
-rw-r--r--Source/JavaScriptCore/wtf/wx/StringWx.cpp75
-rw-r--r--Source/JavaScriptCore/yarr/RegexInterpreter.cpp1891
-rw-r--r--Source/JavaScriptCore/yarr/RegexInterpreter.h381
-rw-r--r--Source/JavaScriptCore/yarr/RegexJIT.cpp2213
-rw-r--r--Source/JavaScriptCore/yarr/RegexJIT.h90
-rw-r--r--Source/JavaScriptCore/yarr/RegexParser.h887
-rw-r--r--Source/JavaScriptCore/yarr/RegexPattern.cpp991
-rw-r--r--Source/JavaScriptCore/yarr/RegexPattern.h424
1928 files changed, 535558 insertions, 0 deletions
diff --git a/Source/JavaScriptCore/API/APICast.h b/Source/JavaScriptCore/API/APICast.h
new file mode 100644
index 0000000..4294d3d
--- /dev/null
+++ b/Source/JavaScriptCore/API/APICast.h
@@ -0,0 +1,153 @@
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef APICast_h
+#define APICast_h
+
+#include "JSAPIValueWrapper.h"
+#include "JSGlobalObject.h"
+#include "JSValue.h"
+#include <wtf/UnusedParam.h>
+
+namespace JSC {
+ class ExecState;
+ class PropertyNameArray;
+ class JSGlobalData;
+ class JSObject;
+ class JSValue;
+}
+
+typedef const struct OpaqueJSContextGroup* JSContextGroupRef;
+typedef const struct OpaqueJSContext* JSContextRef;
+typedef struct OpaqueJSContext* JSGlobalContextRef;
+typedef struct OpaqueJSPropertyNameAccumulator* JSPropertyNameAccumulatorRef;
+typedef const struct OpaqueJSValue* JSValueRef;
+typedef struct OpaqueJSValue* JSObjectRef;
+
+/* Opaque typing convenience methods */
+
+inline JSC::ExecState* toJS(JSContextRef c)
+{
+ ASSERT(c);
+ return reinterpret_cast<JSC::ExecState*>(const_cast<OpaqueJSContext*>(c));
+}
+
+inline JSC::ExecState* toJS(JSGlobalContextRef c)
+{
+ ASSERT(c);
+ return reinterpret_cast<JSC::ExecState*>(c);
+}
+
+inline JSC::JSValue toJS(JSC::ExecState* exec, JSValueRef v)
+{
+ ASSERT_UNUSED(exec, exec);
+ ASSERT(v);
+#if USE(JSVALUE32_64)
+ JSC::JSCell* jsCell = reinterpret_cast<JSC::JSCell*>(const_cast<OpaqueJSValue*>(v));
+ if (!jsCell)
+ return JSC::JSValue();
+ if (jsCell->isAPIValueWrapper())
+ return static_cast<JSC::JSAPIValueWrapper*>(jsCell)->value();
+ return jsCell;
+#else
+ return JSC::JSValue::decode(reinterpret_cast<JSC::EncodedJSValue>(const_cast<OpaqueJSValue*>(v)));
+#endif
+}
+
+inline JSC::JSValue toJSForGC(JSC::ExecState* exec, JSValueRef v)
+{
+ ASSERT_UNUSED(exec, exec);
+ ASSERT(v);
+#if USE(JSVALUE32_64)
+ JSC::JSCell* jsCell = reinterpret_cast<JSC::JSCell*>(const_cast<OpaqueJSValue*>(v));
+ if (!jsCell)
+ return JSC::JSValue();
+ return jsCell;
+#else
+ return JSC::JSValue::decode(reinterpret_cast<JSC::EncodedJSValue>(const_cast<OpaqueJSValue*>(v)));
+#endif
+}
+
+inline JSC::JSObject* toJS(JSObjectRef o)
+{
+ return reinterpret_cast<JSC::JSObject*>(o);
+}
+
+inline JSC::PropertyNameArray* toJS(JSPropertyNameAccumulatorRef a)
+{
+ return reinterpret_cast<JSC::PropertyNameArray*>(a);
+}
+
+inline JSC::JSGlobalData* toJS(JSContextGroupRef g)
+{
+ return reinterpret_cast<JSC::JSGlobalData*>(const_cast<OpaqueJSContextGroup*>(g));
+}
+
+inline JSValueRef toRef(JSC::ExecState* exec, JSC::JSValue v)
+{
+#if USE(JSVALUE32_64)
+ if (!v)
+ return 0;
+ if (!v.isCell())
+ return reinterpret_cast<JSValueRef>(JSC::jsAPIValueWrapper(exec, v).asCell());
+ return reinterpret_cast<JSValueRef>(v.asCell());
+#else
+ UNUSED_PARAM(exec);
+ return reinterpret_cast<JSValueRef>(JSC::JSValue::encode(v));
+#endif
+}
+
+inline JSObjectRef toRef(JSC::JSObject* o)
+{
+ return reinterpret_cast<JSObjectRef>(o);
+}
+
+inline JSObjectRef toRef(const JSC::JSObject* o)
+{
+ return reinterpret_cast<JSObjectRef>(const_cast<JSC::JSObject*>(o));
+}
+
+inline JSContextRef toRef(JSC::ExecState* e)
+{
+ return reinterpret_cast<JSContextRef>(e);
+}
+
+inline JSGlobalContextRef toGlobalRef(JSC::ExecState* e)
+{
+ ASSERT(e == e->lexicalGlobalObject()->globalExec());
+ return reinterpret_cast<JSGlobalContextRef>(e);
+}
+
+inline JSPropertyNameAccumulatorRef toRef(JSC::PropertyNameArray* l)
+{
+ return reinterpret_cast<JSPropertyNameAccumulatorRef>(l);
+}
+
+inline JSContextGroupRef toRef(JSC::JSGlobalData* g)
+{
+ return reinterpret_cast<JSContextGroupRef>(g);
+}
+
+#endif // APICast_h
diff --git a/Source/JavaScriptCore/API/APIShims.h b/Source/JavaScriptCore/API/APIShims.h
new file mode 100644
index 0000000..0b49d70
--- /dev/null
+++ b/Source/JavaScriptCore/API/APIShims.h
@@ -0,0 +1,101 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef APIShims_h
+#define APIShims_h
+
+#include "CallFrame.h"
+#include "GCActivityCallback.h"
+#include "JSLock.h"
+#include <wtf/WTFThreadData.h>
+
+namespace JSC {
+
+class APIEntryShimWithoutLock {
+protected:
+ APIEntryShimWithoutLock(JSGlobalData* globalData, bool registerThread)
+ : m_globalData(globalData)
+ , m_entryIdentifierTable(wtfThreadData().setCurrentIdentifierTable(globalData->identifierTable))
+ {
+ if (registerThread)
+ globalData->heap.registerThread();
+ m_globalData->heap.activityCallback()->synchronize();
+ m_globalData->timeoutChecker.start();
+ }
+
+ ~APIEntryShimWithoutLock()
+ {
+ m_globalData->timeoutChecker.stop();
+ wtfThreadData().setCurrentIdentifierTable(m_entryIdentifierTable);
+ }
+
+private:
+ JSGlobalData* m_globalData;
+ IdentifierTable* m_entryIdentifierTable;
+};
+
+class APIEntryShim : public APIEntryShimWithoutLock {
+public:
+ // Normal API entry
+ APIEntryShim(ExecState* exec, bool registerThread = true)
+ : APIEntryShimWithoutLock(&exec->globalData(), registerThread)
+ , m_lock(exec)
+ {
+ }
+
+ // JSPropertyNameAccumulator only has a globalData.
+ APIEntryShim(JSGlobalData* globalData, bool registerThread = true)
+ : APIEntryShimWithoutLock(globalData, registerThread)
+ , m_lock(globalData->isSharedInstance() ? LockForReal : SilenceAssertionsOnly)
+ {
+ }
+
+private:
+ JSLock m_lock;
+};
+
+class APICallbackShim {
+public:
+ APICallbackShim(ExecState* exec)
+ : m_dropAllLocks(exec)
+ , m_globalData(&exec->globalData())
+ {
+ wtfThreadData().resetCurrentIdentifierTable();
+ }
+
+ ~APICallbackShim()
+ {
+ m_globalData->heap.activityCallback()->synchronize();
+ wtfThreadData().setCurrentIdentifierTable(m_globalData->identifierTable);
+ }
+
+private:
+ JSLock::DropAllLocks m_dropAllLocks;
+ JSGlobalData* m_globalData;
+};
+
+}
+
+#endif
diff --git a/Source/JavaScriptCore/API/JSBase.cpp b/Source/JavaScriptCore/API/JSBase.cpp
new file mode 100644
index 0000000..c5f1b15
--- /dev/null
+++ b/Source/JavaScriptCore/API/JSBase.cpp
@@ -0,0 +1,113 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JSBase.h"
+#include "JSBasePrivate.h"
+
+#include "APICast.h"
+#include "APIShims.h"
+#include "Completion.h"
+#include "OpaqueJSString.h"
+#include "SourceCode.h"
+#include <interpreter/CallFrame.h>
+#include <runtime/InitializeThreading.h>
+#include <runtime/Completion.h>
+#include <runtime/JSGlobalObject.h>
+#include <runtime/JSLock.h>
+#include <runtime/JSObject.h>
+#include <wtf/text/StringHash.h>
+
+using namespace JSC;
+
+JSValueRef JSEvaluateScript(JSContextRef ctx, JSStringRef script, JSObjectRef thisObject, JSStringRef sourceURL, int startingLineNumber, JSValueRef* exception)
+{
+ ExecState* exec = toJS(ctx);
+ APIEntryShim entryShim(exec);
+
+ JSObject* jsThisObject = toJS(thisObject);
+
+ // evaluate sets "this" to the global object if it is NULL
+ JSGlobalObject* globalObject = exec->dynamicGlobalObject();
+ SourceCode source = makeSource(script->ustring(), sourceURL->ustring(), startingLineNumber);
+ Completion completion = evaluate(globalObject->globalExec(), globalObject->globalScopeChain(), source, jsThisObject);
+
+ if (completion.complType() == Throw) {
+ if (exception)
+ *exception = toRef(exec, completion.value());
+ return 0;
+ }
+
+ if (completion.value())
+ return toRef(exec, completion.value());
+
+ // happens, for example, when the only statement is an empty (';') statement
+ return toRef(exec, jsUndefined());
+}
+
+bool JSCheckScriptSyntax(JSContextRef ctx, JSStringRef script, JSStringRef sourceURL, int startingLineNumber, JSValueRef* exception)
+{
+ ExecState* exec = toJS(ctx);
+ APIEntryShim entryShim(exec);
+
+ SourceCode source = makeSource(script->ustring(), sourceURL->ustring(), startingLineNumber);
+ Completion completion = checkSyntax(exec->dynamicGlobalObject()->globalExec(), source);
+ if (completion.complType() == Throw) {
+ if (exception)
+ *exception = toRef(exec, completion.value());
+ return false;
+ }
+
+ return true;
+}
+
+void JSGarbageCollect(JSContextRef ctx)
+{
+ // We used to recommend passing NULL as an argument here, which caused the only heap to be collected.
+ // As there is no longer a shared heap, the previously recommended usage became a no-op (but the GC
+ // will happen when the context group is destroyed).
+ // Because the function argument was originally ignored, some clients may pass their released context here,
+ // in which case there is a risk of crashing if another thread performs GC on the same heap in between.
+ if (!ctx)
+ return;
+
+ ExecState* exec = toJS(ctx);
+ APIEntryShim entryShim(exec, false);
+
+ JSGlobalData& globalData = exec->globalData();
+ if (!globalData.heap.isBusy())
+ globalData.heap.collectAllGarbage();
+
+ // FIXME: Perhaps we should trigger a second mark and sweep
+ // once the garbage collector is done if this is called when
+ // the collector is busy.
+}
+
+void JSReportExtraMemoryCost(JSContextRef ctx, size_t size)
+{
+ ExecState* exec = toJS(ctx);
+ APIEntryShim entryShim(exec);
+ exec->globalData().heap.reportExtraMemoryCost(size);
+}
diff --git a/Source/JavaScriptCore/API/JSBase.h b/Source/JavaScriptCore/API/JSBase.h
new file mode 100644
index 0000000..2e16720
--- /dev/null
+++ b/Source/JavaScriptCore/API/JSBase.h
@@ -0,0 +1,132 @@
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef JSBase_h
+#define JSBase_h
+
+#ifndef __cplusplus
+#include <stdbool.h>
+#endif
+
+/* JavaScript engine interface */
+
+/*! @typedef JSContextGroupRef A group that associates JavaScript contexts with one another. Contexts in the same group may share and exchange JavaScript objects. */
+typedef const struct OpaqueJSContextGroup* JSContextGroupRef;
+
+/*! @typedef JSContextRef A JavaScript execution context. Holds the global object and other execution state. */
+typedef const struct OpaqueJSContext* JSContextRef;
+
+/*! @typedef JSGlobalContextRef A global JavaScript execution context. A JSGlobalContext is a JSContext. */
+typedef struct OpaqueJSContext* JSGlobalContextRef;
+
+/*! @typedef JSStringRef A UTF16 character buffer. The fundamental string representation in JavaScript. */
+typedef struct OpaqueJSString* JSStringRef;
+
+/*! @typedef JSClassRef A JavaScript class. Used with JSObjectMake to construct objects with custom behavior. */
+typedef struct OpaqueJSClass* JSClassRef;
+
+/*! @typedef JSPropertyNameArrayRef An array of JavaScript property names. */
+typedef struct OpaqueJSPropertyNameArray* JSPropertyNameArrayRef;
+
+/*! @typedef JSPropertyNameAccumulatorRef An ordered set used to collect the names of a JavaScript object's properties. */
+typedef struct OpaqueJSPropertyNameAccumulator* JSPropertyNameAccumulatorRef;
+
+
+/* JavaScript data types */
+
+/*! @typedef JSValueRef A JavaScript value. The base type for all JavaScript values, and polymorphic functions on them. */
+typedef const struct OpaqueJSValue* JSValueRef;
+
+/*! @typedef JSObjectRef A JavaScript object. A JSObject is a JSValue. */
+typedef struct OpaqueJSValue* JSObjectRef;
+
+/* JavaScript symbol exports */
+
+#undef JS_EXPORT
+#if defined(JS_NO_EXPORT)
+ #define JS_EXPORT
+#elif defined(__GNUC__) && !defined(__CC_ARM) && !defined(__ARMCC__)
+ #define JS_EXPORT __attribute__((visibility("default")))
+#elif defined(WIN32) || defined(_WIN32) || defined(_WIN32_WCE)
+ #if defined(BUILDING_JavaScriptCore) || defined(BUILDING_WTF)
+ #define JS_EXPORT __declspec(dllexport)
+ #else
+ #define JS_EXPORT __declspec(dllimport)
+ #endif
+#else
+ #define JS_EXPORT
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Script Evaluation */
+
+/*!
+@function JSEvaluateScript
+@abstract Evaluates a string of JavaScript.
+@param ctx The execution context to use.
+@param script A JSString containing the script to evaluate.
+@param thisObject The object to use as "this," or NULL to use the global object as "this."
+@param sourceURL A JSString containing a URL for the script's source file. This is only used when reporting exceptions. Pass NULL if you do not care to include source file information in exceptions.
+@param startingLineNumber An integer value specifying the script's starting line number in the file located at sourceURL. This is only used when reporting exceptions.
+@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.
+@result The JSValue that results from evaluating script, or NULL if an exception is thrown.
+*/
+JS_EXPORT JSValueRef JSEvaluateScript(JSContextRef ctx, JSStringRef script, JSObjectRef thisObject, JSStringRef sourceURL, int startingLineNumber, JSValueRef* exception);
+
+/*!
+@function JSCheckScriptSyntax
+@abstract Checks for syntax errors in a string of JavaScript.
+@param ctx The execution context to use.
+@param script A JSString containing the script to check for syntax errors.
+@param sourceURL A JSString containing a URL for the script's source file. This is only used when reporting exceptions. Pass NULL if you do not care to include source file information in exceptions.
+@param startingLineNumber An integer value specifying the script's starting line number in the file located at sourceURL. This is only used when reporting exceptions.
+@param exception A pointer to a JSValueRef in which to store a syntax error exception, if any. Pass NULL if you do not care to store a syntax error exception.
+@result true if the script is syntactically correct, otherwise false.
+*/
+JS_EXPORT bool JSCheckScriptSyntax(JSContextRef ctx, JSStringRef script, JSStringRef sourceURL, int startingLineNumber, JSValueRef* exception);
+
+/*!
+@function JSGarbageCollect
+@abstract Performs a JavaScript garbage collection.
+@param ctx The execution context to use.
+@discussion JavaScript values that are on the machine stack, in a register,
+ protected by JSValueProtect, set as the global object of an execution context,
+ or reachable from any such value will not be collected.
+
+ During JavaScript execution, you are not required to call this function; the
+ JavaScript engine will garbage collect as needed. JavaScript values created
+ within a context group are automatically destroyed when the last reference
+ to the context group is released.
+*/
+JS_EXPORT void JSGarbageCollect(JSContextRef ctx);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* JSBase_h */
diff --git a/Source/JavaScriptCore/API/JSBasePrivate.h b/Source/JavaScriptCore/API/JSBasePrivate.h
new file mode 100644
index 0000000..befa316
--- /dev/null
+++ b/Source/JavaScriptCore/API/JSBasePrivate.h
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2008 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef JSBasePrivate_h
+#define JSBasePrivate_h
+
+#include <JavaScriptCore/JSBase.h>
+#include <JavaScriptCore/WebKitAvailability.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*!
+@function
+@abstract Reports an object's non-GC memory payload to the garbage collector.
+@param ctx The execution context to use.
+@param size The payload's size, in bytes.
+@discussion Use this function to notify the garbage collector that a GC object
+owns a large non-GC memory region. Calling this function will encourage the
+garbage collector to collect soon, hoping to reclaim that large non-GC memory
+region.
+*/
+JS_EXPORT void JSReportExtraMemoryCost(JSContextRef ctx, size_t size) AVAILABLE_IN_WEBKIT_VERSION_4_0;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* JSBasePrivate_h */
diff --git a/Source/JavaScriptCore/API/JSCallbackConstructor.cpp b/Source/JavaScriptCore/API/JSCallbackConstructor.cpp
new file mode 100644
index 0000000..66c6b88
--- /dev/null
+++ b/Source/JavaScriptCore/API/JSCallbackConstructor.cpp
@@ -0,0 +1,89 @@
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JSCallbackConstructor.h"
+
+#include "APIShims.h"
+#include "APICast.h"
+#include <runtime/Error.h>
+#include <runtime/JSGlobalObject.h>
+#include <runtime/JSLock.h>
+#include <runtime/ObjectPrototype.h>
+#include <wtf/Vector.h>
+
+namespace JSC {
+
+const ClassInfo JSCallbackConstructor::info = { "CallbackConstructor", 0, 0, 0 };
+
+JSCallbackConstructor::JSCallbackConstructor(JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, JSClassRef jsClass, JSObjectCallAsConstructorCallback callback)
+ : JSObjectWithGlobalObject(globalObject, structure)
+ , m_class(jsClass)
+ , m_callback(callback)
+{
+ if (m_class)
+ JSClassRetain(jsClass);
+}
+
+JSCallbackConstructor::~JSCallbackConstructor()
+{
+ if (m_class)
+ JSClassRelease(m_class);
+}
+
+static EncodedJSValue JSC_HOST_CALL constructJSCallback(ExecState* exec)
+{
+ JSObject* constructor = exec->callee();
+ JSContextRef ctx = toRef(exec);
+ JSObjectRef constructorRef = toRef(constructor);
+
+ JSObjectCallAsConstructorCallback callback = static_cast<JSCallbackConstructor*>(constructor)->callback();
+ if (callback) {
+ int argumentCount = static_cast<int>(exec->argumentCount());
+ Vector<JSValueRef, 16> arguments(argumentCount);
+ for (int i = 0; i < argumentCount; i++)
+ arguments[i] = toRef(exec, exec->argument(i));
+
+ JSValueRef exception = 0;
+ JSObjectRef result;
+ {
+ APICallbackShim callbackShim(exec);
+ result = callback(ctx, constructorRef, argumentCount, arguments.data(), &exception);
+ }
+ if (exception)
+ throwError(exec, toJS(exec, exception));
+ return JSValue::encode(toJS(result));
+ }
+
+ return JSValue::encode(toJS(JSObjectMake(ctx, static_cast<JSCallbackConstructor*>(constructor)->classRef(), 0)));
+}
+
+ConstructType JSCallbackConstructor::getConstructData(ConstructData& constructData)
+{
+ constructData.native.function = constructJSCallback;
+ return ConstructTypeHost;
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/API/JSCallbackConstructor.h b/Source/JavaScriptCore/API/JSCallbackConstructor.h
new file mode 100644
index 0000000..a6d64cc
--- /dev/null
+++ b/Source/JavaScriptCore/API/JSCallbackConstructor.h
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef JSCallbackConstructor_h
+#define JSCallbackConstructor_h
+
+#include "JSObjectRef.h"
+#include <runtime/JSObjectWithGlobalObject.h>
+
+namespace JSC {
+
+class JSCallbackConstructor : public JSObjectWithGlobalObject {
+public:
+ JSCallbackConstructor(JSGlobalObject*, NonNullPassRefPtr<Structure>, JSClassRef, JSObjectCallAsConstructorCallback);
+ virtual ~JSCallbackConstructor();
+ JSClassRef classRef() const { return m_class; }
+ JSObjectCallAsConstructorCallback callback() const { return m_callback; }
+ static const ClassInfo info;
+
+ static PassRefPtr<Structure> createStructure(JSValue proto)
+ {
+ return Structure::create(proto, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount);
+ }
+
+protected:
+ static const unsigned StructureFlags = ImplementsHasInstance | JSObject::StructureFlags;
+
+private:
+ virtual ConstructType getConstructData(ConstructData&);
+ virtual const ClassInfo* classInfo() const { return &info; }
+
+ JSClassRef m_class;
+ JSObjectCallAsConstructorCallback m_callback;
+};
+
+} // namespace JSC
+
+#endif // JSCallbackConstructor_h
diff --git a/Source/JavaScriptCore/API/JSCallbackFunction.cpp b/Source/JavaScriptCore/API/JSCallbackFunction.cpp
new file mode 100644
index 0000000..c488aa6
--- /dev/null
+++ b/Source/JavaScriptCore/API/JSCallbackFunction.cpp
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JSCallbackFunction.h"
+
+#include "APIShims.h"
+#include "APICast.h"
+#include "CodeBlock.h"
+#include "ExceptionHelpers.h"
+#include "JSFunction.h"
+#include "FunctionPrototype.h"
+#include <runtime/JSGlobalObject.h>
+#include <runtime/JSLock.h>
+#include <wtf/Vector.h>
+
+namespace JSC {
+
+ASSERT_CLASS_FITS_IN_CELL(JSCallbackFunction);
+
+const ClassInfo JSCallbackFunction::info = { "CallbackFunction", &InternalFunction::info, 0, 0 };
+
+JSCallbackFunction::JSCallbackFunction(ExecState* exec, JSGlobalObject* globalObject, JSObjectCallAsFunctionCallback callback, const Identifier& name)
+ : InternalFunction(&exec->globalData(), globalObject, globalObject->callbackFunctionStructure(), name)
+ , m_callback(callback)
+{
+}
+
+EncodedJSValue JSCallbackFunction::call(ExecState* exec)
+{
+ JSContextRef execRef = toRef(exec);
+ JSObjectRef functionRef = toRef(exec->callee());
+ JSObjectRef thisObjRef = toRef(exec->hostThisValue().toThisObject(exec));
+
+ int argumentCount = static_cast<int>(exec->argumentCount());
+ Vector<JSValueRef, 16> arguments(argumentCount);
+ for (int i = 0; i < argumentCount; i++)
+ arguments[i] = toRef(exec, exec->argument(i));
+
+ JSValueRef exception = 0;
+ JSValueRef result;
+ {
+ APICallbackShim callbackShim(exec);
+ result = static_cast<JSCallbackFunction*>(toJS(functionRef))->m_callback(execRef, functionRef, thisObjRef, argumentCount, arguments.data(), &exception);
+ }
+ if (exception)
+ throwError(exec, toJS(exec, exception));
+
+ return JSValue::encode(toJS(exec, result));
+}
+
+CallType JSCallbackFunction::getCallData(CallData& callData)
+{
+ callData.native.function = call;
+ return CallTypeHost;
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/API/JSCallbackFunction.h b/Source/JavaScriptCore/API/JSCallbackFunction.h
new file mode 100644
index 0000000..b119b97
--- /dev/null
+++ b/Source/JavaScriptCore/API/JSCallbackFunction.h
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef JSCallbackFunction_h
+#define JSCallbackFunction_h
+
+#include "InternalFunction.h"
+#include "JSObjectRef.h"
+
+namespace JSC {
+
+class JSCallbackFunction : public InternalFunction {
+public:
+ JSCallbackFunction(ExecState*, JSGlobalObject*, JSObjectCallAsFunctionCallback, const Identifier& name);
+
+ static const ClassInfo info;
+
+ // InternalFunction mish-mashes constructor and function behavior -- we should
+ // refactor the code so this override isn't necessary
+ static PassRefPtr<Structure> createStructure(JSValue proto)
+ {
+ return Structure::create(proto, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount);
+ }
+
+private:
+ virtual CallType getCallData(CallData&);
+ virtual const ClassInfo* classInfo() const { return &info; }
+
+ static EncodedJSValue JSC_HOST_CALL call(ExecState*);
+
+ JSObjectCallAsFunctionCallback m_callback;
+};
+
+} // namespace JSC
+
+#endif // JSCallbackFunction_h
diff --git a/Source/JavaScriptCore/API/JSCallbackObject.cpp b/Source/JavaScriptCore/API/JSCallbackObject.cpp
new file mode 100644
index 0000000..abd2adc
--- /dev/null
+++ b/Source/JavaScriptCore/API/JSCallbackObject.cpp
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JSCallbackObject.h"
+
+#include "Collector.h"
+#include <wtf/text/StringHash.h>
+
+namespace JSC {
+
+ASSERT_CLASS_FITS_IN_CELL(JSCallbackObject<JSObjectWithGlobalObject>);
+ASSERT_CLASS_FITS_IN_CELL(JSCallbackObject<JSGlobalObject>);
+
+// Define the two types of JSCallbackObjects we support.
+template <> const ClassInfo JSCallbackObject<JSObjectWithGlobalObject>::info = { "CallbackObject", 0, 0, 0 };
+template <> const ClassInfo JSCallbackObject<JSGlobalObject>::info = { "CallbackGlobalObject", 0, 0, 0 };
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/API/JSCallbackObject.h b/Source/JavaScriptCore/API/JSCallbackObject.h
new file mode 100644
index 0000000..83442b2
--- /dev/null
+++ b/Source/JavaScriptCore/API/JSCallbackObject.h
@@ -0,0 +1,201 @@
+/*
+ * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef JSCallbackObject_h
+#define JSCallbackObject_h
+
+#include "JSObjectRef.h"
+#include "JSValueRef.h"
+#include "JSObject.h"
+#include <wtf/PassOwnPtr.h>
+
+namespace JSC {
+
+struct JSCallbackObjectData {
+ JSCallbackObjectData(void* privateData, JSClassRef jsClass)
+ : privateData(privateData)
+ , jsClass(jsClass)
+ {
+ JSClassRetain(jsClass);
+ }
+
+ ~JSCallbackObjectData()
+ {
+ JSClassRelease(jsClass);
+ }
+
+ JSValue getPrivateProperty(const Identifier& propertyName) const
+ {
+ if (!m_privateProperties)
+ return JSValue();
+ return m_privateProperties->getPrivateProperty(propertyName);
+ }
+
+ void setPrivateProperty(const Identifier& propertyName, JSValue value)
+ {
+ if (!m_privateProperties)
+ m_privateProperties = adoptPtr(new JSPrivatePropertyMap);
+ m_privateProperties->setPrivateProperty(propertyName, value);
+ }
+
+ void deletePrivateProperty(const Identifier& propertyName)
+ {
+ if (!m_privateProperties)
+ return;
+ m_privateProperties->deletePrivateProperty(propertyName);
+ }
+
+ void markChildren(MarkStack& markStack)
+ {
+ if (!m_privateProperties)
+ return;
+ m_privateProperties->markChildren(markStack);
+ }
+
+ void* privateData;
+ JSClassRef jsClass;
+ struct JSPrivatePropertyMap {
+ JSValue getPrivateProperty(const Identifier& propertyName) const
+ {
+ PrivatePropertyMap::const_iterator location = m_propertyMap.find(propertyName.impl());
+ if (location == m_propertyMap.end())
+ return JSValue();
+ return location->second;
+ }
+
+ void setPrivateProperty(const Identifier& propertyName, JSValue value)
+ {
+ m_propertyMap.set(propertyName.impl(), value);
+ }
+
+ void deletePrivateProperty(const Identifier& propertyName)
+ {
+ m_propertyMap.remove(propertyName.impl());
+ }
+
+ void markChildren(MarkStack& markStack)
+ {
+ for (PrivatePropertyMap::iterator ptr = m_propertyMap.begin(); ptr != m_propertyMap.end(); ++ptr) {
+ if (ptr->second)
+ markStack.append(ptr->second);
+ }
+ }
+
+ private:
+ typedef HashMap<RefPtr<StringImpl>, JSValue, IdentifierRepHash> PrivatePropertyMap;
+ PrivatePropertyMap m_propertyMap;
+ };
+ OwnPtr<JSPrivatePropertyMap> m_privateProperties;
+};
+
+
+template <class Base>
+class JSCallbackObject : public Base {
+public:
+ JSCallbackObject(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure>, JSClassRef, void* data);
+ JSCallbackObject(JSClassRef, NonNullPassRefPtr<Structure>);
+ virtual ~JSCallbackObject();
+
+ void setPrivate(void* data);
+ void* getPrivate();
+
+ static const ClassInfo info;
+
+ JSClassRef classRef() const { return m_callbackObjectData->jsClass; }
+ bool inherits(JSClassRef) const;
+
+ static PassRefPtr<Structure> createStructure(JSValue proto)
+ {
+ return Structure::create(proto, TypeInfo(ObjectType, StructureFlags), Base::AnonymousSlotCount);
+ }
+
+ JSValue getPrivateProperty(const Identifier& propertyName) const
+ {
+ return m_callbackObjectData->getPrivateProperty(propertyName);
+ }
+
+ void setPrivateProperty(const Identifier& propertyName, JSValue value)
+ {
+ m_callbackObjectData->setPrivateProperty(propertyName, value);
+ }
+
+ void deletePrivateProperty(const Identifier& propertyName)
+ {
+ m_callbackObjectData->deletePrivateProperty(propertyName);
+ }
+
+protected:
+ static const unsigned StructureFlags = OverridesGetOwnPropertySlot | ImplementsHasInstance | OverridesHasInstance | OverridesMarkChildren | OverridesGetPropertyNames | Base::StructureFlags;
+
+private:
+ virtual UString className() const;
+
+ virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
+ virtual bool getOwnPropertySlot(ExecState*, unsigned, PropertySlot&);
+ virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
+
+ virtual void put(ExecState*, const Identifier&, JSValue, PutPropertySlot&);
+
+ virtual bool deleteProperty(ExecState*, const Identifier&);
+ virtual bool deleteProperty(ExecState*, unsigned);
+
+ virtual bool hasInstance(ExecState* exec, JSValue value, JSValue proto);
+
+ virtual void getOwnPropertyNames(ExecState*, PropertyNameArray&, EnumerationMode mode = ExcludeDontEnumProperties);
+
+ virtual double toNumber(ExecState*) const;
+ virtual UString toString(ExecState*) const;
+
+ virtual ConstructType getConstructData(ConstructData&);
+ virtual CallType getCallData(CallData&);
+ virtual const ClassInfo* classInfo() const { return &info; }
+
+ virtual void markChildren(MarkStack& markStack)
+ {
+ Base::markChildren(markStack);
+ m_callbackObjectData->markChildren(markStack);
+ }
+
+ void init(ExecState*);
+
+ static JSCallbackObject* asCallbackObject(JSValue);
+
+ static EncodedJSValue JSC_HOST_CALL call(ExecState*);
+ static EncodedJSValue JSC_HOST_CALL construct(ExecState*);
+
+ static JSValue staticValueGetter(ExecState*, JSValue, const Identifier&);
+ static JSValue staticFunctionGetter(ExecState*, JSValue, const Identifier&);
+ static JSValue callbackGetter(ExecState*, JSValue, const Identifier&);
+
+ OwnPtr<JSCallbackObjectData> m_callbackObjectData;
+};
+
+} // namespace JSC
+
+// include the actual template class implementation
+#include "JSCallbackObjectFunctions.h"
+
+#endif // JSCallbackObject_h
diff --git a/Source/JavaScriptCore/API/JSCallbackObjectFunctions.h b/Source/JavaScriptCore/API/JSCallbackObjectFunctions.h
new file mode 100644
index 0000000..de5d842
--- /dev/null
+++ b/Source/JavaScriptCore/API/JSCallbackObjectFunctions.h
@@ -0,0 +1,607 @@
+/*
+ * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "APIShims.h"
+#include "APICast.h"
+#include "Error.h"
+#include "ExceptionHelpers.h"
+#include "JSCallbackFunction.h"
+#include "JSClassRef.h"
+#include "JSFunction.h"
+#include "JSGlobalObject.h"
+#include "JSLock.h"
+#include "JSObjectRef.h"
+#include "JSString.h"
+#include "JSStringRef.h"
+#include "OpaqueJSString.h"
+#include "PropertyNameArray.h"
+#include <wtf/Vector.h>
+
+namespace JSC {
+
+template <class Base>
+inline JSCallbackObject<Base>* JSCallbackObject<Base>::asCallbackObject(JSValue value)
+{
+ ASSERT(asObject(value)->inherits(&info));
+ return static_cast<JSCallbackObject*>(asObject(value));
+}
+
+template <class Base>
+JSCallbackObject<Base>::JSCallbackObject(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, JSClassRef jsClass, void* data)
+ : Base(globalObject, structure)
+ , m_callbackObjectData(adoptPtr(new JSCallbackObjectData(data, jsClass)))
+{
+ init(exec);
+}
+
+// Global object constructor.
+// FIXME: Move this into a separate JSGlobalCallbackObject class derived from this one.
+template <class Base>
+JSCallbackObject<Base>::JSCallbackObject(JSClassRef jsClass, NonNullPassRefPtr<Structure> structure)
+ : Base(structure)
+ , m_callbackObjectData(adoptPtr(new JSCallbackObjectData(0, jsClass)))
+{
+ ASSERT(Base::isGlobalObject());
+ init(static_cast<JSGlobalObject*>(this)->globalExec());
+}
+
+template <class Base>
+void JSCallbackObject<Base>::init(ExecState* exec)
+{
+ ASSERT(exec);
+
+ Vector<JSObjectInitializeCallback, 16> initRoutines;
+ JSClassRef jsClass = classRef();
+ do {
+ if (JSObjectInitializeCallback initialize = jsClass->initialize)
+ initRoutines.append(initialize);
+ } while ((jsClass = jsClass->parentClass));
+
+ // initialize from base to derived
+ for (int i = static_cast<int>(initRoutines.size()) - 1; i >= 0; i--) {
+ APICallbackShim callbackShim(exec);
+ JSObjectInitializeCallback initialize = initRoutines[i];
+ initialize(toRef(exec), toRef(this));
+ }
+}
+
+template <class Base>
+JSCallbackObject<Base>::~JSCallbackObject()
+{
+ JSObjectRef thisRef = toRef(this);
+
+ for (JSClassRef jsClass = classRef(); jsClass; jsClass = jsClass->parentClass)
+ if (JSObjectFinalizeCallback finalize = jsClass->finalize)
+ finalize(thisRef);
+}
+
+template <class Base>
+UString JSCallbackObject<Base>::className() const
+{
+ UString thisClassName = classRef()->className();
+ if (!thisClassName.isEmpty())
+ return thisClassName;
+
+ return Base::className();
+}
+
+template <class Base>
+bool JSCallbackObject<Base>::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
+{
+ JSContextRef ctx = toRef(exec);
+ JSObjectRef thisRef = toRef(this);
+ RefPtr<OpaqueJSString> propertyNameRef;
+
+ for (JSClassRef jsClass = classRef(); jsClass; jsClass = jsClass->parentClass) {
+ // optional optimization to bypass getProperty in cases when we only need to know if the property exists
+ if (JSObjectHasPropertyCallback hasProperty = jsClass->hasProperty) {
+ if (!propertyNameRef)
+ propertyNameRef = OpaqueJSString::create(propertyName.ustring());
+ APICallbackShim callbackShim(exec);
+ if (hasProperty(ctx, thisRef, propertyNameRef.get())) {
+ slot.setCustom(this, callbackGetter);
+ return true;
+ }
+ } else if (JSObjectGetPropertyCallback getProperty = jsClass->getProperty) {
+ if (!propertyNameRef)
+ propertyNameRef = OpaqueJSString::create(propertyName.ustring());
+ JSValueRef exception = 0;
+ JSValueRef value;
+ {
+ APICallbackShim callbackShim(exec);
+ value = getProperty(ctx, thisRef, propertyNameRef.get(), &exception);
+ }
+ if (exception) {
+ throwError(exec, toJS(exec, exception));
+ slot.setValue(jsUndefined());
+ return true;
+ }
+ if (value) {
+ slot.setValue(toJS(exec, value));
+ return true;
+ }
+ }
+
+ if (OpaqueJSClassStaticValuesTable* staticValues = jsClass->staticValues(exec)) {
+ if (staticValues->contains(propertyName.impl())) {
+ slot.setCustom(this, staticValueGetter);
+ return true;
+ }
+ }
+
+ if (OpaqueJSClassStaticFunctionsTable* staticFunctions = jsClass->staticFunctions(exec)) {
+ if (staticFunctions->contains(propertyName.impl())) {
+ slot.setCustom(this, staticFunctionGetter);
+ return true;
+ }
+ }
+ }
+
+ return Base::getOwnPropertySlot(exec, propertyName, slot);
+}
+
+template <class Base>
+bool JSCallbackObject<Base>::getOwnPropertySlot(ExecState* exec, unsigned propertyName, PropertySlot& slot)
+{
+ return getOwnPropertySlot(exec, Identifier::from(exec, propertyName), slot);
+}
+
+template <class Base>
+bool JSCallbackObject<Base>::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
+{
+ PropertySlot slot;
+ if (getOwnPropertySlot(exec, propertyName, slot)) {
+ // Ideally we should return an access descriptor, but returning a value descriptor is better than nothing.
+ JSValue value = slot.getValue(exec, propertyName);
+ if (!exec->hadException())
+ descriptor.setValue(value);
+ // We don't know whether the property is configurable, but assume it is.
+ descriptor.setConfigurable(true);
+ // We don't know whether the property is enumerable (we could call getOwnPropertyNames() to find out), but assume it isn't.
+ descriptor.setEnumerable(false);
+ return true;
+ }
+
+ return Base::getOwnPropertyDescriptor(exec, propertyName, descriptor);
+}
+
+template <class Base>
+void JSCallbackObject<Base>::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
+{
+ JSContextRef ctx = toRef(exec);
+ JSObjectRef thisRef = toRef(this);
+ RefPtr<OpaqueJSString> propertyNameRef;
+ JSValueRef valueRef = toRef(exec, value);
+
+ for (JSClassRef jsClass = classRef(); jsClass; jsClass = jsClass->parentClass) {
+ if (JSObjectSetPropertyCallback setProperty = jsClass->setProperty) {
+ if (!propertyNameRef)
+ propertyNameRef = OpaqueJSString::create(propertyName.ustring());
+ JSValueRef exception = 0;
+ bool result;
+ {
+ APICallbackShim callbackShim(exec);
+ result = setProperty(ctx, thisRef, propertyNameRef.get(), valueRef, &exception);
+ }
+ if (exception)
+ throwError(exec, toJS(exec, exception));
+ if (result || exception)
+ return;
+ }
+
+ if (OpaqueJSClassStaticValuesTable* staticValues = jsClass->staticValues(exec)) {
+ if (StaticValueEntry* entry = staticValues->get(propertyName.impl())) {
+ if (entry->attributes & kJSPropertyAttributeReadOnly)
+ return;
+ if (JSObjectSetPropertyCallback setProperty = entry->setProperty) {
+ if (!propertyNameRef)
+ propertyNameRef = OpaqueJSString::create(propertyName.ustring());
+ JSValueRef exception = 0;
+ bool result;
+ {
+ APICallbackShim callbackShim(exec);
+ result = setProperty(ctx, thisRef, propertyNameRef.get(), valueRef, &exception);
+ }
+ if (exception)
+ throwError(exec, toJS(exec, exception));
+ if (result || exception)
+ return;
+ } else
+ throwError(exec, createReferenceError(exec, "Attempt to set a property that is not settable."));
+ }
+ }
+
+ if (OpaqueJSClassStaticFunctionsTable* staticFunctions = jsClass->staticFunctions(exec)) {
+ if (StaticFunctionEntry* entry = staticFunctions->get(propertyName.impl())) {
+ if (entry->attributes & kJSPropertyAttributeReadOnly)
+ return;
+ JSCallbackObject<Base>::putDirect(propertyName, value); // put as override property
+ return;
+ }
+ }
+ }
+
+ return Base::put(exec, propertyName, value, slot);
+}
+
+template <class Base>
+bool JSCallbackObject<Base>::deleteProperty(ExecState* exec, const Identifier& propertyName)
+{
+ JSContextRef ctx = toRef(exec);
+ JSObjectRef thisRef = toRef(this);
+ RefPtr<OpaqueJSString> propertyNameRef;
+
+ for (JSClassRef jsClass = classRef(); jsClass; jsClass = jsClass->parentClass) {
+ if (JSObjectDeletePropertyCallback deleteProperty = jsClass->deleteProperty) {
+ if (!propertyNameRef)
+ propertyNameRef = OpaqueJSString::create(propertyName.ustring());
+ JSValueRef exception = 0;
+ bool result;
+ {
+ APICallbackShim callbackShim(exec);
+ result = deleteProperty(ctx, thisRef, propertyNameRef.get(), &exception);
+ }
+ if (exception)
+ throwError(exec, toJS(exec, exception));
+ if (result || exception)
+ return true;
+ }
+
+ if (OpaqueJSClassStaticValuesTable* staticValues = jsClass->staticValues(exec)) {
+ if (StaticValueEntry* entry = staticValues->get(propertyName.impl())) {
+ if (entry->attributes & kJSPropertyAttributeDontDelete)
+ return false;
+ return true;
+ }
+ }
+
+ if (OpaqueJSClassStaticFunctionsTable* staticFunctions = jsClass->staticFunctions(exec)) {
+ if (StaticFunctionEntry* entry = staticFunctions->get(propertyName.impl())) {
+ if (entry->attributes & kJSPropertyAttributeDontDelete)
+ return false;
+ return true;
+ }
+ }
+ }
+
+ return Base::deleteProperty(exec, propertyName);
+}
+
+template <class Base>
+bool JSCallbackObject<Base>::deleteProperty(ExecState* exec, unsigned propertyName)
+{
+ return deleteProperty(exec, Identifier::from(exec, propertyName));
+}
+
+template <class Base>
+ConstructType JSCallbackObject<Base>::getConstructData(ConstructData& constructData)
+{
+ for (JSClassRef jsClass = classRef(); jsClass; jsClass = jsClass->parentClass) {
+ if (jsClass->callAsConstructor) {
+ constructData.native.function = construct;
+ return ConstructTypeHost;
+ }
+ }
+ return ConstructTypeNone;
+}
+
+template <class Base>
+EncodedJSValue JSCallbackObject<Base>::construct(ExecState* exec)
+{
+ JSObject* constructor = exec->callee();
+ JSContextRef execRef = toRef(exec);
+ JSObjectRef constructorRef = toRef(constructor);
+
+ for (JSClassRef jsClass = static_cast<JSCallbackObject<Base>*>(constructor)->classRef(); jsClass; jsClass = jsClass->parentClass) {
+ if (JSObjectCallAsConstructorCallback callAsConstructor = jsClass->callAsConstructor) {
+ int argumentCount = static_cast<int>(exec->argumentCount());
+ Vector<JSValueRef, 16> arguments(argumentCount);
+ for (int i = 0; i < argumentCount; i++)
+ arguments[i] = toRef(exec, exec->argument(i));
+ JSValueRef exception = 0;
+ JSObject* result;
+ {
+ APICallbackShim callbackShim(exec);
+ result = toJS(callAsConstructor(execRef, constructorRef, argumentCount, arguments.data(), &exception));
+ }
+ if (exception)
+ throwError(exec, toJS(exec, exception));
+ return JSValue::encode(result);
+ }
+ }
+
+ ASSERT_NOT_REACHED(); // getConstructData should prevent us from reaching here
+ return JSValue::encode(JSValue());
+}
+
+template <class Base>
+bool JSCallbackObject<Base>::hasInstance(ExecState* exec, JSValue value, JSValue)
+{
+ JSContextRef execRef = toRef(exec);
+ JSObjectRef thisRef = toRef(this);
+
+ for (JSClassRef jsClass = classRef(); jsClass; jsClass = jsClass->parentClass) {
+ if (JSObjectHasInstanceCallback hasInstance = jsClass->hasInstance) {
+ JSValueRef valueRef = toRef(exec, value);
+ JSValueRef exception = 0;
+ bool result;
+ {
+ APICallbackShim callbackShim(exec);
+ result = hasInstance(execRef, thisRef, valueRef, &exception);
+ }
+ if (exception)
+ throwError(exec, toJS(exec, exception));
+ return result;
+ }
+ }
+ return false;
+}
+
+template <class Base>
+CallType JSCallbackObject<Base>::getCallData(CallData& callData)
+{
+ for (JSClassRef jsClass = classRef(); jsClass; jsClass = jsClass->parentClass) {
+ if (jsClass->callAsFunction) {
+ callData.native.function = call;
+ return CallTypeHost;
+ }
+ }
+ return CallTypeNone;
+}
+
+template <class Base>
+EncodedJSValue JSCallbackObject<Base>::call(ExecState* exec)
+{
+ JSContextRef execRef = toRef(exec);
+ JSObjectRef functionRef = toRef(exec->callee());
+ JSObjectRef thisObjRef = toRef(exec->hostThisValue().toThisObject(exec));
+
+ for (JSClassRef jsClass = static_cast<JSCallbackObject<Base>*>(toJS(functionRef))->classRef(); jsClass; jsClass = jsClass->parentClass) {
+ if (JSObjectCallAsFunctionCallback callAsFunction = jsClass->callAsFunction) {
+ int argumentCount = static_cast<int>(exec->argumentCount());
+ Vector<JSValueRef, 16> arguments(argumentCount);
+ for (int i = 0; i < argumentCount; i++)
+ arguments[i] = toRef(exec, exec->argument(i));
+ JSValueRef exception = 0;
+ JSValue result;
+ {
+ APICallbackShim callbackShim(exec);
+ result = toJS(exec, callAsFunction(execRef, functionRef, thisObjRef, argumentCount, arguments.data(), &exception));
+ }
+ if (exception)
+ throwError(exec, toJS(exec, exception));
+ return JSValue::encode(result);
+ }
+ }
+
+ ASSERT_NOT_REACHED(); // getCallData should prevent us from reaching here
+ return JSValue::encode(JSValue());
+}
+
+template <class Base>
+void JSCallbackObject<Base>::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
+{
+ JSContextRef execRef = toRef(exec);
+ JSObjectRef thisRef = toRef(this);
+
+ for (JSClassRef jsClass = classRef(); jsClass; jsClass = jsClass->parentClass) {
+ if (JSObjectGetPropertyNamesCallback getPropertyNames = jsClass->getPropertyNames) {
+ APICallbackShim callbackShim(exec);
+ getPropertyNames(execRef, thisRef, toRef(&propertyNames));
+ }
+
+ if (OpaqueJSClassStaticValuesTable* staticValues = jsClass->staticValues(exec)) {
+ typedef OpaqueJSClassStaticValuesTable::const_iterator iterator;
+ iterator end = staticValues->end();
+ for (iterator it = staticValues->begin(); it != end; ++it) {
+ StringImpl* name = it->first.get();
+ StaticValueEntry* entry = it->second;
+ if (entry->getProperty && (!(entry->attributes & kJSPropertyAttributeDontEnum) || (mode == IncludeDontEnumProperties)))
+ propertyNames.add(Identifier(exec, name));
+ }
+ }
+
+ if (OpaqueJSClassStaticFunctionsTable* staticFunctions = jsClass->staticFunctions(exec)) {
+ typedef OpaqueJSClassStaticFunctionsTable::const_iterator iterator;
+ iterator end = staticFunctions->end();
+ for (iterator it = staticFunctions->begin(); it != end; ++it) {
+ StringImpl* name = it->first.get();
+ StaticFunctionEntry* entry = it->second;
+ if (!(entry->attributes & kJSPropertyAttributeDontEnum) || (mode == IncludeDontEnumProperties))
+ propertyNames.add(Identifier(exec, name));
+ }
+ }
+ }
+
+ Base::getOwnPropertyNames(exec, propertyNames, mode);
+}
+
+template <class Base>
+double JSCallbackObject<Base>::toNumber(ExecState* exec) const
+{
+ // We need this check to guard against the case where this object is rhs of
+ // a binary expression where lhs threw an exception in its conversion to
+ // primitive
+ if (exec->hadException())
+ return NaN;
+ JSContextRef ctx = toRef(exec);
+ JSObjectRef thisRef = toRef(this);
+
+ for (JSClassRef jsClass = classRef(); jsClass; jsClass = jsClass->parentClass)
+ if (JSObjectConvertToTypeCallback convertToType = jsClass->convertToType) {
+ JSValueRef exception = 0;
+ JSValueRef value;
+ {
+ APICallbackShim callbackShim(exec);
+ value = convertToType(ctx, thisRef, kJSTypeNumber, &exception);
+ }
+ if (exception) {
+ throwError(exec, toJS(exec, exception));
+ return 0;
+ }
+
+ double dValue;
+ if (value)
+ return toJS(exec, value).getNumber(dValue) ? dValue : NaN;
+ }
+
+ return Base::toNumber(exec);
+}
+
+template <class Base>
+UString JSCallbackObject<Base>::toString(ExecState* exec) const
+{
+ JSContextRef ctx = toRef(exec);
+ JSObjectRef thisRef = toRef(this);
+
+ for (JSClassRef jsClass = classRef(); jsClass; jsClass = jsClass->parentClass)
+ if (JSObjectConvertToTypeCallback convertToType = jsClass->convertToType) {
+ JSValueRef exception = 0;
+ JSValueRef value;
+ {
+ APICallbackShim callbackShim(exec);
+ value = convertToType(ctx, thisRef, kJSTypeString, &exception);
+ }
+ if (exception) {
+ throwError(exec, toJS(exec, exception));
+ return "";
+ }
+ if (value)
+ return toJS(exec, value).getString(exec);
+ }
+
+ return Base::toString(exec);
+}
+
+template <class Base>
+void JSCallbackObject<Base>::setPrivate(void* data)
+{
+ m_callbackObjectData->privateData = data;
+}
+
+template <class Base>
+void* JSCallbackObject<Base>::getPrivate()
+{
+ return m_callbackObjectData->privateData;
+}
+
+template <class Base>
+bool JSCallbackObject<Base>::inherits(JSClassRef c) const
+{
+ for (JSClassRef jsClass = classRef(); jsClass; jsClass = jsClass->parentClass)
+ if (jsClass == c)
+ return true;
+
+ return false;
+}
+
+template <class Base>
+JSValue JSCallbackObject<Base>::staticValueGetter(ExecState* exec, JSValue slotBase, const Identifier& propertyName)
+{
+ JSCallbackObject* thisObj = asCallbackObject(slotBase);
+
+ JSObjectRef thisRef = toRef(thisObj);
+ RefPtr<OpaqueJSString> propertyNameRef;
+
+ for (JSClassRef jsClass = thisObj->classRef(); jsClass; jsClass = jsClass->parentClass)
+ if (OpaqueJSClassStaticValuesTable* staticValues = jsClass->staticValues(exec))
+ if (StaticValueEntry* entry = staticValues->get(propertyName.impl()))
+ if (JSObjectGetPropertyCallback getProperty = entry->getProperty) {
+ if (!propertyNameRef)
+ propertyNameRef = OpaqueJSString::create(propertyName.ustring());
+ JSValueRef exception = 0;
+ JSValueRef value;
+ {
+ APICallbackShim callbackShim(exec);
+ value = getProperty(toRef(exec), thisRef, propertyNameRef.get(), &exception);
+ }
+ if (exception) {
+ throwError(exec, toJS(exec, exception));
+ return jsUndefined();
+ }
+ if (value)
+ return toJS(exec, value);
+ }
+
+ return throwError(exec, createReferenceError(exec, "Static value property defined with NULL getProperty callback."));
+}
+
+template <class Base>
+JSValue JSCallbackObject<Base>::staticFunctionGetter(ExecState* exec, JSValue slotBase, const Identifier& propertyName)
+{
+ JSCallbackObject* thisObj = asCallbackObject(slotBase);
+
+ // Check for cached or override property.
+ PropertySlot slot2(thisObj);
+ if (thisObj->Base::getOwnPropertySlot(exec, propertyName, slot2))
+ return slot2.getValue(exec, propertyName);
+
+ for (JSClassRef jsClass = thisObj->classRef(); jsClass; jsClass = jsClass->parentClass) {
+ if (OpaqueJSClassStaticFunctionsTable* staticFunctions = jsClass->staticFunctions(exec)) {
+ if (StaticFunctionEntry* entry = staticFunctions->get(propertyName.impl())) {
+ if (JSObjectCallAsFunctionCallback callAsFunction = entry->callAsFunction) {
+
+ JSObject* o = new (exec) JSCallbackFunction(exec, asGlobalObject(thisObj->getAnonymousValue(0)), callAsFunction, propertyName);
+ thisObj->putDirect(propertyName, o, entry->attributes);
+ return o;
+ }
+ }
+ }
+ }
+
+ return throwError(exec, createReferenceError(exec, "Static function property defined with NULL callAsFunction callback."));
+}
+
+template <class Base>
+JSValue JSCallbackObject<Base>::callbackGetter(ExecState* exec, JSValue slotBase, const Identifier& propertyName)
+{
+ JSCallbackObject* thisObj = asCallbackObject(slotBase);
+
+ JSObjectRef thisRef = toRef(thisObj);
+ RefPtr<OpaqueJSString> propertyNameRef;
+
+ for (JSClassRef jsClass = thisObj->classRef(); jsClass; jsClass = jsClass->parentClass)
+ if (JSObjectGetPropertyCallback getProperty = jsClass->getProperty) {
+ if (!propertyNameRef)
+ propertyNameRef = OpaqueJSString::create(propertyName.ustring());
+ JSValueRef exception = 0;
+ JSValueRef value;
+ {
+ APICallbackShim callbackShim(exec);
+ value = getProperty(toRef(exec), thisRef, propertyNameRef.get(), &exception);
+ }
+ if (exception) {
+ throwError(exec, toJS(exec, exception));
+ return jsUndefined();
+ }
+ if (value)
+ return toJS(exec, value);
+ }
+
+ return throwError(exec, createReferenceError(exec, "hasProperty callback returned true for a property that doesn't exist."));
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/API/JSClassRef.cpp b/Source/JavaScriptCore/API/JSClassRef.cpp
new file mode 100644
index 0000000..decf493
--- /dev/null
+++ b/Source/JavaScriptCore/API/JSClassRef.cpp
@@ -0,0 +1,266 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JSClassRef.h"
+
+#include "APICast.h"
+#include "JSCallbackObject.h"
+#include "JSObjectRef.h"
+#include <runtime/InitializeThreading.h>
+#include <runtime/JSGlobalObject.h>
+#include <runtime/ObjectPrototype.h>
+#include <runtime/Identifier.h>
+#include <wtf/text/StringHash.h>
+#include <wtf/unicode/UTF8.h>
+
+using namespace std;
+using namespace JSC;
+using namespace WTF::Unicode;
+
+const JSClassDefinition kJSClassDefinitionEmpty = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
+
+static inline UString tryCreateStringFromUTF8(const char* string)
+{
+ if (!string)
+ return UString();
+
+ size_t length = strlen(string);
+ Vector<UChar, 1024> buffer(length);
+ UChar* p = buffer.data();
+ if (conversionOK != convertUTF8ToUTF16(&string, string + length, &p, p + length))
+ return UString();
+
+ return UString(buffer.data(), p - buffer.data());
+}
+
+OpaqueJSClass::OpaqueJSClass(const JSClassDefinition* definition, OpaqueJSClass* protoClass)
+ : parentClass(definition->parentClass)
+ , prototypeClass(0)
+ , initialize(definition->initialize)
+ , finalize(definition->finalize)
+ , hasProperty(definition->hasProperty)
+ , getProperty(definition->getProperty)
+ , setProperty(definition->setProperty)
+ , deleteProperty(definition->deleteProperty)
+ , getPropertyNames(definition->getPropertyNames)
+ , callAsFunction(definition->callAsFunction)
+ , callAsConstructor(definition->callAsConstructor)
+ , hasInstance(definition->hasInstance)
+ , convertToType(definition->convertToType)
+ , m_className(tryCreateStringFromUTF8(definition->className))
+ , m_staticValues(0)
+ , m_staticFunctions(0)
+{
+ initializeThreading();
+
+ if (const JSStaticValue* staticValue = definition->staticValues) {
+ m_staticValues = new OpaqueJSClassStaticValuesTable();
+ while (staticValue->name) {
+ UString valueName = tryCreateStringFromUTF8(staticValue->name);
+ if (!valueName.isNull()) {
+ // Use a local variable here to sidestep an RVCT compiler bug.
+ StaticValueEntry* entry = new StaticValueEntry(staticValue->getProperty, staticValue->setProperty, staticValue->attributes);
+ StringImpl* impl = valueName.impl();
+ impl->ref();
+ m_staticValues->add(impl, entry);
+ }
+ ++staticValue;
+ }
+ }
+
+ if (const JSStaticFunction* staticFunction = definition->staticFunctions) {
+ m_staticFunctions = new OpaqueJSClassStaticFunctionsTable();
+ while (staticFunction->name) {
+ UString functionName = tryCreateStringFromUTF8(staticFunction->name);
+ if (!functionName.isNull()) {
+ // Use a local variable here to sidestep an RVCT compiler bug.
+ StaticFunctionEntry* entry = new StaticFunctionEntry(staticFunction->callAsFunction, staticFunction->attributes);
+ StringImpl* impl = functionName.impl();
+ impl->ref();
+ m_staticFunctions->add(impl, entry);
+ }
+ ++staticFunction;
+ }
+ }
+
+ if (protoClass)
+ prototypeClass = JSClassRetain(protoClass);
+}
+
+OpaqueJSClass::~OpaqueJSClass()
+{
+ // The empty string is shared across threads & is an identifier, in all other cases we should have done a deep copy in className(), below.
+ ASSERT(!m_className.length() || !m_className.impl()->isIdentifier());
+
+ if (m_staticValues) {
+ OpaqueJSClassStaticValuesTable::const_iterator end = m_staticValues->end();
+ for (OpaqueJSClassStaticValuesTable::const_iterator it = m_staticValues->begin(); it != end; ++it) {
+ ASSERT(!it->first->isIdentifier());
+ delete it->second;
+ }
+ delete m_staticValues;
+ }
+
+ if (m_staticFunctions) {
+ OpaqueJSClassStaticFunctionsTable::const_iterator end = m_staticFunctions->end();
+ for (OpaqueJSClassStaticFunctionsTable::const_iterator it = m_staticFunctions->begin(); it != end; ++it) {
+ ASSERT(!it->first->isIdentifier());
+ delete it->second;
+ }
+ delete m_staticFunctions;
+ }
+
+ if (prototypeClass)
+ JSClassRelease(prototypeClass);
+}
+
+PassRefPtr<OpaqueJSClass> OpaqueJSClass::createNoAutomaticPrototype(const JSClassDefinition* definition)
+{
+ return adoptRef(new OpaqueJSClass(definition, 0));
+}
+
+static void clearReferenceToPrototype(JSObjectRef prototype)
+{
+ OpaqueJSClassContextData* jsClassData = static_cast<OpaqueJSClassContextData*>(JSObjectGetPrivate(prototype));
+ ASSERT(jsClassData);
+ jsClassData->cachedPrototype.clear(toJS(prototype));
+}
+
+PassRefPtr<OpaqueJSClass> OpaqueJSClass::create(const JSClassDefinition* clientDefinition)
+{
+ JSClassDefinition definition = *clientDefinition; // Avoid modifying client copy.
+
+ JSClassDefinition protoDefinition = kJSClassDefinitionEmpty;
+ protoDefinition.finalize = clearReferenceToPrototype;
+ swap(definition.staticFunctions, protoDefinition.staticFunctions); // Move static functions to the prototype.
+
+ // We are supposed to use JSClassRetain/Release but since we know that we currently have
+ // the only reference to this class object we cheat and use a RefPtr instead.
+ RefPtr<OpaqueJSClass> protoClass = adoptRef(new OpaqueJSClass(&protoDefinition, 0));
+ return adoptRef(new OpaqueJSClass(&definition, protoClass.get()));
+}
+
+OpaqueJSClassContextData::OpaqueJSClassContextData(OpaqueJSClass* jsClass)
+ : m_class(jsClass)
+{
+ if (jsClass->m_staticValues) {
+ staticValues = new OpaqueJSClassStaticValuesTable;
+ OpaqueJSClassStaticValuesTable::const_iterator end = jsClass->m_staticValues->end();
+ for (OpaqueJSClassStaticValuesTable::const_iterator it = jsClass->m_staticValues->begin(); it != end; ++it) {
+ ASSERT(!it->first->isIdentifier());
+ // Use a local variable here to sidestep an RVCT compiler bug.
+ StaticValueEntry* entry = new StaticValueEntry(it->second->getProperty, it->second->setProperty, it->second->attributes);
+ staticValues->add(StringImpl::create(it->first->characters(), it->first->length()), entry);
+ }
+ } else
+ staticValues = 0;
+
+ if (jsClass->m_staticFunctions) {
+ staticFunctions = new OpaqueJSClassStaticFunctionsTable;
+ OpaqueJSClassStaticFunctionsTable::const_iterator end = jsClass->m_staticFunctions->end();
+ for (OpaqueJSClassStaticFunctionsTable::const_iterator it = jsClass->m_staticFunctions->begin(); it != end; ++it) {
+ ASSERT(!it->first->isIdentifier());
+ // Use a local variable here to sidestep an RVCT compiler bug.
+ StaticFunctionEntry* entry = new StaticFunctionEntry(it->second->callAsFunction, it->second->attributes);
+ staticFunctions->add(StringImpl::create(it->first->characters(), it->first->length()), entry);
+ }
+
+ } else
+ staticFunctions = 0;
+}
+
+OpaqueJSClassContextData::~OpaqueJSClassContextData()
+{
+ if (staticValues) {
+ deleteAllValues(*staticValues);
+ delete staticValues;
+ }
+
+ if (staticFunctions) {
+ deleteAllValues(*staticFunctions);
+ delete staticFunctions;
+ }
+}
+
+OpaqueJSClassContextData& OpaqueJSClass::contextData(ExecState* exec)
+{
+ OpaqueJSClassContextData*& contextData = exec->globalData().opaqueJSClassData.add(this, 0).first->second;
+ if (!contextData)
+ contextData = new OpaqueJSClassContextData(this);
+ return *contextData;
+}
+
+UString OpaqueJSClass::className()
+{
+ // Make a deep copy, so that the caller has no chance to put the original into IdentifierTable.
+ return UString(m_className.characters(), m_className.length());
+}
+
+OpaqueJSClassStaticValuesTable* OpaqueJSClass::staticValues(JSC::ExecState* exec)
+{
+ OpaqueJSClassContextData& jsClassData = contextData(exec);
+ return jsClassData.staticValues;
+}
+
+OpaqueJSClassStaticFunctionsTable* OpaqueJSClass::staticFunctions(JSC::ExecState* exec)
+{
+ OpaqueJSClassContextData& jsClassData = contextData(exec);
+ return jsClassData.staticFunctions;
+}
+
+/*!
+// Doc here in case we make this public. (Hopefully we won't.)
+@function
+ @abstract Returns the prototype that will be used when constructing an object with a given class.
+ @param ctx The execution context to use.
+ @param jsClass A JSClass whose prototype you want to get.
+ @result The JSObject prototype that was automatically generated for jsClass, or NULL if no prototype was automatically generated. This is the prototype that will be used when constructing an object using jsClass.
+*/
+JSObject* OpaqueJSClass::prototype(ExecState* exec)
+{
+ /* Class (C++) and prototype (JS) inheritance are parallel, so:
+ * (C++) | (JS)
+ * ParentClass | ParentClassPrototype
+ * ^ | ^
+ * | | |
+ * DerivedClass | DerivedClassPrototype
+ */
+
+ if (!prototypeClass)
+ return 0;
+
+ OpaqueJSClassContextData& jsClassData = contextData(exec);
+
+ if (!jsClassData.cachedPrototype) {
+ // Recursive, but should be good enough for our purposes
+ jsClassData.cachedPrototype = new (exec) JSCallbackObject<JSObjectWithGlobalObject>(exec, exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->callbackObjectStructure(), prototypeClass, &jsClassData); // set jsClassData as the object's private data, so it can clear our reference on destruction
+ if (parentClass) {
+ if (JSObject* prototype = parentClass->prototype(exec))
+ jsClassData.cachedPrototype->setPrototype(prototype);
+ }
+ }
+ return jsClassData.cachedPrototype.get();
+}
diff --git a/Source/JavaScriptCore/API/JSClassRef.h b/Source/JavaScriptCore/API/JSClassRef.h
new file mode 100644
index 0000000..5062093
--- /dev/null
+++ b/Source/JavaScriptCore/API/JSClassRef.h
@@ -0,0 +1,122 @@
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef JSClassRef_h
+#define JSClassRef_h
+
+#include "JSObjectRef.h"
+
+#include <runtime/JSObject.h>
+#include <runtime/Protect.h>
+#include <runtime/UString.h>
+#include <runtime/WeakGCPtr.h>
+#include <wtf/HashMap.h>
+
+struct StaticValueEntry : FastAllocBase {
+ StaticValueEntry(JSObjectGetPropertyCallback _getProperty, JSObjectSetPropertyCallback _setProperty, JSPropertyAttributes _attributes)
+ : getProperty(_getProperty), setProperty(_setProperty), attributes(_attributes)
+ {
+ }
+
+ JSObjectGetPropertyCallback getProperty;
+ JSObjectSetPropertyCallback setProperty;
+ JSPropertyAttributes attributes;
+};
+
+struct StaticFunctionEntry : FastAllocBase {
+ StaticFunctionEntry(JSObjectCallAsFunctionCallback _callAsFunction, JSPropertyAttributes _attributes)
+ : callAsFunction(_callAsFunction), attributes(_attributes)
+ {
+ }
+
+ JSObjectCallAsFunctionCallback callAsFunction;
+ JSPropertyAttributes attributes;
+};
+
+typedef HashMap<RefPtr<StringImpl>, StaticValueEntry*> OpaqueJSClassStaticValuesTable;
+typedef HashMap<RefPtr<StringImpl>, StaticFunctionEntry*> OpaqueJSClassStaticFunctionsTable;
+
+struct OpaqueJSClass;
+
+// An OpaqueJSClass (JSClass) is created without a context, so it can be used with any context, even across context groups.
+// This structure holds data members that vary across context groups.
+struct OpaqueJSClassContextData : Noncopyable {
+ OpaqueJSClassContextData(OpaqueJSClass*);
+ ~OpaqueJSClassContextData();
+
+ // It is necessary to keep OpaqueJSClass alive because of the following rare scenario:
+ // 1. A class is created and used, so its context data is stored in JSGlobalData hash map.
+ // 2. The class is released, and when all JS objects that use it are collected, OpaqueJSClass
+ // is deleted (that's the part prevented by this RefPtr).
+ // 3. Another class is created at the same address.
+ // 4. When it is used, the old context data is found in JSGlobalData and used.
+ RefPtr<OpaqueJSClass> m_class;
+
+ OpaqueJSClassStaticValuesTable* staticValues;
+ OpaqueJSClassStaticFunctionsTable* staticFunctions;
+ JSC::WeakGCPtr<JSC::JSObject> cachedPrototype;
+};
+
+struct OpaqueJSClass : public ThreadSafeShared<OpaqueJSClass> {
+ static PassRefPtr<OpaqueJSClass> create(const JSClassDefinition*);
+ static PassRefPtr<OpaqueJSClass> createNoAutomaticPrototype(const JSClassDefinition*);
+ ~OpaqueJSClass();
+
+ JSC::UString className();
+ OpaqueJSClassStaticValuesTable* staticValues(JSC::ExecState*);
+ OpaqueJSClassStaticFunctionsTable* staticFunctions(JSC::ExecState*);
+ JSC::JSObject* prototype(JSC::ExecState*);
+
+ OpaqueJSClass* parentClass;
+ OpaqueJSClass* prototypeClass;
+
+ JSObjectInitializeCallback initialize;
+ JSObjectFinalizeCallback finalize;
+ JSObjectHasPropertyCallback hasProperty;
+ JSObjectGetPropertyCallback getProperty;
+ JSObjectSetPropertyCallback setProperty;
+ JSObjectDeletePropertyCallback deleteProperty;
+ JSObjectGetPropertyNamesCallback getPropertyNames;
+ JSObjectCallAsFunctionCallback callAsFunction;
+ JSObjectCallAsConstructorCallback callAsConstructor;
+ JSObjectHasInstanceCallback hasInstance;
+ JSObjectConvertToTypeCallback convertToType;
+
+private:
+ friend struct OpaqueJSClassContextData;
+
+ OpaqueJSClass();
+ OpaqueJSClass(const OpaqueJSClass&);
+ OpaqueJSClass(const JSClassDefinition*, OpaqueJSClass* protoClass);
+
+ OpaqueJSClassContextData& contextData(JSC::ExecState*);
+
+ // UStrings in these data members should not be put into any IdentifierTable.
+ JSC::UString m_className;
+ OpaqueJSClassStaticValuesTable* m_staticValues;
+ OpaqueJSClassStaticFunctionsTable* m_staticFunctions;
+};
+
+#endif // JSClassRef_h
diff --git a/Source/JavaScriptCore/API/JSContextRef.cpp b/Source/JavaScriptCore/API/JSContextRef.cpp
new file mode 100644
index 0000000..ccab953
--- /dev/null
+++ b/Source/JavaScriptCore/API/JSContextRef.cpp
@@ -0,0 +1,175 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JSContextRef.h"
+#include "JSContextRefPrivate.h"
+
+#include "APICast.h"
+#include "InitializeThreading.h"
+#include "JSCallbackObject.h"
+#include "JSClassRef.h"
+#include "JSGlobalObject.h"
+#include "JSObject.h"
+#include <wtf/text/StringHash.h>
+
+#if OS(DARWIN)
+#include <mach-o/dyld.h>
+
+static const int32_t webkitFirstVersionWithConcurrentGlobalContexts = 0x2100500; // 528.5.0
+#endif
+
+using namespace JSC;
+
+JSContextGroupRef JSContextGroupCreate()
+{
+ initializeThreading();
+ return toRef(JSGlobalData::createContextGroup(ThreadStackTypeSmall).leakRef());
+}
+
+JSContextGroupRef JSContextGroupRetain(JSContextGroupRef group)
+{
+ toJS(group)->ref();
+ return group;
+}
+
+void JSContextGroupRelease(JSContextGroupRef group)
+{
+ toJS(group)->deref();
+}
+
+JSGlobalContextRef JSGlobalContextCreate(JSClassRef globalObjectClass)
+{
+ initializeThreading();
+#if OS(DARWIN)
+ // When running on Tiger or Leopard, or if the application was linked before JSGlobalContextCreate was changed
+ // to use a unique JSGlobalData, we use a shared one for compatibility.
+#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
+ if (NSVersionOfLinkTimeLibrary("JavaScriptCore") <= webkitFirstVersionWithConcurrentGlobalContexts) {
+#else
+ {
+#endif
+ JSLock lock(LockForReal);
+ return JSGlobalContextCreateInGroup(toRef(&JSGlobalData::sharedInstance()), globalObjectClass);
+ }
+#endif // OS(DARWIN)
+
+ return JSGlobalContextCreateInGroup(0, globalObjectClass);
+}
+
+JSGlobalContextRef JSGlobalContextCreateInGroup(JSContextGroupRef group, JSClassRef globalObjectClass)
+{
+ initializeThreading();
+
+ JSLock lock(LockForReal);
+ RefPtr<JSGlobalData> globalData = group ? PassRefPtr<JSGlobalData>(toJS(group)) : JSGlobalData::createContextGroup(ThreadStackTypeSmall);
+
+ APIEntryShim entryShim(globalData.get(), false);
+
+#if ENABLE(JSC_MULTIPLE_THREADS)
+ globalData->makeUsableFromMultipleThreads();
+#endif
+
+ if (!globalObjectClass) {
+ JSGlobalObject* globalObject = new (globalData.get()) JSGlobalObject;
+ return JSGlobalContextRetain(toGlobalRef(globalObject->globalExec()));
+ }
+
+ JSGlobalObject* globalObject = new (globalData.get()) JSCallbackObject<JSGlobalObject>(globalObjectClass, JSCallbackObject<JSGlobalObject>::createStructure(jsNull()));
+ ExecState* exec = globalObject->globalExec();
+ JSValue prototype = globalObjectClass->prototype(exec);
+ if (!prototype)
+ prototype = jsNull();
+ globalObject->resetPrototype(prototype);
+ return JSGlobalContextRetain(toGlobalRef(exec));
+}
+
+JSGlobalContextRef JSGlobalContextRetain(JSGlobalContextRef ctx)
+{
+ ExecState* exec = toJS(ctx);
+ APIEntryShim entryShim(exec);
+
+ JSGlobalData& globalData = exec->globalData();
+ gcProtect(exec->dynamicGlobalObject());
+ globalData.ref();
+ return ctx;
+}
+
+void JSGlobalContextRelease(JSGlobalContextRef ctx)
+{
+ ExecState* exec = toJS(ctx);
+ JSLock lock(exec);
+
+ JSGlobalData& globalData = exec->globalData();
+ JSGlobalObject* dgo = exec->dynamicGlobalObject();
+ IdentifierTable* savedIdentifierTable = wtfThreadData().setCurrentIdentifierTable(globalData.identifierTable);
+
+ // One reference is held by JSGlobalObject, another added by JSGlobalContextRetain().
+ bool releasingContextGroup = globalData.refCount() == 2;
+ bool releasingGlobalObject = Heap::heap(dgo)->unprotect(dgo);
+ // If this is the last reference to a global data, it should also
+ // be the only remaining reference to the global object too!
+ ASSERT(!releasingContextGroup || releasingGlobalObject);
+
+ // An API 'JSGlobalContextRef' retains two things - a global object and a
+ // global data (or context group, in API terminology).
+ // * If this is the last reference to any contexts in the given context group,
+ // call destroy on the heap (the global data is being freed).
+ // * If this was the last reference to the global object, then unprotecting
+ // it may release a lot of GC memory - run the garbage collector now.
+ // * If there are more references remaining the the global object, then do nothing
+ // (specifically that is more protects, which we assume come from other JSGlobalContextRefs).
+ if (releasingContextGroup)
+ globalData.heap.destroy();
+ else if (releasingGlobalObject)
+ globalData.heap.collectAllGarbage();
+
+ globalData.deref();
+
+ wtfThreadData().setCurrentIdentifierTable(savedIdentifierTable);
+}
+
+JSObjectRef JSContextGetGlobalObject(JSContextRef ctx)
+{
+ ExecState* exec = toJS(ctx);
+ APIEntryShim entryShim(exec);
+
+ // It is necessary to call toThisObject to get the wrapper object when used with WebCore.
+ return toRef(exec->lexicalGlobalObject()->toThisObject(exec));
+}
+
+JSContextGroupRef JSContextGetGroup(JSContextRef ctx)
+{
+ ExecState* exec = toJS(ctx);
+ return toRef(&exec->globalData());
+}
+
+JSGlobalContextRef JSContextGetGlobalContext(JSContextRef ctx)
+{
+ ExecState* exec = toJS(ctx);
+ APIEntryShim entryShim(exec);
+
+ return toGlobalRef(exec->lexicalGlobalObject()->globalExec());
+}
diff --git a/Source/JavaScriptCore/API/JSContextRef.h b/Source/JavaScriptCore/API/JSContextRef.h
new file mode 100644
index 0000000..c5c8a71
--- /dev/null
+++ b/Source/JavaScriptCore/API/JSContextRef.h
@@ -0,0 +1,132 @@
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef JSContextRef_h
+#define JSContextRef_h
+
+#include <JavaScriptCore/JSObjectRef.h>
+#include <JavaScriptCore/JSValueRef.h>
+#include <JavaScriptCore/WebKitAvailability.h>
+
+#ifndef __cplusplus
+#include <stdbool.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*!
+@function
+@abstract Creates a JavaScript context group.
+@discussion A JSContextGroup associates JavaScript contexts with one another.
+ Contexts in the same group may share and exchange JavaScript objects. Sharing and/or exchanging
+ JavaScript objects between contexts in different groups will produce undefined behavior.
+ When objects from the same context group are used in multiple threads, explicit
+ synchronization is required.
+@result The created JSContextGroup.
+*/
+JS_EXPORT JSContextGroupRef JSContextGroupCreate() AVAILABLE_IN_WEBKIT_VERSION_4_0;
+
+/*!
+@function
+@abstract Retains a JavaScript context group.
+@param group The JSContextGroup to retain.
+@result A JSContextGroup that is the same as group.
+*/
+JS_EXPORT JSContextGroupRef JSContextGroupRetain(JSContextGroupRef group) AVAILABLE_IN_WEBKIT_VERSION_4_0;
+
+/*!
+@function
+@abstract Releases a JavaScript context group.
+@param group The JSContextGroup to release.
+*/
+JS_EXPORT void JSContextGroupRelease(JSContextGroupRef group) AVAILABLE_IN_WEBKIT_VERSION_4_0;
+
+/*!
+@function
+@abstract Creates a global JavaScript execution context.
+@discussion JSGlobalContextCreate allocates a global object and populates it with all the
+ built-in JavaScript objects, such as Object, Function, String, and Array.
+
+ In WebKit version 4.0 and later, the context is created in a unique context group.
+ Therefore, scripts may execute in it concurrently with scripts executing in other contexts.
+ However, you may not use values created in the context in other contexts.
+@param globalObjectClass The class to use when creating the global object. Pass
+ NULL to use the default object class.
+@result A JSGlobalContext with a global object of class globalObjectClass.
+*/
+JS_EXPORT JSGlobalContextRef JSGlobalContextCreate(JSClassRef globalObjectClass) AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
+
+/*!
+@function
+@abstract Creates a global JavaScript execution context in the context group provided.
+@discussion JSGlobalContextCreateInGroup allocates a global object and populates it with
+ all the built-in JavaScript objects, such as Object, Function, String, and Array.
+@param globalObjectClass The class to use when creating the global object. Pass
+ NULL to use the default object class.
+@param group The context group to use. The created global context retains the group.
+ Pass NULL to create a unique group for the context.
+@result A JSGlobalContext with a global object of class globalObjectClass and a context
+ group equal to group.
+*/
+JS_EXPORT JSGlobalContextRef JSGlobalContextCreateInGroup(JSContextGroupRef group, JSClassRef globalObjectClass) AVAILABLE_IN_WEBKIT_VERSION_4_0;
+
+/*!
+@function
+@abstract Retains a global JavaScript execution context.
+@param ctx The JSGlobalContext to retain.
+@result A JSGlobalContext that is the same as ctx.
+*/
+JS_EXPORT JSGlobalContextRef JSGlobalContextRetain(JSGlobalContextRef ctx);
+
+/*!
+@function
+@abstract Releases a global JavaScript execution context.
+@param ctx The JSGlobalContext to release.
+*/
+JS_EXPORT void JSGlobalContextRelease(JSGlobalContextRef ctx);
+
+/*!
+@function
+@abstract Gets the global object of a JavaScript execution context.
+@param ctx The JSContext whose global object you want to get.
+@result ctx's global object.
+*/
+JS_EXPORT JSObjectRef JSContextGetGlobalObject(JSContextRef ctx);
+
+/*!
+@function
+@abstract Gets the context group to which a JavaScript execution context belongs.
+@param ctx The JSContext whose group you want to get.
+@result ctx's group.
+*/
+JS_EXPORT JSContextGroupRef JSContextGetGroup(JSContextRef ctx) AVAILABLE_IN_WEBKIT_VERSION_4_0;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* JSContextRef_h */
diff --git a/Source/JavaScriptCore/API/JSContextRefPrivate.h b/Source/JavaScriptCore/API/JSContextRefPrivate.h
new file mode 100644
index 0000000..ff014ec
--- /dev/null
+++ b/Source/JavaScriptCore/API/JSContextRefPrivate.h
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2009 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef JSContextRefPrivate_h
+#define JSContextRefPrivate_h
+
+#include <JavaScriptCore/JSObjectRef.h>
+#include <JavaScriptCore/JSValueRef.h>
+#include <JavaScriptCore/WebKitAvailability.h>
+
+#ifndef __cplusplus
+#include <stdbool.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*!
+@function
+@abstract Gets the global context of a JavaScript execution context.
+@param ctx The JSContext whose global context you want to get.
+@result ctx's global context.
+*/
+JS_EXPORT JSGlobalContextRef JSContextGetGlobalContext(JSContextRef ctx);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* JSContextRefPrivate_h */
diff --git a/Source/JavaScriptCore/API/JSObjectRef.cpp b/Source/JavaScriptCore/API/JSObjectRef.cpp
new file mode 100644
index 0000000..4198ca8
--- /dev/null
+++ b/Source/JavaScriptCore/API/JSObjectRef.cpp
@@ -0,0 +1,544 @@
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2008 Kelvin W Sherlock (ksherlock@gmail.com)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JSObjectRef.h"
+#include "JSObjectRefPrivate.h"
+
+#include "APICast.h"
+#include "CodeBlock.h"
+#include "DateConstructor.h"
+#include "ErrorConstructor.h"
+#include "FunctionConstructor.h"
+#include "Identifier.h"
+#include "InitializeThreading.h"
+#include "JSArray.h"
+#include "JSCallbackConstructor.h"
+#include "JSCallbackFunction.h"
+#include "JSCallbackObject.h"
+#include "JSClassRef.h"
+#include "JSFunction.h"
+#include "JSGlobalObject.h"
+#include "JSObject.h"
+#include "JSRetainPtr.h"
+#include "JSString.h"
+#include "JSValueRef.h"
+#include "ObjectPrototype.h"
+#include "PropertyNameArray.h"
+#include "RegExpConstructor.h"
+
+using namespace JSC;
+
+JSClassRef JSClassCreate(const JSClassDefinition* definition)
+{
+ initializeThreading();
+ RefPtr<OpaqueJSClass> jsClass = (definition->attributes & kJSClassAttributeNoAutomaticPrototype)
+ ? OpaqueJSClass::createNoAutomaticPrototype(definition)
+ : OpaqueJSClass::create(definition);
+
+ return jsClass.release().leakRef();
+}
+
+JSClassRef JSClassRetain(JSClassRef jsClass)
+{
+ jsClass->ref();
+ return jsClass;
+}
+
+void JSClassRelease(JSClassRef jsClass)
+{
+ jsClass->deref();
+}
+
+JSObjectRef JSObjectMake(JSContextRef ctx, JSClassRef jsClass, void* data)
+{
+ ExecState* exec = toJS(ctx);
+ APIEntryShim entryShim(exec);
+
+ if (!jsClass)
+ return toRef(new (exec) JSObject(exec->lexicalGlobalObject()->emptyObjectStructure())); // slightly more efficient
+
+ JSCallbackObject<JSObjectWithGlobalObject>* object = new (exec) JSCallbackObject<JSObjectWithGlobalObject>(exec, exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->callbackObjectStructure(), jsClass, data);
+ if (JSObject* prototype = jsClass->prototype(exec))
+ object->setPrototype(prototype);
+
+ return toRef(object);
+}
+
+JSObjectRef JSObjectMakeFunctionWithCallback(JSContextRef ctx, JSStringRef name, JSObjectCallAsFunctionCallback callAsFunction)
+{
+ ExecState* exec = toJS(ctx);
+ APIEntryShim entryShim(exec);
+
+ Identifier nameID = name ? name->identifier(&exec->globalData()) : Identifier(exec, "anonymous");
+
+ return toRef(new (exec) JSCallbackFunction(exec, exec->lexicalGlobalObject(), callAsFunction, nameID));
+}
+
+JSObjectRef JSObjectMakeConstructor(JSContextRef ctx, JSClassRef jsClass, JSObjectCallAsConstructorCallback callAsConstructor)
+{
+ ExecState* exec = toJS(ctx);
+ APIEntryShim entryShim(exec);
+
+ JSValue jsPrototype = jsClass ? jsClass->prototype(exec) : 0;
+ if (!jsPrototype)
+ jsPrototype = exec->lexicalGlobalObject()->objectPrototype();
+
+ JSCallbackConstructor* constructor = new (exec) JSCallbackConstructor(exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->callbackConstructorStructure(), jsClass, callAsConstructor);
+ constructor->putDirect(exec->propertyNames().prototype, jsPrototype, DontEnum | DontDelete | ReadOnly);
+ return toRef(constructor);
+}
+
+JSObjectRef JSObjectMakeFunction(JSContextRef ctx, JSStringRef name, unsigned parameterCount, const JSStringRef parameterNames[], JSStringRef body, JSStringRef sourceURL, int startingLineNumber, JSValueRef* exception)
+{
+ ExecState* exec = toJS(ctx);
+ APIEntryShim entryShim(exec);
+
+ Identifier nameID = name ? name->identifier(&exec->globalData()) : Identifier(exec, "anonymous");
+
+ MarkedArgumentBuffer args;
+ for (unsigned i = 0; i < parameterCount; i++)
+ args.append(jsString(exec, parameterNames[i]->ustring()));
+ args.append(jsString(exec, body->ustring()));
+
+ JSObject* result = constructFunction(exec, args, nameID, sourceURL->ustring(), startingLineNumber);
+ if (exec->hadException()) {
+ if (exception)
+ *exception = toRef(exec, exec->exception());
+ exec->clearException();
+ result = 0;
+ }
+ return toRef(result);
+}
+
+JSObjectRef JSObjectMakeArray(JSContextRef ctx, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ ExecState* exec = toJS(ctx);
+ APIEntryShim entryShim(exec);
+
+ JSObject* result;
+ if (argumentCount) {
+ MarkedArgumentBuffer argList;
+ for (size_t i = 0; i < argumentCount; ++i)
+ argList.append(toJS(exec, arguments[i]));
+
+ result = constructArray(exec, argList);
+ } else
+ result = constructEmptyArray(exec);
+
+ if (exec->hadException()) {
+ if (exception)
+ *exception = toRef(exec, exec->exception());
+ exec->clearException();
+ result = 0;
+ }
+
+ return toRef(result);
+}
+
+JSObjectRef JSObjectMakeDate(JSContextRef ctx, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ ExecState* exec = toJS(ctx);
+ APIEntryShim entryShim(exec);
+
+ MarkedArgumentBuffer argList;
+ for (size_t i = 0; i < argumentCount; ++i)
+ argList.append(toJS(exec, arguments[i]));
+
+ JSObject* result = constructDate(exec, argList);
+ if (exec->hadException()) {
+ if (exception)
+ *exception = toRef(exec, exec->exception());
+ exec->clearException();
+ result = 0;
+ }
+
+ return toRef(result);
+}
+
+JSObjectRef JSObjectMakeError(JSContextRef ctx, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ ExecState* exec = toJS(ctx);
+ APIEntryShim entryShim(exec);
+
+ JSValue message = argumentCount ? toJS(exec, arguments[0]) : jsUndefined();
+ Structure* errorStructure = exec->lexicalGlobalObject()->errorStructure();
+ JSObject* result = ErrorInstance::create(exec, errorStructure, message);
+
+ if (exec->hadException()) {
+ if (exception)
+ *exception = toRef(exec, exec->exception());
+ exec->clearException();
+ result = 0;
+ }
+
+ return toRef(result);
+}
+
+JSObjectRef JSObjectMakeRegExp(JSContextRef ctx, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ ExecState* exec = toJS(ctx);
+ APIEntryShim entryShim(exec);
+
+ MarkedArgumentBuffer argList;
+ for (size_t i = 0; i < argumentCount; ++i)
+ argList.append(toJS(exec, arguments[i]));
+
+ JSObject* result = constructRegExp(exec, argList);
+ if (exec->hadException()) {
+ if (exception)
+ *exception = toRef(exec, exec->exception());
+ exec->clearException();
+ result = 0;
+ }
+
+ return toRef(result);
+}
+
+JSValueRef JSObjectGetPrototype(JSContextRef ctx, JSObjectRef object)
+{
+ ExecState* exec = toJS(ctx);
+ APIEntryShim entryShim(exec);
+
+ JSObject* jsObject = toJS(object);
+ return toRef(exec, jsObject->prototype());
+}
+
+void JSObjectSetPrototype(JSContextRef ctx, JSObjectRef object, JSValueRef value)
+{
+ ExecState* exec = toJS(ctx);
+ APIEntryShim entryShim(exec);
+
+ JSObject* jsObject = toJS(object);
+ JSValue jsValue = toJS(exec, value);
+
+ jsObject->setPrototypeWithCycleCheck(jsValue.isObject() ? jsValue : jsNull());
+}
+
+bool JSObjectHasProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName)
+{
+ ExecState* exec = toJS(ctx);
+ APIEntryShim entryShim(exec);
+
+ JSObject* jsObject = toJS(object);
+
+ return jsObject->hasProperty(exec, propertyName->identifier(&exec->globalData()));
+}
+
+JSValueRef JSObjectGetProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception)
+{
+ ExecState* exec = toJS(ctx);
+ APIEntryShim entryShim(exec);
+
+ JSObject* jsObject = toJS(object);
+
+ JSValue jsValue = jsObject->get(exec, propertyName->identifier(&exec->globalData()));
+ if (exec->hadException()) {
+ if (exception)
+ *exception = toRef(exec, exec->exception());
+ exec->clearException();
+ }
+ return toRef(exec, jsValue);
+}
+
+void JSObjectSetProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSPropertyAttributes attributes, JSValueRef* exception)
+{
+ ExecState* exec = toJS(ctx);
+ APIEntryShim entryShim(exec);
+
+ JSObject* jsObject = toJS(object);
+ Identifier name(propertyName->identifier(&exec->globalData()));
+ JSValue jsValue = toJS(exec, value);
+
+ if (attributes && !jsObject->hasProperty(exec, name))
+ jsObject->putWithAttributes(exec, name, jsValue, attributes);
+ else {
+ PutPropertySlot slot;
+ jsObject->put(exec, name, jsValue, slot);
+ }
+
+ if (exec->hadException()) {
+ if (exception)
+ *exception = toRef(exec, exec->exception());
+ exec->clearException();
+ }
+}
+
+JSValueRef JSObjectGetPropertyAtIndex(JSContextRef ctx, JSObjectRef object, unsigned propertyIndex, JSValueRef* exception)
+{
+ ExecState* exec = toJS(ctx);
+ APIEntryShim entryShim(exec);
+
+ JSObject* jsObject = toJS(object);
+
+ JSValue jsValue = jsObject->get(exec, propertyIndex);
+ if (exec->hadException()) {
+ if (exception)
+ *exception = toRef(exec, exec->exception());
+ exec->clearException();
+ }
+ return toRef(exec, jsValue);
+}
+
+
+void JSObjectSetPropertyAtIndex(JSContextRef ctx, JSObjectRef object, unsigned propertyIndex, JSValueRef value, JSValueRef* exception)
+{
+ ExecState* exec = toJS(ctx);
+ APIEntryShim entryShim(exec);
+
+ JSObject* jsObject = toJS(object);
+ JSValue jsValue = toJS(exec, value);
+
+ jsObject->put(exec, propertyIndex, jsValue);
+ if (exec->hadException()) {
+ if (exception)
+ *exception = toRef(exec, exec->exception());
+ exec->clearException();
+ }
+}
+
+bool JSObjectDeleteProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception)
+{
+ ExecState* exec = toJS(ctx);
+ APIEntryShim entryShim(exec);
+
+ JSObject* jsObject = toJS(object);
+
+ bool result = jsObject->deleteProperty(exec, propertyName->identifier(&exec->globalData()));
+ if (exec->hadException()) {
+ if (exception)
+ *exception = toRef(exec, exec->exception());
+ exec->clearException();
+ }
+ return result;
+}
+
+void* JSObjectGetPrivate(JSObjectRef object)
+{
+ JSObject* jsObject = toJS(object);
+
+ if (jsObject->inherits(&JSCallbackObject<JSGlobalObject>::info))
+ return static_cast<JSCallbackObject<JSGlobalObject>*>(jsObject)->getPrivate();
+ else if (jsObject->inherits(&JSCallbackObject<JSObjectWithGlobalObject>::info))
+ return static_cast<JSCallbackObject<JSObjectWithGlobalObject>*>(jsObject)->getPrivate();
+
+ return 0;
+}
+
+bool JSObjectSetPrivate(JSObjectRef object, void* data)
+{
+ JSObject* jsObject = toJS(object);
+
+ if (jsObject->inherits(&JSCallbackObject<JSGlobalObject>::info)) {
+ static_cast<JSCallbackObject<JSGlobalObject>*>(jsObject)->setPrivate(data);
+ return true;
+ } else if (jsObject->inherits(&JSCallbackObject<JSObjectWithGlobalObject>::info)) {
+ static_cast<JSCallbackObject<JSObjectWithGlobalObject>*>(jsObject)->setPrivate(data);
+ return true;
+ }
+
+ return false;
+}
+
+JSValueRef JSObjectGetPrivateProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName)
+{
+ ExecState* exec = toJS(ctx);
+ APIEntryShim entryShim(exec);
+ JSObject* jsObject = toJS(object);
+ JSValue result;
+ Identifier name(propertyName->identifier(&exec->globalData()));
+ if (jsObject->inherits(&JSCallbackObject<JSGlobalObject>::info))
+ result = static_cast<JSCallbackObject<JSGlobalObject>*>(jsObject)->getPrivateProperty(name);
+ else if (jsObject->inherits(&JSCallbackObject<JSObjectWithGlobalObject>::info))
+ result = static_cast<JSCallbackObject<JSObjectWithGlobalObject>*>(jsObject)->getPrivateProperty(name);
+ return toRef(exec, result);
+}
+
+bool JSObjectSetPrivateProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef value)
+{
+ ExecState* exec = toJS(ctx);
+ APIEntryShim entryShim(exec);
+ JSObject* jsObject = toJS(object);
+ JSValue jsValue = value ? toJS(exec, value) : JSValue();
+ Identifier name(propertyName->identifier(&exec->globalData()));
+ if (jsObject->inherits(&JSCallbackObject<JSGlobalObject>::info)) {
+ static_cast<JSCallbackObject<JSGlobalObject>*>(jsObject)->setPrivateProperty(name, jsValue);
+ return true;
+ }
+ if (jsObject->inherits(&JSCallbackObject<JSObjectWithGlobalObject>::info)) {
+ static_cast<JSCallbackObject<JSObjectWithGlobalObject>*>(jsObject)->setPrivateProperty(name, jsValue);
+ return true;
+ }
+ return false;
+}
+
+bool JSObjectDeletePrivateProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName)
+{
+ ExecState* exec = toJS(ctx);
+ APIEntryShim entryShim(exec);
+ JSObject* jsObject = toJS(object);
+ Identifier name(propertyName->identifier(&exec->globalData()));
+ if (jsObject->inherits(&JSCallbackObject<JSGlobalObject>::info)) {
+ static_cast<JSCallbackObject<JSGlobalObject>*>(jsObject)->deletePrivateProperty(name);
+ return true;
+ }
+ if (jsObject->inherits(&JSCallbackObject<JSObjectWithGlobalObject>::info)) {
+ static_cast<JSCallbackObject<JSObjectWithGlobalObject>*>(jsObject)->deletePrivateProperty(name);
+ return true;
+ }
+ return false;
+}
+
+bool JSObjectIsFunction(JSContextRef, JSObjectRef object)
+{
+ CallData callData;
+ return toJS(object)->getCallData(callData) != CallTypeNone;
+}
+
+JSValueRef JSObjectCallAsFunction(JSContextRef ctx, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ ExecState* exec = toJS(ctx);
+ APIEntryShim entryShim(exec);
+
+ JSObject* jsObject = toJS(object);
+ JSObject* jsThisObject = toJS(thisObject);
+
+ if (!jsThisObject)
+ jsThisObject = exec->globalThisValue();
+
+ MarkedArgumentBuffer argList;
+ for (size_t i = 0; i < argumentCount; i++)
+ argList.append(toJS(exec, arguments[i]));
+
+ CallData callData;
+ CallType callType = jsObject->getCallData(callData);
+ if (callType == CallTypeNone)
+ return 0;
+
+ JSValueRef result = toRef(exec, call(exec, jsObject, callType, callData, jsThisObject, argList));
+ if (exec->hadException()) {
+ if (exception)
+ *exception = toRef(exec, exec->exception());
+ exec->clearException();
+ result = 0;
+ }
+ return result;
+}
+
+bool JSObjectIsConstructor(JSContextRef, JSObjectRef object)
+{
+ JSObject* jsObject = toJS(object);
+ ConstructData constructData;
+ return jsObject->getConstructData(constructData) != ConstructTypeNone;
+}
+
+JSObjectRef JSObjectCallAsConstructor(JSContextRef ctx, JSObjectRef object, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ ExecState* exec = toJS(ctx);
+ APIEntryShim entryShim(exec);
+
+ JSObject* jsObject = toJS(object);
+
+ ConstructData constructData;
+ ConstructType constructType = jsObject->getConstructData(constructData);
+ if (constructType == ConstructTypeNone)
+ return 0;
+
+ MarkedArgumentBuffer argList;
+ for (size_t i = 0; i < argumentCount; i++)
+ argList.append(toJS(exec, arguments[i]));
+ JSObjectRef result = toRef(construct(exec, jsObject, constructType, constructData, argList));
+ if (exec->hadException()) {
+ if (exception)
+ *exception = toRef(exec, exec->exception());
+ exec->clearException();
+ result = 0;
+ }
+ return result;
+}
+
+struct OpaqueJSPropertyNameArray : FastAllocBase {
+ OpaqueJSPropertyNameArray(JSGlobalData* globalData)
+ : refCount(0)
+ , globalData(globalData)
+ {
+ }
+
+ unsigned refCount;
+ JSGlobalData* globalData;
+ Vector<JSRetainPtr<JSStringRef> > array;
+};
+
+JSPropertyNameArrayRef JSObjectCopyPropertyNames(JSContextRef ctx, JSObjectRef object)
+{
+ JSObject* jsObject = toJS(object);
+ ExecState* exec = toJS(ctx);
+ APIEntryShim entryShim(exec);
+
+ JSGlobalData* globalData = &exec->globalData();
+
+ JSPropertyNameArrayRef propertyNames = new OpaqueJSPropertyNameArray(globalData);
+ PropertyNameArray array(globalData);
+ jsObject->getPropertyNames(exec, array);
+
+ size_t size = array.size();
+ propertyNames->array.reserveInitialCapacity(size);
+ for (size_t i = 0; i < size; ++i)
+ propertyNames->array.append(JSRetainPtr<JSStringRef>(Adopt, OpaqueJSString::create(array[i].ustring()).leakRef()));
+
+ return JSPropertyNameArrayRetain(propertyNames);
+}
+
+JSPropertyNameArrayRef JSPropertyNameArrayRetain(JSPropertyNameArrayRef array)
+{
+ ++array->refCount;
+ return array;
+}
+
+void JSPropertyNameArrayRelease(JSPropertyNameArrayRef array)
+{
+ if (--array->refCount == 0) {
+ APIEntryShim entryShim(array->globalData, false);
+ delete array;
+ }
+}
+
+size_t JSPropertyNameArrayGetCount(JSPropertyNameArrayRef array)
+{
+ return array->array.size();
+}
+
+JSStringRef JSPropertyNameArrayGetNameAtIndex(JSPropertyNameArrayRef array, size_t index)
+{
+ return array->array[static_cast<unsigned>(index)].get();
+}
+
+void JSPropertyNameAccumulatorAddName(JSPropertyNameAccumulatorRef array, JSStringRef propertyName)
+{
+ PropertyNameArray* propertyNames = toJS(array);
+ APIEntryShim entryShim(propertyNames->globalData());
+ propertyNames->add(propertyName->identifier(propertyNames->globalData()));
+}
diff --git a/Source/JavaScriptCore/API/JSObjectRef.h b/Source/JavaScriptCore/API/JSObjectRef.h
new file mode 100644
index 0000000..3e8b0eb
--- /dev/null
+++ b/Source/JavaScriptCore/API/JSObjectRef.h
@@ -0,0 +1,694 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2008 Kelvin W Sherlock (ksherlock@gmail.com)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef JSObjectRef_h
+#define JSObjectRef_h
+
+#include <JavaScriptCore/JSBase.h>
+#include <JavaScriptCore/JSValueRef.h>
+#include <JavaScriptCore/WebKitAvailability.h>
+
+#ifndef __cplusplus
+#include <stdbool.h>
+#endif
+#include <stddef.h> /* for size_t */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*!
+@enum JSPropertyAttribute
+@constant kJSPropertyAttributeNone Specifies that a property has no special attributes.
+@constant kJSPropertyAttributeReadOnly Specifies that a property is read-only.
+@constant kJSPropertyAttributeDontEnum Specifies that a property should not be enumerated by JSPropertyEnumerators and JavaScript for...in loops.
+@constant kJSPropertyAttributeDontDelete Specifies that the delete operation should fail on a property.
+*/
+enum {
+ kJSPropertyAttributeNone = 0,
+ kJSPropertyAttributeReadOnly = 1 << 1,
+ kJSPropertyAttributeDontEnum = 1 << 2,
+ kJSPropertyAttributeDontDelete = 1 << 3
+};
+
+/*!
+@typedef JSPropertyAttributes
+@abstract A set of JSPropertyAttributes. Combine multiple attributes by logically ORing them together.
+*/
+typedef unsigned JSPropertyAttributes;
+
+/*!
+@enum JSClassAttribute
+@constant kJSClassAttributeNone Specifies that a class has no special attributes.
+@constant kJSClassAttributeNoAutomaticPrototype Specifies that a class should not automatically generate a shared prototype for its instance objects. Use kJSClassAttributeNoAutomaticPrototype in combination with JSObjectSetPrototype to manage prototypes manually.
+*/
+enum {
+ kJSClassAttributeNone = 0,
+ kJSClassAttributeNoAutomaticPrototype = 1 << 1
+};
+
+/*!
+@typedef JSClassAttributes
+@abstract A set of JSClassAttributes. Combine multiple attributes by logically ORing them together.
+*/
+typedef unsigned JSClassAttributes;
+
+/*!
+@typedef JSObjectInitializeCallback
+@abstract The callback invoked when an object is first created.
+@param ctx The execution context to use.
+@param object The JSObject being created.
+@discussion If you named your function Initialize, you would declare it like this:
+
+void Initialize(JSContextRef ctx, JSObjectRef object);
+
+Unlike the other object callbacks, the initialize callback is called on the least
+derived class (the parent class) first, and the most derived class last.
+*/
+typedef void
+(*JSObjectInitializeCallback) (JSContextRef ctx, JSObjectRef object);
+
+/*!
+@typedef JSObjectFinalizeCallback
+@abstract The callback invoked when an object is finalized (prepared for garbage collection). An object may be finalized on any thread.
+@param object The JSObject being finalized.
+@discussion If you named your function Finalize, you would declare it like this:
+
+void Finalize(JSObjectRef object);
+
+The finalize callback is called on the most derived class first, and the least
+derived class (the parent class) last.
+
+You must not call any function that may cause a garbage collection or an allocation
+of a garbage collected object from within a JSObjectFinalizeCallback. This includes
+all functions that have a JSContextRef parameter.
+*/
+typedef void
+(*JSObjectFinalizeCallback) (JSObjectRef object);
+
+/*!
+@typedef JSObjectHasPropertyCallback
+@abstract The callback invoked when determining whether an object has a property.
+@param ctx The execution context to use.
+@param object The JSObject to search for the property.
+@param propertyName A JSString containing the name of the property look up.
+@result true if object has the property, otherwise false.
+@discussion If you named your function HasProperty, you would declare it like this:
+
+bool HasProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName);
+
+If this function returns false, the hasProperty request forwards to object's statically declared properties, then its parent class chain (which includes the default object class), then its prototype chain.
+
+This callback enables optimization in cases where only a property's existence needs to be known, not its value, and computing its value would be expensive.
+
+If this callback is NULL, the getProperty callback will be used to service hasProperty requests.
+*/
+typedef bool
+(*JSObjectHasPropertyCallback) (JSContextRef ctx, JSObjectRef object, JSStringRef propertyName);
+
+/*!
+@typedef JSObjectGetPropertyCallback
+@abstract The callback invoked when getting a property's value.
+@param ctx The execution context to use.
+@param object The JSObject to search for the property.
+@param propertyName A JSString containing the name of the property to get.
+@param exception A pointer to a JSValueRef in which to return an exception, if any.
+@result The property's value if object has the property, otherwise NULL.
+@discussion If you named your function GetProperty, you would declare it like this:
+
+JSValueRef GetProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception);
+
+If this function returns NULL, the get request forwards to object's statically declared properties, then its parent class chain (which includes the default object class), then its prototype chain.
+*/
+typedef JSValueRef
+(*JSObjectGetPropertyCallback) (JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception);
+
+/*!
+@typedef JSObjectSetPropertyCallback
+@abstract The callback invoked when setting a property's value.
+@param ctx The execution context to use.
+@param object The JSObject on which to set the property's value.
+@param propertyName A JSString containing the name of the property to set.
+@param value A JSValue to use as the property's value.
+@param exception A pointer to a JSValueRef in which to return an exception, if any.
+@result true if the property was set, otherwise false.
+@discussion If you named your function SetProperty, you would declare it like this:
+
+bool SetProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSValueRef* exception);
+
+If this function returns false, the set request forwards to object's statically declared properties, then its parent class chain (which includes the default object class).
+*/
+typedef bool
+(*JSObjectSetPropertyCallback) (JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSValueRef* exception);
+
+/*!
+@typedef JSObjectDeletePropertyCallback
+@abstract The callback invoked when deleting a property.
+@param ctx The execution context to use.
+@param object The JSObject in which to delete the property.
+@param propertyName A JSString containing the name of the property to delete.
+@param exception A pointer to a JSValueRef in which to return an exception, if any.
+@result true if propertyName was successfully deleted, otherwise false.
+@discussion If you named your function DeleteProperty, you would declare it like this:
+
+bool DeleteProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception);
+
+If this function returns false, the delete request forwards to object's statically declared properties, then its parent class chain (which includes the default object class).
+*/
+typedef bool
+(*JSObjectDeletePropertyCallback) (JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception);
+
+/*!
+@typedef JSObjectGetPropertyNamesCallback
+@abstract The callback invoked when collecting the names of an object's properties.
+@param ctx The execution context to use.
+@param object The JSObject whose property names are being collected.
+@param accumulator A JavaScript property name accumulator in which to accumulate the names of object's properties.
+@discussion If you named your function GetPropertyNames, you would declare it like this:
+
+void GetPropertyNames(JSContextRef ctx, JSObjectRef object, JSPropertyNameAccumulatorRef propertyNames);
+
+Property name accumulators are used by JSObjectCopyPropertyNames and JavaScript for...in loops.
+
+Use JSPropertyNameAccumulatorAddName to add property names to accumulator. A class's getPropertyNames callback only needs to provide the names of properties that the class vends through a custom getProperty or setProperty callback. Other properties, including statically declared properties, properties vended by other classes, and properties belonging to object's prototype, are added independently.
+*/
+typedef void
+(*JSObjectGetPropertyNamesCallback) (JSContextRef ctx, JSObjectRef object, JSPropertyNameAccumulatorRef propertyNames);
+
+/*!
+@typedef JSObjectCallAsFunctionCallback
+@abstract The callback invoked when an object is called as a function.
+@param ctx The execution context to use.
+@param function A JSObject that is the function being called.
+@param thisObject A JSObject that is the 'this' variable in the function's scope.
+@param argumentCount An integer count of the number of arguments in arguments.
+@param arguments A JSValue array of the arguments passed to the function.
+@param exception A pointer to a JSValueRef in which to return an exception, if any.
+@result A JSValue that is the function's return value.
+@discussion If you named your function CallAsFunction, you would declare it like this:
+
+JSValueRef CallAsFunction(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception);
+
+If your callback were invoked by the JavaScript expression 'myObject.myFunction()', function would be set to myFunction, and thisObject would be set to myObject.
+
+If this callback is NULL, calling your object as a function will throw an exception.
+*/
+typedef JSValueRef
+(*JSObjectCallAsFunctionCallback) (JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception);
+
+/*!
+@typedef JSObjectCallAsConstructorCallback
+@abstract The callback invoked when an object is used as a constructor in a 'new' expression.
+@param ctx The execution context to use.
+@param constructor A JSObject that is the constructor being called.
+@param argumentCount An integer count of the number of arguments in arguments.
+@param arguments A JSValue array of the arguments passed to the function.
+@param exception A pointer to a JSValueRef in which to return an exception, if any.
+@result A JSObject that is the constructor's return value.
+@discussion If you named your function CallAsConstructor, you would declare it like this:
+
+JSObjectRef CallAsConstructor(JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception);
+
+If your callback were invoked by the JavaScript expression 'new myConstructor()', constructor would be set to myConstructor.
+
+If this callback is NULL, using your object as a constructor in a 'new' expression will throw an exception.
+*/
+typedef JSObjectRef
+(*JSObjectCallAsConstructorCallback) (JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception);
+
+/*!
+@typedef JSObjectHasInstanceCallback
+@abstract hasInstance The callback invoked when an object is used as the target of an 'instanceof' expression.
+@param ctx The execution context to use.
+@param constructor The JSObject that is the target of the 'instanceof' expression.
+@param possibleInstance The JSValue being tested to determine if it is an instance of constructor.
+@param exception A pointer to a JSValueRef in which to return an exception, if any.
+@result true if possibleInstance is an instance of constructor, otherwise false.
+@discussion If you named your function HasInstance, you would declare it like this:
+
+bool HasInstance(JSContextRef ctx, JSObjectRef constructor, JSValueRef possibleInstance, JSValueRef* exception);
+
+If your callback were invoked by the JavaScript expression 'someValue instanceof myObject', constructor would be set to myObject and possibleInstance would be set to someValue.
+
+If this callback is NULL, 'instanceof' expressions that target your object will return false.
+
+Standard JavaScript practice calls for objects that implement the callAsConstructor callback to implement the hasInstance callback as well.
+*/
+typedef bool
+(*JSObjectHasInstanceCallback) (JSContextRef ctx, JSObjectRef constructor, JSValueRef possibleInstance, JSValueRef* exception);
+
+/*!
+@typedef JSObjectConvertToTypeCallback
+@abstract The callback invoked when converting an object to a particular JavaScript type.
+@param ctx The execution context to use.
+@param object The JSObject to convert.
+@param type A JSType specifying the JavaScript type to convert to.
+@param exception A pointer to a JSValueRef in which to return an exception, if any.
+@result The objects's converted value, or NULL if the object was not converted.
+@discussion If you named your function ConvertToType, you would declare it like this:
+
+JSValueRef ConvertToType(JSContextRef ctx, JSObjectRef object, JSType type, JSValueRef* exception);
+
+If this function returns false, the conversion request forwards to object's parent class chain (which includes the default object class).
+
+This function is only invoked when converting an object to number or string. An object converted to boolean is 'true.' An object converted to object is itself.
+*/
+typedef JSValueRef
+(*JSObjectConvertToTypeCallback) (JSContextRef ctx, JSObjectRef object, JSType type, JSValueRef* exception);
+
+/*!
+@struct JSStaticValue
+@abstract This structure describes a statically declared value property.
+@field name A null-terminated UTF8 string containing the property's name.
+@field getProperty A JSObjectGetPropertyCallback to invoke when getting the property's value.
+@field setProperty A JSObjectSetPropertyCallback to invoke when setting the property's value. May be NULL if the ReadOnly attribute is set.
+@field attributes A logically ORed set of JSPropertyAttributes to give to the property.
+*/
+typedef struct {
+ const char* const name;
+ JSObjectGetPropertyCallback getProperty;
+ JSObjectSetPropertyCallback setProperty;
+ JSPropertyAttributes attributes;
+} JSStaticValue;
+
+/*!
+@struct JSStaticFunction
+@abstract This structure describes a statically declared function property.
+@field name A null-terminated UTF8 string containing the property's name.
+@field callAsFunction A JSObjectCallAsFunctionCallback to invoke when the property is called as a function.
+@field attributes A logically ORed set of JSPropertyAttributes to give to the property.
+*/
+typedef struct {
+ const char* const name;
+ JSObjectCallAsFunctionCallback callAsFunction;
+ JSPropertyAttributes attributes;
+} JSStaticFunction;
+
+/*!
+@struct JSClassDefinition
+@abstract This structure contains properties and callbacks that define a type of object. All fields other than the version field are optional. Any pointer may be NULL.
+@field version The version number of this structure. The current version is 0.
+@field attributes A logically ORed set of JSClassAttributes to give to the class.
+@field className A null-terminated UTF8 string containing the class's name.
+@field parentClass A JSClass to set as the class's parent class. Pass NULL use the default object class.
+@field staticValues A JSStaticValue array containing the class's statically declared value properties. Pass NULL to specify no statically declared value properties. The array must be terminated by a JSStaticValue whose name field is NULL.
+@field staticFunctions A JSStaticFunction array containing the class's statically declared function properties. Pass NULL to specify no statically declared function properties. The array must be terminated by a JSStaticFunction whose name field is NULL.
+@field initialize The callback invoked when an object is first created. Use this callback to initialize the object.
+@field finalize The callback invoked when an object is finalized (prepared for garbage collection). Use this callback to release resources allocated for the object, and perform other cleanup.
+@field hasProperty The callback invoked when determining whether an object has a property. If this field is NULL, getProperty is called instead. The hasProperty callback enables optimization in cases where only a property's existence needs to be known, not its value, and computing its value is expensive.
+@field getProperty The callback invoked when getting a property's value.
+@field setProperty The callback invoked when setting a property's value.
+@field deleteProperty The callback invoked when deleting a property.
+@field getPropertyNames The callback invoked when collecting the names of an object's properties.
+@field callAsFunction The callback invoked when an object is called as a function.
+@field hasInstance The callback invoked when an object is used as the target of an 'instanceof' expression.
+@field callAsConstructor The callback invoked when an object is used as a constructor in a 'new' expression.
+@field convertToType The callback invoked when converting an object to a particular JavaScript type.
+@discussion The staticValues and staticFunctions arrays are the simplest and most efficient means for vending custom properties. Statically declared properties autmatically service requests like getProperty, setProperty, and getPropertyNames. Property access callbacks are required only to implement unusual properties, like array indexes, whose names are not known at compile-time.
+
+If you named your getter function "GetX" and your setter function "SetX", you would declare a JSStaticValue array containing "X" like this:
+
+JSStaticValue StaticValueArray[] = {
+ { "X", GetX, SetX, kJSPropertyAttributeNone },
+ { 0, 0, 0, 0 }
+};
+
+Standard JavaScript practice calls for storing function objects in prototypes, so they can be shared. The default JSClass created by JSClassCreate follows this idiom, instantiating objects with a shared, automatically generating prototype containing the class's function objects. The kJSClassAttributeNoAutomaticPrototype attribute specifies that a JSClass should not automatically generate such a prototype. The resulting JSClass instantiates objects with the default object prototype, and gives each instance object its own copy of the class's function objects.
+
+A NULL callback specifies that the default object callback should substitute, except in the case of hasProperty, where it specifies that getProperty should substitute.
+*/
+typedef struct {
+ int version; /* current (and only) version is 0 */
+ JSClassAttributes attributes;
+
+ const char* className;
+ JSClassRef parentClass;
+
+ const JSStaticValue* staticValues;
+ const JSStaticFunction* staticFunctions;
+
+ JSObjectInitializeCallback initialize;
+ JSObjectFinalizeCallback finalize;
+ JSObjectHasPropertyCallback hasProperty;
+ JSObjectGetPropertyCallback getProperty;
+ JSObjectSetPropertyCallback setProperty;
+ JSObjectDeletePropertyCallback deleteProperty;
+ JSObjectGetPropertyNamesCallback getPropertyNames;
+ JSObjectCallAsFunctionCallback callAsFunction;
+ JSObjectCallAsConstructorCallback callAsConstructor;
+ JSObjectHasInstanceCallback hasInstance;
+ JSObjectConvertToTypeCallback convertToType;
+} JSClassDefinition;
+
+/*!
+@const kJSClassDefinitionEmpty
+@abstract A JSClassDefinition structure of the current version, filled with NULL pointers and having no attributes.
+@discussion Use this constant as a convenience when creating class definitions. For example, to create a class definition with only a finalize method:
+
+JSClassDefinition definition = kJSClassDefinitionEmpty;
+definition.finalize = Finalize;
+*/
+JS_EXPORT extern const JSClassDefinition kJSClassDefinitionEmpty;
+
+/*!
+@function
+@abstract Creates a JavaScript class suitable for use with JSObjectMake.
+@param definition A JSClassDefinition that defines the class.
+@result A JSClass with the given definition. Ownership follows the Create Rule.
+*/
+JS_EXPORT JSClassRef JSClassCreate(const JSClassDefinition* definition);
+
+/*!
+@function
+@abstract Retains a JavaScript class.
+@param jsClass The JSClass to retain.
+@result A JSClass that is the same as jsClass.
+*/
+JS_EXPORT JSClassRef JSClassRetain(JSClassRef jsClass);
+
+/*!
+@function
+@abstract Releases a JavaScript class.
+@param jsClass The JSClass to release.
+*/
+JS_EXPORT void JSClassRelease(JSClassRef jsClass);
+
+/*!
+@function
+@abstract Creates a JavaScript object.
+@param ctx The execution context to use.
+@param jsClass The JSClass to assign to the object. Pass NULL to use the default object class.
+@param data A void* to set as the object's private data. Pass NULL to specify no private data.
+@result A JSObject with the given class and private data.
+@discussion The default object class does not allocate storage for private data, so you must provide a non-NULL jsClass to JSObjectMake if you want your object to be able to store private data.
+
+data is set on the created object before the intialize methods in its class chain are called. This enables the initialize methods to retrieve and manipulate data through JSObjectGetPrivate.
+*/
+JS_EXPORT JSObjectRef JSObjectMake(JSContextRef ctx, JSClassRef jsClass, void* data);
+
+/*!
+@function
+@abstract Convenience method for creating a JavaScript function with a given callback as its implementation.
+@param ctx The execution context to use.
+@param name A JSString containing the function's name. This will be used when converting the function to string. Pass NULL to create an anonymous function.
+@param callAsFunction The JSObjectCallAsFunctionCallback to invoke when the function is called.
+@result A JSObject that is a function. The object's prototype will be the default function prototype.
+*/
+JS_EXPORT JSObjectRef JSObjectMakeFunctionWithCallback(JSContextRef ctx, JSStringRef name, JSObjectCallAsFunctionCallback callAsFunction);
+
+/*!
+@function
+@abstract Convenience method for creating a JavaScript constructor.
+@param ctx The execution context to use.
+@param jsClass A JSClass that is the class your constructor will assign to the objects its constructs. jsClass will be used to set the constructor's .prototype property, and to evaluate 'instanceof' expressions. Pass NULL to use the default object class.
+@param callAsConstructor A JSObjectCallAsConstructorCallback to invoke when your constructor is used in a 'new' expression. Pass NULL to use the default object constructor.
+@result A JSObject that is a constructor. The object's prototype will be the default object prototype.
+@discussion The default object constructor takes no arguments and constructs an object of class jsClass with no private data.
+*/
+JS_EXPORT JSObjectRef JSObjectMakeConstructor(JSContextRef ctx, JSClassRef jsClass, JSObjectCallAsConstructorCallback callAsConstructor);
+
+/*!
+ @function
+ @abstract Creates a JavaScript Array object.
+ @param ctx The execution context to use.
+ @param argumentCount An integer count of the number of arguments in arguments.
+ @param arguments A JSValue array of data to populate the Array with. Pass NULL if argumentCount is 0.
+ @param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.
+ @result A JSObject that is an Array.
+ @discussion The behavior of this function does not exactly match the behavior of the built-in Array constructor. Specifically, if one argument
+ is supplied, this function returns an array with one element.
+ */
+JS_EXPORT JSObjectRef JSObjectMakeArray(JSContextRef ctx, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) AVAILABLE_IN_WEBKIT_VERSION_4_0;
+
+/*!
+ @function
+ @abstract Creates a JavaScript Date object, as if by invoking the built-in Date constructor.
+ @param ctx The execution context to use.
+ @param argumentCount An integer count of the number of arguments in arguments.
+ @param arguments A JSValue array of arguments to pass to the Date Constructor. Pass NULL if argumentCount is 0.
+ @param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.
+ @result A JSObject that is a Date.
+ */
+JS_EXPORT JSObjectRef JSObjectMakeDate(JSContextRef ctx, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) AVAILABLE_IN_WEBKIT_VERSION_4_0;
+
+/*!
+ @function
+ @abstract Creates a JavaScript Error object, as if by invoking the built-in Error constructor.
+ @param ctx The execution context to use.
+ @param argumentCount An integer count of the number of arguments in arguments.
+ @param arguments A JSValue array of arguments to pass to the Error Constructor. Pass NULL if argumentCount is 0.
+ @param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.
+ @result A JSObject that is a Error.
+ */
+JS_EXPORT JSObjectRef JSObjectMakeError(JSContextRef ctx, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) AVAILABLE_IN_WEBKIT_VERSION_4_0;
+
+/*!
+ @function
+ @abstract Creates a JavaScript RegExp object, as if by invoking the built-in RegExp constructor.
+ @param ctx The execution context to use.
+ @param argumentCount An integer count of the number of arguments in arguments.
+ @param arguments A JSValue array of arguments to pass to the RegExp Constructor. Pass NULL if argumentCount is 0.
+ @param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.
+ @result A JSObject that is a RegExp.
+ */
+JS_EXPORT JSObjectRef JSObjectMakeRegExp(JSContextRef ctx, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) AVAILABLE_IN_WEBKIT_VERSION_4_0;
+
+/*!
+@function
+@abstract Creates a function with a given script as its body.
+@param ctx The execution context to use.
+@param name A JSString containing the function's name. This will be used when converting the function to string. Pass NULL to create an anonymous function.
+@param parameterCount An integer count of the number of parameter names in parameterNames.
+@param parameterNames A JSString array containing the names of the function's parameters. Pass NULL if parameterCount is 0.
+@param body A JSString containing the script to use as the function's body.
+@param sourceURL A JSString containing a URL for the script's source file. This is only used when reporting exceptions. Pass NULL if you do not care to include source file information in exceptions.
+@param startingLineNumber An integer value specifying the script's starting line number in the file located at sourceURL. This is only used when reporting exceptions.
+@param exception A pointer to a JSValueRef in which to store a syntax error exception, if any. Pass NULL if you do not care to store a syntax error exception.
+@result A JSObject that is a function, or NULL if either body or parameterNames contains a syntax error. The object's prototype will be the default function prototype.
+@discussion Use this method when you want to execute a script repeatedly, to avoid the cost of re-parsing the script before each execution.
+*/
+JS_EXPORT JSObjectRef JSObjectMakeFunction(JSContextRef ctx, JSStringRef name, unsigned parameterCount, const JSStringRef parameterNames[], JSStringRef body, JSStringRef sourceURL, int startingLineNumber, JSValueRef* exception);
+
+/*!
+@function
+@abstract Gets an object's prototype.
+@param ctx The execution context to use.
+@param object A JSObject whose prototype you want to get.
+@result A JSValue that is the object's prototype.
+*/
+JS_EXPORT JSValueRef JSObjectGetPrototype(JSContextRef ctx, JSObjectRef object);
+
+/*!
+@function
+@abstract Sets an object's prototype.
+@param ctx The execution context to use.
+@param object The JSObject whose prototype you want to set.
+@param value A JSValue to set as the object's prototype.
+*/
+JS_EXPORT void JSObjectSetPrototype(JSContextRef ctx, JSObjectRef object, JSValueRef value);
+
+/*!
+@function
+@abstract Tests whether an object has a given property.
+@param object The JSObject to test.
+@param propertyName A JSString containing the property's name.
+@result true if the object has a property whose name matches propertyName, otherwise false.
+*/
+JS_EXPORT bool JSObjectHasProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName);
+
+/*!
+@function
+@abstract Gets a property from an object.
+@param ctx The execution context to use.
+@param object The JSObject whose property you want to get.
+@param propertyName A JSString containing the property's name.
+@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.
+@result The property's value if object has the property, otherwise the undefined value.
+*/
+JS_EXPORT JSValueRef JSObjectGetProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception);
+
+/*!
+@function
+@abstract Sets a property on an object.
+@param ctx The execution context to use.
+@param object The JSObject whose property you want to set.
+@param propertyName A JSString containing the property's name.
+@param value A JSValue to use as the property's value.
+@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.
+@param attributes A logically ORed set of JSPropertyAttributes to give to the property.
+*/
+JS_EXPORT void JSObjectSetProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSPropertyAttributes attributes, JSValueRef* exception);
+
+/*!
+@function
+@abstract Deletes a property from an object.
+@param ctx The execution context to use.
+@param object The JSObject whose property you want to delete.
+@param propertyName A JSString containing the property's name.
+@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.
+@result true if the delete operation succeeds, otherwise false (for example, if the property has the kJSPropertyAttributeDontDelete attribute set).
+*/
+JS_EXPORT bool JSObjectDeleteProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception);
+
+/*!
+@function
+@abstract Gets a property from an object by numeric index.
+@param ctx The execution context to use.
+@param object The JSObject whose property you want to get.
+@param propertyIndex An integer value that is the property's name.
+@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.
+@result The property's value if object has the property, otherwise the undefined value.
+@discussion Calling JSObjectGetPropertyAtIndex is equivalent to calling JSObjectGetProperty with a string containing propertyIndex, but JSObjectGetPropertyAtIndex provides optimized access to numeric properties.
+*/
+JS_EXPORT JSValueRef JSObjectGetPropertyAtIndex(JSContextRef ctx, JSObjectRef object, unsigned propertyIndex, JSValueRef* exception);
+
+/*!
+@function
+@abstract Sets a property on an object by numeric index.
+@param ctx The execution context to use.
+@param object The JSObject whose property you want to set.
+@param propertyIndex The property's name as a number.
+@param value A JSValue to use as the property's value.
+@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.
+@discussion Calling JSObjectSetPropertyAtIndex is equivalent to calling JSObjectSetProperty with a string containing propertyIndex, but JSObjectSetPropertyAtIndex provides optimized access to numeric properties.
+*/
+JS_EXPORT void JSObjectSetPropertyAtIndex(JSContextRef ctx, JSObjectRef object, unsigned propertyIndex, JSValueRef value, JSValueRef* exception);
+
+/*!
+@function
+@abstract Gets an object's private data.
+@param object A JSObject whose private data you want to get.
+@result A void* that is the object's private data, if the object has private data, otherwise NULL.
+*/
+JS_EXPORT void* JSObjectGetPrivate(JSObjectRef object);
+
+/*!
+@function
+@abstract Sets a pointer to private data on an object.
+@param object The JSObject whose private data you want to set.
+@param data A void* to set as the object's private data.
+@result true if object can store private data, otherwise false.
+@discussion The default object class does not allocate storage for private data. Only objects created with a non-NULL JSClass can store private data.
+*/
+JS_EXPORT bool JSObjectSetPrivate(JSObjectRef object, void* data);
+
+/*!
+@function
+@abstract Tests whether an object can be called as a function.
+@param ctx The execution context to use.
+@param object The JSObject to test.
+@result true if the object can be called as a function, otherwise false.
+*/
+JS_EXPORT bool JSObjectIsFunction(JSContextRef ctx, JSObjectRef object);
+
+/*!
+@function
+@abstract Calls an object as a function.
+@param ctx The execution context to use.
+@param object The JSObject to call as a function.
+@param thisObject The object to use as "this," or NULL to use the global object as "this."
+@param argumentCount An integer count of the number of arguments in arguments.
+@param arguments A JSValue array of arguments to pass to the function. Pass NULL if argumentCount is 0.
+@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.
+@result The JSValue that results from calling object as a function, or NULL if an exception is thrown or object is not a function.
+*/
+JS_EXPORT JSValueRef JSObjectCallAsFunction(JSContextRef ctx, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception);
+
+/*!
+@function
+@abstract Tests whether an object can be called as a constructor.
+@param ctx The execution context to use.
+@param object The JSObject to test.
+@result true if the object can be called as a constructor, otherwise false.
+*/
+JS_EXPORT bool JSObjectIsConstructor(JSContextRef ctx, JSObjectRef object);
+
+/*!
+@function
+@abstract Calls an object as a constructor.
+@param ctx The execution context to use.
+@param object The JSObject to call as a constructor.
+@param argumentCount An integer count of the number of arguments in arguments.
+@param arguments A JSValue array of arguments to pass to the constructor. Pass NULL if argumentCount is 0.
+@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.
+@result The JSObject that results from calling object as a constructor, or NULL if an exception is thrown or object is not a constructor.
+*/
+JS_EXPORT JSObjectRef JSObjectCallAsConstructor(JSContextRef ctx, JSObjectRef object, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception);
+
+/*!
+@function
+@abstract Gets the names of an object's enumerable properties.
+@param ctx The execution context to use.
+@param object The object whose property names you want to get.
+@result A JSPropertyNameArray containing the names object's enumerable properties. Ownership follows the Create Rule.
+*/
+JS_EXPORT JSPropertyNameArrayRef JSObjectCopyPropertyNames(JSContextRef ctx, JSObjectRef object);
+
+/*!
+@function
+@abstract Retains a JavaScript property name array.
+@param array The JSPropertyNameArray to retain.
+@result A JSPropertyNameArray that is the same as array.
+*/
+JS_EXPORT JSPropertyNameArrayRef JSPropertyNameArrayRetain(JSPropertyNameArrayRef array);
+
+/*!
+@function
+@abstract Releases a JavaScript property name array.
+@param array The JSPropetyNameArray to release.
+*/
+JS_EXPORT void JSPropertyNameArrayRelease(JSPropertyNameArrayRef array);
+
+/*!
+@function
+@abstract Gets a count of the number of items in a JavaScript property name array.
+@param array The array from which to retrieve the count.
+@result An integer count of the number of names in array.
+*/
+JS_EXPORT size_t JSPropertyNameArrayGetCount(JSPropertyNameArrayRef array);
+
+/*!
+@function
+@abstract Gets a property name at a given index in a JavaScript property name array.
+@param array The array from which to retrieve the property name.
+@param index The index of the property name to retrieve.
+@result A JSStringRef containing the property name.
+*/
+JS_EXPORT JSStringRef JSPropertyNameArrayGetNameAtIndex(JSPropertyNameArrayRef array, size_t index);
+
+/*!
+@function
+@abstract Adds a property name to a JavaScript property name accumulator.
+@param accumulator The accumulator object to which to add the property name.
+@param propertyName The property name to add.
+*/
+JS_EXPORT void JSPropertyNameAccumulatorAddName(JSPropertyNameAccumulatorRef accumulator, JSStringRef propertyName);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* JSObjectRef_h */
diff --git a/Source/JavaScriptCore/API/JSObjectRefPrivate.h b/Source/JavaScriptCore/API/JSObjectRefPrivate.h
new file mode 100644
index 0000000..32e80ab
--- /dev/null
+++ b/Source/JavaScriptCore/API/JSObjectRefPrivate.h
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef JSObjectRefPrivate_h
+#define JSObjectRefPrivate_h
+
+#include <JavaScriptCore/JSObjectRef.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*!
+ @function
+ @abstract Sets a private property on an object. This private property cannot be accessed from within JavaScript.
+ @param ctx The execution context to use.
+ @param object The JSObject whose private property you want to set.
+ @param propertyName A JSString containing the property's name.
+ @param value A JSValue to use as the property's value. This may be NULL.
+ @result true if object can store private data, otherwise false.
+ @discussion This API allows you to store JS values directly an object in a way that will be ensure that they are kept alive without exposing them to JavaScript code and without introducing the reference cycles that may occur when using JSValueProtect.
+
+ The default object class does not allocate storage for private data. Only objects created with a non-NULL JSClass can store private properties.
+ */
+JS_EXPORT bool JSObjectSetPrivateProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef value);
+
+/*!
+ @function
+ @abstract Gets a private property from an object.
+ @param ctx The execution context to use.
+ @param object The JSObject whose private property you want to get.
+ @param propertyName A JSString containing the property's name.
+ @result The property's value if object has the property, otherwise NULL.
+ */
+JS_EXPORT JSValueRef JSObjectGetPrivateProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName);
+
+/*!
+ @function
+ @abstract Deletes a private property from an object.
+ @param ctx The execution context to use.
+ @param object The JSObject whose private property you want to delete.
+ @param propertyName A JSString containing the property's name.
+ @result true if object can store private data, otherwise false.
+ @discussion The default object class does not allocate storage for private data. Only objects created with a non-NULL JSClass can store private data.
+ */
+JS_EXPORT bool JSObjectDeletePrivateProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // JSObjectRefPrivate_h
diff --git a/Source/JavaScriptCore/API/JSProfilerPrivate.cpp b/Source/JavaScriptCore/API/JSProfilerPrivate.cpp
new file mode 100644
index 0000000..ea277f0
--- /dev/null
+++ b/Source/JavaScriptCore/API/JSProfilerPrivate.cpp
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JSProfilerPrivate.h"
+
+#include "APICast.h"
+#include "OpaqueJSString.h"
+#include "Profiler.h"
+
+using namespace JSC;
+
+void JSStartProfiling(JSContextRef ctx, JSStringRef title)
+{
+ Profiler::profiler()->startProfiling(toJS(ctx), title->ustring());
+}
+
+void JSEndProfiling(JSContextRef ctx, JSStringRef title)
+{
+ ExecState* exec = toJS(ctx);
+ Profiler* profiler = Profiler::profiler();
+ profiler->stopProfiling(exec, title->ustring());
+}
+
diff --git a/Source/JavaScriptCore/API/JSProfilerPrivate.h b/Source/JavaScriptCore/API/JSProfilerPrivate.h
new file mode 100644
index 0000000..b3fe533
--- /dev/null
+++ b/Source/JavaScriptCore/API/JSProfilerPrivate.h
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef JSProfiler_h
+#define JSProfiler_h
+
+#include <JavaScriptCore/JSBase.h>
+
+#ifndef __cplusplus
+#include <stdbool.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*!
+@function JSStartProfiling
+@abstract Enables the profler.
+@param ctx The execution context to use.
+@param title The title of the profile.
+@result The profiler is turned on.
+*/
+JS_EXPORT void JSStartProfiling(JSContextRef ctx, JSStringRef title);
+
+/*!
+@function JSEndProfiling
+@abstract Disables the profler.
+@param ctx The execution context to use.
+@param title The title of the profile.
+@result The profiler is turned off. If there is no name, the most recently started
+ profile is stopped. If the name does not match any profile then no profile
+ is stopped.
+*/
+JS_EXPORT void JSEndProfiling(JSContextRef ctx, JSStringRef title);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* JSProfiler_h */
diff --git a/Source/JavaScriptCore/API/JSRetainPtr.h b/Source/JavaScriptCore/API/JSRetainPtr.h
new file mode 100644
index 0000000..a884f38
--- /dev/null
+++ b/Source/JavaScriptCore/API/JSRetainPtr.h
@@ -0,0 +1,208 @@
+/*
+ * Copyright (C) 2005, 2006, 2007, 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef JSRetainPtr_h
+#define JSRetainPtr_h
+
+#include <JavaScriptCore/JSStringRef.h>
+#include <algorithm>
+
+inline void JSRetain(JSStringRef string) { JSStringRetain(string); }
+inline void JSRelease(JSStringRef string) { JSStringRelease(string); }
+
+enum AdoptTag { Adopt };
+
+template<typename T> class JSRetainPtr {
+public:
+ JSRetainPtr() : m_ptr(0) { }
+ JSRetainPtr(T ptr) : m_ptr(ptr) { if (ptr) JSRetain(ptr); }
+ JSRetainPtr(AdoptTag, T ptr) : m_ptr(ptr) { }
+ JSRetainPtr(const JSRetainPtr&);
+ template<typename U> JSRetainPtr(const JSRetainPtr<U>&);
+ ~JSRetainPtr();
+
+ T get() const { return m_ptr; }
+
+ void clear();
+ T leakRef();
+
+ T operator->() const { return m_ptr; }
+
+ bool operator!() const { return !m_ptr; }
+
+ // This conversion operator allows implicit conversion to bool but not to other integer types.
+ typedef T JSRetainPtr::*UnspecifiedBoolType;
+ operator UnspecifiedBoolType() const { return m_ptr ? &JSRetainPtr::m_ptr : 0; }
+
+ JSRetainPtr& operator=(const JSRetainPtr&);
+ template<typename U> JSRetainPtr& operator=(const JSRetainPtr<U>&);
+ JSRetainPtr& operator=(T);
+ template<typename U> JSRetainPtr& operator=(U*);
+
+ void adopt(T);
+
+ void swap(JSRetainPtr&);
+
+ // FIXME: Remove releaseRef once we change all callers to call leakRef instead.
+ T releaseRef() { return leakRef(); }
+
+private:
+ T m_ptr;
+};
+
+template<typename T> inline JSRetainPtr<T>::JSRetainPtr(const JSRetainPtr& o)
+ : m_ptr(o.m_ptr)
+{
+ if (m_ptr)
+ JSRetain(m_ptr);
+}
+
+template<typename T> template<typename U> inline JSRetainPtr<T>::JSRetainPtr(const JSRetainPtr<U>& o)
+ : m_ptr(o.get())
+{
+ if (m_ptr)
+ JSRetain(m_ptr);
+}
+
+template<typename T> inline JSRetainPtr<T>::~JSRetainPtr()
+{
+ if (m_ptr)
+ JSRelease(m_ptr);
+}
+
+template<typename T> inline void JSRetainPtr<T>::clear()
+{
+ if (T ptr = m_ptr) {
+ m_ptr = 0;
+ JSRelease(ptr);
+ }
+}
+
+template<typename T> inline T JSRetainPtr<T>::leakRef()
+{
+ T ptr = m_ptr;
+ m_ptr = 0;
+ return ptr;
+}
+
+template<typename T> inline JSRetainPtr<T>& JSRetainPtr<T>::operator=(const JSRetainPtr<T>& o)
+{
+ T optr = o.get();
+ if (optr)
+ JSRetain(optr);
+ T ptr = m_ptr;
+ m_ptr = optr;
+ if (ptr)
+ JSRelease(ptr);
+ return *this;
+}
+
+template<typename T> template<typename U> inline JSRetainPtr<T>& JSRetainPtr<T>::operator=(const JSRetainPtr<U>& o)
+{
+ T optr = o.get();
+ if (optr)
+ JSRetain(optr);
+ T ptr = m_ptr;
+ m_ptr = optr;
+ if (ptr)
+ JSRelease(ptr);
+ return *this;
+}
+
+template<typename T> inline JSRetainPtr<T>& JSRetainPtr<T>::operator=(T optr)
+{
+ if (optr)
+ JSRetain(optr);
+ T ptr = m_ptr;
+ m_ptr = optr;
+ if (ptr)
+ JSRelease(ptr);
+ return *this;
+}
+
+template<typename T> inline void JSRetainPtr<T>::adopt(T optr)
+{
+ T ptr = m_ptr;
+ m_ptr = optr;
+ if (ptr)
+ JSRelease(ptr);
+}
+
+template<typename T> template<typename U> inline JSRetainPtr<T>& JSRetainPtr<T>::operator=(U* optr)
+{
+ if (optr)
+ JSRetain(optr);
+ T ptr = m_ptr;
+ m_ptr = optr;
+ if (ptr)
+ JSRelease(ptr);
+ return *this;
+}
+
+template<typename T> inline void JSRetainPtr<T>::swap(JSRetainPtr<T>& o)
+{
+ std::swap(m_ptr, o.m_ptr);
+}
+
+template<typename T> inline void swap(JSRetainPtr<T>& a, JSRetainPtr<T>& b)
+{
+ a.swap(b);
+}
+
+template<typename T, typename U> inline bool operator==(const JSRetainPtr<T>& a, const JSRetainPtr<U>& b)
+{
+ return a.get() == b.get();
+}
+
+template<typename T, typename U> inline bool operator==(const JSRetainPtr<T>& a, U* b)
+{
+ return a.get() == b;
+}
+
+template<typename T, typename U> inline bool operator==(T* a, const JSRetainPtr<U>& b)
+{
+ return a == b.get();
+}
+
+template<typename T, typename U> inline bool operator!=(const JSRetainPtr<T>& a, const JSRetainPtr<U>& b)
+{
+ return a.get() != b.get();
+}
+
+template<typename T, typename U> inline bool operator!=(const JSRetainPtr<T>& a, U* b)
+{
+ return a.get() != b;
+}
+
+template<typename T, typename U> inline bool operator!=(T* a, const JSRetainPtr<U>& b)
+{
+ return a != b.get();
+}
+
+
+#endif // JSRetainPtr_h
diff --git a/Source/JavaScriptCore/API/JSStringRef.cpp b/Source/JavaScriptCore/API/JSStringRef.cpp
new file mode 100644
index 0000000..ea31da6
--- /dev/null
+++ b/Source/JavaScriptCore/API/JSStringRef.cpp
@@ -0,0 +1,112 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JSStringRef.h"
+
+#include "InitializeThreading.h"
+#include "OpaqueJSString.h"
+#include <wtf/unicode/UTF8.h>
+
+using namespace JSC;
+using namespace WTF::Unicode;
+
+JSStringRef JSStringCreateWithCharacters(const JSChar* chars, size_t numChars)
+{
+ initializeThreading();
+ return OpaqueJSString::create(chars, numChars).leakRef();
+}
+
+JSStringRef JSStringCreateWithUTF8CString(const char* string)
+{
+ initializeThreading();
+ if (string) {
+ size_t length = strlen(string);
+ Vector<UChar, 1024> buffer(length);
+ UChar* p = buffer.data();
+ if (conversionOK == convertUTF8ToUTF16(&string, string + length, &p, p + length))
+ return OpaqueJSString::create(buffer.data(), p - buffer.data()).leakRef();
+ }
+
+ // Null string.
+ return OpaqueJSString::create().leakRef();
+}
+
+JSStringRef JSStringRetain(JSStringRef string)
+{
+ string->ref();
+ return string;
+}
+
+void JSStringRelease(JSStringRef string)
+{
+ string->deref();
+}
+
+size_t JSStringGetLength(JSStringRef string)
+{
+ return string->length();
+}
+
+const JSChar* JSStringGetCharactersPtr(JSStringRef string)
+{
+ return string->characters();
+}
+
+size_t JSStringGetMaximumUTF8CStringSize(JSStringRef string)
+{
+ // Any UTF8 character > 3 bytes encodes as a UTF16 surrogate pair.
+ return string->length() * 3 + 1; // + 1 for terminating '\0'
+}
+
+size_t JSStringGetUTF8CString(JSStringRef string, char* buffer, size_t bufferSize)
+{
+ if (!bufferSize)
+ return 0;
+
+ char* p = buffer;
+ const UChar* d = string->characters();
+ ConversionResult result = convertUTF16ToUTF8(&d, d + string->length(), &p, p + bufferSize - 1, true);
+ *p++ = '\0';
+ if (result != conversionOK && result != targetExhausted)
+ return 0;
+
+ return p - buffer;
+}
+
+bool JSStringIsEqual(JSStringRef a, JSStringRef b)
+{
+ unsigned len = a->length();
+ return len == b->length() && 0 == memcmp(a->characters(), b->characters(), len * sizeof(UChar));
+}
+
+bool JSStringIsEqualToUTF8CString(JSStringRef a, const char* b)
+{
+ JSStringRef bBuf = JSStringCreateWithUTF8CString(b);
+ bool result = JSStringIsEqual(a, bBuf);
+ JSStringRelease(bBuf);
+
+ return result;
+}
diff --git a/Source/JavaScriptCore/API/JSStringRef.h b/Source/JavaScriptCore/API/JSStringRef.h
new file mode 100644
index 0000000..c5c1544
--- /dev/null
+++ b/Source/JavaScriptCore/API/JSStringRef.h
@@ -0,0 +1,145 @@
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef JSStringRef_h
+#define JSStringRef_h
+
+#include <JavaScriptCore/JSValueRef.h>
+
+#ifndef __cplusplus
+#include <stdbool.h>
+#endif
+#include <stddef.h> /* for size_t */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if !defined(WIN32) && !defined(_WIN32) && !defined(__WINSCW__) \
+ && !((defined(__CC_ARM) || defined(__ARMCC__)) && !defined(__linux__)) /* RVCT */
+/*!
+@typedef JSChar
+@abstract A Unicode character.
+*/
+ typedef unsigned short JSChar;
+#else
+ typedef wchar_t JSChar;
+#endif
+
+/*!
+@function
+@abstract Creates a JavaScript string from a buffer of Unicode characters.
+@param chars The buffer of Unicode characters to copy into the new JSString.
+@param numChars The number of characters to copy from the buffer pointed to by chars.
+@result A JSString containing chars. Ownership follows the Create Rule.
+*/
+JS_EXPORT JSStringRef JSStringCreateWithCharacters(const JSChar* chars, size_t numChars);
+/*!
+@function
+@abstract Creates a JavaScript string from a null-terminated UTF8 string.
+@param string The null-terminated UTF8 string to copy into the new JSString.
+@result A JSString containing string. Ownership follows the Create Rule.
+*/
+JS_EXPORT JSStringRef JSStringCreateWithUTF8CString(const char* string);
+
+/*!
+@function
+@abstract Retains a JavaScript string.
+@param string The JSString to retain.
+@result A JSString that is the same as string.
+*/
+JS_EXPORT JSStringRef JSStringRetain(JSStringRef string);
+/*!
+@function
+@abstract Releases a JavaScript string.
+@param string The JSString to release.
+*/
+JS_EXPORT void JSStringRelease(JSStringRef string);
+
+/*!
+@function
+@abstract Returns the number of Unicode characters in a JavaScript string.
+@param string The JSString whose length (in Unicode characters) you want to know.
+@result The number of Unicode characters stored in string.
+*/
+JS_EXPORT size_t JSStringGetLength(JSStringRef string);
+/*!
+@function
+@abstract Returns a pointer to the Unicode character buffer that
+ serves as the backing store for a JavaScript string.
+@param string The JSString whose backing store you want to access.
+@result A pointer to the Unicode character buffer that serves as string's
+ backing store, which will be deallocated when string is deallocated.
+*/
+JS_EXPORT const JSChar* JSStringGetCharactersPtr(JSStringRef string);
+
+/*!
+@function
+@abstract Returns the maximum number of bytes a JavaScript string will
+ take up if converted into a null-terminated UTF8 string.
+@param string The JSString whose maximum converted size (in bytes) you
+ want to know.
+@result The maximum number of bytes that could be required to convert string into a
+ null-terminated UTF8 string. The number of bytes that the conversion actually ends
+ up requiring could be less than this, but never more.
+*/
+JS_EXPORT size_t JSStringGetMaximumUTF8CStringSize(JSStringRef string);
+/*!
+@function
+@abstract Converts a JavaScript string into a null-terminated UTF8 string,
+ and copies the result into an external byte buffer.
+@param string The source JSString.
+@param buffer The destination byte buffer into which to copy a null-terminated
+ UTF8 representation of string. On return, buffer contains a UTF8 string
+ representation of string. If bufferSize is too small, buffer will contain only
+ partial results. If buffer is not at least bufferSize bytes in size,
+ behavior is undefined.
+@param bufferSize The size of the external buffer in bytes.
+@result The number of bytes written into buffer (including the null-terminator byte).
+*/
+JS_EXPORT size_t JSStringGetUTF8CString(JSStringRef string, char* buffer, size_t bufferSize);
+
+/*!
+@function
+@abstract Tests whether two JavaScript strings match.
+@param a The first JSString to test.
+@param b The second JSString to test.
+@result true if the two strings match, otherwise false.
+*/
+JS_EXPORT bool JSStringIsEqual(JSStringRef a, JSStringRef b);
+/*!
+@function
+@abstract Tests whether a JavaScript string matches a null-terminated UTF8 string.
+@param a The JSString to test.
+@param b The null-terminated UTF8 string to test.
+@result true if the two strings match, otherwise false.
+*/
+JS_EXPORT bool JSStringIsEqualToUTF8CString(JSStringRef a, const char* b);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* JSStringRef_h */
diff --git a/Source/JavaScriptCore/API/JSStringRefBSTR.cpp b/Source/JavaScriptCore/API/JSStringRefBSTR.cpp
new file mode 100644
index 0000000..70f4254
--- /dev/null
+++ b/Source/JavaScriptCore/API/JSStringRefBSTR.cpp
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JSStringRefBSTR.h"
+
+#include "JSStringRef.h"
+
+JSStringRef JSStringCreateWithBSTR(BSTR string)
+{
+ return JSStringCreateWithCharacters(string ? string : L"", string ? SysStringLen(string) : 0);
+}
+
+BSTR JSStringCopyBSTR(const JSStringRef string)
+{
+ return SysAllocStringLen(JSStringGetCharactersPtr(string), JSStringGetLength(string));
+}
diff --git a/Source/JavaScriptCore/API/JSStringRefBSTR.h b/Source/JavaScriptCore/API/JSStringRefBSTR.h
new file mode 100644
index 0000000..59f19b7
--- /dev/null
+++ b/Source/JavaScriptCore/API/JSStringRefBSTR.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef JSStringRefBSTR_h
+#define JSStringRefBSTR_h
+
+#include "JSBase.h"
+
+#include <windows.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* COM convenience methods */
+
+/*!
+@function
+@abstract Creates a JavaScript string from a BSTR.
+@param string The BSTR to copy into the new JSString.
+@result A JSString containing string. Ownership follows the Create Rule.
+*/
+JS_EXPORT JSStringRef JSStringCreateWithBSTR(const BSTR string);
+
+/*!
+@function
+@abstract Creates a BSTR from a JavaScript string.
+@param string The JSString to copy into the new BSTR.
+@result A BSTR containing string. Ownership follows the Create Rule.
+*/
+JS_EXPORT BSTR JSStringCopyBSTR(const JSStringRef string);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* JSStringRefBSTR_h */
diff --git a/Source/JavaScriptCore/API/JSStringRefCF.cpp b/Source/JavaScriptCore/API/JSStringRefCF.cpp
new file mode 100644
index 0000000..e0961d0
--- /dev/null
+++ b/Source/JavaScriptCore/API/JSStringRefCF.cpp
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JSStringRefCF.h"
+
+#include "APICast.h"
+#include "InitializeThreading.h"
+#include "JSStringRef.h"
+#include "OpaqueJSString.h"
+#include <runtime/UString.h>
+#include <runtime/JSValue.h>
+#include <wtf/OwnArrayPtr.h>
+
+JSStringRef JSStringCreateWithCFString(CFStringRef string)
+{
+ JSC::initializeThreading();
+
+ // We cannot use CFIndex here since CFStringGetLength can return values larger than
+ // it can hold. (<rdar://problem/6806478>)
+ size_t length = CFStringGetLength(string);
+ if (length) {
+ OwnArrayPtr<UniChar> buffer(new UniChar[length]);
+ CFStringGetCharacters(string, CFRangeMake(0, length), buffer.get());
+ COMPILE_ASSERT(sizeof(UniChar) == sizeof(UChar), unichar_and_uchar_must_be_same_size);
+ return OpaqueJSString::create(reinterpret_cast<UChar*>(buffer.get()), length).leakRef();
+ } else {
+ return OpaqueJSString::create(0, 0).leakRef();
+ }
+}
+
+CFStringRef JSStringCopyCFString(CFAllocatorRef alloc, JSStringRef string)
+{
+ return CFStringCreateWithCharacters(alloc, reinterpret_cast<const UniChar*>(string->characters()), string->length());
+}
diff --git a/Source/JavaScriptCore/API/JSStringRefCF.h b/Source/JavaScriptCore/API/JSStringRefCF.h
new file mode 100644
index 0000000..a424765
--- /dev/null
+++ b/Source/JavaScriptCore/API/JSStringRefCF.h
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef JSStringRefCF_h
+#define JSStringRefCF_h
+
+#include "JSBase.h"
+#include <CoreFoundation/CoreFoundation.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* CFString convenience methods */
+
+/*!
+@function
+@abstract Creates a JavaScript string from a CFString.
+@discussion This function is optimized to take advantage of cases when
+ CFStringGetCharactersPtr returns a valid pointer.
+@param string The CFString to copy into the new JSString.
+@result A JSString containing string. Ownership follows the Create Rule.
+*/
+JS_EXPORT JSStringRef JSStringCreateWithCFString(CFStringRef string);
+/*!
+@function
+@abstract Creates a CFString from a JavaScript string.
+@param alloc The alloc parameter to pass to CFStringCreate.
+@param string The JSString to copy into the new CFString.
+@result A CFString containing string. Ownership follows the Create Rule.
+*/
+JS_EXPORT CFStringRef JSStringCopyCFString(CFAllocatorRef alloc, JSStringRef string);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* JSStringRefCF_h */
diff --git a/Source/JavaScriptCore/API/JSValueRef.cpp b/Source/JavaScriptCore/API/JSValueRef.cpp
new file mode 100644
index 0000000..faf4712
--- /dev/null
+++ b/Source/JavaScriptCore/API/JSValueRef.cpp
@@ -0,0 +1,334 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JSValueRef.h"
+
+#include "APICast.h"
+#include "APIShims.h"
+#include "JSCallbackObject.h"
+
+#include <runtime/JSGlobalObject.h>
+#include <runtime/JSONObject.h>
+#include <runtime/JSString.h>
+#include <runtime/LiteralParser.h>
+#include <runtime/Operations.h>
+#include <runtime/Protect.h>
+#include <runtime/UString.h>
+#include <runtime/JSValue.h>
+
+#include <wtf/Assertions.h>
+#include <wtf/text/StringHash.h>
+
+#include <algorithm> // for std::min
+
+using namespace JSC;
+
+::JSType JSValueGetType(JSContextRef ctx, JSValueRef value)
+{
+ ExecState* exec = toJS(ctx);
+ APIEntryShim entryShim(exec);
+
+ JSValue jsValue = toJS(exec, value);
+
+ if (jsValue.isUndefined())
+ return kJSTypeUndefined;
+ if (jsValue.isNull())
+ return kJSTypeNull;
+ if (jsValue.isBoolean())
+ return kJSTypeBoolean;
+ if (jsValue.isNumber())
+ return kJSTypeNumber;
+ if (jsValue.isString())
+ return kJSTypeString;
+ ASSERT(jsValue.isObject());
+ return kJSTypeObject;
+}
+
+bool JSValueIsUndefined(JSContextRef ctx, JSValueRef value)
+{
+ ExecState* exec = toJS(ctx);
+ APIEntryShim entryShim(exec);
+
+ JSValue jsValue = toJS(exec, value);
+ return jsValue.isUndefined();
+}
+
+bool JSValueIsNull(JSContextRef ctx, JSValueRef value)
+{
+ ExecState* exec = toJS(ctx);
+ APIEntryShim entryShim(exec);
+
+ JSValue jsValue = toJS(exec, value);
+ return jsValue.isNull();
+}
+
+bool JSValueIsBoolean(JSContextRef ctx, JSValueRef value)
+{
+ ExecState* exec = toJS(ctx);
+ APIEntryShim entryShim(exec);
+
+ JSValue jsValue = toJS(exec, value);
+ return jsValue.isBoolean();
+}
+
+bool JSValueIsNumber(JSContextRef ctx, JSValueRef value)
+{
+ ExecState* exec = toJS(ctx);
+ APIEntryShim entryShim(exec);
+
+ JSValue jsValue = toJS(exec, value);
+ return jsValue.isNumber();
+}
+
+bool JSValueIsString(JSContextRef ctx, JSValueRef value)
+{
+ ExecState* exec = toJS(ctx);
+ APIEntryShim entryShim(exec);
+
+ JSValue jsValue = toJS(exec, value);
+ return jsValue.isString();
+}
+
+bool JSValueIsObject(JSContextRef ctx, JSValueRef value)
+{
+ ExecState* exec = toJS(ctx);
+ APIEntryShim entryShim(exec);
+
+ JSValue jsValue = toJS(exec, value);
+ return jsValue.isObject();
+}
+
+bool JSValueIsObjectOfClass(JSContextRef ctx, JSValueRef value, JSClassRef jsClass)
+{
+ ExecState* exec = toJS(ctx);
+ APIEntryShim entryShim(exec);
+
+ JSValue jsValue = toJS(exec, value);
+
+ if (JSObject* o = jsValue.getObject()) {
+ if (o->inherits(&JSCallbackObject<JSGlobalObject>::info))
+ return static_cast<JSCallbackObject<JSGlobalObject>*>(o)->inherits(jsClass);
+ else if (o->inherits(&JSCallbackObject<JSObjectWithGlobalObject>::info))
+ return static_cast<JSCallbackObject<JSObjectWithGlobalObject>*>(o)->inherits(jsClass);
+ }
+ return false;
+}
+
+bool JSValueIsEqual(JSContextRef ctx, JSValueRef a, JSValueRef b, JSValueRef* exception)
+{
+ ExecState* exec = toJS(ctx);
+ APIEntryShim entryShim(exec);
+
+ JSValue jsA = toJS(exec, a);
+ JSValue jsB = toJS(exec, b);
+
+ bool result = JSValue::equal(exec, jsA, jsB); // false if an exception is thrown
+ if (exec->hadException()) {
+ if (exception)
+ *exception = toRef(exec, exec->exception());
+ exec->clearException();
+ }
+ return result;
+}
+
+bool JSValueIsStrictEqual(JSContextRef ctx, JSValueRef a, JSValueRef b)
+{
+ ExecState* exec = toJS(ctx);
+ APIEntryShim entryShim(exec);
+
+ JSValue jsA = toJS(exec, a);
+ JSValue jsB = toJS(exec, b);
+
+ return JSValue::strictEqual(exec, jsA, jsB);
+}
+
+bool JSValueIsInstanceOfConstructor(JSContextRef ctx, JSValueRef value, JSObjectRef constructor, JSValueRef* exception)
+{
+ ExecState* exec = toJS(ctx);
+ APIEntryShim entryShim(exec);
+
+ JSValue jsValue = toJS(exec, value);
+
+ JSObject* jsConstructor = toJS(constructor);
+ if (!jsConstructor->structure()->typeInfo().implementsHasInstance())
+ return false;
+ bool result = jsConstructor->hasInstance(exec, jsValue, jsConstructor->get(exec, exec->propertyNames().prototype)); // false if an exception is thrown
+ if (exec->hadException()) {
+ if (exception)
+ *exception = toRef(exec, exec->exception());
+ exec->clearException();
+ }
+ return result;
+}
+
+JSValueRef JSValueMakeUndefined(JSContextRef ctx)
+{
+ ExecState* exec = toJS(ctx);
+ APIEntryShim entryShim(exec);
+
+ return toRef(exec, jsUndefined());
+}
+
+JSValueRef JSValueMakeNull(JSContextRef ctx)
+{
+ ExecState* exec = toJS(ctx);
+ APIEntryShim entryShim(exec);
+
+ return toRef(exec, jsNull());
+}
+
+JSValueRef JSValueMakeBoolean(JSContextRef ctx, bool value)
+{
+ ExecState* exec = toJS(ctx);
+ APIEntryShim entryShim(exec);
+
+ return toRef(exec, jsBoolean(value));
+}
+
+JSValueRef JSValueMakeNumber(JSContextRef ctx, double value)
+{
+ ExecState* exec = toJS(ctx);
+ APIEntryShim entryShim(exec);
+
+ // Our JSValue representation relies on a standard bit pattern for NaN. NaNs
+ // generated internally to JavaScriptCore naturally have that representation,
+ // but an external NaN might not.
+ if (isnan(value))
+ value = NaN;
+
+ return toRef(exec, jsNumber(value));
+}
+
+JSValueRef JSValueMakeString(JSContextRef ctx, JSStringRef string)
+{
+ ExecState* exec = toJS(ctx);
+ APIEntryShim entryShim(exec);
+
+ return toRef(exec, jsString(exec, string->ustring()));
+}
+
+JSValueRef JSValueMakeFromJSONString(JSContextRef ctx, JSStringRef string)
+{
+ ExecState* exec = toJS(ctx);
+ APIEntryShim entryShim(exec);
+ LiteralParser parser(exec, string->ustring(), LiteralParser::StrictJSON);
+ return toRef(exec, parser.tryLiteralParse());
+}
+
+JSStringRef JSValueCreateJSONString(JSContextRef ctx, JSValueRef apiValue, unsigned indent, JSValueRef* exception)
+{
+ ExecState* exec = toJS(ctx);
+ APIEntryShim entryShim(exec);
+ JSValue value = toJS(exec, apiValue);
+ UString result = JSONStringify(exec, value, indent);
+ if (exception)
+ *exception = 0;
+ if (exec->hadException()) {
+ if (exception)
+ *exception = toRef(exec, exec->exception());
+ exec->clearException();
+ return 0;
+ }
+ return OpaqueJSString::create(result).leakRef();
+}
+
+bool JSValueToBoolean(JSContextRef ctx, JSValueRef value)
+{
+ ExecState* exec = toJS(ctx);
+ APIEntryShim entryShim(exec);
+
+ JSValue jsValue = toJS(exec, value);
+ return jsValue.toBoolean(exec);
+}
+
+double JSValueToNumber(JSContextRef ctx, JSValueRef value, JSValueRef* exception)
+{
+ ExecState* exec = toJS(ctx);
+ APIEntryShim entryShim(exec);
+
+ JSValue jsValue = toJS(exec, value);
+
+ double number = jsValue.toNumber(exec);
+ if (exec->hadException()) {
+ if (exception)
+ *exception = toRef(exec, exec->exception());
+ exec->clearException();
+ number = NaN;
+ }
+ return number;
+}
+
+JSStringRef JSValueToStringCopy(JSContextRef ctx, JSValueRef value, JSValueRef* exception)
+{
+ ExecState* exec = toJS(ctx);
+ APIEntryShim entryShim(exec);
+
+ JSValue jsValue = toJS(exec, value);
+
+ RefPtr<OpaqueJSString> stringRef(OpaqueJSString::create(jsValue.toString(exec)));
+ if (exec->hadException()) {
+ if (exception)
+ *exception = toRef(exec, exec->exception());
+ exec->clearException();
+ stringRef.clear();
+ }
+ return stringRef.release().leakRef();
+}
+
+JSObjectRef JSValueToObject(JSContextRef ctx, JSValueRef value, JSValueRef* exception)
+{
+ ExecState* exec = toJS(ctx);
+ APIEntryShim entryShim(exec);
+
+ JSValue jsValue = toJS(exec, value);
+
+ JSObjectRef objectRef = toRef(jsValue.toObject(exec));
+ if (exec->hadException()) {
+ if (exception)
+ *exception = toRef(exec, exec->exception());
+ exec->clearException();
+ objectRef = 0;
+ }
+ return objectRef;
+}
+
+void JSValueProtect(JSContextRef ctx, JSValueRef value)
+{
+ ExecState* exec = toJS(ctx);
+ APIEntryShim entryShim(exec);
+
+ JSValue jsValue = toJSForGC(exec, value);
+ gcProtect(jsValue);
+}
+
+void JSValueUnprotect(JSContextRef ctx, JSValueRef value)
+{
+ ExecState* exec = toJS(ctx);
+ APIEntryShim entryShim(exec);
+
+ JSValue jsValue = toJSForGC(exec, value);
+ gcUnprotect(jsValue);
+}
diff --git a/Source/JavaScriptCore/API/JSValueRef.h b/Source/JavaScriptCore/API/JSValueRef.h
new file mode 100644
index 0000000..4186db8
--- /dev/null
+++ b/Source/JavaScriptCore/API/JSValueRef.h
@@ -0,0 +1,301 @@
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef JSValueRef_h
+#define JSValueRef_h
+
+#include <JavaScriptCore/JSBase.h>
+#include <JavaScriptCore/WebKitAvailability.h>
+
+#ifndef __cplusplus
+#include <stdbool.h>
+#endif
+
+/*!
+@enum JSType
+@abstract A constant identifying the type of a JSValue.
+@constant kJSTypeUndefined The unique undefined value.
+@constant kJSTypeNull The unique null value.
+@constant kJSTypeBoolean A primitive boolean value, one of true or false.
+@constant kJSTypeNumber A primitive number value.
+@constant kJSTypeString A primitive string value.
+@constant kJSTypeObject An object value (meaning that this JSValueRef is a JSObjectRef).
+*/
+typedef enum {
+ kJSTypeUndefined,
+ kJSTypeNull,
+ kJSTypeBoolean,
+ kJSTypeNumber,
+ kJSTypeString,
+ kJSTypeObject
+} JSType;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*!
+@function
+@abstract Returns a JavaScript value's type.
+@param ctx The execution context to use.
+@param value The JSValue whose type you want to obtain.
+@result A value of type JSType that identifies value's type.
+*/
+JS_EXPORT JSType JSValueGetType(JSContextRef ctx, JSValueRef value);
+
+/*!
+@function
+@abstract Tests whether a JavaScript value's type is the undefined type.
+@param ctx The execution context to use.
+@param value The JSValue to test.
+@result true if value's type is the undefined type, otherwise false.
+*/
+JS_EXPORT bool JSValueIsUndefined(JSContextRef ctx, JSValueRef value);
+
+/*!
+@function
+@abstract Tests whether a JavaScript value's type is the null type.
+@param ctx The execution context to use.
+@param value The JSValue to test.
+@result true if value's type is the null type, otherwise false.
+*/
+JS_EXPORT bool JSValueIsNull(JSContextRef ctx, JSValueRef value);
+
+/*!
+@function
+@abstract Tests whether a JavaScript value's type is the boolean type.
+@param ctx The execution context to use.
+@param value The JSValue to test.
+@result true if value's type is the boolean type, otherwise false.
+*/
+JS_EXPORT bool JSValueIsBoolean(JSContextRef ctx, JSValueRef value);
+
+/*!
+@function
+@abstract Tests whether a JavaScript value's type is the number type.
+@param ctx The execution context to use.
+@param value The JSValue to test.
+@result true if value's type is the number type, otherwise false.
+*/
+JS_EXPORT bool JSValueIsNumber(JSContextRef ctx, JSValueRef value);
+
+/*!
+@function
+@abstract Tests whether a JavaScript value's type is the string type.
+@param ctx The execution context to use.
+@param value The JSValue to test.
+@result true if value's type is the string type, otherwise false.
+*/
+JS_EXPORT bool JSValueIsString(JSContextRef ctx, JSValueRef value);
+
+/*!
+@function
+@abstract Tests whether a JavaScript value's type is the object type.
+@param ctx The execution context to use.
+@param value The JSValue to test.
+@result true if value's type is the object type, otherwise false.
+*/
+JS_EXPORT bool JSValueIsObject(JSContextRef ctx, JSValueRef value);
+
+/*!
+@function
+@abstract Tests whether a JavaScript value is an object with a given class in its class chain.
+@param ctx The execution context to use.
+@param value The JSValue to test.
+@param jsClass The JSClass to test against.
+@result true if value is an object and has jsClass in its class chain, otherwise false.
+*/
+JS_EXPORT bool JSValueIsObjectOfClass(JSContextRef ctx, JSValueRef value, JSClassRef jsClass);
+
+/* Comparing values */
+
+/*!
+@function
+@abstract Tests whether two JavaScript values are equal, as compared by the JS == operator.
+@param ctx The execution context to use.
+@param a The first value to test.
+@param b The second value to test.
+@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.
+@result true if the two values are equal, false if they are not equal or an exception is thrown.
+*/
+JS_EXPORT bool JSValueIsEqual(JSContextRef ctx, JSValueRef a, JSValueRef b, JSValueRef* exception);
+
+/*!
+@function
+@abstract Tests whether two JavaScript values are strict equal, as compared by the JS === operator.
+@param ctx The execution context to use.
+@param a The first value to test.
+@param b The second value to test.
+@result true if the two values are strict equal, otherwise false.
+*/
+JS_EXPORT bool JSValueIsStrictEqual(JSContextRef ctx, JSValueRef a, JSValueRef b);
+
+/*!
+@function
+@abstract Tests whether a JavaScript value is an object constructed by a given constructor, as compared by the JS instanceof operator.
+@param ctx The execution context to use.
+@param value The JSValue to test.
+@param constructor The constructor to test against.
+@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.
+@result true if value is an object constructed by constructor, as compared by the JS instanceof operator, otherwise false.
+*/
+JS_EXPORT bool JSValueIsInstanceOfConstructor(JSContextRef ctx, JSValueRef value, JSObjectRef constructor, JSValueRef* exception);
+
+/* Creating values */
+
+/*!
+@function
+@abstract Creates a JavaScript value of the undefined type.
+@param ctx The execution context to use.
+@result The unique undefined value.
+*/
+JS_EXPORT JSValueRef JSValueMakeUndefined(JSContextRef ctx);
+
+/*!
+@function
+@abstract Creates a JavaScript value of the null type.
+@param ctx The execution context to use.
+@result The unique null value.
+*/
+JS_EXPORT JSValueRef JSValueMakeNull(JSContextRef ctx);
+
+/*!
+@function
+@abstract Creates a JavaScript value of the boolean type.
+@param ctx The execution context to use.
+@param boolean The bool to assign to the newly created JSValue.
+@result A JSValue of the boolean type, representing the value of boolean.
+*/
+JS_EXPORT JSValueRef JSValueMakeBoolean(JSContextRef ctx, bool boolean);
+
+/*!
+@function
+@abstract Creates a JavaScript value of the number type.
+@param ctx The execution context to use.
+@param number The double to assign to the newly created JSValue.
+@result A JSValue of the number type, representing the value of number.
+*/
+JS_EXPORT JSValueRef JSValueMakeNumber(JSContextRef ctx, double number);
+
+/*!
+@function
+@abstract Creates a JavaScript value of the string type.
+@param ctx The execution context to use.
+@param string The JSString to assign to the newly created JSValue. The
+ newly created JSValue retains string, and releases it upon garbage collection.
+@result A JSValue of the string type, representing the value of string.
+*/
+JS_EXPORT JSValueRef JSValueMakeString(JSContextRef ctx, JSStringRef string);
+
+/* Converting to and from JSON formatted strings */
+
+/*!
+ @function
+ @abstract Creates a JavaScript value from a JSON formatted string.
+ @param ctx The execution context to use.
+ @param string The JSString containing the JSON string to be parsed.
+ @result A JSValue containing the parsed value, or NULL if the input is invalid.
+ */
+JS_EXPORT JSValueRef JSValueMakeFromJSONString(JSContextRef ctx, JSStringRef string) AVAILABLE_AFTER_WEBKIT_VERSION_4_0;
+
+/*!
+ @function
+ @abstract Creates a JavaScript string containing the JSON serialized representation of a JS value.
+ @param ctx The execution context to use.
+ @param value The value to serialize.
+ @param indent The number of spaces to indent when nesting. If 0, the resulting JSON will not contains newlines. The size of the indent is clamped to 10 spaces.
+ @param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.
+ @result A JSString with the result of serialization, or NULL if an exception is thrown.
+ */
+JS_EXPORT JSStringRef JSValueCreateJSONString(JSContextRef ctx, JSValueRef value, unsigned indent, JSValueRef* exception) AVAILABLE_AFTER_WEBKIT_VERSION_4_0;
+
+/* Converting to primitive values */
+
+/*!
+@function
+@abstract Converts a JavaScript value to boolean and returns the resulting boolean.
+@param ctx The execution context to use.
+@param value The JSValue to convert.
+@result The boolean result of conversion.
+*/
+JS_EXPORT bool JSValueToBoolean(JSContextRef ctx, JSValueRef value);
+
+/*!
+@function
+@abstract Converts a JavaScript value to number and returns the resulting number.
+@param ctx The execution context to use.
+@param value The JSValue to convert.
+@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.
+@result The numeric result of conversion, or NaN if an exception is thrown.
+*/
+JS_EXPORT double JSValueToNumber(JSContextRef ctx, JSValueRef value, JSValueRef* exception);
+
+/*!
+@function
+@abstract Converts a JavaScript value to string and copies the result into a JavaScript string.
+@param ctx The execution context to use.
+@param value The JSValue to convert.
+@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.
+@result A JSString with the result of conversion, or NULL if an exception is thrown. Ownership follows the Create Rule.
+*/
+JS_EXPORT JSStringRef JSValueToStringCopy(JSContextRef ctx, JSValueRef value, JSValueRef* exception);
+
+/*!
+@function
+@abstract Converts a JavaScript value to object and returns the resulting object.
+@param ctx The execution context to use.
+@param value The JSValue to convert.
+@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.
+@result The JSObject result of conversion, or NULL if an exception is thrown.
+*/
+JS_EXPORT JSObjectRef JSValueToObject(JSContextRef ctx, JSValueRef value, JSValueRef* exception);
+
+/* Garbage collection */
+/*!
+@function
+@abstract Protects a JavaScript value from garbage collection.
+@param ctx The execution context to use.
+@param value The JSValue to protect.
+@discussion Use this method when you want to store a JSValue in a global or on the heap, where the garbage collector will not be able to discover your reference to it.
+
+A value may be protected multiple times and must be unprotected an equal number of times before becoming eligible for garbage collection.
+*/
+JS_EXPORT void JSValueProtect(JSContextRef ctx, JSValueRef value);
+
+/*!
+@function
+@abstract Unprotects a JavaScript value from garbage collection.
+@param ctx The execution context to use.
+@param value The JSValue to unprotect.
+@discussion A value may be protected multiple times and must be unprotected an
+ equal number of times before becoming eligible for garbage collection.
+*/
+JS_EXPORT void JSValueUnprotect(JSContextRef ctx, JSValueRef value);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* JSValueRef_h */
diff --git a/Source/JavaScriptCore/API/JSWeakObjectMapRefInternal.h b/Source/JavaScriptCore/API/JSWeakObjectMapRefInternal.h
new file mode 100644
index 0000000..64e1f4d
--- /dev/null
+++ b/Source/JavaScriptCore/API/JSWeakObjectMapRefInternal.h
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef JSWeakObjectMapRefInternal_h
+#define JSWeakObjectMapRefInternal_h
+
+#include "WeakGCMap.h"
+#include <wtf/RefCounted.h>
+
+namespace JSC {
+
+class JSObject;
+
+}
+
+typedef void (*JSWeakMapDestroyedCallback)(struct OpaqueJSWeakObjectMap*, void*);
+
+typedef JSC::WeakGCMap<void*, JSC::JSObject*> WeakMapType;
+
+struct OpaqueJSWeakObjectMap : public RefCounted<OpaqueJSWeakObjectMap> {
+public:
+ static PassRefPtr<OpaqueJSWeakObjectMap> create(void* data, JSWeakMapDestroyedCallback callback)
+ {
+ return adoptRef(new OpaqueJSWeakObjectMap(data, callback));
+ }
+
+ WeakMapType& map() { return m_map; }
+
+ ~OpaqueJSWeakObjectMap()
+ {
+ m_callback(this, m_data);
+ }
+
+private:
+ OpaqueJSWeakObjectMap(void* data, JSWeakMapDestroyedCallback callback)
+ : m_data(data)
+ , m_callback(callback)
+ {
+ }
+ WeakMapType m_map;
+ void* m_data;
+ JSWeakMapDestroyedCallback m_callback;
+};
+
+
+#endif // JSWeakObjectMapInternal_h
diff --git a/Source/JavaScriptCore/API/JSWeakObjectMapRefPrivate.cpp b/Source/JavaScriptCore/API/JSWeakObjectMapRefPrivate.cpp
new file mode 100644
index 0000000..8182075
--- /dev/null
+++ b/Source/JavaScriptCore/API/JSWeakObjectMapRefPrivate.cpp
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JSWeakObjectMapRefPrivate.h"
+
+#include "APICast.h"
+#include "APIShims.h"
+#include "JSCallbackObject.h"
+#include "JSValue.h"
+#include "JSWeakObjectMapRefInternal.h"
+#include <wtf/HashMap.h>
+#include <wtf/text/StringHash.h>
+
+using namespace WTF;
+using namespace JSC;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+JSWeakObjectMapRef JSWeakObjectMapCreate(JSContextRef context, void* privateData, JSWeakMapDestroyedCallback callback)
+{
+ ExecState* exec = toJS(context);
+ APIEntryShim entryShim(exec);
+ RefPtr<OpaqueJSWeakObjectMap> map = OpaqueJSWeakObjectMap::create(privateData, callback);
+ exec->lexicalGlobalObject()->registerWeakMap(map.get());
+ return map.get();
+}
+
+void JSWeakObjectMapSet(JSContextRef ctx, JSWeakObjectMapRef map, void* key, JSObjectRef object)
+{
+ ExecState* exec = toJS(ctx);
+ APIEntryShim entryShim(exec);
+ JSObject* obj = toJS(object);
+ if (!obj)
+ return;
+ ASSERT(obj->inherits(&JSCallbackObject<JSGlobalObject>::info) || obj->inherits(&JSCallbackObject<JSObjectWithGlobalObject>::info));
+ map->map().set(key, obj);
+}
+
+JSObjectRef JSWeakObjectMapGet(JSContextRef ctx, JSWeakObjectMapRef map, void* key)
+{
+ ExecState* exec = toJS(ctx);
+ APIEntryShim entryShim(exec);
+ return toRef(static_cast<JSObject*>(map->map().get(key)));
+}
+
+bool JSWeakObjectMapClear(JSContextRef ctx, JSWeakObjectMapRef map, void* key, JSObjectRef object)
+{
+ ExecState* exec = toJS(ctx);
+ APIEntryShim entryShim(exec);
+ JSObject* obj = toJS(object);
+ if (map->map().uncheckedRemove(key, obj))
+ return true;
+ return false;
+}
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/Source/JavaScriptCore/API/JSWeakObjectMapRefPrivate.h b/Source/JavaScriptCore/API/JSWeakObjectMapRefPrivate.h
new file mode 100644
index 0000000..d36111c
--- /dev/null
+++ b/Source/JavaScriptCore/API/JSWeakObjectMapRefPrivate.h
@@ -0,0 +1,95 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef JSWeakObjectMapRefPrivate_h
+#define JSWeakObjectMapRefPrivate_h
+
+#include <JavaScriptCore/JSContextRef.h>
+#include <JavaScriptCore/JSValueRef.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*! @typedef JSWeakObjectMapRef A weak map for storing JSObjectRefs */
+typedef struct OpaqueJSWeakObjectMap* JSWeakObjectMapRef;
+
+/*!
+ @typedef JSWeakMapDestroyedCallback
+ @abstract The callback invoked when a JSWeakObjectMapRef is being destroyed.
+ @param map The map that is being destroyed.
+ @param data The private data (if any) that was associated with the map instance.
+ */
+typedef void (*JSWeakMapDestroyedCallback)(JSWeakObjectMapRef map, void* data);
+
+/*!
+ @function
+ @abstract Creates a weak value map that can be used to reference user defined objects without preventing them from being collected.
+ @param ctx The execution context to use.
+ @param data A void* to set as the map's private data. Pass NULL to specify no private data.
+ @param destructor A function to call when the weak map is destroyed.
+ @result A JSWeakObjectMapRef bound to the given context, data and destructor.
+ @discussion The JSWeakObjectMapRef can be used as a storage mechanism to hold custom JS objects without forcing those objects to
+ remain live as JSValueProtect would. Any objects that are intended to be stored in a weak map must be user defined objects that
+ remove themselves from the map in their finalizer.
+ */
+JS_EXPORT JSWeakObjectMapRef JSWeakObjectMapCreate(JSContextRef ctx, void* data, JSWeakMapDestroyedCallback destructor);
+
+/*!
+ @function
+ @abstract Associates a JSObjectRef with the given key in a JSWeakObjectMap.
+ @param ctx The execution context to use.
+ @param map The map to operate on.
+ @param key The key to associate a weak reference with.
+ @param object The user defined object to associate with the key.
+ */
+JS_EXPORT void JSWeakObjectMapSet(JSContextRef ctx, JSWeakObjectMapRef map, void* key, JSObjectRef);
+
+/*!
+ @function
+ @abstract Retrieves the JSObjectRef associated with a key.
+ @param ctx The execution context to use.
+ @param map The map to query.
+ @param key The key to search for.
+ @result Either the live object associated with the provided key, or NULL.
+ */
+JS_EXPORT JSObjectRef JSWeakObjectMapGet(JSContextRef ctx, JSWeakObjectMapRef map, void* key);
+
+/*!
+ @function
+ @abstract Clears the association between a key and an object in a JSWeakObjectMapRef
+ @param ctx The execution context to use.
+ @param map The map to clear the key association from.
+ @param key The key to use.
+ @param object The old object value.
+ @result Returns true if the key/object association was present in map, and has been removed.
+ */
+JS_EXPORT bool JSWeakObjectMapClear(JSContextRef ctx, JSWeakObjectMapRef map, void* key, JSObjectRef object);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // JSWeakObjectMapPrivate_h
diff --git a/Source/JavaScriptCore/API/JavaScript.h b/Source/JavaScriptCore/API/JavaScript.h
new file mode 100644
index 0000000..f8d92d8
--- /dev/null
+++ b/Source/JavaScriptCore/API/JavaScript.h
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
+ * Copyright (C) 2008 Alp Toker <alp@atoker.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef JavaScript_h
+#define JavaScript_h
+
+#include <JavaScriptCore/JSBase.h>
+#include <JavaScriptCore/JSContextRef.h>
+#include <JavaScriptCore/JSStringRef.h>
+#include <JavaScriptCore/JSObjectRef.h>
+#include <JavaScriptCore/JSValueRef.h>
+
+#endif /* JavaScript_h */
diff --git a/Source/JavaScriptCore/API/JavaScriptCore.h b/Source/JavaScriptCore/API/JavaScriptCore.h
new file mode 100644
index 0000000..87d6018
--- /dev/null
+++ b/Source/JavaScriptCore/API/JavaScriptCore.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef JavaScriptCore_h
+#define JavaScriptCore_h
+
+#include <JavaScriptCore/JavaScript.h>
+#include <JavaScriptCore/JSStringRefCF.h>
+
+#endif /* JavaScriptCore_h */
diff --git a/Source/JavaScriptCore/API/OpaqueJSString.cpp b/Source/JavaScriptCore/API/OpaqueJSString.cpp
new file mode 100644
index 0000000..9a116e6
--- /dev/null
+++ b/Source/JavaScriptCore/API/OpaqueJSString.cpp
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "OpaqueJSString.h"
+
+#include <interpreter/CallFrame.h>
+#include <runtime/JSGlobalObject.h>
+#include <runtime/Identifier.h>
+
+using namespace JSC;
+
+PassRefPtr<OpaqueJSString> OpaqueJSString::create(const UString& ustring)
+{
+ if (!ustring.isNull())
+ return adoptRef(new OpaqueJSString(ustring.characters(), ustring.length()));
+ return 0;
+}
+
+UString OpaqueJSString::ustring() const
+{
+ if (this && m_characters)
+ return UString(m_characters, m_length);
+ return UString();
+}
+
+Identifier OpaqueJSString::identifier(JSGlobalData* globalData) const
+{
+ if (!this || !m_characters)
+ return Identifier(globalData, static_cast<const char*>(0));
+
+ return Identifier(globalData, m_characters, m_length);
+}
diff --git a/Source/JavaScriptCore/API/OpaqueJSString.h b/Source/JavaScriptCore/API/OpaqueJSString.h
new file mode 100644
index 0000000..473c815
--- /dev/null
+++ b/Source/JavaScriptCore/API/OpaqueJSString.h
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef OpaqueJSString_h
+#define OpaqueJSString_h
+
+#include <runtime/UString.h>
+
+namespace JSC {
+ class Identifier;
+ class JSGlobalData;
+}
+
+struct OpaqueJSString : public ThreadSafeShared<OpaqueJSString> {
+
+ static PassRefPtr<OpaqueJSString> create() // null
+ {
+ return adoptRef(new OpaqueJSString);
+ }
+
+ static PassRefPtr<OpaqueJSString> create(const UChar* characters, unsigned length)
+ {
+ return adoptRef(new OpaqueJSString(characters, length));
+ }
+
+ static PassRefPtr<OpaqueJSString> create(const JSC::UString&);
+
+ UChar* characters() { return this ? m_characters : 0; }
+ unsigned length() { return this ? m_length : 0; }
+
+ JSC::UString ustring() const;
+ JSC::Identifier identifier(JSC::JSGlobalData*) const;
+
+private:
+ friend class WTF::ThreadSafeShared<OpaqueJSString>;
+
+ OpaqueJSString()
+ : m_characters(0)
+ , m_length(0)
+ {
+ }
+
+ OpaqueJSString(const UChar* characters, unsigned length)
+ : m_length(length)
+ {
+ m_characters = new UChar[length];
+ memcpy(m_characters, characters, length * sizeof(UChar));
+ }
+
+ ~OpaqueJSString()
+ {
+ delete[] m_characters;
+ }
+
+ UChar* m_characters;
+ unsigned m_length;
+};
+
+#endif
diff --git a/Source/JavaScriptCore/API/WebKitAvailability.h b/Source/JavaScriptCore/API/WebKitAvailability.h
new file mode 100644
index 0000000..0e4f091
--- /dev/null
+++ b/Source/JavaScriptCore/API/WebKitAvailability.h
@@ -0,0 +1,904 @@
+/*
+ * Copyright (C) 2008, 2009, 2010 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __WebKitAvailability__
+#define __WebKitAvailability__
+
+/* The structure of this header is based on AvailabilityMacros.h. The major difference is that the availability
+ macros are defined in terms of WebKit version numbers rather than Mac OS X system version numbers, as WebKit
+ releases span multiple versions of Mac OS X.
+*/
+
+#define WEBKIT_VERSION_1_0 0x0100
+#define WEBKIT_VERSION_1_1 0x0110
+#define WEBKIT_VERSION_1_2 0x0120
+#define WEBKIT_VERSION_1_3 0x0130
+#define WEBKIT_VERSION_2_0 0x0200
+#define WEBKIT_VERSION_3_0 0x0300
+#define WEBKIT_VERSION_3_1 0x0310
+#define WEBKIT_VERSION_4_0 0x0400
+#define WEBKIT_VERSION_LATEST 0x9999
+
+#ifdef __APPLE__
+#include <AvailabilityMacros.h>
+#else
+/*
+ * For non-Mac platforms, require the newest version.
+ */
+#define WEBKIT_VERSION_MIN_REQUIRED WEBKIT_VERSION_LATEST
+/*
+ * only certain compilers support __attribute__((deprecated))
+ */
+#if defined(__GNUC__) && ((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1)))
+ #define DEPRECATED_ATTRIBUTE __attribute__((deprecated))
+#else
+ #define DEPRECATED_ATTRIBUTE
+#endif
+#endif
+
+/* The versions of GCC that shipped with Xcode prior to 3.0 (GCC build number < 5400) did not support attributes on methods.
+ If we are building with one of these versions, we need to omit the attribute. We achieve this by wrapping the annotation
+ in WEBKIT_OBJC_METHOD_ANNOTATION, which will remove the annotation when an old version of GCC is in use and will otherwise
+ expand to the annotation. The same is needed for protocol methods.
+*/
+#if defined(__APPLE_CC__) && __APPLE_CC__ < 5400
+ #define WEBKIT_OBJC_METHOD_ANNOTATION(ANNOTATION)
+#else
+ #define WEBKIT_OBJC_METHOD_ANNOTATION(ANNOTATION) ANNOTATION
+#endif
+
+
+/* If minimum WebKit version is not specified, assume the version that shipped with the target Mac OS X version */
+#ifndef WEBKIT_VERSION_MIN_REQUIRED
+ #if !defined(MAC_OS_X_VERSION_10_2) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_2
+ #error WebKit was not available prior to Mac OS X 10.2
+ #elif !defined(MAC_OS_X_VERSION_10_3) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_3
+ /* WebKit 1.0 is the only version available on Mac OS X 10.2. */
+ #define WEBKIT_VERSION_MIN_REQUIRED WEBKIT_VERSION_1_0
+ #elif !defined(MAC_OS_X_VERSION_10_4) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_4
+ /* WebKit 1.1 is the version that shipped on Mac OS X 10.3. */
+ #define WEBKIT_VERSION_MIN_REQUIRED WEBKIT_VERSION_1_1
+ #elif !defined(MAC_OS_X_VERSION_10_5) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
+ /* WebKit 2.0 is the version that shipped on Mac OS X 10.4. */
+ #define WEBKIT_VERSION_MIN_REQUIRED WEBKIT_VERSION_2_0
+ #elif !defined(MAC_OS_X_VERSION_10_6) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_6
+ /* WebKit 3.0 is the version that shipped on Mac OS X 10.5. */
+ #define WEBKIT_VERSION_MIN_REQUIRED WEBKIT_VERSION_3_0
+ #elif !defined(MAC_OS_X_VERSION_10_7) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_7
+ /* WebKit 4.0 is the version that shipped on Mac OS X 10.6. */
+ #define WEBKIT_VERSION_MIN_REQUIRED WEBKIT_VERSION_4_0
+ #else
+ #define WEBKIT_VERSION_MIN_REQUIRED WEBKIT_VERSION_LATEST
+ #endif
+#endif
+
+
+/* If maximum WebKit version is not specified, assume largerof(latest, minimum) */
+#ifndef WEBKIT_VERSION_MAX_ALLOWED
+ #if WEBKIT_VERSION_MIN_REQUIRED > WEBKIT_VERSION_LATEST
+ #define WEBKIT_VERSION_MAX_ALLOWED WEBKIT_VERSION_MIN_REQUIRED
+ #else
+ #define WEBKIT_VERSION_MAX_ALLOWED WEBKIT_VERSION_LATEST
+ #endif
+#endif
+
+
+/* Sanity check the configured values */
+#if WEBKIT_VERSION_MAX_ALLOWED < WEBKIT_VERSION_MIN_REQUIRED
+ #error WEBKIT_VERSION_MAX_ALLOWED must be >= WEBKIT_VERSION_MIN_REQUIRED
+#endif
+#if WEBKIT_VERSION_MIN_REQUIRED < WEBKIT_VERSION_1_0
+ #error WEBKIT_VERSION_MIN_REQUIRED must be >= WEBKIT_VERSION_1_0
+#endif
+
+
+
+
+
+
+/*
+ * AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER
+ *
+ * Used on functions introduced in WebKit 1.0
+ */
+#define AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER
+
+/*
+ * AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER_BUT_DEPRECATED
+ *
+ * Used on functions introduced in WebKit 1.0,
+ * and deprecated in WebKit 1.0
+ */
+#define AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER_BUT_DEPRECATED DEPRECATED_ATTRIBUTE
+
+/*
+ * DEPRECATED_IN_WEBKIT_VERSION_1_0_AND_LATER
+ *
+ * Used on types deprecated in WebKit 1.0
+ */
+#define DEPRECATED_IN_WEBKIT_VERSION_1_0_AND_LATER DEPRECATED_ATTRIBUTE
+
+
+
+
+
+
+/*
+ * AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER
+ *
+ * Used on declarations introduced in WebKit 1.1
+ */
+#if WEBKIT_VERSION_MAX_ALLOWED < WEBKIT_VERSION_1_1
+ #define AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER UNAVAILABLE_ATTRIBUTE
+#elif WEBKIT_VERSION_MIN_REQUIRED < WEBKIT_VERSION_1_1
+ #define AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER WEAK_IMPORT_ATTRIBUTE
+#else
+ #define AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER_BUT_DEPRECATED
+ *
+ * Used on declarations introduced in WebKit 1.1,
+ * and deprecated in WebKit 1.1
+ */
+#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_1_1
+ #define AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER_BUT_DEPRECATED DEPRECATED_ATTRIBUTE
+#else
+ #define AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER_BUT_DEPRECATED AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_1_1
+ *
+ * Used on declarations introduced in WebKit 1.0,
+ * but later deprecated in WebKit 1.1
+ */
+#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_1_1
+ #define AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_1_1 DEPRECATED_ATTRIBUTE
+#else
+ #define AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_1_1 AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER
+#endif
+
+/*
+ * DEPRECATED_IN_WEBKIT_VERSION_1_1_AND_LATER
+ *
+ * Used on types deprecated in WebKit 1.1
+ */
+#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_1_1
+ #define DEPRECATED_IN_WEBKIT_VERSION_1_1_AND_LATER DEPRECATED_ATTRIBUTE
+#else
+ #define DEPRECATED_IN_WEBKIT_VERSION_1_1_AND_LATER
+#endif
+
+
+
+
+
+
+/*
+ * AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER
+ *
+ * Used on declarations introduced in WebKit 1.2
+ */
+#if WEBKIT_VERSION_MAX_ALLOWED < WEBKIT_VERSION_1_2
+ #define AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER UNAVAILABLE_ATTRIBUTE
+#elif WEBKIT_VERSION_MIN_REQUIRED < WEBKIT_VERSION_1_2
+ #define AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER WEAK_IMPORT_ATTRIBUTE
+#else
+ #define AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER_BUT_DEPRECATED
+ *
+ * Used on declarations introduced in WebKit 1.2,
+ * and deprecated in WebKit 1.2
+ */
+#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_1_2
+ #define AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER_BUT_DEPRECATED DEPRECATED_ATTRIBUTE
+#else
+ #define AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER_BUT_DEPRECATED AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_1_2
+ *
+ * Used on declarations introduced in WebKit 1.0,
+ * but later deprecated in WebKit 1.2
+ */
+#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_1_2
+ #define AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_1_2 DEPRECATED_ATTRIBUTE
+#else
+ #define AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_1_2 AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_1_2
+ *
+ * Used on declarations introduced in WebKit 1.1,
+ * but later deprecated in WebKit 1.2
+ */
+#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_1_2
+ #define AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_1_2 DEPRECATED_ATTRIBUTE
+#else
+ #define AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_1_2 AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER
+#endif
+
+/*
+ * DEPRECATED_IN_WEBKIT_VERSION_1_2_AND_LATER
+ *
+ * Used on types deprecated in WebKit 1.2
+ */
+#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_1_2
+ #define DEPRECATED_IN_WEBKIT_VERSION_1_2_AND_LATER DEPRECATED_ATTRIBUTE
+#else
+ #define DEPRECATED_IN_WEBKIT_VERSION_1_2_AND_LATER
+#endif
+
+
+
+
+
+
+/*
+ * AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER
+ *
+ * Used on declarations introduced in WebKit 1.3
+ */
+#if WEBKIT_VERSION_MAX_ALLOWED < WEBKIT_VERSION_1_3
+ #define AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER UNAVAILABLE_ATTRIBUTE
+#elif WEBKIT_VERSION_MIN_REQUIRED < WEBKIT_VERSION_1_3
+ #define AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER WEAK_IMPORT_ATTRIBUTE
+#else
+ #define AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER_BUT_DEPRECATED
+ *
+ * Used on declarations introduced in WebKit 1.3,
+ * and deprecated in WebKit 1.3
+ */
+#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_1_3
+ #define AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER_BUT_DEPRECATED DEPRECATED_ATTRIBUTE
+#else
+ #define AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER_BUT_DEPRECATED AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_1_3
+ *
+ * Used on declarations introduced in WebKit 1.0,
+ * but later deprecated in WebKit 1.3
+ */
+#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_1_3
+ #define AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_1_3 DEPRECATED_ATTRIBUTE
+#else
+ #define AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_1_3 AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_1_3
+ *
+ * Used on declarations introduced in WebKit 1.1,
+ * but later deprecated in WebKit 1.3
+ */
+#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_1_3
+ #define AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_1_3 DEPRECATED_ATTRIBUTE
+#else
+ #define AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_1_3 AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_1_3
+ *
+ * Used on declarations introduced in WebKit 1.2,
+ * but later deprecated in WebKit 1.3
+ */
+#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_1_3
+ #define AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_1_3 DEPRECATED_ATTRIBUTE
+#else
+ #define AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_1_3 AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER
+#endif
+
+/*
+ * DEPRECATED_IN_WEBKIT_VERSION_1_3_AND_LATER
+ *
+ * Used on types deprecated in WebKit 1.3
+ */
+#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_1_3
+ #define DEPRECATED_IN_WEBKIT_VERSION_1_3_AND_LATER DEPRECATED_ATTRIBUTE
+#else
+ #define DEPRECATED_IN_WEBKIT_VERSION_1_3_AND_LATER
+#endif
+
+
+
+
+
+
+/*
+ * AVAILABLE_WEBKIT_VERSION_2_0_AND_LATER
+ *
+ * Used on declarations introduced in WebKit 2.0
+ */
+#if WEBKIT_VERSION_MAX_ALLOWED < WEBKIT_VERSION_2_0
+ #define AVAILABLE_WEBKIT_VERSION_2_0_AND_LATER UNAVAILABLE_ATTRIBUTE
+#elif WEBKIT_VERSION_MIN_REQUIRED < WEBKIT_VERSION_2_0
+ #define AVAILABLE_WEBKIT_VERSION_2_0_AND_LATER WEAK_IMPORT_ATTRIBUTE
+#else
+ #define AVAILABLE_WEBKIT_VERSION_2_0_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_WEBKIT_VERSION_2_0_AND_LATER_BUT_DEPRECATED
+ *
+ * Used on declarations introduced in WebKit 2.0,
+ * and deprecated in WebKit 2.0
+ */
+#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_2_0
+ #define AVAILABLE_WEBKIT_VERSION_2_0_AND_LATER_BUT_DEPRECATED DEPRECATED_ATTRIBUTE
+#else
+ #define AVAILABLE_WEBKIT_VERSION_2_0_AND_LATER_BUT_DEPRECATED AVAILABLE_WEBKIT_VERSION_2_0_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_2_0
+ *
+ * Used on declarations introduced in WebKit 1.0,
+ * but later deprecated in WebKit 2.0
+ */
+#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_2_0
+ #define AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_2_0 DEPRECATED_ATTRIBUTE
+#else
+ #define AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_2_0 AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_2_0
+ *
+ * Used on declarations introduced in WebKit 1.1,
+ * but later deprecated in WebKit 2.0
+ */
+#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_2_0
+ #define AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_2_0 DEPRECATED_ATTRIBUTE
+#else
+ #define AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_2_0 AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_2_0
+ *
+ * Used on declarations introduced in WebKit 1.2,
+ * but later deprecated in WebKit 2.0
+ */
+#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_2_0
+ #define AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_2_0 DEPRECATED_ATTRIBUTE
+#else
+ #define AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_2_0 AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_2_0
+ *
+ * Used on declarations introduced in WebKit 1.3,
+ * but later deprecated in WebKit 2.0
+ */
+#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_2_0
+ #define AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_2_0 DEPRECATED_ATTRIBUTE
+#else
+ #define AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_2_0 AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER
+#endif
+
+/*
+ * DEPRECATED_IN_WEBKIT_VERSION_2_0_AND_LATER
+ *
+ * Used on types deprecated in WebKit 2.0
+ */
+#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_2_0
+ #define DEPRECATED_IN_WEBKIT_VERSION_2_0_AND_LATER DEPRECATED_ATTRIBUTE
+#else
+ #define DEPRECATED_IN_WEBKIT_VERSION_2_0_AND_LATER
+#endif
+
+
+
+
+
+
+/*
+ * AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER
+ *
+ * Used on declarations introduced in WebKit 3.0
+ */
+#if WEBKIT_VERSION_MAX_ALLOWED < WEBKIT_VERSION_3_0
+ #define AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER UNAVAILABLE_ATTRIBUTE
+#elif WEBKIT_VERSION_MIN_REQUIRED < WEBKIT_VERSION_3_0
+ #define AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER WEAK_IMPORT_ATTRIBUTE
+#else
+ #define AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER_BUT_DEPRECATED
+ *
+ * Used on declarations introduced in WebKit 3.0,
+ * and deprecated in WebKit 3.0
+ */
+#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_3_0
+ #define AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER_BUT_DEPRECATED DEPRECATED_ATTRIBUTE
+#else
+ #define AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER_BUT_DEPRECATED AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_0
+ *
+ * Used on declarations introduced in WebKit 1.0,
+ * but later deprecated in WebKit 3.0
+ */
+#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_3_0
+ #define AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_0 DEPRECATED_ATTRIBUTE
+#else
+ #define AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_0 AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_0
+ *
+ * Used on declarations introduced in WebKit 1.1,
+ * but later deprecated in WebKit 3.0
+ */
+#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_3_0
+ #define AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_0 DEPRECATED_ATTRIBUTE
+#else
+ #define AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_0 AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_0
+ *
+ * Used on declarations introduced in WebKit 1.2,
+ * but later deprecated in WebKit 3.0
+ */
+#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_3_0
+ #define AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_0 DEPRECATED_ATTRIBUTE
+#else
+ #define AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_0 AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_0
+ *
+ * Used on declarations introduced in WebKit 1.3,
+ * but later deprecated in WebKit 3.0
+ */
+#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_3_0
+ #define AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_0 DEPRECATED_ATTRIBUTE
+#else
+ #define AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_0 AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_WEBKIT_VERSION_2_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_0
+ *
+ * Used on declarations introduced in WebKit 2.0,
+ * but later deprecated in WebKit 3.0
+ */
+#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_3_0
+ #define AVAILABLE_WEBKIT_VERSION_2_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_0 DEPRECATED_ATTRIBUTE
+#else
+ #define AVAILABLE_WEBKIT_VERSION_2_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_0 AVAILABLE_WEBKIT_VERSION_2_0_AND_LATER
+#endif
+
+/*
+ * DEPRECATED_IN_WEBKIT_VERSION_3_0_AND_LATER
+ *
+ * Used on types deprecated in WebKit 3.0
+ */
+#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_3_0
+ #define DEPRECATED_IN_WEBKIT_VERSION_3_0_AND_LATER DEPRECATED_ATTRIBUTE
+#else
+ #define DEPRECATED_IN_WEBKIT_VERSION_3_0_AND_LATER
+#endif
+
+
+
+
+
+
+/*
+ * AVAILABLE_WEBKIT_VERSION_3_1_AND_LATER
+ *
+ * Used on declarations introduced in WebKit 3.1
+ */
+#if WEBKIT_VERSION_MAX_ALLOWED < WEBKIT_VERSION_3_1
+ #define AVAILABLE_WEBKIT_VERSION_3_1_AND_LATER UNAVAILABLE_ATTRIBUTE
+#elif WEBKIT_VERSION_MIN_REQUIRED < WEBKIT_VERSION_3_1
+ #define AVAILABLE_WEBKIT_VERSION_3_1_AND_LATER WEAK_IMPORT_ATTRIBUTE
+#else
+ #define AVAILABLE_WEBKIT_VERSION_3_1_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_WEBKIT_VERSION_3_1_AND_LATER_BUT_DEPRECATED
+ *
+ * Used on declarations introduced in WebKit 3.1,
+ * and deprecated in WebKit 3.1
+ */
+#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_3_1
+ #define AVAILABLE_WEBKIT_VERSION_3_1_AND_LATER_BUT_DEPRECATED DEPRECATED_ATTRIBUTE
+#else
+ #define AVAILABLE_WEBKIT_VERSION_3_1_AND_LATER_BUT_DEPRECATED AVAILABLE_WEBKIT_VERSION_3_1_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_1
+ *
+ * Used on declarations introduced in WebKit 1.0,
+ * but later deprecated in WebKit 3.1
+ */
+#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_3_1
+ #define AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_1 DEPRECATED_ATTRIBUTE
+#else
+ #define AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_1 AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_1
+ *
+ * Used on declarations introduced in WebKit 1.1,
+ * but later deprecated in WebKit 3.1
+ */
+#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_3_1
+ #define AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_1 DEPRECATED_ATTRIBUTE
+#else
+ #define AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_1 AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_1
+ *
+ * Used on declarations introduced in WebKit 1.2,
+ * but later deprecated in WebKit 3.1
+ */
+#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_3_1
+ #define AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_1 DEPRECATED_ATTRIBUTE
+#else
+ #define AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_1 AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_1
+ *
+ * Used on declarations introduced in WebKit 1.3,
+ * but later deprecated in WebKit 3.1
+ */
+#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_3_1
+ #define AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_1 DEPRECATED_ATTRIBUTE
+#else
+ #define AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_1 AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_WEBKIT_VERSION_2_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_1
+ *
+ * Used on declarations introduced in WebKit 2.0,
+ * but later deprecated in WebKit 3.1
+ */
+#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_3_1
+ #define AVAILABLE_WEBKIT_VERSION_2_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_1 DEPRECATED_ATTRIBUTE
+#else
+ #define AVAILABLE_WEBKIT_VERSION_2_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_1 AVAILABLE_WEBKIT_VERSION_2_0_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_1
+ *
+ * Used on declarations introduced in WebKit 3.0,
+ * but later deprecated in WebKit 3.1
+ */
+#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_3_1
+ #define AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_1 DEPRECATED_ATTRIBUTE
+#else
+ #define AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_1 AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER
+#endif
+
+/*
+ * DEPRECATED_IN_WEBKIT_VERSION_3_1_AND_LATER
+ *
+ * Used on types deprecated in WebKit 3.1
+ */
+#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_3_1
+ #define DEPRECATED_IN_WEBKIT_VERSION_3_1_AND_LATER DEPRECATED_ATTRIBUTE
+#else
+ #define DEPRECATED_IN_WEBKIT_VERSION_3_1_AND_LATER
+#endif
+
+
+
+
+
+
+/*
+ * AVAILABLE_IN_WEBKIT_VERSION_4_0
+ *
+ * Used on declarations introduced in WebKit 4.0
+ */
+#if WEBKIT_VERSION_MAX_ALLOWED < WEBKIT_VERSION_4_0
+ #define AVAILABLE_IN_WEBKIT_VERSION_4_0 UNAVAILABLE_ATTRIBUTE
+#elif WEBKIT_VERSION_MIN_REQUIRED < WEBKIT_VERSION_4_0
+ #define AVAILABLE_IN_WEBKIT_VERSION_4_0 WEAK_IMPORT_ATTRIBUTE
+#else
+ #define AVAILABLE_IN_WEBKIT_VERSION_4_0
+#endif
+
+/*
+ * AVAILABLE_IN_WEBKIT_VERSION_4_0_BUT_DEPRECATED
+ *
+ * Used on declarations introduced in WebKit 4.0,
+ * and deprecated in WebKit 4.0
+ */
+#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_4_0
+ #define AVAILABLE_IN_WEBKIT_VERSION_4_0_BUT_DEPRECATED DEPRECATED_ATTRIBUTE
+#else
+ #define AVAILABLE_IN_WEBKIT_VERSION_4_0_BUT_DEPRECATED AVAILABLE_IN_WEBKIT_VERSION_4_0
+#endif
+
+/*
+ * AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_4_0
+ *
+ * Used on declarations introduced in WebKit 1.0,
+ * but later deprecated in WebKit 4.0
+ */
+#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_4_0
+ #define AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_4_0 DEPRECATED_ATTRIBUTE
+#else
+ #define AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_4_0 AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_4_0
+ *
+ * Used on declarations introduced in WebKit 1.1,
+ * but later deprecated in WebKit 4.0
+ */
+#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_4_0
+ #define AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_4_0 DEPRECATED_ATTRIBUTE
+#else
+ #define AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_4_0 AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_4_0
+ *
+ * Used on declarations introduced in WebKit 1.2,
+ * but later deprecated in WebKit 4.0
+ */
+#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_4_0
+ #define AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_4_0 DEPRECATED_ATTRIBUTE
+#else
+ #define AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_4_0 AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_4_0
+ *
+ * Used on declarations introduced in WebKit 1.3,
+ * but later deprecated in WebKit 4.0
+ */
+#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_4_0
+ #define AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_4_0 DEPRECATED_ATTRIBUTE
+#else
+ #define AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_4_0 AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_WEBKIT_VERSION_2_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_4_0
+ *
+ * Used on declarations introduced in WebKit 2.0,
+ * but later deprecated in WebKit 4.0
+ */
+#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_4_0
+ #define AVAILABLE_WEBKIT_VERSION_2_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_4_0 DEPRECATED_ATTRIBUTE
+#else
+ #define AVAILABLE_WEBKIT_VERSION_2_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_4_0 AVAILABLE_WEBKIT_VERSION_2_0_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_4_0
+ *
+ * Used on declarations introduced in WebKit 3.0,
+ * but later deprecated in WebKit 4.0
+ */
+#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_4_0
+ #define AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_4_0 DEPRECATED_ATTRIBUTE
+#else
+ #define AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_4_0 AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_WEBKIT_VERSION_3_1_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_4_0
+ *
+ * Used on declarations introduced in WebKit 3.1,
+ * but later deprecated in WebKit 4.0
+ */
+#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_4_0
+ #define AVAILABLE_WEBKIT_VERSION_3_1_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_4_0 DEPRECATED_ATTRIBUTE
+#else
+ #define AVAILABLE_WEBKIT_VERSION_3_1_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_4_0 AVAILABLE_WEBKIT_VERSION_3_1_AND_LATER
+#endif
+
+/*
+ * DEPRECATED_IN_WEBKIT_VERSION_4_0
+ *
+ * Used on types deprecated in WebKit 4.0
+ */
+#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_4_0
+ #define DEPRECATED_IN_WEBKIT_VERSION_4_0 DEPRECATED_ATTRIBUTE
+#else
+ #define DEPRECATED_IN_WEBKIT_VERSION_4_0
+#endif
+
+
+
+
+
+
+/*
+ * AVAILABLE_AFTER_WEBKIT_VERSION_4_0
+ *
+ * Used on declarations introduced after WebKit 4.0
+ */
+#if WEBKIT_VERSION_MAX_ALLOWED < WEBKIT_VERSION_LATEST
+ #define AVAILABLE_AFTER_WEBKIT_VERSION_4_0 UNAVAILABLE_ATTRIBUTE
+#elif WEBKIT_VERSION_MIN_REQUIRED < WEBKIT_VERSION_LATEST
+ #define AVAILABLE_AFTER_WEBKIT_VERSION_4_0 WEAK_IMPORT_ATTRIBUTE
+#else
+ #define AVAILABLE_AFTER_WEBKIT_VERSION_4_0
+#endif
+
+/*
+ * AVAILABLE_AFTER_WEBKIT_VERSION_4_0_BUT_DEPRECATED
+ *
+ * Used on declarations introduced after WebKit 4.0,
+ * and deprecated after WebKit 4.0
+ */
+#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_LATEST
+ #define AVAILABLE_AFTER_WEBKIT_VERSION_4_0_BUT_DEPRECATED DEPRECATED_ATTRIBUTE
+#else
+ #define AVAILABLE_AFTER_WEBKIT_VERSION_4_0_BUT_DEPRECATED AVAILABLE_AFTER_WEBKIT_VERSION_4_0
+#endif
+
+/*
+ * AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER_BUT_DEPRECATED_AFTER_WEBKIT_VERSION_4_0
+ *
+ * Used on declarations introduced in WebKit 1.0,
+ * but later deprecated after WebKit 4.0
+ */
+#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_LATEST
+ #define AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER_BUT_DEPRECATED_AFTER_WEBKIT_VERSION_4_0 DEPRECATED_ATTRIBUTE
+#else
+ #define AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER_BUT_DEPRECATED_AFTER_WEBKIT_VERSION_4_0 AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER_BUT_DEPRECATED_AFTER_WEBKIT_VERSION_4_0
+ *
+ * Used on declarations introduced in WebKit 1.1,
+ * but later deprecated after WebKit 4.0
+ */
+#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_LATEST
+ #define AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER_BUT_DEPRECATED_AFTER_WEBKIT_VERSION_4_0 DEPRECATED_ATTRIBUTE
+#else
+ #define AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER_BUT_DEPRECATED_AFTER_WEBKIT_VERSION_4_0 AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER_BUT_DEPRECATED_AFTER_WEBKIT_VERSION_4_0
+ *
+ * Used on declarations introduced in WebKit 1.2,
+ * but later deprecated after WebKit 4.0
+ */
+#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_LATEST
+ #define AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER_BUT_DEPRECATED_AFTER_WEBKIT_VERSION_4_0 DEPRECATED_ATTRIBUTE
+#else
+ #define AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER_BUT_DEPRECATED_AFTER_WEBKIT_VERSION_4_0 AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER_BUT_DEPRECATED_AFTER_WEBKIT_VERSION_4_0
+ *
+ * Used on declarations introduced in WebKit 1.3,
+ * but later deprecated after WebKit 4.0
+ */
+#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_LATEST
+ #define AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER_BUT_DEPRECATED_AFTER_WEBKIT_VERSION_4_0 DEPRECATED_ATTRIBUTE
+#else
+ #define AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER_BUT_DEPRECATED_AFTER_WEBKIT_VERSION_4_0 AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_WEBKIT_VERSION_2_0_AND_LATER_BUT_DEPRECATED_AFTER_WEBKIT_VERSION_4_0
+ *
+ * Used on declarations introduced in WebKit 2.0,
+ * but later deprecated after WebKit 4.0
+ */
+#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_LATEST
+ #define AVAILABLE_WEBKIT_VERSION_2_0_AND_LATER_BUT_DEPRECATED_AFTER_WEBKIT_VERSION_4_0 DEPRECATED_ATTRIBUTE
+#else
+ #define AVAILABLE_WEBKIT_VERSION_2_0_AND_LATER_BUT_DEPRECATED_AFTER_WEBKIT_VERSION_4_0 AVAILABLE_WEBKIT_VERSION_2_0_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER_BUT_DEPRECATED_AFTER_WEBKIT_VERSION_4_0
+ *
+ * Used on declarations introduced in WebKit 3.0,
+ * but later deprecated after WebKit 4.0
+ */
+#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_LATEST
+ #define AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER_BUT_DEPRECATED_AFTER_WEBKIT_VERSION_4_0 DEPRECATED_ATTRIBUTE
+#else
+ #define AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER_BUT_DEPRECATED_AFTER_WEBKIT_VERSION_4_0 AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_WEBKIT_VERSION_3_1_AND_LATER_BUT_DEPRECATED_AFTER_WEBKIT_VERSION_4_0
+ *
+ * Used on declarations introduced in WebKit 3.1,
+ * but later deprecated after WebKit 4.0
+ */
+#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_LATEST
+ #define AVAILABLE_WEBKIT_VERSION_3_1_AND_LATER_BUT_DEPRECATED_AFTER_WEBKIT_VERSION_4_0 DEPRECATED_ATTRIBUTE
+#else
+ #define AVAILABLE_WEBKIT_VERSION_3_1_AND_LATER_BUT_DEPRECATED_AFTER_WEBKIT_VERSION_4_0 AVAILABLE_WEBKIT_VERSION_3_1_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_WEBKIT_VERSION_4_0_AND_LATER_BUT_DEPRECATED_AFTER_WEBKIT_VERSION_4_0
+ *
+ * Used on declarations introduced in WebKit 4.0
+ * but later deprecated after WebKit 4.0
+ */
+#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_LATEST
+ #define AVAILABLE_WEBKIT_VERSION_4_0_AND_LATER_BUT_DEPRECATED_AFTER_WEBKIT_VERSION_4_0 DEPRECATED_ATTRIBUTE
+#else
+ #define AVAILABLE_WEBKIT_VERSION_4_0_AND_LATER_BUT_DEPRECATED_AFTER_WEBKIT_VERSION_4_0 AVAILABLE_WEBKIT_VERSION_4_0_AND_LATER
+#endif
+
+/*
+ * DEPRECATED_AFTER_WEBKIT_VERSION_4_0
+ *
+ * Used on types deprecated after WebKit 4.0
+ */
+#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_LATEST
+ #define DEPRECATED_AFTER_WEBKIT_VERSION_4_0 DEPRECATED_ATTRIBUTE
+#else
+ #define DEPRECATED_AFTER_WEBKIT_VERSION_4_0
+#endif
+
+
+#endif /* __WebKitAvailability__ */
diff --git a/Source/JavaScriptCore/API/tests/JSNode.c b/Source/JavaScriptCore/API/tests/JSNode.c
new file mode 100644
index 0000000..d9ac0a9
--- /dev/null
+++ b/Source/JavaScriptCore/API/tests/JSNode.c
@@ -0,0 +1,196 @@
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "JSNode.h"
+#include "JSNodeList.h"
+#include "JSObjectRef.h"
+#include "JSStringRef.h"
+#include "JSValueRef.h"
+#include "Node.h"
+#include "NodeList.h"
+#include "UnusedParam.h"
+#include <wtf/Assertions.h>
+
+static JSValueRef JSNode_appendChild(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ UNUSED_PARAM(function);
+
+ /* Example of throwing a type error for invalid values */
+ if (!JSValueIsObjectOfClass(context, thisObject, JSNode_class(context))) {
+ JSStringRef message = JSStringCreateWithUTF8CString("TypeError: appendChild can only be called on nodes");
+ *exception = JSValueMakeString(context, message);
+ JSStringRelease(message);
+ } else if (argumentCount < 1 || !JSValueIsObjectOfClass(context, arguments[0], JSNode_class(context))) {
+ JSStringRef message = JSStringCreateWithUTF8CString("TypeError: first argument to appendChild must be a node");
+ *exception = JSValueMakeString(context, message);
+ JSStringRelease(message);
+ } else {
+ Node* node = JSObjectGetPrivate(thisObject);
+ Node* child = JSObjectGetPrivate(JSValueToObject(context, arguments[0], NULL));
+
+ Node_appendChild(node, child);
+ }
+
+ return JSValueMakeUndefined(context);
+}
+
+static JSValueRef JSNode_removeChild(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ UNUSED_PARAM(function);
+
+ /* Example of ignoring invalid values */
+ if (argumentCount > 0) {
+ if (JSValueIsObjectOfClass(context, thisObject, JSNode_class(context))) {
+ if (JSValueIsObjectOfClass(context, arguments[0], JSNode_class(context))) {
+ Node* node = JSObjectGetPrivate(thisObject);
+ Node* child = JSObjectGetPrivate(JSValueToObject(context, arguments[0], exception));
+
+ Node_removeChild(node, child);
+ }
+ }
+ }
+
+ return JSValueMakeUndefined(context);
+}
+
+static JSValueRef JSNode_replaceChild(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ UNUSED_PARAM(function);
+
+ if (argumentCount > 1) {
+ if (JSValueIsObjectOfClass(context, thisObject, JSNode_class(context))) {
+ if (JSValueIsObjectOfClass(context, arguments[0], JSNode_class(context))) {
+ if (JSValueIsObjectOfClass(context, arguments[1], JSNode_class(context))) {
+ Node* node = JSObjectGetPrivate(thisObject);
+ Node* newChild = JSObjectGetPrivate(JSValueToObject(context, arguments[0], exception));
+ Node* oldChild = JSObjectGetPrivate(JSValueToObject(context, arguments[1], exception));
+
+ Node_replaceChild(node, newChild, oldChild);
+ }
+ }
+ }
+ }
+
+ return JSValueMakeUndefined(context);
+}
+
+static JSStaticFunction JSNode_staticFunctions[] = {
+ { "appendChild", JSNode_appendChild, kJSPropertyAttributeDontDelete },
+ { "removeChild", JSNode_removeChild, kJSPropertyAttributeDontDelete },
+ { "replaceChild", JSNode_replaceChild, kJSPropertyAttributeDontDelete },
+ { 0, 0, 0 }
+};
+
+static JSValueRef JSNode_getNodeType(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception)
+{
+ UNUSED_PARAM(propertyName);
+ UNUSED_PARAM(exception);
+
+ Node* node = JSObjectGetPrivate(object);
+ if (node) {
+ JSStringRef nodeType = JSStringCreateWithUTF8CString(node->nodeType);
+ JSValueRef value = JSValueMakeString(context, nodeType);
+ JSStringRelease(nodeType);
+ return value;
+ }
+
+ return NULL;
+}
+
+static JSValueRef JSNode_getChildNodes(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+ UNUSED_PARAM(propertyName);
+ UNUSED_PARAM(exception);
+
+ Node* node = JSObjectGetPrivate(thisObject);
+ ASSERT(node);
+ return JSNodeList_new(context, NodeList_new(node));
+}
+
+static JSValueRef JSNode_getFirstChild(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception)
+{
+ UNUSED_PARAM(object);
+ UNUSED_PARAM(propertyName);
+ UNUSED_PARAM(exception);
+
+ return JSValueMakeUndefined(context);
+}
+
+static JSStaticValue JSNode_staticValues[] = {
+ { "nodeType", JSNode_getNodeType, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
+ { "childNodes", JSNode_getChildNodes, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
+ { "firstChild", JSNode_getFirstChild, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
+ { 0, 0, 0, 0 }
+};
+
+static void JSNode_initialize(JSContextRef context, JSObjectRef object)
+{
+ UNUSED_PARAM(context);
+
+ Node* node = JSObjectGetPrivate(object);
+ ASSERT(node);
+
+ Node_ref(node);
+}
+
+static void JSNode_finalize(JSObjectRef object)
+{
+ Node* node = JSObjectGetPrivate(object);
+ ASSERT(node);
+
+ Node_deref(node);
+}
+
+JSClassRef JSNode_class(JSContextRef context)
+{
+ UNUSED_PARAM(context);
+
+ static JSClassRef jsClass;
+ if (!jsClass) {
+ JSClassDefinition definition = kJSClassDefinitionEmpty;
+ definition.staticValues = JSNode_staticValues;
+ definition.staticFunctions = JSNode_staticFunctions;
+ definition.initialize = JSNode_initialize;
+ definition.finalize = JSNode_finalize;
+
+ jsClass = JSClassCreate(&definition);
+ }
+ return jsClass;
+}
+
+JSObjectRef JSNode_new(JSContextRef context, Node* node)
+{
+ return JSObjectMake(context, JSNode_class(context), node);
+}
+
+JSObjectRef JSNode_construct(JSContextRef context, JSObjectRef object, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ UNUSED_PARAM(object);
+ UNUSED_PARAM(argumentCount);
+ UNUSED_PARAM(arguments);
+ UNUSED_PARAM(exception);
+
+ return JSNode_new(context, Node_new());
+}
diff --git a/Source/JavaScriptCore/API/tests/JSNode.h b/Source/JavaScriptCore/API/tests/JSNode.h
new file mode 100644
index 0000000..7725733
--- /dev/null
+++ b/Source/JavaScriptCore/API/tests/JSNode.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef JSNode_h
+#define JSNode_h
+
+#include "JSBase.h"
+#include "Node.h"
+#include <stddef.h>
+
+extern JSObjectRef JSNode_new(JSContextRef context, Node* node);
+extern JSClassRef JSNode_class(JSContextRef context);
+extern JSObjectRef JSNode_construct(JSContextRef context, JSObjectRef object, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception);
+
+#endif /* JSNode_h */
diff --git a/Source/JavaScriptCore/API/tests/JSNodeList.c b/Source/JavaScriptCore/API/tests/JSNodeList.c
new file mode 100644
index 0000000..bc4a8ad
--- /dev/null
+++ b/Source/JavaScriptCore/API/tests/JSNodeList.c
@@ -0,0 +1,123 @@
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "JSNode.h"
+#include "JSNodeList.h"
+#include "JSObjectRef.h"
+#include "JSValueRef.h"
+#include "UnusedParam.h"
+#include <wtf/Assertions.h>
+
+static JSValueRef JSNodeList_item(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ UNUSED_PARAM(object);
+
+ if (argumentCount > 0) {
+ NodeList* nodeList = JSObjectGetPrivate(thisObject);
+ ASSERT(nodeList);
+ Node* node = NodeList_item(nodeList, (unsigned)JSValueToNumber(context, arguments[0], exception));
+ if (node)
+ return JSNode_new(context, node);
+ }
+
+ return JSValueMakeUndefined(context);
+}
+
+static JSStaticFunction JSNodeList_staticFunctions[] = {
+ { "item", JSNodeList_item, kJSPropertyAttributeDontDelete },
+ { 0, 0, 0 }
+};
+
+static JSValueRef JSNodeList_length(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+ UNUSED_PARAM(propertyName);
+ UNUSED_PARAM(exception);
+
+ NodeList* nodeList = JSObjectGetPrivate(thisObject);
+ ASSERT(nodeList);
+ return JSValueMakeNumber(context, NodeList_length(nodeList));
+}
+
+static JSStaticValue JSNodeList_staticValues[] = {
+ { "length", JSNodeList_length, NULL, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { 0, 0, 0, 0 }
+};
+
+static JSValueRef JSNodeList_getProperty(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+ NodeList* nodeList = JSObjectGetPrivate(thisObject);
+ ASSERT(nodeList);
+ double index = JSValueToNumber(context, JSValueMakeString(context, propertyName), exception);
+ unsigned uindex = (unsigned)index;
+ if (uindex == index) { /* false for NaN */
+ Node* node = NodeList_item(nodeList, uindex);
+ if (node)
+ return JSNode_new(context, node);
+ }
+
+ return NULL;
+}
+
+static void JSNodeList_initialize(JSContextRef context, JSObjectRef thisObject)
+{
+ UNUSED_PARAM(context);
+
+ NodeList* nodeList = JSObjectGetPrivate(thisObject);
+ ASSERT(nodeList);
+
+ NodeList_ref(nodeList);
+}
+
+static void JSNodeList_finalize(JSObjectRef thisObject)
+{
+ NodeList* nodeList = JSObjectGetPrivate(thisObject);
+ ASSERT(nodeList);
+
+ NodeList_deref(nodeList);
+}
+
+static JSClassRef JSNodeList_class(JSContextRef context)
+{
+ UNUSED_PARAM(context);
+
+ static JSClassRef jsClass;
+ if (!jsClass) {
+ JSClassDefinition definition = kJSClassDefinitionEmpty;
+ definition.staticValues = JSNodeList_staticValues;
+ definition.staticFunctions = JSNodeList_staticFunctions;
+ definition.getProperty = JSNodeList_getProperty;
+ definition.initialize = JSNodeList_initialize;
+ definition.finalize = JSNodeList_finalize;
+
+ jsClass = JSClassCreate(&definition);
+ }
+
+ return jsClass;
+}
+
+JSObjectRef JSNodeList_new(JSContextRef context, NodeList* nodeList)
+{
+ return JSObjectMake(context, JSNodeList_class(context), nodeList);
+}
diff --git a/Source/JavaScriptCore/API/tests/JSNodeList.h b/Source/JavaScriptCore/API/tests/JSNodeList.h
new file mode 100644
index 0000000..f930914
--- /dev/null
+++ b/Source/JavaScriptCore/API/tests/JSNodeList.h
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef JSNodeList_h
+#define JSNodeList_h
+
+#include "JSBase.h"
+#include "NodeList.h"
+
+extern JSObjectRef JSNodeList_new(JSContextRef, NodeList*);
+
+#endif /* JSNodeList_h */
diff --git a/Source/JavaScriptCore/API/tests/Node.c b/Source/JavaScriptCore/API/tests/Node.c
new file mode 100644
index 0000000..913da0a
--- /dev/null
+++ b/Source/JavaScriptCore/API/tests/Node.c
@@ -0,0 +1,85 @@
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "Node.h"
+#include <stddef.h>
+#include <stdlib.h>
+
+Node* Node_new(void)
+{
+ Node* node = (Node*)malloc(sizeof(Node));
+ node->refCount = 0;
+ node->nodeType = "Node";
+ node->childNodesTail = NULL;
+
+ return node;
+}
+
+void Node_appendChild(Node* node, Node* child)
+{
+ Node_ref(child);
+ NodeLink* nodeLink = (NodeLink*)malloc(sizeof(NodeLink));
+ nodeLink->node = child;
+ nodeLink->prev = node->childNodesTail;
+ node->childNodesTail = nodeLink;
+}
+
+void Node_removeChild(Node* node, Node* child)
+{
+ /* Linear search from tail -- good enough for our purposes here */
+ NodeLink* current;
+ NodeLink** currentHandle;
+ for (currentHandle = &node->childNodesTail, current = *currentHandle; current; currentHandle = &current->prev, current = *currentHandle) {
+ if (current->node == child) {
+ Node_deref(current->node);
+ *currentHandle = current->prev;
+ free(current);
+ break;
+ }
+ }
+}
+
+void Node_replaceChild(Node* node, Node* newChild, Node* oldChild)
+{
+ /* Linear search from tail -- good enough for our purposes here */
+ NodeLink* current;
+ for (current = node->childNodesTail; current; current = current->prev) {
+ if (current->node == oldChild) {
+ Node_deref(current->node);
+ current->node = newChild;
+ }
+ }
+}
+
+void Node_ref(Node* node)
+{
+ ++node->refCount;
+}
+
+void Node_deref(Node* node)
+{
+ if (--node->refCount == 0)
+ free(node);
+}
diff --git a/Source/JavaScriptCore/API/tests/Node.h b/Source/JavaScriptCore/API/tests/Node.h
new file mode 100644
index 0000000..e9250b3
--- /dev/null
+++ b/Source/JavaScriptCore/API/tests/Node.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef Node_h
+#define Node_h
+
+typedef struct __Node Node;
+typedef struct __NodeLink NodeLink;
+
+struct __NodeLink {
+ Node* node;
+ NodeLink* prev;
+};
+
+struct __Node {
+ unsigned refCount;
+ const char* nodeType;
+ NodeLink* childNodesTail;
+};
+
+extern Node* Node_new(void);
+extern void Node_ref(Node* node);
+extern void Node_deref(Node* node);
+extern void Node_appendChild(Node* node, Node* child);
+extern void Node_removeChild(Node* node, Node* child);
+extern void Node_replaceChild(Node* node, Node* newChild, Node* oldChild);
+
+#endif /* Node_h */
diff --git a/Source/JavaScriptCore/API/tests/NodeList.c b/Source/JavaScriptCore/API/tests/NodeList.c
new file mode 100644
index 0000000..ae4c170
--- /dev/null
+++ b/Source/JavaScriptCore/API/tests/NodeList.c
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "NodeList.h"
+
+#include <stdlib.h>
+
+extern NodeList* NodeList_new(Node* parentNode)
+{
+ Node_ref(parentNode);
+
+ NodeList* nodeList = (NodeList*)malloc(sizeof(NodeList));
+ nodeList->parentNode = parentNode;
+ nodeList->refCount = 0;
+ return nodeList;
+}
+
+extern unsigned NodeList_length(NodeList* nodeList)
+{
+ /* Linear count from tail -- good enough for our purposes here */
+ unsigned i = 0;
+ NodeLink* n = nodeList->parentNode->childNodesTail;
+ while (n) {
+ n = n->prev;
+ ++i;
+ }
+
+ return i;
+}
+
+extern Node* NodeList_item(NodeList* nodeList, unsigned index)
+{
+ unsigned length = NodeList_length(nodeList);
+ if (index >= length)
+ return NULL;
+
+ /* Linear search from tail -- good enough for our purposes here */
+ NodeLink* n = nodeList->parentNode->childNodesTail;
+ unsigned i = 0;
+ unsigned count = length - 1 - index;
+ while (i < count) {
+ ++i;
+ n = n->prev;
+ }
+ return n->node;
+}
+
+extern void NodeList_ref(NodeList* nodeList)
+{
+ ++nodeList->refCount;
+}
+
+extern void NodeList_deref(NodeList* nodeList)
+{
+ if (--nodeList->refCount == 0) {
+ Node_deref(nodeList->parentNode);
+ free(nodeList);
+ }
+}
diff --git a/Source/JavaScriptCore/API/tests/NodeList.h b/Source/JavaScriptCore/API/tests/NodeList.h
new file mode 100644
index 0000000..25b95bf
--- /dev/null
+++ b/Source/JavaScriptCore/API/tests/NodeList.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef NodeList_h
+#define NodeList_h
+
+#include "Node.h"
+
+typedef struct {
+ unsigned refCount;
+ Node* parentNode;
+} NodeList;
+
+extern NodeList* NodeList_new(Node* parentNode);
+extern unsigned NodeList_length(NodeList*);
+extern Node* NodeList_item(NodeList*, unsigned);
+extern void NodeList_ref(NodeList*);
+extern void NodeList_deref(NodeList*);
+
+#endif /* NodeList_h */
diff --git a/Source/JavaScriptCore/API/tests/minidom.c b/Source/JavaScriptCore/API/tests/minidom.c
new file mode 100644
index 0000000..43ae2c1
--- /dev/null
+++ b/Source/JavaScriptCore/API/tests/minidom.c
@@ -0,0 +1,126 @@
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2007 Alp Toker <alp@atoker.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "JSContextRef.h"
+#include "JSNode.h"
+#include "JSObjectRef.h"
+#include "JSStringRef.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <wtf/Assertions.h>
+#include <wtf/UnusedParam.h>
+
+static char* createStringWithContentsOfFile(const char* fileName);
+static JSValueRef print(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception);
+
+int main(int argc, char* argv[])
+{
+ const char *scriptPath = "minidom.js";
+ if (argc > 1) {
+ scriptPath = argv[1];
+ }
+
+ JSGlobalContextRef context = JSGlobalContextCreateInGroup(NULL, NULL);
+ JSObjectRef globalObject = JSContextGetGlobalObject(context);
+
+ JSStringRef printIString = JSStringCreateWithUTF8CString("print");
+ JSObjectSetProperty(context, globalObject, printIString, JSObjectMakeFunctionWithCallback(context, printIString, print), kJSPropertyAttributeNone, NULL);
+ JSStringRelease(printIString);
+
+ JSStringRef node = JSStringCreateWithUTF8CString("Node");
+ JSObjectSetProperty(context, globalObject, node, JSObjectMakeConstructor(context, JSNode_class(context), JSNode_construct), kJSPropertyAttributeNone, NULL);
+ JSStringRelease(node);
+
+ char* scriptUTF8 = createStringWithContentsOfFile(scriptPath);
+ JSStringRef script = JSStringCreateWithUTF8CString(scriptUTF8);
+ JSValueRef exception;
+ JSValueRef result = JSEvaluateScript(context, script, NULL, NULL, 1, &exception);
+ if (result)
+ printf("PASS: Test script executed successfully.\n");
+ else {
+ printf("FAIL: Test script threw exception:\n");
+ JSStringRef exceptionIString = JSValueToStringCopy(context, exception, NULL);
+ size_t exceptionUTF8Size = JSStringGetMaximumUTF8CStringSize(exceptionIString);
+ char* exceptionUTF8 = (char*)malloc(exceptionUTF8Size);
+ JSStringGetUTF8CString(exceptionIString, exceptionUTF8, exceptionUTF8Size);
+ printf("%s\n", exceptionUTF8);
+ free(exceptionUTF8);
+ JSStringRelease(exceptionIString);
+ }
+ JSStringRelease(script);
+ free(scriptUTF8);
+
+ globalObject = 0;
+ JSGlobalContextRelease(context);
+ printf("PASS: Program exited normally.\n");
+ return 0;
+}
+
+static JSValueRef print(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ UNUSED_PARAM(object);
+ UNUSED_PARAM(thisObject);
+
+ if (argumentCount > 0) {
+ JSStringRef string = JSValueToStringCopy(context, arguments[0], exception);
+ size_t numChars = JSStringGetMaximumUTF8CStringSize(string);
+ char stringUTF8[numChars];
+ JSStringGetUTF8CString(string, stringUTF8, numChars);
+ printf("%s\n", stringUTF8);
+ }
+
+ return JSValueMakeUndefined(context);
+}
+
+static char* createStringWithContentsOfFile(const char* fileName)
+{
+ char* buffer;
+
+ size_t buffer_size = 0;
+ size_t buffer_capacity = 1024;
+ buffer = (char*)malloc(buffer_capacity);
+
+ FILE* f = fopen(fileName, "r");
+ if (!f) {
+ fprintf(stderr, "Could not open file: %s\n", fileName);
+ return 0;
+ }
+
+ while (!feof(f) && !ferror(f)) {
+ buffer_size += fread(buffer + buffer_size, 1, buffer_capacity - buffer_size, f);
+ if (buffer_size == buffer_capacity) { /* guarantees space for trailing '\0' */
+ buffer_capacity *= 2;
+ buffer = (char*)realloc(buffer, buffer_capacity);
+ ASSERT(buffer);
+ }
+
+ ASSERT(buffer_size < buffer_capacity);
+ }
+ fclose(f);
+ buffer[buffer_size] = '\0';
+
+ return buffer;
+}
diff --git a/Source/JavaScriptCore/API/tests/minidom.html b/Source/JavaScriptCore/API/tests/minidom.html
new file mode 100644
index 0000000..7ea4747
--- /dev/null
+++ b/Source/JavaScriptCore/API/tests/minidom.html
@@ -0,0 +1,9 @@
+<html>
+<head>
+<script src="minidom.js"></script>
+</head>
+
+<body onload="test()">
+ <pre id='pre'></pre>
+</body>
+</html>
diff --git a/Source/JavaScriptCore/API/tests/minidom.js b/Source/JavaScriptCore/API/tests/minidom.js
new file mode 100644
index 0000000..4808960
--- /dev/null
+++ b/Source/JavaScriptCore/API/tests/minidom.js
@@ -0,0 +1,110 @@
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+function shouldBe(a, b)
+{
+ var evalA;
+ try {
+ evalA = eval(a);
+ } catch(e) {
+ evalA = e;
+ }
+
+ if (evalA == b || isNaN(evalA) && typeof evalA == 'number' && isNaN(b) && typeof b == 'number')
+ print("PASS: " + a + " should be " + b + " and is.", "green");
+ else
+ print("__FAIL__: " + a + " should be " + b + " but instead is " + evalA + ".", "red");
+}
+
+function test()
+{
+ print("Node is " + Node);
+ for (var p in Node)
+ print(p + ": " + Node[p]);
+
+ node = new Node();
+ print("node is " + node);
+ for (var p in node)
+ print(p + ": " + node[p]);
+
+ child1 = new Node();
+ child2 = new Node();
+ child3 = new Node();
+
+ node.appendChild(child1);
+ node.appendChild(child2);
+
+ var childNodes = node.childNodes;
+
+ for (var i = 0; i < childNodes.length + 1; i++) {
+ print("item " + i + ": " + childNodes.item(i));
+ }
+
+ for (var i = 0; i < childNodes.length + 1; i++) {
+ print(i + ": " + childNodes[i]);
+ }
+
+ node.removeChild(child1);
+ node.replaceChild(child3, child2);
+
+ for (var i = 0; i < childNodes.length + 1; i++) {
+ print("item " + i + ": " + childNodes.item(i));
+ }
+
+ for (var i = 0; i < childNodes.length + 1; i++) {
+ print(i + ": " + childNodes[i]);
+ }
+
+ try {
+ node.appendChild(null);
+ } catch(e) {
+ print("caught: " + e);
+ }
+
+ try {
+ var o = new Object();
+ o.appendChild = node.appendChild;
+ o.appendChild(node);
+ } catch(e) {
+ print("caught: " + e);
+ }
+
+ try {
+ node.appendChild();
+ } catch(e) {
+ print("caught: " + e);
+ }
+
+ oldNodeType = node.nodeType;
+ node.nodeType = 1;
+ shouldBe("node.nodeType", oldNodeType);
+
+ shouldBe("node instanceof Node", true);
+ shouldBe("new Object() instanceof Node", false);
+
+ print(Node);
+}
+
+test();
diff --git a/Source/JavaScriptCore/API/tests/testapi.c b/Source/JavaScriptCore/API/tests/testapi.c
new file mode 100644
index 0000000..1ecfc7e
--- /dev/null
+++ b/Source/JavaScriptCore/API/tests/testapi.c
@@ -0,0 +1,1458 @@
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "JavaScriptCore.h"
+#include "JSBasePrivate.h"
+#include "JSContextRefPrivate.h"
+#include "JSObjectRefPrivate.h"
+#include <math.h>
+#define ASSERT_DISABLED 0
+#include <wtf/Assertions.h>
+#include <wtf/UnusedParam.h>
+
+#if COMPILER(MSVC)
+
+#include <wtf/MathExtras.h>
+
+static double nan(const char*)
+{
+ return std::numeric_limits<double>::quiet_NaN();
+}
+
+#endif
+
+static JSGlobalContextRef context;
+static int failed;
+static void assertEqualsAsBoolean(JSValueRef value, bool expectedValue)
+{
+ if (JSValueToBoolean(context, value) != expectedValue) {
+ fprintf(stderr, "assertEqualsAsBoolean failed: %p, %d\n", value, expectedValue);
+ failed = 1;
+ }
+}
+
+static void assertEqualsAsNumber(JSValueRef value, double expectedValue)
+{
+ double number = JSValueToNumber(context, value, NULL);
+
+ // FIXME <rdar://4668451> - On i386 the isnan(double) macro tries to map to the isnan(float) function,
+ // causing a build break with -Wshorten-64-to-32 enabled. The issue is known by the appropriate team.
+ // After that's resolved, we can remove these casts
+ if (number != expectedValue && !(isnan((float)number) && isnan((float)expectedValue))) {
+ fprintf(stderr, "assertEqualsAsNumber failed: %p, %lf\n", value, expectedValue);
+ failed = 1;
+ }
+}
+
+static void assertEqualsAsUTF8String(JSValueRef value, const char* expectedValue)
+{
+ JSStringRef valueAsString = JSValueToStringCopy(context, value, NULL);
+
+ size_t jsSize = JSStringGetMaximumUTF8CStringSize(valueAsString);
+ char* jsBuffer = (char*)malloc(jsSize);
+ JSStringGetUTF8CString(valueAsString, jsBuffer, jsSize);
+
+ unsigned i;
+ for (i = 0; jsBuffer[i]; i++) {
+ if (jsBuffer[i] != expectedValue[i]) {
+ fprintf(stderr, "assertEqualsAsUTF8String failed at character %d: %c(%d) != %c(%d)\n", i, jsBuffer[i], jsBuffer[i], expectedValue[i], expectedValue[i]);
+ failed = 1;
+ }
+ }
+
+ if (jsSize < strlen(jsBuffer) + 1) {
+ fprintf(stderr, "assertEqualsAsUTF8String failed: jsSize was too small\n");
+ failed = 1;
+ }
+
+ free(jsBuffer);
+ JSStringRelease(valueAsString);
+}
+
+static void assertEqualsAsCharactersPtr(JSValueRef value, const char* expectedValue)
+{
+ JSStringRef valueAsString = JSValueToStringCopy(context, value, NULL);
+
+ size_t jsLength = JSStringGetLength(valueAsString);
+ const JSChar* jsBuffer = JSStringGetCharactersPtr(valueAsString);
+
+ CFStringRef expectedValueAsCFString = CFStringCreateWithCString(kCFAllocatorDefault,
+ expectedValue,
+ kCFStringEncodingUTF8);
+ CFIndex cfLength = CFStringGetLength(expectedValueAsCFString);
+ UniChar* cfBuffer = (UniChar*)malloc(cfLength * sizeof(UniChar));
+ CFStringGetCharacters(expectedValueAsCFString, CFRangeMake(0, cfLength), cfBuffer);
+ CFRelease(expectedValueAsCFString);
+
+ if (memcmp(jsBuffer, cfBuffer, cfLength * sizeof(UniChar)) != 0) {
+ fprintf(stderr, "assertEqualsAsCharactersPtr failed: jsBuffer != cfBuffer\n");
+ failed = 1;
+ }
+
+ if (jsLength != (size_t)cfLength) {
+ fprintf(stderr, "assertEqualsAsCharactersPtr failed: jsLength(%ld) != cfLength(%ld)\n", jsLength, cfLength);
+ failed = 1;
+ }
+
+ free(cfBuffer);
+ JSStringRelease(valueAsString);
+}
+
+static bool timeZoneIsPST()
+{
+ char timeZoneName[70];
+ struct tm gtm;
+ memset(&gtm, 0, sizeof(gtm));
+ strftime(timeZoneName, sizeof(timeZoneName), "%Z", &gtm);
+
+ return 0 == strcmp("PST", timeZoneName);
+}
+
+static JSValueRef jsGlobalValue; // non-stack value for testing JSValueProtect()
+
+/* MyObject pseudo-class */
+
+static bool MyObject_hasProperty(JSContextRef context, JSObjectRef object, JSStringRef propertyName)
+{
+ UNUSED_PARAM(context);
+ UNUSED_PARAM(object);
+
+ if (JSStringIsEqualToUTF8CString(propertyName, "alwaysOne")
+ || JSStringIsEqualToUTF8CString(propertyName, "cantFind")
+ || JSStringIsEqualToUTF8CString(propertyName, "throwOnGet")
+ || JSStringIsEqualToUTF8CString(propertyName, "myPropertyName")
+ || JSStringIsEqualToUTF8CString(propertyName, "hasPropertyLie")
+ || JSStringIsEqualToUTF8CString(propertyName, "0")) {
+ return true;
+ }
+
+ return false;
+}
+
+static JSValueRef MyObject_getProperty(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception)
+{
+ UNUSED_PARAM(context);
+ UNUSED_PARAM(object);
+
+ if (JSStringIsEqualToUTF8CString(propertyName, "alwaysOne")) {
+ return JSValueMakeNumber(context, 1);
+ }
+
+ if (JSStringIsEqualToUTF8CString(propertyName, "myPropertyName")) {
+ return JSValueMakeNumber(context, 1);
+ }
+
+ if (JSStringIsEqualToUTF8CString(propertyName, "cantFind")) {
+ return JSValueMakeUndefined(context);
+ }
+
+ if (JSStringIsEqualToUTF8CString(propertyName, "hasPropertyLie")) {
+ return 0;
+ }
+
+ if (JSStringIsEqualToUTF8CString(propertyName, "throwOnGet")) {
+ return JSEvaluateScript(context, JSStringCreateWithUTF8CString("throw 'an exception'"), object, JSStringCreateWithUTF8CString("test script"), 1, exception);
+ }
+
+ if (JSStringIsEqualToUTF8CString(propertyName, "0")) {
+ *exception = JSValueMakeNumber(context, 1);
+ return JSValueMakeNumber(context, 1);
+ }
+
+ return JSValueMakeNull(context);
+}
+
+static bool MyObject_setProperty(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSValueRef* exception)
+{
+ UNUSED_PARAM(context);
+ UNUSED_PARAM(object);
+ UNUSED_PARAM(value);
+ UNUSED_PARAM(exception);
+
+ if (JSStringIsEqualToUTF8CString(propertyName, "cantSet"))
+ return true; // pretend we set the property in order to swallow it
+
+ if (JSStringIsEqualToUTF8CString(propertyName, "throwOnSet")) {
+ JSEvaluateScript(context, JSStringCreateWithUTF8CString("throw 'an exception'"), object, JSStringCreateWithUTF8CString("test script"), 1, exception);
+ }
+
+ return false;
+}
+
+static bool MyObject_deleteProperty(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception)
+{
+ UNUSED_PARAM(context);
+ UNUSED_PARAM(object);
+
+ if (JSStringIsEqualToUTF8CString(propertyName, "cantDelete"))
+ return true;
+
+ if (JSStringIsEqualToUTF8CString(propertyName, "throwOnDelete")) {
+ JSEvaluateScript(context, JSStringCreateWithUTF8CString("throw 'an exception'"), object, JSStringCreateWithUTF8CString("test script"), 1, exception);
+ return false;
+ }
+
+ return false;
+}
+
+static void MyObject_getPropertyNames(JSContextRef context, JSObjectRef object, JSPropertyNameAccumulatorRef propertyNames)
+{
+ UNUSED_PARAM(context);
+ UNUSED_PARAM(object);
+
+ JSStringRef propertyName;
+
+ propertyName = JSStringCreateWithUTF8CString("alwaysOne");
+ JSPropertyNameAccumulatorAddName(propertyNames, propertyName);
+ JSStringRelease(propertyName);
+
+ propertyName = JSStringCreateWithUTF8CString("myPropertyName");
+ JSPropertyNameAccumulatorAddName(propertyNames, propertyName);
+ JSStringRelease(propertyName);
+}
+
+static JSValueRef MyObject_callAsFunction(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ UNUSED_PARAM(context);
+ UNUSED_PARAM(object);
+ UNUSED_PARAM(thisObject);
+ UNUSED_PARAM(exception);
+
+ if (argumentCount > 0 && JSValueIsString(context, arguments[0]) && JSStringIsEqualToUTF8CString(JSValueToStringCopy(context, arguments[0], 0), "throwOnCall")) {
+ JSEvaluateScript(context, JSStringCreateWithUTF8CString("throw 'an exception'"), object, JSStringCreateWithUTF8CString("test script"), 1, exception);
+ return JSValueMakeUndefined(context);
+ }
+
+ if (argumentCount > 0 && JSValueIsStrictEqual(context, arguments[0], JSValueMakeNumber(context, 0)))
+ return JSValueMakeNumber(context, 1);
+
+ return JSValueMakeUndefined(context);
+}
+
+static JSObjectRef MyObject_callAsConstructor(JSContextRef context, JSObjectRef object, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ UNUSED_PARAM(context);
+ UNUSED_PARAM(object);
+
+ if (argumentCount > 0 && JSValueIsString(context, arguments[0]) && JSStringIsEqualToUTF8CString(JSValueToStringCopy(context, arguments[0], 0), "throwOnConstruct")) {
+ JSEvaluateScript(context, JSStringCreateWithUTF8CString("throw 'an exception'"), object, JSStringCreateWithUTF8CString("test script"), 1, exception);
+ return object;
+ }
+
+ if (argumentCount > 0 && JSValueIsStrictEqual(context, arguments[0], JSValueMakeNumber(context, 0)))
+ return JSValueToObject(context, JSValueMakeNumber(context, 1), exception);
+
+ return JSValueToObject(context, JSValueMakeNumber(context, 0), exception);
+}
+
+static bool MyObject_hasInstance(JSContextRef context, JSObjectRef constructor, JSValueRef possibleValue, JSValueRef* exception)
+{
+ UNUSED_PARAM(context);
+ UNUSED_PARAM(constructor);
+
+ if (JSValueIsString(context, possibleValue) && JSStringIsEqualToUTF8CString(JSValueToStringCopy(context, possibleValue, 0), "throwOnHasInstance")) {
+ JSEvaluateScript(context, JSStringCreateWithUTF8CString("throw 'an exception'"), constructor, JSStringCreateWithUTF8CString("test script"), 1, exception);
+ return false;
+ }
+
+ JSStringRef numberString = JSStringCreateWithUTF8CString("Number");
+ JSObjectRef numberConstructor = JSValueToObject(context, JSObjectGetProperty(context, JSContextGetGlobalObject(context), numberString, exception), exception);
+ JSStringRelease(numberString);
+
+ return JSValueIsInstanceOfConstructor(context, possibleValue, numberConstructor, exception);
+}
+
+static JSValueRef MyObject_convertToType(JSContextRef context, JSObjectRef object, JSType type, JSValueRef* exception)
+{
+ UNUSED_PARAM(object);
+ UNUSED_PARAM(exception);
+
+ switch (type) {
+ case kJSTypeNumber:
+ return JSValueMakeNumber(context, 1);
+ case kJSTypeString:
+ {
+ JSStringRef string = JSStringCreateWithUTF8CString("MyObjectAsString");
+ JSValueRef result = JSValueMakeString(context, string);
+ JSStringRelease(string);
+ return result;
+ }
+ default:
+ break;
+ }
+
+ // string conversion -- forward to default object class
+ return JSValueMakeNull(context);
+}
+
+static JSStaticValue evilStaticValues[] = {
+ { "nullGetSet", 0, 0, kJSPropertyAttributeNone },
+ { 0, 0, 0, 0 }
+};
+
+static JSStaticFunction evilStaticFunctions[] = {
+ { "nullCall", 0, kJSPropertyAttributeNone },
+ { 0, 0, 0 }
+};
+
+JSClassDefinition MyObject_definition = {
+ 0,
+ kJSClassAttributeNone,
+
+ "MyObject",
+ NULL,
+
+ evilStaticValues,
+ evilStaticFunctions,
+
+ NULL,
+ NULL,
+ MyObject_hasProperty,
+ MyObject_getProperty,
+ MyObject_setProperty,
+ MyObject_deleteProperty,
+ MyObject_getPropertyNames,
+ MyObject_callAsFunction,
+ MyObject_callAsConstructor,
+ MyObject_hasInstance,
+ MyObject_convertToType,
+};
+
+static JSClassRef MyObject_class(JSContextRef context)
+{
+ UNUSED_PARAM(context);
+
+ static JSClassRef jsClass;
+ if (!jsClass)
+ jsClass = JSClassCreate(&MyObject_definition);
+
+ return jsClass;
+}
+
+static bool EvilExceptionObject_hasInstance(JSContextRef context, JSObjectRef constructor, JSValueRef possibleValue, JSValueRef* exception)
+{
+ UNUSED_PARAM(context);
+ UNUSED_PARAM(constructor);
+
+ JSStringRef hasInstanceName = JSStringCreateWithUTF8CString("hasInstance");
+ JSValueRef hasInstance = JSObjectGetProperty(context, constructor, hasInstanceName, exception);
+ JSStringRelease(hasInstanceName);
+ if (!hasInstance)
+ return false;
+ JSObjectRef function = JSValueToObject(context, hasInstance, exception);
+ JSValueRef result = JSObjectCallAsFunction(context, function, constructor, 1, &possibleValue, exception);
+ return result && JSValueToBoolean(context, result);
+}
+
+static JSValueRef EvilExceptionObject_convertToType(JSContextRef context, JSObjectRef object, JSType type, JSValueRef* exception)
+{
+ UNUSED_PARAM(object);
+ UNUSED_PARAM(exception);
+ JSStringRef funcName;
+ switch (type) {
+ case kJSTypeNumber:
+ funcName = JSStringCreateWithUTF8CString("toNumber");
+ break;
+ case kJSTypeString:
+ funcName = JSStringCreateWithUTF8CString("toStringExplicit");
+ break;
+ default:
+ return JSValueMakeNull(context);
+ break;
+ }
+
+ JSValueRef func = JSObjectGetProperty(context, object, funcName, exception);
+ JSStringRelease(funcName);
+ JSObjectRef function = JSValueToObject(context, func, exception);
+ if (!function)
+ return JSValueMakeNull(context);
+ JSValueRef value = JSObjectCallAsFunction(context, function, object, 0, NULL, exception);
+ if (!value) {
+ JSStringRef errorString = JSStringCreateWithUTF8CString("convertToType failed");
+ JSValueRef errorStringRef = JSValueMakeString(context, errorString);
+ JSStringRelease(errorString);
+ return errorStringRef;
+ }
+ return value;
+}
+
+JSClassDefinition EvilExceptionObject_definition = {
+ 0,
+ kJSClassAttributeNone,
+
+ "EvilExceptionObject",
+ NULL,
+
+ NULL,
+ NULL,
+
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ EvilExceptionObject_hasInstance,
+ EvilExceptionObject_convertToType,
+};
+
+static JSClassRef EvilExceptionObject_class(JSContextRef context)
+{
+ UNUSED_PARAM(context);
+
+ static JSClassRef jsClass;
+ if (!jsClass)
+ jsClass = JSClassCreate(&EvilExceptionObject_definition);
+
+ return jsClass;
+}
+
+JSClassDefinition EmptyObject_definition = {
+ 0,
+ kJSClassAttributeNone,
+
+ NULL,
+ NULL,
+
+ NULL,
+ NULL,
+
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+};
+
+static JSClassRef EmptyObject_class(JSContextRef context)
+{
+ UNUSED_PARAM(context);
+
+ static JSClassRef jsClass;
+ if (!jsClass)
+ jsClass = JSClassCreate(&EmptyObject_definition);
+
+ return jsClass;
+}
+
+
+static JSValueRef Base_get(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception)
+{
+ UNUSED_PARAM(object);
+ UNUSED_PARAM(propertyName);
+ UNUSED_PARAM(exception);
+
+ return JSValueMakeNumber(ctx, 1); // distinguish base get form derived get
+}
+
+static bool Base_set(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSValueRef* exception)
+{
+ UNUSED_PARAM(object);
+ UNUSED_PARAM(propertyName);
+ UNUSED_PARAM(value);
+
+ *exception = JSValueMakeNumber(ctx, 1); // distinguish base set from derived set
+ return true;
+}
+
+static JSValueRef Base_callAsFunction(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ UNUSED_PARAM(function);
+ UNUSED_PARAM(thisObject);
+ UNUSED_PARAM(argumentCount);
+ UNUSED_PARAM(arguments);
+ UNUSED_PARAM(exception);
+
+ return JSValueMakeNumber(ctx, 1); // distinguish base call from derived call
+}
+
+static JSStaticFunction Base_staticFunctions[] = {
+ { "baseProtoDup", NULL, kJSPropertyAttributeNone },
+ { "baseProto", Base_callAsFunction, kJSPropertyAttributeNone },
+ { 0, 0, 0 }
+};
+
+static JSStaticValue Base_staticValues[] = {
+ { "baseDup", Base_get, Base_set, kJSPropertyAttributeNone },
+ { "baseOnly", Base_get, Base_set, kJSPropertyAttributeNone },
+ { 0, 0, 0, 0 }
+};
+
+static bool TestInitializeFinalize;
+static void Base_initialize(JSContextRef context, JSObjectRef object)
+{
+ UNUSED_PARAM(context);
+
+ if (TestInitializeFinalize) {
+ ASSERT((void*)1 == JSObjectGetPrivate(object));
+ JSObjectSetPrivate(object, (void*)2);
+ }
+}
+
+static unsigned Base_didFinalize;
+static void Base_finalize(JSObjectRef object)
+{
+ UNUSED_PARAM(object);
+ if (TestInitializeFinalize) {
+ ASSERT((void*)4 == JSObjectGetPrivate(object));
+ Base_didFinalize = true;
+ }
+}
+
+static JSClassRef Base_class(JSContextRef context)
+{
+ UNUSED_PARAM(context);
+
+ static JSClassRef jsClass;
+ if (!jsClass) {
+ JSClassDefinition definition = kJSClassDefinitionEmpty;
+ definition.staticValues = Base_staticValues;
+ definition.staticFunctions = Base_staticFunctions;
+ definition.initialize = Base_initialize;
+ definition.finalize = Base_finalize;
+ jsClass = JSClassCreate(&definition);
+ }
+ return jsClass;
+}
+
+static JSValueRef Derived_get(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception)
+{
+ UNUSED_PARAM(object);
+ UNUSED_PARAM(propertyName);
+ UNUSED_PARAM(exception);
+
+ return JSValueMakeNumber(ctx, 2); // distinguish base get form derived get
+}
+
+static bool Derived_set(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSValueRef* exception)
+{
+ UNUSED_PARAM(ctx);
+ UNUSED_PARAM(object);
+ UNUSED_PARAM(propertyName);
+ UNUSED_PARAM(value);
+
+ *exception = JSValueMakeNumber(ctx, 2); // distinguish base set from derived set
+ return true;
+}
+
+static JSValueRef Derived_callAsFunction(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ UNUSED_PARAM(function);
+ UNUSED_PARAM(thisObject);
+ UNUSED_PARAM(argumentCount);
+ UNUSED_PARAM(arguments);
+ UNUSED_PARAM(exception);
+
+ return JSValueMakeNumber(ctx, 2); // distinguish base call from derived call
+}
+
+static JSStaticFunction Derived_staticFunctions[] = {
+ { "protoOnly", Derived_callAsFunction, kJSPropertyAttributeNone },
+ { "protoDup", NULL, kJSPropertyAttributeNone },
+ { "baseProtoDup", Derived_callAsFunction, kJSPropertyAttributeNone },
+ { 0, 0, 0 }
+};
+
+static JSStaticValue Derived_staticValues[] = {
+ { "derivedOnly", Derived_get, Derived_set, kJSPropertyAttributeNone },
+ { "protoDup", Derived_get, Derived_set, kJSPropertyAttributeNone },
+ { "baseDup", Derived_get, Derived_set, kJSPropertyAttributeNone },
+ { 0, 0, 0, 0 }
+};
+
+static void Derived_initialize(JSContextRef context, JSObjectRef object)
+{
+ UNUSED_PARAM(context);
+
+ if (TestInitializeFinalize) {
+ ASSERT((void*)2 == JSObjectGetPrivate(object));
+ JSObjectSetPrivate(object, (void*)3);
+ }
+}
+
+static void Derived_finalize(JSObjectRef object)
+{
+ if (TestInitializeFinalize) {
+ ASSERT((void*)3 == JSObjectGetPrivate(object));
+ JSObjectSetPrivate(object, (void*)4);
+ }
+}
+
+static JSClassRef Derived_class(JSContextRef context)
+{
+ static JSClassRef jsClass;
+ if (!jsClass) {
+ JSClassDefinition definition = kJSClassDefinitionEmpty;
+ definition.parentClass = Base_class(context);
+ definition.staticValues = Derived_staticValues;
+ definition.staticFunctions = Derived_staticFunctions;
+ definition.initialize = Derived_initialize;
+ definition.finalize = Derived_finalize;
+ jsClass = JSClassCreate(&definition);
+ }
+ return jsClass;
+}
+
+static JSClassRef Derived2_class(JSContextRef context)
+{
+ static JSClassRef jsClass;
+ if (!jsClass) {
+ JSClassDefinition definition = kJSClassDefinitionEmpty;
+ definition.parentClass = Derived_class(context);
+ jsClass = JSClassCreate(&definition);
+ }
+ return jsClass;
+}
+
+static JSValueRef print_callAsFunction(JSContextRef ctx, JSObjectRef functionObject, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ UNUSED_PARAM(functionObject);
+ UNUSED_PARAM(thisObject);
+ UNUSED_PARAM(exception);
+
+ ASSERT(JSContextGetGlobalContext(ctx) == context);
+
+ if (argumentCount > 0) {
+ JSStringRef string = JSValueToStringCopy(ctx, arguments[0], NULL);
+ size_t sizeUTF8 = JSStringGetMaximumUTF8CStringSize(string);
+ char* stringUTF8 = (char*)malloc(sizeUTF8);
+ JSStringGetUTF8CString(string, stringUTF8, sizeUTF8);
+ printf("%s\n", stringUTF8);
+ free(stringUTF8);
+ JSStringRelease(string);
+ }
+
+ return JSValueMakeUndefined(ctx);
+}
+
+static JSObjectRef myConstructor_callAsConstructor(JSContextRef context, JSObjectRef constructorObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ UNUSED_PARAM(constructorObject);
+ UNUSED_PARAM(exception);
+
+ JSObjectRef result = JSObjectMake(context, NULL, NULL);
+ if (argumentCount > 0) {
+ JSStringRef value = JSStringCreateWithUTF8CString("value");
+ JSObjectSetProperty(context, result, value, arguments[0], kJSPropertyAttributeNone, NULL);
+ JSStringRelease(value);
+ }
+
+ return result;
+}
+
+
+static void globalObject_initialize(JSContextRef context, JSObjectRef object)
+{
+ UNUSED_PARAM(object);
+ // Ensure that an execution context is passed in
+ ASSERT(context);
+
+ // Ensure that the global object is set to the object that we were passed
+ JSObjectRef globalObject = JSContextGetGlobalObject(context);
+ ASSERT(globalObject);
+ ASSERT(object == globalObject);
+
+ // Ensure that the standard global properties have been set on the global object
+ JSStringRef array = JSStringCreateWithUTF8CString("Array");
+ JSObjectRef arrayConstructor = JSValueToObject(context, JSObjectGetProperty(context, globalObject, array, NULL), NULL);
+ JSStringRelease(array);
+
+ UNUSED_PARAM(arrayConstructor);
+ ASSERT(arrayConstructor);
+}
+
+static JSValueRef globalObject_get(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception)
+{
+ UNUSED_PARAM(object);
+ UNUSED_PARAM(propertyName);
+ UNUSED_PARAM(exception);
+
+ return JSValueMakeNumber(ctx, 3);
+}
+
+static bool globalObject_set(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSValueRef* exception)
+{
+ UNUSED_PARAM(object);
+ UNUSED_PARAM(propertyName);
+ UNUSED_PARAM(value);
+
+ *exception = JSValueMakeNumber(ctx, 3);
+ return true;
+}
+
+static JSValueRef globalObject_call(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ UNUSED_PARAM(function);
+ UNUSED_PARAM(thisObject);
+ UNUSED_PARAM(argumentCount);
+ UNUSED_PARAM(arguments);
+ UNUSED_PARAM(exception);
+
+ return JSValueMakeNumber(ctx, 3);
+}
+
+static JSValueRef functionGC(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ UNUSED_PARAM(function);
+ UNUSED_PARAM(thisObject);
+ UNUSED_PARAM(argumentCount);
+ UNUSED_PARAM(arguments);
+ UNUSED_PARAM(exception);
+ JSGarbageCollect(context);
+ return JSValueMakeUndefined(context);
+}
+
+static JSStaticValue globalObject_staticValues[] = {
+ { "globalStaticValue", globalObject_get, globalObject_set, kJSPropertyAttributeNone },
+ { 0, 0, 0, 0 }
+};
+
+static JSStaticFunction globalObject_staticFunctions[] = {
+ { "globalStaticFunction", globalObject_call, kJSPropertyAttributeNone },
+ { "gc", functionGC, kJSPropertyAttributeNone },
+ { 0, 0, 0 }
+};
+
+static char* createStringWithContentsOfFile(const char* fileName);
+
+static void testInitializeFinalize()
+{
+ JSObjectRef o = JSObjectMake(context, Derived_class(context), (void*)1);
+ UNUSED_PARAM(o);
+ ASSERT(JSObjectGetPrivate(o) == (void*)3);
+}
+
+static JSValueRef jsNumberValue = NULL;
+
+static JSObjectRef aHeapRef = NULL;
+
+static void makeGlobalNumberValue(JSContextRef context) {
+ JSValueRef v = JSValueMakeNumber(context, 420);
+ JSValueProtect(context, v);
+ jsNumberValue = v;
+ v = NULL;
+}
+
+static bool assertTrue(bool value, const char* message)
+{
+ if (!value) {
+ if (message)
+ fprintf(stderr, "assertTrue failed: '%s'\n", message);
+ else
+ fprintf(stderr, "assertTrue failed.\n");
+ failed = 1;
+ }
+ return value;
+}
+
+static bool checkForCycleInPrototypeChain()
+{
+ bool result = true;
+ JSGlobalContextRef context = JSGlobalContextCreate(0);
+ JSObjectRef object1 = JSObjectMake(context, /* jsClass */ 0, /* data */ 0);
+ JSObjectRef object2 = JSObjectMake(context, /* jsClass */ 0, /* data */ 0);
+ JSObjectRef object3 = JSObjectMake(context, /* jsClass */ 0, /* data */ 0);
+
+ JSObjectSetPrototype(context, object1, JSValueMakeNull(context));
+ ASSERT(JSValueIsNull(context, JSObjectGetPrototype(context, object1)));
+
+ // object1 -> object1
+ JSObjectSetPrototype(context, object1, object1);
+ result &= assertTrue(JSValueIsNull(context, JSObjectGetPrototype(context, object1)), "It is possible to assign self as a prototype");
+
+ // object1 -> object2 -> object1
+ JSObjectSetPrototype(context, object2, object1);
+ ASSERT(JSValueIsStrictEqual(context, JSObjectGetPrototype(context, object2), object1));
+ JSObjectSetPrototype(context, object1, object2);
+ result &= assertTrue(JSValueIsNull(context, JSObjectGetPrototype(context, object1)), "It is possible to close a prototype chain cycle");
+
+ // object1 -> object2 -> object3 -> object1
+ JSObjectSetPrototype(context, object2, object3);
+ ASSERT(JSValueIsStrictEqual(context, JSObjectGetPrototype(context, object2), object3));
+ JSObjectSetPrototype(context, object1, object2);
+ ASSERT(JSValueIsStrictEqual(context, JSObjectGetPrototype(context, object1), object2));
+ JSObjectSetPrototype(context, object3, object1);
+ result &= assertTrue(!JSValueIsStrictEqual(context, JSObjectGetPrototype(context, object3), object1), "It is possible to close a prototype chain cycle");
+
+ JSValueRef exception;
+ JSStringRef code = JSStringCreateWithUTF8CString("o = { }; p = { }; o.__proto__ = p; p.__proto__ = o");
+ JSStringRef file = JSStringCreateWithUTF8CString("");
+ result &= assertTrue(!JSEvaluateScript(context, code, /* thisObject*/ 0, file, 1, &exception)
+ , "An exception should be thrown");
+
+ JSStringRelease(code);
+ JSStringRelease(file);
+ JSGlobalContextRelease(context);
+ return result;
+}
+
+int main(int argc, char* argv[])
+{
+ const char *scriptPath = "testapi.js";
+ if (argc > 1) {
+ scriptPath = argv[1];
+ }
+
+ // Test garbage collection with a fresh context
+ context = JSGlobalContextCreateInGroup(NULL, NULL);
+ TestInitializeFinalize = true;
+ testInitializeFinalize();
+ JSGlobalContextRelease(context);
+ TestInitializeFinalize = false;
+
+ ASSERT(Base_didFinalize);
+
+ JSClassDefinition globalObjectClassDefinition = kJSClassDefinitionEmpty;
+ globalObjectClassDefinition.initialize = globalObject_initialize;
+ globalObjectClassDefinition.staticValues = globalObject_staticValues;
+ globalObjectClassDefinition.staticFunctions = globalObject_staticFunctions;
+ globalObjectClassDefinition.attributes = kJSClassAttributeNoAutomaticPrototype;
+ JSClassRef globalObjectClass = JSClassCreate(&globalObjectClassDefinition);
+ context = JSGlobalContextCreateInGroup(NULL, globalObjectClass);
+
+ JSGlobalContextRetain(context);
+ JSGlobalContextRelease(context);
+ ASSERT(JSContextGetGlobalContext(context) == context);
+
+ JSReportExtraMemoryCost(context, 0);
+ JSReportExtraMemoryCost(context, 1);
+ JSReportExtraMemoryCost(context, 1024);
+
+ JSObjectRef globalObject = JSContextGetGlobalObject(context);
+ ASSERT(JSValueIsObject(context, globalObject));
+
+ JSValueRef jsUndefined = JSValueMakeUndefined(context);
+ JSValueRef jsNull = JSValueMakeNull(context);
+ JSValueRef jsTrue = JSValueMakeBoolean(context, true);
+ JSValueRef jsFalse = JSValueMakeBoolean(context, false);
+ JSValueRef jsZero = JSValueMakeNumber(context, 0);
+ JSValueRef jsOne = JSValueMakeNumber(context, 1);
+ JSValueRef jsOneThird = JSValueMakeNumber(context, 1.0 / 3.0);
+ JSObjectRef jsObjectNoProto = JSObjectMake(context, NULL, NULL);
+ JSObjectSetPrototype(context, jsObjectNoProto, JSValueMakeNull(context));
+
+ // FIXME: test funny utf8 characters
+ JSStringRef jsEmptyIString = JSStringCreateWithUTF8CString("");
+ JSValueRef jsEmptyString = JSValueMakeString(context, jsEmptyIString);
+
+ JSStringRef jsOneIString = JSStringCreateWithUTF8CString("1");
+ JSValueRef jsOneString = JSValueMakeString(context, jsOneIString);
+
+ UniChar singleUniChar = 65; // Capital A
+ CFMutableStringRef cfString =
+ CFStringCreateMutableWithExternalCharactersNoCopy(kCFAllocatorDefault,
+ &singleUniChar,
+ 1,
+ 1,
+ kCFAllocatorNull);
+
+ JSStringRef jsCFIString = JSStringCreateWithCFString(cfString);
+ JSValueRef jsCFString = JSValueMakeString(context, jsCFIString);
+
+ CFStringRef cfEmptyString = CFStringCreateWithCString(kCFAllocatorDefault, "", kCFStringEncodingUTF8);
+
+ JSStringRef jsCFEmptyIString = JSStringCreateWithCFString(cfEmptyString);
+ JSValueRef jsCFEmptyString = JSValueMakeString(context, jsCFEmptyIString);
+
+ CFIndex cfStringLength = CFStringGetLength(cfString);
+ UniChar* buffer = (UniChar*)malloc(cfStringLength * sizeof(UniChar));
+ CFStringGetCharacters(cfString,
+ CFRangeMake(0, cfStringLength),
+ buffer);
+ JSStringRef jsCFIStringWithCharacters = JSStringCreateWithCharacters((JSChar*)buffer, cfStringLength);
+ JSValueRef jsCFStringWithCharacters = JSValueMakeString(context, jsCFIStringWithCharacters);
+
+ JSStringRef jsCFEmptyIStringWithCharacters = JSStringCreateWithCharacters((JSChar*)buffer, CFStringGetLength(cfEmptyString));
+ free(buffer);
+ JSValueRef jsCFEmptyStringWithCharacters = JSValueMakeString(context, jsCFEmptyIStringWithCharacters);
+
+ ASSERT(JSValueGetType(context, jsUndefined) == kJSTypeUndefined);
+ ASSERT(JSValueGetType(context, jsNull) == kJSTypeNull);
+ ASSERT(JSValueGetType(context, jsTrue) == kJSTypeBoolean);
+ ASSERT(JSValueGetType(context, jsFalse) == kJSTypeBoolean);
+ ASSERT(JSValueGetType(context, jsZero) == kJSTypeNumber);
+ ASSERT(JSValueGetType(context, jsOne) == kJSTypeNumber);
+ ASSERT(JSValueGetType(context, jsOneThird) == kJSTypeNumber);
+ ASSERT(JSValueGetType(context, jsEmptyString) == kJSTypeString);
+ ASSERT(JSValueGetType(context, jsOneString) == kJSTypeString);
+ ASSERT(JSValueGetType(context, jsCFString) == kJSTypeString);
+ ASSERT(JSValueGetType(context, jsCFStringWithCharacters) == kJSTypeString);
+ ASSERT(JSValueGetType(context, jsCFEmptyString) == kJSTypeString);
+ ASSERT(JSValueGetType(context, jsCFEmptyStringWithCharacters) == kJSTypeString);
+
+ JSObjectRef myObject = JSObjectMake(context, MyObject_class(context), NULL);
+ JSStringRef myObjectIString = JSStringCreateWithUTF8CString("MyObject");
+ JSObjectSetProperty(context, globalObject, myObjectIString, myObject, kJSPropertyAttributeNone, NULL);
+ JSStringRelease(myObjectIString);
+
+ JSObjectRef EvilExceptionObject = JSObjectMake(context, EvilExceptionObject_class(context), NULL);
+ JSStringRef EvilExceptionObjectIString = JSStringCreateWithUTF8CString("EvilExceptionObject");
+ JSObjectSetProperty(context, globalObject, EvilExceptionObjectIString, EvilExceptionObject, kJSPropertyAttributeNone, NULL);
+ JSStringRelease(EvilExceptionObjectIString);
+
+ JSObjectRef EmptyObject = JSObjectMake(context, EmptyObject_class(context), NULL);
+ JSStringRef EmptyObjectIString = JSStringCreateWithUTF8CString("EmptyObject");
+ JSObjectSetProperty(context, globalObject, EmptyObjectIString, EmptyObject, kJSPropertyAttributeNone, NULL);
+ JSStringRelease(EmptyObjectIString);
+
+ JSStringRef lengthStr = JSStringCreateWithUTF8CString("length");
+ JSObjectRef aStackRef = JSObjectMakeArray(context, 0, 0, 0);
+ aHeapRef = aStackRef;
+ JSObjectSetProperty(context, aHeapRef, lengthStr, JSValueMakeNumber(context, 10), 0, 0);
+ JSStringRef privatePropertyName = JSStringCreateWithUTF8CString("privateProperty");
+ if (!JSObjectSetPrivateProperty(context, myObject, privatePropertyName, aHeapRef)) {
+ printf("FAIL: Could not set private property.\n");
+ failed = 1;
+ } else
+ printf("PASS: Set private property.\n");
+ aStackRef = 0;
+ if (JSObjectSetPrivateProperty(context, aHeapRef, privatePropertyName, aHeapRef)) {
+ printf("FAIL: JSObjectSetPrivateProperty should fail on non-API objects.\n");
+ failed = 1;
+ } else
+ printf("PASS: Did not allow JSObjectSetPrivateProperty on a non-API object.\n");
+ if (JSObjectGetPrivateProperty(context, myObject, privatePropertyName) != aHeapRef) {
+ printf("FAIL: Could not retrieve private property.\n");
+ failed = 1;
+ } else
+ printf("PASS: Retrieved private property.\n");
+ if (JSObjectGetPrivateProperty(context, aHeapRef, privatePropertyName)) {
+ printf("FAIL: JSObjectGetPrivateProperty should return NULL when called on a non-API object.\n");
+ failed = 1;
+ } else
+ printf("PASS: JSObjectGetPrivateProperty return NULL.\n");
+
+ if (JSObjectGetProperty(context, myObject, privatePropertyName, 0) == aHeapRef) {
+ printf("FAIL: Accessed private property through ordinary property lookup.\n");
+ failed = 1;
+ } else
+ printf("PASS: Cannot access private property through ordinary property lookup.\n");
+
+ JSGarbageCollect(context);
+
+ for (int i = 0; i < 10000; i++)
+ JSObjectMake(context, 0, 0);
+
+ aHeapRef = JSValueToObject(context, JSObjectGetPrivateProperty(context, myObject, privatePropertyName), 0);
+ if (JSValueToNumber(context, JSObjectGetProperty(context, aHeapRef, lengthStr, 0), 0) != 10) {
+ printf("FAIL: Private property has been collected.\n");
+ failed = 1;
+ } else
+ printf("PASS: Private property does not appear to have been collected.\n");
+ JSStringRelease(lengthStr);
+
+ if (!JSObjectSetPrivateProperty(context, myObject, privatePropertyName, 0)) {
+ printf("FAIL: Could not set private property to NULL.\n");
+ failed = 1;
+ } else
+ printf("PASS: Set private property to NULL.\n");
+ if (JSObjectGetPrivateProperty(context, myObject, privatePropertyName)) {
+ printf("FAIL: Could not retrieve private property.\n");
+ failed = 1;
+ } else
+ printf("PASS: Retrieved private property.\n");
+
+ JSStringRef validJSON = JSStringCreateWithUTF8CString("{\"aProperty\":true}");
+ JSValueRef jsonObject = JSValueMakeFromJSONString(context, validJSON);
+ JSStringRelease(validJSON);
+ if (!JSValueIsObject(context, jsonObject)) {
+ printf("FAIL: Did not parse valid JSON correctly\n");
+ failed = 1;
+ } else
+ printf("PASS: Parsed valid JSON string.\n");
+ JSStringRef propertyName = JSStringCreateWithUTF8CString("aProperty");
+ assertEqualsAsBoolean(JSObjectGetProperty(context, JSValueToObject(context, jsonObject, 0), propertyName, 0), true);
+ JSStringRelease(propertyName);
+ JSStringRef invalidJSON = JSStringCreateWithUTF8CString("fail!");
+ if (JSValueMakeFromJSONString(context, invalidJSON)) {
+ printf("FAIL: Should return null for invalid JSON data\n");
+ failed = 1;
+ } else
+ printf("PASS: Correctly returned null for invalid JSON data.\n");
+ JSValueRef exception;
+ JSStringRef str = JSValueCreateJSONString(context, jsonObject, 0, 0);
+ if (!JSStringIsEqualToUTF8CString(str, "{\"aProperty\":true}")) {
+ printf("FAIL: Did not correctly serialise with indent of 0.\n");
+ failed = 1;
+ } else
+ printf("PASS: Correctly serialised with indent of 0.\n");
+ JSStringRelease(str);
+
+ str = JSValueCreateJSONString(context, jsonObject, 4, 0);
+ if (!JSStringIsEqualToUTF8CString(str, "{\n \"aProperty\": true\n}")) {
+ printf("FAIL: Did not correctly serialise with indent of 4.\n");
+ failed = 1;
+ } else
+ printf("PASS: Correctly serialised with indent of 4.\n");
+ JSStringRelease(str);
+ JSStringRef src = JSStringCreateWithUTF8CString("({get a(){ throw '';}})");
+ JSValueRef unstringifiableObj = JSEvaluateScript(context, src, NULL, NULL, 1, NULL);
+
+ str = JSValueCreateJSONString(context, unstringifiableObj, 4, 0);
+ if (str) {
+ printf("FAIL: Didn't return null when attempting to serialize unserializable value.\n");
+ JSStringRelease(str);
+ failed = 1;
+ } else
+ printf("PASS: returned null when attempting to serialize unserializable value.\n");
+
+ str = JSValueCreateJSONString(context, unstringifiableObj, 4, &exception);
+ if (str) {
+ printf("FAIL: Didn't return null when attempting to serialize unserializable value.\n");
+ JSStringRelease(str);
+ failed = 1;
+ } else
+ printf("PASS: returned null when attempting to serialize unserializable value.\n");
+ if (!exception) {
+ printf("FAIL: Did not set exception on serialisation error\n");
+ failed = 1;
+ } else
+ printf("PASS: set exception on serialisation error\n");
+ // Conversions that throw exceptions
+ exception = NULL;
+ ASSERT(NULL == JSValueToObject(context, jsNull, &exception));
+ ASSERT(exception);
+
+ exception = NULL;
+ // FIXME <rdar://4668451> - On i386 the isnan(double) macro tries to map to the isnan(float) function,
+ // causing a build break with -Wshorten-64-to-32 enabled. The issue is known by the appropriate team.
+ // After that's resolved, we can remove these casts
+ ASSERT(isnan((float)JSValueToNumber(context, jsObjectNoProto, &exception)));
+ ASSERT(exception);
+
+ exception = NULL;
+ ASSERT(!JSValueToStringCopy(context, jsObjectNoProto, &exception));
+ ASSERT(exception);
+
+ ASSERT(JSValueToBoolean(context, myObject));
+
+ exception = NULL;
+ ASSERT(!JSValueIsEqual(context, jsObjectNoProto, JSValueMakeNumber(context, 1), &exception));
+ ASSERT(exception);
+
+ exception = NULL;
+ JSObjectGetPropertyAtIndex(context, myObject, 0, &exception);
+ ASSERT(1 == JSValueToNumber(context, exception, NULL));
+
+ assertEqualsAsBoolean(jsUndefined, false);
+ assertEqualsAsBoolean(jsNull, false);
+ assertEqualsAsBoolean(jsTrue, true);
+ assertEqualsAsBoolean(jsFalse, false);
+ assertEqualsAsBoolean(jsZero, false);
+ assertEqualsAsBoolean(jsOne, true);
+ assertEqualsAsBoolean(jsOneThird, true);
+ assertEqualsAsBoolean(jsEmptyString, false);
+ assertEqualsAsBoolean(jsOneString, true);
+ assertEqualsAsBoolean(jsCFString, true);
+ assertEqualsAsBoolean(jsCFStringWithCharacters, true);
+ assertEqualsAsBoolean(jsCFEmptyString, false);
+ assertEqualsAsBoolean(jsCFEmptyStringWithCharacters, false);
+
+ assertEqualsAsNumber(jsUndefined, nan(""));
+ assertEqualsAsNumber(jsNull, 0);
+ assertEqualsAsNumber(jsTrue, 1);
+ assertEqualsAsNumber(jsFalse, 0);
+ assertEqualsAsNumber(jsZero, 0);
+ assertEqualsAsNumber(jsOne, 1);
+ assertEqualsAsNumber(jsOneThird, 1.0 / 3.0);
+ assertEqualsAsNumber(jsEmptyString, 0);
+ assertEqualsAsNumber(jsOneString, 1);
+ assertEqualsAsNumber(jsCFString, nan(""));
+ assertEqualsAsNumber(jsCFStringWithCharacters, nan(""));
+ assertEqualsAsNumber(jsCFEmptyString, 0);
+ assertEqualsAsNumber(jsCFEmptyStringWithCharacters, 0);
+ ASSERT(sizeof(JSChar) == sizeof(UniChar));
+
+ assertEqualsAsCharactersPtr(jsUndefined, "undefined");
+ assertEqualsAsCharactersPtr(jsNull, "null");
+ assertEqualsAsCharactersPtr(jsTrue, "true");
+ assertEqualsAsCharactersPtr(jsFalse, "false");
+ assertEqualsAsCharactersPtr(jsZero, "0");
+ assertEqualsAsCharactersPtr(jsOne, "1");
+ assertEqualsAsCharactersPtr(jsOneThird, "0.3333333333333333");
+ assertEqualsAsCharactersPtr(jsEmptyString, "");
+ assertEqualsAsCharactersPtr(jsOneString, "1");
+ assertEqualsAsCharactersPtr(jsCFString, "A");
+ assertEqualsAsCharactersPtr(jsCFStringWithCharacters, "A");
+ assertEqualsAsCharactersPtr(jsCFEmptyString, "");
+ assertEqualsAsCharactersPtr(jsCFEmptyStringWithCharacters, "");
+
+ assertEqualsAsUTF8String(jsUndefined, "undefined");
+ assertEqualsAsUTF8String(jsNull, "null");
+ assertEqualsAsUTF8String(jsTrue, "true");
+ assertEqualsAsUTF8String(jsFalse, "false");
+ assertEqualsAsUTF8String(jsZero, "0");
+ assertEqualsAsUTF8String(jsOne, "1");
+ assertEqualsAsUTF8String(jsOneThird, "0.3333333333333333");
+ assertEqualsAsUTF8String(jsEmptyString, "");
+ assertEqualsAsUTF8String(jsOneString, "1");
+ assertEqualsAsUTF8String(jsCFString, "A");
+ assertEqualsAsUTF8String(jsCFStringWithCharacters, "A");
+ assertEqualsAsUTF8String(jsCFEmptyString, "");
+ assertEqualsAsUTF8String(jsCFEmptyStringWithCharacters, "");
+
+ ASSERT(JSValueIsStrictEqual(context, jsTrue, jsTrue));
+ ASSERT(!JSValueIsStrictEqual(context, jsOne, jsOneString));
+
+ ASSERT(JSValueIsEqual(context, jsOne, jsOneString, NULL));
+ ASSERT(!JSValueIsEqual(context, jsTrue, jsFalse, NULL));
+
+ CFStringRef cfJSString = JSStringCopyCFString(kCFAllocatorDefault, jsCFIString);
+ CFStringRef cfJSEmptyString = JSStringCopyCFString(kCFAllocatorDefault, jsCFEmptyIString);
+ ASSERT(CFEqual(cfJSString, cfString));
+ ASSERT(CFEqual(cfJSEmptyString, cfEmptyString));
+ CFRelease(cfJSString);
+ CFRelease(cfJSEmptyString);
+
+ CFRelease(cfString);
+ CFRelease(cfEmptyString);
+
+ jsGlobalValue = JSObjectMake(context, NULL, NULL);
+ makeGlobalNumberValue(context);
+ JSValueProtect(context, jsGlobalValue);
+ JSGarbageCollect(context);
+ ASSERT(JSValueIsObject(context, jsGlobalValue));
+ JSValueUnprotect(context, jsGlobalValue);
+ JSValueUnprotect(context, jsNumberValue);
+
+ JSStringRef goodSyntax = JSStringCreateWithUTF8CString("x = 1;");
+ JSStringRef badSyntax = JSStringCreateWithUTF8CString("x := 1;");
+ ASSERT(JSCheckScriptSyntax(context, goodSyntax, NULL, 0, NULL));
+ ASSERT(!JSCheckScriptSyntax(context, badSyntax, NULL, 0, NULL));
+
+ JSValueRef result;
+ JSValueRef v;
+ JSObjectRef o;
+ JSStringRef string;
+
+ result = JSEvaluateScript(context, goodSyntax, NULL, NULL, 1, NULL);
+ ASSERT(result);
+ ASSERT(JSValueIsEqual(context, result, jsOne, NULL));
+
+ exception = NULL;
+ result = JSEvaluateScript(context, badSyntax, NULL, NULL, 1, &exception);
+ ASSERT(!result);
+ ASSERT(JSValueIsObject(context, exception));
+
+ JSStringRef array = JSStringCreateWithUTF8CString("Array");
+ JSObjectRef arrayConstructor = JSValueToObject(context, JSObjectGetProperty(context, globalObject, array, NULL), NULL);
+ JSStringRelease(array);
+ result = JSObjectCallAsConstructor(context, arrayConstructor, 0, NULL, NULL);
+ ASSERT(result);
+ ASSERT(JSValueIsObject(context, result));
+ ASSERT(JSValueIsInstanceOfConstructor(context, result, arrayConstructor, NULL));
+ ASSERT(!JSValueIsInstanceOfConstructor(context, JSValueMakeNull(context), arrayConstructor, NULL));
+
+ o = JSValueToObject(context, result, NULL);
+ exception = NULL;
+ ASSERT(JSValueIsUndefined(context, JSObjectGetPropertyAtIndex(context, o, 0, &exception)));
+ ASSERT(!exception);
+
+ JSObjectSetPropertyAtIndex(context, o, 0, JSValueMakeNumber(context, 1), &exception);
+ ASSERT(!exception);
+
+ exception = NULL;
+ ASSERT(1 == JSValueToNumber(context, JSObjectGetPropertyAtIndex(context, o, 0, &exception), &exception));
+ ASSERT(!exception);
+
+ JSStringRef functionBody;
+ JSObjectRef function;
+
+ exception = NULL;
+ functionBody = JSStringCreateWithUTF8CString("rreturn Array;");
+ JSStringRef line = JSStringCreateWithUTF8CString("line");
+ ASSERT(!JSObjectMakeFunction(context, NULL, 0, NULL, functionBody, NULL, 1, &exception));
+ ASSERT(JSValueIsObject(context, exception));
+ v = JSObjectGetProperty(context, JSValueToObject(context, exception, NULL), line, NULL);
+ assertEqualsAsNumber(v, 1);
+ JSStringRelease(functionBody);
+ JSStringRelease(line);
+
+ exception = NULL;
+ functionBody = JSStringCreateWithUTF8CString("return Array;");
+ function = JSObjectMakeFunction(context, NULL, 0, NULL, functionBody, NULL, 1, &exception);
+ JSStringRelease(functionBody);
+ ASSERT(!exception);
+ ASSERT(JSObjectIsFunction(context, function));
+ v = JSObjectCallAsFunction(context, function, NULL, 0, NULL, NULL);
+ ASSERT(v);
+ ASSERT(JSValueIsEqual(context, v, arrayConstructor, NULL));
+
+ exception = NULL;
+ function = JSObjectMakeFunction(context, NULL, 0, NULL, jsEmptyIString, NULL, 0, &exception);
+ ASSERT(!exception);
+ v = JSObjectCallAsFunction(context, function, NULL, 0, NULL, &exception);
+ ASSERT(v && !exception);
+ ASSERT(JSValueIsUndefined(context, v));
+
+ exception = NULL;
+ v = NULL;
+ JSStringRef foo = JSStringCreateWithUTF8CString("foo");
+ JSStringRef argumentNames[] = { foo };
+ functionBody = JSStringCreateWithUTF8CString("return foo;");
+ function = JSObjectMakeFunction(context, foo, 1, argumentNames, functionBody, NULL, 1, &exception);
+ ASSERT(function && !exception);
+ JSValueRef arguments[] = { JSValueMakeNumber(context, 2) };
+ v = JSObjectCallAsFunction(context, function, NULL, 1, arguments, &exception);
+ JSStringRelease(foo);
+ JSStringRelease(functionBody);
+
+ string = JSValueToStringCopy(context, function, NULL);
+ assertEqualsAsUTF8String(JSValueMakeString(context, string), "function foo(foo) { return foo;\n}");
+ JSStringRelease(string);
+
+ JSStringRef print = JSStringCreateWithUTF8CString("print");
+ JSObjectRef printFunction = JSObjectMakeFunctionWithCallback(context, print, print_callAsFunction);
+ JSObjectSetProperty(context, globalObject, print, printFunction, kJSPropertyAttributeNone, NULL);
+ JSStringRelease(print);
+
+ ASSERT(!JSObjectSetPrivate(printFunction, (void*)1));
+ ASSERT(!JSObjectGetPrivate(printFunction));
+
+ JSStringRef myConstructorIString = JSStringCreateWithUTF8CString("MyConstructor");
+ JSObjectRef myConstructor = JSObjectMakeConstructor(context, NULL, myConstructor_callAsConstructor);
+ JSObjectSetProperty(context, globalObject, myConstructorIString, myConstructor, kJSPropertyAttributeNone, NULL);
+ JSStringRelease(myConstructorIString);
+
+ ASSERT(!JSObjectSetPrivate(myConstructor, (void*)1));
+ ASSERT(!JSObjectGetPrivate(myConstructor));
+
+ string = JSStringCreateWithUTF8CString("Base");
+ JSObjectRef baseConstructor = JSObjectMakeConstructor(context, Base_class(context), NULL);
+ JSObjectSetProperty(context, globalObject, string, baseConstructor, kJSPropertyAttributeNone, NULL);
+ JSStringRelease(string);
+
+ string = JSStringCreateWithUTF8CString("Derived");
+ JSObjectRef derivedConstructor = JSObjectMakeConstructor(context, Derived_class(context), NULL);
+ JSObjectSetProperty(context, globalObject, string, derivedConstructor, kJSPropertyAttributeNone, NULL);
+ JSStringRelease(string);
+
+ string = JSStringCreateWithUTF8CString("Derived2");
+ JSObjectRef derived2Constructor = JSObjectMakeConstructor(context, Derived2_class(context), NULL);
+ JSObjectSetProperty(context, globalObject, string, derived2Constructor, kJSPropertyAttributeNone, NULL);
+ JSStringRelease(string);
+
+ o = JSObjectMake(context, NULL, NULL);
+ JSObjectSetProperty(context, o, jsOneIString, JSValueMakeNumber(context, 1), kJSPropertyAttributeNone, NULL);
+ JSObjectSetProperty(context, o, jsCFIString, JSValueMakeNumber(context, 1), kJSPropertyAttributeDontEnum, NULL);
+ JSPropertyNameArrayRef nameArray = JSObjectCopyPropertyNames(context, o);
+ size_t expectedCount = JSPropertyNameArrayGetCount(nameArray);
+ size_t count;
+ for (count = 0; count < expectedCount; ++count)
+ JSPropertyNameArrayGetNameAtIndex(nameArray, count);
+ JSPropertyNameArrayRelease(nameArray);
+ ASSERT(count == 1); // jsCFString should not be enumerated
+
+ JSValueRef argumentsArrayValues[] = { JSValueMakeNumber(context, 10), JSValueMakeNumber(context, 20) };
+ o = JSObjectMakeArray(context, sizeof(argumentsArrayValues) / sizeof(JSValueRef), argumentsArrayValues, NULL);
+ string = JSStringCreateWithUTF8CString("length");
+ v = JSObjectGetProperty(context, o, string, NULL);
+ assertEqualsAsNumber(v, 2);
+ v = JSObjectGetPropertyAtIndex(context, o, 0, NULL);
+ assertEqualsAsNumber(v, 10);
+ v = JSObjectGetPropertyAtIndex(context, o, 1, NULL);
+ assertEqualsAsNumber(v, 20);
+
+ o = JSObjectMakeArray(context, 0, NULL, NULL);
+ v = JSObjectGetProperty(context, o, string, NULL);
+ assertEqualsAsNumber(v, 0);
+ JSStringRelease(string);
+
+ JSValueRef argumentsDateValues[] = { JSValueMakeNumber(context, 0) };
+ o = JSObjectMakeDate(context, 1, argumentsDateValues, NULL);
+ if (timeZoneIsPST())
+ assertEqualsAsUTF8String(o, "Wed Dec 31 1969 16:00:00 GMT-0800 (PST)");
+
+ string = JSStringCreateWithUTF8CString("an error message");
+ JSValueRef argumentsErrorValues[] = { JSValueMakeString(context, string) };
+ o = JSObjectMakeError(context, 1, argumentsErrorValues, NULL);
+ assertEqualsAsUTF8String(o, "Error: an error message");
+ JSStringRelease(string);
+
+ string = JSStringCreateWithUTF8CString("foo");
+ JSStringRef string2 = JSStringCreateWithUTF8CString("gi");
+ JSValueRef argumentsRegExpValues[] = { JSValueMakeString(context, string), JSValueMakeString(context, string2) };
+ o = JSObjectMakeRegExp(context, 2, argumentsRegExpValues, NULL);
+ assertEqualsAsUTF8String(o, "/foo/gi");
+ JSStringRelease(string);
+ JSStringRelease(string2);
+
+ JSClassDefinition nullDefinition = kJSClassDefinitionEmpty;
+ nullDefinition.attributes = kJSClassAttributeNoAutomaticPrototype;
+ JSClassRef nullClass = JSClassCreate(&nullDefinition);
+ JSClassRelease(nullClass);
+
+ nullDefinition = kJSClassDefinitionEmpty;
+ nullClass = JSClassCreate(&nullDefinition);
+ JSClassRelease(nullClass);
+
+ functionBody = JSStringCreateWithUTF8CString("return this;");
+ function = JSObjectMakeFunction(context, NULL, 0, NULL, functionBody, NULL, 1, NULL);
+ JSStringRelease(functionBody);
+ v = JSObjectCallAsFunction(context, function, NULL, 0, NULL, NULL);
+ ASSERT(JSValueIsEqual(context, v, globalObject, NULL));
+ v = JSObjectCallAsFunction(context, function, o, 0, NULL, NULL);
+ ASSERT(JSValueIsEqual(context, v, o, NULL));
+
+ functionBody = JSStringCreateWithUTF8CString("return eval(\"this\");");
+ function = JSObjectMakeFunction(context, NULL, 0, NULL, functionBody, NULL, 1, NULL);
+ JSStringRelease(functionBody);
+ v = JSObjectCallAsFunction(context, function, NULL, 0, NULL, NULL);
+ ASSERT(JSValueIsEqual(context, v, globalObject, NULL));
+ v = JSObjectCallAsFunction(context, function, o, 0, NULL, NULL);
+ ASSERT(JSValueIsEqual(context, v, o, NULL));
+
+ JSStringRef script = JSStringCreateWithUTF8CString("this;");
+ v = JSEvaluateScript(context, script, NULL, NULL, 1, NULL);
+ ASSERT(JSValueIsEqual(context, v, globalObject, NULL));
+ v = JSEvaluateScript(context, script, o, NULL, 1, NULL);
+ ASSERT(JSValueIsEqual(context, v, o, NULL));
+ JSStringRelease(script);
+
+ script = JSStringCreateWithUTF8CString("eval(this);");
+ v = JSEvaluateScript(context, script, NULL, NULL, 1, NULL);
+ ASSERT(JSValueIsEqual(context, v, globalObject, NULL));
+ v = JSEvaluateScript(context, script, o, NULL, 1, NULL);
+ ASSERT(JSValueIsEqual(context, v, o, NULL));
+ JSStringRelease(script);
+
+ // Verify that creating a constructor for a class with no static functions does not trigger
+ // an assert inside putDirect or lead to a crash during GC. <https://bugs.webkit.org/show_bug.cgi?id=25785>
+ nullDefinition = kJSClassDefinitionEmpty;
+ nullClass = JSClassCreate(&nullDefinition);
+ myConstructor = JSObjectMakeConstructor(context, nullClass, 0);
+ JSClassRelease(nullClass);
+
+ char* scriptUTF8 = createStringWithContentsOfFile(scriptPath);
+ if (!scriptUTF8) {
+ printf("FAIL: Test script could not be loaded.\n");
+ failed = 1;
+ } else {
+ script = JSStringCreateWithUTF8CString(scriptUTF8);
+ result = JSEvaluateScript(context, script, NULL, NULL, 1, &exception);
+ if (result && JSValueIsUndefined(context, result))
+ printf("PASS: Test script executed successfully.\n");
+ else {
+ printf("FAIL: Test script returned unexpected value:\n");
+ JSStringRef exceptionIString = JSValueToStringCopy(context, exception, NULL);
+ CFStringRef exceptionCF = JSStringCopyCFString(kCFAllocatorDefault, exceptionIString);
+ CFShow(exceptionCF);
+ CFRelease(exceptionCF);
+ JSStringRelease(exceptionIString);
+ failed = 1;
+ }
+ JSStringRelease(script);
+ free(scriptUTF8);
+ }
+
+ // Clear out local variables pointing at JSObjectRefs to allow their values to be collected
+ function = NULL;
+ v = NULL;
+ o = NULL;
+ globalObject = NULL;
+ myConstructor = NULL;
+
+ JSStringRelease(jsEmptyIString);
+ JSStringRelease(jsOneIString);
+ JSStringRelease(jsCFIString);
+ JSStringRelease(jsCFEmptyIString);
+ JSStringRelease(jsCFIStringWithCharacters);
+ JSStringRelease(jsCFEmptyIStringWithCharacters);
+ JSStringRelease(goodSyntax);
+ JSStringRelease(badSyntax);
+
+ JSGlobalContextRelease(context);
+ JSClassRelease(globalObjectClass);
+
+ // Test for an infinite prototype chain that used to be created. This test
+ // passes if the call to JSObjectHasProperty() does not hang.
+
+ JSClassDefinition prototypeLoopClassDefinition = kJSClassDefinitionEmpty;
+ prototypeLoopClassDefinition.staticFunctions = globalObject_staticFunctions;
+ JSClassRef prototypeLoopClass = JSClassCreate(&prototypeLoopClassDefinition);
+ JSGlobalContextRef prototypeLoopContext = JSGlobalContextCreateInGroup(NULL, prototypeLoopClass);
+
+ JSStringRef nameProperty = JSStringCreateWithUTF8CString("name");
+ JSObjectHasProperty(prototypeLoopContext, JSContextGetGlobalObject(prototypeLoopContext), nameProperty);
+
+ JSGlobalContextRelease(prototypeLoopContext);
+ JSClassRelease(prototypeLoopClass);
+
+ printf("PASS: Infinite prototype chain does not occur.\n");
+
+ if (checkForCycleInPrototypeChain())
+ printf("PASS: A cycle in a prototype chain can't be created.\n");
+ else {
+ printf("FAIL: A cycle in a prototype chain can be created.\n");
+ failed = true;
+ }
+
+ if (failed) {
+ printf("FAIL: Some tests failed.\n");
+ return 1;
+ }
+
+ printf("PASS: Program exited normally.\n");
+ return 0;
+}
+
+static char* createStringWithContentsOfFile(const char* fileName)
+{
+ char* buffer;
+
+ size_t buffer_size = 0;
+ size_t buffer_capacity = 1024;
+ buffer = (char*)malloc(buffer_capacity);
+
+ FILE* f = fopen(fileName, "r");
+ if (!f) {
+ fprintf(stderr, "Could not open file: %s\n", fileName);
+ return 0;
+ }
+
+ while (!feof(f) && !ferror(f)) {
+ buffer_size += fread(buffer + buffer_size, 1, buffer_capacity - buffer_size, f);
+ if (buffer_size == buffer_capacity) { // guarantees space for trailing '\0'
+ buffer_capacity *= 2;
+ buffer = (char*)realloc(buffer, buffer_capacity);
+ ASSERT(buffer);
+ }
+
+ ASSERT(buffer_size < buffer_capacity);
+ }
+ fclose(f);
+ buffer[buffer_size] = '\0';
+
+ return buffer;
+}
diff --git a/Source/JavaScriptCore/API/tests/testapi.js b/Source/JavaScriptCore/API/tests/testapi.js
new file mode 100644
index 0000000..15c9e50
--- /dev/null
+++ b/Source/JavaScriptCore/API/tests/testapi.js
@@ -0,0 +1,251 @@
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+function bludgeonArguments() { if (0) arguments; return function g() {} }
+h = bludgeonArguments();
+gc();
+
+var failed = false;
+function pass(msg)
+{
+ print("PASS: " + msg, "green");
+}
+
+function fail(msg)
+{
+ print("FAIL: " + msg, "red");
+ failed = true;
+}
+
+function shouldBe(a, b)
+{
+ var evalA;
+ try {
+ evalA = eval(a);
+ } catch(e) {
+ evalA = e;
+ }
+
+ if (evalA == b || isNaN(evalA) && typeof evalA == 'number' && isNaN(b) && typeof b == 'number')
+ pass(a + " should be " + b + " and is.");
+ else
+ fail(a + " should be " + b + " but instead is " + evalA + ".");
+}
+
+function shouldThrow(a)
+{
+ var evalA;
+ try {
+ eval(a);
+ } catch(e) {
+ pass(a + " threw: " + e);
+ return;
+ }
+
+ fail(a + " did not throw an exception.");
+}
+
+function globalStaticFunction()
+{
+ return 4;
+}
+
+shouldBe("globalStaticValue", 3);
+shouldBe("globalStaticFunction()", 4);
+
+shouldBe("typeof MyObject", "function"); // our object implements 'call'
+MyObject.cantFind = 1;
+shouldBe("MyObject.cantFind", undefined);
+MyObject.regularType = 1;
+shouldBe("MyObject.regularType", 1);
+MyObject.alwaysOne = 2;
+shouldBe("MyObject.alwaysOne", 1);
+MyObject.cantDelete = 1;
+delete MyObject.cantDelete;
+shouldBe("MyObject.cantDelete", 1);
+shouldBe("delete MyObject.throwOnDelete", "an exception");
+MyObject.cantSet = 1;
+shouldBe("MyObject.cantSet", undefined);
+shouldBe("MyObject.throwOnGet", "an exception");
+shouldBe("MyObject.throwOnSet = 5", "an exception");
+shouldBe("MyObject('throwOnCall')", "an exception");
+shouldBe("new MyObject('throwOnConstruct')", "an exception");
+shouldBe("'throwOnHasInstance' instanceof MyObject", "an exception");
+
+var foundMyPropertyName = false;
+var foundRegularType = false;
+for (var p in MyObject) {
+ if (p == "myPropertyName")
+ foundMyPropertyName = true;
+ if (p == "regularType")
+ foundRegularType = true;
+}
+
+if (foundMyPropertyName)
+ pass("MyObject.myPropertyName was enumerated");
+else
+ fail("MyObject.myPropertyName was not enumerated");
+
+if (foundRegularType)
+ pass("MyObject.regularType was enumerated");
+else
+ fail("MyObject.regularType was not enumerated");
+
+var alwaysOneDescriptor = Object.getOwnPropertyDescriptor(MyObject, "alwaysOne");
+shouldBe('typeof alwaysOneDescriptor', "object");
+shouldBe('alwaysOneDescriptor.value', MyObject.alwaysOne);
+shouldBe('alwaysOneDescriptor.configurable', true);
+shouldBe('alwaysOneDescriptor.enumerable', false); // Actually it is.
+var cantFindDescriptor = Object.getOwnPropertyDescriptor(MyObject, "cantFind");
+shouldBe('typeof cantFindDescriptor', "object");
+shouldBe('cantFindDescriptor.value', MyObject.cantFind);
+shouldBe('cantFindDescriptor.configurable', true);
+shouldBe('cantFindDescriptor.enumerable', false);
+try {
+ // If getOwnPropertyDescriptor() returned an access descriptor, this wouldn't throw.
+ Object.getOwnPropertyDescriptor(MyObject, "throwOnGet");
+} catch (e) {
+ pass("getting property descriptor of throwOnGet threw exception");
+}
+var myPropertyNameDescriptor = Object.getOwnPropertyDescriptor(MyObject, "myPropertyName");
+shouldBe('typeof myPropertyNameDescriptor', "object");
+shouldBe('myPropertyNameDescriptor.value', MyObject.myPropertyName);
+shouldBe('myPropertyNameDescriptor.configurable', true);
+shouldBe('myPropertyNameDescriptor.enumerable', false); // Actually it is.
+try {
+ // if getOwnPropertyDescriptor() returned an access descriptor, this wouldn't throw.
+ Object.getOwnPropertyDescriptor(MyObject, "hasPropertyLie");
+} catch (e) {
+ pass("getting property descriptor of hasPropertyLie threw exception");
+}
+shouldBe('Object.getOwnPropertyDescriptor(MyObject, "doesNotExist")', undefined);
+
+myObject = new MyObject();
+
+shouldBe("delete MyObject.regularType", true);
+shouldBe("MyObject.regularType", undefined);
+shouldBe("MyObject(0)", 1);
+shouldBe("MyObject()", undefined);
+shouldBe("typeof myObject", "object");
+shouldBe("MyObject ? 1 : 0", true); // toBoolean
+shouldBe("+MyObject", 1); // toNumber
+shouldBe("(MyObject.toString())", "[object MyObject]"); // toString
+shouldBe("String(MyObject)", "MyObjectAsString"); // type conversion to string
+shouldBe("MyObject - 0", 1); // toNumber
+
+shouldBe("typeof MyConstructor", "object");
+constructedObject = new MyConstructor(1);
+shouldBe("typeof constructedObject", "object");
+shouldBe("constructedObject.value", 1);
+shouldBe("myObject instanceof MyObject", true);
+shouldBe("(new Object()) instanceof MyObject", false);
+
+shouldThrow("MyObject.nullGetSet = 1");
+shouldThrow("MyObject.nullGetSet");
+shouldThrow("MyObject.nullCall()");
+shouldThrow("MyObject.hasPropertyLie");
+
+derived = new Derived();
+
+shouldBe("derived instanceof Derived", true);
+shouldBe("derived instanceof Base", true);
+
+// base properties and functions return 1 when called/gotten; derived, 2
+shouldBe("derived.baseProtoDup()", 2);
+shouldBe("derived.baseProto()", 1);
+shouldBe("derived.baseDup", 2);
+shouldBe("derived.baseOnly", 1);
+shouldBe("derived.protoOnly()", 2);
+shouldBe("derived.protoDup", 2);
+shouldBe("derived.derivedOnly", 2)
+
+// base properties throw 1 when set; derived, 2
+shouldBe("derived.baseDup = 0", 2);
+shouldBe("derived.baseOnly = 0", 1);
+shouldBe("derived.derivedOnly = 0", 2)
+shouldBe("derived.protoDup = 0", 2);
+
+derived2 = new Derived2();
+
+shouldBe("derived2 instanceof Derived2", true);
+shouldBe("derived2 instanceof Derived", true);
+shouldBe("derived2 instanceof Base", true);
+
+// base properties and functions return 1 when called/gotten; derived, 2
+shouldBe("derived2.baseProtoDup()", 2);
+shouldBe("derived2.baseProto()", 1);
+shouldBe("derived2.baseDup", 2);
+shouldBe("derived2.baseOnly", 1);
+shouldBe("derived2.protoOnly()", 2);
+shouldBe("derived2.protoDup", 2);
+shouldBe("derived2.derivedOnly", 2)
+
+// base properties throw 1 when set; derived, 2
+shouldBe("derived2.baseDup = 0", 2);
+shouldBe("derived2.baseOnly = 0", 1);
+shouldBe("derived2.derivedOnly = 0", 2)
+shouldBe("derived2.protoDup = 0", 2);
+
+shouldBe('Object.getOwnPropertyDescriptor(derived, "baseProto")', undefined);
+shouldBe('Object.getOwnPropertyDescriptor(derived, "baseProtoDup")', undefined);
+var baseDupDescriptor = Object.getOwnPropertyDescriptor(derived, "baseDup");
+shouldBe('typeof baseDupDescriptor', "object");
+shouldBe('baseDupDescriptor.value', derived.baseDup);
+shouldBe('baseDupDescriptor.configurable', true);
+shouldBe('baseDupDescriptor.enumerable', false);
+var baseOnlyDescriptor = Object.getOwnPropertyDescriptor(derived, "baseOnly");
+shouldBe('typeof baseOnlyDescriptor', "object");
+shouldBe('baseOnlyDescriptor.value', derived.baseOnly);
+shouldBe('baseOnlyDescriptor.configurable', true);
+shouldBe('baseOnlyDescriptor.enumerable', false);
+shouldBe('Object.getOwnPropertyDescriptor(derived, "protoOnly")', undefined);
+var protoDupDescriptor = Object.getOwnPropertyDescriptor(derived, "protoDup");
+shouldBe('typeof protoDupDescriptor', "object");
+shouldBe('protoDupDescriptor.value', derived.protoDup);
+shouldBe('protoDupDescriptor.configurable', true);
+shouldBe('protoDupDescriptor.enumerable', false);
+var derivedOnlyDescriptor = Object.getOwnPropertyDescriptor(derived, "derivedOnly");
+shouldBe('typeof derivedOnlyDescriptor', "object");
+shouldBe('derivedOnlyDescriptor.value', derived.derivedOnly);
+shouldBe('derivedOnlyDescriptor.configurable', true);
+shouldBe('derivedOnlyDescriptor.enumerable', false);
+
+shouldBe("undefined instanceof MyObject", false);
+EvilExceptionObject.hasInstance = function f() { return f(); };
+EvilExceptionObject.__proto__ = undefined;
+shouldThrow("undefined instanceof EvilExceptionObject");
+EvilExceptionObject.hasInstance = function () { return true; };
+shouldBe("undefined instanceof EvilExceptionObject", true);
+
+EvilExceptionObject.toNumber = function f() { return f(); }
+shouldThrow("EvilExceptionObject*5");
+EvilExceptionObject.toStringExplicit = function f() { return f(); }
+shouldThrow("String(EvilExceptionObject)");
+
+shouldBe("EmptyObject", "[object CallbackObject]");
+
+if (failed)
+ throw "Some tests failed";
+
diff --git a/Source/JavaScriptCore/AUTHORS b/Source/JavaScriptCore/AUTHORS
new file mode 100644
index 0000000..e50da8c
--- /dev/null
+++ b/Source/JavaScriptCore/AUTHORS
@@ -0,0 +1,2 @@
+Harri Porten (porten@kde.org)
+Peter Kelly (pmk@post.com)
diff --git a/Source/JavaScriptCore/AllInOneFile.cpp b/Source/JavaScriptCore/AllInOneFile.cpp
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Source/JavaScriptCore/AllInOneFile.cpp
diff --git a/Source/JavaScriptCore/Android.mk b/Source/JavaScriptCore/Android.mk
new file mode 100644
index 0000000..d72b686
--- /dev/null
+++ b/Source/JavaScriptCore/Android.mk
@@ -0,0 +1,253 @@
+##
+## Copyright 2009, The Android Open Source Project
+##
+## Redistribution and use in source and binary forms, with or without
+## modification, are permitted provided that the following conditions
+## are met:
+## * Redistributions of source code must retain the above copyright
+## notice, this list of conditions and the following disclaimer.
+## * Redistributions in binary form must reproduce the above copyright
+## notice, this list of conditions and the following disclaimer in the
+## documentation and/or other materials provided with the distribution.
+##
+## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+## EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+## PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+## EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+## PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+## PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+## OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+##
+
+LOCAL_SRC_FILES := \
+ API/JSValueRef.cpp \
+ API/JSCallbackObject.cpp \
+ API/OpaqueJSString.cpp \
+ \
+ assembler/ARMv7Assembler.cpp \
+ \
+ bytecode/CodeBlock.cpp \
+ bytecode/JumpTable.cpp \
+ bytecode/Opcode.cpp \
+ bytecode/SamplingTool.cpp \
+ bytecode/StructureStubInfo.cpp \
+ \
+ bytecompiler/BytecodeGenerator.cpp \
+ bytecompiler/NodesCodegen.cpp \
+ \
+ debugger/Debugger.cpp \
+ debugger/DebuggerActivation.cpp \
+ debugger/DebuggerCallFrame.cpp \
+ \
+ interpreter/CallFrame.cpp \
+ interpreter/Interpreter.cpp \
+ interpreter/RegisterFile.cpp \
+ \
+ jit/ExecutableAllocator.cpp\
+ jit/ExecutableAllocatorFixedVMPool.cpp \
+ jit/JIT.cpp \
+ jit/JITArithmetic.cpp \
+ jit/JITArithmetic32_64.cpp \
+ jit/JITCall.cpp \
+ jit/JITCall32_64.cpp \
+ jit/JITOpcodes.cpp \
+ jit/JITPropertyAccess.cpp \
+ jit/JITStubs.cpp \
+ jit/ThunkGenerators.cpp \
+ \
+ parser/JSParser.cpp \
+ parser/Lexer.cpp \
+ parser/Nodes.cpp \
+ parser/Parser.cpp \
+ parser/ParserArena.cpp \
+ \
+ pcre/pcre_compile.cpp \
+ pcre/pcre_exec.cpp \
+ pcre/pcre_tables.cpp \
+ pcre/pcre_ucp_searchfuncs.cpp \
+ pcre/pcre_xclass.cpp \
+ \
+ profiler/Profile.cpp \
+ profiler/ProfileGenerator.cpp \
+ profiler/ProfileNode.cpp \
+ profiler/Profiler.cpp \
+ \
+ runtime/ArgList.cpp \
+ runtime/Arguments.cpp \
+ runtime/ArrayConstructor.cpp \
+ runtime/ArrayPrototype.cpp \
+ runtime/BooleanConstructor.cpp \
+ runtime/BooleanObject.cpp \
+ runtime/BooleanPrototype.cpp \
+ runtime/CallData.cpp \
+ runtime/Collector.cpp \
+ runtime/CommonIdentifiers.cpp \
+ runtime/Completion.cpp \
+ runtime/ConstructData.cpp \
+ runtime/DateConstructor.cpp \
+ runtime/DateConversion.cpp \
+ runtime/DateInstance.cpp \
+ runtime/DatePrototype.cpp \
+ runtime/Error.cpp \
+ runtime/ErrorConstructor.cpp \
+ runtime/ErrorInstance.cpp \
+ runtime/ErrorPrototype.cpp \
+ runtime/ExceptionHelpers.cpp \
+ runtime/Executable.cpp \
+ runtime/FunctionConstructor.cpp \
+ runtime/FunctionPrototype.cpp \
+ runtime/GCActivityCallback.cpp \
+ runtime/GCHandle.cpp \
+ runtime/GetterSetter.cpp \
+ runtime/GlobalEvalFunction.cpp \
+ runtime/Identifier.cpp \
+ runtime/InitializeThreading.cpp \
+ runtime/InternalFunction.cpp \
+ runtime/JSAPIValueWrapper.cpp \
+ runtime/JSActivation.cpp \
+ runtime/JSArray.cpp \
+ runtime/JSByteArray.cpp \
+ runtime/JSCell.cpp \
+ runtime/JSFunction.cpp \
+ runtime/JSGlobalData.cpp \
+ runtime/JSGlobalObject.cpp \
+ runtime/JSGlobalObjectFunctions.cpp \
+ runtime/JSImmediate.cpp \
+ runtime/JSLock.cpp \
+ runtime/JSNotAnObject.cpp \
+ runtime/JSNumberCell.cpp \
+ runtime/JSONObject.cpp \
+ runtime/JSObject.cpp \
+ runtime/JSObjectWithGlobalObject.cpp \
+ runtime/JSPropertyNameIterator.cpp \
+ runtime/JSStaticScopeObject.cpp \
+ runtime/JSString.cpp \
+ runtime/JSValue.cpp \
+ runtime/JSVariableObject.cpp \
+ runtime/JSWrapperObject.cpp \
+ runtime/LiteralParser.cpp \
+ runtime/Lookup.cpp \
+ runtime/MarkStack.cpp \
+ runtime/MarkStackPosix.cpp \
+ runtime/MathObject.cpp \
+ runtime/NativeErrorConstructor.cpp \
+ runtime/NativeErrorPrototype.cpp \
+ runtime/NumberConstructor.cpp \
+ runtime/NumberObject.cpp \
+ runtime/NumberPrototype.cpp \
+ runtime/ObjectConstructor.cpp \
+ runtime/ObjectPrototype.cpp \
+ runtime/Operations.cpp \
+ runtime/PropertyDescriptor.cpp \
+ runtime/PropertyNameArray.cpp \
+ runtime/PropertySlot.cpp \
+ runtime/PrototypeFunction.cpp \
+ runtime/RegExp.cpp \
+ runtime/RegExpCache.cpp \
+ runtime/RegExpConstructor.cpp \
+ runtime/RegExpObject.cpp \
+ runtime/RegExpPrototype.cpp \
+ runtime/RopeImpl.cpp \
+ runtime/ScopeChain.cpp \
+ runtime/SmallStrings.cpp \
+ runtime/StrictEvalActivation.cpp \
+ runtime/StringConstructor.cpp \
+ runtime/StringObject.cpp \
+ runtime/StringPrototype.cpp \
+ runtime/Structure.cpp \
+ runtime/StructureChain.cpp \
+ runtime/TimeoutChecker.cpp \
+ runtime/UString.cpp \
+ \
+ wtf/Assertions.cpp \
+ wtf/ByteArray.cpp \
+ wtf/CurrentTime.cpp \
+ wtf/DateMath.cpp \
+ wtf/DecimalNumber.cpp \
+ wtf/FastMalloc.cpp \
+ wtf/HashTable.cpp \
+ wtf/MD5.cpp \
+ wtf/MainThread.cpp \
+ wtf/OSAllocatorPosix.cpp \
+ wtf/PageAllocationAligned.cpp\
+ wtf/PageBlock.cpp\
+ wtf/RandomNumber.cpp \
+ wtf/RefCountedLeakCounter.cpp \
+ wtf/StackBounds.cpp \
+ wtf/TCSystemAlloc.cpp \
+ wtf/ThreadIdentifierDataPthreads.cpp \
+ wtf/Threading.cpp \
+ wtf/ThreadingPthreads.cpp \
+ wtf/TypeTraits.cpp \
+ wtf/WTFThreadData.cpp \
+ wtf/dtoa.cpp \
+ \
+ wtf/android/MainThreadAndroid.cpp \
+ \
+ wtf/text/AtomicString.cpp \
+ wtf/text/CString.cpp \
+ wtf/text/StringBuilder.cpp \
+ wtf/text/StringImpl.cpp \
+ wtf/text/StringStatics.cpp \
+ wtf/text/WTFString.cpp \
+ \
+ wtf/unicode/CollatorDefault.cpp \
+ wtf/unicode/UTF8.cpp \
+ \
+ wtf/unicode/icu/CollatorICU.cpp \
+ \
+<<<<<<< HEAD:JavaScriptCore/Android.mk
+ wtf/url/src/URLCharacterTypes.cpp \
+ wtf/url/src/URLEscape.cpp \
+ wtf/url/src/URLSegments.cpp \
+ \
+ yarr/RegexCompiler.cpp \
+=======
+ yarr/RegexPattern.cpp \
+>>>>>>> webkit.org at r75315:Source/JavaScriptCore/Android.mk
+ yarr/RegexInterpreter.cpp \
+ yarr/RegexJIT.cpp
+
+# generated headers
+JSC_OBJECTS := $(addprefix $(intermediates)/runtime/, \
+ ArrayPrototype.lut.h \
+ DatePrototype.lut.h \
+ JSONObject.lut.h \
+ MathObject.lut.h \
+ NumberConstructor.lut.h \
+ RegExpConstructor.lut.h \
+ RegExpObject.lut.h \
+ StringPrototype.lut.h \
+ )
+$(JSC_OBJECTS): PRIVATE_PATH := $(LOCAL_PATH)
+$(JSC_OBJECTS): PRIVATE_CUSTOM_TOOL = perl $(PRIVATE_PATH)/create_hash_table $< -i > $@
+$(JSC_OBJECTS): $(LOCAL_PATH)/create_hash_table
+$(JSC_OBJECTS): $(intermediates)/%.lut.h : $(LOCAL_PATH)/%.cpp
+ $(transform-generated-source)
+
+
+LEXER_HEADER := $(intermediates)/Lexer.lut.h
+$(LEXER_HEADER): PRIVATE_PATH := $(LOCAL_PATH)
+$(LEXER_HEADER): PRIVATE_CUSTOM_TOOL = perl $(PRIVATE_PATH)/create_hash_table $< -i > $@
+$(LEXER_HEADER): $(LOCAL_PATH)/create_hash_table
+$(LEXER_HEADER): $(intermediates)/%.lut.h : $(LOCAL_PATH)/parser/Keywords.table
+ $(transform-generated-source)
+
+CHARTABLES := $(intermediates)/chartables.c
+$(CHARTABLES): PRIVATE_PATH := $(LOCAL_PATH)
+$(CHARTABLES): PRIVATE_CUSTOM_TOOL = perl $(PRIVATE_PATH)/pcre/dftables $@
+$(CHARTABLES): $(LOCAL_PATH)/pcre/dftables
+$(CHARTABLES): $(LOCAL_PATH)/pcre/pcre_internal.h
+ $(transform-generated-source)
+
+REGEXP_JIT_TABLES := $(intermediates)/RegExpJitTables.h
+$(REGEXP_JIT_TABLES): PRIVATE_PATH := $(LOCAL_PATH)
+$(REGEXP_JIT_TABLES): PRIVATE_CUSTOM_TOOL = python $(PRIVATE_PATH)/create_regex_tables > $@
+$(REGEXP_JIT_TABLES): $(LOCAL_PATH)/create_regex_tables
+ $(transform-generated-source)
+
+LOCAL_GENERATED_SOURCES += $(JSC_OBJECTS) $(LEXER_HEADER) $(CHARTABLES) $(REGEXP_JIT_TABLES)
diff --git a/Source/JavaScriptCore/Android.v8.wtf.mk b/Source/JavaScriptCore/Android.v8.wtf.mk
new file mode 100644
index 0000000..340ed90
--- /dev/null
+++ b/Source/JavaScriptCore/Android.v8.wtf.mk
@@ -0,0 +1,87 @@
+##
+## Copyright 2009, The Android Open Source Project
+##
+## Redistribution and use in source and binary forms, with or without
+## modification, are permitted provided that the following conditions
+## are met:
+## * Redistributions of source code must retain the above copyright
+## notice, this list of conditions and the following disclaimer.
+## * Redistributions in binary form must reproduce the above copyright
+## notice, this list of conditions and the following disclaimer in the
+## documentation and/or other materials provided with the distribution.
+##
+## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+## EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+## PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+## EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+## PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+## PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+## OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+##
+
+# wtf source files
+
+LOCAL_SRC_FILES := \
+ pcre/pcre_compile.cpp \
+ pcre/pcre_exec.cpp \
+ pcre/pcre_tables.cpp \
+ pcre/pcre_ucp_searchfuncs.cpp \
+ pcre/pcre_xclass.cpp \
+ \
+ wtf/Assertions.cpp \
+ wtf/ByteArray.cpp \
+ wtf/CurrentTime.cpp \
+ wtf/DateMath.cpp \
+ wtf/DecimalNumber.cpp \
+ wtf/FastMalloc.cpp \
+ wtf/HashTable.cpp \
+ wtf/MD5.cpp \
+ wtf/MainThread.cpp \
+ wtf/OSAllocatorPosix.cpp \
+ wtf/PageAllocationAligned.cpp \
+ wtf/PageBlock.cpp \
+ wtf/RandomNumber.cpp \
+ wtf/RefCountedLeakCounter.cpp \
+ wtf/StackBounds.cpp \
+ wtf/TCSystemAlloc.cpp \
+ wtf/ThreadIdentifierDataPthreads.cpp \
+ wtf/Threading.cpp \
+ wtf/ThreadingPthreads.cpp \
+ wtf/WTFThreadData.cpp \
+ \
+ wtf/TypeTraits.cpp \
+ wtf/dtoa.cpp \
+ \
+ wtf/android/MainThreadAndroid.cpp \
+ \
+ wtf/text/AtomicString.cpp \
+ wtf/text/CString.cpp \
+ wtf/text/StringBuilder.cpp \
+ wtf/text/StringImpl.cpp \
+ wtf/text/StringStatics.cpp \
+ wtf/text/WTFString.cpp \
+ \
+ wtf/unicode/CollatorDefault.cpp \
+ wtf/unicode/UTF8.cpp \
+ \
+ wtf/unicode/icu/CollatorICU.cpp \
+ \
+ wtf/url/src/URLCharacterTypes.cpp \
+ wtf/url/src/URLEscape.cpp \
+ wtf/url/src/URLSegments.cpp
+
+CHARTABLES := $(intermediates)/chartables.c
+$(CHARTABLES): PRIVATE_PATH := $(LOCAL_PATH)
+$(CHARTABLES): PRIVATE_CUSTOM_TOOL = perl $(PRIVATE_PATH)/pcre/dftables $@
+$(CHARTABLES): $(LOCAL_PATH)/pcre/dftables
+$(CHARTABLES): $(LOCAL_PATH)/pcre/pcre_internal.h
+ $(transform-generated-source)
+
+$(intermediates)/pcre/pcre_tables.o : $(CHARTABLES)
+
+# We do not add $(CHARTABLES) to LOCAL_GENERATED_SOURCES because the chartables.c file
+# is explicitly #included in pcre_tables.cpp.
diff --git a/Source/JavaScriptCore/CMakeLists.txt b/Source/JavaScriptCore/CMakeLists.txt
new file mode 100644
index 0000000..f8b4d1e
--- /dev/null
+++ b/Source/JavaScriptCore/CMakeLists.txt
@@ -0,0 +1,258 @@
+SET(JavaScriptCore_INCLUDE_DIRECTORIES
+ "${CMAKE_BINARY_DIR}"
+ "${JAVASCRIPTCORE_DIR}"
+ "${JAVASCRIPTCORE_DIR}/API"
+ "${JAVASCRIPTCORE_DIR}/ForwardingHeaders"
+ "${JAVASCRIPTCORE_DIR}/assembler"
+ "${JAVASCRIPTCORE_DIR}/bytecode"
+ "${JAVASCRIPTCORE_DIR}/bytecompiler"
+ "${JAVASCRIPTCORE_DIR}/debugger"
+ "${JAVASCRIPTCORE_DIR}/interpreter"
+ "${JAVASCRIPTCORE_DIR}/jit"
+ "${JAVASCRIPTCORE_DIR}/parser"
+ "${JAVASCRIPTCORE_DIR}/pcre"
+ "${JAVASCRIPTCORE_DIR}/profiler"
+ "${JAVASCRIPTCORE_DIR}/runtime"
+ "${JAVASCRIPTCORE_DIR}/yarr"
+ "${WTF_INCLUDE_DIRECTORIES}"
+ "${CMAKE_SOURCE_DIR}"
+)
+
+SET(JavaScriptCore_SOURCES
+ API/JSBase.cpp
+ API/JSCallbackConstructor.cpp
+ API/JSCallbackFunction.cpp
+ API/JSCallbackObject.cpp
+ API/JSClassRef.cpp
+ API/JSContextRef.cpp
+ API/JSObjectRef.cpp
+ API/JSProfilerPrivate.cpp
+ API/JSStringRef.cpp
+ API/JSValueRef.cpp
+ API/JSWeakObjectMapRefPrivate.cpp
+ API/OpaqueJSString.cpp
+
+ bytecode/CodeBlock.cpp
+ bytecode/JumpTable.cpp
+ bytecode/Opcode.cpp
+ bytecode/SamplingTool.cpp
+ bytecode/StructureStubInfo.cpp
+
+ bytecompiler/BytecodeGenerator.cpp
+ bytecompiler/NodesCodegen.cpp
+
+ debugger/Debugger.cpp
+ debugger/DebuggerActivation.cpp
+ debugger/DebuggerCallFrame.cpp
+
+ interpreter/CallFrame.cpp
+ interpreter/Interpreter.cpp
+ interpreter/RegisterFile.cpp
+
+ jit/ExecutableAllocator.cpp
+ jit/JITArithmetic32_64.cpp
+ jit/JITArithmetic.cpp
+ jit/JITCall32_64.cpp
+ jit/JITCall.cpp
+ jit/JIT.cpp
+ jit/JITOpcodes32_64.cpp
+ jit/JITOpcodes.cpp
+ jit/JITPropertyAccess32_64.cpp
+ jit/JITPropertyAccess.cpp
+ jit/JITStubs.cpp
+ jit/ThunkGenerators.cpp
+
+ parser/JSParser.cpp
+ parser/Lexer.cpp
+ parser/Nodes.cpp
+ parser/Parser.cpp
+ parser/ParserArena.cpp
+
+ pcre/pcre_compile.cpp
+ pcre/pcre_exec.cpp
+ pcre/pcre_tables.cpp
+ pcre/pcre_ucp_searchfuncs.cpp
+ pcre/pcre_xclass.cpp
+
+ profiler/Profile.cpp
+ profiler/ProfileGenerator.cpp
+ profiler/ProfileNode.cpp
+ profiler/Profiler.cpp
+
+ runtime/ArgList.cpp
+ runtime/Arguments.cpp
+ runtime/ArrayConstructor.cpp
+ runtime/ArrayPrototype.cpp
+ runtime/BooleanConstructor.cpp
+ runtime/BooleanObject.cpp
+ runtime/BooleanPrototype.cpp
+ runtime/CallData.cpp
+ runtime/Collector.cpp
+ runtime/CommonIdentifiers.cpp
+ runtime/Completion.cpp
+ runtime/ConstructData.cpp
+ runtime/DateConstructor.cpp
+ runtime/DateConversion.cpp
+ runtime/DateInstance.cpp
+ runtime/DatePrototype.cpp
+ runtime/Error.cpp
+ runtime/ErrorConstructor.cpp
+ runtime/ErrorInstance.cpp
+ runtime/ErrorPrototype.cpp
+ runtime/ExceptionHelpers.cpp
+ runtime/Executable.cpp
+ runtime/FunctionConstructor.cpp
+ runtime/FunctionPrototype.cpp
+ runtime/GCActivityCallback.cpp
+ runtime/GCHandle.cpp
+ runtime/GetterSetter.cpp
+ runtime/GlobalEvalFunction.cpp
+ runtime/Identifier.cpp
+ runtime/InitializeThreading.cpp
+ runtime/InternalFunction.cpp
+ runtime/JSActivation.cpp
+ runtime/JSAPIValueWrapper.cpp
+ runtime/JSArray.cpp
+ runtime/JSByteArray.cpp
+ runtime/JSCell.cpp
+ runtime/JSFunction.cpp
+ runtime/JSGlobalData.cpp
+ runtime/JSGlobalObject.cpp
+ runtime/JSGlobalObjectFunctions.cpp
+ runtime/JSImmediate.cpp
+ runtime/JSLock.cpp
+ runtime/JSNotAnObject.cpp
+ runtime/JSNumberCell.cpp
+ runtime/JSObject.cpp
+ runtime/JSObjectWithGlobalObject.cpp
+ runtime/JSONObject.cpp
+ runtime/JSPropertyNameIterator.cpp
+ runtime/JSStaticScopeObject.cpp
+ runtime/JSString.cpp
+ runtime/JSValue.cpp
+ runtime/JSVariableObject.cpp
+ runtime/JSWrapperObject.cpp
+ runtime/JSZombie.cpp
+ runtime/LiteralParser.cpp
+ runtime/Lookup.cpp
+ runtime/MarkStack.cpp
+ runtime/MathObject.cpp
+ runtime/NativeErrorConstructor.cpp
+ runtime/NativeErrorPrototype.cpp
+ runtime/NumberConstructor.cpp
+ runtime/NumberObject.cpp
+ runtime/NumberPrototype.cpp
+ runtime/ObjectConstructor.cpp
+ runtime/ObjectPrototype.cpp
+ runtime/Operations.cpp
+ runtime/PropertyDescriptor.cpp
+ runtime/PropertyNameArray.cpp
+ runtime/PropertySlot.cpp
+ runtime/PrototypeFunction.cpp
+ runtime/RegExp.cpp
+ runtime/RegExpCache.cpp
+ runtime/RegExpConstructor.cpp
+ runtime/RegExpObject.cpp
+ runtime/RegExpPrototype.cpp
+ runtime/RopeImpl.cpp
+ runtime/ScopeChain.cpp
+ runtime/SmallStrings.cpp
+ runtime/StrictEvalActivation.cpp
+ runtime/StringConstructor.cpp
+ runtime/StringObject.cpp
+ runtime/StringPrototype.cpp
+ runtime/Structure.cpp
+ runtime/StructureChain.cpp
+ runtime/TimeoutChecker.cpp
+ runtime/UString.cpp
+
+ yarr/RegexPattern.cpp
+ yarr/RegexInterpreter.cpp
+ yarr/RegexJIT.cpp
+
+ wtf/DateMath.cpp
+ wtf/PageAllocationAligned.cpp
+ wtf/PageBlock.cpp
+)
+SET(JavaScriptCore_HEADERS )
+
+SET(JavaScriptCore_LUT_FILES
+ runtime/ArrayPrototype.cpp
+ runtime/DatePrototype.cpp
+ runtime/JSONObject.cpp
+ runtime/MathObject.cpp
+ runtime/NumberConstructor.cpp
+ runtime/RegExpConstructor.cpp
+ runtime/RegExpObject.cpp
+ runtime/StringPrototype.cpp
+)
+
+SET(JavaScriptCore_LIBRARIES
+ ${WTF_LIBRARY_NAME}
+)
+
+
+# GENERATOR 1-A: LUT creator
+FOREACH (_file ${JavaScriptCore_LUT_FILES})
+ GET_FILENAME_COMPONENT(_name ${_file} NAME_WE)
+ GENERATE_HASH_LUT(${JAVASCRIPTCORE_DIR}/${_file} ${DERIVED_SOURCES_DIR}/${_name}.lut.h)
+ LIST(APPEND JavaScriptCore_HEADERS ${DERIVED_SOURCES_DIR}/${_name}.lut.h)
+ENDFOREACH ()
+
+
+# GENERATOR 1-B: particular LUT creator (for 1 file only)
+GENERATE_HASH_LUT(${JAVASCRIPTCORE_DIR}/parser/Keywords.table ${DERIVED_SOURCES_DIR}/Lexer.lut.h MAIN_DEPENDENCY)
+LIST(APPEND JavaScriptCore_HEADERS ${DERIVED_SOURCES_DIR}/Lexer.lut.h)
+
+# GENERATOR: "chartables.c": compile and execute the chartables generator (and add it to sources)
+ADD_CUSTOM_COMMAND(
+ OUTPUT ${DERIVED_SOURCES_DIR}/chartables.c
+ MAIN_DEPENDENCY ${JAVASCRIPTCORE_DIR}/pcre/dftables
+ COMMAND ${PERL_EXECUTABLE} ${JAVASCRIPTCORE_DIR}/pcre/dftables --preprocessor "${CODE_GENERATOR_PREPROCESSOR}" ${DERIVED_SOURCES_DIR}/chartables.c
+ VERBATIM)
+ADD_SOURCE_DEPENDENCIES(${JAVASCRIPTCORE_DIR}/pcre/pcre_tables.cpp ${DERIVED_SOURCES_DIR}/chartables.c)
+
+
+#GENERATOR: "RegExpJitTables.h": tables used by Yarr
+ADD_CUSTOM_COMMAND(
+ OUTPUT ${DERIVED_SOURCES_DIR}/RegExpJitTables.h
+ MAIN_DEPENDENCY ${JAVASCRIPTCORE_DIR}/create_regex_tables
+ COMMAND ${PYTHON_EXECUTABLE} ${JAVASCRIPTCORE_DIR}/create_regex_tables > ${DERIVED_SOURCES_DIR}/RegExpJitTables.h
+ VERBATIM)
+ADD_SOURCE_DEPENDENCIES(${JAVASCRIPTCORE_DIR}/yarr/RegexPattern.cpp ${DERIVED_SOURCES_DIR}/RegExpJitTables.h)
+
+
+
+IF (WTF_CPU_ARM)
+ LIST(APPEND JavaScriptCore_SOURCES
+ assembler/ARMAssembler.cpp
+ assembler/MacroAssemblerARM.cpp
+ )
+ELSEIF (WTF_CPU_MIPS)
+ELSEIF (WTF_CPU_X86)
+ELSEIF (WTF_CPU_X86_64)
+ELSE ()
+ MESSAGE(FATAL_ERROR "Unknown CPU")
+ENDIF ()
+
+
+INCLUDE_IF_EXISTS(${JAVASCRIPTCORE_DIR}/CMakeLists${PORT}.txt)
+
+
+ADD_SUBDIRECTORY(wtf)
+ADD_SUBDIRECTORY(shell)
+
+WEBKIT_WRAP_SOURCELIST(${JavaScriptCore_SOURCES})
+INCLUDE_DIRECTORIES(${JavaScriptCore_INCLUDE_DIRECTORIES})
+ADD_DEFINITIONS(-DBUILDING_JavaScriptCore)
+ADD_LIBRARY(${JavaScriptCore_LIBRARY_NAME} ${JavaScriptCore_LIBRARY_TYPE} ${JavaScriptCore_HEADERS} ${JavaScriptCore_SOURCES})
+TARGET_LINK_LIBRARIES(${JavaScriptCore_LIBRARY_NAME} ${JavaScriptCore_LIBRARIES})
+
+IF (JavaScriptCore_LINK_FLAGS)
+ ADD_TARGET_PROPERTIES(${JavaScriptCore_LIBRARY_NAME} LINK_FLAGS "${JavaScriptCore_LINK_FLAGS}")
+ENDIF ()
+
+IF (SHARED_CORE)
+ SET_TARGET_PROPERTIES(${JavaScriptCore_LIBRARY_NAME} PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR})
+ INSTALL(TARGETS ${JavaScriptCore_LIBRARY_NAME} DESTINATION lib)
+ENDIF ()
diff --git a/Source/JavaScriptCore/CMakeListsEfl.txt b/Source/JavaScriptCore/CMakeListsEfl.txt
new file mode 100644
index 0000000..9d3c71e
--- /dev/null
+++ b/Source/JavaScriptCore/CMakeListsEfl.txt
@@ -0,0 +1,20 @@
+LIST(APPEND JavaScriptCore_SOURCES
+ jit/ExecutableAllocatorFixedVMPool.cpp
+ jit/ExecutableAllocator.cpp
+ runtime/MarkStackPosix.cpp
+ wtf/OSAllocatorPosix.cpp
+)
+
+LIST(APPEND JavaScriptCore_LIBRARIES
+ ${ICU_I18N_LIBRARIES}
+)
+
+IF (ENABLE_GLIB_SUPPORT)
+ LIST(APPEND JavaScriptCore_INCLUDE_DIRECTORIES
+ ${JAVASCRIPTCORE_DIR}/wtf/gobject
+ )
+ENDIF ()
+
+LIST(APPEND JavaScriptCore_LINK_FLAGS
+ ${ECORE_LDFLAGS}
+)
diff --git a/Source/JavaScriptCore/CMakeListsWinCE.txt b/Source/JavaScriptCore/CMakeListsWinCE.txt
new file mode 100644
index 0000000..666b1c7
--- /dev/null
+++ b/Source/JavaScriptCore/CMakeListsWinCE.txt
@@ -0,0 +1,5 @@
+LIST(APPEND JavaScriptCore_SOURCES
+ jit/ExecutableAllocator.cpp
+
+ runtime/MarkStackWin.cpp
+)
diff --git a/Source/JavaScriptCore/COPYING.LIB b/Source/JavaScriptCore/COPYING.LIB
new file mode 100644
index 0000000..87c4a33
--- /dev/null
+++ b/Source/JavaScriptCore/COPYING.LIB
@@ -0,0 +1,488 @@
+
+
+NOTE! The LGPL below is copyrighted by the Free Software Foundation, but
+the instance of code that it refers to (the kde libraries) are copyrighted
+by the authors who actually wrote it.
+
+---------------------------------------------------------------------------
+ GNU LIBRARY GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1991 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor
+ Boston, MA 02110-1301, USA.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the library GPL. It is
+ numbered 2 because it goes with version 2 of the ordinary GPL.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Library General Public License, applies to some
+specially designated Free Software Foundation software, and to any
+other libraries whose authors decide to use it. You can use it for
+your libraries, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if
+you distribute copies of the library, or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link a program with the library, you must provide
+complete object files to the recipients so that they can relink them
+with the library, after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ Our method of protecting your rights has two steps: (1) copyright
+the library, and (2) offer you this license which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ Also, for each distributor's protection, we want to make certain
+that everyone understands that there is no warranty for this free
+library. If the library is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original
+version, so that any problems introduced by others will not reflect on
+the original authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that companies distributing free
+software will individually obtain patent licenses, thus in effect
+transforming the program into proprietary software. To prevent this,
+we have made it clear that any patent must be licensed for everyone's
+free use or not licensed at all.
+
+ Most GNU software, including some libraries, is covered by the ordinary
+GNU General Public License, which was designed for utility programs. This
+license, the GNU Library General Public License, applies to certain
+designated libraries. This license is quite different from the ordinary
+one; be sure to read it in full, and don't assume that anything in it is
+the same as in the ordinary license.
+
+ The reason we have a separate public license for some libraries is that
+they blur the distinction we usually make between modifying or adding to a
+program and simply using it. Linking a program with a library, without
+changing the library, is in some sense simply using the library, and is
+analogous to running a utility program or application program. However, in
+a textual and legal sense, the linked executable is a combined work, a
+derivative of the original library, and the ordinary General Public License
+treats it as such.
+
+ Because of this blurred distinction, using the ordinary General
+Public License for libraries did not effectively promote software
+sharing, because most developers did not use the libraries. We
+concluded that weaker conditions might promote sharing better.
+
+ However, unrestricted linking of non-free programs would deprive the
+users of those programs of all benefit from the free status of the
+libraries themselves. This Library General Public License is intended to
+permit developers of non-free programs to use free libraries, while
+preserving your freedom as a user of such programs to change the free
+libraries that are incorporated in them. (We have not seen how to achieve
+this as regards changes in header files, but we have achieved it as regards
+changes in the actual functions of the Library.) The hope is that this
+will lead to faster development of free libraries.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, while the latter only
+works together with the library.
+
+ Note that it is possible for a library to be covered by the ordinary
+General Public License rather than by this special one.
+
+ GNU LIBRARY GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library which
+contains a notice placed by the copyright holder or other authorized
+party saying it may be distributed under the terms of this Library
+General Public License (also called "this License"). Each licensee is
+addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+ 6. As an exception to the Sections above, you may also compile or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ c) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ d) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the source code distributed need not include anything that is normally
+distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+ 9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded. In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Library General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+ NO WARRANTY
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+ How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library. It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the library's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+ <signature of Ty Coon>, 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog
new file mode 100644
index 0000000..54ac1e9
--- /dev/null
+++ b/Source/JavaScriptCore/ChangeLog
@@ -0,0 +1,18229 @@
+2011-01-07 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Bug 26276 - Need a mechanism to determine stack extent on WINDOWS, SOLARIS, OPENBSD, SYMBIAN, HAIKU, WINCE platforms
+
+ Fix for win32. The base of the stack is stored in the "deallocation stack" field of the
+ Thread Information Block - see: http://en.wikipedia.org/wiki/Win32_Thread_Information_Block
+ for more information!
+
+ * wtf/StackBounds.cpp:
+ (WTF::StackBounds::initialize):
+
+2011-01-07 Adam Roben <aroben@apple.com>
+
+ Update react-to-vsprops-changes.py after r74855
+
+ * JavaScriptCore.vcproj/JavaScriptCore/react-to-vsprops-changes.py:
+
+2011-01-07 Carlos Garcia Campos <cgarcia@igalia.com>
+
+ Reviewed by Martin Robinson.
+
+ [GTK] Port scrollbar painting to GtkStyleContext
+ https://bugs.webkit.org/show_bug.cgi?id=52051
+
+ * wtf/gobject/GTypedefs.h: Add GtkStyleContext forward
+ declaration.
+
+2011-01-07 Daniel Bates <dbates@rim.com>
+
+ Reviewed by Martin Robinson.
+
+ Enable PCRE computed gotos when compiling with RCVT 4.0 or greater in GNU mode
+ https://bugs.webkit.org/show_bug.cgi?id=52034
+
+ Derived from a patch by Eli Fidler.
+
+ RVCT 4 or greater in GNU mode supports the computed goto GNU language extension
+ as per <http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0348c/ch03s07s12.html>.
+
+ * pcre/pcre_exec.cpp: Modified to check for feature, HAVE(COMPUTED_GOTO), instead
+ of hardcoding the GCC compiler.
+ * wtf/Platform.h: Define WTF_COMPILER_RVCT4_OR_GREATER if __ARMCC_VERSION >= 400000.
+
+2011-01-06 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Bug 52035 - Unregistering DOMWrapperWorlds is unsafe
+
+ The method DOMWrapperWorld::unregisterWorld() effectively calls the DOMWrapperWorld's
+ destructor early, in order to release wrappers once we know we no longer intend to use them.
+ Whilst it is okay to have a method to throw away wrappers (assuming we know we're willing to
+ lose any state stored on them) it is not okay to deregister the world from the JSGlobalData.
+ A sequence of events that triggers the bug would look like this:
+
+ (1) Create a DOMWrapperWorld.
+ (2) Register a timer in the world.
+ (3) Call unregisterWorld() on the world.
+ (4) Timer goes off, code is executed in the world, creates a Node not attached to a Document.
+ (5) We attempt to lookup a wrapper map for the world on the JSGlobalData, but because we've
+ called forgetWorld() none exists.
+ (6) Attempt to add a wrapper to a NULL map.
+
+ Fix the problem by not removing the JSGlobalData's wrapper map until the world really goes away.
+
+ * runtime/WeakGCMap.h:
+ (JSC::WeakGCMap::clear):
+
+2011-01-06 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Bug 52021 - zeroDouble broken on ARMv7
+
+ The bug here is that zeroDouble was working incorrectly,
+ leading to op_loop_if_true failing - specifically in the
+ case where the value being checked is 0.0 encoded as a
+ double (rather than an integer immediate).
+
+ Additionally this patch removes a redundant duplicate compare
+ in some (many) case.
+
+ * assembler/ARMv7Assembler.h:
+ (JSC::ARMv7Assembler::vcmp_F64):
+ (JSC::ARMv7Assembler::vcmpz_F64):
+ * assembler/MacroAssemblerARM.h:
+ (JSC::MacroAssemblerARM::branchDoubleNonZero):
+ (JSC::MacroAssemblerARM::branchDoubleZeroOrNaN):
+ * assembler/MacroAssemblerARMv7.h:
+ (JSC::MacroAssemblerARMv7::branchDouble):
+ (JSC::MacroAssemblerARMv7::branchDoubleNonZero):
+ (JSC::MacroAssemblerARMv7::branchDoubleZeroOrNaN):
+ (JSC::MacroAssemblerARMv7::compare32):
+ * assembler/MacroAssemblerMIPS.h:
+ (JSC::MacroAssemblerMIPS::branchDoubleNonZero):
+ (JSC::MacroAssemblerMIPS::branchDoubleZeroOrNaN):
+ * assembler/MacroAssemblerX86Common.h:
+ (JSC::MacroAssemblerX86Common::branchDoubleNonZero):
+ (JSC::MacroAssemblerX86Common::branchDoubleZeroOrNaN):
+ * jit/JITOpcodes32_64.cpp:
+ (JSC::JIT::emit_op_jfalse):
+ (JSC::JIT::emit_op_jtrue):
+
+2011-01-06 Michael Saboff <msaboff@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Added debug code to compare the results of JIT regexp with
+ interpreted regexp and displays discrepencies. This debug code is
+ controlled by the ENABLE_YARR_JIT_DEBUG macro in wtf/Platform.h and
+ is only valid if ENABLE_YARR_JIT is enabled.
+
+ Fixed a discovered problem in RegExp::printTraceData, changing
+ m_pattern to the getter pattern().
+ Also deleted an extraneous semicolon.
+
+ Enhancement: Add Regexp Debug Compare between JIT and Interpreter
+ https://bugs.webkit.org/show_bug.cgi?id=51834
+
+ * runtime/RegExp.cpp:
+ (JSC::RegExp::compile):
+ (JSC::RegExp::match):
+ (JSC::RegExp::printTraceData):
+ * wtf/Platform.h:
+
+2011-01-06 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ [WINCE] Remove JSC::g_stackBase
+ https://bugs.webkit.org/show_bug.cgi?id=51779
+
+ * wtf/StackBounds.cpp:
+
+2011-01-06 Joone Hur <joone.hur@collabora.co.uk>
+
+ Reviewed by Eric Seidel.
+
+ WML Parser should treat line/column number in a consistent way
+ https://bugs.webkit.org/show_bug.cgi?id=51601
+
+ Add the equality operators to TextPosition class.
+
+ * wtf/text/TextPosition.h:
+ (WTF::TextPosition::operator==): Added.
+ (WTF::TextPosition::operator!=): Added.
+ (WTF::TextPosition::belowRangePosition): Use belowBase() instead of base().
+ (WTF::ZeroBasedNumber::operator==): Added.
+ (WTF::ZeroBasedNumber::operator!=): Added.
+ (WTF::OneBasedNumber::operator==): Added.
+ (WTF::OneBasedNumber::operator!=): Added.
+
+2011-01-06 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by Gavin Barraclough.
+
+ [WINCE] Determine stack extent
+ https://bugs.webkit.org/show_bug.cgi?id=26276
+
+ Scan the stack for writeable pages and use the limits.
+
+ * wtf/StackBounds.cpp:
+ (WTF::detectGrowingDownward):
+ (WTF::isPageWritable):
+ (WTF::getLowerStackBound):
+ (WTF::getUpperStackBound):
+ (WTF::StackBounds::initialize):
+
+2011-01-05 Steve Falkenburg <sfalken@apple.com>
+
+ Windows build fix.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops: Revert change to additional library search path needed to find ICU.
+
+2011-01-05 Steve Falkenburg <sfalken@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Debug and Release builds on Windows clobber each other
+ https://bugs.webkit.org/show_bug.cgi?id=49185
+
+ Changes the structure of WebKitBuild build products directory so we
+ completely separate each build configuration into independent directories.
+
+ Although we previously had per-configuration directories for obj, this change adds
+ per-configuration directories for bin, lib, obj, and include. Each configuration's
+ build products are stored within a directory inside of WebKitBuild.
+
+ Most use of $(WebKitOutputDir) in the build files has been replaced by $(ConfigurationBuildDir),
+ defined in common.vsprops to be $(WebKitOutputDir)\$(ConfigurationName).
+
+ For PGO, $(ConfigurationBuildDir) points to the same directory (Release_PGO) to allow
+ for proper operation of the instrumentation/optimization scripts.
+
+ * JavaScriptCore.vcproj/JavaScriptCore.make:
+ * JavaScriptCore.vcproj/JavaScriptCore.sln:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.vcproj:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGeneratedCommon.vsprops:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCorePGOOptimize.vsprops: Added.
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCorePostBuild.cmd:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCorePreBuild.cmd:
+ * JavaScriptCore.vcproj/JavaScriptCore/build-generated-files.sh:
+ * JavaScriptCore.vcproj/JavaScriptCore/react-to-vsprops-changes.py:
+ * JavaScriptCore.vcproj/JavaScriptCoreSubmit.sln:
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * JavaScriptCore.vcproj/WTF/WTFCommon.vsprops:
+ * JavaScriptCore.vcproj/WTF/WTFPostBuild.cmd:
+ * JavaScriptCore.vcproj/WTF/WTFPreBuild.cmd:
+ * JavaScriptCore.vcproj/jsc/jsc.vcproj:
+ * JavaScriptCore.vcproj/jsc/jscCommon.vsprops:
+ * JavaScriptCore.vcproj/jsc/jscPostBuild.cmd:
+ * JavaScriptCore.vcproj/jsc/jscPreBuild.cmd:
+ * JavaScriptCore.vcproj/testapi/testapiCommon.vsprops:
+ * JavaScriptCore.vcproj/testapi/testapiPostBuild.cmd:
+ * JavaScriptCore.vcproj/testapi/testapiPreBuild.cmd:
+
+2011-01-05 Brent Fulgham <bfulgham@webkit.org>
+
+ Unreviewed build fix.
+
+ * wtf/Encoder.h: Add <stdint.h> include for systems that
+ do not natively know about uint8_t, etc.
+
+2011-01-05 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by Andreas Kling.
+
+ [CMake] Fix the usage of SOURCE_GROUP
+ https://bugs.webkit.org/show_bug.cgi?id=51739
+
+ * CMakeLists.txt:
+
+2011-01-05 Andras Becsi <abecsi@webkit.org>
+
+ Reviewed by Csaba Osztrogonác.
+
+ [Qt][V8] Fix the build after recent changes.
+
+ * pcre/pcre.pri: Correct the path after Source was introduced.
+
+2011-01-04 Steve Falkenburg <sfalken@apple.com>
+
+ Build fix. Update path to FindSafari after source code reorganization.
+
+ * JavaScriptCore.vcproj/JavaScriptCore.sln:
+
+2011-01-04 Daniel Bates <dbates@rim.com>
+
+ Fix the Android build after changeset 74975 <http://trac.webkit.org/changeset/74975>
+ (https://bugs.webkit.org/show_bug.cgi?id=51855).
+
+ * wtf/ThreadingPthreads.cpp: Add include of PassOwnPtr.h.
+ (WTF::runThreadWithRegistration): Use -> instead of . to dereference pointer.
+
+2011-01-04 Martin Robinson <mrobinson@igalia.com>
+
+ Try to fix the EFL build.
+
+ * wtf/CMakeLists.txt: Remove PlatformRefPtr from the CMake source list.
+
+2011-01-04 James Robinson <jamesr@chromium.org>
+
+ Reviewed by Darin Adler.
+
+ StackBounds initialization in WTFThreadData should be guarded by #if USE(JSC)
+ https://bugs.webkit.org/show_bug.cgi?id=51881
+
+ The StackBounds class is only used by JavaScriptCore.
+
+ * wtf/WTFThreadData.cpp:
+ (WTF::WTFThreadData::WTFThreadData):
+ * wtf/WTFThreadData.h:
+ (WTF::WTFThreadData::resetCurrentIdentifierTable):
+
+2011-01-03 Martin Robinson <mrobinson@igalia.com>
+
+ Reviewed by Darin Adler.
+
+ Remove the last non-GObject usage of PlatformRefPtr and move the code to GRefPtr
+ https://bugs.webkit.org/show_bug.cgi?id=51846
+
+ * GNUmakefile.am: Remove PlatformRefPtr.h from the sources list.
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj: Ditto.
+ * jit/ExecutableAllocator.h: Change references to PlatformRefPtr to RefPtr.
+ (JSC::ExecutableAllocator::cacheFlush): Ditto.
+ * wtf/PlatformRefPtr.h: Removed.
+ * wtf/RandomNumber.cpp: Change references to PlatformRefPtr to RefPtr.
+ (WTF::randomNumber): Ditto.
+ * wtf/brew/RefPtrBrew.h: Ditto.
+ (WTF::refIfNotNull): Added.
+ (WTF::derefIfNotNull): Added.
+ * wtf/brew/ShellBrew.h: Change references to PlatformRefPtr to RefPtr.
+ (WTF::createRefPtrInstance): Modified to return a RefPtr.
+ * wtf/gobject/GRefPtr.cpp:
+ (WTF::refGPtr): Moved from PlatformRefPtr here.
+ (WTF::derefGPtr): Ditto.
+ * wtf/gobject/GRefPtr.h: Ditto.
+ (WTF::GRefPtr::GRefPtr): Ditto.
+ (WTF::GRefPtr::~GRefPtr): Ditto.
+ (WTF::GRefPtr::clear): Ditto.
+ (WTF::GRefPtr::isHashTableDeletedValue): Ditto.
+ (WTF::GRefPtr::get): Ditto.
+ (WTF::GRefPtr::operator*): Ditto.
+ (WTF::GRefPtr::operator->): Ditto.
+ (WTF::GRefPtr::operator!): Ditto.
+ (WTF::GRefPtr::operator UnspecifiedBoolType): Ditto.
+ (WTF::GRefPtr::hashTableDeletedValue): Ditto.
+ (WTF::::operator): Ditto.
+ (WTF::::swap): Ditto.
+ (WTF::swap): Ditto.
+ (WTF::operator==): Ditto.
+ (WTF::operator!=): Ditto.
+ (WTF::static_pointer_cast): Ditto.
+ (WTF::const_pointer_cast): Ditto.
+ (WTF::getPtr): Ditto.
+ (WTF::adoptGRef): Ditto.
+ (WTF::refGPtr): Ditto.
+ (WTF::derefGPtr): Ditto.
+
+2011-01-04 Daniel Bates <dbates@rim.com>
+
+ Reviewed by Adam Roben.
+
+ LEAK: Deallocate instance of ThreadFunctionInvocation if thread creation fails
+ https://bugs.webkit.org/show_bug.cgi?id=51860
+
+ * wtf/ThreadingWin.cpp:
+ (WTF::createThreadInternal):
+
+2011-01-04 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Ariya Hidayat.
+
+ [Qt][Symbian] Make sure that WebKit headers are included before platform headers on Symbian
+ https://bugs.webkit.org/show_bug.cgi?id=31273
+
+ On Symbian PREPEND_INCLUDEPATH is the best way to make sure that WebKit headers
+ are included before platform headers. On all other platforms continue to use
+ INCLUDEPATH (as before). This is a continuation of r65877.
+
+ No new tests as there is no new functionality.
+
+ * JavaScriptCore.pri:
+
+2011-01-04 Darin Adler <darin@apple.com>
+
+ Try to fix Windows build.
+
+ * wtf/ThreadingWin.cpp: Added include of PassOwnPtr.h. Fixed paragraphing
+ of conditional includes.
+ (WTF::wtfThreadEntryPoint): Use -> instead of . to dereference pointer.
+ (WTF::createThreadInternal): Tweaked #if to not need separate macro.
+
+2011-01-04 Daniel Bates <dbates@rim.com>
+
+ Reviewed by Adam Roben.
+
+ Extract ThreadFunctionInvocation into separate file and share between Apple Windows and Android
+ https://bugs.webkit.org/show_bug.cgi?id=51855
+
+ Both the Apple Windows and Android ports implement a similar adapter structure,
+ called ThreadFunctionInvocation and ThreadData respectively, as part of
+ their thread creation process. Instead, we should share such an adapter
+ structure and remove duplicate code.
+
+ * JavaScriptCore.gypi: Added header wtf/ThreadFunctionInvocation.h.
+ * wtf/ThreadFunctionInvocation.h: Added.
+ (WTF::ThreadFunctionInvocation::ThreadFunctionInvocation):
+ * wtf/ThreadingPthreads.cpp: Removed Android-specific structure ThreadData; Instead, use ThreadFunctionInvocation.
+ (WTF::runThreadWithRegistration):
+ (WTF::createThreadInternal):
+ * wtf/ThreadingWin.cpp: Moved structure ThreadFunctionInvocation to its own file so that
+ it can be shared with the Android implementation of createThreadInternal().
+ (WTF::wtfThreadEntryPoint): Use OwnPtr to hold passed instance of ThreadFunctionInvocation.
+
+2011-01-04 Daniel Bates <dbates@rim.com>
+
+ Reviewed by Darin Adler.
+
+ Use __builtin_expect when compiling using RVCT in GNU mode
+ https://bugs.webkit.org/show_bug.cgi?id=51866
+
+ Derived from a patch by Dave Tapuska.
+
+ * wtf/AlwaysInline.h:
+
+2011-01-03 Darin Adler <darin@apple.com>
+
+ Reviewed by Brady Eidson.
+
+ * wtf/Forward.h: Added Decoder and Encoder.
+
+2011-01-03 Brady Eidson <beidson@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Add Encode/Decode machinery Darin and I plan to work with for back/forward stuff in WebKit2.
+
+ Starting out with a pure virtual interface to be implemented in WK2, but we might change that later.
+
+ * GNUmakefile.am:
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * wtf/CMakeLists.txt:
+
+ * wtf/Decoder.h: Added.
+ * wtf/Encoder.h: Added.
+
+2011-01-03 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Unreviewed build fix.
+
+ [Qt] Add NullPtr.cpp introduced in r71155 to the Qt build system.
+
+ This fix is required for builds where HAVE(NULLPTR) is false
+ (e.g. some MSVC and Symbian builds).
+
+ * wtf/wtf.pri:
+
+2011-01-02 Dan Bernstein <mitz@apple.com>
+
+ Rubber-stamped by Simon Fraser.
+
+ <rdar://problem/8812159> Update copyright strings
+
+ * Info.plist:
+
+2011-01-02 Csaba Osztrogonác <ossy@webkit.org>
+
+ Fix GTK+ build after r74855.
+
+ Reviewed by Xan Lopez.
+
+ * GNUmakefile.am: Fix include pathes.
+
+2011-01-02 Adam Barth <abarth@webkit.org>
+
+ One more .. missing in the Qt build.
+
+ * jsc.pro:
+
+2011-01-02 Xan Lopez <xlopez@igalia.com>
+
+ Fix GTK+ build.
+
+ * GNUmakefile.am: add -I$(srcdir)/Source to the JSC cppflags so
+ that anyone can include its headers without adding the prefix
+ 'Source/'.
+
+2011-01-02 Carl Lobo <carllobo@gmail.com>
+
+ Reviewed by Adam Barth.
+
+ Fix Windows Build for non-production where VSPropsRedirectionDir is not defined.
+ https://bugs.webkit.org/show_bug.cgi?id=51797
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.vcproj/JavaScriptCore/build-generated-files.sh:
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * JavaScriptCore.vcproj/jsc/jsc.vcproj:
+ * JavaScriptCore.vcproj/testapi/testapi.vcproj:
+
+2011-01-01 Adam Barth <abarth@webkit.org>
+
+ Fix relative include paths in an attempt to fix the Qt build.
+
+ * JavaScriptCore.pri:
+ * JavaScriptCore.pro:
+
+2011-01-01 Adam Barth <abarth@webkit.org>
+
+ Another speculative build fix for GTK.
+
+ * GNUmakefile.am:
+
+2011-01-01 Adam Barth <abarth@webkit.org>
+
+ Speculative build fix for GTK. Update the paths in GNUmakefile to
+ include "Source".
+
+ * GNUmakefile.am:
+
+2011-01-01 Adam Barth <abarth@webkit.org>
+
+ Update relative paths in JavaScriptCore.gyp to account for the extra
+ level of directories.
+
+ * JavaScriptCore.gyp/JavaScriptCore.gyp:
+
+2010-12-31 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ Add a fast case for ASCII strings in HashAndUTF8CharactersTranslator::equal
+ https://bugs.webkit.org/show_bug.cgi?id=50517
+
+ This change shows about 2% performance win on the xml-parser benchmark.
+
+ * wtf/text/AtomicString.cpp:
+ (WTF::HashAndUTF8CharactersTranslator::equal):
+
+2010-12-30 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by Ariya Hidayat.
+
+ [CMake] Add WTF_HEADERS
+ https://bugs.webkit.org/show_bug.cgi?id=51741
+
+ Add the WTF headers to show them in Visual Studio.
+
+ * wtf/CMakeLists.txt:
+ * wtf/CMakeListsWinCE.txt:
+
+2010-12-30 Konstantin Tokarev <annulen@yandex.ru>
+
+ Reviewed by David Kilzer.
+
+ [Qt] Don't build wtf/TCSystemAlloc.cpp if --system-malloc option is
+ used
+ https://bugs.webkit.org/show_bug.cgi?id=51672
+
+ * wtf/wtf.pri: Replaced USE_SYSTEM_MALLOC with USE_SYSTEM_MALLOC=1
+
+2010-12-30 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ Use OS(WINDOWS) instead of COMPILER(MSVC) in FastMalloc.cpp
+ https://bugs.webkit.org/show_bug.cgi?id=51743
+
+ Most of the ifdefs belong to windows and not to the MSVC compiler.
+
+ * wtf/FastMalloc.cpp:
+
+2010-12-29 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Bug 51724 - In strict mode string literals should allow \0, but disallow \8 and \9.
+
+ * parser/Lexer.cpp:
+ (JSC::Lexer::parseString):
+
+2010-12-29 Helder Correia <helder@sencha.com>
+
+ Reviewed by Eric Seidel.
+
+ <VT> and <FF> are not valid JSON whitespace characters
+ https://bugs.webkit.org/show_bug.cgi?id=51671
+
+ Vertical Tab and Form Feed are not allowed white spaces by the JSON
+ RFC 4627: http://www.ietf.org/rfc/rfc4627.txt (2. JSON Grammar).
+
+ Tests: ietestcenter/Javascript/15.12.1.1-0-2.html
+ ietestcenter/Javascript/15.12.1.1-0-3.html
+
+ * runtime/LiteralParser.cpp:
+ (JSC::isJSONWhiteSpace):
+ (JSC::LiteralParser::Lexer::lex):
+
+2010-12-28 Helder Correia <helder@sencha.com>
+
+ Reviewed by Eric Seidel.
+
+ JSON.stringify must exist as a function taking 3 parameters
+ https://bugs.webkit.org/show_bug.cgi?id=51667
+
+ The reported function length is 1 instead.
+
+ Test: ietestcenter/Javascript/15.12.3-0-2.html
+
+ * runtime/JSONObject.cpp:
+
+2010-12-28 Helder Correia <helder@sencha.com>
+
+ Reviewed by Sam Weinig.
+
+ JSON.parse must exist as a function taking 2 parameters
+ https://bugs.webkit.org/show_bug.cgi?id=51666
+
+ Support for revivers was introduced in bug 26591, but the function
+ length has since remained unchanged.
+
+ Test: ietestcenter/Javascript/15.12.2-0-2.html
+
+ * runtime/JSONObject.cpp:
+
+2010-12-27 Jake Helfert <jake@jakeonthenet.com>
+
+ Reviewed and reworked by Darin Adler.
+
+ Building WebKit with Visual Studio 2010 fails due
+ to ambiguous assignment operator errors.
+ https://bugs.webkit.org/show_bug.cgi?id=51116
+
+ * wtf/NullPtr.h: Added a HAVE(NULLPTR) definition for use with
+ Platform.h HAVE macro, and included the Visual Studio 2010 compiler
+ as one of the ones that has nullptr.
+ * wtf/NullPtr.cpp: Updated condition to match.
+
+ * wtf/PassOwnArrayPtr.h: Don't include the operator=(nullptr_t)
+ overload if we are compiling in loose mode and the compiler has
+ nullptr, because assignment of 0 will otherwise encounter
+ ambiguitity with this overload and the overload for loose mode
+ that takes a raw pointer. The conditional can be removed when we
+ get rid of loose mode.
+ * wtf/PassOwnPtr.h: Ditto.
+
+ * wtf/PassRefPtr.h: Don't include the operator=(nullptr_t) overload
+ if the compiler has nullptr, because assignment of 0 would be
+ ambiguous with the overload that takes a raw pointer. The conditional
+ can be removed if we ever decide we no longer need to support
+ assigning 0, but might need a way to catch that usage on older compilers.
+ * wtf/RefPtr.h: Ditto.
+ * wtf/RetainPtr.h: Ditto
+
+ * JavaScriptCore.xcodeproj/project.pbxproj: Added NullPtr.cpp,
+ accidentally omitted when the file was first added.
+
+2010-12-26 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Eric Seidel.
+
+ [GTK] Add standalone target for JSC
+ https://bugs.webkit.org/show_bug.cgi?id=51607
+
+ * GNUmakefile.am: add convenience target to only build jsc and its
+ dependencies.
+
+2010-12-24 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ [WINCE] Add CPU(MIPS) detection
+ https://bugs.webkit.org/show_bug.cgi?id=51342
+
+ WinCE usually defines MIPS and _MIPS_.
+
+ * wtf/Platform.h:
+
+2010-12-23 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Rename RegexCompiler.cpp to RegexPattern.cpp.
+ Implicitly call compileRegex from RegexPattern's constructor.
+
+ * Android.mk:
+ * CMakeLists.txt:
+ * GNUmakefile.am:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.pro:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * runtime/RegExp.cpp:
+ (JSC::RegExp::compile):
+ * yarr/RegexCompiler.cpp: Removed.
+ * yarr/RegexCompiler.h: Removed.
+ * yarr/RegexInterpreter.cpp:
+ * yarr/RegexJIT.cpp:
+ * yarr/RegexPattern.cpp: Copied from JavaScriptCore/yarr/RegexCompiler.cpp.
+ (JSC::Yarr::compileRegex):
+ (JSC::Yarr::RegexPattern::RegexPattern):
+ * yarr/RegexPattern.h:
+
+2010-12-23 Patrick Gansterer <paroga@webkit.org>
+
+ Unreviewed build fix for WinCE after r74360.
+
+ Move the OS(WINDOWS) section after the OS(WINCE) section
+ and add missing argument to the getStackMax call.
+
+ * wtf/StackBounds.cpp:
+ (WTF::StackBounds::initialize):
+
+2010-12-22 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Unreviewed build fix.
+
+ [Symbian] Make sure OSAllocatorSymbian builds
+
+ This patch only addresses the build problem.
+
+ https://bugs.webkit.org/show_bug.cgi?id=51128 tracks the full
+ (re)implementation of the Symbian allocator.
+
+ * wtf/OSAllocatorSymbian.cpp:
+ (WTF::OSAllocator::reserveUncommitted):
+ (WTF::OSAllocator::reserveAndCommit):
+ (WTF::OSAllocator::commit):
+
+2010-12-22 Dan Bernstein <mitz@apple.com>
+
+ Changed WebKitTools to Tools.
+
+ * JavaScriptCore.vcproj/JavaScriptCore.sln:
+
+2010-12-22 Dan Bernstein <mitz@apple.com>
+
+ Rubber-stamped by Mark Rowe.
+
+ Changed WebKitTools to Tools in script build phases.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2010-12-22 Andrei Popescu <andreip@google.com>
+
+ Unreviewed build fix.
+
+ Fix Chromium Linux shared library build.
+ [Chromium] r74431 broke the Chromium Linux shared library build
+ https://bugs.webkit.org/show_bug.cgi?id=51462
+
+ * JavaScriptCore.gyp/JavaScriptCore.gyp:
+ * JavaScriptCore.gypi:
+
+2010-12-21 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r74462.
+ http://trac.webkit.org/changeset/74462
+ https://bugs.webkit.org/show_bug.cgi?id=51449
+
+ broke chromium win (Requested by tonyg-cr on #webkit).
+
+ * JavaScriptCore.gypi:
+
+2010-12-21 Tony Gentilcore <tonyg@chromium.org>
+
+ Unreviewed build fix.
+
+ [chromium] Build fix after r74431
+ https://bugs.webkit.org/show_bug.cgi?id=51447
+
+ * JavaScriptCore.gypi:
+
+2010-12-21 Gavin Barraclough <barraclough@apple.com>
+
+ Windows build fix.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-12-21 Gavin Barraclough <barraclough@apple.com>
+
+ Windows build fix.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-12-21 Gavin Barraclough <barraclough@apple.com>
+
+ Speculative build fix.
+
+ * jit/ExecutableAllocator.cpp:
+ (JSC::ExecutableAllocator::underMemoryPressure):
+
+2010-12-21 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 26276 - Need a mechanism to determine stack extent
+
+ This patch adds accurate stack size calculation for:
+ DARWIN, QNX, UNIX
+ We still need to fix:
+ WINDOWS, SOLARIS, OPENBSD, SYMBIAN, HAIKU, WINCE
+
+ * wtf/StackBounds.cpp:
+ (WTF::StackBounds::initialize):
+
+2010-12-21 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ <rdar://problem/8765333> CRASH running out of executable memory, loading io9.com
+ https://bugs.webkit.org/show_bug.cgi?id=51443
+
+ The problem here is that each page uses a reasonable amount of memory, (~4Mb),
+ and that when miultiple pages are open we keep all JIT code for all functions
+ in all pages alive.
+
+ Add a check to detect high memory pressure situations in the executable allocator
+ (>50% of available memory allocated), and upon a top level entry into JSC (no code
+ running on the stack) in this situation throw away all JIT code.
+
+ * JavaScriptCore.exp:
+ * debugger/Debugger.cpp:
+ (JSC::Debugger::recompileAllJSFunctions): stop passing exec to recompile.
+ * jit/ExecutableAllocator.h:
+ * jit/ExecutableAllocatorFixedVMPool.cpp:
+ (JSC::ExecutablePool::systemAlloc): Count allocations.
+ (JSC::ExecutablePool::systemRelease): Count deallocations.
+ (JSC::ExecutablePool::underMemoryPressure): Check memory pressure.
+ * jit/ExecutableAllocatorPosix.cpp:
+ (JSC::ExecutablePool::underMemoryPressure): Stub out; only meaningful with FixedVMPool.
+ * jit/ExecutableAllocatorWin.cpp:
+ (JSC::ExecutablePool::underMemoryPressure): Stub out; only meaningful with FixedVMPool.
+ * runtime/Executable.cpp:
+ (JSC::FunctionExecutable::recompile): Remove ExecState argument to recompile.
+ * runtime/Executable.h:
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::recompileAllJSFunctions): throws away all JIT code.
+ * runtime/JSGlobalData.h:
+ * runtime/JSGlobalObject.h:
+ (JSC::DynamicGlobalObjectScope::DynamicGlobalObjectScope): add check / call to throw away.
+
+2010-12-21 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ <rdar://problem/8241425> JIT executable memory excessive usage due to regex caching
+ https://bugs.webkit.org/show_bug.cgi?id=51434
+
+ Reduce the amount of memory the RegExpCache can hold on to on iOS.
+ Currently the RegExpCache can hold 256 RegExp objects. If each falls into a separate
+ ExecutablePool, with a common size of 16Kb, this means we end up holding onto 4Mb of
+ memory. Firstly, we can reduce this by simply reducing the size of the cache to 32
+ entries. Secondly, we can use a separate set of ExecutablePools for JIT code generated
+ from RegExp objects. This helps in two ways (1) it increases the probability that
+ RegExps in the cache share the same pool, and (2) it means that a RegExp can't end
+ up holding on to a large ExecutablePool containing a translation of JS code.
+ (A RegExp could end up keeping a larger RegExp alive that happened to be sharing the
+ same pool, but large RegExp patterns are less common).
+
+ * runtime/JSGlobalData.h:
+ * runtime/RegExpCache.h:
+ * yarr/RegexJIT.cpp:
+ (JSC::Yarr::RegexGenerator::compile):
+
+2010-12-21 Gavin Barraclough <barraclough@apple.com>
+
+ Windows build fix.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-12-21 Gavin Barraclough <barraclough@apple.com>
+
+ Eeeep! build fix!
+
+ * wtf/OSAllocator.h:
+ (WTF::OSAllocator::decommitAndRelease):
+
+2010-12-21 Gavin Barraclough <barraclough@apple.com>
+
+ Ooops, fixed typo in comment.
+
+ * wtf/OSAllocator.h:
+
+2010-12-21 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Gavin Barraclough & Oliver Hunt.
+
+ Added PageAllocationAligned, a cross-platform abstraction for memory allocations with arbitrary alignment requirements
+ https://bugs.webkit.org/show_bug.cgi?id=51359
+
+ I think this patch fixes <rdar://problem/8107952> [5.0.1] WER crash in
+ Heap::allocateBlock (1902752929), and some other leaks and crashes as well.
+
+ * Android.mk:
+ * CMakeLists.txt:
+ * GNUmakefile.am:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj: Updated build files.
+
+ * runtime/AlignedMemoryAllocator.h: Removed. Supplanted by
+ PageAllocationAligned.
+
+ * runtime/Collector.cpp:
+ (JSC::Heap::destroy):
+ (JSC::Heap::allocateBlock):
+ (JSC::Heap::freeBlock):
+ (JSC::Heap::addWeakGCHandle):
+ * runtime/Collector.h: Switched from AlignedMemoryAllocator to
+ PageAllocationAligned.
+
+ * runtime/GCHandle.cpp:
+ * runtime/GCHandle.h: Ditto.
+
+ * wtf/PageAllocation.h:
+ (WTF::PageAllocation::PageAllocation): Removed aligned memory allocation
+ functions. Supplanted by PageAllocationAligned.
+
+ * wtf/PageAllocationAligned.cpp: Added.
+ (WTF::PageAllocationAligned::allocate):
+ (WTF::PageAllocationAligned::deallocate):
+ * wtf/PageAllocationAligned.h: Added.
+ (WTF::PageAllocationAligned::PageAllocationAligned): New cross-platform
+ class for doing aligned memory allocation. This class properly matches
+ allocation and deallocation library calls, fixing a long-standing bug
+ in PageAllocation.
+
+ * wtf/Platform.h: Removed some defunction VM platform defines.
+
+ * wtf/wtf.pri: Updated build files.
+
+2010-12-21 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ ASSERTION FAILED: base->index() == m_codeBlock->argumentsRegister() while loading taobao.com
+ https://bugs.webkit.org/show_bug.cgi?id=49006
+
+ This problem was caused by having a parameter named 'arguments'.
+ The fix is to treat parameters named 'arguments' as shadowing
+ the actual arguments property, and so logically turn the function
+ into one that doesn't "use" arguments.
+
+ This required a bit of fiddling in the parser to ensure we correctly
+ propagate the 'feature' of shadowing is set correctly.
+
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::createArgumentsIfNecessary):
+ Change assertion to an early return as we may now reference
+ a property named 'arguments' without being in a function that
+ has the ArgumentsFeature
+ * parser/JSParser.cpp:
+ (JSC::JSParser::Scope::Scope):
+ (JSC::JSParser::Scope::declareParameter):
+ (JSC::JSParser::Scope::shadowsArguments):
+ (JSC::JSParser::parseProgram):
+ (JSC::JSParser::parseFormalParameters):
+ (JSC::JSParser::parseFunctionInfo):
+ * parser/Nodes.h:
+ (JSC::ScopeNode::usesArguments):
+
+2010-12-21 Daniel Bates <dbates@rim.com>
+
+ Reviewed by Eric Seidel and Darin Adler.
+
+ Deallocate GregorianDateTime.timeZone (if allocated) when copying so that we don't leak memory.
+ https://bugs.webkit.org/show_bug.cgi?id=51367
+
+ Inspired by a patch by George Staikos.
+
+ * wtf/DateMath.cpp:
+ (JSC::msToGregorianDateTime): Modified to set timeZone to nullptr since timeZone is now
+ of type OwnPtrArray<char>.
+ * wtf/DateMath.h: Change timeZone to type OwnArrayPtr<char>; Removed destructor since it is no longer needed.
+ (JSC::GregorianDateTime::GregorianDateTime): Modified to use OwnPtrArray semantics for timeZone.
+ (JSC::GregorianDateTime::operator tm): Ditto.
+ (JSC::GregorianDateTime::copyFrom): Ditto.
+
+2010-12-21 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r74402.
+ http://trac.webkit.org/changeset/74402
+ https://bugs.webkit.org/show_bug.cgi?id=51402
+
+ This patch broke the Windows 7 Release Layout Tests (Requested
+ by jessieberlin on #webkit).
+
+ * wtf/StackBounds.cpp:
+ (WTF::estimateStackBound):
+ (WTF::StackBounds::initialize):
+
+2010-12-21 Peter Varga <pvarga@inf.u-szeged.hu>
+
+ Reviewed by Csaba Osztrogonác.
+
+ Unify the name of parentheses in YARR: rename parenthesis to
+ parentheses.
+
+ * yarr/RegexCompiler.cpp:
+ (JSC::Yarr::RegexPatternConstructor::atomParenthesesEnd):
+
+2010-12-21 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Andreas Kling.
+
+ [Qt] Set BUILDING_QT__ consistently
+ https://bugs.webkit.org/show_bug.cgi?id=51341
+
+ * JavaScriptCore.pri: Remove the definition of BUILDING_QT__ as it
+ is already defined in WebKit.pri.
+
+2010-12-20 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 26276 - Need a mechanism to determine stack extent
+
+ This patch adds accurate stack size calculation for:
+ DARWIN, WINDOWS, QNX, UNIX
+ We still need to fix:
+ SOLARIS, OPENBSD, SYMBIAN, HAIKU, WINCE
+
+ * wtf/StackBounds.cpp:
+ (WTF::StackBounds::initialize):
+
+2010-12-20 Gavin Barraclough <barraclough@apple.com>
+
+ PPC build fix; stop using std::swap on PageAllocation/PageReservation,
+ this was failing on some compilers since the lack of default construction
+ for the m_executable/m_writable fields meant the value being swapped may
+ not have been fully initialized.
+
+ * wtf/PageAllocation.h:
+ (WTF::PageAllocation::deallocate):
+ * wtf/PageBlock.h:
+ * wtf/PageReservation.h:
+ (WTF::PageReservation::deallocate):
+
+2010-12-20 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ |delete name| in strict mode code should be an early error
+ https://bugs.webkit.org/show_bug.cgi?id=50431
+
+ Disallow the |delete IDENTIFIER| production in strict mode, and removed
+ a bunch of now unnecessary code.
+
+ * parser/JSParser.cpp:
+ (JSC::JSParser::Scope::collectFreeVariables):
+ (JSC::jsParse):
+ (JSC::JSParser::parseProgram):
+ (JSC::JSParser::parseUnaryExpression):
+ * parser/JSParser.h:
+ * parser/Parser.cpp:
+ (JSC::Parser::parse):
+ * parser/Parser.h:
+ (JSC::Parser::parse):
+
+2010-12-20 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Olver Hunt.
+
+ Bug 51358 - Should check stack depth rather than using recursion limits in byte compilation
+
+ The current implementation of recursion limit checking is not safe on smaller stacks.
+ Switch to using a common mechanism, shared with the parser, to check recursion limits.
+
+ Make bytecompiler use StackBounds. Empirical testing shows emitStrcat to have the largest
+ footprint on the stack, at just under 1k on x86-64. Given this, the default recursion
+ check (requiring 4k of available space to recurse) seems reasonable.
+
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::BytecodeGenerator):
+ * bytecompiler/BytecodeGenerator.h:
+ (JSC::BytecodeGenerator::emitNode):
+ (JSC::BytecodeGenerator::emitNodeInConditionContext):
+ * bytecompiler/NodesCodegen.cpp:
+ (JSC::BinaryOpNode::emitStrcat):
+
+2010-12-20 Tony Gentilcore <tonyg@chromium.org>
+
+ Unreviewed build fix.
+
+ Include pthread to fix chromium mac build (broken by r74360)
+ https://bugs.webkit.org/show_bug.cgi?id=51356
+
+ * wtf/StackBounds.cpp:
+
+2010-12-20 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Gustavo Noronha.
+
+ * GNUmakefile.am: add missing files.
+
+2010-12-18 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 26276 - Need a mechanism to determine stack extent
+
+ This patch adds a class 'StackBounds', to hold information about the machine stack.
+ The implementation of this class broadly adheres to the current implmentation of
+ stack limit checking, and as such does not solve the problem of determining stack
+ extent, but gives us a common place to do so.
+
+ Currently two mechanism are provided to determine the stack origin (the point the
+ stack is growing away from). currentThreadStackBase() in Collector provides a
+ more accurate determination of the stack origin, so use this to calculate
+ StackBounds::m_origin; WTFThreadData::approximatedStackStart is less accurate, and
+ as such can be removed. Cache the StackBounds on WTFThreadData such that they
+ need only be determined once per thread, and for non-API contexts cache this
+ information in JSGlobalData, to save a thread-specific access.
+
+ For the time being retain the estimate of stack size used by JSC's parser
+ (128 * sizeof(void*) * 1024), with a view to replacing this with something more
+ accurate in the near future.
+
+ * parser/JSParser.cpp:
+ (JSC::JSParser::canRecurse):
+ (JSC::JSParser::JSParser):
+ Change to use StackBounds.
+ * runtime/Collector.cpp:
+ (JSC::Heap::registerThread):
+ (JSC::Heap::markCurrentThreadConservativelyInternal):
+ Change to use StackBounds, cached on JSGlobalData.
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData):
+ * runtime/JSGlobalData.h:
+ (JSC::JSGlobalData::stack):
+ Add a cached copy of StackBounds.
+ * wtf/StackBounds.cpp: Copied from JavaScriptCore/runtime/Collector.cpp.
+ (WTF::estimateStackBound):
+ (WTF::StackBounds::initialize):
+ (WTF::getStackMax):
+ Copy code from Collector.cpp to determine stack origin.
+ * wtf/StackBounds.h: Added.
+ (WTF::StackBounds::StackBounds):
+ No argument constructor; returns a null StackBounds.
+ (WTF::StackBounds::currentThreadStackBounds):
+ Returns a StackBounds object representing the stack limits
+ of the current thread.
+ (WTF::StackBounds::origin):
+ Returns to stack origin (the point the stack is growing away
+ from; the highest extent of the stack on machines where the
+ stack grows downwards.
+ (WTF::StackBounds::recursionLimit):
+ Returns a limit value that is 'a comfortable distance from
+ the end of the stack'. Our concept of this is currently 1 page
+ away from the end, however the default value may be tuned in
+ the future, and clients may override passing a larger delta;
+ should only be called on StackBounds object representing the
+ stack of the thread this method is called on (checked by
+ checkConsistency).
+ (WTF::StackBounds::recursionCheck):
+ Checks whether we are currently 'a comfortable distance from
+ the end of the stack'. Our concept of this is currently 1 page
+ away from the end, however the default value may be tuned in
+ the future, and clients may override passing a larger delta
+ to apply when checking, if they wish to do so. This method
+ should only be called on StackBounds object representing the
+ stack of the thread this method is called on (checked by
+ checkConsistency).
+ (WTF::StackBounds::current):
+ Approximate current stack position. On machines where the stack
+ is growing downwards this is the lowest address that might need
+ conservative collection.
+ (WTF::StackBounds::isGrowingDownward):
+ True for all platforms other than WINCE, which has to check.
+ (WTF::StackBounds::checkConsistency):
+ This is called in methods that shoulds only be operating on a
+ valid set of bounds; as such we expect m_origin != m_bounds
+ (i.e. stack size != zero) - we're really testing that this
+ object is not null (the constructor initializes both fields
+ to zero). Also checks that current() is within the stack's
+ bounds.
+ * wtf/WTFThreadData.cpp:
+ (WTF::WTFThreadData::WTFThreadData):
+ * wtf/WTFThreadData.h:
+ (WTF::WTFThreadData::stack):
+ Add the StackBounds member variable.
+
+2010-12-17 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Factored common page set management into a new PageBlock base class
+ https://bugs.webkit.org/show_bug.cgi?id=51285
+
+ * Android.mk:
+ * CMakeLists.txt:
+ * GNUmakefile.am:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * interpreter/RegisterFile.h:
+ (JSC::RegisterFile::RegisterFile):
+ * jit/ExecutableAllocator.cpp:
+ (JSC::ExecutableAllocator::intializePageSize):
+ * wtf/PageAllocation.cpp: Removed.
+ * wtf/PageAllocation.h:
+ (WTF::PageAllocation::deallocate):
+ (WTF::PageAllocation::PageAllocation):
+ * wtf/PageReservation.h:
+ (WTF::PageReservation::commit):
+ (WTF::PageReservation::decommit):
+ (WTF::PageReservation::deallocate):
+ (WTF::PageReservation::PageReservation):
+ * wtf/wtf.pri:
+
+2010-12-17 Michael Saboff <msaboff@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ RegExp Jit'ed expression crashes clicking link on yelp.com
+ https://bugs.webkit.org/show_bug.cgi?id=51284
+
+ When transitioning between an non-repeating beginning of line
+ anchored expression and the remaining refactored repeating
+ expression, we should not clear any residual datalabel in
+ state's m_backtrack. It will be resolved and cleared in subsequent
+ code when linkAlternativeBacktracks() is called for the repeating
+ alternative(s).
+
+ * yarr/RegexJIT.cpp:
+ (JSC::Yarr::RegexGenerator::BacktrackDestination::clear):
+ (JSC::Yarr::RegexGenerator::TermGenerationState::clearBacktrack):
+
+2010-12-17 Dan Bernstein <mitz@apple.com>
+
+ Rubber-stamped by Mark Rowe.
+
+ Updated for the renaming of WebKitTools to Tools
+
+ * JavaScriptCore.vcproj/JavaScriptCore/build-generated-files.sh:
+
+2010-12-17 Ariya Hidayat <ariya@sencha.com>
+
+ Reviewed by Oliver Hunt.
+
+ [JSC] parseAssignmentExpression should use TreeBuilder::CreatesAST
+ https://bugs.webkit.org/show_bug.cgi?id=51268
+
+ * parser/JSParser.cpp:
+ (JSC::JSParser::parseAssignmentExpression):
+
+2010-12-17 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Removed RChunk from PageAllocation/PageReservation, since it's now unused.
+ https://bugs.webkit.org/show_bug.cgi?id=51276
+
+ * wtf/PageAllocation.h:
+ (WTF::PageAllocation::PageAllocation):
+ * wtf/PageReservation.h:
+ (WTF::PageReservation::PageReservation):
+
+2010-12-17 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Incorrect encoding of some constants in ARMv7 JIT
+ https://bugs.webkit.org/show_bug.cgi?id=51273
+ <rdar://problem/8650210>
+
+ When using immediate encoding 3 we need to write the byte
+ that holds a duplicated value.
+
+ * assembler/ARMv7Assembler.h:
+ (JSC::ARMThumbImmediate::makeEncodedImm):
+
+2010-12-16 Evan Martin <evan@chromium.org>
+
+ Reviewed by Darin Fisher.
+
+ [chromium] useless warnings when building on Windows
+ https://bugs.webkit.org/show_bug.cgi?id=50985
+
+ Disable some compiler warnings that aren't indicative of real problems.
+
+ * JavaScriptCore.gyp/JavaScriptCore.gyp:
+
+2010-12-16 Pratik Solanki <psolanki@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ https://bugs.webkit.org/show_bug.cgi?id=51166
+ ExecutableAllocator::cacheFlush should call sys_cache_control
+
+ * jit/ExecutableAllocator.h:
+ (JSC::ExecutableAllocator::cacheFlush): Use the more correct and forward looking API -
+ sys_cache_control(kCacheFunctionPrepareForExecution,...).
+
+2010-12-16 Ariya Hidayat <ariya@sencha.com>
+
+ Reviewed by Andreas Kling.
+
+ [JSC] Const correctness in ASTBuilder and SyntaxChecker
+ https://bugs.webkit.org/show_bug.cgi?id=51141
+
+ * parser/ASTBuilder.h:
+ (JSC::ASTBuilder::getName):
+ (JSC::ASTBuilder::getType):
+ (JSC::ASTBuilder::isResolve):
+ * parser/SyntaxChecker.h:
+ (JSC::SyntaxChecker::operatorStackPop):
+
+2010-12-15 Kenneth Russell <kbr@google.com>
+
+ Reviewed by James Robinson.
+
+ Web Audio API: port FFTFrame to MKL
+ https://bugs.webkit.org/show_bug.cgi?id=50986
+
+ Fixed bug in log2 emulation function provided for Windows port of
+ Web Audio API.
+
+ * wtf/MathExtras.h:
+ (log2):
+
+2010-12-14 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ <http://webkit.org/b/51064> Reproducible crash inside WebCore::MediaPlayerPrivateQTKit::createQTMovie when loading <video>
+
+ * wtf/text/WTFString.h: Prevent String from being implicitly convertable to bool.
+ It was previously implicitly convertible to bool on Mac via operator NSString*,
+ but since that always has a non-zero return value it would give unexpected results.
+
+2010-12-14 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Eric Seidel.
+
+ [Qt] [Symbian] Do not use pkg-config on Symbian as it is not supported
+ https://bugs.webkit.org/show_bug.cgi?id=50231
+
+ Guard CONFIG+=link_pkgconfig with !symbian.
+
+ * jsc.pro:
+
+2010-12-14 Cameron Zwarich <zwarich@apple.com>
+
+ Not reviewed.
+
+ Revert accidental change disabling the JIT for most platforms.
+
+ * wtf/Platform.h:
+
+2010-12-13 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Eric Seidel.
+
+ Clang fails to build the JSC interpreter
+ https://bugs.webkit.org/show_bug.cgi?id=51016
+
+ Clang does not allow indirect gotos out of scopes with cleanup. GCC 4.2 allows
+ them, but it does not correctly generate the cleanup, causing a leak if the
+ cleanup decrements a reference count.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute): Put an Identifier into its own scope.
+
+2010-12-14 Carlos Garcia Campos <cgarcia@igalia.com>
+
+ Reviewed by Martin Robinson.
+
+ [GTK] Simplify context-menu handling code
+ https://bugs.webkit.org/show_bug.cgi?id=49658
+
+ * wtf/PlatformRefPtr.h: Add leakRef()
+
+2010-12-13 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ JavaScriptCore should not use "asm volatile" outside of a function
+ https://bugs.webkit.org/show_bug.cgi?id=50991
+
+ * jit/JITStubs.cpp: Remove the volatile keyword from asm statements.
+
+2010-12-13 Steve Falkenburg <sfalken@apple.com>
+
+ Windows production build fix.
+ Try copying ICU 4.6 in addition to 4.4 and 4.2.
+
+ * JavaScriptCore.vcproj/jsc/jscPostBuild.cmd:
+
+2010-12-13 Michael Saboff <msaboff@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ REGRESSION: mobileme mail viewing is broken
+ https://bugs.webkit.org/show_bug.cgi?id=50884
+
+ Fixed problem where simple parenthesis (those without capture and
+ with a fixed count) where not propagating backtrack to labels for
+ nested parentheses. Also added the nesting level for the parentheses
+ state created in that case as well.
+
+ * yarr/RegexJIT.cpp:
+ (JSC::Yarr::RegexGenerator::BacktrackDestination::copyBacktrackToLabel):
+ (JSC::Yarr::RegexGenerator::TermGenerationState::isLastTerm):
+ (JSC::Yarr::RegexGenerator::ParenthesesTail::generateCode):
+ (JSC::Yarr::RegexGenerator::generateParenthesesSingle):
+
+2010-12-13 Peter Varga <pvarga@inf.u-szeged.hu>
+
+ Reviewed by Gavin Barraclough.
+
+ Reduce the size of the RegexStackSpaceForBackTrackInfoParentheses in YARR
+ https://bugs.webkit.org/show_bug.cgi?id=49385
+
+ Remove the BackTrackInfoParentheses struct prevBegin and prevEnd members.
+
+ * yarr/RegexInterpreter.cpp:
+ (JSC::Yarr::Interpreter::matchParentheses):
+ (JSC::Yarr::Interpreter::backtrackParentheses):
+ * yarr/RegexPattern.h:
+
+2010-12-10 Michael Saboff <msaboff@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ REGRESSION Hang inside Yarr::RegexCodeBlock::execute when visiting
+ bugs.webkit.org
+ https://bugs.webkit.org/show_bug.cgi?id=50816
+
+ First nested parentheses of the second or greater alternative
+ where backtracking to the prior parentheses. Changed the default
+ handling of initial parentheses for all alternatives to go back
+ to the immediate outer paren.
+
+ * yarr/RegexJIT.cpp:
+ (JSC::Yarr::RegexGenerator::GenerationState::addParenthesesTail):
+ (JSC::Yarr::RegexGenerator::TermGenerationState::TermGenerationState):
+ (JSC::Yarr::RegexGenerator::TermGenerationState::isLastTerm):
+ (JSC::Yarr::RegexGenerator::TermGenerationState::getTermIndex):
+ (JSC::Yarr::RegexGenerator::TermGenerationState::setParenthesesTail):
+ (JSC::Yarr::RegexGenerator::TermGenerationState::getParenthesesTail):
+ (JSC::Yarr::RegexGenerator::ParenthesesTail::ParenthesesTail):
+ (JSC::Yarr::RegexGenerator::ParenthesesTail::processBacktracks):
+ (JSC::Yarr::RegexGenerator::ParenthesesTail::generateCode):
+ (JSC::Yarr::RegexGenerator::generateParenthesesSingle):
+
+2010-12-11 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ Add an overload to makeString for Vector<char>
+ https://bugs.webkit.org/show_bug.cgi?id=50123
+
+ Also cleanup StringTypeAdapter.
+
+ * wtf/text/StringConcatenate.h:
+
+2010-12-10 Siddharth Mathur <siddharth.mathur@nokia.com>
+
+ Reviewed by Eric Seidel.
+
+ [Qt] Build fix for Symbian: don't compile POSIX memory management implementation
+ https://bugs.webkit.org/show_bug.cgi?id=50707
+
+ * wtf/wtf.pri:
+
+2010-12-10 Steve Falkenburg <sfalken@apple.com>
+
+ Windows production build fix.
+
+ Don't stop if react-to-vsprops-changes.py exits with an error,
+ since this will occur in production builds.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make:
+
+2010-12-10 Brian Weinstein <bweinstein@apple.com>
+
+ Reviewed by Adam Roben.
+
+ Turn on USE(CROSS_PLATFORM_CONTEXT_MENUS) for Windows.
+
+ * wtf/Platform.h:
+
+2010-12-10 Martin Robinson <mrobinson@igalia.com>
+
+ Unreviewed, rolling out r73703.
+ http://trac.webkit.org/changeset/73703
+ https://bugs.webkit.org/show_bug.cgi?id=49658
+
+ This patch is causing crashes on the GTK+ bots.
+
+ * wtf/PlatformRefPtr.h:
+
+2010-12-10 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ Cleanup StringWx.cpp
+ https://bugs.webkit.org/show_bug.cgi?id=50525
+
+ Use StringImpl::createUninitialized to avoid memcpy and fix style issues.
+
+ * wtf/wx/StringWx.cpp:
+ (WTF::String::String):
+
+2010-12-10 Carlos Garcia Campos <cgarcia@igalia.com>
+
+ Reviewed by Martin Robinson.
+
+ [GTK] Simplify context-menu handling code
+ https://bugs.webkit.org/show_bug.cgi?id=49658
+
+ * wtf/PlatformRefPtr.h:
+
+2010-12-09 Michael Saboff <msaboff@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ REGRESSION (r73065?): A regex no longer works
+ https://bugs.webkit.org/show_bug.cgi?id=50570
+
+ Changed the handling of adjacent parentheses backtracks in two ways.
+ First, only outer most paren backtracks default to back tracking
+ to the "next character" looping code. Second, added a jump around
+ backtracks that fall through to the next backtrack where the
+ second backtrack has some greedy processing before the backtracking
+ from outside the parentheses code.
+ Also cleaned up extraneous white spce, removing white space at the
+ end of or that makes up a whole line.
+
+ * yarr/RegexJIT.cpp:
+ (JSC::Yarr::RegexGenerator::GenerationState::GenerationState):
+ (JSC::Yarr::RegexGenerator::GenerationState::incrementParenNestingLevel):
+ (JSC::Yarr::RegexGenerator::GenerationState::decrementParenNestingLevel):
+ (JSC::Yarr::RegexGenerator::GenerationState::addParenthesesTail):
+ (JSC::Yarr::RegexGenerator::GenerationState::emitParenthesesTail):
+ (JSC::Yarr::RegexGenerator::ParenthesesTail::ParenthesesTail):
+ (JSC::Yarr::RegexGenerator::ParenthesesTail::setNextIteration):
+ (JSC::Yarr::RegexGenerator::ParenthesesTail::generateCode):
+ (JSC::Yarr::RegexGenerator::generateParenthesesSingle):
+
+2010-12-09 Michael Saboff <msaboff@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Addressed the "FIXME" issues in array sort for toString() methods that
+ mutate the array in either size or contents. The change is to mark
+ the temporary array contents so that they are not garbage collected
+ and to make sure the array is large enough to hold the contents
+ of the sorted temporary vector.
+ https://bugs.webkit.org/show_bug.cgi?id=50718
+
+ * runtime/Collector.cpp:
+ (JSC::Heap::addTempSortVector):
+ (JSC::Heap::removeTempSortVector):
+ (JSC::Heap::markTempSortVectors):
+ (JSC::Heap::markRoots):
+ * runtime/Collector.h:
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::sort):
+ * runtime/JSValue.h:
+
+2010-12-09 Michael Saboff <msaboff@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Changed setting of backtrack labels to not overwrite a prior
+ label. Where losing prior labe which then reverted back to
+ next character label.
+ https://bugs.webkit.org/show_bug.cgi?id=50579
+
+ * yarr/RegexJIT.cpp:
+ (JSC::Yarr::RegexGenerator::BacktrackDestination::setBacktrackToLabel):
+
+2010-12-08 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Permit Character Class Escape in CharacterRange in Character Class.
+ https://bugs.webkit.org/show_bug.cgi?id=50483
+ https://bugs.webkit.org/show_bug.cgi?id=50538
+ https://bugs.webkit.org/show_bug.cgi?id=50654
+ https://bugs.webkit.org/show_bug.cgi?id=50646
+
+ We recently tightened up our spec conformance in generating syntax
+ error in these cases, however testing in the wild has shown this
+ to be problematic. This reverts the previous change in allowing
+ class escapes (e.g. \d) in ranges in character classes ([]), but
+ does retain some closer conformance to the spec in only allowing
+ ranges that would be permitted per the grammar rules in the spec
+ (e.g. in /[\d-a-z]/ "a-z" cannot be considered as a range).
+
+ * yarr/RegexParser.h:
+ (JSC::Yarr::Parser::CharacterClassParserDelegate::atomPatternCharacter):
+ (JSC::Yarr::Parser::CharacterClassParserDelegate::atomBuiltInCharacterClass):
+ (JSC::Yarr::Parser::parse):
+
+2010-12-08 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Try to fix crash-on-launch seen on Windows builder.
+
+ * wtf/OSAllocatorWin.cpp:
+ (WTF::OSAllocator::release): Disabled an ASSERT, because it checks for
+ a bug that hasn't been fixed yet.
+
+2010-12-08 Geoffrey Garen <ggaren@apple.com>
+
+ Try to fix Windows build.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: Updated .def file.
+
+2010-12-08 Geoffrey Garen <ggaren@apple.com>
+
+ Try to fix Windows build.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: Updated .def
+ file to remove a symbol -- the next build failure will say which symbol
+ to add back.
+
+2010-12-08 Geoffrey Garen <ggaren@apple.com>
+
+ Try to fix Windows build.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: Updated .def file.
+
+2010-12-08 Geoffrey Garen <ggaren@apple.com>
+
+ Try to fix GTK Linux build.
+
+ * jit/ExecutableAllocator.cpp:
+ (JSC::ExecutablePool::systemAlloc):
+ * runtime/AlignedMemoryAllocator.h:
+ (JSC::::AlignedMemoryAllocator): Updated for Usage enum moving to OSAllocator.
+
+2010-12-07 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Migrated OS-specific allocation code from PageReservation and PageAllocation to OSAllocator
+ https://bugs.webkit.org/show_bug.cgi?id=50653
+
+ * JavaScriptCore.exp: Updated for new function signature.
+
+ * interpreter/RegisterFile.h:
+ (JSC::RegisterFile::RegisterFile):
+ (JSC::RegisterFile::grow):
+ * jit/ExecutableAllocatorFixedVMPool.cpp:
+ (JSC::FixedVMPoolAllocator::reuse):
+ (JSC::FixedVMPoolAllocator::FixedVMPoolAllocator): Removed checkAllocatedOkay.
+ OSAllocator is now the central location for verifying that allocation succeeds.
+ This allowed me to remove some complicating cross-platform cruft.
+
+ * runtime/AlignedMemoryAllocator.h:
+ (JSC::::allocate): Updated for code motion.
+
+ * wtf/OSAllocator.h: Added Usage, writable, and executable parameters, to
+ support VM features required by clients of PageAllocation and PageReservation.
+
+ * wtf/OSAllocatorPosix.cpp:
+ (WTF::OSAllocator::reserve):
+ (WTF::OSAllocator::reserveAndCommit):
+ (WTF::OSAllocator::commit): Moved PageAllocation support for randomizing
+ executable memory here.
+
+ * wtf/OSAllocatorSymbian.cpp:
+ (WTF::OSAllocator::reserve):
+ (WTF::OSAllocator::reserveAndCommit):
+ (WTF::OSAllocator::commit): Updated for new function signatures.
+
+ * wtf/OSAllocatorWin.cpp:
+ (WTF::protection):
+ (WTF::OSAllocator::reserve):
+ (WTF::OSAllocator::reserveAndCommit):
+ (WTF::OSAllocator::commit):
+ (WTF::OSAllocator::release): Updated for new function signatures. Moved
+ some protection-related and WINCE-related code from PageAllocation here.
+
+ * wtf/PageAllocation.cpp: Nixed cross-platform lastError abstraction, since
+ it was only used by checkAllocatedOkay, which is now gone.
+
+ * wtf/PageAllocation.h:
+ (WTF::PageAllocation::allocate):
+ (WTF::PageAllocation::allocateAligned):
+ (WTF::PageAllocation::deallocate):
+ (WTF::PageAllocation::isPowerOfTwo):
+ (WTF::PageAllocation::systemAllocateAligned): Removed system* functions,
+ and replaced calls to them with calls to OSAllocator.
+
+ * wtf/PageReservation.h:
+ (WTF::PageReservation::commit):
+ (WTF::PageReservation::decommit):
+ (WTF::PageReservation::reserve):
+ (WTF::PageReservation::deallocate):
+ (WTF::PageReservation::PageReservation): Ditto. Added m_writable and
+ m_executable because these flags are now required when committing memory.
+
+2010-12-08 Chris Rogers <crogers@google.com>
+
+ Reviewed by Kenneth Russell.
+
+ Add web audio files to mac port Xcode projects
+ https://bugs.webkit.org/show_bug.cgi?id=50721
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2010-12-08 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Marking the active global object re-enters through markConservatively
+ https://bugs.webkit.org/show_bug.cgi?id=50711
+
+ draining of the MarkStack is not allowed to be re-entrant, we got away
+ with this simply due to the logic in MarkStack::drain implicitly handling
+ changes that could be triggered by the re-entry.
+
+ Just to be safe this patch removes the re-entry through markConservatively
+ so we don't accidentally introduce such an issue in future. I've also
+ added an assertion to catch such errors.
+
+ * runtime/Collector.cpp:
+ (JSC::Heap::markConservatively):
+ (JSC::Heap::markCurrentThreadConservativelyInternal):
+ (JSC::Heap::markOtherThreadConservatively):
+ * runtime/JSArray.h:
+ (JSC::MarkStack::drain):
+ * runtime/MarkStack.h:
+ (JSC::MarkStack::MarkStack):
+
+2010-12-08 Chris Marrin <cmarrin@apple.com>
+
+ Reviewed by Simon Fraser.
+
+ Share code between Mac (CA) and Windows (CACF) GraphicsLayer implementations
+ https://bugs.webkit.org/show_bug.cgi?id=49388
+
+ Added a WTF_PLATFORM_CA flag. Set when platform is MAC or IOS or (WINDOWS AND CG)
+ which was decided was the best way to identify a build with CoreAnimation
+
+ * wtf/Platform.h:
+
+2010-12-07 Anders Carlsson <andersca@apple.com>
+
+ Build fix follow up build fix.
+
+ * pcre/pcre_ucp_searchfuncs.cpp:
+ (jsc_pcre_ucp_othercase):
+
+2010-12-07 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Fix clang++ build
+ https://bugs.webkit.org/show_bug.cgi?id=50645
+
+ Explicitly cast offset to int.
+
+ * pcre/pcre_ucp_searchfuncs.cpp:
+ (jsc_pcre_ucp_othercase):
+
+2010-12-07 Kenneth Russell <kbr@google.com>
+
+ Reviewed by David Levin.
+
+ Fix compilation of core web audio files on Windows
+ https://bugs.webkit.org/show_bug.cgi?id=50603
+
+ Added log2 definition to MathExtras.h on Windows platform.
+
+ * wtf/MathExtras.h:
+ (log2):
+
+2010-12-07 Antti Koivisto <antti@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ https://bugs.webkit.org/show_bug.cgi?id=50412
+ http://www.wunderground.com/US/CA/Hayward.html causes big memory spike during page loading
+
+ Creating a substring caused the original string be flattened if it was in the rope form. This could use
+ significant amount of memory by reducing buffer sharing between strings.
+
+ Add a rope specific substring function that constructs the substring by reusing the rope fibers
+ instead of flattening the rope.
+
+ No change observed in SunSpider.
+
+ * runtime/JSString.cpp:
+ (JSC::JSString::substringFromRope):
+ * runtime/JSString.h:
+ (JSC::jsSubstring):
+ * runtime/StringPrototype.cpp:
+ (JSC::stringProtoFuncSubstr):
+ (JSC::stringProtoFuncSubstring):
+
+2010-12-06 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Simplified some ASLR-related code in PageAllocation/Reservation
+ https://bugs.webkit.org/show_bug.cgi?id=50599
+
+ Removed reserveAt, allocateAt, and friends, since they all existed to
+ serve one feature: ASLR for executable memory on x86_64 on Mac. Moved
+ ASLR code down into systemAllocate -- now, any time you allocate
+ executable memory on a supporting platform, the memory's location is
+ randomized.
+
+ * jit/ExecutableAllocatorFixedVMPool.cpp:
+ (JSC::FixedVMPoolAllocator::FixedVMPoolAllocator): No need for the caller
+ to randomize anything.
+
+ * wtf/PageAllocation.h:
+ (WTF::PageAllocation::systemAllocate): Removed some *At() functions, and
+ beefed up executable allocation with randomization.
+
+ * wtf/PageReservation.h:
+ (WTF::PageReservation::systemReserve): Removed some *At() functions.
+
+2010-12-06 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ reserveAndCommit doesn't commit on MADVISE_FREE_REUSE systems
+ https://bugs.webkit.org/show_bug.cgi?id=50588
+
+ * wtf/OSAllocatorPosix.cpp:
+ (WTF::OSAllocator::reserve):
+ (WTF::OSAllocator::reserveAndCommit):
+ (WTF::OSAllocator::commit): Tightened up some comments. Changed
+ reserveAndCommit to actually commit on MADVISE_FREE_REUSE systems.
+
+2010-12-06 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by Andreas Kling.
+
+ [WINCE] Add build system
+ https://bugs.webkit.org/show_bug.cgi?id=50522
+
+ * CMakeListsWinCE.txt: Added.
+ * shell/CMakeListsWinCE.txt: Added.
+ * wtf/CMakeListsWinCE.txt: Added.
+
+2010-12-06 John Tantalo <john.tantalo@gmail.com>
+
+ Reviewed by Geoffrey Garen.
+
+ jsc does not ignore shebang
+ https://bugs.webkit.org/show_bug.cgi?id=49576
+
+ * jsc.cpp:
+ (fillBufferWithContentsOfFile):
+ - translate shebang into a valid JavaScript comment so the lexer ignores it
+
+2010-12-05 Adam Roben <aroben@apple.com>
+
+ Windows production build fix
+
+ Put spaces after trailing backslashes when setting
+ %WebKitVSPropsRedirectionDir%. According to MSDN
+ <http://msdn.microsoft.com/en-us/library/2kzfk8c7(v=VS.80).aspx>:
+
+ A backslash ( \ ) followed by a newline character is interpreted as
+ a space in the command; use a backslash at the end of a line to
+ continue a command onto the next line. NMAKE interprets the
+ backslash literally if any other character, including a space or
+ tab, follows the backslash.
+
+ * JavaScriptCore.vcproj/JavaScriptCore.make:
+
+2010-12-04 Patrick Gansterer <paroga@webkit.org>
+
+ Unreviewed, build fix after r69132.
+
+ * shell/CMakeLists.txt: Fix directory name (jsc -> shell).
+
+2010-12-04 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Martin Robinson.
+
+ [GTK] Drop GdkDrawable usage, it's deprecated in GTK+3.x and we can use GdkWindow
+ https://bugs.webkit.org/show_bug.cgi?id=50451
+
+ * wtf/gobject/GTypedefs.h: add GdkWindow defines.
+
+2010-12-03 Gavin Barraclough <barraclough@apple.com>
+
+ Rubber stamped by Oliver Hunt.
+
+ Bug 50509 - set* methods on MacroAssembler are awfully named.
+
+ Methods set32 and setTest32 compare 32-bit operands, and set a 32-bit results based on the comparison.
+ set8 compares 32-bit operands, and sets an 8-bit result based on the comparison.
+ setTest8 compares 8-bit operands, and sets a 32-bit result based on the comparison.
+
+ Rename to clarify.
+
+ set32 -> set32Compare32
+ setTest32 -> set32Test32
+ set8 -> set8Compare32
+ setTest8 -> set32Test8
+
+ * assembler/MacroAssembler.h:
+ (JSC::MacroAssembler::setPtr):
+ * assembler/MacroAssemblerARM.h:
+ (JSC::MacroAssemblerARM::set32Compare32):
+ (JSC::MacroAssemblerARM::set8Compare32):
+ (JSC::MacroAssemblerARM::set32Test32):
+ (JSC::MacroAssemblerARM::set32Test8):
+ * assembler/MacroAssemblerARMv7.h:
+ (JSC::MacroAssemblerARMv7::set32Compare32):
+ (JSC::MacroAssemblerARMv7::set8Compare32):
+ (JSC::MacroAssemblerARMv7::set32Test32):
+ (JSC::MacroAssemblerARMv7::set32Test8):
+ * assembler/MacroAssemblerMIPS.h:
+ (JSC::MacroAssemblerMIPS::set8Compare32):
+ (JSC::MacroAssemblerMIPS::set32Compare32):
+ (JSC::MacroAssemblerMIPS::set32Test8):
+ (JSC::MacroAssemblerMIPS::set32Test32):
+ * assembler/MacroAssemblerX86Common.h:
+ (JSC::MacroAssemblerX86Common::set8Compare32):
+ (JSC::MacroAssemblerX86Common::set32Compare32):
+ (JSC::MacroAssemblerX86Common::set32Test8):
+ (JSC::MacroAssemblerX86Common::set32Test32):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_eq):
+ (JSC::JIT::emit_op_neq):
+ (JSC::JIT::compileOpStrictEq):
+ (JSC::JIT::emit_op_eq_null):
+ (JSC::JIT::emit_op_neq_null):
+ * jit/JITOpcodes32_64.cpp:
+ (JSC::JIT::emit_op_eq):
+ (JSC::JIT::emit_op_neq):
+ (JSC::JIT::compileOpStrictEq):
+ (JSC::JIT::emit_op_eq_null):
+ (JSC::JIT::emit_op_neq_null):
+
+2010-12-03 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Incorrect logic for returning memory at the end of linking.
+ Reviewed by Geoff Garen.
+
+ At the end of linking we return any space at the end of the
+ allocated executable region that was saved due to branch
+ compaction. This is currently by done by subtracting the
+ different from the m_freePtr in the allocation pool. This
+ can be incorrect if your allocation was made from a new
+ page that was not selected for subsequent allocations.
+
+ This patch corrects this behaviour by verifying that the
+ memory being returned actually comes from the current
+ allocation pool.
+
+ * assembler/LinkBuffer.h:
+ (JSC::LinkBuffer::linkCode):
+ * jit/ExecutableAllocator.h:
+ (JSC::ExecutablePool::tryShrink):
+
+2010-12-03 Michael Saboff <msaboff@apple.com>
+
+ Reviewed by Gavin Barraclough
+
+ Changes to significantly reduce branches to branches in JIT'ed
+ parentheses backtrack processing. The changes include the following:
+ - Taking the backtracking processing out of line and adding it as
+ code at the end of the JIT'ed routine.
+ - Allow backtracks to be direct via an indirect branch for an address
+ pushed onto the stack. If the use of an indirect branch is from a
+ conditional jump, then we emit a trampoline at the end of the
+ routine.
+ - Propogate backtracks instead of adding trampolines. Backtracks are
+ propogated to where they are used. This change also eliminated
+ trampoline branch code that aren't used.
+ - Added global expression state to keep track of parentheses tail
+ code and indirect branches.
+ Other changes made to support these changes.
+ - Split invertOrCapture flag on Patterns to two separate flags. Added
+ getters for these flags. Rippled these changes to both the JIT
+ and interpreter code.
+ - Split BacktrackDestination out off TermGenerationState struct.
+ This is done to hold references to a backtrack for later code
+ generation.
+ https://bugs.webkit.org/show_bug.cgi?id=50295
+
+ * assembler/ARMAssembler.h:
+ (JSC::ARMAssembler::JmpDst::isSet):
+ * assembler/ARMv7Assembler.h:
+ (JSC::ARMv7Assembler::JmpDst::isSet):
+ * assembler/AbstractMacroAssembler.h:
+ (JSC::AbstractMacroAssembler::Label::isSet):
+ (JSC::AbstractMacroAssembler::DataLabelPtr::isUsed):
+ (JSC::AbstractMacroAssembler::DataLabelPtr::used):
+ (JSC::AbstractMacroAssembler::JumpList::clear):
+ * assembler/MIPSAssembler.h:
+ (JSC::MIPSAssembler::JmpDst::isSet):
+ * assembler/X86Assembler.h:
+ (JSC::X86Assembler::JmpDst::isSet):
+ * yarr/RegexCompiler.cpp:
+ (JSC::Yarr::RegexPatternConstructor::atomParenthesesSubpatternBegin):
+ (JSC::Yarr::RegexPatternConstructor::atomParentheticalAssertionBegin):
+ (JSC::Yarr::RegexPatternConstructor::atomBackReference):
+ (JSC::Yarr::RegexPatternConstructor::setupAlternativeBeginTerms):
+ * yarr/RegexInterpreter.cpp:
+ (JSC::Yarr::ByteCompiler::atomParenthesesOnceBegin):
+ (JSC::Yarr::ByteCompiler::atomParenthesesTerminalBegin):
+ (JSC::Yarr::ByteCompiler::atomParenthesesSubpatternBegin):
+ (JSC::Yarr::ByteCompiler::atomParentheticalAssertionBegin):
+ (JSC::Yarr::ByteCompiler::atomParentheticalAssertionEnd):
+ (JSC::Yarr::ByteCompiler::atomParenthesesSubpatternEnd):
+ (JSC::Yarr::ByteCompiler::atomParenthesesOnceEnd):
+ (JSC::Yarr::ByteCompiler::atomParenthesesTerminalEnd):
+ (JSC::Yarr::ByteCompiler::emitDisjunction):
+ * yarr/RegexInterpreter.h:
+ (JSC::Yarr::ByteTerm::ByteTerm):
+ (JSC::Yarr::ByteTerm::BackReference):
+ (JSC::Yarr::ByteTerm::invert):
+ (JSC::Yarr::ByteTerm::capture):
+ * yarr/RegexJIT.cpp:
+ (JSC::Yarr::RegexGenerator::IndirectJumpEntry::IndirectJumpEntry):
+ (JSC::Yarr::RegexGenerator::IndirectJumpEntry::addJump):
+ (JSC::Yarr::RegexGenerator::GenerationState::GenerationState):
+ (JSC::Yarr::RegexGenerator::GenerationState::addIndirectJumpEntry):
+ (JSC::Yarr::RegexGenerator::GenerationState::emitIndirectJumpTable):
+ (JSC::Yarr::RegexGenerator::GenerationState::addParenthesesTail):
+ (JSC::Yarr::RegexGenerator::GenerationState::emitParenthesesTail):
+ (JSC::Yarr::RegexGenerator::GenerationState::addJumpToNextInteration):
+ (JSC::Yarr::RegexGenerator::GenerationState::addJumpsToNextInteration):
+ (JSC::Yarr::RegexGenerator::GenerationState::addDataLabelToNextIteration):
+ (JSC::Yarr::RegexGenerator::GenerationState::linkToNextIteration):
+ (JSC::Yarr::RegexGenerator::BacktrackDestination::BacktrackDestination):
+ (JSC::Yarr::RegexGenerator::BacktrackDestination::clear):
+ (JSC::Yarr::RegexGenerator::BacktrackDestination::clearDataLabel):
+ (JSC::Yarr::RegexGenerator::BacktrackDestination::haveDestination):
+ (JSC::Yarr::RegexGenerator::BacktrackDestination::isStackOffset):
+ (JSC::Yarr::RegexGenerator::BacktrackDestination::isLabel):
+ (JSC::Yarr::RegexGenerator::BacktrackDestination::isJumpList):
+ (JSC::Yarr::RegexGenerator::BacktrackDestination::haveDataLabel):
+ (JSC::Yarr::RegexGenerator::BacktrackDestination::copyTarget):
+ (JSC::Yarr::RegexGenerator::BacktrackDestination::copyTo):
+ (JSC::Yarr::RegexGenerator::BacktrackDestination::addBacktrackJump):
+ (JSC::Yarr::RegexGenerator::BacktrackDestination::setStackOffset):
+ (JSC::Yarr::RegexGenerator::BacktrackDestination::setLabel):
+ (JSC::Yarr::RegexGenerator::BacktrackDestination::setNextBacktrackLabel):
+ (JSC::Yarr::RegexGenerator::BacktrackDestination::setBacktrackToLabel):
+ (JSC::Yarr::RegexGenerator::BacktrackDestination::setBacktrackJumpList):
+ (JSC::Yarr::RegexGenerator::BacktrackDestination::setBacktrackSourceLabel):
+ (JSC::Yarr::RegexGenerator::BacktrackDestination::setDataLabel):
+ (JSC::Yarr::RegexGenerator::BacktrackDestination::setSubDataLabelPtr):
+ (JSC::Yarr::RegexGenerator::BacktrackDestination::linkToNextBacktrack):
+ (JSC::Yarr::RegexGenerator::BacktrackDestination::getStackOffset):
+ (JSC::Yarr::RegexGenerator::BacktrackDestination::getLabel):
+ (JSC::Yarr::RegexGenerator::BacktrackDestination::getBacktrackJumps):
+ (JSC::Yarr::RegexGenerator::BacktrackDestination::getDataLabel):
+ (JSC::Yarr::RegexGenerator::BacktrackDestination::jumpToBacktrack):
+ (JSC::Yarr::RegexGenerator::BacktrackDestination::linkDataLabelToHereIfExists):
+ (JSC::Yarr::RegexGenerator::BacktrackDestination::plantJumpToBacktrackIfExists):
+ (JSC::Yarr::RegexGenerator::BacktrackDestination::linkAlternativeBacktracks):
+ (JSC::Yarr::RegexGenerator::BacktrackDestination::linkAlternativeBacktracksTo):
+ (JSC::Yarr::RegexGenerator::TermGenerationState::TermGenerationState):
+ (JSC::Yarr::RegexGenerator::TermGenerationState::resetAlternative):
+ (JSC::Yarr::RegexGenerator::TermGenerationState::isLastAlternative):
+ (JSC::Yarr::RegexGenerator::TermGenerationState::clearBacktrack):
+ (JSC::Yarr::RegexGenerator::TermGenerationState::jumpToBacktrack):
+ (JSC::Yarr::RegexGenerator::TermGenerationState::plantJumpToBacktrackIfExists):
+ (JSC::Yarr::RegexGenerator::TermGenerationState::linkDataLabelToBacktrackIfExists):
+ (JSC::Yarr::RegexGenerator::TermGenerationState::addBacktrackJump):
+ (JSC::Yarr::RegexGenerator::TermGenerationState::setDataLabelPtr):
+ (JSC::Yarr::RegexGenerator::TermGenerationState::setBackTrackStackOffset):
+ (JSC::Yarr::RegexGenerator::TermGenerationState::setBacktrackLabel):
+ (JSC::Yarr::RegexGenerator::TermGenerationState::linkAlternativeBacktracks):
+ (JSC::Yarr::RegexGenerator::TermGenerationState::linkAlternativeBacktracksTo):
+ (JSC::Yarr::RegexGenerator::TermGenerationState::setBacktrackLink):
+ (JSC::Yarr::RegexGenerator::TermGenerationState::chainBacktracks):
+ (JSC::Yarr::RegexGenerator::TermGenerationState::chainBacktrackJumps):
+ (JSC::Yarr::RegexGenerator::TermGenerationState::getBacktrackDestination):
+ (JSC::Yarr::RegexGenerator::TermGenerationState::propagateBacktrackingFrom):
+ (JSC::Yarr::RegexGenerator::ParenthesesTail::ParenthesesTail):
+ (JSC::Yarr::RegexGenerator::ParenthesesTail::processBacktracks):
+ (JSC::Yarr::RegexGenerator::ParenthesesTail::setNextIteration):
+ (JSC::Yarr::RegexGenerator::ParenthesesTail::generateCode):
+ (JSC::Yarr::RegexGenerator::generateAssertionBOL):
+ (JSC::Yarr::RegexGenerator::generateAssertionEOL):
+ (JSC::Yarr::RegexGenerator::generateAssertionWordBoundary):
+ (JSC::Yarr::RegexGenerator::generatePatternCharacterSingle):
+ (JSC::Yarr::RegexGenerator::generatePatternCharacterPair):
+ (JSC::Yarr::RegexGenerator::generatePatternCharacterFixed):
+ (JSC::Yarr::RegexGenerator::generatePatternCharacterGreedy):
+ (JSC::Yarr::RegexGenerator::generatePatternCharacterNonGreedy):
+ (JSC::Yarr::RegexGenerator::generateCharacterClassSingle):
+ (JSC::Yarr::RegexGenerator::generateCharacterClassFixed):
+ (JSC::Yarr::RegexGenerator::generateCharacterClassGreedy):
+ (JSC::Yarr::RegexGenerator::generateCharacterClassNonGreedy):
+ (JSC::Yarr::RegexGenerator::generateParenthesesDisjunction):
+ (JSC::Yarr::RegexGenerator::generateParenthesesSingle):
+ (JSC::Yarr::RegexGenerator::generateParenthesesGreedyNoBacktrack):
+ (JSC::Yarr::RegexGenerator::generateParentheticalAssertion):
+ (JSC::Yarr::RegexGenerator::generateDisjunction):
+ (JSC::Yarr::RegexGenerator::compile):
+ * yarr/RegexPattern.h:
+ (JSC::Yarr::PatternTerm::PatternTerm):
+ (JSC::Yarr::PatternTerm::invert):
+ (JSC::Yarr::PatternTerm::capture):
+
+2010-12-03 Chris Rogers <crogers@google.com>
+
+ Reviewed by Kenneth Russell.
+
+ First steps to adding web audio files to build systems
+ https://bugs.webkit.org/show_bug.cgi?id=49952
+
+ * wtf/Complex.h:
+
+2010-12-03 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by Andreas Kling.
+
+ Move StringWx.cpp into wtf directory
+ https://bugs.webkit.org/show_bug.cgi?id=50060
+
+ * wtf/wx/StringWx.cpp: Renamed from WebCore/platform/text/wx/StringWx.cpp.
+ (WTF::String::String):
+
+2010-12-03 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by Andreas Kling.
+
+ Move StringBrew.cpp into wtf directory
+ https://bugs.webkit.org/show_bug.cgi?id=50058
+
+ * wtf/brew/StringBrew.cpp: Renamed from WebCore/platform/text/brew/StringBrew.cpp.
+ (WTF::String::String):
+
+2010-12-03 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by Andreas Kling.
+
+ Move StringHaiku.cpp into wtf directory
+ https://bugs.webkit.org/show_bug.cgi?id=50057
+
+ * wtf/haiku/StringHaiku.cpp: Renamed from WebCore/platform/text/haiku/StringHaiku.cpp.
+ (WTF::String::String):
+ (WTF::String::operator BString):
+
+2010-12-02 Geoffrey Garen <ggaren@apple.com>
+
+ Try to fix Windows build.
+
+ * runtime/GCActivityCallback.cpp:
+ (JSC::DefaultGCActivityCallback::synchronize): Added a non-CF implementation.
+
+2010-12-02 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Fixed <rdar://problem/8310571> CrashTracer: 60 crashes in Photo Booth at
+ com.apple.JavaScriptCore: JSC::Heap::markRoots + 746
+
+ * API/APIShims.h:
+ (JSC::APIEntryShimWithoutLock::APIEntryShimWithoutLock): Call our new
+ synchronize() function.
+
+ * runtime/Collector.cpp:
+ (JSC::Heap::activityCallback):
+ * runtime/Collector.h: Added an activityCallback() accessor, for the
+ call above.
+
+ * runtime/GCActivityCallback.h:
+ (JSC::GCActivityCallback::synchronize):
+ * runtime/GCActivityCallbackCF.cpp:
+ (JSC::DefaultGCActivityCallback::DefaultGCActivityCallback):
+ (JSC::DefaultGCActivityCallback::~DefaultGCActivityCallback):
+ (JSC::DefaultGCActivityCallback::operator()):
+ (JSC::DefaultGCActivityCallback::synchronize): Track the run loop we're
+ scheduled in. If we begin/resume execution within a new run loop, reschedule
+ on it. This prevents a crash when using a lockless context group on
+ multiple threads -- the crash would happen if the GC timer scheduled on
+ thread A, then you continued execution on thread B, then the thread A
+ timer fired.
+
+2010-12-02 Darin Adler <darin@apple.com>
+
+ * wtf/ASCIICType.h: Fix wrong type from last check-in.
+
+2010-12-02 Darin Adler <darin@apple.com>
+
+ Try to fix certain builds (Qt Windows).
+
+ * wtf/ASCIICType.h: Added an overload for unsigned because in obsolete
+ versions of ICU, UChar32 can be a typedef for unsigned. Adding this
+ overload should make us compatible with these old ICUs.
+
+2010-12-02 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ Add AtomicString::fromUTF8
+ https://bugs.webkit.org/show_bug.cgi?id=45594
+
+ Unicode::calculateStringHashFromUTF8 creates a StringHash out of UTF8 input data and
+ calculates the required length for the UTF16 conversation in one step.
+ This is then used in a specialized translator for the string table of AtomicString.
+
+ * JavaScriptCore.exp:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * wtf/text/AtomicString.cpp:
+ (WTF::CStringTranslator::equal):
+ (WTF::HashAndUTF8CharactersTranslator::hash):
+ (WTF::HashAndUTF8CharactersTranslator::equal):
+ (WTF::HashAndUTF8CharactersTranslator::translate):
+ (WTF::AtomicString::add):
+ (WTF::AtomicString::addSlowCase):
+ (WTF::AtomicString::find):
+ (WTF::AtomicString::fromUTF8):
+ * wtf/text/AtomicString.h:
+ * wtf/text/StringImpl.h:
+ * wtf/text/WTFString.h:
+ * wtf/unicode/UTF8.cpp:
+ (WTF::Unicode::readUTF8Sequence):
+ (WTF::Unicode::convertUTF8ToUTF16):
+ (WTF::Unicode::calculateStringHashFromUTF8):
+ (WTF::Unicode::equalUTF16WithUTF8):
+ * wtf/unicode/UTF8.h:
+
+2010-12-02 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Added a little hardening to OSAllocator.
+
+ * wtf/OSAllocatorPosix.cpp:
+ (WTF::OSAllocator::release):
+ * wtf/OSAllocatorWin.cpp:
+ (WTF::OSAllocator::reserve):
+ (WTF::OSAllocator::reserveAndCommit):
+ (WTF::OSAllocator::commit):
+ (WTF::OSAllocator::decommit):
+ (WTF::OSAllocator::release): CRASH() if the OS's virtual memory system
+ reports an error.
+
+2010-12-02 Csaba Osztrogonác <ossy@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ [Qt] Make platform managing of OSAllocator better than r73106
+ https://bugs.webkit.org/show_bug.cgi?id=50385
+
+ * wtf/OSAllocatorPosix.cpp: Remove platform specific guard.
+ * wtf/OSAllocatorSymbian.cpp: Remove platform specific guard.
+ * wtf/OSAllocatorWin.cpp: Remove platform specific guard.
+ * wtf/wtf.pri: Add the correct platform specific source file instead of all of them.
+
+2010-12-02 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by Andreas Kling.
+
+ [WINCE] Use GetTickCount() for srand()
+ https://bugs.webkit.org/show_bug.cgi?id=50338
+
+ time() is not a native function on WinCE, so use GetTickCount() instead.
+
+ * wtf/RandomNumberSeed.h:
+ (WTF::initializeRandomNumberGenerator):
+
+2010-12-02 Norbert Leser <norbert.leser@nokia.com>
+
+ Reviewed by Laszlo Gombos.
+
+ [Qt] [Symbian] Reintroduce compiler optimizations for JSC
+ https://bugs.webkit.org/show_bug.cgi?id=50270
+
+ Add compiler optimization (symbian ARM target) which was lost after split from WebCore.
+ Tested via Sunspider and V8 - both of which show significant performance improvement.
+
+ * JavaScriptCore.pro:
+
+2010-12-02 Peter Varga <pvarga@inf.u-szeged.hu>
+
+ Reviewed by Gavin Barraclough.
+
+ Move regex parsing and fallback handling to runtime/RegExp.cpp
+ https://bugs.webkit.org/show_bug.cgi?id=50015
+
+ * runtime/RegExp.cpp:
+ (JSC::RegExp::RegExp):
+ (JSC::RegExp::create):
+ (JSC::RegExp::compile):
+ (JSC::RegExp::match):
+ (JSC::RegExp::printTraceData):
+ * runtime/RegExp.h:
+ (JSC::RegExp::pattern):
+ * yarr/RegexInterpreter.cpp:
+ * yarr/RegexInterpreter.h:
+ * yarr/RegexJIT.cpp:
+ (JSC::Yarr::RegexGenerator::compile):
+ (JSC::Yarr::jitCompileRegex):
+ * yarr/RegexJIT.h:
+ (JSC::Yarr::RegexCodeBlock::RegexCodeBlock):
+ (JSC::Yarr::RegexCodeBlock::setFallBack):
+ (JSC::Yarr::RegexCodeBlock::isFallBack):
+ (JSC::Yarr::executeRegex):
+
+2010-12-01 Geoffrey Garen <ggaren@apple.com>
+
+ Try to fix the GTK build.
+
+ * GNUmakefile.am: Use a full path to OSAllocator*.cpp.
+
+2010-12-01 Geoffrey Garen <ggaren@apple.com>
+
+ Try to fix the EFL Linux build.
+
+ * CMakeListsEfl.txt: Added OSAllocator to the project.
+
+2010-12-01 Geoffrey Garen <ggaren@apple.com>
+
+ Try to fix the Qt build: Include all OS files for Qt's sake, and then
+ use #ifdefs in the files to exclude things based on OS.
+
+ This is a pretty bad way to manage platforms -- hopefully we can
+ fix the Qt build system and move away from this in the future.
+
+ * wtf/OSAllocatorPosix.cpp:
+ * wtf/OSAllocatorSymbian.cpp:
+ * wtf/OSAllocatorWin.cpp:
+ * wtf/wtf.pri:
+
+2010-12-01 Geoffrey Garen <ggaren@apple.com>
+
+ Try to fix the Chromium build.
+
+ * JavaScriptCore.gypi: This is a Windows build file, so use OSAllocatorWin.cpp.
+
+2010-12-01 Geoffrey Garen <ggaren@apple.com>
+
+ Try to fix the GTK build.
+
+ * GNUmakefile.am: Added OSAllocator to another project.
+
+2010-12-01 Geoffrey Garen <ggaren@apple.com>
+
+ Try to fix the GTK Linux build.
+
+ * JavaScriptCore.gypi: Added OSAllocator to the project.
+
+2010-12-01 Geoffrey Garen <ggaren@apple.com>
+
+ Try to fix the Qt Linux build.
+
+ * wtf/OSAllocatorPosix.cpp: Use the right errno.h.
+
+2010-12-01 Geoffrey Garen <ggaren@apple.com>
+
+ Try to fix Windows build: export some more symbols.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-12-01 Geoffrey Garen <ggaren@apple.com>
+
+ Try to fix the Qt Linux build.
+
+ * wtf/wtf.pri: Use the POSIX OSAllocator for Qt Linux.
+
+2010-12-01 Geoffrey Garen <ggaren@apple.com>
+
+ Windows build fix: commit doesn't have a return value.
+
+ * wtf/OSAllocatorWin.cpp:
+ (WTF::OSAllocator::commit):
+
+2010-12-01 Geoffrey Garen <ggaren@apple.com>
+
+ Build fix: Export some symbols.
+
+ * JavaScriptCore.exp:
+
+2010-12-01 Geoffrey Garen <ggaren@apple.com>
+
+ Build fix.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj: Export OSAllocator.h as private
+ so other projects can see it.
+
+ * wtf/OSAllocatorPosix.cpp: #include UnusedParam.h for UNUSED_PARAM.
+
+2010-12-01 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Baby step toward a cross-platform virtual memory abstraction: created
+ an all-static OSAllocator class and changed MarkStack to use it.
+
+ * JavaScriptCore.exp: These functions are inlined now.
+
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj: Added OSAllocatorWin.cpp.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj: Added OSAllocatorPosix.cpp.
+
+ * runtime/MarkStack.h:
+ (JSC::MarkStack::allocateStack):
+ (JSC::MarkStack::releaseStack): Use OSAllocator instead of rolling our
+ own platform-specific code.
+
+ * runtime/MarkStackNone.cpp: Removed. Nothing used this.
+
+ * runtime/MarkStackPosix.cpp:
+ * runtime/MarkStackSymbian.cpp:
+ * runtime/MarkStackWin.cpp: Removed custom platform-specific code, since
+ we use the OSAllocator abstraction now.
+
+ * wtf/OSAllocator.h: Added.
+ * wtf/OSAllocatorPosix.cpp: Added.
+ (WTF::OSAllocator::reserve):
+ (WTF::OSAllocator::reserveAndCommit):
+ (WTF::OSAllocator::commit):
+ (WTF::OSAllocator::decommit):
+ (WTF::OSAllocator::release):
+ * wtf/OSAllocatorSymbian.cpp: Added.
+ (WTF::OSAllocator::reserve):
+ (WTF::OSAllocator::reserveAndCommit):
+ (WTF::OSAllocator::commit):
+ (WTF::OSAllocator::decommit):
+ (WTF::OSAllocator::release):
+ * wtf/OSAllocatorWin.cpp: Added.
+ (WTF::OSAllocator::reserve):
+ (WTF::OSAllocator::reserveAndCommit):
+ (WTF::OSAllocator::commit):
+ (WTF::OSAllocator::decommit):
+ (WTF::OSAllocator::release): The new OSAllocator abstraction.
+
+ * wtf/wtf.pri: Added OSAllocatorSymbian.cpp.
+
+2010-12-01 Steve Falkenburg <sfalken@apple.com>
+
+ Reviewed by Adam Roben.
+
+ WinCairo build should not use link-time code generation (LTCG)
+ https://bugs.webkit.org/show_bug.cgi?id=50353
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * JavaScriptCore.vcproj/jsc/jsc.vcproj:
+ * JavaScriptCore.vcproj/testapi/testapi.vcproj:
+
+010-12-01 Steve Falkenburg <sfalken@apple.com>
+
+ Reviewed by Adam Roben.
+
+ vcproj changes can't be applied cleanly by the Windows EWS bot
+ https://bugs.webkit.org/show_bug.cgi?id=50328
+
+ * JavaScriptCore.vcproj/JavaScriptCore.sln: Modified property svn:eol-style.
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Modified property svn:eol-style.
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCF.vsprops: Added property svn:eol-style.
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCFLite.vsprops: Added property svn:eol-style.
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops: Added property svn:eol-style.
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.vcproj: Modified property svn:eol-style.
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGeneratedCommon.vsprops: Added property svn:eol-style.
+ * JavaScriptCore.vcproj/JavaScriptCoreSubmit.sln: Modified property svn:eol-style.
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj: Modified property svn:eol-style.
+ * JavaScriptCore.vcproj/WTF/WTFCommon.vsprops: Added property svn:eol-style.
+ * JavaScriptCore.vcproj/jsc/jsc.vcproj: Modified property svn:eol-style.
+ * JavaScriptCore.vcproj/jsc/jscCommon.vsprops: Added property svn:eol-style.
+ * JavaScriptCore.vcproj/testapi/testapi.vcproj: Modified property svn:eol-style.
+ * JavaScriptCore.vcproj/testapi/testapiCommon.vsprops: Added property svn:eol-style.
+
+2010-12-01 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Bug 50298 - /()()()()()()()()()(?:(\10a|b)(X|Y))+/.exec("bXXaYYaY") ASSERTs
+
+ For unmatched subpattens we previously used to set the subpattern end to -1,
+ but now we only set the start value. E.g. consider the following:
+ /a(b)?c/.exec("ac");
+ Previously we would generate an internal results array of:
+ [ 0, 2, -1, -1 ]
+ Since fairly recently we have generated results of:
+ [ 0, 2, -1, ??? ]
+ (With the end index of the subpattern uninitialized).
+
+ Update these ASSERTs to account for this.
+
+ Also, when stripping out self-referencing backreferences, (e.g. /(\1)/) we
+ were checking the wrong property on the pattern term. We should have been
+ looking at term.parentheses.subpatternId, but instead were checking
+ term.subpatternId. The latter is actually only the subpatternId for
+ back reference terms. Rename this to backReferenceSubpatternId.
+
+ * yarr/RegexInterpreter.cpp:
+ (JSC::Yarr::Interpreter::matchBackReference):
+ (JSC::Yarr::Interpreter::backtrackBackReference):
+
+2010-11-30 Gavin Barraclough <barraclough@apple.com>
+
+ Rubber stamped by Sam Weinig.
+
+ Bug 50297 - \s in YARR should match BOMs.
+
+ From section 15.10.2.12 CharacterClassEscape contains:
+
+ The production CharacterClassEscape :: s evaluates by returning the set of characters containing the
+ characters that are on the right-hand side of the WhiteSpace (7.2) or LineTerminator (7.3) productions.
+
+ Table 2 in section 7.2 contains:
+
+ \uFEFF Byte Order Mark <BOM>
+
+ * create_regex_tables:
+ Add BOM to spaces table.
+
+2010-11-30 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Fixed review comments following bug #48101.
+ Mostly typos, plus gave quantifyInfinite a symbolic name.
+
+ * yarr/RegexCompiler.cpp:
+ (JSC::Yarr::RegexPatternConstructor::quantifyAtom):
+ (JSC::Yarr::RegexPatternConstructor::checkForTerminalParentheses):
+ * yarr/RegexInterpreter.cpp:
+ (JSC::Yarr::Interpreter::backtrackParenthesesOnceEnd):
+ (JSC::Yarr::Interpreter::matchParenthesesTerminalBegin):
+ (JSC::Yarr::Interpreter::backtrackParenthesesTerminalBegin):
+ (JSC::Yarr::Interpreter::backtrackParenthesesTerminalEnd):
+ * yarr/RegexJIT.cpp:
+ (JSC::Yarr::RegexGenerator::generatePatternCharacterGreedy):
+ (JSC::Yarr::RegexGenerator::generatePatternCharacterNonGreedy):
+ (JSC::Yarr::RegexGenerator::generateCharacterClassGreedy):
+ * yarr/RegexParser.h:
+ (JSC::Yarr::Parser::parseTokens):
+ (JSC::Yarr::parse):
+
+2010-11-30 Steve Falkenburg <sfalken@apple.com>
+
+ Reviewed by Darin Adler.
+
+ WTF project missing build-stopping code from its pre-build event
+ https://bugs.webkit.org/show_bug.cgi?id=50281
+
+ * JavaScriptCore.vcproj/WTF/WTFPreBuild.cmd:
+
+2010-11-30 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ Cleanup UTF8.cpp
+ https://bugs.webkit.org/show_bug.cgi?id=49581
+
+ Use macros and functions instead of range values directly.
+
+ * wtf/unicode/UTF8.cpp:
+ (WTF::Unicode::inlineUTF8SequenceLength):
+ (WTF::Unicode::UTF8SequenceLength):
+ (WTF::Unicode::convertUTF16ToUTF8):
+ (WTF::Unicode::readUTF8Sequence):
+ (WTF::Unicode::convertUTF8ToUTF16):
+ * wtf/unicode/UnicodeMacrosFromICU.h: Added U_IS_SUPPLEMENTARY macro.
+
+2010-11-30 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Fixed a crash seen when using a PageAllocation to store itself.
+
+ * wtf/PageAllocation.h:
+ (WTF::PageAllocation::systemDeallocate): Zero out m_base before unmapping
+ it, in case unmapping m_base unmaps the PageAllocation.
+
+ * wtf/BumpPointerAllocator.h:
+ (WTF::BumpPointerPool::destroy): Now this work-around isn't needed!
+
+2010-11-30 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Darin Adler.
+
+ m_hasNonEnumerableProperties is never initialized in Structure
+ https://bugs.webkit.org/show_bug.cgi?id=50266
+
+ * runtime/Structure.cpp:
+ (JSC::Structure::Structure): initialize member variable.
+
+2010-11-29 Steve Falkenburg <sfalken@apple.com>
+
+ Windows build fix (part 1). Use correct environment variable syntax in cmd files.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCorePostBuild.cmd:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCorePreBuild.cmd:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCorePreLink.cmd:
+ * JavaScriptCore.vcproj/WTF/WTFPostBuild.cmd:
+ * JavaScriptCore.vcproj/jsc/jscPostBuild.cmd:
+ * JavaScriptCore.vcproj/jsc/jscPreBuild.cmd:
+ * JavaScriptCore.vcproj/jsc/jscPreLink.cmd:
+ * JavaScriptCore.vcproj/testapi/testapiPostBuild.cmd:
+ * JavaScriptCore.vcproj/testapi/testapiPreBuild.cmd:
+ * JavaScriptCore.vcproj/testapi/testapiPreLink.cmd:
+
+2010-11-29 Dan Bernstein <mitz@apple.com>
+
+ Reviewed by Darin Adler.
+
+ WTF support for <rdar://problem/8650085> adding word-prefix search options to the text search API.
+ https://bugs.webkit.org/show_bug.cgi?id=50038
+
+ * wtf/unicode/UnicodeMacrosFromICU.h: Copied additional macros from icu/unicode/utf16.h.
+
+2010-11-29 Steve Falkenburg <sfalken@apple.com>
+
+ Reviewed by Darin Adler.
+
+ JavaScriptCore projects on Windows should use cmd files for build events
+ https://bugs.webkit.org/show_bug.cgi?id=50193
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCorePostBuild.cmd: Added.
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCorePreBuild.cmd: Added.
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCorePreLink.cmd: Added.
+ * JavaScriptCore.vcproj/WTF/WTFPostBuild.cmd: Added property svn:eol-style.
+ * JavaScriptCore.vcproj/WTF/WTFPreBuild.cmd: Added property svn:eol-style.
+ * JavaScriptCore.vcproj/jsc/jscCommon.vsprops:
+ * JavaScriptCore.vcproj/jsc/jscPostBuild.cmd: Added.
+ * JavaScriptCore.vcproj/jsc/jscPreBuild.cmd: Added.
+ * JavaScriptCore.vcproj/jsc/jscPreLink.cmd: Added.
+ * JavaScriptCore.vcproj/testapi/testapiCommon.vsprops:
+ * JavaScriptCore.vcproj/testapi/testapiPostBuild.cmd: Added.
+ * JavaScriptCore.vcproj/testapi/testapiPreBuild.cmd: Added.
+ * JavaScriptCore.vcproj/testapi/testapiPreLink.cmd: Added.
+
+2010-11-29 Dai Mikurube <dmikurube@google.com>
+
+ Reviewed by Kent Tamura.
+
+ when empty, clicking "down" on outer-spin-button returns "max value"
+ https://bugs.webkit.org/show_bug.cgi?id=45491
+
+ It is required to calculate UTC/DST offsets to retrieve the current local milliseconds for
+ date/time type inputs. WTF::currentTimeMS() returns a UTC time, and WTF::getLocalTime()
+ returns a struct tm, not milliseconds.
+
+ Calculating milliseconds from a struct tm is not simple since timegm() cannot be used in all
+ environments. This calculation is already done in calculateUTCOffset(), and complicated.
+ Duplicating this complicated calculation is unreasonable because of maintainability.
+ To achieve this without duplication, we must call calculate{UTC|DST}Offset in some way.
+
+ * JavaScriptCore.exp:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * wtf/DateMath.cpp: Changed calculateUTCOffset() and calculateDSTOffset() to external functions.
+ (WTF::calculateUTCOffset):
+ (WTF::calculateDSTOffset):
+ * wtf/DateMath.h:
+
+2010-11-29 Chris Rogers <crogers@google.com>
+
+ Reviewed by Kenneth Russell.
+
+ Switch web audio code to use FloatPoint3D instead of Vector3
+ https://bugs.webkit.org/show_bug.cgi?id=50186
+
+ * wtf/Vector3.h: Removed.
+
+2010-11-29 Steve Falkenburg <sfalken@apple.com>
+
+ Reviewed by Adam Roben.
+
+ Add a mechanism for Windows pre-build/pre-link/post-build events to be separated into individual cmd files
+ https://bugs.webkit.org/show_bug.cgi?id=49858
+
+ We're migrating our prebuild/prelink/postbuild steps out of vcproj and vsprops files:
+ - To simplify editing (editing vsprops build steps is confusing).
+ - For more readable diffs.
+
+ * JavaScriptCore.vcproj/WTF/WTFCommon.vsprops:
+ * JavaScriptCore.vcproj/WTF/WTFPostBuild.cmd: Added.
+ * JavaScriptCore.vcproj/WTF/WTFPreBuild.cmd: Added.
+
+2010-11-29 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Improved accuracy of command-line SunSpider.
+
+ * jsc.cpp:
+ (functionRun): Changed the "run" function to run a given test in
+ its own global object. Previously, all tests ran in the same global
+ object, which created name conflicts, and made globals from previous
+ tests artificially survive into later tests.
+
+ Also changed "run" to return the elapsed milliseconds when running a
+ given test, for slightly more accurate numbers.
+
+ (functionCheckSyntax): Ditto on returning elapsed milliseconds.
+
+2010-11-29 Darin Adler <darin@apple.com>
+
+ Reviewed by Andreas Kling.
+
+ Remove a couple unneeded overflow checks
+ https://bugs.webkit.org/show_bug.cgi?id=49816
+
+ * wtf/text/CString.cpp:
+ (WTF::CString::init): Use an ASSERT instead of
+ an overflow check with CRASH.
+
+2010-11-29 Adam Roben <aroben@apple.com>
+
+ Robustify react-to-vsprops-changes.py against changes to its location
+ or the location of the .vsprops files
+
+ Suggested by John Sullivan.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/react-to-vsprops-changes.py:
+ Removed file_modification_times.
+ (main): Use glob.glob to find the .vsprops files and assert that we found some.
+
+2010-11-29 Adam Roben <aroben@apple.com>
+
+ Touch wtf/Platform.h whenever any .vsprops file changes
+
+ This will cause all files to be recompiled, which will make changes to
+ preprocessor macros (e.g., ENABLE_*) actually take effect.
+
+ Fixes <http://webkit.org/b/50167> Windows build fails when ENABLE_*
+ macros are changed (because not enough files are rebuilt)
+
+ Reviewed by John Sullivan.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/react-to-vsprops-changes.py:
+ (main): Touch wtf/Platform.h if it's older than any .vsprops file. Also
+ added some comments and logging to make it clearer what the script is
+ doing and why.
+
+2010-11-29 Adam Roben <aroben@apple.com>
+
+ Update react-to-vsprops-changes.py after r72555
+
+ .vsprops files are no longer accessed relative to $WebKitLibrariesDir.
+
+ Fixes <http://webkit.org/b/50166> REGRESSION (r72555):
+ react-to-vsprops-changes.py no longer works for people with a
+ non-default $WebKitLibrariesDir
+
+ Reviewed by John Sullivan.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/react-to-vsprops-changes.py:
+ (main): Always look in WebKitLibraries/win for .vsprops files, not in
+ $WebKitLibrariesDir.
+
+2010-11-28 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Bug 48100 - YARR allows what seems like a bogus character-class range
+
+ Per ECMA-262 character classes containing character ranges containing
+ character classes are invalid, eg:
+ /[\d-x]/
+ /[x-\d]/
+ /[\d-\d]/
+ These should throw a syntax error.
+
+ * yarr/RegexParser.h:
+
+2010-11-27 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Bug 48101 - Yarr gives different results for /(?:a*?){2,}/
+
+ The test cases in the linked mozilla bug demonstrate a couple of
+ problems in subpattern matching. These bugs lie in the optimized
+ cases - for matching parentheses with a quantity count of 1, and
+ for matching greedy quantified parentheses at the end of a regex
+ (which do not backtrack).
+
+ In both of these cases we are failing to correctly handle empty
+ matches. In the case of parentheses-single matches (quantity count
+ one) we are failing to test for empty matches at all. In the case
+ of terminal subpattern matches we do currently check, however there
+ is a subtler bug here too. In the case of an empty match we will
+ presently immediately fall through to the next alternative (or
+ complete the regex match), whereas upon a failed match we should
+ be backtracking into the failing alternative, to give it a chance
+ to match further (e.g. consider /a??b?|a/.exec("ab") - upon first
+ attempting to match the first alternative this will match the empty
+ string - since a?? is non-greedy, however rather than moving on to
+ the second alternative we should be re-matching the first one, at
+ which point the non-greedy a?? will match, and as such the result
+ should be "ab", not "a").
+
+ Terminal subpattern matching contains a second bug, too. The frame
+ location values in the subpattern should be being allocated with
+ the outer disjunction's frame (as we do for the parentheses-single
+ optimization). Consider the following three regexes:
+ /a*(?:b*)*c*/
+ /a*(?:b*)c*/
+ /a*(?:b*)*/
+ Considering only the frame location required by the atoms a,b, and
+ c, (ignoring space associated with the nested subpattern) the first
+ regex (a normal subpattern match) requires a frame size of 2 for
+ the outer disjunction, (to backtrack terms a & c), with each
+ iteration of the subpattern requiring a frame of size 1 (in order
+ to backtrack b). In the case of the second regex (where the
+ parentheses-single optimization will kick in) the outer frame must
+ be set up with a frame size of 3, since the outer frame will also
+ be used when running the nested subpattern. We will currently only
+ allocate a farme of size 1 for the outer disjuntion (to contain a),
+ howver the frame size should be 2 (since the subpattern will be
+ evaluated in the outer frame). In addition to failing to allocate
+ frame space the frame offsets are also presently invalid - in the
+ case of the last regex b's frame location will be set assuming it
+ to be the first term in the frame, whereas in this case b lies
+ after the term a, and should be taking a separate frame location.
+
+ In order to correctly allocate the frame for terminal subpattern
+ matches we must move this optimization back up from the JIT into
+ the compiler (and thus interpreter too), since this is where the
+ frame allocation takes place.
+
+ * yarr/RegexCompiler.cpp:
+ (JSC::Yarr::RegexPatternConstructor::setupAlternativeOffsets):
+ (JSC::Yarr::RegexPatternConstructor::checkForTerminalParentheses):
+ (JSC::Yarr::compileRegex):
+ * yarr/RegexInterpreter.cpp:
+ (JSC::Yarr::Interpreter::matchParenthesesOnceBegin):
+ (JSC::Yarr::Interpreter::matchParenthesesOnceEnd):
+ (JSC::Yarr::Interpreter::backtrackParenthesesOnceBegin):
+ (JSC::Yarr::Interpreter::backtrackParenthesesOnceEnd):
+ (JSC::Yarr::Interpreter::matchParenthesesTerminalBegin):
+ (JSC::Yarr::Interpreter::matchParenthesesTerminalEnd):
+ (JSC::Yarr::Interpreter::backtrackParenthesesTerminalBegin):
+ (JSC::Yarr::Interpreter::backtrackParenthesesTerminalEnd):
+ (JSC::Yarr::Interpreter::matchDisjunction):
+ (JSC::Yarr::ByteCompiler::atomParenthesesOnceBegin):
+ (JSC::Yarr::ByteCompiler::atomParenthesesTerminalBegin):
+ (JSC::Yarr::ByteCompiler::atomParenthesesSubpatternBegin):
+ (JSC::Yarr::ByteCompiler::atomParentheticalAssertionEnd):
+ (JSC::Yarr::ByteCompiler::atomParenthesesSubpatternEnd):
+ (JSC::Yarr::ByteCompiler::atomParenthesesOnceEnd):
+ (JSC::Yarr::ByteCompiler::atomParenthesesTerminalEnd):
+ (JSC::Yarr::ByteCompiler::emitDisjunction):
+ * yarr/RegexInterpreter.h:
+ * yarr/RegexJIT.cpp:
+ (JSC::Yarr::RegexGenerator::generateParenthesesSingle):
+ (JSC::Yarr::RegexGenerator::generateParenthesesGreedyNoBacktrack):
+ (JSC::Yarr::RegexGenerator::generateTerm):
+ * yarr/RegexPattern.h:
+ (JSC::Yarr::PatternTerm::PatternTerm):
+
+2010-11-24 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by Csaba Osztrogonác.
+
+ Remove Bakefile build system files
+ https://bugs.webkit.org/show_bug.cgi?id=49983
+
+ r53757 only removed the content, but not the files.
+ This patch removes that empty files.
+
+ * JavaScriptCoreSources.bkl: Removed.
+ * jscore.bkl: Removed.
+
+2010-11-24 Gabor Loki <loki@webkit.org>
+
+ Reviewed by Csaba Osztrogonác.
+
+ Merge the usage of jumps and calls at ARM-JIT
+ https://bugs.webkit.org/show_bug.cgi?id=50008
+
+ Those JmpSrc objects which represent jumps (not calls) should point to
+ after the jump instruction.
+
+ * assembler/ARMAssembler.h:
+ (JSC::ARMAssembler::blx):
+ (JSC::ARMAssembler::loadBranchTarget):
+ (JSC::ARMAssembler::getAbsoluteJumpAddress):
+ (JSC::ARMAssembler::linkJump):
+ (JSC::ARMAssembler::relinkJump):
+ (JSC::ARMAssembler::linkCall):
+ (JSC::ARMAssembler::relinkCall):
+ (JSC::ARMAssembler::getRelocatedAddress):
+ (JSC::ARMAssembler::getDifferenceBetweenLabels):
+ (JSC::ARMAssembler::getCallReturnOffset):
+ * assembler/MacroAssemblerARM.h:
+ (JSC::MacroAssemblerARM::call):
+
+2010-11-24 Carlos Garcia Campos <cgarcia@igalia.com>
+
+ Reviewed by Xan Lopez.
+
+ [GTK] Optimize foldCase, toLower and toUpper methods in glib unicode backend
+ https://bugs.webkit.org/show_bug.cgi?id=48625
+
+ GLib methods use UTF-8 strings, so we have to convert from UTF-16 to
+ UTF-8 to perform the case operations and then convert back the result to
+ UTF-16. GLib conversion methods return a new allocated string, so we
+ have to memcpy the result into the destination buffer too. Using our
+ own methods to convert between UTF-8 and UTF-16 from wtf/unicode/UTF8.h
+ we don't need such memcpy, since they take an already allocated buffer
+ rather than returning a new one. There's another optimization for the
+ case when the destination buffer is not large enough. In that case,
+ methods should return the expected destination buffer size and are
+ called again with a new buffer. We can avoid the conversion to UTF-16 by
+ pre-calculating the required size for the destination buffer.
+
+ * wtf/unicode/glib/UnicodeGLib.cpp:
+ (WTF::Unicode::getUTF16LengthFromUTF8):
+ (WTF::Unicode::convertCase):
+ (WTF::Unicode::foldCase):
+ (WTF::Unicode::toLower):
+ (WTF::Unicode::toUpper):
+
+2010-11-23 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by Sam Weinig.
+
+ Use WTF::StringHasher directly in JavaScriptCore
+ https://bugs.webkit.org/show_bug.cgi?id=49893
+
+ * profiler/CallIdentifier.h:
+ (JSC::CallIdentifier::Hash::hash):
+ * runtime/Identifier.cpp:
+ (JSC::IdentifierCStringTranslator::hash):
+ (JSC::IdentifierUCharBufferTranslator::hash):
+
+2010-11-22 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by Sam Weinig.
+
+ Add WTF::FixedArray::size()
+ https://bugs.webkit.org/show_bug.cgi?id=49891
+
+ Add a method to get the size of a FixedArray.
+
+ * wtf/FixedArray.h:
+ (WTF::FixedArray::size):
+
+2010-11-22 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by Adam Roben.
+
+ [WINCE] Set correct preprocessor definitions
+ https://bugs.webkit.org/show_bug.cgi?id=49887
+
+ * wtf/Platform.h:
+
+2010-11-22 Adam Roben <aroben@apple.com>
+
+ Use paths relative to $WebKitVSPropsRedirectionDir to access shared .vsprops files
+
+ Apple's Windows build allows placing header files and import libraries for WebKit's
+ dependencies (CoreGraphics, CFNetwork, SQLite, etc.) outside the source tree via the
+ $WebKitLibrariesDir environment variable. This is both required for production builds and
+ convenient for Apple-internal developer builds. Apple's production builds also require that
+ WebKit's shared .vsprops files be accessed relative to $WebKitLibrariesDir. In production
+ builds, the files are copied into that directory tree by the
+ WebKitLibraries/win/tools/WinTools.make file. In Apple-internal developer builds, the
+ copying is done by
+ JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make.
+
+ This .vsprops copying is problematic in one very important case: when a developer updates
+ their source tree and then tries to build. Visual Studio only reads .vsprops files when a
+ project is first loaded. So, when Visual Studio is first opened after the .vsprops files are
+ updated, it reads in the old files that were already residing in $WebKitLibrariesDir. When a
+ build is started, JavaScriptCoreGenerated.make copies the new .vsprops files into
+ $WebKitLibrariesDir, but Visual Studio will not pick up the changes. The rest of the build
+ will proceed with out-of-date .vsprops files, which will likely result in a build failure.
+
+ To fix this, we now use normal relative paths to access the .vsprops files in the source
+ tree rather than in $WebKitLibrariesDir, but prefix those paths with a new environment
+ variable, $WebKitVSPropsRedirectionDir. In developer builds, this environment variable is
+ unset, so the normal relative paths are used to read the .vsprops files out of the source
+ tree directly. In production builds, this environment variable is set to a fake directory
+ that will cause the .vsprops files in $WebKitLibrariesDir to be found when the relative path
+ is resolved.
+
+ For example, JavaScriptCore.vcproj uses this path for FeatureDefines.vsprops:
+
+ $(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefines.vsprops
+
+ In developer builds, where $WebKitVSPropsRedirectionDir is unset, this will point to the
+ files in WebKitLibraries\win\tools\vsprops in the source tree. In production builds,
+ JavaScriptCore.make sets $WebKitVSPropsRedirectionDir to
+ "$(SRCROOT)\AppleInternal\tools\vsprops\OpenSource\1\2\3\", so the full path for
+ FeatureDefines.vsprops becomes:
+
+ $(SRCROOT)\AppleInternal\tools\vsprops\OpenSource\1\2\3\..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefines.vsprops
+
+ which resolves to:
+
+ $(SRCROOT)\AppleInternal\tools\vsprops\OpenSource\WebKitLibraries\win\tools\vsprops\FeatureDefines.vsprops
+
+ (We rely on the fact that Windows doesn't care whether the directories "1", "2", and "3"
+ actually exist since they are matched by an equal number of ".." path components.)
+
+ Note that Visual Studio still won't pick up changes made to .vsprops files while Visual
+ Studio is open, but that problem hasn't seemed to cause developers many headaches so far.
+
+ Fixes <http://webkit.org/b/49181> Windows build fails mysteriously when .vsprops files are
+ updated
+
+ Reviewed by Dave Hyatt.
+
+ * JavaScriptCore.vcproj/JavaScriptCore.make: Set $WebKitVSPropsRedirectionDir so that
+ production builds can find the .vsprops files.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make: Stopy copying the
+ .vsprops files. It isn't needed anymore.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * JavaScriptCore.vcproj/jsc/jsc.vcproj:
+ * JavaScriptCore.vcproj/testapi/testapi.vcproj:
+ Changed to use paths relative to $WebKitVSPropsRedirectionDir to access shared .vsprops
+ files.
+
+2010-11-19 Peter Varga <pvarga@inf.u-szeged.hu>
+
+ Reviewed by Gavin Barraclough.
+
+ YARR JIT should fallback to YARR Interpreter instead of PCRE.
+ https://bugs.webkit.org/show_bug.cgi?id=46719
+
+ Remove the ENABLE_YARR macro and the option of matching regular
+ expressions with PCRE from JavaScriptCore.
+
+ * runtime/JSGlobalData.h:
+ * runtime/RegExp.cpp:
+ (JSC::RegExp::compile):
+ (JSC::RegExp::match):
+ * tests/mozilla/expected.html:
+ * wtf/Platform.h:
+ * yarr/RegexCompiler.cpp:
+ * yarr/RegexCompiler.h:
+ * yarr/RegexInterpreter.cpp:
+ (JSC::Yarr::byteCompileRegex):
+ * yarr/RegexInterpreter.h:
+ * yarr/RegexJIT.cpp:
+ (JSC::Yarr::jitCompileRegex):
+ * yarr/RegexJIT.h:
+ (JSC::Yarr::RegexCodeBlock::RegexCodeBlock):
+ (JSC::Yarr::RegexCodeBlock::~RegexCodeBlock):
+ (JSC::Yarr::RegexCodeBlock::getFallback):
+ (JSC::Yarr::RegexCodeBlock::isFallback):
+ (JSC::Yarr::RegexCodeBlock::setFallback):
+ (JSC::Yarr::executeRegex):
+ * yarr/RegexParser.h:
+ * yarr/RegexPattern.h:
+
+2010-11-20 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by David Kilzer.
+
+ [BREWMP] Replace DBGPRINTF and DBGPRINTF_FATAL with dbg_Message
+ https://bugs.webkit.org/show_bug.cgi?id=49520
+
+ DBGPRINTF and DBGPRINTF_FATAL macros are prohibited in Mod1. Use dbg_Message instead.
+
+ * wtf/Assertions.cpp:
+ * wtf/Assertions.h:
+
+2010-11-20 Gabor Loki <loki@webkit.org>
+
+ Reviewed by Gavin Barraclough.
+
+ Support JIT_OPTIMIZE_MOD on Thumb-2
+ https://bugs.webkit.org/show_bug.cgi?id=49432
+
+ Rewrite the soft modulo operation into macroassembler form, and move it
+ to JSValue32_64 section.
+ Add support for soft modulo on Thumb-2 JIT also.
+
+ * assembler/ARMv7Assembler.h:
+ (JSC::ARMv7Assembler::clz):
+ * assembler/MacroAssemblerARM.h:
+ (JSC::MacroAssemblerARM::countLeadingZeros32):
+ (JSC::MacroAssemblerARM::relativeTableJump):
+ * assembler/MacroAssemblerARMv7.h:
+ (JSC::MacroAssemblerARMv7::countLeadingZeros32):
+ (JSC::MacroAssemblerARMv7::relativeTableJump):
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emit_op_mod):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ * jit/JITOpcodes32_64.cpp:
+ (JSC::JIT::softModulo):
+ * jit/JITStubs.cpp:
+ (JSC::JITThunks::JITThunks):
+ * wtf/Platform.h:
+
+2010-11-20 David Kilzer <ddkilzer@apple.com>
+
+ <http://webkit.org/b/49848> Make it possible to display the last character of a secure text field unobscured
+
+ Reviewed by Darin Adler.
+
+ * JavaScriptCore.exp:
+ * wtf/text/StringImpl.cpp:
+ (WTF::StringImpl::secure): Added argument that controls whether
+ the last character is obscured or not. Implemented behavior.
+ * wtf/text/StringImpl.h:
+ (WTF::StringImpl::LastCharacterBehavior): Added enum.
+ (WTF::StringImpl::secure): Updated method signature.
+
+2010-11-19 William Chan <willchan@chromium.org>
+
+ Reviewed by David Levin.
+
+ Add USE(CHROMIUM_NET)
+
+ Indicates the use of Chromium's network stack. Chromium's network
+ stack performs better when it has full view of all resource requests,
+ so USE(CHROMIUM_NET) can be used to bypass throttles.
+
+ https://bugs.webkit.org/show_bug.cgi?id=49778
+
+ * wtf/Platform.h:
+
+2010-11-19 Steve Falkenburg <sfalken@apple.com>
+
+ Reviewed by Adam Roben.
+
+ Add Debug_Cairo_CFLite and Release_Cairo_CFLite configurations for all vcproj files
+ https://bugs.webkit.org/show_bug.cgi?id=49819
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.vcproj:
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * JavaScriptCore.vcproj/WTF/WTFCommon.vsprops:
+ * JavaScriptCore.vcproj/jsc/jsc.vcproj:
+ * JavaScriptCore.vcproj/testapi/testapi.vcproj:
+
+2010-11-19 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Don't check for constant registers when we can guarantee that the register won't be in the constant pool
+ https://bugs.webkit.org/show_bug.cgi?id=49814
+
+ Add uncheckedR(int) to CallFrame, and replace all the uses of r() with uncheckedR()
+ when we can guarantee that the register is not referring to a constant.
+ This makes the interpreter about 0.5% faster, and makes the CallFrame initialisation
+ logic correct when we're using a faked callframe (as in the case of the globalExec).
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::createActivation):
+ * debugger/DebuggerCallFrame.cpp:
+ (JSC::DebuggerCallFrame::thisObject):
+ * interpreter/CallFrame.h:
+ (JSC::ExecState::uncheckedR):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::resolve):
+ (JSC::Interpreter::resolveSkip):
+ (JSC::Interpreter::resolveGlobal):
+ (JSC::Interpreter::resolveGlobalDynamic):
+ (JSC::Interpreter::resolveBase):
+ (JSC::Interpreter::resolveBaseAndProperty):
+ (JSC::Interpreter::callEval):
+ (JSC::Interpreter::unwindCallFrame):
+ (JSC::Interpreter::throwException):
+ (JSC::Interpreter::execute):
+ (JSC::Interpreter::executeCall):
+ (JSC::Interpreter::executeConstruct):
+ (JSC::Interpreter::prepareForRepeatCall):
+ (JSC::Interpreter::createExceptionScope):
+ (JSC::Interpreter::privateExecute):
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+ * runtime/JSActivation.cpp:
+ (JSC::JSActivation::argumentsGetter):
+
+2010-11-19 Steve Falkenburg <sfalken@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Normalize Cairo/CFLite project/solution configuration names
+ https://bugs.webkit.org/show_bug.cgi?id=49818
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.vcproj/jsc/jsc.vcproj:
+ * JavaScriptCore.vcproj/testapi/testapi.vcproj:
+
+2010-11-18 Steve Falkenburg <sfalken@apple.com>
+
+ Reviewed by Adam Roben.
+
+ Windows vcproj configuration names should be normalized across projects
+ https://bugs.webkit.org/show_bug.cgi?id=49776
+
+ * JavaScriptCore.vcproj/JavaScriptCore.sln:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.vcproj:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGeneratedCommon.vsprops: Added.
+ * JavaScriptCore.vcproj/JavaScriptCoreSubmit.sln:
+
+2010-11-19 Patrick Gansterer <paroga@webkit.org>
+
+ Unreviewed, build fix after r72360.
+
+ * bytecode/CodeBlock.h:
+ (JSC::CodeBlock::bytecodeOffset):
+
+2010-11-18 Gavin Barraclough <barraclough@apple.com>
+
+ Rubber stamped by Geoff Garen.
+
+ Bug 49577 - Function.prototype should be non-configurable
+
+ Ooops, Function.prototype should not be enumerable!
+
+ * runtime/JSFunction.cpp:
+ (JSC::JSFunction::getOwnPropertySlot):
+
+2010-11-18 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 49708 - Stop recompiling functions to regenerate exception info.
+
+ Instead only hold info as necessary – keep divot info is the inspector
+ is enabled, line number info is debugging or profiling, and handler
+ info for functions with try/catch.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::dumpStatistics):
+ (JSC::CodeBlock::CodeBlock):
+ (JSC::CodeBlock::lineNumberForBytecodeOffset):
+ (JSC::CodeBlock::expressionRangeForBytecodeOffset):
+ (JSC::CodeBlock::shrinkToFit):
+ * bytecode/CodeBlock.h:
+ (JSC::CodeBlock::bytecodeOffset):
+ (JSC::CodeBlock::addExpressionInfo):
+ (JSC::CodeBlock::addLineInfo):
+ (JSC::CodeBlock::hasExpressionInfo):
+ (JSC::CodeBlock::hasLineInfo):
+ (JSC::CodeBlock::needsCallReturnIndices):
+ (JSC::CodeBlock::callReturnIndexVector):
+ * bytecode/SamplingTool.cpp:
+ (JSC::SamplingTool::dump):
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::generate):
+ (JSC::BytecodeGenerator::BytecodeGenerator):
+ * bytecompiler/BytecodeGenerator.h:
+ (JSC::BytecodeGenerator::emitNode):
+ (JSC::BytecodeGenerator::emitNodeInConditionContext):
+ (JSC::BytecodeGenerator::emitExpressionInfo):
+ (JSC::BytecodeGenerator::addLineInfo):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::unwindCallFrame):
+ (JSC::appendSourceToError):
+ (JSC::Interpreter::throwException):
+ (JSC::Interpreter::privateExecute):
+ (JSC::Interpreter::retrieveLastCaller):
+ * interpreter/Interpreter.h:
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompile):
+ * jit/JITStubs.cpp:
+ (JSC::jitThrow):
+ (JSC::DEFINE_STUB_FUNCTION):
+ * runtime/Collector.cpp:
+ (JSC::Heap::markRoots):
+ * runtime/Executable.cpp:
+ (JSC::EvalExecutable::compileInternal):
+ (JSC::ProgramExecutable::compileInternal):
+ (JSC::FunctionExecutable::compileForCallInternal):
+ (JSC::FunctionExecutable::compileForConstructInternal):
+ * runtime/Executable.h:
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData):
+ * runtime/JSGlobalData.h:
+ (JSC::JSGlobalData::usingAPI):
+ * runtime/JSGlobalObject.h:
+ (JSC::JSGlobalObject::supportsRichSourceInfo):
+ (JSC::JSGlobalObject::globalData):
+
+2010-11-18 Adam Roben <aroben@apple.com>
+
+ Add a script to delete manifest-related files when they are older than
+ any .vsprops file
+
+ Changes to .vsprops files can cause the manifest files to become
+ invalid, and Visual Studio doesn't always figure out that it needs to
+ rebuild them.
+
+ Reviewed by Sam Weinig.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make:
+ Call the new script.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.vcproj:
+ Added the new script.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/react-to-vsprops-changes.py: Added.
+ (file_modification_times): Generator to return the modification time of
+ each file in a directory hierarchy.
+ (main): Get the modification time of the newest vsprops file, then find
+ all manifest-related files in the obj directory. Delete all
+ manifest-related files that are older than the newest vsprops file.
+
+2010-11-18 Mark Rowe <mrowe@apple.com>
+
+ Rubber-stamped by Adam Roben.
+
+ <rdar://problem/8602509&8602717&8602724> Enable compaction support.
+
+ * Configurations/JavaScriptCore.xcconfig:
+
+2010-11-18 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 49635 - Profiler implementation is fragile
+
+ The profile presently requires the exception handling mechanism to explicitly
+ remove all stack frames that are exited during the exception unwind mechanism.
+ This is fragile in a number of ways:
+ * We have to change bytecode register allocation when compiling code to run
+ when profiling, to preserve the callee function (this is also required to
+ call did_call after the call has returned).
+ * In the JIT we have to maintain additional data structures
+ (CodeBlock::RareData::m_functionRegisterInfos) to map back to the register
+ containing the callee.
+ * In the interpreter we use 'magic values' to offset into the instruction
+ stream to rediscover the register containing the function.
+
+ Instead, move profiling into the head and tail of functions.
+ * This correctly accounts the cost of the call itself to the caller.
+ * This allows us to access the callee function object from the callframe.
+ * This means that at the point a call is made we can track the stack depth
+ on the ProfileNode.
+ * When unwinding we can simply report the depth at which the exception is
+ being handled - all call frames above this level are freed.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::shrinkToFit):
+ * bytecode/CodeBlock.h:
+ (JSC::CodeBlock::bytecodeOffset):
+ (JSC::CodeBlock::methodCallLinkInfo):
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::emitCall):
+ (JSC::BytecodeGenerator::emitCallVarargs):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::unwindCallFrame):
+ (JSC::Interpreter::throwException):
+ (JSC::Interpreter::execute):
+ (JSC::Interpreter::executeCall):
+ (JSC::Interpreter::executeConstruct):
+ (JSC::Interpreter::privateExecute):
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+ * profiler/Profile.cpp:
+ (JSC::Profile::Profile):
+ * profiler/ProfileGenerator.cpp:
+ (JSC::ProfileGenerator::addParentForConsoleStart):
+ (JSC::ProfileGenerator::willExecute):
+ (JSC::ProfileGenerator::didExecute):
+ (JSC::ProfileGenerator::exceptionUnwind):
+ (JSC::ProfileGenerator::stopProfiling):
+ * profiler/ProfileGenerator.h:
+ * profiler/ProfileNode.cpp:
+ (JSC::ProfileNode::ProfileNode):
+ (JSC::ProfileNode::willExecute):
+ * profiler/ProfileNode.h:
+ (JSC::ProfileNode::create):
+ (JSC::ProfileNode::callerCallFrame):
+ * profiler/Profiler.cpp:
+ (JSC::dispatchFunctionToProfiles):
+ (JSC::Profiler::_willExecute):
+ (JSC::Profiler::_didExecute):
+ (JSC::Profiler::exceptionUnwind):
+ * profiler/Profiler.h:
+
+2010-11-18 Steve Falkenburg <sfalken@apple.com>
+
+ Reviewed by Adam Roben.
+
+ Remove leftover Windows Debug_Internal configurations
+ https://bugs.webkit.org/show_bug.cgi?id=49758
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * JavaScriptCore.vcproj/jsc/jsc.vcproj:
+ * JavaScriptCore.vcproj/testapi/testapi.vcproj:
+
+2010-11-18 Chao-ying Fu <fu@mips.com>
+
+ Reviewed by Csaba Osztrogonác.
+
+ Avoid increasing required alignment of target type warning
+ https://bugs.webkit.org/show_bug.cgi?id=43963
+
+ * runtime/UString.h:
+ (JSC::UStringHash::equal):
+ * wtf/StdLibExtras.h:
+
+2010-11-17 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Anders Carlsson.
+
+ Add stubbed out ScrollAnimator for the Mac
+ https://bugs.webkit.org/show_bug.cgi?id=49678
+
+ * wtf/Platform.h: Enable SMOOTH_SCROLLING on the Mac, this has no
+ change in behavior at the moment.
+
+2010-11-17 David Kilzer <ddkilzer@apple.com>
+
+ <http://webkit.org/b/49634> Make overflow guards in WTF::String::utf8 explicit
+
+ Reviewed by Darin Adler.
+
+ Add an explicit overflow check prior to allocating our buffer,
+ rather than implicitly relying on the guard in convertUTF16ToUTF8.
+
+ * wtf/text/WTFString.cpp:
+ (WTF::String::utf8):
+
+2010-11-17 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r72197.
+ http://trac.webkit.org/changeset/72197
+ https://bugs.webkit.org/show_bug.cgi?id=49661
+
+ broke fast/regex/test1.html (Requested by stampho on #webkit).
+
+ * runtime/JSGlobalData.h:
+ * runtime/RegExp.cpp:
+ (JSC::RegExpRepresentation::~RegExpRepresentation):
+ (JSC::RegExp::compile):
+ (JSC::RegExp::match):
+ * tests/mozilla/expected.html:
+ * wtf/Platform.h:
+ * yarr/RegexCompiler.cpp:
+ * yarr/RegexCompiler.h:
+ * yarr/RegexInterpreter.cpp:
+ * yarr/RegexInterpreter.h:
+ * yarr/RegexJIT.cpp:
+ (JSC::Yarr::jitCompileRegex):
+ * yarr/RegexJIT.h:
+ (JSC::Yarr::RegexCodeBlock::RegexCodeBlock):
+ (JSC::Yarr::RegexCodeBlock::~RegexCodeBlock):
+ (JSC::Yarr::RegexCodeBlock::getFallback):
+ (JSC::Yarr::RegexCodeBlock::setFallback):
+ (JSC::Yarr::executeRegex):
+ * yarr/RegexParser.h:
+ * yarr/RegexPattern.h:
+
+2010-11-17 Peter Varga <pvarga@inf.u-szeged.hu>
+
+ Reviewed by Gavin Barraclough.
+
+ YARR JIT should fallback to YARR Interpreter instead of PCRE.
+ https://bugs.webkit.org/show_bug.cgi?id=46719
+
+ Remove the ENABLE_YARR macro and the option of matching regular
+ expressions with PCRE from JavaScriptCore.
+
+ * runtime/JSGlobalData.h:
+ * runtime/RegExp.cpp:
+ (JSC::RegExp::compile):
+ (JSC::RegExp::match):
+ * tests/mozilla/expected.html:
+ * wtf/Platform.h:
+ * yarr/RegexCompiler.cpp:
+ * yarr/RegexCompiler.h:
+ * yarr/RegexInterpreter.cpp:
+ (JSC::Yarr::byteCompileRegex):
+ * yarr/RegexInterpreter.h:
+ * yarr/RegexJIT.cpp:
+ (JSC::Yarr::jitCompileRegex):
+ * yarr/RegexJIT.h:
+ (JSC::Yarr::RegexCodeBlock::RegexCodeBlock):
+ (JSC::Yarr::RegexCodeBlock::~RegexCodeBlock):
+ (JSC::Yarr::RegexCodeBlock::getFallback):
+ (JSC::Yarr::RegexCodeBlock::isFallback):
+ (JSC::Yarr::RegexCodeBlock::setFallback):
+ (JSC::Yarr::executeRegex):
+ * yarr/RegexParser.h:
+ * yarr/RegexPattern.h:
+
+2010-11-17 Peter Varga <pvarga@inf.u-szeged.hu>
+
+ Reviewed by Gavin Barraclough.
+
+ Extend YARR Interpreter with beginning character look-up optimization
+ https://bugs.webkit.org/show_bug.cgi?id=45751
+
+ Add beginning character look-up optimization which sets the start
+ index to the first possible successful pattern match.
+ Extend YARR Interpreter with lookupForBeginChars function which
+ implements the beginning character look-up optimization.
+
+ * yarr/RegexInterpreter.cpp:
+ (JSC::Yarr::Interpreter::InputStream::readPair):
+ (JSC::Yarr::Interpreter::InputStream::isNotAvailableInput):
+ (JSC::Yarr::Interpreter::lookupForBeginChars):
+ (JSC::Yarr::Interpreter::matchDisjunction):
+ (JSC::Yarr::Interpreter::interpret):
+ * yarr/RegexInterpreter.h:
+ (JSC::Yarr::BytecodePattern::BytecodePattern):
+
+2010-11-17 Alexis Menard <alexis.menard@nokia.com>, Simon Hausmann <simon.hausmann@nokia.com>
+
+ Reviewed by Kenneth Christiansen, Tor Arne Vestbø.
+
+ [Qt] Add support for use GStreamer with the Qt build
+
+ Enable the build/inclusion of the wtf/QObject convenience classes.
+
+ * JavaScriptCore.pri:
+ * wtf/wtf.pri:
+
+2010-11-17 Peter Varga <pvarga@inf.u-szeged.hu>
+
+ Reviewed by Gavin Barraclough.
+
+ Collect the beginning characters in a RegExp pattern for look-up
+ optimization
+ https://bugs.webkit.org/show_bug.cgi?id=45748
+
+ Extend the YARR's parser with an algorithm which collects the potential
+ beginning characters from a RegExp pattern for later look-up optimization.
+
+ * yarr/RegexCompiler.cpp:
+ (JSC::Yarr::BeginCharHelper::BeginCharHelper):
+ (JSC::Yarr::BeginCharHelper::addBeginChar):
+ (JSC::Yarr::BeginCharHelper::merge):
+ (JSC::Yarr::BeginCharHelper::addCharacter):
+ (JSC::Yarr::BeginCharHelper::linkHotTerms):
+ (JSC::Yarr::RegexPatternConstructor::RegexPatternConstructor):
+ (JSC::Yarr::RegexPatternConstructor::addBeginTerm):
+ (JSC::Yarr::RegexPatternConstructor::setupDisjunctionBeginTerms):
+ (JSC::Yarr::RegexPatternConstructor::setupAlternativeBeginTerms):
+ (JSC::Yarr::RegexPatternConstructor::setupBeginChars):
+ (JSC::Yarr::compileRegex):
+ * yarr/RegexPattern.h:
+ (JSC::Yarr::TermChain::TermChain):
+ (JSC::Yarr::BeginChar::BeginChar):
+ (JSC::Yarr::RegexPattern::RegexPattern):
+ (JSC::Yarr::RegexPattern::reset):
+
+2010-11-17 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r72160.
+ http://trac.webkit.org/changeset/72160
+ https://bugs.webkit.org/show_bug.cgi?id=49646
+
+ Broke lots of fast/profiler tests, among others (Requested by
+ aroben on #webkit).
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::dump):
+ (JSC::CodeBlock::functionRegisterForBytecodeOffset):
+ (JSC::CodeBlock::shrinkToFit):
+ * bytecode/CodeBlock.h:
+ (JSC::CodeBlock::addFunctionRegisterInfo):
+ * bytecode/Opcode.h:
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::BytecodeGenerator):
+ (JSC::BytecodeGenerator::emitCall):
+ (JSC::BytecodeGenerator::emitCallVarargs):
+ (JSC::BytecodeGenerator::emitReturn):
+ (JSC::BytecodeGenerator::emitConstruct):
+ * bytecompiler/BytecodeGenerator.h:
+ (JSC::CallArguments::profileHookRegister):
+ * bytecompiler/NodesCodegen.cpp:
+ (JSC::CallArguments::CallArguments):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::unwindCallFrame):
+ (JSC::Interpreter::throwException):
+ (JSC::Interpreter::execute):
+ (JSC::Interpreter::executeCall):
+ (JSC::Interpreter::executeConstruct):
+ (JSC::Interpreter::privateExecute):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ * jit/JIT.h:
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_profile_will_call):
+ (JSC::JIT::emit_op_profile_did_call):
+ * jit/JITOpcodes32_64.cpp:
+ (JSC::JIT::emit_op_profile_will_call):
+ (JSC::JIT::emit_op_profile_did_call):
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+ * jit/JITStubs.h:
+ * profiler/Profile.cpp:
+ (JSC::Profile::Profile):
+ * profiler/ProfileGenerator.cpp:
+ (JSC::ProfileGenerator::addParentForConsoleStart):
+ (JSC::ProfileGenerator::willExecute):
+ (JSC::ProfileGenerator::didExecute):
+ (JSC::ProfileGenerator::stopProfiling):
+ * profiler/ProfileGenerator.h:
+ * profiler/ProfileNode.cpp:
+ (JSC::ProfileNode::ProfileNode):
+ (JSC::ProfileNode::willExecute):
+ * profiler/ProfileNode.h:
+ (JSC::ProfileNode::create):
+ (JSC::ProfileNode::operator==):
+ * profiler/Profiler.cpp:
+ (JSC::dispatchFunctionToProfiles):
+ (JSC::Profiler::willExecute):
+ (JSC::Profiler::didExecute):
+ * profiler/Profiler.h:
+
+2010-11-16 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Bug 49635 - Profiler implementation is fragile
+
+ The profile presently requires the exception handling mechanism to explicitly
+ remove all stack frames that are exited during the exception unwind mechanism.
+ This is fragile in a number of ways:
+ * We have to change bytecode register allocation when compiling code to run
+ when profiling, to preserve the callee function (this is also required to
+ call did_call after the call has returned).
+ * In the JIT we have to maintain additional data structures
+ (CodeBlock::RareData::m_functionRegisterInfos) to map back to the register
+ containing the callee.
+ * In the interpreter we use 'magic values' to offset into the instruction
+ stream to rediscover the register containing the function.
+
+ Instead, move profiling into the head and tail of functions.
+ * This correctly accounts the cost of the call itself to the caller.
+ * This allows us to access the callee function object from the callframe.
+ * This means that at the point a call is made we can track the stack depth
+ on the ProfileNode.
+ * When unwinding we can simply report the depth at which the exception is
+ being handled - all call frames above this level are freed.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::dump):
+ (JSC::CodeBlock::shrinkToFit):
+ * bytecode/CodeBlock.h:
+ (JSC::CodeBlock::bytecodeOffset):
+ (JSC::CodeBlock::methodCallLinkInfo):
+ * bytecode/Opcode.h:
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::BytecodeGenerator):
+ (JSC::BytecodeGenerator::emitCall):
+ (JSC::BytecodeGenerator::emitCallVarargs):
+ (JSC::BytecodeGenerator::emitReturn):
+ (JSC::BytecodeGenerator::emitConstruct):
+ * bytecompiler/BytecodeGenerator.h:
+ (JSC::CallArguments::count):
+ * bytecompiler/NodesCodegen.cpp:
+ (JSC::CallArguments::CallArguments):
+ * interpreter/Interpreter.cpp:
+ (JSC::ProfileHostCall::ProfileHostCall):
+ (JSC::ProfileHostCall::~ProfileHostCall):
+ (JSC::Interpreter::unwindCallFrame):
+ (JSC::Interpreter::throwException):
+ (JSC::Interpreter::execute):
+ (JSC::Interpreter::executeCall):
+ (JSC::Interpreter::executeConstruct):
+ (JSC::Interpreter::privateExecute):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ * jit/JIT.h:
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_profile_has_called):
+ (JSC::JIT::emit_op_profile_will_return):
+ * jit/JITOpcodes32_64.cpp:
+ (JSC::JIT::emit_op_profile_has_called):
+ (JSC::JIT::emit_op_profile_will_return):
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+ * jit/JITStubs.h:
+ * profiler/Profile.cpp:
+ (JSC::Profile::Profile):
+ * profiler/ProfileGenerator.cpp:
+ (JSC::ProfileGenerator::addParentForConsoleStart):
+ (JSC::ProfileGenerator::willExecute):
+ (JSC::ProfileGenerator::didExecute):
+ (JSC::ProfileGenerator::exceptionUnwind):
+ (JSC::ProfileGenerator::stopProfiling):
+ * profiler/ProfileGenerator.h:
+ * profiler/ProfileNode.cpp:
+ (JSC::ProfileNode::ProfileNode):
+ (JSC::ProfileNode::willExecute):
+ * profiler/ProfileNode.h:
+ (JSC::ProfileNode::create):
+ (JSC::ProfileNode::operator==):
+ (JSC::ProfileNode::exec):
+ * profiler/Profiler.cpp:
+ (JSC::dispatchFunctionToProfiles):
+ (JSC::Profiler::hasCalled):
+ (JSC::Profiler::willEvaluate):
+ (JSC::Profiler::willReturn):
+ (JSC::Profiler::didEvaluate):
+ (JSC::Profiler::exceptionUnwind):
+ * profiler/Profiler.h:
+
+2010-11-16 Brian Weinstein <bweinstein@apple.com>
+
+ Reviewed by Adam Roben and Steve Falkenburg.
+
+ Touch Platform.h to force a rebuild for Windows.
+
+ * wtf/Platform.h:
+
+2010-11-16 Steve Falkenburg <sfalken@apple.com>
+
+ Reviewed by Adam Roben.
+
+ Disable LTCG for Windows Release builds. Add new Release_LTCG configuration.
+ https://bugs.webkit.org/show_bug.cgi?id=49632
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * JavaScriptCore.vcproj/jsc/jsc.vcproj:
+ * JavaScriptCore.vcproj/testapi/testapi.vcproj:
+
+2010-11-16 Peter Varga <pvarga@inf.u-szeged.hu>
+
+ Reviewed by Gavin Barraclough.
+
+ The number of recursive match calls isn't limited in YARR Interpreter
+ https://bugs.webkit.org/show_bug.cgi?id=47906
+
+ Check the number of the matchDisjunction recursive calls to avoid unbounded
+ recursion.
+ Now the matchDisjunction function returns JSRegExpResult instead of bool.
+ The JSRegExpResult enum contains the result of matching or the error code
+ of the failure (like HitLimit) which terminates the matching.
+ The error codes are based on pcre's jsRegExpExecute error codes.
+
+ * yarr/RegexInterpreter.cpp:
+ (JSC::Yarr::Interpreter::parenthesesDoBacktrack):
+ (JSC::Yarr::Interpreter::matchParentheses):
+ (JSC::Yarr::Interpreter::backtrackParentheses):
+ (JSC::Yarr::Interpreter::matchDisjunction):
+ (JSC::Yarr::Interpreter::matchNonZeroDisjunction):
+ (JSC::Yarr::Interpreter::interpret):
+ (JSC::Yarr::Interpreter::Interpreter):
+ * yarr/RegexInterpreter.h:
+
+2010-11-16 Brian Weinstein <bweinstein@apple.com>
+
+ Rest of the Windows build fix.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-11-16 Gavin Barraclough <barraclough@apple.com>
+
+ Windows build fix pt 1.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-11-16 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ https://bugs.webkit.org/show_bug.cgi?id=49606
+
+ The bug here is that we read the prototype from the RHS argument using a regular
+ op_get_by_id before op_instanceof has checked that this is an object implementing
+ HasInstance. This incorrect behaviour gives rise to further unnecessary complexity
+ in the code base, since we have additional logic (implemented using the
+ GetByIdExceptionInfo data structures on CodeBlock) to convert not an object errors
+ from the get_by_id into invalid parameter errors. Having fixed this bug this code
+ is all redundant, since in these cases the get_by_id will never have been reached.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::dump):
+ (JSC::CodeBlock::shrinkToFit):
+ * bytecode/CodeBlock.h:
+ (JSC::CodeBlock::addExpressionInfo):
+ * bytecode/Opcode.h:
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::BytecodeGenerator):
+ (JSC::BytecodeGenerator::emitCheckHasInstance):
+ * bytecompiler/BytecodeGenerator.h:
+ * bytecompiler/NodesCodegen.cpp:
+ (JSC::InstanceOfNode::emitBytecode):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::throwException):
+ (JSC::Interpreter::privateExecute):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ (JSC::JIT::privateCompileSlowCases):
+ * jit/JIT.h:
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_check_has_instance):
+ (JSC::JIT::emit_op_instanceof):
+ (JSC::JIT::emitSlow_op_check_has_instance):
+ (JSC::JIT::emitSlow_op_instanceof):
+ * jit/JITOpcodes32_64.cpp:
+ (JSC::JIT::emit_op_check_has_instance):
+ (JSC::JIT::emit_op_instanceof):
+ (JSC::JIT::emitSlow_op_check_has_instance):
+ (JSC::JIT::emitSlow_op_instanceof):
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+ * jit/JITStubs.h:
+ * runtime/ExceptionHelpers.cpp:
+ (JSC::createInterruptedExecutionException):
+ (JSC::createTerminatedExecutionException):
+ (JSC::createUndefinedVariableError):
+ (JSC::createNotAFunctionError):
+ (JSC::createNotAnObjectError):
+ * runtime/ExceptionHelpers.h:
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData):
+ * runtime/JSGlobalData.h:
+ * runtime/JSNotAnObject.cpp:
+ (JSC::JSNotAnObject::toPrimitive):
+ (JSC::JSNotAnObject::getPrimitiveNumber):
+ (JSC::JSNotAnObject::toBoolean):
+ (JSC::JSNotAnObject::toNumber):
+ (JSC::JSNotAnObject::toString):
+ (JSC::JSNotAnObject::toObject):
+ (JSC::JSNotAnObject::getOwnPropertySlot):
+ (JSC::JSNotAnObject::getOwnPropertyDescriptor):
+ (JSC::JSNotAnObject::put):
+ (JSC::JSNotAnObject::deleteProperty):
+ (JSC::JSNotAnObject::getOwnPropertyNames):
+ * runtime/JSNotAnObject.h:
+ (JSC::JSNotAnObject::JSNotAnObject):
+ * runtime/JSObject.h:
+ (JSC::JSObject::isActivationObject):
+ * runtime/JSValue.cpp:
+ (JSC::JSValue::toObjectSlowCase):
+ (JSC::JSValue::synthesizeObject):
+ (JSC::JSValue::synthesizePrototype):
+
+2010-11-15 Darin Adler <darin@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Harden additional string functions against large lengths
+ https://bugs.webkit.org/show_bug.cgi?id=49574
+
+ * wtf/text/CString.cpp:
+ (WTF::CString::init): Check for length that is too large for CString.
+ (WTF::CString::newUninitialized): Ditto.
+ (WTF::CString::copyBufferIfNeeded): Fix types so the length stays
+ in a size_t.
+
+ * wtf/text/WTFString.cpp:
+ (WTF::String::append): Check for length that is too large.
+
+2010-11-15 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Bug 49577 - Function.prototype should be non-configurable
+
+ JSC lazily allocates the prototype property of Function objects.
+
+ We check the prototype exists on 'get', but not on 'put'.
+ If you 'put' without having first done a 'get' you can end up with a configurable
+ prototype (prototype should only ever be non-configurable).
+
+ This is visible in a couple of ways:
+ * 'delete' on the property may succeed. (the next access will result in a new,
+ reset prototype object).
+ * the prototype may be set to a getter.
+
+ * runtime/JSFunction.cpp:
+ (JSC::JSFunction::getOwnPropertyNames):
+ Reify the prototype property before allowing an enumerate including don't enum properties.
+ (JSC::JSFunction::put):
+ Reify the prototype property before any put to it.
+
+2010-11-15 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Bug 49488 - Only add source specific information to exceptions in Interpreter::throwException
+
+ Three types of source location information are added to errors.
+
+ (1) Divot information.
+
+ This was added with the intention of using it to provide better source highlighting in the inspector.
+ We may still want to do so, but we probably should not be exposing these values in a manner visible to
+ user scripts – only through an internal C++ interface. The code adding divot properties to objects has
+ been removed.
+
+ (2) Line number information.
+
+ Line number information is presently sometimes added at the point the exception is created, and sometimes
+ added at the point the exception passes through throwException. Change this so that throwException has
+ the sole responsibility for adding line number and source file information.
+
+ (3) Source snippets in the message of certain type errors (e.g. 'doc' in `Result of expression 'doc' [undefined] is not an object.`).
+
+ These messages are currently created at the point the exceptions is raised. Instead reformat the message
+ such that the source snippet is located at the end (`Result of expression 'b1' [undefined] is not an object.`
+ becomes `'undefined' is not an object (evaluating 'b1.property')`), and append these to the message at
+ the in throw Exception. This presents a number of advantages:
+ * we no longer need to have source location information to create these TypeErrors.
+ * we can chose to append source location information in other error messages, including those where
+ passing source location to the point of construction would be inconvenient.
+ * we can chose in future to omit to append source location information when running in a non-debug mode.
+
+ This also cleans up some error output, e.g. removing double brackets ('[[]]') around objects in output,
+ removing double periods (..) at end of lines, and adding slightly more context to some errors.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::expressionRangeForBytecodeOffset):
+ - Separated called to access line and range information.
+
+ * bytecode/CodeBlock.h:
+ - Separated called to access line and range information.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::resolve):
+ (JSC::Interpreter::resolveSkip):
+ (JSC::Interpreter::resolveGlobal):
+ (JSC::Interpreter::resolveGlobalDynamic):
+ (JSC::Interpreter::resolveBaseAndProperty):
+ (JSC::isInvalidParamForIn):
+ (JSC::isInvalidParamForInstanceOf):
+ - Update parameters passed to error constructors.
+ (JSC::appendSourceToError):
+ - Update message property to add location information (previously added in createErrorMessage, in ExceptionHelpers)
+ (JSC::Interpreter::throwException):
+ - Updated to call appendSourceToError.
+ (JSC::Interpreter::privateExecute):
+ - Update parameters passed to error constructors.
+
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+ - Update parameters passed to error constructors.
+
+ * runtime/Error.cpp:
+ (JSC::addErrorInfo):
+ (JSC::hasErrorInfo):
+ - Removed divot properties.
+
+ * runtime/Error.h:
+ - Removed divot properties.
+
+ * runtime/ErrorInstance.cpp:
+ (JSC::ErrorInstance::ErrorInstance):
+ - Initialize new property.
+
+ * runtime/ErrorInstance.h:
+ (JSC::ErrorInstance::appendSourceToMessage):
+ (JSC::ErrorInstance::setAppendSourceToMessage):
+ (JSC::ErrorInstance::clearAppendSourceToMessage):
+ - Added flag to check for errors needing location information appending.
+ (JSC::ErrorInstance::isErrorInstance):
+ - Added virtual method to check for ErrorInstances.
+
+ * runtime/ExceptionHelpers.cpp:
+ (JSC::createUndefinedVariableError):
+ (JSC::createInvalidParamError):
+ (JSC::createNotAConstructorError):
+ (JSC::createNotAFunctionError):
+ (JSC::createNotAnObjectError):
+ - Update parameters passed to error constructors, stopped adding line number information early, changed TypeError messages.
+
+ * runtime/ExceptionHelpers.h:
+ - Updated function signatures.
+
+ * runtime/JSFunction.cpp:
+ (JSC::callHostFunctionAsConstructor):
+ - Update parameters passed to error constructors.
+
+ * runtime/JSObject.h:
+ (JSC::JSObject::isErrorInstance):
+ - Added virtual method to check for ErrorInstances.
+
+2010-11-12 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Adam Roben.
+
+ CString(const char*) crashes when passed a null pointer
+ https://bugs.webkit.org/show_bug.cgi?id=49450
+
+ * wtf/text/CString.cpp:
+ (WTF::CString::CString):
+ Return early if str is null.
+
+2010-11-11 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 49420 - Clean up syntax/reference error throw.
+
+ Some errors detected at compile time are thrown at runtime. We currently do so using a op_new_error/op_throw bytecode pair.
+ This is not ideal. op_throw is used for explicit user throw statements, and has different requirements in terms or meta data
+ attached to the exception (controlled by the explicitThrow parameter passed to Interpreter::throwException). To work around
+ this, op_new_error has to add the meta data at an early stage, which is unlike other VM exceptions being raised.
+
+ We can simplify this and bring into line with other exception behaviour by changing new_error from just allocating an
+ Exception instance to also throwing it – but as a regular VM throw, correctly passing explicitThrow as false.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::dump):
+ (JSC::CodeBlock::expressionRangeForBytecodeOffset):
+ * bytecode/Opcode.h:
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::emitThrowReferenceError):
+ (JSC::BytecodeGenerator::emitThrowSyntaxError):
+ (JSC::BytecodeGenerator::emitThrowExpressionTooDeepException):
+ * bytecompiler/BytecodeGenerator.h:
+ (JSC::BytecodeGenerator::emitNodeInConditionContext):
+ * bytecompiler/NodesCodegen.cpp:
+ (JSC::ThrowableExpressionData::emitThrowReferenceError):
+ (JSC::ThrowableExpressionData::emitThrowSyntaxError):
+ (JSC::RegExpNode::emitBytecode):
+ (JSC::PostfixErrorNode::emitBytecode):
+ (JSC::PrefixErrorNode::emitBytecode):
+ (JSC::AssignErrorNode::emitBytecode):
+ (JSC::ForInNode::emitBytecode):
+ (JSC::ContinueNode::emitBytecode):
+ (JSC::BreakNode::emitBytecode):
+ (JSC::ReturnNode::emitBytecode):
+ (JSC::LabelNode::emitBytecode):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ * jit/JIT.h:
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_throw_reference_error):
+ (JSC::JIT::emit_op_throw_syntax_error):
+ * jit/JITOpcodes32_64.cpp:
+ (JSC::JIT::emit_op_throw_reference_error):
+ (JSC::JIT::emit_op_throw_syntax_error):
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+ * jit/JITStubs.h:
+ * parser/Nodes.h:
+
+2010-11-11 Darin Adler <darin@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Harden some string functions against large lengths
+ https://bugs.webkit.org/show_bug.cgi?id=49293
+
+ * wtf/text/StringImpl.cpp:
+ (WTF::StringImpl::create): Fix incorrect use of PassRefPtr. Check for
+ strlen results that are too large for StringImpl.
+ (WTF::StringImpl::lower): Check for lengths that are too large for
+ int32_t.
+ (WTF::StringImpl::upper): Fix incorrect use of PassRefPtr. Check for
+ lengths that are too large for int32_t.
+ (WTF::StringImpl::secure): Fix incorect use of PassRefPtr. Use unsigned
+ rather than int and int32_t so we can handle any length.
+ (WTF::StringImpl::foldCase): Fix incorrect use of PassRefPtr. Check for
+ lengths that are too large for int32_t.
+ (WTF::StringImpl::find): Check for strlen results that are too large for
+ StringImpl.
+ (WTF::StringImpl::findIgnoringCase): Ditto.
+ (WTF::StringImpl::replace): Fix incorrect use of PassRefPtr.
+ (WTF::StringImpl::createWithTerminatingNullCharacter): Check before
+ incrementing length.
+
+2010-11-11 Dan Horák <dan@danny.cz>
+
+ Reviewed by Andreas Kling.
+
+ Add support for the s390/s390x architectures, it's big-endian
+ with s390 being 32-bit and s390x being 64-bit.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34786
+
+ * wtf/Platform.h:
+
+2010-11-10 Csaba Osztrogonác <ossy@webkit.org>
+
+ Reviewed by David Hyatt.
+
+ HTML5 Ruby support should be mandatory feature
+ https://bugs.webkit.org/show_bug.cgi?id=49272
+
+ Remove Ruby as optional feature.
+
+ * Configurations/FeatureDefines.xcconfig:
+ * JavaScriptCorePrefix.h:: Touch it to avoid incremental build failure on Windows.
+
+2010-11-10 Peter Rybin <peter.rybin@gmail.com>
+
+ Reviewed by Adam Barth.
+
+ HTML parser should provide script column position within HTML document to JavaScript engine
+ https://bugs.webkit.org/show_bug.cgi?id=45271
+
+ Adds TextPosition* classes -- a structure that stores line/column/generation
+ level coordinates inside text document. Adds *BasedNumber classes -- typesafe int
+ wrappers that emphasize whether int number is used as zero-based or
+ one-based.
+
+ * GNUmakefile.am:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * wtf/text/TextPosition.h: Added.
+ (WTF::TextPosition::TextPosition):
+ (WTF::TextPosition::minimumPosition):
+ (WTF::TextPosition::belowRangePosition):
+ (WTF::ZeroBasedNumber::fromZeroBasedInt):
+ (WTF::ZeroBasedNumber::ZeroBasedNumber):
+ (WTF::ZeroBasedNumber::zeroBasedInt):
+ (WTF::ZeroBasedNumber::base):
+ (WTF::ZeroBasedNumber::belowBase):
+ (WTF::OneBasedNumber::fromOneBasedInt):
+ (WTF::OneBasedNumber::OneBasedNumber):
+ (WTF::OneBasedNumber::oneBasedInt):
+ (WTF::OneBasedNumber::convertAsZeroBasedInt):
+ (WTF::OneBasedNumber::convertToZeroBased):
+ (WTF::OneBasedNumber::base):
+ (WTF::OneBasedNumber::belowBase):
+ (WTF::toZeroBasedTextPosition):
+ (WTF::toOneBasedTextPosition):
+ (WTF::ZeroBasedNumber::convertToOneBased):
+
+2010-11-09 Gabor Loki <loki@webkit.org>
+
+ Reviewed by Gavin Barraclough.
+
+ ARM JIT asserts when loading http://reader.google.com in debug mode
+ https://bugs.webkit.org/show_bug.cgi?id=48912
+
+ There are several cases when the uninterrupted sequence is larger than
+ maximum required offset for pathing the same sequence. Eg.: if in a
+ uninterrupted sequence the last macroassembler's instruction is a stub
+ call, it emits store instruction(s) which should not be included in the
+ calculation of length of uninterrupted sequence. So, the insnSpace and
+ constSpace should be upper limit instead of hard limit.
+
+ * jit/JIT.h:
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::endUninterruptedSequence):
+
+2010-11-09 David Kilzer <ddkilzer@apple.com>
+
+ <http://webkit.org/b/49279> Fix include statements for local headers
+
+ Reviewed by Gavin Barraclough.
+
+ Use "Foo.h" instead of <Foo.h> for local headers.
+
+ * assembler/AbstractMacroAssembler.h: Also fixed sort order.
+ * assembler/CodeLocation.h:
+ * yarr/RegexJIT.h:
+ * yarr/RegexParser.h:
+
+2010-11-08 Adam Roben <aroben@apple.com>
+
+ Roll out r71532
+
+ It broke the build for Cygwin 1.7 installs. Cygwin 1.7's default
+ .bashrc unsets %TEMP%, which broke copy-tools.cmd.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.vcproj:
+ * JavaScriptCore.vcproj/JavaScriptCore/copy-tools.cmd: Removed.
+ * JavaScriptCore.vcproj/JavaScriptCore/show-alert.js: Removed.
+
+2010-11-08 Martin Robinson <mrobinson@igalia.com>
+
+ Reviewed by Xan Lopez.
+
+ >=webkitgtk-1.2.5: parallel build fails with libtool: link: cannot find the library `libwebkit-1.0.la' or unhandled argument `libwebkit-1.0.la'
+ https://bugs.webkit.org/show_bug.cgi?id=49128
+
+ r59042 introduced a C++-style comment in Platform.h, which is often
+ included in C source files. Change it to a C-style comment.
+
+ * wtf/Platform.h: Fix the C++-style comment.
+
+2010-11-08 Adam Roben <aroben@apple.com>
+
+ Show a message and cause the build to immediately fail when any
+ .vsprops files are copied
+
+ When $WebKitLibrariesDir is set to a non-standard location, the
+ .vsprops files have to be copied from WebKitLibraries/win to
+ $WebKitLibrariesDir. When this happens, Visual Studio doesn't pick up
+ changes to the .vsprops files until the next time it opens the solution
+ file. Before this patch, the build would soldier on with the old
+ .vsprops files, leading to strange build failures. Now we detect that
+ the .vsprops files have been updated, display a message to the user
+ telling them what to do, and make the build fail immediately.
+
+ Fixes <http://webkit.org/b/49181> Windows build fail mysteriously when
+ .vsprops files are updated
+
+ Reviewed by Steve Falkenburg.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make:
+ Moved code to copy the tools directory to the new copy-tools.cmd
+ script. Moved that after the command that writes the buildfailed file
+ so the build will be considered a failure if copy-tools.cmd fails.
+ Changed to write the project name into buildfailed like all our other
+ projects do, so those other projects will know that the failure was due
+ to this project.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.vcproj:
+ Added new scripts.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/copy-tools.cmd: Added. Copies
+ the tools directory to $WebKitLibrariesDir. If any files were copied,
+ we display a message to the user and exit with error code 1 to cause
+ the build to fail. In non-interactive builds, we just print the message
+ to the build log. In interactive builds, we show the message in an
+ alert.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/show-alert.js: Added. Uses
+ Windows Scripting Host to display a message in an alert.
+
+2010-11-07 Sam Magnuson <smagnuson@netflix.com>
+
+ Reviewed by Andreas Kling.
+
+ [Qt] make install does not cause JavaScriptCore to be built
+ https://bugs.webkit.org/show_bug.cgi?id=49114
+
+ * JavaScriptCore.pro:
+
+2010-11-05 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Website consistently crashing TOT in JIT::execute() on news.com.au
+ https://bugs.webkit.org/show_bug.cgi?id=48954
+
+ The problem here was the strict pass of this conversion was loading the
+ this structure into one register but doing the flags check off a different
+ register. This is clearly wrong. I have been unable to trigger the crash
+ with a reduction, but I've added an assertion to the this conversion to
+ attempt to make it more readily catchable in future.
+
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_convert_this_strict):
+ * jit/JITOpcodes32_64.cpp:
+ (JSC::JIT::emit_op_convert_this_strict):
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+
+2010-11-04 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Adam Barth.
+
+ Use leakRef instead of releaseRef
+ https://bugs.webkit.org/show_bug.cgi?id=48974
+
+ Use leakRef instead of the deprecated releaseRef. This was renamed
+ some time ago because 'releaseRef' is too close to 'release',
+ which does something completely different.
+
+2010-11-04 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Gavin Barraclough.
+
+ REGRESSION(49798): Crash in HTMLObjectElement::parseMappedAttribute
+ https://bugs.webkit.org/show_bug.cgi?id=48789
+
+ The contract for all String/AtomicString methods seems to be that it's
+ safe to call them, even when the String is null (impl() returns 0).
+ This contract was broken by r49798 (unintentionally) when optimizing
+ for dromeo.
+ This patch adds a null check to AtomicString::lower() fixing this
+ crash and preventing future confusion.
+
+ * wtf/text/AtomicString.cpp:
+ (WTF::AtomicString::lower):
+
+2010-11-04 Adam Barth <abarth@webkit.org>
+
+ Enabled ICCJPEG on Chromium Mac
+ https://bugs.webkit.org/show_bug.cgi?id=48977
+
+ * wtf/Platform.h:
+
+2010-11-03 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Crash in Function.prototype.call.apply
+ https://bugs.webkit.org/show_bug.cgi?id=48485
+
+ The problem here was op_load_varargs failing to ensure that
+ there was sufficient space for the entire callframe prior to
+ op_call_varargs. This meant that when we then re-entered the
+ VM it was possible to stomp over an earlier portion of the
+ stack, so causing sub-optimal behaviour.
+
+ * bytecode/Opcode.h:
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::emitLoadVarargs):
+ * bytecompiler/BytecodeGenerator.h:
+ * bytecompiler/NodesCodegen.cpp:
+ (JSC::ApplyFunctionCallDotNode::emitBytecode):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompile):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_load_varargs):
+
+2010-11-03 Kenneth Russell <kbr@google.com>
+
+ Reviewed by Chris Marrin.
+
+ Redesign extension mechanism in GraphicsContext3D
+ https://bugs.webkit.org/show_bug.cgi?id=46894
+
+ * JavaScriptCore.exp:
+ - Exposed String::split(const String&, Vector<String>).
+
+2010-11-03 Adam Roben <aroben@apple.com>
+
+ Bring WTF.vcproj up to date
+
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj: Added filters for the text and
+ unicode directories, added new files, removed old files.
+
+2010-11-03 Gabor Loki <loki@webkit.org>
+
+ Reviewed by Andreas Kling.
+
+ Remove unused initializeWeakRandomNumberGenerator
+ https://bugs.webkit.org/show_bug.cgi?id=48899
+
+ WeakRandom class is used instead of weakRandomNumber and its initializer.
+
+ * wtf/RandomNumberSeed.h:
+
+2010-11-03 Gabor Loki <loki@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ Unused class: JSFastMath with JSValue64
+ https://bugs.webkit.org/show_bug.cgi?id=48835
+
+ Remove unused JSFastMath class.
+
+ * runtime/JSImmediate.h:
+
+2010-11-02 Adam Roben <aroben@apple.com>
+
+ Windows build fix after r71127
+
+ MSVC isn't smart enough to figure out that the definition of the global
+ nullptr variable isn't needed, so we provide one for it.
+
+ Fixes <http://webkit.org/b/48862> Windows build is broken due to
+ undefined symbol nullptr
+
+ Reviewed by Anders Carlsson.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: Export nullptr.
+
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj: Added NullPtr.cpp and let VS
+ resort the files.
+
+ * wtf/NullPtr.cpp: Added.
+
+2010-11-02 Martin Robinson <mrobinson@igalia.com>
+
+ Reviewed by Xan Lopez.
+
+ Remove special handling of HashTableDeletedValue in PlatformRefPtr and manually manage memory that cannot be controlled by HashTraits
+ https://bugs.webkit.org/show_bug.cgi?id=48841
+
+ Remove special handling of HashTableDeletedValue in PlatformRefPtr.
+ This is better handled on a case-by-case basis, when HashTraits
+ cannot account for it.
+
+ * wtf/PlatformRefPtr.h:
+ (WTF::PlatformRefPtr::~PlatformRefPtr):
+ (WTF::PlatformRefPtr::clear):
+ (WTF::::operator):
+
+2010-10-29 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ REGRESSION: r69429-r69611: Crash in JSC::Interpreter::privateExecute
+ https://bugs.webkit.org/show_bug.cgi?id=47573
+
+ I think the interpreter portion of this was introduced by
+ an incorrect but silent merge when I updated prior to committing.
+ The JIT change is basically just a correctness fix, but it is
+ needed to prevent the testcase from asserting in debug builds.
+
+ The basic problem is incorrectly setting the activation object
+ on an arguments object. The crash was due to us setting a null
+ activation in the interpreter, in the jit we were setting the
+ activation of a strict mode arguments object.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+ * wtf/Platform.h:
+
+2010-10-29 Csaba Osztrogonác <ossy@webkit.org>
+
+ Reviewed by Adam Roben and David Kilzer.
+
+ Fix and cleanup of build systems
+ https://bugs.webkit.org/show_bug.cgi?id=48342
+
+ * Configurations/FeatureDefines.xcconfig: Add missing ENABLE_FULLSCREEN_API
+
+2010-10-28 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Darin Adler.
+
+ Include stddef.h unconditionally in Assertions.h
+ https://bugs.webkit.org/show_bug.cgi?id=48573
+
+ There is no reason to have stddef.h include be MSVC-only.
+
+ * wtf/Assertions.h:
+
+2010-10-28 Herczeg Zoltan <zherczeg@webkit.org>
+
+ Rubber stamped by Csaba Osztrogonác.
+
+ Try to fix interpreter build.
+
+ Needed parentheses around assignment to avoid GCC warning after
+ http://trac.webkit.org/changeset/70703
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+
+2010-10-28 Peter Varga <pvarga@inf.u-szeged.hu>
+
+ Reviewed by Csaba Osztrogonác.
+
+ resetAssertionMatches() is an unused function in YARR Interpreter
+ https://bugs.webkit.org/show_bug.cgi?id=48503
+
+ The resetAssertionMatches() function is removed from YARR Interpreter
+ because it's never called.
+
+ * yarr/RegexInterpreter.cpp:
+ (JSC::Yarr::Interpreter::resetMatches):
+
+2010-10-28 Zoltan Herczeg <zherczeg@webkit.org>
+
+ Reviewed by Andreas Kling.
+
+ Wrong instruction form for BKPT
+ https://bugs.webkit.org/show_bug.cgi?id=48427
+
+ One '0' is missing from BKPT instruction.
+ Thanks for Jacob Bramley for reporting this error.
+
+ * assembler/ARMAssembler.h:
+
+2010-10-28 Xan Lopez <xlopez@igalia.com>
+
+ Try to fix Snow Leopard build.
+
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::testPrototype):
+
+2010-10-28 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Oliver Hunt.
+
+ Do not have two different asCell APIs in JSValue
+ https://bugs.webkit.org/show_bug.cgi?id=47979
+
+ Remove JSCell* asCell(JSValue) in favor of only using
+ JSValue::asCell().
+
+ * API/APICast.h:
+ (toRef):
+ * jit/JITPropertyAccess32_64.cpp:
+ (JSC::JIT::testPrototype):
+ * jit/JITStubs.cpp:
+ (JSC::JITThunks::tryCachePutByID):
+ (JSC::JITThunks::tryCacheGetByID):
+ (JSC::DEFINE_STUB_FUNCTION):
+ * runtime/GetterSetter.h:
+ (JSC::asGetterSetter):
+ * runtime/JSByteArray.h:
+ (JSC::asByteArray):
+ * runtime/JSCell.h:
+ (JSC::JSCell::getCallData):
+ (JSC::JSCell::getConstructData):
+ * runtime/JSString.h:
+ (JSC::RopeBuilder::appendValueInConstructAndIncrementLength):
+ (JSC::asString):
+ * runtime/JSValue.h:
+ * runtime/Operations.cpp:
+ (JSC::jsIsObjectType):
+ * runtime/Operations.h:
+ (JSC::normalizePrototypeChain):
+ * runtime/Protect.h:
+ (JSC::gcProtect):
+ (JSC::gcUnprotect):
+
+2010-10-27 Chao-ying Fu <fu@mips.com>
+
+ Reviewed by Oliver Hunt.
+
+ Support emit_op_mod() for MIPS on JSVALUE32_64
+ https://bugs.webkit.org/show_bug.cgi?id=46511
+
+ This patch uses MIPS div instructions for op_mod to improve performance.
+
+ * jit/JITArithmetic32_64.cpp:
+ (JSC::JIT::emit_op_mod):
+
+2010-10-27 Brent Fulgham <bfulgham@webkit.org>
+
+ Unreviewed build correction.
+
+ * wtf/Platform.h: Make sure ACCELERATED_COMPOSITING is
+ turned off in the WinCairo port. This isn't supported (yet.)
+
+2010-10-27 Chris Rogers <crogers@google.com>
+
+ Reviewed by Chris Marrin.
+
+ Add ENABLE_WEB_AUDIO feature enable flag (initially disabled) to build-webkit
+ https://bugs.webkit.org/show_bug.cgi?id=48279
+
+ * Configurations/FeatureDefines.xcconfig:
+
+2010-10-27 Brian Weinstein <bweinstein@apple.com>
+
+ Windows build fix.
+
+ * jit/JITStubs.cpp:
+ (JSC::jitThrow):
+
+2010-10-27 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 48365 - Remove output parameters from JITStackFrame
+
+ The JIT stub functions presently use the stackframe to provide a couple of additional return values.
+ * In the case of uncaught exceptions the exception value is returned on the stackframe.exception property.
+ * In the case of caught exceptions the updated value for the callFrame register is returned on the stackframe.callFrame property.
+
+ Change exception returns such that exceptions are always returned on JSGlobalData::exception.
+ Change op_catch such that the new CallFrame value is returned from op_throw / vm_throw in regT0.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * debugger/Debugger.cpp:
+ (JSC::evaluateInGlobalCallFrame):
+ * debugger/DebuggerCallFrame.cpp:
+ (JSC::DebuggerCallFrame::evaluate):
+ * interpreter/CachedCall.h:
+ (JSC::CachedCall::CachedCall):
+ (JSC::CachedCall::call):
+ * interpreter/CallFrame.h:
+ (JSC::ExecState::exception):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::callEval):
+ (JSC::Interpreter::Interpreter):
+ (JSC::Interpreter::execute):
+ (JSC::Interpreter::executeCall):
+ (JSC::Interpreter::executeConstruct):
+ (JSC::Interpreter::prepareForRepeatCall):
+ (JSC::Interpreter::privateExecute):
+ * interpreter/Interpreter.h:
+ * jit/JITCode.h:
+ (JSC::JITCode::execute):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_catch):
+ * jit/JITOpcodes32_64.cpp:
+ (JSC::JIT::emit_op_catch):
+ * jit/JITStubs.cpp:
+ (JSC::ctiTrampoline):
+ (JSC::jitThrow):
+ (JSC::DEFINE_STUB_FUNCTION):
+ * jit/JITStubs.h:
+ * runtime/ArrayPrototype.cpp:
+ (JSC::arrayProtoFuncFilter):
+ (JSC::arrayProtoFuncMap):
+ (JSC::arrayProtoFuncEvery):
+ (JSC::arrayProtoFuncForEach):
+ (JSC::arrayProtoFuncSome):
+ (JSC::arrayProtoFuncReduce):
+ (JSC::arrayProtoFuncReduceRight):
+ * runtime/CallData.cpp:
+ (JSC::call):
+ * runtime/Completion.cpp:
+ (JSC::evaluate):
+ * runtime/ConstructData.cpp:
+ (JSC::construct):
+ * runtime/ExceptionHelpers.cpp:
+ (JSC::createErrorForInvalidGlobalAssignment):
+ (JSC::throwOutOfMemoryError):
+ (JSC::throwStackOverflowError):
+ * runtime/ExceptionHelpers.h:
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::sort):
+ * runtime/JSGlobalObjectFunctions.cpp:
+ (JSC::globalFuncEval):
+ * runtime/StringPrototype.cpp:
+ (JSC::stringProtoFuncReplace):
+
+2010-10-27 Gabor Loki <loki@webkit.org>
+
+ Reviewed by Oliver Hunt.
+
+ https://bugs.webkit.org/show_bug.cgi?id=48060
+ Speed up op_jeq_null and op_jneq_null.
+
+ For both opcodes the NullTag and UndefinedTag are checked to control the
+ jump. These values can be simply checked by AboveOrEqual or Below
+ condition if they are the two highest unsigned integers from JSValue's
+ Tag field.
+
+ * jit/JITOpcodes32_64.cpp:
+ (JSC::JIT::emit_op_jeq_null):
+ (JSC::JIT::emit_op_jneq_null):
+ * runtime/JSValue.h:
+
+2010-10-25 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ https://bugs.webkit.org/show_bug.cgi?id=41948
+ REGRESSION(r60392): Registerfile can be unwound too far following an exception
+
+ SunSpider reports no change.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::throwException): Walk the stack to calculate the high
+ water mark currently in use. It's not safe to assume that the current
+ CallFrame's high water mark is the highest high water mark because
+ calls do not always set up at the end of a CallFrame. A large caller
+ CallFrame can encompass a small callee CallFrame.
+
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::privateCompileCTINativeCall):
+ * jit/JITOpcodes32_64.cpp:
+ (JSC::JIT::privateCompileCTINativeCall): Make sure to set a 0 CodeBlock
+ in the CallFrame of a host call, like the Interpreter does, instead of
+ leaving the CodeBlock field uninitialized. The backtracing code requires
+ a valid CodeBlock field in each CallFrame.
+
+2010-10-27 Gabor Loki <loki@webkit.org>
+
+ Reviewed by Csaba Osztrogonác.
+
+ Add cmn to branch32(reg, imm) on ARM
+ https://bugs.webkit.org/show_bug.cgi?id=48062
+
+ The conditional comparison can be done with cmn if the imm value is
+ negative and can fit into the cmn instruction.
+
+ * assembler/MacroAssemblerARM.h:
+ (JSC::MacroAssemblerARM::branch32):
+
+2010-10-26 Oliver Hunt <oliver@apple.com>
+
+ Interpreter build fix.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+
+2010-10-25 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Remove exec and globalData arguments from jsNumber
+ https://bugs.webkit.org/show_bug.cgi?id=48270
+
+ Remove the now unused exec and globalData arguments from jsNumber
+ and mechanically update all users of jsNumber.
+
+ * API/JSValueRef.cpp:
+ (JSValueMakeNumber):
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::emitLoad):
+ * bytecompiler/NodesCodegen.cpp:
+ (JSC::ArrayNode::emitBytecode):
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emit_op_mod):
+ * jit/JITArithmetic32_64.cpp:
+ (JSC::JIT::emit_op_mod):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_jfalse):
+ (JSC::JIT::emit_op_jtrue):
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+ * jsc.cpp:
+ (functionRun):
+ * runtime/Arguments.cpp:
+ (JSC::Arguments::getOwnPropertySlot):
+ (JSC::Arguments::getOwnPropertyDescriptor):
+ * runtime/ArrayConstructor.cpp:
+ (JSC::ArrayConstructor::ArrayConstructor):
+ * runtime/ArrayPrototype.cpp:
+ (JSC::arrayProtoFuncPop):
+ (JSC::arrayProtoFuncPush):
+ (JSC::arrayProtoFuncShift):
+ (JSC::arrayProtoFuncSplice):
+ (JSC::arrayProtoFuncUnShift):
+ (JSC::arrayProtoFuncFilter):
+ (JSC::arrayProtoFuncMap):
+ (JSC::arrayProtoFuncEvery):
+ (JSC::arrayProtoFuncForEach):
+ (JSC::arrayProtoFuncSome):
+ (JSC::arrayProtoFuncReduce):
+ (JSC::arrayProtoFuncReduceRight):
+ (JSC::arrayProtoFuncIndexOf):
+ (JSC::arrayProtoFuncLastIndexOf):
+ * runtime/BooleanConstructor.cpp:
+ (JSC::BooleanConstructor::BooleanConstructor):
+ * runtime/CachedTranscendentalFunction.h:
+ (JSC::CachedTranscendentalFunction::operator()):
+ * runtime/DateConstructor.cpp:
+ (JSC::DateConstructor::DateConstructor):
+ (JSC::dateParse):
+ (JSC::dateNow):
+ (JSC::dateUTC):
+ * runtime/DateInstance.cpp:
+ (JSC::DateInstance::DateInstance):
+ * runtime/DatePrototype.cpp:
+ (JSC::dateProtoFuncGetFullYear):
+ (JSC::dateProtoFuncGetUTCFullYear):
+ (JSC::dateProtoFuncGetMonth):
+ (JSC::dateProtoFuncGetUTCMonth):
+ (JSC::dateProtoFuncGetDate):
+ (JSC::dateProtoFuncGetUTCDate):
+ (JSC::dateProtoFuncGetDay):
+ (JSC::dateProtoFuncGetUTCDay):
+ (JSC::dateProtoFuncGetHours):
+ (JSC::dateProtoFuncGetUTCHours):
+ (JSC::dateProtoFuncGetMinutes):
+ (JSC::dateProtoFuncGetUTCMinutes):
+ (JSC::dateProtoFuncGetSeconds):
+ (JSC::dateProtoFuncGetUTCSeconds):
+ (JSC::dateProtoFuncGetMilliSeconds):
+ (JSC::dateProtoFuncGetUTCMilliseconds):
+ (JSC::dateProtoFuncGetTimezoneOffset):
+ (JSC::dateProtoFuncSetTime):
+ (JSC::setNewValueFromTimeArgs):
+ (JSC::setNewValueFromDateArgs):
+ (JSC::dateProtoFuncSetYear):
+ (JSC::dateProtoFuncGetYear):
+ * runtime/Error.cpp:
+ (JSC::addErrorSourceInfo):
+ (JSC::addErrorDivotInfo):
+ * runtime/ErrorConstructor.cpp:
+ (JSC::ErrorConstructor::ErrorConstructor):
+ * runtime/FunctionConstructor.cpp:
+ (JSC::FunctionConstructor::FunctionConstructor):
+ * runtime/FunctionPrototype.cpp:
+ (JSC::FunctionPrototype::FunctionPrototype):
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::getOwnPropertySlot):
+ (JSC::JSArray::getOwnPropertyDescriptor):
+ * runtime/JSByteArray.cpp:
+ (JSC::JSByteArray::JSByteArray):
+ * runtime/JSByteArray.h:
+ (JSC::JSByteArray::getIndex):
+ * runtime/JSFunction.cpp:
+ (JSC::JSFunction::JSFunction):
+ (JSC::JSFunction::lengthGetter):
+ (JSC::JSFunction::getOwnPropertyDescriptor):
+ * runtime/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::reset):
+ * runtime/JSGlobalObjectFunctions.cpp:
+ (JSC::globalFuncParseInt):
+ (JSC::globalFuncParseFloat):
+ * runtime/JSNumberCell.h:
+ (JSC::JSValue::JSValue):
+ (JSC::jsNaN):
+ (JSC::JSValue::toJSNumber):
+ * runtime/JSONObject.cpp:
+ (JSC::unwrapBoxedPrimitive):
+ (JSC::PropertyNameForFunctionCall::value):
+ (JSC::JSONStringify):
+ * runtime/JSString.cpp:
+ (JSC::JSString::getStringPropertyDescriptor):
+ * runtime/JSString.h:
+ (JSC::JSString::getStringPropertySlot):
+ * runtime/JSValue.h:
+ (JSC::jsDoubleNumber):
+ (JSC::jsNumber):
+ (JSC::jsNaN):
+ (JSC::JSValue::JSValue):
+ (JSC::JSValue::toJSNumber):
+ * runtime/LiteralParser.cpp:
+ (JSC::LiteralParser::parse):
+ * runtime/MathObject.cpp:
+ (JSC::MathObject::MathObject):
+ (JSC::mathProtoFuncAbs):
+ (JSC::mathProtoFuncACos):
+ (JSC::mathProtoFuncASin):
+ (JSC::mathProtoFuncATan):
+ (JSC::mathProtoFuncATan2):
+ (JSC::mathProtoFuncCeil):
+ (JSC::mathProtoFuncCos):
+ (JSC::mathProtoFuncExp):
+ (JSC::mathProtoFuncFloor):
+ (JSC::mathProtoFuncLog):
+ (JSC::mathProtoFuncMax):
+ (JSC::mathProtoFuncMin):
+ (JSC::mathProtoFuncPow):
+ (JSC::mathProtoFuncRandom):
+ (JSC::mathProtoFuncRound):
+ (JSC::mathProtoFuncSin):
+ (JSC::mathProtoFuncSqrt):
+ (JSC::mathProtoFuncTan):
+ * runtime/NativeErrorConstructor.cpp:
+ (JSC::NativeErrorConstructor::NativeErrorConstructor):
+ * runtime/NumberConstructor.cpp:
+ (JSC::NumberConstructor::NumberConstructor):
+ (JSC::numberConstructorNaNValue):
+ (JSC::numberConstructorNegInfinity):
+ (JSC::numberConstructorPosInfinity):
+ (JSC::numberConstructorMaxValue):
+ (JSC::numberConstructorMinValue):
+ (JSC::constructWithNumberConstructor):
+ (JSC::callNumberConstructor):
+ * runtime/NumberPrototype.cpp:
+ (JSC::NumberPrototype::NumberPrototype):
+ * runtime/ObjectConstructor.cpp:
+ (JSC::ObjectConstructor::ObjectConstructor):
+ * runtime/Operations.cpp:
+ (JSC::jsAddSlowCase):
+ * runtime/Operations.h:
+ (JSC::jsAdd):
+ * runtime/PrototypeFunction.cpp:
+ (JSC::PrototypeFunction::PrototypeFunction):
+ * runtime/RegExpConstructor.cpp:
+ (JSC::RegExpConstructor::RegExpConstructor):
+ (JSC::RegExpMatchesArray::fillArrayInstance):
+ * runtime/RegExpObject.cpp:
+ (JSC::regExpObjectLastIndex):
+ * runtime/StringConstructor.cpp:
+ (JSC::StringConstructor::StringConstructor):
+ * runtime/StringPrototype.cpp:
+ (JSC::StringPrototype::StringPrototype):
+ (JSC::stringProtoFuncReplace):
+ (JSC::stringProtoFuncCharCodeAt):
+ (JSC::stringProtoFuncIndexOf):
+ (JSC::stringProtoFuncLastIndexOf):
+ (JSC::stringProtoFuncSearch):
+ (JSC::stringProtoFuncLocaleCompare):
+
+2010-10-25 David Tapuska <dtapuska@rim.com>
+
+ Reviewed by David Kilzer.
+
+ Enable VFP if our compiler settings indicated we had a hardware
+ VFP.
+
+ https://bugs.webkit.org/show_bug.cgi?id=46096
+
+ * assembler/MacroAssemblerARM.cpp:
+ (JSC::isVFPPresent):
+
+2010-10-25 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r70451.
+ http://trac.webkit.org/changeset/70451
+ https://bugs.webkit.org/show_bug.cgi?id=48249
+
+ Broke set-unloaded-frame-location.html under Qt (Requested by
+ caseq on #webkit).
+
+ * GNUmakefile.am:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * wtf/text/TextPosition.h: Removed.
+
+2010-10-25 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by David Kilzer.
+
+ Replace _countof with WTF_ARRAY_LENGTH
+ https://bugs.webkit.org/show_bug.cgi?id=48229
+
+ * wtf/Platform.h:
+
+2010-10-25 Peter Rybin <peter.rybin@gmail.com>
+
+ Reviewed by Adam Barth.
+
+ HTML parser should provide script column position within HTML document to JavaScript engine
+ https://bugs.webkit.org/show_bug.cgi?id=45271
+
+ Adds TextPosition* classes -- a structure that stores line/column/generation
+ level coordinates inside text document. Adds *BasedNumber classes -- typesafe int
+ wrappers that emphasize whether int number is used as zero-based or
+ one-based.
+
+ * GNUmakefile.am:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * wtf/text/TextPosition.h: Added.
+ (WTF::TextPosition::TextPosition):
+ (WTF::TextPosition::minimumPosition):
+ (WTF::TextPosition::belowRangePosition):
+ (WTF::ZeroBasedNumber::fromZeroBasedInt):
+ (WTF::ZeroBasedNumber::ZeroBasedNumber):
+ (WTF::ZeroBasedNumber::zeroBasedInt):
+ (WTF::ZeroBasedNumber::base):
+ (WTF::ZeroBasedNumber::belowBase):
+ (WTF::OneBasedNumber::fromOneBasedInt):
+ (WTF::OneBasedNumber::OneBasedNumber):
+ (WTF::OneBasedNumber::oneBasedInt):
+ (WTF::OneBasedNumber::convertAsZeroBasedInt):
+ (WTF::OneBasedNumber::convertToZeroBased):
+ (WTF::OneBasedNumber::base):
+ (WTF::OneBasedNumber::belowBase):
+ (WTF::toZeroBasedTextPosition):
+ (WTF::toOneBasedTextPosition):
+ (WTF::ZeroBasedNumber::convertToOneBased):
+
+2010-10-24 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by David Kilzer.
+
+ Check endianness with __BIG_ENDIAN in RVCT.
+ https://bugs.webkit.org/show_bug.cgi?id=46122
+
+ RVCT defines __BIG_ENDIAN if compiling for a big-endian target.
+
+ * wtf/Platform.h:
+
+2010-10-24 Dan Bernstein <mitz@apple.com>
+
+ Rubber-stamped by Dave Kilzer.
+
+ Removed empty directories.
+
+ * JavaScriptCore: Removed.
+ * JavaScriptCore/runtime: Removed.
+
+2010-10-24 Patrick Gansterer <paroga@webkit.org>
+
+ Unreviewed, fix typo of last build fix.
+
+ * wtf/DateMath.cpp:
+
+2010-10-24 Patrick Gansterer <paroga@webkit.org>
+
+ Unreviewed build fix for chromium.
+
+ * wtf/DateMath.cpp: Added missing include.
+
+2010-10-24 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by David Kilzer.
+
+ Add WTF_ARRAY_LENGTH macro to WTF
+ https://bugs.webkit.org/show_bug.cgi?id=32828
+
+ Unify the different implementations and usages.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+ * runtime/DatePrototype.cpp:
+ (JSC::formatLocaleDate):
+ * runtime/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::reset):
+ * runtime/JSONObject.cpp:
+ (JSC::Stringifier::appendQuotedString):
+ (JSC::Stringifier::toJSON):
+ (JSC::Stringifier::appendStringifiedValue):
+ * runtime/UString.cpp:
+ (JSC::UString::number):
+ * wtf/DateMath.cpp:
+ (WTF::parseDateFromNullTerminatedCharacters):
+ * wtf/StdLibExtras.h:
+
+2010-10-24 Dirk Schulze <krit@webkit.org>
+
+ Reviewed by Nikolas Zimmermann.
+
+ Filter example Chiseled from SVG Wow! is slow
+ https://bugs.webkit.org/show_bug.cgi?id=48174
+
+ Added 'using WTF::ByteArray;' at the end of ByteArray.h
+
+ * wtf/ByteArray.h:
+
+2010-10-24 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by David Kilzer.
+
+ Inline WTF::bitwise_cast and fix style
+ https://bugs.webkit.org/show_bug.cgi?id=48208
+
+ * wtf/StdLibExtras.h:
+ (WTF::bitwise_cast):
+ (WTF::bitCount):
+
+2010-10-23 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Sam Weinig.
+
+ Unify globalData APIs
+ https://bugs.webkit.org/show_bug.cgi?id=47969
+
+ Make JSGlobalObject::globalData return a reference and adapt
+ callers. This unifies the API with the existing
+ CallFrame::globalData, which also returns a reference.
+
+ * debugger/Debugger.cpp:
+ (JSC::evaluateInGlobalCallFrame):
+ * interpreter/CallFrame.h:
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::dumpRegisters):
+ * jsc.cpp:
+ (runWithScripts):
+ * parser/JSParser.cpp:
+ (JSC::jsParse):
+ * parser/Parser.cpp:
+ (JSC::Parser::parse):
+ * parser/Parser.h:
+ (JSC::Parser::parse):
+ * runtime/Error.cpp:
+ (JSC::createError):
+ (JSC::createEvalError):
+ (JSC::createRangeError):
+ (JSC::createReferenceError):
+ (JSC::createSyntaxError):
+ (JSC::createTypeError):
+ (JSC::createURIError):
+ * runtime/FunctionConstructor.cpp:
+ (JSC::constructFunction):
+ * runtime/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::~JSGlobalObject):
+ (JSC::JSGlobalObject::markChildren):
+ * runtime/JSGlobalObject.h:
+ (JSC::JSGlobalObject::globalData):
+
+2010-10-23 Dimitri Glazkov <dglazkov@chromium.org>
+
+ Unreviewed, rolling out r70369.
+ http://trac.webkit.org/changeset/70369
+ https://bugs.webkit.org/show_bug.cgi?id=47974
+
+ Caused weird artifacts in expected results.
+
+ * wtf/Platform.h:
+
+2010-10-23 Martin Robinson <mrobinson@igalia.com>
+
+ Reviewed by Xan Lopez.
+
+ Crashes randomly in cairo_scaled_font_destroy
+ https://bugs.webkit.org/show_bug.cgi?id=46794
+
+ Make PlatformRefPtr aware of hashTableDeletedValue. When PlatformRefPtr
+ goes away this should probably be handled in the future via some special
+ hooks in RefCounted (or its contained type).
+
+ * wtf/PlatformRefPtr.h:
+ (WTF::PlatformRefPtr::~PlatformRefPtr):
+ (WTF::PlatformRefPtr::clear):
+ (WTF::::operator):
+
+2010-10-22 Adam Roben <aroben@apple.com>
+
+ Remove the QuartzCorePresent.h mechanism
+
+ This header was used to detect whether QuartzCore headers were present
+ on the system. Everyone should have these headers now so we no longer
+ need to detect.
+
+ Reviewed by Sam Weinig.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/build-generated-files.sh: Remove
+ code to generate QuartzCorePresent.h.
+
+ * wtf/Platform.h: Stop including QuartzCorePresent.h on Windows and
+ collapse all USE_ACCELERATED_COMPOSITING settings into one #ifdef.
+
+2010-10-22 Adam Barth <abarth@webkit.org>
+
+ Unreviewed, rolling out r70290.
+ http://trac.webkit.org/changeset/70290
+ https://bugs.webkit.org/show_bug.cgi?id=48111
+
+ Undelete Android build files.
+
+ * Android.mk: Added.
+
+2010-10-22 Zoltan Herczeg <zherczeg@webkit.org>
+
+ Reviewed by Csaba Osztrogonác.
+
+ JSC interpreter regressions after r69940
+ https://bugs.webkit.org/show_bug.cgi?id=47839
+
+ Wrong "if": It should test whether the result exists,
+ and not the opposite. It is an interpreter bug, hence
+ the bots does not capture it.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::resolveBase):
+
+2010-10-21 Adam Barth <abarth@webkit.org>
+
+ Reviewed by David Levin.
+
+ Remove Android build system
+ https://bugs.webkit.org/show_bug.cgi?id=48111
+
+ * Android.mk: Removed.
+
+2010-10-21 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Kent Tamura.
+
+ [BREWMP] Add a String constructor which takes AECHAR*
+ https://bugs.webkit.org/show_bug.cgi?id=45043
+
+ Add String(const AECHAR*) constructor for convenience.
+
+ * wtf/text/WTFString.h:
+
+2010-10-21 Carlos Garcia Campos <cgarcia@igalia.com>
+
+ Reviewed by Martin Robinson.
+
+ [GTK] Use GCharsetConverter instead of g_iconv in TextCodecGtk
+ https://bugs.webkit.org/show_bug.cgi?id=47896
+
+ * wtf/gobject/GTypedefs.h:
+
+2010-10-21 Adam Barth <abarth@webkit.org>
+
+ Unreviewed, rolling out r70174.
+ http://trac.webkit.org/changeset/70174
+ https://bugs.webkit.org/show_bug.cgi?id=41948
+
+ This patch reverts a change that causes
+ http/tests/xmlhttprequest/origin-whitelisting-removal.html to crash.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::throwException):
+
+2010-10-20 Simon Fraser <simon.fraser@apple.com>
+
+ Fix the EFL build.
+
+ * wtf/CMakeLists.txt:
+
+2010-10-20 Simon Fraser <simon.fraser@apple.com>
+
+ Fix Windows build: export needed symbols.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-10-19 Simon Fraser <simon.fraser@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ https://bugs.webkit.org/show_bug.cgi?id=47851
+
+ Add methods to DecimalNumber to return the buffer length
+ required for decimal and exponential output.
+
+ Make some of the DecimalNumber code non-inline (no
+ effect on Sunspider), adding DecimalNumber.cpp to various
+ build systems.
+
+ Make some DecimalNumber methods 'const'.
+
+ * Android.mk:
+ * Android.v8.wtf.mk:
+ * GNUmakefile.am:
+ * JavaScriptCore.exp:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * runtime/NumberPrototype.cpp:
+ (JSC::numberProtoFuncToExponential):
+ (JSC::numberProtoFuncToFixed):
+ (JSC::numberProtoFuncToPrecision):
+ * wtf/DecimalNumber.cpp: Added.
+ (WTF::DecimalNumber::bufferLengthForStringDecimal):
+ (WTF::DecimalNumber::bufferLengthForStringExponential):
+ (WTF::DecimalNumber::toStringDecimal):
+ (WTF::DecimalNumber::toStringExponential):
+ * wtf/DecimalNumber.h:
+ (WTF::DecimalNumber::sign):
+ (WTF::DecimalNumber::exponent):
+ (WTF::DecimalNumber::significand):
+ (WTF::DecimalNumber::precision):
+ * wtf/dtoa.cpp:
+ (WTF::dtoa):
+ * wtf/dtoa.h:
+ * wtf/wtf.pri:
+
+2010-10-20 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r70165.
+ http://trac.webkit.org/changeset/70165
+ https://bugs.webkit.org/show_bug.cgi?id=48007
+
+ It broke tests on Qt bot (Requested by Ossy on #webkit).
+
+ * GNUmakefile.am:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * wtf/text/TextPosition.h: Removed.
+
+2010-10-20 Brian Weinstein <bweinstein@apple.com>
+
+ Reviewed by Adam Roben.
+
+ Fix the Windows build after r70165. Move the copying of JavaScript headers from JavaScriptCore's post-build
+ step to JavaScriptCoreGenerated, so the copying is done even when a cpp file in JavaScriptCore is changed.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make:
+
+2010-10-20 Dumitru Daniliuc <dumi@chromium.org>
+
+ Unreviewed, fixing the Win build.
+
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+
+2010-10-20 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=41948
+ REGRESSION(r60392): Registerfile can be unwound too far following an exception
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::throwException): Walk the stack to calculate the high
+ water mark currently in use. It's not safe to assume that the current
+ CallFrame's high water mark is the highest high water mark because
+ calls do not always set up at the end of a CallFrame. A large caller
+ CallFrame can encompass a small callee CallFrame.
+
+2010-10-20 Peter Rybin <peter.rybin@gmail.com>
+
+ Reviewed by Adam Barth.
+
+ HTML parser should provide script column position within HTML document to JavaScript engine
+ https://bugs.webkit.org/show_bug.cgi?id=45271
+
+ Adds TextPosition* classes -- a structure that stores line/column/generation
+ level coordinates inside text document. Adds *BasedNumber classes -- typesafe int
+ wrappers that emphasize whether int number is used as zero-based or
+ one-based.
+
+ * GNUmakefile.am:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * wtf/text/TextPosition.h: Added.
+ (WTF::TextPosition::TextPosition):
+ (WTF::TextPosition::minimumPosition):
+ (WTF::TextPosition::belowRangePosition):
+ (WTF::ZeroBasedNumber::fromZeroBasedInt):
+ (WTF::ZeroBasedNumber::ZeroBasedNumber):
+ (WTF::ZeroBasedNumber::zeroBasedInt):
+ (WTF::ZeroBasedNumber::base):
+ (WTF::ZeroBasedNumber::belowBase):
+ (WTF::OneBasedNumber::fromOneBasedInt):
+ (WTF::OneBasedNumber::OneBasedNumber):
+ (WTF::OneBasedNumber::oneBasedInt):
+ (WTF::OneBasedNumber::convertAsZeroBasedInt):
+ (WTF::OneBasedNumber::convertToZeroBased):
+ (WTF::OneBasedNumber::base):
+ (WTF::OneBasedNumber::belowBase):
+ (WTF::toZeroBasedTextPosition):
+ (WTF::toOneBasedTextPosition):
+ (WTF::ZeroBasedNumber::convertToOneBased):
+
+2010-10-19 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by David Kilzer.
+
+ [BREWMP] Turn off JIT for simulator build
+ https://bugs.webkit.org/show_bug.cgi?id=47937
+
+ We don't need to test x86 JIT.
+
+ * wtf/Platform.h:
+
+2010-10-19 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Remove support for JSVALUE32 from JSC
+ https://bugs.webkit.org/show_bug.cgi?id=47948
+
+ Remove all the code for supporting JSVALUE32 from JSC.
+
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ (JSC::JIT::privateCompileSlowCases):
+ * jit/JIT.h:
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emit_op_lshift):
+ (JSC::JIT::emitSlow_op_lshift):
+ (JSC::JIT::emit_op_rshift):
+ (JSC::JIT::emitSlow_op_rshift):
+ (JSC::JIT::emit_op_urshift):
+ (JSC::JIT::emitSlow_op_urshift):
+ (JSC::JIT::emit_op_jnless):
+ (JSC::JIT::emitSlow_op_jnless):
+ (JSC::JIT::emit_op_jless):
+ (JSC::JIT::emitSlow_op_jless):
+ (JSC::JIT::emit_op_jlesseq):
+ (JSC::JIT::emitSlow_op_jlesseq):
+ (JSC::JIT::emit_op_bitand):
+ (JSC::JIT::emit_op_post_inc):
+ (JSC::JIT::emit_op_post_dec):
+ (JSC::JIT::emit_op_pre_inc):
+ (JSC::JIT::emit_op_pre_dec):
+ (JSC::JIT::emit_op_mod):
+ (JSC::JIT::emitSlow_op_mod):
+ * jit/JITCall.cpp:
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::emitGetFromCallFrameHeaderPtr):
+ (JSC::JIT::emitGetFromCallFrameHeader32):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_loop_if_lesseq):
+ (JSC::JIT::emit_op_bitnot):
+ (JSC::JIT::emit_op_next_pname):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::emit_op_get_by_val):
+ (JSC::JIT::emit_op_put_by_val):
+ * jit/JITStubs.h:
+ * jit/JSInterfaceJIT.h:
+ * jit/SpecializedThunkJIT.h:
+ (JSC::SpecializedThunkJIT::returnDouble):
+ (JSC::SpecializedThunkJIT::tagReturnAsInt32):
+ * jit/ThunkGenerators.cpp:
+ (JSC::sqrtThunkGenerator):
+ (JSC::powThunkGenerator):
+ * runtime/Collector.cpp:
+ (JSC::isPossibleCell):
+ (JSC::typeName):
+ * runtime/JSCell.h:
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData):
+ * runtime/JSGlobalData.h:
+ * runtime/JSGlobalObject.h:
+ (JSC::Structure::prototypeForLookup):
+ * runtime/JSImmediate.h:
+ (JSC::reinterpretIntptrToDouble):
+ (JSC::JSImmediate::isIntegerNumber):
+ (JSC::JSImmediate::isDouble):
+ (JSC::JSImmediate::areBothImmediateIntegerNumbers):
+ (JSC::JSImmediate::makeDouble):
+ (JSC::JSImmediate::doubleValue):
+ (JSC::JSImmediate::toBoolean):
+ (JSC::JSImmediate::fromNumberOutsideIntegerRange):
+ (JSC::JSImmediate::from):
+ (JSC::JSImmediate::toDouble):
+ (JSC::JSFastMath::rightShiftImmediateNumbers):
+ * runtime/JSNumberCell.cpp:
+ * runtime/JSNumberCell.h:
+ * runtime/JSObject.h:
+ (JSC::JSObject::JSObject):
+ * runtime/JSValue.h:
+ * runtime/NumberObject.h:
+ * wtf/Platform.h:
+
+2010-10-19 Csaba Osztrogonác <ossy@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ BytecodeGenerator::m_lastOpcodePosition must be initialized in all constructors
+ https://bugs.webkit.org/show_bug.cgi?id=47920
+
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::BytecodeGenerator): Add missing member initialization.
+
+2010-10-19 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by David Kilzer.
+
+ RVCT fails to compile DateMath.cpp due to overloaded function pow
+ https://bugs.webkit.org/show_bug.cgi?id=47844
+
+ Choose std::pow(double, double) among multiple overloaded pow functions
+ to fix build for RVCT.
+
+ * wtf/DateMath.cpp:
+ (WTF::parseES5DateFromNullTerminatedCharacters):
+
+2010-10-19 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by David Kilzer.
+
+ Use UChar instead of wchar_t in UnicodeWinCE
+ https://bugs.webkit.org/show_bug.cgi?id=47904
+
+ Make UnicodeWinCE more portable, so we can use it for other ports too.
+
+ * wtf/unicode/wince/UnicodeWinCE.cpp:
+ (WTF::Unicode::toLower):
+ (WTF::Unicode::toUpper):
+ (WTF::Unicode::foldCase):
+ (WTF::Unicode::isPrintableChar):
+ (WTF::Unicode::isSpace):
+ (WTF::Unicode::isLetter):
+ (WTF::Unicode::isUpper):
+ (WTF::Unicode::isLower):
+ (WTF::Unicode::isDigit):
+ (WTF::Unicode::isPunct):
+ (WTF::Unicode::isAlphanumeric):
+ (WTF::Unicode::toTitleCase):
+ (WTF::Unicode::mirroredChar):
+ (WTF::Unicode::digitValue):
+ * wtf/unicode/wince/UnicodeWinCE.h:
+ (WTF::Unicode::isSeparatorSpace):
+ (WTF::Unicode::isHighSurrogate):
+ (WTF::Unicode::isLowSurrogate):
+ (WTF::Unicode::umemcasecmp):
+ (WTF::Unicode::surrogateToUcs4):
+
+2010-10-19 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by Andreas Kling.
+
+ Fix style of UnicodeWinCE
+ https://bugs.webkit.org/show_bug.cgi?id=47818
+
+ * wtf/unicode/wince/UnicodeWinCE.cpp:
+ (WTF::Unicode::toLower):
+ (WTF::Unicode::toUpper):
+ * wtf/unicode/wince/UnicodeWinCE.h:
+
+2010-10-18 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Martin Robinson.
+
+ * GNUmakefile.am: add missing file.
+
+2010-10-18 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Strict mode: Functions created with the function constructor don't implement strict mode semantics
+ https://bugs.webkit.org/show_bug.cgi?id=47860
+
+ When creating the FunctionExecutable for a new function the function constructor
+ was always passing false for whether or not a function was strict, rather than
+ using the information from the freshly parsed function itself.
+
+ * runtime/Executable.cpp:
+ (JSC::FunctionExecutable::fromGlobalCode):
+
+2010-10-18 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Strict mode: |this| should be undefined if it is not explicitly provided
+ https://bugs.webkit.org/show_bug.cgi?id=47833
+
+ To make strict mode behave correctly we want to pass undefined instead of null
+ as the default this value. This has no impact on behaviour outside of strict
+ mode as both values are replaced with the global object if necessary.
+
+ * bytecompiler/NodesCodegen.cpp:
+ (JSC::FunctionCallValueNode::emitBytecode):
+ (JSC::FunctionCallResolveNode::emitBytecode):
+ (JSC::CallFunctionCallDotNode::emitBytecode):
+ (JSC::ApplyFunctionCallDotNode::emitBytecode):
+
+
+2010-10-18 Darin Adler <darin@apple.com>
+
+ Reviewed by Anders Carlsson.
+
+ Make a nullptr that works with OwnPtr and RefPtr
+ https://bugs.webkit.org/show_bug.cgi?id=47756
+
+ * JavaScriptCore.xcodeproj/project.pbxproj: Added NullPtr.h.
+
+ * wtf/NullPtr.h: Added.
+
+ * wtf/OwnArrayPtr.h: Add an overload of = taking nullptr.
+ * wtf/OwnPtr.h: Ditto.
+ * wtf/PassOwnArrayPtr.h: Ditto.
+ * wtf/PassOwnPtr.h: Ditto.
+ * wtf/PassRefPtr.h: Ditto.
+ * wtf/RefPtr.h: Ditto.
+ * wtf/RetainPtr.h: Ditto.
+
+2010-10-18 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Strict mode: JIT doesn't check for |this| being an immediate before dereferencing
+ https://bugs.webkit.org/show_bug.cgi?id=47826
+
+ There's no guarantee that |this| will be a cell in a strict mode function, so
+ don't claim that it is.
+
+ * bytecode/CodeBlock.h:
+ (JSC::CodeBlock::isKnownNotImmediate):
+
+2010-10-18 Zoltan Herczeg <zherczeg@webkit.org>
+
+ Reviewed by Oliver Hunt.
+
+ if (0) throw "x" ; else { } throws parse error after r69906
+ https://bugs.webkit.org/show_bug.cgi?id=47807
+
+ r69906 introduced a bug: the semicolon is not parsed after a throw
+ expression anymore. Thus, the semicolon terminates the "if" parsing
+ in the example above, and the else token results a parse error.
+
+ * parser/JSParser.cpp:
+ (JSC::JSParser::parseThrowStatement):
+
+2010-10-18 Peter Varga <pvarga@inf.u-szeged.hu>
+
+ Reviewed by Andreas Kling.
+
+ Remove some unnecessary lines of code from Parser.cpp
+ https://bugs.webkit.org/show_bug.cgi?id=47816
+
+ * parser/Parser.cpp:
+
+2010-10-18 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Csaba Osztrogonác.
+
+ Build broken with JIT disabled
+ https://bugs.webkit.org/show_bug.cgi?id=47801
+
+ This is a regression caused by r69940.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::resolveBase):
+
+2010-10-18 Zoltan Horvath <zoltan@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ Change FastAllocBase implementation into a macro
+ https://bugs.webkit.org/show_bug.cgi?id=42998
+
+ It was investigated in bug #33896 that inheriting classes from FastAllocBase
+ can result in objects getting larger which leads to memory regressions.
+ Using a macro instead of inheriting classes from FastAllocBase would solve the issue.
+
+ * wtf/FastAllocBase.h: Add a WTF_MAKE_FAST_ALLOCATED macro
+
+2010-10-17 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Strict mode: arguments is not valid as the base expression for pre- or post-fix expressions
+ https://bugs.webkit.org/show_bug.cgi?id=47791
+
+ Simple fix, check for arguments in addition to eval.
+
+ * parser/JSParser.cpp:
+ (JSC::JSParser::parseUnaryExpression):
+
+2010-10-17 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Strict mode: Assignment that would create a global should be a late ReferenceError, not a syntax failure
+ https://bugs.webkit.org/show_bug.cgi?id=47788
+
+ Fixing this required a couple of changes:
+ * resolve_base now has a flag to indicate whether it is being used for a put in strict mode.
+ this allows us to throw an exception when we're doing a completely generic resolve for
+ assignment, and that assignment would create a new global.
+ * There is a new opcode 'op_ensure_property_exists' that is used to determine whether
+ the property being assigned to already exists on the global object. This currently
+ has no caching, but such caching could be added relatively trivially. It is only used
+ in the case where we know that a property will be placed on the global object, and
+ we cannot verify that the property already exists.
+
+ In the jit we plant a call to cti_op_resolve_base_strict_put in the effected case rather
+ than making op_resolve_base have an additional runtime branch.
+
+ There's also a new helper function to create the exception for the invalid assignment.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::dump):
+ * bytecode/Opcode.h:
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::emitResolveBase):
+ (JSC::BytecodeGenerator::emitResolveBaseForPut):
+ * bytecompiler/BytecodeGenerator.h:
+ * bytecompiler/NodesCodegen.cpp:
+ (JSC::AssignResolveNode::emitBytecode):
+ (JSC::ForInNode::emitBytecode):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::resolveBase):
+ (JSC::Interpreter::privateExecute):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ * jit/JIT.h:
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_resolve_base):
+ (JSC::JIT::emit_op_ensure_property_exists):
+ * jit/JITOpcodes32_64.cpp:
+ (JSC::JIT::emit_op_resolve_base):
+ (JSC::JIT::emit_op_ensure_property_exists):
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+ * jit/JITStubs.h:
+ * parser/JSParser.cpp:
+ (JSC::JSParser::parseProgram):
+ * runtime/ExceptionHelpers.cpp:
+ (JSC::createErrorForInvalidGlobalAssignment):
+ * runtime/ExceptionHelpers.h:
+ * runtime/Operations.h:
+ (JSC::resolveBase):
+
+2010-10-17 Simon Fraser <simon.fraser@apple.com>
+
+ First part of fix for Windows build failure. Will wait for the
+ next set of link errors to determine the mangled forms for dtoaRoundSF
+ and dtoaRoundDP.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-10-17 Simon Fraser <simon.fraser@apple.com>
+
+ Reviewed by Nikolas Zimmermann.
+
+ Very large and small numbers fail to round-trip through CSS
+ https://bugs.webkit.org/show_bug.cgi?id=20674
+
+ New exports required to use DecimalNumber in WebCore.
+
+ * JavaScriptCore.exp:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2010-10-16 Kyusun Kim <maniagoon@company100.net>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Add using declarations for currentTimeMS() and parseDateFromNullTerminatedCharacters()
+ https://bugs.webkit.org/show_bug.cgi?id=47758
+
+ * wtf/CurrentTime.h:
+ * wtf/DateMath.h:
+
+2010-10-16 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by Adam Barth.
+
+ Rename StringHasherFunctions.h to StringHasher.h
+ https://bugs.webkit.org/show_bug.cgi?id=47200
+
+ Now StringHasherFunctions.h only contains the StringHasher class, so rename it to the correct name.
+
+ * GNUmakefile.am:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * wtf/StringHashFunctions.h: Removed.
+ * wtf/StringHasher.h: Copied from JavaScriptCore/wtf/StringHashFunctions.h.
+ * wtf/text/StringHash.h:
+ * wtf/text/StringImpl.h:
+
+2010-10-15 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Automatic Semicolon Insertion incorrectly inserts semicolon after break, continue, and return followed by a newline
+ https://bugs.webkit.org/show_bug.cgi?id=47762
+
+ The old YACC parser depended on the lexer for some classes of semicolon insertion.
+ The new parser handles ASI entirely on its own so when the lexer inserts a semicolon
+ on its own the net result is a spurious semicolon in the input stream. This can result
+ in incorrect parsing in some cases:
+
+ if (0)
+ break
+ ;else {}
+
+ Would result in a parse failure as the output from the lexer is essentially
+
+ if (0)
+ break
+ ;;else
+
+ So the second semicolon is interpreted as a empty statement, which terminates the if,
+ making the else an error.
+
+
+ * parser/JSParser.cpp:
+ (JSC::JSParser::parseThrowStatement):
+ Parsing of throw statement was wrong, and only worked due to the weird behaviour
+ in the lexer
+ * parser/Lexer.cpp:
+ (JSC::Lexer::lex):
+ Remove bogus semicolon insertion from the newline handling
+
+2010-10-15 Nikolas Zimmermann <nzimmermann@rim.com>
+
+ Reviewed by Dirk Schulze.
+
+ Replace some String::format() usages by StringConcatenate in WebKit
+ https://bugs.webkit.org/show_bug.cgi?id=47714
+
+ * wtf/text/StringConcatenate.h: Add UChar specific StringTypeAdapter, to accept single UChars in makeString().
+
+2010-10-15 Ilya Tikhonovsky <loislo@chromium.org>
+
+ Unreviewed build fix for Debug Leopard which is failng to compile after r69842.
+
+ * yarr/RegexInterpreter.cpp:
+ (JSC::Yarr::ByteCompiler::emitDisjunction):
+
+2010-10-15 Peter Varga <pvarga@inf.u-szeged.hu>
+
+ Reviewed by Gavin Barraclough.
+
+ The parenthetical assertion checking isn't working in some cases with YARR
+ Interpreter
+ https://bugs.webkit.org/show_bug.cgi?id=46893
+
+ Calculate the countToCheck value of a TypeParentheticalAssertion by
+ subtracting the number of characters which follows
+ a TypeParentheticalAssertion term with the number of characters which should
+ be matched by terms which are contained
+ in the TypeParentheticalAssertion term (minimumSize).
+
+ * yarr/RegexInterpreter.cpp:
+ (JSC::Yarr::ByteCompiler::emitDisjunction):
+
+2010-10-14 Nathan Vander Wilt <nate@andyet.net>
+
+ Reviewed by Darin Adler.
+
+ Added parser for ECMAScript 5 standard date format, so Date.parse can handle RFC 3339 timestamps: https://bugs.webkit.org/show_bug.cgi?id=44632
+
+ * runtime/DateConversion.cpp:
+ (JSC::parseDate):
+ * wtf/DateMath.cpp:
+ (WTF::ymdhmsToSeconds):
+ (WTF::parseES5DateFromNullTerminatedCharacters):
+ * wtf/DateMath.h:
+
+2010-10-14 Nikolas Zimmermann <nzimmermann@rim.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Replace lots of String::format() usages by StringConcatenate
+ https://bugs.webkit.org/show_bug.cgi?id=47664
+
+ Add StringTypeAdapter<char> to accept single characters for makeString().
+
+ * wtf/text/StringConcatenate.h:
+ (WTF::makeString):
+
+2010-10-14 David Goodwin <david_goodwin@apple.com>
+
+ Reviewed by Darin Adler.
+
+ need way to measure size of JITed ARM code
+ https://bugs.webkit.org/show_bug.cgi?id=47121
+
+ * assembler/LinkBuffer.h:
+ (JSC::LinkBuffer::linkCode):
+ (JSC::LinkBuffer::dumpLinkStats):
+ (JSC::LinkBuffer::dumpCode):
+
+2010-10-14 Peter Varga <pvarga@inf.u-szeged.hu>
+
+ Reviewed by Gavin Barraclough.
+
+ The backreference checking isn't working in some cases with YARR Interpreter
+ https://bugs.webkit.org/show_bug.cgi?id=46904
+
+ The Interpreter::matchBackReference() function returns true without matching
+ when a backreference points to the same parentheses where it is.
+
+ * yarr/RegexInterpreter.cpp:
+ (JSC::Yarr::Interpreter::matchBackReference):
+
+2010-10-14 No'am Rosenthal <noam.rosenthal@nokia.com>
+
+ Reviewed by Andreas Kling.
+
+ [Qt] Text breaking is slow: enable ICU as an opt-in
+ https://bugs.webkit.org/show_bug.cgi?id=40332
+
+ Added a config flag that enables ICU as an opt-in instead of the Qt specific code.
+ Because of the inclusion of ICU headers, some explicit casting was necessary in UnicodeQt4.h
+
+ * JavaScriptCore.pri:
+ * wtf/unicode/qt4/UnicodeQt4.h:
+ (WTF::Unicode::toLower):
+ (WTF::Unicode::toUpper):
+ (WTF::Unicode::toTitleCase):
+ (WTF::Unicode::foldCase):
+ (WTF::Unicode::isPrintableChar):
+ (WTF::Unicode::isSeparatorSpace):
+ (WTF::Unicode::isPunct):
+ (WTF::Unicode::isLower):
+ (WTF::Unicode::mirroredChar):
+ (WTF::Unicode::combiningClass):
+ (WTF::Unicode::direction):
+ (WTF::Unicode::category):
+
+2010-10-14 Anton Faern <anton@bladehawke.com>
+
+ Reviewed by Csaba Osztrogonác.
+
+ https://bugs.webkit.org/show_bug.cgi?id=47658
+ NetBSD was not included in the WTF_PLATFORM_FOO to WTF_OS_FOO
+ change. This means that OS(NETBSD) is also undefined.
+
+ * wtf/Platform.h: s/_PLATFORM_/_OS_/ for NetBSD
+
+2010-10-13 David Goodwin <david_goodwin@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ ARMv7 JIT should generated conditional branches when possible
+ https://bugs.webkit.org/show_bug.cgi?id=47384
+
+ Use different jump padding sizes for conditional and unconditional
+ jumps (12 bytes and 10 bytes respectively). This allows the JIT to
+ include the IT instruction as part of the conditional jump sequence
+ which in turn allows it to optimize away the IT using an ARMv7
+ conditional branch instruction. Use 2-byte B(T1) and 4-byte B(T3) for
+ conditional branches when displacement is in range. Also use IT/B(T4)
+ for conditional branch when displacement does not fit in B(T3).
+
+ For unconditional jump, instruction selection options are:
+ B(T2), B(T4), MOVW/MOVT/BX. For conditional jump, instruction selection
+ options are: B(T1), B(T3), IT/B(T4), ITTT/MOVW/MOVT/BX.
+
+ * assembler/ARMv7Assembler.cpp:
+ * assembler/ARMv7Assembler.h:
+ (JSC::ARMv7Assembler::JmpSrc::JmpSrc):
+ (JSC::ARMv7Assembler::ifThenElse):
+ (JSC::ARMv7Assembler::jumpSizeDelta):
+ (JSC::ARMv7Assembler::canCompact):
+ (JSC::ARMv7Assembler::computeJumpType):
+ (JSC::ARMv7Assembler::link):
+ (JSC::ARMv7Assembler::canBeJumpT1):
+ (JSC::ARMv7Assembler::canBeJumpT3):
+ (JSC::ARMv7Assembler::canBeJumpT4):
+ (JSC::ARMv7Assembler::linkJumpT1):
+ (JSC::ARMv7Assembler::linkJumpT3):
+ (JSC::ARMv7Assembler::linkJumpT4):
+ (JSC::ARMv7Assembler::linkConditionalJumpT4):
+ (JSC::ARMv7Assembler::linkBX):
+ (JSC::ARMv7Assembler::linkConditionalBX):
+ (JSC::ARMv7Assembler::linkJumpAbsolute):
+ * assembler/LinkBuffer.h:
+ (JSC::LinkBuffer::linkCode):
+ * assembler/MacroAssemblerARMv7.h:
+ (JSC::MacroAssemblerARMv7::canCompact):
+ (JSC::MacroAssemblerARMv7::computeJumpType):
+ (JSC::MacroAssemblerARMv7::jumpSizeDelta):
+ (JSC::MacroAssemblerARMv7::jump):
+ (JSC::MacroAssemblerARMv7::nearCall):
+ (JSC::MacroAssemblerARMv7::call):
+ (JSC::MacroAssemblerARMv7::ret):
+ (JSC::MacroAssemblerARMv7::tailRecursiveCall):
+ (JSC::MacroAssemblerARMv7::makeJump):
+ (JSC::MacroAssemblerARMv7::makeBranch):
+
+2010-10-13 Fridrich Strba <fridrich.strba@bluewin.ch>
+
+ Reviewed by Darin Adler.
+
+ Don't depend on Windows on sched_yield and sched.h
+ https://bugs.webkit.org/show_bug.cgi?id=45543
+
+ sched.h is part of pthreads and sched_yield is implemented
+ in pthreads-win32 as Sleep(0). This patch avoids a gratuitous
+ dependency on pthreads-win32 in this file.
+
+ * wtf/TCSpinLock.h:
+ (TCMalloc_SlowLock):
+
+2010-10-13 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Kent Tamura.
+
+ [BREWMP] Port unicode
+ https://bugs.webkit.org/show_bug.cgi?id=45716
+
+ Brew MP port uses only the subset of ICU library to reduce the binary size.
+ Follow the WinCE's implementation.
+
+ * wtf/Platform.h:
+ * wtf/unicode/Unicode.h:
+ * wtf/unicode/brew/UnicodeBrew.cpp: Added.
+ (WTF::Unicode::toLower):
+ (WTF::Unicode::toUpper):
+ (WTF::Unicode::foldCase):
+ (WTF::Unicode::isPrintableChar):
+ (WTF::Unicode::isUpper):
+ (WTF::Unicode::isLower):
+ (WTF::Unicode::isDigit):
+ (WTF::Unicode::isPunct):
+ (WTF::Unicode::isAlphanumeric):
+ (WTF::Unicode::toTitleCase):
+ (WTF::Unicode::direction):
+ (WTF::Unicode::category):
+ (WTF::Unicode::decompositionType):
+ (WTF::Unicode::combiningClass):
+ (WTF::Unicode::mirroredChar):
+ (WTF::Unicode::digitValue):
+ (WTF::Unicode::isSpace):
+ (WTF::Unicode::isLetter):
+ * wtf/unicode/brew/UnicodeBrew.h: Added.
+ (WTF::Unicode::isArabicChar):
+ (WTF::Unicode::isSeparatorSpace):
+ (WTF::Unicode::hasLineBreakingPropertyComplexContext):
+ (WTF::Unicode::hasLineBreakingPropertyComplexContextOrIdeographic):
+ (WTF::Unicode::umemcasecmp):
+
+2010-10-13 Gavin Barraclough <barraclough@apple.com>
+
+ Windows build fix.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-10-13 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Maciej Stachowiak.
+
+ [WTFURL] Add URLQueryCanonicalizer
+ https://bugs.webkit.org/show_bug.cgi?id=45088
+
+ This class canonicalizes the query component of URLs. The main tricky
+ bit there is the convertCharset function, which I've moved to a
+ templated dependency. There'll likely be more about that in future
+ patches.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * wtf/url/src/URLEscape.cpp: Added.
+ * wtf/url/src/URLEscape.h: Added.
+ (WTF::appendEscapedCharacter):
+ * wtf/url/src/URLQueryCanonicalizer.h: Added.
+ (WTF::URLQueryCanonicalizer::canonicalize):
+ (WTF::URLQueryCanonicalizer::isAllASCII):
+ (WTF::URLQueryCanonicalizer::appendRaw8BitQueryString):
+ (WTF::URLQueryCanonicalizer::convertToQueryEncoding):
+
+2010-10-13 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 43987 - Downloading using XHR is much slower than before
+ Change StringBuilder to use overcapacity in a StringImpl, rather than a Vector.
+ Fundamentally this should be the same (copies current contents to expand capacity,
+ rather than using a rope), but this approach allows the intermadiate state of the
+ String to be inspected in the buffer without copying to resolve.
+
+ * runtime/JSONObject.cpp:
+ (JSC::Stringifier::appendQuotedString):
+ (JSC::Stringifier::Holder::appendNextProperty):
+ Renamed StringBuilder::size() -> length() (to match other String types).
+
+ * runtime/UStringBuilder.h:
+ (JSC::UStringBuilder::append):
+ (JSC::UStringBuilder::toUString):
+ Update for changes in parent class, can just 'using' the append methods.
+
+ * wtf/text/StringBuilder.cpp: Added.
+ (WTF::StringBuilder::reifyString):
+ (WTF::StringBuilder::resize):
+ (WTF::StringBuilder::reserveCapacity):
+ (WTF::StringBuilder::allocateBuffer):
+ (WTF::StringBuilder::appendUninitialized):
+ (WTF::StringBuilder::append):
+ (WTF::StringBuilder::shrinkToFit):
+ * wtf/text/StringBuilder.h:
+ (WTF::StringBuilder::StringBuilder):
+ (WTF::StringBuilder::append):
+ (WTF::StringBuilder::toString):
+ (WTF::StringBuilder::toStringPreserveCapacity):
+ (WTF::StringBuilder::length):
+ (WTF::StringBuilder::isEmpty):
+ (WTF::StringBuilder::operator[]):
+ (WTF::StringBuilder::clear):
+ Class updated to use overcapacity in a StringImpl, rather than a Vector.
+
+ * Android.mk:
+ * Android.v8.wtf.mk:
+ * GNUmakefile.am:
+ * JavaScriptCore.exp:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops:
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * JavaScriptCore.vcproj/jsc/jsc.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * wtf/CMakeLists.txt:
+ * wtf/wtf.pri:
+
+2010-10-13 Adam Roben <aroben@apple.com>
+
+ Export tryFastRealloc for WebKit2's benefit
+
+ Rubber-stamped by Anders Carlsson.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: Added
+ tryFastRealloc. Removed RegExpObject::info, which is now exported via
+ JS_EXPORTDATA.
+
+2010-10-13 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Maciej Stachowiak.
+
+ [WTFURL] Add a mechanism for classifying types of characters
+ https://bugs.webkit.org/show_bug.cgi?id=45085
+
+ Various characters have different escaping rules depending on where
+ they are in URLs. This patch adds a table containing that information.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * wtf/url/src/URLCharacterTypes.cpp: Added.
+ * wtf/url/src/URLCharacterTypes.h: Added.
+ (WTF::URLCharacterTypes::isQueryChar):
+ (WTF::URLCharacterTypes::isIPv4Char):
+ (WTF::URLCharacterTypes::isHexChar):
+ (WTF::URLCharacterTypes::isCharOfType):
+
+2010-10-13 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Csaba Osztrogonác.
+
+ Missing parameters for bytecode dump of next_pname
+ https://bugs.webkit.org/show_bug.cgi?id=47590
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::dump): add missing parameters to the dump.
+
+2010-10-13 Nikolas Zimmermann <nzimmermann@rim.com>
+
+ Reviewed by Dirk Schulze.
+
+ Add wtf/text/StringConcatenate
+ https://bugs.webkit.org/show_bug.cgi?id=47584
+
+ Move runtime/StringConcatenate.h to wtf/text, make it work for Strings too.
+ Add a special runtime/UStringConcatenate.h class that inherits from StringConcatenate, and extends it for use with UString.
+ Exactly the same design that has been followed while refactoring StringBuilder.
+
+ The UString variants can all be removed as soon as WTF::String & JSC::UString converge.
+
+ * GNUmakefile.am: Add wtf/text/StringConcatenate.h and runtime/UStringConcatenate.h.
+ * JavaScriptCore.gypi: Ditto.
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Ditto.
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj: Ditto.
+ * JavaScriptCore.xcodeproj/project.pbxproj: Ditto.
+ * bytecode/CodeBlock.cpp: s/makeString/makeUString/
+ (JSC::escapeQuotes):
+ (JSC::valueToSourceString):
+ (JSC::constantName):
+ (JSC::idName):
+ (JSC::CodeBlock::registerName):
+ (JSC::regexpToSourceString):
+ (JSC::regexpName):
+ * bytecompiler/NodesCodegen.cpp: Ditto.
+ (JSC::substitute):
+ * profiler/Profiler.cpp: Ditto.
+ (JSC::Profiler::createCallIdentifier):
+ * runtime/ExceptionHelpers.cpp: Ditto.
+ (JSC::createUndefinedVariableError):
+ (JSC::createErrorMessage):
+ (JSC::createInvalidParamError):
+ * runtime/FunctionConstructor.cpp: Ditto.
+ (JSC::constructFunction):
+ * runtime/FunctionPrototype.cpp: Ditto.
+ (JSC::insertSemicolonIfNeeded):
+ * runtime/JSONObject.cpp: Ditto.
+ (JSC::Stringifier::indent):
+ * runtime/JSStringBuilder.h:
+ (JSC::jsMakeNontrivialString):
+ * runtime/RegExpConstructor.cpp: Ditto.
+ (JSC::constructRegExp):
+ * runtime/RegExpObject.cpp: Ditto.
+ (JSC::RegExpObject::match):
+ * runtime/RegExpPrototype.cpp: Ditto.
+ (JSC::regExpProtoFuncCompile):
+ * runtime/StringConcatenate.h: Removed.
+ * runtime/UStringConcatenate.h: Added. Only contains the StringTypeAdapter<JSC::UString> code and the makeUString variants, the rest lives in wtf/text/StringConcatenate.h
+ (JSC::makeUString):
+ * wtf/text/StringConcatenate.h: Copied from runtime/StringConcatenate.h.
+ (WTF::makeString):
+
+2010-10-12 Gavin Barraclough <barraclough@apple.com>
+
+ Windows build fix.
+
+ * wtf/text/StringBuilder.h:
+ (WTF::StringBuilder::length):
+
+2010-10-12 Nikolas Zimmermann <nzimmermann@rim.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Unify JSC::StringBuilder & WebCore::StringBuilder
+ https://bugs.webkit.org/show_bug.cgi?id=47538
+
+ Move runtime/StringBuilder.h to wtf/text/StringBuilder.h. Rename build() to toString() and return a WTF::String().
+ Move the append(const JSC::UString&) method into runtime/UStringBuilder.h.
+ UStringBuilder inherits from StringBuilder.h and adds append(const JSC::UString&) and UString toUString() functionality.
+
+ No new code, just move code around.
+
+ * GNUmakefile.am: Add wtf/text/StringBuilder.h / runtime/UStringBuilder.h. Remove runtime/StringBuilder.h.
+ * JavaScriptCore.gypi: Ditto.
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Ditto.
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj: Ditto.
+ * JavaScriptCore.xcodeproj/project.pbxproj: Ditto.
+ * runtime/Executable.cpp:
+ (JSC::FunctionExecutable::paramString): Use UStringBuilder, instead of StringBuilder. Rename build() -> toUString().
+ * runtime/FunctionConstructor.cpp:
+ (JSC::constructFunction): Ditto.
+ * runtime/JSGlobalObjectFunctions.cpp:
+ (JSC::globalFuncUnescape): Ditto.
+ * runtime/JSONObject.cpp:
+ (JSC::Stringifier::stringify): Ditto.
+ (JSC::Stringifier::appendQuotedString): Ditto.
+ (JSC::Stringifier::appendStringifiedValue): Ditto.
+ (JSC::Stringifier::startNewLine): Ditto.
+ (JSC::Stringifier::Holder::appendNextProperty): Ditto.
+ * runtime/LiteralParser.cpp:
+ (JSC::LiteralParser::Lexer::lexString): Ditto.
+ * runtime/NumberPrototype.cpp: Remove unneeded JSStringBuilder.h / StringBuilder.h include.
+ * runtime/StringBuilder.h: Removed.
+ * runtime/UStringBuilder.h: Added. Inherits from WTF::StringBuilder, extending it by two methods.
+ (JSC::UStringBuilder::append): append(const JSC::UString&)
+ (JSC::UStringBuilder::toUString):
+ * wtf/text/StringBuilder.h: Copied from runtime/StringBuilder.h. Move JSC::UString parts into runtime/UStringBuilder.h
+ (WTF::StringBuilder::append): Renamed m_buffer to buffer everywhere.
+ (WTF::StringBuilder::isEmpty): Ditto (+ constify method).
+ (WTF::StringBuilder::reserveCapacity): Ditto.
+ (WTF::StringBuilder::resize): Ditto.
+ (WTF::StringBuilder::size): Ditto.
+ (WTF::StringBuilder::operator[]): Ditto.
+ (WTF::StringBuilder::toString): Ditto (+ renamed from build()). Returns a String, not an UString. The old build() method is now named toUString() and lives in UStringBuilder.
+
+2010-10-12 Michael Saboff <msaboff@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Cleaned up the processing of replacements after regular expression
+ processing, especially the case where there wasn't a match.
+ Changed to use empty strings instead of computing a zero length sub
+ string.
+ https://bugs.webkit.org/show_bug.cgi?id=47506
+
+ * runtime/StringPrototype.cpp:
+ (JSC::jsSpliceSubstringsWithSeparators):
+ (JSC::stringProtoFuncReplace):
+
+2010-10-11 Patrick Gansterer <paroga@webkit.org>
+
+ Unreviewed.
+
+ Clang build fix after r69472.
+ https://bugs.webkit.org/show_bug.cgi?id=46523
+
+ * wtf/text/StringHash.h:
+
+2010-10-11 Oliver Hunt <oliver@apple.com>
+
+ Undo last minute change to 32bit build.
+
+ * jit/JITOpcodes32_64.cpp:
+ (JSC::JIT::emit_op_convert_this_strict):
+
+2010-10-11 Brian Weinstein <bweinstein@apple.com>
+
+ Build fix for Windows. Add a necessary export from r69516.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-10-11 Oliver Hunt <oliver@apple.com>
+
+ Fix interpreter build -- was broken by incorrect merge.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+
+2010-10-01 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ [ES5] Implement strict mode
+ https://bugs.webkit.org/show_bug.cgi?id=10701
+
+ Initial strict mode implementation. This is the simplest
+ implementation that could possibly work and adds (hopefully)
+ all of the restrictions required by strict mode. There are
+ a number of inefficiencies, especially in the handling of
+ arguments and eval as smart implementations would make this
+ patch more complicated.
+
+ The SyntaxChecker AST builder has become somewhat more complex
+ as strict mode does require more parse tree information to
+ validate the syntax.
+
+ Summary of major changes to the parser:
+ * We track when we enter strict mode (this may come as a surprise)
+ * Strict mode actually requires a degree of AST knowledge to validate
+ so the SyntaxChecker now produces values that can be used to distinguish
+ "node" types.
+ * We now track variables that are written to. We do this to
+ statically identify writes to global properties that don't exist
+ and abort at that point. This should actually make it possible
+ to optimise some other cases in the future but for now it's
+ purely for validity checking. Currently writes are only tracked
+ in strict mode code.
+ * Labels are now tracked as it is now a syntax error to jump to a label
+ that does not exist (or to use break, continue, or return in a context
+ where they would be invalid).
+
+ Runtime changes:
+ * In order to get correct hanlding of the Arguments object all
+ strict mode functions that reference arguments create and tearoff
+ the arguments object on entry. This is not strictly necessary
+ but was the least work necessary to get the correct behaviour.
+ * PutPropertySlot now tracks whether it is being used for a strict
+ mode write, and if so Object::put will throw when a write can't be
+ completed.
+ * StrictEvalActivation was added as an "activation" object for strict
+ mode eval (so that strict eval does not introduce new variables into
+ the containing scope).
+
+ * CMakeLists.txt:
+ * GNUmakefile.am:
+ * JavaScriptCore.exp:
+ * JavaScriptCore.pro:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::dump):
+ (JSC::CodeBlock::CodeBlock):
+ (JSC::CodeBlock::reparseForExceptionInfoIfNecessary):
+ * bytecode/CodeBlock.h:
+ (JSC::CodeBlock::isStrictMode):
+ * bytecode/EvalCodeCache.h:
+ (JSC::EvalCodeCache::get):
+ * bytecode/Opcode.h:
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::BytecodeGenerator):
+ (JSC::BytecodeGenerator::createArgumentsIfNecessary):
+ (JSC::BytecodeGenerator::emitReturn):
+ * bytecompiler/BytecodeGenerator.h:
+ (JSC::BytecodeGenerator::isStrictMode):
+ (JSC::BytecodeGenerator::makeFunction):
+ * debugger/Debugger.cpp:
+ (JSC::evaluateInGlobalCallFrame):
+ * debugger/DebuggerCallFrame.cpp:
+ (JSC::DebuggerCallFrame::evaluate):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::callEval):
+ (JSC::Interpreter::unwindCallFrame):
+ (JSC::Interpreter::execute):
+ (JSC::Interpreter::privateExecute):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ (JSC::JIT::privateCompileSlowCases):
+ * jit/JIT.h:
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_get_pnames):
+ (JSC::JIT::emit_op_convert_this_strict):
+ (JSC::JIT::emitSlow_op_convert_this_strict):
+ * jit/JITOpcodes32_64.cpp:
+ (JSC::JIT::emit_op_get_pnames):
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+ * jit/JITStubs.h:
+ * parser/ASTBuilder.h:
+ (JSC::ASTBuilder::createFunctionBody):
+ (JSC::ASTBuilder::isResolve):
+ * parser/JSParser.cpp:
+ (JSC::JSParser::next):
+ (JSC::JSParser::startLoop):
+ (JSC::JSParser::endLoop):
+ (JSC::JSParser::startSwitch):
+ (JSC::JSParser::endSwitch):
+ (JSC::JSParser::setStrictMode):
+ (JSC::JSParser::strictMode):
+ (JSC::JSParser::isValidStrictMode):
+ (JSC::JSParser::declareParameter):
+ (JSC::JSParser::breakIsValid):
+ (JSC::JSParser::pushLabel):
+ (JSC::JSParser::popLabel):
+ (JSC::JSParser::hasLabel):
+ (JSC::JSParser::DepthManager::DepthManager):
+ (JSC::JSParser::DepthManager::~DepthManager):
+ (JSC::JSParser::Scope::Scope):
+ (JSC::JSParser::Scope::startSwitch):
+ (JSC::JSParser::Scope::endSwitch):
+ (JSC::JSParser::Scope::startLoop):
+ (JSC::JSParser::Scope::endLoop):
+ (JSC::JSParser::Scope::inLoop):
+ (JSC::JSParser::Scope::breakIsValid):
+ (JSC::JSParser::Scope::pushLabel):
+ (JSC::JSParser::Scope::popLabel):
+ (JSC::JSParser::Scope::hasLabel):
+ (JSC::JSParser::Scope::isFunction):
+ (JSC::JSParser::Scope::declareVariable):
+ (JSC::JSParser::Scope::declareWrite):
+ (JSC::JSParser::Scope::deleteProperty):
+ (JSC::JSParser::Scope::declareParameter):
+ (JSC::JSParser::Scope::setNeedsFullActivation):
+ (JSC::JSParser::Scope::collectFreeVariables):
+ (JSC::JSParser::Scope::getUncapturedWrittenVariables):
+ (JSC::JSParser::Scope::getDeletedVariables):
+ (JSC::JSParser::Scope::setStrictMode):
+ (JSC::JSParser::Scope::strictMode):
+ (JSC::JSParser::Scope::isValidStrictMode):
+ (JSC::JSParser::pushScope):
+ (JSC::JSParser::popScope):
+ (JSC::JSParser::declareVariable):
+ (JSC::JSParser::declareWrite):
+ (JSC::JSParser::deleteProperty):
+ (JSC::jsParse):
+ (JSC::JSParser::JSParser):
+ (JSC::JSParser::parseProgram):
+ (JSC::JSParser::parseSourceElements):
+ (JSC::JSParser::parseDoWhileStatement):
+ (JSC::JSParser::parseWhileStatement):
+ (JSC::JSParser::parseVarDeclarationList):
+ (JSC::JSParser::parseConstDeclarationList):
+ (JSC::JSParser::parseForStatement):
+ (JSC::JSParser::parseBreakStatement):
+ (JSC::JSParser::parseContinueStatement):
+ (JSC::JSParser::parseReturnStatement):
+ (JSC::JSParser::parseWithStatement):
+ (JSC::JSParser::parseSwitchStatement):
+ (JSC::JSParser::parseSwitchClauses):
+ (JSC::JSParser::parseSwitchDefaultClause):
+ (JSC::JSParser::parseTryStatement):
+ (JSC::JSParser::parseBlockStatement):
+ (JSC::JSParser::parseStatement):
+ (JSC::JSParser::parseFormalParameters):
+ (JSC::JSParser::parseFunctionBody):
+ (JSC::JSParser::parseFunctionInfo):
+ (JSC::JSParser::parseFunctionDeclaration):
+ (JSC::JSParser::parseExpressionOrLabelStatement):
+ (JSC::JSParser::parseIfStatement):
+ (JSC::JSParser::parseExpression):
+ (JSC::JSParser::parseAssignmentExpression):
+ (JSC::JSParser::parseConditionalExpression):
+ (JSC::JSParser::parseBinaryExpression):
+ (JSC::JSParser::parseStrictObjectLiteral):
+ (JSC::JSParser::parsePrimaryExpression):
+ (JSC::JSParser::parseMemberExpression):
+ (JSC::JSParser::parseUnaryExpression):
+ * parser/JSParser.h:
+ * parser/Lexer.cpp:
+ (JSC::Lexer::parseString):
+ (JSC::Lexer::lex):
+ * parser/Lexer.h:
+ (JSC::Lexer::isReparsing):
+ * parser/Nodes.cpp:
+ (JSC::ScopeNode::ScopeNode):
+ (JSC::FunctionBodyNode::FunctionBodyNode):
+ (JSC::FunctionBodyNode::create):
+ * parser/Nodes.h:
+ (JSC::ScopeNode::isStrictMode):
+ * parser/Parser.cpp:
+ (JSC::Parser::parse):
+ * parser/Parser.h:
+ (JSC::Parser::parse):
+ * parser/SyntaxChecker.h:
+ (JSC::SyntaxChecker::SyntaxChecker):
+ (JSC::SyntaxChecker::makeFunctionCallNode):
+ (JSC::SyntaxChecker::appendToComma):
+ (JSC::SyntaxChecker::createCommaExpr):
+ (JSC::SyntaxChecker::makeAssignNode):
+ (JSC::SyntaxChecker::makePrefixNode):
+ (JSC::SyntaxChecker::makePostfixNode):
+ (JSC::SyntaxChecker::makeTypeOfNode):
+ (JSC::SyntaxChecker::makeDeleteNode):
+ (JSC::SyntaxChecker::makeNegateNode):
+ (JSC::SyntaxChecker::makeBitwiseNotNode):
+ (JSC::SyntaxChecker::createLogicalNot):
+ (JSC::SyntaxChecker::createUnaryPlus):
+ (JSC::SyntaxChecker::createVoid):
+ (JSC::SyntaxChecker::thisExpr):
+ (JSC::SyntaxChecker::createResolve):
+ (JSC::SyntaxChecker::createObjectLiteral):
+ (JSC::SyntaxChecker::createArray):
+ (JSC::SyntaxChecker::createNumberExpr):
+ (JSC::SyntaxChecker::createString):
+ (JSC::SyntaxChecker::createBoolean):
+ (JSC::SyntaxChecker::createNull):
+ (JSC::SyntaxChecker::createBracketAccess):
+ (JSC::SyntaxChecker::createDotAccess):
+ (JSC::SyntaxChecker::createRegex):
+ (JSC::SyntaxChecker::createNewExpr):
+ (JSC::SyntaxChecker::createConditionalExpr):
+ (JSC::SyntaxChecker::createAssignResolve):
+ (JSC::SyntaxChecker::createFunctionExpr):
+ (JSC::SyntaxChecker::createFunctionBody):
+ (JSC::SyntaxChecker::appendBinaryExpressionInfo):
+ (JSC::SyntaxChecker::operatorStackPop):
+ * runtime/Arguments.cpp:
+ (JSC::Arguments::createStrictModeCallerIfNecessary):
+ (JSC::Arguments::createStrictModeCalleeIfNecessary):
+ (JSC::Arguments::getOwnPropertySlot):
+ (JSC::Arguments::getOwnPropertyDescriptor):
+ (JSC::Arguments::put):
+ (JSC::Arguments::deleteProperty):
+ * runtime/Arguments.h:
+ (JSC::Arguments::Arguments):
+ * runtime/CommonIdentifiers.cpp:
+ (JSC::CommonIdentifiers::CommonIdentifiers):
+ * runtime/CommonIdentifiers.h:
+ * runtime/Error.cpp:
+ (JSC::StrictModeTypeErrorFunction::StrictModeTypeErrorFunction):
+ (JSC::StrictModeTypeErrorFunction::constructThrowTypeError):
+ (JSC::StrictModeTypeErrorFunction::getConstructData):
+ (JSC::StrictModeTypeErrorFunction::callThrowTypeError):
+ (JSC::StrictModeTypeErrorFunction::getCallData):
+ (JSC::createTypeErrorFunction):
+ * runtime/Error.h:
+ * runtime/Executable.cpp:
+ (JSC::EvalExecutable::EvalExecutable):
+ (JSC::ProgramExecutable::ProgramExecutable):
+ (JSC::FunctionExecutable::FunctionExecutable):
+ (JSC::EvalExecutable::compileInternal):
+ (JSC::ProgramExecutable::checkSyntax):
+ (JSC::ProgramExecutable::compileInternal):
+ (JSC::FunctionExecutable::compileForCallInternal):
+ (JSC::FunctionExecutable::compileForConstructInternal):
+ (JSC::FunctionExecutable::reparseExceptionInfo):
+ (JSC::EvalExecutable::reparseExceptionInfo):
+ (JSC::FunctionExecutable::fromGlobalCode):
+ (JSC::ProgramExecutable::reparseExceptionInfo):
+ * runtime/Executable.h:
+ (JSC::ScriptExecutable::ScriptExecutable):
+ (JSC::ScriptExecutable::isStrictMode):
+ (JSC::EvalExecutable::create):
+ (JSC::FunctionExecutable::create):
+ * runtime/JSActivation.cpp:
+ (JSC::JSActivation::toStrictThisObject):
+ * runtime/JSActivation.h:
+ * runtime/JSFunction.cpp:
+ (JSC::createDescriptorForThrowingProperty):
+ (JSC::JSFunction::getOwnPropertySlot):
+ (JSC::JSFunction::getOwnPropertyDescriptor):
+ (JSC::JSFunction::put):
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData):
+ * runtime/JSGlobalData.h:
+ * runtime/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::reset):
+ * runtime/JSGlobalObject.h:
+ (JSC::JSGlobalObject::internalFunctionStructure):
+ * runtime/JSGlobalObjectFunctions.cpp:
+ (JSC::globalFuncEval):
+ * runtime/JSObject.cpp:
+ (JSC::JSObject::put):
+ (JSC::JSObject::toStrictThisObject):
+ (JSC::throwTypeError):
+ * runtime/JSObject.h:
+ (JSC::JSObject::isStrictModeFunction):
+ (JSC::JSObject::putDirectInternal):
+ (JSC::JSObject::putDirect):
+ (JSC::JSValue::putDirect):
+ (JSC::JSValue::toStrictThisObject):
+ * runtime/JSStaticScopeObject.cpp:
+ (JSC::JSStaticScopeObject::toStrictThisObject):
+ * runtime/JSStaticScopeObject.h:
+ * runtime/JSValue.h:
+ * runtime/JSZombie.h:
+ (JSC::JSZombie::toStrictThisObject):
+ * runtime/PutPropertySlot.h:
+ (JSC::PutPropertySlot::PutPropertySlot):
+ (JSC::PutPropertySlot::isStrictMode):
+ * runtime/StrictEvalActivation.cpp: Added.
+ (JSC::StrictEvalActivation::StrictEvalActivation):
+ (JSC::StrictEvalActivation::deleteProperty):
+ (JSC::StrictEvalActivation::toThisObject):
+ (JSC::StrictEvalActivation::toStrictThisObject):
+ * runtime/StrictEvalActivation.h: Added.
+
+2010-10-10 Patrick Gansterer <paroga@webkit.org>
+
+ Unreviewed.
+
+ Windows build fix after r69472.
+
+ * wtf/text/StringHash.h:
+ (WTF::CaseFoldingHash::hash):
+
+2010-10-10 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by Adam Barth.
+
+ Use WTF::StringHasher in WTF::CaseFoldingHash
+ https://bugs.webkit.org/show_bug.cgi?id=46523
+
+ * wtf/text/StringHash.h:
+ (WTF::CaseFoldingHash::foldCase):
+ (WTF::CaseFoldingHash::hash):
+
+2010-10-09 Pratik Solanki <psolanki@apple.com>
+
+ Reviewed by Xan Lopez.
+
+ https://bugs.webkit.org/show_bug.cgi?id=47445
+ Remove unused function WTFThreadData::initializeIdentifierTable()
+
+ * wtf/WTFThreadData.h:
+
+2010-10-08 Michael Saboff <msaboff@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Added check to start of subexpression being positive before using
+ subexpression in replacement.
+ https://bugs.webkit.org/show_bug.cgi?id=47324
+
+ * runtime/StringPrototype.cpp:
+ (JSC::substituteBackreferencesSlow):
+
+2010-10-08 Chris Evans <cevans@google.com>
+
+ Reviewed by David Levin.
+
+ https://bugs.webkit.org/show_bug.cgi?id=47393
+
+ Use unsigned consistently to check for max StringImpl length.
+ Add a few integer overflow checks.
+ Uses the existing paradigm of CRASH() when we can't reasonably handle a crazily large request.
+
+ * wtf/text/WTFString.cpp:
+ * wtf/text/StringImpl.h:
+ * wtf/text/StringImpl.cpp:
+ Better use of size_t vs. unsigned; check for integer overflows.
+
+2010-10-07 David Goodwin <david_goodwin@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ ARM JIT generates undefined operations due to partially uninitialized ShiftTypeAndAmount
+ https://bugs.webkit.org/show_bug.cgi?id=47356
+
+ * assembler/ARMv7Assembler.h:
+
+2010-10-06 Chris Evans <cevans@google.com>
+
+ Reviewed by David Levin.
+
+ https://bugs.webkit.org/show_bug.cgi?id=47248
+
+ Use size_t consistently in CString, to prevent theoretical trouble
+ with > 4GB strings on 64-bit platforms.
+
+ * wtf/text/CString.h:
+ * wtf/text/CString.cpp:
+ Use size_t for string lengths.
+ * wtf/MD5.cpp:
+ (WTF::expectMD5): use suitable format string + cast for size_t.
+ * JavaScriptCore.exp:
+ Update symbol name.
+
+2010-10-06 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Start cleaning up Arguments.h
+ https://bugs.webkit.org/show_bug.cgi?id=47304
+
+ * wtf/TypeTraits.h:
+ * wtf/TypeTraits.cpp:
+ Add RemoveReference type trait.
+
+2010-10-06 Rafael Antognolli <antognolli@profusion.mobi>
+
+ Unreviewed build fix.
+
+ [EFL] Build fix for glib support.
+ https://bugs.webkit.org/show_bug.cgi?id=47221
+
+ If compiling with GLib support enabled, we also need to link wtf against
+ glib library.
+
+ * wtf/CMakeListsEfl.txt:
+
+2010-10-05 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Gavin Barraclough.
+
+ [BREWMP] Port ExecutableAllocator::cacheFlush to enable ARM JIT
+ https://bugs.webkit.org/show_bug.cgi?id=47117
+
+ Use IMemCache1 to flush data cache and invalidate instruction cache.
+
+ * jit/ExecutableAllocator.h:
+ (JSC::ExecutableAllocator::cacheFlush):
+
+2010-10-05 Leandro Pereira <leandro@profusion.mobi>
+
+ Unreviewed. Build fix.
+
+ Moved "jsc" directory to "shell", so that the name does not clash with the
+ JavaScriptCore shell in some build systems.
+ http://webkit.org/b/47049
+
+ * CMakeLists.txt: Changed reference from "jsc" to "shell".
+ * jsc: Removed.
+ * jsc/CMakeLists.txt: Removed.
+ * jsc/CMakeListsEfl.txt: Removed.
+ * shell: Copied from JavaScriptCore/jsc.
+
+2010-10-05 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Kent Tamura.
+
+ [BREWMP] Use PlatformRefPtr in randomNumber
+ https://bugs.webkit.org/show_bug.cgi?id=46989
+
+ Use PlatformRefPtr to free memory automatically.
+
+ * wtf/RandomNumber.cpp:
+ (WTF::randomNumber):
+
+2010-10-05 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Darin Adler.
+
+ REGRESSION(r68338): JavaScript error on PowerPC only (crashes on Interpreter built for x86_64)
+ https://bugs.webkit.org/show_bug.cgi?id=46690
+
+ Use the correct register value when initialising the arguments
+ object in the interpreter. This is covered by existing tests.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+
+2010-10-04 David Goodwin <david_goodwin@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ ARMv7 JIT should take advantage of 2-byte branches to reduce code size
+ https://bugs.webkit.org/show_bug.cgi?id=47007
+
+ * assembler/ARMv7Assembler.cpp:
+ * assembler/ARMv7Assembler.h:
+ (JSC::ARMv7Assembler::computeJumpType):
+ (JSC::ARMv7Assembler::link):
+ (JSC::ARMv7Assembler::canBeJumpT2):
+ (JSC::ARMv7Assembler::canBeJumpT4):
+ (JSC::ARMv7Assembler::linkBX):
+ (JSC::ARMv7Assembler::linkJumpT4):
+ (JSC::ARMv7Assembler::linkJumpT2):
+ (JSC::ARMv7Assembler::linkJumpAbsolute):
+
+2010-10-04 Gyuyoung Kim <gyuyoung.kim@samsung.com>
+
+ Reviewed by Antonio Gomes.
+
+ [EFL] Use fast malloc for WebKit EFL
+ https://bugs.webkit.org/show_bug.cgi?id=46691
+
+ Use fast malloc for WebKit EFL because the fast malloc is to allocate
+ memory quickly.
+
+ * wtf/CMakeListsEfl.txt:
+
+2010-10-04 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Lazily create activation objects
+ https://bugs.webkit.org/show_bug.cgi?id=47107
+
+ Make it possible to lazily create the activation object
+ for a function that needs one. This allows us to reduce
+ the overhead of entering a function that may require
+ an activation in some cases, but not always.
+
+ This does make exception handling a little more complex as
+ it's now necessary to verify that a callframes activation
+ has been created, and create it if not, in all of the
+ paths used in exception handling.
+
+ We also need to add logic to check for the existence of
+ the activation in the scoped_var opcodes, as well as
+ op_ret, op_ret_object_or_this and op_tearoff_activation
+ so that we can avoid creating an activation unnecesarily
+ on function exit.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::dump):
+ (JSC::CodeBlock::reparseForExceptionInfoIfNecessary):
+ (JSC::CodeBlock::createActivation):
+ * bytecode/CodeBlock.h:
+ (JSC::CodeBlock::setActivationRegister):
+ (JSC::CodeBlock::activationRegister):
+ * bytecode/Opcode.h:
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::BytecodeGenerator):
+ (JSC::BytecodeGenerator::emitNewFunctionInternal):
+ (JSC::BytecodeGenerator::emitNewFunctionExpression):
+ (JSC::BytecodeGenerator::createActivationIfNecessary):
+ * bytecompiler/BytecodeGenerator.h:
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::resolveSkip):
+ (JSC::Interpreter::resolveGlobalDynamic):
+ (JSC::Interpreter::resolveBase):
+ (JSC::Interpreter::unwindCallFrame):
+ (JSC::Interpreter::throwException):
+ (JSC::Interpreter::privateExecute):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ * jit/JIT.h:
+ * jit/JITCall32_64.cpp:
+ (JSC::JIT::emit_op_ret):
+ (JSC::JIT::emit_op_ret_object_or_this):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_end):
+ (JSC::JIT::emit_op_get_scoped_var):
+ (JSC::JIT::emit_op_put_scoped_var):
+ (JSC::JIT::emit_op_tear_off_activation):
+ (JSC::JIT::emit_op_ret):
+ (JSC::JIT::emit_op_ret_object_or_this):
+ (JSC::JIT::emit_op_create_activation):
+ (JSC::JIT::emit_op_resolve_global_dynamic):
+ * jit/JITOpcodes32_64.cpp:
+ (JSC::JIT::emit_op_get_scoped_var):
+ (JSC::JIT::emit_op_put_scoped_var):
+ (JSC::JIT::emit_op_tear_off_activation):
+ (JSC::JIT::emit_op_create_activation):
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+
+2010-10-04 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Sam Weinig.
+
+ Remove ENABLE_SANDBOX
+ https://bugs.webkit.org/show_bug.cgi?id=47032
+
+ * Configurations/FeatureDefines.xcconfig:
+
+2010-10-01 Pratik Solanki <psolanki@apple.com>
+
+ Reviewed by Geoffrey Garen.
+ Specify ALWAYS_INLINE at function declaration not function definition
+ https://bugs.webkit.org/show_bug.cgi?id=46960
+
+ For functions defined with ALWAYS_INLINE, add the attribute to the declaration as well.
+
+ * bytecompiler/BytecodeGenerator.h:
+ * wtf/FastMalloc.cpp:
+
+2010-10-01 Kwang Yul Seo <skyul@company100.net>
+
+ Unreviewed.
+
+ [BREWMP] Change Collector BLOCK_SIZE to 64KB
+ https://bugs.webkit.org/show_bug.cgi?id=46436
+
+ Lower BLOCK_SIZE to 64KB because Brew MP runs on low end devices.
+
+ * runtime/Collector.h:
+
+2010-10-01 Viatcheslav Ostapenko <ostapenko.viatcheslav@nokia.com>
+
+ Reviewed by Andreas Kling.
+
+ [Qt] Stack overflow on symbian platform.
+ https://bugs.webkit.org/show_bug.cgi?id=40598
+
+ Move big allocation in arrayProtoFuncToString from stack to heap.
+ JSC::arrayProtoFuncToString function can be called recursivly and
+ 1K allocation on stack cahse stack overflow.
+ Can be useful for other platforms with limited stack size.
+
+ * runtime/ArrayPrototype.cpp:
+ (JSC::arrayProtoFuncToString):
+
+2010-09-30 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Kent Tamura.
+
+ [BREWMP] Add a factory function which returns an instance wrapped in PlatformRefPtr.
+ https://bugs.webkit.org/show_bug.cgi?id=46373
+
+ A Brew MP instance has reference count 1 when it is created, so call adoptPlatformRef
+ to wrap the instance in PlatformRefPtr.
+
+ * wtf/brew/ShellBrew.h:
+ (WTF::createRefPtrInstance):
+
+2010-09-30 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Kent Tamura.
+
+ [BREWMP] Port PlatformRefPtr
+ https://bugs.webkit.org/show_bug.cgi?id=46370
+
+ Implement refPlatformPtr and derefPlatformPtr to use PlatformRefPtr in Brew MP.
+
+ * wtf/brew/RefPtrBrew.h: Added.
+ (WTF::refPlatformPtr):
+ (WTF::derefPlatformPtr):
+
+2010-09-29 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ Add additional checks to StringBuffer.
+ <rdar://problem/7756381>
+
+ * wtf/text/StringBuffer.h:
+ (WTF::StringBuffer::StringBuffer):
+ (WTF::StringBuffer::resize):
+
+2010-09-30 Chris Marrin <cmarrin@apple.com>
+
+ Reviewed by Simon Fraser.
+
+ Make 2D accelerated canvas rendering build on Mac
+ https://bugs.webkit.org/show_bug.cgi?id=46007
+
+ Added ACCELERATED_2D_CANVAS to FeatureDefines
+
+ * Configurations/FeatureDefines.xcconfig:
+
+2010-09-30 Kevin Ollivier <kevino@theolliviers.com>
+
+ [wx] wxMSW build fix. Make sure we copy the compiler flags and remove exception handling from
+ the copy so as not to alter global settings.
+
+ * wscript:
+
+2010-09-30 Peter Varga <pvarga@inf.u-szeged.hu>
+
+ Reviewed by Gavin Barraclough.
+
+ The case-insensitivity backreference checking isn't working with YARR
+ Interpreter
+ https://bugs.webkit.org/show_bug.cgi?id=46882
+
+ Add ignorecase checking to the Interpreter::tryConsumeBackReference() function.
+
+ * yarr/RegexInterpreter.cpp:
+ (JSC::Yarr::Interpreter::tryConsumeBackReference):
+
+2010-09-30 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Andreas Kling.
+
+ [BREWMP] Leave initializeRandomNumberGenerator empty.
+ https://bugs.webkit.org/show_bug.cgi?id=46851
+
+ On Brew MP, AEECLSID_RANDOM initializes itself.
+
+ * wtf/RandomNumberSeed.h:
+ (WTF::initializeRandomNumberGenerator):
+
+2010-09-30 Gabor Loki <loki@webkit.org>
+
+ Reviewed by Csaba Osztrogonác.
+
+ Remove unnecessary cacheFlush calls from Thumb-2
+ https://bugs.webkit.org/show_bug.cgi?id=46702
+
+ * assembler/ARMv7Assembler.h:
+ (JSC::ARMv7Assembler::relinkCall):
+ (JSC::ARMv7Assembler::repatchInt32):
+ (JSC::ARMv7Assembler::repatchPointer):
+
+2010-09-29 Patrick Gansterer <paroga@webkit.org>
+
+ Unreviewed.
+
+ Next try to fix cygwin build.
+
+ * wtf/Assertions.cpp:
+
+2010-09-29 Patrick Gansterer <paroga@webkit.org>
+
+ Unreviewed.
+
+ Build fix for cygwin #2. It's OS(WINDOWS), not OS(WIN).
+
+ * wtf/Assertions.cpp:
+
+2010-09-29 Patrick Gansterer <paroga@webkit.org>
+
+ Unreviewed.
+
+ Build fix for cygwin.
+
+ * wtf/Assertions.cpp:
+
+2010-09-29 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by Andreas Kling.
+
+ [WINCE] Buildfix for Assertions.cpp after r68511.
+ https://bugs.webkit.org/show_bug.cgi?id=46807
+
+ Some, but not all WinCE environments have support for IsDebuggerPresent().
+ Add HAVE(ISDEBUGGERPRESENT) to make this a build option.
+ HAVE(ISDEBUGGERPRESENT) will be 1 for all OS(WIN) by default.
+
+ * wtf/Assertions.cpp:
+ * wtf/Platform.h:
+
+2010-09-29 Peter Varga <pvarga@inf.u-szeged.hu>
+
+ Reviewed by Csaba Osztrogonác.
+
+ JSC compile fails on 32bit platform when Regexp Tracing is enabled
+ https://bugs.webkit.org/show_bug.cgi?id=46713
+
+ Fix the cast of pointer in regexp tracing to avoid the warning.
+
+ * runtime/RegExp.cpp:
+ (JSC::RegExp::match):
+
+2010-09-28 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Begin hooking up painting in the plug-in process
+ https://bugs.webkit.org/show_bug.cgi?id=46766
+
+ * JavaScriptCore.exp:
+ Add tryFastRealloc, used by WebKit2.
+
+2010-09-28 Philippe Normand <pnormand@igalia.com>
+
+ Reviewed by Martin Robinson.
+
+ Guard GRefPtr/GOwnPtr files with ENABLE(GLIB_SUPPORT)
+ https://bugs.webkit.org/show_bug.cgi?id=46721
+
+ Enable GOwnPtr/GRefPtr build only if glib support has been
+ explicitly enabled using the WTF_ENABLE_GLIB_SUPPORT macro.
+
+ * wtf/gobject/GOwnPtr.cpp:
+ * wtf/gobject/GOwnPtr.h:
+ * wtf/gobject/GRefPtr.cpp:
+ * wtf/gobject/GRefPtr.h:
+
+2010-09-28 İsmail Dönmez <ismail@namtrac.org>
+
+ Reviewed by Andreas Kling.
+
+ Test for WINCE instead of WINCEBASIC, compiler always defines WINCE.
+ Remove reference to unexisting path JavaScriptCore/os-wince.
+
+ * JavaScriptCore.pri:
+ * wtf/Assertions.cpp:
+
+2010-09-27 Michael Saboff <msaboff@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Changed the initialization of JSArray objects to have space for
+ 3 elements for the constructor that takes a ArgList argument.
+ This improves v8-deltablue performance by about 2.8% by reducing
+ the number of realloc() calls.
+ https://bugs.webkit.org/show_bug.cgi?id=46664
+
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::JSArray):
+
+2010-09-27 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Bug 46680 - Inlining string concatenation can regress interpreter performance
+ <rdar://problem/8362752> REGRESSION: ~6.4% sunspider regression in interpreter
+ Do not inline calls to string concatenation in the interpret loop.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::concatenateStrings):
+ (JSC::Interpreter::privateExecute):
+
+2010-09-27 Anders Carlsson <andersca@apple.com>
+
+ Fix thinko.
+
+ * runtime/JSCell.h:
+
+2010-09-27 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Adam Roben.
+
+ Try to fix Windows build.
+
+ * runtime/JSCell.h:
+ (JSC::MSVCBugWorkaround::MSVCBugWorkaround):
+ (JSC::MSVCBugWorkaround::~MSVCBugWorkaround):
+
+2010-09-27 Erik Arvidsson <arv@chromium.org>
+
+ Reviewed by Darin Adler.
+
+ Add operator == for AtomicString and Vector<Uchar>
+ https://bugs.webkit.org/show_bug.cgi?id=46509
+
+ * JavaScriptCore.exp:
+ * wtf/text/AtomicString.cpp:
+ (WTF::operator==):
+ * wtf/text/AtomicString.h:
+ (WTF::operator==):
+ (WTF::operator!=):
+
+2010-09-27 Anders Carlsson <andersca@apple.com>
+
+ Try to fix the Windows build.
+
+ * wtf/Noncopyable.h:
+
+2010-09-26 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Alexey Proskuryakov and Adam Barth.
+
+ Add WTF_MAKE_NONCOPYABLE macro
+ https://bugs.webkit.org/show_bug.cgi?id=46589
+
+ Going forward, we'd like to get rid of the Noncopyable and FastAllocBase classes. The
+ reason for this is that the Itanium C++ ABI states that no empty classes of the same type
+ can be laid out at the same offset in the class. This can result in objects getting larger
+ which leads to memory regressions. (One example of this is the String class which grew by
+ sizeof(void*) when both its base class and its first member variable inherited indirectly
+ from FastAllocBase).
+
+ * wtf/Noncopyable.h:
+ Add a WTF_MAKE_NONCOPYABLE macro and get rid of NoncopyableCustomAllocated.
+
+ * runtime/JSCell.h:
+ * wtf/RefCounted.h:
+ Don't inherit from NoncopyableCustomAllocated. Instead, use WTF_MAKE_NONCOPYABLE.
+
+2010-09-27 Philippe Normand <pnormand@igalia.com>
+
+ Reviewed by Martin Robinson.
+
+ [GTK] use ENABLE(GLIB_SUPPORT)
+ https://bugs.webkit.org/show_bug.cgi?id=46630
+
+ * wtf/Platform.h: Include GTypedefs.h only if glib support
+ is explicitly enabled.
+
+2010-09-25 Holger Hans Peter Freyther <holger@moiji-mobile.com>
+
+ Reviewed by Adam Barth.
+
+ jsc: Document the strcat opcode.
+ https://bugs.webkit.org/show_bug.cgi?id=46571
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+
+2010-09-21 Holger Hans Peter Freyther <holger@moiji-mobile.com>
+
+ Reviewed by Adam Barth.
+
+ make-bytecode-docs.pl: Add a comment to the generated HTML
+ https://bugs.webkit.org/show_bug.cgi?id=46570
+
+ Generate an HTML Comment that this file was generated from
+ Interpreter.cpp with the make-bytecode-docs.pl script.
+
+ * docs/make-bytecode-docs.pl:
+
+2010-09-27 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by Adam Barth.
+
+ Remove WTF::stringHash functions
+ https://bugs.webkit.org/show_bug.cgi?id=46520
+
+ Since r68289 the stringHash functions are only wrappers around StringHasher::createHash.
+ So use StringHasher::createHash directly and remove stringHash.
+
+ * wtf/StringHashFunctions.h:
+ * wtf/text/StringImpl.h:
+ (WTF::StringImpl::computeHash): Use WTF::StringHasher::createHash directly.
+
+2010-09-26 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by Adam Barth.
+
+ Add WTF::StringHasher::createBlobHash
+ https://bugs.webkit.org/show_bug.cgi?id=46514
+
+ Add this function for hashing FormElementKey and QualifiedNameComponents.
+
+ * wtf/StringHashFunctions.h:
+ (WTF::StringHasher::createBlobHash):
+
+2010-09-26 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by Adam Barth.
+
+ REGRESSION (r68289): Assertion failure in StringHasher::addCharacter() (ch != invalidCharacterValue)
+ running websocket/tests/bad-sub-protocol-non-ascii.html
+ https://bugs.webkit.org/show_bug.cgi?id=46553
+
+ Because we use StringHasher for binary data too, so the check for invalid unicode input is wrong.
+ Add an additional member variable to indicate if we have an pending character
+ instead of only using an invalid character for this purpose.
+
+ * wtf/StringHashFunctions.h:
+ (WTF::StringHasher::StringHasher):
+ (WTF::StringHasher::addCharacters):
+ (WTF::StringHasher::addCharacter):
+ (WTF::StringHasher::hash):
+
+2010-09-26 Mark Hahnenberg <mhahnenb@gmail.com>
+
+ Reviewed by Oliver Hunt.
+
+ valueOf called in wrong order in atan2 and date constructors.
+ https://bugs.webkit.org/show_bug.cgi?id=26978
+
+ Fixed the bug where the arguments to atan2 were being evaluated
+ out of order.
+
+ * runtime/MathObject.cpp:
+ (JSC::mathProtoFuncATan2):
+
+2010-09-26 Mark Hahnenberg <mhahnenb@gmail.com>
+
+ Reviewed by Oliver Hunt.
+
+ valueOf called in wrong order in atan2 and date constructors.
+ https://bugs.webkit.org/show_bug.cgi?id=26978
+
+ Fixed the issue where the parameters to the Date constructor
+ were being evaluated to numbers more than once.
+
+ * runtime/DateConstructor.cpp:
+ (JSC::constructDate):
+ (JSC::dateUTC):
+
+2010-09-25 Oliver Hunt <oliver@apple.com>
+
+ Fix various builds
+
+ Relearning the lesson that last minute changes are bad.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::dump):
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::emitGetArgumentsLength):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emitSlow_op_get_argument_by_val):
+
+2010-09-25 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ Avoid constructing arguments object when accessing length and index properties
+ https://bugs.webkit.org/show_bug.cgi?id=46572
+
+ Add opcodes to read argument length and properties, and then implement them.
+ Much like other lazy opcodes these opcodes take a fast path when the arguments
+ object has not been instantiated, and fall back on generic access mechanisms
+ if they are acting on an instantiated object.
+
+ 3% win on v8-earleyboyer, no change elsewhere.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::dump):
+ * bytecode/Opcode.h:
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::emitGetArgumentsLength):
+ (JSC::BytecodeGenerator::emitGetArgumentByVal):
+ * bytecompiler/BytecodeGenerator.h:
+ * bytecompiler/NodesCodegen.cpp:
+ (JSC::BracketAccessorNode::emitBytecode):
+ (JSC::DotAccessorNode::emitBytecode):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ (JSC::JIT::privateCompileSlowCases):
+ * jit/JIT.h:
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_get_arguments_length):
+ (JSC::JIT::emitSlow_op_get_arguments_length):
+ (JSC::JIT::emit_op_get_argument_by_val):
+ (JSC::JIT::emitSlow_op_get_argument_by_val):
+ * jit/JITOpcodes32_64.cpp:
+ (JSC::JIT::emit_op_get_arguments_length):
+ (JSC::JIT::emitSlow_op_get_arguments_length):
+ (JSC::JIT::emit_op_get_argument_by_val):
+ (JSC::JIT::emitSlow_op_get_argument_by_val):
+
+2010-09-25 Patrick Gansterer <paroga@webkit.org>
+
+ Unreviewed.
+
+ Fix typo in StringHasher class
+ https://bugs.webkit.org/show_bug.cgi?id=45970
+
+ * wtf/StringHashFunctions.h:
+ (WTF::StringHasher::createHash):
+
+2010-09-24 Patrick Gansterer <paroga@paroga.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Add WTF::StringHasher
+ https://bugs.webkit.org/show_bug.cgi?id=45970
+
+ StringHasher is a class for calculation stringHash out of character string.
+ This class will unify the different usages of the same algorithm.
+
+ * wtf/StringHashFunctions.h:
+ (WTF::StringHasher::StringHasher):
+ (WTF::StringHasher::addCharacters):
+ (WTF::StringHasher::addCharacter):
+ (WTF::StringHasher::hash):
+ (WTF::StringHasher::createHash):
+ (WTF::StringHasher::defaultCoverter):
+ (WTF::StringHasher::addCharactersToHash):
+ (WTF::stringHash):
+
+2010-09-24 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Variable declarations inside a catch scope don't get propogated to the parent scope
+ https://bugs.webkit.org/show_bug.cgi?id=46501
+
+ Add logic to make variable declaration look for a scope for the
+ new variable. This allows us to create a scope (eg. for catch)
+ and then seal it, so that additional variable declarations
+ contained are propogated to the correct target. Strangely this
+ comes out as a performance win, but I think it's mostly cache
+ effects.
+
+ * parser/JSParser.cpp:
+ (JSC::JSParser::Scope::Scope):
+ (JSC::JSParser::Scope::preventNewDecls):
+ (JSC::JSParser::Scope::allowsNewDecls):
+ (JSC::JSParser::declareVariable):
+ (JSC::JSParser::parseVarDeclarationList):
+ (JSC::JSParser::parseConstDeclarationList):
+ (JSC::JSParser::parseTryStatement):
+ (JSC::JSParser::parseFormalParameters):
+ (JSC::JSParser::parseFunctionDeclaration):
+
+2010-09-24 İsmail Dönmez <ismail@namtrac.org>
+
+ Reviewed by Csaba Osztrogonác.
+
+ Add a Windows compatible inttypes.h header to fix WinCE build.
+ https://bugs.webkit.org/show_bug.cgi?id=46463
+
+ * os-win32/inttypes.h: Added.
+
+2010-09-24 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ REGRESSION(r68223): It broke 2-3 tests on bots (Requested by Ossy on #webkit).
+ https://bugs.webkit.org/show_bug.cgi?id=46448
+
+ Roll this back in, with additional logic to prevent us from delaying construction
+ of functions named "arguments"
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::dump):
+ * bytecode/Opcode.h:
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::BytecodeGenerator):
+ (JSC::BytecodeGenerator::emitInitLazyRegister):
+ (JSC::BytecodeGenerator::registerFor):
+ (JSC::BytecodeGenerator::createLazyRegisterIfNecessary):
+ (JSC::BytecodeGenerator::constRegisterFor):
+ (JSC::BytecodeGenerator::emitNewFunction):
+ (JSC::BytecodeGenerator::emitLazyNewFunction):
+ (JSC::BytecodeGenerator::emitNewFunctionInternal):
+ * bytecompiler/BytecodeGenerator.h:
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ * jit/JIT.h:
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_init_lazy_reg):
+ (JSC::JIT::emit_op_new_func):
+ * jit/JITOpcodes32_64.cpp:
+ (JSC::JIT::emit_op_init_lazy_reg):
+ * parser/Nodes.h:
+ (JSC::ScopeNode::needsActivationForMoreThanVariables):
+
+2010-09-23 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r68223.
+ http://trac.webkit.org/changeset/68223
+ https://bugs.webkit.org/show_bug.cgi?id=46448
+
+ It broke 2-3 tests on bots (Requested by Ossy on #webkit).
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::dump):
+ * bytecode/Opcode.h:
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::BytecodeGenerator):
+ (JSC::BytecodeGenerator::registerFor):
+ (JSC::BytecodeGenerator::constRegisterFor):
+ (JSC::BytecodeGenerator::emitNewFunction):
+ * bytecompiler/BytecodeGenerator.h:
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ * jit/JIT.h:
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_new_func):
+ (JSC::JIT::emit_op_init_arguments):
+ * jit/JITOpcodes32_64.cpp:
+ (JSC::JIT::emit_op_new_func):
+ (JSC::JIT::emit_op_init_arguments):
+ * parser/Nodes.h:
+
+2010-09-23 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Delay construction of functions that aren't captured
+ https://bugs.webkit.org/show_bug.cgi?id=46433
+
+ If a function isn't captured by an activation there's no
+ way it can be accessed indirectly, so we can delay the
+ construction until it's used (similar to what we do with
+ arguments). We rename the existing op_init_arguments to
+ op_init_lazy_reg and removed its implicit handling of
+ the anonymous argument register, and make op_new_function
+ take a parameter to indicate whether it should null check
+ the target slot before creating the function object.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::dump):
+ * bytecode/Opcode.h:
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::BytecodeGenerator):
+ (JSC::BytecodeGenerator::emitInitLazyRegister):
+ (JSC::BytecodeGenerator::registerFor):
+ (JSC::BytecodeGenerator::createLazyRegisterIfNecessary):
+ (JSC::BytecodeGenerator::constRegisterFor):
+ (JSC::BytecodeGenerator::emitNewFunction):
+ (JSC::BytecodeGenerator::emitLazyNewFunction):
+ (JSC::BytecodeGenerator::emitNewFunctionInternal):
+ * bytecompiler/BytecodeGenerator.h:
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ * jit/JIT.h:
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_init_lazy_reg):
+ (JSC::JIT::emit_op_new_func):
+ * jit/JITOpcodes32_64.cpp:
+ (JSC::JIT::emit_op_init_lazy_reg):
+ * parser/Nodes.h:
+ (JSC::ScopeNode::needsActivationForMoreThanVariables):
+
+2010-09-23 David Kilzer <ddkilzer@apple.com>
+
+ <rdar://problem/8460731> ~9.9% speedup when compiling interpreter with llvm-gcc-4.2
+ https://bugs.webkit.org/show_bug.cgi?id=46423
+
+ Reviewed by Oliver Hunt.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute): Disable the gcc computed
+ goto hacks added in r55564 when compiling with llvm-gcc-4.2.
+
+2010-09-23 Lucas De Marchi <lucas.demarchi@profusion.mobi>
+
+ Reviewed by Darin Adler.
+
+ Fix usage of enum as if it was a define
+ https://bugs.webkit.org/show_bug.cgi?id=46355
+
+ pthread.h defines PTHREAD_MUTEX_DEFAULT and PTHREAD_MUTEX_NORMAL as an
+ enum. Hence, it cannot be used by the preprocessor which always
+ evaluates that condition as true. This was giving a warning when
+ compiling with gcc and "-Wundef" flag.
+
+ The second path, when PTHREAD_MUTEX_DEFAULT is not the same of
+ PTHREAD_MUTEX_NORMAL, is not slow. So, let's eliminate the first path
+ and get rid of that #if.
+
+ * wtf/ThreadingPthreads.cpp: Always call pthread_mutexattr_init() to
+ set mutex type to PTHREAD_MUTEX_NORMAL.
+ (WTF::Mutex::Mutex):
+
+2010-09-23 Michael Saboff <msaboff@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Removed extraneous truncation of ovector on entry and error exit.
+ Changed the initialization to -1 of vector to only initialize
+ the start indecies, which is sufficient for the pattern/subpatterns.
+ Changed the JIT code to not clear the end index for subpatterns
+ as it isn't needed. These changes are worth ~2.7% on v8-regexp.
+ https://bugs.webkit.org/show_bug.cgi?id=46404
+
+ * runtime/RegExp.cpp:
+ (JSC::RegExp::match):
+ * yarr/RegexJIT.cpp:
+ (JSC::Yarr::RegexGenerator::generateParenthesesSingle):
+
+2010-09-22 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Only copy captured variables into activation
+ https://bugs.webkit.org/show_bug.cgi?id=46330
+
+ We now track free variable information which means that
+ we no longer need to copy every variable defined in a
+ function. With this patch activations only retain those
+ variables needed for correctness. In order to interact
+ safely with the inspector this means that JSActivation
+ now provides its own lookup functions so it can avoid
+ trying to read or write to variables that have been
+ optimised out.
+
+ * bytecode/CodeBlock.h:
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::BytecodeGenerator):
+ * parser/Nodes.h:
+ (JSC::ScopeNode::capturedVariableCount):
+ (JSC::ScopeNode::captures):
+ * runtime/Arguments.h:
+ (JSC::JSActivation::copyRegisters):
+ * runtime/Executable.cpp:
+ (JSC::FunctionExecutable::FunctionExecutable):
+ (JSC::FunctionExecutable::compileForCallInternal):
+ (JSC::FunctionExecutable::compileForConstructInternal):
+ * runtime/Executable.h:
+ (JSC::FunctionExecutable::capturedVariableCount):
+ * runtime/JSActivation.cpp:
+ (JSC::JSActivation::markChildren):
+ (JSC::JSActivation::symbolTableGet):
+ (JSC::JSActivation::symbolTablePut):
+ (JSC::JSActivation::getOwnPropertyNames):
+ (JSC::JSActivation::symbolTablePutWithAttributes):
+ * runtime/JSActivation.h:
+
+2010-09-23 Ismail Donmez <ismail@namtrac.org>
+
+ Reviewed by Andreas Kling.
+
+ Fix jsc.exe build for Windows CE
+
+ * jsc.pro: Add mmtimer.lib for Windows CE.
+
+2010-09-23 Ismail Donmez <ismail@namtrac.org>
+
+ Unreviewed.
+
+ JIT should be disabled on Windows CE. Broken in r64176.
+
+ * wtf/Platform.h:
+
+2010-09-23 Peter Varga <pvarga@inf.u-szeged.hu>
+
+ Reviewed by Gavin Barraclough.
+
+ Reduce the number of BOL checks in YARR Interpreter
+ https://bugs.webkit.org/show_bug.cgi?id=46260
+
+ Extend the YARR Interpreter with an optimization which reduces the number of
+ BOL assertion checks. If a "TypeBodyAlternative" byteTerm is followed by a
+ "TypeAssertionBOL" byteTerm it will be checked just one time.
+
+ * yarr/RegexInterpreter.cpp:
+ (JSC::Yarr::Interpreter::matchDisjunction):
+ (JSC::Yarr::ByteCompiler::compile):
+ (JSC::Yarr::ByteCompiler::regexBegin):
+ (JSC::Yarr::ByteCompiler::alternativeBodyDisjunction):
+ (JSC::Yarr::ByteCompiler::emitDisjunction):
+ * yarr/RegexInterpreter.h:
+ (JSC::Yarr::ByteTerm::BodyAlternativeBegin):
+ (JSC::Yarr::ByteTerm::BodyAlternativeDisjunction):
+ (JSC::Yarr::ByteTerm::BodyAlternativeEnd):
+ (JSC::Yarr::ByteTerm::AlternativeBegin):
+ (JSC::Yarr::ByteTerm::AlternativeDisjunction):
+ (JSC::Yarr::ByteTerm::AlternativeEnd):
+
+2010-09-22 Michael Saboff <msaboff@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Fixed the cross over from alternatives executed once and
+ those that loop. This fixed the problem where the index
+ was getting messed up for looping alternatives causing an
+ infinite loop.
+ https://bugs.webkit.org/show_bug.cgi?id=46189
+
+ * yarr/RegexJIT.cpp:
+ (JSC::Yarr::RegexGenerator::generateDisjunction):
+
+2010-09-22 Steve Falkenburg <sfalken@apple.com>
+
+ Rubber stamped by Jon Honeycutt.
+
+ Allow jsc.exe to be run against unversioned ICU.
+
+ * JavaScriptCore.vcproj/jsc/jscCommon.vsprops:
+
+2010-09-22 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Laszlo Gombos.
+
+ Use "typedef wchar_t JSChar" when compiled with RVCT
+ https://bugs.webkit.org/show_bug.cgi?id=40651
+
+ Use wchar_t for JSChar and UChar when compiled with RVCT.
+ Linux is the exception for this rule.
+
+ * API/JSStringRef.h:
+ * wtf/unicode/qt4/UnicodeQt4.h:
+
+2010-09-22 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ [INTERPRETER] Two tests fail with SputnikError: #1.1: if argArray is neither an array nor an arguments object (see 10.1.8), a TypeError exception is thrown
+ https://bugs.webkit.org/show_bug.cgi?id=44245
+
+ Remove incorrect code from op_load_varargs in the interpreter.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+
+2010-09-22 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ [JIT] fast/js/sputnik/Conformance/15_Native_Objects/15.3_Function/15.3.5/S15.3.5.3_A2_T6.html fails
+ https://bugs.webkit.org/show_bug.cgi?id=44246
+
+ JIT code generated for instanceof was not checking to ensure that the prototype property was
+ an object, this patch ensures that it does.
+
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_instanceof):
+ (JSC::JIT::emitSlow_op_instanceof):
+ * jit/JITOpcodes32_64.cpp:
+ (JSC::JIT::emit_op_instanceof):
+ (JSC::JIT::emitSlow_op_instanceof):
+
+2010-09-22 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ Inline UTF8SequenceLength
+ https://bugs.webkit.org/show_bug.cgi?id=45589
+
+ * wtf/unicode/UTF8.cpp:
+ (WTF::Unicode::convertUTF8ToUTF16): Use inline version of UTF8SequenceLength to improve performance.
+
+2010-09-21 Oliver Hunt <oliver@apple.com>
+
+ RS=Gavin Barraclough.
+
+ Fix codeblock dumping
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::dump):
+ * runtime/Executable.h:
+ (JSC::ScriptExecutable::ScriptExecutable):
+
+2010-09-21 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Speed up function.apply(..., arguments)
+ https://bugs.webkit.org/show_bug.cgi?id=46207
+
+ Add code to do argument copying inline in the case
+ where we're using Function.apply to forward our arguments
+ directly.
+
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileSlowCases):
+ Splitted op_load_varargs into fast and slow paths, so add the call
+ to the slow path generator.
+ * jit/JIT.h:
+ * jit/JITCall32_64.cpp:
+ Remove 32bit specific emit_op_load_varargs as the logic is the
+ same for all value representations
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_load_varargs):
+ Copy arguments inline
+ (JSC::JIT::emitSlow_op_load_varargs):
+
+2010-09-21 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ <rdar://problem/8363003> REGRESSION: ~1.4% sunspider regression in
+ interpreter due to 54724 and 54596
+
+ Fixed a typo (using "UNLIKELY" instead of "LIKELY").
+
+ * wtf/PassRefPtr.h:
+ (WTF::refIfNotNull):
+ (WTF::derefIfNotNull): It is likely that m_ptr != 0 because most RefPtrs
+ hold real data. Also, in cases where they do not hold real data, the
+ compiler usually sees a call to release() right before the call to the
+ destructor, so it can probably optimize out the test completely.
+
+2010-09-21 Fridrich Strba <fridrich.strba@bluewin.ch>
+
+ Reviewed by Martin Robinson.
+
+ Build issues with Windows versions of the GTK+ port
+ https://bugs.webkit.org/show_bug.cgi?id=45844
+
+ Link with winmm.dll when necessary and specify the executable extension
+ explicitely so that the Programs/jsc-@WEBKITGTK_API_MAJOR_VERSION@
+ rule actually works.
+
+ Don't try to build the ThreadSpecificWin.cpp since GTK+ port uses
+ a section in ThreadSpecific.cpp
+
+ * GNUmakefile.am:
+
+2010-09-21 Martin Robinson <mrobinson@igalia.com>
+
+ Reviewed by Xan Lopez.
+
+ [GTK] 'make dist' should be fixed in preparation for the next release
+ https://bugs.webkit.org/show_bug.cgi?id=46129
+
+ * GNUmakefile.am: Update the sources list to include missing headers.
+
+2010-09-21 Dave Tapuska <dtapuska@rim.com>
+
+ Reviewed by Csaba Osztrogonác.
+
+ https://bugs.webkit.org/show_bug.cgi?id=45673
+
+ r65596 caused ENABLE_PROFILER_REFERENCE_OFFSET to not be
+ 8 byte aligned. A non 8 byte divisible value for this will
+ cause the sp to become non 8 byte aligned.
+
+ Verify and correct offset values that r65596 effected that
+ weren't updated.
+
+ * jit/JITStubs.cpp:
+ * jit/JITStubs.h:
+
+2010-09-21 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Martin Robinson.
+
+ Fix Opcode stats compilation
+ https://bugs.webkit.org/show_bug.cgi?id=46079
+
+ The FixedArray API had changed, and <stdio.h> was not included for
+ printf.
+
+ * bytecode/Opcode.cpp:
+ (JSC::OpcodeStats::~OpcodeStats):
+
+2010-09-20 Michael Saboff <msaboff@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Fixed detection of alternative smaller than the first alternative
+ to only check looping alternatives.
+ https://bugs.webkit.org/show_bug.cgi?id=46049
+
+ * yarr/RegexJIT.cpp:
+ (JSC::Yarr::RegexGenerator::generateDisjunction):
+
+2010-09-20 Peter Varga <pvarga@inf.u-szeged.hu>
+
+ Reviewed by Geoffrey Garen.
+
+ REGRESSION(67790): jsc tests are failed with YARR interpreter
+ https://bugs.webkit.org/show_bug.cgi?id=46083
+
+ Fix the initializing of the lastSubpatternId member of
+ parentheses.
+
+ * yarr/RegexCompiler.cpp:
+ (JSC::Yarr::RegexPatternConstructor::atomParenthesesEnd):
+
+2010-09-20 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 46077 - ASSERT failure in YARR JIT
+
+ We will currently attempt to loop if there are multiple alternatives, they are all
+ BOL predicated, and the last alternative is longer then the first - however if all
+ alternatives are BOL predicated the head of loop label will not have been set, and
+ we'll try to link a jump to an undefined label. Stop doing so.
+
+ * yarr/RegexJIT.cpp:
+ (JSC::Yarr::RegexGenerator::generateDisjunction):
+
+2010-09-20 Adam Roben <aroben@apple.com>
+
+ Export RegExpObject::info from JavaScriptCore
+
+ This allows obj->inherits(&RegExpObject::info) to work correctly from
+ outside JavaScriptCore.dll on Windows.
+
+ Fixes <http://webkit.org/b/46098>
+ fast/loader/stateobjects/pushstate-object-types.html fails on Windows
+
+ Reviewed by John Sullivan.
+
+ * runtime/RegExpObject.h: Added JS_EXPORTDATA to the info member, as
+ we already have for some other classes whose info members have to be
+ used from outside the DLL.
+
+2010-09-19 Gavin Barraclough <barraclough@apple.com>
+
+ Windows build fix pt 2.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-09-19 Gavin Barraclough <barraclough@apple.com>
+
+ Windows build fix pt 1.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-09-19 Gavin Barraclough <barraclough@apple.com>
+
+ Build fix - implicit double-to-int conversion invalid on 32-bit.
+
+ * runtime/DatePrototype.cpp:
+ (JSC::fillStructuresUsingDateArgs):
+ (JSC::dateProtoFuncSetYear):
+
+2010-09-19 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 46065 - Unify implementation of ToInt32 and ToUInt32, don't use fmod.
+
+ These methods implement the same conversion (see discussion in the notes
+ of sections of 9.5 and 9.6 of the spec), only differing in how the result
+ is interpretted.
+
+ Date prototype is incorrectly using toInt32, and this is causing us to
+ provide an output value indicating whether the input to ToInt32 was finite
+ (the corresponding methods on Date are actually spec'ed to use ToInteger,
+ not ToInt32). This patch partially fixes this in order to remove this
+ bogus output value, hoewever more work will be require to bring Date
+ fully up to spec compliance (the constructor is still performing ToInt32
+ conversions).
+
+ * JavaScriptCore.exp:
+ * runtime/DatePrototype.cpp:
+ (JSC::fillStructuresUsingTimeArgs):
+ (JSC::fillStructuresUsingDateArgs):
+ (JSC::dateProtoFuncSetYear):
+ * runtime/JSValue.cpp:
+ (JSC::toInt32):
+ * runtime/JSValue.h:
+ (JSC::toUInt32):
+ (JSC::JSValue::toInt32):
+ (JSC::JSValue::toUInt32):
+
+2010-09-18 Darin Adler <darin@apple.com>
+
+ First step in fixing Windows build.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ Removed incorrect symbol. The build will probably still fail,
+ but the failure will tell us what symbol to add.
+
+2010-09-18 Michael Saboff <msaboff@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Added code to unroll regular expressions containing ^.
+ Alternatives that begin with ^ are tagged during parsing
+ and rolled up in containing sub expression structs.
+ After parsing, a regular expression flagged as containing
+ a ^ (a.k.a. BOL) is processed further in optimizeBOL().
+ A copy of the disjunction is made excluding alternatives that
+ are rooted with BOL. The original alternatives are flagged
+ to only be executed once. The copy of the other alternatives are
+ added to the original expression.
+ In the case that all original alternatives are flagged, there
+ won't be any looping alternatives.
+ The JIT generator will emit code accordingly, executing the
+ original alternatives once and then looping over the
+ alternatives that aren't anchored with a BOL (if any).
+ https://bugs.webkit.org/show_bug.cgi?id=45787
+
+ * yarr/RegexCompiler.cpp:
+ (JSC::Yarr::RegexPatternConstructor::assertionBOL):
+ (JSC::Yarr::RegexPatternConstructor::atomParenthesesEnd):
+ (JSC::Yarr::RegexPatternConstructor::copyDisjunction):
+ (JSC::Yarr::RegexPatternConstructor::copyTerm):
+ (JSC::Yarr::RegexPatternConstructor::optimizeBOL):
+ (JSC::Yarr::compileRegex):
+ * yarr/RegexJIT.cpp:
+ (JSC::Yarr::RegexGenerator::generateDisjunction):
+ * yarr/RegexPattern.h:
+ (JSC::Yarr::PatternAlternative::PatternAlternative):
+ (JSC::Yarr::PatternAlternative::setOnceThrough):
+ (JSC::Yarr::PatternAlternative::onceThrough):
+ (JSC::Yarr::PatternDisjunction::PatternDisjunction):
+ (JSC::Yarr::RegexPattern::RegexPattern):
+ (JSC::Yarr::RegexPattern::reset):
+
+2010-09-18 Patrick Gansterer <paroga@paroga.com>
+
+ Reviewed by Darin Adler.
+
+ Rename Wince files to WinCE
+ https://bugs.webkit.org/show_bug.cgi?id=37287
+
+ * wtf/unicode/Unicode.h:
+ * wtf/unicode/wince/UnicodeWinCE.cpp: Copied from JavaScriptCore/wtf/unicode/wince/UnicodeWince.cpp.
+ * wtf/unicode/wince/UnicodeWinCE.h: Copied from JavaScriptCore/wtf/unicode/wince/UnicodeWince.h.
+ * wtf/unicode/wince/UnicodeWince.cpp: Removed.
+ * wtf/unicode/wince/UnicodeWince.h: Removed.
+ * wtf/wince/FastMallocWinCE.h: Copied from JavaScriptCore/wtf/wince/FastMallocWince.h.
+ * wtf/wince/FastMallocWince.h: Removed.
+
+2010-09-18 Ademar de Souza Reis Jr <ademar.reis@openbossa.org>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Enable Platform Strategies on Qt
+
+ [Qt] Turn on PLATFORM_STRATEGIES
+ https://bugs.webkit.org/show_bug.cgi?id=45831
+
+ * wtf/Platform.h: Enable Platform Strategies when building QtWebkit
+
+2010-09-17 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Imprecise tracking of variable capture leads to overly pessimistic creation of activations
+ https://bugs.webkit.org/show_bug.cgi?id=46020
+
+ The old logic for track free and captured variables would cause us
+ to decide we needed an activation in every function along the scope
+ chain between a variable capture and its declaration. We now track
+ captured variables precisely which requires a bit of additional work
+
+ The most substantial change is that the parsing routine needs to
+ be passed the list of function parameters when reparsing a function
+ as when reparsing we don't parse the function declaration itself only
+ its body.
+
+ * JavaScriptCore.exp:
+ * parser/JSParser.cpp:
+ (JSC::JSParser::Scope::Scope):
+ (JSC::JSParser::Scope::needsFullActivation):
+ We need to distinguish between use of a feature that requires
+ an activation and eval so we now get this additional flag.
+ (JSC::JSParser::Scope::collectFreeVariables):
+ (JSC::JSParser::Scope::getCapturedVariables):
+ We can't simply return the list of "capturedVariables" now as
+ is insufficiently precise, so we compute them instead.
+ (JSC::JSParser::popScope):
+ (JSC::jsParse):
+ (JSC::JSParser::JSParser):
+ (JSC::JSParser::parseProgram):
+ (JSC::JSParser::parseWithStatement):
+ (JSC::JSParser::parseTryStatement):
+ (JSC::JSParser::parseFunctionInfo):
+ (JSC::JSParser::parseFunctionDeclaration):
+ (JSC::JSParser::parseProperty):
+ (JSC::JSParser::parseMemberExpression):
+ * parser/JSParser.h:
+ * parser/Parser.cpp:
+ (JSC::Parser::parse):
+ * parser/Parser.h:
+ (JSC::Parser::parse):
+ * runtime/Executable.cpp:
+ (JSC::EvalExecutable::compileInternal):
+ (JSC::ProgramExecutable::checkSyntax):
+ (JSC::ProgramExecutable::compileInternal):
+ (JSC::FunctionExecutable::compileForCallInternal):
+ (JSC::FunctionExecutable::compileForConstructInternal):
+ (JSC::FunctionExecutable::reparseExceptionInfo):
+ (JSC::EvalExecutable::reparseExceptionInfo):
+ (JSC::FunctionExecutable::fromGlobalCode):
+ Pass function parameters (if available) to the parser.
+
+2010-09-17 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Add IsFloatingPoint and IsArithmetic type traits
+ https://bugs.webkit.org/show_bug.cgi?id=46018
+
+ * wtf/TypeTraits.h:
+ * wtf/TypeTraits.cpp:
+
+2010-09-17 Martin Robinson <mrobinson@igalia.com>
+
+ Reviewed by Oliver Hunt.
+
+ [GTK] FontPlatformDataFreeType should use smart pointers to hold its members
+ https://bugs.webkit.org/show_bug.cgi?id=45917
+
+ Added support to PlatformRefPtr for handling HashTableDeletedValue.
+
+ * wtf/PlatformRefPtr.h:
+ (WTF::PlatformRefPtr::PlatformRefPtr): Added a constructor that takes HashTableDeletedValue.
+ (WTF::PlatformRefPtr::isHashTableDeletedValue): Added.
+
+2010-09-16 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Crash due to timer triggered GC on one heap while another heap is active
+ https://bugs.webkit.org/show_bug.cgi?id=45932
+ <rdar://problem/8318446>
+
+ The GC timer may trigger for one heap while another heap is active. This
+ is safe, but requires us to ensure that we have temporarily associated the
+ thread's identifierTable with the heap we're collecting on. Otherwise we
+ may end up with the identifier tables in an inconsistent state leading to
+ an eventual crash.
+
+ * runtime/Collector.cpp:
+ (JSC::Heap::allocate):
+ (JSC::Heap::reset):
+ (JSC::Heap::collectAllGarbage):
+ Add assertions to ensure we have the correct identifierTable active
+ while collecting.
+ * runtime/GCActivityCallbackCF.cpp:
+ (JSC::DefaultGCActivityCallbackPlatformData::trigger):
+ Temporarily make the expected IdentifierTable active
+ * wtf/WTFThreadData.h:
+ (JSC::IdentifierTable::remove):
+ Make it possible to see when IdentifierTable::remove has succeeded
+ * wtf/text/StringImpl.cpp:
+ (WTF::StringImpl::~StringImpl):
+ CRASH if an StringImpl is an Identifier but isn't present in the
+ active IdentifierTable. If we get to this state something has
+ gone wrong and we should just crash immediately.
+
+2010-09-16 Martin Robinson <mrobinson@igalia.com>
+
+ Reviewed by Xan Lopez.
+
+ [GTK] Implement dissolveDragImageToFraction
+ https://bugs.webkit.org/show_bug.cgi?id=45826
+
+ * wtf/gobject/GTypedefs.h: Added forward declarations for GtkWindow and GdkEventExpose.
+
+2010-09-16 Eric Uhrhane <ericu@chromium.org>
+
+ Reviewed by Jian Li.
+
+ Unify FILE_SYSTEM and FILE_WRITER enables under the name FILE_SYSTEM.
+ https://bugs.webkit.org/show_bug.cgi?id=45798
+
+ * Configurations/FeatureDefines.xcconfig:
+
+2010-09-15 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Use free variable analysis to improve activation performance
+ https://bugs.webkit.org/show_bug.cgi?id=45837
+
+ Adds free and captured variable tracking to the JS parser. This
+ allows us to avoid construction of an activation object in some
+ cases. Future patches will make more use of this information to
+ improve those cases where activations are still needed.
+
+ * parser/ASTBuilder.h:
+ * parser/JSParser.cpp:
+ (JSC::JSParser::Scope::Scope):
+ (JSC::JSParser::Scope::declareVariable):
+ (JSC::JSParser::Scope::useVariable):
+ (JSC::JSParser::Scope::collectFreeVariables):
+ (JSC::JSParser::Scope::capturedVariables):
+ (JSC::JSParser::ScopeRef::ScopeRef):
+ (JSC::JSParser::ScopeRef::operator->):
+ (JSC::JSParser::ScopeRef::index):
+ (JSC::JSParser::currentScope):
+ (JSC::JSParser::pushScope):
+ (JSC::JSParser::popScope):
+ (JSC::JSParser::parseProgram):
+ (JSC::JSParser::parseVarDeclarationList):
+ (JSC::JSParser::parseConstDeclarationList):
+ (JSC::JSParser::parseTryStatement):
+ (JSC::JSParser::parseFormalParameters):
+ (JSC::JSParser::parseFunctionInfo):
+ (JSC::JSParser::parseFunctionDeclaration):
+ (JSC::JSParser::parsePrimaryExpression):
+ * parser/Nodes.cpp:
+ (JSC::ScopeNodeData::ScopeNodeData):
+ (JSC::ScopeNode::ScopeNode):
+ (JSC::ProgramNode::ProgramNode):
+ (JSC::ProgramNode::create):
+ (JSC::EvalNode::EvalNode):
+ (JSC::EvalNode::create):
+ (JSC::FunctionBodyNode::FunctionBodyNode):
+ (JSC::FunctionBodyNode::create):
+ * parser/Nodes.h:
+ (JSC::ScopeNode::needsActivation):
+ (JSC::ScopeNode::hasCapturedVariables):
+ * parser/Parser.cpp:
+ (JSC::Parser::didFinishParsing):
+ * parser/Parser.h:
+ (JSC::Parser::parse):
+ * parser/SyntaxChecker.h:
+ * runtime/Executable.cpp:
+ (JSC::EvalExecutable::compileInternal):
+ (JSC::ProgramExecutable::compileInternal):
+ (JSC::FunctionExecutable::compileForCallInternal):
+ (JSC::FunctionExecutable::compileForConstructInternal):
+ * runtime/Executable.h:
+ (JSC::ScriptExecutable::needsActivation):
+ (JSC::ScriptExecutable::recordParse):
+
+2010-09-14 Hyung Song <beergun@company100.net>
+
+ Reviewed by Kent Tamura.
+
+ [BREWMP] Add IMemGroup and IMemSpace to OwnPtr type.
+ https://bugs.webkit.org/show_bug.cgi?id=44764
+
+ * wtf/OwnPtrCommon.h:
+ * wtf/brew/OwnPtrBrew.cpp:
+ (WTF::deleteOwnedPtr):
+
+2010-09-14 Darin Adler <darin@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Sort with non-numeric custom sort function fails on array with length but no values
+ https://bugs.webkit.org/show_bug.cgi?id=45781
+
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::sort): Replaced early exit for an array of length zero to instead
+ exit for any array without values, even if it has a non-0 length.
+
+2010-09-14 Steve Falkenburg <sfalken@apple.com>
+
+ Windows production build fix.
+ Roll out r65143.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make:
+
+2010-09-14 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Darin Adler.
+
+ Share UnicodeMacrosFromICU.h
+ https://bugs.webkit.org/show_bug.cgi?id=45710
+
+ glib, qt4 and wince use the same macros from ICU.
+ Remove the code duplication and use the same header file.
+
+ * wtf/unicode/UnicodeMacrosFromICU.h: Copied from JavaScriptCore/wtf/unicode/glib/UnicodeMacrosFromICU.h.
+ * wtf/unicode/glib/UnicodeMacrosFromICU.h: Removed.
+ * wtf/unicode/qt4/UnicodeQt4.h:
+ * wtf/unicode/wince/UnicodeWince.h:
+
+2010-09-13 Darin Adler <darin@apple.com>
+
+ Reviewed by Adam Barth.
+
+ Preparation for eliminating deprecatedParseURL
+ https://bugs.webkit.org/show_bug.cgi?id=45695
+
+ * wtf/text/WTFString.h: Added isAllSpecialCharacters, moved here from
+ the HTML tree builder.
+
+2010-09-13 Darin Fisher <darin@chromium.org>
+
+ Reviewed by David Levin.
+
+ Add option to conditionally compile smooth scrolling support.
+ https://bugs.webkit.org/show_bug.cgi?id=45689
+
+ ENABLE(SMOOTH_SCROLLING) is disabled by default for all platforms.
+
+ * wtf/Platform.h:
+
+2010-09-13 Adam Roben <aroben@apple.com>
+
+ Copy JavaScriptCore's generated sources to the right directory
+
+ * JavaScriptCore.vcproj/JavaScriptCore.make: Fixed typo.
+
+2010-09-13 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Kent Tamura.
+
+ [BREWMP] Don't call _msize
+ https://bugs.webkit.org/show_bug.cgi?id=45556
+
+ Because Brew MP uses its own memory allocator, it is not correct to use
+ _msize in fastMallocSize. Add !PLATFORM(BREWMP) guard.
+
+ * wtf/FastMalloc.cpp:
+ (WTF::fastMallocSize):
+
+2010-09-11 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Reviewed by Andreas Kling.
+
+ [Qt] V8 port: webcore project files changes
+ https://bugs.webkit.org/show_bug.cgi?id=45141
+
+ * JavaScriptCore.pro: Moved wtf specific files to wtf.pri,
+ so that they can also be used from WebCore.pro for v8 builds.
+ * wtf/wtf.pri: Added.
+
+2010-09-10 Fridrich Strba <fridrich.strba@bluewin.ch>
+
+ Reviewed by Andreas Kling.
+
+ Add a define missing when building with glib unicode backend
+ https://bugs.webkit.org/show_bug.cgi?id=45544
+
+ * wtf/unicode/glib/UnicodeMacrosFromICU.h:
+
+2010-09-10 Stephanie Lewis <slewis@apple.com>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Refactor JavaScriptCore memory statistics so that WebKit doesn't need to know
+ about the JIT and other implementation details of JavaScriptCore. Necessary
+ to fix PPC build.
+
+ https://bugs.webkit.org/show_bug.cgi?id=45528
+
+ * JavaScriptCore.exp:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * runtime/MemoryStatistics.cpp: Added.
+ (JSC::memoryStatistics):
+ * runtime/MemoryStatistics.h: Added.
+
+2010-09-09 Michael Saboff <msaboff@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Added a regular expression tracing facility. This tracing is connected
+ to jsc. Every compiled regular expression object is added to a list.
+ When the process exits, each regular expression dumps its pattern,
+ JIT address, number of times it was executed and the number of matches.
+ This tracing is controlled by the macro ENABLE_REGEXP_TRACING in
+ wtf/Platform.h.
+ https://bugs.webkit.org/show_bug.cgi?id=45401
+
+ * JavaScriptCore.exp:
+ * jsc.cpp:
+ (runWithScripts):
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData):
+ (JSC::JSGlobalData::~JSGlobalData):
+ (JSC::JSGlobalData::addRegExpToTrace):
+ (JSC::JSGlobalData::dumpRegExpTrace):
+ * runtime/JSGlobalData.h:
+ * runtime/RegExp.cpp:
+ (JSC::RegExp::RegExp):
+ (JSC::RegExp::create):
+ (JSC::RegExp::match):
+ * runtime/RegExp.h:
+ * wtf/Platform.h:
+ * yarr/RegexJIT.h:
+ (JSC::Yarr::RegexCodeBlock::getAddr):
+
+2010-09-09 John Therrell <jtherrell@apple.com>
+
+ 32-bit build fix.
+
+ * jit/ExecutableAllocator.cpp:
+ (JSC::ExecutableAllocator::committedByteCount):
+
+2010-09-09 John Therrell <jtherrell@apple.com>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Added statistics sampling and reporting for JavaScriptCore's RegisterFile and ExecutableAllocator classes
+ https://bugs.webkit.org/show_bug.cgi?id=45134
+
+ Added thread-safe committed byte counting and reporting functionality to RegisterFile and
+ ExecutableAllocator.
+
+ * JavaScriptCore.exp:
+ Exported new symbols to allow for WebKit to get statistics from JavaScriptCore classes.
+
+ * interpreter/RegisterFile.cpp:
+ (JSC::registerFileStatisticsMutex):
+ Added function which returns a static Mutex used for locking during read/write access to
+ static committed byte count variable.
+ (JSC::RegisterFile::~RegisterFile):
+ Added call to addToStatistics since memory is decommitted here.
+ (JSC::RegisterFile::releaseExcessCapacity):
+ Added call to addToStatistics since memory is decommitted here.
+ (JSC::RegisterFile::initializeThreading):
+ Added function which calls registerFileStatisticsMutex().
+ (JSC::RegisterFile::committedByteCount):
+ Added function which returns the current committed byte count for RegisterFile.
+ (JSC::RegisterFile::addToCommittedByteCount):
+ Added function which updates committed byte count.
+
+ * interpreter/RegisterFile.h:
+ (JSC::RegisterFile::RegisterFile):
+ Added call to addToStatistics since memory is committed here.
+ (JSC::RegisterFile::grow):
+ Added call to addToStatistics since memory is committed here.
+
+ * jit/ExecutableAllocator.h:
+ Added function prototype for public static function committedByteCount().
+
+ * jit/ExecutableAllocatorFixedVMPool.cpp:
+ (JSC::FixedVMPoolAllocator::release):
+ Added call to addToStatistics since memory is decommitted here.
+ (JSC::FixedVMPoolAllocator::reuse):
+ Added call to addToStatistics since memory is committed here.
+ (JSC::FixedVMPoolAllocator::addToCommittedByteCount):
+ Added function which updates committed byte count.
+ (JSC::ExecutableAllocator::committedByteCount):
+ Added function which returns the current committed byte count for ExecutableAllocator.
+
+ * runtime/InitializeThreading.cpp:
+ (JSC::initializeThreadingOnce):
+ Added call to RegisterFile::initializeThreading.
+
+2010-09-09 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ <http://webkit.org/b/45502> JSObjectSetPrivateProperty does not handle NULL values as it claims
+
+ * API/JSObjectRef.cpp:
+ (JSObjectSetPrivateProperty): Don't call toJS if we have a NULL value as that will cause an assertion
+ failure. Instead map NULL directly to the null JSValue.
+ * API/tests/testapi.c:
+ (main): Add test coverage for the NULL value case.
+
+2010-09-09 Csaba Osztrogonác <ossy@webkit.org>
+
+ Reviewed by Gavin Barraclough.
+
+ [Qt] JSVALUE32_64 not works on Windows platform with MinGW compiler
+ https://bugs.webkit.org/show_bug.cgi?id=29268
+
+ * wtf/Platform.h: Enable JSVALUE32_64 for Qt/Windows/MinGW, because it works now.
+
+2010-09-08 Zoltan Herczeg <zherczeg@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ Removing doneSemicolon label in the lexer
+ https://bugs.webkit.org/show_bug.cgi?id=45289
+
+ As a side effect of moving the multiline comment parsing
+ to a separate function, an opportunity raised to simplify
+ the single line comment parsing, and removing doneSemicolon
+ label. Slight performance increase on --parse-only
+ tests (from 32.8ms to 31.5ms)
+
+ * parser/Lexer.cpp:
+ (JSC::Lexer::lex):
+
+2010-09-08 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Remove accessor for private member variable in JSParser
+ https://bugs.webkit.org/show_bug.cgi?id=45378
+
+ m_token is private to JSParser, so it does not seem to be useful
+ to have an accessor for it. On top of that, the file was both
+ using the accessor and directly accessing the member variable,
+ only one style should be used.
+
+2010-09-08 Csaba Osztrogonác <ossy@webkit.org>
+
+ Reviewed by Oliver Hunt.
+
+ [Qt] REGRESSION(63348): jsc is broken
+ https://bugs.webkit.org/show_bug.cgi?id=42818
+
+ Need fastcall conventions on Qt/Win/MinGW.
+ Based on patches of Gavin Barraclough: r63947 and r63948.
+
+ * jit/JITStubs.cpp:
+ * jit/JITStubs.h:
+
+2010-09-08 Robert Hogan <robert@webkit.org>
+
+ Reviewed by Antonio Gomes.
+
+ Remove some unnecessary duplicate calls to string functions
+
+ https://bugs.webkit.org/show_bug.cgi?id=45314
+
+ * wtf/text/WTFString.cpp:
+ (WTF::String::format):
+
+2010-09-08 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
+
+ Reviewed by Andreas Kling.
+
+ Re-Disable JIT for MSVC 64bit to fix the build on this compiler.
+ https://bugs.webkit.org/show_bug.cgi?id=45382
+
+ It was enabled in the cleanup made in r64176, though it is still
+ not implemented.
+
+ * wtf/Platform.h:
+
+2010-09-08 Martin Robinson <mrobinson@igalia.com>
+
+ Reviewed by Xan Lopez.
+
+ [GTK] Need a WebSocket implementation
+ https://bugs.webkit.org/show_bug.cgi?id=45197
+
+ Add a GIO-based WebSocket implementation.
+
+ * wtf/gobject/GRefPtr.cpp: Added PlatformRefPtr support for GSource.
+ (WTF::refPlatformPtr):
+ (WTF::derefPlatformPtr):
+ * wtf/gobject/GRefPtr.h: Added new template specialization declarations.
+ * wtf/gobject/GTypedefs.h: Add some more GLib/GIO forward declarations.
+
+2010-08-30 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Handle MediaQueryExp memory management exclusively with smart pointers
+ https://bugs.webkit.org/show_bug.cgi?id=44874
+
+ Implemented a non-copying sort function to make it possible to sort a Vector
+ of OwnPtrs (which cannot be copied). This is required for the above.
+
+ * wtf/NonCopyingSort.h: Added.
+ (WTF::nonCopyingSort): It's secretly heapsort.
+ (WTF::heapSort): heapsort implementation.
+ (WTF::siftDown): Helper function for heapsort.
+ (WTF::heapify): ditto
+
+ Adjust build systems.
+
+ * GNUmakefile.am:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2010-09-08 Zoltan Herczeg <zherczeg@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ Refactoring multiline comments in the lexer
+ https://bugs.webkit.org/show_bug.cgi?id=45289
+
+ MultiLine comment parsing is moved to a separate function.
+
+ Slight performance increase on --parse-only tests (from 33.6ms to 32.8ms)
+ SunSpider reports no change (from 523.1ms to 521.2ms).
+
+ * parser/Lexer.cpp:
+ (JSC::Lexer::parseMultilineComment):
+ (JSC::Lexer::lex):
+ * parser/Lexer.h:
+
+2010-09-07 James Robinson <jamesr@chromium.org>
+
+ Compile fix attempt for windows.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-09-07 Mihai Parparita <mihaip@chromium.org>
+
+ Reviewed by James Robinson.
+
+ Fix Windows build after r66936
+ https://bugs.webkit.org/show_bug.cgi?id=45348
+
+ Add symbol names that were missing from r66936.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-09-07 Mihai Parparita <mihaip@chromium.org>
+
+ Reviewed by Oliver Hunt.
+
+ pushState and replaceState do not clone RegExp objects correctly
+ https://bugs.webkit.org/show_bug.cgi?id=44718
+
+ Move internal representation of JSC::RegExp (which depends on wether
+ YARR and YARR_JIT is enabled) into RegExpRepresentation which can live
+ in the implementation only. This makes it feasible to use RegExp in
+ WebCore without bringing in all of YARR.
+
+ * JavaScriptCore.exp: Export RegExp and RegExpObject functions that are
+ needed inside WebCore's JSC bindings.
+ * runtime/RegExp.cpp:
+ (JSC::RegExpRepresentation::~RegExpRepresentation):
+ (JSC::RegExp::RegExp):
+ (JSC::RegExp::~RegExp):
+ (JSC::RegExp::compile):
+ (JSC::RegExp::match):
+ * runtime/RegExp.h:
+
+2010-09-07 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Darin Adler.
+
+ <rdar://problem/8381749> -Wcast-align warning emitted when building with clang
+
+ Remove the -Wcast-align-warning since it isn't really useful, and clang is more aggressive about warning than gcc.
+
+ * Configurations/Base.xcconfig:
+
+2010-09-07 Zoltan Horvath <zoltan@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ REGRESSION(66741): Undefined pthread macros
+ https://bugs.webkit.org/show_bug.cgi?id=45246
+
+ PTHREAD_MUTEX_NORMAL and PTHREAD_MUTEX_DEFAULT (introduced in r60487) are not defined on Linux,
+ but used in a statement. Add an additional check to test this.
+
+ * wtf/FastMalloc.cpp:
+ (WTF::TCMalloc_PageHeap::initializeScavenger):
+
+2010-09-06 Oliver Hunt <oliver@apple.com>
+
+ Windows build fix
+
+2010-09-05 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ SerializedScriptValue needs to use a flat storage mechanism
+ https://bugs.webkit.org/show_bug.cgi?id=45244
+
+ Export JSArray::put
+
+ * JavaScriptCore.exp:
+
+2010-09-06 Chao-ying Fu <fu@mips.com>
+
+ Reviewed by Oliver Hunt.
+
+ Support JSVALUE32_64 on MIPS
+ https://bugs.webkit.org/show_bug.cgi?id=43999
+
+ Add missing functions to support JSVALUE32_64 on MIPS.
+ Remove JSVALUE32 as the default for MIPS.
+
+ * assembler/MIPSAssembler.h:
+ (JSC::MIPSAssembler::divd):
+ (JSC::MIPSAssembler::mthc1):
+ (JSC::MIPSAssembler::cvtwd):
+ * assembler/MacroAssemblerMIPS.h:
+ (JSC::MacroAssemblerMIPS::neg32):
+ (JSC::MacroAssemblerMIPS::branchOr32):
+ (JSC::MacroAssemblerMIPS::set8):
+ (JSC::MacroAssemblerMIPS::loadDouble):
+ (JSC::MacroAssemblerMIPS::divDouble):
+ (JSC::MacroAssemblerMIPS::convertInt32ToDouble):
+ (JSC::MacroAssemblerMIPS::branchDouble):
+ (JSC::MacroAssemblerMIPS::branchConvertDoubleToInt32):
+ (JSC::MacroAssemblerMIPS::zeroDouble):
+ * jit/JIT.h:
+ * jit/JITOpcodes32_64.cpp:
+ (JSC::JIT::privateCompileCTINativeCall):
+ * jit/JITPropertyAccess32_64.cpp:
+ (JSC::JIT::privateCompilePutByIdTransition):
+ * jit/JITStubs.cpp:
+ (JSC::JITThunks::JITThunks):
+ * jit/JITStubs.h:
+ * wtf/Platform.h:
+
+2010-09-06 Robert Hogan <robert@webkit.org>
+
+ Unreviewed, compile fix.
+
+ Fix compile failure in r66843
+
+ Revert to original patch in bugzilla. Leave bug open for
+ discussion on potential removal of double utf8 conversion.
+
+ https://bugs.webkit.org/show_bug.cgi?id=45240
+
+ * wtf/text/WTFString.cpp:
+ (WTF::String::format):
+
+2010-09-06 Robert Hogan <robert@webkit.org>
+
+ Reviewed by Andreas Kling.
+
+ [Qt] utf8 encoding of console() messages
+
+ Unskip:
+ http/tests/security/xssAuditor/embed-tag-null-char.html
+ http/tests/security/xssAuditor/object-embed-tag-null-char.html
+
+ Both tests failed because Qt's implementation of String::format()
+ is casting a utf8 result to String, which assumes latin1 in
+ its constructor. So instead of casting a QString to a String, use
+ StringImpl::create() instead. Unfortunately, this involves a lot
+ of extra casts but the end result is correct.
+
+ https://bugs.webkit.org/show_bug.cgi?id=45240
+
+ * wtf/text/WTFString.cpp:
+ (WTF::String::format):
+
+2010-09-03 Alexey Proskuryakov <ap@apple.com>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=45135
+ <rdar://problem/7823714> TCMalloc_PageHeap doesn't hold a mutex while manipulating shared data
+
+ * wtf/FastMalloc.cpp:
+ (WTF::TCMalloc_PageHeap::initializeScavenger): Make sure to create a non-recursive mutex
+ regardless of platform default, so that we can assert that it's held (this is for platforms
+ that don't have libdispatch).
+ (WTF::TCMalloc_PageHeap::signalScavenger): Assert that the mutex is held, so we can look
+ at m_scavengeThreadActive. For platforms that have libdispatch, assert that pageheap_lock
+ is held.
+ (WTF::TCMalloc_PageHeap::periodicScavenge): Make sure that pageheap_lock is held before
+ manipulating m_scavengeThreadActive. Otherwise, there is an obvious race condition, and we
+ can make unbalanced calls to dispatch_resume().
+
+2010-09-03 Lucas De Marchi <lucas.demarchi@profusion.mobi>
+
+ Reviewed by Martin Robinson.
+
+ [EFL] Regression (66531) Build break with Glib Support
+ https://bugs.webkit.org/show_bug.cgi?id=45011
+
+ Move GtkTypedefs.h to GTypedefs.h and let it inside gobject directory
+ since when glib is enabled, EFL port needs it, too.
+
+ * CMakeListsEfl.txt: Include gobject directory to find new header
+ file.
+ * GNUmakefile.am: Ditto.
+ * wtf/CMakeListsEfl.txt: Ditto.
+ * wtf/Platform.h: Include header if port is EFL and glib support is
+ enabled.
+ * wtf/gtk/GtkTypedefs.h: Removed.
+ * wtf/gobject/GTypedefs.h: Added. Sections specific to GTK are now
+ guarded by PLATFORM(GTK).
+
+2010-09-03 Csaba Osztrogonác <ossy@webkit.org>
+
+ Reviewed by Simon Hausmann.
+
+ Fix warning in wtf/ByteArray.h
+ https://bugs.webkit.org/show_bug.cgi?id=44672
+
+ * wtf/ByteArray.h: Use maximal sized array for MSVC and unsized array for other compilers.
+
+2010-09-02 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ Actually parse a URL from ParsedURL
+ https://bugs.webkit.org/show_bug.cgi?id=45080
+
+ This patch only handles standard URLs. At some point we'll need to
+ distinguish between standard URLs and other kinds of URLs.
+
+ * wtf/url/api/ParsedURL.cpp:
+ (WTF::ParsedURL::ParsedURL):
+
+2010-09-02 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ Add ParsedURL and URLString to WTFURL API
+ https://bugs.webkit.org/show_bug.cgi?id=45078
+
+ Currently there's no actual URL parsing going on, but this patch is a
+ start to sketching out the API.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * wtf/url/api/ParsedURL.cpp: Added.
+ (WTF::ParsedURL::ParsedURL):
+ (WTF::ParsedURL::scheme):
+ (WTF::ParsedURL::username):
+ (WTF::ParsedURL::password):
+ (WTF::ParsedURL::host):
+ (WTF::ParsedURL::port):
+ (WTF::ParsedURL::path):
+ (WTF::ParsedURL::query):
+ (WTF::ParsedURL::fragment):
+ (WTF::ParsedURL::segment):
+ * wtf/url/api/ParsedURL.h: Added.
+ (WTF::ParsedURL::spec):
+ * wtf/url/api/URLString.h: Added.
+ (WTF::URLString::URLString):
+ (WTF::URLString::string):
+
+2010-09-02 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ Add WTFURL to the JavaScriptCore build on Mac
+ https://bugs.webkit.org/show_bug.cgi?id=45075
+
+ Building code is good.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2010-09-02 Alexey Proskuryakov <ap@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ https://bugs.webkit.org/show_bug.cgi?id=43230
+ <rdar://problem/8254215> REGRESSION: Memory leak within JSParser::JSParser
+
+ One can't delete a ThreadSpecific object that has data in it. It's not even possible to
+ enumerate data objects in all threads, much less destroy them from a thread that's destroying
+ the ThreadSpecific.
+
+ * parser/JSParser.cpp:
+ (JSC::JSParser::JSParser):
+ * runtime/JSGlobalData.h:
+ * wtf/WTFThreadData.cpp:
+ (WTF::WTFThreadData::WTFThreadData):
+ * wtf/WTFThreadData.h:
+ (WTF::WTFThreadData::approximatedStackStart):
+ Moved stack guard tracking from JSGlobalData to WTFThreadData.
+
+ * wtf/ThreadSpecific.h: Made destructor unimplemented. It's dangerous, and we probably won't
+ ever face a situation where we'd want to delete a ThreadSpecific object.
+
+2010-09-01 Gavin Barraclough <barraclough@apple.com>
+
+ Rubber stamped by Oliver Hunt.
+
+ Ecma-262 15.11.1.1 states that if the argument is undefined then an
+ Error object's message property should be set to the empty string.
+
+ * runtime/ErrorInstance.cpp:
+ (JSC::ErrorInstance::ErrorInstance):
+ (JSC::ErrorInstance::create):
+ * runtime/ErrorInstance.h:
+ * runtime/ErrorPrototype.cpp:
+ (JSC::ErrorPrototype::ErrorPrototype):
+
+2010-08-31 Darin Adler <darin@apple.com>
+
+ Reviewed by Anders Carlsson.
+
+ * wtf/FastMalloc.cpp:
+ (WTF::TCMalloc_PageHeap::scavenge): Replaced somewhat-quirky code that
+ mixed types with code that uses size_t.
+
+ * wtf/TCPageMap.h: Removed names of unused arguments to avoid warning.
+
+2010-08-31 Martin Robinson <mrobinson@igalia.com>
+
+ Reviewed by Gustavo Noronha Silva.
+
+ [GTK] Isolate all GTK+ typedefs into one file
+ https://bugs.webkit.org/show_bug.cgi?id=44900
+
+ * GNUmakefile.am: Add GtkTypedefs.h to the source lists.
+ * wtf/Platform.h: #include GtkTypedefs.h for the GTK+ build.
+ * wtf/ThreadingPrimitives.h: Remove GTK+ typedefs.
+ * wtf/gobject/GOwnPtr.h: Ditto.
+ * wtf/gobject/GRefPtr.h: Ditto.
+ * wtf/gtk/GtkTypedefs.h: Added.
+
+2010-08-31 Martin Robinson <mrobinson@igalia.com>
+
+ Reviewed by Gustavo Noronha Silva.
+
+ [GTK] Fix 'make dist' in preparation of the 1.3.3 release
+ https://bugs.webkit.org/show_bug.cgi?id=44978
+
+ * GNUmakefile.am: Adding missing headers to the sources list.
+
+2010-08-31 Chao-ying Fu <fu@mips.com>
+
+ Reviewed by Oliver Hunt.
+
+ Support emit_op_mod() for MIPS
+ https://bugs.webkit.org/show_bug.cgi?id=42855
+
+ This patch uses MIPS div instructions for op_mod to improve performance.
+
+ * assembler/MIPSAssembler.h:
+ (JSC::MIPSAssembler::div):
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emit_op_mod):
+ (JSC::JIT::emitSlow_op_mod):
+
+2010-08-31 Csaba Osztrogonác <ossy@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ Modify ASSERT_UNUSED and UNUSED_PARAM similar to Qt's Q_UNUSED.
+ https://bugs.webkit.org/show_bug.cgi?id=44870
+
+ * wtf/Assertions.h:
+ * wtf/UnusedParam.h:
+
+2010-08-31 Benjamin Poulain <benjamin.poulain@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ JSC TimeoutChecker::didTimeOut overflows on ARM
+ https://bugs.webkit.org/show_bug.cgi?id=38538
+
+ Make getCPUTime() return values relative to the first call.
+ The previous implementation relied on simply on currentTime(), which
+ return a time since epoch and not a time since the thread started. This
+ made the return value of getCPUTime() overflow on 32 bits.
+
+ * runtime/TimeoutChecker.cpp:
+ (JSC::getCPUTime):
+
+2010-08-30 Mihai Parparita <mihaip@chromium.org>
+
+ Reviewed by Adam Barth.
+
+ HISTORY_ALWAYS_ASYNC should be removed (history should always be async)
+ https://bugs.webkit.org/show_bug.cgi?id=44315
+
+ Remove ENABLE_HISTORY_ALWAYS_ASYNC #define.
+
+ * wtf/Platform.h:
+
+2010-08-30 Chris Rogers <crogers@google.com>
+
+ Reviewed by Kenneth Russell.
+
+ Fix namespace for wtf/Complex.h and wtf/Vector3.h
+ https://bugs.webkit.org/show_bug.cgi?id=44892
+
+ * wtf/Complex.h:
+ * wtf/Vector3.h:
+
+2010-08-30 Andy Estes <aestes@apple.com>
+
+ Reviewed by Eric Carlson.
+
+ Strings returned by asciiDebug() should be NULL-terminated.
+ https://bugs.webkit.org/show_bug.cgi?id=44866
+
+ * wtf/text/WTFString.cpp:
+ (asciiDebug):
+
+2010-08-30 Zoltan Herczeg <zherczeg@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ Refactor number parsing in the lexer
+ https://bugs.webkit.org/show_bug.cgi?id=44104
+
+ Number parsing was full of gotos, and needed a complete
+ redesign to remove them (Only one remained). Furthermore
+ integer arithmetic is empolyed for fast cases (= small
+ integer numbers).
+
+ * parser/Lexer.cpp:
+ (JSC::Lexer::parseHex):
+ (JSC::Lexer::parseOctal):
+ (JSC::Lexer::parseDecimal):
+ (JSC::Lexer::parseNumberAfterDecimalPoint):
+ (JSC::Lexer::parseNumberAfterExponentIndicator):
+ (JSC::Lexer::lex):
+ * parser/Lexer.h:
+
+2010-08-29 Darin Adler <darin@apple.com>
+
+ Fix Qt build.
+
+ * wtf/unicode/glib/UnicodeMacrosFromICU.h: Added U_IS_BMP.
+ * wtf/unicode/qt4/UnicodeQt4.h: Ditto.
+ * wtf/unicode/wince/UnicodeWince.h: Ditto.
+
+2010-08-29 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Kent Tamura.
+
+ [BREWMP] Port vprintf_stderr_common
+ https://bugs.webkit.org/show_bug.cgi?id=33568
+
+ Use BREW's DBGPRINTF to output debug messages.
+
+ * wtf/Assertions.cpp:
+
+2010-08-28 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 44830 - In Array's prototype functyions we're incorrectly handing large index values
+
+ We are in places casting doubles to unsigneds, and unsigneds to ints, without always check
+ that the result is within bounds. This is problematic in the case of double-to-unsigned
+ conversion because we should be saturating to array length.
+
+ Also, the error return value from Array.splice should be [], not undefined.
+
+ I don't see any security concerns here. These methods are spec'ed in such a way that they
+ can be applied to non Array objects, so in all cases the (potentially bogus) indices are
+ being passed to functions that will safely check accesses are within bounds.
+
+ * runtime/ArrayPrototype.cpp:
+ (JSC::argumentClampedIndexFromStartOrEnd):
+ (JSC::arrayProtoFuncJoin):
+ (JSC::arrayProtoFuncConcat):
+ (JSC::arrayProtoFuncReverse):
+ (JSC::arrayProtoFuncShift):
+ (JSC::arrayProtoFuncSlice):
+ (JSC::arrayProtoFuncSort):
+ (JSC::arrayProtoFuncSplice):
+ (JSC::arrayProtoFuncUnShift):
+ (JSC::arrayProtoFuncFilter):
+ (JSC::arrayProtoFuncMap):
+ (JSC::arrayProtoFuncEvery):
+ (JSC::arrayProtoFuncForEach):
+ (JSC::arrayProtoFuncSome):
+ (JSC::arrayProtoFuncReduce):
+ (JSC::arrayProtoFuncReduceRight):
+ (JSC::arrayProtoFuncIndexOf):
+ (JSC::arrayProtoFuncLastIndexOf):
+ * runtime/JSValue.h:
+ (JSC::JSValue::toUInt32):
+
+2010-08-28 Pratik Solanki <psolanki@apple.com>
+
+ Reviewed by Dan Bernstein.
+
+ Add an ENABLE define for purgeable memory support
+ https://bugs.webkit.org/show_bug.cgi?id=44777
+
+ * wtf/Platform.h:
+
+2010-08-27 Kimmo Kinnunen <kimmo.t.kinnunen@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] NPAPI Plugin metadata should be cached, and loading a plugin should not require loading every plugin
+ https://bugs.webkit.org/show_bug.cgi?id=43179
+
+ Add ENABLE_NETSCAPE_PLUGIN_METADATA_CACHE flag to enable persistent
+ NPAPI Plugin Cache. The flag is enabled by default.
+
+ * wtf/Platform.h: Add ENABLE_NETSCAPE_PLUGIN_METADATA_CACHE
+
+2010-07-27 Jer Noble <jer.noble@apple.com>
+
+ Reviewed by Eric Carlson.
+
+ Add JavaScript API to allow a page to go fullscreen.
+ rdar://problem/6867795
+ https://bugs.webkit.org/show_bug.cgi?id=43099
+
+ * wtf/Platform.h: Enable FULLSCREEN_API mode for the Mac (except iOS).
+
+2010-08-27 Gavin Barraclough <barraclough@apple.com>
+
+ Windows build fix pt 2.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-08-27 Gavin Barraclough <barraclough@apple.com>
+
+ Windows build fix pt 1.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-08-27 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 44745 - Number.toFixed/toExponential/toPrecision are inaccurate.
+
+ These methods should be using a version of dtoa that can generate results accurate
+ to the requested precision, whereas our version of dtoa is only currently able to
+ support producing results sufficiently accurate to distinguish the value from any
+ other IEEE-754 double precision number.
+
+ This change has no impact on benchmarks we track.
+
+ On microbenchmarks for these functions, this is a slight regression where a high
+ precision is requested (dtoa now need to iterate further to generate a a greater
+ number of digits), but with smaller precision values (hopefully more common) this
+ improves performance, since it reduced the accurate of result dtoa is required,
+ to produce, and removes the need to pre-round values before calling dtoa.
+
+ * JavaScriptCore.exp:
+ doubleToStringInJavaScriptFormat renamed to numberToString
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ doubleToStringInJavaScriptFormat renamed to numberToString
+
+ * runtime/UString.cpp:
+ (JSC::UString::number):
+ doubleToStringInJavaScriptFormat renamed to numberToString
+
+ * wtf/DecimalNumber.h:
+ (WTF::DecimalNumber::DecimalNumber):
+ (WTF::DecimalNumber::toStringDecimal):
+ (WTF::DecimalNumber::toStringExponential):
+ Remove all pre-rounding of values, instead call dtoa correctly.
+
+ * wtf/dtoa.cpp:
+ (WTF::dtoa):
+ * wtf/dtoa.h:
+ Reenable support for rounding to specific-figures/decimal-places in dtoa.
+ Modify to remove unbiased rounding, provide ECMA required away-from-zero.
+ Rewrite doubleToStringInJavaScriptFormat to use DecimalNumber, rename to
+ numberToString.
+
+2010-08-27 Chao-ying Fu <fu@mips.com>
+
+ Reviewed by Oliver Hunt.
+
+ Byte alignment issue on MIPS
+ https://bugs.webkit.org/show_bug.cgi?id=29415
+
+ MIPS accesses one byte at a time for now to avoid the help from the
+ kernel to fix unaligned accesses.
+
+ * wtf/text/AtomicString.cpp:
+ (WebCore::equal):
+ * wtf/text/StringHash.h:
+ (WebCore::StringHash::equal):
+
+2010-08-27 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Tor Arne Vestbø.
+
+ Fix a couple of typos in comment.
+
+ * bytecode/CodeBlock.h:
+
+2010-08-26 Gavin Barraclough <barraclough@apple.com>
+
+ Windows build fix.
+
+ * wtf/dtoa.cpp:
+
+2010-08-26 Gavin Barraclough <baraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Bug 44735 - Clean up dtoa.cpp
+ Remove unused & unmaintained code paths, reformat code to match
+ coding standard & use platform #defines from Platform.h directly.
+
+ * wtf/dtoa.cpp:
+ (WTF::storeInc):
+ (WTF::multadd):
+ (WTF::s2b):
+ (WTF::lo0bits):
+ (WTF::mult):
+ (WTF::pow5mult):
+ (WTF::lshift):
+ (WTF::diff):
+ (WTF::ulp):
+ (WTF::b2d):
+ (WTF::d2b):
+ (WTF::ratio):
+ (WTF::):
+ (WTF::strtod):
+ (WTF::quorem):
+ (WTF::dtoa):
+
+2010-08-26 Gavin Barraclough <barraclough@apple.com>
+
+ Rubber Stamped by Oliver Hunt.
+
+ Partially revert r65959. The toString changes regressed the v8 tests,
+ but keep the toFixed/toExponential/toPrecision changes.
+
+ * JavaScriptCore.exp:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * runtime/NumberPrototype.cpp:
+ * runtime/UString.cpp:
+ (JSC::UString::number):
+ * wtf/DecimalNumber.h:
+ * wtf/dtoa.cpp:
+ (WTF::append):
+ (WTF::doubleToStringInJavaScriptFormat):
+ * wtf/dtoa.h:
+ * wtf/text/WTFString.cpp:
+ * wtf/text/WTFString.h:
+
+2010-08-26 James Robinson <jamesr@chromium.org>
+
+ Reviewed by Darin Fisher.
+
+ [chromium] Remove the USE(GLES2_RENDERING) define and associated code
+ https://bugs.webkit.org/show_bug.cgi?id=43761
+
+ Remove WTF_USE_GLES2_RENDERING from the list of defines in chromium, it's unused.
+
+ * wtf/Platform.h:
+
+2010-08-26 Gavin Barraclough <barraclough@apple.com>
+
+ Rolling out r64608, this regressed performance.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * assembler/ARMAssembler.cpp:
+ (JSC::ARMAssembler::executableCopy):
+ * assembler/LinkBuffer.h:
+ (JSC::LinkBuffer::LinkBuffer):
+ (JSC::LinkBuffer::~LinkBuffer):
+ (JSC::LinkBuffer::performFinalization):
+ * assembler/MIPSAssembler.h:
+ (JSC::MIPSAssembler::executableCopy):
+ * assembler/X86Assembler.h:
+ (JSC::X86Assembler::executableCopy):
+ * bytecode/StructureStubInfo.h:
+ (JSC::StructureStubInfo::initGetByIdProto):
+ (JSC::StructureStubInfo::initGetByIdChain):
+ (JSC::StructureStubInfo::initGetByIdSelfList):
+ (JSC::StructureStubInfo::initGetByIdProtoList):
+ (JSC::StructureStubInfo::initPutByIdTransition):
+ * jit/ExecutableAllocator.cpp:
+ (JSC::ExecutablePool::systemAlloc):
+ * jit/ExecutableAllocator.h:
+ (JSC::ExecutablePool::create):
+ (JSC::ExecutableAllocator::ExecutableAllocator):
+ (JSC::ExecutableAllocator::poolForSize):
+ (JSC::ExecutablePool::ExecutablePool):
+ (JSC::ExecutablePool::poolAllocate):
+ * jit/ExecutableAllocatorFixedVMPool.cpp:
+ (JSC::FixedVMPoolAllocator::allocInternal):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompile):
+ * jit/JIT.h:
+ (JSC::JIT::compileGetByIdProto):
+ (JSC::JIT::compileGetByIdSelfList):
+ (JSC::JIT::compileGetByIdProtoList):
+ (JSC::JIT::compileGetByIdChainList):
+ (JSC::JIT::compileGetByIdChain):
+ (JSC::JIT::compilePutByIdTransition):
+ (JSC::JIT::compilePatchGetArrayLength):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ * jit/JITOpcodes32_64.cpp:
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ (JSC::JIT::privateCompileCTINativeCall):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::stringGetByValStubGenerator):
+ (JSC::JIT::privateCompilePutByIdTransition):
+ (JSC::JIT::privateCompilePatchGetArrayLength):
+ (JSC::JIT::privateCompileGetByIdProto):
+ (JSC::JIT::privateCompileGetByIdSelfList):
+ (JSC::JIT::privateCompileGetByIdProtoList):
+ (JSC::JIT::privateCompileGetByIdChainList):
+ (JSC::JIT::privateCompileGetByIdChain):
+ * jit/JITPropertyAccess32_64.cpp:
+ (JSC::JIT::stringGetByValStubGenerator):
+ (JSC::JIT::privateCompilePutByIdTransition):
+ (JSC::JIT::privateCompilePatchGetArrayLength):
+ (JSC::JIT::privateCompileGetByIdProto):
+ (JSC::JIT::privateCompileGetByIdSelfList):
+ (JSC::JIT::privateCompileGetByIdProtoList):
+ (JSC::JIT::privateCompileGetByIdChainList):
+ (JSC::JIT::privateCompileGetByIdChain):
+ * jit/JITStubs.cpp:
+ (JSC::JITThunks::tryCachePutByID):
+ (JSC::JITThunks::tryCacheGetByID):
+ (JSC::DEFINE_STUB_FUNCTION):
+ (JSC::getPolymorphicAccessStructureListSlot):
+ * jit/JITStubs.h:
+ * jit/SpecializedThunkJIT.h:
+ (JSC::SpecializedThunkJIT::finalize):
+ * runtime/ExceptionHelpers.cpp:
+ * runtime/ExceptionHelpers.h:
+ * runtime/Executable.cpp:
+ (JSC::EvalExecutable::compileInternal):
+ (JSC::ProgramExecutable::compileInternal):
+ (JSC::FunctionExecutable::compileForCallInternal):
+ (JSC::FunctionExecutable::compileForConstructInternal):
+ (JSC::FunctionExecutable::reparseExceptionInfo):
+ (JSC::EvalExecutable::reparseExceptionInfo):
+ * yarr/RegexJIT.cpp:
+ (JSC::Yarr::RegexGenerator::compile):
+
+2010-08-26 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Brady Eidson.
+
+ Bug 44655 - Add debug only convenience methods to obtain a Vector<char> from a String/StringImpl.
+
+ * wtf/text/WTFString.cpp:
+ (asciiDebug):
+ Return a Vector<char> containing the contents of a string as ASCII.
+
+2010-08-26 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ Add PassOwnArrayPtr
+ https://bugs.webkit.org/show_bug.cgi?id=44627
+
+ * GNUmakefile.am:
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ Add the new files.
+
+ * wtf/Forward.h:
+ Forward declare PassOwnArrayPtr.
+
+ * wtf/OwnArrayPtr.h:
+ Mimic the OwnPtr interface.
+
+ * wtf/OwnArrayPtrCommon.h: Added.
+ (WTF::deleteOwnedArrayPtr):
+ Move delete function here so it can be shared by OwnArrayPtr and
+ PassOwnArrayPtr.
+
+ * wtf/PassOwnArrayPtr.h: Added.
+ Mimic the PassOwnPtr interface.
+
+2010-08-26 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ [JSC] JavaScript parsing error when loading Equifax web page
+ https://bugs.webkit.org/show_bug.cgi?id=42900
+
+ '-->' is ostensibly only meant to occur when there is only
+ whitespace preceeding it on the line. However firefox treats
+ multiline comments as a space character, so they are allowed.
+ One side effect of the firefox model is that any line terminators
+ inside the multiline comment are ignored, so
+
+ foo/*
+ */-->
+
+ is treated as
+
+ foo -->
+
+ and so '-->' will not be a comment in this case. Happily this simply
+ means that to fix this issue all we need to do is stop updating
+ m_atLineStart when handling multiline comments.
+
+ * parser/Lexer.cpp:
+ (JSC::Lexer::lex):
+
+2010-08-25 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Improve overflow handling in StringImpl::Replace
+ https://bugs.webkit.org/show_bug.cgi?id=42502
+ <rdar://problem/8203794>
+
+ Harden StringImpl::replace against overflow -- I can't see how this
+ could be abused, but it's better to be safe than sorry.
+
+ * wtf/text/StringImpl.cpp:
+ (WTF::StringImpl::replace):
+
+2010-08-26 Martin Robinson <mrobinson@igalia.com>
+
+ Reviewed by Xan Lopez.
+
+ [GTK] The GNUmakefile.am files contain a myriad of confusing preprocessor and compiler flag definitions
+ https://bugs.webkit.org/show_bug.cgi?id=44624
+
+ Clean up GNUmakefile.am.
+
+ * GNUmakefile.am: Alphabetize the include order in javascriptcore_cppflags. Move
+ a couple include lines from the top-level GNUmakefile.am.
+
+2010-08-25 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Kent Tamura.
+
+ Local variables 'k' and 'y' in s2b() in dtoa.cpp are computed but not used
+ https://bugs.webkit.org/show_bug.cgi?id=29259
+
+ Remove unused code in dtoa.cpp, spotted by Wan-Teh Chang.
+
+ * wtf/dtoa.cpp:
+ (WTF::s2b):
+
+2010-08-25 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Kevin Ollivier.
+
+ [BREWMP] Add build system
+ https://bugs.webkit.org/show_bug.cgi?id=44645
+
+ Make waf script portable so that we can add more ports.
+
+ * wscript:
+
+2010-08-25 Michael Saboff <msaboff@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Remove the single entry regular expression cache introduced as part of
+ the fix for https://bugs.webkit.org/show_bug.cgi?id=41238.
+ The performance problem in Dromaeo that initiated that bug is no
+ longer present. Dromaeo has been modified so that the regular
+ expression tests are somewhat random and don't benefit from a
+ single entry cache.
+
+ * runtime/RegExp.cpp:
+ (JSC::RegExp::RegExp):
+ (JSC::RegExp::match):
+ * runtime/RegExp.h:
+
+2010-08-25 Martin Robinson <mrobinson@igalia.com>
+
+ Reviewed by Gustavo Noronha Silva.
+
+ Cairo and EFL port shouldn't depend on glib.
+ https://bugs.webkit.org/show_bug.cgi?id=44354
+
+ Replace GRefPtr with PlatformRefPtr. Keep GLib specific bits in
+ GRefPtr.h.
+
+ * GNUmakefile.am: Add PlatformRefPtr.h to the source list.
+ * wtf/PlatformRefPtr.h: Migrated from GRefPtr.h.
+ (WTF::PlatformRefPtr::PlatformRefPtr): Ditto.
+ (WTF::PlatformRefPtr::~PlatformRefPtr): Ditto.
+ (WTF::PlatformRefPtr::clear): Ditto.
+ (WTF::PlatformRefPtr::get): Ditto.
+ (WTF::PlatformRefPtr::operator*): Ditto.
+ (WTF::PlatformRefPtr::operator->): Ditto.
+ (WTF::PlatformRefPtr::operator!): Ditto.
+ (WTF::PlatformRefPtr::operator UnspecifiedBoolType): Ditto.
+ (WTF::PlatformRefPtr::hashTableDeletedValue): Ditto.
+ (WTF::::operator): Ditto.
+ (WTF::::swap): Ditto.
+ (WTF::swap): Ditto.
+ (WTF::operator==): Ditto.
+ (WTF::operator!=): Ditto.
+ (WTF::static_pointer_cast): Ditto.
+ (WTF::const_pointer_cast): Ditto.
+ (WTF::getPtr): Ditto.
+ (WTF::adoptPlatformRef): Ditto.
+ * wtf/gobject/GRefPtr.cpp: Changes to reflect new names.
+ (WTF::refPlatformPtr):
+ (WTF::derefPlatformPtr):
+ * wtf/gobject/GRefPtr.h: Ditto.
+ (WTF::refPlatformPtr):
+ (WTF::derefPlatformPtr):
+
+2010-08-25 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Remove dead code in JSGlobalObject
+ https://bugs.webkit.org/show_bug.cgi?id=44615
+
+ The recursion data member in the JSGlobalObject and its getter
+ plus inc/dec methods seems to be unused, remove them.
+
+ * runtime/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::init):
+ * runtime/JSGlobalObject.h:
+
+2010-08-25 Michael Saboff <msaboff@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Changed the initial and subsequent allocation of vector storage to
+ Array()s. The changes are to limit sparse arrays to 100000 entries
+ and fixed the sparse map to vector storage conversion to use the
+ minimum amount of memory needed to store the current number of entries.
+ These changes address https://bugs.webkit.org/show_bug.cgi?id=43707
+
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::putSlowCase):
+ (JSC::JSArray::getNewVectorLength):
+
+2010-08-16 Gabor Loki <loki@webkit.org>
+
+ Reviewed by Gavin Barraclough.
+
+ Avoid increasing required alignment of target type warning
+ https://bugs.webkit.org/show_bug.cgi?id=43963
+
+ Fix platform independent alignment warnings.
+
+ * wtf/ListHashSet.h:
+ (WTF::ListHashSetNodeAllocator::pool):
+
+2010-08-19 Gabor Loki <loki@webkit.org>
+
+ Reviewed by Gavin Barraclough.
+
+ Enable truncated floating point feature on ARM
+ https://bugs.webkit.org/show_bug.cgi?id=44233
+
+ Enable truncated floating point feature with the help of VCVTR.S32.F64
+ instruction. If VCVTR.S32.F64 can't fit the result into a 32-bit
+ integer/register, it saturates at INT_MAX or INT_MIN. Testing this
+ looks quicker than testing FPSCR for exception.
+
+ Inspired by Jacob Bramley's patch from JaegerMonkey
+
+ * assembler/ARMAssembler.h:
+ (JSC::ARMAssembler::):
+ (JSC::ARMAssembler::cmn_r):
+ (JSC::ARMAssembler::vcvtr_s32_f64_r):
+ * assembler/MacroAssemblerARM.h:
+ (JSC::MacroAssemblerARM::supportsFloatingPointTruncate):
+ (JSC::MacroAssemblerARM::branchTruncateDoubleToInt32):
+
+2010-08-24 Gavin Barraclough <barraclough@apple.com>
+
+ Windows build fix.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-08-24 Gavin Barraclough <barraclough@apple.com>
+
+ Windows build fix.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * wtf/DecimalNumber.h:
+ (WTF::DecimalNumber::intPow10):
+ * wtf/dtoa.cpp:
+ * wtf/dtoa.h:
+
+2010-08-23 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ https://bugs.webkit.org/show_bug.cgi?id=44487
+
+ Number.toExponential/toFixed/toPrecision all contain a spaghetti of duplicated
+ code & unnecessary complexity. Add a new DecimalNumber class to encapsulate
+ double to string conversion, share the implementations of rounding &
+ decimal-fraction/exponential formatting.
+
+ * JavaScriptCore.exp:
+ Update exports.
+
+ * runtime/NumberPrototype.cpp:
+ (JSC::toThisNumber):
+ (JSC::getIntegerArgumentInRange):
+ Helper methods used in implementing toExponential/toFixed/toString.
+ (JSC::numberProtoFuncToExponential):
+ (JSC::numberProtoFuncToFixed):
+ (JSC::numberProtoFuncToPrecision):
+ Reimplemented using new DecimalNumber class.
+
+ * runtime/UString.cpp:
+ (JSC::UString::number):
+ Updated to call numberToString.
+
+ * wtf/DecimalNumber.h: Added.
+ (WTF::):
+ (WTF::DecimalNumber::DecimalNumber):
+ (WTF::DecimalNumber::toStringDecimal):
+ (WTF::DecimalNumber::toStringExponential):
+ (WTF::DecimalNumber::sign):
+ (WTF::DecimalNumber::exponent):
+ (WTF::DecimalNumber::significand):
+ (WTF::DecimalNumber::precision):
+ (WTF::DecimalNumber::init):
+ (WTF::DecimalNumber::isZero):
+ (WTF::DecimalNumber::roundToPrecision):
+ New class to perform double to string conversion.
+ Has three constructors, which allow conversion with no rounding,
+ rounding to significant-figures, or rounding to decimal-places,
+ and two methods for formatting strings, either using decimal
+ fraction or exponential encoding. Internal implementation uses
+ pre-rounding of the values before calling dtoa rather than
+ relying on dtoa to correctly round, which does not produce
+ fully accurate results. Hopefully we can address this in the
+ near future.
+
+ * wtf/dtoa.cpp:
+ (WTF::intPow10):
+ * wtf/dtoa.h:
+ intPow10 is used internally by DecimalNumber.
+
+ * wtf/text/WTFString.cpp:
+ (WTF::copyToString):
+ (WTF::nanOrInfToString):
+ Used internally in numberToString for NaN/Infinity handling.
+ (WTF::numberToString):
+ Added new method to convert doubles to strings.
+
+ * wtf/text/WTFString.h:
+ Added declaration for numberToString. This is here because
+ we should switch over to using this for all double to string
+ conversion in WebCore (see section 2.4.4.3 of the HTML5 spec).
+
+2010-08-24 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Don't seed the JS random number generator from time()
+ https://bugs.webkit.org/show_bug.cgi?id=41868
+ <rdar://problem/8171025>
+
+ Switch to using the secure random number generator to
+ seed the fast random generator, and make the generator
+ be per global object.
+
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData):
+ * runtime/JSGlobalData.h:
+ * runtime/JSGlobalObject.h:
+ (JSC::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData):
+ (JSC::JSGlobalObject::weakRandomNumber):
+ * runtime/MathObject.cpp:
+ (JSC::mathProtoFuncRandom):
+
+2010-08-24 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Beth Dakin.
+
+ Make overflow guards in UString::utf8 explicit
+ https://bugs.webkit.org/show_bug.cgi?id=44540
+
+ Add an explicit overflow check prior to allocating our buffer,
+ rather than implicitly relying on the guard in convertUTF16ToUTF8.
+
+ * runtime/UString.cpp:
+ (JSC::UString::utf8):
+
+2010-08-24 Yael Aharon <yael.aharon@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Symbian] Fix commit/decommit of system memory using RChunk
+
+ Swap accidentially reversed start and m_base values for determining the
+ offset within the RChunk.
+
+ * wtf/PageReservation.h:
+ (WTF::PageReservation::systemCommit):
+ (WTF::PageReservation::systemDecommit):
+
+2010-08-23 Patrick Gansterer <paroga@paroga.com>
+
+ Rubber-stamped by Gabor Loki.
+
+ [WINCE] Buildfix for GeneratedJITStubs after r64818
+ https://bugs.webkit.org/show_bug.cgi?id=44469
+
+ Use " THUNK_RETURN_ADDRESS_OFFSET" instead of "#offset#".
+
+ * jit/JITStubs.cpp:
+
+2010-08-23 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Darin Adler.
+
+ [REGRESSION] Interpreter incorrectly excludes prototype chain when validating put_by_id_transition
+ https://bugs.webkit.org/show_bug.cgi?id=44240
+ <rdar://problem/8328995>
+
+ Fix an error I introduced when cleaning up the interpreter side of the logic
+ to prevent setters being called in object initialisers.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+
+2010-08-23 Michael Saboff <msaboff@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Fixed case where a single character search string in a string.replace()
+ did not properly handle back reference replacement. The fix is to
+ check for a '$' as part of the check to see if we can execute the
+ single character replace optimization.
+ https://bugs.webkit.org/show_bug.cgi?id=44067
+
+ * runtime/StringPrototype.cpp:
+ (JSC::stringProtoFuncReplace):
+
+2010-08-23 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ JSON.stringify is much slower than Firefox on particular pathological input
+ https://bugs.webkit.org/show_bug.cgi?id=44456
+
+ Make StringBuilder::reserveCapacity reserve additional space so we don't end up
+ repeatedly copying the entire result string.
+
+ * runtime/StringBuilder.h:
+ (JSC::StringBuilder::append):
+ (JSC::StringBuilder::reserveCapacity):
+
+2010-08-23 Jian Li <jianli@chromium.org>
+
+ Reviewed by Darin Fisher.
+
+ Handle blob resource.
+ https://bugs.webkit.org/show_bug.cgi?id=43941
+
+ * JavaScriptCore.exp: Add an export that is neede by BlobResourceHandle.
+
+2010-08-19 Andreas Kling <andreas.kling@nokia.com>
+
+ Reviewed by Geoffrey Garen.
+
+ JSC: Move the static_cast into to(U)Int32 fast case
+ https://bugs.webkit.org/show_bug.cgi?id=44037
+
+ Do the static_cast<(u)int32_t> inline to avoid the function call overhead
+ for easily converted values (within (u)int32_t range.)
+
+ * runtime/JSValue.cpp:
+ (JSC::toInt32SlowCase):
+ (JSC::toUInt32SlowCase):
+ * runtime/JSValue.h:
+ (JSC::JSValue::toInt32):
+ (JSC::JSValue::toUInt32):
+
+2010-08-18 Andreas Kling <andreas.kling@nokia.com>
+
+ Reviewed by Geoffrey Garen.
+
+ REGRESSION(r58469): Math.pow() always returns double-backed JSValue which is extremely slow as array subscript
+ https://bugs.webkit.org/show_bug.cgi?id=43742
+
+ Add codegen for pow() to return Int32 values when possible.
+
+ * jit/ThunkGenerators.cpp:
+ (JSC::powThunkGenerator):
+
+2010-08-18 Gabor Loki <loki@webkit.org>
+
+ Reviewed by Gavin Barraclough.
+
+ The JITStackFrame is wrong using Thumb-2 JIT with JSVALUE32_64
+ https://bugs.webkit.org/show_bug.cgi?id=43897
+
+ A 64 bits wide member in a structure is aligned to 8 bytes on ARM by
+ default, but this is not taken into account in the offset defines of
+ JITStackFrame.
+
+ * jit/JITStubs.cpp:
+ * jit/JITStubs.h:
+
+2010-08-18 Gavin Barraclough <barraclough@apple.com>
+
+ Rubber stamped by Sam Weinig.
+
+ Rename UString::substr to substringSharingImpl, add to WTF::String.
+ Now WTF::String can do everything that JSC::UString can do!
+
+ * JavaScriptCore.exp:
+ * bytecode/CodeBlock.cpp:
+ (JSC::escapeQuotes):
+ * bytecompiler/NodesCodegen.cpp:
+ (JSC::substitute):
+ * parser/SourceProvider.h:
+ (JSC::UStringSourceProvider::getRange):
+ * runtime/FunctionPrototype.cpp:
+ (JSC::insertSemicolonIfNeeded):
+ * runtime/JSGlobalObjectFunctions.cpp:
+ (JSC::parseInt):
+ * runtime/JSONObject.cpp:
+ (JSC::gap):
+ (JSC::Stringifier::indent):
+ (JSC::Stringifier::unindent):
+ * runtime/JSString.cpp:
+ (JSC::JSString::replaceCharacter):
+ * runtime/NumberPrototype.cpp:
+ (JSC::numberProtoFuncToFixed):
+ (JSC::numberProtoFuncToPrecision):
+ * runtime/StringPrototype.cpp:
+ (JSC::stringProtoFuncReplace):
+ (JSC::trimString):
+ * runtime/UString.cpp:
+ (JSC::UString::substringSharingImpl):
+ * runtime/UString.h:
+ * wtf/text/WTFString.cpp:
+ (WTF::String::substringSharingImpl):
+ * wtf/text/WTFString.h:
+
+2010-08-18 Gavin Barraclough <barraclough@apple.com>
+
+ Windows build fix.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2010-08-18 Gavin Barraclough <barraclough@apple.com>
+
+ Windows build fix.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2010-08-17 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Bug 44146 - Remove toDouble/toUInt32 methods from UString.
+
+ These methods all implement JavaScript language specific behaviour, and as such
+ are not suited to being on a generic string object. They are also inefficient
+ and incorrectly used, refactor & cleanup. Uses of these methods really divide
+ out into two cases.
+
+ ToNumber:
+ Uses of toDouble from JSString and from parseFloat are implementing ecma's
+ ToNumber conversion from strings (see ecma-262 9.3.1), so UString::toDouble
+ should largely just be moved out to a global jsToNumber function. ToNumber is
+ capable of recognizing either decimal or hexadecimal numbers, but parseFloat
+ should only recognize decimal values. This is currently handled by testing for
+ hexadecimal before calling toDouble, which should unnecessary - instead we can
+ just split out the two parts to the grammar into separate functions. Also,
+ strtod recognizes a set of literals (nan, inf, and infinity - all with any
+ capitalization) - which are not defined by any of the specs we are implementing.
+ To handle this we need to perform additional work in toDouble to convert the
+ unsupported cases of infinities back to NaNs. Instead we should simply remove
+ support for this literals from strtod. This should provide a more desirable
+ behaviour for all clients of strtod.
+
+ Indexed properties:
+ Uses of the toStrictUInt32 methods are were all converting property names to
+ indices, and all uses of toUInt32 were incorrect; in all cases we should have
+ been calling toUInt32. This error results in some incorrect behaviour in the
+ DOM (accessing property "0 " of a NodeList should fail; it currently does not).
+ Move this method onto Identifier (our canonical property name), and make it
+ always perform a strict conversion. Add a layout test to check NodeList does
+ convert indexed property names correctly.
+
+ * JavaScriptCore.exp:
+ * runtime/Arguments.cpp:
+ (JSC::Arguments::getOwnPropertySlot):
+ (JSC::Arguments::getOwnPropertyDescriptor):
+ (JSC::Arguments::put):
+ (JSC::Arguments::deleteProperty):
+ * runtime/Identifier.cpp:
+ (JSC::Identifier::toUInt32):
+ * runtime/Identifier.h:
+ (JSC::Identifier::toUInt32):
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::getOwnPropertySlot):
+ (JSC::JSArray::getOwnPropertyDescriptor):
+ (JSC::JSArray::put):
+ (JSC::JSArray::deleteProperty):
+ * runtime/JSArray.h:
+ (JSC::Identifier::toArrayIndex):
+ * runtime/JSByteArray.cpp:
+ (JSC::JSByteArray::getOwnPropertySlot):
+ (JSC::JSByteArray::getOwnPropertyDescriptor):
+ (JSC::JSByteArray::put):
+ * runtime/JSGlobalObjectFunctions.cpp:
+ (JSC::isInfinity):
+ (JSC::jsHexIntegerLiteral):
+ (JSC::jsStrDecimalLiteral):
+ (JSC::jsToNumber):
+ (JSC::parseFloat):
+ * runtime/JSGlobalObjectFunctions.h:
+ * runtime/JSString.cpp:
+ (JSC::JSString::getPrimitiveNumber):
+ (JSC::JSString::toNumber):
+ (JSC::JSString::getStringPropertyDescriptor):
+ * runtime/JSString.h:
+ (JSC::JSString::getStringPropertySlot):
+ * runtime/ObjectPrototype.cpp:
+ (JSC::ObjectPrototype::put):
+ * runtime/StringObject.cpp:
+ (JSC::StringObject::deleteProperty):
+ * runtime/UString.cpp:
+ * runtime/UString.h:
+ * wtf/dtoa.cpp:
+ (WTF::strtod):
+
+2010-08-17 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Bug 44099 - REGRESSION(r65468): Crashes in StringImpl::find
+
+ Bug 44080 introuduced a couple of cases in which array bounds could be overrun.
+ One of these was fixed in r65493, this patch fixes the other and address the
+ concerns voiced in comment #6 by restructuring the loops to remove the code
+ dupliction without introducing an additional if check.
+
+ * wtf/text/StringImpl.cpp:
+ (WTF::StringImpl::find):
+ (WTF::StringImpl::findIgnoringCase):
+ (WTF::StringImpl::reverseFind):
+ (WTF::StringImpl::reverseFindIgnoringCase):
+
+2010-08-17 No'am Rosenthal <noam.rosenthal@nokia.com>
+
+ Reviewed by Ariya Hidayat.
+
+ [Qt] Move the accelerated compositing build flag to the right place
+ https://bugs.webkit.org/show_bug.cgi?id=43882
+
+ * wtf/Platform.h:
+
+2010-08-17 Yuta Kitamura <yutak@chromium.org>
+
+ Reviewed by Shinichiro Hamaji.
+
+ Avoid uninitialized memory read in StringImpl::find().
+
+ REGRESSION(r65468): Crashes in StringImpl::find
+ https://bugs.webkit.org/show_bug.cgi?id=44099
+
+ * wtf/text/StringImpl.cpp:
+ (WTF::StringImpl::find):
+
+2010-08-16 Gavin Barraclough <barraclough@apple.com>
+
+ Rubber stamped by Sam Weinig
+
+ Add VectorTraits to String & DefaultHash traits to UString to unify behaviour.
+
+ * runtime/UString.h:
+ (JSC::UStringHash::hash):
+ (JSC::UStringHash::equal):
+ (WTF::):
+ * wtf/text/WTFString.h:
+ (WTF::):
+
+2010-08-16 Gavin Barraclough <barraclough@apple.com>
+
+ Rubber stamped by Sam Weinig
+
+ Remove unnecessary includes from UString.h, add new includes as necessary.
+
+ * profiler/CallIdentifier.h:
+ * profiler/ProfileNode.h:
+ * runtime/DateConversion.cpp:
+ * runtime/Identifier.h:
+ (JSC::IdentifierRepHash::hash):
+ * runtime/RegExpCache.h:
+ * runtime/RegExpKey.h:
+ * runtime/UString.cpp:
+ (JSC::UString::substr):
+ * runtime/UString.h:
+ * wtf/text/WTFString.h:
+
+2010-08-16 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig
+
+ Bug 44080 - String find/reverseFind methods need tidying up
+ These methods have a couple of problems with their interface, and implementation.
+
+ These methods take and int index, and return an int - however this is problematic
+ since on 64-bit string indices may have a full 32-bit range. This spills out into
+ surrounding code, which unsafely casts string indices from unsigned to int. Code
+ checking the result of these methods check for a mix of "== -1", "< 0", and
+ "== notFound". Clean this up by changing these methods to take an unsigned
+ starting index, and return a size_t. with a failed match indicated by notFound.
+ reverseFind also has a special meaning for the starting index argument, in that a
+ negative index is interpreted as an offset back from the end of the string. Remove
+ this functionality, in the (1!) case where it is used we should just calculate the
+ offset by subtracting from the string's length.
+
+ The implementation has a few problems too. The code is not in webkit style, in
+ using assorted abbreviations in variable names, and implementations of similar
+ find methods with differing argument types were unnecessarily inconsistent. When
+ find is passed const char* data the string would be handled as latin1 (zero
+ extended to UTF-16) for all characters but the first; this is sign extended.
+ Case-insensitive find is broken for unicode strings; the hashing optimization is
+ not unicode safe, and could result in false negatives.
+
+ Unify UString find methods to match String.
+
+ * JavaScriptCore.exp:
+ * bytecode/CodeBlock.cpp:
+ (JSC::escapeQuotes):
+ * bytecompiler/NodesCodegen.cpp:
+ (JSC::substitute):
+ * runtime/JSString.cpp:
+ (JSC::JSString::replaceCharacter):
+ * runtime/RegExp.cpp:
+ (JSC::RegExp::RegExp):
+ * runtime/RegExpKey.h:
+ (JSC::RegExpKey::getFlagsValue):
+ * runtime/StringPrototype.cpp:
+ (JSC::substituteBackreferencesSlow):
+ (JSC::substituteBackreferences):
+ (JSC::stringProtoFuncReplace):
+ (JSC::stringProtoFuncIndexOf):
+ (JSC::stringProtoFuncLastIndexOf):
+ (JSC::stringProtoFuncSplit):
+ * runtime/UString.cpp:
+ * runtime/UString.h:
+ (JSC::UString::find):
+ (JSC::UString::reverseFind):
+ * wtf/text/AtomicString.h:
+ (WTF::AtomicString::find):
+ * wtf/text/StringImpl.cpp:
+ (WTF::StringImpl::find):
+ (WTF::StringImpl::findCaseInsensitive):
+ (WTF::StringImpl::reverseFind):
+ (WTF::StringImpl::reverseFindCaseInsensitive):
+ (WTF::StringImpl::endsWith):
+ (WTF::StringImpl::replace):
+ * wtf/text/StringImpl.h:
+ (WTF::StringImpl::startsWith):
+ * wtf/text/WTFString.cpp:
+ (WTF::String::split):
+ * wtf/text/WTFString.h:
+ (WTF::String::find):
+ (WTF::String::reverseFind):
+ (WTF::String::findCaseInsensitive):
+ (WTF::String::reverseFindCaseInsensitive):
+ (WTF::String::contains):
+ (WTF::find):
+ (WTF::reverseFind):
+
+2010-08-16 Kevin Ollivier <kevino@theolliviers.com>
+
+ [wx] Build fix, do not build WebCore as a convenience library as this leads to
+ errors in the Win build w/export symbols and causes problems with DOM bindings
+ debugging in gdb.
+
+ * wscript:
+
+2010-08-16 Leandro Pereira <leandro@profusion.mobi>
+
+ [EFL] Build fix after r65366.
+
+ * CMakeLists.txt: Use if (VAR) instead of if (${VAR}) to check if
+ they're empty.
+ * jsc/CMakeLists.txt: Ditto.
+ * wtf/CMakeLists.txt: Ditto.
+
+2010-08-15 Kevin Ollivier <kevino@theolliviers.com>
+
+ [wx] Build fix, don't build intermediate source in DerivedSources dir.
+
+ * wscript:
+
+2010-08-14 Patrick Gansterer <paroga@paroga.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [CMake] Add preprocessor detection for generator scripts
+ https://bugs.webkit.org/show_bug.cgi?id=43984
+
+ * CMakeLists.txt:
+
+2010-08-14 Patrick Gansterer <paroga@paroga.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [CMake] Set target properties only if available
+ https://bugs.webkit.org/show_bug.cgi?id=43978
+
+ * CMakeLists.txt:
+ * jsc/CMakeLists.txt:
+ * wtf/CMakeLists.txt:
+
+2010-08-13 Kevin Ollivier <kevino@theolliviers.com>
+
+ [wx] Build fix, add CString to the list of forwards.
+
+ * wtf/Forward.h:
+
+2010-08-13 Gavin Barraclough <barraclough@apple.com>
+
+ Windows build fix
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-08-13 Gavin Barraclough <barraclough@apple.com>
+
+ Windows build fix
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-08-13 Gavin Barraclough <barraclough@apple.com>
+
+ Windows build fix
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-08-13 Gavin Barraclough <barraclough@apple.com>
+
+ Rubber stamped by Sam Weinig.
+ Switch String::/UString::ascii() to return a CString.
+
+ * JavaScriptCore.exp:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::dump):
+ * bytecode/SamplingTool.cpp:
+ (JSC::SamplingTool::dump):
+ * interpreter/CallFrame.cpp:
+ (JSC::CallFrame::dumpCaller):
+ * jsc.cpp:
+ (runWithScripts):
+ (runInteractive):
+ * runtime/Identifier.h:
+ (JSC::Identifier::ascii):
+ * runtime/ScopeChain.cpp:
+ (JSC::ScopeChainNode::print):
+ * runtime/UString.cpp:
+ (JSC::UString::ascii):
+ (JSC::UString::latin1):
+ * runtime/UString.h:
+ * wtf/text/StringImpl.cpp:
+ (WTF::StringImpl::asciiOLD):
+ * wtf/text/StringImpl.h:
+ * wtf/text/WTFString.cpp:
+ (WTF::String::ascii):
+ (WTF::String::latin1):
+ * wtf/text/WTFString.h:
+
+2010-08-13 Gabor Loki <loki@webkit.org>
+
+ Reviewed by Gavin Barraclough.
+
+ Avoid increasing required alignment of target type warning on ARM
+ https://bugs.webkit.org/show_bug.cgi?id=38045
+
+ The reinterpret_cast<Type1*>([pointer to Type2]) expressions - where
+ sizeof(Type1) > sizeof(Type2) - cause the following warning on ARM:
+ increases required alignment of target type warnings.
+ Casting the type of [pointer to Type2] object to void* bypasses the
+ warning.
+
+ * assembler/ARMAssembler.cpp:
+ (JSC::ARMAssembler::executableCopy):
+ * assembler/AssemblerBuffer.h:
+ (JSC::AssemblerBuffer::putShortUnchecked):
+ (JSC::AssemblerBuffer::putIntUnchecked):
+ (JSC::AssemblerBuffer::putInt64Unchecked):
+ * interpreter/RegisterFile.h:
+ (JSC::RegisterFile::RegisterFile):
+ (JSC::RegisterFile::grow):
+ * jit/JITStubs.cpp:
+ * pcre/pcre_compile.cpp:
+ (jsRegExpCompile):
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::putSlowCase):
+ (JSC::JSArray::increaseVectorLength):
+ (JSC::JSArray::increaseVectorPrefixLength):
+ (JSC::JSArray::shiftCount):
+ (JSC::JSArray::unshiftCount):
+ * wtf/FastMalloc.cpp:
+ (WTF::PageHeapAllocator::New):
+ (WTF::TCMalloc_Central_FreeList::Populate):
+ * wtf/MD5.cpp:
+ (WTF::reverseBytes):
+ (WTF::MD5::addBytes):
+ (WTF::MD5::checksum):
+ * wtf/StdLibExtras.h:
+ (isPointerTypeAlignmentOkay):
+ (reinterpret_cast_ptr):
+ * wtf/Vector.h:
+ (WTF::VectorBuffer::inlineBuffer):
+ * wtf/qt/StringQt.cpp:
+ (WTF::String::String):
+
+2010-08-13 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig
+
+ Unify UString::UTF8String() & String::utf8() methods,
+ remove UString::cost() & make atArrayIndex a free function.
+
+ * JavaScriptCore.exp:
+ * bytecode/CodeBlock.cpp:
+ (JSC::constantName):
+ (JSC::idName):
+ (JSC::CodeBlock::registerName):
+ (JSC::regexpName):
+ (JSC::printGlobalResolveInfo):
+ (JSC::printStructureStubInfo):
+ (JSC::CodeBlock::printStructure):
+ (JSC::CodeBlock::printStructures):
+ * jsc.cpp:
+ (functionPrint):
+ (functionDebug):
+ (runInteractive):
+ (fillBufferWithContentsOfFile):
+ * pcre/pcre_exec.cpp:
+ (Histogram::~Histogram):
+ * profiler/CallIdentifier.h:
+ (JSC::CallIdentifier::c_str):
+ * profiler/Profile.cpp:
+ (JSC::Profile::debugPrintDataSampleStyle):
+ * profiler/ProfileGenerator.cpp:
+ (JSC::ProfileGenerator::willExecute):
+ (JSC::ProfileGenerator::didExecute):
+ * profiler/ProfileNode.cpp:
+ (JSC::ProfileNode::debugPrintData):
+ (JSC::ProfileNode::debugPrintDataSampleStyle):
+ * runtime/Arguments.cpp:
+ (JSC::Arguments::getOwnPropertySlot):
+ (JSC::Arguments::getOwnPropertyDescriptor):
+ (JSC::Arguments::put):
+ (JSC::Arguments::deleteProperty):
+ * runtime/DateConversion.cpp:
+ (JSC::parseDate):
+ * runtime/Identifier.h:
+ (JSC::Identifier::toStrictUInt32):
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::getOwnPropertySlot):
+ (JSC::JSArray::getOwnPropertyDescriptor):
+ (JSC::JSArray::put):
+ (JSC::JSArray::deleteProperty):
+ * runtime/JSArray.h:
+ (JSC::toArrayIndex):
+ * runtime/JSGlobalObjectFunctions.cpp:
+ (JSC::encode):
+ (JSC::parseInt):
+ (JSC::globalFuncJSCPrint):
+ * runtime/JSString.h:
+ (JSC::RopeBuilder::JSString):
+ * runtime/UString.cpp:
+ (JSC::UString::toDouble):
+ (JSC::putUTF8Triple):
+ (JSC::UString::utf8):
+ * runtime/UString.h:
+ (JSC::UString::~UString):
+ (JSC::UString::isNull):
+ (JSC::UString::isEmpty):
+ (JSC::UString::impl):
+ * wtf/text/WTFString.cpp:
+ (WTF::String::utf8):
+ * wtf/text/WTFString.h:
+ (WTF::String::~String):
+ (WTF::String::swap):
+ (WTF::String::isNull):
+ (WTF::String::isEmpty):
+ (WTF::String::impl):
+ (WTF::String::length):
+ (WTF::String::String):
+ (WTF::String::isHashTableDeletedValue):
+
+2010-08-12 Zoltan Herczeg <zherczeg@webkit.org>
+
+ Reviewed by Gavin Barraclough.
+
+ Refactoring the fpu code generator for the ARM port
+ https://bugs.webkit.org/show_bug.cgi?id=43842
+
+ Support up to 32 double precision registers, and the
+ recent VFP instruction formats. This patch is mainly
+ a style change which keeps the current functionality.
+
+ * assembler/ARMAssembler.h:
+ (JSC::ARMRegisters::):
+ (JSC::ARMAssembler::):
+ (JSC::ARMAssembler::emitInst):
+ (JSC::ARMAssembler::emitDoublePrecisionInst):
+ (JSC::ARMAssembler::emitSinglePrecisionInst):
+ (JSC::ARMAssembler::vadd_f64_r):
+ (JSC::ARMAssembler::vdiv_f64_r):
+ (JSC::ARMAssembler::vsub_f64_r):
+ (JSC::ARMAssembler::vmul_f64_r):
+ (JSC::ARMAssembler::vcmp_f64_r):
+ (JSC::ARMAssembler::vsqrt_f64_r):
+ (JSC::ARMAssembler::vmov_vfp_r):
+ (JSC::ARMAssembler::vmov_arm_r):
+ (JSC::ARMAssembler::vcvt_f64_s32_r):
+ (JSC::ARMAssembler::vcvt_s32_f64_r):
+ (JSC::ARMAssembler::vmrs_apsr):
+ * assembler/MacroAssemblerARM.h:
+ (JSC::MacroAssemblerARM::addDouble):
+ (JSC::MacroAssemblerARM::divDouble):
+ (JSC::MacroAssemblerARM::subDouble):
+ (JSC::MacroAssemblerARM::mulDouble):
+ (JSC::MacroAssemblerARM::sqrtDouble):
+ (JSC::MacroAssemblerARM::convertInt32ToDouble):
+ (JSC::MacroAssemblerARM::branchDouble):
+ (JSC::MacroAssemblerARM::branchConvertDoubleToInt32):
+
+2010-08-12 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r65295.
+ http://trac.webkit.org/changeset/65295
+ https://bugs.webkit.org/show_bug.cgi?id=43950
+
+ It broke 4 sputnik tests (Requested by Ossy on #webkit).
+
+ * JavaScriptCore.exp:
+ * bytecode/CodeBlock.cpp:
+ (JSC::constantName):
+ (JSC::idName):
+ (JSC::CodeBlock::registerName):
+ (JSC::regexpName):
+ (JSC::printGlobalResolveInfo):
+ (JSC::printStructureStubInfo):
+ (JSC::CodeBlock::printStructure):
+ (JSC::CodeBlock::printStructures):
+ * jsc.cpp:
+ (functionPrint):
+ (functionDebug):
+ (runInteractive):
+ (fillBufferWithContentsOfFile):
+ * pcre/pcre_exec.cpp:
+ (Histogram::~Histogram):
+ * profiler/CallIdentifier.h:
+ (JSC::CallIdentifier::c_str):
+ * profiler/Profile.cpp:
+ (JSC::Profile::debugPrintDataSampleStyle):
+ * profiler/ProfileGenerator.cpp:
+ (JSC::ProfileGenerator::willExecute):
+ (JSC::ProfileGenerator::didExecute):
+ * profiler/ProfileNode.cpp:
+ (JSC::ProfileNode::debugPrintData):
+ (JSC::ProfileNode::debugPrintDataSampleStyle):
+ * runtime/Arguments.cpp:
+ (JSC::Arguments::getOwnPropertySlot):
+ (JSC::Arguments::getOwnPropertyDescriptor):
+ (JSC::Arguments::put):
+ (JSC::Arguments::deleteProperty):
+ * runtime/DateConversion.cpp:
+ (JSC::parseDate):
+ * runtime/Identifier.h:
+ (JSC::Identifier::Identifier):
+ (JSC::Identifier::toArrayIndex):
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::getOwnPropertySlot):
+ (JSC::JSArray::getOwnPropertyDescriptor):
+ (JSC::JSArray::put):
+ (JSC::JSArray::deleteProperty):
+ * runtime/JSArray.h:
+ * runtime/JSGlobalObjectFunctions.cpp:
+ (JSC::encode):
+ (JSC::parseInt):
+ (JSC::globalFuncJSCPrint):
+ * runtime/JSString.h:
+ (JSC::RopeBuilder::JSString):
+ * runtime/UString.cpp:
+ (JSC::UString::toDouble):
+ (JSC::UString::UTF8String):
+ * runtime/UString.h:
+ (JSC::UString::isNull):
+ (JSC::UString::isEmpty):
+ (JSC::UString::impl):
+ (JSC::UString::cost):
+ (JSC::UString::~UString):
+ (JSC::UString::toArrayIndex):
+ * wtf/text/WTFString.cpp:
+ (WTF::String::utf8):
+ * wtf/text/WTFString.h:
+ (WTF::String::String):
+ (WTF::String::isHashTableDeletedValue):
+ (WTF::String::length):
+ (WTF::String::operator[]):
+ (WTF::String::isNull):
+ (WTF::String::isEmpty):
+ (WTF::String::impl):
+
+2010-08-12 Gavin Barraclough <barraclough@apple.com>
+
+ Windows build fix.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-08-12 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig
+
+ Unify UString::UTF8String() & String::utf8() methods,
+ remove UString::cost() & make atArrayIndex a free function.
+
+ * JavaScriptCore.exp:
+ * bytecode/CodeBlock.cpp:
+ (JSC::constantName):
+ (JSC::idName):
+ (JSC::CodeBlock::registerName):
+ (JSC::regexpName):
+ (JSC::printGlobalResolveInfo):
+ (JSC::printStructureStubInfo):
+ (JSC::CodeBlock::printStructure):
+ (JSC::CodeBlock::printStructures):
+ * jsc.cpp:
+ (functionPrint):
+ (functionDebug):
+ (runInteractive):
+ (fillBufferWithContentsOfFile):
+ * pcre/pcre_exec.cpp:
+ (Histogram::~Histogram):
+ * profiler/CallIdentifier.h:
+ (JSC::CallIdentifier::c_str):
+ * profiler/Profile.cpp:
+ (JSC::Profile::debugPrintDataSampleStyle):
+ * profiler/ProfileGenerator.cpp:
+ (JSC::ProfileGenerator::willExecute):
+ (JSC::ProfileGenerator::didExecute):
+ * profiler/ProfileNode.cpp:
+ (JSC::ProfileNode::debugPrintData):
+ (JSC::ProfileNode::debugPrintDataSampleStyle):
+ * runtime/Arguments.cpp:
+ (JSC::Arguments::getOwnPropertySlot):
+ (JSC::Arguments::getOwnPropertyDescriptor):
+ (JSC::Arguments::put):
+ (JSC::Arguments::deleteProperty):
+ * runtime/DateConversion.cpp:
+ (JSC::parseDate):
+ * runtime/Identifier.h:
+ (JSC::Identifier::toStrictUInt32):
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::getOwnPropertySlot):
+ (JSC::JSArray::getOwnPropertyDescriptor):
+ (JSC::JSArray::put):
+ (JSC::JSArray::deleteProperty):
+ * runtime/JSArray.h:
+ (JSC::toArrayIndex):
+ * runtime/JSGlobalObjectFunctions.cpp:
+ (JSC::encode):
+ (JSC::parseInt):
+ (JSC::globalFuncJSCPrint):
+ * runtime/JSString.h:
+ (JSC::RopeBuilder::JSString):
+ * runtime/UString.cpp:
+ (JSC::UString::toDouble):
+ (JSC::putUTF8Triple):
+ (JSC::UString::utf8):
+ * runtime/UString.h:
+ (JSC::UString::~UString):
+ (JSC::UString::isNull):
+ (JSC::UString::isEmpty):
+ (JSC::UString::impl):
+ * wtf/text/WTFString.cpp:
+ (WTF::String::utf8):
+ * wtf/text/WTFString.h:
+ (WTF::String::~String):
+ (WTF::String::swap):
+ (WTF::String::isNull):
+ (WTF::String::isEmpty):
+ (WTF::String::impl):
+ (WTF::String::length):
+ (WTF::String::String):
+ (WTF::String::isHashTableDeletedValue):
+
+2010-08-12 Gavin Barraclough <barraclough@apple.com>
+
+ Eeerk! - revert accidentally committed changes in UString!
+
+ * JavaScriptCore.exp:
+ * runtime/UString.cpp:
+ (JSC::UString::UString):
+ * runtime/UString.h:
+
+2010-08-12 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig
+
+ Change UString constructors to match those in WTF::String.
+ This changes behaviour of UString((char*)0) to create null
+ strings, akin to UString() rather than UString::empty().
+ (This matches String). Remove unused constructors from
+ UString, and add null-terminated UTF-16 constructor, to
+ match String. Move String's constructor into the .cpp to
+ match UString.
+
+ * JavaScriptCore.exp:
+ * debugger/DebuggerCallFrame.cpp:
+ (JSC::DebuggerCallFrame::calculatedFunctionName):
+ * runtime/RegExpKey.h:
+ (JSC::RegExpKey::RegExpKey):
+ * runtime/SmallStrings.cpp:
+ (JSC::SmallStrings::createSingleCharacterString):
+ * runtime/UString.cpp:
+ (JSC::UString::UString):
+ * runtime/UString.h:
+ (JSC::UString::UString):
+ (JSC::UString::swap):
+ (JSC::UString::adopt):
+ (JSC::UString::operator[]):
+ * wtf/text/WTFString.h:
+ (WTF::String::String):
+ (WTF::String::adopt):
+ (WTF::String::operator[]):
+
+2010-08-12 David Levin <levin@chromium.org>
+
+ Reviewed by NOBODY (build fix).
+
+ * runtime/UString.h: Removed unneccessary #include.
+
+2010-08-12 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig
+
+ Revert changes to ALWAYS_INLINEness of a couple of functions in UString.
+ This appears to have degraded performance.
+
+ * runtime/UString.cpp:
+ (JSC::UString::ascii):
+ * runtime/UString.h:
+ (JSC::UString::length):
+ (JSC::UString::isEmpty):
+ (JSC::UString::~UString):
+
+2010-08-12 Csaba Osztrogonác <ossy@webkit.org>
+
+ Reviewed by Antonio Gomes.
+
+ [Qt] Fix warnings: unknown conversion type character 'l' in format
+ https://bugs.webkit.org/show_bug.cgi?id=43359
+
+ Qt port doesn't call any printf in String::format(...), consequently
+ using __attribute__((format(printf,m,n))) is incorrect and causes
+ false positive warnings on Windows if you build with MinGW.
+
+ Qt port calls QString::vsprintf(...) , which is platform
+ independent, and handles %lli, %llu and %llx on all platforms.
+ (http://trac.webkit.org/changeset/35712)
+
+ * wtf/text/WTFString.h:
+
+2010-08-12 Gabor Loki <loki@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ Fix the array subscript is above array bounds warning in ByteArray on ARM.
+ https://bugs.webkit.org/show_bug.cgi?id=43358
+
+ The warning is very similar to this one: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37861
+
+ * wtf/ByteArray.cpp:
+ (WTF::ByteArray::create):
+
+2010-08-12 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk>
+
+ Reviewed by Martin Robinson.
+
+ [GTK] Use GSettings to save/restore Web Inspector settings
+ https://bugs.webkit.org/show_bug.cgi?id=43512
+
+ * wtf/gobject/GRefPtr.cpp: Added support for GVariant, used by our
+ GSettings support.
+ (WTF::refGPtr):
+ (WTF::derefGPtr):
+ * wtf/gobject/GRefPtr.h:
+
+2010-08-12 Gabor Loki <loki@webkit.org>
+
+ Reviewed by Simon Hausmann.
+
+ The scratch register should be saved in YARR with ARM JIT
+ https://bugs.webkit.org/show_bug.cgi?id=43910
+
+ Reported by Jocelyn Turcotte.
+
+ * yarr/RegexJIT.cpp:
+ (JSC::Yarr::RegexGenerator::generateEnter):
+ (JSC::Yarr::RegexGenerator::generateReturn):
+
+2010-08-11 Gavin Barraclough <barraclough@apple.com>
+
+ Windows build fix.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * wtf/Forward.h:
+
+2010-08-11 Leo Yang <leo.yang@torchmobile.com.cn>
+
+ Reviewed by Geoffrey Garen.
+
+ Date("") should be an invalid date. For IE, Firefox and Chrome, Date("") is invalid date,
+ which means isNaN(new Date("")) should return true.
+ https://bugs.webkit.org/show_bug.cgi?id=43793
+ Tests: fast/js/date-constructor.html
+
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::resetDateCache):
+
+2010-08-11 Gavin Barraclough <barraclough@apple.com>
+
+ Windows & !JIT build fix.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * runtime/RegExp.cpp:
+ (JSC::RegExp::match):
+
+2010-08-11 Gavin Barraclough <barraclough@apple.com>
+
+ Rubber stamp by sam weinig
+
+ Touch a file to stop the bot rolling a bit change out!
+
+ * runtime/UString.cpp:
+ (JSC::UString::ascii):
+
+2010-08-11 Kevin Ollivier <kevino@theolliviers.com>
+
+ [wx] Build fix for wx and WebDOM bindings, add CString classes to the list of forwards.
+
+ * wtf/Forward.h:
+
+2010-08-11 Gavin Barraclough <barraclough@apple.com>
+
+ Rubber stamps by Darin Adler & Sam Weinig.
+
+ Bug 43867 - Some UString cleanup
+
+ Change JSC::UString data(), size(), and from(), to characters(), length(), and number() to match WTF::String.
+ Move string concatenation methods to a new header to simplify down UString.h. Remove is8Bit().
+
+ * API/JSClassRef.cpp:
+ (OpaqueJSClass::~OpaqueJSClass):
+ (OpaqueJSClass::className):
+ * API/OpaqueJSString.cpp:
+ (OpaqueJSString::create):
+ * JavaScriptCore.exp:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * bytecode/CodeBlock.cpp:
+ (JSC::constantName):
+ (JSC::idName):
+ (JSC::CodeBlock::registerName):
+ (JSC::regexpName):
+ * bytecode/EvalCodeCache.h:
+ (JSC::EvalCodeCache::get):
+ * bytecompiler/NodesCodegen.cpp:
+ (JSC::ResolveNode::emitBytecode):
+ (JSC::FunctionCallResolveNode::emitBytecode):
+ (JSC::ReadModifyResolveNode::emitBytecode):
+ (JSC::processClauseList):
+ * parser/ASTBuilder.h:
+ (JSC::ASTBuilder::createRegex):
+ * parser/ParserArena.h:
+ (JSC::IdentifierArena::makeNumericIdentifier):
+ * parser/SourceProvider.h:
+ (JSC::UStringSourceProvider::data):
+ (JSC::UStringSourceProvider::length):
+ * profiler/Profiler.cpp:
+ * runtime/Arguments.cpp:
+ (JSC::Arguments::getOwnPropertySlot):
+ (JSC::Arguments::getOwnPropertyNames):
+ (JSC::Arguments::put):
+ (JSC::Arguments::deleteProperty):
+ * runtime/ArrayPrototype.cpp:
+ (JSC::arrayProtoFuncToString):
+ * runtime/DatePrototype.cpp:
+ (JSC::formatLocaleDate):
+ * runtime/ExceptionHelpers.cpp:
+ * runtime/FunctionConstructor.cpp:
+ * runtime/FunctionPrototype.cpp:
+ (JSC::insertSemicolonIfNeeded):
+ * runtime/Identifier.h:
+ (JSC::Identifier::characters):
+ (JSC::Identifier::length):
+ * runtime/JSGlobalObjectFunctions.cpp:
+ (JSC::decode):
+ (JSC::parseInt):
+ (JSC::parseFloat):
+ (JSC::globalFuncEscape):
+ (JSC::globalFuncUnescape):
+ * runtime/JSNumberCell.cpp:
+ (JSC::JSNumberCell::toString):
+ * runtime/JSONObject.cpp:
+ (JSC::gap):
+ (JSC::Stringifier::appendQuotedString):
+ (JSC::Stringifier::appendStringifiedValue):
+ (JSC::Stringifier::indent):
+ (JSC::Stringifier::unindent):
+ (JSC::Walker::walk):
+ * runtime/JSString.cpp:
+ (JSC::JSString::replaceCharacter):
+ (JSC::JSString::getIndexSlowCase):
+ * runtime/JSString.h:
+ (JSC::RopeBuilder::JSString):
+ (JSC::RopeBuilder::appendValueInConstructAndIncrementLength):
+ (JSC::RopeBuilder::fiberCount):
+ (JSC::jsSingleCharacterSubstring):
+ (JSC::jsNontrivialString):
+ (JSC::JSString::getIndex):
+ (JSC::jsString):
+ (JSC::jsStringWithFinalizer):
+ (JSC::jsSubstring):
+ (JSC::jsOwnedString):
+ * runtime/JSStringBuilder.h:
+ (JSC::JSStringBuilder::append):
+ * runtime/LiteralParser.h:
+ (JSC::LiteralParser::Lexer::Lexer):
+ * runtime/NumberPrototype.cpp:
+ (JSC::numberProtoFuncToString):
+ (JSC::numberProtoFuncToFixed):
+ (JSC::numberProtoFuncToExponential):
+ (JSC::numberProtoFuncToPrecision):
+ * runtime/NumericStrings.h:
+ (JSC::NumericStrings::add):
+ (JSC::NumericStrings::lookupSmallString):
+ * runtime/Operations.h:
+ (JSC::jsString):
+ * runtime/RegExp.cpp:
+ (JSC::RegExp::match):
+ * runtime/RegExpCache.cpp:
+ (JSC::RegExpCache::lookupOrCreate):
+ (JSC::RegExpCache::create):
+ * runtime/RegExpConstructor.cpp:
+ (JSC::RegExpConstructor::getRightContext):
+ * runtime/RegExpObject.cpp:
+ (JSC::RegExpObject::match):
+ * runtime/RegExpPrototype.cpp:
+ (JSC::regExpProtoFuncToString):
+ * runtime/StringBuilder.h:
+ (JSC::StringBuilder::append):
+ * runtime/StringConcatenate.h: Copied from JavaScriptCore/runtime/UString.h.
+ (JSC::):
+ (JSC::sumWithOverflow):
+ (JSC::tryMakeString):
+ (JSC::makeString):
+ * runtime/StringObject.cpp:
+ (JSC::StringObject::getOwnPropertyNames):
+ * runtime/StringPrototype.cpp:
+ (JSC::substituteBackreferencesSlow):
+ (JSC::localeCompare):
+ (JSC::jsSpliceSubstringsWithSeparators):
+ (JSC::stringProtoFuncReplace):
+ (JSC::stringProtoFuncCharAt):
+ (JSC::stringProtoFuncCharCodeAt):
+ (JSC::stringProtoFuncIndexOf):
+ (JSC::stringProtoFuncLastIndexOf):
+ (JSC::stringProtoFuncSlice):
+ (JSC::stringProtoFuncSplit):
+ (JSC::stringProtoFuncSubstr):
+ (JSC::stringProtoFuncSubstring):
+ (JSC::stringProtoFuncToLowerCase):
+ (JSC::stringProtoFuncToUpperCase):
+ (JSC::stringProtoFuncFontsize):
+ (JSC::stringProtoFuncLink):
+ (JSC::trimString):
+ * runtime/UString.cpp:
+ (JSC::UString::number):
+ (JSC::UString::ascii):
+ (JSC::UString::operator[]):
+ (JSC::UString::toDouble):
+ (JSC::UString::find):
+ (JSC::UString::rfind):
+ (JSC::UString::substr):
+ (JSC::operator==):
+ (JSC::operator<):
+ (JSC::operator>):
+ (JSC::UString::UTF8String):
+ * runtime/UString.h:
+ (JSC::UString::UString):
+ (JSC::UString::adopt):
+ (JSC::UString::length):
+ (JSC::UString::characters):
+ (JSC::UString::isNull):
+ (JSC::UString::isEmpty):
+ (JSC::UString::impl):
+ (JSC::UString::cost):
+ (JSC::operator==):
+ (JSC::operator!=):
+ (JSC::codePointCompare):
+ (JSC::UString::toArrayIndex):
+ (JSC::IdentifierRepHash::hash):
+ (WTF::):
+ * yarr/RegexJIT.cpp:
+ (JSC::Yarr::jitCompileRegex):
+ * yarr/RegexParser.h:
+ (JSC::Yarr::Parser::Parser):
+
+2010-08-11 Gabor Loki <loki@webkit.org>
+
+ Qt build fix (ARMv7).
+
+ Fix invalid conversion from int to Condition.
+ Add ARMv7Assembler.cpp to JavaScriptCore.pro.
+
+ * JavaScriptCore.pro:
+ * assembler/ARMv7Assembler.h:
+ (JSC::ARMv7Assembler::):
+ (JSC::ARMv7Assembler::JmpSrc::JmpSrc):
+
+2010-08-11 Nathan Lawrence <nlawrence@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ At collection time, we frequently want to mark a cell, while checking
+ whether it was originally checked. Previously, this was a get
+ operation follwed by a set operation. Fusing the two saves
+ computation and gives a 0.5% sunspider speedup.
+
+ * runtime/Collector.h:
+ (JSC::CollectorBitmap::getset):
+ (JSC::Heap::checkMarkCell):
+ * runtime/JSArray.h:
+ (JSC::MarkStack::drain):
+ * runtime/JSCell.h:
+ (JSC::MarkStack::append):
+
+2010-08-11 Steve Falkenburg <sfalken@apple.com>
+
+ Reviewed by Adam Roben.
+
+ Improve vsprops copying for Windows build
+ https://bugs.webkit.org/show_bug.cgi?id=41982
+
+ When we detect a new SDK, always copy a new set of vsprops files.
+ Previously, if someone updated their SDK after updating their sources,
+ they could end up with out-of-date vsprops files.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make:
+
+2010-08-10 Darin Adler <darin@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Add leakRef and clear to all RefPtr variants
+ https://bugs.webkit.org/show_bug.cgi?id=42389
+
+ * API/JSRetainPtr.h: Changed all uses of "template <...>" to instead do
+ "template<...>". We should probably put this in the style guide and do it
+ consitently. Fixed other minor style issues. Defined many of the inlined
+ functions outside the class definition, to avoid style checker warnings
+ about multiple statements on a single line and for slightly better clarity
+ of the class definition itself. Renamed releaseRef to leakRef. Added a
+ releaseRef that calls leakRef so we don't have to rename all callers oat
+ once. Added a clear function.
+
+ * wtf/PassRefPtr.h: Changed all uses of releaseRef to leakRef.
+n
+ * wtf/RefPtr.h: Changed all uses of "template <...>" to instead do
+ "template<...>". Tidied up declarations and comments a bit.
+ Changed all uses of releaseRef to leakRef.
+
+ * wtf/RetainPtr.h: Changed all uses of "template <...>" to instead do
+ "template<...>". Defined many of the inlined functions outside the class
+ definition, to avoid style checker warnings about multiple statements on
+ a single line and for slightly better clarity of the class definition itself.
+ Renamed releaseRef to leakRef. Added a releaseRef that calls leakRef so we
+ don't have to rename all callers at once. Added a clear function.
+
+2010-08-10 Dumitru Daniliuc <dumi@chromium.org>
+
+ Unreviewed, reverting an unintentional change to a file submitted in r65108.
+
+ * bytecode/CodeBlock.h:
+ (JSC::binaryChop):
+
+2010-08-10 Gavin Barraclough <barraclough@apple.com>
+
+ Rubber stamped by Sam Weinig
+
+ Bug 43817 - Remove UString::Rep
+ UString::Rep has for a long time been replaced by UStringImpl (Rep
+ remaining as a typedef). UStringImpl has since been removed too
+ (unified with StringImpl). Remove Rep, rename rep() to impl() and
+ m_rep to m_impl. Also add impl() method to Identifier, and rename
+ its UString member from _ustring to m_string.
+
+ * API/JSCallbackObject.h:
+ (JSC::JSCallbackObjectData::JSPrivatePropertyMap::getPrivateProperty):
+ (JSC::JSCallbackObjectData::JSPrivatePropertyMap::setPrivateProperty):
+ (JSC::JSCallbackObjectData::JSPrivatePropertyMap::deletePrivateProperty):
+ * API/JSCallbackObjectFunctions.h:
+ (JSC::::getOwnPropertySlot):
+ (JSC::::put):
+ (JSC::::deleteProperty):
+ (JSC::::getOwnPropertyNames):
+ (JSC::::staticValueGetter):
+ (JSC::::staticFunctionGetter):
+ * API/JSClassRef.cpp:
+ (tryCreateStringFromUTF8):
+ (OpaqueJSClass::OpaqueJSClass):
+ (OpaqueJSClass::~OpaqueJSClass):
+ (OpaqueJSClassContextData::OpaqueJSClassContextData):
+ * API/JSClassRef.h:
+ * API/OpaqueJSString.cpp:
+ (OpaqueJSString::ustring):
+ * bytecode/EvalCodeCache.h:
+ (JSC::EvalCodeCache::get):
+ * bytecode/JumpTable.h:
+ (JSC::StringJumpTable::offsetForValue):
+ (JSC::StringJumpTable::ctiForValue):
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::addVar):
+ (JSC::BytecodeGenerator::addGlobalVar):
+ (JSC::BytecodeGenerator::BytecodeGenerator):
+ (JSC::BytecodeGenerator::addParameter):
+ (JSC::BytecodeGenerator::registerFor):
+ (JSC::BytecodeGenerator::willResolveToArguments):
+ (JSC::BytecodeGenerator::uncheckedRegisterForArguments):
+ (JSC::BytecodeGenerator::constRegisterFor):
+ (JSC::BytecodeGenerator::isLocal):
+ (JSC::BytecodeGenerator::isLocalConstant):
+ (JSC::BytecodeGenerator::addConstant):
+ (JSC::BytecodeGenerator::emitLoad):
+ (JSC::BytecodeGenerator::findScopedProperty):
+ (JSC::keyForCharacterSwitch):
+ (JSC::prepareJumpTableForStringSwitch):
+ * bytecompiler/BytecodeGenerator.h:
+ * bytecompiler/NodesCodegen.cpp:
+ (JSC::processClauseList):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+ * parser/JSParser.cpp:
+ (JSC::JSParser::parseStrictObjectLiteral):
+ * pcre/pcre_exec.cpp:
+ (Histogram::add):
+ * profiler/CallIdentifier.h:
+ (JSC::CallIdentifier::Hash::hash):
+ * profiler/Profile.cpp:
+ * profiler/ProfileNode.cpp:
+ (JSC::ProfileNode::debugPrintDataSampleStyle):
+ * profiler/ProfileNode.h:
+ * runtime/ArrayPrototype.cpp:
+ (JSC::arrayProtoFuncToString):
+ * runtime/Identifier.cpp:
+ (JSC::Identifier::equal):
+ (JSC::IdentifierCStringTranslator::hash):
+ (JSC::IdentifierCStringTranslator::equal):
+ (JSC::IdentifierCStringTranslator::translate):
+ (JSC::Identifier::add):
+ (JSC::IdentifierUCharBufferTranslator::hash):
+ (JSC::IdentifierUCharBufferTranslator::equal):
+ (JSC::IdentifierUCharBufferTranslator::translate):
+ (JSC::Identifier::addSlowCase):
+ * runtime/Identifier.h:
+ (JSC::Identifier::Identifier):
+ (JSC::Identifier::ustring):
+ (JSC::Identifier::impl):
+ (JSC::Identifier::data):
+ (JSC::Identifier::size):
+ (JSC::Identifier::ascii):
+ (JSC::Identifier::isNull):
+ (JSC::Identifier::isEmpty):
+ (JSC::Identifier::toUInt32):
+ (JSC::Identifier::toStrictUInt32):
+ (JSC::Identifier::toArrayIndex):
+ (JSC::Identifier::toDouble):
+ (JSC::Identifier::equal):
+ (JSC::Identifier::add):
+ * runtime/InitializeThreading.cpp:
+ (JSC::initializeThreadingOnce):
+ * runtime/InternalFunction.cpp:
+ (JSC::InternalFunction::displayName):
+ * runtime/JSFunction.cpp:
+ (JSC::JSFunction::displayName):
+ * runtime/JSGlobalObject.h:
+ (JSC::JSGlobalObject::addStaticGlobals):
+ * runtime/JSStaticScopeObject.h:
+ (JSC::JSStaticScopeObject::JSStaticScopeObject):
+ * runtime/JSString.h:
+ (JSC::):
+ (JSC::RopeBuilder::appendStringInConstruct):
+ (JSC::RopeBuilder::appendValueInConstructAndIncrementLength):
+ (JSC::jsSingleCharacterSubstring):
+ (JSC::jsSubstring):
+ * runtime/JSVariableObject.cpp:
+ (JSC::JSVariableObject::deleteProperty):
+ (JSC::JSVariableObject::symbolTableGet):
+ * runtime/JSVariableObject.h:
+ (JSC::JSVariableObject::symbolTableGet):
+ (JSC::JSVariableObject::symbolTablePut):
+ (JSC::JSVariableObject::symbolTablePutWithAttributes):
+ * runtime/Lookup.cpp:
+ (JSC::HashTable::createTable):
+ (JSC::HashTable::deleteTable):
+ * runtime/Lookup.h:
+ (JSC::HashEntry::initialize):
+ (JSC::HashEntry::setKey):
+ (JSC::HashEntry::key):
+ (JSC::HashTable::entry):
+ * runtime/PropertyMapHashTable.h:
+ (JSC::PropertyMapEntry::PropertyMapEntry):
+ * runtime/PropertyNameArray.cpp:
+ (JSC::PropertyNameArray::add):
+ * runtime/PropertyNameArray.h:
+ (JSC::PropertyNameArray::add):
+ (JSC::PropertyNameArray::addKnownUnique):
+ * runtime/RegExp.cpp:
+ (JSC::RegExp::match):
+ * runtime/RegExpCache.cpp:
+ (JSC::RegExpCache::create):
+ * runtime/RegExpKey.h:
+ (JSC::RegExpKey::RegExpKey):
+ * runtime/SmallStrings.cpp:
+ (JSC::SmallStringsStorage::rep):
+ (JSC::SmallStrings::singleCharacterStringRep):
+ * runtime/SmallStrings.h:
+ * runtime/StringPrototype.cpp:
+ (JSC::jsSpliceSubstringsWithSeparators):
+ (JSC::stringProtoFuncMatch):
+ (JSC::stringProtoFuncSearch):
+ * runtime/Structure.cpp:
+ (JSC::Structure::~Structure):
+ (JSC::Structure::despecifyDictionaryFunction):
+ (JSC::Structure::addPropertyTransitionToExistingStructure):
+ (JSC::Structure::addPropertyTransition):
+ (JSC::Structure::copyPropertyTable):
+ (JSC::Structure::get):
+ (JSC::Structure::despecifyFunction):
+ (JSC::Structure::put):
+ (JSC::Structure::hasTransition):
+ (JSC::Structure::remove):
+ (JSC::Structure::checkConsistency):
+ * runtime/Structure.h:
+ (JSC::Structure::get):
+ (JSC::Structure::hasTransition):
+ * runtime/StructureTransitionTable.h:
+ * runtime/SymbolTable.h:
+ * runtime/UString.cpp:
+ (JSC::UString::UString):
+ (JSC::UString::toStrictUInt32):
+ (JSC::UString::substr):
+ * runtime/UString.h:
+ (JSC::UString::UString):
+ (JSC::UString::adopt):
+ (JSC::UString::data):
+ (JSC::UString::size):
+ (JSC::UString::isNull):
+ (JSC::UString::isEmpty):
+ (JSC::UString::impl):
+ (JSC::UString::cost):
+ (JSC::operator==):
+ (JSC::codePointCompare):
+ (JSC::IdentifierRepHash::hash):
+ (WTF::):
+
+2010-08-10 Gavin Barraclough <barraclough@apple.com>
+
+ Bug 43816 - Remove UStringImpl
+ The class was actually removed a long time ago, replaced by StringImpl.
+ UStringImpl is just a typedef onto StringImpl. Remove this.
+
+ * API/JSClassRef.cpp:
+ (OpaqueJSClass::OpaqueJSClass):
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * runtime/JSString.cpp:
+ (JSC::JSString::resolveRope):
+ (JSC::JSString::replaceCharacter):
+ * runtime/JSString.h:
+ (JSC::RopeBuilder::RopeIterator::operator*):
+ (JSC::RopeBuilder::JSString):
+ (JSC::RopeBuilder::appendStringInConstruct):
+ (JSC::RopeBuilder::appendValueInConstructAndIncrementLength):
+ (JSC::jsSingleCharacterSubstring):
+ (JSC::jsSubstring):
+ * runtime/JSStringBuilder.h:
+ (JSC::jsMakeNontrivialString):
+ * runtime/RopeImpl.cpp:
+ (JSC::RopeImpl::derefFibersNonRecursive):
+ * runtime/RopeImpl.h:
+ (JSC::RopeImpl::deref):
+ * runtime/SmallStrings.cpp:
+ (JSC::SmallStringsStorage::SmallStringsStorage):
+ * runtime/StringConstructor.cpp:
+ (JSC::stringFromCharCodeSlowCase):
+ * runtime/StringPrototype.cpp:
+ (JSC::jsSpliceSubstringsWithSeparators):
+ (JSC::stringProtoFuncFontsize):
+ (JSC::stringProtoFuncLink):
+ * runtime/UString.cpp:
+ (JSC::initializeUString):
+ * runtime/UString.h:
+ (JSC::UString::adopt):
+ (JSC::tryMakeString):
+ (JSC::makeString):
+ * runtime/UStringImpl.h: Removed.
+
+2010-08-10 Patrick Gansterer <paroga@paroga.com>
+
+ Reviewed by Eric Seidel.
+
+ Make FastMalloc more portable.
+ https://bugs.webkit.org/show_bug.cgi?id=41790
+
+ * wtf/FastMalloc.cpp:
+ (WTF::TCMalloc_Central_FreeList::Populate):
+ (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary):
+
+2010-08-10 Patrick Gansterer <paroga@paroga.com>
+
+ Reviewed by David Levin.
+
+ [WINCE] Buildfix for CE 6.0
+ https://bugs.webkit.org/show_bug.cgi?id=43027
+
+ CE 6.0 doesn't define localtime in the system include files.
+
+ * wtf/Platform.h: Include ce_time.h on all OS(WINCE).
+
+2010-08-10 Gavin Barraclough <barraclough@apple.com>
+
+ Rubber stamped by Sam Weinig.
+
+ Bug 43786 - Move AtomicStringHash from WebCore to WTF
+ Also remove deprecated string headers from WebCore/platform/text.
+
+ * GNUmakefile.am:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * wtf/text/AtomicString.h:
+ * wtf/text/AtomicStringHash.h: Copied from WebCore/platform/text/AtomicStringHash.h.
+
+2010-08-09 Oliver Hunt <oliver@apple.com>
+
+ Fix Qt/ARM again, this time including the other changed file.
+
+ * jit/JIT.h:
+
+2010-08-09 Oliver Hunt <oliver@apple.com>
+
+ Fix Qt/ARM
+
+ C++ overload resolution I stab at thee
+
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::beginUninterruptedSequence):
+ (JSC::JIT::endUninterruptedSequence):
+
+2010-08-09 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Allow an assembler/macroassembler to compact branches to more concise forms when linking
+ https://bugs.webkit.org/show_bug.cgi?id=43745
+
+ This patch makes it possible for an assembler to convert jumps into a different
+ (presumably more efficient) form at link time. Currently implemented in the
+ ARMv7 JIT as that already had logic to delay linking of jumps until the end of
+ compilation already. The ARMv7 JIT chooses between either a 4 byte short jump
+ or a full 32-bit offset (and rewrites ITTT instructions as appropriate), so does
+ not yet produce the most compact form possible. The general design of the linker
+ should make it relatively simple to introduce new branch types with little effort,
+ as the linker has no knowledge of the exact form of any of the branches.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * assembler/ARMv7Assembler.cpp: Added.
+ (JSC::):
+ Record jump sizes
+
+ * assembler/ARMv7Assembler.h:
+ (JSC::ARMv7Assembler::LinkRecord::LinkRecord):
+ (JSC::ARMv7Assembler::LinkRecord::from):
+ (JSC::ARMv7Assembler::LinkRecord::setFrom):
+ (JSC::ARMv7Assembler::LinkRecord::to):
+ (JSC::ARMv7Assembler::LinkRecord::type):
+ (JSC::ARMv7Assembler::LinkRecord::linkType):
+ (JSC::ARMv7Assembler::LinkRecord::setLinkType):
+ Encapsulate LinkRecord fields so we can compress the values somewhat
+
+ (JSC::ARMv7Assembler::JmpSrc::JmpSrc):
+ Need to record the jump type now
+
+ (JSC::ARMv7Assembler::b):
+ (JSC::ARMv7Assembler::blx):
+ (JSC::ARMv7Assembler::bx):
+ Need to pass the jump types
+
+ (JSC::ARMv7Assembler::executableOffsetFor):
+ (JSC::ARMv7Assembler::jumpSizeDelta):
+ (JSC::ARMv7Assembler::linkRecordSourceComparator):
+ (JSC::ARMv7Assembler::computeJumpType):
+ (JSC::ARMv7Assembler::convertJumpTo):
+ (JSC::ARMv7Assembler::recordLinkOffsets):
+ (JSC::ARMv7Assembler::jumpsToLink):
+ (JSC::ARMv7Assembler::link):
+ (JSC::ARMv7Assembler::unlinkedCode):
+ Helper functions for the linker
+
+ (JSC::ARMv7Assembler::linkJump):
+ (JSC::ARMv7Assembler::canBeShortJump):
+ (JSC::ARMv7Assembler::linkLongJump):
+ (JSC::ARMv7Assembler::linkShortJump):
+ (JSC::ARMv7Assembler::linkJumpAbsolute):
+ Moving code around for the various jump linking functions
+
+ * assembler/AbstractMacroAssembler.h:
+ (JSC::AbstractMacroAssembler::beginUninterruptedSequence):
+ (JSC::AbstractMacroAssembler::endUninterruptedSequence):
+ We have to track uninterrupted sequences in any assembler that compacts
+ branches as that's not something we're allowed to do in such sequences.
+ AbstractMacroAssembler has a nop version of these functions as it makes the
+ code elsewhere nicer.
+
+ * assembler/LinkBuffer.h:
+ (JSC::LinkBuffer::LinkBuffer):
+ (JSC::LinkBuffer::link):
+ (JSC::LinkBuffer::patch):
+ (JSC::LinkBuffer::locationOf):
+ (JSC::LinkBuffer::locationOfNearCall):
+ (JSC::LinkBuffer::returnAddressOffset):
+ (JSC::LinkBuffer::trampolineAt):
+ Updated these functions to adjust for any changed offsets in the linked code
+
+ (JSC::LinkBuffer::applyOffset):
+ A helper function to deal with the now potentially moved labels
+
+ (JSC::LinkBuffer::linkCode):
+ The new and mighty linker function
+
+ * assembler/MacroAssemblerARMv7.h:
+ (JSC::MacroAssemblerARMv7::MacroAssemblerARMv7):
+ (JSC::MacroAssemblerARMv7::beginUninterruptedSequence):
+ (JSC::MacroAssemblerARMv7::endUninterruptedSequence):
+ (JSC::MacroAssemblerARMv7::jumpsToLink):
+ (JSC::MacroAssemblerARMv7::unlinkedCode):
+ (JSC::MacroAssemblerARMv7::computeJumpType):
+ (JSC::MacroAssemblerARMv7::convertJumpTo):
+ (JSC::MacroAssemblerARMv7::recordLinkOffsets):
+ (JSC::MacroAssemblerARMv7::jumpSizeDelta):
+ (JSC::MacroAssemblerARMv7::link):
+ (JSC::MacroAssemblerARMv7::jump):
+ (JSC::MacroAssemblerARMv7::branchMul32):
+ (JSC::MacroAssemblerARMv7::breakpoint):
+ (JSC::MacroAssemblerARMv7::nearCall):
+ (JSC::MacroAssemblerARMv7::call):
+ (JSC::MacroAssemblerARMv7::ret):
+ (JSC::MacroAssemblerARMv7::tailRecursiveCall):
+ (JSC::MacroAssemblerARMv7::executableOffsetFor):
+ (JSC::MacroAssemblerARMv7::inUninterruptedSequence):
+ (JSC::MacroAssemblerARMv7::makeJump):
+ (JSC::MacroAssemblerARMv7::makeBranch):
+ All branches need to pass on their type now
+
+ * jit/ExecutableAllocator.h:
+ (JSC::ExecutablePool::returnLastBytes):
+ We can't know ahead of time how much space will be necessary to
+ hold the linked code if we're compacting branches, this new
+ function allows us to return the unused bytes at the end of linking
+
+ * jit/JIT.cpp:
+ (JSC::JIT::JIT):
+ (JSC::JIT::privateCompile):
+ * jit/JIT.h:
+ (JSC::JIT::compile):
+ The JIT class now needs to take a linker offset so that recompilation
+ can generate the same jumps when using branch compaction.
+ * jit/JITArithmetic32_64.cpp:
+ (JSC::JIT::emitSlow_op_mod):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ * jit/JITOpcodes32_64.cpp:
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ (JSC::JIT::privateCompileCTINativeCall):
+ Update for new trampolineAt changes
+
+ * wtf/FastMalloc.cpp:
+ (WTF::TCMallocStats::):
+ * wtf/Platform.h:
+
+2010-08-09 Gavin Barraclough <barraclough@apple.com>
+
+ Qt build fix III.
+
+ * wtf/text/WTFString.h:
+
+2010-08-09 Gavin Barraclough <barraclough@apple.com>
+
+ Qt build fix.
+
+ * wtf/qt/StringQt.cpp:
+
+2010-08-06 Gavin Barraclough <barraclough@apple.com>
+
+ Rubber stamped by Sam Weinig
+
+ Bug 43594 - Add string forwards to Forward.h
+ This allows us to remove forward declarations for these classes from
+ WebCore/WebKit (a step in moving these class from WebCore:: to WTF::).
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * wtf/Forward.h:
+
+2010-08-07 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r64938.
+ http://trac.webkit.org/changeset/64938
+ https://bugs.webkit.org/show_bug.cgi?id=43685
+
+ Did not compile on several ports (Requested by abarth on
+ #webkit).
+
+ * Android.mk:
+ * CMakeLists.txt:
+ * GNUmakefile.am:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.pro:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * assembler/AbstractMacroAssembler.h:
+ * assembler/MacroAssembler.h:
+ * assembler/MacroAssemblerX86.h:
+ (JSC::MacroAssemblerX86::load32):
+ (JSC::MacroAssemblerX86::store32):
+ * assembler/X86Assembler.h:
+ (JSC::X86Assembler::movl_rm):
+ (JSC::X86Assembler::movl_mr):
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::markAggregate):
+ * bytecode/Instruction.h:
+ (JSC::PolymorphicAccessStructureList::PolymorphicStubInfo::):
+ (JSC::PolymorphicAccessStructureList::PolymorphicStubInfo::set):
+ (JSC::PolymorphicAccessStructureList::PolymorphicAccessStructureList):
+ * bytecode/StructureStubInfo.cpp:
+ (JSC::StructureStubInfo::deref):
+ * bytecode/StructureStubInfo.h:
+ (JSC::StructureStubInfo::initGetByIdProto):
+ (JSC::StructureStubInfo::initGetByIdChain):
+ (JSC::StructureStubInfo::):
+ * jit/JIT.h:
+ * jit/JITMarkObjects.cpp: Removed.
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::compileGetDirectOffset):
+ (JSC::JIT::testPrototype):
+ (JSC::JIT::privateCompilePutByIdTransition):
+ (JSC::JIT::privateCompileGetByIdProto):
+ (JSC::JIT::privateCompileGetByIdProtoList):
+ (JSC::JIT::privateCompileGetByIdChainList):
+ (JSC::JIT::privateCompileGetByIdChain):
+ * jit/JITPropertyAccess32_64.cpp:
+ (JSC::JIT::compileGetDirectOffset):
+ (JSC::JIT::testPrototype):
+ (JSC::JIT::privateCompilePutByIdTransition):
+ (JSC::JIT::privateCompileGetByIdProto):
+ (JSC::JIT::privateCompileGetByIdProtoList):
+ (JSC::JIT::privateCompileGetByIdChainList):
+ (JSC::JIT::privateCompileGetByIdChain):
+ * jit/JITStubs.cpp:
+ (JSC::setupPolymorphicProtoList):
+ * wtf/Platform.h:
+
+2010-08-07 Nathan Lawrence <nlawrence@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ The JIT code contains a number of direct references to GC'd objects.
+ When we have movable objects, these references will need to be
+ updated.
+
+ * Android.mk:
+ * CMakeLists.txt:
+ * GNUmakefile.am:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.pro:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * assembler/AbstractMacroAssembler.h:
+ (JSC::AbstractMacroAssembler::int32AtLocation):
+ (JSC::AbstractMacroAssembler::pointerAtLocation):
+ (JSC::AbstractMacroAssembler::jumpTarget):
+ * assembler/MacroAssembler.h:
+ (JSC::MacroAssembler::loadPtrWithPatch):
+ Normally, loadPtr will optimize when the register is eax. Since
+ the slightly smaller instruction changes the offsets, it messes up
+ our ability to repatch the code. We added this new instruction
+ that garuntees a constant size.
+ * assembler/MacroAssemblerX86.h:
+ (JSC::MacroAssemblerX86::load32WithPatch):
+ Changed load32 in the same way described above.
+ (JSC::MacroAssemblerX86::load32):
+ Moved the logic to optimize laod32 from movl_mr to load32
+ (JSC::MacroAssemblerX86::store32):
+ Moved the logic to optimize store32 from movl_rm to store32
+ * assembler/X86Assembler.h:
+ (JSC::X86Assembler::movl_rm):
+ (JSC::X86Assembler::movl_mr):
+ (JSC::X86Assembler::int32AtLocation):
+ (JSC::X86Assembler::pointerAtLocation):
+ (JSC::X86Assembler::jumpTarget):
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::markAggregate):
+ * bytecode/Instruction.h:
+ As described in StructureStubInfo.h, we needed to add additional
+ fields to both StructureStubInfo and
+ PolymorphicAccessStructureList so that we can determine the
+ structure of the JITed code at patch time.
+ (JSC::PolymorphicAccessStructureList::PolymorphicStubInfo::set):
+ (JSC::PolymorphicAccessStructureList::PolymorphicAccessStructureList):
+ * bytecode/StructureStubInfo.cpp:
+ (JSC::StructureStubInfo::markAggregate):
+ Added this function to mark the JITed code that correosponds to
+ this structure stub info.
+ * bytecode/StructureStubInfo.h:
+ (JSC::StructureStubInfo::initGetByIdProto):
+ (JSC::StructureStubInfo::initGetByIdChain):
+ (JSC::StructureStubInfo::):
+ * jit/JIT.h:
+ * jit/JITMarkObjects.cpp: Added.
+ (JSC::JIT::patchPrototypeStructureAddress):
+ (JSC::JIT::patchGetDirectOffset):
+ (JSC::JIT::markGetByIdProto):
+ (JSC::JIT::markGetByIdChain):
+ (JSC::JIT::markGetByIdProtoList):
+ (JSC::JIT::markPutByIdTransition):
+ (JSC::JIT::markGlobalObjectReference):
+ * jit/JITPropertyAccess.cpp:
+ Added asserts for the patch offsets.
+ (JSC::JIT::compileGetDirectOffset):
+ (JSC::JIT::testPrototype):
+ (JSC::JIT::privateCompilePutByIdTransition):
+ (JSC::JIT::privateCompileGetByIdProto):
+ (JSC::JIT::privateCompileGetByIdProtoList):
+ (JSC::JIT::privateCompileGetByIdChainList):
+ (JSC::JIT::privateCompileGetByIdChain):
+ * jit/JITPropertyAccess32_64.cpp:
+ (JSC::JIT::compileGetDirectOffset):
+ (JSC::JIT::testPrototype):
+ (JSC::JIT::privateCompilePutByIdTransition):
+ (JSC::JIT::privateCompileGetByIdProto):
+ (JSC::JIT::privateCompileGetByIdProtoList):
+ (JSC::JIT::privateCompileGetByIdChainList):
+ (JSC::JIT::privateCompileGetByIdChain):
+ * jit/JITStubs.cpp:
+ (JSC::setupPolymorphicProtoList):
+ * wtf/Platform.h:
+ Added ENABLE_MOVABLE_GC_OBJECTS flag
+
+2010-08-07 Michael Saboff <msaboff@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Revert JSArray to point to the beginning of the contained ArrayStorage
+ struct. This is described in
+ https://bugs.webkit.org/show_bug.cgi?id=43526.
+
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::emit_op_get_by_val):
+ (JSC::JIT::emit_op_put_by_val):
+ (JSC::JIT::privateCompilePatchGetArrayLength):
+ * jit/JITPropertyAccess32_64.cpp:
+ (JSC::JIT::emit_op_get_by_val):
+ (JSC::JIT::emit_op_put_by_val):
+ (JSC::JIT::privateCompilePatchGetArrayLength):
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::JSArray):
+ (JSC::JSArray::~JSArray):
+ (JSC::JSArray::getOwnPropertySlot):
+ (JSC::JSArray::getOwnPropertyDescriptor):
+ (JSC::JSArray::put):
+ (JSC::JSArray::putSlowCase):
+ (JSC::JSArray::deleteProperty):
+ (JSC::JSArray::getOwnPropertyNames):
+ (JSC::JSArray::getNewVectorLength):
+ (JSC::JSArray::increaseVectorLength):
+ (JSC::JSArray::increaseVectorPrefixLength):
+ (JSC::JSArray::setLength):
+ (JSC::JSArray::pop):
+ (JSC::JSArray::push):
+ (JSC::JSArray::shiftCount):
+ (JSC::JSArray::unshiftCount):
+ (JSC::JSArray::sortNumeric):
+ (JSC::JSArray::sort):
+ (JSC::JSArray::fillArgList):
+ (JSC::JSArray::copyToRegisters):
+ (JSC::JSArray::compactForSorting):
+ (JSC::JSArray::subclassData):
+ (JSC::JSArray::setSubclassData):
+ (JSC::JSArray::checkConsistency):
+ * runtime/JSArray.h:
+ (JSC::JSArray::length):
+ (JSC::JSArray::canGetIndex):
+ (JSC::JSArray::getIndex):
+ (JSC::JSArray::setIndex):
+ (JSC::JSArray::uncheckedSetIndex):
+ (JSC::JSArray::markChildrenDirect):
+
+2010-08-07 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Eric Seidel.
+
+ Add ENABLE(YARR) guard around JSGlobalData::m_regexAllocator
+ https://bugs.webkit.org/show_bug.cgi?id=43399
+
+ m_regexAllocator is used only by RegExp::compile which is guarded with ENABLE(YARR).
+
+ * runtime/JSGlobalData.h:
+
+2010-08-07 Patrick Roland Gansterer <paroga@paroga.com>
+
+ Reviewed by Eric Seidel.
+
+ [Qt] Enable JIT on WinCE
+ https://bugs.webkit.org/show_bug.cgi?id=43303
+
+ Add ExtraCompiler for generating GeneratedJITStubs_MSVC.asm.
+
+ * DerivedSources.pro:
+
+2010-08-07 Dan Bernstein <mitz@apple.com>
+
+ Reviewed by Anders Carlsson.
+
+ Created a separate SimpleFontData constructor exclusively for SVG fonts and moved the CTFontRef
+ from SimpleFontData to FontPlatformData.
+ https://bugs.webkit.org/show_bug.cgi?id=43674
+
+ * wtf/Platform.h: Moved definitions of WTF_USE_CORE_TEXT and WTF_USE_ATSUI here from WebCore/config.h.
+
+2010-08-07 Zoltan Herczeg <zherczeg@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ Bitmap.h has no default constructor
+ https://bugs.webkit.org/show_bug.cgi?id=43619
+
+ Without a constructor, the initial bits of the Bitmap class
+ are undefinied. If only a few, or zero bits are 0, the memory
+ area provided by AlignedMemoryAllocator can be easly exhausted.
+
+ Csaba Osztrogonác helped to find this bug.
+
+ * wtf/Bitmap.h:
+ (WTF::::Bitmap):
+
+2010-08-06 Rafael Antognolli <antognolli@profusion.mobi>
+
+ [EFL] Build fix.
+
+ * CMakeLists.txt: add runtime/CGHandle.cpp.
+
+2010-08-06 Jessie Berlin <jberlin@apple.com>
+
+ Roll out http://trac.webkit.org/changeset/64801, which broke the Safari Windows Build.
+ Unreviewed.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * wtf/Forward.h:
+
+2010-08-06 Jessie Berlin <jberlin@apple.com>
+
+ Windows Build Fix (continued). Unreviewed.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-08-06 Jessie Berlin <jberlin@apple.com>
+
+ Windows Build Fix. Unreviewed.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ Add GCHandle.h and GCHandle.cpp.
+
+2010-08-06 Nathan Lawrence <nlawrence@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ https://bugs.webkit.org/show_bug.cgi?id=43207
+
+ WeakGCPtr's should instead of directly pointing to the GC'd object
+ should be directed to an array of pointers that can be updated for
+ movable objects.
+
+ * Android.mk:
+ * GNUmakefile.am:
+ * JavaScriptCore.exp:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.pro:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * runtime/Collector.cpp:
+ (JSC::Heap::destroy):
+ (JSC::Heap::allocateBlock):
+ (JSC::Heap::freeBlock):
+ (JSC::Heap::updateWeakGCHandles):
+ (JSC::WeakGCHandlePool::update):
+ (JSC::Heap::addWeakGCHandle):
+ (JSC::Heap::markRoots):
+ * runtime/Collector.h:
+ (JSC::Heap::weakGCHandlePool):
+ * runtime/GCHandle.cpp: Added.
+ (JSC::WeakGCHandle::pool):
+ (JSC::WeakGCHandlePool::WeakGCHandlePool):
+ (JSC::WeakGCHandlePool::allocate):
+ (JSC::WeakGCHandlePool::free):
+ (JSC::WeakGCHandlePool::operator new):
+ * runtime/GCHandle.h: Added.
+ (JSC::WeakGCHandle::isValidPtr):
+ (JSC::WeakGCHandle::isPtr):
+ (JSC::WeakGCHandle::isNext):
+ (JSC::WeakGCHandle::invalidate):
+ (JSC::WeakGCHandle::get):
+ (JSC::WeakGCHandle::set):
+ (JSC::WeakGCHandle::getNextInFreeList):
+ (JSC::WeakGCHandle::setNextInFreeList):
+ (JSC::WeakGCHandlePool::isFull):
+ * runtime/WeakGCPtr.h:
+ (JSC::WeakGCPtr::WeakGCPtr):
+ (JSC::WeakGCPtr::~WeakGCPtr):
+ (JSC::WeakGCPtr::get):
+ (JSC::WeakGCPtr::clear):
+ (JSC::WeakGCPtr::assign):
+ (JSC::get):
+
+2010-08-06 Tor Arne Vestbø <tor.arne.vestbo@nokia.com>
+
+ Reviewed by Antonio Gomes.
+
+ [Qt] Fix warnings about difference in symbol visiblity on Mac OS X
+
+ * jsc.pro:
+
+2010-08-06 Zoltan Herczeg <zherczeg@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ Refactor identifier parsing in lexer
+ https://bugs.webkit.org/show_bug.cgi?id=41845
+
+ The code is refactored to avoid gotos. The new code
+ has the same performance as the old one.
+
+ SunSpider --parse-only: no change (from 34.0ms to 33.6ms)
+ SunSpider: no change (from 523.2ms to 523.5ms)
+
+ * parser/Lexer.cpp:
+ (JSC::Lexer::parseIdent):
+ (JSC::Lexer::lex):
+ * parser/Lexer.h:
+
+2010-08-06 Gabor Loki <loki@webkit.org>
+
+ Reviewed by Gavin Barraclough.
+
+ The ARM JIT does not support JSValue32_64 with RVCT
+ https://bugs.webkit.org/show_bug.cgi?id=43411
+
+ JSValue32_64 is enabled for RVCT by default.
+
+ * create_jit_stubs:
+ * jit/JITStubs.cpp:
+ (JSC::ctiTrampoline):
+ (JSC::ctiVMThrowTrampoline):
+ (JSC::ctiOpThrowNotCaught):
+ * wtf/Platform.h:
+
+2010-08-05 Chao-ying Fu <fu@mips.com>
+
+ Reviewed by Darin Adler.
+
+ Define WTF_USE_ARENA_ALLOC_ALIGNMENT_INTEGER for MIPS
+ https://bugs.webkit.org/show_bug.cgi?id=43514
+
+ MIPS needs to define WTF_USE_ARENA_ALLOC_ALIGNMENT_INTEGER, so that
+ RenderArena::allocate() can return 8-byte aligned memory to avoid
+ exceptions on sdc1/ldc1.
+
+ * wtf/Platform.h:
+
+2010-08-05 Gavin Barraclough <barraclough@apple.com>
+
+ Rubber stamped by Sam Weinig
+
+ Bug 43594 - Add string forwards to Forward.h
+ This allows us to remove forward declarations for these classes from
+ WebCore/WebKit (a step in moving these class from WebCore:: to WTF::).
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * wtf/Forward.h:
+
+2010-08-05 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Mark Rowe.
+
+ Fixed leak seen on buildbot.
+
+ * runtime/GCActivityCallbackCF.cpp:
+ (JSC::DefaultGCActivityCallback::DefaultGCActivityCallback):
+ (JSC::DefaultGCActivityCallback::~DefaultGCActivityCallback):
+ (JSC::DefaultGCActivityCallback::operator()): Make out timer a RetainPtr,
+ since anything less would be uncivilized.
+
+2010-08-05 Andy Estes <aestes@apple.com>
+
+ Reviewed by David Kilzer.
+
+ Rename iOS-related OS and PLATFORM macros.
+ https://bugs.webkit.org/show_bug.cgi?id=43493
+
+ Rename WTF_OS_IPHONE_OS to WTF_OS_IOS, WTF_PLATFORM_IPHONE to
+ WTF_PLATFORM_IOS, and WTF_PLATFORM_IPHONE_SIMULATOR to
+ WTF_PLATFORM_IOS_SIMULATOR.
+
+ * jit/ExecutableAllocator.h:
+ * jit/JITStubs.cpp:
+ * profiler/ProfilerServer.mm:
+ (-[ProfilerServer init]):
+ * wtf/FastMalloc.cpp:
+ (WTF::TCMallocStats::):
+ * wtf/Platform.h:
+ * wtf/unicode/icu/CollatorICU.cpp:
+ (WTF::Collator::userDefault):
+
+2010-08-05 Nathan Lawrence <nlawrence@apple.com>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=43464
+
+ Currently, the global object is being embedded in the JavaScriptCore
+ bytecode, however since the global object is the same for all opcodes
+ in a code block, we can have the global object just be a member of the
+ associated code block.
+
+ Additionally, I added an assert inside of emitOpcode that verifies
+ that the last generated opcode was of the correct length.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::CodeBlock):
+ (JSC::CodeBlock::derefStructures):
+ (JSC::CodeBlock::markAggregate):
+ * bytecode/CodeBlock.h:
+ (JSC::CodeBlock::globalObject):
+ (JSC::GlobalCodeBlock::GlobalCodeBlock):
+ (JSC::ProgramCodeBlock::ProgramCodeBlock):
+ (JSC::EvalCodeBlock::EvalCodeBlock):
+ (JSC::FunctionCodeBlock::FunctionCodeBlock):
+ * bytecode/Opcode.h:
+ (JSC::opcodeLength):
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::BytecodeGenerator):
+ (JSC::BytecodeGenerator::emitOpcode):
+ Added an assert to check that the last generated opcode is the
+ correct length.
+ (JSC::BytecodeGenerator::rewindBinaryOp):
+ Changed the last opcode to op_end since the length will no longer
+ be correct.
+ (JSC::BytecodeGenerator::rewindUnaryOp):
+ Changed the last opcode to op_end since the length will no longer
+ be correct.
+ (JSC::BytecodeGenerator::emitResolve):
+ (JSC::BytecodeGenerator::emitGetScopedVar):
+ (JSC::BytecodeGenerator::emitPutScopedVar):
+ (JSC::BytecodeGenerator::emitResolveWithBase):
+ * bytecompiler/BytecodeGenerator.h:
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::resolveGlobal):
+ (JSC::Interpreter::resolveGlobalDynamic):
+ (JSC::Interpreter::privateExecute):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_get_global_var):
+ (JSC::JIT::emit_op_put_global_var):
+ (JSC::JIT::emit_op_resolve_global):
+ (JSC::JIT::emitSlow_op_resolve_global):
+ (JSC::JIT::emit_op_resolve_global_dynamic):
+ (JSC::JIT::emitSlow_op_resolve_global_dynamic):
+ * jit/JITOpcodes32_64.cpp:
+ (JSC::JIT::emit_op_get_global_var):
+ (JSC::JIT::emit_op_put_global_var):
+ (JSC::JIT::emit_op_resolve_global):
+ (JSC::JIT::emitSlow_op_resolve_global):
+ * jit/JITStubs.cpp:
+ (JSC::cti_op_resolve_global):
+ * runtime/Executable.cpp:
+ (JSC::FunctionExecutable::compileForCallInternal):
+ (JSC::FunctionExecutable::compileForConstructInternal):
+ (JSC::FunctionExecutable::reparseExceptionInfo):
+
+2010-08-05 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Bug 43185 - Switch RegisterFile over to use PageAllocation
+
+ Remove platform-specific memory allocation code.
+
+ * interpreter/RegisterFile.cpp:
+ (JSC::RegisterFile::~RegisterFile):
+ (JSC::RegisterFile::releaseExcessCapacity):
+ * interpreter/RegisterFile.h:
+ (JSC::RegisterFile::RegisterFile):
+ (JSC::RegisterFile::grow):
+ (JSC::RegisterFile::checkAllocatedOkay):
+ * wtf/PageAllocation.cpp:
+ (WTF::PageAllocation::lastError):
+ * wtf/PageAllocation.h:
+ (WTF::PageAllocation::allocate):
+ (WTF::PageAllocation::allocateAt):
+ (WTF::PageAllocation::allocateAligned):
+ (WTF::PageAllocation::pageSize):
+ (WTF::PageAllocation::isPageAligned):
+ (WTF::PageAllocation::isPowerOfTwo):
+ * wtf/PageReservation.h:
+ (WTF::PageReservation::commit):
+ (WTF::PageReservation::decommit):
+ (WTF::PageReservation::reserve):
+ (WTF::PageReservation::reserveAt):
+
+2010-08-05 Michael Saboff <msaboff@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Fixed https://bugs.webkit.org/show_bug.cgi?id=43401 where array
+ content aren't properly initialized as part of unshift.
+
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::unshiftCount):
+
+2010-08-05 Jian Li <jianli@chromium.org>
+
+ Reviewed by David Levin.
+
+ Unify blob related feature defines to ENABLE(BLOB).
+ https://bugs.webkit.org/show_bug.cgi?id=43081
+
+ * Configurations/FeatureDefines.xcconfig:
+
+2010-08-05 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk>
+
+ Rubber-stamped by Xan Lopez.
+
+ Remove GHashTable left-overs. GHashTable is ref-counted, and is
+ correctly supported by GRefPtr.
+
+ * wtf/gobject/GOwnPtr.h:
+
+2010-08-05 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk>
+
+ Unreviewed.
+
+ Typo fix that makes distcheck happy.
+
+ * GNUmakefile.am:
+
+2010-08-03 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt and Beth Dakin.
+
+ https://bugs.webkit.org/show_bug.cgi?id=43461
+ Invalid NaN parsing
+
+ * wtf/dtoa.cpp: Turn off the dtoa feature that allows you to specify a
+ non-standard NaN representation, since our NaN encoding assumes that all
+ true NaNs have the standard bit pattern.
+
+ * API/JSValueRef.cpp:
+ (JSValueMakeNumber): Don't allow an API client to accidentally specify
+ a non-standard NaN either.
+
+2010-08-04 Gavin Barraclough <barraclough@apple.com>
+
+ Windows build fix part II.
+
+ * wtf/PageReservation.h:
+ (WTF::PageReservation::systemReserve):
+
+2010-08-04 Gavin Barraclough <barraclough@apple.com>
+
+ Windows build fix.
+
+ * wtf/PageReservation.h:
+ (WTF::PageReservation::systemReserve):
+
+2010-08-04 Gavin Barraclough <barraclough@apple.com>
+
+ Build fix - add new header to !Mac projects.
+
+ * GNUmakefile.am:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+
+2010-08-04 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Bug 43515 - Fix small design issues with PageAllocation, split out PageReservation.
+
+ The PageAllocation class has a number of issues:
+ * Changes in bug #43269 accidentally switched SYMBIAN over to use malloc/free to allocate
+ blocks of memory for the GC heap, instead of allocating RChunks. Revert this change in
+ behaviour.
+ * In order for PageAllocation to work correctly on WinCE we should be decommitting memory
+ before deallocating. In order to simplify understanding the expected state at deallocate,
+ split behaviour out into PageAllocation and PageReservation classes. Require that all
+ memory be decommitted before calling deallocate on a PageReservation, add asserts to
+ enforce this.
+ * add many missing asserts.
+ * inline more functions.
+ * remove ability to create sub-PageAllocations from an existing PageAllocations object -
+ this presented an interface that would allow sub regions to be deallocated, which would
+ not have provided expected behaviour.
+ * remove writable/executable arguments to commit, this value can be cached at the point
+ the memory is reserved.
+ * remove writable/executable arguments to allocateAligned, protection other than RW is not
+ supported.
+ * add missing checks for overflow & failed allocation to mmap path through allocateAligned.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * jit/ExecutableAllocator.cpp:
+ (JSC::ExecutableAllocator::intializePageSize):
+ * jit/ExecutableAllocator.h:
+ (JSC::ExecutablePool::Allocation::Allocation):
+ (JSC::ExecutablePool::Allocation::base):
+ (JSC::ExecutablePool::Allocation::size):
+ (JSC::ExecutablePool::Allocation::operator!):
+ * jit/ExecutableAllocatorFixedVMPool.cpp:
+ (JSC::FixedVMPoolAllocator::reuse):
+ (JSC::FixedVMPoolAllocator::coalesceFreeSpace):
+ (JSC::FixedVMPoolAllocator::FixedVMPoolAllocator):
+ (JSC::FixedVMPoolAllocator::alloc):
+ (JSC::FixedVMPoolAllocator::free):
+ (JSC::FixedVMPoolAllocator::allocInternal):
+ * runtime/AlignedMemoryAllocator.h:
+ (JSC::::allocate):
+ (JSC::::AlignedMemoryAllocator):
+ * runtime/Collector.cpp:
+ (JSC::Heap::allocateBlock):
+ * runtime/Collector.h:
+ * wtf/PageAllocation.cpp:
+ * wtf/PageAllocation.h:
+ (WTF::PageAllocation::operator!):
+ (WTF::PageAllocation::allocate):
+ (WTF::PageAllocation::allocateAt):
+ (WTF::PageAllocation::allocateAligned):
+ (WTF::PageAllocation::deallocate):
+ (WTF::PageAllocation::pageSize):
+ (WTF::PageAllocation::systemAllocate):
+ (WTF::PageAllocation::systemAllocateAt):
+ (WTF::PageAllocation::systemAllocateAligned):
+ (WTF::PageAllocation::systemDeallocate):
+ (WTF::PageAllocation::systemPageSize):
+ * wtf/PageReservation.h: Copied from JavaScriptCore/wtf/PageAllocation.h.
+ (WTF::PageReservation::PageReservation):
+ (WTF::PageReservation::commit):
+ (WTF::PageReservation::decommit):
+ (WTF::PageReservation::reserve):
+ (WTF::PageReservation::reserveAt):
+ (WTF::PageReservation::deallocate):
+ (WTF::PageReservation::systemCommit):
+ (WTF::PageReservation::systemDecommit):
+ (WTF::PageReservation::systemReserve):
+ (WTF::PageReservation::systemReserveAt):
+ * wtf/Platform.h:
+
+2010-08-04 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r64655.
+ http://trac.webkit.org/changeset/64655
+ https://bugs.webkit.org/show_bug.cgi?id=43496
+
+ JavaScriptCore references patch seems to have caused
+ regressions in QT and GTK builds (Requested by nlawrence on
+ #webkit).
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::markAggregate):
+ * runtime/Collector.cpp:
+ (JSC::Heap::markConservatively):
+ * runtime/JSCell.h:
+ (JSC::JSValue::asCell):
+ (JSC::MarkStack::append):
+ * runtime/JSGlobalObject.cpp:
+ (JSC::markIfNeeded):
+ * runtime/JSONObject.cpp:
+ (JSC::Stringifier::Holder::object):
+ * runtime/JSObject.h:
+ (JSC::JSObject::prototype):
+ * runtime/JSStaticScopeObject.cpp:
+ (JSC::JSStaticScopeObject::markChildren):
+ * runtime/JSValue.h:
+ (JSC::JSValue::):
+ (JSC::JSValue::JSValue):
+ (JSC::JSValue::asCell):
+ * runtime/MarkStack.h:
+ * runtime/NativeErrorConstructor.cpp:
+ * runtime/NativeErrorConstructor.h:
+ * runtime/Structure.h:
+ (JSC::Structure::storedPrototype):
+
+2010-08-04 Gavin Barraclough <barraclough@apple.com>
+
+ Rubber stamped by Sam Weinig.
+
+ Enable JSVALUE64 for CPU(PPC64).
+ Basic browsing seems to work.
+
+ * wtf/Platform.h:
+
+2010-08-04 Nathan Lawrence <nlawrence@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Refactoring MarkStack::append to take a reference. This is in
+ preparation for movable objects when we will need to update pointers.
+ http://bugs.webkit.org/show_bug.cgi?id=41177
+
+ Unless otherwise noted, all changes are to either return by reference
+ or pass a reference to MarkStack::append.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::markAggregate):
+ * runtime/Collector.cpp:
+ (JSC::Heap::markConservatively):
+ Added a temporary variable to prevent marking from changing an
+ unknown value on the stack
+ * runtime/JSCell.h:
+ (JSC::JSValue::asCell):
+ (JSC::MarkStack::append):
+ (JSC::MarkStack::appendInternal):
+ * runtime/JSGlobalObject.cpp:
+ (JSC::markIfNeeded):
+ * runtime/JSONObject.cpp:
+ (JSC::Stringifier::Holder::object):
+ * runtime/JSObject.h:
+ (JSC::JSObject::prototype):
+ * runtime/JSStaticScopeObject.cpp:
+ (JSC::JSStaticScopeObject::markChildren):
+ * runtime/JSValue.h:
+ (JSC::JSValue::JSValue):
+ (JSC::JSValue::asCell):
+ * runtime/MarkStack.h:
+ * runtime/NativeErrorConstructor.cpp:
+ (JSC::NativeErrorConstructor::createStructure):
+ Changed the structure flags to include a custom markChildren.
+ (JSC::NativeErrorConstructor::markChildren):
+ Update the prototype of the stored structure.
+ * runtime/NativeErrorConstructor.h:
+ Added structure flags.
+ * runtime/Structure.h:
+ (JSC::Structure::storedPrototype):
+
+2010-08-03 Nathan Lawrence <nlawrence@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Tightened up some get_by_id_chain* code generation
+ https://bugs.webkit.org/show_bug.cgi?id=40935
+
+ This is in the style of
+ https://bugs.webkit.org/show_bug.cgi?id=30539, and changed code to
+ call accessor functions when it was not necessary to directly access
+ the private variables.
+
+ * jit/JIT.h:
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::compileGetDirectOffset):
+ (JSC::JIT::testPrototype):
+ (JSC::JIT::privateCompilePutByIdTransition):
+ (JSC::JIT::privateCompileGetByIdChainList):
+ (JSC::JIT::privateCompileGetByIdChain):
+ * jit/JITPropertyAccess32_64.cpp:
+ (JSC::JIT::testPrototype):
+ (JSC::JIT::privateCompilePutByIdTransition):
+ (JSC::JIT::privateCompileGetByIdChainList):
+ (JSC::JIT::privateCompileGetByIdChain):
+
+2010-08-03 Adam Roben <aroben@apple.com>
+
+ Turn on PLATFORM_STRATEGIES on Windows
+
+ Fixes <http://webkit.org/b/43431>.
+
+ Reviewed by Anders Carlsson.
+
+ * wtf/Platform.h:
+
+2010-08-04 Gabor Loki <loki@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ Enable JSValue32_64 for GCC on ARM by default
+ https://bugs.webkit.org/show_bug.cgi?id=43410
+
+ * wtf/Platform.h:
+
+2010-08-03 Gavin Barraclough <barraclough@apple.com>
+
+ Speculative windows build fix.
+
+ * wtf/Bitmap.h:
+
+2010-08-03 Gavin Barraclough <barraclough@apple.com>
+
+ Build fix following r64624.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * wtf/PageAllocation.h:
+
+2010-08-03 Nathan Lawrence <nlawrence@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ https://bugs.webkit.org/show_bug.cgi?id=43269
+
+ Added new allocateAligned methods to PageAllocation. In order to
+ prevent a regress in performance, the function needs to be inlined.
+
+ Additionally, I ported the symbian block allocator to use
+ PageAllocation and added a new WTF::Bitmap class to support this.
+
+ * GNUmakefile.am:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * runtime/AlignedMemoryAllocator.h: Added.
+ (JSC::AlignedMemory::deallocate):
+ (JSC::AlignedMemory::base):
+ (JSC::AlignedMemory::AlignedMemory):
+ (JSC::AlignedMemoryAllocator::destroy):
+ (JSC::AlignedMemoryAllocator::allocate):
+ (JSC::AlignedMemoryAllocator::AlignedMemoryAllocator):
+ (JSC::AlignedMemoryAllocator::~AlignedMemoryAllocator):
+ (JSC::AlignedMemoryAllocator::free):
+ * runtime/Collector.cpp:
+ (JSC::Heap::Heap):
+ (JSC::Heap::destroy):
+ (JSC::Heap::allocateBlock):
+ (JSC::Heap::freeBlock):
+ (JSC::Heap::freeBlocks):
+ (JSC::Heap::allocate):
+ (JSC::Heap::shrinkBlocks):
+ (JSC::Heap::markConservatively):
+ (JSC::Heap::clearMarkBits):
+ (JSC::Heap::markedCells):
+ * runtime/Collector.h:
+ (JSC::CollectorHeap::collectorBlock):
+ * runtime/CollectorHeapIterator.h:
+ (JSC::CollectorHeapIterator::operator*):
+ (JSC::LiveObjectIterator::operator++):
+ (JSC::DeadObjectIterator::operator++):
+ * wtf/Bitmap.h: Added.
+ (WTF::Bitmap::get):
+ (WTF::Bitmap::set):
+ (WTF::Bitmap::clear):
+ (WTF::Bitmap::clearAll):
+ (WTF::Bitmap::advanceToNextFreeBit):
+ (WTF::Bitmap::count):
+ (WTF::Bitmap::isEmpty):
+ (WTF::Bitmap::isFull):
+ * wtf/PageAllocation.h:
+ (WTF::PageAllocation::operator UnspecifiedBoolType):
+ (WTF::PageAllocation::allocateAligned):
+ (WTF::PageAllocation::reserveAligned):
+ * wtf/Platform.h:
+ * wtf/symbian: Removed.
+ * wtf/symbian/BlockAllocatorSymbian.cpp: Removed.
+ * wtf/symbian/BlockAllocatorSymbian.h: Removed.
+
+2010-08-03 Michael Saboff <msaboff@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Fix for https://bugs.webkit.org/show_bug.cgi?id=43314. The prior code
+ was using the wrong "length" value to move array contents when adding
+ space to the beginning of an array for an unshift() or similar
+ operation. Instead of using m_vectorLength, the length of the
+ allocated JSValue array, the code was using m_length, the declared
+ length of the array. These two values do not need to match.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::increaseVectorPrefixLength):
+
+2010-08-03 Chao-ying Fu <fu@mips.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Fix following https://bugs.webkit.org/show_bug.cgi?id=43089
+ (accidentally inverted a compiler version check).
+
+ * jit/ExecutableAllocator.h:
+ (JSC::ExecutableAllocator::cacheFlush):
+
+2010-08-03 Patrick Gansterer <paroga@paroga.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Implement DEFINE_STUB_FUNCTION for WinCE.
+ https://bugs.webkit.org/show_bug.cgi?id=34953
+
+ * jit/JITStubs.cpp:
+ (JSC::):
+ (JSC::DEFINE_STUB_FUNCTION):
+
+2010-08-02 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 43390 - Do not CRASH if we run out of room for jit code.
+
+ Change the ExecutableAllocator implementations not to crash, and to return 0 if memory cannot be allocated.
+ The assemblers should pass this through without trying to use it in executableCopy.
+ Change the LinkBuffer to handle this, and to provide an allocationSuccessful() method to test for this.
+
+ Change the JIT to throw an exception if allocation fails.
+ Make JIT optimizations fail gracefully if memory cannot be allocated (use non-optimized path).
+ Change YARR JIT to fallback to PCRE
+
+ * assembler/ARMAssembler.cpp:
+ (JSC::ARMAssembler::executableCopy):
+ * assembler/ARMv7Assembler.h:
+ (JSC::ARMv7Assembler::executableCopy):
+ * assembler/LinkBuffer.h:
+ (JSC::LinkBuffer::allocationSuccessful):
+ * assembler/MIPSAssembler.h:
+ (JSC::MIPSAssembler::executableCopy):
+ * assembler/X86Assembler.h:
+ (JSC::X86Assembler::executableCopy):
+ * bytecode/StructureStubInfo.h:
+ (JSC::StructureStubInfo::initGetByIdProto):
+ (JSC::StructureStubInfo::initGetByIdChain):
+ (JSC::StructureStubInfo::initGetByIdSelfList):
+ (JSC::StructureStubInfo::initGetByIdProtoList):
+ (JSC::StructureStubInfo::initPutByIdTransition):
+ * jit/ExecutableAllocator.cpp:
+ (JSC::ExecutablePool::systemAlloc):
+ * jit/ExecutableAllocatorFixedVMPool.cpp:
+ (JSC::FixedVMPoolAllocator::allocInternal):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompile):
+ * jit/JIT.h:
+ (JSC::JIT::compileGetByIdProto):
+ (JSC::JIT::compileGetByIdSelfList):
+ (JSC::JIT::compileGetByIdProtoList):
+ (JSC::JIT::compileGetByIdChainList):
+ (JSC::JIT::compileGetByIdChain):
+ (JSC::JIT::compilePutByIdTransition):
+ (JSC::JIT::compilePatchGetArrayLength):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ * jit/JITOpcodes32_64.cpp:
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ (JSC::JIT::privateCompileCTINativeCall):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::stringGetByValStubGenerator):
+ (JSC::JIT::privateCompilePutByIdTransition):
+ (JSC::JIT::privateCompilePatchGetArrayLength):
+ (JSC::JIT::privateCompileGetByIdProto):
+ (JSC::JIT::privateCompileGetByIdSelfList):
+ (JSC::JIT::privateCompileGetByIdProtoList):
+ (JSC::JIT::privateCompileGetByIdChainList):
+ (JSC::JIT::privateCompileGetByIdChain):
+ * jit/JITPropertyAccess32_64.cpp:
+ (JSC::JIT::stringGetByValStubGenerator):
+ (JSC::JIT::privateCompilePutByIdTransition):
+ (JSC::JIT::privateCompilePatchGetArrayLength):
+ (JSC::JIT::privateCompileGetByIdProto):
+ (JSC::JIT::privateCompileGetByIdSelfList):
+ (JSC::JIT::privateCompileGetByIdProtoList):
+ (JSC::JIT::privateCompileGetByIdChainList):
+ (JSC::JIT::privateCompileGetByIdChain):
+ * jit/JITStubs.cpp:
+ (JSC::JITThunks::tryCachePutByID):
+ (JSC::JITThunks::tryCacheGetByID):
+ (JSC::DEFINE_STUB_FUNCTION):
+ (JSC::setupPolymorphicProtoList):
+ * jit/JITStubs.h:
+ * jit/SpecializedThunkJIT.h:
+ (JSC::SpecializedThunkJIT::finalize):
+ * runtime/ExceptionHelpers.cpp:
+ (JSC::createOutOfMemoryError):
+ * runtime/ExceptionHelpers.h:
+ * runtime/Executable.cpp:
+ (JSC::EvalExecutable::compileInternal):
+ (JSC::ProgramExecutable::compileInternal):
+ (JSC::FunctionExecutable::compileForCallInternal):
+ (JSC::FunctionExecutable::compileForConstructInternal):
+ (JSC::FunctionExecutable::reparseExceptionInfo):
+ (JSC::EvalExecutable::reparseExceptionInfo):
+ * yarr/RegexJIT.cpp:
+ (JSC::Yarr::RegexGenerator::compile):
+
+2010-08-03 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Fixed a crash seen on the GTK 64bit buildbot.
+
+ When JSArray is allocated for the vptr stealing hack, it's not allocated
+ in the heap, so the JSArray constructor can't safely call Heap::heap().
+
+ Since this was subtle enough to confuse smart people, I've changed JSArray
+ to have an explicit vptr stealing constructor.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::JSArray):
+ * runtime/JSArray.h:
+ (JSC::JSArray::):
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::storeVPtrs):
+
+2010-08-03 Alex Milowski <alex@milowski.com>
+
+ Reviewed by Beth Dakin.
+
+ Changed the ENABLE_MATHML value to enable MathML by default.
+
+ * Configurations/FeatureDefines.xcconfig:
+
+2010-08-03 Michael Saboff <msaboff@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Change to keep returned pointer from malloc family functions to
+ quiet memory leak detect. The pointer is saved in the new m_allocBase
+ member of the ArrayStorage structure. This fixes the issue found in
+ https://bugs.webkit.org/show_bug.cgi?id=43229.
+
+ As part of this change, we use m_allocBase when reallocating and
+ freeing the memory associated with ArrayStorage.
+
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::JSArray):
+ (JSC::JSArray::~JSArray):
+ (JSC::JSArray::putSlowCase):
+ (JSC::JSArray::increaseVectorLength):
+ (JSC::JSArray::increaseVectorPrefixLength):
+ * runtime/JSArray.h:
+
+2010-08-03 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Mark Rowe.
+
+ https://bugs.webkit.org/show_bug.cgi?id=43444
+ PLATFORM(CF) is false on Windows in JavaScriptCore
+
+ Moved some PLATFORM(WIN) #defines down into JavaScriptCore.
+
+ * wtf/Platform.h: Added WTF_PLATFORM_CF 1 and WTF_USE_PTHREADS 0, inherited
+ from WebCore/config.h. Removed WTF_USE_WININET 1 since WebCore/config.h
+ just #undefined that later.
+
+2010-08-03 Geoffrey Garen <ggaren@apple.com>
+
+ Try to fix Windows build: Don't use GCActivityCallbackCF on Windows, since
+ PLATFORM(CF) is not defined on Windows.
+
+ We'll need to enable the GC activity callback some other way, but this
+ change should get the build back to normal.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+
+ * runtime/GCActivityCallbackCF.cpp: Make it easier to detect this error
+ in the future with an explicit error message.
+
+2010-08-03 Geoffrey Garen <ggaren@apple.com>
+
+ Try to fix Windows build: update .def file.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-08-03 Nathan Lawrence <nlawrence@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ https://bugs.webkit.org/show_bug.cgi?id=41318
+ GC should reclaim garbage even when new objects are not being allocated rapidly
+
+ Added a callback in JavaScriptCore that gets triggered after an
+ allocation causes the heap to reset. This is useful for adding a
+ timer that will trigger garbage collection after the "last" allocation.
+
+ Also needed was to add lock and unlock methods to JSLock that needed
+ only a JSGlobalData object versus an ExecState object.
+
+ * CMakeLists.txt:
+ * GNUmakefile.am:
+ * JavaScriptCore.exp:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.pro:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::emit_op_put_by_val):
+ * runtime/Collector.cpp:
+ (JSC::Heap::Heap):
+ (JSC::Heap::reset):
+ (JSC::Heap::setActivityCallback):
+ * runtime/Collector.h:
+ * runtime/GCActivityCallback.cpp: Added.
+ (JSC::DefaultGCActivityCallback::DefaultGCActivityCallback):
+ (JSC::DefaultGCActivityCallback::~DefaultGCActivityCallback):
+ (JSC::DefaultGCActivityCallback::operator()):
+ * runtime/GCActivityCallback.h: Added.
+ (JSC::GCActivityCallback::~GCActivityCallback):
+ (JSC::GCActivityCallback::operator()):
+ (JSC::GCActivityCallback::GCActivityCallback):
+ (JSC::DefaultGCActivityCallback::create):
+ * runtime/GCActivityCallbackCF.cpp: Added.
+ (JSC::DefaultGCActivityCallbackPlatformData::trigger):
+ (JSC::DefaultGCActivityCallback::DefaultGCActivityCallback):
+ (JSC::DefaultGCActivityCallback::~DefaultGCActivityCallback):
+ (JSC::DefaultGCActivityCallback::operator()):
+ * runtime/JSLock.cpp:
+ (JSC::JSLock::JSLock):
+ * runtime/JSLock.h:
+
+2010-08-02 Kevin Ollivier <kevino@theolliviers.com>
+
+ [wx] Build fix after removal of need to compile ExecutableAllocatorPosix.cpp
+
+ * wscript:
+
+2010-08-02 Mahesh Kulkarni <mahesh.kulkarni@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ [QT] build fix for symbian
+ https://bugs.webkit.org/show_bug.cgi?id=43234
+
+ 1) wrong order of passing param's
+ 2) static_cast complains on symbian so using reinterpret_cast
+
+ No new tests added. Just a build fix for qt symbian
+
+ * wtf/PageAllocation.cpp:
+ (WTF::PageAllocation::commit):
+ (WTF::PageAllocation::decommit):
+ (WTF::PageAllocation::reserve):
+
+2010-07-30 Luiz Agostini <luiz.agostini@openbossa.org>
+
+ Reviewed by Simon Fraser.
+
+ Enabling view modes to all platforms
+ https://bugs.webkit.org/show_bug.cgi?id=37505
+
+ Removing ENABLE_WIDGETS_10_SUPPORT flag.
+
+ As view mode media feature is not part of widget 1.0 specification
+ any more the ENABLE_WIDGETS_10_SUPPORT flag may be removed. The only use
+ of this flag was related to view mode media feature implementation in Qt.
+
+ * wtf/Platform.h:
+
+2010-07-30 Andy Estes <aestes@apple.com>
+
+ Reviewed by David Kilzer.
+
+ Add Xcode support for compiling WebKit against iOS SDKs.
+ https://bugs.webkit.org/show_bug.cgi?id=42796
+
+ * Configurations/Base.xcconfig:
+ * Configurations/DebugRelease.xcconfig:
+ * Configurations/FeatureDefines.xcconfig:
+
+2010-07-30 Dumitru Daniliuc <dumi@chromium.org>
+
+ Reviewed by Davin Levin.
+
+ Added a yield() function.
+ https://bugs.webkit.org/show_bug.cgi?id=42843
+
+ * JavaScriptCore.exp:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * wtf/Threading.h:
+ * wtf/ThreadingPthreads.cpp:
+ (WTF::yield):
+ * wtf/ThreadingWin.cpp:
+ (WTF::yield):
+ * wtf/gtk/ThreadingGtk.cpp:
+ (WTF::yield):
+ * wtf/qt/ThreadingQt.cpp:
+ (WTF::yield):
+
+2010-07-30 Rafael Antognolli <antognolli@profusion.mobi>
+
+ Reviewed by Antonio Gomes.
+
+ [EFL] Add library version and soname to EFL generated libraries and binary.
+ https://bugs.webkit.org/show_bug.cgi?id=43212
+
+ Add version and soname to libjavascriptcore.so and libwtf.so in case of
+ linking as shared libraries, and version to jsc executable.
+
+ * CMakeLists.txt:
+ * jsc/CMakeLists.txt:
+ * wtf/CMakeLists.txt:
+
+2010-07-30 Mahesh Kulkarni <mahesh.kulkarni@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ [QT] build fix for symbian
+ https://bugs.webkit.org/show_bug.cgi?id=43234
+
+ * wtf/PageAllocation.h:
+ (WTF::PageAllocation::PageAllocation):
+
+2010-07-29 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r64313.
+ http://trac.webkit.org/changeset/64313
+ https://bugs.webkit.org/show_bug.cgi?id=43233
+
+ Some Chromium bots are not happy with it for some unknown
+ reason. (Requested by dumi on #webkit).
+
+ * JavaScriptCore.exp:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * wtf/Threading.h:
+ * wtf/ThreadingPthreads.cpp:
+ * wtf/ThreadingWin.cpp:
+ * wtf/gtk/ThreadingGtk.cpp:
+ * wtf/qt/ThreadingQt.cpp:
+
+2010-07-29 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r64302.
+ http://trac.webkit.org/changeset/64302
+ https://bugs.webkit.org/show_bug.cgi?id=43223
+
+ Assertion is bogus (Requested by olliej on #webkit).
+
+ * assembler/ARMAssembler.cpp:
+ (JSC::ARMAssembler::executableCopy):
+ * assembler/AssemblerBuffer.h:
+ (JSC::AssemblerBuffer::putShortUnchecked):
+ (JSC::AssemblerBuffer::putIntUnchecked):
+ (JSC::AssemblerBuffer::putInt64Unchecked):
+ * jit/JITStubs.cpp:
+ * pcre/pcre_compile.cpp:
+ (jsRegExpCompile):
+ * wtf/FastMalloc.cpp:
+ (WTF::PageHeapAllocator::New):
+ (WTF::TCMalloc_Central_FreeList::Populate):
+ * wtf/MD5.cpp:
+ (WTF::reverseBytes):
+ (WTF::MD5::addBytes):
+ (WTF::MD5::checksum):
+ * wtf/StdLibExtras.h:
+ * wtf/Vector.h:
+ (WTF::VectorBuffer::inlineBuffer):
+ * wtf/qt/StringQt.cpp:
+ (WebCore::String::String):
+
+2010-07-29 Michael Saboff <msaboff@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Changed the handling for removing and adding elements at the front
+ of an array. The code now keeps a bias that indicates the amount of
+ JSValue sized holes are prior to the ArrayStorage block. This means
+ that shift operations are now memmove's of the header part of
+ the ArrayStorage and unshift operations are similar, but may require a
+ realloc first to create the space. Similar operations are performed
+ for special cases of splice and slice.
+ Also optimized the new Array(size) case so that we don't allocate and
+ initialize array elements until the JS code starts using elements.
+ The array growth code is slightly more aggressive for initial growth
+ based on size growth of any previous array.
+
+ * Configurations/JavaScriptCore.xcconfig:
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::emit_op_get_by_val):
+ (JSC::JIT::emit_op_put_by_val):
+ (JSC::JIT::privateCompilePatchGetArrayLength):
+ * jit/JITPropertyAccess32_64.cpp:
+ (JSC::JIT::emit_op_get_by_val):
+ (JSC::JIT::emit_op_put_by_val):
+ (JSC::JIT::privateCompilePatchGetArrayLength):
+ * runtime/ArrayPrototype.cpp:
+ (JSC::arrayProtoFuncShift):
+ (JSC::arrayProtoFuncSplice):
+ (JSC::arrayProtoFuncUnShift):
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::JSArray):
+ (JSC::JSArray::~JSArray):
+ (JSC::JSArray::getOwnPropertySlot):
+ (JSC::JSArray::getOwnPropertyDescriptor):
+ (JSC::JSArray::put):
+ (JSC::JSArray::putSlowCase):
+ (JSC::JSArray::deleteProperty):
+ (JSC::JSArray::getOwnPropertyNames):
+ (JSC::JSArray::getNewVectorLength):
+ (JSC::JSArray::increaseVectorLength):
+ (JSC::JSArray::increaseVectorPrefixLength):
+ (JSC::JSArray::setLength):
+ (JSC::JSArray::pop):
+ (JSC::JSArray::push):
+ (JSC::JSArray::shiftCount):
+ (JSC::JSArray::unshiftCount):
+ (JSC::JSArray::sortNumeric):
+ (JSC::JSArray::sort):
+ (JSC::JSArray::fillArgList):
+ (JSC::JSArray::copyToRegisters):
+ (JSC::JSArray::compactForSorting):
+ (JSC::JSArray::subclassData):
+ (JSC::JSArray::setSubclassData):
+ (JSC::JSArray::checkConsistency):
+ * runtime/JSArray.h:
+ (JSC::JSArray::length):
+ (JSC::JSArray::canGetIndex):
+ (JSC::JSArray::getIndex):
+ (JSC::JSArray::setIndex):
+ (JSC::JSArray::uncheckedSetIndex):
+ (JSC::JSArray::arrayStorage):
+ (JSC::JSArray::setArrayStorage):
+ (JSC::JSArray::markChildrenDirect):
+
+2010-07-29 Michael Saboff <msaboff@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Changed MINIMUM_CELL_SIZE to be fixed at 64 bytes.
+
+ * runtime/Collector.h:
+
+2010-07-28 Dumitru Daniliuc <dumi@chromium.org>
+
+ Reviewed by David Levin.
+
+ Added a yield() function.
+ https://bugs.webkit.org/show_bug.cgi?id=42843
+
+ * JavaScriptCore.exp:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * wtf/Threading.h:
+ * wtf/ThreadingPthreads.cpp:
+ (WTF::yield):
+ * wtf/ThreadingWin.cpp:
+ (WTF::yield):
+ * wtf/gtk/ThreadingGtk.cpp:
+ (WTF::yield):
+ * wtf/qt/ThreadingQt.cpp:
+ (WTF::yield):
+
+2010-07-29 Michael Saboff <msaboff@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Fixed issue where RegExp greedy jit code loops when no input is
+ consumed. Changed the code to only loop if some input was consumed,
+ but fall through if we successfully match an alternative that
+ doesn't consume any input.
+ https://bugs.webkit.org/show_bug.cgi?id=42664
+
+ * yarr/RegexJIT.cpp:
+ (JSC::Yarr::RegexGenerator::generateParenthesesGreedyNoBacktrack):
+
+2010-07-29 Gabor Loki <loki@webkit.org>
+
+ Reviewed by Gavin Barraclough.
+
+ Avoid increasing required alignment of target type warning on ARM
+ https://bugs.webkit.org/show_bug.cgi?id=38045
+
+ The reinterpret_cast<Type1*>([pointer to Type2]) expressions - where
+ sizeof(Type1) > sizeof(Type2) - cause the following warning on ARM:
+ increases required alignment of target type warnings.
+ Casting the type of [pointer to Type2] object to void* bypasses the
+ warning.
+
+ * assembler/ARMAssembler.cpp:
+ (JSC::ARMAssembler::executableCopy):
+ * assembler/AssemblerBuffer.h:
+ (JSC::AssemblerBuffer::putShortUnchecked):
+ (JSC::AssemblerBuffer::putIntUnchecked):
+ (JSC::AssemblerBuffer::putInt64Unchecked):
+ * jit/JITStubs.cpp:
+ * pcre/pcre_compile.cpp:
+ (jsRegExpCompile):
+ * wtf/FastMalloc.cpp:
+ (WTF::PageHeapAllocator::New):
+ (WTF::TCMalloc_Central_FreeList::Populate):
+ * wtf/MD5.cpp:
+ (WTF::reverseBytes):
+ (WTF::MD5::addBytes):
+ (WTF::MD5::checksum):
+ * wtf/StdLibExtras.h:
+ (reinterpret_cast_ptr):
+ * wtf/Vector.h:
+ (WTF::VectorBuffer::inlineBuffer):
+ * wtf/qt/StringQt.cpp:
+ (WebCore::String::String):
+
+2010-07-29 Martin Robinson <mrobinson@igalia.com>
+
+ Unreviewed build fix.
+
+ Include a missing header in the source list to fix 'make dist.'
+
+ * GNUmakefile.am: Include missing header.
+
+2010-07-28 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Bug 43162 - Add support for MADV_FREE to PageAllocation.
+
+ * wtf/PageAllocation.cpp:
+ (WTF::PageAllocation::commit):
+ (WTF::PageAllocation::decommit):
+
+2010-07-27 Kinuko Yasuda <kinuko@chromium.org>
+
+ Reviewed by Ojan Vafai.
+
+ Add FILE_SYSTEM build flag for FileSystem API
+ https://bugs.webkit.org/show_bug.cgi?id=42915
+
+ * Configurations/FeatureDefines.xcconfig:
+
+2010-07-27 Gavin Barraclough <barraclough@apple.com>
+
+ Temporarily rolling out http://trac.webkit.org/changeset/64177,
+ this seems to give QT ARM/Win a headache (specifically, looks
+ like structure layour differs, objects get too large -
+ "..\..\..\JavaScriptCore\runtime\ArrayPrototype.cpp:41:"
+ "error: size of array 'dummyclass_fits_in_cell' is negative").
+
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::emit_op_get_by_val):
+ (JSC::JIT::emit_op_put_by_val):
+ (JSC::JIT::privateCompilePatchGetArrayLength):
+ * jit/JITPropertyAccess32_64.cpp:
+ (JSC::JIT::emit_op_get_by_val):
+ (JSC::JIT::emit_op_put_by_val):
+ (JSC::JIT::privateCompilePatchGetArrayLength):
+ * runtime/ArrayPrototype.cpp:
+ (JSC::arrayProtoFuncShift):
+ (JSC::arrayProtoFuncSplice):
+ (JSC::arrayProtoFuncUnShift):
+ * runtime/JSArray.cpp:
+ (JSC::increasedVectorLength):
+ (JSC::JSArray::JSArray):
+ (JSC::JSArray::~JSArray):
+ (JSC::JSArray::getOwnPropertySlot):
+ (JSC::JSArray::getOwnPropertyDescriptor):
+ (JSC::JSArray::put):
+ (JSC::JSArray::putSlowCase):
+ (JSC::JSArray::deleteProperty):
+ (JSC::JSArray::getOwnPropertyNames):
+ (JSC::JSArray::increaseVectorLength):
+ (JSC::JSArray::setLength):
+ (JSC::JSArray::pop):
+ (JSC::JSArray::push):
+ (JSC::JSArray::sortNumeric):
+ (JSC::JSArray::sort):
+ (JSC::JSArray::fillArgList):
+ (JSC::JSArray::copyToRegisters):
+ (JSC::JSArray::compactForSorting):
+ (JSC::JSArray::subclassData):
+ (JSC::JSArray::setSubclassData):
+ (JSC::JSArray::checkConsistency):
+ * runtime/JSArray.h:
+ (JSC::JSArray::length):
+ (JSC::JSArray::canGetIndex):
+ (JSC::JSArray::getIndex):
+ (JSC::JSArray::setIndex):
+ (JSC::JSArray::uncheckedSetIndex):
+ (JSC::JSArray::markChildrenDirect):
+
+2010-07-27 Gavin Barraclough <barraclough@apple.com>
+
+ Speculative build fix for Chromium/Win
+
+ * wtf/Platform.h:
+
+2010-07-27 Gavin Barraclough <barraclough@apple.com>
+
+ Oh! that makes more sense! Maybe C++-style comments are bringing teh bad mojo.
+
+ * wtf/Platform.h:
+
+2010-07-27 Gavin Barraclough <barraclough@apple.com>
+
+ Speculative build fix for GTK/64 ... seems to be barfing on a comment o_O
+
+ * wtf/Platform.h:
+
+2010-07-27 Michael Saboff <msaboff@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Changed the handling for removing and adding elements at the front
+ of an array. The code now keeps a bias that indicates the amount of
+ JSValue sized holes are prior to the ArrayStorage block. This means
+ that shift operations are now memmove's of the header part of
+ the ArrayStorage and unshift operations are similar, but may require a
+ realloc first to create the space. Similar operations are performed
+ for special cases of splice and slice.
+ Also optimized the new Array(size) case so that we don't allocate and
+ initialize array elements until the JS code starts using elements.
+ The array growth code is slightly more aggressive for initial growth
+ based on size growth of any previous array.
+
+ * Configurations/JavaScriptCore.xcconfig:
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::emit_op_get_by_val):
+ (JSC::JIT::emit_op_put_by_val):
+ (JSC::JIT::privateCompilePatchGetArrayLength):
+ * jit/JITPropertyAccess32_64.cpp:
+ (JSC::JIT::emit_op_get_by_val):
+ (JSC::JIT::emit_op_put_by_val):
+ (JSC::JIT::privateCompilePatchGetArrayLength):
+ * runtime/ArrayPrototype.cpp:
+ (JSC::arrayProtoFuncShift):
+ (JSC::arrayProtoFuncSplice):
+ (JSC::arrayProtoFuncUnShift):
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::JSArray):
+ (JSC::JSArray::~JSArray):
+ (JSC::JSArray::getOwnPropertySlot):
+ (JSC::JSArray::getOwnPropertyDescriptor):
+ (JSC::JSArray::put):
+ (JSC::JSArray::putSlowCase):
+ (JSC::JSArray::deleteProperty):
+ (JSC::JSArray::getOwnPropertyNames):
+ (JSC::JSArray::getNewVectorLength):
+ (JSC::JSArray::increaseVectorLength):
+ (JSC::JSArray::increaseVectorPrefixLength):
+ (JSC::JSArray::setLength):
+ (JSC::JSArray::pop):
+ (JSC::JSArray::push):
+ (JSC::JSArray::shiftCount):
+ (JSC::JSArray::unshiftCount):
+ (JSC::JSArray::sortNumeric):
+ (JSC::JSArray::sort):
+ (JSC::JSArray::fillArgList):
+ (JSC::JSArray::copyToRegisters):
+ (JSC::JSArray::compactForSorting):
+ (JSC::JSArray::subclassData):
+ (JSC::JSArray::setSubclassData):
+ (JSC::JSArray::checkConsistency):
+ * runtime/JSArray.h:
+ (JSC::JSArray::length):
+ (JSC::JSArray::canGetIndex):
+ (JSC::JSArray::getIndex):
+ (JSC::JSArray::setIndex):
+ (JSC::JSArray::uncheckedSetIndex):
+ (JSC::JSArray::arrayStorage):
+ (JSC::JSArray::setArrayStorage):
+ (JSC::JSArray::markChildrenDirect):
+
+2010-07-27 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 43089 - Cleanup JIT related switched in Platform.h
+
+ The code the enable to JIT checks every permutation of platform & OS individually, but
+ now the JIT is enabled on the majority much all x86/x86-64/ARM/MIPS systems. It should
+ be cleaner to just enable by default on these platforms, and explicitly disable on configs
+ that don't aren't supported.
+
+ Also, rename ENABLE_JIT_OPTIMIZE_MOD to ENABLE_JIT_USE_SOFT_MODULO. I always find this
+ confusing since enabling this "optimization" would be possible, but would be a regression
+ on x86/x86-64 systems! I think it's clearer to reserve "JIT_OPTIMIZE" for compiler
+ technologies applicable to all platforms, and make a more optional behaviour like this a
+ "USE".
+
+ * jit/ExecutableAllocator.h:
+ (JSC::ExecutableAllocator::cacheFlush):
+ * jit/JIT.h:
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emit_op_mod):
+ (JSC::JIT::emitSlow_op_mod):
+ * jit/JITArithmetic32_64.cpp:
+ (JSC::JIT::emit_op_mod):
+ (JSC::JIT::emitSlow_op_mod):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ * jit/JITOpcodes32_64.cpp:
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ * wtf/Platform.h:
+
+2010-07-27 James Robinson <jamesr@chromium.org>
+
+ Reviewed by Darin Fisher.
+
+ [chromium] Make PLATFORM(CHROMIUM) and not OS(MAC) turn USE(GLES2_RENDERING) on
+ https://bugs.webkit.org/show_bug.cgi?id=43084
+
+ This turns USE(GLES2_RENDERING) on for chromium on windows/linux. This causes no
+ change in behavior, that's all controlled by ENABLE() macros that are currently off.
+
+ * wtf/Platform.h:
+
+2010-07-23 Helder Correia <heldercorreia@codeaurora.org>
+
+ Reviewed by Darin Adler.
+
+ Canvas tests 2d.imageData.object.round and 2d.imageData.object.wrap are
+ failing. For canvas image data manipulation, the values passed should
+ be truncated and wrapped. Also fix the canvas-ImageData-behaviour test
+ to expect wrapping rather than clamping, and add some new checkings.
+ https://bugs.webkit.org/show_bug.cgi?id=40272
+
+ * runtime/JSByteArray.h:
+ (JSC::JSByteArray::setIndex):
+ (JSC::JSByteArray::JSByteArray):
+
+2010-07-27 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 42621 - Add a bump allocator for the YARR interpreter
+
+ The regex engine requires lifo allocation, however currently uses the general purpose
+ malloc/free memory allocation. A simple bump pointer allocator should provide a lower
+ overhead allocation solution.
+
+ When using YARR interpreter, 15% progression on v8-regex.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * runtime/JSGlobalData.h:
+ * runtime/RegExp.cpp:
+ (JSC::RegExp::compile):
+ * wtf/BumpPointerAllocator.h: Added.
+ (WTF::BumpPointerPool::ensureCapacity):
+ (WTF::BumpPointerPool::alloc):
+ (WTF::BumpPointerPool::dealloc):
+ (WTF::BumpPointerPool::operator new):
+ (WTF::BumpPointerPool::BumpPointerPool):
+ (WTF::BumpPointerPool::create):
+ (WTF::BumpPointerPool::shrink):
+ (WTF::BumpPointerPool::destroy):
+ (WTF::BumpPointerPool::ensureCapacityCrossPool):
+ (WTF::BumpPointerPool::deallocCrossPool):
+ (WTF::BumpPointerAllocator::BumpPointerAllocator):
+ (WTF::BumpPointerAllocator::~BumpPointerAllocator):
+ (WTF::BumpPointerAllocator::startAllocator):
+ (WTF::BumpPointerAllocator::stopAllocator):
+ * yarr/RegexInterpreter.cpp:
+ (JSC::Yarr::Interpreter::allocDisjunctionContext):
+ (JSC::Yarr::Interpreter::freeDisjunctionContext):
+ (JSC::Yarr::Interpreter::allocParenthesesDisjunctionContext):
+ (JSC::Yarr::Interpreter::freeParenthesesDisjunctionContext):
+ (JSC::Yarr::Interpreter::interpret):
+ (JSC::Yarr::Interpreter::Interpreter):
+ (JSC::Yarr::ByteCompiler::compile):
+ (JSC::Yarr::byteCompileRegex):
+ * yarr/RegexInterpreter.h:
+ (JSC::Yarr::BytecodePattern::BytecodePattern):
+
+2010-07-26 Gavin Barraclough <barraclough@apple.com>
+
+ Windows build fix from Chromium/GTK build fix!
+
+ * wtf/PageAllocation.cpp:
+
+2010-07-26 Gavin Barraclough <barraclough@apple.com>
+
+ Chromium/GTK build fix
+
+ * wtf/PageAllocation.cpp:
+
+2010-07-26 Gavin Barraclough <barraclough@apple.com>
+
+ Build fix for !Mac platforms.
+
+ * Android.mk:
+ * CMakeLists.txt:
+ * GNUmakefile.am:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.pro:
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+
+2010-07-26 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 43009 - Abstract out page allocation from executable allocators
+
+ It would be great to have a single platform abstraction for block allocation, rather than copy/paste code.
+
+ In this initial implementation I've made Symbian fall back to use malloc/free for non-executable memory.
+ I think this will match current behaviour for the next client we will want to port across (RegisterFile &
+ Collector).
+
+ * CMakeListsEfl.txt:
+ * GNUmakefile.am:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.pro:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * jit/ExecutableAllocator.cpp:
+ (JSC::ExecutableAllocator::intializePageSize):
+ (JSC::ExecutablePool::systemAlloc):
+ (JSC::ExecutablePool::systemRelease):
+ (JSC::ExecutableAllocator::isValid):
+ * jit/ExecutableAllocator.h:
+ (JSC::ExecutablePool::ExecutablePool):
+ (JSC::ExecutablePool::poolAllocate):
+ * jit/ExecutableAllocatorFixedVMPool.cpp:
+ (JSC::FixedVMPoolAllocator::release):
+ (JSC::FixedVMPoolAllocator::reuse):
+ (JSC::FixedVMPoolAllocator::FixedVMPoolAllocator):
+ (JSC::FixedVMPoolAllocator::alloc):
+ (JSC::FixedVMPoolAllocator::free):
+ (JSC::FixedVMPoolAllocator::isValid):
+ (JSC::FixedVMPoolAllocator::isWithinVMPool):
+ (JSC::ExecutablePool::systemAlloc):
+ (JSC::ExecutablePool::systemRelease):
+ * jit/ExecutableAllocatorPosix.cpp: Removed.
+ * jit/ExecutableAllocatorSymbian.cpp: Removed.
+ * jit/ExecutableAllocatorWin.cpp: Removed.
+ * wscript:
+ * wtf/PageAllocator.cpp: Added.
+ (WTF::protection):
+ (WTF::PageAllocation::commit):
+ (WTF::PageAllocation::decommit):
+ (WTF::PageAllocator::allocate):
+ (WTF::PageAllocator::reserve):
+ (WTF::PageAllocator::deallocate):
+ (WTF::PageAllocator::pagesize):
+ * wtf/PageAllocator.h: Added.
+ (WTF::PageAllocation::PageAllocation):
+ (WTF::PageAllocation::base):
+ (WTF::PageAllocation::size):
+ (WTF::PageAllocation::chunk):
+ (WTF::PageAllocation::operator!):
+ (WTF::PageAllocator::):
+
+2010-07-26 Gavin Barraclough <barraclough@apple.com>
+
+ Rolling out r64097:64100, oops, more b0rked than I relized by my last changes, sorry!
+
+ * CMakeListsEfl.txt:
+ * GNUmakefile.am:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.pro:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * jit/ExecutableAllocator.cpp:
+ (JSC::ExecutableAllocator::reprotectRegion):
+ (JSC::ExecutableAllocator::cacheFlush):
+ * jit/ExecutableAllocator.h:
+ (JSC::ExecutablePool::ExecutablePool):
+ (JSC::ExecutablePool::poolAllocate):
+ * jit/ExecutableAllocatorFixedVMPool.cpp:
+ (JSC::FixedVMPoolAllocator::release):
+ (JSC::FixedVMPoolAllocator::reuse):
+ (JSC::FixedVMPoolAllocator::FixedVMPoolAllocator):
+ (JSC::FixedVMPoolAllocator::alloc):
+ (JSC::FixedVMPoolAllocator::free):
+ (JSC::FixedVMPoolAllocator::isValid):
+ (JSC::FixedVMPoolAllocator::isWithinVMPool):
+ (JSC::ExecutablePool::systemAlloc):
+ (JSC::ExecutablePool::systemRelease):
+ * jit/ExecutableAllocatorPosix.cpp: Added.
+ (JSC::ExecutableAllocator::intializePageSize):
+ (JSC::ExecutablePool::systemAlloc):
+ (JSC::ExecutablePool::systemRelease):
+ (JSC::ExecutableAllocator::isValid):
+ * jit/ExecutableAllocatorSymbian.cpp: Added.
+ (JSC::ExecutableAllocator::intializePageSize):
+ (JSC::ExecutablePool::systemAlloc):
+ (JSC::ExecutablePool::systemRelease):
+ (JSC::ExecutableAllocator::isValid):
+ * jit/ExecutableAllocatorWin.cpp: Added.
+ (JSC::ExecutableAllocator::intializePageSize):
+ (JSC::ExecutablePool::systemAlloc):
+ (JSC::ExecutablePool::systemRelease):
+ (JSC::ExecutableAllocator::isValid):
+ * wscript:
+ * wtf/PageAllocation.cpp: Removed.
+ * wtf/PageAllocation.h: Removed.
+
+2010-07-26 Gavin Barraclough <barraclough@apple.com>
+
+ Speculative !debug build fix II.
+
+ * wtf/PageAllocation.h:
+ (WTF::PageAllocation::PageAllocation):
+
+2010-07-26 Gavin Barraclough <barraclough@apple.com>
+
+ Speculative !debug build fix.
+
+ * wtf/PageAllocation.h:
+ (WTF::PageAllocation::PageAllocation):
+
+2010-07-26 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 43009 - Abstract out page allocation from executable allocators
+
+ It would be great to have a single platform abstraction for block allocation, rather than copy/paste code.
+
+ In this initial implementation I've made Symbian fall back to use malloc/free for non-executable memory.
+ I think this will match current behaviour for the next client we will want to port across (RegisterFile &
+ Collector).
+
+ * CMakeListsEfl.txt:
+ * GNUmakefile.am:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.pro:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * jit/ExecutableAllocator.cpp:
+ (JSC::ExecutableAllocator::intializePageSize):
+ (JSC::ExecutablePool::systemAlloc):
+ (JSC::ExecutablePool::systemRelease):
+ (JSC::ExecutableAllocator::isValid):
+ * jit/ExecutableAllocator.h:
+ (JSC::ExecutablePool::ExecutablePool):
+ (JSC::ExecutablePool::poolAllocate):
+ * jit/ExecutableAllocatorFixedVMPool.cpp:
+ (JSC::FixedVMPoolAllocator::release):
+ (JSC::FixedVMPoolAllocator::reuse):
+ (JSC::FixedVMPoolAllocator::FixedVMPoolAllocator):
+ (JSC::FixedVMPoolAllocator::alloc):
+ (JSC::FixedVMPoolAllocator::free):
+ (JSC::FixedVMPoolAllocator::isValid):
+ (JSC::FixedVMPoolAllocator::isWithinVMPool):
+ (JSC::ExecutablePool::systemAlloc):
+ (JSC::ExecutablePool::systemRelease):
+ * jit/ExecutableAllocatorPosix.cpp: Removed.
+ * jit/ExecutableAllocatorSymbian.cpp: Removed.
+ * jit/ExecutableAllocatorWin.cpp: Removed.
+ * wscript:
+ * wtf/PageAllocator.cpp: Added.
+ (WTF::protection):
+ (WTF::PageAllocation::commit):
+ (WTF::PageAllocation::decommit):
+ (WTF::PageAllocator::allocate):
+ (WTF::PageAllocator::reserve):
+ (WTF::PageAllocator::deallocate):
+ (WTF::PageAllocator::pagesize):
+ * wtf/PageAllocator.h: Added.
+ (WTF::PageAllocation::PageAllocation):
+ (WTF::PageAllocation::base):
+ (WTF::PageAllocation::size):
+ (WTF::PageAllocation::chunk):
+ (WTF::PageAllocation::operator!):
+ (WTF::PageAllocator::):
+
+2009-10-30 Tor Arne Vestbø <tor.arne.vestbo@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] Use the default timeout interval for JS as the HTML tokenizer delay for setHtml()
+
+ This ensures that long-running JavaScript (for example due to a modal alert() dialog),
+ will not trigger a deferred load after only 500ms (the default tokenizer delay) while
+ still giving a reasonable timeout (10 seconds) to prevent deadlock.
+
+ https://bugs.webkit.org/show_bug.cgi?id=29381
+
+ * runtime/TimeoutChecker.h: Add getter for the timeout interval
+
+2010-07-25 Patrick Gansterer <paroga@paroga.com>
+
+ Reviewed by Kent Tamura.
+
+ [WINCE] Buildfix for JSC in release mode
+ https://bugs.webkit.org/show_bug.cgi?id=42934
+
+ * jsc.cpp: Don't use __try on WinCE.
+
+2010-07-24 Patrick Gansterer <paroga@paroga.com>
+
+ Reviewed by Darin Adler.
+
+ [MSVC] Ensure 4 byte alignment on ARM
+ https://bugs.webkit.org/show_bug.cgi?id=42935
+
+ * jit/JITStubs.h: Added #pragma pack(4) around JITStackFrame.
+
+2010-07-24 Patrick Gansterer <paroga@paroga.com>
+
+ Reviewed by Darin Adler.
+
+ [WINCE] Cleanup defines in Platform.h
+ https://bugs.webkit.org/show_bug.cgi?id=42933
+
+ * wtf/Platform.h:
+
+2010-07-23 Rafael Antognolli <antognolli@profusion.mobi>
+
+ Reviewed by Antonio Gomes.
+
+ [EFL] Cleanup glib support (make it optional)
+ https://bugs.webkit.org/show_bug.cgi?id=42480
+
+ Remove gobject/GRefPtr.cpp if not using soup/glib.
+
+ * wtf/CMakeListsEfl.txt:
+
+2010-07-23 Patrick Gansterer <paroga@paroga.com>
+
+ Reviewed by Adam Roben.
+
+ [WINCE] Implement TCSpinLock.
+ https://bugs.webkit.org/show_bug.cgi?id=41792
+
+ Implement the SpinLock with InterlockedExchange from the Windows API.
+
+ * wtf/TCSpinLock.h:
+ (TCMalloc_SpinLock::Lock):
+ (TCMalloc_SpinLock::Unlock):
+ (TCMalloc_SpinLock::IsHeld):
+ (TCMalloc_SpinLock::Init):
+ (TCMalloc_SlowLock):
+
+2010-07-22 Csaba Osztrogonác <ossy@webkit.org>
+
+ Unreviewed rolling out r63947 and r63948, because they broke Qt Windows build.
+
+ * jit/JITStubs.cpp:
+ * jit/JITStubs.h:
+
+2010-07-22 Gavin Barraclough <barraclough@apple.com>
+
+ Eeeep! r63947 hosed all non-x86 builds!
+
+ * jit/JITStubs.h:
+
+2010-07-22 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 42818 - [Qt] REGRESSION(63348): jsc is broken
+ Speculative fix, need fastcall conventions on Qt/Win.
+
+ * jit/JITStubs.cpp:
+ * jit/JITStubs.h:
+
+2010-07-22 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Do more constant folding
+ https://bugs.webkit.org/show_bug.cgi?id=42867
+
+ Constant fold a few more operations. SunSpider says this is
+ a win but I suspect that's just code motion at play.
+
+ * parser/ASTBuilder.h:
+ (JSC::ASTBuilder::makeModNode):
+ (JSC::ASTBuilder::makeURightShiftNode):
+ (JSC::ASTBuilder::makeBitOrNode):
+ (JSC::ASTBuilder::makeBitAndNode):
+ (JSC::ASTBuilder::makeBitXOrNode):
+ (JSC::ASTBuilder::makeBinaryNode):
+
+2010-07-22 Kent Hansen <kent.hansen@nokia.com>
+
+ Reviewed by Kent Tamura.
+
+ Error properties of the Global Object are missing the DontEnum attribute
+ https://bugs.webkit.org/show_bug.cgi?id=28771
+
+ Add the attributes to become spec compliant.
+
+ * runtime/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::reset):
+
+2010-07-20 Steve Falkenburg <sfalken@apple.com>
+
+ Reviewed by Adam Roben.
+
+ WebKit on Windows should build optionally with an unversioned ICU DLL
+ https://bugs.webkit.org/show_bug.cgi?id=42722
+ <rdar://problem/8211743> JavaScriptCore needs to link against unversioned ICU
+
+ Dynamically create a new header, ICUVersion.h, as part of build-generated-files.sh.
+ Header contains a preprocessor define (U_DISABLE_RENAMING) indicating to ICU whether the ICU API
+ should be namespaced with the current ICU version number. Proper value is determined
+ by checking for the presence of libicuuc.lib, the unversioned copy of ICU.
+
+ To get the proper value for U_DISABLE_RENAMING into all source files, we force
+ the include of ICUVersion.h (our generated header) via the compiler options.
+
+ Since the versioned and unversioned ICU have different filenames (libicuuc.lib vs icuuc.lib)
+ we copy the ICU lib to an intermediate location under obj with a common name. This
+ allows us to link properly with either without adding a new build configuration.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops:
+ Copy ICU libs into a common location with a common name.
+ Add additional library search path to pick up icu lib.
+ Change ICU library filename specified to linker.
+ Add forced include of ICUVersion.h.
+ * JavaScriptCore.vcproj/JavaScriptCore/build-generated-files.sh: Generate ICUVersion.h
+ * JavaScriptCore.vcproj/WTF/WTFCommon.vsprops: Add forced include of ICUVersion.h.
+ * JavaScriptCore.vcproj/jsc/jscCommon.vsprops:
+ Copy ICU libs into a common location with a common name.
+ Add additional library search path to pick up icu lib.
+ Change ICU library filename specified to linker.
+ Add forced include of ICUVersion.h.
+ * JavaScriptCore.vcproj/testapi/testapiCommon.vsprops:
+ Copy ICU libs into a common location with a common name.
+ Add additional library search path to pick up icu lib.
+ Change ICU library filename specified to linker.
+ Add forced include of ICUVersion.h.
+
+2010-07-20 Steve Falkenburg <sfalken@apple.com>
+
+ Re-save vsprops files after no-op edits in Visual Studio
+ to fix manual edit issues.
+
+2010-07-20 Mahesh Kulkarni <mahesh.kulkarni@nokia.com>
+
+ Reviewed by Steve Block.
+
+ Need to be able to configure Geolocation policy regarding user permissions
+ https://bugs.webkit.org/show_bug.cgi?id=42068
+
+ If CLIENT_BASED_GEOLOCATION is enabled, enable preemtive permission policy
+ by default
+
+ * wtf/Platform.h:
+
+2010-07-20 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r63742.
+ http://trac.webkit.org/changeset/63742
+ https://bugs.webkit.org/show_bug.cgi?id=42641
+
+ Broke Leopard Intel build. (Requested by bbandix on #webkit).
+
+ * wtf/Platform.h:
+
+2010-07-20 Mahesh Kulkarni <mahesh.kulkarni@nokia.com>
+
+ Reviewed by Steve Block.
+
+ Need to be able to configure Geolocation policy regarding user permissions
+ https://bugs.webkit.org/show_bug.cgi?id=42068
+
+ If CLIENT_BASED_GEOLOCATION is enabled, enable preemtive permission policy
+ by default
+
+ * wtf/Platform.h:
+
+2010-07-19 Dirk Schulze <krit@webkit.org>
+
+ Reviewed by Nikolas Zimmermann.
+
+ SVG CleanUp of SVGPathData parsing
+ https://bugs.webkit.org/show_bug.cgi?id=41410
+
+ Added piOverTwo to MathExtras.
+
+ * wtf/MathExtras.h:
+
+2010-07-19 Mike Moretti <mike.moretti@nokia.com>
+
+ Reviewed by Laszlo Gombos.
+
+ [Symbian] Build fix after r63404.
+
+ Implement isValid() function for the Symbian executable allocator.
+
+ * jit/ExecutableAllocatorSymbian.cpp:
+ (JSC::ExecutableAllocator::isValid):
+
+2010-07-19 Chris Marrin <cmarrin@apple.com>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=42118
+ Disable WebGL on Leopard for now.
+
+ LayoutTests fail on some graphics hardware on Leopard because one of the features we use,
+ GL_ARB_framebuffer_object, is not universally available in Leopard like it is in
+ SnowLeopard. This will allow LayoutTests to pass on Leopard until we add logic to use a
+ software OpenGL driver on machines without this support.
+
+ * Configurations/FeatureDefines.xcconfig:
+
+2010-07-16 Darin Adler <darin@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Use OwnPtr for CodeBlock objects
+ https://bugs.webkit.org/show_bug.cgi?id=42490
+
+ * runtime/Executable.cpp:
+ (JSC::EvalExecutable::EvalExecutable): Moved this here and made it non-inline.
+ Eliminated the code that used to initialize the raw pointer since it's now
+ an OwnPtr.
+ (JSC::EvalExecutable::~EvalExecutable): Removed the explicit delete here.
+ (JSC::ProgramExecutable::ProgramExecutable): Ditto.
+ (JSC::ProgramExecutable::~ProgramExecutable): Ditto.
+ (JSC::FunctionExecutable::FunctionExecutable): Ditto.
+ (JSC::FunctionExecutable::~FunctionExecutable): Ditto.
+ (JSC::EvalExecutable::compileInternal): Added use of adoptPtr and get.
+ (JSC::ProgramExecutable::compileInternal): Ditto.
+ (JSC::FunctionExecutable::compileForCallInternal): Ditto.
+ (JSC::FunctionExecutable::compileForConstructInternal): Ditto.
+ (JSC::FunctionExecutable::recompile): Use clear instead of delete followed
+ by assignment of 0.
+
+ * runtime/Executable.h: Moved constructors to the cpp file and changed
+ raw pointers to OwnPtr.
+
+2010-07-19 Lucas De Marchi <lucas.demarchi@profusion.mobi>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [EFL] Fix build on 64-bit systems. According to
+ JavaScriptCore/wtf/Platform.h, x86_64 uses fixed allocator, which
+ needs jit/ExecutableAllocatorFixedVMPool.cpp to be included in build
+ system.
+ https://bugs.webkit.org/show_bug.cgi?id=42559
+
+ * CMakeListsEfl.txt: add missing file for x86_64.
+
+2010-07-16 Leandro Pereira <leandro@profusion.mobi>
+
+ [EFL] Unreviewed build system cleanup.
+
+ Move ExecutableAllocator{FixedVMPool,Posix,Symbian,Win}.cpp from
+ root CMakeLists.txt to the platform CMakeLists.txt.
+
+ * CMakeLists.txt:
+ * CMakeListsEfl.txt: Add ExecutableAllocatorPosix.cpp.
+
+2010-07-16 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ ES5 allows use of reserved words as IdentifierName
+ https://bugs.webkit.org/show_bug.cgi?id=42471
+
+ Modify the lexer to allow us to avoid identifying reserved
+ words in those contexts where they are valid identifiers, and
+ we know it's safe. Additionally tag the reserved word tokens
+ so we can easily identify them in those cases where we can't
+ guarantee that we've skipped reserved word identification.
+
+ * parser/JSParser.cpp:
+ (JSC::JSParser::next):
+ (JSC::JSParser::parseProperty):
+ (JSC::JSParser::parseMemberExpression):
+ * parser/JSParser.h:
+ (JSC::):
+ * parser/Lexer.cpp:
+ (JSC::Lexer::lex):
+ * parser/Lexer.h:
+ (JSC::Lexer::):
+
+2010-07-16 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ clang++ build fixes for JavaScriptCore and WebCore
+ https://bugs.webkit.org/show_bug.cgi?id=42478
+
+ * runtime/RegExpKey.h:
+ (JSC::operator==):
+ Move the RegExpKey equals operator into the JSC namespace so it can be found by ADL.
+
+2010-07-16 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by David Levin.
+
+ Really add WARN_UNUSED_RESULT to leakRef
+ https://bugs.webkit.org/show_bug.cgi?id=42464
+
+ * wtf/PassRefPtr.h:
+ (WTF::PassRefPtr::):
+ (WTF::NonNullPassRefPtr::):
+ Put the WARN_UNUSED_RESULT attribute at the right place.
+
+ * wtf/RetainPtr.h:
+ (WTF::RetainPtr::releaseRef):
+ Remove WARN_UNUSED_RESULT here for now, it leads to two warnings that need
+ to be fixed first.
+
+2010-07-15 Victor Wang <victorw@chromium.org>
+
+ Reviewed by David Levin.
+
+ [Chromium] Disable c4291 for chromium windows multi dll build.
+
+ https://bugs.webkit.org/show_bug.cgi?id=42177
+
+ * JavaScriptCore.gyp/JavaScriptCore.gyp:
+
+2010-07-15 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Crash entering mail.yahoo.com
+ https://bugs.webkit.org/show_bug.cgi?id=42394
+
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::argumentNumberFor): Added a NULL check. If the
+ identifier we're resolving is not a local variable, registerFor returns
+ NULL.
+
+ * bytecompiler/NodesCodegen.cpp:
+ (JSC::FunctionBodyNode::emitBytecode): Unrelated to the crash, but I
+ noticed this while working on it: No need to NULL-check returnNode,
+ since an early return has already done so.
+
+2010-07-15 Martin Robinson <mrobinson@igalia.com>
+
+ Reviewed by Oliver Hunt.
+
+ [GTK] Simplify the distribution step
+ https://bugs.webkit.org/show_bug.cgi?id=42414
+
+ * GNUmakefile.am: Add extra dist files directly to EXTRA_DIST instead
+ of adding them by proxy via javascriptcore_dist. Sort the EXTRA_DIST list.
+ Refer to create_hash_table and create_regexp_tables directly, as is the
+ behavior with other code generation scripts.
+
+2010-07-15 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Fix dumping of op_put_by_id.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::printPutByIdOp):
+
+2010-07-15 Zoltan Herczeg <zherczeg@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ Refactoring some parts of the lexer
+ https://bugs.webkit.org/show_bug.cgi?id=41845
+
+ This patch is a precursor of refactoring the identifier
+ parsing, which currently slows down the lexer, and not
+ ready for landing. This patch contains those sources,
+ which does not slow down the lexer (mainly style changes).
+
+ SunSpider: no change (529.4ms to 528.7ms)
+ --parse-only: no change (31.0ms to 31.2ms)
+
+ * parser/Lexer.cpp:
+ (JSC::isIdentStart): using typesOfASCIICharacters to determine
+ whether the current character is in identifier start
+ (JSC::isIdentPart): using typesOfASCIICharacters to determine
+ whether the current character is in identifier part
+ (JSC::Lexer::parseString): style fix
+ (JSC::Lexer::lex): removing the else after the main which
+ which reduces code duplication
+
+2010-07-15 Mark Rowe <mrowe@apple.com>
+
+ Update the sorting in the Xcode project files.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2010-07-14 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Make sure that mixed interpreter/jit builds don't try to use the jit if the allocator fails
+ https://bugs.webkit.org/show_bug.cgi?id=42310
+
+ Add some null checks to deal with the Fixed VM allocator failing
+ to get the requested executable region, delay the creation of the
+ JITStubs in JSGlobalData until after we know whether we're using
+ the JIT.
+
+ * jit/ExecutableAllocator.h:
+ (JSC::ExecutableAllocator::ExecutableAllocator):
+ (JSC::ExecutableAllocator::poolForSize):
+ * jit/ExecutableAllocatorFixedVMPool.cpp:
+ (JSC::FixedVMPoolAllocator::FixedVMPoolAllocator):
+ (JSC::FixedVMPoolAllocator::alloc):
+ (JSC::FixedVMPoolAllocator::free):
+ (JSC::FixedVMPoolAllocator::isValid):
+ (JSC::ExecutableAllocator::isValid):
+ (JSC::ExecutablePool::systemAlloc):
+ (JSC::ExecutablePool::systemRelease):
+ * jit/ExecutableAllocatorPosix.cpp:
+ (JSC::ExecutableAllocator::isValid):
+ * jit/ExecutableAllocatorWin.cpp:
+ (JSC::ExecutableAllocator::isValid):
+ * jit/JIT.cpp:
+ (JSC::JIT::linkCall):
+ (JSC::JIT::linkConstruct):
+ * jit/JIT.h:
+ (JSC::JIT::compileCTIMachineTrampolines):
+ (JSC::JIT::compileCTINativeCall):
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emit_op_mod):
+ * jit/JITArithmetic32_64.cpp:
+ (JSC::JIT::emit_op_mod):
+ * jit/JITCall.cpp:
+ (JSC::JIT::compileOpCallVarargs):
+ (JSC::JIT::compileOpCall):
+ (JSC::JIT::compileOpCallSlowCase):
+ * jit/JITCall32_64.cpp:
+ (JSC::JIT::compileOpCallVarargs):
+ (JSC::JIT::compileOpCall):
+ (JSC::JIT::compileOpCallSlowCase):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::privateCompileCTINativeCall):
+ * jit/JITStubs.cpp:
+ (JSC::JITThunks::JITThunks):
+ (JSC::JITThunks::tryCacheGetByID):
+ (JSC::JITThunks::hostFunctionStub):
+ * jit/ThunkGenerators.cpp:
+ (JSC::charCodeAtThunkGenerator):
+ (JSC::charAtThunkGenerator):
+ (JSC::fromCharCodeThunkGenerator):
+ (JSC::sqrtThunkGenerator):
+ (JSC::powThunkGenerator):
+ * runtime/Executable.h:
+ (JSC::NativeExecutable::create):
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData):
+ (JSC::JSGlobalData::getHostFunction):
+ * runtime/JSGlobalData.h:
+ (JSC::JSGlobalData::getCTIStub):
+ * yarr/RegexJIT.cpp:
+ (JSC::Yarr::jitCompileRegex):
+
+2010-07-14 Gavin Barraclough <barraclough@apple.com>
+
+ Speculative Qt/Windows build fix.
+
+ * jit/JITStubs.h:
+
+2010-07-14 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ https://bugs.webkit.org/show_bug.cgi?id=42280
+ JIT_STUB_ARGUMENT_VA_LIST is only slowing us down! Remove it!
+
+ * jit/JIT.h:
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::restoreArgumentReferenceForTrampoline):
+ * jit/JITStubs.cpp:
+ * jit/JITStubs.h:
+ * wtf/Platform.h:
+
+2010-07-14 Oliver Hunt <oliver@apple.com>
+
+ RS=Geoff Garen.
+
+ Guard the CF path of interpreter vs. jit selection with PLATFORM(CF)
+
+ This allows the code to work on windows as well. Also unifies the
+ environment variable with the preference name.
+
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData):
+
+2010-07-14 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Don Melton.
+
+ Crash when trying to enable JIT and Interpreter in a single build.
+
+ CFPreferences code added at the last minute failed to account for
+ the preference not being present and then attempted to CFRelease
+ a null value.
+
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData):
+
+2010-07-14 Zoltan Herczeg <zherczeg@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ Change indentations in the lexer
+ https://bugs.webkit.org/show_bug.cgi?id=41845
+
+ This patch fixes an old, indentation error comes from kjs,
+ as webkit has a different style rule for switches, and change
+ the indentation of the main switch, which is a temporary
+ style error. This change makes easier to see the behavioural
+ changes in the follow-up patch.
+
+ No behavioural changes.
+
+ * parser/Lexer.cpp:
+ (JSC::singleEscape):
+ (JSC::Lexer::lex):
+
+2010-07-13 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r63262.
+ http://trac.webkit.org/changeset/63262
+ https://bugs.webkit.org/show_bug.cgi?id=42229
+
+ broke Windows compile (Requested by bweinstein on #webkit).
+
+ * API/tests/testapi.c:
+ (assertEqualsAsCharactersPtr):
+ (main):
+ * testapi.pro: Removed.
+
+2010-07-13 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ ES5 requires BOMs to be treated as whitespace
+ https://bugs.webkit.org/show_bug.cgi?id=42218
+
+ Add BOM character to the Lexer's definition of whitespace,
+ and remove the logic that dealt with stripping BOMs and
+ caching the cleaned string.
+
+ * parser/Lexer.h:
+ (JSC::Lexer::isWhiteSpace):
+ * parser/SourceProvider.h:
+ (JSC::UStringSourceProvider::create):
+ (JSC::UStringSourceProvider::UStringSourceProvider):
+ * wtf/text/StringImpl.h:
+
+2010-07-13 Andreas Kling <andreas.kling@nokia.com>
+
+ Reviewed by Darin Adler.
+
+ Avoid slow-path for put() in Array.splice()
+ https://bugs.webkit.org/show_bug.cgi?id=41920
+
+ Defer creation of the returned array until its final size is known
+ to avoid growing it while adding elements.
+
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::JSArray): Add two modes of creation, CreateInitialized (old)
+ and CreateCompact (which should only be used when constructing arrays whose
+ size and contents are known at the time of creation.)
+ (JSC::JSArray::setLength): Skip first consistency check if in CreateCompact
+ initialization mode. (Only applies to non-empty arrays.)
+ (JSC::JSArray::checkConsistency): Build fix (JSValue::type() is gone)
+ * runtime/JSArray.h:
+ (JSC::JSArray::uncheckedSetIndex): Added for fast initialization of compact
+ arrays. Does no bounds or other sanity checking.
+ * runtime/ArrayPrototype.cpp:
+ (JSC::arrayProtoFuncSplice): Optimized creation of the returned JSArray.
+ * runtime/ArrayConstructor.cpp:
+ (JSC::constructArrayWithSizeQuirk): Pass CreateInitialized to ctor.
+ * runtime/JSGlobalObject.h:
+ (JSC::constructEmptyArray): Pass CreateInitialized to ctor.
+ * runtime/RegExpConstructor.cpp:
+ (JSC::RegExpMatchesArray::RegExpMatchesArray): Pass CreateInitialized to ctor.
+
+2010-07-13 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 42207 - Clean up interface to compile executables, always check for exceptions
+
+ Presently interface to compile executable is inconsistent between eval/program and
+ function code, and is error prone in allowing a caller to byte compile without JIT
+ compiling an executable (we rely on all executables with codeblocks having JIT code).
+ Unify on an interface where all compilation is performed by a single compile (with
+ ForCall|ForConstruct variants) method, and make all clients check for errors.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::unwindCallFrame):
+ (JSC::Interpreter::execute):
+ (JSC::Interpreter::executeCall):
+ (JSC::Interpreter::executeConstruct):
+ (JSC::Interpreter::prepareForRepeatCall):
+ (JSC::Interpreter::privateExecute):
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+ * parser/Parser.h:
+ (JSC::Parser::isFunctionBodyNode):
+ (JSC::Parser::parse):
+ * runtime/ArrayPrototype.cpp:
+ (JSC::isNumericCompareFunction):
+ * runtime/ExceptionHelpers.cpp:
+ (JSC::createStackOverflowError):
+ * runtime/ExceptionHelpers.h:
+ * runtime/Executable.cpp:
+ (JSC::EvalExecutable::compileInternal):
+ (JSC::ProgramExecutable::checkSyntax):
+ (JSC::ProgramExecutable::compileInternal):
+ (JSC::FunctionExecutable::compileForCallInternal):
+ (JSC::FunctionExecutable::compileForConstructInternal):
+ (JSC::FunctionExecutable::reparseExceptionInfo):
+ (JSC::EvalExecutable::reparseExceptionInfo):
+ (JSC::FunctionExecutable::fromGlobalCode):
+ * runtime/Executable.h:
+ (JSC::EvalExecutable::compile):
+ (JSC::EvalExecutable::generatedBytecode):
+ (JSC::EvalExecutable::generatedJITCode):
+ (JSC::ProgramExecutable::compile):
+ (JSC::ProgramExecutable::generatedBytecode):
+ (JSC::ProgramExecutable::generatedJITCode):
+ (JSC::FunctionExecutable::generatedBytecode):
+ (JSC::FunctionExecutable::compileForCall):
+ (JSC::FunctionExecutable::compileForConstruct):
+ (JSC::FunctionExecutable::generatedJITCodeForConstructWithArityCheck):
+ * runtime/FunctionConstructor.cpp:
+ (JSC::constructFunction):
+ * runtime/JSActivation.cpp:
+ (JSC::JSActivation::argumentsGetter):
+ * runtime/JSGlobalData.h:
+ (JSC::JSGlobalData::canUseJIT):
+
+2010-07-13 Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
+
+ Reviewed by Oliver Hunt.
+
+ testapi.c depends on the Core Foundation.
+ https://bugs.webkit.org/show_bug.cgi?id=40058
+
+ Separate CoreFoundation specific tests in JSC's testapi.c. Enabling it
+ to compile in Qt environments.
+
+ All tests should work except for the JSStringCreateWithCharacters() function,
+ because its tests depend on Core Foundation specific functions.
+
+ * API/tests/testapi.c:
+ (testJSStringRefCF): moved CoreFoundation specific tests to this function.
+ (main): The moves plus some minor tweaks.
+ * testapi.pro: Added.
+
+2010-07-13 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 42182 - Change how numeric compare functions are detected
+
+ There are three problems with the current mechanism:
+ * It requires that a function executable be bytecode compiled without
+ being JIT generated (in order to copy the bytecode from the numeric
+ compare function). This is a problem since we have an invariant when
+ running with the JIT that functions are never bytecode compiled without
+ also being JIT generated (after checking the codeblock we assume the
+ function has JIT code). To help maintain this invariant
+ * This implementation will prevent us from experimenting with alternate
+ compilation paths which do not compile via bytecode.
+ * It doesn't work. Functions passing more than two arguments will match
+ if they are comparing their last two arguments, not the first two.
+ Generally the mapping back from bytecode to semantics may be more
+ complex then initially expected.
+
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::generate):
+ (JSC::BytecodeGenerator::setIsNumericCompareFunction):
+ (JSC::BytecodeGenerator::argumentNumberFor):
+ * bytecompiler/BytecodeGenerator.h:
+ * bytecompiler/NodesCodegen.cpp:
+ (JSC::BlockNode::singleStatement):
+ (JSC::FunctionBodyNode::emitBytecode):
+ * parser/Nodes.h:
+ (JSC::ExpressionNode::isSubtract):
+ (JSC::BinaryOpNode::lhs):
+ (JSC::BinaryOpNode::rhs):
+ (JSC::SubNode::isSubtract):
+ (JSC::ReturnNode::value):
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData):
+ * runtime/JSGlobalData.h:
+
+2010-07-12 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ REGRESSION: Crash at JSC::JIT::privateCompile(JSC::MacroAssemblerCodePtr*)
+ https://bugs.webkit.org/show_bug.cgi?id=41763
+
+ There are two parts to this patch, the first is to fix the actual
+ problem. When calling copyStringWithoutBOMs on a string we know
+ to contain BOMs we return a value indicating that there are no
+ BOMs.
+
+ The second part of this fix is simply to harden the path that
+ led to a crash when parsing failed.
+
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ * jit/JITOpcodes32_64.cpp:
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+ Harden compilation stubs against parser failure.
+ * parser/Lexer.cpp:
+ (JSC::Lexer::sourceCode):
+ Add assertions to ensure that subranges into a source provider
+ are always actually braces. Hopefully this should catch similar
+ failures in future. These assertions fire on existing tests
+ without this fix.
+ * runtime/Executable.h:
+ (JSC::FunctionExecutable::tryJitCodeForCall):
+ (JSC::FunctionExecutable::tryJitCodeForConstruct):
+ * wtf/text/StringImpl.h:
+ (WebCore::StringImpl::copyStringWithoutBOMs):
+ Make copyStringWithBOMs do the right thing.
+
+2010-07-13 Gabor Loki <loki@webkit.org>
+
+ Reviewed by Gavin Barraclough.
+
+ Fix the constant encoding in data transfer instructions on ARM
+ https://bugs.webkit.org/show_bug.cgi?id=42166
+
+ The getImm function is designed to produce modified immediate constant
+ for data processing instructions. It should not be used to encode
+ any constant for data transfer. In the current situation there is no
+ way to use any immediate constant for data transfer. So, the moveImm
+ function is the desired method to pass the offset value to the data
+ transfer instructions.
+
+ Reported by Jacob Bramley.
+
+ * assembler/ARMAssembler.cpp:
+ (JSC::ARMAssembler::dataTransfer32):
+ * assembler/MacroAssemblerARM.h:
+ (JSC::MacroAssemblerARM::call32):
+
+2010-07-09 Darin Adler <darin@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ String to number coercion is not spec compliant
+ https://bugs.webkit.org/show_bug.cgi?id=31349
+
+ ToNumber should ignore NBSP (\u00a0)
+ https://bugs.webkit.org/show_bug.cgi?id=25490
+
+ * runtime/JSGlobalObjectFunctions.cpp:
+ (JSC::parseIntOverflow): Added a version that works on UChar.
+ * runtime/JSGlobalObjectFunctions.h: Ditto.
+
+ * runtime/UString.cpp:
+ (JSC::isInfinity): Added helper functions.
+ (JSC::UString::toDouble): Use isStrWhiteSpace instead of
+ isSASCIISpace to define what we should skip. Got rid of the
+ code that used CString and UTF8String, instead processing the
+ UChar of the string directly, except for when we call strtod.
+ For strtod, use our own home-grown conversion function that
+ does not try to do any UTF-16 processing. Tidied up the logic
+ a bit as well.
+
+2010-07-12 Martin Robinson <mrobinson@igalia.com>
+
+ Reviewed by Xan Lopez.
+
+ [GTK] make dist is broken because of missing headers and other miscellaneous reasons
+ https://bugs.webkit.org/show_bug.cgi?id=42107
+
+ * GNUmakefile.am: Add missing header to the sources list.
+
+2010-07-12 Adam Roben <aroben@apple.com>
+
+ Stop generating stripped symbols for Release builds
+
+ It turns out we can strip the symbols after-the-fact using PDBCopy.
+
+ Fixes <http://webkit.org/b/42085>.
+
+ Reviewed by Steve Falkenburg.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops:
+ Removed the pre-link event, which just created the public\sym
+ directory.
+
+2010-07-12 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Dan Bernstein.
+
+ Add WARN_UNUSED_RETURN to the smart pointer "leak" member functions
+ https://bugs.webkit.org/show_bug.cgi?id=42086
+
+ * wtf/OwnPtr.h:
+ * wtf/PassOwnPtr.h:
+ * wtf/PassRefPtr.h:
+ (WTF::PassRefPtr::releaseRef):
+ (WTF::NonNullPassRefPtr::leakRef):
+ (WTF::NonNullPassRefPtr::releaseRef):
+ * wtf/RetainPtr.h:
+ (WTF::RetainPtr::releaseRef):
+
+2010-07-10 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ HAVE_COMPUTED_GOTO is dependent on the interpreter being enabled
+ https://bugs.webkit.org/show_bug.cgi?id=42039
+
+ Separate the existence of computed goto support in the compiler
+ from whether or not we are using the interpreter. All the current
+ HAVE(COMPUTED_GOTO) guards are for the interpreter, but I'd like
+ the option of using it elsewhere. The interpreter now uses
+ ENABLE(COMPUTED_GOTO_INTERPRETER)
+
+ * bytecode/Instruction.h:
+ (JSC::Instruction::Instruction):
+ * bytecode/Opcode.h:
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::Interpreter):
+ (JSC::Interpreter::isOpcode):
+ (JSC::Interpreter::privateExecute):
+ * interpreter/Interpreter.h:
+ (JSC::Interpreter::getOpcode):
+ (JSC::Interpreter::getOpcodeID):
+ * wtf/Platform.h:
+
+2010-07-10 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Remove switches from inner expression loops in the parser
+ https://bugs.webkit.org/show_bug.cgi?id=42035
+
+ Use bitmasks and flags on the token types to identify unary and
+ binary operators, rather than switching on the token type to
+ identify them.
+
+ * parser/JSParser.cpp:
+ (JSC::isUnaryOp):
+ (JSC::JSParser::isBinaryOperator):
+ * parser/JSParser.h:
+ (JSC::):
+
+2010-07-09 Leon Clarke <leonclarke@google.com>
+
+ Reviewed by Adam Barth.
+
+ add support for link prefetching
+ https://bugs.webkit.org/show_bug.cgi?id=3652
+
+ * Configurations/FeatureDefines.xcconfig:
+
+2010-07-09 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Tidy up lexer token ids
+ https://bugs.webkit.org/show_bug.cgi?id=42014
+
+ Stop using character literals to identify single character tokens
+ and instead use symbolic names for all tokens.
+
+ * parser/ASTBuilder.h:
+ (JSC::ASTBuilder::makeBinaryNode):
+ * parser/JSParser.cpp:
+ (JSC::JSParser::consume):
+ (JSC::JSParser::match):
+ (JSC::JSParser::autoSemiColon):
+ (JSC::JSParser::JSParser):
+ (JSC::JSParser::parseProgram):
+ (JSC::JSParser::allowAutomaticSemicolon):
+ (JSC::JSParser::parseDoWhileStatement):
+ (JSC::JSParser::parseWhileStatement):
+ (JSC::JSParser::parseVarDeclarationList):
+ (JSC::JSParser::parseConstDeclarationList):
+ (JSC::JSParser::parseForStatement):
+ (JSC::JSParser::parseReturnStatement):
+ (JSC::JSParser::parseWithStatement):
+ (JSC::JSParser::parseSwitchStatement):
+ (JSC::JSParser::parseSwitchClauses):
+ (JSC::JSParser::parseSwitchDefaultClause):
+ (JSC::JSParser::parseTryStatement):
+ (JSC::JSParser::parseDebuggerStatement):
+ (JSC::JSParser::parseStatement):
+ (JSC::JSParser::parseFormalParameters):
+ (JSC::JSParser::parseFunctionInfo):
+ (JSC::JSParser::parseExpressionOrLabelStatement):
+ (JSC::JSParser::parseIfStatement):
+ (JSC::JSParser::parseExpression):
+ (JSC::JSParser::parseAssignmentExpression):
+ (JSC::JSParser::parseConditionalExpression):
+ (JSC::isUnaryOp):
+ (JSC::JSParser::isBinaryOperator):
+ (JSC::JSParser::parseBinaryExpression):
+ (JSC::JSParser::parseProperty):
+ (JSC::JSParser::parseObjectLiteral):
+ (JSC::JSParser::parseStrictObjectLiteral):
+ (JSC::JSParser::parseArrayLiteral):
+ (JSC::JSParser::parsePrimaryExpression):
+ (JSC::JSParser::parseArguments):
+ (JSC::JSParser::parseMemberExpression):
+ (JSC::JSParser::parseUnaryExpression):
+ * parser/JSParser.h:
+ (JSC::):
+ * parser/Lexer.cpp:
+ (JSC::):
+ (JSC::Lexer::lex):
+ * parser/Lexer.h:
+
+2010-07-09 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 42015 - Enable JSValue32_64 on ARMv7
+
+ * Configurations/JavaScriptCore.xcconfig:
+ * jit/JIT.h:
+ * jit/JITStubs.cpp:
+ * wtf/Platform.h:
+
+2010-07-09 Kenneth Russell <kbr@google.com>
+
+ Reviewed by Dimitri Glazkov.
+
+ Assertion failure in String::utf8() for certain invalid UTF16 inputs
+ https://bugs.webkit.org/show_bug.cgi?id=41983
+
+ * wtf/text/WTFString.cpp:
+ (WebCore::String::utf8):
+ - Fixed assertion when sourceExhausted is returned from convertUTF16ToUTF8.
+
+2010-07-09 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Remove a couple of excess writes from the lexer
+ https://bugs.webkit.org/show_bug.cgi?id=41981
+
+ Remove a couple of fields from JSTokenInfo, and rename the remaining ones
+ to something more accurate
+
+ * parser/JSParser.cpp:
+ (JSC::JSParser::next):
+ (JSC::JSParser::tokenStart):
+ (JSC::JSParser::tokenLine):
+ (JSC::JSParser::tokenEnd):
+ * parser/JSParser.h:
+ (JSC::JSTokenInfo::JSTokenInfo):
+ * parser/Lexer.cpp:
+ (JSC::Lexer::lex):
+
+2010-07-08 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Property declarations in an object literal should not consider the prototype chain when being added to the new object
+ https://bugs.webkit.org/show_bug.cgi?id=41929
+
+ To fix this all we need to do is ensure that all new properties are
+ added with putDirect rather than a fully generic call to put. This
+ is safe as an object literal is by definition going to produce a
+ completely normal object.
+
+ Rather than duplicating all the put_by_id logic we add an additional
+ flag to op_put_by_id to indicate it should be using putDirect. In
+ the interpreter this adds a runtime branch, but in the jit this is
+ essentially free as the branch is taken at compile time. This does
+ actually improve object literal creation time even in the interpreter
+ as we no longer need to walk the prototype chain to verify that the
+ cached put is safe.
+
+ We still emit normal put_by_id code when emitting __proto__ as we want
+ to get the correct handling for changing the prototype.
+
+ Sunspider claims this is a 0.7% speedup which is conceivably real due
+ to the performance improvement in object literals, but I suspect its
+ really just the result of code motion.
+
+ * bytecode/Opcode.h:
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::emitPutById):
+ (JSC::BytecodeGenerator::emitDirectPutById):
+ * bytecompiler/BytecodeGenerator.h:
+ * bytecompiler/NodesCodegen.cpp:
+ (JSC::PropertyListNode::emitBytecode):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+ * jit/JIT.h:
+ (JSC::JIT::compilePutByIdTransition):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::emit_op_put_by_id):
+ (JSC::JIT::emitSlow_op_put_by_id):
+ (JSC::JIT::privateCompilePutByIdTransition):
+ (JSC::JIT::patchPutByIdReplace):
+ * jit/JITPropertyAccess32_64.cpp:
+ (JSC::JIT::emitSlow_op_put_by_id):
+ (JSC::JIT::privateCompilePutByIdTransition):
+ (JSC::JIT::patchPutByIdReplace):
+ * jit/JITStubs.cpp:
+ (JSC::JITThunks::tryCachePutByID):
+ (JSC::DEFINE_STUB_FUNCTION):
+ * jit/JITStubs.h:
+ (JSC::):
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData):
+ * runtime/JSObject.h:
+ (JSC::JSObject::putDirect):
+ (JSC::JSValue::putDirect):
+ * runtime/JSValue.h:
+
+2010-07-08 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ String.prototype methods should CheckObjectCoercible (test this is not null or undefined).
+
+ * runtime/StringPrototype.cpp:
+ (JSC::stringProtoFuncCharAt):
+ (JSC::stringProtoFuncCharCodeAt):
+ (JSC::stringProtoFuncConcat):
+ (JSC::stringProtoFuncIndexOf):
+ (JSC::stringProtoFuncLastIndexOf):
+ (JSC::stringProtoFuncMatch):
+ (JSC::stringProtoFuncSearch):
+ (JSC::stringProtoFuncSlice):
+ (JSC::stringProtoFuncSplit):
+ (JSC::stringProtoFuncSubstr):
+ (JSC::stringProtoFuncSubstring):
+ (JSC::stringProtoFuncToLowerCase):
+ (JSC::stringProtoFuncToUpperCase):
+ (JSC::stringProtoFuncLocaleCompare):
+ (JSC::trimString):
+
+2010-07-08 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Date.prototype.toJSON takes one argument, report this correctly.
+
+ * runtime/DatePrototype.cpp:
+
+2010-07-08 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ RegExp's prototype should be an object of type RegExp.
+
+ * runtime/RegExpPrototype.cpp:
+ (JSC::RegExpPrototype::RegExpPrototype):
+ * runtime/RegExpPrototype.h:
+
+2010-07-08 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ JavaScript parser violates ECMA automatic semicolon insertion rule
+ https://bugs.webkit.org/show_bug.cgi?id=41844
+
+ Remove (very) old and bogus logic that automatically inserted a semicolon
+ at the end of a script's source.
+
+ * parser/Lexer.cpp:
+ (JSC::Lexer::lex):
+
+2010-07-08 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Anders Carlson.
+
+ Tidy up the lexer
+
+ Remove some of the old yacc/lex-isms still present in the lexer
+
+ * parser/JSParser.h:
+ (JSC::):
+ * parser/Lexer.cpp:
+ (JSC::Lexer::parseString):
+ (JSC::Lexer::lex):
+ * parser/Lexer.h:
+
+2010-07-08 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Make object-literal parsing conformant with the spec.
+ https://bugs.webkit.org/show_bug.cgi?id=41892
+
+ Bring our parsing of object literals into conformance with the ES5 spec.
+ Basically disallow conflicting accessor vs. normal property definitions
+ The bulk of this patch is just fiddling to maintain performance.
+
+ * parser/ASTBuilder.h:
+ (JSC::ASTBuilder::createGetterOrSetterProperty):
+ (JSC::ASTBuilder::createProperty):
+ (JSC::ASTBuilder::getName):
+ (JSC::ASTBuilder::getType):
+ * parser/JSParser.cpp:
+ (JSC::jsParse):
+ (JSC::JSParser::JSParser):
+ (JSC::JSParser::parseProperty):
+ (JSC::JSParser::parseObjectLiteral):
+ (JSC::JSParser::parseStrictObjectLiteral):
+ * parser/JSParser.h:
+ * parser/Lexer.cpp:
+ (JSC::Lexer::clear):
+ * parser/Lexer.h:
+ (JSC::Lexer::currentOffset):
+ (JSC::Lexer::setOffset):
+ Add logic to allow us to roll the lexer back in the input stream.
+ * parser/Nodes.h:
+ (JSC::PropertyNode::):
+ (JSC::PropertyNode::type):
+ * parser/Parser.cpp:
+ (JSC::Parser::parse):
+ * parser/SourceProvider.h:
+ (JSC::SourceProvider::SourceProvider):
+ (JSC::SourceProvider::isValid):
+ (JSC::SourceProvider::setValid):
+ SourceProvider now records whether the input text
+ has already been validated.
+ * parser/SyntaxChecker.h:
+ (JSC::SyntaxChecker::SyntaxChecker):
+ (JSC::SyntaxChecker::Property::Property):
+ (JSC::SyntaxChecker::Property::operator!):
+ (JSC::SyntaxChecker::createProperty):
+ (JSC::SyntaxChecker::createPropertyList):
+ (JSC::SyntaxChecker::createGetterOrSetterProperty):
+ The SyntaxChecker mode now needs to maintain a bit more information
+ to ensure that we can validate object literals correctly.
+
+2010-07-08 Darin Adler <darin@apple.com>
+
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::sharedInstance): Fix typo.
+
+2010-07-08 Darin Adler <darin@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Fix assertion seen on the Leopard buildbot.
+ The single shared instance of JSGlobalData was not being
+ adopted after creation.
+
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::sharedInstance): Do adoptRef and then leakRef.
+
+2010-07-08 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ BOMs are whitespace.
+
+ * runtime/JSGlobalObjectFunctions.cpp:
+ (JSC::isStrWhiteSpace):
+
+2010-07-08 Martin Robinson <mrobinson@igalia.com>
+
+ Unreviewed.
+
+ Try fix the GTK+ build by touching this file.
+
+ * jit/ExecutableAllocatorFixedVMPool.cpp:
+
+2010-07-08 Gavin Barraclough <barraclough@apple.com>
+
+ GTK build fix take two.
+
+ * GNUmakefile.am:
+
+2010-07-08 Gavin Barraclough <barraclough@apple.com>
+
+ GTK build fix.
+
+ * GNUmakefile.am:
+
+2010-07-08 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ https://bugs.webkit.org/show_bug.cgi?id=41641
+
+ Update compile flags to allow use of ExecutableAllocatorFixedVMPool on platforms
+ other than x86-64 (this may be useful on 32-bit platforms, too).
+
+ Simplify ifdefs by dividing into thwo broad allocation strategies
+ (ENABLE_EXECUTABLE_ALLOCATOR_FIXED & ENABLE_EXECUTABLE_ALLOCATOR_DEMAND).
+
+ Rename constant used in the code to have names descriptive of their purpose,
+ rather than their specific value on a given platform.
+
+ * jit/ExecutableAllocator.cpp:
+ (JSC::ExecutableAllocator::reprotectRegion):
+ (JSC::ExecutableAllocator::cacheFlush):
+ * jit/ExecutableAllocatorFixedVMPool.cpp:
+ (JSC::FixedVMPoolAllocator::FixedVMPoolAllocator):
+ (JSC::FixedVMPoolAllocator::free):
+ (JSC::ExecutablePool::systemAlloc):
+ * jit/ExecutableAllocatorPosix.cpp:
+ * jit/ExecutableAllocatorSymbian.cpp:
+ * jit/ExecutableAllocatorWin.cpp:
+ * wtf/Platform.h:
+
+2010-07-08 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Gustavo Noronha.
+
+ Silence a few noisy build rules.
+
+ * GNUmakefile.am:
+
+2010-07-08 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r62765.
+ http://trac.webkit.org/changeset/62765
+ https://bugs.webkit.org/show_bug.cgi?id=41840
+
+ All jscore and layout tests crash on Qt bot (Requested by Ossy
+ on #webkit).
+
+ * wtf/FastMalloc.cpp:
+ (WTF::TCMalloc_PageHeap::initializeScavenger):
+ (WTF::TCMalloc_PageHeap::signalScavenger):
+ (WTF::TCMalloc_PageHeap::scavengerThread):
+
+2010-07-08 Andreas Kling <andreas.kling@nokia.com>
+
+ Reviewed by Oliver Hunt.
+
+ Interpreter: Crash in op_load_varargs on 64-bit
+ https://bugs.webkit.org/show_bug.cgi?id=41795
+
+ Added missing cast of argCount to int32_t in op_load_varargs.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+
+2010-07-08 Patrick Gansterer <paroga@paroga.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Make FastMalloc more portable.
+ https://bugs.webkit.org/show_bug.cgi?id=41790
+
+ Use WTF::Mutex instead of pthread_mutex_t and
+ replace pthread_cond_t with WTF::ThreadCondition.
+
+ * wtf/FastMalloc.cpp:
+ (WTF::TCMalloc_PageHeap::initializeScavenger):
+ (WTF::TCMalloc_PageHeap::signalScavenger):
+ (WTF::TCMalloc_PageHeap::scavengerThread):
+
+2010-07-08 Patrick Gansterer <paroga@paroga.com>
+
+ Reviewed by Darin Adler.
+
+ Remove needless #include <fcntl.h> from TCSystemAlloc.cpp.
+ https://bugs.webkit.org/show_bug.cgi?id=41777
+
+ * wtf/TCSystemAlloc.cpp:
+
+2010-07-07 Darin Adler <darin@apple.com>
+
+ Fixed build in configurations like PowerPC.
+
+ * runtime/RegExpConstructor.cpp: Added include of PassOwnPtr.h.
+ * runtime/RegExpObject.cpp: Ditto.
+ * wtf/SizeLimits.cpp: Changed compile time assertion to work
+ even on platforms where two bool members do not end up taking
+ the same size as one int member!
+
+2010-07-07 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Lazy mode of parser allows invalid syntax in object literals.
+ https://bugs.webkit.org/show_bug.cgi?id=41809
+
+ Make the parser itself validate getter and setter syntax rather
+ than offloading it to the AST builder.
+
+ * parser/ASTBuilder.h:
+ (JSC::ASTBuilder::createGetterOrSetterProperty):
+ * parser/JSParser.cpp:
+ (JSC::JSParser::parseProperty):
+
+2010-07-07 Dumitru Daniliuc <dumi@chromium.org>
+
+ Reviewed by Adam Roben.
+
+ Revert r62689.
+ https://bugs.webkit.org/show_bug.cgi?id=41804
+
+ * runtime/Collector.cpp:
+ (JSC::Heap::freeBlocks):
+
+2010-07-07 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Sam Weinig.
+
+ Add reverseFind to Vector and deploy in HTML5 parser
+ https://bugs.webkit.org/show_bug.cgi?id=41778
+
+ This method seems generally useful. I'm slightly surprised we don't
+ have it already.
+
+ * wtf/Vector.h:
+ (WTF::::reverseFind):
+
+2010-07-07 Darin Adler <darin@apple.com>
+
+ Reviewed by Adam Barth.
+
+ Turn on adoptRef assertion for RefCounted
+ https://bugs.webkit.org/show_bug.cgi?id=41547
+
+ * wtf/CrossThreadRefCounted.h: Fixed include style. Includes of other
+ WTF headers should use "" includes; consistent in most WTF headers.
+ Added a call to relaxAdoptionRequirement.
+
+ * wtf/RefCounted.h: Fixed include style. Removed LOOSE_REF_COUNTED.
+ Added relaxAdoptionRequirement.
+
+2010-07-07 Anders Carlsson <andersca@apple.com>
+
+ Try to fix the Windows build.
+
+ * runtime/Collector.cpp:
+ (JSC::Heap::freeBlocks):
+
+2010-07-07 Darin Adler <darin@apple.com>
+
+ Reviewed by Adam Barth.
+
+ More OwnPtr work
+ https://bugs.webkit.org/show_bug.cgi?id=41727
+
+ * API/JSCallbackObject.h:
+ (JSC::JSCallbackObjectData::setPrivateProperty): Use adoptPtr.
+ * API/JSCallbackObjectFunctions.h:
+ (JSC::JSCallbackObject::JSCallbackObject): Ditto.
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::CodeBlock): Ditto.
+ * bytecode/CodeBlock.h:
+ (JSC::CodeBlock::createRareDataIfNecessary): Ditto.
+ * parser/Nodes.cpp:
+ (JSC::ScopeNode::ScopeNode): Ditto.
+ * parser/ParserArena.cpp:
+ (JSC::ParserArena::ParserArena): Ditto.
+ * runtime/Arguments.h:
+ (JSC::Arguments::Arguments): Ditto.
+ * runtime/Executable.cpp:
+ (JSC::EvalExecutable::compile): Ditto.
+ (JSC::ProgramExecutable::compile): Ditto.
+ (JSC::FunctionExecutable::compileForCall): Ditto.
+ (JSC::FunctionExecutable::compileForConstruct): Ditto.
+ (JSC::FunctionExecutable::reparseExceptionInfo): Ditto.
+ (JSC::EvalExecutable::reparseExceptionInfo): Ditto.
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::sort): Ditto.
+ * runtime/RegExpConstructor.cpp:
+ (JSC::RegExpConstructor::RegExpConstructor): Ditto.
+ * runtime/RegExpObject.cpp:
+ (JSC::RegExpObject::RegExpObject): Ditto.
+ * runtime/SmallStrings.cpp:
+ (JSC::SmallStrings::createSingleCharacterString): Ditto.
+ (JSC::SmallStrings::singleCharacterStringRep): Ditto.
+
+ * wtf/unicode/icu/CollatorICU.cpp:
+ (WTF::Collator::userDefault): Use adoptPtr.
+ * yarr/RegexInterpreter.cpp:
+ (JSC::Yarr::ByteCompiler::ByteCompiler): Ditto.
+ (JSC::Yarr::ByteCompiler::compile): Ditto.
+ (JSC::Yarr::ByteCompiler::regexBegin): Ditto.
+ (JSC::Yarr::byteCompileRegex): Ditto.
+ * yarr/RegexInterpreter.h:
+ (JSC::Yarr::BytecodePattern::BytecodePattern): Ditto.
+
+2010-07-07 Darin Adler <darin@apple.com>
+
+ Reviewed by Adam Barth.
+
+ Make clear set the pointer to 0 before deletion
+ https://bugs.webkit.org/show_bug.cgi?id=41727
+
+ * wtf/OwnArrayPtr.h: Changed code so we always set the pointer to its new
+ value before deleting the old one, including in the set function and the
+ clear function. This required changing safeDelete.
+ * wtf/OwnPtr.h: Ditto. Also removed some extra null checks.
+ * wtf/PassOwnPtr.h: Ditto.
+
+ * wtf/PassRefPtr.h: Changed code so we always set the pointer to its new
+ value before deref'ing the old one in the clear function. Also added a
+ leakRef function for NonNullPassRefPtr.
+ * wtf/RefPtr.h: Ditto.
+
+ * wtf/gobject/GOwnPtr.h: More of the same.
+ * wtf/gobject/GRefPtr.h: Ditto.
+
+2010-07-07 Zoltan Herczeg <zherczeg@webkit.org>
+
+ Reviewed by Oliver Hunt.
+
+ Refactored string parsing inside the lexer
+ https://bugs.webkit.org/show_bug.cgi?id=41606
+
+ Does not use goto. Although the last sunspider
+ parse-only tests yields 1.044x speedup, I think the
+ patch can have a slight improvement at most.
+
+ * parser/Lexer.cpp:
+ (JSC::singleEscape):
+ (JSC::Lexer::parseString):
+ (JSC::Lexer::lex):
+ * parser/Lexer.h:
+
+2010-07-06 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Make it possible to have both the JIT and Interpreter available in a single build
+ https://bugs.webkit.org/show_bug.cgi?id=41722
+
+ Separate the concept of !ENABLE(JIT) and ENABLE(INTERPRETER) and make it possible
+ to have both JIT and INTERPRETER enabled at the same time. This doesn't add
+ support for mix mode execution, but it does allow a single build to contain all
+ the code needed to use either the interpreter or the jit.
+
+ If both ENABLE(INTERPRETER) and ENABLE(JIT) are true then setting the environment
+ variable JSC_FORCE_INTERPRETER will force JSC to use the interpreter.
+
+ This patch basically consists of replacing !ENABLE(JIT) with ENABLE(INTERPRETER),
+ or converting #if ENABLE(JIT) ... #else ... into #if ENABLE(JIT) ... #endif
+ #if ENABLE(INTERPRETER), etc. There are also a few functions that need to be
+ renamed to resolve return type ambiguity.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::~CodeBlock):
+ (JSC::CodeBlock::shrinkToFit):
+ * bytecode/CodeBlock.h:
+ * interpreter/CallFrame.h:
+ (JSC::ExecState::returnVPC):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::unwindCallFrame):
+ (JSC::Interpreter::throwException):
+ (JSC::Interpreter::execute):
+ (JSC::Interpreter::executeCall):
+ (JSC::Interpreter::executeConstruct):
+ (JSC::Interpreter::prepareForRepeatCall):
+ (JSC::Interpreter::privateExecute):
+ (JSC::Interpreter::retrieveLastCaller):
+ * interpreter/Interpreter.h:
+ * runtime/ArrayPrototype.cpp:
+ (JSC::isNumericCompareFunction):
+ * runtime/Executable.cpp:
+ (JSC::EvalExecutable::generateJITCode):
+ (JSC::ProgramExecutable::generateJITCode):
+ (JSC::FunctionExecutable::generateJITCodeForCall):
+ (JSC::FunctionExecutable::generateJITCodeForConstruct):
+ (JSC::FunctionExecutable::reparseExceptionInfo):
+ (JSC::EvalExecutable::reparseExceptionInfo):
+ * runtime/JSFunction.cpp:
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData):
+ * runtime/JSGlobalData.h:
+ (JSC::JSGlobalData::canUseJIT):
+ * wtf/Platform.h:
+
+2010-07-06 Darin Adler <darin@apple.com>
+
+ Reviewed by Adam Barth.
+
+ Add adoptPtr and leakPtr functions for OwnPtr and PassOwnPtr
+ https://bugs.webkit.org/show_bug.cgi?id=41320
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::reparseForExceptionInfoIfNecessary): Use assignment
+ instead of set since the result of reparseExceptionInfo is now a
+ PassOwnPtr.
+
+ * bytecode/CodeBlock.h: Change extractExceptionInfo to return a
+ PassOwnPtr instead of a raw pointer.
+
+ * runtime/Executable.cpp:
+ (JSC::FunctionExecutable::reparseExceptionInfo): Return a PassOwnPtr.
+ (JSC::EvalExecutable::reparseExceptionInfo): Ditto.
+ (JSC::ProgramExecutable::reparseExceptionInfo): Added. This was
+ in the header before, but it's better to not have it there to reduce
+ header dependencies. Return a PassOwnPtr.
+
+ * runtime/Executable.h: Made reparseExceptionInfo return a PassOwnPtr,
+ and put it in the private sections of classes other than the base class.
+
+ * wtf/MessageQueue.h:
+ (WTF::MessageQueue::append): Use leakPtr instead of release.
+ (WTF::MessageQueue::appendAndCheckEmpty): Ditto.
+ (WTF::MessageQueue::prepend): Ditto.
+
+ * wtf/OwnPtr.h: Tweaked formatting. Changed the release function to return
+ a PassOwnPtr rather than a raw pointer. Added a leakPtr function that
+ returns a raw pointer. Put the constructor that takes a raw pointer and
+ the set function into a section guarded by LOOSE_OWN_PTR. Adapted to the
+ new adoptPtr function from PassOwnPtr.h.
+
+ * wtf/PassOwnPtr.h: Tweaked formatting. Renamed the release function
+ to leakPtr. Added an adoptPtr function that creates a new PassOwnPtr.
+ Put the constructor and assignment operators that take a raw pointer
+ into a section guarded by LOOSE_PASS_OWN_PTR.
+
+2010-07-06 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Darin Adler
+
+ Update comment in StringExtras.h to be more accurate.
+
+ * wtf/StringExtras.h:
+
+2010-07-06 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r62511.
+ http://trac.webkit.org/changeset/62511
+ https://bugs.webkit.org/show_bug.cgi?id=41686
+
+ Breaks Linux/64bit compilation (Requested by xan_ on #webkit).
+
+ * jit/ExecutableAllocator.cpp:
+ * jit/ExecutableAllocatorFixedVMPool.cpp:
+ (JSC::FixedVMPoolAllocator::FixedVMPoolAllocator):
+ (JSC::FixedVMPoolAllocator::free):
+ (JSC::ExecutablePool::systemAlloc):
+ * jit/ExecutableAllocatorPosix.cpp:
+ (JSC::ExecutableAllocator::reprotectRegion):
+ (JSC::ExecutableAllocator::cacheFlush):
+ * jit/ExecutableAllocatorSymbian.cpp:
+ * jit/ExecutableAllocatorWin.cpp:
+ * wtf/Platform.h:
+
+2010-07-05 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ https://bugs.webkit.org/show_bug.cgi?id=41641
+
+ Update compile flags to allow use of ExecutableAllocatorFixedVMPool on platforms
+ other than x86-64 (this may be useful on 32-bit platforms, too).
+
+ Simplify ifdefs by dividing into thwo broad allocation strategies
+ (ENABLE_EXECUTABLE_ALLOCATOR_FIXED & ENABLE_EXECUTABLE_ALLOCATOR_DEMAND).
+
+ Rename constant used in the code to have names descriptive of their purpose,
+ rather than their specific value on a given platform.
+
+ * jit/ExecutableAllocator.cpp:
+ (JSC::ExecutableAllocator::reprotectRegion):
+ (JSC::ExecutableAllocator::cacheFlush):
+ * jit/ExecutableAllocatorFixedVMPool.cpp:
+ (JSC::FixedVMPoolAllocator::FixedVMPoolAllocator):
+ (JSC::FixedVMPoolAllocator::free):
+ (JSC::ExecutablePool::systemAlloc):
+ * jit/ExecutableAllocatorPosix.cpp:
+ * jit/ExecutableAllocatorSymbian.cpp:
+ * jit/ExecutableAllocatorWin.cpp:
+ * wtf/Platform.h:
+
+2010-07-05 Steve Block <steveblock@google.com>
+
+ Reviewed by Darin Adler.
+
+ ThreadingPthreads.cpp should use JNIUtility.h on Android, not outdated jni_utility.h
+ https://bugs.webkit.org/show_bug.cgi?id=41594
+
+ * wtf/ThreadingPthreads.cpp:
+
+2010-07-04 Mark Rowe <mrowe@apple.com>
+
+ Build fix after r62456.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute): Be slightly more consistent in using uint32_t to prevent
+ warnings about comparisons between signed and unsigned types, and attempts to call an overload
+ of std::min that doesn't exist.
+
+2010-07-02 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ Patch for https://bugs.webkit.org/show_bug.cgi?id=41553
+ Make StringExtras.h versions of snprintf and vsnprintf match the unix versions.
+
+ - MSVC does not ensure the buffers are null terminated as the unix versions do.
+
+ * runtime/JSGlobalObjectFunctions.cpp: Cleanup includes.
+ * runtime/UString.cpp: Clean up includes.
+ (JSC::UString::from): Don't pass sizeof(buf) - 1, that is wrong.
+ * wtf/StringExtras.h:
+ (snprintf): Ensure null termination of buffer.
+ (vsnprintf): Ditto.
+
+2010-07-03 Yong Li <yoli@rim.com>
+
+ Reviewed by Darin Adler.
+
+ Make Arguments::MaxArguments clamping work for numbers >= 0x80000000 in
+ the interpreter as well as the JIT.
+
+ https://bugs.webkit.org/show_bug.cgi?id=41351
+ rdar://problem/8142141
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute): Fix signed integer overflow problem
+ in op_load_varargs handling. 0xFFFFFFFF was read as -1.
+
+2010-06-26 Jeremy Orlow <jorlow@chromium.org>
+
+ Reviewed by Dumitru Daniliuc.
+
+ Support for keys and in-memory storage for IndexedDB
+ https://bugs.webkit.org/show_bug.cgi?id=41252
+
+ Set the role to Private.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2010-07-02 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Move BOM handling out of the lexer and parser
+ https://bugs.webkit.org/show_bug.cgi?id=41539
+
+ Doing the BOM stripping in the lexer meant that we could
+ end up having to strip the BOMs from a source multiple times.
+ To deal with this we now require all strings provided by
+ a SourceProvider to already have had the BOMs stripped.
+ This also simplifies some of the lexer logic.
+
+ * parser/Lexer.cpp:
+ (JSC::Lexer::setCode):
+ (JSC::Lexer::sourceCode):
+ * parser/SourceProvider.h:
+ (JSC::SourceProvider::SourceProvider):
+ (JSC::UStringSourceProvider::create):
+ (JSC::UStringSourceProvider::getRange):
+ (JSC::UStringSourceProvider::UStringSourceProvider):
+ * wtf/text/StringImpl.h:
+ (WebCore::StringImpl::copyStringWithoutBOMs):
+
+2010-07-03 Patrick Gansterer <paroga@paroga.com>
+
+ Reviewed by Kent Tamura.
+
+ [WINCE] Implement Unicode::isAlphanumeric and Unicode::isArabicChar.
+ https://bugs.webkit.org/show_bug.cgi?id=41411
+
+ * wtf/unicode/wince/UnicodeWince.cpp:
+ (WTF::Unicode::isAlphanumeric):
+ * wtf/unicode/wince/UnicodeWince.h:
+ (WTF::Unicode::isArabicChar):
+
+2010-07-03 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Kent Tamura.
+
+ [BREWMP] Change the CRASH() macro to print "WebKit CRASH" log.
+ https://bugs.webkit.org/show_bug.cgi?id=41524
+
+ Print "WebKit CRASH" before crashing.
+
+ * wtf/Assertions.h:
+
+2010-07-02 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 41565 - Repatching in ARMv7Assembler::repatchLoadPtrToLEA is broken
+
+ This method tried to repatch a LDR (T2) into an ADD (T3) - but it only
+ repatches the first instruction word. The layout of the fields in the
+ second word is different, and also needs repatching.
+
+ * assembler/ARMv7Assembler.h:
+ (JSC::ARMv7Assembler::repatchLoadPtrToLEA):
+
+2010-07-02 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Clamp the number of arguments supported by function.apply
+ https://bugs.webkit.org/show_bug.cgi?id=41351
+ <rdar://problem/8142141>
+
+ Add clamping logic to function.apply similar to that
+ enforced by firefox. We have a smaller clamp than
+ firefox as our calling convention means that stack
+ usage is proportional to argument count -- the firefox
+ limit is larger than you could actually call.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+ * runtime/Arguments.h:
+ (JSC::Arguments::):
+
+2010-07-02 Chao-ying Fu <fu@mips.com>
+
+ Reviewed by Oliver Hunt.
+
+ Re-enable JIT_OPTIMIZE_NATIVE_CALL on MIPS
+ https://bugs.webkit.org/show_bug.cgi?id=40179
+
+ Add the MIPS part to re-enable JIT_OPTIMIZE_NATIVE_CALL.
+
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::privateCompileCTINativeCall):
+ * wtf/Platform.h:
+
+2010-07-02 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 41552 - Clean up ARMv7 vfp code generation
+ Emit separate opcode individually, remove magic numbers.
+
+ Also remove invalid assert from JSImmediate (number cells are not CELL_MASK aligned).
+
+ * assembler/ARMv7Assembler.h:
+ (JSC::ARMv7Assembler::):
+ (JSC::ARMv7Assembler::vadd_F64):
+ (JSC::ARMv7Assembler::vcmp_F64):
+ (JSC::ARMv7Assembler::vcvt_F64_S32):
+ (JSC::ARMv7Assembler::vcvtr_S32_F64):
+ (JSC::ARMv7Assembler::vdiv_F64):
+ (JSC::ARMv7Assembler::vldr):
+ (JSC::ARMv7Assembler::vmov_F64_0):
+ (JSC::ARMv7Assembler::vmov):
+ (JSC::ARMv7Assembler::vmrs):
+ (JSC::ARMv7Assembler::vmul_F64):
+ (JSC::ARMv7Assembler::vstr):
+ (JSC::ARMv7Assembler::vsub_F64):
+ (JSC::ARMv7Assembler::VFPOperand::VFPOperand):
+ (JSC::ARMv7Assembler::VFPOperand::bits1):
+ (JSC::ARMv7Assembler::VFPOperand::bits4):
+ (JSC::ARMv7Assembler::vcvtOp):
+ (JSC::ARMv7Assembler::ARMInstructionFormatter::vfpOp):
+ (JSC::ARMv7Assembler::ARMInstructionFormatter::vfpMemOp):
+ * assembler/MacroAssemblerARMv7.h:
+ (JSC::MacroAssemblerARMv7::branchDouble):
+ * runtime/JSImmediate.h:
+ (JSC::JSValue::isCell):
+
+2010-07-02 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r62410.
+ http://trac.webkit.org/changeset/62410
+ https://bugs.webkit.org/show_bug.cgi?id=41549
+
+ accursed last minute changes (Requested by olliej on #webkit).
+
+ * parser/Lexer.cpp:
+ (JSC::Lexer::setCode):
+ (JSC::Lexer::copyCodeWithoutBOMs):
+ (JSC::Lexer::sourceCode):
+ * parser/SourceProvider.h:
+ (JSC::):
+ (JSC::SourceProvider::SourceProvider):
+ (JSC::SourceProvider::hasBOMs):
+ (JSC::UStringSourceProvider::create):
+ (JSC::UStringSourceProvider::getRange):
+ (JSC::UStringSourceProvider::UStringSourceProvider):
+ * wtf/text/StringImpl.h:
+
+2010-07-02 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ Patch for https://bugs.webkit.org/show_bug.cgi?id=41548
+ Use snprintf instead of sprintf everywhere in JavaScriptCore
+
+ * runtime/JSGlobalObjectFunctions.cpp:
+ (JSC::encode):
+ (JSC::globalFuncEscape):
+ * runtime/UString.cpp:
+ (JSC::UString::from):
+
+2010-07-02 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Move BOM handling out of the lexer and parser
+ https://bugs.webkit.org/show_bug.cgi?id=41539
+
+ Doing the BOM stripping in the lexer meant that we could
+ end up having to strip the BOMs from a source multiple times.
+ To deal with this we now require all strings provided by
+ a SourceProvider to already have had the BOMs stripped.
+ This also simplifies some of the lexer logic.
+
+ * parser/Lexer.cpp:
+ (JSC::Lexer::setCode):
+ (JSC::Lexer::sourceCode):
+ * parser/SourceProvider.h:
+ (JSC::SourceProvider::SourceProvider):
+ (JSC::UStringSourceProvider::create):
+ (JSC::UStringSourceProvider::getRange):
+ (JSC::UStringSourceProvider::UStringSourceProvider):
+ * wtf/text/StringImpl.h:
+ (WebCore::StringImpl::copyStringWithoutBOMs):
+
+2010-07-02 Renata Hodovan <reni@inf.u-szeged.hu>
+
+ Reviewed by Oliver Hunt.
+
+ [ Updated after rollout. ]
+
+ Merged RegExp constructor and RegExp::create methods.
+ Both functions are called with three parameters and check whether
+ flags (the third param) is given or not.
+ Avoid extra hash lookups in RegExpCache::create by passing a pre-computed
+ iterator parameter.
+ https://bugs.webkit.org/show_bug.cgi?id=41055
+
+ * runtime/RegExp.cpp:
+ (JSC::RegExp::RegExp):
+ * runtime/RegExp.h:
+ * runtime/RegExpCache.cpp:
+ (JSC::RegExpCache::lookupOrCreate):
+ (JSC::RegExpCache::create):
+ * runtime/RegExpCache.h:
+
+2010-07-02 Martin Robinson <mrobinson@igalia.com>
+
+ Unreviewed. Build fix for GTK+.
+
+ Build Lexer.lut.h with the rest of the .lut.h files. Later these should
+ all probably be moved to DerivedSources.
+
+ * GNUmakefile.am:
+
+2010-06-23 Martin Robinson <mrobinson@igalia.com>
+
+ Reviewed by Gustavo Noronha Silva.
+
+ [GTK] Separate DerivedSources per-project
+ https://bugs.webkit.org/show_bug.cgi?id=41109
+
+ Generate JavaScriptCore derived sources in <builddir>/DerivedSources/JavaScriptCore.
+
+ * GNUmakefile.am:
+
+2010-07-02 Peter Varga <pvarga@inf.u-szeged.hu>
+
+ Reviewed by Oliver Hunt.
+
+ The alternativeFrameLocation value is wrong in the emitDisjunction function in
+ case of PatternTerm::TypeParentheticalAssertion. This value needs to be
+ computed from term.frameLocation instead of term.inputPosition. This mistake caused glibc
+ memory corruption in some cases.
+ Layout test added for checking of TypeParentheticalAssertion case.
+ https://bugs.webkit.org/show_bug.cgi?id=41458
+
+ * yarr/RegexInterpreter.cpp:
+ (JSC::Yarr::ByteCompiler::emitDisjunction):
+
+2010-07-01 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Add a FixedArray template to encapsulate fixed length arrays
+ https://bugs.webkit.org/show_bug.cgi?id=41506
+
+ This new type is used in place of fixed length C arrays so
+ that debug builds can guard against attempts to go beyond
+ the end of the array.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * bytecode/Opcode.cpp:
+ (JSC::OpcodeStats::~OpcodeStats):
+ * pcre/pcre_compile.cpp:
+ (calculateCompiledPatternLength):
+ * runtime/Collector.cpp:
+ (JSC::Heap::allocateBlock):
+ (JSC::Heap::allocate):
+ * runtime/Collector.h:
+ (JSC::CollectorBitmap::clearAll):
+ * runtime/CollectorHeapIterator.h:
+ (JSC::CollectorHeapIterator::operator*):
+ * runtime/DateInstanceCache.h:
+ * runtime/JSString.cpp:
+ (JSC::JSString::replaceCharacter):
+ * runtime/JSString.h:
+ (JSC::RopeBuilder::JSStringFinalizerStruct::):
+ * runtime/NumericStrings.h:
+ * runtime/RegExpCache.h:
+ * runtime/SmallStrings.h:
+ (JSC::SmallStrings::singleCharacterStrings):
+ * wtf/AVLTree.h:
+ * wtf/FixedArray.h: Added.
+ (WTF::FixedArray::operator[]):
+ (WTF::FixedArray::data):
+
+2010-07-01 Zoltan Herczeg <zherczeg@webkit.org>
+
+ Reviewed by Oliver Hunt.
+
+ Improve the main lexer switch by mapping input characters to their type
+ https://bugs.webkit.org/show_bug.cgi?id=41459
+
+ Sunsipder: no change (from 532.9ms to 531.5ms)
+ SunSpider --parse-only: 1.025x as fast (from 33.1ms to 32.3ms)
+
+ * parser/Lexer.cpp:
+ (JSC::):
+ (JSC::Lexer::lex):
+
+2010-07-01 Sam Weinig <sam@webkit.org>
+
+ Rubber-stamped by Ander Carlsson.
+
+ Define HAVE_HOSTED_CORE_ANIMATION on Snow Leopard.
+
+ * wtf/Platform.h:
+
+2010-07-01 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 41490 - Add missing operations to MacroAssemblerARMv7
+ Also, make single, double, quad register numbers in ARMv7Assembler distinct & strongly typed.
+
+ * assembler/ARMv7Assembler.h:
+ (JSC::ARMRegisters::):
+ (JSC::ARMRegisters::asSingle):
+ (JSC::ARMRegisters::asDouble):
+ (JSC::VFPImmediate::VFPImmediate):
+ (JSC::VFPImmediate::isValid):
+ (JSC::VFPImmediate::value):
+ (JSC::ARMv7Assembler::singleRegisterMask):
+ (JSC::ARMv7Assembler::doubleRegisterMask):
+ (JSC::ARMv7Assembler::):
+ (JSC::ARMv7Assembler::add_S):
+ (JSC::ARMv7Assembler::neg):
+ (JSC::ARMv7Assembler::orr_S):
+ (JSC::ARMv7Assembler::sub):
+ (JSC::ARMv7Assembler::sub_S):
+ (JSC::ARMv7Assembler::vadd_F64):
+ (JSC::ARMv7Assembler::vcmp_F64):
+ (JSC::ARMv7Assembler::vcvt_F64_S32):
+ (JSC::ARMv7Assembler::vcvtr_S32_F64):
+ (JSC::ARMv7Assembler::vdiv_F64):
+ (JSC::ARMv7Assembler::vldr):
+ (JSC::ARMv7Assembler::vmov_F64_0):
+ (JSC::ARMv7Assembler::vmov):
+ (JSC::ARMv7Assembler::vmul_F64):
+ (JSC::ARMv7Assembler::vstr):
+ (JSC::ARMv7Assembler::vsub_F64):
+ (JSC::ARMv7Assembler::vcvt):
+ (JSC::ARMv7Assembler::vmem):
+ * assembler/AbstractMacroAssembler.h:
+ * assembler/MacroAssemblerARM.h:
+ * assembler/MacroAssemblerARMv7.h:
+ (JSC::MacroAssemblerARMv7::fpTempRegisterAsSingle):
+ (JSC::MacroAssemblerARMv7::neg32):
+ (JSC::MacroAssemblerARMv7::loadDouble):
+ (JSC::MacroAssemblerARMv7::divDouble):
+ (JSC::MacroAssemblerARMv7::convertInt32ToDouble):
+ (JSC::MacroAssemblerARMv7::branchConvertDoubleToInt32):
+ (JSC::MacroAssemblerARMv7::zeroDouble):
+ (JSC::MacroAssemblerARMv7::branchOr32):
+ (JSC::MacroAssemblerARMv7::set32):
+ (JSC::MacroAssemblerARMv7::set8):
+ * assembler/MacroAssemblerMIPS.h:
+ * assembler/MacroAssemblerX86Common.h:
+
+2010-07-01 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Improve reentrancy logic in polymorphic cache stubs
+ <https://bugs.webkit.org/show_bug.cgi?id=41482>
+ <rdar://problem/8094380>
+
+ Make the polymorphic cache stubs handle reentrancy
+ better.
+
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+ (JSC::getPolymorphicAccessStructureListSlot):
+
+2010-07-01 Antti Koivisto <koivisto@iki.fi>
+
+ Revert accidental commit.
+
+ * runtime/Collector.cpp:
+ (JSC::Heap::allocateBlock):
+
+2010-06-30 Darin Adler <darin@apple.com>
+
+ Reviewed by Adam Barth.
+
+ Add assertion, off by default, for when you forget to do adoptRef
+ https://bugs.webkit.org/show_bug.cgi?id=41422
+
+ * wtf/PassRefPtr.h: Tweaked formatting. Added a new adopted
+ function, called on the pointer by adoptRef, with an empty inline
+ default version, meant to be overloaded. Unified the inlining
+ with a macro named REF_DEREF_INLINE to make it clearer what's
+ going on in the refIfNotNull/derefIfNotNull functions. Renamed
+ releaseRef to leakRef, but left the old name in for compatibility
+ for now.
+
+ * wtf/RefCounted.h: Added code to require adoption and assert if
+ you don't call adoptRef. For now, it is turned off because of the
+ LOOSE_REF_COUNTED define in this header. Later we can turn it on
+ once we get everything working without asserting.
+
+2010-06-29 Michael Saboff <msaboff@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Bug 41238 - RegExp performance slow on Dromaeo benchmark
+
+ Other javascript engines appear to cache prior results of regular
+ expression operations.
+
+ Suggest adding some sort of caching mechanism to regular expression
+ processing.
+
+ Added a single entry cache of match() results to RegExp class.
+
+ Also added performance improvements to UString == operator.
+ First check the impls for equality. Then get the length of
+ each of the non-null impls. Next check the sizes for equality.
+ Then check the data for the case of different impls that point
+ to the same data (most likely due to substrings from the beginning of
+ another string). Lastly we check the underlying data for equality.
+
+ * runtime/RegExp.cpp:
+ (JSC::RegExp::RegExp):
+ (JSC::RegExp::match):
+ * runtime/RegExp.h:
+ * runtime/UString.h:
+ (JSC::operator==):
+
+2010-06-29 Nathan Lawrence <nlawrence@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ WTF::HashSet iterators are quasi-mutable. Changing the value through
+ dereferencing an iterator will not change the behavior of methods like
+ contains or find, but will change the behavior of iterating.
+
+ * wtf/HashSet.h:
+ (WTF::::begin):
+ (WTF::::end):
+ (WTF::::find):
+ (WTF::::remove):
+ * wtf/HashTable.h:
+
+2010-06-29 Martin Robinson <mrobinson@igalia.com>
+
+ Reviewed by Xan Lopez.
+
+ [GTK] Clean up the source lists in the GNUMakefile.am files
+ https://bugs.webkit.org/show_bug.cgi?id=41229
+
+ Clean up the GNUMakefile.am a little bit. Alphabetize and conglomerate
+ the source lists.
+
+ * GNUmakefile.am:
+
+2010-06-29 Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] Fix QtScript build after QScriptValuePrivate ctor changes
+ https://bugs.webkit.org/show_bug.cgi?id=41307
+
+ * qt/api/qscriptvalue_p.h:
+ (QScriptValuePrivate::prototype):
+ * qt/benchmarks/qscriptengine/qscriptengine.pro:
+
+2010-06-28 Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] QScriptEngine API should contain a newArray function
+ https://bugs.webkit.org/show_bug.cgi?id=39115
+
+ * qt/api/qscriptengine.cpp:
+ (QScriptEngine::newArray):
+ * qt/api/qscriptengine.h:
+ * qt/api/qscriptengine_p.cpp:
+ (QScriptEnginePrivate::newArray):
+ * qt/api/qscriptengine_p.h:
+ * qt/tests/qscriptengine/tst_qscriptengine.cpp:
+ (tst_QScriptEngine::newArray):
+
+2010-06-28 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Gustavo Noronha.
+
+ Install jsc as jsc-X where X is the major API version to allow
+ parallel installation of both GTK+ 2.x and 3.x versions.
+
+ * GNUmakefile.am:
+
+2010-06-28 John Gregg <johnnyg@google.com>
+
+ Reviewed by Kent Tamura.
+
+ add ENABLE_DIRECTORY_UPLOAD build support
+ https://bugs.webkit.org/show_bug.cgi?id=41100
+
+ * Configurations/FeatureDefines.xcconfig:
+
+2010-06-28 Xan Lopez <xlopez@igalia.com>
+
+ Revert to build jsc, since the tests expect this.
+
+ * GNUmakefile.am:
+
+2010-06-28 Zoltan Herczeg <zherczeg@webkit.org>
+
+ Reviewed by Oliver Hunt.
+
+ Only one character lookahead should be enough for the lexer
+ https://bugs.webkit.org/show_bug.cgi?id=41213
+
+ The lexer had 4 character lookahead before, which required
+ a complex shifting mechanism. This can be improved by using
+ only one character lookahead for most decisions, and a
+ peek() function as a fallback when it is absolutely necessary.
+
+ * parser/Lexer.cpp:
+ (JSC::Lexer::currentCharacter):
+ (JSC::Lexer::currentOffset):
+ (JSC::Lexer::setCode):
+ (JSC::Lexer::shift):
+ (JSC::Lexer::peek):
+ (JSC::Lexer::getUnicodeCharacter):
+ (JSC::Lexer::shiftLineTerminator):
+ (JSC::Lexer::lastTokenWasRestrKeyword):
+ (JSC::Lexer::lex):
+ (JSC::Lexer::scanRegExp):
+ (JSC::Lexer::skipRegExp):
+ * parser/Lexer.h:
+
+2010-06-28 Lucas De Marchi <lucas.demarchi@profusion.mobi>
+
+ Unreviewed build fix.
+
+ [EFL] Build fix for latest version of Ecore library.
+ Ecore recently changed return type of callbacks from int to Eina_Bool.
+
+ * wtf/efl/MainThreadEfl.cpp:
+ (WTF::timeoutFired): Return Eina_Bool instead of int.
+
+2010-06-28 Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] QScriptValue should have API for accessing object properties
+ https://bugs.webkit.org/show_bug.cgi?id=40903
+
+ Make possible to access properties inside QScriptValues. While this
+ still doesn't support the ResolveLocal parameter, it is already useful
+ for testing the API.
+
+ The tests from upstream QtScript weren't imported since most of them
+ depend on the setProperty() function as well. A simple test was created.
+
+ * qt/api/qscriptvalue.cpp:
+ (QScriptValue::property):
+ * qt/api/qscriptvalue.h:
+ (QScriptValue::):
+ * qt/api/qscriptvalue_p.h:
+ (QScriptValuePrivate::property):
+ * qt/tests/qscriptvalue/tst_qscriptvalue.cpp:
+ (tst_QScriptValue::propertySimple):
+ * qt/tests/qscriptvalue/tst_qscriptvalue.h:
+
+2010-06-28 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Gustavo Noronha.
+
+ [GTK] Add support for GTK+3
+ https://bugs.webkit.org/show_bug.cgi?id=41253
+
+ Suffix jsc with the API version of the library, so that
+ libwebkitgtk 1.x and 3.x can install jsc.
+
+ * GNUmakefile.am:
+
+2010-06-27 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Kent Tamura.
+
+ [BREWMP] Turn ENABLE(SINGLE_THREADED) on.
+ https://bugs.webkit.org/show_bug.cgi?id=41135
+
+ Brew MP does not support preemptive multi-threading.
+ Disable threading for Brew MP.
+
+ * wtf/Platform.h:
+
+2010-06-26 Tony Gentilcore <tonyg@chromium.org>
+
+ Reviewed by Dimitri Glazkov.
+
+ Add an ENABLE_WEB_TIMING option for enabling Web Timing support.
+ https://bugs.webkit.org/show_bug.cgi?id=38924
+
+ * Configurations/FeatureDefines.xcconfig:
+
+2010-06-25 Nathan Lawrence <nlawrence@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ We assume in testapi.c that the value aHeapRef refers to will not be
+ moved. When we have movable objects, this will not be the case.
+
+ * API/tests/testapi.c:
+ (main):
+
+2010-06-25 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r61924.
+ http://trac.webkit.org/changeset/61924
+ https://bugs.webkit.org/show_bug.cgi?id=41240
+
+ It was rolled out, but cq+ wasn't removed (Requested by Ossy_
+ on #webkit).
+
+ * runtime/RegExp.cpp:
+ (JSC::RegExp::RegExp):
+ (JSC::RegExp::create):
+ * runtime/RegExp.h:
+ * runtime/RegExpCache.cpp:
+ (JSC::RegExpCache::lookupOrCreate):
+ (JSC::RegExpCache::create):
+ * runtime/RegExpCache.h:
+
+2010-06-25 Renata Hodovan <reni@inf.u-szeged.hu>
+
+ Reviewed by Geoffrey Garen.
+
+ Merge RegExp constructor and RegExp::create methods into one.
+ Both of function are called with tree parameters and check whether
+ flags (the third param) is given or not.
+ Simplify hash lookups in RegExpCache::create with giving them an extra
+ iterator parameter.
+ https://bugs.webkit.org/show_bug.cgi?id=41055
+
+ * runtime/RegExp.cpp:
+ (JSC::RegExp::RegExp):
+ * runtime/RegExp.h:
+ * runtime/RegExpCache.cpp:
+ (JSC::RegExpCache::lookupOrCreate):
+ (JSC::RegExpCache::create):
+ * runtime/RegExpCache.h:
+
+2010-06-25 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Introduce QtScript benchmarks.
+
+ The QtScript performance should be tested regularly. The patch introduces
+ micro benchmarks for existing API.
+
+ [Qt] Performance of the QtScript API is not tested.
+ https://bugs.webkit.org/show_bug.cgi?id=40911
+
+ * qt/benchmarks/benchmarks.pri: Copied from JavaScriptCore/qt/tests/tests.pri.
+ * qt/benchmarks/benchmarks.pro: Added.
+ * qt/benchmarks/qscriptengine/qscriptengine.pro: Added.
+ * qt/benchmarks/qscriptengine/tst_qscriptengine.cpp: Added.
+ (tst_QScriptEngine::checkSyntax_data):
+ (tst_QScriptEngine::checkSyntax):
+ (tst_QScriptEngine::constructor):
+ (tst_QScriptEngine::evaluateString_data):
+ (tst_QScriptEngine::evaluateString):
+ (tst_QScriptEngine::evaluateProgram_data):
+ (tst_QScriptEngine::evaluateProgram):
+ (tst_QScriptEngine::newObject):
+ (tst_QScriptEngine::nullValue):
+ (tst_QScriptEngine::undefinedValue):
+ (tst_QScriptEngine::globalObject):
+ (tst_QScriptEngine::toStringHandle):
+ * qt/benchmarks/qscriptvalue/qscriptvalue.pro: Added.
+ * qt/benchmarks/qscriptvalue/tst_qscriptvalue.cpp: Added.
+ (tst_QScriptValue::tst_QScriptValue):
+ (tst_QScriptValue::~tst_QScriptValue):
+ (tst_QScriptValue::values_data):
+ (tst_QScriptValue::ctorBool):
+ (tst_QScriptValue::ctorReal):
+ (tst_QScriptValue::ctorNumber):
+ (tst_QScriptValue::ctorQString):
+ (tst_QScriptValue::ctorCString):
+ (tst_QScriptValue::ctorSpecial):
+ (tst_QScriptValue::ctorQScriptValue):
+ (tst_QScriptValue::isValid_data):
+ (tst_QScriptValue::isValid):
+ (tst_QScriptValue::isBool_data):
+ (tst_QScriptValue::isBool):
+ (tst_QScriptValue::isNumber_data):
+ (tst_QScriptValue::isNumber):
+ (tst_QScriptValue::isFunction_data):
+ (tst_QScriptValue::isFunction):
+ (tst_QScriptValue::isNull_data):
+ (tst_QScriptValue::isNull):
+ (tst_QScriptValue::isString_data):
+ (tst_QScriptValue::isString):
+ (tst_QScriptValue::isUndefined_data):
+ (tst_QScriptValue::isUndefined):
+ (tst_QScriptValue::isObject_data):
+ (tst_QScriptValue::isObject):
+ (tst_QScriptValue::isError_data):
+ (tst_QScriptValue::isError):
+ (tst_QScriptValue::toString_data):
+ (tst_QScriptValue::toString):
+ (tst_QScriptValue::toNumber_data):
+ (tst_QScriptValue::toNumber):
+ (tst_QScriptValue::toBool_data):
+ (tst_QScriptValue::toBool):
+ (tst_QScriptValue::toInteger_data):
+ (tst_QScriptValue::toInteger):
+ (tst_QScriptValue::toInt32_data):
+ (tst_QScriptValue::toInt32):
+ (tst_QScriptValue::toUInt32_data):
+ (tst_QScriptValue::toUInt32):
+ (tst_QScriptValue::toUInt16_data):
+ (tst_QScriptValue::toUInt16):
+ (tst_QScriptValue::toObject_data):
+ (tst_QScriptValue::toObject):
+ (tst_QScriptValue::equals_data):
+ (tst_QScriptValue::equals):
+ (tst_QScriptValue::strictlyEquals_data):
+ (tst_QScriptValue::strictlyEquals):
+ (tst_QScriptValue::instanceOf_data):
+ (tst_QScriptValue::instanceOf):
+
+2010-06-25 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Remove old js parser
+ https://bugs.webkit.org/show_bug.cgi?id=41222
+
+ Remove the old yacc parser, this also solves the tiger problem. Which
+ was a conflict between yacc generated token values and those in the
+ custom parser
+
+ * Android.mk:
+ * CMakeLists.txt:
+ * DerivedSources.make:
+ * DerivedSources.pro:
+ * GNUmakefile.am:
+ * JavaScriptCore.pro:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * parser/Grammar.y: Removed.
+ * parser/JSParser.cpp:
+ * parser/JSParser.h:
+ * parser/Lexer.cpp:
+ * parser/NodeConstructors.h:
+ (JSC::Node::Node):
+ * parser/Parser.cpp:
+ (JSC::Parser::parse):
+ * wtf/Platform.h:
+
+2010-06-25 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ New QtScript API; setPrototype() and prototype().
+
+ This patch implements QScriptValue's prototype accessors.
+
+ [Qt] QScriptValue should have accessors to a prototype.
+ https://bugs.webkit.org/show_bug.cgi?id=39356
+
+ * qt/api/qscriptvalue.cpp:
+ (QScriptValue::prototype):
+ (QScriptValue::setPrototype):
+ * qt/api/qscriptvalue.h:
+ * qt/api/qscriptvalue_p.h:
+ (QScriptValuePrivate::prototype):
+ (QScriptValuePrivate::setPrototype):
+ * qt/tests/qscriptvalue/tst_qscriptvalue.cpp:
+ (tst_QScriptValue::getSetPrototype):
+ * qt/tests/qscriptvalue/tst_qscriptvalue.h:
+
+2010-06-25 Lucas De Marchi <lucas.demarchi@profusion.mobi>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [CMake] Add option to enable JIT.
+ JIT is disabled by default, but now it's possible to enable it through
+ an option to CMake: -DENABLE_JIT will enable it.
+ https://bugs.webkit.org/show_bug.cgi?id=40936
+
+ * CMakeLists.txt: Add missing files and re-sort.
+
+2010-06-25 Lucas De Marchi <lucas.demarchi@profusion.mobi>
+
+ Reviewed by Gustavo Noronha Silva.
+
+ [CMake] Remove unused variable in EFL build system. It was previously
+ being used to set the flags of each port but it was superseded by
+ other flags.
+ https://bugs.webkit.org/show_bug.cgi?id=40931
+
+ * jsc/CMakeLists.txt:
+
+2010-06-25 Nathan Lawrence <nlawrence@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Aligning AssemblerBuffer to 128 bytes gives a 0.4% speedup on
+ sunspider.
+
+ * assembler/AssemblerBuffer.h:
+ (JSC::AssemblerBuffer::AssemblerBuffer):
+
+2010-06-25 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r61842.
+ http://trac.webkit.org/changeset/61842
+ https://bugs.webkit.org/show_bug.cgi?id=41208
+
+ It broke Windows build (Requested by Ossy_ on #webkit).
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops:
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * wtf/OwnPtrCommon.h:
+ * wtf/brew/OwnPtrBrew.h: Removed.
+ * wtf/win/OwnPtrWin.h: Removed.
+
+2010-06-25 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r61833.
+ http://trac.webkit.org/changeset/61833
+ https://bugs.webkit.org/show_bug.cgi?id=41205
+
+ It broke Leopard and GTK (Requested by Ossy_ on #webkit).
+
+ * runtime/RegExp.cpp:
+ (JSC::RegExp::RegExp):
+ (JSC::RegExp::create):
+ * runtime/RegExp.h:
+ * runtime/RegExpCache.cpp:
+ (JSC::RegExpCache::lookupOrCreate):
+ (JSC::RegExpCache::create):
+ * runtime/RegExpCache.h:
+
+2010-06-25 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Adam Barth.
+
+ Change OwnPtrCommon to include platform-specific headers
+ https://bugs.webkit.org/show_bug.cgi?id=40279
+
+ Adding new type to OwnPtrCommon needlessly causes all ports to do full rebuilds.
+ Change OwnPtrCommon to include platform-specific headers to avoid all ports rebuilds.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops:
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * wtf/OwnPtrCommon.h:
+ * wtf/brew/OwnPtrBrew.h: Added.
+ * wtf/win/OwnPtrWin.h: Added.
+
+2010-06-25 Patrick Gansterer <paroga@paroga.com>
+
+ Reviewed by Darin Adler.
+
+ Add the possibility for a head and footer section to create_jit_stubs.
+ https://bugs.webkit.org/show_bug.cgi?id=36050
+
+ * create_jit_stubs:
+
+2010-06-24 Renata Hodovan <reni@inf.u-szeged.hu>
+
+ Reviewed by Geoffrey Garen.
+
+ Merge RegExp constructor and RegExp::create methods into one.
+ Both of function are called with tree parameters and check whether
+ flags (the third param) is given or not.
+ Simplify hash lookups in RegExpCache::create with giving them an extra
+ iterator parameter.
+ https://bugs.webkit.org/show_bug.cgi?id=41055
+
+ * runtime/RegExp.cpp:
+ (JSC::RegExp::RegExp):
+ * runtime/RegExp.h:
+ * runtime/RegExpCache.cpp:
+ (JSC::RegExpCache::lookupOrCreate):
+ (JSC::RegExpCache::create):
+ * runtime/RegExpCache.h:
+
+2010-06-24 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Incorrect use of '+ 4' and 0 instead of tag and payload offsets in JSValue32_64
+ https://bugs.webkit.org/show_bug.cgi?id=41193
+
+ I noticed a use of '+ 4' in some of the 32_64 code paths and realised there
+ were a few places where endianness was being hardcoded. This patch fixes
+ the errors i could find through code inspection.
+
+ * jit/JITOpcodes32_64.cpp:
+ (JSC::JIT::emit_op_resolve_global):
+ * jit/JITPropertyAccess32_64.cpp:
+ (JSC::JIT::emit_op_get_by_val):
+ (JSC::JIT::emit_op_put_by_val):
+ (JSC::JIT::compileGetDirectOffset):
+ (JSC::JIT::privateCompilePutByIdTransition):
+ (JSC::JIT::patchGetByIdSelf):
+ (JSC::JIT::patchPutByIdReplace):
+
+2010-06-24 Oliver Hunt <oliver@apple.com>
+
+ Build fix
+
+ Temporarily get the tiger bot working again by disabling the
+ new JS parser. GCC on tiger is miscompiling the parser and
+ I don't have access to a tiger machine right now.
+
+ * wtf/Platform.h:
+
+ 2010-06-21 Nathan Lawrence <nlawrence@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ https://bugs.webkit.org/show_bug.cgi?id=40128
+ Fixed broken debug functionality.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::dumpRegisters):
+ Fixed to work with updated call frame.
+ * runtime/JSImmediate.h:
+ (JSC::JSValue::isCell):
+ Added assert for aligned cell.
+ * runtime/JSValue.cpp:
+ (JSC::JSValue::description):
+ Fixed to work with current JSValue implementation.
+ * runtime/JSZombie.cpp:
+ (JSC::JSZombie::leakedZombieStructure):
+ JSombies compile again.
+
+2010-06-24 Leandro Pereira <leandro@profusion.mobi>
+
+ Unreviewed build fix.
+
+ * CMakeLists.txt: Add JSParser.cpp.
+
+2010-06-24 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Single character string replacement may replace too many characters
+ https://bugs.webkit.org/show_bug.cgi?id=41138
+ <rdar://problem/8097496>
+
+ Simple fix to stop the rope path of single character replacement
+ once the first replacement occurs.
+
+ * runtime/JSString.cpp:
+ (JSC::JSString::replaceCharacter):
+
+2010-06-24 Gabor Loki <loki@webkit.org>
+
+ Reviewed by Gavin Barraclough.
+
+ Fix the length of instruction stream controlled by constant pool
+ https://bugs.webkit.org/show_bug.cgi?id=40293
+
+ The initial/maximum length of instruction stream (m_maxDistance) should
+ be set when the first constant arrives to the constant pool. Otherwise
+ the constant pool could be placed into an uninterrupted sequence.
+
+ * assembler/AssemblerBufferWithConstantPool.h:
+ (JSC::):
+
+2010-06-24 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ We assume bytecodeOffset will always return a value > 1,
+ so we adjust the failure case to return 1 instead of 0.
+
+ * bytecode/CodeBlock.h:
+ (JSC::CodeBlock::bytecodeOffset):
+
+2010-06-23 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Custom-written JavaScript parser
+ https://bugs.webkit.org/show_bug.cgi?id=34019
+
+ Implement a recursive descent parser similar to that used by V8 and
+ SpiderMonkey. Greater than 2x improvement in SunSpider parsing tests.
+
+ The parser consists of a JSParser class that uses a TreeBuilder to actually
+ build the AST. There are currently two builders -- the ASTBuilder and
+ SyntaxChecker which separate the job of building an AST for code generation
+ and simply checking syntactic correctness.
+
+ There's still some less than ideal code remaining in the parser to allow
+ us to retain the existing lexing code with minimal changes. We'll tidy
+ this up at a later date.
+
+ * GNUmakefile.am:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.pro:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * parser/ASTBuilder.h: Added.
+ (JSC::ASTBuilder::BinaryOpInfo::BinaryOpInfo):
+ (JSC::ASTBuilder::AssignmentInfo::AssignmentInfo):
+ (JSC::ASTBuilder::ASTBuilder):
+ (JSC::ASTBuilder::createSourceElements):
+ (JSC::ASTBuilder::varDeclarations):
+ (JSC::ASTBuilder::funcDeclarations):
+ (JSC::ASTBuilder::features):
+ (JSC::ASTBuilder::numConstants):
+ (JSC::ASTBuilder::appendToComma):
+ (JSC::ASTBuilder::createCommaExpr):
+ (JSC::ASTBuilder::createLogicalNot):
+ (JSC::ASTBuilder::createUnaryPlus):
+ (JSC::ASTBuilder::createVoid):
+ (JSC::ASTBuilder::thisExpr):
+ (JSC::ASTBuilder::createResolve):
+ (JSC::ASTBuilder::createObjectLiteral):
+ (JSC::ASTBuilder::createArray):
+ (JSC::ASTBuilder::createNumberExpr):
+ (JSC::ASTBuilder::createString):
+ (JSC::ASTBuilder::createBoolean):
+ (JSC::ASTBuilder::createNull):
+ (JSC::ASTBuilder::createBracketAccess):
+ (JSC::ASTBuilder::createDotAccess):
+ (JSC::ASTBuilder::createRegex):
+ (JSC::ASTBuilder::createNewExpr):
+ (JSC::ASTBuilder::createConditionalExpr):
+ (JSC::ASTBuilder::createAssignResolve):
+ (JSC::ASTBuilder::createFunctionExpr):
+ (JSC::ASTBuilder::createFunctionBody):
+ (JSC::ASTBuilder::createGetterOrSetterProperty):
+ (JSC::ASTBuilder::createArguments):
+ (JSC::ASTBuilder::createArgumentsList):
+ (JSC::ASTBuilder::createProperty):
+ (JSC::ASTBuilder::createPropertyList):
+ (JSC::ASTBuilder::createElementList):
+ (JSC::ASTBuilder::createFormalParameterList):
+ (JSC::ASTBuilder::createClause):
+ (JSC::ASTBuilder::createClauseList):
+ (JSC::ASTBuilder::setUsesArguments):
+ (JSC::ASTBuilder::createFuncDeclStatement):
+ (JSC::ASTBuilder::createBlockStatement):
+ (JSC::ASTBuilder::createExprStatement):
+ (JSC::ASTBuilder::createIfStatement):
+ (JSC::ASTBuilder::createForLoop):
+ (JSC::ASTBuilder::createForInLoop):
+ (JSC::ASTBuilder::createEmptyStatement):
+ (JSC::ASTBuilder::createVarStatement):
+ (JSC::ASTBuilder::createReturnStatement):
+ (JSC::ASTBuilder::createBreakStatement):
+ (JSC::ASTBuilder::createContinueStatement):
+ (JSC::ASTBuilder::createTryStatement):
+ (JSC::ASTBuilder::createSwitchStatement):
+ (JSC::ASTBuilder::createWhileStatement):
+ (JSC::ASTBuilder::createDoWhileStatement):
+ (JSC::ASTBuilder::createLabelStatement):
+ (JSC::ASTBuilder::createWithStatement):
+ (JSC::ASTBuilder::createThrowStatement):
+ (JSC::ASTBuilder::createDebugger):
+ (JSC::ASTBuilder::createConstStatement):
+ (JSC::ASTBuilder::appendConstDecl):
+ (JSC::ASTBuilder::appendStatement):
+ (JSC::ASTBuilder::addVar):
+ (JSC::ASTBuilder::combineCommaNodes):
+ (JSC::ASTBuilder::evalCount):
+ (JSC::ASTBuilder::appendBinaryExpressionInfo):
+ (JSC::ASTBuilder::operatorStackPop):
+ (JSC::ASTBuilder::operatorStackHasHigherPrecedence):
+ (JSC::ASTBuilder::getFromOperandStack):
+ (JSC::ASTBuilder::shrinkOperandStackBy):
+ (JSC::ASTBuilder::appendBinaryOperation):
+ (JSC::ASTBuilder::operatorStackAppend):
+ (JSC::ASTBuilder::popOperandStack):
+ (JSC::ASTBuilder::appendUnaryToken):
+ (JSC::ASTBuilder::unaryTokenStackLastType):
+ (JSC::ASTBuilder::unaryTokenStackLastStart):
+ (JSC::ASTBuilder::unaryTokenStackRemoveLast):
+ (JSC::ASTBuilder::assignmentStackAppend):
+ (JSC::ASTBuilder::createAssignment):
+ (JSC::ASTBuilder::Scope::Scope):
+ (JSC::ASTBuilder::setExceptionLocation):
+ (JSC::ASTBuilder::incConstants):
+ (JSC::ASTBuilder::usesThis):
+ (JSC::ASTBuilder::usesCatch):
+ (JSC::ASTBuilder::usesClosures):
+ (JSC::ASTBuilder::usesArguments):
+ (JSC::ASTBuilder::usesAssignment):
+ (JSC::ASTBuilder::usesWith):
+ (JSC::ASTBuilder::usesEval):
+ (JSC::ASTBuilder::createNumber):
+ (JSC::ASTBuilder::makeTypeOfNode):
+ (JSC::ASTBuilder::makeDeleteNode):
+ (JSC::ASTBuilder::makeNegateNode):
+ (JSC::ASTBuilder::makeBitwiseNotNode):
+ (JSC::ASTBuilder::makeMultNode):
+ (JSC::ASTBuilder::makeDivNode):
+ (JSC::ASTBuilder::makeAddNode):
+ (JSC::ASTBuilder::makeSubNode):
+ (JSC::ASTBuilder::makeLeftShiftNode):
+ (JSC::ASTBuilder::makeRightShiftNode):
+ (JSC::ASTBuilder::makeFunctionCallNode):
+ (JSC::ASTBuilder::makeBinaryNode):
+ (JSC::ASTBuilder::makeAssignNode):
+ (JSC::ASTBuilder::makePrefixNode):
+ (JSC::ASTBuilder::makePostfixNode):
+ * parser/JSParser.cpp: Added.
+ (JSC::JSParser::AllowInOverride::AllowInOverride):
+ (JSC::JSParser::AllowInOverride::~AllowInOverride):
+ (JSC::JSParser::token):
+ (JSC::JSParser::next):
+ (JSC::JSParser::consume):
+ (JSC::JSParser::match):
+ (JSC::JSParser::tokenStart):
+ (JSC::JSParser::tokenLine):
+ (JSC::JSParser::tokenEnd):
+ (JSC::JSParser::):
+ (JSC::JSParser::autoSemiColon):
+ (JSC::JSParser::canRecurse):
+ (JSC::JSParser::lastTokenEnd):
+ (JSC::jsParse):
+ (JSC::JSParser::JSParser):
+ (JSC::JSParser::parseProgram):
+ (JSC::JSParser::allowAutomaticSemicolon):
+ (JSC::JSParser::parseSourceElements):
+ (JSC::JSParser::parseVarDeclaration):
+ (JSC::JSParser::parseConstDeclaration):
+ (JSC::JSParser::parseDoWhileStatement):
+ (JSC::JSParser::parseWhileStatement):
+ (JSC::JSParser::parseVarDeclarationList):
+ (JSC::JSParser::parseConstDeclarationList):
+ (JSC::JSParser::parseForStatement):
+ (JSC::JSParser::parseBreakStatement):
+ (JSC::JSParser::parseContinueStatement):
+ (JSC::JSParser::parseReturnStatement):
+ (JSC::JSParser::parseThrowStatement):
+ (JSC::JSParser::parseWithStatement):
+ (JSC::JSParser::parseSwitchStatement):
+ (JSC::JSParser::parseSwitchClauses):
+ (JSC::JSParser::parseSwitchDefaultClause):
+ (JSC::JSParser::parseTryStatement):
+ (JSC::JSParser::parseDebuggerStatement):
+ (JSC::JSParser::parseBlockStatement):
+ (JSC::JSParser::parseStatement):
+ (JSC::JSParser::parseFormalParameters):
+ (JSC::JSParser::parseFunctionBody):
+ (JSC::JSParser::parseFunctionInfo):
+ (JSC::JSParser::parseFunctionDeclaration):
+ (JSC::JSParser::parseExpressionOrLabelStatement):
+ (JSC::JSParser::parseExpressionStatement):
+ (JSC::JSParser::parseIfStatement):
+ (JSC::JSParser::parseExpression):
+ (JSC::JSParser::parseAssignmentExpression):
+ (JSC::JSParser::parseConditionalExpression):
+ (JSC::isUnaryOp):
+ (JSC::JSParser::isBinaryOperator):
+ (JSC::JSParser::parseBinaryExpression):
+ (JSC::JSParser::parseProperty):
+ (JSC::JSParser::parseObjectLiteral):
+ (JSC::JSParser::parseArrayLiteral):
+ (JSC::JSParser::parsePrimaryExpression):
+ (JSC::JSParser::parseArguments):
+ (JSC::JSParser::parseMemberExpression):
+ (JSC::JSParser::parseUnaryExpression):
+ * parser/JSParser.h: Added.
+ (JSC::):
+ (JSC::JSTokenInfo::JSTokenInfo):
+ * parser/Lexer.cpp:
+ (JSC::Lexer::lex):
+ * parser/Lexer.h:
+ (JSC::Lexer::setLastLineNumber):
+ (JSC::Lexer::lastLineNumber):
+ * parser/NodeConstructors.h:
+ (JSC::Node::Node):
+ * parser/Parser.cpp:
+ (JSC::Parser::parse):
+ * parser/SyntaxChecker.h: Added.
+ (JSC::SyntaxChecker::SyntaxChecker):
+ (JSC::SyntaxChecker::createSourceElements):
+ (JSC::SyntaxChecker::makeFunctionCallNode):
+ (JSC::SyntaxChecker::appendToComma):
+ (JSC::SyntaxChecker::createCommaExpr):
+ (JSC::SyntaxChecker::makeAssignNode):
+ (JSC::SyntaxChecker::makePrefixNode):
+ (JSC::SyntaxChecker::makePostfixNode):
+ (JSC::SyntaxChecker::makeTypeOfNode):
+ (JSC::SyntaxChecker::makeDeleteNode):
+ (JSC::SyntaxChecker::makeNegateNode):
+ (JSC::SyntaxChecker::makeBitwiseNotNode):
+ (JSC::SyntaxChecker::createLogicalNot):
+ (JSC::SyntaxChecker::createUnaryPlus):
+ (JSC::SyntaxChecker::createVoid):
+ (JSC::SyntaxChecker::thisExpr):
+ (JSC::SyntaxChecker::createResolve):
+ (JSC::SyntaxChecker::createObjectLiteral):
+ (JSC::SyntaxChecker::createArray):
+ (JSC::SyntaxChecker::createNumberExpr):
+ (JSC::SyntaxChecker::createString):
+ (JSC::SyntaxChecker::createBoolean):
+ (JSC::SyntaxChecker::createNull):
+ (JSC::SyntaxChecker::createBracketAccess):
+ (JSC::SyntaxChecker::createDotAccess):
+ (JSC::SyntaxChecker::createRegex):
+ (JSC::SyntaxChecker::createNewExpr):
+ (JSC::SyntaxChecker::createConditionalExpr):
+ (JSC::SyntaxChecker::createAssignResolve):
+ (JSC::SyntaxChecker::createFunctionExpr):
+ (JSC::SyntaxChecker::createFunctionBody):
+ (JSC::SyntaxChecker::createArguments):
+ (JSC::SyntaxChecker::createArgumentsList):
+ (JSC::SyntaxChecker::createProperty):
+ (JSC::SyntaxChecker::createPropertyList):
+ (JSC::SyntaxChecker::createElementList):
+ (JSC::SyntaxChecker::createFormalParameterList):
+ (JSC::SyntaxChecker::createClause):
+ (JSC::SyntaxChecker::createClauseList):
+ (JSC::SyntaxChecker::setUsesArguments):
+ (JSC::SyntaxChecker::createFuncDeclStatement):
+ (JSC::SyntaxChecker::createBlockStatement):
+ (JSC::SyntaxChecker::createExprStatement):
+ (JSC::SyntaxChecker::createIfStatement):
+ (JSC::SyntaxChecker::createForLoop):
+ (JSC::SyntaxChecker::createForInLoop):
+ (JSC::SyntaxChecker::createEmptyStatement):
+ (JSC::SyntaxChecker::createVarStatement):
+ (JSC::SyntaxChecker::createReturnStatement):
+ (JSC::SyntaxChecker::createBreakStatement):
+ (JSC::SyntaxChecker::createContinueStatement):
+ (JSC::SyntaxChecker::createTryStatement):
+ (JSC::SyntaxChecker::createSwitchStatement):
+ (JSC::SyntaxChecker::createWhileStatement):
+ (JSC::SyntaxChecker::createWithStatement):
+ (JSC::SyntaxChecker::createDoWhileStatement):
+ (JSC::SyntaxChecker::createLabelStatement):
+ (JSC::SyntaxChecker::createThrowStatement):
+ (JSC::SyntaxChecker::createDebugger):
+ (JSC::SyntaxChecker::createConstStatement):
+ (JSC::SyntaxChecker::appendConstDecl):
+ (JSC::SyntaxChecker::createGetterOrSetterProperty):
+ (JSC::SyntaxChecker::appendStatement):
+ (JSC::SyntaxChecker::addVar):
+ (JSC::SyntaxChecker::combineCommaNodes):
+ (JSC::SyntaxChecker::evalCount):
+ (JSC::SyntaxChecker::appendBinaryExpressionInfo):
+ (JSC::SyntaxChecker::operatorStackPop):
+ * runtime/JSGlobalData.h:
+ * wtf/Platform.h:
+ * wtf/ThreadSpecific.h:
+ (WTF::T):
+
+2010-06-23 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Optimization of the QScriptValuePrivate.
+
+ Patch change only internals of the QScriptValuePrivate.
+ Most of the QScriptValuePrivate's attributes were moved
+ into an union.
+
+ [Qt] Optimization of the QScriptVAluePrivate.
+ https://bugs.webkit.org/show_bug.cgi?id=40415
+
+ * qt/api/qscriptengine_p.cpp:
+ (QScriptEnginePrivate::globalObject):
+ * qt/api/qscriptvalue_p.h:
+ (QScriptValuePrivate::):
+ (QScriptValuePrivate::~QScriptValuePrivate):
+ (QScriptValuePrivate::QScriptValuePrivate):
+ (QScriptValuePrivate::toString):
+ (QScriptValuePrivate::toNumber):
+ (QScriptValuePrivate::toBool):
+ (QScriptValuePrivate::toObject):
+ (QScriptValuePrivate::equals):
+ (QScriptValuePrivate::strictlyEquals):
+ (QScriptValuePrivate::assignEngine):
+ (QScriptValuePrivate::operator JSValueRef):
+ (QScriptValuePrivate::operator JSObjectRef):
+ (QScriptValuePrivate::refinedJSValue):
+
+2010-06-23 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Oliver Hunt.
+
+ [GTK] Implement ThreadSpecific with glib
+ https://bugs.webkit.org/show_bug.cgi?id=39829
+
+ Implement ThreadSpecific with glib's GStaticPrivate.
+ This patch makes it possible to build GTK port without pthread.
+
+ * wtf/ThreadSpecific.h:
+ (WTF::::ThreadSpecific):
+ (WTF::::~ThreadSpecific):
+ (WTF::::get):
+ (WTF::::set):
+ (WTF::::destroy):
+
+2010-06-23 Leandro Pereira <leandro@profusion.mobi>
+
+ Unreviewed build fix.
+
+ * CMakeLists.txt: Add runtime/RegExpCache.cpp.
+
+2010-06-22 Renata Hodovan <hodovan@inf.u-szeged.hu>
+
+ Reviewed by Geoffrey Garen.
+
+ Adding regular expression caching to JavaScriptCore
+ https://bugs.webkit.org/show_bug.cgi?id=38142
+
+ The cache is based on Round Robin eviction policy, and
+ can cache at most 256 character long regular expressions,
+ and at most 256 of them. These values can be changed at compile time.
+
+ * GNUmakefile.am:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.pro:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * bytecompiler/NodesCodegen.cpp:
+ (JSC::RegExpNode::emitBytecode):
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData):
+ (JSC::JSGlobalData::~JSGlobalData):
+ * runtime/JSGlobalData.h:
+ (JSC::JSGlobalData::regExpCache):
+ * runtime/RegExpCache.cpp: Added.
+ (JSC::RegExpCache::lookupOrCreate):
+ (JSC::RegExpCache::create):
+ (JSC::RegExpCache::RegExpCache):
+ * runtime/RegExpCache.h: Added.
+ * runtime/RegExpConstructor.cpp:
+ (JSC::constructRegExp):
+ * runtime/RegExpKey.h: Added.
+ (JSC::RegExpKey::RegExpKey):
+ (JSC::RegExpKey::getFlagsValue):
+ (WTF::operator==):
+ (WTF::):
+ * runtime/RegExpPrototype.cpp:
+ (JSC::regExpProtoFuncCompile):
+ * runtime/StringPrototype.cpp:
+ (JSC::stringProtoFuncMatch):
+ (JSC::stringProtoFuncSearch):
+
+2010-06-22 Gabor Loki <loki@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ Add native call support for ARM and Thumb-2 JIT.
+ https://bugs.webkit.org/show_bug.cgi?id=40231
+
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::privateCompileCTINativeCall):
+ * jit/JITOpcodes32_64.cpp:
+ (JSC::JIT::privateCompileCTINativeCall):
+ * wtf/Platform.h:
+
+2010-06-21 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Make JSC more resilient in the face of parse failures
+ https://bugs.webkit.org/show_bug.cgi?id=40951
+
+ A number of recent bugs have occurred due to issues like miscounting
+ BOMs, etc which lead to interesting crashes later on. Adding this
+ logic hardens JSC in the face of these errors, and has no impact on
+ performance (32bit jit actually gets 0.7% faster but I put that down
+ to cache effects).
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::reparseForExceptionInfoIfNecessary):
+ (JSC::CodeBlock::lineNumberForBytecodeOffset):
+ (JSC::CodeBlock::expressionRangeForBytecodeOffset):
+ (JSC::CodeBlock::getByIdExceptionInfoForBytecodeOffset):
+ * bytecode/CodeBlock.h:
+ (JSC::CodeBlock::bytecodeOffset):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::execute):
+ (JSC::Interpreter::executeCall):
+ (JSC::Interpreter::executeConstruct):
+ (JSC::Interpreter::prepareForRepeatCall):
+ (JSC::Interpreter::privateExecute):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ * jit/JITOpcodes32_64.cpp:
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+ * runtime/ArrayPrototype.cpp:
+ (JSC::isNumericCompareFunction):
+ * runtime/Executable.cpp:
+ (JSC::FunctionExecutable::compileForCall):
+ (JSC::FunctionExecutable::compileForConstruct):
+ (JSC::FunctionExecutable::generateJITCodeForCall):
+ (JSC::FunctionExecutable::generateJITCodeForConstruct):
+ (JSC::FunctionExecutable::reparseExceptionInfo):
+ (JSC::EvalExecutable::reparseExceptionInfo):
+ * runtime/Executable.h:
+ (JSC::FunctionExecutable::bytecodeForCall):
+ (JSC::FunctionExecutable::bytecodeForConstruct):
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::numericCompareFunction):
+
+2010-06-21 John Sullivan <sullivan@apple.com>
+
+ Reviewed by Adam Roben.
+
+ RetainPtr can't be used in HashMaps or HashSets
+ <https://bugs.webkit.org/show_bug.cgi?id=40938>
+
+ Added hashing knowledge similar to that in COMPtr.h.
+
+ * wtf/RetainPtr.h:
+ (WTF::RetainPtr::RetainPtr):
+ New function, copied from COMPtr.h but for the type change.
+ (WTF::RetainPtr::isHashTableDeletedValue):
+ Ditto.
+ (WTF::RetainPtr::hashTableDeletedValue):
+ Ditto.
+ Added template code for HashTraits and PtrHash copied from COMPtr.h but for the type change.
+ The only difference is that constructDeletedValue() matches the RefPtr implementation (in HashTraits.h)
+ rather than the COMPtr implementation.
+
+2010-06-19 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Need to ensure that we grow the RegisterFile when creating a callframe for host code
+ https://bugs.webkit.org/show_bug.cgi?id=40858
+ <rdar://problem/8108986>
+
+ In the past the use of the callframe in hostcode was much more
+ limited. Now that we expect the callframe to always be valid
+ we need to grow the RegisterFile so that this is actually the
+ case. In this particular case the problem was failing to grow
+ the registerfile could lead to a callframe that extended beyond
+ RegisterFiler::end(), so vm re-entry would clobber the callframe
+ other scenarios could also lead to badness.
+
+ I was unable to construct a simple testcase to trigger badness,
+ and any such testcase would be so dependent on exact vm stack
+ layout that it would be unlikely to work as a testcase following
+ any callframe or register allocation changes anyway.
+
+ Thankfully the new assertion I added should help to catch these
+ failures in future, and triggers on a couple of tests currently.
+
+ * interpreter/CallFrame.cpp:
+ (JSC::CallFrame::registerFile):
+ * interpreter/CallFrame.h:
+ (JSC::ExecState::init):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+
+2010-06-21 Satish Sampath <satish@chromium.org>
+
+ Reviewed by Steve Block.
+
+ Speech Input Patch 0: Added compilation argument to conditionally compile pending patches.
+ https://bugs.webkit.org/show_bug.cgi?id=40878
+
+ * Configurations/FeatureDefines.xcconfig:
+
+2010-06-21 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Kent Tamura.
+
+ [BREWMP] Use global new/delete operator overloading with USE_SYSTEM_MALLOC=1
+ https://bugs.webkit.org/show_bug.cgi?id=40653
+
+ Currently, other ports do not use global new/delete operator overloading
+ when USE_SYSTEM_MALLOC=1. Brew MP uses system malloc, but it needs to enable
+ "global fastMalloc new" because the default new/delete causes crash on device.
+ We need to replace them with Brew MP's MALLOC/FREE.
+
+ * wtf/FastMalloc.h:
+
+2010-06-18 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Work around a build problem with libjscore on Symbian.
+ https://bugs.webkit.org/show_bug.cgi?id=40840
+
+ Sbsv2 sometimes have problems with debug/release configuration
+ determination causing QtWebKit in release to try linking with the debug
+ JavaScriptCore static library. This patch limit the jscore/jscored
+ r58306 fix necessary for mac builds only to the mac platform to prevent the
+ different name problem.
+
+ The real fix would be to fix qmake or the toolchain, this patch might
+ help meanwhile.
+
+ * JavaScriptCore.pri:
+
+2010-06-21 Patrick Gansterer <paroga@paroga.com>
+
+ Reviewed by Kent Tamura.
+
+ Buildfix after r61338.
+ https://bugs.webkit.org/show_bug.cgi?id=40888
+
+ roundUpAllocationSize is needed in RegisterFile.h.
+
+ * jit/ExecutableAllocator.h:
+
+2010-06-19 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Darin Adler.
+
+ Include <string.h> in StringExtras.h
+ https://bugs.webkit.org/show_bug.cgi?id=40808
+
+ Without string.h, RVCT 2.2 can't compile StringExtras.h.
+ It can't find strlen and strncmp.
+
+ * wtf/StringExtras.h:
+
+2010-06-19 Thiago Macieira <thiago.macieira@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Don't use __attribute__((may_alias)) with the Intel compiler,
+ as it doesn't understand it.
+
+ * wtf/Vector.h:
+
+2010-06-19 Thiago Macieira <thiago.macieira@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Fix compilation with the Intel C++ compiler (11.1.072).
+
+ Like RVCT, label pointers must be void*, not const void*.
+
+ * bytecode/Opcode.h:
+
+2010-06-19 Thiago Macieira <thiago.macieira@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Add the WTF_COMPILER_INTEL for when the Intel compiler is used
+ for building. Usually, the Intel compiler masquerades as
+ another compiler in the system and gets away with it, but some
+ times specific fixes are required (such as when using language
+ extensions).
+
+ * wtf/Platform.h:
+
+2010-06-18 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Incorrect handling of multiple BOMs scattered through a file.
+ https://bugs.webkit.org/show_bug.cgi?id=40865
+
+ When determining the offset of open and close braces in a source
+ with BOMs we were finishing our count early as we failed to account
+ for BOMs prior to the open/close brace positions effecting those
+ positions.
+
+ * parser/Lexer.cpp:
+ (JSC::Lexer::sourceCode):
+
+2010-06-17 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Don't throw away exception information for functions that use exceptions
+ https://bugs.webkit.org/show_bug.cgi?id=40786
+
+ Simple patch to stop JSC from throwing away the exception information
+ of a function that uses "exceptiony" features like try and throw. This
+ is a speed up for catching expressions but it's difficult to quantify as
+ the old cost of reparsing is amortised over all exceptions caught in the
+ effected function.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::reparseForExceptionInfoIfNecessary):
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::generate):
+ (JSC::BytecodeGenerator::emitCatch):
+ * bytecompiler/BytecodeGenerator.h:
+ (JSC::BytecodeGenerator::emitThrow):
+
+2010-06-18 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Add PlatformStrategies and PluginStrategy classes.
+ https://bugs.webkit.org/show_bug.cgi?id=40850
+
+ * wtf/Platform.h:
+
+2010-06-18 Leandro Pereira <leandro@profusion.mobi>
+
+ [EFL] Unreviewed build fix.
+
+ * wtf/CMakeLists.txt: Add MD5.cpp.
+
+2010-06-17 Shu Chang <chang.shu@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] Fix the link error on symbian with ENABLE_JIT=0.
+ 1. Add "#if ENABLE(JIT)" in the header file;
+ 2. Put feature enable/disable logic to a common.pri so
+ that both JavaScriptCore.pri and WebCore.pri can share.
+
+ https://bugs.webkit.org/show_bug.cgi?id=40780
+
+ * JavaScriptCore.pri:
+ * jit/ExecutableAllocator.h:
+
+2010-06-17 Darin Adler <darin@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Use adoptRef and create functions in more code paths
+ https://bugs.webkit.org/show_bug.cgi?id=40760
+
+ * API/JSClassRef.h: Removed unneeded include of RefCounted.h.
+ * API/JSWeakObjectMapRefPrivate.cpp: Ditto.
+
+ * bytecode/CodeBlock.h:
+ (JSC::FunctionCodeBlock::FunctionCodeBlock): Use the
+ SharedSymbolTable::create function instead of calling new directly.
+
+ * runtime/SymbolTable.h: Added a create function to the SharedSymbolTable
+ class and made the constructor private.
+
+2010-06-17 Mark Brand <mabrand@mabrand.nl>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] use "win32-g++*" scope to match all MinGW makespecs
+
+ The scope "win32-g++" comes from the name of the makespec. However, it
+ is frequently used to check for MinGW. This works fine as long as
+ win32-g++ is the only makespec for MinGW. Now we need the wildcard
+ to cover "win32-g++-cross" as well.
+
+ * JavaScriptCore.pro:
+
+2010-06-16 Darin Adler <darin@apple.com>
+
+ Reviewed by David Levin.
+
+ Deploy adoptRef in more places, including all HTML and MathML elements
+ https://bugs.webkit.org/show_bug.cgi?id=39941
+
+ * wtf/ThreadSafeShared.h: Made the constructor protected and removed the
+ unneeded support for initial reference counts other than 1.
+
+2010-06-16 Peter Varga <pvarga@inf.u-szeged.hu>
+
+ Reviewed by Geoffrey Garen.
+
+ Store matchBegin directly in the array of output instead of the stack.
+ https://bugs.webkit.org/show_bug.cgi?id=38988
+
+ * yarr/RegexJIT.cpp:
+ (JSC::Yarr::RegexGenerator::generateDisjunction):
+ (JSC::Yarr::RegexGenerator::generate):
+
+2010-06-15 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Make JavaScriptCore build with clang++.
+
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::emitPutVirtualRegister):
+ Explicitly cast to an int.
+
+ * yarr/RegexCompiler.cpp:
+ (JSC::Yarr::compileRegex):
+ Return 0 instead of false.
+
+2010-06-15 Adam Roben <aroben@apple.com>
+
+ Make WebCore's and JavaScriptCore's DerivedSources available for debugging in production builds
+
+ Fixes <http://webkit.org/b/40626> <rdar://problem/8094205>.
+
+ Reviewed by Sam Weinig.
+
+ * JavaScriptCore.vcproj/JavaScriptCore.make: Copy the contents of
+ JavaScriptCore's DerivedSources directory to
+ AppleInternal/Sources/JavaScriptCore.
+
+2010-06-15 Gabor Loki <loki@webkit.org>
+
+ Rubber-stamped by Eric Seidel.
+
+ Fix invalid access to non-static data member warning in JITPropertyAccess32_64 on ARM
+ https://bugs.webkit.org/show_bug.cgi?id=40423
+
+ Using OBJECT_OFFSETOF macro instead of objectof to bypass access to
+ non-static data member warning.
+
+ * jit/JITPropertyAccess32_64.cpp:
+ (JSC::JIT::privateCompilePutByIdTransition):
+
+2010-06-11 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Adam Barth.
+
+ Rename the rest of the *Tokenizer classes to *DocumentParser
+ https://bugs.webkit.org/show_bug.cgi?id=40507
+
+ * wtf/Platform.h:
+ - fixed a comment to match new names.
+
+2010-06-11 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Explicit conversions from QtScript types to JSC opaque types were removed.
+ https://bugs.webkit.org/show_bug.cgi?id=40412
+
+ Conversion between a JSC C types and a QtScript private types, takes
+ main part of the source code. In most cases a mapping between the types
+ is one to one. New cast operators were added to simplify the code.
+
+ The QScriptValuePrivate could be casted to the JSValueRef and the JSObjectRef.
+ The QScriptEnginePrivate could be casted to the JSGlobalContext.
+ The QScriptProgramPrivate could be casted to the JSStringRef.
+
+ * qt/api/qscriptengine_p.cpp:
+ (QScriptEnginePrivate::evaluate):
+ (QScriptEnginePrivate::newObject):
+ (QScriptEnginePrivate::globalObject):
+ * qt/api/qscriptengine_p.h:
+ (QScriptEnginePrivate::operator JSGlobalContextRef):
+ * qt/api/qscriptprogram_p.h:
+ (QScriptProgramPrivate::operator JSStringRef):
+ * qt/api/qscriptsyntaxcheckresult.cpp:
+ (QScriptSyntaxCheckResultPrivate::~QScriptSyntaxCheckResultPrivate):
+ (QScriptSyntaxCheckResultPrivate::errorMessage):
+ (QScriptSyntaxCheckResultPrivate::errorLineNumber):
+ * qt/api/qscriptvalue_p.h:
+ (QScriptValuePrivate::~QScriptValuePrivate):
+ (QScriptValuePrivate::QScriptValuePrivate):
+ (QScriptValuePrivate::isBool):
+ (QScriptValuePrivate::isNumber):
+ (QScriptValuePrivate::isNull):
+ (QScriptValuePrivate::isString):
+ (QScriptValuePrivate::isUndefined):
+ (QScriptValuePrivate::isFunction):
+ (QScriptValuePrivate::toString):
+ (QScriptValuePrivate::toNumber):
+ (QScriptValuePrivate::toBool):
+ (QScriptValuePrivate::toObject):
+ (QScriptValuePrivate::equals):
+ (QScriptValuePrivate::strictlyEquals):
+ (QScriptValuePrivate::instanceOf):
+ (QScriptValuePrivate::call):
+ (QScriptValuePrivate::operator JSValueRef):
+ (QScriptValuePrivate::operator JSObjectRef):
+ (QScriptValuePrivate::setValue):
+ (QScriptValuePrivate::inherits):
+ (QScriptValuePrivate::refinedJSValue):
+
+2010-05-31 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Implement the simple text code path.
+ https://bugs.webkit.org/show_bug.cgi?id=40077
+
+ Remove the FONT_FAST_PATH macro and use the Qt's
+ fast text implementation instead of the one of WebKit.
+
+ The Qt::TextBypassShaping flag is used to tell Qt to
+ only use the glyph advances.
+
+ Qt 4.7 is needed to get this flag thus the complex path is always
+ used if QtWebKit is compiled against an earlier version.
+
+ Contrary to the WebKit's implementation, the complex code path
+ is taken if the text is RightToLeft, justified or is formatted
+ with non-zero letter or word spacing.
+
+ * wtf/Platform.h:
+
+2010-06-11 Luiz Agostini <luiz.agostini@openbossa.org>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ add codePointCompare to JavaScriptCore.exp
+ https://bugs.webkit.org/show_bug.cgi?id=40426
+
+ * JavaScriptCore.exp:
+
+2010-06-10 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Math Javascript Bug on Safari 5 (webkit 533.16) under "32bit" mode
+ https://bugs.webkit.org/show_bug.cgi?id=40367
+
+ If we're in the slow case of right shift we must write the type tag as
+ the only reason we hit this code path is because we know we're working
+ with a double. eg. we are guaranteed that the tag cannot be reused.
+
+ * jit/JITArithmetic32_64.cpp:
+ (JSC::JIT::emitRightShiftSlowCase):
+
+2010-06-10 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Eric Seidel.
+
+ Remove weakRandomNumber
+ https://bugs.webkit.org/show_bug.cgi?id=40291
+
+ weakRandomNumber is used nowhere. Currently, WeakRandom is used instead.
+
+ * wtf/RandomNumber.cpp:
+ * wtf/RandomNumber.h:
+
+2010-06-09 Alexey Proskuryakov <ap@apple.com>
+
+ Reviewed by Brady Eidson.
+
+ Export StringImpl::ascii(). It might be not very useful, but it's a public function.
+
+ * JavaScriptCore.exp:
+
+2010-06-09 Leandro Pereira <leandro@profusion.mobi>
+
+ Reviewed by Adam Treat.
+
+ [EFL] Allow building core libraries as shared objects to speed up
+ linking time on machines with small amounts of memory.
+ http://webkit.org/b/39899
+
+ * CMakeLists.txt: If building with shared core, install the lib.
+ * jsc/CMakeListsEfl.txt: Needs Glib and Ecore to link dynamically.
+ * wtf/CMakeLists.txt: If building with shared core, install the lib.
+
+2010-06-09 Gabor Loki <loki@webkit.org>
+
+ Reviewed by David Levin.
+
+ Remove some unused variable warnings from JITOpcodes
+ https://bugs.webkit.org/show_bug.cgi?id=40298
+
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::privateCompileCTINativeCall):
+ * jit/JITOpcodes32_64.cpp:
+ (JSC::JIT::privateCompileCTINativeCall):
+
+2010-05-18 Yuzo Fujishima <yuzo@google.com>
+
+ Reviewed by Shinichiro Hamaji.
+
+ Fix for Bug 34529 - [CSSOM] issues with cssText and selectorText
+ Add U16_LENGTH that is needed to implement CSS character serialization.
+ https://bugs.webkit.org/show_bug.cgi?id=34529
+
+ * wtf/unicode/qt4/UnicodeQt4.h:
+ * wtf/unicode/wince/UnicodeWince.h:
+
+2010-06-08 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r60830.
+ http://trac.webkit.org/changeset/60830
+ https://bugs.webkit.org/show_bug.cgi?id=40305
+
+ Broke the Windows build (Requested by abarth on #webkit).
+
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * wtf/OwnPtrCommon.h:
+ * wtf/brew/OwnPtrBrew.h: Removed.
+ * wtf/win/OwnPtrWin.h: Removed.
+
+2010-06-08 MORITA Hajime <morrita@google.com>
+
+ Unreviewed. An attempt to fix test break.
+
+ * Configurations/FeatureDefines.xcconfig:
+
+2010-06-08 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Adam Barth.
+
+ Change OwnPtrCommon to include platform-specific headers
+ https://bugs.webkit.org/show_bug.cgi?id=40279
+
+ Adding new type to OwnPtrCommon needlessly causes all ports to do full rebuilds.
+ Change OwnPtrCommon to include platform-specific headers to avoid all ports rebuilds.
+
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * wtf/OwnPtrCommon.h:
+ * wtf/brew/OwnPtrBrew.h: Added.
+ * wtf/win/OwnPtrWin.h: Added.
+
+2010-06-07 MORITA Hajime <morrita@google.com>
+
+ Reviewed by Kent Tamura.
+
+ https://bugs.webkit.org/show_bug.cgi?id=40219
+ [Mac] ENABLE_METER_TAG should be enabled
+
+ Added ENABLE_METER_TAG.
+
+ * Configurations/FeatureDefines.xcconfig:
+
+2010-06-07 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Eric Seidel.
+
+ [BREWMP] Add more types to OwnPtr
+ https://bugs.webkit.org/show_bug.cgi?id=39667
+
+ Add ISSL and ISocket to the list of OwnPtr-ed type.
+
+ * wtf/OwnPtrCommon.h:
+ * wtf/brew/OwnPtrBrew.cpp:
+ (WTF::deleteOwnedPtr):
+
+2010-06-07 Benjamin Poulain <benjamin.poulain@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Crash when compiling on Snow Leopard and running on Leopard
+ https://bugs.webkit.org/show_bug.cgi?id=31403
+
+ Disable the use of pthread_setname_np and other symbols
+ when targetting Leopard.
+
+ Use the defines TARGETING_XX instead of BUILDING_ON_XX
+ for features that cannot be used before Snow Leopard.
+
+ * wtf/Platform.h:
+
+2010-06-07 Gabor Loki <loki@webkit.org>
+
+ Reviewed by NOBODY (JSVALUE32_64 build fix).
+
+ * jit/JITOpcodes32_64.cpp:
+ (JSC::JIT::privateCompileCTINativeCall):
+
+2010-06-06 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by NOBODY (windows build fix pt 2).
+
+ * JavaScriptCore.exp:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-06-06 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by NOBODY (windows build fix pt 1).
+
+ * JavaScriptCore.exp:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-06-06 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Bug 40214 - Clean up error construction / throwing in JSC.
+
+ The one egregious insanity here is that creating an error requires
+ a VM-entry-esqe-host call (the string argument is wrapped as a JS
+ object & pushed on the RegisterFile, then unwrapped back to a
+ UString). Changing this also means you only require a global
+ object, not an ExecState, to create an error.
+
+ The methods to create error objects are also parameterized
+ requiring a switch on the type, which can be made cleaner and
+ faster by moving to a separate method per error type. Code to add
+ divot information to error had been duplicated, and is coalesced
+ back into a single function.
+
+ Convenience methods added to create & throw type & syntax error
+ with a default error message, since this is a common case.
+
+ Also, errors are currently thrown either using
+ "throwError(exec, error)" or "exec->setException(error)" - unify
+ on the former, since this is more commonly used. Add
+ "throwVMError(exec, error)" equivalents, as a convenience for
+ cases where the result was being wrapped in "JSValue::encode(...)".
+
+ * API/JSCallbackConstructor.cpp:
+ (JSC::constructJSCallback):
+ * API/JSCallbackFunction.cpp:
+ (JSC::JSCallbackFunction::call):
+ * API/JSCallbackObjectFunctions.h:
+ (JSC::::getOwnPropertySlot):
+ (JSC::::put):
+ (JSC::::deleteProperty):
+ (JSC::::construct):
+ (JSC::::hasInstance):
+ (JSC::::call):
+ (JSC::::toNumber):
+ (JSC::::toString):
+ (JSC::::staticValueGetter):
+ (JSC::::staticFunctionGetter):
+ (JSC::::callbackGetter):
+ * API/JSObjectRef.cpp:
+ (JSObjectMakeError):
+ * JavaScriptCore.exp:
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::emitNewError):
+ (JSC::BytecodeGenerator::emitThrowExpressionTooDeepException):
+ * bytecompiler/BytecodeGenerator.h:
+ * bytecompiler/NodesCodegen.cpp:
+ (JSC::ThrowableExpressionData::emitThrowError):
+ (JSC::RegExpNode::emitBytecode):
+ (JSC::PostfixErrorNode::emitBytecode):
+ (JSC::PrefixErrorNode::emitBytecode):
+ (JSC::AssignErrorNode::emitBytecode):
+ (JSC::ForInNode::emitBytecode):
+ (JSC::ContinueNode::emitBytecode):
+ (JSC::BreakNode::emitBytecode):
+ (JSC::ReturnNode::emitBytecode):
+ (JSC::LabelNode::emitBytecode):
+ * interpreter/CallFrame.h:
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::throwException):
+ (JSC::Interpreter::privateExecute):
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+ * jsc.cpp:
+ (functionRun):
+ (functionLoad):
+ (functionCheckSyntax):
+ * parser/Nodes.h:
+ * runtime/ArrayConstructor.cpp:
+ (JSC::constructArrayWithSizeQuirk):
+ * runtime/ArrayPrototype.cpp:
+ (JSC::arrayProtoFuncToString):
+ (JSC::arrayProtoFuncToLocaleString):
+ (JSC::arrayProtoFuncJoin):
+ (JSC::arrayProtoFuncFilter):
+ (JSC::arrayProtoFuncMap):
+ (JSC::arrayProtoFuncEvery):
+ (JSC::arrayProtoFuncForEach):
+ (JSC::arrayProtoFuncSome):
+ (JSC::arrayProtoFuncReduce):
+ (JSC::arrayProtoFuncReduceRight):
+ * runtime/BooleanPrototype.cpp:
+ (JSC::booleanProtoFuncToString):
+ (JSC::booleanProtoFuncValueOf):
+ * runtime/DatePrototype.cpp:
+ (JSC::dateProtoFuncToString):
+ (JSC::dateProtoFuncToUTCString):
+ (JSC::dateProtoFuncToISOString):
+ (JSC::dateProtoFuncToDateString):
+ (JSC::dateProtoFuncToTimeString):
+ (JSC::dateProtoFuncToLocaleString):
+ (JSC::dateProtoFuncToLocaleDateString):
+ (JSC::dateProtoFuncToLocaleTimeString):
+ (JSC::dateProtoFuncGetTime):
+ (JSC::dateProtoFuncGetFullYear):
+ (JSC::dateProtoFuncGetUTCFullYear):
+ (JSC::dateProtoFuncToGMTString):
+ (JSC::dateProtoFuncGetMonth):
+ (JSC::dateProtoFuncGetUTCMonth):
+ (JSC::dateProtoFuncGetDate):
+ (JSC::dateProtoFuncGetUTCDate):
+ (JSC::dateProtoFuncGetDay):
+ (JSC::dateProtoFuncGetUTCDay):
+ (JSC::dateProtoFuncGetHours):
+ (JSC::dateProtoFuncGetUTCHours):
+ (JSC::dateProtoFuncGetMinutes):
+ (JSC::dateProtoFuncGetUTCMinutes):
+ (JSC::dateProtoFuncGetSeconds):
+ (JSC::dateProtoFuncGetUTCSeconds):
+ (JSC::dateProtoFuncGetMilliSeconds):
+ (JSC::dateProtoFuncGetUTCMilliseconds):
+ (JSC::dateProtoFuncGetTimezoneOffset):
+ (JSC::dateProtoFuncSetTime):
+ (JSC::setNewValueFromTimeArgs):
+ (JSC::setNewValueFromDateArgs):
+ (JSC::dateProtoFuncSetMilliSeconds):
+ (JSC::dateProtoFuncSetUTCMilliseconds):
+ (JSC::dateProtoFuncSetSeconds):
+ (JSC::dateProtoFuncSetUTCSeconds):
+ (JSC::dateProtoFuncSetMinutes):
+ (JSC::dateProtoFuncSetUTCMinutes):
+ (JSC::dateProtoFuncSetHours):
+ (JSC::dateProtoFuncSetUTCHours):
+ (JSC::dateProtoFuncSetDate):
+ (JSC::dateProtoFuncSetUTCDate):
+ (JSC::dateProtoFuncSetMonth):
+ (JSC::dateProtoFuncSetUTCMonth):
+ (JSC::dateProtoFuncSetFullYear):
+ (JSC::dateProtoFuncSetUTCFullYear):
+ (JSC::dateProtoFuncSetYear):
+ (JSC::dateProtoFuncGetYear):
+ (JSC::dateProtoFuncToJSON):
+ * runtime/Error.cpp:
+ (JSC::createError):
+ (JSC::createEvalError):
+ (JSC::createRangeError):
+ (JSC::createReferenceError):
+ (JSC::createSyntaxError):
+ (JSC::createTypeError):
+ (JSC::createURIError):
+ (JSC::addErrorSourceInfo):
+ (JSC::addErrorDivotInfo):
+ (JSC::addErrorInfo):
+ (JSC::hasErrorInfo):
+ (JSC::throwError):
+ (JSC::throwTypeError):
+ (JSC::throwSyntaxError):
+ * runtime/Error.h:
+ (JSC::throwVMError):
+ (JSC::throwVMTypeError):
+ * runtime/ErrorConstructor.cpp:
+ (JSC::constructWithErrorConstructor):
+ (JSC::callErrorConstructor):
+ * runtime/ErrorConstructor.h:
+ * runtime/ErrorInstance.cpp:
+ (JSC::ErrorInstance::ErrorInstance):
+ (JSC::ErrorInstance::create):
+ * runtime/ErrorInstance.h:
+ * runtime/ErrorPrototype.cpp:
+ (JSC::ErrorPrototype::ErrorPrototype):
+ * runtime/ExceptionHelpers.cpp:
+ (JSC::createStackOverflowError):
+ (JSC::createUndefinedVariableError):
+ (JSC::createInvalidParamError):
+ (JSC::createNotAConstructorError):
+ (JSC::createNotAFunctionError):
+ (JSC::createNotAnObjectError):
+ (JSC::throwOutOfMemoryError):
+ * runtime/ExceptionHelpers.h:
+ * runtime/Executable.cpp:
+ (JSC::EvalExecutable::compile):
+ (JSC::ProgramExecutable::checkSyntax):
+ (JSC::ProgramExecutable::compile):
+ * runtime/FunctionConstructor.cpp:
+ (JSC::constructFunction):
+ * runtime/FunctionPrototype.cpp:
+ (JSC::functionProtoFuncToString):
+ (JSC::functionProtoFuncApply):
+ (JSC::functionProtoFuncCall):
+ * runtime/Identifier.cpp:
+ (JSC::Identifier::from):
+ * runtime/Identifier.h:
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::put):
+ * runtime/JSFunction.cpp:
+ (JSC::callHostFunctionAsConstructor):
+ * runtime/JSGlobalObjectFunctions.cpp:
+ (JSC::encode):
+ (JSC::decode):
+ (JSC::globalFuncEval):
+ * runtime/JSONObject.cpp:
+ (JSC::Stringifier::appendStringifiedValue):
+ (JSC::Walker::walk):
+ (JSC::JSONProtoFuncParse):
+ (JSC::JSONProtoFuncStringify):
+ * runtime/JSObject.cpp:
+ (JSC::throwSetterError):
+ (JSC::JSObject::put):
+ (JSC::JSObject::putWithAttributes):
+ (JSC::JSObject::defaultValue):
+ (JSC::JSObject::hasInstance):
+ (JSC::JSObject::defineOwnProperty):
+ * runtime/JSObject.h:
+ * runtime/JSValue.cpp:
+ (JSC::JSValue::toObjectSlowCase):
+ (JSC::JSValue::synthesizeObject):
+ (JSC::JSValue::synthesizePrototype):
+ * runtime/NativeErrorConstructor.cpp:
+ (JSC::constructWithNativeErrorConstructor):
+ (JSC::callNativeErrorConstructor):
+ * runtime/NativeErrorConstructor.h:
+ * runtime/NumberPrototype.cpp:
+ (JSC::numberProtoFuncToString):
+ (JSC::numberProtoFuncToLocaleString):
+ (JSC::numberProtoFuncValueOf):
+ (JSC::numberProtoFuncToFixed):
+ (JSC::numberProtoFuncToExponential):
+ (JSC::numberProtoFuncToPrecision):
+ * runtime/ObjectConstructor.cpp:
+ (JSC::objectConstructorGetPrototypeOf):
+ (JSC::objectConstructorGetOwnPropertyDescriptor):
+ (JSC::objectConstructorGetOwnPropertyNames):
+ (JSC::objectConstructorKeys):
+ (JSC::toPropertyDescriptor):
+ (JSC::objectConstructorDefineProperty):
+ (JSC::objectConstructorDefineProperties):
+ (JSC::objectConstructorCreate):
+ * runtime/ObjectPrototype.cpp:
+ (JSC::objectProtoFuncDefineGetter):
+ (JSC::objectProtoFuncDefineSetter):
+ * runtime/RegExpConstructor.cpp:
+ (JSC::constructRegExp):
+ * runtime/RegExpObject.cpp:
+ (JSC::RegExpObject::match):
+ * runtime/RegExpPrototype.cpp:
+ (JSC::regExpProtoFuncTest):
+ (JSC::regExpProtoFuncExec):
+ (JSC::regExpProtoFuncCompile):
+ (JSC::regExpProtoFuncToString):
+ * runtime/StringPrototype.cpp:
+ (JSC::stringProtoFuncToString):
+
+2010-06-05 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Eric Seidel.
+
+ [BREWMP] Add PLATFORM(BREWMP) guard for using std::xxx
+ https://bugs.webkit.org/show_bug.cgi?id=39710
+
+ Build fix for BREW MP.
+
+ * wtf/MathExtras.h:
+
+2010-06-04 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ HTML5 parser should be within 1% of old parser performance
+ https://bugs.webkit.org/show_bug.cgi?id=40172
+
+ Fix cast in this operator= to allow for assignment between vectors with
+ different inline capacities (as clearly intended by its author).
+
+ * wtf/Vector.h:
+ (WTF::::operator):
+
+2010-06-04 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ New QtScript API; QScriptValue::instanceOf.
+
+ New function create an easy way to check value's prototype hierarchy.
+
+ [Qt] QScriptValue should have an instanceOf method
+ https://bugs.webkit.org/show_bug.cgi?id=40120
+
+ * qt/api/qscriptvalue.cpp:
+ (QScriptValue::instanceOf):
+ * qt/api/qscriptvalue.h:
+ * qt/api/qscriptvalue_p.h:
+ (QScriptValuePrivate::instanceOf):
+ * qt/tests/qscriptvalue/tst_qscriptvalue.h:
+ * qt/tests/qscriptvalue/tst_qscriptvalue_generated_comparison.cpp:
+ (tst_QScriptValue::instanceOf_initData):
+ (tst_QScriptValue::instanceOf_makeData):
+ (tst_QScriptValue::instanceOf_test):
+
+2010-06-04 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by NOBODY (interpreter build fix).
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+
+2010-06-04 Mark Rowe <mrowe@apple.com>
+
+ Silence some warnings seen on the build bot.
+
+ * JavaScriptCore.JSVALUE32_64only.exp: Add a trailing newline.
+ * JavaScriptCore.JSVALUE32only.exp: Ditto.
+ * JavaScriptCore.JSVALUE64only.exp: Ditto.
+ * JavaScriptCore.xcodeproj/project.pbxproj: Remove the .exp files from all targets so that Xcode doesn't
+ complain about not knowing how to compile them.
+
+2010-06-04 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 40187 - Change function signature of NativeConstructor to match NativeFunction
+
+ Mostly for consistency, but constructor & args arguments are redundant,
+ and this will help if we wish to be able to JIT calls to more constructors.
+
+ * API/JSCallbackConstructor.cpp:
+ (JSC::constructJSCallback):
+ * API/JSCallbackObject.h:
+ * API/JSCallbackObjectFunctions.h:
+ (JSC::::construct):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::executeConstruct):
+ * interpreter/Interpreter.h:
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+ * runtime/ArrayConstructor.cpp:
+ (JSC::constructWithArrayConstructor):
+ * runtime/BooleanConstructor.cpp:
+ (JSC::constructWithBooleanConstructor):
+ * runtime/ConstructData.cpp:
+ (JSC::construct):
+ * runtime/ConstructData.h:
+ * runtime/DateConstructor.cpp:
+ (JSC::constructWithDateConstructor):
+ * runtime/Error.cpp:
+ (JSC::constructNativeError):
+ (JSC::Error::create):
+ * runtime/ErrorConstructor.cpp:
+ (JSC::constructWithErrorConstructor):
+ * runtime/FunctionConstructor.cpp:
+ (JSC::constructWithFunctionConstructor):
+ * runtime/NativeErrorConstructor.cpp:
+ (JSC::constructWithNativeErrorConstructor):
+ * runtime/NativeErrorConstructor.h:
+ (JSC::NativeErrorConstructor::errorStructure):
+ * runtime/NumberConstructor.cpp:
+ (JSC::constructWithNumberConstructor):
+ * runtime/ObjectConstructor.cpp:
+ (JSC::constructWithObjectConstructor):
+ * runtime/RegExpConstructor.cpp:
+ (JSC::constructWithRegExpConstructor):
+ * runtime/StringConstructor.cpp:
+ (JSC::constructWithStringConstructor):
+
+2010-06-04 Tony Gentilcore <tonyg@chromium.org>
+
+ Reviewed by Adam Barth.
+
+ Add a takeFirst() method to Deque and use it where appropriate.
+ https://bugs.webkit.org/show_bug.cgi?id=40089
+
+ * wtf/Deque.h:
+ (WTF::::takeFirst):
+ * wtf/MainThread.cpp:
+ (WTF::dispatchFunctionsFromMainThread):
+ * wtf/MessageQueue.h:
+ (WTF::::tryGetMessage):
+
+2010-06-04 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Remove a QEXPECT_FAIL flag from an autotest.
+
+ Test tst_QScriptEngine::globalObject pass after 36600 bug
+ fix have been applied.
+
+ [Qt] Expected fail in the tst_QScriptEngine::globalObject should be removed.
+ https://bugs.webkit.org/show_bug.cgi?id=40114
+
+ * qt/tests/qscriptengine/tst_qscriptengine.cpp:
+ (tst_QScriptEngine::globalObject):
+
+2010-06-04 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Fix QScriptValue::equals.
+
+ Handling for a few edge cases were added. Now comparison between
+ NaN, an invalid objects should works as supposed.
+
+ [Qt] QScriptValue::equals problems
+ https://bugs.webkit.org/show_bug.cgi?id=40110
+
+ * qt/api/qscriptvalue.cpp:
+ (QScriptValue::equals):
+ * qt/api/qscriptvalue_p.h:
+ (QScriptValuePrivate::equals):
+ * qt/tests/qscriptvalue/tst_qscriptvalue.h:
+ * qt/tests/qscriptvalue/tst_qscriptvalue_generated_comparison.cpp:
+ (tst_QScriptValue::equals_initData):
+ (tst_QScriptValue::equals_makeData):
+ (tst_QScriptValue::equals_test):
+
+2010-06-03 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ New states in QScriptValuePrivate.
+
+ The CSpecial state was divided into CNull and CUndefined. It simplify
+ the QScriptValue code by avoiding a few "cast" and "if".
+ Moreover the MSVS compiler didn't like casting between a double and an
+ enum which is avoided now.
+
+ [Qt] The QScriptValuePrivate::CSpecial is too generic.
+ https://bugs.webkit.org/show_bug.cgi?id=40067
+
+ * qt/api/qscriptvalue_p.h:
+ (QScriptValuePrivate::):
+ (QScriptValuePrivate::QScriptValuePrivate):
+ (QScriptValuePrivate::isNull):
+ (QScriptValuePrivate::isUndefined):
+ (QScriptValuePrivate::toString):
+ (QScriptValuePrivate::toNumber):
+ (QScriptValuePrivate::toBool):
+ (QScriptValuePrivate::toObject):
+ (QScriptValuePrivate::assignEngine):
+ (QScriptValuePrivate::isNumberBased):
+
+2010-06-03 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by NOBODY (Qt build fix).
+
+ * wtf/Platform.h:
+
+2010-06-03 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Mark Rowe.
+
+ Bug 40150 - ENABLE_JIT_OPTIMIZE_NATIVE_CALL on all x86/x86_64 platforms
+ This was fixed in bug #40094.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * wtf/Platform.h:
+
+2010-06-03 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by NOBODY (Interpreter build fix).
+
+ * JavaScriptCore.JSVALUE32_64only.exp:
+ * JavaScriptCore.JSVALUE32only.exp:
+ * JavaScriptCore.JSVALUE64only.exp:
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+
+2010-06-03 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by NOBODY (windows build fix II).
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-06-03 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by NOBODY (windows build fix).
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-06-02 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 40094 - The return type of NativeFunction should be EncodedJSValue
+ On Windows & Linux, using JSVALUE32_64, EncodedJSValue is returned in registers, but JSValue is not.
+
+ * API/JSCallbackFunction.cpp:
+ (JSC::JSCallbackFunction::call):
+ * API/JSCallbackFunction.h:
+ * API/JSCallbackObject.h:
+ * API/JSCallbackObjectFunctions.h:
+ (JSC::::call):
+ * JavaScriptCore.exp:
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::executeCall):
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+ * jit/JITStubs.h:
+ * jsc.cpp:
+ (functionPrint):
+ (functionDebug):
+ (functionGC):
+ (functionVersion):
+ (functionRun):
+ (functionLoad):
+ (functionCheckSyntax):
+ (functionSetSamplingFlags):
+ (functionClearSamplingFlags):
+ (functionReadline):
+ (functionQuit):
+ * runtime/ArrayConstructor.cpp:
+ (JSC::callArrayConstructor):
+ (JSC::arrayConstructorIsArray):
+ * runtime/ArrayPrototype.cpp:
+ (JSC::arrayProtoFuncToString):
+ (JSC::arrayProtoFuncToLocaleString):
+ (JSC::arrayProtoFuncJoin):
+ (JSC::arrayProtoFuncConcat):
+ (JSC::arrayProtoFuncPop):
+ (JSC::arrayProtoFuncPush):
+ (JSC::arrayProtoFuncReverse):
+ (JSC::arrayProtoFuncShift):
+ (JSC::arrayProtoFuncSlice):
+ (JSC::arrayProtoFuncSort):
+ (JSC::arrayProtoFuncSplice):
+ (JSC::arrayProtoFuncUnShift):
+ (JSC::arrayProtoFuncFilter):
+ (JSC::arrayProtoFuncMap):
+ (JSC::arrayProtoFuncEvery):
+ (JSC::arrayProtoFuncForEach):
+ (JSC::arrayProtoFuncSome):
+ (JSC::arrayProtoFuncReduce):
+ (JSC::arrayProtoFuncReduceRight):
+ (JSC::arrayProtoFuncIndexOf):
+ (JSC::arrayProtoFuncLastIndexOf):
+ * runtime/BooleanConstructor.cpp:
+ (JSC::callBooleanConstructor):
+ * runtime/BooleanPrototype.cpp:
+ (JSC::booleanProtoFuncToString):
+ (JSC::booleanProtoFuncValueOf):
+ * runtime/CallData.h:
+ * runtime/DateConstructor.cpp:
+ (JSC::callDate):
+ (JSC::dateParse):
+ (JSC::dateNow):
+ (JSC::dateUTC):
+ * runtime/DatePrototype.cpp:
+ (JSC::dateProtoFuncToString):
+ (JSC::dateProtoFuncToUTCString):
+ (JSC::dateProtoFuncToISOString):
+ (JSC::dateProtoFuncToDateString):
+ (JSC::dateProtoFuncToTimeString):
+ (JSC::dateProtoFuncToLocaleString):
+ (JSC::dateProtoFuncToLocaleDateString):
+ (JSC::dateProtoFuncToLocaleTimeString):
+ (JSC::dateProtoFuncGetTime):
+ (JSC::dateProtoFuncGetFullYear):
+ (JSC::dateProtoFuncGetUTCFullYear):
+ (JSC::dateProtoFuncToGMTString):
+ (JSC::dateProtoFuncGetMonth):
+ (JSC::dateProtoFuncGetUTCMonth):
+ (JSC::dateProtoFuncGetDate):
+ (JSC::dateProtoFuncGetUTCDate):
+ (JSC::dateProtoFuncGetDay):
+ (JSC::dateProtoFuncGetUTCDay):
+ (JSC::dateProtoFuncGetHours):
+ (JSC::dateProtoFuncGetUTCHours):
+ (JSC::dateProtoFuncGetMinutes):
+ (JSC::dateProtoFuncGetUTCMinutes):
+ (JSC::dateProtoFuncGetSeconds):
+ (JSC::dateProtoFuncGetUTCSeconds):
+ (JSC::dateProtoFuncGetMilliSeconds):
+ (JSC::dateProtoFuncGetUTCMilliseconds):
+ (JSC::dateProtoFuncGetTimezoneOffset):
+ (JSC::dateProtoFuncSetTime):
+ (JSC::dateProtoFuncSetMilliSeconds):
+ (JSC::dateProtoFuncSetUTCMilliseconds):
+ (JSC::dateProtoFuncSetSeconds):
+ (JSC::dateProtoFuncSetUTCSeconds):
+ (JSC::dateProtoFuncSetMinutes):
+ (JSC::dateProtoFuncSetUTCMinutes):
+ (JSC::dateProtoFuncSetHours):
+ (JSC::dateProtoFuncSetUTCHours):
+ (JSC::dateProtoFuncSetDate):
+ (JSC::dateProtoFuncSetUTCDate):
+ (JSC::dateProtoFuncSetMonth):
+ (JSC::dateProtoFuncSetUTCMonth):
+ (JSC::dateProtoFuncSetFullYear):
+ (JSC::dateProtoFuncSetUTCFullYear):
+ (JSC::dateProtoFuncSetYear):
+ (JSC::dateProtoFuncGetYear):
+ (JSC::dateProtoFuncToJSON):
+ * runtime/ErrorConstructor.cpp:
+ (JSC::callErrorConstructor):
+ * runtime/ErrorPrototype.cpp:
+ (JSC::errorProtoFuncToString):
+ * runtime/FunctionConstructor.cpp:
+ (JSC::callFunctionConstructor):
+ * runtime/FunctionPrototype.cpp:
+ (JSC::callFunctionPrototype):
+ (JSC::functionProtoFuncToString):
+ (JSC::functionProtoFuncApply):
+ (JSC::functionProtoFuncCall):
+ * runtime/JSCell.h:
+ (JSC::getCallData):
+ (JSC::getConstructData):
+ * runtime/JSFunction.cpp:
+ (JSC::callHostFunctionAsConstructor):
+ * runtime/JSFunction.h:
+ * runtime/JSGlobalObjectFunctions.cpp:
+ (JSC::globalFuncEval):
+ (JSC::globalFuncParseInt):
+ (JSC::globalFuncParseFloat):
+ (JSC::globalFuncIsNaN):
+ (JSC::globalFuncIsFinite):
+ (JSC::globalFuncDecodeURI):
+ (JSC::globalFuncDecodeURIComponent):
+ (JSC::globalFuncEncodeURI):
+ (JSC::globalFuncEncodeURIComponent):
+ (JSC::globalFuncEscape):
+ (JSC::globalFuncUnescape):
+ (JSC::globalFuncJSCPrint):
+ * runtime/JSGlobalObjectFunctions.h:
+ * runtime/JSONObject.cpp:
+ (JSC::JSONProtoFuncParse):
+ (JSC::JSONProtoFuncStringify):
+ * runtime/JSObject.cpp:
+ (JSC::callDefaultValueFunction):
+ * runtime/JSValue.h:
+ * runtime/MathObject.cpp:
+ (JSC::mathProtoFuncAbs):
+ (JSC::mathProtoFuncACos):
+ (JSC::mathProtoFuncASin):
+ (JSC::mathProtoFuncATan):
+ (JSC::mathProtoFuncATan2):
+ (JSC::mathProtoFuncCeil):
+ (JSC::mathProtoFuncCos):
+ (JSC::mathProtoFuncExp):
+ (JSC::mathProtoFuncFloor):
+ (JSC::mathProtoFuncLog):
+ (JSC::mathProtoFuncMax):
+ (JSC::mathProtoFuncMin):
+ (JSC::mathProtoFuncPow):
+ (JSC::mathProtoFuncRandom):
+ (JSC::mathProtoFuncRound):
+ (JSC::mathProtoFuncSin):
+ (JSC::mathProtoFuncSqrt):
+ (JSC::mathProtoFuncTan):
+ * runtime/NativeErrorConstructor.cpp:
+ (JSC::callNativeErrorConstructor):
+ * runtime/NumberConstructor.cpp:
+ (JSC::callNumberConstructor):
+ * runtime/NumberPrototype.cpp:
+ (JSC::numberProtoFuncToString):
+ (JSC::numberProtoFuncToLocaleString):
+ (JSC::numberProtoFuncValueOf):
+ (JSC::numberProtoFuncToFixed):
+ (JSC::numberProtoFuncToExponential):
+ (JSC::numberProtoFuncToPrecision):
+ * runtime/ObjectConstructor.cpp:
+ (JSC::callObjectConstructor):
+ (JSC::objectConstructorGetPrototypeOf):
+ (JSC::objectConstructorGetOwnPropertyDescriptor):
+ (JSC::objectConstructorGetOwnPropertyNames):
+ (JSC::objectConstructorKeys):
+ (JSC::toPropertyDescriptor):
+ (JSC::objectConstructorDefineProperty):
+ (JSC::objectConstructorDefineProperties):
+ (JSC::objectConstructorCreate):
+ * runtime/ObjectPrototype.cpp:
+ (JSC::objectProtoFuncValueOf):
+ (JSC::objectProtoFuncHasOwnProperty):
+ (JSC::objectProtoFuncIsPrototypeOf):
+ (JSC::objectProtoFuncDefineGetter):
+ (JSC::objectProtoFuncDefineSetter):
+ (JSC::objectProtoFuncLookupGetter):
+ (JSC::objectProtoFuncLookupSetter):
+ (JSC::objectProtoFuncPropertyIsEnumerable):
+ (JSC::objectProtoFuncToLocaleString):
+ (JSC::objectProtoFuncToString):
+ * runtime/ObjectPrototype.h:
+ * runtime/RegExpConstructor.cpp:
+ (JSC::callRegExpConstructor):
+ * runtime/RegExpObject.cpp:
+ (JSC::callRegExpObject):
+ * runtime/RegExpPrototype.cpp:
+ (JSC::regExpProtoFuncTest):
+ (JSC::regExpProtoFuncExec):
+ (JSC::regExpProtoFuncCompile):
+ (JSC::regExpProtoFuncToString):
+ * runtime/StringConstructor.cpp:
+ (JSC::stringFromCharCode):
+ (JSC::callStringConstructor):
+ * runtime/StringPrototype.cpp:
+ (JSC::stringProtoFuncReplace):
+ (JSC::stringProtoFuncToString):
+ (JSC::stringProtoFuncCharAt):
+ (JSC::stringProtoFuncCharCodeAt):
+ (JSC::stringProtoFuncConcat):
+ (JSC::stringProtoFuncIndexOf):
+ (JSC::stringProtoFuncLastIndexOf):
+ (JSC::stringProtoFuncMatch):
+ (JSC::stringProtoFuncSearch):
+ (JSC::stringProtoFuncSlice):
+ (JSC::stringProtoFuncSplit):
+ (JSC::stringProtoFuncSubstr):
+ (JSC::stringProtoFuncSubstring):
+ (JSC::stringProtoFuncToLowerCase):
+ (JSC::stringProtoFuncToUpperCase):
+ (JSC::stringProtoFuncLocaleCompare):
+ (JSC::stringProtoFuncBig):
+ (JSC::stringProtoFuncSmall):
+ (JSC::stringProtoFuncBlink):
+ (JSC::stringProtoFuncBold):
+ (JSC::stringProtoFuncFixed):
+ (JSC::stringProtoFuncItalics):
+ (JSC::stringProtoFuncStrike):
+ (JSC::stringProtoFuncSub):
+ (JSC::stringProtoFuncSup):
+ (JSC::stringProtoFuncFontcolor):
+ (JSC::stringProtoFuncFontsize):
+ (JSC::stringProtoFuncAnchor):
+ (JSC::stringProtoFuncLink):
+ (JSC::stringProtoFuncTrim):
+ (JSC::stringProtoFuncTrimLeft):
+ (JSC::stringProtoFuncTrimRight):
+
+2010-06-02 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Add value-representation specific sections to the mac export file.
+
+ * Configurations/JavaScriptCore.xcconfig:
+ * DerivedSources.make:
+ * JavaScriptCore.JSVALUE32_64only.exp: Added.
+ * JavaScriptCore.JSVALUE32only.exp: Added.
+ * JavaScriptCore.JSVALUE64only.exp: Added.
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2010-06-02 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ <rdar://problem/8054988> Work around an LLVM GCC code generation bug that results in crashes inside PCRE.
+
+ * pcre/pcre_exec.cpp:
+ (repeatInformationFromInstructionOffset): Change the type of instructionOffset to int. There's no good
+ reason for it to be a short, and using int prevents this code from triggering the LLVM GCC bug.
+
+2010-06-02 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Fix the QScriptValue::strictlyEquals function.
+
+ Handling for a few edge cases was added.
+
+ New autotest that covers the QScriptValue::strictlyEquals function.
+
+ [Qt] QScriptValue::strictlyEquals is broken
+ https://bugs.webkit.org/show_bug.cgi?id=36600
+
+ * qt/api/qscriptvalue.cpp:
+ (QScriptValue::strictlyEquals):
+ * qt/api/qscriptvalue_p.h:
+ (QScriptValuePrivate::strictlyEquals):
+ * qt/tests/qscriptvalue/qscriptvalue.pro:
+ * qt/tests/qscriptvalue/tst_qscriptvalue.h:
+ * qt/tests/qscriptvalue/tst_qscriptvalue_generated_comparison.cpp: Added.
+ (tst_QScriptValue::strictlyEquals_initData):
+ (tst_QScriptValue::strictlyEquals_makeData):
+ (tst_QScriptValue::strictlyEquals_test):
+
+2010-06-02 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ New function QScriptEngine::newObject.
+
+ The function creates a object of class Object and returns it
+ as a QScriptValue.
+
+ [Qt] QScriptEngine API should contain a newObject function
+ https://bugs.webkit.org/show_bug.cgi?id=39114
+
+ * qt/api/qscriptengine.cpp:
+ (QScriptEngine::newObject):
+ * qt/api/qscriptengine.h:
+ * qt/api/qscriptengine_p.cpp:
+ (QScriptEnginePrivate::newObject):
+ * qt/api/qscriptengine_p.h:
+ * qt/tests/qscriptengine/tst_qscriptengine.cpp:
+ (tst_QScriptEngine::newObject):
+
+2010-06-02 Gabor Loki <loki@webkit.org>
+
+ Reviewed by Gavin Barraclough.
+ https://bugs.webkit.org/show_bug.cgi?id=40011
+
+ Thumb-2 build fix: The offset parameter of ldrh should be encoded as an
+ imm12 immediate constant in load16. If it is not fit in the instruction
+ a temporary register has to be used.
+
+ * assembler/MacroAssemblerARMv7.h:
+ (JSC::MacroAssemblerARMv7::load16):
+
+2010-06-02 Sterling Swigart <sswigart@google.com>
+
+ Reviewed by David Levin.
+
+ Image Resizer Patch 0: Added compilation argument to conditionally compile pending patches.
+ https://bugs.webkit.org/show_bug.cgi?id=39906
+
+ * Configurations/FeatureDefines.xcconfig:
+
+2010-06-01 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Bug 40021 - Refactor bytecode generation for calls so that register for this & args are allocated together
+
+ This is a useful stepping stone towards reversing argument order.
+
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::BytecodeGenerator):
+ (JSC::BytecodeGenerator::addParameter):
+ (JSC::BytecodeGenerator::emitCall):
+ (JSC::BytecodeGenerator::emitCallEval):
+ (JSC::BytecodeGenerator::emitConstruct):
+ * bytecompiler/BytecodeGenerator.h:
+ (JSC::CallArguments::thisRegister):
+ (JSC::CallArguments::argumentRegister):
+ (JSC::CallArguments::callFrame):
+ (JSC::CallArguments::count):
+ (JSC::BytecodeGenerator::shouldEmitProfileHooks):
+ * bytecompiler/NodesCodegen.cpp:
+ (JSC::NewExprNode::emitBytecode):
+ (JSC::CallArguments::CallArguments):
+ (JSC::EvalFunctionCallNode::emitBytecode):
+ (JSC::FunctionCallValueNode::emitBytecode):
+ (JSC::FunctionCallResolveNode::emitBytecode):
+ (JSC::FunctionCallBracketNode::emitBytecode):
+ (JSC::FunctionCallDotNode::emitBytecode):
+ (JSC::CallFunctionCallDotNode::emitBytecode):
+ (JSC::ApplyFunctionCallDotNode::emitBytecode):
+
+2010-06-01 Yong Li <yoli@rim.com>
+
+ Reviewed by Darin Adler.
+
+ Explicitly use PTHREAD_MUTEX_NORMAL to create pthread mutex.
+ https://bugs.webkit.org/show_bug.cgi?id=39893
+
+ * wtf/ThreadingPthreads.cpp:
+ (WTF::Mutex::Mutex):
+
+2010-06-01 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Xan Lopez.
+
+ [GTK] Use DEFINE_STATIC_LOCAL for threadMapMutex and threadMap
+ https://bugs.webkit.org/show_bug.cgi?id=39831
+
+ Use DEFINE_STATIC_LOCAL for static local variables.
+
+ * wtf/gtk/ThreadingGtk.cpp:
+ (WTF::threadMapMutex):
+ (WTF::threadMap):
+ (WTF::identifierByGthreadHandle):
+
+2010-06-01 Kent Tamura <tkent@chromium.org>
+
+ Reviewed by Shinichiro Hamaji.
+
+ Fix style errors of dtoa
+ https://bugs.webkit.org/show_bug.cgi?id=39972
+
+ Fix all errors reported by check-webkit-style.
+
+ * wtf/dtoa.cpp:
+ * wtf/dtoa.h:
+
+2010-05-30 Darin Adler <darin@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ * wtf/OwnArrayPtr.h:
+ (WTF::OwnArrayPtr::set): Fix the assertion in here to match the one in OwnPtr.
+ At some point someone fixed the "asserts when assigning to 0 and the pointer is
+ already 0" issue in OwnPtr but forgot to do it here.
+
+2010-05-29 Geoffrey Garen <ggaren@apple.com>
+
+ Windows build fix: Updated exported symbols.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-05-29 Geoffrey Garen <ggaren@apple.com>
+
+ Disabled ENABLE_JIT_OPTIMIZE_NATIVE_CALL on Windows for now, until I
+ can figure out why it's crashing.
+
+ * wtf/Platform.h:
+
+2010-05-29 Geoffrey Garen <ggaren@apple.com>
+
+ Fixed Windows crash seen on buildbot.
+
+ * jit/JITOpcodes32_64.cpp:
+ (JSC::JIT::privateCompileCTINativeCall): __fastcall puts the first
+ argument in ecx.
+
+2010-05-28 Geoffrey Garen <ggaren@apple.com>
+
+ Windows build fix: Updated exported symbols.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-05-28 Geoffrey Garen <ggaren@apple.com>
+
+ Qt build fix: disable a little more stuff when JIT_OPTIMIZE_NATIVE_CALL
+ is disabled.
+
+ * runtime/Lookup.cpp:
+ (JSC::setUpStaticFunctionSlot):
+ * runtime/Lookup.h:
+ * wtf/Platform.h:
+
+2010-05-28 Geoffrey Garen <ggaren@apple.com>
+
+ Windows build fix: Updated exported symbols.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-05-28 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig, Gavin Barraclough, Oliver Hunt.
+
+ Simplified the host calling convention.
+
+ 22.5% speedup on 32-bit host function calls. 9.5% speedup on 64-bit host
+ function calls.
+
+ No change on SunSpider.
+
+ All JS calls (but not constructs, yet) now go through the normal JS
+ calling convention via the RegisterFile. As a result, the host calling
+ convention, which used to be this
+
+ JSValue (JSC_HOST_CALL *NativeFunction)(ExecState*, JSObject*, JSValue thisValue, const ArgList&)
+
+ is now this
+
+ JSValue (JSC_HOST_CALL *NativeFunction)(ExecState*)
+
+ Callee, 'this', and argument access all hapen relative to the ExecState*,
+ which is a pointer into the RegisterFile.
+
+ This patch comes in two parts.
+
+ PART ONE: Functional code changes.
+
+ * wtf/Platform.h: Disabled optimized calls on platforms I didn't test.
+ We can re-enable once we verify that host calls on these platforms are
+ correct.
+
+ * debugger/DebuggerCallFrame.cpp:
+ (JSC::DebuggerCallFrame::functionName):
+ (JSC::DebuggerCallFrame::calculatedFunctionName): Updated for change to
+ ExecState::callee().
+
+ (JSC::DebuggerCallFrame::thisObject): Updated for removal of ExecState::thisValue().
+
+ * interpreter/CallFrame.cpp:
+ * interpreter/CallFrame.h:
+ (JSC::ExecState::callee):
+ (JSC::ExecState::scopeChain):
+ (JSC::ExecState::init): Changed callee() to be JSObject* instead of
+ JSFunction* -- now, it might be some other callable host object.
+
+ (JSC::ExecState::hostThisRegister):
+ (JSC::ExecState::hostThisValue):
+ (JSC::ExecState::argumentCount):
+ (JSC::ExecState::argumentCountIncludingThis):
+ (JSC::ExecState::argument):
+ (JSC::ExecState::setArgumentCountIncludingThis):
+ (JSC::ExecState::setCallee): Added convenient accessors for arguments
+ from within a host function. Removed thisValue() because it was too
+ tempting to use incorrectly, and it only had one or two clients, anyway.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::callEval): Updated for removal of ExecState::thisValue().
+
+ (JSC::Interpreter::throwException): Be sure to shrink the register file
+ before invoking the exception handler, to reduce the chances that the
+ handler will re-throw in the case of stack overflow. (Re-throwing is now
+ more likely than it used to be, since standardizing the calling convention
+ implicitly added stack overflow checks to some places where they used to be missing.)
+
+ (JSC::Interpreter::execute): Clarified the scope of DynamicGlobalObjectScope.
+ Updated for CallFrame::init API change.
+
+ (JSC::Interpreter::executeCall): Clarified scope of DynamicGlobalObjectScope.
+ Updated for CallFrame::init API change. Added support for calling a host
+ function.
+
+ (JSC::Interpreter::executeConstruct): Clarified scope of DynamicGlobalObjectScope.
+ Updated for CallFrame::init API change.
+
+ (JSC::Interpreter::prepareForRepeatCall): Updated for CallFrame::init API change.
+
+ (JSC::Interpreter::privateExecute): Updated for CallFrame::init API change.
+ Added some explicit JSValue(JSObject*) initialization, since relaxing
+ the JSFunction* restriction on callee has made register types more ambiguous.
+ Removed toThisObject() conversion, since all callees do it themselves now.
+ Updated host function call for new host function signature. Updated for
+ change to ExecState::argumentCount() API.
+
+ * interpreter/Register.h:
+ (JSC::Register::):
+ (JSC::Register::operator=):
+ (JSC::Register::function): Changed callee() to be JSObject* instead of
+ JSFunction* -- now, it might be some other callable host object.
+
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::privateCompileCTINativeCall):
+ * jit/JITOpcodes32_64.cpp:
+ (JSC::JIT::privateCompileCTINativeCall): Deleted a bunch of code that
+ set up the arguments to host functions -- all but one of the arguments
+ are gone now. This is the actual optimization.
+
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION): Updated for ExecState and Register API
+ changes noted above. Removed toThisObject() conversion, since all callees
+ do it themselves now.
+
+ * runtime/ArgList.h:
+ (JSC::ArgList::ArgList): ArgList is getting close to unused. Added a
+ temporary shim for converting from ExecState* to ArgList where it's still
+ necessary.
+
+ * runtime/Arguments.h:
+ (JSC::Arguments::getArgumentsData):
+ (JSC::Arguments::Arguments): Updated for ExecState and Register API
+ changes noted above.
+
+ * runtime/CallData.cpp:
+ (JSC::call): Changed call always to call Interpreter::executeCall, even
+ for host functions. This ensures that the normal calling convention is
+ set up in the RegsiterFile when calling from C++ to host function.
+
+ * runtime/CallData.h: Changed host function signature as described above.
+
+ * runtime/ConstructData.cpp:
+ (JSC::construct): Moved JSFunction::construct code here so I could nix
+ JSFunction::call and JSFunction::call. We want a JSFunction-agnostic
+ way to call and construct, so that everything works naturally for non-
+ JSFunction objects.
+
+ * runtime/JSFunction.cpp:
+ (JSC::callHostFunctionAsConstructor):
+ * runtime/JSFunction.h: Updated for ExecState and Register API changes
+ noted above. Nixed JSFunction::call and JSFunction::construct, noted above.
+
+ * runtime/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::init): Ditto.
+
+ PART TWO: Global search and replace.
+
+ In the areas below, I used global search-and-replace to change
+ (ExecState*, JSObject*, JSValue, const ArgList&) => (ExecState*)
+ args.size() => exec->argumentCount()
+ args.at(i) => exec->argument(i)
+
+ * API/JSCallbackFunction.cpp:
+ (JSC::JSCallbackFunction::call):
+ * API/JSCallbackFunction.h:
+ * API/JSCallbackObject.h:
+ * API/JSCallbackObjectFunctions.h:
+ (JSC::::call):
+ * JavaScriptCore.exp:
+ * jsc.cpp:
+ (functionPrint):
+ (functionDebug):
+ (functionGC):
+ (functionVersion):
+ (functionRun):
+ (functionLoad):
+ (functionCheckSyntax):
+ (functionSetSamplingFlags):
+ (functionClearSamplingFlags):
+ (functionReadline):
+ (functionQuit):
+ * runtime/ArrayConstructor.cpp:
+ (JSC::callArrayConstructor):
+ (JSC::arrayConstructorIsArray):
+ * runtime/ArrayPrototype.cpp:
+ (JSC::arrayProtoFuncToString):
+ (JSC::arrayProtoFuncToLocaleString):
+ (JSC::arrayProtoFuncJoin):
+ (JSC::arrayProtoFuncConcat):
+ (JSC::arrayProtoFuncPop):
+ (JSC::arrayProtoFuncPush):
+ (JSC::arrayProtoFuncReverse):
+ (JSC::arrayProtoFuncShift):
+ (JSC::arrayProtoFuncSlice):
+ (JSC::arrayProtoFuncSort):
+ (JSC::arrayProtoFuncSplice):
+ (JSC::arrayProtoFuncUnShift):
+ (JSC::arrayProtoFuncFilter):
+ (JSC::arrayProtoFuncMap):
+ (JSC::arrayProtoFuncEvery):
+ (JSC::arrayProtoFuncForEach):
+ (JSC::arrayProtoFuncSome):
+ (JSC::arrayProtoFuncReduce):
+ (JSC::arrayProtoFuncReduceRight):
+ (JSC::arrayProtoFuncIndexOf):
+ (JSC::arrayProtoFuncLastIndexOf):
+ * runtime/BooleanConstructor.cpp:
+ (JSC::callBooleanConstructor):
+ * runtime/BooleanPrototype.cpp:
+ (JSC::booleanProtoFuncToString):
+ (JSC::booleanProtoFuncValueOf):
+ * runtime/DateConstructor.cpp:
+ (JSC::callDate):
+ (JSC::dateParse):
+ (JSC::dateNow):
+ (JSC::dateUTC):
+ * runtime/DatePrototype.cpp:
+ (JSC::formatLocaleDate):
+ (JSC::fillStructuresUsingTimeArgs):
+ (JSC::fillStructuresUsingDateArgs):
+ (JSC::dateProtoFuncToString):
+ (JSC::dateProtoFuncToUTCString):
+ (JSC::dateProtoFuncToISOString):
+ (JSC::dateProtoFuncToDateString):
+ (JSC::dateProtoFuncToTimeString):
+ (JSC::dateProtoFuncToLocaleString):
+ (JSC::dateProtoFuncToLocaleDateString):
+ (JSC::dateProtoFuncToLocaleTimeString):
+ (JSC::dateProtoFuncGetTime):
+ (JSC::dateProtoFuncGetFullYear):
+ (JSC::dateProtoFuncGetUTCFullYear):
+ (JSC::dateProtoFuncToGMTString):
+ (JSC::dateProtoFuncGetMonth):
+ (JSC::dateProtoFuncGetUTCMonth):
+ (JSC::dateProtoFuncGetDate):
+ (JSC::dateProtoFuncGetUTCDate):
+ (JSC::dateProtoFuncGetDay):
+ (JSC::dateProtoFuncGetUTCDay):
+ (JSC::dateProtoFuncGetHours):
+ (JSC::dateProtoFuncGetUTCHours):
+ (JSC::dateProtoFuncGetMinutes):
+ (JSC::dateProtoFuncGetUTCMinutes):
+ (JSC::dateProtoFuncGetSeconds):
+ (JSC::dateProtoFuncGetUTCSeconds):
+ (JSC::dateProtoFuncGetMilliSeconds):
+ (JSC::dateProtoFuncGetUTCMilliseconds):
+ (JSC::dateProtoFuncGetTimezoneOffset):
+ (JSC::dateProtoFuncSetTime):
+ (JSC::setNewValueFromTimeArgs):
+ (JSC::setNewValueFromDateArgs):
+ (JSC::dateProtoFuncSetMilliSeconds):
+ (JSC::dateProtoFuncSetUTCMilliseconds):
+ (JSC::dateProtoFuncSetSeconds):
+ (JSC::dateProtoFuncSetUTCSeconds):
+ (JSC::dateProtoFuncSetMinutes):
+ (JSC::dateProtoFuncSetUTCMinutes):
+ (JSC::dateProtoFuncSetHours):
+ (JSC::dateProtoFuncSetUTCHours):
+ (JSC::dateProtoFuncSetDate):
+ (JSC::dateProtoFuncSetUTCDate):
+ (JSC::dateProtoFuncSetMonth):
+ (JSC::dateProtoFuncSetUTCMonth):
+ (JSC::dateProtoFuncSetFullYear):
+ (JSC::dateProtoFuncSetUTCFullYear):
+ (JSC::dateProtoFuncSetYear):
+ (JSC::dateProtoFuncGetYear):
+ (JSC::dateProtoFuncToJSON):
+ * runtime/ErrorConstructor.cpp:
+ (JSC::callErrorConstructor):
+ * runtime/ErrorPrototype.cpp:
+ (JSC::errorProtoFuncToString):
+ * runtime/FunctionConstructor.cpp:
+ (JSC::callFunctionConstructor):
+ * runtime/FunctionPrototype.cpp:
+ (JSC::callFunctionPrototype):
+ (JSC::functionProtoFuncToString):
+ (JSC::functionProtoFuncApply):
+ (JSC::functionProtoFuncCall):
+ * runtime/JSGlobalObjectFunctions.cpp:
+ (JSC::encode):
+ (JSC::decode):
+ (JSC::globalFuncEval):
+ (JSC::globalFuncParseInt):
+ (JSC::globalFuncParseFloat):
+ (JSC::globalFuncIsNaN):
+ (JSC::globalFuncIsFinite):
+ (JSC::globalFuncDecodeURI):
+ (JSC::globalFuncDecodeURIComponent):
+ (JSC::globalFuncEncodeURI):
+ (JSC::globalFuncEncodeURIComponent):
+ (JSC::globalFuncEscape):
+ (JSC::globalFuncUnescape):
+ (JSC::globalFuncJSCPrint):
+ * runtime/JSGlobalObjectFunctions.h:
+ * runtime/JSONObject.cpp:
+ (JSC::JSONProtoFuncParse):
+ (JSC::JSONProtoFuncStringify):
+ * runtime/JSString.h:
+ * runtime/MathObject.cpp:
+ (JSC::mathProtoFuncAbs):
+ (JSC::mathProtoFuncACos):
+ (JSC::mathProtoFuncASin):
+ (JSC::mathProtoFuncATan):
+ (JSC::mathProtoFuncATan2):
+ (JSC::mathProtoFuncCeil):
+ (JSC::mathProtoFuncCos):
+ (JSC::mathProtoFuncExp):
+ (JSC::mathProtoFuncFloor):
+ (JSC::mathProtoFuncLog):
+ (JSC::mathProtoFuncMax):
+ (JSC::mathProtoFuncMin):
+ (JSC::mathProtoFuncPow):
+ (JSC::mathProtoFuncRandom):
+ (JSC::mathProtoFuncRound):
+ (JSC::mathProtoFuncSin):
+ (JSC::mathProtoFuncSqrt):
+ (JSC::mathProtoFuncTan):
+ * runtime/NativeErrorConstructor.cpp:
+ (JSC::callNativeErrorConstructor):
+ * runtime/NumberConstructor.cpp:
+ (JSC::callNumberConstructor):
+ * runtime/NumberPrototype.cpp:
+ (JSC::numberProtoFuncToString):
+ (JSC::numberProtoFuncToLocaleString):
+ (JSC::numberProtoFuncValueOf):
+ (JSC::numberProtoFuncToFixed):
+ (JSC::numberProtoFuncToExponential):
+ (JSC::numberProtoFuncToPrecision):
+ * runtime/ObjectConstructor.cpp:
+ (JSC::callObjectConstructor):
+ (JSC::objectConstructorGetPrototypeOf):
+ (JSC::objectConstructorGetOwnPropertyDescriptor):
+ (JSC::objectConstructorGetOwnPropertyNames):
+ (JSC::objectConstructorKeys):
+ (JSC::objectConstructorDefineProperty):
+ (JSC::objectConstructorDefineProperties):
+ (JSC::objectConstructorCreate):
+ * runtime/ObjectPrototype.cpp:
+ (JSC::objectProtoFuncValueOf):
+ (JSC::objectProtoFuncHasOwnProperty):
+ (JSC::objectProtoFuncIsPrototypeOf):
+ (JSC::objectProtoFuncDefineGetter):
+ (JSC::objectProtoFuncDefineSetter):
+ (JSC::objectProtoFuncLookupGetter):
+ (JSC::objectProtoFuncLookupSetter):
+ (JSC::objectProtoFuncPropertyIsEnumerable):
+ (JSC::objectProtoFuncToLocaleString):
+ (JSC::objectProtoFuncToString):
+ * runtime/ObjectPrototype.h:
+ * runtime/Operations.h:
+ (JSC::jsString):
+ * runtime/RegExpConstructor.cpp:
+ (JSC::callRegExpConstructor):
+ * runtime/RegExpObject.cpp:
+ (JSC::RegExpObject::test):
+ (JSC::RegExpObject::exec):
+ (JSC::callRegExpObject):
+ (JSC::RegExpObject::match):
+ * runtime/RegExpObject.h:
+ * runtime/RegExpPrototype.cpp:
+ (JSC::regExpProtoFuncTest):
+ (JSC::regExpProtoFuncExec):
+ (JSC::regExpProtoFuncCompile):
+ (JSC::regExpProtoFuncToString):
+ * runtime/StringConstructor.cpp:
+ (JSC::stringFromCharCodeSlowCase):
+ (JSC::stringFromCharCode):
+ (JSC::callStringConstructor):
+ * runtime/StringPrototype.cpp:
+ (JSC::stringProtoFuncReplace):
+ (JSC::stringProtoFuncToString):
+ (JSC::stringProtoFuncCharAt):
+ (JSC::stringProtoFuncCharCodeAt):
+ (JSC::stringProtoFuncConcat):
+ (JSC::stringProtoFuncIndexOf):
+ (JSC::stringProtoFuncLastIndexOf):
+ (JSC::stringProtoFuncMatch):
+ (JSC::stringProtoFuncSearch):
+ (JSC::stringProtoFuncSlice):
+ (JSC::stringProtoFuncSplit):
+ (JSC::stringProtoFuncSubstr):
+ (JSC::stringProtoFuncSubstring):
+ (JSC::stringProtoFuncToLowerCase):
+ (JSC::stringProtoFuncToUpperCase):
+ (JSC::stringProtoFuncLocaleCompare):
+ (JSC::stringProtoFuncBig):
+ (JSC::stringProtoFuncSmall):
+ (JSC::stringProtoFuncBlink):
+ (JSC::stringProtoFuncBold):
+ (JSC::stringProtoFuncFixed):
+ (JSC::stringProtoFuncItalics):
+ (JSC::stringProtoFuncStrike):
+ (JSC::stringProtoFuncSub):
+ (JSC::stringProtoFuncSup):
+ (JSC::stringProtoFuncFontcolor):
+ (JSC::stringProtoFuncFontsize):
+ (JSC::stringProtoFuncAnchor):
+ (JSC::stringProtoFuncLink):
+ (JSC::stringProtoFuncTrim):
+ (JSC::stringProtoFuncTrimLeft):
+ (JSC::stringProtoFuncTrimRight):
+
+2010-05-28 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Fix the JSObjectSetPrototype function.
+
+ A cycle in a prototype chain can cause an application hang or
+ even crash.
+ A check for a prototype chain cycles was added to
+ the JSObjectSetPrototype.
+
+ JSObjectSetPrototype doesn't check for cycle in prototype chain.
+ https://bugs.webkit.org/show_bug.cgi?id=39360
+
+ * API/JSObjectRef.cpp:
+ (JSObjectSetPrototype):
+ * API/tests/testapi.c:
+ (assertTrue):
+ (checkForCycleInPrototypeChain):
+ (main):
+ * runtime/JSObject.cpp:
+ (JSC::JSObject::put):
+ * runtime/JSObject.h:
+ (JSC::JSObject::setPrototypeWithCycleCheck):
+
+2010-05-28 Chao-ying Fu <fu@mips.com>
+
+ Reviewed by Eric Seidel.
+
+ Fix MIPS JIT DoubleGreaterThanOrEqual Operands
+ https://bugs.webkit.org/show_bug.cgi?id=39504
+
+ Swapped two operands of left and right for DoubleGreaterThanOrEqual.
+ This patch fixed two layout tests as follows.
+ fast/js/comparison-operators-greater.html
+ fast/js/comparison-operators-less.html
+
+ * assembler/MacroAssemblerMIPS.h:
+ (JSC::MacroAssemblerMIPS::branchDouble):
+
+2010-05-28 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Move jit compilation from linking thunks into cti_vm_lazyLink methods.
+
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ * jit/JITOpcodes32_64.cpp:
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+
+2010-05-28 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Bug 39898 - Move arity check into callee.
+
+ We can reduce the size of the virtual call trampolines by moving the arity check
+ into the callee functions. As a following step we will be able to remove the
+ check for native function / codeblocks by performing translation in a lazy stub.
+
+ * interpreter/CallFrame.h:
+ (JSC::ExecState::init):
+ (JSC::ExecState::setReturnPC):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompile):
+ (JSC::JIT::linkCall):
+ (JSC::JIT::linkConstruct):
+ * jit/JIT.h:
+ (JSC::JIT::compile):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ * jit/JITOpcodes32_64.cpp:
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+ * runtime/Executable.cpp:
+ (JSC::FunctionExecutable::generateJITCodeForCall):
+ (JSC::FunctionExecutable::generateJITCodeForConstruct):
+ (JSC::FunctionExecutable::reparseExceptionInfo):
+ * runtime/Executable.h:
+ (JSC::NativeExecutable::NativeExecutable):
+ (JSC::FunctionExecutable::generatedJITCodeForCallWithArityCheck):
+ (JSC::FunctionExecutable::generatedJITCodeForConstructWithArityCheck):
+
+2010-05-27 Luiz Agostini <luiz.agostini@openbossa.org>
+
+ Reviewed by Darin Adler.
+
+ UTF-16 code points compare() for String objects
+ https://bugs.webkit.org/show_bug.cgi?id=39701
+
+ Moving compare() implementation from UString to StringImpl for it to be shared
+ with String. Adding overloaded free functions codePointCompare() in StringImpl
+ and WTFString. Renaming function compare in UString to codePointCompare to be
+ consistent.
+
+ * runtime/JSArray.cpp:
+ (JSC::compareByStringPairForQSort):
+ * runtime/UString.cpp:
+ * runtime/UString.h:
+ (JSC::codePointCompare):
+ * wtf/text/StringImpl.cpp:
+ (WebCore::codePointCompare):
+ * wtf/text/StringImpl.h:
+ * wtf/text/WTFString.cpp:
+ (WebCore::codePointCompare):
+ * wtf/text/WTFString.h:
+
+2010-05-26 Darin Adler <darin@apple.com>
+
+ Reviewed by Kent Tamura.
+
+ Null characters handled incorrectly in ToNumber conversion
+ https://bugs.webkit.org/show_bug.cgi?id=38088
+
+ * runtime/JSGlobalObjectFunctions.cpp:
+ (JSC::parseInt): Changed code to use UTF8String().data() instead of
+ ascii() to fix the thread safety issue. Code path is covered by existing
+ tests in run-javascriptcore-tests.
+ (JSC::parseFloat): Moved comment to UString::toDouble since the issue
+ affects all clients, not just parseFloat. Specifically, this also affects
+ standard JavaScript numeric conversion, ToNumber.
+
+ * runtime/UString.cpp:
+ (JSC::UString::toDouble): Added a comment about incorrect space skipping.
+ Changed trailing junk check to use the length of the CString instead of
+ checking for a null character. Also got rid of a little unneeded logic
+ in the case where we tolerate trailing junk.
+
+2010-05-27 Nathan Lawrence <nlawrence@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Search for the new allocation one word at a time. Improves
+ performance on SunSpider by approximately 1%.
+ http://bugs.webkit.org/show_bug.cgi?id=39758
+
+ * runtime/Collector.cpp:
+ (JSC::Heap::allocate):
+ * runtime/Collector.h:
+ (JSC::CollectorBitmap::advanceToNextPossibleFreeCell):
+
+2010-05-27 Kevin Ollivier <kevino@theolliviers.com>
+
+ [wx] Build fixes for Windows after recent changes.
+
+ * wscript:
+
+2010-05-27 Gustavo Noronha Silva <gns@gnome.org>
+
+ More build fixage for make dist.
+
+ * GNUmakefile.am:
+
+2010-05-27 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Darin Adler.
+
+ RVCT does not have strnstr.
+ https://bugs.webkit.org/show_bug.cgi?id=39719
+
+ Add COMPILER(RVCT) guard to strnstr in StringExtras.h as RVCT does not provide strnstr.
+
+ * wtf/StringExtras.h:
+
+2010-05-26 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 39795 - Add support for YARR JIT generation of greedy quantified parens at the end of the main disjunction.
+ (relanding r60267)
+
+ If the last item in a main disjunction is a quantified set of parentheses,
+ this is easier to code generate for than the general case for quantified
+ parentheses. This is because we never need to backtrack into the parentheses
+ - the first match will be the final and accepted match.
+
+ This patch also somewhat reverts a recent change to when fallback to PCRE
+ occurs. At the minute the compiler is tracking on patterns which will
+ require JIT fallback. This is handy from a performance perspective (it saves
+ the failed attempt at JIT compilation), but it means introducing knowledge
+ of the JITs capabilities into the other layers of the regex compilers. For
+ the specific feature of back-references, add a flag tracking their presence
+ on the pattern, and make these expressions fallback without attempting to
+ JIT. For parentheses, return to detecting which cases are have or have not
+ been handled during JIT compilation.
+
+ 18% progression on tagcloud, ~1.5% overall on sunspidey.
+
+ * yarr/RegexCompiler.cpp:
+ (JSC::Yarr::RegexPatternConstructor::atomBackReference):
+ (JSC::Yarr::RegexPatternConstructor::quantifyAtom):
+ * yarr/RegexJIT.cpp:
+ (JSC::Yarr::RegexGenerator::TermGenerationState::isLastTerm):
+ (JSC::Yarr::RegexGenerator::TermGenerationState::isMainDisjunction):
+ (JSC::Yarr::RegexGenerator::generateParenthesesGreedyNoBacktrack):
+ (JSC::Yarr::RegexGenerator::generateTerm):
+ (JSC::Yarr::RegexGenerator::RegexGenerator):
+ (JSC::Yarr::RegexGenerator::shouldFallBack):
+ (JSC::Yarr::jitCompileRegex):
+ * yarr/RegexPattern.h:
+ (JSC::Yarr::RegexPattern::RegexPattern):
+ (JSC::Yarr::RegexPattern::reset):
+
+2010-05-26 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by NOBODY (revert).
+
+ Temporarily rolling out r60267, I appear to have hoesed perf at the last minute. :-/ Fixing.
+
+ * yarr/RegexCompiler.cpp:
+ (JSC::Yarr::RegexPatternConstructor::atomBackReference):
+ (JSC::Yarr::RegexPatternConstructor::quantifyAtom):
+ * yarr/RegexJIT.cpp:
+ (JSC::Yarr::RegexGenerator::TermGenerationState::term):
+ (JSC::Yarr::RegexGenerator::generateParenthesesSingle):
+ (JSC::Yarr::RegexGenerator::generateTerm):
+ (JSC::Yarr::RegexGenerator::RegexGenerator):
+ (JSC::Yarr::jitCompileRegex):
+ * yarr/RegexPattern.h:
+ (JSC::Yarr::RegexPattern::RegexPattern):
+ (JSC::Yarr::RegexPattern::reset):
+
+2010-05-26 Gustavo Noronha Silva <gns@gnome.org>
+
+ Build fixes for make distcheck.
+
+ * GNUmakefile.am:
+
+2010-05-26 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 39795 - Add support for YARR JIT generation of greedy quantified parens at the end of the main disjunction.
+
+ If the last item in a main disjunction is a quantified set of parentheses,
+ this is easier to code generate for than the general case for quantified
+ parentheses. This is because we never need to backtrack into the parentheses
+ - the first match will be the final and accepted match.
+
+ This patch also somewhat reverts a recent change to when fallback to PCRE
+ occurs. At the minute the compiler is tracking on patterns which will
+ require JIT fallback. This is handy from a performance perspective (it saves
+ the failed attempt at JIT compilation), but it means introducing knowledge
+ of the JITs capabilities into the other layers of the regex compilers. For
+ the specific feature of back-references, add a flag tracking their presence
+ on the pattern, and make these expressions fallback without attempting to
+ JIT. For parentheses, return to detecting which cases are have or have not
+ been handled during JIT compilation.
+
+ 18% progression on tagcloud, ~1.5% overall on sunspidey.
+
+ * yarr/RegexCompiler.cpp:
+ (JSC::Yarr::RegexPatternConstructor::atomBackReference):
+ (JSC::Yarr::RegexPatternConstructor::quantifyAtom):
+ * yarr/RegexJIT.cpp:
+ (JSC::Yarr::RegexGenerator::TermGenerationState::isLastTerm):
+ (JSC::Yarr::RegexGenerator::TermGenerationState::isMainDisjunction):
+ (JSC::Yarr::RegexGenerator::generateParenthesesGreedyNoBacktrack):
+ (JSC::Yarr::RegexGenerator::generateTerm):
+ (JSC::Yarr::RegexGenerator::RegexGenerator):
+ (JSC::Yarr::RegexGenerator::shouldFallBack):
+ (JSC::Yarr::jitCompileRegex):
+ * yarr/RegexPattern.h:
+ (JSC::Yarr::RegexPattern::RegexPattern):
+ (JSC::Yarr::RegexPattern::reset):
+
+2010-05-26 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Fixed a crash seen on the Leopard bot, caused by merge.
+
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION): Get the return address from the callframe,
+ since it's no longer passed to us as an argument.
+
+2010-05-25 Geoffrey Garen <ggaren@apple.com>
+
+ Fixed build failure caused by merge.
+
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION): On error, return a single value, since this
+ function no longer returns a pair.
+
+2010-05-25 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ <rdar://problem/8020221>
+
+ Fixed a crash seen on Windows when calling a function with too many
+ arguments.
+
+ SunSpider reports no change.
+
+ No test because the ASSERT I added fires in existing tests.
+
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION): Make sure to grow the registerFile when too
+ many arguments have been provided, since the caller only allocated enough
+ registerFile space for the arguments it provided, not enough for the extra
+ copy of arguments we're going to need.
+
+2010-05-25 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Darin Adler.
+
+ Build fix for JSFunction
+ https://bugs.webkit.org/show_bug.cgi?id=39658
+
+ MSVC can't compile one of JSFunction constructors when JIT is disabled.
+ "PassRefPtr<NativeExecutable>" causes the compile error as NativeExecutable is not defined.
+ Add ENABLE(JIT) guard to the constructor.
+
+ * runtime/JSFunction.cpp:
+ (JSC::JSFunction::JSFunction):
+ * runtime/JSFunction.h:
+
+2010-05-24 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Bug 39643 - Clean up code generation in the JIT of stub function calls for op_call.
+
+ Presently, as soon as op-call strays off the hot path we set up a set of values on
+ the stack to be passed as arguments to cti functions, in case any should be called.
+
+ Instead, hoist the setup of the callframe to happen slightly sooner, and make the
+ cti functions to compile & check arity read these values from the callframe. This
+ allows up to remove the deprecated methods to manually set up cti arguments, rather
+ than using JITStubCall.h.
+
+ * interpreter/CallFrame.h:
+ * jit/JIT.h:
+ * jit/JITCall.cpp:
+ (JSC::JIT::compileOpCallInitializeCallFrame):
+ (JSC::JIT::compileOpCallVarargs):
+ (JSC::JIT::compileOpCallVarargsSlowCase):
+ (JSC::JIT::compileOpCall):
+ (JSC::JIT::compileOpCallSlowCase):
+ * jit/JITCall32_64.cpp:
+ (JSC::JIT::compileOpCallInitializeCallFrame):
+ (JSC::JIT::compileOpCallVarargs):
+ (JSC::JIT::compileOpCallVarargsSlowCase):
+ (JSC::JIT::compileOpCall):
+ (JSC::JIT::compileOpCallSlowCase):
+ * jit/JITInlineMethods.h:
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ * jit/JITOpcodes32_64.cpp:
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+ * jit/JITStubs.h:
+ (JSC::):
+
+2010-05-24 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+ Relanding r60075.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::dump):
+ (JSC::CodeBlock::getByIdExceptionInfoForBytecodeOffset):
+ * bytecode/CodeBlock.h:
+ * bytecode/Opcode.h:
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::BytecodeGenerator):
+ (JSC::BytecodeGenerator::emitConstruct):
+ * bytecompiler/BytecodeGenerator.h:
+ (JSC::BytecodeGenerator::emitGetByIdExceptionInfo):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ * jit/JIT.h:
+ * jit/JITCall.cpp:
+ (JSC::JIT::compileOpCall):
+ (JSC::JIT::compileOpCallSlowCase):
+ * jit/JITCall32_64.cpp:
+ (JSC::JIT::compileOpCall):
+ (JSC::JIT::compileOpCallSlowCase):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ (JSC::JIT::privateCompileCTINativeCall):
+ (JSC::JIT::emit_op_neq_null):
+ (JSC::JIT::emit_op_convert_this):
+ (JSC::JIT::emit_op_get_callee):
+ (JSC::JIT::emit_op_create_this):
+ * jit/JITOpcodes32_64.cpp:
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ (JSC::JIT::privateCompileCTINativeCall):
+ (JSC::JIT::emit_op_get_callee):
+ (JSC::JIT::emit_op_create_this):
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+ (JSC::JITThunks::hostFunctionStub):
+ * jit/JITStubs.h:
+ (JSC::JITThunks::ctiNativeConstruct):
+ (JSC::):
+ * runtime/ExceptionHelpers.cpp:
+ (JSC::createNotAnObjectError):
+ * runtime/Executable.h:
+ (JSC::NativeExecutable::create):
+ (JSC::NativeExecutable::NativeExecutable):
+ * runtime/JSFunction.cpp:
+ (JSC::callHostFunctionAsConstructor):
+ * runtime/JSFunction.h:
+ * wtf/Platform.h:
+
+== Rolled over to ChangeLog-2010-05-24 ==
diff --git a/Source/JavaScriptCore/ChangeLog-2002-12-03 b/Source/JavaScriptCore/ChangeLog-2002-12-03
new file mode 100644
index 0000000..bd63777
--- /dev/null
+++ b/Source/JavaScriptCore/ChangeLog-2002-12-03
@@ -0,0 +1,2271 @@
+2002-12-03 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by: Darin Adler
+
+ - fixed Deployment build.
+
+ * kjs/dtoa.cpp: Work around warnings.
+
+2002-12-03 Maciej Stachowiak <mjs@apple.com>
+
+ - fixed 3114790 - Gamespot reviews pages badly mis-rendering
+ because floating point numbers format wide
+
+ Reviewed by: David Hyatt
+
+ * kjs/dtoa.cpp: Imported float <--> string conversion routines
+ from David M. Gay. I changed this to fix warnings and avoid
+ colliding with names of standard library functions.
+ * kjs/dtoa.h: Added a header I made up for dtoa.cpp
+ * kjs/ustring.cpp:
+ (UString::from): Use new double to string routine (kjs_strtod).
+ (UString::toDouble): Use new string to double routine (kjs_dtoa).
+ * JavaScriptCore.pbproj/project.pbxproj: Added new files
+
+2002-11-27 John Sullivan <sullivan@apple.com>
+
+ * kjs/collector.cpp:
+ removed puts("COLLECT") leftover debugging spam that was
+ buggin' gramps
+
+=== Alexander-34 ===
+
+2002-11-26 Maciej Stachowiak <mjs@apple.com>
+
+ Change ActivationImp to be allocated via the garbage collector
+ again instead of on the stack. This fixes the following four
+ regressions but sadly it causes a 6% performance hit. It's
+ probably possibly to reduce the hit a bit by being smarter about
+ inlining and the way the marking list variant is implemented, but
+ I'll look into that later.
+
+ - fixed 3111500 - REGRESSION: crash in "KJS::ScopeChain::mark()" on www.posci.com
+ - fixed 3111145 - REGRESSION: reproducible crash in KJS hashtable lookup at time.com
+ - fixed 3110897 - REGRESSION: javascript crasher on http://bmwgallery.tripod.com/
+ - fixed 3109987 - REGRESSION: Reproducible crash in KJS ObjectImp at live365.com
+
+ Also:
+
+ - improved DEBUG_COLLECTOR mode a bit by never giving memory back
+ to the system.
+
+ * kjs/collector.cpp:
+ * kjs/context.h:
+ * kjs/function.cpp:
+ (ActivationImp::ActivationImp):
+ (ActivationImp::mark):
+ (ActivationImp::createArgumentsObject):
+ * kjs/function.h:
+ * kjs/internal.cpp:
+ (ContextImp::ContextImp):
+ (ContextImp::mark):
+ * kjs/list.cpp:
+ * kjs/list.h:
+ * kjs/value.cpp:
+ (Value::Value):
+
+2002-11-26 Darin Adler <darin@apple.com>
+
+ * kjs/property_map.cpp:
+ (PropertyMap::save): Look at the attributes the same way in the single hash entry
+ case as in the actual hash table case. Change the rule for which attributes to save
+ to "attributes that don't have the ReadOnly, DontEnum, or Function bit set".
+ Also fix bug where saving an empty property map would leave the count set to the old value.
+
+2002-11-26 Richard Williamson <rjw@apple.com>
+
+ Remove debugging code. Could be cause of performance regresssion.
+ * kjs/nodes.cpp:
+ (FunctionCallNode::evaluate):
+
+ Restire attributes correctly.
+ * kjs/property_map.cpp:
+
+2002-11-25 Richard Williamson <rjw@apple.com>
+
+ Use delete[] (not delete) operator to delete array.
+
+ * kjs/property_map.cpp:
+
+2002-11-25 Richard Williamson <rjw@apple.com>
+
+ Added debugging info. Fixed property map save function.
+
+ * kjs/nodes.cpp:
+ (FunctionCallNode::evaluate):
+ * kjs/property_map.cpp:
+
+2002-11-25 Richard Williamson <rjw@apple.com>
+
+ Changes for back/forward. Currently disabled.
+
+ * kjs/property_map.cpp:
+ * kjs/property_map.h:
+
+2002-11-25 Darin Adler <darin@apple.com>
+
+ * kjs/property_map.cpp: Rearrange code a little bit and tweak indentation.
+ This might provide a tiny speedup because we don't look at the single entry
+ any more in cases where the _table pointer is non-0.
+
+2002-11-24 Darin Adler <darin@apple.com>
+
+ - changed ScopeChain to not ref each item in the chain, and use
+ marking instead; gains 1% on JavaScript iBench
+
+ * kjs/context.h: Return chain by reference.
+ * kjs/internal.cpp: (ContextImp::mark): Mark the scope chain.
+ * kjs/interpreter.cpp: (Context::scopeChain): Return chain by reference.
+ * kjs/interpreter.h: Make some Context methods inline.
+ * kjs/nodes.cpp:
+ (ThisNode::evaluate): Get at ContextImp directly.
+ (ResolveNode::evaluateReference): Ditto.
+ (VarDeclNode::evaluate): Ditto.
+ (VarDeclNode::processVarDecls): Ditto.
+ (FuncDeclNode::processFuncDecl): Pass ScopeChain directly to avoid copying.
+ (FuncExprNode::evaluate): Ditto.
+ * kjs/object.cpp: Make scope and setScope inline.
+ * kjs/object.h: Make scope return a chain by reference. Make scope and
+ setScope both be inline. Use a normal ScopeChain instead of NoRefScopeChain
+ since they are now one and the same.
+ * kjs/scope_chain.cpp: Remove all the code to ref and deref objects.
+ Merge NoRefScopeChain in with ScopeChain since they both work this way now.
+ * kjs/scope_chain.h: Remove NoRefScopeChain and simplify the ref counts.
+ Make more functions inline.
+
+2002-11-24 Maciej Stachowiak <mjs@apple.com>
+
+ - fixed 3098356 - Hard hang on movie search at www.movietickets.com
+
+ * kjs/string_object.cpp:
+ (StringProtoFuncImp::call): When doing a regexp replacement that
+ results in an empty match, always move on to the next character
+ after doing the replacement. The previous code would hit an
+ infinite loop if an initial empty match was replaced with the
+ empty string.
+
+2002-11-24 Maciej Stachowiak <mjs@apple.com>
+
+ - fixed 3095446 - Crash on AppleScript page due to very long argument list
+
+ * kjs/grammar.y: Don't try to construct the argument list in the
+ right order, since that blows out the parser stack.
+ * kjs/nodes.cpp:
+ (ArgumentsNode::ArgumentsNode): Instead reverse the argument list
+ here.
+ * kjs/nodes.h: Make ArgumentsNode a friend of ArgumentListNode.
+ * kjs/grammar.cpp: Updated from grammar.y.
+
+2002-11-23 Maciej Stachowiak <mjs@apple.com>
+
+ - completed Darin's mostly-fix for 3037795 - Resource use
+ increases when accessing very high index value in array
+
+ The two missing pieces were handling sparse properties when
+ shrinking the array, and when sorting. Thse are now both taken
+ care of.
+
+ * kjs/array_instance.h:
+ * kjs/array_object.cpp:
+ (ArrayInstanceImp::put):
+ (ArrayInstanceImp::deleteProperty):
+ (ArrayInstanceImp::resizeStorage):
+ (ArrayInstanceImp::setLength):
+ (ArrayInstanceImp::sort):
+ (ArrayInstanceImp::pushUndefinedObjectsToEnd):
+ * kjs/identifier.h:
+ * kjs/object.h:
+ * kjs/property_map.cpp:
+ * kjs/property_map.h:
+ * kjs/reference_list.cpp:
+ (ReferenceList::append):
+ (ReferenceList::length):
+ * kjs/reference_list.h:
+ * kjs/ustring.cpp:
+ (UString::toUInt32):
+ * kjs/ustring.h:
+
+2002-11-23 Maciej Stachowiak <mjs@apple.com>
+
+ Numerous collector changes for a net gain of 3% on JS ibench:
+
+ - Replaced per-block bitmap with free list.
+ - Increased number of empty blocks kept around to 2.
+ - Doubled block size.
+ - When scanning heap in collector, skip scanning the rest of a
+ block as soon as we see as many live cells as the the number of
+ used cells it had originally.
+
+ Also the following collector changes unrelated to performance:
+
+ - Made constants `const int' instead of `static const int'.
+ - Miscellaneous code cleanup.
+
+ * kjs/collector.cpp:
+
+ - Added debugging mode enabled by defining DEBUG_GC which asserts
+ when a destroyed ValueImp
+
+ * kjs/internal.cpp:
+ (ContextImp::mark):
+ * kjs/value.cpp:
+ (Value::Value):
+ * kjs/value.h:
+ * kjs/config.h:
+
+2002-11-22 Darin Adler <darin@apple.com>
+
+ - replaced List class with a vector rather than a linked list, changed it
+ to use a pool of instances instead of all the nodes allocated off of the
+ heap; gives 10% gain on iBench
+
+ * kjs/list.h: Complete rewrite.
+ * kjs/list.cpp: Ditto.
+
+ * kjs/array_object.cpp: (compareWithCompareFunctionForQSort): Go back to
+ doing a clear and two appends here. Fast with the new list implementation.
+
+ * kjs/collector.h: Remove _COLLECTOR hack and just make rootObjectClasses
+ return a const void *.
+ * kjs/collector.cpp: Remove _COLLECTOR hack, and various other minor tweaks.
+
+2002-11-22 Darin Adler <darin@apple.com>
+
+ - prepare to reimplement KJS::List; move to its own file, add statistics
+
+ * kjs/function_object.cpp: (FunctionProtoFuncImp::call): Use new copyTail()
+ function rather than copy() and removeFirst().
+
+ * kjs/identifier.cpp: Add statistics, off by default.
+ * kjs/property_map.cpp: Add statistics, off by default.
+
+ * kjs/list.cpp: Added. Moved code here. To be rewritten.
+ * kjs/list.h: Added. Moved interface here. To be rewritten.
+
+ * kjs/types.cpp: Removed.
+ * kjs/types.h: Now just an empty header that includes other headers.
+
+ * JavaScriptCore.pbproj/project.pbxproj: Add new files, rearrange.
+
+2002-11-22 Maciej Stachowiak <mjs@apple.com>
+
+ - reduce cell size to 56 bytes from 64, now that nearly all
+ objects fit in that size. .5% speed gain and probably some
+ footprint gain.
+
+ * kjs/collector.cpp: Change CELL_SIZE from 64 to 56.
+
+2002-11-22 Darin Adler <darin@apple.com>
+
+ - change ScopeChain to be a singly linked list shares tails, gives 11% gain on iBench
+
+ * kjs/context.h:
+ (ContextImp::pushScope): Make inline, use push instead of prepend, and pass imp pointer.
+ (ContextImp::popScope): Make inline, use pop instead of removeFirst.
+ * kjs/function.cpp: (DeclaredFunctionImp::DeclaredFunctionImp): No need to copy.
+ * kjs/function_object.cpp: (FunctionObjectImp::construct): Use push instead of
+ prepend, and pass imp pointer.
+ * kjs/internal.cpp: (ContextImp::ContextImp): Use clear, push instead of prepend,
+ and pass imp pointers.
+ * kjs/nodes.cpp: (ResolveNode::evaluateReference): Use isEmpty, pop, and top instead
+ of ScopeChainIterator.
+ * kjs/object.h: Change _scope to be a NoRefScopeChain.
+ * kjs/object.cpp: No need to initialize _scope any more, since it's not a NoRefScopeChain.
+
+ * kjs/scope_chain.h: Rewrite, different implementation and interface.
+ * kjs/scope_chain.cpp: More of the same.
+
+2002-11-22 Maciej Stachowiak <mjs@apple.com>
+
+ - a simple change for .4% gain on ibench - instead of unmarking
+ all objects at the start of collection, instead unmark as part of
+ the sweep phase
+
+ * kjs/collector.cpp:
+ (Collector::collect): Remove separate unmarking pass and instead
+ unmark the objects that don't get collected during the sweep
+ phase.
+
+2002-11-21 Darin Adler <darin@apple.com>
+
+ - stop garbage collecting the ActivationImp objects, gets 3% on iBench
+ - pave the way to separate the argument lists from scope chains
+
+ * kjs/context.h: Added. Moved ContextImp here so it can use things defined
+ in function.h
+
+ * kjs/scope_chain.h: Added. Starting as a copy of List, to be improved.
+ * kjs/scope_chain.cpp: Added. Starting as a copy of List, to be improved.
+
+ * JavaScriptCore.pbproj/project.pbxproj: Rearranged things, added context.h.
+
+ * kjs/function.cpp:
+ (FunctionImp::call): Pass InterpreterImp, not ExecState, to ContextImp.
+ (DeclaredFunctionImp::DeclaredFunctionImp): List -> ScopeChain.
+ (ActivationImp::createArgumentsObject): ArgumentList -> List.
+ (GlobalFuncImp::call): Pass InterpreterImp, not an ExecState, to ContextImp.
+ * kjs/function.h: List -> ScopeChain.
+ * kjs/function_object.cpp: (FunctionObjectImp::construct): List -> ScopeChain.
+ * kjs/internal.cpp:
+ (ContextImp::ContextImp): Set the context in the interpreter.
+ (ContextImp::~ContextImp): Set the context in the interpreter to the caller.
+ (ContextImp::mark): Mark all the activation objects.
+ (InterpreterImp::InterpreterImp): Initialize context to 0.
+ (InterpreterImp::mark): Mark the top context.
+ (InterpreterImp::evaluate): Pass InterpreterImp to ContextImp.
+ * kjs/internal.h: Move ContextImp to its own header. Add setContext to InterpreterImp.
+ * kjs/interpreter.cpp: (Context::scopeChain): List -> ScopeChain.
+ * kjs/interpreter.h: List -> ScopeChain.
+ * kjs/nodes.cpp:
+ (ResolveNode::evaluateReference): List -> ScopeChain.
+ (FuncDeclNode::processFuncDecl): List -> ScopeChain.
+ (FuncExprNode::evaluate): List -> ScopeChain.
+ * kjs/object.cpp: List -> ScopeChain.
+ * kjs/object.h: List -> ScopeChain.
+
+ * kjs/types.h: Remove needsMarking features from List.
+ * kjs/types.cpp: Ditto.
+
+2002-11-21 Maciej Stachowiak <mjs@apple.com>
+
+ - reduced the size of PropertyMap by storing sizes and such in the
+ dynamically allocated part of the object to reduce the size of
+ ObjectImp - .5% speed improvement on JS iBench.
+
+ * kjs/property_map.cpp:
+ * kjs/property_map.h:
+
+2002-11-21 Maciej Stachowiak <mjs@apple.com>
+
+ * Makefile.am: Pass symroots for this tree to pbxbuild.
+
+=== Alexander-33 ===
+
+2002-11-21 Darin Adler <darin@apple.com>
+
+ * kjs/property_map.cpp: More assertions.
+
+2002-11-21 Darin Adler <darin@apple.com>
+
+ * kjs/property_map.cpp: Turn that consistency check back off.
+
+2002-11-21 Darin Adler <darin@apple.com>
+
+ - someone somewhere must be defining a macro named check, causing a compile failure in WebCore
+
+ Rename check() to checkConsistency().
+
+ * kjs/property_map.h: Rename.
+ * kjs/property_map.cpp: Yes, rename.
+
+2002-11-21 Darin Adler <darin@apple.com>
+
+ - add self-check to property map in hopes of finding the cnet.com bug
+
+ * kjs/property_map.h: Add check() function.
+ * kjs/property_map.cpp: Add the checking, controlled by DO_CONSISTENCY_CHECK.
+
+ - fixed UChar interface so it's not so slow in debug builds
+
+ * kjs/ustring.h: Nothing in UChar needs to be private.
+
+ * kjs/function.cpp: (GlobalFuncImp::call):
+ * kjs/function_object.cpp: (FunctionObjectImp::construct):
+ * kjs/identifier.cpp:
+ * kjs/lexer.cpp: (Lexer::setCode), (Lexer::shift):
+ * kjs/lookup.cpp: (keysMatch):
+ * kjs/ustring.cpp: (UString::Rep::computeHash), (KJS::compare):
+ Use the "uc" field instead of the "unicode()" inline function.
+
+2002-11-21 Darin Adler <darin@apple.com>
+
+ - fixed a null-dereference I ran into while trying to reproduce bug 3107351
+
+ * kjs/function.h: Change ActivationImp constructor to take context parameter.
+ * kjs/function.cpp: (ActivationImp::ActivationImp): Take context parameter,
+ not execution state parameter.
+
+ * kjs/internal.cpp: (ContextImp::ContextImp): Initialize activation object
+ from context, not execution state, because the new context is not yet in the
+ execution state.
+
+2002-11-20 Darin Adler <darin@apple.com>
+
+ - added a feature for Richard to use in his back/forward cache
+
+ * kjs/object.h: Added save/restoreProperties.
+ * kjs/property_map.h: Here too.
+ * kjs/property_map.cpp: Here too.
+
+2002-11-20 Darin Adler <darin@apple.com>
+
+ - created argument list objects only on demand for a 7.5% speedup
+
+ * kjs/function.h: Change ActivationImp around.
+ * kjs/function.cpp:
+ (FunctionImp::call): Pass a pointer to the arguments list to avoid ref/unref.
+ (FunctionImp::get): Get the function pointer from the context directly,
+ not the activation object.
+ (ArgumentsImp::ArgumentsImp): Add an overload that takes no arguments.
+ (ActivationImp::ActivationImp): Store a context pointer and an arguments object pointer.
+ (ActivationImp::get): Special case for arguments, create it and return it.
+ (ActivationImp::put): Special case for arguments, can't be set.
+ (ActivationImp::hasProperty): Special case for arguments, return true.
+ (ActivationImp::deleteProperty): Special case for arguments, refuse to delete.
+ (ActivationImp::mark): Mark the arguments object.
+ (ActivationImp::createArgumentsObject): Do the work of actually creating it.
+ (GlobalFuncImp::call): Use stack-based objects for the ContextImp and ExecState.
+
+ * kjs/internal.h: Keep function and arguments pointer in the context.
+ * kjs/internal.cpp:
+ (ContextImp::ContextImp): Don't pass in the func and args when making an ActivationImp.
+ (InterpreterImp::evaluate): Use stack-based objects here.
+
+ * kjs/types.h: Add ArgumentList as a synonym for List, soon to be separate.
+
+2002-11-20 Maciej Stachowiak <mjs@apple.com>
+
+ Reduced the size of ValueImp by 8 bytes for a .5% speedup.
+
+ * kjs/value.h: Removed destructed flag. Made refcount and flag 16
+ bits each.
+ * kjs/value.cpp:
+ (ValueImp::~ValueImp): Don't set destructed flag.
+
+2002-11-20 Darin Adler <darin@apple.com>
+
+ * kjs/types.cpp: Keep ref count for the whole lists of nodes.
+ Doesn't speed things up much, less than 1%.
+
+2002-11-20 Maciej Stachowiak <mjs@apple.com>
+
+ * kjs/collector.cpp:
+ (Collector::allocate): Clear the flags on newly allocated objects.
+
+2002-11-20 Darin Adler <darin@apple.com>
+
+ - oops, checked in big regression instead of 5% speedup
+
+ * kjs/function.cpp: (ActivationImp::ActivationImp): Make a marking
+ list, not a refing list.
+
+ - a cut at the sparse array implementation
+
+ * kjs/array_instance.h: Keep storageLength separate from length.
+ * kjs/array_object.cpp:
+ (ArrayInstanceImp::ArrayInstanceImp): Start with storageLength == length.
+ (ArrayInstanceImp::get): Check against storage length.
+ (ArrayInstanceImp::put): Ditto.
+ (ArrayInstanceImp::hasProperty): Ditto.
+ (ArrayInstanceImp::deleteProperty): Ditto.
+ (ArrayInstanceImp::setLength): Only enlarge storage length up to a cutoff.
+ (ArrayInstanceImp::mark): Use storageLength.
+ (ArrayInstanceImp::pushUndefinedObjectsToEnd): Added FIXME.
+
+2002-11-20 Darin Adler <darin@apple.com>
+
+ - decrease ref/deref -- 5% speedup in iBench
+
+ * JavaScriptCore.pbproj/project.pbxproj: Added array_instance.h
+ * kjs/array_instance.h: Added so it can be shared by function.h.
+
+ * kjs/array_object.cpp:
+ * kjs/array_object.h:
+ * kjs/bool_object.cpp:
+ * kjs/bool_object.h:
+ * kjs/collector.cpp:
+ * kjs/date_object.cpp:
+ * kjs/date_object.h:
+ * kjs/error_object.cpp:
+ * kjs/function.cpp:
+ * kjs/function.h:
+ * kjs/function_object.cpp:
+ * kjs/internal.cpp:
+ * kjs/internal.h:
+ * kjs/math_object.cpp:
+ * kjs/nodes.cpp:
+ * kjs/number_object.cpp:
+ * kjs/object.cpp:
+ * kjs/object.h:
+ * kjs/object_object.cpp:
+ * kjs/property_map.cpp:
+ * kjs/reference.cpp:
+ * kjs/reference.h:
+ * kjs/regexp_object.cpp:
+ * kjs/string_object.cpp:
+ * kjs/string_object.h:
+ * kjs/value.cpp:
+ * kjs/value.h:
+ Switched lots of interfaces so they don't require ref/deref.
+
+2002-11-20 Maciej Stachowiak <mjs@apple.com>
+
+ Fixed the two most obvious problems with the new GC for another 6%
+ improvement.
+
+ * kjs/collector.cpp:
+ (Collector::allocate): Don't bother doing the bit tests on a bitmap word if
+ all it's bits are on.
+ (Collector::collect): Track memoryFull boolean.
+ * kjs/collector.h: Inlined outOfMemory since it was showing up on profiles.
+
+2002-11-20 Maciej Stachowiak <mjs@apple.com>
+
+ Rewrote garbage collector to make blocks of actual memory instead
+ of blocks of pointers. 7% improvement on JavaScript
+ iBench. There's still lots of room to tune the new GC, this is
+ just my first cut.
+
+ * kjs/collector.cpp:
+ (Collector::allocate):
+ (Collector::collect):
+ (Collector::size):
+ (Collector::outOfMemory):
+ (Collector::finalCheck):
+ (Collector::numGCNotAllowedObjects):
+ (Collector::numReferencedObjects):
+ (Collector::liveObjectClasses):
+ * kjs/collector.h:
+ * kjs/function.cpp:
+ (ActivationImp::ActivationImp):
+ * kjs/function.h:
+
+2002-11-20 Darin Adler <darin@apple.com>
+
+ - on the road to killing ActivationImp
+
+ * kjs/function.h: Add get/put to FunctionImp. Remove argumentsObject() from
+ ActivationImp. Add function() to ActivationImp.
+ * kjs/function.cpp:
+ (FunctionImp::FunctionImp): No arguments property.
+ (FunctionImp::call): No need to set up the arguments property.
+ (FunctionImp::parameterString): Remove ** strangeness.
+ (FunctionImp::processParameters): Ditto.
+ (FunctionImp::get): Added, handles arguments and length properties.
+ (FunctionImp::put): Ditto.
+ (FunctionImp::hasProperty): Ditto.
+ (FunctionImp::deleteProperty): Ditto.
+ (ActivationImp::ActivationImp): Store a function pointer so we can find it
+ in the context.
+
+ * kjs/function_object.cpp: (FunctionObjectImp::construct): No need to set up
+ arguments property.
+ * kjs/nodes.cpp: (FuncExprNode::evaluate): No need to set up length property.
+
+ * kjs/internal.h: Return ObjectImp * for activation object.
+
+ * kjs/interpreter.h: Remove stray declaration of ExecStateImp.
+
+2002-11-20 Darin Adler <darin@apple.com>
+
+ - add a couple of list operations to avoid clearing lists so much during sorting; gives 1.5% iBench
+
+ * kjs/types.h: Added replaceFirst/replaceLast.
+ * kjs/types.cpp: (List::replaceFirst), (List::replaceLast): Added.
+
+ * kjs/array_object.cpp: (compareWithCompareFunctionForQSort): Use replaceFirst/replaceLast.
+
+ * kjs/property_map.cpp: Put in an ifdef so I can re-add/remove the single entry to see if
+ it has outlived its usefulness. (It hasn't yet.)
+
+2002-11-20 Darin Adler <darin@apple.com>
+
+ - atomic identifiers; gives another 6.5% in the iBench suite
+
+ * kjs/identifier.h: Did the real thing.
+ * kjs/identifier.cpp: Ditto.
+
+ * kjs/property_map.h: _tableSizeHashMask -> _tableSizeMask
+ * kjs/property_map.cpp: The above, plus take advantage of comparing
+ by pointer instead of by comparing bytes.
+
+2002-11-19 Darin Adler <darin@apple.com>
+
+ - a few more globals for often-used property names
+ - conversion to Identifier from UString must now be explicit
+
+ * kjs/error_object.cpp:
+ * kjs/function.cpp:
+ * kjs/function_object.cpp:
+ * kjs/identifier.cpp:
+ * kjs/identifier.h:
+ * kjs/lexer.cpp:
+ * kjs/nodes.cpp:
+ * kjs/number_object.cpp:
+ * kjs/object.cpp:
+ * kjs/object.h:
+ * kjs/string_object.cpp:
+ * kjs/testkjs.cpp:
+ * kjs/ustring.cpp:
+ * kjs/ustring.h:
+
+2002-11-19 Darin Adler <darin@apple.com>
+
+ - another step towards atomic identifiers; storing hash in the string rep. gives about
+ a 1.5% speedup in the JavaScript iBench
+
+ * kjs/ustring.h: Add a hash field to UString::Rep.
+ * kjs/ustring.cpp:
+ (UString::Rep::create): Set hash to uninitialized value.
+ (UString::Rep::destroy): Do the deleting in her, and call Identifier if needed.
+ (UString::Rep::computeHash): Added.
+ (UString::append): Set hash to 0 when modifying the string in place.
+ (UString::operator=): Ditto.
+
+ * kjs/property_map.cpp: Use the hash from UString.
+
+ * kjs/identifier.h: Added aboutToDestroyUStringRep.
+ * kjs/identifier.cpp: (Identifier::aboutToDestroyUStringRep): Added.
+
+2002-11-19 Darin Adler <darin@apple.com>
+
+ - next step towards atomic identifiers; Identifier is no longer derived from UString
+
+ * kjs/identifier.h: Remove base class and add _ustring member.
+ * kjs/identifier.cpp: Add null and an == that works with const char *.
+ * kjs/property_map.cpp: Get rep through _ustring.
+
+ * kjs/function.cpp: (FunctionImp::parameterString): Call ustring().
+ * kjs/function_object.cpp: (FunctionProtoFuncImp::call): Ditto.
+ * kjs/nodes.cpp:
+ (PropertyNode::evaluate): Ditto.
+ (VarDeclNode::evaluate): Ditto.
+ (ForInNode::execute): Ditto.
+ * kjs/nodes2string.cpp: (SourceStream::operator<<): Add overload for Identifier.
+ * kjs/reference.cpp: (Reference::getValue): Call ustring().
+ * kjs/regexp_object.cpp: (RegExpObjectImp::get): Call ustring().
+
+2002-11-19 Darin Adler <darin@apple.com>
+
+ - fixed memory trasher
+
+ * kjs/ustring.cpp: (UString::from): Fix "end of buffer" computation.
+
+2002-11-19 Darin Adler <darin@apple.com>
+
+ - a first step towards atomic identifiers in JavaScript
+
+ Most places that work with identifiers now use Identifier
+ instead of UString.
+
+ * kjs/identifier.cpp: Added.
+ * kjs/identifier.h: Added.
+ * JavaScriptCore.pbproj/project.pbxproj: Added files.
+
+ * kjs/array_object.cpp:
+ * kjs/array_object.h:
+ * kjs/completion.cpp:
+ * kjs/completion.h:
+ * kjs/date_object.cpp:
+ * kjs/date_object.h:
+ * kjs/function.cpp:
+ * kjs/function.h:
+ * kjs/function_object.cpp:
+ * kjs/grammar.cpp:
+ * kjs/grammar.cpp.h:
+ * kjs/grammar.h:
+ * kjs/grammar.y:
+ * kjs/internal.cpp:
+ * kjs/internal.h:
+ * kjs/lexer.cpp:
+ * kjs/lookup.cpp:
+ * kjs/lookup.h:
+ * kjs/math_object.cpp:
+ * kjs/math_object.h:
+ * kjs/nodes.cpp:
+ * kjs/nodes.h:
+ * kjs/number_object.cpp:
+ * kjs/number_object.h:
+ * kjs/object.cpp:
+ * kjs/object.h:
+ * kjs/property_map.cpp:
+ * kjs/property_map.h:
+ * kjs/reference.cpp:
+ * kjs/reference.h:
+ * kjs/regexp_object.cpp:
+ * kjs/regexp_object.h:
+ * kjs/string_object.cpp:
+ * kjs/string_object.h:
+
+2002-11-19 Darin Adler <darin@apple.com>
+
+ - fix hash function and key comparison for the other kind of hash table; yields 3%
+
+ * kjs/lookup.cpp:
+ (keysMatch): Added.
+ (Lookup::findEntry): Don't allocate and convert to ASCII just to search.
+
+2002-11-19 Darin Adler <darin@apple.com>
+
+ - another hash table fix; yields a 2% improvement on iBench JavaScript
+
+ * kjs/property_map.cpp: A few more places where we use & instead of %.
+
+ - some List changes that don't affect speed yet
+
+ * kjs/types.cpp:
+ (List::prependList): Tighten up a tiny bit.
+ (List::copy): Use prependList.
+ * kjs/types.h: Remove appendList and globalClear.
+
+ * kjs/interpreter.cpp: (Interpreter::finalCheck): Remove List::globalClear().
+
+2002-11-19 Darin Adler <darin@apple.com>
+
+ - fixed 3105026 -- REGRESSION: DHTML menus are broken all over the place
+
+ * kjs/types.cpp: (List::prepend): Fix backwards links in new node.
+
+2002-11-19 Darin Adler <darin@apple.com>
+
+ - a fix that gives another 1.5% on the iBench JavaScript test
+
+ * kjs/ustring.cpp: (UString::from): Stop using sprintf to format integers.
+
+2002-11-18 Darin Adler <darin@apple.com>
+
+ - reduced the creation of Value objects and hoisted the property map
+ into Object for another gain of about 6%
+
+ * JavaScriptCore.pbproj/project.pbxproj: Made property_map.h public.
+ * kjs/array_object.cpp:
+ (compareWithCompareFunctionForQSort): Don't wrap the ValueImp * in a Value
+ just to add it to a list.
+ (ArrayProtoFuncImp::call): Pass the globalObject directly so we don't have
+ to ref/deref.
+ * kjs/function.cpp:
+ (FunctionImp::call): Use a reference for the global object to avoid ref/deref.
+ (GlobalFuncImp::call): Ditto.
+ * kjs/internal.cpp:
+ (BooleanImp::toObject): Put the object directly into the list, don't create a Value.
+ (StringImp::toObject): Ditto.
+ (NumberImp::toObject): Ditto.
+ (InterpreterImp::evaluate): Use a reference for the global object.
+ * kjs/internal.h: Return a reference for the global object.
+ * kjs/interpreter.cpp: (Interpreter::globalObject): Ditto.
+ * kjs/interpreter.h: Ditto.
+ * kjs/object.cpp: Use _prop directly in the object, not a separate pointer.
+ * kjs/object.h: Ditto.
+ * kjs/types.cpp: Added List methods that work directly with ValueImp.
+ (List::append): Added a ValueImp version.
+ (List::prepend): Ditto.
+ (List::appendList): Work directly with the ValueImp's.
+ (List::prependList): Ditto.
+ (List::copy): Use appendList.
+ (List::empty): Use a shared global List.
+ * kjs/types.h: Update for above changes.
+
+2002-11-18 Darin Adler <darin@apple.com>
+
+ * kjs/property_map.cpp: Oops, copyright goes to Apple, not me.
+ * kjs/property_map.h: Ditto.
+
+2002-11-18 Darin Adler <darin@apple.com>
+
+ - property and string improvements giving a 7% or so improvement in JavaScript iBench
+
+ * kjs/property_map.h: Rewrite to use a hash table.
+ * kjs/property_map.cpp: Ditto.
+
+ * kjs/string_object.h:
+ * kjs/string_object.cpp:
+ (StringInstanceImp::StringInstanceImp): Construct a string with the right value
+ instead of putting the string in later.
+ (StringInstanceImp::get): Get the length from the string, not a separate property.
+ (StringInstanceImp::put): Ignore attempts to set length, since we don't put it in
+ the property map.
+ (StringInstanceImp::hasProperty): Return true for length.
+ (StringInstanceImp::deleteProperty): Return false for length.
+ (StringObjectImp::construct): Call new StringInstanceImp constructor. Don't try
+ to set a length property.
+
+ * kjs/ustring.h: Make the rep deref know how to deallocate the rep.
+ * kjs/ustring.cpp:
+ (UString::release): Move the real work to the rep's deref, since the hash table
+ now uses the rep directly.
+
+ * kjs/object.h: Remove unused field.
+
+2002-11-18 Maciej Stachowiak <mjs@apple.com>
+
+ Change List to completely avoid going through the GC
+ allocator. 3.6% performance improvement on JavaScript iBench.
+
+ * kjs/internal.cpp:
+ (InterpreterImp::mark): Don't mark the empty list.
+
+ For all the methods below I basically lifted the ListImp version
+ up to the List method with minor tweaks.
+
+ * kjs/types.cpp:
+ (ListIterator::ListIterator):
+ (List::List):
+ (List::operator=):
+ (List::~List):
+ (List::mark):
+ (List::append):
+ (List::prepend):
+ (List::appendList):
+ (List::prependList):
+ (List::removeFirst):
+ (List::removeLast):
+ (List::remove):
+ (List::clear):
+ (List::clearInternal):
+ (List::copy):
+ (List::begin):
+ (List::end):
+ (List::isEmpty):
+ (List::size):
+ (List::at):
+ (List::operator[]):
+ (List::empty):
+ (List::erase):
+ (List::refAll):
+ (List::derefAll):
+ (List::swap):
+ (List::globalClear):
+ * kjs/types.h:
+
+2002-11-18 Maciej Stachowiak <mjs@apple.com>
+
+ Fixed a horrible leak introduced with my last change that
+ somehow did not show up on my machine.
+
+ * kjs/types.cpp:
+ (List::List): Mark ListImp as GC allowed.
+
+2002-11-18 Maciej Stachowiak <mjs@apple.com>
+
+ Another step towards the List conversion: stop inheriting from Value.
+
+ * kjs/types.cpp:
+ (ListIterator::ListIterator):
+ (List::List):
+ (List::operator=):
+ (List::~List):
+ (List::mark):
+ (List::append):
+ (List::prepend):
+ (List::appendList):
+ (List::prependList):
+ (List::removeFirst):
+ (List::removeLast):
+ (List::remove):
+ (List::clear):
+ (List::copy):
+ (List::begin):
+ (List::end):
+ (List::isEmpty):
+ (List::size):
+ (List::at):
+ (List::operator[]):
+ * kjs/types.h:
+
+2002-11-18 Maciej Stachowiak <mjs@apple.com>
+
+ Partway to removing Value from List. Created a marking List
+ variant, used it in place of ListImp.
+
+ * kjs/internal.h: Removed List stuff.
+ * kjs/internal.cpp:
+ (InterpreterImp::mark): Call appropriate List method to do marking of
+ empty ListImp.
+ * kjs/object.h:
+ * kjs/object.cpp: Use marking List instead of ListImp *.
+ * kjs/types.h:
+ * kjs/types.cpp:
+ (List::List): New boolean needsMarking parameter.
+ (List::operator=): Perform trickery related to needsMarking.
+ (List::~List): Likewise.
+ (List::mark): Mark the ListImp.
+ (List::markEmptyList):
+ (ListImp::*): Moved here fron internal.cpp, they will be
+ integrated into the relevant List methods soon.
+
+2002-11-18 Darin Adler <darin@apple.com>
+
+ - another string constant discovered that can be optimized
+
+ * kjs/object.h: Add a property name constant for "__proto__".
+ * kjs/object.cpp: Define it.
+ (ObjectImp::get): Use it.
+ (ObjectImp::hasProperty): Use it.
+
+ - prepare to turn PropertyMap into a hash table
+
+ * kjs/object.cpp:
+ (ObjectImp::mark): Use the new PropertyMap::mark().
+ (ObjectImp::put): Use the new overload of PropertyMap::get().
+ (ObjectImp::deleteProperty): Use the new overload of PropertyMap::get().
+ (ObjectImp::propList): Use PropertyMap::addEnumerablesToReferenceList().
+
+ * kjs/property_map.h: Remove PropertyMapNode and make all node-related methods private.
+ Add mark(), a new overload of get() that returns attributes, a clear() that takes no attributes,
+ and addEnumerablesToReferenceList().
+ * kjs/property_map.cpp:
+ (PropertyMap::get): Added new overload.
+ (PropertyMap::clear): Added new overload.
+ (PropertyMap::mark): Added.
+ (PropertyMap::addEnumerablesToReferenceList): Added.
+
+ * kjs/ustring.h: Added a hash function.
+ * kjs/ustring.cpp: (KJS::hash): Added.
+
+2002-11-18 Darin Adler <darin@apple.com>
+
+ - simplified the ExecState class, which was showing up in profiles
+
+ Sped up JavaScript iBench by 6%.
+
+ * kjs/interpreter.h: Removed the level of indirection, and made it all inline.
+ * kjs/interpreter.cpp: Removed ExecState implementation from here altogether.
+
+ - fixed an oversight in my sort speedup
+
+ * kjs/array_object.h: Add pushUndefinedObjectsToEnd.
+ * kjs/array_object.cpp:
+ (ArrayInstanceImp::sort): Call pushUndefinedObjectsToEnd.
+ (ArrayInstanceImp::pushUndefinedObjectsToEnd): Added.
+ Pushes all undefined to the end of the array.
+
+2002-11-18 Darin Adler <darin@apple.com>
+
+ - fix worst speed problems on the sort page of the iBench JavaScript test
+
+ Sped up JavaScript iBench by 70%, the sort page by 88%.
+
+ * kjs/array_object.h: Add array-specific sort functions.
+ * kjs/array_object.cpp:
+ (compareByStringForQSort): Added.
+ (ArrayInstanceImp::sort): Added.
+ (compareWithCompareFunctionForQSort): Added.
+ (ArrayProtoFuncImp::call): Use ArrayInstanceImp::sort if the object being
+ sorted is actually an array.
+
+ * kjs/object.h: Add argumentsPropertyName.
+ * kjs/object.cpp: Add argumentsPropertyName.
+ * kjs/function.cpp:
+ (FunctionImp::FunctionImp): Use argumentsPropertyName to avoid making a UString.
+ (FunctionImp::call): Ditto.
+ (ActivationImp::ActivationImp): Ditto.
+ * kjs/function_object.cpp: (FunctionObjectImp::construct): Ditto.
+
+ * kjs/ustring.h: Added compare function for -1/0/+1 comparison.
+ * kjs/ustring.cpp: (KJS::compare): Added.
+
+2002-11-18 Maciej Stachowiak <mjs@apple.com>
+
+ Change ArgumentListNode operations to be iterative instead of
+ recursive. This probably fixes 3095446 (Crash in
+ KJS::ArgumentListNode::ref()) but I can't reproduce it myself so
+ I'm not 100% sure. I think the original bug was a stack overflow
+ and this change would remove that possibility.
+
+ * kjs/nodes.cpp:
+ (ArgumentListNode::ref): Make iterative.
+ (ArgumentListNode::deref): Make iterative.
+ (ArgumentListNode::evaluateList): Make iterative.
+
+=== Alexander-32 ===
+
+2002-11-14 Darin Adler <darin@apple.com>
+
+ - fixed 3101243 -- excite passes date that can't be parsed, results in bogus date at top right corner
+
+ * kjs/date_object.cpp: (KJS::KRFCDate_parseDate): Handle errors from strtol
+ by checking errno. Check the "string in a haystack" to be sure it's a multiple
+ of 3. Add case that allows year to be after time.
+
+2002-11-14 Darin Adler <darin@apple.com>
+
+ - fixed 3101191 -- REGRESSION: Hang loading excite.com
+
+ * kjs/date_object.cpp:
+ (mktimeUsingCF): Pick an arbitrary cutoff of 3000, and return -1 if the
+ year passed in is that big so we don't infinite loop. Also validate the
+ rest of the date with CFGregorianDateIsValid.
+ (DateProtoFuncImp::call): Handle a -1 result from mktime.
+ (DateObjectImp::construct): Check for NaN before calling mktime, and also
+ handle a -1 result from mktime.
+ (DateObjectFuncImp::call): Check for NaN before calling mktime, and also
+ handle a -1 result from mktime.
+
+2002-11-13 Darin Adler <darin@apple.com>
+
+ - fixed 3099930 -- dates/times without time zones are parsed as UTC by kjs,
+ local time by other browsers
+
+ * kjs/date_object.cpp:
+ (DateProtoFuncImp::call): Handle the NaN case better, like Mozilla and OmniWeb.
+ (DateObjectFuncImp::call): Return NaN rather than Undefined() for bad dates.
+ (KJS::parseDate): Return NaN rather than Undefined() or 0 for bad dates.
+ (KJS::KRFCDate_parseDate): Return -1 rather than 0 for bad dates.
+ Assume local time if no time zone is passed. Don't return 1 if we parse 0.
+
+2002-11-13 Darin Adler <darin@apple.com>
+
+ - fixed 3073230 -- JavaScript time calls do I/O by lstat()ing /etc/localtime
+
+ * kjs/date_object.cpp:
+ (formatDate): Added.
+ (formatTime): Added.
+ (formatLocaleDate): Added.
+ (formatLocaleTime): Added.
+ (DateProtoFuncImp::call): Changed to use the above functions instead of
+ using strftime.
+
+2002-11-08 Darin Adler <darin@apple.com>
+
+ * kjs/date_object.cpp:
+ (ctimeUsingCF): Added.
+ (timeUsingCF): Added.
+
+2002-11-07 Darin Adler <darin@apple.com>
+
+ * kjs/date_object.cpp: (mktimeUsingCF): Fix storage leak.
+
+2002-11-07 Maciej Stachowiak <mjs@apple.com>
+
+ - partial fix to 3073230 - JavaScript time calls do I/O by
+ lastat()ing /etc/localtime
+
+ * kjs/date_object.cpp:
+ (mktimeUsingCF): Implementation of mktime using CF.
+
+=== Alexander-31 ===
+
+2002-11-01 Darin Adler <darin@apple.com>
+
+ * kjs/object.cpp: Make the same change Maciej just did, but to the
+ other constructor right next to the one he changed.
+
+2002-10-31 Maciej Stachowiak <mjs@apple.com>
+
+ - fixed 3082660 - REGRESSION: one ListImp leaks opening/closing nearly empty web page
+
+ * kjs/object.cpp: Set gc allowed on freshly created ListImp, since
+ there is no List wrapper for it.
+
+2002-10-31 Darin Adler <darin@apple.com>
+
+ * kjs/grammar.y: Fix the APPLE_CHANGES thing here too.
+ * kjs/grammar.cpp: Regenerated this file.
+
+=== Alexander-30 ===
+
+2002-10-30 Darin Adler <darin@apple.com>
+
+ - fixed 3073230 -- Alex is doing file I/O when executing JavaScript by asking for localtime
+
+ I fixed this by using Core Foundation time functions instead.
+
+ * kjs/date_object.cpp:
+ (tmUsingCF): Function that uses Core Foundation to get the time and then puts it into
+ a tm struct.
+ (gmtimeUsingCF): Function used instead of gmtime (used a macro to make the substitution).
+ (localtimeUsingCF): Function used instead of localtime (used a macro to make the substitution).
+
+2002-10-26 Darin Adler <darin@apple.com>
+
+ - changed to use #if APPLE_CHANGES and #if !APPLE_CHANGES consistently
+
+ We no longer do #ifdef APPLE_CHANGES or #ifndef APPLE_CHANGES.
+
+ * kjs/collector.cpp:
+ * kjs/collector.h:
+ * kjs/grammar.cpp:
+ * kjs/internal.cpp:
+ * kjs/ustring.h:
+
+2002-10-25 Darin Adler <darin@apple.com>
+
+ - fixed 3038011 -- drop-down menu hierarchy broken at yahoo new acct page
+
+ * kjs/array_object.cpp: (ArrayProtoFuncImp::call):
+ Fix bug calling concat on an empty array. The old code tried to
+ optimize in a way that would prevent appending any arrays until
+ at least one element was in the destination array. So if you were
+ concatenating a non-empty array into an empty array, you got an empty array.
+
+=== Alexander-29 ===
+
+=== Alexander-28 ===
+
+2002-10-10 Darin Adler <darin@apple.com>
+
+ - fixed 3072643 -- infinite loop in JavaScript code at walgreens.com
+
+ The problem is that "xxx".indexOf("", 1) needs to return 1, but we
+ were returning 0.
+
+ * kjs/ustring.cpp:
+ (UString::find): Return pos, not 0, when the search string is empty.
+ (UString::rfind): Make sure that pos is not past the end of the string,
+ taking into account the search string; fixes a potential read off the end
+ of the buffer. Also return pos, not 0, when the search string is empty.
+
+=== Alexander-27 ===
+
+2002-10-07 Darin Adler <darin@apple.com>
+
+ Fixed absurdly high memory usage when looking at pages that use a lot of JavaScript.
+
+ * kjs/collector.cpp:
+ (Collector::allocate): Implement a new policy of doing a garbage collect every 1000
+ allocations. The old policy was both complicated and misguided.
+ (Collector::collect): Zero out the "number of allocations since last collect".
+
+2002-10-06 Darin Adler <darin@apple.com>
+
+ I noticed some broken lists at mapblast.com and tracked it down to this.
+
+ * kjs/array_object.cpp:
+ (ArrayInstanceImp::put): Don't truncate the list; only extend the length if
+ it's not already long enough.
+ (ArrayProtoFuncImp::call): Fix some ifdef'd code so it compiles if you turn
+ the ifdefs on.
+
+2002-10-04 Darin Adler <darin@apple.com>
+
+ Fixed problems parsing numbers that are larger than a long with parseInt.
+
+ * kjs/config.h: Define HAVE_FUNC_STRTOLL.
+ * kjs/function.cpp: (GlobalFuncImp::call):
+ Change parseInt to use strtoll if available.
+
+=== Alexander-26 ===
+
+2002-09-27 Darin Adler <darin@apple.com>
+
+ - fixed 3033969 -- repro crash (infinite recursion in JavaScript)
+ clicking on "screens" option at fsv.sf.net
+
+ * kjs/object.h: Change recursion limit to 100 levels rather than 1000.
+
+=== Alexander-25 ===
+
+2002-09-26 Darin Adler <darin@apple.com>
+
+ Fix the infinity problem Dave worked around. We didn't have the
+ configuration flags set right to make infinity work. Setting those
+ properly made everything work without changes to min and max.
+
+ * kjs/config.h: Define HAVE_FUNC_ISINF, HAVE_STRING_H, and
+ also WORDS_BIGENDIAN (if on ppc).
+
+ * kjs/math_object.cpp: (MathFuncImp::call): Roll out min and max
+ changes from yesterday.
+
+2002-09-25 David Hyatt <hyatt@apple.com>
+
+ Fix the impls of min/max to not use +inf/-inf when you have
+ arguments. Technically there's still a bug here for the no
+ argument case, probably caused by a screwup when +inf/-inf are
+ converted to doubles.
+
+ * kjs/math_object.cpp:
+ (MathFuncImp::call):
+
+2002-09-25 Darin Adler <darin@apple.com>
+
+ - fixed 3057964 -- JS problem performing MD5 script embedded in yahoo login page
+
+ * kjs/simple_number.h: Fix incorrect check for sign bit that was munging numbers
+ in the range 0x10000000 to 0x1FFFFFFF.
+
+=== Alexander-24 ===
+
+=== Alexander-22 ===
+
+2002-09-05 Maciej Stachowiak <mjs@apple.com>
+
+ First baby step towards moving List away from garbage collection.
+
+ * kjs/types.h: Add needsMarking boolean and make List inherit from
+ Value privately instead of publicly.
+
+2002-08-30 Darin Adler <darin@apple.com>
+
+ * JavaScriptCore.pbproj/project.pbxproj: Allowed the new Project Builder to put in
+ encodings for each file.
+
+=== Alexander-21 ===
+
+=== Alexander-20 ===
+
+2002-08-20 Darin Adler <darin@apple.com>
+
+ Three small changes to things that showed up in the sample.
+
+ 5% speed increase on cvs-js-performance test.
+
+ * kjs/simple_number.h: Check if double is an integer with d == (double)(int)d
+ instead of remainder(d, 1) == 0, saving a function call each time.
+
+ * kjs/ustring.cpp:
+ (UString::find): Compare the first character before calling memcmp for the rest.
+ (UString::rfind): Ditto.
+ (KJS::operator==): Don't do a strlen before starting to compare the characters.
+
+2002-08-20 Maciej Stachowiak <mjs@apple.com>
+
+ * kjs/object.cpp: Don't reference other ValueImps in the
+ destructor, they may have already been destroyed, and will have
+ GC_ALLOWED set already in any case.
+
+2002-08-19 Maciej Stachowiak <mjs@apple.com>
+
+ Fixed the bug that made sony.com menus come out wrong and made
+ aa.com crash (Radar 3027762).
+
+ Mode most methods inline.
+
+ * kjs/completion.cpp:
+ * kjs/completion.h:
+
+2002-08-19 Maciej Stachowiak <mjs@apple.com>
+
+ Maintain stack of old "arguments" property values for functions
+ implicitly on the system stack instead of explicitly in the
+ FunctionImp. This eliminates only a trivial number of GC
+ allocations (less than 200) but eliminates one of the two cases
+ where a ListImp * is stored directly, paving the way to separate
+ List from Value.
+
+ * kjs/function.h: Remove argStack, pushArgs and popArgs.
+ * kjs/function.cpp:
+ (FunctionImp::FunctionImp): Don't initalize argStack.
+ (FunctionImp::~FunctionImp): Remove comment about argStack.
+ (FunctionImp::mark): Don't mark the argStack.
+ (FunctionImp::call): Save old "arguments" property in a Value,
+ where it will be GC-protected, rather than keeping a list, and
+ restore the old value when done executing.
+
+2002-08-18 Darin Adler <darin@apple.com>
+
+ * kjs/internal.cpp: (KJS::printInfo): Remove one more CompletionType
+ that Maciej missed.
+
+2002-08-18 Maciej Stachowiak <mjs@apple.com>
+
+ Remove stray references to CompletionType and CompletionImp.
+
+ * kjs/completion.h:
+ * kjs/object.cpp:
+ * kjs/value.h:
+
+2002-08-18 Maciej Stachowiak <mjs@apple.com>
+
+ Separated Completion from Value and made it a pure stack
+ object. This removed another 160,000 of the remaining 580,000
+ garbage collected object allocations.
+
+ 6% speed increase on cvs-js-performance test.
+
+ * kjs/completion.cpp: Added. New implementation that doesn't
+ require a ValueImp *.
+ (Completion::Completion):
+ (Completion::complType):
+ (Completion::value):
+ (Completion::target):
+ (Completion::isValueCompletion):
+ * kjs/completion.h: Added.
+ * kjs/function.cpp:
+ (GlobalFuncImp::call): Removed some (apparently mistaken) uses of
+ Completion as a Value.
+ * kjs/internal.cpp:
+ * kjs/internal.h:
+ * kjs/types.cpp: Removed Completion stuff.
+ * kjs/types.h: Removed Completion stuff.
+ * JavaScriptCore.pbproj/project.pbxproj: Added new header.
+
+2002-08-16 Darin Adler <darin@apple.com>
+
+ Fix the Development build.
+
+ * kjs/object.cpp: Take out a use of ReferenceType.
+
+ * kjs/ustring.h: Added a bit more inlining.
+ * kjs/ustring.cpp: Moved the function out of here.
+
+2002-08-16 Maciej Stachowiak <mjs@apple.com>
+
+ Final step of the Reference change. Completely separate Reference
+ from Value, and eliminate ReferenceImp.
+
+ 18% speedup on cvs-js-performance test.
+
+ * kjs/internal.cpp, kjs/internal.h: Remove ReferenceImp.
+ * kjs/nodes.cpp:
+ (Node::evaluateReference): Use Reference::makeValueReference(),
+ not ConstReference.
+ * kjs/reference.cpp:
+ (Reference::Reference): New implementation, handles both regular
+ and value references.
+ (Reference::makeValueReference): Incorporate functionality of ConstReference
+ into this class.
+ (Reference::getBase): New implementation (incorporates error vase
+ for value references).
+ (Reference::getPropertyName): New implementation (incorporates error case
+ for value references).
+ (Reference::putValue): New implementation (incorporates error case
+ for value references).
+ (Reference::deleteValue): New implementation (incorporates error case
+ for value references).
+ (Reference::getValue): New implementation (incorporates special case
+ for value references).
+ (Reference::isMutable): New implementation.
+ * kjs/reference.h: New implementation that merges ReferenceImp
+ into the stack object.
+ * kjs/value.h, kjs/value.cpp: Removed all reference-related method.
+
+2002-08-16 Darin Adler <darin@apple.com>
+
+ - fixed 3026184 -- Hang going to http://aa.com/ while executing JavaScript
+
+ * kjs/simple_number.h: (SimpleNumber::value): Fixed conversion to a negative
+ number. The technique of using division was no good. Instead, or in the sign
+ bits as needed.
+
+2002-08-16 Maciej Stachowiak <mjs@apple.com>
+
+ * kjs/reference_list.h: Must include headers with "", not
+ <>. D'oh!
+
+2002-08-16 Maciej Stachowiak <mjs@apple.com>
+
+ * JavaScriptCore.pbproj/project.pbxproj: Install reference.h and
+ reference_list.h so WebCore compiles (duh).
+
+2002-08-16 Maciej Stachowiak <mjs@apple.com>
+
+ * JavaScriptCore.pbproj/project.pbxproj:
+ * kjs/internal.cpp:
+ * kjs/internal.h:
+ * kjs/nodes.cpp:
+ (Node::evaluateReference):
+ * kjs/reference.cpp:
+ (Reference::Reference):
+ (Reference::makeValueReference):
+ (Reference::getBase):
+ (Reference::getPropertyName):
+ (Reference::getValue):
+ (Reference::putValue):
+ (Reference::deleteValue):
+ (Reference::isMutable):
+ * kjs/reference.h:
+ * kjs/reference_list.h:
+ * kjs/value.cpp:
+ (ValueImp::dispatchToUInt32):
+ * kjs/value.h:
+
+2002-08-16 Maciej Stachowiak <mjs@apple.com>
+
+ Next step: reimplement ReferenceList from scratch, and store it as
+ an actual Reference object, so ReferenceList no longer depends on
+ Reference being a Value or having a ReferenceImp. A resizing
+ vector might be even better the way this is used.
+
+ Also moved Reference to its own header and implementation file in
+ preparation for reimplementing it.
+
+ * JavaScriptCore.pbproj/project.pbxproj:
+ * kjs/nodes.cpp:
+ (ForInNode::execute):
+ * kjs/reference.cpp: Added.
+ (Reference::Reference):
+ (Reference::dynamicCast):
+ (ConstReference::ConstReference):
+ * kjs/reference.h: Added.
+ * kjs/reference_list.cpp: Added.
+ (ReferenceList::ReferenceList):
+ (ReferenceList::operator=):
+ (ReferenceList::swap):
+ (ReferenceList::append):
+ (ReferenceList::~ReferenceList):
+ (ReferenceList::begin):
+ (ReferenceList::end):
+ (ReferenceListIterator::ReferenceListIterator):
+ (ReferenceListIterator::operator!=):
+ (ReferenceListIterator::operator->):
+ (ReferenceListIterator::operator++):
+ * kjs/reference_list.h:
+ * kjs/types.cpp:
+ * kjs/types.h:
+
+2002-08-16 Maciej Stachowiak <mjs@apple.com>
+
+ Fix Development build - some NDEBUG code had to be changed for the
+ Value/Reference split.
+
+ * kjs/internal.cpp:
+ (KJS::printInfo):
+ * kjs/nodes.cpp:
+ (FunctionCallNode::evaluate):
+
+2002-08-16 Maciej Stachowiak <mjs@apple.com>
+
+ * kjs/reference_list.h: Added file I forgot to check in last time.
+
+2002-08-15 Maciej Stachowiak <mjs@apple.com>
+
+ Phase 1 of optimization to stop allocating references through the
+ collector. This step clearly splits evaluating to a reference and
+ evaluating to a value, and moves all of the reference-specific
+ operations from Value to Reference. A special ConstReference class
+ helps out for the one case where you need special reference
+ operations if the result is a reference, and not otherwise.
+
+ Also, Reference now inherits privately from Value, and there is a
+ new ReferenceList class that inherits privately from List, so the
+ uses of Reference and Value are now completely orthogonal. This
+ means that as the next step, their implementations can be
+ completely disentangled.
+
+ This step has no actual performance impact.
+
+ * kjs/collector.cpp:
+ (Collector::collect):
+ * kjs/nodes.cpp:
+ (Node::evaluateReference):
+ (ResolveNode::evaluate):
+ (ResolveNode::evaluateReference):
+ (ElementNode::evaluate):
+ (PropertyValueNode::evaluate):
+ (AccessorNode1::evaluate):
+ (AccessorNode1::evaluateReference):
+ (AccessorNode2::evaluate):
+ (AccessorNode2::evaluateReference):
+ (ArgumentListNode::evaluateList):
+ (NewExprNode::evaluate):
+ (FunctionCallNode::evaluate):
+ (PostfixNode::evaluate):
+ (DeleteNode::evaluate):
+ (VoidNode::evaluate):
+ (TypeOfNode::evaluate):
+ (PrefixNode::evaluate):
+ (UnaryPlusNode::evaluate):
+ (NegateNode::evaluate):
+ (BitwiseNotNode::evaluate):
+ (LogicalNotNode::evaluate):
+ (MultNode::evaluate):
+ (AddNode::evaluate):
+ (ShiftNode::evaluate):
+ (RelationalNode::evaluate):
+ (EqualNode::evaluate):
+ (BitOperNode::evaluate):
+ (BinaryLogicalNode::evaluate):
+ (ConditionalNode::evaluate):
+ (AssignNode::evaluate):
+ (CommaNode::evaluate):
+ (VarDeclNode::evaluate):
+ (ExprStatementNode::execute):
+ (IfNode::execute):
+ (DoWhileNode::execute):
+ (WhileNode::execute):
+ (ForNode::execute):
+ (ForInNode::execute):
+ (ReturnNode::execute):
+ (WithNode::execute):
+ (CaseClauseNode::evaluate):
+ (SwitchNode::execute):
+ (ThrowNode::execute):
+ * kjs/nodes.h:
+ * kjs/types.cpp:
+ (ConstReference::ConstReference):
+ * kjs/types.h:
+ * kjs/value.h:
+
+2002-08-15 Darin Adler <darin@apple.com>
+
+ Tweaks and small bug fixes to Maciej's excellent new fixnum optimization.
+ Also updated or removed comments that call it "fixnum" instead of "simple number".
+
+ * kjs/simple_number.h: Change constant names so they don't SHOUT the way macro
+ names do. Added constants for shift, min, and max. Fixed off-by-1 error that
+ prevented us from using the extreme values on either end. Base the range of
+ numbers on a fixed 32 bits constant rather than the size of a long, because
+ code elsewhere depends on positive numbers fitting into both "unsigned" and
+ "UInt32" while assuming it doesn't need to check; we can easily change this
+ later. Used int types rather than long for essentially the same reason.
+ Fixed the value-extraction function so it will work for negative numbers even
+ if the shift is logical, not arithmetic, by using division instead.
+ Renamed functions to be quite terse since they are inside a class.
+
+ * kjs/value.h:
+ * kjs/value.cpp:
+ (ValueImp::dispatchToObject): Call NumberImp::toObject in a "non-virtual"
+ way rather than repeating the code here.
+ (ValueImp::dispatchToUInt32): Handle the negative number case correctly.
+ (ValueImp::dispatchGetBase): Call ValueImp::getBase in a "non-virtual"
+ way rather than repeating the code here.
+ (ValueImp::dispatchGetPropertyName): Call ValueImp::getPropertyName in a
+ "non-virtual" way rather than repeating the code here.
+ (ValueImp::dispatchPutValue): Call ValueImp::putValue in a "non-virtual"
+ way rather than repeating the code here.
+ (ValueImp::dispatchDeleteValue): Call ValueImp::deleteValue in a "non-virtual"
+ way rather than repeating the code here.
+ (Number::Number): Fixed a bug where the double-based constructor was casting
+ to long, so wouldn't do the "remainder" check.
+
+=== Alexander-19 ===
+
+=== Alexander-18 ===
+
+2002-08-15 Maciej Stachowiak <mjs@apple.com>
+
+ Phase 2 of fixnum optimization. Store any integral number that
+ will fit in two bits less than a long inside the ValueImp *
+ itself, thus avoiding the need to deal with the garbage collector
+ at all for these types. Such numbers comprised .5 million of the
+ 1.7 million ValueImps created during the cvs-js-performance test,
+ so traffic through the garbage collector should be
+
+ 20% improvement on cvs-js-performance. This may also show up on
+ cvs-base, but I did not compare and I am too lazy to make clean in
+ WebCore yet again.
+
+ This also significantly reduces memory footprint on
+ JavaScript-heavy pages. Size after going through
+ cvs-js-performance suite is now 22MB to 17.5MB.
+
+ * JavaScriptCore.pbproj/project.pbxproj:
+ * kjs/simple_number.h: Added. Some inline static methods for handling
+ simple numbers that are stored in the pointer.
+ * kjs/ustring.h:
+ * kjs/ustring.cpp:
+ (UString::from): Added new overload for long.
+ * kjs/value.cpp:
+ (ValueImp::marked): Add special case for simple numbers.
+ (ValueImp::setGcAllowed): Likewise.
+ (ValueImp::toInteger): Call dispatch version of
+ toUInt32(unsigned&), not the real method.
+ (ValueImp::toInt32): Likewise.
+ (ValueImp::toUInt32): Likewise.
+ (ValueImp::toUInt16): Likewise.
+ (ValueImp::dispatchType): Add special case for simple numbers.
+ (ValueImp::dispatchToPrimitive): Likewise.
+ (ValueImp::dispatchToBoolean): Likewise.
+ (ValueImp::dispatchToNumber): Likewise.
+ (ValueImp::dispatchToString): Likewise.
+ (ValueImp::dispatchToObject): Likewise.
+ (ValueImp::dispatchToUInt32): Likewise.
+ (ValueImp::dispatchGetBase): Likewise.
+ (ValueImp::dispatchGetPropertyName): Likewise.
+ (ValueImp::dispatchPutValue): Likewise.
+ (ValueImp::dispatchDeleteValue): Likewise.
+ (Number::Number): Create a simple number instead of a full-blown
+ ValueImp when possible.
+ (Number::value): Likewise.
+ * kjs/value.h:
+
+2002-08-15 Maciej Stachowiak <mjs@apple.com>
+
+ Phase one of the "fixnum" optimization (storing small enough
+ integers in the pointer). This just paves the way for the change
+ by making all the virtual functions of ValueImp private and adding
+ non-virtual dispatchers which can call the virtual function or
+ handle fixnums specially.
+
+ Also, I marked every place that should need a special case with a
+ FIXNUM comment.
+
+ * kjs/bool_object.cpp:
+ (BooleanObjectImp::construct): Call dispatch method not the real method.
+ * kjs/internal.h: Make toUInt32 private to make sure no one calls it directly
+ on a NumberImp*.
+ * kjs/nodes.cpp:
+ (ForInNode::execute): Call dispatch method not the real method.
+ * kjs/object.cpp:
+ (ObjectImp::propList): Call dispatch method not the real method.
+ * kjs/object.h:
+ * kjs/string_object.cpp:
+ (StringProtoFuncImp::call): Call dispatch method not the real method.
+ (StringObjectImp::construct): Call dispatch method not the real method.
+ * kjs/value.h:
+ * kjs/value.cpp:
+ (ValueImp::marked): Put a comment about required FIXNUM change.
+ (ValueImp::setGcAllowed): Likewise.
+ (ValueImp::dispatchType): Just call the virtual method for now.
+ (ValueImp::dispatchToPrimitive): Likewise.
+ (ValueImp::dispatchToBoolean): Likewise.
+ (ValueImp::dispatchToNumber): Likewise.
+ (ValueImp::dispatchToString): Likewise.
+ (ValueImp::dispatchToObject): Likewise.
+ (ValueImp::dispatchToUInt32): Likewise.
+ (ValueImp::dispatchGetBase): Likewise.
+ (ValueImp::dispatchGetPropertyName): Likewise.
+ (ValueImp::dispatchGetValue): Likewise.
+ (ValueImp::dispatchPutValue): Likewise.
+ (ValueImp::dispatchDeleteValue): Likewise.
+
+2002-08-14 Darin Adler <darin@apple.com>
+
+ Another pass of tweaks, including one bug fix.
+
+ * kjs/array_object.cpp:
+ (ArrayInstanceImp::ArrayInstanceImp): Use malloc, not new.
+ (ArrayInstanceImp::get): Use a local variable so we don't rely on the optimizer
+ to avoid indexing twice.
+ (ArrayInstanceImp::hasProperty): Use a local variable, and also check against
+ UndefinedImp::staticUndefined rather than doing type() != UndefinedType.
+
+2002-08-14 Maciej Stachowiak <mjs@apple.com>
+
+ Simplified array handling by using NULL to represent empty cells
+ instead of the Undefined object, so we can use calloc, realloc and
+ memset instead of loops. Inspired by a suggestion of Darin's.
+
+ * kjs/array_object.cpp:
+ (ArrayInstanceImp::ArrayInstanceImp):
+ (ArrayInstanceImp::~ArrayInstanceImp):
+ (ArrayInstanceImp::get):
+ (ArrayInstanceImp::hasProperty):
+ (ArrayInstanceImp::deleteProperty):
+ (ArrayInstanceImp::setLength):
+ (ArrayInstanceImp::mark):
+
+2002-08-14 Maciej Stachowiak <mjs@apple.com>
+
+ Fix major JavaScript memory leak. run-plt says cvs-base improved
+ by 2% and cvs-js-performance improved by 7%. However, this was
+ within the possible noise level in each case.
+
+ The fix was to store ValueImp *'s in the array instead of Value
+ objects, since the Value wrapper will keep a ref and make the
+ object immortal.
+
+ * kjs/array_object.cpp:
+ (ArrayInstanceImp::ArrayInstanceImp):
+ (ArrayInstanceImp::get):
+ (ArrayInstanceImp::put):
+ (ArrayInstanceImp::hasProperty):
+ (ArrayInstanceImp::deleteProperty):
+ (ArrayInstanceImp::setLength):
+ (ArrayInstanceImp::mark):
+ * kjs/array_object.h:
+
+2002-08-13 Maciej Stachowiak <mjs@apple.com>
+
+ Add the ability to determine the classes of live JavaScript
+ objects, to help with leak fixing.
+
+ * kjs/collector.h, kjs/collector.cpp:
+ (Collector::liveObjectClasses):
+
+2002-08-13 Maciej Stachowiak <mjs@apple.com>
+
+ Small speed improvement. 3% faster on cvs-js-performance, no
+ measurable change on cvs-static-urls.
+
+ * kjs/collector.cpp:
+ (Collector::collect): Combine 3 loops over all objects into one,
+ to reduce flat time and improve locality of reference.
+
+2002-08-12 Darin Adler <darin@apple.com>
+
+ Speed improvements. 19% faster on cvs-js-performance, 1% on cvs-static-urls.
+
+ Use global string objects for length and other common property names rather
+ than constantly making and destroying them. Use integer versions of get() and
+ other related calls rather than always making a string.
+
+ Also get rid of many unneeded constructors, destructors, copy constructors, and
+ assignment operators. And make some functions non-virtual.
+
+ * kjs/internal.h:
+ * kjs/internal.cpp:
+ (NumberImp::toUInt32): Implement.
+ (ReferenceImp::ReferenceImp): Special case for numeric property names.
+ (ReferenceImp::getPropertyName): Moved guts here from ValueImp. Handle numeric case.
+ (ReferenceImp::getValue): Moved guts here from ValueImp. Handle numeric case.
+ (ReferenceImp::putValue): Moved guts here from ValueImp. Handle numeric case.
+ (ReferenceImp::deleteValue): Added. Handle numeric case.
+
+ * kjs/array_object.h:
+ * kjs/array_object.cpp: All-new array implementation that stores the elements
+ in a C++ array rather than in a property map.
+ (ArrayInstanceImp::ArrayInstanceImp): Allocate the C++ array.
+ (ArrayInstanceImp::~ArrayInstanceImp): Delete the C++ array.
+ (ArrayInstanceImp::get): Implement both the old version and the new overload that
+ takes an unsigned index for speed.
+ (ArrayInstanceImp::put): Implement both the old version and the new overload that
+ takes an unsigned index for speed.
+ (ArrayInstanceImp::hasProperty): Implement both the old version and the new overload that
+ takes an unsigned index for speed.
+ (ArrayInstanceImp::deleteProperty): Implement both the old version and the new overload that
+ takes an unsigned index for speed.
+ (ArrayInstanceImp::setLength): Added. Used by the above to resize the array.
+ (ArrayInstanceImp::mark): Mark the elements of the array too.
+ (ArrayPrototypeImp::ArrayPrototypeImp): Pass the length to the array instance constructor.
+
+ * kjs/bool_object.cpp:
+ * kjs/date_object.cpp:
+ * kjs/error_object.cpp:
+ * kjs/function.cpp:
+ * kjs/function_object.cpp:
+ * kjs/math_object.cpp:
+ * kjs/nodes.cpp:
+ * kjs/nodes.h:
+ * kjs/number_object.cpp:
+ * kjs/object_object.cpp:
+ * kjs/regexp_object.cpp:
+ * kjs/string_object.cpp:
+
+ * kjs/nodes2string.cpp: (SourceStream::operator<<): Add a special case for char now that
+ you can't create a UString from a char implicitly.
+
+ * kjs/object.h:
+ * kjs/object.cpp:
+ (ObjectImp::get): Call through to the string version if the numeric version is not implemented.
+ (ObjectImp::put): Call through to the string version if the numeric version is not implemented.
+ (ObjectImp::hasProperty): Call through to the string version if the numeric version is not implemented.
+ (ObjectImp::deleteProperty): Call through to the string version if the numeric version is not implemented.
+
+ * kjs/types.h:
+ * kjs/types.cpp:
+ (Reference::Reference): Added constructors for the numeric property name case.
+
+ * kjs/ustring.h: Made the constructor that turns a character into a string be explicit so we
+ don't get numbers that turn themselves into strings.
+ * kjs/ustring.cpp:
+ (UString::UString): Detect the empty string case, and use a shared empty string.
+ (UString::find): Add an overload for single character finds.
+ (UString::rfind): Add an overload for single character finds.
+ (KJS::operator==): Fix bug where it would call strlen(0) if the first string was not null.
+ Also handle non-ASCII characters consistently with the rest of the code by casting to unsigned char
+ just in case.
+
+ * kjs/value.h: Make ValueImp and all subclasses non-copyable and non-assignable.
+ * kjs/value.cpp:
+ (ValueImp::toUInt32): New interface, mainly useful so we can detect array indices and not turn
+ them into strings and back.
+ (ValueImp::toInteger): Use the new toUInt32. Probably can use more improvement.
+ (ValueImp::toInt32): Use the new toUInt32. Probably can use more improvement.
+ (ValueImp::toUInt16): Use the new toUInt32. Probably can use more improvement.
+ (ValueImp::getBase): Remove handling of the Reference case. That's in ReferenceImp now.
+ (ValueImp::getPropertyName): Remove handling of the Reference case. That's in ReferenceImp now.
+ (ValueImp::getValue): Remove handling of the Reference case. That's in ReferenceImp now.
+ (ValueImp::putValue): Remove handling of the Reference case. That's in ReferenceImp now.
+ (ValueImp::deleteValue): Added. Used so we can do delete the same way we do put.
+
+=== Alexander-17 ===
+
+2002-08-09 Darin Adler <darin@apple.com>
+
+ Some string speedups. Makes sony.com cached 11% faster on Development, but
+ the improvement for Deployment should be greater.
+
+ * kjs/ustring.h: Made it possible for UChar objects to be uninitialized, which
+ gives a speed boost. Inlined CString's +=, UString's destructor, +=, and +.
+ * kjs/ustring.cpp:
+ (UString::UString): Optimize const char * version, which showed up
+ heavily in performance analysis. Added new two-UString version, which
+ makes the + operator fast.
+ (UString::ascii): Remove thread safety changes. Change static buffer to remember
+ its size, and to always be at least 4096 bytes long; that way we never have to
+ reallocate unless it's for a long string. Also make code to extract the characters
+ significantly faster by getting rid of two pointer dereferences per character.
+ (UString::is8Bit): Avoid one pointer dereference per character.
+ (UString::toDouble): Use ascii() instead of cstring() to avoid copying the string.
+
+ * kjs/collector.cpp: Remove unneeded APPLE_CHANGES.
+ * kjs/regexp.cpp: Remove ifdefs around some APPLE_CHANGES that we
+ want to keep, because they just fix warnings.
+ * kjs/value.h: Remove obsolete APPLE_CHANGES comment.
+
+ * JavaScriptCore.pbproj/project.pbxproj: Project Builder decided
+ to move a line around in the file.
+
+2002-08-09 Maciej Stachowiak <mjs@apple.com>
+
+ Fix my last change to actually call the versions of the lock functions
+ that are recursive and initialize as needed.
+
+ * kjs/internal.cpp:
+ (InterpreterImp::InterpreterImp):
+ (InterpreterImp::clear):
+ (InterpreterImp::evaluate):
+
+2002-08-09 Maciej Stachowiak <mjs@apple.com>
+
+ - fixed 2948835 - JavaScriptCore locking is too fine grained, makes it too slow
+
+ * kjs/collector.cpp:
+ (Collector::allocate):
+ (Collector::collect):
+ (Collector::finalCheck):
+ (Collector::numInterpreters):
+ (Collector::numGCNotAllowedObjects):
+ (Collector::numReferencedObjects):
+ * kjs/collector.h:
+ * kjs/internal.cpp:
+ (initializeInterpreterLock):
+ (lockInterpreter):
+ (unlockInterpreter):
+ (Parser::parse):
+ (InterpreterImp::InterpreterImp):
+ (InterpreterImp::clear):
+ (InterpreterImp::evaluate):
+ * kjs/value.cpp:
+ (ValueImp::ValueImp):
+ (ValueImp::setGcAllowed):
+
+=== milestone 0.5 ===
+
+=== Alexander-16 ===
+
+2002-08-05 Maciej Stachowiak <mjs@apple.com>
+
+ - fixed 3007072 - need to be able to build fat
+
+ * JavaScriptCore.pbproj/project.pbxproj: Fixed DeploymentFat build.
+
+=== Alexander-15 ===
+
+2002-07-25 Darin Adler <darin@apple.com>
+
+ * JavaScriptCore.pbproj/project.pbxproj: Add DeploymentFat build style.
+
+=== Alexander-14 ===
+
+2002-07-21 Darin Adler <darin@apple.com>
+
+ * kjs/*: Roll KDE 3.0.2 changes in. Also switch to not using APPLE_CHANGES
+ for some of the changes that we definitely want to contribute upstream.
+
+2002-07-21 Maciej Stachowiak <mjs@apple.com>
+
+ * Makefile.am: Remove products from symroots on `make clean'.
+
+=== Alexander-13 ===
+
+2002-07-13 Darin Adler <darin@apple.com>
+
+ * Makefile.am: Don't use embed.am any more.
+ * JavaScriptCore.pbproj/project.pbxproj: Use embed-into-alex instead
+ of make embed.
+
+2002-07-12 Darin Adler <darin@apple.com>
+
+ * kjs/ustring.h: Since <sys/types.h> includes ushort and uint now, had
+ to change the includes here to be compatible with that.
+
+2002-07-11 Darin Adler <darin@apple.com>
+
+ * JavaScriptCore.pbproj/project.pbxproj: To make the build of
+ WebCore work without using -I to peek at JavaScriptCore sources,
+ made all the Public sources Private so they are all in one directory.
+ Also, made lookup.h be Private.
+
+=== Alexander-11 ===
+
+=== Alexander-10 ===
+
+2002-06-25 Darin Adler <darin@apple.com>
+
+ * JavaScriptCore.pbproj/project.pbxproj: Re-add -Wmissing-format-attribute.
+
+=== Alexander-9 ===
+
+2002-06-19 Kenneth Kocienda <kocienda@apple.com>
+
+ I just played alchemical voodoo games with the linker to
+ make all our frameworks and Alexander prebound.
+
+ * JavaScriptCore.pbproj/project.pbxproj
+
+2002-06-15 Darin Adler <darin@apple.com>
+
+ * JavaScriptCore.pbproj/project.pbxproj: Removed explicit PFE_FILE_C_DIALECTS now that
+ Project Builder handles this automatically. Removed explicit USE_GCC3 since that's implicit
+ now. Also, since this project is all C++, only use WARNING_CFLAGS with flags that are appropriate
+ for C++; don't bother breaking out C vs. C++.
+
+ * kjs/collector.cpp: Now that the system warning is fixed, use PTHREAD_MUTEX_INITIALIZER and
+ PTHREAD_COND_INITIALIZER.
+ * kjs/internal.cpp: Use PTHREAD_MUTEX_INITIALIZER.
+ * kjs/ustring.cpp: Use PTHREAD_ONCE_INIT.
+
+2002-06-15 Maciej Stachowiak <mjs@apple.com>
+
+ Made Development build mode mean what Unoptimized used to mean. Removed Unoptimized build mode.
+ Added a Mixed build mode which does what Deployment used to. All this to fix:
+
+ Radar 2955367 - Change default build style to "Unoptimized"
+
+ * JavaScriptCore.pbproj/project.pbxproj:
+
+2002-06-12 Darin Adler <darin@apple.com>
+
+ * kjs/nodes.cpp: (Node::finalCheck): A bit of APPLE_CHANGES so we
+ can compile with KJS_DEBUG_MEM defined if we want to.
+
+2002-06-10 Darin Adler <darin@apple.com>
+
+ Merged in changes from KDE 3.0.1.
+
+ * kjs/collector.cpp:
+ * kjs/date_object.cpp:
+ * kjs/function.cpp:
+ * kjs/internal.cpp:
+ * kjs/lookup.h:
+ * kjs/object.cpp:
+ * kjs/operations.cpp:
+ * kjs/regexp.cpp:
+ * kjs/regexp_object.cpp:
+ * kjs/regexp_object.h:
+ * kjs/string_object.cpp:
+ * kjs/testkjs.cpp:
+ * kjs/ustring.cpp:
+ * kjs/value.cpp:
+ * kjs/value.h:
+ Do the merge, and add APPLE_CHANGES as needed to make things compile.
+
+ * kjs/date_object.lut.h: Re-generated.
+
+2002-06-07 Darin Adler <darin@apple.com>
+
+ * Makefile.am: Use new shared "embed.am" file so we don't need four copies of
+ the embedding rules for WebFoundation, JavaScriptCore, WebCore, and WebKit.
+
+2002-06-07 Darin Adler <darin@apple.com>
+
+ * JavaScriptCore.pbproj/project.pbxproj: Don't use any warning flags for C that won't work
+ for C++, because PFE uses the C warning flags on a C++ compile.
+
+=== Alexander-8 ===
+
+2002-06-06 Darin Adler <darin@apple.com>
+
+ * JavaScriptCore.pbproj/project.pbxproj: Update warning flags for compatibility
+ with new C++.
+
+2002-06-05 Darin Adler <darin@apple.com>
+
+ Fix problem seen as build failure on Jersey.
+
+ * Makefile.am: JavaScriptCore-stamp needs to be a dependency, not a
+ source file, because it doesn't have a corresponding object file.
+ Making it a dependency causes things to compile in the right order.
+
+2002-06-04 Darin Adler <darin@apple.com>
+
+ Improve the speed of the JavaScript string append operation by growing
+ the capacity so we don't need to reallocate the string every time.
+
+ Also fix script execution so it doesn't use recursion to advance from
+ one statement to the next, using iteration instead.
+
+ * Makefile.am: Stop using BUILT_SOURCES to build JavaScriptCore-stamp,
+ because this causes the Project Builder project to build *before* the
+ subdir. Intead, use an all-am rule in a way more similar to all our
+ other directories.
+
+ * kjs/grammar.y: Link the SourceElementsNode in the opposite direction,
+ so we can walk the list and execute each element instead of using
+ recursion to reverse the list.
+ * kjs/grammar.cpp: Check in new generated file.
+
+ * kjs/nodes.cpp:
+ (SourceElementsNode::execute):
+ (SourceElementsNode::processFuncDecl):
+ (SourceElementsNode::processVarDecls):
+ Use loops instead of recursion.
+
+ * kjs/ustring.h: Don't initialize all UChar objects to 0. This was
+ wasting a *huge* amount of time.
+ * kjs/ustring.cpp:
+ (UString::Rep::create): Add a "capacity" along with the length.
+ (UString::append): Include 50% extra capacity when appending.
+ (UString::operator=): Reuse the buffer if possible rather than
+ always creating a new one.
+
+2002-06-02 Darin Adler <darin@apple.com>
+
+ * COPYING.LIB: Fix line endings. It was using CRs.
+
+2002-05-31 Darin Adler <darin@apple.com>
+
+ * Makefile.am:
+ * kjs/Makefile.am:
+ Slight improvements to rules that touch stamp files.
+
+2002-05-28 Maciej Stachowiak <mjs@apple.com>
+
+ * THANKS: Demangled.
+
+=== Alexander-7 ===
+
+2002-05-24 Maciej Stachowiak <mjs@apple.com>
+
+ Added license and acknowledgements.
+
+ * AUTHORS: Added.
+ * COPYING.LIB: Added.
+ * THANKS: Added.
+
+=== 0.3 ===
+
+=== Alexander-6 ===
+
+=== Alexander-5 ===
+
+=== Alexander-4 ===
+
+=== JavaScriptCore-5 ===
+
+2002-05-21 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by: Richard Williamson
+
+ Fixed Radar 2928775 - Sherlock crashes sitting in stocks channel
+
+ * kjs/internal.cpp:
+ (InterpreterImp::InterpreterImp): Set the interp pointer earlier,
+ in case garbage collection takes place while creating the global
+ values.
+
+2002-05-15 Darin Adler <darin@apple.com>
+
+ Reviewed by: Maciej Stachowiak
+
+ * Makefile.am:
+ Use all-am and clean-am instead of all and clean because it's better and
+ to make "make check" at the top level work right.
+
+2002-05-13 Darin Adler <darin@apple.com>
+
+ Reviewed by: Maciej Stachowiak
+
+ * kjs/value.h: Fix comment typos.
+
+=== JavaScriptCore-4 ===
+
+2002-05-10 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by: Ken Kocienda and Darin Adler
+
+ Fixed the following bug:
+
+ Radar 2890573 - JavaScriptCore needs to be thread-safe
+
+ Actually this is only a weak form of thread-safety - you can safely
+ use different interpreters from different threads at the same
+ time. If you try to use a single interpreter object from multiple
+ threads, you need to provide your own locking.
+
+ * kjs/collector.h, kjs/collector.cpp:
+ (Collector::lock, Collector::unlock): Trivial implementation of a
+ recursive mutex.
+ (Collector::allocate): Lock around the body of this function.
+ (Collector::collect): Likewise.
+ (Collector::finalCheck): Likewise.
+ (Collector::numInterpreters): Likewise.
+ (Collector::numGCNotAllowedObjects): Likewise.
+ (Collector::numReferencedObjects): Likewise.
+ * kjs/internal.cpp:
+ (Parser::parse): use a mutex to lock around the whole parse, since
+ it uses a bunch of global state.
+ (InterpreterImp::InterpreterImp): Grab the Collector lock here,
+ both the mutually exclude calls to the body of this function, and
+ to protect the s_hook static member which the collector pokes at.
+ (InterpreterImp::clear): Likewise.
+ * kjs/ustring.cpp:
+ (statBufferKeyCleanup, statBufferKeyInit, UString::ascii): Convert
+ use of static variable
+ * kjs/value.cpp:
+ (ValueImp::ValueImp, ValueImp::mark, ValueImp::marked,
+ ValueImp::setGcAllowed): Grab the GC lock around any flag changes.
+
+=== Alexander-3 ===
+
+2002-05-08 Darin Adler <darin@apple.com>
+
+ * kjs/collector.h:
+ * kjs/collector.cpp:
+ (Collector::numInterpreters):
+ (Collector::numGCNotAllowedObjects):
+ (Collector::numReferencedObjects):
+ Add three new functions so we can see a bit more about leaking JavaScriptCore.
+
+2002-05-06 Darin Adler <darin@apple.com>
+
+ * JavaScriptCorePrefix.h: Added.
+ * JavaScriptCore.pbproj/project.pbxproj: Use PFE precompiling.
+ Also switch from xNDEBUG to NDEBUG.
+
+=== Alexander 0.3c2 (v1) ===
+
+2002-04-18 Darin Adler <darin@apple.com>
+
+ * JavaScriptCore.pbproj/project.pbxproj: Oops. Take out -Wstrict-prototypes, put back
+ -Wmissing-prototypes.
+
+2002-04-18 Darin Adler <darin@apple.com>
+
+ * JavaScriptCore.pbproj/project.pbxproj: Take out -Wmissing-prototypes
+ because system headers are triggering it when we don't have
+ precompiled headers on.
+
+2002-04-18 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej
+
+ * JavaScriptCore.pbproj/project.pbxproj: Turn on gcc3 and the same set of warnings
+ as in the rest of Labyrinth (see top level ChangeLog for details).
+
+2002-04-17 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by: Darin Adler <darin@apple.com>
+
+ * kjs/testkjs.cpp: Don't include <iostream.h> to avoid gcc3
+ warning.
+
+2002-04-15 Darin Adler <darin@apple.com>
+
+ Reviwed by: Maciej Stachowiak <mjs@apple.com>
+
+ * kjs/internal.cpp:
+ * kjs/property_map.cpp:
+ * kjs/ustring.h:
+ Removed some unneeded <config.h> includes so we are more similar
+ to the real KDE sources.
+
+2002-04-15 Darin Adler <darin@apple.com>
+
+ Reviwed by: Maciej Stachowiak <mjs@apple.com>
+
+ Merged changes from KDE 3.0 final and did some build fixes.
+
+ * JavaScriptCore.pbproj/project.pbxproj: Added nodes2string.cpp.
+
+ * kjs/grammar.*: Regenerated.
+ * kjs/*.lut.h: Regenerated.
+
+2002-04-08 Darin Adler <darin@apple.com>
+
+ Reviwed by: Maciej Stachowiak <mjs@apple.com>
+
+ * JavaScriptCore.pbproj/project.pbxproj: Re-added -Wno-format-y2k.
+
+2002-04-04 Darin Adler <darin@apple.com>
+
+ * JavaScriptCore.pbproj/project.pbxproj: Add an Unoptimized build
+ style: exactly like Development except without the -O.
+
+2002-04-03 Darin Adler <darin@apple.com>
+
+ * kjs/Makefile.am: Gratuitous cleanup.
+
+2002-04-02 Darin Adler <darin@apple.com>
+
+ * JavaScriptCore.pbproj/project.pbxproj: Update flags as I did for
+ WebFoundation.
+
+2002-04-02 Maciej Stachowiak <mjs@apple.com>
+
+ * JavaScriptCore.pbproj/project.pbxproj: Pass -Wno-format-y2k so
+ the project builds with gcc3.
+
+ * kjs/nodes.cpp: Avoid including an obsolete header to avoid
+ warning with gcc3.
+
+2002-04-02 Darin Adler <darin@apple.com>
+
+ * kjs/property_map.cpp: (PropertyMap::~PropertyMap): Deallocate the
+ map by calling clear so we don't leak the entire map.
+
+2002-04-02 Darin Adler <darin@apple.com>
+
+ * kjs/internal.cpp: (InterpreterImp::globalClear): Add code to
+ deallocate and null out emptyList, because once the last interpreter
+ is destroyed there's nothing to keep it from being garbage collected.
+
+2002-04-01 Darin Adler <darin@apple.com>
+
+ Got rid of KWQDef.h because it's dangerous to have two files with
+ the same name and different contents.
+
+ * JavaScriptCore.pbproj/project.pbxproj:
+ * kjs/KWQDef.h: Removed.
+ * kjs/ustring.h: Defines unsigned int types inline now.
+
+2002-03-30 Maciej Stachowiak <mjs@apple.com>
+
+ Fixed Radar 2891272 (JavaScript crashes loading quicktime.com and
+ apple.com)
+
+ * kjs/object.cpp: (ObjectImp::~ObjectImp): Don't call setGCAlloc
+ on object internals pointed to, because they may have already been
+ collected by the time this object is collected, and in that case
+ we would corrupt the malloc arena.
+
+ * Makefile.am: Make the stamp file depend on all the sources and
+ headers so the framework gets rebuilt properly.
+
+ * JavaScriptCore.pbproj/project.pbxproj: Some random numbers moved
+ around. No idea what I really changed.
+
+2002-03-30 Darin Adler <darin@apple.com>
+
+ * kjs/grammar.y: Took out Id tag so we won't constantly need to
+ update grammar.cpp.
+ * kjs/grammar.cpp: Regenerated without Id tag.
+
+ * .cvsignore: Ignore some additional autogenerated files.
+ * kjs/.cvsignore: Ignore some additional autogenerated files.
+
+2002-03-30 Maciej Stachowiak <mjs@apple.com>
+
+ * JavaScriptCore.pbproj/project.pbxproj: Install some of the
+ headers.
+
+2002-03-30 Maciej Stachowiak <mjs@apple.com>
+
+ Converted JavaScriptCore to build with Project Builder, in
+ preparation for B&I submission.
+
+ * English.lproj/InfoPlist.strings: Added.
+ * JavaScriptCore.pbproj/.cvsignore: Added.
+ * JavaScriptCore.pbproj/project.pbxproj: Added.
+
+ * .cvsignore: Update the set of ignored things.
+
+ * Makefile.am: Hand off to PB for the main build, but still handle
+ the generated files and the test program.
+
+ * kjs/Makefile.am: Don't build anything except the generated
+ source files.
+
+ * kjs/KWQDef.h, kjs/config.h: Added minimal versions of these
+ files to get kjs to build.
+
+ Check in all the genrated files, since Project Builder isn't up to
+ the task of handling built sources:
+
+ * kjs/array_object.lut.h: Added.
+ * kjs/date_object.lut.h: Added.
+ * kjs/grammar.cpp: Added.
+ * kjs/grammar.cpp.h: Added.
+ * kjs/grammar.h: Added.
+ * kjs/lexer.lut.h: Added.
+ * kjs/math_object.lut.h: Added.
+ * kjs/number_object.lut.h: Added.
+ * kjs/string_object.lut.h: Added.
+
+ * kjs/.cvsignore: Update set of ignored things.
+
+2002-03-28 Maciej Stachowiak <mjs@apple.com>
+
+ * kjs/kjs-test.chk: Update output for new test results.
+
+2002-03-26 Maciej Stachowiak <mjs@apple.com>
+
+ Set up kjs to build by itself into libJavaScriptCore.dylib.
+
+ * .cvsignore: Added.
+ * Makefile.am: Added.
+ * dummy.cpp: Added.
+ * kjs/.cvsignore: Added.
diff --git a/Source/JavaScriptCore/ChangeLog-2003-10-25 b/Source/JavaScriptCore/ChangeLog-2003-10-25
new file mode 100644
index 0000000..7127d32
--- /dev/null
+++ b/Source/JavaScriptCore/ChangeLog-2003-10-25
@@ -0,0 +1,1483 @@
+=== Safari-111 ===
+
+2003-10-22 Maciej Stachowiak <mjs@apple.com>
+
+ Fix broken build.
+
+ * kjs/simple_number.h:
+
+2003-10-22 Maciej Stachowiak <mjs@apple.com>
+
+ Merged 64-bit compilation fixes, and fixes for handling negative 0
+ from upstream kjs.
+
+ * kjs/internal.cpp:
+ * kjs/simple_number.h:
+ (KJS::SimpleNumber): fixed constants; added negZero constant.
+ (KJS::SimpleNumber::is): adjusted to use long and not int.
+ (KJS::SimpleNumber::value): ditto.
+ (KJS::SimpleNumber::fits): ditto; also don't allow -0 to fit, so
+ we don't lose the distinction between -0 and +0.
+ (KJS::SimpleNumber::make): adjusted to use long.
+
+2003-10-18 Darin Adler <darin@apple.com>
+
+ Reviewed by Dave.
+
+ - fixed 3367015 -- interdependent variable declarations in for loop don't work (they go backwards)
+
+ * kjs/nodes.h: (KJS::ForNode::ForNode): Add a new overload of the constructor for when the
+ first parameter is a variable declaration list. Call reverseList as we do in other constructors
+ that take lists that are built backwards.
+ * kjs/nodes.cpp: (ForNode::reverseList): Added. New helper function.
+
+=== Safari-110 ===
+
+=== Safari-109 ===
+
+2003-10-06 Darin Adler <darin@apple.com>
+
+ * kjs/create_hash_table: Remove stray semicolon.
+
+ * kjs/array_object.lut.h:
+ * kjs/date_object.lut.h:
+ * kjs/lexer.lut.h:
+ * kjs/math_object.lut.h:
+ * kjs/number_object.lut.h:
+ * kjs/string_object.lut.h:
+ Regenerated.
+
+=== Safari-108 ===
+
+2003-10-02 Darin Adler <darin@apple.com>
+
+ Reviewed by Dave.
+
+ - fixed 3441656 -- constructor bad for objs created w/ function as prototype (www.moock.org/asdg/codedepot)
+
+ * kjs/nodes.cpp: (FuncDeclNode::processFuncDecl): Set up the constructor as
+ as specified in the JavaScript spec. We were already doing this right in the
+ other place we make functions.
+
+2003-09-30 Darin Adler <darin@apple.com>
+
+ Reviewed by Dave.
+
+ Rolled in Harri Porten's change to accept non-breaking space in JavaScript.
+
+ * kjs/lexer.cpp: (Lexer::isWhiteSpace): Accept 00A0 as "whitespace".
+
+2003-09-25 Maciej Stachowiak <mjs@apple.com>
+
+ Roll out build system change since it did not actually work. :-(
+
+ * JavaScriptCore.pbproj/project.pbxproj:
+ * Makefile.am:
+
+2003-09-25 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin.
+
+ * JavaScriptCore.pbproj/project.pbxproj: Don't hack install name. Instead
+ of embedding into Safari, embed into WebKit as sub-umbrella.
+ * Makefile.am: Don't forget to rebuild if the user removes
+ JavaScript.framework from symroots manually.
+
+=== Safari-107 ===
+
+2003-09-24 Darin Adler <darin@apple.com>
+
+ Reviewed by Ken.
+
+ - fixed 3421107 -- some dates that other browsers can parse can't be parsed by KJS's Date.parse()
+
+ * kjs/date_object.cpp: (KJS::KRFCDate_parseDate): Added code to be more strict about month names,
+ to allow a time zone after date even if the date omits the time, and to understand AM and PM.
+
+2003-09-22 Darin Adler <darin@apple.com>
+
+ * JavaScriptCore.pbproj/project.pbxproj: Rename Mixed build style to OptimizedWithSymbols.
+
+2003-09-22 Darin Adler <darin@apple.com>
+
+ Reviewed by Ken.
+
+ * kjs/config.h: Added HAVE_SYS_PARAM_H, since KJS does look for this header, and we do
+ indeed have it. Just something I noticed in passing while cleaning up configure.in.
+
+2003-09-20 Darin Adler <darin@apple.com>
+
+ Reviewed by Dave.
+
+ - fixed 3419380 -- JavaScript Date.getTimezoneOffset is off by one hour (during daylight savings)
+
+ * kjs/date_object.cpp: (DateProtoFuncImp::call): The daylight savings correction
+ in here was incorrect. Perhaps I should have corrected it for the non-BSD case too,
+ but I'm not sure the issue is the same.
+
+2003-09-17 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ * kjs/date_object.cpp: Removed our CF-based implementations of gmtime, localtime,
+ mktime, timegm, and time, since they no longer have the slow "hit the filesystem
+ every time" behavior.
+
+=== Safari-100 ===
+
+=== Safari-99 ===
+
+=== Safari-98 ===
+
+=== Safari-97 ===
+
+=== Safari-96 ===
+
+2003-08-27 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by John
+
+ - fixed rdar://problem/3397316 - sherlock crash: KJS::Collector::allocate(unsigned long)
+
+ * kjs/internal.cpp:
+ (InterpreterImp::InterpreterImp): Hold the lock a bit longer, so
+ the call to initGlobalObject is covered.
+
+=== Safari-95 ===
+
+2003-08-24 Darin Adler <darin@apple.com>
+
+ Reviewed by John.
+
+ - fixed 3098350 -- opt. params to date methods are ignored (can't set end date in Exchange/Outlook web cal.)
+
+ * kjs/date_object.cpp: (DateProtoFuncImp::call): Added code to handle the optional parameters.
+ Strangely, the table of functions already had the right number of parameters listed, but the
+ code to look at the parameter values was missing.
+
+=== Safari-94 ===
+
+2003-08-17 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - fixed 3247528 -- encodeURI missing from JavaScriptCore (needed by Crystal Reports)
+ - fixed 3381297 -- escape method does not escape the null character
+ - fixed 3381299 -- escape method produces incorrect escape sequences ala WinIE, rather than correct ala Gecko
+ - fixed 3381303 -- unescape method treats escape sequences as Latin-1 ala WinIE rather than as UTF-8 ala Gecko
+ - fixed 3381304 -- unescape method garbles strings with bad escape sequences in them
+
+ * kjs/function.h: Added constants for decodeURI, decodeURIComponent, encodeURI, and
+ encodeURIComponent.
+ * kjs/function.cpp:
+ (encode): Added. New helper function for escape, encodeURI, and encodeURIComponent.
+ (decode): Added. New helper function for unescape, decodeURI, and decodeURIComponent.
+ (GlobalFuncImp::call): Added decodeURI, decodeURIComponent, encodeURI, and encodeURIComponent
+ implementations. Changed escape and unescape to use new helper functions, which fixes
+ the four problems above.
+
+ * kjs/internal.cpp: (InterpreterImp::initGlobalObject): Add decodeURI, decodeURIComponent,
+ encodeURI, and encodeURIComponent to the global object.
+
+ * kjs/ustring.h: Added a length to the CString class so it can hold strings with null
+ characters in them, not just null-terminated strings. This allows a null character from
+ a UString to survive the process of UTF-16 to UTF-8 decoding. Added overloads to
+ UString::append, UString::UTF8String, UTF8SequenceLength, decodeUTF8Sequence,
+ convertUTF16OffsetsToUTF8Offsets, and convertUTF8OffsetsToUTF16Offsets.
+
+ * kjs/ustring.cpp:
+ (CString::CString): Set up the length properly in all the constructors. Also add a new
+ constructor that takes a length.
+ (CString::append): Use and set the length properly.
+ (CString::operator=): Use and set the length properly.
+ (operator==): Use and the length and memcmp instead of strcmp.
+ (UString::append): Added new overloads for const char * and for a single string to make
+ it more efficient to build up a UString from pieces. The old way, a UString was created
+ and destroyed each time you appended.
+ (UTF8SequenceLength): New. Helper for decoding UTF-8.
+ (decodeUTF8Sequence): New. Helper for decoding UTF-8.
+ (UString::UTF8String): New. Decodes from UTF-16 to UTF-8. Same as the function that
+ was in regexp.cpp, except has proper handling for UTF-16 surrogates.
+ (compareStringOffsets): Moved from regexp.cpp.
+ (createSortedOffsetsArray): Moved from regexp.cpp.
+ (convertUTF16OffsetsToUTF8Offsets): New. Converts UTF-16 offsets to UTF-8 offsets, given
+ a UTF-8 string. Same as the function that was in regexp.cpp, except has proper handling
+ for UTF-16 surrogates.
+ (convertUTF8OffsetsToUTF16Offsets): New. Converts UTF-8 offsets to UTF-16 offsets, given
+ a UTF-8 string. Same as the function that was in regexp.cpp, except has proper handling
+ for UTF-16 surrogates.
+
+ - fixed 3381296 -- regular expression matches with UTF-16 surrogates will treat sequences as two characters
+
+ * kjs/regexp.cpp:
+ (RegExp::RegExp): Use the new UString::UTF8String function instead a function in this file.
+ (RegExp::match): Use the new convertUTF16OffsetsToUTF8Offsets (and the corresponding
+ reverse) instead of convertCharacterOffsetsToUTF8ByteOffsets in this file.
+
+=== Safari-93 ===
+
+2003-08-14 Vicki Murley <vicki@apple.com>
+
+ Reviewed by John.
+
+ * JavaScriptCore.pbproj/project.pbxproj: deleted JavaScriptCore.order from the project.
+
+2003-08-14 Vicki Murley <vicki@apple.com>
+
+ Reviewed by John.
+
+ * JavaScriptCore.order: Removed. We now link to the order file at /AppleInternal/OrderFiles.
+ * JavaScriptCore.pbproj/project.pbxproj: change sectorder flag to point to /AppleInternal/OrderFiles/JavaScriptCore.order
+
+=== JavaScriptCore-92.1 ===
+
+2003-08-07 Darin Adler <darin@apple.com>
+
+ Reviewed by John Sullivan.
+
+ - fixed 3365527 -- subscripting JavaScript strings does not work (leads to hang at www.newmagna.com.au)
+
+ The JavaScript specification says nothing about this, but other browsers seem to give
+ read-only access to the characters in a string as if the string was an array of characters.
+
+ * kjs/array_object.cpp:
+ (ArrayInstanceImp::get): Update to use a public toArrayIndex function instead of our own getArrayIndex
+ function, so we can share with string.
+ (ArrayInstanceImp::put): Ditto.
+ (ArrayInstanceImp::hasProperty): Ditto.
+ (ArrayInstanceImp::setLength): Ditto.
+
+ * kjs/ustring.h: Add toArrayIndex.
+ * kjs/ustring.cpp: (UString::toArrayIndex): Added. Implements the rule from array.
+ * kjs/identifier.h: Add a forwarding function so we can use toArrayIndex.
+
+ * kjs/string_object.cpp:
+ (StringInstanceImp::get): Return a single character string if the property name is an array index.
+ (StringInstanceImp::hasProperty): Return true for property names that are suitable array indices.
+
+ * JavaScriptCore.pbproj/project.pbxproj: Let Xcode be Xcode.
+
+=== Safari-92 ===
+
+2003-08-07 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin.
+
+ - fixed 3366975 - repro hang in KJS::Value::Value entering text at eil.com
+
+ * kjs/string_object.cpp:
+ (StringProtoFuncImp::call): When doing a match against a regexp
+ with the global flag set, make sure to return null rather than an
+ empty array when there is no match. This is what other browsers do.
+
+2003-08-05 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by John.
+
+ * kjs/list.cpp:
+ (List::copyTail): Test for loop termination with < instead of !=,
+ since i starts at 1 but size could be 0. Do the same for the other
+ loop for consistency's sake.
+
+2003-08-01 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by John.
+
+ - fixed 3222621 - Cryptic "anonymous function hack" messages in console (10.2.4)
+
+ * kjs/lexer.cpp:
+ (Lexer::lex): Remove useless debug spew.
+
+=== Safari-91 ===
+
+2003-07-30 Darin Adler <darin@apple.com>
+
+ Reviewed by Dave.
+
+ - fixed problem where some JavaScriptCore symbols had no namespace or prefix
+
+ * kjs/grammar.y: Added a define for yylloc to make it use the kjs prefix.
+ This is the same thing done for the rest of the symbols automatically by yacc,
+ but for some reason it's not done for yyloc. Also make automatic() function static.
+ * kjs/grammar.cpp: Regenerated.
+ * kjs/lexer.cpp: Use kjsyylloc instead of yyloc.
+
+ * pcre/pcre.h: Add defines to prepend kjs prefixes for all the PCRE functions.
+
+2003-07-30 Darin Adler <darin@apple.com>
+
+ * Makefile.am: Include the subdirectory with the PCRE code in it.
+
+2003-07-30 John Sullivan <sullivan@apple.com>
+
+ - JavaScriptCore part of fix for 3284525 -- AutoFill fills in
+ only e-mail address field of New Account form on Apple Store Japan
+
+ Reviewed by Darin
+
+ * JavaScriptCore.pbproj/project.pbxproj:
+ Mark pcre.h as a Private header
+
+2003-07-28 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Richard.
+
+ - fixed 3240814 - LEAK: 120 byte leak in JavaScript parser in Sherlock Movies channel
+
+ * kjs/internal.cpp:
+ (Parser::parse): ref() and deref() the program node, to make sure to clean up properly,
+ before deleting it.
+ (InterpreterImp::checkSyntax): Likewise.
+
+=== Safari-90 ===
+
+2003-07-22 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by John.
+
+ Remove -seg_addr_table_filename to fix build.
+
+ * JavaScriptCore.pbproj/project.pbxproj:
+
+2003-07-17 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by John.
+
+ - fixed 3330344 - Please change allowable client to "JavaScriptGlue" from "JSGlue"
+
+ * JavaScriptCore.pbproj/project.pbxproj: Changed allowable client
+ to "JavaScriptGlue"
+
+2003-07-13 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - do some improvements Maciej suggested while reviewing the array index change
+
+ * kjs/array_object.cpp:
+ (getArrayIndex): Return a flag to say whether the index was value separately, to avoid
+ in-band signalling.
+ (ArrayInstanceImp::get): Update for new getArrayIndex parameters.
+ (ArrayInstanceImp::put): Ditto.
+ (ArrayInstanceImp::hasProperty): Ditto.
+ (ArrayInstanceImp::setLength): Ditto.
+
+ * kjs/ustring.cpp: (UString::toStrictUInt32): Check for overflow in a way that avoids doing
+ a divide every time through the loop. But note that it adds an extra branch to the loop.
+ I wonder which is worse.
+
+2003-07-12 Darin Adler <darin@apple.com>
+
+ Fixed broken build.
+
+ * kjs/identifier.h: Add toULong back. It's still used in WebCore (and maybe in JavaScriptGlue,
+ for all I know).
+
+2003-07-12 Darin Adler <darin@apple.com>
+
+ Reviewed by Dave.
+
+ - fixed 3272777 -- array object indices treated as integers by Safari, but as strings in other web browsers
+
+ JavaScriptCore did not implement the proper rule for what an array index is.
+
+ * kjs/array_object.cpp:
+ (getArrayIndex): Added. Implements the rule from the specification, which also provides a handy
+ "not an array index" value of 2^32-1.
+ (ArrayInstanceImp::get): Use getArrayIndex.
+ (ArrayInstanceImp::put): Ditto.
+ (ArrayInstanceImp::hasProperty): Ditto.
+ (ArrayInstanceImp::setLength): Ditto.
+
+ * kjs/identifier.h: Removed now-unused toULong, and added toStrictUInt32, in both cases forwarding
+ functions that forward to UString.
+
+ * kjs/ustring.h: Added toStringUInt32.
+ * kjs/ustring.cpp: (UString::toStrictUInt32): Added. Converts a string to a 32-bit unsigned integer,
+ and rejects any string that does not exactly match the way the integer would be formatted on output.
+ This is the rule documented in the ECMA language standard.
+
+=== Safari-89 ===
+
+2003-07-10 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin.
+
+ - fixed 3302021 - v74 and v85 hang with http://e-www.motorola.com/
+
+ The crux of this was saving and restoring the prototype objects
+ for all the standard types when saving and restoring for the page
+ cache.
+
+ * kjs/internal.cpp:
+ (InterpreterImp::saveBuiltins):
+ (InterpreterImp::restoreBuiltins):
+ * kjs/internal.h:
+ * kjs/interpreter.cpp:
+ (Interpreter::saveBuiltins):
+ (Interpreter::restoreBuiltins):
+ (SavedBuiltins::SavedBuiltins):
+ (SavedBuiltins::~SavedBuiltins):
+ * kjs/interpreter.h:
+ * kjs/property_map.cpp:
+
+2003-07-07 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by John.
+
+ - fixed 3295916 - b/c JavaScriptCore and WebCore are installing in wrong location, private headers are public
+
+ * WebCore.pbproj/project.pbxproj: Install in WebKit.framework/Versions/A/Frameworks.
+
+=== Safari-88 ===
+
+2003-07-02 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Ken.
+
+ - fixed 3096961 - JavaScriptCore should link only to what it uses, shouldn't drag in Cocoa.framework
+
+ * JavaScriptCore.pbproj/project.pbxproj: Don't link Cocoa.framework;
+ just pull in CoreFoundation and CoreServices.
+ * kjs/date_object.cpp: Include CoreServices.h instead of Carbon.h
+ (the stuff we want is in CarbonCore).
+
+2003-06-20 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - improved the property map sorting technique so that the indices
+ are separate for each property map, and also preserve the ordering
+ when property maps are saved and restored
+
+ * kjs/property_map.cpp:
+ (PropertyMap::put): Don't bother setting the index for _singleEntry, since there's
+ no need to sort a single entry. Use the per-table lastIndexUsed instead of a global.
+ (PropertyMap::expand): Don't use the index (uninitialized now) out of a _singleEntry
+ when putting it in a newly-created map; just use 0. Compute a value for the new map's
+ lastIndexUsed as we walk through the elements we are adding to it (using the same old
+ indices from the old map).
+
+=== Safari-85.1 ===
+
+=== Safari-85 ===
+
+2003-06-13 Darin Adler <darin@apple.com>
+
+ Reviewed by Dave.
+
+ - fixed 3178438 -- return elements in order of addition in for..in loop (other browsers seem to)
+ - fixed 3292067 -- REGRESSION (64-65): albertsons.com "Shop A to Z" menus are not sorted alphabetically
+
+ * kjs/property_map.h: Add index field to hash table entry and index parameter to insert function.
+ * kjs/property_map.cpp:
+ (PropertyMap::put): Set an index for new map entries to an ever-increasing number based on a global.
+ (PropertyMap::insert): Take an index parameter.
+ (PropertyMap::expand): Preserve the indices as we rehash the table.
+ (comparePropertyMapEntryIndices): Added. Compares two property map entries by index.
+ (PropertyMap::addEnumerablesToReferenceList): Sort the proprty map entries by index before adding
+ them to the reference list.
+
+=== Safari-84 ===
+
+2003-06-10 Vicki Murley <vicki@apple.com>
+
+ Reviewed by john.
+
+ * JavaScriptCore.order: new order file for 1.0
+
+=== Safari-83 ===
+
+2003-06-04 Darin Adler <darin@apple.com>
+
+ Reviewed by Dave.
+
+ - fixed 3224031 -- can't search at rakuten.co.jp b/c of extra characters inserted by regexp replace (8-bit char)
+
+ Use PCRE UTF-8 regular expressions instead of just chopping off high bytes.
+
+ * kjs/regexp.h: Redo field names, remove some unused stuff.
+ * kjs/regexp.cpp:
+ (convertToUTF8): Added.
+ (compareStringOffsets): Added.
+ (createSortedOffsetsArray): Added.
+ (convertCharacterOffsetsToUTF8ByteOffsets): Added.
+ (convertUTF8ByteOffsetsToCharacterOffsets): Added.
+ (RegExp::RegExp): Set the PCRE_UTF8 flag, and convert the UString to UTF-8 instead of
+ using ascii() on it.
+ (RegExp::~RegExp): Remove unneeded if statement (pcre_free is 0-tolerant as free is).
+ (RegExp::match): Convert the UString to UTF-8 and convert the character offsets to and
+ from UTF-8 byte offsets. Also do fixes for the "no offset vector" case so we get the
+ correct position and matched string.
+
+ * JavaScriptCore.pbproj/project.pbxproj: Add a PCRE header that was missing before.
+
+=== Safari-82 ===
+
+=== Safari-81 ===
+
+2003-05-21 Vicki Murley <vicki@apple.com>
+
+ Reviewed by john
+ - fixed 3234553: Safari and its frameworks should link using order files
+
+ * JavaScriptCore.order: Added.
+ * JavaScriptCore.pbproj/project.pbxproj: set SECTORDER_FLAGS = -sectorder __TEXT __text JavaScriptCore.order
+
+=== Safari-80 ===
+
+2003-05-19 Maciej Stachowiak <mjs@apple.com>
+
+ - fixed 3261096 - Make WebKit an umbrella framework
+
+ * JavaScriptCore.pbproj/project.pbxproj: In a B&I build, compile as a
+ sub-umbrella of WebKit.
+
+2003-05-16 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Ken.
+
+ - fixed 3254063 - REGRESSION: hang in KJS PropertyMap with many items in iDisk pictures folder
+
+ * kjs/property_map.cpp:
+ (PropertyMap::expand): Fixed to maintain key count properly - otherwise the hashtable
+ could get completely full, resulting in disaster.
+ (PropertyMap::checkConsistency): Fixed compilation. Fixed to know about deleted
+ sentinel. Fixed to search with double-hashing instead of linear probing.
+
+=== Safari-79 ===
+
+2003-05-15 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Chris.
+
+ - fixed 3259673 - REGRESSION: marvel.com thinks I don't have the flash plugin any more
+
+ * kjs/nodes.cpp:
+ (ContinueNode::execute): Return a Continue completion, not a Break
+ completion, in the normal non-exception case.
+
+2003-05-12 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin.
+
+ - fixed 3254484 - Add a way to print JavaScript exceptions to the console via the debug menu
+ - improved JavaScript error message format
+
+ * kjs/error_object.cpp:
+ (ErrorProtoFuncImp::call): Include line number in toString output.
+ * kjs/internal.cpp:
+ (Parser::parse): Remove redundant fprintf.
+ * kjs/interpreter.cpp:
+ (Interpreter::evaluate): Log if the flag is on. Include filename in log output.
+ (Interpreter::shouldPrintExceptions): Check the global flag.
+ (Interpreter::setShouldPrintExceptions): Set the global flag.
+ * kjs/interpreter.h:
+ * kjs/nodes.cpp:
+ (Node::throwError): Add variants that include value and expression or label in format.
+ (NewExprNode::evaluate): Improve error message.
+ (FunctionCallNode::evaluate): Improve error message.
+ (RelationalNode::evaluate): Improve error message.
+ (ContinueNode::execute): Improve error message.
+ (BreakNode::execute): Improve error message.
+ (LabelNode::execute): Improve error message.
+ * kjs/nodes.h:
+
+=== Safari-78 ===
+
+2003-05-07 Vicki Murley <vicki@apple.com>
+
+ Reviewed by darin.
+
+ - modify the Mixed build style to build optimized with symbols
+
+ * JavaScriptCore.pbproj/project.pbxproj: removed OPTIMIZATION_CFLAGS
+
+2003-05-05 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Don.
+
+ - fixed 3239961 - www.phiffer.com doesn't work; uses "var top; top = n;"
+
+ * kjs/nodes.cpp:
+ (VarDeclNode::evaluate): Check if the property exists with
+ getDirect() instead of hasProperty().
+
+=== Safari-77 ===
+
+2003-04-29 Darin Adler <darin@apple.com>
+
+ Reviewed by John.
+
+ - fixed 2959353 -- eliminate globally initialized objects from JavaScriptCore
+
+ * JavaScriptCore.pbproj/project.pbxproj: Added fpconst.cpp.
+ * kjs/fpconst.cpp: Added. Defines KJS::NaN and KJS::Inf in a way that does not require a
+ framework init routine.
+
+ * kjs/identifier.h: Use a new KJS_IDENTIFIER_EACH_GLOBAL macro so we can do things to
+ the entire set of identifiers easily. Also added an init function that sets up these globals
+ in a way that does not require a framework init routine.
+ * kjs/identifier.cpp: (Identifier::init): Initialize the property ane globals in a way that
+ does not require a framework init routine.
+
+ * kjs/internal.cpp: (InterpreterImp::initGlobalObject): Call Identifier::init.
+
+ * kjs/ustring.h: Remove UChar::null and UString::null, and add UString::null(). We can't have
+ a global object of a class that has a constructor if we want to avoid framework init routines,
+ and luckily very little code relies on these.
+ * kjs/ustring.cpp:
+ (UCharReference::ref): Use our own global specific to this function rather than returning
+ UChar::null when past the end of the string. This is dangerous because if the caller modifies
+ it, that affects what all subsequent callers will see.
+ (UString::Rep::create): Added assertions.
+ (UString::UString): Got rid of code here that used to set up UString::null.
+ (UString::null): Added. Returns a global null string, and can be used in some of the places
+ where we used to use the UString::null global.
+ (UString::operator[]): Fixed case where this used to return UChar::null to return '\0' instead.
+
+ * kjs/regexp.cpp: (RegExp::match): Change uses of UString::null to UString::null().
+
+2003-04-25 Darin Adler <darin@apple.com>
+
+ - fixed 3241344 -- REGRESSION: top of page missing on wired.com and cnn.com
+
+ Caused by the ResolveNode speedup. Roll it out until I can figure out why.
+
+ * kjs/nodes.cpp: (ResolveNode::evaluate): Go back to using evaluateReference.
+
+2003-04-25 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - a couple improvements that give a 6.6% speedup on iBench JavaScript
+
+ * kjs/nodes.cpp: (ResolveNode::evaluate): Don't use evaluateReference.
+
+ * kjs/object.cpp: (ObjectImp::get): Do the prototype work with the ValueImp, not a wrapper.
+ Contributes a tiny bit to the speedup, but cleaner anyway.
+ (ObjectImp::hasProperty): Same thing here.
+
+2003-04-25 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - move from linear probing to double hashing, gives an 0.7% speedup in iBench JavaScript
+
+ * kjs/property_map.h: Remove the hash function.
+ * kjs/property_map.cpp: Added statistics for rehashes and removes.
+ Moved from linear probing to double hashing, using the hash modulo
+ (table size minus one) plus one for the probing distance.
+
+ * kjs/ustring.h: Use unsigned instead of int for hash function result.
+
+=== Safari-75 ===
+
+2003-04-18 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Ken.
+
+ Improved List pool for 3% speed improvement on cvs-js-ibench
+
+ * kjs/list.cpp: Replaced the roving cursor with a free list and
+ raised the high water mark to 384.
+
+2003-04-12 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Don.
+
+ - JavaScriptCore part of fix for 3158769 - JavaScript triggers not as async as they used to be
+
+ Added a way to get the current interpreter lock count, so Sherlock
+ can unlock the interpreter inside JS method implementations that
+ spend a long time waiting for I/O, allowing more efficient
+ multi-threaded operation.
+
+ * kjs/internal.cpp:
+ (lockInterpreter):
+ (unlockInterpreter):
+ (InterpreterImp::lock):
+ (InterpreterImp::lockCount):
+ * kjs/internal.h:
+ * kjs/interpreter.cpp:
+ (Interpreter::lockCount):
+ * kjs/interpreter.h:
+
+=== Safari-73 ===
+
+=== Safari-72 ===
+
+=== Safari-71 ===
+
+2003-03-31 Darin Adler <darin@apple.com>
+
+ * English.lproj/InfoPlist.strings: Changed "1.0 Beta" to "1.0 Beta 2".
+ * JavaScriptCore.pbproj/project.pbxproj: Changed "1.0 Beta" to "1.0 Beta 2".
+
+=== Safari-69 ===
+
+2003-03-24 Trey Matteson <trey@apple.com>
+
+ Pass -seg_addr_table_filename <FILENAME> to ld. This makes our frameworks in
+ SYMROOT actually work for symbol resolution because they will have the correct
+ prebinding address. It also fixes obscure B&I problems with prebinding
+ reported by Matt Reda.
+
+ Note the reason all this is tricky for our projects is that we have a different
+ install location for Jaguar and Panther. The purpose of this arg is to declare
+ at link time our eventual location, which allows the prebinding address to be
+ found in /AppleInternal/Developer/seg_addr_table. We use a funky back-tick
+ expression within OTHER_LDFLAGS to get a conditional value depending on the
+ build train we are in.
+
+ This can all go away once we only build on Panther and don't embed the
+ frameworks inside the Safari.app wrapper.
+
+ In addition I fixed the OTHER_LDFLAGS settings in our build styles to be
+ additive instead of overriding, so we have the args we used for B&I in force
+ when building outside of B&I.
+
+ Reviewed by Maciej.
+
+ * JavaScriptCore.pbproj/project.pbxproj:
+
+=== Safari-68 ===
+
+2003-03-16 Trey Matteson <trey@apple.com>
+
+ 3198135 - need to fix our projects so SYMROOT is not stripped
+
+ Tweaked stripping options: B&I build does not COPY_PHASE_STRIP.
+ Deployment build still does.
+ We strip manually as part of the install that we do ourselves.
+
+ Reviewed by Maciej.
+
+ * JavaScriptCore.pbproj/project.pbxproj:
+
+=== Safari-67 ===
+
+=== Safari-66 ===
+
+2003-03-10 Darin Adler <darin@apple.com>
+
+ Reviewed by Ken.
+
+ - fixed 3193099 -- date parsing can't handle the time zone format that date formatting produces
+
+ * kjs/date_object.cpp: (KJS::KRFCDate_parseDate): Allow a "GMT" prefix before the time zone offset.
+
+=== Safari-65 ===
+
+2003-03-04 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - got rid of some framework initialization (working on bug 2959353)
+
+ * kjs/identifier.h: Turn Identifier:null into Identifier:null().
+ * kjs/identifier.cpp: Removed Identifier:null and added Identifier:null().
+
+ * kjs/internal.cpp: Made NaN_Bytes and Inf_Bytes const.
+
+ * kjs/completion.h: Use Identifier:null() instead of Identifier:null.
+ * kjs/function.h: Ditto.
+ * kjs/function_object.cpp: (FunctionObjectImp::construct): Ditto.
+ * kjs/nodes.cpp: (FuncExprNode::evaluate): Use Identifier:null() instead of Identifier:null.
+
+2003-03-02 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Trey.
+
+ - fixed 3158833 - ebay prefs page is so slow, it seems like a hang.
+
+ 92% speed improvement on ebay prefs page.
+ 1% speed improvement on js-ibench and js-performance plt suites.
+
+ There were a couple of problems with the identifier hash table that
+ I fixed:
+
+ * kjs/identifier.cpp:
+ (void Identifier::remove): Adjust the shrink threshold to avoid
+ constantly growing and shrinking.
+ * kjs/ustring.cpp:
+ (UString::Rep::computeHash): Use a better hash function that
+ avoids collisions for obvious data sets.
+
+=== Safari-64 ===
+
+=== Safari-63 ===
+
+2003-02-26 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin.
+
+ - fixed 3156705 - REGRESSION: javascript menus improperly placed at umich.edu store
+
+ * kjs/nodes.cpp:
+ (StatListNode::execute): If the first statement's completion is
+ not normal, return immediately.
+
+2003-02-21 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - fixed 3142355 -- nil-deref in CFTimeZoneCopyAbbreviation
+
+ The real problem wasn't with the current time zone, but with the UTC time zone.
+ The poor sod had a broken /usr/share/zoneinfo directory, with a 0-byte-long UTC file.
+
+ * kjs/date_object.cpp: (UTCTimeZone): Use CFTimeZoneCreateWithTimeIntervalFromGMT(NULL, 0.0)
+ to get the universal time zone instead of getting it by name.
+
+=== Safari-62 ===
+
+2003-02-18 Darin Adler <darin@apple.com>
+
+ Reviewed by Trey and Ken.
+
+ - fixed 3142355 -- nil-deref in CFTimeZoneCopyAbbreviation
+
+ Although I can't reproduce this bug, it seems that it's caused by CFTimeZoneCopyDefault returning NULL.
+ I'm almost certain that the UTC time zone will be created successfully in this case, so I'll just use that.
+
+ * kjs/date_object.cpp:
+ (UTCTimeZone): Added. Gets the UTC time zone (once in a global).
+ (CopyLocalTimeZone): Added. Gets the local time zone, but falls back to UTC.
+ (gmtimeUsingCF): Use UTCTimeZone.
+ (localtimeUsingCF): Use CopyLocalTimeZone.
+ (mktimeUsingCF): Use CopyLocalTimeZone.
+ (timegmUsingCF): Use UTCTimeZone.
+
+2003-02-12 Darin Adler <darin@apple.com>
+
+ Reviewed by Dave.
+
+ - fixed 3145442 -- toString(16) is not working, causing non-ASCII characters in mac.com homepage to be munged
+
+ * kjs/number_object.cpp: (NumberProtoFuncImp::call): Add handling for toString with a radix other than
+ 10 passed as an argument.
+
+2003-02-11 Trey Matteson <trey@apple.com>
+
+ Set -seg1addr in our build styles, but not for the B&I build.
+ This makes our SYMROOTS from B&I usable to determine symbols from crash
+ logs from the field.
+ Also nuked DeploymentFat build style.
+
+ Reviewed by Ken.
+
+ * JavaScriptCore.pbproj/project.pbxproj:
+
+2003-02-04 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin.
+
+ * JavaScriptCore.pbproj/project.pbxproj: Updated to build the framework
+ standalone instead of embedded when doing a B&I build for Panther.
+
+=== Safari-55 ===
+
+2003-01-29 Darin Adler <darin@apple.com>
+
+ Reviewed by John.
+
+ * kjs/scope_chain.cpp: Rolled out the fix to bug 3137084.
+ It caused a massive storage leak, and probably didn't even fix the bug.
+
+2003-01-28 Darin Adler <darin@apple.com>
+
+ Reviewed by Ken.
+
+ - fixed 3157318 -- hang at time zone page after clicking on map at www.time.gov
+
+ * kjs/date_object.cpp: (KJS::KRFCDate_parseDate): Allow a comma after the day.
+ Given how this code is structured, it allows commas in unwanted contexts too, but
+ that's almost certainly harmless.
+
+2003-01-28 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - fixed 3144918 -- Can't drill down multiple levels of categories when selling on ebay
+ if first item in list is chosen
+
+ The bug was caused by having array values in the property map past the storageLength cutoff
+ in an array object; those values would not be seen when you do a get.
+
+ * kjs/array_object.cpp:
+ (ArrayInstanceImp::put): Implement a new rule for resizing the storage that is independent
+ of the length. The old rule would sometimes make the storage very big if you added two elements
+ in a row that both had large, but consecutive indexes. This eliminates any cases where we
+ make sparse entries in the property map below the sparse array cutoff.
+ (ArrayInstanceImp::resizeStorage): Don't ever make storage size bigger than the cutoff unless
+ the caller specifically requests it.
+ (ArrayInstanceImp::setLength): Change this so it only makes the storage smaller, never larger.
+ We will actually enlarge the storage when putting elements in.
+
+2003-01-25 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ * kjs/Makefile.am: Add dependencies so the .lut.h files get rebuilt if the script changes.
+
+=== Safari-54 ===
+
+2003-01-22 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - fixed 3137084 -- Many non-reproducible crashers in ContextImp::mark / ScopeChain::mark
+
+ * kjs/scope_chain.cpp: (ScopeChain::push): Add assertion.
+ (ScopeChain::release): Fix while loop so that it decrements refCount of the first node in
+ the chain too.
+
+2003-01-21 Darin Adler <darin@apple.com>
+
+ - correct our copyrights to 2003; copyright is based on year of publication, not year worked on
+
+2003-01-16 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin.
+
+ - made minor tweaks to work better with Mozilla's JavaScript tests.
+
+ * kjs/testkjs.cpp:
+ (VersionFunctionImp::call): Implemented
+ (main): Ignore files named -f (hack to match -f <filename syntax
+ that moz JavaScript tests expect). Also use return code 3 instead
+ of 1 for uncaught exception.
+
+2003-01-16 Darin Adler <darin@apple.com>
+
+ * kjs/number_object.cpp: (NumberObjectImp::construct):
+ Fix build, remove stray space.
+
+2003-01-16 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - rolled in a change from the KJS folks
+
+ * kjs/number_object.h: Use ObjectImp *, not Object, for the proto.
+ * kjs/number_object.cpp:
+ (NumberInstanceImp::NumberInstanceImp): Use ObjectImp *, not Object, for the proto.
+ (NumberPrototypeImp::NumberPrototypeImp): Pass ObjectImp.
+ (NumberObjectImp::construct): Use ObjectImp.
+
+=== Safari-52 ===
+
+2003-01-14 Darin Adler <darin@apple.com>
+
+ Reviewed by Ken.
+
+ - rolled in a change from the KJS folks
+
+ Fixes a bug where the date functions would not accept non-strings.
+ And provides a bit of a speedup.
+
+ * kjs/date_object.h: Change parameter type for parseDate.
+ * kjs/date_object.cpp:
+ (DateObjectFuncImp::call): Always call toString, don't check the type.
+ (KJS::parseDate): Take a UString parameter, not a String parameter.
+
+2003-01-13 Darin Adler <darin@apple.com>
+
+ * kjs/ustring.h: Fix spelling of occurrence.
+
+2003-01-12 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - turned more recursion into iteration, and fixed some backwards stuff
+
+ * kjs/grammar.y: Use the normal idiom for CaseClauses and FormalParameterList
+ rather than using append().
+ * kjs/grammar.cpp: Regenerated.
+
+ * kjs/nodes.h: Change ClauseListNode and ParameterNode to use the normal idiom,
+ and got rid of append methods. Also added friend declarations and calls to reverseList().
+ * kjs/nodes.cpp:
+ (StatListNode::ref): Iteration, not recursion.
+ (StatListNode::deref): Iteration, not recursion.
+ (StatListNode::execute): Iteration, not recursion.
+ (StatListNode::processVarDecls): Iteration, not recursion.
+ (CaseClauseNode::reverseList): Added.
+ (ClauseListNode::ref): Iteration, not recursion.
+ (ClauseListNode::deref): Iteration, not recursion.
+ (ClauseListNode::processVarDecls): Iteration, not recursion.
+ (CaseBlockNode::reverseLists): Added.
+ (ParameterNode::ref): Iteration, not recursion.
+ (ParameterNode::deref): Iteration, not recursion.
+ (FuncDeclNode::reverseParameterList): Added.
+ (FuncExprNode::reverseParameterList): Added.
+ (SourceElementsNode::ref): Iteration, not recursion.
+ (SourceElementsNode::deref): Iteration, not recursion.
+ (SourceElementsNode::execute): Use variable name of n to match other functions.
+ (SourceElementsNode::processFuncDecl): Ditto.
+ (SourceElementsNode::processVarDecls): Ditto.
+
+ * kjs/nodes2string.cpp:
+ (SourceStream::operator<<): Used a switch statement for a bit of added clarity.
+ (ElementNode::streamTo): Iteration, not recursion.
+ (PropertyValueNode::streamTo): Iteration, not recursion.
+ (ArgumentListNode::streamTo): Iteration, not recursion.
+ (StatListNode::streamTo): Iteration, not recursion, and fixed order.
+ (VarDeclListNode::streamTo): Iteration, not recursion.
+ (ClauseListNode::streamTo): Used for statement to match other functions.
+ (CaseBlockNode::streamTo): Used for statement to match other functions.
+ (ParameterNode::streamTo): Iteration, not recursion.
+ (SourceElementsNode::streamTo): Iteration, not recursion, and fixed order that has been
+ backwards since I changed how this works in nodes.cpp.
+
+2003-01-11 Darin Adler <darin@apple.com>
+
+ Reviewed by John.
+
+ - changes inspired by things I noticed reviewing diffs vs. KDE when preparing the tarball
+
+ * kjs/function.cpp: (GlobalFuncImp::call): Use strtol when strtoll is
+ not available. Do #ifndef NDEBUG, not #if !NDEBUG.
+ * kjs/function.h: Do #ifndef NDEBUG, not #if !NDEBUG.
+ * kjs/internal.cpp:
+ (InterpreterImp::initGlobalObject): Do #ifndef NDEBUG, not #if !NDEBUG.
+ (KJS::printInfo): Remove case for ListType and remove default case that just
+ ends up suppressing the "missing case" warning and does no good.
+ * kjs/interpreter.cpp: (Interpreter::evaluate): Do #ifndef NDEBUG, not #if !NDEBUG.
+ * kjs/nodes.cpp:
+ (Node::finalCheck): Fix accidentally-deleted code in an ifdef we never compile.
+ (FunctionCallNode::evaluate): Remove bogus XXX comment. Maciej put this comment in,
+ and together we determined it's not needed.
+ (TypeOfNode::evaluate): Ditto.
+ * kjs/object.cpp: Remove assert that refers to ListType.
+ * kjs/value.h: Remove ListType.
+
+2003-01-09 Darin Adler <darin@apple.com>
+
+ * JavaScriptCore.pbproj/project.pbxproj: Add the year 2003, remove CFBundleIconFile,
+ bump marketing version to 0.8.1 and version to 52u to keep up with the branch,
+ remove CFHumanReadableCopyright, remove NSPrincipalClass.
+
+ * English.lproj/InfoPlist.strings: Updated to match above changes.
+
+2003-01-05 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by no one cause I'm just changing copyright strings.
+
+ * JavaScriptCore.pbproj/project.pbxproj: Added non-Apple copyrights to
+ copyright strings.
+ * English.lproj/InfoPlist.strings: Likewise.
+
+2003-01-05 Darin Adler <darin@apple.com>
+
+ * JavaScriptCore.pbproj/project.pbxproj: Fix "Apple Compupter" typo.
+ Remove unneeded CFBundleLongVersionString we don't use anywhere else.
+
+2003-01-02 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - fixed 3138213 -- browser hangs trying to open Apple travel site
+
+ * kjs/date_object.cpp: (timetUsingCF): Check for very-negative year numbers too.
+
+=== Alexander-48 ===
+
+=== Alexander-47 ===
+
+2002-12-30 Darin Adler <darin@apple.com>
+
+ Reviewed by Don and Maciej.
+
+ - follow-on to my fix for 3134693 that fixes one more case of recursion and simplifies further
+
+ * kjs/grammar.y: Remove SourceElementNode and just use a StatementNode instead.
+ Reverse SourceElements rule so the recursive rule comes first as in the original
+ KJS code (avoids actual parser recursion).
+
+ * kjs/grammar.cpp: Regenerated.
+ * kjs/grammar.cpp.h: Regenerated.
+ * kjs/grammar.h: Regenerated.
+
+ * kjs/nodes.h: Make processFuncDecl a virtual function in StatementNode so that we can
+ use a StatementNode instead of a SourceElementNode. Add a call to reverseList in BlockNode
+ to correct the order of the linked list in SourceElementsNode, to replace the technique
+ where we reversed it in the parser. Remove SourceElementNode class, and make the element in
+ SourceElementsNode be a StatementNode instead.
+ * kjs/nodes.cpp: Remove SourceElementNode code.
+ (StatementNode::processFuncDecl): Added empty function.
+ (BlockNode::reverseList): Added. Used to make the SourceElements list ordered correctly.
+ * kjs/nodes2string.cpp: Remove SourceElementNode code.
+
+=== Alexander-46 ===
+
+2002-12-28 Darin Adler <darin@apple.com>
+
+ Reviewed by Gramps and Ken.
+ Checked in by Ken.
+
+ - fixed 3134693 -- carsdirect.com crash on used car search, due to large JavaScript array
+
+ The parser was using recursion to handle many types of lists.
+ This meant that we crashed out of stack space when any of the lists were extra big.
+ I applied the same sort of fix we had already applied a while back for argument lists for
+ all the other types of lists, including the list of ElementNode that was the reason for
+ the crash reported here.
+
+ * kjs/grammar.y: Removed ElisionNode altogether and just use a count.
+ Use specific node types for PropertyNameAndValueList and PropertyName.
+
+ * kjs/grammar.cpp: Regenerated.
+ * kjs/grammar.cpp.h: Regenerated.
+ * kjs/grammar.h: Regenerated.
+
+ * kjs/nodes.h: Elide "ElisionNode", changing objects to keep elision counts instead.
+ Make the ObjectLiteralNode list field be PropertyValueNode, not just Node.
+ Make PropertyValueNode fields have specific types. Add new reverse list functions, calls
+ to those functions in the constructors, and friend declarations as needed so the class
+ that holds the head of a list can reverse the list during parsing.
+ * kjs/nodes.cpp:
+ (ElementNode::ref): Use iteration instead of recursion. Also elide "elision".
+ (ElementNode::deref): Ditto.
+ (ElementNode::evaluate): Use iteration instead of recursion, taking advantage of
+ the fact that the linked list is reversed. Also use the elision count rather than
+ an elision list.
+ (ArrayNode::reverseElementList): Reverse the list so we can iterate normally.
+ (ArrayNode::ref): Elide "elision".
+ (ArrayNode::deref): Ditto.
+ (ArrayNode::evaluate): Use elision count instead of elision list.
+ (ObjectLiteralNode::reverseList): Reverse the list so we can iterate normally.
+ (PropertyValueNode::ref): Use iteration instead of recursion.
+ (PropertyValueNode::deref): Use iteration instead of recursion.
+ (PropertyValueNode::evaluate): Use iteration instead of recursion, taking advantage
+ of the fact that the linked list is reversed.
+ (ArgumentListNode::ref): Change code to match the other similar cases we had to revise.
+ (ArgumentListNode::deref): Ditto.
+ (ArgumentListNode::evaluateList): Ditto.
+ (ArgumentsNode::reverseList): Ditto.
+ (VarDeclListNode::ref): Use iteration instead of recursion.
+ (VarDeclListNode::deref): Ditto.
+ (VarDeclListNode::evaluate): Use iteration instead of recursion, taking advantage
+ of the fact that the linked list is reversed.
+ (VarDeclListNode::processVarDecls): Ditto.
+ (VarStatementNode::reverseList): Reverse the list so we can iterate normally.
+ (FunctionBodyNode::FunctionBodyNode): Use BlockNode as the base class, removing
+ most of the FunctionBodyNode class.
+
+ * kjs/nodes2string.cpp:
+ (ElementNode::streamTo): Update for using a count for elision, and reverse linking.
+ (ArrayNode::streamTo): Update for using a count for elision.
+ (PropertyValueNode::streamTo): Update for reverse linking.
+ (ArgumentListNode::streamTo): Update for reverse linking. This has been wrong for
+ a while, since we added the reverse a long time ago.
+ (VarDeclListNode::streamTo): Update for reverse linking.
+ (ParameterNode::streamTo): Update for reverse linking.
+
+=== Alexander-45 ===
+
+2002-12-22 Darin Adler <darin@apple.com>
+
+ Reviewed by Don and John.
+
+ - fixed 3134449 -- Date.UTC returns NaN (invalid date)
+
+ Did more testing of the date functions and made them behave like the other browsers.
+ There were three problems:
+
+ 1) We did a validity check that other browsers don't do (hence the NaN).
+ 2) We treated passed-in dates as local time even in Date.UTC (hence a wrong result
+ once I fixed the NaN).
+ 3) The results of ToUTCString (and ToGMTString) weren't formatted quite the same
+ as other browsers.
+
+ Also found a couple of silly but unrelated coding mistakes.
+
+ * kjs/date_object.cpp:
+ (timetUsingCF): Added. Has the guts of mktimeUsingCF, but without the CFGregorianDateIsValid
+ check. Other browsers accept invalid dates. Also takes a time zone parameter.
+ (mktimeUsingCF): Calls timetUsingCF with the current time zone.
+ (timegmUsingCF): Calls timetUsingCF with the UTC time zone.
+ (formatDate): Remove the includeComma flag.
+ (formatDateUTCVariant): Added. For use instead of formatDate with the includeComma flag.
+ Puts the day before the month name.
+ (DateProtoFuncImp::call): Use the new formatDateUTCVariant for ToGMTString and ToUTCString.
+ Without this change the date didn't match other browsers.
+ (DateObjectImp::DateObjectImp): Use UTCPropertyName. Somehow I declared this and didn't use
+ it before.
+ (DateObjectImp::construct): Pass -1 for is_dst literally instead of using invalidDate.
+ Changing this to invalidDate was just a mistake (although no real difference in compiled
+ code since invalidDate is just -1).
+ (DateObjectFuncImp::call): Call timegm for the UTC case instead of mktime.
+
+=== Alexander-44 ===
+
+=== Alexander-43 ===
+
+2002-12-20 Trey Matteson <trey@apple.com>
+
+ We now build with symbols the B&I. Deployment builds are without symbols,
+ so it is easy to generate a non-huge app as a one-off.
+
+ Reviewed by Darin
+
+ * JavaScriptCore.pbproj/project.pbxproj:
+
+=== Alexander-42 ===
+
+=== Alexander-41 ===
+
+=== Alexander-40 ===
+
+2002-12-18 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by John.
+
+ - fixed 3131171 - Change Alex versions to satisfy both marketing and B&I requirements
+
+ * English.lproj/InfoPlist.strings:
+ * JavaScriptCore.pbproj/project.pbxproj:
+
+2002-12-17 Darin Adler <darin@apple.com>
+
+ Reviewed by Trey.
+
+ * JavaScriptCore.pbproj/project.pbxproj: Removed signature.
+
+=== Alexander-39 ===
+
+=== Alexander-38 ===
+
+2002-12-16 Darin Adler <darin@apple.com>
+
+ Reviewed by Don and Maciej.
+
+ - fixed 3129115 -- need Apple copyright added to open source documents
+
+ * tons of files: Added our copyright to files we modified, and updated all to standard format.
+
+ - other changes
+
+ * JavaScriptCore.pbproj/project.pbxproj: Set MACOSX_DEPLOYMENT_TARGET to 10.2.
+ Also removed completion.cpp.
+ * kjs/completion.cpp: Removed.
+ * kjs/completion.h: Made the Completion constructor inline.
+
+ * kjs/grammar.y: Removed an obsolete "pretend ifdef". No need to put these in APPLE_CHANGES now.
+
+=== Alexander-37 ===
+
+=== JavaScriptCore-37u2 ===
+
+2002-12-15 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin.
+
+ * JavaScriptCore.pbproj/project.pbxproj: Bump version to 37u2.
+
+2002-12-14 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ * JavaScriptCore.pbproj/project.pbxproj: Make dtoa.h visible as an SPI so I can
+ use it inside QString.
+
+2002-12-14 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Ken.
+
+ - further corrections to number printing.
+
+ * kjs/ustring.cpp:
+ (UString::from): Make number printing match the ECMA standard
+ algorithm.
+
+2002-12-14 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Dave.
+
+ - fix toString() conversion for numbers less than 1. Negative
+ exponents are still wrong though (things like 1E-34).
+
+ * kjs/ustring.cpp:
+ (UString::from): Don't print empty string for numbers less than 1,
+ and remember to add extra 0s after the decimal for negative
+ decimal positions.
+
+=== Alexander-37u1 ===
+
+=== Alexander-36 ===
+
+2002-12-12 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin.
+
+ - fixed 3056449 - can't select state at tucows.com
+
+ * kjs/array_instance.h:
+ * kjs/array_object.cpp:
+ (ArrayInstanceImp::propList): Add numeric proprties that are in
+ special storage.
+ * kjs/array_object.h:
+ * kjs/object.h: Make propList a virtual method.
+
+2002-12-11 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Don.
+
+ - Add kjsprint global function in Development build for ease of debugging.
+ - Print uncaught JavaScript exceptions to the console in Development.
+ - Improve wording of exception error messages.
+
+ * kjs/function.cpp:
+ (GlobalFuncImp::call):
+ * kjs/function.h:
+ * kjs/internal.cpp:
+ (InterpreterImp::initGlobalObject):
+ * kjs/interpreter.cpp:
+ (Interpreter::evaluate):
+ * kjs/nodes.cpp:
+ (NewExprNode::evaluate):
+ (FunctionCallNode::evaluate):
+ (RelationalNode::evaluate):
+
+2002-12-10 John Sullivan <sullivan@apple.com>
+
+ Fixed more "Alexander"s that were lurking in places I forgot
+ to look before.
+
+ Reviewed by Darin
+
+ * Makefile.am:
+ "rm -rf $(SYMROOTS)/Safari.app/Frameworks/JavaScriptCore.framework"
+
+2002-12-09 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ * JavaScriptCore.pbproj/project.pbxproj: Bump versions to 0.8 and 35u.
+ * English.lproj/InfoPlist.strings: In here too.
+
+2002-12-09 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Ken.
+
+ - fixed 3059637 - all articles missing at excite.com sports page
+ - fixed 3065903 - most of content missing at excite.com news page
+
+ These bugs both came up because a JavaScript function has a var
+ declaration that collides with a function parameter name.
+
+ * kjs/nodes.cpp:
+ (VarDeclNode::processVarDecls): Don't set the property to
+ undefined if a property with that name is already set on the
+ global object. Otherwise we may clobber function parameters with
+ undefined even before hitting a possible var initializer.
+
+2002-12-06 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by: Darin Adler
+
+ - made framework embedding work correctly with buildit
+
+ * JavaScriptCore.pbproj/project.pbxproj: Give framework a relative
+ install path, don't install it the normal way, and copy it
+ manually to /AppleInternal/Library/Frameworks if installing.
+
+=== Alexander-35 ===
+
+2002-12-04 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by: Richard Williamson
+
+ Added explicit lock/unlock methods so Sherlock can grab the
+ interpreter lock as needed.
+
+ - partially addressed 3084320 - JavaScriptCore crash
+
+ * kjs/internal.cpp:
+ (InterpreterImp::InterpreterImp):
+ (InterpreterImp::lock):
+ (InterpreterImp::unlock):
+ * kjs/internal.h:
+ * kjs/interpreter.cpp:
+ (Interpreter::lock):
+ (Interpreter::unlock):
+ * kjs/interpreter.h:
+
+2002-12-04 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by: Darin Adler
+
+ Set things up so JavaScriptCore builds in PCRE and uses it for
+ regular expressions. This fixes many form validation bugs:
+
+ - fixed 3103197 - javascript at fidelity.com rejects valid input
+ - fixed 2942552 - form validation at weather.com fails
+ - fixed 3079752 - js always reports textarea is empty
+ - fixed 3079719 - covad.com "check availalbility" fails
+
+ * Makefile.am: Add pcre subdir.
+ * kjs/config.h: define HAVE_PCREPOSIX to true.
+ * kjs/regexp.h: Don't include pcreposix.h since nothing from there
+ is used.
+ * pcre/.cvsignore: Added.
+ * pcre/ChangeLog: Removed.
+ * pcre/INSTALL: Removed.
+ * pcre/Makefile.am: Added.
+ * pcre/Makefile.in: Removed.
+ * pcre/NEWS: Removed.
+ * pcre/NON-UNIX-USE: Removed.
+ * pcre/README: Removed.
+ * pcre/chartables.c: Added.
+ * pcre/config.guess: Removed.
+ * pcre/config.in: Removed.
+ * pcre/config.sub: Removed.
+ * pcre/configure: Removed.
+ * pcre/configure.in: Removed.
+ * pcre/dll.mk: Removed.
+ * pcre/doc/Tech.Notes: Removed.
+ * pcre/doc/pcre.3: Removed.
+ * pcre/doc/pcre.html: Removed.
+ * pcre/doc/pcre.txt: Removed.
+ * pcre/doc/pcregrep.1: Removed.
+ * pcre/doc/pcregrep.html: Removed.
+ * pcre/doc/pcregrep.txt: Removed.
+ * pcre/doc/pcreposix.3: Removed.
+ * pcre/doc/pcreposix.html: Removed.
+ * pcre/doc/pcreposix.txt: Removed.
+ * pcre/doc/pcretest.1: Removed.
+ * pcre/doc/pcretest.html: Removed.
+ * pcre/doc/pcretest.txt: Removed.
+ * pcre/doc/perltest.txt: Removed.
+ * pcre/install-sh: Removed.
+ * pcre/ltmain.sh: Removed.
+ * pcre/pcre-config.h: Added.
+ * pcre/pcre-config.in: Removed.
+ * pcre/internal.h: Include pcre-config.h instead of config.h
+ * pcre/pcre.c:
+ (ord2utf8): Fix warnings.
+ (pcre_compile): Fix warnings.
+ * pcre/pcre.def: Removed.
+ * pcre/pcre.h: Added.
+ * pcre/pcre.in: Removed.
+ * JavaScriptCore.pbproj/project.pbxproj: Added pcre files to build.
+ * JavaScriptCorePrefix.h: Guard c++ headers with #ifdef __cplusplus.
+
+2002-12-04 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by: Richard Williamson
+
+ * pcre/doc/*: Added.
+ * pcre/testdata/*: Added.
+
+2002-12-03 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by: Darin Adler
+
+ - imported PCRE 3.9 into the tree; this isn't actually compiled or
+ used yet.
+
+ * pcre/*: Added.
+
+== Rolled over to ChangeLog-2002-12-03 ==
diff --git a/Source/JavaScriptCore/ChangeLog-2007-10-14 b/Source/JavaScriptCore/ChangeLog-2007-10-14
new file mode 100644
index 0000000..693f966
--- /dev/null
+++ b/Source/JavaScriptCore/ChangeLog-2007-10-14
@@ -0,0 +1,26221 @@
+=== Start merge of feature-branch 2007-10-12 ===
+
+2007-10-11 Andrew Wellington <proton@wiretapped.net>
+
+ Reviewed by Eric Seidel.
+
+ Fix for http://bugs.webkit.org/show_bug.cgi?id=15076
+ "deg2rad has multiple definitions"
+
+ Define deg2rad, rad2deg, deg2grad, grad2deg, rad2grad, grad2rad
+ These are used through WebKit.
+
+ Change based on original patch by Rob Buis.
+
+ * wtf/MathExtras.h:
+ (deg2rad):
+ (rad2deg):
+ (deg2grad):
+ (grad2deg):
+ (rad2grad):
+ (grad2rad):
+
+2007-10-10 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Eric.
+
+ - fix assertion failures on quit.
+
+ * kjs/array_object.cpp:
+ (ArrayProtoFunc::callAsFunction): Dynamically alocate function-scope static
+ UStrings to avoid the static destructor getting called later.
+ * kjs/lookup.h: Dynamically alocate function-scope static
+ Identifiers to avoid the static destructor getting called later.
+
+2007-10-07 Ed Schouten <ed@fxq.nl>
+
+ Reviewed and landed by Alexey Proskuryakov.
+
+ Add PLATFORM(FREEBSD), so we can fix the build on FreeBSD-like
+ systems by including <pthread_np.h>. Also fix some (disabled)
+ regcomp()/regexec() code; it seems some variable names have
+ changed.
+
+ * kjs/config.h:
+ * kjs/regexp.cpp:
+ (KJS::RegExp::RegExp):
+ * wtf/Platform.h:
+
+2007-10-02 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Darin.
+
+ http://bugs.webkit.org/show_bug.cgi?id=10370
+ RegExp fails to match non-ASCII characters against [\S\s]
+
+ Test: fast/js/regexp-negative-special-characters.html
+
+ * pcre/pcre_compile.c:
+ (compile_branch): Adjust opcode and bitmap as necessary to include (or exclude)
+ character codes >255. Fix suggested by Philip Hazel.
+
+ * pcre/pcre_exec.c:
+ (match): Merged fix for PCRE bug 580 (\S\S vs. \S{2}).
+
+ * tests/mozilla/expected.html: One test was fixed.
+ * pcre/MERGING: Added information about this fix.
+
+2007-10-02 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver.
+
+ - skip extra hash lookup and avoid converting char* to UString for 19% speedup on CK JS array test
+ http://bugs.webkit.org/show_bug.cgi?id=15350
+
+ * kjs/array_object.cpp:
+ (ArrayProtoFunc::callAsFunction): Implement the two mentioned optimizations.
+
+2007-10-02 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Mark.
+
+ - Efficiently handle regexp property identifiers for 19% speedup on Celtic Kane regexp test
+ http://bugs.webkit.org/show_bug.cgi?id=15337
+
+ * kjs/CommonIdentifiers.h:
+ * kjs/regexp_object.cpp:
+ (RegExpProtoFunc::callAsFunction):
+ (RegExpObjectImp::arrayOfMatches):
+ (RegExpObjectImp::construct):
+
+2007-10-02 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Mark.
+
+ - Cache global prorotypes more efficiently for 10% speedup on CK AJAX benchmark
+ http://bugs.webkit.org/show_bug.cgi?id=15335
+
+ * kjs/lookup.h:
+
+2007-10-01 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Mark.
+
+ Enable Experimental SVG features by default when building from Xcode
+
+ * Configurations/JavaScriptCore.xcconfig:
+
+2007-09-29 Rob Buis <buis@kde.org>
+
+ Reviewed by Adam.
+
+ http://bugs.webkit.org/show_bug.cgi?id=13472
+ Misparsing date in javascript leads to year value of -1
+ http://bugs.webkit.org/show_bug.cgi?id=14176
+ Some date values not handled consistently with IE/Firefox
+
+ Allow an optional comma between month and year, and year and time.
+
+ * kjs/date_object.cpp:
+ (KJS::parseDate):
+
+2007-07-11 Nikolas Zimmermann <zimmermann@kde.org>
+
+ Reviewed by Mark.
+
+ Forwardport the hash table fix from CodeGeneratorJS.pm to create_hash_table.
+ Reran run-jsc-tests, couldn't find any regressions. Suggested by Darin.
+
+ * kjs/create_hash_table:
+
+2007-06-25 Antti Koivisto <antti@apple.com>
+
+ Reviewed by Maciej.
+
+ Use intHash to hash floats and doubles too.
+
+ * ChangeLog:
+ * wtf/HashFunctions.h:
+ (WTF::FloatHash::hash):
+ (WTF::FloatHash::equal):
+ (WTF::):
+ * wtf/HashTraits.h:
+ (WTF::FloatHashTraits::emptyValue):
+ (WTF::FloatHashTraits::deletedValue):
+ (WTF::):
+
+=== End merge of feature-branch 2007-10-12 ===
+
+2007-10-11 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Tim Hatcher.
+
+ Fix for <rdar://problem/5488678>. Disable debugging symbols in production builds for 10.4
+ PowerPC to prevent a huge STABS section from being generated.
+
+ * Configurations/Base.xcconfig:
+
+2007-10-08 George Staikos <staikos@kde.org>
+
+ Reviewed by Adam Roben.
+
+ Fix Qt build on Win32.
+
+ * kjs/testkjs.cpp:
+ (main):
+
+2007-10-10 Simon Hausmann <hausmann@kde.org>
+
+ Reviewed by Lars.
+
+ Fix compilation using gcc 4.3. Header files have been reorganized and as a result some extra
+ includes are needed for INT_MAX, std::auto_ptr and the like.
+
+ * kjs/collector.cpp:
+ * kjs/collector.h:
+ * kjs/lexer.cpp:
+ * kjs/scope_chain.cpp:
+ * kjs/ustring.cpp:
+ * wtf/Vector.h:
+
+2007-10-09 Lars Knoll <lars@trolltech.com>
+
+ Reviewed by Simon.
+
+ fix the invokation of slots with return types. Add a JSLock around the conversion from QVariant to JSValue.
+
+ * bindings/qt/qt_instance.cpp:
+ (KJS::Bindings::QtInstance::invokeMethod):
+ * bindings/qt/qt_runtime.cpp:
+ (KJS::Bindings::convertValueToQVariant):
+ (KJS::Bindings::convertQVariantToValue):
+
+2007-10-05 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Added JSObject::removeDirect, to support the fix for
+ <rdar://problem/5522487> REGRESSION: With JavaScript disabled, any
+ page load causes a crash in PropertyMap::put
+
+ * kjs/object.cpp:
+ (KJS::JSObject::removeDirect):
+ * kjs/object.h:
+
+2007-10-04 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Oliver.
+
+ Switch to default level of debugging symbols to resolve <rdar://problem/5488678>.
+ The "full" level appears to offer no observable benefits even though the documentation
+ suggests it be used for dead code stripping. This should also decrease link times.
+
+ * Configurations/Base.xcconfig:
+
+2007-10-03 Lars Knoll <lars@trolltech.com>
+
+ Reviewed by Rob.
+
+ Fix a stupid bug in Unicode::toUpper/toLower.
+ Fixes all three test failures in the JavaScriptCore test
+ suite.
+
+ * wtf/unicode/qt4/UnicodeQt4.h:
+ (WTF::Unicode::toLower):
+ (WTF::Unicode::toUpper):
+
+2007-10-02 Darin Adler <darin@apple.com>
+
+ Reviewed by Adam.
+
+ - add support for GDI objects to OwnPtr; I plan to use this
+ to fix some GDI handle leaks
+
+ * kjs/grammar.y: Change parser to avoid macros that conflict
+ with macros defined in Windows system headers: THIS, DELETE,
+ VOID, IN, and CONST. This is needed because OwnPtr.h will now
+ include <windows.h>.
+ * kjs/keywords.table: Ditto.
+
+ * wtf/OwnPtr.h: For PLATFORM(WIN), add support so that OwnPtr can be
+ a GDI handle, and it will call DeleteObject. Also change to use the
+ RemovePointer technique used by RetainPtr, so you can say OwnPtr<HBITMAP>
+ rather than having to pass in the type pointed to by HBITMAP.
+
+ * wtf/OwnPtrWin.cpp: Added.
+ (WebCore::deleteOwnedPtr): Put this in a separate file so that we
+ don't have to include <windows.h> in OwnPtr.h.
+
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj: Added OwnPtrWin.cpp.
+
+2007-09-29 Holger Hans Peter Freyther <zecke@selfish.org>
+
+ Reviewed by Mark.
+
+ -Fix http://bugs.webkit.org/show_bug.cgi?id=13226.
+ Remove Bakefiles from svn.
+
+ * JavaScriptCoreSources.bkl: Removed.
+ * jscore.bkl: Removed.
+
+2007-09-27 Kevin Decker <kdecker@apple.com>
+
+ Rubber stamped by John Sullivan.
+
+ <rdar://problem/5493093>
+
+ * JavaScriptCore.order: Added.
+ * JavaScriptCore.xcodeproj/project.pbxproj: We're changing from using an order file built by
+ another team to using one we actually check into our project repository. Linker settings for
+ Symbol Ordering Flags have been updated accordingly.
+
+2007-09-26 Adam Roben <aroben@apple.com>
+
+ Make testkjs delay-load WebKit.dll so WebKitInitializer can work its magic
+
+ Rubberstamped by Anders.
+
+ * JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
+
+2007-09-25 Adam Roben <aroben@apple.com>
+
+ Make testkjs delay-load its dependencies
+
+ This lets WebKitInitializer re-route the dependencies to be loaded out
+ of the Safari installation directory.
+
+ Rubberstamped by Sam.
+
+ * JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
+
+2007-09-25 David Kilzer <ddkilzer@webkit.org>
+
+ Reviewed by Adam.
+
+ - Fix http://bugs.webkit.org/show_bug.cgi?id=14885
+ LGPL'ed files contain incorrect FSF address
+
+ * COPYING.LIB:
+ * bindings/testbindings.cpp:
+ * kjs/AllInOneFile.cpp:
+ * kjs/DateMath.cpp:
+ * kjs/PropertyNameArray.cpp:
+ * kjs/PropertyNameArray.h:
+ * kjs/config.h:
+
+2007-09-25 Sam Weinig <sam@webkit.org>
+
+ Fix location for build products for Debug_Internal.
+
+ Reviewed by Adam Roben.
+
+ * JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
+
+2007-09-25 Adam Roben <aroben@apple.com>
+
+ Make testkjs use WebKitInitializer
+
+ Reviewed by Sam.
+
+ * JavaScriptCore.vcproj/JavaScriptCore.sln: Add WebKitInitializer and
+ make testkjs depend on it.
+ * JavaScriptCore.vcproj/testkjs/testkjs.vcproj: Link against
+ WebKitInitializer.lib.
+ * kjs/testkjs.cpp:
+ (main): Call initializeWebKit.
+
+2007-09-24 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Sam.
+
+ - Continued to update project files to not use Edit and Continue for Debug Information since it doesn't work and breaks some functionality.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+
+2007-09-21 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Sam.
+
+ - Updated project files to not use Edit and Continue for Debug Information since it doesn't work and breaks some functionality.
+
+ * JavaScriptCore.vcproj/dftables/dftables.vcproj:
+ * JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
+
+2007-09-20 Holger Hans Peter Freyther <zecke@selfish.org>
+
+ Rubber stamped by Adam.
+
+ Renamed files from *Gdk to *Gtk (see #14732) using the
+ work of Juan A. Suarez Romero as a base.
+
+ GDK -> GTK
+
+ * JavaScriptCore.pri:
+ * kjs/testkjs.pro:
+ * pcre/dftables.pro:
+ * wtf/Platform.h: PLATFORM(GDK) to PLATFORM(GTK)
+
+2007-09-21 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Antti Koivisto.
+
+ http://bugs.webkit.org/show_bug.cgi?id=15250
+ <rdar://problem/5496942> REGRESSION: Reproducible crash in Safari when evaluating script in Drosera console (15250)
+
+ * kjs/function.cpp:
+ (KJS::GlobalFuncImp::callAsFunction): Null-check thisObj before passing it to interpreterForGlobalObject.
+
+2007-09-19 Holger Hans Peter Freyther <zecke@selfish.org>
+
+ Rubber stamped by Adam.
+
+ Make the guard/#if use the same name (ENABLE_FTPDIR) as the #define. This follows
+ the ENABLE_ICONDATABASE example from a couple of lines above.
+
+ * wtf/Platform.h:
+
+2007-09-19 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Maciej.
+
+ <rdar://problem/5487107> NULL dereference crash in FastMallocZone::enumerate when running leaks against Safari
+
+ Storing remote pointers to their local equivalents in mapped memory was leading to the local pointer being
+ interpreted as a remote pointer. This caused a crash when using the result of mapping this invalid remote pointer.
+ The fix is to follow the pattern used elsewhere in FastMallocZone by always doing the mapping after reading and
+ never storing the mapped pointer.
+
+ * wtf/FastMalloc.cpp:
+ (WTF::FastMallocZone::enumerate):
+
+2007-09-15 Darin Adler <darin@apple.com>
+
+ - fix Mac build
+
+ * JavaScriptCore.exp: Export WTFLogVerbose.
+
+2007-09-14 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Sam.
+
+ - Copy JSRetainPtr to include folder.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+
+2007-09-13 Geoffrey Garen <ggaren@apple.com>
+
+ Try to fix GDK build.
+
+ * wtf/MathExtras.h:
+ (wtf_random_init):
+
+2007-09-12 Geoff Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Fixed <rdar://problem/5429064> 141885 Safari JavaScript: Math.random() slightly less randomly distributed than on Safari / Mac
+
+ Math.random was skewed slightly upward because it assumed that RAND_MAX was outside the range of
+ values that rand() might return. This problem was particularly pronounced on Windows because
+ the range of values returned by rand() on Windows is 2^16 smaller than the range of values
+ return by rand() on Mac.
+
+ Fixed by accounting for RAND_MAX return values. Also, switched Windows over to rand_s, which has
+ a range that's equal to rand()'s range on Mac.
+
+ * kjs/config.h:
+
+ * kjs/math_object.cpp:
+ (MathFuncImp::callAsFunction): Use the new new thing.
+
+ * wtf/MathExtras.h: Platform abstraction for random numbers, to cover over differences on Windows.
+ (wtf_random_init):
+ (wtf_random):
+
+2007-09-13 Antti Koivisto <antti@apple.com>
+
+ Reviewed by Maciej.
+
+ Small addition to previous path to cover
+ http://bugs.webkit.org/show_bug.cgi?id=11399
+ window.eval runs in the global scope of the calling window
+
+ Switch variable scope as well.
+
+ * kjs/function.cpp:
+ (KJS::GlobalFuncImp::callAsFunction):
+
+2007-09-12 Antti Koivisto <antti@apple.com>
+
+ Reviewed by Geoff, Maciej.
+
+ Fix <rdar://problem/5445058>
+ REGRESSION: Unable to upload picture to eBay auction due to domain security check
+
+ eBay uses window.eval() between windows. In Firefox window.eval() switches execution
+ and security context to the target window, something WebKit did not do. With WebKit
+ security tightening in r24781, this broke picture uploads.
+
+ Fix by making WebKit switch context in window.eval().
+
+ * kjs/Context.cpp:
+ (KJS::Context::Context):
+ (KJS::Context::~Context):
+ * kjs/context.h:
+ Save and restore interpreter context independently from calling context.
+
+ * kjs/function.cpp:
+ (KJS::GlobalFuncImp::callAsFunction):
+ If eval is called for global object different than current one, switch execution context
+ to that object and push it to scope.
+
+2007-09-12 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ <rdar://problem/5478717> JSStringCreateWithCFString leaks when passed a zero length CFStringRef
+
+ * API/JSStringRefCF.cpp:
+ (JSStringCreateWithCFString): Special case the zero length string and remove the
+ UTF16 optimized path since it will always leak due to the fact that we won't be
+ able to free the backing store that the CFStringRef provides.
+
+2007-09-10 Timothy Hatcher <timothy@apple.com>
+
+ Reviewed by Darin Adler.
+
+ <rdar://problem/5456224> CrashTracer: [USER] 2 crashes in Toast Titanium at com.apple.CoreServices.CarbonCore: CSMemDisposePtr + 37
+
+ Removed the implementation of these malloc zone functions. We do not have the ability to
+ check if a pointer is valid or not, so we can't correctly implement them. The system free
+ does not fail if you pass in a bad pointer.
+
+ * wtf/FastMalloc.cpp:
+ (WTF::FastMallocZone::size):
+ (WTF::FastMallocZone::zoneMalloc):
+ (WTF::FastMallocZone::zoneCalloc):
+ (WTF::FastMallocZone::zoneFree):
+ (WTF::FastMallocZone::zoneRealloc):
+
+2007-09-07 Darin Adler <darin@apple.com>
+
+ Reviewed by Steve Falkenburg.
+
+ - fix crash seen on Windows release builds
+
+ * wtf/FastMalloc.cpp: Change pthread_getspecific optimization to be done only
+ on the DARWIN platform. Also correct a couple reinterpret_cast that should be
+ static_cast instead.
+
+2007-09-06 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Maciej.
+
+ - Moved JSRetainPtr to the API.
+
+ * API/JSRetainPtr.h: Copied from kjs/JSRetainPtr.h.
+ (JSRetain):
+ (JSRelease):
+ (JSRetainPtr::JSRetainPtr):
+ (JSRetainPtr::~JSRetainPtr):
+ (JSRetainPtr::get):
+ (JSRetainPtr::releaseRef):
+ (JSRetainPtr::operator->):
+ (JSRetainPtr::operator!):
+ (JSRetainPtr::operator UnspecifiedBoolType):
+ (::operator):
+ (::adopt):
+ (::swap):
+ (swap):
+ (operator==):
+ (operator!=):
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * kjs/JSRetainPtr.h: Removed.
+
+2007-09-05 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin.
+
+ - Remove single-threaded optimization for FastMalloc.
+
+ It does not appear to help anywhere but Mac OS X on PPC, due to
+ pthread_getspecific being slow there. On Intel, removing the
+ optimization results in a ~1.5% PLT speedup, a ~1-5% JS iBench
+ speedup, and a ~1.5% HTML iBench speedup. On PPC this change is a
+ speedup on some benchmarks, a slight hit on others.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * kjs/collector.cpp:
+ (KJS::Collector::registerThread):
+ * wtf/FastMalloc.cpp:
+ (WTF::TCMalloc_ThreadCache::GetCache):
+ (WTF::TCMalloc_ThreadCache::GetCacheIfPresent):
+ (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary):
+ (WTF::do_malloc):
+ * wtf/FastMallocInternal.h: Removed.
+
+2007-09-05 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Adam, Sam, Darin.
+
+ - Created a JSRetainPtr specifically for JSStringRefs so they can be automatically refed and derefed.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * kjs/JSRetainPtr.h: Copied from wtf/RetainPtr.h.
+ (KJS::JSRetain):
+ (KJS::JSRelease):
+ (KJS::):
+ (KJS::JSRetainPtr::JSRetainPtr):
+ (KJS::JSRetainPtr::~JSRetainPtr):
+ (KJS::JSRetainPtr::get):
+ (KJS::JSRetainPtr::releaseRef):
+ (KJS::JSRetainPtr::operator->):
+ (KJS::JSRetainPtr::operator UnspecifiedBoolType):
+ (KJS::::operator):
+ (KJS::::adopt):
+ (KJS::::swap):
+ (KJS::swap):
+ (KJS::operator==):
+ (KJS::operator!=):
+
+2007-09-05 Mark Rowe <mrowe@apple.com>
+
+ Unreviewed Qt build fix.
+
+ * wtf/unicode/qt4/UnicodeQt4.h: Fix the constness of the src argument to toUpper to prevent build failures.
+
+2007-09-04 Maciej Stachowiak <mjs@apple.com>
+
+ Back out accidentally committed change.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * kjs/collector.cpp:
+ (KJS::Collector::registerThread):
+ * wtf/FastMalloc.cpp:
+ (WTF::fastMallocSetIsMultiThreaded):
+ (WTF::TCMalloc_ThreadCache::GetCache):
+ (WTF::TCMalloc_ThreadCache::GetCacheIfPresent):
+ (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary):
+ (WTF::do_malloc):
+ * wtf/FastMallocInternal.h: Added.
+
+2007-09-04 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin.
+
+ - Added Vector::appendRange(), which appends to a vector based on a given start and end iterator
+ - Added keys() and values() functions to HashMap iterators, which give keys-only and values-only iterators
+
+ Together, these allow easy copying of a set, or the keys or values of a map, into a Vector. Examples:
+
+ HashMap<int, int> map;
+ HashSet<int> set;
+ Vector<int> vec;
+ // ...
+ vec.appendRange(set.begin(), set.end());
+ vec.appendRange(map.begin().keys(), map.end().keys());
+ vec.appendRange(map.begin().values(), map.end().values());
+
+ This also allows for a slightly nicer syntax when iterating a map. Instead of saying
+ (*it)->first, you can say *it.values(). Similarly for keys. Example:
+
+ HashMap<int, int>::const_iterator end = map.end();
+ for (HashMap<int, int>::const_iterator it = map.begin(); it != end; ++it)
+ printf(" [%d => %d]", *it.keys(), *it.values());
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * wtf/HashIterators.h: Added.
+ (WTF::):
+ (WTF::HashTableConstKeysIterator::HashTableConstKeysIterator):
+ (WTF::HashTableConstKeysIterator::get):
+ (WTF::HashTableConstKeysIterator::operator*):
+ (WTF::HashTableConstKeysIterator::operator->):
+ (WTF::HashTableConstKeysIterator::operator++):
+ (WTF::HashTableConstValuesIterator::HashTableConstValuesIterator):
+ (WTF::HashTableConstValuesIterator::get):
+ (WTF::HashTableConstValuesIterator::operator*):
+ (WTF::HashTableConstValuesIterator::operator->):
+ (WTF::HashTableConstValuesIterator::operator++):
+ (WTF::HashTableKeysIterator::HashTableKeysIterator):
+ (WTF::HashTableKeysIterator::get):
+ (WTF::HashTableKeysIterator::operator*):
+ (WTF::HashTableKeysIterator::operator->):
+ (WTF::HashTableKeysIterator::operator++):
+ (WTF::HashTableKeysIterator::operator HashTableConstKeysIterator<HashTableType, KeyType, MappedType>):
+ (WTF::HashTableValuesIterator::HashTableValuesIterator):
+ (WTF::HashTableValuesIterator::get):
+ (WTF::HashTableValuesIterator::operator*):
+ (WTF::HashTableValuesIterator::operator->):
+ (WTF::HashTableValuesIterator::operator++):
+ (WTF::HashTableValuesIterator::operator HashTableConstValuesIterator<HashTableType, KeyType, MappedType>):
+ (WTF::operator==):
+ (WTF::operator!=):
+ * wtf/HashTable.h:
+ * wtf/Vector.h:
+ (WTF::::appendRange):
+
+2007-09-04 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin.
+
+ - Remove single-threaded optimization for FastMalloc.
+
+ It does not appear to help anywhere but Mac OS X on PPC, due to
+ pthread_getspecific being slow there. On Intel, removing the
+ optimization results in a 1% PLT speedup, a 2% JS iBench speedup,
+ and no measurable effect on HTML iBench (maybe a slight speedup).
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * kjs/collector.cpp:
+ (KJS::Collector::registerThread):
+ * wtf/FastMalloc.cpp:
+ (WTF::TCMalloc_ThreadCache::GetCache):
+ (WTF::TCMalloc_ThreadCache::GetCacheIfPresent):
+ (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary):
+ (WTF::do_malloc):
+ * wtf/FastMallocInternal.h: Removed.
+
+2007-09-03 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Tim Hatcher.
+
+ <rdar://problem/5452164> Production build with in symbols directory has no debug info
+
+ Enable debug symbol generation on all build configurations. Production builds are stripped
+ of symbols by Xcode during deployment post-processing.
+
+ * Configurations/Base.xcconfig:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2007-08-30 Riku Voipio <riku.voipio@iki.fi>
+
+ Reviewed by Dave Kilzer.
+
+ Better ARM defines.
+
+ * kjs/ustring.h: Update comments to reflect the change and update test
+ to fit changes to Platform.h.
+ * wtf/Platform.h: Forced packing is only needed on oldabi ARM.
+ Set middle-endian floats only for little-endian oldabi ARM.
+ Set big-endian define for big-endian ARM.
+
+2007-08-29 Ryan Leavengood <leavengood@gmail.com>
+
+ Reviewed by Maciej.
+
+ http://bugs.webkit.org/show_bug.cgi?id=15043
+ - posix_memalign takes a void** as its first parameter. My port makes use of this function call.
+
+ * kjs/collector.cpp:
+ (KJS::allocateBlock):
+
+2007-08-26 Darin Adler <darin@apple.com>
+
+ - quick follow on to that last check-in
+
+ * API/JSCallbackObject.cpp: (KJS::JSCallbackObject::JSCallbackObject):
+ Need to initialize m_class to 0.
+
+2007-08-26 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Darin Adler.
+
+ <rdar://problem/4949002> JSGlobalContextCreate can cause crashes because it passes a NULL JSContextRef to the globalObjectClass's initialize callback
+
+ JSCallbackObject now tracks whether it was constructed with a null ExecState. This will happen when the object is being used as the global object,
+ as the Interpreter needs to be created after the global object. In this situation the initialization is deferred until after the Interpreter's
+ ExecState is available to be passed down to the initialize callbacks.
+
+ * API/JSCallbackObject.cpp:
+ (KJS::JSCallbackObject::init): Track whether we successfully initialized.
+ (KJS::JSCallbackObject::initializeIfNeeded): Attempt to initialize with the new ExecState.
+ * API/JSCallbackObject.h:
+ * API/JSContextRef.cpp:
+ (JSGlobalContextCreate): Initialize the JSCallbackObject with the Interpreter's ExecState.
+ * API/testapi.c:
+ (testInitializeOfGlobalObjectClassHasNonNullContext):
+ (main): Verify that the context passed to the initialize callback is non-null.
+
+2007-08-26 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Darin Adler.
+
+ <rdar://problem/5438496> JSGlobalContextCreate crashes when passed a custom class
+
+ * API/JSContextRef.cpp:
+ (JSGlobalContextCreate): Specify jsNull() as the prototype and let Interpreter's constructor fix it up to point at builtinObjectPrototype().
+ * API/testapi.c:
+ (main): Use an instance of a custom class as the global object to ensure the code path is exercised in the test.
+
+2007-08-26 Mike Hommey <glandium@debian.org>
+
+ Reviewed by Mark Rowe and David Kilzer.
+
+ Fix build failure on arm.
+
+ * wtf/Platform.h: Also test if __arm__ is defined.
+
+2007-08-25 Peter Kasting <pkasting@google.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Part 3 of http://bugs.webkit.org/show_bug.cgi?id=14967
+ Bug 14967: Reduce wtf::Vector::operator[]() overloads
+
+ * wtf/Vector.h:
+ (WTF::Vector::operator[]): Only provide versions of operator[] that takes a size_t argument.
+
+2007-08-25 Peter Kasting <pkasting@google.com>
+
+ Reviewed by Sam Weinig.
+
+ Part 2 of http://bugs.webkit.org/show_bug.cgi?id=14967.
+ Eliminate all remaining implicit conversions of wtf::Vector<T> to T*. Where code was
+ previously checking that the Vector's data pointer was non-NULL, check !Vector::isEmpty()
+ instead.
+
+ * wtf/Vector.h:
+ (WTF::Vector::data):
+
+2007-08-16 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Geoff and Adam.
+
+ - Changing stack depth to 500 (from 100 on mac and win) to help out some apps specifically gmail. <rdar://problem/3590522> JavaScript call stack limit of 99 is too small for some applications; needs to be closer to 500 (4045)
+
+ * kjs/object.cpp:
+
+2007-08-15 Peter Kasting <pkasting@google.com>
+
+ Reviewed by Darin.
+
+ http://bugs.webkit.org/show_bug.cgi?id=14967 part 1 - Eliminate most implicit
+ conversions of wtf::Vector<T> to T* by explicitly calling .data()
+
+ * API/JSCallbackConstructor.cpp:
+ (KJS::JSCallbackConstructor::construct):
+ * API/JSCallbackFunction.cpp:
+ (KJS::JSCallbackFunction::callAsFunction):
+ * API/JSCallbackObject.cpp:
+ (KJS::JSCallbackObject::construct):
+ (KJS::JSCallbackObject::callAsFunction):
+ * bindings/c/c_instance.cpp:
+ (KJS::Bindings::CInstance::invokeMethod):
+ (KJS::Bindings::CInstance::invokeDefaultMethod):
+ * kjs/number_object.cpp:
+ (integer_part_noexp):
+ (char_sequence):
+ * kjs/ustring.cpp:
+ (KJS::UString::UTF8String):
+
+2007-08-14 Darin Adler <darin@apple.com>
+
+ Reviewed by Sam.
+
+ - fix <rdar://problem/5410570> Global initializer introduced by use of std::numeric_limits in r24919
+
+ * kjs/ustring.cpp:
+ (KJS::overflowIndicator): Turned into a function.
+ (KJS::maxUChars): Ditto.
+ (KJS::allocChars): Use the functions.
+ (KJS::reallocChars): Ditto.
+ (KJS::UString::expandedSize): Ditto.
+
+2007-08-12 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=14931
+ <rdar://problem/5403816> JavaScript regular expression non-participating capturing parentheses
+ fail in 3 different ways
+
+ Test: fast/js/regexp-non-capturing-groups.html
+
+ * kjs/string_object.cpp:
+ (KJS::replace): Add missing code to handle undefined backreferences; before we'd get the empty string
+ instead of a JavaScript "undefined" value.
+ (KJS::StringProtoFunc::callAsFunction): Implemented backreference support for split.
+ * pcre/pcre_exec.c: (match): Made backreferences to undefined groups match the empty string instead
+ of always failing. Only in JAVASCRIPT mode.
+
+ * tests/mozilla/expected.html: Add a new expected test success, since this fixed one test result.
+
+2007-08-10 Timothy Hatcher <timothy@apple.com>
+
+ Reviewed by Adam.
+
+ <rdar://problem/5394449> Stop using some Carbon UI APIs for 64 bit
+
+ Disable the NPAPI for 64-bit on Mac OS X.
+
+ * Configurations/JavaScriptCore.xcconfig: Use the 64-bit export file.
+ * JavaScriptCore.xcodeproj/project.pbxproj: Create a 64-bit export file
+ that filters out the NPN fnctions.
+ * bindings/NP_jsobject.cpp: #ifdef out this for 64-bit on Mac OS X
+ * bindings/NP_jsobject.h: Ditto.
+ * bindings/c/c_class.cpp: Ditto.
+ * bindings/c/c_class.h: Ditto.
+ * bindings/c/c_instance.cpp: Ditto.
+ * bindings/c/c_instance.h: Ditto.
+ * bindings/c/c_runtime.cpp: Ditto.
+ * bindings/c/c_runtime.h: Ditto.
+ * bindings/c/c_utility.cpp: Ditto.
+ * bindings/c/c_utility.h: Ditto.
+ * bindings/npapi.h: Ditto.
+ * bindings/npruntime.cpp: Ditto.
+ * bindings/npruntime.h: Ditto.
+ * bindings/npruntime_impl.h: Ditto.
+ * bindings/npruntime_priv.h: Ditto.
+ * bindings/runtime.cpp:
+ (KJS::Bindings::Instance::createBindingForLanguageInstance):
+ don't creat an NPObject on Mac OS X in 64-bit.
+
+2007-08-09 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Antti.
+
+ <rdar://problem/5400709> Versioning in debug and release builds should include minor and tiny version before +
+
+ * Configurations/Version.xcconfig:
+ * JavaScriptCore.xcodeproj/project.pbxproj: Add a shell script phase to make to dependency between
+ Version.xcconfig and Info.plist explicit to Xcode.
+
+2007-08-08 George Staikos <staikos@kde.org>
+
+ Make it compile with Qt again.
+
+ * wtf/unicode/qt4/UnicodeQt4.h:
+ (WTF::Unicode::toUpper):
+
+2007-08-07 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Oliver.
+
+ Fix for http://bugs.webkit.org/show_bug.cgi?id=14897
+ Decompilation of double negation fails and produces invalid or incorrect code
+
+ Test: fast/js/function-decompilation-operators.html
+
+ * kjs/nodes2string.cpp:
+ (UnaryPlusNode::streamTo): Put space after unary operator. Matches Firefox.
+ (NegateNode::streamTo): Diito.
+ (MultNode::streamTo): Put spaces around binary operator. Matches Firefox.
+ (AddNode::streamTo): Ditto.
+
+2007-08-07 Darin Adler <darin@apple.com>
+
+ Reviewed by Adele.
+
+ - fix <rdar://problem/5383104> REGRESSION: XHR.responseText is null instead of empty string
+ in http/tests/xmlhttprequest/zero-length-response.html
+
+ The new code to handle out of memory conditions was turning a "" into a null string.
+
+ * kjs/ustring.h: Removed UCharReference, which has long been obsolete and unused.
+ Removed copyForWriting, which was only used for the upper/lowercasing code and for
+ UCharReference.
+ * kjs/ustring.cpp:
+ (KJS::allocChars): Removed special case that made this fail (return 0) when passed 0.
+ Instead assert that we're not passed 0. Also added an overflow check for two reasons:
+ 1) for sizes that aren't checked this prevents us from allocating a buffer that's too
+ small, and 2) for sizes where we overflowed in the expandedSize function and returned
+ overflowIndicator, it guarantees we fail.
+ (KJS::reallocChars): Ditto.
+ (KJS::UString::expandedSize): Return a large number, overflowIndicator, rather than 0
+ for cases where we overflow.
+ (KJS::UString::spliceSubstringsWithSeparators): Added a special case for empty string so
+ we don't call allocChars with a length of 0.
+ (KJS::UString::operator=): Added special characters for both 0 and empty string so we
+ match the behavior of the constructor. This avoids calling allocChars with a length of 0
+ and making a null string rather than an empty string in that case, and also matches the
+ pattern used in the rest of the functions.
+ (KJS::UString::operator[]): Made the return value const so code that tries to use the
+ operator to modify the string will fail.
+
+ * kjs/string_object.cpp: (KJS::StringProtoFunc::callAsFunction): Rewrote uppercasing and
+ lowercasing functions so they don't need copyForWriting any more -- it wasn't really doing
+ any good for optimization purposes. Instead use a Vector and releaseBuffer.
+
+ * wtf/unicode/icu/UnicodeIcu.h: Eliminate one of the versions of toLower/toUpper -- we now
+ only need the version where both a source and destination buffer is passed in, not the one
+ that works in place.
+ * wtf/unicode/qt4/UnicodeQt4.h: Ditto.
+
+2007-08-06 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Oliver.
+
+ Fix for http://bugs.webkit.org/show_bug.cgi?id=14891
+ Decompilation of try block immediately following "else" fails
+
+ Test: fast/js/toString-try-else.html
+
+ * kjs/nodes2string.cpp:
+ (TryNode::streamTo): Add newline before "try".
+
+2007-08-07 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Maciej.
+
+ <rdar://problem/5388774> REGRESSION: Hang occurs after clicking "Attach a file " link in a new .Mac message
+
+ Attempting to acquire the JSLock inside CollectorHeap::forceLock can lead to a deadlock if the thread currently
+ holding the lock is waiting on the thread that is forking. It is not considered safe to use system frameworks
+ after a fork without first execing[*] so it is not particularly important to ensure that the collector and
+ fastMalloc allocators are unlocked in the child process. If the child process wishes to use JavaScriptCore it
+ should exec after forking like it would to use any other system framework.
+ [*]: <http://lists.apple.com/archives/Cocoa-dev/2005/Jan/msg00676.html>
+
+ * kjs/CollectorHeapIntrospector.cpp: Remove forceLock and forceUnlock implementations.
+ * kjs/CollectorHeapIntrospector.h: Stub out forceLock and forceUnlock methods.
+ * wtf/FastMalloc.cpp: Ditto.
+
+2007-08-06 Darin Adler <darin@apple.com>
+
+ Rubber stamped by Geoff.
+
+ * kjs/ustring.h: Added an assertion which would have helped us find the
+ previous bug more easily.
+
+2007-08-06 Darin Adler <darin@apple.com>
+
+ Reviewed by Anders.
+
+ - fix <rdar://problem/5387589> 9A514: Quartz Composer crash on launch in KJS::jsString
+
+ * API/JSBase.cpp:
+ (JSEvaluateScript): Turn NULL for sourceURL into UString::null(), just as JSObjectMakeFunction already does.
+ (JSCheckScriptSyntax): Ditto.
+
+2007-08-06 Matt Lilek <pewtermoose@gmail.com>
+
+ Not reviewed, build fix.
+
+ * kjs/string_object.cpp:
+ (KJS::StringProtoFunc::callAsFunction):
+
+2007-08-04 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - fix <rdar://problem/5371862> crash in Dashcode due to Quartz Composer JavaScript garbage collector reentrancy
+
+ * API/JSBase.cpp: (JSGarbageCollect): Don't call collector() if isBusy() returns true.
+
+ * kjs/collector.h: Added isBusy(), removed the unused return value from collect()
+ * kjs/collector.cpp: Added an "operation in progress" flag to the allocator.
+ (KJS::Collector::allocate): Call abort() if an operation is already in progress. Set the new flag instead
+ of using the debug-only GCLock.
+ (KJS::Collector::collect): Ditto.
+ (KJS::Collector::isBusy): Added.
+
+2007-08-04 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin and Adam.
+
+ <rdar://problem/5368990> REGRESSION: newsgator.com sign-on 6x slower than Safari 3 beta due to GC changes (14808)
+
+ * kjs/string_object.cpp:
+ (KJS::replace): if the string didn't change (very common in some cases) reuse the original string value.
+ (KJS::StringProtoFunc::callAsFunction): Pass in the StringImp* when replacing, not just the UString.
+ * kjs/string_object.h:
+ (KJS::StringInstance::internalValue): covariant override to return StringImp for convenience
+
+2007-08-04 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ <rdar://problem/5385145> r24843 introduces a crash on calling fork() (14878)
+ http://bugs.webkit.org/show_bug.cgi?id=14878
+
+ Provide no-op functions for all members of the malloc_zone_t and malloc_introspection_t structures that we
+ register to avoid crashes in system code that assumes they will be non-null.
+
+ * kjs/CollectorHeapIntrospector.cpp:
+ (KJS::CollectorHeapIntrospector::CollectorHeapIntrospector):
+ (KJS::CollectorHeapIntrospector::forceLock): Grab the lock.
+ (KJS::CollectorHeapIntrospector::forceUnlock): Release the lock.
+ * kjs/CollectorHeapIntrospector.h:
+ (KJS::CollectorHeapIntrospector::goodSize):
+ (KJS::CollectorHeapIntrospector::check):
+ (KJS::CollectorHeapIntrospector::print):
+ (KJS::CollectorHeapIntrospector::log):
+ (KJS::CollectorHeapIntrospector::statistics):
+ (KJS::CollectorHeapIntrospector::size):
+ (KJS::CollectorHeapIntrospector::zoneMalloc):
+ (KJS::CollectorHeapIntrospector::zoneCalloc):
+ (KJS::CollectorHeapIntrospector::zoneFree):
+ * wtf/FastMalloc.cpp:
+ (WTF::FastMallocZone::goodSize):
+ (WTF::FastMallocZone::check):
+ (WTF::FastMallocZone::print):
+ (WTF::FastMallocZone::log):
+ (WTF::FastMallocZone::forceLock): Grab the TCMalloc locks.
+ (WTF::FastMallocZone::forceUnlock): Release the TCMalloc locks.
+ (WTF::FastMallocZone::FastMallocZone):
+
+2007-08-04 Mark Rowe <mrowe@apple.com>
+
+ Rubber-stamped by Anders.
+
+ * pcre/pcre_compile.c: Remove non-ASCII character from a comment.
+
+2007-08-02 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ <rdar://problem/4212199> 'leaks' reports false leaks in WebKit (because the WTF allocator uses mmap?)
+
+ Implement malloc zone introspection routines to allow leaks, heap, and friends to request information
+ about specific memory regions that were allocated by FastMalloc or the JavaScriptCore collector.
+
+ This requires tool-side support before the regions will be displayed. The addition of that support is
+ tracked by <rdar://problems/5353057&5353060>.
+
+ * JavaScriptCore.exp: Export the two variables that are used by leaks to introspect the allocators.
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * kjs/AllInOneFile.cpp:
+ * kjs/CollectorHeapIntrospector.cpp: Added.
+ (KJS::):
+ (KJS::CollectorHeapIntrospector::init):
+ (KJS::CollectorHeapIntrospector::CollectorHeapIntrospector): Create and register our zone with the system.
+ (KJS::CollectorHeapIntrospector::enumerate): Iterate over the CollectorBlocks that are in use and report them to the caller as being used.
+ * kjs/CollectorHeapIntrospector.h: Added.
+ (KJS::CollectorHeapIntrospector::size): Return zero to indicate the specified pointer does not belong to this zone.
+ * kjs/collector.cpp:
+ (KJS::Collector::registerThread): Register the CollectorHeapIntrospector with the system when the first thread is registered with the collector.
+ * wtf/FastMalloc.cpp:
+ (WTF::TCMalloc_PageHeap::GetDescriptorEnsureSafe):
+ (WTF::TCMalloc_ThreadCache_FreeList::enumerateFreeObjects): Enumerate the objects on the free list.
+ (WTF::TCMalloc_ThreadCache::enumerateFreeObjects): Ditto.
+ (WTF::TCMalloc_Central_FreeList::enumerateFreeObjects): Ditto.
+ (WTF::TCMalloc_ThreadCache::InitModule): Register the FastMallocZone with the system when initializing TCMalloc.
+ (WTF::FreeObjectFinder::FreeObjectFinder):
+ (WTF::FreeObjectFinder::visit): Add an object to the free list.
+ (WTF::FreeObjectFinder::isFreeObject):
+ (WTF::FreeObjectFinder::freeObjectCount):
+ (WTF::FreeObjectFinder::findFreeObjects): Find the free objects within a thread cache or free list.
+ (WTF::PageMapFreeObjectFinder::PageMapFreeObjectFinder): Find the free objects within a TC_PageMap.
+ (WTF::PageMapFreeObjectFinder::visit): Called once per allocated span. Record whether the span or any subobjects are free.
+ (WTF::PageMapMemoryUsageRecorder::PageMapMemoryUsageRecorder):
+ (WTF::PageMapMemoryUsageRecorder::visit): Called once per allocated span. Report the range of memory as being allocated, and the span or
+ its subobjects as being used if they do not appear on the free list.
+ (WTF::FastMallocZone::enumerate): Map the key remote TCMalloc data structures into our address space. We then locate all free memory ranges
+ before reporting the other ranges as being in use.
+ (WTF::FastMallocZone::size): Determine whether the given pointer originates from within our allocation zone. If so,
+ we return its allocation size.
+ (WTF::FastMallocZone::zoneMalloc):
+ (WTF::FastMallocZone::zoneCalloc):
+ (WTF::FastMallocZone::zoneFree):
+ (WTF::FastMallocZone::zoneRealloc):
+ (WTF::):
+ (WTF::FastMallocZone::FastMallocZone): Create and register our zone with the system.
+ (WTF::FastMallocZone::init):
+ * wtf/MallocZoneSupport.h: Added.
+ (WTF::RemoteMemoryReader::RemoteMemoryReader): A helper class to ease the process of mapping memory in a different process into
+ our local address space
+ (WTF::RemoteMemoryReader::operator()):
+ * wtf/TCPageMap.h:
+ (TCMalloc_PageMap2::visit): Walk over the heap and visit each allocated span.
+ (TCMalloc_PageMap3::visit): Ditto.
+
+2007-08-02 Mark Rowe <mrowe@apple.com>
+
+ Build fix.
+
+ * kjs/ustring.cpp:
+ (KJS::UString::expandedSize): Use std::numeric_limits<size_t>::max() rather than the non-portable SIZE_T_MAX.
+
+2007-08-02 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Maciej.
+
+ <rdar://problem/5352887> "Out of memory" error during repeated JS string concatenation leaks hundreds of MBs of RAM
+
+ A call to fastRealloc was failing which lead to UString::expandCapacity leaking the buffer it was trying to reallocate.
+ It also resulted in the underlying UString::rep having both a null baseString and buf field, which meant that attempting
+ to access the contents of the string after the failed memory reallocation would crash.
+
+ A third issue is that expandedSize size was calculating the new length in a way that led to an integer overflow occurring.
+ Attempting to allocate a string more than 190,000,000 characters long would fail a the integer overflow would lead to a
+ memory allocation of around 3.6GB being attempted rather than the expected 390MB. Sizes that would lead to an overflow
+ are now returned as zero and callers are updated to treat this as though the memory allocation has failed.
+
+ * kjs/array_object.cpp:
+ (ArrayProtoFunc::callAsFunction): Check whether the append failed and raise an "Out of memory" exception if it did.
+ * kjs/ustring.cpp:
+ (KJS::allocChars): Wrapper around fastMalloc that takes a length in characters. It will return 0 when asked to allocate a zero-length buffer.
+ (KJS::reallocChars): Wrapper around fastRealloc that takes a length in characters. It will return 0 when asked to allocate a zero-length buffer.
+ (KJS::UString::expandedSize): Split the size calculation in two and guard against overflow during each step.
+ (KJS::UString::expandCapacity): Don't leak r->buf if reallocation fails. Instead free the memory and use the null representation.
+ (KJS::UString::expandPreCapacity): If fastMalloc fails then use the null representation rather than crashing in memcpy.
+ (KJS::UString::UString): If calls to expandCapacity, expandPreCapacity or fastMalloc fail then use the null representation rather than crashing in memcpy.
+ (KJS::UString::append): Ditto.
+ (KJS::UString::operator=): Ditto.
+ * kjs/ustring.h: Change return type of expandedSize from int to size_t.
+
+2007-08-01 Darin Adler <darin@apple.com>
+
+ Reviewed by Kevin McCullough.
+
+ - fix <rdar://problem/5375186> pointers to pieces of class definition passed to JSClassCreate should all be const
+
+ * API/JSObjectRef.h: Added const.
+
+ * API/JSClassRef.cpp:
+ (OpaqueJSClass::OpaqueJSClass): Added const.
+ (OpaqueJSClass::create): Added const.
+ * API/JSObjectRef.cpp:
+ (JSClassCreate): Added const.
+
+2007-08-01 Steve Falkenburg <sfalken@apple.com>
+
+ Build mod: Fix sln to match configs in vcproj.
+
+ Reviewed by Adam.
+
+ * JavaScriptCore.vcproj/JavaScriptCore.make:
+ * JavaScriptCore.vcproj/JavaScriptCore.sln:
+
+2007-07-30 Simon Hausmann <hausmann@kde.org>
+
+ Done with and reviewed by Lars.
+
+ Removed the __BUILDING_QT ifdef in JSStringRef.h and changed UChar for the Qt build to use wchar_t on Windows.
+
+ * API/JSStringRef.h:
+ * wtf/unicode/qt4/UnicodeQt4.h:
+
+2007-07-27 Simon Hausmann <hausmann@kde.org>
+
+ Done with and reviewed by Lars and Zack.
+
+ Always define JSChar to be unsigned short for the Qt builds, to ensure compatibility with UChar.
+
+ * API/JSStringRef.h:
+
+2007-07-27 Simon Hausmann <hausmann@kde.org>
+
+ Done with and reviewed by Lars and Zack.
+
+ Fix compilation with Qt on Windows with MingW: Implemented currentThreadStackBase() for this platform.
+
+ * kjs/collector.cpp:
+ (KJS::currentThreadStackBase):
+
+2007-07-27 Simon Hausmann <hausmann@kde.org>
+
+ Done with and reviewed by Lars and Zack.
+
+ Fix compilation with Qt on Windows with MingW: The MingW headers do not provide a prototype for a reentrant version of localtime. But since we don't use multiple threads for the Qt build we can use the plain localtime() function.
+
+ * kjs/DateMath.cpp:
+ (KJS::getDSTOffsetSimple):
+
+2007-07-27 Simon Hausmann <hausmann@kde.org>
+
+ Done with and reviewed by Lars and Zack.
+
+ Use $(MOVE) instead of mv to eliminated the shell dependency and replaced the long shell line to call bison and modify the css grammar file with a few lines of portable perl code.
+
+ * JavaScriptCore.pri:
+
+2007-07-27 Simon Hausmann <hausmann@kde.org>
+
+ Done with and reviewed by Lars and Zack.
+
+ Implemented currentTime() in the interpreter by using QDateTime, so that we don't need timeGetTime() on Windows and therefore also don't need to link against Winmm.dll.
+
+ * kjs/interpreter.cpp:
+ (KJS::getCurrentTime):
+ * kjs/testkjs.cpp:
+ (StopWatch::start):
+ (StopWatch::stop):
+
+2007-07-27 Simon Hausmann <hausmann@kde.org>
+
+ Done with and reviewed by Lars and Zack.
+
+ Replace the use of snprintf with QByteArray to compile under msvc 2005 express.
+
+ * bindings/qt/qt_instance.cpp:
+ (KJS::Bindings::QtInstance::stringValue):
+
+2007-07-27 Simon Hausmann <hausmann@kde.org>
+
+ Done with and reviewed by Lars and Zack.
+
+ Don't use pthread.h unless thread support is enabled.
+
+ * kjs/collector.cpp:
+ (KJS::Collector::registerAsMainThread):
+ (KJS::onMainThread):
+
+2007-07-27 Simon Hausmann <hausmann@kde.org>
+
+ Done with and reviewed by Lars and Zack.
+
+ Removed TCSystemMalloc from the Qt build, it's not necessary it seems.
+
+ * JavaScriptCore.pri:
+
+2007-07-27 Simon Hausmann <hausmann@kde.org>
+
+ Done with and reviewed by Lars and Zack.
+
+ Added os-win32 to the include search path for the Qt windows build in order to provide the fake stdint.h header file.
+
+ * JavaScriptCore.pri:
+
+2007-07-25 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Mark.
+
+ - follow-up to previous change
+
+ * kjs/ustring.cpp:
+ (KJS::UString::operator=): Make sure to reset the length when
+ replacing the buffer contents for a single-owned string.
+
+2007-07-25 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin.
+
+ - JavaScriptCore part of fix for <rdar://problem/5300291> Optimize GC to reclaim big, temporary objects (like XMLHttpRequest.responseXML) quickly
+
+ Also, as a side effect of optimizations included in this patch:
+ - 7% speedup on JavaScript iBench
+ - 4% speedup on "Celtic Kane" JS benchmark
+
+ The basic idea is explained in a big comment in collector.cpp. When unusually
+ large objecs are allocated, we push the next GC closer on the assumption that
+ most objects are short-lived.
+
+ I also did the following two optimizations in the course of tuning
+ this not to be a performance regression:
+
+ 1) Change UString::Rep to hold a self-pointer as the baseString in
+ the unshared case, instead of a null pointer; this removes a
+ number of null checks in hot code because many places already
+ wanted to use the rep itself or the baseString as appropriate.
+
+ 2) Avoid creating duplicate StringImpls when creating a
+ StringInstance (the object wrapper for a JS string) or calling
+ their methods. Since a temporary wrapper object is made every time
+ a string method is called, this resulted in two useless extra
+ StringImpls being allocated for no reason whenever a String method
+ was invoked on a string value. Now we bypass those.
+
+ * kjs/collector.cpp:
+ (KJS::):
+ (KJS::Collector::recordExtraCost): Basics of the extra cost mechanism.
+ (KJS::Collector::allocate): ditto
+ (KJS::Collector::collect): ditto
+ * kjs/collector.h:
+ (KJS::Collector::reportExtraMemoryCost): ditto
+ * kjs/array_object.cpp:
+ (ArrayInstance::ArrayInstance): record extra cost
+ * kjs/internal.cpp:
+ (KJS::StringImp::toObject): don't create a whole new StringImpl just
+ to be the internal value of a StringInstance! StringImpls are immutable
+ so there's no point tot his.
+ * kjs/internal.h:
+ (KJS::StringImp::StringImp): report extra cost
+ * kjs/string_object.cpp:
+ (KJS::StringInstance::StringInstance): new version that takes a StringImp
+ (KJS::StringProtoFunc::callAsFunction): don't create a whole new StringImpl
+ just to convert self to string! we already have one in the internal value
+ * kjs/string_object.h: report extra cost
+ * kjs/ustring.cpp: All changes to handle baseString being self instead of null in the
+ unshared case.
+ (KJS::):
+ (KJS::UString::Rep::create):
+ (KJS::UString::Rep::destroy):
+ (KJS::UString::usedCapacity):
+ (KJS::UString::usedPreCapacity):
+ (KJS::UString::expandCapacity):
+ (KJS::UString::expandPreCapacity):
+ (KJS::UString::UString):
+ (KJS::UString::append):
+ (KJS::UString::operator=):
+ (KJS::UString::copyForWriting):
+ * kjs/ustring.h:
+ (KJS::UString::Rep::baseIsSelf): new method, now that baseString is
+ self instead of null in the unshared case we can't just null check.
+ (KJS::UString::Rep::data): adjusted as mentioned above
+ (KJS::UString::cost): new method to compute the cost for a UString, for
+ use by StringImpl.
+
+ * kjs/value.cpp:
+ (KJS::jsString): style fixups.
+ (KJS::jsOwnedString): new method, use this for strings allocated from UStrings
+ held by the parse tree. Tracking their cost as part of string cost is pointless,
+ because garbage collecting them will not actually free the relevant string buffer.
+ * kjs/value.h: prototyped jsOwnedString.
+ * kjs/nodes.cpp:
+ (StringNode::evaluate): use jsOwnedString as appropriate
+ (RegExpNode::evaluate): ditto
+ (PropertyNameNode::evaluate): ditto
+ (ForInNode::execute): ditto
+
+ * JavaScriptCore.exp: Exported some new symbols.
+
+2007-07-23 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Geoff.
+
+ <rdar://problem/5121461> REGRESSION: Unable to load JigZone puzzle
+
+ * bindings/jni/jni_jsobject.cpp:
+ (JavaJSObject::createNative):
+
+ Call RootObject::gcProtect on the global object, thereby putting it in the
+ "protect count" set which is used for checking if a native handle is valid.
+
+2007-07-23 Darin Adler <darin@apple.com>
+
+ * pcre/pcre_compile.c: Roll back a tiny accidental change in the unused !JAVASCRIPT
+ side of an #ifdef. This has no effect when using PCRE in JAVASCRIPT mode as we do,
+ but seems worth rolling back.
+
+2007-07-23 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver.
+
+ - fix remaining problems with Window shadowing
+
+ * kjs/nodes.cpp:
+ (VarDeclNode::evaluate): Tweak the special case a little.
+
+2007-07-23 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver.
+
+ - fix Window shadowing regressions caused by the previous commit.
+
+ * kjs/nodes.cpp:
+ (VarDeclNode::evaluate): Handle the case of global scope specially.
+
+2007-07-22 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin.
+
+ -fixed <rdar://problem/5353293> REGRESSION (r24287): 1% i-Bench JS slowdown from JavaScript compatibility fix (14719)
+ http://bugs.webkit.org/show_bug.cgi?id=14719
+
+ My fix for this actually resulted in JS iBench being 1% faster than before the regression
+ and the Celtic Kane benchmark being 5% faster than before the regression.
+
+ * kjs/nodes.cpp:
+ (VarDeclNode::handleSlowCase): factored out the slow code path to be out of line.
+ (VarDeclNode::evaluate): I did a couple of things:
+ (1) Don't check if the variable is already declared by looking for the property in
+ the variable object, that code path was dead code.
+ (2) Special-case the common case where the top of the scope and the variable object
+ are the same; in that case the variable must always be in the variable object.
+ (3) Don't return a jsString() of the variable name, nothing uses the return value
+ from this node types evaluate method.
+ * kjs/nodes.h:
+
+2007-07-22 Darin Adler <darin@apple.com>
+
+ Reviewed by Kevin Decker.
+
+ - fix <rdar://problem/5126394> REGRESSION: Crash after clicking back button in test application (13250)
+ http://bugs.webkit.org/show_bug.cgi?id=13250
+
+ * bindings/objc/objc_utility.mm: (KJS::Bindings::convertObjcValueToValue):
+ If the object returns 0 for _imp, convert that to "undefined", since callers
+ can't cope with a JSValue of 0.
+
+2007-07-19 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Fixed http://bugs.webkit.org/show_bug.cgi?id=10880 | <rdar://problem/5335694>
+ REGRESSION: JavaScript menu doesn't appear on pricepoint.com (14595)
+
+ Though the ECMA spec says auto-semicolon insertion should not occur
+ without a newline or '}', Firefox treats do-while specially, and the
+ library used by pricepoint.com requires that special treatment.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * kjs/grammar.y:
+
+2007-07-19 Darin Adler <darin@apple.com>
+
+ Reviewed by Geoff.
+
+ - fix <rdar://problem/5345440> PCRE computes wrong length for expressions with quantifiers
+ on named recursion or subexpressions
+
+ It's challenging to implement proper preflighting for compiling these advanced features.
+ But we don't want them in the JavaScript engine anyway.
+
+ Turned off the following features of PCRE (some of these are simply parsed and not implemented):
+
+ \C \E \G \L \N \P \Q \U \X \Z
+ \e \l \p \u \z
+ [::] [..] [==]
+ (?#) (?<=) (?<!) (?>)
+ (?C) (?P) (?R)
+ (?0) (and 1-9)
+ (?imsxUX)
+
+ Added the following:
+
+ \u \v
+
+ Because of \v, the js1_2/regexp/special_characters.js test now passes.
+
+ To be conservative, I left some features that JavaScript doesn't want, such as
+ \012 and \x{2013}, in place. We can revisit these later; they're not directly-enough
+ related to avoiding the incorrect preflighting.
+
+ I also didn't try to remove unused opcodes and remove code from the execution engine.
+ That could save code size and speed things up a bit, but it would require more changes.
+
+ * kjs/regexp.h:
+ * kjs/regexp.cpp: (KJS::RegExp::RegExp): Remove the sanitizePattern workaround for
+ lack of \u support, since the PCRE code now has \u support.
+
+ * pcre/pcre-config.h: Set JAVASCRIPT to 1.
+ * pcre/pcre_internal.h: Added ESC_v.
+
+ * pcre/pcre_compile.c: Added a different escape table for when JAVASCRIPT is set that
+ omits all the escapes we don't want interpreted and includes '\v'.
+ (check_escape): Put !JAVASCRIPT around the code for '\l', '\L', '\N', '\u', and '\U',
+ and added code to handle '\u2013' inside JAVASCRIPT.
+ (compile_branch): Put !JAVASCRIPT if around all the code implementing the features we
+ don't want.
+ (pcre_compile2): Ditto.
+
+ * tests/mozilla/expected.html: Updated since js1_2/regexp/special_characters.js now
+ passes.
+
+2007-07-18 Darin Adler <darin@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ - fix <rdar://problem/5345432> PCRE computes length wrong for expressions such as "[**]"
+
+ Test: fast/js/regexp-charclass-crash.html
+
+ * pcre/pcre_compile.c: (pcre_compile2): Fix the preflight code that calls
+ check_posix_syntax to match the actual regular expression compilation code;
+ before it was missing the check of the first character.
+
+2007-07-19 Holger Hans Peter Freyther <zecke@selfish.org>
+
+ Reviewed by Mark.
+
+ Define __BUILDING_GDK when building for Gdk to fix building testkjs on OSX.
+
+ * JavaScriptCore.pri:
+
+2007-07-18 Simon Hausmann <hausmann@kde.org>
+
+ * Fix the Qt build, call dftables from the right directory.
+
+ Reviewed by Adam Treat.
+
+ * pcre/pcre.pri:
+
+2007-07-18 Simon Hausmann <hausmann@kde.org>
+
+ Reviewed by Zack.
+
+ Don't call gcc directly when building the dftables tool but use a separate .pro file for the Qt build.
+
+ * pcre/dftables.pro: Added.
+ * pcre/pcre.pri:
+
+2007-07-17 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Darin, Maciej, and Adam.
+
+ Fixes <http://bugs.webkit.org/show_bug.cgi?id=9697>,
+ the failure of ecma/GlobalObject/15.1.2.2-2.js,
+ the failure of ecma/LexicalConventions/7.7.3-1.js,
+ and most of the failures of tests in ecma/TypeConversion/9.3.1-3.js.
+
+ Bug 9697: parseInt results may be inaccurate for numbers greater than 2^53
+
+ This patch also fixes similar issues in the lexer and UString::toDouble().
+
+ * kjs/function.cpp:
+ (KJS::parseIntOverflow):
+ (KJS::parseInt):
+ * kjs/function.h:
+ * kjs/lexer.cpp:
+ (KJS::Lexer::lex):
+ * kjs/ustring.cpp:
+ (KJS::UString::toDouble):
+ * tests/mozilla/expected.html:
+
+2007-07-16 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Oliver.
+
+ Turn off -Wshorten-64-to-32 warning for 64-bit builds.
+
+ * Configurations/Base.xcconfig:
+
+2007-07-14 Brady Eidson <beidson@apple.com>
+
+ Reviewed by Sam Weinig
+
+ Initial check-in for <rdar://problem/3154486> - Supporting FTP directory listings in the browser
+
+ * wtf/Platform.h: Add ENABLE_FTPDIR feature to handle building on platforms that don't have the
+ proper network-layer support
+
+2007-07-14 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Darin.
+
+ Fixes http://bugs.webkit.org/show_bug.cgi?id=13517,
+ http://bugs.webkit.org/show_bug.cgi?id=14237, and
+ the failure of test js1_5/Scope/regress-185485.js
+
+ Bug 13517: DOM Exception 8 in finance.aol.com sub-page
+ Bug 14237: Javascript "var" statement interprets initialization in the topmost function scope
+
+ * kjs/nodes.cpp:
+ (VarDeclNode::evaluate):
+ * tests/mozilla/expected.html:
+
+2007-07-12 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Mitz.
+
+ http://bugs.webkit.org/show_bug.cgi?id=14596
+ Fix JSC compilation with KJS_VERBOSE.
+
+ * kjs/function.cpp:
+ (KJS::FunctionImp::passInParameters):
+
+2007-07-11 George Staikos <staikos@kde.org>
+
+ Make it compile.
+
+ * ForwardingHeaders: Added.
+ * ForwardingHeaders/JavaScriptCore: Added.
+ * ForwardingHeaders/JavaScriptCore/APICast.h: Added.
+ * ForwardingHeaders/JavaScriptCore/JSBase.h: Added.
+ * ForwardingHeaders/JavaScriptCore/JSContextRef.h: Added.
+ * ForwardingHeaders/JavaScriptCore/JSLock.h: Added.
+ * ForwardingHeaders/JavaScriptCore/JSObjectRef.h: Added.
+ * ForwardingHeaders/JavaScriptCore/JSStringRef.h: Added.
+ * ForwardingHeaders/JavaScriptCore/JSStringRefCF.h: Added.
+ * ForwardingHeaders/JavaScriptCore/JSValueRef.h: Added.
+ * ForwardingHeaders/JavaScriptCore/JavaScriptCore.h: Added.
+
+2007-07-11 Holger Hans Peter Freyther <zecke@selfish.org>
+
+ Reviewed by Darin.
+
+ As of http://bugs.webkit.org/show_bug.cgi?id=14527 move the
+ WebCore/ForwardingHeader/JavaScriptCore to JavaScriptCore
+
+ * ForwardingHeaders: Added.
+ * ForwardingHeaders/JavaScriptCore: Copied from WebCore/ForwardingHeaders/JavaScriptCore.
+
+2007-07-11 Nikolas Zimmermann <zimmermann@kde.org>
+
+ Reviewed by Mark.
+
+ Forwardport the hash table fix from CodeGeneratorJS.pm to create_hash_table.
+ Reran run-jsc-tests, couldn't find any regressions. Suggested by Darin.
+
+ * kjs/create_hash_table:
+
+2007-07-09 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver.
+
+ - JavaScriptCore part of fix for: <rdar://problem/5295734> Repro crash closing tab/window @ maps.google.com in WTF::HashSet<KJS::RuntimeObjectImp*, WTF::PtrHash<KJS::RuntimeObjectImp*>, WTF::HashTraits<KJS::RuntimeObjectImp*> >::add + 11
+
+ * JavaScriptCore.exp: Added needed export.
+
+2007-07-06 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Antti.
+
+ - <rdar://problem/5311093> JavaScriptCore fails to build with strict-aliasing warnings
+
+ * Configurations/Base.xcconfig: Re-enable -Wstrict-aliasing
+ * bindings/jni/jni_utility.cpp:
+ (KJS::Bindings::getJNIEnv): Type-pun via a union instead of a pointer cast.
+ * wtf/HashMap.h:
+ (WTF::): Instead of doing type-punned assignments via pointer cast, do one of three things:
+ (1) assign directly w/o cast if storage type matches real type; (2) assign using cast
+ via union if type does not need reffing; (3) copy with memcpy and ref/deref manually if type
+ needs reffing. This is ok peref-wise because memcpy of a constant length gets optomized.
+ HashTraits are now expected to make ref()/deref() take the storage type, not the true type.
+ * wtf/HashSet.h:
+ (WTF::): Same basic idea.
+ * wtf/HashTable.h:
+ (WTF::): Added Assigner template for use by HashMap/HashSet. Change RefCounter to call ref()
+ and deref() via storage type, avoiding the need to
+ type-pun.
+ (WTF::RefCounter::ref): ditto
+ (WTF::RefCounter::deref): ditto
+ * wtf/HashTraits.h:
+ (WTF::): Change ref() and deref() for RefPtr HashTraits to take the storage type; cast
+ via union to pointer type.
+ * wtf/FastMalloc.cpp:
+ (WTF::TCMalloc_PageHeap::init): Changed from constructor to init function so this can go in a union.
+ (WTF::): redefine pageheap macro in terms of getPageHeap().
+ (WTF::getPageHeap): new inline function, helper for pageheap macro. This hides the cast in a union.
+ (WTF::TCMalloc_ThreadCache::InitModule): Call init() instead of using placement new to initialize page
+ heap.
+ * wtf/TCPageMap.h:
+ (TCMalloc_PageMap1::init): Changed from constructor to init function.
+ (TCMalloc_PageMap2::init): ditto
+ (TCMalloc_PageMap3::init): ditto
+
+
+2007-07-06 George Staikos <staikos@kde.org>
+
+ Reviewed by Maciej.
+
+ Switch USE(ICONDATABASE) to ENABLE(ICONDATABASE)
+
+ * wtf/Platform.h:
+
+2007-07-03 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Darin.
+
+ Eleventh round of fixes for implicit 64-32 bit conversion errors.
+ <rdar://problem/5292262>
+
+ - Fixes a real bug where where we were setting long long and unsigned long long
+ values to a long field.
+
+ * bindings/objc/objc_utility.mm:
+ (KJS::Bindings::convertValueToObjcValue):
+
+2007-07-03 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Brady Eidson.
+
+ Tenth round of fixes for implicit 64-32 bit conversion errors.
+ <rdar://problem/5292262>
+
+ - Add explicit casts.
+
+ * kjs/dtoa.cpp:
+ (Bigint::):
+
+2007-07-02 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Kevin McCullough.
+
+ Fourth round of fixes for implicit 64-32 bit conversion errors.
+ <rdar://problem/5292262>
+
+ Add custom piDouble and piFloat constants to use instead of M_PI.
+
+ * kjs/math_object.cpp:
+ (MathObjectImp::getValueProperty):
+ * wtf/MathExtras.h:
+ (wtf_atan2):
+
+2007-06-29 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Darin.
+
+ Second pass at fixing implicit 64-32 bit conversion errors.
+ <rdar://problem/5292262>
+
+ - Add a toFloat() method to JSValue for float conversion.
+
+ * JavaScriptCore.exp:
+ * kjs/value.cpp:
+ (KJS::JSValue::toFloat):
+ * kjs/value.h:
+
+2007-06-27 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Darin.
+
+ - <rdar://problem/5271937> REGRESSION: Apparent WebKit JavaScript memory smasher when submitting comment to iWeb site (crashes in kjs_pcre_compile2)
+ - Correctly evaluate the return value of _pcre_ucp_findchar.
+
+ * pcre/pcre_compile.c:
+ (compile_branch):
+ * pcre/pcre_exec.c:
+ (match):
+
+2007-06-27 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Darin.
+
+ First pass at fixing implicit 64-32 bit conversion errors.
+ <rdar://problem/5292262>
+
+ - Add 'f' suffix where necessary.
+
+ * kjs/testkjs.cpp:
+ (StopWatch::getElapsedMS):
+
+2007-06-26 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Fixed <rdar://problem/5296627> JSGarbageCollect headerdoc suggests that
+ using JavaScriptCore requires leaking memory
+
+ * API/JSBase.h: Changed documentation to explain that you can pass NULL
+ to JSGarbageCollect.
+
+2007-06-26 Adam Treat <adam@staikos.net>
+
+ Reviewed by Adam Roben.
+
+ Make the SQLite icon database optional.
+
+ * wtf/Platform.h:
+
+2007-06-15 George Staikos <staikos@kde.org>
+
+ More missing files for Qt.
+
+ * JavaScriptCore.pri:
+ * kjs/testkjs.pro:
+
+2007-06-15 George Staikos <staikos@kde.org>
+
+ Another Qt build fix.
+
+ * JavaScriptCore.pri:
+ * kjs/testkjs.pro:
+
+2007-06-15 George Staikos <staikos@kde.org>
+
+ Fixing Qt build.
+
+ * JavaScriptCore.pri:
+
+2007-06-20 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Mitz.
+
+ Fix http://bugs.webkit.org/show_bug.cgi?id=14244
+ Bug 14244: Data corruption when using a replace() callback function with data containing "$"
+
+ * kjs/string_object.cpp:
+ (KJS::replace): When 'replacement' is a function, do not replace $n placeholders in its return value.
+ This matches the behaviour described in ECMA 262 3rd Ed section 15.5.4.1, and as implemented in Firefox.
+
+2007-06-14 Anders Carlsson <andersca@apple.com>
+
+ Fix Windows build.
+
+ * bindings/runtime_object.cpp:
+ (RuntimeObjectImp::canPut):
+
+2007-06-14 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Darin.
+
+ <rdar://problem/5103077>
+ Crash at _NPN_ReleaseObject when quitting page at http://eshop.macsales.com/shop/ModBook
+
+ <rdar://problem/5183692>
+ http://bugs.webkit.org/show_bug.cgi?id=13547
+ REGRESSION: Crash in _NPN_ReleaseObject when closing Safari on nba.com (13547)
+
+ <rdar://problem/5261499>
+ CrashTracer: [USER] 75 crashes in Safari at com.apple.JavaScriptCore: KJS::Bindings::CInstance::~CInstance + 40
+
+ Have the root object track all live instances of RuntimeObjectImp. When invalidating
+ the root object, also invalidate all live runtime objects by zeroing out their instance ivar.
+ This prevents instances from outliving their plug-ins which lead to crashes.
+
+ * bindings/c/c_utility.cpp:
+ (KJS::Bindings::convertValueToNPVariant):
+ * bindings/jni/jni_jsobject.cpp:
+ (JavaJSObject::convertValueToJObject):
+ * bindings/jni/jni_utility.cpp:
+ (KJS::Bindings::convertValueToJValue):
+ * bindings/objc/objc_runtime.mm:
+ (ObjcFallbackObjectImp::callAsFunction):
+ * bindings/runtime_array.cpp:
+ (RuntimeArray::RuntimeArray):
+ * bindings/runtime_array.h:
+ (KJS::RuntimeArray::getConcreteArray):
+ * bindings/runtime_method.cpp:
+ (RuntimeMethod::callAsFunction):
+ * bindings/runtime_method.h:
+ * bindings/runtime_object.cpp:
+ (RuntimeObjectImp::RuntimeObjectImp):
+ (RuntimeObjectImp::~RuntimeObjectImp):
+ (RuntimeObjectImp::invalidate):
+ (RuntimeObjectImp::fallbackObjectGetter):
+ (RuntimeObjectImp::fieldGetter):
+ (RuntimeObjectImp::methodGetter):
+ (RuntimeObjectImp::getOwnPropertySlot):
+ (RuntimeObjectImp::put):
+ (RuntimeObjectImp::canPut):
+ (RuntimeObjectImp::defaultValue):
+ (RuntimeObjectImp::implementsCall):
+ (RuntimeObjectImp::callAsFunction):
+ (RuntimeObjectImp::getPropertyNames):
+ (RuntimeObjectImp::throwInvalidAccessError):
+ * bindings/runtime_object.h:
+ * bindings/runtime_root.cpp:
+ (KJS::Bindings::RootObject::invalidate):
+ (KJS::Bindings::RootObject::addRuntimeObject):
+ (KJS::Bindings::RootObject::removeRuntimeObject):
+ * bindings/runtime_root.h:
+
+2007-06-14 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Mitz.
+
+ <rdar://problem/5244948>
+ Safari keeps on complaining about slow script playing NBC TV video (14133)
+
+ http://bugs.webkit.org/show_bug.cgi?id=14133
+ Runaway JavaScript timer fires when spinning around in Google Maps street view
+
+ Make sure to start and stop the timeout checker around calls to JS.
+
+ * bindings/NP_jsobject.cpp:
+ (_NPN_InvokeDefault):
+ (_NPN_Invoke):
+ (_NPN_Evaluate):
+ * bindings/jni/jni_jsobject.cpp:
+ (JavaJSObject::call):
+ (JavaJSObject::eval):
+
+2007-06-13 Darin Adler <darin@apple.com>
+
+ Reviewed by Mark Rowe.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=14132
+ array sort with > 10000 elements sets elements > 10000 undefined
+
+ Test: fast/js/sort-large-array.html
+
+ * kjs/array_instance.h: Replaced pushUndefinedObjectsToEnd with
+ compactForSorting, and removed ExecState parameters.
+
+ * kjs/array_object.cpp:
+ (ArrayInstance::sort): Changed to call compactForSorting.
+ (ArrayInstance::compactForSorting): Do the get and delete of the
+ properties directly on the property map instead of using public
+ calls from JSObject. The public calls would just read the undefined
+ values from the compacted sort results array!
+
+2007-06-13 George Staikos <staikos@kde.org>
+
+ Reviewed by Lars.
+
+ Fix Mac OS X build after last checkin.
+
+ * wtf/FastMalloc.h:
+
+2007-06-14 Lars Knoll <lars@trolltech.com>
+
+ Reviewed by Maciej.
+
+ Disable FastMalloc for the Qt build and make sure we
+ don't reimplement the global new/delete operators
+ when using the system malloc.
+
+ * wtf/FastMalloc.cpp:
+ * wtf/FastMalloc.h:
+ * wtf/Platform.h:
+
+2007-06-13 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Geoff.
+
+ Make sure that bindings instances get correct root objects.
+
+ * JavaScriptCore.exp:
+ * bindings/NP_jsobject.cpp:
+ (listFromVariantArgs):
+ (_NPN_InvokeDefault):
+ (_NPN_Invoke):
+ (_NPN_SetProperty):
+ * bindings/c/c_instance.cpp:
+ (KJS::Bindings::CInstance::invokeMethod):
+ (KJS::Bindings::CInstance::invokeDefaultMethod):
+ * bindings/c/c_runtime.cpp:
+ (KJS::Bindings::CField::valueFromInstance):
+ * bindings/c/c_utility.cpp:
+ (KJS::Bindings::convertNPVariantToValue):
+ * bindings/c/c_utility.h:
+ * bindings/objc/objc_instance.mm:
+ (ObjcInstance::invokeMethod):
+ (ObjcInstance::invokeDefaultMethod):
+ (ObjcInstance::getValueOfUndefinedField):
+ * bindings/objc/objc_runtime.mm:
+ (ObjcField::valueFromInstance):
+ (ObjcArray::valueAt):
+ * bindings/objc/objc_utility.h:
+ * bindings/objc/objc_utility.mm:
+ (KJS::Bindings::convertObjcValueToValue):
+ * bindings/runtime.h:
+
+2007-06-13 Simon Hausmann <hausmann@kde.org>
+
+ Reviewed by Lars.
+
+ * kjs/testkjs.pro: WebKitQt is now called QtWebKit.
+
+2007-06-12 Anders Carlsson <andersca@apple.com>
+
+ Another build fix.
+
+ * bindings/qt/qt_instance.cpp:
+ (KJS::Bindings::QtInstance::invokeMethod):
+
+2007-06-12 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Geoff.
+
+ Move the notion of field type to the JNI runtime since that's the only
+ one that was actually using it.
+
+ * bindings/c/c_runtime.h:
+ (KJS::Bindings::CField::CField):
+ * bindings/jni/jni_runtime.h:
+ * bindings/objc/objc_runtime.h:
+ * bindings/objc/objc_runtime.mm:
+ * bindings/qt/qt_runtime.h:
+ * bindings/runtime.h:
+ * bindings/runtime_method.cpp:
+
+2007-06-12 Anders Carlsson <andersca@apple.com>
+
+ Build fix.
+
+ * bindings/qt/qt_class.cpp:
+ (KJS::Bindings::QtClass::methodsNamed):
+ * bindings/qt/qt_instance.cpp:
+ (KJS::Bindings::QtInstance::invokeMethod):
+
+2007-06-12 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Oliver.
+
+ Get rid of the MethodList class and use a good ol' Vector instead.
+
+ * bindings/c/c_class.cpp:
+ (KJS::Bindings::CClass::methodsNamed):
+ * bindings/c/c_instance.cpp:
+ (KJS::Bindings::CInstance::invokeMethod):
+ * bindings/jni/jni_class.cpp:
+ (JavaClass::JavaClass):
+ (JavaClass::~JavaClass):
+ * bindings/jni/jni_instance.cpp:
+ (JavaInstance::invokeMethod):
+ * bindings/objc/objc_class.mm:
+ (KJS::Bindings::ObjcClass::methodsNamed):
+ * bindings/objc/objc_instance.mm:
+ (ObjcInstance::invokeMethod):
+ * bindings/objc/objc_runtime.mm:
+ (ObjcFallbackObjectImp::callAsFunction):
+ * bindings/runtime.cpp:
+ * bindings/runtime.h:
+ * bindings/runtime_method.cpp:
+ (RuntimeMethod::lengthGetter):
+ (RuntimeMethod::callAsFunction):
+ * bindings/runtime_object.cpp:
+ (RuntimeObjectImp::getOwnPropertySlot):
+
+2007-06-12 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Geoff.
+
+ Make RuntimeMethod's method list a pointer so that the object size doesn't
+ grow beyond 32 bytes when we later will replace MethodList with a Vector.
+
+ * bindings/runtime_method.cpp:
+ (RuntimeMethod::RuntimeMethod):
+ (RuntimeMethod::lengthGetter):
+ (RuntimeMethod::callAsFunction):
+ * bindings/runtime_method.h:
+
+2007-06-12 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Geoff.
+
+ Get rid of the Parameter class.
+
+ * bindings/jni/jni_instance.cpp:
+ (JavaInstance::invokeMethod):
+ * bindings/jni/jni_runtime.cpp:
+ (JavaMethod::signature):
+ * bindings/jni/jni_runtime.h:
+ (KJS::Bindings::JavaParameter::JavaParameter):
+ (KJS::Bindings::JavaParameter::~JavaParameter):
+ (KJS::Bindings::JavaParameter::type):
+ (KJS::Bindings::JavaMethod::parameterAt):
+ (KJS::Bindings::JavaMethod::numParameters):
+ * bindings/runtime.h:
+
+2007-06-12 Anders Carlsson <andersca@apple.com>
+
+ Build fix.
+
+ * bindings/qt/qt_class.h:
+
+2007-06-12 Mark Rowe <mrowe@apple.com>
+
+ Build fix.
+
+ * bindings/objc/objc_runtime.h:
+
+2007-06-12 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Geoff.
+
+ Get rid of Constructor and its only subclass JavaConstructor.
+
+ * bindings/c/c_class.h:
+ * bindings/jni/jni_class.cpp:
+ (JavaClass::JavaClass):
+ (JavaClass::~JavaClass):
+ * bindings/jni/jni_class.h:
+ * bindings/jni/jni_runtime.cpp:
+ * bindings/jni/jni_runtime.h:
+ * bindings/objc/objc_class.h:
+ * bindings/runtime.h:
+
+2007-06-12 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Geoff.
+
+ Use RetainPtr throughout the bindings code.
+
+ * bindings/objc/objc_class.h:
+ * bindings/objc/objc_class.mm:
+ (KJS::Bindings::ObjcClass::ObjcClass):
+ (KJS::Bindings::ObjcClass::methodsNamed):
+ (KJS::Bindings::ObjcClass::fieldNamed):
+ * bindings/objc/objc_instance.h:
+ (KJS::Bindings::ObjcInstance::getObject):
+ * bindings/objc/objc_instance.mm:
+ (ObjcInstance::ObjcInstance):
+ (ObjcInstance::~ObjcInstance):
+ (ObjcInstance::implementsCall):
+ (ObjcInstance::invokeMethod):
+ (ObjcInstance::invokeDefaultMethod):
+ (ObjcInstance::defaultValue):
+ * bindings/objc/objc_runtime.h:
+ (KJS::Bindings::ObjcMethod::setJavaScriptName):
+ (KJS::Bindings::ObjcMethod::javaScriptName):
+ (KJS::Bindings::ObjcArray::getObjcArray):
+ * bindings/objc/objc_runtime.mm:
+ (ObjcField::name):
+ (ObjcArray::ObjcArray):
+ (ObjcArray::setValueAt):
+ (ObjcArray::valueAt):
+ (ObjcArray::getLength):
+ * wtf/RetainPtr.h:
+
+2007-06-12 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Maciej.
+
+ Have JSCell inherit from Noncopyable.
+
+ * bindings/objc/objc_runtime.h:
+ * bindings/runtime_object.h:
+ * kjs/value.h:
+
+2007-06-12 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Darin and Maciej.
+
+ More cleanup. Use our Noncopyable WTF class, add a root object member
+ to the Array class.
+
+ * bindings/c/c_class.h:
+ * bindings/jni/jni_class.h:
+ * bindings/jni/jni_instance.h:
+ * bindings/jni/jni_runtime.cpp:
+ (JavaArray::JavaArray):
+ * bindings/jni/jni_runtime.h:
+ * bindings/objc/objc_class.h:
+ * bindings/objc/objc_runtime.h:
+ * bindings/objc/objc_runtime.mm:
+ (ObjcArray::ObjcArray):
+ * bindings/objc/objc_utility.mm:
+ (KJS::Bindings::convertObjcValueToValue):
+ * bindings/runtime.cpp:
+ (KJS::Bindings::Array::Array):
+ (KJS::Bindings::Array::~Array):
+ * bindings/runtime.h:
+ * bindings/runtime_object.h:
+ * bindings/runtime_root.h:
+
+2007-06-08 Zack Rusin <zrusin@trolltech.com>
+
+ Fix the Qt build
+
+ * bindings/qt/qt_instance.cpp:
+ (KJS::Bindings::QtInstance::QtInstance):
+ * bindings/qt/qt_instance.h:
+
+2007-06-07 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Geoff.
+
+ Get rid of Instance::setRootObject and pass the root object to the instance constructor instead.
+
+ * bindings/c/c_instance.cpp:
+ (KJS::Bindings::CInstance::CInstance):
+ * bindings/c/c_instance.h:
+ * bindings/jni/jni_instance.cpp:
+ (JavaInstance::JavaInstance):
+ * bindings/jni/jni_instance.h:
+ * bindings/jni/jni_jsobject.cpp:
+ (JavaJSObject::convertJObjectToValue):
+ * bindings/objc/objc_instance.h:
+ * bindings/objc/objc_instance.mm:
+ (ObjcInstance::ObjcInstance):
+ * bindings/runtime.cpp:
+ (KJS::Bindings::Instance::Instance):
+ (KJS::Bindings::Instance::createBindingForLanguageInstance):
+ * bindings/runtime.h:
+
+2007-06-07 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Adam.
+
+ Don't use a JavaInstance to store the field when all we want to do is to keep the field
+ from being garbage collected. Instead, use a JObjectWrapper.
+
+ * bindings/jni/jni_instance.h:
+ * bindings/jni/jni_runtime.cpp:
+ (JavaField::JavaField):
+ (JavaField::dispatchValueFromInstance):
+ (JavaField::dispatchSetValueToInstance):
+ * bindings/jni/jni_runtime.h:
+ (KJS::Bindings::JavaField::JavaField):
+ (KJS::Bindings::JavaField::operator=):
+
+2007-05-30 Alp Toker <alp.toker@collabora.co.uk>
+
+ Reviewed by Brady.
+
+ Enable logging in the Gdk port.
+ http://bugs.webkit.org/show_bug.cgi?id=13936
+
+ * wtf/Assertions.cpp:
+ * wtf/Assertions.h: Add WTFLogVerbose which also logs
+ the file, line number and function.
+
+2007-05-30 Mark Rowe <mrowe@apple.com>
+
+ Mac build fix. Update #include.
+
+ * API/JSCallbackFunction.h:
+
+2007-05-30 Luciano Montanaro <mikelima@cirulla.net>
+
+ Reviewed by Maciej.
+
+ - cross-port Harri Porten's commits 636099 and 636108 from KJS:
+ "publish a class anyway public already" and "class is being used from
+ outside for quite some time" in preparation for further syncronizations
+
+ * kjs/context.h:
+ * kjs/date_object.cpp:
+ * kjs/date_object.h:
+ * kjs/function.h:
+ (KJS::):
+ (KJS::InternalFunctionImp::classInfo):
+ (KJS::InternalFunctionImp::functionName):
+ * kjs/function_object.h:
+ * kjs/internal.h:
+ * kjs/lookup.h:
+ (KJS::getStaticPropertySlot):
+ (KJS::getStaticFunctionSlot):
+ (KJS::getStaticValueSlot):
+ * kjs/object_object.h:
+
+2007-05-29 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Adam Roben.
+
+ Cleanup function and fix to match comparison API.
+
+ * kjs/string_object.cpp:
+ (KJS::substituteBackreferences):
+ (KJS::localeCompare):
+
+2007-05-28 Geoffrey Garen <ggaren@apple.com>
+
+ Slight clarification to an exception message.
+
+ * API/JSCallbackObject.cpp:
+ (KJS::JSCallbackObject::put):
+
+2007-05-27 Holger Freyther <zecke@selfish.org>
+
+ Reviewed by Mark Rowe.
+
+ * wtf/Platform.h: Move Gdk up to allow building WebKit/Gdk on Darwin
+
+2007-05-27 Darin Adler <darin@apple.com>
+
+ - fix a couple ifdefs that said WIN instead of WIN_OS
+
+ * kjs/collector.cpp:
+ (KJS::allocateBlock): WIN -> WIN_OS
+ (KJS::freeBlock): Ditto.
+
+2007-05-26 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Darin.
+
+ Patch for http://bugs.webkit.org/show_bug.cgi?id=13854
+ Port of commit 667785 from kjs
+
+ - special case calling String.localeCompare() with no parameters to return 0.
+
+ * kjs/string_object.cpp:
+ (KJS::StringProtoFunc::callAsFunction):
+
+2007-05-25 Kimmo Kinnunen <kimmok@iki.fi>
+
+ Reviewed by Darin.
+
+ - Fix for http://bugs.webkit.org/show_bug.cgi?id=13456
+ REGRESSION: setTimeout "arguments" object gets shadowed by a local variable
+
+ - Add a explicit check for arguments. Previously check was done with getDirect,
+ but since the arguments is created on-demand in ActivationImp, it doesn't
+ show up in the test. 'arguments' should always be in the VarDeclNode's
+ evaluation scope.
+
+ * kjs/nodes.cpp:
+ (VarDeclNode::evaluate): Additional check if the var decl identifier is 'arguments'
+
+2007-05-25 George Staikos <staikos@kde.org>
+
+ Reviewed by Maciej.
+
+ - Use COMPILER(GCC), not PLATFORM(GCC) - as Platform.h defines
+
+ * wtf/FastMalloc.h:
+
+2007-05-25 Kimmo Kinnunen <kimmok@iki.fi>
+
+ Reviewed by Darin.
+
+ - http://bugs.webkit.org/show_bug.cgi?id=13623 (Decompilation of function
+ doesn't compile with "++(x,y)")
+ - Create the error node based on the actual node, not the node inside
+ parenthesis
+ - Fix applies to postfix, prefix and typeof operators
+ - Produces run-time ReferenceError like other non-lvalue assignments etc.
+
+ * kjs/grammar.y: Create {Prefix,Postfix}ErrorNode based on the actual node,
+ not the based on the node returned by "nodeInsideAllParens()". Same for
+ TypeOfValueNode.
+
+2007-05-25 Simon Hausmann <hausmann@kde.org>
+
+ Reviewed by Zack.
+
+ Fix crash in Qt JavaScript bindings when the arguments used on the Qt side are not
+ registered with QMetaType.
+
+ * bindings/qt/qt_instance.cpp:
+ (KJS::Bindings::QtInstance::invokeMethod):
+ * bindings/qt/qt_runtime.cpp:
+
+2007-05-24 Luciano Montanaro <mikelima@cirulla.net>
+
+ Reviewed by Darin
+
+ Patch for http://bugs.webkit.org/show_bug.cgi?id=13855
+ Port patch 666176 to JavaScriptCore
+
+ - Renamed JSValue::downcast() to JSValue::asCell() which makes the
+ function meaning cleaner. It's modeled after Harri Porten change in
+ KDE trunk.
+
+ * kjs/collector.cpp:
+ (KJS::Collector::protect):
+ (KJS::Collector::unprotect):
+ (KJS::Collector::collectOnMainThreadOnly):
+ * kjs/object.h:
+ (KJS::JSValue::isObject):
+ * kjs/string_object.cpp:
+ (KJS::StringProtoFunc::callAsFunction):
+ * kjs/value.h:
+ (KJS::JSValue::asCell):
+ (KJS::JSValue::isNumber):
+ (KJS::JSValue::isString):
+ (KJS::JSValue::isObject):
+ (KJS::JSValue::getNumber):
+ (KJS::JSValue::getString):
+ (KJS::JSValue::getObject):
+ (KJS::JSValue::getUInt32):
+ (KJS::JSValue::mark):
+ (KJS::JSValue::marked):
+ (KJS::JSValue::type):
+ (KJS::JSValue::toPrimitive):
+ (KJS::JSValue::toBoolean):
+ (KJS::JSValue::toNumber):
+ (KJS::JSValue::toString):
+ (KJS::JSValue::toObject):
+
+2007-05-18 Holger Hans Peter Freyther <zecke@selfish.org>
+
+ Reviewed by Mark Rowe.
+
+ * kjs/testkjs.pro: Make the Gdk port link to icu
+
+2007-05-15 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Adele Peterson.
+
+ It helps if you swap the right variable.
+
+ * wtf/HashSet.h:
+ (WTF::::operator):
+
+2007-05-15 Lars Knoll <lars@trolltech.com>
+
+ Reviewed by Zack
+
+ Extend the QObject JavaScript bindings to work for slots with
+ arguments.
+
+ * bindings/qt/qt_instance.cpp:
+ (KJS::Bindings::QtInstance::invokeMethod):
+
+2007-05-14 Kimmo Kinnunen <kimmok@iki.fi>
+
+ Reviewed by Darin.
+
+ - Fixes http://bugs.webkit.org/show_bug.cgi?id=13622 (Decompiler
+ omits trailing comma in array literal)
+
+ * kjs/nodes2string.cpp:
+ (ArrayNode::streamTo): print extra ',' in case there was elision
+ commas (check opt member var) and array elements present
+ in the array expression
+
+2007-05-14 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Added HashMap::swap and HashSet::swap. WebCore now uses HashSet::swap.
+ I figured while I was in the neighborhood I might as well add HashMap::swap,
+ too.
+
+ * wtf/HashMap.h:
+ (WTF::::operator):
+ (WTF::::swap):
+ * wtf/HashSet.h:
+ (WTF::::operator):
+ (WTF::::swap):
+
+2007-05-11 Kimmo Kinnunen <kimmok@iki.fi>
+
+ Reviewed by Darin.
+
+ - Fix for bug http://bugs.webkit.org/show_bug.cgi?id=13620
+ Bogus decompilation of "for (var j = 1 in [])"
+ - ForInNode toString()'ed to syntax error if there was var decl
+ and initializer
+ - ForNode toStringed()'ed lost 'var ' if it was present
+
+ * kjs/nodes2string.cpp:
+ (VarDeclListNode::streamTo): Print "var " here
+ (VarStatementNode::streamTo): Don't print "var " here
+ (ForNode::streamTo): Remove TODO comment, VarDeclListNode will
+ stream the "var "
+ (ForInNode::streamTo): ForIn initializer is printed by VarDeclNode
+
+2007-05-11 Kimmo Kinnunen <kimmok@iki.fi>
+
+ Reviewed by Darin.
+
+ - Fixes http://bugs.webkit.org/show_bug.cgi?id=10878
+ (Incorrect decompilation for "4..x")
+ - Group numbers in dotted expressions in toString() output, so we
+ avoid the 4.x constructs when the original input is 4..x.
+ 4..x means the same as 4. .x or (4).x or Number(4).x
+
+ * kjs/nodes2string.cpp:
+ (KJS::SourceStream::):
+ Add boolean flag to indicate that if next item is a number, it should be grouped.
+ Add new formatting enum which turns on the boolean flag.
+ (KJS::SourceStream::SourceStream): Added. Initialize the flag.
+ (SourceStream::operator<<): Added. New overloaded operator with double value as parameter.
+ (NumberNode::streamTo): Use the double operator
+ (ArrayNode::streamTo):
+ (DotAccessorNode::streamTo):
+ (FunctionCallDotNode::streamTo):
+ (FunctionCallParenDotNode::streamTo):
+ (PostfixDotNode::streamTo):
+ (DeleteDotNode::streamTo):
+ (PrefixDotNode::streamTo):
+ (AssignDotNode::streamTo): Use the new formatting enum to turn on the grouping flag.
+
+2007-05-10 Lars Knoll <lars@trolltech.com>
+
+ Reviewed by Zack
+
+ Fix our last three test failures in the JavaScript
+ tests.
+
+ * wtf/unicode/qt4/UnicodeQt4.h:
+ (WTF::Unicode::toLower):
+ (WTF::Unicode::toUpper):
+
+2007-05-08 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Fixed #includes of JSStringRefCF.h and use of CF datatypes. I think I
+ misunderstood this issue before.
+
+ * API/JavaScriptCore.h: #include JSStringRefCF.h. Platforms that don't
+ want this behavior can just #include individual headers, instead of the
+ umbrella framework header. But we definitely want Mac OS X clients to
+ get the #include of JSStringRefCF.h "for free."
+ * API/minidom.c: Don't #include JSStringRefCF.h. (Don't need to #include
+ JavaScriptCore.h, either.)
+ * API/testapi.c: Don't #include JSStringRefCF.h. Do use CF datatypes
+ regardless of whether __APPLE__ is defined. Platforms that don't support
+ CF just shouldn't compile this file.
+ (main):
+
+2007-05-09 Eric Seidel <eric@webkit.org>
+
+ Reviewed by mjs.
+
+ http://bugs.webkit.org/show_bug.cgi?id=6985
+ Cyclic __proto__ values cause WebKit to hang
+
+ * kjs/object.cpp:
+ (KJS::JSObject::put): do a cycle check before setting __proto__
+
+2007-05-08 Kimmo Kinnunen <kimmok@iki.fi>
+
+ Reviewed by darin. Landed by eseidel.
+
+ - http://bugs.webkit.org/show_bug.cgi?id=10880 (Do..while loop gains
+ a semicolon each time it is toStringed)
+ Grammar in Ecma-66262, 12.6: "do Statement while ( Expression );"
+ EmptyStatement was created after every do..while(expr) which
+ had semicolon at the end.
+
+ * kjs/grammar.y: Require semicolon at the end of do..while
+
+2007-05-08 Geoffrey Garen <ggaren@apple.com>
+
+ Build fix -- this time for sure.
+
+ APICast.h, being private, ends up in a different folder than JSValueRef.h,
+ so we can't include one from the other using "". Instead, just forward
+ declare the relevant data types.
+
+ * API/APICast.h:
+
+2007-05-08 Geoffrey Garen <ggaren@apple.com>
+
+ Build fix: export APICast.h for WebCore and WebKit.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2007-05-04 Darin Adler <darin@apple.com>
+
+ Reviewed by Adele.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=12821
+ <rdar://problem/5007921> Number.toExponential doesn't work for negative numbers
+
+ * kjs/number_object.cpp: (NumberProtoFunc::callAsFunction):
+ Added a call to fabs before calling log10.
+
+2007-05-03 Holger Freyther <freyther@kde.org>
+
+ Reviewed by Zack, landed by Simon.
+ This is bugzilla bug 13499.
+
+ * JavaScriptCore.pri: Place Qt into the qt-port scope
+ * bindings/testbindings.pro: Place Qt into the qt-port scope
+ * kjs/testkjs.pro: Place Qt into the qt-port scope
+ * pcre/pcre.pri: Place Qt into the qt-port scope
+
+2007-05-02 David Harrison <harrison@apple.com>
+
+ Reviewed by Antti.
+
+ <rdar://problem/5174862> Crash resulting from DeprecatedString::insert()
+
+ Added insertion support for more than one value.
+
+ * wtf/Vector.h:
+ (WTF::::insert):
+ Added support for inserting multiple values.
+
+ (WTF::::prepend):
+ New. Insert at the start of vectors. Convenient for vectors used as strings.
+
+2007-05-01 Jungshik Shin <jungshik.shin@gmail.com>
+
+ Reviewed by Alexey.
+
+ - get rid of non-ASCII lteral characters : suppress compiler warnings
+ http://bugs.webkit.org/show_bug.cgi?id=13551
+
+ * kjs/testkjs.cpp:
+ * pcre/pcre_compile.c:
+
+2007-04-28 Jungshik Shin <jungshik.shin@gmail.com>
+
+ Reviewed by Sam Weinig.
+
+ - Replace copyright sign in Latin-1 (0xA9) with '(C)'
+ http://bugs.webkit.org/show_bug.cgi?id=13531
+
+ * bindings/npruntime.h:
+
+2007-04-28 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - fix <rdar://problem/5154144> Hamachi test fails: assertion failure in ListHashSet
+
+ Test: fast/forms/add-remove-form-elements-stress-test.html
+
+ * wtf/ListHashSet.h:
+ (WTF::ListHashSetNodeAllocator::ListHashSetNodeAllocator): Initialize
+ m_isDoneWithInitialFreeList to false.
+ (WTF::ListHashSetNodeAllocator::allocate): Added assertions based on a debug-only
+ m_isAllocated flag that make sure we don't allocate a block that's already allocated.
+ These assertions helped pinpoint the bug. Set m_isDoneWithInitialFreeList when we
+ allocate the last block of the initial free list. Once we're done with the initial
+ free list, turn off the rule that says that the next node in the pool after the last
+ node in the free list is also free. This rule works because any free nodes are added
+ to the head of the free list, so a node that hasn't been allocated even once is always
+ at the tail of the free list and all the nodes after it also haven't been allocated
+ even once. But it doesn't work any longer once the entire pool has been used at least
+ once, because there's nothing special about the last node on the free list any more.
+ (WTF::ListHashSetNodeAllocator::deallocate): Set the node's m_isAllocated to false.
+ (WTF::ListHashSetNodeAllocator::pastPool): Added. Used above.
+ (WTF::ListHashSetNodeAllocator::inPool): Changed to use the pastPool function.
+ (WTF::ListHashSetNode::ListHashSetNode): Initialize m_isAllocated to true.
+ (WTF::ListHashSetNode::operator new): Removed variable name for unused size
+ parameter.
+ (WTF::ListHashSetNode::destroy): Changed to call the destructor rather than
+ delete -- this gets rid of the need to define an operator delete.
+
+2007-04-27 Christopher Brichford <chrisb@adobe.com>
+
+ Reviewed by Timothy Hatcher.
+
+ Fix for: Bug 13211: Move JavaScriptCore mac project files for apollo port
+ http://bugs.webkit.org/show_bug.cgi?id=13211
+
+ * JavaScriptCore.apolloproj/mac/JavaScriptCore.Debug.xcconfig: Added.
+ * JavaScriptCore.apolloproj/mac/JavaScriptCore.Release.xcconfig: Added.
+ * JavaScriptCore.apolloproj/mac/JavaScriptCore.xcconfig: Added.
+ * JavaScriptCore.apolloproj/mac/JavaScriptCore.xcodeproj/project.pbxproj: Added.
+ * JavaScriptCore.apolloproj/mac/JavaScriptCore/JavaScriptCore.Debug.xcconfig: Removed.
+ * JavaScriptCore.apolloproj/mac/JavaScriptCore/JavaScriptCore.Release.xcconfig: Removed.
+ * JavaScriptCore.apolloproj/mac/JavaScriptCore/JavaScriptCore.xcconfig: Removed.
+ * JavaScriptCore.apolloproj/mac/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj: Removed.
+
+2007-04-27 Holger Freyther <freyther@kde.org>
+
+ Reviewed by Maciej.
+
+ Remove unmaintained CMake build system.
+
+ * CMakeLists.txt: Removed.
+ * pcre/CMakeLists.txt: Removed.
+
+2007-04-27 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Oliver.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj: Improve dependencies in Xcode project
+ by marking dftables as a dependency of Generate Derived Sources rather than of
+ JavaScriptCore itself.
+
+2007-04-26 Geoffrey Garen <ggaren@apple.com>
+
+ Build fix -- added #includes that we used to get implicitly through
+ JSStringRef.h.
+
+ * API/JSNode.c:
+ * API/JSNodeList.c:
+ * API/minidom.c:
+ * API/testapi.c:
+
+2007-04-26 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak, Adam Roben.
+
+ Fixed
+ <rdar://problem/4885130> Remove #include of JSStringRefCF.h from JSStringRef.h
+ <rdar://problem/4885123> JavaScriptCore is not cross-platform -- JSStringRef.h references CF datatypes
+
+ * API/JSStringRef.h: Removed #include -- no clients need it anymore.
+
+2007-04-25 David Kilzer <ddkilzer@apple.com>
+
+ Reviewed by Maciej.
+
+ Add assertions for debug builds.
+
+ * kjs/JSLock.cpp:
+ (KJS::JSLock::lock): Assert the return value of pthread_mutex_lock() in debug builds.
+ (KJS::JSLock::unlock): Assert the return value of pthread_mutex_unlock() in debug builds.
+
+2007-04-25 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Anders.
+
+ - fix build problems
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Disable warning that
+ gives often downright incorrect results based on guessing what will happen in 64-bit.
+
+2007-04-25 Darin Adler <darin@apple.com>
+
+ Reviewed by Geoff.
+
+ - tweak the allocator for a small speedup -- Shark showed this was a win, but I can't
+ measure an improvement right now, but it's also clear these changes do no harm
+
+ * wtf/FastMalloc.cpp:
+ (WTF::LgFloor): Use ALWAYS_INLINE here; in testing I did a while back this was necessary
+ to get this single-instruction function to be inlined.
+ (WTF::SizeClass): Use ALWAYS_INLINE here too for the same reason. Also change the special
+ case for a size of 0 to work without a branch for a bit of extra speed.
+ (WTF::ByteSizeForClass): Use ALWAYS_INLINE here too for the same reason.
+
+2007-04-24 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver.
+
+ - use custom calling convention for everything in nodes.cpp on intel gcc for 1.5% speed boost
+
+ Nearly all functions in nodes.cpp were marked up to use the
+ regparm(3) calling convention under GCC for x86, since this is
+ faster and they are all guaranteed to be called only internally to
+ kjs.
+
+ The only exception is destructors, since delete doesn't know how to use a custom calling convention.
+
+ * kjs/nodes.cpp:
+ (dotExprDoesNotAllowCallsString):
+ * kjs/nodes.h:
+ (KJS::Node::):
+ (KJS::StatementNode::):
+ (KJS::NullNode::):
+ (KJS::BooleanNode::):
+ (KJS::NumberNode::):
+ (KJS::StringNode::):
+ (KJS::RegExpNode::):
+ (KJS::ThisNode::):
+ (KJS::ResolveNode::):
+ (KJS::GroupNode::):
+ (KJS::ElementNode::):
+ (KJS::ArrayNode::):
+ (KJS::PropertyNameNode::):
+ (KJS::PropertyNode::):
+ (KJS::PropertyListNode::):
+ (KJS::ObjectLiteralNode::):
+ (KJS::BracketAccessorNode::):
+ (KJS::DotAccessorNode::):
+ (KJS::ArgumentListNode::):
+ (KJS::ArgumentsNode::):
+ (KJS::NewExprNode::):
+ (KJS::FunctionCallValueNode::):
+ (KJS::FunctionCallResolveNode::):
+ (KJS::FunctionCallBracketNode::):
+ (KJS::FunctionCallParenBracketNode::):
+ (KJS::FunctionCallDotNode::):
+ (KJS::FunctionCallParenDotNode::):
+ (KJS::PostfixResolveNode::):
+ (KJS::PostfixBracketNode::):
+ (KJS::PostfixDotNode::):
+ (KJS::PostfixErrorNode::):
+ (KJS::DeleteResolveNode::):
+ (KJS::DeleteBracketNode::):
+ (KJS::DeleteDotNode::):
+ (KJS::DeleteValueNode::):
+ (KJS::VoidNode::):
+ (KJS::TypeOfResolveNode::):
+ (KJS::TypeOfValueNode::):
+ (KJS::PrefixResolveNode::):
+ (KJS::PrefixBracketNode::):
+ (KJS::PrefixDotNode::):
+ (KJS::PrefixErrorNode::):
+ (KJS::UnaryPlusNode::):
+ (KJS::NegateNode::):
+ (KJS::BitwiseNotNode::):
+ (KJS::LogicalNotNode::):
+ (KJS::MultNode::):
+ (KJS::AddNode::):
+ (KJS::ShiftNode::):
+ (KJS::RelationalNode::):
+ (KJS::EqualNode::):
+ (KJS::BitOperNode::):
+ (KJS::BinaryLogicalNode::):
+ (KJS::ConditionalNode::):
+ (KJS::AssignResolveNode::):
+ (KJS::AssignBracketNode::):
+ (KJS::AssignDotNode::):
+ (KJS::AssignErrorNode::):
+ (KJS::CommaNode::):
+ (KJS::AssignExprNode::):
+ (KJS::VarDeclListNode::):
+ (KJS::VarStatementNode::):
+ (KJS::EmptyStatementNode::):
+ (KJS::ExprStatementNode::):
+ (KJS::IfNode::):
+ (KJS::DoWhileNode::):
+ (KJS::WhileNode::):
+ (KJS::ForNode::):
+ (KJS::ContinueNode::):
+ (KJS::BreakNode::):
+ (KJS::ReturnNode::):
+ (KJS::WithNode::):
+ (KJS::LabelNode::):
+ (KJS::ThrowNode::):
+ (KJS::TryNode::):
+ (KJS::ParameterNode::):
+ (KJS::Parameter::):
+ (KJS::FunctionBodyNode::):
+ (KJS::FuncExprNode::):
+ (KJS::FuncDeclNode::):
+ (KJS::SourceElementsNode::):
+ (KJS::CaseClauseNode::):
+ (KJS::ClauseListNode::):
+ (KJS::SwitchNode::):
+
+2007-04-24 Oliver Hunt <oliver@apple.com>
+
+ GTK Build fix, ::findEntry->KJS::findEntry
+
+ * kjs/lookup.cpp:
+ (KJS::Lookup::findEntry):
+ (KJS::Lookup::find):
+
+2007-04-23 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Geoff.
+
+ - compile most of JavaScriptCore as one file for 4% JS iBench speed improvement
+
+ * JavaScriptCore.xcodeproj/project.pbxproj: Add AllInOneFile.cpp, and remove files it includes
+ from the build.
+ * kjs/AllInOneFile.cpp: Added.
+ * kjs/dtoa.cpp: Renamed CONST to CONST_ to avoid conflict.
+ (Bigint::):
+ (Bigint::nrv_alloc):
+ * kjs/lookup.cpp: Use "namspace KJS { ... }" instead of "using namespace KJS;"
+
+2007-04-23 Maciej Stachowiak <mjs@apple.com>
+
+ Build fix, not reviewed.
+
+ * kjs/collector.h: Fix struct/class mismatch.
+
+2007-04-23 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin.
+
+ - raise ALLOCATIONS_PER_COLLECTION to 4000, for 3.7% iBench speed improvement
+
+ Now that the cell size is smaller and the block size is bigger, we can fit 4000 objects in
+ the two spare cells the collector is willing to keep around, so collect a bit less often.
+
+ * kjs/collector.cpp:
+
+2007-04-23 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin and Geoff.
+
+ - move mark and collectOnMainThreadOnly bits into separate bitmaps
+
+ This saves 4 bytes per cell, allowing shrink of cell size to 32,
+ which leads to a .8% speed improvement on iBench.
+
+ This is only feasible because of all the previous changes on the branch.
+
+ * kjs/collector.cpp:
+ (KJS::allocateBlock): Adjust for some renames of constants.
+ (KJS::Collector::markStackObjectsConservatively): Now that cells are 32 bytes (64
+ bytes on 64-bit) the cell alignment check can be made much more strict, and also
+ obsoletes the need for a % sizeof(CollectorCell) check. Also, we can mask off the low
+ bits of the pointer to have a potential block pointer to look for.
+ (KJS::Collector::collectOnMainThreadOnly): Use bitmap.
+ (KJS::Collector::markMainThreadOnlyObjects): Use bitmap.
+ (KJS::Collector::collect): When sweeping, use bitmaps directly to find mark bits.
+ * kjs/collector.h:
+ (KJS::): Move needed constants and type declarations here.
+ (KJS::CollectorBitmap::get): Bit twiddling to get a bitmap value.
+ (KJS::CollectorBitmap::set): Bit twiddling to set a bitmap bit to true.
+ (KJS::CollectorBitmap::clear): Bit twiddling to set a bitmap bit to false.
+ (KJS::CollectorBitmap::clearAll): Clear whole bitmap at one go.
+ (KJS::Collector::cellBlock): New operation, compute the block pointer for
+ a cell by masking off low bits.
+ (KJS::Collector::cellOffset): New operation, compute the cell offset for a
+ cell by masking off high bits and dividing (actually a shift).
+ (KJS::Collector::isCellMarked): Check mark bit in bitmap
+ (KJS::Collector::markCell): Set mark bit in bitmap.
+ * kjs/value.h:
+ (KJS::JSCell::JSCell): No more bits.
+ (KJS::JSCell::marked): Let collector handle it.
+ (KJS::JSCell::mark): Let collector handle it.
+
+2007-04-23 Anders Carlsson <andersca@apple.com>
+
+ Build fix.
+
+ * kjs/regexp_object.h:
+ RegExpObjectImpPrivate is a struct, not a class.
+
+2007-04-23 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin.
+
+ - shrink FunctionImp / DeclaredFunctionImp by 4 bytes, by moving parameter list to function body
+
+ I reconciled this with a similar change in KDE kjs by Maks Orlovich <maksim@kde.org>.
+
+ * kjs/function.cpp:
+ (KJS::FunctionImp::callAsFunction):
+ (KJS::FunctionImp::passInParameters):
+ (KJS::FunctionImp::lengthGetter):
+ (KJS::FunctionImp::getParameterName):
+ * kjs/function.h:
+ * kjs/function_object.cpp:
+ (FunctionProtoFunc::callAsFunction):
+ (FunctionObjectImp::construct):
+ * kjs/nodes.cpp:
+ (FunctionBodyNode::addParam):
+ (FunctionBodyNode::paramString):
+ (FuncDeclNode::addParams):
+ (FuncDeclNode::processFuncDecl):
+ (FuncExprNode::addParams):
+ (FuncExprNode::evaluate):
+ * kjs/nodes.h:
+ (KJS::Parameter::Parameter):
+ (KJS::FunctionBodyNode::numParams):
+ (KJS::FunctionBodyNode::paramName):
+ (KJS::FunctionBodyNode::parameters):
+ (KJS::FuncExprNode::FuncExprNode):
+ (KJS::FuncDeclNode::FuncDeclNode):
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Disable 64-bit warnings because
+ they handle size_t badly.
+
+2007-04-23 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin.
+
+ - shrink RegexpObjectImp by 4 bytes
+
+ Somewhat inexplicably, this seems to be a .33% speedup on JS iBench.
+
+ * kjs/regexp_object.cpp:
+ (KJS::RegExpObjectImpPrivate::RegExpObjectImpPrivate):
+ (RegExpObjectImp::RegExpObjectImp):
+ (RegExpObjectImp::performMatch):
+ (RegExpObjectImp::arrayOfMatches):
+ (RegExpObjectImp::getBackref):
+ (RegExpObjectImp::getLastMatch):
+ (RegExpObjectImp::getLastParen):
+ (RegExpObjectImp::getLeftContext):
+ (RegExpObjectImp::getRightContext):
+ (RegExpObjectImp::getValueProperty):
+ (RegExpObjectImp::putValueProperty):
+ * kjs/regexp_object.h:
+
+2007-04-23 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver.
+
+ - change to 1-bit bitfields instead of 8-bit, this turns out to lead to a .51% speedup on JS iBench
+
+ The 1-bit bitfields are actually faster than just plain bools, at least on Intel (go figure).
+
+ * kjs/property_map.h:
+
+2007-04-23 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin.
+
+ - shrink ArrayInstance objects by 4 bytes
+ http://bugs.webkit.org/show_bug.cgi?id=13386
+
+ I did this by storing the capacity before the beginning of the storage array. It turns out
+ it is rarely needed and is by definition 0 when the storage array is null.
+
+ * kjs/array_instance.h:
+ (KJS::ArrayInstance::capacity): Get it from the secret stash
+ * kjs/array_object.cpp:
+ (allocateStorage): New function to encapsulate allocating the storage with extra space ahead
+ for the capacity.
+ (reallocateStorage): ditto for realloc
+ (ArrayInstance::ArrayInstance):
+ (ArrayInstance::~ArrayInstance):
+ (ArrayInstance::resizeStorage):
+
+2007-04-23 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - fix <rdar://problem/4840688> REGRESSION (r10588, r10621): JavaScript won't parse
+ modifications of non-references (breaks 300themovie.warnerbros.com, fedex.com)
+
+ Despite the ECMAScript specification's claim that you can treat these as syntax
+ errors, doing so creates some website incompatibilities. So this patch turns them back
+ into evaluation errors instead.
+
+ Test: fast/js/modify-non-references.html
+
+ * kjs/grammar.y: Change makeAssignNode, makePrefixNode, and makePostfixNode so that they
+ never fail to parse. Update rules that use them. Fix a little bit of indenting. Use
+ new PostfixErrorNode, PrefixErrorNode, and AssignErrorNode classes.
+
+ * kjs/nodes.h: Added an overload of throwError that takes a char* argument.
+ Replaced setExceptionDetailsIfNeeded and debugExceptionIfNeeded with handleException,
+ which does both. Added PostfixErrorNode, PrefixErrorNode, and AssignErrorNode classes.
+
+ * kjs/nodes.cpp: Changed exception macros to use handleException; simpler and smaller
+ code size than the two functions that we used before.
+ (Node::throwError): Added the overload mentioned above.
+ (Node::handleException): Added. Contains the code from both setExceptionDetailsIfNeeded
+ and debugExceptionIfNeeded.
+ (PostfixErrorNode::evaluate): Added. Throws an exception.
+ (PrefixErrorNode::evaluate): Ditto.
+ (AssignErrorNode::evaluate): Ditto.
+ (ThrowNode::execute): Call handleException instead of debugExceptionIfNeeded; this
+ effectively adds a call to setExceptionDetailsIfNeeded, which may help with getting
+ the correct file and line number for these exceptions.
+
+ * kjs/nodes2string.cpp:
+ (PostfixErrorNode::streamTo): Added.
+ (PrefixErrorNode::streamTo): Added.
+ (AssignErrorNode::streamTo): Added.
+
+2007-04-23 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin.
+
+ - fix test failures / crashes on PPC
+
+ * kjs/property_map.h: Make the bool fields explicitly 8-bit bitfields, since bool is a full
+ word there otherwise :-(
+
+2007-04-23 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin.
+
+ - fix more test case failures
+
+ * bindings/runtime_array.cpp:
+ (RuntimeArray::RuntimeArray): inherit from JSObject instead of ArrayInstance; it turns
+ out that this class only needs the prototype and classInfo from ArrayInstance, not the
+ actual class itself, and it was too big otherwise.
+ (RuntimeArray::getOwnPropertySlot):
+ * bindings/runtime_array.h:
+
+2007-04-23 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin.
+
+ - fix some test failures
+
+ * bindings/runtime_method.cpp:
+ (RuntimeMethod::RuntimeMethod): inherit from InternalFunctionImp instead of FunctionImpl,
+ otherwise this is too big
+ (RuntimeMethod::getOwnPropertySlot):
+ * bindings/runtime_method.h:
+
+2007-04-22 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin.
+
+ - discard the arguments List for an ActivationImp when the corresponding Context is destroyed (1.7% speedup)
+ http://bugs.webkit.org/show_bug.cgi?id=13385
+
+ Based an idea by Christopher E. Hyde <C.Hyde@parableuk.force9.co.uk>. His patch to do
+ this also had many other List changes and I found this much simpler subset of the changes
+ was actually a hair faster.
+
+ This optimization is valid because the arguments list is only kept around to
+ lazily make the arguments object. If it's not made by the time the function
+ exits, it never will be, since any function that captures the continuation will
+ have its own local arguments variable in scope.
+
+ Besides the 1.7% speed improvement, it shrinks List by 4 bytes
+ (which in turn shrinks ActivationImp by 4 bytes).
+
+ * kjs/Context.cpp:
+ (KJS::Context::~Context): Clear the activation's arguments list.
+ * kjs/function.cpp:
+ (KJS::ActivationImp::ActivationImp): Adjusted for list changes.
+ (KJS::ActivationImp::mark): No need to mark, lists are always protected (this doesn't
+ cause a ref-cycle for reasons stated above).
+ (KJS::ActivationImp::createArgumentsObject): Clear arguments list.
+ * kjs/function.h:
+ * kjs/list.cpp:
+ (KJS::List::List): No more needsMarking boolean
+ (KJS::List::operator=): ditto
+ * kjs/list.h:
+ (KJS::List::List): ditto
+ (KJS::List::reset): ditto
+ (KJS::List::deref): ditto
+
+2007-04-22 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin.
+
+ - shrink PropertyMap by 8 bytes and therefore shrink CELL_SIZE to 40 (for 32-bit;
+ similar shrinkage for 64-bit)
+ http://bugs.webkit.org/show_bug.cgi?id=13384
+
+ Inspired by similar changes by Christopher E. Hyde <C.Hyde@parableuk.force9.co.uk>
+ done in the kjs-tweaks branch of KDE's kjs. However, this version is somewhat
+ cleaner style-wise and avoids some of the negative speed impact (at least on gcc/x86)
+ of his version.
+
+ This is nearly a wash performance-wise, maybe a slight slowdown, but worth doing
+ to eventually reach cell size 32.
+
+ * kjs/collector.cpp:
+ (KJS::):
+ * kjs/property_map.cpp:
+ (KJS::PropertyMap::~PropertyMap):
+ (KJS::PropertyMap::clear):
+ (KJS::PropertyMap::get):
+ (KJS::PropertyMap::getLocation):
+ (KJS::PropertyMap::put):
+ (KJS::PropertyMap::insert):
+ (KJS::PropertyMap::expand):
+ (KJS::PropertyMap::rehash):
+ (KJS::PropertyMap::remove):
+ (KJS::PropertyMap::mark):
+ (KJS::PropertyMap::containsGettersOrSetters):
+ (KJS::PropertyMap::getEnumerablePropertyNames):
+ (KJS::PropertyMap::getSparseArrayPropertyNames):
+ (KJS::PropertyMap::save):
+ (KJS::PropertyMap::checkConsistency):
+ * kjs/property_map.h:
+ (KJS::PropertyMap::hasGetterSetterProperties):
+ (KJS::PropertyMap::setHasGetterSetterProperties):
+ (KJS::PropertyMap::):
+ (KJS::PropertyMap::PropertyMap):
+
+2007-04-22 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin.
+
+ - change blocks to 64k in size, and use various platform-specific calls to allocate at 64k-aligned addresses
+ http://bugs.webkit.org/show_bug.cgi?id=13383
+
+ * kjs/collector.cpp:
+ (KJS::allocateBlock): New function to allocate 64k of 64k-aligned memory
+ (KJS::freeBlock): Corresponding free
+ (KJS::Collector::allocate):
+ (KJS::Collector::collect):
+
+2007-04-22 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin and Geoff.
+
+ - remove the concept of oversize objects, now that there aren't any (for now
+ only enforced with an assert).
+ http://bugs.webkit.org/show_bug.cgi?id=13382
+
+ This change is a .66% speedup on JS iBench for 32-bit platforms, probably much more
+ for 64-bit since it finally gives a reasonable cell size, but I did not test that.
+
+ * kjs/collector.cpp:
+ (KJS::): Use different cell size for 32-bit and 64-bit, now that there is no
+ oversize allocation.
+ (KJS::Collector::allocate): Remove oversize allocator.
+ (KJS::Collector::markStackObjectsConservatively): Don't check oversize objects.
+ (KJS::Collector::markMainThreadOnlyObjects): Ditto.
+ (KJS::Collector::collect): Ditto.
+
+2007-04-21 Mitz Pettel <mitz@webkit.org>
+
+ Reviewed by Adam.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=13428
+ REGRESSION (r20973-r20976): Failing ecma/Array/15.4.4.5-3.js
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=13429
+ REGRESSION (r20973-r20976): Crashing in fast/dom/plugin-attributes-enumeration.html
+
+ * kjs/array_object.cpp:
+ (ArrayInstance::sort): Free the old storage, not the new one.
+
+2007-04-20 Maciej Stachowiak <mjs@apple.com>
+
+ Not reviewed, build fix.
+
+ - fix build problem with last change - -O3 complains more about uninitialized variables
+
+ * pcre/pcre_compile.c:
+ (compile_branch):
+ (pcre_compile2):
+
+2007-04-20 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin.
+
+ - <rdar://problem/5149915> use mergesort when possible, since it leads to fewer compares (2% JS iBench speedup)
+
+ * kjs/array_object.cpp:
+ (ArrayInstance::sort): Use mergesort(3) on platforms that have it, since it tends
+ to do fewer compares than qsort; but avoid it very on large arrays since it uses extra
+ memory. Also added comments identifying possibly even better sorting algorithms
+ for sort by string value and sort by compare function.
+ * kjs/config.h:
+
+2007-04-20 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin.
+
+ - bump optimization flags up to -O3 for 1% JS iBench speed improvement
+
+ * Configurations/Base.xcconfig:
+
+2007-04-20 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Maciej.
+
+ Fix bogus optimisation in the generic pthread code path.
+
+ * kjs/collector.cpp:
+ (KJS::currentThreadStackBase):
+
+2007-04-20 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Anders.
+
+ Improve FreeBSD compatibility, as suggested by Alexander Botero-Lowry.
+
+ * kjs/collector.cpp:
+ (KJS::currentThreadStackBase): FreeBSD requires that pthread_attr_t's are
+ initialized via pthread_attr_init before being used in any context.
+
+2007-04-19 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Darin.
+
+ Fix http://bugs.webkit.org/show_bug.cgi?id=13401
+ Bug 13401: Reproducible crash calling myArray.sort(compareFn) from within
+ a sort comparison function
+
+ * kjs/array_object.cpp:
+ (ArrayInstance::sort): Save/restore the static variables around calls to qsort
+ to ensure nested calls to ArrayInstance::sort behave correctly.
+
+2007-04-12 Deneb Meketa <dmeketa@adobe.com>
+
+ Reviewed by Darin Adler.
+
+ http://bugs.webkit.org/show_bug.cgi?id=13029
+ rdar://problem/4994849
+ Bug 13029: Permit NPAPI plug-ins to see HTTP response headers.
+ This doesn't actually change JavaScriptCore, but that's where npapi.h is.
+
+ * bindings/npapi.h:
+ Add headers member to NPStream struct. Also increase NP_VERSION_MINOR to 18.
+ Increasing to >= 17 allows plug-ins to safely detect whether to look for
+ NPStream::headers. Increasing from 17 to 18 reflects presence of NPObject
+ enumeration, which was added in a prior patch, and which has been agreed to
+ constitute version 18 by the plugin-futures list. Also add other missing
+ bits of npapi.h to catch up from 14 to 18. This includes features that are
+ not implemented in WebKit, but those are safely stubbed.
+
+2007-04-10 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Mark Rowe.
+
+ Fixed last check-in to print in release builds, too.
+
+ * kjs/collector.cpp:
+ (KJS::getPlatformThreadRegisters):
+
+2007-04-10 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by John Sullivan, Darin Adler.
+
+ Fixed <rdar://problem/5121899> JavaScript garbage collection leads to
+ later crash under Rosetta (should abort or leak instead?)
+
+ Log an error message and crash if the kernel reports failure during GC.
+ We decided to do this instead of just leaking because we don't want people
+ to get the mistaken impression that running in Rosetta is a supported
+ configurtion.
+
+ The CRASH macro will also hook into CrashReporter, which will tell us if
+ many (any?) users run into this issue.
+
+ * kjs/collector.cpp:
+ (KJS::getPlatformThreadRegisters):
+
+2007-04-06 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
+
+ Reviewed by darin.
+
+ Coverity fix. Coverity says:
+ "Event var_deref_model: Variable "sourceRanges" tracked as NULL was passed to a
+ function that dereferences it"
+
+ * kjs/string_object.cpp:
+ (KJS::replace):
+
+2007-04-06 Geoffrey Garen <ggaren@apple.com>
+
+ Rubber stamped by Adele Peterson.
+
+ * kjs/ExecState.h: Removed obsolete forward/friend declaration of
+ RuntimeMethodImp.
+
+2007-04-05 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
+
+ Reviewed by darin.
+
+ Coverity fix. Coverity says:
+ "Event check_after_deref: Pointer "dateString" dereferenced before NULL check"
+
+ * kjs/date_object.cpp:
+ (KJS::parseDate):
+
+2007-04-05 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
+
+ Reviewed by darin.
+
+ Coverity fix. Coverity says:
+ "Event check_after_deref: Pointer "re" dereferenced before NULL check"
+
+ * pcre/pcre_study.c:
+ (pcre_study):
+
+2007-04-05 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
+
+ Reviewed by darin.
+
+ Coverity fixes. Coverity says:
+ "Event leaked_storage: Returned without freeing storage "buffer""
+ and:
+ "Event leaked_storage: Returned without freeing storage "script""
+
+ * kjs/testkjs.cpp:
+ (doIt):
+ (createStringWithContentsOfFile):
+
+2007-04-05 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
+
+ Reviewed by darin.
+
+ Coverity fix: in single-threaded case currentThreadIsMainThread is always true
+ so the code in if (!currentThreadIsMainThread) cannot possibly be reached
+ and Coverity complains about dead code.
+
+ * kjs/collector.cpp:
+ (KJS::Collector::collect):
+
+=== Safari-5522.6 ===
+
+2007-04-03 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Adam.
+
+ - Testing a post-commit hook.
+
+ * JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
+
+2007-04-03 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Adam.
+
+ <rdar://problem/5107534>
+ http://bugs.webkit.org/show_bug.cgi?id=13265
+ REGRESSION: Crash in KJS::Bindings::convertValueToNPVariant
+
+ * bindings/NP_jsobject.cpp:
+ (_NPN_InvokeDefault):
+ Return false if the object isn't a function. Set the return value to undefined by default
+ (to match Firefox).
+
+2007-03-30 Anders Carlsson <andersca@apple.com>
+
+ Build fix.
+
+ * bindings/NP_jsobject.cpp:
+ (_NPN_Enumerate):
+
+2007-03-30 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Geoff.
+
+ Implement _NPN_Enumerate support.
+
+ * JavaScriptCore.exp:
+ * bindings/NP_jsobject.cpp:
+ (_NPN_Enumerate):
+ * bindings/c/c_instance.cpp:
+ (KJS::Bindings::CInstance::getPropertyNames):
+ * bindings/c/c_instance.h:
+ * bindings/npapi.h:
+ * bindings/npruntime.h:
+ * bindings/npruntime_impl.h:
+ * bindings/runtime.h:
+ (KJS::Bindings::Instance::getPropertyNames):
+ * bindings/runtime_object.cpp:
+ (RuntimeObjectImp::getPropertyNames):
+ * bindings/runtime_object.h:
+ (KJS::RuntimeObjectImp::getInternalInstance):
+
+2007-03-28 Jeff Walden <jwalden+code@mit.edu>
+
+ Reviewed by Darin.
+
+ http://bugs.webkit.org/show_bug.cgi?id=12963
+ Fix some inconsistencies in the Mozilla JS Array extras implementations
+ with respect to the Mozilla implementation:
+
+ - holes in arrays should be skipped, not treated as undefined,
+ by all such methods
+ - an element with value undefined is not a hole
+ - Array.prototype.forEach should return undefined
+
+ * kjs/array_object.cpp:
+ (ArrayInstance::getOwnPropertySlot):
+ (ArrayProtoFunc::callAsFunction):
+
+2007-03-27 Anders Carlsson <acarlsson@apple.com>
+
+ Reviewed by Geoff.
+
+ * bindings/NP_jsobject.cpp:
+ (_NPN_InvokeDefault):
+ Call JSObject:call for native JavaScript objects.
+
+2007-03-26 David Carson <dacarson@gmail.com>
+
+ Reviewed by Darin, landed by Anders.
+
+ Fix for: REGRESSION (r19559): Java applet crash
+ http://bugs.webkit.org/show_bug.cgi?id=13142
+ <rdar://problem/5080340>
+
+ The previous fix http://bugs.webkit.org/show_bug.cgi?id=12636
+ introduced new JNIType to enum in jni_utility.h This is a
+ problem on the Mac as it seems that the JNIType enum is also
+ used in the JVM, it is used to specify the return type in
+ jni_objc.mm
+ Corrected the fix by moving type to the end, and changing
+ jni_objc.mm to convert the new type to an old compatible
+ type.
+
+ * bindings/jni/jni_objc.mm:
+ (KJS::Bindings::dispatchJNICall):
+ * bindings/jni/jni_utility.h:
+
+2007-03-26 Christopher Brichford <chrisb@adobe.com>
+
+ Reviewed/landed by Adam.
+
+ Bug 13198: Move build settings from project file to xcconfig file for apollo
+ port JSCore
+ http://bugs.webkit.org/show_bug.cgi?id=13198
+
+ - Moving build settings from xcode project file to xcconfig files.
+
+ * JavaScriptCore.apolloproj/mac/JavaScriptCore/JavaScriptCore.Debug.xcconfig:
+ * JavaScriptCore.apolloproj/mac/JavaScriptCore/JavaScriptCore.Release.xcconfig:
+ * JavaScriptCore.apolloproj/mac/JavaScriptCore/JavaScriptCore.xcconfig:
+ * JavaScriptCore.apolloproj/mac/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj:
+
+2007-03-26 Brady Eidson <beidson@apple.com>
+
+ Rubberstamped by Anders and Maciej aand Geoff (oh my!)
+
+ Since CFTypeRef is really void*, a RetainPtr couldn't be used.
+ RefType was "void", which doesn't actually exist as a type.
+ Since RefType only existed for operator*(), and since that operator
+ doesn't make any sense for RetainPtr, I removed them!
+
+ * kjs/nodes.cpp: Touch this to force a rebuild and (hopefully) help the
+ compiler with dependencies
+ * wtf/RetainPtr.h: Nuke RefType and operator*()
+
+2007-03-26 Geoffrey Garen <ggaren@apple.com>
+
+ Touched a file to (hopefully) help the compiler with RetainPtr dependencies.
+
+ * kjs/nodes.cpp:
+ (Node::deref):
+
+2007-03-24 Brady Eidson <beidson@apple.com>
+
+ Reviewed by Adam
+
+ Whoops, RetainPtr should be in the WTF namespace
+
+ * wtf/RetainPtr.h:
+
+2007-03-24 Brady Eidson <beidson@apple.com>
+
+ Reviewed by Adam
+
+ <rdar://problem/5086210> - Move RetainPtr to WTF
+
+ * wtf/RetainPtr.h: Added
+ * JavaScriptCore.xcodeproj/project.pbxproj: Add it to the project file
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj: Ditto
+
+
+2007-03-23 Christopher Brichford <chrisb@adobe.com>
+
+ Reviewed/landed by Adam.
+
+ Bug 13175: Make apollo mac project files for JavaScriptCore actually
+ build something
+ http://bugs.webkit.org/show_bug.cgi?id=13175
+
+ - Changing apollo mac project files for JavaScriptCore such that they actually build
+ JavaScriptCore source code.
+
+ * JavaScriptCore.apolloproj/ForwardingSources/grammar.cpp: Added.
+ * JavaScriptCore.apolloproj/mac/JavaScriptCore/JavaScriptCore.xcconfig:
+ * JavaScriptCore.apolloproj/mac/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj:
+
+2007-03-24 Mark Rowe <mrowe@apple.com>
+
+ Rubber-stamped by Darin.
+
+ * Configurations/JavaScriptCore.xcconfig: Remove unnecessary INFOPLIST_PREPROCESS.
+
+2007-03-22 Christopher Brichford <chrisb@adobe.com>
+
+ Reviewed/landed by Adam.
+
+ Bug 13164: Initial version of mac JavaScriptCore project files for
+ apollo port
+ http://bugs.webkit.org/show_bug.cgi?id=13164
+
+ - Adding mac project files for apollo port of JavaScriptCore. Currently project
+ just builds dftables.
+
+ * JavaScriptCore.apolloproj/mac/JavaScriptCore/JavaScriptCore.Debug.xcconfig: Added.
+ * JavaScriptCore.apolloproj/mac/JavaScriptCore/JavaScriptCore.Release.xcconfig: Added.
+ * JavaScriptCore.apolloproj/mac/JavaScriptCore/JavaScriptCore.xcconfig: Added.
+ * JavaScriptCore.apolloproj/mac/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj: Added.
+
+2007-03-21 Timothy Hatcher <timothy@apple.com>
+
+ Reviewed by Darin.
+
+ <rdar://problem/5076599> JavaScriptCore has a weak export (vtable for KJS::JSCell)
+
+ * JavaScriptCore.exp: Remove __ZTVN3KJS6JSCellE.
+
+2007-03-21 Adele Peterson <adele@apple.com>
+
+ Reviewed by Geoff.
+
+ * API/JSStringRef.cpp: (JSStringIsEqual): Added JSLock.
+
+2007-03-21 Zack Rusin <zrusin@trolltech.com>
+
+ Fix the compile when USE(MULTIPLE_THREADS) isn't
+ defined
+
+ * kjs/JSLock.cpp:
+ (KJS::JSLock::currentThreadIsHoldingLock):
+
+2007-03-20 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Geoff and Adam.
+
+ - make USE(MULTIPLE_THREADS) support more portable
+ http://bugs.webkit.org/show_bug.cgi?id=13069
+
+ - fixed a threadsafety bug discovered by testing this
+
+ - enhanced threadsafety assertions in collector
+
+ * API/JSCallbackObject.cpp:
+ (KJS::JSCallbackObject::~JSCallbackObject): This destructor can't
+ DropAllLocks around the finalize callback, because it gets called
+ from garbage collection and we can't let other threads collect!
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * kjs/JSLock.cpp:
+ (KJS::JSLock::currentThreadIsHoldingLock): Added new function
+ to allow stronger assertions than just that the lock is held
+ by some thread (you can now assert that the current thread is
+ holding it, given the new JSLock design).
+ * kjs/JSLock.h:
+ * kjs/collector.cpp: Refactored for portability plus added some
+ stronger assertions.
+ (KJS::Collector::allocate):
+ (KJS::currentThreadStackBase):
+ (KJS::Collector::registerAsMainThread):
+ (KJS::onMainThread):
+ (KJS::PlatformThread::PlatformThread):
+ (KJS::getCurrentPlatformThread):
+ (KJS::Collector::Thread::Thread):
+ (KJS::destroyRegisteredThread):
+ (KJS::Collector::registerThread):
+ (KJS::Collector::markCurrentThreadConservatively):
+ (KJS::suspendThread):
+ (KJS::resumeThread):
+ (KJS::getPlatformThreadRegisters):
+ (KJS::otherThreadStackPointer):
+ (KJS::otherThreadStackBase):
+ (KJS::Collector::markOtherThreadConservatively):
+ (KJS::Collector::markStackObjectsConservatively):
+ (KJS::Collector::protect):
+ (KJS::Collector::unprotect):
+ (KJS::Collector::collectOnMainThreadOnly):
+ (KJS::Collector::markMainThreadOnlyObjects):
+ (KJS::Collector::collect):
+ * kjs/collector.h:
+ * wtf/FastMalloc.cpp:
+ (WTF::fastMallocSetIsMultiThreaded):
+ * wtf/FastMallocInternal.h:
+ * wtf/Platform.h:
+
+2007-03-19 Darin Adler <darin@apple.com>
+
+ * kjs/value.h: Roll ~JSValue change out. It was causing problems. I'll do it right later.
+
+2007-03-19 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by John Sullivan.
+
+ Fixed <rdar://problem/5073380> REGRESSION: Crash occurs at WTF::fastFree()
+ when reloading liveconnect page (applet)
+
+ Best to use free when you use malloc, especially when malloc and delete
+ use completely different libraries.
+
+ * bindings/jni/jni_runtime.cpp:
+ (JavaMethod::~JavaMethod):
+
+2007-03-19 Andrew Wellington <proton@wiretapped.net>
+
+ Reviewed by Maciej.
+
+ Really set Xcode editor to use 4 space indentation (http://webkit.org/coding/coding-style.html)
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2007-03-19 Darin Adler <darin@apple.com>
+
+ Reviewed by Geoff.
+
+ - Changed list size threshold to 5 based on testing.
+
+ I was testing the i-Bench JavaScript with the list statistics
+ dumping on, and discovered that there were many 5-element lists.
+ The fast case for lists was for 4 elements and fewer. By changing
+ the threshold to 5 elements we get a measurable speedup. I believe
+ this will help real web pages too, not just the benchmark.
+
+ * kjs/list.cpp: Change constant from 4 to 5.
+
+2007-03-19 Darin Adler <darin@apple.com>
+
+ * kjs/value.h: Oops, fix build.
+
+2007-03-19 Darin Adler <darin@apple.com>
+
+ Reviewed by Geoff.
+
+ - remove ~JSValue; tiny low-risk performance boost
+
+ * kjs/value.h: Remove unneeded empty virtual destructor from JSValue.
+ The only class derived from JSValue is JSCell and it already has a
+ virtual destructor. Declaring an empty constructor in JSValue had one
+ good effect: it marked the destructor private, making it a compile
+ time error to try to destroy a JSValue; but that's not a likely
+ mistake for someone to make. It had two bad effects: (1) it caused gcc,
+ at least, to generate code to fix up the virtual table pointer to
+ point to the JSValue version of the virtual table inside the destructor
+ of all classes derived from JSValue directly or indirectly; (2) it
+ caused JSValue to be a polymorphic class so required a virtual table for
+ it. It's cleaner to not have either of those.
+
+2007-03-18 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Mark.
+
+ - avoid static construction (and global variable access) in a smarter, more portable way,
+ to later enable MUTLI_THREAD mode to work on other platforms and compilers.
+
+ * kjs/CommonIdentifiers.cpp: Added. New class to hold all the shared identifiers.
+ (KJS::CommonIdentifiers::CommonIdentifiers):
+ (KJS::CommonIdentifiers::shared):
+ * kjs/CommonIdentifiers.h: Added.
+
+ * kjs/ExecState.h:
+ (KJS::ExecState::propertyNames): Hand the CommonIdentifiers instance here for easy access.
+ (KJS::ExecState::ExecState):
+
+ * API/JSObjectRef.cpp:
+ (JSObjectMakeConstructor):
+ * CMakeLists.txt:
+ * JavaScriptCore.exp:
+ * JavaScriptCore.pri:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * JavaScriptCoreSources.bkl:
+ * bindings/runtime_array.cpp:
+ (RuntimeArray::getOwnPropertySlot):
+ (RuntimeArray::put):
+ * bindings/runtime_method.cpp:
+ (RuntimeMethod::getOwnPropertySlot):
+ * kjs/array_object.cpp:
+ (ArrayInstance::getOwnPropertySlot):
+ (ArrayInstance::put):
+ (ArrayInstance::deleteProperty):
+ (ArrayProtoFunc::ArrayProtoFunc):
+ (ArrayProtoFunc::callAsFunction):
+ (ArrayObjectImp::ArrayObjectImp):
+ * kjs/bool_object.cpp:
+ (BooleanPrototype::BooleanPrototype):
+ (BooleanProtoFunc::BooleanProtoFunc):
+ (BooleanProtoFunc::callAsFunction):
+ (BooleanObjectImp::BooleanObjectImp):
+ * kjs/completion.h:
+ (KJS::Completion::Completion):
+ * kjs/date_object.cpp:
+ (KJS::DateProtoFunc::DateProtoFunc):
+ (KJS::DateObjectImp::DateObjectImp):
+ (KJS::DateObjectFuncImp::DateObjectFuncImp):
+ * kjs/error_object.cpp:
+ (ErrorPrototype::ErrorPrototype):
+ (ErrorProtoFunc::ErrorProtoFunc):
+ (ErrorProtoFunc::callAsFunction):
+ (ErrorObjectImp::ErrorObjectImp):
+ (ErrorObjectImp::construct):
+ (NativeErrorPrototype::NativeErrorPrototype):
+ (NativeErrorImp::NativeErrorImp):
+ (NativeErrorImp::construct):
+ (NativeErrorImp::callAsFunction):
+ * kjs/function.cpp:
+ (KJS::FunctionImp::getOwnPropertySlot):
+ (KJS::FunctionImp::put):
+ (KJS::FunctionImp::deleteProperty):
+ (KJS::FunctionImp::getParameterName):
+ (KJS::DeclaredFunctionImp::construct):
+ (KJS::IndexToNameMap::unMap):
+ (KJS::Arguments::Arguments):
+ (KJS::ActivationImp::getOwnPropertySlot):
+ (KJS::ActivationImp::deleteProperty):
+ (KJS::GlobalFuncImp::GlobalFuncImp):
+ * kjs/function_object.cpp:
+ (FunctionPrototype::FunctionPrototype):
+ (FunctionProtoFunc::FunctionProtoFunc):
+ (FunctionProtoFunc::callAsFunction):
+ (FunctionObjectImp::FunctionObjectImp):
+ (FunctionObjectImp::construct):
+ * kjs/grammar.y:
+ * kjs/identifier.cpp:
+ * kjs/identifier.h:
+ * kjs/interpreter.cpp:
+ (KJS::Interpreter::init):
+ (KJS::Interpreter::initGlobalObject):
+ * kjs/interpreter.h:
+ * kjs/lookup.h:
+ * kjs/math_object.cpp:
+ (MathFuncImp::MathFuncImp):
+ * kjs/nodes.cpp:
+ (ArrayNode::evaluate):
+ (FuncDeclNode::processFuncDecl):
+ (FuncExprNode::evaluate):
+ * kjs/number_object.cpp:
+ (NumberPrototype::NumberPrototype):
+ (NumberProtoFunc::NumberProtoFunc):
+ (NumberObjectImp::NumberObjectImp):
+ * kjs/object.cpp:
+ (KJS::JSObject::put):
+ (KJS::JSObject::defaultValue):
+ (KJS::JSObject::hasInstance):
+ * kjs/object.h:
+ (KJS::JSObject::getOwnPropertySlot):
+ * kjs/object_object.cpp:
+ (ObjectPrototype::ObjectPrototype):
+ (ObjectProtoFunc::ObjectProtoFunc):
+ (ObjectObjectImp::ObjectObjectImp):
+ * kjs/regexp_object.cpp:
+ (RegExpPrototype::RegExpPrototype):
+ (RegExpProtoFunc::RegExpProtoFunc):
+ (RegExpObjectImp::RegExpObjectImp):
+ * kjs/string_object.cpp:
+ (KJS::StringInstance::getOwnPropertySlot):
+ (KJS::StringInstance::put):
+ (KJS::StringInstance::deleteProperty):
+ (KJS::StringPrototype::StringPrototype):
+ (KJS::StringProtoFunc::StringProtoFunc):
+ (KJS::StringProtoFunc::callAsFunction):
+ (KJS::StringObjectImp::StringObjectImp):
+ (KJS::StringObjectFuncImp::StringObjectFuncImp):
+ * kjs/testkjs.cpp:
+ (TestFunctionImp::TestFunctionImp):
+
+2007-03-18 Andrew Wellington <proton@wiretapped.net>
+
+ Reviewed by Mark Rowe
+
+ Set Xcode editor to use 4 space indentation (http://webkit.org/coding/coding-style.html)
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2007-03-19 Mark Rowe <mrowe@apple.com>
+
+ Rubber-stamped by Brady.
+
+ Update references to bugzilla.opendarwin.org with bugs.webkit.org.
+
+ * bindings/c/c_utility.cpp:
+ (KJS::Bindings::convertUTF8ToUTF16):
+ * kjs/function.cpp:
+ (KJS::FunctionImp::callAsFunction):
+ * kjs/grammar.y:
+ * kjs/keywords.table:
+ * kjs/lexer.cpp:
+ (KJS::Lexer::shift):
+
+2007-03-18 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Exposed some extra toUInt32 functionality, as part of the fix for
+ REGRESSION: Incomplete document.all implementation breaks abtelectronics.com
+ (Style Change Through JavaScript Blanks Content)
+
+ * JavaScriptCore.exp:
+ * kjs/identifier.h:
+ (KJS::Identifier::toUInt32):
+
+2007-03-18 Geoffrey Garen <ggaren@apple.com>
+
+ Removed duplicate export name.
+
+ * JavaScriptCore.exp:
+
+2007-03-15 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Fixed <rdar://problem/5064964> Repro ASSERT failure in JS Bindings when
+ closing window @ lowtrades.bptrade.com
+
+ Unfortunately, the bindings depend on UString and Identifier as string
+ representations. So, they need to acquire the JSLock when doing something
+ that will ref/deref their strings.
+
+ Layout tests, the original site, and Java, Flash, and Quicktime on the
+ web work. No leaks reported. No automated test for this because testing
+ the Java bindings, like math, is hard.
+
+ * bindings/runtime.h: Made Noncopyable, just to be sure.
+
+ * bindings/c/c_class.cpp:
+ (KJS::Bindings::CClass::~CClass): Acquire the JSLock and explicitly clear the keys
+ in our hashtable, since they're UString::Reps, and ref/deref aren't thread-safe.
+ (KJS::Bindings::CClass::methodsNamed): Also acquire the JSLock when adding
+ keys to the table, since the table ref's them.
+ (KJS::Bindings::CClass::fieldNamed): ditto.
+
+ * bindings/c/c_utility.cpp: Removed dead function.
+ (KJS::Bindings::convertValueToNPVariant): Acquire the JSLock because doing
+ it recursively is pretty cheap, and it's just too confusing to tell whether
+ all our callers do it for us.
+ (KJS::Bindings::convertNPVariantToValue): ditto
+ * bindings/c/c_utility.h:
+
+ * bindings/jni/jni_class.cpp: Same deal as c_class.cpp.
+ (JavaClass::JavaClass):
+ (JavaClass::~JavaClass):
+
+ * bindings/jni/jni_instance.cpp: Same deal as c_utility.cpp.
+ (JavaInstance::stringValue):
+ * bindings/jni/jni_jsobject.cpp:
+ (JavaJSObject::convertValueToJObject):
+
+ * bindings/jni/jni_runtime.cpp:
+ (JavaMethod::~JavaMethod): Moved from header, for clarity.
+ (appendClassName): Made this static, so the set of callers is known, and
+ we can assert that we hold the JSLock. Also changed it to take a UString
+ reference, which makes the calling code simpler.
+ (JavaMethod::signature): Store the ASCII value we care about instead of
+ a UString, since UString is so much more hassle. Hold the JSLock while
+ building up the temporary UString.
+
+ * bindings/jni/jni_runtime.h: Nixed dead code in JavaMethod.
+ (KJS::Bindings::JavaString::JavaString): Hold a UString::Rep instead of
+ a UString, so we can acquire the JSLock and explicitly release it.
+ (KJS::Bindings::JavaString::_commonInit):
+ (KJS::Bindings::JavaString::~JavaString):
+ (KJS::Bindings::JavaString::UTF8String):
+ (KJS::Bindings::JavaString::uchars):
+ (KJS::Bindings::JavaString::length):
+ (KJS::Bindings::JavaString::ustring):
+
+ * bindings/jni/jni_utility.cpp:
+ (KJS::Bindings::convertArrayInstanceToJavaArray): Made this static, so
+ the set of callers is known, and we can assert that we hold the JSLock.
+ (KJS::Bindings::convertValueToJValue): Acquire the JSLock because doing
+ it recursively is pretty cheap, and it's just too confusing to tell whether
+ all our callers do it for us.
+
+ * bindings/objc/objc_runtime.h: Nixed some dead code.
+ * bindings/objc/objc_utility.mm:
+ (KJS::Bindings::convertNSStringToString): Same drill as above.
+
+2007-03-18 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Geoff.
+
+ http://bugs.webkit.org/show_bug.cgi?id=13105
+ REGRESSION: an exception raised when calculating base value of a dot expression is not returned
+
+ Test: fast/js/dot-node-base-exception.html
+
+ * kjs/nodes.cpp:
+ (FunctionCallDotNode::evaluate): Added the necessary KJS_CHECKEXCEPTIONVALUE.
+
+2007-03-18 Steve Falkenburg <sfalken@apple.com>
+
+ Build fix.
+
+ * JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
+
+2007-03-17 Timothy Hatcher <timothy@apple.com>
+
+ Reviewed by Mark Rowe.
+
+ Made Version.xcconfig smarter when building for different configurations.
+ Now uses the 522+ OpenSource version for Debug and Release, while using the
+ full 522.4 version for Production builds. The system prefix is also computed
+ based on the current system, so 4522.4 on Tiger and 5522.4 on Leopard.
+
+ * Configurations/JavaScriptCore.xcconfig:
+ * Configurations/Version.xcconfig:
+
+2007-03-15 Maciej Stachowiak <mjs@apple.com>
+
+ Not reviewed.
+
+ - build fix
+
+ * wtf/TCSystemAlloc.cpp:
+
+2007-03-15 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Geoff and Steve.
+
+ - fix some portability issues with TCMalloc.
+
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * kjs/config.h:
+ * wtf/FastMalloc.cpp:
+ (WTF::SizeClass):
+ (WTF::InitSizeClasses):
+ (WTF::TCMalloc_PageHeap::Split):
+ (WTF::TCMalloc_PageHeap::RegisterSizeClass):
+ (WTF::TCMalloc_Central_FreeList::length):
+ (WTF::TCMalloc_ThreadCache::InitTSD):
+ (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary):
+ * wtf/TCSpinLock.h:
+ * wtf/TCSystemAlloc.cpp:
+ (TryVirtualAlloc):
+ (TCMalloc_SystemAlloc):
+
+2007-03-15 Timothy Hatcher <timothy@apple.com>
+
+ Reviewed by John.
+
+ * Factored out most of our common build settings into .xcconfig files. Anything that was common in
+ each build configuration was factored out into the shared .xcconfig file.
+ * Adds a Version.xcconfig file to define the current framework version, to be used in other places.
+ * Use the new $(BUNDLE_VERSION) (defined in Version.xcconfig) in the preprocessed Info.plist.
+ * Use the versions defined in Version.xcconfig to set $(DYLIB_CURRENT_VERSION).
+
+ * Configurations/Base.xcconfig: Added.
+ * Configurations/DebugRelease.xcconfig: Added.
+ * Configurations/JavaScriptCore.xcconfig: Added.
+ * Configurations/Version.xcconfig: Added.
+ * Info.plist:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2007-03-16 Shrikant Gangoda <shrikant.gangoda@celunite.com>
+
+ Gdk build fix.
+
+ * kjs/DateMath.cpp: gettimeofday comes from <sys/time.h> on Linux.
+
+2007-03-14 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by .
+
+ - Fixed one more build breakage
+
+ * kjs/date_object.cpp:
+ (KJS::formatLocaleDate):
+
+2007-03-14 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by .
+
+ - Fixed a build breakage.
+
+ * kjs/DateMath.cpp:
+ * kjs/date_object.cpp:
+ (KJS::formatLocaleDate):
+ (KJS::DateObjectImp::construct):
+
+2007-03-14 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Geoff.
+
+ - rdar://problem/5045720
+ - DST changes in US affect JavaScript date calculations (12975)
+ This fix was to ensure we properly test for the new changes to DST in the US.
+ Also this fixes when we apply DST, now we correctly map most past years to current
+ DST rules. We still have a small issue with years before 1900 or after 2100.
+ rdar://problem/5055038
+
+ * kjs/DateMath.cpp: Fix DST to match spec better.
+ (KJS::getCurrentUTCTime):
+ (KJS::mimimumYearForDST):
+ (KJS::maximumYearForDST):
+ (KJS::equivalentYearForDST):
+ (KJS::getDSTOffset):
+ * kjs/DateMath.h: Consolodated common funtionality.
+ * kjs/date_object.cpp: Consolodated common functionality.
+ (KJS::formatLocaleDate):
+ (KJS::DateObjectImp::construct):
+ * tests/mozilla/ecma/jsref.js: Added functions for finding the correct days when DST starts and ends.
+ * tests/mozilla/ecma/shell.js: Added back in the old DST functions for ease of merging with mozilla if needed.
+ * tests/mozilla/ecma_2/jsref.js: Added functions for finding the correct days when DST starts and ends.
+ * tests/mozilla/ecma_3/Date/shell.js: Added functions for finding the correct days when DST starts and ends.
+ * tests/mozilla/expected.html: Updated to show all date tests passing.
+
+=== Safari-5522.4 ===
+
+2007-03-13 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by .
+
+ - Adding expected failures until the are truly fixed.
+ - rdar://problem/5060302
+
+ * tests/mozilla/expected.html:
+
+2007-03-12 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by .
+
+ - Actually update tests for new DST rules.
+
+ * tests/mozilla/ecma/Date/15.9.3.1-1.js:
+ * tests/mozilla/ecma/Date/15.9.3.1-2.js:
+ * tests/mozilla/ecma/Date/15.9.3.1-3.js:
+ * tests/mozilla/ecma/Date/15.9.3.1-4.js:
+ * tests/mozilla/ecma/Date/15.9.3.1-5.js:
+ * tests/mozilla/ecma/Date/15.9.3.2-1.js:
+ * tests/mozilla/ecma/Date/15.9.3.2-2.js:
+ * tests/mozilla/ecma/Date/15.9.3.2-3.js:
+ * tests/mozilla/ecma/Date/15.9.3.2-4.js:
+ * tests/mozilla/ecma/Date/15.9.3.2-5.js:
+ * tests/mozilla/ecma/Date/15.9.3.8-1.js:
+ * tests/mozilla/ecma/Date/15.9.3.8-2.js:
+ * tests/mozilla/ecma/Date/15.9.3.8-3.js:
+ * tests/mozilla/ecma/Date/15.9.3.8-4.js:
+ * tests/mozilla/ecma/Date/15.9.3.8-5.js:
+ * tests/mozilla/ecma/Date/15.9.5.10-1.js:
+ * tests/mozilla/ecma/Date/15.9.5.10-10.js:
+ * tests/mozilla/ecma/Date/15.9.5.10-11.js:
+ * tests/mozilla/ecma/Date/15.9.5.10-12.js:
+ * tests/mozilla/ecma/Date/15.9.5.10-13.js:
+ * tests/mozilla/ecma/Date/15.9.5.10-2.js:
+ * tests/mozilla/ecma/Date/15.9.5.10-3.js:
+ * tests/mozilla/ecma/Date/15.9.5.10-4.js:
+ * tests/mozilla/ecma/Date/15.9.5.10-5.js:
+ * tests/mozilla/ecma/Date/15.9.5.10-6.js:
+ * tests/mozilla/ecma/Date/15.9.5.10-7.js:
+ * tests/mozilla/ecma/Date/15.9.5.10-8.js:
+ * tests/mozilla/ecma/Date/15.9.5.10-9.js:
+ * tests/mozilla/ecma/jsref.js:
+ * tests/mozilla/ecma_2/jsref.js:
+ * tests/mozilla/ecma_3/Date/shell.js:
+
+2007-03-12 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by .
+
+ - Update tests for new DST rules.
+
+ * tests/mozilla/ecma/shell.js:
+
+2007-03-11 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Fixed <rdar://problem/4681051> Installer crashes in KJS::Collector::
+ markOtherThreadConservatively(KJS::Collector::Thread*) trying to install
+ iLife 06 using Rosetta on an Intel Machine
+
+ The problem was that our thread-specific data destructor would modify the
+ list of active JavaScript threads without holding the JSLock, corrupting
+ the list. Corruption was especially likely if one JavaScript thread exited
+ while another was starting up.
+
+ * JavaScriptCore.exp:
+ * kjs/JSLock.cpp: Don't conflate locking the JSLock with registering a
+ thread, since the thread-specific data destructor needs to lock
+ without registering a thread. Instead, treat thread registration as a
+ part of the convenience of the JSLock object, and whittle down JSLock::lock()
+ to just the bits that actually do the locking.
+ (KJS::JSLock::lock):
+ (KJS::JSLock::registerThread):
+ * kjs/JSLock.h: Updated comments to mention the new behavior above, and
+ other recent changes.
+ (KJS::JSLock::JSLock):
+ * kjs/collector.cpp:
+ (KJS::destroyRegisteredThread): Lock here.
+ (KJS::Collector::registerThread): To match, assert that we're locked here.
+
+2007-03-10 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Fixed <rdar://problem/4587763> PAC file: lock inversion between QT and
+ JSCore causes a hang @ www.panoramas.dk
+
+ With a PAC file, run-webkit-tests --threaded passes, the reported site
+ works, and all the Quicktime/JavaScript and Flash/JavaScript examples
+ I found through Google work, too.
+
+ Any time JavaScript causes arbitrary non-JavaScript code to execute, it
+ risks deadlock, because that code may block, trying to acquire a lock
+ owned by a thread that is waiting to execute JavaScript. In this case,
+ the thread was a networking thread that was waiting to interpret a PAC file.
+
+ Because non-JavaScript code may execute in response to, well, anything,
+ a perfect solution to this problem is impossible. I've implemented an
+ optimistic solution, instead: JavaScript will drop its lock whenever it
+ makes a direct call to non-JavaScript code through a bridging/plug-in API,
+ but will blissfully ignore the indirect ways it may cause non-JavaScript
+ code to run (resizing a window, for example).
+
+ Unfortunately, this solution introduces significant locking overhead in
+ the bridging APIs. I don't see a way around that.
+
+ This patch includes some distinct bug fixes I saw along the way:
+
+ * bindings/objc/objc_instance.mm: Fixed a bug where a nested begin() call
+ would leak its autorelease pool, because it would NULL out _pool without
+ draining it.
+
+ * bindings/runtime_object.cpp:
+ (RuntimeObjectImp::methodGetter): Don't copy an Identifier to ASCII only
+ to turn around and make an Identifier from the ASCII. In an earlier
+ version of this patch, the copy caused an assertion failure. Now it's
+ just unnecessary work.
+ (RuntimeObjectImp::getOwnPropertySlot): ditto
+
+ * bindings/objc/objc_instance.h: Removed overrides of setVAlueOfField and
+ getValueOfField, because they did exactly what the base class versions did.
+ Removed overrides of Noncopyable declarations for the same reason.
+
+ * bindings/runtime.h: Inherit from Noncopyable instead of rolling our own.
+ * bindings/c/c_instance.h: ditto
+
+ And the actual patch:
+
+ * API/JSCallbackConstructor.cpp: Drop all locks when calling out to C.
+ (KJS::JSCallbackConstructor::construct):
+ * API/JSCallbackFunction.cpp: ditto
+ (KJS::JSCallbackFunction::callAsFunction):
+ * API/JSCallbackObject.cpp: ditto
+ (KJS::JSCallbackObject::init):
+ (KJS::JSCallbackObject::~JSCallbackObject):
+ (KJS::JSCallbackObject::getOwnPropertySlot):
+ (KJS::JSCallbackObject::put):
+ (KJS::JSCallbackObject::deleteProperty):
+ (KJS::JSCallbackObject::construct):
+ (KJS::JSCallbackObject::hasInstance):
+ (KJS::JSCallbackObject::callAsFunction):
+ (KJS::JSCallbackObject::getPropertyNames):
+ (KJS::JSCallbackObject::toNumber):
+ (KJS::JSCallbackObject::toString):
+ (KJS::JSCallbackObject::staticValueGetter):
+ (KJS::JSCallbackObject::callbackGetter):
+
+ * bindings/c/c_instance.cpp: Drop all locks when calling out to C.
+ (KJS::Bindings::CInstance::invokeMethod):
+ (KJS::Bindings::CInstance::invokeDefaultMethod):
+ * bindings/c/c_runtime.cpp: Drop all locks when calling out to C.
+ (KJS::Bindings::CField::valueFromInstance):
+ (KJS::Bindings::CField::setValueToInstance):
+ * bindings/jni/jni_objc.mm:
+ (KJS::Bindings::dispatchJNICall): Drop all locks when calling out to Java.
+
+ * bindings/objc/objc_instance.mm: The changes here are to accomodate the
+ fact that C++ unwinding of DropAllLocks goes crazy when you put it inside
+ a @try block. I moved all JavaScript stuff outside of the @try blocks, and
+ then prefixed the whole blocks with DropAllLocks objects. This required some
+ supporting changes in other functions, which now acquire the JSLock for
+ themselves, intead of relying on their callers to do so.
+ (ObjcInstance::end):
+ (ObjcInstance::invokeMethod):
+ (ObjcInstance::invokeDefaultMethod):
+ (ObjcInstance::setValueOfUndefinedField):
+ (ObjcInstance::getValueOfUndefinedField):
+ * bindings/objc/objc_runtime.mm: Same as above, except I didn't want to
+ change throwError to acquire the JSLock for itself.
+ (ObjcField::valueFromInstance):
+ (ObjcField::setValueToInstance):
+ * bindings/objc/objc_utility.mm: Supporting changes mentioned above.
+ (KJS::Bindings::convertValueToObjcValue):
+ (KJS::Bindings::convertObjcValueToValue):
+
+ * kjs/JSLock.cpp:
+ (1) Fixed DropAllLocks to behave as advertised, and drop the JSLock only
+ if the current thread actually acquired it in the first place. This is
+ important because WebKit needs to ensure that the JSLock has been
+ dropped before it makes a plug-in call, even though it doesn't know if
+ the current thread actually acquired the JSLock. (We don't want WebKit
+ to accidentally drop a lock belonging to *another thread*.)
+ (2) Used the new per-thread code written for (1) to make recursive calls
+ to JSLock very cheap. JSLock now knows to call pthread_mutext_lock/
+ pthread_mutext_unlock only at nesting level 0.
+ (KJS::createDidLockJSMutex):
+ (KJS::JSLock::lock):
+ (KJS::JSLock::unlock):
+ (KJS::DropAllLocks::DropAllLocks):
+ (KJS::DropAllLocks::~DropAllLocks):
+ (KJS::JSLock::lockCount):
+ * kjs/JSLock.h: Don't duplicate Noncopyable.
+ (KJS::JSLock::~JSLock):
+
+ * wtf/Assertions.h: Blind attempt at helping the Windows build.
+
+2007-03-08 Darin Fisher <darin@chromium.org>
+
+ Reviewed by Darin.
+
+ http://bugs.webkit.org/show_bug.cgi?id=13018
+ Bug 13018: allow embedders to override the definition of CRASH.
+
+ * wtf/Assertions.h: make it possible to override CRASH.
+
+2007-03-07 Huan Ren <huanr@chromium.org>
+
+ Reviewed by Maciej.
+
+ Fix http://bugs.webkit.org/show_bug.cgi?id=12535
+ Bug 12535: Stack-optimizing compilers can trick GC into freeing in-use objects
+
+ * kjs/internal.cpp:
+ (KJS::StringImp::toObject): Copy val onto the stack so it is not subject to garbage collection.
+
+2007-03-07 Geoffrey Garen <ggaren@apple.com>
+
+ Build fix for non-multiple-thread folks.
+
+ Use a shared global in the non-multiple-thread case.
+
+ * wtf/FastMalloc.cpp:
+ (WTF::isForbidden):
+ (WTF::fastMallocForbid):
+ (WTF::fastMallocAllow):
+
+2007-03-07 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Fixed ASSERT failure I just introduced.
+
+ Made the fastMalloc isForbidden flag per thread. (Oops!) We expect that
+ other threads will malloc while we're marking -- we just want to prevent
+ our own marking from malloc'ing.
+
+ * wtf/FastMalloc.cpp:
+ (WTF::initializeIsForbiddenKey):
+ (WTF::isForbidden):
+ (WTF::fastMallocForbid):
+ (WTF::fastMallocAllow):
+ (WTF::fastMalloc):
+ (WTF::fastCalloc):
+ (WTF::fastFree):
+ (WTF::fastRealloc):
+ (WTF::do_malloc):
+
+2007-03-07 Shrikant Gangoda <shrikant.gangoda@celunite.com>
+
+ Reviewed by Maciej.
+
+ http://bugs.webkit.org/show_bug.cgi?id=12997
+
+ Wrap pthread-specific assertion in #if USE(MULTIPLE_THREADS).
+
+ * kjs/collector.cpp:
+ (KJS::Collector::markMainThreadOnlyObjects):
+
+2007-03-06 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Fixed <rdar://problem/4576242> | http://bugs.webkit.org/show_bug.cgi?id=12586
+ PAC file: malloc deadlock sometimes causes a hang @ www.apple.com/pro/profiles/ (12586)
+
+ This is a modified version of r14752 on the branch.
+
+ These changes just add debugging functionality. They ASSERT that we don't
+ malloc during the mark phase of a garbage collection, which can cause a
+ deadlock.
+
+ * kjs/collector.cpp:
+ (KJS::Collector::collect):
+ * wtf/FastMalloc.cpp:
+ (WTF::fastMallocForbid):
+ (WTF::fastMallocAllow):
+ (WTF::fastMalloc):
+ (WTF::fastCalloc):
+ (WTF::fastFree):
+ (WTF::fastRealloc):
+ (WTF::do_malloc):
+ * wtf/FastMalloc.h:
+
+2007-03-06 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Fixed all known crashers exposed by run-webkit-tests --threaded. This covers:
+
+ <rdar://problem/4565394> | http://bugs.webkit.org/show_bug.cgi?id=12585
+ PAC file: after closing a window that contains macworld.com, new window
+ crashes (KJS::PropertyMap::mark()) (12585)
+ <rdar://problem/4571215> | http://bugs.webkit.org/show_bug.cgi?id=9211
+ PAC file: Crash occurs when clicking on the navigation tabs at http://www.businessweek.com/ (9211)
+ <rdar://problem/4557926>
+ PAC file: Crash occurs when attempting to view image in slideshow mode
+ at http://d.smugmug.com/gallery/581716 ( KJS::IfNode::execute (KJS::
+ ExecState*) + 312) if you use a PAC file
+
+ (1) Added some missing JSLocks, along with related ASSERTs.
+
+ (2) Fully implemented support for objects that can only be garbage collected
+ on the main thread. So far, only WebCore uses this. We can add it to API
+ later if we learn that it's needed.
+
+ The implementation uses a "main thread only" flag inside each object. When
+ collecting on a secondary thread, the Collector does an extra pass through
+ the heap to mark all flagged objects before sweeping. This solution makes
+ the common case -- flag lots of objects, but never collect on a secondary
+ thread -- very fast, even though the uncommon case of garbage collecting
+ on a secondary thread isn't as fast as it could be. I left some notes
+ about how to speed it up, if we ever care.
+
+ For posterity, here are some things I learned about GC while investigating:
+
+ * Each collect must either mark or delete every heap object. "Zombie"
+ objects, which are neither marked nor deleted, raise these issues:
+
+ * On the next pass, the conservative marking algorithm might mark a
+ zombie, causing it to mark freed objects.
+
+ * The client might try to use a zombie, which would seem live because
+ its finalizer had not yet run.
+
+ * A collect on the main thread is free to delete any object. Presumably,
+ objects allocated on secondary threads have thread-safe finalizers.
+
+ * A collect on a secondary thread must not delete thread-unsafe objects.
+
+ * The mark function must be thread-safe.
+
+ Line by line comments:
+
+ * API/JSObjectRef.h: Added comment specifying that the finalize callback
+ may run on any thread.
+
+ * JavaScriptCore.exp: Nothing to see here.
+
+ * bindings/npruntime.cpp:
+ (_NPN_GetStringIdentifier): Added JSLock.
+
+ * bindings/objc/objc_instance.h:
+ * bindings/objc/objc_instance.mm:
+ (ObjcInstance::~ObjcInstance): Use an autorelease pool. The other callers
+ to CFRelease needed one, too, but they were dead code, so I removed them
+ instead. (This fixes a leak seen while running run-webkit-tests --threaded,
+ although I don't think it's specifically a threading issue.)
+
+ * kjs/collector.cpp:
+ (KJS::Collector::collectOnMainThreadOnly): New function. Tells the collector
+ to collect a value only if it's collecting on the main thread.
+ (KJS::Collector::markMainThreadOnlyObjects): New function. Scans the heap
+ for "main thread only" objects and marks them.
+
+ * kjs/date_object.cpp:
+ (KJS::DateObjectImp::DateObjectImp): To make the new ASSERTs happy, allocate
+ our globals on the heap, avoiding a seemingly unsafe destructor call at
+ program exit time.
+ * kjs/function_object.cpp:
+ (FunctionPrototype::FunctionPrototype): ditto
+
+ * kjs/interpreter.cpp:
+ (KJS::Interpreter::mark): Removed boolean parameter, which was an incomplete
+ and arguably hackish way to implement markMainThreadOnlyObjects() inside WebCore.
+ * kjs/interpreter.h:
+
+ * kjs/identifier.cpp:
+ (KJS::identifierTable): Added some ASSERTs to check for thread safety
+ problems.
+
+ * kjs/list.cpp: Added some ASSERTs to check for thread safety problems.
+ (KJS::allocateListImp):
+ (KJS::List::release):
+ (KJS::List::append):
+ (KJS::List::empty): Make the new ASSERTs happy.
+
+ * kjs/object.h:
+ (KJS::JSObject::JSObject): "m_destructorIsThreadSafe" => "m_collectOnMainThreadOnly".
+ I removed the constructor parameter because m_collectOnMainThreadOnly,
+ like m_marked, is a Collector bit, so only the Collector should set or get it.
+
+ * kjs/object_object.cpp:
+ (ObjectPrototype::ObjectPrototype): Make the ASSERTs happy.
+ * kjs/regexp_object.cpp:
+ (RegExpPrototype::RegExpPrototype): ditto
+
+ * kjs/ustring.cpp: Added some ASSERTs to check for thread safety problems.
+ (KJS::UCharReference::ref):
+ (KJS::UString::Rep::createCopying):
+ (KJS::UString::Rep::create):
+ (KJS::UString::Rep::destroy):
+ (KJS::UString::null): Make the new ASSERTs happy.
+ * kjs/ustring.h:
+ (KJS::UString::Rep::ref): Added some ASSERTs to check for thread safety problems.
+ (KJS::UString::Rep::deref):
+
+ * kjs/value.h:
+ (KJS::JSCell::JSCell):
+
+2007-03-06 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ 2% speedup on super accurate JS iBench.
+
+ (KJS::Collector::collect): Removed anti-optimization to call
+ pthread_is_threaded_np() before calling pthread_main_np(). Almost all
+ apps have more than one thread, so the extra call is actually worse.
+ Interestingly, even the single-threaded testkjs shows a speed gain
+ from removing the pthread_is_threaded_np() short-circuit. Not sure why.
+
+2007-03-04 Peter Kasting <pkasting@google.com>
+
+ Reviewed by Nikolas Zimmermann.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=12950
+ Assertions.cpp should not #define macros that are already defined
+
+ * wtf/Assertions.cpp: Don't #define WINVER and _WIN32_WINNT if they
+ are already defined.
+
+2007-03-02 Steve Falkenburg <sfalken@apple.com>
+
+ Reviewed by Anders.
+
+ Add unsigned int hash traits (matches existing unsigned long version)
+
+ * wtf/HashTraits.h:
+ (WTF::):
+
+2007-03-02 Adam Roben <aroben@apple.com>
+
+ Reviewed by Kevin M.
+
+ Try to fix the Qt build.
+
+ * kjs/DateMath.cpp:
+ (KJS::msToGregorianDateTime): Removed unnecessary "struct" keyword.
+ * kjs/DateMath.h: Moved forward declarations to the top of the file
+ before they are used.
+ * kjs/date_object.cpp:
+ (KJS::formatLocaleDate): Changed to take a const GregorianDateTime&
+ since GregorianDateTime is Noncopyable.
+
+2007-03-02 Darin Adler <darin@apple.com>
+
+ Reviewed by Kevin McCullough.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=12867
+ REGRESSION: BenchJS test 7 (dates) is 220% slower than in Safari 2.0.4
+
+ * kjs/DateMath.h: Marked GregorianDateTime as noncopyable, since it has a non-trivial
+ destructor and not the correspoding copy constructor or assignment operator.
+ Changed the GregorianDateTime constructor to use member initialization syntax.
+ Fixed the destructor to use the array delete operator, since timeZone is an array.
+
+ * kjs/DateMath.cpp:
+ (KJS::daysInYear): Changed to call isLeapYear so the rule is not repeated twice.
+ (KJS::getUTCOffset): Added caching on PLATFORM(DARWIN), since we can rely on the
+ notify_check function and "com.apple.system.timezone" to let us know when the
+ offset has changed.
+
+2007-02-27 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Follow-up to fixing http://bugs.webkit.org/show_bug.cgi?id=12659 | <rdar://problem/4954306>
+ JS objects not collected after closing window @ ebay.com/maps.google.com
+
+ Changed Interpreter cache of global constructors and prototypes from
+ ProtectedPtrs to bare, marked pointers. ProtectedPtrs are inefficient,
+ and they increase the risk of reference cycles. Also, Darin said something
+ about ProtectedPtrs giving him warts.
+
+ Also changed data members to precise types from generic JSObject*'s.
+
+ Layout tests and JS tests pass.
+
+ * kjs/SavedBuiltins.h:
+ * kjs/interpreter.cpp:
+ (KJS::Interpreter::init):
+ (KJS::Interpreter::~Interpreter):
+ (KJS::Interpreter::initGlobalObject): Moved Identifier::init() call to
+ constructor, for clarity.
+ (KJS::Interpreter::mark):
+ * kjs/interpreter.h:
+
+2007-02-27 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Fixed http://bugs.webkit.org/show_bug.cgi?id=12659 | <rdar://problem/4954306>
+ JS objects not collected after closing window @ ebay.com/maps.google.com
+
+ Don't GC in the Interpreter destructor. For that to work, the Interpreter
+ would have to NULL out all of its ProtectedPtrs before calling collect(). But
+ we've decided that we don't want things to work that way, anyway. We want the
+ client to be in charge of manual GC so that it can optimize cases when
+ it will be destroying many interpreters at once
+ (e.g., http://bugs.webkit.org/show_bug.cgi?id=12900).
+
+ Also removed Interpreter::collect() because it was redundant with
+ Collector::collect().
+
+ * JavaScriptCore.exp:
+ * kjs/interpreter.cpp:
+ (KJS::Interpreter::~Interpreter):
+ * kjs/testkjs.cpp:
+ (TestFunctionImp::callAsFunction):
+
+2007-02-26 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
+
+ Reviewed by Adam Roben.
+
+ Rename *_SUPPORT defines to ENABLE_*.
+
+ * jscore.bkl:
+
+2007-02-26 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Lars.
+
+ - <rdar://problem/5021698> Disable experimental SVG features (12883)
+
+ * wtf/Platform.h: Add ENABLE() macro similar to HAVE() and USE(), to
+ allow nicer handling of optional WebKit features.
+
+2007-02-22 George Staikos <staikos@kde.org>
+
+ Reviewed by Lars.
+
+ Add return values
+
+ * wtf/unicode/qt4/UnicodeQt4.h:
+ (WTF::Unicode::toLower):
+ (WTF::Unicode::toUpper):
+
+2007-02-22 Oscar Cwajbaum <public@oscarc.net>
+
+ Reviewed by Maciej.
+
+ Fix ARM-specific alignment problem in FastMalloc
+ http://bugs.webkit.org/show_bug.cgi?id=12841
+
+ * wtf/FastMalloc.cpp:
+ Modify how pageheap_memory is declared to ensure proper alignment
+ on architectures such as ARM
+
+2007-02-20 Zack Rusin <zrusin@trolltech.com>
+
+ Reviewed by Lars
+
+ Make sure that non-void methods always return something.
+
+ * wtf/unicode/qt4/UnicodeQt4.h:
+ (WTF::Unicode::toLower):
+ (WTF::Unicode::toUpper):
+ (WTF::Unicode::foldCase):
+
+2007-02-18 Kevin Ollivier <kevino@theolliviers.com>
+
+ Reviewed by Adam Roben.
+
+ Fix cases where MSVC-specific code was identified as Win32 platform
+ code. (as it should be compiled for e.g. wx port when using MSVC too)
+
+ * wtf/Assertions.h:
+ * wtf/MathExtras.h:
+ * wtf/StringExtras.h:
+ changed PLATFORM(WIN) sections to COMPILER(MSVC) as necessary
+
+2007-02-17 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
+
+ Reviewed by Adam Roben.
+
+ Fix crashes on ARM due to different struct packing. Based on a patch
+ by Mike Emmel.
+ * kjs/ustring.cpp: compile-time assert to make sure sizeof(UChar) == 2
+ * kjs/ustring.h: pack UChar struct to ensure that sizeof(UChar) == 2
+ * wtf/Assertions.h: add COMPILE_ASSERT macro for compile-time assertions
+
+2007-02-16 George Staikos <staikos@kde.org>
+
+ Reviewed by Maciej.
+
+ Fix uninitialized variable
+
+ * bindings/testbindings.cpp:
+ (myAllocate):
+
+2007-02-16 Anders Carlsson <acarlsson@apple.com>
+
+ Reviewed by Mitz.
+
+ http://bugs.webkit.org/show_bug.cgi?id=12788
+ REGRESSION: Going back one page in history has a noticeable delay
+
+ Um...if all elements in two vectors are equal, then I guess we could say that
+ the two vectors are equal too.
+
+ * wtf/Vector.h:
+ (WTF::):
+
+2007-02-14 Anders Carlsson <acarlsson@apple.com>
+
+ Reviewed by Darin.
+
+ Add new canCompareWithMemcmp vector trait and use it to determine whether
+ operator== can use memcmp.
+
+ * wtf/Vector.h:
+ (WTF::):
+ (WTF::VectorTypeOperations::compare):
+ (WTF::operator==):
+ * wtf/VectorTraits.h:
+ (WTF::):
+
+2007-02-13 Brady Eidson <beidson@apple.com>
+
+ Reviewed by Darin
+
+ Tweaked vector a bit
+
+ * wtf/Vector.h:
+ (WTF::operator==):
+
+2007-02-13 Matt Perry <mpcomplete@chromium.org>
+
+ Reviewed by Darin.
+
+ - fix for http://bugs.webkit.org/show_bug.cgi?id=12750
+ Vector operator== was not defined correctly. It returned void,
+ did not accept const Vectors, and used an int instead of size_t.
+
+ * wtf/Vector.h: fixed comparison operators
+ (WTF::operator==):
+ (WTF::operator!=):
+
+2007-02-10 David Carson <dacarson@gmail.com>
+
+ Reviewed by Maciej.
+
+ - fix for http://bugs.webkit.org/show_bug.cgi?id=12636
+ Corrected the generation of method signatures when the parameter
+ is an Array.
+ Added support for converting a Javascript array to a Java array.
+
+ * bindings/jni/jni_utility.h: added new type for array, array_type
+ * bindings/jni/jni_runtime.cpp: add support for new array type
+ (JavaField::valueFromInstance):
+ (JavaField::setValueToInstance):
+ (JavaMethod::JavaMethod):
+ (JavaMethod::signature):
+ * bindings/jni/jni_utility.cpp: add support for new array type
+ (KJS::Bindings::callJNIMethod):
+ (KJS::Bindings::callJNIStaticMethod):
+ (KJS::Bindings::callJNIMethodIDA):
+ (KJS::Bindings::JNITypeFromClassName):
+ (KJS::Bindings::signatureFromPrimitiveType):
+ (KJS::Bindings::JNITypeFromPrimitiveType):
+ (KJS::Bindings::getJNIField):
+ (KJS::Bindings::convertArrayInstanceToJavaArray): new method
+ converts the Javascript array to the requested Java array.
+ (KJS::Bindings::convertValueToJValue):
+
+2007-02-08 Anders Carlsson <acarlsson@apple.com>
+
+ Reviewed by Geoff.
+
+ <rdar://problem/4930614>
+ Safari complains about "Slow Script" if GMail is left open and machine is busy
+
+ <rdar://problem/4649516>
+ Turn off slow script dialog or crank up time that makes it come up
+
+ <rdar://problem/4963589>
+ Slow script warning is displayed after closing of PROMPT or PRINT dialog
+
+ Re-do the way script timeouts are handled. No longer use a unix timer that sends signals. Instead, add a
+ tick count and increment it in loop bodies. If the tick count reaches a threshold, do a timeout check. If the total time executing
+ is higher than the timeout value, (possibly) interrupt the script. The timeout checker also adjusts the threshold dynamically
+ to prevent doing the timeout check too often.
+
+ * JavaScriptCore.exp:
+ Remove pause and resume calls.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ Add winmm.lib.
+
+ * kjs/interpreter.cpp:
+ (KJS::Interpreter::init):
+ (KJS::Interpreter::~Interpreter):
+ (KJS::Interpreter::startTimeoutCheck):
+ (KJS::Interpreter::stopTimeoutCheck):
+ (KJS::Interpreter::resetTimeoutCheck):
+ (KJS::getCurrentTime):
+ (KJS::Interpreter::checkTimeout):
+ * kjs/interpreter.h:
+ (KJS::Interpreter::timedOut):
+ * kjs/nodes.cpp:
+ (DoWhileNode::execute):
+ (WhileNode::execute):
+ (ForNode::execute):
+
+2007-02-07 Darin Adler <darin@apple.com>
+
+ * JavaScriptCore.vcproj/JavaScriptCore.sln: Reenable testkjs.
+
+2007-02-07 Darin Adler <darin@apple.com>
+
+ Reviewed by Geoff.
+
+ - another build fix; this time for sure
+
+ * pcre/pcre_exec.c: (match):
+ The compiler caught an incorrect use of the othercase variable across
+ a call to RMATCH in character repeat processing. Local variables can
+ change in the crazy NO_RECURSE mode that we use, so we instead need
+ the value in othercase to be in one of the special stack frame variables.
+ Added a new stack frame variable for this purpose named repeat_othercase.
+ Also noted a similar error in the non-UTF-16 side of the #ifdef, but
+ didn't try to fix that one. Also removed a SUPPORT_UCP #ifdef from the
+ PCRE_UTF16 side; that code doesn't work without the Unicde properties
+ table, and we don't try to use it that way.
+
+2007-02-06 Steve Falkenburg <sfalken@apple.com>
+
+ Disable testkjs in sln until we figure out mysterious compiler warning.
+
+ * JavaScriptCore.vcproj/JavaScriptCore.sln:
+
+2007-02-06 Steve Falkenburg <sfalken@apple.com>
+
+ Build fix by ggaren
+
+ * pcre/pcre_exec.c:
+ (match):
+
+2007-02-06 Darin Adler <darin@apple.com>
+
+ Reviewed by Geoff.
+
+ - fix <rdar://problem/4979089> PCRE should avoid setjmp/longjmp even when compiler
+ is not GCC
+
+ Added a new code path that's slower and way uglier but doesn't rely on GCC's
+ computed gotos.
+
+ * pcre/pcre_exec.c: Added a numeric parameter to the RMATCH function. It must be
+ different at every RMATCH call site. Changed the non-GCC NO_RECURSE version of
+ the macro to use a label incorporating the number. Changed the RRETURN macro to
+ use a goto instead of longjmp.
+ (match): Added a different number at each callsite, using a perl script for the
+ first-time task. Going forward it should be easy to maintain by hand. Added a
+ switch statement at the bottom of the function. We'll get compile time errors
+ if we have anything in the switch statement that's never used in an RMATCH,
+ but errors in the other direction are silent except at runtime.
+
+2007-02-06 Darin Adler <darin@apple.com>
+
+ Reviewed by John.
+
+ - fix <rdar://problem/4687840> 9A241: JavaScript RegExp 25-30x slower than on 10.4.7
+
+ I used Shark to figure out what to do. The test case is now 15% faster than with
+ stock Safari. Some other regular expression cases might still be a few % slower
+ than before, but the >10x slowdown is now completely gone.
+
+ 1) Fix slowness caused by setjmp/longjmp by using computed goto instead.
+
+ Use GCC extensions - locally declared labels, labels as values, and computed goto -
+ instead of using setjmp/longjmp to implemement non-recursive version of the regular
+ expression system. We could probably make this even faster if we reduced the use
+ of malloc a bit too.
+
+ 2) Fix slowness caused by allocating heapframe objects by allocating the first
+ 16 of them from the stack.
+
+ 3) Speed up use of malloc and free in PCRE by making it use fastMalloc and fastFree.
+
+ 4) Speed up the test case by adding a special case to a UString function.
+
+ 5) Made a small improvement to the innermost hottest loop of match by hoisting
+ the conversion from int to pcre_uchar out of the loop.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj: Compile FastMallocPCRE.cpp, and don't
+ compile pcre_globals.c.
+
+ * wtf/FastMallocPCRE.cpp: Added. A copy of pcre_globals.c that uses FastMalloc.h.
+ This is better than code that sets the PCRE allocation globals because by doing it
+ this way there's guaranteed to be no problem with order of initialization.
+
+ * kjs/ustring.cpp: (KJS::UString::spliceSubstringsWithSeparators): Add a fast
+ special case when this is called for only one subrange and no seaprators. This
+ was happening a lot in the test case and it seems quite reasonable to optimize this.
+
+ * pcre/pcre_exec.c: Create a copy of the RMATCH and RRETURN macros that use goto
+ instead of setjmp/longjmp. Change code that calls pcre_stack_malloc to first use
+ storage on the stack inside the match function.
+ (match): Move initialization of utf8 up a couple lines to avoid "possibly used
+ uninitialized" warning. Use a local variable so we compare with pcre_uchar instead
+ of with int inside the inner "find a character" loop.
+
+2007-02-03 George Staikos <staikos@kde.org>
+
+ Reviewed by Alexey.
+
+ -1 is not a valid point. We can't handle anything > 0xffff anyway.
+ Fixes crash on cases like eval("x");
+
+ * wtf/unicode/qt4/UnicodeQt4.h:
+ (WTF::Unicode::category):
+
+2007-02-02 Darin Adler <darin@apple.com>
+
+ Reviewed by Anders.
+
+ - fix copying and assigning a ListHashSet
+
+ No test because the code path with bugs I am fixing is not used yet.
+
+ * wtf/ListHashSet.h: Tweaked ListHashSetNodeAllocator a little bit for clarity.
+ Changed m_allocator to be an OwnPtr instead of doing an explicit delete.
+ Fixed bug in copy constructor where we'd have an uninitialized m_allocator.
+ Fixed bug in assignment operator where it would swap only the hash table, and
+ not the head, tail, and allocator pointers.
+
+2007-02-02 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Use WTFLog instead of fprintf for logging KJS::Node leaks.
+
+ * kjs/nodes.cpp:
+ (NodeCounter::~NodeCounter): Changed count to unsigned, updated
+ to match style guidelines.
+
+2007-02-02 Maciej Stachowiak <mjs@apple.com>
+
+ - not reviewed, build fix
+
+ * wtf/ListHashSet.h:
+ (WTF::ListHashSetNodeAllocator::ListHashSetNodeAllocator): ummm, use union correctly
+
+2007-02-01 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin.
+
+ - use a custom allocator for ListHashSet, to fix ~1% perf regression using it for form control
+
+ * wtf/ListHashSet.h:
+ (WTF::ListHashSetNodeAllocator::ListHashSetNodeAllocator):
+ (WTF::ListHashSetNodeAllocator::allocate):
+ (WTF::ListHashSetNodeAllocator::deallocate):
+ (WTF::ListHashSetNode::operator new):
+ (WTF::ListHashSetNode::operator delete):
+ (WTF::ListHashSetNode::destroy):
+ (WTF::ListHashSetTranslator::translate):
+ (WTF::::ListHashSet):
+ (WTF::::~ListHashSet):
+ (WTF::::add):
+ (WTF::::unlinkAndDelete):
+ (WTF::::deleteAllNodes):
+
+2007-01-31 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Adam.
+
+ - fix sporadic crash
+
+ * wtf/ListHashSet.h:
+ (WTF::::remove): remove before deleting
+
+2007-01-31 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Mark with help from Lars.
+
+ - added new ListHashSet class, which combines a hashtable and a linked list to provide a set
+ that keeps elements in inserted order
+
+ This is to assist in fixing the following:
+ <rdar://problem/4751164> REGRESSION: Safari places text on incorrect button when returning to a page via back [10541]
+ http://bugs.webkit.org/show_bug.cgi?id=10541
+
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * wtf/HashTable.h:
+ (WTF::HashTable::find):
+ (WTF::HashTable::contains):
+ (WTF::::find):
+ (WTF::::contains):
+ * wtf/ListHashSet.h: Added.
+ (WTF::ListHashSetNode::ListHashSetNode):
+ (WTF::ListHashSetNodeHashFunctions::hash):
+ (WTF::ListHashSetNodeHashFunctions::equal):
+ (WTF::ListHashSetIterator::ListHashSetIterator):
+ (WTF::ListHashSetIterator::get):
+ (WTF::ListHashSetIterator::operator*):
+ (WTF::ListHashSetIterator::operator->):
+ (WTF::ListHashSetIterator::operator++):
+ (WTF::ListHashSetIterator::operator--):
+ (WTF::ListHashSetIterator::operator==):
+ (WTF::ListHashSetIterator::operator!=):
+ (WTF::ListHashSetIterator::operator const_iterator):
+ (WTF::ListHashSetIterator::node):
+ (WTF::ListHashSetConstIterator::ListHashSetConstIterator):
+ (WTF::ListHashSetConstIterator::get):
+ (WTF::ListHashSetConstIterator::operator*):
+ (WTF::ListHashSetConstIterator::operator->):
+ (WTF::ListHashSetConstIterator::operator++):
+ (WTF::ListHashSetConstIterator::operator--):
+ (WTF::ListHashSetConstIterator::operator==):
+ (WTF::ListHashSetConstIterator::operator!=):
+ (WTF::ListHashSetConstIterator::node):
+ (WTF::ListHashSetTranslator::hash):
+ (WTF::ListHashSetTranslator::equal):
+ (WTF::ListHashSetTranslator::translate):
+ (WTF::::ListHashSet):
+ (WTF::::operator):
+ (WTF::::~ListHashSet):
+ (WTF::::size):
+ (WTF::::capacity):
+ (WTF::::isEmpty):
+ (WTF::::begin):
+ (WTF::::end):
+ (WTF::::find):
+ (WTF::::contains):
+ (WTF::::add):
+ (WTF::::remove):
+ (WTF::::clear):
+ (WTF::::unlinkAndDelete):
+ (WTF::::appendNode):
+ (WTF::::deleteAllNodes):
+ (WTF::::makeIterator):
+ (WTF::::makeConstIterator):
+ (WTF::deleteAllValues):
+
+2007-01-30 Darin Adler <darin@apple.com>
+
+ * kjs/DateMath.cpp: Fix license header to reflect LGPL as the first license
+ mentioned. We still mention the option of using under MPL or GPL since some
+ of this code came from the Mozilla project with those license terms.
+
+2007-01-30 Simon Hausmann <hausmann@kde.org>
+
+ Reviewed by Zack.
+
+ Turned JavaScriptCore from a separate library into an includable
+ project, to combine it all into libWebKitQt.
+
+ * JavaScriptCore.pri: Added.
+ * JavaScriptCore.pro: Removed.
+ * kjs/testkjs.pro:
+
+2007-01-29 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Fixed <rdar://problem/4485644> REGRESSION: JavaScriptCore has init routines
+
+ The TCMalloc module now initializes, if needed, inside GetCache() and
+ fastMallocSetIsMultiThreaded(). We leverage the same synchronization
+ technique used for enabling / disabling the single-threaded optimization
+ to synchronize initialization of the library without requiring a lock
+ for every malloc.
+
+ 1,251 runs of tcmalloc_unittest, 2 runs of a custom, massively multi-threaded
+ tcmalloc_unittest, and my custom version of the PLT show no regressions.
+ Super-accurate JS iBench reports a .24% regression, which is right at the
+ limit of its error range, so I'm declaring victory.
+
+ * wtf/FastMalloc.cpp:
+ (WTF::fastMallocSetIsMultiThreaded): Initialize, if needed. (InitModule()
+ checks the "if needed" part.)
+ (WTF::TCMalloc_ThreadCache::GetCache): Restored original TCMalloc code
+ inside #ifdef, for posterity. Added new initialization logic.
+ (WTF::TCMalloc_ThreadCache::InitModule): Call InitTSD(), since we don't
+ have a static initializer to call it for us, now. This means that fastMalloc
+ is not usable as a general libc allocator, but it never was, and if it were
+ the general libc allocator, we wouldn't be here in the first place, so whatever.
+ (WTF::TCMalloc_ThreadCache::InitTSD): Don't try to take the pageheap_lock,
+ since InitModule already has it.
+
+2007-01-29 Kevin McCullough <KMcCullough@apple.com>
+
+ Reviewed by Geoff and Oliver.
+
+ - rdar://problem/4955561
+ - missusing JavaScript shouldn't crash webkit. Now it doesn't, in this case.
+
+ * bindings/objc/objc_runtime.mm:
+ (ObjcFallbackObjectImp::callAsFunction):
+ * bindings/runtime_method.cpp:
+ (RuntimeMethod::callAsFunction):
+ * bindings/runtime_object.cpp:
+ (RuntimeObjectImp::callAsFunction):
+
+2007-01-28 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ First step in fixing <rdar://problem/4485644> REGRESSION: JavaScriptCore
+ has init routines
+
+ Don't rely on a static initializer to store the main thread's ID (which
+ we would use to detect allocations on secondary threads). Instead, require
+ the caller to notify fastMalloc if it might allocate on a secondary thread.
+
+ Also fixed what seemed like a race condition in do_malloc.
+
+ tcmalloc_unittest and my custom versions of JS iBench and PLT show no
+ regressions.
+
+ * wtf/FastMalloc.cpp:
+ (WTF::fastMallocSetIsMultiThreaded):
+ (1) Renamed from "fastMallocRegisterThread", which was a misleading name because
+ not all threads need to register with fastMalloc -- only secondary threads
+ need to, and only for the purpose of disabling its single-threaded optimization.
+
+ (2) Use the pageheap_lock instead of a custom one, since we need to synchronize
+ with the read of isMultiThreaded inside CreateCacheIfNecessary. This is a new
+ requirement, now that we can't guarantee that the first call to CreateCacheIfNecessary
+ will occur on the main thread at init time, before any other threads have been created.
+
+ (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary):
+ (WTF::do_malloc): Reverted WTF change only to call GetCache() if size <= kMaxSize.
+ The WTF code would read phinited without holding the pageheap_lock, which
+ seemed like a race condition. Regardless, calling GetCache reduces the number
+ of code paths to module initialization, which will help in writing the
+ final fix for this bug.
+
+2007-01-28 David Kilzer <ddkilzer@webkit.org>
+
+ Reviewed by Darin.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=9815
+ JavaScript TypeError loading Dean Edwards' JS compressor/obfuscator
+
+ Creating a function using 'new Function()' was not setting its prototype with the
+ same flags as 'function() { }'.
+
+ Test: fast/js/function-prototype.html
+
+ * kjs/function_object.cpp:
+ (FunctionObjectImp::construct): Change flags from DontEnum|DontDelete|ReadOnly to
+ Internal|DontDelete to match FuncDeclNode::processFuncDecl() and
+ FuncExprNode::evaluate() in kjs/nodes.cpp.
+
+2007-01-27 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Beth Dakin.
+
+ Added some missing JSLocks, which might fix <rdar://problem/4889707>.
+
+ We need to lock whenever we might allocate memory because our FastMalloc
+ implementation requires clients to register their threads, which we do
+ through JSLock.
+
+ We also need to lock whenever modifying ref-counts because they're not
+ thread-safe.
+
+ * API/JSObjectRef.cpp:
+ (JSClassCreate): Allocates memory
+ (JSClassRetain): Modifies a ref-count
+ (JSClassRelease): Modifies a ref-count
+ (JSPropertyNameArrayRetain): Modifies a ref-count
+ (JSPropertyNameArrayRelease): Modifies a ref-count
+ * API/JSStringRef.cpp:
+ (JSStringRetain): Modifies a ref-count
+ * API/JSValueRef.cpp:
+ (JSValueIsInstanceOfConstructor): Might allocate memory if an exception
+ is thrown.
+
+2007-01-27 Lars Knoll <lars@trolltech.com>
+
+ Fix the Qt build.
+
+ * bindings/qt/qt_instance.h:
+
+2007-01-25 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Fixed <rdar://problem/4608404> WebScriptObject's _rootObject lack
+ of ownership policy causes crashes (e.g., in Dashcode)
+
+ The old model for RootObject ownership was either to (1) leak them or (2) assign
+ them to a single owner -- the WebCore::Frame -- which would destroy them
+ when it believed that all of its plug-ins had unloaded.
+
+ This model was broken because of (1) and also because plug-ins are not the only
+ RootObject clients. All Bindings clients are RootObjects clients, including
+ applications, which outlive any particular WebCore::Frame.
+
+ The new model for RootObject ownership is to reference-count them, with a
+ throw-back to the old model: The WebCore::Frame tracks the RootObjects
+ it creates, and invalidates them when it believes that all of its plug-ins
+ have unloaded.
+
+ We maintain this throw-back to avoid plug-in leaks, particularly from Java.
+ Java is completely broken when it comes to releasing JavaScript objects.
+ Comments in our code allege that Java does not always call finalize when
+ collecting objects. Moreoever, my own testing reveals that, when Java does
+ notify JavaScript of a finalize, the data it provides is totally bogus.
+
+ This setup is far from ideal, but I don't think we can do better without
+ completely rewriting the bindings code, and possibly part of the Java
+ plug-in / VM.
+
+ Layout tests pass. No additional leaks reported. WebCore/manual-tests/*liveconnect*
+ and a few LiveConnect demos on the web also run without a hitch.
+
+ const RootObject* => RootObject*, since we need to ref/deref
+
+ * bindings/NP_jsobject.cpp:
+ (jsDeallocate): deref our RootObjects. Also unprotect or JSObject, instead
+ of just relying on the RootObject to do it for us when it's invalidated.
+ (_isSafeScript): Check RootObject validity.
+ (_NPN_CreateScriptObject): ditto
+ (_NPN_Invoke): ditto
+ (_NPN_Evaluate): ditto
+ (_NPN_GetProperty): ditto
+ (_NPN_SetProperty): ditto
+ (_NPN_RemoveProperty): ditto
+ (_NPN_HasProperty): ditto
+ (_NPN_HasMethod): ditto
+ (_NPN_SetException): ditto
+
+ * bindings/runtime_root.cpp:
+ Revived bit-rotted LIAR LIAR LIAR comment.
+
+ LOOK: Added support for invalidating RootObjects without deleting them,
+ which is the main goal of this patch.
+
+ Moved protect counting into the RootObject class, to emphasize that
+ the RootObject protects the JSObject, and unprotects it upon being invalidated.
+ addNativeReference => RootObject::gcProtect
+ removeNativeReference => RootObject::gcUnprotect
+ ProtectCountSet::contains => RootObject::gcIsProtected
+
+ I know we'll all be sad to see the word "native" go.
+
+ * bindings/runtime_root.h: Added ref-counting support to RootObject, with
+ all the standard accoutrements.
+
+ * bindings/c/c_utility.cpp:
+ (KJS::Bindings::convertValueToNPVariant): If we can't find a valid RootObject,
+ return void instead of just leaking.
+
+ * bindings/jni/jni_instance.cpp:
+ (JavaInstance::JavaInstance): Don't take a RootObject in our constructor;
+ be like other Instances and require the caller to call setRootObject. This
+ reduces the number of ownership code paths.
+ (JavaInstance::invokeMethod): Check RootObject for validity.
+ * bindings/jni/jni_instance.h: Removed private no-arg constructor. Having
+ an arg constructor accomplishes the same thing.
+
+ * bindings/jni/jni_jsobject.cpp:
+ (JavaJSObject::invoke): No need to call findProtectCountSet, because finalize()
+ checks for RootObject validity.
+ (JavaJSObject::JavaJSObject): check RootObject for validity
+ (JavaJSObject::call): ditto
+ (JavaJSObject::eval): ditto
+ (JavaJSObject::getMember): ditto
+ (JavaJSObject::setMember): ditto
+ (JavaJSObject::removeMember): ditto
+ (JavaJSObject::getSlot): ditto
+ (JavaJSObject::setSlot): ditto
+ (JavaJSObject::toString): ditto
+ (JavaJSObject::finalize): ditto
+ (JavaJSObject::createNative): No need to tell the RootObject to protect
+ the global object, since the RootObject already owns the interpreter.
+
+ * bindings/jni/jni_runtime.cpp:
+ (JavaArray::JavaArray): Removed copy construcutor becaue it was unused.
+ Dead code is dangerous code.
+
+ * bindings/objc/objc_runtime.mm: Added WebUndefined protocol. Previous use
+ of WebScriptObject was bogus, because WebUndefined is not a subclass of
+ WebScriptObject.
+ (convertValueToObjcObject): If we can't find a valid RootObject,
+ return nil instead of just leaking.
+
+ * bindings/objc/objc_utility.mm:
+ (KJS::Bindings::convertValueToObjcValue): If we can't find a valid RootObject,
+ return nil instead of just leaking.
+
+2007-01-27 Andrew Wellington <proton@wiretapped.net>
+
+ Reviewed by Maciej.
+
+ Fix for Repeated string concatenation results in OOM crash
+ http://bugs.webkit.org/show_bug.cgi?id=11131
+
+ * kjs/operations.cpp:
+ (KJS::add): Throw exception if string addition result is null
+ * kjs/ustring.cpp:
+ (KJS::UString::UString): Don't call memcpy when malloc failed
+
+2007-01-25 Jan Kraemer <camel@gmx.de>
+
+ Reviewed by Maciej
+
+ Fix for http://bugs.webkit.org/show_bug.cgi?id=12382
+
+ Fix crash on architectures with 32 bit ints and
+ 64 bit longs (For example Linux on AMD64)
+
+ * kjs/dtoa.cpp: #define Long int as suggested in comment
+
+2007-01-24 Geoffrey Garen <ggaren@apple.com>
+
+ Fixed up #include order for style. No review necessary.
+
+ * API/JSStringRef.cpp:
+
+2007-01-24 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ Copy JSStringRefCF, in case anybody wants to use it. (I just added
+ it recently.)
+
+2007-01-24 Maciej Stachowiak <mjs@apple.com>
+
+ Not reviewed, trivial property change.
+
+ * JavaScriptCore.vcproj/JavaScriptCore.sln: remove svn:mime-type
+ property which made this binary.
+
+2007-01-25 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Darin.
+
+ * Info.plist: Update copyright string.
+
+2007-01-24 Darin Adler <darin@apple.com>
+
+ Reviewed by Mark Rowe.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj: Changed to /usr/sbin/sysctl
+ so we don't rely on people's paths.
+
+2007-01-23 Alice Liu <alice.liu@apple.com>
+
+ release build fix
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ Copy APICasts.h
+
+2007-01-23 Geoffrey Garen <ggaren@apple.com>
+
+ build fix
+
+ * API/JSStringRef.h:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2007-01-24 Mark Rowe <mrowe@apple.com>
+
+ Build fix for DumpRenderTree.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj: Make JSStringRefCF.h public so it's copied into built framework.
+
+2007-01-23 Anders Carlsson <acarlsson@apple.com>
+
+ Reviewed by Darin.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ Copy APICasts.h
+
+2007-01-23 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Fixed <rdar://problem/4885131> Move CFString function declarations from
+ JSStringRef.h to JSStringRefCF.h
+
+ Also removed remaining API FIXMEs and changed them into Radars.
+
+ * API/JSClassRef.cpp:
+ (OpaqueJSClass::OpaqueJSClass): Added Radar numbers for UTF8 conversion.
+
+ * API/JSContextRef.cpp:
+ (JSGlobalContextCreate): Replaced FIXME for NULL JSContextRef with Radar number.
+
+ * API/JSObjectRef.h: Removed FIXME, which is unprofessional in a public header.
+
+ * API/JSStringRef.cpp: Moved CF related implementations to JSStringRefCF.cpp.
+ (JSStringCreateWithUTF8CString): Replaced FIXME with Radar number.
+ * API/JSStringRef.h: Moved CF related declarations to JSStringRefCF.h. Added
+ #include of JSStringRefCF.h as a stopgap until clients start #including
+ it as needed by themselves.
+
+ * API/JSStringRefCF.cpp: Added.
+ (JSStringCreateWithCFString):
+ (JSStringCopyCFString): Replaced JSChar cast with UniChar cast, which is
+ more appropriate for a CF call.
+ * API/JSStringRefCF.h: Added.
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2007-01-18 Sanjay Madhav <sanjay12@gmail.com>
+
+ Reviewed by Darin.
+
+ Add JavaScriptCore define to help with tracing of when objects are marked.
+
+ * kjs/object.cpp:
+ (KJS::JSObject::mark):
+
+2007-01-18 Simon Hausmann <hausmann@kde.org>
+
+ Reviewed by Zack.
+
+ * JavaScriptCore.pro: Remove generated files on make clean.
+ * pcre/pcre.pri:
+
+2007-01-16 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Maciej.
+
+ http://bugs.webkit.org/show_bug.cgi?id=12268
+ Give object prototypes their own names
+
+ * kjs/lookup.h: Append "Prototype" to ClassName in KJS_IMPLEMENT_PROTOTYPE.
+
+2007-01-16 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Added re-entrency checking to GC allocation and collection. It is an error
+ to allocate or collect from within a collection. We've had at least one
+ case of each bug in the past.
+
+ Added a comment to the API header, explaining that API clients must not
+ make this mistake, either.
+
+ Layout tests and JS tests pass.
+
+ * API/JSObjectRef.h:
+ * kjs/collector.cpp:
+ (KJS::GCLock::GCLock):
+ (KJS::GCLock::~GCLock):
+ (KJS::Collector::allocate):
+ (KJS::Collector::collect):
+
+2007-01-14 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Mitz.
+
+ Minor fixes to JavaScript pretty-printing.
+
+ * JavaScriptCore.exp:
+ * kjs/Parser.cpp:
+ (KJS::Parser::prettyPrint): Return line number and error message if parsing fails.
+ * kjs/Parser.h:
+ * kjs/nodes2string.cpp:
+ (ElementNode::streamTo): Include comma delimiters in array literals.
+ (PropertyNameNode::streamTo): Quote property names in object literals to handle the case when the property name is not a valid identifier.
+ * kjs/testkjs.cpp:
+ (doIt): Print any errors encountered while pretty-printing.
+
+2007-01-12 Anders Carlsson <acarlsson@apple.com>
+
+ Reviewed by Darin.
+
+ * wtf/HashTraits.h:
+ Add hash traits for unsigned long and unsigned long long.
+
+2007-01-12 Geoffrey Garen <ggaren@apple.com>
+
+ RS by Brady Eidson.
+
+ Rolling back in r18786 with leaks fixed, and these renames slightly reworked:
+
+ Because they can return 0:
+ rootObjectForImp => findRootObject (overloaded for JSObject* and Interpreter*)
+ rootObjectForInterpreter => findRootObject (ditto)
+ findReferenceSet => findProtectCountSet
+
+2007-01-11 Geoffrey Garen <ggaren@apple.com>
+
+ RS by Brady Eidson.
+
+ Rolling out r18786 because it caused leaks.
+
+2007-01-11 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Anders Carlsson.
+
+ Even more cleanup in preparation for fixing <rdar://problem/4608404>
+ WebScriptObject's _executionContext lack of ownership policy causes
+ crashes (e.g., in Dashcode)
+
+ Layout tests pass.
+
+ Renames:
+ ReferencesSet | ProtectCounts => ProtectCountSet (because it's a typename for a set of GC protect counts)
+ ReferencesByRootMap => RootObjectMap (because RootObjectToProtectCountSetMap would have been confusing)
+ pv => protectedValues
+ rootObjectForImp => getRootObject (overloaded for JSObject* and Interpreter*)
+ rootObjectForInterpreter => getRootObject (ditto)
+ findReferenceSet => getProtectCountSet
+ imp => jsObject
+
+ (KJS::Bindings::getRootObjectMap): Changed to take advantage of built-in
+ facility for initializing static variables.
+
+ (KJS::Bindings::getProtectCountSet):
+ (KJS::Bindings::destroyProtectCountSet): Added. Helps encapsulate the fact
+ that getting a ProtectCountSet entails adding a RootObject to a hash table,
+ and destroying one entails the reverse.
+
+ (KJS::Bindings::getRootObject): Removed spurious NULL check.
+
+ (KJS::Bindings::findReferenceSet): Renamed. Changed to use getRootObject()
+ instead of iterating on its own.
+
+ (KJS::Bindings::addNativeReference): Changed to use an early return instead
+ of indenting the whole function.
+ (KJS::Bindings::removeNativeReference): Ditto.
+
+2007-01-11 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Anders Carlsson.
+
+ Even more cleanup in preparation for fixing <rdar://problem/4608404>
+ WebScriptObject's _executionContext lack of ownership policy causes
+ crashes (e.g., in Dashcode)
+
+ Layout tests pass.
+
+ Renames:
+ findRootObjectForNativeHandleFunction => createRootObject
+ FindRootObjectForNativeHandleFunctionPtr => CreateRootObjectFunction
+
+ Also removed unnecessary use of "Bindings::" prefix.
+
+ * JavaScriptCore.exp:
+ * bindings/jni/jni_jsobject.cpp:
+ (JavaJSObject::createNative):
+ (JavaJSObject::convertValueToJObject):
+ (JavaJSObject::convertJObjectToValue):
+ * bindings/runtime_root.cpp:
+ (KJS::Bindings::RootObject::setCreateRootObject):
+ * bindings/runtime_root.h:
+ (KJS::Bindings::RootObject::createRootObject):
+
+2007-01-11 George Staikos <staikos@kde.org>
+
+ Reviewed by Maciej
+
+ Appears to be Mac specific right now.
+
+ * kjs/config.h:
+
+2007-01-10 Lars Knoll <lars@trolltech.com>
+
+ Reviewed by Zack
+
+ Use the new functionality in Qt 4.3, to make
+ the methods closer compliant with the Unicode
+ spec.
+
+ Keep the old code so that it still compiles against
+ Qt 4.2.
+
+ * wtf/unicode/qt4/UnicodeQt4.h:
+ (WTF::Unicode::toLower):
+ (WTF::Unicode::toUpper):
+ (WTF::Unicode::toTitleCase):
+ (WTF::Unicode::foldCase):
+ (WTF::Unicode::isFormatChar):
+ (WTF::Unicode::isPrintableChar):
+ (WTF::Unicode::isSeparatorSpace):
+ (WTF::Unicode::isPunct):
+ (WTF::Unicode::isDigit):
+ (WTF::Unicode::isLower):
+ (WTF::Unicode::isUpper):
+ (WTF::Unicode::digitValue):
+ (WTF::Unicode::mirroredChar):
+ (WTF::Unicode::combiningClass):
+ (WTF::Unicode::decompositionType):
+ (WTF::Unicode::umemcasecmp):
+ (WTF::Unicode::direction):
+ (WTF::Unicode::category):
+
+2007-01-09 Darin Adler <darin@apple.com>
+
+ - update 2007 Apple copyright for the new company name
+
+ * kjs/DateMath.cpp:
+
+2007-01-09 Darin Adler <darin@apple.com>
+
+ - fix build
+
+ * kjs/string_object.cpp: (KJS::StringProtoFunc::callAsFunction):
+ Actually compile it this time.
+
+2007-01-09 Darin Adler <darin@apple.com>
+
+ - fix build
+
+ * kjs/string_object.cpp: (KJS::StringProtoFunc::callAsFunction):
+ Change types.
+
+2007-01-09 Darin Adler <darin@apple.com>
+
+ - fix build on platforms where Unicode::UChar is != uint16_t
+
+ * kjs/string_object.cpp: (KJS::StringProtoFunc::callAsFunction):
+ Change types.
+
+2007-01-09 Mitz Pettel <mitz@webkit.org>
+
+ Reviewed by Darin.
+
+ - changes for http://bugs.webkit.org/show_bug.cgi?id=11078
+ Forms Don't Submit (ASP Pages)
+
+ * JavaScriptCore.exp:
+ * kjs/value.cpp:
+ (KJS::JSValue::toInt32): Folded toInt32Inline into this method, which was its
+ only caller.
+ (KJS::JSValue::toUInt32): Added a variant that reports if the conversion has
+ succeeded.
+ * kjs/value.h:
+
+2007-01-09 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=12174
+ improve Unicode use (less WTF::Unicode:: prefix, centralized character names)
+
+ * wtf/unicode/icu/UnicodeIcu.h: Change parameter and return types
+ to UChar32 and UChar. Removed unneeded type casts and added some
+ const to functions that lacked it. Removed WTF::Unicode::memcmp.
+ (WTF::Unicode::umemcasecmp): Renamed from strcasecmp since this
+ doesn't work on 0-terminated strings as the str functions do.
+ * wtf/unicode/qt4/UnicodeQt4.h: Ditto.
+
+ - got rid of namespace prefixes from most uses of WTF::Unicode
+
+ * kjs/function.cpp:
+ (KJS::isStrWhiteSpace):
+ (KJS::escapeStringForPrettyPrinting):
+ * kjs/lexer.cpp:
+ (KJS::Lexer::isWhiteSpace):
+ (KJS::Lexer::isIdentStart):
+ (KJS::Lexer::isIdentPart):
+ * kjs/string_object.cpp:
+ (KJS::StringProtoFunc::callAsFunction):
+
+2007-01-07 David Kilzer <ddkilzer@webkit.org>
+
+ Reviewed by Darin.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=11917
+ setlocale() can return null
+
+ * kjs/date_object.cpp:
+ (KJS::DateProtoFunc::callAsFunction): Removed dead code.
+
+2007-01-07 David Carson <dacarson@gmail.com>
+
+ Reviewed by Darin.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=12100
+ JNI bindings should be available to non-Mac platforms that have JNI
+
+ Change JNI so that it is not wrapped in the PLATFORM(MAC) ifdef, enabling
+ other platforms who have JNI to use it.
+
+ * bindings/jni/jni_instance.h:
+ Removed unnecessary include of <CoreFoundation/CoreFoundation.h>
+ * bindings/jni/jni_utility.cpp:
+ (KJS::Bindings::setJavaVM):
+ * bindings/jni/jni_utility.h:
+ Added new method for clients to set the JavaVM
+ * bindings/runtime.cpp:
+ (KJS::Bindings::Instance::createBindingForLanguageInstance):
+ Changed code to utilize new #if HAVE(JNI)
+ * kjs/config.h:
+ Added new #define for JNI, ie HAVE_JNI
+
+2007-01-07 David Carson <dacarson@gmail.com>
+
+ Reviewed by Darin.
+
+ Fix http://bugs.webkit.org/show_bug.cgi?id=11431
+ ARM platform has some byte alignment issues
+
+ Fix for NaN being 4 bytes and it must start on a byte boundary
+ for ARM architectures.
+
+ * kjs/fpconst.cpp:
+ (KJS::):
+
+2007-01-04 David Kilzer <ddkilzer@webkit.org>
+
+ Reviewed by Kevin McCullough.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=12070
+ REGRESSION: KJS::getUTCOffset() caches UTC offset but ignores time zone changes
+
+ * kjs/DateMath.cpp:
+ (KJS::getUTCOffset): Don't cache UTC offset.
+
+2007-01-02 Darin Adler <darin@apple.com>
+
+ - minor tweak (hope this doesn't re-break Windows)
+
+ * pcre/pcre_compile.c: Removed use of const pcre_uchar const * -- Mitz probably
+ meant const pcre_uchar *const, but I think we can do without the explicit const here.
+
+ * pcre/pcre_internal.h: Re-enabled warning C4114.
+
+2007-01-02 David Kilzer <ddkilzer@webkit.org>
+
+ Reviewed by NOBODY (Windows build fix).
+
+ The MSVC compiler requires variables to be declared at the top of the enclosing block in C source.
+
+ Disable this warning to prevent MSVC from complaining about the 'const pcre_uchar const *' type:
+ warning C4114: same type qualifier used more than once
+
+ * pcre/pcre_compile.c:
+ (pcre_compile2): Moved variable declarations to top of their respective enclosing blocks.
+ * pcre/pcre_internal.h: Added pragma to disable compiler warning.
+
+2007-01-01 Mitz Pettel <mitz@webkit.org>
+
+ Reviewed by Darin.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=11849
+ REGRESSION (r18182): Google Calendar is broken (a regular expression containing a null character is not parsed correctly)
+
+ Modified pcre_compile() (and the functions that it calls) to work with patterns
+ containing null characters.
+
+ Covered by JavaScriptCore tests ecma_3/RegExp/octal-002.js and ecma_3/RegExp/regress-85721.js
+
+ * kjs/regexp.cpp:
+ (KJS::RegExp::RegExp): Changed to not null-terminate the pattern string and instead
+ pass its length to pcre_compile.
+ * pcre/pcre.h:
+ * pcre/pcre_compile.c:
+ (check_escape):
+ (get_ucp):
+ (is_counted_repeat):
+ (check_posix_syntax):
+ (compile_branch):
+ (compile_regex):
+ (pcre_compile): Added a parameter specifying the length of the pattern, which
+ is no longer required to be null-terminated and may contain null characters.
+ (pcre_compile2):
+ * pcre/pcre_internal.h:
+ * tests/mozilla/expected.html: Updated for the two tests that this patch
+ fixes. Also updated failing results for ecma_3/RegExp/regress-100199.js
+ which were not updated after bug 6257 was fixed.
+
+2007-01-01 David Kilzer <ddkilzer@webkit.org>
+
+ Reviewed by Darin.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=12057
+ REGRESSION: JavaScript Date Is One Day In The Future in GMT time zone
+
+ Because Mac OS X returns geographically and historically accurate time zone information,
+ converting Jan 02, 1970 12:00:00 AM to local time then subtracting 24 hours did not work
+ in GMT (London - England) since it was in BST (+0100) all year in 1970[1]. Instead, the
+ UTC offset is calculated by converting Jan 01, 2000 12:00:00 AM to local time then
+ subtracting that from the same date in UTC.
+
+ [1] http://en.wikipedia.org/wiki/British_Summer_Time
+
+ * kjs/DateMath.cpp:
+ (KJS::getUTCOffset): Updated UTC offset calculation.
+ (KJS::getDSTOffset): Improved comment.
+
+2006-12-31 David Kilzer <ddkilzer@webkit.org>
+
+ Reviewed by Geoff.
+
+ Update embedded pcre library from version 6.2 to 6.4. Changes from pcre 6.2 to 6.3
+ did not include any files in JavaScriptCore/pcre.
+
+ All changes include renaming EXPORT to PCRE_EXPORT, renaming of ucp_findchar() to
+ _pcre_ucp_findchar(), or comment changes. Additional changes noted below.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Updated source file list.
+ * JavaScriptCore.xcodeproj/project.pbxproj: Renamed pcre_printint.c to pcre_printint.src
+ and changed it from a source file to a header file.
+ * JavaScriptCoreSources.bkl: Updated source file list.
+ * pcre/CMakeLists.txt: Updated source file list.
+ * pcre/pcre-config.h:
+ * pcre/pcre.h: Updated version.
+ * pcre/pcre.pri: Updated source file list.
+ * pcre/pcre_compile.c: Include pcre_printint.src #if DEBUG.
+ (pcre_compile2):
+ * pcre/pcre_config.c:
+ * pcre/pcre_exec.c:
+ (match):
+ * pcre/pcre_fullinfo.c:
+ * pcre/pcre_info.c:
+ * pcre/pcre_internal.h: Added header guard. Removed export of _pcre_printint().
+ * pcre/pcre_ord2utf8.c:
+ * pcre/pcre_printint.c: Renamed to pcre_printint.src.
+ * pcre/pcre_printint.src: Added. Renamed _pcre_printint() to pcre_printint().
+ * pcre/pcre_refcount.c:
+ * pcre/pcre_study.c:
+ * pcre/pcre_tables.c:
+ * pcre/pcre_try_flipped.c:
+ * pcre/pcre_ucp_findchar.c: Added contents of ucp_findchar.c.
+ * pcre/pcre_version.c:
+ * pcre/pcre_xclass.c:
+ (_pcre_xclass):
+ * pcre/ucp.h: Removed export of ucp_findchar().
+ * pcre/ucp_findchar.c: Removed. Contents moved to pcre_ucp_findchar.c.
+
+2006-12-29 David Kilzer <ddkilzer@webkit.org>
+
+ Reviewed by Geoff.
+
+ Update embedded pcre library from version 6.1 to 6.2. From the pcre ChangeLog:
+
+ 3. Added "b" to the 2nd argument of fopen() in dftables.c, for non-Unix-like
+ operating environments where this matters.
+
+ 5. Named capturing subpatterns were not being correctly counted when a pattern
+ was compiled. This caused two problems: (a) If there were more than 100
+ such subpatterns, the calculation of the memory needed for the whole
+ compiled pattern went wrong, leading to an overflow error. (b) Numerical
+ back references of the form \12, where the number was greater than 9, were
+ not recognized as back references, even though there were sufficient
+ previous subpatterns.
+
+ * pcre/dftables.c: Item 3.
+ (main):
+ * pcre/pcre.h: Updated version.
+ * pcre/pcre_compile.c: Item 5.
+ (read_repeat_counts):
+ (pcre_compile2):
+
+2006-12-29 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Brian Dash... err... Mark Rowe.
+
+ More cleanup in preparation for fixing <rdar://problem/4608404>
+ WebScriptObject's _executionContext lack of ownership policy causes
+ crashes (e.g., in Dashcode)
+
+ The key change here is to RootObject::RootObject().
+
+ * JavaScriptCore.exp:
+
+ * bindings/c/c_utility.cpp:
+ (KJS::Bindings::convertValueToNPVariant): Changed to use new constructor.
+
+ * bindings/jni/jni_jsobject.cpp:
+ (JavaJSObject::createNative): Changed to use new constructor. Replaced
+ large 'if' followed by default condition with "if !" and explicit default
+ condition.
+
+ * bindings/objc/objc_runtime.mm:
+ (convertValueToObjcObject): Changed to use new constructor.
+
+ * bindings/runtime_root.cpp:
+ (KJS::Bindings::RootObject::destroy): "removeAllNativeReferences" => "destroy"
+ because this function actually destroys the RootObject.
+
+ * bindings/runtime_root.h: Changed Interpreter* to RefPtr<Interpreter>
+ to prevent a RootObject from holding a stale Interperter*.
+
+ (KJS::Bindings::RootObject::RootObject): Changed constructor to take an
+ Interpreter*, since it's pointless to create a RootObject without one.
+ Removed setRootObjectImp() and rootObjectImp() because they were just
+ a confusing way of setting and getting the Interpreter's global object.
+
+ (KJS::Bindings::RootObject::nativeHandle): "_nativeHandle" => "m_nativeHandle"
+ (KJS::Bindings::RootObject::interpreter): "_interpreter" => "m_interpreter"
+
+2006-12-28 George Staikos <staikos@kde.org>
+
+ Reviewed by Olliej.
+
+ * bindings/qt/qt_instance.cpp: build
+ (KJS::Bindings::QtInstance::QtInstance):
+
+2006-12-28 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ More cleanup. Layout tests pass.
+
+ Use a helper function to initialize and access WebUndefined and WebScriptObject.
+
+ * bindings/objc/objc_runtime.h:
+ * bindings/objc/objc_runtime.mm:
+ (KJS::Bindings::webScriptObjectClass):
+ (KJS::Bindings::webUndefinedClass):
+ (convertValueToObjcObject):
+ * bindings/objc/objc_utility.mm:
+ (KJS::Bindings::convertValueToObjcValue):
+ (KJS::Bindings::convertObjcValueToValue):
+
+2006-12-28 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Brady Eidson.
+
+ Some cleanup in preparation for fixing <rdar://problem/4608404>
+ WebScriptObject's _executionContext lack of ownership policy causes
+ crashes (e.g., in Dashcode)
+
+ I'm just trying to make heads or tails of this baffling code.
+
+ Renamed "root" | "execContext" | "executionContext" => "rootObject", because
+ that's the object's (admittedly vague) type name.
+
+ * bindings/runtime.cpp: Removed createLanguageInstanceForValue
+ because I'll give you a dollar if you can explain to me what it actually did.
+
+ * bindings/runtime_root.cpp: Put everything in the KJS::Bindings namespace,
+ removing the KJS::Bindings prefix from individual functions and datatypes.
+ This matches the header and eliminates a lot of syntax cruft.
+
+ * bindings/c/c_utility.cpp:
+ (KJS::Bindings::convertValueToNPVariant): Replaced use of createLanguageInstanceForValue
+ with call to _NPN_CreateScriptObject because that's what createLanguageInstanceForValue
+ actually did (but don't ask me for that dollar now; that's cheating.)
+
+ * bindings/objc/objc_utility.h:
+ * bindings/objc/objc_utility.mm:
+ (KJS::Bindings::convertValueToObjcValue): Removed. Its only purpose was
+ to call a single function for WebKit, which WebKit can do on its own.
+
+ * kjs/interpreter.h: Removed rtti() because it was unused, and this class
+ is scheduled for demolition anyway.
+
+ * kjs/interpreter.cpp: Removed createLanguageInstanceForValue because it had
+ nothing to do with the Interpreter, and nothing makes Chuck Norris more mad
+ than a function whose sole purpose is to call another function of the same
+ name. (Really, I asked him.)
+
+2006-12-26 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Eric Seidel.
+
+ Some cleanup in preparation for fixing <rdar://problem/4740328> Safari
+ crash on quit in _NPN_ReleaseObject from KJS::Bindings::CInstance::~CInstance
+
+ * bindings/c/c_instance.cpp:
+ * bindings/c/c_instance.h: Removed unused copy constructor and assignment
+ operator. They made tracking data flow more difficult. Unused code is also
+ dangerous because it can succumb to bit rot with the stealth of a Ninja.
+
+ Replaced #include with forward declaration to reduce header dependency.
+
+ * bindings/npruntime.cpp: Sorted #includes.
+ (_NPN_GetStringIdentifier): Replaced assert with ASSERT.
+ (_NPN_GetStringIdentifiers): ditto
+ (_NPN_ReleaseVariantValue): ditto
+ (_NPN_CreateObject): ditto
+ (_NPN_RetainObject): ditto
+ (_NPN_ReleaseObject): ditto
+ (_NPN_DeallocateObject): ditto
+
+2006-12-20 Anders Carlsson <acarlsson@apple.com>
+
+ * kjs/string_object.cpp:
+ (localeCompare):
+ Another speculative Win32 fix.
+
+2006-12-20 Anders Carlsson <acarlsson@apple.com>
+
+ * kjs/string_object.cpp:
+ (localeCompare):
+ Speculative Win32 fix.
+
+2006-12-20 Anders Carlsson <acarlsson@apple.com>
+
+ Reviewed by Darin.
+
+ <rdar://problem/4235733>
+ <http://bugs.webkit.org/?show_bug.cgi?id=10193>
+ support String.localeCompare.
+
+ Implement localeCompare.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * kjs/string_object.cpp:
+ (localeCompare):
+ (StringProtoFunc::callAsFunction):
+ * kjs/string_object.h:
+ (KJS::StringProtoFunc::):
+
+2006-12-20 Timothy Hatcher <timothy@apple.com>
+
+ Reviewed by Mark Rowe.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj: use GCC 4.0 for all the other test targets
+
+2006-12-20 Timothy Hatcher <timothy@apple.com>
+
+ Reviewed by Mark Rowe.
+
+ <rdar://problem/4871613> JavaScriptCore-421.31's dftables target needs to override default compiler and use gcc-4.0
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2006-12-20 Lars Knoll <lars@trolltech.com>
+
+ Reviewed by David Hyatt
+
+ Added support to bind QObject's to
+ JavaScript.
+
+ * JavaScriptCore.pro:
+ * bindings/qt/qt_class.cpp: Added.
+ (KJS::Bindings::QtClass::QtClass):
+ (KJS::Bindings::QtClass::~QtClass):
+ (KJS::Bindings::QtClass::classForObject):
+ (KJS::Bindings::QtClass::name):
+ (KJS::Bindings::QtClass::methodsNamed):
+ (KJS::Bindings::QtClass::fieldNamed):
+ * bindings/qt/qt_class.h: Added.
+ (KJS::Bindings::QtClass::constructorAt):
+ (KJS::Bindings::QtClass::numConstructors):
+ * bindings/qt/qt_instance.cpp: Added.
+ (KJS::Bindings::QtInstance::QtInstance):
+ (KJS::Bindings::QtInstance::~QtInstance):
+ (KJS::Bindings::QtInstance::operator=):
+ (KJS::Bindings::QtInstance::getClass):
+ (KJS::Bindings::QtInstance::begin):
+ (KJS::Bindings::QtInstance::end):
+ (KJS::Bindings::QtInstance::implementsCall):
+ (KJS::Bindings::QtInstance::invokeMethod):
+ (KJS::Bindings::QtInstance::invokeDefaultMethod):
+ (KJS::Bindings::QtInstance::defaultValue):
+ (KJS::Bindings::QtInstance::stringValue):
+ (KJS::Bindings::QtInstance::numberValue):
+ (KJS::Bindings::QtInstance::booleanValue):
+ (KJS::Bindings::QtInstance::valueOf):
+ * bindings/qt/qt_instance.h: Added.
+ (KJS::Bindings::QtInstance::getObject):
+ * bindings/qt/qt_runtime.cpp: Added.
+ (KJS::Bindings::convertValueToQVariant):
+ (KJS::Bindings::convertQVariantToValue):
+ (KJS::Bindings::QtField::name):
+ (KJS::Bindings::QtField::valueFromInstance):
+ (KJS::Bindings::QtField::setValueToInstance):
+ * bindings/qt/qt_runtime.h: Added.
+ (KJS::Bindings::QtField::QtField):
+ (KJS::Bindings::QtField::type):
+ (KJS::Bindings::QtMethod::QtMethod):
+ (KJS::Bindings::QtMethod::name):
+ (KJS::Bindings::QtMethod::numParameters):
+ * bindings/runtime.cpp:
+ (KJS::Bindings::Instance::createBindingForLanguageInstance):
+ * bindings/runtime.h:
+ (KJS::Bindings::Instance::):
+ * bindings/testbindings.pro: Added.
+ * bindings/testqtbindings.cpp: Added.
+ (MyObject::MyObject):
+ (MyObject::setTestString):
+ (MyObject::setTestInt):
+ (MyObject::testString):
+ (MyObject::testInt):
+ (MyObject::foo):
+ (Global::className):
+ (main):
+
+2006-12-19 Anders Carlsson <acarlsson@apple.com>
+
+ Reviewed by Geoff.
+
+ Add -p option to testkjs which pretty prints the files instead of executing them.
+
+ * JavaScriptCore.exp:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * kjs/Parser.cpp:
+ (KJS::Parser::prettyPrint):
+ * kjs/Parser.h:
+ * kjs/testkjs.cpp:
+ (doIt):
+
+2006-12-19 Brady Eidson <beidson@apple.com>
+
+ Rubberstamped by Lou
+
+ Removed unneccessary "else"
+
+ * wtf/Assertions.cpp:
+
+2006-12-19 Timothy Hatcher <timothy@apple.com>
+
+ Reviewed by Darin.
+
+ <rdar://problem/4891774> Local WebCore/WebBrowser builds fail in 9A328 due to warning about ObjC-2.0 language features
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2006-12-17 Simon Hausmann <hausmann@kde.org>
+
+ Reviewed by Zack.
+
+ * kjs/testkjs.pro: Oops, make it also build on machines other than
+ mine :)
+
+2006-12-17 Simon Hausmann <hausmann@kde.org>
+
+ Reviewed by Rob Buis.
+
+ * kjs/testkjs.pro: Added .pro file to build testkjs.
+
+2006-12-16 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Rob.
+
+ A deleted object was accessed to prepare RegExp construction error messages.
+
+ * kjs/regexp_object.cpp:
+ (RegExpObjectImp::construct): Wrap the RegExp into an OwnPtr.
+
+2006-12-16 Mitz Pettel <mitz@webkit.org>
+
+ Reviewed by Alexey.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=11814
+ REGRESSION(r18098): Find does not work with capital letters
+
+ Test: editing/execCommand/findString-3.html
+
+ * wtf/unicode/icu/UnicodeIcu.h:
+ (WTF::Unicode::foldCase): Changed to not return an error if the result fits
+ in the buffer without a null terminator.
+
+2006-12-13 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Anders.
+
+ - added equality and inequality operations for HashMap and Vector, useful for comparing more complex types
+
+ * wtf/HashMap.h:
+ (WTF::operator==):
+ (WTF::operator!=):
+ * wtf/Vector.h:
+ (WTF::operator==):
+ (WTF::operator!=):
+
+2006-12-12 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Geoff. Based on a patch by Maks Orlovich.
+
+ http://bugs.webkit.org/show_bug.cgi?id=6257
+ Throw errors on invalid expressions (KJS merge)
+
+ * kjs/regexp.cpp:
+ (KJS::RegExp::RegExp):
+ (KJS::RegExp::~RegExp):
+ (KJS::RegExp::match):
+ * kjs/regexp.h:
+ (KJS::RegExp::flags):
+ (KJS::RegExp::isValid):
+ (KJS::RegExp::errorMessage):
+ (KJS::RegExp::subPatterns):
+ Remember and report RegExp construction failures. Renamed data members not to start with underscores.
+
+ * kjs/regexp_object.cpp:
+ (RegExpObjectImp::construct): Raise an exception if RegExp construction fails.
+ (RegExpObjectImp::callAsFunction): Removed an obsolete comment.
+
+ * tests/mozilla/ecma_3/RegExp/regress-119909.js: Reduced the number of nested parentheses to
+ a value supported by PCRE.
+
+2006-12-11 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Darin.
+
+ http://bugs.webkit.org/show_bug.cgi?id=9673
+ Add support for window.atob() and window.btoa()
+
+ * JavaScriptCore.exp: Export UString::is8Bit().
+ * JavaScriptCore.xcodeproj/project.pbxproj: Added StringExtras.h as
+ a private header.
+
+2006-12-11 Darin Adler <darin@apple.com>
+
+ Reviewed by Brady.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj: Let Xcode update this
+ (I think Hyatt is using an old Xcode).
+
+2006-12-11 David Hyatt <hyatt@apple.com>
+
+ Fix the failing layout test. Just remove Unicode::isSpace and
+ revert StringImpl to do the same thing it was doing before.
+
+ Reviewed by darin
+
+ * wtf/unicode/icu/UnicodeIcu.h:
+ * wtf/unicode/qt4/UnicodeQt4.h:
+
+2006-12-09 George Staikos <staikos@kde.org>
+
+ Reviewed by Zack.
+
+ Fix bison again on qmake build.
+
+ * JavaScriptCore.pro:
+
+2006-12-09 Lars Knoll <lars@trolltech.com>
+
+ Reviewed by Zack
+
+ Make it possible to build WebKit with qmake.
+
+ * JavaScriptCore.pro: Added.
+ * kjs/kjs.pro: Removed.
+ * pcre/pcre.pri: Added.
+
+2006-12-09 Zack Rusin <zack@kde.org>
+
+ Fixing the compilation with platform kde after the icu changes.
+
+ * CMakeLists.txt:
+
+2006-12-09 Adam Roben <aroben@apple.com>
+
+ Reviewed by Darin.
+
+ Some updates in reaction to r18098.
+
+ * wtf/unicode/icu/UnicodeIcu.h: Use !! to convert UBool to bool in all
+ cases.
+ (WTF::Unicode::toLower):
+ (WTF::Unicode::toUpper):
+ (WTF::Unicode::isDigit):
+ (WTF::Unicode::isSpace):
+ (WTF::Unicode::isPunct):
+ (WTF::Unicode::isLower):
+ (WTF::Unicode::isUpper):
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+
+2006-12-09 George Staikos <staikos@kde.org>
+
+ Patch by Lars Knoll, comment out ICU dependency on Qt platform (unused code).
+
+ Reviewed by Darin.
+
+ * bindings/c/c_utility.cpp:
+ (KJS::Bindings::convertUTF8ToUTF16):
+
+2006-12-08 David Hyatt <hyatt@apple.com>
+
+ Land the new ICU abstraction layer. Patch by Lars.
+
+ Reviewed by me
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * wtf/Platform.h:
+ * wtf/unicode/UnicodeCategory.h: Removed.
+ * wtf/unicode/UnicodeDecomposition.h: Removed.
+ * wtf/unicode/UnicodeDirection.h: Removed.
+ * wtf/unicode/icu/UnicodeIcu.h:
+ (WTF::Unicode::):
+ (WTF::Unicode::foldCase):
+ (WTF::Unicode::toLower):
+ (WTF::Unicode::toUpper):
+ (WTF::Unicode::toTitleCase):
+ (WTF::Unicode::isDigit):
+ (WTF::Unicode::isSpace):
+ (WTF::Unicode::isPunct):
+ (WTF::Unicode::mirroredChar):
+ (WTF::Unicode::category):
+ (WTF::Unicode::direction):
+ (WTF::Unicode::isLower):
+ (WTF::Unicode::isUpper):
+ (WTF::Unicode::digitValue):
+ (WTF::Unicode::combiningClass):
+ (WTF::Unicode::decompositionType):
+ (WTF::Unicode::strcasecmp):
+ (WTF::Unicode::memset):
+ * wtf/unicode/qt4/UnicodeQt4.cpp: Removed.
+ * wtf/unicode/qt4/UnicodeQt4.h:
+ (WTF::Unicode::):
+ (WTF::Unicode::toLower):
+ (WTF::Unicode::toUpper):
+ (WTF::Unicode::toTitleCase):
+ (WTF::Unicode::foldCase):
+ (WTF::Unicode::isPrintableChar):
+ (WTF::Unicode::isLower):
+ (WTF::Unicode::isUpper):
+ (WTF::Unicode::digitValue):
+ (WTF::Unicode::combiningClass):
+ (WTF::Unicode::decompositionType):
+ (WTF::Unicode::strcasecmp):
+ (WTF::Unicode::memset):
+ (WTF::Unicode::direction):
+ (WTF::Unicode::category):
+
+=== Safari-521.32 ===
+
+2006-12-08 Adam Roben <aroben@apple.com>
+
+ Reviewed by Anders.
+
+ This is a mo' better fix for ensuring we don't use macro definitions
+ of min/max.
+
+ * kjs/config.h:
+ * wtf/Vector.h:
+
+2006-12-07 Kevin Fyure <digdog@macports.org>
+
+ Reviewed by Darin.
+
+ http://bugs.webkit.org/show_bug.cgi?id=11545
+ Disable the testcases do not follow the ECMA-262v3 specification.
+
+ * tests/mozilla/expected.html: Update Results.
+ * tests/mozilla/js1_2/String/concat.js:
+ 4 tests disabled. The result of concat Array object is not followinig
+ ECMA 15.5.4.6
+ * tests/mozilla/js1_2/function/Number.js:
+ 1 test disabled. The result of Array object to Number object conversion
+ is not following ECMA 9.3. And the test was duplicated in
+ ecma/TypeConversion/9.3-1.js
+ * tests/mozilla/js1_2/function/String.js:
+ 2 tests disabled. The result of Object/Array object to String object
+ conversion is not following ECMA 15.5.1.1 and ECMA 9.8
+
+2006-11-30 Steve Falkenburg <sfalken@apple.com>
+
+ Reviewed by Oliver.
+
+ Move WTF from JavaScriptCore project into a new WTF project.
+
+ * JavaScriptCore.vcproj/JavaScriptCore.sln: Add WTF.vcproj to sln
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Remove WTF source files
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj: Added.
+ * JavaScriptCore.vcproj/testkjs/testkjs.vcproj: Add dependency on WTF.lib
+
+2006-11-30 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Beth Dakin.
+
+ Fixed up garbage collection at window close time.
+
+ * kjs/interpreter.cpp:
+ (KJS::Interpreter::~Interpreter): Garbage collect here, since
+ destroying the interpreter frees the global object and
+ therefore creates a lot of garbage.
+
+2006-11-20 W. Andy Carrel <wac@google.com>
+
+ Reviewed by Maciej.
+
+ http://bugs.webkit.org/show_bug.cgi?id=11501
+ REGRESSION: \u no longer escapes metacharacters in RegExps
+ http://bugs.webkit.org/show_bug.cgi?id=11502
+ Serializing RegExps doesn't preserve Unicode escapes
+
+ * kjs/lexer.cpp:
+ (Lexer::Lexer):
+ (Lexer::setCode):
+ (Lexer::shift):
+ (Lexer::scanRegExp):
+ Push \u parsing back down into the RegExp object rather than in the
+ parser. This backs out r17354 in favor of a new fix that better
+ matches the behavior of other browsers.
+
+ * kjs/lexer.h:
+ * kjs/regexp.cpp:
+ (KJS::RegExp::RegExp):
+ (KJS::sanitizePattern):
+ (KJS::isHexDigit):
+ (KJS::convertHex):
+ (KJS::convertUnicode):
+ * kjs/regexp.h:
+ Translate \u escaped unicode characters for the benefit of pcre.
+
+ * kjs/ustring.cpp:
+ (KJS::UString::append):
+ Fix failure to increment length on the first UChar appended to a
+ UString that was copy-on-write.
+
+ * tests/mozilla/ecma_2/RegExp/properties-001.js:
+ Adjust tests back to the uniform standards.
+
+2006-11-20 Samuel Weinig <sam@webkit.org>
+
+ Reviewed by Maciej.
+
+ Fix for http://bugs.webkit.org/show_bug.cgi?id=11647
+ Fix Win32 build
+
+ * kjs/config.h: define NOMINMAX instead of min/max
+ as themselves.
+ * wtf/Vector.h: put back hack to ensure that min/max
+ are not defined as macros.
+
+2006-11-19 Simon Hausmann <hausmann@kde.org>
+
+ Reviewed by Zack.
+
+ http://bugs.webkit.org/show_bug.cgi?id=11649
+ Fix CMake Qt-only build without KDE CMake files
+
+ * CMakeLists.txt:
+ * pcre/CMakeLists.txt:
+
+2006-11-17 Anders Carlsson <acarlsson@apple.com>
+
+ Reviewed by Adam.
+
+ Make sure that we always use std::min and std::max instead of macros.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * kjs/config.h:
+ * wtf/Vector.h:
+
+=== Safari-521.31 ===
+
+2006-11-12 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Beth Dakin.
+
+ Added project-wide setting to disable Microsoft's made-up deprecation
+ warnings related to std:: functions. (Doesn't have any affect yet,
+ since we currently disable all deprecation warnings.)
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+
+2006-11-12 Mark Rowe <bdash@webkit.org>
+
+ Reviewed by Mitz.
+
+ Clean up of JavaScriptCore bakefiles.
+
+ * JavaScriptCoreSources.bkl:
+ * jscore.bkl:
+
+2006-11-11 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Maciej.
+
+ http://bugs.webkit.org/show_bug.cgi?id=11508
+ Undisable some warnings for JSImmediate.h
+
+ Fix suggested by Don Gibson.
+
+ * kjs/JSImmediate.h:
+ Re-enable all MSVC warnings, move the remaining runtime checks
+ to compile-time.
+
+2006-11-10 Zalan Bujtas <zalan.bujtas@nokia.com>
+
+ Reviewed by Maciej.
+
+ Added s60/symbian platform defines.
+ http://bugs.webkit.org/show_bug.cgi?id=11540
+
+ * wtf/Platform.h:
+
+=== Safari-521.30 ===
+
+2006-11-08 Ada Chan <adachan@apple.com>
+
+ Reviewed by darin.
+
+ Added a method to delete all the keys in a HashMap.
+
+ * wtf/HashMap.h:
+ (WTF::deleteAllPairFirsts):
+ (WTF::deleteAllKeys):
+
+2006-11-07 Anders Carlsson <acarlsson@apple.com>
+
+ Reviewed by Geoff.
+
+ * API/JSClassRef.cpp:
+ (OpaqueJSClass::OpaqueJSClass):
+ Initialize cachedPrototype to 0.
+
+2006-11-06 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
+
+ Reviewed by Maciej.
+
+ Remove warning about garbage after #else. #else clause applies for all
+ non-mac platforms, not only win.
+
+ * kjs/date_object.cpp:
+
+2006-11-06 Mark Rowe <bdash@webkit.org>
+
+ Reviewed by the wonderful Mitz Pettel.
+
+ http://bugs.webkit.org/show_bug.cgi?id=11524
+ Bug 11524: REGRESSION(r9842): Array.prototype.join should use ToString operator rather than calling toString on each element
+
+ * kjs/array_object.cpp:
+ (ArrayProtoFunc::callAsFunction): Use ToString operator on each element rather than calling their toString method.
+
+2006-11-03 Steve Falkenburg <sfalken@apple.com>
+
+ Fix build
+
+ * kjs/JSImmediate.h:
+
+2006-11-03 Alexey Proskuryakov <ap@nypop.com>
+
+ Reviewed by Darin.
+
+ http://bugs.webkit.org/show_bug.cgi?id=11504
+ Fix warnings on non 32 bit platforms
+
+ * kjs/JSImmediate.h:
+ (KJS::JSImmediate::NanAsBits):
+ (KJS::JSImmediate::oneAsBits):
+ Rewrite in a way that moves runtime checks to compile-time.
+
+ (KJS::):
+ (KJS::JSImmediate::fromDouble):
+ (KJS::JSImmediate::toDouble):
+
+2006-11-02 George Staikos <staikos@kde.org>
+
+ Reviewed by Maciej.
+
+ * collector.cpp:
+ Remove a deprecated pthreads call.
+
+2006-11-02 Anders Carlsson <acarlsson@apple.com>
+
+ Reviewed by Maciej, landed by Anders.
+
+ * CMakeLists.txt:
+ Make KDE support optional.
+
+2006-11-01 Kevin McCullough <KMcCullough@apple.com>
+
+ Reviewed by Brady.
+
+ - Fixes many JavaScriptCore tests in other timezones. The root problem is that on mac localtime() returns historically accurate information for DST, but the JavaScript spec explicitly states to not take into account historical information but rather to interpolate from valid years.
+
+ * kjs/DateMath.cpp:
+ (KJS::equivalentYearForDST):
+ (KJS::getDSTOffsetSimple):
+ (KJS::getDSTOffset):
+
+2006-10-31 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Beth.
+
+ Fixed http://bugs.webkit.org/show_bug.cgi?id=11477
+ REGRESSION: GMail crashes in KJS::FunctionImp::callerGetter
+
+ * kjs/function.cpp:
+ (KJS::FunctionImp::argumentsGetter): Removed unnecessary braces.
+ (KJS::FunctionImp::callerGetter): More logical NULL checking.
+
+2006-10-31 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff.
+
+ Adding definition for PLATFORM(CI)
+
+ * wtf/Platform.h:
+
+2006-10-31 Vladimir Olexa <vladimir.olexa@gmail.com>
+
+ Reviewed by Geoff.
+
+ http://bugs.webkit.org/show_bug.cgi?id=4166
+ Function object does not support caller property
+
+ Test: fast/js/caller-property.html
+
+ * kjs/function.cpp:
+ (KJS::FunctionImp::callerGetter): added
+ (KJS::FunctionImp::getOwnPropertySlot): added if statement to handle callerGetter()
+ * kjs/function.h: added callerGetter() declaration
+ * kjs/identifier.h: added caller property macro
+ * tests/mozilla/expected.html:
+
+2006-10-30 Kevin McCullough <KMcCullough@apple.com>
+
+ Reviewed by Adam.
+
+ - Fix some timezone issues and JavaScriptCore date tests. Addresses bugzilla 4930.
+
+ * kjs/DateMath.h:
+ (KJS::GregorianDateTime::GregorianDateTime): Here's the fix, to add parenthesis for order of precedence.
+ * kjs/date_object.cpp:
+ (KJS::DateProtoFunc::callAsFunction):
+ (KJS::DateObjectImp::construct): memset not needed as GregorianDateTime initializes itself.
+
+2006-10-30 Darin Adler <darin@apple.com>
+
+ Reviewed by John Sullivan.
+
+ * kjs/SavedBuiltins.h: Added needed include.
+ * wtf/OwnPtr.h: (WTF::OwnPtr::set): Fixed mistake in assertion.
+
+2006-10-28 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - renamed PassRefPtr::release to releaseRef to make it clearer that
+ it's the counterpart of adoptRef, and to make it harder to confuse
+ it with the safer-to-use RefPtr::release
+
+ * kjs/identifier.cpp:
+ (KJS::CStringTranslator::translate):
+ (KJS::UCharBufferTranslator::translate):
+ * kjs/ustring.cpp:
+ (KJS::UString::Rep::create):
+ * wtf/PassRefPtr.h:
+ (WTF::PassRefPtr::PassRefPtr):
+ (WTF::PassRefPtr::~PassRefPtr):
+ (WTF::PassRefPtr::get):
+ (WTF::PassRefPtr::releaseRef):
+ (WTF::PassRefPtr::operator->):
+ (WTF::PassRefPtr::operator=):
+ (WTF::adoptRef):
+ (WTF::static_pointer_cast):
+ (WTF::const_pointer_cast):
+ * wtf/RefPtr.h:
+ (WTF::RefPtr::RefPtr):
+ (WTF::RefPtr::operator=):
+
+2006-10-28 Darin Adler <darin@apple.com>
+
+ Reviewed by Steve.
+
+ * kjs/grammar.y: Add definitions of YYMALLOC and YYFREE to fix
+ a warning some people see (not sure why others don't see it).
+
+ * JavaScriptCore.vcproj/JavaScriptCore/grammarWrapper.cpp: Touch
+ this file to force it to re-build grammar.cpp.
+
+2006-10-28 Darin Adler <darin@apple.com>
+
+ Reviewed by Geoff.
+
+ - made changes so the code compiles with the highest warning level
+ under MSVC (disabling some warnings, making some code fixes)
+
+ * API/JSCallbackConstructor.cpp:
+ (KJS::JSCallbackConstructor::construct):
+ * API/JSCallbackFunction.cpp:
+ (KJS::JSCallbackFunction::callAsFunction):
+ * API/JSCallbackObject.cpp:
+ (KJS::JSCallbackObject::init):
+ (KJS::JSCallbackObject::construct):
+ (KJS::JSCallbackObject::callAsFunction):
+ * API/JSObjectRef.cpp:
+ (JSPropertyNameArrayGetNameAtIndex):
+ * API/JSStringRef.cpp:
+ (JSStringCreateWithCharacters):
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * bindings/c/c_utility.cpp:
+ (KJS::Bindings::convertUTF8ToUTF16):
+ (KJS::Bindings::coerceValueToNPVariantStringType):
+ (KJS::Bindings::convertValueToNPVariant):
+ * kjs/DateMath.h:
+ (KJS::GregorianDateTime::GregorianDateTime):
+ * kjs/ExecState.h:
+ (KJS::ExecState::hadException):
+ * kjs/JSImmediate.h:
+ (KJS::JSImmediate::fromDouble):
+ (KJS::JSImmediate::toDouble):
+ (KJS::JSImmediate::NanAsBits):
+ (KJS::JSImmediate::oneAsBits):
+ * kjs/Parser.h:
+ * kjs/PropertyNameArray.h:
+ (KJS::PropertyNameArray::size):
+ * kjs/array_object.cpp:
+ (ArrayObjectImp::callAsFunction):
+ * kjs/bool_object.cpp:
+ (BooleanObjectImp::callAsFunction):
+ * kjs/collector.cpp:
+ (KJS::Collector::allocate):
+ (KJS::Collector::markCurrentThreadConservatively):
+ (KJS::Collector::collect):
+ * kjs/completion.h:
+ (KJS::Completion::isValueCompletion):
+ * kjs/date_object.cpp:
+ (KJS::findMonth):
+ * kjs/debugger.cpp:
+ (Debugger::sourceParsed):
+ (Debugger::sourceUnused):
+ (Debugger::exception):
+ (Debugger::atStatement):
+ (Debugger::callEvent):
+ (Debugger::returnEvent):
+ * kjs/dtoa.cpp:
+ * kjs/error_object.cpp:
+ (ErrorObjectImp::callAsFunction):
+ (NativeErrorImp::callAsFunction):
+ * kjs/function.cpp:
+ (KJS::FunctionImp::processVarDecls):
+ (KJS::GlobalFuncImp::callAsFunction):
+ * kjs/function_object.cpp:
+ (FunctionPrototype::callAsFunction):
+ * kjs/grammar.y:
+ * kjs/identifier.cpp:
+ (KJS::CStringTranslator::translate):
+ (KJS::Identifier::add):
+ * kjs/internal.h:
+ * kjs/lexer.cpp:
+ (Lexer::lex):
+ (Lexer::isIdentStart):
+ (Lexer::isIdentPart):
+ (isDecimalDigit):
+ (Lexer::isHexDigit):
+ (Lexer::isOctalDigit):
+ (Lexer::matchPunctuator):
+ (Lexer::singleEscape):
+ (Lexer::convertOctal):
+ (Lexer::convertHex):
+ (Lexer::convertUnicode):
+ (Lexer::record8):
+ * kjs/lexer.h:
+ * kjs/math_object.cpp:
+ (MathFuncImp::callAsFunction):
+ * kjs/number_object.cpp:
+ (integer_part_noexp):
+ (intPow10):
+ (NumberProtoFunc::callAsFunction):
+ (NumberObjectImp::callAsFunction):
+ * kjs/object.cpp:
+ (KJS::JSObject::deleteProperty):
+ (KJS::JSObject::callAsFunction):
+ (KJS::JSObject::toBoolean):
+ (KJS::JSObject::toObject):
+ * kjs/object.h:
+ (KJS::JSObject::getPropertySlot):
+ * kjs/property_map.cpp:
+ (KJS::isValid):
+ (KJS::PropertyMap::put):
+ (KJS::PropertyMap::insert):
+ (KJS::PropertyMap::containsGettersOrSetters):
+ * kjs/property_map.h:
+ (KJS::PropertyMap::hasGetterSetterProperties):
+ * kjs/property_slot.h:
+ * kjs/string_object.cpp:
+ (StringInstance::getPropertyNames):
+ (StringObjectImp::callAsFunction):
+ (StringObjectFuncImp::callAsFunction):
+ * kjs/ustring.cpp:
+ (KJS::UString::Rep::computeHash):
+ (KJS::UString::UString):
+ (KJS::UString::from):
+ (KJS::UString::append):
+ (KJS::UString::ascii):
+ (KJS::UString::operator=):
+ (KJS::UString::find):
+ (KJS::UString::rfind):
+ * kjs/ustring.h:
+ (KJS::UChar::high):
+ (KJS::UChar::low):
+ (KJS::UCharReference::low):
+ (KJS::UCharReference::high):
+ * kjs/value.cpp:
+ (KJS::JSValue::toUInt16):
+ * kjs/value.h:
+ * pcre/pcre_compile.c:
+ (get_othercase_range):
+ * pcre/pcre_exec.c:
+ (match):
+ * pcre/pcre_internal.h:
+ * wtf/HashFunctions.h:
+ (WTF::intHash):
+ (WTF::PtrHash::hash):
+ * wtf/MathExtras.h:
+ (isnan):
+ (lround):
+ (lroundf):
+ * wtf/StringExtras.h:
+ (strncasecmp):
+ * wtf/unicode/icu/UnicodeIcu.h:
+ (WTF::Unicode::isPrintableChar):
+
+2006-10-26 W. Andy Carrel <wac@google.com>
+
+ Reviewed by Maciej.
+
+ - Fix http://bugs.webkit.org/show_bug.cgi?id=7445 /
+ <rdar://problem/4614195> (and 7253 / <rdar://4694011>) by changing
+ inline regexps so that they can have \u escaped Unicode sequences and
+ still work properly.
+
+ * kjs/lexer.cpp:
+ (Lexer::Lexer):
+ (Lexer::setCode):
+ (Lexer::shift): Looking ahead one additional character for the benefit
+ of scanRegExp
+ (Lexer::scanRegExp): Change code to support unicode escapes in inline
+ regexps.
+ * kjs/lexer.h: Extra lookahead added.
+
+=== Safari-521.29 ===
+
+2006-10-26 Nikolas Zimmermann <zimmermann@kde.org>
+
+ Reviewed by Darin.
+
+ Fix build with older gcc 3.3.4.
+
+ * kjs/DateMath.cpp: Remove inline prefix.
+ (KJS::equivalentYearForDST):
+
+2006-10-26 Darin Adler <darin@apple.com>
+
+ Reviewed by John.
+
+ - fix iteration of properties of string objects (found because of a warning
+ emitted by the MSVC compiler)
+
+ * kjs/string_object.cpp: (StringInstance::getPropertyNames): Change code that
+ wants to format a number as a string to use UString::from. Before it was using
+ the UString constructor that makes a string from a character!
+
+ * kjs/ustring.h:
+ * kjs/ustring.cpp: Remove the dangerous and not all that helpful UString(char)
+ constructor.
+
+ * kjs/grammar.y: Change code to not depend on the UString(char) constructor.
+ This is potentially more efficient anyway because we could overload the + operator
+ some day to handle char* directly instead of creating a UString.
+
+ * kjs/nodes2string.cpp: (SourceStream::operator<<): Change code to not depend on
+ the UString(char) constructor.
+
+2006-10-25 Kevin McCullough <KMcCullough@apple.com>
+
+ Reviewed by Steve (rubber stamp).
+
+ - Link against your local build of JavaScriptCore.lib first, this fixes some errors on release builds of testkjs.
+
+ * JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
+
+2006-10-25 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Lou.
+
+ Removed duplicate symbol declaration.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * kjs/grammar.y:
+
+2006-10-24 Steve Falkenburg <sfalken@apple.com>
+
+ Build config change
+
+ * JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
+
+2006-10-24 Kevin McCullough <KMcCullough@apple.com>
+
+ Reviewed by Brady.
+
+ - Fixes a date formatting issue on win. Specifically strftime cannot handle some ranges of time so we shift time call strftime and then manipulate the returned string, if needed.
+
+ * kjs/date_object.cpp:
+ (KJS::):
+ (KJS::formatLocaleDate):
+ (KJS::DateProtoFunc::callAsFunction):
+
+2006-10-23 Kevin McCullough <KMcCullough@apple.com>
+
+ Reviewed by
+
+ - Build fix
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * kjs/grammar.y:
+
+2006-10-23 Kevin McCullough <KMcCullough@apple.com>
+
+ Reviewed by Maciej.
+
+ - Makes the toTM function an operator. Was going to piggy back on a patch but the patch needs more work.
+
+ * kjs/DateMath.cpp:
+ (KJS::equivalentYearForDST):
+ * kjs/DateMath.h:
+ (KJS::GregorianDateTime::operator tm):
+ * kjs/date_object.cpp:
+ (KJS::formatTime):
+ (KJS::DateProtoFunc::callAsFunction):
+
+2006-10-23 Kevin McCullough <KMcCullough@apple.com>
+
+ Reviewed by Maciej.
+
+ - Fixes two regressions on win. Both are stack overflows. For one the number of recursions is capped at 100, and for the other, nested parenthesis pairs are not evaluated (since they would evaluate to whatever is in them anyway).
+
+ * kjs/grammar.y:
+ * kjs/object.cpp:
+
+2006-10-21 Steve Falkenburg <sfalken@apple.com>
+
+ Reviewed by Adam.
+
+ Add minimal compatibility with MSVCRT leak checker
+
+ * wtf/FastMalloc.h:
+
+2006-10-23 Kevin McCullough <KMcCullough@apple.com>
+
+ Reviewed by Geof.
+
+ - Sets the lowercase range correctly in the test and consolidates a variable to make the test more readable.
+
+ * tests/mozilla/ecma/String/15.5.4.11-2.js:
+
+2006-10-21 Darin Adler <darin@apple.com>
+
+ Reviewed by Anders.
+
+ - http://bugs.webkit.org/show_bug.cgi?id=11377
+ swap(Vector, Vector) should be O(1) instead of O(n)
+
+ * wtf/Vector.h:
+ (WTF::VectorBuffer::swap): Added.
+ (WTF::Vector::swap): Added.
+ (WTF::swap): Added overload that takes two Vector objects.
+
+2006-10-21 Darin Adler <darin@apple.com>
+
+ Reviewed by Adam.
+
+ - http://bugs.webkit.org/show_bug.cgi?id=11376
+ build scripts should invoke make with "-j" option for multiple processors
+
+ * JavaScriptCore.xcodeproj/project.pbxproj: Pass -j `sysctl -n hw.ncpu` to make.
+
+2006-10-19 Kevin McCullough <KMcCullough@apple.com>
+
+ Reviewed by Geof.
+
+ Changed test to make us pass Georgian case changing for Unicode 4.0 and 5.0. This incorporates changes from the 1.4 revision of the same mozilla test.
+ On Tiger we are still using Unicode 4.0 but on win and Leopard we are using Unicode 5.0, so this test currently allows for either answer.
+
+ * tests/mozilla/ecma/String/15.5.4.11-2.js:
+
+2006-10-18 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Geoff.
+
+ - remove vestiges of KXMLCore name (former name of WTF).
+
+ * wtf/Assertions.h:
+ * wtf/FastMalloc.h:
+ (operator new):
+ (operator delete):
+ (operator new[]):
+ (operator delete[]):
+ * wtf/FastMallocInternal.h:
+ * wtf/Forward.h:
+ * wtf/GetPtr.h:
+ * wtf/HashCountedSet.h:
+ * wtf/HashFunctions.h:
+ * wtf/HashMap.h:
+ * wtf/HashSet.h:
+ * wtf/HashTable.h:
+ * wtf/HashTraits.h:
+ * wtf/ListRefPtr.h:
+ * wtf/MathExtras.h:
+ * wtf/Noncopyable.h:
+ * wtf/OwnArrayPtr.h:
+ * wtf/OwnPtr.h:
+ * wtf/PassRefPtr.h:
+ * wtf/Platform.h:
+ * wtf/RefPtr.h:
+ * wtf/StringExtras.h:
+ (snprintf):
+ * wtf/UnusedParam.h:
+ * wtf/Vector.h:
+ * wtf/VectorTraits.h:
+
+2006-10-17 Steve Falkenburg <sfalken@apple.com>
+
+ Reviewed by Maciej.
+
+ Adjust include paths
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+
+2006-10-17 Kevin McCullough <KMcCullough@apple.com>
+
+ Reviewed by Darin.
+
+ Fixed a date issue where the UTC offset was not set in win.
+
+ * kjs/DateMath.cpp:
+ (KJS::getDSTOffsetSimple):
+ (KJS::getDSTOffset):
+ (KJS::msToGregorianDateTime):
+ * kjs/DateMath.h:
+ (KJS::):
+ (KJS::GregorianDateTime::GregorianDateTime):
+
+2006-10-17 Kevin McCullough <KMcCullough@apple.com>
+
+ Reviewed by Brady.
+
+ Fixes a JavaScriptCore math issue on win.
+
+ * kjs/math_object.cpp:
+ (MathFuncImp::callAsFunction):
+ * wtf/MathExtras.h:
+ (wtf_atan2):
+
+2006-10-16 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Geof.
+
+ Removed unecessary global specifiers.
+
+ * kjs/math_object.cpp:
+ (MathFuncImp::callAsFunction):
+
+2006-10-16 Kevin McCullough <KMcCullough@apple.com>
+
+ Reviewed by John.
+
+ Fixes a compile order issue for testkjs on win.
+
+ * JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
+
+2006-10-15 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
+
+ Reviewed by Anders.
+
+ Remove junk (as gcc calls it) after #else clause.
+
+ * wtf/FastMalloc.cpp:
+ (WTF::do_free):
+
+2006-10-14 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
+
+ Reviewed by Maciej.
+
+ Define KXMLCORE_USE_CURL for platforms that wish to use CURL as
+ networking, and set it for GDK build
+
+ * wtf/Platform.h:
+
+2006-10-13 Brett Wilson <brettw@google.com>
+
+ Reviewed by Kevin McCullough.
+
+ Fixes http://bugs.webkit.org/show_bug.cgi?id=11283
+ Fixes Qt/Linux and Windows build
+
+ * kjs/DateMath.cpp:
+ * kjs/DateMath.h:
+ * kjs/date_object.cpp:
+ (KJS::DateProtoFunc::callAsFunction):
+
+2006-10-13 Kevin McCullough <KMcCullough@apple.com>
+
+ Reviewed by Adam, Geoff, Darin.
+
+ Fixed displaying the UTC offset and time zone string, as well as renamed the GregorianDateTime structure and clean up.
+
+ * ChangeLog:
+ * kjs/DateMath.cpp:
+ (KJS::getUTCOffset):
+ (KJS::getDSTOffsetSimple):
+ (KJS::gregorianDateTimeToMS):
+ (KJS::msToGregorianDateTime):
+ * kjs/DateMath.h:
+ (KJS::GregorianDateTime::GregorianDateTime):
+ (KJS::GregorianDateTime::~GregorianDateTime):
+ (KJS::GregorianDateTime::toTM):
+ * kjs/date_object.cpp:
+ (KJS::gmtoffset):
+ (KJS::formatDate):
+ (KJS::formatDateUTCVariant):
+ (KJS::formatTime):
+ (KJS::fillStructuresUsingTimeArgs):
+ (KJS::fillStructuresUsingDateArgs):
+ (KJS::DateInstance::getTime):
+ (KJS::DateInstance::getUTCTime):
+ (KJS::DateProtoFunc::callAsFunction):
+ (KJS::DateObjectImp::construct):
+ (KJS::DateObjectImp::callAsFunction):
+ (KJS::DateObjectFuncImp::callAsFunction):
+ (KJS::parseDate):
+ * kjs/date_object.h:
+
+2006-10-13 Kevin McCullough <KMcCullough@apple.com>
+
+ Reviewed by Adam.
+
+ Gets JavaScripCore tests running on windows.
+
+ * Scripts/run-javascriptcore-tests:
+ * Scripts/webkitdirs.pm:
+
+2006-10-12 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej.
+
+ Removed JSObjectMakeWithPrototype, clarified some comments. We really
+ don't want people to manage their own prototypes, so we don't want an
+ extra function in the API devoted to just that. People can still manage
+ their own prototypes if they really want by using JSObjectSetPrototype.
+
+ * API/JSClassRef.cpp:
+ (OpaqueJSClass::createNoAutomaticPrototype):
+ (OpaqueJSClass::create):
+ * API/JSClassRef.h:
+ * API/JSObjectRef.cpp:
+ (JSClassCreate):
+ (JSObjectMake):
+ * API/JSObjectRef.h:
+ * API/testapi.c:
+ (main):
+ * JavaScriptCore.exp:
+
+2006-10-12 Kevin McCullough <KMcCullough@apple.com>
+
+ Reviewed by Adam.
+
+ Build breakage fix
+
+ * kjs/DateMath.cpp:
+ (KJS::msToTM):
+ * kjs/date_object.cpp:
+ (KJS::gmtoffset):
+
+2006-10-11 Kevin McCullough <KMcCullough@apple.com>
+
+ Reviewed by Geoff.
+
+ Added our own tm struct to have a consistent set of fields, which lets us display the DST offset and timezone strings correctly. Also there is some code cleanup.
+
+ * kjs/DateMath.cpp:
+ (KJS::timeToMS):
+ (KJS::getUTCOffset):
+ (KJS::getDSTOffsetSimple):
+ (KJS::dateToMS):
+ (KJS::msToTM):
+ (KJS::tmToKJStm):
+ (KJS::KJStmToTm):
+ * kjs/DateMath.h:
+ * kjs/date_object.cpp:
+ (KJS::gmtoffset):
+ (KJS::formatTime):
+ (KJS::DateProtoFunc::callAsFunction):
+ (KJS::DateObjectImp::construct):
+ (KJS::DateObjectImp::callAsFunction):
+ (KJS::DateObjectFuncImp::callAsFunction):
+ (KJS::parseDate):
+ * kjs/date_object.h:
+
+2006-10-09 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
+
+ Reviewed by Geoff.
+
+ Improve gdk build compiler flags (show warning, no rtti and exceptions).
+
+ * jscore.bkl:
+
+2006-10-06 Kevin McCullough <KMcCullough@apple.com>
+
+ Reviewed by Brady.
+
+ DST and TimeZones were wrong in some cases, specifically on some of the dates where DST changes.
+
+ * kjs/DateMath.cpp:
+ (KJS::equivalentYearForDST):
+ (KJS::getUTCOffset):
+ (KJS::getDSTOffsetSimple):
+ (KJS::getDSTOffset):
+ (KJS::dateToMseconds):
+ (KJS::msToTM):
+ * kjs/DateMath.h:
+ * kjs/date_object.cpp:
+ (KJS::gmtoffset):
+
+2006-10-05 Darin Adler <darin@apple.com>
+
+ Reviewed by Kevin McCullough.
+
+ * wtf/Assertions.cpp: Fix build when _DEBUG is not defined.
+
+2006-10-04 Kevin McCullough <KMcCullough@apple.com>
+
+ Reviewed by Adam.
+
+ - Removed an unnecessary assert that was stopping many pages. tm_gmtoff was not set for UTC time in mozilla but is always set for us.
+
+ * kjs/DateMath.cpp:
+ (KJS::getUTCOffset):
+ (KJS::msToTM):
+ * kjs/date_object.cpp:
+ (KJS::gmtoffset):
+ (KJS::formatTime):
+
+2006-10-04 Geoffrey Garen <ggaren@apple.com>
+
+ Patch by Darin and me, reviewed by Maciej.
+
+ Fixed <rdar://problem/4518397> REGRESSION(?): Oft-seen but unrepro crash
+ in JavaScript garbage collection (KJS::Collector::collect())
+ <rdar://problem/4752492> Crash in KJS::collect
+
+ The issue here was allocating one garbage-collected object in the midst
+ of allocating a second garbage-collected object. In such a case, the
+ zeroIfFree word lies.
+
+ * kjs/collector.cpp:
+ (KJS::Collector::allocate):
+ (KJS::Collector::collect):
+
+2006-10-04 Kevin McCullough <KMcCullough@apple.com>
+
+ Reviewed by Adam.
+
+ - Layout test fix
+
+ * kjs/DateMath.cpp:
+ (KJS::dateToDayInYear): accept and correctly handle negative months
+
+2006-10-05 Kevin McCullough <KMcCullough@apple.com>
+
+ build fix
+
+ * kjs/DateMath.cpp:
+ (KJS::dateToDayInYear):
+
+2006-10-05 Mark Rowe <bdash@webkit.org>
+
+ Reviewed by maculloch.
+
+ Gdk build fix.
+
+ * JavaScriptCoreSources.bkl: Add DateMath.cpp to file list.
+
+2006-10-05 Kevin McCullough <KMcCullough@apple.com>
+
+ Reviewed by aroben
+
+ - build fix
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2006-10-04 Nikolas Zimmermann <zimmermann@kde.org>
+
+ Reviewed by Mitz.
+
+ Fix Qt/Linux build by adding DateMath.cpp to compilation.
+
+ * CMakeLists.txt: Also replace tabs with spaces.
+
+2006-10-04 Kevin McCullough <KMcCullough@apple.com>
+
+ Reviewed by DethBakin.
+
+ - Apparently the build bot uses an older version of XCode which warns about conversions and the newest version does not. I hope this fixes the build but I cann't be sure on my system.
+
+ * kjs/DateMath.cpp:
+ (KJS::msToYear):
+ (KJS::dayInYear):
+ (KJS::dateToDayInYear):
+
+2006-10-05 Darin Adler <darin@apple.com>
+
+ Reviewed by Adam.
+
+ * wtf/Assertions.cpp: Changed assertion formatting to omit the "======"
+ lines so you can see more assertions in less space. Also improved format
+ of file/line information so it works with more development environments.
+
+2006-10-04 Kevin McCullough <KMcCullough@apple.com>
+
+ Reviewed by Tim H.
+
+ - The build machine is more sensitive about automatic conversions. These fixes exp
+licitly cast or change the input and return types of functions to avoid conversions.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * kjs/DateMath.cpp:
+ (KJS::):
+ (KJS::msToDays):
+ (KJS::msToYear):
+ (KJS::dayInYear):
+ (KJS::monthToDayInYear):
+ (KJS::dateToDayInYear):
+ (KJS::getDSTOffsetSimple):
+ (KJS::getDSTOffset):
+ (KJS::dateToMseconds):
+ (KJS::msToTM):
+
+2006-10-04 Kevin McCullough <KMcCullough@apple.com>
+
+ Reviewed by GGaren
+
+ - This is a big makeover for our Date implemenetation. This solves many platform specific issues, specifically dates before 1970, and simplifies some ugly code. The purpose of this was to get us to pass many of the JavaScriptCore tests on windows.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * kjs/DateMath.cpp: Added.
+ (KJS::):
+ (KJS::daysInYear):
+ (KJS::daysFrom1970ToYear):
+ (KJS::msFrom1970ToYear):
+ (KJS::msToDays):
+ (KJS::msToYear):
+ (KJS::isLeapYear):
+ (KJS::isInLeapYear):
+ (KJS::dayInYear):
+ (KJS::msToMilliseconds):
+ (KJS::msToWeekDay):
+ (KJS::msToSeconds):
+ (KJS::msToMinutes):
+ (KJS::msToHours):
+ (KJS::msToMonth):
+ (KJS::msToDayInMonth):
+ (KJS::monthToDayInYear):
+ (KJS::timeToMseconds):
+ (KJS::dateToDayInYear):
+ (KJS::equivalentYearForDST):
+ (KJS::getUTCOffset):
+ (KJS::getDSTOffsetSimple):
+ (KJS::getDSTOffset):
+ (KJS::localTimeToUTC):
+ (KJS::UTCToLocalTime):
+ (KJS::dateToMseconds):
+ (KJS::msToTM):
+ (KJS::isDST):
+ * kjs/DateMath.h: Added.
+ (KJS::):
+ * kjs/date_object.cpp:
+ (KJS::gmtoffset):
+ (KJS::formatTime):
+ (KJS::DateInstance::getTime):
+ (KJS::DateInstance::getUTCTime):
+ (KJS::DateProtoFunc::callAsFunction):
+ (KJS::DateObjectImp::construct):
+ (KJS::DateObjectFuncImp::callAsFunction):
+ (KJS::parseDate):
+ * kjs/testkjs.cpp:
+ * os-win32/stdint.h:
+
+2006-10-02 Nikolas Zimmermann <zimmermann@kde.org>
+
+ Reviewed/landed by Adam.
+
+ Build testkjs on Qt/Linux.
+
+ * CMakeLists.txt:
+
+2006-10-02 Nikolas Zimmermann <zimmermann@kde.org>
+
+ Reviewed by eseidel. Landed by eseidel.
+
+ Fix win32 build, which has no inttypes.h
+
+ * wtf/Assertions.h:
+
+2006-10-02 Nikolas Zimmermann <zimmermann@kde.org>
+
+ Reviewed by eseidel & mjs. Landed by eseidel.
+
+ Fix Qt/Linux build with older gcc 3.3.4.
+ http://bugs.webkit.org/show_bug.cgi?id=11116
+
+ * kjs/lookup.h: Move cacheGlobalObject into KJS namespace.
+ (KJS::cacheGlobalObject): Also remove GCC_ROOT_NS_HACK.
+ * wtf/Assertions.h: Include inttypes.h for uintptr_t.
+
+2006-09-28 Steve Falkenburg <sfalken@apple.com>
+
+ Reviewed by Maciej.
+
+ Use $(ConfigSuffix) set via vsprops files to add _debug
+ to end of debug filenames.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.vcproj/debug.vsprops: Added.
+ * JavaScriptCore.vcproj/dftables/dftables.vcproj:
+ * JavaScriptCore.vcproj/release.vsprops: Added.
+ * JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
+
+2006-09-28 Darin Adler <darin@apple.com>
+
+ Reviewed by Alice.
+
+ - support for change that should fix <rdar://problem/4733044>
+ REGRESSION: XML iBench shows 10% perf. regression (copying
+ strings while decoding)
+
+ * wtf/Vector.h: Changed VectorBuffer so that the general case
+ contains an instance of the 0 case, since deriving from it
+ was violating the Liskov Substitution Principle.
+ (WTF::VectorBuffer::releaseBuffer): Added. Releases the buffer so it can
+ be adopted by another data structure that uses the FastMalloc.h allocator.
+ Returns 0 if the internal buffer was being used.
+ (WTF::Vector::releaseBuffer): Added. Releases the buffer as above or creates
+ a new one in the case where the internal buffer was being used.
+
+2006-09-28 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Geoff.
+
+ - change garbage collection to happen at increments proportional to number of live objects, not always
+ every 1000 allocations
+
+ * kjs/collector.cpp:
+ (KJS::Collector::allocate):
+
+2006-09-28 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Mitz.
+
+ - fixed REGRESSION (r16606): javascriptCore Crash on website load
+
+ Plus style fixes.
+
+ - fixed some possible off-by-one bugs
+ - use indexing, not iterators, for Vectors
+ - store Vector by pointer instead of by value to avoid blowing out FunctionImp size
+
+ * kjs/function.cpp:
+ (KJS::FunctionImp::addParameter):
+ (KJS::FunctionImp::parameterString):
+ (KJS::FunctionImp::processParameters):
+ (KJS::FunctionImp::lengthGetter):
+ (KJS::FunctionImp::getParameterName):
+ * kjs/function.h:
+
+2006-09-27 Steve Falkenburg <sfalken@apple.com>
+
+ Reviewed by Maciej.
+
+ More build tweaks
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.vcproj/JavaScriptCore/dstroot-to-sdk.cmd: Removed.
+
+2006-09-27 John Sullivan <sullivan@apple.com>
+
+ * kjs/function.cpp:
+ (KJS::FunctionImp::getParameterName):
+ removed assertion that displeased gcc 4.0.1 (build 5420):
+ ASSERT(static_cast<size_t>(index) == index);
+
+2006-09-27 Kevin McCullough <KMcCullough@apple.com>
+
+ Reviewed by GGaren.
+
+ Cleanup of previous fix which was to address Radar: 4752492
+
+ * kjs/function.cpp:
+ (KJS::FunctionImp::addParameter):
+ (KJS::FunctionImp::parameterString):
+ (KJS::FunctionImp::processParameters):
+ (KJS::FunctionImp::lengthGetter):
+ (KJS::FunctionImp::getParameterName):
+ * kjs/function.h:
+
+2006-09-27 Kevin McCullough <KMcCullough@apple.com>
+
+ Reviewed by Adele.
+
+ Fixes a GC stack overflow crash.
+ The change is to move from a linked list implementation of Parameters to a Vector.
+ The problem with the linked list is that each one creates it's own stack frame when being destroyed and in extreme cases this caused the stack to overflow.
+
+ * kjs/function.cpp:
+ (KJS::Parameter::Parameter):
+ (KJS::FunctionImp::addParameter):
+ (KJS::FunctionImp::parameterString):
+ (KJS::FunctionImp::processParameters):
+ (KJS::FunctionImp::lengthGetter):
+ (KJS::FunctionImp::getParameterName):
+ * kjs/function.h:
+
+2006-09-27 Steve Falkenburg <sfalken@apple.com>
+
+ Fix last path fix.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+
+2006-09-27 Steve Falkenburg <sfalken@apple.com>
+
+ Set path before build.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+
+2006-09-27 Sean Gies <seangies@apple.com>
+
+ Reviewed by Adam Roben.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Debug config should link to debug runtime.
+ * JavaScriptCore.vcproj/dftables/dftables.vcproj: Debug config should link to debug runtime.
+
+2006-09-27 Don Melton <gramps@apple.com>
+
+ Reviewed by Adam Roben.
+
+ Changed line ending from DOS to UNIX format so it doesn't die running
+ on my machine. ;)
+
+ * JavaScriptCore.vcproj/JavaScriptCore/build-generated-files.sh:
+
+2006-09-23 Alexey Proskuryakov <ap@nypop.com>
+
+ Reviewed by Maciej.
+
+ http://bugs.webkit.org/show_bug.cgi?id=10183
+ REGRESSION: obfuscated JS decoding breaks because of soft hyphen removal
+ (Fanfiction.net author pages not listing stories)
+
+ Rolled out the fix for bug 4139.
+
+ * kjs/lexer.cpp:
+ (Lexer::setCode):
+ (Lexer::shift):
+ * tests/mozilla/ecma/Array/15.4.5.1-1.js:
+ * tests/mozilla/expected.html:
+
+2006-09-22 Steve Falkenburg <sfalken@apple.com>
+
+ Build fix.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+
+2006-09-22 Darin Adler <darin@apple.com>
+
+ Reviewed by Alice.
+
+ * wtf/Vector.h: Add an append that takes a pointer and length.
+ Generalize the existing Vector append to work on vectors with
+ any value for inlineCapacity. Change the append algorithm so
+ it doesn't check capacity each time through the loop.
+
+2006-09-22 Steve Falkenburg <sfalken@apple.com>
+
+ Fix release build.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+
+2006-09-21 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ Updated to include the right path.
+ * wtf/FastMalloc.h: #include Platform.h, since we use Platform macros.
+
+=== Safari-521.27 ===
+
+2006-09-20 Anders Carlsson <acarlsson@apple.com>
+
+ Reviewed by Dave Hyatt.
+
+ * wtf/MathExtras.h:
+ Get rid of lrint.
+
+2006-09-20 Sean Gies <seangies@apple.com>
+
+ Reviewed by Steve Falkenburg.
+
+ * wtf/Assertions.cpp: Debug messages should go into debugger console.
+
+2006-09-20 David Hyatt <hyatt@apple.com>
+
+ Add an implementation of lrint for Win32.
+
+ Reviewed by anders
+
+ * wtf/MathExtras.h:
+ (lrint):
+
+2006-09-15 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
+
+ Reviewed by Adam.
+
+ http://bugs.webkit.org/show_bug.cgi?id=10864
+ Bug 10864: Linux\GDK build fixes
+
+ * JavaScriptCoreSources.bkl:
+ * jscore.bkl:
+
+2006-09-15 Adam Roben <aroben@apple.com>
+
+ Windows build fix.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/build-generated-files.sh:
+
+2006-09-15 Anders Carlsson <acarlsson@apple.com>
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ Fix the release build.
+
+2006-09-15 Anders Carlsson <acarlsson@apple.com>
+
+ Reviewed by Steve.
+
+ Add JavaScriptCore API to the build.
+ * API/JSBase.cpp:
+ * API/JSCallbackConstructor.cpp:
+ * API/JSCallbackFunction.cpp:
+ * API/JSCallbackObject.cpp:
+ * API/JSClassRef.cpp:
+ * API/JSContextRef.cpp:
+ * API/JSObjectRef.cpp:
+ * API/JSStringRef.cpp:
+ * API/JSValueRef.cpp:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * os-win32/stdbool.h: Added.
+
+2006-09-12 Steve Falkenburg <sfalken@apple.com>
+
+ Reviewed by Ada.
+
+ Build tweaks (doing JavaScriptCore now since it doesn't have
+ dependencies).
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.vcproj/JavaScriptCore/build-generated-files.sh:
+ * JavaScriptCore.vcproj/JavaScriptCore/dstroot-to-sdk.cmd: Added.
+ * JavaScriptCore.vcproj/dftables/dftables.vcproj:
+ * JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
+
+2006-09-11 Brady Eidson <beidson@apple.com>
+
+ Build fix - I think Tim's last checkin wasn't tested on Tiger, possibly. I simply
+ commented out the undefined constants until he can have a chance to make the right call
+
+ * bindings/objc/objc_utility.mm:
+ (KJS::Bindings::objcValueTypeForType): Commented out undefined symbols
+
+2006-09-11 Timothy Hatcher <timothy@apple.com>
+
+ Reviewed by Tim O. and Darin.
+
+ Add support for more method signatures affecting ObjC methods called from JavaScript:
+ - Added unsigned types and long long.
+ - Allow methods that use const, oneway, bycopy and byref type modifiers.
+
+ * bindings/objc/objc_instance.mm:
+ (ObjcInstance::invokeMethod):
+ * bindings/objc/objc_utility.h:
+ (KJS::Bindings::):
+ * bindings/objc/objc_utility.mm:
+ (KJS::Bindings::convertValueToObjcValue):
+ (KJS::Bindings::convertObjcValueToValue):
+ (KJS::Bindings::objcValueTypeForType):
+
+2006-09-05 Timothy Hatcher <timothy@apple.com>
+
+ Reviewed by Tim O.
+
+ <rdar://problem/4715840> SEL is not char*
+
+ * bindings/objc/objc_class.mm:
+ (KJS::Bindings::ObjcClass::methodsNamed): use sel_getName instead of a char* cast.
+ * bindings/objc/objc_runtime.mm:
+ (ObjcFallbackObjectImp::callAsFunction): ditto
+
+2006-09-03 Alexey Proskuryakov <ap@nypop.com>
+
+ Reviewed by Tim H.
+
+ http://bugs.webkit.org/show_bug.cgi?id=10693
+ Convert JavaScript arrays to AppleScript lists
+
+ * JavaScriptCore.exp: Export ArrayInstance::info and ArrayInstance::getItem().
+ * kjs/array_instance.h:
+ * kjs/array_object.cpp:
+ (ArrayInstance::getItem): Added a method to access array items from C++.
+
+2006-09-02 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
+
+ Reviewed by Tim H.
+
+ Bug 10454: Unix bakefile fixes
+ http://bugs.webkit.org/show_bug.cgi?id=10454
+
+ * JavaScriptCoreSources.bkl:
+
+2006-09-01 Nikolas Zimmermann <zimmermann@kde.org>
+
+ Reviewed by hyatt. Landed by eseidel.
+
+ Fix build on Linux.
+
+ * pcre/CMakeLists.txt: Add wtf/ include.
+
+2006-09-01 Nikolas Zimmermann <zimmermann@kde.org>
+
+ Reviewed and landed by ap.
+
+ Fix build on Linux (C89 without gcc extensions enabled).
+
+ * pcre/pcre_internal.h: Use C style comments.
+ * wtf/Assertions.h: Use C style comments.
+ * wtf/Platform.h: Use C style comments.
+
+2006-09-01 Steve Falkenburg <sfalken@apple.com>
+
+ Fix build.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.vcproj/dftables/dftables.vcproj:
+
+2006-08-31 Anders Carlsson <acarlsson@apple.com>
+
+ Reviewed by Darin.
+
+ Add new portability functions to MathExtras.h and add StringExtras.h which is for
+ string portability functions.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * bindings/c/c_instance.cpp:
+ * kjs/date_object.cpp:
+ * wtf/MathExtras.h:
+ (copysign):
+ (isfinite):
+ * wtf/StringExtras.h: Added.
+ (snprintf):
+ (strncasecmp):
+
+2006-08-31 Anders Carlsson <acarlsson@apple.com>
+
+ Reviewed by Tim H.
+
+ Fix Windows build.
+
+ * JavaScriptCore.vcproj/dftables/dftables.vcproj:
+ * pcre/pcre_internal.h:
+
+2006-08-31 Timothy Hatcher <timothy@apple.com>
+
+ Reviewed by Geoff.
+
+ Band-aid fix for PCRE to compile for ppc64 and x86_64 now that
+ we use -Wshorten-64-to-32. Adds an INT_CAST macro that ASSERTs
+ the value <= INT_MAX.
+
+ I filed <rdar://problem/4712064> to track the need to verify
+ PCRE's 64-bit compliance.
+
+ * pcre/pcre_compile.c:
+ (complete_callout):
+ (compile_branch):
+ (compile_regex):
+ (pcre_compile2):
+ * pcre/pcre_exec.c:
+ (match):
+ (pcre_exec):
+ * pcre/pcre_get.c:
+ (pcre_get_substring_list):
+ * pcre/pcre_internal.h:
+ * pcre/pcre_tables.c:
+ * pcre/pcre_try_flipped.c:
+ (_pcre_try_flipped):
+
+2006-08-30 Darin Adler <darin@apple.com>
+
+ Reviewed by Tim Hatcher.
+
+ - add WTF::getPtr, a function template that makes it possible to write
+ generic code that gets a raw pointer out of any of our pointer types
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * wtf/GetPtr.h: Added.
+ * wtf/ListRefPtr.h: (WTF::getPtr): Added.
+ * wtf/OwnArrayPtr.h: (WTF::getPtr): Added.
+ * wtf/OwnPtr.h: (WTF::getPtr): Added.
+ * wtf/PassRefPtr.h: (WTF::getPtr): Added.
+ * wtf/RefPtr.h: (WTF::getPtr): Added.
+
+2006-08-29 waylonis <waylonis@google.com>
+
+ Reviewed, tweaked by ggaren.
+
+ - Added storage and accessor functions for ExecState as a fix for
+ http://bugs.webkit.org/show_bug.cgi?id=10114
+
+ * kjs/ExecState.cpp:
+ (KJS::ExecState::ExecState):
+ * kjs/ExecState.h:
+ * kjs/context.h:
+ (KJS::Context::setExecState):
+ (KJS::Context::execState):
+
+2006-08-30 Nikolas Zimmermann <zimmermann@kde.org>
+
+ Reviewed by Tim H.
+
+ Commit KDE related tweaks, to be able to
+ differentiate between a Qt-only or a KDE build.
+
+ * CMakeLists.txt: Install wtf-unity library.
+ * wtf/Platform.h: Add define for the KDE platform.
+
+2006-08-28 Darin Adler <darin@apple.com>
+
+ Reviewed by Geoff.
+
+ * kjs/list.h: Use explicit in constructor (as appropriate).
+
+2006-08-24 Nikolas Zimmermann <zimmermann@kde.org>
+
+ Reviewed, tweaked and landed by ap
+
+ http://bugs.webkit.org/show_bug.cgi?id=10467
+ WebKit should have Qt platform support (Part II)
+
+ * CMakeLists.txt: Adjust to Anders' build fixes.
+ * wtf/Platform.h: Fix define for the Qt platform (we don't use/need Cairo.)
+
+2006-08-23 David Hyatt <hyatt@apple.com>
+
+ Fix Platform.h to include #defines for graphics features.
+
+ Reviewed by darin
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * wtf/Platform.h:
+
+2006-08-23 Anders Carlsson <acarlsson@apple.com>
+
+ Reviewed by Darin.
+
+ Make the bindings compile without CoreFoundation.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * bindings/c/c_instance.cpp:
+ * bindings/c/c_utility.cpp:
+ (KJS::Bindings::convertUTF8ToUTF16):
+ * bindings/npapi.h:
+ * bindings/runtime.cpp:
+ (KJS::Bindings::Instance::createBindingForLanguageInstance):
+ (KJS::Bindings::Instance::createLanguageInstanceForValue):
+ * bindings/runtime_root.cpp:
+ * bindings/runtime_root.h:
+ * kjs/interpreter.cpp:
+ (KJS::Interpreter::createLanguageInstanceForValue):
+ * kjs/interpreter.h:
+
+2006-08-22 Anders Carlsson <acarlsson@apple.com>
+
+ Reviewed by Darin.
+
+ Move the npruntime code over to using HashMap and the runtime_root code over to using
+ HashMap and HashCountedSet.
+
+ * bindings/NP_jsobject.cpp:
+ * bindings/c/c_utility.cpp:
+ (KJS::Bindings::identifierFromNPIdentifier):
+ * bindings/c/c_utility.h:
+ * bindings/jni/jni_jsobject.cpp:
+ (JavaJSObject::invoke):
+ * bindings/npruntime.cpp:
+ (getStringIdentifierMap):
+ (getIntIdentifierMap):
+ (_NPN_GetStringIdentifier):
+ (_NPN_GetIntIdentifier):
+ * bindings/runtime_root.cpp:
+ (getReferencesByRootMap):
+ (getReferencesSet):
+ (KJS::Bindings::findReferenceSet):
+ (KJS::Bindings::rootForImp):
+ (KJS::Bindings::rootForInterpreter):
+ (KJS::Bindings::addNativeReference):
+ (KJS::Bindings::removeNativeReference):
+ (RootObject::removeAllNativeReferences):
+ * bindings/runtime_root.h:
+
+2006-08-22 Anders Carlsson <acarlsson@apple.com>
+
+ Reviewed by Geoff.
+
+ Switch over the NPAPI and Java bindings to using HashMaps instead of dictionaries.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * bindings/c/c_class.cpp:
+ (KJS::Bindings::CClass::CClass):
+ (KJS::Bindings::CClass::~CClass):
+ (KJS::Bindings::CClass::classForIsA):
+ (KJS::Bindings::CClass::methodsNamed):
+ (KJS::Bindings::CClass::fieldNamed):
+ * bindings/c/c_class.h:
+ * bindings/jni/jni_class.cpp:
+ (JavaClass::JavaClass):
+ (JavaClass::~JavaClass):
+ (JavaClass::methodsNamed):
+ (JavaClass::fieldNamed):
+ * bindings/jni/jni_class.h:
+ * bindings/objc/objc_class.h:
+ * bindings/objc/objc_class.mm:
+ (KJS::Bindings::deleteMethod):
+ (KJS::Bindings::deleteField):
+ (KJS::Bindings::):
+ (KJS::Bindings::ObjcClass::methodsNamed):
+ (KJS::Bindings::ObjcClass::fieldNamed):
+ * bindings/runtime.cpp:
+ * bindings/runtime.h:
+ * bindings/runtime_object.cpp:
+ (RuntimeObjectImp::fieldGetter):
+ (RuntimeObjectImp::getOwnPropertySlot):
+ (RuntimeObjectImp::put):
+ (RuntimeObjectImp::canPut):
+
+2006-08-21 Vladimir Olexa <vladimir.olexa@gmail.com>
+
+ Reviewed by Darin.
+
+ http://bugs.webkit.org/show_bug.cgi?id=6252
+ JavaScript 1.6 Array.lastIndexOf
+
+ Test: fast/js/array-lastIndexOf.html
+
+ * kjs/array_object.cpp:
+ (ArrayProtoFunc::callAsFunction): Added a LastIndexOf case.
+ * kjs/array_object.h:
+ (KJS::ArrayProtoFunc::): Added LastIndexOf to enum.
+ * tests/mozilla/expected.html: Two more tests now pass.
+
+2006-08-20 Nikolas Zimmermann <zimmermann@kde.org>
+
+ Reviewed by Maciej. Landed by rwlbuis.
+
+ Fixes parts of: http://bugs.webkit.org/show_bug.cgi?id=10463
+ WebKit should have Qt platform support
+
+ Removing obsolete QConstString/QString constructors in kjs code.
+
+ * kjs/identifier.h:
+ * kjs/ustring.h:
+
+2006-08-17 Nikolas Zimmermann <zimmermann@kde.org>
+
+ Reviewed by Maciej. Landed by rwlbuis.
+
+ Fixes: http://bugs.webkit.org/show_bug.cgi?id=10463
+ WTF Changes needed for Qt platform code.
+
+ * wtf/Platform.h:
+ * wtf/unicode/UnicodeDecomposition.h: Added.
+ (WTF::Unicode::):
+ * wtf/unicode/UnicodeDirection.h: Added.
+ (WTF::Unicode::):
+ * wtf/unicode/qt4/UnicodeQt4.cpp: Added.
+ (WTF::Unicode::direction):
+ (WTF::Unicode::category):
+ (WTF::Unicode::decomposition):
+ * wtf/unicode/qt4/UnicodeQt4.h:
+ (WTF::Unicode::toLower):
+ (WTF::Unicode::toUpper):
+ (WTF::Unicode::isPrintableChar):
+ (WTF::Unicode::isSpace):
+ (WTF::Unicode::isPunct):
+ (WTF::Unicode::isDigit):
+ (WTF::Unicode::mirroredChar):
+ (WTF::Unicode::compare):
+
+2006-08-17 Nikolas Zimmermann <zimmermann@kde.org>
+
+ Reviewed by Eric. Landed by rwlbuis.
+
+ Fixes: http://bugs.webkit.org/show_bug.cgi?id=10464
+ Offer a cmake build system for Qt platform.
+
+ * CMakeLists.txt: Added.
+ * pcre/CMakeLists.txt: Added.
+
+2006-08-17 Anders Carlsson <acarlsson@apple.com>
+
+ Reviewed by Maciej.
+
+ * bindings/npapi.h:
+ Fix ifdef.
+
+2006-08-15 Steve Falkenburg <sfalken@apple.com>
+
+ Reviewed by mjs.
+
+ Build fix.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * wtf/Assertions.h:
+
+2006-08-15 Mark Rowe <opendarwin.org@bdash.net.nz>
+
+ Reviewed by Tim H.
+
+ Build fix: DWARF and -gfull are incompatible with symbol separation.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2006-08-15 Mark Rowe <opendarwin.org@bdash.net.nz>
+
+ Reviewed by Tim H.
+
+ http://bugs.webkit.org/show_bug.cgi?id=10394
+ Bug 10394: WebKit Release and Production configurations should enable dead code stripping
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2006-08-15 Mark Rowe <opendarwin.org@bdash.net.nz>
+
+ Reviewed by Tim H.
+
+ http://bugs.webkit.org/show_bug.cgi?id=10384
+ Bug 10384: Switch to DWARF for Release configuration
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2006-08-13 Maks Orlovich <maksim@kde.org>
+
+ Reviewed (and tweaked a little) by Maciej.
+
+ - shrank the size of JSObject by 8 bytes and made the corresponding reduction to the cell size, resulting
+ in a 1.2% speed improvement on JS iBench (and probably overall memory savings).
+
+ This was done by removing _scope and _internalValue data members
+ from JSObject and moving them only to the subclasses that actually
+ make use of them.
+
+ * kjs/object.cpp:
+ (KJS::JSObject::mark): No need to mark scope or internal value here.
+ * kjs/object.h:
+ (KJS::JSObject::JSObject): Don't initialize them.
+ * kjs/JSWrapperObject.cpp: Added. New base class for object types that
+ wrap primitive values (Number, String, Boolean, Date).
+ (KJS::JSWrapperObject::mark):
+ * kjs/JSWrapperObject.h: Added.
+ (KJS::JSWrapperObject::JSWrapperObject):
+ (KJS::JSWrapperObject::internalValue):
+ (KJS::JSWrapperObject::setInternalValue):
+ * kjs/array_object.cpp:
+ (ArrayPrototype::ArrayPrototype): Don't set useless internal value.
+ * kjs/bool_object.cpp:
+ (BooleanInstance::BooleanInstance): Inherit from JSWrapperObject.
+ (BooleanProtoFunc::callAsFunction): Fixed to account for fact that not all
+ JSObjects have an internal value.
+ (BooleanObjectImp::construct): ditto.
+ * kjs/bool_object.h:
+ * kjs/collector.cpp: Lowered cell size to 48.
+ (KJS::Collector::allocate): meaningless whitespace change
+ * kjs/date_object.cpp:
+ (KJS::DateInstance::DateInstance): Inherit from JSWrapperObject.
+ (KJS::DateProtoFunc::callAsFunction): adjusted for move of internalValue
+ (KJS::DateObjectImp::construct): ditto
+ * kjs/date_object.h:
+ * kjs/error_object.cpp:
+ (ErrorPrototype::ErrorPrototype): don't set internal value
+ * kjs/function.cpp: move _scope and related handling here
+ (KJS::FunctionImp::mark): mark scope
+ * kjs/function.h:
+ (KJS::FunctionImp::scope): moved here from JSObject
+ (KJS::FunctionImp::setScope): ditto
+ * kjs/number_object.cpp:
+ (NumberInstance::NumberInstance): inherit from JSWrapperObject
+ (NumberProtoFunc::callAsFunction): adjusted
+ (NumberObjectImp::construct): adjusted
+ * kjs/number_object.h: shring RegExp-related objects a little
+ * kjs/regexp_object.cpp:
+ (RegExpPrototype::RegExpPrototype): Adjust for size tweaks
+ (RegExpObjectImp::RegExpObjectImp): ditto
+ * kjs/regexp_object.h:
+ * kjs/string_object.cpp:
+ (StringInstance::StringInstance): inherit from JSWrapperObject
+ (StringProtoFunc::callAsFunction): adjusted
+ * kjs/string_object.h:
+ * JavaScriptCore.exp: Exported new methods as needed.
+ * JavaScriptCore.xcodeproj/project.pbxproj: Added new files to build.
+
+2006-08-04 Brady Eidson <beidson@apple.com>
+
+ Reviewed by Geoff's rubber stamp
+
+ Fix a build break on Intel hardware causes by adapting stricter
+ compiler warnings (-Wshorten-64-to-32)
+
+ * API/testapi.c:
+ (assertEqualsAsNumber): manually cast some doubles to floats
+ (main): ditto
+
+2006-08-04 Sam Weinig <sam.weinig@gmail.com>
+
+ Reviewed by Darin.
+
+ - patch for http://bugs.webkit.org/show_bug.cgi?id=10192
+ Make WebCore (and friends) compile with -Wshorten-64-to-32
+
+ * Adds -Wshorten-64-to-32 flag to Xcode project.
+ * Adds explicit casts where OK.
+
+ * API/JSNodeList.c:
+ (JSNodeList_item):
+ (JSNodeList_getProperty):
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2006-08-04 Adam Roben <aroben@apple.com>
+
+ Reviewed by Anders.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Convert
+ spaces to tabs
+
+2006-08-03 Sam Weinig <sam.weinig@gmail.com>
+
+ Reviewed by Darin.
+
+ - patch for http://bugs.webkit.org/show_bug.cgi?id=10176
+ Make WebCore compile with -Wundef
+
+ * Adds -Wundef flag to Xcode project
+ * Converts #ifs to #ifdef and #ifndefs where needed.
+ * Added #define YYMAXDEPTH 10000 in kjs/grammar.y
+ to fix a warning from within Bison.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * bindings/jni/jni_jsobject.cpp:
+ (JavaJSObject::getSlot):
+ (JavaJSObject::setSlot):
+ * bindings/npapi.h:
+ * bindings/objc/objc_class.mm:
+ (KJS::Bindings::ObjcClass::methodsNamed):
+ (KJS::Bindings::ObjcClass::fieldNamed):
+ * bindings/objc/objc_instance.mm:
+ (ObjcInstance::invokeMethod):
+ * bindings/objc/objc_runtime.mm:
+ (ObjcMethod::getMethodSignature):
+ (ObjcField::name):
+ (ObjcField::type):
+ * kjs/grammar.y:
+ * kjs/identifier.h:
+
+2006-08-03 Anders Carlsson <acarlsson@apple.com>
+
+ Reviewed by John Sullivan.
+
+ * wtf/HashSet.h:
+ (WTF::::operator):
+ Return *this in operator=
+
+2006-08-03 Adam Roben <aroben@apple.com>
+
+ Reviewed by Anders.
+
+ - Fixed Windows build
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * wtf/MathExtras.h: Implement inline versions of these functions
+ (nextafter):
+ (nextafterf):
+
+2006-08-02 Adam Roben <aroben@apple.com>
+
+ Reviewed by Darin.
+
+ - Fixed build
+
+ * kjs/date_object.cpp:
+ (KJS::formatTime):
+
+2006-07-29 Darin Adler <darin@apple.com>
+
+ - Removed tabs from these source files that still had them.
+ We don't use them; that way source files look fine in editors
+ that have tabs set to 8 spaces or to 4 spaces.
+ - Removed allow-tabs Subversion property from the files too.
+
+ * bindings/NP_jsobject.cpp:
+ * bindings/c/c_utility.cpp:
+ * bindings/jni/jni_runtime.cpp:
+ * bindings/jni/jni_utility.cpp:
+ * bindings/objc/objc_utility.mm:
+ * bindings/runtime.cpp:
+ * bindings/runtime_method.cpp:
+ * bindings/testbindings.cpp:
+ * bindings/testbindings.mm:
+ * kjs/date_object.cpp:
+ * kjs/function.cpp:
+ * kjs/list.cpp:
+ * kjs/nodes.cpp:
+ * kjs/nodes.h:
+ * kjs/string_object.cpp:
+ * kjs/ustring.cpp:
+
+2006-07-29 Darin Adler <darin@apple.com>
+
+ * tests/mozilla/expected.html: Update test results now that regress-185165.js
+ is succeeding. I suspect Anders fix for bug 4620655 is the reason.
+
+2006-07-29 Sam Weinig <sam.weinig@gmail.com>
+
+ Reviewed by Darin.
+
+ - patch for http://bugs.webkit.org/show_bug.cgi?id=10080
+ Adopt pedantic changes from the Unity project to improve
+ cross-compiler compatibility
+
+ Changes include:
+ * Removing trailing semicolon from namespace braces.
+ * Removing trailing comma from last enum declaration.
+ * Updating to match style guidelines.
+ * Adding missing newline to the end of the file.
+ * Turning on gcc warning for missing newline at the end of a source file
+ (GCC_WARN_ABOUT_MISSING_NEWLINE in Xcode, -Wnewline in gcc).
+ * Alphabetical sorting of Xcode source list files.
+ * Replace use of non-portable variable-size array with Vector.
+ * Use C-style comments instead of C++ comments in files that might
+ be included by either C or C++ files.
+
+ * API/JSCallbackConstructor.cpp:
+ (KJS::JSCallbackConstructor::construct):
+ * API/JSCallbackFunction.cpp:
+ (KJS::JSCallbackFunction::callAsFunction):
+ * API/JSCallbackObject.cpp:
+ (KJS::JSCallbackObject::construct):
+ (KJS::JSCallbackObject::callAsFunction):
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * JavaScriptCorePrefix.h:
+ * bindings/jni/jni_class.cpp:
+ (JavaClass::fieldNamed):
+ * bindings/jni/jni_class.h:
+ * bindings/jni/jni_instance.cpp:
+ (JavaInstance::JavaInstance):
+ (JavaInstance::valueOf):
+ * bindings/jni/jni_objc.mm:
+ (KJS::Bindings::dispatchJNICall):
+ * bindings/jni/jni_runtime.cpp:
+ (JavaParameter::JavaParameter):
+ (JavaArray::JavaArray):
+ * bindings/jni/jni_runtime.h:
+ * bindings/jni/jni_utility.h:
+ * bindings/objc/objc_instance.h:
+ * bindings/runtime_array.h:
+ * kjs/collector.h:
+ * kjs/config.h:
+ * kjs/ustring.cpp:
+ * wtf/Platform.h:
+
+2006-07-29 Mike Emmel <mike.emmel@gmail.com>
+
+ Reviewed by Darin.
+
+ - fixes for Linux build
+
+ * JavaScriptCoreSources.bkl: Added new files to build, kjs/PropertyNameArray.cpp
+ and kjs/testkjs.cpp, and removed old files.
+
+2006-07-24 Dan Waylonis <waylonis@google.com>
+
+ Reviewed and tweaked a bit by Darin.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=9902
+ jsNull and NSNull not properly converted between JS and ObjC
+
+ * bindings/objc/objc_utility.mm: (KJS::Bindings::convertObjcValueToValue):
+ Added case for converting NSNull to jsNull.
+
+2006-07-24 Rob Buis <buis@kde.org>
+
+ Reviewed by Darin.
+
+ http://bugs.webkit.org/show_bug.cgi?id=4258
+ Date().toString() only includes GMT offset, not timezone string
+
+ Use the info in tm_zone to append timezone abbreviation
+ to Date().toString().
+
+ * kjs/date_object.cpp:
+ (KJS::formatTime):
+
+2006-07-24 Rob Buis <buis@kde.org>
+
+ Reviewed by Darin.
+
+ http://bugs.webkit.org/show_bug.cgi?id=5257
+ setYear() does not match FireFox/IE behavior
+
+ Make sure the right values end up in tm_year.
+
+ * kjs/date_object.cpp:
+ (KJS::formatTime):
+
+2006-07-23 Mark Rowe <opendarwin.org@bdash.net.nz>
+
+ Reviewed by Maciej.
+
+ Bug 9686: [Drosera] Need the ability to break into Drosera on Javascript exceptions
+ http://bugs.webkit.org/show_bug.cgi?id=9686
+
+ JavaScriptCore portion of the fix.
+
+ * JavaScriptCore.exp: Update symbol for change in argument type.
+ * kjs/debugger.cpp:
+ (Debugger::detach): Clear map of recent exceptions.
+ (Debugger::hasHandledException): Track the most recent exception
+ thrown by an interpreter.
+ (Debugger::exception): Change exception argument to a JSValue.
+ * kjs/debugger.h:
+ * kjs/nodes.cpp:
+ (Node::debugExceptionIfNeeded): Notify the debugger of an exception
+ if it hasn't seen it before.
+ (ThrowNode::execute): Notify the debugger that an exception is being thrown.
+ * kjs/nodes.h:
+
+ 2006-07-23 Geoffrey Garen <ggaren@apple.com>
+
+ Patch by Eric Albert, reviewed by Darin and me.
+
+ - Fixed <rdar://problem/4645931> JavaScriptCore stack-scanning code
+ crashes (Collector::markStackObjectsConservatively)
+
+ * bindings/jni/jni_jsobject.cpp: On 64bit systems, jint is a long, not an
+ int.
+ (JavaJSObject::getSlot):
+ (JavaJSObject::setSlot):
+ * kjs/collector.cpp:
+ (KJS::Collector::markCurrentThreadConservatively): Use a pointer instead of
+ an int as 'dummy,' because on LP64 systems, an int is not pointer-aligned,
+ and we want to scan the stack for pointers.
+ * JavaScriptCore.xcodeproj/project.pbxproj: After a tense cease-fire, the
+ XCode war has started up again!
+
+=== Safari-521.20 ===
+
+2006-07-21 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin.
+
+ <rdar://problem/4507265> REGRESSION: overlays don't work on HousingMaps.com (Google Maps-based site)
+
+ - Added support for strings that masquerade as undefined. Currently used
+ by WebCore to implement undetectable style.filter.
+
+ The name is a little long, but it's only used in one line of code, so I
+ thought clarity should win over brevity.
+
+ * JavaScriptCore.exp:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * kjs/object.h:
+ * kjs/string_object.h:
+ (KJS::StringInstanceThatMasqueradesAsUndefined::StringInstanceThatMasqueradesAsUndefined):
+ (KJS::StringInstanceThatMasqueradesAsUndefined::masqueradeAsUndefined):
+ (KJS::StringInstanceThatMasqueradesAsUndefined::toBoolean):
+
+=== Safari-521.19 ===
+
+2006-07-20 Steve Falkenburg <sfalken@apple.com>
+
+ Fix the build
+
+ * kjs/function.cpp:
+ (KJS::escapeStringForPrettyPrinting):
+
+2006-07-19 Anders Carlsson <acarlsson@apple.com>
+
+ Reviewed by Darin.
+
+ <rdar://problem/4620655> REGRESSION(10.4.7-10.5): preview button for a blogger.com post doesn't work
+
+ * kjs/nodes2string.cpp:
+ (StringNode::streamTo):
+ Return the escaped string.
+
+ (RegExpNode::streamTo):
+ Use the correct syntax.
+
+ * kjs/function.cpp:
+ (KJS::escapeStringForPrettyPrinting):
+ * kjs/function.h:
+ Add escape function which escapes a string for pretty-printing so it can be parsed again.
+
+ * wtf/unicode/icu/UnicodeIcu.h:
+ (WTF::Unicode::isPrintableChar):
+ New function.
+
+2006-07-18 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Adele Peterson.
+
+ <rdar://problem/4589530> REGRESSION: null character in JS string causes parse error (works in Tiger and in other browsers)
+
+ * kjs/lexer.cpp:
+ (Lexer::shift):
+ (Lexer::lex):
+ (Lexer::record16):
+ (Lexer::scanRegExp):
+ * kjs/lexer.h:
+
+2006-07-18 Tim Omernick <timo@apple.com>
+
+ Reviewed by Tim Hatcher.
+
+ Removed a misleading comment; we recently added support for the NPNVPluginElementNPObject
+ variable.
+
+ * bindings/npapi.h:
+
+=== Safari-521.18 ===
+
+2006-07-18 Timothy Hatcher <timothy@apple.com>
+
+ Made the following headers public:
+
+ * JavaScriptCore.h
+ * JSBase.h
+ * JSContextRef.h
+ * JSObjectRef.h
+ * JSStringRef.h
+ * JSValueRef.h
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2006-07-17 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej.
+
+ - Added automatic prototype creation for classes.
+
+ A class stores a weak reference to a prototype, which is cleared when
+ the prototype is garbage collected, to avoid a reference cycle.
+
+ We now have an attributes field in JSClassDefinition, that currently is
+ used only to override automatic prototype creation when you want to manage your
+ own prototypes, but can be extended in the future for other nefarious purposes.
+
+ Similarly, we have JSObjectMake and JSObjectMakeWithPrototype, the latter
+ allowing you to manage your own prototypes.
+
+ JSObjectMakeConstructor is more interesting now, able to make a constructor
+ on your behalf if you just give it a class.
+
+ - Removed bogus old code from minidom.js.
+
+ - Tweaked the headerdocs.
+
+ - Added more GC testing, which caught some leaks, and tested more funny
+ edge cases in lookup, which caught a lookup bug. Removed some testing
+ we used to do with MyObject because it was redundant with the new, cool
+ stuff.
+
+ While fixing the lookup bug I retracted this change:
+
+ "If a static setProperty callback returns 'false', to indicate that the
+ property was not set, we no longer forward the set request up the class
+ chain, because that's almost certainly not what the programmer expected."
+
+ Returning false when setting a static property is a little silly, but you can see
+ it being useful when shadowing a base class's static properties, and, regardless
+ of usefullness, this is the defined behavior of the setProperty callback.
+
+ - Plus a little ASCII art, for the kids.
+
+2006-07-17 Timothy Hatcher <timothy@apple.com>
+
+ Reviewed by Maciej.
+
+ <rdar://problem/4634874> WebScriptObject and WebUndefined are no longer defined by WebKit
+
+ Moves WebScriptObject and WebUndefined up to WebCore.
+ This change does create an upwards-dependancy on WebScriptObject existing
+ in the loaded process, but this code path in JavaScriptCore does not get used
+ unless it is through WebKit/WebCore. Moving all of the binding code out of
+ JavaScriptCore might make sense in the future.
+
+ * JavaScriptCore.exp:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * bindings/objc/WebScriptObject.h: Replaced.
+ * bindings/objc/WebScriptObject.mm: Removed.
+ * bindings/objc/WebScriptObjectPrivate.h: Removed.
+ * bindings/objc/objc_class.h:
+ * bindings/objc/objc_instance.h:
+ * bindings/objc/objc_instance.mm:
+ (ObjcInstance::~ObjcInstance):
+ * bindings/objc/objc_runtime.h:
+ * bindings/objc/objc_runtime.mm:
+ (convertValueToObjcObject):
+ * bindings/objc/objc_utility.mm:
+ (KJS::Bindings::convertValueToObjcValue):
+ (KJS::Bindings::convertObjcValueToValue):
+ (KJS::Bindings::createObjcInstanceForValue):
+
+2006-07-17 Darin Adler <darin@apple.com>
+
+ * API/JSBase.h: Fix comment formatting where things used to be lined up but
+ are now ragged. Got rid of spaces that attempted to line things up.
+ * API/JSObjectRef.h: Ditto. Also add missing periods for a couple of comments.
+
+2006-07-17 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej.
+
+ - Removed the exception parameter from the initialize callback and, by extension,
+ JSObjectMake. We have never had a need for exceptions when iniitializing,
+ so the parameter seemed likely to "get in the way."
+
+ Also, an exception in JavaScript is thrown in response to input --
+ "invalid URL", "index not a number", etc., so it's the job of the
+ constructor function, not the initialize method, to throw.
+
+ If initialize *really* wants to throw, it can communicate the throw to
+ the constructor through the constructed object's private data (e.g., set
+ it to NULL, signaling to the consntructor that initialization failed.)
+
+ - Added JSObjectMakeWithData, which enables a constructor to set private
+ data on an object *before* it has been initialized. That way, the initialize
+ methods can properly operate on the data.
+
+ * API/JSNode.c: Moved ref into the initialize method, for better encapsulation,
+ now that it's possible.
+ * API/JSNodeList.c: ditto
+ * API/minidom.c:
+ (main): Do more aggressive garbage collection to test ref/deref and
+ initialize/finalize.
+ * API/minidom.js: store childNodes in a temporary so it doesn't get re-created
+ like a thousand times. This makes debugging ref/deref easier
+
+2006-07-17 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej.
+
+ - Changed the initialize callback to run from least derived class (parent
+ class) to most derived class. This enables C++ style initialization,
+ and derived class overriding of member data.
+
+ - Added excpetion propopgation to JSObjectMake, to support initialize
+ exceptions, and generally round out our policy of making function
+ signatures as long as possible.
+
+ * API/JSCallbackObject.h: Use ExecState instead of ContextRef, cuz we're
+ in C++ land now.
+
+2006-07-17 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej.
+
+ - Changed JSObjectMakeConstructor to JSObjectMakeConstructorWithCallback,
+ to match JSObjectMakeFunctionWithCallback.
+
+ - Added prototype parameter, so the generated constructor
+ automatically works with hasInstance / instanceof
+
+ - Moved hasInstance implementation from InternalFunctionImp to JSObject
+ so that subclasses can inherit it without inheriting function-related baggage.
+ More refactoring here would be good, but this seems like a good short-term
+ solution.
+
+ (KJS::JSCallbackFunction::implementsHasInstance): override and return false,
+ because callback functions aren't constructors.
+
+2006-07-17 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Geoff.
+
+ - add a JSContextRef parameter to all JSValueRef, JSObjectRef, and JSContextRef operations;
+ except JSObject{Get,Set}PrivateData which can be assumed to be simple pure accessors.
+
+ Also renamed the parameter "context" to "ctx" because it makes the code read better with this pervasive
+ but usually uninteresting parameter.
+
+ * API/JSBase.cpp:
+ (JSEvaluateScript):
+ (JSCheckScriptSyntax):
+ (JSGarbageCollect):
+ * API/JSBase.h:
+ * API/JSCallbackObject.cpp:
+ (KJS::JSCallbackObject::JSCallbackObject):
+ (KJS::JSCallbackObject::init):
+ (KJS::JSCallbackObject::getOwnPropertySlot):
+ (KJS::JSCallbackObject::put):
+ (KJS::JSCallbackObject::deleteProperty):
+ (KJS::JSCallbackObject::toNumber):
+ (KJS::JSCallbackObject::toString):
+ * API/JSContextRef.cpp:
+ (JSGlobalContextCreate):
+ (JSGlobalContextRetain):
+ (JSGlobalContextRelease):
+ (JSContextGetGlobalObject):
+ * API/JSContextRef.h:
+ * API/JSNode.c:
+ (JSNodePrototype_appendChild):
+ (JSNodePrototype_removeChild):
+ (JSNodePrototype_replaceChild):
+ (JSNode_getNodeType):
+ (JSNode_getFirstChild):
+ (JSNode_prototype):
+ * API/JSNodeList.c:
+ (JSNodeListPrototype_item):
+ (JSNodeList_length):
+ (JSNodeList_getProperty):
+ (JSNodeList_prototype):
+ * API/JSObjectRef.cpp:
+ (JSObjectMake):
+ (JSObjectMakeFunctionWithCallback):
+ (JSObjectMakeConstructor):
+ (JSObjectMakeFunction):
+ (JSObjectGetPrototype):
+ (JSObjectSetPrototype):
+ (JSObjectHasProperty):
+ (JSObjectGetProperty):
+ (JSObjectSetProperty):
+ (JSObjectGetPropertyAtIndex):
+ (JSObjectSetPropertyAtIndex):
+ (JSObjectDeleteProperty):
+ (JSObjectIsFunction):
+ (JSObjectCallAsFunction):
+ (JSObjectIsConstructor):
+ (JSObjectCallAsConstructor):
+ (JSObjectCopyPropertyNames):
+ * API/JSObjectRef.h:
+ * API/JSStringRef.cpp:
+ * API/JSValueRef.cpp:
+ (JSValueGetType):
+ (JSValueIsUndefined):
+ (JSValueIsNull):
+ (JSValueIsBoolean):
+ (JSValueIsNumber):
+ (JSValueIsString):
+ (JSValueIsObject):
+ (JSValueIsObjectOfClass):
+ (JSValueIsEqual):
+ (JSValueIsStrictEqual):
+ (JSValueIsInstanceOfConstructor):
+ (JSValueMakeUndefined):
+ (JSValueMakeNull):
+ (JSValueMakeBoolean):
+ (JSValueMakeNumber):
+ (JSValueMakeString):
+ (JSValueToBoolean):
+ (JSValueToNumber):
+ (JSValueToStringCopy):
+ (JSValueToObject):
+ (JSValueProtect):
+ (JSValueUnprotect):
+ * API/JSValueRef.h:
+ * API/minidom.c:
+ (print):
+ * API/testapi.c:
+ (MyObject_getProperty):
+ (MyObject_deleteProperty):
+ (MyObject_callAsFunction):
+ (MyObject_callAsConstructor):
+ (MyObject_convertToType):
+ (print_callAsFunction):
+ (main):
+
+2006-07-16 Geoffrey Garen <ggaren@apple.com>
+
+ Approved by Maciej, RS by Beth.
+
+ JSObjectMakeFunction -> JSObjectMakeFunctionWithCallback
+ JSObjectMakeFunctionWithBody -> JSObjectMakeFunction
+
+ because the latter is more common, and more fundamental, than the former.
+
+ * API/APICast.h:
+ (toJS):
+ * API/JSBase.h:
+ * API/JSCallbackObject.cpp:
+ (KJS::JSCallbackObject::getOwnPropertySlot):
+ (KJS::JSCallbackObject::put):
+ (KJS::JSCallbackObject::deleteProperty):
+ (KJS::JSCallbackObject::getPropertyNames):
+ (KJS::JSCallbackObject::staticValueGetter):
+ (KJS::JSCallbackObject::staticFunctionGetter):
+ * API/JSClassRef.cpp:
+ (OpaqueJSClass::OpaqueJSClass):
+ (OpaqueJSClass::~OpaqueJSClass):
+ * API/JSClassRef.h:
+ * API/JSObjectRef.cpp:
+ (JSClassCreate):
+ (JSObjectMakeFunctionWithCallback):
+ (JSObjectMakeFunction):
+ (OpaqueJSPropertyNameArray::OpaqueJSPropertyNameArray):
+ (JSObjectCopyPropertyNames):
+ * API/JSObjectRef.h:
+ * API/minidom.c:
+ (main):
+ * API/testapi.c:
+ (main):
+ * ChangeLog:
+ * JavaScriptCore.exp:
+
+2006-07-16 Geoffrey Garen <ggaren@apple.com>
+
+ Laughed at by Beth.
+
+ Replace __JS with OpaqueJS because the former, while used by CF, is
+ a prefix that's triply-reserved by the compiler. (_* is reserved in global
+ names, _[A-Z] is reserved in all names, and __ is reserved in all names
+ in C++.)
+
+ Opaque is an alternative used by other Mac OS X framewokrs.
+
+ * API/APICast.h:
+ (toJS):
+ * API/JSBase.h:
+ * API/JSCallbackObject.cpp:
+ (KJS::JSCallbackObject::getOwnPropertySlot):
+ (KJS::JSCallbackObject::put):
+ (KJS::JSCallbackObject::deleteProperty):
+ (KJS::JSCallbackObject::getPropertyNames):
+ (KJS::JSCallbackObject::staticValueGetter):
+ (KJS::JSCallbackObject::staticFunctionGetter):
+ * API/JSClassRef.cpp:
+ (OpaqueJSClass::OpaqueJSClass):
+ (OpaqueJSClass::~OpaqueJSClass):
+ * API/JSClassRef.h:
+ * API/JSObjectRef.cpp:
+ (JSClassCreate):
+ (OpaqueJSPropertyNameArray::OpaqueJSPropertyNameArray):
+ (JSObjectCopyPropertyNames):
+
+2006-07-16 Darin Adler <darin@apple.com>
+
+ - try to fix Windows build
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ Added some recently added files, removed some recently removed.
+
+2006-07-16 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej.
+
+ - Change getProperty* to return undefined, rather than NULL, for missing
+ properties, since that's what the spec says. Also added exception out
+ parameters to the *Index functions, because they can call through to the
+ regular functions, which can throw for custom objects.
+
+ * API/JSObjectRef.cpp:
+ (JSObjectGetProperty):
+ (JSObjectGetPropertyAtIndex):
+ (JSObjectSetPropertyAtIndex):
+ * API/JSObjectRef.h:
+ * API/testapi.c:
+ (main):
+
+2006-07-16 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej.
+
+ - Properly document and handle NULL callbacks for static properties. We
+ throw an exception in any case other than a ReadOnly property with a NULL
+ setProperty callback, because a NULL callback almost certainly indicates
+ a programming error. Also throw an exception if hasProperty returns true
+ for a property that getProperty can't get.
+
+ - If a static setProperty callback returns 'false', to indicate that the
+ property was not set, we no longer forward the set request up the class
+ chain, because that's almost certainly not what the programmer expected.
+
+ * API/JSCallbackObject.cpp:
+ (KJS::JSCallbackObject::getOwnPropertySlot):
+ (KJS::JSCallbackObject::put):
+ (KJS::JSCallbackObject::staticValueGetter):
+ (KJS::JSCallbackObject::staticFunctionGetter):
+ (KJS::JSCallbackObject::callbackGetter):
+ * API/JSObjectRef.h:
+ * API/minidom.js:
+ * API/testapi.c:
+ (MyObject_hasProperty):
+ * API/testapi.js:
+
+2006-07-16 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej.
+
+ - Added names to functions.
+
+ - Removed GetPrivate/SetPrivate from callbackFunctions and callbackConstructors.
+ The private data idiom is that a JS object stores its native implementation
+ as private data. For functions and constructors, the native implementation is nothing
+ more than the callback they already store, so supporting private data, too,
+ confuses the idiom. If you *really* want, you can still create a custom
+ function with private data.
+
+ * API/JSCallbackConstructor.cpp:
+ * API/JSCallbackConstructor.h:
+ * API/JSCallbackFunction.cpp:
+ (KJS::JSCallbackFunction::JSCallbackFunction):
+ * API/JSCallbackFunction.h:
+ * API/JSCallbackObject.cpp:
+ (KJS::JSCallbackObject::staticFunctionGetter):
+ * API/JSObjectRef.cpp:
+ (JSObjectMakeFunction):
+ (JSObjectMakeFunctionWithBody):
+ (JSObjectGetPrivate):
+ (JSObjectSetPrivate):
+ * API/JSObjectRef.h:
+ * API/minidom.c:
+ (main):
+ * API/testapi.c:
+ (main):
+
+2006-07-15 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin.
+
+ - switch property lists to be vector+set of Identifiers instead of list of References
+
+ This has the following benefits:
+
+ - no duplicates in property lists
+ - simplifies API calls
+ - probably more efficient, since linked list is gone
+ - entirely removed Reference, ReferenceList and ProtectedReference types from the API
+
+ * kjs/PropertyNameArray.cpp: Added.
+ (KJS::PropertyNameArray::add): Check set, if not already there, add to
+ vector.
+ * kjs/PropertyNameArray.h: Added.
+ (KJS::PropertyNameArray::PropertyNameArray): Newly added type, combines
+ a set and a vector to make a unique but ordered list of identifiers.
+ (KJS::PropertyNameArray::begin): ditto
+ (KJS::PropertyNameArray::end): ditto
+ (KJS::PropertyNameArray::size): ditto
+ (KJS::PropertyNameArray::operator[]): ditto
+ * kjs/array_instance.h:
+ * kjs/array_object.cpp:
+ (ArrayInstance::getPropertyNames): renamed from getPropertyList, updated
+ for PropertyNameArray
+ (ArrayInstance::setLength): updated for PropertyNameArray
+ (ArrayInstance::pushUndefinedObjectsToEnd): ditto
+ * kjs/nodes.cpp:
+ (ForInNode::execute): updated for PropertyNameArray
+ * kjs/nodes.h:
+ * kjs/object.cpp:
+ (KJS::JSObject::getPropertyNames): renamed from getPropertyList, updated
+ for PropertyNameArray
+ * kjs/object.h:
+ * kjs/property_map.cpp:
+ (KJS::PropertyMap::getEnumerablePropertyNames): updated for PropertyNameArray
+ (KJS::PropertyMap::getSparseArrayPropertyNames): ditto
+ * kjs/property_map.h:
+ * kjs/protected_reference.h: Removed.
+ * kjs/reference.cpp: Removed.
+ * kjs/reference.h: Removed.
+ * kjs/reference_list.cpp: Removed.
+ * kjs/reference_list.h: Removed.
+ * kjs/scope_chain.cpp:
+ (KJS::ScopeChain::print): Use PropertyNamesArray instead of ReferenceList.
+ * kjs/string_object.cpp:
+ (StringInstance::getPropertyNames): Updated for new approach.
+ * kjs/string_object.h:
+ * kjs/ustring.h:
+ * API/APICast.h:
+ (toJS): Added overload for PropertyNameAccumulatorRef / PropertyNameArray*
+ (toRef): ditto
+ * API/JSBase.h:
+ * API/JSCallbackObject.cpp:
+ (KJS::JSCallbackObject::getPropertyNames): Fixed for new API.
+ * API/JSCallbackObject.h:
+ * API/JSObjectRef.cpp:
+ (__JSPropertyNameArray::__JSPropertyNameArray): Type used for a publicly vended
+ JSPropertyNameArrayRef.
+ (JSObjectCopyPropertyNames): New API call - renamed / refactored from
+ JSObjectCreatePropertyList
+ (JSPropertyNameArrayRetain): new retain call for JSPropertyNameArray.
+ (JSPropertyNameArrayRelease): new release call for - " -.
+ (JSPropertyNameArrayGetCount): Instead of having to use a stateful enumerator you
+ can now get the count and items in any order.
+ (JSPropertyNameArrayGetNameAtIndex): See above.
+ (JSPropertyNameAccumulatorAddName): What you add properties to is now an opaque
+ accumulator object.
+ * API/JSObjectRef.h: Prototyped new functions, removed old ones
+ * JavaScriptCore.exp: Updated exported symbols.
+ * JavaScriptCore.xcodeproj/project.pbxproj: Added new files, removed old.
+ * API/testapi.c:
+ (MyObject_getPropertyNames): Renamed / fixed callback to fit new paradigm.
+ (main): Updated for new API.
+
+2006-07-15 Darin Adler <darin@apple.com>
+
+ - oops, missed a few more arrays that had to be const
+
+ * API/JSNode.c:
+ (JSNodePrototype_appendChild): Added const.
+ (JSNodePrototype_removeChild): Ditto.
+ (JSNodePrototype_replaceChild): Ditto.
+ (JSNode_construct): Ditto.
+ * API/JSNodeList.c:
+ (JSNodeListPrototype_item): Ditto.
+ * API/JSObjectRef.cpp:
+ (JSObjectMakeFunctionWithBody): Ditto.
+ (JSObjectCallAsFunction): Ditto.
+ (JSObjectCallAsConstructor): Ditto.
+ * API/minidom.c:
+ (print): Ditto.
+ * API/testapi.c:
+ (MyObject_callAsFunction): Ditto.
+ (MyObject_callAsConstructor): Ditto.
+ (print_callAsFunction): Ditto.
+ (myConstructor_callAsConstructor): Ditto.
+
+2006-07-15 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ * API/JSNode.h: Made an array parameter const.
+ * API/JSObjectRef.h: Made array parameters const. Fixed a comment.
+
+2006-07-15 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej.
+
+ - JSObjectMakeFunctionWithBody includes a function name and named parameters now.
+
+ * API/JSObjectRef.cpp:
+ (JSObjectMakeFunctionWithBody):
+ * API/JSObjectRef.h:
+ * API/testapi.c:
+ (assertEqualsAsUTF8String): More informative failure reporting.
+ (main): Test more function cases.
+
+2006-07-15 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej.
+
+ - Moved the arguments passed to JSClassCreate into a single structure,
+ called JSClassDefinition. This will enable easier structure
+ migration/versioning in the future, if necessary.
+
+ - Added support for class names.
+
+ - kJSClassDefinitionNull replaces kJSObjectCallbacksNone.
+
+ - JSClass is becoming a fairly complex struct, so I migrated all of its
+ implementation other than reference counting to the sruct.
+
+ - Also moved JSClass* functions in the API to JSObjectRef.cpp, since they're
+ declared in JSObjectRef.h
+
+ - Also added some more informative explanation to the class structure doc.
+
+2006-07-15 Darin Adler <darin@apple.com>
+
+ Reviewed by Geoff.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=8395
+ <rdar://problem/4613467>
+ REGRESSION: RegEx seems broken for hex escaped non breaking space
+
+ Test: fast/js/regexp-extended-characters-more.html
+
+ * pcre/pcre_exec.c:
+ (match): Got rid of utf16Length local variable to guarantee there's no
+ extra stack usage in recursive calls. Fixed two places in the PCRE_UTF16
+ code that were using the length variable, which is the UTF-8 length of
+ a character in the pattern, to move in the UTF-16 subject string. Instead
+ they hardcode lengths of 1 and 2 since the code already handles BMP
+ characters and surrogate pairs separately. Also fixed some DPRINTF so
+ I could compile with DEBUG on.
+ (pcre_exec): Changed a place that was checking for multibyte characters
+ in the subject string to use ISMIDCHAR. Instead it was using hardcoded
+ logic that was right for UTF-8 but wrong for UTF-16.
+
+ * pcre/pcre_compile.c: (pcre_compile2): Fixed a DPRINTF so I could compile
+ with DEBUG on.
+
+2006-07-14 Geoffrey Garen <ggaren@apple.com>
+
+ RS by Maciej.
+
+ Global replace in the API of argc/argv with argumentCount/arguments.
+
+2006-07-14 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej.
+
+ - Finalized exception handling in the API.
+
+ setProperty can throw because it throws for built-in arrays. getProperty
+ and deleteProperty can throw because setProperty can throw and we want
+ to be consistent, and also because they seem like "actions." callAsFunction,
+ callAsConstructor, and hasInstance can throw, because they caan throw for
+ all built-ins.
+
+ toBoolean can't throw because it's defined that way in the spec.
+
+ - Documented that toBoolean and toObject can't be overridden by custom
+ objects because they're defined that way in the spec.
+
+=== Safari-521.17 ===
+
+2006-07-14 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej.
+
+ - Implemented ref-counting of JSContexts by splitting into two datatypes:
+ JSGlobalContext, which you can create/retain/release, and JSContext, which
+ you can't.
+
+ Internally, you retain a JSGlobalContext/ExecState by retaining its
+ interpreter, which, in the case of a global ExecState, owns it.
+
+ - Also made ~Interpreter() protected to catch places where Interpreter
+ is manually deleted. (Can't make it private because some crazy fool
+ decided it would be a good idea to subclass Interpreter in other frameworks.
+ I pity da fool.)
+
+ * API/APICast.h:
+ (toJS): Added cast for new JSGlobalContext
+ * API/JSStringRef.h: Changed vague "you must" language to more specific
+ (but, ultimately, equally vague) "behavior is undefined if you don't"
+ language.
+ (KJS::Interpreter::Interpreter): Factored more common initialization into
+ init()
+ * kjs/interpreter.h:
+ (KJS::Interpreter::ref): new
+ (KJS::Interpreter::deref): new
+ (KJS::Interpreter::refCount): new
+ * kjs/testkjs.cpp:
+ (doIt): Ref-count the interpreter.
+
+2006-07-14 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Geoff.
+
+ - removed bool return value from JSObjectSetProperty, since it is inefficient and
+ also doesn't work quite right
+ - added JSObjectGetPropertyAtIndex and JSObjectSetPropertyAtIndex
+
+ * API/JSObjectRef.cpp:
+ (JSObjectSetProperty): Removed return value and canPut stuff.
+ (JSObjectGetPropertyAtIndex): Added.
+ (JSObjectSetPropertyAtIndex): Added.
+ * API/JSObjectRef.h: Prototyped and documented new functions.
+
+2006-07-14 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Beth.
+
+ Moved JSCheckScriptSyntax, JSEvaluateScript, and JSGarbageCollect into
+ JSBase.h/.cpp. They don't belong in the value-specific or context-specific
+ files because they're not part of the value or context implementations.
+
+ * API/JSBase.h:
+ * API/JSContextRef.cpp:
+ (JSContextGetGlobalObject):
+ * API/JSContextRef.h:
+ * API/JSValueRef.cpp:
+ (JSValueUnprotect):
+ * API/JSValueRef.h:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2006-07-13 Timothy Hatcher <timothy@apple.com>
+
+ Reviewed by Maciej.
+
+ Moved JavaScriptCore to be a public framework.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2006-07-13 Mark Rowe <opendarwin.org@bdash.net.nz>
+
+ Reviewed by Geoffrey.
+
+ http://bugs.webkit.org/show_bug.cgi?id=9742
+ Bug 9742: REGRESSION: WebKit hangs when loading <http://www.vtbook.com>
+
+ * kjs/value.h:
+ (KJS::JSValue::getUInt32): Only types tagged as numeric can be converted to UInt32.
+
+2006-07-13 Geoffrey Garen <ggaren@apple.com>
+
+ Pleasing to Maciej.
+
+ - Renamed JSEvaluate -> JSEvaluateScript, JSCheckSyntax -> JSCheckScriptSyntax
+ - Added exception out parameters to JSValueTo* and JSValueIsEqual because
+ they can throw
+ - Removed JSObjectGetDescription because it's useless and vague, and
+ JSValueToString/JSValueIsObjectOfClass do a better job, anyway
+ - Clarified comments about "IsFunction/Constructor" to indicate that they
+ are true of all functions/constructors, not just those created by JSObjectMake*
+
+2006-07-12 Geoffrey Garen <ggaren@apple.com>
+
+ RS by Beth.
+
+ Finished previously approved JSInternalString -> JSString conversion
+ by renaming the files.
+
+ * API/JSCallbackObject.cpp:
+ * API/JSInternalStringRef.cpp: Removed.
+ * API/JSInternalStringRef.h: Removed.
+ * API/JSStringRef.cpp: Added.
+ * API/JSStringRef.h: Added.
+ * API/JavaScriptCore.h:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2006-07-12 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej.
+
+ - Removed context and exception parameters from JSObjectGetPropertyEnumerator,
+ removing the spurious use of ExecState inside JavaScriptCore that made
+ us think this was necessary in the first place.
+
+ (StringInstance::getPropertyList): Use getString instead of toString because
+ we know we're dealing with a string -- we put it there in the first place.
+ While we're at it, store the string's size instead of retrieving it each time
+ through the loop, to avoid the unnecessary killing of puppies.
+ * kjs/string_object.h:
+
+2006-07-12 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Geoff.
+
+ - add handling of hasInstance callback for API objects
+
+ * API/JSCallbackObject.cpp:
+ (KJS::JSCallbackObject::implementsHasInstance): Check if callback is present.
+ (KJS::JSCallbackObject::hasInstance): Invoke appropriate callback.
+ * API/JSCallbackObject.h:
+ * API/JSClassRef.cpp:
+ * API/JSObjectRef.h:
+ * API/testapi.c:
+ (MyObject_hasInstance): Test case; should match what construct would do.
+ * API/testapi.js:
+
+2006-07-11 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej.
+
+ - Implemented a vast number of renames and comment clarifications
+ suggested during API review.
+
+ JSInternalString -> JSString
+ JS*Make -> JSValueMake*, JSObjectMake*
+ JSTypeCode -> JSType
+ JSValueIsInstanceOf -> JSValueIsInstanceOfConstructor (reads strangely well in client code)
+ JSGC*Protect -> JSValue*Protect
+ JS*Callback -> JSObject*Callback
+ JSGetPropertyListCallback -> JSObjectAddPropertiesToListCallback
+ JSPropertyEnumeratorGetNext -> JSPropertyEnumeratorGetNextName
+ JSString* ->
+ JSStringCreateWithUTF8CString, JSStringGetUTF8CString,
+ JSStringGetMaximumUTF8CStringSize JSStringIsEqualToUTF8CString,
+ JSStringCreateWithCFString, JSStringCopyCFString, JSStringCreateWithCharacters.
+
+ - Changed functions taking a JSValue out arg and returning a bool indicating
+ whether it was set to simply return a JSValue or NULL.
+
+ - Removed JSStringGetCharacters because it's more documentation than code,
+ and it's just a glorified memcpy built on existing API functionality.
+
+ - Moved standard library includes into the headers that actually require them.
+
+ - Standardized use of the phrase "Create Rule."
+
+ - Removed JSLock from make functions that don't allocate.
+
+ - Added exception handling to JSValueToBoolean, since we now allow
+ callback objects to throw exceptions upon converting to boolean.
+
+ - Renamed JSGCCollect to JSGarbageCollect.
+
+2006-07-10 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin.
+
+ - Changed public header includes to the <JavaScriptCore/ style.
+ - Changed instances of 'buffer' to 'string' since we decided on
+ JSInternalString instead of JSStringBuffer.
+
+ * API/JSContextRef.h:
+ * API/JSInternalStringRef.cpp:
+ (JSStringMake):
+ (JSInternalStringRetain):
+ (JSInternalStringRelease):
+ (JSValueCopyStringValue):
+ (JSInternalStringGetLength):
+ (JSInternalStringGetCharactersPtr):
+ (JSInternalStringGetCharacters):
+ (JSInternalStringGetMaxLengthUTF8):
+ (JSInternalStringGetCharactersUTF8):
+ (CFStringCreateWithJSInternalString):
+ * API/JSInternalStringRef.h:
+ * API/JSNode.c:
+ (JSNodePrototype_appendChild):
+ (JSNode_getNodeType):
+ * API/JSObjectRef.cpp:
+ (JSObjectCallAsConstructor):
+ * API/JSValueRef.h:
+ * API/JavaScriptCore.h:
+ * API/minidom.c:
+ (main):
+ (print):
+ * API/testapi.c:
+ (MyObject_getPropertyList):
+ (myConstructor_callAsConstructor):
+ (main): I noticed that we were prematurely releasing some string buffers,
+ so I moved their release calls to the end of main(). I got rid of 'Buf' in *Buf
+ (sometimes changing to 'IString', when necessary to differentiate a variable)
+ to match the buffer->string change.
+
+=== Safari-521.16 ===
+
+2006-07-10 Darin Adler <darin@apple.com>
+
+ * kjs/value.cpp: (KJS::JSValue::toInt32Inline): Added inline keyword one more place.
+ Just in case.
+
+2006-07-10 Darin Adler <darin@apple.com>
+
+ - fix the release build
+
+ * kjs/value.h:
+ * kjs/value.cpp:
+ (KJS::JSValue::toInt32Inline): Move the code here to an inline.
+ (KJS::JSValue::toInt32): Call the inline from both overloaded toInt32 functions.
+
+2006-07-10 David Kilzer <ddkilzer@kilzer.net>
+
+ Reviewed by Darin.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=9179
+ Implement select.options.add() method
+
+ * JavaScriptCore.exp: Added overloaded KJS::JSValue::toInt32() method.
+ * JavaScriptCore.xcodeproj/project.pbxproj: Altered attributes metadata for
+ kjs/value.h to make it available as a forwarded header.
+ * kjs/lookup.h:
+ (KJS::lookupPut): Extracted a lookupPut() method from the existing lookupPut() method.
+ The new method returns a boolean value if no entry is found in the lookup table.
+ * kjs/value.cpp:
+ (KJS::JSValue::toInt32): Overloaded toInt32() method with boolean "Ok" argument.
+ * kjs/value.h: Ditto.
+
+2006-07-10 Geoffrey Garen <ggaren@apple.com>
+
+ No review necessary. Removed bogus file I accidentally checked in before.
+
+ * API/JSInternalSringRef.h: Removed.
+
+2006-07-10 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin.
+
+ Added exception out parameter to API object callbacks, removed semi-bogus
+ JSContext(.*)Exception functions.
+
+ To make these calls syntactically simple, I added an exceptionSlot()
+ method to the ExecState class, which provides a JSValue** slot in which to
+ store a JSValue* exception.
+
+ * API/APICast.h:
+ (toRef):
+ * API/JSCallbackConstructor.cpp:
+ (KJS::JSCallbackConstructor::construct):
+ * API/JSCallbackFunction.cpp:
+ (KJS::JSCallbackFunction::callAsFunction):
+ * API/JSCallbackObject.cpp:
+ (KJS::JSCallbackObject::init):
+ (KJS::JSCallbackObject::getOwnPropertySlot):
+ (KJS::JSCallbackObject::put):
+ (KJS::JSCallbackObject::deleteProperty):
+ (KJS::JSCallbackObject::construct):
+ (KJS::JSCallbackObject::callAsFunction):
+ (KJS::JSCallbackObject::getPropertyList):
+ (KJS::JSCallbackObject::toBoolean):
+ (KJS::JSCallbackObject::toNumber):
+ (KJS::JSCallbackObject::toString):
+ (KJS::JSCallbackObject::staticValueGetter):
+ (KJS::JSCallbackObject::callbackGetter):
+ * API/JSContextRef.cpp:
+ (JSCheckSyntax):
+ * API/JSContextRef.h:
+ * API/JSNode.c:
+ (JSNodePrototype_appendChild):
+ (JSNodePrototype_removeChild):
+ (JSNodePrototype_replaceChild):
+ (JSNode_getNodeType):
+ (JSNode_getChildNodes):
+ (JSNode_getFirstChild):
+ (JSNode_construct):
+ * API/JSNode.h:
+ * API/JSNodeList.c:
+ (JSNodeListPrototype_item):
+ (JSNodeList_length):
+ (JSNodeList_getProperty):
+ * API/JSObjectRef.h:
+ * API/minidom.c:
+ (print):
+ * API/testapi.c:
+ (MyObject_initialize):
+ (MyObject_hasProperty):
+ (MyObject_getProperty):
+ (MyObject_setProperty):
+ (MyObject_deleteProperty):
+ (MyObject_getPropertyList):
+ (MyObject_callAsFunction):
+ (MyObject_callAsConstructor):
+ (MyObject_convertToType):
+ (print_callAsFunction):
+ (myConstructor_callAsConstructor):
+ (main):
+ * JavaScriptCore.exp:
+ * kjs/ExecState.h:
+ (KJS::ExecState::exceptionHandle):
+
+2006-07-10 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin.
+
+ Improved type safety by implementing opaque JSValue/JSObject typing through
+ abuse of 'const', not void*. Also fixed an alarming number of bugs
+ exposed by this new type safety.
+
+ I made one design change in JavaScriptCore, which is that the JSObject
+ constructor should take a JSValue* as its prototype argument, not a JSObject*,
+ since we allow the prototype to be any JSValue*, including jsNull(), for
+ example.
+
+ * API/APICast.h:
+ (toJS):
+ * API/JSBase.h:
+ * API/JSCallbackConstructor.cpp:
+ (KJS::JSCallbackConstructor::construct):
+ * API/JSCallbackFunction.cpp:
+ (KJS::JSCallbackFunction::callAsFunction):
+ * API/JSCallbackObject.cpp:
+ (KJS::JSCallbackObject::JSCallbackObject):
+ (KJS::JSCallbackObject::getOwnPropertySlot):
+ (KJS::JSCallbackObject::put):
+ (KJS::JSCallbackObject::construct):
+ (KJS::JSCallbackObject::callAsFunction):
+ (KJS::JSCallbackObject::staticFunctionGetter):
+ * API/JSCallbackObject.h:
+ * API/JSContextRef.cpp:
+ (JSEvaluate):
+ * API/JSNode.c:
+ (JSNodePrototype_appendChild):
+ (JSNodePrototype_removeChild):
+ (JSNodePrototype_replaceChild):
+ * API/JSObjectRef.cpp:
+ (JSObjectMake):
+ (JSFunctionMakeWithBody):
+ (JSObjectGetProperty):
+ (JSObjectCallAsFunction):
+ (JSObjectCallAsConstructor):
+ * API/JSObjectRef.h:
+ * API/testapi.c:
+ (main):
+ * ChangeLog:
+ * kjs/object.h:
+ (KJS::JSObject::JSObject):
+
+2006-07-10 Geoffrey Garen <ggaren@apple.com>
+
+ Approved by Maciej, Darin.
+
+ Renamed JSStringBufferRef to JSInternalStringRef. "Internal string" means the
+ JavaScript engine's internal string representation, which is the most
+ low-level and efficient representation to use when interfacing with JavaScript.
+
+ * API/APICast.h:
+ (toJS):
+ (toRef):
+ * API/JSBase.h:
+ * API/JSCallbackObject.cpp:
+ (KJS::JSCallbackObject::getOwnPropertySlot):
+ (KJS::JSCallbackObject::put):
+ (KJS::JSCallbackObject::deleteProperty):
+ (KJS::JSCallbackObject::staticValueGetter):
+ (KJS::JSCallbackObject::callbackGetter):
+ * API/JSContextRef.cpp:
+ (JSEvaluate):
+ (JSCheckSyntax):
+ * API/JSContextRef.h:
+ * API/JSInternalStringRef.cpp: Added.
+ (JSStringMake):
+ (JSInternalStringCreate):
+ (JSInternalStringCreateUTF8):
+ (JSInternalStringRetain):
+ (JSInternalStringRelease):
+ (JSValueCopyStringValue):
+ (JSInternalStringGetLength):
+ (JSInternalStringGetCharactersPtr):
+ (JSInternalStringGetCharacters):
+ (JSInternalStringGetMaxLengthUTF8):
+ (JSInternalStringGetCharactersUTF8):
+ (JSInternalStringIsEqual):
+ (JSInternalStringIsEqualUTF8):
+ (JSInternalStringCreateCF):
+ (CFStringCreateWithJSInternalString):
+ * API/JSInternalStringRef.h: Added.
+ * API/JSNode.c:
+ (JSNodePrototype_appendChild):
+ (JSNode_getNodeType):
+ (JSNode_getChildNodes):
+ (JSNode_getFirstChild):
+ * API/JSNodeList.c:
+ (JSNodeList_length):
+ (JSNodeList_getProperty):
+ * API/JSObjectRef.cpp:
+ (JSFunctionMakeWithBody):
+ (JSObjectGetDescription):
+ (JSObjectHasProperty):
+ (JSObjectGetProperty):
+ (JSObjectSetProperty):
+ (JSObjectDeleteProperty):
+ (JSPropertyEnumeratorGetNext):
+ (JSPropertyListAdd):
+ * API/JSObjectRef.h:
+ * API/JSStringBufferRef.cpp: Removed.
+ * API/JSStringBufferRef.h: Removed.
+ * API/JSValueRef.h:
+ * API/JavaScriptCore.h:
+ * API/minidom.c:
+ (main):
+ (print):
+ * API/testapi.c:
+ (assertEqualsAsUTF8String):
+ (assertEqualsAsCharactersPtr):
+ (assertEqualsAsCharacters):
+ (MyObject_hasProperty):
+ (MyObject_getProperty):
+ (MyObject_setProperty):
+ (MyObject_deleteProperty):
+ (MyObject_getPropertyList):
+ (print_callAsFunction):
+ (myConstructor_callAsConstructor):
+ (main):
+ * JavaScriptCore.exp:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2006-07-08 Tim Omernick <timo@apple.com>
+
+ Reviewed by Maciej.
+
+ Added an OpenGL drawing model to the Netscape Plug-in API.
+
+ * bindings/npapi.h:
+
+2006-07-08 Timothy Hatcher <timothy@apple.com>
+
+ Reviewed by Maciej.
+
+ Moved KJS_GetCreatedJavaVMs to jni_utility.cpp.
+ Switched KJS_GetCreatedJavaVMs over to use dlopen and dlsym
+ now that NSAddImage, NSLookupSymbolInImage and NSAddressOfSymbol
+ are deprecated in Leopard.
+
+ * JavaScriptCore.exp:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * bindings/jni/jni_utility.cpp:
+ (KJS::Bindings::KJS_GetCreatedJavaVMs):
+ * bindings/softlinking.c: Removed.
+ * bindings/softlinking.h: Removed.
+
+2006-07-08 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Anders.
+
+ - Make JSObjectGetProperty return a JSValue or NULL, like JSEvaluate does.
+
+ * API/JSObjectRef.cpp:
+ (JSObjectGetProperty):
+ * API/JSObjectRef.h:
+ * API/testapi.c:
+ (main):
+
+2006-07-08 Geoffrey Garen <ggaren@apple.com>
+
+ Style change -- no review necessary.
+
+ Use 0 instead of NULL in API .cpp files, to match our style guidelines.
+
+ * API/JSContextRef.cpp:
+ (JSEvaluate):
+ * API/JSObjectRef.cpp:
+ (JSFunctionMakeWithBody):
+ (JSObjectCallAsFunction):
+ (JSObjectCallAsConstructor):
+ * API/JSValueRef.cpp:
+ (JSValueToObject):
+
+2006-07-08 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by TimO.
+
+ - Added ability to pass NULL for thisObject when calling JSObjectCallAsFunction,
+ to match JSEvaluate.
+
+ * API/JSObjectRef.cpp:
+ (JSObjectCallAsFunction):
+ * API/JSObjectRef.h:
+ * API/testapi.c:
+ (main):
+
+=== Safari-521.15 ===
+
+2006-07-07 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej.
+
+ - Standardized which functions take a JSContext as an argument. The rule is:
+ if you might execute JavaScript, you take a JSContext, otherwise you don't.
+
+ The FIXME in JSObjectRef.h requires refactoring some parts of Interpreter,
+ but not API changes, so I'm putting it off until later.
+
+ * API/JSCallbackObject.cpp:
+ (KJS::JSCallbackObject::JSCallbackObject):
+ (KJS::JSCallbackObject::init):
+ * API/JSCallbackObject.h:
+ * API/JSContextRef.cpp:
+ (JSContextCreate):
+ * API/JSContextRef.h:
+ * API/JSObjectRef.cpp:
+ (JSObjectMake):
+ (JSPropertyEnumeratorGetNext):
+ * API/JSObjectRef.h:
+ * API/testapi.c:
+ (MyObject_initialize):
+ (main):
+ * JavaScriptCore.exp:
+ * kjs/array_object.cpp:
+ (ArrayInstance::setLength):
+ (ArrayInstance::pushUndefinedObjectsToEnd):
+ * kjs/nodes.cpp:
+ (ForInNode::execute):
+ * kjs/reference.cpp:
+ (KJS::Reference::getPropertyName):
+ (KJS::Reference::getValue):
+ * kjs/reference.h:
+ * kjs/scope_chain.cpp:
+ (KJS::ScopeChain::print):
+
+2006-07-06 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej.
+
+ More API action.
+
+ - Headerdoc finished
+
+ Semantic Changes:
+ - Added a JSContextRef argument to many functions, because you need a
+ JSContextRef for doing virtually anything. I expect to add this argument
+ to even more functions in a future patch.
+
+ - Removed the globalObjectPrototype argument to JSContextCreate because
+ you can't create an object until you have a context, so it's impossible
+ to pass a prototype object to JSContextCreate. That's OK because (1) there's
+ no reason to give the global object a prototype and (2) if you really want
+ to, you can just use a separate call to JSObjectSetPrototype.
+
+ - Removed the JSClassRef argument to JSClassCreate because it was unnecessary,
+ and you need to be able to make the global object's class before you've
+ created a JSContext.
+
+ - Added an optional exception parameter to JSFunctionMakeWithBody because anything
+ less would be uncivilized.
+
+ - Made the return value parameter to JSObjectGetProperty optional to match
+ all other return value parameters in the API.
+
+ - Made JSObjectSetPrivate/JSObjectGetPrivate work on JSCallbackFunctions
+ and JSCallbackConstructors. You could use an abstract base class or strategic
+ placement of m_privateData in the class structure to implement this, but
+ the former seemed like overkill, and the latter seemed too dangerous.
+
+ - Fixed a bug where JSPropertyEnumeratorGetNext would skip the first property.
+
+ Cosmetic Changes:
+ - Reversed the logic of the JSChar #ifdef to avoid confusing headerdoc
+
+ - Removed function names from @function declarations because headeroc
+ can parse them automatically, and I wanted to rule out manual mismatch.
+
+ - Changed Error::create to take a const UString& instead of a UString*
+ because it was looking at me funny.
+
+ - Renamed JSStringBufferCreateWithCFString to JSStringBufferCreateCF
+ because the latter is more concise and it matches JSStringBufferCreateUTF8.
+
+ * API/JSCallbackObject.cpp:
+ (KJS::JSCallbackObject::getOwnPropertySlot):
+ (KJS::JSCallbackObject::put):
+ (KJS::JSCallbackObject::deleteProperty):
+ (KJS::JSCallbackObject::getPropertyList):
+ (KJS::JSCallbackObject::toBoolean):
+ (KJS::JSCallbackObject::toNumber):
+ (KJS::JSCallbackObject::toString):
+ * API/JSClassRef.cpp:
+ (JSClassCreate):
+ * API/JSContextRef.cpp:
+ (JSContextCreate):
+ (JSContextSetException):
+ * API/JSContextRef.h:
+ * API/JSNode.c:
+ (JSNodePrototype_class):
+ (JSNode_class):
+ * API/JSNodeList.c:
+ (JSNodeListPrototype_class):
+ (JSNodeList_class):
+ * API/JSObjectRef.cpp:
+ (JSObjectGetProperty):
+ (JSObjectGetPrivate):
+ (JSObjectSetPrivate):
+ (JSObjectCallAsFunction):
+ (JSObjectCallAsConstructor):
+ (JSPropertyEnumeratorGetNext):
+ * API/JSObjectRef.h:
+ * API/JSStringBufferRef.cpp:
+ (JSStringBufferCreateCF):
+ * API/JSStringBufferRef.h:
+ * API/JSValueRef.cpp:
+ (JSValueIsInstanceOf):
+ * API/JSValueRef.h:
+ * API/minidom.c:
+ (main):
+ * API/minidom.js:
+ * API/testapi.c:
+ (MyObject_hasProperty):
+ (MyObject_setProperty):
+ (MyObject_deleteProperty):
+ (MyObject_getPropertyList):
+ (MyObject_convertToType):
+ (MyObject_class):
+ (main):
+ * JavaScriptCore.exp:
+
+2006-07-07 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by John.
+
+ - Fixed a few crashes resulting from NULL parameters to JSClassCreate.
+
+ * API/JSClassRef.cpp:
+ (JSClassCreate):
+ (JSClassRelease):
+ * API/testapi.c: Added test for NULL parameters.
+ (main):
+
+2006-07-07 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by John, mocked by Darin.
+
+ - Changed JSEvaluate to take a JSObjectRef instead of a JSValueRef as
+ "this," since "this" must be an object.
+
+ * API/JSContextRef.cpp:
+ (JSEvaluate):
+ * API/JSContextRef.h:
+
+2006-07-07 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by John.
+
+ - More headerdoc
+
+ * API/JSBase.h:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2006-07-05 Geoffrey Garen <ggaren@apple.com>
+
+ RS by Beth.
+
+ Renamed JSCharBufferRef, which was universally unpopular, to JSStringBufferRef,
+ which, hopefully, will be less unpopular.
+
+ * API/APICast.h:
+ (toJS):
+ (toRef):
+ * API/JSBase.h:
+ * API/JSCallbackObject.cpp:
+ (KJS::JSCallbackObject::getOwnPropertySlot):
+ (KJS::JSCallbackObject::put):
+ (KJS::JSCallbackObject::deleteProperty):
+ (KJS::JSCallbackObject::staticValueGetter):
+ (KJS::JSCallbackObject::callbackGetter):
+ * API/JSCharBufferRef.cpp: Removed.
+ * API/JSCharBufferRef.h: Removed.
+ * API/JSContextRef.cpp:
+ (JSEvaluate):
+ (JSCheckSyntax):
+ * API/JSContextRef.h:
+ * API/JSNode.c:
+ (JSNodePrototype_appendChild):
+ (JSNode_getNodeType):
+ (JSNode_getChildNodes):
+ (JSNode_getFirstChild):
+ * API/JSNodeList.c:
+ (JSNodeList_length):
+ (JSNodeList_getProperty):
+ * API/JSObjectRef.cpp:
+ (JSFunctionMakeWithBody):
+ (JSObjectGetDescription):
+ (JSObjectHasProperty):
+ (JSObjectGetProperty):
+ (JSObjectSetProperty):
+ (JSObjectDeleteProperty):
+ (JSPropertyEnumeratorGetNext):
+ (JSPropertyListAdd):
+ * API/JSObjectRef.h:
+ * API/JSStringBufferRef.cpp: Added.
+ (JSStringMake):
+ (JSStringBufferCreate):
+ (JSStringBufferCreateUTF8):
+ (JSStringBufferRetain):
+ (JSStringBufferRelease):
+ (JSValueCopyStringValue):
+ (JSStringBufferGetLength):
+ (JSStringBufferGetCharactersPtr):
+ (JSStringBufferGetCharacters):
+ (JSStringBufferGetMaxLengthUTF8):
+ (JSStringBufferGetCharactersUTF8):
+ (JSStringBufferIsEqual):
+ (JSStringBufferIsEqualUTF8):
+ (JSStringBufferCreateWithCFString):
+ (CFStringCreateWithJSStringBuffer):
+ * API/JSStringBufferRef.h: Added.
+ * API/JSValueRef.h:
+ * API/JavaScriptCore.h:
+ * API/minidom.c:
+ (main):
+ (print):
+ * API/testapi.c:
+ (assertEqualsAsUTF8String):
+ (assertEqualsAsCharactersPtr):
+ (assertEqualsAsCharacters):
+ (MyObject_hasProperty):
+ (MyObject_getProperty):
+ (MyObject_setProperty):
+ (MyObject_deleteProperty):
+ (MyObject_getPropertyList):
+ (print_callAsFunction):
+ (myConstructor_callAsConstructor):
+ (main):
+ * JavaScriptCore.exp:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2006-07-05 Geoffrey Garen <ggaren@apple.com>
+
+ RS by Beth.
+
+ Moved some code around for more logical file separation.
+
+ * API/JSBase.h:
+ * API/JSContextRef.h:
+ * API/JSObjectRef.cpp:
+ * API/JSValueRef.cpp:
+ (JSValueToObject):
+ * API/JSValueRef.h:
+
+2006-07-03 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej.
+
+ Implemented JSFunctionMakeWithBody, which parses a script as a function body
+ in the global scope, and returns the resulting anonymous function.
+
+ I also removed private data from JSCallbackFunction. It never worked,
+ since JSCallbackFunction doesn't inherit from JSCallbackObject.
+
+ * API/JSCallbackConstructor.cpp: Removed.
+ * API/JSCallbackConstructor.h: Removed.
+ * API/JSCallbackFunction.cpp:
+ (KJS::JSCallbackFunction::JSCallbackFunction):
+ (KJS::JSCallbackFunction::implementsConstruct):
+ (KJS::JSCallbackFunction::construct):
+ (KJS::JSCallbackFunction::implementsCall):
+ (KJS::JSCallbackFunction::callAsFunction):
+ * API/JSCallbackFunction.h:
+ * API/JSCallbackObject.cpp:
+ (KJS::JSCallbackObject::staticFunctionGetter):
+ * API/JSObjectRef.cpp:
+ (JSFunctionMake):
+ (JSFunctionMakeWithCallbacks):
+ * API/JSObjectRef.h:
+ * API/JSValueRef.h:
+ * API/minidom.c:
+ (main):
+ * API/testapi.c:
+ (main):
+ * JavaScriptCore.exp: Programmatically added all symbols exported by
+ API object files, and sorted results
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2006-07-03 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej.
+
+ - Return syntax error in JSCheckSyntax through a JSValueRef* exception
+ argument
+
+ * API/JSBase.h:
+ * API/JSContextRef.cpp:
+ (JSCheckSyntax):
+ * API/testapi.c:
+ (main):
+ * JavaScriptCore.exp:
+ * kjs/interpreter.cpp:
+ (KJS::Interpreter::checkSyntax):
+ * kjs/interpreter.h:
+
+2006-07-04 Darin Adler <darin@apple.com>
+
+ - fixed build
+
+ * wtf/MathExtras.h: Oops. Added missing #endif.
+
+2006-07-04 Bjoern Graf <bjoern.graf@gmail.com>
+
+ Reviewed by Maciej.
+ Tweaked a bit by Darin.
+
+ - http://bugs.webkit.org/show_bug.cgi?id=9678
+ work around MSVCRT's fmod function returning NaN for fmod(x, infinity) instead of x
+
+ * wtf/MathExtras.h: Added include of <float.h>.
+ (isinf): Fix to return false for NAN.
+ (wtf_fmod): Added. An inline that works around the bug.
+
+ * kjs/nodes.cpp:
+ * kjs/number_object.cpp:
+ * kjs/operations.cpp:
+ * kjs/value.cpp:
+ Added includes of MathExtras.h to all files using fmod.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj: Let Xcode 2.3 have its way with
+ the project.
+
+2006-07-01 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin.
+
+ - Refined value conversions in the API:
+ - failed toNumber returns NaN
+ - failed toObject returns NULL
+ - failed toString returns empty string
+
+ - Refined excpetion handling in the API:
+ - failed value conversions do not throw exceptions
+ - uncaught exceptions in JSEvaluate, JSObjectCallAsFunction, and
+ JSObjectCallAsConstructor are returned through a JSValueRef* exception
+ argument
+ - removed JSContextHasException, because JSContextGetException does
+ the same job
+
+ * API/JSBase.h:
+ * API/JSCharBufferRef.cpp:
+ (JSValueCopyStringValue):
+ * API/JSContextRef.cpp:
+ (JSEvaluate):
+ * API/JSContextRef.h:
+ * API/JSNodeList.c: Added test code demonstrating how you would use
+ toNumber, and why you probably don't need toUInt32, etc.
+ (JSNodeListPrototype_item):
+ (JSNodeList_getProperty):
+ * API/JSObjectRef.cpp:
+ (JSValueToObject):
+ (JSObjectCallAsFunction):
+ (JSObjectCallAsConstructor):
+ * API/JSObjectRef.h:
+ * API/JSValueRef.cpp:
+ (JSValueToNumber):
+ * API/JSValueRef.h:
+ * API/minidom.c:
+ (main):
+ * API/testapi.c:
+ (main): Added tests for new rules, and call to JSGCProtect to fix Intel
+ crash
+ * JavaScriptCore.exp:
+
+2006-07-03 Darin Adler <darin@apple.com>
+
+ - Rolled out HashMap implementation of NPRuntime, at least temporarily.
+
+ Fixes hang in the bindings section of layout tests seen on the
+ buildbot.
+
+ This code was using HashMap<const char*, PrivateIdentifier*>.
+ But that hashes based on pointer identity, not string value.
+ The default hash for any pointer type is to hash based on the pointer.
+ And WTF doesn't currently have a string hash for char*.
+ We'll need to fix that before re-landing this patch.
+
+ (Formatting was also incorrect -- extra spaces in parentheses.)
+
+ * bindings/npruntime.cpp: Rolled out last change.
+
+2006-07-02 Justin Haygood <jhaygood@spsu.edu>
+
+ Reviewed, tweaked, landed by ggaren.
+
+ - Port NPRuntime from CFDictionary to HashMap.
+
+ * bindings/npruntime.cpp:
+ (getStringIdentifierDictionary):
+ (getIntIdentifierDictionary):
+ (_NPN_GetStringIdentifier):
+ (_NPN_GetIntIdentifier):
+ * bindings/npruntime.h:
+
+2006-07-01 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Adele.
+
+ - Fixed <rdar://problem/4611197> REGRESSION: Liveconnect with Java test
+ fails at http://www-sor.inria.fr/~dedieu/notes/liveconnect/simple_example.html
+
+ * JavaScriptCore.exp: Export symbols used by liveconnect
+
+2006-06-29 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej.
+
+ - Phase 2 in the JS API.
+
+ - Added support for specifying static tables of values -- this should
+ obviate the need for using complicated callbacks for most lookups.
+
+ - API objects are now created with classes (JSClassRef) -- in order to support
+ static values, and in order to prevent API objects from storing their
+ data inline, and thus falling into the oversized (read: slow and prone to
+ giving Maciej the frowny face) heap.
+
+ - Added two specialized JSObject subclasses -- JSCallbackFunction and JSCallbackConstructor --
+ to allow JSFunctionMake and JSConstructorMake to continue to work with
+ the new class model. Another solution to this problem would be to create
+ a custom class object for each function and constructor you make. This
+ solution is more code but also more efficient.
+
+ - Substantially beefed up the minidom example to demonstrate and test a
+ lot of these techniques. Its output is still pretty haphazard, though.
+
+ - Gave the <kjs/ preface to some includes -- I'm told this matters to
+ building on some versions of Linux.
+
+ - Implemented JSValueIsInstanceOf and JSValueIsObjectOfClass
+
+ - Removed GetDescription callback. Something in the class datastructure
+ should take care of this.
+
+ * API/JSBase.h:
+ * API/JSCallbackConstructor.cpp: Added.
+ (KJS::):
+ (KJS::JSCallbackConstructor::JSCallbackConstructor):
+ (KJS::JSCallbackConstructor::implementsConstruct):
+ (KJS::JSCallbackConstructor::construct):
+ (KJS::JSCallbackConstructor::setPrivate):
+ (KJS::JSCallbackConstructor::getPrivate):
+ * API/JSCallbackConstructor.h: Added.
+ (KJS::JSCallbackConstructor::classInfo):
+ * API/JSCallbackFunction.cpp: Added.
+ (KJS::):
+ (KJS::JSCallbackFunction::JSCallbackFunction):
+ (KJS::JSCallbackFunction::implementsCall):
+ (KJS::JSCallbackFunction::callAsFunction):
+ (KJS::JSCallbackFunction::setPrivate):
+ (KJS::JSCallbackFunction::getPrivate):
+ * API/JSCallbackFunction.h: Added.
+ (KJS::JSCallbackFunction::classInfo):
+ * API/JSCallbackObject.cpp:
+ (KJS::):
+ (KJS::JSCallbackObject::JSCallbackObject):
+ (KJS::JSCallbackObject::init):
+ (KJS::JSCallbackObject::~JSCallbackObject):
+ (KJS::JSCallbackObject::className):
+ (KJS::JSCallbackObject::getOwnPropertySlot):
+ (KJS::JSCallbackObject::put):
+ (KJS::JSCallbackObject::deleteProperty):
+ (KJS::JSCallbackObject::implementsConstruct):
+ (KJS::JSCallbackObject::construct):
+ (KJS::JSCallbackObject::implementsCall):
+ (KJS::JSCallbackObject::callAsFunction):
+ (KJS::JSCallbackObject::getPropertyList):
+ (KJS::JSCallbackObject::toBoolean):
+ (KJS::JSCallbackObject::toNumber):
+ (KJS::JSCallbackObject::toString):
+ (KJS::JSCallbackObject::inherits):
+ (KJS::JSCallbackObject::staticValueGetter):
+ (KJS::JSCallbackObject::staticFunctionGetter):
+ (KJS::JSCallbackObject::callbackGetter):
+ * API/JSCallbackObject.h:
+ * API/JSCharBufferRef.cpp:
+ * API/JSClassRef.cpp: Added.
+ (JSClassCreate):
+ (JSClassRetain):
+ (JSClassRelease):
+ * API/JSClassRef.h: Added.
+ (StaticValueEntry::StaticValueEntry):
+ (StaticFunctionEntry::StaticFunctionEntry):
+ (__JSClass::__JSClass):
+ * API/JSContextRef.cpp:
+ (JSContextCreate):
+ (JSEvaluate):
+ * API/JSContextRef.h:
+ * API/JSNode.c: Added.
+ (JSNodePrototype_appendChild):
+ (JSNodePrototype_removeChild):
+ (JSNodePrototype_replaceChild):
+ (JSNodePrototype_class):
+ (JSNode_getNodeType):
+ (JSNode_getChildNodes):
+ (JSNode_getFirstChild):
+ (JSNode_finalize):
+ (JSNode_class):
+ (JSNode_prototype):
+ (JSNode_new):
+ (JSNode_construct):
+ * API/JSNode.h: Added.
+ * API/JSNodeList.c: Added.
+ (JSNodeListPrototype_item):
+ (JSNodeListPrototype_class):
+ (JSNodeList_length):
+ (JSNodeList_getProperty):
+ (JSNodeList_finalize):
+ (JSNodeList_class):
+ (JSNodeList_prototype):
+ (JSNodeList_new):
+ * API/JSNodeList.h: Added.
+ * API/JSObjectRef.cpp:
+ (JSObjectMake):
+ (JSFunctionMake):
+ (JSConstructorMake):
+ (__JSPropertyEnumerator::__JSPropertyEnumerator):
+ (JSObjectCreatePropertyEnumerator):
+ (JSPropertyEnumeratorGetNext):
+ (JSPropertyEnumeratorRetain):
+ (JSPropertyEnumeratorRelease):
+ * API/JSObjectRef.h:
+ (__JSObjectCallbacks::):
+ * API/JSValueRef.cpp:
+ (JSValueIsObjectOfClass):
+ (JSValueIsInstanceOf):
+ * API/JSValueRef.h:
+ * API/Node.c: Added.
+ (Node_new):
+ (Node_appendChild):
+ (Node_removeChild):
+ (Node_replaceChild):
+ (Node_ref):
+ (Node_deref):
+ * API/Node.h: Added.
+ * API/NodeList.c: Added.
+ (NodeList_new):
+ (NodeList_length):
+ (NodeList_item):
+ (NodeList_ref):
+ (NodeList_deref):
+ * API/NodeList.h: Added.
+ * API/minidom.c:
+ (main):
+ (print):
+ (createStringWithContentsOfFile):
+ * API/minidom.js:
+ * API/testapi.c:
+ (assertEqualsAsCharacters):
+ (MyObject_getProperty):
+ (MyObject_class):
+ (myConstructor_callAsConstructor):
+ (main):
+ * API/testapi.js:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2006-06-26 Kevin Ollivier <kevino@theolliviers.com>
+
+ Reviewed and tweaked by Darin.
+
+ - Compile fixes for wx port / gcc 4.0.2
+
+ * kjs/array_object.cpp:
+ Added missing headers.
+
+ * kjs/ExecState.h:
+ gcc needs class prototypes before defining those classes as friend classes
+
+2006-06-30 Mike Emmel <mike.emmel@gmail.com>
+
+ Reviewed by Darin.
+
+ Compilation fixes for Linux/Gdk.
+
+ * JavaScriptCore/kjs/interpreter.cpp: added include of signal.h
+ * JavaScriptCore/kjs/ExecState.h: added missing class declaration
+ * JavaScriptCore/kjs/ExecState.cpp: case wrong on include of context.h
+ * JavaScriptCore/JavaScriptCoreSources.bkl: added Context.cpp and ExecState.cpp
+
+=== Safari-521.14 ===
+
+2006-06-29 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Geoff.
+
+ - add headerdoc comments to some of the new JS API headers
+
+ * API/JSBase.h:
+ * API/JSValueRef.h:
+
+2006-06-28 Timothy Hatcher <timothy@apple.com>
+
+ Prefer the Stabs debugging symbols format until DWARF bugs are fixed.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2006-06-27 Timothy Hatcher <timothy@apple.com>
+
+ Reviewed by Tim O.
+
+ <rdar://problem/4448350> Deprecated ObjC language API used in JavaScriptCore, WebCore, WebKit and WebBrowser
+
+ Switch to the new ObjC 2 API, ifdefed the old code around OBJC_API_VERSION so it still works on Tiger.
+ Removed the use of the old stringWithCString, switched to the new Tiger version that accepts an encoding.
+ Lots of code style cleanup.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * bindings/objc/objc_class.h:
+ * bindings/objc/objc_class.mm:
+ (KJS::Bindings::ObjcClass::~ObjcClass):
+ (KJS::Bindings::_createClassesByIsAIfNecessary):
+ (KJS::Bindings::ObjcClass::classForIsA):
+ (KJS::Bindings::ObjcClass::name):
+ (KJS::Bindings::ObjcClass::methodsNamed):
+ (KJS::Bindings::ObjcClass::fieldNamed):
+ (KJS::Bindings::ObjcClass::fallbackObject):
+ * bindings/objc/objc_header.h:
+ * bindings/objc/objc_instance.h:
+ * bindings/objc/objc_instance.mm:
+ (ObjcInstance::ObjcInstance):
+ (ObjcInstance::~ObjcInstance):
+ (ObjcInstance::operator=):
+ (ObjcInstance::begin):
+ (ObjcInstance::end):
+ (ObjcInstance::getClass):
+ (ObjcInstance::invokeMethod):
+ (ObjcInstance::invokeDefaultMethod):
+ (ObjcInstance::setValueOfField):
+ (ObjcInstance::supportsSetValueOfUndefinedField):
+ (ObjcInstance::setValueOfUndefinedField):
+ (ObjcInstance::getValueOfField):
+ (ObjcInstance::getValueOfUndefinedField):
+ (ObjcInstance::defaultValue):
+ (ObjcInstance::stringValue):
+ (ObjcInstance::numberValue):
+ (ObjcInstance::booleanValue):
+ (ObjcInstance::valueOf):
+ * bindings/objc/objc_runtime.h:
+ * bindings/objc/objc_runtime.mm:
+ (ObjcMethod::ObjcMethod):
+ (ObjcMethod::name):
+ (ObjcMethod::getMethodSignature):
+ (ObjcMethod::setJavaScriptName):
+ (ObjcField::name):
+ (ObjcField::type):
+ (ObjcField::valueFromInstance):
+ (convertValueToObjcObject):
+ (ObjcField::setValueToInstance):
+ (ObjcArray::operator=):
+ (ObjcArray::setValueAt):
+ (ObjcArray::valueAt):
+ (ObjcFallbackObjectImp::ObjcFallbackObjectImp):
+ (ObjcFallbackObjectImp::callAsFunction):
+ (ObjcFallbackObjectImp::defaultValue):
+
+2006-06-28 Anders Carlsson <acarlsson@apple.com>
+
+ Reviewed by Geoff.
+
+ http://bugs.webkit.org/show_bug.cgi?id=8636
+ REGRESSION: JavaScript access to Java applet causes hang (_webViewURL not implemented)
+
+ * bindings/jni/jni_objc.mm:
+ (KJS::Bindings::dispatchJNICall):
+ Just pass nil as the calling URL. This will cause the Java plugin to use the URL of the page
+ containing the applet (which is what we used to do).
+
+2006-06-27 Timothy Hatcher <timothy@apple.com>
+
+ Reviewed by Darin.
+
+ <rdar://problem/4406785> Add an export file to TOT JavaScriptCore like the Safari-2-0-branch
+
+ * JavaScriptCore.exp: Added.
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2006-06-25 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Adele.
+
+ - Added JSConstructorMake to match JSFunctionMake, along with test code.
+
+ [ I checked in the ChangeLog before without the actual files. ]
+
+ * API/JSObjectRef.cpp:
+ (JSConstructorMake):
+ * API/JSObjectRef.h:
+ * API/testapi.c:
+ (myConstructor_callAsConstructor):
+ (main):
+ * API/testapi.js:
+ * ChangeLog:
+ * JavaScriptCore.xcodeproj/project.pbxproj: Moved testapi.c to the testapi
+ target -- this was an oversight in my earlier check-in.
+
+2006-06-25 Timothy Hatcher <timothy@apple.com>
+
+ Reviewed by Darin.
+
+ Bug 9574: Drosera should show inline scripts within the original HTML
+ http://bugs.webkit.org/show_bug.cgi?id=9574
+
+ Pass the starting line number and error message to the debugger.
+
+ * kjs/debugger.cpp:
+ (Debugger::sourceParsed):
+ * kjs/debugger.h:
+ * kjs/function.cpp:
+ (KJS::GlobalFuncImp::callAsFunction):
+ * kjs/function_object.cpp:
+ (FunctionObjectImp::construct):
+ * kjs/interpreter.cpp:
+ (KJS::Interpreter::evaluate):
+
+2006-06-24 Alexey Proskuryakov <ap@nypop.com>
+
+ Rubber-stamped by Eric.
+
+ Add a -h (do not follow symlinks) option to ln in derived sources build script (without it,
+ a symlink was created inside the source directory on second build).
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2006-06-24 David Kilzer <ddkilzer@kilzer.net>
+
+ Reviewed by Timothy.
+
+ * Info.plist: Fixed copyright to include 2003-2006.
+
+2006-06-24 Alexey Proskuryakov <ap@nypop.com>
+
+ Reviewed by Darin.
+
+ - http://bugs.webkit.org/show_bug.cgi?id=9418
+ WebKit will not build when Space exists in path
+
+ * JavaScriptCore.xcodeproj/project.pbxproj: Enclose search paths in quotes; create symlinks to
+ avoid passing paths with spaces to make.
+
+2006-06-23 Timothy Hatcher <timothy@apple.com>
+
+ Reviewed by Darin.
+
+ Adding more operator[] overloads for long and short types.
+
+ * wtf/Vector.h:
+ (WTF::Vector::operator[]):
+
+=== JavaScriptCore-521.13 ===
+
+2006-06-22 Alexey Proskuryakov <ap@nypop.com>
+
+ Build fix.
+
+ - http://bugs.webkit.org/show_bug.cgi?id=9539
+ Another case error preventing build
+
+ * API/JSObjectRef.cpp: Changed "identifier.h" to "Identifier.h"
+
+2006-06-22 David Kilzer <ddkilzer@kilzer.net>
+
+ Build fix.
+
+ http://bugs.webkit.org/show_bug.cgi?id=9539
+ Another case error preventing build
+
+ * API/APICast.h: Changed "UString.h" to "ustring.h".
+
+2006-06-21 Geoffrey Garen <ggaren@apple.com>
+
+ Fixed release build, fixed accidental infinite recursion due to
+ last minute global replace gone awry.
+
+ * API/APICast.h:
+ (toRef):
+ * API/testapi.c:
+ (assertEqualsAsBoolean):
+ (assertEqualsAsNumber):
+ (assertEqualsAsUTF8String):
+ (assertEqualsAsCharactersPtr):
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2006-06-21 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Anders.
+
+ - First cut at C API to JavaScript. Includes a unit test, 'testapi.c',
+ and the outline of a test app, 'minidom.c'.
+
+ Includes one change to JSC internals: Rename propList to getPropertyList and have it
+ take its target property list by reference so that subclasses can
+ add properties to the list before calling through to their superclasses.
+
+ Also, I just ran prepare-ChangeLog in about 10 seconds, and I would like
+ to give a shout-out to that.
+
+ * API/APICast.h: Added.
+ (toJS):
+ (toRef):
+ * API/JSBase.h: Added.
+ * API/JSCallbackObject.cpp: Added.
+ (KJS::):
+ (KJS::JSCallbackObject::JSCallbackObject):
+ (KJS::JSCallbackObject::~JSCallbackObject):
+ (KJS::JSCallbackObject::className):
+ (KJS::JSCallbackObject::getOwnPropertySlot):
+ (KJS::JSCallbackObject::put):
+ (KJS::JSCallbackObject::deleteProperty):
+ (KJS::JSCallbackObject::implementsConstruct):
+ (KJS::JSCallbackObject::construct):
+ (KJS::JSCallbackObject::implementsCall):
+ (KJS::JSCallbackObject::callAsFunction):
+ (KJS::JSCallbackObject::getPropertyList):
+ (KJS::JSCallbackObject::toBoolean):
+ (KJS::JSCallbackObject::toNumber):
+ (KJS::JSCallbackObject::toString):
+ (KJS::JSCallbackObject::setPrivate):
+ (KJS::JSCallbackObject::getPrivate):
+ (KJS::JSCallbackObject::cachedValueGetter):
+ (KJS::JSCallbackObject::callbackGetter):
+ * API/JSCallbackObject.h: Added.
+ (KJS::JSCallbackObject::classInfo):
+ * API/JSCharBufferRef.cpp: Added.
+ (JSStringMake):
+ (JSCharBufferCreate):
+ (JSCharBufferCreateUTF8):
+ (JSCharBufferRetain):
+ (JSCharBufferRelease):
+ (JSValueCopyStringValue):
+ (JSCharBufferGetLength):
+ (JSCharBufferGetCharactersPtr):
+ (JSCharBufferGetCharacters):
+ (JSCharBufferGetMaxLengthUTF8):
+ (JSCharBufferGetCharactersUTF8):
+ (JSCharBufferIsEqual):
+ (JSCharBufferIsEqualUTF8):
+ (JSCharBufferCreateWithCFString):
+ (CFStringCreateWithJSCharBuffer):
+ * API/JSCharBufferRef.h: Added.
+ * API/JSContextRef.cpp: Added.
+ (JSContextCreate):
+ (JSContextDestroy):
+ (JSContextGetGlobalObject):
+ (JSEvaluate):
+ (JSCheckSyntax):
+ (JSContextHasException):
+ (JSContextGetException):
+ (JSContextClearException):
+ (JSContextSetException):
+ * API/JSContextRef.h: Added.
+ * API/JSObjectRef.cpp: Added.
+ (JSValueToObject):
+ (JSObjectMake):
+ (JSFunctionMake):
+ (JSObjectGetDescription):
+ (JSObjectGetPrototype):
+ (JSObjectSetPrototype):
+ (JSObjectHasProperty):
+ (JSObjectGetProperty):
+ (JSObjectSetProperty):
+ (JSObjectDeleteProperty):
+ (JSObjectGetPrivate):
+ (JSObjectSetPrivate):
+ (JSObjectIsFunction):
+ (JSObjectCallAsFunction):
+ (JSObjectIsConstructor):
+ (JSObjectCallAsConstructor):
+ (__JSPropertyListEnumerator::__JSPropertyListEnumerator):
+ (JSObjectCreatePropertyEnumerator):
+ (JSPropertyEnumeratorGetNext):
+ (JSPropertyEnumeratorRetain):
+ (JSPropertyEnumeratorRelease):
+ (JSPropertyListAdd):
+ * API/JSObjectRef.h: Added.
+ * API/JSValueRef.cpp: Added.
+ (JSValueGetType):
+ (JSValueIsUndefined):
+ (JSValueIsNull):
+ (JSValueIsBoolean):
+ (JSValueIsNumber):
+ (JSValueIsString):
+ (JSValueIsObject):
+ (JSValueIsEqual):
+ (JSValueIsStrictEqual):
+ (JSUndefinedMake):
+ (JSNullMake):
+ (JSBooleanMake):
+ (JSNumberMake):
+ (JSValueToBoolean):
+ (JSValueToNumber):
+ (JSGCProtect):
+ (JSGCUnprotect):
+ (JSGCCollect):
+ * API/JSValueRef.h: Added.
+ * API/JavaScriptCore.h: Added.
+ * API/minidom.c: Added.
+ (main):
+ * API/minidom.html: Added.
+ * API/minidom.js: Added.
+ * API/testapi.c: Added.
+ (assertEqualsAsBoolean):
+ (assertEqualsAsNumber):
+ (assertEqualsAsUTF8String):
+ (assertEqualsAsCharactersPtr):
+ (assertEqualsAsCharacters):
+ (MyObject_initialize):
+ (MyObject_copyDescription):
+ (MyObject_hasProperty):
+ (MyObject_getProperty):
+ (MyObject_setProperty):
+ (MyObject_deleteProperty):
+ (MyObject_getPropertyList):
+ (MyObject_callAsFunction):
+ (MyObject_callAsConstructor):
+ (MyObject_convertToType):
+ (MyObject_finalize):
+ (print_callAsFunction):
+ (main):
+ (createStringWithContentsOfFile):
+ * API/testapi.js: Added.
+ * ChangeLog:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * bindings/npruntime_impl.h:
+ * kjs/array_instance.h:
+ * kjs/array_object.cpp:
+ (ArrayInstance::getPropertyList):
+ * kjs/interpreter.cpp:
+ (KJS::Interpreter::evaluate):
+ * kjs/nodes.cpp:
+ (ForInNode::execute):
+ * kjs/object.cpp:
+ (KJS::JSObject::put):
+ (KJS::JSObject::canPut):
+ (KJS::JSObject::deleteProperty):
+ (KJS::JSObject::propertyIsEnumerable):
+ (KJS::JSObject::getPropertyAttributes):
+ (KJS::JSObject::getPropertyList):
+ * kjs/object.h:
+ * kjs/property_map.cpp:
+ (KJS::PropertyMap::get):
+ * kjs/property_map.h:
+ * kjs/scope_chain.cpp:
+ (KJS::ScopeChain::print):
+ * kjs/string_object.cpp:
+ (StringInstance::getPropertyList):
+ * kjs/string_object.h:
+ * kjs/ustring.h:
+ (KJS::UString::Rep::ref):
+
+2006-06-20 Timothy Hatcher <timothy@apple.com>
+
+ Reviewed by Geoff.
+
+ Make sure we clear the exception before returning so
+ that future calls will not fail because of an earlier
+ exception state. Assert on entry that the WebScriptObject
+ is working with an ExecState that dose not have an exception.
+ Document that evaluateWebScript and callWebScriptMethod return
+ WebUndefined when an exception is thrown.
+
+ * bindings/objc/WebScriptObject.h:
+ * bindings/objc/WebScriptObject.mm:
+ (-[WebScriptObject callWebScriptMethod:withArguments:]):
+ (-[WebScriptObject evaluateWebScript:]):
+ (-[WebScriptObject setValue:forKey:]):
+ (-[WebScriptObject valueForKey:]):
+ (-[WebScriptObject removeWebScriptKey:]):
+ (-[WebScriptObject webScriptValueAtIndex:]):
+ (-[WebScriptObject setWebScriptValueAtIndex:value:]):
+
+2006-06-19 Anders Carlsson <acarlsson@apple.com>
+
+ Reviewed by John.
+
+ * kjs/interpreter.cpp:
+ (KJS::TimeoutChecker::pauseTimeoutCheck):
+ (KJS::TimeoutChecker::resumeTimeoutCheck):
+ Fix argument order in setitimer calls.
+
+2006-06-18 Anders Carlsson <acarlsson@apple.com>
+
+ Reviewed by Geoff.
+
+ * kjs/interpreter.cpp:
+ (KJS::TimeoutChecker::pauseTimeoutCheck):
+ Do nothing if the timeout check hasn't been started.
+
+ (KJS::TimeoutChecker::resumeTimeoutCheck):
+ Do nothing if the timeout check hasn't been started.
+ Use the right signal handler when unblocking.
+
+ (KJS::Interpreter::handleTimeout):
+ pause/resume the timeout check around the call to
+ shouldInterruptScript().
+
+2006-06-16 Ben Goodger <beng@google.com>
+
+ Reviewed by Maciej
+
+ http://bugs.webkit.org/show_bug.cgi?id=9491
+ Windows build breaks in interpreter.cpp
+
+ * kjs/interpreter.cpp
+ (KJS::TimeoutChecker::pauseTimeoutCheck):
+ (KJS::TimeoutChecker::resumeTimeoutCheck):
+ Make sure to only assert equality with s_executingInterpreter when it
+ is being used (i.e. when HAVE(SYS_TIME_H) == true)
+
+2006-06-17 David Kilzer <ddkilzer@kilzer.net>
+
+ Reviewed by darin.
+
+ http://bugs.webkit.org/show_bug.cgi?id=9477
+ REGRESSION: fast/dom/replaceChild.html crashes on WebKit ToT in debug build
+
+ * kjs/function.cpp:
+ (KJS::FunctionImp::callAsFunction): Refetch the debugger after executing the function
+ in case the WebFrame it was running in has since been destroyed.
+
+2006-06-17 David Kilzer <ddkilzer@kilzer.net>
+
+ Reviewed by ggaren.
+
+ http://bugs.webkit.org/show_bug.cgi?id=9476
+ REGRESSION: Reproducible crash after closing window after viewing
+ css2.1/t0803-c5501-imrgn-t-00-b-ag.html
+
+ * kjs/debugger.cpp:
+ (Debugger::detach): Call setDebugger(0) for all interpreters removed from
+ the 'attached to a debugger' list.
+
+2006-06-17 Anders Carlsson <acarlsson@apple.com>
+
+ Reviewed by Maciej and Geoff.
+
+ http://bugs.webkit.org/show_bug.cgi?id=7080
+ Provide some way to stop a JavaScript infinite loop
+
+ * kjs/completion.h:
+ (KJS::):
+ Add Interrupted completion type.
+
+ * kjs/function.cpp:
+ (KJS::FunctionImp::callAsFunction):
+ (KJS::GlobalFuncImp::callAsFunction):
+ Only set the exception on the new ExecState if the current one has had one.
+
+ * kjs/interpreter.cpp:
+ (KJS::TimeoutChecker::startTimeoutCheck):
+ (KJS::TimeoutChecker::stopTimeoutCheck):
+ (KJS::TimeoutChecker::alarmHandler):
+ (KJS::TimeoutChecker::pauseTimeoutCheck):
+ (KJS::TimeoutChecker::resumeTimeoutCheck):
+ New TimeoutChecker class which handles setting Interpreter::m_timedOut flag after a given
+ period of time. This currently only works on Unix platforms where setitimer and signals are used.
+
+ (KJS::Interpreter::Interpreter):
+ Initialize new member variables.
+
+ (KJS::Interpreter::~Interpreter):
+ Destroy the timeout checker.
+
+ (KJS::Interpreter::startTimeoutCheck):
+ (KJS::Interpreter::stopTimeoutCheck):
+ (KJS::Interpreter::pauseTimeoutCheck):
+ (KJS::Interpreter::resumeTimeoutCheck):
+ Call the timeout checker.
+
+ (KJS::Interpreter::handleTimeout):
+ Called on timeout. Resets the m_timedOut flag and calls shouldInterruptScript.
+
+ * kjs/interpreter.h:
+ (KJS::Interpreter::setTimeoutTime):
+ New function for setting the timeout time.
+
+ (KJS::Interpreter::shouldInterruptScript):
+ New function. The idea is that this should be overridden by subclasses in order to for example
+ pop up a dialog asking the user if the script should be interrupted.
+
+ (KJS::Interpreter::checkTimeout):
+ New function which checks the m_timedOut flag and calls handleTimeout if it's set.
+
+ * kjs/nodes.cpp:
+ (DoWhileNode::execute):
+ (WhileNode::execute):
+ (ForNode::execute):
+ Call Interpreter::checkTimeout after each iteration of the loop.
+
+2006-06-15 Timothy Hatcher <timothy@apple.com>
+
+ Reviewed by Geoff and Darin.
+
+ Prefer the DWARF debugging symbols format for use in Xcode 2.3.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2006-06-14 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Beth.
+
+ - fixed http://bugs.webkit.org/show_bug.cgi?id=9438
+ Someone broke ToT: cannot build
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * bindings/runtime_root.h: Changed "Interpreter.h" to "interpreter.h"
+
+2006-06-12 Geoffrey Garen <ggaren@apple.com>
+
+ build fix
+
+ * bindings/objc/WebScriptObject.mm:
+ (+[WebScriptObject throwException:]): Restore assignment I accidentally
+ deleted in previous commit
+
+2006-06-12 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by TimO, Maciej.
+
+ - Merged InterpreterImp code into Interpreter, which implements
+ all interpreter functionality now. This is part of my continuing quest
+ to create an external notion of JS "execution context" that is unified and simple --
+ something to replace the mix of Context, ContextImp, ExecState, Interpreter,
+ InterpreterImp, and JSRun.
+
+ All tests pass. Leaks test has not regressed from its baseline ~207 leaks
+ with ~3460 leaked nodes.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * bindings/NP_jsobject.cpp:
+ * bindings/objc/WebScriptObject.mm:
+ (+[WebScriptObject throwException:]):
+ * bindings/runtime_root.cpp:
+ * bindings/runtime_root.h:
+ * kjs/Context.cpp:
+ (KJS::Context::Context):
+ * kjs/ExecState.cpp: Added.
+ (KJS::ExecState::lexicalInterpreter):
+ * kjs/ExecState.h: Added.
+ (KJS::ExecState::dynamicInterpreter):
+ * kjs/SavedBuiltins.h: Added.
+ * kjs/bool_object.cpp:
+ (BooleanPrototype::BooleanPrototype):
+ * kjs/collector.cpp:
+ (KJS::Collector::collect):
+ (KJS::Collector::numInterpreters):
+ * kjs/context.h:
+ * kjs/debugger.cpp:
+ (Debugger::attach):
+ (Debugger::detach):
+ * kjs/function.cpp:
+ (KJS::FunctionImp::callAsFunction):
+ (KJS::GlobalFuncImp::callAsFunction):
+ * kjs/function_object.cpp:
+ (FunctionObjectImp::construct):
+ * kjs/internal.cpp:
+ * kjs/internal.h:
+ * kjs/interpreter.cpp:
+ (KJS::interpreterMap):
+ (KJS::Interpreter::Interpreter):
+ (KJS::Interpreter::init):
+ (KJS::Interpreter::~Interpreter):
+ (KJS::Interpreter::globalObject):
+ (KJS::Interpreter::initGlobalObject):
+ (KJS::Interpreter::globalExec):
+ (KJS::Interpreter::checkSyntax):
+ (KJS::Interpreter::evaluate):
+ (KJS::Interpreter::builtinObject):
+ (KJS::Interpreter::builtinFunction):
+ (KJS::Interpreter::builtinArray):
+ (KJS::Interpreter::builtinBoolean):
+ (KJS::Interpreter::builtinString):
+ (KJS::Interpreter::builtinNumber):
+ (KJS::Interpreter::builtinDate):
+ (KJS::Interpreter::builtinRegExp):
+ (KJS::Interpreter::builtinError):
+ (KJS::Interpreter::builtinObjectPrototype):
+ (KJS::Interpreter::builtinFunctionPrototype):
+ (KJS::Interpreter::builtinArrayPrototype):
+ (KJS::Interpreter::builtinBooleanPrototype):
+ (KJS::Interpreter::builtinStringPrototype):
+ (KJS::Interpreter::builtinNumberPrototype):
+ (KJS::Interpreter::builtinDatePrototype):
+ (KJS::Interpreter::builtinRegExpPrototype):
+ (KJS::Interpreter::builtinErrorPrototype):
+ (KJS::Interpreter::builtinEvalError):
+ (KJS::Interpreter::builtinRangeError):
+ (KJS::Interpreter::builtinReferenceError):
+ (KJS::Interpreter::builtinSyntaxError):
+ (KJS::Interpreter::builtinTypeError):
+ (KJS::Interpreter::builtinURIError):
+ (KJS::Interpreter::builtinEvalErrorPrototype):
+ (KJS::Interpreter::builtinRangeErrorPrototype):
+ (KJS::Interpreter::builtinReferenceErrorPrototype):
+ (KJS::Interpreter::builtinSyntaxErrorPrototype):
+ (KJS::Interpreter::builtinTypeErrorPrototype):
+ (KJS::Interpreter::builtinURIErrorPrototype):
+ (KJS::Interpreter::mark):
+ (KJS::Interpreter::interpreterWithGlobalObject):
+ (KJS::Interpreter::saveBuiltins):
+ (KJS::Interpreter::restoreBuiltins):
+ * kjs/interpreter.h:
+ (KJS::Interpreter::setCompatMode):
+ (KJS::Interpreter::compatMode):
+ (KJS::Interpreter::firstInterpreter):
+ (KJS::Interpreter::nextInterpreter):
+ (KJS::Interpreter::prevInterpreter):
+ (KJS::Interpreter::debugger):
+ (KJS::Interpreter::setDebugger):
+ (KJS::Interpreter::setContext):
+ (KJS::Interpreter::context):
+ * kjs/nodes.cpp:
+ (StatementNode::hitStatement):
+ (RegExpNode::evaluate):
+ * kjs/protect.h:
+
+2006-06-12 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej.
+
+ - Have *.lut.h files #include lookup.h to eliminate surprising header
+ include order dependency.
+
+ * DerivedSources.make:
+ * kjs/array_object.cpp:
+ * kjs/date_object.cpp:
+ * kjs/date_object.h:
+ (KJS::DateProtoFunc::):
+ * kjs/lexer.cpp:
+ * kjs/math_object.cpp:
+ * kjs/number_object.cpp:
+ * kjs/regexp_object.cpp:
+ * kjs/string_object.cpp:
+
+2006-06-10 Geoffrey Garen <ggaren@apple.com>
+
+ - http://bugs.webkit.org/show_bug.cgi?id=8515
+ Linux porting compile bug
+
+ Fix by Mike Emmel, Reviewed by Darin.
+
+ * JavaScriptCoreSources.bkl:
+ * jscore.bkl:
+ * wtf/Platform.h:
+
+2006-06-09 Geoffrey Garen <ggaren@apple.com>
+
+ Build fix -- I think :).
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * kjs/context.h:
+
+2006-06-09 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Eric (yay!).
+
+ - Removed Context wrapper for ContextImp, renamed ContextImp to Context,
+ split Context into its own file -- Context.cpp -- renamed _var to m_var,
+ change ' *' to '* '.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * kjs/Context.cpp: Added.
+ (KJS::Context::Context):
+ (KJS::Context::~Context):
+ (KJS::Context::mark):
+ * kjs/context.h:
+ (KJS::Context::scopeChain):
+ (KJS::Context::variableObject):
+ (KJS::Context::setVariableObject):
+ (KJS::Context::thisValue):
+ (KJS::Context::callingContext):
+ (KJS::Context::activationObject):
+ (KJS::Context::currentBody):
+ (KJS::Context::function):
+ (KJS::Context::arguments):
+ (KJS::Context::pushScope):
+ (KJS::Context::seenLabels):
+ * kjs/function.cpp:
+ (KJS::FunctionImp::callAsFunction):
+ (KJS::FunctionImp::processParameters):
+ (KJS::FunctionImp::argumentsGetter):
+ (KJS::GlobalFuncImp::callAsFunction):
+ * kjs/internal.cpp:
+ (KJS::InterpreterImp::evaluate):
+ * kjs/internal.h:
+ (KJS::InterpreterImp::setContext):
+ (KJS::InterpreterImp::context):
+ * kjs/interpreter.cpp:
+ * kjs/interpreter.h:
+ (KJS::ExecState::context):
+ (KJS::ExecState::ExecState):
+ * kjs/nodes.cpp:
+ (currentSourceId):
+ (currentSourceURL):
+ (ThisNode::evaluate):
+ (ResolveNode::evaluate):
+ (FunctionCallResolveNode::evaluate):
+ (PostfixResolveNode::evaluate):
+ (DeleteResolveNode::evaluate):
+ (TypeOfResolveNode::evaluate):
+ (PrefixResolveNode::evaluate):
+ (AssignResolveNode::evaluate):
+ (VarDeclNode::evaluate):
+ (VarDeclNode::processVarDecls):
+ (DoWhileNode::execute):
+ (WhileNode::execute):
+ (ForNode::execute):
+ (ForInNode::execute):
+ (ContinueNode::execute):
+ (BreakNode::execute):
+ (ReturnNode::execute):
+ (WithNode::execute):
+ (SwitchNode::execute):
+ (LabelNode::execute):
+ (TryNode::execute):
+ (FuncDeclNode::processFuncDecl):
+ (FuncExprNode::evaluate):
+
+2006-06-07 Geoffrey Garen <ggaren@apple.com>
+
+ Removed API directory I prematurely/accidentally added.
+
+ * API: Removed.
+
+2006-06-05 Mitz Pettel <opendarwin.org@mitzpettel.com>
+
+ Reviewed and landed by Geoff.
+
+ - fix a regression in ecma_3/String/regress-104375.js
+
+ * kjs/string_object.cpp:
+ (substituteBackreferences): If a 2-digit back reference is out of range,
+ parse it as a 1-digit reference (followed by the other digit). This matches
+ Firefox's behavior.
+
+2006-06-05 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed By Maciej.
+ Darin already reviewed this change on the branch. See <rdar://problem/4317701>.
+
+ - Fixed <rdar://problem/4291345> PCRE overflow in Safari JavaScriptCore
+
+ No test case because there's no behavior change.
+
+ * pcre/pcre_compile.c:
+ (read_repeat_counts): Check for integer overflow / out of bounds
+
+2006-06-05 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by aliu.
+
+ - Changed CString length from int to size_t. We sould probably do this
+ for UString, too. (Darin, if you're reading this: Maciej said so.)
+
+ * kjs/function.cpp:
+ (KJS::encode):
+ * kjs/ustring.cpp:
+ (KJS::CString::CString):
+ (KJS::operator==):
+ * kjs/ustring.h:
+ (KJS::CString::size):
+
+2006-06-04 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej.
+
+ - http://bugs.webkit.org/show_bug.cgi?id=9304
+ Minor cleanup in JavaScriptCore
+
+ * kjs/value.h: Removed redundant declarations
+
+2006-06-04 Darin Adler <darin@apple.com>
+
+ Reviewed by Anders.
+
+ - changed deleteAllValues so it can work on "const" collections
+ Deleting the values affects the values, not the pointers in the
+ collection, so it's legitimate to do it to a const collection,
+ and a case of that actually came up in the XPath code.
+
+ * wtf/HashMap.h:
+ (WTF::deleteAllPairSeconds): Use const iterators.
+ (WTF::deleteAllValues): Take const HashMap reference as a parameter.
+ * wtf/HashSet.h:
+ (WTF::deleteAllValues): Take const HashSet reference as a parameter,
+ and use const iterators.
+ * wtf/Vector.h:
+ (WTF::deleteAllValues): Take const Vector reference as a parameter.
+
+ - added more functions that are present in <math.h> on some platforms,
+ but not on others; moved here from various files in WebCore
+
+ * wtf/MathExtras.h:
+ (isinf): Added.
+ (isnan): Added.
+ (lround): Added.
+ (lroundf): Tweaked.
+ (round): Added.
+ (roundf): Tweaked.
+ (signbit): Added.
+
+2006-06-02 Mitz Pettel <opendarwin.org@mitzpettel.com>
+
+ Reviewed by ggaren.
+
+ - http://bugs.webkit.org/show_bug.cgi?id=9234
+ Implement $&, $' and $` replacement codes in String.prototype.replace
+
+ Test: fast/js/string-replace-3.html
+
+ * kjs/string_object.cpp:
+ (substituteBackreferences): Added support for $& (matched substring),
+ $` (everything preceding matched substring), $' (everything following
+ matched substring) and 2-digit back references, and cleaned up a little.
+
+2006-06-02 Adele Peterson <adele@apple.com>
+
+ Reviewed by Darin.
+
+ Set incremental linking to no. This seems to fix a build problem I was seeing
+ where dftables couldn't find a dll.
+
+ * JavaScriptCore.vcproj/dftables/dftables.vcproj:
+
+2006-05-26 Steve Falkenburg <sfalken@apple.com>
+
+ Build fixes/tweaks
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+
+=== JavaScriptCore-521.11 ===
+
+2006-05-24 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by mjs.
+
+ - JSC half of fix for <rdar://problem/4557926> TOT REGRESSSION: Crash
+ occurs when attempting to view image in slideshow mode at
+ http://d.smugmug.com/gallery/581716 ( KJS::IfNode::execute
+ (KJS::ExecState*) + 312)
+
+ On alternate threads, DOMObjects remain in the
+ ScriptInterpreter's cache because they're not collected. So, they
+ need an opportunity to mark their children.
+
+ I'm not particularly happy with this solution because it fails to
+ resolve many outstanding issues with the DOM object cache. Since none
+ of those issues is a crasher or a serious compatibility concern,
+ and since the behavior of other browsers is not much to go on in this
+ case, I've filed <rdar://problem/4561439> about that, and I'm moving on
+ with my life.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * kjs/collector.cpp:
+ (KJS::Collector::collect):
+ * kjs/internal.cpp:
+ (KJS::InterpreterImp::mark):
+ * kjs/internal.h:
+ * kjs/interpreter.cpp:
+ (KJS::Interpreter::mark):
+ * kjs/interpreter.h:
+
+=== JavaScriptCore-521.10 ===
+
+2006-05-22 Timothy Hatcher <timothy@apple.com>
+
+ Reviewed by Eric, Kevin and Geoff.
+
+ Merge open source build fixes. <rdar://problem/4555500>
+
+ * kjs/collector.cpp: look at the rsp register in x86_64
+ (KJS::Collector::markOtherThreadConservatively):
+ * wtf/Platform.h: add x86_64 to the platform list
+
+2006-05-19 Anders Carlsson <acarlsson@apple.com>
+
+ Reviewed by Geoff.
+
+ http://bugs.webkit.org/show_bug.cgi?id=8993
+ Support function declaration in case statements
+
+ * kjs/grammar.y: Get rid of StatementList and use SourceElements instead.
+
+ * kjs/nodes.cpp:
+ (CaseClauseNode::evalStatements):
+ (CaseClauseNode::processVarDecls):
+ (CaseClauseNode::processFuncDecl):
+ (ClauseListNode::processFuncDecl):
+ (CaseBlockNode::processFuncDecl):
+ (SwitchNode::processFuncDecl):
+ * kjs/nodes.h:
+ (KJS::CaseClauseNode::CaseClauseNode):
+ (KJS::ClauseListNode::ClauseListNode):
+ (KJS::ClauseListNode::getClause):
+ (KJS::ClauseListNode::getNext):
+ (KJS::ClauseListNode::releaseNext):
+ (KJS::SwitchNode::SwitchNode):
+ Add processFuncDecl for the relevant nodes.
+
+ * kjs/nodes2string.cpp:
+ (CaseClauseNode::streamTo):
+ next got renamed to source.
+
+2006-05-17 George Staikos <staikos@kde.org>
+
+ Reviewed by Maciej, Alexey, and Eric.
+
+ * pcre/pcre_compile.c:
+ * pcre/pcre_get.c:
+ * pcre/pcre_exec.c:
+ * wtf/UnusedParam.h:
+ Use /**/ in .c files to compile with non-C99 and non-GCC compilers.
+
+ * kjs/testkjs.cpp:
+ Change include to <wtf/HashTraits.h> from "HashTraits.h" to avoid -I
+
+ * wtf/unicode/qt4/UnicodeQt4.h:
+ Use correct parentheses and correct mask for utf-32 support.
+
+2006-05-17 Alexey Proskuryakov <ap@nypop.com>
+
+ Reviewed by Darin.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=8870
+ Crash typing in Yahoo auto-complete widget.
+
+ Test: fast/js/regexp-stack-overflow.html
+
+ * pcre/pcre-config.h: Define NO_RECURSE.
+
+2006-05-16 George Staikos <staikos@kde.org>
+
+ Reviewed by Maciej.
+
+ Fix some warnings and strict compilation errors.
+
+ * kjs/nodes.cpp:
+ * kjs/value.cpp:
+
+2006-05-15 Alexey Proskuryakov <ap@nypop.com>
+
+ * make-generated-sources.sh: Changed to be executable and removed
+ text in the file generated by "svn diff".
+
+2006-05-15 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej.
+
+ - Fixed <rdar://problem/4534904> please do not treat "debugger" as
+ a reserved word while parsing JavaScript (and other ECMA reserved
+ words)
+
+ AKA
+
+ http://bugs.webkit.org/show_bug.cgi?id=6179
+ We treat "char" as a reserved word in JavaScript and firefox/IE do
+ not
+
+ (1) I unreserved most of the spec's "future reserved words" because
+ they're not reserved in IE or FF. (Most, but not all, because IE
+ somewhat randomly *does* reserve a few of them.)
+ (2) I made 'debugger' a legitimate statement that acts like an empty
+ statement because FF and IE support it.
+
+ * kjs/grammar.y:
+ * kjs/keywords.table:
+
+2006-05-15 Tim Omernick <timo@apple.com>
+
+ Reviewed by John Sullivan.
+
+ Part of <rdar://problem/4466508> Add 64-bit support to the Netscape Plugin API
+
+ Added to the Netscape Plugin API the concept of "plugin drawing models". The drawing model
+ determines the kind of graphics context created by the browser for the plugin, as well as
+ the Mac types of various Netscape Plugin API data structures.
+
+ There is a drawing model to represent the old QuickDraw-based API. It is used by default
+ if QuickDraw is available on the system, unless the plugin specifies another drawing model.
+
+ The big change is the addition of the CoreGraphics drawing model. A plugin may request this
+ drawing model to obtain access to a CGContextRef for drawing, instead of a QuickDraw CGrafPtr.
+
+ * bindings/npapi.h:
+ Define NP_NO_QUICKDRAW when compiling 64-bit; there is no 64-bit QuickDraw.
+ Added NPNVpluginDrawingModel, NPNVsupportsQuickDrawBool, and NPNVsupportsCoreGraphicsBool
+ variables.
+ Added NPDrawingModel enumeration. Currently the only drawing models are QuickDraw and
+ CoreGraphics.
+ NPRegion's type now depends on the drawing model specified by the plugin.
+ NP_Port is now only defined when QuickDraw is available.
+ Added NP_CGContext, which is the type of the NPWindow's "window" member in CoreGraphics mode.
+
+2006-05-13 Kevin M. Ollivier <kevino@theolliviers.com>
+
+ Reviewed by Darin, landed by ap.
+
+ - http://bugs.webkit.org/show_bug.cgi?id=8528
+ Bakefiles (and generated Makefiles) for wx and gdk ports
+
+ * make-generated-sources.sh:
+ Added script to configure environment to run DerivedSources.make
+
+ * JavaScriptCoreSources.bkl:
+ Added JavaScriptCore sources list for Bakefile.
+
+ * jscore.bkl:
+ Bakefile used to generate JavaScriptCore project files
+ (currently only used by wx and gdk ports)
+
+2006-05-09 Steve Falkenburg <sfalken@apple.com>
+
+ Fix Windows build.
+ Minor fixes to WTF headers.
+
+ Reviewed by kevin.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Fix include dirs, paths to files.
+ * JavaScriptCore.vcproj/testkjs/testkjs.vcproj: Fix include dirs.
+ * wtf/Assertions.h: include Platform.h to get definition for COMPILER()
+ * wtf/Vector.h: include FastMalloc.h for definition of fastMalloc, fastFree
+
+2006-05-09 Maciej Stachowiak <mjs@apple.com>
+
+ Rubber stamped by Anders.
+
+ - renamed kxmlcore to wtf
+
+ kxmlcore --> wtf
+ KXMLCore --> WTF
+ KXC --> WTF
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * bindings/c/c_instance.cpp:
+ * bindings/objc/WebScriptObject.mm:
+ * kjs/JSImmediate.h:
+ * kjs/Parser.cpp:
+ * kjs/Parser.h:
+ * kjs/array_object.cpp:
+ * kjs/collector.cpp:
+ (KJS::Collector::registerThread):
+ * kjs/collector.h:
+ * kjs/config.h:
+ * kjs/function.cpp:
+ (KJS::isStrWhiteSpace):
+ * kjs/function.h:
+ * kjs/identifier.cpp:
+ * kjs/internal.cpp:
+ * kjs/internal.h:
+ * kjs/lexer.cpp:
+ (Lexer::shift):
+ (Lexer::isWhiteSpace):
+ (Lexer::isIdentStart):
+ (Lexer::isIdentPart):
+ * kjs/lookup.cpp:
+ * kjs/nodes.cpp:
+ * kjs/nodes.h:
+ * kjs/number_object.cpp:
+ * kjs/object.h:
+ * kjs/property_map.cpp:
+ * kjs/property_map.h:
+ * kjs/string_object.cpp:
+ (StringProtoFunc::callAsFunction):
+ * kjs/testkjs.cpp:
+ (testIsInteger):
+ * kjs/ustring.cpp:
+ * kjs/ustring.h:
+ * kxmlcore: Removed.
+ * kxmlcore/AlwaysInline.h: Removed.
+ * kxmlcore/Assertions.cpp: Removed.
+ * kxmlcore/Assertions.h: Removed.
+ * kxmlcore/FastMalloc.cpp: Removed.
+ * kxmlcore/FastMalloc.h: Removed.
+ * kxmlcore/FastMallocInternal.h: Removed.
+ * kxmlcore/Forward.h: Removed.
+ * kxmlcore/HashCountedSet.h: Removed.
+ * kxmlcore/HashFunctions.h: Removed.
+ * kxmlcore/HashMap.h: Removed.
+ * kxmlcore/HashSet.h: Removed.
+ * kxmlcore/HashTable.cpp: Removed.
+ * kxmlcore/HashTable.h: Removed.
+ * kxmlcore/HashTraits.h: Removed.
+ * kxmlcore/ListRefPtr.h: Removed.
+ * kxmlcore/Noncopyable.h: Removed.
+ * kxmlcore/OwnArrayPtr.h: Removed.
+ * kxmlcore/OwnPtr.h: Removed.
+ * kxmlcore/PassRefPtr.h: Removed.
+ * kxmlcore/Platform.h: Removed.
+ * kxmlcore/RefPtr.h: Removed.
+ * kxmlcore/TCPageMap.h: Removed.
+ * kxmlcore/TCSpinLock.h: Removed.
+ * kxmlcore/TCSystemAlloc.cpp: Removed.
+ * kxmlcore/TCSystemAlloc.h: Removed.
+ * kxmlcore/UnusedParam.h: Removed.
+ * kxmlcore/Vector.h: Removed.
+ * kxmlcore/VectorTraits.h: Removed.
+ * kxmlcore/unicode: Removed.
+ * kxmlcore/unicode/Unicode.h: Removed.
+ * kxmlcore/unicode/UnicodeCategory.h: Removed.
+ * kxmlcore/unicode/icu: Removed.
+ * kxmlcore/unicode/icu/UnicodeIcu.h: Removed.
+ * kxmlcore/unicode/posix: Removed.
+ * kxmlcore/unicode/qt3: Removed.
+ * kxmlcore/unicode/qt4: Removed.
+ * kxmlcore/unicode/qt4/UnicodeQt4.h: Removed.
+ * pcre/pcre_get.c:
+ * wtf: Added.
+ * wtf/Assertions.cpp:
+ * wtf/Assertions.h:
+ * wtf/FastMalloc.cpp:
+ (WTF::TCMalloc_ThreadCache::Scavenge):
+ (WTF::do_malloc):
+ (WTF::do_free):
+ (WTF::TCMallocGuard::TCMallocGuard):
+ (WTF::malloc):
+ (WTF::free):
+ (WTF::calloc):
+ (WTF::cfree):
+ (WTF::realloc):
+ * wtf/FastMalloc.h:
+ * wtf/FastMallocInternal.h:
+ * wtf/Forward.h:
+ * wtf/HashCountedSet.h:
+ * wtf/HashFunctions.h:
+ * wtf/HashMap.h:
+ * wtf/HashSet.h:
+ * wtf/HashTable.cpp:
+ * wtf/HashTable.h:
+ * wtf/HashTraits.h:
+ * wtf/ListRefPtr.h:
+ * wtf/Noncopyable.h:
+ * wtf/OwnArrayPtr.h:
+ * wtf/OwnPtr.h:
+ * wtf/PassRefPtr.h:
+ * wtf/RefPtr.h:
+ * wtf/TCSystemAlloc.cpp:
+ (TCMalloc_SystemAlloc):
+ * wtf/Vector.h:
+ * wtf/VectorTraits.h:
+ * wtf/unicode/UnicodeCategory.h:
+ * wtf/unicode/icu/UnicodeIcu.h:
+
+2006-05-08 Timothy Hatcher <timothy@apple.com>
+
+ Reviewed by Tim O.
+
+ * bindings/npapi.h: do not define #pragma options align=mac68k if we are 64-bit
+
+2006-05-07 Darin Adler <darin@apple.com>
+
+ Reviewed and landed by Maciej.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=8765
+ Random crashes on TOT since the form state change
+
+ I haven't figured out how to construct a test for this, but this does seem to fix the
+ problem; Mitz mentioned that a double-destroy was occurring in these functions.
+
+ * kxmlcore/HashMap.h: (KXMLCore::HashMap::remove): Use RefCounter::deref instead of calling
+ ~ValueType, because ~ValueType often results in a double-destroy, since the HashTable also
+ destroys the element based on the storage type. The RefCounter template correctly does work
+ only in cases where ValueType and ValueStorageType differ and this class is what's used
+ elsewhere for the same purpose; I somehow missed this case when optimizing HashMap.
+ * kxmlcore/HashSet.h: (KXMLCore::HashSet::remove): Ditto.
+
+2006-05-05 Darin Adler <darin@apple.com>
+
+ - http://bugs.webkit.org/show_bug.cgi?id=8722
+ IE compatibility fix in date parsing
+
+ * kjs/date_object.cpp: (KJS::parseDate): Merged change that George Staikos provided
+ from KDE 3.4.3 branch that allows day values of 0 and values that are > 1000.
+
+2006-05-04 Anders Carlsson <andersca@mac.com>
+
+ Reviewed by Maciej.
+
+ http://bugs.webkit.org/show_bug.cgi?id=8734
+ Would like a Vector::append that takes another Vector
+
+ * kxmlcore/Vector.h:
+ (KXMLCore::::append):
+ New function that takes another array.
+
+2006-05-02 Steve Falkenburg <sfalken@apple.com>
+
+ Reviewed by eric.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: set NDEBUG for release build
+ * kxmlcore/FastMalloc.cpp: Prevent USE_SYSTEM_MALLOC from being defined twice
+
+2006-05-02 Anders Carlsson <andersca@mac.com>
+
+ Reviewed by Maciej.
+
+ * kxmlcore/HashMap.h:
+ (KXMLCore::::operator):
+ Return *this
+
+2006-05-01 Tim Omernick <timo@apple.com>
+
+ Reviewed by Tim Hatcher.
+
+ <rdar://problem/4476875> Support printing for embedded Netscape plugins
+
+ * bindings/npapi.h:
+ Fixed struct alignment problem in our npapi.h. Structs must be 68k-aligned on both pre-Mac OS X
+ and Mac OS X systems, as this is what plugins expect.
+
+2006-05-01 Timothy Hatcher <timothy@apple.com>
+
+ Reviewed by Maciej.
+
+ <rdar://problem/4308243> 8F36 Regression: crash in malloc_consolidate if you use a .PAC file
+
+ The original fix missed the oversized cell case. Added a test for "currentThreadIsMainThread ||
+ imp->m_destructorIsThreadSafe" where we collect oversized cells.
+
+ We don't have a way to test PAC files yet, so there's no test attached.
+
+ * kjs/collector.cpp:
+ (KJS::Collector::collect): test the thread when we collect oversized cells
+
+2006-05-01 Tim Omernick <timo@apple.com>
+
+ Reviewed by Adele.
+
+ <rdar://problem/4526114> REGRESSION (two days ago): LOG() just prints @ for NSObject substitutions
+
+ * kxmlcore/Assertions.cpp:
+ Changed sense of strstr("%@") check. I already made the same fix to the WebBrowser assertions.
+
+2006-04-28 Steve Falkenburg <sfalken@apple.com>
+
+ Reviewed by kdecker
+
+ Actually apply the change that was reviewed insted of checking it in with an #if 0 (oops).
+
+ * kjs/testkjs.cpp:
+ (main): Suppress C runtime alerts
+
+2006-04-28 Steve Falkenburg <sfalken@apple.com>
+
+ Reviewed by kdecker
+
+ Suppress error reporting dialog that blocks Javascript tests from completing.
+
+ Real error is due to an overflow in the date/time handling functions that needs
+ to be addressed, but this will prevent the hang running the Javascript tests
+ on the build bot (along with the related changes).
+
+ * kjs/testkjs.cpp:
+ (main): Suppress C runtime alerts
+
+2006-04-27 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej
+
+ - Minor fixups I discovered while working on the autogenerator.
+
+ * kjs/lookup.cpp:
+ (findEntry): ASSERT that size is not 0, because otherwise we'll % by 0,
+ compute a garbage address, and possibly crash.
+ * kjs/lookup.h:
+ (cacheGlobalObject): Don't enumerate cached objects -- ideally, they
+ would be hidden entirely.
+
+2006-04-21 Kevin M. Ollivier <kevino@theolliviers.com>
+
+ Reviewed by Darin.
+
+ - http://bugs.webkit.org/show_bug.cgi?id=8507
+ Compilation fixes for building on gcc 4.0.2, and without precomp headers
+
+ * kjs/operations.h:
+ * kxmlcore/Assertions.cpp:
+ * kxmlcore/FastMalloc.cpp:
+ Added necessary headers to resolve compilation issues when not using
+ precompiled headers.
+
+ * kjs/value.h: Declare the JSCell class before friend declaration
+ to resolve compilation issues with gcc 4.0.2.
+
+ * kxmlcore/Platform.h: Set Unicode support to use ICU on platforms
+ other than KDE (previously only defined for Win and Mac OS)
+
+2006-04-18 Eric Seidel <eseidel@apple.com>
+
+ Reviewed by ggaren.
+
+ Fix "new Function()" to correctly use lexical scoping.
+ Add ScopeChain::print() function for debugging.
+ <rdar://problem/4067864> REGRESSION (125-407): JavaScript failure on PeopleSoft REN Server
+
+ * kjs/function_object.cpp:
+ (FunctionObjectImp::construct):
+ * kjs/scope_chain.cpp:
+ (KJS::ScopeChain::print):
+ * kjs/scope_chain.h:
+
+2006-04-14 James G. Speth <speth@end.com>
+
+ Reviewed by Timothy.
+
+ Bug 8389: support for Cocoa bindings - binding an NSTreeController to the WebView's DOM
+ http://bugs.webkit.org/show_bug.cgi?id=8389
+
+ Adds a category to WebScriptObject with array accessors for KVC/KVO.
+
+ If super valueForKey: fails it will call valueForUndefinedKey:, which is
+ important because it causes the right behavior to happen with bindings using
+ the "Raises for Not Applicable Keys" flag and the "Not Applicable Placeholder"
+
+ * bindings/objc/WebScriptObject.mm:
+ (-[WebScriptObject valueForKey:]):
+ (-[WebScriptObject count]):
+ (-[WebScriptObject objectAtIndex:]):
+ (-[WebUndefined description]): return "undefined"
+
+2006-04-13 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin.
+
+ * kjs/internal.cpp:
+ (KJS::InterpreterImp::initGlobalObject): Add the built-in object
+ prototype to the end of the global object's prototype chain instead of
+ just blowing away its existing prototype. We need to do this because
+ the window object has a meaningful prototype now.
+
+2006-04-13 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Geoff.
+
+ - fix testkjs to not show false-positive KJS::Node leaks in debug builds
+
+ * kjs/testkjs.cpp:
+ (doIt):
+ (kjsmain):
+
+2006-04-11 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej.
+
+ Minor code cleanup -- passes all the JS tests.
+
+ * kjs/object_object.cpp:
+ (ObjectObjectImp::construct):
+ (ObjectObjectImp::callAsFunction):
+
+2006-04-11 Darin Adler <darin@apple.com>
+
+ - another attempt to fix Windows build -- Vector in Forward.h was not working
+
+ * kxmlcore/Forward.h: Remove Vector.
+ * kxmlcore/Vector.h: Add back default arguments, remove include of
+ Forward.h.
+
+2006-04-11 Darin Adler <darin@apple.com>
+
+ - try to fix Windows build -- HashForward.h was not working
+
+ * kxmlcore/HashForward.h: Removed.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj: Remove HashForward.h.
+ * kjs/collector.h: Remove use of HashForward.h.
+ * kxmlcore/HashCountedSet.h: Remove include of HashForward.h, restore
+ default arguments.
+ * kxmlcore/HashMap.h: Ditto.
+ * kxmlcore/HashSet.h: Ditto.
+
+2006-04-11 David Harrison <harrison@apple.com>
+
+ Reviewed by Darin.
+
+ - fixed clean build, broken by Darin's check-in
+
+ * kjs/date_object.cpp: Add needed include of lookup.h.
+ * kjs/regexp_object.cpp: Move include of .lut.h file below other includes.
+
+2006-04-10 Darin Adler <darin@apple.com>
+
+ Rubber-stamped by John Sullivan.
+
+ - switched from a shell script to a makefile for generated files
+ - removed lots of unneeded includes
+ - added new Forward.h and HashForward.h headers that allow compiling with
+ fewer unneeded templates
+
+ * DerivedSources.make: Added.
+ * generate-derived-sources: Removed.
+ * JavaScriptCore.xcodeproj/project.pbxproj: Added new files, changed to use
+ DerivedSources.make.
+
+ * kxmlcore/Forward.h: Added.
+ * kxmlcore/HashForward.h: Added.
+
+ * kxmlcore/HashCountedSet.h: Include HashForward for default args.
+ * kxmlcore/HashMap.h: Ditto.
+ * kxmlcore/HashSet.h: Ditto.
+
+ * kjs/object.h:
+ * kjs/object.cpp:
+ Moved KJS_MAX_STACK into the .cpp file.
+
+ * bindings/NP_jsobject.cpp:
+ * bindings/c/c_instance.h:
+ * bindings/jni/jni_class.h:
+ * bindings/jni/jni_runtime.h:
+ * bindings/jni/jni_utility.h:
+ * bindings/objc/WebScriptObject.mm:
+ * bindings/objc/WebScriptObjectPrivate.h:
+ * bindings/objc/objc_class.h:
+ * bindings/objc/objc_class.mm:
+ * bindings/objc/objc_instance.h:
+ * bindings/objc/objc_instance.mm:
+ * bindings/objc/objc_runtime.mm:
+ * bindings/objc/objc_utility.mm:
+ * bindings/runtime.h:
+ * bindings/runtime_array.cpp:
+ * bindings/runtime_array.h:
+ * bindings/runtime_method.cpp:
+ * bindings/runtime_method.h:
+ * bindings/runtime_object.cpp:
+ * bindings/runtime_root.h:
+ * kjs/JSImmediate.cpp:
+ * kjs/Parser.h:
+ * kjs/array_object.cpp:
+ * kjs/array_object.h:
+ * kjs/bool_object.cpp:
+ * kjs/bool_object.h:
+ * kjs/collector.h:
+ * kjs/context.h:
+ * kjs/debugger.cpp:
+ * kjs/error_object.h:
+ * kjs/function_object.h:
+ * kjs/internal.h:
+ * kjs/lexer.cpp:
+ * kjs/math_object.cpp:
+ * kjs/math_object.h:
+ * kjs/nodes.cpp:
+ * kjs/nodes.h:
+ * kjs/number_object.cpp:
+ * kjs/number_object.h:
+ * kjs/object_object.cpp:
+ * kjs/operations.cpp:
+ * kjs/protected_reference.h:
+ * kjs/reference.h:
+ * kjs/reference_list.h:
+ * kjs/regexp_object.h:
+ * kjs/string_object.cpp:
+ * kjs/string_object.h:
+ * kjs/testkjs.cpp:
+ * kjs/value.cpp:
+ * kjs/value.h:
+ * kxmlcore/HashTable.h:
+ * kxmlcore/ListRefPtr.h:
+ * kxmlcore/TCPageMap.h:
+ * kxmlcore/Vector.h:
+ Removed unneeded header includes.
+
+2006-04-09 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by eric.
+
+ - Fixed http://bugs.webkit.org/show_bug.cgi?id=8284
+ prevent unnecessary entries in the "nodes with extra refs" hash table
+
+ This patch switches manually RefPtr exchange with use of
+ RefPtr::release to ensure that a node's ref count never tops 1
+ (in the normal case).
+
+ * kjs/nodes.cpp:
+ (BlockNode::BlockNode):
+ (CaseBlockNode::CaseBlockNode):
+ * kjs/nodes.h:
+ (KJS::ArrayNode::ArrayNode):
+ (KJS::ObjectLiteralNode::ObjectLiteralNode):
+ (KJS::ArgumentsNode::ArgumentsNode):
+ (KJS::VarStatementNode::VarStatementNode):
+ (KJS::ForNode::ForNode):
+ (KJS::CaseClauseNode::CaseClauseNode):
+ (KJS::FuncExprNode::FuncExprNode):
+ (KJS::FuncDeclNode::FuncDeclNode):
+
+2006-04-08 Alexey Proskuryakov <ap@nypop.com>
+
+ Reviewed by Darin.
+
+ One more attempt - use reinterpret_cast, rather than static_cast.
+
+2006-04-08 Alexey Proskuryakov <ap@nypop.com>
+
+ Reviewed by Darin.
+
+ An attempt to fix Win32 build - ICU uses wchar_t on Windows, so we need a type cast.
+
+ * kxmlcore/unicode/icu/UnicodeIcu.h:
+ (KXMLCore::Unicode::toLower):
+ (KXMLCore::Unicode::toUpper):
+
+2006-04-08 Alexey Proskuryakov <ap@nypop.com>
+
+ Reviewed by Darin.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=8264
+ toLowerCase and toUpperCase don't honor special mappings
+
+ Test: fast/js/string-capitalization.html
+
+ * JavaScriptCore.xcodeproj/project.pbxproj: Added KXMLCore::Unicode headers to the project.
+ * icu/unicode/putil.h: Added (copied from WebCore).
+ * icu/unicode/uiter.h: Ditto.
+ * icu/unicode/ustring.h: Ditto.
+ * kjs/string_object.cpp:
+ (StringProtoFunc::callAsFunction): Use the new KXMLCore::Unicode::toUpper() and toLower().
+ * kjs/ustring.cpp: Removed unused (and evil) UChar::toLower() and toUpper().
+ * kjs/ustring.h: Ditto.
+
+ * kxmlcore/unicode/Unicode.h: Corrected capitalization of the word Unicode.
+ * kxmlcore/unicode/UnicodeCategory.h: Renamed include guard macro to match file name.
+
+ * kxmlcore/unicode/icu/UnicodeIcu.h:
+ (KXMLCore::Unicode::toLower): Work on strings, not individual characters. Use ICU root locale.
+ (KXMLCore::Unicode::toUpper): Ditto.
+ (KXMLCore::Unicode::isFormatChar): Use int32_t, which can hold a complete code point.
+ (KXMLCore::Unicode::isSeparatorSpace): Ditto.
+ (KXMLCore::Unicode::category): Ditto.
+ * kxmlcore/unicode/qt4/UnicodeQt4.h:
+ (KXMLCore::Unicode::toLower): Work on strings, not individual characters.
+ (KXMLCore::Unicode::toUpper): Ditto.
+ (KXMLCore::Unicode::isFormatChar): Use int32_t, which can hold a complete code point.
+ (KXMLCore::Unicode::isSeparatorSpace): Ditto.
+ (KXMLCore::Unicode::category): Ditto.
+
+ * tests/mozilla/ecma/String/15.5.4.12-1.js: Corrected expected results.
+ * tests/mozilla/ecma/String/15.5.4.12-5.js: Corrected expected results.
+
+2006-04-05 Darin Adler <darin@apple.com>
+
+ - attempt to fix Windows build
+
+ * kxmlcore/HashMap.h: (KXMLCore::HashMap::remove): Use (*it). instead of it->.
+ * kxmlcore/HashSet.h: (KXMLCore::HashSet::remove): Ditto.
+
+2006-04-05 Darin Adler <darin@apple.com>
+
+ - attempt to fix Windows build
+
+ * os-win32/stdint.h: Add int8_t, uint8_t, int64_t.
+
+2006-04-05 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - fix memory leak introduced by the previous change
+
+ * kxmlcore/HashTable.h: Specialize NeedsRef so that it correctly returns true when
+ the value in question is a pair where one of the pair needs a ref and the other
+ of the pair does not.
+
+2006-04-05 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - JavaScriptCore part of fix for http://bugs.webkit.org/show_bug.cgi?id=8049
+ StringImpl hash traits deleted value creates an init routine for WebCore
+ <rdar://problem/4442248> REGRESSION: WebCore has init routines (8049)
+
+ Change HashMap and HashSet implementation so they fold various types together.
+ This allows us to implement maps and sets that use RefPtr<WebCore::StringImpl>
+ and WebCore::String in terms of the underlying raw pointer type, and hence use
+ -1 for the deleted value.
+
+ * kxmlcore/HashTraits.h: Added a new type to HashTraits, StorageTraits, which is a
+ type to be used when storing a value that has the same layout as the type itself.
+ This is used only for non-key cases. In the case of keys, the hash function must also
+ be considered. Moved emptyValue out of GenericHashTraitsBase into GenericHashTraits.
+ Added a new bool to HashTraits, needsRef, which indicates whether the type needs
+ explicit reference counting. If the type itself has needsRef true, but the storage
+ type has needsRef false, then the HashSet or HashMap has to handle the reference
+ counting explicitly. Added hash trait specializations for all signed integer values
+ that give -1 as the deleted value. Gave all integers StorageTraits of the canonical
+ integer type of the same size so int and long will share code. Gave all pointers and
+ RefPtrs StorageTraits of the appropriately sized integer type. Removed redundant
+ TraitType and emptyValue definitions in the pointer specialization for HashTraits.
+ Added PairBaseHashTraits, which doesn't try to set up needsDestruction and deletedValue.
+ Useful for types where we don't want to force the existence of deletedValue, such as
+ the type of a pair in a HashMap which is not the actual storage type. Removed an
+ unneeded parameter from the DeletedValueAssigner template. Added HashKeyStorageTraits
+ template, which determines what type can be used to store a given hash key type with
+ a given hash function, and specialized it for pointers and RefPtr so that pointer
+ hash tables share an underlying HashTable that uses IntHash.
+
+ * kxmlcore/HashTable.h: Added HashTableConstIteratorAdapter, HashTableIteratorAdapter,
+ NeedsRef, RefCountManagerBase, RefCountManager, HashTableRefCountManagerBase, and
+ HashTableRefCountManager. All are used by both HashSet and HashMap to handle hash
+ tables where the type stored is not the same as the real value type.
+
+ * kxmlcore/HashFunctions.h: Added a new struct named IntTypes that finds an
+ integer type given a sizeof value. Renamed pointerHash to intHash and made it
+ use overloading and take integer parameters. Added an IntHash struct which is
+ a hash function that works for integers. Changed PtrHash to call IntHash with
+ an appropriately sized integer. Made IntHash the default hash function for
+ many integer types. Made PtrHash the default hash function for RefPtr as well
+ as for raw pointers.
+
+ * kxmlcore/HashSet.h: Changed implementation to use a separate "storage type"
+ derived from the new traits. The HashTable will use the storage type and all
+ necessary translation and ref/deref is done at the HashSet level. Also reorganized
+ the file so that the HashSet is at the top and has no inline implementation inside
+ it so it's easy to read the interface to HashSet.
+
+ * kxmlcore/HashMap.h: Changed implementation to use a separate "storage type"
+ derived from the new traits. The HashTable will use the storage type and all
+ necessary translation and ref/deref is done at the HashMap level. Also reorganized
+ the file so that the HashMap is at the top and has no inline implementation inside
+ it so it's easy to read the interface to HashMap.
+
+ * kxmlcore/HashMapPtrSpec.h: Removed. Superceded by optimizations in HashMap itself.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj: Remove HashMapPtrSpec.h, resort files,
+ and also remove some unnecessary build settings from the aggregate target that
+ generates derived sources.
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Ditto.
+
+2006-04-04 Timothy Hatcher <timothy@apple.com>
+
+ Reviewed by Darin.
+
+ The Debug and Release frameworks are now built with install paths relative to the build products directory.
+ This removes the need for other projects to build with -framework WebCore and -framework JavaScriptCore.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2006-04-04 Eric Seidel <eseidel@apple.com>
+
+ Reviewed by ggaren.
+
+ Fix win32 build.
+ Disable ASSERT redefinition warnings for now.
+
+ * JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
+ * kxmlcore/Assertions.h:
+
+2006-04-04 Bjrn Graf <bjoern.graf@gmail.com>
+
+ Reviewed by ggaren & darin. Landed by eseidel.
+
+ Integrate CURL version of gettimeofday
+ http://bugs.webkit.org/show_bug.cgi?id=7399
+ Disable crash report dialogs for testkjs.exe in Release mode
+ http://bugs.webkit.org/show_bug.cgi?id=8113
+
+ * kjs/testkjs.cpp:
+ (StopWatch::start):
+ (StopWatch::stop):
+ (StopWatch::getElapsedMS):
+ (main):
+ (kjsmain):
+
+2006-04-04 Eric Seidel <eseidel@apple.com>
+
+ Reviewed by mjs.
+
+ * kjs/number_object.cpp:
+ (NumberProtoFunc::callAsFunction): remove trunc() to fix win32.
+
+2006-03-12 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin.
+
+ - fixed "toPrecision sometimes messes up the last digit on intel Macs"
+ http://bugs.webkit.org/show_bug.cgi?id=7748
+
+ * kjs/number_object.cpp:
+ (intPow10): Compute integer powers of 10 using exponentiation by squaring.
+ (NumberProtoFunc::callAsFunction): Use intPow10(n) in place of all pow(10.0, n),
+ plus a bit of refactoring.
+
+2006-04-03 Darin Adler <darin@apple.com>
+
+ - tweak config.h and Platform.h to try to get buildbot working
+ (making some small changes at the same time)
+
+ * kjs/config.h: Removed now-unneeded HAVE_ICU.
+ * kxmlcore/Platform.h: Tweak how platform gets set up. Move all the
+ USE stuff to the end.
+
+2006-04-03 George Staikos <staikos@opensource.apple.com>
+
+ Reviewed by Maciej.
+
+ Fix Win32 build breakage from previous commit, remove unused forward.
+
+2006-04-03 George Staikos <staikos@opensource.apple.com>
+
+ Reviewed by Maciej.
+
+ Implement a unicode abstraction layer to make JavaScriptCore much more
+ easily ported to other platforms without having to take in libicu. Also
+ makes the unicode related code easier to understand.
+
+2006-04-03 Timothy Hatcher <timothy@apple.com>
+
+ Reviewed by Adele.
+
+ Fixes <rdar://problem/4498338> JavaScriptCore fails to compile for ppc64
+ Other 64 bit build fixes.
+
+ * kjs/collector.cpp:
+ (KJS::Collector::markOtherThreadConservatively): test for __DARWIN_UNIX03 and use __r1
+ * kjs/dtoa.cpp:
+ (Bigint::): cast PRIVATE_mem to unsigned to prevent warning
+ * bindings/jni/jni_utility.cpp:
+ (KJS::Bindings::getJavaVM): cast jniError to long to prevent format warning
+ (KJS::Bindings::getJNIEnv): cast jniError to long to prevent format warning
+ * bindings/runtime_root.cpp:
+ (KJS::Bindings::addNativeReference): cast CFDictionaryGetValue to unsigned long to prevent warning
+ (KJS::Bindings::removeNativeReference): cast CFDictionaryGetValue to unsigned long to prevent warning
+
+2006-03-31 Darin Adler <darin@apple.com>
+
+ Reviewed by Geoff.
+
+ - <rdar://problem/4395622> API: WebScriptObject.h incorrectly reports that -isSelectorExcludedFromWebScript returns NO by default
+
+ * bindings/objc/WebScriptObject.h: Fixed comment.
+
+2006-03-31 Eric Seidel <eseidel@apple.com>
+
+ Reviewed by mjs.
+
+ A bit more code cleanup.
+
+ * bindings/c/c_utility.cpp:
+ (KJS::Bindings::convertValueToNPVariant):
+ * bindings/objc/objc_runtime.mm:
+ (convertValueToObjcObject):
+ * bindings/objc/objc_utility.mm:
+ (KJS::Bindings::convertValueToObjcValue):
+ * kjs/function.cpp:
+ (KJS::GlobalFuncImp::callAsFunction):
+ * kjs/interpreter.cpp:
+ (KJS::ExecState::lexicalInterpreter):
+ * kjs/interpreter.h:
+ * kjs/operations.cpp:
+ (KJS::equal):
+
+2006-03-30 Eric Seidel <eseidel@apple.com>
+
+ Reviewed by anders.
+
+ Small code-style update.
+
+ * kjs/operations.cpp:
+ (KJS::isNaN):
+ (KJS::isInf):
+ (KJS::isPosInf):
+ (KJS::isNegInf):
+ (KJS::equal):
+ (KJS::strictEqual):
+ (KJS::relation):
+ (KJS::maxInt):
+ (KJS::minInt):
+ (KJS::add):
+ (KJS::mult):
+
+2006-03-31 Anders Carlsson <andersca@mac.com>
+
+ Reviewed by Maciej.
+
+ Make sure the GetterSetterImp objects are marked as well.
+
+ * kjs/internal.cpp:
+ (KJS::GetterSetterImp::mark):
+ Call JSCell::mark().
+
+2006-03-30 Eric Seidel <eseidel@apple.com>
+
+ Reviewed by ggaren.
+
+ * kjs/nodes.h: Some various small style fixes.
+
+2006-03-30 Eric Seidel <eseidel@apple.com>
+
+ Reviewed by ggaren.
+
+ Clean-up style issues in node.h, remove redundant initializations.
+
+ * kjs/nodes.h:
+ (KJS::StatementNode::evaluate):
+ (KJS::ArrayNode::ArrayNode):
+ (KJS::ObjectLiteralNode::ObjectLiteralNode):
+ (KJS::ArgumentsNode::ArgumentsNode):
+ (KJS::NewExprNode::NewExprNode):
+ (KJS::CaseClauseNode::CaseClauseNode):
+ (KJS::FuncDeclNode::FuncDeclNode):
+
+2006-03-30 Tim Omernick <timo@apple.com>
+
+ Reviewed by Geoff.
+
+ <rdar://problem/4212626> REGRESSION: LIVECONNECT: JavaScript type for Java Strings is function,
+ not object
+
+ * bindings/runtime.h:
+ (KJS::Bindings::Instance::implementsCall):
+ New method. Returns false by default. Concrete subclasses can override this return true when
+ the bound object may be called as a function.
+ (KJS::Bindings::Instance::invokeDefaultMethod):
+ Since bound objects are no longer treated as functions by default, we can return jsUndefined()
+ here instead of in concrete subclasses that decide not to implement the default method
+ functionality.
+
+ * bindings/runtime_object.cpp:
+ (RuntimeObjectImp::implementsCall):
+ Don't assume that the bound object is a function; instead, let the object instance decide whether
+ it is callable.
+
+ * bindings/c/c_instance.h:
+ * bindings/c/c_instance.cpp:
+ (KJS::Bindings::CInstance::implementsCall):
+ The object is callable if its class has an invokeDefault function.
+
+ * bindings/objc/objc_instance.h:
+ * bindings/objc/objc_instance.mm:
+ (ObjcInstance::implementsCall):
+ The object is callable if the ObjC instance responds to -invokeDefaultMethodWithArguments:.
+
+ * bindings/jni/jni_instance.h:
+ * bindings/jni/jni_instance.cpp:
+ Moved bogus invokeDefaultMethod() to superclass.
+
+2006-03-29 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin.
+
+ - JavaScriptCore side of fix for <rdar://problem/4308243> 8F36
+ Regression: crash in malloc_consolidate if you use a .PAC file
+
+ The crash was a result of threaded deallocation of thread-unsafe
+ objects. Pure JS objects are thread-safe because all JS execution
+ is synchronized through JSLock. However, JS objects that wrap WebCore
+ objects are thread-unsafe because JS and WebCore execution are not
+ synchronized. That unsafety comes into play when the collector
+ deallocates a JS object that wraps a WebCore object, thus causing the
+ WebCore object to be deallocated.
+
+ The solution here is to have each JSCell know whether it is safe to
+ collect on a non-main thread, and to avoid collecting unsafe cells
+ when on a non-main thread.
+
+ We don't have a way to test PAC files yet, so there's no test
+ attached to this patch.
+
+ * kjs/collector.cpp:
+ (KJS::Collector::collect):
+ (1) Added the test "currentThreadIsMainThread ||
+ imp->m_destructorIsThreadSafe".
+
+ * kjs/protect.h:
+ (KJS::gcProtectNullTolerant):
+ (KJS::gcUnprotectNullTolerant):
+ * kjs/value.h:
+ (KJS::JSCell::JSCell): The bools here must be bitfields, otherwise
+ m_destructorIsThreadSafe becomes another whole word, ruining the
+ collector optimizations we've made based on the size of a JSObject.
+ * kxmlcore/FastMalloc.cpp:
+ (KXMLCore::currentThreadIsMainThread):
+ (KXMLCore::fastMallocRegisterThread):
+ * kxmlcore/FastMalloc.h:
+
+2006-03-28 Darin Adler <darin@apple.com>
+
+ Reviewed by Geoff.
+
+ - change some code that resulted in init routines on Mac OS X -- if the framework has
+ init routines it will use memory and slow down applications that link with WebKit
+ even in cases where those applications don't use WebKit
+
+ * kjs/date_object.cpp: Changed constants that were derived by multiplying other constants
+ to use immediate numbers instead. Apparently, double constant expressions of the type we
+ had here are evaluated at load time.
+
+ * kjs/list.cpp: Can't use OwnArrayPtr in ListImp because of the global instances of
+ ListImp, so go back to using a plain old pointer.
+ (KJS::List::List): Set overflow to 0 when initializing ListImp.
+ (KJS::List::release): Replace a clear call with a delete and explicit set to 0.
+ (KJS::List::append): Use raw pointers, and do a delete [] instead of finessing it with
+ a swap of OwnArrayPtr.
+ (KJS::List::copyFrom): Remove now-unneeded get().
+ (KJS::List::copyTail): Ditto.
+
+ * kjs/ustring.cpp: Changed UString::Rep::empty initializer a bit so that it doesn't get
+ a static initializer routine. Had to get rid of one level of constant to get the compiler
+ to understand it could initialize without any code.
+
+ - added a build step that checks for init routines
+
+ * JavaScriptCore.xcodeproj/project.pbxproj: Deleted now-unused custom build rule that
+ was replaced by the generate-derived-sources script a while back. Added a custom build
+ phase that invokes the check-for-global-initializers script.
+
+2006-03-28 Timothy Hatcher <timothy@apple.com>
+
+ Reviewed by Eric.
+
+ fixes <rdar://problem/4458539> Unable to include Security(public) and WebKit(private) headers
+
+ * bindings/npapi.h: added #defines after the #ifndefs
+
+2006-03-27 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Anders.
+
+ - fixed <rdar://problem/4489745> REGRESSION: Safari crashes at to display http://www.lgphilips-lcd.com/
+
+ * kjs/nodes.cpp:
+ (Node::deref): take into account the case where the extra refcount table was never created
+
+2006-03-23 David Carson <dacarson@gmail.com>
+
+ Reviewed by Darin.
+
+ - JSObject in LiveConnect not working.
+ http://bugs.webkit.org/show_bug.cgi?id=7917
+
+ * bindings/jni_jsobject.cpp:
+ (JavaJSObject::convertJObjectToValue): Was trying to retrieve the native pointer from the wrong base
+ class, and the GetFieldID was using the wrong signature.
+
+2006-03-23 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - fix buildbot
+
+ * JavaScriptCore.xcodeproj/project.pbxproj: Change target name to JavaScriptCore (it was "include"!?).
+ Also add -Y 3 option for linker.
+
+2006-03-23 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=7726
+ REGRESSION: orbitz calendar fails (JavaScript function serialization/parsing)
+
+ * kjs/object.h: Take function name, as well as source URL and line number, when
+ using the special overloaded construct for making functions.
+ * kjs/object.cpp: (KJS::JSObject::construct): Ditto.
+ * kjs/function_object.h: Ditto.
+ * kjs/function_object.cpp: (FunctionObjectImp::construct): Pass a name when
+ constructing the function rather than null. Use "anonymous" when making a
+ function using the default function constructor.
+
+ * kjs/nodes2string.cpp: (FuncDeclNode::streamTo): Put a line break just before
+ a function declaration.
+
+ - unrelated fix
+
+ * kxmlcore/HashMapPtrSpec.h: Add missing needed friend declaration.
+
+2006-03-23 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=7805
+ LEAK: method name leaks in KJS::Bindings::CInstance::invokeMethod
+
+ * bindings/c/c_utility.h: Remove NPN_UTF16FromString declaration (not implemented).
+ * bindings/c/c_utility.cpp:
+ (KJS::Bindings::convertValueToNPVariant): Use DOUBLE_TO_NPVARIANT,
+ BOOLEAN_TO_NPVARIANT, VOID_TO_NPVARIANT, NULL_TO_NPVARIANT, and
+ OBJECT_TO_NPVARIANT. In the case of OBJECT, call _NPN_RetainObject in
+ one case and remove a _NPN_ReleaseObject in another because this
+ should return a retained value.
+ (KJS::Bindings::convertNPVariantToValue): Use NPVARIANT_TO_BOOLEAN,
+ NPVARIANT_TO_INT32, and NPVARIANT_TO_DOUBLE.
+
+ * bindings/c/c_runtime.h: Removed implementations of CMethod::name and
+ CField::name that called _NPN_UTF8FromIdentifier and hence leaked.
+ * bindings/c/c_runtime.cpp:
+ (KJS::Bindings::CMethod::name): Added. Returns the string from inside the
+ method object.
+ (KJS::Bindings::CField::name): Added. Returns the string from inside the
+ field object.
+ (KJS::Bindings::CField::valueFromInstance): Added call to _NPN_ReleaseVariantValue
+ on the result of getProperty after using it to fix a storage leak.
+ (KJS::Bindings::CField::setValueToInstance): Added call to _NPN_ReleaseVariantValue
+ after pasing a value to setProperty now that the conversion function does a retain.
+
+ * bindings/c/c_instance.cpp:
+ (KJS::Bindings::CInstance::invokeMethod): Changed to use Vector for a local
+ stack buffer. Removed special case for NPVARIANT_IS_VOID because the
+ convertNPVariantToValue function handles that properly.
+ (KJS::Bindings::CInstance::invokeDefaultMethod): Ditto.
+
+ * bindings/NP_jsobject.h: Formatting changes only.
+ * bindings/NP_jsobject.cpp:
+ (jsDeallocate): Changed parameter type so we don't need a function cast.
+ (_NPN_InvokeDefault): Use VOID_TO_NPVARIANT.
+ (_NPN_Invoke): Use NULL_TO_NPVARIANT and VOID_TO_NPVARIANT.
+ (_NPN_Evaluate): Use VOID_TO_NPVARIANT.
+ (_NPN_GetProperty): Use NULL_TO_NPVARIANT and VOID_TO_NPVARIANT.
+
+ * bindings/c/c_class.cpp: Formatting changes only.
+ * bindings/c/c_class.h: Formatting changes only.
+
+ * bindings/npruntime_priv.h: Removed obsolete and now-unused functions:
+ NPN_VariantIsVoid, NPN_VariantIsNull, NPN_VariantIsUndefined,
+ NPN_VariantIsBool, NPN_VariantIsInt32, NPN_VariantIsDouble,
+ NPN_VariantIsString, NPN_VariantIsObject, NPN_VariantToBool,
+ NPN_VariantToInt32, NPN_VariantToDouble, NPN_VariantToString,
+ NPN_VariantToStringCopy, NPN_VariantToObject, NPN_InitializeVariantAsVoid,
+ NPN_InitializeVariantAsNull, NPN_InitializeVariantAsUndefined,
+ NPN_InitializeVariantWithBool, NPN_InitializeVariantWithInt32,
+ NPN_InitializeVariantWithDouble, NPN_InitializeVariantWithString,
+ NPN_InitializeVariantWithObject, and NPN_InitializeVariantWithVariant.
+ * bindings/npruntime.cpp:
+ (getIntIdentifierDictionary): Don't bother creating custom callbacks for the
+ integer dictionary since the default behavior is fine for integers.
+
+2006-03-23 Mark Rowe <opendarwin.org@bdash.net.nz>
+
+ Reviewed and landed by Maciej.
+
+ - WebKit no longer builds with bison 2.1
+ http://bugs.webkit.org/show_bug.cgi?id=7923
+
+ * generate-derived-sources: Handle generated header named either grammar.cpp.h
+ or grammar.hpp.
+
+2006-03-22 Maciej Stachowiak <mjs@apple.com>
+
+ - fix the build
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2006-03-21 Maciej Stachowiak <mjs@apple.com>
+
+ * kjs/generate-derived-sources: Set executable property.
+
+2006-03-21 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin.
+
+ Ensure that generated source dependencies are handled properly, as follows:
+
+ - Made an external script that generates the sources into a
+ DerivedSources dir in the build products directory.
+ - Added a new build target that builds all the generated sources
+ if needed. Sadly it has to be a target, not a phase for Xcode to notice changes.
+ - Added the DerivedSources dir in question to the include path.
+ - Added the new DerivedSources dir and its contents to the project as build-relative.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * kjs/generate-derived-sources: Added. Based on the windows version - maybe someday they
+ can share more.
+
+2006-03-11 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin.
+
+ - fixed "charAt layout test fails on intel macs; some NaNs are printed as -NaN"
+ http://bugs.webkit.org/show_bug.cgi?id=7745
+
+ * kjs/ustring.cpp:
+ (KJS::UString::from): Use "NaN" for all NaN values, regardless of sign.
+
+2006-03-16 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin.
+
+ - tweaks to my change to redo KJS::Node refcounting
+
+ * kjs/nodes.cpp:
+ (Node::ref):
+ (Node::deref):
+ (Node::refcount):
+ (Node::clearNewNodes):
+ * kjs/nodes.h:
+
+2006-03-16 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - fixed Vector so that you can pass a reference to something in the vector
+ to the append or insert functions
+
+ * kxmlcore/Vector.h:
+ (KXMLCore::Vector::expandCapacity): Added new overloads that take a pointer to adjust
+ and return the adjusted value of the pointer.
+ (KXMLCore::Vector::append): Pass a pointer when expanding the vector, and use it when
+ adding the new element. Makes the case where the element moves when the vector
+ is expanded work.
+ (KXMLCore::Vector::insert): Ditto.
+
+2006-03-15 Eric Seidel <eseidel@apple.com>
+
+ Reviewed by adele.
+
+ Build fix.
+
+ * kjs/date_object.cpp:
+ (KJS::DateProtoFunc::callAsFunction): use size() not "len()"
+
+2006-03-15 Eric Seidel <eseidel@apple.com>
+
+ Reviewed by mjs.
+
+ Fix CString copy constructor, fixes Date.parse("") on Win32.
+
+ * kjs/date_object.cpp:
+ (KJS::DateProtoFunc::callAsFunction):
+ * kjs/ustring.cpp:
+ (KJS::CString::CString):
+ (KJS::CString::operator=):
+
+2006-03-13 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Anders.
+
+ - KJS::Node and KJS::StatementNode are bigger than they need to be
+ http://bugs.webkit.org/show_bug.cgi?id=7775
+
+ The memory usage of Node was reduced by 2 machine words per node:
+
+ - sourceURL was removed and only kept on FunctionBodyNode. The
+ source URL can only be distinct per function or top-level program node,
+ and you always have one.
+
+ - refcount was removed and kept in a separate hashtable when
+ greater than 1. newNodes set represents floating nodes with
+ refcount of 0. This helps because almost all nodes have a refcount of 1
+ for almost all of their lifetime.
+
+ * bindings/runtime_method.cpp:
+ (RuntimeMethod::RuntimeMethod): Pass null body, added FIXME.
+ * kjs/Parser.cpp:
+ (KJS::clearNewNodes): New nodes are tracked in nodes.cpp now, but still clear
+ them at the appropriate time.
+ * kjs/context.h:
+ (KJS::ContextImp::currentBody): added; used to retrieve source URL and sid
+ for current code.
+ (KJS::ContextImp::pushIteration): moved here from LabelStack
+ (KJS::ContextImp::popIteration): ditto
+ (KJS::ContextImp::inIteration): ditto
+ (KJS::ContextImp::pushSwitch): ditto
+ (KJS::ContextImp::popSwitch): ditto
+ (KJS::ContextImp::inSwitch): ditto
+ * kjs/function.cpp:
+ (KJS::FunctionImp::FunctionImp): Add FunctionBodyNode* parameter.
+ (KJS::FunctionImp::callAsFunction): Pass body to ContextImp.
+ (KJS::FunctionImp::argumentsGetter): _context renamed to m_context.
+ (KJS::DeclaredFunctionImp::DeclaredFunctionImp): Pass body to superclass
+ constructor.
+ (KJS::GlobalFuncImp::callAsFunction): Pass progNode as body for ContextImp in
+ eval.
+ * kjs/function.h: Move body field from DeclaredFunctionImp to
+ FunctionImp.
+ * kjs/grammar.y: Change DBG; statements no longer have a sourceid.
+ * kjs/internal.cpp:
+ (KJS::ContextImp::ContextImp): Initialize new m_currentBody, m_iterationDepth
+ and m_switchDepth data members. New FunctionBodyNode* parameter - the
+ function body provides source URL and SourceId.
+ (KJS::InterpreterImp::mark): Use exception() function, not _exception directly.
+ (KJS::InterpreterImp::evaluate): Pass progNode to ContextImp constructor
+ to use as the body.
+ * kjs/internal.h:
+ (KJS::LabelStack::LabelStack): Remove iteration depth and switch depth;
+ statement label stacks don't need these and it bloats their size. Put them
+ in the ContextImp instead.
+ * kjs/interpreter.cpp:
+ (KJS::ExecState::lexicalInterpreter): Renamed _context to m_context.
+ * kjs/interpreter.h:
+ (KJS::ExecState::dynamicInterpreter): Renamed _context to m_context.
+ (KJS::ExecState::context): ditto
+ (KJS::ExecState::setException): Renamed _exception to m_exception
+ (KJS::ExecState::clearException): ditto
+ (KJS::ExecState::exception): ditto
+ (KJS::ExecState::hadException): ditto
+ (KJS::ExecState::ExecState): ditto both above renames
+ * kjs/nodes.cpp:
+ (Node::Node): Removed initialization of line, source URL and refcount. Add to
+ local newNodes set instead of involving parser.
+ (Node::ref): Instead of managing refcount directly, story refcount over 1 in a
+ HashCountedSet, and keep a separate HashSet of "floating" nodes with refcount
+ 0.
+ (Node::deref): ditto
+ (Node::refcount): ditto
+ (Node::clearNewNodes): Destroy anything left in the new nodes set.
+ (currentSourceId): Inline helper to get sourceId from function body via context.
+ (currentSourceURL): ditto for sourceURL.
+ (Node::createErrorCompletion): use new helper
+ (Node::throwError): ditto
+ (Node::setExceptionDetailsIfNeeded): ditto
+ (StatementNode::StatementNode): remove initialization of l0 and sid, rename
+ l1 to m_lastLine.
+ (StatementNode::setLoc): Set own m_lastLine and Node's m_line.
+ (StatementNode::hitStatement): Get sid, first line, last line in the proper new ways.
+ (StatListNode::StatListNode): updated for setLoc changes
+ (BlockNode::BlockNode): ditto
+ (DoWhileNode::execute): excpect iteraton counts on ContextImp, not LabelStack
+ (WhileNode::execute): ditto
+ (ForNode::execute): ditto
+ (ForInNode::execute): ditto
+ (ContinueNode::execute): excpect inIteration on ContextImp, not LabelStack
+ (BreakNode::execute): excpect inIteration and inSwitch on ContextImp, not LabelStack
+ (SwitchNode::execute): expect switch counts on ContextImp, not LabelStack
+ (FunctionBodyNode::FunctionBodyNode): update for new setLoc
+ (FunctionBodyNode::processFuncDecl): reindent
+ (SourceElementsNode::SourceElementsNode): update for new setLoc
+ * kjs/nodes.h:
+ (KJS::Node::lineNo): Renamed _line to m_line
+ (KJS::StatementNode::firstLine): Use lineNo()
+ (KJS::StatementNode::lastLine): Renamed l1 to m_lastLine
+ (KJS::FunctionBodyNode::sourceId): added
+ (KJS::FunctionBodyNode::sourceURL): added
+ * kjs/testkjs.cpp:
+
+2006-03-14 Geoffrey Garen <ggaren@apple.com>
+
+ - Fixed <rdar://problem/4478239> string sort puts "closed" before
+ "close"
+
+ Reviewed by Eric.
+
+ * kjs/ustring.cpp:
+ (KJS::compare): Inverted a < in order to treat the longer string as >
+ the shorter string.
+
+2006-03-12 Alexey Proskuryakov <ap@nypop.com>
+
+ Reviewed by Maciej.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=7708
+ REGRESSION: Flash callback to JavaScript function not working.
+
+ Test: plugins/invoke.html
+
+ * bindings/c/c_utility.cpp:
+ (KJS::Bindings::convertUTF8ToUTF16): Return a correct string length.
+
+2006-03-08 Eric Seidel <eseidel@apple.com>
+
+ Reviewed by darin.
+
+ Partially fix JS on win32 by fixing hash table generation.
+
+ * kjs/create_hash_table: limit << results to 32 bits.
+ * kjs/testkjs.cpp:
+ (TestFunctionImp::callAsFunction):
+
+2006-03-07 Darin Adler <darin@apple.com>
+
+ * kxmlcore/Vector.h: Quick fix to try to get Windows compiling again.
+
+2006-03-07 Darin Adler <darin@apple.com>
+
+ Reviewed by Anders.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=7655
+ unwanted output while running layout tests
+
+ * kjs/lexer.cpp: (Lexer::lex): Turn off the "yylex: ERROR" message.
+ * kjs/regexp.cpp: (KJS::RegExp::RegExp): Remove the code to log errors from PCRE
+ to standard output. I think we should arrange for the error text to be in JavaScript
+ exceptions instead at some point.
+ * kxmlcore/Vector.h: Add a check for overflow so that we'll abort if we pass a
+ too-large size rather than allocating a buffer smaller than requested.
+
+2006-03-06 David Carson <dacarson@gmail.com>
+
+ Reviewed by Darin, landed by ap.
+
+ - Fixed http://bugs.webkit.org/show_bug.cgi?id=7582
+ c_utility.cpp contains CFString OS X platform-dependent code; should use ICU
+
+ Tested with test case from:
+ http://bugs.webkit.org/show_bug.cgi?id=5163
+
+ * bindings/c_utility.cpp
+ (convertUTF8ToUTF16): Changed to using Unicode converter from ICU, and manual Latin-1 conversion.
+ * icu/unicode/ucnv.h: Copied from WebCore.
+ * icu/unicode/ucnv_err.h: Ditto.
+ * icu/unicode/uenum.h: Ditto.
+
+2006-03-05 Darin Adler <darin@apple.com>
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Updated.
+
+2006-03-06 Mitz Pettel <opendarwin.org@mitzpettel.com>
+
+ Fix suggested by Alexey Proskuryakov <ap@nypop.com>, reviewed by Maciej and Hyatt.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=7601
+ REGRESSION (r13089): Reproducible crash dereferencing a deallocated element on google image search
+
+ * kxmlcore/Platform.h: Corrected the define to enable USE(MULTIPLE_THREADS) on Mac OS X.
+
+2006-03-05 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - http://bugs.webkit.org/show_bug.cgi?id=7616
+ get all references to KJS::Node out of internal.h
+
+ * JavaScriptCore.xcodeproj/project.pbxproj: Updated for file changes.
+
+ * kjs/Parser.cpp: Added.
+ * kjs/Parser.h: Added.
+
+ * kjs/internal.cpp: Removed the Parser class.
+ * kjs/internal.h: Ditto. Also removed unnecessary declarations of classes
+ not used in this header.
+
+ * kjs/nodes.h: Added an include of "Parser.h".
+ * kjs/function.h: Added a declaration of FunctionBodyNode.
+
+2006-03-05 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej.
+
+ - JSC support for the fix for <rdar://problem/4467143> JavaScript
+ enumeration of HTML element properties skips DOM node properties
+
+ * kjs/lookup.h:
+ (1) Added the KJS_DEFINE_PROTOTYPE_WITH_PROTOTYPE macro. The
+ class definiton macro needs to know about the prototype's prototype so
+ that the class constructor properly sets it.
+ (2) Removed the KJS_IMPLEMENT_PROTOTYPE_WITH_PARENT macro. The class
+ implementation macro does not need to know about the prototype's
+ prototype, since getOwnPropertySlot should only look in the current
+ object's property map, and not its prototype's.
+
+2006-03-05 Andrew Wellington <proton@wiretapped.net>
+
+ Reviewed by Eric, landed by ap.
+
+ - Remove unused breakpoint bool from StatementNodes. No test provided as
+ there is no functionality change.
+
+ * kjs/nodes.cpp:
+ (StatementNode::StatementNode):
+ * kjs/nodes.h:
+
+2006-03-03 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin.
+
+ - Fixed <rdar://problem/4465598> REGRESSION (TOT): Crash occurs at
+ http://maps.google.com/?output=html ( KJS::Identifier::add(KJS::UString::Rep*)
+
+ This regression was caused by my fix for 4448098. I failed to account for the
+ deleted entry sentinel in the mehtod that saves the contents of a property map to
+ the back/forward cache.
+
+ Manual test in WebCore/manual-tests/property-map-save-crash.html
+
+ * kjs/property_map.cpp:
+ (KJS::deletedSentinel): Use 1 instead of -1 to facilitate an easy bit mask
+ (KJS::isValid): New function: checks if a key is null or the deleted sentinel
+ (KJS::PropertyMap::~PropertyMap): Fixed up the branch logic here for readability
+ and a slight performance win
+ (KJS::PropertyMap::clear):
+ (KJS::PropertyMap::rehash):
+ (KJS::PropertyMap::addSparseArrayPropertiesToReferenceList):
+ (KJS::PropertyMap::save): Check keys with isValid()
+
+2006-03-02 Maciej Stachowiak <mjs@apple.com>
+
+ - now fix mac build again
+
+ * kjs/identifier.cpp:
+
+2006-03-02 Maciej Stachowiak <mjs@apple.com>
+
+ Rubber stamped by Anders and Eric.
+
+ - add fpconst.cpp to win32 build, it is now needed
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * kjs/fpconst.cpp:
+
+2006-03-02 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Eric.
+
+ - fix windows build, broken by my last patch
+
+ * kjs/JSImmediate.cpp:
+ * kjs/identifier.cpp:
+ * kxmlcore/FastMalloc.cpp:
+ * kxmlcore/Platform.h:
+
+2006-03-01 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin.
+
+ - Set up new prototype macros and avoid using #if without defined() in JSC
+
+ Added new PLATFORM macros and related, to make sure #if's all check if relevant macros
+ are defined, and to separate core OS-level dependencies from operating environment
+ dependencies so you can, e.g., build KDE on Mac or Windows.
+
+ * kxmlcore/Platform.h: Added.
+
+ - deploy them everywhere in JavaScriptCore
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * bindings/jni/jni_utility.cpp:
+ (KJS::Bindings::convertValueToJValue):
+ * bindings/objc/WebScriptObject.mm:
+ * bindings/objc/objc_instance.mm:
+ (ObjcInstance::end):
+ * bindings/softlinking.h:
+ * bindings/testbindings.mm:
+ (main):
+ * kjs/JSLock.cpp:
+ * kjs/collector.cpp:
+ (KJS::Collector::markCurrentThreadConservatively):
+ (KJS::Collector::markOtherThreadConservatively):
+ (KJS::Collector::markStackObjectsConservatively):
+ * kjs/config.h:
+ * kjs/date_object.cpp:
+ (gmtoffset):
+ (KJS::formatTime):
+ (KJS::DateProtoFunc::callAsFunction):
+ (KJS::DateObjectImp::construct):
+ (KJS::makeTime):
+ * kjs/dtoa.cpp:
+ * kjs/fpconst.cpp:
+ (KJS::sizeof):
+ (KJS::):
+ * kjs/grammar.y:
+ * kjs/identifier.cpp:
+ * kjs/internal.cpp:
+ * kjs/interpreter.cpp:
+ (KJS::Interpreter::evaluate):
+ (KJS::Interpreter::createLanguageInstanceForValue):
+ * kjs/interpreter.h:
+ * kjs/lookup.cpp:
+ * kjs/lookup.h:
+ * kjs/math_object.cpp:
+ * kjs/object.cpp:
+ * kjs/object.h:
+ * kjs/operations.cpp:
+ (KJS::isNaN):
+ (KJS::isInf):
+ (KJS::isPosInf):
+ (KJS::isNegInf):
+ * kjs/operations.h:
+ * kjs/regexp.cpp:
+ (KJS::RegExp::RegExp):
+ (KJS::RegExp::~RegExp):
+ (KJS::RegExp::match):
+ * kjs/regexp.h:
+ * kjs/testkjs.cpp:
+ (StopWatch::start):
+ (StopWatch::stop):
+ (StopWatch::getElapsedMS):
+ * kjs/ustring.cpp:
+ * kjs/ustring.h:
+ * kxmlcore/AlwaysInline.h:
+ * kxmlcore/Assertions.cpp:
+ * kxmlcore/Assertions.h:
+ * kxmlcore/FastMalloc.cpp:
+ (KXMLCore::):
+ * kxmlcore/FastMalloc.h:
+ * kxmlcore/FastMallocInternal.h:
+ * kxmlcore/HashTable.h:
+ * kxmlcore/TCPageMap.h:
+ * kxmlcore/TCSpinLock.h:
+ (TCMalloc_SpinLock::Lock):
+ (TCMalloc_SpinLock::Unlock):
+ (TCMalloc_SlowLock):
+ * kxmlcore/TCSystemAlloc.cpp:
+ (TCMalloc_SystemAlloc):
+ * os-win32/stdint.h:
+
+2006-02-28 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin.
+
+ - Fixed <rdar://problem/4448098> Switch PropertyMap deleted entry
+ placeholder to -1 from UString::Rep::null
+
+ This turned out to be only a small speedup (.12%). That's within the
+ margin of error for super accurate JS iBench, but Shark confirms the
+ same, so I think it's worth landing.
+
+ FYI, I also confirmed that the single entry optimization in
+ PropertyMap is a 3.2% speedup.
+
+ * kjs/property_map.cpp:
+ (KJS::PropertyMap::~PropertyMap):
+ (KJS::PropertyMap::clear):
+ (KJS::PropertyMap::put):
+ (KJS::PropertyMap::insert):
+ (KJS::PropertyMap::rehash):
+ (KJS::PropertyMap::remove):
+ (KJS::PropertyMap::addSparseArrayPropertiesToReferenceList):
+ (KJS::PropertyMap::checkConsistency):
+ * kjs/property_map.h:
+ (KJS::PropertyMap::deletedSentinel):
+
+2006-02-27 Eric Seidel <eseidel@apple.com>
+
+ Rubber-stamped by darin.
+
+ Remove fpconst.cpp, unused on win32 and the cause of linker warnings.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+
+2006-02-27 Eric Seidel <eseidel@apple.com>
+
+ Reviewed by mjs.
+
+ Fix Assertions.cpp to compile on win32.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * kxmlcore/Assertions.cpp:
+
+2006-02-27 Eric Seidel <eseidel@apple.com>
+
+ Reviewed by mjs.
+
+ Made Assertions.cpp platform independent.
+ Moved mac-specific logging logic up into WebCore.
+ http://bugs.webkit.org/show_bug.cgi?id=7503
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * kxmlcore/Assertions.cpp: Added.
+ * kxmlcore/Assertions.h:
+ * kxmlcore/Assertions.mm: Removed.
+
+2006-02-27 Darin Adler <darin@apple.com>
+
+ - fixed Mac Debug build, there was an unused parameter
+
+ * kxmlcore/FastMalloc.cpp: (KXMLCore::fastMallocRegisterThread):
+ Remove parameter name.
+
+ * kjs/debugger.h: Fixed comment.
+
+2006-02-27 Eric Seidel <eseidel@apple.com>
+
+ Reviewed by darin.
+
+ * kxmlcore/Vector.h:
+ (KXMLCore::deleteAllValues): fix unused variable warning
+
+2006-02-21 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin.
+
+ - Turn off -Wno-unused-param for JavaScriptCore and get rid of unused params
+ http://bugs.webkit.org/show_bug.cgi?id=7384
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * bindings/NP_jsobject.cpp:
+ (jsAllocate):
+ (_NPN_InvokeDefault):
+ (_NPN_Evaluate):
+ (_NPN_GetProperty):
+ (_NPN_SetProperty):
+ (_NPN_RemoveProperty):
+ (_NPN_HasProperty):
+ (_NPN_HasMethod):
+ * bindings/c/c_class.h:
+ (KJS::Bindings::CClass::constructorAt):
+ * bindings/c/c_utility.cpp:
+ (KJS::Bindings::convertNPVariantToValue):
+ * bindings/jni/jni_class.cpp:
+ (JavaClass::methodsNamed):
+ (JavaClass::fieldNamed):
+ * bindings/jni/jni_instance.cpp:
+ (JavaInstance::invokeDefaultMethod):
+ * bindings/jni/jni_jsobject.cpp:
+ * bindings/jni/jni_objc.mm:
+ (-[NSObject KJS::Bindings::]):
+ * bindings/objc/WebScriptObject.mm:
+ (+[WebUndefined allocWithZone:]):
+ (-[WebUndefined initWithCoder:]):
+ (-[WebUndefined encodeWithCoder:]):
+ (-[WebUndefined copyWithZone:]):
+ * bindings/objc/objc_class.h:
+ (KJS::Bindings::ObjcClass::constructorAt):
+ * bindings/objc/objc_class.mm:
+ (KJS::Bindings::ObjcClass::methodsNamed):
+ (KJS::Bindings::ObjcClass::fallbackObject):
+ * bindings/objc/objc_instance.mm:
+ (ObjcInstance::getValueOfUndefinedField):
+ * bindings/objc/objc_runtime.mm:
+ (ObjcFallbackObjectImp::getOwnPropertySlot):
+ (ObjcFallbackObjectImp::put):
+ (ObjcFallbackObjectImp::canPut):
+ (ObjcFallbackObjectImp::deleteProperty):
+ (ObjcFallbackObjectImp::toBoolean):
+ * bindings/runtime.cpp:
+ (KJS::Bindings::Instance::createLanguageInstanceForValue):
+ * bindings/runtime.h:
+ (KJS::Bindings::Instance::getValueOfUndefinedField):
+ (KJS::Bindings::Instance::setValueOfUndefinedField):
+ * bindings/runtime_array.cpp:
+ (RuntimeArray::lengthGetter):
+ (RuntimeArray::indexGetter):
+ (RuntimeArray::put):
+ (RuntimeArray::deleteProperty):
+ * bindings/runtime_method.cpp:
+ (RuntimeMethod::lengthGetter):
+ (RuntimeMethod::execute):
+ * bindings/runtime_object.cpp:
+ (RuntimeObjectImp::fallbackObjectGetter):
+ (RuntimeObjectImp::fieldGetter):
+ (RuntimeObjectImp::methodGetter):
+ (RuntimeObjectImp::put):
+ (RuntimeObjectImp::canPut):
+ (RuntimeObjectImp::deleteProperty):
+ (RuntimeObjectImp::defaultValue):
+ (RuntimeObjectImp::callAsFunction):
+ * bindings/runtime_root.cpp:
+ (performJavaScriptAccess):
+ * kjs/array_object.cpp:
+ (ArrayInstance::lengthGetter):
+ (ArrayInstance::getOwnPropertySlot):
+ (ArrayPrototype::ArrayPrototype):
+ (ArrayPrototype::getOwnPropertySlot):
+ * kjs/bool_object.cpp:
+ (BooleanObjectImp::BooleanObjectImp):
+ * kjs/date_object.cpp:
+ (KJS::DateObjectFuncImp::DateObjectFuncImp):
+ (KJS::DateObjectFuncImp::callAsFunction):
+ * kjs/error_object.cpp:
+ (ErrorObjectImp::ErrorObjectImp):
+ (NativeErrorPrototype::NativeErrorPrototype):
+ (NativeErrorImp::NativeErrorImp):
+ * kjs/function.cpp:
+ (KJS::FunctionImp::argumentsGetter):
+ (KJS::FunctionImp::lengthGetter):
+ (KJS::Arguments::mappedIndexGetter):
+ (KJS::ActivationImp::argumentsGetter):
+ (KJS::ActivationImp::put):
+ * kjs/function_object.cpp:
+ (FunctionObjectImp::FunctionObjectImp):
+ * kjs/internal.cpp:
+ (KJS::GetterSetterImp::toPrimitive):
+ (KJS::GetterSetterImp::toBoolean):
+ * kjs/interpreter.cpp:
+ (KJS::Interpreter::evaluate):
+ * kjs/interpreter.h:
+ (KJS::Interpreter::isGlobalObject):
+ (KJS::Interpreter::interpreterForGlobalObject):
+ (KJS::Interpreter::isSafeScript):
+ * kjs/lexer.cpp:
+ (Lexer::makeIdentifier):
+ (Lexer::makeUString):
+ * kjs/lookup.h:
+ (KJS::staticFunctionGetter):
+ (KJS::staticValueGetter):
+ * kjs/nodes.cpp:
+ (StatementNode::processFuncDecl):
+ (PropertyNode::evaluate):
+ (PropertyNameNode::evaluate):
+ * kjs/number_object.cpp:
+ (NumberObjectImp::NumberObjectImp):
+ (NumberObjectImp::getOwnPropertySlot):
+ * kjs/object.cpp:
+ (KJS::JSObject::defineGetter):
+ (KJS::JSObject::defineSetter):
+ (KJS::JSObject::hasInstance):
+ (KJS::JSObject::propertyIsEnumerable):
+ * kjs/object_object.cpp:
+ (ObjectObjectImp::ObjectObjectImp):
+ * kjs/property_slot.cpp:
+ (KJS::PropertySlot::undefinedGetter):
+ (KJS::PropertySlot::functionGetter):
+ * kjs/reference.cpp:
+ (KJS::Reference::getPropertyName):
+ * kjs/reference_list.cpp:
+ (ReferenceListIterator::operator++):
+ * kjs/regexp_object.cpp:
+ (RegExpObjectImp::RegExpObjectImp):
+ (RegExpObjectImp::getValueProperty):
+ (RegExpObjectImp::putValueProperty):
+ * kjs/string_object.cpp:
+ (StringInstance::lengthGetter):
+ (StringInstance::indexGetter):
+ (StringPrototype::StringPrototype):
+ * kxmlcore/Assertions.mm:
+ * kxmlcore/FastMalloc.cpp:
+ (KXMLCore::TCMalloc_PageHeap::CheckList):
+ * kxmlcore/HashTable.h:
+ (KXMLCore::HashTableConstIterator::checkValidity):
+ (KXMLCore::IdentityHashTranslator::translate):
+ * pcre/pcre_get.c:
+ (pcre_get_stringnumber):
+
+2006-02-23 Darin Adler <darin@apple.com>
+
+ - try to fix buildbot failure
+
+ * bindings/c/c_utility.cpp: Touch this file, which seems to not have been
+ recompiled after additional inlining was introduced (Xcode bug?).
+
+2006-02-23 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin, Maciej.
+
+ - Inline some functions suggested by Shark. 2.9% speedup on super
+ accurate JS iBench.
+
+ http://bugs.webkit.org/show_bug.cgi?id=7411
+ <rdar://problem/4448116>
+
+ * kjs/nodes.h:
+ (KJS::ArgumentsNode::evaluateList):
+ * kjs/object.cpp:
+ * kjs/object.h:
+ (KJS::ScopeChain::release):
+ (KJS::JSObject::toPrimitive):
+ * kjs/scope_chain.cpp:
+ * kjs/ustring.cpp:
+ * kjs/ustring.h:
+ (KJS::UString::toArrayIndex):
+ * kjs/value.cpp:
+ * kjs/value.h:
+ (KJS::JSValue::toObject):
+ * kxmlcore/FastMalloc.cpp:
+ (KXMLCore::TCMalloc_ThreadCache_FreeList::Push):
+ (KXMLCore::TCMalloc_ThreadCache_FreeList::Pop):
+
+2006-02-21 Eric Seidel <eseidel@apple.com>
+
+ Added *.user to ignore list.
+
+2006-02-21 Eric Seidel <eseidel@apple.com>
+
+ Reviewed by ggaren.
+
+ Add grammarWrapper.cpp to work around visual studio bug plaguing buildbot.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.vcproj/JavaScriptCore/grammarWrapper.cpp: Added.
+
+2006-02-21 Eric Seidel <eseidel@apple.com>
+
+ Reviewed by ggaren.
+
+ * kjs/testkjs.cpp: #if out timeval code on win32
+
+2006-02-21 Michael Emmel <mike.emmel@gmail.com>
+
+ Reviewed by Darin.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=7397
+ TCPageMap.h would not compile for me because string.h was missing
+
+ * kxmlcore/TCPageMap.h: Added <string.h> include.
+
+2006-02-21 Darin Adler <darin@apple.com>
+
+ Reviewed by John Sullivan.
+
+ - http://bugs.webkit.org/show_bug.cgi?id=7404
+ remove a bunch of extra implementsCall overrides
+
+ * JavaScriptCore.xcodeproj/project.pbxproj: Sorted files.
+
+ * kjs/internal.h: Made InternalFunctionImp::callAsFunction pure virtual so that
+ we'll get a compile error if some derived class neglects to implement it.
+
+ * kjs/function.cpp: (KJS::FunctionImp::FunctionImp): Remove unneeded initialization
+ of param, which is an OwnPtr so it gets initialized by default.
+
+ * bindings/runtime_method.cpp:
+ * bindings/runtime_method.h:
+ * kjs/array_object.cpp:
+ * kjs/array_object.h:
+ * kjs/bool_object.cpp:
+ * kjs/bool_object.h:
+ * kjs/date_object.cpp:
+ * kjs/date_object.h:
+ * kjs/error_object.cpp:
+ * kjs/error_object.h:
+ * kjs/function.cpp:
+ * kjs/function.h:
+ * kjs/function_object.cpp:
+ * kjs/function_object.h:
+ * kjs/math_object.cpp:
+ * kjs/math_object.h:
+ * kjs/number_object.cpp:
+ * kjs/number_object.h:
+ * kjs/object_object.cpp:
+ * kjs/object_object.h:
+ * kjs/regexp_object.cpp:
+ * kjs/regexp_object.h:
+ * kjs/string_object.cpp:
+ * kjs/string_object.h:
+ Removed many rendundant implementations of implementsCall from subclasses of
+ InternalFunctionImp.
+
+2006-02-21 Darin Adler <darin@apple.com>
+
+ - fixed build
+
+ * kjs/internal.cpp: (KJS::InternalFunctionImp::implementsCall):
+ Oops, fixed name.
+
+2006-02-21 Darin Adler <darin@apple.com>
+
+ Change suggested by Mitz.
+
+ - http://bugs.webkit.org/show_bug.cgi?id=7402
+ REGRESSION: Methods do not execute
+
+ * kjs/internal.h: Add implementsHasCall to InternalFunctionImp.
+ * kjs/internal.cpp: (KJS::InternalFunctionImp::implementsHasCall):
+ Return true. All the classes derived from InternalFunctionImp need
+ to return true from this -- later we can remove all the extra
+ implementations too.
+
+2006-02-21 Maciej Stachowiak <mjs@apple.com>
+
+ - fix build breakage caused by last-minute change to my patch
+
+ * kjs/lookup.h:
+
+2006-02-20 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Geoff and Darin.
+
+ Patch from Maks Orlovich, based on work by David Faure, hand-applied and
+ significantly reworked by me.
+
+ - Patch: give internal function names (KJS merge)
+ http://bugs.webkit.org/show_bug.cgi?id=6279
+
+ * tests/mozilla/expected.html: Updated for newly fixed test.
+
+ * kjs/array_object.cpp:
+ (ArrayProtoFunc::ArrayProtoFunc):
+ * kjs/array_object.h:
+ * kjs/bool_object.cpp:
+ (BooleanPrototype::BooleanPrototype):
+ (BooleanProtoFunc::BooleanProtoFunc):
+ * kjs/bool_object.h:
+ * kjs/date_object.cpp:
+ (KJS::DateProtoFunc::DateProtoFunc):
+ (KJS::DateObjectImp::DateObjectImp):
+ (KJS::DateObjectFuncImp::DateObjectFuncImp):
+ * kjs/error_object.cpp:
+ (ErrorPrototype::ErrorPrototype):
+ (ErrorProtoFunc::ErrorProtoFunc):
+ * kjs/error_object.h:
+ * kjs/function.cpp:
+ (KJS::FunctionImp::FunctionImp):
+ (KJS::GlobalFuncImp::GlobalFuncImp):
+ * kjs/function.h:
+ * kjs/function_object.cpp:
+ (FunctionPrototype::FunctionPrototype):
+ (FunctionProtoFunc::FunctionProtoFunc):
+ (FunctionProtoFunc::callAsFunction):
+ * kjs/function_object.h:
+ * kjs/internal.cpp:
+ (KJS::InterpreterImp::initGlobalObject):
+ (KJS::InternalFunctionImp::InternalFunctionImp):
+ * kjs/internal.h:
+ (KJS::InternalFunctionImp::functionName):
+ * kjs/lookup.h:
+ (KJS::staticFunctionGetter):
+ (KJS::HashEntryFunction::HashEntryFunction):
+ (KJS::HashEntryFunction::implementsCall):
+ (KJS::HashEntryFunction::toBoolean):
+ (KJS::HashEntryFunction::implementsHasInstance):
+ (KJS::HashEntryFunction::hasInstance):
+ * kjs/math_object.cpp:
+ (MathFuncImp::MathFuncImp):
+ * kjs/math_object.h:
+ * kjs/number_object.cpp:
+ (NumberPrototype::NumberPrototype):
+ (NumberProtoFunc::NumberProtoFunc):
+ * kjs/number_object.h:
+ * kjs/object.cpp:
+ (KJS::JSObject::putDirectFunction):
+ (KJS::Error::create):
+ * kjs/object.h:
+ * kjs/object_object.cpp:
+ (ObjectPrototype::ObjectPrototype):
+ (ObjectProtoFunc::ObjectProtoFunc):
+ * kjs/object_object.h:
+ * kjs/regexp_object.cpp:
+ (RegExpPrototype::RegExpPrototype):
+ (RegExpProtoFunc::RegExpProtoFunc):
+ * kjs/regexp_object.h:
+ * kjs/string_object.cpp:
+ (StringProtoFunc::StringProtoFunc):
+ (StringObjectImp::StringObjectImp):
+ (StringObjectFuncImp::StringObjectFuncImp):
+ * kjs/string_object.h:
+
+2006-02-20 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin, with help from Eric, Maciej.
+
+ - More changes to support super-accurate JS iBench. Doesn't work on
+ Windows. (Doesn't break Windows, either.) I've filed
+ [http://bugs.webkit.org/show_bug.cgi?id=7399] about that.
+
+ * kjs/interpreter.cpp:
+ (KJS::Interpreter::evaluate): Print line numbers with exception output
+ * kjs/testkjs.cpp: Changed " *" to "* " because Eric says that's the
+ way we roll with .cpp files.
+ (StopWatch::StopWatch): New class. Provides microsecond-accurate
+ timings.
+ (StopWatch::~StopWatch):
+ (StopWatch::start):
+ (StopWatch::stop):
+ (StopWatch::getElapsedMS):
+ (TestFunctionImp::callAsFunction): Added missing return statement.
+ Fixed up "run" to use refactored helper functions. Removed bogus
+ return statement from "quit" case. Made "print" output to stdout
+ instead of stderr because that makes more sense, and PERL handles
+ stdout better.
+ (main): Factored out KXMLCore unit tests. Removed custom exception
+ printing code because the interpreter prints exceptions for you. Added
+ a "delete" call for the GlobalImp we allocate.
+ (testIsInteger): New function, result of refacotring.
+ (createStringWithContentsOfFile): New function, result of refactoring.
+ Renamed "code" to "buffer" to match factored-out-ness.
+
+2006-02-20 Eric Seidel <eseidel@apple.com>
+
+ Reviewed by hyatt.
+
+ Fix "Copy ICU DLLs..." phase.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.vcproj/JavaScriptCore/build-generated-files.sh:
+
+2006-02-19 Darin Adler <darin@apple.com>
+
+ - renamed ERROR to LOG_ERROR to fix build
+ presumably Maciej had this change and forgot to land it
+
+ * kjs/collector.cpp: Removed now-unneeded #undef ERROR.
+ * kxmlcore/Assertions.h: Renamed ERROR to LOG_ERROR.
+ * kxmlcore/FastMalloc.cpp: Changed MESSAGE macro to use LOG_ERROR.
+
+2006-02-18 Mitz Pettel <opendarwin.org@mitzpettel.com>
+
+ Test: fast/js/toString-exception.html
+
+ Reviewed by Maciej.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=7343
+ REGRESSION: fast/js/toString-overrides.html fails when run multiple times
+
+ * kjs/array_object.cpp:
+ (ArrayProtoFunc::callAsFunction): Remove the object from the visited elements set before
+ returning an error.
+
+2006-02-18 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - http://bugs.webkit.org/show_bug.cgi?id=7345
+ add insert and remove to KXMLCore::Vector
+
+ * kxmlcore/Vector.h: Added "moveOverlapping", which is used in both
+ insert and remove to slide elements within the vector. Also added
+ "insert" and "remove" functions.
+
+2006-02-16 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by John.
+
+ - Fixed <rdar://problem/4448534> TOT REGRESSION: crash in KJS::
+ Bindings::Instance::deref when leaving page @ gigaom.com
+
+ * bindings/c/c_instance.cpp:
+ (KJS::Bindings::CInstance::~CInstance): Since we cache the class object
+ globally, we shouldn't delete it, so don't.
+
+2006-02-16 Timothy Hatcher <timothy@apple.com>
+
+ Added -Wno-deprecated-declarations to all the ObjC binding files to prevent deprecation
+ warnings. Using <rdar://problem/4448350> to track this.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * bindings/objc/objc_jsobject.h: Removed empty file.
+ * bindings/objc/objc_jsobject.mm: Removed empty file.
+
+2006-02-16 Tim Omernick <timo@apple.com>
+
+ Reviewed by Geoff.
+
+ <rdar://problem/4428609> Flash Player 8.0.22 can crash Safari (and WebKit apps) with
+ javascript disabled (7015)
+
+ * bindings/NP_jsobject.cpp:
+ (_NPN_CreateNoScriptObject):
+ Returns an NPObject which is not bound to a JavaScript object. This kind of NPObject
+ can be given to a plugin as the "window script object" when JavaScript is disabled.
+ The object has a custom NPClass, NPNoScriptObjectClass, which has no defined methods.
+ Because of this, none of the NPN_* functions called by the plugin on this "no script
+ object" will cause entry into JavaScript code.
+ (_NPN_InvokeDefault):
+ Make sure the NPVariant is filled before returning from this function. This never
+ mattered before because we never reached this case, having only created NPObjects of
+ the class NPScriptObjectClass.
+ (_NPN_Invoke):
+ ditto
+ (_NPN_Evaluate):
+ ditto
+ (_NPN_GetProperty):
+ ditto
+
+ * bindings/NP_jsobject.h:
+ Declared _NPN_CreateNoScriptObject().
+
+2006-02-16 Darin Adler <darin@apple.com>
+
+ Reviewed by me, change by Peter Kuemmel.
+
+ * kjs/operations.cpp: (KJS::isNegInf): Fix Windows code, which was
+ checking for positive infinity (rolling in fix from KDE side).
+
+2006-02-15 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej, Eric.
+
+ - JavaScriptCore half of fix for <rdar://problem/4176077> CrashTracer: 6569
+ crashes in DashboardClient at com.apple.JavaScriptCore:
+ KJS::Bindings::ObjcFallbackObjectImp::type()
+
+ WebCore and JavaScriptCore weren't sharing Instance objects very
+ nicely. I made them use RefPtrs, and sent them to bed without dessert.
+
+ * bindings/jni/jni_instance.cpp: Made _instance a RefPtr
+ (JavaInstance::~JavaInstance):
+ (JObjectWrapper::JObjectWrapper):
+ * bindings/jni/jni_instance.h:
+ (KJS::Bindings::JObjectWrapper::ref):
+ (KJS::Bindings::JObjectWrapper::deref):
+ * bindings/jni/jni_runtime.cpp: Made _array a RefPtr
+ (JavaArray::~JavaArray):
+ (JavaArray::JavaArray):
+ * bindings/jni/jni_runtime.h:
+ (KJS::Bindings::JavaArray::operator=):
+ * bindings/objc/objc_runtime.h:
+ - Prohibited copying because that would muss the ref count.
+ - Prohibited construction without instance because an instance wrapper
+ without an instance is almost certainly a bug.
+ * bindings/objc/objc_runtime.mm:
+ (ObjcFallbackObjectImp::ObjcFallbackObjectImp):
+ * bindings/runtime.cpp:
+ (KJS::Bindings::Instance::Instance):
+ (KJS::Bindings::Instance::createBindingForLanguageInstance):
+ (KJS::Bindings::Instance::createRuntimeObject):
+ * bindings/runtime.h:
+ (KJS::Bindings::Instance::ref):
+ (KJS::Bindings::Instance::deref):
+ * bindings/runtime_object.cpp:
+ (RuntimeObjectImp::RuntimeObjectImp):
+ (RuntimeObjectImp::fallbackObjectGetter):
+ (RuntimeObjectImp::fieldGetter):
+ (RuntimeObjectImp::methodGetter):
+ (RuntimeObjectImp::getOwnPropertySlot):
+ (RuntimeObjectImp::put):
+ (RuntimeObjectImp::canPut):
+ * bindings/runtime_object.h:
+ - Removed ownsInstance data member because RefPtr takes care of
+ instance lifetime now.
+ - Prohibited copying because that would muss the ref count.
+ - Prohibited construction without instance because an instance wrapper
+ without an instance is almost certainly a bug.
+ (KJS::RuntimeObjectImp::getInternalInstance):
+
+2006-02-15 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by John.
+
+ - Applied the 4330457 change to CClass and ObjcClass as well.
+
+ Once plugins work in DumpRenderTree, running run-webkit-tests --leaks
+ will catch this.
+
+ This change isn't as critical because CClass and ObjcClass objects get
+ cached globally and never deleted, but it's good practice, in case we
+ ever do decide to delete CClass and ObjcClass objects.
+
+ This change requires prohibiting copying, because we don't do any
+ intelligent ref-counting -- when a Class is destroyed, it destroys its
+ methods and fields unconditionally. (Java classes already prohibited
+ copying.)
+
+ * bindings/c/c_class.cpp:
+ - Merged _commonInit and _commonDelete into constructor and destructor.
+ (CClass::CClass):
+ (CClass::~CClass):
+ (CClass::methodsNamed): Added delete callbacks
+ (CClass::fieldNamed): Added delete callbacks
+ * bindings/c/c_class.h: Prohibited copying
+ * bindings/c/c_instance.cpp:
+ (KJS::Bindings::CInstance::getClass): Changed to use the preferred
+ class factory method, to take advantage of the global cache.
+
+ [ Repeated changes applied to CClass for ObjcClass: ]
+
+ * bindings/objc/objc_class.h:
+ * bindings/objc/objc_class.mm:
+ (KJS::Bindings::ObjcClass::ObjcClass):
+ (KJS::Bindings::ObjcClass::~ObjcClass):
+ (KJS::Bindings::ObjcClass::methodsNamed):
+ (KJS::Bindings::ObjcClass::fieldNamed):
+ * bindings/objc/objc_runtime.h:
+ (KJS::Bindings::ObjcMethod::ObjcMethod): Initialized uninitialized
+ variable to prevent bad CFRelease.
+ (KJS::Bindings::ObjcMethod::~ObjcMethod): Removed erroneous ';' from
+ if statement to prevent bad CFRelease.
+ * bindings/objc/objc_runtime.cpp: Changed to use the preferred
+ ObjectStructPtr, for clarity.
+
+2006-02-14 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by John.
+
+ - Fixed <rdar://problem/4330457> CrashTracer: [REGRESSION] 3763 crashes
+ in Safari at com.apple.JavaScriptCore: KJS::Bindings::JavaInstance::
+ getClass const + 56
+
+ Once plugins work in DumpRenderTree, running run-webkit-tests --leaks
+ will catch this.
+
+ This was a memory leak in the bindings code. The leak was so extreme
+ that it would cause Safari or the JVM to abort from lack of memory.
+ Upon construction, Class objects create field and method objects,
+ storing them in CFDictionaries. The bug was that upon destruction, the
+ class objects released the dictionaries but didn't destroy the stored
+ objects.
+
+ The fix is to supply CFDictionary callbacks for destroying the values
+ added to the dictionary.
+
+ * bindings/jni/jni_class.cpp:
+ (JavaClass::JavaClass): Added delete callbacks
+ * bindings/runtime.cpp: Added definitions for delete callbacks
+ (KJS::Bindings::deleteMethodList):
+ (KJS::Bindings::deleteMethod):
+ (KJS::Bindings::deleteField):
+ * bindings/runtime.h: Added declarations for delete callbacks
+
+2006-02-14 Timothy Hatcher <timothy@apple.com>
+
+ Reviewed by Justin.
+
+ Fixed <rdar://problem/4415050> STD: WebCore build steps use echo -n, which will change
+ behavior due to POSIX version of sh
+
+ * JavaScriptCore.xcodeproj/project.pbxproj: removed the use of echo -n, replaced with printf ""
+
+2006-02-13 Dave Hyatt <hyatt@apple.com>
+
+ Fix Win32 bustage in JavaScriptCore.
+
+ Reviewed by darin
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ Add JSImmediate to the Win32 project.
+
+ * kjs/JSImmediate.h:
+ (KJS::JSImmediate::fromDouble):
+ (KJS::JSImmediate::toDouble):
+ (KJS::JSImmediate::NanAsBits):
+ (KJS::JSImmediate::oneAsBits):
+ Win32 needs explicit returns after abort() for non-void functions.
+
+ * kjs/testkjs.cpp:
+ (run):
+ Win32 catches a bug in testkjs! The "return 2" should actually
+ have been a return false.
+
+ * kjs/value.h:
+ The extern decls of NaN and Inf need to be const.
+
+=== JavaScriptCore-521.7 ===
+
+2006-02-13 Timothy Hatcher <timothy@apple.com>
+
+ Reviewed by Darin.
+
+ Replaced the old NS_DURING exception blocking with @try/@catch.
+
+ * JavaScriptCorePrefix.h: undef try and catch to workaround a C++ conflict
+ * bindings/objc/objc_instance.mm:
+ (ObjcInstance::invokeMethod):
+ (ObjcInstance::invokeDefaultMethod):
+ (ObjcInstance::setValueOfUndefinedField):
+ (ObjcInstance::getValueOfUndefinedField):
+ * bindings/objc/objc_runtime.mm:
+ (ObjcField::valueFromInstance):
+ (ObjcField::setValueToInstance):
+ (ObjcArray::setValueAt):
+ (ObjcArray::valueAt):
+
+2006-02-13 Darin Adler <darin@apple.com>
+
+ - fix a couple problems building on Windows, based on requests
+ from Krzysztof Kowalczyk <kkowalczyk@gmail.com>
+
+ * kjs/JSImmediate.h: Change code using non-standard u_int32/64_t types
+ to the standard uint32/64_t. Also removed curious "isIEEE()" function
+ that checked the sizes of some types (and type sizes alone don't tell you if
+ the floating point conforms to the IEEE-standard). Added missing include
+ of <stdint.h>.
+
+ * kjs/property_slot.h: Added missing include of <assert.h>.
+
+2006-02-12 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by darin.
+
+ Cleaned up testkjs, added new "run" functionality to allow scripting
+ tests from within JS. ("run" is a part of my new super-accurate
+ JS iBench.)
+
+ No regressions in run-javascriptcore-tests.
+
+ * kjs/testkjs.cpp:
+ (GlobalImp::className):
+ (TestFunctionImp::):
+ (TestFunctionImp::callAsFunction):
+ (main):
+ (run):
+
+2006-02-11 Alexey Proskuryakov <ap@nypop.com>
+
+ Reviewed by Darin.
+
+ - improve fix for http://bugs.webkit.org/show_bug.cgi?id=5163
+ RealPlayer.GetTitle() Crashes Safari/Dashboard
+
+ * bindings/c/c_utility.cpp: (KJS::Bindings::convertUTF8ToUTF16):
+ Use kCFStringEncodingISOLatin1 rather than kCFStringEncodingWindowsLatin1,
+ because the latter encoding has holes, and conversion can still fail.
+
+2006-02-10 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin.
+
+ - Inlined RefPtr assignment operators. .7% performance win on
+ super-accurate JS iBench.
+
+ * kxmlcore/RefPtr.h:
+ (KXMLCore::::operator):
+
+2006-02-10 Geoffrey Garen <ggaren@apple.com>
+
+ No review needed, just a build fix. This time for sure.
+
+ * kjs/JSType.h:
+
+2006-02-10 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by eric.
+
+ - Fixed build. As it goes without saying, I will not mention that I
+ blame Kevin.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * kjs/JSImmediate.cpp:
+ (KJS::JSImmediate::toObject):
+
+2006-02-09 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by mjs.
+
+ - Fixed <rdar://problem/4343730> Should switch ConstantValues (null,
+ undefined, true, false) from JS objects to immediate values similar to
+ SimpleNumber
+
+ 2.0% performance gain on my new super-accurate version of JS iBench.
+ (I promise to land a version of it soon.)
+
+ The gist of the change:
+ (1) The SimpleNumber class (simple_number.h) is now the JSImmediate
+ class (JSImmediate.h/.cpp), and it handles not only numbers but also
+ null, undefined, true, and false.
+ (2) JSImmediate provides convenience methods for the bit masking
+ necessary to encode and decode immediate values.
+ (3) ConstantValues, BooleanImp, NullImp, and UndefinedImp are gone.
+ (4) JSCell no longer implements functions like getBoolean, because
+ only a JSImmediate can be a boolean.
+ (5) JSImmediate no longer uses ALWAYS_INLINE because there's no need,
+ and ALWAYS_INLINE is a non-portable option of last resort.
+ (6) Type is now JSType, and it resides in its own file, JSType.h.
+ Since I was there, I did some header include sorting as part of this
+ change.
+
+ The rest pretty much explains itself.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj: Removed simple_number.h,
+ added JSImmediate.h/.cpp.
+ * bindings/c/c_instance.cpp:
+ (KJS::Bindings::CInstance::defaultValue):
+ * bindings/c/c_instance.h:
+ * bindings/c/c_utility.cpp:
+ (KJS::Bindings::convertValueToNPVariant):
+ * bindings/jni/jni_instance.cpp:
+ (JavaInstance::defaultValue):
+ * bindings/jni/jni_instance.h:
+ * bindings/jni/jni_jsobject.cpp:
+ (JavaJSObject::convertValueToJObject):
+ * bindings/objc/WebScriptObject.mm:
+ (+[WebScriptObject _convertValueToObjcValue:originExecutionContext:executionContext:]):
+ Standardized calls to use getXXX instead of hand-rolling JSValue
+ functionality.
+ * bindings/objc/objc_instance.h:
+ * bindings/objc/objc_instance.mm:
+ (ObjcInstance::getValueOfUndefinedField):
+ (ObjcInstance::defaultValue):
+ * bindings/objc/objc_runtime.h:
+ * bindings/objc/objc_runtime.mm:
+ (ObjcFallbackObjectImp::type):
+ (ObjcFallbackObjectImp::defaultValue):
+ * bindings/runtime.h:
+ (KJS::Bindings::Instance::getValueOfUndefinedField):
+ * bindings/runtime_object.cpp:
+ (RuntimeObjectImp::defaultValue):
+ * bindings/runtime_object.h:
+ * kjs/JSImmediate.h: Added.
+ (KJS::JSImmediate::isImmediate):
+ (KJS::JSImmediate::isNumber):
+ (KJS::JSImmediate::isBoolean):
+ (KJS::JSImmediate::isUndefinedOrNull):
+ (KJS::JSImmediate::fromDouble):
+ (KJS::JSImmediate::toDouble):
+ (KJS::JSImmediate::toBoolean):
+ (KJS::JSImmediate::trueImmediate):
+ (KJS::JSImmediate::falseImmediate):
+ (KJS::JSImmediate::NaNImmediate):
+ (KJS::JSImmediate::undefinedImmediate):
+ (KJS::JSImmediate::nullImmediate):
+ (KJS::JSImmediate::tag):
+ (KJS::JSImmediate::unTag):
+ (KJS::JSImmediate::getTag):
+ (KJS::JSImmediate::):
+ (KJS::JSImmediate::isIEEE):
+ (KJS::JSImmediate::is32bit):
+ (KJS::JSImmediate::is64bit):
+ (KJS::JSImmediate::NanAsBits):
+ (KJS::JSImmediate::zeroAsBits):
+ (KJS::JSImmediate::oneAsBits):
+ * kjs/JSLock.cpp:
+ (KJS::JSLock::lock): Removed hack-o-rama to initialize ConstantValues.
+ * kjs/JSType.h: Added.
+ * kjs/collector.cpp:
+ (KJS::Collector::protect):
+ (KJS::Collector::unprotect):
+ (KJS::Collector::collect):
+ * kjs/internal.cpp:
+ (KJS::StringImp::toPrimitive):
+ (KJS::NumberImp::toPrimitive):
+ (KJS::NumberImp::toBoolean):
+ (KJS::GetterSetterImp::toPrimitive):
+ * kjs/internal.h:
+ (KJS::StringImp::type):
+ (KJS::NumberImp::type):
+ * kjs/object.cpp:
+ (KJS::JSObject::type):
+ (KJS::tryGetAndCallProperty): Replaced "Are you one of the six things
+ I'm looking for?" test with "Are you not the one thing I'm not looking
+ for" test.
+ (KJS::JSObject::defaultValue):
+ (KJS::JSObject::toPrimitive):
+ * kjs/object.h:
+ (KJS::GetterSetterImp::type):
+ (KJS::JSValue::isObject):
+ * kjs/operations.cpp:
+ (KJS::equal):
+ (KJS::strictEqual):
+ (KJS::add):
+ * kjs/reference.cpp:
+ (KJS::Reference::deleteValue):
+ * kjs/simple_number.h: Removed.
+ * kjs/string_object.cpp:
+ (StringInstance::getOwnPropertySlot): fixed indentation
+ * kjs/value.cpp:
+ (KJS::JSValue::toObject):
+ (KJS::jsNumberCell): New function to quarantine a PIC branch -- allows
+ us to inline jsNumber without adding PIC branches to callers.
+ * kjs/value.h:
+ (KJS::jsUndefined):
+ (KJS::jsNull):
+ (KJS::jsNaN):
+ (KJS::jsBoolean):
+ (KJS::jsNumber):
+ (KJS::JSValue::downcast):
+ (KJS::JSValue::isUndefinedOrNull):
+ (KJS::JSValue::isBoolean):
+ (KJS::JSValue::isNumber):
+ (KJS::JSValue::isString):
+ (KJS::JSValue::isObject):
+ (KJS::JSValue::getBoolean):
+ (KJS::JSValue::getNumber):
+ (KJS::JSValue::getString):
+ (KJS::JSValue::getObject):
+ (KJS::JSValue::getUInt32):
+ (KJS::JSValue::mark): Replaced !JSImmediate::is() test with assertion,
+ resulting in a slight performance gain. Callers should always check
+ !marked() before calling mark(), so it's impossible to call mark on
+ a JSImmediate.
+ (KJS::JSValue::marked):
+ (KJS::JSValue::type):
+ (KJS::JSValue::toPrimitive):
+ (KJS::JSValue::toBoolean):
+ (KJS::JSValue::toNumber):
+ (KJS::JSValue::toString):
+
+2006-02-06 Eric Seidel <eseidel@apple.com>
+
+ Add svn:ignore properties for visual studio internals.
+
+2006-02-06 Alexey Proskuryakov <ap@nypop.com>
+
+ Reviewed by Darin.
+
+ - Refactor DateInstance to provide direct access to data. Several WIN32 modifications.
+ http://bugs.webkit.org/show_bug.cgi?id=7107
+
+ - No tests added - only changed functionality on WIN32, which should be covered by
+ existing tests.
+
+ * kjs/date_object.cpp:
+ (gmtoffset): On WIN32, use the recommended global (_timezone rather than timezone).
+ Updated comments.
+ (KJS::timeZoneOffset): Removed, was basically the same as the above.
+ (KJS::formatTime): Pass an UTC flag - UTC/local cannot be correctly selected on
+ Windows based on struct tm itself.
+ (KJS::DateInstance::getTime): Added.
+ (KJS::DateInstance::getUTCTime): Added.
+ (KJS::millisecondsToTM): Factored out from DateProtoFunc::callAsFunction().
+ (KJS::DateObjectImp::callAsFunction): Use the new parameter to formatTime().
+ (KJS::DateProtoFunc::callAsFunction): Updated for the other changes. The code for
+ GetTimezoneOffset was incorrect on WIN32 - _daylight global has nothing to do
+ with daylight savings time being in effect.
+
+ * kjs/date_object.h: Added prototypes for new functions.
+
+2006-02-05 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Anders.
+
+ - fixed ~1100 KJS::Node leaked on layout tests
+ http://bugs.webkit.org/show_bug.cgi?id=7097
+
+ * kjs/internal.cpp:
+ (KJS::Parser::noteNodeCycle):
+ (KJS::Parser::removeNodeCycle):
+ (KJS::clearNewNodes):
+ * kjs/internal.h:
+ * kjs/nodes.cpp:
+ (ElementNode::breakCycle):
+ (PropertyListNode::breakCycle):
+ (ArgumentListNode::breakCycle):
+ (StatListNode::StatListNode):
+ (StatListNode::breakCycle):
+ (VarDeclListNode::breakCycle):
+ (BlockNode::BlockNode):
+ (ClauseListNode::breakCycle):
+ (CaseBlockNode::CaseBlockNode):
+ (ParameterNode::breakCycle):
+ (SourceElementsNode::SourceElementsNode):
+ (SourceElementsNode::breakCycle):
+ * kjs/nodes.h:
+ (KJS::Node::breakCycle):
+ (KJS::ElementNode::ElementNode):
+ (KJS::ArrayNode::ArrayNode):
+ (KJS::PropertyListNode::PropertyListNode):
+ (KJS::ObjectLiteralNode::ObjectLiteralNode):
+ (KJS::ArgumentListNode::ArgumentListNode):
+ (KJS::ArgumentsNode::ArgumentsNode):
+ (KJS::VarDeclListNode::VarDeclListNode):
+ (KJS::VarStatementNode::VarStatementNode):
+ (KJS::ForNode::ForNode):
+ (KJS::CaseClauseNode::CaseClauseNode):
+ (KJS::ClauseListNode::ClauseListNode):
+ (KJS::ParameterNode::ParameterNode):
+ (KJS::FuncExprNode::FuncExprNode):
+ (KJS::FuncDeclNode::FuncDeclNode):
+
+2006-02-05 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Hyatt.
+
+ - fix default traits for classes to make sure default constructors get called
+
+ * kxmlcore/VectorTraits.h:
+ (KXMLCore::):
+
+2006-02-04 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=5210
+ REGRESSION: for/in loop with var changes global variable instead of making local
+
+ Test: fast/js/for-in-var-scope.html
+
+ * kjs/nodes.cpp:
+ (valueForReadModifyAssignment): Use ALWAYS_INLINE macro.
+ (ForInNode::execute): Break out of the scope chain loop once we find and set the
+ loop variable. We don't want to set multiple loop variables.
+ (ForInNode::processVarDecls): Process the declaration of the loop variable.
+
+ - other cleanup
+
+ * kjs/object.cpp: (KJS::tryGetAndCallProperty): Use ALWAYS_INLINE macro.
+ * kxmlcore/FastMalloc.cpp: Change to use ALWAYS_INLINE macro from AlwaysInline.h
+ instead of defining it here a second time.
+
+2006-02-04 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Hyatt.
+
+ - change JavaScript collector statistics calls to use HashCountedSet instead
+ of CFSet; other misc cleanup
+ http://bugs.webkit.org/show_bug.cgi?id=7072
+
+ * kjs/collector.cpp:
+ (KJS::Collector::numProtectedObjects): renamed from numReferencedObjects
+ (KJS::typeName):
+ (KJS::Collector::rootObjectTypeCounts): renamed from rootObjectClasses,
+ use HashSet
+ * kjs/collector.h:
+ (KJS::Collector::isOutOfMemory): Renamed from outOfMemory.
+ * kjs/nodes.cpp:
+
+2006-02-03 Timothy Hatcher <timothy@apple.com>
+
+ Reviewed by Justin.
+
+ Renamed configuration names to Debug, Release and Production.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2006-02-02 George Staikos <staikos@opensource.apple.com>
+
+ Reviewed by Maciej.
+
+ * kjs/lookup.h: Fix compile, merged from KDE.
+
+2006-02-02 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - http://bugs.webkit.org/show_bug.cgi?id=7005
+ add Noncopyable, OwnPtr, OwnArrayPtr to KXMLCore
+
+ * kxmlcore/Noncopyable.h: Added.
+ * kxmlcore/OwnArrayPtr.h: Added.
+ * kxmlcore/OwnPtr.h: Added.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj: Added new files.
+
+ * kjs/function.h:
+ * kjs/function.cpp: Use OwnPtr for Parameter pointers.
+
+ * kjs/internal.h: Use Noncopyable for LabelStack.
+
+ * kjs/list.cpp: Use OwnArrayPtr for overflow.
+
+ * kjs/property_map.h:
+ * kjs/property_map.cpp: Use OwnArrayPtr for SavedProperties.
+ Use Vector for some stack buffers.
+
+ * kjs/regexp_object.h:
+ * kjs/regexp_object.cpp: Use OwnArrayPtr for lastOvector.
+
+2006-01-31 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin.
+
+ - fixed leak of hundreds of thousands of JS parser nodes on the layout tests, and added an exit counter
+ that would catch them
+
+ * kjs/nodes.cpp:
+ (NodeCounter::~NodeCounter): Added debug-only node counter.
+ (Node::Node):
+ (Node::~Node):
+ * kxmlcore/VectorTraits.h: Simple classes like RefPtr do in fact need destruction.
+
+2006-01-31 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - added deleteAllValues for HashSet as well as HashMap
+ - fixed conversion from const_iterator to iterator, which I broke a while back
+
+ * kxmlcore/HashMap.h: Updated copyright date.
+ * kxmlcore/HashSet.h: (KXMLCore::deleteAllValues): Added.
+ * kxmlcore/HashTable.h: (KXMLCore::HashTableIterator::operator const_iterator): Added.
+
+2006-01-31 Tim Omernick <timo@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ * bindings/c/c_utility.cpp:
+ (KJS::Bindings::convertUTF8ToUTF16):
+ Fixed an invalid assertion that UTF8Chars is not NULL. It is valid for it to be NULL as long as
+ UTF8Length is 0.
+ This fixes an assertion failure on TOT at <http://www.musicindiaonline.com/p/x/tJO0OOBME9.As1NMvHdW/>,
+ where JavaScript is getting a NULL string back from some call on the Real Player plugin.
+
+2006-01-30 Anders Carlsson <andersca@mac.com>
+
+ Reviewed by Darin.
+
+ Fix http://bugs.webkit.org/show_bug.cgi?id=6907
+ REGRESSION: United.com menus messed up due to document.all/MSIE sniff
+
+ * kjs/nodes.cpp:
+ (typeStringForValue):
+ Return "undefined" if the given object should masquerade as undefined.
+
+ * kjs/object.h:
+ (KJS::JSObject::masqueradeAsUndefined):
+ Rename from isEqualToNull.
+
+ * kjs/operations.cpp:
+ (KJS::equal):
+ Update for name change.
+
+2006-01-29 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin.
+
+ - properly define Vector assignment operator; the private version was accidentally left
+ in, and the template version is not enough to replace the default
+
+ * kxmlcore/Vector.h:
+ (KXMLCore::Vector::operator=):
+
+2006-01-29 Eric Seidel <eseidel@apple.com>
+
+ Reviewed by darin.
+
+ Fix the build by applying a GCC-specific namespace hack.
+
+ * kjs/lookup.h:
+
+2006-01-29 Eric Seidel <eseidel@apple.com>
+
+ Reviewed by hyatt.
+
+ Fix build on Win32.
+
+ * kjs/lookup.h: fixed ::cacheGlobalObject
+ * kxmlcore/Vector.h:
+ (KXMLCore::Vector::operator[]): use unsigned long
+
+2006-01-29 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Dave Hyatt.
+
+ * kxmlcore/Vector.h:
+ (KXMLCore::Vector::operator[]): Add unsigned overload
+
+2006-01-28 Darin Adler <darin@apple.com>
+
+ Reviewed by John Sullivan.
+
+ - http://bugs.webkit.org/show_bug.cgi?id=6895
+ include exception names in JavaScript form of DOM exception
+
+ * khtml/ecma/kjs_binding.cpp: (KJS::setDOMException): Include the name of the
+ exception in the error message.
+
+2006-01-28 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin.
+
+ - miscellaneous Vector improvements
+
+ * kxmlcore/Vector.h:
+ (KXMLCore::Vector::at): Add range-checking asserts.
+ (KXMLCore::Vector::first): Added as a convenience.
+ (KXMLCore::Vector::last): Convenience for stack-style use.
+ (KXMLCore::Vector::removeLast): ditto
+
+2006-01-28 Darin Adler <darin@apple.com>
+
+ Reviewed by John Sullivan
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=6870
+ REGRESSION: JavaScript Date constructor won't accept another Date object
+
+ Test: fast/js/date-constructor.html
+
+ * kjs/date_object.cpp: (KJS::DateObjectImp::construct):
+ Added a special case for constructing one date from another (to avoid losing
+ milliseconds, which are not in the text form, to match Firefox), and changed
+ the base code to convert to primitive before checking for string to match
+ the standard. Also corrected a couple silly things in the "construct from
+ current time" code path (removed a floor that does no good, and changed
+ the constant used to convert microseconds to milliseconds to be a 1000
+ rather than "msPerSecond").
+
+2006-01-28 Darin Adler <darin@apple.com>
+
+ * kjs/create_hash_table: Added missing license.
+
+2006-01-28 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Dave Hyatt.
+
+ - added a Vector class
+ http://bugs.webkit.org/show_bug.cgi?id=6894
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * kjs/internal.cpp:
+ (KJS::Parser::saveNewNode): Apply Vector.
+ (KJS::clearNewNodes): ditto
+ * kjs/number_object.cpp:
+ (integer_part_noexp): ditto
+ (char_sequence): ditto
+ * kjs/ustring.cpp:
+ (KJS::UString::UTF8String): ditto
+ * kxmlcore/HashMap.h:
+ (KXMLCore::deleteAllValues): Tweaked this to only apply to HashMap,
+ other versions are useful for other containers.
+ * kxmlcore/Vector.h: Added. Implemented a Vector class, which should
+ be usable for all Array/QVector style purposes, and also as a stack buffer
+ with oversize handling. Also some helper classes to make vector operations
+ as efficient as possible for POD types and for simple non-PODs like RefPtr.
+ (KXMLCore::):
+ (KXMLCore::VectorTypeOperations::destruct):
+ (KXMLCore::VectorTypeOperations::initialize):
+ (KXMLCore::VectorTypeOperations::move):
+ (KXMLCore::VectorTypeOperations::uninitializedCopy):
+ (KXMLCore::VectorTypeOperations::uninitializedFill):
+ (KXMLCore::VectorBuffer::VectorBuffer):
+ (KXMLCore::VectorBuffer::~VectorBuffer):
+ (KXMLCore::VectorBuffer::deallocateBuffer):
+ (KXMLCore::VectorBuffer::inlineBuffer):
+ (KXMLCore::Vector::Vector):
+ (KXMLCore::Vector::~Vector):
+ (KXMLCore::Vector::size):
+ (KXMLCore::Vector::capacity):
+ (KXMLCore::Vector::isEmpty):
+ (KXMLCore::Vector::at):
+ (KXMLCore::Vector::operator[]):
+ (KXMLCore::Vector::data):
+ (KXMLCore::Vector::operator T*):
+ (KXMLCore::Vector::operator const T*):
+ (KXMLCore::Vector::begin):
+ (KXMLCore::Vector::end):
+ (KXMLCore::Vector::clear):
+ (KXMLCore::Vector::fill):
+ (KXMLCore::Vector::operator=):
+ (KXMLCore::::Vector):
+ (KXMLCore::::operator):
+ (KXMLCore::::fill):
+ (KXMLCore::::expandCapacity):
+ (KXMLCore::::resize):
+ (KXMLCore::::reserveCapacity):
+ (KXMLCore::::append):
+ (KXMLCore::deleteAllValues):
+ * kxmlcore/VectorTraits.h: Added.
+ (KXMLCore::VectorTraits): Traits to enable making Vector efficient for
+ simple types.
+
+2006-01-28 Alexey Proskuryakov <ap@nypop.com>
+
+ Reviewed by Darin.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=5163
+ RealPlayer.GetTitle() Crashes Safari/Dashboard
+
+ * bindings/c/c_utility.cpp: (KJS::Bindings::convertUTF8ToUTF16):
+ Fallback to kCFStringEncodingWindowsLatin1 if the passed buffer is not valid UTF-8, preventing crashes.
+
+2006-01-25 George Staikos <staikos@opensource.apple.com>
+
+ Reviewed by Darin.
+
+ * kxmlcore/HashFunctions.h: Merge build fix from KDE.
+
+2006-01-25 Darin Adler <darin@apple.com>
+
+ - removed an unused source file
+
+ * kjs/pointer_hash.h: Removed.
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Removed reference to pointer_hash.h.
+
+2006-01-23 Anders Carlsson <andersca@mac.com>
+
+ Reviewed by Maciej.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=6737
+ KJS_DEFINE_PROTOTYPE should work outside of the KJS namespace
+
+ * kjs/lookup.h:
+ Prefix all KJS types with KJS:: in KJS_DEFINE_PROTOTYPE.
+
+ (cacheGlobalObject):
+ Move this out of the KJS namespace.
+
+2006-01-23 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Eric.
+
+ - renamed PointerHash to PtrHash
+ - made PtrHash the default hash function for int and pointer types that aren't further specialized
+ - added an AtomicStringImpl class to make it easier and more typesafe to identity hash atomic strings
+ - did appropriate consequent cleanup (very few places now need to declare a hash function)
+ http://bugs.webkit.org/show_bug.cgi?id=6752
+
+ * kjs/array_object.cpp:
+ (ArrayProtoFunc::callAsFunction): no need to mention PointerHash
+ * kjs/collector.cpp: ditto
+ * kjs/identifier.cpp:
+ (KXMLCore::): declare DefaultHash the new way
+ * kjs/internal.cpp: no need to mention PointerHash
+ * kjs/ustring.h:
+ * kxmlcore/HashCountedSet.h: change how we get the default hash to make it
+ easier to specialize on PtrHash
+ * kxmlcore/HashFunctions.h:
+ (KXMLCore::): renamed PointerHash to PtrHash; changed DefaultHash so that it has
+ a Hash typedef rather than being a hash function class itself; declared DefaultHash
+ for int and partializy specialized for pointer types
+ * kxmlcore/HashMapPtrSpec.h:
+ (KXMLCore::PtrHashIteratorAdapter::PtrHashIteratorAdapter): Slight tweaks for new
+ way of handling pointer hash
+ (KXMLCore::PtrHashConstIteratorAdapter::PtrHashConstIteratorAdapter): ditto
+ (KXMLCore::): ditto
+ * kxmlcore/HashMap.h: ditto
+ * kxmlcore/HashSet.h: ditto
+
+2006-01-23 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Tim Omernick.
+
+ - use classes instead of free functions for extractors, this better matches how other
+ things work and should avoid the need for hacky workarounds on other compilers
+ http://bugs.webkit.org/show_bug.cgi?id=6748
+
+ * kjs/array_object.cpp:
+ * kjs/identifier.cpp:
+ * kjs/internal.cpp:
+ * kxmlcore/HashMap.h:
+ (KXMLCore::PairFirstExtractor::extract):
+ * kxmlcore/HashMapPtrSpec.h:
+ (KXMLCore::):
+ * kxmlcore/HashSet.h:
+ (KXMLCore::IdentityExtractor::extract):
+ * kxmlcore/HashTable.h:
+ (KXMLCore::addIterator):
+ (KXMLCore::removeIterator):
+ (KXMLCore::HashTable::add):
+ (KXMLCore::HashTable::isEmptyBucket):
+ (KXMLCore::HashTable::isDeletedBucket):
+ (KXMLCore::HashTable::HashTable):
+ (KXMLCore::HashTable::lookup):
+ (KXMLCore::HashTable::add):
+ (KXMLCore::HashTable::reinsert):
+ (KXMLCore::HashTable::find):
+ (KXMLCore::HashTable::contains):
+ (KXMLCore::HashTable::remove):
+ (KXMLCore::HashTable::allocateTable):
+ (KXMLCore::HashTable::deallocateTable):
+ (KXMLCore::HashTable::expand):
+ (KXMLCore::HashTable::rehash):
+ (KXMLCore::HashTable::clear):
+ (KXMLCore::HashTable::swap):
+ (KXMLCore::HashTable::operator):
+ (KXMLCore::HashTable::checkTableConsistency):
+ (KXMLCore::HashTable::checkTableConsistencyExceptSize):
+ (KXMLCore::HashTable::invalidateIterators):
+
+2006-01-23 Maciej Stachowiak <mjs@apple.com>
+
+ Rubber stamped by Tim Hatcher.
+
+ - renamed inert() operation on HashSet, HashCountedSet and HashTable to add()
+ for consistency with HashMap
+
+ * kjs/array_object.cpp:
+ (ArrayProtoFunc::callAsFunction):
+ * kjs/collector.cpp:
+ (KJS::Collector::protect):
+ * kjs/identifier.cpp:
+ (KJS::Identifier::add):
+ * kxmlcore/HashCountedSet.h:
+ (KXMLCore::::add):
+ * kxmlcore/HashMap.h:
+ (KXMLCore::::inlineAdd):
+ * kxmlcore/HashSet.h:
+ (KXMLCore::::add):
+ * kxmlcore/HashTable.h:
+ (KXMLCore::HashTable::add):
+ (KXMLCore::::add):
+ (KXMLCore::::HashTable):
+
+2006-01-23 Justin Garcia <justin.garcia@apple.com>
+
+ Reviewed by thatcher
+
+ Turned on -O2 for B&I build.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2006-01-23 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Tim Hatcher.
+
+ - it's "Franklin Street", not "Franklin Steet"
+
+ * kjs/array_instance.h:
+ * kjs/array_object.cpp:
+ * kjs/array_object.h:
+ * kjs/bool_object.cpp:
+ * kjs/bool_object.h:
+ * kjs/collector.cpp:
+ * kjs/collector.h:
+ * kjs/completion.h:
+ * kjs/context.h:
+ * kjs/date_object.cpp:
+ * kjs/date_object.h:
+ * kjs/debugger.cpp:
+ * kjs/debugger.h:
+ * kjs/dtoa.h:
+ * kjs/error_object.cpp:
+ * kjs/error_object.h:
+ * kjs/function.cpp:
+ * kjs/function.h:
+ * kjs/function_object.cpp:
+ * kjs/function_object.h:
+ * kjs/grammar.y:
+ * kjs/identifier.cpp:
+ * kjs/identifier.h:
+ * kjs/internal.cpp:
+ * kjs/internal.h:
+ * kjs/interpreter.cpp:
+ * kjs/interpreter.h:
+ * kjs/lexer.cpp:
+ * kjs/lexer.h:
+ * kjs/list.cpp:
+ * kjs/list.h:
+ * kjs/lookup.cpp:
+ * kjs/lookup.h:
+ * kjs/math_object.cpp:
+ * kjs/math_object.h:
+ * kjs/nodes.cpp:
+ * kjs/nodes.h:
+ * kjs/nodes2string.cpp:
+ * kjs/number_object.cpp:
+ * kjs/number_object.h:
+ * kjs/object.cpp:
+ * kjs/object.h:
+ * kjs/object_object.cpp:
+ * kjs/object_object.h:
+ * kjs/operations.cpp:
+ * kjs/operations.h:
+ * kjs/property_map.cpp:
+ * kjs/property_map.h:
+ * kjs/property_slot.cpp:
+ * kjs/property_slot.h:
+ * kjs/reference.cpp:
+ * kjs/reference.h:
+ * kjs/reference_list.cpp:
+ * kjs/reference_list.h:
+ * kjs/regexp.cpp:
+ * kjs/regexp.h:
+ * kjs/regexp_object.cpp:
+ * kjs/regexp_object.h:
+ * kjs/scope_chain.cpp:
+ * kjs/scope_chain.h:
+ * kjs/simple_number.h:
+ * kjs/string_object.cpp:
+ * kjs/string_object.h:
+ * kjs/testkjs.cpp:
+ * kjs/types.h:
+ * kjs/ustring.cpp:
+ * kjs/ustring.h:
+ * kjs/value.cpp:
+ * kjs/value.h:
+ * kxmlcore/AlwaysInline.h:
+ * kxmlcore/ListRefPtr.h:
+ * kxmlcore/PassRefPtr.h:
+ * kxmlcore/RefPtr.h:
+
+2006-01-23 Darin Adler <darin@apple.com>
+
+ Reviewed by John Sullivan.
+
+ - change needed for fix to http://bugs.webkit.org/show_bug.cgi?id=6617
+ REGRESSION: Crash in cloneChildNodes when clicking element
+
+ * kxmlcore/PassRefPtr.h: Fix assignment operator from RefPtr of a different
+ type by calling get() instead of going directly at m_ptr.
+ * kxmlcore/RefPtr.h: Ditto.
+
+ - other changes
+
+ * JavaScriptCore.xcodeproj/project.pbxproj: Xcode decided to change this file.
+ It's just a resorted list of keys in a dictionary.
+
+ * kjs/fpconst.cpp: Wrap this file in #if __APPLE__ since the alternate version
+ in internal.cpp is in #if !__APPLE__. This file is to give us the "no init
+ routine" property we want to have on OS X.
+
+2006-01-22 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin.
+
+ - Set up Page class and invert Frame / WebCoreFrameBridge ownership
+ http://bugs.webkit.org/show_bug.cgi?id=6577
+
+ * kjs/interpreter.h: make globalExec virtual so ScriptInterpreter can
+ override it
+
+2006-01-23 George Staikos <staikos@opensource.apple.com>
+
+ Reviewed by Maciej and Darin.
+
+ * kxmlcore/Assertions.h: This file only works with __APPLE__ right now
+ * kjs/interpreter.cpp: ditto
+ * kjs/simple_number.h: Add assert.h and remove from config.h
+ * kjs/array_object.cpp: Use relative paths for kxmlcore includes
+ * kjs/testkjs.cpp: Use relative paths for kxmlcore includes
+
+2006-01-23 George Staikos <staikos@opensource.apple.com>
+
+ Reviewed by Maciej.
+
+ * kjs/config.h: unbreak preprocessor change
+
+2006-01-23 George Staikos <staikos@opensource.apple.com>
+
+ Approved by Maciej and Darin.
+
+ * kjs/:
+ * kxmlcore/:
+ Update FSF address in license to make merging easier
+
+2006-01-22 George Staikos <staikos@opensource.apple.com>
+
+ Reviewed by Maciej.
+
+ * kjs/collector.cpp: merge major speedup from KDE on Linux
+ patch by Maks Orlovich, bug #6145
+ Also unify cpu detection
+ * kjs/config.h: define simpler CPU macros
+
+2006-01-22 George Staikos <staikos@opensource.apple.com>
+
+ Reviewed by Maciej.
+
+ * kjs/collector.cpp: merge FreeBSD compile fix from KDE
+ -> requires build magic for use
+
+2006-01-21 George Staikos <staikos@opensource.apple.com>
+
+ Reviewed by Maciej.
+
+ * kjs/nodes2string.cpp
+ * kjs/operations.h
+ * kjs/debugger.h
+ Fix pedantic compile with some gcc versions (Merge from KDE)
+
+ * kjs/create_hash_table:
+ Fix build with Perl 5.8.0 (Merge from KDE)
+
+2006-01-18 Darin Adler <darin@apple.com>
+
+ Reviewed by Hyatt.
+
+ - hash table fixes needed for my WebCore changes
+
+ * kxmlcore/HashTable.h: (KXMLCore::HashTableConstIterator::operator=):
+ Added a missing return statement.
+
+ * kxmlcore/HashTraits.h: Fix traits so they work properly for classes where you
+ can't instantiate with a 0 by using traits rather than ? : to select the default
+ emtpy value of hash table keys.
+
+ - small cleanup of "runtime" code left over from recent JavaScript crash fix
+
+ * bindings/runtime_root.h:
+ (KJS::Bindings::RootObject::RootObject): No explicit initialization of _imp needed
+ since it's now a ProtectedPtr.
+ (KJS::Bindings::RootObject::setRootObjectImp): Remove old code that relied on the
+ fact that _imp was 0 and replaced with use of ProtectedPtr.
+ (KJS::Bindings::RootObject::rootObjectImp): Updated since _imp is a ProtectedPtr.
+
+2006-01-17 Darin Adler <darin@apple.com>
+
+ Reviewed by Anders.
+
+ - http://bugs.webkit.org/show_bug.cgi?id=6611
+ add assertions to check correct use of hash table iterators
+
+ * kxmlcore/HashTable.h:
+ (KXMLCore::addIterator): Added. Helper function that adds an iterator to the list
+ maintained by the specified hash table.
+ (KXMLCore::removeIterator): Added. Helper function that removes an iterator from
+ the list maintained by the hash table it's in.
+ (KXMLCore::HashTableConstIterator::HashTableConstIterator): Added a HashTable
+ parameter, ignored when not debugging. Call addIterator.
+ (KXMLCore::HashTableConstIterator::~HashTableConstIterator):
+ (KXMLCore::HashTableConstIterator::operator=): Call removeIterator.
+ (KXMLCore::HashTableConstIterator::operator*): Call checkValidity.
+ (KXMLCore::HashTableConstIterator::operator->): Ditto.
+ (KXMLCore::HashTableConstIterator::operator++): Ditto.
+ (KXMLCore::HashTableConstIterator::operator==): Ditto.
+ (KXMLCore::HashTableConstIterator::operator!=): Ditto.
+ (KXMLCore::HashTableConstIterator::checkValidity): Checks that the hash table
+ pointer is not 0 and if there are two iterators that both point at the same table.
+ (KXMLCore::HashTableIterator::HashTableIterator): Changed to use the const iterator
+ as an implementation detail, to avoid having two separate iterator implementations.
+ (KXMLCore::HashTableIterator::operator*): Ditto.
+ (KXMLCore::HashTableIterator::operator->): Ditto.
+ (KXMLCore::HashTableIterator::operator++): Ditto.
+ (KXMLCore::HashTableIterator::operator==): Ditto.
+ (KXMLCore::HashTableIterator::operator!=): Ditto.
+ (KXMLCore::HashTable::HashTable): Initialize pointer to head of iterators list.
+ (KXMLCore::HashTable::~HashTable): Added call to invalidateIterators.
+ (KXMLCore::HashTable::makeIterator): Pass this pointer.
+ (KXMLCore::HashTable::makeConstIterator): Ditto.
+ (KXMLCore::HashTable::insert): Call invalidateIterators, since this is a public
+ entry point that modifies the hash table.
+ (KXMLCore::HashTable::remove): Ditto.
+ (KXMLCore::HashTable::clear): Ditto.
+ (KXMLCore::HashTable::swap): Ditto.
+ (KXMLCore::HashTable::invalidateIterators): Added. Walks the iterators list and
+ clears out the table, next, and previous pointers in all of them, and then clears
+ the head so we have an empty list.
+ (KXMLCore::addIterator): Added. Adds the iterator the the linked list in the
+ passed-in table, and points the iterator at the table.
+ (KXMLCore::removeIterator): Added. Removes the iterator from the linked list in
+ the passed-in table.
+
+ * kxmlcore/HashTraits.h: A bit of tweaking and formatting.
+
+2006-01-17 Justin Garcia <justin.garcia@apple.com>
+
+ Reviewed by eric
+
+ Deployment builds now use -O2
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2006-01-17 Darin Adler <darin@apple.com>
+
+ Reviewed by Anders.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=6610
+ change RefPtr so that it works when deref ends up deleting the RefPtr
+
+ * kxmlcore/PassRefPtr.h: Always set m_ptr before calling deref.
+ * kxmlcore/RefPtr.h: Ditto.
+
+2006-01-16 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by darin.
+
+ - Fixed http://bugs.webkit.org/show_bug.cgi?id=6322
+ DateProtoFuncImp::callAsFunction can crash due to lack of type checking
+
+ * kjs/date_object.cpp:
+ (KJS::DateProtoFunc::callAsFunction): Type check calls to all methods.
+ This matches section 15.9.5 in the spec.
+
+2006-01-16 Tim Omernick <timo@apple.com>
+
+ Reviewed by John Sullivan.
+
+ JavaScriptCore part of <rdar://problem/4211707> NPAPI ref count behavior differs with Mozilla
+
+ * bindings/npruntime.cpp:
+ (_NPN_ReleaseObject):
+ Refactored part of this function out into _NPN_DeallocateObject.
+ (_NPN_DeallocateObject):
+ Forcibly deallocates the passed object, even if its refcount is
+ greater than zero.
+
+ * bindings/npruntime_impl.h:
+ Declared _NPN_DeallocateObject().
+
+2006-01-16 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - fix problem with ++, ==, and != on const iterators in
+ HashMaps that are using the pointer specialization
+
+ * kxmlcore/HashMapPtrSpec.h:
+ (KXMLCore::PointerHashConstIteratorAdapter::operator++): Change type to const_iterator.
+ (KXMLCore::PointerHashConstIteratorAdapter::operator==): Ditto.
+ (KXMLCore::PointerHashConstIteratorAdapter::operator!=): Ditto.
+
+2006-01-15 Alexey Proskuryakov <ap@nypop.com>
+
+ Reviewed by Anders.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=6561
+ run-javascriptcore-tests doesn't work
+
+ * JavaScriptCore/tests/mozilla/Getopt/Mixed.pm:
+ Changed revision number to 1.8 (broken by svn migration).
+
+2006-01-14 David Kilzer <ddkilzer@kilzer.net>
+
+ Reviewed and landed by Anders.
+
+ * kjs/create_hash_table: Fixed comment typo.
+
+2006-01-13 Maks Orlovich <maksim@kde.org>
+
+ Mostly merging work by Peter Kelly. Reviewed by Maciej, landed by ap.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=6261
+ Misc. array object fixes from KJS
+
+ * kjs/array_object.cpp: Don't treat 2^32-1 as a real array index property.
+ (ArrayInstance::getOwnPropertySlot): Ditto.
+ (ArrayInstance::deleteProperty): Ditto.
+ (ArrayInstance::put): Ditto.
+ (ArrayInstance::propList): Added a FIXME comment.
+ (ArrayInstance::put): Throw exception on trying to set invalid array length.
+ (ArrayProtoFunc::callAsFunction): Do not use a separator argument when doing toString/toLocalString.
+ * kjs/array_object.h: Added MAX_ARRAY_INDEX.
+
+2006-01-13 Darin Adler <darin@apple.com>
+
+ - Replaced tabs with spaces in source files that had less than 10 lines with tabs.
+ - Set allow-tabs Subversion property in source files that have more than 10 lines with tabs.
+
+2006-01-13 Anders Carlsson <andersca@mac.com>
+
+ Reviewed by Eric.
+
+ * kjs/create_hash_table:
+ Use correct size variables.
+
+2006-01-13 Anders Carlsson <andersca@mac.com>
+
+ Reviewed by Darin.
+
+ * kjs/create_hash_table:
+ Don't create an empty entry array, instead add a entry with all fields
+ set to null and set the hash table size to 1.
+
+ * kjs/lookup.cpp:
+ (findEntry):
+ Remove the hash table size check
+
+2006-01-12 Anders Carlsson <andersca@mac.com>
+
+ Reviewed by Maciej.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=6494
+ Crash when assigning a new function to a DOMParser object
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ Move lookup.cpp before lookup.h
+
+ * kjs/lookup.cpp:
+ (findEntry):
+ If the hash table is empty, return 0 early.
+
+2006-01-12 George Staikos <staikos@kde.org>
+
+ Reviewed by Darin.
+
+ * kjs/interpreter.cpp:
+ * kjs/testkjs.cpp:
+ * kjs/interpreter.h:
+ Add helper to interpreter to call the collector in order to facilitate
+ visibility rules in KDE.
+
+2006-01-12 George Staikos <staikos@kde.org>
+
+ Reviewed by Maciej.
+
+ * kjs/kjs.pro: Updates to build the whole thing on Linux at least.
+
+ * kxmlcore/HashTable.h: Add missing assert.h
+
+2006-01-12 Darin Adler <darin@apple.com>
+
+ Reviewed by Geoff.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=6505
+ retire APPLE_CHANGES from JavaScriptCore
+
+ * JavaScriptCore.xcodeproj/project.pbxproj: Removed both
+ APPLE_CHANGES and HAVE_CONFIG_H from all targets.
+
+ * README: Removed. This had obsolete information in it
+ and it wasn't clear what to replace it with.
+
+ * kjs/collector.h: Removed an APPLE_CHANGES if around something
+ that's not really platform-specific (although it does use a
+ platform-specific API at the moment).
+ * kjs/collector.cpp: Removed a mistaken comment.
+
+ * kjs/grammar.y:
+ * kjs/internal.cpp:
+ * kjs/object.h:
+ * kjs/operations.cpp:
+ * kjs/operations.h:
+ * kjs/ustring.h:
+ Use __APPLE__ instead of APPLE_CHANGES for code that should be
+ used only on Mac OS X.
+
+ * kjs/interpreter.cpp: Removed APPLE_CHANGES ifdef around the include
+ of the runtime.h header. Even though that header isn't needed at the
+ moment on platforms other than Mac OS X, the conditional stuff should
+ be in the header itself, not in this one client.
+
+ * kjs/math_object.cpp: (MathFuncImp::callAsFunction): Removed some
+ code inside APPLE_CHANGES. I'm pretty sure this code isn't needed on
+ any platform where pow is implemented corrrectly according to the IEEE
+ standard. If it is needed on some, we can add it back with an appropriate
+ #if for the platforms where it is needed.
+
+2006-01-12 Justin Haygood <justin@xiondigital.net>
+
+ Reviewed, tweaked, and landed by Darin.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=6416
+ lexer.cpp, grammar.y protect include of config.h with "HAVE_CONFIG_H"
+
+ * kjs/dtoa.cpp: Removed HAVE_CONFIG_H, changed config.h to use
+ quotes instead of angle brackets. Moved dtoa.h include to the top.
+ Changed system header includes to use angle brackets instead of quotes.
+ * kjs/grammar.y: Removed HAVE_CONFIG_H, changed config.h to use
+ quotes instead of angle brackets.
+ * kjs/lexer.cpp: Removed HAVE_CONFIG_H, changed config.h to use
+ quotes instead of angle brackets. Moved lexer.h include to the top.
+ * kjs/ustring.cpp: Removed HAVE_CONFIG_H, changed config.h to use
+ quotes instead of angle brackets. Moved ustring.h include to the top.
+
+2006-01-12 George Staikos <staikos@kde.org>
+
+ Reviewed by Maciej
+
+ - Import initial QMake file. Doesn't fully work yet.
+
+2006-01-11 Ricci Adams <ricciadams@apple.com>
+
+ Reviewed by Maciej and Darin, landed by Darin.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=5939
+ final comma in javascript object prevents parsing
+
+ * kjs/grammar.y: Added rule to allow trailing comma in
+ object construction.
+
+2006-01-11 Ricci Adams <ricciadams@apple.com>
+
+ Reviewed by Geoff, landed by Darin.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=5308
+ Number.toFixed doesn't include leading 0
+
+ * kjs/number_object.cpp: (NumberProtoFunc::callAsFunction):
+ Fixed a "<" that should have been a "<=".
+
+2006-01-11 Ricci Adams <ricciadams@apple.com>
+
+ Reviewed by Geoff, landed by Darin.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=5307
+ Number.toFixed doesn't round 0.5 up
+
+ * kjs/number_object.cpp: (NumberProtoFunc::callAsFunction):
+ Fixed a ">" that should have been a ">=".
+
+2006-01-11 Justin Haygood <justin@xiondigital.net>
+
+ Reviewed and landed by Darin.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=6486
+ JavaScriptCore should use system malloc on Windows
+
+ * kjs/config.h: Add USE_SYSTEM_MALLOC to the Win32 section.
+
+2006-01-10 Darin Adler <darin@apple.com>
+
+ * Makefile: Took out unneeded "export" line.
+ * <many-files>: Changed a lot of flags (cleared bogus executable bits, set
+ MIME types, other small corrections).
+
+2006-01-09 Darin Adler <darin@apple.com>
+
+ * Makefile.am: Removed.
+
+2006-01-07 Anders Carlsson <andersca@mac.com>
+
+ Reviewed by Maciej.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=6373
+ REGRESSION: JavaScript hang when comparing large array to null
+
+ * kjs/object.h:
+ (KJS::JSObject::isEqualToNull):
+ Add new function which returns true if an object should be treated as null when
+ doing comparisons.
+
+ * kjs/operations.cpp:
+ (KJS::equal):
+ Use isEqualToNull.
+
+2006-01-07 Alexey Proskuryakov <ap@nypop.com>
+
+ Reviewed by Maciej.
+
+ - Fix WebCore development build
+ http://bugs.webkit.org/show_bug.cgi?id=6408
+
+ * kxmlcore/Assertions.h: Use __VA_ARGS__ in variadic macros.
+
+2006-01-06 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin.
+
+ - miscellaneous changes for 4% speedup on the JavaScript iBench
+ http://bugs.webkit.org/show_bug.cgi?id=6396
+
+ Changes mostly thanks to Maks Orlovich, tweaked a little by me.
+
+ * kjs/create_hash_table: Use the same hash as the one used by Identifier.
+ * kjs/function.cpp:
+ (KJS::FunctionImp::processParameters): Use the new List::copyFrom
+ (KJS::ActivationImp::ActivationImp): track variable while iterating
+ * kjs/internal.cpp:
+ (KJS::StringImp::toObject): create StringInstance directly
+ * kjs/list.cpp:
+ (KJS::List::copy): implement in terms of copyFrom
+ (KJS::List::copyFrom): more efficient way to copy in another list
+ * kjs/list.h:
+ * kjs/lookup.cpp:
+ (keysMatch): updated to work with identifier hash
+ (findEntry): ditto
+ (Lookup::findEntry): ditto
+ (Lookup::find): ditto
+ * kjs/lookup.h:
+
+2006-01-06 Maciej Stachowiak <mjs@apple.com>
+
+ - fix development build failure from the previous checkin
+
+ * kjs/function.cpp:
+ (KJS::ActivationImp::put): Use prototype() accessor in assert.
+
+2006-01-05 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Eric.
+
+ - fix remaining performance regression from Getter/Setter change
+ http://bugs.webkit.org/show_bug.cgi?id=6249
+
+ - Activation objects should not have __proto__ property
+ http://bugs.webkit.org/show_bug.cgi?id=6395
+
+ * kjs/function.cpp:
+ (KJS::ActivationImp::getOwnPropertySlot): Implement directly, thus
+ skipping getter/setter handling and __proto__ handling, as well
+ as inlining needed superclass stuff.
+ (KJS::ActivationImp::put): Implement directly, skipping getter/setter,
+ __proto__, and do canPut directly in PropertyMap::put since there's no
+ static property table either.
+ * kjs/function.h:
+ * kjs/property_map.cpp:
+ (KJS::PropertyMap::put): Allow optionally inlining canPut check.
+ * kjs/property_map.h:
+
+2006-01-04 Geoffrey Garen <ggaren@apple.com>
+
+ Patch by kimmo.t.kinnunen@nokia.com, reviewed by darin, tweaked by me.
+
+ - Fixed http://bugs.webkit.org/show_bug.cgi?id=4921
+ \u escape sequences in JavaScript identifiers
+
+ * kjs/function_object.cpp:
+ (FunctionObjectImp::construct):
+ * kjs/lexer.cpp:
+ (Lexer::shift):
+ (Lexer::lex):
+ (Lexer::isWhiteSpace):
+ (Lexer::isLineTerminator):
+ (Lexer::isIdentStart):
+ (Lexer::isIdentPart):
+ (isDecimalDigit):
+ (Lexer::scanRegExp):
+ * kjs/lexer.h:
+ (KJS::Lexer::):
+
+ * tests/mozilla/expected.html: Updated test results.
+
+2005-12-30 Maciej Stachowiak <mjs@apple.com>
+
+ No review, just test result update.
+
+ * tests/mozilla/expected.html: Updated for newly passing test from recent fixes.
+
+2005-12-30 Anders Carlsson <andersca@mac.com>
+
+ Reviewed by Maciej.
+
+ - Fix http://bugs.webkit.org/show_bug.cgi?id=6298
+ Getter setter test is failing
+
+ * kjs/object.cpp:
+ (KJS::JSObject::put):
+ Rework the getter setter part. We now walk the prototype chain, checking for
+ getter/setter properties and only take the slow path if any are found.
+
+2005-12-30 Maks Orlovich <maksim@kde.org>
+
+ Reviewed and committed by Maciej.
+
+ - Handle negative, FP numbers with non-10 radix in toString
+ http://bugs.webkit.org/show_bug.cgi?id=6259
+
+ (Merged from KJS, original work by Harri Porten)
+
+ * kjs/number_object.cpp:
+ (NumberProtoFunc::callAsFunction): rewrote Number.toString(radix) to work with
+ negative numbers, floating point and very large numbers.
+
+2005-12-29 Geoffrey Garen <ggaren@apple.com>
+
+ Patch by Maks Orlovich, reviewed and landed by me.
+
+ - http://bugs.webkit.org/show_bug.cgi?id=6267
+ Fix Number.prototype.toFixed/toExponential(undefined)
+
+ * kjs/number_object.cpp:
+ (NumberProtoFunc::callAsFunction):
+
+2005-12-29 Geoffrey Garen <ggaren@apple.com>
+
+ Patch by Maks Orlovich, Reviewed and landed by me.
+
+ - http://bugs.webkit.org/show_bug.cgi?id=6266
+ Minor object naming updates (to match Mozilla, KJS)
+
+ * kjs/number_object.cpp:
+ * kjs/regexp_object.cpp:
+
+2005-12-29 Geoffrey Garen <ggaren@apple.com>
+
+ Patch by Maks Orlovich, reviewed by mjs.
+
+ This has 2 very minor fixes, covered by KJS testsuite:
+ 1. Enumerates string indices in property list (with the same bug as array
+ object has in corresponding code). This is a mozilla emulation thing.
+ 2. Permits properties with integer names in prototypes to be found
+
+ * kjs/string_object.cpp:
+ (StringInstance::getOwnPropertySlot):
+ (StringInstanceImp::propList):
+ * kjs/string_object.h:
+
+2005-12-26 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by mjs.
+
+ - Fixed <rdar://problem/4364705> run-javascriptcore-tests crashes in
+ KJS::BlockNode::deref
+ AKA
+ http://bugs.webkit.org/show_bug.cgi?id=6233
+ Reproducible stack-overflow crash in ~RefPtr<T> due to RefPtr<T> use in
+ linked lists
+
+ This patch does four things:
+ (1) Standardizes all our linked list nodes to use "next" as their next
+ pointers.
+ (2) Creates the ListRefPtr<T> class, a subclass of RefPtr<T> specialized
+ to iteratively deref "next" pointers.
+ (3) Standardizes our linked list nodes to use ListRefPtr<T> and
+ implement the releaseNext() function used by ~ListRefPtr<T>().
+ (4) Adds to RefPtr<T> the release() method used by releaseNext().
+
+ - Modified existing mozilla test to ensure it would make deployment
+ builds crash as well.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * kjs/nodes.cpp:
+ (ElementNode::evaluate):
+ (PropertyListNode::evaluate):
+ (ArgumentListNode::evaluateList):
+ (StatListNode::StatListNode):
+ (StatListNode::execute):
+ (StatListNode::processVarDecls):
+ (VarDeclListNode::evaluate):
+ (VarDeclListNode::processVarDecls):
+ (VarStatementNode::execute):
+ (VarStatementNode::processVarDecls):
+ (BlockNode::BlockNode):
+ (CaseClauseNode::evalStatements):
+ (CaseClauseNode::processVarDecls):
+ (ClauseListNode::processVarDecls):
+ (CaseBlockNode::CaseBlockNode):
+ (CaseBlockNode::evalBlock):
+ (SourceElementsNode::SourceElementsNode):
+ (SourceElementsNode::execute):
+ (SourceElementsNode::processFuncDecl):
+ (SourceElementsNode::processVarDecls):
+ * kjs/nodes.h:
+ (KJS::ElementNode::ElementNode):
+ (KJS::ElementNode::releaseNext):
+ (KJS::ArrayNode::ArrayNode):
+ (KJS::PropertyListNode::PropertyListNode):
+ (KJS::PropertyListNode::releaseNext):
+ (KJS::ObjectLiteralNode::ObjectLiteralNode):
+ (KJS::ArgumentListNode::ArgumentListNode):
+ (KJS::ArgumentListNode::releaseNext):
+ (KJS::ArgumentsNode::ArgumentsNode):
+ (KJS::StatListNode::releaseNext):
+ (KJS::VarDeclListNode::VarDeclListNode):
+ (KJS::VarDeclListNode::releaseNext):
+ (KJS::VarStatementNode::VarStatementNode):
+ (KJS::ForNode::ForNode):
+ (KJS::CaseClauseNode::CaseClauseNode):
+ (KJS::ClauseListNode::ClauseListNode):
+ (KJS::ClauseListNode::getClause):
+ (KJS::ClauseListNode::getNext):
+ (KJS::ClauseListNode::releaseNext):
+ (KJS::ParameterNode::ParameterNode):
+ (KJS::ParameterNode::releaseNext):
+ (KJS::SourceElementsNode::releaseNext):
+ * kjs/nodes2string.cpp:
+ (ElementNode::streamTo):
+ (PropertyListNode::streamTo):
+ (ArgumentListNode::streamTo):
+ (StatListNode::streamTo):
+ (VarDeclListNode::streamTo):
+ (VarStatementNode::streamTo):
+ (CaseClauseNode::streamTo):
+ (ClauseListNode::streamTo):
+ (CaseBlockNode::streamTo):
+ (SourceElementsNode::streamTo):
+ * kxmlcore/ListRefPtr.h: Added.
+ (KXMLCore::ListRefPtr::ListRefPtr):
+ (KXMLCore::ListRefPtr::~ListRefPtr):
+ (KXMLCore::ListRefPtr::operator=):
+ * kxmlcore/RefPtr.h:
+ (KXMLCore::RefPtr::release):
+
+2005-12-29 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by mjs.
+
+ - Fixed http://bugs.webkit.org/show_bug.cgi?id=4026
+ Math.random() not seeded.
+
+ Added call to sranddev() -- it executes the first time a process
+ calls Math.random().
+
+ * kjs/math_object.cpp:
+ (MathFuncImp::callAsFunction):
+
+2005-12-29 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by darin.
+
+ - Fixed http://bugs.webkit.org/show_bug.cgi?id=6265
+ Name change regression: Java doesn't know what JavaJSObject is
+
+ Changed strings passed to Java back to original "JSObject".
+
+ * bindings/jni/jni_jsobject.cpp:
+ (JavaJSObject::convertValueToJObject):
+ (JavaJSObject::convertJObjectToValue):
+
+2005-12-28 Anders Carlsson <andersca@mac.com>
+
+ Reviewed by Maciej.
+
+ - The JSC part of http://bugs.webkit.org/show_bug.cgi?id=6268
+ Add undetectable document.all
+
+ * kjs/operations.cpp:
+ (KJS::equal):
+ When comparing an object with null or undefined, call toPrimitive with
+ NullType as the preferred type.
+
+2005-12-27 Anders Carlsson <andersca@mac.com>
+
+ Reviewed by Darin.
+
+ * kjs/array_object.cpp:
+ (ArrayProtoFunc::callAsFunction):
+ Implement filter and map. Also, make the existing
+ array iteration functions not invoke the callback for
+ non-existing properties, just as Mozilla does now.
+
+ * kjs/array_object.h:
+ (KJS::ArrayProtoFunc::):
+ Add filter and map.
+
+ * tests/mozilla/expected.html:
+ Update, two 1.6 tests now pass.
+
+2005-12-27 Maciej Stachowiak <mjs@apple.com>
+
+ - updated test results for new JS 1.6 tests
+
+ * tests/mozilla/expected.html:
+
+2005-12-27 Anders Carlsson <andersca@mac.com>
+
+ Reviewed by Maciej.
+
+ Add Mozilla JS 1.6 tests.
+
+ * tests/mozilla/js1_6/Array/browser.js: Added.
+ * tests/mozilla/js1_6/Array/regress-290592.js: Added.
+ * tests/mozilla/js1_6/Array/regress-304828.js: Added.
+ * tests/mozilla/js1_6/Array/regress-305002.js: Added.
+ * tests/mozilla/js1_6/Array/regress-310425-01.js: Added.
+ * tests/mozilla/js1_6/Array/regress-310425-02.js: Added.
+ * tests/mozilla/js1_6/Array/regress-320887.js: Added.
+ * tests/mozilla/js1_6/Array/shell.js: Added.
+ * tests/mozilla/js1_6/README: Added.
+ * tests/mozilla/js1_6/Regress/browser.js: Added.
+ * tests/mozilla/js1_6/Regress/regress-301574.js: Added.
+ * tests/mozilla/js1_6/Regress/regress-309242.js: Added.
+ * tests/mozilla/js1_6/Regress/regress-311157-01.js: Added.
+ * tests/mozilla/js1_6/Regress/regress-311157-02.js: Added.
+ * tests/mozilla/js1_6/Regress/regress-314887.js: Added.
+ * tests/mozilla/js1_6/Regress/regress-320172.js: Added.
+ * tests/mozilla/js1_6/Regress/shell.js: Added.
+ * tests/mozilla/js1_6/String/browser.js: Added.
+ * tests/mozilla/js1_6/String/regress-306591.js: Added.
+ * tests/mozilla/js1_6/String/shell.js: Added.
+ * tests/mozilla/js1_6/browser.js: Added.
+ * tests/mozilla/js1_6/shell.js: Added.
+ * tests/mozilla/js1_6/template.js: Added.
+
+2005-12-27 Maks Orlovich <maksim@kde.org>
+
+ Reviewed and landed by Maciej.
+
+ - fixed 6234: Can delete array index property incorrectly.
+ http://bugs.webkit.org/show_bug.cgi?id=6234
+
+ * kjs/array_object.cpp:
+ (ArrayInstance::deleteProperty): use toArrayIndex instead of toUInt32 when
+ looking for array properties.
+
+2005-12-27 Anders Carlsson <andersca@mac.com>
+
+ Reviewed by Maciej.
+
+ * kjs/object.cpp:
+ (KJS::JSObject::defineSetter):
+ Remove duplicate call to putDirect.
+
+2005-12-26 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin and Geoff.
+
+ Changes by me and Anders.
+
+ - mostly fixed REGRESSION: 5-10% performance regression on JS iBench from getter/setter change
+ http://bugs.webkit.org/show_bug.cgi?id=6083
+
+ - also fixed some warnings reported by -Winline
+
+ * JavaScriptCorePrefix.h: Move new and delete definitions higher so there
+ aren't conflicts with use in standard C++ headers
+ * kjs/object.cpp:
+ (KJS::throwSetterError): Moved this piece of put into a seprate function
+ to avoid the PIC branch.
+ (KJS::JSObject::put): Use hasGetterSetterProperties to avoid expensive stuff
+ when not needed. Also use GetterSetter properties attribute.
+ (KJS::JSObject::deleteProperty): Recompute whether any properties are getter/setter
+ properties any more, if this one was one.
+ (KJS::JSObject::defineGetter): Let the PropertyMap know that it has getter/setter
+ properties now (and use the new attribute).
+ (KJS::JSObject::defineSetter): Ditto.
+ (KJS::JSObject::fillGetterPropertySlot): Out-of-line helper for getOwnPropertySlot,
+ to avoid global variable access in the hot code path.
+ * kjs/object.h:
+ (KJS::): Added GetterSetter attribute.
+ (KJS::JSCell::isObject): Moved lower to be after inline methods it uses.
+ (KJS::JSValue::isObject): ditto
+ (KJS::JSObject::getOwnPropertySlot): try to avoid impact of getters and setters
+ as much as possible in the case where they are not being used
+ * kjs/property_map.cpp:
+ (KJS::PropertyMap::containsGettersOrSetters): New method to help with this
+ * kjs/property_map.h:
+ (KJS::PropertyMap::hasGetterSetterProperties): Ditto
+ (KJS::PropertyMap::setHasGetterSetterProperties): Ditto
+ (KJS::PropertyMap::PropertyMap): Added a crazy hack to store the
+ global "has getter/setter properties" flag in the property map
+ single entry, to avoid making objects any bigger.
+ * kjs/value.h: Moved some things to object.h to make -Winline happier
+
+2005-12-24 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Eric and Dave Hyatt.
+
+ - make even const PassRefPtrs give transfer of ownership semantics
+ http://bugs.webkit.org/show_bug.cgi?id=6238
+
+ This is a somewhat cheesy change. Having to use PassRefPtr_Ref creates ambiguities
+ in assignment and copy construction. And this makes life way easier and removes
+ the need for pass(). It is not really correct, but we pretty much never need a real
+ const PassRefPtr, and this takes care of things for PassRefPtr temporaries.
+
+ * kjs/identifier.cpp:
+ (KJS::Identifier::add): No more need for pass()
+ * kjs/property_map.cpp:
+ (KJS::PropertyMap::addSparseArrayPropertiesToReferenceList): No more need for pass()
+ * kjs/ustring.cpp:
+ (KJS::UString::Rep::create): Use adoptRef
+ (KJS::UString::UString): No more need for pass
+ (KJS::UString::append): No more need for pass
+ (KJS::UString::substr): No more need for pass
+ * kxmlcore/PassRefPtr.h: made m_ptr mutable (ugh)
+ (KXMLCore::PassRefPtr::PassRefPtr): Take a const PassRefPtr reference
+ (KXMLCore::PassRefPtr::release): Made this a const method (ugh)
+ (KXMLCore::PassRefPtr::operator=): clean up appropriately
+ (KXMLCore::adoptRef): Added this to use instead of PassRefPtr<T>::adopt, I think
+ it makes the behavior more clear and it is less verbose.
+ (KXMLCore::static_pointer_cast): use adoptRef
+ (KXMLCore::const_pointer_cast): use adoptRef
+ * kxmlcore/RefPtr.h:
+ (KXMLCore::RefPtr::RefPtr): take const PassRefPtr&
+ (KXMLCore::PassRefPtr::operator=): take const PassRefPtr&
+
+2005-12-25 Eric Seidel <eseidel@apple.com>
+
+ Reviewed by mjs.
+
+ Unbreak HashTableConstIterator++ by returning const_iterator
+
+ * kxmlcore/HashTable.h:
+ (KXMLCore::HashTableConstIterator::operator++): use const_iterator
+
+2005-12-25 Eric Seidel <eseidel@apple.com>
+
+ Reviewed by mjs.
+
+ Un-break HashTable copy constructor.
+
+ * kxmlcore/HashTable.h:
+ (KXMLCore::::HashTable): use const_iterator instead
+
+2005-12-23 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Eric.
+
+ - fixed "HashMap does not work with const pointer keys or values"
+ http://bugs.webkit.org/show_bug.cgi?id=6222
+
+ * kxmlcore/HashMapPtrSpec.h:
+ (KXMLCore::HashMap): In all methods, explicitly cast all pointers
+ to void * before passing to internal implementation. Use C-style
+ casts instead of new-style casts, because the real solution would
+ require a combo of reinterpret_cast anc const_cast.
+
+
+2005-12-23 Maciej Stachowiak <mjs@apple.com>
+
+ - this time for sure
+
+ * kxmlcore/RefPtr.h:
+ (KXMLCore::::swap):
+
+2005-12-22 Maciej Stachowiak <mjs@apple.com>
+
+ - fix build problem from last commit.
+
+ * kxmlcore/RefPtr.h:
+ (KXMLCore::::swap):
+
+2005-12-21 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin.
+
+ - Make HashMap/HashSet support non-POD types
+ http://bugs.webkit.org/show_bug.cgi?id=5332
+
+ The changes for support are relatively simple, but I also made extensive changes to
+ avoid copying, so that there isn't refcount thrash when you put RefPtrs into a HashMap.
+
+ * kxmlcore/HashTable.h:
+ (KXMLCore::swap): specialize swap for pairs, to swap elements individually,
+ so that excess copies can be avoided.
+ (KXMLCore::Mover::move): Template function to either copy or swap, used
+ when transferring elements from old table to new.
+ (KXMLCore::IdentityHashTranslator::hash): The old "converting lookup" templates
+ that took two or three function parameters now take a class parameter, this is
+ the class used to do a normal lookup.
+ (KXMLCore::IdentityHashTranslator::equal): Ditto.
+ (KXMLCore::IdentityHashTranslator::translate): Ditto. Translate now takes a reference
+ to write into instead of returning a value to avoid redundant copies.
+ (KXMLCore::HashTable::~HashTable): Use deallocateTable instead of freeing directly.
+ (KXMLCore::HashTable::insert): Based on HashTranslator now instead of separate
+ functions. Added a FIXME about a remaining rare excess copy.
+ (KXMLCore::HashTable::isEmptyBucket): Use KeyTraits directly instead of unwrapping
+ the key from Traits, to avoid creating and destroying pair, which copies.
+ (KXMLCore::HashTable::isDeletedBucket): ditto
+ (KXMLCore::HashTable::lookup): Use HashTranslator now instead of separate functions.
+ (KXMLCore::HashTable::initializeBucket): Renamed from emptyBucket. Use placement new to
+ work right for non-POD types.
+ (KXMLCore::HashTable::deleteBucket): Use assignDeleted to avoid excess copies.
+ (KXMLCore::HashTable::reinsert): use Mover template to copy or swap as appropriate
+ (KXMLCore::HashTable::allocateTable): Initialize every bucket if calloc won't do.
+ (KXMLCore::HashTable::deallocateTable): Destruct every bucket if needed.
+ (KXMLCore::HashTable::rehash): Avoid copy before reinserting, so that swap can do its magic.
+ (KXMLCore::HashTable::clear): use deallocateTable instead of freeing directly.
+ (KXMLCore::HashTable::HashTable): be more dumb when copying to ensure that non-POD types
+ work right
+ * kxmlcore/HashFunctions.h:
+ (KXMLCore::PointerHash): Specialize PointerHash for RefPtr
+ * kxmlcore/HashMap.h:
+ (KXMLCore::extractFirst): Return a reference not a full object to avoid
+ copies.
+ (KXMLCore::HashMapTranslator::hash): Use a special translator for insertion
+ to defer making the pair as long as possible, thus avoiding needless copies.
+ (KXMLCore::HashMapTranslator::equal): ditto
+ (KXMLCore::HashMapTranslator::translate): ditto
+ (KXMLCore::::inlineAdd): Shared by set and add to insert using HashMapTranslator
+ (KXMLCore::::set): Use inlineAdd
+ (KXMLCore::::add): Use inlineAdd
+ * kxmlcore/HashMapPtrSpec.h:
+ (KXMLCore::): Pass KeyTraits along
+ * kxmlcore/HashSet.h:
+ (KXMLCore::identityExtract): Return a reference not a full object to avoid copies.
+ (KXMLCore::HashSetTranslatorAdapter::hash): Redo adapter stuff to work with
+ the new HashTranslator approach.
+ (KXMLCore::HashSetTranslatorAdapter::equal): ditto
+ (KXMLCore::HashSetTranslatorAdapter::translate): ditto
+ (KXMLCore::::insert): ditto
+ * kxmlcore/HashTraits.h:
+ (KXMLCore::GenericHashTraits): This is intended be used as a base class for
+ customized traits: sensible defaults.
+ (KXMLCore::): Use it a bunch
+ (KXMLCore::assignDeleted): template function to allow pairs to be assigned the
+ deleted value w/o excess copies.
+ (KXMLCore::PairHashTraits::emptyValue): Updated
+ (KXMLCore::PairHashTraits::deletedValue): Updated
+ (KXMLCore::PairHashTraits::assignDeletedValue): part of assignDeleted hack
+ (KXMLCore::DeletedValueAssigner::assignDeletedValue): Use template magic
+ to either use use deletedValue or assignDeletedValue for the cases where we care.
+ * kxmlcore/RefPtr.h:
+ (KXMLCore::RefPtr::swap): Added swap method.
+ (KXMLCore::swap): Added swap free function.
+ * kjs/identifier.cpp:
+ (KJS::CStringTranslator::hash): Use new HashTranslator class approach to
+ alternate type based insertion.
+ (KJS::CStringTranslator::equal): ditto
+ (KJS::CStringTranslator::translate): ditto
+ (KJS::Identifier::add): ditto
+ (KJS::UCharBufferTranslator::hash): ditto
+ (KJS::UCharBufferTranslator::equal): ditto
+ (KJS::UCharBufferTranslator::translate): ditto
+
+ - irrelevant change:
+
+ * kjs/array_object.cpp:
+ (ArrayProtoFunc::callAsFunction): Removed a stray space.
+
+2005-12-22 Anders Carlsson <andersca@mac.com>
+
+ Reviewed by Eric and Darin.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=6196
+ Would like to be able to define prototypes in headers
+
+ * kjs/lookup.h:
+ Move ClassName from KJS_DECLARE_PROTOTYPE to KJS_IMPLEMENT_PROTOTYPE.
+ Also, namespace all macros by prefixing them with KJS_.
+
+2005-12-22 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=6191
+ RefPtr/PassRefPtr have a leak issue, operator== issues
+
+ * kxmlcore/PassRefPtr.h:
+ (KXMLCore::PassRefPtr::PassRefPtr): Remove non-template constructor that takes RefPtr
+ since the constructor template that takes RefPtr should be sufficient. Add a constructor
+ template that takes PassRefPtr&.
+ (KXMLCore::PassRefPtr::adopt): Use PassRefPtr_Ref to avoid setting pointer first to
+ 0 and then to the pointer.
+ (KXMLCore::PassRefPtr::operator=): Added template versions that take PassRefPtr& and
+ RefPtr parameters.
+ (KXMLCore::PassRefPtr::operator PassRefPtr<U>): Changed to fix leak -- old version
+ would release and then ref.
+ (KXMLCore::operator==): Make templates have two parameters so you can mix types.
+ Also remove unneeded const in raw pointer versions.
+ (KXMLCore::operator!=): Ditto.
+
+ * kxmlcore/RefPtr.h:
+ (KXMLCore::RefPtr::RefPtr): Add constructor template that takes PassRefPtr.
+ (KXMLCore::RefPtr::operator=): Add assignment operator templates that take
+ RefPtr and PassRefPtr.
+ (KXMLCore::operator==): Make templates have two parameters so you can mix types.
+ Also remove unneeded const in raw pointer versions.
+ (KXMLCore::operator!=): Ditto.
+
+2005-12-21 Timothy Hatcher <timothy@apple.com>
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ Set tab width to 8, indent width to 4 and uses tabs to false per file.
+
+2005-12-21 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin.
+
+ Removed evil hack for determining if a type is an integer, replaced
+ with template metaprogramming.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj: Set tab size to 2 for
+ testkjs.cpp
+ * kjs/testkjs.cpp:
+ (main): Inserted asserts to test IsInteger. FIXME: Move these to
+ KXMLCore unit tests directory when we create one.
+ * kxmlcore/HashTraits.h:
+ (KXMLCore::): Added IsInteger class for querying types.
+
+2005-12-20 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin.
+
+ - made ALWAYS_INLINE declare things inline as well as __attribute__((always_inline))
+ http://bugs.webkit.org/show_bug.cgi?id=6159
+
+ * kxmlcore/AlwaysInline.h:
+
+2005-12-19 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin.
+
+ - fixed a leak in the assignment operator from PassRefPtr to RefPtr
+ http://bugs.webkit.org/show_bug.cgi?id=6158
+
+ * kxmlcore/RefPtr.h:
+ (KXMLCore::RefPtr::operator=):
+
+ - fix problem with PassRefPtr that darin spotted - it lacked a copy constructor
+ and therefore was using the default one, which can lead to excess derefs
+
+ I fixed this by adding a copy constructor from non-const
+ reference, and by adding a template pass() function that you have
+ to use when raw pointer or RefPtr are passed where PassRefPtr is
+ expected.
+
+ * kjs/identifier.cpp:
+ (KJS::Identifier::add): Changed to have PassRefPtr return type and
+ pass() the results.
+ * kjs/identifier.h:
+ * kjs/property_map.cpp:
+ (KJS::PropertyMap::addSparseArrayPropertiesToReferenceList): Use pass()
+ where required.
+ * kjs/ustring.cpp:
+ (KJS::UString::UString): Use pass() as needed.
+ (KJS::UString::append): ditto
+ (KJS::UString::substr): ditto
+ * kjs/ustring.h:
+ (KJS::UString::UString): Use initializer instead of assignment
+ * kxmlcore/PassRefPtr.h:
+ (KXMLCore::PassRefPtr::PassRefPtr): Added copy constructor
+ (KXMLCore::pass): new template function to make it convenient to pass
+ a PassRefPtr
+
+2005-12-19 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej.
+
+ Fixed <rdar://problem/4370397> Missing return statement in
+ JSMethodNameToObjcMethodName.
+
+ JSMethodNameToObjcMethodName had a check for a name being too long, but
+ the check was missing a return statement.
+
+ A lot of this code was confusing and some of it was wrong, so I fixed
+ it up, added some asserts to catch this type of bug in the future,
+ changed some comments, and renamed some variables.
+
+ The two advantages of the new algorithm are (1) It makes writing past
+ the end of the buffer virtually impossible because the test on the main
+ loop is "while (not past end of buffer)" and (2) It's twice as fast
+ because it doesn't call strlen. (There's no need to call strlen when
+ we're walking the string ourselves.)
+
+ methodsNamed also supports arbitrary-length method names now. Just in
+ case the AppKit folks start getting REALLY verbose...
+
+ * bindings/objc/objc_class.mm:
+ (KJS::Bindings::ObjcClass::methodsNamed):
+ * bindings/objc/objc_utility.h:
+ * bindings/objc/objc_utility.mm:
+ (KJS::Bindings::JSMethodNameToObjcMethodName):
+
+2005-12-19 Darin Adler <darin@apple.com>
+
+ Originally done by both George Staikos and Alexey Proskuryakov.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=5706
+ Sharedptr dependency can be removed
+
+ Our coding guidelines say "use 0 instead of NULL" and both RefPtr and
+ PassRefPtr were using NULL, which required including a header that
+ defines NULL.
+
+ * kxmlcore/PassRefPtr.h:
+ (KXMLCore::PassRefPtr::PassRefPtr): Use 0 instead of NULL.
+ (KXMLCore::PassRefPtr::operator!): Use ! instead of == NULL.
+ * kxmlcore/RefPtr.h:
+ (KXMLCore::RefPtr::RefPtr): Use 0 instead of NULL.
+ (KXMLCore::RefPtr::operator!): Use ! instead of == NULL.
+ Also did some reformatting.
+
+2005-12-19 Darin Adler <darin@apple.com>
+
+ Reviewed by Geoff Garen and Eric Seidel.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=4923
+ stop using <ostream> in WebCore, eliminating the <cmath> troubles it causes
+
+ * kjs/simple_number.h: Removed many unnecessary includes, including
+ the <cmath> one to work around GCC library header bugs. We may have to
+ add some includes elsewhere for platforms other than OS X, since our
+ prefix header takes care of some things.
+
+ * kxmlcore/AlwaysInline.h: Added. Now clients that don't include
+ simple_number.h can still get the ALWAYS_INLINE macro.
+ * JavaScriptCore.xcodeproj/project.pbxproj: Added AlwaysInline.h.
+
+ * bindings/NP_jsobject.h: Removed a lot of unnecessary includes
+ and removed C-specific stuff from this C++-only header.
+ * bindings/jni/jni_jsobject.h: Removed a lot of unnecessary includes
+ and did some reformatting.
+ * bindings/objc/objc_runtime.h: Removed an unnecessary include.
+ * bindings/runtime.h: Removed some unneeded includes. Reformatted.
+ * bindings/runtime.cpp: Updated to compile with header changes,
+ including a lot of reformatting.
+ * bindings/runtime_object.h: Removed an unnecessary include.
+
+2005-12-13 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Geoff and Adele
+
+ - replaced custom Identifier hashtable with HashSet
+
+ * kjs/identifier.cpp:
+ (KXMLCore::):
+ (KJS::identifierTable):
+ (KJS::Identifier::equal):
+ (KJS::hash):
+ (KJS::equal):
+ (KJS::convert):
+ (KJS::Identifier::add):
+ (KJS::Identifier::remove):
+ * kjs/identifier.h:
+ * kjs/internal.cpp:
+ (KJS::InterpreterImp::initGlobalObject):
+
+2005-12-18 Justin Haygood <justin@xiondigital.net>
+
+ Reviewed, tweaked, and landed by Darin.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=5227
+ Array indexOf() extension for JavaScript 1.5 Core
+
+ * kjs/array_object.h:
+ * kjs/array_object.cpp: (ArrayProtoFunc::callAsFunction): Added implementation of indexOf.
+
+2005-12-18 Anders Carlsson <andersca@mac.com>
+
+ Reviewed by Darin and Geoffrey.
+
+ - fix for <http://bugs.webkit.org/show_bug.cgi?id=4000>
+ Object.prototype is missing isPrototypeOf
+
+ * kjs/object_object.cpp:
+ (ObjectPrototype::ObjectPrototype):
+ Add isPrototypeOf to object prototype.
+
+ (ObjectProtoFunc::callAsFunction):
+ Implement isPrototypeOf
+
+ * kjs/object_object.h:
+ (KJS::ObjectProtoFunc::):
+ Add id for isPrototypeOf.
+
+2005-12-17 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin.
+
+ Fixed http://bugs.webkit.org/show_bug.cgi?id=6119
+ split() function ignores case insensitive modifier.
+
+ Glossary:
+ RegExpImp: The C++ object you get when JavaScript executes
+ "new RegExp()".
+ RegExp: A C++ wrapper object that performs regular expression
+ matching on behalf of a RegExpImp.
+
+ Instead of unnecessarily constructing a RegExp which (wrongly) lacks
+ any modifiers, String.split() now uses the RegExp built in to the
+ RegExpImp passed to it, which has the right modifiers already.
+
+ I also cleaned up other bits of the string code to standardized how
+ we handle RegExpImp arguments.
+
+ * ChangeLog:
+ * kjs/string_object.cpp:
+ (replace):
+ (StringProtoFunc::callAsFunction):
+
+2005-12-16 David Hyatt <hyatt@apple.com>
+
+ Remove unused RefPtr constructors that can create an ambiguity in ustring on some platforms.
+
+ Reviewed by mjs
+
+ * kxmlcore/RefPtr.h:
+ (KXMLCore::RefPtr::RefPtr):
+
+2005-12-15 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=5688
+ speed up JavaScript parsing by not creating a UString just to parse
+
+ * kjs/internal.h:
+ * kjs/internal.cpp: (KJS::InterpreterImp::evaluate): Change to take a character pointer
+ and length rather than a UString.
+
+ * kjs/interpreter.h:
+ * kjs/interpreter.cpp: (Interpreter::evaluate): Ditto.
+
+ * kjs/protect.h: Remove uneeded "convert to bool" operator since we already have a
+ "convert to raw pointer" operator in this class.
+
+=== Safari-521~5 ===
+
+2005-12-13 Geoffrey Garen <ggaren@apple.com>
+
+ Updated test results to match Anders's last fix.
+
+ * tests/mozilla/expected.html:
+
+2005-12-13 Anders Carlsson <andersca@mac.com>
+
+ * ChangeLog: Add titles for my bugzilla bugs.
+
+2005-12-13 Anders Carlsson <andersca@mac.com>
+
+ Reviewed by Darin.
+
+ - Fixes <http://bugs.webkit.org/show_bug.cgi?id=6041>
+ Support property getters and setters.
+
+ * bindings/runtime_array.cpp:
+ (RuntimeArray::lengthGetter):
+ (RuntimeArray::indexGetter):
+ * bindings/runtime_array.h:
+ * bindings/runtime_method.cpp:
+ (RuntimeMethod::lengthGetter):
+ * bindings/runtime_method.h:
+ * bindings/runtime_object.cpp:
+ (RuntimeObjectImp::fallbackObjectGetter):
+ (RuntimeObjectImp::fieldGetter):
+ (RuntimeObjectImp::methodGetter):
+ * bindings/runtime_object.h:
+ * kjs/array_instance.h:
+ * kjs/array_object.cpp:
+ (ArrayInstance::lengthGetter):
+ (getProperty):
+ Update for changes to PropertySlot::getValue and
+ PropertySlot::GetValueFunc.
+
+ * kjs/collector.cpp:
+ (KJS::className):
+ Handle GetterSetterType.
+
+ * kjs/function.cpp:
+ (KJS::FunctionImp::argumentsGetter):
+ (KJS::FunctionImp::lengthGetter):
+ (KJS::Arguments::mappedIndexGetter):
+ (KJS::ActivationImp::argumentsGetter):
+ * kjs/function.h:
+ Update for changes to PropertySlot::getValue and
+ PropertySlot::GetValueFunc.
+
+ * kjs/grammar.y:
+ Rework grammar parts for get set declarations directly
+ in the object literal.
+
+ * kjs/internal.cpp:
+ (KJS::GetterSetterImp::mark):
+ (KJS::GetterSetterImp::toPrimitive):
+ (KJS::GetterSetterImp::toBoolean):
+ (KJS::GetterSetterImp::toNumber):
+ (KJS::GetterSetterImp::toString):
+ (KJS::GetterSetterImp::toObject):
+ Add type conversion functions. These aren't meant to be called.
+
+ (KJS::printInfo):
+ Handle GetterSetterType.
+
+ * kjs/lookup.h:
+ (KJS::staticFunctionGetter):
+ (KJS::staticValueGetter):
+ Update for changes to PropertySlot::GetValueFunc.
+
+ * kjs/nodes.cpp:
+ Refactor they way properties nodes are implemented.
+ We now have a PropertyListNode which is a list of PropertyNodes.
+ Each PropertyNode has a name (which is a PropertyNameNode) and an associated
+ value node. PropertyNodes can be of different types. The Constant type is the
+ old constant declaration and the Getter and Setter types are for property getters
+ and setters.
+ (ResolveNode::evaluate):
+ Update for changes to PropertySlot::getValue.
+
+ (PropertyListNode::evaluate):
+ Go through all property nodes and set them on the newly created object. If the
+ property nodes are of type Getter or Setter, define getters and setters. Otherwise,
+ just add the properties like before.
+
+ (PropertyNode::evaluate):
+ This should never be called directly.
+
+ (PropertyNameNode::evaluate):
+ Rename from PropertyNode::evaluate.
+
+ (FunctionCallResolveNode::evaluate):
+ (FunctionCallBracketNode::evaluate):
+ (FunctionCallDotNode::evaluate):
+ (PostfixResolveNode::evaluate):
+ (PostfixBracketNode::evaluate):
+ (PostfixDotNode::evaluate):
+ (TypeOfResolveNode::evaluate):
+ (PrefixResolveNode::evaluate):
+ (PrefixBracketNode::evaluate):
+ (PrefixDotNode::evaluate):
+ (AssignResolveNode::evaluate):
+ (AssignDotNode::evaluate):
+ (AssignBracketNode::evaluate):
+ Update for changes to PropertySlot::getValue.
+
+ * kjs/nodes.h:
+ (KJS::PropertyNameNode::PropertyNameNode):
+ Rename from PropertyNode.
+
+ (KJS::PropertyNode::):
+ (KJS::PropertyNode::PropertyNode):
+ New class, representing a single property.
+
+ (KJS::PropertyListNode::PropertyListNode):
+ Rename from PropertyValueNode.
+
+ (KJS::FuncExprNode::FuncExprNode):
+ Put ParameterNode parameter last, and make it optional.
+
+ (KJS::ObjectLiteralNode::ObjectLiteralNode):
+ Use a PropertyListNode here now.
+
+ * kjs/nodes2string.cpp:
+ (PropertyListNode::streamTo):
+ Iterate through all property nodes.
+
+ (PropertyNode::streamTo):
+ Print out the name and value. Doesn't handle getters and setters currently.
+
+ (PropertyNameNode::streamTo):
+ Rename from PropertyNode::streamTo.
+
+ * kjs/object.cpp:
+ (KJS::JSObject::get):
+ Update for changes to PropertySlot::getValue.
+
+ (KJS::JSObject::put):
+ If the property already exists and has a Setter, invoke
+ the setter function instead of setting the property directly.
+
+ (KJS::JSObject::defineGetter):
+ (KJS::JSObject::defineSetter):
+ New functions for defining property getters and setters on the object.
+
+ * kjs/object.h:
+ (KJS::GetterSetterImp::type):
+ (KJS::GetterSetterImp::GetterSetterImp):
+ (KJS::GetterSetterImp::getGetter):
+ (KJS::GetterSetterImp::setGetter):
+ (KJS::GetterSetterImp::getSetter):
+ (KJS::GetterSetterImp::setSetter):
+ New class for properties which have getters and setters defined.
+ This class is only used internally and should never be seen from the outside.
+
+ (KJS::JSObject::getOwnPropertySlot):
+ If the property is a getter, call setGetterSlot on the property slot.
+
+ * kjs/object_object.cpp:
+ (ObjectPrototype::ObjectPrototype):
+ Add __defineGetter__, __defineSetter, __lookupGetter__, __lookupSetter__
+ to prototype.
+
+ (ObjectProtoFunc::callAsFunction):
+ Implement handlers for new functions.
+
+ * kjs/object_object.h:
+ (KJS::ObjectProtoFunc::):
+ Add ids for new functions.
+
+ * kjs/property_slot.cpp:
+ (KJS::PropertySlot::undefinedGetter):
+ Update for changes to PropertySlot::GetValueFunc.
+
+ (KJS::PropertySlot::functionGetter):
+ Call the function getter object and return its value.
+
+ * kjs/property_slot.h:
+ (KJS::PropertySlot::getValue):
+ Add a new argument which is the original object that
+ getPropertySlot was called on.
+
+ (KJS::PropertySlot::setGetterSlot):
+ (KJS::PropertySlot::):
+ New function which sets a getter slot. When getValue is called on a
+ getter slot, the getter function object is invoked.
+
+ * kjs/string_object.cpp:
+ (StringInstance::lengthGetter):
+ (StringInstance::indexGetter):
+ * kjs/string_object.h:
+ Update for changes to PropertySlot::GetValueFunc.
+
+ * kjs/value.h:
+ (KJS::):
+ Add GetterSetterType and make GetterSetterImp a friend class of JSCell.
+
+2005-12-12 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Eric.
+
+ - added a new HashCountedSet class for the common pattern of mapping items to counts that can change
+
+ * kxmlcore/HashCountedSet.h: Added.
+ (KXMLCore::HashCountedSet::*): Implemented, on top of HashMap.
+ * kxmlcore/HashMap.h:
+ (KXMLCore::HashMap::add): New method - does not replace existing value if key already present
+ but otherwise like set().
+ (KXMLCore::HashMap::set): Improved comments.
+ * kxmlcore/HashMapPtrSpec.h:
+ (KXMLCore::HashMap::add): Added to specializations too.
+ * JavaScriptCore.xcodeproj/project.pbxproj: Add new file.
+ * kxmlcore/HashFunctions.h: Added include of stdint.h
+
+ - replaced the custom hashtable for values protected from GC with HashCountedSet
+
+ * kjs/collector.cpp:
+ (KJS::Collector::protect): Moved code here from ProtectedValues::increaseProtectCount
+ since the code is so simple now.
+ (KJS::Collector::unprotect): Ditto for ProtectedValues::decreaseProtectCount.
+ (KJS::Collector::markProtectedObjects): Updated for new way of doing things, now
+ simpler and safer.
+ (KJS::Collector::numReferencedObjects): ditto
+ (KJS::Collector::rootObjectClasses): ditto
+ * kjs/collector.h: Added protect and unprotect static methods
+ * kjs/protect.h:
+ (KJS::gcProtect): Updated for removal of ProtectedValues class
+ (KJS::gcUnprotect): likewise
+ * kjs/protected_values.cpp: Removed.
+ * kjs/protected_values.h: Removed.
+
+2005-12-10 Darin Adler <darin@apple.com>
+
+ Rubber stamped by Maciej.
+
+ - did long-promised KJS renaming:
+
+ ValueImp -> JSValue
+ ObjectImp -> JSObject
+ AllocatedValueImp -> JSCell
+
+ A renaming to get a class out of the way
+
+ KJS::Bindings::JSObject -> JavaJSObject
+
+ and some other "imp-reduction" renaming
+
+ *InstanceImp -> *Instance
+ *ProtoFuncImp -> *ProtoFunc
+ *PrototypeImp -> *Prototype
+ ArgumentsImp -> Arguments
+ RuntimeArrayImp -> RuntimeArray
+ RuntimeMethodImp -> RuntimeMethod
+
+ * most files and functions
+
+2005-12-10 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - eliminated the old Undefined(), Null(), Boolean(), Number(), and String()
+
+ Code now uses jsUndefined(), jsNull(), jsBoolean(), jsNumber(), and jsString().
+
+ * bindings/NP_jsobject.cpp:
+ (_NPN_Evaluate):
+ * bindings/c/c_instance.cpp:
+ (KJS::Bindings::CInstance::invokeMethod):
+ (KJS::Bindings::CInstance::invokeDefaultMethod):
+ * bindings/c/c_runtime.cpp:
+ (CField::valueFromInstance):
+ * bindings/c/c_utility.cpp:
+ (KJS::Bindings::convertNPVariantToValue):
+ * bindings/jni/jni_instance.cpp:
+ (JavaInstance::invokeMethod):
+ (JavaInstance::invokeDefaultMethod):
+ * bindings/jni/jni_jsobject.cpp:
+ (JSObject::eval):
+ (JSObject::convertJObjectToValue):
+ * bindings/jni/jni_runtime.cpp:
+ (JavaArray::convertJObjectToArray):
+ (JavaField::valueFromInstance):
+ (JavaArray::valueAt):
+ * bindings/objc/WebScriptObject.mm:
+ (-[WebScriptObject callWebScriptMethod:withArguments:]):
+ (-[WebScriptObject evaluateWebScript:]):
+ (-[WebScriptObject valueForKey:]):
+ (-[WebScriptObject webScriptValueAtIndex:]):
+ * bindings/objc/objc_instance.mm:
+ (ObjcInstance::invokeMethod):
+ (ObjcInstance::invokeDefaultMethod):
+ (ObjcInstance::getValueOfUndefinedField):
+ * bindings/objc/objc_runtime.mm:
+ (ObjcField::valueFromInstance):
+ (ObjcFallbackObjectImp::callAsFunction):
+ * bindings/objc/objc_utility.mm:
+ (KJS::Bindings::convertNSStringToString):
+ (KJS::Bindings::convertObjcValueToValue):
+ * bindings/runtime.h:
+ (KJS::Bindings::Class::fallbackObject):
+ (KJS::Bindings::Instance::getValueOfUndefinedField):
+ (KJS::Bindings::Instance::valueOf):
+ * bindings/runtime_array.cpp:
+ (RuntimeArrayImp::lengthGetter):
+ * bindings/runtime_method.cpp:
+ (RuntimeMethodImp::lengthGetter):
+ (RuntimeMethodImp::callAsFunction):
+ (RuntimeMethodImp::execute):
+ * kjs/array_object.cpp:
+ (ArrayInstanceImp::lengthGetter):
+ (CompareWithCompareFunctionArguments::CompareWithCompareFunctionArguments):
+ (ArrayPrototypeImp::ArrayPrototypeImp):
+ (ArrayProtoFuncImp::ArrayProtoFuncImp):
+ (ArrayProtoFuncImp::callAsFunction):
+ (ArrayObjectImp::ArrayObjectImp):
+ * kjs/bool_object.cpp:
+ (BooleanPrototypeImp::BooleanPrototypeImp):
+ (BooleanProtoFuncImp::callAsFunction):
+ (BooleanObjectImp::BooleanObjectImp):
+ (BooleanObjectImp::callAsFunction):
+ * kjs/error_object.cpp:
+ (ErrorPrototypeImp::ErrorPrototypeImp):
+ (ErrorProtoFuncImp::ErrorProtoFuncImp):
+ (ErrorProtoFuncImp::callAsFunction):
+ (ErrorObjectImp::ErrorObjectImp):
+ (NativeErrorImp::NativeErrorImp):
+ * kjs/function.cpp:
+ (KJS::FunctionImp::callAsFunction):
+ (KJS::FunctionImp::processParameters):
+ (KJS::FunctionImp::argumentsGetter):
+ (KJS::FunctionImp::lengthGetter):
+ (KJS::DeclaredFunctionImp::execute):
+ (KJS::encode):
+ (KJS::decode):
+ (KJS::GlobalFuncImp::callAsFunction):
+ * kjs/function_object.cpp:
+ (FunctionPrototypeImp::FunctionPrototypeImp):
+ (FunctionPrototypeImp::callAsFunction):
+ (FunctionProtoFuncImp::callAsFunction):
+ (FunctionObjectImp::FunctionObjectImp):
+ * kjs/internal.cpp:
+ (KJS::InterpreterImp::initGlobalObject):
+ * kjs/interpreter.h:
+ * kjs/lookup.h:
+ * kjs/math_object.cpp:
+ (MathObjectImp::getValueProperty):
+ (MathFuncImp::callAsFunction):
+ * kjs/nodes.cpp:
+ (Node::setExceptionDetailsIfNeeded):
+ (NullNode::evaluate):
+ (PropertyNode::evaluate):
+ (FunctionCallBracketNode::evaluate):
+ (FunctionCallDotNode::evaluate):
+ (PostfixBracketNode::evaluate):
+ (PostfixDotNode::evaluate):
+ (VoidNode::evaluate):
+ (PrefixBracketNode::evaluate):
+ (PrefixDotNode::evaluate):
+ (ShiftNode::evaluate):
+ (valueForReadModifyAssignment):
+ (AssignDotNode::evaluate):
+ (AssignBracketNode::evaluate):
+ (VarDeclNode::evaluate):
+ (VarDeclNode::processVarDecls):
+ (VarDeclListNode::evaluate):
+ (ReturnNode::execute):
+ (CaseClauseNode::evalStatements):
+ (ParameterNode::evaluate):
+ (FuncDeclNode::processFuncDecl):
+ * kjs/nodes.h:
+ (KJS::StatementNode::evaluate):
+ * kjs/number_object.cpp:
+ (NumberPrototypeImp::NumberPrototypeImp):
+ (NumberProtoFuncImp::callAsFunction):
+ (NumberObjectImp::NumberObjectImp):
+ (NumberObjectImp::getValueProperty):
+ (NumberObjectImp::callAsFunction):
+ * kjs/object.cpp:
+ (KJS::ObjectImp::get):
+ (KJS::Error::create):
+ * kjs/object_object.cpp:
+ (ObjectPrototypeImp::ObjectPrototypeImp):
+ (ObjectProtoFuncImp::callAsFunction):
+ (ObjectObjectImp::ObjectObjectImp):
+ * kjs/property_slot.cpp:
+ (KJS::PropertySlot::undefinedGetter):
+ * kjs/regexp_object.cpp:
+ (RegExpPrototypeImp::RegExpPrototypeImp):
+ (RegExpProtoFuncImp::callAsFunction):
+ (RegExpObjectImp::RegExpObjectImp):
+ (RegExpObjectImp::arrayOfMatches):
+ (RegExpObjectImp::getBackref):
+ (RegExpObjectImp::getLastMatch):
+ (RegExpObjectImp::getLastParen):
+ (RegExpObjectImp::getLeftContext):
+ (RegExpObjectImp::getRightContext):
+ (RegExpObjectImp::getValueProperty):
+ (RegExpObjectImp::construct):
+ * kjs/string_object.cpp:
+ (StringInstanceImp::StringInstanceImp):
+ (StringPrototypeImp::StringPrototypeImp):
+ (replace):
+ (StringProtoFuncImp::callAsFunction):
+ (StringObjectImp::StringObjectImp):
+ (StringObjectImp::callAsFunction):
+ (StringObjectFuncImp::StringObjectFuncImp):
+ (StringObjectFuncImp::callAsFunction):
+ * kjs/testkjs.cpp:
+ (TestFunctionImp::callAsFunction):
+ (VersionFunctionImp::callAsFunction):
+ * kjs/value.h:
+
+2005-12-10 Oliver Hunt <ojh16@student.canterbury.ac.nz>
+
+ Reviewed by Maciej, landed by Darin.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=3539
+ Array join and toString methods do not support circular references
+
+ * kjs/array_object.cpp: (ArrayProtoFuncImp::callAsFunction):
+ Added set of visited objects -- don't recurse if item is already in the set.
+
+2005-12-08 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by John.
+
+ - fix major memory leak and resultant slowdown on JavaScript iBench from
+ my PassRefPtr changes
+
+ * kjs/ustring.cpp:
+ (KJS::UString::Rep::create): I forgot to change one of the two overloads to create
+ with a refcount of 0 instead of 1 (the smart pointer then bumps it. But instead of
+ changing it, I changed both to start with a refcounter of 1 and use PassRefPtr::adopt
+ to adopt the initial refcount, this may be a hair more efficient.
+
+ - made the assignment operators for smart pointers inline because Shark said so
+
+ * kxmlcore/PassRefPtr.h:
+ (KXMLCore::::operator=):
+ * kxmlcore/RefPtr.h:
+ (KXMLCore::::operator=):
+
+2005-12-06 Anders Carlsson <andersca@mac.com>
+
+ Reviewed by Darin.
+
+ - fix build when using gcc 4
+
+ * kjs/ustring.h:
+ Make Rep public.
+
+ * kxmlcore/PassRefPtr.h:
+ (KXMLCore::::operator):
+ Fix a typo.
+
+2005-12-05 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Eric.
+
+ - add PassRefPtr, a smart pointer class that works in conjunction
+ with RefPtr but has transfer-of-ownership semantics
+ - apply RefPtr and PassRefPtr to UString
+ - cleaned up UString a little so that it doesn't need to have so many friend classes
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * kjs/identifier.cpp:
+ (KJS::Identifier::add):
+ * kjs/identifier.h:
+ (KJS::Identifier::Identifier):
+ (KJS::Identifier::equal):
+ * kjs/property_map.cpp:
+ (KJS::PropertyMap::get):
+ (KJS::PropertyMap::getLocation):
+ (KJS::PropertyMap::put):
+ (KJS::PropertyMap::remove):
+ * kjs/ustring.cpp:
+ (KJS::UCharReference::operator=):
+ (KJS::UCharReference::ref):
+ (KJS::UString::Rep::createCopying):
+ (KJS::UString::Rep::create):
+ (KJS::UString::usedCapacity):
+ (KJS::UString::usedPreCapacity):
+ (KJS::UString::expandCapacity):
+ (KJS::UString::expandPreCapacity):
+ (KJS::UString::UString):
+ (KJS::UString::spliceSubstringsWithSeparators):
+ (KJS::UString::append):
+ (KJS::UString::operator=):
+ (KJS::UString::toStrictUInt32):
+ (KJS::UString::substr):
+ (KJS::UString::copyForWriting):
+ (KJS::operator==):
+ * kjs/ustring.h:
+ (KJS::UString::UString):
+ (KJS::UString::~UString):
+ (KJS::UString::data):
+ (KJS::UString::isNull):
+ (KJS::UString::isEmpty):
+ (KJS::UString::size):
+ (KJS::UString::rep):
+ * kxmlcore/RefPtr.h:
+ (KXMLCore::RefPtr::RefPtr):
+ (KXMLCore::RefPtr::operator*):
+ (KXMLCore::::operator):
+ (KXMLCore::operator==):
+ (KXMLCore::operator!=):
+ (KXMLCore::static_pointer_cast):
+ (KXMLCore::const_pointer_cast):
+
+2005-12-04 Geoffrey Garen <ggaren@apple.com>
+
+ Update test results to match Anders's last checkin.
+
+ * tests/mozilla/expected.html:
+
+2005-12-04 Anders Carlsson <andersca@mac.com>
+
+ Reviewed by Geoffrey.
+
+ - Fixes <http://bugs.webkit.org/show_bug.cgi?id=3999>
+ Object.prototype is missing propertyIsEnumerable
+
+ * kjs/object.cpp:
+ (KJS::ObjectImp::canPut):
+ Refactor to use getPropertyAttributes.
+
+ (KJS::ObjectImp::propertyIsEnumerable):
+ New function which checks if a property is enumerable.
+
+ (KJS::ObjectImp::getPropertyAttributes):
+ * kjs/object.h:
+ Add getPropertyAttributes and propertyIsEnumerable.
+
+ * kjs/object_object.cpp:
+ (ObjectPrototypeImp::ObjectPrototypeImp):
+ (ObjectProtoFuncImp::callAsFunction):
+ * kjs/object_object.h:
+ (KJS::ObjectProtoFuncImp::):
+ Add propertyIsEnumerable to the Object prototype.
+
+2005-12-01 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Tim Hatcher.
+
+ - removed deprecated reset, isNull and nonNull methods
+
+ * kxmlcore/RefPtr.h:
+
+2005-12-01 Anders Carlsson <andersca@mac.com>
+
+ Reviewed by Darin.
+
+ - Fixes <http://bugs.webkit.org/show_bug.cgi?id=3382>
+ nodes2strings.cpp fails to print left expression of ForInNode when 'var' is not used
+
+ Patch by Mark Rowe.
+
+ * kjs/nodes2string.cpp:
+ (ForInNode::streamTo):
+ Add lexpr if there's no varDecl.
+
+2005-12-01 Maciej Stachowiak <mjs@apple.com>
+
+ Rubber stamped by Eric.
+
+ - renamed SharedPtr to RefPtr via script
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * kjs/function.cpp:
+ (KJS::GlobalFuncImp::callAsFunction):
+ * kjs/function.h:
+ * kjs/function_object.cpp:
+ (FunctionObjectImp::construct):
+ * kjs/internal.cpp:
+ (KJS::Parser::parse):
+ (KJS::InterpreterImp::checkSyntax):
+ (KJS::InterpreterImp::evaluate):
+ * kjs/internal.h:
+ * kjs/nodes.h:
+ * kjs/nodes2string.cpp:
+ (KJS::SourceStream::operator<<):
+ * kjs/protect.h:
+ * kxmlcore/RefPtr.h: Added.
+ (KXMLCore::RefPtr::RefPtr):
+ (KXMLCore::RefPtr::~RefPtr):
+ (KXMLCore::RefPtr::isNull):
+ (KXMLCore::RefPtr::notNull):
+ (KXMLCore::RefPtr::reset):
+ (KXMLCore::RefPtr::get):
+ (KXMLCore::RefPtr::operator*):
+ (KXMLCore::RefPtr::operator->):
+ (KXMLCore::RefPtr::operator!):
+ (KXMLCore::RefPtr::operator UnspecifiedBoolType):
+ (KXMLCore::::operator):
+ (KXMLCore::operator==):
+ (KXMLCore::operator!=):
+ (KXMLCore::static_pointer_cast):
+ (KXMLCore::const_pointer_cast):
+ * kxmlcore/SharedPtr.h: Removed.
+
+2005-11-30 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Dave Hyatt.
+
+ - change idiom used for implicit bool conversion of smart pointers, because the old one gives weird error messages sometimes
+
+ * kjs/protect.h:
+ (KJS::ProtectedPtr::operator UnspecifiedBoolType):
+ * kxmlcore/SharedPtr.h:
+ (KXMLCore::SharedPtr::operator UnspecifiedBoolType):
+
+2005-11-29 Mitz Pettel <opendarwin.org@mitzpettel.com>
+
+ Reviewed by ggaren. Committed by eseidel.
+
+ Date conversion to local time gets the DST flag wrong sometimes
+ http://bugs.webkit.org/show_bug.cgi?id=5514
+
+ * kjs/date_object.cpp:
+ (KJS::isTime_tSigned):
+ (KJS::DateProtoFuncImp::callAsFunction):
+
+2005-11-26 Maciej Stachowiak <mjs@apple.com>
+
+ Rubber stamped by Eric.
+
+ - renamed InterpreterLock to JSLock
+
+ * bindings/NP_jsobject.cpp:
+ (_NPN_Invoke):
+ (_NPN_Evaluate):
+ (_NPN_GetProperty):
+ (_NPN_SetProperty):
+ (_NPN_RemoveProperty):
+ (_NPN_HasProperty):
+ (_NPN_HasMethod):
+ (_NPN_SetException):
+ * bindings/jni/jni_jsobject.cpp:
+ (JSObject::call):
+ (JSObject::eval):
+ (JSObject::getMember):
+ (JSObject::setMember):
+ (JSObject::removeMember):
+ (JSObject::getSlot):
+ (JSObject::setSlot):
+ (JSObject::toString):
+ (JSObject::convertJObjectToValue):
+ * bindings/objc/WebScriptObject.mm:
+ (-[WebScriptObject callWebScriptMethod:withArguments:]):
+ (-[WebScriptObject evaluateWebScript:]):
+ (-[WebScriptObject setValue:forKey:]):
+ (-[WebScriptObject valueForKey:]):
+ (-[WebScriptObject removeWebScriptKey:]):
+ (-[WebScriptObject stringRepresentation]):
+ (-[WebScriptObject webScriptValueAtIndex:]):
+ (-[WebScriptObject setWebScriptValueAtIndex:value:]):
+ (+[WebScriptObject _convertValueToObjcValue:originExecutionContext:executionContext:]):
+ * bindings/runtime.cpp:
+ (Instance::createRuntimeObject):
+ * bindings/runtime_root.cpp:
+ (KJS::Bindings::addNativeReference):
+ (KJS::Bindings::removeNativeReference):
+ (RootObject::removeAllNativeReferences):
+ * bindings/runtime_root.h:
+ (KJS::Bindings::RootObject::~RootObject):
+ (KJS::Bindings::RootObject::setRootObjectImp):
+ * bindings/testbindings.cpp:
+ (main):
+ * bindings/testbindings.mm:
+ (main):
+ * kjs/JSLock.cpp:
+ (KJS::initializeJSLock):
+ (KJS::JSLock::lock):
+ (KJS::JSLock::unlock):
+ (KJS::JSLock::lockCount):
+ (KJS::JSLock::DropAllLocks::DropAllLocks):
+ (KJS::JSLock::DropAllLocks::~DropAllLocks):
+ * kjs/JSLock.h:
+ (KJS::JSLock::JSLock):
+ (KJS::JSLock::~JSLock):
+ * kjs/collector.cpp:
+ (KJS::Collector::allocate):
+ (KJS::Collector::collect):
+ * kjs/internal.cpp:
+ (KJS::InterpreterImp::InterpreterImp):
+ (KJS::InterpreterImp::clear):
+ (KJS::InterpreterImp::checkSyntax):
+ (KJS::InterpreterImp::evaluate):
+ * kjs/interpreter.cpp:
+ (Interpreter::evaluate):
+ * kjs/protect.h:
+ (KJS::::ProtectedPtr):
+ (KJS::::~ProtectedPtr):
+ (KJS::::operator):
+ * kjs/protected_reference.h:
+ (KJS::ProtectedReference::ProtectedReference):
+ (KJS::ProtectedReference::~ProtectedReference):
+ (KJS::ProtectedReference::operator=):
+ * kjs/protected_values.cpp:
+ (KJS::ProtectedValues::getProtectCount):
+ (KJS::ProtectedValues::increaseProtectCount):
+ (KJS::ProtectedValues::decreaseProtectCount):
+ * kjs/testkjs.cpp:
+ (TestFunctionImp::callAsFunction):
+ (main):
+
+2005-11-26 Darin Adler <darin@apple.com>
+
+ Reviewed by eseidel. Committed by eseidel.
+
+ Inline ScopeChain functions for speed.
+ http://bugs.webkit.org/show_bug.cgi?id=5687
+
+ * kjs/object.h:
+ (KJS::ScopeChain::mark):
+ * kjs/scope_chain.cpp:
+ * kjs/scope_chain.h:
+ (KJS::ScopeChain::ref):
+ (KJS::ScopeChain::operator=):
+ (KJS::ScopeChain::bottom):
+ (KJS::ScopeChain::push):
+ (KJS::ScopeChain::pop):
+
+2005-11-21 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Geoff.
+
+ <rdar://problem/4139620> Seed: WebKit: hang when sending XMLHttpRequest if automatic proxy config is used
+
+ Also factored locking code completely into a separate class, and
+ added a convenient packaged way to temporarily drop locks.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * kjs/JSLock.cpp: Added.
+ (KJS::initializeInterpreterLock):
+ (KJS::InterpreterLock::lock):
+ (KJS::InterpreterLock::unlock):
+ (KJS::InterpreterLock::lockCount):
+ (KJS::InterpreterLock::DropAllLocks::DropAllLocks):
+ (KJS::InterpreterLock::DropAllLocks::~DropAllLocks):
+ * kjs/JSLock.h: Added.
+ (KJS::InterpreterLock::InterpreterLock):
+ (KJS::InterpreterLock::~InterpreterLock):
+ * kjs/internal.cpp:
+ * kjs/internal.h:
+ * kjs/interpreter.cpp:
+ * kjs/interpreter.h:
+ * kjs/protect.h:
+ * kjs/testkjs.cpp:
+ (TestFunctionImp::callAsFunction):
+
+2005-11-21 Eric Seidel <eseidel@apple.com>
+
+ Rubber-stamped by hyatt.
+
+ Removed JavaScriptCore+SVG target.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2005-11-15 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by mjs.
+
+ - Fixed <rdar://problem/4342216> Installer crash in
+ KJS::ValueImp::marked() when garbage collector runs inside call to
+ ConstantValues::init()
+
+ I took responsibility for initializing and marking ConstantValues away
+ from InterpreterImp, since it's possible to reference such a value
+ before any interpreter has been created and after the last interpreter
+ has been destroyed.
+
+ InterpreterImp::lock now initializes ConstantValues. It's a good
+ place for the initialization because you have to call it before
+ creating any objects. Since ::lock can be called more than once,
+ I added a check in ConstantValues::init to ensure that it executes
+ only once.
+
+ Collector:collect is now responsible for marking ConstantValues.
+
+ We no longer clear the ConstantValues since we can't guarantee that no
+ one has a reference to them.
+
+ FIXME: This is hackery. The long-term plan is to make ConstantValues
+ use immediate values that require no initialization.
+
+ * ChangeLog:
+ * kjs/collector.cpp:
+ (KJS::Collector::collect):
+ * kjs/internal.cpp:
+ (KJS::InterpreterImp::InterpreterImp):
+ (KJS::InterpreterImp::lock):
+ (KJS::InterpreterImp::clear):
+ (KJS::InterpreterImp::mark):
+ * kjs/internal.h:
+ * kjs/value.cpp:
+ (KJS::ConstantValues::initIfNeeded):
+ * kjs/value.h:
+
+2005-11-08 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin.
+
+ This patch fixes some naughty naughty code -- 5 crashes and 2
+ may-go-haywire-in-the-futures.
+
+ One such crash is <rdar://problem/4247330> 8C46 Crash with with
+ incomplete parameter list to webScript object function.
+
+ I replaced early returns from within NS_DURINGs with calls to
+ NS_VALUERETURN because the doc says, "You cannot use goto or
+ return to exit an exception handling domain -- errors will result."
+
+ I replaced hard-coded analyses of -[NSMethodSignature
+ methodReturnType] with more abstracted alternatives, since
+ the documentation says "This encoding is implementation-specific,
+ so applications should use it with caution," and then emits an
+ evil cackle.
+
+ I removed the early return in the case where a JavaScript caller
+ supplies an insufficient number of arguments, because the right
+ thing to do in such a case is to use JavaScript's defined behavior
+ of supplying "undefined" for any missing arguments.
+
+ I also changed ObjcInstance::invokeMethod so that it no longer
+ deletes the method passed to it. It doesn't create the method,
+ so it shouldn't delete it. A friend of mine named
+ KERNEL_PROTECTION_FAILURE agrees with me on this point.
+
+ Finally, I changed an assert(true) to assert(false) because
+ all the other asserts were making fun of it.
+
+ * bindings/objc/objc_instance.mm:
+ (ObjcInstance::invokeMethod):
+ (ObjcInstance::invokeDefaultMethod):
+
+2005-11-06 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin.
+
+ - Fixed http://bugs.webkit.org/show_bug.cgi?id=5571
+ REGRESSION (412.5-TOT): duplicated words/sentences at
+ shakespeer.sourceforge.net
+
+ Our UTF16-modified PCRE didn't work with extended character classes
+ (classes involving characters > 255) because it used the GETCHARINC
+ macro to read through them. In UTF16 mode, GETCHARINC expects UTF16
+ input, but PCRE encodes character classes in UTF8 regardless of the
+ input mode of the subject string.
+
+ The fix is to explicitly define GETUTF8CHARINC, and to use it,
+ rather than GETCHARINC, when reading extended character classes.
+
+ In UTF8 mode, we simply define GETCHARINC to be GETUTF8CHARINC.
+
+ * pcre/pcre_internal.h:
+ * pcre/pcre_xclass.c:
+ (_pcre_xclass):
+
+2005-11-05 Geoffrey Garen <ggaren@apple.com>
+
+ Patch by Mitz Pettel, reviewed by Maciej.
+
+ - Fixed http://bugs.webkit.org/show_bug.cgi?id=5357
+ REGRESSION: Scriptable plugin hides properties of OBJECT element
+
+ * bindings/objc/objc_class.mm:
+ (KJS::Bindings::ObjcClass::fallbackObject):
+
+2005-11-05 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin.
+
+ - Fixed http://bugs.webkit.org/show_bug.cgi?id=5409
+ slice() testcase doesn't pass
+
+ Modified String.slice to deal with funky values.
+ Updated test results. We now pass <js1_2/String/slice.js>.
+
+ * kjs/string_object.cpp:
+ (StringProtoFuncImp::callAsFunction):
+ * tests/mozilla/expected.html:
+
+2005-11-04 Darin Adler <darin@apple.com>
+
+ Reviewed by Tim Hatcher.
+
+ * kxmlcore/HashSet.h: Fixed case of "hashfunctions.h" -- needs to be "HashFunctions.h".
+
+2005-11-03 Timothy Hatcher <timothy@apple.com>
+
+ Reviewed by Darin and Vicki.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ Change to use $(SYSTEM_LIBRARY_DIR) consistently and place
+ $(NEXT_ROOT) in a few spots to make build-root work.
+
+2005-11-03 Geoffrey Garen <ggaren@apple.com>
+
+ - Updated JavaScriptCore test results to reflect recent fixes.
+
+ * tests/mozilla/expected.html:
+
+2005-11-03 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by darin.
+
+ - Fixed http://bugs.webkit.org/show_bug.cgi?id=5602
+ REGRESSION: RegExp("[^\\s$]+", "g") returns extra matches
+
+ We now update lastIndex relative to the start of the last match,
+ rather than the start of the last search. We used to assume that
+ the two were equal, but that is not the case when a pattern
+ matches at a character after the first in the string.
+
+ * kjs/regexp_object.cpp:
+ (RegExpProtoFuncImp::callAsFunction):
+
+2005-10-24 John Sullivan <sullivan@apple.com>
+
+ Reviewed by Darin Adler. Code changes by Alexey Proskuryakov.
+
+ - fixed http://bugs.webkit.org/show_bug.cgi?id=4931
+ Unicode format characters (Cf) should be removed from JavaScript source
+
+ * kjs/lexer.cpp:
+ include <unicode/uchar.h>
+ (Lexer::Lexer):
+ use KJS::UChar instead of UChar to avoid ambiguity caused by new include
+ (Lexer::setCode):
+ ditto; also, use shift(4) to skip first 4 chars to take advantage of new
+ logic there.
+ (Lexer::shift):
+ skip chars of type U_FORMAT_CHAR
+ (Lexer::convertUnicode):
+ use KJS::UChar instead of UChar to avoid ambiguity caused by new include
+ (Lexer::record16):
+ ditto
+ (Lexer::makeIdentifier):
+ ditto
+ (Lexer::makeUString):
+ ditto
+
+ * tests/mozilla/ecma/Array/15.4.5.1-1.js:
+ updated to skip soft hyphens
+
+2005-10-24 John Sullivan <sullivan@apple.com>
+
+ Reviewed by Darin Adler. Code changes by George Staikos/Geoff Garen.
+
+ - fixed http://bugs.webkit.org/show_bug.cgi?id=4142
+ Date object does not always adjust daylight savings correctly
+
+ * kjs/date_object.cpp:
+ (KJS::makeTime):
+ Fix the case where a time change crosses the daylight savings start/end dates.
+
+2005-10-17 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Geoff. Code changes by Darin.
+
+ - some micro-optimizations to FastMalloc to reduce math and branches.
+
+ * kxmlcore/FastMalloc.cpp:
+ (KXMLCore::TCMalloc_Central_FreeList::Populate):
+ (KXMLCore::fastMallocRegisterThread):
+ (KXMLCore::TCMalloc_ThreadCache::GetCache):
+ (KXMLCore::TCMalloc_ThreadCache::GetCacheIfPresent):
+
+2005-10-15 Maciej Stachowiak <mjs@apple.com>
+
+ Reverted fix for this bug, because it was part of a time range that caused a performance
+ regression:
+
+ <rdar://problem/4260481> Remove Reference type from JavaScriptCore
+
+2005-10-15 Darin Adler <darin@apple.com>
+
+ * kxmlcore/HashTable.cpp: Fixed build failure (said hashtable.h instead of HashTable.h).
+
+2005-10-14 Geoffrey Garen <ggaren@apple.com>
+
+ Style changes recommended by Darin.
+
+ Changed to camelCase, changed ValueImp* to ValueImp *.
+
+ * kjs/simple_number.h:
+ (KJS::SimpleNumber::make):
+ (KJS::SimpleNumber::value):
+
+2005-10-11 Geoffrey Garen <ggaren@apple.com>
+
+ Added regexp_object.lut.h build phase from JavaScriptCore
+ to JavaScriptCore+SVG.
+
+ Reviewed by mitz.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2005-10-11 Geoffrey Garen <ggaren@apple.com>
+
+ Fixed build bustage from last checkin (stray characters
+ in the project file).
+
+ Reviewed by mitz.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2005-10-11 Geoffrey Garen <ggaren@apple.com>
+
+ New JavaScriptCore test results to reflect the last change.
+
+ * tests/mozilla/expected.html:
+
+2005-10-10 Geoffrey Garen <ggaren@apple.com>
+
+ - Implemented caching of match state inside the global RegExp object
+ (lastParen, leftContext, rightContext, lastMatch, input).
+
+ exec(), test(), match(), search(), and replace() now dipatch regular
+ expression matching through the RegExp object's performMatch function,
+ to facilitate caching. This replaces registerRegexp and
+ setSubPatterns.
+
+ - Implemented the special '$' aliases (e.g. RegExp.input aliases to
+ RegExp.$_).
+
+ - Moved support for backreferences into the new static hash table
+ used for other special RegExp properties. Truncated backreferences
+ at $9 to match IE, FF, and the "What's New in Netscape 1.2?" doc.
+ (String.replace still supports double-digit backreferences.)
+
+ - Tweaked RegExp.prototype.exec to handle ginormous values in lastIndex.
+
+ Fixes 11 -- count em, 11 -- JavaScriptCore tests.
+
+ * fast/js/regexp-caching-expected.txt: Added.
+ * fast/js/regexp-caching.html: Added.
+
+ Reviewed by mjs.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj: Added regexp_object.lut.h
+ * kjs/create_hash_table: Tweaked to allow for more exotic characters.
+ We now rely on the compiler to catch illegal
+ identifiers.
+ * kjs/regexp.cpp:
+ (KJS::RegExp::RegExp):
+ * kjs/regexp_object.cpp:
+ (RegExpProtoFuncImp::callAsFunction):
+ (RegExpObjectImp::RegExpObjectImp):
+ (RegExpObjectImp::performMatch):
+ (RegExpObjectImp::arrayOfMatches):
+ (RegExpObjectImp::backrefGetter):
+ (RegExpObjectImp::getLastMatch):
+ (RegExpObjectImp::getLastParen):
+ (RegExpObjectImp::getLeftContext):
+ (RegExpObjectImp::getRightContext):
+ (RegExpObjectImp::getOwnPropertySlot):
+ (RegExpObjectImp::getValueProperty):
+ (RegExpObjectImp::put):
+ (RegExpObjectImp::putValueProperty):
+ * kjs/regexp_object.h:
+ (KJS::RegExpObjectImp::):
+ * kjs/string_object.cpp:
+ (substituteBackreferences):
+ (replace):
+ (StringProtoFuncImp::callAsFunction):
+
+2005-10-09 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej; some changes done after review.
+
+ - fixed <rdar://problem/4092064> hanging loading page; rte.ie (works in IE and Firefox)
+ - fixed http://bugs.webkit.org/show_bug.cgi?id=5280
+ Date.setMonth fails with negative values
+ - fixed http://bugs.webkit.org/show_bug.cgi?id=5154
+ JSC should switch to _r variants of unix time/date functions
+ - fixed a few possible overflow cases
+
+ Retested all tests to be sure nothing broke; added layout test for bug 5280.
+
+ * kjs/config.h: Removed TIME_WITH_SYS_TIME define. Also set HAVE_SYS_TIMEB_H
+ for the __APPLE__ case (the latter is accurate but irrelevant).
+
+ * kjs/date_object.h: Reformatted. Removed unnecessary include of "function_object.h".
+ Moved declarations of helper classes and functions into the cpp file.
+
+ * kjs/date_object.cpp: Removed code at top to define macros to use CoreFoundation instead of
+ POSIX date functions.
+ (KJS::styleFromArgString): Tweaked to return early instead of using a variable.
+ (KJS::formatLocaleDate): Tweaked to check for undefined rather than checking argument count.
+ (KJS::formatDate): Made parameter const.
+ (KJS::formatDateUTCVariant): Ditto.
+ (KJS::formatTime): Ditto.
+ (KJS::DateProtoFuncImp::callAsFunction): Use gmtime_r and localtime_r instead of gmtime and
+ localtime.
+ (KJS::DateObjectImp::callAsFunction): Use localtime_r instead of localtime.
+ (KJS::ymdhmsToSeconds): Renamed from ymdhms_to_seconds. Changed computation to avoid possible
+ overflow if year is an extremely large or small number.
+ (KJS::makeTime): Removed code to move large month numbers from tm_mon to tm_year; this was
+ to accomodate CFGregorianDate, which is no longer used (and didn't handle negative values).
+ (KJS::parseDate): Renamed from KRFCDate_parseDate; changed to return a value in milliseconds
+ rather than in seconds. Reformatted the code. Changed to use UTF8String() instead of ascii(),
+ since ascii() is not thread safe. Changed some variables back from int to long to avoid
+ trouble if the result of strtol does not fit in an int (64-bit issue only).
+
+2005-10-08 Mitz Pettel <opendarwin.org@mitzpettel.com>
+
+ Reviewed by Geoff.
+ Tweaked and landed by Darin.
+
+ - fixed http://bugs.webkit.org/show_bug.cgi?id=5266
+ Support parenthesized comments in Date.parse()
+
+ * kjs/date_object.cpp:
+ (KJS::skipSpacesAndComments): Take a pointer, and advance it past spaces,
+ and also past anything enclosed in parentheses.
+ (KJS::KRFCDate_parseDate): Use skipSpacesAndComments wherever we formerly had
+ code to skip spaces.
+
+2005-10-08 Justin Haygood <justin@xiondigital.net>
+
+ Reviewed, tweaked, and landed by Darin.
+
+ - fixed http://bugs.webkit.org/show_bug.cgi?id=5189
+ pcre_exec.c fails to compile using MSVC
+ - fixed http://bugs.webkit.org/show_bug.cgi?id=5190
+ KJS config.h adjustment for Win32
+
+ * kjs/config.h: Make sure HAVE_MMAP and HAVE_SBRK are off for Win32.
+ Turn HAVE_ERRNO_H on for Mac OS X. Sort defines so they are easy to compare
+ with each other. Remove #undef of DEBUG_COLLECTOR.
+ * pcre/pcre_exec.c: (match): Work around strange MSVC complaint by splitting
+ the definition of a local variable into a separate declaration and
+ initialization.
+
+2005-10-05 Geoffrey Garen <ggaren@apple.com>
+
+ - Darin and I rewrote our implementation of the SimpleNumber class
+ to store number bit patterns in their floating point formats.
+
+ My tweaks reviewed by Darin.
+
+ ~1% speedup on JS iBench.
+
+ * kjs/internal.h: removed obsolete jsNumber declarations.
+ * kjs/math_object.cpp:
+ (MathFuncImp::callAsFunction): changed KJS::isNaN to isNaN
+ * kjs/nodes.cpp:
+ (PostfixResolveNode::evaluate): removed obsolete knownToBeInteger
+ (PostfixBracketNode::evaluate): ditto
+ (PostfixDotNode::evaluate): ditto
+ (PrefixResolveNode::evaluate): ditto
+ (PrefixBracketNode::evaluate): ditto
+ (PrefixDotNode::evaluate): ditto
+ (NegateNode::evaluate): ditto
+ (valueForReadModifyAssignment): ditto
+ * kjs/number_object.cpp: removed obsolete comment
+ * kjs/operations.cpp:
+ (KJS::equal): removed unnecessary isNaN checks
+ (KJS::strictEqual): ditto
+ (KJS::add): removed obsolete knownToBeInteger
+ (KJS::mult): ditto
+ * kjs/operations.h: removed include of "value.h" to prevent circular reference
+ * kjs/simple_number.h: removed unnecessary #includes
+ (KJS::SimpleNumber::make): see above
+ (KJS::SimpleNumber::is): ditto
+ (KJS::SimpleNumber::value): ditto
+ * kjs/string_object.cpp:
+ (StringProtoFuncImp::callAsFunction): changed KJS::isNaN to isNaN
+ * kjs/ustring.cpp: removed unnecessary isNaN check
+ (KJS::UString::toUInt32): ditto
+ * kjs/value.cpp:
+ (KJS::jsNumber): removed obsolete jsNumber definitions
+ (KJS::ConstantValues::init): NaN is no longer a ConstantValue
+ (KJS::ConstantValues::clear): ditto
+ (KJS::ConstantValues::mark): ditto
+ * kjs/value.h: removed obsolete knownToBeInteger
+ (KJS::jsNaN): now returns a SimpleNumber
+ (KJS::ValueImp::getUInt32): changed to account for NaN being a SimpleNumber
+ (KJS::ValueImp::toBoolean): ditto
+ (KJS::ValueImp::toString): changed to account for +/- 0.0
+ (KJS::jsZero): changed to reflect that SimpleNumber::make takes a double
+ (KJS::jsOne): ditto
+ (KJS::jsTwo): ditto
+ (KJS::Number): removed obsolete non-double constructor declarations
+
+2005-10-05 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Eric.
+
+ - fixed <rdar://problem/4260481> Remove Reference type from JavaScriptCore
+
+ Also fixed some bugs with for..in enumeration while I was at it. object
+ properties now come before prototype properties and duplicates
+ between object and prototype are listed only once.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * kjs/IdentifierSequencedSet.cpp: Added.
+ (KJS::IdentifierSequencedSet::IdentifierSequencedSet):
+ (KJS::IdentifierSequencedSet::deallocateVector):
+ (KJS::IdentifierSequencedSet::~IdentifierSequencedSet):
+ (KJS::IdentifierSequencedSet::insert):
+ * kjs/IdentifierSequencedSet.h: Added.
+ (KJS::IdentifierSequencedSetIterator::IdentifierSequencedSetIterator):
+ (KJS::IdentifierSequencedSetIterator::operator*):
+ (KJS::IdentifierSequencedSetIterator::operator->):
+ (KJS::IdentifierSequencedSetIterator::operator++):
+ (KJS::IdentifierSequencedSetIterator::operator==):
+ (KJS::IdentifierSequencedSetIterator::operator!=):
+ (KJS::IdentifierSequencedSet::begin):
+ (KJS::IdentifierSequencedSet::end):
+ (KJS::IdentifierSequencedSet::size):
+ * kjs/array_instance.h:
+ * kjs/array_object.cpp:
+ (ArrayInstanceImp::getPropertyNames):
+ (ArrayInstanceImp::setLength):
+ (ArrayInstanceImp::pushUndefinedObjectsToEnd):
+ * kjs/nodes.cpp:
+ (ForInNode::execute):
+ * kjs/nodes.h:
+ * kjs/object.cpp:
+ (KJS::ObjectImp::getPropertyNames):
+ * kjs/object.h:
+ * kjs/property_map.cpp:
+ (KJS::PropertyMap::getEnumerablePropertyNames):
+ (KJS::PropertyMap::getSparseArrayPropertyNames):
+ * kjs/property_map.h:
+ * kjs/protect.h:
+ * kjs/protected_reference.h: Removed.
+ * kjs/reference.cpp: Removed.
+ * kjs/reference.h: Removed.
+ * kjs/reference_list.cpp: Removed.
+ * kjs/reference_list.h: Removed.
+ * kjs/ustring.h:
+ (KJS::UString::impl):
+ * kxmlcore/HashSet.h:
+
+2005-10-04 Eric Seidel <eseidel@apple.com>
+
+ Reviewed by mjs.
+
+ Code cleanup, which resulted in a small win on iBench.
+
+ * kjs/object.cpp:
+ (KJS::tryGetAndCallProperty): new static inline
+ (KJS::ObjectImp::defaultValue): code cleanup
+
+2005-10-03 Maciej Stachowiak <mjs@apple.com>
+
+ Patch from George Staikos <staikos@kde.org>, reviewed and tweaked a bit by me.
+
+ - more Linux build fixes
+
+ * kjs/operations.cpp:
+ * kxmlcore/FastMalloc.h:
+ * kxmlcore/TCSystemAlloc.cpp:
+ (TCMalloc_SystemAlloc):
+
+2005-10-03 Maciej Stachowiak <mjs@apple.com>
+
+ Patch from George Staikos <staikos@kde.org>, reviewed and tweaked a bit by me.
+
+ http://bugs.webkit.org/show_bug.cgi?id=5174
+ Add support for compiling on Linux (likely to help for other POSIX systems too)
+
+ * kjs/collector.cpp:
+ (KJS::Collector::markCurrentThreadConservatively):
+ (KJS::Collector::markOtherThreadConservatively):
+ * kjs/config.h:
+ * kjs/date_object.cpp:
+ (KJS::formatDate):
+ (KJS::formatDateUTCVariant):
+ (KJS::formatTime):
+ (KJS::timeZoneOffset):
+ (KJS::DateProtoFuncImp::callAsFunction):
+ (KJS::DateObjectImp::construct):
+ (KJS::DateObjectImp::callAsFunction):
+ (KJS::makeTime):
+ * kjs/identifier.cpp:
+ * kjs/internal.cpp:
+ (KJS::initializeInterpreterLock):
+ (KJS::lockInterpreter):
+ (KJS::unlockInterpreter):
+ (KJS::UndefinedImp::toPrimitive):
+ (KJS::UndefinedImp::toBoolean):
+ (KJS::UndefinedImp::toNumber):
+ (KJS::UndefinedImp::toString):
+ (KJS::NullImp::toPrimitive):
+ (KJS::NullImp::toBoolean):
+ (KJS::NullImp::toNumber):
+ (KJS::NullImp::toString):
+ (KJS::BooleanImp::toPrimitive):
+ (KJS::BooleanImp::toBoolean):
+ (KJS::BooleanImp::toNumber):
+ (KJS::BooleanImp::toString):
+ (KJS::StringImp::toPrimitive):
+ (KJS::StringImp::toBoolean):
+ (KJS::StringImp::toNumber):
+ (KJS::StringImp::toString):
+ * kjs/internal.h:
+ * kjs/protected_values.cpp:
+
+2005-10-03 Maciej Stachowiak <mjs@apple.com>
+
+ - fix Development build after last checkin
+
+ * kxmlcore/FastMalloc.cpp:
+ (KXMLCore::fastMallocRegisterThread):
+
+2005-10-02 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin.
+
+ <rdar://problem/4283967> REGRESSION: 3% regression on PLT from new FastMalloc
+ http://bugs.webkit.org/show_bug.cgi?id=5243
+
+ A number of optimizations to the new threadsafe malloc that make it actually as fast
+ as dlmalloc (I measured wrong before) and as memory-efficient as the system malloc.
+
+ - use fastMalloc for everything - it now gets applied to all new/delete allocations
+ via a private inline operator new that is now included into every file via config.h.
+
+ - tweaked some of the numeric parameters for size classes and amount of wasted memory
+ allowed per allocation - this saves on memory use and consequently improves speed.
+
+ - so long as the allocator is not being used on background threads, get the per-thread
+ cache from a global variable instead of from pthread_getspecific, since the latter is slow.
+
+ - inline more functions, and force the ones GCC refuses to inline with
+ attribute(always_inline), nearly all of these have one call site so inlining them has
+ to be a win.
+
+ - use some tricks to calculate allocation size more efficiently and fewer times for small
+ allocations, to avoid hitting the huge size table array.
+
+ - avoid hitting the per-thread cache on code paths that don't need it.
+
+ - implement inline assembly version of spinlock for PowerPC (was already done for x86)
+
+ * bindings/NP_jsobject.cpp:
+ * bindings/c/c_class.cpp:
+ * bindings/c/c_instance.cpp:
+ * bindings/c/c_runtime.cpp:
+ * bindings/c/c_utility.cpp:
+ * bindings/jni/jni_class.cpp:
+ * bindings/jni/jni_instance.cpp:
+ * bindings/jni/jni_jsobject.cpp:
+ * bindings/jni/jni_objc.mm:
+ * bindings/jni/jni_runtime.cpp:
+ * bindings/jni/jni_utility.cpp:
+ * bindings/npruntime.cpp:
+ * bindings/objc/WebScriptObject.mm:
+ * bindings/objc/objc_class.mm:
+ * bindings/objc/objc_instance.mm:
+ * bindings/objc/objc_runtime.mm:
+ * bindings/objc/objc_utility.mm:
+ * bindings/runtime.cpp:
+ * bindings/runtime_array.cpp:
+ * bindings/runtime_method.cpp:
+ * bindings/runtime_object.cpp:
+ * bindings/runtime_root.cpp:
+ * bindings/testbindings.cpp:
+ * bindings/testbindings.mm:
+ * kjs/array_object.cpp:
+ (ArrayInstanceImp::ArrayInstanceImp):
+ (ArrayInstanceImp::~ArrayInstanceImp):
+ (ArrayInstanceImp::resizeStorage):
+ * kjs/bool_object.cpp:
+ * kjs/collector.cpp:
+ (KJS::Collector::registerThread):
+ * kjs/config.h:
+ * kjs/debugger.cpp:
+ * kjs/error_object.cpp:
+ * kjs/function.cpp:
+ * kjs/function_object.cpp:
+ * kjs/identifier.cpp:
+ (KJS::Identifier::rehash):
+ * kjs/internal.cpp:
+ (KJS::Parser::saveNewNode):
+ (KJS::clearNewNodes):
+ * kjs/interpreter.cpp:
+ * kjs/lexer.cpp:
+ (Lexer::doneParsing):
+ (Lexer::makeIdentifier):
+ (Lexer::makeUString):
+ * kjs/list.cpp:
+ * kjs/math_object.cpp:
+ * kjs/nodes.cpp:
+ * kjs/nodes.h:
+ * kjs/nodes2string.cpp:
+ * kjs/number_object.cpp:
+ (integer_part_noexp):
+ (char_sequence):
+ * kjs/object.cpp:
+ * kjs/object_object.cpp:
+ * kjs/property_map.cpp:
+ * kjs/property_slot.cpp:
+ * kjs/protected_values.cpp:
+ (KJS::ProtectedValues::rehash):
+ * kjs/reference.cpp:
+ * kjs/reference_list.cpp:
+ * kjs/regexp.cpp:
+ * kjs/regexp_object.cpp:
+ * kjs/scope_chain.cpp:
+ * kjs/scope_chain.h:
+ * kjs/string_object.cpp:
+ * kjs/testkjs.cpp:
+ * kjs/ustring.h:
+ * kjs/value.cpp:
+ * kxmlcore/Assertions.mm:
+ * kxmlcore/FastMalloc.cpp:
+ (KXMLCore::InitSizeClasses):
+ (KXMLCore::DLL_IsEmpty):
+ (KXMLCore::DLL_Prepend):
+ (KXMLCore::TCMalloc_Central_FreeList::Insert):
+ (KXMLCore::TCMalloc_Central_FreeList::Remove):
+ (KXMLCore::TCMalloc_Central_FreeList::Populate):
+ (KXMLCore::TCMalloc_ThreadCache::Allocate):
+ (KXMLCore::TCMalloc_ThreadCache::FetchFromCentralCache):
+ (KXMLCore::fastMallocRegisterThread):
+ (KXMLCore::TCMalloc_ThreadCache::GetCache):
+ (KXMLCore::TCMalloc_ThreadCache::GetCacheIfPresent):
+ (KXMLCore::TCMalloc_ThreadCache::CreateCacheIfNecessary):
+ (KXMLCore::do_malloc):
+ (KXMLCore::do_free):
+ (KXMLCore::realloc):
+ * kxmlcore/FastMalloc.h:
+ (operator new):
+ (operator delete):
+ (operator new[]):
+ (operator delete[]):
+ * kxmlcore/HashTable.cpp:
+ * kxmlcore/TCSpinLock.h:
+ (TCMalloc_SpinLock::Lock):
+ (TCMalloc_SpinLock::Unlock):
+ (TCMalloc_SlowLock):
+ * kxmlcore/TCSystemAlloc.cpp:
+
+2005-09-30 Geoffrey Garen <ggaren@apple.com>
+
+ - Second cut at fixing <rdar://problem/4275206> Denver Regression: Seed:
+ Past Editions of Opinions display "NAN/Undefined" for www.washingtonpost.com
+
+ Reviewed by john.
+
+ * kjs/date_object.cpp:
+ (KJS::KRFCDate_parseDate): Intead of creating a timezone when one isn't specified,
+ just rely on the fallback logic, which will do it for you. Also, return invalidDate
+ if the date includes trailing garbage. (Somewhat accidentally, the timezone logic
+ used to catch trailing garbage.)
+
+ Added test case to fast/js/date-parse-test.html.
+
+2005-09-29 Eric Seidel <eseidel@apple.com>
+ Fix from Mitz Pettel <opendarwin.org@mitzpettel.com>
+
+ Reviewed by darin.
+
+ Fix JSC memory smasher in TOT.
+ http://bugs.webkit.org/show_bug.cgi?id=5176
+
+ * pcre/pcre_exec.c:
+ (match):
+
+2005-09-29 Eric Seidel <eseidel@apple.com>
+ Fix from Mitz Pettel <opendarwin.org@mitzpettel.com>
+
+ Reviewed by mjs.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ Build fix for JSC+SVG after 5161.
+ http://bugs.webkit.org/show_bug.cgi?id=5179
+
+2005-09-28 Geoffrey Garen <ggaren@apple.com>
+
+ - Fixed <rdar://problem/4275206> Denver Regression: Seed: Past Editions of Opinions display
+ "NAN/Undefined" for www.washingtonpost.com
+
+ Reviewed by darin.
+
+ * kjs/date_object.cpp:
+ (KJS::KRFCDate_parseDate): If the timezone isn't specified, rather than returning
+ invalidDate, substitute the local timezone. This matches the behavior of FF/IE.
+
+2005-09-28 Maciej Stachowiak <mjs@apple.com>
+
+ Patch from George Staikos, reviewed by me.
+
+ - fixed some compile issues on Linux
+
+ * kjs/property_slot.h:
+ * kjs/simple_number.h:
+
+2005-09-27 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Eric.
+
+ - move HashMap/HashSet code down to JavaScriptCore
+ http://bugs.webkit.org/show_bug.cgi?id=5161
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * kjs/internal.cpp:
+ (KJS::interpreterMap): Function that fetches the interpreter map on demand.
+ (KJS::InterpreterImp::InterpreterImp): Replace use of InterpreterMap
+ class with an appropriate HashMap.
+ (KJS::InterpreterImp::clear): ditto
+ (KJS::InterpreterImp::interpreterWithGlobalObject): ditto
+ * kjs/interpreter_map.cpp: Removed.
+ * kjs/interpreter_map.h: Removed.
+
+ The HashMap/HashSet code (copied and slightly tweaked from WebCore)
+
+ * kxmlcore/HashFunctions.h: Added.
+ (KXMLCore::4):
+ (KXMLCore::8):
+ (KXMLCore::):
+ (KXMLCore::PointerHash::hash):
+ (KXMLCore::PointerHash::equal):
+ * kxmlcore/HashMap.h: Added.
+ (KXMLCore::extractFirst):
+ (KXMLCore::HashMap::HashMap):
+ (KXMLCore::::size):
+ (KXMLCore::::capacity):
+ (KXMLCore::::isEmpty):
+ (KXMLCore::::begin):
+ (KXMLCore::::end):
+ (KXMLCore::::find):
+ (KXMLCore::::contains):
+ (KXMLCore::::set):
+ (KXMLCore::::get):
+ (KXMLCore::::remove):
+ (KXMLCore::::clear):
+ (KXMLCore::deleteAllValues):
+ * kxmlcore/HashMapPtrSpec.h: Added.
+ (KXMLCore::PointerHashIteratorAdapter::PointerHashIteratorAdapter):
+ (KXMLCore::PointerHashIteratorAdapter::operator*):
+ (KXMLCore::PointerHashIteratorAdapter::operator->):
+ (KXMLCore::PointerHashIteratorAdapter::operator++):
+ (KXMLCore::PointerHashIteratorAdapter::operator==):
+ (KXMLCore::PointerHashIteratorAdapter::operator!=):
+ (KXMLCore::PointerHashConstIteratorAdapter::PointerHashConstIteratorAdapter):
+ (KXMLCore::PointerHashConstIteratorAdapter::operator*):
+ (KXMLCore::PointerHashConstIteratorAdapter::operator->):
+ (KXMLCore::PointerHashConstIteratorAdapter::operator++):
+ (KXMLCore::PointerHashConstIteratorAdapter::operator==):
+ (KXMLCore::PointerHashConstIteratorAdapter::operator!=):
+ (KXMLCore::):
+ * kxmlcore/HashSet.h: Added.
+ (KXMLCore::identityExtract):
+ (KXMLCore::convertAdapter):
+ (KXMLCore::HashSet::HashSet):
+ (KXMLCore::::size):
+ (KXMLCore::::capacity):
+ (KXMLCore::::isEmpty):
+ (KXMLCore::::begin):
+ (KXMLCore::::end):
+ (KXMLCore::::find):
+ (KXMLCore::::contains):
+ (KXMLCore::::insert):
+ (KXMLCore::::remove):
+ (KXMLCore::::clear):
+ * kxmlcore/HashTable.cpp: Added.
+ (KXMLCore::HashTableStats::~HashTableStats):
+ (KXMLCore::HashTableStats::recordCollisionAtCount):
+ * kxmlcore/HashTable.h: Added.
+ (KXMLCore::HashTableIterator::skipEmptyBuckets):
+ (KXMLCore::HashTableIterator::HashTableIterator):
+ (KXMLCore::HashTableIterator::operator*):
+ (KXMLCore::HashTableIterator::operator->):
+ (KXMLCore::HashTableIterator::operator++):
+ (KXMLCore::HashTableIterator::operator==):
+ (KXMLCore::HashTableIterator::operator!=):
+ (KXMLCore::HashTableConstIterator::HashTableConstIterator):
+ (KXMLCore::HashTableConstIterator::operator*):
+ (KXMLCore::HashTableConstIterator::operator->):
+ (KXMLCore::HashTableConstIterator::skipEmptyBuckets):
+ (KXMLCore::HashTableConstIterator::operator++):
+ (KXMLCore::HashTableConstIterator::operator==):
+ (KXMLCore::HashTableConstIterator::operator!=):
+ (KXMLCore::HashTable::HashTable):
+ (KXMLCore::HashTable::~HashTable):
+ (KXMLCore::HashTable::begin):
+ (KXMLCore::HashTable::end):
+ (KXMLCore::HashTable::size):
+ (KXMLCore::HashTable::capacity):
+ (KXMLCore::HashTable::insert):
+ (KXMLCore::HashTable::isEmptyBucket):
+ (KXMLCore::HashTable::isDeletedBucket):
+ (KXMLCore::HashTable::isEmptyOrDeletedBucket):
+ (KXMLCore::HashTable::hash):
+ (KXMLCore::HashTable::equal):
+ (KXMLCore::HashTable::identityConvert):
+ (KXMLCore::HashTable::extractKey):
+ (KXMLCore::HashTable::lookup):
+ (KXMLCore::HashTable::shouldExpand):
+ (KXMLCore::HashTable::mustRehashInPlace):
+ (KXMLCore::HashTable::shouldShrink):
+ (KXMLCore::HashTable::shrink):
+ (KXMLCore::HashTable::clearBucket):
+ (KXMLCore::HashTable::deleteBucket):
+ (KXMLCore::HashTable::makeLookupResult):
+ (KXMLCore::HashTable::makeIterator):
+ (KXMLCore::HashTable::makeConstIterator):
+ (KXMLCore::::lookup):
+ (KXMLCore::::insert):
+ (KXMLCore::::reinsert):
+ (KXMLCore::::find):
+ (KXMLCore::::contains):
+ (KXMLCore::::remove):
+ (KXMLCore::::allocateTable):
+ (KXMLCore::::expand):
+ (KXMLCore::::rehash):
+ (KXMLCore::::clear):
+ (KXMLCore::::HashTable):
+ (KXMLCore::::swap):
+ (KXMLCore::::operator):
+ (KXMLCore::::checkTableConsistency):
+ (KXMLCore::::checkTableConsistencyExceptSize):
+ * kxmlcore/HashTraits.h: Added.
+ (KXMLCore::HashTraits::emptyValue):
+ (KXMLCore::):
+ (KXMLCore::PairHashTraits::emptyValue):
+ (KXMLCore::PairHashTraits::deletedValue):
+
+2005-09-27 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - update grammar to fix conflicts; fixes one of our test cases
+ because it resolves the relationship between function expressions
+ and declarations in the way required by the ECMA specification
+
+ * kjs/grammar.y: Added lots of new grammar rules so we have no conflicts.
+ A new set of rules for "no bracket or function at start of expression" and
+ another set of rules for "no in anywhere in expression". Also simplified the
+ handling of try to use only a single node and used operator precedence to
+ get rid of the conflict in handling of if and else. Also used a macro to
+ streamline the handling of automatic semicolons and changed parenthesis
+ handling to use a virtual function.
+
+ * kjs/nodes.h: Added nodeInsideAllParens, removed unused abortStatement.
+ (KJS::TryNode::TryNode): Updated to hold catch and finally blocks directly instead
+ of using a special node for each.
+ * kjs/nodes.cpp:
+ (Node::createErrorCompletion): Added. Used instead of throwError when creating errors
+ that should not be in a completion rather than an ExecState.
+ (Node::throwUndefinedVariableError): Added. Sets source location unlike the call it
+ replaces.
+ (Node::nodeInsideAllParens): Added.
+ (GroupNode::nodeInsideAllParens): Added.
+ (StatListNode::execute): Removed code to move exceptions into completion objects;
+ that's now done solely by the KJS_CHECKEXCEPTION macro.
+ (TryNode::execute): Include execution of catch and finally here rather than using
+ separate nodes.
+ (FuncDeclNode::execute): Moved here, no longer inline.
+ * kjs/nodes2string.cpp:
+ (TryNode::streamTo): Updated for change.
+ (FuncDeclNode::streamTo): Ditto.
+ (FuncExprNode::streamTo): Ditto.
+
+ * kjs/kjs-test: Removed. Was part of "make check".
+ * kjs/kjs-test.chk: Ditto.
+ * kjs/test.js: Ditto.
+
+ * tests/mozilla/expected.html: Updated because one more test succeeds.
+
+2005-09-27 Adele Peterson <adele@apple.com>
+
+ Reviewed by Maciej.
+
+ Changed ints to size_t where appropriate.
+
+ * kjs/collector.cpp:
+ (KJS::Collector::allocate):
+ (KJS::Collector::markStackObjectsConservatively):
+ (KJS::Collector::collect):
+ (KJS::Collector::size):
+ (KJS::Collector::numInterpreters):
+ (KJS::Collector::numGCNotAllowedObjects):
+ (KJS::Collector::numReferencedObjects):
+ * kjs/collector.h:
+
+2005-09-27 Eric Seidel <eseidel@apple.com>
+
+ Reviewed by kevin.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj: fix after malloc changes.
+
+2005-09-27 Eric Seidel <eseidel@apple.com>
+
+ Reviewed by mjs.
+
+ * kjs/nodes.cpp:
+ (FuncExprNode::evaluate): Now sets .constructor properly.
+ Test cases added to WebCore/layout-tests.
+ http://bugs.webkit.org/show_bug.cgi?id=3537
+
+2005-09-26 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by John.
+
+ - replace dlmalloc with tcmalloc
+ http://bugs.webkit.org/show_bug.cgi?id=5145
+
+ I also moved SharedPtr and the assertion code from WebCore into a
+ new kxmlcore directory.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * kjs/collector.cpp:
+ (KJS::Collector::allocate):
+ (KJS::Collector::collect):
+ * kjs/config.h:
+ * kjs/fast_malloc.cpp: Removed.
+ * kjs/fast_malloc.h: Removed.
+ * kjs/function.cpp:
+ * kjs/function.h:
+ * kjs/function_object.cpp:
+ * kjs/identifier.cpp:
+ (KJS::Identifier::add):
+ * kjs/internal.cpp:
+ * kjs/internal.h:
+ * kjs/nodes.h:
+ * kjs/nodes2string.cpp:
+ * kjs/property_map.cpp:
+ (KJS::PropertyMap::~PropertyMap):
+ (KJS::PropertyMap::rehash):
+ * kjs/scope_chain.h:
+ * kjs/shared_ptr.h: Removed.
+ * kjs/string_object.cpp:
+ (StringObjectFuncImp::callAsFunction):
+ * kjs/ustring.cpp:
+ (KJS::UString::Rep::createCopying):
+ (KJS::UString::Rep::destroy):
+ (KJS::UString::expandCapacity):
+ (KJS::UString::expandPreCapacity):
+ (KJS::UString::UString):
+ (KJS::UString::spliceSubstringsWithSeparators):
+ (KJS::UString::append):
+ (KJS::UString::operator=):
+ (KJS::UString::detach):
+ * kjs/ustring.h:
+ * kxmlcore/Assertions.h: Added.
+ * kxmlcore/Assertions.mm: Added.
+ * kxmlcore/FastMalloc.cpp: Added.
+ (KXMLCore::LgFloor):
+ (KXMLCore::SizeClass):
+ (KXMLCore::ByteSizeForClass):
+ (KXMLCore::InitSizeClasses):
+ (KXMLCore::MetaDataAlloc):
+ (KXMLCore::PageHeapAllocator::Init):
+ (KXMLCore::PageHeapAllocator::New):
+ (KXMLCore::PageHeapAllocator::Delete):
+ (KXMLCore::PageHeapAllocator::inuse):
+ (KXMLCore::pages):
+ (KXMLCore::AllocationSize):
+ (KXMLCore::Event):
+ (KXMLCore::NewSpan):
+ (KXMLCore::DeleteSpan):
+ (KXMLCore::DLL_Init):
+ (KXMLCore::DLL_Remove):
+ (KXMLCore::DLL_IsEmpty):
+ (KXMLCore::DLL_Length):
+ (KXMLCore::DLL_Print):
+ (KXMLCore::DLL_Prepend):
+ (KXMLCore::DLL_InsertOrdered):
+ (KXMLCore::):
+ (KXMLCore::TCMalloc_PageHeap::GetDescriptor):
+ (KXMLCore::TCMalloc_PageHeap::SystemBytes):
+ (KXMLCore::TCMalloc_PageHeap::FreeBytes):
+ (KXMLCore::TCMalloc_PageHeap::RecordSpan):
+ (KXMLCore::TCMalloc_PageHeap::TCMalloc_PageHeap):
+ (KXMLCore::TCMalloc_PageHeap::New):
+ (KXMLCore::TCMalloc_PageHeap::Split):
+ (KXMLCore::TCMalloc_PageHeap::Carve):
+ (KXMLCore::TCMalloc_PageHeap::Delete):
+ (KXMLCore::TCMalloc_PageHeap::RegisterSizeClass):
+ (KXMLCore::TCMalloc_PageHeap::Dump):
+ (KXMLCore::TCMalloc_PageHeap::GrowHeap):
+ (KXMLCore::TCMalloc_PageHeap::Check):
+ (KXMLCore::TCMalloc_PageHeap::CheckList):
+ (KXMLCore::TCMalloc_ThreadCache_FreeList::Init):
+ (KXMLCore::TCMalloc_ThreadCache_FreeList::length):
+ (KXMLCore::TCMalloc_ThreadCache_FreeList::empty):
+ (KXMLCore::TCMalloc_ThreadCache_FreeList::lowwatermark):
+ (KXMLCore::TCMalloc_ThreadCache_FreeList::clear_lowwatermark):
+ (KXMLCore::TCMalloc_ThreadCache_FreeList::Push):
+ (KXMLCore::TCMalloc_ThreadCache_FreeList::Pop):
+ (KXMLCore::TCMalloc_ThreadCache::freelist_length):
+ (KXMLCore::TCMalloc_ThreadCache::Size):
+ (KXMLCore::TCMalloc_Central_FreeList::length):
+ (KXMLCore::TCMalloc_Central_FreeList::Init):
+ (KXMLCore::TCMalloc_Central_FreeList::Insert):
+ (KXMLCore::TCMalloc_Central_FreeList::Remove):
+ (KXMLCore::TCMalloc_Central_FreeList::Populate):
+ (KXMLCore::TCMalloc_ThreadCache::SampleAllocation):
+ (KXMLCore::TCMalloc_ThreadCache::Init):
+ (KXMLCore::TCMalloc_ThreadCache::Cleanup):
+ (KXMLCore::TCMalloc_ThreadCache::Allocate):
+ (KXMLCore::TCMalloc_ThreadCache::Deallocate):
+ (KXMLCore::TCMalloc_ThreadCache::FetchFromCentralCache):
+ (KXMLCore::TCMalloc_ThreadCache::ReleaseToCentralCache):
+ (KXMLCore::TCMalloc_ThreadCache::Scavenge):
+ (KXMLCore::TCMalloc_ThreadCache::GetCache):
+ (KXMLCore::TCMalloc_ThreadCache::GetCacheIfPresent):
+ (KXMLCore::TCMalloc_ThreadCache::PickNextSample):
+ (KXMLCore::TCMalloc_ThreadCache::InitModule):
+ (KXMLCore::TCMalloc_ThreadCache::InitTSD):
+ (KXMLCore::TCMalloc_ThreadCache::CreateCacheIfNecessary):
+ (KXMLCore::TCMalloc_ThreadCache::DeleteCache):
+ (KXMLCore::TCMalloc_ThreadCache::RecomputeThreadCacheSize):
+ (KXMLCore::TCMalloc_ThreadCache::Print):
+ (KXMLCore::ExtractStats):
+ (KXMLCore::DumpStats):
+ (KXMLCore::PrintStats):
+ (KXMLCore::DumpStackTraces):
+ (KXMLCore::TCMallocImplementation::GetStats):
+ (KXMLCore::TCMallocImplementation::ReadStackTraces):
+ (KXMLCore::TCMallocImplementation::GetNumericProperty):
+ (KXMLCore::TCMallocImplementation::SetNumericProperty):
+ (KXMLCore::DoSampledAllocation):
+ (KXMLCore::do_malloc):
+ (KXMLCore::do_free):
+ (KXMLCore::do_memalign):
+ (KXMLCore::TCMallocGuard::TCMallocGuard):
+ (KXMLCore::TCMallocGuard::~TCMallocGuard):
+ (KXMLCore::malloc):
+ (KXMLCore::free):
+ (KXMLCore::calloc):
+ (KXMLCore::cfree):
+ (KXMLCore::realloc):
+ (KXMLCore::memalign):
+ (KXMLCore::posix_memalign):
+ (KXMLCore::valloc):
+ (KXMLCore::pvalloc):
+ (KXMLCore::malloc_stats):
+ (KXMLCore::mallopt):
+ (KXMLCore::mallinfo):
+ * kxmlcore/FastMalloc.h: Added.
+ (KXMLCore::FastAllocated::operator new):
+ (KXMLCore::FastAllocated::operator delete):
+ (KXMLCore::FastAllocated::operator new[]):
+ (KXMLCore::FastAllocated::operator delete[]):
+ * kxmlcore/SharedPtr.h: Added.
+ (KXMLCore::SharedPtr::SharedPtr):
+ (KXMLCore::SharedPtr::~SharedPtr):
+ (KXMLCore::SharedPtr::isNull):
+ (KXMLCore::SharedPtr::notNull):
+ (KXMLCore::SharedPtr::reset):
+ (KXMLCore::SharedPtr::get):
+ (KXMLCore::SharedPtr::operator*):
+ (KXMLCore::SharedPtr::operator->):
+ (KXMLCore::SharedPtr::operator!):
+ (KXMLCore::SharedPtr::operator bool):
+ (KXMLCore::::operator):
+ (KXMLCore::operator==):
+ (KXMLCore::operator!=):
+ (KXMLCore::static_pointer_cast):
+ (KXMLCore::const_pointer_cast):
+ * kxmlcore/TCPageMap.h: Added.
+ (TCMalloc_PageMap1::TCMalloc_PageMap1):
+ (TCMalloc_PageMap1::Ensure):
+ (TCMalloc_PageMap1::get):
+ (TCMalloc_PageMap1::set):
+ (TCMalloc_PageMap2::TCMalloc_PageMap2):
+ (TCMalloc_PageMap2::get):
+ (TCMalloc_PageMap2::set):
+ (TCMalloc_PageMap2::Ensure):
+ (TCMalloc_PageMap3::NewNode):
+ (TCMalloc_PageMap3::TCMalloc_PageMap3):
+ (TCMalloc_PageMap3::get):
+ (TCMalloc_PageMap3::set):
+ (TCMalloc_PageMap3::Ensure):
+ * kxmlcore/TCSpinLock.h: Added.
+ (TCMalloc_SpinLock::Init):
+ (TCMalloc_SpinLock::Finalize):
+ (TCMalloc_SpinLock::Lock):
+ (TCMalloc_SpinLock::Unlock):
+ (TCMalloc_SlowLock):
+ (TCMalloc_SpinLockHolder::TCMalloc_SpinLockHolder):
+ (TCMalloc_SpinLockHolder::~TCMalloc_SpinLockHolder):
+ * kxmlcore/TCSystemAlloc.cpp: Added.
+ (TrySbrk):
+ (TryMmap):
+ (TryDevMem):
+ (TCMalloc_SystemAlloc):
+ * kxmlcore/TCSystemAlloc.h: Added.
+
+2005-09-23 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin.
+
+ <rdar://problem/4260479> Finish deploying PropertySlot in the interpreter
+ http://bugs.webkit.org/show_bug.cgi?id=5112
+
+ Convert postfix, prefix, delete, prefix, and for..in expressions to use
+ PropertySlot-based lookup instead of evaluateReference.
+
+ 3% speedup on JS iBench.
+
+ Fixed two of the JS tests:
+ * tests/mozilla/expected.html:
+
+ * kjs/grammar.y:
+ * kjs/nodes.cpp:
+ (PostfixResolveNode::evaluate):
+ (PostfixBracketNode::evaluate):
+ (PostfixDotNode::evaluate):
+ (DeleteResolveNode::evaluate):
+ (DeleteBracketNode::evaluate):
+ (DeleteDotNode::evaluate):
+ (DeleteValueNode::evaluate):
+ (typeStringForValue):
+ (TypeOfResolveNode::evaluate):
+ (TypeOfValueNode::evaluate):
+ (PrefixResolveNode::evaluate):
+ (PrefixBracketNode::evaluate):
+ (PrefixDotNode::evaluate):
+ (ForInNode::execute):
+ * kjs/nodes.h:
+ (KJS::PostfixResolveNode::PostfixResolveNode):
+ (KJS::PostfixBracketNode::PostfixBracketNode):
+ (KJS::PostfixDotNode::PostfixDotNode):
+ (KJS::DeleteResolveNode::DeleteResolveNode):
+ (KJS::DeleteBracketNode::DeleteBracketNode):
+ (KJS::DeleteDotNode::DeleteDotNode):
+ (KJS::DeleteValueNode::DeleteValueNode):
+ (KJS::TypeOfResolveNode::TypeOfResolveNode):
+ (KJS::TypeOfValueNode::TypeOfValueNode):
+ (KJS::PrefixResolveNode::PrefixResolveNode):
+ (KJS::PrefixBracketNode::PrefixBracketNode):
+ (KJS::PrefixDotNode::PrefixDotNode):
+ * kjs/nodes2string.cpp:
+ (PostfixResolveNode::streamTo):
+ (PostfixBracketNode::streamTo):
+ (PostfixDotNode::streamTo):
+ (DeleteResolveNode::streamTo):
+ (DeleteBracketNode::streamTo):
+ (DeleteDotNode::streamTo):
+ (DeleteValueNode::streamTo):
+ (TypeOfValueNode::streamTo):
+ (TypeOfResolveNode::streamTo):
+ (PrefixResolveNode::streamTo):
+ (PrefixBracketNode::streamTo):
+ (PrefixDotNode::streamTo):
+ * kjs/reference.cpp:
+ (KJS::Reference::Reference):
+ (KJS::Reference::getPropertyName):
+ (KJS::Reference::getValue):
+ (KJS::Reference::deleteValue):
+ * kjs/reference.h:
+
+2005-09-23 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
+
+ Reviewed and landed by Darin.
+
+ - a Windows-specific file
+
+ * os-win32/stdint.h: Added. We plan to remove dependency on the <stdint.h> types,
+ and if we do so, we will remove this file.
+
+2005-09-22 Geoffrey Garen <ggaren@apple.com>
+
+ - Fixed http://bugs.webkit.org/show_bug.cgi?id=5053
+ Need to restore int/long changes to simple_number.h
+
+ Reviewed by darin and mjs.
+
+ * kjs/simple_number.h: changed enums to indenpendent constants to clarify types
+ (KJS::isNegativeZero): changed to static function - no reason to export
+ (KJS::SimpleNumber::rightShiftSignExtended): new function for clarity
+ (KJS::SimpleNumber::make): specified cast as reinterpret_cast
+ (KJS::SimpleNumber::is): changed to use uintptr_t for portability
+ (KJS::SimpleNumber::value): changed to use uintptr_t and rightShiftSignExtended
+ (KJS::SimpleNumber::fits): inverted tests - probably only a performance win for double
+ (KJS::SimpleNumber::integerFits): ditto
+
+2005-09-20 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Geoff and partly by Darin.
+
+ - fixed http://bugs.webkit.org/post_bug.cgi
+ (Reduce conflicts in JavaScriptCore grammar)
+
+ This change gets us down from over 200 shift/reduce and 45 reduce/reduce to
+ 9 shift/reduce and 45 reduce/reduce.
+
+ * kjs/grammar.y:
+ * kjs/grammar_types.h: Removed.
+ * kjs/lexer.cpp:
+ * kjs/nodes.h:
+ (KJS::Node::isGroupNode):
+ (KJS::Node::isLocation):
+ (KJS::Node::isResolveNode):
+ (KJS::Node::isBracketAccessorNode):
+ (KJS::Node::isDotAccessorNode):
+ (KJS::ResolveNode::isLocation):
+ (KJS::ResolveNode::isResolveNode):
+ (KJS::ResolveNode::identifier):
+ (KJS::GroupNode::isGroupNode):
+ (KJS::GroupNode::leafNode):
+ (KJS::BracketAccessorNode::isLocation):
+ (KJS::BracketAccessorNode::isBracketAccessorNode):
+ (KJS::BracketAccessorNode::base):
+ (KJS::BracketAccessorNode::subscript):
+ (KJS::DotAccessorNode::isLocation):
+ (KJS::DotAccessorNode::isDotAccessorNode):
+ (KJS::DotAccessorNode::base):
+ (KJS::DotAccessorNode::identifier):
+ (KJS::FuncExprNode::FuncExprNode):
+ (KJS::FuncExprNode::identifier):
+ (KJS::FuncDeclNode::FuncDeclNode):
+ (KJS::FuncDeclNode::execute):
+
+2005-09-20 Geoffrey Garen <ggaren@apple.com>
+
+ - Oops. The 4263434 change was only appropriate on the branch. Rolling out.
+
+ Reviewed by eric.
+
+ * kjs/internal.cpp:
+ (KJS::InterpreterImp::mark):
+
+2005-09-20 Geoffrey Garen <ggaren@apple.com>
+
+ - More changes needed to fix <rdar://problem/4214783> 8F29 REGRESSION(Denver/Chardonnay):
+ kjs_fast_malloc crash due to lack of locking on multiple threads (seen selecting volumes in
+ the installer)
+
+ Added InterpreterLocks in some places in the bindings we missed before.
+
+ Reviewed by john.
+
+ * bindings/runtime_root.cpp:
+ (KJS::Bindings::addNativeReference):
+ (KJS::Bindings::removeNativeReference):
+ (RootObject::removeAllNativeReferences):
+ * bindings/runtime_root.h:
+ (KJS::Bindings::RootObject::~RootObject):
+ (KJS::Bindings::RootObject::setRootObjectImp):
+
+2005-09-20 Geoffrey Garen <ggaren@apple.com>
+
+ - Fixed <rdar://problem/4263434> <rdar://problem/4263434> Denver 8F29 Regression:
+ KJS::InterpreterImp::mark() crash
+
+ Fix by mjs, review by me.
+
+ * kjs/internal.cpp:
+ (KJS::InterpreterImp::mark): Added a null check on globExec in case a
+ garbage collection occurs inside InterpreterImp::globalInit (called
+ from InterpreterImp::InterpreterImp), at which point globExec has not yet been initialized.
+
+2005-09-20 Geoffrey Garen <ggaren@apple.com>
+
+ - Rolled in fix for http://bugs.webkit.org/show_bug.cgi?id=4892
+ Date constructor has problems with months larger than 11
+
+ Test cases added:
+
+ * layout-tests/fast/js/date-big-constructor-expected.txt: Added.
+ * layout-tests/fast/js/date-big-constructor.html: Added.
+
+ Reviewed by darin.
+
+ * kjs/date_object.cpp:
+ (KJS::fillStructuresUsingDateArgs):
+ (KJS::makeTime):
+
+2005-09-19 Geoffrey Garen <ggaren@apple.com>
+
+ - Fixed http://bugs.webkit.org/show_bug.cgi?id=5028
+ 9 layout tests fail following the change from long to int
+
+ - Rolled out changes to simple_number.h, and added fits(long long)
+ and SimpleNumber::fits(unsigned long long) to the old system.
+
+ Reviewed by mjs.
+
+ * kjs/simple_number.h:
+ (KJS::SimpleNumber::):
+ (KJS::SimpleNumber::value):
+ (KJS::SimpleNumber::fits):
+ (KJS::SimpleNumber::integerFits):
+ (KJS::SimpleNumber::make):
+
+2005-09-14 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Geoff.
+
+ - fixed <rdar://problem/4214783> REGRESSION: kjs_fast_malloc crash due to lack of locking on multiple threads (seen selecting volumes in the installer)
+
+ Make sure to lock using the InterpreterLock class in all places that need it
+ (including anything that uses the collector, the parser, the protect count hash table,
+ and anything that allocates via fast_malloc).
+
+ Also added assertions to ensure that the locking rules are followed for the relevant
+ resources.
+
+ * Makefile.am:
+ * bindings/NP_jsobject.cpp:
+ (identifierFromNPIdentifier):
+ (_NPN_Invoke):
+ (_NPN_Evaluate):
+ (_NPN_GetProperty):
+ (_NPN_SetProperty):
+ (_NPN_RemoveProperty):
+ (_NPN_HasProperty):
+ (_NPN_HasMethod):
+ (_NPN_SetException):
+ * bindings/jni/jni_jsobject.cpp:
+ (JSObject::call):
+ (JSObject::eval):
+ (JSObject::getMember):
+ (JSObject::setMember):
+ (JSObject::removeMember):
+ (JSObject::getSlot):
+ (JSObject::setSlot):
+ (JSObject::toString):
+ (JSObject::convertJObjectToValue):
+ * bindings/objc/WebScriptObject.mm:
+ (-[WebScriptObject callWebScriptMethod:withArguments:]):
+ (-[WebScriptObject evaluateWebScript:]):
+ (-[WebScriptObject setValue:forKey:]):
+ (-[WebScriptObject valueForKey:]):
+ (-[WebScriptObject removeWebScriptKey:]):
+ (-[WebScriptObject stringRepresentation]):
+ (-[WebScriptObject webScriptValueAtIndex:]):
+ (-[WebScriptObject setWebScriptValueAtIndex:value:]):
+ (+[WebScriptObject _convertValueToObjcValue:KJS::originExecutionContext:Bindings::executionContext:Bindings::]):
+ * bindings/runtime.cpp:
+ (Instance::createRuntimeObject):
+ * bindings/runtime_root.h:
+ * bindings/testbindings.cpp:
+ (main):
+ * bindings/testbindings.mm:
+ (main):
+ * kjs/fast_malloc.cpp:
+ (KJS::kjs_fast_malloc):
+ (KJS::kjs_fast_calloc):
+ (KJS::kjs_fast_free):
+ (KJS::kjs_fast_realloc):
+ * kjs/fast_malloc.h:
+ * kjs/identifier.h:
+ * kjs/internal.cpp:
+ (InterpreterImp::InterpreterImp):
+ (InterpreterImp::clear):
+ (InterpreterImp::mark):
+ (InterpreterImp::checkSyntax):
+ (InterpreterImp::evaluate):
+ * kjs/internal.h:
+ (KJS::InterpreterImp::globalObject):
+ * kjs/interpreter.cpp:
+ (Interpreter::evaluate):
+ * kjs/interpreter.h:
+ (KJS::InterpreterLock::InterpreterLock):
+ (KJS::InterpreterLock::~InterpreterLock):
+ * kjs/nodes.h:
+ * kjs/protect.h:
+ (KJS::ProtectedValue::ProtectedValue):
+ (KJS::ProtectedValue::~ProtectedValue):
+ (KJS::ProtectedValue::operator=):
+ (KJS::ProtectedObject::ProtectedObject):
+ (KJS::ProtectedObject::~ProtectedObject):
+ (KJS::ProtectedObject::operator=):
+ (KJS::ProtectedReference::ProtectedReference):
+ (KJS::ProtectedReference::~ProtectedReference):
+ (KJS::ProtectedReference::operator=):
+ * kjs/protected_object.h:
+ * kjs/protected_values.cpp:
+ (KJS::ProtectedValues::getProtectCount):
+ (KJS::ProtectedValues::increaseProtectCount):
+ (KJS::ProtectedValues::decreaseProtectCount):
+ * kjs/string_object.cpp:
+ (StringObjectImp::StringObjectImp):
+ * kjs/testkjs.cpp:
+ (main):
+
+2005-09-16 Adele Peterson <adele@apple.com>
+
+ Change by Darin, reviewed by me and Maciej.
+
+ Fixes http://bugs.webkit.org/show_bug.cgi?id=4547
+ use int instead of long for 32-bit (to prepare for LP64 compiling)
+
+ * bindings/c/c_class.h:
+ (KJS::Bindings::CClass::constructorAt):
+ (KJS::Bindings::CClass::numConstructors):
+ * bindings/c/c_runtime.h:
+ (KJS::Bindings::CMethod::numParameters):
+ * bindings/jni/jni_class.cpp:
+ (JavaClass::JavaClass):
+ * bindings/jni/jni_class.h:
+ (KJS::Bindings::JavaClass::constructorAt):
+ (KJS::Bindings::JavaClass::numConstructors):
+ * bindings/jni/jni_instance.cpp:
+ (JavaInstance::invokeMethod):
+ * bindings/jni/jni_jsobject.cpp:
+ (JSObject::convertJObjectToValue):
+ (JSObject::listFromJArray):
+ * bindings/jni/jni_runtime.cpp:
+ (JavaMethod::JavaMethod):
+ * bindings/jni/jni_runtime.h:
+ (KJS::Bindings::JavaConstructor::_commonCopy):
+ (KJS::Bindings::JavaConstructor::parameterAt):
+ (KJS::Bindings::JavaConstructor::numParameters):
+ (KJS::Bindings::JavaMethod::_commonCopy):
+ (KJS::Bindings::JavaMethod::parameterAt):
+ (KJS::Bindings::JavaMethod::numParameters):
+ * bindings/npapi.h:
+ * bindings/objc/WebScriptObject.mm:
+ (listFromNSArray):
+ * bindings/objc/objc_class.h:
+ (KJS::Bindings::ObjcClass::constructorAt):
+ (KJS::Bindings::ObjcClass::numConstructors):
+ * bindings/objc/objc_instance.h:
+ * bindings/objc/objc_runtime.h:
+ * bindings/objc/objc_runtime.mm:
+ (ObjcMethod::numParameters):
+ * bindings/runtime.h:
+ * kjs/identifier.h:
+ * kjs/internal.h:
+ * kjs/property_slot.h:
+ (KJS::PropertySlot::setCustomIndex):
+ (KJS::PropertySlot::index):
+ (KJS::PropertySlot::):
+ * kjs/regexp_object.cpp:
+ (RegExpObjectImp::backrefGetter):
+ (RegExpObjectImp::getOwnPropertySlot):
+ * kjs/simple_number.h:
+ (KJS::SimpleNumber::):
+ (KJS::SimpleNumber::value):
+ (KJS::SimpleNumber::fits):
+ (KJS::SimpleNumber::integerFits):
+ (KJS::SimpleNumber::make):
+ * kjs/string_object.cpp:
+ (substituteBackreferences):
+ * kjs/ustring.cpp:
+ (KJS::UString::from):
+ (KJS::UString::toUInt32):
+ (KJS::UString::find):
+ (KJS::UString::rfind):
+ * kjs/ustring.h:
+ * kjs/value.cpp:
+ (KJS::jsNumber):
+ * kjs/value.h:
+
+2005-09-11 Eric Seidel <eseidel@apple.com>
+
+ No review requested, build fix affects only SVG.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj: Fixed JSC+SVG
+ Fixed JavaScriptCore+SVG after PCRE 6.1 merger.
+ http://bugs.webkit.org/show_bug.cgi?id=4932
+
+2005-09-10 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
+
+ Reviewed and landed by Darin.
+
+ * Makefile.vc: Added.
+ * README-Win32.txt: Added.
+
+2005-09-10 Darin Adler <darin@apple.com>
+
+ - fixed compilation for WebCore (another try)
+
+ * kjs/simple_number.h: Added more "using" lines.
+
+2005-09-10 Darin Adler <darin@apple.com>
+
+ - fixed compilation for WebCore
+
+ * kjs/simple_number.h: Have to include <cmath> here to work around a bug in the GCC
+ standard C++ library headers.
+
+2005-09-10 Darin Adler <darin@apple.com>
+
+ Windows changes by Krzysztof Kowalczyk <kkowalczyk@gmail.com>.
+
+ - fixed http://bugs.webkit.org/show_bug.cgi?id=4870
+ win portability: fix IS_NEGATIVE_ZERO macro in simple_number.h
+
+ * kjs/simple_number.h:
+ (KJS::isNegativeZero): Added. Inline function. Has a case for Windows that
+ uses _fpclass and a case for other platforms that uses signbit.
+ (KJS::SimpleNumber::fits): Use inline isNegativeZero instead of macro IS_NEGATIVE_ZERO.
+
+ * kjs/internal.cpp: Remove definition of now-unneeded negZero global.
+
+ * kjs/value.cpp: Touched the file because Xcode didn't know it needed to
+ recompile it.
+
+ - improved test engine
+
+ * tests/mozilla/jsDriver.pl: Sort tests in numeric order instead of using
+ a plain-ASCII sort; now test 33 will be after test 5 in any given set of
+ numbered tests.
+
+2005-09-08 Darin Adler <darin@apple.com>
+
+ - fixed overloaded versions of throwError so that they substitute *all*
+ expected parameters into the message string -- some versions used to
+ skip parameters, resulting in "%s" being printed in the error message.
+
+ Reviewed by Geoff.
+
+ * kjs/nodes.h: Updated declarations to use "const &" and not to name parameters
+ * kjs/nodes.cpp: (Node::throwError): Updated to match above and add one missing
+ call to substitute.
+
+2005-09-08 Darin Adler <darin@apple.com>
+
+ Reviewed by Geoff.
+
+ - updated to PCRE 6.1
+
+ The original PCRE 6.1 sources are checked into the tree with the tag
+ "pcre-6-1" for reference. What we're checking in right now is the original
+ plus our changes to make it support UTF-16 and at least one other tweak
+ (vertical tab considered whitespace). Our work to get our changes was
+ done on "pcre-6-1-branch", with an anchor at "pcre-6-1-anchor" so you can
+ see the evolution of the UTF-16 changes.
+
+ Note also that there was one small change made here that's not on the branch
+ in pcre_compile.c.
+
+ * Info.plist: Updated the part of the copyright message that's about PCRE.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj: Added new PCRE source files,
+ removed obsolete ones.
+
+ * pcre/AUTHORS: Updated to PCRE 6.1. Includes credits for Apple's UTF-16
+ changes, but not the credits for Google's C++ wrapper, since we don't include that.
+ * pcre/COPYING: Updated to PCRE 6.1.
+ * pcre/LICENCE: Ditto.
+ * pcre/dftables.c: Ditto.
+ * pcre/pcre-config.h: Ditto.
+ * pcre/pcre.h: Ditto.
+
+ * pcre/pcre_compile.c: Added for PCRE 6.1.
+ * pcre/pcre_config.c: Ditto.
+ * pcre/pcre_exec.c: Ditto.
+ * pcre/pcre_fullinfo.c: Ditto.
+ * pcre/pcre_get.c: Ditto.
+ * pcre/pcre_globals.c: Ditto.
+ * pcre/pcre_info.c: Ditto.
+ * pcre/pcre_internal.h: Ditto.
+ * pcre/pcre_maketables.c: Ditto.
+ * pcre/pcre_ord2utf8.c: Ditto.
+ * pcre/pcre_printint.c: Ditto.
+ * pcre/pcre_refcount.c: Ditto.
+ * pcre/pcre_study.c: Ditto.
+ * pcre/pcre_tables.c: Ditto.
+ * pcre/pcre_try_flipped.c: Ditto.
+ * pcre/pcre_ucp_findchar.c: Ditto.
+ * pcre/pcre_version.c: Ditto.
+ * pcre/pcre_xclass.c: Ditto.
+ * pcre/ucp.h: Ditto.
+ * pcre/ucp_findchar.c: Ditto.
+ * pcre/ucpinternal.h: Ditto.
+ * pcre/ucptable.c: Ditto.
+
+ * pcre/get.c: Removed.
+ * pcre/internal.h: Removed.
+ * pcre/maketables.c: Removed.
+ * pcre/pcre.c: Removed.
+ * pcre/study.c: Removed.
+
+2005-09-07 Geoffrey Garen <ggaren@apple.com>
+
+ -fixed http://bugs.webkit.org/show_bug.cgi?id=4781
+ Date.setMonth fails with big values due to overflow
+
+ Reviewed by darin.
+
+ * kjs/date_object.cpp:
+ (timetUsingCF): for consistency, changed return statement to invalidDate instead of LONG_MAX
+ (KJS::fillStructuresUsingTimeArgs): modified for readability
+ (KJS::fillStructuresUsingDateArgs): new function analogous to fillStructuresUsingTimeArgs
+ (KJS::DateProtoFuncImp::callAsFunction): modified to use fillStructuresUsingDateArgs
+ (KJS::DateObjectImp::construct): moved variable declaration to proper scope
+ (KJS::DateObjectFuncImp::callAsFunction): moved variable declaration to proper scope
+
+2005-09-07 Geoffrey Garen <ggaren@apple.com>
+ -updated expected test results to reflect fix for
+ http://bugs.webkit.org/show_bug.cgi?id=4698
+ kjs does not allow named functions in function expressions
+
+ * tests/mozilla/expected.html:
+
+2005-09-04 Darin Adler <darin@apple.com>
+
+ * kjs/identifier.cpp: Fix comment, add missing include.
+ (Follow-on to changes from yesterday.)
+
+2005-09-03 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
+
+ Reviewed, tweaked and landed by Darin.
+
+ - another try at some of the Windows compilation fixes
+ should fix these bugs: 4546, 4831, 4834, 4643, 4830, 4832, 4833, 4835
+
+ * kjs/collector.cpp: Add missing <setjmp.h> include.
+ * kjs/date_object.cpp: Fix broken copysign macro.
+ * kjs/dtoa.cpp: Move macro definitions down after all header includes.
+ * kjs/fast_malloc.cpp: Add missing <assert.h> and <stddef.h> includes.
+ * kjs/function.cpp: Remove broken isxdigit definition.
+ * kjs/grammar.y: Add a missing semicolon (and remove an excess one).
+ * kjs/identifier.cpp: Turn off AVOID_STATIC_CONSTRUCTORS because the placement new syntax
+ doesn't seem to work in Visual C++ (I'm surprised to hear that, by the way).
+ * kjs/value.h: Made ValueImp's destructor virtual because otherwise pointers to ValueImp
+ on the stack aren't right for garbage collection on Windows (don't think it works that
+ way with gcc's virtual table scheme, but it's a harmless change).
+
+2005-09-03 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
+
+ Reviewed, tweaked and landed by Darin.
+
+ - some Windows compilation fixes, hoping to fix the problems reported in these bugs:
+ 4627, 4629, 4630, 4631, 4632, 4633, 4634, 4635, 4636, 4637, 4639, 4640, 4641, 4644, 4645
+
+ * kjs/collector.cpp: Include <windows.h> on WIN32. Put thread-related code inside
+ KJS_MULTIPLE_THREADS #if directives.
+ (KJS::Collector::markCurrentThreadConservatively): Use NT_TIB to find the stack base on Win32.
+
+ * kjs/config.h: Define HAVE_SYS_TIMEB_H for Win32.
+
+ * kjs/date_object.cpp: Add include of <limits.h>. Add definitions of strncasecmp, isfinite, and
+ copysign for Win32.
+ (KJS::KRFCDate_parseDate): Move "errno = 0" line down closer to the first call to strol -- I believe
+ that on Win32 there's some other call before that setting errno.
+
+ * kjs/date_object.h: Remove unneeded include of <sys/time.h>.
+
+ * kjs/dtoa.cpp: Add an undef of strtod, needed on Win32.
+
+ * kjs/fast_malloc.cpp: Put #if !WIN32 around some customization that's not appropriate on Win32.
+ (KJS::region_list_append): Add a missing cast so this Win32-specific function compiles in C++.
+ (KJS::sbrk): Change parameter type to match the declaration.
+
+ * kjs/function.cpp: (isxdigit): Define a locale-independent isxdigit on Win32.
+
+ * kjs/function.h: Remove unneeded friend class Function for FunctionImp.
+
+ * kjs/identifier.cpp: Took out the APPLE_CHANGES from around the AVOID_STATIC_CONSTRUCTORS
+ define. We ultimately intend to phase out APPLE_CHANGES entirely. Also fix the
+ non-AVOID_STATIC_CONSTRUCTORS code path.
+
+ * kjs/internal.cpp: Remove uneeded include of <strings.h>, which was confused with <string.h>!
+ Add a Win32 implementation of copysign. Put the threads code inside KJS_MULTIPLE_THREADS.
+
+ * kjs/internal.h: Define a KJS_MULTIPLE_THREADS macro on non-Win32 only. Later we can make this
+ specific to Mac OS X if we like.
+
+ * kjs/interpreter_map.cpp: Add missing include of <stdlib.h>.
+
+ * kjs/list.cpp:
+ (KJS::ListImp::markValues): Use std::min instead of MIN.
+ (KJS::List::copy): Ditto.
+ (KJS::List::copyTail): Ditto.
+
+ * kjs/math_object.cpp: (signbit): Add a Win32 implementation of signbit.
+
+ * kjs/nodes.cpp: (Node::finalCheck): Use unsigned instead of uint.
+ Put the use of always_inline inside __GNUC__.
+
+ * kjs/number_object.cpp: (NumberProtoFuncImp::callAsFunction): Use "10.0" instead of "10"
+ inside all the calls to pow to avoid ambiguity caused by overloading of pow on Win32, seen
+ when passing an int rather than a double or float.
+
+ * kjs/operations.cpp:
+ (KJS::isInf): Add Win32 implementation.
+ (KJS::isPosInf): Add Win32 implementation.
+ (KJS::isNegInf): Add Win32 implementation.
+
+ * kjs/regexp.cpp: Use unsigned instead of uint.
+ * kjs/regexp.h: Ditto.
+ * kjs/regexp_object.cpp: Ditto.
+ * kjs/regexp_object.h: Ditto.
+
+2005-09-02 Beth Dakin <bdakin@apple.com>
+
+ Fix for <rdar://problem/4235531> Denver Regression: Safari crash in KWQStringData::makeUnicode
+ The other half of the fix is in WebCore.
+
+ Fix written by Maciej and Darin.
+ Reviewed by me/Maciej
+
+ As Maciej said in Radar: These problems was caused by a conflict between some of our custom
+ allocators, causing them to return null. Symptom is typically a null pointer dereference in
+ a place where it might be expected an allocation has just occurred.
+
+ * kjs/fast_malloc.cpp: Added #define for MORECORE_CONTIGUOUS, MORECORE_CANNOT_TRIM,
+ and MALLOC_FAILURE_ACTION.
+
+2005-08-31 Geoffrey Garen <ggaren@apple.com>
+
+ -rolled in fix for http://bugs.webkit.org/show_bug.cgi?id=4698
+ kjs does not allow named functions in function expressions
+
+ Fix by Arthur Langereis.
+
+ Reviewed by darin.
+
+ * kjs/grammar.y:
+ * kjs/nodes.cpp:
+ (FuncExprNode::evaluate):
+ * kjs/nodes.h:
+ (KJS::FuncExprNode::FuncExprNode):
+
+ Test cases added:
+
+ * layout-tests/fast/js/named-function-expression-expected.txt: Added.
+ * layout-tests/fast/js/named-function-expression.html: Added.
+
+2005-08-31 Justin Haygood <justin@xiondigital.net>
+
+ Reviewed, tweaked, and landed by Darin.
+
+ - fixed http://bugs.webkit.org/show_bug.cgi?id=4085
+ - fixed http://bugs.webkit.org/show_bug.cgi?id=4087
+ - fixed http://bugs.webkit.org/show_bug.cgi?id=4096
+ Some fixes for compiling on windows.
+
+ * kjs/config.h: Added a WIN32 case in here, with suitable defines.
+ (To be tweaked as necessary.)
+ * kjs/function.cpp: Took out APPLE_CHANGES around use of ICU.
+ * kjs/operations.cpp: Removed some bogus code that always set HAVE_FLOAT_H.
+
+2005-08-30 Darin Adler <darin@apple.com>
+
+ Reviewed by John Sullivan.
+
+ - fixed http://bugs.webkit.org/show_bug.cgi?id=4758
+ unify SharedPtr in WebCore and JavaScriptCore
+
+ * kjs/shared_ptr.h: Updated namespace to KXMLCore instead of kxhmlcore.
+ Made a few small improvements to use local variables a bit more and added
+ an "operator int" to reduce the chance that we'll convert a SharedPtr to
+ an int by accident. Also made the == operators normal functions rather than
+ friend functions, added a couple of comemnts.
+
+ * kjs/function.h: Updated for namespace change.
+ * kjs/function.cpp: Ditto.
+ * kjs/function_object.cpp: Ditto.
+ * kjs/internal.h: Ditto.
+ * kjs/internal.cpp: Ditto.
+ * kjs/nodes.h: Ditto.
+ * kjs/nodes2string.cpp: Ditto.
+
+2005-08-26 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by John.
+
+ <rdar://problem/4224911> many many leaks in kjsyyparse with malformed Javascript
+
+ Record all nodes that are created during parsing, and delete any
+ that are left floating with a refcount of 0.
+
+ * kjs/internal.cpp:
+ (KJS::Parser::saveNewNode):
+ (KJS::clearNewNodes):
+ (KJS::Parser::parse):
+ * kjs/internal.h:
+ * kjs/nodes.cpp:
+ (Node::Node):
+ * kjs/nodes.h:
+ (KJS::Node::refcount):
+
+2005-08-26 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by John.
+
+ - fixed <rdar://problem/4232452> many many leaks in kjsyyparse on some well-formed JavaScript (can repro on sony.com, webkit tests)
+
+ Fixed by changing the refcounting scheme for nodes. Instead of each node implementing a custom ref and
+ deref for all its children (and being responsible for deleting them), nodes use a smart pointer to
+ hold their children, and smart pointers are used outside the node tree as well. This change mostly
+ removes code.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * kjs/function.cpp:
+ (KJS::DeclaredFunctionImp::DeclaredFunctionImp):
+ (KJS::GlobalFuncImp::callAsFunction):
+ * kjs/function.h:
+ * kjs/function_object.cpp:
+ (FunctionObjectImp::construct):
+ * kjs/grammar.y:
+ * kjs/internal.cpp:
+ (KJS::Parser::parse):
+ (KJS::Parser::accept):
+ (KJS::InterpreterImp::checkSyntax):
+ (KJS::InterpreterImp::evaluate):
+ * kjs/internal.h:
+ * kjs/nodes.cpp:
+ (Node::Node):
+ (Node::~Node):
+ (ElementNode::evaluate):
+ (PropertyValueNode::evaluate):
+ (ArgumentListNode::evaluateList):
+ (NewExprNode::evaluate):
+ (FunctionCallValueNode::evaluate):
+ (FunctionCallBracketNode::evaluate):
+ (FunctionCallDotNode::evaluate):
+ (RelationalNode::evaluate):
+ (StatListNode::execute):
+ (StatListNode::processVarDecls):
+ (VarDeclListNode::evaluate):
+ (VarDeclListNode::processVarDecls):
+ (ForInNode::ForInNode):
+ (ClauseListNode::processVarDecls):
+ (CaseBlockNode::evalBlock):
+ (FuncDeclNode::processFuncDecl):
+ (FuncExprNode::evaluate):
+ (SourceElementsNode::execute):
+ (SourceElementsNode::processFuncDecl):
+ (SourceElementsNode::processVarDecls):
+ * kjs/nodes.h:
+ (KJS::Node::ref):
+ (KJS::Node::deref):
+ (KJS::NumberNode::NumberNode):
+ (KJS::GroupNode::GroupNode):
+ (KJS::ElementNode::ElementNode):
+ (KJS::ArrayNode::ArrayNode):
+ (KJS::PropertyValueNode::PropertyValueNode):
+ (KJS::ObjectLiteralNode::ObjectLiteralNode):
+ (KJS::BracketAccessorNode::BracketAccessorNode):
+ (KJS::DotAccessorNode::DotAccessorNode):
+ (KJS::ArgumentListNode::ArgumentListNode):
+ (KJS::ArgumentsNode::ArgumentsNode):
+ (KJS::NewExprNode::NewExprNode):
+ (KJS::FunctionCallValueNode::FunctionCallValueNode):
+ (KJS::FunctionCallResolveNode::FunctionCallResolveNode):
+ (KJS::FunctionCallBracketNode::FunctionCallBracketNode):
+ (KJS::FunctionCallDotNode::FunctionCallDotNode):
+ (KJS::PostfixNode::PostfixNode):
+ (KJS::DeleteNode::DeleteNode):
+ (KJS::VoidNode::VoidNode):
+ (KJS::TypeOfNode::TypeOfNode):
+ (KJS::PrefixNode::PrefixNode):
+ (KJS::UnaryPlusNode::UnaryPlusNode):
+ (KJS::NegateNode::NegateNode):
+ (KJS::BitwiseNotNode::BitwiseNotNode):
+ (KJS::LogicalNotNode::LogicalNotNode):
+ (KJS::MultNode::MultNode):
+ (KJS::AddNode::AddNode):
+ (KJS::ShiftNode::ShiftNode):
+ (KJS::RelationalNode::RelationalNode):
+ (KJS::EqualNode::EqualNode):
+ (KJS::BitOperNode::BitOperNode):
+ (KJS::BinaryLogicalNode::BinaryLogicalNode):
+ (KJS::ConditionalNode::ConditionalNode):
+ (KJS::AssignResolveNode::AssignResolveNode):
+ (KJS::AssignBracketNode::AssignBracketNode):
+ (KJS::AssignDotNode::AssignDotNode):
+ (KJS::CommaNode::CommaNode):
+ (KJS::AssignExprNode::AssignExprNode):
+ (KJS::VarDeclListNode::VarDeclListNode):
+ (KJS::VarStatementNode::VarStatementNode):
+ (KJS::ExprStatementNode::ExprStatementNode):
+ (KJS::IfNode::IfNode):
+ (KJS::DoWhileNode::DoWhileNode):
+ (KJS::WhileNode::WhileNode):
+ (KJS::ForNode::ForNode):
+ (KJS::ReturnNode::ReturnNode):
+ (KJS::WithNode::WithNode):
+ (KJS::CaseClauseNode::CaseClauseNode):
+ (KJS::ClauseListNode::ClauseListNode):
+ (KJS::ClauseListNode::clause):
+ (KJS::ClauseListNode::next):
+ (KJS::SwitchNode::SwitchNode):
+ (KJS::LabelNode::LabelNode):
+ (KJS::ThrowNode::ThrowNode):
+ (KJS::CatchNode::CatchNode):
+ (KJS::FinallyNode::FinallyNode):
+ (KJS::TryNode::TryNode):
+ (KJS::ParameterNode::ParameterNode):
+ (KJS::ParameterNode::nextParam):
+ (KJS::FuncDeclNode::FuncDeclNode):
+ (KJS::FuncExprNode::FuncExprNode):
+ * kjs/nodes2string.cpp:
+ (KJS::SourceStream::operator<<):
+ (ElementNode::streamTo):
+ (PropertyValueNode::streamTo):
+ (ArgumentListNode::streamTo):
+ (StatListNode::streamTo):
+ (VarDeclListNode::streamTo):
+ (CaseBlockNode::streamTo):
+ (ParameterNode::streamTo):
+ (SourceElementsNode::streamTo):
+ * kjs/shared_ptr.h: Added.
+ (kxmlcore::SharedPtr::SharedPtr):
+ (kxmlcore::SharedPtr::~SharedPtr):
+ (kxmlcore::SharedPtr::isNull):
+ (kxmlcore::SharedPtr::notNull):
+ (kxmlcore::SharedPtr::reset):
+ (kxmlcore::SharedPtr::get):
+ (kxmlcore::SharedPtr::operator*):
+ (kxmlcore::SharedPtr::operator->):
+ (kxmlcore::SharedPtr::operator!):
+ (kxmlcore::SharedPtr::operator bool):
+ (kxmlcore::SharedPtr::operator==):
+ (kxmlcore::::operator):
+ (kxmlcore::operator!=):
+ (kxmlcore::static_pointer_cast):
+ (kxmlcore::const_pointer_cast):
+
+2005-08-26 Geoff Garen <ggaren@apple.com>
+
+ Reviewed by John.
+ Landed by Darin.
+
+ - fixed http://bugs.webkit.org/show_bug.cgi?id=4664
+ TOT Crash from backwards null check in WebScriptObject.mm
+
+ * bindings/objc/WebScriptObject.mm:
+ (+[WebScriptObject _convertValueToObjcValue:originExecutionContext:executionContext:]):
+ Remove bogus !.
+
+2005-08-25 Darin Adler <darin@apple.com>
+
+ Reviewed by John Sullivan.
+
+ - rename KJS::UString::string() to KJS::UString::domString()
+ - rename KJS::Identifier::string() to KJS::Identifier::domString()
+
+ * kjs/identifier.h: Renamed.
+ * kjs/ustring.h: Ditto.
+
+2005-08-19 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - fixed http://bugs.webkit.org/show_bug.cgi?id=4435
+ speed up JavaScript by tweaking the Identifier class
+
+ * kjs/identifier.h: Add a new global nullIdentifier and make Identifier::null a function
+ that returns it.
+ * kjs/identifier.cpp: (KJS::Identifier::init): Initialize a global for the null identifier
+ as well as all the other globals for special identifiers.
+
+ * kjs/ustring.h: (KJS::UString::UString): Make this empty constructor inline.
+ * kjs/ustring.cpp: Remove the old non-inline version.
+
+2005-08-19 Mitz Pettel <opendarwin.org@mitzpettel.com>
+
+ Reviewed by Maciej.
+ Revised and landed by Darin.
+
+ - fixed http://bugs.webkit.org/show_bug.cgi?id=4474
+ REGRESSION: Crash when using in-place operator on uninitialized array element
+
+ * kjs/nodes.cpp:
+ (AssignResolveNode::evaluate): Remove unneeded "isSet" assertion.
+ (AssignBracketNode::evaluate): Replace code that tested "isSet" with code that
+ tests the return value of getPropertySlot.
+
+ * kjs/property_slot.h: Removed unneeded "isSet" function. Property slots are
+ either uninitialized or set. There's no "initialized and not set" state.
+
+2005-08-18 Adele Peterson <adele@apple.com>
+
+ Checked "Inline Functions Hidden" box
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2005-08-16 Darin Adler <darin@apple.com>
+
+ Reviewed by Geoff.
+
+ - fixed crash in one of the JavaScript tests (introduced by my throwError change)
+
+ * kjs/nodes.cpp: (Node::setExceptionDetailsIfNeeded): Check if the exception is an
+ object before setting the file and line number properties on it. Something to think
+ about in the future -- do we really want to do this on any object that's thrown?
+ How about limiting it to error objects that were created by the JavaScript engine?
+
+ - changed kjs_fast_malloc so we don't have two conflicting versions of the same function
+
+ * kjs/fast_malloc.h: Took out all the ifdefs from this header.
+ * kjs/fast_malloc.cpp: Added non-NDEBUG versions of the functions that just call
+ the system malloc, and put the NDEBUG versions in an #else.
+
+2005-08-16 Darin Adler <darin@apple.com>
+
+ Reviewed by Geoff.
+
+ - clean up exported symbols that are not in a "KJS" namespace
+
+ * bindings/NP_jsobject.cpp: (identiferFromNPIdentifier): Marked this function static
+ so it no longer has external linkage.
+ * bindings/c/c_utility.h: Put all this stuff inside the KJS namespace.
+ * bindings/c/c_utility.cpp: Also marked some globals static so they don't have external
+ linkage; not as important given the namespace.
+ * bindings/npruntime.cpp: Marked functions static so they no longer have internal linkage.
+ Also removed unused _NPN_SetExceptionWithUTF8 function (not in header, had C++ linkage!).
+
+ * bindings/jni/jni_utility.cpp: (KJS::Bindings::getJavaVM): Call KJS_GetCreatedJavaVMs
+ using the soft linking header, instead of calling the JNI call. This allows processes
+ to link both JavaScriptCore and JavaVM without a symbol conflict.
+ * bindings/softlinking.c:
+ (loadFramework): Marked this function static so it no longer has external linkage.
+ (getFunctionPointer): Ditto.
+ (KJS_GetCreatedJavaVMs): Renamed this so it has a KJS prefix.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj: Added softlinking.h.
+ * bindings/softlinking.h: Added.
+
+ * kjs/nodes2string.cpp: (streamAssignmentOperatorTo): Marked this function static so it
+ no longer has external linkage.
+
+2005-08-15 Darin Adler <darin@apple.com>
+
+ Reviewed by Geoff.
+
+ - fixed http://bugs.webkit.org/show_bug.cgi?id=4437
+ clean up error creation with new throwError function
+
+ * bindings/NP_jsobject.cpp:
+ (_NPN_SetException):
+ * bindings/jni/jni_instance.cpp:
+ (JavaInstance::invokeMethod):
+ * bindings/jni/jni_runtime.cpp:
+ (JavaField::dispatchValueFromInstance):
+ (JavaField::dispatchSetValueToInstance):
+ * bindings/objc/WebScriptObject.mm:
+ (-[WebScriptObject _initializeWithObjectImp:originExecutionContext:executionContext:]):
+ (-[WebScriptObject _initWithObjectImp:originExecutionContext:executionContext:]):
+ (+[WebScriptObject throwException:]):
+ (-[WebScriptObject setException:]):
+ (+[WebScriptObject _convertValueToObjcValue:originExecutionContext:executionContext:]):
+ * bindings/objc/objc_class.h:
+ (KJS::Bindings::ObjcClass::~ObjcClass):
+ (KJS::Bindings::ObjcClass::ObjcClass):
+ (KJS::Bindings::ObjcClass::operator=):
+ (KJS::Bindings::ObjcClass::constructorAt):
+ (KJS::Bindings::ObjcClass::numConstructors):
+ * bindings/objc/objc_header.h:
+ * bindings/objc/objc_runtime.h:
+ (KJS::Bindings::ObjcField::~ObjcField):
+ (KJS::Bindings::ObjcField::ObjcField):
+ (KJS::Bindings::ObjcField::operator=):
+ (KJS::Bindings::ObjcMethod::ObjcMethod):
+ (KJS::Bindings::ObjcMethod::~ObjcMethod):
+ (KJS::Bindings::ObjcMethod::operator=):
+ * bindings/objc/objc_runtime.mm:
+ (ObjcField::valueFromInstance):
+ (ObjcField::setValueToInstance):
+ (ObjcArray::setValueAt):
+ (ObjcArray::valueAt):
+ * bindings/objc/objc_utility.h:
+ * bindings/objc/objc_utility.mm:
+ (KJS::Bindings::JSMethodNameToObjCMethodName):
+ (KJS::Bindings::convertValueToObjcValue):
+ (KJS::Bindings::convertNSStringToString):
+ (KJS::Bindings::convertObjcValueToValue):
+ (KJS::Bindings::objcValueTypeForType):
+ (KJS::Bindings::createObjcInstanceForValue):
+ (KJS::Bindings::throwError):
+ * bindings/runtime.h:
+ (KJS::Bindings::Parameter::~Parameter):
+ (KJS::Bindings::Method::~Method):
+ (KJS::Bindings::Instance::Instance):
+ (KJS::Bindings::Instance::begin):
+ (KJS::Bindings::Instance::end):
+ (KJS::Bindings::Instance::getValueOfUndefinedField):
+ (KJS::Bindings::Instance::supportsSetValueOfUndefinedField):
+ (KJS::Bindings::Instance::setValueOfUndefinedField):
+ (KJS::Bindings::Instance::valueOf):
+ * bindings/runtime_array.cpp:
+ (RuntimeArrayImp::put):
+ * bindings/runtime_object.h:
+ (KJS::RuntimeObjectImp::setInternalInstance):
+ (KJS::RuntimeObjectImp::getInternalInstance):
+ * kjs/array_object.cpp:
+ (getProperty):
+ (ArrayProtoFuncImp::callAsFunction):
+ (ArrayObjectImp::construct):
+ * kjs/bool_object.cpp:
+ (BooleanProtoFuncImp::callAsFunction):
+ * kjs/date_object.cpp:
+ (KJS::DateProtoFuncImp::callAsFunction):
+ * kjs/function.cpp:
+ (KJS::decode):
+ (KJS::GlobalFuncImp::callAsFunction):
+ * kjs/function_object.cpp:
+ (FunctionProtoFuncImp::callAsFunction):
+ (FunctionObjectImp::construct):
+ * kjs/internal.cpp:
+ (KJS::UndefinedImp::toObject):
+ (KJS::NullImp::toObject):
+ (KJS::InterpreterImp::evaluate):
+ (KJS::InternalFunctionImp::hasInstance):
+ * kjs/nodes.cpp:
+ (Node::throwError):
+ (substitute):
+ (Node::setExceptionDetailsIfNeeded):
+ (undefinedVariableError):
+ (ProgramNode::ProgramNode):
+ * kjs/number_object.cpp:
+ (NumberProtoFuncImp::callAsFunction):
+ * kjs/object.cpp:
+ (KJS::ObjectImp::call):
+ (KJS::ObjectImp::defaultValue):
+ (KJS::Error::create):
+ (KJS::throwError):
+ * kjs/object.h:
+ (KJS::ObjectImp::clearProperties):
+ (KJS::ObjectImp::getPropertySlot):
+ (KJS::ObjectImp::getOwnPropertySlot):
+ * kjs/object_object.cpp:
+ (ObjectProtoFuncImp::callAsFunction):
+ * kjs/reference.cpp:
+ (KJS::Reference::getBase):
+ (KJS::Reference::getValue):
+ (KJS::Reference::putValue):
+ (KJS::Reference::deleteValue):
+ * kjs/regexp_object.cpp:
+ (RegExpProtoFuncImp::callAsFunction):
+ (RegExpObjectImp::construct):
+ * kjs/string_object.cpp:
+ (StringProtoFuncImp::callAsFunction):
+
+2005-08-15 Anders Carlsson <andersca@mac.com>
+
+ Reviewed by Darin.
+
+ * tests/mozilla/ecma_3/Date/15.9.5.5.js:
+ Remove the code which tests that Date.toLocaleString should be parsable
+ by Date.parse. That is not true according to the spec.
+
+2005-08-15 Darin Adler <darin@apple.com>
+
+ Reviewed by Geoff.
+
+ * kjs/collector.cpp: (KJS::Collector::allocate): Use a local instead of a global in one
+ more place; slight speedup.
+
+2005-08-14 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - fixed crash observed on one of the Apple-only layout tests
+
+ * kjs/property_map.cpp: (KJS::PropertyMap::mark): Change code to understand that deleted
+ entries have a value of NULL, so the deleted sentinel count doesn't need to be included
+ in the count of things to mark since we're ignoring the keys.
+
+2005-08-14 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - fixed http://bugs.webkit.org/show_bug.cgi?id=4421
+ speed up JavaScript by inlining some label stack functions
+
+ * kjs/internal.h: Removed the copy constructor and assignment operator for LabelStack.
+ They were unused, and the implementations had bugs; I removed them rather than fixing them.
+ Also removed the clear function, since that was only needed to help the assignment operator
+ share code with the destructor, and was not efficient enough for the destructor.
+ (KJS::LabelStack::~LabelStack): Made this inline. Also used an efficient implementation
+ that's nice and fast when the stack is empty, better than the old clear() function which
+ used to keep updating and refetching "tos" each time through the loop.
+ (KJS::LabelStack::pop): Made this inline.
+
+ * kjs/internal.cpp: Deleted the now-inline functions and the obsolete functions. Also
+ deleted a commented-out line of code.
+
+2005-08-14 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - fixed http://bugs.webkit.org/show_bug.cgi?id=4419
+ speed up JavaScript by improving KJS::List
+
+ my measurements show an improvement of 1% on iBench JavaScript
+
+ * kjs/list.cpp: Rearrange list to make the values and free list share the same storage,
+ which saves 4 bytes per list. Also remove the pointers used only on the heap from the
+ lists that are in the pool, which saves 8 bytes per list. Moving the free list pointer
+ closer to the start of the list object also speeds up access to the free list. New
+ "HeapListImp" struct is used only for the lists on the heap.
+ (KJS::List::markProtectedLists): Shadowed global variable in local and updated for the
+ new terminology ("heap" instead of "outside pool").
+ (KJS::allocateListImp): Updated for new terminology.
+ (KJS::List::release): Moved the code from deallocateListImp in here -- it wasn't being
+ inlined and didn't need to be in a separate function.
+
+2005-08-14 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - fixed http://bugs.webkit.org/show_bug.cgi?id=4417
+ speed up JavaScript with some small changes to the property map code
+
+ my measurements show an improvement of 2% on iBench JavaScript
+
+ * kjs/property_map.h: (KJS::PropertyMap::PropertyMap): Made the default constructor inline.
+ * kjs/property_map.cpp:
+ (KJS::PropertyMap::~PropertyMap): Changed loop to exit early once we know we've processed
+ all the hash table entries, based on the count.
+ (KJS::PropertyMap::mark): Ditto.
+
+ * kjs/object.h: Made an arbitrary change here to force recompiling so we pick up changes to
+ property_map.h. Works around what seems to be an Xcode header dependency bug.
+
+2005-08-14 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - fixed http://bugs.webkit.org/show_bug.cgi?id=4416
+ speed up JavaScript with some improvements to the garbage collector
+
+ my measurements show an improvement of 2% on iBench JavaScript
+
+ * kjs/collector.cpp:
+ (KJS::Collector::allocate): Use local variables to shadow globals instead of repeatedly
+ going at global variables. Tighten up loop implementations to make the common case fast.
+ (KJS::Collector::markStackObjectsConservatively): Use local variables to shadow globals.
+ Used a goto to eliminate a boolean since it was showing up in the profile.
+ (KJS::Collector::markProtectedObjects): Iterate through the table using pointer rather
+ than an index since the profile showed that generating better code.
+ (KJS::Collector::collect): Added a special case for blocks where all cells are used,
+ Use local variables to shadow globals. Eliminated a boolean by computing it another
+ way (checking to see if the number of live objects changed). Also used local variables
+ to shadow fields in the current cell when sweeping.
+ (KJS::Collector::numReferencedObjects): Use AllocatedValueImp instead of ValueImp
+ in one place -- means we get faster versions of various functions that don't worry
+ about SimpleNumber.
+ (KJS::className): Ditto.
+ (KJS::Collector::rootObjectClasses): Ditto.
+
+2005-08-14 Darin Adler <darin@apple.com>
+
+ - fixed http://bugs.webkit.org/show_bug.cgi?id=4344
+ REGRESSION: JavaScript crash when going back from viewing a thread (NULL protoype)
+
+ * kjs/error_object.cpp: (NativeErrorImp::NativeErrorImp): Set proto in a more
+ straightforward way. The old code set the proto to 0 and then to the correct value.
+ This showed up as a "false positive" when searching for places that set prototype
+ to NULL/0 so I fixed it.
+
+ * kjs/function_object.cpp: (FunctionPrototypeImp::FunctionPrototypeImp): Change to
+ not pass an explicit "0" to the base class (InternalFunctionImp) constructor.
+
+ * kjs/internal.h: Added a default constructor for InternalFunctionImp.
+ * kjs/internal.cpp: (KJS::InternalFunctionImp::InternalFunctionImp): Added the
+ default constructor (empty body, just calls base class's default constructor).
+
+ * kjs/object.h:
+ (KJS::ObjectImp::ObjectImp): Add an assertion to catch NULL prototypes earlier
+ in Development builds.
+ (KJS::ObjectImp::setPrototype): Ditto.
+
+2005-08-12 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by John.
+
+ - two simple speed improvements for a 3% speed gain
+
+ * JavaScriptCore.xcodeproj/project.pbxproj: turn on -fstrict-aliasing
+
+ * kjs/scope_chain.h:
+ (KJS::ScopeChainIterator::ScopeChainIterator): Add a scope chain iterator
+ so you can walk a scope chain without having to make a copy that you then mutate.
+ (KJS::ScopeChainIterator::operator*): standard iterator operation
+ (KJS::ScopeChainIterator::operator->): ditto
+ (KJS::ScopeChainIterator::operator++): ditto
+ (KJS::ScopeChainIterator::operator==): ditto
+ (KJS::ScopeChainIterator::operator!=): ditto
+ (KJS::ScopeChain::begin): Iterator for the top of the scope chain
+ (KJS::ScopeChain::end): Iterator for one past the bottom (i.e. null)
+ * kjs/nodes.cpp:
+ (ResolveNode::evaluate): Use scope chain iterator instead of copying
+ a scope chain and then modifying the copy
+ (ResolveNode::evaluateReference): ditto
+ (FunctionCallResolveNode::evaluate): ditto
+ (AssignResolveNode::evaluate): ditto
+
+2005-08-12 Maciej Stachowiak <mjs@apple.com>
+
+ Patch from Anders Carlsson, reviewed by me.
+
+ * kjs/nodes.h: Fix build breakage.
+
+2005-08-12 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by hyatt.
+
+ - refactor function calls, 3% speedup on JS iBench.
+
+ * kjs/grammar.y:
+ * kjs/nodes.cpp:
+ (Node::throwError): Added new useful variants.
+ (FunctionCallValueNode::evaluate): New node to handle calls on expressions
+ that are strictly values, not references.
+ (FunctionCallValueNode::ref): ditto
+ (FunctionCallValueNode::deref): ditto
+ (FunctionCallResolveNode::evaluate): New node to handle calls on identifier
+ expressions, so that they are looked up in the scope chain.
+ (FunctionCallResolveNode::ref): ditto
+ (FunctionCallResolveNode::deref): ditto
+ (FunctionCallBracketNode::evaluate): New node to handle calls on bracket
+ dereferences, so that the expression before brackets is used as the this
+ object.
+ (FunctionCallBracketNode::ref): ditto
+ (FunctionCallBracketNode::deref): ditto
+ (FunctionCallDotNode::evaluate): New node to handle calls on dot
+ dereferences, so that the expression before the dot is used as the this
+ object.
+ (FunctionCallDotNode::ref): ditto
+ (FunctionCallDotNode::deref): ditto
+ (dotExprNotAnObjectString): helper function to avoid global variable access.
+ (dotExprDoesNotAllowCallsString): ditto
+ * kjs/nodes.h: Declared new classes.
+ * kjs/nodes2string.cpp:
+ (FunctionCallValueNode::streamTo): Added - serializes the appropriate function call
+ (FunctionCallResolveNode::streamTo): ditto
+ (FunctionCallBracketNode::streamTo): ditto
+ (FunctionCallParenBracketNode::streamTo): ditto
+ (FunctionCallDotNode::streamTo): ditto
+ (FunctionCallParenDotNode::streamTo): ditto
+ * kjs/object.h:
+ (KJS::ObjectImp::isActivation): Change how activation objects are
+ detected in the scope chain, a virtual function is cheaper than the
+ old inheritance test.
+ * kjs/function.h:
+ (KJS::ActivationImp::isActivation): Ditto.
+
+2005-08-11 Maciej Stachowiak <mjs@apple.com>
+
+ - added missing file from earlier checkin
+
+ * kjs/grammar_types.h: Added.
+ (KJS::makeNodePair):
+ (KJS::makeNodeWithIdent):
+
+2005-08-11 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Geoff.
+
+ * kjs/date_object.cpp:
+ (timetUsingCF): Fix one of the date tests my making the CF version of mktime
+ have the same quirk about the DST field as the real mktime.
+ * tests/mozilla/expected.html: Updated for newly fixed test.
+
+2005-08-11 Maciej Stachowiak <mjs@apple.com>
+
+ - updated for one of the tests that Darin incidentally fixed.
+
+ * tests/mozilla/expected.html:
+
+2005-08-10 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Geoff.
+
+ Refactor assignment grammar to avoid Reference type, and to later
+ be able to take advantage of writeable PropertySlots, when those
+ are added. I also fixed a minor bug, turning a function to a
+ string lost parentheses, I made sure they are printed at least
+ where semantically significant.
+
+ Test cases: see WebCore
+
+ * kjs/grammar.y: Change grammar so that assignment expressions are parsed
+ directly to nodes that know how to set the kind of location being assigned, instead
+ of having a generic assign node that counts on evaluateReference.
+ * kjs/lexer.cpp: Include grammar_types.h.
+ * kjs/nodes.cpp:
+ (BracketAccessorNode): Renamed from AccessorNode1 for clarity.
+ (DotAccessorNode): Renamed from AccessorNode2 for clarity.
+ (combineForAssignment): Inline function for doing the proper kind of
+ operation for various update assignments like += or *=.
+ (AssignResolveNode): Node that handles assignment to a bare identifier.
+ (AssignDotNode): Node that handles assignments of the form EXPR . IDENT = EXPR
+ (AssignBracketNode): EXPR [ IDENT ] = EXPR
+ * kjs/nodes.h: Updated for declarations/renames of new classes.
+ * kjs/nodes2string.cpp:
+ (GroupNode::streamTo): Fixed to print parens around the expression.
+ (BracketAccessorNode::streamTo): Renamed.
+ (DotAccessorNode::streamTo): Renamed.
+ (AssignResolveNode::streamTo): Added.
+ (AssignBracketNode::streamTo): Added.
+ (AssignDotNode::streamTo): Added.
+ (streamAssignmentOperatorTo): helper function for the above
+ * kjs/property_slot.h:
+ (KJS::PropertySlot::isSet): Made this const.
+
+2005-08-10 Adele Peterson <adele@apple.com>
+
+ Bumping version to 420+
+
+ * Info.plist:
+
+2005-08-10 Geoffrey Garen <ggaren@apple.com>
+
+ -fixed <rdar://problem/4151132> REGRESSION: Some applet liveconnect calls
+ throws privilege exception.
+
+ Reviewed by richard and mjs.
+
+ -I removed the global static JavaClass cache, since it violated Java
+ security to cache classes between websites and applets.
+
+ * bindings/jni/jni_class.cpp:
+ -removed global static cache dictionary
+ -instance constructor and destructor now do the work that used to
+ be done by static factory methods
+ -removed obsolete functions
+ (JavaClass::JavaClass):
+ (JavaClass::~JavaClass):
+ * bindings/jni/jni_class.h:
+ -removed obsolete function declarations
+ -made copying private since it's unused and it's also not clear
+ excatly how copying would work with Java security
+ -made default construction private since it's meaningless
+ * bindings/jni/jni_instance.cpp:
+ -removed obsolete functions
+ (JavaInstance::~JavaInstance):
+ (JavaInstance::getClass):
+ * bindings/jni/jni_instance.h:
+ -made copying private since it's unused and it's also not clear
+ excatly how copying would work with Java security
+ -made default construction private since it's meaningless
+
+2005-08-08 Geoffrey Garen <ggaren@apple.com>
+
+ -fixed crash caused by fix for http://bugs.webkit.org/show_bug.cgi?id=4313
+
+ - exceptionDescription now gets explicitly initialized to NULL in all
+ the places listed below -- our wrapper classes used to take care of this
+ automagically
+
+ * bindings/jni/jni_instance.cpp:
+ (JavaInstance::invokeMethod):
+ * bindings/jni/jni_runtime.cpp:
+ (JavaField::dispatchValueFromInstance):
+ (JavaField::dispatchSetValueToInstance):
+
+2005-08-08 Darin Adler <darin@apple.com>
+
+ Reviewed by John Sullivan.
+
+ - fixed http://bugs.webkit.org/show_bug.cgi?id=4325
+ Mozilla Date tests have an unnecessary loop that runs 1970 times before each test
+
+ * tests/mozilla/ecma/shell.js: Added TIME_YEAR_0 constant.
+
+ * tests/mozilla/ecma/Date/15.9.5.10-1.js: Removed the loop and changed code to use the constant.
+ * tests/mozilla/ecma/Date/15.9.5.10-10.js: Ditto.
+ * tests/mozilla/ecma/Date/15.9.5.10-11.js: Ditto.
+ * tests/mozilla/ecma/Date/15.9.5.10-12.js: Ditto.
+ * tests/mozilla/ecma/Date/15.9.5.10-13.js: Ditto.
+ * tests/mozilla/ecma/Date/15.9.5.10-2.js: Ditto.
+ * tests/mozilla/ecma/Date/15.9.5.10-3.js: Ditto.
+ * tests/mozilla/ecma/Date/15.9.5.10-4.js: Ditto.
+ * tests/mozilla/ecma/Date/15.9.5.10-5.js: Ditto.
+ * tests/mozilla/ecma/Date/15.9.5.10-6.js: Ditto.
+ * tests/mozilla/ecma/Date/15.9.5.10-7.js: Ditto.
+ * tests/mozilla/ecma/Date/15.9.5.10-8.js: Ditto.
+ * tests/mozilla/ecma/Date/15.9.5.10-9.js: Ditto.
+ * tests/mozilla/ecma/Date/15.9.5.11-2.js: Ditto.
+ * tests/mozilla/ecma/Date/15.9.5.12-1.js: Ditto.
+ * tests/mozilla/ecma/Date/15.9.5.12-2.js: Ditto.
+ * tests/mozilla/ecma/Date/15.9.5.12-3.js: Ditto.
+ * tests/mozilla/ecma/Date/15.9.5.12-4.js: Ditto.
+ * tests/mozilla/ecma/Date/15.9.5.12-5.js: Ditto.
+ * tests/mozilla/ecma/Date/15.9.5.12-6.js: Ditto.
+ * tests/mozilla/ecma/Date/15.9.5.12-7.js: Ditto.
+ * tests/mozilla/ecma/Date/15.9.5.12-8.js: Ditto.
+ * tests/mozilla/ecma/Date/15.9.5.13-2.js: Ditto.
+ * tests/mozilla/ecma/Date/15.9.5.13-8.js: Ditto.
+ * tests/mozilla/ecma/Date/15.9.5.14.js: Ditto.
+ * tests/mozilla/ecma/Date/15.9.5.15.js: Ditto.
+ * tests/mozilla/ecma/Date/15.9.5.16.js: Ditto.
+ * tests/mozilla/ecma/Date/15.9.5.17.js: Ditto.
+ * tests/mozilla/ecma/Date/15.9.5.18.js: Ditto.
+ * tests/mozilla/ecma/Date/15.9.5.19.js: Ditto.
+ * tests/mozilla/ecma/Date/15.9.5.20.js: Ditto.
+ * tests/mozilla/ecma/Date/15.9.5.21-1.js: Ditto.
+ * tests/mozilla/ecma/Date/15.9.5.21-2.js: Ditto.
+ * tests/mozilla/ecma/Date/15.9.5.21-3.js: Ditto.
+ * tests/mozilla/ecma/Date/15.9.5.21-4.js: Ditto.
+ * tests/mozilla/ecma/Date/15.9.5.21-5.js: Ditto.
+ * tests/mozilla/ecma/Date/15.9.5.21-6.js: Ditto.
+ * tests/mozilla/ecma/Date/15.9.5.21-7.js: Ditto.
+ * tests/mozilla/ecma/Date/15.9.5.21-8.js: Ditto.
+ * tests/mozilla/ecma/Date/15.9.5.22-1.js: Ditto.
+ * tests/mozilla/ecma/Date/15.9.5.22-2.js: Ditto.
+ * tests/mozilla/ecma/Date/15.9.5.22-3.js: Ditto.
+ * tests/mozilla/ecma/Date/15.9.5.22-4.js: Ditto.
+ * tests/mozilla/ecma/Date/15.9.5.22-5.js: Ditto.
+ * tests/mozilla/ecma/Date/15.9.5.22-6.js: Ditto.
+ * tests/mozilla/ecma/Date/15.9.5.22-7.js: Ditto.
+ * tests/mozilla/ecma/Date/15.9.5.22-8.js: Ditto.
+ * tests/mozilla/ecma/Date/15.9.5.23-4.js: Ditto.
+ * tests/mozilla/ecma/Date/15.9.5.23-5.js: Ditto.
+ * tests/mozilla/ecma/Date/15.9.5.23-6.js: Ditto.
+ * tests/mozilla/ecma/Date/15.9.5.23-7.js: Ditto.
+ * tests/mozilla/ecma/Date/15.9.5.23-8.js: Ditto.
+ * tests/mozilla/ecma/Date/15.9.5.23-9.js: Ditto.
+ * tests/mozilla/ecma/Date/15.9.5.5.js: Ditto.
+ * tests/mozilla/ecma/Date/15.9.5.6.js: Ditto.
+ * tests/mozilla/ecma/Date/15.9.5.7.js: Ditto.
+ * tests/mozilla/ecma/Date/15.9.5.8.js: Ditto.
+ * tests/mozilla/ecma/Date/15.9.5.9.js: Ditto.
+
+2005-08-08 Darin Adler <darin@apple.com>
+
+ - forgot to delete an obsolete file
+
+ * kjs/object_wrapper.h: Deleted.
+
+2005-08-07 Darin Adler <darin@apple.com>
+
+ - fixed two problems compiling with gcc 4.0
+
+ * kjs/array_object.cpp: (ArrayProtoFuncImp::callAsFunction): Initialized a
+ variable to quiet an erroneous warning.
+ * kjs/date_object.cpp: (KJS::makeTime): Removed extraneous KJS:: prefix.
+
+2005-08-07 Darin Adler <darin@apple.com>
+
+ Rubber stamped by Maciej.
+
+ - fixed http://bugs.webkit.org/show_bug.cgi?id=4313
+ eliminate KJS::Value and KJS::Object smart pointer wrappers (for simplicity and speed)
+
+ * JavaScriptCore.xcodeproj/project.pbxproj: Removed object_wrapper.h.
+
+ Global replaces and other wonderful stuff.
+
+ * bindings/NP_jsobject.cpp:
+ (_NPN_Invoke):
+ (_NPN_Evaluate):
+ (_NPN_GetProperty):
+ (_NPN_SetProperty):
+ (_NPN_HasMethod):
+ (_NPN_SetException):
+ * bindings/c/c_instance.cpp:
+ (KJS::Bindings::CInstance::CInstance):
+ (KJS::Bindings::CInstance::invokeMethod):
+ (KJS::Bindings::CInstance::invokeDefaultMethod):
+ (KJS::Bindings::CInstance::defaultValue):
+ (KJS::Bindings::CInstance::stringValue):
+ (KJS::Bindings::CInstance::numberValue):
+ (KJS::Bindings::CInstance::booleanValue):
+ (KJS::Bindings::CInstance::valueOf):
+ * bindings/c/c_instance.h:
+ * bindings/c/c_runtime.cpp:
+ (CField::valueFromInstance):
+ (CField::setValueToInstance):
+ * bindings/c/c_runtime.h:
+ * bindings/c/c_utility.cpp:
+ (convertNPStringToUTF16):
+ (convertUTF8ToUTF16):
+ (coerceValueToNPVariantStringType):
+ (convertValueToNPVariant):
+ (convertNPVariantToValue):
+ * bindings/c/c_utility.h:
+ * bindings/jni/jni_instance.cpp:
+ (JavaInstance::stringValue):
+ (JavaInstance::numberValue):
+ (JavaInstance::booleanValue):
+ (JavaInstance::invokeMethod):
+ (JavaInstance::invokeDefaultMethod):
+ (JavaInstance::defaultValue):
+ (JavaInstance::valueOf):
+ * bindings/jni/jni_instance.h:
+ * bindings/jni/jni_jsobject.cpp:
+ (JSObject::invoke):
+ (JSObject::call):
+ (JSObject::eval):
+ (JSObject::getMember):
+ (JSObject::getSlot):
+ (JSObject::toString):
+ (JSObject::convertValueToJObject):
+ (JSObject::convertJObjectToValue):
+ (JSObject::listFromJArray):
+ * bindings/jni/jni_jsobject.h:
+ * bindings/jni/jni_objc.mm:
+ (KJS::Bindings::dispatchJNICall):
+ * bindings/jni/jni_runtime.cpp:
+ (JavaArray::convertJObjectToArray):
+ (JavaField::dispatchValueFromInstance):
+ (JavaField::valueFromInstance):
+ (JavaField::dispatchSetValueToInstance):
+ (JavaField::setValueToInstance):
+ (JavaArray::setValueAt):
+ (JavaArray::valueAt):
+ * bindings/jni/jni_runtime.h:
+ (KJS::Bindings::JavaString::ustring):
+ * bindings/jni/jni_utility.cpp:
+ (KJS::Bindings::getJavaVM):
+ (KJS::Bindings::getJNIEnv):
+ (KJS::Bindings::getMethodID):
+ (KJS::Bindings::callJNIVoidMethod):
+ (KJS::Bindings::callJNIObjectMethod):
+ (KJS::Bindings::callJNIBooleanMethod):
+ (KJS::Bindings::callJNIStaticBooleanMethod):
+ (KJS::Bindings::callJNIByteMethod):
+ (KJS::Bindings::callJNICharMethod):
+ (KJS::Bindings::callJNIShortMethod):
+ (KJS::Bindings::callJNIIntMethod):
+ (KJS::Bindings::callJNILongMethod):
+ (KJS::Bindings::callJNIFloatMethod):
+ (KJS::Bindings::callJNIDoubleMethod):
+ (KJS::Bindings::callJNIVoidMethodA):
+ (KJS::Bindings::callJNIObjectMethodA):
+ (KJS::Bindings::callJNIByteMethodA):
+ (KJS::Bindings::callJNICharMethodA):
+ (KJS::Bindings::callJNIShortMethodA):
+ (KJS::Bindings::callJNIIntMethodA):
+ (KJS::Bindings::callJNILongMethodA):
+ (KJS::Bindings::callJNIFloatMethodA):
+ (KJS::Bindings::callJNIDoubleMethodA):
+ (KJS::Bindings::callJNIBooleanMethodA):
+ (KJS::Bindings::callJNIVoidMethodIDA):
+ (KJS::Bindings::callJNIObjectMethodIDA):
+ (KJS::Bindings::callJNIByteMethodIDA):
+ (KJS::Bindings::callJNICharMethodIDA):
+ (KJS::Bindings::callJNIShortMethodIDA):
+ (KJS::Bindings::callJNIIntMethodIDA):
+ (KJS::Bindings::callJNILongMethodIDA):
+ (KJS::Bindings::callJNIFloatMethodIDA):
+ (KJS::Bindings::callJNIDoubleMethodIDA):
+ (KJS::Bindings::callJNIBooleanMethodIDA):
+ (KJS::Bindings::getCharactersFromJString):
+ (KJS::Bindings::releaseCharactersForJString):
+ (KJS::Bindings::getCharactersFromJStringInEnv):
+ (KJS::Bindings::releaseCharactersForJStringInEnv):
+ (KJS::Bindings::getUCharactersFromJStringInEnv):
+ (KJS::Bindings::releaseUCharactersForJStringInEnv):
+ (KJS::Bindings::JNITypeFromClassName):
+ (KJS::Bindings::signatureFromPrimitiveType):
+ (KJS::Bindings::JNITypeFromPrimitiveType):
+ (KJS::Bindings::getJNIField):
+ (KJS::Bindings::convertValueToJValue):
+ * bindings/jni/jni_utility.h:
+ * bindings/objc/WebScriptObject.mm:
+ (_didExecute):
+ (-[WebScriptObject _initializeWithObjectImp:originExecutionContext:Bindings::executionContext:Bindings::]):
+ (-[WebScriptObject _initWithObjectImp:originExecutionContext:Bindings::executionContext:Bindings::]):
+ (-[WebScriptObject _imp]):
+ (-[WebScriptObject _executionContext]):
+ (-[WebScriptObject _setExecutionContext:]):
+ (-[WebScriptObject _originExecutionContext]):
+ (-[WebScriptObject _setOriginExecutionContext:]):
+ (+[WebScriptObject throwException:]):
+ (listFromNSArray):
+ (-[WebScriptObject callWebScriptMethod:withArguments:]):
+ (-[WebScriptObject evaluateWebScript:]):
+ (-[WebScriptObject setValue:forKey:]):
+ (-[WebScriptObject valueForKey:]):
+ (-[WebScriptObject removeWebScriptKey:]):
+ (-[WebScriptObject stringRepresentation]):
+ (-[WebScriptObject webScriptValueAtIndex:]):
+ (-[WebScriptObject setException:]):
+ (+[WebScriptObject _convertValueToObjcValue:originExecutionContext:executionContext:Bindings::]):
+ * bindings/objc/WebScriptObjectPrivate.h:
+ * bindings/objc/objc_class.h:
+ * bindings/objc/objc_class.mm:
+ (KJS::Bindings::ObjcClass::fallbackObject):
+ * bindings/objc/objc_instance.h:
+ * bindings/objc/objc_instance.mm:
+ (ObjcInstance::invokeMethod):
+ (ObjcInstance::invokeDefaultMethod):
+ (ObjcInstance::setValueOfField):
+ (ObjcInstance::setValueOfUndefinedField):
+ (ObjcInstance::getValueOfField):
+ (ObjcInstance::getValueOfUndefinedField):
+ (ObjcInstance::defaultValue):
+ (ObjcInstance::stringValue):
+ (ObjcInstance::numberValue):
+ (ObjcInstance::booleanValue):
+ (ObjcInstance::valueOf):
+ * bindings/objc/objc_runtime.h:
+ * bindings/objc/objc_runtime.mm:
+ (ObjcField::valueFromInstance):
+ (convertValueToObjcObject):
+ (ObjcField::setValueToInstance):
+ (ObjcArray::setValueAt):
+ (ObjcArray::valueAt):
+ (ObjcFallbackObjectImp::put):
+ (ObjcFallbackObjectImp::callAsFunction):
+ (ObjcFallbackObjectImp::defaultValue):
+ * bindings/objc/objc_utility.h:
+ * bindings/objc/objc_utility.mm:
+ (Bindings::JSMethodNameToObjCMethodName):
+ (Bindings::convertValueToObjcValue):
+ (Bindings::convertNSStringToString):
+ (Bindings::convertObjcValueToValue):
+ (Bindings::objcValueTypeForType):
+ (Bindings::createObjcInstanceForValue):
+ * bindings/runtime.cpp:
+ (Instance::getValueOfField):
+ (Instance::setValueOfField):
+ (Instance::createRuntimeObject):
+ (Instance::createLanguageInstanceForValue):
+ * bindings/runtime.h:
+ (KJS::Bindings::Constructor::~Constructor):
+ (KJS::Bindings::Field::~Field):
+ (KJS::Bindings::MethodList::MethodList):
+ (KJS::Bindings::Class::fallbackObject):
+ (KJS::Bindings::Class::~Class):
+ (KJS::Bindings::Instance::Instance):
+ (KJS::Bindings::Instance::getValueOfUndefinedField):
+ (KJS::Bindings::Instance::supportsSetValueOfUndefinedField):
+ (KJS::Bindings::Instance::setValueOfUndefinedField):
+ (KJS::Bindings::Instance::valueOf):
+ (KJS::Bindings::Instance::setExecutionContext):
+ (KJS::Bindings::Instance::~Instance):
+ (KJS::Bindings::Array::~Array):
+ * bindings/runtime_array.cpp:
+ (RuntimeArrayImp::RuntimeArrayImp):
+ (RuntimeArrayImp::lengthGetter):
+ (RuntimeArrayImp::indexGetter):
+ (RuntimeArrayImp::put):
+ * bindings/runtime_array.h:
+ * bindings/runtime_method.cpp:
+ (RuntimeMethodImp::lengthGetter):
+ (RuntimeMethodImp::callAsFunction):
+ * bindings/runtime_method.h:
+ * bindings/runtime_object.cpp:
+ (RuntimeObjectImp::fallbackObjectGetter):
+ (RuntimeObjectImp::fieldGetter):
+ (RuntimeObjectImp::methodGetter):
+ (RuntimeObjectImp::getOwnPropertySlot):
+ (RuntimeObjectImp::put):
+ (RuntimeObjectImp::defaultValue):
+ (RuntimeObjectImp::callAsFunction):
+ * bindings/runtime_object.h:
+ * kjs/array_instance.h:
+ * kjs/array_object.cpp:
+ (ArrayInstanceImp::ArrayInstanceImp):
+ (ArrayInstanceImp::lengthGetter):
+ (ArrayInstanceImp::getOwnPropertySlot):
+ (ArrayInstanceImp::put):
+ (ArrayInstanceImp::propList):
+ (ArrayInstanceImp::setLength):
+ (compareByStringForQSort):
+ (compareWithCompareFunctionForQSort):
+ (ArrayInstanceImp::sort):
+ (ArrayInstanceImp::pushUndefinedObjectsToEnd):
+ (ArrayPrototypeImp::ArrayPrototypeImp):
+ (ArrayProtoFuncImp::ArrayProtoFuncImp):
+ (ArrayProtoFuncImp::callAsFunction):
+ (ArrayObjectImp::ArrayObjectImp):
+ (ArrayObjectImp::construct):
+ (ArrayObjectImp::callAsFunction):
+ * kjs/array_object.h:
+ * kjs/bool_object.cpp:
+ (BooleanPrototypeImp::BooleanPrototypeImp):
+ (BooleanProtoFuncImp::BooleanProtoFuncImp):
+ (BooleanProtoFuncImp::callAsFunction):
+ (BooleanObjectImp::BooleanObjectImp):
+ (BooleanObjectImp::construct):
+ (BooleanObjectImp::callAsFunction):
+ * kjs/bool_object.h:
+ * kjs/collector.cpp:
+ (KJS::Collector::markStackObjectsConservatively):
+ (KJS::Collector::collect):
+ (KJS::className):
+ * kjs/completion.h:
+ (KJS::Completion::Completion):
+ (KJS::Completion::value):
+ (KJS::Completion::isValueCompletion):
+ * kjs/context.h:
+ (KJS::ContextImp::variableObject):
+ (KJS::ContextImp::setVariableObject):
+ (KJS::ContextImp::thisValue):
+ (KJS::ContextImp::activationObject):
+ (KJS::ContextImp::pushScope):
+ * kjs/date_object.cpp:
+ (formatLocaleDate):
+ (KJS::timeFromArgs):
+ (KJS::DatePrototypeImp::DatePrototypeImp):
+ (KJS::DateProtoFuncImp::DateProtoFuncImp):
+ (KJS::DateProtoFuncImp::callAsFunction):
+ (KJS::DateObjectImp::DateObjectImp):
+ (KJS::DateObjectImp::construct):
+ (KJS::DateObjectImp::callAsFunction):
+ (KJS::DateObjectFuncImp::DateObjectFuncImp):
+ (KJS::DateObjectFuncImp::callAsFunction):
+ (KJS::parseDate):
+ (KJS::KRFCDate_parseDate):
+ (KJS::timeClip):
+ * kjs/date_object.h:
+ * kjs/debugger.cpp:
+ (Debugger::exception):
+ (Debugger::callEvent):
+ (Debugger::returnEvent):
+ * kjs/debugger.h:
+ * kjs/error_object.cpp:
+ (ErrorPrototypeImp::ErrorPrototypeImp):
+ (ErrorProtoFuncImp::ErrorProtoFuncImp):
+ (ErrorProtoFuncImp::callAsFunction):
+ (ErrorObjectImp::ErrorObjectImp):
+ (ErrorObjectImp::construct):
+ (ErrorObjectImp::callAsFunction):
+ (NativeErrorPrototypeImp::NativeErrorPrototypeImp):
+ (NativeErrorImp::NativeErrorImp):
+ (NativeErrorImp::construct):
+ (NativeErrorImp::callAsFunction):
+ * kjs/error_object.h:
+ * kjs/function.cpp:
+ (KJS::FunctionImp::FunctionImp):
+ (KJS::FunctionImp::callAsFunction):
+ (KJS::FunctionImp::processParameters):
+ (KJS::FunctionImp::argumentsGetter):
+ (KJS::FunctionImp::lengthGetter):
+ (KJS::FunctionImp::put):
+ (KJS::DeclaredFunctionImp::DeclaredFunctionImp):
+ (KJS::DeclaredFunctionImp::construct):
+ (KJS::ArgumentsImp::ArgumentsImp):
+ (KJS::ArgumentsImp::mappedIndexGetter):
+ (KJS::ArgumentsImp::put):
+ (KJS::ActivationImp::argumentsGetter):
+ (KJS::GlobalFuncImp::GlobalFuncImp):
+ (KJS::encode):
+ (KJS::decode):
+ (KJS::GlobalFuncImp::callAsFunction):
+ * kjs/function.h:
+ * kjs/function_object.cpp:
+ (FunctionPrototypeImp::FunctionPrototypeImp):
+ (FunctionPrototypeImp::callAsFunction):
+ (FunctionProtoFuncImp::FunctionProtoFuncImp):
+ (FunctionProtoFuncImp::callAsFunction):
+ (FunctionObjectImp::FunctionObjectImp):
+ (FunctionObjectImp::construct):
+ (FunctionObjectImp::callAsFunction):
+ * kjs/function_object.h:
+ * kjs/internal.cpp:
+ (KJS::UndefinedImp::toPrimitive):
+ (KJS::UndefinedImp::toObject):
+ (KJS::NullImp::toPrimitive):
+ (KJS::NullImp::toObject):
+ (KJS::BooleanImp::toPrimitive):
+ (KJS::BooleanImp::toObject):
+ (KJS::StringImp::toPrimitive):
+ (KJS::StringImp::toObject):
+ (KJS::NumberImp::toPrimitive):
+ (KJS::NumberImp::toObject):
+ (KJS::NumberImp::getUInt32):
+ (KJS::LabelStack::push):
+ (KJS::ContextImp::ContextImp):
+ (KJS::InterpreterImp::globalInit):
+ (KJS::InterpreterImp::globalClear):
+ (KJS::InterpreterImp::InterpreterImp):
+ (KJS::InterpreterImp::initGlobalObject):
+ (KJS::InterpreterImp::clear):
+ (KJS::InterpreterImp::mark):
+ (KJS::InterpreterImp::evaluate):
+ (KJS::InternalFunctionImp::hasInstance):
+ (KJS::roundValue):
+ (KJS::printInfo):
+ * kjs/internal.h:
+ (KJS::InterpreterImp::builtinObject):
+ (KJS::InterpreterImp::builtinFunction):
+ (KJS::InterpreterImp::builtinArray):
+ (KJS::InterpreterImp::builtinBoolean):
+ (KJS::InterpreterImp::builtinString):
+ (KJS::InterpreterImp::builtinNumber):
+ (KJS::InterpreterImp::builtinDate):
+ (KJS::InterpreterImp::builtinRegExp):
+ (KJS::InterpreterImp::builtinError):
+ (KJS::InterpreterImp::builtinObjectPrototype):
+ (KJS::InterpreterImp::builtinFunctionPrototype):
+ (KJS::InterpreterImp::builtinArrayPrototype):
+ (KJS::InterpreterImp::builtinBooleanPrototype):
+ (KJS::InterpreterImp::builtinStringPrototype):
+ (KJS::InterpreterImp::builtinNumberPrototype):
+ (KJS::InterpreterImp::builtinDatePrototype):
+ (KJS::InterpreterImp::builtinRegExpPrototype):
+ (KJS::InterpreterImp::builtinErrorPrototype):
+ (KJS::InterpreterImp::builtinEvalError):
+ (KJS::InterpreterImp::builtinRangeError):
+ (KJS::InterpreterImp::builtinReferenceError):
+ (KJS::InterpreterImp::builtinSyntaxError):
+ (KJS::InterpreterImp::builtinTypeError):
+ (KJS::InterpreterImp::builtinURIError):
+ (KJS::InterpreterImp::builtinEvalErrorPrototype):
+ (KJS::InterpreterImp::builtinRangeErrorPrototype):
+ (KJS::InterpreterImp::builtinReferenceErrorPrototype):
+ (KJS::InterpreterImp::builtinSyntaxErrorPrototype):
+ (KJS::InterpreterImp::builtinTypeErrorPrototype):
+ (KJS::InterpreterImp::builtinURIErrorPrototype):
+ * kjs/interpreter.cpp:
+ (Context::variableObject):
+ (Context::thisValue):
+ (Interpreter::Interpreter):
+ (Interpreter::globalObject):
+ (Interpreter::evaluate):
+ (Interpreter::builtinObject):
+ (Interpreter::builtinFunction):
+ (Interpreter::builtinArray):
+ (Interpreter::builtinBoolean):
+ (Interpreter::builtinString):
+ (Interpreter::builtinNumber):
+ (Interpreter::builtinDate):
+ (Interpreter::builtinRegExp):
+ (Interpreter::builtinError):
+ (Interpreter::builtinObjectPrototype):
+ (Interpreter::builtinFunctionPrototype):
+ (Interpreter::builtinArrayPrototype):
+ (Interpreter::builtinBooleanPrototype):
+ (Interpreter::builtinStringPrototype):
+ (Interpreter::builtinNumberPrototype):
+ (Interpreter::builtinDatePrototype):
+ (Interpreter::builtinRegExpPrototype):
+ (Interpreter::builtinErrorPrototype):
+ (Interpreter::builtinEvalError):
+ (Interpreter::builtinRangeError):
+ (Interpreter::builtinReferenceError):
+ (Interpreter::builtinSyntaxError):
+ (Interpreter::builtinTypeError):
+ (Interpreter::builtinURIError):
+ (Interpreter::builtinEvalErrorPrototype):
+ (Interpreter::builtinRangeErrorPrototype):
+ (Interpreter::builtinReferenceErrorPrototype):
+ (Interpreter::builtinSyntaxErrorPrototype):
+ (Interpreter::builtinTypeErrorPrototype):
+ (Interpreter::builtinURIErrorPrototype):
+ (Interpreter::createLanguageInstanceForValue):
+ * kjs/interpreter.h:
+ (KJS::Interpreter::isGlobalObject):
+ (KJS::ExecState::setException):
+ (KJS::ExecState::clearException):
+ (KJS::ExecState::exception):
+ (KJS::ExecState::hadException):
+ (KJS::ExecState::ExecState):
+ * kjs/list.cpp:
+ (KJS::List::at):
+ * kjs/list.h:
+ (KJS::List::operator[]):
+ (KJS::ListIterator::operator->):
+ (KJS::ListIterator::operator*):
+ (KJS::ListIterator::operator++):
+ (KJS::ListIterator::operator--):
+ * kjs/lookup.h:
+ (KJS::staticFunctionGetter):
+ (KJS::staticValueGetter):
+ (KJS::lookupPut):
+ (KJS::cacheGlobalObject):
+ * kjs/math_object.cpp:
+ (MathObjectImp::getValueProperty):
+ (MathFuncImp::MathFuncImp):
+ (MathFuncImp::callAsFunction):
+ * kjs/math_object.h:
+ * kjs/nodes.cpp:
+ (Node::evaluateReference):
+ (Node::throwError):
+ (Node::setExceptionDetailsIfNeeded):
+ (NullNode::evaluate):
+ (BooleanNode::evaluate):
+ (NumberNode::evaluate):
+ (StringNode::evaluate):
+ (RegExpNode::evaluate):
+ (ThisNode::evaluate):
+ (ResolveNode::evaluate):
+ (ResolveNode::evaluateReference):
+ (GroupNode::evaluate):
+ (ElementNode::evaluate):
+ (ArrayNode::evaluate):
+ (ObjectLiteralNode::evaluate):
+ (PropertyValueNode::evaluate):
+ (PropertyNode::evaluate):
+ (AccessorNode1::evaluate):
+ (AccessorNode1::evaluateReference):
+ (AccessorNode2::evaluate):
+ (AccessorNode2::evaluateReference):
+ (ArgumentListNode::evaluate):
+ (ArgumentListNode::evaluateList):
+ (ArgumentsNode::evaluate):
+ (NewExprNode::evaluate):
+ (FunctionCallNode::evaluate):
+ (PostfixNode::evaluate):
+ (DeleteNode::evaluate):
+ (VoidNode::evaluate):
+ (TypeOfNode::evaluate):
+ (PrefixNode::evaluate):
+ (UnaryPlusNode::evaluate):
+ (NegateNode::evaluate):
+ (BitwiseNotNode::evaluate):
+ (LogicalNotNode::evaluate):
+ (MultNode::evaluate):
+ (AddNode::evaluate):
+ (ShiftNode::evaluate):
+ (RelationalNode::evaluate):
+ (EqualNode::evaluate):
+ (BitOperNode::evaluate):
+ (BinaryLogicalNode::evaluate):
+ (ConditionalNode::evaluate):
+ (AssignNode::evaluate):
+ (CommaNode::evaluate):
+ (StatListNode::execute):
+ (AssignExprNode::evaluate):
+ (VarDeclNode::evaluate):
+ (VarDeclNode::processVarDecls):
+ (VarDeclListNode::evaluate):
+ (ExprStatementNode::execute):
+ (IfNode::execute):
+ (DoWhileNode::execute):
+ (WhileNode::execute):
+ (ForNode::execute):
+ (ForInNode::execute):
+ (ContinueNode::execute):
+ (BreakNode::execute):
+ (ReturnNode::execute):
+ (WithNode::execute):
+ (CaseClauseNode::evaluate):
+ (ClauseListNode::evaluate):
+ (CaseBlockNode::evaluate):
+ (CaseBlockNode::evalBlock):
+ (SwitchNode::execute):
+ (ThrowNode::execute):
+ (CatchNode::execute):
+ (TryNode::execute):
+ (ParameterNode::evaluate):
+ (FuncDeclNode::processFuncDecl):
+ (FuncExprNode::evaluate):
+ (SourceElementsNode::execute):
+ * kjs/nodes.h:
+ (KJS::StatementNode::evaluate):
+ * kjs/number_object.cpp:
+ (NumberPrototypeImp::NumberPrototypeImp):
+ (NumberProtoFuncImp::NumberProtoFuncImp):
+ (NumberProtoFuncImp::callAsFunction):
+ (NumberObjectImp::NumberObjectImp):
+ (NumberObjectImp::getValueProperty):
+ (NumberObjectImp::construct):
+ (NumberObjectImp::callAsFunction):
+ * kjs/number_object.h:
+ * kjs/object.cpp:
+ (KJS::ObjectImp::call):
+ (KJS::ObjectImp::mark):
+ (KJS::ObjectImp::classInfo):
+ (KJS::ObjectImp::get):
+ (KJS::ObjectImp::getProperty):
+ (KJS::ObjectImp::getPropertySlot):
+ (KJS::ObjectImp::put):
+ (KJS::ObjectImp::hasOwnProperty):
+ (KJS::ObjectImp::defaultValue):
+ (KJS::ObjectImp::findPropertyHashEntry):
+ (KJS::ObjectImp::construct):
+ (KJS::ObjectImp::callAsFunction):
+ (KJS::ObjectImp::hasInstance):
+ (KJS::ObjectImp::propList):
+ (KJS::ObjectImp::toPrimitive):
+ (KJS::ObjectImp::toNumber):
+ (KJS::ObjectImp::toString):
+ (KJS::ObjectImp::toObject):
+ (KJS::ObjectImp::putDirect):
+ (KJS::Error::create):
+ (KJS::error):
+ * kjs/object.h:
+ (KJS::):
+ (KJS::ObjectImp::getPropertySlot):
+ (KJS::AllocatedValueImp::isObject):
+ (KJS::ObjectImp::ObjectImp):
+ (KJS::ObjectImp::internalValue):
+ (KJS::ObjectImp::setInternalValue):
+ (KJS::ObjectImp::prototype):
+ (KJS::ObjectImp::setPrototype):
+ (KJS::ObjectImp::inherits):
+ * kjs/object_object.cpp:
+ (ObjectPrototypeImp::ObjectPrototypeImp):
+ (ObjectProtoFuncImp::ObjectProtoFuncImp):
+ (ObjectProtoFuncImp::callAsFunction):
+ (ObjectObjectImp::ObjectObjectImp):
+ (ObjectObjectImp::construct):
+ (ObjectObjectImp::callAsFunction):
+ * kjs/object_object.h:
+ * kjs/operations.cpp:
+ (KJS::equal):
+ (KJS::strictEqual):
+ (KJS::relation):
+ (KJS::add):
+ (KJS::mult):
+ * kjs/operations.h:
+ * kjs/property_map.cpp:
+ (KJS::PropertyMap::mark):
+ (KJS::PropertyMap::addEnumerablesToReferenceList):
+ (KJS::PropertyMap::addSparseArrayPropertiesToReferenceList):
+ (KJS::PropertyMap::save):
+ (KJS::PropertyMap::restore):
+ * kjs/property_map.h:
+ * kjs/property_slot.cpp:
+ (KJS::PropertySlot::undefinedGetter):
+ * kjs/property_slot.h:
+ (KJS::PropertySlot::getValue):
+ * kjs/protect.h:
+ (KJS::gcUnprotectNullTolerant):
+ (KJS::ProtectedValue::ProtectedValue):
+ (KJS::ProtectedValue::~ProtectedValue):
+ (KJS::ProtectedValue::operator=):
+ (KJS::ProtectedValue::operator ValueImp *):
+ (KJS::ProtectedValue::operator->):
+ * kjs/protected_object.h:
+ (KJS::ProtectedObject::ProtectedObject):
+ (KJS::ProtectedObject::operator=):
+ (KJS::ProtectedObject::operator ValueImp *):
+ (KJS::ProtectedObject::operator ObjectImp *):
+ (KJS::ProtectedObject::operator->):
+ (KJS::ProtectedReference::ProtectedReference):
+ (KJS::ProtectedReference::~ProtectedReference):
+ (KJS::ProtectedReference::operator=):
+ * kjs/protected_values.cpp:
+ (KJS::ProtectedValues::getProtectCount):
+ (KJS::ProtectedValues::increaseProtectCount):
+ (KJS::ProtectedValues::insert):
+ (KJS::ProtectedValues::decreaseProtectCount):
+ * kjs/protected_values.h:
+ * kjs/reference.cpp:
+ (KJS::Reference::Reference):
+ (KJS::Reference::makeValueReference):
+ (KJS::Reference::getBase):
+ (KJS::Reference::getValue):
+ (KJS::Reference::putValue):
+ (KJS::Reference::deleteValue):
+ * kjs/reference.h:
+ (KJS::Reference::baseIfMutable):
+ * kjs/regexp_object.cpp:
+ (RegExpPrototypeImp::RegExpPrototypeImp):
+ (RegExpProtoFuncImp::RegExpProtoFuncImp):
+ (RegExpProtoFuncImp::callAsFunction):
+ (RegExpObjectImp::RegExpObjectImp):
+ (RegExpObjectImp::arrayOfMatches):
+ (RegExpObjectImp::backrefGetter):
+ (RegExpObjectImp::construct):
+ (RegExpObjectImp::callAsFunction):
+ * kjs/regexp_object.h:
+ * kjs/string_object.cpp:
+ (StringInstanceImp::lengthGetter):
+ (StringInstanceImp::indexGetter):
+ (StringInstanceImp::getOwnPropertySlot):
+ (StringInstanceImp::put):
+ (StringPrototypeImp::StringPrototypeImp):
+ (StringProtoFuncImp::StringProtoFuncImp):
+ (regExpIsGlobal):
+ (replace):
+ (StringProtoFuncImp::callAsFunction):
+ (StringObjectImp::StringObjectImp):
+ (StringObjectImp::construct):
+ (StringObjectImp::callAsFunction):
+ (StringObjectFuncImp::StringObjectFuncImp):
+ (StringObjectFuncImp::callAsFunction):
+ * kjs/string_object.h:
+ * kjs/testkjs.cpp:
+ (TestFunctionImp::callAsFunction):
+ (VersionFunctionImp::callAsFunction):
+ (main):
+ * kjs/value.cpp:
+ (KJS::AllocatedValueImp::operator new):
+ (KJS::AllocatedValueImp::getUInt32):
+ (KJS::ValueImp::toInteger):
+ (KJS::ValueImp::toInt32):
+ (KJS::ValueImp::toUInt32):
+ (KJS::ValueImp::toUInt16):
+ (KJS::ValueImp::toObject):
+ (KJS::AllocatedValueImp::getBoolean):
+ (KJS::AllocatedValueImp::getNumber):
+ (KJS::AllocatedValueImp::getString):
+ (KJS::AllocatedValueImp::getObject):
+ (KJS::jsString):
+ (KJS::jsNumber):
+ (KJS::ConstantValues::init):
+ (KJS::ConstantValues::clear):
+ (KJS::ConstantValues::mark):
+ * kjs/value.h:
+ (KJS::):
+ (KJS::jsUndefined):
+ (KJS::jsNull):
+ (KJS::jsBoolean):
+ (KJS::jsNaN):
+ (KJS::ValueImp::ValueImp):
+ (KJS::ValueImp::~ValueImp):
+ (KJS::AllocatedValueImp::AllocatedValueImp):
+ (KJS::AllocatedValueImp::~AllocatedValueImp):
+ (KJS::AllocatedValueImp::isBoolean):
+ (KJS::AllocatedValueImp::isNumber):
+ (KJS::AllocatedValueImp::isString):
+ (KJS::AllocatedValueImp::isObject):
+ (KJS::AllocatedValueImp::marked):
+ (KJS::AllocatedValueImp::mark):
+ (KJS::ValueImp::downcast):
+ (KJS::ValueImp::isUndefined):
+ (KJS::ValueImp::isNull):
+ (KJS::ValueImp::isUndefinedOrNull):
+ (KJS::ValueImp::isBoolean):
+ (KJS::ValueImp::isNumber):
+ (KJS::ValueImp::isString):
+ (KJS::ValueImp::isObject):
+ (KJS::ValueImp::getBoolean):
+ (KJS::ValueImp::getNumber):
+ (KJS::ValueImp::getString):
+ (KJS::ValueImp::getObject):
+ (KJS::ValueImp::getUInt32):
+ (KJS::ValueImp::mark):
+ (KJS::ValueImp::marked):
+ (KJS::ValueImp::type):
+ (KJS::ValueImp::toPrimitive):
+ (KJS::ValueImp::toBoolean):
+ (KJS::ValueImp::toNumber):
+ (KJS::ValueImp::toString):
+ (KJS::jsZero):
+ (KJS::jsOne):
+ (KJS::jsTwo):
+ (KJS::Undefined):
+ (KJS::Null):
+ (KJS::Boolean):
+ (KJS::Number):
+ (KJS::String):
+
+2005-08-06 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin.
+
+ Change over to the new PropertySlot mechanism for property
+ lookup. This allows the elimination of hasOwnProperty
+ methods. Also did some of the performance tuning enabled by this
+ (but not yet all the possible improvements for function calls,
+ assignment, ++, and so forth). And also much code cleanup.
+
+ Net result is about a 2% speedup on the JS iBench.
+
+ Also redid Geoff's fix for the chrashing applet by avoiding a NULL
+ prototype in the bindings code and using the default of Null()
+ instead.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * bindings/objc/objc_runtime.h:
+ * bindings/objc/objc_runtime.mm:
+ (ObjcFallbackObjectImp::ObjcFallbackObjectImp):
+ (ObjcFallbackObjectImp::getOwnPropertySlot):
+ * bindings/runtime_array.cpp:
+ (RuntimeArrayImp::lengthGetter):
+ (RuntimeArrayImp::indexGetter):
+ (RuntimeArrayImp::getOwnPropertySlot):
+ * bindings/runtime_array.h:
+ * bindings/runtime_method.cpp:
+ (RuntimeMethodImp::lengthGetter):
+ (RuntimeMethodImp::getOwnPropertySlot):
+ * bindings/runtime_method.h:
+ * bindings/runtime_object.cpp:
+ (RuntimeObjectImp::RuntimeObjectImp):
+ (RuntimeObjectImp::fallbackObjectGetter):
+ (RuntimeObjectImp::fieldGetter):
+ (RuntimeObjectImp::methodGetter):
+ (RuntimeObjectImp::getOwnPropertySlot):
+ * bindings/runtime_object.h:
+ * bindings/runtime_root.h:
+ * kjs/array_instance.h:
+ * kjs/array_object.cpp:
+ (ArrayInstanceImp::lengthGetter):
+ (ArrayInstanceImp::getOwnPropertySlot):
+ (ArrayPrototypeImp::getOwnPropertySlot):
+ * kjs/array_object.h:
+ * kjs/date_object.cpp:
+ (DatePrototypeImp::getOwnPropertySlot):
+ * kjs/date_object.h:
+ * kjs/function.cpp:
+ (KJS::FunctionImp::argumentsGetter):
+ (KJS::FunctionImp::lengthGetter):
+ (KJS::FunctionImp::getOwnPropertySlot):
+ (KJS::FunctionImp::put):
+ (KJS::FunctionImp::deleteProperty):
+ (KJS::ArgumentsImp::mappedIndexGetter):
+ (KJS::ArgumentsImp::getOwnPropertySlot):
+ (KJS::ActivationImp::argumentsGetter):
+ (KJS::ActivationImp::getArgumentsGetter):
+ (KJS::ActivationImp::getOwnPropertySlot):
+ (KJS::ActivationImp::deleteProperty):
+ * kjs/function.h:
+ * kjs/internal.cpp:
+ (InterpreterImp::InterpreterImp):
+ (InterpreterImp::initGlobalObject):
+ (InterpreterImp::~InterpreterImp):
+ (InterpreterImp::evaluate):
+ * kjs/internal.h:
+ (KJS::InterpreterImp::globalExec):
+ * kjs/interpreter.cpp:
+ (Interpreter::Interpreter):
+ (Interpreter::createLanguageInstanceForValue):
+ * kjs/interpreter.h:
+ (KJS::Interpreter::argumentsIdentifier):
+ (KJS::Interpreter::specialPrototypeIdentifier):
+ * kjs/lookup.h:
+ (KJS::staticFunctionGetter):
+ (KJS::staticValueGetter):
+ (KJS::getStaticPropertySlot):
+ (KJS::getStaticFunctionSlot):
+ (KJS::getStaticValueSlot):
+ * kjs/math_object.cpp:
+ (MathObjectImp::getOwnPropertySlot):
+ * kjs/math_object.h:
+ * kjs/nodes.cpp:
+ (ResolveNode::evaluate):
+ (ResolveNode::evaluateReference):
+ (AccessorNode1::evaluate):
+ (AccessorNode2::evaluate):
+ * kjs/number_object.cpp:
+ (NumberObjectImp::getOwnPropertySlot):
+ * kjs/number_object.h:
+ * kjs/object.cpp:
+ (KJS::ObjectImp::get):
+ (KJS::ObjectImp::getProperty):
+ (KJS::ObjectImp::getPropertySlot):
+ (KJS::ObjectImp::getOwnPropertySlot):
+ (KJS::ObjectImp::put):
+ (KJS::ObjectImp::hasProperty):
+ (KJS::ObjectImp::hasOwnProperty):
+ * kjs/object.h:
+ (KJS::ObjectImp::getDirectLocation):
+ (KJS::ObjectImp::getPropertySlot):
+ (KJS::ObjectImp::getOwnPropertySlot):
+ * kjs/object_wrapper.h: Added.
+ (KJS::):
+ (KJS::Object::Object):
+ (KJS::Object::operator ObjectImp *):
+ * kjs/property_map.cpp:
+ (KJS::PropertyMap::getLocation):
+ * kjs/property_map.h:
+ * kjs/property_slot.cpp: Added.
+ (KJS::PropertySlot::undefinedGetter):
+ * kjs/property_slot.h: Added.
+ (KJS::PropertySlot::isSet):
+ (KJS::PropertySlot::getValue):
+ (KJS::PropertySlot::setValueSlot):
+ (KJS::PropertySlot::setStaticEntry):
+ (KJS::PropertySlot::setCustom):
+ (KJS::PropertySlot::setCustomIndex):
+ (KJS::PropertySlot::setUndefined):
+ (KJS::PropertySlot::slotBase):
+ (KJS::PropertySlot::staticEntry):
+ (KJS::PropertySlot::index):
+ (KJS::PropertySlot::):
+ * kjs/protect.h:
+ * kjs/protected_object.h: Added.
+ (KJS::ProtectedObject::ProtectedObject):
+ (KJS::ProtectedObject::~ProtectedObject):
+ (KJS::ProtectedObject::operator=):
+ (KJS::ProtectedReference::ProtectedReference):
+ (KJS::ProtectedReference::~ProtectedReference):
+ (KJS::ProtectedReference::operator=):
+ * kjs/reference.h:
+ * kjs/reference_list.cpp:
+ * kjs/regexp_object.cpp:
+ (RegExpObjectImp::backrefGetter):
+ (RegExpObjectImp::getOwnPropertySlot):
+ * kjs/regexp_object.h:
+ * kjs/string_object.cpp:
+ (StringInstanceImp::lengthGetter):
+ (StringInstanceImp::indexGetter):
+ (StringInstanceImp::getOwnPropertySlot):
+ (StringPrototypeImp::getOwnPropertySlot):
+ * kjs/string_object.h:
+
+2005-08-05 Adele Peterson <adele@apple.com>
+
+ Reviewed by Darin.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj: Unchecked 'statics are thread safe' option.
+
+2005-08-05 Geoffrey Garen <ggaren@apple.com>
+
+ -fixed <rdar://problem/4207220> REGRESSION (DENVER): Crash occurs
+ after clicking on Hangman applet
+
+ Reviewed by darin.
+
+ * kjs/object.cpp:
+ (KJS::ObjectImp::hasProperty): added check for null prototype.
+
+ FIXME: The long-term plan is to make runtime objects use JS Null()
+ instead of null pointers, which will allow us to eliminate null
+ checks, improving performance.
+
+2005-08-05 Geoffrey Garen <ggaren@apple.com>
+
+ Fix by darin, reviewed by me.
+
+ - rolled in fix for: <rdar://problem/4161606> JavaScript regular
+ expressions with certain ranges of Unicode characters cause a crash
+
+ Test cases added:
+
+ * layout-tests/fast/js/regexp-big-unicode-ranges-expected.txt: Added.
+ * layout-tests/fast/js/regexp-big-unicode-ranges.html: Added.
+
+ * pcre/pcre.c:
+ (compile_branch): added checks for characters > 255
+
+2005-08-04 Maciej Stachowiak <mjs@apple.com>
+
+ - updated expected test results now that we no longer exlude the
+ date tests (apparently this was overlooked)
+
+ * tests/mozilla/expected.html:
+
+2005-07-31 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - remove uses of Mac-OS-X-specific MAX macro
+ - remove one of the many excess "APPLE_CHANGES" ifdefs
+
+ * kjs/collector.cpp: (KJS::Collector::allocate): Use std::max instead of MAX.
+ * kjs/property_map.cpp: (KJS::PropertyMap::rehash): Ditto.
+ * kjs/ustring.cpp:
+ (KJS::UChar::toLower): Take out non-ICU code path.
+ (KJS::UChar::toUpper): Ditto.
+ (KJS::UString::spliceSubstringsWithSeparators): Use std::max instead of MAX.
+
+2005-07-27 Geoffrey Garen <ggaren@apple.com>
+
+ - fixed http://bugs.webkit.org/show_bug.cgi?id=4147
+ Array.toString() and toLocaleString() improvements from KDE KJS
+ (rolled in KDE changes)
+
+ Test cases added:
+
+ * layout-tests/fast/js/toString-overrides-expected.txt: Added.
+ * layout-tests/fast/js/toString-overrides.html: Added.
+
+ * kjs/array_object.cpp:
+ (ArrayProtoFuncImp::call):
+
+2005-07-27 Maciej Stachowiak <mjs@apple.com>
+
+ Changes by Michael Kahl, reviewed by me.
+
+ - fixed <rdar://problem/4194278> Need better debugging support in JavaScriptCore
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * kjs/debugger.cpp:
+ (KJS::AttachedInterpreter::AttachedInterpreter):
+ (KJS::AttachedInterpreter::~AttachedInterpreter):
+ (Debugger::~Debugger):
+ (Debugger::attach):
+ (Debugger::detach):
+ (Debugger::sourceParsed):
+ * kjs/debugger.h:
+ * kjs/function.cpp:
+ (KJS::FunctionImp::call):
+ (KJS::GlobalFuncImp::call):
+ * kjs/function_object.cpp:
+ (FunctionObjectImp::construct):
+ * kjs/grammar.y:
+ * kjs/internal.cpp:
+ (Parser::parse):
+ (InterpreterImp::evaluate):
+ * kjs/internal.h:
+ (KJS::InterpreterImp::setDebugger):
+ * kjs/interpreter.cpp:
+ * kjs/interpreter.h:
+ (KJS::Interpreter::imp):
+ * kjs/nodes.cpp:
+
+2005-07-27 Geoffrey Garen <ggaren@apple.com>
+
+ - fixed http://bugs.webkit.org/show_bug.cgi?id=3381
+ Date.prototype.setDate() incorrect for values >=128
+
+ - Test cases added:
+
+ * layout-tests/fast/js/date-big-setdate-expected.txt: Added.
+ * layout-tests/fast/js/date-big-setdate.html: Added.
+
+ Reviewed by darin.
+
+ * kjs/date_object.cpp:
+ (DateProtoFuncImp::call):
+
+2005-07-27 Geoffrey Garen <ggaren@apple.com>
+
+ -rolled in patch by Carsten Guenther <cguenther@gmail.com>
+ for http://bugs.webkit.org/show_bug.cgi?id=3759
+ Date object enhancements
+
+ Test cases added:
+
+ * layout-tests/fast/js/date-preserve-milliseconds-expected.txt: Added.
+ * layout-tests/fast/js/date-preserve-milliseconds.html: Added.
+
+ Reviewed by darin.
+
+ * kjs/date_object.cpp:
+ (timeFromArgs):
+ (DateProtoFuncImp::call):
+ (DateObjectImp::construct):
+ (DateObjectFuncImp::call):
+ (KJS::makeTime):
+ * kjs/date_object.h:
+ * tests/mozilla/expected.html:
+
+2005-07-26 Justin Garcia <justin.garcia@apple.com>
+
+ Added a forward declaration to fix gcc4 build error
+
+ * kjs/function.h:
+
+2005-07-25 Geoffrey Garen <ggaren@apple.com>
+ - fixed mistake in my last checkin -- the expected results included
+ results from a patch that hasn't landed yet.
+
+ * tests/mozilla/expected.html:
+
+2005-07-25 Maciej Stachowiak <mjs@apple.com>
+
+ - fix mistake in last change that leads to assertion failure in the Development build
+
+ * kjs/lookup.h:
+ (KJS::lookupGetOwnValue):
+
+2005-07-24 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin.
+
+ - http://bugs.webkit.org/show_bug.cgi?id=4124
+ (change JavaScript property access to avoid double lookup)
+
+ - 10% speedup on JavaScript iBench
+ - 5% speedup on 24fun BenchJS benchmark
+
+ Changed all get methods to getOwnProperty - they are no longer
+ responsible for prototype lookup, and determine if the property
+ was found as a side efect.
+
+ get() is now a nonvirtual ObjectImp method which calls the virtual
+ getOwnProperty and walks the prototype chain. A few selected
+ methods were inlined.
+
+ Changed ResolveNode::evaluate plus some other places to use
+ getProperty which does get() and hasProperty() in one lookup.
+
+ Also miscellaneous code cleanup.
+
+ * bindings/objc/objc_runtime.h:
+ * bindings/objc/objc_runtime.mm:
+ (ObjcFallbackObjectImp::ObjcFallbackObjectImp):
+ (ObjcFallbackObjectImp::getOwnProperty):
+ * bindings/runtime_array.cpp:
+ (RuntimeArrayImp::RuntimeArrayImp):
+ (RuntimeArrayImp::getOwnProperty):
+ * bindings/runtime_array.h:
+ * bindings/runtime_method.cpp:
+ (RuntimeMethodImp::getOwnProperty):
+ * bindings/runtime_method.h:
+ * bindings/runtime_object.cpp:
+ (RuntimeObjectImp::getOwnProperty):
+ * bindings/runtime_object.h:
+ * kjs/array_instance.h:
+ * kjs/array_object.cpp:
+ (ArrayInstanceImp::getOwnProperty):
+ (ArrayPrototypeImp::getOwnProperty):
+ (ArrayProtoFuncImp::call):
+ * kjs/array_object.h:
+ * kjs/date_object.cpp:
+ (DatePrototypeImp::getOwnProperty):
+ * kjs/date_object.h:
+ * kjs/function.cpp:
+ (KJS::FunctionImp::getOwnProperty):
+ (KJS::ArgumentsImp::getOwnProperty):
+ (KJS::ActivationImp::getOwnProperty):
+ * kjs/function.h:
+ * kjs/lookup.h:
+ (KJS::lookupGetOwnProperty):
+ (KJS::lookupGetOwnFunction):
+ (KJS::lookupGetOwnValue):
+ * kjs/math_object.cpp:
+ (MathObjectImp::getOwnProperty):
+ (MathObjectImp::getValueProperty):
+ * kjs/math_object.h:
+ * kjs/nodes.cpp:
+ (ResolveNode::evaluate):
+ * kjs/number_object.cpp:
+ (NumberObjectImp::getOwnProperty):
+ * kjs/number_object.h:
+ * kjs/object.cpp:
+ (KJS::ObjectImp::get):
+ (KJS::ObjectImp::getOwnProperty):
+ (KJS::ObjectImp::getProperty):
+ * kjs/object.h:
+ (KJS::ObjectImp::getProperty):
+ (KJS::ObjectImp::getOwnProperty):
+ * kjs/object_object.cpp:
+ (ObjectProtoFuncImp::call):
+ * kjs/regexp_object.cpp:
+ (RegExpObjectImp::getOwnProperty):
+ * kjs/regexp_object.h:
+ * kjs/string_object.cpp:
+ (StringInstanceImp::getOwnProperty):
+ (StringPrototypeImp::getOwnProperty):
+ * kjs/string_object.h:
+
+2005-07-25 Geoffrey Garen <ggaren@apple.com>
+
+ - fixed http://bugs.webkit.org/show_bug.cgi?id=3971
+ JS test suite depends on JS 1.2 behavior
+
+ Reviewed by darin.
+
+ * tests/mozilla/js1_2/Array/tostring_1.js: now tests only for JS 1.5 behavior
+ * tests/mozilla/js1_2/Array/tostring_2.js: ditto
+ * tests/mozilla/expected.html:
+
+2005-07-24 Justin Garcia <justin.garcia@apple.com>
+
+ Reviewed by kevin.
+
+ Fixes make clean problem introduced in xcode2.1 transition
+
+ * Makefile.am:
+
+2005-07-22 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by darin.
+
+ * kjs/date_object.cpp: DatePrototypeImp now identifies itself as a
+ child class of DateInstanceImp -- this enables calls to Date.ValueOf().
+
+ fixes: ecma/Date/15.9.5.js (once we enable the date tests).
+
+2005-07-22 Geoffrey Garen <ggaren@apple.com>
+
+
+ Reviewed by darin.
+
+ * tests/mozilla/jsDriver.pl: now takes the path to testkjs as a command-line argument
+ * tests/mozilla/run-mozilla-tests: Removed.
+
+2005-07-21 Geoffrey Garen <ggaren@apple.com>
+
+ * JavaScriptCore.xcodeproj/.cvsignore: Added.
+
+2005-07-21 Geoffrey Garen <ggaren@apple.com>
+
+ * JavaScriptCore.pbproj/project.pbxproj: Removed.
+ * JavaScriptCore.xcodeproj/ggaren.pbxuser: Added.
+ * JavaScriptCore.xcodeproj/ggaren.perspective: Added.
+ * JavaScriptCore.xcodeproj/project.pbxproj: Added.
+ * Makefile.am:
+
+2005-07-20 Maciej Stachowiak <mjs@apple.com>
+
+ Patch from Trey Matteson <trey@usa.net>, reviewed by me.
+
+ - fixed http://bugs.webkit.org/show_bug.cgi?id=3956
+ some of WebKit builds with symbols, some doesn't
+
+ * JavaScriptCore.pbproj/project.pbxproj: Generate symbols even for
+ Deployment.
+
+2005-07-19 Geoffrey Garen <ggaren@apple.com>
+
+ -fixed http://bugs.webkit.org/show_bug.cgi?id=3991
+ JSC doesn't implement Array.prototype.toLocaleString()
+
+ -test failure: ecma_3/Array/15.4.4.3-1.js
+
+ Reviewed by mjs.
+
+ * kjs/array_object.cpp:
+ (ArrayProtoFuncImp::call): now searches for toString and
+ toLocaleString overrides in the array's elements
+
+ * tests/mozilla/expected.html: failures are under 100! woohoo!
+
+2005-07-19 Darin Adler <darin@apple.com>
+
+ - fixed the build
+
+ * kjs/lookup.h: (KJS::lookupPut): Remove bogus const; was preventing WebCore from
+ compiling (not sure why this didn't affect my other build machine).
+
+ - one other tiny tweak (so sue me)
+
+ * bindings/runtime_root.cpp: Remove unneeded declaration.
+
+2005-07-19 Darin Adler <darin@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ - eliminated try wrappers for get/put/call since we don't use C++ exceptions any more
+
+ * kjs/lookup.h: Changed tryCall in IMPLEMENT_PROTOFUNC here to call. It doesn't make
+ sense for this macro to use the name tryCall anyway, since that's specific to how
+ WebCore used this, so this is good anyway. On the other hand, it might be a problem
+ for KDOM or KSVG, in which case we'll need another macro for them, since JavaScriptCore
+ should presumably not have the C++ exception support.
+
+2005-07-18 Geoffrey Garen <ggaren@apple.com>
+
+ -fixed http://bugs.webkit.org/show_bug.cgi?id=4008
+ Error objects report incorrect length
+
+ Reviewed by darin.
+
+ * kjs/error_object.cpp: Error objects now include a length property
+ (ErrorObjectImp::ErrorObjectImp):
+
+ * tests/mozilla/expected.html: updated expected results to reflect fix
+ * tests/mozilla/js1_5/Exceptions/regress-123002.js: test now expects
+ ecma compliant results
+
+2005-07-15 Geoffrey Garen <ggaren@apple.com>
+
+ -rolled in KDE fixes for http://bugs.webkit.org/show_bug.cgi?id=3601
+ Error instance type info
+
+ Reviewed by mjs.
+
+ * kjs/error_object.cpp:
+ - Created ErrorInstanceImp class for Error() objects.
+ - Changed parent object for Native Errors to "Function" (matches
+ ECMA spec).
+ (ErrorInstanceImp::ErrorInstanceImp):
+ (ErrorProtoFuncImp::call):
+ (ErrorObjectImp::construct):
+ (NativeErrorImp::construct):
+
+ * kjs/error_object.h:
+ (KJS::ErrorInstanceImp::classInfo):
+ * kjs/object.h: made comment more informative about ClassInfo
+
+ * tests/mozilla/expected.html:
+
+2005-07-14 Geoffrey Garen <ggaren@apple.com>
+
+ - fixed: JS test suite expects an out of memory error
+ that our memory efficiency avoids
+
+ Reviewed by mjs.
+
+ * tests/mozilla/js1_5/Array/regress-157652.js:
+ test now expects normal execution
+
+ * tests/mozilla/expected.html:
+
+2005-07-14 Geoffrey Garen <ggaren@apple.com>
+ - fixed http://bugs.webkit.org/show_bug.cgi?id=4006
+ testkjs doesn't implement gc()
+
+ - test failure:
+ ecma_3/Function/regress-104584.js
+
+ Reviewed by mjs.
+
+ * kjs/interpreter.cpp:
+ (Interpreter::finalCheck): removed misleading while && comment
+
+ * kjs/testkjs.cpp: added "gc" function to global object
+ (TestFunctionImp::):
+ (TestFunctionImp::call):
+ (main):
+
+ * tests/mozilla/expected.html:
+
+2005-07-14 Geoffrey Garen <ggaren@apple.com>
+
+ -rolled in patches for http://bugs.webkit.org/show_bug.cgi?id=3945
+ [PATCH] Safe merges of comments and other trivialities from KDE's kjs
+
+ -patch by Martijn Klingens <klingens@kde.org>
+
+ * kjs/array_instance.h:
+ * kjs/array_object.cpp:
+ * kjs/array_object.h:
+ * kjs/bool_object.cpp:
+ * kjs/bool_object.h:
+ * kjs/collector.cpp:
+ * kjs/collector.h:
+ * kjs/completion.h:
+ * kjs/context.h:
+ * kjs/date_object.cpp:
+ * kjs/date_object.h:
+ * kjs/debugger.cpp:
+ * kjs/debugger.h:
+ * kjs/dtoa.h:
+ * kjs/error_object.cpp:
+ * kjs/error_object.h:
+ * kjs/function.cpp:
+ * kjs/function.h:
+ * kjs/function_object.cpp:
+ * kjs/function_object.h:
+ * kjs/grammar.y:
+ * kjs/identifier.cpp:
+ * kjs/identifier.h:
+ * kjs/internal.cpp:
+ * kjs/internal.h:
+ * kjs/interpreter.cpp:
+ * kjs/interpreter.h:
+ * kjs/interpreter_map.cpp:
+ * kjs/interpreter_map.h:
+ * kjs/lexer.cpp:
+ * kjs/lexer.h:
+ * kjs/list.cpp:
+ * kjs/list.h:
+ * kjs/lookup.cpp:
+ * kjs/lookup.h:
+ * kjs/math_object.cpp:
+ * kjs/math_object.h:
+ * kjs/nodes.cpp:
+ * kjs/nodes.h:
+ * kjs/nodes2string.cpp:
+ * kjs/number_object.cpp:
+ * kjs/number_object.h:
+ * kjs/object.cpp:
+ * kjs/object.h:
+ * kjs/object_object.cpp:
+ * kjs/object_object.h:
+ * kjs/operations.cpp:
+ * kjs/operations.h:
+ * kjs/property_map.cpp:
+ * kjs/property_map.h:
+ * kjs/reference.cpp:
+ * kjs/reference.h:
+ * kjs/reference_list.cpp:
+ * kjs/reference_list.h:
+ * kjs/regexp.cpp:
+ * kjs/regexp.h:
+ * kjs/regexp_object.cpp:
+ * kjs/regexp_object.h:
+ * kjs/scope_chain.cpp:
+ * kjs/scope_chain.h:
+ * kjs/simple_number.h:
+ * kjs/string_object.cpp:
+ * kjs/string_object.h:
+ * kjs/testkjs.cpp:
+ * kjs/types.h:
+ * kjs/ustring.cpp:
+ * kjs/ustring.h:
+ * kjs/value.cpp:
+ * kjs/value.h:
+
+2005-07-14 Geoffrey Garen <ggaren@apple.com>
+
+ -fixed http://bugs.webkit.org/show_bug.cgi?id=3970
+ throw statements fail inside eval statements
+
+ Reviewed by mjs.
+
+ * kjs/function.cpp:
+ (KJS::GlobalFuncImp::call):
+ Big change since I fixed the tabbing. The important part is:
+ if (c.complType() == Throw)
+ exec->setException(c.value());
+
+ * kjs/nodes.cpp:
+ (ThrowNode::execute): removed duplicate KJS_CHECKEXCEPTION
+ (TryNode::execute):
+ try now clears the exception state before the finally block executes,
+ and checks the state after the block executes, so that exceptions in
+ finally code get caught.
+
+ * tests/mozilla/expected.html:
+
+2005-07-14 Geoffrey Garen <ggaren@apple.com>
+
+ -landed fix for http://bugs.webkit.org/show_bug.cgi?id=3412
+ Object.prototype is missing toLocaleString
+
+ - patch by Mark Rowe (bdash) <opendarwin.org@bdash.net.nz>
+
+ -layout test info in webcore changelog
+
+ Reviewed by mjs.
+
+ * kjs/object_object.cpp:
+ (ObjectPrototypeImp::ObjectPrototypeImp):
+ (ObjectProtoFuncImp::call):
+ * kjs/object_object.h:
+ (KJS::ObjectProtoFuncImp::):
+
+2005-07-12 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by mjs.
+
+ * kjs/function.cpp:
+ (KJS::IndexToNameMap::operator[]): fixed infinite recursion
+ bug in last checkin
+
+2005-07-12 Geoffrey Garen <ggaren@apple.com>
+
+ -fixed http://bugs.webkit.org/show_bug.cgi?id=3881
+ arguments object should share values with function parameters
+
+ Reviewed by mjs.
+
+ ArgumentsImp now uses a simple hash lookup to share values
+ with the activation object.
+
+ * kjs/function.cpp:
+ (KJS::FunctionImp::getParameterName):
+ (KJS::IndexToNameMap::IndexToNameMap):
+ (KJS::IndexToNameMap::~IndexToNameMap):
+ (KJS::IndexToNameMap::isMapped):
+ (KJS::IndexToNameMap::unMap):
+ (KJS::IndexToNameMap::operator[]):
+ (KJS::ArgumentsImp::ArgumentsImp):
+ (KJS::ArgumentsImp::mark):
+ (KJS::ArgumentsImp::get):
+ (KJS::ArgumentsImp::put):
+ (KJS::ArgumentsImp::deleteProperty):
+ (KJS::ArgumentsImp::hasOwnProperty):
+ (KJS::ActivationImp::createArgumentsObject):
+ * kjs/function.h:
+ * tests/mozilla/expected.html: updated results
+
+2005-07-09 Maciej Stachowiak <mjs@apple.com>
+
+ - backing out my earlier collector change, it causes a performance regression in TOT
+
+ * kjs/collector.cpp:
+ (KJS::Collector::allocate):
+
+2005-07-08 Eric Seidel <eseidel@apple.com>
+
+ Reviewed by mjs/hyatt (only in concept).
+
+ * JavaScriptCore.pbproj/project.pbxproj: Added JavaScriptCore+SVG
+ Turns on RTTI support for JavaScriptCore.framework when
+ building the JavaScriptCore+SVG target. This is needed as
+ kdom (part of WebCore+SVG) requires RTTI for the time being.
+
+2005-07-08 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by hyatt.
+
+ - When there are many live objects, GC less often, to try to make
+ GC cost proportional to garbage, not proportional to total memory used.
+
+ * kjs/collector.cpp:
+ (KJS::Collector::allocate):
+
+2005-07-08 Vicki Murley <vicki@apple.com>
+
+ Fix from Carsten Guenther, reviewed by Maciej
+
+ - fixed http://bugs.webkit.org/show_bug.cgi?id=3644 (Error string representation)
+
+ Switch from "-" to ":" in error strings.
+
+ * kjs/error_object.cpp:
+ (ErrorProtoFuncImp::call):
+ * tests/mozilla/expected.html:
+
+2005-07-08 Geoffrey Garen <ggaren@apple.com>
+
+ -rolled in patch for http://bugs.webkit.org/show_bug.cgi?id=3878
+ arguments object should be an object not an array
+
+ Reviewed by mjs.
+
+ * kjs/function.cpp:
+ (KJS::ArgumentsImp::ArgumentsImp): now manually handles initialization
+ we used to get for free by inheriting from ArrayInstanceImp
+ * kjs/function.h: ArgumentsImp now inherits from ObjectImp
+ * tests/mozilla/expected.html: updated expected test results
+
+2005-07-07 Eric Seidel <eseidel@apple.com>
+
+ Reviewed by mjs.
+
+ * kjs/grammar.y: removed #define YYMAXDEPTH 0 for bison 2.0
+ http://bugs.webkit.org/show_bug.cgi?id=3882
+
+2005-07-03 Maciej Stachowiak <mjs@apple.com>
+
+ Original patch from Mark Rowe <opendarwin.org@bdash.net.nz>, reviewed by me.
+ Fixes to patch by me, reviewed by John Sullivan.
+
+ - fixed http://bugs.webkit.org/show_bug.cgi?id=3293
+
+ Test cases added:
+ * tests/mozilla/expected.html: Two tests newly pass.
+
+ * bindings/objc/objc_runtime.h:
+ * bindings/objc/objc_runtime.mm:
+ (ObjcFallbackObjectImp::hasOwnProperty):
+ * bindings/runtime_array.cpp:
+ (RuntimeArrayImp::hasOwnProperty):
+ * bindings/runtime_array.h:
+ * bindings/runtime_object.cpp:
+ (RuntimeObjectImp::hasOwnProperty):
+ * bindings/runtime_object.h:
+ * kjs/array_instance.h:
+ * kjs/array_object.cpp:
+ (ArrayInstanceImp::hasOwnProperty):
+ * kjs/function.cpp:
+ (KJS::FunctionImp::hasOwnProperty):
+ (KJS::ActivationImp::hasOwnProperty):
+ * kjs/function.h:
+ * kjs/lookup.h:
+ * kjs/object.cpp:
+ (KJS::ObjectImp::hasProperty):
+ (KJS::ObjectImp::hasOwnProperty):
+ * kjs/object.h:
+ (KJS::Object::hasOwnProperty):
+ * kjs/object_object.cpp:
+ (ObjectPrototypeImp::ObjectPrototypeImp):
+ (ObjectProtoFuncImp::call):
+ * kjs/object_object.h:
+ (KJS::ObjectProtoFuncImp::):
+ * kjs/string_object.cpp:
+ (StringInstanceImp::hasOwnProperty):
+ * kjs/string_object.h:
+
+2005-07-01 Geoffrey Garen <ggaren@apple.com>
+
+ -landed patch by Eric Seidel <macdome@opendarwin.org>
+
+ -for http://bugs.webkit.org/show_bug.cgi?id=3657
+ GroundWork: Moving some functions from khtml->jsc following kjs TOT
+
+ - no layout test necessary yet - only groundwork
+
+ Reviewed by darin.
+
+ * kjs/lookup.h:
+ (KJS::cacheGlobalObject):
+
+2005-07-01 Geoffrey Garen <ggaren@apple.com>
+
+ -landed patch by Carsten Guenther <cguenther@gmail.com>
+
+ -fixes http://bugs.webkit.org/show_bug.cgi?id=3477
+ some US-centric date formats not parsed by JavaScript (clock at news8austin.com)
+
+ -relevant tests:
+ mozilla/ecma_3/Date/15.9.5.5.js
+ layout-tests/fast/js/date-parse-test.html
+
+ Reviewed by darin.
+
+ * kjs/date_object.cpp:
+ (formatLocaleDate):
+ (day):
+ (dayFromYear):
+ (daysInYear):
+ (timeFromYear):
+ (yearFromTime):
+ (weekDay):
+ (timeZoneOffset):
+ (DateProtoFuncImp::call):
+ (DateObjectImp::construct):
+ (KJS::parseDate):
+ (ymdhms_to_seconds):
+ (KJS::makeTime):
+ (findMonth):
+ (KJS::KRFCDate_parseDate):
+ * kjs/date_object.h:
+ * tests/mozilla/expected.html: updated expected results to reflect fix
+
+2005-07-01 Geoffrey Garen <ggaren@apple.com>
+
+ -fixed <rdar://problem/4168186> JavaScript fails to throw exceptions
+ for invalid return statements
+
+ relevant tests:
+ ecma/Statements/12.9-1-n.js
+ ecma_2/Exceptions/lexical-052.js
+ ecma_2/Exceptions/statement-009.js
+
+ Reviewed by sullivan.
+
+ * kjs/nodes.cpp:
+ (ReturnNode::execute): now throws exception if return is not inside
+ a function.
+
+ * tests/mozilla/expected.html: updated to reflect fix
+
+2005-07-01 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by sullivan.
+
+ * tests/mozilla/expected.html: Updated test results for last fix.
+
+2005-07-01 Geoffrey Garen <ggaren@apple.com>
+
+ -fixed <rdar://problem/4168161> JavaScript fails to throw an exception
+ for invalid function calls
+
+ Reviewed by sullivan.
+
+ Relevant mozilla test: ecma_3/Exceptions/regress-95101.js
+
+ * kjs/nodes.cpp:
+ (FunctionCallNode::evaluate): evaluate now checks for an exception
+ after resolving a function name (in case the function is undefined)
+
+2005-07-01 Eric Seidel <eseidel@apple.com>
+
+ Reviewed by darin.
+
+ * kjs/interpreter.h:
+ (KJS::Context::curStmtFirstLine): stub for compatibility with KDE
+ * kjs/value.h:
+ (KJS::Value::isValid): compatibility with KDE
+ http://bugs.webkit.org/show_bug.cgi?id=3687
+
+2005-07-01 Eric Seidel <eseidel@apple.com>
+
+ Reviewed by darin.
+
+ * kjs/create_hash_table: rolled in changes from KDE, including
+ -n <namespace> support from KDOM and support for newer comments
+ http://bugs.webkit.org/show_bug.cgi?id=3771
+
+2005-06-30 Geoffrey Garen <ggaren@apple.com>
+
+ -rolled in KDE fix to <rdar://problem/4167660> JavaScript fails to
+ throw exceptions for invalid break/continue statements
+
+ No layout tests because it's already covered by the Mozilla suite
+
+ Reviewed by mjs.
+
+ * kjs/internal.h: LabelStack now tracks where you are relative to
+ switch and iteration (loop) statements
+
+ (KJS::LabelStack::LabelStack):
+ (KJS::LabelStack::pushIteration):
+ (KJS::LabelStack::popIteration):
+ (KJS::LabelStack::inIteration):
+ (KJS::LabelStack::pushSwitch):
+ (KJS::LabelStack::popSwitch):
+ (KJS::LabelStack::inSwitch):
+
+ * kjs/nodes.cpp:
+ These files were updated to use the new LabelStack:
+ (DoWhileNode::execute):
+ (WhileNode::execute):
+ (ForNode::execute):
+ (ForInNode::execute):
+ (SwitchNode::execute):
+
+ These files were updated to throw exceptions for invalid
+ break/continue statements:
+ (BreakNode::execute):
+ (ContinueNode::execute):
+
+ * tests/mozilla/expected.html: Updated expected results to reflect fix
+
+2005-06-30 Kevin Decker <kdecker@apple.com>
+
+ Reviewed by rjw.
+
+ fixed: <rdar://problem/4166838> failed assertion in`Interpreter::lockCount() > 0
+
+ no layout test added; this is in the bindings code.
+
+ * bindings/objc/WebScriptObject.mm:
+ (+[WebScriptObject _convertValueToObjcValue:KJS::originExecutionContext:Bindings::executionContext:Bindings::]): make sure to lock and unlock the interpreter around allocations.
+
+2005-06-29 Geoffrey Garen <ggaren@apple.com>
+
+ Patch by Francisco Tolmasky <tolmasky@gmail.com>
+
+ - fixes http://bugs.webkit.org/show_bug.cgi?id=3667
+ Core JavaScript 1.5 Reference:Objects:Array:forEach
+
+ See WebCore Changelog for layout tests added.
+
+ Reviewed by darin.
+
+ * kjs/array_object.cpp:
+ (ArrayProtoFuncImp::call):
+ * kjs/array_object.h:
+ (KJS::ArrayProtoFuncImp::):
+
+2005-06-29 Geoffrey Garen <ggaren@apple.com>
+
+ Patch contributed by Oliver Hunt <ojh16@student.canterbury.ac.nz>
+
+ -fixed http://bugs.webkit.org/show_bug.cgi?id=3743
+ Incorrect error message given for certain calls
+
+ See WebCore Changelog for layout test added.
+
+ Reviewed by mjs.
+
+ * kjs/object.cpp:
+ (KJS::ObjectImp::defaultValue):
+
+2005-06-29 Geoffrey Garen <ggaren@apple.com>
+
+ Rolling out date patch from 6-28-05 because it breaks
+ fast/js/date-parse-test
+
+ * kjs/date_object.cpp:
+ (formatLocaleDate):
+ (DateProtoFuncImp::call):
+ (DateObjectImp::construct):
+ (KJS::parseDate):
+ (ymdhms_to_seconds):
+ (isSpaceOrTab):
+ (KJS::KRFCDate_parseDate):
+ * kjs/date_object.h:
+ * tests/mozilla/expected.html:
+
+2005-06-29 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin.
+
+ -fixes http://bugs.webkit.org/show_bug.cgi?id=3750
+ build fails with KJS_VERBOSE set
+
+ * kjs/nodes.cpp: changed debug print statement to use UString
+ (VarDeclNode::evaluate):
+ * kjs/reference.cpp: ditto
+ (KJS::Reference::putValue):
+
+2005-06-28 Geoffrey Garen <ggaren@apple.com>
+
+ Patch contributed by Carsten Guenther <cguenther@gmail.com>.
+
+ -fixes http://bugs.webkit.org/show_bug.cgi?id=3477
+ some US-centric date formats not parsed by JavaScript (clock at news8austin.com)
+
+ Reviewed by darin.
+
+ * kjs/date_object.cpp:
+ (formatLocaleDate):
+ (day):
+ (dayFromYear):
+ (daysInYear):
+ (timeFromYear):
+ (yearFromTime):
+ (weekDay):
+ (timeZoneOffset):
+ (DateProtoFuncImp::call):
+ (DateObjectImp::construct):
+ (KJS::parseDate):
+ (ymdhms_to_seconds):
+ (KJS::makeTime):
+ (findMonth):
+ (KJS::KRFCDate_parseDate):
+ * kjs/date_object.h:
+ * tests/mozilla/expected.html: updated expected test results to reflect fix
+
+2005-06-26 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin.
+
+ - replace hash functions with better ones
+
+ * JavaScriptCore.pbproj/project.pbxproj: Add new file to build.
+ * kjs/interpreter_map.cpp:
+ (KJS::InterpreterMap::computeHash): Use shared pointer hash.
+ * kjs/pointer_hash.h: Added.
+ (KJS::pointerHash): Pointer hash based on 32-bit mix and 64-bit mix hashes.
+ * kjs/protected_values.cpp:
+ (KJS::ProtectedValues::computeHash): Use shared pointer hash.
+ * kjs/ustring.cpp:
+ (KJS::UString::Rep::computeHash): Use SuperFastHash algorithm.
+
+2005-06-22 Darin Adler <darin@apple.com>
+
+ Change by Anders Carlsson.
+ Reviewed by me.
+
+ - fixed <http://bugs.webkit.org/show_bug.cgi?id=3294>
+ String.prototype.replace() fails with function as second param
+
+ * kjs/string_object.cpp: (replace): Added code to handle functions.
+
+ * tests/mozilla/expected.html: Updated since ecma_3/RegExp/regress-209067.js is fixed now.
+
+ * tests/mozilla/run-mozilla-tests: Fix a minor coding style issue that leads to a warning each
+ time we run the tests.
+
+2005-06-21 Adele Peterson <adele@apple.com>
+
+ rolling out fix for http://bugs.webkit.org/show_bug.cgi?id=3293, since it caused layout test failures.
+ fast/forms/element-by-name
+ fast/loader/loadInProgress
+
+ * ChangeLog:
+ * bindings/objc/objc_runtime.h:
+ * bindings/objc/objc_runtime.mm:
+ (ObjcFallbackObjectImp::hasProperty):
+ * bindings/runtime_array.cpp:
+ (RuntimeArrayImp::hasProperty):
+ * bindings/runtime_array.h:
+ * bindings/runtime_object.cpp:
+ (RuntimeObjectImp::hasProperty):
+ * bindings/runtime_object.h:
+ * kjs/array_instance.h:
+ * kjs/array_object.cpp:
+ (ArrayInstanceImp::hasProperty):
+ * kjs/function.cpp:
+ (KJS::FunctionImp::hasProperty):
+ (KJS::ActivationImp::hasProperty):
+ * kjs/function.h:
+ * kjs/object.cpp:
+ (KJS::ObjectImp::hasProperty):
+ * kjs/object.h:
+ * kjs/object_object.cpp:
+ (ObjectPrototypeImp::ObjectPrototypeImp):
+ (ObjectProtoFuncImp::call):
+ * kjs/object_object.h:
+ (KJS::ObjectProtoFuncImp::):
+ * kjs/string_object.cpp:
+ (StringInstanceImp::hasProperty):
+ * kjs/string_object.h:
+ * tests/mozilla/expected.html:
+
+2005-06-21 Darin Adler <darin@apple.com>
+
+ * JavaScriptCore.pbproj/project.pbxproj: Switched to a build rule rather than a build phase for
+ .y files -- this gets rid of the problem where modifying the .y file would not cause sufficient
+ compilation.
+
+ * kjs/grammar_wrapper.cpp: Removed.
+
+2005-06-21 Adele Peterson <adele@apple.com>
+
+ Patch from Anders Carlsson <andersca@mac.com>, reviewed by Darin.
+
+ Fixed: <http://bugs.webkit.org/show_bug.cgi?id=3450>
+ <rdar://problem/3881901> String.replace() method not working when regex pattern contains {n, m}
+
+ * pcre/pcre.c: (pcre_compile): Remember the last char length so it can be subtracted correctly if needed.
+
+2005-06-21 Geoffrey Garen <ggaren@apple.com>
+
+ - fixed <rdar://problem/4155532> 'delete' succeeds on functions
+ - fixed <rdar://problem/4155049> javascript function named as "opener" doesn't get called because of window.opener property
+
+ Reviewed by cblu.
+
+ * kjs/nodes.cpp:
+ (FuncDeclNode::processFuncDecl): Functions now have DontDelete and Internal attributes set when appropriate.
+
+ Test cases:
+ * tests/mozilla/expected.html: Updated for one new success.
+ - see also test case added in WebCore.
+
+2005-06-20 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin(first pass) and Hyatt.
+
+ - fixed http://bugs.webkit.org/show_bug.cgi?id=3576
+ (roll in support for "const" keyword from KDE tree)
+ - make processVarDecls handle deletability of variables declared
+ in an eval block the same as evaluate would
+ - make eval() call processVarDecls - needed to match mozilla and
+ to make the second change testable
+
+ I started with the KDE implementation of const but I ended up changing it a bit
+ to avoid the use of a global variable. Now instead of the global variable it distinguishes
+ const and var at the grammar level so the appropriate node can know the right kind of
+ declaration.
+
+ Test cases:
+ * tests/mozilla/expected.html: Updated for one new test that is
+ failing - we used to bail on it entirely because it checks for
+ const support before starting.
+ - see also test cases added in WebCore
+
+ * kjs/grammar.y: Add rules for const declarations.
+ * kjs/keywords.table: Add const keyword.
+ * kjs/nodes.cpp:
+ (VarDeclNode::VarDeclNode): Add parameter.
+ (VarDeclNode::evaluate): Add const support.
+ (VarDeclNode::processVarDecls): Add const support.
+ (VarStatementNode::execute): Irrelevant change.
+ (ForInNode::ForInNode): Tell our variable node that it's a variable.
+ * kjs/nodes.h:
+ (KJS::VarDeclNode::): Add declaration of type enum, extra constructor parameter.
+ (KJS::VarStatementNode::VarStatementNode): Irrelevant change.
+ * kjs/function.cpp:
+ (KJS::GlobalFuncImp::call): Process var decls before evaluating.
+
+2005-06-20 Maciej Stachowiak <mjs@apple.com>
+
+ Patch from Mark Rowe <opendarwin.org@bdash.net.nz>, reviewed by me.
+
+ - fixed http://bugs.webkit.org/show_bug.cgi?id=3293
+
+ Test cases added:
+ * tests/mozilla/expected.html: Updated for two fixed tests.
+ - also added a layout test
+
+ * bindings/objc/objc_runtime.h:
+ * bindings/objc/objc_runtime.mm:
+ (ObjcFallbackObjectImp::hasOwnProperty):
+ * bindings/runtime_array.cpp:
+ (RuntimeArrayImp::hasOwnProperty):
+ * bindings/runtime_array.h:
+ * bindings/runtime_object.cpp:
+ (RuntimeObjectImp::hasOwnProperty):
+ * bindings/runtime_object.h:
+ * kjs/array_instance.h:
+ * kjs/array_object.cpp:
+ (ArrayInstanceImp::hasOwnProperty):
+ * kjs/function.cpp:
+ (KJS::FunctionImp::hasOwnProperty):
+ (KJS::ActivationImp::hasOwnProperty):
+ * kjs/function.h:
+ * kjs/object.cpp:
+ (KJS::ObjectImp::hasProperty):
+ (KJS::ObjectImp::hasOwnProperty):
+ * kjs/object.h:
+ (KJS::Object::hasOwnProperty):
+ * kjs/object_object.cpp:
+ (ObjectPrototypeImp::ObjectPrototypeImp):
+ (ObjectProtoFuncImp::call):
+ * kjs/object_object.h:
+ (KJS::ObjectProtoFuncImp::):
+ * kjs/string_object.cpp:
+ (StringInstanceImp::hasOwnProperty):
+ * kjs/string_object.h:
+
+2005-06-18 Darin Adler <darin@apple.com>
+
+ Reviewed by Eric Seidel.
+
+ * pcre/get.c: (pcre_get_substring): Fix some computations so this works for UTF-16.
+ This is unused in the current JavaScriptCore, but still good to fix.
+
+2005-06-18 Darin Adler <darin@apple.com>
+
+ Change by Finlay Dobbie.
+ Reviewed by me.
+
+ - fixed <http://bugs.webkit.org/show_bug.cgi?id=3331>
+ 10.3.9 Build Failure: NSString may not respond to `+stringWithCString:encoding:'
+
+ * bindings/objc/WebScriptObject.mm: (-[WebScriptObject stringRepresentation]):
+ Undo change we did a while back to work around the gcc 3.3 compiler error.
+ It no longer seems to happen, and the workaround code was 10.4-specific.
+
+2005-06-16 Geoffrey Garen <ggaren@apple.com>
+
+ Fixed: <rdar://problem/4151759> 'delete' fails on variables declared inside 'eval' statements.
+
+ Reviewed by cblu.
+
+ * kjs/context.h:
+ (KJS::ContextImp::codeType): Added code type accessor for execution context objects.
+ * kjs/internal.cpp:
+ (ContextImp::ContextImp): Reflects change to ContextImp::codeType.
+ * kjs/nodes.cpp:
+ (VarDeclNode::evaluate): Added separate code path for variable declarations inside 'eval' statements.
+ * tests/mozilla/expected.html: Updated expected test results to reflect fix.
+
+2005-06-14 Geoffrey Garen <ggaren@apple.com>
+
+ Updated expected.html to reflect fix to <rdar://problem/4147745>.
+
+ Reviewed by cblu.
+
+ * tests/mozilla/expected.html:
+
+2005-06-14 Geoffrey Garen <ggaren@apple.com>
+
+ Fixed: <rdar://problem/4147745> JavaScript discards locally defined "arguments" property
+
+ No layout tests added because this change fixes existing tests:
+ ecma/ExecutionContexts/10.1.6.js
+ ecma_3/Function/regress-94506.js
+ js1_4/Functions/function-001.js
+
+ Reviewed by cblu.
+
+ * kjs/function.cpp:
+ (KJS::ActivationImp::get): get now checks for an "arguments" property defined in the local variable object
+ before trying to return the built-in arguments array.
+
+ * kjs/function.h: ActivationImp::put no longer overrides ObjectImp::put
+
+2005-06-10 Darin Adler <darin@apple.com>
+
+ Change by Mark Rowe <opendarwin.org@bdash.net.nz>.
+ Reviewed by me.
+
+ - further improvements to exception file/line number fix
+
+ * kjs/nodes.h: Added setExceptionDetailsIfNeeded function.
+ * kjs/nodes.cpp: Updated macros to call the new setExceptionDetailsIfNeeded function.
+ (Node::setExceptionDetailsIfNeeded): Added.
+
+2005-06-09 Darin Adler <darin@apple.com>
+
+ Change by Mark Rowe <opendarwin.org@bdash.net.nz>
+ Reviewed by me.
+
+ * kjs/nodes.cpp: Get rid of unneeded this->.
+
+2005-06-08 Maciej Stachowiak <mjs@apple.com>
+
+ Change by Mark Rowe <opendarwin.org@bdash.net.nz>
+ Reviewed by me.
+
+ - fixed http://bugs.webkit.org/show_bug.cgi?id=3327
+ (Exception When Setting Style to Invalid Value Lacks Line/File Information)
+
+ * kjs/nodes.cpp: Include source file and line number when making exception in
+ KJS_CHECKEXCEPTIONVALUE.
+
+2005-06-07 Darin Adler <darin@apple.com>
+
+ Change by Toby Peterson <toby@opendarwin.org>.
+ Reviewed by me.
+
+ * JavaScriptCore.pbproj/project.pbxproj: Allow bison 2.0, which generates the file
+ with a different name.
+
+2005-06-07 Darin Adler <darin@apple.com>
+
+ Change by Toby Peterson <toby@opendarwin.org>.
+ Reviewed by me.
+
+ * kjs/grammar.y: Remove bogus extra line from grammar.y. Toby got this change from KDE KJS.
+
+2005-06-06 Darin Adler <darin@apple.com>
+
+ * tests/mozilla/run-mozilla-tests: Wrote a perl version of this so we don't require
+ the "jst" tool to run the tests.
+
+2005-06-04 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - add libicu headers
+
+ * JavaScriptCore.pbproj/project.pbxproj: Added icu directory to header search path.
+
+ * icu/README: Added.
+ * icu/unicode/platform.h: Added.
+ * icu/unicode/uchar.h: Added.
+ * icu/unicode/uconfig.h: Added.
+ * icu/unicode/umachine.h: Added.
+ * icu/unicode/urename.h: Added.
+ * icu/unicode/utf.h: Added.
+ * icu/unicode/utf16.h: Added.
+ * icu/unicode/utf8.h: Added.
+ * icu/unicode/utf_old.h: Added.
+ * icu/unicode/utypes.h: Added.
+ * icu/unicode/uversion.h: Added.
+
+2005-05-19 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - turned off exceptions and RTTI; seems to cut JavaScriptCore code size by about 22%
+
+ * JavaScriptCore.pbproj/project.pbxproj: Turn off exceptions and RTTI for both
+ the framework and testkjs tool.
+
+2005-05-18 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - got rid of code that depended on RTTI
+
+ * kjs/collector.cpp:
+ (KJS::className): Added. Gets class name in a KJS way, rather than a C++ RTTI way.
+ (KJS::Collector::rootObjectClasses): Use className instead of typeid names.
+
+2005-05-18 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - fix a failure seen in the Mozilla JavaScript tests where a live object was garbage-collected
+ when the only reference to it was in an argList on the stack
+
+ * kjs/list.h: Moved the operator= function into the .cpp file since it's too big to be
+ a good choice to inline.
+ * kjs/list.cpp: (KJS::List::operator=): Moved this formerly-inline function into a separate
+ file and added missing code to update valueRefCount. It's the latter that fixes the bug.
+
+2005-05-16 Darin Adler <darin@apple.com>
+
+ Reviewed by Adele.
+
+ - fixed issues preventing us from compiling with newer versions of gcc 4.0
+
+ * kjs/ustring.cpp:
+ (KJS::operator==): Remove redundant and illegal KJS:: prefix on this function's definition.
+ (KJS::operator<): Ditto.
+ (KJS::compare): Ditto.
+
+2005-05-09 Darin Adler <darin@apple.com>
+
+ Reviewed by John.
+
+ - turn on conservative GC unconditionally and start on SPI changes to
+ eliminate the now-unneeded smart pointers since we don't ref count any more
+
+ * kjs/value.h: Removed macros to turn conservative GC on and off.
+ Removed ref and deref functions.
+ (KJS::ValueImp::ValueImp): Removed non-conservative-GC code path.
+ (KJS::ValueImp::isUndefined): Added. New SPI to make it easier to deal with ValueImp directly.
+ (KJS::ValueImp::isNull): Ditto.
+ (KJS::ValueImp::isBoolean): Ditto.
+ (KJS::ValueImp::isNumber): Ditto.
+ (KJS::ValueImp::isString): Ditto.
+ (KJS::ValueImp::isObject): Ditto.
+ (KJS::Value::Value): Removed non-conservative-GC code path and made constructor no
+ longer explicit so we can quietly create Value wrappers from ValueImp *; inexpensive with
+ conservative GC and eases the transition.
+ (KJS::Value::operator ValueImp *): Added. Quietly creates ValueImp * from Value.
+ (KJS::ValueImp::marked): Removed non-conservative-GC code path.
+
+ * kjs/value.cpp:
+ (KJS::ValueImp::mark): Removed non-conservative-GC code path.
+ (KJS::ValueImp::isUndefinedOrNull): Added. New SPI to make it easier to deal with ValueImp directly.
+ (KJS::ValueImp::isBoolean): Ditto.
+ (KJS::ValueImp::isNumber): Ditto.
+ (KJS::ValueImp::isString): Ditto.
+ (KJS::ValueImp::asString): Ditto.
+ (KJS::ValueImp::isObject): Ditto.
+ (KJS::undefined): Ditto.
+ (KJS::null): Ditto.
+ (KJS::boolean): Ditto.
+ (KJS::string): Ditto.
+ (KJS::zero): Ditto.
+ (KJS::one): Ditto.
+ (KJS::two): Ditto.
+ (KJS::number): Ditto.
+
+ * kjs/object.h: Made constructor no longer explicit so we can quietly create Object
+ wrappers from ObjectImp *; inexpensive with conservative GC and eases the transition.
+ (KJS::Object::operator ObjectImp *): Added. Quietly creates ObjectImp * from Object.
+ (KJS::ValueImp::isObject): Added. Implementation of new object-related ValueImp function.
+ (KJS::ValueImp::asObject): Ditto.
+
+ * kjs/object.cpp:
+ (KJS::ObjectImp::setInternalValue): Remove non-conservative-GC code path.
+ (KJS::ObjectImp::putDirect): Ditto.
+ (KJS::error): Added. Function in the new SPI style to create an error object.
+
+ * kjs/internal.h: Added the new number-constructing functions as friends of NumberImp.
+ There may be a more elegant way to do this later; what's important now is the new SPI.
+
+ * kjs/collector.h: Remove non-conservative-GC code path and also take out some
+ unneeded APPLE_CHANGES.
+
+ * bindings/runtime_root.cpp:
+ (KJS::Bindings::addNativeReference): Remove non-conservative-GC code path.
+ (KJS::Bindings::removeNativeReference): Ditto.
+ (RootObject::removeAllNativeReferences): Ditto.
+ * bindings/runtime_root.h:
+ (KJS::Bindings::RootObject::~RootObject): Ditto.
+ (KJS::Bindings::RootObject::setRootObjectImp): Ditto.
+ * kjs/collector.cpp:
+ (KJS::Collector::allocate): Ditto.
+ (KJS::Collector::collect): Ditto.
+ (KJS::Collector::numGCNotAllowedObjects): Ditto.
+ (KJS::Collector::numReferencedObjects): Ditto.
+ (KJS::Collector::rootObjectClasses): Ditto.
+ * kjs/internal.cpp:
+ (NumberImp::create): Ditto.
+ (InterpreterImp::globalInit): Ditto.
+ (InterpreterImp::globalClear): Ditto.
+ * kjs/list.cpp:
+ (KJS::List::markProtectedLists): Ditto.
+ (KJS::List::clear): Ditto.
+ (KJS::List::append): Ditto.
+ * kjs/list.h:
+ (KJS::List::List): Ditto.
+ (KJS::List::deref): Ditto.
+ (KJS::List::operator=): Ditto.
+ * kjs/protect.h:
+ (KJS::gcProtect): Ditto.
+ (KJS::gcUnprotect): Ditto.
+
+2005-05-09 Chris Blumenberg <cblu@apple.com>
+
+ Workaround gcc 3.3 internal compiler errors.
+
+ Reviewed by darin.
+
+ * bindings/objc/WebScriptObject.mm:
+ (-[WebScriptObject stringRepresentation]): call [NSString stringWithCString:encoding] rather than using @""
+
+2005-05-09 Darin Adler <darin@apple.com>
+
+ * Makefile.am: Don't set up PBXIntermediatesDirectory explicitly;
+ Not needed to make builds work, spews undesirable error messages too.
+
+2005-05-06 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - make building multiple trees with make work better
+
+ * Makefile.am: Set up Xcode build directory before invoking xcodebuild.
+
+2005-05-04 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin.
+
+ <rdar://problem/4086570> Crash in JavaScriptCore with RSS Visualizer
+
+ * kjs/internal.cpp:
+ (InterpreterImp::mark): mark staticNaN, it is usually protected by the Number
+ prototype but there is a small window where it can get collected.
+
+2005-05-04 Darin Adler <darin@apple.com>
+
+ Reviewed by Dave Hyatt.
+
+ - another gcc-4.0-related fix
+
+ * bindings/runtime_root.h: Take off extra namespace prefixes that apparently cause problems
+ compiling with gcc 4.0, although I have not observed the problems.
+
+2005-05-04 Darin Adler <darin@apple.com>
+
+ Reviewed by Dave Hyatt.
+
+ - fixed build rules to match other projects
+
+ * JavaScriptCore.pbproj/project.pbxproj: Set deployment target to 10.3 in the build styles.
+ When built without a build style (by Apple B&I) we want to get the target from the
+ environment. But when built with a build style (by Safari engineers and others), we want
+ to use 10.3.
+
+ * Makefile.am: Took out extra parameters that make command-line building different from
+ Xcode building. Now that this is fixed, you should not get a full rebuild if you switch
+ from command line to Xcode or back.
+
+2005-05-04 Maciej Stachowiak <mjs@apple.com>
+
+ - revert presumably accidental change to mozilla JS test expected results, this
+ was making the tests fail.
+
+ * tests/mozilla/expected.html:
+
+2005-05-03 Richard Williamson <rjw@apple.com>
+
+ Fixed <rdar://problem/4102644> Crash in LiveConnect below KJS::Bindings::JavaInstance::stringValue() const
+
+ Correctly handle accessing nil objects from a Java object array.
+
+ Reviewed by John.
+
+ * bindings/jni/jni_runtime.cpp:
+ (JavaArray::valueAt):
+
+2005-05-01 Darin Adler <darin@apple.com>
+
+ - move to Xcode native targets and stop checking in generated files
+
+ * JavaScriptCore.pbproj/project.pbxproj: Updated to use native targets and generate all the generated
+ files, so we don't have to check them in any more.
+ * Info.plist: Added. Native targets use a separate file for this.
+
+ * Makefile.am: Removed pcre and kjs SUBDIRS. Also removed code that deleted the embedded copy of this
+ framework, since we haven't been embedding it for some time.
+
+ * kjs/grammar_wrapper.cpp: Added. Shell used to compile grammar.cpp since we can't add a generated file
+ easily to the list of files to be compiled.
+
+ * kjs/.cvsignore: Removed.
+ * kjs/Makefile.am: Removed.
+ * kjs/array_object.lut.h: Removed.
+ * kjs/date_object.lut.h: Removed.
+ * kjs/grammar.cpp: Removed.
+ * kjs/grammar.cpp.h: Removed.
+ * kjs/grammar.h: Removed.
+ * kjs/lexer.lut.h: Removed.
+ * kjs/math_object.lut.h: Removed.
+ * kjs/number_object.lut.h: Removed.
+ * kjs/string_object.lut.h: Removed.
+ * pcre/.cvsignore: Removed.
+ * pcre/Makefile.am: Removed.
+ * pcre/chartables.c: Removed.
+
+2005-04-28 Darin Adler <darin@apple.com>
+
+ Reviewed by Dave Harrison.
+
+ - fixed problems preventing us from compiling with gcc 4.0
+
+ * JavaScriptCore.pbproj/project.pbxproj: Removed -Wmissing-prototypes from
+ WARNING_CPLUSPLUSFLAGS since it's now a C-only warning.
+
+ * bindings/jni/jni_jsobject.cpp:
+ (JSObject::getSlot): Changed some %d to %ld where the parameters where long ints.
+ (JSObject::setSlot): Ditto.
+ * bindings/jni/jni_utility.cpp:
+ (KJS::Bindings::getJavaVM): Ditto.
+ (KJS::Bindings::getJNIEnv): Ditto.
+ * bindings/objc/objc_utility.mm: Fixed include of <JavascriptCore/internal.h> that needed the
+ letter "S" capitalized.
+ * kjs/bool_object.cpp: (BooleanProtoFuncImp::call): Rearranged how this function returns to
+ avoid incorrect gcc 4.0 warning.
+ * kjs/collector.cpp: (KJS::Collector::markStackObjectsConservatively): Changed code to check
+ the alignment of the passed-in pointers to only require pointer-level alignment, not 8-byte alignment.
+ Prevents a crash on garbage collect when compiled with gcc 4.0.
+ * kjs/nodes.cpp:
+ (WhileNode::execute): Added a redundant return after an infinite loop to work around incorrect gcc 4.0 warning.
+ (ForNode::execute): Ditto.
+ (SwitchNode::execute):Rearranged how this function returns to avoid incorrect gcc 4.0 warning.
+ (LabelNode::execute): Ditto.
+ * kjs/string_object.cpp: (replace): Ditto.
+
+2005-04-26 Richard Williamson <rjw@apple.com>
+
+ Fixed <rdar://problem/4098713> Scripting API is incompatible with Mozilla
+
+ We were incompatible with Mozilla's implementation of the scripting APIs in
+ two ways:
+
+ Their NPN_SetException has the following signature:
+
+ void NPN_SetException(NPObject *npobj, const NPUTF8 *message);
+
+ ours has:
+
+ void NPN_SetException (NPObject * npobj, const NPString *message);
+
+ Also, they expect the string returned from NPN_UTF8FromIdentifier() to be freed by caller.
+ We do not.
+
+ I changed both behaviors to match Mozilla.
+
+ Reviewed by Chris.
+
+ * bindings/NP_jsobject.cpp:
+ (_NPN_SetException):
+ * bindings/npruntime.cpp:
+ (_NPN_UTF8FromIdentifier):
+ (_NPN_IntFromIdentifier):
+ (_NPN_SetExceptionWithUTF8):
+ * bindings/npruntime.h:
+ * bindings/npruntime_impl.h:
+
+2005-04-26 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Chris.
+
+ <rdar://problem/4092136> reproducible crash in KJS::kjs_fast_realloc loading maps.google.com
+
+ * kjs/string_object.cpp:
+ (StringObjectFuncImp::call): Allocate adopted ustring buffer properly.
+
+2005-04-22 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ * kjs/ustring.cpp: (KJS::UString::UTF8String): Fix off-by-one error in surrogate pair logic.
+
+2005-04-22 Darin Adler <darin@apple.com>
+
+ Reviewed by John.
+
+ - fixed <rdar://problem/4090046> JavaScript throw statement causes parse error when no semicolon is present
+
+ * kjs/grammar.y: Added an additional rule for throw like the ones we have for all the other semicolon rules.
+ Not sure why we missed this one earlier.
+
+ * kjs/grammar.cpp: Regenerated.
+
+=== JavaScriptCore-412.1 ===
+
+2005-04-20 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - speedups, total 12% on JavaScript iBench
+
+ I ran the benchmark under Shark and followed its advice a lot, mainly.
+
+ * kjs/collector.cpp:
+ (KJS::Collector::allocate): Take out special case for 0; costing speed but unexercised.
+ Use numLiveObjectsAtLastCollect instead of numAllocationsSinceLastCollect so we don't
+ have to bump it each time we call allocate. Put numLiveObjects into a local variable to
+ cut down on global variable accesses. Make "next" cell pointer be a byte offset rather
+ than a pointer so we don't need a special case for NULL. Allow freeList to point to some
+ bogus item when the entire block is full rather than going out of our way to make it
+ point to NULL.
+ (KJS::Collector::markProtectedObjects): Get table size and pointer into locals outside
+ the loop to avoid re-loading them over and over again.
+ (KJS::Collector::collect): Put numLiveObjects into a local variable to cut down on global
+ variable accesses. Make "next" cell pointer be a byte offset as above. Put numLiveObjects
+ into a local variable to cut down on global variable accesses. Set numLiveObjectsAtLastCollect
+ rather than numAllocationsSinceLastCollect.
+ (KJS::Collector::numReferencedObjects): Get table size and pointer into locals outside
+ the loop to avoid re-loading them over and over again.
+ (KJS::Collector::rootObjectClasses): Ditto.
+
+ * kjs/internal.h: Make Value be a friend of NumberImp so it can construct number objects
+ directly, avoiding the conversion from Number to Value.
+
+ * kjs/internal.cpp: (StringImp::toObject): Don't use Object::dynamicCast, because we know
+ the thing is an object and we don't want to do all the extra work; just cast directly.
+
+ * kjs/list.cpp: (KJS::List::List): Construct valueRefCount in a way that avoids the need for
+ a branch -- in the hot case this just meant avoiding checking a variable we just set to false.
+
+ * kjs/lookup.cpp: (keysMatch): Marked this inline.
+
+ * kjs/nodes.cpp: Disabled KJS_BREAKPOINT, to avoid calling hitStatement all the time.
+ (BooleanNode::evaluate): Make a Value directly, rather than making a Boolean which is converted
+ into a Value.
+ (NumberNode::evaluate): Ditto.
+ (StringNode::evaluate): Ditto.
+ (ArrayNode::evaluate): Ditto.
+ (FunctionCallNode::evaluate): Use new inline baseIfMutable to avoid unnecessary getBase function.
+ Also just use a pointer for func, rather than an Object.
+ (PostfixNode::evaluate): Change code so that it doesn't make an excess Number, and so that it
+ passes a "known to be integer" boolean in, often avoiding a conversion from floating point to
+ integer and back.
+ (DeleteNode::evaluate): Make a Value directly.
+ (TypeOfNode::evaluate): Use new inline baseIfMutable and make Value directly.
+ (PrefixNode::evaluate): Change code so that it doesn't make an excess Number, and so that it
+ passes a "known to be integer" boolean in, often avoiding a conversion from floating point to
+ integer and back.
+ (UnaryPlusNode::evaluate): Make a Value directly.
+ (NegateNode::evaluate): Change code so that it doesn't make an excess Number, and so that it
+ passes a "known to be integer" boolean in, often avoiding a conversion from floating point to
+ integer and back.
+ (BitwiseNotNode::evaluate): Make a Value directly.
+ (LogicalNotNode::evaluate): Ditto.
+ (ShiftNode::evaluate): Don't convert to a double before making a Value.
+ (RelationalNode::evaluate): Make a Value directly.
+ (EqualNode::evaluate): Ditto.
+ (BitOperNode::evaluate): Ditto.
+ (AssignNode::evaluate): Make a Value directly. Change code so that it passes a "known to be integer"
+ boolean in, often avoiding a conversion from floating point to integer and back.
+ (VarDeclNode::evaluate): Make a Value directly.
+ (ForNode::execute): Remove unused local variable.
+
+ * kjs/operations.h:
+ (KJS::isNaN): Inlined.
+ (KJS::isInf): Ditto.
+ (KJS::isPosInf): Ditto.
+ (KJS::isNegInf): Ditto.
+
+ * kjs/operations.cpp: Change isNaN, isInf, isPosInf, and isNegInf to be inlines.
+ (KJS::equal): Rewrite to avoid creating values and recursing back into the function.
+ (KJS::relation): Rearranged code so that we don't need explicit isNaN checks.
+ (KJS::add): Changed code to make Value directly, and so that it passes a "known to be integer"
+ boolean in, often avoiding a conversion from floating point to integer and back.
+ (KJS::mult): Ditto.
+
+ * kjs/property_map.cpp:
+ (KJS::PropertyMap::~PropertyMap): Get size and entries pointer outside loop to avoid
+ re-getting them inside the loop.
+ (KJS::PropertyMap::clear): Ditto. Clear value pointer in addition to key, so we can just
+ look at the value pointer in the mark function.
+ (KJS::PropertyMap::get): Get sizeMask and entries pointer outside loop to avoid
+ re-getting them inside the loop.
+ (KJS::PropertyMap::put): Ditto.
+ (KJS::PropertyMap::insert): Ditto.
+ (KJS::PropertyMap::remove): Ditto.
+ (KJS::PropertyMap::mark): Get size and entries pointer outside loop to avoid
+ re-getting them inside the loop. Don't bother checking key for 0, since we already have
+ to check value for 0. (Also had to change clear() to set value to 0.)
+ (KJS::PropertyMap::addEnumerablesToReferenceList): Get size and entries pointer outside
+ loop to avoid re-getting them inside the loop.
+ (KJS::PropertyMap::addSparseArrayPropertiesToReferenceList): Ditto.
+ (KJS::PropertyMap::save): Ditto.
+
+ - other changes
+
+ * kjs/protected_values.h: Remove unneeded class name qualifiers.
+
+ * kjs/reference.h:
+ (KJS::Reference::baseIfMutable): New inline function: replaces isMutable().
+ (KJS::Reference::Reference): Inlined.
+ * kjs/reference.cpp:
+ (KJS::Reference::getValue): Rewrite to not use getBase.
+ (KJS::Reference::putValue): Ditto.
+ (KJS::Reference::deleteValue): Dittol
+
+ * kjs/simple_number.h:
+ (KJS::SimpleNumber::integerFits): Added. For use when the parameter is known to be integral.
+
+ * kjs/string_object.cpp: (StringProtoFuncImp::call): Create the number without first converting
+ to double in various cases that involve integers.
+
+ * kjs/ustring.h:
+ (KJS::UString::attach): Inlined.
+ (KJS::UString::release): Inlined.
+ * kjs/ustring.cpp:
+ (KJS::UString::find): Get first character outside the loop instead of re-fetching it each time.
+
+ * kjs/value.cpp:
+ (Value::Value): Added overloads for all the various specific types of values, so you don't have
+ to convert from, say, Number to Value, just to create one.
+ (Number::Number): Added an overload that takes a boolean to indicate the number is already
+ known to be an integer.
+
+ * kjs/value.h: Added more Value constructors, added a version of toNumber that returns
+ a boolean to indicate if the number is known to be an integer (because it was a "simple number").
+ (KJS::ValueImp::marked): Inlined.
+ (KJS::ValueImp::dispatchType): Inlined.
+ (KJS::ValueImp::dispatchToPrimitive): Inlined.
+ (KJS::ValueImp::dispatchToBoolean): Inlined.
+ (KJS::ValueImp::dispatchToNumber): Inlined.
+ (KJS::ValueImp::dispatchToString): Inlined.
+ (KJS::ValueImp::dispatchToUInt32): Inlined.
+
+2005-04-14 Maciej Stachowiak <mjs@apple.com>
+
+ - make fast_malloc.h a private header, not project
+
+ * JavaScriptCore.pbproj/project.pbxproj:
+
+2005-04-12 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Richard.
+
+ <rdar://problem/4089734> JavaScript iBench can be sped up ~10% with custom allocator
+
+ - use custom single-threaded malloc for all non-GC JavaScriptCore
+ allocations, for a 9.1% speedup on JavaScript iBench
+
+ * JavaScriptCore.pbproj/project.pbxproj:
+ * kjs/collector.cpp:
+ (KJS::Collector::allocate): Use dlmalloc to allocate the collector blocks.
+ (KJS::Collector::collect): And dlfree to free it.
+ * kjs/fast_malloc.cpp: Added, just the standard dlmalloc here.
+ * kjs/fast_malloc.h: Added. Declarations for the functions. Also added a handy
+ macro to give a class custom operator new/delete
+ * kjs/identifier.cpp:
+ (KJS::Identifier::add): Use dlmalloc/dlfree.
+ * kjs/nodes.h: make nodes KJS_FAST_ALLOCATED.
+ * kjs/property_map.cpp:
+ (KJS::PropertyMap::~PropertyMap): Use dlmalloc/dlfree.
+ (KJS::PropertyMap::rehash): ditto
+ * kjs/scope_chain.h:
+ * kjs/ustring.cpp:
+ (KJS::UString::Rep::createCopying): New named constructor that copies a passed-in
+ buffer, to hide allocation details from webcore.
+ (KJS::UString::UString): use createCopying when appropriate.
+ (KJS::UString::Rep::destroy): Use dlmalloc/dlfree.
+ (KJS::UString::expandedSize): likewise
+ (KJS::UString::expandCapacity): likewise
+ (KJS::UString::expandPreCapacity): likewise
+ (KJS::UString::spliceSubstringsWithSeparators): likewise
+ (KJS::UString::append): likewise
+ (KJS::UString::operator=): likewise
+ (KJS::UString::detach): likewise
+ * kjs/ustring.h: make UString and UString::Rep KJS_FAST_ALLOCATED.
+
+2005-04-11 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by John.
+
+ <rdar://problem/4086819> Avoid using protect count hash table so much for 5.6% JS iBench speedup
+
+ - Avoid using protected values hash for the two most common cases
+ - Bump up ListImp high water mark, new testing shows 508 ListImps are
+ created during JS iBench.
+
+ Net result is a 5.6% speedup on JavaScript iBench
+
+ * kjs/collector.cpp:
+ (KJS::Collector::collect): mark protected lists as appropriate.
+ * kjs/context.h:
+ * kjs/list.cpp:
+ (KJS::ListImp::markValues): Moved implementation from List::markValues
+ (KJS::List::markProtectedLists): Implemented - scan pool and overflow
+ list.
+ (KJS::allocateListImp): link lists outside the pool into a separate
+ doubly linked list to be able to mark protected lists
+ (KJS::deallocateListImp): do the corresponding delinking
+ (KJS::List::derefValues): do nothing in conservative GC mode
+ (KJS::List::refValues): do nothing in conservative GC mode
+ (KJS::List::markValues): call ListImp version
+ (KJS::List::append):
+ * kjs/list.h:
+
+=== Safari-412 ===
+
+=== Safari-411 ===
+
+=== Safari-410 ===
+
+=== Safari-409 ===
+
+=== Safari-408 ===
+
+=== Safari-407 ===
+
+2005-03-16 Jens Alfke <jens@apple.com>
+
+ Reviewed by Kevin.
+
+ Fix for <rdar://problem/4025212> "REGRESSION (163-164): search not performed correctly; united.com"
+ JavaScript unescape("") was returning a messed-up String object that appeared identical to an empty string, but would in some cases act as 'null' when passed to native functions, in this case the Option() constructor.
+ In the implementation of unescape, the UString holding the result was not initialized to "", so it started out as a null string. If nothing was appended to it, it remained null, resulting in a JavaScript String object with some bad behaviors (namely, converting it to a DOMStringImpl results in a NULL pointer.)
+ Darin says this regression occurred when we replaced our own implementation of unescape() with code from KJS.
+
+ * kjs/function.cpp:
+ (KJS::GlobalFuncImp::call):
+
+2005-03-15 Richard Williamson <rjw@apple.com>
+
+ Fixed <rdar://problem/4053276> WebScripting protocol in WebKit cannot convert Boolean in Javascript to BOOL in Objective-C
+
+ Added JavaScript boolean to type that can be converted to
+ ObjC scalar parameters.
+
+ Reviewed by Ken Kocienda.
+
+ * bindings/objc/objc_utility.mm:
+ (KJS::Bindings::convertValueToObjcValue):
+
+=== Safari-406 ===
+
+=== Safari-405 ===
+
+=== Safari-403 ===
+
+=== Safari-402 ===
+
+=== Safari-401 ===
+
+=== Safari-400 ===
+
+=== Safari-188 ===
+
+2005-02-21 Darin Adler <darin@apple.com>
+
+ * kjs/date_object.cpp: (timetUsingCF): Fixed indenting.
+
+2005-02-17 Richard Williamson <rjw@apple.com>
+
+ Fixed <rdar://problem/4003251> Safari crashed at www.icelandair.com in LiveConnect code converting a Java object to a string
+
+ Added nil check.
+
+ Reviewed by John Sullivan.
+
+ * bindings/jni/jni_runtime.cpp:
+ (JavaField::valueFromInstance):
+
+=== Safari-187 ===
+
+2005-02-11 Richard Williamson <rjw@apple.com>
+
+ Fixed <rdar://problem/3985118> DOM objects not being marshaled on JS->native calls
+
+ Re-factored how 'native' wrappers for JS objects are created. The interpreter now
+ creates these wrappers. The WebCore subclass of the interpreter now overrides
+ createLanguageInstanceForValue() and creates a DOM ObjC wrapper for DOM objects.
+
+ Reviewed by Ken.
+
+ * bindings/c/c_utility.cpp:
+ (convertValueToNPVariant):
+ * bindings/jni/jni_instance.cpp:
+ (JavaInstance::invokeMethod):
+ * bindings/jni/jni_objc.mm:
+ (KJS::Bindings::dispatchJNICall):
+ * bindings/jni/jni_runtime.cpp:
+ (JavaField::valueFromInstance):
+ (JavaArray::valueAt):
+ * bindings/objc/WebScriptObject.mm:
+ (-[WebScriptObject _setExecutionContext:KJS::Bindings::]):
+ (+[WebScriptObject _convertValueToObjcValue:KJS::originExecutionContext:Bindings::executionContext:Bindings::]):
+ * bindings/objc/WebScriptObjectPrivate.h:
+ * bindings/objc/objc_utility.h:
+ * bindings/objc/objc_utility.mm:
+ (KJS::Bindings::convertObjcValueToValue):
+ (KJS::Bindings::createObjcInstanceForValue):
+ * bindings/runtime.cpp:
+ (Instance::createBindingForLanguageInstance):
+ (Instance::createRuntimeObject):
+ (Instance::createLanguageInstanceForValue):
+ * bindings/runtime.h:
+ * kjs/interpreter.cpp:
+ (Interpreter::createLanguageInstanceForValue):
+ * kjs/interpreter.h:
+
+=== Safari-186 ===
+
+2005-02-10 Darin Adler <darin@apple.com>
+
+ "Reviewed" by Richard (he told me the file was obsolete).
+
+ - got rid of an obsolete file
+
+ * bindings/npsap.h: Removed.
+
+=== Safari-185 ===
+
+=== Safari-183 ===
+
+2005-02-03 Richard Williamson <rjw@apple.com>
+
+ Fixed <rdar://problem/3972905> CrashTracer: ...36 crashes at com.apple.WebCore: khtml::CSSStyleSelector::applyDeclarations + 120
+
+ Revert to old (and correct) behavior of returning runtime object
+ when passed as a parameter, rather than it's corresponding DOM
+ object.
+
+ Reviewed by Chris.
+
+ * bindings/objc/WebScriptObject.mm:
+ (+[WebScriptObject _convertValueToObjcValue:KJS::originExecutionContext:Bindings::executionContext:Bindings::]):
+
+=== Safari-182 ===
+
+2005-01-28 Richard Williamson <rjw@apple.com>
+
+ Fixed <rdar://problem/3980389> JavaScript bindings access incorrect runtime object
+
+ Only use special 'back door' property to get the runtime object if thisObj isn't
+ already a runtime object.
+
+ <gratuitous> Cleaned up a couple of strcmp on ClassInfo name. Used == on
+ ClassInfo pointer instead.
+
+ Reviewed by Chris.
+
+ * bindings/c/c_utility.cpp:
+ (convertValueToNPVariant):
+ * bindings/objc/WebScriptObject.mm:
+ (+[WebScriptObject _convertValueToObjcValue:KJS::originExecutionContext:Bindings::executionContext:Bindings::]):
+ * bindings/runtime_method.cpp:
+ (RuntimeMethodImp::call):
+
+=== Safari-181 ===
+
+2005-01-26 Richard Williamson <rjw@apple.com>
+
+ Fixed <rdar://problem/3972522> (179-180) 40% slowdown on iBench JavaScript test
+
+ I added a member variable to ObjectImp. This changed it's size and consequently
+ hampered the optimizations built into the garbage collector. Objects no longer
+ fit within the allocators cell size, and thus allocation fell back to a slower
+ allocator.
+
+ As a result of this fix I also dramatically cleaned up how runtime objects are
+ accessed. The path mostly *removes* code.
+
+ Reviewed by Chris.
+
+ * bindings/runtime_method.cpp:
+ (RuntimeMethodImp::call):
+ * bindings/runtime_object.cpp:
+ (RuntimeObjectImp::get):
+ (RuntimeObjectImp::put):
+ (RuntimeObjectImp::canPut):
+ (RuntimeObjectImp::hasProperty):
+ (RuntimeObjectImp::defaultValue):
+ * bindings/runtime_object.h:
+ * kjs/object.cpp:
+ (KJS::ObjectImp::ObjectImp):
+ * kjs/object.h:
+
+2005-01-20 Darin Adler <darin@apple.com>
+
+ Reviewed by me, changes by Han Ming Ong.
+
+ - <rdar://problem/3964302> SWB: A few files need to be updated to be compilable under GCC 4.0
+
+ * bindings/objc/WebScriptObjectPrivate.h: Make members public.
+ * kjs/lookup.h: Change "value.h" to "object.h" because we need KJS::Object to compile a template.
+
+2005-01-20 Richard Williamson <rjw@apple.com>
+
+ Fixed <rdar://problem/3964634> undefined property value from binding seems to evaluate to true in an if statement
+
+ The comprehensive fix for this problem requires new API, as described in 3965326. However,
+ given that we can't add new API at this point, the 'ObjcFallbackObjectImp' will behave
+ like and Undefined object if invokeUndefinedMethodFromWebScript:withArguments: isn't
+ implemented on the bound object.
+
+ Reviewed by Chris.
+
+ * bindings/objc/objc_runtime.h:
+ * bindings/objc/objc_runtime.mm:
+ (ObjcFallbackObjectImp::type):
+ (ObjcFallbackObjectImp::implementsCall):
+ (ObjcFallbackObjectImp::toBoolean):
+ * bindings/testbindings.mm:
+ (+[MyFirstInterface isSelectorExcludedFromWebScript:]):
+ (+[MyFirstInterface isKeyExcludedFromWebScript:]):
+
+=== Safari-180 ===
+
+2005-01-19 Richard Williamson <rjw@apple.com>
+
+ Fixed <rdar://problem/3853676> Browser Crash when accessing CCWeb Progress Page - KJS::Bindings::convertValueToJValue
+
+ Fixed the following problems with LiveConnect that are demonstrated by the application
+ described in 3853676.
+
+ 1. If a nil object is passed in an array from Java to JavaScript we will crash.
+ 2. We sometimes will incorrectly attempt to access a generic JavaScript as a Java runtime object wrapper.
+ 3. We will sometimes fail to find the correct static method ID.
+
+ Reviewed by Maciej.
+
+ * bindings/jni/jni_jsobject.cpp:
+ (JSObject::convertJObjectToValue):
+ (JSObject::listFromJArray):
+ * bindings/jni/jni_runtime.cpp:
+ (JavaField::valueFromInstance):
+ (JavaField::setValueToInstance):
+ * bindings/jni/jni_utility.cpp:
+ (KJS::Bindings::getMethodID):
+ (KJS::Bindings::convertValueToJValue):
+ * bindings/runtime_array.h:
+
+2005-01-18 Richard Williamson <rjw@apple.com>
+
+ Fixed several issues all arising from analysis of plugin detection code at ifilm.com:
+
+ Fixed <rdar://problem/3958592> can't script plug-ins if plug-in is invoked with <object> element instead of <embed>
+ Fixed <rdar://problem/3958597> <object> elements with IDs do not show up as named properties of the document
+ Fixed <rdar://problem/3960973> DOM objects for plugin elements are not accessible
+ Fixed <rdar://problem/3958601> need an additional class ID in WebCore for the Real plug-in
+
+ We now support accessing scriptable plugin objects that are specified with <applet>, <embed>, or <object>
+ tags. Also, if any of these elements are named they can be accessed from the document or window objects.
+ Finally, DOM methods are properties will be forwarded appropriately for the plugin's root scriptable object.
+
+ Reviewed by Chris.
+
+ * bindings/objc/objc_instance.h:
+ * bindings/objc/objc_instance.mm:
+ (ObjcInstance::supportsSetValueOfUndefinedField):
+ * bindings/runtime.h:
+ (KJS::Bindings::Instance::supportsSetValueOfUndefinedField):
+ * bindings/runtime_object.cpp:
+ (RuntimeObjectImp::RuntimeObjectImp):
+ (RuntimeObjectImp::get):
+ (RuntimeObjectImp::put):
+ (RuntimeObjectImp::canPut):
+ (RuntimeObjectImp::hasProperty):
+ (RuntimeObjectImp::defaultValue):
+ * bindings/runtime_object.h:
+ (KJS::RuntimeObjectImp::fallbackObject):
+ * kjs/object.cpp:
+ (KJS::ObjectImp::ObjectImp):
+ * kjs/object.h:
+ (KJS::ObjectImp::forwardingScriptMessage):
+ (KJS::ObjectImp::setForwardingScriptMessage):
+
+2005-01-18 Richard Williamson <rjw@apple.com>
+
+ Back out a change that was incorrectly committed yesterday.
+
+ Reviewed by Chris.
+
+ * bindings/objc/objc_utility.mm:
+ (KJS::Bindings::convertValueToObjcValue):
+
+2005-01-17 Richard Williamson <rjw@apple.com>
+
+ Fixed <rdar://problem/3753030> Need to ensure same origin for plugin binding invocations (origin security rules)
+
+ Keep track of originating execution context and target execution
+ context for native JS object wrappers, and perform appropriate
+ security checks.
+
+ Reviewed by David Harrison.
+
+ * bindings/NP_jsobject.cpp:
+ (_isSafeScript):
+ (_NPN_CreateScriptObject):
+ (_NPN_Invoke):
+ (_NPN_Evaluate):
+ (_NPN_GetProperty):
+ (_NPN_SetProperty):
+ (_NPN_RemoveProperty):
+ (_NPN_HasProperty):
+ (_NPN_HasMethod):
+ (_NPN_SetException):
+ * bindings/NP_jsobject.h:
+ * bindings/c/c_instance.cpp:
+ (CInstance::CInstance):
+ (CInstance::stringValue):
+ * bindings/c/c_instance.h:
+ * bindings/c/c_utility.cpp:
+ (convertValueToNPVariant):
+ * bindings/jni/jni_instance.cpp:
+ (JavaInstance::JavaInstance):
+ (JavaInstance::valueOf):
+ * bindings/jni/jni_instance.h:
+ * bindings/objc/WebScriptObject.mm:
+ (-[WebScriptObject _initializeWithObjectImp:KJS::originExecutionContext:Bindings::executionContext:Bindings::]):
+ (-[WebScriptObject _initWithObjectImp:KJS::originExecutionContext:Bindings::executionContext:Bindings::]):
+ (-[WebScriptObject KJS::Bindings::]):
+ (-[WebScriptObject _setOriginExecutionContext:KJS::Bindings::]):
+ (-[WebScriptObject _isSafeScript]):
+ (-[WebScriptObject callWebScriptMethod:withArguments:]):
+ (-[WebScriptObject evaluateWebScript:]):
+ (-[WebScriptObject setValue:forKey:]):
+ (-[WebScriptObject valueForKey:]):
+ (-[WebScriptObject removeWebScriptKey:]):
+ (-[WebScriptObject stringRepresentation]):
+ (-[WebScriptObject webScriptValueAtIndex:]):
+ (-[WebScriptObject setWebScriptValueAtIndex:value:]):
+ (+[WebScriptObject _convertValueToObjcValue:KJS::originExecutionContext:Bindings::executionContext:Bindings::]):
+ * bindings/objc/WebScriptObjectPrivate.h:
+ * bindings/objc/objc_instance.h:
+ * bindings/objc/objc_runtime.mm:
+ (convertValueToObjcObject):
+ * bindings/objc/objc_utility.mm:
+ (KJS::Bindings::convertValueToObjcValue):
+ * bindings/runtime.cpp:
+ (Instance::Instance):
+ (Instance::operator=):
+ * bindings/runtime.h:
+ (KJS::Bindings::Instance::Instance):
+ (KJS::Bindings::Instance::setExecutionContext):
+ (KJS::Bindings::Instance::executionContext):
+ * bindings/runtime_root.cpp:
+ (RootObject::setInterpreter):
+ * bindings/runtime_root.h:
+ * kjs/interpreter.h:
+ (KJS::Interpreter::isGlobalObject):
+ (KJS::Interpreter::interpreterForGlobalObject):
+ (KJS::Interpreter::isSafeScript):
+
+=== Safari-179 ===
+
+2005-01-13 Vicki Murley <vicki@apple.com>
+
+ Reviewed by Adele.
+
+ - fix <rdar://problem/3946836> Safari about box lists 2004 instead of 2005
+
+ * JavaScriptCore.pbproj/project.pbxproj: bump "2004" to "2005"
+
+2005-01-12 Richard Williamson <rjw@apple.com>
+
+ Avoid additional work on dealloc by adding early out to
+ removeNativeReference(). (This will save time on dealloc
+ for all ObjC DOM objects.)
+
+ Reviewed by Darin.
+
+ * bindings/runtime_root.cpp:
+ (KJS::Bindings::removeNativeReference):
+
+2005-01-12 Richard Williamson <rjw@apple.com>
+
+ Fixed <rdar://problem/3923356> REGRESSION: Java/JavaScript security checks working incorrectly
+
+ We were always returning the first "root" object for all runtime
+ objects. Changed 0 in loop to i, the index.
+
+ Reviewed by David Harrison.
+
+ * bindings/runtime_root.cpp:
+ (KJS::Bindings::rootForImp):
+
+2005-01-11 Richard Williamson <rjw@apple.com>
+
+ Fixed <rdar://problem/3887930> Must use new Java plug-in API to get/set fields so exception handling works (fixes many LiveConnect crashes)
+
+ Use the new dispatching API to invoke JNI, rather than calling JNI
+ directly.
+
+ Reviewed by David Harrison.
+
+ * bindings/jni/jni_instance.cpp:
+ (JavaInstance::invokeMethod):
+ * bindings/jni/jni_runtime.cpp:
+ (JavaField::dispatchValueFromInstance):
+ (JavaField::valueFromInstance):
+ (JavaField::dispatchSetValueToInstance):
+ (JavaField::setValueToInstance):
+ * bindings/jni/jni_runtime.h:
+ * bindings/jni/jni_utility.cpp:
+ (KJS::Bindings::convertValueToJValue):
+
+=== Safari-178 ===
+
+=== Safari-177 ===
+
+=== Safari-176 ===
+
+2004-12-17 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Kevin.
+
+ <rdar://problem/3926869> Opening caches window after running PLT causes crash
+
+ * kjs/protected_values.cpp:
+ (KJS::ProtectedValues::getProtectCount): Don't include simple numbers in
+ the protected value table.
+ (KJS::ProtectedValues::increaseProtectCount): Ditto.
+ (KJS::ProtectedValues::decreaseProtectCount): Ditto.
+
+2004-12-16 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - fixed <rdar://problem/3920764> Unimplemented String methods toLocaleLowerCase and toLocaleUpperCase
+
+ * kjs/string_object.h: Added toLocaleLowerCase and toLocaleUpperCase.
+ * kjs/string_object.cpp: (StringProtoFuncImp::call): Made locale versions be synonmyms for the
+ non-locale-specific versions.
+ * kjs/string_object.lut.h: Regenerated.
+
+2004-12-14 Richard Williamson <rjw@apple.com>
+
+ Pass URL of plugin view when call into JNI.
+
+ Reviewed by Chris.
+
+ * bindings/jni/jni_objc.mm:
+ (KJS::Bindings::dispatchJNICall):
+
+2004-12-13 Richard Williamson <rjw@apple.com>
+
+ Fixed <rdar://problem/3827799> repro. crash with IBM Rational ClearCase Web under Safari (Java/LiveConnect-related)
+
+ Add support for calling static Java methods from JavaScript.
+
+ Reviewed by Maciej.
+
+ * bindings/jni/jni_instance.cpp:
+ (JavaInstance::invokeMethod):
+ * bindings/jni/jni_runtime.cpp:
+ (JavaMethod::JavaMethod):
+ * bindings/jni/jni_runtime.h:
+ (KJS::Bindings::JavaMethod::isStatic):
+ * bindings/jni/jni_utility.cpp:
+ (callJNIStaticMethod):
+ (KJS::Bindings::callJNIBooleanMethod):
+ (KJS::Bindings::callJNIStaticBooleanMethod):
+ * bindings/jni/jni_utility.h:
+
+2004-12-13 Richard Williamson <rjw@apple.com>
+
+ Fixed <rdar://problem/3887767> LiveConnect doesn't propagate Java exceptions back to JavaScript (prevents security suite from running)
+
+ Reviewed by John.
+
+ * bindings/jni/jni_instance.cpp:
+ (JavaInstance::invokeMethod):
+ * bindings/jni/jni_objc.mm:
+ (KJS::Bindings::dispatchJNICall):
+ * bindings/jni/jni_runtime.h:
+ * bindings/jni/jni_utility.h:
+
+=== Safari-175 ===
+
+2004-12-07 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin.
+
+ <rdar://problem/3908017> REGRESSION (172-173): assertion in ObjectImp::construct trying to create JS error (24hourfitness.com)
+
+ The fix was to implement copy constructor and assignment operator,
+ the ones that worked on the base class did not replace the
+ defaults apparently!
+
+ * kjs/protect.h:
+ (KJS::ProtectedValue::ProtectedValue):
+ (KJS::ProtectedValue::operator=):
+ (KJS::ProtectedObject::ProtectedObject):
+ (KJS::ProtectedObject::operator=):
+
+ Also fixed a bug in the GC test mode that compares the results of
+ the old collector and the new collector.
+
+ * kjs/value.cpp:
+ (ValueImp::mark):
+
+=== Safari-173 ===
+
+2004-11-23 Richard Williamson <rjw@apple.com>
+
+ Fixed <rdar://problem/3890385> field and method cache incorrectly capped (c bindings)
+
+ Reviewed by Ken.
+
+ * bindings/c/c_class.cpp:
+ (CClass::_commonInit):
+
+2004-11-21 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Ken.
+
+ <rdar://problem/3889696> Enable conservative garbage collection for JavaScript
+
+ * kjs/collector.cpp:
+ (KJS::Collector::Thread::Thread):
+ (KJS::destroyRegisteredThread):
+ (KJS::initializeRegisteredThreadKey):
+ (KJS::Collector::registerThread):
+ (KJS::Collector::markStackObjectsConservatively):
+ (KJS::Collector::markCurrentThreadConservatively):
+ (KJS::Collector::markOtherThreadConservatively):
+ * kjs/collector.h:
+ * kjs/internal.cpp:
+ (lockInterpreter):
+ * kjs/value.h:
+
+=== Safari-172 ===
+
+2004-11-15 Richard Williamson <rjw@apple.com>
+
+ Fixed <rdar://problem/3880561> Default string value of ObjC object in JS should be [obj description].
+
+ Reviewed by Hyatt.
+
+ * bindings/objc/objc_instance.mm:
+ (ObjcInstance::stringValue):
+ * bindings/objc/objc_utility.h:
+ * bindings/objc/objc_utility.mm:
+ (KJS::Bindings::convertNSStringToString):
+ (KJS::Bindings::convertObjcValueToValue):
+
+=== Safari-171 ===
+
+2004-11-09 Chris Blumenberg <cblu@apple.com>
+
+ Fixed: <rdar://problem/3872724> soft link against JavaVM to save ~2MB RSHRD
+
+ Reviewed by rjw.
+
+ * ChangeLog:
+ * JavaScriptCore.pbproj/project.pbxproj: don't link against JavaVM
+ * bindings/softlinking.c: Added.
+ (loadFramework): new
+ (getFunctionPointer): new
+ (JNI_GetCreatedJavaVMs): load JavaVM if not already loaded, get _JNI_GetCreatedJavaVMs symbol if we don't already have it, call JNI_GetCreatedJavaVMs
+
+=== Safari-170 ===
+
+2004-11-04 Darin Adler <darin@apple.com>
+
+ Reviewed by Ken.
+
+ - fixed <rdar://problem/3865365> since -[WebScriptObject dealloc] does not call [super dealloc], the build will fail due to a warning
+ - fixed behavior so that [[WebScriptObject alloc] initWithCoder:] doesn't leak WebUndefined instances
+ and incidentally so that [[WebScriptObject alloc] init] returns the single shared instance rather
+ than allocating a new one
+
+ * bindings/objc/WebScriptObject.mm: Removed some stray semicolons.
+ (+[WebUndefined allocWithZone:]): Made this the common bottleneck that returns the single instance
+ of WebUndefined, since it's the single method that normally allocates new instances. Calls super to
+ actually allocate only the very first time it's called.
+ (-[WebUndefined initWithCoder:]): Simplified to just return self (no reason to re-lookup the single
+ shared instance since there can be only one).
+ (-[WebUndefined copyWithZone:]): Ditto.
+ (-[WebUndefined retain]): Ditto.
+ (-[WebUndefined retainCount]): Use UINT_MAX constant here (matches usage in NSObject.m for retain count
+ of class).
+ (-[WebUndefined autorelease]): Simplified to just return self (see above).
+ (-[WebUndefined copy]): No need to override this since it just turns around and calls copyWithZone:.
+ (-[WebUndefined dealloc]): Added an assertion since this method should never be called. Also added
+ a call to [super dealloc] after return; to make the new -Wdealloc-check compiler happy (fixing the
+ bug mentioned above).
+ (+[WebUndefined undefined]): Reimplemented; calls allocWithZone:NULL to get to the shared instance.
+ No need to call init, since that's a no-op for this class.
+
+2004-11-03 David Harrison <harrison@apple.com>
+
+ Reviewed by Darin.
+
+ Eliminate the use of a marker file to determine how to build.
+
+ * .cvsignore:
+ * Makefile.am:
+
+2004-11-01 Richard Williamson <rjw@apple.com>
+
+ Fixed <rdar://problem/3861469> Latest Real player crashes Safari on some sites.
+
+ Reviewed by Ken.
+
+ * bindings/c/c_instance.cpp:
+ (CInstance::invokeMethod):
+ (CInstance::invokeDefaultMethod):
+ Initialize out parameters to void type.
+
+ * bindings/c/c_runtime.cpp:
+ (CField::valueFromInstance):
+ (CField::setValueToInstance):
+ Initialize out parameters to void type.
+ Also added additional checks to protect against classes that
+ don't implement all functions.
+
+2004-11-01 Richard Williamson <rjw@apple.com>
+
+ Fixed <rdar://problem/3861257> WebUndefined should be returned for undefined values
+
+ Reviewed by John.
+
+ * ChangeLog:
+ * bindings/objc/WebScriptObject.mm:
+ (+[WebScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
+ Added additional conversion Undefined -> WebUndefined.
+ * bindings/objc/objc_utility.mm:
+ (KJS::Bindings::convertObjcValueToValue):
+ Added additional conversion WebUndefined -> Undefined.
+
+2004-11-01 Darin Adler <darin@apple.com>
+
+ - fixed <rdar://problem/3855573> Remove reference to "WebScriptMethods" from WebScriptObject.h comments
+
+ * bindings/objc/WebScriptObject.h: Removed unneeded #ifdef protection for multiple includes (since
+ this is an Objective-C header and we use #import for those). Fixed comments as requested in the bug
+ report to match the contents of the file.
+
+=== Safari-169 ===
+
+=== Safari-168 ===
+
+2004-10-22 Ken Kocienda <kocienda@apple.com>
+
+ Reviewed by me
+
+ * JavaScriptCore.pbproj/project.pbxproj:
+ Add GCC_ENABLE_OBJC_GC and GCC_FAST_OBJC_DISPATCH flags.
+
+=== Safari-167 ===
+
+2004-10-13 Richard Williamson <rjw@apple.com>
+
+ Moved boolean checks prior to NSNumber checks. booleans are
+ NSNumbers.
+
+ Follow on to <rdar://problem/3821515> binding layer needs to convert NSNumber-bools to js type boolean not number.
+
+ Reviewed by John.
+
+ * bindings/objc/objc_utility.mm:
+ (KJS::Bindings::convertObjcValueToValue):
+
+2004-10-12 Richard Williamson <rjw@apple.com>
+
+ Fixed access to DOM object via WebScriptObject API.
+ The execution context for DOM objects wasn't being found.
+ <rdar://problem/3831372> The valueForKey method for @"offsetLeft" on a paragraph element causes a crash.
+
+ Reviewed by Chris.
+
+ * bindings/objc/WebScriptObject.mm:
+ (_didExecute):
+ (-[WebScriptObject KJS::Bindings::]):
+ (-[WebScriptObject callWebScriptMethod:withArguments:]):
+ (-[WebScriptObject evaluateWebScript:]):
+ (-[WebScriptObject setValue:forKey:]):
+ (-[WebScriptObject valueForKey:]):
+ (-[WebScriptObject stringRepresentation]):
+ * bindings/objc/WebScriptObjectPrivate.h:
+
+2004-10-09 Darin Adler <darin@apple.com>
+
+ Reviewed by Kevin.
+
+ - fixed <rdar://problem/3804661> REGRESSION: JavaScriptCore framework now has two init routines
+
+ * bindings/NP_jsobject.cpp: Fixed unnecessarily-complex globals set up that was
+ creating an init routine.
+
+ * kjs/ustring.cpp: Changed around the UString::Rep::empty construction to not
+ require a global constructor that creates an init routine.
+
+2004-10-09 Darin Adler <darin@apple.com>
+
+ Reviewed by Kevin.
+
+ - fixed <rdar://problem/3822618> REGRESSION (164-165): expedia.com's popup help doesn't work
+
+ * kjs/reference.cpp: (Reference::putValue): Change so that references not found in any object
+ work with the window object of the page the function is in, not the page of the caller. This
+ is what all other browsers do. This code was hidden before by the "everything is defined on
+ window object" hack in WebCore.
+
+2004-10-07 Richard Williamson <rjw@apple.com>
+
+ Added simple JavaScript call tracing. Very useful for
+ debugging complex pages.
+
+ Tracing is only available in development builds and is
+ enabled by:
+
+ (gdb) set traceJavaScript = 1
+
+ or programatically
+
+ setTraceJavaScript(true)
+
+ Function, args, and return values are printed to console. Very
+ verbose.
+
+ Reviewed by Ken.
+
+ * kjs/function_object.cpp:
+ (FunctionProtoFuncImp::call):
+ * kjs/object.cpp:
+ (KJS::Object::call):
+
+=== Safari-166 ===
+
+2004-10-05 Richard Williamson <rjw@apple.com>
+
+ Fixed <rdar://problem/3819234> NPN_SetException (and throwException:) isn't implemented
+
+ Reviewed by Chris.
+
+ * bindings/NP_jsobject.cpp:
+ (_NPN_SetException):
+ * bindings/npruntime.cpp:
+ (_NPN_SetExceptionWithUTF8):
+ * bindings/objc/WebScriptObject.mm:
+ (+[WebScriptObject throwException:]):
+ * kjs/internal.h:
+ (KJS::InterpreterImp::context):
+
+2004-10-05 Richard Williamson <rjw@apple.com>
+
+ Fixed <rdar://problem/3821515> binding layer needs to convert NSNumber-bools to js type boolean not number
+
+ Reviewed by Ken.
+
+ * bindings/objc/objc_utility.mm:
+ (KJS::Bindings::convertObjcValueToValue):
+
+2004-10-04 Darin Adler <darin@apple.com>
+
+ Reviewed by Ken.
+
+ - rolled in a fix the KDE folks did for the operations that generate HTML fragments
+
+ * kjs/string_object.cpp: (StringProtoFuncImp::call): Added quote marks to generated HTML.
+
+ - rolled out an old workaround we don't need any more
+
+ * JavaScriptCore.pbproj/project.pbxproj: Remove -Wno-long-double because the <math.h> issue that
+ required it is no longer there.
+
+2004-09-30 Richard Williamson <rjw@apple.com>
+
+ Fixed <rdar://problem/3821215> NPN hasMethod and hasProperty functions should take NPObjects, not NPClass
+
+ Reviewed by Chris.
+
+ * bindings/NP_jsobject.cpp:
+ (_NPN_GetProperty):
+ (_NPN_HasProperty):
+ (_NPN_HasMethod):
+ * bindings/c/c_class.cpp:
+ (CClass::methodsNamed):
+ (CClass::fieldNamed):
+ * bindings/c/c_class.h:
+ * bindings/c/c_instance.cpp:
+ (CInstance::invokeMethod):
+ * bindings/jni/jni_class.cpp:
+ (JavaClass::methodsNamed):
+ * bindings/jni/jni_class.h:
+ * bindings/npruntime.h:
+ * bindings/objc/objc_class.h:
+ * bindings/objc/objc_class.mm:
+ (ObjcClass::methodsNamed):
+ * bindings/runtime.h:
+ * bindings/runtime_object.cpp:
+ (RuntimeObjectImp::get):
+ (RuntimeObjectImp::hasProperty):
+
+2004-09-29 Chris Blumenberg <cblu@apple.com>
+
+ Prepended underscores to NPN methods so that when the QT plug-in loads these symbols, it uses the non-underscore versions in WebKit. Without this, the QT plug-in was failing to load when launching Safari from the command-line.
+
+ Reviewed by rjw.
+
+ * JavaScriptCore.pbproj/project.pbxproj:
+ * bindings/NP_jsobject.cpp:
+ (_NPN_CreateScriptObject):
+ (_NPN_InvokeDefault):
+ (_NPN_Invoke):
+ (_NPN_Evaluate):
+ (_NPN_GetProperty):
+ (_NPN_SetProperty):
+ (_NPN_RemoveProperty):
+ (_NPN_HasProperty):
+ (_NPN_HasMethod):
+ * bindings/c/c_class.cpp:
+ (CClass::methodsNamed):
+ (CClass::fieldNamed):
+ * bindings/c/c_instance.cpp:
+ (CInstance::CInstance):
+ (CInstance::~CInstance):
+ (CInstance::operator=):
+ (CInstance::invokeMethod):
+ (CInstance::invokeDefaultMethod):
+ * bindings/c/c_runtime.cpp:
+ * bindings/c/c_runtime.h:
+ (KJS::Bindings::CField::name):
+ (KJS::Bindings::CMethod::name):
+ * bindings/npruntime.cpp:
+ (_NPN_GetStringIdentifier):
+ (_NPN_GetStringIdentifiers):
+ (_NPN_GetIntIdentifier):
+ (_NPN_IdentifierIsString):
+ (_NPN_UTF8FromIdentifier):
+ (_NPN_IntFromIdentifier):
+ (NPN_InitializeVariantWithObject):
+ (_NPN_ReleaseVariantValue):
+ (_NPN_CreateObject):
+ (_NPN_RetainObject):
+ (_NPN_ReleaseObject):
+ (_NPN_SetExceptionWithUTF8):
+ (_NPN_SetException):
+
+2004-09-26 Darin Adler <darin@apple.com>
+
+ * kjs/string_object.cpp: (StringProtoFuncImp::call): Remove strange use of high() and
+ low() to get Unicode value of character, and just use unicode().
+
+2004-09-26 Darin Adler <darin@apple.com>
+
+ - refine charAt/charCodeAt fix slightly
+
+ * kjs/string_object.cpp: (StringProtoFuncImp::call): Treat undefined the same was as an
+ omitted parameter, as we do everywhere else, and as other browsers do here.
+
+2004-09-26 Darin Adler <darin@apple.com>
+
+ Reviewed by Kevin.
+
+ - fixed <rdar://problem/3816097> REGRESSION: mailblocks, and presumably many other pages, failing because variable not found
+
+ * kjs/internal.cpp: (InterpreterImp::evaluate): Process variable declarations before executing
+ the program. We were doing this properly for functions, but not entire programs.
+
+ - fixed <rdar://problem/3814706> REGRESSION: text fields in mailblocks wizards do not accept keystrokes due to use of charCodeAt()
+
+ * kjs/string_object.cpp: (StringProtoFuncImp::call): Changed the implementation of charAt
+ and charCodeAt to treat a missing parameter as an index of 0, rather than an invalid index.
+
+ * tests/mozilla/expected.html: Update for two tests that now pass with these changes.
+
+=== Safari-165 ===
+
+=== Safari-164 ===
+
+2004-09-14 Richard Williamson <rjw@apple.com>
+
+ 1. Add class parameter to object allocation function. This is somewhat redundant, given that
+ the allocation function is in the class function vector, but people wanted to use the same
+ allocation function for different classes.
+
+ 2. Renamed NPN_Class to NPN_Invoke to match the name in the function vector.
+
+ 3. Add support for a default function on an object. This is a feature that ActiveX supports,
+ and will allow JavaScript code to be written that will look exactly the same for both ActiveX
+ plugins and Netscape or WebKit plugins. There are implementations included for the 'C' and
+ 'Objective-C' bindings.
+
+ There bugs are covered by
+
+ <rdar://problem/3776343> Support for default functions in the JavaScript bindings
+ <rdar://problem/3779186> NPN_Call needs to be renamed to NPN_Invoke
+ <rdar://problem/3674754> Need to implement latest npruntime.h
+
+ Reviewed by John.
+
+ * bindings/NP_jsobject.cpp:
+ (jsAllocate):
+ (NPN_InvokeDefault):
+ (NPN_Invoke):
+ * bindings/c/c_class.cpp:
+ * bindings/c/c_instance.cpp:
+ (CInstance::CInstance):
+ (CInstance::operator=):
+ (CInstance::invokeMethod):
+ (CInstance::invokeDefaultMethod):
+ * bindings/c/c_instance.h:
+ * bindings/c/c_runtime.cpp:
+ * bindings/c/c_runtime.h:
+ * bindings/jni/jni_instance.cpp:
+ (JavaInstance::invokeDefaultMethod):
+ * bindings/jni/jni_instance.h:
+ * bindings/npruntime.cpp:
+ (NPN_CreateObject):
+ * bindings/npruntime.h:
+ * bindings/objc/WebScriptObject.h:
+ * bindings/objc/objc_class.mm:
+ (ObjcClass::fallbackObject):
+ * bindings/objc/objc_instance.h:
+ * bindings/objc/objc_instance.mm:
+ (ObjcInstance::invokeDefaultMethod):
+ * bindings/objc/objc_runtime.h:
+ * bindings/objc/objc_runtime.mm:
+ (ObjcFallbackObjectImp::ObjcFallbackObjectImp):
+ (ObjcFallbackObjectImp::get):
+ (ObjcFallbackObjectImp::put):
+ (ObjcFallbackObjectImp::canPut):
+ (ObjcFallbackObjectImp::implementsCall):
+ (ObjcFallbackObjectImp::call):
+ (ObjcFallbackObjectImp::hasProperty):
+ (ObjcFallbackObjectImp::deleteProperty):
+ (ObjcFallbackObjectImp::defaultValue):
+ * bindings/runtime.h:
+ (KJS::Bindings::Class::fallbackObject):
+ (KJS::Bindings::Instance::getValueOfUndefinedField):
+ (KJS::Bindings::Instance::setValueOfUndefinedField):
+ (KJS::Bindings::Instance::valueOf):
+ * bindings/runtime_object.cpp:
+ (RuntimeObjectImp::implementsCall):
+ (RuntimeObjectImp::call):
+ * bindings/runtime_object.h:
+
+2004-09-13 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin.
+
+ <rdar://problem/3794735> Gmail- sending a very long message with Safari is so slow it seems like a hang
+
+ * kjs/string_object.cpp:
+ (StringProtoFuncImp::call): Replaced implementation of replace()
+ method with function below...
+ (replace): In order to avoid excessive allocation and copying,
+ figure out the ranges of the original string and replacement
+ strings to be assembled, instead of constantly creating new
+ strings at each substitution. The old behavior is basically O(N^2)
+ for a global replace on a pattern that matches many places in the
+ string.
+ (regExpIsGlobal): Helper function for the above.
+ (expandSourceRanges): ditto
+ (pushSourceRange): ditto
+ (expandReplacements): ditto
+ (pushReplacement): ditto
+ * kjs/ustring.cpp:
+ (KJS::UString::spliceSubstringsWithSeparators): New method that
+ pieces together substring ranges of this string together with
+ specified separators, all at one go.
+ * kjs/ustring.h:
+ (KJS::UString::Range::Range): Added new helper class to represent
+ substring choices.
+
+2004-09-14 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin.
+
+ - fixed <rdar://problem/3800315> encode-URI-test layout test is failing
+
+ * kjs/function.cpp:
+ (KJS::GlobalFuncImp::call): Make sure to escape null
+ characters. This is a bug in the new code that made part of the
+ test fail.
+
+2004-09-13 Darin Adler <darin@apple.com>
+
+ Reviewed by Kevin and Maciej.
+
+ - new function to support fix for DIG bug in WebCore
+
+ * kjs/scope_chain.h: Added new push function that pushes another entire scope chain.
+ * kjs/scope_chain.cpp: (KJS::ScopeChain::push): Ditto.
+
+2004-09-12 Darin Adler <darin@apple.com>
+
+ * tests/mozilla/expected.html: Updated test results for 3 more tests that pass with the new version
+ of escape and unescape.
+
+2004-09-12 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - fixed <rdar://problem/3798209> any non-ASCII characters are garbled in the result of toLocaleString
+
+ * kjs/date_object.cpp:
+ (formatLocaleDate): Replaced two old functions that used LongDateTime with this one new function that
+ uses CFDateFormatter.
+ (DateProtoFuncImp::call): Call the new formatLocaleDate instead of both formatLocaleDate and formatLocaleTime.
+
+2004-09-09 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Richard.
+
+ <rdar://problem/3493140> REGRESSION (85-100): cedille displays %-escaped in JavaScript message at hotmail.com
+
+ * kjs/function.cpp:
+ (KJS::GlobalFuncImp::call): Replace our escape() and unescape() implementations with
+ ones from KDE KJS, which have the proper latin-1 behavior to match Win IE.
+ * kjs/lexer.cpp:
+ (Lexer::isHexDigit): Made static and non-const.
+ * kjs/lexer.h:
+
+=== Safari-163 ===
+
+2004-09-06 Darin Adler <darin@apple.com>
+
+ * JavaScriptCore.pbproj/project.pbxproj: Bump MACOSX_DEPLOYMENT_TARGET to 10.3.
+
+=== Safari-162 ===
+
+2004-09-01 Richard Williamson <rjw@apple.com>
+
+ Add pid to exception messages (to help debug dashboard clients).
+
+ Reviewed by Chris.
+
+ * kjs/interpreter.cpp:
+ (Interpreter::evaluate):
+
+=== Safari-161 ===
+
+2004-08-20 Richard Williamson <rjw@apple.com>
+
+ Implemented new JNI abstraction. We no longer invoke Java methods
+ directly with JNI, rather we call into the plugin. This allows the
+ plugin to dispatch the call to the appropriate VM thread. This
+ change should (will?) fix a whole class of threading related problems with
+ the Java VM.
+
+ Reviewed by Hyatt.
+
+ * JavaScriptCore.pbproj/project.pbxproj:
+ * bindings/c/c_instance.h:
+ (KJS::Bindings::CInstance::setExecutionContext):
+ (KJS::Bindings::CInstance::executionContext):
+ * bindings/jni/jni_instance.cpp:
+ (JavaInstance::JavaInstance):
+ (JavaInstance::invokeMethod):
+ (JavaInstance::setExecutionContext):
+ (JavaInstance::executionContext):
+ * bindings/jni/jni_instance.h:
+ * bindings/jni/jni_jsobject.cpp:
+ (JSObject::convertJObjectToValue):
+ * bindings/jni/jni_runtime.cpp:
+ (JavaField::JavaField):
+ (JavaArray::convertJObjectToArray):
+ (JavaField::valueFromInstance):
+ (JavaArray::JavaArray):
+ (JavaArray::valueAt):
+ * bindings/jni/jni_runtime.h:
+ (KJS::Bindings::JavaArray::operator=):
+ (KJS::Bindings::JavaArray::executionContext):
+ * bindings/jni/jni_utility.h:
+ * bindings/objc/objc_instance.h:
+ (KJS::Bindings::ObjcInstance::setExecutionContext):
+ (KJS::Bindings::ObjcInstance::executionContext):
+ * bindings/runtime.cpp:
+ (Instance::createBindingForLanguageInstance):
+ * bindings/runtime.h:
+ * bindings/runtime_root.h:
+ (KJS::Bindings::RootObject::nativeHandle):
+
+=== Safari-158 ===
+
+2004-08-19 Vicki Murley <vicki@apple.com>
+
+ Reviewed by John.
+
+ * kjs/property_map.cpp:
+ (KJS::PropertyMap::put): initialize deletedElementIndex to zero, to make the compiler happy
+
+2004-08-17 Darin Adler <darin@apple.com>
+
+ Reviewed by Adele.
+
+ - fixed <rdar://problem/3746676> SAP WebDynpro app hangs inside JavaScript property map hash table code (deleted sentinel problem)
+
+ * kjs/property_map.h: Added some private functions.
+ * kjs/property_map.cpp:
+ (KJS::PropertyMap::clear): Set sentinelCount to 0.
+ (KJS::PropertyMap::put): Complete search for the element before choosing to use the deleted-element sentinel.
+ Also keep sentinel count up to date when we destroy a sentinel by overwriting with a new added element.
+ (KJS::PropertyMap::expand): Added. Calls rehash with a size 2x the old size, or 16.
+ (KJS::PropertyMap::rehash): Added. Refactored the rehash code into a separate function.
+ (KJS::PropertyMap::remove): Add one to sentinelCount, and rehash if 1/4 or more of the elements are
+ deleted-element sentinels.
+ (KJS::PropertyMap::checkConsistency): Check the sentinelCount.
+
+2004-08-16 Maciej Stachowiak <mjs@apple.com>
+
+ Code change by Eric Albert, reviewd by me.
+
+ <rdar://problem/3571960> washingtonpost.com claims I don't have cookies enabled and won't let me read articles
+
+ * kjs/date_object.cpp:
+ (timetUsingCF): Clamp time to LONG_MAX (getting rid of time_t
+ entirely would be even better, but is not required to fix this bug.
+
+=== Safari-157 ===
+
+2004-08-16 Richard Williamson <rjw@apple.com>
+
+ Fixed <rdar://problem/3581092> cash in KJS::Bindings::JSObject::eval at tcvetantcvetkov.com
+
+ Adds bullet proofing to protect against evaluation of bogus JS in all the flavors of bindings (Java, C, and ObjC).
+
+ Reviewed by Chris.
+
+ * bindings/NP_jsobject.cpp:
+ (NPN_Evaluate):
+ * bindings/jni/jni_jsobject.cpp:
+ (JSObject::eval):
+ * bindings/objc/WebScriptObject.mm:
+ (-[WebScriptObject evaluateWebScript:]):
+
+2004-08-15 Richard Williamson <rjw@apple.com>
+
+ More updates to np headers. Implemented new NPN functions.
+
+ Reviewed by Darin.
+
+ * bindings/NP_jsobject.cpp:
+ (NPN_HasProperty):
+ (NPN_HasMethod):
+ * bindings/npapi.h:
+ * bindings/npruntime.h:
+
+2004-08-13 Darin Adler <darin@apple.com>
+
+ - fix build so we can compile again
+
+ * bindings/npapi.h: Added. Richard forgot to check this in. The one I'm checking in here
+ is good enough so that we can compile, but it's only a stopgap measure, because I think
+ Richard has a newer one he wants to check in.
+
+2004-08-12 Richard Williamson <rjw@apple.com>
+
+ Bring npruntime.h and friends closer to compliance with
+ latest spec.
+
+ Reviewed by Maciej.
+
+ * JavaScriptCore.pbproj/project.pbxproj:
+ * bindings/NP_jsobject.cpp:
+ (jsAllocate):
+ (_NPN_CreateScriptObject):
+ (NPN_Call):
+ (NPN_Evaluate):
+ (NPN_GetProperty):
+ (NPN_SetProperty):
+ (NPN_RemoveProperty):
+ * bindings/NP_jsobject.h:
+ * bindings/c/c_instance.cpp:
+ (CInstance::invokeMethod):
+ * bindings/c/c_utility.cpp:
+ (convertNPVariantToValue):
+ * bindings/npruntime.cpp:
+ (NPN_IdentifierIsString):
+ (NPN_VariantIsVoid):
+ (NPN_VariantIsNull):
+ (NPN_VariantIsUndefined):
+ (NPN_VariantIsBool):
+ (NPN_VariantIsInt32):
+ (NPN_VariantIsDouble):
+ (NPN_VariantIsString):
+ (NPN_VariantIsObject):
+ (NPN_VariantToBool):
+ (NPN_VariantToString):
+ (NPN_VariantToInt32):
+ (NPN_VariantToDouble):
+ (NPN_VariantToObject):
+ (NPN_InitializeVariantAsVoid):
+ (NPN_InitializeVariantAsNull):
+ (NPN_InitializeVariantAsUndefined):
+ (NPN_InitializeVariantWithBool):
+ (NPN_InitializeVariantWithInt32):
+ (NPN_InitializeVariantWithDouble):
+ (NPN_InitializeVariantWithString):
+ (NPN_InitializeVariantWithStringCopy):
+ (NPN_InitializeVariantWithObject):
+ (NPN_InitializeVariantWithVariant):
+ (NPN_ReleaseVariantValue):
+ (NPN_CreateObject):
+ * bindings/npruntime.h:
+ (_NPString::):
+ (_NPString::_NPVariant::):
+ * bindings/npruntime_priv.h: Added.
+
+2004-08-12 Darin Adler <darin@apple.com>
+
+ Reviewed by Adele.
+
+ - fixed 3 problems with parse functions that I just wrote, fixing 3 more Mozilla JavaScript tests
+
+ * kjs/function.cpp:
+ (KJS::parseDigit): Fix typo, 'Z' instead of 'z', that prevented lowercase hex digits from working.
+ (KJS::parseInt): Add octal support. Specification says it's optional, but I guess not.
+ (KJS::parseFloat): Fix check for "0x" in parseFloat to return 0 rather than NaN. Also add code
+ to skip leading "+" or "-".
+
+=== Safari-156 ===
+
+2004-08-12 Darin Adler <darin@apple.com>
+
+ Reviewed by Ken.
+
+ - fixed 43 Mozilla JavaScript tests
+
+ * kjs/date_object.h: Change parseDate and timeClip to take and return doubles.
+ * kjs/date_object.cpp:
+ (DateObjectImp::construct): Change to use a timeClip function that takes and returns a double rather
+ than constructing a number object to pass to it.
+ (DateObjectFuncImp::call): Change to use a parseDate function that returns a double.
+ (KJS::parseDate): Change to return a double instead of creating the Number object here.
+ (KJS::timeClip): Implement this as specified in the language standard.
+
+ * kjs/error_object.cpp: (NativeErrorImp::NativeErrorImp): Set the DontDelete, ReadOnly, and DontEnum
+ flags on the prototype property.
+
+ * kjs/function.cpp:
+ (KJS::FunctionImp::get): Return null rather than undefined for arguments when the function is not
+ currently in scope.
+ (KJS::isStrWhiteSpace): Added. Matches specification for StrWhiteSpace. Could move it to some utility
+ file later.
+ (KJS::parseDigit): Added. Helper function for parseInt.
+ (KJS::parseInt): Added. Integer parser that puts result in a double so we're not limited to what
+ strtoll can handle. Also matches standard more closely.
+ (KJS::parseFloat): Added. Handles "0x" properly and passes flag to make empty string turn into NaN
+ instead of 0.
+ (KJS::GlobalFuncImp::call): Use the new parseInt and parseFloat.
+
+ * kjs/function_object.cpp: (FunctionPrototypeImp::FunctionPrototypeImp): Add a length property.
+
+ * kjs/lexer.h: Added error flag and sawError() function for detecting errors.
+ * kjs/lexer.cpp:
+ (Lexer::setCode): Clear error state.
+ (Lexer::lex): Set error state if the lexer encounters an error
+
+ * kjs/internal.cpp:
+ (NumberImp::toString): Roll in change from KDE version to special case 0 so we handle -0 correctly.
+ (Parser::parse): Use new lexer error method so those errors are treated like parser errors.
+
+ * kjs/math_object.cpp: (MathFuncImp::call): Change min and max to treat -0 as less than +0.
+ Change round to round values between -0.5 and -0 to -0 instead of +0.
+
+ * kjs/nodes.h: Add evaluateReference function to GroupNode.
+ * kjs/nodes.cpp: (GroupNode::evaluateReference): Pass references through groups (parenthesized
+ expressions) properly so that expressions like "delete (x.y)" work. Before, the parentheses
+ would change x.y into a value that can't be deleted as a side effect.
+
+ * kjs/string_object.cpp: Change parameter count for indexOf and lastIndexOf from 2 to 1 to match
+ the specification.
+
+ * kjs/testkjs.cpp: Rolled in changes from KDE to add a "quit" function to the test tool and
+ get rid of the fixed size limit for code.
+
+ * kjs/ustring.cpp: (KJS::UString::substr): Added optimized case for substr(0, length) so it just
+ returns the string without creating a new Rep, since I'm using substr in a place where it will
+ often be passed a 0.
+
+ * tests/mozilla/ecma/String/15.5.4.11-1.js: Fixed one wrong entry in the Unicode table I added to
+ the other day that was making a couple tests fail.
+ * tests/mozilla/ecma/String/15.5.4.12-1.js: Ditto.
+ * tests/mozilla/ecma/String/15.5.4.12-2.js: Ditto.
+ * tests/mozilla/ecma/String/15.5.4.12-3.js: Ditto.
+ * tests/mozilla/ecma/String/15.5.4.12-4.js: Ditto.
+ * tests/mozilla/ecma/String/15.5.4.12-5.js: Ditto.
+
+ * kjs/string_object.lut.h: Regenerated.
+
+2004-08-11 Darin Adler <darin@apple.com>
+
+ - fixed a tiny problem with the UTF-16 PCRE check-in
+
+ * pcre/maketables.c: (pcre_maketables): Fix mistake in table-generating code that sometimes caused
+ the ctype_meta flag to get set in items that should not have it.
+
+ * pcre/chartables.c: Regenerated.
+
+2004-08-10 Richard Williamson <rjw@apple.com>
+
+ Fixed <rdar://problem/3674747> Need to implement invokeUndefinedMethodFromWebScript:withArguments:
+
+ The following WebScripting methods are now supported on bound
+ objects:
+
+ - (id)invokeUndefinedMethodFromWebScript:(NSString *)name withArguments:(NSArray *)args;
+ - (void)setValue:(id)value forUndefinedKey:(NSString *)key
+ - (id)valueForUndefinedKey:(NSString *)key
+
+ Reviewed by Chris.
+
+ * bindings/c/c_class.cpp:
+ (CClass::fieldNamed):
+ * bindings/c/c_class.h:
+ * bindings/jni/jni_class.cpp:
+ (JavaClass::fieldNamed):
+ * bindings/jni/jni_class.h:
+ * bindings/objc/objc_class.h:
+ (KJS::Bindings::ObjcClass::isa):
+ * bindings/objc/objc_class.mm:
+ (ObjcClass::methodsNamed):
+ (ObjcClass::fieldNamed):
+ (ObjcClass::fallbackObject):
+ * bindings/objc/objc_instance.h:
+ * bindings/objc/objc_instance.mm:
+ (ObjcInstance::invokeMethod):
+ (ObjcInstance::setValueOfField):
+ (ObjcInstance::setValueOfUndefinedField):
+ (ObjcInstance::getValueOfField):
+ (ObjcInstance::getValueOfUndefinedField):
+ * bindings/objc/objc_runtime.h:
+ (KJS::Bindings::ObjcField::~ObjcField):
+ (KJS::Bindings::ObjcField::ObjcField):
+ (KJS::Bindings::ObjcField::operator=):
+ (KJS::Bindings::FallbackObjectImp::classInfo):
+ * bindings/objc/objc_runtime.mm:
+ (ObjcField::ObjcField):
+ (ObjcField::name):
+ (ObjcField::type):
+ (ObjcField::valueFromInstance):
+ (ObjcField::setValueToInstance):
+ (FallbackObjectImp::FallbackObjectImp):
+ (FallbackObjectImp::get):
+ (FallbackObjectImp::put):
+ (FallbackObjectImp::canPut):
+ (FallbackObjectImp::implementsCall):
+ (FallbackObjectImp::call):
+ (FallbackObjectImp::hasProperty):
+ (FallbackObjectImp::deleteProperty):
+ (FallbackObjectImp::defaultValue):
+ * bindings/runtime.h:
+ (KJS::Bindings::Class::fallbackObject):
+ (KJS::Bindings::Instance::getValueOfUndefinedField):
+ (KJS::Bindings::Instance::setValueOfUndefinedField):
+ * bindings/runtime_object.cpp:
+ (RuntimeObjectImp::get):
+ (RuntimeObjectImp::put):
+ (RuntimeObjectImp::canPut):
+ (RuntimeObjectImp::hasProperty):
+ * bindings/testbindings.mm:
+ (-[MyFirstInterface valueForUndefinedKey:]):
+ (-[MyFirstInterface setValue:forUndefinedKey:]):
+
+2004-08-10 Darin Adler <darin@apple.com>
+
+ Reviewed by Dave.
+
+ - switch PCRE to do UTF-16 directly instead of converting to/from UTF-8 for speed
+
+ * pcre/pcre.h: Added PCRE_UTF16 switch, set to 1. Added pcre_char typedef, which is char
+ or uint16_t depending on the mode, and used appropriate in the 7 public functions
+ that need to use it.
+ * pcre/pcre.c: Add UTF-16 support to all functions.
+ * pcre/study.c: Ditto.
+
+ * pcre/internal.h: Added ichar typedef, which is unsigned char or uint16_t depending on
+ the mode. Changed declarations to use symbolic constants and typedefs so we size
+ things to ichar when needed.
+
+ * pcre/maketables.c: (pcre_maketables): Change code to make tables that are
+ sized to 16-bit characters instead of 8-bit.
+
+ * pcre/get.c:
+ (pcre_copy_substring): Use pcre_char instead of char.
+ (pcre_get_substring_list): Ditto.
+ (pcre_free_substring_list): Ditto.
+ (pcre_get_substring): Ditto.
+ (pcre_free_substring): Ditto.
+
+ * pcre/dftables.c: (main): Used a bit more const, and use ICHAR sizes instead
+ of hard-coding 8-bit table sizes.
+
+ * pcre/chartables.c: Regenerated.
+
+ * kjs/ustring.h: Remove functions that convert UTF-16 to/from UTF-8 offsets.
+ * kjs/ustring.cpp: Change the shared empty string to have a unicode pointer that
+ is not null. The null string still has a null pointer. This prevents us from
+ passing a null through to the regular expression engine (which results in a null
+ error even when the string length is 0).
+
+ * kjs/regexp.cpp:
+ (KJS::RegExp::RegExp): Null-terminate the pattern and pass it.
+ (KJS::RegExp::match): Use the 16-bit string directly, no need to convert to UTF-8.
+
+2004-08-09 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - fixed 28 Mozilla JavaScript tests
+
+ * kjs/array_object.cpp: (ArrayProtoFuncImp::call): Check for undefined rather than
+ checking the number of arguments for the join method.
+
+ * kjs/lexer.cpp: (Lexer::lex): Parse hexadecimal and octal constants in doubles rather
+ than integers, so we aren't limited to 32 bits.
+
+ * kjs/math_object.cpp: (MathFuncImp::call): Get rid of many unneeded special cases in
+ the implementation of the pow operation. Also simplied a case that was handling positive
+ and negative infinity separately.
+
+ * kjs/nodes.cpp: (ShiftNode::evaluate): Keep the result of shifts in a double instead of
+ putting them in a long, so that unsigned shift will work properly.
+
+ * kjs/number_object.cpp: Add the DontDelete and ReadOnly flags to the numeric constants.
+
+ * kjs/operations.cpp:
+ (KJS::isPosInf): Added an implementation inside APPLE_CHANGES that does not depend on the
+ sign of isinf; our isinf function returns +1 even for negative infinity.
+ (KJS::isNegInf): And again.
+ (KJS::relation): Put in a nice simple implementation of comparison inside APPLE_CHANGES.
+ Our floating point already handles the various infinity cases correctly.
+
+ * kjs/regexp_object.cpp:
+ (RegExpProtoFuncImp::call): Add missing return before Null() in Exec method.
+ (RegExpObjectImp::arrayOfMatches): Put undefined rather than an empty string into the
+ array in cases where we did not match.
+ (RegExpObjectImp::construct): Set the DontDelete, ReadOnly, and DontEnum flags for
+ "global", "ignoreCase", "multiline", and "source".
+
+ * kjs/string_object.cpp: (StringProtoFuncImp::call): For the match method, turn a null
+ string into undefined rather than an empty string. For the slice method, handle an
+ undefined parameter for the limit properly as decribed in the specification, and add
+ the limit to one case that didn't have the limit at all. For the methods that generate
+ HTML strings, use lowercase tags instead of uppercase.
+
+ * kjs/ustring.cpp:
+ (KJS::UChar::toLower): Use u_tolower from the ICU library.
+ (KJS::UChar::toUpper): Use u_toupper from the ICU library.
+ (KJS::UString::append): Fix some math that caused a buffer overflow.
+ (KJS::convertUTF16OffsetsToUTF8Offsets): Ignore negative numbers (-1 is used as a special
+ flag) rather than converting them all to 0.
+ (KJS::convertUTF8OffsetsToUTF16Offsets): Ditto.
+
+ * tests/mozilla/jsDriver.pl: Fixed the relative links to point to our actual test files.
+
+ * tests/mozilla/ecma/String/15.5.4.11-1.js: Fixed the Unicode table in this test to match
+ the Unicode specification in a few cases where it was wrong before.
+ * tests/mozilla/ecma/String/15.5.4.11-2.js: Ditto.
+ * tests/mozilla/ecma/String/15.5.4.11-3.js: Ditto.
+ * tests/mozilla/ecma/String/15.5.4.11-5.js: Ditto.
+ * tests/mozilla/ecma/String/15.5.4.11-6.js: Ditto.
+ * tests/mozilla/ecma/String/15.5.4.12-1.js: Ditto.
+ * tests/mozilla/ecma/String/15.5.4.12-2.js: Ditto.
+ * tests/mozilla/ecma/String/15.5.4.12-3.js: Ditto.
+ * tests/mozilla/ecma/String/15.5.4.12-4.js: Ditto.
+ * tests/mozilla/ecma/String/15.5.4.12-5.js: Ditto.
+
+ * JavaScriptCore.pbproj/project.pbxproj: Link to libicu.
+
+ * kjs/number_object.lut.h: Regenerated.
+
+2004-08-09 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - fixed <rdar://problem/3753467> REGRESSION (137-138): reproducible buffer overrun in UString manipulation code
+
+ * kjs/ustring.cpp: (KJS::UString::append): Fix incorrect size computation. Without it
+ we get a buffer overflow.
+
+=== Safari-155 ===
+
+2004-08-05 Richard Williamson <rjw@apple.com>
+
+ Fixed part of 3674747. The QT guys need this for feature freeze.
+
+ This patch implements support for the
+
+ - (id)invokeUndefinedMethodFromWebScript:(NSString *)name withArguments:(NSArray *)args
+
+ method of objects bound to JavaScript.
+
+ Reviewed by John.
+
+ * ChangeLog:
+ * bindings/objc/objc_class.mm:
+ (ObjcClass::methodsNamed):
+ (ObjcClass::fieldNamed):
+ * bindings/objc/objc_instance.mm:
+ (ObjcInstance::invokeMethod):
+ * bindings/objc/objc_runtime.h:
+ (KJS::Bindings::ObjcMethod::~ObjcMethod):
+ (KJS::Bindings::ObjcMethod::isFallbackMethod):
+ (KJS::Bindings::ObjcMethod::javaScriptName):
+ * bindings/objc/objc_runtime.mm:
+ (ObjcMethod::ObjcMethod):
+ (ObjcMethod::getMethodSignature):
+ (ObjcMethod::setJavaScriptName):
+ * bindings/testbindings.mm:
+
+2004-08-04 Vicki Murley <vicki@apple.com>
+
+ Reviewed by mjs.
+
+ - fix <rdar://problem/3649789> SAP WebGUI has problems loading first page because of parse error
+
+ * kjs/lexer.cpp:
+ (Lexer::lex): if the current character is a '\' and the next character is a line terminator,
+ go to the next line and continue parsing the string (instead of failing). This matches
+ behavior in Mac IE and Mozilla.
+
+2004-08-03 Kevin Decker <kdecker@apple.com>
+
+ Reviewed by Darin.
+
+ Rolled in changes from the latest KJS sources that support additional
+ Number.prototype functions.
+
+ Specifically this patch covers the follow parts of the ECMA 3 spec:
+ 15.7.4.5, 15.7.4.6, and 15.7.4.7
+
+ Fixes:
+ <rdar://problem/3663716> missing Number.toFixed (and toPrecision, toExponential)
+ <rdar://problem/3749492> missing Number.toPrecision prototype implementation
+ <rdar://problem/3749591> missing Number.toExponential prototype implementation
+
+ * kjs/identifier.h: Added toFixed, toPrecision, and toExponential to the
+ list of supported identifiers (a macro).
+ * kjs/number_object.cpp: Implemented support for toFixed(), toPrecision(),
+ and toExponential().
+ (NumberPrototypeImp::NumberPrototypeImp):
+ (NumberProtoFuncImp::call):
+ * kjs/number_object.h: Added property names for toFixed, toPrecision,
+ and toExponential.
+ (KJS::NumberProtoFuncImp::):
+ * tests/mozilla/expected.html: Update results.
+
+2004-08-03 Darin Adler <darin@apple.com>
+
+ Reviewed by Ken.
+
+ - added support for copying RegExp objects so 7 more Mozilla regexp tests pass
+
+ * kjs/regexp_object.cpp: (RegExpObjectImp::construct): Check for case where
+ we are supposed to just copy the regular expression object, and do so.
+ Also tighten up arguments check to handle case where an actual "undefined"
+ is passed rather than just omitting an argument.
+
+ * tests/mozilla/expected.html: Update results.
+
+2004-08-02 Darin Adler <darin@apple.com>
+
+ * tests/mozilla/.cvsignore: Added.
+ * tests/mozilla/expected.html: Update results.
+
+2004-08-02 Darin Adler <darin@apple.com>
+
+ Reviewed by Ken.
+
+ - fixed RegExp.toString so 3 more Mozilla regexp tests pass
+
+ * kjs/regexp_object.cpp: (RegExpProtoFuncImp::call):
+ Append the flags here so more tests paseed.
+
+2004-08-02 Darin Adler <darin@apple.com>
+
+ Reviewed by Ken.
+
+ - fixed a couple things making 5 Mozilla regexp tests pass
+
+ * kjs/regexp_object.cpp: (RegExpProtoFuncImp::call): Implement toString
+ for the prototype.
+ (RegExpObjectImp::construct): Fix bug where the string "undefined" would
+ be used as the flags string when no parameter was passed.
+
+ * kjs/regexp_object.h: (KJS::RegExpPrototypeImp::classInfo):
+ Added a class info object for RegExp prototype so it can return
+ a string instead of raising an exception when converting to a string.
+
+ * tests/mozilla/expected.html: Update results.
+
+2004-08-02 Darin Adler <darin@apple.com>
+
+ Reviewed by Kevin.
+
+ - fix crashes in mozilla tests due to mishandling NaN
+
+ * kjs/array_object.cpp: (ArrayProtoFuncImp::call): Rerranged range checks after
+ calls to toInteger so that NaN will get turned into something that fits in an integer.
+ These were the ones John already fixed, but his fix used isnan and the new fix is
+ more efficient.
+
+ * kjs/number_object.cpp: (NumberProtoFuncImp::call): Rearranged radix range checks
+ after a call to toInteger to handle NaN properly. Also removed separate check
+ for undefined that's not needed.
+
+ * kjs/string_object.cpp: (StringProtoFuncImp::call): More of the same kinds of changes
+ as in the above two files, but for a lot more functions. Also changed one place with
+ an explicit check for undefined to instead just check isNaN.
+
+ * tests/mozilla/run-mozilla-tests: Changed to invoke jst using $SYMROOTS for people
+ like me who don't keep $SYMROOTS in their $PATH.
+
+=== Safari-154 ===
+
+=== Safari-153 ===
+
+2004-07-26 Kevin Decker <kdecker@apple.com>
+
+ Changes done by Darin, reviewed by Kevin.
+
+ - changed testkjs to build in Xcode rather than from Makefile
+
+ * .cvsignore: Removed obsolete files from this list.
+ * Makefile.am: Removed code to build testkjs; we do this in Xcode now.
+ Changed to build target "All" rather than default target. This makes us
+ build the testkjs test tool.
+ * dummy.cpp: Removed.
+ * kjs/.cvsignore: Removed obsolete files from this list, including
+ the testkjs tool, which is now built in the symroots directory.
+ * kjs/testkjs.cpp: Added copyright notice that was missing, since we have
+ changed this file. Also this has the nice side effect of causing the tool
+ to be rebuilt in the new location even if there are no other changes in
+ your tree when you check this out.
+ * tests/mozilla/run-mozilla-tests: Invoke perl explicitly so this works
+ without setting the execute bit on jsDriver.pl.
+
+2004-07-22 Kevin Decker <kdecker@apple.com>
+
+ Reviewed by Darin
+
+ Fixed <rdar://problem/3682340> (error console does not include source urls or line numbers of event exceptions).
+
+ * kjs/function_object.cpp:
+ (FunctionObjectImp::construct):
+ * kjs/function_object.h:
+ * kjs/object.cpp:
+ (KJS::ObjectImp::construct):
+ * kjs/object.h:
+ (KJS::Object::construct):
+
+2004-07-21 Darin Adler <darin@apple.com>
+
+ * bindings/npruntime.h: Fixed typo.
+
+2004-07-19 John Sullivan <sullivan@apple.com>
+
+ Reviewed by Maciej.
+
+ - bulletproofed array.slice() against NAN arguments. Harri noticed this
+ vulnerability in my patch for 3714644
+
+ * kjs/array_object.cpp:
+ (ArrayProtoFuncImp::call):
+ handle NAN parameters passed to slice() by clamping to 0 and length.
+
+2004-07-19 Richard Williamson <rjw@apple.com>
+
+ Fixed 3733349. Prevent Java applet callbacks into JavaScript after applet
+ has been destroyed.
+
+ Reviewed by John.
+
+ * bindings/jni/jni_jsobject.cpp:
+ (JSObject::invoke):
+ (JSObject::JSObject):
+
+2004-07-16 John Sullivan <sullivan@apple.com>
+
+ Reviewed by Maciej.
+
+ - fixed <rdar://problem/3714644> REGRESSION (125.8-146): bugzilla submit link
+ hangs browser with javascript
+
+ * kjs/array_object.cpp:
+ (ArrayProtoFuncImp::call):
+ Check for undefined type for args[0] the same way we were already checking
+ for args[1]. In this case, args was zero-length, but we were treating
+ args[0] like an integer anyway. Resulted in some code looping from a NAN
+ value to 4, taking approximately forever.
+
+ * JavaScriptCore.pbproj/project.pbxproj:
+ version wars
+
+=== Safari-152 ===
+
+2004-07-14 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by John.
+
+ <rdar://problem/3711474>: (REGRESSION (125-146): JavaScript 'toString(16)' is broken)
+ <rdar://problem/3644873>: (REGRESSION (125-140u): secondary list doesn't fill in at Southwest.com)
+
+ * kjs/number_object.cpp:
+ (NumberProtoFuncImp::call): Initialize radix from dradix, not from itself!
+
+2004-07-13 Kevin Decker <kdecker@apple.com>
+
+ Reviewed by kocienda.
+
+ - made testkjs and JavaScriptCore a subtarget of 'All'
+ - testkjs now builds in $SYMROOTS
+
+ * JavaScriptCore.pbproj/project.pbxproj:
+
+=== Safari-151 ===
+
+2004-06-24 Chris Blumenberg <cblu@apple.com>
+
+ Ignore .mode1 files in JavaScriptCore.pbproj
+
+ Reviewed by kocienda.
+
+ * JavaScriptCore.pbproj/.cvsignore:
+
+2004-06-23 Richard Williamson <rjw@apple.com>
+
+ Implemented changes for latest npruntime.h.
+
+ Reviewed by Chris.
+
+ * JavaScriptCore.pbproj/project.pbxproj:
+ * bindings/NP_jsobject.cpp:
+ (listFromVariantArgs):
+ (identiferFromNPIdentifier):
+ (_NPN_CreateScriptObject):
+ (NPN_Call):
+ (NPN_Evaluate):
+ (NPN_GetProperty):
+ (NPN_SetProperty):
+ (NPN_RemoveProperty):
+ * bindings/NP_jsobject.h:
+ * bindings/c/c_class.cpp:
+ (CClass::methodsNamed):
+ (CClass::fieldNamed):
+ * bindings/c/c_instance.cpp:
+ (CInstance::invokeMethod):
+ * bindings/c/c_utility.cpp:
+ (convertNPVariantToValue):
+ * bindings/c/c_utility.h:
+ * bindings/npruntime.cpp:
+ (stringIdentifierEqual):
+ (stringIdentifierHash):
+ (getStringIdentifierDictionary):
+ (intIdentifierEqual):
+ (intIdentifierHash):
+ (getIntIdentifierDictionary):
+ (NPN_GetStringIdentifier):
+ (NPN_GetStringIdentifiers):
+ (NPN_GetIntIdentifier):
+ (NPN_IdentifierIsString):
+ (NPN_UTF8FromIdentifier):
+ (NPN_VariantToInt32):
+ (NPN_VariantToDouble):
+ (NPN_SetException):
+ * bindings/npruntime.h:
+ * bindings/objc/WebScriptObject.mm:
+ (+[WebScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
+ * bindings/runtime_object.cpp:
+ (RuntimeObjectImp::~RuntimeObjectImp):
+ * bindings/runtime_root.cpp:
+ (KJS::Bindings::rootForInterpreter):
+ * bindings/testbindings.cpp:
+ (initializeIdentifiers):
+ (logMessage):
+ (setDoubleValue):
+ (setIntValue):
+ (setBooleanValue):
+
+=== JavaScriptCore-146.1 ===
+
+2004-06-16 Richard Williamson <rjw@apple.com>
+
+ Fixed <rdar://problem/3702287> Crash returning nil from bound ObjC
+
+ This turned out to be a show stopper for Dashboard. Accessing a nil
+ ObjC property from JS caused a crash. Similar to the problem
+ 3696112 fixed below.
+
+ Reviewed by Trey.
+
+ * bindings/objc/objc_runtime.mm:
+ (KJS::Bindings::ObjcField::valueFromInstance):
+
+=== Safari-146 ===
+
+2004-06-16 Richard Williamson <rjw@apple.com>
+
+ Fixed <rdar://problem/3696112>: nil from an Objective-C class seems to get wrapped as a JavaScript proxy that will not print.
+
+ This turned out to be a show stopper for Dashboard. We now
+ return Undefined() when nil is returned from a ObjC method
+ that returns an object type.
+
+ Reviewed by Maciej.
+
+ * bindings/objc/objc_utility.mm:
+ (KJS::Bindings::convertObjcValueToValue):
+
+=== Safari-145 ===
+
+2004-06-15 Richard Williamson <rjw@apple.com>
+
+ Fixed <rdar://problem/3695875>: Objective-C instances that are exported to JavaScript are too promiscuous
+
+ No longer need to check respondsToSelector: for
+ isSelectorExcludedFromWebScript: and isKeyExcludedFromWebScript:
+ because these now have a default implementation on NSObject.
+
+ Reviewed by Trey.
+
+ * bindings/objc/objc_class.mm:
+ (ObjcClass::methodsNamed):
+ (ObjcClass::fieldNamed):
+
+2004-06-14 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - fixed some things for GC that Patrick missed, or that happened after the branch
+
+ * bindings/objc/WebScriptObject.mm:
+ (-[WebScriptObject dealloc]): Moved removeNativeReference call here from private object.
+ (-[WebScriptObject finalize]): Added.
+
+ - added some missing nil checks
+
+ * bindings/objc/objc_instance.mm:
+ (ObjcInstance::ObjcInstance): Check for nil.
+ (ObjcInstance::~ObjcInstance): Check for nil.
+ (ObjcInstance::operator=): Check for nil.
+
+2004-06-14 Darin Adler <darin@apple.com>
+
+ Reviewed by me, code changes by Patrick Beard.
+
+ - fixed <rdar://problem/3671507>: (WebKit should adopt GC changes and compile with GC enabled)
+
+ * bindings/objc/objc_instance.mm:
+ (ObjcInstance::ObjcInstance): Use CFRetain instead of retain.
+ (ObjcInstance::~ObjcInstance): Use CFRelease instead of release.
+ (ObjcInstance::operator=): More of the same.
+ (ObjcInstance::end): Use [pool drain] if compiling on Tiger.
+
+ * bindings/objc/objc_runtime.mm:
+ (ObjcArray::ObjcArray): Use CFRetain instead of retain.
+ (ObjcArray::~ObjcArray): Use CFRelease instead of release.
+ (ObjcArray::operator=): More of the same.
+
+ * bindings/testbindings.mm: Fixed incorrect license.
+ (main): Use [pool drain] if compiling on Tiger.
+
+=== Safari-144 ===
+
+2004-06-10 Kevin Decker <kdecker@apple.com>
+
+ Reviewed by John.
+
+ * kjs/lexer.cpp:
+ (Lexer::setCode):
+ - fixed <rdar://problem/3682398>: (error console line numbers are offset by 1)
+ * kjs/lexer.h:
+ (KJS::Lexer::lineNo):
+ - fixed <rdar://problem/3682398>: (error console line numbers are offset by 1)
+
+=== JavaScriptCore-143.2 ===
+
+2004-06-07 Darin Adler <darin@apple.com>
+
+ - fixed <rdar://problem/3682489>: (JavaScriptGlue no longer compiles because Interpreter::evaluate parameters changed)
+
+ * kjs/interpreter.h: Added an overload to make JavaScriptGlue compile.
+ * kjs/interpreter.cpp: (KJS::Interpreter::evaluate): Implemented the overload.
+
+=== JavaScriptCore-143.1 ===
+
+2004-06-04 Kevin Decker <kdecker@apple.com>
+
+ Reviewed by Darin
+
+ - fixed <rdar://problem/3680594>
+
+ * kjs/object.cpp:
+ (KJS::Error::create):
+
+=== Safari-143 ===
+
+2004-06-04 Darin Adler <darin@apple.com>
+
+ * kjs/testkjs.cpp: (main): Fix build breakage by adding URL and line number parameters.
+
+2004-06-04 Kevin Decker <kdecker@apple.com>
+
+ Reviewed by Dave.
+
+ - ObjC bindings do not (yet) pass along sourceurl or line numbers
+ - we don't have a way as of yet to accomidate line numbers and urls for dynamic javascript
+ - changed the wording of an error message
+ - the lexer, parser, and interpreter have been made "sourceURL aware"
+ - stored the url into Error
+
+ * bindings/NP_jsobject.cpp:
+ (NPN_Evaluate):
+ * bindings/jni/jni_jsobject.cpp:
+ (JSObject::eval):
+ * bindings/objc/WebScriptObject.mm:
+ (-[WebScriptObject evaluateWebScript:]):
+ * kjs/function.cpp:
+ (GlobalFuncImp::call):
+ * kjs/function_object.cpp:
+ (FunctionObjectImp::construct):
+ * kjs/internal.cpp:
+ (Parser::parse):
+ (InterpreterImp::checkSyntax):
+ (InterpreterImp::evaluate):
+ * kjs/internal.h:
+ * kjs/interpreter.cpp:
+ (Interpreter::evaluate):
+ * kjs/interpreter.h:
+ * kjs/lexer.cpp:
+ (Lexer::setCode):
+ * kjs/lexer.h:
+ (KJS::Lexer::sourceURL):
+ * kjs/nodes.cpp:
+ (Node::Node):
+ (Node::throwError):
+ (FunctionCallNode::evaluate):
+ * kjs/nodes.h:
+ * kjs/object.cpp:
+ (KJS::Error::create):
+ * kjs/object.h:
+
+2004-06-04 Richard Williamson <rjw@apple.com>
+
+ Fixed crash when attempting to access properties on nil
+ object.
+
+ Reviewed by John.
+
+ * bindings/objc/objc_instance.mm:
+ (ObjcInstance::getClass):
+ * bindings/runtime_object.cpp:
+ (RuntimeObjectImp::get):
+ * bindings/testM.js:
+ * bindings/testbindings.mm:
+ (-[MyFirstInterface getString]):
+
+2004-05-27 Kevin Decker <kdecker@apple.com>
+
+ Reviewed by Ken.
+
+ -revised generated error message content
+
+ * kjs/error_object.cpp:
+ (ErrorProtoFuncImp::call):
+ * kjs/internal.cpp:
+ (Parser::parse):
+ * kjs/object.cpp:
+ (KJS::Error::create):
+
+=== Safari-142 ===
+
+2004-05-27 Richard Williamson <rjw@apple.com>
+
+ Renamed WebScriptMethods to WebScripting based on feedback from Nancy.
+
+ Reviewed by Chris.
+
+ * bindings/objc/WebScriptObject.h:
+
+2004-05-27 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - moved to new symlink technique for embedding frameworks
+
+ * JavaScriptCore.pbproj/project.pbxproj: Get rid of embed-frameworks build step
+ because we don't need it any more.
+
+2004-05-24 Richard Williamson <rjw@apple.com>
+
+ Changed RuntimeArrayImp to inherit from ArrayInstanceImp and
+ fixed ClassInfo to correctly reflect inheritance. This is required
+ because of the runtime checks in JSC for arrays, i.e. in
+ the Function objects apply method.
+
+ Reviewed by Ken.
+
+ * bindings/jni/jni_runtime.cpp:
+ (JavaArray::convertJObjectToArray):
+ * bindings/objc/objc_utility.mm:
+ (KJS::Bindings::convertObjcValueToValue):
+ * bindings/runtime_array.cpp:
+ (RuntimeArrayImp::RuntimeArrayImp):
+ * bindings/runtime_array.h:
+ * bindings/testM.js: Added.
+ * bindings/testbindings.mm:
+ (+[MyFirstInterface webScriptNameForSelector:]):
+ (-[MyFirstInterface logMessages:]):
+ (-[MyFirstInterface logMessage:prefix:]):
+ (-[MyFirstInterface callJSObject::]):
+
+2004-05-22 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - fixed <rdar://problem/3664260>: (JS needs to listen to timezone change notifications)
+
+ * kjs/date_object.cpp: (CopyLocalTimeZone): As per Chris Kane and Jordan Hubbard, use <notify.h>
+ with a hardcoded string of "com.apple.system.timezone", and do CFTimeZoneResetSystem since
+ CoreFoundation doesn't do this itself. Turns out this affects the default time zone as long as
+ it hasn't been set explicitly.
+
+=== Safari-141 ===
+
+2004-05-20 Richard Williamson <rjw@apple.com>
+
+ Implemented WebScriptObject/DOM wrapper voodoo. DOM wrappers
+ can now be referenced like any other WebScriptObject, meaning
+ you can do JS operations on them.
+
+ All added implementation of finalizeForWebScript.
+
+ Reviewed by Ken.
+
+ * bindings/objc/WebScriptObject.h:
+ * bindings/objc/WebScriptObject.mm:
+ (-[WebScriptObject _initializeWithObjectImp:KJS::root:Bindings::]):
+ (-[WebScriptObject _initWithObjectImp:KJS::root:Bindings::]):
+ (-[WebScriptObject KJS::]):
+ (-[WebScriptObject dealloc]):
+ (-[WebScriptObject callWebScriptMethod:withArguments:]):
+ (-[WebScriptObject evaluateWebScript:]):
+ (-[WebScriptObject setValue:forKey:]):
+ (-[WebScriptObject valueForKey:]):
+ (-[WebScriptObject stringRepresentation]):
+ * bindings/objc/WebScriptObjectPrivate.h:
+ * bindings/objc/objc_instance.mm:
+ (ObjcInstance::~ObjcInstance):
+
+2004-05-19 Richard Williamson <rjw@apple.com>
+
+ Removed extraneous tabs that were added (by XCode?).
+
+ * bindings/objc/WebScriptObject.h:
+
+2004-05-19 Darin Adler <darin@apple.com>
+
+ - fixed headers with licenses mangled by Xcode auto-indenting
+
+ * bindings/jni/jni_jsobject.cpp:
+ * bindings/jni/jni_jsobject.h:
+ * bindings/runtime_array.h:
+ * bindings/runtime_root.cpp:
+ * bindings/runtime_root.h:
+
+2004-05-18 Richard Williamson <rjw@apple.com>
+
+ Added exception logging. Also check for exception and
+ set results as appropriate.
+
+ Reviewed by Maciej (partially reviewed).
+
+ * bindings/objc/WebScriptObject.mm:
+ (-[WebScriptObject callWebScriptMethod:withArguments:]):
+ (-[WebScriptObject evaluateWebScript:]):
+ (-[WebScriptObject setValue:forKey:]):
+ (-[WebScriptObject valueForKey:]):
+
+2004-05-18 Richard Williamson <rjw@apple.com>
+
+ Finsished implementing support for windowScriptObject.
+ Had to make WebScriptObjectPrivate.h accessible from
+ WebCore.
+
+ Reviewed by Maciej.
+
+ * JavaScriptCore.pbproj/project.pbxproj:
+ * bindings/objc/WebScriptObjectPrivate.h:
+
+2004-05-18 Richard Williamson <rjw@apple.com>
+
+ Use KVC to set/get values instead of directly accessing
+ ivars.
+
+ Reviewed by Maciej.
+
+ * bindings/objc/WebScriptObject.mm:
+ (-[WebScriptObject callWebScriptMethod:withArguments:]):
+ (+[WebScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
+ * bindings/objc/objc_runtime.mm:
+ (ObjcField::valueFromInstance):
+ (convertValueToObjcObject):
+ (ObjcField::setValueToInstance):
+
+2004-05-17 Richard Williamson <rjw@apple.com>
+
+ Implemented new API for WebScriptObject.
+
+ Fixed <rdar://problem/3657145>: (objc to javascript method calls do not cause updates.)
+ Fixed <rdar://problem/3654887>: (Update to JSC to refer to new JSObject LiveConnect object) (w/ help from Vicki)
+
+ Reviewed by Hyatt.
+
+ * JavaScriptCore.pbproj/project.pbxproj:
+ * bindings/c/c_instance.cpp:
+ (CInstance::invokeMethod):
+ * bindings/jni/jni_instance.cpp:
+ (JavaInstance::invokeMethod):
+ * bindings/jni/jni_jsobject.cpp:
+ (JSObject::convertValueToJObject):
+ * bindings/jni/jni_utility.cpp:
+ (KJS::Bindings::getJNIField):
+ * bindings/objc/WebScriptObject.mm:
+ (_didExecute):
+ (-[WebScriptObject _initWithObjectImp:KJS::root:Bindings::]):
+ (-[WebScriptObject KJS::]):
+ (-[WebScriptObject dealloc]):
+ (+[WebScriptObject throwException:]):
+ (listFromNSArray):
+ (-[WebScriptObject callWebScriptMethod:withArguments:]):
+ (-[WebScriptObject evaluateWebScript:]):
+ (-[WebScriptObject setValue:forKey:]):
+ (-[WebScriptObject valueForKey:]):
+ (-[WebScriptObject stringRepresentation]):
+ (+[WebScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
+ (+[WebUndefined undefined]):
+ (-[WebUndefined initWithCoder:]):
+ (-[WebUndefined encodeWithCoder:]):
+ (-[WebUndefined copyWithZone:]):
+ (-[WebUndefined retain]):
+ (-[WebUndefined release]):
+ (-[WebUndefined retainCount]):
+ (-[WebUndefined autorelease]):
+ (-[WebUndefined dealloc]):
+ (-[WebUndefined copy]):
+ (-[WebUndefined replacementObjectForPortCoder:]):
+ * bindings/objc/WebScriptObjectPrivate.h: Added.
+ * bindings/objc/objc_class.mm:
+ (ObjcClass::methodsNamed):
+ (ObjcClass::fieldNamed):
+ * bindings/objc/objc_instance.mm:
+ (ObjcInstance::invokeMethod):
+ * bindings/objc/objc_jsobject.h:
+ * bindings/objc/objc_jsobject.mm:
+ * bindings/objc/objc_runtime.mm:
+ (ObjcField::valueFromInstance):
+ * bindings/objc/objc_utility.mm:
+ (KJS::Bindings::JSMethodNameToObjCMethodName):
+ (KJS::Bindings::convertValueToObjcValue):
+ (KJS::Bindings::convertObjcValueToValue):
+ * bindings/runtime.cpp:
+ (Instance::setDidExecuteFunction):
+ (Instance::didExecuteFunction):
+ (Instance::setValueOfField):
+ * bindings/runtime.h:
+ * bindings/testbindings.mm:
+ (+[MyFirstInterface webScriptNameForSelector:]):
+ (-[MyFirstInterface callJSObject::]):
+
+2004-05-14 Vicki Murley <vicki@apple.com>
+
+ Reviewed by mjs.
+
+ <rdar://problem/3642427>: framework marketing number should be 2.0 for DoubleBarrel release
+
+ * JavaScriptCore.pbproj/project.pbxproj: change CFBundleShortVersionString to 2.0
+
+=== Safari-140 ===
+
+2004-05-13 Richard Williamson <rjw@apple.com>
+
+ Fixed indentation.
+
+ Reviewed by Chris.
+
+ * ChangeLog:
+ * bindings/objc/WebScriptObject.h:
+
+2004-05-13 Richard Williamson <rjw@apple.com>
+
+ Approved API changes. Currently unimplemented.
+
+ Reviewed by Chris.
+
+ * ChangeLog:
+ * JavaScriptCore.pbproj/project.pbxproj:
+ * bindings/objc/WebScriptObject.h: Added.
+ * bindings/objc/WebScriptObject.mm: Added.
+ (+[WebScriptObject throwException:]):
+ (-[WebScriptObject callWebScriptMethod:withArguments:]):
+ (-[WebScriptObject evaluateWebScript:]):
+ (-[WebScriptObject stringRepresentation]):
+ (+[WebUndefined undefined]):
+ (-[WebUndefined initWithCoder:]):
+ (-[WebUndefined encodeWithCoder:]):
+ (-[WebUndefined copyWithZone:]):
+
+2004-05-07 Vicki Murley <vicki@apple.com>
+
+ Reviewed by darin.
+
+ Turn off GC since it uses ppc only instructions (which breaks
+ the B&I build).
+
+ * kjs/value.h: set USE_CONSERVATIVE_GC to 0
+
+=== Safari-139 ===
+
+2004-05-07 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin.
+
+ - add -funroll-loops=16 compiler option for approx .5% speedup on
+ HTML iBench and .5-1% speedup on JS iBench.
+
+ * JavaScriptCore.pbproj/project.pbxproj:
+
+2004-04-25 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin.
+
+ Enable full conservative GC mode in addition to test mode. When
+ conservative GC is enabled, we now get an 11% speed improvement on
+ the iBench. Also fix some spots I missed before.
+
+ Specific noteworth changes:
+
+ * kjs/collector.cpp:
+ (KJS::Collector::markStackObjectsConservatively): Check possible
+ cell pointers for 8-byte aligment and verify they are not 0.
+
+ * kjs/protected_values.cpp:
+ (KJS::ProtectedValues::increaseProtectCount): Move null-tolerance from here...
+ (KJS::ProtectedValues::decreaseProtectCount): ...and here...
+ * kjs/protect.h:
+ (KJS::gcProtectNullTolerant): ...to here...
+ (KJS::gcUnprotectNullTolerant): ...and here, because not all callers need the null
+ tolerance, and doing the check is expensive.
+
+ * kjs/protected_values.cpp:
+ (KJS::ProtectedValues::computeHash): Replace hash function with a much faster one
+ that is still very good.
+
+ * kjs/protect.h:
+ (KJS::gcProtect):
+ (KJS::gcUnprotect):
+ (KJS::ProtectedValue::ProtectedValue):
+ (KJS::ProtectedValue::~ProtectedValue):
+ (KJS::ProtectedValue::operator=):
+ (KJS::ProtectedObject::ProtectedObject):
+ (KJS::ProtectedObject::~ProtectedObject):
+ (KJS::ProtectedObject::operator=):
+ (KJS::ProtectedReference::ProtectedReference):
+ (KJS::ProtectedReference::~ProtectedReference):
+ (KJS::ProtectedReference::operator=):
+ * kjs/protected_values.cpp:
+ (KJS::ProtectedValues::getProtectCount):
+ (KJS::ProtectedValues::increaseProtectCount):
+ (KJS::ProtectedValues::decreaseProtectCount):
+ (KJS::ProtectedValues::computeHash):
+ * bindings/runtime_root.cpp:
+ (KJS::Bindings::addNativeReference):
+ (KJS::Bindings::removeNativeReference):
+ (RootObject::removeAllNativeReferences):
+ * bindings/runtime_root.h:
+ (KJS::Bindings::RootObject::~RootObject):
+ (KJS::Bindings::RootObject::setRootObjectImp):
+ * kjs/collector.cpp:
+ (KJS::Collector::allocate):
+ (KJS::Collector::collect):
+ * kjs/collector.h:
+ * kjs/internal.cpp:
+ (NumberImp::create):
+ (InterpreterImp::globalInit):
+ (InterpreterImp::globalClear):
+ (InterpreterImp::mark):
+ * kjs/list.cpp:
+ (KJS::List::derefValues):
+ (KJS::List::refValues):
+ (KJS::List::append):
+ * kjs/object.cpp:
+ (KJS::ObjectImp::setInternalValue):
+ (KJS::ObjectImp::putDirect):
+ * kjs/value.cpp:
+ (ValueImp::mark):
+ (ValueImp::marked):
+ * kjs/value.h:
+ (KJS::ValueImp::ValueImp):
+ (KJS::ValueImp::~ValueImp):
+ (KJS::ValueImp::):
+ (KJS::Value::Value):
+ (KJS::Value::~Value):
+ (KJS::Value::operator=):
+
+2004-04-30 Richard Williamson <rjw@apple.com>
+
+ Asking an NSInvocation for it's return value when return type
+ is void throws an exception. Added check for void return types
+ to avoid this exception.
+
+ Reviewed by Ken.
+
+ * bindings/objc/objc_instance.mm:
+ (ObjcInstance::invokeMethod):
+
+2004-04-29 Richard Williamson <rjw@apple.com>
+
+ Fixed several bad problems with the ObjC bindings. In particular, conversion
+ to/from JavaScriptObject (soon to be WebScriptObject) was completely broken.
+
+ Reviewed by Chris.
+
+ * bindings/objc/objc_jsobject.h:
+ * bindings/objc/objc_jsobject.mm:
+ (-[JavaScriptObject initWithObjectImp:KJS::root:Bindings::]):
+ (-[JavaScriptObject KJS::]):
+ (+[JavaScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
+ (-[JavaScriptObject call:arguments:]):
+ (-[JavaScriptObject evaluate:]):
+ (-[JavaScriptObject getMember:]):
+ (-[JavaScriptObject getSlot:]):
+ * bindings/objc/objc_runtime.mm:
+ (ObjcField::valueFromInstance):
+ (ObjcField::setValueToInstance):
+ * bindings/objc/objc_utility.mm:
+ (KJS::Bindings::convertValueToObjcValue):
+ (KJS::Bindings::convertObjcValueToValue):
+ * bindings/runtime.h:
+ * bindings/runtime_root.cpp:
+ (KJS::Bindings::rootForInterpreter):
+ (KJS::Bindings::addNativeReference):
+ (KJS::Bindings::removeNativeReference):
+ * bindings/runtime_root.h:
+ * bindings/testbindings.mm:
+ (-[MyFirstInterface logMessage:]):
+ (-[MyFirstInterface setJSObject:]):
+ (-[MyFirstInterface callJSObject::]):
+
+2004-04-24 Darin Adler <darin@apple.com>
+
+ Reviewed by Dave.
+
+ * kjs/ustring.cpp: (KJS::UString::append): Fix one case that was allocating a buffer
+ that is 2x too big.
+
+2004-04-23 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin.
+
+ Implementation of conservative GC, based partly on code from
+ Darin. It's turned off for now, so it shouldn't have any effect on
+ the normal build.
+
+ * JavaScriptCore.pbproj/project.pbxproj:
+ * kjs/collector.cpp:
+ (KJS::Collector::markStackObjectsConservatively):
+ (KJS::Collector::markProtectedObjects):
+ (KJS::Collector::collect):
+ * kjs/collector.h:
+ * kjs/protect.h:
+ (KJS::gcProtect):
+ (KJS::gcUnprotect):
+ * kjs/protected_values.cpp: Added.
+ (KJS::ProtectedValues::getProtectCount):
+ (KJS::ProtectedValues::increaseProtectCount):
+ (KJS::ProtectedValues::insert):
+ (KJS::ProtectedValues::decreaseProtectCount):
+ (KJS::ProtectedValues::expand):
+ (KJS::ProtectedValues::shrink):
+ (KJS::ProtectedValues::rehash):
+ (KJS::ProtectedValues::computeHash):
+ * kjs/protected_values.h: Added.
+ * kjs/value.cpp:
+ (ValueImp::useConservativeMark):
+ (ValueImp::mark):
+ (ValueImp::marked):
+ * kjs/value.h:
+ (KJS::ValueImp::):
+
+=== Safari-138 ===
+
+2004-04-22 Richard Williamson <rjw@apple.com>
+
+ Fixed build snafu (re-declaration of NPBool in npruntime.h and
+ npapi.h).
+
+ * bindings/npruntime.h:
+
+2004-04-22 Richard Williamson <rjw@apple.com>
+
+ Updated plugin binding API to reflect latest revision from
+ working group.
+
+ Biggest change is the introduction of NPVariant used to represent
+ value types. NPVariant replaces the use of NPObject for the
+ exchange of values between scripting environment and native code.
+
+ Reviewed by John.
+
+ * JavaScriptCore.pbproj/project.pbxproj:
+ * bindings/NP_jsobject.cpp:
+ (identiferFromNPIdentifier):
+ (NPN_Call):
+ (NPN_Evaluate):
+ (NPN_GetProperty):
+ (NPN_SetProperty):
+ (NPN_ToString):
+ (NPN_GetPropertyAtIndex):
+ (NPN_SetPropertyAtIndex):
+ * bindings/c/c_class.cpp:
+ (CClass::methodsNamed):
+ (CClass::fieldNamed):
+ * bindings/c/c_instance.cpp:
+ (CInstance::invokeMethod):
+ (CInstance::defaultValue):
+ * bindings/c/c_runtime.cpp:
+ (CField::valueFromInstance):
+ (CField::setValueToInstance):
+ * bindings/c/c_utility.cpp:
+ (convertNPStringToUTF16):
+ (convertUTF8ToUTF16):
+ (coerceValueToNPVariantStringType):
+ (convertValueToNPVariant):
+ (convertNPVariantToValue):
+ * bindings/c/c_utility.h:
+ * bindings/npruntime.cpp:
+ (NPN_GetIdentifier):
+ (NPN_GetIdentifiers):
+ (NPN_UTF8FromIdentifier):
+ (NPN_VariantIsVoid):
+ (NPN_VariantIsNull):
+ (NPN_VariantIsUndefined):
+ (NPN_VariantIsBool):
+ (NPN_VariantIsInt32):
+ (NPN_VariantIsDouble):
+ (NPN_VariantIsString):
+ (NPN_VariantIsObject):
+ (NPN_VariantToBool):
+ (NPN_VariantToString):
+ (NPN_VariantToInt32):
+ (NPN_VariantToDouble):
+ (NPN_VariantToObject):
+ (NPN_InitializeVariantAsVoid):
+ (NPN_InitializeVariantAsNull):
+ (NPN_InitializeVariantAsUndefined):
+ (NPN_InitializeVariantWithBool):
+ (NPN_InitializeVariantWithInt32):
+ (NPN_InitializeVariantWithDouble):
+ (NPN_InitializeVariantWithString):
+ (NPN_InitializeVariantWithStringCopy):
+ (NPN_InitializeVariantWithObject):
+ (NPN_InitializeVariantWithVariant):
+ (NPN_ReleaseVariantValue):
+ (NPN_CreateObject):
+ (NPN_RetainObject):
+ (NPN_ReleaseObject):
+ (NPN_IsKindOfClass):
+ (NPN_SetExceptionWithUTF8):
+ (NPN_SetException):
+ * bindings/npruntime.h:
+ (_NPString::):
+ (_NPString::_NPVariant::):
+ * bindings/testbindings.cpp:
+ (logMessage):
+ (setDoubleValue):
+ (setIntValue):
+ (setStringValue):
+ (setBooleanValue):
+ (getDoubleValue):
+ (getIntValue):
+ (getStringValue):
+ (getBooleanValue):
+ (myGetProperty):
+ (mySetProperty):
+ (myInvoke):
+ (myAllocate):
+
+2004-04-22 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - fixed <rdar://problem/3627473>: "REGRESSION (125-137): memory trasher in UString::append, causing many different crashes"
+
+ * kjs/ustring.cpp:
+ (KJS::UString::expandCapacity): Fix sizeof(UChar *) that should be sizeof(UChar).
+ Was resulting in a buffer 2x the needed size.
+ (KJS::UString::expandPreCapacity): Ditto.
+ (KJS::UString::append): Fix malloc that is missing a sizeof(UChar).
+
+2004-04-21 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin.
+
+ Preliminary change for conservative GC. Create "protected"
+ subclasses to GC-protect objects when on heap, since we will soon
+ remove the built-in refcounting of the normal wrapper classes. Use
+ them where needed.
+
+ * JavaScriptCore.pbproj/project.pbxproj:
+ * kjs/context.h:
+ * kjs/internal.h:
+ (KJS::InterpreterImp::globalObject):
+ * kjs/interpreter.h:
+ * kjs/property_map.cpp:
+ * kjs/reference.h:
+ * kjs/reference_list.cpp:
+
+2004-04-19 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Dave.
+
+ Optimize prepend using the shared substring optimization. Also,
+ limit the applicability of shared append and shared prepend. If
+ you overdo it, it does more harm than good, because you create a
+ bunch of strings that are disqualified from future shared
+ append/prepend, for not much immediate savings in allocate/copy
+ expense.
+
+ * kjs/ustring.cpp:
+ (KJS::):
+ (KJS::UString::Rep::create):
+ (KJS::UString::expandedSize):
+ (KJS::UString::usedPreCapacity):
+ (KJS::UString::expandCapacity):
+ (KJS::UString::expandPreCapacity):
+ (KJS::UString::UString):
+ (KJS::UString::append):
+ (KJS::UString::operator=):
+ * kjs/ustring.h:
+ (KJS::UString::Rep::data):
+
+2004-04-16 Maciej Stachowiak <mjs@apple.com>
+ Reviewed by Richard.
+
+ No more need for Completion or Reference to privately inherit from
+ Value, none of the superclass functionality is used.
+
+ * kjs/completion.h:
+ * kjs/reference.h:
+
+=== Safari-137 ===
+
+2004-04-16 Richard Williamson <rjw@apple.com>
+
+ Added interpreter lock protection around object creation.
+
+ Reviewed by Chris.
+
+ * bindings/runtime.cpp:
+ (Instance::createRuntimeObject):
+
+2004-04-16 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Ken.
+
+ Another JavaScript speed improvement: use the mechanism from
+ string append optimization to make taking a substring fast, again
+ sharing the buffer.
+
+ A further 22% improvement on the 24fun string speed test.
+
+ * kjs/ustring.cpp:
+ (KJS::):
+ (KJS::UString::Rep::create):
+ (KJS::UString::UString):
+ (KJS::UString::append):
+ (KJS::UString::operator=):
+ (KJS::UString::substr):
+ * kjs/ustring.h:
+ (KJS::UString::Rep::data):
+
+2004-04-13 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin.
+
+ - fixed <rdar://problem/3600695>: String manipulation in JavaScript 24fun test is very slow (slow)
+ - fixed <rdar://problem/3600691>: Table generation test is really slow
+ - fixed <rdar://problem/3600661>: 24fun date test is really slow
+
+ 80% speedup on the string test, lesser speedups on the other two.
+
+ Two different optimizations here:
+
+ 1) Avoid large overhead of scanning strings to see if they are all
+ ASCII before numeric conversion.
+
+ * kjs/nodes.cpp:
+ (AssignNode::evaluate): Don't convert to integer until we know for
+ sure the operation will need it. Attempting to convert strings to
+ numbers is a waste when they are being appended with +=.
+
+ 2) Avoid huge cost of appending strings.
+
+ This is done by allowing multiple strings to share a buffer but
+ actually use different ranges of it. The first time a string is
+ appended to, we start leaving at least 10% extra space in the
+ buffer, so doing N appends to the same string takes O(log N)
+ mallocs instead of O(N).
+
+ * kjs/identifier.cpp:
+ (KJS::Identifier::equal):
+ (KJS::Identifier::add):
+ * kjs/ustring.cpp:
+ (KJS::):
+ (KJS::UCharReference::operator=):
+ (KJS::UCharReference::ref):
+ (KJS::UString::Rep::create):
+ (KJS::UString::Rep::destroy):
+ (KJS::UString::expandedSize):
+ (KJS::UString::usedCapacity):
+ (KJS::UString::expandCapacity):
+ (KJS::UString::UString):
+ (KJS::UString::null):
+ (KJS::UString::append):
+ (KJS::UString::operator=):
+ (KJS::UString::toStrictUInt32):
+ (KJS::UString::detach):
+ (KJS::KJS::operator==):
+ * kjs/ustring.h:
+ (KJS::UString::Rep::data):
+ (KJS::UString::Rep::hash):
+
+2004-04-09 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by John.
+
+ - fix deployment build by avoiding deployment-only warning.
+
+ * kjs/scope_chain.cpp:
+ (KJS::ScopeChain::bottom):
+
+2004-04-09 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by John.
+
+ Changed things so that newly created objects get a prototype based
+ on the scope chain of the current function, rather than the
+ interpreter that started execution. This fixes the following bugs:
+
+ <rdar://problem/3368523>: ARCH: wrong prototype used to create new objects (hang on lookup.atomica.com)
+ <rdar://problem/3559173>: ARCH: Cannot scan using a HP Jetdirect product (JS object prototypes bind incorrectly)
+
+ * JavaScriptCore.pbproj/project.pbxproj:
+ * kjs/array_object.cpp:
+ (CompareWithCompareFunctionArguments::CompareWithCompareFunctionArguments):
+ (ArrayProtoFuncImp::ArrayProtoFuncImp):
+ (ArrayProtoFuncImp::call):
+ (ArrayObjectImp::construct):
+ * kjs/bool_object.cpp:
+ (BooleanObjectImp::construct):
+ * kjs/date_object.cpp:
+ (DateProtoFuncImp::DateProtoFuncImp):
+ (DateProtoFuncImp::call):
+ (DateObjectImp::construct):
+ * kjs/error_object.cpp:
+ (ErrorObjectImp::construct):
+ * kjs/function.cpp:
+ (FunctionImp::FunctionImp):
+ (FunctionImp::call):
+ (DeclaredFunctionImp::construct):
+ (ArgumentsImp::ArgumentsImp):
+ (GlobalFuncImp::call):
+ * kjs/function_object.cpp:
+ (FunctionProtoFuncImp::call):
+ (FunctionObjectImp::construct):
+ * kjs/internal.cpp:
+ (BooleanImp::toObject):
+ (StringImp::toObject):
+ (NumberImp::toObject):
+ (InterpreterImp::InterpreterImp):
+ (InterpreterImp::clear):
+ (InterpreterImp::interpreterWithGlobalObject):
+ * kjs/internal.h:
+ * kjs/interpreter.cpp:
+ (ExecState::lexicalInterpreter):
+ * kjs/interpreter.h:
+ (KJS::ExecState::dynamicInterpreter):
+ (KJS::ExecState::interpreter):
+ * kjs/math_object.cpp:
+ (MathFuncImp::MathFuncImp):
+ * kjs/nodes.cpp:
+ (StatementNode::hitStatement):
+ (StatementNode::abortStatement):
+ (RegExpNode::evaluate):
+ (ElementNode::evaluate):
+ (ArrayNode::evaluate):
+ (ObjectLiteralNode::evaluate):
+ (PropertyValueNode::evaluate):
+ (FunctionCallNode::evaluate):
+ (FuncDeclNode::processFuncDecl):
+ (FuncExprNode::evaluate):
+ * kjs/number_object.cpp:
+ (NumberObjectImp::construct):
+ * kjs/object.cpp:
+ (KJS::ObjectImp::defaultValue):
+ (KJS::Error::create):
+ * kjs/object_object.cpp:
+ (ObjectObjectImp::construct):
+ * kjs/reference.cpp:
+ (Reference::putValue):
+ * kjs/regexp_object.cpp:
+ (RegExpProtoFuncImp::call):
+ (RegExpObjectImp::arrayOfMatches):
+ (RegExpObjectImp::construct):
+ * kjs/scope_chain.cpp:
+ (KJS::ScopeChain::bottom):
+ * kjs/scope_chain.h:
+ * kjs/string_object.cpp:
+ (StringProtoFuncImp::StringProtoFuncImp):
+ (StringProtoFuncImp::call):
+ (StringObjectImp::construct):
+
+=== Safari-136 ===
+
+=== Safari-135 ===
+
+2004-03-31 Richard Williamson <rjw@apple.com>
+
+ Tedious renames based on feedback from plugin-futures list.
+ NP_ functions are renamed with NPN_ prefix.
+ Types prefix renamed from NP_ to NP.
+ NPN_CreateStringWithUTF8 and NPN_SetExceptionWithUTF8 now take a length, optionally -1 if string is null terminated.
+
+ No review because this was just a renaming patch.
+
+ * bindings/NP_jsobject.cpp:
+ (listFromNPArray):
+ (jsAllocate):
+ (identiferFromNPIdentifier):
+ (NPN_Call):
+ (NPN_Evaluate):
+ (NPN_GetProperty):
+ (NPN_SetProperty):
+ (NPN_RemoveProperty):
+ (NPN_ToString):
+ (NPN_GetPropertyAtIndex):
+ (NPN_SetPropertyAtIndex):
+ * bindings/NP_jsobject.h:
+ * bindings/c/c_class.cpp:
+ (CClass::_commonInit):
+ (CClass::classForIsA):
+ (CClass::CClass):
+ (CClass::methodsNamed):
+ (CClass::fieldNamed):
+ * bindings/c/c_class.h:
+ * bindings/c/c_instance.cpp:
+ (CInstance::CInstance):
+ (CInstance::~CInstance):
+ (CInstance::operator=):
+ (CInstance::invokeMethod):
+ (CInstance::defaultValue):
+ * bindings/c/c_instance.h:
+ (KJS::Bindings::CInstance::getObject):
+ * bindings/c/c_runtime.cpp:
+ (CField::valueFromInstance):
+ (CField::setValueToInstance):
+ * bindings/c/c_runtime.h:
+ (KJS::Bindings::CField::CField):
+ (KJS::Bindings::CField::name):
+ (KJS::Bindings::CMethod::CMethod):
+ (KJS::Bindings::CMethod::name):
+ * bindings/c/c_utility.cpp:
+ (coerceValueToNPString):
+ (convertValueToNPValueType):
+ (convertNPValueTypeToValue):
+ * bindings/c/c_utility.h:
+ * bindings/npruntime.cpp:
+ (NPN_IdentifierFromUTF8):
+ (NPN_IsValidIdentifier):
+ (NPN_GetIdentifiers):
+ (NPN_UTF8FromIdentifier):
+ (NPN_CreateObject):
+ (NPN_RetainObject):
+ (NPN_ReleaseObject):
+ (NPN_IsKindOfClass):
+ (NPN_SetExceptionWithUTF8):
+ (NPN_SetException):
+ (numberAllocate):
+ (NPN_CreateNumberWithInt):
+ (NPN_CreateNumberWithFloat):
+ (NPN_CreateNumberWithDouble):
+ (NPN_IntFromNumber):
+ (NPN_FloatFromNumber):
+ (NPN_DoubleFromNumber):
+ (stringAllocate):
+ (NPN_CreateStringWithUTF8):
+ (NPN_CreateStringWithUTF16):
+ (NPN_DeallocateUTF8):
+ (NPN_UTF8FromString):
+ (NPN_UTF16FromString):
+ (NPN_StringLength):
+ (booleanAllocate):
+ (NPN_CreateBoolean):
+ (NPN_BoolFromBoolean):
+ (nullAllocate):
+ (NPN_GetNull):
+ (undefinedAllocate):
+ (NPN_GetUndefined):
+ (arrayAllocate):
+ (arrayDeallocate):
+ (NPN_CreateArray):
+ (NPN_CreateArrayV):
+ (NPN_ObjectAtIndex):
+ * bindings/npruntime.h:
+ * bindings/runtime.cpp:
+ (Instance::createBindingForLanguageInstance):
+ * bindings/testbindings.cpp:
+ (initializeIdentifiers):
+ (myHasProperty):
+ (myHasMethod):
+ (myGetProperty):
+ (mySetProperty):
+ (logMessage):
+ (setDoubleValue):
+ (setIntValue):
+ (setStringValue):
+ (setBooleanValue):
+ (getDoubleValue):
+ (getIntValue):
+ (getStringValue):
+ (getBooleanValue):
+ (myInvoke):
+ (myAllocate):
+ (myInvalidate):
+ (myDeallocate):
+ (main):
+
+2004-03-31 Richard Williamson <rjw@apple.com>
+
+ Changed references to NP_runtime.h to npruntime.h
+
+ * JavaScriptCore.pbproj/project.pbxproj:
+ * bindings/NP_jsobject.h:
+ * bindings/c/c_class.h:
+ * bindings/c/c_instance.h:
+ * bindings/c/c_runtime.h:
+ * bindings/c/c_utility.h:
+ * bindings/npruntime.cpp:
+
+2004-03-31 Richard Williamson <rjw@apple.com>
+
+ Renamed NP_runtime.h to npruntime.h to match Netscape SDK.
+
+ * JavaScriptCore.pbproj/project.pbxproj:
+ * bindings/NP_jsobject.h:
+ * bindings/npruntime.cpp:
+
+=== Safari-134 ===
+
+2004-03-23 Richard Williamson <rjw@apple.com>
+
+ Added implementation of KJS::Value <-> NP_Object conversion functions.
+ Augmented test program for 'C' bindings.
+ Added asserts and parameter checking to all public API.
+
+ Reviewed by Ken.
+
+ * JavaScriptCore.pbproj/project.pbxproj:
+ * bindings/NP_jsobject.cpp:
+ (NP_ToString):
+ * bindings/NP_jsobject.h: Added.
+ * bindings/NP_runtime.cpp:
+ (NP_IdentifierFromUTF8):
+ (NP_IsValidIdentifier):
+ (NP_GetIdentifiers):
+ (NP_CreateObject):
+ (NP_RetainObject):
+ (NP_ReleaseObject):
+ (NP_IsKindOfClass):
+ (NP_SetExceptionWithUTF8):
+ (NP_SetException):
+ (NP_IntFromNumber):
+ (NP_FloatFromNumber):
+ (NP_DoubleFromNumber):
+ (NP_CreateStringWithUTF8):
+ (NP_CreateStringWithUTF16):
+ (NP_DeallocateUTF8):
+ (NP_UTF8FromString):
+ (NP_UTF16FromString):
+ (NP_StringLength):
+ (NP_BoolFromBoolean):
+ * bindings/NP_runtime.h:
+ * bindings/c/c_instance.cpp:
+ (CInstance::invokeMethod):
+ * bindings/c/c_utility.cpp:
+ (coerceValueToNPString):
+ (convertValueToNPValueType):
+ (convertNPValueTypeToValue):
+ * bindings/c/c_utility.h:
+ * bindings/test.js:
+ * bindings/testC.js: Added.
+ * bindings/testbindings.cpp:
+ (logMessage):
+ (setDoubleValue):
+ (setIntValue):
+ (setStringValue):
+ (setBooleanValue):
+ (getDoubleValue):
+ (getIntValue):
+ (getStringValue):
+ (getBooleanValue):
+ (myInterfaceInvoke):
+ (myInterfaceAllocate):
+
+=== Safari-133 ===
+
+2004-03-19 Darin Adler <darin@apple.com>
+
+ Reviewed by Ken.
+
+ - fixed problem with methods like setUTCHour
+
+ * kjs/date_object.cpp: (DateProtoFuncImp::call): Fix conversion back to time_t to use the appropriate
+ GMT vs. local time function based on the utc flag.
+
+2004-03-17 Richard Williamson <rjw@apple.com>
+
+ Added a context parameter to result callbacks use by JavaScriptObject functions. This was a change requested by Eric Carlson on the QT plugin team.
+
+ Reviewed by Ken.
+
+ * bindings/NP_jsobject.cpp:
+ (NP_Call):
+ (NP_Evaluate):
+ (NP_GetProperty):
+ (NP_ToString):
+ (NP_GetPropertyAtIndex):
+ * bindings/NP_runtime.h:
+
+2004-03-16 Richard Williamson <rjw@apple.com>
+
+ Fixed 3590169. Regression (crash) caused by the switch to MethodLists. Crash when attempting to invoke a method from JavaScript to Java that is not implemented.
+
+ Reviewed by John.
+
+ * bindings/jni/jni_class.cpp:
+ (JavaClass::methodsNamed):
+
+2004-03-15 Richard Williamson <rjw@apple.com>
+
+ Fixed 3570854. Don't attempt to convert Null to strings. We
+ were incorrectly converting to "Null".
+
+ Actually fixed by Scott Kovatch.
+
+ Reviewed by Richard.
+
+ * bindings/jni/jni_utility.cpp:
+ (KJS::Bindings::convertValueToJValue):
+
+=== Safari-132 ===
+
+2004-03-11 Richard Williamson <rjw@apple.com>
+
+ Stitched together the NP stuff to our language independent
+ JavaScript binding stuff. Very close to being done.
+
+ Added program to test C bindings (and NP stuff). Just tests
+ properties. Will add methods and JavaScript access, etc.
+
+ Updated Makefile.am to account for new bindings/c directory.
+
+ Change NP_UTF8 from "const char *" to "char" to allow for
+ declarations like "const NP_UTF8 *" and "NP_UTF8 *". Ditto
+ for NP_UTF16.
+
+ Added NP_IsValidIdentifier().
+
+ Reviewed by Chris.
+
+ * JavaScriptCore.pbproj/project.pbxproj:
+ * Makefile.am:
+ * bindings/NP_jsobject.cpp:
+ (identiferFromNPIdentifier):
+ (NP_Evaluate):
+ * bindings/NP_runtime.cpp:
+ (NP_IdentifierFromUTF8):
+ (NP_IsValidIdentifier):
+ (NP_GetIdentifiers):
+ (NP_UTF8FromIdentifier):
+ (NP_SetExceptionWithUTF8):
+ (NP_SetException):
+ (NP_CreateStringWithUTF8):
+ (NP_CreateStringWithUTF16):
+ (NP_UTF8FromString):
+ (NP_UTF16FromString):
+ * bindings/NP_runtime.h:
+ * bindings/c/c_class.cpp: Added.
+ (CClass::_commonDelete):
+ (CClass::_commonCopy):
+ (CClass::_commonInit):
+ (_createClassesByIsAIfNecessary):
+ (CClass::classForIsA):
+ (CClass::CClass):
+ (CClass::name):
+ (CClass::methodsNamed):
+ (CClass::fieldNamed):
+ * bindings/c/c_class.h: Added.
+ (KJS::Bindings::CClass::~CClass):
+ (KJS::Bindings::CClass::CClass):
+ (KJS::Bindings::CClass::operator=):
+ (KJS::Bindings::CClass::constructorAt):
+ (KJS::Bindings::CClass::numConstructors):
+ * bindings/c/c_instance.cpp: Added.
+ (CInstance::CInstance):
+ (CInstance::~CInstance):
+ (CInstance::operator=):
+ (CInstance::getClass):
+ (CInstance::begin):
+ (CInstance::end):
+ (CInstance::invokeMethod):
+ (CInstance::defaultValue):
+ (CInstance::stringValue):
+ (CInstance::numberValue):
+ (CInstance::booleanValue):
+ (CInstance::valueOf):
+ * bindings/c/c_instance.h: Added.
+ (KJS::Bindings::CInstance::getObject):
+ * bindings/c/c_runtime.cpp: Added.
+ (CField::valueFromInstance):
+ (CField::setValueToInstance):
+ * bindings/c/c_runtime.h: Added.
+ (KJS::Bindings::CField::CField):
+ (KJS::Bindings::CField::name):
+ (KJS::Bindings::CField::type):
+ (KJS::Bindings::CMethod::CMethod):
+ (KJS::Bindings::CMethod::name):
+ (KJS::Bindings::CMethod::numParameters):
+ * bindings/c/c_utility.cpp: Added.
+ (coerceValueToNPValueType):
+ (convertValueToNPValueType):
+ (convertNPValueTypeToValue):
+ * bindings/c/c_utility.h: Added.
+ * bindings/make_testbindings:
+ * bindings/runtime.cpp:
+ (Instance::createBindingForLanguageInstance):
+ * bindings/runtime.h:
+ (KJS::Bindings::Instance::):
+ * bindings/testbindings.cpp: Added.
+ (initializeIdentifiers):
+ (myInterfaceHasProperty):
+ (myInterfaceHasMethod):
+ (myInterfaceGetProperty):
+ (myInterfaceSetProperty):
+ (myInterfaceInvoke):
+ (myInterfaceAllocate):
+ (myInterfaceInvalidate):
+ (myInterfaceDeallocate):
+ (GlobalImp::className):
+ (readJavaScriptFromFile):
+ (main):
+
+2004-03-10 Richard Williamson <rjw@apple.com>
+
+ Made changes to support new asychronous approach to calls from
+ plugin to JavaScript
+
+ Reviewed by Chris.
+
+ * bindings/NP_jsobject.cpp:
+ (NP_Call):
+ (NP_Evaluate):
+ (NP_GetProperty):
+ (NP_ToString):
+ (NP_GetPropertyAtIndex):
+ * bindings/NP_runtime.h:
+ * bindings/make_testbindings:
+ * bindings/runtime.cpp:
+ (Instance::createBindingForLanguageInstance):
+
+2004-03-10 Richard Williamson <rjw@apple.com>
+
+ Updated header to include proposed changes from
+ plugin-futures list. Calls from plugin to JavaScript
+ are now asynchronous.
+
+ Reviewed by Chris.
+
+ * bindings/NP_runtime.h:
+
+=== Safari-131 ===
+
+2004-03-04 Richard Williamson <rjw@apple.com>
+
+ Implementation of NP_JavaScriptObject. This is the 'C' class
+ that wraps a JavaScript object.
+
+ Reviewed by Chris.
+
+ * JavaScriptCore.pbproj/project.pbxproj:
+ * bindings/NP_jsobject.cpp: Added.
+ (coerceValueToNPValueType):
+ (convertValueToNPValueType):
+ (convertNPValueTypeToValue):
+ (listFromNPArray):
+ (jsAllocate):
+ (jsDeallocate):
+ (identiferFromNPIdentifier):
+ (NP_Call):
+ (NP_Evaluate):
+ (NP_GetProperty):
+ (NP_SetProperty):
+ (NP_RemoveProperty):
+ (NP_ToString):
+ (NP_GetPropertyAtIndex):
+ (NP_SetPropertyAtIndex):
+ * bindings/NP_runtime.cpp:
+ (NP_ObjectAtIndex):
+ * bindings/NP_runtime.h:
+ * bindings/runtime_object.h:
+
+2004-03-04 Richard Williamson <rjw@apple.com>
+
+ Added NP_Array implementation.
+
+ Changed NP_Boolean to just depend on two static instances, no
+ space is required for values.
+
+ Reviewed by Chris.
+
+ * bindings/NP_runtime.cpp:
+ (NP_CreateBoolean):
+ (NP_BoolFromBoolean):
+ (arrayAllocate):
+ (arrayDeallocate):
+ (NP_CreateArray):
+ (NP_CreateArrayV):
+ (NP_ObjectAtIndex):
+ * bindings/NP_runtime.h:
+
+2004-03-03 Darin Adler <darin@apple.com>
+
+ Reviewed by Vicki.
+
+ * English.lproj/InfoPlist.strings: Removed. No need to localize the version and
+ copyright string, and that's all that was in here.
+ * JavaScriptCore.pbproj/project.pbxproj: Removed InfoPlist.strings from build.
+
+2004-03-03 Richard Williamson <rjw@apple.com>
+
+ More 'C' binding implementation. Fleshed out all the
+ 'primitive' data types.
+
+ Reviewed by Chris.
+
+ * bindings/NP_runtime.cpp:
+ (NP_ReleaseObject):
+ (numberAllocate):
+ (stringAllocate):
+ (stringDeallocate):
+ (NP_CreateStringWithUTF8):
+ (NP_CreateStringWithUTF16):
+ (NP_UTF8FromString):
+ (NP_UTF16FromString):
+ (NP_StringLength):
+ (booleanAllocate):
+ (booleanDeallocate):
+ (NP_CreateBoolean):
+ (NP_BoolFromBoolean):
+ (nullAllocate):
+ (nullDeallocate):
+ (NP_GetNull):
+ (undefinedAllocate):
+ (undefinedDeallocate):
+ (NP_GetUndefined):
+ * bindings/NP_runtime.h:
+
+2004-03-03 Richard Williamson <rjw@apple.com>
+
+ More 'C' binding implementation.
+
+ Reviewed by Chris.
+
+ * bindings/NP_runtime.cpp:
+ (identifierEqual):
+ (identifierHash):
+ (getIdentifierDictionary):
+ (NP_IdentifierFromUTF8):
+ (NP_UTF8FromIdentifier):
+ (NP_CreateObject):
+ (NP_ReleaseObject):
+ (NP_IsKindOfClass):
+ (numberCreate):
+ (NP_CreateNumberWithInt):
+ (NP_CreateNumberWithFloat):
+ (NP_CreateNumberWithDouble):
+ (NP_IntFromNumber):
+ (NP_FloatFromNumber):
+ (NP_DoubleFromNumber):
+ * bindings/NP_runtime.h:
+
+2004-03-02 Richard Williamson <rjw@apple.com>
+
+ Removed retain/release from NP_Class. Classes will not be allowed to implement their
+ own customer retain/release scheme.
+
+ Reviewed by Chris.
+
+ * bindings/NP_runtime.cpp:
+ (NP_RetainObject):
+ (NP_ReleaseObject):
+ * bindings/NP_runtime.h:
+
+2004-03-02 Richard Williamson <rjw@apple.com>
+
+ C binding API. Partial implementation.
+
+ Completed ObjectiveC bindings (not based on the C API). These will re-implemented over the C binding API, but I wanted to get this code in the tree.
+
+ Factored root object reference counting scheme. It is now useful independent
+ of LiveConnect.
+
+ Reviewed by Chris.
+
+ * JavaScriptCore.pbproj/project.pbxproj:
+ * bindings/NP_runtime.cpp: Added.
+ (NP_IdentifierFromUTF8):
+ (NP_GetIdentifiers):
+ (NP_UTF8FromIdentifier):
+ (NP_CreateObject):
+ (NP_RetainObject):
+ (NP_ReleaseObject):
+ (NP_IsKindOfClass):
+ (NP_SetException):
+ (NP_Call):
+ (NP_Evaluate):
+ (NP_GetProperty):
+ (NP_SetProperty):
+ (NP_RemoveProperty):
+ (NP_ToString):
+ (NP_GetPropertyAtIndex):
+ (NP_SetPropertyAtIndex):
+ (NP_CreateNumberWithInt):
+ (NP_CreateNumberWithFloat):
+ (NP_CreateNumberWithDouble):
+ (NP_IntFromNumber):
+ (NP_FloatFromNumber):
+ (NP_DoubleFromNumber):
+ (NP_CreateStringWithUTF8):
+ (NP_CreateStringWithUTF16):
+ (NP_UTF8FromString):
+ (NP_UTF16FromString):
+ (NP_CreateBoolean):
+ (NP_BoolFromBoolean):
+ (NP_GetNull):
+ (NP_GetUndefined):
+ (NP_CreateArray):
+ (NP_CreateArrayV):
+ (NP_ObjectAtIndex):
+ * bindings/NP_runtime.h: Added.
+ * bindings/jni/jni_jsobject.cpp:
+ (JSObject::invoke):
+ (JSObject::finalize):
+ (JSObject::createNative):
+ (JSObject::convertValueToJObject):
+ * bindings/jni/jni_jsobject.h:
+ * bindings/objc/objc_jsobject.h:
+ * bindings/objc/objc_jsobject.mm:
+ (rootForView):
+ (windowJavaScriptObject):
+ (-[JavaScriptObject initWithObjectImp:KJS::root:Bindings::]):
+ (-[JavaScriptObject dealloc]):
+ (-[JavaScriptObject _convertValueToObjcValue:KJS::]):
+ (-[JavaScriptObject call:arguments:]):
+ (-[JavaScriptObject evaluate:]):
+ (-[JavaScriptObject getMember:]):
+ (-[JavaScriptObject setMember:value:]):
+ (-[JavaScriptObject removeMember:]):
+ (-[JavaScriptObject toString]):
+ (-[JavaScriptObject getSlot:]):
+ (-[JavaScriptObject setSlot:value:]):
+ * bindings/objc/objc_utility.h:
+ * bindings/objc/objc_utility.mm:
+ (KJS::Bindings::convertValueToObjcValue):
+ * bindings/runtime_root.cpp: Added.
+ (getReferencesByRootDictionary):
+ (getReferencesDictionary):
+ (KJS::Bindings::findReferenceDictionary):
+ (KJS::Bindings::rootForImp):
+ (KJS::Bindings::addNativeReference):
+ (KJS::Bindings::removeNativeReference):
+ (completedJavaScriptAccess):
+ (initializeJavaScriptAccessLock):
+ (lockJavaScriptAccess):
+ (unlockJavaScriptAccess):
+ (RootObject::dispatchToJavaScriptThread):
+ (performJavaScriptAccess):
+ (RootObject::setFindRootObjectForNativeHandleFunction):
+ (RootObject::removeAllNativeReferences):
+ * bindings/runtime_root.h: Added.
+ (KJS::Bindings::RootObject::RootObject):
+ (KJS::Bindings::RootObject::~RootObject):
+ (KJS::Bindings::RootObject::setRootObjectImp):
+ (KJS::Bindings::RootObject::rootObjectImp):
+ (KJS::Bindings::RootObject::setInterpreter):
+ (KJS::Bindings::RootObject::interpreter):
+ (KJS::Bindings::RootObject::findRootObjectForNativeHandleFunction):
+ (KJS::Bindings::RootObject::runLoop):
+ (KJS::Bindings::RootObject::performJavaScriptSource):
+
+=== Safari-130 ===
+
+=== Safari-129 ===
+
+2004-02-18 Richard Williamson <rjw@apple.com>
+
+ Added NSNumber/Number conversion.
+
+ Removed some unnecessary KJS:: namespace specifiers.
+
+ Reviewed by Ken.
+
+ * bindings/objc/objc_utility.mm:
+ (KJS::Bindings::convertValueToObjcValue):
+ (KJS::Bindings::convertObjcValueToValue):
+ * bindings/runtime_array.h:
+
+2004-02-18 Richard Williamson <rjw@apple.com>
+
+ Added support for export NSArrays.
+
+ Updated valueAt() to take an ExecState so we can throw
+ JS exceptions.
+
+ Implemented excludeSelectorFromJavaScript: in ObjcClass. This allows
+ ObjectiveC classes to control the visibility of their methods in
+ JavaScript.
+
+ Reviewed by Ken.
+
+ * bindings/jni/jni_runtime.cpp:
+ (JavaField::valueFromInstance):
+ (JavaArray::valueAt):
+ * bindings/jni/jni_runtime.h:
+ * bindings/objc/objc_class.mm:
+ (ObjcClass::methodsNamed):
+ * bindings/objc/objc_runtime.h:
+ (KJS::Bindings::ObjcArray::getObjcArray):
+ * bindings/objc/objc_runtime.mm:
+ (ObjcField::valueFromInstance):
+ (ObjcField::setValueToInstance):
+ (ObjcArray::ObjcArray):
+ (ObjcArray::~ObjcArray):
+ (ObjcArray::operator=):
+ (ObjcArray::setValueAt):
+ (ObjcArray::valueAt):
+ (ObjcArray::getLength):
+ * bindings/objc/objc_utility.mm:
+ (KJS::Bindings::convertValueToObjcValue):
+ (KJS::Bindings::convertObjcValueToValue):
+ * bindings/runtime.cpp:
+ (Instance::getValueOfField):
+ * bindings/runtime.h:
+ * bindings/runtime_array.cpp:
+ (RuntimeArrayImp::get):
+ * bindings/runtime_object.cpp:
+ (RuntimeObjectImp::get):
+
+2004-02-17 Richard Williamson <rjw@apple.com>
+
+ Added String <-> NSString conversion.
+ Added tests of String <-> NSString conversion to test program.
+
+ Reviewed by Chris.
+
+ * bindings/objc/objc_utility.mm:
+ (KJS::Bindings::convertValueToObjcValue):
+ (KJS::Bindings::convertObjcValueToValue):
+ * bindings/test.js:
+ * bindings/testbindings.mm:
+ (-[MyFirstInterface getString]):
+
+2004-02-15 Darin Adler <darin@apple.com>
+
+ Reviewed by Dave.
+
+ * JavaScriptCore.pbproj/project.pbxproj: Tweak build styles a bit, fixing OptimizedWithSymbols,
+ and removing redundant settings of things that match defaults in other build styles.
+
+2004-02-13 Richard Williamson <rjw@apple.com>
+
+ Work towards the JavaScript ObjC bindings. The bindings now work for
+ simple scalar types. testbindings.mm is an illustration of how the
+ bindings work.
+
+ Reviewed by Ken.
+
+ * JavaScriptCore.pbproj/project.pbxproj:
+ * Makefile.am:
+ * bindings/jni/jni_class.cpp:
+ (JavaClass::methodsNamed):
+ * bindings/jni/jni_class.h:
+ * bindings/jni/jni_instance.cpp:
+ (JavaInstance::invokeMethod):
+ * bindings/jni/jni_instance.h:
+ * bindings/jni/jni_runtime.h:
+ (KJS::Bindings::JavaMethod::returnType):
+ * bindings/make_testbindings: Added.
+ * bindings/objc/objc_class.h: Added.
+ (KJS::Bindings::ObjcClass::~ObjcClass):
+ (KJS::Bindings::ObjcClass::ObjcClass):
+ (KJS::Bindings::ObjcClass::operator=):
+ (KJS::Bindings::ObjcClass::constructorAt):
+ (KJS::Bindings::ObjcClass::numConstructors):
+ * bindings/objc/objc_class.mm: Added.
+ (ObjcClass::_commonDelete):
+ (ObjcClass::_commonCopy):
+ (ObjcClass::_commonInit):
+ (_createClassesByIsAIfNecessary):
+ (ObjcClass::classForIsA):
+ (ObjcClass::ObjcClass):
+ (ObjcClass::name):
+ (ObjcClass::methodsNamed):
+ (ObjcClass::fieldNamed):
+ * bindings/objc/objc_header.h: Added.
+ * bindings/objc/objc_instance.h: Added.
+ (KJS::Bindings::ObjcInstance::getObject):
+ * bindings/objc/objc_instance.mm: Added.
+ (ObjcInstance::ObjcInstance):
+ (ObjcInstance::~ObjcInstance):
+ (ObjcInstance::operator=):
+ (ObjcInstance::begin):
+ (ObjcInstance::end):
+ (ObjcInstance::getClass):
+ (ObjcInstance::invokeMethod):
+ (ObjcInstance::defaultValue):
+ (ObjcInstance::stringValue):
+ (ObjcInstance::numberValue):
+ (ObjcInstance::booleanValue):
+ (ObjcInstance::valueOf):
+ * bindings/objc/objc_jsobject.h: Added.
+ * bindings/objc/objc_jsobject.mm: Added.
+ * bindings/objc/objc_runtime.h:
+ (KJS::Bindings::ObjcField::~ObjcField):
+ (KJS::Bindings::ObjcField::ObjcField):
+ (KJS::Bindings::ObjcField::operator=):
+ (KJS::Bindings::ObjcMethod::ObjcMethod):
+ (KJS::Bindings::ObjcMethod::~ObjcMethod):
+ (KJS::Bindings::ObjcMethod::operator=):
+ * bindings/objc/objc_runtime.mm: Added.
+ (ObjcMethod::ObjcMethod):
+ (ObjcMethod::name):
+ (ObjcMethod::numParameters):
+ (ObjcMethod::getMethodSignature):
+ (ObjcField::ObjcField):
+ (ObjcField::name):
+ (ObjcField::type):
+ (ObjcField::valueFromInstance):
+ (ObjcField::setValueToInstance):
+ * bindings/objc/objc_utility.h: Added.
+ (KJS::Bindings::):
+ * bindings/objc/objc_utility.mm: Added.
+ (KJS::Bindings::JSMethodNameToObjCMethodName):
+ (KJS::Bindings::convertValueToObjcValue):
+ (KJS::Bindings::convertObjcValueToValue):
+ (KJS::Bindings::objcValueTypeForType):
+ * bindings/runtime.cpp:
+ (MethodList::MethodList):
+ (MethodList::operator=):
+ (Instance::setValueOfField):
+ (Instance::createBindingForLanguageInstance):
+ (Instance::createRuntimeObject):
+ * bindings/runtime.h:
+ * bindings/runtime_method.cpp:
+ (RuntimeMethodImp::RuntimeMethodImp):
+ (RuntimeMethodImp::get):
+ (RuntimeMethodImp::call):
+ * bindings/runtime_method.h:
+ * bindings/runtime_object.cpp:
+ (RuntimeObjectImp::get):
+ (RuntimeObjectImp::hasProperty):
+ * bindings/test.js: Added.
+ * bindings/testbindings.mm: Added.
+ (-[MySecondInterface init]):
+ (-[MyFirstInterface init]):
+ (-[MyFirstInterface dealloc]):
+ (+[MyFirstInterface JavaScriptNameForSelector:]):
+ (-[MyFirstInterface getInt]):
+ (-[MyFirstInterface setInt:]):
+ (-[MyFirstInterface getMySecondInterface]):
+ (-[MyFirstInterface logMessage:]):
+ (GlobalImp::className):
+ (readJavaScriptFromFile):
+ (main):
+
+=== Safari-128 ===
+
+2004-02-08 Darin Adler <darin@apple.com>
+
+ Reviewed by Dave.
+
+ - fixed things seen in the profile, for a total speedup of 4% on cvs-base (including changes across all projects)
+
+ * JavaScriptCorePrefix.h: Add a workaround for a bug in our system headers that prevents the <ctype.h>
+ macros from working right in C++ code that uses the <cctype> header.
+
+ * kjs/ustring.cpp:
+ (KJS::inlineUTF8SequenceLengthNonASCII): Added.
+ (KJS::UTF8SequenceLengthNonASCII): Added.
+ (KJS::inlineUTF8SequenceLength): Added.
+ (KJS::UTF8SequenceLength): Calls inlineUTF8SequenceLengthNonASCII now.
+ (KJS::decodeUTF8Sequence): Use new inlineUTF8SequenceLengthNonASCII; faster for ASCII.
+ (KJS::createSortedOffsetsArray): Add special case for 1, 2, and 3 offsets, so we don't do qsort for those.
+ (KJS::convertUTF16OffsetsToUTF8Offsets): Use new inlineUTF8SequenceLengthNonASCII; faster for ASCII.
+ (KJS::convertUTF8OffsetsToUTF16Offsets): Use new inlineUTF8SequenceLengthNonASCII; faster for ASCII.
+
+ - fixed the test program so it won't hit the interpreter lock assertion
+
+ * kjs/testkjs.cpp: (main): Just lock around the whole thing, since the test is singly threaded.
+
+=== Safari-127 ===
+
+2004-02-06 Richard Williamson <rjw@apple.com>
+
+ Fixed 3550242 and 3546977. The first diff prevents an assert from firing. The second diff prevents a JavaScript exception, caused be an invalid conversion, which has a downstream consequence of preventing a valid conversion.
+
+ Reviewed by John.
+
+ * bindings/jni/jni_jsobject.cpp:
+ (JSObject::toString):
+ * bindings/jni/jni_utility.cpp:
+ (KJS::Bindings::convertValueToJValue):
+
+2004-02-02 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - fixed <rdar://problem/3546613>: array of negative size leads to crash (test page at oscar.the-rileys.net)
+
+ * kjs/array_object.cpp:
+ (ArrayInstanceImp::ArrayInstanceImp): If the length is greater than 10,000, don't allocate an array until
+ we start putting values in. This prevents new Array(2147483647) from causing trouble.
+ (ArrayObjectImp::construct): Check number as described in specification, and raise a range error if the
+ number is out of range. This prevents new Array(-1) from causing trouble.
+
+ - fixed <rdar://problem/3545756>: Math.round screws up on numbers bigger than 2^31 (incorrect results on HP-35 calculator page)
+
+ * kjs/math_object.cpp: (MathFuncImp::call): Change implementation to be much simpler and not involve
+ casting to int. Results now match those in other browsers.
+
+2004-02-02 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - fixed <rdar://problem/3519285>: integer operations on large negative numbers yield bad results (discovered with "HTMLCrypt")
+ - fixed other related overflow issues
+
+ * kjs/value.h: Changed return types of toInteger, toInt32, toUInt32, and toUInt16.
+ * kjs/value.cpp:
+ (ValueImp::toInteger): Change to return a double, since this operation, from the ECMA specification,
+ must not restrict values to the range of a particular integer type.
+ (ValueImp::toInt32): Used a sized integer type for the result of this function, and also added
+ proper handling for negative results from fmod.
+ (ValueImp::toUInt32): Ditto.
+ (ValueImp::toUInt16): Ditto.
+ (ValueImp::dispatchToUInt32): Changed result type from unsigned to uint32_t.
+
+ * kjs/array_object.cpp: (ArrayProtoFuncImp::call): Use a double instead of an int to handle
+ out-of-integer-range values better in the slice function.
+ * kjs/internal.cpp: (KJS::roundValue): Streamline the function, handling NAN and infinity properly.
+ * kjs/number_object.cpp: (NumberProtoFuncImp::call): Use a double instead of an int to handle
+ out-of-integer-range values better in the toString function.
+ * kjs/string_object.cpp: (StringProtoFuncImp::call): Use a double instead of an int to handle
+ out-of-integer-range values better in the charAt, charCodeAt, indexOf, lastIndexOf, slice,
+ and substr functions.
+
+=== Safari-126 ===
+
+2004-01-30 Richard Williamson <rjw@apple.com>
+
+ Fixed 3542044. Create KJS::String using UString constructor instead of passing UTF8 string to char* constructor.
+
+ Reviewed by Darin.
+
+ * bindings/jni/jni_instance.cpp:
+ (JavaInstance::stringValue):
+
+2004-01-26 Darin Adler <darin@apple.com>
+
+ * Makefile.am: Switch from pbxbuild to xcodebuild.
+
+2004-01-22 Richard Williamson <rjw@apple.com>
+
+ Added stubs for ObjC language binding to JavaScript.
+
+ * JavaScriptCore.pbproj/project.pbxproj:
+ * bindings/jni/jni_runtime.h:
+ * bindings/objc/objc_runtime.h: Added.
+ (KJS::Bindings::ObjcParameter::ObjcParameter):
+ (KJS::Bindings::ObjcParameter::~ObjcParameter):
+ (KJS::Bindings::ObjcParameter::operator=):
+ (KJS::Bindings::ObjcParameter::type):
+ (KJS::Bindings::ObjcConstructor::ObjcConstructor):
+ (KJS::Bindings::ObjcConstructor::~ObjcConstructor):
+ (KJS::Bindings::ObjcConstructor::_commonCopy):
+ (KJS::Bindings::ObjcConstructor::operator=):
+ (KJS::Bindings::ObjcConstructor::value):
+ (KJS::Bindings::ObjcConstructor::parameterAt):
+ (KJS::Bindings::ObjcConstructor::numParameters):
+ (KJS::Bindings::ObjcField::ObjcField):
+ (KJS::Bindings::ObjcField::~ObjcField):
+ * bindings/runtime.h:
+
+2004-01-22 Richard Williamson <rjw@apple.com>
+
+ Simplified JavaString by using UString as backing store. This
+ revealed a bug in CString's assignment operator which I fixed.
+
+ Removed some dead code.
+
+ Reviewed by John.
+
+ * bindings/jni/jni_runtime.h:
+ (KJS::Bindings::JavaString::JavaString):
+ (KJS::Bindings::JavaString::_commonInit):
+ (KJS::Bindings::JavaString::UTF8String):
+ (KJS::Bindings::JavaString::uchars):
+ (KJS::Bindings::JavaString::length):
+ (KJS::Bindings::JavaString::ustring):
+ * bindings/runtime_object.cpp:
+ (RuntimeObjectImp::RuntimeObjectImp):
+ * bindings/runtime_object.h:
+ * kjs/ustring.cpp:
+ (KJS::CString::CString):
+ (KJS::CString::operator=):
+
+=== Safari-125 ===
+
+=== Safari-124 ===
+
+2004-01-16 Richard Williamson <rjw@apple.com>
+
+ Fixed 3525853. We weren't handling mapping to overloaded Java
+ methods very well. Even though this is undefined the other
+ browsers support it. Also fixed a bug with returning arrays
+ from Java functions.
+
+ Reviewed by John.
+
+ * bindings/jni/jni_class.cpp:
+ (JavaClass::_commonInit):
+ (JavaClass::methodsNamed):
+ * bindings/jni/jni_class.h:
+ * bindings/jni/jni_instance.cpp:
+ (JavaInstance::invokeMethod):
+ * bindings/jni/jni_instance.h:
+ * bindings/jni/jni_runtime.cpp:
+ (JavaArray::convertJObjectToArray):
+ (JavaField::valueFromInstance):
+ (JavaMethod::signature):
+ (JavaArray::valueAt):
+ * bindings/jni/jni_runtime.h:
+ * bindings/jni_jsobject.cpp:
+ (JSObject::call):
+ (JSObject::convertJObjectToValue):
+ * bindings/runtime.cpp:
+ (MethodList::addMethod):
+ (MethodList::length):
+ (MethodList::methodAt):
+ (MethodList::~MethodList):
+ * bindings/runtime.h:
+ (KJS::Bindings::MethodList::MethodList):
+ * bindings/runtime_method.cpp:
+ (RuntimeMethodImp::RuntimeMethodImp):
+ (RuntimeMethodImp::get):
+ (RuntimeMethodImp::call):
+ * bindings/runtime_method.h:
+ * bindings/runtime_object.cpp:
+ (RuntimeObjectImp::get):
+ (RuntimeObjectImp::hasProperty):
+
+2004-01-16 Richard Williamson <rjw@apple.com>
+
+ Fixed 3531229. Another place that needs the Push/PopLocalFrame
+ protection implemented for 3530401.
+
+ Reviewed by John.
+
+ * bindings/runtime_method.cpp:
+ (RuntimeMethodImp::call):
+
+2004-01-15 Richard Williamson <rjw@apple.com>
+
+ Fixed 3530401. JNI doesn't cleanup local refs created on the
+ main thread. IMO this is a bad bug in our JMI implementation.
+
+ To work-around the problem I explicitly delete all local refs.
+ Further, I've added Push/PopLocalFrame calls to catch any refs
+ that I may have missed. This will guarantee that we don't leak
+ any Java references.
+
+ Reviewed by John.
+
+ * bindings/jni/jni_class.cpp:
+ (JavaClass::_commonInit):
+ (JavaClass::JavaClass):
+ * bindings/jni/jni_instance.cpp:
+ (JavaInstance::begin):
+ (JavaInstance::end):
+ * bindings/jni/jni_instance.h:
+ * bindings/jni/jni_runtime.cpp:
+ (JavaConstructor::JavaConstructor):
+ (JavaMethod::JavaMethod):
+ * bindings/jni_jsobject.cpp:
+ (JSObject::listFromJArray):
+ * bindings/runtime.h:
+ (KJS::Bindings::Instance::begin):
+ (KJS::Bindings::Instance::end):
+ * bindings/runtime_object.cpp:
+ (RuntimeObjectImp::get):
+ (RuntimeObjectImp::put):
+ (RuntimeObjectImp::canPut):
+ (RuntimeObjectImp::hasProperty):
+ (RuntimeObjectImp::defaultValue):
+
+2004-01-15 Vicki Murley <vicki@apple.com>
+
+ Reviewed by Darin.
+
+ * JavaScriptCore.pbproj/project.pbxproj: Update copyright date to 2004.
+
+2004-01-14 Richard Williamson <rjw@apple.com>
+
+ Fixed 3529466. With recent changes to Java plugin we must no
+ longer call DeleteLocalRef(). Not a problem, it was an optimization anyway.
+
+ Reviewed by John.
+
+ * bindings/jni/jni_instance.cpp:
+ (JObjectWrapper::JObjectWrapper):
+
+=== Safari-122 ===
+
+2004-01-14 Richard Williamson <rjw@apple.com>
+
+ Fixed 3529010.
+
+ Finalize may be called on an JSObject after we've already remove all our references. The assert in this case is firing because we've received a finalize call from Java for an instance that we no longer know about. The fix is to check in finalize that we're getting a call on an instance that we still care about.
+
+ Reviewed by John.
+
+ * bindings/jni_jsobject.cpp:
+ (addJavaReference):
+ (removeJavaReference):
+ (RootObject::removeAllJavaReferencesForRoot):
+ (JSObject::invoke):
+
+2004-01-13 Richard Williamson <rjw@apple.com>
+
+ Fixed 3528324.
+
+ The run loop that is used to execute JavaScript (in practice, always the main run loop) is held in a class variable. It is set and retained once and should not be released. Unfortunately is it being released when the 'root' object on a LiveConnect applet is released. This has the symptom of eventually causing an deallocation of the main run loop! Usually after about 5 instantiations/destructions of a LiveConnect applet. The CFRelease of the run loop was removed.
+
+ Reviewed by Hyatt.
+
+ * bindings/jni_jsobject.h:
+ (KJS::Bindings::RootObject::~RootObject):
+
+=== Safari-121 ===
+
+=== Safari-120 ===
+
+2004-01-06 Richard Williamson <rjw@apple.com>
+
+ Fixed 3521814. Finalize messages weren't being dispatched!
+
+ Reviewed by John.
+
+ * bindings/jni_jsobject.cpp:
+ (JSObject::invoke):
+
+2004-01-05 Richard Williamson <rjw@apple.com>
+
+ Added cache of JNI method IDs to minimize allocations. This mitigates the problem
+ described by 3515579.
+
+ Also cleanup up logging of Java exceptions.
+
+ Reviewed by John.
+
+ * bindings/jni/jni_class.cpp:
+ (JavaClass::classForInstance):
+ * bindings/jni/jni_instance.cpp:
+ (JavaInstance::JavaInstance):
+ (JavaInstance::getClass):
+ (JavaInstance::invokeMethod):
+ (JObjectWrapper::JObjectWrapper):
+ (JObjectWrapper::~JObjectWrapper):
+ * bindings/jni/jni_instance.h:
+ (KJS::Bindings::JavaInstance::operator=):
+ * bindings/jni/jni_runtime.cpp:
+ (JavaMethod::JavaMethod):
+ (JavaMethod::methodID):
+ * bindings/jni/jni_runtime.h:
+ (KJS::Bindings::JavaMethod::JavaMethod):
+ * bindings/jni/jni_utility.cpp:
+ (callJNIMethod):
+ (callJNIMethodIDA):
+ (callJNIMethodA):
+ (KJS::Bindings::getMethodID):
+ (KJS::Bindings::callJNIVoidMethodIDA):
+ (KJS::Bindings::callJNIObjectMethodIDA):
+ (KJS::Bindings::callJNIByteMethodIDA):
+ (KJS::Bindings::callJNICharMethodIDA):
+ (KJS::Bindings::callJNIShortMethodIDA):
+ (KJS::Bindings::callJNIIntMethodIDA):
+ (KJS::Bindings::callJNILongMethodIDA):
+ (KJS::Bindings::callJNIFloatMethodIDA):
+ (KJS::Bindings::callJNIDoubleMethodIDA):
+ (KJS::Bindings::callJNIBooleanMethodIDA):
+ (KJS::Bindings::getCharactersFromJStringInEnv):
+ (KJS::Bindings::getUCharactersFromJStringInEnv):
+ (KJS::Bindings::getJNIField):
+ * bindings/jni/jni_utility.h:
+
+l2003-12-23 John Sullivan <sullivan@apple.com>
+
+ * JavaScriptCore.pbproj/project.pbxproj:
+ Xcode version wars, harmless
+
+2003-12-23 Darin Adler <darin@apple.com>
+
+ Reviewed by John (concept, not code, which is just the old code coming back).
+
+ - fixed 3518092: REGRESSION (100-119): getting NaN instead of HH:MM times
+
+ * kjs/date_object.cpp: Added back our CF-based implementations of gmtime, localtime,
+ mktime, timegm, and time, because mktime, at least, won't handle a year of 0.
+
+2003-12-19 Richard Williamson <rjw@apple.com>
+
+ Fixed 3515597. When an error occurs we need
+ to make sure result values are zeroed.
+
+ Cleaned up logs by adding a newline.
+
+ Reviewed by John.
+
+ * bindings/jni/jni_utility.cpp:
+ (KJS::Bindings::getJavaVM):
+ (KJS::Bindings::getJNIEnv):
+ (callJNIMethod):
+ (callJNIMethodA):
+ (KJS::Bindings::getJNIField):
+ * bindings/jni_jsobject.cpp:
+ (JSObject::convertValueToJObject):
+
+=== Safari-119 ===
+
+2003-12-17 Richard Williamson <rjw@apple.com>
+
+ Ensure that all the symbols we export are in the KJS
+ namespace (3512245).
+
+ Also renamed JavaString.characters() to JavaString.UTF8String()
+ for enhanced clarity.
+
+ Added some sanity checking to constructor of JObjectWrapper.
+
+ Reviewed by Dave.
+
+ * ChangeLog:
+ * bindings/jni/jni_class.cpp:
+ * bindings/jni/jni_class.h:
+ * bindings/jni/jni_instance.cpp:
+ (JavaInstance::invokeMethod):
+ (JObjectWrapper::JObjectWrapper):
+ * bindings/jni/jni_instance.h:
+ * bindings/jni/jni_runtime.cpp:
+ (JavaParameter::JavaParameter):
+ (JavaField::JavaField):
+ (JavaMethod::JavaMethod):
+ (JavaMethod::signature):
+ * bindings/jni/jni_runtime.h:
+ (KJS::Bindings::JavaString::ascii):
+ (KJS::Bindings::JavaString::UTF8String):
+ (KJS::Bindings::JavaString::JavaString):
+ (KJS::Bindings::JavaString::_commonInit):
+ (KJS::Bindings::JavaString::uchars):
+ (KJS::Bindings::JavaString::length):
+ (KJS::Bindings::JavaString::ustring):
+ (KJS::Bindings::JavaParameter::type):
+ (KJS::Bindings::JavaField::name):
+ (KJS::Bindings::JavaField::type):
+ (KJS::Bindings::JavaMethod::name):
+ (KJS::Bindings::JavaMethod::returnType):
+ * bindings/jni/jni_utility.cpp:
+ (KJS::Bindings::getJavaVM):
+ (KJS::Bindings::getJNIEnv):
+ (KJS::Bindings::callJNIVoidMethod):
+ (KJS::Bindings::callJNIObjectMethod):
+ (KJS::Bindings::callJNIBooleanMethod):
+ (KJS::Bindings::callJNIByteMethod):
+ (KJS::Bindings::callJNICharMethod):
+ (KJS::Bindings::callJNIShortMethod):
+ (KJS::Bindings::callJNIIntMethod):
+ (KJS::Bindings::callJNILongMethod):
+ (KJS::Bindings::callJNIFloatMethod):
+ (KJS::Bindings::callJNIDoubleMethod):
+ (KJS::Bindings::callJNIVoidMethodA):
+ (KJS::Bindings::callJNIObjectMethodA):
+ (KJS::Bindings::callJNIByteMethodA):
+ (KJS::Bindings::callJNICharMethodA):
+ (KJS::Bindings::callJNIShortMethodA):
+ (KJS::Bindings::callJNIIntMethodA):
+ (KJS::Bindings::callJNILongMethodA):
+ (KJS::Bindings::callJNIFloatMethodA):
+ (KJS::Bindings::callJNIDoubleMethodA):
+ (KJS::Bindings::callJNIBooleanMethodA):
+ (KJS::Bindings::getCharactersFromJString):
+ (KJS::Bindings::releaseCharactersForJString):
+ (KJS::Bindings::getCharactersFromJStringInEnv):
+ (KJS::Bindings::releaseCharactersForJStringInEnv):
+ (KJS::Bindings::getUCharactersFromJStringInEnv):
+ (KJS::Bindings::releaseUCharactersForJStringInEnv):
+ (KJS::Bindings::JNITypeFromClassName):
+ (KJS::Bindings::signatureFromPrimitiveType):
+ (KJS::Bindings::JNITypeFromPrimitiveType):
+ (KJS::Bindings::getJNIField):
+ (KJS::Bindings::convertValueToJValue):
+ * bindings/jni/jni_utility.h:
+ * bindings/jni_jsobject.cpp:
+ (KJS::Bindings::JSObject::invoke):
+ (KJS::Bindings::JSObject::JSObject):
+ (KJS::Bindings::JSObject::call):
+ (KJS::Bindings::JSObject::eval):
+ (KJS::Bindings::JSObject::getMember):
+ (KJS::Bindings::JSObject::setMember):
+ (KJS::Bindings::JSObject::removeMember):
+ (KJS::Bindings::JSObject::getSlot):
+ (KJS::Bindings::JSObject::setSlot):
+ (KJS::Bindings::JSObject::toString):
+ (KJS::Bindings::JSObject::finalize):
+ (KJS::Bindings::JSObject::createNative):
+ (KJS::Bindings::JSObject::convertValueToJObject):
+ (KJS::Bindings::JSObject::convertJObjectToValue):
+ (KJS::Bindings::JSObject::listFromJArray):
+ * bindings/jni_jsobject.h:
+ * bindings/runtime.cpp:
+ * bindings/runtime.h:
+ * bindings/runtime_method.cpp:
+ * bindings/runtime_method.h:
+
+=== Safari-118 ===
+
+2003-12-16 Richard Williamson <rjw@apple.com>
+
+ Ack! More assertions. Lock ALL entry points into the interpreter!
+ (3511733).
+
+ Reviewed by Ken.
+
+ * bindings/jni_jsobject.cpp:
+ (Bindings::JSObject::call):
+ (Bindings::JSObject::eval):
+ (Bindings::JSObject::getMember):
+ (Bindings::JSObject::setMember):
+ (Bindings::JSObject::removeMember):
+ (Bindings::JSObject::getSlot):
+ (Bindings::JSObject::setSlot):
+ (Bindings::JSObject::convertJObjectToValue):
+
+2003-12-15 Richard Williamson <rjw@apple.com>
+
+ Fixed a couple of snafus and removed some logging.
+
+ Reviewed by Maciej.
+
+ * bindings/jni_jsobject.cpp:
+ (Bindings::performJavaScriptAccess):
+ (Bindings::completedJavaScriptAccess):
+ (Bindings::dispatchToJavaScriptThread):
+ Removed some annoying JS_LOG clutter.
+
+ (Bindings::RootObject::removeAllJavaReferencesForRoot):
+ Fixed allocation of key buffer that was called after it was needed.
+
+ (Bindings::JSObject::invoke):
+ (Bindings::JSObject::JSObject):
+ (Bindings::JSObject::getMember):
+ (Bindings::JSObject::getSlot):
+ Added additional interpreter locks around getMember and getSlot.
+ These functions may cause allocation of JS impls.
+
+2003-12-15 Richard Williamson <rjw@apple.com>
+
+ args weren't passed to 'call' invocation. d'oh.
+ lock interpreter when we create instances of JS impls.
+
+ Reviewed by Maciej.
+
+ * bindings/jni_jsobject.cpp:
+ (Bindings::JSObject::call):
+ (Bindings::JSObject::eval):
+ (Bindings::JSObject::getMember):
+ (Bindings::JSObject::setMember):
+ (Bindings::JSObject::getSlot):
+ (Bindings::JSObject::convertValueToJObject):
+ (Bindings::JSObject::convertJObjectToValue):
+ (Bindings::JSObject::listFromJArray):
+ * bindings/jni_jsobject.h:
+
+2003-12-15 Richard Williamson <rjw@apple.com>
+
+ Last piece of LiveConnect! This checkin adds implementation
+ of the Java to JavaScript object conversion functions.
+
+ Reviewed by John.
+
+ * bindings/jni/jni_instance.cpp:
+ (JavaInstance::invokeMethod):
+ * bindings/jni/jni_utility.cpp:
+ * bindings/jni/jni_utility.h:
+ * bindings/jni_jsobject.cpp:
+ (Bindings::JSObject::invoke):
+ (Bindings::JSObject::call):
+ (Bindings::JSObject::eval):
+ (Bindings::JSObject::getMember):
+ (Bindings::JSObject::setMember):
+ (Bindings::JSObject::getSlot):
+ (Bindings::JSObject::setSlot):
+ (Bindings::JSObject::createNative):
+ (Bindings::JSObject::convertValueToJObject):
+ (Bindings::JSObject::convertJObjectToValue):
+ (Bindings::JSObject::listFromJArray):
+ * bindings/jni_jsobject.h:
+ (Bindings::):
+ * bindings/runtime_method.cpp:
+ (RuntimeMethodImp::get):
+ (RuntimeMethodImp::codeType):
+ (RuntimeMethodImp::execute):
+
+2003-12-12 Richard Williamson <rjw@apple.com>
+
+ Added implementation of stubs in JSObject. All that
+ remains is a couple of simple conversion functions stubs and
+ we're done with LiveConnect. Also, changed string passing to
+ JS to use uchars instead of chars.
+
+ Reviewed by Maciej.
+
+ * bindings/jni/jni_runtime.h:
+ (Bindings::JavaString::JavaString):
+ (Bindings::JavaString::_commonInit):
+ (Bindings::JavaString::_commonCopy):
+ (Bindings::JavaString::_commonDelete):
+ (Bindings::JavaString::~JavaString):
+ (Bindings::JavaString::operator=):
+ (Bindings::JavaString::uchars):
+ (Bindings::JavaString::length):
+ (Bindings::JavaString::ustring):
+ * bindings/jni/jni_utility.cpp:
+ (getUCharactersFromJStringInEnv):
+ (releaseUCharactersForJStringInEnv):
+ (convertValueToJObject):
+ (convertJObjectToValue):
+ * bindings/jni/jni_utility.h:
+ * bindings/jni_jsobject.cpp:
+ (Bindings::JSObject::invoke):
+ (Bindings::JSObject::call):
+ (Bindings::JSObject::eval):
+ (Bindings::JSObject::getMember):
+ (Bindings::JSObject::setMember):
+ (Bindings::JSObject::removeMember):
+ (Bindings::JSObject::getSlot):
+ (Bindings::JSObject::setSlot):
+ * bindings/jni_jsobject.h:
+
+2003-12-12 Richard Williamson <rjw@apple.com>
+
+ Ensure that all calls from Java into JavaScript are
+ performed on a designated thread (the main thread).
+
+ Reviewed by Ken.
+
+ * bindings/jni_jsobject.cpp:
+ (isJavaScriptThread):
+ (rootForImp):
+ (Bindings::performJavaScriptAccess):
+ (Bindings::completedJavaScriptAccess):
+ (Bindings::initializeJavaScriptAccessLock):
+ (Bindings::lockJavaScriptAccess):
+ (Bindings::unlockJavaScriptAccess):
+ (Bindings::dispatchToJavaScriptThread):
+ (Bindings::RootObject::setFindRootObjectForNativeHandleFunction):
+ (Bindings::RootObject::removeAllJavaReferencesForRoot):
+ (Bindings::JSObject::invoke):
+ (Bindings::JSObject::JSObject):
+ (Bindings::JSObject::call):
+ (Bindings::JSObject::eval):
+ (Bindings::JSObject::getMember):
+ (Bindings::JSObject::setMember):
+ (Bindings::JSObject::removeMember):
+ (Bindings::JSObject::getSlot):
+ (Bindings::JSObject::setSlot):
+ (Bindings::JSObject::toString):
+ (Bindings::JSObject::finalize):
+ (Bindings::JSObject::getWindow):
+ * bindings/jni_jsobject.h:
+ (Bindings::RootObject::~RootObject):
+ (Bindings::RootObject::findRootObjectForNativeHandleFunction):
+ (Bindings::RootObject::runLoop):
+ (Bindings::RootObject::performJavaScriptSource):
+ (Bindings::):
+
+2003-12-11 Richard Williamson <rjw@apple.com>
+
+ Added support for calling a JavaScript function from
+ Java. Right now this only works for void func(void)
+ functions, but the conversion of args and return values
+ will come shortly.
+
+ Cleaned up and verified reference counting scheme, and
+ dereferencing of vended JavaScript objects when applet is
+ destroyed (actually when part is destroyed).
+
+ Removed link hack for testkjs now that the Java folks think
+ they have a solution for the 1.4.2 JavaVM link problem. Although
+ Greg B. thinks his solution may cause problems for the 1.3.1
+ version of the VM!?!
+
+ Reviewed by Ken.
+
+ * Makefile.am:
+ * bindings/jni/jni_runtime.h:
+ (Bindings::JavaString::JavaString):
+ * bindings/jni/jni_utility.cpp:
+ (convertValueToJValue):
+ (convertValueToJObject):
+ (listFromJArray):
+ * bindings/jni/jni_utility.h:
+ * bindings/jni_jsobject.cpp:
+ (KJS_setFindRootObjectForNativeHandleFunction):
+ (KJS_findRootObjectForNativeHandleFunction):
+ (getReferencesByRootDictionary):
+ (getReferencesDictionary):
+ (findReferenceDictionary):
+ (rootForImp):
+ (addJavaReference):
+ (removeJavaReference):
+ * bindings/jni_jsobject.h:
+ (Bindings::RootObject::RootObject):
+ (Bindings::RootObject::~RootObject):
+ (Bindings::RootObject::setRootObjectImp):
+ (Bindings::RootObject::rootObjectImp):
+ (Bindings::RootObject::setInterpreter):
+ (Bindings::RootObject::interpreter):
+
+=== Safari-117 ===
+
+2003-12-10 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - fixed regression in JavaScript tests reported by the KDE guys
+ - fixed 3506345: REGRESSION (115-116): VIP: chordfind.com no longer displays chords
+
+ * kjs/ustring.h: Add tolerateEmptyString parameter to toDouble and toULong.
+ * kjs/ustring.cpp:
+ (KJS::UString::toDouble): Separate the "tolerant" parameter into two separate ones:
+ tolerateTrailingJunk and tolerateEmptyString. Add new overloads; better for code size
+ and binary compatibility than default parameter values.
+ (KJS::UString::toULong): Pass tolerateEmptyString down to toDouble. Add new overload.
+
+ * kjs/string_object.cpp: (StringProtoFuncImp::call): Pass false for the new
+ "tolerate empty string" parameter.
+
+2003-12-10 Richard Williamson <rjw@apple.com>
+
+ Added code to manage reference counting of JavaScript
+ objects passed to Java. Also added implementation of
+ KJS_JSCreateNativeJSObject. This is the function that
+ provides the root object to Java (KJS::Window).
+
+ Reviewed by Hyatt.
+
+ * JavaScriptCore.pbproj/project.pbxproj:
+ * bindings/jni_jsobject.cpp:
+ (KJS_setFindObjectForNativeHandleFunction):
+ (KJS_findObjectForNativeHandleFunction):
+ (getReferencesByOwnerDictionary):
+ (getReferencesDictionary):
+ (findReferenceDictionary):
+ (addJavaReference):
+ (removeJavaReference):
+ (removeAllJavaReferencesForOwner):
+ * bindings/jni_jsobject.h:
+
+2003-12-09 Richard Williamson <rjw@apple.com>
+
+ LiveConnect stubs that correspond to the native methods
+ on JSObject. These will be called from the new Java plugin
+ when an instance of JSObject is instantiated and messaged.
+ When these are implemented the Java will be able to originate
+ calls into JavaScript.
+
+ Also a temporary work-around added to Makefile.am to solve
+ a link problem. The 1.4.2 JavaVM accidentally links against
+ libobjc. This call a failure linking testkjs. Mike Hay is
+ working with someone to fix the problem (3505587).
+
+ Reviewed by Chris.
+
+ * JavaScriptCore.pbproj/project.pbxproj:
+ * Makefile.am:
+ * bindings/jni_jsobject.cpp: Added.
+ (KJS_JSCreateNativeJSObject):
+ (KJS_JSObject_JSFinalize):
+ (KJS_JSObject_JSObjectCall):
+ (KJS_JSObject_JSObjectEval):
+ (KJS_JSObject_JSObjectGetMember):
+ (KJS_JSObject_JSObjectSetMember):
+ (KJS_JSObject_JSObjectRemoveMember):
+ (KJS_JSObject_JSObjectGetSlot):
+ (KJS_JSObject_JSObjectSetSlot):
+ (KJS_JSObject_JSObjectToString):
+ * bindings/jni_jsobject.h: Added.
+
+2003-12-09 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by John.
+
+ <rdar://problem/3505183>: JavaScriptCore should assert that interpreter is locked in collector
+
+ * kjs/collector.cpp:
+ (KJS::Collector::allocate): Assert that interpreter lock count is not 0.
+ (KJS::Collector::collect): likewise
+
+2003-12-08 Richard Williamson <rjw@apple.com>
+
+ LiveConnect: The last piece of the JavaScript side of the
+ LiveConnect implementation. This change adds support for
+ setting/getting values from Java arrays in JavaScript.
+
+ Reviewed by John.
+
+ * bindings/jni/jni_instance.h:
+ * bindings/jni/jni_runtime.cpp:
+ (JavaField::JavaField):
+ (convertJObjectToArray):
+ (JavaArray::JavaArray):
+ (JavaArray::~JavaArray):
+ (JavaArray::setValueAt):
+ (JavaArray::valueAt):
+ (JavaArray::getLength):
+ * bindings/jni/jni_runtime.h:
+ (Bindings::JavaArray::operator=):
+ (Bindings::JavaArray::javaArray):
+ * bindings/jni/jni_utility.cpp:
+ (JNITypeFromPrimitiveType):
+ (convertValueToJValue):
+ * bindings/jni/jni_utility.h:
+ * bindings/runtime.h:
+ * bindings/runtime_array.cpp:
+ (RuntimeArrayImp::RuntimeArrayImp):
+ (RuntimeArrayImp::~RuntimeArrayImp):
+ (RuntimeArrayImp::get):
+ (RuntimeArrayImp::put):
+ (RuntimeArrayImp::hasProperty):
+ * bindings/runtime_array.h:
+ (KJS::RuntimeArrayImp::getLength):
+ (KJS::RuntimeArrayImp::getConcreteArray):
+ * bindings/runtime_object.cpp:
+ (RuntimeObjectImp::get):
+ (RuntimeObjectImp::canPut):
+ (RuntimeObjectImp::hasProperty):
+
+2003-12-05 Richard Williamson <rjw@apple.com>
+
+ LiveConnect: Part 1 of supporting JS bindings to
+ native language arrays.
+
+ Reviewed by Chris.
+
+ * JavaScriptCore.pbproj/project.pbxproj:
+ * bindings/jni/jni_runtime.cpp:
+ (JavaField::JavaField):
+ (convertJObjectToArray):
+ (JavaField::valueFromInstance):
+ (JavaField::setValueToInstance):
+ * bindings/jni/jni_runtime.h:
+ * bindings/runtime.cpp:
+ (Instance::setValueOfField):
+ * bindings/runtime.h:
+ (Bindings::Array::~Array):
+
+2003-12-04 Richard Williamson <rjw@apple.com>
+
+ LiveConnect: Moved defaultValue into concrete implementation because
+ more intelligent conversion can be perform with knowledge
+ of the class of the original instance.
+
+ Reviewed by Chris.
+
+ * bindings/jni/jni_class.cpp:
+ (JavaClass::isNumberClass):
+ (JavaClass::isBooleanClass):
+ (JavaClass::isStringClass):
+ * bindings/jni/jni_class.h:
+ * bindings/jni/jni_instance.cpp:
+ (JavaInstance::defaultValue):
+ (JavaInstance::valueOf):
+ * bindings/jni/jni_instance.h:
+ (Bindings::JavaInstance::javaInstance):
+ * bindings/runtime.h:
+ * bindings/runtime_object.cpp:
+ (RuntimeObjectImp::defaultValue):
+
+2003-12-04 Richard Williamson <rjw@apple.com>
+
+ LiveConnect: Added support for setting the value of Java
+ fields.
+
+ Reviewed by Chris.
+
+ * bindings/jni/jni_instance.cpp:
+ (JavaInstance::invokeMethod):
+ * bindings/jni/jni_runtime.cpp:
+ (JavaParameter::JavaParameter):
+ (JavaField::JavaField):
+ (JavaField::valueFromInstance):
+ (JavaField::setValueToInstance):
+ (JavaMethod::JavaMethod):
+ * bindings/jni/jni_runtime.h:
+ (Bindings::JavaField::getJNIType):
+ * bindings/jni/jni_utility.cpp:
+ (JNITypeFromClassName):
+ (convertValueToJValue):
+ * bindings/jni/jni_utility.h:
+ * bindings/runtime.cpp:
+ (Instance::setValueOfField):
+ * bindings/runtime.h:
+ * bindings/runtime_object.cpp:
+ (RuntimeObjectImp::get):
+ (RuntimeObjectImp::put):
+ (RuntimeObjectImp::defaultValue):
+
+2003-12-04 Richard Williamson <rjw@apple.com>
+
+ Added support for string conversions.
+ Changed various JavaString member variables to be inline.
+ Implemented defaultValue for context relevant type coercion.
+
+ Reviewed by Chris.
+
+ * bindings/jni/jni_class.cpp:
+ (JavaClass::JavaClass):
+ (JavaClass::setClassName):
+ (JavaClass::classForInstance):
+ * bindings/jni/jni_class.h:
+ * bindings/jni/jni_instance.cpp:
+ (JavaInstance::stringValue):
+ (JavaInstance::numberValue):
+ (JavaInstance::booleanValue):
+ (JavaInstance::invokeMethod):
+ * bindings/jni/jni_instance.h:
+ * bindings/jni/jni_runtime.cpp:
+ (JavaParameter::JavaParameter):
+ (JavaField::JavaField):
+ (JavaMethod::JavaMethod):
+ (appendClassName):
+ (JavaMethod::signature):
+ * bindings/jni/jni_runtime.h:
+ (Bindings::JavaString::JavaString):
+ (Bindings::JavaString::~JavaString):
+ (Bindings::JavaString::operator=):
+ (Bindings::JavaString::characters):
+ (Bindings::JavaParameter::JavaParameter):
+ (Bindings::JavaParameter::~JavaParameter):
+ (Bindings::JavaParameter::operator=):
+ (Bindings::JavaParameter::type):
+ (Bindings::JavaField::JavaField):
+ (Bindings::JavaField::~JavaField):
+ (Bindings::JavaField::operator=):
+ (Bindings::JavaField::name):
+ (Bindings::JavaField::type):
+ (Bindings::JavaMethod::JavaMethod):
+ (Bindings::JavaMethod::_commonDelete):
+ (Bindings::JavaMethod::name):
+ (Bindings::JavaMethod::returnType):
+ * bindings/jni/jni_utility.cpp:
+ (convertValueToJValue):
+ * bindings/runtime.h:
+ (Bindings::Instance::valueOf):
+ * bindings/runtime_method.cpp:
+ (RuntimeMethodImp::call):
+ * bindings/runtime_object.cpp:
+ (RuntimeObjectImp::RuntimeObjectImp):
+ (RuntimeObjectImp::get):
+ (RuntimeObjectImp::defaultValue):
+ * bindings/runtime_object.h:
+ (KJS::RuntimeObjectImp::classInfo):
+
+=== Safari-116 ===
+
+2003-12-03 Richard Williamson <rjw@apple.com>
+
+ LiveConnect: Added support for parameter passing to Java and conversion
+ of return values.
+
+ Reviewed by Chris.
+
+ * bindings/jni/jni_instance.cpp:
+ (JavaInstance::invokeMethod):
+ * bindings/jni/jni_instance.h:
+ * bindings/jni/jni_runtime.cpp:
+ (JavaParameter::JavaParameter):
+ (JavaMethod::JavaMethod):
+ (JavaMethod::signature):
+ * bindings/jni/jni_runtime.h:
+ (Bindings::JavaParameter::JavaParameter):
+ (Bindings::JavaParameter::operator=):
+ (Bindings::JavaParameter::getJNIType):
+ * bindings/jni/jni_utility.cpp:
+ (callJNIBooleanMethodA):
+ (convertValueToJValue):
+ * bindings/jni/jni_utility.h:
+ * bindings/runtime.h:
+ * bindings/runtime_method.cpp:
+ (RuntimeMethodImp::call):
+ * bindings/runtime_object.cpp:
+ (RuntimeObjectImp::get):
+
+2003-12-02 Richard Williamson <rjw@apple.com>
+
+ Added support for calling simple methods in Java from JavaScript.
+ (void return and no parameters). Yay, LiveConnect lives.
+
+ Still need write argument and return value conversion code.
+
+ Reviewed by Chris.
+
+ * JavaScriptCore.pbproj/project.pbxproj:
+ * bindings/jni/jni_instance.cpp:
+ (JavaInstance::getClass):
+ (JavaInstance::invokeMethod):
+ * bindings/jni/jni_instance.h:
+ * bindings/jni/jni_runtime.cpp:
+ (JavaMethod::JavaMethod):
+ (JavaMethod::signature):
+ (JavaMethod::JNIReturnType):
+ * bindings/jni/jni_runtime.h:
+ (Bindings::JavaMethod::_commonDelete):
+ (Bindings::JavaMethod::_commonCopy):
+ (Bindings::JavaMethod::name):
+ * bindings/jni/jni_utility.cpp:
+ (signatureFromPrimitiveType):
+ * bindings/jni/jni_utility.h:
+ * bindings/runtime.h:
+ * bindings/runtime_method.cpp: Added.
+ (RuntimeMethodImp::RuntimeMethodImp):
+ (RuntimeMethodImp::~RuntimeMethodImp):
+ (RuntimeMethodImp::get):
+ (RuntimeMethodImp::implementsCall):
+ (RuntimeMethodImp::call):
+ (RuntimeMethodImp::codeType):
+ (RuntimeMethodImp::execute):
+ * bindings/runtime_method.h: Added.
+ * bindings/runtime_object.cpp:
+ (RuntimeObjectImp::RuntimeObjectImp):
+ (RuntimeObjectImp::get):
+ * bindings/runtime_object.h:
+ * kjs/function.cpp:
+ (FunctionImp::FunctionImp):
+ * kjs/interpreter.h:
+
+2003-12-01 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - fixed 3493799: JavaScript string.replace expands $ if it's the last character in replacement string
+
+ * kjs/ustring.cpp: (KJS::UString::toDouble): Fix backwards handling of the "tolerant" boolean.
+ This indirectly caused the string.replace bug.
+
+2003-12-02 Maciej Stachowiak <mjs@apple.com>
+
+ Merged patches from Harri Porten and David Faure to fix:
+
+ <rdar://problem/3497643>: reproducible crash printing self-referential array
+
+ * kjs/array_object.cpp:
+ (ArrayProtoFuncImp::call): Break out of the loop if an exception was thrown.
+ * kjs/nodes.cpp:
+ (FunctionCallNode::evaluate): Move function call depth check from here...
+ * kjs/object.cpp:
+ (KJS::Object::call): ...to here.
+ * kjs/object.h: Un-inline Object::call now that it does more.
+
+2003-12-01 Richard Williamson <rjw@apple.com>
+
+ Fixed mistake in method signatures used to get boolean and integer fields.
+
+ Reviewed by Chris.
+
+ * bindings/jni/jni_runtime.cpp:
+ (JavaField::valueFromInstance):
+
+2003-12-01 Richard Williamson <rjw@apple.com>
+
+Fixed parameter passing to applet. Child elements are NOT valid in setStyle(). So we now create the widget before needed with createWidgetIfNecessary. This either happens when doing the first layout, or when JavaScript first references the applet element.
+
+Fixed early delete of the the main applet instance. When the JS collector cleaned up the last JS object referring to the applet instance we were deleting the java instance. This caused the applet instance cached on the applet element to be invalid. The applet instance is the only Java object not to be cleaned up by the JS collector.
+
+Added support for getting at Java object fields.
+
+ Reviewed by Chris.
+
+ * JavaScriptCore.pbproj/project.pbxproj:
+ * Makefile.am:
+ * bindings/jni/jni_instance.cpp:
+ (JObjectWrapper::JObjectWrapper):
+ * bindings/jni/jni_instance.h:
+ (Bindings::JObjectWrapper::~JObjectWrapper):
+ * bindings/jni/jni_runtime.cpp:
+ (JavaField::valueFromInstance):
+ * bindings/runtime_object.cpp:
+ (RuntimeObjectImp::~RuntimeObjectImp):
+ (RuntimeObjectImp::RuntimeObjectImp):
+ (RuntimeObjectImp::get):
+ (RuntimeObjectImp::deleteProperty):
+ * bindings/runtime_object.h:
+
+=== Safari-115 ===
+
+2003-11-21 Maciej Stachowiak <mjs@apple.com>
+
+ Patch from Harri Porten, reviewed by me.
+
+ - fixed 3491712 - String slice with negative arguments does not offset from end of string
+
+ * kjs/string_object.cpp:
+ (StringProtoFuncImp::call): Handle negative arguments as offsets from end by
+ adding length and clamping to [0,length-1].
+
+2003-11-21 Maciej Stachowiak <mjs@apple.com>
+
+ Patch from Harri Porten, reviewed by me.
+
+ - fixed 3491709 - using Function.apply with a primitive type as the arg list causes crash
+
+ * kjs/function_object.cpp:
+ (FunctionProtoFuncImp::call): Nest parentheses properly.
+
+2003-11-20 Richard Williamson <rjw@apple.com>
+
+ More LiveConnect stuff. Primitive Java fields are now
+ accessible from JavaScript! Yay!
+
+ Reviewed by Maciej.
+
+ * bindings/jni/jni_class.cpp:
+ (JavaClass::methodNamed):
+ (JavaClass::fieldNamed):
+ * bindings/jni/jni_class.h:
+ (Bindings::JavaClass::_commonDelete):
+ * bindings/jni/jni_instance.cpp:
+ (JavaInstance::JavaInstance):
+ (JavaInstance::~JavaInstance):
+ (JavaInstance::getClass):
+ * bindings/jni/jni_instance.h:
+ (Bindings::JavaInstance::javaInstance):
+ * bindings/jni/jni_runtime.cpp:
+ (JavaField::JavaField):
+ (JavaField::valueFromInstance):
+ * bindings/jni/jni_runtime.h:
+ (Bindings::JavaField::JavaField):
+ (Bindings::JavaField::~JavaField):
+ (Bindings::JavaField::operator=):
+ * bindings/jni/jni_utility.cpp:
+ (callJNIMethod):
+ (callJNIMethodA):
+ (callJNIVoidMethod):
+ (callJNIObjectMethod):
+ (callJNIBooleanMethod):
+ (callJNIByteMethod):
+ (callJNICharMethod):
+ (callJNIShortMethod):
+ (callJNIIntMethod):
+ (callJNILongMethod):
+ (callJNIFloatMethod):
+ (callJNIDoubleMethod):
+ (callJNIVoidMethodA):
+ (callJNIObjectMethodA):
+ (callJNIByteMethodA):
+ (callJNICharMethodA):
+ (callJNIShortMethodA):
+ (callJNIIntMethodA):
+ (callJNILongMethodA):
+ (callJNIFloatMethodA):
+ (callJNIDoubleMethodA):
+ (releaseCharactersForJStringInEnv):
+ (primitiveTypeFromClassName):
+ (getJNIField):
+ * bindings/jni/jni_utility.h:
+ * bindings/runtime.cpp:
+ (Instance::createBindingForLanguageInstance):
+ (Instance::getValueOfField):
+ * bindings/runtime.h:
+ * bindings/runtime_object.cpp:
+ (RuntimeObjectImp::get):
+
+2003-11-20 Richard Williamson <rjw@apple.com>
+
+ More LiveConnect stuff.
+
+ Reviewed by Chris.
+
+ * bindings/jni/jni_class.cpp:
+ (JavaClass::classForName):
+ (JavaClass::classForInstance):
+ * bindings/jni/jni_instance.cpp:
+ (JavaInstance::getValueOfField):
+ * bindings/jni/jni_instance.h:
+ (Bindings::JObjectWrapper::JObjectWrapper):
+ * bindings/jni/jni_runtime.h:
+ (Bindings::JavaConstructor::~JavaConstructor):
+ (Bindings::JavaConstructor::operator=):
+ (Bindings::JavaMethod::JavaMethod):
+ (Bindings::JavaMethod::_commonDelete):
+ (Bindings::JavaMethod::signature):
+ * bindings/jni/jni_utility.cpp:
+ (getJNIEnv):
+ (attachToJavaVM):
+ * bindings/jni/jni_utility.h:
+ * bindings/runtime.h:
+ * bindings/runtime_object.cpp:
+ (RuntimeObjectImp::~RuntimeObjectImp):
+ (RuntimeObjectImp::get):
+ * bindings/runtime_object.h:
+
+2003-11-19 Richard Williamson <rjw@apple.com>
+
+ More LiveConnect stuff.
+
+ Reviewed by Ken.
+
+ * JavaScriptCore.pbproj/project.pbxproj:
+ * bindings/jni/jni_class.cpp: Added.
+ (JavaClass::_commonInit):
+ (JavaClass::JavaClass):
+ (_createClassesByNameIfNecessary):
+ (JavaClass::classForName):
+ (JavaClass::classForInstance):
+ (JavaClass::methodNamed):
+ (JavaClass::fieldNamed):
+ * bindings/jni/jni_class.h: Added.
+ (Bindings::JavaClass::_commonDelete):
+ (Bindings::JavaClass::~JavaClass):
+ (Bindings::JavaClass::_commonCopy):
+ (Bindings::JavaClass::JavaClass):
+ (Bindings::JavaClass::operator=):
+ (Bindings::JavaClass::name):
+ (Bindings::JavaClass::constructorAt):
+ (Bindings::JavaClass::numConstructors):
+ * bindings/jni/jni_instance.cpp: Added.
+ (JavaInstance::JavaInstance):
+ (JavaInstance::~JavaInstance):
+ * bindings/jni/jni_instance.h: Added.
+ (Bindings::JObjectWrapper::JObjectWrapper):
+ (Bindings::JObjectWrapper::~JObjectWrapper):
+ (Bindings::JObjectWrapper::ref):
+ (Bindings::JObjectWrapper::deref):
+ (Bindings::JavaInstance::getClass):
+ (Bindings::JavaInstance::operator=):
+ * bindings/jni/jni_runtime.cpp:
+ (JavaMethod::JavaMethod):
+ * bindings/jni/jni_runtime.h:
+ (Bindings::JavaString::JavaString):
+ (Bindings::JavaString::~JavaString):
+ (Bindings::JavaString::operator=):
+ * bindings/jni/jni_utility.cpp:
+ (getJavaVM):
+ (getJNIEnv):
+ (getCharactersFromJString):
+ (releaseCharactersForJString):
+ (getCharactersFromJStringInEnv):
+ (releaseCharactersForJStringInEnv):
+ * bindings/jni/jni_utility.h:
+ * bindings/runtime.cpp:
+ (Instance::createBindingForLanguageInstance):
+ * bindings/runtime.h:
+ (Bindings::Instance::):
+
+2003-11-18 Richard Williamson <rjw@apple.com>
+
+ More live connect stubs. We're getting close.
+
+ Reviewed by Chris.
+
+ * JavaScriptCore.pbproj/project.pbxproj:
+ * bindings/jni/jni_runtime.cpp:
+ (JavaClass::JavaClass):
+ (JavaInstance::JavaInstance):
+ (JavaInstance::~JavaInstance):
+ * bindings/jni/jni_runtime.h:
+ (Bindings::JavaConstructor::value):
+ (Bindings::JavaField::value):
+ (Bindings::JavaMethod::value):
+ (Bindings::JavaClass::_commonDelete):
+ (Bindings::JavaClass::_commonCopy):
+ (Bindings::JavaClass::methodNamed):
+ (Bindings::JavaClass::fieldNamed):
+ (Bindings::JavaInstance::getClass):
+ * bindings/runtime.cpp: Added.
+ * bindings/runtime.h:
+ (Bindings::Instance::~Instance):
+ * bindings/runtime_object.cpp: Added.
+ (RuntimeObjectImp::classInfo):
+ (RuntimeObjectImp::RuntimeObjectImp):
+ (RuntimeObjectImp::get):
+ (RuntimeObjectImp::put):
+ (RuntimeObjectImp::canPut):
+ (RuntimeObjectImp::hasProperty):
+ (RuntimeObjectImp::deleteProperty):
+ (RuntimeObjectImp::defaultValue):
+ (RuntimeObjectImp::_initializeClassInfoFromInstance):
+ * bindings/runtime_object.h: Added.
+ (KJS::RuntimeObjectImp::setInternalInstance):
+ (KJS::RuntimeObjectImp::getInternalInstance):
+ * kjs/object.cpp:
+ (KJS::ObjectImp::get):
+ (KJS::ObjectImp::hasProperty):
+ * kjs/value.h:
+ (KJS::):
+
+2003-11-17 Maciej Stachowiak <mjs@apple.com>
+
+ Patch from Harri, reviewed by me.
+
+ - fixed 3487375 - backwards array slice causes infinite loop
+
+ * kjs/array_object.cpp:
+ (ArrayProtoFuncImp::call):
+
+2003-11-17 Maciej Stachowiak <mjs@apple.com>
+
+ Patch from Harri Porten reviewed by me.
+
+ - fixed 3487371 - operator precedence for bitwise or, xor and and is wrong
+
+ * kjs/grammar.y: Correct the precedence.
+
+2003-11-16 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by John.
+
+ - fixed 3483829 - JavaScriptCore needs workaround to compile on Merlot
+
+ * JavaScriptCore.pbproj/project.pbxproj: Add -Wno-long-double to
+ warning flags.
+
+=== Safari-114 ===
+
+2003-11-13 Richard Williamson <rjw@apple.com>
+
+ Factored common code between copy constructor and assignment operator.
+
+ Reviewed by Chris.
+
+ * ChangeLog:
+ * bindings/jni/jni_runtime.h:
+ (Bindings::JavaConstructor::_commonCopy):
+ (Bindings::JavaConstructor::JavaConstructor):
+ (Bindings::JavaConstructor::operator=):
+ (Bindings::JavaField::type):
+ * bindings/runtime.h:
+
+2003-11-13 Richard Williamson <rjw@apple.com>
+
+ More LiveConnect stuff. This checkin adds abstract classes to model
+ language runtimes and a JNI based set of concrete implementations for
+ Java.
+
+ Reviewed by Chris.
+
+ * JavaScriptCore.pbproj/project.pbxproj:
+ * Makefile.am:
+ * bindings/Makefile.am: Removed.
+ * bindings/jni/Makefile.am: Removed.
+ * bindings/jni/jni_runtime.cpp: Added.
+ (JavaField::JavaField):
+ (JavaConstructor::JavaConstructor):
+ (JavaMethod::JavaMethod):
+ (JavaClass::JavaClass):
+ * bindings/jni/jni_runtime.h: Added.
+ (Bindings::JavaString::JavaString):
+ (Bindings::JavaString::~JavaString):
+ (Bindings::JavaString::operator=):
+ (Bindings::JavaString::characters):
+ (Bindings::JavaParameter::JavaParameter):
+ (Bindings::JavaParameter::~JavaParameter):
+ (Bindings::JavaParameter::operator=):
+ (Bindings::JavaParameter::type):
+ (Bindings::JavaConstructor::JavaConstructor):
+ (Bindings::JavaConstructor::~JavaConstructor):
+ (Bindings::JavaConstructor::operator=):
+ (Bindings::JavaConstructor::parameterAt):
+ (Bindings::JavaConstructor::numParameters):
+ (Bindings::JavaField::JavaField):
+ (Bindings::JavaField::~JavaField):
+ (Bindings::JavaField::operator=):
+ (Bindings::JavaField::name):
+ (Bindings::JavaField::type):
+ (Bindings::JavaMethod::JavaMethod):
+ (Bindings::JavaMethod::_commonDelete):
+ (Bindings::JavaMethod::~JavaMethod):
+ (Bindings::JavaMethod::_commonCopy):
+ (Bindings::JavaMethod::operator=):
+ (Bindings::JavaMethod::name):
+ (Bindings::JavaMethod::returnType):
+ (Bindings::JavaMethod::parameterAt):
+ (Bindings::JavaMethod::numParameters):
+ (Bindings::JavaClass::_commonDelete):
+ (Bindings::JavaClass::~JavaClass):
+ (Bindings::JavaClass::_commonCopy):
+ (Bindings::JavaClass::JavaClass):
+ (Bindings::JavaClass::operator=):
+ (Bindings::JavaClass::name):
+ (Bindings::JavaClass::methodAt):
+ (Bindings::JavaClass::numMethods):
+ (Bindings::JavaClass::constructorAt):
+ (Bindings::JavaClass::numConstructors):
+ (Bindings::JavaClass::fieldAt):
+ (Bindings::JavaClass::numFields):
+ * bindings/jni/jni_utility.cpp:
+ (callJNIMethod):
+ (callJNIMethodA):
+ (callJNIObjectMethod):
+ (callJNIByteMethod):
+ (callJNICharMethod):
+ (callJNIShortMethod):
+ (callJNIIntMethod):
+ (callJNILongMethod):
+ (callJNIFloatMethod):
+ (callJNIDoubleMethod):
+ (callJNIVoidMethodA):
+ (callJNIObjectMethodA):
+ (callJNIByteMethodA):
+ (callJNICharMethodA):
+ (callJNIShortMethodA):
+ (callJNIIntMethodA):
+ (callJNILongMethodA):
+ (callJNIFloatMethodA):
+ (callJNIDoubleMethodA):
+ (getCharactersFromJString):
+ (releaseCharactersForJString):
+ * bindings/jni/jni_utility.h:
+ * bindings/objc/Makefile.am: Removed.
+ * bindings/runtime.h: Added.
+ (Bindings::Parameter::~Parameter):
+ (Bindings::Constructor::~Constructor):
+ (Bindings::Field::~Field):
+ (Bindings::Method::~Method):
+ (Bindings::Class::~Class):
+
+2003-11-13 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by John.
+
+ - fixed 3472562 - Null or Undefined variables passed to IN operator cause javascript exceptions
+
+ * kjs/nodes.cpp:
+ (ForInNode::execute): If the in value is null or undefined, bail
+ out early, since attempting to iterate its properties will throw
+ an exception.
+
+2003-11-12 Darin Adler <darin@apple.com>
+
+ - fixed the build
+
+ * Makefile.am: Fix the build by removing the bindings directory from SUBDIRS.
+ Later, we can either add this back and add the Makefile.am files to the top
+ level configure.in or leave it out and remove the Makefile.am files.
+
+2003-11-12 Richard Williamson <rjw@apple.com>
+
+ Added utility functions for calling JNI methods.
+
+ Reviewed by Chris.
+
+ * JavaScriptCore.pbproj/project.pbxproj:
+ * Makefile.am:
+ * bindings/Makefile.am: Added.
+ * bindings/jni/Makefile.am: Added.
+ * bindings/jni/jni_utility.cpp: Added.
+ (attachToJavaVM):
+ (callJNIMethod):
+ (callJNIVoidMethod):
+ (callJNIObjectMethod):
+ (callJNIByteMethod):
+ (callJNICharMethod):
+ (callJNIShortMethod):
+ (callJNIIntMethod):
+ (callJNILongMethod):
+ (callJNIFloatMethod):
+ (callJNIDoubleMethod):
+ * bindings/jni/jni_utility.h: Added.
+ * bindings/objc/Makefile.am: Added.
+
+2003-11-08 Darin Adler <darin@apple.com>
+
+ Reviewed by John.
+
+ - fixed 3477528 -- array.sort(function) fails if the function returns a non-zero value that rounds to zero
+
+ * kjs/array_object.cpp:
+ (compareByStringForQSort): Added checks for undefined values to match what the specification calls for.
+ (compareWithCompareFunctionForQSort): Added checks for undefined values as above, and also changed the
+ code that looks at the compare function result to look at the number returned without rounding to an integer.
+ (ArrayProtoFuncImp::call): Changed the code that looks at the compare function result to look at the number
+ returned without rounding to an integer.
+
+=== Safari-113 ===
+
+2003-11-03 Vicki Murley <vicki@apple.com>
+
+ Reviewed by kocienda.
+
+ - fixed <rdar://problem/3471096>: non-B&I builds should not use order files, because they cause false "regressions" in perf.
+
+ * JavaScriptCore.pbproj/project.pbxproj: added empty SECTORDER_FLAGS variables to the Development and Deployment build styles
+
+2003-11-02 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - changed list manipulation to use Harri Porten's idea of a circular
+ linked list that is built from head to tail rather than building the
+ list backwards and reversing the list when done
+
+ * kjs/grammar.y: Handle CatchNode and FinallyNode in a type-safe way.
+ Change many places that passed 0L to pass nothing at all, or to pass 0.
+
+ * kjs/nodes.h:
+ (KJS::ElementNode::ElementNode): Build a circular list instead of a 0-terminated
+ backwards list.
+ (KJS::ArrayNode::ArrayNode): Break the circular list instead of reversing the list.
+ (KJS::PropertyValueNode::PropertyValueNode): Moved before ObjectLiteralNode so the
+ inline code in ObjectLiteralNode works. Build a circular list instead of a 0-terminated
+ backwards list. Made the case for the first node separate so we don't need a nil check.
+ (KJS::ObjectLiteralNode::ObjectLiteralNode): Break the circular list instead of
+ reversing the list.
+ (KJS::ArgumentListNode::ArgumentListNode): Build a circular list instead of a 0-terminated
+ backwards list. Also, made the constructors inline (moved here from .cpp file).
+ (KJS::ArgumentsNode::ArgumentsNode): Break the circular list instead of
+ reversing the list.
+ (KJS::NewExprNode::NewExprNode): Changed a 0L to 0.
+ (KJS::StatListNode::StatListNode): Make this constructor no longer inline (moved into
+ .cpp file). The one in the .cpp file builds a circular list instead of a 0-terminated
+ backwards list.
+ (KJS::VarDeclListNode::VarDeclListNode): Build a circular list instead of a 0-terminated
+ backwards list.
+ (KJS::VarStatementNode::VarStatementNode): Break the circular list instead of reversing
+ the list.
+ (KJS::BlockNode::BlockNode): Make this constructor no longer inline (moved into .cpp file).
+ The one in the .cpp file breaks the list instead of reversing it.
+ (KJS::ForNode::ForNode): Break the circular list instead of reversing the list.
+ (KJS::CaseClauseNode::CaseClauseNode): Break the circular list instead of reversing the
+ list.
+ (KJS::ClauseListNode::ClauseListNode): Build a circular list instead of a 0-terminated
+ backwards list.
+ (KJS::CaseBlockNode::CaseBlockNode): Make this constructor no longer inline (moved into
+ .cpp file). The one in the .cpp file breaks the list instead of reversing it.
+ (KJS::TryNode::TryNode): Changed constructor to take typed parameters for the catch and
+ finally nodes rather than just Node.
+ (KJS::ParameterNode::ParameterNode): Build a circular list instead of a 0-terminated
+ backwards list.
+ (KJS::FuncDeclNode::FuncDeclNode): Break the circular list instead of reversing the
+ list.
+ (KJS::FuncExprNode::FuncExprNode): Break the circular list instead of reversing the
+ list.
+
+ * kjs/nodes.cpp:
+ (StatListNode::StatListNode): Moved this constructor here, no longer inline.
+ Did the "break circular list" thing instead of the "reverse list" thing.
+ Added setLoc calls to match KJS in the KDE tree; since we don't currently
+ use the JavaScript debugging support, it's unclear whether there's any benefit, but
+ later we might be using it and it's good to be as close as possible.
+ (BlockNode::BlockNode): Moved this constructor here, no longer inline.
+ Did the "break circular list" thing instead of the "reverse list" thing.
+ Added setLoc calls.
+ (CaseBlockNode::CaseBlockNode): Moved this constructor here, no longer inline.
+ Did the "break circular list" thing instead of the "reverse list" thing.
+ (SourceElementsNode::SourceElementsNode): Moved this constructor here, no longer inline.
+ Did the "break circular list" thing instead of the "reverse list" thing.
+ Added setLoc calls.
+
+ * kjs/grammar.cpp: Regenerated.
+ * kjs/grammar.cpp.h: Regenerated.
+ * kjs/grammar.h: Regenerated.
+
+=== Safari-112 ===
+
+2003-10-30 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Ken.
+
+ - fixed 3427069 - browsing mp3.com causes leaks (KJS)
+
+ * kjs/string_object.cpp:
+ (StringProtoFuncImp::call): Don't do an early return, since that
+ could leak a temporary regexp.
+
+2003-10-29 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin.
+
+ - fixed 3426076 - Leak of JS lexer data visiting http://www.ebay.com
+
+ * kjs/grammar.cpp:
+ (yyerror): Updated the commented code.
+ * kjs/grammar.y: Don't delete string and identifier tokens when done
+ with them any more, they'll get cleaned up by the lexer now.
+ * kjs/internal.cpp:
+ (Parser::parse): Tell lexer when done parsing.
+ * kjs/lexer.cpp:
+ (Lexer::Lexer): Initialize new data members.
+ (Lexer::lex): Use new methods to make strings and identifiers, and
+ save them.
+ (Lexer::makeIdentifier): Make a new Identifier and save it in an
+ auto-growing array.
+ (Lexer::makeUString): Likewise for UStrings.
+ (Lexer::doneParsing): Clean up arrays of Ifentifiers and UStrings.
+ * kjs/lexer.h:
+
+2003-10-28 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Ken.
+
+ - fixed 3413962 - malicious web pages can kill all future JavaScript execution by breaking recursion limit check
+
+ * kjs/nodes.cpp:
+ (FunctionCallNode::evaluate): If we're going to return early due
+ to breaking the recursion limit, make sure to lower it again, or
+ it will creep up by one each time it's exceeded.
+
+2003-10-26 Darin Adler <darin@apple.com>
+
+ * JavaScriptCorePrefix.h: Added a C case to the NULL definition since we use C as well
+ as C++ in this project.
+
+2003-10-26 Darin Adler <darin@apple.com>
+
+ - rolled in some CString changes Harri Porten did on the KDE side
+
+ * kjs/ustring.cpp:
+ (KJS::CString::CString): Use memcpy instead of strcpy for speed. Fix an off by one error
+ in the copy constructor.
+ (KJS::CString::operator=): Use memcpy instead of strcpy for speed.
+
+ * JavaScriptCorePrefix.h: Add a definition of NULL here that takes advantage of the GNU
+ __null feature even if the system C library doesn't.
+
+== Rolled over to ChangeLog-2003-10-25 ==
diff --git a/Source/JavaScriptCore/ChangeLog-2008-08-10 b/Source/JavaScriptCore/ChangeLog-2008-08-10
new file mode 100644
index 0000000..0912aec
--- /dev/null
+++ b/Source/JavaScriptCore/ChangeLog-2008-08-10
@@ -0,0 +1,31482 @@
+2008-08-10 Jan Michael Alonzo <jmalonzo@webkit.org>
+
+ Reviewed (and updated) by Alp Toker.
+
+ https://bugs.webkit.org/show_bug.cgi?id=16620
+ [GTK] Autotools make dist and make check support
+
+ Get make dist working.
+
+ Note that not all possible configurations have been tested yet.
+
+ * GNUmakefile.am:
+
+2008-08-09 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Sam Weinig.
+
+ Added same heap debug checks to more code paths.
+
+ * kjs/JSActivation.cpp:
+ (KJS::JSActivation::put):
+ (KJS::JSActivation::putWithAttributes):
+ * kjs/JSGlobalObject.cpp:
+ (KJS::JSGlobalObject::putWithAttributes):
+ * kjs/JSObject.h:
+ (KJS::JSObject::putDirect):
+ * kjs/JSVariableObject.h:
+ (KJS::JSVariableObject::symbolTablePut):
+ (KJS::JSVariableObject::symbolTablePutWithAttributes):
+
+2008-08-09 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Maciej.
+
+ Fix some style issues in the sampling tool.
+
+ * VM/SamplingTool.cpp:
+ (KJS::sleepForMicroseconds):
+ (KJS::SamplingTool::dump):
+
+2008-08-09 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Oliver.
+
+ Revision 35651, despite being a rather trivial change, introduced a
+ large regression on the regexp-dna SunSpider test. This regression
+ stemmed from an increase in the size of CodeBlock::dump(). There is
+ no reason for this method (and several related methods) to be compiled
+ in non-debug builds with the sampling tool disabled. This patch
+ conditionally compiles them, reversing the regression on SunSpider.
+
+ * JavaScriptCore.exp:
+ * VM/CodeBlock.cpp:
+ * VM/CodeBlock.h:
+ * VM/Machine.cpp:
+
+2008-08-08 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Oliver.
+
+ Bug 20330: JSCore crash loading any filehurricane media page
+ <https://bugs.webkit.org/show_bug.cgi?id=20330>
+
+ Fix a typo in the constant loading patch. Also, add a case for
+ op_unexpected_load to CodeBlock::dump().
+
+ * VM/CodeBlock.cpp:
+ (KJS::CodeBlock::dump):
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::addUnexpectedConstant):
+
+2008-08-08 Matt Lilek <webkit@mattlilek.com>
+
+ Not reviewed, build fix.
+
+ * JavaScriptCore.exp:
+
+2008-08-08 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ Improve performance of arithmetic operators
+
+ Added a fast (non-virtual) mechanism to determine if a non-immediate JSValue*
+ is a JSNumberCell. We then use this to allow improved specialisation in many
+ arithmetic operators. SunSpider reports a 2.5% progression overall, with greater
+ than 10% progressions on a number of arithmetic heavy tests.
+
+ * VM/Machine.cpp:
+ (KJS::fastIsNumber):
+ (KJS::fastToInt32):
+ (KJS::fastToUInt32):
+ (KJS::jsLess):
+ (KJS::jsLessEq):
+ (KJS::jsAdd):
+ (KJS::Machine::privateExecute):
+ * kjs/JSNumberCell.h:
+ (KJS::JSNumberCell::fastToInt32):
+ (KJS::JSNumberCell::fastToUInt32):
+ * kjs/collector.cpp:
+ (KJS::allocateBlock):
+ (KJS::Heap::heapAllocate):
+ * kjs/collector.h:
+ (KJS::Heap::fastIsNumber):
+
+2008-08-06 Adam Roben <aroben@apple.com>
+
+ Try to fix the Windows build bots
+
+ * API/JSBase.cpp: Touch this to force JSC to rebuild and re-copy the
+ WTF headers.
+
+2008-08-06 Tor Arne Vestbø <tavestbo@trolltech.com>
+
+ Revert change 35595.
+
+ * wtf/RetainPtr.h:
+
+2008-08-06 Ariya Hidayat <ariya.hidayat@trolltech.com>
+
+ Fix non-Mac build.
+
+ * wtf/RetainPtr.h: CoreFoundation only for PLATFORM(MAC)
+
+2008-08-06 Ariya Hidayat <ariya.hidayat@trolltech.com>
+
+ Fix non-Mac build.
+
+ * wtf/RetainPtr.h: CoreFoundation only for PLATFORM(MAC)
+
+2008-08-06 Csaba Osztrogonac <oszi@inf.u-szeged.hu>
+
+ Reviewed by Darin. Landed by Cameron.
+
+ Bug 20272: typo in JavaScriptCore
+ <https://bugs.webkit.org/show_bug.cgi?id=20272>
+
+ Correct the documentation for op_not. (typo)
+ Fix #undef. (typo)
+
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+
+2008-08-06 Cameron Zwarich <cwzwarich@webkit.org>
+
+ Reviewed by Maciej.
+
+ Bug 20286: Load constants all at once instead of using op_load
+ <https://bugs.webkit.org/show_bug.cgi?id=20286>
+
+ Load constants all at once into temporary registers instead of using
+ individual instances of op_load.
+
+ This is a 2.6% speedup on SunSpider.
+
+ * JavaScriptCore.exp:
+ * VM/CodeBlock.cpp:
+ (KJS::CodeBlock::dump):
+ (KJS::CodeBlock::mark):
+ * VM/CodeBlock.h:
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::CodeGenerator):
+ (KJS::CodeGenerator::newTemporary):
+ (KJS::CodeGenerator::addConstant):
+ (KJS::CodeGenerator::addUnexpectedConstant):
+ (KJS::CodeGenerator::emitLoad):
+ (KJS::CodeGenerator::emitUnexpectedLoad):
+ (KJS::CodeGenerator::emitNewError):
+ * VM/CodeGenerator.h:
+ * VM/Machine.cpp:
+ (KJS::slideRegisterWindowForCall):
+ (KJS::Machine::unwindCallFrame):
+ (KJS::Machine::throwException):
+ (KJS::Machine::execute):
+ (KJS::Machine::privateExecute):
+ * VM/Machine.h:
+ * VM/Opcode.h:
+ * VM/RegisterID.h:
+ (KJS::RegisterID::RegisterID):
+ (KJS::RegisterID::makeConstant):
+ (KJS::RegisterID::isTemporary):
+ * kjs/NodeInfo.h:
+ * kjs/Parser.cpp:
+ (KJS::Parser::didFinishParsing):
+ * kjs/Parser.h:
+ (KJS::Parser::parse):
+ * kjs/grammar.y:
+ * kjs/nodes.cpp:
+ (KJS::NullNode::emitCode):
+ (KJS::BooleanNode::emitCode):
+ (KJS::NumberNode::emitCode):
+ (KJS::StringNode::emitCode):
+ (KJS::ArrayNode::emitCode):
+ (KJS::DeleteResolveNode::emitCode):
+ (KJS::DeleteValueNode::emitCode):
+ (KJS::VoidNode::emitCode):
+ (KJS::ConstDeclNode::emitCodeSingle):
+ (KJS::ReturnNode::emitCode):
+ (KJS::ScopeNode::ScopeNode):
+ (KJS::ProgramNode::ProgramNode):
+ (KJS::ProgramNode::create):
+ (KJS::EvalNode::EvalNode):
+ (KJS::EvalNode::create):
+ (KJS::FunctionBodyNode::FunctionBodyNode):
+ (KJS::FunctionBodyNode::create):
+ (KJS::FunctionBodyNode::emitCode):
+ * kjs/nodes.h:
+ (KJS::ScopeNode::neededConstants):
+
+2008-08-05 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Cameron.
+
+ - add fast path for immediates to % operator, as we have for many other math ops
+
+ This fixes handling for a 0 divisor relative to the last patch. Only an 0.2% speedup on SunSpider but
+ still a 1.4x win on Oliver's prime test.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+
+2008-08-05 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Darin.
+
+ Bug 20293: Crash in JavaScript codegen for eval("const a;")
+ <https://bugs.webkit.org/show_bug.cgi?id=20293>
+
+ Correctly handle constant declarations in eval code with no initializer.
+
+ * kjs/nodes.cpp:
+ (KJS::ConstDeclNode::emitCodeSingle):
+
+2008-08-05 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Oliver.
+
+ Roll out r35555 because of correctness issues.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+
+2008-08-05 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Geoff.
+
+ - add fast path for immediates to % operator, as we have for many other math ops
+
+ 0.6% speedup on SunSpider. 1.4x speedup on a prime testing torture test that Oliver whipped up.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+
+2008-07-31 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ Bug 19359: JavaScriptCore behaves differently from FF2/3 and IE when handling context in catch statement
+ <https://bugs.webkit.org/show_bug.cgi?id=19359>
+
+ Make our catch behave like Firefox and IE, we do this by using a StaticScopeObject
+ instead of a generic JSObject for the scope node. We still don't make use of the
+ fact that we have a static scope inside the catch block, so the internal performance
+ of the catch block is not improved, even though technically it would be possible to
+ do so.
+
+ * VM/CodeBlock.cpp:
+ (KJS::CodeBlock::dump):
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::emitPushNewScope):
+ * VM/CodeGenerator.h:
+ * VM/Machine.cpp:
+ (KJS::createExceptionScope):
+ (KJS::Machine::privateExecute):
+ * VM/Machine.h:
+ * VM/Opcode.h:
+ * kjs/JSStaticScopeObject.cpp:
+ (KJS::JSStaticScopeObject::toThisObject):
+ (KJS::JSStaticScopeObject::put):
+ * kjs/JSStaticScopeObject.h:
+ * kjs/nodes.cpp:
+ (KJS::TryNode::emitCode):
+
+2008-08-02 Rob Gowin <robg@gowin.net>
+
+ Reviewed by Eric Seidel.
+
+ Added JavaScriptCore/API/WebKitAvailability to list of files in
+ javascriptcore_h_api.
+
+ * GNUmakefile.am:
+
+2008-08-01 Alexey Proskuryakov <ap@webkit.org>
+
+ Rubber-stamped by Maciej.
+
+ Remove JSGlobalData::DataInstance. It was only needed when we had per-thread JSGlobalData
+ instances.
+
+ * kjs/JSGlobalData.h:
+
+2008-07-31 Kevin Ollivier <kevino@theolliviers.com>
+
+ Second attempt at Windows/wx build fix. Instead of avoiding inclusion of windows.h,
+ use defines, etc. to avoid conflicts in each affected file. Also, change PLATFORM(WIN)
+ to PLATFORM(WIN_OS) so that other ports using Windows headers get the right impls.
+
+ * VM/SamplingTool.cpp:
+ * wtf/Threading.h:
+
+2008-07-31 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Adam.
+
+ Fix Windows build.
+
+ * kjs/collector.h:
+ * wtf/FastMalloc.cpp:
+
+2008-07-31 Csaba Osztrogonac <oszi@inf.u-szeged.hu>
+
+ Reviewed by Simon.
+
+ Bug 20170: [Qt] missing namespace defines in JavaScriptCore.pro
+ <https://bugs.webkit.org/show_bug.cgi?id=20170>
+
+ * JavaScriptCore.pro: Added missing define.
+
+2008-07-31 Alexey Proskuryakov <ap@webkit.org>
+
+ Rubber-stamped by Maciej.
+
+ Eliminate JSLock (it was already disabled, removing the stub implementaion and all
+ call sites now).
+
+ * API/JSBase.cpp:
+ (JSEvaluateScript):
+ (JSCheckScriptSyntax):
+ (JSGarbageCollect):
+ * API/JSCallbackConstructor.cpp:
+ (KJS::constructJSCallback):
+ * API/JSCallbackFunction.cpp:
+ (KJS::JSCallbackFunction::call):
+ * API/JSCallbackObjectFunctions.h:
+ (KJS::::init):
+ (KJS::::getOwnPropertySlot):
+ (KJS::::put):
+ (KJS::::deleteProperty):
+ (KJS::::construct):
+ (KJS::::hasInstance):
+ (KJS::::call):
+ (KJS::::getPropertyNames):
+ (KJS::::toNumber):
+ (KJS::::toString):
+ (KJS::::staticValueGetter):
+ (KJS::::callbackGetter):
+ * API/JSContextRef.cpp:
+ (JSGlobalContextCreateInGroup):
+ (JSGlobalContextRetain):
+ (JSGlobalContextRelease):
+ * API/JSObjectRef.cpp:
+ (JSObjectMake):
+ (JSObjectMakeFunctionWithCallback):
+ (JSObjectMakeConstructor):
+ (JSObjectMakeFunction):
+ (JSObjectHasProperty):
+ (JSObjectGetProperty):
+ (JSObjectSetProperty):
+ (JSObjectGetPropertyAtIndex):
+ (JSObjectSetPropertyAtIndex):
+ (JSObjectDeleteProperty):
+ (JSObjectCallAsFunction):
+ (JSObjectCallAsConstructor):
+ (JSObjectCopyPropertyNames):
+ (JSPropertyNameArrayRelease):
+ (JSPropertyNameAccumulatorAddName):
+ * API/JSStringRef.cpp:
+ (JSStringRelease):
+ * API/JSValueRef.cpp:
+ (JSValueIsEqual):
+ (JSValueIsInstanceOfConstructor):
+ (JSValueMakeNumber):
+ (JSValueMakeString):
+ (JSValueToNumber):
+ (JSValueToStringCopy):
+ (JSValueToObject):
+ (JSValueProtect):
+ (JSValueUnprotect):
+ * ForwardingHeaders/JavaScriptCore/JSLock.h: Removed.
+ * GNUmakefile.am:
+ * JavaScriptCore.exp:
+ * JavaScriptCore.order:
+ * JavaScriptCore.pri:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * JavaScriptCoreSources.bkl:
+ * kjs/AllInOneFile.cpp:
+ * kjs/JSGlobalData.cpp:
+ (KJS::JSGlobalData::JSGlobalData):
+ * kjs/JSGlobalData.h:
+ * kjs/JSGlobalObject.cpp:
+ (KJS::JSGlobalObject::~JSGlobalObject):
+ (KJS::JSGlobalObject::init):
+ * kjs/JSLock.cpp: Removed.
+ * kjs/JSLock.h: Removed.
+ * kjs/Shell.cpp:
+ (functionGC):
+ (jscmain):
+ * kjs/collector.cpp:
+ (KJS::Heap::~Heap):
+ (KJS::Heap::heapAllocate):
+ (KJS::Heap::setGCProtectNeedsLocking):
+ (KJS::Heap::protect):
+ (KJS::Heap::unprotect):
+ (KJS::Heap::collect):
+ * kjs/identifier.cpp:
+ * kjs/interpreter.cpp:
+ (KJS::Interpreter::checkSyntax):
+ (KJS::Interpreter::evaluate):
+
+2008-07-31 Alexey Proskuryakov <ap@webkit.org>
+
+ Rubber-stamped by Oliver Hunt.
+
+ Fix the Mac project to not display "test/" as part of file name for tests.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2008-07-31 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Rename USE(MULTIPLE_THREADS) to ENABLE(JSC_MULTIPLE_THREADS)
+ to better match the use/enable pattern (and better describe
+ the usage of the feature in question.)
+
+ I also fixed a couple other ENABLE_ macros to be pre-processor
+ definition override-able to match the rest of the ENABLE_ macros
+ since it seems to be our convention that build systems can set
+ ENABLE_ macros in Makefiles.
+
+ * kjs/InitializeThreading.cpp:
+ (KJS::initializeThreadingOnce):
+ * kjs/JSGlobalData.cpp:
+ (KJS::JSGlobalData::JSGlobalData):
+ (KJS::JSGlobalData::~JSGlobalData):
+ * kjs/MathObject.cpp:
+ * kjs/collector.cpp:
+ (KJS::Heap::Heap):
+ (KJS::Heap::~Heap):
+ (KJS::allocateBlock):
+ (KJS::Heap::markStackObjectsConservatively):
+ * kjs/collector.h:
+ * kjs/dtoa.cpp:
+ (KJS::pow5mult):
+ (KJS::rv_alloc):
+ (KJS::freedtoa):
+ (KJS::dtoa):
+ * wtf/FastMalloc.cpp:
+ * wtf/Platform.h:
+ * wtf/RefCountedLeakCounter.cpp:
+
+2008-07-30 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Mark Rowe.
+
+ Try to clean up our usage of USE(MULTIPLE_THREADS) vs. USE(PTHREADS) a little.
+ It looks like JSC assumes that if MULTIPLE_THREADS is defined, then pthreads will always be available
+ I'm not sure that's always the case for gtk, certainly not for Windows. We should eventually go back
+ and fix wtf/Threading.h to cover all these cases some day.
+
+ * kjs/JSLock.cpp:
+ * kjs/collector.h:
+ * wtf/Platform.h:
+
+2008-07-30 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Oliver.
+
+ MSVC warns when structs are called classes or vice versa.
+ Make all the source refer to JSGlobalData as a class.
+
+ * kjs/CommonIdentifiers.h:
+ * kjs/JSGlobalData.h:
+ * kjs/Parser.h:
+ * kjs/lexer.h:
+
+2008-07-30 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Geoff Garen.
+
+ Add consistency checks to UString to document and enforce its design.
+
+ * kjs/ustring.cpp:
+ (KJS::UString::Rep::create):
+ (KJS::UString::Rep::destroy):
+ (KJS::UString::Rep::checkConsistency):
+ (KJS::UString::expandCapacity):
+ (KJS::UString::expandPreCapacity):
+ (KJS::UString::UString):
+ (KJS::UString::spliceSubstringsWithSeparators):
+ (KJS::UString::append):
+ * kjs/ustring.h:
+ (KJS::UString::Rep::checkConsistency):
+
+2008-07-30 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Fixes for Windows and non-AllInOne file build with SamplingTool, plus review fixes.
+
+ * GNUmakefile.am: Adding SamplingTool.cpp to build.
+ * JavaScriptCore.exp: Export hooks to init & control SamplingTool.
+ * JavaScriptCore.pri: Adding SamplingTool.cpp to build.
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Adding SamplingTool.cpp to build.
+ * JavaScriptCore.xcodeproj/project.pbxproj: Adding SamplingTool.cpp to build.
+ * JavaScriptCoreSources.bkl: Adding SamplingTool.cpp to build.
+ * VM/Machine.cpp: MACHINE_SAMPLING_callingNativeFunction renamed MACHINE_SAMPLING_callingHostFunction
+ * VM/Machine.h:
+ * VM/Opcode.cpp: SamplingTool moved to SamplingTool.cpp/.h, opcodeNames generated from FOR_EACH_OPCODE_ID.
+ * VM/Opcode.h:
+ * VM/SamplingTool.cpp: Added .cpp/.h for SamplingTool.
+ * VM/SamplingTool.h:
+ * kjs/Shell.cpp: Switched SAMPLING_TOOL_ENABLED to ENABLE_SAMPLING_TOOL.
+ * wtf/Platform.h: Added ENABLE_SAMPLING_TOOL config option.
+ * kjs/nodes.cpp: Header include to fix non-AllInOne builds.
+
+2008-07-30 Ariya Hidayat <ariya.hidayat@trolltech.com>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Fix compilation without multi-threading support.
+
+ * kjs/collector.cpp:
+ (KJS::Heap::Heap):
+
+2008-07-30 Anders Carlsson <andersca@apple.com>
+
+ Add WebKitAvailability.h forwarding header.
+
+ * ForwardingHeaders/JavaScriptCore/WebKitAvailability.h: Added.
+
+2008-07-30 Anders Carlsson <andersca@apple.com>
+
+ Fix the else.
+
+ * API/WebKitAvailability.h:
+
+2008-07-30 Anders Carlsson <andersca@apple.com>
+
+ * API/WebKitAvailability.h:
+ Fix Windows (and other non-Mac builds).
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ Add WebKitAvailability.h to the project.
+
+2008-07-30 Anders Carlsson <andersca@apple.com>
+
+ One step closer towards fixing the Windows build.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make:
+ Make sure to copy WebKitAvailability.h
+
+2008-07-29 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Bug 20209: Atomize constant strings
+ <https://bugs.webkit.org/show_bug.cgi?id=20209>
+
+ Prevents significant performance degradation seen when a script contains multiple
+ identical strings that are used as keys to identify properties on objects.
+
+ No performance change on SunSpider.
+
+ * kjs/nodes.cpp: Atomize constant strings.
+
+2008-07-30 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Alexey Proskuryakov.
+
+ <rdar://problem/6111648> JavaScript exceptions fail if the scope chain includes the global object
+
+ In an attempt to remove the branch I just added to KJS::depth I
+ used the existence of a Variable Object at a point in the scope
+ chain as an indicator of function or global scope activation.
+ However this assumption results in incorrect behaviour if the
+ global object is injected into the scope chain with 'with'.
+
+ * VM/Machine.cpp:
+ (KJS::depth):
+
+2008-07-30 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Geoff Garen.
+
+ Don't call JSGarbageCollect() on a released context.
+
+ * API/testapi.c: (main):
+
+2008-07-29 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Geoff Garen.
+
+ Implement JSContextGroup APIs to make concurrent execution possible for
+ JavaScriptCore clients.
+
+ This changes the behavior of JSGlobalContextCreate(), so that it now uses a private context
+ group for each context, making JSlock implicit locking unnecessary.
+
+ * API/JSContextRef.h:
+ * API/JSContextRef.cpp:
+ (JSContextGroupCreate):
+ (JSContextGroupRetain):
+ (JSContextGroupRelease):
+ (JSGlobalContextCreate):
+ (JSGlobalContextCreateInGroup):
+ (JSGlobalContextRelease):
+ (JSContextGetGroup):
+ Added new methods. JSGlobalContextCreate() calls JSGlobalContextCreateInGroup() now.
+
+ * API/APICast.h: (toJS): (toRef): Added converters for JSContextGroupRef.
+ * API/JSBase.cpp: (JSGarbageCollect): JSGarbageCollect(0) is now a no-op, and the passed in
+ context is actually used.
+
+ * API/JSBase.h: Aded a typedef for JSContextGroupRef. Updated documentation for
+ JSGarbageCollect().
+
+ * JavaScriptCore.exp: Removed JSGlobalData::sharedInstance().
+
+ * kjs/JSGlobalData.cpp:
+ * kjs/JSGlobalData.h:
+ Removed support for JSGlobalData shared instance. JSGlobalData::isSharedInstance member
+ variable still remains, to be deleted in a followup patch.
+
+ * kjs/JSLock.cpp: (KJS::JSLock::JSLock): Disabled JSLock, to be deleted in a follow-up patch.
+
+ * kjs/collector.cpp:
+ (KJS::Heap::markOtherThreadConservatively): Removed an assertion that referenced
+ JSGlobalData::sharedInstance.
+
+ * kjs/collector.h: Made Heap destructor public, so that JSContextRelease can use it.
+
+2008-07-29 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Geoff Garen.
+
+ Fix a leak of ThreadRegistrar objects.
+
+ As the heap is usually deleted when registered threads still exist, ThreadSpecific doesn't
+ have a chance to clean up per-thread object. Switched to native pthread calls, storing a
+ plain pointer that doesn't require cleanup.
+
+ * kjs/collector.cpp:
+ (KJS::PlatformThread::PlatformThread):
+ (KJS::Heap::Thread::Thread):
+ (KJS::Heap::Heap):
+ (KJS::Heap::~Heap):
+ (KJS::Heap::registerThread):
+ (KJS::Heap::unregisterThread):
+ * kjs/collector.h:
+
+2008-07-29 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Sam Weinig.
+
+ https://bugs.webkit.org/show_bug.cgi?id=20169
+ Memory allocated with fastMalloc is freed with delete
+
+ * VM/JSPropertyNameIterator.cpp:
+ (KJS::JSPropertyNameIterator::invalidate): Free the array properly.
+ (KJS::JSPropertyNameIterator::~JSPropertyNameIterator): Delete the array by calling
+ invalidate().
+
+2008-07-29 Mark Rowe <mrowe@apple.com>
+
+ Attempt to fix the Qt build.
+
+ * wtf/ThreadingQt.cpp: Add the extra argument to createThread.
+
+2008-07-29 Adam Roben <aroben@apple.com>
+
+ Change Vector::find to return an index instead of an iterator
+
+ Indices are more natural than iterators when working with Vector.
+
+ Reviewed by John Sullivan.
+
+ * wtf/Vector.h:
+ (WTF::Vector::find): Changed to iterate the Vector manually and return
+ the index of the found item, rather than an iterator. When the item
+ could not be found, we return WTF::notFound.
+
+2008-07-29 Adam Roben <aroben@apple.com>
+
+ Windows build fix
+
+ * wtf/ThreadingWin.cpp:
+ (WTF::setThreadName): Move a misplaced assertion to here...
+ (WTF::createThread): ...from here.
+
+2008-07-29 Adam Roben <aroben@apple.com>
+
+ Add support for setting thread names on Windows
+
+ These thread names make it much easier to identify particular threads
+ in Visual Studio's Threads panel.
+
+ WTF::createThread now takes a const char* representing the thread's
+ name. On Windows, we throw a special exception to set this string as
+ the thread's name. Other platforms do nothing with this name for now.
+
+ Reviewed by Anders Carlsson.
+
+ * JavaScriptCore.exp: Export the new version of createThread that
+ takes 3 arguments (the old one continues to be exported for backward
+ compatibility).
+ * wtf/Threading.h: Add a threadName argument to createThread.
+
+ * wtf/ThreadingGtk.cpp:
+ (WTF::createThread):
+ * wtf/ThreadingNone.cpp:
+ (WTF::createThread):
+ Updated for function signature change.
+
+ * wtf/ThreadingPthreads.cpp:
+ (WTF::createThread): Updated for function signature change. We keep
+ around the old 2-argument version of createThread for backward
+ compatibility.
+
+ * wtf/ThreadingWin.cpp:
+ (WTF::setThreadName): Added. This function's implementation came from
+ MSDN.
+ (WTF::initializeThreading): Set the name of the main thread.
+ (WTF::createThread): Call setThreadName. We keep around the old
+ 2-argument version of createThread for backward compatibility.
+
+2008-07-29 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Oliver Hunt.
+
+ Store UString::Rep::isStatic bit in identifierTable pointer instead of reportedCost for
+ slightly nicer code and a 0.5% SunSpider improvement.
+
+ * API/JSClassRef.cpp:
+ (OpaqueJSClass::~OpaqueJSClass):
+ (OpaqueJSClassContextData::OpaqueJSClassContextData):
+ * API/JSStringRef.cpp:
+ (JSStringRelease):
+ * kjs/PropertyNameArray.cpp:
+ (KJS::PropertyNameArray::add):
+ * kjs/identifier.cpp:
+ (KJS::IdentifierTable::~IdentifierTable):
+ (KJS::IdentifierTable::add):
+ (KJS::Identifier::addSlowCase):
+ (KJS::Identifier::remove):
+ * kjs/identifier.h:
+ (KJS::Identifier::add):
+ * kjs/ustring.cpp:
+ (KJS::):
+ (KJS::UString::Rep::create):
+ (KJS::UString::Rep::destroy):
+ * kjs/ustring.h:
+ (KJS::UString::Rep::identifierTable):
+ (KJS::UString::Rep::setIdentifierTable):
+ (KJS::UString::Rep::isStatic):
+ (KJS::UString::Rep::setStatic):
+ (KJS::UString::cost):
+
+2008-07-28 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Renamed "ConstructTypeNative" => "ConstructTypeHost".
+
+2008-07-26 Mark Rowe <mrowe@apple.com>
+
+ Speculative fix for the wx build.
+
+ * JavaScriptCoreSources.bkl: Add JSStaticScopeObject.cpp to the list of source files.
+
+2008-07-25 Oliver Hunt <oliver@apple.com>
+
+ RS=Cameron Zwarich.
+
+ Whoops, forgot to save style correction.
+
+ * kjs/JSStaticScopeObject.h:
+
+2008-07-25 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ Bug 19718: Named anonymous functions are slow accessing global variables
+ <https://bugs.webkit.org/show_bug.cgi?id=19718>
+
+ To fix this we switch over to an activation-like scope object for
+ on which we attach the function name property, and add logic to
+ prevent cross scope assignment to read only properties.
+
+ * GNUmakefile.am:
+ * JavaScriptCore.pri:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::findScopedProperty):
+ (KJS::CodeGenerator::emitResolve):
+ * VM/CodeGenerator.h:
+ * kjs/AllInOneFile.cpp:
+ * kjs/JSStaticScopeObject.cpp: Added.
+ (KJS::JSStaticScopeObject::putWithAttributes):
+ (KJS::JSStaticScopeObject::isDynamicScope):
+ (KJS::JSStaticScopeObject::~JSStaticScopeObject):
+ (KJS::JSStaticScopeObject::getOwnPropertySlot):
+ * kjs/JSStaticScopeObject.h: Added.
+ (KJS::JSStaticScopeObject::JSStaticScopeObjectData::JSStaticScopeObjectData):
+ (KJS::JSStaticScopeObject::JSStaticScopeObject):
+ * kjs/nodes.cpp:
+ (KJS::FunctionCallResolveNode::emitCode):
+ (KJS::PostfixResolveNode::emitCode):
+ (KJS::PrefixResolveNode::emitCode):
+ (KJS::ReadModifyResolveNode::emitCode):
+ (KJS::AssignResolveNode::emitCode):
+ (KJS::FuncExprNode::makeFunction):
+
+2008-07-25 kevino <kevino@theolliviers.com>
+
+ wx build fix for Win.
+
+ On wx/Win, including windows.h in Threading.h causes multiply-defined symbol errors
+ for libjpeg and wx, and also wx needs to include windows.h itself first for wx
+ includes to work right. So until we can find a better solution to this problem,
+ on wx, we work around the need to include windows.h here.
+
+ * wtf/Threading.h:
+
+2008-07-25 Adam Roben <aroben@apple.com>
+
+ Windows build fix
+
+ * JavaScriptCore.vcproj/testapi/testapi.vcproj: Add API/ to the
+ include path.
+
+2008-07-25 Simon Hausmann <hausmann@webkit.org>
+
+ Fix the build of jsc on Qt/Windows, make sure os-win32 is in the
+ include search path (added by WebKit.pri).
+
+ * kjs/jsc.pro:
+
+2008-07-25 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Simon Hausmann.
+
+ Move JavaScriptCore API tests into a subdirectory of their own to avoid header name
+ conflicts and developer confusion.
+
+ * API/JSNode.c: Removed.
+ * API/JSNode.h: Removed.
+ * API/JSNodeList.c: Removed.
+ * API/JSNodeList.h: Removed.
+ * API/Node.c: Removed.
+ * API/Node.h: Removed.
+ * API/NodeList.c: Removed.
+ * API/NodeList.h: Removed.
+ * API/minidom.c: Removed.
+ * API/minidom.html: Removed.
+ * API/minidom.js: Removed.
+ * API/testapi.c: Removed.
+ * API/testapi.js: Removed.
+ * API/tests: Added.
+ * API/tests/JSNode.c: Copied from JavaScriptCore/API/JSNode.c.
+ * API/tests/JSNode.h: Copied from JavaScriptCore/API/JSNode.h.
+ * API/tests/JSNodeList.c: Copied from JavaScriptCore/API/JSNodeList.c.
+ * API/tests/JSNodeList.h: Copied from JavaScriptCore/API/JSNodeList.h.
+ * API/tests/Node.c: Copied from JavaScriptCore/API/Node.c.
+ * API/tests/Node.h: Copied from JavaScriptCore/API/Node.h.
+ * API/tests/NodeList.c: Copied from JavaScriptCore/API/NodeList.c.
+ * API/tests/NodeList.h: Copied from JavaScriptCore/API/NodeList.h.
+ * API/tests/minidom.c: Copied from JavaScriptCore/API/minidom.c.
+ * API/tests/minidom.html: Copied from JavaScriptCore/API/minidom.html.
+ * API/tests/minidom.js: Copied from JavaScriptCore/API/minidom.js.
+ * API/tests/testapi.c: Copied from JavaScriptCore/API/testapi.c.
+ * API/tests/testapi.js: Copied from JavaScriptCore/API/testapi.js.
+ * GNUmakefile.am:
+ * JavaScriptCore.vcproj/testapi/testapi.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2008-07-25 Simon Hausmann <hausmann@webkit.org>
+
+ Prospective WX build fix, add JavaScriptCore/API to the include search
+ path.
+
+ * jscore.bkl:
+
+2008-07-25 Simon Hausmann <hausmann@webkit.org>
+
+ Rubber-stamped by Lars.
+
+ Fix the build on Windows. operator new for ArgList is implemented using fastMalloc()
+ but operator delete was not implemented. Unfortunately MSVC decides to call/reference
+ the function, so a simple implementation using fastFree() fixes the build.
+
+ * kjs/ArgList.h:
+ (KJS::ArgList::operator delete):
+
+2008-07-25 Simon Hausmann <hausmann@webkit.org>
+
+ Discussed with and rubber-stamped by Lars.
+
+ Fix the build system for the Qt port.
+
+ Recent JavaScriptCore changes require the addition of JavaScriptCore/API to the
+ include search path. With a build process that combines JavaScriptCore and
+ WebCore in one build process/Makefile the existance of
+ JavaScriptCore/API/Node.h and WebCore/dom/Node.h causes include conflicts.
+
+ This commit solves this by introducing a separate build of JavaScriptCore into
+ a static library.
+
+ As a result of the split-up a race-condition due to broken dependencies of
+ regular source files to header files of generated sources showed up very
+ frequently when doing parallel builds (which the buildbot does). This commit at
+ the same time tries to address the dependency problem by making the
+ addExtraCompiler() function also generate a pseudo extra compiler that
+ represents the header file output, so that qmake is aware of the creation of
+ the header file for dependency calculation.
+
+ At the same time I removed a lot of cruft from the pro files to ease maintenance.
+
+ * JavaScriptCore.pri:
+ * JavaScriptCore.pro: Added.
+ * kjs/jsc.pro:
+
+2008-07-24 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Fixed a strict aliasing violation, which caused hash tables with floating
+ point keys not to find items that were indeed in the tables
+ (intermittently, and only in release builds, of course).
+
+ SunSpider reports no change.
+
+ This bug doesn't seem to affect any existing code, but it causes obvious
+ crashes in some new code I'm working on.
+
+ * wtf/HashFunctions.h:
+ (WTF::FloatHash::hash): Use a union when punning between a float / double
+ and an unsigned (bucket of bits). With strict aliasing enabled, unions
+ are the only safe way to do this kind of type punning.
+
+ * wtf/HashTable.h: When rehashing, ASSERT that the item we just added to
+ the table is indeed in the table. In the buggy case described above, this
+ ASSERT fires.
+
+2008-07-24 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Bug 20142: REGRESSION(r35245): /=/ weirdness
+ <https://bugs.webkit.org/show_bug.cgi?id=20142>
+
+ When adding all the meta data needed for exception error messages
+ I accidentally clobbered the handling of regex beginning with /=.
+
+ * kjs/grammar.y:
+
+2008-07-23 Alp Toker <alp@nuanti.com>
+
+ Build fix after r35293: Add API/ to the include path.
+
+ * GNUmakefile.am:
+
+2008-07-23 Adam Roben <aroben@apple.com>
+
+ Windows build fixes
+
+ Build fix after r35293:
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Add API/
+ to the include path.
+
+ Build fix after r35305:
+
+ * VM/Machine.cpp:
+ * VM/Machine.h:
+ * VM/Opcode.cpp:
+ * VM/Opcode.h:
+ Completely compile out all sampler-related code when
+ SAMPLING_TOOL_ENABLED is 0. The sampler code can't be compiled 1) on
+ non-AllInOne configurations due to circular header dependencies, and
+ 2) on platforms that don't have a usleep() function, such as Windows.
+
+2008-07-23 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff Garen and Sam Weinig.
+
+ Improve switch performance.
+
+ Improve switch performance by converting to a hashmap based jump
+ table to avoid the sequence of dispatches that would otherwise be
+ needed. This results in a 9-19x performance win for string switches
+ based on ad hoc testing, and a 6x improvement for integer switch
+ statements. SunSpider reports a 1.2% progression.
+
+ * VM/CodeBlock.cpp:
+ (KJS::CodeBlock::dump):
+ (KJS::SimpleJumpTable::offsetForValue):
+ * VM/CodeBlock.h:
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::beginSwitch):
+ (KJS::prepareJumpTableForImmediateSwitch):
+ (KJS::prepareJumpTableForCharacterSwitch):
+ (KJS::prepareJumpTableForStringSwitch):
+ (KJS::CodeGenerator::endSwitch):
+ * VM/CodeGenerator.h:
+ * VM/Machine.cpp:
+ (KJS::offsetForStringSwitch):
+ (KJS::Machine::privateExecute):
+ * VM/Opcode.cpp:
+ (KJS::):
+ * VM/Opcode.h:
+ * kjs/JSImmediate.h:
+ * kjs/nodes.cpp:
+ (KJS::):
+ (KJS::processClauseList):
+ (KJS::CaseBlockNode::tryOptimisedSwitch):
+ (KJS::CaseBlockNode::emitCodeForBlock):
+ * kjs/nodes.h:
+ (KJS::SwitchInfo::):
+
+2008-07-23 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Sampling tool to analyze cost of instruction execution and identify hot regions of JS code.
+ Enable Switches by setting SAMPLING_TOOL_ENABLED in Opcode.h.
+
+ * JavaScriptCore.exp: Export symbols for Shell.cpp.
+ * VM/Machine.cpp: Added sampling hooks.
+ * VM/Machine.h: Machine contains a pointer to a sampler, when sampling.
+ * VM/Opcode.cpp: Tool implementation.
+ * VM/Opcode.h: Tool declaration.
+ * kjs/Shell.cpp: Initialize the sampler, if enabled.
+ * kjs/nodes.cpp: Added sampling hooks.
+
+2008-07-23 Gabor Loki <loki@inf.u-szeged.hu>
+
+ Bug 20097: [Qt] 20% Sunspider slow-down
+
+ <https://bugs.webkit.org/show_bug.cgi?id=20097>
+
+ Reviewed by Simon Hausmann.
+
+ * kjs/jsc.pro: Added missing NDEBUG define for release builds.
+
+2008-07-23 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Geoff Garen.
+
+ JSClassRef is created context-free, but gets infatuated with the first context it sees.
+
+ The implicit API contract is that JSClassRef can be used with any context on any thread.
+ This no longer worked, because UStrings in the class were turned into per-context
+ identifiers, and the cached JSObject prototype was tied to JSGlobalData, too.
+
+ * API/JSClassRef.h: Made a separate struct for context-dependent parts of OpaqueJSClass.
+ * API/JSClassRef.cpp:
+ (OpaqueJSClass::OpaqueJSClass): Updated for renames and changed member variable order.
+ (OpaqueJSClass::~OpaqueJSClass): Assert that string members are not identifiers.
+ (clearReferenceToPrototype): Update for the new reference location.
+ (OpaqueJSClassContextData::OpaqueJSClassContextData): Make a deep copy of all strings.
+ (OpaqueJSClass::contextData): Added a function that finds the per-context part of
+ OpaqueJSClass in JSGlobalData, or creates it if not found.
+ (OpaqueJSClass::className): Always make a deep copy. Callers of this function do not have
+ a way to access JSGlobalData, so a per-context copy could not be made.
+ (OpaqueJSClass::staticValues): Updated for new data location.
+ (OpaqueJSClass::staticFunctions): Ditto.
+ (OpaqueJSClass::prototype): Changed to take an internal type for consistency.
+
+ * kjs/JSGlobalData.cpp:
+ (KJS::JSGlobalData::JSGlobalData):
+ (KJS::JSGlobalData::~JSGlobalData):
+ * kjs/JSGlobalData.h:
+ Keep a HashMap to access per-context JSClass data given a pointr to the shared part.
+
+ * API/JSCallbackObjectFunctions.h:
+ (KJS::::className):
+ (KJS::::getOwnPropertySlot):
+ (KJS::::put):
+ (KJS::::deleteProperty):
+ (KJS::::getPropertyNames):
+ (KJS::::staticValueGetter):
+ (KJS::::staticFunctionGetter):j
+ Use function accessors instead of accessing OpaqueJSClass members directly.
+
+ * API/JSContextRef.cpp: (JSGlobalContextCreate): Updated for the change in
+ OpaqueJSClass::prototype() argument type.
+
+ * API/JSObjectRef.cpp:
+ (JSObjectMake): Updated for the change in OpaqueJSClass::prototype() argument type.
+ (JSObjectMakeConstructor): Ditto.
+
+2008-07-23 Alexey Proskuryakov <ap@webkit.org>
+
+ Build fix.
+
+ * kjs/ArgList.h: (KJS::ArgList::operator new): removed an extraneous "ArgList::" inside the
+ class definition.
+
+2008-07-22 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt and Sam Weinig.
+
+ Next step toward putting doubles in registers: Prepare the Register class
+ and its clients for registers that don't contain JSValue*s.
+
+ This means a few things:
+
+ 1. Register::jsValue() clients, including ArgList clients, must now supply
+ an ExecState* when accessing an entry in an ArgList, in case the entry
+ will need to create a JSValue* on the fly.
+
+ 2. Register clients that definitely don't want to create a JSValue* on
+ the fly now use different APIs: getJSValue() for clients that know
+ the register contains a JSValue*, and v() for clients who just want a
+ void*.
+
+ 3. I had to change some headers around in order to resolve dependency
+ problems created by using a Register in the ArgList header.
+
+ SunSpider reports no change.
+
+2008-07-22 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Prevent integer overflow when reallocating storage vector for arrays.
+
+ Sunspider reports 1.005x as fast (no change expected).
+
+ * kjs/JSArray.cpp:
+
+2008-07-21 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ <rdar://problem/6091287> Revamp the handling of CFBundleShortVersionString to be fixed at the major component of the version number.
+
+ * Configurations/Version.xcconfig:
+ * Info.plist:
+
+2008-07-21 Adam Roben <aroben@apple.com>
+
+ Add Vector::find
+
+ This is a convenience wrapper around std::find.
+
+ Reviewed by Anders Carlsson.
+
+ * wtf/Vector.h:
+
+2008-07-19 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ Bug 20104: Exception in tables/mozilla_expected_failures/bugs/bug92868_1.html includes the equals operator in the quoted expression
+ <https://bugs.webkit.org/show_bug.cgi?id=20104>
+
+ To make this correct we make the dot and bracket assign nodes emit the information to indicate
+ the failure range is the dot/bracket accessor.
+
+ * kjs/grammar.y:
+
+2008-07-18 Steve Falkenburg <sfalken@apple.com>
+
+ Windows build fix.
+
+ * kjs/JSGlobalObjectFunctions.cpp:
+ (KJS::isStrWhiteSpace):
+
+2008-07-18 Steve Falkenburg <sfalken@apple.com>
+
+ Windows build fix.
+
+ * kjs/nodes.h:
+ (KJS::ThrowableExpressionData::ThrowableExpressionData):
+
+2008-07-18 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ Bug 18774: SQUIRRELFISH: print meaningful error messages <https://bugs.webkit.org/show_bug.cgi?id=18774>
+ <rdar://problem/5769353> SQUIRRELFISH: JavaScript error messages are missing informative text
+
+ Add support for decent error messages in JavaScript. This patch achieves this by providing
+ ensuring the common errors and exceptions have messages that provide the text of expression
+ that trigger the exception. In addition it attaches a number of properties to the exception
+ object detailing where in the source the expression came from.
+
+ * JavaScriptCore.exp:
+ * VM/CodeBlock.cpp:
+ (KJS::CodeBlock::lineNumberForVPC):
+ (KJS::CodeBlock::expressionRangeForVPC):
+ Function to recover the expression range for an instruction
+ that triggered an exception.
+ * VM/CodeBlock.h:
+ (KJS::ExpressionRangeInfo::):
+ (KJS::CodeBlock::CodeBlock):
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::emitCall):
+ (KJS::CodeGenerator::emitCallEval):
+ Emit call needed to be modified so to place the expression range info internally,
+ as the CodeGenerator emits the arguments nodes itself, rather than the various call
+ nodes.
+ * VM/CodeGenerator.h:
+ (KJS::CodeGenerator::emitExpressionInfo):
+ Record the expression range info.
+ * VM/ExceptionHelpers.cpp:
+ (KJS::createErrorMessage):
+ (KJS::createInvalidParamError):
+ (KJS::createUndefinedVariableError):
+ (KJS::createNotAConstructorError):
+ (KJS::createNotAFunctionError):
+ (KJS::createNotAnObjectErrorStub):
+ (KJS::createNotAnObjectError):
+ Rewrite all the code for the error messages so that they make use of the newly available
+ information.
+ * VM/ExceptionHelpers.h:
+ * VM/Machine.cpp:
+ (KJS::isNotObject): Now needs vPC and codeBlock
+ (KJS::Machine::throwException):
+ New logic to handle the NotAnObjectErrorStub and to handle the absurd "no default value" edge case
+ (KJS::Machine::privateExecute):
+ * VM/Machine.h:
+ * kjs/DebuggerCallFrame.cpp:
+ (KJS::DebuggerCallFrame::evaluate):
+ * kjs/Error.cpp:
+ (KJS::Error::create):
+ * kjs/Error.h:
+ * kjs/JSGlobalObjectFunctions.cpp:
+ * kjs/JSImmediate.cpp:
+ (KJS::JSImmediate::toObject):
+ (KJS::JSImmediate::prototype):
+ My changes to the JSNotAnObject constructor needed to be handled here.
+ * kjs/JSNotAnObject.h:
+ (KJS::JSNotAnObjectErrorStub::JSNotAnObjectErrorStub):
+ (KJS::JSNotAnObjectErrorStub::isNull):
+ (KJS::JSNotAnObjectErrorStub::isNotAnObjectErrorStub):
+ Added a JSNotAnObjectErrorStub class to ease the handling of toObject failure exceptions,
+ and potentially allow even more detailed error messages in future.
+ * kjs/JSObject.h:
+ * kjs/Parser.h:
+ (KJS::Parser::parse):
+ * kjs/SourceRange.h:
+ * kjs/grammar.y:
+ Large amounts of position propagation.
+ * kjs/lexer.cpp:
+ (KJS::Lexer::Lexer):
+ (KJS::Lexer::shift):
+ (KJS::Lexer::lex):
+ The lexer needed a few changes to be able to correctly track token character positions.
+ * kjs/lexer.h:
+ * kjs/nodes.cpp:
+ (KJS::ThrowableExpressionData::emitThrowError):
+ (KJS::StatementNode::StatementNode):
+ (KJS::ResolveNode::emitCode):
+ (KJS::BracketAccessorNode::emitCode):
+ (KJS::DotAccessorNode::emitCode):
+ (KJS::NewExprNode::emitCode):
+ (KJS::EvalFunctionCallNode::emitCode):
+ (KJS::FunctionCallValueNode::emitCode):
+ (KJS::FunctionCallResolveNode::emitCode):
+ (KJS::FunctionCallBracketNode::emitCode):
+ (KJS::FunctionCallDotNode::emitCode):
+ (KJS::PostfixResolveNode::emitCode):
+ (KJS::PostfixBracketNode::emitCode):
+ (KJS::PostfixDotNode::emitCode):
+ (KJS::DeleteResolveNode::emitCode):
+ (KJS::DeleteBracketNode::emitCode):
+ (KJS::DeleteDotNode::emitCode):
+ (KJS::PrefixResolveNode::emitCode):
+ (KJS::PrefixBracketNode::emitCode):
+ (KJS::PrefixDotNode::emitCode):
+ (KJS::ThrowableBinaryOpNode::emitCode):
+ (KJS::ReadModifyResolveNode::emitCode):
+ (KJS::AssignResolveNode::emitCode):
+ (KJS::AssignDotNode::emitCode):
+ (KJS::ReadModifyDotNode::emitCode):
+ (KJS::AssignBracketNode::emitCode):
+ (KJS::ReadModifyBracketNode::emitCode):
+ (KJS::ForInNode::ForInNode):
+ (KJS::ForInNode::emitCode):
+ (KJS::WithNode::emitCode):
+ (KJS::LabelNode::emitCode):
+ (KJS::ThrowNode::emitCode):
+ (KJS::ProgramNode::ProgramNode):
+ (KJS::ProgramNode::create):
+ (KJS::EvalNode::generateCode):
+ (KJS::FunctionBodyNode::create):
+ (KJS::FunctionBodyNode::generateCode):
+ (KJS::ProgramNode::generateCode):
+ All of these methods were handling the position information.
+ Constructors and create methods were modified to store the information.
+ All the emitCall implementations listed needed to be updated to actually
+ record the position information we have so carefully collected.
+ * kjs/nodes.h:
+ (KJS::ThrowableExpressionData::ThrowableExpressionData):
+ (KJS::ThrowableExpressionData::setExceptionSourceRange):
+ (KJS::ThrowableExpressionData::divot):
+ (KJS::ThrowableExpressionData::startOffset):
+ (KJS::ThrowableExpressionData::endOffset):
+ (KJS::ThrowableSubExpressionData::ThrowableSubExpressionData):
+ (KJS::ThrowableSubExpressionData::setSubexpressionInfo):
+ (KJS::ThrowablePrefixedSubExpressionData::ThrowablePrefixedSubExpressionData):
+ (KJS::ThrowablePrefixedSubExpressionData::setSubexpressionInfo):
+ ThrowableExpressionData is just a uniform mechanism for storing the position
+ information.
+ (KJS::ResolveNode::):
+ (KJS::PrePostResolveNode::):
+ (KJS::ThrowableBinaryOpNode::):
+ (KJS::WithNode::):
+
+2008-07-18 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ Three renames:
+
+ "CallTypeNative" => "CallTypeHost"
+ "code" => "byteCode"
+ "generatedCode" => "generatedByteCode"
+
+2008-07-18 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Optimized <= for immediate number cases.
+
+ SunSpider reports no overall change, but a 10% speedup on access-nsieve.
+
+2008-07-18 Mark Rowe <mrowe@apple.com>
+
+ Rubber-stamped by Sam Weinig.
+
+ Fix some casts added in a previous build fix to match the style used
+ throughout WebKit.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::initializeCallFrame):
+ * VM/Register.h:
+ (KJS::Register::Register):
+
+2008-07-18 Landry Breuil <landry@openbsd.org>
+
+ Bug 19975: [OpenBSD] Patches to enable build of WebKit
+
+ <https://bugs.webkit.org/show_bug.cgi?id=19975>
+
+ Reviewed by David Kilzer.
+
+ Support for OpenBSD, mostly threading and libm tweaks.
+
+ * kjs/collector.cpp: #include <pthread.h>
+ (KJS::currentThreadStackBase): use pthread_stackseg_np() to get stack base
+ * kjs/config.h: OpenBSD also provides <pthread_np.h>
+ * wtf/MathExtras.h: #include <sys/types.h> and <machine/ieee.h>
+ (isfinite), (signbit): as long as we don't have those functions provide fallback implementations
+ * wtf/Platform.h: Add support for PLATFORM(OPENBSD) and PLATFORM(SPARC64) macro
+
+2008-07-17 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Next step toward putting doubles in registers: Store constant pool
+ entries as registers, not JSValue*s.
+
+ SunSpider reports no change.
+
+2008-07-17 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by John Sullivan and Oliver Hunt.
+
+ A tiny bit of tidying in function call register allocation.
+
+ This patch saves one register when invoking a function expression and/or
+ a new expression that is stored in a temporary.
+
+ Since it's just one register, I can't make a testcase for it.
+
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::emitCall): No need to ref the function we're calling
+ or its base. We'd like the call frame to overlap with them, if possible.
+ op_call will read the function and its base before writing the call frame,
+ so this is safe.
+
+ * kjs/nodes.cpp:
+ (KJS::NewExprNode::emitCode): No need to ref the function we're new-ing,
+ for the same reasons stated above.
+
+ (KJS::FunctionCallValueNode::emitCode): ditto
+
+2008-07-17 Steve Falkenburg <sfalken@apple.com>
+
+ Build fix.
+
+ * kjs/InternalFunction.cpp:
+
+2008-07-17 Sam Weinig <sam@webkit.org>
+
+ Roll out r35199 as it is causing failures on the PPC build.
+
+2008-07-17 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by David Kilzer.
+
+ Fixed https://bugs.webkit.org/show_bug.cgi?id=20067
+ Support function.name (Firefox extension)
+
+ Pretty straight-forward.
+
+2008-07-17 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Fixed <rdar://problem/6081636> Functions calls use more temporary
+ registers than necessary
+
+ Holding a reference to the last statement result register caused each
+ successive statement to output its result to an even higher register.
+
+ Happily, statements don't actually need to return a result register
+ at all. I hope to make this clearer in a future cleanup patch,
+ but this change will fix the major bug for now.
+
+ * kjs/nodes.cpp:
+ (KJS::statementListEmitCode):
+
+2008-07-17 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Merge pre&post dot nodes to simplify the parse tree.
+ Sunspider results show 0.6% progression (no performance change expected).
+
+ * kjs/grammar.y:
+ * kjs/nodes.cpp:
+ * kjs/nodes.h:
+ * kjs/nodes2string.cpp:
+
+2008-07-17 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ Merge pre&post resolve nodes to simplify the parse tree.
+ Sunspider results show no performance change.
+
+ * kjs/grammar.y:
+ * kjs/nodes.cpp:
+ * kjs/nodes.h:
+ * kjs/nodes2string.cpp:
+
+2008-07-17 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ Merge logical nodes to simplify the parse tree.
+ Sunspider results show 0.6% progression (no performance change expected).
+
+ * kjs/grammar.y:
+ * kjs/nodes.cpp:
+ * kjs/nodes.h:
+ * kjs/nodes2string.cpp:
+
+2008-07-17 Ariya Hidayat <ariya.hidayat@trolltech.com>
+
+ Reviewed by Simon.
+
+ Fix MinGW build (broken in r35198) and simplify getLocalTime().
+
+ * kjs/DateMath.cpp:
+ (KJS::getLocalTime):
+
+2008-07-17 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Merge pre&post bracket nodes to simplify the parse tree.
+ Sunspider results show no performance change.
+
+ * kjs/grammar.y:
+ * kjs/nodes.cpp:
+ * kjs/nodes.h:
+ * kjs/nodes2string.cpp:
+
+2008-07-17 Ariya Hidayat <ariya.hidayat@trolltech.com>
+
+ Reviewed by Simon.
+
+ Fix the 32-bit gcc builds, conversion from "long int" to Register is
+ ambiguous. Explicitly choose the intptr_t constructor.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::initializeCallFrame):
+ * VM/Register.h:
+ (KJS::Register::Register):
+
+2008-07-16 Mark Rowe <mrowe@apple.com>
+
+ Rubber-stamped by Geoff Garen.
+
+ Fix JavaScript in 64-bit by using a pointer-sized integer
+ type in the Register union. Also includes a rename of
+ the intType constant to IntType.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::initializeCallFrame):
+ * VM/Register.h:
+ (KJS::Register::):
+ (KJS::Register::Register):
+
+2008-07-17 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ First step toward putting doubles in registers: Turned Register into a
+ proper abstraction layer. It is no longer possible to cast a Register
+ to a JSValue*, or a Register& to a JSValue*&, or to access the union
+ inside a Register directly.
+
+ SunSpider reports no change.
+
+ In support of this change, I had to make the following mechanical changes
+ in a lot of places:
+
+ 1. Clients now use explicit accessors to read data out of Registers, and
+ implicit copy constructors to write data into registers.
+
+ So, assignment that used to look like
+
+ x.u.jsValue = y;
+
+ now looks like
+
+ x = y;
+
+ And access that used to look like
+
+ x = y.u.jsValue;
+
+ now looks like
+
+ x = y.jsValue();
+
+ 2. I made generic flow control specific in opcodes that made their flow
+ control generic by treating a Register& as a JSValue*&. This had the
+ added benefit of removing some exception checking branches from immediate
+ number code.
+
+ 3. I beefed up PropertySlot to support storing a Register* in a property
+ slot. For now, only JSVariableObject's symbolTableGet and symbolTablePut
+ use this functionality, but I expect more clients to use it in the future.
+
+ 4. I changed ArgList to be a buffer of Registers, not JSValue*'s, and I
+ changed ArgList iterator clients to iterate Registers, not JSValue*'s.
+
+2008-07-16 Ada Chan <adachan@apple.com>
+
+ Fixed build.
+
+ * kjs/JSGlobalObject.cpp:
+
+2008-07-16 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Sam and Geoff.
+
+ <rdar://problem/5958840> Navigating to another page while profiler is
+ attached results in slow JavaScript for all time.
+
+ - The UNLIKELY keeps this from being a sunspider performance regression.
+
+ * kjs/JSGlobalObject.cpp:
+ (KJS::JSGlobalObject::~JSGlobalObject): Stop the profiler associated
+ with this exec state.
+
+2008-07-16 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Steve Falkenburg.
+
+ Replace adopting UString constructor in favor of explicit
+ static adopt method.
+
+ * API/JSStringRefCF.cpp:
+ (JSStringCreateWithCFString):
+ * kjs/StringConstructor.cpp:
+ (KJS::stringFromCharCode):
+ * kjs/StringPrototype.cpp:
+ (KJS::stringProtoFuncToLowerCase):
+ (KJS::stringProtoFuncToUpperCase):
+ (KJS::stringProtoFuncToLocaleLowerCase):
+ (KJS::stringProtoFuncToLocaleUpperCase):
+ * kjs/ustring.cpp:
+ (KJS::UString::adopt):
+ * kjs/ustring.h:
+ (KJS::UString::UString):
+ (KJS::UString::~UString):
+
+2008-07-16 Ariya Hidayat <ariya.hidayat@trolltech.com>
+
+ Reviewed by Simon.
+
+ http://trolltech.com/developer/task-tracker/index_html?method=entry&id=216179
+ Fix potential crash (on Qt for Windows port) when performing JavaScript date
+ conversion.
+
+ * kjs/DateMath.cpp:
+ (KJS::getLocalTime): For the Qt port, prefer to use Windows code, i.e.
+ localtime_s() instead of localtime() since the latter might crash (on Windows)
+ given a non-sensible, e.g. NaN, argument.
+
+2008-07-16 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Anders and Geoff.
+
+ https://bugs.webkit.org/show_bug.cgi?id=20023
+ Failed assertion in PropertyNameArray.cpp
+
+ This is already tested by testapi.
+
+ * API/JSObjectRef.cpp: (JSPropertyNameAccumulatorAddName): Add the string to identifier
+ table to appease PropertyNameArray.
+
+2008-07-16 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Geoff.
+
+ Dereference identifiers when deleting a hash table (fixes leaks with private JSGlobalData
+ objects).
+
+ * kjs/JSGlobalData.cpp: (KJS::JSGlobalData::~JSGlobalData):
+ * kjs/lookup.cpp: (KJS::HashTable::deleteTable):
+ * kjs/lookup.h:
+ * kjs/lexer.cpp: (KJS::Lexer::~Lexer)
+ HashTable cannot have a destructor, because check-for-global-initializers complains about
+ having a global constructor then.
+
+2008-07-16 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Geoff.
+
+ Check pthread_key_create return value.
+
+ This check was helpful when debugging a crash in run-webkit-tests --threaded that happened
+ because JSGlobalData objects were not deleted, and we were running out of pthread keys soon.
+ It also looks useful for production builds.
+
+ * wtf/ThreadSpecific.h: (WTF::::ThreadSpecific):
+
+2008-07-15 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Geoff.
+
+ Rename pageGroupIdentifier to profileGroup to keep mention of a
+ pageGroup out of JavaScriptCore.
+
+ * kjs/JSGlobalObject.cpp:
+ (KJS::JSGlobalObject::init):
+ * kjs/JSGlobalObject.h:
+ (KJS::JSGlobalObject::setProfileGroup):
+ (KJS::JSGlobalObject::profileGroup):
+ * profiler/ProfileGenerator.cpp:
+ (KJS::ProfileGenerator::create):
+ (KJS::ProfileGenerator::ProfileGenerator):
+ * profiler/ProfileGenerator.h:
+ (KJS::ProfileGenerator::profileGroup):
+ * profiler/Profiler.cpp:
+ (KJS::Profiler::startProfiling):
+ (KJS::dispatchFunctionToProfiles):
+ (KJS::Profiler::willExecute):
+ (KJS::Profiler::didExecute):
+
+2008-07-14 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Fix https://bugs.webkit.org/show_bug.cgi?id=20037
+ Bug 20037: GCC 4.2 build broken due to strict aliasing violation.
+
+ * kjs/ustring.cpp:
+ (KJS::UString::Rep::computeHash): Add a version of computeHash that takes a char* and explicit length.
+ * kjs/ustring.h:
+ * profiler/CallIdentifier.h:
+ (WTF::): Use new version of computeHash that takes a char* and explicit length to avoid unsafe aliasing.
+
+2008-07-14 David Hyatt <hyatt@apple.com>
+
+ Fix a crashing bug in ListHashSet's -- operator. Make sure that end() can be -- by special-casing the null
+ position.
+
+ Reviewed by Maciej
+
+ * wtf/ListHashSet.h:
+ (WTF::ListHashSetConstIterator::operator--):
+
+2008-07-14 David Hyatt <hyatt@apple.com>
+
+ Buidl fix. Make sure the second insertBefore method returns a value.
+
+ * wtf/ListHashSet.h:
+ (WTF::::insertBefore):
+
+2008-07-14 Adam Roben <aroben@apple.com>
+
+ Windows build fix
+
+ * JavaScriptCore.vcproj/jsc/jsc.vcproj: Added include/pthreads to the
+ include path.
+
+2008-07-14 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Kevin McCullough.
+
+ Make JSGlobalData refcounted in preparation to adding a way to create contexts that share
+ global data.
+
+ * JavaScriptCore.exp:
+ * kjs/JSGlobalData.cpp:
+ (KJS::JSGlobalData::create):
+ * kjs/JSGlobalData.h:
+ Made contructor private, and added a static create() method. Made the class inherit from
+ RefCounted.
+
+ * kjs/JSGlobalObject.h:
+ (KJS::JSGlobalObject::globalData):
+ JSGlobalData is now owned by JSGlobalObject (except for the shared one, and the common
+ WebCore one, which are never deleted).
+
+ * kjs/Shell.cpp: (main): Create JSGlobalData with create() method.
+
+2008-07-14 Simon Hausmann <hausmann@webkit.org>
+
+ Fix the single-threaded build.
+
+ * kjs/JSLock.cpp: Removed undeclared registerThread() function.
+ * kjs/collector.cpp:
+ (KJS::Heap::registerThread): Added dummy implementation.
+
+2008-07-14 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Geoff Garen.
+
+ Eliminate per-thread JavaScript global data instance support and make arbitrary
+ global data/global object combinations possible.
+
+ * kjs/collector.cpp:
+ (KJS::Heap::Heap): Store a JSGlobalData pointer instead of multiple pointers to its members.
+ This allows for going from any JS object to its associated global data, currently used in
+ JSGlobalObject constructor to initialize its JSGlobalData pointer.
+ (KJS::Heap::registerThread): Changed thread registration data to be per-heap. Previously,
+ only the shared heap could be used from multiple threads, so it was the only one that needed
+ thread registration, but now this can happen to any heap.
+ (KJS::Heap::unregisterThread): Ditto.
+ (KJS::Heap::markStackObjectsConservatively): Adapt for the above changes.
+ (KJS::Heap::setGCProtectNeedsLocking): Ditto.
+ (KJS::Heap::protect): Ditto.
+ (KJS::Heap::unprotect): Ditto.
+ (KJS::Heap::collect): Ditto.
+ (KJS::Heap::globalObjectCount): Use global object list associated with the current heap,
+ not the late per-thread one.
+ (KJS::Heap::protectedGlobalObjectCount): Ditto.
+
+ * kjs/collector.h:
+ (KJS::Heap::ThreadRegistrar): Added a helper object that unregisters a thread when it is
+ destroyed.
+
+ * kjs/JSLock.cpp:
+ (KJS::JSLock::JSLock):
+ * kjs/JSLock.h:
+ (KJS::JSLock::JSLock):
+ Don't use JSLock to implicitly register threads. I've added registerThread() calls to most
+ places that use JSLock - we cannot guarantee absolute safety unless we always mark all
+ threads in the process, but these implicit registration calls should cover reasonable usage
+ scenarios, I hope.
+
+ * API/JSBase.cpp:
+ (JSEvaluateScript): Explicitly register the current thread.
+ (JSCheckScriptSyntax): Explicitly register the current thread.
+ (JSGarbageCollect): Changed to use the passed in context. Unfortunately, this creates a race
+ condition for clients that pass an already released context to JSGarbageCollect - but it is
+ unlikely to create real life problems.
+ To maintain compatibility, the shared heap is collected if NULL is passed.
+
+ * API/JSContextRef.cpp:
+ (JSGlobalContextCreate): Use a new syntax for JSGlobalObject allocation.
+ (JSGlobalContextRetain): Register the thread.
+ (JSContextGetGlobalObject): Register the thread.
+
+ * API/JSObjectRef.cpp:
+ (JSObjectMake):
+ (JSObjectMakeFunctionWithCallback):
+ (JSObjectMakeConstructor):
+ (JSObjectMakeFunction):
+ (JSObjectHasProperty):
+ (JSObjectGetProperty):
+ (JSObjectSetProperty):
+ (JSObjectGetPropertyAtIndex):
+ (JSObjectSetPropertyAtIndex):
+ (JSObjectDeleteProperty):
+ (JSObjectCallAsFunction):
+ (JSObjectCallAsConstructor):
+ (JSObjectCopyPropertyNames):
+ (JSPropertyNameAccumulatorAddName):
+ * API/JSValueRef.cpp:
+ (JSValueIsEqual):
+ (JSValueIsInstanceOfConstructor):
+ (JSValueMakeNumber):
+ (JSValueMakeString):
+ (JSValueToNumber):
+ (JSValueToStringCopy):
+ (JSValueToObject):
+ (JSValueProtect):
+ (JSValueUnprotect):
+ Register the thread.
+
+ * API/JSStringRef.cpp: (JSStringRelease): Changed a comment to not mention per-thread contexts.
+
+ * API/JSStringRefCF.cpp: Removed an unnecessary include of JSLock.h.
+
+ * JavaScriptCore.exp: Export JSGlobalData constructor/destructor, now that anyone can have
+ their own instances. Adapt to other changes, too.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj: Made ThreadSpecific.h private, as it is now
+ included by collector.h and is thus needed in other projects.
+
+ * kjs/InitializeThreading.cpp: (KJS::initializeThreadingOnce): Don't initialize per-thread
+ global data, as it no longer exists.
+
+ * kjs/JSGlobalData.cpp:
+ (KJS::JSGlobalData::JSGlobalData):
+ (KJS::JSGlobalData::~JSGlobalData):
+ * kjs/JSGlobalData.h:
+ Removed support for per-thread instance. Made constructor and destructor public.
+
+ * kjs/JSGlobalObject.cpp: (KJS::JSGlobalObject::init): Get to now arbitrary JSGlobalData
+ via the heap.
+ (KJS::JSGlobalObject::operator new): Changed ot take JSGlobalDatra pointer.
+ * kjs/JSGlobalObject.h:
+
+ * kjs/Shell.cpp:
+ (main):
+ (jscmain):
+ Changed to maintain a custom JSGlobalData pointer instead of a per-thread one.
+
+2008-07-13 Ada Chan <adachan@apple.com>
+
+ Windows build fix: Add wtf/RefCountedLeakCounter to the project.
+
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+
+2008-07-12 Jan Michael Alonzo <jmalonzo@webkit.org>
+
+ Gtk, Qt and Wx build fix: Add wtf/RefCountedLeakCounter in the
+ build scripts
+
+ * GNUmakefile.am:
+ * JavaScriptCore.pri:
+ * JavaScriptCoreSources.bkl:
+
+2008-07-11 Stephanie Lewis <slewis@apple.com>
+
+ Reviewed by Darin Adler and Oliver Hunt.
+
+ Refactor RefCounting Leak counting code into a common class.
+
+ In order to export the symbols I needed to put the debug defines inside the function names
+
+ Before we had a separate channel for each Logging each Leak type. Since the leak channels were only used in one location, and only at quit for simplicity I combined them all into one leak channel.
+
+ * JavaScriptCore.exp:
+ * JavaScriptCore.xcodeproj/project.pbxproj: add new class
+ * kjs/nodes.cpp: remove old leak counting code
+ * wtf/RefCountedLeakCounter.cpp: Added. create a common leak counting class
+ * wtf/RefCountedLeakCounter.h: Added.
+
+2008-07-11 David Hyatt <hyatt@apple.com>
+
+ Add an insertBefore method to ListHashSet to allow for insertions in the middle of the list (rather than just
+ at the end).
+
+ Reviewed by Anders
+
+ * wtf/ListHashSet.h:
+ (WTF::::insertBefore):
+ (WTF::::insertNodeBefore):
+
+2008-07-11 Sam Weinig <sam@webkit.org>
+
+ Rubber-stamped by Darin Adler.
+
+ Move call function to CallData.cpp and construct to ConstructData.cpp.
+
+ * GNUmakefile.am:
+ * JavaScriptCore.pri:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * JavaScriptCoreSources.bkl:
+ * kjs/AllInOneFile.cpp:
+ * kjs/CallData.cpp: Copied from kjs/JSValue.cpp.
+ * kjs/ConstructData.cpp: Copied from kjs/JSValue.cpp.
+ * kjs/JSValue.cpp:
+
+2008-07-10 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Define WEBKIT_VERSION_MIN_REQUIRED=WEBKIT_VERSION_LATEST when building WebKit to ensure that no symbols end up with the weak_import attribute.
+
+ * Configurations/Base.xcconfig:
+
+2008-07-10 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Fix the Tiger build by omitting annotations from methods declared in categories when using old versions of GCC.
+
+ * API/WebKitAvailability.h:
+
+2008-07-10 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Darin.
+
+ -Minor cleanup. Renamed callTree() to head() and no longer use m_head
+ directly but instead keep it private and access via a method().
+
+ * profiler/HeavyProfile.cpp:
+ (KJS::HeavyProfile::HeavyProfile):
+ (KJS::HeavyProfile::generateHeavyStructure):
+ (KJS::HeavyProfile::addNode):
+ * profiler/Profile.h:
+ (KJS::Profile::head):
+ * profiler/ProfileGenerator.cpp:
+ (KJS::ProfileGenerator::ProfileGenerator):
+
+2008-07-10 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Mark Rowe.
+
+ Eliminate CollectorHeapIntrospector.
+
+ CollectorHeapIntrospector was added primarily in the hopes to improve leaks tool output,
+ a result that it didn't deliver. Also, it helped by labeling JSC heap regions as reported by
+ vmmap tool, but at the same time, it made them mislabeled as malloc'd ones - the correct
+ way to label mapped regions is to use a VM tag.
+
+ So, it makes more sense to remove it completely than to make it work with multiple heaps.
+
+ * JavaScriptCore.exp:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * kjs/AllInOneFile.cpp:
+ * kjs/InitializeThreading.cpp:
+ (KJS::initializeThreading):
+ * kjs/collector.cpp:
+ * kjs/collector.h:
+ * kjs/CollectorHeapIntrospector.cpp: Removed.
+ * kjs/CollectorHeapIntrospector.h: Removed.
+
+2008-07-09 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Darin.
+
+ <rdar://problem/5951532> JSProfiler: Implement heavy (or bottom-up)
+ view (19228)
+ - Implemented the time and call count portionof heavy. Now all that we
+ need is some UI.
+
+ * profiler/CallIdentifier.h: Removed an unused constructor.
+ * profiler/HeavyProfile.cpp:
+ (KJS::HeavyProfile::HeavyProfile): Set the initial time of the head
+ node so that percentages work correctly.
+ (KJS::HeavyProfile::mergeProfiles): Sum the times and call count of
+ nodes being merged.
+ * profiler/ProfileNode.cpp: Set the intital values of time and call
+ count when copying ProfileNodes.
+ (KJS::ProfileNode::ProfileNode):
+
+2008-07-10 Jan Michael Alonzo <jmalonzo@webkit.org>
+
+ Gtk build fix.
+
+ * GNUmakefile.am: Add HeavyProfile.cpp
+
+2008-07-09 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Don't warn about deprecated functions in production builds.
+
+ * Configurations/Base.xcconfig:
+ * Configurations/DebugRelease.xcconfig:
+
+2008-07-09 Darin Adler <darin@apple.com>
+
+ * JavaScriptCore.pri: Fix Qt build by adding HeavyProfile.cpp.
+
+2008-07-09 Kevin Ollivier <kevino@theolliviers.com>
+
+ wx biuld fix. Add HeavyProfile.cpp to build files.
+
+ * JavaScriptCoreSources.bkl:
+
+2008-07-09 Kevin McCullough <kmccullough@apple.com>
+
+ - Windows build fix.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+
+2008-07-09 Kevin McCullough <kmccullough@apple.com>
+
+ - Build fix.
+
+ * profiler/HeavyProfile.cpp:
+ (KJS::HeavyProfile::mergeProfiles):
+
+2008-07-09 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Geoff and Adam.
+
+ <rdar://problem/5951532> JSProfiler: Implement Bottom-Up view (19228)
+ - This is the plumbing for bottom-up, but does not include calculating
+ time, mostly because I'm still undclear about what the end result should
+ look like.
+ - This, obviously, does not include the UI to expose this in the
+ inspector yet.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * profiler/CallIdentifier.h:
+ (KJS::CallIdentifier::CallIdentifier):
+ (WTF::): Added HashTraits for CallIdentifiers to be used by a HashMap.
+ * profiler/HeavyProfile.cpp: Added.
+ (KJS::HeavyProfile::HeavyProfile):
+ (KJS::HeavyProfile::generateHeavyStructure):
+ (KJS::HeavyProfile::addNode):
+ (KJS::HeavyProfile::mergeProfiles):
+ (KJS::HeavyProfile::addAncestorsAsChildren):
+ * profiler/HeavyProfile.h: Added.
+ (KJS::HeavyProfile::create):
+ (KJS::HeavyProfile::heavyProfile):
+ (KJS::HeavyProfile::treeProfile):
+ * profiler/Profile.cpp: Removed old commented out includes.
+ * profiler/Profile.h: The m_head is needed by the HeavyProfile so it
+ is now protected as opposed to private.
+ * profiler/ProfileNode.cpp:
+ (KJS::ProfileNode::ProfileNode): Created a constructor to copy
+ ProfileNodes.
+ (KJS::ProfileNode::findChild): Added a null check to make HeavyProfile
+ children finding easier and avoid a potential crasher.
+ * profiler/ProfileNode.h: Mostly moved things around but also added some
+ functionality needed by HeavyProfile.
+ (KJS::ProfileNode::create):
+ (KJS::ProfileNode::functionName):
+ (KJS::ProfileNode::url):
+ (KJS::ProfileNode::lineNumber):
+ (KJS::ProfileNode::head):
+ (KJS::ProfileNode::setHead):
+ (KJS::ProfileNode::setNextSibling):
+ (KJS::ProfileNode::actualTotalTime):
+ (KJS::ProfileNode::actualSelfTime):
+ * profiler/TreeProfile.cpp: Implemented the ability to get a
+ HeavyProfile.
+ (KJS::TreeProfile::heavyProfile):
+ * profiler/TreeProfile.h:
+
+2008-07-08 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Added support for checking if an object has custom properties in its
+ property map. WebCore uses this to optimize marking DOM wrappers.
+
+2008-07-08 Simon Hausmann <hausmann@webkit.org>
+
+ Prospective Gtk/Wx build fixes, add ProfileGenerator.cpp to the build.
+
+ * GNUmakefile.am:
+ * JavaScriptCoreSources.bkl:
+
+2008-07-08 Simon Hausmann <hausmann@webkit.org>
+
+ Fix the Qt build, add ProfileGenerator.cpp to the build.
+
+ * JavaScriptCore.pri:
+
+2008-07-07 David Kilzer <ddkilzer@apple.com>
+
+ releaseFastMallocFreeMemory() should always be defined
+
+ Reviewed by Darin.
+
+ * JavaScriptCore.exp: Changed to export C++ binding for
+ WTF::releaseFastMallocFreeMemory() instead of C binding for
+ releaseFastMallocFreeMemory().
+ * wtf/FastMalloc.cpp: Moved definitions of
+ releaseFastMallocFreeMemory() to be in the WTF namespace
+ regardless whether FORCE_SYSTEM_MALLOC is defined.
+ * wtf/FastMalloc.h: Moved releaseFastMallocFreeMemory() from
+ extern "C" binding to WTF::releaseFastMallocFreeMemory().
+
+2008-07-07 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Geoff.
+
+ Bug 19926: URL causes crash within a minute
+ <https://bugs.webkit.org/show_bug.cgi?id=19926>
+
+ Add a check that lastGlobalObject is non-null in Machine::execute()
+ before copying its globals to the current register file.
+
+ In theory, it is possible to make a test case for this, but it will
+ take a while to get it right.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::execute):
+
+2008-07-07 Darin Adler <darin@apple.com>
+
+ Rubber stamped by Adele.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute): Fix a typo in a comment.
+
+2008-07-07 Steve Falkenburg <sfalken@apple.com>
+
+ Build fixes.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.vcproj/testapi/testapi.vcproj:
+
+2008-07-07 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Darin.
+
+ When the profiler is running it gathers information and creates a
+ Profile. After it finishes the Profile can be sorted and have other
+ data refinements run over it. Both of these were done in the same class
+ before. Now I split the gathering operations into a new class called
+ ProfileGenerator.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * profiler/Profile.cpp: Removed code related to the gather stage of a
+ Profile's creation.
+ (KJS::Profile::create):
+ (KJS::Profile::Profile):
+ * profiler/Profile.h: Ditto.
+ (KJS::Profile::title):
+ (KJS::Profile::callTree):
+ (KJS::Profile::setHead):
+ * profiler/ProfileGenerator.cpp: Added. This is the class that will
+ handle the stage of creating a Profile. Once the Profile is finished
+ being created, this class goes away.
+ (KJS::ProfileGenerator::create):
+ (KJS::ProfileGenerator::ProfileGenerator):
+ (KJS::ProfileGenerator::title):
+ (KJS::ProfileGenerator::willExecute):
+ (KJS::ProfileGenerator::didExecute):
+ (KJS::ProfileGenerator::stopProfiling):
+ (KJS::ProfileGenerator::didFinishAllExecution):
+ (KJS::ProfileGenerator::removeProfileStart):
+ (KJS::ProfileGenerator::removeProfileEnd):
+ * profiler/ProfileGenerator.h: Added.
+ (KJS::ProfileGenerator::profile):
+ (KJS::ProfileGenerator::originatingGlobalExec):
+ (KJS::ProfileGenerator::pageGroupIdentifier):
+ (KJS::ProfileGenerator::client):
+ (KJS::ProfileGenerator::stoppedProfiling):
+ * profiler/Profiler.cpp: Now operates with the ProfileGenerator instead
+ of the Profile.
+ (KJS::Profiler::startProfiling):
+ (KJS::Profiler::stopProfiling):
+ (KJS::Profiler::didFinishAllExecution): It is here that the Profile is
+ handed off to its client and the Profile Generator is no longer needed.
+ (KJS::dispatchFunctionToProfiles):
+ (KJS::Profiler::willExecute):
+ (KJS::Profiler::didExecute):
+ * profiler/Profiler.h: Cleaned up the includes and subsequently the
+ forward declarations. Also use the new ProfileGenerator.
+ (KJS::ProfilerClient::~ProfilerClient):
+ (KJS::Profiler::currentProfiles):
+ * profiler/TreeProfile.cpp: Use Profile's new interface.
+ (KJS::TreeProfile::create):
+ (KJS::TreeProfile::TreeProfile):
+ * profiler/TreeProfile.h:
+
+2008-07-07 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Cameron Zwarich.
+
+ Third step in broad cleanup effort.
+
+ [ File list elided ]
+
+2008-07-06 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Cameron Zwarich.
+
+ Second step in broad cleanup effort.
+
+ [ File list elided ]
+
+2008-07-05 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Cameron Zwarich.
+
+ First step in broad cleanup effort.
+
+ [ File list elided ]
+
+2008-07-05 Sam Weinig <sam@webkit.org>
+
+ Rubber-stamped by Cameron Zwarich.
+
+ Rename list.h/cpp to ArgList.h/cpp.
+
+ * GNUmakefile.am:
+ * JavaScriptCore.pri:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * JavaScriptCoreSources.bkl:
+ * VM/Machine.h:
+ * kjs/AllInOneFile.cpp:
+ * kjs/ArgList.cpp: Copied from JavaScriptCore/kjs/list.cpp.
+ * kjs/ArgList.h: Copied from JavaScriptCore/kjs/list.h.
+ * kjs/IndexToNameMap.cpp:
+ * kjs/JSGlobalData.cpp:
+ * kjs/JSGlobalData.h:
+ * kjs/JSObject.h:
+ * kjs/collector.cpp:
+ * kjs/list.cpp: Removed.
+ * kjs/list.h: Removed.
+
+2008-07-05 Sam Weinig <sam@webkit.org>
+
+ Fix non-AllInOne builds again.
+
+ * kjs/BooleanPrototype.cpp:
+ * kjs/ErrorPrototype.cpp:
+ * kjs/FunctionPrototype.cpp:
+ * kjs/NumberPrototype.cpp:
+ * kjs/ObjectPrototype.cpp:
+
+2008-07-05 Sam Weinig <sam@webkit.org>
+
+ Fix build on case-sensitive build systems.
+
+ * kjs/IndexToNameMap.cpp:
+
+2008-07-05 Sam Weinig <sam@webkit.org>
+
+ Fix build.
+
+ * kjs/Arguments.cpp:
+ * kjs/BooleanPrototype.cpp:
+ * kjs/DateConstructor.cpp:
+ * kjs/ErrorPrototype.cpp:
+ * kjs/FunctionPrototype.cpp:
+ * kjs/NumberPrototype.cpp:
+ * kjs/ObjectPrototype.cpp:
+ * kjs/RegExpPrototype.cpp:
+ * kjs/StringConstructor.cpp:
+ * kjs/lookup.cpp:
+
+2008-07-05 Sam Weinig <sam@webkit.org>
+
+ Fix non-AllInOne build.
+
+ * kjs/JSGlobalObject.cpp:
+
+2008-07-05 Sam Weinig <sam@webkit.org>
+
+ Rubber-stamped by Cameron Zwarich.
+
+ Split Arguments, IndexToNameMap, PrototypeFunction, GlobalEvalFunction and
+ the functions on the global object out of JSFunction.h/cpp.
+
+ * GNUmakefile.am:
+ * JavaScriptCore.pri:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * JavaScriptCoreSources.bkl:
+ * VM/Machine.cpp:
+ * kjs/AllInOneFile.cpp:
+ * kjs/Arguments.cpp: Copied from JavaScriptCore/kjs/JSFunction.cpp.
+ * kjs/Arguments.h: Copied from JavaScriptCore/kjs/JSFunction.h.
+ * kjs/GlobalEvalFunction.cpp: Copied from JavaScriptCore/kjs/JSFunction.cpp.
+ * kjs/GlobalEvalFunction.h: Copied from JavaScriptCore/kjs/JSFunction.h.
+ * kjs/IndexToNameMap.cpp: Copied from JavaScriptCore/kjs/JSFunction.cpp.
+ * kjs/IndexToNameMap.h: Copied from JavaScriptCore/kjs/JSFunction.h.
+ * kjs/JSActivation.cpp:
+ * kjs/JSFunction.cpp:
+ * kjs/JSFunction.h:
+ * kjs/JSGlobalObject.cpp:
+ * kjs/JSGlobalObjectFunctions.cpp: Copied from JavaScriptCore/kjs/JSFunction.cpp.
+ * kjs/JSGlobalObjectFunctions.h: Copied from JavaScriptCore/kjs/JSFunction.h.
+ The functions on the global object should be in JSGlobalObject.cpp, but putting them there
+ was a 0.5% regression.
+
+ * kjs/PrototypeFunction.cpp: Copied from JavaScriptCore/kjs/JSFunction.cpp.
+ * kjs/PrototypeFunction.h: Copied from JavaScriptCore/kjs/JSFunction.h.
+ * kjs/Shell.cpp:
+ * kjs/lexer.cpp:
+ * kjs/ustring.cpp:
+
+2008-07-04 Sam Weinig <sam@webkit.org>
+
+ Really fix the mac build.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2008-07-04 Sam Weinig <sam@webkit.org>
+
+ Fix mac build.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2008-07-04 Sam Weinig <sam@webkit.org>
+
+ Fix non-AllInOne builds.
+
+ * kjs/Error.cpp:
+ * kjs/GetterSetter.cpp:
+ * kjs/JSImmediate.cpp:
+ * kjs/operations.cpp:
+
+2008-07-04 Sam Weinig <sam@webkit.org>
+
+ Rubber-stamped by Dan Bernstein.
+
+ Split Error and GetterSetter out of JSObject.h.
+
+ * API/JSCallbackObjectFunctions.h:
+ * GNUmakefile.am:
+ * JavaScriptCore.pri:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * JavaScriptCoreSources.bkl:
+ * kjs/AllInOneFile.cpp:
+ * kjs/ClassInfo.h: Copied from JavaScriptCore/kjs/JSObject.h.
+ * kjs/Error.cpp: Copied from JavaScriptCore/kjs/JSObject.cpp.
+ * kjs/Error.h: Copied from JavaScriptCore/kjs/JSObject.h.
+ * kjs/GetterSetter.cpp:
+ * kjs/GetterSetter.h: Copied from JavaScriptCore/kjs/JSObject.h.
+ * kjs/JSObject.cpp:
+ * kjs/JSObject.h:
+ * kjs/nodes.h:
+
+2008-07-04 Simon Hausmann <hausmann@webkit.org>
+
+ Fix the Wx build, added TreeProfile.cpp to the build.
+
+ * JavaScriptCoreSources.bkl:
+
+2008-07-03 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Fix output path of recently-added script phase to reference the correct file.
+ This prevents Xcode from running the script phase unnecessarily, which caused
+ the generated header to be recreated and lead to AllInOneFile.cpp rebuilding.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2008-07-03 Mark Rowe <mrowe@apple.com>
+
+ Follow-up to the 64-bit build fix. Use intptr_t rather than ssize_t as
+ the latter is non-standard and does not exist on Windows.
+
+ * kjs/JSLock.cpp:
+ (KJS::JSLock::lockCount):
+ (KJS::JSLock::lock):
+ (KJS::JSLock::unlock):
+ (KJS::JSLock::DropAllLocks::DropAllLocks):
+ * kjs/JSLock.h:
+
+2008-07-02 Mark Rowe <mrowe@apple.com>
+
+ Fix the 64-bit build. pthread_getspecific works with pointer-sized values,
+ so use ssize_t rather than int to track the lock count to avoid warnings about
+ truncating the result of pthread_getspecific.
+
+ * kjs/JSLock.cpp:
+ (KJS::JSLock::lockCount):
+ (KJS::JSLock::lock):
+ (KJS::JSLock::unlock):
+ (KJS::JSLock::DropAllLocks::DropAllLocks):
+ * kjs/JSLock.h:
+
+2008-07-03 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Removed checking for the array get/put fast case from the array code.
+ Callers who want the fast case should call getIndex and/or setIndex
+ instead. (get_by_val and put_by_val already do this.)
+
+ SunSpider reports no change overall, but a 1.4% speedup on fannkuch and
+ a 3.6% speedup on nsieve.
+
+2008-07-03 Dan Bernstein <mitz@apple.com>
+
+ - Windows build fix
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Added TreeProfile.{h,cpp}.
+
+2008-07-03 Dan Bernstein <mitz@apple.com>
+
+ Reviewed by Anders Carlsson.
+
+ - Windows build fix
+
+ * VM/Machine.cpp:
+ (KJS::Machine::Machine):
+
+2008-07-03 Simon Hausmann <hausmann@webkit.org>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Fix the non-threaded build.
+
+ * kjs/JSGlobalData.cpp:
+ (KJS::JSGlobalData::threadInstanceInternal):
+
+2008-07-03 Simon Hausmann <hausmann@webkit.org>
+
+ Fix the Qt build, added TreeProfile to the build.
+
+ * JavaScriptCore.pri:
+
+2008-07-02 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Geoff.
+
+ Don't create unnecessary JSGlobalData instances.
+
+ * kjs/JSGlobalData.h:
+ * kjs/JSGlobalData.cpp:
+ (KJS::JSGlobalData::threadInstanceExists):
+ (KJS::JSGlobalData::sharedInstanceExists):
+ (KJS::JSGlobalData::threadInstance):
+ (KJS::JSGlobalData::sharedInstance):
+ (KJS::JSGlobalData::threadInstanceInternal):
+ (KJS::JSGlobalData::sharedInstanceInternal):
+ Added methods to query instance existence.
+
+ * kjs/InitializeThreading.cpp:
+ (KJS::initializeThreadingOnce):
+ Initialize thread instance static in a new way.
+
+ * API/JSBase.cpp:
+ (JSGarbageCollect):
+ * kjs/collector.cpp:
+ (KJS::Heap::collect):
+ Check for instance existence before accessing it.
+
+2008-07-02 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ Fixed https://bugs.webkit.org/show_bug.cgi?id=19862
+ REGRESSION (r34907): Gmail crashes in JavaScriptCore code while editing drafts
+
+ I was never able to reproduce this issue, but Cameron could, and he says
+ that this patch fixes it.
+
+ The crash seems tied to a timer or event handler callback. In such a case,
+ the sole reference to the global object may be in the current call frame,
+ so we can't depend on the global object to mark the call frame area in
+ the register file.
+
+ The new GC marking rule is: the global object is not responsible for
+ marking the whole register file -- it's just responsible for the globals
+ section it's tied to. The heap is responsible for marking the call frame area.
+
+2008-07-02 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Add the ability to trace JavaScriptCore garabge collections using dtrace.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj: Generate the dtrace probe header
+ file when building on a new enough version of Mac OS X.
+ * JavaScriptCorePrefix.h: Add our standard Mac OS X version detection macros.
+ * kjs/Tracing.d: Declare three dtrace probes.
+ * kjs/Tracing.h: Include the generated dtrace macros if dtrace is available,
+ otherwise provide versions that do nothing.
+ * kjs/collector.cpp:
+ (KJS::Heap::collect): Fire dtrace probes when starting a collection, after the
+ mark phase has completed, and when the collection is complete.
+ * wtf/Platform.h: Define HAVE_DTRACE when building on a new enough version of Mac OS X.
+
+2008-07-02 Geoffrey Garen <ggaren@apple.com>
+
+ Rubber stamped by Oliver Hunt.
+
+ Reduced the max register file size from 8MB to 2MB.
+
+ We still allow about 20,000 levels of recursion.
+
+2008-07-02 Alp Toker <alp@nuanti.com>
+
+ Build fix for r34960. Add TreeProfile.cpp to build.
+
+ * GNUmakefile.am:
+
+2008-07-02 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Optimized a[n] get for cases when a is an array or a string. When a is
+ an array, we optimize both get and put. When a is a string, we only
+ optimize get, since you can't put to a string.
+
+ SunSpider says 3.4% faster.
+
+2008-07-02 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Darin.
+
+ -Small cleanup in preparation for implementing Bottom-up.
+
+ * profiler/CallIdentifier.h: Rename debug function to make it clear of
+ its output and intention to be debug only.
+ (KJS::CallIdentifier::operator const char* ): Implement in terms of
+ c_str.
+ (KJS::CallIdentifier::c_str):
+ * profiler/ProfileNode.cpp: Impelment findChild() which will be needed
+ by the bottom-up implementation.
+ (KJS::ProfileNode::findChild):
+ * profiler/ProfileNode.h: Added comments to make the collections of
+ functions more clear.
+ (KJS::ProfileNode::operator==):
+ (KJS::ProfileNode::c_str):
+
+2008-07-02 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Darin.
+
+ Bug 19776: Number.toExponential() is incorrect for numbers between 0.1 and 1
+ <https://bugs.webkit.org/show_bug.cgi?id=19776>
+
+ Perform the sign check for the exponent on the actual exponent value,
+ which is 1 less than the value of decimalPoint, instead of on the value
+ of decimalPoint itself.
+
+ * kjs/NumberPrototype.cpp:
+ (KJS::exponentialPartToString):
+
+2008-07-02 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Darin.
+
+ <rdar://problem/5951532> JSProfiler: Implement Bottom-Up view (19228)
+ - Subclass TreeProfile as I prepare for a HeavyProfile to be comming
+ later.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * profiler/Profile.cpp: By default we create a TreeProfile.
+ (KJS::Profile::create):
+ * profiler/Profile.h: Changes to the Profile class to make it amenable
+ to be inherited from.
+ (KJS::Profile::~Profile):
+ * profiler/TreeProfile.cpp: Added.
+ (KJS::TreeProfile::create):
+ (KJS::TreeProfile::TreeProfile):
+ (KJS::TreeProfile::heavyProfile):
+ * profiler/TreeProfile.h: Added.
+ (KJS::TreeProfile::treeProfile):
+
+2008-07-02 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Dan.
+
+ Broke CallIdentifier out into its own file. I did this because it's
+ going to grow a lot soon and I wanted this to be a separate patch.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * profiler/CallIdentifier.h: Added.
+ (KJS::CallIdentifier::CallIdentifier):
+ (KJS::CallIdentifier::operator==):
+ (KJS::CallIdentifier::operator!=):
+ (KJS::CallIdentifier::operator const char* ):
+ (KJS::CallIdentifier::toString):
+ * profiler/ProfileNode.h:
+
+2008-07-02 Simon Hausmann <hausmann@webkit.org>
+
+ Build fix. Implemented missing functions for single-threaded build.
+
+ * kjs/JSLock.cpp:
+ (KJS::JSLock::JSLock):
+ (KJS::JSLock::lock):
+ (KJS::JSLock::unlock):
+ (KJS::JSLock::DropAllLocks::DropAllLocks):
+
+2008-07-02 Alexey Proskuryakov <ap@webkit.org>
+
+ Another non-AllInOne build fix.
+
+ * kjs/JSGlobalObject.cpp: Include JSLock.h here, too.
+
+2008-07-02 Alexey Proskuryakov <ap@webkit.org>
+
+ Non-AllInOne build fix.
+
+ * kjs/interpreter.cpp: Include JSLock.h.
+
+2008-06-30 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Darin.
+
+ Disable JSLock for per-thread contexts.
+
+ No change on SunSpider.
+
+ * kjs/JSGlobalData.h:
+ * kjs/JSGlobalData.cpp:
+ (KJS::JSGlobalData::JSGlobalData):
+ (KJS::JSGlobalData::sharedInstance):
+ Added isSharedInstance as a better way to tell whether the instance is shared (legacy).
+
+ * kjs/JSLock.cpp:
+ (KJS::createJSLockCount):
+ (KJS::JSLock::lockCount):
+ (KJS::setLockCount):
+ (KJS::JSLock::JSLock):
+ (KJS::JSLock::lock):
+ (KJS::JSLock::unlock):
+ (KJS::JSLock::currentThreadIsHoldingLock):
+ (KJS::JSLock::DropAllLocks::DropAllLocks):
+ (KJS::JSLock::DropAllLocks::~DropAllLocks):
+ * kjs/JSLock.h:
+ (KJS::JSLock::JSLock):
+ (KJS::JSLock::~JSLock):
+ Made JSLock and JSLock::DropAllLocks constructors take a parameter to decide whether to
+ actually lock a mutex, or only to increment recursion count. We cannot turn it into no-op
+ if we want to keep existing assertions working.
+ Made recursion count per-thread, now that locks may not lock.
+
+ * API/JSBase.cpp:
+ (JSEvaluateScript): Take JSLock after casting JSContextRef to ExecState* (which doesn't need
+ locking in any case), so that a decision whether to actually lock can be made.
+ (JSCheckScriptSyntax): Ditto.
+ (JSGarbageCollect): Only lock while collecting the shared heap, not the per-thread one.
+
+ * API/JSObjectRef.cpp:
+ (JSClassCreate): Don't lock, as there is no reason to.
+ (JSClassRetain): Ditto.
+ (JSClassRelease): Ditto.
+ (JSPropertyNameArrayRetain): Ditto.
+ (JSPropertyNameArrayRelease): Only lock while deleting the array, as that may touch
+ identifier table.
+ (JSPropertyNameAccumulatorAddName): Adding a string also involves an identifier table
+ lookup, and possibly modification.
+
+ * API/JSStringRef.cpp:
+ (JSStringCreateWithCharacters):
+ (JSStringCreateWithUTF8CString):
+ (JSStringRetain):
+ (JSStringRelease):
+ (JSStringGetUTF8CString):
+ (JSStringIsEqual):
+ * API/JSStringRefCF.cpp:
+ (JSStringCreateWithCFString):
+ JSStringRef operations other than releasing do not need locking.
+
+ * VM/Machine.cpp: Don't include unused JSLock.h.
+
+ * kjs/CollectorHeapIntrospector.cpp: (KJS::CollectorHeapIntrospector::statistics):
+ Don't take the lock for real, as heap introspection pauses the process anyway. It seems that
+ the existing code could cause deadlocks.
+
+ * kjs/Shell.cpp:
+ (functionGC):
+ (main):
+ (jscmain):
+ The test tool uses a per-thread context, so no real locking is required.
+
+ * kjs/collector.h:
+ (KJS::Heap::setGCProtectNeedsLocking): Optionally protect m_protectedValues access with a
+ per-heap mutex. This is only needed for WebCore Database code, which violates the "no data
+ migration between threads" by using ProtectedPtr on a background thread.
+ (KJS::Heap::isShared): Keep a shared flag here, as well.
+
+ * kjs/protect.h:
+ (KJS::::ProtectedPtr):
+ (KJS::::~ProtectedPtr):
+ (KJS::::operator):
+ (KJS::operator==):
+ (KJS::operator!=):
+ ProtectedPtr is ony used from WebCore, so it doesn't need to take JSLock. An assertion in
+ Heap::protect/unprotect guards agains possible future unlocked uses of ProtectedPtr in JSC.
+
+ * kjs/collector.cpp:
+ (KJS::Heap::Heap): Initialize m_isShared.
+ (KJS::Heap::~Heap): No need to lock for real during destruction, but must keep assertions
+ in sweep() working.
+ (KJS::destroyRegisteredThread): Registered thread list is only accessed for shared heap,
+ so locking is always needed here.
+ (KJS::Heap::registerThread): Ditto.
+ (KJS::Heap::markStackObjectsConservatively): Use m_isShared instead of comparing to a shared
+ instance for a small speedup.
+ (KJS::Heap::setGCProtectNeedsLocking): Create m_protectedValuesMutex. There is currently no
+ way to undo this - and ideally, Database code will be fixed to lo longer require this quirk.
+ (KJS::Heap::protect): Take m_protectedValuesMutex (if it exists) while accessing
+ m_protectedValues.
+ (KJS::Heap::unprotect): Ditto.
+ (KJS::Heap::markProtectedObjects): Ditto.
+ (KJS::Heap::protectedGlobalObjectCount): Ditto.
+ (KJS::Heap::protectedObjectCount): Ditto.
+ (KJS::Heap::protectedObjectTypeCounts): Ditto.
+
+ * kjs/ustring.cpp:
+ * kjs/ustring.h:
+ Don't include JSLock.h, which is no longer used here. As a result, an explicit include had
+ to be added to many files in JavaScriptGlue, WebCore and WebKit.
+
+ * kjs/JSGlobalObject.cpp:
+ (KJS::JSGlobalObject::init):
+ * API/JSCallbackConstructor.cpp:
+ (KJS::constructJSCallback):
+ * API/JSCallbackFunction.cpp:
+ (KJS::JSCallbackFunction::call):
+ * API/JSCallbackObjectFunctions.h:
+ (KJS::::init):
+ (KJS::::getOwnPropertySlot):
+ (KJS::::put):
+ (KJS::::deleteProperty):
+ (KJS::::construct):
+ (KJS::::hasInstance):
+ (KJS::::call):
+ (KJS::::getPropertyNames):
+ (KJS::::toNumber):
+ (KJS::::toString):
+ (KJS::::staticValueGetter):
+ (KJS::::callbackGetter):
+ * API/JSContextRef.cpp:
+ (JSGlobalContextCreate):
+ (JSGlobalContextRetain):
+ (JSGlobalContextRelease):
+ * API/JSValueRef.cpp:
+ (JSValueIsEqual):
+ (JSValueIsStrictEqual):
+ (JSValueIsInstanceOfConstructor):
+ (JSValueMakeNumber):
+ (JSValueMakeString):
+ (JSValueToNumber):
+ (JSValueToStringCopy):
+ (JSValueToObject):
+ (JSValueProtect):
+ (JSValueUnprotect):
+ * JavaScriptCore.exp:
+ * kjs/PropertyNameArray.h:
+ (KJS::PropertyNameArray::globalData):
+ * kjs/interpreter.cpp:
+ (KJS::Interpreter::checkSyntax):
+ (KJS::Interpreter::evaluate):
+ Pass a parameter to JSLock/JSLock::DropAllLocks to decide whether the lock needs to be taken.
+
+2008-07-01 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Darin.
+
+ https://bugs.webkit.org/show_bug.cgi?id=19834
+ Failed assertion in JavaScriptCore/VM/SegmentedVector.h:82
+
+ Creating a global object with a custom prototype resets it twice (wasteful!).
+ So, addStaticGlobals() was called twice, but JSGlobalObject::reset() didn't reset
+ the register array.
+
+ * kjs/JSGlobalObject.cpp: (KJS::JSGlobalObject::reset): Call setRegisterArray(0, 0).
+
+ * kjs/JSVariableObject.h: Changed registerArray to OwnArrayPtr. Also, added private copy
+ constructor and operator= to ensure that no one attempts to copy this object (for whatever
+ reason, I couldn't make Noncopyable work).
+
+ * kjs/JSGlobalObject.h: (KJS::JSGlobalObject::addStaticGlobals): Allocate registerArray
+ with new[].
+
+ * kjs/JSVariableObject.cpp:
+ (KJS::JSVariableObject::copyRegisterArray): Allocate registerArray with new[].
+ (KJS::JSVariableObject::setRegisterArray): Avoid hitting an assertion in OwnArrayPtr when
+ "changing" the value from 0 to 0.
+
+2008-07-01 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Removed and/or reordered exception checks in array-style a[n] access.
+
+ SunSpider says 1.4% faster.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute): No need to check for exceptions before
+ calling toString, toNumber and/or get. If the call ends up being observable
+ through toString, valueOf, or a getter, we short-circuit it there, instead.
+ In the op_del_by_val case, I removed the incorrect comment without actually
+ removing the code, since I didn't want to tempt the GCC fates!
+
+ * kjs/JSObject.cpp:
+ (KJS::callDefaultValueFunction): Added exception check to prevent
+ toString and valueOf functions from observing execution after an exception
+ has been thrown. This removes some of the burden of exception checking
+ from the machine.
+
+ (KJS::JSObject::defaultValue): Removed redundant exception check here.
+
+ * kjs/PropertySlot.cpp:
+ (KJS::PropertySlot::functionGetter): Added exception check to prevent
+ getter functions from observing execution after an exception has been
+ thrown. This removes some of the burden of exception checking from the
+ machine.
+
+2008-07-01 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Optimized a[n] get and put for cases where n is an immediate unsigned
+ value.
+
+ SunSpider says 3.5% faster.
+
+2008-07-01 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Darin.
+
+ Bug 19844: JavaScript Switch statement modifies "this"
+ <https://bugs.webkit.org/show_bug.cgi?id=19844>
+
+ Use a temporary when generating code for switch clauses to avoid
+ overwriting 'this' or a local variable.
+
+ * kjs/nodes.cpp:
+ (KJS::CaseBlockNode::emitCodeForBlock):
+
+2008-07-01 Christian Dywan <christian@twotoasts.de>
+
+ Gtk+ build fix.
+
+ * kjs/list.cpp: Include "JSCell.h"
+
+2008-07-01 Kevin McCullough <kmccullough@apple.com>
+
+ Build fix.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2008-07-01 Dan Bernstein <mitz@apple.com>
+
+ Reviewed by Anders Carlsson.
+
+ - Mac release build fix
+
+ * JavaScriptCore.exp:
+
+2008-07-01 Sam Weinig <sam@webkit.org>
+
+ Try and fix mac builds.
+
+ * JavaScriptCore.exp:
+
+2008-07-01 Sam Weinig <sam@webkit.org>
+
+ Fix non-AllInOne builds.
+
+ * kjs/DateMath.cpp:
+
+2008-07-01 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ Split JSCell and JSNumberCell class declarations out of JSValue.h
+
+ * GNUmakefile.am:
+ * JavaScriptCore.pri:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * JavaScriptCoreSources.bkl:
+ * VM/JSPropertyNameIterator.h:
+ * kjs/AllInOneFile.cpp:
+ * kjs/JSCell.cpp: Copied from JavaScriptCore/kjs/JSValue.cpp.
+ * kjs/JSCell.h: Copied from JavaScriptCore/kjs/JSValue.h.
+ (KJS::JSValue::getJSNumber):
+ * kjs/JSNumberCell.cpp:
+ * kjs/JSNumberCell.h: Copied from JavaScriptCore/kjs/JSValue.h.
+ * kjs/JSObject.h:
+ * kjs/JSString.cpp:
+ (KJS::jsString):
+ (KJS::jsOwnedString):
+ * kjs/JSString.h:
+ (KJS::JSValue::toThisJSString):
+ * kjs/JSValue.cpp:
+ * kjs/JSValue.h:
+
+2008-07-01 Anders Carlsson <andersca@apple.com>
+
+ Build fixes.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * kjs/JSGlobalObject.h:
+ (KJS::JSGlobalObject::addStaticGlobals):
+
+2008-07-01 Simon Hausmann <hausmann@webkit.org>
+
+ Build fix, include OwnPtr.h.
+
+ * kjs/RegExpConstructor.h:
+
+2008-06-30 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Fixed a global object leak caused by the switch to one register file.
+
+ Don't unconditionally mark the register file, since that logically
+ makes all global variables GC roots, even when their global object is
+ no longer reachable.
+
+ Instead, make the global object associated with the register file
+ responsible for marking the register file.
+
+2008-06-30 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Removed the "registerBase" abstraction. Since the register file never
+ reallocates, we can keep direct pointers into it, instead of
+ <registerBase, offset> tuples.
+
+ SunSpider says 0.8% faster.
+
+2008-06-30 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by NOBODY (build fix).
+
+ Fix build by adding all (hopefully) the missing includes.
+
+ * kjs/BooleanPrototype.cpp:
+ * kjs/DateConstructor.cpp:
+ * kjs/ErrorPrototype.cpp:
+ * kjs/FunctionPrototype.cpp:
+ * kjs/NativeErrorConstructor.cpp:
+ * kjs/NumberPrototype.cpp:
+ * kjs/ObjectPrototype.cpp:
+ * kjs/RegExpConstructor.cpp:
+ * kjs/StringConstructor.cpp:
+ * kjs/StringPrototype.cpp:
+
+2008-06-30 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Oliver.
+
+ Bug 19830: REGRESSION (r34883): Google Reader doesn't show up feed list on sidebar
+ <https://bugs.webkit.org/show_bug.cgi?id=19830>
+
+ Ensure that we do not eliminate a write to a local register when doing
+ peephole optimizations.
+
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::emitJumpIfTrue):
+ (KJS::CodeGenerator::emitJumpIfFalse):
+
+2008-06-30 Sam Weinig <sam@webkit.org>
+
+ Rubber-stamped by Darin Alder.
+
+ Split InternalFunction into its own header file.
+
+ * API/JSCallbackFunction.h:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * kjs/ArrayConstructor.h:
+ * kjs/BooleanConstructor.h:
+ * kjs/DateConstructor.h:
+ * kjs/ErrorConstructor.h:
+ * kjs/FunctionConstructor.h:
+ * kjs/FunctionPrototype.h:
+ * kjs/InternalFunction.h: Copied from kjs/JSFunction.h.
+ * kjs/JSFunction.h:
+ * kjs/NativeErrorConstructor.h:
+ * kjs/NumberConstructor.h:
+ * kjs/ObjectConstructor.h:
+ * kjs/RegExpConstructor.h:
+ * kjs/StringConstructor.h:
+ * profiler/Profiler.cpp:
+
+2008-06-30 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Kevin McCullough.
+
+ Remove empty files Instruction.cpp, LabelID.cpp, Register.cpp and RegisterID.cpp.
+
+ * GNUmakefile.am:
+ * JavaScriptCore.pri:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * JavaScriptCoreSources.bkl:
+ * VM/Instruction.cpp: Removed.
+ * VM/LabelID.cpp: Removed.
+ * VM/Register.cpp: Removed.
+ * VM/RegisterID.cpp: Removed.
+
+2008-06-30 Sam Weinig <sam@webkit.org>
+
+ Rubber-stamped (reluctantly) by Kevin McCullough.
+
+ Rename date_object.h/cpp to DateInstance.h/cpp
+
+ * GNUmakefile.am:
+ * JavaScriptCore.pri:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * JavaScriptCoreSources.bkl:
+ * kjs/AllInOneFile.cpp:
+ * kjs/DateConstructor.cpp:
+ * kjs/DateInstance.cpp: Copied from kjs/date_object.cpp.
+ * kjs/DateInstance.h: Copied from kjs/date_object.h.
+ * kjs/DatePrototype.cpp:
+ * kjs/DatePrototype.h:
+ * kjs/date_object.cpp: Removed.
+ * kjs/date_object.h: Removed.
+
+2008-06-30 Sam Weinig <sam@webkit.org>
+
+ Rubber-stamped by Darin Adler.
+
+ Remove internal.cpp and move its contents to there own .cpp files.
+
+ * GNUmakefile.am:
+ * JavaScriptCore.pri:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * JavaScriptCoreSources.bkl:
+ * kjs/AllInOneFile.cpp:
+ * kjs/GetterSetter.cpp: Copied from kjs/internal.cpp.
+ * kjs/InternalFunction.cpp: Copied from kjs/internal.cpp.
+ * kjs/JSNumberCell.cpp: Copied from kjs/internal.cpp.
+ * kjs/JSString.cpp: Copied from kjs/internal.cpp.
+ * kjs/JSString.h:
+ * kjs/LabelStack.cpp: Copied from kjs/internal.cpp.
+ * kjs/NumberConstructor.cpp:
+ * kjs/NumberObject.cpp:
+ (KJS::constructNumber):
+ (KJS::constructNumberFromImmediateNumber):
+ * kjs/internal.cpp: Removed.
+
+2008-06-30 Adam Roben <aroben@apple.com>
+
+ Fix <rdar://5954749> Assertion failure due to HashTable's use of
+ operator&
+
+ HashTable was passing &value to constructDeletedValue, which in
+ classes like WebCore::COMPtr would cause an assertion. We now pass
+ value by reference instead of by address so that the HashTraits
+ implementations have more flexibility in constructing the deleted
+ value.
+
+ Reviewed by Ada Chan.
+
+ * VM/CodeGenerator.h: Updated for changes to HashTraits.
+ * wtf/HashTable.h:
+ (WTF::::deleteBucket): Changed to pass bucket by reference instead of
+ by address.
+ (WTF::::checkKey): Ditto.
+ * wtf/HashTraits.h:
+ (WTF::): Updated HashTraits for HashTable change.
+
+2008-07-01 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Cameron Zwarich.
+
+ Make RegisterFile really unmap memory on destruction.
+
+ This fixes run-webkit-tests --threaded, which ran out of address space in a few seconds.
+
+ * VM/RegisterFile.cpp: (KJS::RegisterFile::~RegisterFile): Unmap all the memory, not just
+ 1/4 of it.
+
+ * kjs/JSGlobalObject.h: Don't include RegisterFile.h, so that changes to it don't make
+ half of WebCore rebuild.
+
+ * VM/Machine.h: Don't forward declare RegisterFile, as RegisterFile.h is included already.
+
+ * VM/RegisterFile.h: (KJS::RegisterFile::RegisterFile): Assert that the allocation succeeded.
+
+2008-06-30 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Rubber-stamped by Oliver.
+
+ Correct the documentation for op_put_by_index.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+
+2008-06-29 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Oliver.
+
+ Bug 19821: Merge the instruction pair (less, jfalse)
+ <https://bugs.webkit.org/show_bug.cgi?id=19821>
+
+ This is a 2.4% win on SunSpider. I needed to add an ALWAYS_INLINE
+ intrinisc to CodeGenerator::rewindBinaryOp() to avoid a massive
+ regression in regexp-dna.
+
+ * VM/CodeBlock.cpp:
+ (KJS::CodeBlock::dump):
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::rewindBinaryOp):
+ (KJS::CodeGenerator::emitJumpIfFalse):
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+ * VM/Opcode.cpp:
+ (KJS::):
+ * VM/Opcode.h:
+
+2008-06-29 Sam Weinig <sam@webkit.org>
+
+ Fix non-AllInOne builds.
+
+ * kjs/JSObject.cpp:
+ * kjs/JSValue.cpp:
+
+2008-06-29 Sam Weinig <sam@webkit.org>
+
+ Build fix for Qt.
+
+ * kjs/DateMath.cpp:
+ * kjs/DatePrototype.cpp:
+
+2008-06-29 Sam Weinig <sam@webkit.org>
+
+ Rubber-stamped by Cameron Zwarich.
+
+ Splits ErrorConstructor, ErrorPrototype, NativeErrorConstructor and
+ NativeErrorPrototype out of error_object.h/cpp and renames it ErrorInstance.
+
+ * GNUmakefile.am:
+ * JavaScriptCore.pri:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * JavaScriptCoreSources.bkl:
+ * kjs/AllInOneFile.cpp:
+ * kjs/ArrayConstructor.cpp:
+ * kjs/ArrayPrototype.cpp:
+ * kjs/BooleanPrototype.cpp:
+ * kjs/DatePrototype.cpp:
+ * kjs/ErrorConstructor.cpp: Copied from kjs/error_object.cpp.
+ * kjs/ErrorConstructor.h: Copied from kjs/error_object.h.
+ * kjs/ErrorInstance.cpp: Copied from kjs/error_object.cpp.
+ * kjs/ErrorInstance.h: Copied from kjs/error_object.h.
+ * kjs/ErrorPrototype.cpp: Copied from kjs/error_object.cpp.
+ * kjs/ErrorPrototype.h: Copied from kjs/error_object.h.
+ * kjs/JSGlobalObject.cpp:
+ * kjs/JSObject.cpp:
+ * kjs/JSValue.cpp:
+ * kjs/NativeErrorConstructor.cpp: Copied from kjs/error_object.cpp.
+ * kjs/NativeErrorConstructor.h: Copied from kjs/error_object.h.
+ * kjs/NativeErrorPrototype.cpp: Copied from kjs/error_object.cpp.
+ * kjs/NativeErrorPrototype.h: Copied from kjs/error_object.h.
+ * kjs/NumberPrototype.cpp:
+ * kjs/RegExpConstructor.cpp:
+ * kjs/RegExpObject.cpp:
+ * kjs/RegExpPrototype.cpp:
+ * kjs/StringPrototype.cpp:
+ * kjs/error_object.cpp: Removed.
+ * kjs/error_object.h: Removed.
+ * kjs/internal.cpp:
+
+2008-06-29 Sam Weinig <sam@webkit.org>
+
+ Fix non-AllInOne build.
+
+ * kjs/DateConstructor.cpp:
+ * kjs/DateMath.cpp:
+ * kjs/JSObject.cpp:
+
+2008-06-29 Sam Weinig <sam@webkit.org>
+
+ Rubber-stamped by Oliver Hunt.
+
+ Splits DateConstructor and DatePrototype out of date_object.h/cpp
+ Moves shared Date code into DateMath.
+
+ * DerivedSources.make:
+ * GNUmakefile.am:
+ * JavaScriptCore.pri:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * JavaScriptCoreSources.bkl:
+ * kjs/AllInOneFile.cpp:
+ * kjs/DateConstructor.cpp: Copied from kjs/date_object.cpp.
+ * kjs/DateConstructor.h: Copied from kjs/date_object.h.
+ * kjs/DateMath.cpp:
+ (KJS::ymdhmsToSeconds):
+ (KJS::):
+ (KJS::skipSpacesAndComments):
+ (KJS::findMonth):
+ (KJS::parseDate):
+ (KJS::timeClip):
+ (KJS::formatDate):
+ (KJS::formatDateUTCVariant):
+ (KJS::formatTime):
+ * kjs/DateMath.h:
+ (KJS::gmtoffset):
+ * kjs/DatePrototype.cpp: Copied from kjs/date_object.cpp.
+ * kjs/DatePrototype.h: Copied from kjs/date_object.h.
+ * kjs/JSGlobalObject.cpp:
+ * kjs/JSObject.cpp:
+ * kjs/date_object.cpp:
+ * kjs/date_object.h:
+ * kjs/internal.cpp:
+
+2008-06-29 Jan Michael Alonzo <jmalonzo@webkit.org>
+
+ Rubber-stamped by Cameron Zwarich
+
+ Fix Gtk non-AllInOne build
+
+ * GNUmakefile.am: include JSVariableObject.cpp
+ * kjs/RegExpConstructor.cpp: include RegExpObject.h
+ * kjs/RegExpObject.h: forward declare RegExpPrototype
+
+2008-06-28 Darin Adler <darin@apple.com>
+
+ Reviewed by Sam and Cameron.
+
+ - fix https://bugs.webkit.org/show_bug.cgi?id=19805
+ Array.concat turns missing array elements into "undefined"
+
+ Test: fast/js/array-holes.html
+
+ * JavaScriptCore.exp: No longer export JSArray::getItem.
+
+ * kjs/ArrayPrototype.cpp:
+ (KJS::arrayProtoFuncConcat): Changed to use getProperty instead of
+ JSArray::getItem -- need to handle properties from the prototype chain
+ instead of ignoring them.
+
+ * kjs/JSArray.cpp: Removed getItem.
+ * kjs/JSArray.h: Ditto.
+
+2008-06-28 Darin Adler <darin@apple.com>
+
+ Reviewed by Cameron.
+
+ - https://bugs.webkit.org/show_bug.cgi?id=19804
+ optimize access to arrays without "holes"
+
+ SunSpider says 1.8% faster.
+
+ * kjs/JSArray.cpp:
+ (KJS::JSArray::JSArray): Initialize m_fastAccessCutoff when creating
+ arrays. Also updated for new location of m_vectorLength.
+ (KJS::JSArray::getItem): Updated for new location of m_vectorLength.
+ (KJS::JSArray::getSlowCase): Added. Broke out the non-hot parts of
+ getOwnPropertySlot to make the hot part faster.
+ (KJS::JSArray::getOwnPropertySlot): Added a new faster case for
+ indices lower than m_fastAccessCutoff. We can do theese with no
+ additional checks or branches.
+ (KJS::JSArray::put): Added a new faster case for indices lower than
+ m_fastAccessCutoff. We can do theese with no additional checks or
+ branches. Moved the maxArrayIndex handling out of this function.
+ Added code to set m_fastAccessCutoff when the very last hole in
+ an array is filled; this is how the cutoff gets set for most arrays.
+ (KJS::JSArray::putSlowCase): Moved the rest of the put function logic
+ in here, to make the hot part of the put function faster.
+ (KJS::JSArray::deleteProperty): Added code to lower m_fastAccessCutoff
+ when a delete makes a new hole in the array.
+ (KJS::JSArray::getPropertyNames): Updated for new location of
+ m_vectorLength.
+ (KJS::JSArray::increaseVectorLength): Ditto.
+ (KJS::JSArray::setLength): Added code to lower m_fastAccessCutoff
+ when setLength makes the array smaller.
+ (KJS::JSArray::mark): Updated for new location of m_vectorLength.
+ (KJS::JSArray::sort): Ditto. Set m_fastAccessCutoff after moving
+ all the holes to the end of the array.
+ (KJS::JSArray::compactForSorting): Ditto.
+ (KJS::JSArray::checkConsistency): Added consistency checks fro
+ m_fastAccessCutoff and updated for the new location of m_vectorLength.
+
+ * kjs/JSArray.h: Added declarations for slow case functions.
+ Replaced m_vectorLength with m_fastAccessCutoff.
+
+2008-06-28 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Sam.
+
+ When executing a native call, check for an exception before writing the
+ return value.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+
+2008-06-28 Mark Rowe <mrowe@apple.com>
+
+ Build fix. Flag headers as private or public as is appropriate.
+ These settings were accidentally removed during some project file cleanup.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2008-06-28 Sam Weinig <sam@webkit.org>
+
+ Rubber-stamped by Darin Adler.
+
+ Splits RegExpConstructor and RegExpPrototype out of RegExpObject.h/cpp
+
+ * DerivedSources.make:
+ * GNUmakefile.am:
+ * JavaScriptCore.pri:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * JavaScriptCoreSources.bkl:
+ * VM/Machine.cpp:
+ * kjs/AllInOneFile.cpp:
+ * kjs/JSGlobalObject.cpp:
+ * kjs/RegExpConstructor.cpp: Copied from kjs/RegExpObject.cpp.
+ * kjs/RegExpConstructor.h: Copied from kjs/RegExpObject.h.
+ * kjs/RegExpObject.cpp:
+ * kjs/RegExpObject.h:
+ * kjs/RegExpPrototype.cpp: Copied from kjs/RegExpObject.cpp.
+ * kjs/RegExpPrototype.h: Copied from kjs/RegExpObject.h.
+ * kjs/StringPrototype.cpp:
+ * kjs/internal.cpp:
+
+2008-06-28 Sam Weinig <sam@webkit.org>
+
+ Fix non-AllInOne builds.
+
+ * kjs/StringConstructor.cpp:
+
+2008-06-28 Sam Weinig <sam@webkit.org>
+
+ Rubber-stamped by Darin Adler.
+
+ Rename string_object.h/cpp to StringObject.h/cpp and split out StringObjectThatMasqueradesAsUndefined,
+ StringConstructor and StringPrototype.
+
+ * DerivedSources.make:
+ * GNUmakefile.am:
+ * JavaScriptCore.pri:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * JavaScriptCoreSources.bkl:
+ * kjs/AllInOneFile.cpp:
+ * kjs/JSGlobalObject.cpp:
+ * kjs/StringConstructor.cpp: Copied from JavaScriptCore/kjs/string_object.cpp.
+ * kjs/StringConstructor.h: Copied from JavaScriptCore/kjs/string_object.h.
+ * kjs/StringObject.cpp: Copied from JavaScriptCore/kjs/string_object.cpp.
+ * kjs/StringObject.h: Copied from JavaScriptCore/kjs/string_object.h.
+ * kjs/StringObjectThatMasqueradesAsUndefined.h: Copied from JavaScriptCore/kjs/string_object.h.
+ * kjs/StringPrototype.cpp: Copied from JavaScriptCore/kjs/string_object.cpp.
+ * kjs/StringPrototype.h: Copied from JavaScriptCore/kjs/string_object.h.
+ * kjs/internal.cpp:
+ * kjs/string_object.cpp: Removed.
+ * kjs/string_object.h: Removed.
+
+2008-06-28 Jan Michael Alonzo <jmalonzo@webkit.org>
+
+ Gtk build fix: JSVariableObject is now part of AllInOne
+
+ * GNUmakefile.am:
+
+2008-06-28 Darin Adler <darin@apple.com>
+
+ Reviewed by Oliver.
+
+ - https://bugs.webkit.org/show_bug.cgi?id=19801
+ add a feature so we can tell what regular expressions are taking time
+
+ * pcre/pcre_compile.cpp:
+ (jsRegExpCompile): Compile in the string if REGEXP_HISTOGRAM is on.
+
+ * pcre/pcre_exec.cpp:
+ (jsRegExpExecute): Add hook to time execution.
+ (Histogram::~Histogram): Print a sorted list of what took time.
+ (Histogram::add): Accumulate records of what took time.
+ (HistogramTimeLogger::~HistogramTimeLogger): Hook that calls
+ Histogram::add at the right moment and creates the global histogram
+ object.
+
+ * pcre/pcre_internal.h: Define REGEXP_HISTOGRAM.
+
+ * pcre/pcre_tables.cpp: Added missing include of "config.h". Not needed
+ any more, but an omissions an earlier version of this patch detected.
+ * pcre/pcre_ucp_searchfuncs.cpp: Ditto.
+ * pcre/pcre_xclass.cpp: Ditto.
+
+2008-06-28 Sam Weinig <sam@webkit.org>
+
+ Try and fix the Windows build again.
+
+ * kjs/RegExpObject.cpp:
+ * kjs/date_object.cpp:
+ * kjs/error_object.cpp:
+
+2008-06-28 Sam Weinig <sam@webkit.org>
+
+ Rubber-stamped by Darin Adler.
+
+ Remove unused StringConstructorFunction class.
+
+ * kjs/string_object.h:
+
+2008-06-28 Sam Weinig <sam@webkit.org>
+
+ Fix windows build.
+
+ * kjs/ArrayPrototype.cpp:
+ * kjs/BooleanPrototype.cpp:
+ * kjs/BooleanPrototype.h:
+ * kjs/FunctionPrototype.cpp:
+ * kjs/JSImmediate.cpp:
+ * kjs/JSObject.cpp:
+ * kjs/MathObject.cpp:
+ * kjs/NumberPrototype.cpp:
+ * kjs/NumberPrototype.h:
+ * kjs/ObjectConstructor.cpp:
+ * kjs/RegExpObject.h:
+ * kjs/error_object.h:
+ * kjs/string_object.cpp:
+
+2008-06-28 Sam Weinig <sam@webkit.org>
+
+ Rubber-stamped by Oliver Hunt.
+
+ Splits FunctionConstructor out of FunctionPrototype.h/cpp
+ Splits NumberConstructor and NumberPrototype out of NumberObject.h/cpp
+ Rename object_object.h/cpp to ObjectPrototype.h/cpp and split out ObjectConstructor.
+
+ * API/JSCallbackConstructor.cpp:
+ * API/JSClassRef.cpp:
+ * API/JSObjectRef.cpp:
+ * DerivedSources.make:
+ * GNUmakefile.am:
+ * JavaScriptCore.pri:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * JavaScriptCoreSources.bkl:
+ * VM/Machine.cpp:
+ * kjs/AllInOneFile.cpp:
+ * kjs/ArrayConstructor.cpp:
+ * kjs/ArrayConstructor.h:
+ * kjs/FunctionConstructor.cpp: Copied from JavaScriptCore/kjs/FunctionPrototype.cpp.
+ * kjs/FunctionConstructor.h: Copied from JavaScriptCore/kjs/FunctionPrototype.h.
+ * kjs/FunctionPrototype.cpp:
+ * kjs/FunctionPrototype.h:
+ * kjs/JSFunction.cpp:
+ * kjs/JSGlobalObject.cpp:
+ * kjs/JSImmediate.cpp:
+ * kjs/MathObject.h:
+ * kjs/NumberConstructor.cpp: Copied from JavaScriptCore/kjs/NumberObject.cpp.
+ * kjs/NumberConstructor.h: Copied from JavaScriptCore/kjs/NumberObject.h.
+ * kjs/NumberObject.cpp:
+ * kjs/NumberObject.h:
+ * kjs/NumberPrototype.cpp: Copied from JavaScriptCore/kjs/NumberObject.cpp.
+ * kjs/NumberPrototype.h: Copied from JavaScriptCore/kjs/NumberObject.h.
+ * kjs/ObjectConstructor.cpp: Copied from JavaScriptCore/kjs/object_object.cpp.
+ * kjs/ObjectConstructor.h: Copied from JavaScriptCore/kjs/object_object.h.
+ * kjs/ObjectPrototype.cpp: Copied from JavaScriptCore/kjs/object_object.cpp.
+ * kjs/ObjectPrototype.h: Copied from JavaScriptCore/kjs/object_object.h.
+ * kjs/RegExpObject.h:
+ * kjs/Shell.cpp:
+ * kjs/error_object.h:
+ * kjs/internal.cpp:
+ * kjs/nodes.cpp:
+ * kjs/object_object.cpp: Removed.
+ * kjs/object_object.h: Removed.
+ * kjs/string_object.h:
+
+2008-06-28 Darin Adler <darin@apple.com>
+
+ Reviewed by Oliver.
+
+ - fix https://bugs.webkit.org/show_bug.cgi?id=19796
+ optimize expressions with ignored results (especially post-increment)
+
+ SunSpider says 0.9% faster.
+
+ * VM/CodeGenerator.h:
+ (KJS::CodeGenerator::tempDestination): Create a new temporary for
+ ignoredResult() too, just as we would for 0.
+ (KJS::CodeGenerator::finalDestination): Use the temporary if the
+ register passed in is ignoredResult() too, just as we would for 0.
+ (KJS::CodeGenerator::destinationForAssignResult): Return 0 if the
+ passed in register is ignoredResult(), just as we would for 0.
+ (KJS::CodeGenerator::moveToDestinationIfNeeded): Return 0 if the
+ register passed in is ignoredResult(). What matters is that we
+ don't want to emit a move. The return value won't be looked at.
+ (KJS::CodeGenerator::emitNode): Allow ignoredResult() and pass it
+ through to the node's emitCode function.
+
+ * VM/RegisterID.h:
+ (KJS::ignoredResult): Added. Special value to indicate the result of
+ a node will be ignored and need not be put in any register.
+
+ * kjs/nodes.cpp:
+ (KJS::NullNode::emitCode): Do nothing if dst == ignoredResult().
+ (KJS::BooleanNode::emitCode): Ditto.
+ (KJS::NumberNode::emitCode): Ditto.
+ (KJS::StringNode::emitCode): Ditto.
+ (KJS::RegExpNode::emitCode): Ditto.
+ (KJS::ThisNode::emitCode): Ditto.
+ (KJS::ResolveNode::emitCode): Do nothing if dst == ignoredResult() and
+ the identifier resolves to a local variable.
+ (KJS::ObjectLiteralNode::emitCode): Do nothing if dst == ignoredResult()
+ and the object is empty.
+ (KJS::PostIncResolveNode::emitCode): If dst == ignoredResult(), then do
+ nothing for the local constant case, and do a pre-increment in all the
+ other cases.
+ (KJS::PostDecResolveNode::emitCode): Ditto.
+ (KJS::PostIncBracketNode::emitCode): Ditto.
+ (KJS::PostDecBracketNode::emitCode): Ditto.
+ (KJS::PostIncDotNode::emitCode): Ditto.
+ (KJS::PostDecDotNode::emitCode): Ditto.
+ (KJS::DeleteValueNode::emitCode): Pass ignoredResult() when evaluating
+ the expression.
+ (KJS::VoidNode::emitCode): Ditto.
+ (KJS::TypeOfResolveNode::emitCode): If dst == ignoredResult(), do nothing
+ if the identifier resolves to a local variable, and don't bother generating
+ a typeof opcode in the other case.
+ (KJS::TypeOfValueNode::emitCode): Ditto.
+ (KJS::PreIncResolveNode::emitCode): Do nothing if dst == ignoredResult() and
+ the identifier resolves to a local constant.
+ (KJS::PreDecResolveNode::emitCode): Ditto.
+ (KJS::AssignResolveNode::emitCode): Turn ignoredResult() into 0 in a couple
+ places, because we need to put the result into a register so we can assign
+ it. At other sites this is taken care of by functions like finalDestination.
+ (KJS::CommaNode::emitCode): Pass ignoredResult() when evaluating the first
+ expression.
+ (KJS::ForNode::emitCode): Pass ignoredResult() when evaluating the first and
+ third expressions.
+ (KJS::ForInNode::emitCode): Pass ignoredResult() when evaluating the first
+ expression.
+
+2008-06-28 Darin Adler <darin@apple.com>
+
+ Reviewed by Oliver.
+
+ - https://bugs.webkit.org/show_bug.cgi?id=19787
+ create most arrays from values in registers rather than with multiple put operations
+
+ SunSpider says 0.8% faster.
+
+ * VM/CodeBlock.cpp:
+ (KJS::CodeBlock::dump): Added argv and argc parameters to new_array.
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute): Ditto.
+
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::emitNewArray): Added.
+ * VM/CodeGenerator.h: Added ElementNode* argument to emitNewArray.
+
+ * kjs/nodes.cpp:
+ (KJS::ArrayNode::emitCode): Pass the ElementNode to emitNewArray so it can be
+ initialized with as many elements as possible. If the array doesn't have any
+ holes in it, that's all that's needed. If there are holes, then emit some separate
+ put operations for the other values in the array and for the length as needed.
+
+ * kjs/nodes.h: Added some accessors to ElementNode so the code generator can
+ iterate through elements and generate code to evaluate them. Now ArrayNode does
+ not need to be a friend. Also took out some unused PlacementNewAdoptType
+ constructors.
+
+2008-06-28 Darin Adler <darin@apple.com>
+
+ Reviewed by Oliver.
+
+ * kjs/nodes.h: Remove obsolete PlacementNewAdopt constructors.
+ We no longer mutate the AST in place.
+
+2008-06-28 Jan Michael Alonzo <jmalonzo@webkit.org>
+
+ Reviewed by Oliver Hunt.
+
+ Build fix
+
+ * VM/Machine.cpp: include stdio.h for printf
+
+2008-06-27 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Oliver Hunt.
+
+ Fix platforms that don't use AllInOne.cpp
+
+ * kjs/BooleanConstructor.h:
+ * kjs/BooleanPrototype.h:
+ * kjs/FunctionPrototype.cpp:
+
+2008-06-27 Sam Weinig <sam@webkit.org>
+
+ Rubber-stamped by Oliver Hunt.
+
+ Splits ArrayConstructor out of ArrayPrototype.h/cpp
+ Splits BooleanConstructor and BooleanPrototype out of BooleanObject.h/cpp
+
+ * GNUmakefile.am:
+ * JavaScriptCore.pri:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * JavaScriptCoreSources.bkl:
+ * VM/Machine.cpp:
+ * kjs/AllInOneFile.cpp:
+ * kjs/ArrayConstructor.cpp: Copied from kjs/ArrayPrototype.cpp.
+ * kjs/ArrayConstructor.h: Copied from kjs/ArrayPrototype.h.
+ * kjs/ArrayPrototype.cpp:
+ * kjs/ArrayPrototype.h:
+ * kjs/BooleanConstructor.cpp: Copied from kjs/BooleanObject.cpp.
+ * kjs/BooleanConstructor.h: Copied from kjs/BooleanObject.h.
+ * kjs/BooleanObject.cpp:
+ * kjs/BooleanObject.h:
+ * kjs/BooleanPrototype.cpp: Copied from kjs/BooleanObject.cpp.
+ * kjs/BooleanPrototype.h: Copied from kjs/BooleanObject.h.
+ * kjs/CommonIdentifiers.h:
+ * kjs/FunctionPrototype.cpp:
+ * kjs/JSArray.cpp:
+ * kjs/JSGlobalObject.cpp:
+ * kjs/JSImmediate.cpp:
+ * kjs/Shell.cpp:
+ * kjs/internal.cpp:
+ * kjs/nodes.cpp:
+ * kjs/string_object.cpp:
+
+2008-06-27 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Sam.
+
+ Bug 18626: SQUIRRELFISH: support the "slow script" dialog <https://bugs.webkit.org/show_bug.cgi?id=18626>
+ <rdar://problem/5973931> Slow script dialog needs to be reimplemented for squirrelfish
+
+ Adds support for the slow script dialog in squirrelfish. This requires the addition
+ of three new op codes, op_loop, op_loop_if_true, and op_loop_if_less which have the
+ same behaviour as their simple jump equivalents but have an additional time out check.
+
+ Additional assertions were added to other jump instructions to prevent accidentally
+ creating loops with jump types that do not support time out checks.
+
+ Sunspider does not report a regression, however this appears very sensitive to code
+ layout and hardware, so i would expect up to a 1% regression on other systems.
+
+ Part of this required moving the old timeout logic from JSGlobalObject and into Machine
+ which is the cause of a number of the larger diff blocks.
+
+ * JavaScriptCore.exp:
+ * VM/CodeBlock.cpp:
+ (KJS::CodeBlock::dump):
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::emitJumpIfTrue):
+ (KJS::CodeGenerator::emitJumpScopes):
+ * VM/ExceptionHelpers.cpp:
+ (KJS::InterruptedExecutionError::isWatchdogException):
+ (KJS::createInterruptedExecutionException):
+ * VM/ExceptionHelpers.h:
+ * VM/LabelID.h:
+ * VM/Machine.cpp:
+ (KJS::Machine::Machine):
+ (KJS::Machine::throwException):
+ (KJS::Machine::resetTimeoutCheck):
+ (KJS::getCurrentTime):
+ (KJS::Machine::checkTimeout):
+ (KJS::Machine::privateExecute):
+ * VM/Machine.h:
+ (KJS::Machine::setTimeoutTime):
+ (KJS::Machine::startTimeoutCheck):
+ (KJS::Machine::stopTimeoutCheck):
+ (KJS::Machine::initTimeout):
+ * VM/Opcode.cpp:
+ (KJS::):
+ * VM/Opcode.h:
+ * kjs/JSGlobalObject.cpp:
+ (KJS::JSGlobalObject::init):
+ (KJS::JSGlobalObject::setTimeoutTime):
+ (KJS::JSGlobalObject::startTimeoutCheck):
+ * kjs/JSGlobalObject.h:
+ * kjs/JSObject.h:
+ * kjs/interpreter.cpp:
+ (KJS::Interpreter::evaluate):
+
+2008-06-27 Jan Michael Alonzo <jmalonzo@webkit.org>
+
+ Gtk and Qt build fix: Remove RegisterFileStack from the build
+ scripts.
+
+ * GNUmakefile.am:
+ * JavaScriptCore.pri:
+
+2008-06-27 Adele Peterson <adele@apple.com>
+
+ Reviewed by Geoff.
+
+ Build fixes.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * VM/RegisterFile.h:
+ (KJS::RegisterFile::RegisterFile):
+ * kjs/JSGlobalObject.cpp:
+ * kjs/collector.cpp:
+
+2008-06-27 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ One RegisterFile to rule them all!
+
+ SunSpider reports a 0.2% speedup.
+
+ This patch removes the RegisterFileStack abstraction and replaces it with
+ a single register file that
+
+ (a) allocates a fixed storage area, including a fixed area for global
+ vars, so that no operation may cause the register file to reallocate
+
+ and
+
+ (b) swaps between global storage areas when executing code in different
+ global objects.
+
+ This patch also changes the layout of the register file so that all call
+ frames, including call frames for global code, get a header. This is
+ required to support re-entrant global code. It also just makes things simpler.
+
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::addGlobalVar): New function. Differs from addVar in
+ that
+
+ (a) global vars don't contribute to a CodeBlock's numLocals count, since
+ global storage is fixed and allocated at startup
+
+ and
+
+ (b) references to global vars get shifted to elide intermediate stack
+ between "r" and the global storage area.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::dumpRegisters): Updated this function to match the new
+ register file layout, and added the ability to dump exact identifiers
+ for the different parts of a call frame.
+
+ (KJS::Machine::unwindCallFrame): Updated this function to match the new
+ register file layout.
+
+ (KJS::Machine::execute): Updated this function to initialize a call frame
+ header for global code, and to swap global storage areas when switching
+ to execution in a new global object.
+
+ (KJS::Machine::privateExecute): Got rid of "safeForReentry" and re-reading
+ of registerBase because the register file is always safe for reentry now,
+ and registerBase never changes.
+
+ * VM/Machine.h: Moved the call frame header enum from Machine to RegisterFile,
+ to resolve a header dependency problem (a good sign that the enum belonged
+ in RegisterFile all along!)
+
+ * VM/RegisterFile.cpp:
+ * VM/RegisterFile.h: Changed RegisterFile to mmap a fixed size register
+ area. This allows us to avoid re-allocting the register file later on.
+ Instead, we rely on the OS to allocate physical pages to the register
+ file as necessary.
+
+ * VM/RegisterFileStack.cpp: Removed. Tada!
+ * VM/RegisterFileStack.h: Removed. Tada!
+
+ * kjs/DebuggerCallFrame.cpp: Updated this class to match the new
+ register file layout, greatly simplifying it in the process.
+
+ * kjs/JSActivation.h:
+ * kjs/JSActivation.cpp: Moved some of this logic up to JSVariableObject,
+ since the global object now needs to be able to tear off its registers
+ just like the activation object.
+
+ * kjs/JSFunction.cpp: No need to fiddle with the register file anymore.
+
+ * kjs/JSGlobalObject.h:
+ * kjs/JSGlobalObject.cpp: Updated JSGlobalObject to support moving its
+ global storage area into and out of the register file.
+
+ * kjs/PropertySlot.cpp: No need to fiddle with the register file anymore.
+
+ * kjs/collector.cpp: Renamed markStackObjectConservatively to
+ markConservatively, since we don't just mark stack objects this way.
+
+ Also, added code to mark the machine's register file.
+
+ * kjs/config.h: Moved some platforms #defines from here...
+ * wtf/Platform.h: ...to here, to support mmap/VirtualAlloc detection
+ in RegisterFile.h.
+
+2008-06-26 Mark Rowe <mrowe@apple.com>
+
+ Speculative fix for the Windows build.
+
+ * kjs/JSImmediate.cpp:
+
+2008-06-26 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Darin Adler and Geoff Garen.
+
+ Fix the malloc zone introspection functions so that malloc_zone_statistics does not give
+ bogus output in an application that uses JavaScriptCore.
+
+ * kjs/CollectorHeapIntrospector.cpp:
+ (KJS::CollectorHeapIntrospector::statistics): Return statistics about memory allocated by the collector.
+ * kjs/CollectorHeapIntrospector.h:
+ * wtf/FastMalloc.cpp: Zero out the statistics. FastMalloc doesn't track this information at present.
+ Returning zero for all values is preferable to returning bogus data.
+
+2008-06-26 Darin Adler <darin@apple.com>
+
+ Reviewed by Geoff.
+
+ - https://bugs.webkit.org/show_bug.cgi?id=19721
+ speed up JavaScriptCore by not wrapping strings in objects just
+ to call functions on them
+
+ - optimize UString append and the replace function a bit
+
+ SunSpider says 1.8% faster.
+
+ * JavaScriptCore.exp: Updated.
+
+ * VM/JSPropertyNameIterator.cpp: Added include of JSString.h, now needed
+ because jsString returns a JSString*.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute): Removed the toObject call from native
+ function calls. Also removed code to put the this value into a register.
+
+ * kjs/BooleanObject.cpp:
+ (KJS::booleanProtoFuncToString): Rewrite to handle false and true
+ separately.
+
+ * kjs/FunctionPrototype.cpp:
+ (KJS::constructFunction): Use single-character append rather than building
+ a string for each character.
+ * kjs/JSFunction.cpp:
+ (KJS::globalFuncUnescape): Ditto.
+
+ * kjs/JSImmediate.cpp:
+ (KJS::JSImmediate::prototype): Added. Gets the appropriate prototype for
+ use with an immediate value. To be used instead of toObject when doing a
+ get on an immediate value.
+ * kjs/JSImmediate.h: Added prototype.
+
+ * kjs/JSObject.cpp:
+ (KJS::JSObject::toString): Tweaked formatting.
+
+ * kjs/JSObject.h:
+ (KJS::JSValue::get): Use prototype instead of toObject to avoid creating
+ an object wrapper just to search for properties. This also saves an
+ unnecessary hash table lookup since the object wrappers themselves don't
+ have any properties.
+
+ * kjs/JSString.h: Added toThisString and toThisJSString.
+
+ * kjs/JSValue.cpp:
+ (KJS::JSCell::toThisString): Added.
+ (KJS::JSCell::toThisJSString): Added.
+ (KJS::JSCell::getJSNumber): Added.
+ (KJS::jsString): Changed return type to JSString*.
+ (KJS::jsOwnedString): Ditto.
+
+ * kjs/JSValue.h:
+ (KJS::JSValue::toThisString): Added.
+ (KJS::JSValue::toThisJSString): Added.
+ (KJS::JSValue::getJSNumber): Added.
+
+ * kjs/NumberObject.cpp:
+ (KJS::NumberObject::getJSNumber): Added.
+ (KJS::integer_part_noexp): Append C string directly rather than first
+ turning it into a UString.
+ (KJS::numberProtoFuncToString): Use getJSNumber to check if the value
+ is a number rather than isObject(&NumberObject::info). This works for
+ immediate numbers, number cells, and NumberObject instances.
+ (KJS::numberProtoFuncToLocaleString): Ditto.
+ (KJS::numberProtoFuncValueOf): Ditto.
+ (KJS::numberProtoFuncToFixed): Ditto.
+ (KJS::numberProtoFuncToExponential): Ditto.
+ (KJS::numberProtoFuncToPrecision): Ditto.
+ * kjs/NumberObject.h: Added getJSNumber.
+
+ * kjs/PropertySlot.cpp: Tweaked comment.
+
+ * kjs/internal.cpp:
+ (KJS::JSString::toThisString): Added.
+ (KJS::JSString::toThisJSString): Added.
+ (KJS::JSString::getOwnPropertySlot): Changed code that searches the
+ prototype chain to start with the string prototype and not create a
+ string object.
+ (KJS::JSNumberCell::toThisString): Added.
+ (KJS::JSNumberCell::getJSNumber): Added.
+
+ * kjs/lookup.cpp:
+ (KJS::staticFunctionGetter): Moved here, because there's no point in
+ having a function that's only used for a function pointer be inline.
+ (KJS::setUpStaticFunctionSlot): New function for getStaticFunctionSlot.
+
+ * kjs/lookup.h:
+ (KJS::staticValueGetter): Don't mark this inline. It doesn't make sense
+ to have a function that's only used for a function pointer be inline.
+ (KJS::getStaticFunctionSlot): Changed to get properties from the parent
+ first before doing any handling of functions. This is the fastest way
+ to return the function once the initial setup is done.
+
+ * kjs/string_object.cpp:
+ (KJS::StringObject::getPropertyNames): Call value() instead of getString(),
+ avoiding an unnecessary virtual function call (the call to the type()
+ function in the implementation of the isString() function).
+ (KJS::StringObject::toString): Added.
+ (KJS::StringObject::toThisString): Added.
+ (KJS::StringObject::toThisJSString): Added.
+ (KJS::substituteBackreferences): Rewrote to use a appending algorithm
+ instead of a the old one that tried to replace in place.
+ (KJS::stringProtoFuncReplace): Merged this function and the replace function.
+ Replaced the hand-rolled dynamic arrays for source ranges and replacements
+ with Vector.
+ (KJS::stringProtoFuncToString): Handle JSString as well as StringObject.
+ Removed the separate valueOf implementation, since it can just share this.
+ (KJS::stringProtoFuncCharAt): Use toThisString, which handles JSString as
+ well as StringObject, and is slightly more efficient than the old code too.
+ (KJS::stringProtoFuncCharCodeAt): Ditto.
+ (KJS::stringProtoFuncConcat): Ditto.
+ (KJS::stringProtoFuncIndexOf): Ditto.
+ (KJS::stringProtoFuncLastIndexOf): Ditto.
+ (KJS::stringProtoFuncMatch): Ditto.
+ (KJS::stringProtoFuncSearch): Ditto.
+ (KJS::stringProtoFuncSlice): Ditto.
+ (KJS::stringProtoFuncSplit): Ditto.
+ (KJS::stringProtoFuncSubstr): Ditto.
+ (KJS::stringProtoFuncSubstring): Ditto.
+ (KJS::stringProtoFuncToLowerCase): Use toThisJSString.
+ (KJS::stringProtoFuncToUpperCase): Ditto.
+ (KJS::stringProtoFuncToLocaleLowerCase): Ditto.
+ (KJS::stringProtoFuncToLocaleUpperCase): Ditto.
+ (KJS::stringProtoFuncLocaleCompare): Ditto.
+ (KJS::stringProtoFuncBig): Use toThisString.
+ (KJS::stringProtoFuncSmall): Ditto.
+ (KJS::stringProtoFuncBlink): Ditto.
+ (KJS::stringProtoFuncBold): Ditto.
+ (KJS::stringProtoFuncFixed): Ditto.
+ (KJS::stringProtoFuncItalics): Ditto.
+ (KJS::stringProtoFuncStrike): Ditto.
+ (KJS::stringProtoFuncSub): Ditto.
+ (KJS::stringProtoFuncSup): Ditto.
+ (KJS::stringProtoFuncFontcolor): Ditto.
+ (KJS::stringProtoFuncFontsize): Ditto.
+ (KJS::stringProtoFuncAnchor): Ditto.
+ (KJS::stringProtoFuncLink): Ditto.
+
+ * kjs/string_object.h: Added toString, toThisString, and toThisJSString.
+
+ * kjs/ustring.cpp:
+ (KJS::UString::append): Added a version that takes a character pointer and
+ size, so we don't have to create a UString just to append to another UString.
+ * kjs/ustring.h:
+
+2008-06-26 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Maciej.
+
+ Make JSGlobalData per-thread.
+
+ No change on SunSpider total.
+
+ * wtf/ThreadSpecific.h: Re-enabled the actual implementation.
+
+ * kjs/JSGlobalObject.cpp:
+ (KJS::JSGlobalObject::~JSGlobalObject): Re-added a JSLock-related assertion. We'll probably
+ want to preserve these somehow to keep legacy behavior in working condition.
+ (KJS::JSGlobalObject::init): Initialize globalData pointer earlier, so that it is ready
+ when updating JSGlobalObject linked list.
+
+ * kjs/JSGlobalObject.h: (KJS::JSGlobalObject::head): Changed head() to be non-static, and
+ to use JSGlobalData associated with the current object.
+
+ * kjs/InitializeThreading.cpp: (KJS::initializeThreadingOnce): Removed a no longer needed
+ Heap::registerAsMainThread() call.
+
+ * kjs/JSGlobalData.h: Removed a lying lie comment - parserObjectExtraRefCounts is not
+ transient, and while newParserObjects may conceptually be such, there is still some node
+ manipulation going on outside Parser::parse which touches it.
+
+ * kjs/JSGlobalData.cpp:
+ (KJS::JSGlobalData::~JSGlobalData): Delete recently added members.
+ (KJS::JSGlobalData::sharedInstance): Actually use a separate instance.
+
+ * kjs/collector.cpp:
+ (KJS::Heap::Heap):
+ (KJS::Heap::~Heap): Added a destructor, which unconditionally deletes everything.
+ (KJS::Heap::sweep): Removed code related to "collect on main thread only" logic.
+ (KJS::Heap::collect): Ditto.
+ (KJS::Heap::globalObjectCount): Explicitly use per-thread instance of JSGlobalObject linked
+ list now that JSGlobalObject::head() is not static. Curently, WebCoreStatistics methods only
+ work with the main thread currently anyway.
+ (KJS::Heap::protectedGlobalObjectCount): Ditto.
+
+ * kjs/collector.h: Removed code related to "collect on main thread only" logic.
+
+ * JavaScriptCore.exp: Removed Heap::collectOnMainThreadOnly.
+
+2008-06-26 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Darin.
+
+ https://bugs.webkit.org/show_bug.cgi?id=19767
+ REGRESSION: Crash in sort() when visiting http://www.onnyturf.com/subway/
+
+ * kjs/JSArray.cpp: (KJS::AVLTreeAbstractorForArrayCompare::set_balance_factor):
+ Made changing balance factor from -1 to +1 work correctly.
+
+ * wtf/AVLTree.h: (KJS::AVLTreeDefaultBSet::operator[]): Added an assertion that catches
+ this slightly earlier.
+
+2008-06-25 Timothy Hatcher <timothy@apple.com>
+
+ Fixes an ASSERT in the profiler when starting multiple profiles
+ with the same name inside the same function/program.
+
+ Reviewed by Kevin McCullough.
+
+ * profiler/Profile.cpp:
+ (KJS::Profile::Profile): Initialize m_stoppedCallDepth to zero.
+ (KJS::Profile::stopProfiling): Set the current node to the parent,
+ because we are in a call that will not get a didExecute call.
+ (KJS::Profile::removeProfile): Increment m_stoppedCallDepth to
+ account for didExecute not being called for profile.
+ (KJS::Profile::willExecute): Increment m_stoppedCallDepth if stopped.
+ (KJS::Profile::didExecute): Decrement m_stoppedCallDepth if stopped and
+ greater than zero, and return early.
+ * profiler/Profile.h: Added stoppedProfiling().
+ * profiler/Profiler.cpp:
+ (KJS::Profiler::findProfile): Removed.
+ (KJS::Profiler::startProfiling): Don't return early for stopped profiles.
+ (KJS::Profiler::stopProfiling): Skipp stopped profiles.
+ (KJS::Profiler::didFinishAllExecution): Code clean-up.
+ * profiler/Profiler.h: Removed findProfile.
+
+2008-06-25 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Attempt to fix Windows debug build. The compiler gives a warning when
+ Structured Exception Handling and destructors are used in the same
+ function. Using manual locking and unlocking instead of constructors
+ and destructors should fix the warning.
+
+ * kjs/Shell.cpp:
+ (main):
+
+2008-06-25 Alexey Proskuryakov <ap@webkit.org>
+
+ Forgot to address a review comment about better names for tracked objects, doing it now.
+
+ * kjs/JSGlobalData.cpp:
+ (KJS::JSGlobalData::JSGlobalData):
+ * kjs/JSGlobalData.h:
+ * kjs/nodes.cpp:
+ (KJS::ParserRefCounted::ParserRefCounted):
+ (KJS::ParserRefCounted::ref):
+ (KJS::ParserRefCounted::deref):
+ (KJS::ParserRefCounted::hasOneRef):
+ (KJS::ParserRefCounted::deleteNewObjects):
+
+2008-06-25 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Geoff.
+
+ Remove more threadInstance() calls.
+
+ * kjs/JSFunction.cpp:
+ (KJS::JSFunction::getParameterName):
+ (KJS::IndexToNameMap::unMap):
+ (KJS::Arguments::deleteProperty):
+ * kjs/JSFunction.h:
+ Access nullIdentifier without going to thread specific storage.
+
+ * JavaScriptCore.exp:
+ * kjs/JSGlobalData.cpp:
+ (KJS::JSGlobalData::JSGlobalData):
+ * kjs/JSGlobalData.h:
+ * kjs/Parser.cpp:
+ (KJS::Parser::parse):
+ * kjs/Parser.h:
+ (KJS::ParserRefCountedData::ParserRefCountedData):
+ (KJS::Parser::parse):
+ * kjs/grammar.y:
+ * kjs/nodes.cpp:
+ (KJS::ParserRefCounted::ParserRefCounted):
+ (KJS::ParserRefCounted::ref):
+ (KJS::ParserRefCounted::deref):
+ (KJS::ParserRefCounted::hasOneRef):
+ (KJS::ParserRefCounted::deleteNewObjects):
+ (KJS::Node::Node):
+ (KJS::StatementNode::StatementNode):
+ (KJS::BreakpointCheckStatement::BreakpointCheckStatement):
+ (KJS::ConstDeclNode::ConstDeclNode):
+ (KJS::BlockNode::BlockNode):
+ (KJS::ForInNode::ForInNode):
+ (KJS::ScopeNode::ScopeNode):
+ (KJS::ProgramNode::ProgramNode):
+ (KJS::ProgramNode::create):
+ (KJS::EvalNode::EvalNode):
+ (KJS::EvalNode::create):
+ (KJS::FunctionBodyNode::FunctionBodyNode):
+ (KJS::FunctionBodyNode::create):
+ * kjs/nodes.h:
+ (KJS::ExpressionNode::):
+ (KJS::NullNode::):
+ (KJS::BooleanNode::):
+ (KJS::NumberNode::):
+ (KJS::ImmediateNumberNode::):
+ (KJS::StringNode::):
+ (KJS::RegExpNode::):
+ (KJS::ThisNode::):
+ (KJS::ResolveNode::):
+ (KJS::ElementNode::):
+ (KJS::ArrayNode::):
+ (KJS::PropertyNode::):
+ (KJS::PropertyListNode::):
+ (KJS::ObjectLiteralNode::):
+ (KJS::BracketAccessorNode::):
+ (KJS::DotAccessorNode::):
+ (KJS::ArgumentListNode::):
+ (KJS::ArgumentsNode::):
+ (KJS::NewExprNode::):
+ (KJS::EvalFunctionCallNode::):
+ (KJS::FunctionCallValueNode::):
+ (KJS::FunctionCallResolveNode::):
+ (KJS::FunctionCallBracketNode::):
+ (KJS::FunctionCallDotNode::):
+ (KJS::PrePostResolveNode::):
+ (KJS::PostIncResolveNode::):
+ (KJS::PostDecResolveNode::):
+ (KJS::PostfixBracketNode::):
+ (KJS::PostIncBracketNode::):
+ (KJS::PostDecBracketNode::):
+ (KJS::PostfixDotNode::):
+ (KJS::PostIncDotNode::):
+ (KJS::PostDecDotNode::):
+ (KJS::PostfixErrorNode::):
+ (KJS::DeleteResolveNode::):
+ (KJS::DeleteBracketNode::):
+ (KJS::DeleteDotNode::):
+ (KJS::DeleteValueNode::):
+ (KJS::VoidNode::):
+ (KJS::TypeOfResolveNode::):
+ (KJS::TypeOfValueNode::):
+ (KJS::PreIncResolveNode::):
+ (KJS::PreDecResolveNode::):
+ (KJS::PrefixBracketNode::):
+ (KJS::PreIncBracketNode::):
+ (KJS::PreDecBracketNode::):
+ (KJS::PrefixDotNode::):
+ (KJS::PreIncDotNode::):
+ (KJS::PreDecDotNode::):
+ (KJS::PrefixErrorNode::):
+ (KJS::UnaryOpNode::UnaryOpNode):
+ (KJS::UnaryPlusNode::):
+ (KJS::NegateNode::):
+ (KJS::BitwiseNotNode::):
+ (KJS::LogicalNotNode::):
+ (KJS::BinaryOpNode::BinaryOpNode):
+ (KJS::ReverseBinaryOpNode::ReverseBinaryOpNode):
+ (KJS::MultNode::):
+ (KJS::DivNode::):
+ (KJS::ModNode::):
+ (KJS::AddNode::):
+ (KJS::SubNode::):
+ (KJS::LeftShiftNode::):
+ (KJS::RightShiftNode::):
+ (KJS::UnsignedRightShiftNode::):
+ (KJS::LessNode::):
+ (KJS::GreaterNode::):
+ (KJS::LessEqNode::):
+ (KJS::GreaterEqNode::):
+ (KJS::InstanceOfNode::):
+ (KJS::InNode::):
+ (KJS::EqualNode::):
+ (KJS::NotEqualNode::):
+ (KJS::StrictEqualNode::):
+ (KJS::NotStrictEqualNode::):
+ (KJS::BitAndNode::):
+ (KJS::BitOrNode::):
+ (KJS::BitXOrNode::):
+ (KJS::LogicalAndNode::):
+ (KJS::LogicalOrNode::):
+ (KJS::ConditionalNode::):
+ (KJS::ReadModifyResolveNode::):
+ (KJS::AssignResolveNode::):
+ (KJS::ReadModifyBracketNode::):
+ (KJS::AssignBracketNode::):
+ (KJS::AssignDotNode::):
+ (KJS::ReadModifyDotNode::):
+ (KJS::AssignErrorNode::):
+ (KJS::CommaNode::):
+ (KJS::VarDeclCommaNode::):
+ (KJS::ConstStatementNode::):
+ (KJS::SourceElements::SourceElements):
+ (KJS::EmptyStatementNode::):
+ (KJS::DebuggerStatementNode::):
+ (KJS::ExprStatementNode::):
+ (KJS::VarStatementNode::):
+ (KJS::IfNode::):
+ (KJS::IfElseNode::):
+ (KJS::DoWhileNode::):
+ (KJS::WhileNode::):
+ (KJS::ForNode::):
+ (KJS::ContinueNode::):
+ (KJS::BreakNode::):
+ (KJS::ReturnNode::):
+ (KJS::WithNode::):
+ (KJS::LabelNode::):
+ (KJS::ThrowNode::):
+ (KJS::TryNode::):
+ (KJS::ParameterNode::):
+ (KJS::FuncExprNode::):
+ (KJS::FuncDeclNode::):
+ (KJS::CaseClauseNode::):
+ (KJS::ClauseListNode::):
+ (KJS::CaseBlockNode::):
+ (KJS::SwitchNode::):
+ Changed ParserRefCounted to hold a JSGlobalData pointer, and used it to replace
+ threadInstance calls.
+
+2008-06-24 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Make the JavaScript shell collect the heap from main() instead of
+ jscmain() to suppress leak messages in debug builds.
+
+ * kjs/Shell.cpp:
+ (main):
+ (jscmain):
+
+2008-06-24 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Maciej.
+
+ Make the conversion of the pair (less, jtrue) to jless use register
+ reference counting information for safety instead of requiring callers
+ to decide whether it is safe.
+
+ No changes on SunSpider codegen.
+
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::emitJumpIfTrue):
+ * VM/CodeGenerator.h:
+ * kjs/nodes.cpp:
+ (KJS::DoWhileNode::emitCode):
+ (KJS::WhileNode::emitCode):
+ (KJS::ForNode::emitCode):
+ (KJS::CaseBlockNode::emitCodeForBlock):
+
+2008-06-24 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Tim.
+
+ <rdar://problem/6031594> JSProfiler: Profiler goes into an infinite
+ loop sometimes.
+ <rdar://problem/6031603> JSProfiler: Profiler asserts in debug and
+ give the wrong times in release
+
+ Fixed two issues found by Tim in the same test.
+
+ * profiler/Profile.cpp:
+ (KJS::Profile::removeProfileStart): No longer take profile's time from
+ all ancestors, but instead attribute it to its parent. Also add an
+ Assert to ensure we only delete the child we mean to.
+ (KJS::Profile::removeProfileEnd): Ditto for profileEnd.
+ (KJS::Profile::didExecute): Cleaned up the execution order and correctly
+ attribute all of the parent's time to the new node.
+ * profiler/ProfileNode.cpp: If this node does not have a startTime it
+ should not get a giant total time, but instead be 0.
+ (KJS::ProfileNode::endAndRecordCall):
+ * profiler/ProfileNode.h:
+ (KJS::ProfileNode::removeChild): Should reset the sibling pointers since
+ one of them has been removed.
+
+2008-06-24 Darin Adler <darin@apple.com>
+
+ Reviewed by Cameron.
+
+ - fix https://bugs.webkit.org/show_bug.cgi?id=19739
+ REGRESSION: fast/js/property-getters-and-setters.html fails
+
+ * kjs/JSObject.cpp:
+ (KJS::JSObject::put): Remove an untested optimization I checked in by accident.
+ The two loops up the prototype chain both need to start from this; instead the
+ second loop was starting where the first loop left off.
+
+2008-06-24 Steve Falkenburg <sfalken@apple.com>
+
+ Build fix.
+
+ * kjs/nodes.cpp:
+
+2008-06-24 Joerg Bornemann <joerg.bornemann@trolltech.com>
+
+ Reviewed by Simon.
+
+ For the Qt build on Windows don't depend on the presence of GNU CPP
+ but use MSVC's preprocessor instead.
+ dftables accepts a --preprocessor option which is set in pcre.pri for MSVC platforms.
+
+ * pcre/dftables: Added support for specifying the preprocessor command
+ to use via --preprocessor, similar to
+ WebCore/bindings/scripts/generate-bindings.pl.
+ * pcre/pcre.pri: Pass --preprocessor='cl /e' to dftables, or more
+ generally speaking QMAKE_CC /E for the win32-msvc buildspecs.
+
+2008-06-24 Simon Hausmann <hausmann@webkit.org>
+
+ Fix the Qt build, added missing include.
+
+ * kjs/PropertySlot.cpp:
+
+2008-06-24 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Cameron Zwarich.
+
+ Make ParserRefCountedCounter actually perform a leak check.
+
+ * kjs/nodes.cpp:
+ (KJS::ParserRefCountedCounter::~ParserRefCountedCounter): Check for leaks in destructor,
+ not in constructor.
+ (KJS::ParserRefCountedCounter::increment):
+ (KJS::ParserRefCountedCounter::decrement):
+ (KJS::ParserRefCounted::ParserRefCounted):
+ (KJS::ParserRefCounted::~ParserRefCounted):
+ While at it, also made counting thread-safe.
+
+2008-06-24 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Oliver.
+
+ Bug 19730: REGRESSION (r34497): Text in alerts in "Leisure suit Larry" is not wrapped
+ <https://bugs.webkit.org/show_bug.cgi?id=19730>
+
+ Do not convert the pair (less, jtrue) to jless when jtrue is a jump
+ target. An example of this is when the condition of a while loop is a
+ LogicalOrNode.
+
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::emitLabel):
+
+2008-06-20 Ariya Hidayat <ariya.hidayat@trolltech.com>
+
+ Reviewed by Adam Roben.
+
+ Fix compile with MinGW.
+
+ * kjs/Shell.cpp:
+ * wtf/Threading.h:
+ (WTF::atomicIncrement):
+ (WTF::atomicDecrement):
+
+2008-06-23 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Prepration for returning memory to the OS on Windows. Track whether a portion of a span of memory was returned to the OS.
+ If it was, ask that it be recommitted before returning it to the application as an allocated region.
+
+ * wtf/FastMalloc.cpp:
+ (WTF::TCMalloc_PageHeap::New): If the span was decommitted, ask that it be recommitted before returning it.
+ (WTF::TCMalloc_PageHeap::AllocLarge): Ditto.
+ (WTF::TCMalloc_PageHeap::Carve): When splitting a span, ensure that the decommitted state propogates to the two new spans.
+ (WTF::TCMalloc_PageHeap::Delete): When merging a span, ensure that the resulting span is marked as decommitted if any of the
+ spans being merged were marked as decommitted.
+ (WTF::TCMalloc_PageHeap::IncrementalScavenge): Mark as decommitted after releasing the span.
+ (WTF::TCMalloc_Central_FreeList::FetchFromSpans): Add an assertion to catch a decommitted span being returned to the application
+ without first being recommitted.
+ (WTF::TCMalloc_Central_FreeList::Populate): Ditto.
+ * wtf/TCSystemAlloc.cpp: Stub out TCMalloc_SystemCommit.
+ * wtf/TCSystemAlloc.h:
+
+2008-06-23 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Remove the sample member of Span when NO_TCMALLOC_SAMPLES is defined.
+
+ * wtf/FastMalloc.cpp:
+ (WTF::TCMalloc_PageHeap::Delete): Only update Span::sample if NO_TCMALLOC_SAMPLES is not defined.
+ (WTF::TCMallocStats::do_free): Ditto.
+
+2008-06-23 Darin Adler <darin@apple.com>
+
+ Reviewed by Geoff.
+
+ - work toward https://bugs.webkit.org/show_bug.cgi?id=19721
+
+ More preparation toward making functions work on primitive types without
+ creating wrapper objects. No speedup this time, but prepares for a future
+ speedup without slowing things down.
+
+ SunSpider reports no change.
+
+ - Eliminated the implementsCall, callAsFunction and construct virtual
+ functions from JSObject. Instead, the CallData and ConstructData for
+ a native function includes a function pointer that the caller can use
+ directly. Changed all call sites to use CallData and ConstructData.
+
+ - Changed the "this" argument to native functions to be a JSValue rather
+ than a JSObject. This prepares us for passing primitives into these
+ functions. The conversion to an object now must be done inside the
+ function. Critically, if it's a function that can be called on a DOM
+ window object, then we have to be sure to call toThisObject on the
+ argument before we use it for anything even if it's already an object.
+
+ - Eliminated the practice of using constructor objects in the global
+ object to make objects of the various basic types. Since these
+ constructors can't be replaced by script, there's no reason to involve
+ a constructor object at all. Added functions to do the construction
+ directly.
+
+ - Made some more class members private and protected, including virtual
+ function overrides. This can catch code using unnecessarily slow virtual
+ function code paths when the type of an object is known statically. If we
+ later find a new reason use the members outside the class it's easy to
+ make them public again.
+
+ - Moved the declarations of the native implementations for functions out
+ of header files. These can have internal linkage and be declared inside
+ the source file.
+
+ - Changed PrototypeFunction to take function pointers with the right
+ arguments to be put directly into CallData. This eliminates the
+ need to have a separate PrototypeReflexiveFunction, and reveals that the
+ real purpose of that class included something else specific to eval --
+ storage of a cached global object. So renamed PrototypeReflexiveFunction
+ to GlobalEvalFunction.
+
+ * API/JSCallbackConstructor.cpp:
+ (KJS::constructJSCallback):
+ (KJS::JSCallbackConstructor::getConstructData):
+ * API/JSCallbackConstructor.h:
+ * API/JSCallbackFunction.cpp:
+ (KJS::JSCallbackFunction::implementsHasInstance):
+ (KJS::JSCallbackFunction::call):
+ (KJS::JSCallbackFunction::getCallData):
+ * API/JSCallbackFunction.h:
+ (KJS::JSCallbackFunction::classInfo):
+ * API/JSCallbackObject.h:
+ (KJS::JSCallbackObject::classRef):
+ (KJS::JSCallbackObject::classInfo):
+ * API/JSCallbackObjectFunctions.h:
+ (KJS::::getConstructData):
+ (KJS::::construct):
+ (KJS::::getCallData):
+ (KJS::::call):
+ * API/JSObjectRef.cpp:
+ (JSObjectMakeFunction):
+ (JSObjectIsFunction):
+ (JSObjectCallAsFunction):
+ (JSObjectCallAsConstructor):
+ * JavaScriptCore.exp:
+ * VM/Machine.cpp:
+ (KJS::jsTypeStringForValue):
+ (KJS::Machine::privateExecute):
+ * kjs/ArrayPrototype.cpp:
+ (KJS::arrayProtoFuncToString):
+ (KJS::arrayProtoFuncToLocaleString):
+ (KJS::arrayProtoFuncJoin):
+ (KJS::arrayProtoFuncConcat):
+ (KJS::arrayProtoFuncPop):
+ (KJS::arrayProtoFuncPush):
+ (KJS::arrayProtoFuncReverse):
+ (KJS::arrayProtoFuncShift):
+ (KJS::arrayProtoFuncSlice):
+ (KJS::arrayProtoFuncSort):
+ (KJS::arrayProtoFuncSplice):
+ (KJS::arrayProtoFuncUnShift):
+ (KJS::arrayProtoFuncFilter):
+ (KJS::arrayProtoFuncMap):
+ (KJS::arrayProtoFuncEvery):
+ (KJS::arrayProtoFuncForEach):
+ (KJS::arrayProtoFuncSome):
+ (KJS::arrayProtoFuncIndexOf):
+ (KJS::arrayProtoFuncLastIndexOf):
+ (KJS::ArrayConstructor::ArrayConstructor):
+ (KJS::constructArrayWithSizeQuirk):
+ (KJS::constructWithArrayConstructor):
+ (KJS::ArrayConstructor::getConstructData):
+ (KJS::callArrayConstructor):
+ (KJS::ArrayConstructor::getCallData):
+ * kjs/ArrayPrototype.h:
+ * kjs/BooleanObject.cpp:
+ (KJS::booleanProtoFuncToString):
+ (KJS::booleanProtoFuncValueOf):
+ (KJS::constructBoolean):
+ (KJS::constructWithBooleanConstructor):
+ (KJS::BooleanConstructor::getConstructData):
+ (KJS::callBooleanConstructor):
+ (KJS::BooleanConstructor::getCallData):
+ (KJS::constructBooleanFromImmediateBoolean):
+ * kjs/BooleanObject.h:
+ * kjs/CallData.h:
+ (KJS::):
+ * kjs/ConstructData.h:
+ (KJS::):
+ * kjs/FunctionPrototype.cpp:
+ (KJS::callFunctionPrototype):
+ (KJS::FunctionPrototype::getCallData):
+ (KJS::functionProtoFuncToString):
+ (KJS::functionProtoFuncApply):
+ (KJS::functionProtoFuncCall):
+ (KJS::constructWithFunctionConstructor):
+ (KJS::FunctionConstructor::getConstructData):
+ (KJS::callFunctionConstructor):
+ (KJS::FunctionConstructor::getCallData):
+ (KJS::constructFunction):
+ * kjs/FunctionPrototype.h:
+ * kjs/JSArray.cpp:
+ (KJS::AVLTreeAbstractorForArrayCompare::compare_key_key):
+ (KJS::JSArray::sort):
+ (KJS::constructEmptyArray):
+ (KJS::constructArray):
+ * kjs/JSArray.h:
+ (KJS::JSArray::classInfo):
+ * kjs/JSFunction.cpp:
+ (KJS::JSFunction::call):
+ (KJS::globalFuncEval):
+ (KJS::globalFuncParseInt):
+ (KJS::globalFuncParseFloat):
+ (KJS::globalFuncIsNaN):
+ (KJS::globalFuncIsFinite):
+ (KJS::globalFuncDecodeURI):
+ (KJS::globalFuncDecodeURIComponent):
+ (KJS::globalFuncEncodeURI):
+ (KJS::globalFuncEncodeURIComponent):
+ (KJS::globalFuncEscape):
+ (KJS::globalFuncUnescape):
+ (KJS::globalFuncKJSPrint):
+ (KJS::PrototypeFunction::PrototypeFunction):
+ (KJS::PrototypeFunction::getCallData):
+ (KJS::GlobalEvalFunction::GlobalEvalFunction):
+ (KJS::GlobalEvalFunction::mark):
+ * kjs/JSFunction.h:
+ (KJS::InternalFunction::classInfo):
+ (KJS::InternalFunction::functionName):
+ (KJS::JSFunction::classInfo):
+ (KJS::GlobalEvalFunction::cachedGlobalObject):
+ * kjs/JSGlobalObject.cpp:
+ (KJS::JSGlobalObject::reset):
+ (KJS::JSGlobalObject::mark):
+ * kjs/JSGlobalObject.h:
+ (KJS::JSGlobalObject::JSGlobalObject):
+ (KJS::JSGlobalObject::evalFunction):
+ * kjs/JSImmediate.cpp:
+ (KJS::JSImmediate::toObject):
+ * kjs/JSNotAnObject.cpp:
+ * kjs/JSNotAnObject.h:
+ * kjs/JSObject.cpp:
+ (KJS::JSObject::put):
+ (KJS::callDefaultValueFunction):
+ (KJS::JSObject::defaultValue):
+ (KJS::JSObject::lookupGetter):
+ (KJS::JSObject::lookupSetter):
+ (KJS::JSObject::hasInstance):
+ (KJS::JSObject::fillGetterPropertySlot):
+ (KJS::Error::create):
+ (KJS::constructEmptyObject):
+ * kjs/JSObject.h:
+ (KJS::GetterSetter::GetterSetter):
+ (KJS::GetterSetter::getter):
+ (KJS::GetterSetter::setGetter):
+ (KJS::GetterSetter::setter):
+ (KJS::GetterSetter::setSetter):
+ * kjs/JSValue.cpp:
+ (KJS::JSCell::deleteProperty):
+ (KJS::call):
+ (KJS::construct):
+ * kjs/JSValue.h:
+ * kjs/MathObject.cpp:
+ (KJS::mathProtoFuncAbs):
+ (KJS::mathProtoFuncACos):
+ (KJS::mathProtoFuncASin):
+ (KJS::mathProtoFuncATan):
+ (KJS::mathProtoFuncATan2):
+ (KJS::mathProtoFuncCeil):
+ (KJS::mathProtoFuncCos):
+ (KJS::mathProtoFuncExp):
+ (KJS::mathProtoFuncFloor):
+ (KJS::mathProtoFuncLog):
+ (KJS::mathProtoFuncMax):
+ (KJS::mathProtoFuncMin):
+ (KJS::mathProtoFuncPow):
+ (KJS::mathProtoFuncRandom):
+ (KJS::mathProtoFuncRound):
+ (KJS::mathProtoFuncSin):
+ (KJS::mathProtoFuncSqrt):
+ (KJS::mathProtoFuncTan):
+ * kjs/MathObject.h:
+ * kjs/NumberObject.cpp:
+ (KJS::numberProtoFuncToString):
+ (KJS::numberProtoFuncToLocaleString):
+ (KJS::numberProtoFuncValueOf):
+ (KJS::numberProtoFuncToFixed):
+ (KJS::numberProtoFuncToExponential):
+ (KJS::numberProtoFuncToPrecision):
+ (KJS::NumberConstructor::NumberConstructor):
+ (KJS::constructWithNumberConstructor):
+ (KJS::NumberConstructor::getConstructData):
+ (KJS::callNumberConstructor):
+ (KJS::NumberConstructor::getCallData):
+ (KJS::constructNumber):
+ (KJS::constructNumberFromImmediateNumber):
+ * kjs/NumberObject.h:
+ (KJS::NumberObject::classInfo):
+ (KJS::NumberConstructor::classInfo):
+ * kjs/PropertySlot.cpp:
+ (KJS::PropertySlot::functionGetter):
+ * kjs/RegExpObject.cpp:
+ (KJS::regExpProtoFuncTest):
+ (KJS::regExpProtoFuncExec):
+ (KJS::regExpProtoFuncCompile):
+ (KJS::regExpProtoFuncToString):
+ (KJS::callRegExpObject):
+ (KJS::RegExpObject::getCallData):
+ (KJS::constructRegExp):
+ (KJS::constructWithRegExpConstructor):
+ (KJS::RegExpConstructor::getConstructData):
+ (KJS::callRegExpConstructor):
+ (KJS::RegExpConstructor::getCallData):
+ * kjs/RegExpObject.h:
+ (KJS::RegExpConstructor::classInfo):
+ * kjs/Shell.cpp:
+ (GlobalObject::GlobalObject):
+ (functionPrint):
+ (functionDebug):
+ (functionGC):
+ (functionVersion):
+ (functionRun):
+ (functionLoad):
+ (functionReadline):
+ (functionQuit):
+ * kjs/date_object.cpp:
+ (KJS::gmtoffset):
+ (KJS::formatLocaleDate):
+ (KJS::fillStructuresUsingDateArgs):
+ (KJS::DateInstance::getTime):
+ (KJS::DateInstance::getUTCTime):
+ (KJS::DateConstructor::DateConstructor):
+ (KJS::constructDate):
+ (KJS::DateConstructor::getConstructData):
+ (KJS::callDate):
+ (KJS::DateConstructor::getCallData):
+ (KJS::dateParse):
+ (KJS::dateNow):
+ (KJS::dateUTC):
+ (KJS::dateProtoFuncToString):
+ (KJS::dateProtoFuncToUTCString):
+ (KJS::dateProtoFuncToDateString):
+ (KJS::dateProtoFuncToTimeString):
+ (KJS::dateProtoFuncToLocaleString):
+ (KJS::dateProtoFuncToLocaleDateString):
+ (KJS::dateProtoFuncToLocaleTimeString):
+ (KJS::dateProtoFuncValueOf):
+ (KJS::dateProtoFuncGetTime):
+ (KJS::dateProtoFuncGetFullYear):
+ (KJS::dateProtoFuncGetUTCFullYear):
+ (KJS::dateProtoFuncToGMTString):
+ (KJS::dateProtoFuncGetMonth):
+ (KJS::dateProtoFuncGetUTCMonth):
+ (KJS::dateProtoFuncGetDate):
+ (KJS::dateProtoFuncGetUTCDate):
+ (KJS::dateProtoFuncGetDay):
+ (KJS::dateProtoFuncGetUTCDay):
+ (KJS::dateProtoFuncGetHours):
+ (KJS::dateProtoFuncGetUTCHours):
+ (KJS::dateProtoFuncGetMinutes):
+ (KJS::dateProtoFuncGetUTCMinutes):
+ (KJS::dateProtoFuncGetSeconds):
+ (KJS::dateProtoFuncGetUTCSeconds):
+ (KJS::dateProtoFuncGetMilliSeconds):
+ (KJS::dateProtoFuncGetUTCMilliseconds):
+ (KJS::dateProtoFuncGetTimezoneOffset):
+ (KJS::dateProtoFuncSetTime):
+ (KJS::setNewValueFromTimeArgs):
+ (KJS::setNewValueFromDateArgs):
+ (KJS::dateProtoFuncSetMilliSeconds):
+ (KJS::dateProtoFuncSetUTCMilliseconds):
+ (KJS::dateProtoFuncSetSeconds):
+ (KJS::dateProtoFuncSetUTCSeconds):
+ (KJS::dateProtoFuncSetMinutes):
+ (KJS::dateProtoFuncSetUTCMinutes):
+ (KJS::dateProtoFuncSetHours):
+ (KJS::dateProtoFuncSetUTCHours):
+ (KJS::dateProtoFuncSetDate):
+ (KJS::dateProtoFuncSetUTCDate):
+ (KJS::dateProtoFuncSetMonth):
+ (KJS::dateProtoFuncSetUTCMonth):
+ (KJS::dateProtoFuncSetFullYear):
+ (KJS::dateProtoFuncSetUTCFullYear):
+ (KJS::dateProtoFuncSetYear):
+ (KJS::dateProtoFuncGetYear):
+ * kjs/date_object.h:
+ (KJS::DateInstance::internalNumber):
+ (KJS::DateInstance::classInfo):
+ * kjs/error_object.cpp:
+ (KJS::errorProtoFuncToString):
+ (KJS::constructError):
+ (KJS::constructWithErrorConstructor):
+ (KJS::ErrorConstructor::getConstructData):
+ (KJS::callErrorConstructor):
+ (KJS::ErrorConstructor::getCallData):
+ (KJS::NativeErrorConstructor::construct):
+ (KJS::constructWithNativeErrorConstructor):
+ (KJS::NativeErrorConstructor::getConstructData):
+ (KJS::callNativeErrorConstructor):
+ (KJS::NativeErrorConstructor::getCallData):
+ * kjs/error_object.h:
+ (KJS::NativeErrorConstructor::classInfo):
+ * kjs/internal.cpp:
+ (KJS::JSNumberCell::toObject):
+ (KJS::JSNumberCell::toThisObject):
+ (KJS::GetterSetter::mark):
+ (KJS::GetterSetter::toPrimitive):
+ (KJS::GetterSetter::toBoolean):
+ (KJS::GetterSetter::toNumber):
+ (KJS::GetterSetter::toString):
+ (KJS::GetterSetter::toObject):
+ (KJS::InternalFunction::InternalFunction):
+ (KJS::InternalFunction::implementsHasInstance):
+ * kjs/lookup.h:
+ (KJS::HashEntry::):
+ * kjs/nodes.cpp:
+ (KJS::FuncDeclNode::makeFunction):
+ (KJS::FuncExprNode::makeFunction):
+ * kjs/object_object.cpp:
+ (KJS::objectProtoFuncValueOf):
+ (KJS::objectProtoFuncHasOwnProperty):
+ (KJS::objectProtoFuncIsPrototypeOf):
+ (KJS::objectProtoFuncDefineGetter):
+ (KJS::objectProtoFuncDefineSetter):
+ (KJS::objectProtoFuncLookupGetter):
+ (KJS::objectProtoFuncLookupSetter):
+ (KJS::objectProtoFuncPropertyIsEnumerable):
+ (KJS::objectProtoFuncToLocaleString):
+ (KJS::objectProtoFuncToString):
+ (KJS::ObjectConstructor::ObjectConstructor):
+ (KJS::constructObject):
+ (KJS::constructWithObjectConstructor):
+ (KJS::ObjectConstructor::getConstructData):
+ (KJS::callObjectConstructor):
+ (KJS::ObjectConstructor::getCallData):
+ * kjs/object_object.h:
+ * kjs/string_object.cpp:
+ (KJS::replace):
+ (KJS::stringProtoFuncToString):
+ (KJS::stringProtoFuncValueOf):
+ (KJS::stringProtoFuncCharAt):
+ (KJS::stringProtoFuncCharCodeAt):
+ (KJS::stringProtoFuncConcat):
+ (KJS::stringProtoFuncIndexOf):
+ (KJS::stringProtoFuncLastIndexOf):
+ (KJS::stringProtoFuncMatch):
+ (KJS::stringProtoFuncSearch):
+ (KJS::stringProtoFuncReplace):
+ (KJS::stringProtoFuncSlice):
+ (KJS::stringProtoFuncSplit):
+ (KJS::stringProtoFuncSubstr):
+ (KJS::stringProtoFuncSubstring):
+ (KJS::stringProtoFuncToLowerCase):
+ (KJS::stringProtoFuncToUpperCase):
+ (KJS::stringProtoFuncToLocaleLowerCase):
+ (KJS::stringProtoFuncToLocaleUpperCase):
+ (KJS::stringProtoFuncLocaleCompare):
+ (KJS::stringProtoFuncBig):
+ (KJS::stringProtoFuncSmall):
+ (KJS::stringProtoFuncBlink):
+ (KJS::stringProtoFuncBold):
+ (KJS::stringProtoFuncFixed):
+ (KJS::stringProtoFuncItalics):
+ (KJS::stringProtoFuncStrike):
+ (KJS::stringProtoFuncSub):
+ (KJS::stringProtoFuncSup):
+ (KJS::stringProtoFuncFontcolor):
+ (KJS::stringProtoFuncFontsize):
+ (KJS::stringProtoFuncAnchor):
+ (KJS::stringProtoFuncLink):
+ (KJS::stringFromCharCode):
+ (KJS::StringConstructor::StringConstructor):
+ (KJS::constructWithStringConstructor):
+ (KJS::StringConstructor::getConstructData):
+ (KJS::callStringConstructor):
+ (KJS::StringConstructor::getCallData):
+ * kjs/string_object.h:
+
+2008-06-23 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Oliver.
+
+ Bug 19716: REGRESSION (SquirrelFish): Reproducible crash after entering a username at mint.com
+ <https://bugs.webkit.org/show_bug.cgi?id=19716>
+
+ When unwinding callframes for exceptions, check whether the callframe
+ was created by a reentrant native call to JavaScript after tearing off
+ the local variables instead of before.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::unwindCallFrame):
+
+2008-06-23 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Get testapi passing again in a debug build.
+
+ * API/testapi.c:
+ (main): Update the expected output of calling JSValueMakeString on a function object.
+
+2008-06-21 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Print a blank line when exiting the jsc interactive mode to ensure that the shell
+ prompt will start on a new line.
+
+ * kjs/Shell.cpp:
+ (runInteractive):
+
+2008-06-21 Mark Rowe <mrowe@apple.com>
+
+ Rubber-stamped by Sam Weinig.
+
+ Tweak the paths of the items in the "tests" group to clean things up a little.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2008-06-21 Mark Rowe <mrowe@apple.com>
+
+ Rubber-stamped by Sam Weinig.
+
+ Fix jsc to link against libedit.dylib rather than libedit.2.dylib.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2008-06-21 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Copy the JavaScriptCore shell (jsc) into JavaScriptCore.framework so that it will
+ be included in nightly builds.
+ https://bugs.webkit.org/show_bug.cgi?id=19691
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2008-06-21 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Mark Rowe.
+
+ Fix the build for non-Mac Darwin platforms by disabling their support
+ for readline in the JavaScript shell.
+
+ * kjs/config.h:
+
+2008-06-20 Timothy Hatcher <timothy@apple.com>
+
+ Use member function pointers for the Profile::forEach function.
+ Eliminating a few static functions and simplified things a little.
+
+ Reviewed by Alexey Proskuryakov.
+
+ * JavaScriptCore.exp: Change the symbol for forEach.
+ * profiler/Profile.cpp:
+ (KJS::Profile::forEach): Use a member function pointer.
+ * profiler/Profile.h:
+ (KJS::Profile::sortTotalTimeDescending): Pass a function pointer.
+ (KJS::Profile::sortTotalTimeAscending): Ditto.
+ (KJS::Profile::sortSelfTimeDescending): Ditto.
+ (KJS::Profile::sortSelfTimeAscending): Ditto.
+ (KJS::Profile::sortCallsDescending): Ditto.
+ * profiler/ProfileNode.h:
+ (KJS::ProfileNode::sortTotalTimeDescending): No longer static.
+ (KJS::ProfileNode::sortTotalTimeAscending): Ditto.
+ (KJS::ProfileNode::sortSelfTimeDescending): Ditto.
+ (KJS::ProfileNode::sortSelfTimeAscending): Ditto.
+ (KJS::ProfileNode::sortCallsDescending): Ditto.
+
+2008-06-20 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Oliver.
+
+ Remove unused destructors.
+
+ * kjs/nodes.cpp:
+ * kjs/nodes.h:
+
+2008-06-20 Timothy Hatcher <timothy@apple.com>
+
+ Fixed an ASSERT(m_actualSelfTime <= m_actualTotalTime) when starting
+ and stopping a profile from the Develop menu. Also prevents
+ inserting an incorrect parent node as the new head after profiling
+ is stopped from the Develop menu.
+
+ Reviewed by Dan Bernstein.
+
+ * profiler/Profile.cpp:
+ (KJS::Profile::stopProfiling): If the current node is already the head
+ then there is no more need to record future nodes in didExecute.
+ (KJS::Profile::didExecute): Move the code of setupCurrentNodeAsStopped
+ into here since this was the only caller. When setting the total time
+ keep any current total time while adding the self time of the head.
+ (KJS::Profile::setupCurrentNodeAsStopped): Removed.
+ * profiler/Profile.h: Removed setupCurrentNodeAsStopped.
+
+2008-06-20 Kevin Ollivier <kevino@theolliviers.com>
+
+ !USE(MULTIPLE_THREADS) on Darwin build fix
+
+ * kjs/InitializeThreading.cpp:
+ (KJS::initializeThreading):
+ * kjs/collector.h:
+
+2008-06-20 Kevin McCullough <kmccullough@apple.com>
+
+ -Leopard Build Fix.
+
+ * profiler/Profile.cpp:
+ (KJS::Profile::removeProfileStart):
+ (KJS::Profile::removeProfileEnd):
+
+2008-06-20 Kevin McCullough <kmccullough@apple.com>
+
+ Just giving credit.
+
+ * ChangeLog:
+
+2008-06-20 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Tim and Dan.
+
+ <rdar://problem/6024846> JSProfiler: ASSERT hit in Profiler.
+ - Because InspectorController can call startProfiling() and
+ stopProfiling() we cannot assert that console.profile() and
+ console.profileEnd() will be in the profile tree.
+
+ * profiler/Profile.cpp:
+ (KJS::Profile::removeProfileStart):
+ (KJS::Profile::removeProfileEnd):
+
+2008-06-20 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Tim.
+
+ <rdar://problem/5958770> JSProfiler: Time incorrectly given to (idle)
+ if profiling is started and finished within the same function. (19230)
+ - Now we profile one more stack frame up from the last frame to allocate
+ the time spent in it, if it exists.
+
+ * JavaScriptCore.exp:
+ * VM/Machine.cpp: We need to let the profiler know when the JS program
+ has finished since that is what will actually stop the profiler instead
+ of just calling stopProfiling().
+ (KJS::Machine::execute):
+ * profiler/Profile.cpp:
+ (KJS::Profile::create): Moved from Profile.h since it was getting pretty
+ long.
+ (KJS::Profile::Profile): We now have a client, which is a listener who
+ we will return this profile to, once it has actually finished.
+ (KJS::Profile::stopProfiling): Instead of fully stopping the profiler
+ here, we set the flag and keep it profiling in the background.
+ (KJS::Profile::didFinishAllExecution): This is where the profiler
+ actually finishes and creates the (idle) node if one should be made.
+ (KJS::Profile::removeProfileStart): Don't use m_currentNode since it is
+ needed by the profiler as it runs silently in the background.
+ (KJS::Profile::removeProfileEnd): Ditto.
+ (KJS::Profile::willExecute): Don't profile new functions if we have
+ stopped profiling.
+ (KJS::Profile::didExecute): Only record one more return as all the
+ remaining time will be attributed to that function.
+ (KJS::Profile::setupCurrentNodeAsStopped): Sets the current node's time.
+ * profiler/Profile.h: Added functions and variables for the above
+ changes.
+ (KJS::Profile::client):
+ * profiler/ProfileNode.h:
+ (KJS::CallIdentifier::toString): Debug method.
+ * profiler/Profiler.cpp: Added support for the ProfilerClient.
+ (KJS::Profiler::startProfiling):
+ (KJS::Profiler::stopProfiling): No longer return sthe profile.
+ (KJS::Profiler::didFinishAllExecution): Now returns the profile to the
+ client instead of stopProfiling.
+ * profiler/Profiler.h:
+ (KJS::ProfilerClient::~ProfilerClient): Clients will implement this
+ interface.
+
+2008-06-19 Ariya Hidayat <ariya.hidayat@trolltech.com>
+
+ Reviewed by Simon.
+
+ Surpress compiler warning (int vs unsigned comparison).
+
+ * wtf/unicode/qt4/UnicodeQt4.h:
+ (WTF::Unicode::toLower):
+
+2008-06-19 Ariya Hidayat <ariya.hidayat@trolltech.com>
+
+ Reviewed by Timothy Hatcher.
+
+ Introduce compiler define for MinGW, to have COMPILER(MINGW).
+
+ * wtf/Platform.h:
+
+2008-06-19 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Geoff.
+
+ Make Machine per-JSGlobalData.
+
+ * VM/CodeBlock.cpp:
+ (KJS::CodeBlock::dump):
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::emitOpcode):
+ * VM/Machine.cpp:
+ (KJS::callEval):
+ (KJS::Machine::unwindCallFrame):
+ (KJS::Machine::throwException):
+ (KJS::Machine::execute):
+ (KJS::Machine::debug):
+ * VM/Machine.h:
+ * kjs/DebuggerCallFrame.cpp:
+ (KJS::DebuggerCallFrame::evaluate):
+ * kjs/DebuggerCallFrame.h:
+ (KJS::DebuggerCallFrame::DebuggerCallFrame):
+ * kjs/ExecState.cpp:
+ (KJS::ExecState::ExecState):
+ * kjs/ExecState.h:
+ (KJS::ExecState::machine):
+ * kjs/JSFunction.cpp:
+ (KJS::JSFunction::callAsFunction):
+ (KJS::JSFunction::argumentsGetter):
+ (KJS::JSFunction::callerGetter):
+ (KJS::JSFunction::construct):
+ (KJS::globalFuncEval):
+ * kjs/JSGlobalData.cpp:
+ (KJS::JSGlobalData::JSGlobalData):
+ * kjs/JSGlobalData.h:
+ * kjs/interpreter.cpp:
+ (KJS::Interpreter::evaluate):
+
+2008-06-19 Alp Toker <alp@nuanti.com>
+
+ GTK+/autotools build fix. JSGlobalObject.cpp in now in
+ AllInOneFile.cpp and shouldn't be built separately.
+
+ * GNUmakefile.am:
+
+2008-06-19 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Darin.
+
+ Get rid of some threadInstance calls.
+
+ * kjs/JSGlobalObject.cpp:
+ (KJS::JSGlobalObject::init):
+ * kjs/Parser.cpp:
+ (KJS::Parser::parse):
+ * kjs/Shell.cpp:
+ (jscmain):
+
+2008-06-19 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Sam.
+
+ Fix an assertion failure at startup.
+
+ * kjs/JSObject.h: (KJS::JSObject::JSObject): Allow jsNull prototype in an assertion (I had
+ it fixed in a wrong copy of the file, so I wasn't getting the failure).
+
+2008-06-19 Alexey Proskuryakov <ap@webkit.org>
+
+ Build fix.
+
+ * kjs/collector.cpp:
+ (KJS::Heap::Heap):
+ (KJS::allocateBlock):
+ * kjs/collector.h:
+ No, #if PLATFORM(UNIX) was not right. I've just moved the unsafe initialization back for now,
+ as the platforms that use that code path do not use multiple threads yet.
+
+2008-06-19 Alexey Proskuryakov <ap@webkit.org>
+
+ Windows and Qt build fixes.
+
+ * kjs/collector.h:
+ * kjs/collector.cpp:
+ (KJS::Heap::Heap):
+ Wrapped m_pagesize in #if PLATFORM(UNIX), which should better match the sequence of #elifs
+ in allocateBlock(). Changed MIN_ARRAY_SIZE to be explicitly size_t, as this type is different
+ on different platforms.
+
+2008-06-17 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Darin.
+
+ Prepare JavaScript heap for being per-thread.
+
+ * kjs/ExecState.h: Shuffle includes, making it possible to include ExecState.h in JSValue.h.
+ (KJS::ExecState::heap): Added an accessor.
+
+ * API/JSBase.cpp: (JSGarbageCollect): Collect both shared and per-thread heaps.
+
+ * API/JSContextRef.cpp: (JSGlobalContextCreate): When allocating JSGlobalObject, indicate
+ that it belongs to a shared heap.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * kjs/AllInOneFile.cpp:
+ Moved JSGlobalObject.cpp to AllInOneFile, as a build fix for inlineAllocate magic.
+
+ * VM/CodeGenerator.h: (KJS::CodeGenerator::globalExec): Added an accessor (working via
+ m_scopeChain).
+
+ * VM/RegisterFile.h:
+ (KJS::RegisterFile::mark):
+ * VM/RegisterFileStack.h:
+ (KJS::RegisterFileStack::mark):
+ Made these pseudo-mark functions take Heap*.
+
+ * kjs/InitializeThreading.cpp:
+ (KJS::initializeThreading): Initialize heap introspector.
+
+ * kjs/JSGlobalData.h: Added Heap to the structure.
+
+ * kjs/JSGlobalData.cpp:
+ (KJS::JSGlobalData::JSGlobalData): Initialize Heap.
+ (KJS::JSGlobalData::sharedInstance): Added a method to access shared global data instance
+ for legacy clients.
+
+ * kjs/JSGlobalObject.cpp:
+ (KJS::JSGlobalObject::~JSGlobalObject): Changed to work with per-thread head; fixed list
+ maintenance logic.
+ (KJS::JSGlobalObject::init): Changed to work with per-thread head.
+ (KJS::JSGlobalObject::put): Assert that a cross-heap operation is not being attempted.
+ (KJS::JSGlobalObject::reset): Pass ExecState* where now required.
+ (KJS::JSGlobalObject::mark): Pass the current heap to RegisterFileStack::mark.
+ (KJS::JSGlobalObject::operator new): Overload operator new to use per-thread or shared heap.
+ * kjs/JSGlobalObject.h: Removed static s_head member.
+
+ * kjs/PropertyMap.h: (KJS::PropertyMap::PropertyMap): Removed unused SavedProperty.
+
+ * kjs/collector.h: Turned Collector into an actual object with its own data, renamed to Heap.
+ (KJS::Heap::initializeHeapIntrospector): Added.
+ (KJS::Heap::heap): Added a method to determine which heap a JSValue is in, if any.
+ (KJS::Heap::allocate): Made non-static.
+ (KJS::Heap::inlineAllocateNumber): Ditto.
+ (KJS::Heap::markListSet): Ditto.
+ (KJS::Heap::cellBlock): Ditto.
+ (KJS::Heap::cellOffset): Ditto.
+ (KJS::Heap::isCellMarked): Ditto.
+ (KJS::Heap::markCell): Ditto.
+ (KJS::Heap::reportExtraMemoryCost): Ditto.
+ (KJS::CollectorBlock): Added a back-reference to Heap for Heap::heap() method.
+ (KJS::SmallCellCollectorBlock): Ditto.
+
+ * kjs/collector.cpp: Changed MIN_ARRAY_SIZE to a #define to avoid a PIC branch. Removed
+ main thread related machinery.
+ (KJS::Heap::Heap): Initialize the newly added data members.
+ (KJS::allocateBlock): Marked NEVER_INLINE, as this is a rare case that uses a PIC branch.
+ Moved static pagesize to the class to make it safely initialized.
+ (KJS::Heap::heapAllocate): Initialize heap back reference after a new block is allocated.
+ (KJS::Heap::registerThread): Removed introspector initialization, as it is now performed
+ in InitializeThreading.cpp.
+ (KJS::Heap::markOtherThreadConservatively): Assert that the "other thread" case only occurs
+ for legacy clients using a shared heap.
+ (KJS::Heap::markStackObjectsConservatively): Moved fastMallocForbid/Allow down here, since
+ it doesn't need to be forbidden during other GC phases.
+
+ * kjs/JSImmediate.h:
+ (KJS::jsUndefined):
+ (KJS::jsNull):
+ (KJS::jsBoolean):
+ Moved from JSvalue.h, to make these usable in files that cannot include JSValue.h (such
+ as list.h).
+
+ * API/JSCallbackObjectFunctions.h:
+ (KJS::::staticFunctionGetter):
+ * API/JSClassRef.cpp:
+ (OpaqueJSClass::prototype):
+ * API/JSObjectRef.cpp:
+ (JSObjectMake):
+ (JSObjectMakeFunctionWithCallback):
+ (JSObjectMakeConstructor):
+ (JSObjectMakeFunction):
+ * API/JSValueRef.cpp:
+ (JSValueMakeNumber):
+ (JSValueMakeString):
+ * JavaScriptCore.exp:
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::emitLoad):
+ * VM/JSPropertyNameIterator.cpp:
+ (KJS::JSPropertyNameIterator::create):
+ (KJS::JSPropertyNameIterator::next):
+ * VM/Machine.cpp:
+ (KJS::jsAddSlowCase):
+ (KJS::jsAdd):
+ (KJS::jsTypeStringForValue):
+ (KJS::scopeChainForCall):
+ (KJS::Machine::throwException):
+ (KJS::Machine::execute):
+ (KJS::Machine::privateExecute):
+ (KJS::Machine::retrieveArguments):
+ * kjs/ArrayPrototype.cpp:
+ (KJS::arrayProtoFuncToString):
+ (KJS::arrayProtoFuncToLocaleString):
+ (KJS::arrayProtoFuncJoin):
+ (KJS::arrayProtoFuncConcat):
+ (KJS::arrayProtoFuncPop):
+ (KJS::arrayProtoFuncPush):
+ (KJS::arrayProtoFuncShift):
+ (KJS::arrayProtoFuncSlice):
+ (KJS::arrayProtoFuncSplice):
+ (KJS::arrayProtoFuncUnShift):
+ (KJS::arrayProtoFuncFilter):
+ (KJS::arrayProtoFuncMap):
+ (KJS::arrayProtoFuncEvery):
+ (KJS::arrayProtoFuncForEach):
+ (KJS::arrayProtoFuncSome):
+ (KJS::arrayProtoFuncIndexOf):
+ (KJS::arrayProtoFuncLastIndexOf):
+ (KJS::ArrayConstructor::ArrayConstructor):
+ (KJS::ArrayConstructor::construct):
+ (KJS::ArrayConstructor::callAsFunction):
+ * kjs/BooleanObject.cpp:
+ (KJS::BooleanPrototype::BooleanPrototype):
+ (KJS::booleanProtoFuncToString):
+ (KJS::BooleanConstructor::BooleanConstructor):
+ (KJS::BooleanConstructor::construct):
+ * kjs/FunctionPrototype.cpp:
+ (KJS::FunctionPrototype::FunctionPrototype):
+ (KJS::functionProtoFuncToString):
+ (KJS::FunctionConstructor::FunctionConstructor):
+ (KJS::FunctionConstructor::construct):
+ * kjs/JSActivation.cpp:
+ (KJS::JSActivation::createArgumentsObject):
+ * kjs/JSArray.cpp:
+ (KJS::JSArray::JSArray):
+ (KJS::JSArray::lengthGetter):
+ * kjs/JSFunction.cpp:
+ (KJS::JSFunction::lengthGetter):
+ (KJS::JSFunction::construct):
+ (KJS::Arguments::Arguments):
+ (KJS::encode):
+ (KJS::decode):
+ (KJS::globalFuncParseInt):
+ (KJS::globalFuncParseFloat):
+ (KJS::globalFuncEscape):
+ (KJS::globalFuncUnescape):
+ (KJS::PrototypeFunction::PrototypeFunction):
+ (KJS::PrototypeReflexiveFunction::PrototypeReflexiveFunction):
+ * kjs/JSImmediate.cpp:
+ (KJS::JSImmediate::toObject):
+ * kjs/JSLock.cpp:
+ (KJS::JSLock::registerThread):
+ * kjs/JSObject.cpp:
+ (KJS::JSObject::put):
+ (KJS::JSObject::defineGetter):
+ (KJS::JSObject::defineSetter):
+ (KJS::Error::create):
+ * kjs/JSObject.h:
+ (KJS::JSObject::putDirect):
+ * kjs/JSString.h:
+ (KJS::JSString::JSString):
+ * kjs/JSValue.cpp:
+ (KJS::JSCell::operator new):
+ (KJS::jsString):
+ (KJS::jsOwnedString):
+ * kjs/JSValue.h:
+ (KJS::JSNumberCell::operator new):
+ (KJS::jsNumberCell):
+ (KJS::jsNaN):
+ (KJS::jsNumber):
+ (KJS::JSCell::marked):
+ (KJS::JSCell::mark):
+ (KJS::JSValue::toJSNumber):
+ * kjs/MathObject.cpp:
+ (KJS::MathObject::getValueProperty):
+ (KJS::mathProtoFuncAbs):
+ (KJS::mathProtoFuncACos):
+ (KJS::mathProtoFuncASin):
+ (KJS::mathProtoFuncATan):
+ (KJS::mathProtoFuncATan2):
+ (KJS::mathProtoFuncCeil):
+ (KJS::mathProtoFuncCos):
+ (KJS::mathProtoFuncExp):
+ (KJS::mathProtoFuncFloor):
+ (KJS::mathProtoFuncLog):
+ (KJS::mathProtoFuncMax):
+ (KJS::mathProtoFuncMin):
+ (KJS::mathProtoFuncPow):
+ (KJS::mathProtoFuncRandom):
+ (KJS::mathProtoFuncRound):
+ (KJS::mathProtoFuncSin):
+ (KJS::mathProtoFuncSqrt):
+ (KJS::mathProtoFuncTan):
+ * kjs/NumberObject.cpp:
+ (KJS::NumberPrototype::NumberPrototype):
+ (KJS::numberProtoFuncToString):
+ (KJS::numberProtoFuncToLocaleString):
+ (KJS::numberProtoFuncToFixed):
+ (KJS::numberProtoFuncToExponential):
+ (KJS::numberProtoFuncToPrecision):
+ (KJS::NumberConstructor::NumberConstructor):
+ (KJS::NumberConstructor::getValueProperty):
+ (KJS::NumberConstructor::construct):
+ (KJS::NumberConstructor::callAsFunction):
+ * kjs/RegExpObject.cpp:
+ (KJS::RegExpPrototype::RegExpPrototype):
+ (KJS::regExpProtoFuncToString):
+ (KJS::RegExpObject::getValueProperty):
+ (KJS::RegExpConstructor::RegExpConstructor):
+ (KJS::RegExpMatchesArray::fillArrayInstance):
+ (KJS::RegExpConstructor::arrayOfMatches):
+ (KJS::RegExpConstructor::getBackref):
+ (KJS::RegExpConstructor::getLastParen):
+ (KJS::RegExpConstructor::getLeftContext):
+ (KJS::RegExpConstructor::getRightContext):
+ (KJS::RegExpConstructor::getValueProperty):
+ (KJS::RegExpConstructor::construct):
+ * kjs/RegExpObject.h:
+ * kjs/Shell.cpp:
+ (GlobalObject::GlobalObject):
+ (functionGC):
+ (functionRun):
+ (functionReadline):
+ (jscmain):
+ * kjs/date_object.cpp:
+ (KJS::formatLocaleDate):
+ (KJS::DatePrototype::DatePrototype):
+ (KJS::DateConstructor::DateConstructor):
+ (KJS::DateConstructor::construct):
+ (KJS::DateConstructor::callAsFunction):
+ (KJS::DateFunction::DateFunction):
+ (KJS::DateFunction::callAsFunction):
+ (KJS::dateProtoFuncToString):
+ (KJS::dateProtoFuncToUTCString):
+ (KJS::dateProtoFuncToDateString):
+ (KJS::dateProtoFuncToTimeString):
+ (KJS::dateProtoFuncToLocaleString):
+ (KJS::dateProtoFuncToLocaleDateString):
+ (KJS::dateProtoFuncToLocaleTimeString):
+ (KJS::dateProtoFuncValueOf):
+ (KJS::dateProtoFuncGetTime):
+ (KJS::dateProtoFuncGetFullYear):
+ (KJS::dateProtoFuncGetUTCFullYear):
+ (KJS::dateProtoFuncToGMTString):
+ (KJS::dateProtoFuncGetMonth):
+ (KJS::dateProtoFuncGetUTCMonth):
+ (KJS::dateProtoFuncGetDate):
+ (KJS::dateProtoFuncGetUTCDate):
+ (KJS::dateProtoFuncGetDay):
+ (KJS::dateProtoFuncGetUTCDay):
+ (KJS::dateProtoFuncGetHours):
+ (KJS::dateProtoFuncGetUTCHours):
+ (KJS::dateProtoFuncGetMinutes):
+ (KJS::dateProtoFuncGetUTCMinutes):
+ (KJS::dateProtoFuncGetSeconds):
+ (KJS::dateProtoFuncGetUTCSeconds):
+ (KJS::dateProtoFuncGetMilliSeconds):
+ (KJS::dateProtoFuncGetUTCMilliseconds):
+ (KJS::dateProtoFuncGetTimezoneOffset):
+ (KJS::dateProtoFuncSetTime):
+ (KJS::setNewValueFromTimeArgs):
+ (KJS::setNewValueFromDateArgs):
+ (KJS::dateProtoFuncSetYear):
+ (KJS::dateProtoFuncGetYear):
+ * kjs/error_object.cpp:
+ (KJS::ErrorPrototype::ErrorPrototype):
+ (KJS::errorProtoFuncToString):
+ (KJS::ErrorConstructor::ErrorConstructor):
+ (KJS::ErrorConstructor::construct):
+ (KJS::NativeErrorPrototype::NativeErrorPrototype):
+ (KJS::NativeErrorConstructor::NativeErrorConstructor):
+ (KJS::NativeErrorConstructor::construct):
+ * kjs/identifier.h:
+ * kjs/internal.cpp:
+ (KJS::StringObject::create):
+ (KJS::JSString::lengthGetter):
+ (KJS::JSString::indexGetter):
+ (KJS::JSString::indexNumericPropertyGetter):
+ * kjs/interpreter.cpp:
+ * kjs/list.cpp:
+ (KJS::ArgList::slowAppend):
+ * kjs/list.h:
+ * kjs/lookup.h:
+ (KJS::staticFunctionGetter):
+ (KJS::cacheGlobalObject):
+ * kjs/nodes.cpp:
+ (KJS::Node::emitThrowError):
+ (KJS::StringNode::emitCode):
+ (KJS::ArrayNode::emitCode):
+ (KJS::FuncDeclNode::makeFunction):
+ (KJS::FuncExprNode::makeFunction):
+ * kjs/nodes.h:
+ * kjs/object_object.cpp:
+ (KJS::ObjectPrototype::ObjectPrototype):
+ (KJS::objectProtoFuncToLocaleString):
+ (KJS::objectProtoFuncToString):
+ (KJS::ObjectConstructor::ObjectConstructor):
+ (KJS::ObjectConstructor::construct):
+ * kjs/protect.h:
+ (KJS::gcProtect):
+ (KJS::gcUnprotect):
+ * kjs/string_object.cpp:
+ (KJS::StringObject::StringObject):
+ (KJS::StringPrototype::StringPrototype):
+ (KJS::replace):
+ (KJS::stringProtoFuncCharAt):
+ (KJS::stringProtoFuncCharCodeAt):
+ (KJS::stringProtoFuncConcat):
+ (KJS::stringProtoFuncIndexOf):
+ (KJS::stringProtoFuncLastIndexOf):
+ (KJS::stringProtoFuncMatch):
+ (KJS::stringProtoFuncSearch):
+ (KJS::stringProtoFuncReplace):
+ (KJS::stringProtoFuncSlice):
+ (KJS::stringProtoFuncSplit):
+ (KJS::stringProtoFuncSubstr):
+ (KJS::stringProtoFuncSubstring):
+ (KJS::stringProtoFuncToLowerCase):
+ (KJS::stringProtoFuncToUpperCase):
+ (KJS::stringProtoFuncToLocaleLowerCase):
+ (KJS::stringProtoFuncToLocaleUpperCase):
+ (KJS::stringProtoFuncLocaleCompare):
+ (KJS::stringProtoFuncBig):
+ (KJS::stringProtoFuncSmall):
+ (KJS::stringProtoFuncBlink):
+ (KJS::stringProtoFuncBold):
+ (KJS::stringProtoFuncFixed):
+ (KJS::stringProtoFuncItalics):
+ (KJS::stringProtoFuncStrike):
+ (KJS::stringProtoFuncSub):
+ (KJS::stringProtoFuncSup):
+ (KJS::stringProtoFuncFontcolor):
+ (KJS::stringProtoFuncFontsize):
+ (KJS::stringProtoFuncAnchor):
+ (KJS::stringProtoFuncLink):
+ (KJS::StringConstructor::StringConstructor):
+ (KJS::StringConstructor::construct):
+ (KJS::StringConstructor::callAsFunction):
+ (KJS::StringConstructorFunction::StringConstructorFunction):
+ (KJS::StringConstructorFunction::callAsFunction):
+ * kjs/string_object.h:
+ (KJS::StringObjectThatMasqueradesAsUndefined::StringObjectThatMasqueradesAsUndefined):
+ * kjs/ustring.h:
+ Updated for the above changes.
+
+2008-06-17 Timothy Hatcher <timothy@apple.com>
+
+ Added a type to DebuggerCallFrame so the under interface can
+ distinguish anonymous functions and program call frames.
+
+ https://bugs.webkit.org/show_bug.cgi?id=19585
+
+ Reviewed by Geoff Garen.
+
+ * JavaScriptCore.exp: Export the DebuggerCallFrame::type symbol.
+ * kjs/DebuggerCallFrame.cpp:
+ (KJS::DebuggerCallFrame::type): Added.
+ * kjs/DebuggerCallFrame.h:
+
+2008-06-17 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Tim H.
+
+ Remove bogus ASSERT which tripped every time for those who use PAC files.
+
+ * kjs/Parser.cpp:
+ (KJS::Parser::parse):
+
+2008-06-17 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Geoff.
+
+ <rdar://problem/5951534> JSProfiler: Don't profile console.profile()
+ or console.profileEnd()
+
+ * profiler/Profile.cpp:
+ (KJS::Profile::stopProfiling): Moved the creation of the (idle) node to
+ the Profile (not ProfileNode). This makes sense since the Profile
+ should be the one to modify the profile tree. Also each stopProfiling()
+ does not need to check if it's the head node anymore. Also fixed an
+ oddity where I was using willExecute to create the node.
+ (KJS::Profile::removeProfileStart): Removes the call to console.profile
+ that started this profile.
+ (KJS::Profile::removeProfileEnd): Removes the call to console.profileEnd
+ that ended this profile.
+ * profiler/Profile.h:
+ * profiler/ProfileNode.cpp: Moved the creation of the (idle) node to
+ the Profile object.
+ (KJS::ProfileNode::stopProfiling):
+ * profiler/ProfileNode.h: Added some helper functions and whitespace to
+ facilitate readability and the removal of profile() and profileEnd()
+ from the Profile tree.
+ (KJS::CallIdentifier::operator const char* ):
+ (KJS::ProfileNode::firstChild):
+ (KJS::ProfileNode::lastChild):
+ (KJS::ProfileNode::removeChild):
+ (KJS::ProfileNode::toString):
+
+2008-06-17 Ariya Hidayat <ariya.hidayat@trolltech.com>
+
+ Rubber stamped by Adam Roben.
+
+ Include JSGlobalObject.h to fix the build.
+
+ * kjs/ScopeChain.cpp:
+
+2008-06-17 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Oliver.
+
+ Reduce code duplication in emitReadModifyAssignment().
+
+ * kjs/nodes.cpp:
+ (KJS::emitReadModifyAssignment):
+
+2008-06-17 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Oliver.
+
+ Sort includes alphabetically.
+
+ * kjs/nodes.cpp:
+
+2008-06-16 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Maciej.
+
+ Bug 19596: LEAK: Gmail leaks SegmentedVector<RegisterID>
+ <https://bugs.webkit.org/show_bug.cgi?id=19596>
+
+ When growing SegmentedVector, we start adding segments at the position
+ of the last segment, overwriting it. The destructor frees allocated
+ segments starting at the segment of index 1, because the segment of
+ index 0 is assumed to be the initial inline segment. This causes a leak
+ of the segment that is referenced by index 0. Modifying grow() so that
+ it starts adding segments at the position after the last segment fixes
+ the leak.
+
+ Since the initial segment is a special case in the lookup code, this
+ bug never manifested itself via incorrect results.
+
+ * VM/SegmentedVector.h:
+ (KJS::SegmentedVector::grow):
+
+2008-06-16 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Alexey.
+
+ - removed nearly unused types.h and LocalStorageEntry.h headers
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * kjs/ExecState.h:
+ * kjs/LocalStorageEntry.h: Removed.
+ * kjs/RegExpObject.cpp:
+ * kjs/error_object.cpp:
+ * kjs/grammar.y:
+ * kjs/nodes.cpp:
+ * kjs/types.h: Removed.
+
+2008-06-16 Alp Toker <alp@nuanti.com>
+
+ Rubber-stamped by Geoff.
+
+ Change c++ to c in minidom and testapi emacs mode line comments.
+
+ * API/Node.h:
+ * API/NodeList.c:
+ * API/NodeList.h:
+ * API/testapi.c:
+
+2008-06-16 Alexey Proskuryakov <ap@webkit.org>
+
+ Trying to fix Windows build.
+
+ * kjs/PropertyNameArray.h:
+ * kjs/identifier.cpp:
+ Include ExecState.h
+
+2008-06-16 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Slight cleanup to the SymbolTableEntry class.
+
+ Renamed isEmpty to isNull, since we usually use "empty" to mean "holds
+ the valid, empty value", and "null" to mean "holds no value".
+
+ Changed an "== 0" to a "!", to match our style guidelines.
+
+ Added some ASSERTs to verify the (possibly questionable) assumption that
+ all register indexes will have their high two bits set. Also clarified a
+ comment to make that assumption clear.
+
+2008-06-16 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Darin.
+
+ Initialize functionQueueMutex in a safe manner.
+
+ * wtf/MainThread.cpp:
+ (WTF::functionQueueMutex): Made it an AtomicallyInitializedStatic.
+
+ (WTF::dispatchFunctionsFromMainThread):
+ (WTF::setMainThreadCallbacksPaused):
+ Assert that the current thread is main, meaning that the callbacksPaused static can be
+ accessed.
+
+2008-06-16 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Geoff Garen.
+
+ Make Identifier construction use an explicitly passed IdentifierTable.
+
+ No change on SunSpider total.
+
+ * API/JSCallbackObjectFunctions.h:
+ (KJS::::getOwnPropertySlot):
+ (KJS::::put):
+ (KJS::::deleteProperty):
+ (KJS::::getPropertyNames):
+ * API/JSObjectRef.cpp:
+ (JSObjectMakeFunctionWithCallback):
+ (JSObjectMakeFunction):
+ (JSObjectHasProperty):
+ (JSObjectGetProperty):
+ (JSObjectSetProperty):
+ (JSObjectDeleteProperty):
+ (OpaqueJSPropertyNameArray::OpaqueJSPropertyNameArray):
+ (JSObjectCopyPropertyNames):
+ * JavaScriptCore.exp:
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::CodeGenerator):
+ (KJS::CodeGenerator::registerForLocal):
+ (KJS::CodeGenerator::isLocal):
+ (KJS::CodeGenerator::addConstant):
+ (KJS::CodeGenerator::findScopedProperty):
+ * VM/CodeGenerator.h:
+ (KJS::CodeGenerator::globalData):
+ (KJS::CodeGenerator::propertyNames):
+ * VM/JSPropertyNameIterator.cpp:
+ (KJS::JSPropertyNameIterator::create):
+ * VM/Machine.cpp:
+ (KJS::Machine::throwException):
+ (KJS::Machine::privateExecute):
+ * kjs/ArrayPrototype.cpp:
+ (KJS::ArrayConstructor::ArrayConstructor):
+ * kjs/BooleanObject.cpp:
+ (KJS::BooleanConstructor::BooleanConstructor):
+ * kjs/FunctionPrototype.cpp:
+ (KJS::FunctionConstructor::FunctionConstructor):
+ (KJS::FunctionConstructor::construct):
+ * kjs/JSArray.cpp:
+ (KJS::JSArray::inlineGetOwnPropertySlot):
+ (KJS::JSArray::put):
+ (KJS::JSArray::deleteProperty):
+ (KJS::JSArray::getPropertyNames):
+ * kjs/JSFunction.cpp:
+ (KJS::Arguments::Arguments):
+ * kjs/JSGlobalData.cpp:
+ (KJS::JSGlobalData::JSGlobalData):
+ * kjs/JSGlobalObject.cpp:
+ (KJS::JSGlobalObject::reset):
+ * kjs/JSObject.cpp:
+ (KJS::JSObject::getOwnPropertySlot):
+ (KJS::JSObject::put):
+ (KJS::JSObject::putWithAttributes):
+ (KJS::JSObject::deleteProperty):
+ (KJS::JSObject::findPropertyHashEntry):
+ (KJS::JSObject::getPropertyNames):
+ (KJS::Error::create):
+ * kjs/JSVariableObject.cpp:
+ (KJS::JSVariableObject::getPropertyNames):
+ * kjs/NumberObject.cpp:
+ (KJS::NumberConstructor::NumberConstructor):
+ * kjs/PropertyNameArray.cpp:
+ (KJS::PropertyNameArray::add):
+ * kjs/PropertyNameArray.h:
+ (KJS::PropertyNameArray::PropertyNameArray):
+ (KJS::PropertyNameArray::addKnownUnique):
+ * kjs/PropertySlot.h:
+ (KJS::PropertySlot::getValue):
+ * kjs/RegExpObject.cpp:
+ (KJS::RegExpConstructor::RegExpConstructor):
+ * kjs/ScopeChain.cpp:
+ (KJS::ScopeChainNode::print):
+ * kjs/Shell.cpp:
+ (GlobalObject::GlobalObject):
+ * kjs/date_object.cpp:
+ (KJS::DateConstructor::DateConstructor):
+ * kjs/error_object.cpp:
+ (KJS::ErrorConstructor::ErrorConstructor):
+ (KJS::NativeErrorConstructor::NativeErrorConstructor):
+ * kjs/grammar.y:
+ * kjs/identifier.cpp:
+ (KJS::Identifier::add):
+ (KJS::Identifier::addSlowCase):
+ * kjs/identifier.h:
+ (KJS::Identifier::Identifier):
+ (KJS::Identifier::from):
+ (KJS::Identifier::equal):
+ (KJS::Identifier::add):
+ (KJS::operator==):
+ (KJS::operator!=):
+ * kjs/internal.cpp:
+ (KJS::JSString::getOwnPropertySlot):
+ * kjs/lexer.cpp:
+ (KJS::Lexer::Lexer):
+ (KJS::Lexer::lex):
+ (KJS::Lexer::makeIdentifier):
+ * kjs/lexer.h:
+ * kjs/lookup.cpp:
+ (KJS::HashTable::createTable):
+ * kjs/lookup.h:
+ (KJS::HashTable::initializeIfNeeded):
+ (KJS::HashTable::entry):
+ (KJS::getStaticPropertySlot):
+ (KJS::getStaticFunctionSlot):
+ (KJS::getStaticValueSlot):
+ (KJS::lookupPut):
+ * kjs/object_object.cpp:
+ (KJS::objectProtoFuncHasOwnProperty):
+ (KJS::objectProtoFuncDefineGetter):
+ (KJS::objectProtoFuncDefineSetter):
+ (KJS::objectProtoFuncLookupGetter):
+ (KJS::objectProtoFuncLookupSetter):
+ (KJS::objectProtoFuncPropertyIsEnumerable):
+ (KJS::ObjectConstructor::ObjectConstructor):
+ * kjs/string_object.cpp:
+ (KJS::StringObject::getOwnPropertySlot):
+ (KJS::StringObject::getPropertyNames):
+ (KJS::StringConstructor::StringConstructor):
+ Just pass ExecState or JSGlobalData everywhere. Identifier construction is now always
+ explicit.
+
+ * kjs/nodes.cpp: (KJS::RegExpNode::emitCode): Here, Identifier was created from a non-literal
+ char*, which was incorrect, as that uses the pointer value as a key.
+
+2008-06-16 Thiago Macieira <tjmaciei@trolltech.com>
+
+ Reviewed by Darin.
+
+ https://bugs.webkit.org/show_bug.cgi?id=19577
+
+ Fix compilation in C++ environments where C99 headers are not present
+
+ The stdbool.h header is a C99 feature, defining the "_Bool" type as well as the
+ "true" and "false" constants. But it's completely unnecessary in C++ as the
+ language already defines the "bool" type and its two values.
+
+ * API/JSBase.h:
+ * API/JSContextRef.h:
+ * API/JSObjectRef.h:
+ * API/JSStringRef.h:
+ * API/JSValueRef.h:
+
+2008-06-16 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by John.
+
+ <rdar://problem/6012509> JSProfiler: %s are incorrect if you exclude a
+ top level node like (idle)
+
+ * profiler/Profile.cpp:
+ (KJS::Profile::focus):
+ (KJS::Profile::exclude): Subtract the selfTime from the totalTime of the
+ head since its self time will only be non-zero when one of its children
+ were excluded. Since the head's totalTime is used to calculate %s when
+ its totalTime is the same as the sum of all its visible childrens' times
+ their %s will sum to 100%.
+
+2008-06-16 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ <rdar://problem/5969992> JSProfiler: Remove the recursion limit in the profiler.
+
+ * profiler/Profile.cpp:
+ (KJS::Profile::willExecute):
+
+2008-06-16 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Sam.
+
+ <rdar://problem/5969992> JSProfiler: Remove the recursion limit in the
+ profiler.
+ - Remove the last of the uses of recursion in the profiler.
+
+ * JavaScriptCore.exp: Export the new function's signature.
+ * profiler/Profile.cpp:
+ (KJS::calculateVisibleTotalTime): Added a new static method for
+ recalculating the visibleTotalTime of methods after focus has changed
+ which are visible.
+ (KJS::stopProfiling):
+ (KJS::Profile::focus): Implemented focus without recursion.
+ * profiler/Profile.h: Moved implementation into the definition file.
+ * profiler/ProfileNode.cpp:
+ (KJS::ProfileNode::traverseNextNodePreOrder): Added an argument for
+ whether or not to process the children nodes, this allows focus to skip
+ sub trees which have been set as not visible.
+ (KJS::ProfileNode::calculateVisibleTotalTime): This function set's a
+ node's total visible time to the sum of its self time and its children's
+ total times.
+ (KJS::ProfileNode::focus): Implemented focus without recursion.
+ * profiler/ProfileNode.h:
+ (KJS::CallIdentifier::operator!= ):
+ (KJS::ProfileNode::setActualTotalTime): Expanded setting the total time
+ so that focus could modify only the visible total time.
+ (KJS::ProfileNode::setVisibleTotalTime):
+
+2008-06-16 Christian Dywan <christian@twotoasts.de>
+
+ Reviewed by Sam.
+
+ https://bugs.webkit.org/show_bug.cgi?id=19552
+ JavaScriptCore headers use C++ style comments
+
+ Replace all C++ style comments with C style multiline
+ comments and remove all "mode" lines.
+
+ * API/JSBase.h:
+ * API/JSClassRef.h:
+ * API/JSContextRef.h:
+ * API/JSObjectRef.h:
+ * API/JSStringRef.h:
+ * API/JSStringRefBSTR.h:
+ * API/JSStringRefCF.h:
+ * API/JSValueRef.h:
+ * API/JavaScript.h:
+ * API/JavaScriptCore.h:
+
+2008-06-16 Christian Dywan <christian@twotoasts.de>
+
+ Reviewed by Sam.
+
+ https://bugs.webkit.org/show_bug.cgi?id=19557
+ (JavaScriptCore) minidom uses C++ style comments
+
+ Use only C style comments in minidom sources
+
+ * API/JSNode.c:
+ (JSNode_appendChild):
+ (JSNode_removeChild):
+ * API/JSNode.h:
+ * API/JSNodeList.c:
+ (JSNodeList_getProperty):
+ * API/JSNodeList.h:
+ * API/Node.c:
+ * API/Node.h:
+ * API/NodeList.c:
+ (NodeList_new):
+ (NodeList_item):
+ * API/NodeList.h:
+ * API/minidom.c:
+ (createStringWithContentsOfFile):
+ * wtf/Assertions.h:
+ * wtf/UnusedParam.h:
+
+2008-06-16 Adriaan de Groot <groot@kde.org>
+
+ Reviewed by Simon.
+
+ Fix compilation on Solaris
+
+ On some systems, munmap takes a char* instead of a void* (contrary to POSIX and
+ Single Unix Specification). Since you can always convert from char* to void*
+ but not vice-versa, do the casting to char*.
+
+ * kjs/collector.cpp:
+ (KJS::allocateBlock):
+ (KJS::freeBlock):
+
+2008-06-16 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Maciej.
+
+ Make a UnaryOpNode class to reduce boilerplate code for UnaryPlusNode,
+ NegateNode, BitwiseNotNode, and LogicalNotNode.
+
+ * VM/CodeGenerator.h:
+ (KJS::CodeGenerator::emitToJSNumber):
+ * kjs/nodes.cpp:
+ (KJS::UnaryOpNode::emitCode):
+ * kjs/nodes.h:
+ (KJS::UnaryOpNode::UnaryOpNode):
+ (KJS::UnaryPlusNode::):
+ (KJS::NegateNode::):
+ (KJS::NegateNode::precedence):
+ (KJS::BitwiseNotNode::):
+ (KJS::BitwiseNotNode::precedence):
+ (KJS::LogicalNotNode::):
+ (KJS::LogicalNotNode::precedence):
+
+2008-06-16 Jan Michael Alonzo <jmalonzo@webkit.org>
+
+ Gtk build fix
+
+ * GNUmakefile.am:
+
+2008-06-15 Darin Adler <darin@apple.com>
+
+ - rename KJS::List to KJS::ArgList
+
+ * API/JSCallbackConstructor.cpp:
+ (KJS::JSCallbackConstructor::construct):
+ * API/JSCallbackConstructor.h:
+ * API/JSCallbackFunction.cpp:
+ (KJS::JSCallbackFunction::callAsFunction):
+ * API/JSCallbackFunction.h:
+ * API/JSCallbackObject.h:
+ * API/JSCallbackObjectFunctions.h:
+ (KJS::::construct):
+ (KJS::::callAsFunction):
+ * API/JSObjectRef.cpp:
+ (JSObjectMakeFunction):
+ (JSObjectCallAsFunction):
+ (JSObjectCallAsConstructor):
+ * JavaScriptCore.exp:
+ * VM/Machine.cpp:
+ (KJS::Machine::execute):
+ (KJS::Machine::privateExecute):
+ * VM/Machine.h:
+ * kjs/ArrayPrototype.cpp:
+ (KJS::arrayProtoFuncToString):
+ (KJS::arrayProtoFuncToLocaleString):
+ (KJS::arrayProtoFuncJoin):
+ (KJS::arrayProtoFuncConcat):
+ (KJS::arrayProtoFuncPop):
+ (KJS::arrayProtoFuncPush):
+ (KJS::arrayProtoFuncReverse):
+ (KJS::arrayProtoFuncShift):
+ (KJS::arrayProtoFuncSlice):
+ (KJS::arrayProtoFuncSort):
+ (KJS::arrayProtoFuncSplice):
+ (KJS::arrayProtoFuncUnShift):
+ (KJS::arrayProtoFuncFilter):
+ (KJS::arrayProtoFuncMap):
+ (KJS::arrayProtoFuncEvery):
+ (KJS::arrayProtoFuncForEach):
+ (KJS::arrayProtoFuncSome):
+ (KJS::arrayProtoFuncIndexOf):
+ (KJS::arrayProtoFuncLastIndexOf):
+ (KJS::ArrayConstructor::construct):
+ (KJS::ArrayConstructor::callAsFunction):
+ * kjs/ArrayPrototype.h:
+ * kjs/BooleanObject.cpp:
+ (KJS::booleanProtoFuncToString):
+ (KJS::booleanProtoFuncValueOf):
+ (KJS::BooleanConstructor::construct):
+ (KJS::BooleanConstructor::callAsFunction):
+ * kjs/BooleanObject.h:
+ * kjs/CommonIdentifiers.h:
+ * kjs/ExecState.h:
+ (KJS::ExecState::emptyList):
+ * kjs/FunctionPrototype.cpp:
+ (KJS::FunctionPrototype::callAsFunction):
+ (KJS::functionProtoFuncToString):
+ (KJS::functionProtoFuncApply):
+ (KJS::functionProtoFuncCall):
+ (KJS::FunctionConstructor::construct):
+ (KJS::FunctionConstructor::callAsFunction):
+ * kjs/FunctionPrototype.h:
+ * kjs/JSActivation.cpp:
+ (KJS::JSActivation::createArgumentsObject):
+ * kjs/JSArray.cpp:
+ (KJS::JSArray::JSArray):
+ (KJS::AVLTreeAbstractorForArrayCompare::compare_key_key):
+ * kjs/JSArray.h:
+ * kjs/JSFunction.cpp:
+ (KJS::JSFunction::callAsFunction):
+ (KJS::JSFunction::construct):
+ (KJS::IndexToNameMap::IndexToNameMap):
+ (KJS::Arguments::Arguments):
+ (KJS::encode):
+ (KJS::decode):
+ (KJS::globalFuncEval):
+ (KJS::globalFuncParseInt):
+ (KJS::globalFuncParseFloat):
+ (KJS::globalFuncIsNaN):
+ (KJS::globalFuncIsFinite):
+ (KJS::globalFuncDecodeURI):
+ (KJS::globalFuncDecodeURIComponent):
+ (KJS::globalFuncEncodeURI):
+ (KJS::globalFuncEncodeURIComponent):
+ (KJS::globalFuncEscape):
+ (KJS::globalFuncUnescape):
+ (KJS::globalFuncKJSPrint):
+ (KJS::PrototypeFunction::callAsFunction):
+ (KJS::PrototypeReflexiveFunction::callAsFunction):
+ * kjs/JSFunction.h:
+ * kjs/JSGlobalData.h:
+ * kjs/JSImmediate.cpp:
+ (KJS::JSImmediate::toObject):
+ * kjs/JSNotAnObject.cpp:
+ (KJS::JSNotAnObject::construct):
+ (KJS::JSNotAnObject::callAsFunction):
+ * kjs/JSNotAnObject.h:
+ * kjs/JSObject.cpp:
+ (KJS::JSObject::put):
+ (KJS::JSObject::construct):
+ (KJS::JSObject::callAsFunction):
+ (KJS::Error::create):
+ * kjs/JSObject.h:
+ * kjs/MathObject.cpp:
+ (KJS::mathProtoFuncAbs):
+ (KJS::mathProtoFuncACos):
+ (KJS::mathProtoFuncASin):
+ (KJS::mathProtoFuncATan):
+ (KJS::mathProtoFuncATan2):
+ (KJS::mathProtoFuncCeil):
+ (KJS::mathProtoFuncCos):
+ (KJS::mathProtoFuncExp):
+ (KJS::mathProtoFuncFloor):
+ (KJS::mathProtoFuncLog):
+ (KJS::mathProtoFuncMax):
+ (KJS::mathProtoFuncMin):
+ (KJS::mathProtoFuncPow):
+ (KJS::mathProtoFuncRandom):
+ (KJS::mathProtoFuncRound):
+ (KJS::mathProtoFuncSin):
+ (KJS::mathProtoFuncSqrt):
+ (KJS::mathProtoFuncTan):
+ * kjs/MathObject.h:
+ * kjs/NumberObject.cpp:
+ (KJS::numberProtoFuncToString):
+ (KJS::numberProtoFuncToLocaleString):
+ (KJS::numberProtoFuncValueOf):
+ (KJS::numberProtoFuncToFixed):
+ (KJS::numberProtoFuncToExponential):
+ (KJS::numberProtoFuncToPrecision):
+ (KJS::NumberConstructor::construct):
+ (KJS::NumberConstructor::callAsFunction):
+ * kjs/NumberObject.h:
+ * kjs/RegExpObject.cpp:
+ (KJS::regExpProtoFuncTest):
+ (KJS::regExpProtoFuncExec):
+ (KJS::regExpProtoFuncCompile):
+ (KJS::regExpProtoFuncToString):
+ (KJS::RegExpObject::match):
+ (KJS::RegExpObject::test):
+ (KJS::RegExpObject::exec):
+ (KJS::RegExpObject::callAsFunction):
+ (KJS::RegExpConstructor::construct):
+ (KJS::RegExpConstructor::callAsFunction):
+ * kjs/RegExpObject.h:
+ * kjs/Shell.cpp:
+ (functionPrint):
+ (functionDebug):
+ (functionGC):
+ (functionVersion):
+ (functionRun):
+ (functionLoad):
+ (functionReadline):
+ (functionQuit):
+ * kjs/collector.cpp:
+ (KJS::Collector::collect):
+ * kjs/collector.h:
+ (KJS::Collector::markListSet):
+ * kjs/date_object.cpp:
+ (KJS::formatLocaleDate):
+ (KJS::fillStructuresUsingTimeArgs):
+ (KJS::fillStructuresUsingDateArgs):
+ (KJS::DateConstructor::construct):
+ (KJS::DateConstructor::callAsFunction):
+ (KJS::DateFunction::callAsFunction):
+ (KJS::dateProtoFuncToString):
+ (KJS::dateProtoFuncToUTCString):
+ (KJS::dateProtoFuncToDateString):
+ (KJS::dateProtoFuncToTimeString):
+ (KJS::dateProtoFuncToLocaleString):
+ (KJS::dateProtoFuncToLocaleDateString):
+ (KJS::dateProtoFuncToLocaleTimeString):
+ (KJS::dateProtoFuncValueOf):
+ (KJS::dateProtoFuncGetTime):
+ (KJS::dateProtoFuncGetFullYear):
+ (KJS::dateProtoFuncGetUTCFullYear):
+ (KJS::dateProtoFuncToGMTString):
+ (KJS::dateProtoFuncGetMonth):
+ (KJS::dateProtoFuncGetUTCMonth):
+ (KJS::dateProtoFuncGetDate):
+ (KJS::dateProtoFuncGetUTCDate):
+ (KJS::dateProtoFuncGetDay):
+ (KJS::dateProtoFuncGetUTCDay):
+ (KJS::dateProtoFuncGetHours):
+ (KJS::dateProtoFuncGetUTCHours):
+ (KJS::dateProtoFuncGetMinutes):
+ (KJS::dateProtoFuncGetUTCMinutes):
+ (KJS::dateProtoFuncGetSeconds):
+ (KJS::dateProtoFuncGetUTCSeconds):
+ (KJS::dateProtoFuncGetMilliSeconds):
+ (KJS::dateProtoFuncGetUTCMilliseconds):
+ (KJS::dateProtoFuncGetTimezoneOffset):
+ (KJS::dateProtoFuncSetTime):
+ (KJS::setNewValueFromTimeArgs):
+ (KJS::setNewValueFromDateArgs):
+ (KJS::dateProtoFuncSetMilliSeconds):
+ (KJS::dateProtoFuncSetUTCMilliseconds):
+ (KJS::dateProtoFuncSetSeconds):
+ (KJS::dateProtoFuncSetUTCSeconds):
+ (KJS::dateProtoFuncSetMinutes):
+ (KJS::dateProtoFuncSetUTCMinutes):
+ (KJS::dateProtoFuncSetHours):
+ (KJS::dateProtoFuncSetUTCHours):
+ (KJS::dateProtoFuncSetDate):
+ (KJS::dateProtoFuncSetUTCDate):
+ (KJS::dateProtoFuncSetMonth):
+ (KJS::dateProtoFuncSetUTCMonth):
+ (KJS::dateProtoFuncSetFullYear):
+ (KJS::dateProtoFuncSetUTCFullYear):
+ (KJS::dateProtoFuncSetYear):
+ (KJS::dateProtoFuncGetYear):
+ * kjs/date_object.h:
+ * kjs/debugger.h:
+ * kjs/error_object.cpp:
+ (KJS::errorProtoFuncToString):
+ (KJS::ErrorConstructor::construct):
+ (KJS::ErrorConstructor::callAsFunction):
+ (KJS::NativeErrorConstructor::construct):
+ (KJS::NativeErrorConstructor::callAsFunction):
+ * kjs/error_object.h:
+ * kjs/internal.cpp:
+ (KJS::JSNumberCell::toObject):
+ (KJS::JSNumberCell::toThisObject):
+ * kjs/list.cpp:
+ (KJS::ArgList::getSlice):
+ (KJS::ArgList::markLists):
+ (KJS::ArgList::slowAppend):
+ * kjs/list.h:
+ (KJS::ArgList::ArgList):
+ (KJS::ArgList::~ArgList):
+ * kjs/object_object.cpp:
+ (KJS::objectProtoFuncValueOf):
+ (KJS::objectProtoFuncHasOwnProperty):
+ (KJS::objectProtoFuncIsPrototypeOf):
+ (KJS::objectProtoFuncDefineGetter):
+ (KJS::objectProtoFuncDefineSetter):
+ (KJS::objectProtoFuncLookupGetter):
+ (KJS::objectProtoFuncLookupSetter):
+ (KJS::objectProtoFuncPropertyIsEnumerable):
+ (KJS::objectProtoFuncToLocaleString):
+ (KJS::objectProtoFuncToString):
+ (KJS::ObjectConstructor::construct):
+ (KJS::ObjectConstructor::callAsFunction):
+ * kjs/object_object.h:
+ * kjs/string_object.cpp:
+ (KJS::replace):
+ (KJS::stringProtoFuncToString):
+ (KJS::stringProtoFuncValueOf):
+ (KJS::stringProtoFuncCharAt):
+ (KJS::stringProtoFuncCharCodeAt):
+ (KJS::stringProtoFuncConcat):
+ (KJS::stringProtoFuncIndexOf):
+ (KJS::stringProtoFuncLastIndexOf):
+ (KJS::stringProtoFuncMatch):
+ (KJS::stringProtoFuncSearch):
+ (KJS::stringProtoFuncReplace):
+ (KJS::stringProtoFuncSlice):
+ (KJS::stringProtoFuncSplit):
+ (KJS::stringProtoFuncSubstr):
+ (KJS::stringProtoFuncSubstring):
+ (KJS::stringProtoFuncToLowerCase):
+ (KJS::stringProtoFuncToUpperCase):
+ (KJS::stringProtoFuncToLocaleLowerCase):
+ (KJS::stringProtoFuncToLocaleUpperCase):
+ (KJS::stringProtoFuncLocaleCompare):
+ (KJS::stringProtoFuncBig):
+ (KJS::stringProtoFuncSmall):
+ (KJS::stringProtoFuncBlink):
+ (KJS::stringProtoFuncBold):
+ (KJS::stringProtoFuncFixed):
+ (KJS::stringProtoFuncItalics):
+ (KJS::stringProtoFuncStrike):
+ (KJS::stringProtoFuncSub):
+ (KJS::stringProtoFuncSup):
+ (KJS::stringProtoFuncFontcolor):
+ (KJS::stringProtoFuncFontsize):
+ (KJS::stringProtoFuncAnchor):
+ (KJS::stringProtoFuncLink):
+ (KJS::StringConstructor::construct):
+ (KJS::StringConstructor::callAsFunction):
+ (KJS::StringConstructorFunction::callAsFunction):
+ * kjs/string_object.h:
+
+2008-06-15 Darin Adler <darin@apple.com>
+
+ - new names for more JavaScriptCore files
+
+ * API/JSCallbackFunction.cpp:
+ * API/JSObjectRef.cpp:
+ * DerivedSources.make:
+ * GNUmakefile.am:
+ * JavaScriptCore.exp:
+ * JavaScriptCore.pri:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * JavaScriptCoreSources.bkl:
+ * VM/Machine.cpp:
+ * kjs/AllInOneFile.cpp:
+ * kjs/ArrayPrototype.cpp: Copied from JavaScriptCore/kjs/array_object.cpp.
+ * kjs/ArrayPrototype.h: Copied from JavaScriptCore/kjs/array_object.h.
+ * kjs/BooleanObject.cpp: Copied from JavaScriptCore/kjs/bool_object.cpp.
+ * kjs/BooleanObject.h: Copied from JavaScriptCore/kjs/bool_object.h.
+ * kjs/ExecState.cpp:
+ * kjs/ExecState.h:
+ * kjs/FunctionPrototype.cpp: Copied from JavaScriptCore/kjs/function_object.cpp.
+ * kjs/FunctionPrototype.h: Copied from JavaScriptCore/kjs/function_object.h.
+ * kjs/JSArray.cpp: Copied from JavaScriptCore/kjs/array_instance.cpp.
+ * kjs/JSArray.h: Copied from JavaScriptCore/kjs/array_instance.h.
+ * kjs/JSFunction.cpp:
+ * kjs/JSFunction.h:
+ * kjs/JSGlobalObject.cpp:
+ * kjs/JSImmediate.cpp:
+ * kjs/JSObject.h:
+ * kjs/JSString.h:
+ * kjs/JSValue.h:
+ * kjs/JSVariableObject.cpp:
+ * kjs/MathObject.cpp: Copied from JavaScriptCore/kjs/math_object.cpp.
+ * kjs/MathObject.h: Copied from JavaScriptCore/kjs/math_object.h.
+ * kjs/NumberObject.cpp: Copied from JavaScriptCore/kjs/number_object.cpp.
+ * kjs/NumberObject.h: Copied from JavaScriptCore/kjs/number_object.h.
+ * kjs/PropertyMap.cpp: Copied from JavaScriptCore/kjs/property_map.cpp.
+ * kjs/PropertyMap.h: Copied from JavaScriptCore/kjs/property_map.h.
+ * kjs/PropertySlot.cpp: Copied from JavaScriptCore/kjs/property_slot.cpp.
+ * kjs/PropertySlot.h: Copied from JavaScriptCore/kjs/property_slot.h.
+ * kjs/RegExpObject.cpp: Copied from JavaScriptCore/kjs/regexp_object.cpp.
+ * kjs/RegExpObject.h: Copied from JavaScriptCore/kjs/regexp_object.h.
+ * kjs/ScopeChain.cpp: Copied from JavaScriptCore/kjs/scope_chain.cpp.
+ * kjs/ScopeChain.h: Copied from JavaScriptCore/kjs/scope_chain.h.
+ * kjs/ScopeChainMark.h: Copied from JavaScriptCore/kjs/scope_chain_mark.h.
+ * kjs/Shell.cpp:
+ * kjs/array_instance.cpp: Removed.
+ * kjs/array_instance.h: Removed.
+ * kjs/array_object.cpp: Removed.
+ * kjs/array_object.h: Removed.
+ * kjs/bool_object.cpp: Removed.
+ * kjs/bool_object.h: Removed.
+ * kjs/error_object.h:
+ * kjs/function_object.cpp: Removed.
+ * kjs/function_object.h: Removed.
+ * kjs/internal.cpp:
+ * kjs/math_object.cpp: Removed.
+ * kjs/math_object.h: Removed.
+ * kjs/nodes.cpp:
+ * kjs/number_object.cpp: Removed.
+ * kjs/number_object.h: Removed.
+ * kjs/object_object.cpp:
+ * kjs/property_map.cpp: Removed.
+ * kjs/property_map.h: Removed.
+ * kjs/property_slot.cpp: Removed.
+ * kjs/property_slot.h: Removed.
+ * kjs/regexp_object.cpp: Removed.
+ * kjs/regexp_object.h: Removed.
+ * kjs/scope_chain.cpp: Removed.
+ * kjs/scope_chain.h: Removed.
+ * kjs/scope_chain_mark.h: Removed.
+ * kjs/string_object.cpp:
+ * kjs/string_object.h:
+
+2008-06-15 Darin Adler <darin@apple.com>
+
+ - new names for a few key JavaScriptCore files
+
+ * API/JSBase.cpp:
+ * API/JSCallbackConstructor.h:
+ * API/JSCallbackFunction.cpp:
+ * API/JSCallbackFunction.h:
+ * API/JSCallbackObject.h:
+ * API/JSCallbackObjectFunctions.h:
+ * API/JSClassRef.h:
+ * API/JSContextRef.cpp:
+ * API/JSObjectRef.cpp:
+ * API/JSStringRef.cpp:
+ * API/JSStringRefCF.cpp:
+ * API/JSValueRef.cpp:
+ * GNUmakefile.am:
+ * JavaScriptCore.pri:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * JavaScriptCoreSources.bkl:
+ * VM/CodeBlock.cpp:
+ * VM/CodeGenerator.cpp:
+ * VM/ExceptionHelpers.cpp:
+ * VM/ExceptionHelpers.h:
+ * VM/JSPropertyNameIterator.cpp:
+ * VM/JSPropertyNameIterator.h:
+ * VM/Machine.cpp:
+ * kjs/AllInOneFile.cpp:
+ * kjs/DateMath.cpp:
+ * kjs/DebuggerCallFrame.cpp:
+ * kjs/ExecState.cpp:
+ * kjs/JSActivation.cpp:
+ * kjs/JSFunction.cpp: Copied from JavaScriptCore/kjs/function.cpp.
+ * kjs/JSFunction.h: Copied from JavaScriptCore/kjs/function.h.
+ * kjs/JSImmediate.cpp:
+ * kjs/JSNotAnObject.h:
+ * kjs/JSObject.cpp: Copied from JavaScriptCore/kjs/object.cpp.
+ * kjs/JSObject.h: Copied from JavaScriptCore/kjs/object.h.
+ * kjs/JSString.h: Copied from JavaScriptCore/kjs/internal.h.
+ * kjs/JSValue.cpp: Copied from JavaScriptCore/kjs/value.cpp.
+ * kjs/JSValue.h: Copied from JavaScriptCore/kjs/value.h.
+ * kjs/JSVariableObject.h:
+ * kjs/JSWrapperObject.h:
+ * kjs/Shell.cpp:
+ * kjs/SymbolTable.h:
+ * kjs/array_instance.h:
+ * kjs/collector.cpp:
+ * kjs/date_object.cpp:
+ * kjs/date_object.h:
+ * kjs/error_object.cpp:
+ * kjs/function.cpp: Removed.
+ * kjs/function.h: Removed.
+ * kjs/function_object.cpp:
+ * kjs/function_object.h:
+ * kjs/grammar.y:
+ * kjs/internal.cpp:
+ * kjs/internal.h: Removed.
+ * kjs/lexer.cpp:
+ * kjs/list.h:
+ * kjs/lookup.h:
+ * kjs/nodes.h:
+ * kjs/object.cpp: Removed.
+ * kjs/object.h: Removed.
+ * kjs/object_object.h:
+ * kjs/operations.cpp:
+ * kjs/property_map.cpp:
+ * kjs/property_slot.cpp:
+ * kjs/property_slot.h:
+ * kjs/protect.h:
+ * kjs/regexp_object.cpp:
+ * kjs/scope_chain.cpp:
+ * kjs/string_object.h:
+ * kjs/ustring.cpp:
+ * kjs/value.cpp: Removed.
+ * kjs/value.h: Removed.
+ * profiler/Profile.cpp:
+ * profiler/Profiler.cpp:
+
+2008-06-15 Darin Adler <darin@apple.com>
+
+ Rubber stamped by Sam.
+
+ - cut down on confusing uses of "Object" and "Imp" in
+ JavaScriptCore class names
+
+ * API/JSCallbackFunction.cpp:
+ (KJS::JSCallbackFunction::JSCallbackFunction):
+ * API/JSCallbackFunction.h:
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+ * kjs/ExecState.h:
+ (KJS::ExecState::regExpTable):
+ (KJS::ExecState::regExpConstructorTable):
+ * kjs/JSGlobalData.cpp:
+ (KJS::JSGlobalData::JSGlobalData):
+ (KJS::JSGlobalData::~JSGlobalData):
+ * kjs/JSGlobalData.h:
+ * kjs/JSGlobalObject.cpp:
+ (KJS::JSGlobalObject::reset):
+ * kjs/JSGlobalObject.h:
+ (KJS::JSGlobalObject::objectConstructor):
+ (KJS::JSGlobalObject::functionConstructor):
+ (KJS::JSGlobalObject::arrayConstructor):
+ (KJS::JSGlobalObject::booleanConstructor):
+ (KJS::JSGlobalObject::stringConstructor):
+ (KJS::JSGlobalObject::numberConstructor):
+ (KJS::JSGlobalObject::dateConstructor):
+ (KJS::JSGlobalObject::regExpConstructor):
+ (KJS::JSGlobalObject::errorConstructor):
+ (KJS::JSGlobalObject::evalErrorConstructor):
+ (KJS::JSGlobalObject::rangeErrorConstructor):
+ (KJS::JSGlobalObject::referenceErrorConstructor):
+ (KJS::JSGlobalObject::syntaxErrorConstructor):
+ (KJS::JSGlobalObject::typeErrorConstructor):
+ (KJS::JSGlobalObject::URIErrorConstructor):
+ * kjs/array_object.cpp:
+ (KJS::ArrayConstructor::ArrayConstructor):
+ (KJS::ArrayConstructor::getConstructData):
+ (KJS::ArrayConstructor::construct):
+ (KJS::ArrayConstructor::callAsFunction):
+ * kjs/array_object.h:
+ * kjs/bool_object.cpp:
+ (KJS::BooleanObject::BooleanObject):
+ (KJS::BooleanPrototype::BooleanPrototype):
+ (KJS::booleanProtoFuncToString):
+ (KJS::booleanProtoFuncValueOf):
+ (KJS::BooleanConstructor::BooleanConstructor):
+ (KJS::BooleanConstructor::getConstructData):
+ (KJS::BooleanConstructor::construct):
+ (KJS::BooleanConstructor::callAsFunction):
+ * kjs/bool_object.h:
+ * kjs/date_object.cpp:
+ (KJS::DatePrototype::DatePrototype):
+ (KJS::DateConstructor::DateConstructor):
+ (KJS::DateConstructor::getConstructData):
+ (KJS::DateConstructor::construct):
+ (KJS::DateConstructor::callAsFunction):
+ (KJS::DateFunction::DateFunction):
+ (KJS::DateFunction::callAsFunction):
+ * kjs/date_object.h:
+ * kjs/error_object.cpp:
+ (KJS::ErrorPrototype::ErrorPrototype):
+ (KJS::ErrorConstructor::ErrorConstructor):
+ (KJS::ErrorConstructor::getConstructData):
+ (KJS::ErrorConstructor::construct):
+ (KJS::ErrorConstructor::callAsFunction):
+ (KJS::NativeErrorConstructor::NativeErrorConstructor):
+ (KJS::NativeErrorConstructor::getConstructData):
+ (KJS::NativeErrorConstructor::construct):
+ (KJS::NativeErrorConstructor::callAsFunction):
+ (KJS::NativeErrorConstructor::mark):
+ * kjs/error_object.h:
+ * kjs/function.cpp:
+ (KJS::JSFunction::JSFunction):
+ (KJS::JSFunction::mark):
+ (KJS::JSFunction::getOwnPropertySlot):
+ (KJS::JSFunction::put):
+ (KJS::JSFunction::deleteProperty):
+ (KJS::PrototypeFunction::PrototypeFunction):
+ (KJS::PrototypeReflexiveFunction::PrototypeReflexiveFunction):
+ (KJS::PrototypeReflexiveFunction::mark):
+ * kjs/function.h:
+ * kjs/function_object.cpp:
+ (KJS::functionProtoFuncToString):
+ (KJS::FunctionConstructor::FunctionConstructor):
+ (KJS::FunctionConstructor::getConstructData):
+ (KJS::FunctionConstructor::construct):
+ (KJS::FunctionConstructor::callAsFunction):
+ * kjs/function_object.h:
+ * kjs/internal.cpp:
+ (KJS::StringObject::create):
+ (KJS::JSString::toObject):
+ (KJS::JSString::toThisObject):
+ (KJS::JSString::getOwnPropertySlot):
+ (KJS::InternalFunction::InternalFunction):
+ (KJS::InternalFunction::getCallData):
+ (KJS::InternalFunction::implementsHasInstance):
+ * kjs/math_object.cpp:
+ (KJS::MathObject::MathObject):
+ (KJS::MathObject::getOwnPropertySlot):
+ (KJS::MathObject::getValueProperty):
+ * kjs/math_object.h:
+ * kjs/number_object.cpp:
+ (KJS::NumberObject::NumberObject):
+ (KJS::NumberPrototype::NumberPrototype):
+ (KJS::numberProtoFuncToString):
+ (KJS::numberProtoFuncToLocaleString):
+ (KJS::numberProtoFuncValueOf):
+ (KJS::numberProtoFuncToFixed):
+ (KJS::numberProtoFuncToExponential):
+ (KJS::numberProtoFuncToPrecision):
+ (KJS::NumberConstructor::NumberConstructor):
+ (KJS::NumberConstructor::getOwnPropertySlot):
+ (KJS::NumberConstructor::getValueProperty):
+ (KJS::NumberConstructor::getConstructData):
+ (KJS::NumberConstructor::construct):
+ (KJS::NumberConstructor::callAsFunction):
+ * kjs/number_object.h:
+ * kjs/object.cpp:
+ (KJS::JSObject::putDirectFunction):
+ * kjs/object.h:
+ * kjs/object_object.cpp:
+ (KJS::ObjectConstructor::ObjectConstructor):
+ (KJS::ObjectConstructor::getConstructData):
+ (KJS::ObjectConstructor::construct):
+ (KJS::ObjectConstructor::callAsFunction):
+ * kjs/object_object.h:
+ * kjs/regexp.cpp:
+ (KJS::RegExp::RegExp):
+ * kjs/regexp_object.cpp:
+ (KJS::regExpProtoFuncTest):
+ (KJS::regExpProtoFuncExec):
+ (KJS::regExpProtoFuncCompile):
+ (KJS::regExpProtoFuncToString):
+ (KJS::RegExpObject::RegExpObject):
+ (KJS::RegExpObject::~RegExpObject):
+ (KJS::RegExpObject::getOwnPropertySlot):
+ (KJS::RegExpObject::getValueProperty):
+ (KJS::RegExpObject::put):
+ (KJS::RegExpObject::putValueProperty):
+ (KJS::RegExpObject::match):
+ (KJS::RegExpObject::test):
+ (KJS::RegExpObject::exec):
+ (KJS::RegExpObject::getCallData):
+ (KJS::RegExpObject::callAsFunction):
+ (KJS::RegExpConstructorPrivate::RegExpConstructorPrivate):
+ (KJS::RegExpConstructor::RegExpConstructor):
+ (KJS::RegExpConstructor::performMatch):
+ (KJS::RegExpMatchesArray::RegExpMatchesArray):
+ (KJS::RegExpMatchesArray::~RegExpMatchesArray):
+ (KJS::RegExpMatchesArray::fillArrayInstance):
+ (KJS::RegExpConstructor::arrayOfMatches):
+ (KJS::RegExpConstructor::getBackref):
+ (KJS::RegExpConstructor::getLastParen):
+ (KJS::RegExpConstructor::getLeftContext):
+ (KJS::RegExpConstructor::getRightContext):
+ (KJS::RegExpConstructor::getOwnPropertySlot):
+ (KJS::RegExpConstructor::getValueProperty):
+ (KJS::RegExpConstructor::put):
+ (KJS::RegExpConstructor::putValueProperty):
+ (KJS::RegExpConstructor::getConstructData):
+ (KJS::RegExpConstructor::construct):
+ (KJS::RegExpConstructor::callAsFunction):
+ (KJS::RegExpConstructor::input):
+ * kjs/regexp_object.h:
+ * kjs/string_object.cpp:
+ (KJS::StringObject::StringObject):
+ (KJS::StringObject::getOwnPropertySlot):
+ (KJS::StringObject::put):
+ (KJS::StringObject::deleteProperty):
+ (KJS::StringObject::getPropertyNames):
+ (KJS::StringPrototype::StringPrototype):
+ (KJS::StringPrototype::getOwnPropertySlot):
+ (KJS::replace):
+ (KJS::stringProtoFuncToString):
+ (KJS::stringProtoFuncValueOf):
+ (KJS::stringProtoFuncCharAt):
+ (KJS::stringProtoFuncCharCodeAt):
+ (KJS::stringProtoFuncConcat):
+ (KJS::stringProtoFuncIndexOf):
+ (KJS::stringProtoFuncLastIndexOf):
+ (KJS::stringProtoFuncMatch):
+ (KJS::stringProtoFuncSearch):
+ (KJS::stringProtoFuncReplace):
+ (KJS::stringProtoFuncSlice):
+ (KJS::stringProtoFuncSplit):
+ (KJS::stringProtoFuncSubstr):
+ (KJS::stringProtoFuncSubstring):
+ (KJS::stringProtoFuncToLowerCase):
+ (KJS::stringProtoFuncToUpperCase):
+ (KJS::stringProtoFuncToLocaleLowerCase):
+ (KJS::stringProtoFuncToLocaleUpperCase):
+ (KJS::stringProtoFuncLocaleCompare):
+ (KJS::stringProtoFuncBig):
+ (KJS::stringProtoFuncSmall):
+ (KJS::stringProtoFuncBlink):
+ (KJS::stringProtoFuncBold):
+ (KJS::stringProtoFuncFixed):
+ (KJS::stringProtoFuncItalics):
+ (KJS::stringProtoFuncStrike):
+ (KJS::stringProtoFuncSub):
+ (KJS::stringProtoFuncSup):
+ (KJS::stringProtoFuncFontcolor):
+ (KJS::stringProtoFuncFontsize):
+ (KJS::stringProtoFuncAnchor):
+ (KJS::stringProtoFuncLink):
+ (KJS::StringConstructor::StringConstructor):
+ (KJS::StringConstructor::getConstructData):
+ (KJS::StringConstructor::construct):
+ (KJS::StringConstructor::callAsFunction):
+ (KJS::StringConstructorFunction::StringConstructorFunction):
+ (KJS::StringConstructorFunction::callAsFunction):
+ * kjs/string_object.h:
+ (KJS::StringObjectThatMasqueradesAsUndefined::StringObjectThatMasqueradesAsUndefined):
+ * profiler/Profiler.cpp:
+ (KJS::createCallIdentifier):
+
+2008-06-15 Darin Adler <darin@apple.com>
+
+ Rubber stamped by Sam.
+
+ - use JS prefix and simpler names for basic JavaScriptCore types,
+ to complement JSValue and JSObject
+
+ * JavaScriptCore.exp:
+ * VM/Machine.cpp:
+ (KJS::jsLess):
+ (KJS::jsLessEq):
+ (KJS::jsAdd):
+ (KJS::callEval):
+ (KJS::Machine::execute):
+ (KJS::Machine::retrieveArguments):
+ (KJS::Machine::retrieveCaller):
+ (KJS::Machine::getCallFrame):
+ (KJS::Machine::getFunctionAndArguments):
+ * VM/Machine.h:
+ * VM/Register.h:
+ * kjs/DebuggerCallFrame.cpp:
+ (KJS::DebuggerCallFrame::functionName):
+ * kjs/ExecState.h:
+ * kjs/JSActivation.cpp:
+ (KJS::JSActivation::createArgumentsObject):
+ * kjs/array_instance.cpp:
+ (KJS::JSArray::checkConsistency):
+ (KJS::JSArray::JSArray):
+ (KJS::JSArray::~JSArray):
+ (KJS::JSArray::getItem):
+ (KJS::JSArray::lengthGetter):
+ (KJS::JSArray::inlineGetOwnPropertySlot):
+ (KJS::JSArray::getOwnPropertySlot):
+ (KJS::JSArray::put):
+ (KJS::JSArray::deleteProperty):
+ (KJS::JSArray::getPropertyNames):
+ (KJS::JSArray::increaseVectorLength):
+ (KJS::JSArray::setLength):
+ (KJS::JSArray::mark):
+ (KJS::JSArray::sort):
+ (KJS::JSArray::compactForSorting):
+ (KJS::JSArray::lazyCreationData):
+ (KJS::JSArray::setLazyCreationData):
+ * kjs/array_instance.h:
+ * kjs/array_object.cpp:
+ (KJS::ArrayPrototype::ArrayPrototype):
+ (KJS::ArrayPrototype::getOwnPropertySlot):
+ (KJS::arrayProtoFuncToString):
+ (KJS::arrayProtoFuncToLocaleString):
+ (KJS::arrayProtoFuncConcat):
+ (KJS::arrayProtoFuncSort):
+ (KJS::ArrayObjectImp::construct):
+ * kjs/array_object.h:
+ * kjs/completion.h:
+ * kjs/function.cpp:
+ (KJS::JSFunction::JSFunction):
+ (KJS::JSFunction::mark):
+ (KJS::JSFunction::getCallData):
+ (KJS::JSFunction::callAsFunction):
+ (KJS::JSFunction::argumentsGetter):
+ (KJS::JSFunction::callerGetter):
+ (KJS::JSFunction::lengthGetter):
+ (KJS::JSFunction::getOwnPropertySlot):
+ (KJS::JSFunction::put):
+ (KJS::JSFunction::deleteProperty):
+ (KJS::JSFunction::getParameterName):
+ (KJS::JSFunction::getConstructData):
+ (KJS::JSFunction::construct):
+ (KJS::IndexToNameMap::IndexToNameMap):
+ (KJS::Arguments::Arguments):
+ * kjs/function.h:
+ * kjs/function_object.cpp:
+ (KJS::functionProtoFuncToString):
+ (KJS::functionProtoFuncApply):
+ (KJS::FunctionObjectImp::construct):
+ * kjs/internal.cpp:
+ (KJS::JSString::toPrimitive):
+ (KJS::JSString::getPrimitiveNumber):
+ (KJS::JSString::toBoolean):
+ (KJS::JSString::toNumber):
+ (KJS::JSString::toString):
+ (KJS::StringInstance::create):
+ (KJS::JSString::toObject):
+ (KJS::JSString::toThisObject):
+ (KJS::JSString::lengthGetter):
+ (KJS::JSString::indexGetter):
+ (KJS::JSString::indexNumericPropertyGetter):
+ (KJS::JSString::getOwnPropertySlot):
+ (KJS::JSNumberCell::type):
+ (KJS::JSNumberCell::toPrimitive):
+ (KJS::JSNumberCell::getPrimitiveNumber):
+ (KJS::JSNumberCell::toBoolean):
+ (KJS::JSNumberCell::toNumber):
+ (KJS::JSNumberCell::toString):
+ (KJS::JSNumberCell::toObject):
+ (KJS::JSNumberCell::toThisObject):
+ (KJS::JSNumberCell::getUInt32):
+ (KJS::JSNumberCell::getTruncatedInt32):
+ (KJS::JSNumberCell::getTruncatedUInt32):
+ (KJS::GetterSetter::mark):
+ (KJS::GetterSetter::toPrimitive):
+ (KJS::GetterSetter::getPrimitiveNumber):
+ (KJS::GetterSetter::toBoolean):
+ (KJS::GetterSetter::toNumber):
+ (KJS::GetterSetter::toString):
+ (KJS::GetterSetter::toObject):
+ (KJS::GetterSetter::getOwnPropertySlot):
+ (KJS::GetterSetter::put):
+ (KJS::GetterSetter::toThisObject):
+ * kjs/internal.h:
+ (KJS::JSString::JSString):
+ (KJS::JSString::getStringPropertySlot):
+ * kjs/nodes.cpp:
+ (KJS::FuncDeclNode::makeFunction):
+ (KJS::FuncExprNode::makeFunction):
+ * kjs/nodes.h:
+ * kjs/object.cpp:
+ (KJS::JSObject::put):
+ (KJS::JSObject::deleteProperty):
+ (KJS::JSObject::defineGetter):
+ (KJS::JSObject::defineSetter):
+ (KJS::JSObject::lookupGetter):
+ (KJS::JSObject::lookupSetter):
+ (KJS::JSObject::fillGetterPropertySlot):
+ * kjs/object.h:
+ (KJS::GetterSetter::GetterSetter):
+ * kjs/operations.cpp:
+ (KJS::equal):
+ (KJS::strictEqual):
+ * kjs/property_map.cpp:
+ (KJS::PropertyMap::containsGettersOrSetters):
+ * kjs/regexp_object.cpp:
+ (KJS::RegExpMatchesArray::getOwnPropertySlot):
+ (KJS::RegExpMatchesArray::put):
+ (KJS::RegExpMatchesArray::deleteProperty):
+ (KJS::RegExpMatchesArray::getPropertyNames):
+ (KJS::RegExpMatchesArray::RegExpMatchesArray):
+ (KJS::RegExpMatchesArray::fillArrayInstance):
+ * kjs/string_object.cpp:
+ (KJS::StringInstance::StringInstance):
+ (KJS::replace):
+ (KJS::stringProtoFuncReplace):
+ (KJS::stringProtoFuncToLowerCase):
+ (KJS::stringProtoFuncToUpperCase):
+ (KJS::stringProtoFuncToLocaleLowerCase):
+ (KJS::stringProtoFuncToLocaleUpperCase):
+ * kjs/string_object.h:
+ (KJS::StringInstance::internalValue):
+ * kjs/value.cpp:
+ (KJS::JSCell::getNumber):
+ (KJS::JSCell::getString):
+ (KJS::JSCell::getObject):
+ (KJS::jsString):
+ (KJS::jsOwnedString):
+ * kjs/value.h:
+ (KJS::JSNumberCell::JSNumberCell):
+ (KJS::jsNumberCell):
+ (KJS::JSValue::uncheckedGetNumber):
+ * profiler/Profiler.cpp:
+ (KJS::createCallIdentifier):
+ (KJS::createCallIdentifierFromFunctionImp):
+
+2008-06-15 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Alexey.
+
+ - add emitUnaryOp, emitNullaryOp and emitUnaryOpNoDst; use them
+
+ This removes some boilerplate code and also reduces the number of
+ places that will need to be changed to do on-demand emit of
+ loads (and thus support k operands).
+
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::emitUnaryOp):
+ (KJS::CodeGenerator::emitNullaryOp):
+ (KJS::CodeGenerator::emitUnaryOpNoDst):
+ (KJS::CodeGenerator::emitPushScope):
+ * VM/CodeGenerator.h:
+ (KJS::CodeGenerator::emitNewObject):
+ (KJS::CodeGenerator::emitNewArray):
+ (KJS::CodeGenerator::emitNot):
+ (KJS::CodeGenerator::emitBitNot):
+ (KJS::CodeGenerator::emitToJSNumber):
+ (KJS::CodeGenerator::emitNegate):
+ (KJS::CodeGenerator::emitInstanceOf):
+ (KJS::CodeGenerator::emitTypeOf):
+ (KJS::CodeGenerator::emitIn):
+ (KJS::CodeGenerator::emitReturn):
+ (KJS::CodeGenerator::emitEnd):
+ (KJS::CodeGenerator::emitGetPropertyNames):
+
+2008-06-15 Alp Toker <alp@nuanti.com>
+
+ Rubber-stamped by Maciej.
+
+ Install 'jsc' application by default.
+
+ * GNUmakefile.am:
+
+2008-06-15 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver.
+
+ - rename testkjs to jsc
+
+ * GNUmakefile.am:
+ * JavaScriptCore.vcproj/JavaScriptCore.sln:
+ * JavaScriptCore.vcproj/jsc: Added.
+ * JavaScriptCore.vcproj/jsc/jsc.vcproj: Copied from JavaScriptCore.vcproj/testkjs/testkjs.vcproj.
+ * JavaScriptCore.vcproj/testkjs: Removed.
+ * JavaScriptCore.vcproj/testkjs/testkjs.vcproj: Removed.
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * jscore.bkl:
+ * kjs/Shell.cpp: Copied from kjs/testkjs.cpp.
+ (main):
+ (printUsageStatement):
+ (jscmain):
+ * kjs/jsc.pro: Copied from kjs/testkjs.pro.
+ * kjs/testkjs.cpp: Removed.
+ * kjs/testkjs.pro: Removed.
+ * tests/mozilla/expected.html:
+ * tests/mozilla/js1_2/Array/tostring_1.js:
+ * tests/mozilla/js1_2/Array/tostring_2.js:
+ * tests/mozilla/jsDriver.pl:
+
+2008-06-15 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Maciej.
+
+ Mac build fix.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * kjs/nodes.h:
+
+2008-06-15 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Maciej.
+
+ Change the spelling of PrecMultiplicitave to PrecMultiplicative.
+
+ * kjs/nodes.h:
+ (KJS::MultNode::precedence):
+ (KJS::DivNode::precedence):
+ (KJS::ModNode::precedence):
+
+2008-06-15 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Maciej.
+
+ Remove unused preprocessor macros related to exceptions in the old
+ interpreter.
+
+ * kjs/nodes.cpp:
+
+2008-06-15 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Maciej.
+
+ Bug 19484: More instructions needs to use temporary registers
+ <https://bugs.webkit.org/show_bug.cgi?id=19484>
+
+ Fix codegen for all binary operations so that temporaries are used if
+ necessary. This was done by making BinaryOpNode and ReverseBinaryOpNode
+ subclasses of ExpressionNode, and eliminating the custom emitCode()
+ methods for the individual node classes.
+
+ This only adds 3 new instructions to SunSpider code, and there is no
+ difference in SunSpider execution time.
+
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::emitBitNot):
+ (KJS::CodeGenerator::emitBinaryOp):
+ * VM/CodeGenerator.h:
+ * kjs/grammar.y:
+ * kjs/nodes.cpp:
+ (KJS::PreIncResolveNode::emitCode):
+ (KJS::PreDecResolveNode::emitCode):
+ (KJS::BinaryOpNode::emitCode):
+ (KJS::ReverseBinaryOpNode::emitCode):
+ (KJS::emitReadModifyAssignment):
+ (KJS::CaseBlockNode::emitCodeForBlock):
+ * kjs/nodes.h:
+ (KJS::BinaryOpNode::BinaryOpNode):
+ (KJS::ReverseBinaryOpNode::ReverseBinaryOpNode):
+ (KJS::MultNode::):
+ (KJS::DivNode::):
+ (KJS::DivNode::precedence):
+ (KJS::ModNode::):
+ (KJS::ModNode::precedence):
+ (KJS::AddNode::):
+ (KJS::AddNode::precedence):
+ (KJS::SubNode::):
+ (KJS::SubNode::precedence):
+ (KJS::LeftShiftNode::):
+ (KJS::LeftShiftNode::precedence):
+ (KJS::RightShiftNode::):
+ (KJS::RightShiftNode::precedence):
+ (KJS::UnsignedRightShiftNode::):
+ (KJS::UnsignedRightShiftNode::precedence):
+ (KJS::LessNode::):
+ (KJS::LessNode::precedence):
+ (KJS::GreaterNode::):
+ (KJS::GreaterNode::precedence):
+ (KJS::LessEqNode::):
+ (KJS::LessEqNode::precedence):
+ (KJS::GreaterEqNode::):
+ (KJS::GreaterEqNode::precedence):
+ (KJS::InstanceOfNode::):
+ (KJS::InstanceOfNode::precedence):
+ (KJS::InNode::):
+ (KJS::InNode::precedence):
+ (KJS::EqualNode::):
+ (KJS::EqualNode::precedence):
+ (KJS::NotEqualNode::):
+ (KJS::NotEqualNode::precedence):
+ (KJS::StrictEqualNode::):
+ (KJS::StrictEqualNode::precedence):
+ (KJS::NotStrictEqualNode::):
+ (KJS::NotStrictEqualNode::precedence):
+ (KJS::BitAndNode::):
+ (KJS::BitAndNode::precedence):
+ (KJS::BitOrNode::):
+ (KJS::BitOrNode::precedence):
+ (KJS::BitXOrNode::):
+ (KJS::BitXOrNode::precedence):
+ * kjs/nodes2string.cpp:
+ (KJS::LessNode::streamTo):
+ (KJS::GreaterNode::streamTo):
+ (KJS::LessEqNode::streamTo):
+ (KJS::GreaterEqNode::streamTo):
+ (KJS::InstanceOfNode::streamTo):
+ (KJS::InNode::streamTo):
+ (KJS::EqualNode::streamTo):
+ (KJS::NotEqualNode::streamTo):
+ (KJS::StrictEqualNode::streamTo):
+ (KJS::NotStrictEqualNode::streamTo):
+ (KJS::BitAndNode::streamTo):
+ (KJS::BitXOrNode::streamTo):
+ (KJS::BitOrNode::streamTo):
+
+2008-06-14 Darin Adler <darin@apple.com>
+
+ Rubber stamped by Sam.
+
+ - rename a bunch of local symbols within the regular expression code to
+ follow our usual coding style, and do a few other name tweaks
+
+ * pcre/pcre_compile.cpp:
+ (CompileData::CompileData):
+ (checkEscape):
+ (readRepeatCounts):
+ (compileBranch):
+ (compileBracket):
+ (calculateCompiledPatternLength):
+ (returnError):
+ (jsRegExpCompile):
+ * pcre/pcre_exec.cpp:
+ (MatchStack::MatchStack):
+ (MatchStack::canUseStackBufferForNextFrame):
+ (MatchStack::popCurrentFrame):
+ (match):
+ (tryFirstByteOptimization):
+ (tryRequiredByteOptimization):
+ (jsRegExpExecute):
+ * pcre/pcre_internal.h:
+
+2008-06-14 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Darin.
+
+ Remove redundant uses of get().
+
+ * kjs/nodes.cpp:
+ (KJS::BracketAccessorNode::emitCode):
+ (KJS::AddNode::emitCode):
+ (KJS::SubNode::emitCode):
+ (KJS::ReadModifyResolveNode::emitCode):
+ (KJS::AssignDotNode::emitCode):
+ (KJS::ReadModifyDotNode::emitCode):
+ (KJS::AssignBracketNode::emitCode):
+ (KJS::ReadModifyBracketNode::emitCode):
+
+2008-06-14 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Maciej.
+
+ Make code generation not use a temporary for the left-hand side of an
+ expression if the right-hand side is a local variable.
+
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::isLocal):
+ * VM/CodeGenerator.h:
+ (KJS::CodeGenerator::leftHandSideNeedsCopy):
+ (KJS::CodeGenerator::emitNodeForLeftHandSide):
+ * kjs/nodes.cpp:
+ (KJS::ResolveNode::isPure):
+ (KJS::BracketAccessorNode::emitCode):
+ (KJS::AddNode::emitCode):
+ (KJS::SubNode::emitCode):
+ (KJS::ReadModifyResolveNode::emitCode):
+ (KJS::AssignDotNode::emitCode):
+ (KJS::ReadModifyDotNode::emitCode):
+ (KJS::AssignBracketNode::emitCode):
+ (KJS::ReadModifyBracketNode::emitCode):
+ * kjs/nodes.h:
+ (KJS::ExpressionNode::):
+ (KJS::BooleanNode::):
+ (KJS::NumberNode::):
+ (KJS::StringNode::):
+
+2008-06-14 Darin Adler <darin@apple.com>
+
+ Reviewed by Sam.
+
+ - more of https://bugs.webkit.org/show_bug.cgi?id=17257
+ start ref counts at 1 instead of 0 for speed
+
+ * kjs/nodes.cpp:
+ (KJS::ParserRefCounted::hasOneRef): Added. Replaces refcount.
+ * kjs/nodes.h: Replaced refcount with hasOneRef.
+
+ * wtf/ListRefPtr.h:
+ (WTF::ListRefPtr::~ListRefPtr): Changed to use hasOneRef instead of
+ refcount, so this class can be used with the RefCounted template.
+
+ * wtf/RefCounted.h:
+ (WTF::RefCounted::hasOneRef): Made const, since there's no reason for
+ it to be non-const.
+
+2008-06-14 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver.
+
+ - initialize local vars as side effect of call instead of in bytecode
+ 1.004x speedup on SunSpider.
+
+ This removes just the dispatch overhead for these loads - in the
+ future, dead store elimination might be able to eliminate them
+ entirely.
+
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::CodeGenerator): For function blocks, don't
+ emit loads of undefined for var initialization.
+ * VM/Machine.cpp:
+ (KJS::slideRegisterWindowForCall): Instead, initialize locals
+ as part of the call.
+
+2008-06-14 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Oliver.
+
+ Remove helper functions in the parser that are no longer needed.
+
+ * kjs/grammar.y:
+
+2008-06-14 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Oliver.
+
+ Bug 19484: More instructions needs to use temporary registers
+ <https://bugs.webkit.org/show_bug.cgi?id=19484>
+
+ Make code generation for AddNode and SubNode use temporaries when
+ necessary.
+
+ * kjs/grammar.y:
+ * kjs/nodes.cpp:
+ (KJS::AddNode::emitCode):
+ (KJS::SubNode::emitCode):
+ * kjs/nodes.h:
+ (KJS::AddNode::):
+ (KJS::SubNode::):
+
+2008-06-13 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Maciej.
+
+ Combine TrueNode and FalseNode to make BooleanNode, and remove the
+ unused class PlaceholderTrueNode.
+
+ * kjs/grammar.y:
+ * kjs/nodes.cpp:
+ (KJS::BooleanNode::emitCode):
+ * kjs/nodes.h:
+ (KJS::BooleanNode::):
+ (KJS::BooleanNode::precedence):
+ * kjs/nodes2string.cpp:
+ (KJS::BooleanNode::streamTo):
+
+2008-06-13 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Maciej.
+
+ Eliminate the use of temporaries to store the left hand side of an
+ expression when the right hand side is a constant. This slightly
+ improves the generated bytecode for a few SunSpider tests, but it is
+ mostly in preparation for fixing
+
+ Bug 19484: More instructions needs to use temporary registers
+ <https://bugs.webkit.org/show_bug.cgi?id=19484>
+
+ * VM/CodeGenerator.h:
+ (KJS::CodeGenerator::leftHandSideNeedsCopy):
+ (KJS::CodeGenerator::emitNodeForLeftHandSide):
+ * kjs/nodes.cpp:
+ (KJS::BracketAccessorNode::emitCode):
+ (KJS::ReadModifyResolveNode::emitCode):
+ (KJS::AssignDotNode::emitCode):
+ (KJS::ReadModifyDotNode::emitCode):
+ (KJS::AssignBracketNode::emitCode):
+ (KJS::ReadModifyBracketNode::emitCode):
+ * kjs/nodes.h:
+ (KJS::ExpressionNode::):
+ (KJS::FalseNode::):
+ (KJS::TrueNode::):
+ (KJS::NumberNode::):
+ (KJS::StringNode::):
+
+2008-06-13 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver.
+
+ - prettify opcode stats output
+
+ I changed things to be a bit more aligned, also there is a new
+ section listing most common opcodes and most common sequences that
+ include them.
+
+ * VM/Opcode.cpp:
+ (KJS::OpcodeStats::~OpcodeStats):
+ * VM/Opcode.h:
+
+2008-06-13 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Geoff.
+
+ <rdar://problem/5969992> JSProfiler: Remove the recursion limit in the
+ profiler.
+ - Remove recursion from exclude(). This leaves only focus() to fix.
+
+ * JavaScriptCore.exp: Change the signatures of the exported functions.
+ * profiler/Profile.cpp:
+ (KJS::Profile::forEach): I added a traverseNextNodePreOrder() function
+ and so needed to distinguish the other function by labeling it
+ traverseNextNodePostOrder().
+ (KJS::Profile::exclude): All new exclude that iteratively walks the tree
+ * profiler/Profile.h:
+ (KJS::Profile::focus): Add a null check for m_head.
+ * profiler/ProfileNode.cpp:
+ (KJS::ProfileNode::traverseNextNodePostOrder): Renamed
+ (KJS::ProfileNode::traverseNextNodePreOrder): Walks the tree in pre-
+ order, where the parent is processed before the children.
+ (KJS::ProfileNode::setTreeVisible): Iterate over the sub-tree and set
+ all of the nodes visible value. This changes another function that used
+ recursion.
+ (KJS::ProfileNode::exclude): Remove recursion from this function.
+ Because we now check for m_visible and we are walking the tree in pre-
+ order we do not need to check if an excluded node is in an excluded
+ sub-tree.
+ * profiler/ProfileNode.h: Added specific selfTime functions to
+ facilitate exclude().
+ (KJS::ProfileNode::setSelfTime):
+ (KJS::ProfileNode::setActualSelfTime):
+ (KJS::ProfileNode::setVisibleSelfTime):
+
+2008-06-12 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - https://bugs.webkit.org/show_bug.cgi?id=19434
+ speed up SunSpider by avoiding some string boxing
+
+ Speeds up SunSpider by 1.1%.
+
+ Optimized code path for getting built-in properties from strings -- avoid
+ boxing with a string object in that case. We can make further changes to avoid
+ even more boxing, but this change alone is a win.
+
+ * API/JSCallbackObjectFunctions.h:
+ (KJS::JSCallbackObject::staticValueGetter): Use isObject instead of inherits
+ in asssert, since the type of slotBase() is now JSValue, not JSObject.
+ (KJS::JSCallbackObject::staticFunctionGetter): Ditto.
+ (KJS::JSCallbackObject::callbackGetter): Ditto.
+
+ * kjs/internal.cpp:
+ (KJS::StringImp::getPrimitiveNumber): Updated for change of data member name.
+ (KJS::StringImp::toBoolean): Ditto.
+ (KJS::StringImp::toNumber): Ditto.
+ (KJS::StringImp::toString): Ditto.
+ (KJS::StringInstance::create): Added; avoids a bit of cut and paste code.
+ (KJS::StringImp::toObject): Use StringInstance::create.
+ (KJS::StringImp::toThisObject): Ditto.
+ (KJS::StringImp::lengthGetter): Added. Replaces the getter that used to live in
+ the StringInstance class.
+ (KJS::StringImp::indexGetter): Ditto.
+ (KJS::StringImp::indexNumericPropertyGetter): Ditto.
+ (KJS::StringImp::getOwnPropertySlot): Added. Deals with built in properties of
+ the string class without creating a StringInstance.
+
+ * kjs/internal.h:
+ (KJS::StringImp::getStringPropertySlot): Added. To be used by both the string
+ and string object getOwnPropertySlot function.
+
+ * kjs/lookup.h:
+ (KJS::staticFunctionGetter): Updated since slotBase() is now a JSValue rather
+ than a JSObject.
+
+ * kjs/object.h: Removed PropertySlot::slotBase() function, which can now move
+ back into property_slot.h where it belongs since it doesn't have to cast to
+ JSObject*.
+
+ * kjs/property_slot.cpp:
+ (KJS::PropertySlot::functionGetter): Updated since slot.slotBase() is now a JSValue*
+ instead of JSObject*. setGetterSlot still guarantees the base is a JSObject*.
+ * kjs/property_slot.h:
+ (KJS::PropertySlot::PropertySlot): Changed base to JSValue* intead of JSCell*.
+ (KJS::PropertySlot::setStaticEntry): Ditto.
+ (KJS::PropertySlot::setCustom): Ditto.
+ (KJS::PropertySlot::setCustomIndex): Ditto.
+ (KJS::PropertySlot::setCustomNumeric): Ditto.
+ (KJS::PropertySlot::slotBase): Moved inline here since it no longer involves a
+ downcast to JSObject*.
+ (KJS::PropertySlot::setBase): Changed to JSValue*.
+
+ * kjs/string_object.cpp:
+ (KJS::StringInstance::getOwnPropertySlot): Changed to use getStringPropertySlot
+ instead of coding the properties here. This allows sharing the code with StringImp.
+
+ * kjs/string_object.h: Removed inlineGetOwnPropertySlot, lengthGetter, and indexGetter.
+ Made one of the constructors protected.
+
+ * kjs/value.h: Made getOwnPropertySlot private in the JSCell class -- this is better
+ since it's not the real JSObject getOwnPropertySlot semantic and most callers shouldn't
+ use it.
+
+2008-06-12 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Maciej.
+
+ Preparation to making JavaScript heap per-thread.
+
+ * kjs/collector.cpp:
+ (KJS::Collector::collect):
+ * kjs/collector.h:
+ (KJS::Collector::markListSet):
+ The collector now holds the list of protected lists itself, to be made per-instance.
+
+ * kjs/list.h: Changed to hold a pointer to a mark set this list is in, if any.
+ (KJS::List::List): Explicitly initialize m_size with zero, as m_vector.size() is
+ guaranteed to be such anyway.
+ (KJS::List::append): Changed the fast case to only be executed as long as inline buffer
+ is used, because otherwise, we now do more expensive checks.
+
+ * kjs/list.cpp:
+ (KJS::List::markLists): Renamed from markProtectedListsSlowCase, made it take the list set
+ as a parameter.
+ (KJS::List::slowAppend): If a non-immediate value is appended, the list needs to be added
+ to an appropriate Heap's protected list. For now, a static Collector::markListSet() is
+ used, but the code is layed out in preparation to making the switch to multiple heaps.
+
+ * JavaScriptCore.exp: Updated export list.
+
+2008-06-12 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Maciej.
+
+ Bug 19510: CodeBlock::needsFullScopeChain not always set for global code
+ <https://bugs.webkit.org/show_bug.cgi?id=19510>
+
+ This fixes the symptoms by using CodeGenerator::m_codeType to determine
+ when to use temporaries instead of CodeBlock::needsFullScopeChain, but
+ it does not fix the problem itself.
+
+ * VM/CodeGenerator.h:
+ (KJS::CodeGenerator::leftHandSideNeedsCopy):
+
+2008-06-11 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Maciej.
+
+ Bug 19498: REGRESSION (r34497): crash while loading GMail
+ <https://bugs.webkit.org/show_bug.cgi?id=19498>
+
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::emitJumpIfTrueMayCombine):
+ (KJS::CodeGenerator::emitJumpIfTrue):
+ * VM/CodeGenerator.h:
+ * kjs/nodes.cpp:
+ (KJS::DoWhileNode::emitCode):
+ (KJS::WhileNode::emitCode):
+ (KJS::ForNode::emitCode):
+ (KJS::CaseBlockNode::emitCodeForBlock):
+
+2008-06-11 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - a little bit of cleanup and prep for some upcoming optimizations
+
+ * JavaScriptCore.exp: Re-sorted this file (with sort command line tool).
+ * VM/CodeBlock.cpp:
+ (KJS::CodeBlock::dump): Fixed printf to avoid warnings -- to use %lu we
+ need to make sure the type is unsigned long.
+ * kjs/object.cpp:
+ (KJS::Error::create): Eliminated unused error names array, and also put
+ the strings into the code since there was already a switch statment.
+ This also avoids having to contemplate a hypothetical access past the
+ end of the array.
+ * kjs/object.h: Got rid of errorNames.
+ * kjs/property_slot.cpp: Deleted unused ungettableGetter.
+ * kjs/property_slot.h: Ditto.
+ * wtf/AlwaysInline.h: Added LIKELY alongside UNLIKELY.
+
+2008-06-11 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Darin.
+
+ Bug 19457: Create fused opcodes for tests and conditional jumps
+ <https://bugs.webkit.org/show_bug.cgi?id=19457>
+
+ Add a new jless instruction, and modify the code generator to emit it
+ instead of the pair (less, jtrue).
+
+ Gives a 3.6% improvement on SunSpider.
+
+ * VM/CodeBlock.cpp:
+ (KJS::CodeBlock::dump):
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::CodeGenerator):
+ (KJS::CodeGenerator::emitOpcode):
+ (KJS::CodeGenerator::retrieveLastBinaryOp):
+ (KJS::CodeGenerator::rewindBinaryOp):
+ (KJS::CodeGenerator::emitJump):
+ (KJS::CodeGenerator::emitJumpIfTrue):
+ (KJS::CodeGenerator::emitJumpIfFalse):
+ (KJS::CodeGenerator::emitMove):
+ (KJS::CodeGenerator::emitNot):
+ (KJS::CodeGenerator::emitEqual):
+ (KJS::CodeGenerator::emitNotEqual):
+ (KJS::CodeGenerator::emitStrictEqual):
+ (KJS::CodeGenerator::emitNotStrictEqual):
+ (KJS::CodeGenerator::emitLess):
+ (KJS::CodeGenerator::emitLessEq):
+ (KJS::CodeGenerator::emitPreInc):
+ (KJS::CodeGenerator::emitPreDec):
+ (KJS::CodeGenerator::emitPostInc):
+ (KJS::CodeGenerator::emitPostDec):
+ (KJS::CodeGenerator::emitToJSNumber):
+ (KJS::CodeGenerator::emitNegate):
+ (KJS::CodeGenerator::emitAdd):
+ (KJS::CodeGenerator::emitMul):
+ (KJS::CodeGenerator::emitDiv):
+ (KJS::CodeGenerator::emitMod):
+ (KJS::CodeGenerator::emitSub):
+ (KJS::CodeGenerator::emitLeftShift):
+ (KJS::CodeGenerator::emitRightShift):
+ (KJS::CodeGenerator::emitUnsignedRightShift):
+ (KJS::CodeGenerator::emitBitAnd):
+ (KJS::CodeGenerator::emitBitXOr):
+ (KJS::CodeGenerator::emitBitOr):
+ (KJS::CodeGenerator::emitBitNot):
+ (KJS::CodeGenerator::emitInstanceOf):
+ (KJS::CodeGenerator::emitTypeOf):
+ (KJS::CodeGenerator::emitIn):
+ (KJS::CodeGenerator::emitLoad):
+ (KJS::CodeGenerator::emitNewObject):
+ (KJS::CodeGenerator::emitNewArray):
+ (KJS::CodeGenerator::emitResolve):
+ (KJS::CodeGenerator::emitGetScopedVar):
+ (KJS::CodeGenerator::emitPutScopedVar):
+ (KJS::CodeGenerator::emitResolveBase):
+ (KJS::CodeGenerator::emitResolveWithBase):
+ (KJS::CodeGenerator::emitResolveFunction):
+ (KJS::CodeGenerator::emitGetById):
+ (KJS::CodeGenerator::emitPutById):
+ (KJS::CodeGenerator::emitPutGetter):
+ (KJS::CodeGenerator::emitPutSetter):
+ (KJS::CodeGenerator::emitDeleteById):
+ (KJS::CodeGenerator::emitGetByVal):
+ (KJS::CodeGenerator::emitPutByVal):
+ (KJS::CodeGenerator::emitDeleteByVal):
+ (KJS::CodeGenerator::emitPutByIndex):
+ (KJS::CodeGenerator::emitNewFunction):
+ (KJS::CodeGenerator::emitNewRegExp):
+ (KJS::CodeGenerator::emitNewFunctionExpression):
+ (KJS::CodeGenerator::emitCall):
+ (KJS::CodeGenerator::emitReturn):
+ (KJS::CodeGenerator::emitEnd):
+ (KJS::CodeGenerator::emitConstruct):
+ (KJS::CodeGenerator::emitPushScope):
+ (KJS::CodeGenerator::emitPopScope):
+ (KJS::CodeGenerator::emitDebugHook):
+ (KJS::CodeGenerator::emitComplexJumpScopes):
+ (KJS::CodeGenerator::emitJumpScopes):
+ (KJS::CodeGenerator::emitNextPropertyName):
+ (KJS::CodeGenerator::emitGetPropertyNames):
+ (KJS::CodeGenerator::emitCatch):
+ (KJS::CodeGenerator::emitThrow):
+ (KJS::CodeGenerator::emitNewError):
+ (KJS::CodeGenerator::emitJumpSubroutine):
+ (KJS::CodeGenerator::emitSubroutineReturn):
+ * VM/CodeGenerator.h:
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+ * VM/Opcode.cpp:
+ * VM/Opcode.h:
+
+2008-06-11 Darin Adler <darin@apple.com>
+
+ Reviewed by Alexey.
+
+ - fix https://bugs.webkit.org/show_bug.cgi?id=19442
+ JavaScript array implementation doesn't maintain m_numValuesInVector when sorting
+
+ * kjs/array_instance.cpp:
+ (KJS::ArrayInstance::checkConsistency): Added. Empty inline version for when
+ consistency checks are turned off.
+ (KJS::ArrayInstance::ArrayInstance): Check consistency after construction.
+ (KJS::ArrayInstance::~ArrayInstance): Check consistency before destruction.
+ (KJS::ArrayInstance::put): Check consistency before and after.
+ (KJS::ArrayInstance::deleteProperty): Ditto.
+ (KJS::ArrayInstance::setLength): Ditto.
+ (KJS::compareByStringPairForQSort): Use typedef for clarity.
+ (KJS::ArrayInstance::sort): Check consistency before and after. Also broke the loop
+ to set up sorting into two separate passes. Added FIXMEs about various exception
+ safety issues. Added code to set m_numValuesInVector after sorting.
+ (KJS::ArrayInstance::compactForSorting): Ditto.
+
+ * kjs/array_instance.h: Added a definition of an enum for the types of consistency
+ check and a declaration of the consistency checking function.
+
+2008-06-10 Kevin Ollivier <kevino@theolliviers.com>
+
+ wx build fix. Link against libedit on Mac since HAVE(READLINE) is defined there.
+
+ * jscore.bkl:
+
+2008-06-10 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Darin.
+
+ https://bugs.webkit.org/show_bug.cgi?id=16503
+ match limit takes at least 13% of the time on the SunSpider regexp-dna test
+
+ Make the limit test slightly more efficient. It is not clear how much of a win it is,
+ as the improvement on regexp-dna varies from 2.3% to 0.6% depending on what revision I
+ apply the patch to. Today, the win on regexp-dna was minimal, but the total win was whopping
+ 0.5%, due to random code generation changes.
+
+ * pcre/pcre_exec.cpp: (match): Avoid loading a constant on each iteration.
+
+2008-06-09 Alp Toker <alp@nuanti.com>
+
+ gcc3/autotools build fix. Add explicit -O2 -fno-strict-aliasing to
+ each of the tools since these are no longer set globally.
+
+ * GNUmakefile.am:
+
+2008-06-09 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Sam.
+
+ Add an include for readline/history.h to fix the build for Darwin users
+ with the GNU readline library installed. Also, clean up the style of
+ the HAVE(READLINE) check.
+
+ * kjs/testkjs.cpp:
+ (runInteractive):
+
+2008-06-09 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Darin.
+
+ Bug 17531: Add interactive mode to testkjs
+ <https://bugs.webkit.org/show_bug.cgi?id=17531>
+
+ This is a cleaned up version of Sam's earlier patch to add an
+ interactive mode to testkjs.
+
+ Readline support is only enabled on Darwin platforms for now, but
+ other ports can enable it by defining HAVE_READLINE in kjs/config.h.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * kjs/config.h:
+ * kjs/testkjs.cpp:
+ (Options::Options):
+ (runWithScripts):
+ (runInteractive):
+ (printUsageStatement):
+ (parseArguments):
+ (kjsmain):
+
+2008-06-08 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Darin.
+
+ Bug 19346: REGRESSION: Mootools 1.2 Class inheritance broken in post-SquirrelFish merge
+ <https://bugs.webkit.org/show_bug.cgi?id=19346>
+
+ A check for whether a function's caller is eval code accidentally included
+ the case where the caller's caller is native code. Add a CodeType field to
+ CodeBlock and use this for the eval caller test instead.
+
+ * VM/CodeBlock.h:
+ (KJS::CodeBlock::CodeBlock):
+ (KJS::ProgramCodeBlock::ProgramCodeBlock):
+ (KJS::EvalCodeBlock::EvalCodeBlock):
+ * VM/Machine.cpp:
+ (KJS::getCallerFunctionOffset):
+ * kjs/nodes.cpp:
+ (KJS::FunctionBodyNode::generateCode):
+ (KJS::ProgramNode::generateCode):
+
+2008-06-07 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Dan Bernstein.
+
+ Bug 17928: testkjs shouldn't require "-f"
+ <https://bugs.webkit.org/show_bug.cgi?id=17928>
+
+ * kjs/testkjs.cpp:
+ (printUsageStatement):
+ (parseArguments):
+
+2008-06-07 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Eric.
+
+ Bug 17548: JavaScriptCore print(a, b) differs from Spidermonkey Behavior
+ <https://bugs.webkit.org/show_bug.cgi?id=17548>
+
+ * kjs/testkjs.cpp:
+ (functionPrint):
+
+2008-06-07 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Sam.
+
+ Bug 17547: JavaScriptCore print() differs from Spidermonkey Behavior
+ <https://bugs.webkit.org/show_bug.cgi?id=17547>
+
+ * kjs/testkjs.cpp:
+ (functionPrint):
+
+2008-06-07 Alexey Proskuryakov <ap@webkit.org>
+
+ More build fixes.
+
+ * kjs/JSGlobalData.cpp: Fixed an included file name for case-sensitive file systems, fixed
+ JSGlobalData::threadInstance() for non-multithreaded builds.
+
+2008-06-07 Alexey Proskuryakov <ap@webkit.org>
+
+ Build fix - actually adding JSGlobalData.cpp to non-Mac builds!
+
+ * GNUmakefile.am:
+ * JavaScriptCore.pri:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCoreSources.bkl:
+
+2008-06-07 Alexey Proskuryakov <ap@webkit.org>
+
+ Try to fix Gtk/gcc 4.3 build.
+
+ * kjs/JSGlobalData.h: Include ustring.h instead of forward-declaring UString::Rep.
+
+2008-06-06 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Darin.
+
+ Combine per-thread objects into one, to make it easier to support legacy clients (for
+ which they shouldn't be really per-thread).
+
+ No change on SunSpider total.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj: Added JSGlobalData.{h,cpp}
+
+ * kjs/JSGlobalData.cpp: Added.
+ (KJS::JSGlobalData::JSGlobalData):
+ (KJS::JSGlobalData::~JSGlobalData):
+ (KJS::JSGlobalData::threadInstance):
+ * kjs/JSGlobalData.h: Added.
+ This class encapsulates all data that should be per-thread (or shared between legacy clients).
+ It will also keep a Heap pointer, but right now, Heap (Collector) methods are all static.
+
+ * kjs/identifier.h:
+ (KJS::Identifier::Identifier):
+ Added a constructor explicitly taking JSGlobalData to access IdentifierTable. Actually,
+ all of them should, but this will be a separate patch.
+
+ * kjs/identifier.cpp:
+ (KJS::IdentifierTable::literalTable):
+ (KJS::createIdentifierTable):
+ (KJS::deleteIdentifierTable):
+ (KJS::Identifier::add):
+ (KJS::Identifier::addSlowCase):
+ Combined IdentifierTable and LiteralIdentifierTable into a single class for simplicity.
+
+ * kjs/grammar.y: kjsyyparse now takes JSGlobalData, not just a Lexer.
+
+ * kjs/nodes.cpp:
+ (KJS::Node::Node):
+ (KJS::EvalFunctionCallNode::emitCode):
+ (KJS::ScopeNode::ScopeNode):
+ Changed to access Lexer and Parser via JSGlobalData::threadInstance(). This is also a
+ temporary measure, they will need to use JSGlobalData explicitly.
+
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::CodeGenerator):
+ * VM/CodeGenerator.h:
+ * VM/Machine.cpp:
+ (KJS::callEval):
+ * kjs/CommonIdentifiers.cpp:
+ (KJS::CommonIdentifiers::CommonIdentifiers):
+ * kjs/CommonIdentifiers.h:
+ * kjs/DebuggerCallFrame.cpp:
+ (KJS::DebuggerCallFrame::evaluate):
+ * kjs/ExecState.cpp:
+ (KJS::ExecState::ExecState):
+ * kjs/ExecState.h:
+ (KJS::ExecState::globalData):
+ (KJS::ExecState::identifierTable):
+ (KJS::ExecState::propertyNames):
+ (KJS::ExecState::emptyList):
+ (KJS::ExecState::lexer):
+ (KJS::ExecState::parser):
+ (KJS::ExecState::arrayTable):
+ (KJS::ExecState::dateTable):
+ (KJS::ExecState::mathTable):
+ (KJS::ExecState::numberTable):
+ (KJS::ExecState::RegExpImpTable):
+ (KJS::ExecState::RegExpObjectImpTable):
+ (KJS::ExecState::stringTable):
+ * kjs/InitializeThreading.cpp:
+ (KJS::initializeThreadingOnce):
+ * kjs/JSGlobalObject.cpp:
+ (KJS::JSGlobalObject::init):
+ * kjs/JSGlobalObject.h:
+ (KJS::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData):
+ (KJS::JSGlobalObject::head):
+ (KJS::JSGlobalObject::globalData):
+ * kjs/Parser.cpp:
+ (KJS::Parser::parse):
+ * kjs/Parser.h:
+ * kjs/function.cpp:
+ (KJS::FunctionImp::getParameterName):
+ (KJS::IndexToNameMap::unMap):
+ (KJS::globalFuncEval):
+ * kjs/function_object.cpp:
+ (KJS::FunctionObjectImp::construct):
+ * kjs/interpreter.cpp:
+ (KJS::Interpreter::checkSyntax):
+ (KJS::Interpreter::evaluate):
+ * kjs/lexer.cpp:
+ (kjsyylex):
+ * kjs/lexer.h:
+ * kjs/testkjs.cpp:
+ (prettyPrintScript):
+ Updated for the above changes. Most of threadInstance uses here will need to be replaced with
+ explicitly passed pointers to support legacy JSC clients.
+
+ * JavaScriptCore.exp: Removed KJS::parser().
+
+2008-06-06 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Oliver.
+
+ Bug 19424: Add support for logging opcode pair counts
+ <https://bugs.webkit.org/show_bug.cgi?id=19424>
+
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+ * VM/Opcode.cpp:
+ (KJS::OpcodeStats::OpcodeStats):
+ (KJS::compareOpcodeIndices):
+ (KJS::compareOpcodePairIndices):
+ (KJS::OpcodeStats::~OpcodeStats):
+ (KJS::OpcodeStats::recordInstruction):
+ (KJS::OpcodeStats::resetLastInstruction):
+ * VM/Opcode.h:
+
+2008-06-06 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Adam.
+
+ <rdar://problem/5969992> JSProfiler: Remove the recursion limit in the
+ profiler.
+ - Change the remaining functions that do not take arguments, from using
+ recursion to using iteration.
+
+ * JavaScriptCore.exp:
+ * profiler/Profile.cpp:
+ (KJS::stopProfiling):
+ (KJS::restoreAll):
+ (KJS::Profile::stopProfiling): Use foreach instead of recursion.
+ (KJS::Profile::restoreAll): Ditto.
+ * profiler/Profile.h:
+ * profiler/ProfileNode.cpp: Remove recursion.
+ (KJS::ProfileNode::stopProfiling):
+ (KJS::ProfileNode::restore):
+ * profiler/ProfileNode.h:
+
+2008-06-05 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Alexey.
+
+ Fix Greater and GreaterEq nodes to emit code for the left
+ and right sub-expressions in the correct order.
+
+ * kjs/nodes.cpp:
+ (KJS::GreaterNode::emitCode):
+ (KJS::GreaterEqNode::emitCode):
+
+2008-06-05 Antti Koivisto <antti@apple.com>
+
+ Reviewed by Alp Toker.
+
+ Fix whitespaces.
+
+ * kjs/collector.cpp:
+ (KJS::getPlatformThreadRegisters):
+
+2008-06-05 Antti Koivisto <antti@apple.com>
+
+ Reviewed by Darin.
+
+ Support compiling JavaScriptCore for ARM.
+
+ * kjs/collector.cpp:
+ (KJS::getPlatformThreadRegisters):
+ (KJS::otherThreadStackPointer):
+
+2008-06-05 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Jon.
+
+ - Name changes.
+
+ * JavaScriptCore.exp:
+ * profiler/Profile.cpp:
+ (KJS::Profile::Profile):
+ (KJS::Profile::stopProfiling):
+ (KJS::Profile::didExecute):
+ (KJS::Profile::forEach):
+ (KJS::Profile::debugPrintData):
+ (KJS::Profile::debugPrintDataSampleStyle):
+ * profiler/Profile.h:
+ (KJS::Profile::callTree):
+ (KJS::Profile::totalTime):
+ (KJS::Profile::sortTotalTimeDescending):
+ (KJS::Profile::sortTotalTimeAscending):
+ (KJS::Profile::sortSelfTimeDescending):
+ (KJS::Profile::sortSelfTimeAscending):
+ (KJS::Profile::sortCallsDescending):
+ (KJS::Profile::sortCallsAscending):
+ (KJS::Profile::sortFunctionNameDescending):
+ (KJS::Profile::sortFunctionNameAscending):
+ (KJS::Profile::focus):
+ (KJS::Profile::exclude):
+ (KJS::Profile::restoreAll):
+
+2008-06-05 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Stephanie Lewis.
+
+ Added the -fno-move-loop-invariants flag to the pcre_exec.cpp build, to
+ tell GCC not to perform loop invariant motion, since GCC's loop
+ invariant motion doesn't do very well with computed goto code.
+
+ SunSpider reports no change.
+
+2008-06-05 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Stephanie Lewis.
+
+ Added the -fno-tree-pre flag to the Machine.cpp build, to tell GCC not
+ to perform Partial Redundancy Elimination (PRE) on trees in Machine.cpp,
+ since GCC's PRE doesn't do very well with computed goto code.
+
+ SunSpider reports a .7% speedup.
+
+2008-06-05 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Stephanie Lewis (or maybe the other way around).
+
+ Minor change to PCRE to help out certain compilers.
+
+ SunSpider reports no change, maybe a small speedup.
+
+ * pcre/pcre_exec.cpp:
+ (match): Use instructionPtr++ a little less, to avoid confusing the
+ optimizer.
+
+2008-06-05 Alexey Proskuryakov <ap@webkit.org>
+
+ Re-landing an independent part of a previously rolled out threading patch.
+
+ * wtf/ThreadSpecific.h: Make sure to initialize POD thread-specific varaibles, too
+ (replaced "new T" with "new T()").
+
+2008-06-05 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Hyatt.
+
+ - force inlining of a template function that only has one call site per specialization
+ 1.3% speedup on SunSpider
+
+ * kjs/collector.cpp:
+ (KJS::Collector::heapAllocate): This template function is only
+ called from allocate() and allocateNumber() (once per
+ specialization) and the extra call overhead for GC allocation
+ shows up, so force inlining.
+
+2008-06-05 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Alexey and Oliver.
+
+ - remove profiler fetch hack
+ I measure an 0.5% progression from this, others show a wash. It seems not needed any more.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+
+2008-06-05 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Maciej.
+
+ Bug 19400: subscript operator does not protect base when necessary
+ <https://bugs.webkit.org/show_bug.cgi?id=19400>
+
+ Use a temporary for the base in BracketAccessorNode if the subscript
+ might possibly modify it.
+
+ * kjs/grammar.y:
+ * kjs/nodes.cpp:
+ (KJS::BracketAccessorNode::emitCode):
+ * kjs/nodes.h:
+ (KJS::BracketAccessorNode::):
+
+2008-06-04 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Maciej Stachowiak.
+
+ Big cleanup of formatting and whitespace.
+
+2008-06-04 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Oliver.
+
+ Add an option to dump statistics on executed instructions.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+ * VM/Opcode.cpp:
+ (KJS::OpcodeStats::~OpcodeStats):
+ (KJS::OpcodeStats::recordInstruction):
+ * VM/Opcode.h:
+
+2008-06-04 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Geoff.
+
+ <rdar://problem/5969992> JSProfiler: Remove the recursion limit in the
+ profiler.
+ - This patch removes the use of recursion for the sort functions.
+
+ * JavaScriptCore.exp: Change the signatures of the functions being
+ exported.
+ * profiler/Profile.cpp:
+ (KJS::Profile::sort): This generic function will accept any of the
+ static sort functions and apply them to the whole tree.
+ * profiler/Profile.h: All of the sorting functions now call the new
+ sort() function.
+ (KJS::Profile::sortTotalTimeDescending):
+ (KJS::Profile::sortTotalTimeAscending):
+ (KJS::Profile::sortSelfTimeDescending):
+ (KJS::Profile::sortSelfTimeAscending):
+ (KJS::Profile::sortCallsDescending):
+ (KJS::Profile::sortCallsAscending):
+ (KJS::Profile::sortFunctionNameDescending):
+ (KJS::Profile::sortFunctionNameAscending):
+ * profiler/ProfileNode.cpp:
+ (KJS::ProfileNode::ProfileNode): m_head used to point to the head node
+ if this was the head node. It now points to null to make iteration easy
+ (KJS::ProfileNode::willExecute): Now must check if m_head is null, this
+ check used to happend in the constructor.
+ (KJS::ProfileNode::stopProfiling): Again the check is slightly different
+ to determine if this is the head.
+ (KJS::ProfileNode::traverseNextNode): This function returns the next
+ node in post order.
+ (KJS::ProfileNode::sort): This generic function will sort according to
+ the comparator passed in, then reset the children pointers to macth the
+ new order.
+ * profiler/ProfileNode.h: The sorting function were removed from the
+ definition file and instead use the new generic sort() function
+ (KJS::ProfileNode::totalPercent): because the head can now be empty we
+ need to check here too for the head node.
+ (KJS::ProfileNode::selfPercent): Ditto
+ (KJS::ProfileNode::firstChild): This function is necessary for the
+ iterative algorithm in Profile.cpp.
+ (KJS::ProfileNode::sortTotalTimeDescending):
+ (KJS::ProfileNode::sortTotalTimeAscending):
+ (KJS::ProfileNode::sortSelfTimeDescending):
+ (KJS::ProfileNode::sortSelfTimeAscending):
+ (KJS::ProfileNode::sortCallsDescending):
+ (KJS::ProfileNode::sortCallsAscending):
+ (KJS::ProfileNode::sortFunctionNameDescending):
+ (KJS::ProfileNode::sortFunctionNameAscending):
+ (KJS::ProfileNode::childrenBegin):
+ (KJS::ProfileNode::childrenEnd):
+ (KJS::ProfileNode::totalTimeDescendingComparator):
+ (KJS::ProfileNode::totalTimeAscendingComparator):
+ (KJS::ProfileNode::selfTimeDescendingComparator):
+ (KJS::ProfileNode::selfTimeAscendingComparator):
+ (KJS::ProfileNode::callsDescendingComparator):
+ (KJS::ProfileNode::callsAscendingComparator):
+ (KJS::ProfileNode::functionNameDescendingComparator):
+ (KJS::ProfileNode::functionNameAscendingComparator):
+
+2008-06-04 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Darin.
+
+ Fix JSClassCreate to work with old JSCore API threading model.
+
+ No change on SunSpider.
+
+ * API/JSClassRef.cpp: (OpaqueJSClass::OpaqueJSClass): Since JSClass is constructed without
+ a context, there is no way for it to create Identifiers.
+ Also, added initializeThreading(), just for good measure.
+
+ * API/JSCallbackObjectFunctions.h: (KJS::::getPropertyNames): Make an Identifier out of the
+ string here, because propertyNames.add() needs that.
+
+ * kjs/identifier.cpp:
+ * kjs/identifier.h:
+ (KJS::Identifier::equal):
+ * kjs/ustring.cpp:
+ (KJS::equal):
+ Moved equal() from identifier.h to ustring.h, because it's not really about Identifiers,
+ and to make it possible to use it from StrHash.
+ Include StrHash.h from ustring.h to avoid having the behavior depend on headers that happen
+ to be included.
+
+ * wtf/StrHash.h: Removed.
+ * kjs/ustring.h: Made RefPtr<UString::Rep> use the same default hash as UString::Rep* (it
+ used to default to pointer equality). Moved the whole StrHash header into ustring.h.
+
+ * JavaScriptCore.exp: Export equal() for WebCore use (this StrHash is used in c_class.cpp,
+ jni_class.cpp, and npruntime.cpp).
+
+2008-06-04 Alexey Proskuryakov <ap@webkit.org>
+
+ Rubber-stamped by Darin.
+
+ Fix spacing in collector.{h,cpp}.
+
+ * kjs/collector.cpp:
+ * kjs/collector.h:
+
+2008-06-03 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Maciej.
+
+ Build fix. The cleanup in r34355 missed a method.
+
+ * kjs/nodes.cpp:
+ * kjs/nodes.h:
+
+2008-06-03 Darin Adler <darin@apple.com>
+
+ Reviewed by Geoff.
+
+ - https://bugs.webkit.org/show_bug.cgi?id=19269
+ speed up SunSpider by eliminating the toObject call for most get/put/delete
+
+ Makes standalone SunSpider 1.025x as fast as before.
+
+ The getOwnPropertySlot virtual function now takes care of the toObject call
+ for get. Similarly, the put function (and later deleteProperty) does the
+ same for those operations. To do this, the virtual functions were moved from
+ the JSObject class to the JSCell class. Also, since the caller no longer knows
+ the identity of the "original object", which is used by JavaScript-function
+ based getters, changed the PropertySlot class so the original object is
+ already stored in the slot when getOwnPropertySlot is called, if the caller
+ intends to call getValue.
+
+ This affected the old interpreter code enough that the easiest thing for me
+ was to just delete it. While I am not certain the mysterious slowdown is not
+ still occurring, the net change is definitely a significant speedup.
+
+ * JavaScriptCore.exp: Updated.
+
+ * VM/Machine.cpp: Moved the UNLIKELY macro into AlwaysInline.h.
+ (KJS::resolve): Set up the originalObject in the PropertySlot before
+ calling getPropertySlot. Also removed the originalObject argument from
+ getValue.
+ (KJS::resolve_skip): Ditto.
+ (KJS::resolveBaseAndProperty): Ditto.
+ (KJS::resolveBaseAndFunc): Ditto.
+ (KJS::Machine::privateExecute): Removed the toObject calls from the get and
+ put functions where possible, instead calling directly with JSValue and letting
+ the JSValue and JSCell calls handle toObject. Same for toThisObject.
+
+ * kjs/ExecState.h: Removed OldInterpreterExecState.
+
+ * API/JSBase.cpp: Updated includes.
+
+ * kjs/LocalStorageEntry.h: Removed contents. Later we can remove the file too.
+
+ * kjs/array_instance.cpp:
+ (KJS::ArrayInstance::lengthGetter): Removed originalObject argumet.
+ (KJS::ArrayInstance::inlineGetOwnPropertySlot): Don't pass a base value to
+ setValueSlot. Also use UNLIKELY around the "getting elements past the end of
+ the array" code path; less common than successfully getting an element.
+
+ * kjs/array_object.cpp:
+ (KJS::getProperty): Initialize the PropertySlot with the original object.
+ Don't pass the original object to the get function.
+ (KJS::arrayProtoFuncFilter): Ditto.
+ (KJS::arrayProtoFuncMap): Ditto.
+ (KJS::arrayProtoFuncEvery): Ditto.
+ (KJS::arrayProtoFuncForEach): Ditto.
+ (KJS::arrayProtoFuncSome): Ditto.
+
+ * kjs/function_object.cpp:
+ (KJS::FunctionObjectImp::construct): Removed an obsolete comment.
+
+ * kjs/grammar.y: Eliminated support for some of the node types that were
+ used to optimize executing from the syntax tree.
+
+ * kjs/internal.cpp:
+ (KJS::StringImp::toThisObject): Added. Same as toObject.
+ (KJS::NumberImp::toThisObject): Ditto.
+ (KJS::GetterSetterImp::getOwnPropertySlot): Added. Not reached.
+ (KJS::GetterSetterImp::put): Ditto.
+ (KJS::GetterSetterImp::toThisObject): Ditto.
+
+ * kjs/internal.h: Added toThisObject to NumberImp for speed.
+
+ * kjs/lexer.cpp:
+ (KJS::Lexer::shift): Changed shift to just do a single character, to unroll
+ the loop and especially to make the one character case faster.
+ (KJS::Lexer::setCode): Call shift multiple times instead of passing a number.
+ (KJS::Lexer::lex): Ditto.
+ (KJS::Lexer::matchPunctuator): Ditto. Also removed unneeded elses after returns.
+ (KJS::Lexer::scanRegExp): Ditto.
+ * kjs/lexer.h: Removed the count argument from shift.
+
+ * kjs/math_object.cpp:
+ (KJS::mathProtoFuncPow): Call jsNaN instead of jsNumber(NaN).
+
+ * kjs/nodes.cpp: Removed some of the things needed only for the pre-SquirrelFish
+ execution model.
+ (KJS::ForNode::emitCode): Handle cases where some expressions are missing by
+ not emitting any code at all. The old way was to emit code for "true", but
+ this is an unnecessary remnant of the old way of doing things.
+
+ * kjs/nodes.h: Removed some of the things needed only for the pre-SquirrelFish
+ execution model.
+
+ * kjs/object.cpp:
+ (KJS::JSObject::fillGetterPropertySlot): Changed to only pass in the getter
+ function. The old code passed in a base, but it was never used when
+ actually getting the property; the toThisObject call was pointless. Also
+ changed to not pass a base for setUndefined.
+
+ * kjs/object.h: Added the new JSCell operations to GetterSetterImp.
+ Never called.
+ (KJS::JSObject::get): Initialize the object in the PropertySlot and don't
+ pass it in getValue.
+ (KJS::JSObject::getOwnPropertySlotForWrite): Removed the base argument
+ in calls to setValueSlot.
+ (KJS::JSObject::getOwnPropertySlot): Ditto.
+ (KJS::JSValue::get): Added. Here because it calls through to JSObject.
+ A version of JSObject::get that also handles the other types of JSValue
+ by creating the appropriate wrapper. Saves the virtual call to toObject.
+ (KJS::JSValue::put): Ditto.
+ (KJS::JSValue::deleteProperty): Ditto.
+
+ * kjs/property_slot.cpp:
+ (KJS::PropertySlot::undefinedGetter): Removed the originalObject argument.
+ (KJS::PropertySlot::ungettableGetter): Ditto.
+ (KJS::PropertySlot::functionGetter): Ditto. Use the value in the base
+ as the "this" object, which will be set to the original object by the new
+ PropertySlot initialization code. Also call toThisObject. The old code did
+ not do this, but needed to so we can properly handle the activation object
+ like the other similar code paths.
+
+ * kjs/property_slot.h:
+ (KJS::PropertySlot::PropertySlot): Added a constructor that takes a base
+ object. In debug builds, set the base to 0 if you don't pass one.
+ (KJS::PropertySlot::getValue): Don't take or pass the originalObject.
+ (KJS::PropertySlot::setValueSlot): Don't take a base object, and clear the
+ base object in debug builds.
+ (KJS::PropertySlot::setGetterSlot): Ditto.
+ (KJS::PropertySlot::setUndefined): Ditto.
+ (KJS::PropertySlot::setUngettable): Ditto.
+ (KJS::PropertySlot::slotBase): Assert that a base object is present.
+ This will fire if someone actually calls the get function without having
+ passed in a base object and the getter needs it.
+ (KJS::PropertySlot::setBase): Added. Used by the code that implements
+ toObject so it can supply the original object after the fact.
+ (KJS::PropertySlot::clearBase): Added. Clears the base, but is debug-only
+ code because it's an error to fetch the base if you don't have a guarantee
+ it was set.
+
+ * API/JSCallbackObject.h:
+ * API/JSCallbackObjectFunctions.h:
+ (KJS::JSCallbackObject::cachedValueGetter):
+ (KJS::JSCallbackObject::staticValueGetter):
+ (KJS::JSCallbackObject::staticFunctionGetter):
+ (KJS::JSCallbackObject::callbackGetter):
+ * kjs/JSActivation.cpp:
+ (KJS::JSActivation::getOwnPropertySlot):
+ (KJS::JSActivation::argumentsGetter):
+ * kjs/JSActivation.h:
+ * kjs/JSVariableObject.h:
+ (KJS::JSVariableObject::symbolTableGet):
+ * kjs/array_instance.h:
+ * kjs/function.cpp:
+ (KJS::FunctionImp::argumentsGetter):
+ (KJS::FunctionImp::callerGetter):
+ (KJS::FunctionImp::lengthGetter):
+ (KJS::Arguments::mappedIndexGetter):
+ * kjs/function.h:
+ * kjs/lookup.h:
+ (KJS::staticFunctionGetter):
+ (KJS::staticValueGetter):
+ * kjs/string_object.cpp:
+ (KJS::StringInstance::lengthGetter):
+ (KJS::StringInstance::indexGetter):
+ (KJS::stringInstanceNumericPropertyGetter):
+ * kjs/string_object.h:
+ Removed originalObject arguments from getters. Don't pass base values to
+ the various PropertySlot functions that no longer take them.
+
+ * kjs/value.cpp:
+ (KJS::JSCell::getOwnPropertySlot): Added. Calls toObject and then sets the slot.
+ This function has to always return true, because the caller can't walk the prototype
+ chain. Because of that, we do a getPropertySlot, not getOwnPropertySlot, which works
+ for the caller. This is private, only called by getOwnPropertySlotInternal.
+ (KJS::JSCell::put): Added. Calls toObject and then put.
+ (KJS::JSCell::toThisObject): Added. Calls toObject.
+
+ * kjs/value.h: Added get, put, and toThisObject to both JSValue
+ and JSCell. These take care of the toObject operation without an additional virtual
+ function call, and so make the common "already an object" case faster.
+
+ * wtf/AlwaysInline.h: Moved the UNLIKELY macro here for now. Maybe we can find a
+ better place later, or rename this header.
+
+2008-06-03 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Tim.
+
+ Bug 12983: Web Inspector break on the debugger keyword
+ <https://bugs.webkit.org/show_bug.cgi?id=12983>
+
+ Added a DebuggerStatementNode to handle codegen, and added a new
+ DidReachBreakPoint debug event (which will hopefully be useful
+ if we ever move breakpoint management into JSC proper). Also
+ added didReachBreakpoint to Debugger to allow us to actually respond
+ to this event.
+
+ * VM/CodeBlock.cpp:
+ (KJS::debugHookName):
+ * VM/Machine.cpp:
+ (KJS::Machine::debug):
+ * VM/Machine.h:
+ * kjs/debugger.h:
+ * kjs/grammar.y:
+ * kjs/nodes.cpp:
+ (KJS::DebuggerStatementNode::emitCode):
+ (KJS::DebuggerStatementNode::execute):
+ * kjs/nodes.h:
+ (KJS::DebuggerStatementNode::):
+ * kjs/nodes2string.cpp:
+ (KJS::DebuggerStatementNode::streamTo):
+
+2008-06-03 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver.
+
+ - document remaining opcodes.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute): Document call, call_eval,
+ construct, ret and end opcodes.
+
+2008-06-03 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute): Document throw and catch opcodes.
+
+2008-06-02 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Removed JSObject::call, since it just called JSObject::callAsFunction.
+
+ SunSpider reports no change.
+
+2008-06-02 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ A little cleanup in the CodeGenerator.
+
+ * VM/CodeGenerator.cpp: A few changes here.
+
+ (1) Removed remaining cases of the old hack of putting "this" into the
+ symbol table; replaced with explicit tracking of m_thisRegister.
+
+ (2) Made m_thisRegister behave the same for function, eval, and program
+ code, removing the static programCodeThis() function.
+
+ (3) Added a feature to nix a ScopeNode's declaration stacks when done
+ compiling, to save memory.
+
+ (4) Removed code that copied eval declarations into special vectors: we
+ just use the originals in the ScopeNode now.
+
+ * VM/CodeGenerator.h: Removed unneded parameters from the CodeGenerator
+ constructor: we just use get that data from the ScopeNode now.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::execute): When executing an eval node, don't iterate a
+ special copy of its declarations; iterate the originals, instead.
+
+ * kjs/nodes.cpp: Moved responsibility for knowing what AST data to throw
+ away into the CodeGenerator. Nodes no longer call shrinkCapacity on
+ their data directly.
+
+ * kjs/nodes.h: Changed FunctionStack to ref its contents, so declaration
+ data stays around even after we've thrown away the AST, unless we explicitly
+ throw away the declaration data, too. This is useful for eval code, which
+ needs to reference its declaration data at execution time. (Soon, it will
+ be useful for program code, too, since program code should do the same.)
+
+2008-06-02 Adam Roben <aroben@apple.com>
+
+ Build fix for non-AllInOne builds
+
+ * kjs/array_object.cpp: Added a missing #include.
+
+2008-06-02 Kevin McCullough <kmccullough@apple.com>
+
+ Took out accidental confilct lines I checked in.
+
+ * ChangeLog:
+
+2008-06-02 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Darin.
+
+ <rdar://problem/5969992> JSProfiler: Remove the recursion limit in the
+ profiler
+ Implement Next Sibling pointers as groundwork for removing the recursion
+ limit in the profiler.
+
+ * profiler/ProfileNode.cpp: Also I renamed parentNode and headNode since
+ 'node' is redundant.
+ (KJS::ProfileNode::ProfileNode): Initialize the nextSibling.
+ (KJS::ProfileNode::willExecute): If there are already children then the
+ new child needs to be the nextSibling of the last child.
+ (KJS::ProfileNode::didExecute):
+ (KJS::ProfileNode::addChild): Ditto.
+ (KJS::ProfileNode::stopProfiling):
+ (KJS::ProfileNode::sortTotalTimeDescending): For all of the sorting
+ algorithms once the children are sorted their nextSibling pointers need
+ to be reset to reflect the new order.
+ (KJS::ProfileNode::sortTotalTimeAscending):
+ (KJS::ProfileNode::sortSelfTimeDescending):
+ (KJS::ProfileNode::sortSelfTimeAscending):
+ (KJS::ProfileNode::sortCallsDescending):
+ (KJS::ProfileNode::sortCallsAscending):
+ (KJS::ProfileNode::sortFunctionNameDescending):
+ (KJS::ProfileNode::sortFunctionNameAscending):
+ (KJS::ProfileNode::resetChildrensSiblings): This new function simply
+ loops over all of the children and sets their nextSibling pointers to
+ the next child in the Vector
+ (KJS::ProfileNode::debugPrintData):
+ * profiler/ProfileNode.h:
+ (KJS::ProfileNode::parent):
+ (KJS::ProfileNode::setParent):
+ (KJS::ProfileNode::nextSibling):
+ (KJS::ProfileNode::setNextSibling):
+ (KJS::ProfileNode::totalPercent):
+ (KJS::ProfileNode::selfPercent):
+
+2008-06-02 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Removed the recursion limit from JSObject::call, since the VM does
+ recursion checking now.
+
+ This should allow us to remove JSObject::call entirely, netting a small
+ speedup.
+
+ * kjs/object.cpp:
+ (KJS::JSObject::call):
+
+2008-06-02 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Adele Peterson.
+
+ Added a specific affordance for avoiding stack overflow when converting
+ recursive arrays to string, in preparation for removing generic stack
+ overflow checking from JSObject::call.
+
+ Tested by fast/js/toString-stack-overflow.html.
+
+2008-06-02 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Alice Liu.
+
+ Refactored some hand-rolled code to call ScopeChain::globalObject instead.
+
+2008-06-02 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Fixed ASSERT due to execution continuing after an exception is thrown
+ during array sort.
+
+ * kjs/array_instance.cpp:
+ (KJS::AVLTreeAbstractorForArrayCompare::compare_key_key): Don't call the
+ custom comparator function if an exception has been thrown. Just return
+ 1 for everything, so the sort completes quickly. (The result will be
+ thrown away.)
+
+2008-05-30 Timothy Hatcher <timothy@apple.com>
+
+ Made the starting line number of scripts be 1-based throughout the engine.
+ This cleans up script line numbers so they are all consistent now and fixes
+ some cases where script execution was shown as off by one line in the debugger.
+
+ No change in SunSpider.
+
+ Reviewed by Oliver Hunt.
+
+ * API/minidom.c:
+ (main): Pass a line number of 1 instead of 0 to parser().parse().
+ * API/testapi.c:
+ (main): Ditto. And removes a FIXME and changed an assertEqualsAsNumber
+ to use 1 instead of 2 for the line number.
+ * VM/Machine.cpp:
+ (KJS::callEval): Pass a line number of 1 instead of 0.
+ (KJS::Machine::debug): Use firstLine for WillExecuteProgram instead of
+ lastLine. Use lastLine for DidExecuteProgram instead of firstLine.
+ * kjs/DebuggerCallFrame.cpp:
+ (KJS::DebuggerCallFrame::evaluate): Pass a line number of 1 instead of
+ 0 to parser().parse().
+ * kjs/Parser.cpp:
+ (KJS::Parser::parse): ASSERT startingLineNumber is greatter than 0. Change
+ the startingLineNumber to be 1 if it was less than or equal to 0. This is needed
+ for release builds to maintain compatibility with the JavaScriptCore API.
+ * kjs/function.cpp:
+ (KJS::globalFuncEval): Pass a line number of 1 instead of 0 to parser().parse().
+ * kjs/function_object.cpp:
+ (FunctionObjectImp::construct): Pass a line number of 1 instead of 0 to construct().
+ * kjs/lexer.cpp:
+ (Lexer::setCode): Made yylineno = startingLineNumber instead of adding 1.
+ * kjs/testkjs.cpp:
+ (functionRun): Pass a line number of 1 instead of 0 to Interpreter::evaluate().
+ (functionLoad): Ditto.
+ (prettyPrintScript): Ditto.
+ (runWithScripts): Ditto.
+ * profiler/Profiler.cpp:
+ (WebCore::createCallIdentifier): Removed a plus 1 of startingLineNumber.
+
+2008-05-30 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Darin.
+
+ https://bugs.webkit.org/show_bug.cgi?id=19180
+ speed up SunSpider by optimizing immediate number cases
+
+ Also fixed a JavaScriptCore regression seen on PowerPC - we didn't clip left shift
+ parameter to 0...31.
+
+ 0.5% improvement on SunSpider overall, although a 8.5 regression on bitops-3bit-bits-in-byte.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+
+ * kjs/JSImmediate.h:
+ (KJS::JSImmediate::toTruncatedUInt32): Added. Same as getTruncatedInt32, but casts the result
+ to unsigned.
+
+2008-05-30 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Oliver Hunt.
+
+ https://bugs.webkit.org/show_bug.cgi?id=19180
+ speed up SunSpider by optimizing immediate number cases
+
+ Also fixed two JavaScriptCore regressions seen on PowerPC - we didn't clip right shift
+ parameter to 0...31.
+
+ 1.6% improvement on SunSpider, without significant regressions on any tests.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+ Added fast paths for >>, ==, ===, !=, !==. Changed order of memory accesses in many
+ cases, making them less dependent on gcc's ability to properly assign registers. With this,
+ I could move exception checks back into slow code paths, and saw less randomness in general.
+
+ * kjs/JSImmediate.h:
+ (KJS::JSImmediate::rightShiftImmediateNumbers):
+ Added.
+
+2008-05-29 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver.
+
+ - fixed <rdar://problem/5972943> REGRESSION(r33979): Flash clips do not play on cnn.com
+
+ Finally blocks could clobber registers that had to remain live
+ until they returned. This patch takes a conservative approach and
+ makes sure that finally blocks do not reuse any registers that
+ were previously allocated for the function. In the future this
+ could probably be tightened up to be less profligate with the
+ register allocation.
+
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::highestUsedRegister):
+ * VM/CodeGenerator.h:
+ * kjs/nodes.cpp:
+ (KJS::TryNode::emitCode):
+
+2008-05-29 Steve Falkenburg <sfalken@apple.com>
+
+ Build fix.
+
+ * kjs/array_instance.cpp:
+
+2008-05-29 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Darin.
+
+ https://bugs.webkit.org/show_bug.cgi?id=19294
+ <rdar://problem/5969062> A crash when iterating over a sparse array backwards.
+
+ * kjs/array_instance.cpp: Turned sparseArrayCutoff into a macro, so that using max() on it
+ doesn't cause a PIC branch.
+ (KJS::ArrayInstance::increaseVectorLength): Added a comment about this function not
+ preserving class invariants.
+ (KJS::ArrayInstance::put): Update m_storage after reallocation. Move values that fit to
+ the vector from the map in all code paths.
+
+2008-05-29 Thiago Macieira <tjmaciei@trolltech.com>
+
+ Reviewed by Simon.
+
+ Fix compilation in Solaris with Sun CC
+
+ Lots of WebKit code uses C99 functions that, strict as it
+ is, the Solaris system doesn't provide in C++. So we must define them
+ for both GCC and the Sun CC.
+
+ * wtf/MathExtras.h:
+
+2008-05-28 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Anders.
+
+ Fix codegen for assignment being used as a function.
+
+ FunctionCallValueNode::emitCode failed to account for the
+ potential of the function expression to allocate arbitrary
+ registers.
+
+ * kjs/nodes.cpp:
+ (KJS::FunctionCallValueNode::emitCode):
+
+2008-05-27 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Tim Hatcher.
+
+ Fixed https://bugs.webkit.org/show_bug.cgi?id=19183
+ REGRESSION (r33979): Crash in DebuggerCallFrame::functionName when
+ clicking button in returnEvent-crash.html
+
+ Added two new debugger hooks, willExecuteProgram and didExecuteProgram,
+ along with code to generate them, code to invoke them when unwinding
+ due to an exception, and code to dump them.
+
+ SunSpider reports no change.
+
+ * VM/CodeBlock.cpp:
+ (KJS::debugHookName): I had to mark this function NEVER_INLINE to avoid
+ a .4% performance regression. The mind boggles.
+
+2008-05-28 Adam Roben <aroben@apple.com>
+
+ Fix JavaScriptCore tests on OS X
+
+ We were quoting the path to testkjs too late, after it had already
+ been combined with spaces and other options.
+
+ * tests/mozilla/jsDriver.pl:
+ (top level): Move path quoting from here...
+ (sub get_kjs_engine_command): ...to here.
+
+2008-05-28 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Oliver.
+
+ <rdar://problem/5968071> "const f" crashes in JavaScriptCore
+
+ Make sure to null check the initializer.
+
+ * kjs/nodes.cpp:
+ (KJS::ConstDeclNode::emitCodeSingle):
+
+2008-05-28 Adam Roben <aroben@apple.com>
+
+ Make run-javascriptcore-tests work with a space in the path to testkjs
+
+ Reviewed by Alexey Proskuryakov.
+
+ * tests/mozilla/jsDriver.pl: Quote the path to the engine so that
+ spaces will be interpreted correctly.
+
+2008-05-28 Alexey Proskuryakov <ap@webkit.org>
+
+ Fixed a misguiding comment - my measurement for negative numbers only included cases
+ where both operands were negative, which is not very interesting.
+
+ * VM/Machine.cpp:
+
+2008-05-28 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Maciej.
+
+ Based on a patch by Oliver Hunt.
+
+ https://bugs.webkit.org/show_bug.cgi?id=19180
+ speed up SunSpider by optimizing immediate number cases
+
+ 1.4% speedup on SunSpider.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+ * kjs/JSImmediate.h:
+ (KJS::JSImmediate::incImmediateNumber):
+ (KJS::JSImmediate::decImmediateNumber):
+ Added fast paths for ++ and --.
+
+ (KJS::JSImmediate::canDoFastAdditiveOperations): Corrected a comment.
+
+2008-05-28 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Darin.
+
+ https://bugs.webkit.org/show_bug.cgi?id=19180
+ speed up SunSpider by optimizing immediate number cases
+
+ 2% speedup overall, maximum 10% on controlflow-recursive and bitops-3bit-bits-in-byte,
+ but a 4% regression on bitops-bits-in-byte and bitops-bitwise-and.
+
+ * kjs/JSImmediate.h:
+ (KJS::JSImmediate::canDoFastAdditiveOperations):
+ (KJS::JSImmediate::addImmediateNumbers):
+ (KJS::JSImmediate::subImmediateNumbers):
+ Added fast cases that work with positive values less than 2^30.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute): Use the above operations. Also updated SunSpider frequencies
+ with my results (looks like tag values have changed, not sure what caused the minor variation
+ in actual frequencies).
+
+2008-05-27 Adam Roben <aroben@apple.com>
+
+ Windows build fix
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make:
+ Remove code that appended Cygwin's /bin directory to PATH.
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.vcproj:
+ Prepend Cygwin's /bin directory to PATH. We prepend instead of append
+ so that Cygwin's utilities will win out over Win32 versions of the
+ same utilities (particularly perl). We do the prepend here instead of
+ in the Makefile because nmake doesn't seem to like prepending to PATH
+ inside the Makefile. This also matches the way WebCoreGenerated works.
+
+2008-05-27 Adam Roben <aroben@apple.com>
+
+ Roll out r34163
+
+ A better fix is on the way.
+
+ * DerivedSources.make:
+ * JavaScriptCore.vcproj/JavaScriptCore/build-generated-files.sh:
+
+2008-05-27 Adam Roben <aroben@apple.com>
+
+ Windows build fix
+
+ * DerivedSources.make: Don't generate the bytecode docs if
+ OMIT_BYTECODE_DOCS is set to 1.
+ * JavaScriptCore.vcproj/JavaScriptCore/build-generated-files.sh: Set
+ OMIT_BYTECODE_DOCS for production builds.
+
+2008-05-27 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Geoff and Maciej.
+
+ <rdar://problem/5806428>
+ https://bugs.webkit.org/show_bug.cgi?id=17925
+ Crash in KJS::JSObject::put after setting this.__proto__
+
+ Set slotIsWriteable to false for __proto__, we want setting __proto__ to go through JSObject::put instead.
+
+ * kjs/object.h:
+ (KJS::JSObject::getOwnPropertySlotForWrite):
+
+2008-05-27 Kevin Ollivier <kevino@theolliviers.com>
+
+ wx build fixes to catch up with SquirrelFish, etc.
+
+ * JavaScriptCoreSources.bkl:
+ * jscore.bkl:
+ * wtf/Platform.h:
+
+2008-05-27 Darin Adler <darin@apple.com>
+
+ Reviewed by Tim Hatcher.
+
+ - https://bugs.webkit.org/show_bug.cgi?id=19180
+ speed up SunSpider by optimizing immediate number cases
+
+ Add immediate number cases for the &, |, and ^ operators.
+ Makes standalone SunSpider 1.010x faster.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute): Add areBothImmediateNumbers special cases
+ for the &, |, and ^ operators.
+
+ * kjs/JSImmediate.h:
+ (KJS::JSImmediate::xorImmediateNumbers): Added.
+ (KJS::JSImmediate::orImmediateNumbers): Added.
+
+2008-05-26 Stephanie Lewis <slewis@apple.com>
+
+ Windows build fix.
+
+ * kjs/testkjs.cpp:
+
+2008-05-26 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Anders.
+
+ - make addStaticGlobals protected instead of private so subclasses can use it
+
+ * JavaScriptCore.exp:
+ * kjs/JSGlobalObject.h:
+
+2008-05-26 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Fixed <rdar://problem/5960859> After an eval of a non-string or a syntax
+ error, all profile stack frames are incorrect
+
+ SunSpider reports a .3% speedup, possibly because eval of a string is a
+ little more efficient now.
+
+ * VM/Machine.cpp:
+ (KJS::callEval): Make sure to call didExecute when returning early. I
+ simplified this function to remove one early return, making the job
+ of adding special code to early returns easier.
+
+ (KJS::Machine::execute): Use the new function ExecState when notifying
+ the profiler. (This doesn't change behavior now, but it might prevent
+ subtle errors in the future.)
+
+2008-05-23 Tor Arne Vestbø <tavestbo@trolltech.com>
+
+ Reviewed by Simon.
+
+ Fixed toLower and toUpper implementations to allow being called
+ with a null result pointer and resultLength, to determine the
+ number of characters needed for the case conversion.
+
+ * wtf/unicode/qt4/UnicodeQt4.h:
+ (WTF::Unicode::toLower):
+ (WTF::Unicode::toUpper):
+
+2008-05-25 Alexey Proskuryakov <ap@webkit.org>
+
+ Fixing a typo in the previous commit made as a last minute change.
+
+ * kjs/regexp_object.cpp:
+
+2008-05-24 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Darin.
+
+ Changed regular expression matching result array to be lazily filled, because many callers
+ only care about it being non-null.
+
+ 2% improvement on Acid3 test 26.
+
+ * kjs/array_instance.cpp: Added a void* member to ArrayStorage for ArrayInstance subclasses
+ to use.
+ * kjs/array_instance.h:
+ (KJS::ArrayInstance::lazyCreationData):
+ (KJS::ArrayInstance::setLazyCreationData):
+ Added methods to access it from subclasses.
+
+ * kjs/regexp_object.cpp:
+ (KJS::RegExpMatchesArray::RegExpMatchesArray):
+ (KJS::RegExpMatchesArray::getOwnPropertySlot):
+ (KJS::RegExpMatchesArray::put):
+ (KJS::RegExpMatchesArray::deleteProperty):
+ (KJS::RegExpMatchesArray::getPropertyNames):
+ (KJS::RegExpMatchesArray::fillArrayInstanceIfNeeded):
+ (KJS::RegExpMatchesArray::~RegExpMatchesArray):
+ (KJS::RegExpObjectImp::arrayOfMatches):
+ RegExpMatchesArray is a subclass of ArrayInstance that isn't filled until
+ accessed for the first time.
+
+2008-05-24 Alp Toker <alp@nuanti.com>
+
+ Win32/gcc build fix. Remove MSVC assumption.
+
+ * wtf/TCSpinLock.h:
+ (TCMalloc_SlowLock):
+
+2008-05-24 Oleg Finkelshteyn <olegfink@gmail.com>
+
+ Rubber-stamped, tweaked and landed by Alexey.
+
+ Build fix for gcc 4.3.
+
+ * JavaScriptCore/kjs/testkjs.cpp:
+ * JavaScriptCore/VM/CodeBlock.cpp:
+ Add missing standard includes.
+
+2008-05-23 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Geoff.
+
+ <rdar://problem/5959886> REGRESSION: Assertion failure in JSImmediate::toString when loading GMail (19217)
+
+ Change List to store a JSValue*** pointer + an offset instead of a JSValue** pointer to protect against the case where
+ a register file changes while a list object points to its buffer.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+ * kjs/JSActivation.cpp:
+ (KJS::JSActivation::createArgumentsObject):
+ * kjs/list.cpp:
+ (KJS::List::getSlice):
+ * kjs/list.h:
+ (KJS::List::List):
+ (KJS::List::at):
+ (KJS::List::append):
+ (KJS::List::begin):
+ (KJS::List::end):
+ (KJS::List::buffer):
+
+2008-05-23 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Sam.
+
+ <rdar://problem/5960012> JSProfiler: Stack overflow if recursion is
+ too deep.
+ -Use a simple depth limit to restrict too deep of recursion.
+
+ * profiler/Profile.cpp:
+ (KJS::Profile::willExecute):
+ (KJS::Profile::didExecute):
+ * profiler/Profile.h:
+
+2008-05-23 Geoffrey Garen <ggaren@apple.com>
+
+ Rolling back in r34085, with performance resolved.
+
+ Apparently, passing the eval function to callEval gave GCC a hernia.
+
+ Reviewed by Darin Adler, Kevin McCullough, and Oliver Hunt.
+
+ Fixed <rdar://problem/5959447> Crashes and incorrect reporting in the
+ JavaScript profiler
+
+ * VM/Machine.cpp:
+ (KJS::Machine::unwindCallFrame): Fixed incorrect reporting / a crash
+ when unwinding from inside eval and/or program code: detect the
+ difference, and do the right thing. Also, be sure to notify the profiler
+ *before* deref'ing the scope chain, since the profiler uses the scope chain.
+
+ (KJS::Machine::execute): Fixed incorrect reporting / crash when calling
+ a JS function re-entrently: Machine::execute(FunctionBodyNode*...)
+ should not invoke the didExecute hook, because op_ret already does that.
+ Also, use the new function's ExecState when calling out to the profiler.
+ (Not important now, but could have become a subtle bug later.)
+
+ (KJS::Machine::privateExecute): Fixed a hard to reproduce crash when
+ profiling JS functions: notify the profiler *before* deref'ing the scope
+ chain, since the profiler uses the scope chain.
+
+ * kjs/object.cpp:
+ (KJS::JSObject::call): Removed these hooks, because they are now unnecessary.
+
+ * profiler/Profile.cpp: Added a comment to explain a subtlety that only
+ Kevin and I understood previously. (Now, the whole world can understand!)
+
+ * profiler/Profiler.cpp:
+ (KJS::shouldExcludeFunction): Don't exclude .call and .apply. That was
+ a hack to fix bugs that no longer exist.
+
+ Finally, sped things up a little bit by changing the "Is the profiler
+ running?" check into an ASSERT, since we only call into the profiler
+ when it's running:
+
+ (KJS::Profiler::willExecute):
+ (KJS::Profiler::didExecute):
+
+2008-05-23 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ - fixed <rdar://problem/5957662> REGRESSION(r33943-r33980): Can't send email , attach file or save as draft from hotmail.com
+
+ SunSpider reports no change.
+
+ This is a reworking of r34073, which I rolled out because it caused
+ lots of crashes.
+
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::CodeGenerator): Use removeDirect to nix old
+ properties whose names collide with new functions. (Don't use putWithAttributes
+ because that tries to write to the register file, which hasn't grown to
+ fit this program yet.)
+
+2008-05-23 Darin Adler <darin@apple.com>
+
+ Reviewed by Mark Rowe.
+
+ As allocateNumber is used via jsNumberCell outside of JavaScriptCore,
+ we need to provide a non-inlined version of it to avoid creating a
+ weak external symbol.
+
+ * JavaScriptCore.exp:
+ * kjs/AllInOneFile.cpp:
+ * kjs/collector.cpp:
+ (KJS::Collector::allocate):
+ (KJS::Collector::allocateNumber):
+ * kjs/collector.h:
+ (KJS::Collector::allocate):
+ (KJS::Collector::inlineAllocateNumber):
+ * kjs/value.h:
+ (KJS::NumberImp::operator new):
+
+2008-05-23 Geoffrey Garen <ggaren@apple.com>
+
+ Rolled out r34073 because it caused lots of layout test crashes.
+
+2008-05-23 Geoffrey Garen <ggaren@apple.com>
+
+ Rolled out r34085 because it measured as a 7.6% performance regression.
+
+2008-05-23 Adam Roben <aroben@apple.com>
+
+ Windows build fix
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Add the
+ profiler directory to the include path.
+
+2008-05-23 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Anders.
+
+ SQUIRRELFISH: JavaScript error messages are missing informative text
+
+ Partial fix.
+ Tidy up error messages, makes a couple of them provide slightly more info.
+ Inexplicably leads to a 1% SunSpider Progression.
+
+ * VM/ExceptionHelpers.cpp:
+ (KJS::createError):
+ (KJS::createInvalidParamError):
+ (KJS::createNotAConstructorError):
+ (KJS::createNotAFunctionError):
+ * VM/ExceptionHelpers.h:
+ * VM/Machine.cpp:
+ (KJS::isNotObject):
+
+2008-05-23 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Tim H.
+
+ Fix call stack reported by profiler when entering event handlers.
+
+ JSObject::call was arbitrarily notifying the profiler when it was
+ called, even if it was JS code, which notifies the profile on entry
+ in any case.
+
+ * kjs/object.cpp:
+ (KJS::JSObject::call):
+
+2008-05-16 Alp Toker <alp@nuanti.com>
+
+ Build fix for gcc 3. Default constructor required in ExecState,
+ used by OldInterpreterExecState.
+
+ * kjs/ExecState.h:
+ (KJS::ExecState::ExecState):
+
+2008-05-23 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Fix <rdar://problem/5954997> global-recursion-on-full-stack.html crashes under guardmalloc.
+
+ Growing the register file with uncheckedGrow from within Machine::execute is not safe as the
+ register file may be too close to its maximum size to grow successfully. By using grow,
+ checking the result and throwing a stack overflow error we can avoid crashing.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::execute):
+ * VM/RegisterFile.h: Remove the now-unused uncheckedGrow.
+
+2008-05-23 Oliver Hunt <oliver@apple.com>
+
+ RS=Kevin McCullough
+
+ Remove JAVASCRIPT_PROFILER define
+
+ * VM/Machine.cpp:
+ (KJS::callEval):
+ (KJS::Machine::unwindCallFrame):
+ (KJS::Machine::execute):
+ (KJS::Machine::privateExecute):
+ * kjs/config.h:
+ * kjs/object.cpp:
+ (KJS::JSObject::call):
+
+2008-05-23 Oliver Hunt <oliver@apple.com>
+
+ <rdar://problem/5951561> Turn on JavaScript Profiler
+
+ Reviewed by Kevin McCullough.
+
+ Flipped the switch on the profiler, rearranged how we
+ signal the the profiler is active so that calls aren't
+ needed in the general case.
+
+ Also fixed the entry point for Machine::execute(FunctionBodyNode..)
+ to correctly indicate function exit.
+
+ Results in a 0.7-1.0% regression in SunSpider :-(
+
+ * VM/Machine.cpp:
+ (KJS::callEval):
+ (KJS::Machine::unwindCallFrame):
+ (KJS::Machine::execute):
+ (KJS::Machine::privateExecute):
+ * kjs/config.h:
+ * profiler/Profiler.cpp:
+ (KJS::Profiler::profiler):
+ (KJS::Profiler::startProfiling):
+ (KJS::Profiler::stopProfiling):
+ * profiler/Profiler.h:
+ (KJS::Profiler::enabledProfilerReference):
+
+2008-05-23 Simon Hausmann <hausmann@webkit.org>
+
+ Fix the Qt build by adding profiler/ to the include search path.
+
+ * JavaScriptCore.pri:
+
+2008-05-22 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Adam.
+
+ Fix a bug in the profiler where time in the current function is given to
+ (idle).
+
+ * profiler/Profile.cpp:
+ (KJS::Profile::didExecute): Set the start time and then call didExecute
+ to calculate the time spent in this function.
+ * profiler/ProfileNode.cpp: Remove confusing calculations that are no
+ longer necessary.
+ (KJS::ProfileNode::insertNode):
+ * profiler/ProfileNode.h: Expose access to the start time to allow the
+ simpler time calculations above.
+ (KJS::ProfileNode::startTime):
+ (KJS::ProfileNode::setStartTime):
+
+2008-05-22 Adam Roben <aroben@apple.com>
+
+ Show "(Function object)" instead of "(JSInpectorCallbackWrapper
+ object)" in profiles
+
+ Reviewed by Kevin McCullough.
+
+ * profiler/Profiler.cpp:
+ (KJS::createCallIdentifier): Use JSObject::className instead of
+ getting the class name from the ClassInfo directly. JSObject
+ subclasses can override className to provide a custom class name, and
+ it seems like we should honor that.
+
+2008-05-22 Timothy Hatcher <timothy@apple.com>
+
+ Added Profile::restoreAll and added ProfileNode::restoreAll
+ to the export file.
+
+ Reviewed by Adam Roben.
+
+ * JavaScriptCore.exp:
+ * profiler/Profile.h:
+
+2008-05-22 Alp Toker <alp@nuanti.com>
+
+ GTK+ build fix. Add JavaScriptCore/profiler to include path.
+
+ * GNUmakefile.am:
+
+2008-05-22 Adam Roben <aroben@apple.com>
+
+ Implement sub-millisecond profiling on Windows
+
+ Reviewed by Kevin McCullough.
+
+ * profiler/ProfileNode.cpp:
+ (KJS::getCount): Added. On Windows, we use QueryPerformanceCounter. On
+ other platforms, we use getCurrentUTCTimeWithMicroseconds.
+ (KJS::ProfileNode::endAndRecordCall): Use getCount instead of
+ getCurrentUTCTimeWithMicroseconds.
+ (KJS::ProfileNode::startTimer): Ditto.
+
+2008-05-22 Adam Roben <aroben@apple.com>
+
+ Fix a profiler assertion when calling a NodeList as a function
+
+ Reviewed by Kevin McCullough.
+
+ * profiler/Profiler.cpp:
+ (KJS::createCallIdentifier): Don't assert when a non-function object
+ is called as a function. Instead, build up a CallIdentifier using the
+ object's class name.
+
+2008-05-22 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Darin.
+
+ <rdar://problem/5951529> JSProfiler: Allow the profiler to "Exclude" a
+ profile node.
+ -Implement 'exclude'; where the excluded node attributes its time to its
+ parent's self time.
+
+ * JavaScriptCore.exp: Export the exclude function.
+ * profiler/Profile.h:
+ (KJS::Profile::exclude):
+ * profiler/ProfileNode.cpp:
+ (KJS::ProfileNode::setTreeVisible): New function that allows a change in
+ visiblitiy to be propogated to all the children of a node.
+ (KJS::ProfileNode::exclude): If the node matches the callIdentifier then
+ set the visiblity of this node and all of its children to false and
+ attribute it's total time to it's caller's self time.
+ * profiler/ProfileNode.h:
+
+2008-05-22 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Fix access to static global variables in Windows release builds.
+
+ * kjs/JSGlobalObject.h: Don't store a reference to an Identifier
+ in GlobalPropertyInfo as the Identifier is likely to be a temporary
+ and therefore may be destroyed before the GlobalPropertyInfo.
+
+2008-05-22 Kevin McCullough <kmccullough@apple.com>
+
+ Build fix.
+
+ * VM/Machine.cpp:
+ (KJS::callEval):
+
+2008-05-22 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Sam.
+
+ <rdar://problem/5951561> Turn on JavaScript Profiler
+ Get basic JS profiling working.
+ Even with this patch the profiler will not be compiled in because we do
+ not know the extend, if any, of the performance regression it would cause
+ when it is not in use. However with these changes, if the profiler were
+ on, it would not crash and show good profiling data.
+
+ * VM/Machine.cpp: Instrument the calls sites that are needed for profiling.
+ (KJS::callEval):
+ (KJS::Machine::unwindCallFrame):
+ (KJS::Machine::execute):
+ (KJS::Machine::privateExecute):
+ * kjs/function.cpp: Ditto.
+ (KJS::globalFuncEval):
+ * kjs/interpreter.cpp: Ditto.
+ (KJS::Interpreter::evaluate):
+ * profiler/Profile.cpp:
+ (KJS::Profile::willExecute):
+ (KJS::Profile::didExecute): Because we do not get a good context when
+ startProfiling is called it is possible that m_currentNode will be at the
+ top of the known stack when a didExecute() is called. What we then do is
+ create a new node that represents the function being exited and insert
+ it between the head and the currently known children, since they should
+ be children of this new node.
+ * profiler/ProfileNode.cpp:
+ (KJS::ProfileNode::ProfileNode):
+ (KJS::ProfileNode::willExecute): Rename the add function for consistency.
+ (KJS::ProfileNode::addChild): Appends the child to this node but also
+ sets the parent pointer of the children to this node.
+ (KJS::ProfileNode::insertNode): Insert a node between this node and its
+ children. Also set the time for the new node since it is now exiting
+ and we don't really know when it started.
+ (KJS::ProfileNode::stopProfiling):
+ (KJS::ProfileNode::startTimer):
+ * profiler/ProfileNode.h:
+ (KJS::CallIdentifier::toString): Added for debugging.
+ (KJS::ProfileNode::setParent):
+ (KJS::ProfileNode::setSelfTime): Fixed an old bug where we set the
+ visibleTotalTime not the visibleSelfTime.
+ (KJS::ProfileNode::children):
+ (KJS::ProfileNode::toString): Added for debugging.
+ * profiler/Profiler.cpp: remove unecessary calls.
+ (KJS::Profiler::startProfiling):
+
+2008-05-22 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Oliver Hunt.
+
+ Rename register arguments for op_call, op_call_eval, op_end, and op_construct
+ to document what they are for.
+
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::emitCall):
+ (KJS::CodeGenerator::emitCallEval):
+ (KJS::CodeGenerator::emitEnd):
+ (KJS::CodeGenerator::emitConstruct):
+ * VM/CodeGenerator.h:
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+
+2008-05-22 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Darin.
+
+ Bug 19116: SquirrelFish shouldn't regress on variable lookups
+ <https://bugs.webkit.org/show_bug.cgi?id=19116>
+
+ Last of the multiscope look up optimisations. This is a wash overall on SunSpider
+ but is a factor of 5-10 improvement in multiscope read/write/modify (eg. ++, --, +=,
+ ... applied to any non-local var).
+
+ * kjs/nodes.cpp:
+ (KJS::PostIncResolveNode::emitCode):
+ (KJS::PostDecResolveNode::emitCode):
+ (KJS::PreIncResolveNode::emitCode):
+ (KJS::PreDecResolveNode::emitCode):
+ (KJS::ReadModifyResolveNode::emitCode):
+
+2008-05-22 David Kilzer <ddkilzer@apple.com>
+
+ <rdar://problem/5954233> Add method to release free memory from FastMalloc
+
+ Patch suggested by Mark Rowe. Rubber-stamped by Maciej.
+
+ * JavaScriptCore.exp: Export _releaseFastMallocFreeMemory.
+ * wtf/FastMalloc.cpp:
+ (WTF::TCMallocStats::): Added releaseFastMallocFreeMemory() for both
+ system malloc and FastMalloc code paths.
+ * wtf/FastMalloc.h: Define releaseFastMallocFreeMemory().
+
+2008-05-22 Oliver Hunt <oliver@apple.com>
+
+ RS=Maciej.
+
+ Roll out r34020 as it causes recursion tests to fail.
+
+ * kjs/object.cpp:
+ (KJS::JSObject::call):
+
+2008-05-22 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Mark.
+
+ Don't leak the SymbolTable when compiling eval code.
+
+ * kjs/nodes.cpp:
+ (KJS::EvalNode::generateCode):
+
+2008-05-22 Simon Hausmann <hausmann@webkit.org>
+
+ Reviewed by Oliver.
+
+ Qt build fix.
+
+ * JavaScriptCore.pri: Added DebuggerCallFrame to the build.
+ * VM/LabelID.h: Include limits.h for UINT_MAX.
+ * wtf/VectorTraits.h: Include memory for std::auto_ptr.
+
+2008-05-22 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Adam Roben.
+
+ Removed the old recursion guard mechanism, since squirrelfish has its
+ own mechanism. Also removed some old JS call tracing code, since we
+ have other ways to do that, too.
+
+ SunSpider reports no change.
+
+ * kjs/object.cpp:
+ (KJS::JSObject::call):
+
+2008-05-22 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver.
+
+ - fixed <rdar://problem/5954979> crash on celtic kane JS benchmark
+
+ * kjs/nodes.cpp:
+ (KJS::WithNode::emitCode):
+ (KJS::TryNode::emitCode):
+
+2008-05-21 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Maciej and Geoff.
+
+ <rdar://problem/5951561> Turn on JavaScript Profiler
+ -As part of the effort to turn on the profiler it would be helpful if it
+ did not need ExecStates to represent the stack location of the currently
+ executing statement.
+ -We now create each node as necessary with a reference to the current
+ node and each node knows its parent so that the tree can be made without
+ the entire stack.
+
+ * profiler/Profile.cpp:
+ (KJS::Profile::Profile): The current node starts at the head.
+ (KJS::Profile::stopProfiling): The current node is cleared when profiling
+ stops.
+ (KJS::Profile::willExecute): The current node either adds a new child or
+ starts and returns a reference to an already existing child if the call
+ ID that is requested already exists.
+ (KJS::Profile::didExecute): The current node finishes and returns its
+ parent.
+ * profiler/Profile.h: Use a single callIdentifier instead of a vector
+ since we no longer use the whole stack.
+ * profiler/ProfileNode.cpp: Now profile nodes keep a reference to their
+ parent.
+ (KJS::ProfileNode::ProfileNode): Initialize the parent.
+ (KJS::ProfileNode::didExecute): Record the time and return the parent.
+ (KJS::ProfileNode::addOrStartChild): If the given callIdentifier is
+ already a child, start it and return it, otherwise create a new one and
+ return that.
+ (KJS::ProfileNode::stopProfiling): Same logic, just use the new function.
+ * profiler/ProfileNode.h: Utilize the parent.
+ (KJS::ProfileNode::create):
+ (KJS::ProfileNode::parent):
+ * profiler/Profiler.cpp:
+ (KJS::Profiler::startProfiling): Here is the only place where the
+ ExecState is used to figure out where in the stack the profiler is
+ currently profiling.
+ (KJS::dispatchFunctionToProfiles): Only send one CallIdentifier instead
+ of a vector of them.
+ (KJS::Profiler::willExecute): Ditto.
+ (KJS::Profiler::didExecute): Ditto.
+ (KJS::createCallIdentifier): Create only one CallIdentifier.
+ (KJS::createCallIdentifierFromFunctionImp): Ditto.
+ * profiler/Profiler.h:
+
+2008-05-21 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - https://bugs.webkit.org/show_bug.cgi?id=19180
+ speed up the < operator for the case when both values are integers
+
+ Makes standalone SunSpider 1.022x faster.
+
+ * VM/Machine.cpp:
+ (KJS::jsLess): Add a special case for when both are numbers that fit in a JSImmediate.
+
+2008-05-21 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver and Sam.
+
+ - fixed <rdar://problem/5815631> REGRESSION (r31239): Multiscope optimisation of function calls results in incorrect this value (breaks tvtv.de)
+
+ Track global this value in the scope chain so we can retrieve it
+ efficiently but it follows lexical scope properly.
+
+ * kjs/ExecState.h:
+ (KJS::ExecState::globalThisValue):
+ * kjs/JSGlobalObject.h:
+ (KJS::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData):
+ * kjs/function_object.cpp:
+ (KJS::FunctionObjectImp::construct):
+ * kjs/scope_chain.h:
+ (KJS::ScopeChainNode::ScopeChainNode):
+ (KJS::ScopeChainNode::globalThisObject):
+ (KJS::ScopeChainNode::push):
+ (KJS::ScopeChain::ScopeChain):
+
+2008-05-21 Kevin McCullough <kmccullough@apple.com>
+
+ Sadness :(
+
+ * kjs/config.h:
+
+2008-05-21 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Maciej.
+
+ <rdar://problem/5950867> JSProfiler: Allow the profiler to "Focus" a
+ profile node.
+ - This patch updatest the times of the visible nodes correctly, but to do
+ so, some of the design of the ProfileNode changed.
+
+ * JavaScriptCore.exp: export focus' symbol.
+ * profiler/Profile.cpp: ProfileNodes now take a reference to the head of
+ the profile tree to get up-to-date accurate total profile time.
+ (KJS::Profile::Profile): Pass 0 for the head node.
+ (KJS::Profile::stopProfiling): stopProfiling no longer needs the time
+ passed into it, since it can get it from the head and it does not need to
+ be told it is the head because it can figure it out on it's own.
+ (KJS::Profile::willExecute): Set the head node for each created node.
+ * profiler/Profile.h:
+ (KJS::Profile::focus): Instead of taking a CallIdentifier that the caller
+ would have to create, now focus() takes a ProfileNode that they should
+ already have a reference to and focus() can extract the CallIdentifier
+ from it.
+ * profiler/ProfileNode.cpp: Create actual and visible versions fo the
+ total and self times for focus and exclude. Also add a head node
+ reference so that nodes can get information from their head.
+ (KJS::ProfileNode::ProfileNode):
+ (KJS::ProfileNode::stopProfiling): Rename the total and self time
+ variables and set the visual ones to the actual ones, so that without any
+ changes to the visual versions of these variables, their times will match
+ the actual times.
+ (KJS::ProfileNode::focus): Now focus() has a bool to force it's children
+ to be visible if this node is visible. If this node does not match the
+ CallIdentifier being focused then the visibleTotalTime is only updated if
+ one or more of it's children is the CallIdentifier being focused.
+ (KJS::ProfileNode::restoreAll): Restores all variables with respect to
+ the visible data in the ProfileNode.
+ (KJS::ProfileNode::endAndRecordCall): Name change.
+ (KJS::ProfileNode::debugPrintData): Dump the new variables.
+ (KJS::ProfileNode::debugPrintDataSampleStyle): Name change.
+ * profiler/ProfileNode.h: Use the new variables and reference to the head
+ node.
+ (KJS::ProfileNode::create):
+ (KJS::ProfileNode::totalTime):
+ (KJS::ProfileNode::setTotalTime):
+ (KJS::ProfileNode::selfTime):
+ (KJS::ProfileNode::setSelfTime):
+ (KJS::ProfileNode::totalPercent):
+ (KJS::ProfileNode::selfPercent):
+ (KJS::ProfileNode::setVisible):
+
+2008-05-21 Alp Toker <alp@nuanti.com>
+
+ GTK+/UNIX testkjs build fix. Include signal.h.
+
+ * kjs/testkjs.cpp:
+
+2008-05-21 Oliver Hunt <oliver@apple.com>
+
+ Yet more windows build fixes
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+
+2008-05-21 Oliver Hunt <oliver@apple.com>
+
+ Yet more windows build fixes
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+
+2008-05-21 Alp Toker <alp@nuanti.com>
+
+ GTK+ build fix. Add DebuggerCallFrame.cpp and take AllInOneFile.cpp
+ changes into account.
+
+ * GNUmakefile.am:
+
+2008-05-21 Oliver Hunt <oliver@apple.com>
+
+ Add DebuggerCallFrame.{h,cpp} to the project file
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+
+2008-05-21 Alp Toker <alp@nuanti.com>
+
+ GTK+ port build fixes following squirrelfish merge r33979.
+
+ * GNUmakefile.am:
+
+2008-05-21 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin.
+
+ - save a hash lookup wne writing to global properties
+ 0.3% speedup on SunSpider, 7% on bitops-bitwise-and
+
+ * VM/Machine.cpp:
+ (KJS::resolveBase): Check for being a the end of the scope chain
+ before hash lookup.
+
+2008-05-21 Alp Toker <alp@nuanti.com>
+
+ Rubber-stamped by Maciej.
+
+ Replace non-standard #pragma marks with comments to avoid compiler
+ warnings.
+
+ * profiler/ProfileNode.cpp:
+
+2008-05-21 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Mark Rowe.
+
+ Fix layout test failure in fast/dom/getter-on-window-object2 introduced in r33961.
+
+ * JavaScriptCore.exp:
+ * kjs/JSGlobalObject.cpp:
+ (KJS::JSGlobalObject::defineGetter):
+ (KJS::JSGlobalObject::defineSetter):
+ * kjs/JSGlobalObject.h:
+
+=== End merge of squirrelfish ===
+
+2008-05-21 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Tim Hatcher.
+
+ Merged with trunk WebCore's new debugger.
+
+ * kjs/DebuggerCallFrame.cpp:
+ (KJS::DebuggerCallFrame::evaluate): Changed this function to separate
+ the exception value from the return value. The WebKit debugger treats
+ them as one, but the WebCore debugger doesn't.
+
+ * kjs/DebuggerCallFrame.h:
+ (KJS::DebuggerCallFrame::dynamicGlobalObject): Added a new accessor for
+ the dynamic global object, since the debugger doesn't want the lexical
+ global object.
+
+2008-05-21 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej.
+
+ Bug 19116: SquirrelFish shouldn't regress on variable lookups
+ <https://bugs.webkit.org/show_bug.cgi?id=19116>
+
+ Optimise cross scope assignment, 0.4% progression in sunspider.
+
+ * VM/CodeBlock.cpp:
+ (KJS::CodeBlock::dump):
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::emitPutScopedVar):
+ * VM/CodeGenerator.h:
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+ * VM/Opcode.h:
+ * kjs/nodes.cpp:
+ (KJS::AssignResolveNode::emitCode):
+
+2008-05-21 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver.
+
+ - check property map before symbol table in JSGlobalObject::getOwnPropertySlot
+ 0.5% speedup on SunSpider
+
+ * kjs/JSGlobalObject.h:
+ (KJS::JSGlobalObject::getOwnPropertySlot): Check property map before symbol table
+ because symbol table access is likely to have been optimized.
+
+2008-05-21 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej.
+
+ Bug 19116: SquirrelFish shouldn't regress on variable lookups
+ <https://bugs.webkit.org/show_bug.cgi?id=19116>
+
+ Optimise multiscope lookup of statically resolvable function calls.
+ SunSpider reports a 1.5% improvement, including 37% on
+ controlflow-recursive for some reason :D
+
+ * VM/CodeBlock.cpp:
+ (KJS::CodeBlock::dump):
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::emitResolve):
+ * VM/CodeGenerator.h:
+ * kjs/nodes.cpp:
+ (KJS::FunctionCallResolveNode::emitCode):
+
+2008-05-21 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver.
+
+ - give JSGlobalObject a special version of getOwnPropertySlot that tells you if the slot is directly writable
+ (WebCore change using this is a 2.6% speedup on in-browser SunSpider).
+
+ * JavaScriptCore.exp:
+ * kjs/JSGlobalObject.h:
+ (KJS::JSGlobalObject::getOwnPropertySlot):
+ * kjs/JSVariableObject.h:
+ (KJS::JSVariableObject::symbolTableGet):
+ * kjs/object.h:
+ (KJS::JSObject::getDirectLocation):
+ (KJS::JSObject::getOwnPropertySlotForWrite):
+ * kjs/property_map.cpp:
+ (KJS::PropertyMap::getLocation):
+ * kjs/property_map.h:
+ * kjs/property_slot.h:
+ (KJS::PropertySlot::putValue):
+
+2008-05-20 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej.
+
+ Bug 19116: SquirrelFish shouldn't regress on variable lookups
+ <https://bugs.webkit.org/show_bug.cgi?id=19116>
+
+ This restores multiscope optimisation to simple resolve, producing
+ a 2.6% progression in SunSpider. Have verified that none of the
+ sites broken by the multiscope optimisation in trunk were effected
+ by this change.
+
+ * VM/CodeBlock.cpp:
+ (KJS::CodeBlock::dump):
+ * VM/CodeBlock.h:
+ (KJS::CodeBlock::CodeBlock):
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::findScopedProperty):
+ (KJS::CodeGenerator::emitResolve):
+ * VM/CodeGenerator.h:
+ * VM/Machine.cpp:
+ (KJS::resolve_n):
+ (KJS::Machine::privateExecute):
+ * VM/Opcode.h:
+ * kjs/JSVariableObject.h:
+
+2008-05-20 Oliver Hunt <oliver@apple.com>
+
+ Fixerate the windows build.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * VM/CodeGenerator.cpp:
+ * VM/RegisterFile.h:
+ * kjs/JSGlobalObject.h:
+ * kjs/Parser.cpp:
+ * kjs/interpreter.h:
+
+2008-05-20 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff.
+
+ Bug 19110: SquirrelFish: Google Maps - no maps
+ <https://bugs.webkit.org/show_bug.cgi?id=19110>
+
+ Correct a comedy of errors present in my original patch to "fix"
+ exceptions occurring midway through pre and post increment. This
+ solution is cleaner than the original, doesn't need the additional
+ opcodes, and as an added benefit does not break Google Maps.
+
+ Sunspider reports a 0.4% progression.
+
+ * VM/CodeBlock.cpp:
+ (KJS::CodeBlock::dump):
+ * VM/CodeGenerator.cpp:
+ * VM/CodeGenerator.h:
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+ * VM/Opcode.h:
+ * kjs/nodes.cpp:
+ (KJS::PreIncResolveNode::emitCode):
+ (KJS::PreDecResolveNode::emitCode):
+ (KJS::PreIncBracketNode::emitCode):
+ (KJS::PreDecBracketNode::emitCode):
+ (KJS::PreIncDotNode::emitCode):
+ (KJS::PreDecDotNode::emitCode):
+
+2008-05-20 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver.
+
+ - inline JSGlobalObject::getOwnPropertySlot
+ 1% improvement on in-browser SunSpider (a wash command-line)
+
+ * kjs/JSGlobalObject.cpp:
+ * kjs/JSGlobalObject.h:
+ (KJS::JSGlobalObject::getOwnPropertySlot):
+
+2008-05-18 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej.
+
+ Bug 18752: SQUIRRELFISH: exceptions are not always handled by the vm
+ <https://bugs.webkit.org/show_bug.cgi?id=18752>
+
+ Handle exceptions thrown by toString conversion in subscript operators,
+ this should basically complete exception handling in SquirrelFish.
+
+ Sunspider reports no regression.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+
+2008-05-17 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ [Reapplying patch with previously missing files from r33553 -- Oliver]
+
+ Behold: debugging.
+
+ SunSpider reports no change.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj: Added DebuggerCallFrame.h/.cpp,
+ and created a debugger folder.
+
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::generate): If the debugger is attached, always
+ generate full scope chains for its sake.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::unwindCallFrame): Notify the debugger when unwinding
+ due to an exception, so it doesn't keep stale call frames around.
+
+ (KJS::Machine::execute): Set Callee to 0 in eval frames, so the
+ debugger can distinguish them from function call frames.
+
+ (KJS::Machine::debug): Simplified this function, since the debugger
+ doesn't actually need all the information we used to provide.
+
+ (KJS::Machine::privateExecute): Treat debugging hooks like other function
+ calls, so the code we hook into (the debugger UI) can be optimized.
+
+ * kjs/debugger.cpp: Nixed these default callback implementations and
+ made the callbacks pure virtual instead, so the compiler could tell me
+ if I made a mistake in one of the subclasses.
+
+ * kjs/debugger.h: Removed a bunch of irrelevent data from the debugger
+ callbacks. Changed from passing an ExecState* to passing a
+ DebuggerCallFrame*, since an ExecState* doesn't contain sufficient
+ information anymore.
+
+ * kjs/function.cpp:
+ (KJS::globalFuncEval): Easiest bug fix evar!
+
+ [Previously missing files from r33553]
+ * kjs/DebuggerCallFrame.cpp: Copied from JavaScriptCore/profiler/FunctionCallProfile.h.
+ (KJS::DebuggerCallFrame::functionName):
+ (KJS::DebuggerCallFrame::thisObject):
+ (KJS::DebuggerCallFrame::evaluateScript):
+ * kjs/DebuggerCallFrame.h: Copied from JavaScriptCore/VM/Register.h.
+ (KJS::DebuggerCallFrame::DebuggerCallFrame):
+ (KJS::DebuggerCallFrame::scopeChain):
+ (KJS::DebuggerCallFrame::exception):
+
+2008-05-17 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Oliver.
+
+ Bug 18991: SquirrelFish: Major codegen issue in a.b=expr, a[b]=expr
+ <https://bugs.webkit.org/show_bug.cgi?id=18991>
+
+ Fix the last remaining blocking cases of this bug.
+
+ * kjs/grammar.y:
+ * kjs/nodes.cpp:
+ (KJS::ReadModifyResolveNode::emitCode):
+
+2008-05-17 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Oliver.
+
+ Partial fix for:
+
+ Bug 18991: SquirrelFish: Major codegen issue in a.b=expr, a[b]=expr
+ <https://bugs.webkit.org/show_bug.cgi?id=18991>
+
+ Ensure that the code generated for assignments uses temporaries whenever
+ necessary. This patch covers the vast majority of situations, but there
+ are still a few left.
+
+ This patch also adds some missing cases to CodeBlock::dump().
+
+ * VM/CodeBlock.cpp:
+ (KJS::CodeBlock::dump):
+ * VM/CodeGenerator.h:
+ (KJS::CodeGenerator::destinationForAssignResult):
+ (KJS::CodeGenerator::leftHandSideNeedsCopy):
+ (KJS::CodeGenerator::emitNodeForLeftHandSide):
+ * kjs/NodeInfo.h:
+ * kjs/grammar.y:
+ * kjs/nodes.cpp:
+ (KJS::AssignDotNode::emitCode):
+ (KJS::ReadModifyDotNode::emitCode):
+ (KJS::AssignBracketNode::emitCode):
+ (KJS::ReadModifyBracketNode::emitCode):
+ (KJS::ForInNode::ForInNode):
+ * kjs/nodes.h:
+ (KJS::ReadModifyResolveNode::):
+ (KJS::AssignResolveNode::):
+ (KJS::ReadModifyBracketNode::):
+ (KJS::AssignBracketNode::):
+ (KJS::AssignDotNode::):
+ (KJS::ReadModifyDotNode::):
+
+2008-05-17 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej.
+
+ Bug 19106: SquirrelFish: Activation is not marked correctly
+ <https://bugs.webkit.org/show_bug.cgi?id=19106>
+
+ We can't rely on the symbol table for a count of the number of globals
+ we need to mark as that misses duplicate parameters and 'this'. Now we
+ use the actual local register count from the codeBlock.
+
+ * kjs/JSActivation.cpp:
+ (KJS::JSActivation::mark):
+
+2008-05-16 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff.
+
+ Bug 19076: SquirrelFish: RegisterFile can be corrupted if implictly reenter global scope with no declared vars
+ <https://bugs.webkit.org/show_bug.cgi?id=19076>
+
+ Don't delay allocation of initial global RegisterFile, as we can't guarantee we will be able
+ to allocate the global 'this' register safely at any point after initialisation of the Global
+ Object.
+
+ Unfortunately this initial allocation caused a regression of 0.2-0.3%, however this patch adds
+ support for the static slot optimisation for the global Math object which brings it to a 0.3%
+ progression.
+
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::programCodeThis):
+ (KJS::CodeGenerator::CodeGenerator):
+ (KJS::CodeGenerator::addParameter):
+ * VM/CodeGenerator.h:
+ * VM/Machine.cpp:
+ (KJS::Machine::execute):
+ * kjs/ExecState.h:
+ * kjs/JSGlobalObject.cpp:
+ (KJS::JSGlobalObject::reset):
+ * kjs/JSGlobalObject.h:
+ (KJS::JSGlobalObject::GlobalPropertyInfo::GlobalPropertyInfo):
+ (KJS::JSGlobalObject::addStaticGlobals):
+ * kjs/nodes.cpp:
+
+2008-05-16 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 19098: SquirrelFish: Ref'd temporaries can be clobbered
+ <https://bugs.webkit.org/show_bug.cgi?id=19098>
+
+ When doing code generation for a statement list, increase the reference
+ count on a register that might eventually be returned, so that it doesn't
+ get clobbered by a request for a new temporary.
+
+ * kjs/nodes.cpp:
+ (KJS::statementListEmitCode):
+
+2008-05-16 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver.
+
+ - fixed Bug 19044: SquirrelFish: Bogus values enter evaluation when closing over scope with parameter and var with same name
+ https://bugs.webkit.org/show_bug.cgi?id=19044
+
+ * kjs/JSActivation.cpp:
+ (KJS::JSActivation::copyRegisters): Use numLocals from the code
+ block rather than the size of the symbol table for the number of
+ registers to copy, to account for duplicate parameters and vars
+ with the same name as parameters (we still have potentially
+ suboptimal codegen in that we allocate a local register for the
+ var in the latter case but it is never used).
+
+2008-05-15 Geoffrey Garen <ggaren@apple.com>
+
+ Not reviewed.
+
+ We regret to inform you that your program is crashing because you were
+ stupid.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute): Math is hard.
+
+2008-05-14 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ A little more debugger action: filled in op_debug. All debugger control
+ flow works now, but variable inspection and backtraces still don't.
+
+ SunSpider reports no change.
+
+ * VM/CodeGenerator.cpp: Changed op_debug to accept line number parameters.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::getFunctionAndArguments): Moved op_debug into a
+ NEVER_INLINE function to avoid a stunning 10% performance regression.
+ Also factored out a common function for retrieving the function and
+ arguments from a call frame.
+
+ * kjs/JSActivation.cpp:
+ (KJS::JSActivation::createArgumentsObject): Use the new factored out
+ function mentioned above.
+
+ * kjs/Parser.cpp:
+ (KJS::Parser::parse): Increment m_sourceId before assigning it, so the
+ sourceId we send to the debugger matches the sourceId recorded in the
+ node.
+
+ * kjs/nodes.cpp: Emit debugging hooks.
+
+2008-05-14 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej.
+
+ Bug 19024: SQUIRRELFISH: ASSERTION FAILED: activation->isActivationObject() in Machine::unwindCallFrame
+ <https://bugs.webkit.org/show_bug.cgi?id=19024>
+
+ This fixes a number of issues. The most important is that we now check every register
+ file for tainting rather than just looking for function register files as that was
+ insufficient. Additionally guarded against implicit re-entry into Eval code.
+
+ Also added a few additional assertions to reduce the amout of time between something
+ going wrong and us seeing the error.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::execute):
+ (KJS::Machine::privateExecute):
+ * VM/RegisterFile.cpp:
+ (KJS::RegisterFile::growBuffer):
+ (KJS::RegisterFile::addGlobalSlots):
+ * VM/RegisterFileStack.cpp:
+ (KJS::RegisterFileStack::pushGlobalRegisterFile):
+ (KJS::RegisterFileStack::pushFunctionRegisterFile):
+ * VM/RegisterFileStack.h:
+ (KJS::RegisterFileStack::inImplicitCall):
+
+2008-05-14 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ A little more debugger action: emit opcodes for debugger hooks. Right
+ now, the opcode implementation is just a stub.
+
+ SunSpider reports no change.
+
+ Some example codegen for "function f() { 1; }":
+
+ [ 0] dbg DidEnterCallFrame
+ [ 2] dbg WillExecuteStatement
+ [ 4] load tr0, 1(@k0)
+ [ 7] load tr0, undefined(@k1)
+ [ 10] dbg WillLeaveCallFrame
+ [ 12] ret tr0
+
+2008-05-14 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff.
+
+ Bug 19025: SQUIRRELFISH: malformed syntax in onload handler causes crash
+ <https://bugs.webkit.org/show_bug.cgi?id=19025>
+
+ Simple fix -- move the use of functionBodyNode to after the null check.
+
+ * kjs/function_object.cpp:
+ (KJS::FunctionObjectImp::construct):
+
+2008-05-13 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Fixed a codegen crash with run-time parse errors.
+
+ SunSpider reports no change.
+
+ emitThrowError needs to return the temporary holding the error, not dst,
+ since dst may be NULL. In fact, emitThrowError shouldn't take a dst
+ parameter at all, since exceptions should not modify the destination
+ register.
+
+2008-05-13 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff.
+
+ Bug 19027: SquirrelFish: Incorrect codegen for pre-increment
+ <https://bugs.webkit.org/show_bug.cgi?id=19027>
+
+ This fixes the codegen issues for the pre-inc/decrement operators
+ to prevent incorrectly clobbering the destination in the event of
+ an exception.
+
+ * VM/CodeBlock.cpp:
+ (KJS::CodeBlock::dump):
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::emitPreInc):
+ (KJS::CodeGenerator::emitPreDec):
+ * VM/CodeGenerator.h:
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+ * VM/Opcode.h:
+ * kjs/nodes.cpp:
+ (KJS::PreIncResolveNode::emitCode):
+ (KJS::PreDecResolveNode::emitCode):
+ (KJS::PreIncBracketNode::emitCode):
+ (KJS::PreDecBracketNode::emitCode):
+ (KJS::PreIncDotNode::emitCode):
+ (KJS::PreDecDotNode::emitCode):
+
+2008-05-13 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ A little more debugger action: supply a real line number, sourceId,
+ and sourceURL in op_new_error.
+
+ SunSpider reports a .2% speedup. Not sure what that's about.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute): Use the new good stuff in op_new_error.
+
+ * kjs/nodes.cpp:
+ (KJS::RegExpNode::emitCode): Use the shared emitThrowError instead of
+ rolling our own.
+
+2008-05-13 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ A little more debugger action: implemented the exception callback.
+
+ SunSpider reports a .2% speedup. Not sure what that's about.
+
+ * VM/CodeBlock.h: A little refactoring here. Store a pointer to our
+ owner ScopeNode so we can retrieve data from it. This allows us to
+ stop storing copies of the data ourselves. Also, store a "this" register
+ instead of a code type, since we were only using the code type to
+ calculate the "this" register.
+
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::generate): Calculate the "this" register mentioned
+ above. Also, take care of removing "this" from the symbol table after
+ codegen is done, since relying on the timing of a destructor for correct
+ behavior is not so good.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::throwException): Invoke the debugger's exception callback.
+ (KJS::Machine::privateExecute): Use the "this" register mentioned above.
+
+2008-05-13 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Removed some unused exception machinery.
+
+ SunSpider reports a .3% speedup.
+
+ * API/JSCallbackObject.h:
+ * API/JSCallbackObjectFunctions.h:
+ * JavaScriptCore.exp:
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+ * kjs/internal.cpp:
+ * kjs/object.cpp:
+ * kjs/object.h:
+ * kjs/value.h:
+
+2008-05-13 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ A little more debugger action.
+
+ * kjs/debugger.cpp:
+ * kjs/debugger.h: Removed debuggersPresent because it was unused.
+ Replaced AttachedGlobalObject linked list with a HashSet because HashSet
+ is faster and simpler. Changed all functions to return void instead of
+ bool, because no clients ever return false, and we don't want to support
+ it.
+
+ * kjs/nodes.cpp: Did some up-keep to avoid build bustage.
+ (KJS::Node::handleException):
+ (KJS::BreakpointCheckStatement::execute):
+ (KJS::FunctionBodyNodeWithDebuggerHooks::execute):
+
+2008-05-13 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Darin.
+
+ Bug 18752: SQUIRRELFISH: exceptions are not always handled by the vm
+ <https://bugs.webkit.org/show_bug.cgi?id=18752>
+
+ Replace old attempt at "branchless" exceptions as the extra information
+ being passed made gcc an unhappy compiler, replacing these custom toNumber
+ calls with ordinary toNumber logic (by relying on toNumber now preventing
+ side effects after an exception has been thrown) provided sufficient leeway
+ to add the additional checks for the remaining unchecked cases.
+
+ This leaves only toString conversions in certain contexts as possibly
+ misbehaving.
+
+ * VM/Machine.cpp:
+ (KJS::jsAdd):
+ (KJS::resolve):
+ (KJS::resolveBaseAndProperty):
+ (KJS::resolveBaseAndFunc):
+ (KJS::Machine::privateExecute):
+ * VM/Opcode.h:
+ * kjs/value.h:
+ (KJS::JSValue::safeGetNumber):
+
+2008-05-13 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ First steps toward supporting the debugger API: support the sourceParsed
+ callback; plus some minor fixups.
+
+ SunSpider reports no regression.
+
+ * VM/CodeGenerator.h: Removed a misleading comment.
+
+ * kjs/Parser.h: Changed the parser to take an ExecState*, so it can
+ implement the sourceParsed callback -- that way, we only have to
+ implement the callback in one place.
+
+ * kjs/debugger.cpp: Nixed DebuggerImp, because its sole purpose in life
+ was to demonstrate the misapplication of design patterns.
+
+ * kjs/debugger.h: Changed sourceParsed to take a SourceProvider, to
+ reduce copying, and not to return a value, because pausing execution
+ after parsing is complicated, and no clients needed that ability, anyway.
+
+ * kjs/grammar.y: Make sure never to pass a NULL SourceElements* to
+ didFinishParsing -- that simplifies some code down the road.
+
+ * kjs/nodes.cpp: Don't generate special AST nodes just because the
+ debugger is attached -- that's a relic of the old AST execution model,
+ and those nodes haven't been maintained.
+
+2008-05-13 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff.
+
+ Bug 18752: SQUIRRELFISH: exceptions are not always handled by the vm
+ <https://bugs.webkit.org/show_bug.cgi?id=18752>
+
+ First step: prevent incorrect evaluation of valueOf/toString conversion
+ in right hand side of expression after earlier conversion throws.
+
+ * API/JSCallbackObjectFunctions.h:
+ (KJS::::toNumber):
+ * kjs/object.cpp:
+ (KJS::JSObject::defaultValue):
+
+2008-05-12 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff.
+
+ Bug 18934: SQUIRRELFISH: ASSERT @ nytimes.com due to RegisterFile being clobbered
+ <https://bugs.webkit.org/show_bug.cgi?id=18934>
+
+ Unfortunately we cannot create new statically optimised globals if there are any
+ tainted RegisterFiles on the RegisterFileStack. To handle this we re-introduce
+ (in a slightly cleaner form) the inImplicitCall concept to the RegisterFileStack.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::execute):
+ * VM/RegisterFileStack.cpp:
+ (KJS::RegisterFileStack::pushFunctionRegisterFile):
+ * VM/RegisterFileStack.h:
+
+2008-05-12 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Introduced support for function.caller.
+
+ Improved support for walking interesting scopes for function introspection.
+
+ This fixes all remaining layout tests not blocked by rebasing to trunk.
+
+ SunSpider reports no change.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::dumpRegisters): Fixed a spacing issue.
+
+2008-05-11 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Oliver.
+
+ Bug 18961: SQUIRRELFISH: Gmail doesn't load
+ <https://bugs.webkit.org/show_bug.cgi?id=18961>
+
+ Fix codegen for logical nodes so that they don't use their destination
+ as a temporary.
+
+ * kjs/nodes.cpp:
+ (KJS::LogicalAndNode::emitCode):
+ (KJS::LogicalOrNode::emitCode):
+
+2008-05-10 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver.
+
+ - JavaScriptCore part of fix for: "SQUIRRELFISH: function toString broken after calling"
+ https://bugs.webkit.org/show_bug.cgi?id=18869
+
+ Three layout tests are fixed:
+ fast/js/toString-elision-trailing-comma.html
+ fast/js/toString-prefix-postfix-preserve-parens.html
+ fast/js/kde/lval-exceptions.html
+
+ Functions now save a shared subrange of the original source used
+ to make them (so in the common case this adds no storage above the
+ memory cache).
+
+ * kjs/SourceProvider.h: Added.
+ (KJS::SourceProvider): New abstract base class for classes that provide on-demand access
+ to the source for a JavaScript program. This allows function objects to have access to their
+ original source without copying.
+ (KJS::UStringSourceProvider): SourceProvider subclass backed by a KJS::UString.
+ (KJS::UStringSourceProvider::create):
+ (KJS::UStringSourceProvider::getRange):
+ (KJS::UStringSourceProvider::data):
+ (KJS::UStringSourceProvider::length):
+ (KJS::UStringSourceProvider::UStringSourceProvider):
+ * kjs/SourceRange.h: Added.
+ (KJS::SourceRange::SourceRange): Class that holds a SourceProvider and a character range into
+ the source, to encapsulate on-demand access to the source of a function.
+ (KJS::SourceRange::toString):
+ * VM/Machine.cpp:
+ (KJS::eval): Pass a UStringSourceProvider to the parser.
+ * kjs/Parser.cpp:
+ (KJS::Parser::parse): Take a SourceProvider and pass it on to the lexer.
+ * kjs/Parser.h:
+ (KJS::Parser::parse): Take a SourceProvider.
+ * kjs/lexer.cpp:
+ (KJS::Lexer::setCode): Take a SourceProvider; keep it around, and
+ use it to get the raw buffer and length.
+ * kjs/lexer.h:
+ (KJS::Lexer::sourceRange): Convenience function to get a source
+ range based on the lexer's source provieder, and char offsets
+ right before and after the desired range.
+ * kjs/function.cpp:
+ (KJS::globalFuncEval): Pass a UStringSourceProvider to the parser.
+ * kjs/function_object.cpp:
+ (KJS::functionProtoFuncToString): Use toSourceString to get the source.
+ (KJS::FunctionObjectImp::construct): Give the parser a UStringSourceProvider.
+ * kjs/grammar.y: When parsing a function declaration, function
+ expression, or getter or setter, tell the function body about its
+ SourceRange.
+ * kjs/interpreter.cpp:
+ (KJS::Interpreter::checkSyntax): Pass a SourceProvider to the parser.
+ (KJS::Interpreter::evaluate): Pass a SourceProvider to the parser.
+ * kjs/interpreter.h:
+ * kjs/nodes.h:
+ (KJS::FunctionBodyNode::setSource): Establish a SourceRange for this function.
+ (KJS::FunctionBodyNode::toSourceString): Get the source string out
+ of the SourceRange.
+ (KJS::FuncExprNode::): Take a SourceRange and set it on the body.
+ (KJS::FuncDeclNode::): ditto
+ * kjs/testkjs.cpp:
+ (prettyPrintScript): Use a SourceProvider appropriately.
+ * JavaScriptCore.exp: Export new symbols.
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Add new files.
+ * JavaScriptCore.xcodeproj/project.pbxproj: Add new files.
+
+2008-05-09 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej.
+
+ Bring back RegisterFile tainting in order to correctly handle
+ natively implemented getters and setters that re-enter JavaScript
+
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+ * VM/RegisterFile.h:
+ * kjs/function.cpp:
+ (KJS::FunctionImp::callAsFunction):
+ * kjs/object.cpp:
+ (KJS::JSObject::put):
+ (KJS::tryGetAndCallProperty):
+ * kjs/property_slot.cpp:
+ (KJS::PropertySlot::functionGetter):
+
+2008-05-09 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver.
+
+ - track character offsets of open and close braces, in preparation for saving function source
+
+ I verified that there is no performance regression from this change.
+
+ * kjs/grammar.y:
+ * kjs/lexer.cpp:
+ (KJS::Lexer::lex):
+ (KJS::Lexer::matchPunctuator):
+ * kjs/lexer.h:
+
+2008-05-09 Oliver Hunt <oliver@apple.com>
+
+ Debug build fix
+
+ * kjs/JSGlobalObject.cpp:
+ (KJS::JSGlobalObject::restoreLocalStorage):
+
+2008-05-09 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff.
+
+ Build fixes for SquirrelFish on windows.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
+ * VM/Register.h:
+ * kjs/JSGlobalObject.cpp:
+ (KJS::JSGlobalObject::restoreLocalStorage):
+ * kjs/collector.cpp:
+ (KJS::Collector::allocate):
+ (KJS::Collector::allocateNumber):
+ * kjs/collector.h:
+ (KJS::Collector::allocate):
+ (KJS::Collector::allocateNumber):
+ * kjs/property_slot.cpp:
+
+2008-05-08 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Geoff.
+
+ - fix activation tearoff in the case where functions are called with too many arguments
+
+ Fixes:
+ fast/canvas/patternfill-repeat.html
+ fast/dom/SelectorAPI/bug-17313.html
+
+ * VM/Machine.cpp:
+ (KJS::slideRegisterWindowForCall):
+ (KJS::scopeChainForCall):
+ (KJS::Machine::execute):
+ (KJS::Machine::privateExecute):
+
+2008-05-08 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Fixed failure in fast/canvas/canvas-pattern-behaviour.html.
+
+ SunSpider reports a small speedup. Not sure what that's about.
+
+ * VM/CodeBlock.cpp:
+ (KJS::CodeBlock::dump): Fixed op_call_eval to dump as "op_call_eval".
+ This helped me while debugging.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::unwindCallFrame): When looking for an activation to tear
+ off, don't use the scope chain. Inside eval, the scope chain doesn't
+ belong to us; it belongs to our calling function.
+
+ Also, don't use the needsFullScopeChain flag to decide whether to tear
+ off the activation. "function.arguments" can create an activation
+ for a function whose needsFullScopeChain flag is set to false.
+
+2008-05-08 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver.
+
+ - fix function.call for calls of more than 8 arguments
+
+ Fixes svg/carto.net/button.svg
+
+ * kjs/list.cpp:
+ (KJS::List::getSlice): properly set up the m_buffer of the target list.
+
+2008-05-08 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver.
+
+ - don't return a null RegisterID from RegExpNode in the exception case, since the caller may need a real register
+
+ Fixes:
+ - fast/regex/early-acid3-86.html
+ - http/tests/misc/acid3.html
+
+ * kjs/nodes.cpp:
+ (KJS::RegExpNode::emitCode):
+
+2008-05-07 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Oliver.
+
+ Fix a performance regression caused by the introduction of property
+ attributes to SymbolTable in r32859 by encoding the attributes and the
+ register index into a single field of SymbolTableEntry.
+
+ This leaves Node::optimizeVariableAccess() definitely broken, although
+ it was probably not entirely correct in SquirrelFish before this change.
+
+ * VM/CodeBlock.h:
+ (KJS::missingThisObjectMarker):
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::addVar):
+ (KJS::CodeGenerator::CodeGenerator):
+ (KJS::CodeGenerator::registerForLocal):
+ (KJS::CodeGenerator::registerForLocalConstInit):
+ (KJS::CodeGenerator::isLocalConstant):
+ (KJS::CodeGenerator::addConstant):
+ (KJS::CodeGenerator::emitCall):
+ * VM/CodeGenerator.h:
+ (KJS::CodeGenerator::IdentifierMapIndexHashTraits::emptyValue):
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+ * kjs/JSGlobalObject.cpp:
+ (KJS::JSGlobalObject::saveLocalStorage):
+ * kjs/JSVariableObject.cpp:
+ (KJS::JSVariableObject::getPropertyNames):
+ (KJS::JSVariableObject::getPropertyAttributes):
+ * kjs/JSVariableObject.h:
+ (KJS::JSVariableObject::symbolTableGet):
+ (KJS::JSVariableObject::symbolTablePut):
+ (KJS::JSVariableObject::symbolTablePutWithAttributes):
+ * kjs/SymbolTable.h:
+ (KJS::SymbolTableEntry::SymbolTableEntry):
+ (KJS::SymbolTableEntry::isEmpty):
+ (KJS::SymbolTableEntry::getIndex):
+ (KJS::SymbolTableEntry::getAttributes):
+ (KJS::SymbolTableEntry::setAttributes):
+ (KJS::SymbolTableEntry::isReadOnly):
+ * kjs/nodes.cpp:
+ (KJS::getSymbolTableEntry):
+ (KJS::PostIncResolveNode::optimizeVariableAccess):
+ (KJS::PostDecResolveNode::optimizeVariableAccess):
+ (KJS::DeleteResolveNode::optimizeVariableAccess):
+ (KJS::TypeOfResolveNode::optimizeVariableAccess):
+ (KJS::PreIncResolveNode::optimizeVariableAccess):
+ (KJS::PreDecResolveNode::optimizeVariableAccess):
+ (KJS::ReadModifyResolveNode::optimizeVariableAccess):
+ (KJS::AssignResolveNode::optimizeVariableAccess):
+ (KJS::ProgramNode::initializeSymbolTable):
+
+2008-05-06 Maciej Stachowiak <mjs@apple.com>
+
+ Rubber stamped by Oliver.
+
+ - add missing ! in an assert that I failed to reverse
+
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::CodeGenerator):
+
+2008-05-06 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver.
+
+ - fixed "SQUIRRELFISH: window.this shows up as a property, but it shouldn't"
+ https://bugs.webkit.org/show_bug.cgi?id=18868
+
+ The basic approach is to have "this" only be present in the symbol
+ table at compile time, not runtime.
+
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::~CodeGenerator): Remove "this" from symbol table.
+ (KJS::CodeGenerator::CodeGenerator): Add "this" back when re-using
+ a symbol table.
+ * VM/CodeGenerator.h:
+ * VM/Machine.cpp:
+ (KJS::Machine::execute): Don't assert that "this" is in the symbol table.
+
+2008-05-06 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Trivial support for function.arguments: Currently, we only support
+ function.arguments from within the scope of function.
+
+ This fixes the remaining Mozilla JS test failures.
+
+ SunSpider reports no change.
+
+ * JavaScriptCore.exp:
+
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute): Separated scope chain deref from
+ activation register copying: since it is now possible for client code
+ to create an activation on behalf of a function that otherwise wouldn't
+ need one, having an activation no longer necessarily means that you need
+ to deref the scope chain.
+
+ (KJS::Machine::getCallFrame): For now, this function only examines the
+ current scope. Walking parent scopes requires some refactoring in the
+ way we track execution stacks.
+
+ * kjs/ExecState.cpp:
+ (KJS::ExecState::ExecState): We use a negative call frame offset to
+ indicate that a given scope is not a function call scope.
+
+2008-05-05 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff.
+
+ Fix call frame set up for native -> JS function calls.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::execute):
+
+2008-05-05 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Fixed ecma_3/Object/8.6.2.6-001.js, and similar bugs.
+
+ SunSpider reports a .4% speedup. Not sure what that's about.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute): Check for exception return from equal,
+ since toPrimitive can throw.
+
+ * kjs/operations.cpp:
+ (KJS::strictEqual): In response to an error I made in an earlier version
+ of this patch, I changed strictEqual to make clear the fact that it
+ performs no conversions and can't throw, making it slightly more efficient
+ in the process.
+
+2008-05-05 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver.
+
+ - fix some dumb mistakes in my last patch
+
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::emitPushScope):
+ (KJS::CodeGenerator::emitGetPropertyNames):
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+
+2008-05-05 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver.
+
+ - document opcodes relating to jumps, scopes, and property name iteration
+
+ Documented jmp, jtrue, false, push_scope, pop_scope, get_pnames,
+ next_pname and jmp_scopes.
+
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::emitJump):
+ (KJS::CodeGenerator::emitJumpIfTrue):
+ (KJS::CodeGenerator::emitJumpIfFalse):
+ (KJS::CodeGenerator::emitPushScope):
+ (KJS::CodeGenerator::emitNextPropertyName):
+ (KJS::CodeGenerator::emitGetPropertyNames):
+ * VM/CodeGenerator.h:
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+ * kjs/nodes.cpp:
+ (KJS::LogicalAndNode::emitCode):
+ (KJS::LogicalOrNode::emitCode):
+ (KJS::ConditionalNode::emitCode):
+ (KJS::IfNode::emitCode):
+ (KJS::IfElseNode::emitCode):
+ (KJS::DoWhileNode::emitCode):
+ (KJS::WhileNode::emitCode):
+ (KJS::ForNode::emitCode):
+ (KJS::ForInNode::emitCode):
+ (KJS::WithNode::emitCode):
+
+2008-05-05 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Oliver.
+
+ Bug 18749: SQUIRRELFISH: const support is broken
+ <https://bugs.webkit.org/show_bug.cgi?id=18749>
+
+ Adds support for const during code generation.
+
+ Fixes 2 layout tests.
+
+ * ChangeLog:
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::addVar):
+ (KJS::CodeGenerator::CodeGenerator):
+ (KJS::CodeGenerator::isLocalConstant):
+ * VM/CodeGenerator.h:
+ (KJS::CodeGenerator::addVar):
+ * kjs/nodes.cpp:
+ (KJS::PostIncResolveNode::emitCode):
+ (KJS::PostDecResolveNode::emitCode):
+ (KJS::PreIncResolveNode::emitCode):
+ (KJS::PreDecResolveNode::emitCode):
+ (KJS::ReadModifyResolveNode::emitCode):
+ (KJS::AssignResolveNode::emitCode):
+
+2008-05-04 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Geoff.
+
+ - document some more opcodes (and fix argument names)
+
+ Added docs for eq, neq, stricteq, nstriceq, less and lesseq.
+
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::emitEqual):
+ (KJS::CodeGenerator::emitNotEqual):
+ (KJS::CodeGenerator::emitStrictEqual):
+ (KJS::CodeGenerator::emitNotStrictEqual):
+ (KJS::CodeGenerator::emitLess):
+ (KJS::CodeGenerator::emitLessEq):
+ * VM/CodeGenerator.h:
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+ * kjs/nodes.cpp:
+ (KJS::LessNode::emitCode):
+ (KJS::GreaterNode::emitCode):
+ (KJS::LessEqNode::emitCode):
+ (KJS::GreaterEqNode::emitCode):
+ (KJS::EqualNode::emitCode):
+ (KJS::NotEqualNode::emitCode):
+ (KJS::StrictEqualNode::emitCode):
+ (KJS::NotStrictEqualNode::emitCode):
+ (KJS::CaseBlockNode::emitCodeForBlock):
+
+2008-05-04 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ More scaffolding for f.arguments.
+
+ Track the offset of the last call frame in the ExecState, so we can
+ produce a backtrace at any time.
+
+ Also, record numLocals, the sum of numVars + numParameters, in each code
+ block, to make updates to the ExecState a little cheaper than they
+ would be otherwise.
+
+ We now use numLocals in a bunch of places where we used to calculate
+ numVars + numParameters or -numVars - numParameters.
+
+ Reports are mixed, but all in all, this seems to be a wash on SunSpider.
+
+2008-05-04 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff.
+
+ Whoops, correctly handle properties that don't exist in the
+ symbol table.
+
+ * kjs/JSVariableObject.h:
+ (KJS::JSVariableObject::symbolTablePutWithAttributes):
+
+2008-05-04 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff.
+
+ Add attribute information to SymbolTable as ground work for
+ various DontEnum and ReadOnly issues.
+
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::addVar):
+ (KJS::CodeGenerator::CodeGenerator):
+ (KJS::CodeGenerator::registerForLocal):
+ (KJS::CodeGenerator::registerForLocalConstInit):
+ (KJS::CodeGenerator::addConstant):
+ * VM/Machine.cpp:
+ (KJS::Machine::execute):
+ * kjs/JSGlobalObject.cpp:
+ (KJS::JSGlobalObject::saveLocalStorage):
+ * kjs/JSVariableObject.cpp:
+ (KJS::JSVariableObject::getPropertyNames):
+ (KJS::JSVariableObject::getPropertyAttributes):
+ * kjs/JSVariableObject.h:
+ (KJS::JSVariableObject::symbolTablePut):
+ (KJS::JSVariableObject::symbolTablePutWithAttributes):
+ * kjs/SymbolTable.h:
+ (KJS::SymbolTableEntry::SymbolTableEntry):
+ (KJS::SymbolTableIndexHashTraits::emptyValue):
+ * kjs/nodes.cpp:
+ (KJS::getSymbolTableEntry):
+ (KJS::ReadModifyResolveNode::optimizeVariableAccess):
+ (KJS::AssignResolveNode::optimizeVariableAccess):
+ (KJS::ProgramNode::initializeSymbolTable):
+
+2008-05-04 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ More scaffolding for f.arguments.
+
+ Store the register file associated with an ExecState in the ExecState.
+
+ SunSpider reports no change.
+
+ * kjs/JSGlobalObject.h:
+ (KJS::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData): Moved
+ registerFileStack above globalExec, so it gets initialized first.
+ Removed remnants of old activation scheme.
+
+2008-05-04 Maciej Stachowiak <mjs@apple.com>
+
+ Rubber stamped by Oliver.
+
+ - renamed a few opcodes and fixed assembly formatting to accomodate the longest opcode
+
+ equal --> eq
+ nequal --> neq
+ resolve_base_and_property --> resolve_with_base
+ resolve_base_and_func --> resolve_func
+ get_prop_id --> get_by_id
+ put_prop_id --> put_by_id
+ delete_prop_id --> del_by_id
+ get_prop_val --> get_by_val
+ put_prop_val --> put_by_val
+ delete_prop_val --> del_by_val
+ put_prop_index --> put_by_index
+
+ * VM/CodeBlock.cpp:
+ (KJS::printUnaryOp):
+ (KJS::printBinaryOp):
+ (KJS::printConditionalJump):
+ (KJS::CodeBlock::dump):
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::emitEqual):
+ (KJS::CodeGenerator::emitNotEqual):
+ (KJS::CodeGenerator::emitResolveWithBase):
+ (KJS::CodeGenerator::emitResolveFunction):
+ (KJS::CodeGenerator::emitGetById):
+ (KJS::CodeGenerator::emitPutById):
+ (KJS::CodeGenerator::emitDeleteById):
+ (KJS::CodeGenerator::emitGetByVal):
+ (KJS::CodeGenerator::emitPutByVal):
+ (KJS::CodeGenerator::emitDeleteByVal):
+ (KJS::CodeGenerator::emitPutByIndex):
+ * VM/CodeGenerator.h:
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+ * VM/Opcode.h:
+ * kjs/nodes.cpp:
+ (KJS::ArrayNode::emitCode):
+ (KJS::PropertyListNode::emitCode):
+ (KJS::BracketAccessorNode::emitCode):
+ (KJS::DotAccessorNode::emitCode):
+ (KJS::EvalFunctionCallNode::emitCode):
+ (KJS::FunctionCallResolveNode::emitCode):
+ (KJS::FunctionCallBracketNode::emitCode):
+ (KJS::FunctionCallDotNode::emitCode):
+ (KJS::PostIncResolveNode::emitCode):
+ (KJS::PostDecResolveNode::emitCode):
+ (KJS::PostIncBracketNode::emitCode):
+ (KJS::PostDecBracketNode::emitCode):
+ (KJS::PostIncDotNode::emitCode):
+ (KJS::PostDecDotNode::emitCode):
+ (KJS::DeleteResolveNode::emitCode):
+ (KJS::DeleteBracketNode::emitCode):
+ (KJS::DeleteDotNode::emitCode):
+ (KJS::TypeOfResolveNode::emitCode):
+ (KJS::PreIncResolveNode::emitCode):
+ (KJS::PreDecResolveNode::emitCode):
+ (KJS::PreIncBracketNode::emitCode):
+ (KJS::PreDecBracketNode::emitCode):
+ (KJS::PreIncDotNode::emitCode):
+ (KJS::PreDecDotNode::emitCode):
+ (KJS::ReadModifyResolveNode::emitCode):
+ (KJS::AssignResolveNode::emitCode):
+ (KJS::AssignDotNode::emitCode):
+ (KJS::ReadModifyDotNode::emitCode):
+ (KJS::AssignBracketNode::emitCode):
+ (KJS::ReadModifyBracketNode::emitCode):
+ (KJS::ConstDeclNode::emitCodeSingle):
+ (KJS::ForInNode::emitCode):
+ (KJS::TryNode::emitCode):
+
+2008-05-04 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej.
+
+ Fix assertion when accessing arguments object with too many arguments provided
+
+ The arguments constructor was assuming that the register offset given for argv
+ was an absolute offset into the registerfile, rather than the offset from the
+ frame. This patches corrects that issue.
+
+ * kjs/JSActivation.cpp:
+ (KJS::JSActivation::createArgumentsObject):
+
+2008-05-04 Geoffrey Garen <ggaren@apple.com>
+
+ Rubber stamped by Sam Weinig.
+
+ Cleaned up Machine.cpp according to our style guidelines: moved static
+ data to the top of the file; moved stand-alone functions below that;
+ moved the Machine constructor above other Machine member functions.
+
+2008-05-03 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Sam.
+
+ - fix accidental breakage from last patch
+
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+
+2008-05-03 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Geoff.
+
+ - a bunch more opcode documentation and corresponding parameter name fixes
+
+ I renamed a few opcodes:
+
+ type_of --> typeof (that's what the JS operator is named)
+ instance_of --> instanceof (ditto)
+ create_error --> new_error (for consistency with other new_* opcodes)
+
+ I documented the following opcodes:
+
+ - load
+ - new_object
+ - new_array
+ - new_regexp
+ - mov
+ - pre_inc
+ - pre_dec
+ - post_inc
+ - post_dec
+ - to_jsnumber
+ - negate
+ - bitnot
+ - not
+ - instanceof
+ - typeof
+ - in
+ - new_func
+ - new_funcexp
+ - new_error
+
+ I also fixed formatting on some existing opcode docs.
+
+ * VM/CodeBlock.cpp:
+ (KJS::CodeBlock::dump):
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::emitMove):
+ (KJS::CodeGenerator::emitNot):
+ (KJS::CodeGenerator::emitPreInc):
+ (KJS::CodeGenerator::emitPreDec):
+ (KJS::CodeGenerator::emitPostInc):
+ (KJS::CodeGenerator::emitPostDec):
+ (KJS::CodeGenerator::emitToJSNumber):
+ (KJS::CodeGenerator::emitNegate):
+ (KJS::CodeGenerator::emitBitNot):
+ (KJS::CodeGenerator::emitInstanceOf):
+ (KJS::CodeGenerator::emitTypeOf):
+ (KJS::CodeGenerator::emitIn):
+ (KJS::CodeGenerator::emitLoad):
+ (KJS::CodeGenerator::emitNewObject):
+ (KJS::CodeGenerator::emitNewArray):
+ (KJS::CodeGenerator::emitNewRegExp):
+ (KJS::CodeGenerator::emitNewError):
+ * VM/CodeGenerator.h:
+ (KJS::CodeGenerator::scopeDepth):
+ (KJS::CodeGenerator::addVar):
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+ * VM/Opcode.h:
+ * kjs/nodes.cpp:
+ (KJS::Node::emitThrowError):
+ (KJS::RegExpNode::emitCode):
+ (KJS::TypeOfValueNode::emitCode):
+ (KJS::UnaryPlusNode::emitCode):
+ (KJS::NegateNode::emitCode):
+ (KJS::BitwiseNotNode::emitCode):
+ (KJS::LogicalNotNode::emitCode):
+ (KJS::InstanceOfNode::emitCode):
+ (KJS::InNode::emitCode):
+
+2008-05-03 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Geoff and Sam.
+
+ - generate HTML bytecode docs at build time
+
+ * DerivedSources.make:
+ * docs: Added.
+ * docs/make-bytecode-docs.pl: Added.
+
+2008-05-03 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Update ExecState::m_scopeChain when switching scope chains inside the
+ machine.
+
+ This fixes uses of lexicalGlobalObject, such as, in a subframe
+
+ alert(top.makeArray() instanceof Array ? "FAIL" : "PASS");
+
+ and a bunch of the security failures listed in
+ https://bugs.webkit.org/show_bug.cgi?id=18870. (Those tests still fail,
+ seemingly because of regressions in exception messages).
+
+ SunSpider reports no change.
+
+ * VM/Machine.cpp: Factored out scope chain updating into a common
+ function that takes care to update ExecState::m_scopeChain, too.
+
+ * kjs/ExecState.h: I made Machine a friend of ExecState so that Machine
+ could update ExecState::m_scopeChain, even though that value is
+ read-only for everyone else.
+
+ * kjs/JSGlobalObject.h:
+ (KJS::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData): Changed
+ this client to be a little friendlier to ExecState's internal
+ storage type for scope chain data.
+
+2008-05-03 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Fixed https://bugs.webkit.org/show_bug.cgi?id=18876
+ Squirrelfish: ScopeChainNode leak in op_jmp_scopes.
+
+ SunSpider reports no change.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute): Don't construct a ScopeChain object,
+ since the direct threaded interpreter will goto across its destructor.
+
+2008-05-03 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ A bit more efficient fix than r32832: Don't copy globals into function
+ register files; instead, have the RegisterFileStack track only the base
+ of the last *global* register file, so the global object's register
+ references stay good.
+
+ SunSpider reports a .3% speedup. Not sure what that's about.
+
+2008-05-03 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej.
+
+ Bug 18864: SquirrelFish: Support getter and setter definition in object literals
+ <https://bugs.webkit.org/show_bug.cgi?id=18864>
+
+ Add new opcodes to allow us to add getters and setters to an object. These are
+ only used by the codegen for object literals.
+
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::emitPutGetter):
+ (KJS::CodeGenerator::emitPutSetter):
+ * VM/CodeGenerator.h:
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+ * VM/Opcode.h:
+ * kjs/nodes.cpp:
+ (KJS::PropertyListNode::emitCode):
+
+2008-05-02 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver.
+
+ - properly copy globals into and out of implicit call register
+ files, otherwise they will fail at global lookup
+
+ Fixes fast/js/array-tostring-and-join.html layout test.
+
+ * VM/RegisterFileStack.cpp:
+ (KJS::RegisterFileStack::pushGlobalRegisterFile):
+ (KJS::RegisterFileStack::popGlobalRegisterFile):
+ (KJS::RegisterFileStack::pushFunctionRegisterFile):
+ (KJS::RegisterFileStack::popFunctionRegisterFile):
+
+2008-05-02 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Fixed https://bugs.webkit.org/show_bug.cgi?id=18822
+ SQUIRRELFISH: incorrect eval used in some cases
+
+ Changed all code inside the machine to fetch the lexical global object
+ directly from the scope chain, instead of from the ExecState.
+
+ Clients who fetch the lexical global object through the ExecState
+ still don't work.
+
+ SunSpider reports no change.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute): Fetch the lexical global object from
+ the scope chain.
+
+ * kjs/ExecState.h:
+ (KJS::ExecState::ExecState::lexicalGlobalObject): Moved the logic for
+ this function into ScopeChainNode, but kept this function around to
+ support existing clients.
+
+2008-05-02 Geoffrey Garen <ggaren@apple.com>
+
+ Rubber stamped by Oliver Hunt.
+
+ Removed ExecState.cpp from AllInOneFile.cpp, for a .2% speedup.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * kjs/AllInOneFile.cpp:
+
+2008-05-01 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff and Maciej.
+
+ Bug 18827: SquirrelFish: Prevent getters and setters from destroying the current RegisterFile
+ <https://bugs.webkit.org/show_bug.cgi?id=18827>
+
+ Remove safe/unsafe RegisterFile concept, and instead just add additional
+ logic to ensure we always push/pop RegisterFiles when executing getters
+ and setters, similar to the logic for valueOf and toString.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+ * VM/RegisterFile.h:
+ * kjs/function.cpp:
+ (KJS::FunctionImp::callAsFunction):
+ * kjs/object.cpp:
+ (KJS::JSObject::put):
+ * kjs/property_slot.cpp:
+ (KJS::PropertySlot::functionGetter):
+
+2008-05-01 Oliver Hunt <oliver@apple.com>
+
+ RS=Geoff
+
+ Rename unsafeForReentry to safeForReentry to avoid double negatives.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+ * VM/RegisterFile.h:
+ * kjs/function.cpp:
+ (KJS::FunctionImp::callAsFunction):
+
+2008-05-01 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej.
+
+ Bug 18827: SquirrelFish: Prevent getters and setters from destroying the current RegisterFile
+ <https://bugs.webkit.org/show_bug.cgi?id=18827>
+
+ This patch makes getters and setters work. It does this by
+ tracking whether the RegisterFile is "safe", that is whether
+ the interpreter is in a state that in which it can handle
+ the RegisterFile being reallocated.
+
+ * VM/Machine.cpp:
+ (KJS::resolve):
+ (KJS::Machine::privateExecute):
+ * VM/RegisterFile.h:
+ * kjs/function.cpp:
+ (KJS::FunctionImp::callAsFunction):
+
+2008-04-30 Geoffrey Garen <ggaren@apple.com>
+
+ Release build fix: Always compile in "isGlobalObject", since it's
+ listed in our .exp file.
+
+ * kjs/ExecState.cpp:
+ (KJS::ExecState::isGlobalObject):
+ * kjs/ExecState.h:
+
+2008-04-30 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej.
+
+ Minor code restructuring to prepare for getters and setters,
+ also helps exception semantics a bit.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+
+2008-04-30 Geoffrey Garen <ggaren@apple.com>
+
+ Fixed tyop.
+
+ * kjs/ExecState.h:
+
+2008-04-30 Geoffrey Garen <ggaren@apple.com>
+
+ Debug build fix: export a missing symbol.
+
+ * JavaScriptCore.exp:
+
+2008-04-30 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ A little more ExecState refactoring: Now, only the global object creates
+ an ExecState.
+
+ Also inlined ExecState::lexicalGlobalObject().
+
+ SunSpider reports no change.
+
+2008-04-30 Geoffrey Garen <ggaren@apple.com>
+
+ WebCore build fix: forward-declare ScopeChain.
+
+ * kjs/interpreter.h:
+
+2008-04-30 Geoffrey Garen <ggaren@apple.com>
+
+ Build fix for JavaScriptGlue: export a missing symbol.
+
+ * JavaScriptCore.exp:
+
+2008-04-30 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Removed a lot of unused bits from ExecState, moving them into
+ OldInterpreterExecState, the fake scaffolding class.
+
+ The clutter was making it hard to see the forest from the trees.
+
+ .4% SunSpider speedup, probably because ExecState::lexicalGlobalObject()
+ is faster now.
+
+2008-04-29 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej.
+
+ Bug 18643: SQUIRRELFISH: need to support implicit function calls (valueOf, toString, getters/setters)
+ <https://bugs.webkit.org/show_bug.cgi?id=18643>
+
+ Prevent static slot optimisation for new variables and functions in
+ globally re-entrant code called from an an implicit function call.
+
+ This is necessary to prevent us from needing to resize the global
+ slot portion of the root RegisterFile during an implicit (and hence
+ unguarded) function call.
+
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::CodeGenerator):
+ * VM/CodeGenerator.h:
+ * VM/Machine.cpp:
+ (KJS::Machine::execute):
+ * VM/RegisterFile.h:
+ * VM/RegisterFileStack.cpp:
+ (KJS::RegisterFileStack::pushGlobalRegisterFile):
+ (KJS::RegisterFileStack::popGlobalRegisterFile):
+ (KJS::RegisterFileStack::pushFunctionRegisterFile):
+ (KJS::RegisterFileStack::popFunctionRegisterFile):
+ * VM/RegisterFileStack.h:
+ (KJS::RegisterFileStack::inImplicitFunctionCall):
+ (KJS::RegisterFileStack::lastGlobal):
+ * kjs/nodes.cpp:
+ (KJS::ProgramNode::generateCode):
+ * kjs/nodes.h:
+ (KJS::ProgramNode::):
+
+2008-04-29 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ In nested program code, don't propogate "this" back to the parent
+ register file. ("this" should remain constant in the parent register
+ file, regardless of the scripts it invokes.)
+
+ * VM/RegisterFile.cpp:
+ (KJS::RegisterFile::copyGlobals):
+
+2008-04-28 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff.
+
+ Restore base pointer when popping a global RegisterFile
+
+ * VM/RegisterFileStack.cpp:
+ (KJS::RegisterFileStack::popGlobalRegisterFile):
+
+2008-04-28 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff.
+
+ Bug 18643: SQUIRRELFISH: need to support implicit function calls (valueOf, toString, getters/setters)
+ <https://bugs.webkit.org/show_bug.cgi?id=18643>
+
+ Partial fix. This results in all implicit calls to toString or valueOf
+ executing in a separate RegisterFile, so ensuring that the the pointers
+ in the triggering interpreter don't get trashed. This still leaves the
+ task of preventing new global re-entry from toString and valueOf from
+ clobbering the RegisterFile.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::execute):
+ * VM/RegisterFileStack.cpp:
+ (KJS::RegisterFileStack::pushFunctionRegisterFile):
+ (KJS::RegisterFileStack::popFunctionRegisterFile):
+ * VM/RegisterFileStack.h:
+ * kjs/object.cpp:
+ (KJS::tryGetAndCallProperty):
+
+2008-04-28 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Simplified activation object a bit: No need to store the callee
+ in the activation object -- we can pull it out of the call frame
+ when needed, instead.
+
+ SunSpider reports no change.
+
+2008-04-28 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ RS by Oliver Hunt on moving JSArguments.cpp out of AllInOneFile.cpp.
+
+ Substantially more handling of "arguments": "arguments" works fully
+ now, but "f.arguments" still doesn't work.
+
+ Fixes 10 regression tests.
+
+ SunSpider reports no regression.
+
+ * kjs/JSActivation.cpp:
+ (KJS::JSActivation::createArgumentsObject): Reconstruct an arguments
+ List to pass to the arguments object constructor.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * kjs/AllInOneFile.cpp: Removed JSActivation.cpp from AllInOneFile.cpp
+ because that seems to make GCC happy. (Previously, I had added
+ JSActivation.cpp to AllInOneFile.cpp because *that* seemed to make GCC
+ happy. So it goes.)
+
+2008-04-28 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Groundwork for more handling of "arguments". I'm not checking in the
+ actual handling of "arguments" yet, because it still needs a little
+ fiddling to avoid a performance regression.
+
+ SunSpider reports no change.
+
+ * VM/Machine.cpp:
+ (KJS::initializeCallFrame): Put argc in the register file, so the
+ arguments object can find it later, to determine arguments.length.
+
+ * kjs/nodes.h:
+ (KJS::FunctionBodyNode::): Added a special code accessor for when you
+ know the code has already been generated, and you don't have a scopeChain
+ to supply for potential code generation. (This is the case when the
+ activation object creates the arguments object.)
+
+2008-04-28 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff.
+
+ Replace unsafe use of auto_ptr in Vector with manual memory
+ management.
+
+ * VM/RegisterFileStack.cpp:
+ (KJS::RegisterFileStack::~RegisterFileStack):
+ (KJS::RegisterFileStack::popRegisterFile):
+ * VM/RegisterFileStack.h:
+
+2008-04-27 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Maciej.
+
+ Bug 18746: SQUIRRELFISH: indirect eval used when direct eval should be used
+ <https://bugs.webkit.org/show_bug.cgi?id=18746>
+
+ Change the base to the correct value of the 'this' object after the direct
+ eval test instead of before.
+
+ Fixes 5 layout tests.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+ * kjs/nodes.cpp:
+ (KJS::EvalFunctionCallNode::emitCode):
+
+2008-04-26 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver.
+
+ - document all property getting, setting and deleting opcodes
+
+ (And fix function parameter names to match corresponding opcode parameter names.)
+
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::emitResolve):
+ (KJS::CodeGenerator::emitResolveBase):
+ (KJS::CodeGenerator::emitResolveBaseAndProperty):
+ (KJS::CodeGenerator::emitResolveBaseAndFunc):
+ (KJS::CodeGenerator::emitGetPropId):
+ (KJS::CodeGenerator::emitPutPropId):
+ (KJS::CodeGenerator::emitDeletePropId):
+ (KJS::CodeGenerator::emitPutPropVal):
+ * VM/CodeGenerator.h:
+ * VM/Machine.cpp:
+ (KJS::resolve):
+ (KJS::resolveBase):
+ (KJS::resolveBaseAndProperty):
+ (KJS::resolveBaseAndFunc):
+ (KJS::Machine::privateExecute):
+ * kjs/nodes.cpp:
+ (KJS::ResolveNode::emitCode):
+ (KJS::ArrayNode::emitCode):
+ (KJS::PropertyListNode::emitCode):
+ (KJS::BracketAccessorNode::emitCode):
+ (KJS::EvalFunctionCallNode::emitCode):
+ (KJS::FunctionCallResolveNode::emitCode):
+ (KJS::FunctionCallBracketNode::emitCode):
+ (KJS::PostIncResolveNode::emitCode):
+ (KJS::PostDecResolveNode::emitCode):
+ (KJS::PostIncBracketNode::emitCode):
+ (KJS::PostDecBracketNode::emitCode):
+ (KJS::PostIncDotNode::emitCode):
+ (KJS::PostDecDotNode::emitCode):
+ (KJS::DeleteResolveNode::emitCode):
+ (KJS::TypeOfResolveNode::emitCode):
+ (KJS::PreIncResolveNode::emitCode):
+ (KJS::PreDecResolveNode::emitCode):
+ (KJS::PreIncBracketNode::emitCode):
+ (KJS::PreDecBracketNode::emitCode):
+ (KJS::AssignResolveNode::emitCode):
+ (KJS::AssignDotNode::emitCode):
+ (KJS::ReadModifyDotNode::emitCode):
+ (KJS::AssignBracketNode::emitCode):
+ (KJS::ReadModifyBracketNode::emitCode):
+ (KJS::ConstDeclNode::emitCodeSingle):
+
+2008-04-26 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej.
+
+ Bug 18628: SQUIRRELFISH: need to support recursion limit
+ <https://bugs.webkit.org/show_bug.cgi?id=18628>
+
+ Basically completes recursion limiting. There is still some
+ tuning we may want to do to make things better in the face of
+ very bad code, but certainly nothing worse than anything already
+ possible in trunk.
+
+ Also fixes a WebKit test by fixing the exception text :D
+
+ * JavaScriptCore.exp:
+ * VM/ExceptionHelpers.cpp:
+ * VM/Machine.cpp:
+ (KJS::Machine::execute):
+ * VM/RegisterFile.cpp:
+ (KJS::RegisterFile::growBuffer):
+ (KJS::RegisterFile::addGlobalSlots):
+ * VM/RegisterFile.h:
+ (KJS::RegisterFile::grow):
+ (KJS::RegisterFile::uncheckedGrow):
+ * VM/RegisterFileStack.cpp:
+ (KJS::RegisterFileStack::pushRegisterFile):
+ * VM/RegisterFileStack.h:
+
+2008-04-25 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff.
+
+ Bug 18628: SQUIRRELFISH: need to support recursion limit
+ <https://bugs.webkit.org/show_bug.cgi?id=18628>
+
+ Put a limit on the level of reentry recursion. 128 levels of re-entrant recursion
+ seems reasonable as it is greater than the old eval limit, and a long way short of
+ the reentry depth needed to overflow the stack.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::execute):
+ * VM/Machine.h:
+
+2008-04-25 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ A tiny bit of cleanup to the regexp code.
+
+ Removed some static_cast.
+
+ Removed createRegExpImp because it's no longer used.
+
+2008-04-25 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej.
+
+ Bug 18736: SQUIRRELFISH: switch statements with no default have incorrect codegen
+ <https://bugs.webkit.org/show_bug.cgi?id=18736>
+
+ Ensure the "default" target is correct in the absence of an explicit default handler.
+
+ * kjs/nodes.cpp:
+ (KJS::CaseBlockNode::emitCodeForBlock):
+
+2008-04-25 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej.
+
+ Bug 18628: SQUIRRELFISH: need to support recursion limit
+ <https://bugs.webkit.org/show_bug.cgi?id=18628>
+
+ More bounds checking.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::execute):
+ * VM/RegisterFile.cpp:
+ (KJS::RegisterFile::growBuffer):
+ * VM/RegisterFile.h:
+
+2008-04-25 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver.
+
+ - fix signal catching magic
+
+ The signal handlers are restored to _exit but are only set when
+ running under run-javascriptcore-tests. fprintf from a signal
+ handler is not safe.
+
+ * kjs/testkjs.cpp:
+ (main):
+ (parseArguments):
+ * tests/mozilla/jsDriver.pl:
+
+2008-04-25 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Maciej.
+
+ Bug 18732: SQUIRRELFISH: exceptions thrown by native constructors are ignored
+ <https://bugs.webkit.org/show_bug.cgi?id=18732>
+
+ Fixes another regression test.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+
+2008-04-25 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Maciej.
+
+ Bug 18728: SQUIRRELFISH: invalid regular expression constants should throw exceptions
+ <https://bugs.webkit.org/show_bug.cgi?id=18728>
+
+ Fixes another regression test.
+
+ * kjs/nodes.cpp:
+ (KJS::RegExpNode::emitCode):
+
+2008-04-24 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Geoffrey Garen.
+
+ Bug 18735: SQUIRRELFISH: closures are sometimes given an incorrect 'this' value when called
+ <https://bugs.webkit.org/show_bug.cgi?id=18735>
+
+ The overloaded toThisObject method was not copied over to JSActivation.
+
+ Fixes two regression tests.
+
+ * kjs/JSActivation.cpp:
+ (KJS::JSActivation::toThisObject):
+ * kjs/JSActivation.h:
+
+2008-04-24 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Added support for arguments.callee.
+
+2008-04-24 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej.
+
+ Bug 18628: SQUIRRELFISH: need to support recursion limit
+ <https://bugs.webkit.org/show_bug.cgi?id=18628>
+
+ Partial fix -- this gets us some of the required bounds checking, but not
+ complete coverage. But it does manage to do them without regressing :D
+
+ * VM/ExceptionHelpers.cpp:
+ (KJS::createError):
+ (KJS::createStackOverflowError):
+ * VM/ExceptionHelpers.h:
+ * VM/Machine.cpp:
+ (KJS::slideRegisterWindowForCall):
+ (KJS::Machine::execute):
+ (KJS::Machine::privateExecute):
+ * VM/RegisterFile.cpp:
+ * VM/RegisterFile.h:
+ (KJS::RegisterFile::):
+ (KJS::RegisterFile::RegisterFile):
+ (KJS::RegisterFile::grow):
+
+2008-04-24 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ A tiny bit more handling of "arguments": create a real, but mostly
+ hollow, arguments object.
+
+ Fixes 2 regression tests.
+
+2008-04-24 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Oliver.
+
+ Bug 18717: SQUIRRELFISH: eval returns the wrong value for a variable declaration statement
+ <https://bugs.webkit.org/show_bug.cgi?id=18717>
+
+ Fixes a regression test, but exposes the failure of another due to the
+ lack of getters and setters.
+
+ * kjs/nodes.cpp:
+ (KJS::ConstDeclNode::emitCodeSingle):
+ (KJS::ConstDeclNode::emitCode):
+ (KJS::ConstStatementNode::emitCode):
+ (KJS::VarStatementNode::emitCode):
+ * kjs/nodes.h:
+
+2008-04-24 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Print a CRASH statement when crashing, so test failures are not a
+ mystery.
+
+ * kjs/testkjs.cpp:
+ (handleCrash):
+ (main):
+
+2008-04-24 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Geoffrey Garen.
+
+ Bug 18716: SQUIRRELFISH: typeof should return undefined for an undefined variable reference
+ <https://bugs.webkit.org/show_bug.cgi?id=18716>
+
+ This fixes 2 more regression tests.
+
+ * kjs/nodes.cpp:
+ (KJS::TypeOfResolveNode::emitCode):
+
+2008-04-24 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Put the callee in the call frame.
+
+ Necessary in order to support "arguments" and "arguments.callee".
+
+ Also fixes a latent GC bug, where an executing function could be
+ subject to GC if the register holding it were overwritten. Here's
+ an example that would have caused problems:
+
+ function f()
+ {
+ // Flood the machine stack to eliminate any old pointers to f.
+ g.call({});
+
+ // Overwrite f in the register file.
+ f = 1;
+
+ // Force a GC.
+ for (var i = 0; i < 5000; ++i) {
+ ({});
+ }
+
+ // Welcome to crash-ville.
+ }
+
+ function g()
+ {
+ }
+
+ f();
+
+ * VM/Machine.h: Changed the order of arguments to
+ execute(FunctionBodyNode*...) to match the other execute functions.
+ * kjs/function.cpp: Updated to match new argument requirements from
+ execute(FunctionBodyNode*...). Renamed newObj to thisObj to match the
+ rest of JavaScriptCore.
+
+ SunSpider reports no change.
+
+2008-04-23 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Maciej.
+
+ Bug 18707: SQUIRRELFISH: eval always performs toString() on its argument
+ <https://bugs.webkit.org/show_bug.cgi?id=18707>
+
+ This fixes 4 more regression tests.
+
+ * VM/Machine.cpp:
+ (KJS::eval):
+
+2008-04-23 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver.
+
+ - fix logic bug in SegmentedVector::grow which would sometimes fail to resize a segment when needed
+
+ Fixes 3 JSC tests.
+
+ * VM/SegmentedVector.h:
+ (KJS::SegmentedVector::grow):
+
+2008-04-23 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Degenerate handling of "arguments" as a property of the activation
+ object. Currently, we just return a vanilla object.
+
+ SunSpider reports no change.
+
+ Fixes:
+
+ ecma_3/Function/regress-94506.js.
+
+ Reveals to have been secretly broken:
+
+ ecma_3/Function/15.3.4.3-1.js
+ ecma_3/Function/15.3.4.4-1.js
+
+ These tests were passing incorrectly. testkjs creates a global array
+ named "arguments" to hold command-line arguments. That array was
+ tricking these tests into thinking that an arguments object with length
+ 0 had been created. Since our new vanilla object shadows the global
+ property named arguments, that object no longer fools these tests into
+ passing.
+
+ Net change: +1 failing test.
+
+ * kjs/AllInOneFile.cpp: Had to put JSActivation.cpp into AllInOneFile.cpp
+ to solve a surprising 8.6% regression in bitops-3bit-bits-in-byte.
+
+2008-04-23 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver.
+
+ - save and restore callFrame
+
+ * VM/Machine.cpp:
+ (KJS::slideRegisterWindowForCall):
+ (KJS::Machine::execute):
+ (KJS::Machine::privateExecute):
+ * kjs/testkjs.cpp:
+ (main):
+
+2008-04-23 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Fixed scopes for named function expressions.
+
+ Fixes one regression test.
+
+ Two changes here:
+
+ (1) The function's name is supposed to have attributes DontDelete,
+ ReadOnly, regardless of the type of code executing.
+
+ (2) Push the name object on the function's scope chain, rather than
+ the ExecState's scope chain because, well, that's where it belongs.
+
+2008-04-23 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Inlined JSObject::putDirect, for a .4% SunSpider speedup.
+
+ I did this as a first step toward removing nodes.cpp from
+ AllInOneFile.cpp, but I'm putting that larger project aside for now.
+
+2008-04-23 Maciej Stachowiak <mjs@apple.com>
+
+ Rubber stamped by Geoff.
+
+ - add OldInterpreterExecState class and use it in dead code
+
+ This will allow removing things from the real ExecState class
+ without having to figure out how to remove all this code without
+ getting a perf regression.
+
+ * kjs/nodes.cpp:
+ (KJS::ExpressionNode::evaluateToNumber):
+ (KJS::ExpressionNode::evaluateToBoolean):
+ (KJS::ExpressionNode::evaluateToInt32):
+ (KJS::ExpressionNode::evaluateToUInt32):
+ (KJS::Node::setErrorCompletion):
+ (KJS::Node::throwError):
+ (KJS::Node::throwUndefinedVariableError):
+ (KJS::Node::handleException):
+ (KJS::Node::rethrowException):
+ (KJS::BreakpointCheckStatement::execute):
+ (KJS::BreakpointCheckStatement::optimizeVariableAccess):
+ (KJS::NullNode::evaluate):
+ (KJS::FalseNode::evaluate):
+ (KJS::TrueNode::evaluate):
+ (KJS::NumberNode::evaluate):
+ (KJS::NumberNode::evaluateToNumber):
+ (KJS::NumberNode::evaluateToBoolean):
+ (KJS::NumberNode::evaluateToInt32):
+ (KJS::NumberNode::evaluateToUInt32):
+ (KJS::ImmediateNumberNode::evaluate):
+ (KJS::ImmediateNumberNode::evaluateToInt32):
+ (KJS::ImmediateNumberNode::evaluateToUInt32):
+ (KJS::StringNode::evaluate):
+ (KJS::StringNode::evaluateToNumber):
+ (KJS::StringNode::evaluateToBoolean):
+ (KJS::RegExpNode::evaluate):
+ (KJS::ThisNode::evaluate):
+ (KJS::ResolveNode::inlineEvaluate):
+ (KJS::ResolveNode::evaluate):
+ (KJS::ResolveNode::evaluateToNumber):
+ (KJS::ResolveNode::evaluateToBoolean):
+ (KJS::ResolveNode::evaluateToInt32):
+ (KJS::ResolveNode::evaluateToUInt32):
+ (KJS::getSymbolTableEntry):
+ (KJS::ResolveNode::optimizeVariableAccess):
+ (KJS::LocalVarAccessNode::inlineEvaluate):
+ (KJS::LocalVarAccessNode::evaluate):
+ (KJS::LocalVarAccessNode::evaluateToNumber):
+ (KJS::LocalVarAccessNode::evaluateToBoolean):
+ (KJS::LocalVarAccessNode::evaluateToInt32):
+ (KJS::LocalVarAccessNode::evaluateToUInt32):
+ (KJS::getNonLocalSymbol):
+ (KJS::ScopedVarAccessNode::inlineEvaluate):
+ (KJS::ScopedVarAccessNode::evaluate):
+ (KJS::ScopedVarAccessNode::evaluateToNumber):
+ (KJS::ScopedVarAccessNode::evaluateToBoolean):
+ (KJS::ScopedVarAccessNode::evaluateToInt32):
+ (KJS::ScopedVarAccessNode::evaluateToUInt32):
+ (KJS::NonLocalVarAccessNode::inlineEvaluate):
+ (KJS::NonLocalVarAccessNode::evaluate):
+ (KJS::NonLocalVarAccessNode::evaluateToNumber):
+ (KJS::NonLocalVarAccessNode::evaluateToBoolean):
+ (KJS::NonLocalVarAccessNode::evaluateToInt32):
+ (KJS::NonLocalVarAccessNode::evaluateToUInt32):
+ (KJS::ElementNode::optimizeVariableAccess):
+ (KJS::ElementNode::evaluate):
+ (KJS::ArrayNode::optimizeVariableAccess):
+ (KJS::ArrayNode::evaluate):
+ (KJS::ObjectLiteralNode::optimizeVariableAccess):
+ (KJS::ObjectLiteralNode::evaluate):
+ (KJS::PropertyListNode::optimizeVariableAccess):
+ (KJS::PropertyListNode::evaluate):
+ (KJS::PropertyNode::optimizeVariableAccess):
+ (KJS::PropertyNode::evaluate):
+ (KJS::BracketAccessorNode::optimizeVariableAccess):
+ (KJS::BracketAccessorNode::inlineEvaluate):
+ (KJS::BracketAccessorNode::evaluate):
+ (KJS::BracketAccessorNode::evaluateToNumber):
+ (KJS::BracketAccessorNode::evaluateToBoolean):
+ (KJS::BracketAccessorNode::evaluateToInt32):
+ (KJS::BracketAccessorNode::evaluateToUInt32):
+ (KJS::DotAccessorNode::optimizeVariableAccess):
+ (KJS::DotAccessorNode::inlineEvaluate):
+ (KJS::DotAccessorNode::evaluate):
+ (KJS::DotAccessorNode::evaluateToNumber):
+ (KJS::DotAccessorNode::evaluateToBoolean):
+ (KJS::DotAccessorNode::evaluateToInt32):
+ (KJS::DotAccessorNode::evaluateToUInt32):
+ (KJS::ArgumentListNode::optimizeVariableAccess):
+ (KJS::ArgumentListNode::evaluateList):
+ (KJS::ArgumentsNode::optimizeVariableAccess):
+ (KJS::NewExprNode::optimizeVariableAccess):
+ (KJS::NewExprNode::inlineEvaluate):
+ (KJS::NewExprNode::evaluate):
+ (KJS::NewExprNode::evaluateToNumber):
+ (KJS::NewExprNode::evaluateToBoolean):
+ (KJS::NewExprNode::evaluateToInt32):
+ (KJS::NewExprNode::evaluateToUInt32):
+ (KJS::ExpressionNode::resolveAndCall):
+ (KJS::EvalFunctionCallNode::optimizeVariableAccess):
+ (KJS::EvalFunctionCallNode::evaluate):
+ (KJS::FunctionCallValueNode::optimizeVariableAccess):
+ (KJS::FunctionCallValueNode::evaluate):
+ (KJS::FunctionCallResolveNode::optimizeVariableAccess):
+ (KJS::FunctionCallResolveNode::inlineEvaluate):
+ (KJS::FunctionCallResolveNode::evaluate):
+ (KJS::FunctionCallResolveNode::evaluateToNumber):
+ (KJS::FunctionCallResolveNode::evaluateToBoolean):
+ (KJS::FunctionCallResolveNode::evaluateToInt32):
+ (KJS::FunctionCallResolveNode::evaluateToUInt32):
+ (KJS::LocalVarFunctionCallNode::inlineEvaluate):
+ (KJS::LocalVarFunctionCallNode::evaluate):
+ (KJS::LocalVarFunctionCallNode::evaluateToNumber):
+ (KJS::LocalVarFunctionCallNode::evaluateToBoolean):
+ (KJS::LocalVarFunctionCallNode::evaluateToInt32):
+ (KJS::LocalVarFunctionCallNode::evaluateToUInt32):
+ (KJS::ScopedVarFunctionCallNode::inlineEvaluate):
+ (KJS::ScopedVarFunctionCallNode::evaluate):
+ (KJS::ScopedVarFunctionCallNode::evaluateToNumber):
+ (KJS::ScopedVarFunctionCallNode::evaluateToBoolean):
+ (KJS::ScopedVarFunctionCallNode::evaluateToInt32):
+ (KJS::ScopedVarFunctionCallNode::evaluateToUInt32):
+ (KJS::NonLocalVarFunctionCallNode::inlineEvaluate):
+ (KJS::NonLocalVarFunctionCallNode::evaluate):
+ (KJS::NonLocalVarFunctionCallNode::evaluateToNumber):
+ (KJS::NonLocalVarFunctionCallNode::evaluateToBoolean):
+ (KJS::NonLocalVarFunctionCallNode::evaluateToInt32):
+ (KJS::NonLocalVarFunctionCallNode::evaluateToUInt32):
+ (KJS::FunctionCallBracketNode::optimizeVariableAccess):
+ (KJS::FunctionCallBracketNode::evaluate):
+ (KJS::FunctionCallDotNode::optimizeVariableAccess):
+ (KJS::FunctionCallDotNode::inlineEvaluate):
+ (KJS::FunctionCallDotNode::evaluate):
+ (KJS::FunctionCallDotNode::evaluateToNumber):
+ (KJS::FunctionCallDotNode::evaluateToBoolean):
+ (KJS::FunctionCallDotNode::evaluateToInt32):
+ (KJS::FunctionCallDotNode::evaluateToUInt32):
+ (KJS::PostIncResolveNode::optimizeVariableAccess):
+ (KJS::PostIncResolveNode::evaluate):
+ (KJS::PostIncLocalVarNode::evaluate):
+ (KJS::PostDecResolveNode::optimizeVariableAccess):
+ (KJS::PostDecResolveNode::evaluate):
+ (KJS::PostDecLocalVarNode::evaluate):
+ (KJS::PostDecLocalVarNode::inlineEvaluateToNumber):
+ (KJS::PostDecLocalVarNode::evaluateToNumber):
+ (KJS::PostDecLocalVarNode::evaluateToBoolean):
+ (KJS::PostDecLocalVarNode::evaluateToInt32):
+ (KJS::PostDecLocalVarNode::evaluateToUInt32):
+ (KJS::PostfixBracketNode::optimizeVariableAccess):
+ (KJS::PostIncBracketNode::evaluate):
+ (KJS::PostDecBracketNode::evaluate):
+ (KJS::PostfixDotNode::optimizeVariableAccess):
+ (KJS::PostIncDotNode::evaluate):
+ (KJS::PostDecDotNode::evaluate):
+ (KJS::PostfixErrorNode::evaluate):
+ (KJS::DeleteResolveNode::optimizeVariableAccess):
+ (KJS::DeleteResolveNode::evaluate):
+ (KJS::LocalVarDeleteNode::evaluate):
+ (KJS::DeleteBracketNode::optimizeVariableAccess):
+ (KJS::DeleteBracketNode::evaluate):
+ (KJS::DeleteDotNode::optimizeVariableAccess):
+ (KJS::DeleteDotNode::evaluate):
+ (KJS::DeleteValueNode::optimizeVariableAccess):
+ (KJS::DeleteValueNode::evaluate):
+ (KJS::VoidNode::optimizeVariableAccess):
+ (KJS::VoidNode::evaluate):
+ (KJS::TypeOfValueNode::optimizeVariableAccess):
+ (KJS::TypeOfResolveNode::optimizeVariableAccess):
+ (KJS::LocalVarTypeOfNode::evaluate):
+ (KJS::TypeOfResolveNode::evaluate):
+ (KJS::TypeOfValueNode::evaluate):
+ (KJS::PreIncResolveNode::optimizeVariableAccess):
+ (KJS::PreIncLocalVarNode::evaluate):
+ (KJS::PreIncResolveNode::evaluate):
+ (KJS::PreDecResolveNode::optimizeVariableAccess):
+ (KJS::PreDecLocalVarNode::evaluate):
+ (KJS::PreDecResolveNode::evaluate):
+ (KJS::PreIncConstNode::evaluate):
+ (KJS::PreDecConstNode::evaluate):
+ (KJS::PostIncConstNode::evaluate):
+ (KJS::PostDecConstNode::evaluate):
+ (KJS::PrefixBracketNode::optimizeVariableAccess):
+ (KJS::PreIncBracketNode::evaluate):
+ (KJS::PreDecBracketNode::evaluate):
+ (KJS::PrefixDotNode::optimizeVariableAccess):
+ (KJS::PreIncDotNode::evaluate):
+ (KJS::PreDecDotNode::evaluate):
+ (KJS::PrefixErrorNode::evaluate):
+ (KJS::UnaryPlusNode::optimizeVariableAccess):
+ (KJS::UnaryPlusNode::evaluate):
+ (KJS::UnaryPlusNode::evaluateToBoolean):
+ (KJS::UnaryPlusNode::evaluateToNumber):
+ (KJS::UnaryPlusNode::evaluateToInt32):
+ (KJS::UnaryPlusNode::evaluateToUInt32):
+ (KJS::NegateNode::optimizeVariableAccess):
+ (KJS::NegateNode::evaluate):
+ (KJS::NegateNode::evaluateToNumber):
+ (KJS::BitwiseNotNode::optimizeVariableAccess):
+ (KJS::BitwiseNotNode::inlineEvaluateToInt32):
+ (KJS::BitwiseNotNode::evaluate):
+ (KJS::BitwiseNotNode::evaluateToNumber):
+ (KJS::BitwiseNotNode::evaluateToBoolean):
+ (KJS::BitwiseNotNode::evaluateToInt32):
+ (KJS::BitwiseNotNode::evaluateToUInt32):
+ (KJS::LogicalNotNode::optimizeVariableAccess):
+ (KJS::LogicalNotNode::evaluate):
+ (KJS::LogicalNotNode::evaluateToBoolean):
+ (KJS::MultNode::optimizeVariableAccess):
+ (KJS::MultNode::inlineEvaluateToNumber):
+ (KJS::MultNode::evaluate):
+ (KJS::MultNode::evaluateToNumber):
+ (KJS::MultNode::evaluateToBoolean):
+ (KJS::MultNode::evaluateToInt32):
+ (KJS::MultNode::evaluateToUInt32):
+ (KJS::DivNode::optimizeVariableAccess):
+ (KJS::DivNode::inlineEvaluateToNumber):
+ (KJS::DivNode::evaluate):
+ (KJS::DivNode::evaluateToNumber):
+ (KJS::DivNode::evaluateToInt32):
+ (KJS::DivNode::evaluateToUInt32):
+ (KJS::ModNode::optimizeVariableAccess):
+ (KJS::ModNode::inlineEvaluateToNumber):
+ (KJS::ModNode::evaluate):
+ (KJS::ModNode::evaluateToNumber):
+ (KJS::ModNode::evaluateToBoolean):
+ (KJS::ModNode::evaluateToInt32):
+ (KJS::ModNode::evaluateToUInt32):
+ (KJS::throwOutOfMemoryErrorToNumber):
+ (KJS::addSlowCase):
+ (KJS::addSlowCaseToNumber):
+ (KJS::add):
+ (KJS::addToNumber):
+ (KJS::AddNode::optimizeVariableAccess):
+ (KJS::AddNode::evaluate):
+ (KJS::AddNode::inlineEvaluateToNumber):
+ (KJS::AddNode::evaluateToNumber):
+ (KJS::AddNode::evaluateToInt32):
+ (KJS::AddNode::evaluateToUInt32):
+ (KJS::AddNumbersNode::inlineEvaluateToNumber):
+ (KJS::AddNumbersNode::evaluate):
+ (KJS::AddNumbersNode::evaluateToNumber):
+ (KJS::AddNumbersNode::evaluateToInt32):
+ (KJS::AddNumbersNode::evaluateToUInt32):
+ (KJS::AddStringsNode::evaluate):
+ (KJS::AddStringLeftNode::evaluate):
+ (KJS::AddStringRightNode::evaluate):
+ (KJS::SubNode::optimizeVariableAccess):
+ (KJS::SubNode::inlineEvaluateToNumber):
+ (KJS::SubNode::evaluate):
+ (KJS::SubNode::evaluateToNumber):
+ (KJS::SubNode::evaluateToInt32):
+ (KJS::SubNode::evaluateToUInt32):
+ (KJS::LeftShiftNode::optimizeVariableAccess):
+ (KJS::LeftShiftNode::inlineEvaluateToInt32):
+ (KJS::LeftShiftNode::evaluate):
+ (KJS::LeftShiftNode::evaluateToNumber):
+ (KJS::LeftShiftNode::evaluateToInt32):
+ (KJS::LeftShiftNode::evaluateToUInt32):
+ (KJS::RightShiftNode::optimizeVariableAccess):
+ (KJS::RightShiftNode::inlineEvaluateToInt32):
+ (KJS::RightShiftNode::evaluate):
+ (KJS::RightShiftNode::evaluateToNumber):
+ (KJS::RightShiftNode::evaluateToInt32):
+ (KJS::RightShiftNode::evaluateToUInt32):
+ (KJS::UnsignedRightShiftNode::optimizeVariableAccess):
+ (KJS::UnsignedRightShiftNode::inlineEvaluateToUInt32):
+ (KJS::UnsignedRightShiftNode::evaluate):
+ (KJS::UnsignedRightShiftNode::evaluateToNumber):
+ (KJS::UnsignedRightShiftNode::evaluateToInt32):
+ (KJS::UnsignedRightShiftNode::evaluateToUInt32):
+ (KJS::lessThan):
+ (KJS::lessThanEq):
+ (KJS::LessNode::optimizeVariableAccess):
+ (KJS::LessNode::inlineEvaluateToBoolean):
+ (KJS::LessNode::evaluate):
+ (KJS::LessNode::evaluateToBoolean):
+ (KJS::LessNumbersNode::inlineEvaluateToBoolean):
+ (KJS::LessNumbersNode::evaluate):
+ (KJS::LessNumbersNode::evaluateToBoolean):
+ (KJS::LessStringsNode::inlineEvaluateToBoolean):
+ (KJS::LessStringsNode::evaluate):
+ (KJS::LessStringsNode::evaluateToBoolean):
+ (KJS::GreaterNode::optimizeVariableAccess):
+ (KJS::GreaterNode::inlineEvaluateToBoolean):
+ (KJS::GreaterNode::evaluate):
+ (KJS::GreaterNode::evaluateToBoolean):
+ (KJS::LessEqNode::optimizeVariableAccess):
+ (KJS::LessEqNode::inlineEvaluateToBoolean):
+ (KJS::LessEqNode::evaluate):
+ (KJS::LessEqNode::evaluateToBoolean):
+ (KJS::GreaterEqNode::optimizeVariableAccess):
+ (KJS::GreaterEqNode::inlineEvaluateToBoolean):
+ (KJS::GreaterEqNode::evaluate):
+ (KJS::GreaterEqNode::evaluateToBoolean):
+ (KJS::InstanceOfNode::optimizeVariableAccess):
+ (KJS::InstanceOfNode::evaluate):
+ (KJS::InstanceOfNode::evaluateToBoolean):
+ (KJS::InNode::optimizeVariableAccess):
+ (KJS::InNode::evaluate):
+ (KJS::InNode::evaluateToBoolean):
+ (KJS::EqualNode::optimizeVariableAccess):
+ (KJS::EqualNode::inlineEvaluateToBoolean):
+ (KJS::EqualNode::evaluate):
+ (KJS::EqualNode::evaluateToBoolean):
+ (KJS::NotEqualNode::optimizeVariableAccess):
+ (KJS::NotEqualNode::inlineEvaluateToBoolean):
+ (KJS::NotEqualNode::evaluate):
+ (KJS::NotEqualNode::evaluateToBoolean):
+ (KJS::StrictEqualNode::optimizeVariableAccess):
+ (KJS::StrictEqualNode::inlineEvaluateToBoolean):
+ (KJS::StrictEqualNode::evaluate):
+ (KJS::StrictEqualNode::evaluateToBoolean):
+ (KJS::NotStrictEqualNode::optimizeVariableAccess):
+ (KJS::NotStrictEqualNode::inlineEvaluateToBoolean):
+ (KJS::NotStrictEqualNode::evaluate):
+ (KJS::NotStrictEqualNode::evaluateToBoolean):
+ (KJS::BitAndNode::optimizeVariableAccess):
+ (KJS::BitAndNode::evaluate):
+ (KJS::BitAndNode::inlineEvaluateToInt32):
+ (KJS::BitAndNode::evaluateToNumber):
+ (KJS::BitAndNode::evaluateToBoolean):
+ (KJS::BitAndNode::evaluateToInt32):
+ (KJS::BitAndNode::evaluateToUInt32):
+ (KJS::BitXOrNode::optimizeVariableAccess):
+ (KJS::BitXOrNode::inlineEvaluateToInt32):
+ (KJS::BitXOrNode::evaluate):
+ (KJS::BitXOrNode::evaluateToNumber):
+ (KJS::BitXOrNode::evaluateToBoolean):
+ (KJS::BitXOrNode::evaluateToInt32):
+ (KJS::BitXOrNode::evaluateToUInt32):
+ (KJS::BitOrNode::optimizeVariableAccess):
+ (KJS::BitOrNode::inlineEvaluateToInt32):
+ (KJS::BitOrNode::evaluate):
+ (KJS::BitOrNode::evaluateToNumber):
+ (KJS::BitOrNode::evaluateToBoolean):
+ (KJS::BitOrNode::evaluateToInt32):
+ (KJS::BitOrNode::evaluateToUInt32):
+ (KJS::LogicalAndNode::optimizeVariableAccess):
+ (KJS::LogicalAndNode::evaluate):
+ (KJS::LogicalAndNode::evaluateToBoolean):
+ (KJS::LogicalOrNode::optimizeVariableAccess):
+ (KJS::LogicalOrNode::evaluate):
+ (KJS::LogicalOrNode::evaluateToBoolean):
+ (KJS::ConditionalNode::optimizeVariableAccess):
+ (KJS::ConditionalNode::evaluate):
+ (KJS::ConditionalNode::evaluateToBoolean):
+ (KJS::ConditionalNode::evaluateToNumber):
+ (KJS::ConditionalNode::evaluateToInt32):
+ (KJS::ConditionalNode::evaluateToUInt32):
+ (KJS::valueForReadModifyAssignment):
+ (KJS::ReadModifyResolveNode::optimizeVariableAccess):
+ (KJS::AssignResolveNode::optimizeVariableAccess):
+ (KJS::ReadModifyLocalVarNode::evaluate):
+ (KJS::AssignLocalVarNode::evaluate):
+ (KJS::ReadModifyConstNode::evaluate):
+ (KJS::AssignConstNode::evaluate):
+ (KJS::ReadModifyResolveNode::evaluate):
+ (KJS::AssignResolveNode::evaluate):
+ (KJS::AssignDotNode::optimizeVariableAccess):
+ (KJS::AssignDotNode::evaluate):
+ (KJS::ReadModifyDotNode::optimizeVariableAccess):
+ (KJS::ReadModifyDotNode::evaluate):
+ (KJS::AssignErrorNode::evaluate):
+ (KJS::AssignBracketNode::optimizeVariableAccess):
+ (KJS::AssignBracketNode::evaluate):
+ (KJS::ReadModifyBracketNode::optimizeVariableAccess):
+ (KJS::ReadModifyBracketNode::evaluate):
+ (KJS::CommaNode::optimizeVariableAccess):
+ (KJS::CommaNode::evaluate):
+ (KJS::ConstDeclNode::optimizeVariableAccess):
+ (KJS::ConstDeclNode::handleSlowCase):
+ (KJS::ConstDeclNode::evaluateSingle):
+ (KJS::ConstDeclNode::evaluate):
+ (KJS::ConstStatementNode::optimizeVariableAccess):
+ (KJS::ConstStatementNode::execute):
+ (KJS::statementListExecute):
+ (KJS::BlockNode::optimizeVariableAccess):
+ (KJS::BlockNode::execute):
+ (KJS::EmptyStatementNode::execute):
+ (KJS::ExprStatementNode::optimizeVariableAccess):
+ (KJS::ExprStatementNode::execute):
+ (KJS::VarStatementNode::optimizeVariableAccess):
+ (KJS::VarStatementNode::execute):
+ (KJS::IfNode::optimizeVariableAccess):
+ (KJS::IfNode::execute):
+ (KJS::IfElseNode::optimizeVariableAccess):
+ (KJS::IfElseNode::execute):
+ (KJS::DoWhileNode::optimizeVariableAccess):
+ (KJS::DoWhileNode::execute):
+ (KJS::WhileNode::optimizeVariableAccess):
+ (KJS::WhileNode::execute):
+ (KJS::ForNode::optimizeVariableAccess):
+ (KJS::ForNode::execute):
+ (KJS::ForInNode::optimizeVariableAccess):
+ (KJS::ForInNode::execute):
+ (KJS::ContinueNode::execute):
+ (KJS::BreakNode::execute):
+ (KJS::ReturnNode::optimizeVariableAccess):
+ (KJS::ReturnNode::execute):
+ (KJS::WithNode::optimizeVariableAccess):
+ (KJS::WithNode::execute):
+ (KJS::CaseClauseNode::optimizeVariableAccess):
+ (KJS::CaseClauseNode::evaluate):
+ (KJS::CaseClauseNode::executeStatements):
+ (KJS::ClauseListNode::optimizeVariableAccess):
+ (KJS::CaseBlockNode::optimizeVariableAccess):
+ (KJS::CaseBlockNode::executeBlock):
+ (KJS::SwitchNode::optimizeVariableAccess):
+ (KJS::SwitchNode::execute):
+ (KJS::LabelNode::optimizeVariableAccess):
+ (KJS::LabelNode::execute):
+ (KJS::ThrowNode::optimizeVariableAccess):
+ (KJS::ThrowNode::execute):
+ (KJS::TryNode::optimizeVariableAccess):
+ (KJS::TryNode::execute):
+ (KJS::ProgramNode::initializeSymbolTable):
+ (KJS::ScopeNode::optimizeVariableAccess):
+ (KJS::ProgramNode::processDeclarations):
+ (KJS::EvalNode::processDeclarations):
+ (KJS::ProgramNode::execute):
+ (KJS::EvalNode::execute):
+ (KJS::FunctionBodyNodeWithDebuggerHooks::execute):
+ (KJS::FuncDeclNode::execute):
+ (KJS::FuncExprNode::evaluate):
+ * kjs/nodes.h:
+ (KJS::Node::):
+ (KJS::FalseNode::):
+ (KJS::TrueNode::):
+ (KJS::ArgumentsNode::):
+
+2008-04-23 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff.
+
+ Bug 18672: SQUIRRELFISH: codegen fails with a large number of temporaries
+ <https://bugs.webkit.org/show_bug.cgi?id=18672>
+
+ Add a SegmentedVector type, which provides a Vector<T> which maintains
+ existing memory locations during resize. This allows dynamically sizing
+ local, temporary and label "vectors" in CodeGenerator.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::addVar):
+ (KJS::CodeGenerator::CodeGenerator):
+ (KJS::CodeGenerator::newTemporary):
+ (KJS::CodeGenerator::newLabel):
+ * VM/CodeGenerator.h:
+ * VM/SegmentedVector.h: Added.
+ (KJS::SegmentedVector::SegmentedVector):
+ (KJS::SegmentedVector::~SegmentedVector):
+ (KJS::SegmentedVector::last):
+ (KJS::SegmentedVector::append):
+ (KJS::SegmentedVector::removeLast):
+ (KJS::SegmentedVector::size):
+ (KJS::SegmentedVector::operator[]):
+ (KJS::SegmentedVector::resize):
+ (KJS::SegmentedVector::shrink):
+ (KJS::SegmentedVector::grow):
+
+2008-04-23 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ A little refactoring in preparation for supporting 'arguments'.
+
+ Fixes 2 regression tests.
+
+ SunSpider reports no change.
+
+ We now check the activation register, instead of the codeBlock, to
+ determine whether we need to tear off the activation. This is to support
+ "f.arguments", which will create an activation/arguments pair for f,
+ even though the needsFullScopeChain flag is false for f's codeBlock.
+
+ The test fixes resulted from calling initializeCallFrame for re-entrant
+ function code, instead of initializing (not enough) parts of the call
+ frame by hand.
+
+2008-04-22 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Sam.
+
+ - propagate the "this" value properly to local eval
+
+ (fixes a measly one regression test)
+
+ * VM/CodeBlock.h:
+ (KJS::CodeBlock::CodeBlock):
+ (KJS::ProgramCodeBlock::ProgramCodeBlock):
+ (KJS::EvalCodeBlock::EvalCodeBlock):
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+
+2008-04-22 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Maciej.
+
+ Add support for function declarations in eval code.
+
+ (this fixes 12 more regression tests)
+
+ * VM/CodeBlock.h:
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::CodeGenerator):
+ * VM/CodeGenerator.h:
+ * VM/Machine.cpp:
+ (KJS::Machine::execute):
+ * kjs/nodes.cpp:
+ (KJS::EvalNode::generateCode):
+
+2008-04-22 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Oliver.
+
+ Implement LabelNode.
+
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::pushJumpContext):
+ (KJS::CodeGenerator::jumpContextForContinue):
+ (KJS::CodeGenerator::jumpContextForBreak):
+ * VM/CodeGenerator.h:
+ * kjs/nodes.cpp:
+ (KJS::DoWhileNode::emitCode):
+ (KJS::WhileNode::emitCode):
+ (KJS::ForNode::emitCode):
+ (KJS::ForInNode::emitCode):
+ (KJS::ContinueNode::emitCode):
+ (KJS::BreakNode::emitCode):
+ (KJS::SwitchNode::emitCode):
+ (KJS::LabelNode::emitCode):
+
+2008-04-22 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Fixed crash when unwinding from exceptions inside eval.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::unwindCallFrame): Don't assume that the top of the
+ current call frame's scope chain is an activation: it can be the global
+ object, instead.
+
+2008-04-22 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Geoff.
+
+ * kjs/testkjs.cpp:
+ (main): Convert signals to exit codes, so that crashing tests are
+ detected as regression test failures.
+
+2008-04-22 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt and Maciej Stachowiak.
+
+ Renamed "needsActivation" to "needsFullScopeChain" because lying will
+ make hair grow on the backs of your hands.
+
+2008-04-21 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Fixed ScopeChainNode lifetime problems:
+
+ (1) In "with" and "catch" scopes, we would construct a ScopeChain
+ object and then jump across its destructor, leaking the ScopeChainNode
+ we had pushed.
+
+ (2) In global and eval scopes, we would fail to initially ref
+ "scopeChain", causing us to overrelease it later. Now that we ref
+ "scopeChain" properly, we also need to deref it when the script
+ terminates.
+
+ SunSpider reports a .2% regression, but an earlier round of ScopeChain
+ refactoring was a .4% speedup, so there.
+
+2008-04-22 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Alexey.
+
+ - use global object instead of null for "this" on unqualified calls
+
+ This fixes 10 more JSC test regressions.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+
+2008-04-22 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver.
+
+ - throw proper exceptions for objects that don't implement call or construct
+
+ This fixes 21 more JSC test regressions. It is also seemingly an
+ 0.5% progression.
+
+ * VM/ExceptionHelpers.cpp:
+ (KJS::createNotAnObjectError):
+ (KJS::createNotAConstructorError):
+ (KJS::createNotAFunctionError):
+ * VM/ExceptionHelpers.h:
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+
+2008-04-21 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff.
+
+ Implement emitCode for ConstDeclNode.
+
+ This fixes the crash (assertion) in js1_5/Scope/scope-001.js
+
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::registerForLocalConstInit):
+ * VM/CodeGenerator.h:
+ * kjs/nodes.cpp:
+ (KJS::AssignResolveNode::emitCode):
+ (KJS::ConstDeclNode::emitCodeSingle):
+ (KJS::ConstDeclNode::emitCode):
+ (KJS::ConstStatementNode::emitCode):
+ * kjs/nodes.h:
+
+2008-04-21 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Sam.
+
+ - add some support for the split window object
+
+ This fixes many layout tests.
+
+ * VM/Machine.cpp:
+ (KJS::resolveBaseAndFunc): Use toThisObject() to ensure we get the
+ wrapper global, if one exists, as the "this" object.
+ * kjs/function.cpp:
+ (KJS::globalFuncEval): Use toGlobalObject() to handle the wrapper
+ case properly.
+
+2008-04-21 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver.
+
+ - restore ScopeChain::operator= to avoid crash on many layout tests
+
+ Otherwise, FunctionImp::setScope would cause a reference
+ underflow. I implemented using the copy construct and swap idiom.
+
+ * kjs/scope_chain.h:
+ (KJS::ScopeChain::swap):
+ (KJS::ScopeChain::operator=):
+
+2008-04-21 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff.
+
+ Bug 18649: SQUIRRELFISH: correctly handle exceptions in eval code
+ <https://bugs.webkit.org/show_bug.cgi?id=18649>
+
+ Allocate a callframe for eval() and initialise with a null codeBlock to
+ indicate native code. This prevents the unwinder from clobbering the
+ register stack.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::execute):
+
+2008-04-21 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Removed ScopeChain::push(ScopeChain&) because it was unused. Moved
+ ScopeChain::print to ScopeChainNode.
+
+ ScopeChain is now nothing more than a resource-handling wrapper around
+ ScopeChainNode.
+
+2008-04-21 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Maciej.
+
+ Bug 18671: SquirrelFish: continue inside switch fails
+ <https://bugs.webkit.org/show_bug.cgi?id=18671>
+
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::jumpContextForLabel):
+ * VM/CodeGenerator.h:
+ * kjs/nodes.cpp:
+ (KJS::ContinueNode::emitCode):
+
+2008-04-21 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Moved push(JSObject*) and pop() from ScopeChain to ScopeChainNode,
+ rearranging scope_chain.h a bit.
+
+ SunSpider reports no change.
+
+2008-04-21 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Moved bottom() from ScopeChain to ScopeChainNode, simplifying it based
+ on the knowledge that the ScopeChain is never empty.
+
+ SunSpider reports no change.
+
+2008-04-21 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Moved begin() and end() from ScopeChain to ScopeChainNode.
+
+ Also marked a few methods "const".
+
+ SunSpider reports no change.
+
+2008-04-21 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Turned ScopeChain::depth into a stand-alone function, and simplified it
+ a bit.
+
+ I also moved ScopeChain::depth to Machine.cpp because it doesn't report
+ the true depth of the ScopeChain -- just the Machine's perspective of
+ its depth within a given call frame.
+
+ SunSpider reports no change.
+
+2008-04-21 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Removed indirection in ScopeChain::ref / ScopeChain::deref.
+
+ SunSpider reports no change.
+
+ * kjs/scope_chain.h:
+ (KJS::ScopeChain::ScopeChain):
+ (KJS::ScopeChain::~ScopeChain):
+ (KJS::ScopeChain::clear):
+
+2008-04-21 Oliver Hunt <oliver@apple.com>
+
+ Fix debug build
+
+ * kjs/nodes.cpp:
+ (KJS::ConstDeclNode::evaluateSingle):
+
+2008-04-21 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Oliver.
+
+ Bug 18664: SQUIRRELFISH: correctly throw a SyntaxError when parsing of eval code fails
+ <https://bugs.webkit.org/show_bug.cgi?id=18664>
+
+ Correctly throw a SyntaxError when parsing of eval code fails.
+
+ * VM/Machine.cpp:
+ (KJS::eval):
+
+2008-04-21 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff.
+
+ Partial fix for Bug 18649: SQUIRRELFISH: correctly handle exceptions in eval code
+
+ Make sure we correct the register state before jumping to vm_throw.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+
+2008-04-21 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Simplified ScopeChain ref/deref.
+
+ SunSpider reports a .4% speedup.
+
+ * kjs/scope_chain.h:
+ (KJS::ScopeChainNode::ref): Removed this function because it was nonsense.
+ ScopeChainNodes are initialized with a refCount of 1, so the loop was
+ guaranteed to iterate exactly once.
+
+2008-04-21 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Removed support for empty ScopeChains.
+
+ SunSpider reports no change.
+
+2008-04-21 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Removed some completely unused ScopeChain member functions.
+
+ SunSpider reports no change.
+
+2008-04-21 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Avoid creating unnecessary ScopeChain objects, to reduce refcount churn.
+
+ SunSpider reports no change.
+
+2008-04-21 Maciej Stachowiak <mjs@apple.com>
+
+ Rubber stamped by Alexey.
+
+ Add some braces.x
+
+ * kjs/testkjs.cpp:
+ (runWithScripts):
+
+2008-04-21 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver.
+
+ - only print "End:" output when -d flag is passed.
+
+ This fixes half of our failing JSC regression tests.
+
+ * kjs/testkjs.cpp:
+ (runWithScripts):
+
+2008-04-21 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Maciej.
+
+ Add support for variable declarations in eval code.
+
+ * VM/CodeBlock.h:
+ (KJS::EvalCodeBlock::EvalCodeBlock):
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::CodeGenerator):
+ * VM/CodeGenerator.h:
+ * VM/Machine.cpp:
+ (KJS::Machine::execute):
+ * VM/Machine.h:
+ * kjs/function.cpp:
+ (KJS::globalFuncEval):
+ * kjs/nodes.cpp:
+ (KJS::EvalNode::generateCode):
+ * kjs/nodes.h:
+ (KJS::EvalNode::):
+
+2008-04-20 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej.
+
+ Throw exceptions for invalid continue, break, and return statements.
+
+ Simple refactoring and extension of Cameron's AssignErrorNode, etc patch
+
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::CodeGenerator):
+ (KJS::CodeGenerator::pushJumpContext):
+ (KJS::CodeGenerator::popJumpContext):
+ (KJS::CodeGenerator::jumpContextForLabel):
+ * VM/CodeGenerator.h:
+ * kjs/nodes.cpp:
+ (KJS::Node::emitThrowError):
+ (KJS::ContinueNode::emitCode):
+ (KJS::BreakNode::emitCode):
+ (KJS::ReturnNode::emitCode):
+ * kjs/nodes.h:
+
+2008-04-20 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Removed Machine.cpp from AllInOneFile.cpp, and manually inlined a few
+ things that used to be inlined automatically.
+
+ 1.9% speedup on SunSpider.
+
+ My hope is that we'll face fewer surprises in Machine.cpp codegen, now
+ that GCC is making fewer decisions. The speedup seems to confirm that.
+
+2008-04-20 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej.
+
+ Bug 18642: Iterator context may get placed into the return register, leading to much badness
+ <https://bugs.webkit.org/show_bug.cgi?id=18642>
+
+ To prevent incorrectly reusing what will become the result register for
+ eval and global code execution, we need to request and ref the destination
+ in advance of codegen. Unfortunately this may lead to unnecessary copying,
+ although in future we can probably limit this. Curiously SunSpider shows
+ a progression in a number of tests, although it comes out as a wash overall.
+
+ * kjs/nodes.cpp:
+ (KJS::EvalNode::emitCode):
+ (KJS::ProgramNode::emitCode):
+
+2008-04-20 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Maciej.
+
+ Add support for AssignErrorNode, PrefixErrorNode, and PostfixErrorNode.
+
+ * VM/CodeBlock.cpp:
+ (KJS::CodeBlock::dump):
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::emitCreateError):
+ * VM/CodeGenerator.h:
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+ * VM/Opcode.h:
+ * kjs/nodes.cpp:
+ (KJS::PostfixErrorNode::emitCode):
+ (KJS::PrefixErrorNode::emitCode):
+ (KJS::AssignErrorNode::emitCode):
+ * kjs/nodes.h:
+
+2008-04-20 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff and Mark.
+
+ Provide line number information in exceptions
+
+ Simple patch, adds line number information metadata to CodeBlock
+ and a simple method to get the line number responsible for a given
+ Instruction*.
+
+ * VM/CodeBlock.cpp:
+ (KJS::CodeBlock::lineNumberForVPC):
+ * VM/CodeBlock.h:
+ * VM/CodeGenerator.h:
+ (KJS::CodeGenerator::emitNode):
+ * VM/Machine.cpp:
+ (KJS::Machine::throwException):
+
+2008-04-20 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej.
+
+ Provide "sourceURL" in exceptions
+
+ * VM/CodeBlock.h:
+ * VM/Machine.cpp:
+ (KJS::Machine::throwException):
+ * kjs/nodes.cpp:
+ (KJS::EvalNode::generateCode):
+ (KJS::ProgramNode::generateCode):
+
+2008-04-19 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej.
+
+ Don't call emitCode directly on subnodes, instead use CodeGenerator::emitNode
+
+ This patch just a preparation for tracking line numbers.
+
+ * kjs/nodes.cpp:
+ (KJS::ObjectLiteralNode::emitCode):
+ (KJS::PropertyListNode::emitCode):
+ (KJS::ArgumentListNode::emitCode):
+ (KJS::TryNode::emitCode):
+
+2008-04-19 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej.
+
+ Bug 18619: Support continue, break, and return in try .. finally blocks
+ <https://bugs.webkit.org/show_bug.cgi?id=18619>
+
+ This patch replaces the current partial finally support (which uses code
+ duplication to achieve what it does) with a subroutine based approach.
+ This has a number of advantages over code duplication:
+ * Reduced code size
+ * Simplified exception handling as the finaliser code only exists in
+ one place, so no "magic" is needed to get the correct handler for a
+ finaliser.
+ * When we support instruction to line number mapping we won't need to
+ worry about the dramatic code movement caused by duplication
+
+ On the downside it is necessary to add two new opcodes, op_jsr and op_sret
+ to enter and exit the finaliser subroutines, happily SunSpider reports
+ a performance progression (gcc amazes me) and ubench reports a wash.
+
+ While jsr and sret provide a mechanism that allows us to enter and exit
+ any arbitrary finaliser we need to, it was still necessary to increase
+ the amount of information tracked when entering and exiting both finaliser
+ scopes and dynamic scopes ("with"). This means "scopeDepth" is now
+ the combination of "finaliserDepth" and "dynamicScopeDepth". We also
+ now use a scopeContextStack to ensure that we pop scopes and execute
+ finalisers in the correct order. This increases the cost of "with" nodes
+ during codegen, but it should not be significant enough to effect real
+ world performance and greatly simplifies codegen for return, break and
+ continue when interacting with finalisers.
+
+ * VM/CodeBlock.cpp:
+ (KJS::CodeBlock::dump):
+ Pretty printing of jsr/sret opcodes
+
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::CodeGenerator):
+ (KJS::CodeGenerator::emitPushScope):
+ (KJS::CodeGenerator::emitPopScope):
+ Dynamic scopes need to be tracked on the scopeContextStack now
+
+ (KJS::CodeGenerator::pushFinallyContext):
+ (KJS::CodeGenerator::popFinallyContext):
+ Handle entry and exit from code regions with finalisers. This is
+ needed solely to support return, continue and break inside finaliser
+ regions.
+
+ (KJS::CodeGenerator::emitComplexJumpScopes):
+ Helper function for emitJumpScopes to handle the complex codegen
+ needed to handle return, continue and break inside a finaliser region
+
+ (KJS::CodeGenerator::emitJumpScopes):
+ Updated to be aware of finalisers, if a cross-scope jump occurs inside
+ a finaliser we hand off codegen to emitComplexJumpScopes, otherwise
+ we can handle the normal (trivial) case with a single instruction.
+
+ (KJS::CodeGenerator::emitJumpSubroutine):
+ (KJS::CodeGenerator::emitSubroutineReturn):
+ Trivial opcode emitter functions.
+
+ * VM/CodeGenerator.h:
+ (KJS::CodeGenerator::scopeDepth):
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+ Implement op_jsr and op_sret.
+
+ * VM/Opcode.h:
+ Ad op_jsr and op_sret
+
+ * kjs/nodes.cpp:
+ (KJS::TryNode::emitCode):
+ Fix codegen for new finaliser model.
+
+2008-04-17 Mark Rowe <mrowe@apple.com>
+
+ Rubber-stamped by Oliver Hunt.
+
+ Remove unnecessary files from testkjs, testapi and minidom targets.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2008-04-17 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Fixed ASSERT seen during run-sunspider of a debug build.
+
+ * VM/CodeGenerator.h: Made the default codegen buffers bigger. SunSpider
+ runs all tests in one global environment, so you end up with more than
+ 128 locals. This is just a stop-gap until we code up a real
+ solution to arbitrary symbol and label limits.
+
+2008-04-17 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Fixed a bug in exception unwinding, where we wouldn't deref the scope
+ chain in global scope, so we would leak ScopeChainNodes when exceptions
+ were thrown inside "with" and "catch" scopes.
+
+ Also did some cleanup of the unwinding code along the way.
+
+ Scope chain reference counting is still wrong in a few ways. I thought
+ I would fix this portion of it first.
+
+ run-sunspider shows no change.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::unwindCallFrame):
+ (KJS::Machine::throwException):
+ (KJS::Machine::privateExecute):
+ * VM/Machine.h:
+
+2008-04-17 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej.
+
+ Add more exception checking to toNumber conversions
+
+ This corrects op_pre_dec, op_negate, op_mod and op_sub.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+
+2008-04-17 Geoffrey Garen <ggaren@apple.com> and Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Oliver Hunt.
+
+ Behold: eval.
+
+ Introduced a new opcode: op_call_eval. In the normal case, it performs
+ an eval. In the case where eval has been overridden in some way, it
+ performs a function call.
+
+ * VM/CodeGenerator.h: Added a feature so the code generator knows not
+ to optimized locals in eval code.
+
+2008-04-17 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Added some ASSERTs to document codegen failures in
+ run-javascriptcore-tests.
+
+ For all tests, program-level codegen now either succeeds, or fails with
+ an ASSERT.
+
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::addVar):
+ (KJS::CodeGenerator::CodeGenerator):
+ (KJS::CodeGenerator::newTemporary):
+ (KJS::CodeGenerator::newLabel):
+
+2008-04-17 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Fixed another case of a dst register being an unreferenced temporary
+ (caused an ASSERT when running the full sunspider suite).
+
+ * kjs/nodes.cpp:
+ (KJS::CaseBlockNode::emitCodeForBlock):
+
+2008-04-16 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Geoff.
+
+ - add documentation (and meaningful parameter names) for arithmetic and bitwise binary ops
+
+ * VM/CodeBlock.cpp:
+ (KJS::CodeBlock::dump):
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::emitMul):
+ (KJS::CodeGenerator::emitDiv):
+ (KJS::CodeGenerator::emitMod):
+ (KJS::CodeGenerator::emitSub):
+ (KJS::CodeGenerator::emitLeftShift):
+ (KJS::CodeGenerator::emitRightShift):
+ (KJS::CodeGenerator::emitUnsignedRightShift):
+ (KJS::CodeGenerator::emitBitAnd):
+ (KJS::CodeGenerator::emitBitXOr):
+ (KJS::CodeGenerator::emitBitOr):
+ * VM/CodeGenerator.h:
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+ * VM/Opcode.h:
+ * kjs/nodes.cpp:
+ (KJS::MultNode::emitCode):
+ (KJS::DivNode::emitCode):
+ (KJS::ModNode::emitCode):
+ (KJS::SubNode::emitCode):
+ (KJS::LeftShiftNode::emitCode):
+ (KJS::RightShiftNode::emitCode):
+ (KJS::UnsignedRightShiftNode::emitCode):
+ (KJS::BitAndNode::emitCode):
+ (KJS::BitXOrNode::emitCode):
+ (KJS::BitOrNode::emitCode):
+ (KJS::emitReadModifyAssignment):
+ (KJS::ReadModifyResolveNode::emitCode):
+
+2008-04-16 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff.
+
+ Exception checks for toNumber in op_pre_inc
+
+ This is somewhat more convoluted than the simple hadException checks
+ we currently use. Instead we use special toNumber conversions that
+ select between the exception and ordinary vPC. This allows us to
+ remove any branches in the common case (incrementing a number).
+
+ * API/JSCallbackObject.h:
+ * API/JSCallbackObjectFunctions.h:
+ (KJS::::toNumber):
+ * ChangeLog:
+ * JavaScriptCore.exp:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * VM/JSPropertyNameIterator.cpp:
+ (KJS::JSPropertyNameIterator::toNumber):
+ * VM/JSPropertyNameIterator.h:
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+ * VM/Opcode.h:
+ * kjs/ExecState.cpp:
+ (KJS::ExecState::ExecState):
+ * kjs/ExecState.h:
+ * kjs/JSNotAnObject.cpp:
+ (KJS::JSNotAnObject::toNumber):
+ * kjs/JSNotAnObject.h:
+ * kjs/internal.cpp:
+ (KJS::StringImp::toNumber):
+ (KJS::NumberImp::toNumber):
+ (KJS::GetterSetterImp::toNumber):
+ * kjs/internal.h:
+ * kjs/object.cpp:
+ (KJS::JSObject::toNumber):
+ * kjs/object.h:
+ * kjs/value.h:
+ (KJS::JSValue::toNumber):
+
+2008-04-16 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Geoff.
+
+ - ensure that activations are kept in a register to protect them from GC
+
+ Also renamed OptionalCalleeScopeChain constant to OptionalCalleeActivation, since
+ that is what is now kept there, and there is no more need to keep the scope chain in
+ the register file.
+
+ * VM/Machine.cpp:
+ (KJS::initializeCallFrame):
+ (KJS::scopeChainForCall):
+ * VM/Machine.h:
+ (KJS::Machine::):
+
+2008-04-16 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Made "this" work in program code / global scope.
+
+ The machine can initialize "this" prior to execution because it knows
+ that, for program code, "this" is always stored in lr1.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::execute):
+ * VM/Machine.h:
+ (KJS::Machine::):
+ * kjs/interpreter.cpp:
+ (KJS::Interpreter::evaluate):
+
+2008-04-16 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Fixed a codegen bug when returning from inside a dynamic scope (a with
+ or catch block): we need to pop any dynamic scope(s) that have been
+ added so op_ret can find the activation object at the top of the scope
+ chain.
+
+ * kjs/nodes.cpp:
+ (KJS::ReturnNode::emitCode): If we're returning from inside a dynamic
+ scope, emit a jmp_scopes to take care of popping any dynamic scope(s)
+ and then branching to the return instruction.
+
+2008-04-16 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Geoff.
+
+ - document the add and get_prop_id opcodes
+
+ In addition to adding documentation in comments, I changed
+ references to register IDs or indices relating to these opcodes to
+ have meaningful names instead of r0 r1 r2.
+
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::emitAdd):
+ * VM/CodeGenerator.h:
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+ * kjs/nodes.cpp:
+ (KJS::DotAccessorNode::emitCode):
+ (KJS::FunctionCallDotNode::emitCode):
+ (KJS::PostIncDotNode::emitCode):
+ (KJS::PostDecDotNode::emitCode):
+ (KJS::PreIncDotNode::emitCode):
+ (KJS::PreDecDotNode::emitCode):
+ (KJS::AddNode::emitCode):
+ (KJS::ReadModifyDotNode::emitCode):
+
+2008-04-15 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt and Maciej Stachowiak.
+
+ Fixed a codegen bug in with and switch, and added an ASSERT to
+ make sure it doesn't happen again.
+
+ emitCode() assumes that dst, if non-zero, is either referenced or
+ non-temporary (i.e., it assumes that newTemporary() will return a
+ register not equal to dst). Certain callers to emitCode() weren't
+ guaranteeing that to be so, so temporary register values were being
+ overwritten.
+
+ * VM/CodeGenerator.h:
+ (KJS::CodeGenerator::emitNode): ASSERT that dst is referenced or non-temporary.
+
+ * kjs/nodes.cpp:
+ (KJS::CommaNode::emitCode): Reference the dst we pass.
+
+ (KJS::WithNode::emitCode): No need to pass an explicit dst register.
+
+ (KJS::CaseBlockNode::emitCodeForBlock): No need to pass an explicit dst register.
+ (KJS::SwitchNode::emitCode): No need to pass an explicit dst register.
+
+ * kjs/nodes.h: Made dst the last parameter to emitCodeForBlock, to match
+ emitCode.
+
+2008-04-15 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej.
+
+ Bug 18526: Throw exceptions when resolve fails for op_resolve_base_and_func.
+ <https://bugs.webkit.org/show_bug.cgi?id=18526>
+
+ Very simple fix, sunspider shows a 0.7% progression, ubench shows a 0.4% regression.
+
+ * VM/Machine.cpp:
+ (KJS::resolveBaseAndFunc):
+ (KJS::Machine::privateExecute):
+
+2008-04-15 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver.
+
+ - fix incorrect result on 3d-raytrace test
+
+ Oliver found and tracked down this bug, I just typed in the fix.
+
+ * VM/Machine.cpp:
+ (KJS::slideRegisterWindowForCall): When setting omitted parameters to undefined,
+ account for the space for local variables.
+
+2008-04-15 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver.
+
+ - fix codegen handling of dst registers
+
+ 1.006x speedup (not sure why).
+
+ Most emitCode functions take an optional "dst" parameter that says
+ where the output of the instruction should be written. I made some
+ functions for convenient handling of the dst register:
+
+ * VM/CodeGenerator.h:
+ (KJS::CodeGenerator::tempDestination): Takes the dst register. Returns it if
+ it is not null and is a temporary, otherwise allocates a new temporary. This is
+ intended for cases where an intermediate value might be written into the dst
+
+ (KJS::CodeGenerator::finalDestination): Takes the dst register and an optional
+ register that was used as a temp destination. Picks the right thing for the final
+ output. Intended to be used as the output register for the instruction that generates
+ the final value of a particular node.
+
+ (KJS::CodeGenerator::moveToDestinationIfNeeded): Takes dst and a
+ RegisterID; moves from the register to dst if dst is defined and
+ different from the register. This is intended for cases where the
+ result of a node is already in a specific register (likely a
+ local), and so no code needs to be generated unless a specific
+ destination has been requested, in which case a move is needed.
+
+ I also applied these methods throughout emitCode functions. In
+ some cases this was just cleanup, in other cases I fixed actual
+ codegen bugs. Below I have given specific comments for the cases
+ where I believe I fixed a codegen bug, or improved quality of codegen.
+
+ * kjs/nodes.cpp:
+ (KJS::NullNode::emitCode):
+ (KJS::FalseNode::emitCode):
+ (KJS::TrueNode::emitCode):
+ (KJS::NumberNode::emitCode):
+ (KJS::StringNode::emitCode):
+ (KJS::RegExpNode::emitCode):
+ (KJS::ThisNode::emitCode): Now avoids emitting a mov when dst is
+ the same as the this register (the unlikely case of "this = this");
+ (KJS::ResolveNode::emitCode): Now avoids emitting a mov when dst
+ is the same as the local regiester, in the local var case (the
+ unlikely case of "x = x");
+ (KJS::ArrayNode::emitCode): Fixed a codegen bug where array
+ literal element expressions may have observed an intermediate
+ value of constructing the array.
+ (KJS::ObjectLiteralNode::emitCode):
+ (KJS::PropertyListNode::emitCode): Fixed a codegen bug where object literal
+ property definition expressions may have obesrved an intermediate value of
+ constructing the object.
+ (KJS::BracketAccessorNode::emitCode):
+ (KJS::DotAccessorNode::emitCode):
+ (KJS::NewExprNode::emitCode):
+ (KJS::FunctionCallValueNode::emitCode):
+ (KJS::FunctionCallBracketNode::emitCode):
+ (KJS::FunctionCallDotNode::emitCode):
+ (KJS::PostIncResolveNode::emitCode):
+ (KJS::PostDecResolveNode::emitCode):
+ (KJS::PostIncBracketNode::emitCode):
+ (KJS::PostDecBracketNode::emitCode):
+ (KJS::PostIncDotNode::emitCode):
+ (KJS::PostDecDotNode::emitCode):
+ (KJS::DeleteResolveNode::emitCode):
+ (KJS::DeleteBracketNode::emitCode):
+ (KJS::DeleteDotNode::emitCode):
+ (KJS::DeleteValueNode::emitCode):
+ (KJS::VoidNode::emitCode):
+ (KJS::TypeOfResolveNode::emitCode):
+ (KJS::TypeOfValueNode::emitCode):
+ (KJS::PreIncResolveNode::emitCode): Fixed a codegen bug where the final
+ value would not be output to the dst register in the local var case.
+ (KJS::PreDecResolveNode::emitCode): Fixed a codegen bug where the final
+ value would not be output to the dst register in the local var case.
+ (KJS::PreIncBracketNode::emitCode):
+ (KJS::PreDecBracketNode::emitCode):
+ (KJS::PreIncDotNode::emitCode):
+ (KJS::PreDecDotNode::emitCode):
+ (KJS::UnaryPlusNode::emitCode):
+ (KJS::NegateNode::emitCode):
+ (KJS::BitwiseNotNode::emitCode):
+ (KJS::LogicalNotNode::emitCode):
+ (KJS::MultNode::emitCode):
+ (KJS::DivNode::emitCode):
+ (KJS::ModNode::emitCode):
+ (KJS::AddNode::emitCode):
+ (KJS::SubNode::emitCode):
+ (KJS::LeftShiftNode::emitCode):
+ (KJS::RightShiftNode::emitCode):
+ (KJS::UnsignedRightShiftNode::emitCode):
+ (KJS::LessNode::emitCode):
+ (KJS::GreaterNode::emitCode):
+ (KJS::LessEqNode::emitCode):
+ (KJS::GreaterEqNode::emitCode):
+ (KJS::InstanceOfNode::emitCode):
+ (KJS::InNode::emitCode):
+ (KJS::EqualNode::emitCode):
+ (KJS::NotEqualNode::emitCode):
+ (KJS::StrictEqualNode::emitCode):
+ (KJS::NotStrictEqualNode::emitCode):
+ (KJS::BitAndNode::emitCode):
+ (KJS::BitXOrNode::emitCode):
+ (KJS::BitOrNode::emitCode):
+ (KJS::LogicalAndNode::emitCode):
+ (KJS::LogicalOrNode::emitCode):
+ (KJS::ConditionalNode::emitCode):
+ (KJS::emitReadModifyAssignment): Allow an out argument separate from the operands,
+ needed for fixes below.
+ (KJS::ReadModifyResolveNode::emitCode): Fixed a codegen bug where the right side of
+ the expression may observe an intermediate value.
+ (KJS::AssignResolveNode::emitCode): Fixed a codegen bug where the right side of the
+ expression may observe an intermediate value.
+ (KJS::ReadModifyDotNode::emitCode): Fixed a codegen bug where the right side of the
+ expression may observe an intermediate value.
+ (KJS::ReadModifyBracketNode::emitCode): Fixed a codegen bug where the right side of the
+ expression may observe an intermediate value.
+ (KJS::CommaNode::emitCode): Avoid writing temporary value to dst register.
+ (KJS::ReturnNode::emitCode): Void return should return undefined, not null.
+ (KJS::FuncExprNode::emitCode):
+
+2008-04-15 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Geoff.
+
+ - fix huge performance regression (from trunk) in string-unpack-code
+
+ This restores string-unpack-code performance to parity with
+ trunk (2.27x speedup relative to previous SquirrelFish)
+
+ * VM/Machine.cpp:
+ (KJS::Machine::execute): Shrink register file after call to avoid
+ growing repeatedly.
+
+2008-04-15 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Fixed dumpCallFrame to match our new convention of passing around a
+ ScopeChainNode* instead of a ScopeChain*.
+
+ * JavaScriptCore.exp:
+ * VM/Machine.cpp:
+ (KJS::Machine::dumpCallFrame):
+ * VM/Machine.h:
+
+2008-04-15 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej.
+
+ Bug 18436: Need to throw exception on read/modify/write or similar resolve for nonexistent property
+ <https://bugs.webkit.org/show_bug.cgi?id=18436>
+
+ Add op_resolve_base_and_property for read/modify/write operations,
+ this adds a "superinstruction" to resolve the base and value of a
+ property simultaneously. Just using resolveBase and resolve results
+ in an 5% regression in ubench, 30% in loop-empty-resolve (which is
+ expected). 1.3% progression in sunspider, 2.1% in ubench, with a
+ 21% gain in loop-empty-resolve. The only outlier is function-missing-args
+ which gets a 3% regression that I could never resolve.
+
+ * VM/CodeBlock.cpp:
+ (KJS::CodeBlock::dump):
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::emitResolveBaseAndProperty):
+ * VM/CodeGenerator.h:
+ * VM/Machine.cpp:
+ (KJS::resolveBaseAndProperty):
+ (KJS::Machine::privateExecute):
+ * VM/Opcode.h:
+ * kjs/nodes.cpp:
+ (KJS::PostIncResolveNode::emitCode):
+ (KJS::PostDecResolveNode::emitCode):
+ (KJS::PreIncResolveNode::emitCode):
+ (KJS::PreDecResolveNode::emitCode):
+ (KJS::ReadModifyResolveNode::emitCode):
+
+2008-04-15 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver.
+
+ - fixed "SquirrelFish crashes due to bad scope chain on some SunSpider tests"
+ https://bugs.webkit.org/show_bug.cgi?id=18508
+
+ 3d-raytrace and string-unpack-code now run.
+
+ The basic approach is to pass around ScopeChainNode* instead of
+ ScopeChain*, which in addition to not becoming suddenly an invalid
+ pointer also saves an indirection.
+
+ This is an 0.4% speedup on SunSpider --squirrelfish (1.8% on --ubench)
+
+ * VM/Machine.cpp:
+ (KJS::resolve):
+ (KJS::resolveBase):
+ (KJS::resolveBaseAndFunc):
+ (KJS::initializeCallFrame):
+ (KJS::scopeChainForCall):
+ (KJS::Machine::unwindCallFrame):
+ (KJS::Machine::throwException):
+ (KJS::Machine::execute):
+ (KJS::Machine::privateExecute):
+ * VM/Machine.h:
+ * VM/Register.h:
+ (KJS::Register::):
+ * kjs/nodes.cpp:
+ (KJS::EvalNode::generateCode):
+ (KJS::FunctionBodyNode::generateCode):
+ (KJS::ProgramNode::generateCode):
+ (KJS::ProgramNode::processDeclarations):
+ (KJS::EvalNode::processDeclarations):
+ (KJS::FuncDeclNode::makeFunction):
+ (KJS::FuncExprNode::makeFunction):
+ * kjs/nodes.h:
+ (KJS::ProgramNode::):
+ (KJS::EvalNode::):
+ (KJS::FunctionBodyNode::):
+ * kjs/object.h:
+ * kjs/scope_chain.h:
+ (KJS::ScopeChainNode::ScopeChainNode):
+ (KJS::ScopeChainNode::deref):
+ (KJS::ScopeChainIterator::ScopeChainIterator):
+ (KJS::ScopeChainIterator::operator*):
+ (KJS::ScopeChainIterator::operator->):
+ (KJS::ScopeChain::ScopeChain):
+ (KJS::ScopeChain::node):
+ (KJS::ScopeChain::deref):
+ (KJS::ScopeChain::ref):
+ (KJS::ScopeChainNode::ref):
+ (KJS::ScopeChainNode::release):
+ (KJS::ScopeChainNode::begin):
+ (KJS::ScopeChainNode::end):
+
+2008-04-14 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Fixed crash when accessing registers in a torn-off activation object.
+
+ * kjs/JSActivation.cpp:
+ (KJS::JSActivation::copyRegisters): Update our registerOffset after
+ copying our registers, since our offset should now be relative to
+ our private register array, not the shared register file.
+
+2008-04-14 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver.
+
+ - fix a codegen flaw that makes some tests run way too fast or way too slow
+
+ The basic problem was that FunctionCallResolveNode results in
+ codegen which can incorrectly write an intermediate value into the
+ dst register even when that is a local. I added convenience
+ functions to CodeGenerator for getting this right, but for now I
+ only fixed FunctionCallResolve.
+
+ * VM/CodeGenerator.h:
+ (KJS::CodeGenerator::tempDestination):
+ (KJS::CodeGenerator::):
+ * kjs/nodes.cpp:
+ (KJS::FunctionCallResolveNode::emitCode):
+
+2008-04-14 Gabor Loki <loki@inf.u-szeged.hu>
+
+ Reviewed and slightly tweaked by Geoffrey Garen.
+
+ Bug 18489: Squirrelfish doesn't build on linux
+ <https://bugs.webkit.org/show_bug.cgi?id=18489>
+
+ * JavaScriptCore.pri: Add VM into include path and its files into
+ source set
+ * VM/JSPropertyNameIterator.cpp: Fix include name
+ * VM/Machine.cpp: Add UNLIKELY macro for GCC
+ * VM/Machine.h: Add missing includes
+ * VM/RegisterFile.cpp: Add missing include
+ * kjs/testkjs.pro: Add VM into include path
+
+2008-04-14 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Restored OwnPtr in some places where I had removed it previously. We
+ can have an OwnPtr to an undefined class in a header as long as the
+ class's destructor isn't in the header.
+
+2008-04-14 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Fixed access to "this" inside dynamic scopes.
+
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::registerForLocal): Always return a register for
+ "this", even if we're not optimizing access to other locals. Because
+ "this" is a keyword, it's always in a register and always accessible.
+
+ * VM/CodeGenerator.h:
+ (KJS::CodeGenerator::shouldOptimizeLocals): Factored out a function
+ for determining whether we should optimize access to locals, since
+ eval will need to make this test a little more complicated.
+
+2008-04-14 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Adam.
+
+ - fix crash when running SunSpider full harness
+
+ When growing the register file's buffer to make space for new globals,
+ make sure to copy accounting for the fact that the new space is logically
+ at the beginning of the buffer in this case, instead of at the end as when
+ growing for a new call frame.
+
+ * VM/RegisterFile.cpp:
+ (KJS::RegisterFile::newBuffer):
+ (KJS::RegisterFile::growBuffer):
+ (KJS::RegisterFile::addGlobalSlots):
+ * VM/RegisterFile.h:
+
+2008-04-11 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Mark constant pools for global and eval code (collectively known as
+ "program code"). (Constant pools for function code are already marked by
+ their functions.)
+
+ The global object is responsible for marking program code constant
+ pools. Code blocks add themselves to the mark set at creation time, and
+ remove themselves from the mark set at destruction time.
+
+ sunspider --squirrelfish reports a 1% speedup, perhaps because
+ generateCode() is now non-virtual.
+
+ * kjs/nodes.cpp: I had to use manual init and delete in this file
+ because putting an OwnPtr into the header would have created a circular
+ header dependency.
+
+2008-04-10 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Maciej.
+
+ Bug 18231: Improve support for function call nodes in SquirrelFish
+ <https://bugs.webkit.org/show_bug.cgi?id=18231>
+
+ Use correct value of 'this' for function calls.
+
+ * VM/CodeBlock.cpp:
+ (KJS::CodeBlock::dump):
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::emitResolveBaseAndFunc):
+ * VM/CodeGenerator.h:
+ * VM/Machine.cpp:
+ (KJS::resolveBaseAndFunc):
+ (KJS::Machine::privateExecute):
+ * VM/Opcode.h:
+ * kjs/nodes.cpp:
+ (KJS::FunctionCallResolveNode::emitCode):
+
+2008-04-10 Geoffrey Garen <ggaren@apple.com>
+
+ This time for sure.
+
+ * kjs/interpreter.cpp:
+ (KJS::Interpreter::evaluate):
+
+2008-04-10 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Fixed Interpreter::execute to honor the new model for returning non-NULL
+ values when an exception is thrown.
+
+ * kjs/interpreter.cpp:
+ (KJS::Interpreter::evaluate):
+
+2008-04-10 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff.
+
+ Fix SquirrelFish interpreter to pass internal exceptions back to
+ native code correctly.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+
+2008-04-10 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ Replace the use of getCallData in op_construct with the new
+ getConstructData function that replaces implementsConstruct.
+
+ * API/JSCallbackConstructor.cpp:
+ (KJS::JSCallbackConstructor::getConstructData):
+ * API/JSCallbackConstructor.h:
+ * API/JSCallbackObject.h:
+ * API/JSCallbackObjectFunctions.h:
+ (KJS::::getConstructData):
+ (KJS::::construct):
+ * API/JSObjectRef.cpp:
+ (JSObjectIsConstructor):
+ * JavaScriptCore.exp:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+ * kjs/CallData.h:
+ * kjs/ConstructData.h: Copied from JavaScriptCore/kjs/CallData.h.
+ * kjs/array_object.cpp:
+ (KJS::ArrayObjectImp::getConstructData):
+ * kjs/array_object.h:
+ * kjs/bool_object.cpp:
+ (KJS::BooleanObjectImp::getConstructData):
+ * kjs/bool_object.h:
+ * kjs/date_object.cpp:
+ (KJS::DateObjectImp::getConstructData):
+ * kjs/date_object.h:
+ * kjs/error_object.cpp:
+ (KJS::ErrorObjectImp::getConstructData):
+ (KJS::NativeErrorImp::getConstructData):
+ * kjs/error_object.h:
+ * kjs/function.cpp:
+ (KJS::FunctionImp::getCallData):
+ (KJS::FunctionImp::getConstructData):
+ (KJS::FunctionImp::construct):
+ * kjs/function.h:
+ * kjs/function_object.cpp:
+ (KJS::FunctionObjectImp::getConstructData):
+ * kjs/function_object.h:
+ * kjs/nodes.cpp:
+ (KJS::NewExprNode::inlineEvaluate):
+ * kjs/number_object.cpp:
+ (KJS::NumberObjectImp::getConstructData):
+ * kjs/number_object.h:
+ * kjs/object.cpp:
+ * kjs/object.h:
+ * kjs/object_object.cpp:
+ (KJS::ObjectObjectImp::getConstructData):
+ * kjs/object_object.h:
+ * kjs/regexp_object.cpp:
+ (KJS::RegExpObjectImp::getConstructData):
+ * kjs/regexp_object.h:
+ * kjs/string_object.cpp:
+ (KJS::StringObjectImp::getConstructData):
+ * kjs/string_object.h:
+ * kjs/value.cpp:
+ (KJS::JSCell::getConstructData):
+ * kjs/value.h:
+ (KJS::JSValue::getConstructData):
+
+2008-04-10 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff.
+
+ Bug 18420: SquirrelFish: need to throw Reference and Type errors
+ when attempting invalid operations on JSValues
+
+ Add validation and exception checks to SquirrelFish so that the
+ correct exceptions are thrown for undefined variables, type errors
+ and toObject failure. Also handle exceptions thrown by native
+ function calls.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * VM/ExceptionHelpers.cpp: Added.
+ (KJS::substitute):
+ (KJS::createError):
+ (KJS::createUndefinedVariableError):
+ * VM/ExceptionHelpers.h: Added.
+ Helper functions
+ * VM/Machine.cpp:
+ (KJS::resolve):
+ Modified to signal failure
+ (KJS::isNotObject):
+ Wrapper for JSValue::isObject and exception creation (these need
+ to be merged, lest GCC go off the deep end)
+ (KJS::Machine::privateExecute):
+ Adding the many exception and validity checks.
+
+ * kjs/JSNotAnObject.cpp: Added.
+ Stub object used to reduce the need for multiple exception checks
+ when toObject fails.
+ (KJS::JSNotAnObject::toPrimitive):
+ (KJS::JSNotAnObject::getPrimitiveNumber):
+ (KJS::JSNotAnObject::toBoolean):
+ (KJS::JSNotAnObject::toNumber):
+ (KJS::JSNotAnObject::toString):
+ (KJS::JSNotAnObject::toObject):
+ (KJS::JSNotAnObject::mark):
+ (KJS::JSNotAnObject::getOwnPropertySlot):
+ (KJS::JSNotAnObject::put):
+ (KJS::JSNotAnObject::deleteProperty):
+ (KJS::JSNotAnObject::defaultValue):
+ (KJS::JSNotAnObject::construct):
+ (KJS::JSNotAnObject::callAsFunction):
+ (KJS::JSNotAnObject::getPropertyNames):
+ * kjs/JSNotAnObject.h: Added.
+ (KJS::JSNotAnObject::JSNotAnObject):
+ * kjs/JSImmediate.cpp:
+ (KJS::JSImmediate::toObject):
+ modified to create an JSNotAnObject rather than throwing an exception
+ directly.
+
+2008-04-10 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Pass a function body node its function's scope chain, rather than the
+ current execution context's scope chain, when compiling it.
+
+ This doesn't matter yet, but it will once we start using the scope
+ chain during compilation.
+
+ sunspider --squirrelfish notes a tiny speedup.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+
+2008-04-10 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Fix two bugs when throwing exceptions from re-entrant JS calls:
+
+ (1) Don't shrink the register file to 0, since our caller may still
+ be using it.
+
+ (2) In case of exception, return jsNull() instead of 0 because,
+ surprisingly, some JavaScriptCore clients rely on a function's return
+ value being safe to operate on even if the function threw an exception.
+
+ Also:
+
+ - Changed FunctionImp::callAsFunction to honor the new semantics of
+ exceptions not returning 0.
+
+ - Renamed "handlerPC" to "handlerVPC" to match other uses of "VPC".
+
+ - Renamed "exceptionData" to "exceptionValue", because "data" seemed to
+ imply something more than just a JSValue.
+
+ - Merged prepareException into throwException, since throwException was
+ its only caller, and it seemed weird that throwException didn't take
+ an exception as an argument.
+
+ sunspider --squirrelfish does not seem to complain on my machine, but it
+ complains a little (.6%) on Oliver's.
+
+2008-04-10 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Fixed op_construct for CallTypeNative to reacquire "r" before setting
+ its return value, since registerBase can theoretically change during the
+ execution of arbitrary code. (Not sure if any native constructors
+ actually make this possible.)
+
+ sunspider --squirrelfish does not seem to complain.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+
+2008-04-10 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt and Sam Weinig.
+
+ Re-entrant execution of function code (global code -> built-in function
+ -> JS function):
+
+ Miraculously, sunspider --squirrelfish does not seem to complain.
+
+ A re-entrant function call is the same as a normal function call with
+ one exception: the re-entrant call leaves everything except for
+ CallerCodeBlock in the call frame header uninitialized, since the call
+ doesn't need to return to JS code. (It sets CallerCodeBlock to 0, to
+ indicate that the call shouldn't return to JS code.)
+
+ Also fixed a few issues along the way:
+
+ - Fixed two bugs in the read-write List implementation that caused
+ m_size and m_buffer to go stale.
+
+ - Changed native call code to update "r" *before* setting the return
+ value, since the call may in turn call JS code, which changes the value
+ of "r".
+
+ - Migrated initialization of "r" outside of Machine::privateExecute,
+ because global code and function code initialize "r" differently.
+
+ - Migrated a codegen warning from Machine::privateExecute to the wiki.
+
+ - Removed unnecessary "r" parameter from slideRegisterWindowForCall
+
+ * VM/Machine.cpp:
+ (KJS::slideRegisterWindowForCall):
+ (KJS::scopeChainForCall):
+ (KJS::Machine::execute):
+ (KJS::Machine::privateExecute):
+ * VM/Machine.h:
+ * kjs/function.cpp:
+ (KJS::FunctionImp::callAsFunction):
+ * kjs/list.cpp:
+ (KJS::List::getSlice):
+ * kjs/list.h:
+ (KJS::List::clear):
+
+2008-04-10 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver.
+
+ - fix problem with code generation for return with no argument
+
+ 3d-cube now runs
+
+ * kjs/nodes.cpp:
+ (KJS::ReturnNode::emitCode):
+
+2008-04-10 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver.
+
+ - Implement support for JS constructors
+
+ access-binary-trees and access-nbody now run.
+
+ Inexplicably a 1% speedup.
+
+ * VM/Machine.cpp:
+ (KJS::initializeCallFrame):
+ (KJS::Machine::privateExecute):
+ * VM/Machine.h:
+ (KJS::Machine::):
+
+2008-04-10 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver.
+
+ - More code cleanup in preparation for JS constructors
+
+ Factor the remaining interesting parts of JS function calls into
+ slideRegisterWindowForCall and scopeChainForCall.
+
+ * VM/Machine.cpp:
+ (KJS::slideRegisterWindowForCall):
+ (KJS::scopeChainForCall):
+ (KJS::Machine::privateExecute):
+
+2008-04-10 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Geoff.
+
+ - Code cleanup in preparation for JS constructors
+
+ - Renamed returnInfo to callFrame.
+ - Made an enum which defines what goes where in the call frame.
+ - Factored out initializeCallFrame function from op_call
+
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::emitCall):
+ (KJS::CodeGenerator::emitConstruct):
+ * VM/Machine.cpp:
+ (KJS::Machine::dumpRegisters):
+ (KJS::initializeCallFrame):
+ (KJS::Machine::unwindCallFrame):
+ (KJS::Machine::execute):
+ (KJS::Machine::privateExecute):
+ * VM/Machine.h:
+ (KJS::Machine::):
+
+2008-04-10 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Fixed two bugs in register allocation for function calls:
+
+ (1) op_call used to allocate codeBlock->numVars too many registers for
+ each call frame, due to duplicated math. Fixing this revealed...
+
+ (2) By unconditionally calling resize(), op_call used to truncate the
+ register file when calling a function whose registers fit wholly within
+ the register file already allocated by its caller.
+
+ sunspider --squirrelfish reports no regression.
+
+ I also threw in a little extra formatting to dumpCallFrame, because it
+ helped me debug these issues.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::dumpRegisters):
+ (KJS::Machine::execute):
+ (KJS::Machine::privateExecute):
+ * VM/RegisterFile.h:
+ (KJS::RegisterFile::shrink):
+ (KJS::RegisterFile::grow):
+ * VM/RegisterFileStack.cpp:
+ (KJS::RegisterFileStack::popRegisterFile):
+
+2008-04-09 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Next step toward re-entrant execution of function code (global code ->
+ built-in function -> JS function):
+
+ Made op_ret return from Machine::privateExecute if its calling codeBlock
+ is NULL.
+
+ I'm checking this in by itself to demonstrate that a more clever
+ mechanism is not necessary for performance.
+
+ sunspider --squirrelfish reports no regression.
+
+ * ChangeLog:
+ * VM/Machine.cpp:
+ (KJS::Machine::execute):
+ (KJS::Machine::privateExecute):
+
+2008-04-09 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Next step toward re-entrant execution of function code (global code ->
+ built-in function -> JS function):
+
+ Made Machine::execute return a value.
+
+ Sketched out some code for Machine::execute for functions -- still
+ doesn't work yet, though.
+
+ sunspider --squirrelfish reports no regression.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::execute):
+ (KJS::Machine::privateExecute):
+ * VM/Machine.h:
+ * kjs/interpreter.cpp:
+ (KJS::Interpreter::evaluate):
+ * kjs/testkjs.cpp:
+ (runWithScripts):
+
+2008-04-09 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ First step toward re-entrant execution of function code (global code ->
+ built-in function -> JS function):
+
+ Tiny bit of refactoring in the Machine class.
+
+ sunspider --squirrelfish reports no regression.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::dumpRegisters):
+ (KJS::Machine::unwindCallFrame):
+ (KJS::Machine::execute):
+ (KJS::Machine::privateExecute):
+ * VM/Machine.h:
+ (KJS::Machine::isGlobalCallFrame):
+ * kjs/interpreter.cpp:
+ (KJS::Interpreter::evaluate):
+
+2008-04-08 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Support for re-entrant execution of global code (global code -> built-in
+ function -> global code).
+
+ Keep a stack of register files instead of just one. Globals propogate
+ between register files as the register files enter and exit the stack.
+
+ An activation still uses its own register file's base as its
+ registerBase, but the global object uses the register file *stack*'s
+ registerBase, which updates dynamically to match the register file at
+ the top of the stack.
+
+ sunspider --squirrelfish reports no regression.
+
+2008-04-08 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Geoff.
+
+ - initial preparatory work for JS constructors
+
+ 1) Allocate registers for the returnInfo block and "this" value when generating code for
+ op_construct. These are not used yet, but the JS branch of op_construct will use them.
+
+ 2) Adjust argc and argv appropriately for native constructor calls.
+
+ 3) Assign return value in a more straightforward way in op_ret since this is actually
+ a bit faster (and makes up for the allocation of extra registers above).
+
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::emitConstruct):
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+
+2008-04-07 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Fixed crashing SunSpider tests.
+
+ Let's just pretend this never happened, bokay?
+
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::CodeGenerator):
+ * VM/CodeGenerator.h:
+ * VM/RegisterFile.cpp:
+ (KJS::RegisterFile::addGlobals):
+
+2008-04-07 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Restored dumping of generated code as a command-line switch:
+ run-testkjs -d will do it.
+
+2008-04-07 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Next step toward supporting re-entrant evaluation: Moved register file
+ maintenance code into a proper "RegisterFile" class.
+
+ There's a subtle change to the register file's internal layout: for
+ global code / the global object, registerOffset is always 0 now. In
+ other words, all register counting starts at 0, not 0 + (number of
+ global variables). The helps simplify accounting when the number of
+ global variables changes.
+
+2008-04-07 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff.
+
+ Bug 18338: Support exceptions in SquirrelFish <http://bugs.webkit.org/show_bug.cgi?id=18338>
+
+ Initial support for exceptions in SquirrelFish, only supports finalisers in the
+ simple cases (eg. exceptions and non-goto/return across finaliser boundaries).
+ This doesn't add the required exception checks to existing code, it merely adds
+ support for throw, catch, and the required stack unwinding.
+
+ * VM/CodeBlock.cpp:
+ (KJS::CodeBlock::dump):
+ (KJS::CodeBlock::getHandlerForVPC):
+ * VM/CodeBlock.h:
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::emitCatch):
+ (KJS::CodeGenerator::emitThrow):
+ * VM/CodeGenerator.h:
+ * VM/JSPropertyNameIterator.cpp:
+ (KJS::JSPropertyNameIterator::create):
+ * VM/Machine.cpp:
+ (KJS::prepareException):
+ (KJS::Machine::unwindCallFrame):
+ (KJS::Machine::throwException):
+ (KJS::Machine::privateExecute):
+ * VM/Machine.h:
+ * VM/Opcode.h:
+ * kjs/nodes.cpp:
+ (KJS::ThrowNode::emitCode):
+ (KJS::TryNode::emitCode):
+ * kjs/nodes.h:
+ * kjs/scope_chain.cpp:
+ (KJS::ScopeChain::depth):
+ * kjs/scope_chain.h:
+
+2008-04-06 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ First step toward supporting re-entrant evaluation: Switch register
+ clients from using "registers", a pointer to a register vector, to
+ "registerBase", an indirect pointer to the logical first entry in the
+ register file. (The logical first entry is the first entry that is not
+ a global variable).
+
+ With a vector, offsets into the register file remain good when the
+ underlying buffer reallocates, but they go bad when the logical
+ first entry moves. (The logical first entry moves when new global
+ variables get added to the beginning of the register file.) With an
+ indirect pointer to the logical first entry, offsets will remain good
+ regardless.
+
+ 1.4% speedup on sunspider --squirrelfish. I suspect this is due to
+ reduced allocation when creating closures, and reduced indirection
+ through the register vector.
+
+ * wtf/Vector.h: Added an accessor for an indirect pointer to the vector's
+ buffer, which we currently use (incorrectly) for registerBase. This is
+ temporary scaffolding to allow us to change client code without
+ changing behavior.
+
+2008-04-06 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Oliver Hunt.
+
+ Implement codegen for ReadModifyDotNode.
+
+ * kjs/nodes.cpp:
+ (KJS::ReadModifyDotNode::emitCode):
+ * kjs/nodes.h:
+
+2008-04-06 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Oliver Hunt.
+
+ Fix codegen for PostIncDotNode and implement codegen for PostIncBracketNode,
+ PostDecBracketNode and PostDecDotNode.
+
+ * kjs/nodes.cpp:
+ (KJS::PostIncBracketNode::emitCode):
+ (KJS::PostDecBracketNode::emitCode):
+ (KJS::PostIncDotNode::emitCode):
+ (KJS::PostDecDotNode::emitCode):
+ * kjs/nodes.h:
+
+2008-04-06 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ Implement codegen for PreDecResolveNode, PreIncBracketNode, PreDecBracketNode,
+ PreIncDotNode and PreDecDotNode. This required adding one new op code, op_pre_dec.
+
+ * VM/CodeBlock.cpp:
+ (KJS::CodeBlock::dump):
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::emitPreDec):
+ * VM/CodeGenerator.h:
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+ * VM/Opcode.h:
+ * kjs/nodes.cpp:
+ (KJS::PreDecResolveNode::emitCode):
+ (KJS::PreIncBracketNode::emitCode):
+ (KJS::PreDecBracketNode::emitCode):
+ (KJS::PreIncDotNode::emitCode):
+ (KJS::PreDecDotNode::emitCode):
+ * kjs/nodes.h:
+
+2008-04-06 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Improved register dumping, plus a liberal smattering of "const". Here's
+ what the new format looks like:
+
+ (gdb) call (void)dumpCallFrame(codeBlock, scopeChain, registers->begin(), r)
+ 4 instructions; 48 bytes at 0x509210; 3 locals (2 parameters); 1 temporaries
+
+ [ 0] load lr1, undefined(@k0)
+ [ 3] load lr1, 2(@k1)
+ [ 6] add tr0, lr2, lr1
+ [ 10] ret tr0
+
+ Constants:
+ k0 = undefined
+ k1 = 2
+
+ Register frame:
+
+ ----------------------------------------
+ use | address | value
+ ----------------------------------------
+ [return info] | 0x80ac08 | 0x5081c0
+ [return info] | 0x80ac0c | 0x508e90
+ [return info] | 0x80ac10 | 0x504acc
+ [return info] | 0x80ac14 | 0x2
+ [return info] | 0x80ac18 | 0x0
+ [return info] | 0x80ac1c | 0x7
+ [return info] | 0x80ac20 | 0x0
+ ----------------------------------------
+ [param] | 0x80ac24 | 0x1
+ [param] | 0x80ac28 | 0x7
+ [var] | 0x80ac2c | 0xb
+ [temp] | 0x80ac30 | 0xf
+
+2008-04-06 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Support for evaluating multiple scripts in the same global environment.
+ (Still don't support re-entrant evaluation yet.)
+
+ The main changes here are:
+
+ (1) Obey the ECMA 10.1.3 rules regarding how to resolve collisions when
+ a given symbol is declared more than once. (This patch fixes the same
+ issue for function code, too.)
+
+ (2) In the case of var and/or function collisions, reuse the existing
+ storage slot. For global code, this is required for previously
+ generated instructions to continue to work. For function code, it's
+ more of a "nice to have": it makes register layout in the case of
+ collisions easier to understand, and has the added benefit of saving
+ memory.
+
+ (3) Allocate slots in the CodeGenerator's m_locals vector in parallel
+ to register indexes in the symbol table. This ensures that, given an
+ index in the symbol table, we can find the corresponding RegisterID
+ without hashing, which speeds up codegen.
+
+ I moved responsibility for emitting var and function initialization
+ instructions into the CodeGenerator, because bookkeeping in cases where
+ var, function, and/or parameter names collide requires a lot of
+ internal knowledge about the CodeGenerator.
+
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::addVar): Removed responsibility for checking whether
+ a var declaration overwrites "arguments", because the check is
+ inappropriate for global code, which may not have a pre-existing
+ "arguments" symbol in scope. Also changed this function to return a
+ boolean indicating whether addVar actually created a new RegisterID,
+ or just reused an old one.
+
+ (KJS::CodeGenerator::CodeGenerator): Split out the constructors for
+ function code and global code, since they're quite different now.
+
+ (KJS::CodeGenerator::registerForLocal): This function does its job
+ without any hashing now.
+
+ * VM/Machine.cpp: Move old globals and update "r" before executing a
+ new script. That way, old globals stay at a constant offset from "r",
+ and previously optimized code still works.
+
+ * VM/RegisterID.h: Added the ability to allocate a RegisterID before
+ initializing its index field. We use this for parameters now.
+
+ * kjs/JSVariableObject.h:
+ (KJS::JSVariableObject::symbolTableGet): Changed the ungettable getter
+ ASSERT to account for the fact that symbol indexes are all negative.
+
+2008-04-05 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ Implement codegen for InNode.
+
+ * VM/CodeBlock.cpp:
+ (KJS::CodeBlock::dump):
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::emitIn):
+ * VM/CodeGenerator.h:
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+ * VM/Opcode.h:
+ * kjs/nodes.cpp:
+ (KJS::InNode::emitCode):
+ * kjs/nodes.h:
+
+2008-04-05 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Oliver Hunt.
+
+ - Implement codegen for DeleteResolveNode, DeleteBracketNode, DeleteDotNode and DeleteValueNode.
+
+ * VM/CodeBlock.cpp:
+ (KJS::CodeBlock::dump):
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::emitGetPropId):
+ (KJS::CodeGenerator::emitPutPropId):
+ (KJS::CodeGenerator::emitDeletePropId):
+ (KJS::CodeGenerator::emitDeletePropVal):
+ (KJS::CodeGenerator::emitPutPropIndex):
+ * VM/CodeGenerator.h:
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+ * VM/Opcode.h:
+ * kjs/nodes.cpp:
+ (KJS::DeleteResolveNode::emitCode):
+ (KJS::DeleteBracketNode::emitCode):
+ (KJS::DeleteDotNode::emitCode):
+ (KJS::DeleteValueNode::emitCode):
+ * kjs/nodes.h:
+
+2008-04-04 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Oliver Hunt.
+
+ - Implement codegen for Switch statements.
+
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::pushJumpContext):
+ (KJS::CodeGenerator::popJumpContext):
+ (KJS::CodeGenerator::jumpContextForLabel):
+ * VM/CodeGenerator.h:
+ Rename LoopContext to JumpContext now that it used of Switch statements in addition
+ to loops.
+
+ * kjs/nodes.cpp:
+ (KJS::DoWhileNode::emitCode):
+ (KJS::WhileNode::emitCode):
+ (KJS::ForNode::emitCode):
+ (KJS::ForInNode::emitCode):
+ (KJS::ContinueNode::emitCode):
+ (KJS::BreakNode::emitCode):
+ (KJS::CaseBlockNode::emitCodeForBlock):
+ (KJS::SwitchNode::emitCode):
+ * kjs/nodes.h:
+ (KJS::CaseClauseNode::expr):
+ (KJS::CaseClauseNode::children):
+ (KJS::CaseBlockNode::):
+
+2008-04-03 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Sam.
+
+ - fix crash in codegen from new nodes
+
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::emitConstruct):
+ * kjs/nodes.h:
+
+2008-04-03 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Geoff.
+
+ * kjs/nodes.cpp:
+ (KJS::ReadModifyResolveNode::emitCode):
+ (KJS::ReadModifyBracketNode::emitCode):
+ * kjs/nodes.h:
+
+2008-04-02 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Geoff.
+
+ - take a shot at marking constant pools for global and eval code
+
+ Geoff says this won't really work in all cases but is an ok stopgap.
+
+ * kjs/JSGlobalObject.cpp:
+ (KJS::JSGlobalObject::mark):
+
+2008-04-02 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Geoff.
+
+ - fix 2x perf regression in 3d-morph
+
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute): If we subbed in null for the global object,
+ don't toObject it, since that will throw an exception (very slowly).
+
+2008-04-02 Maciej Stachowiak <mjs@apple.com>
+
+ Rubber stamped by Geoff
+
+ - fix Release build
+
+ * kjs/nodes.cpp:
+ (KJS::getNonLocalSymbol):
+
+2008-04-02 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Removed the last vestiges of LocalStorage from JSVariableObject and
+ JSGlobalObject.
+
+ * kjs/JSGlobalObject.cpp:
+ (KJS::JSGlobalObject::saveLocalStorage): Save and restore from/to
+ registers. Use stub isReadOnly and isDontEnum methods for now, until
+ we really implement attributes in the symbol table.
+ (KJS::JSGlobalObject::restoreLocalStorage):
+ (KJS::JSGlobalObject::reset):
+
+ * kjs/JSVariableObject.cpp:
+ (KJS::JSVariableObject::getPropertyNames): Use stub isDontEnum method
+ for now, as above.
+ (KJS::JSVariableObject::getPropertyAttributes): ditto
+
+ * kjs/JSVariableObject.h: Removed LocalStorage from JSVariableObjectData.
+ Removed mark method, because subclasses implement different strategies for
+ marking registers.
+ (KJS::JSVariableObject::isReadOnly): Stub method
+ (KJS::JSVariableObject::isDontEnum): ditto
+
+ Changed the code below to ASSERT_NOT_REACHED() and return 0, since it
+ can no longer retrieve LocalStorage from the ExecState. (Eventually,
+ we'll just remove this code and all its friends, but that's a task for
+ later.)
+
+ * kjs/ExecState.cpp:
+ (KJS::ExecState::ExecState):
+ * kjs/function.cpp:
+ (KJS::ActivationImp::markChildren):
+ * kjs/function.h:
+ * kjs/nodes.cpp:
+ (KJS::getNonLocalSymbol):
+ (KJS::ScopeNode::optimizeVariableAccess):
+ (KJS::ProgramNode::processDeclarations):
+
+2008-04-01 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Got globals?
+
+ To get things working, I had to roll out
+ http://trac.webkit.org/projects/webkit/changeset/31226 for the time
+ being.
+
+ * VM/CodeBlock.h: Removed obsolete function.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute): For the sake of re-entrancy, we track
+ and restore the global object's old rOffset value. (No way to test this
+ yet, but I think it will work.)
+
+2008-04-01 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Geoff.
+
+ - mark the constant pool (at least for function code blocks)
+
+ * VM/CodeBlock.cpp:
+ (KJS::CodeBlock::mark):
+ * VM/CodeBlock.h:
+ * kjs/function.cpp:
+ (KJS::FunctionImp::mark):
+ * kjs/nodes.cpp:
+ (KJS::ScopeNode::mark):
+ * kjs/nodes.h:
+ (KJS::FuncExprNode::body):
+ (KJS::FuncDeclNode::body):
+
+2008-04-01 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Beth Dakin.
+
+ Cleaned up a few loose ends.
+
+ * JavaScriptCore.exp: Export dumpRegisters, so it's visible to gdb even
+ if we don't explicitly call it in the source text.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute): No need to call dumpRegisters anymore,
+ since that was just a hack for gdb's sake.
+
+ * kjs/JSActivation.h: Removed obsolete comment.
+
+ * VM/CodeGenerator.cpp: Added ASSERTs to verify that the localCount
+ we're given matches the number of locals actually allocated.
+
+ * VM/CodeGenerator.h:
+ (KJS::CodeGenerator::CodeGenerator): Changed "localCount" to include
+ the parameter count, since we're using the word "local" to mean
+ parameter, var, function, or "this". Renamed "m_nextLocal" to
+ "m_nextVar", since "m_nextLocal" doesn't contrast well with
+ "m_nextParameter".
+
+ Also moved tracking of implicit "this" parameter from here...
+
+ * kjs/nodes.cpp:
+ (KJS::FunctionBodyNode::generateCode): ... to here
+ (KJS::ProgramNode::generateCode): ... and here
+
+ * VM/CodeBlock.cpp:
+ (KJS::CodeBlock::dump): Added missing "\n".
+
+2008-04-01 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Oliver.
+
+ Bug 18274: ResolveNode::emitCode() doesn't make a new temporary when dst
+ is 0, leading to incorrect codegen
+ <http://bugs.webkit.org/show_bug.cgi?id=18274>
+
+ * kjs/nodes.cpp:
+ (KJS::FunctionCallBracketNode::emitCode):
+ (KJS::FunctionCallDotNode::emitCode):
+
+2008-04-01 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver.
+
+ - fix bug in for..in codegen (gotta use ident, not m_ident)
+
+ * kjs/nodes.cpp:
+ (KJS::ForInNode::emitCode):
+
+2008-04-01 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver.
+
+ - Add suport for regexp literals
+
+ * VM/CodeBlock.cpp:
+ (KJS::regexpToSourceString):
+ (KJS::regexpName):
+ (KJS::CodeBlock::dump):
+ * VM/CodeBlock.h:
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::addRegExp):
+ (KJS::CodeGenerator::emitNewRegExp):
+ * VM/CodeGenerator.h:
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+ * VM/Opcode.h:
+ * kjs/nodes.cpp:
+ (KJS::RegExpNode::emitCode):
+ * kjs/nodes.h:
+
+2008-04-01 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff
+
+ Add support for for..in nodes
+
+ Added two new opcodes to get_pnames and next_pname to handle iterating
+ over the set of properties on an object. This iterator is explicitly
+ invalidated and the property name array is released on standard exit
+ from the loop, otherwise we rely on GC to do the clean up for us.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * VM/CodeBlock.cpp:
+ (KJS::CodeBlock::dump):
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::emitNextPropertyName):
+ (KJS::CodeGenerator::emitGetPropertyNames):
+ * VM/CodeGenerator.h:
+ * VM/JSPropertyNameIterator.cpp: Added.
+ (KJS::JSPropertyNameIterator::JSPropertyNameIterator):
+ (KJS::JSPropertyNameIterator::type):
+ (KJS::JSPropertyNameIterator::toPrimitive):
+ (KJS::JSPropertyNameIterator::getPrimitiveNumber):
+ (KJS::JSPropertyNameIterator::toBoolean):
+ (KJS::JSPropertyNameIterator::toNumber):
+ (KJS::JSPropertyNameIterator::toString):
+ (KJS::JSPropertyNameIterator::toObject):
+ (KJS::JSPropertyNameIterator::mark):
+ (KJS::JSPropertyNameIterator::next):
+ (KJS::JSPropertyNameIterator::invalidate):
+ (KJS::JSPropertyNameIterator::~JSPropertyNameIterator):
+ (KJS::JSPropertyNameIterator::create):
+ * VM/JSPropertyNameIterator.h: Added.
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+ * VM/Opcode.h:
+ * VM/Register.h:
+ (KJS::Register::):
+ * kjs/PropertyNameArray.h:
+ * kjs/nodes.cpp:
+ (KJS::ForInNode::emitCode):
+ * kjs/nodes.h:
+ * kjs/value.h:
+
+2008-04-01 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Maciej.
+
+ Change CodeGenerator::emitCall() so it increments the reference count of
+ registers passed to it, and change its callers so they don't needlessly
+ increment the reference count of the registers they are passing.
+
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::emitCall):
+ * kjs/nodes.cpp:
+ (KJS::FunctionCallResolveNode::emitCode):
+ (KJS::FunctionCallDotNode::emitCode):
+
+2008-04-01 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver.
+
+ - generate call for PostIncDotNode
+
+ * kjs/nodes.cpp:
+ (KJS::PostIncDotNode::emitCode):
+ * kjs/nodes.h:
+
+2008-04-01 Maciej Stachowiak <mjs@apple.com>
+
+ Build fix.
+
+ - fix build (not sure how this ever worked?)
+
+ * kjs/nodes.cpp:
+ (KJS::FunctionCallBracketNode::emitCode):
+
+2008-04-01 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Geoff.
+
+ - generate code for FunctionCallBracketNode
+
+ * kjs/nodes.cpp:
+ (KJS::FunctionCallBracketNode::emitCode):
+ * kjs/nodes.h:
+
+2008-04-01 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Geoff.
+
+ - Fix two crashing SunSpider tests
+
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute): set up 'this' properly for native calls.
+ * kjs/list.h:
+ (KJS::List::List): Fix intialization of buffer and size from
+ vector, the initialization order was wrong.
+
+2008-04-01 Geoffrey Garen <ggaren@apple.com>
+
+ Build fix: marked ASSERT-only variables as UNUSED_PARAMs.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+ * kjs/JSVariableObject.h:
+ (KJS::JSVariableObject::symbolTableInitializeVariable):
+
+2008-04-01 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Next step toward global code: Moved get, put, and initializeVariable
+ functionality up into JSVariableObject, and changed JSActivation to
+ rely on it.
+
+ * kjs/JSActivation.cpp:
+ (KJS::JSActivation::JSActivation):
+ (KJS::JSActivation::getOwnPropertySlot):
+ (KJS::JSActivation::put):
+ (KJS::JSActivation::initializeVariable):
+ * kjs/JSVariableObject.h:
+ (KJS::JSVariableObject::valueAt):
+ (KJS::JSVariableObject::isReadOnly):
+ (KJS::JSVariableObject::symbolTableGet):
+ (KJS::JSVariableObject::symbolTablePut):
+ (KJS::JSVariableObject::symbolTableInitializeVariable):
+
+2008-04-01 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Sam.
+
+ - fix HashTable assertion on some SunSpider tests
+
+ Don't use -1 as the deleted value for JSValue*-keyed hashtables,
+ since it is a valid value (it's the immediate for -1).
+
+ * VM/CodeGenerator.h:
+ (KJS::CodeGenerator::JSValueHashTraits::emptyValue):
+ (KJS::CodeGenerator::JSValueHashTraits::deletedValue):
+ * kjs/JSImmediate.h:
+ (KJS::JSImmediate::impossibleValue):
+
+2008-04-01 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Maciej Stachowiak.
+
+ Add support for calling Native constructors like new Array().
+
+ * VM/CodeBlock.cpp:
+ (KJS::CodeBlock::dump):
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::emitConstruct):
+ * VM/CodeGenerator.h:
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+ * VM/Opcode.h:
+ * kjs/nodes.cpp:
+ (KJS::NewExprNode::emitCode):
+ * kjs/nodes.h:
+
+2008-04-01 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Sam.
+
+ - add some missing toOpbject calls to avoid crashing when calling methods on primitives
+
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+
+2008-04-01 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Changed Machine::dumpRegisters to take a pointer instead of a reference,
+ so gdb understands how to call it.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::dumpRegisters):
+ (KJS::Machine::privateExecute):
+ * VM/Machine.h:
+
+2008-03-31 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Maciej.
+
+ Fix CodeGenerator::addConstant() so it uses the functionExpressions
+ counter for function expressions, not the functions counter.
+
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::addConstant):
+
+2008-03-31 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ Add emitCode support for TypeOfResolveNode and TypeOfValueNode.
+ Added new opcode op_type_of to handle them.
+
+ * VM/CodeBlock.cpp:
+ (KJS::CodeBlock::dump):
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::emitNot):
+ (KJS::CodeGenerator::emitInstanceOf):
+ (KJS::CodeGenerator::emitTypeOf):
+ * VM/CodeGenerator.h:
+ * VM/Machine.cpp:
+ (KJS::jsTypeStringForValue):
+ (KJS::Machine::privateExecute):
+ * VM/Opcode.h:
+ * kjs/nodes.cpp:
+ (KJS::TypeOfResolveNode::emitCode):
+ (KJS::TypeOfValueNode::emitCode):
+ * kjs/nodes.h:
+
+2008-03-31 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Oliver Hunt.
+
+ Fix non-computed goto version of isOpcode. op_end is a valid opcode.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::isOpcode):
+
+2008-03-31 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Added op_post_dec.
+
+2008-03-31 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Geoffrey Garen.
+
+ Add support for FunctionCallDotNode.
+
+ * kjs/nodes.cpp:
+ (KJS::FunctionCallDotNode::emitCode):
+ * kjs/nodes.h:
+
+2008-03-31 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Beth Dakin.
+
+ Next step toward global code: Removed more obsolete API, moved
+ saveLocalStorage and restoreLocalStorage to JSGlobalObject subclass,
+ since it's only intended for use there.
+
+ * ChangeLog:
+ * JavaScriptCore.exp:
+ * kjs/Activation.h:
+ * kjs/JSGlobalObject.cpp:
+ (KJS::JSGlobalObject::saveLocalStorage):
+ (KJS::JSGlobalObject::restoreLocalStorage):
+ * kjs/JSGlobalObject.h:
+ * kjs/JSVariableObject.cpp:
+ * kjs/JSVariableObject.h:
+ (KJS::JSVariableObject::JSVariableObjectData::JSVariableObjectData):
+ * kjs/function.cpp:
+ (KJS::ActivationImp::ActivationImp):
+
+2008-03-31 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Beth Dakin.
+
+ Next step toward global code: subclass JSActivation + JSActivationData
+ from JSVariableObject + JSVariableObjectData.
+
+ JSActivation now relies on JSVariableObject for access to registers and
+ symbol table, and for some delete functionality, but not for anything
+ else yet.
+
+ (KJS::JSActivation::mark): Cleaned up the style here a little bit.
+
+2008-03-31 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Beth Dakin.
+
+ Next step toward global code: store "rOffset" in JSVariableObjectData.
+
+ * kjs/JSGlobalObject.h:
+ (KJS::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData):
+ * kjs/JSVariableObject.h:
+ (KJS::JSVariableObject::JSVariableObjectData::JSVariableObjectData):
+
+2008-03-31 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Next steps toward global code:
+
+ * Moved access to the register file into JSVariableObject.
+
+ * Added more ASSERTs to indicate obsolete APIs there are just hanging
+ around to stave off build failures.
+
+ * kjs/JSGlobalObject.h:
+ (KJS::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData):
+ * kjs/JSVariableObject.h:
+ (KJS::JSVariableObject::registers):
+ (KJS::JSVariableObject::JSVariableObjectData::JSVariableObjectData):
+ (KJS::JSVariableObject::JSVariableObject):
+
+2008-03-31 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Oliver. Tweaked somewhat by Maciej.
+
+ - implement codegen for ReadModifyResolveNode
+
+ * kjs/nodes.cpp:
+ (KJS::emitReadModifyAssignment):
+ (KJS::ReadModifyResolveNode::emitCode):
+ * kjs/nodes.h:
+
+2008-03-31 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Geoff.
+
+ Fix the build -- r31492 removed activation tear-off, but r31493 used it.
+
+ * kjs/nodes.cpp:
+ (KJS::FuncExprNode::makeFunction):
+
+2008-03-31 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Maciej.
+
+ Add support for FuncExprNode to SquirrelFish.
+
+ * VM/CodeBlock.cpp:
+ (KJS::CodeBlock::dump):
+ * VM/CodeBlock.h:
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::addConstant):
+ (KJS::CodeGenerator::emitNewFunctionExpression):
+ * VM/CodeGenerator.h:
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+ * VM/Opcode.h:
+ * kjs/nodes.cpp:
+ (KJS::FuncExprNode::emitCode):
+ (KJS::FuncExprNode::makeFunction):
+ * kjs/nodes.h:
+
+2008-03-31 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ First step toward global code: removed some obsolete JSGlobalObject
+ APIs, changing clients to ASSERT_NOT_REACHED.
+
+ Activation tear-off and scope chain pushing is obsolete because we
+ statically detect whether an activation + scope node is required.
+
+ The variableObject() and activationObject() accessors are obsolete
+ because they haven't been maintained, and they're mostly used by
+ node evaluation code, anyway.
+
+ The localStorage() accessor is obsolete because everything is in
+ registers now, and it's mostly used by node evaluation code, anyway.
+
+2008-03-31 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin.
+
+ - implement codegen for bracket accessor and bracket assign
+
+ * VM/CodeBlock.cpp:
+ (KJS::CodeBlock::dump):
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::emitGetPropVal):
+ (KJS::CodeGenerator::emitPutPropVal):
+ * VM/CodeGenerator.h:
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+ * VM/Opcode.h:
+ * kjs/nodes.cpp:
+ (KJS::BracketAccessorNode::emitCode):
+ (KJS::AssignBracketNode::emitCode):
+ * kjs/nodes.h:
+
+2008-03-31 Geoffrey Garen <ggaren@apple.com>
+
+ Not reviewed.
+
+ Removed FIXME that I just fixed.
+
+ Added ASSERT to cover an error previously only covered by a FIXME.
+
+ * kjs/JSActivation.cpp:
+ (KJS::JSActivation::getOwnPropertySlot):
+
+2008-03-31 Geoffrey Garen <ggaren@apple.com>
+
+ Not reviewed.
+
+ Fixed indentation inside op_call. (I had left this code badly indented
+ to make the behavior-changing diff clearer.)
+
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+
+2008-03-31 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Fixed up logging of jump instructions to follow the following style:
+
+ jump offset(->absoluteTarget)
+
+ * VM/CodeBlock.cpp:
+ (KJS::CodeBlock::dump):
+
+2008-03-31 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Changed the SymbolTable API to use int instead of size_t. It has been
+ using int internally for a while now (since squirrelfish symbols can
+ have negative indices).
+
+2008-03-31 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Maciej.
+
+ Add support for FunctionCallValueNode.
+
+ * kjs/nodes.cpp:
+ (KJS::FunctionCallValueNode::emitCode):
+ * kjs/nodes.h:
+
+2008-03-31 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver.
+
+ 1) Implemented array literals
+
+ 2) Renamed op_object_get and op_object_put to op_get_prop_id and
+ op_put_prop_id in preparation for new variants.
+
+ * VM/CodeBlock.cpp:
+ (KJS::CodeBlock::dump):
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::emitNewArray):
+ (KJS::CodeGenerator::emitGetPropId):
+ (KJS::CodeGenerator::emitPutPropId):
+ (KJS::CodeGenerator::emitPutPropIndex):
+ * VM/CodeGenerator.h:
+ (KJS::CodeGenerator::CodeGenerator):
+ (KJS::CodeGenerator::propertyNames):
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+ * VM/Opcode.h:
+ * kjs/nodes.cpp:
+ (KJS::ArrayNode::emitCode):
+ (KJS::PropertyListNode::emitCode):
+ (KJS::DotAccessorNode::emitCode):
+ (KJS::PostIncResolveNode::emitCode):
+ (KJS::PreIncResolveNode::emitCode):
+ (KJS::AssignResolveNode::emitCode):
+ (KJS::AssignDotNode::emitCode):
+ * kjs/nodes.h:
+
+2008-03-30 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Implemented native function calls. (Re-entering from native code back
+ to JS doesn't work yet, though.)
+
+ 0.2% speedup overall, due to some inlining tweaks. 3.6% regression on
+ function-empty.js, since we're making a new virtual call and taking a
+ new branch inside every op_call.
+
+ I adjusted the JavaScriptCore calling convention to minimize overhead,
+ like so:
+
+ The machine calls a single virtual function, "getCallData", to get all
+ the data it needs for a function call. Native code still uses the old
+ "isObject()" check followed by an "implementsCall()" check, which
+ aliases to "getCallData". (We can optimize native code to use getCallData
+ at our leisure.)
+
+ To supply a list of arguments, the machine calls a new List constructor
+ that just takes a pointer and a length, without copying. Native code
+ still appends to the list one argument at a time. (We can optimize
+ native code to use the new List constructor at our leisure.)
+
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute): Changed resize() call to grow() call,
+ to encourage the compiler to inline the Vector code.
+
+ * kjs/CallData.h: Added.
+ (KJS::): CallData is a union because eventually native calls will stuff
+ a function pointer into it, to eliminate the callAsFunction virtual call.
+
+ * kjs/function.cpp:
+ (KJS::FunctionImp::callAsFunction): Changed this to an ASSERT since
+ it's not implemented yet.
+
+ * kjs/list.h: Made the List class two-faced, to support the old way and
+ the new way during this transition phase: lists can be made read-only
+ with just a pointer and a legnth, or you can append to them one item
+ at a time.
+
+ * kjs/value.h:
+ (KJS::jsUndefined): Marked this function ALWAYS_INLINE for the benefit
+ of a certain compiler that doesn't know what's best for it.
+
+2008-03-30 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver.
+
+ Dump code that codegen can't handle yet, so it's easier to prioritize missing nodes.
+
+ * kjs/nodes.h:
+ (KJS::Node::emitCode):
+
+2008-03-30 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver.
+
+ Improve dumping of bytecode and fix coding style accordingly.
+
+ Registers are printed as lr1 for locals, tr1 for temp registers. Identifiers print as
+ foobar(@id0) and constants print as "foo"(@k1) or 312.4(@k2) or the like. Constant and
+ identifier tables are dumped for reference.
+
+ * VM/CodeBlock.cpp:
+ (KJS::escapeQuotes):
+ (KJS::valueToSourceString):
+ (KJS::registerName):
+ (KJS::constantName):
+ (KJS::idName):
+ (KJS::printUnaryOp):
+ (KJS::printBinaryOp):
+ (KJS::CodeBlock::dump):
+ * VM/Machine.cpp:
+ (KJS::resolve):
+ (KJS::resolveBase):
+ (KJS::Machine::privateExecute):
+
+2008-03-30 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver.
+
+ Implement StringNode and VoidNode (both pretty trivial).
+
+ * kjs/nodes.cpp:
+ (KJS::StringNode::emitCode):
+ (KJS::VoidNode::emitCode):
+ * kjs/nodes.h:
+
+2008-03-30 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Sam.
+
+ Implement CommaNode.
+
+ * kjs/nodes.cpp:
+ (KJS::CommaNode::emitCode):
+ * kjs/nodes.h:
+
+2008-03-30 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Maciej.
+
+ Adds support for dot notation and object literals.
+
+ * VM/CodeBlock.cpp:
+ (KJS::CodeBlock::dump):
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::emitNewObject):
+ * VM/CodeGenerator.h:
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+ * VM/Opcode.h:
+ * kjs/nodes.cpp:
+ (KJS::ObjectLiteralNode::emitCode):
+ (KJS::PropertyListNode::emitCode):
+ (KJS::DotAccessorNode::emitCode):
+ (KJS::AssignDotNode::emitCode):
+ * kjs/nodes.h:
+
+2008-03-29 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Mark the register file.
+
+ It's a conservative mark for now, but once registers are typed, we can
+ do an exact mark.
+
+ 1.4% regression regardless of whether we actually do the marking.
+ GCC is is worth every penny.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute): Most of the changes here are just for
+ the fact that "registers" is a pointer now.
+
+ * kjs/JSGlobalObject.cpp: The global object owns the register file now.
+
+2008-03-28 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej.
+
+ Bug 18204: SquirrelFish: continue/break do not correctly handle scope popping
+ <http://bugs.webkit.org/show_bug.cgi?id=18204>
+
+ We now track the scope depth as part of a loop context, and add an
+ extra instruction op_jump_scopes that is used to perform a jump across
+ dynamic scope boundaries.
+
+ * VM/CodeBlock.cpp:
+ (KJS::CodeBlock::dump):
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::emitJumpScopes):
+ * VM/CodeGenerator.h:
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+ * VM/Opcode.h:
+ * kjs/nodes.cpp:
+ (KJS::ContinueNode::emitCode):
+ (KJS::BreakNode::emitCode):
+
+2008-03-28 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ Add emitCode support for ConditionalNode.
+
+ * kjs/nodes.cpp:
+ (KJS::ConditionalNode::emitCode):
+ * kjs/nodes.h:
+
+2008-03-28 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Responding to feedback, added some comments, fixed up a few names, and
+ clarified that "locals" always means all local variables, functions,
+ and parameters.
+
+2008-03-28 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Added support for "this".
+
+ Supply an implicit "this" value as the first argument to every function.
+ Alias the "this" keyword to that argument.
+
+ 1% regression overall, 2.5% regression on empty function calls. Seems
+ like a reasonable cost for now, since we're doing more work.
+ (Eventually, we might decide to create a version of op_call specialized
+ for a known null "this" value.)
+
+ * VM/CodeBlock.cpp:
+ (KJS::CodeBlock::dump):
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::emitCall):
+ * VM/CodeGenerator.h:
+ (KJS::CodeGenerator::CodeGenerator):
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+ * kjs/CommonIdentifiers.cpp:
+ (KJS::CommonIdentifiers::CommonIdentifiers):
+ * kjs/CommonIdentifiers.h:
+ * kjs/nodes.cpp:
+ (KJS::ThisNode::emitCode):
+ (KJS::FunctionCallResolveNode::emitCode):
+ * kjs/nodes.h:
+
+2008-03-28 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff.
+
+ Bug 18192: Squirrelfish needs support for break and continue
+ <http://bugs.webkit.org/show_bug.cgi?id=18192>
+
+ Added a loop context stack to the code generator to provide the
+ correct jump labels for continue and goto. Added logic to the
+ currently implemented loop constructs to manage entry and exit
+ from the loop contexts. Finally, implemented codegen for break
+ and continue (and a pass through for LabelNode)
+
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::pushLoopContext):
+ (KJS::CodeGenerator::popLoopContext):
+ (KJS::CodeGenerator::loopContextForIdentifier):
+ (KJS::CodeGenerator::labelForContinue):
+ (KJS::CodeGenerator::labelForBreak):
+ * VM/CodeGenerator.h:
+ * kjs/nodes.cpp:
+ (KJS::DoWhileNode::emitCode):
+ (KJS::WhileNode::emitCode):
+ (KJS::ForNode::emitCode):
+ (KJS::ContinueNode::emitCode):
+ (KJS::BreakNode::emitCode):
+ (KJS::LabelNode::emitCode):
+ * kjs/nodes.h:
+
+2008-03-27 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ Add emitCode support for UnaryPlusNode, NegateNode, BitwiseNotNode and LogicalNotNode.
+
+ * VM/CodeBlock.cpp:
+ (KJS::printUnaryOp):
+ (KJS::CodeBlock::dump):
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::emitToJSNumber):
+ (KJS::CodeGenerator::emitNegate):
+ (KJS::CodeGenerator::emitBitNot):
+ (KJS::CodeGenerator::emitNot):
+ * VM/CodeGenerator.h:
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+ * VM/Opcode.h:
+ * kjs/nodes.cpp:
+ (KJS::UnaryPlusNode::emitCode):
+ (KJS::NegateNode::emitCode):
+ (KJS::BitwiseNotNode::emitCode):
+ (KJS::LogicalNotNode::emitCode):
+ * kjs/nodes.h:
+
+2008-03-27 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Maciej Stachowiak.
+
+ Add support for LogicalAndNode and LogicalOrNode.
+
+ * kjs/nodes.cpp:
+ (KJS::LogicalAndNode::emitCode):
+ (KJS::LogicalOrNode::emitCode):
+ * kjs/nodes.h:
+
+2008-03-27 Sam Weinig <sam@webkit.org>
+
+ Clean up code and debug output.
+
+ * VM/CodeBlock.cpp:
+ (KJS::CodeBlock::dump):
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+
+2008-03-27 Geoffrey Garen <ggaren@apple.com>
+
+ Moved an ASSERT to a more logical place.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+
+2008-03-27 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Oliver Hunt.
+
+ Add emitCode support for InstanceOfNode.
+
+ * VM/CodeBlock.cpp:
+ (KJS::CodeBlock::dump):
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::emitInstanceOf):
+ * VM/CodeGenerator.h:
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+ * VM/Opcode.h:
+ * kjs/nodes.cpp:
+ (KJS::InstanceOfNode::emitCode):
+ * kjs/nodes.h:
+
+2008-03-27 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej.
+
+ Bug 18142: squirrelfish needs to support dynamic scoping/with
+ <http://bugs.webkit.org/show_bug.cgi?id=18142>
+
+ Add support for dynamic scoping and add code to handle 'with'
+ statements.
+
+ * VM/CodeBlock.cpp:
+ (KJS::CodeBlock::dump):
+ * VM/CodeBlock.h:
+ (KJS::CodeBlock::CodeBlock):
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::getRegister):
+ (KJS::CodeGenerator::emitPushScope):
+ (KJS::CodeGenerator::emitPopScope):
+ * VM/CodeGenerator.h:
+ (KJS::CodeGenerator::CodeGenerator):
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+ * VM/Opcode.h:
+ * kjs/nodes.cpp:
+ (KJS::WithNode::emitCode):
+ * kjs/nodes.h:
+
+2008-03-27 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ Add emitCode support for NullNode, FalseNode, TrueNode, IfNode, IfElseNode, DoWhileNode and WhileNode
+
+ * VM/CodeBlock.cpp:
+ (KJS::CodeBlock::dump): Dump op_jfalse opcode.
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::emitJumpIfFalse): Identical to emitJumpIfTrue except it emits the op_jfalse opcode.
+ (KJS::CodeGenerator::emitLoad): Add and emitLoad override for booleans.
+ * VM/CodeGenerator.h:
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute): Adds execution of op_jfalse. It is identical to op_jtrue, except the
+ the condition is reversed.
+ * VM/Opcode.h: Add op_jfalse.
+ * kjs/nodes.cpp:
+ (KJS::NullNode::emitCode): Added.
+ (KJS::FalseNode::emitCode): Added.
+ (KJS::TrueNode::emitCode): Added.
+ (KJS::IfNode::emitCode): Added.
+ (KJS::IfElseNode::emitCode): Added.
+ (KJS::DoWhileNode::emitCode): Added.
+ (KJS::WhileNode::emitCode): Added.
+ * kjs/nodes.h:
+
+2008-03-26 Geoffrey Garen <ggaren@apple.com>
+
+ Nixed an unused List.
+
+ The calm before my stormy war against the List class.
+
+ * kjs/function_object.cpp:
+ (KJS::FunctionObjectImp::construct):
+
+2008-03-26 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Geoffrey Garen.
+
+ Adds support for EqualNode, NotEqualNode, StrictEqualNode, NotStrictEqualNode,
+ LessEqNode, GreaterNode, GreaterEqNode, MultNode, DivNode, ModNode, SubNode,
+ LeftShiftNode, RightShiftNode, UnsignedRightShiftNode, BitAndNode, BitXOrNode,
+ and BitOrNode.
+
+ * VM/CodeBlock.cpp:
+ (KJS::CodeBlock::dump):
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::emitEqual):
+ (KJS::CodeGenerator::emitNotEqual):
+ (KJS::CodeGenerator::emitStrictEqual):
+ (KJS::CodeGenerator::emitNotStrictEqual):
+ (KJS::CodeGenerator::emitLessEq):
+ (KJS::CodeGenerator::emitMult):
+ (KJS::CodeGenerator::emitDiv):
+ (KJS::CodeGenerator::emitMod):
+ (KJS::CodeGenerator::emitSub):
+ (KJS::CodeGenerator::emitLeftShift):
+ (KJS::CodeGenerator::emitRightShift):
+ (KJS::CodeGenerator::emitUnsignedRightShift):
+ (KJS::CodeGenerator::emitBitAnd):
+ (KJS::CodeGenerator::emitBitXOr):
+ (KJS::CodeGenerator::emitBitOr):
+ * VM/CodeGenerator.h:
+ * VM/Machine.cpp:
+ (KJS::jsLessEq):
+ (KJS::Machine::privateExecute):
+ * VM/Opcode.h:
+ * kjs/nodes.cpp:
+ (KJS::MultNode::emitCode):
+ (KJS::DivNode::emitCode):
+ (KJS::ModNode::emitCode):
+ (KJS::SubNode::emitCode):
+ (KJS::LeftShiftNode::emitCode):
+ (KJS::RightShiftNode::emitCode):
+ (KJS::UnsignedRightShiftNode::emitCode):
+ (KJS::GreaterNode::emitCode):
+ (KJS::LessEqNode::emitCode):
+ (KJS::GreaterEqNode::emitCode):
+ (KJS::EqualNode::emitCode):
+ (KJS::NotEqualNode::emitCode):
+ (KJS::StrictEqualNode::emitCode):
+ (KJS::NotStrictEqualNode::emitCode):
+ (KJS::BitAndNode::emitCode):
+ (KJS::BitXOrNode::emitCode):
+ (KJS::BitOrNode::emitCode):
+ * kjs/nodes.h:
+
+2008-03-26 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Only print debug dumps in debug builds.
+
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::generate):
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+
+2008-03-26 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Moved a few files around in the XCode project.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2008-03-26 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Made closures work.
+
+ An activation object aliases to the register file until its associated
+ function returns, at which point it copies the registers for locals and
+ parameters into an independent storage buffer.
+
+2008-03-24 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Fixed recent 25% regression on simple for loop test. GCC seems to be
+ very finicky about the code that gets inlined into
+ Machine::privateExecute.
+
+ Everything in this patch is simply the result of experiment.
+
+ The resolve and resolve_base opcodes do not seem to have gotten slower
+ from this change.
+
+ * VM/Machine.cpp:
+ (KJS::resolve):
+ (KJS::resolveBase):
+ (KJS::Machine::privateExecute):
+ * kjs/nodes.h:
+
+2008-03-24 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Bug 18059: squirrelfish needs to compile on platforms without computed goto
+ <http://bugs.webkit.org/show_bug.cgi?id=18059>
+
+ "Standard" macro style support for conditionalising the use of computed goto.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * VM/Machine.cpp:
+ (KJS::Machine::isOpcode):
+ (KJS::Machine::privateExecute):
+ * VM/Machine.h:
+ (KJS::Machine::getOpcode):
+ (KJS::Machine::getOpcodeID):
+ * VM/Opcode.h:
+ * wtf/Platform.h:
+
+2008-03-24 Geoffrey Garen <ggaren@apple.com>
+
+ Moved my notes from nodes.h to the wiki.
+
+ * kjs/nodes.h:
+
+2008-03-24 Geoffrey Garen <ggaren@apple.com>
+
+ SquirrelFish lives.
+
+ Initial check-in of the code I've been carrying around. Lots of stuff
+ doesn't work. Plus a bunch of empty files.
+
+=== Start merge of squirrelfish ===
+
+2008-05-21 Darin Adler <darin@apple.com>
+
+ - try to fix the Windows build
+
+ * profiler/Profiler.cpp:
+ (KJS::Profiler::stopProfiling): Use ptrdiff_t instead of the less-common but incredibly
+ similar ssize_t type.
+ * wtf/AVLTree.h:
+ (KJS::AVLTree::search): Added a typename for a dependent name that's a type.
+
+2008-05-21 Darin Adler <darin@apple.com>
+
+ Reviewed by Anders.
+
+ - fix <rdar://problem/5952721> bug in JavaScript arguments object property lookup
+
+ Test: fast/js/arguments-bad-index.html
+
+ * kjs/function.cpp:
+ (KJS::IndexToNameMap::IndexToNameMap): Use unsigned instead of int.
+ (KJS::IndexToNameMap::isMapped): Use unsigned instead of int, and also use the
+ strict version of the numeric conversion function, since we don't want to allow
+ trailing junk.
+ (KJS::IndexToNameMap::unMap): Ditto.
+ (KJS::IndexToNameMap::operator[]): Ditto.
+ * kjs/function.h: Changed IndexToNameMap::size type from int to unsigned.
+
+2008-05-21 Timothy Hatcher <timothy@apple.com>
+
+ Change the Profiler to allow multiple profiles to be running at
+ the same time. This can happen when you have nested console.profile()
+ calls. This required two changes. First, the Profiler needed to keep a
+ Vector of current profiles, instead of one. Second, a Profile needs
+ to keep track of the global ExecState it started in and the page group
+ identifier it is tracking.
+
+ The stopProfiling call now takes the same arguments as startProfiling.
+ This makes sure the correct profile is stopped. Passing a null UString
+ as the title will stop the last profile for the matching ExecState.
+
+ <rdar://problem/5951559> Multiple pages profiling can interfere with each other
+
+ Reviewed by Kevin McCullough.
+
+ * JavaScriptCore.exp: Added new exports. Removed old symbols.
+ * profiler/Profile.cpp:
+ (KJS::Profile::Profile): New constructor arguments for the
+ originatingGlobalExec and pageGroupIdentifier.
+ (KJS::Profile::stopProfiling): Set the m_originatingGlobalExec to null.
+ * profiler/Profile.h:
+ (KJS::Profile::create): Additional arguments.
+ (KJS::Profile::originatingGlobalExec): Return m_originatingGlobalExec.
+ (KJS::Profile::pageGroupIdentifier): Return m_pageGroupIdentifier.
+ * profiler/Profiler.cpp:
+ (KJS::Profiler::findProfile): Added. Finds a Profile that matches
+ the ExecState and title.
+ (KJS::Profiler::startProfiling): Return early if there is already
+ a Profile with the ExecState and title. If not, create a new profile
+ and append it to m_currentProfiles.
+ (KJS::Profiler::stopProfiling): Loops through m_currentProfiles
+ and find the one matching the ExecState and title. If one is found
+ call stopProfiling and return the Profile after removing it
+ from m_currentProfiles.
+ (KJS::dispatchFunctionToProfiles): Helper inline function to loop through
+ m_currentProfiles and call a Profile function.
+ (KJS::Profiler::willExecute): Call dispatchFunctionToProfiles.
+ (KJS::Profiler::didExecute): Ditto.
+ * profiler/Profiler.h:
+
+2008-05-21 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Darin.
+
+ <rdar://problem/5908520> REGRESSION (3.1.1-r33033): Crash in WebKit when opening or
+ refreshing page on people.com
+
+ The problem was that STL algorithms do not work with non-conformant comparators, and the
+ site used sort(function() { return 0.5 - Math.random(); } to randomly shuffle an array.
+
+ https://bugs.webkit.org/show_bug.cgi?id=18687
+ REGRESSION(r32220): ecma/Array/15.4.4.5-3.js test now fails in GMT(BST)
+
+ Besides relying on sort stability, this test was just broken, and kept failing with the
+ new stable sort.
+
+ Tests: fast/js/sort-randomly.html
+ fast/js/sort-stability.html
+ fast/js/comparefn-sort-stability.html
+
+ * kjs/avl_tree.h: Added an AVL tree implementation.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * wtf/AVLTree.h: Added.
+ Added an AVL tree implementation.
+
+ * kjs/array_instance.cpp:
+ (KJS::ArrayInstance::increaseVectorLength):
+ (KJS::ArrayInstance::sort):
+ (KJS::AVLTreeAbstractorForArrayCompare::get_less):
+ (KJS::AVLTreeAbstractorForArrayCompare::set_less):
+ (KJS::AVLTreeAbstractorForArrayCompare::get_greater):
+ (KJS::AVLTreeAbstractorForArrayCompare::set_greater):
+ (KJS::AVLTreeAbstractorForArrayCompare::get_balance_factor):
+ (KJS::AVLTreeAbstractorForArrayCompare::set_balance_factor):
+ (KJS::AVLTreeAbstractorForArrayCompare::compare_key_key):
+ (KJS::AVLTreeAbstractorForArrayCompare::compare_key_node):
+ (KJS::AVLTreeAbstractorForArrayCompare::compare_node_node):
+ (KJS::AVLTreeAbstractorForArrayCompare::null):
+ (KJS::ArrayInstance::compactForSorting):
+
+ * kjs/array_instance.h: increaseVectorLength() now returns a bool to indicate whether it was
+ successful.
+
+ * wtf/Vector.h:
+ (WTF::Vector::Vector):
+ (WTF::::operator=):
+ (WTF::::fill):
+ Make these methods fail instead of crash when allocation fails, matching resize() and
+ reserveCapacity(), which already had this behavior. Callers need to check for null buffer
+ after making any Vector call that can try to allocate.
+
+ * tests/mozilla/ecma/Array/15.4.4.5-3.js: Fixed the test to use a consistent sort function,
+ as suggested in comments to a Mozilla bug filed about it (I'll keep tracking the bug to see
+ what the final resolution is).
+
+2008-05-20 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Tim.
+
+ <rdar://problem/5950867> JSProfiler: Allow the profiler to "Focus" a
+ profile node.
+ - Implements focus by adding the idea of a profileNode being visible and
+ adding the ability to reset all of the visible flags.
+
+ * profiler/Profile.h:
+ (KJS::Profile::focus):
+ * profiler/ProfileNode.cpp:
+ (KJS::ProfileNode::ProfileNode): Initialize the visible flag.
+ (KJS::ProfileNode::setTreeVisible): Set the visibility of this node and
+ all of its descendents.
+ (KJS::ProfileNode::focus): Determine if this node should be visible when
+ focusing, if the functionName matches this node's function name or if any
+ of this node's children are visible.
+ (KJS::ProfileNode::restoreAll): Restore all nodes' visible flag.
+ (KJS::ProfileNode::debugPrintData):
+ * profiler/ProfileNode.h:
+ (KJS::ProfileNode::visible):
+ (KJS::ProfileNode::setVisible):
+
+2008-05-20 Timothy Hatcher <timothy@apple.com>
+
+ Fixes a couple performance issues with the profiler. Also fixes
+ a regression where some nodes wouldn't be added to the tree.
+
+ Reviewed by Kevin McCullough.
+
+ * profiler/ProfileNode.cpp:
+ (KJS::ProfileNode::addChild): Compare callIdentifier instead
+ of functionName.
+ * profiler/ProfileNode.h:
+ (CallIdentifier.operator==): Compare the CallIdentifiers in
+ an order that fails sooner for non-matches.
+ (CallIdentifier.callIdentifier): Return the CallIdentifier by
+ reference to prevent making a new copy each time.
+
+2008-05-20 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Darin.
+
+ <rdar://problem/5950796> JSProfiler: dump functions are in the code
+ Removed dump and logging functions from the Release version of the code
+ and renamed them to be obviously for debugging only.
+
+ * JavaScriptCore.exp:
+ * profiler/Profile.cpp:
+ (KJS::Profile::debugPrintData):
+ (KJS::Profile::debugPrintDataSampleStyle):
+ * profiler/Profile.h:
+ * profiler/ProfileNode.cpp:
+ (KJS::ProfileNode::debugPrintData):
+ (KJS::ProfileNode::debugPrintDataSampleStyle):
+ * profiler/ProfileNode.h:
+ * profiler/Profiler.cpp:
+ * profiler/Profiler.h:
+
+2008-05-20 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Adam.
+
+ <rdar://problem/5950538> JSProfiler: Keep track of non-JS execution time
+ We now have an extra node that represents the excess non-JS time.
+ - Also changed "SCRIPT" and "anonymous function" to be more consistent
+ with the debugger.
+
+ * profiler/ProfileNode.cpp:
+ (KJS::ProfileNode::stopProfiling): If this ProfileNode is the head node
+ create a new child that has the excess execution time.
+ (KJS::ProfileNode::calculatePercentages): Moved calculation of the
+ percentages into a function since it's called from multiple places.
+ * profiler/ProfileNode.h: Add the newly needed functions used above.
+ (KJS::ProfileNode::setTotalTime):
+ (KJS::ProfileNode::setSelfTime):
+ (KJS::ProfileNode::setNumberOfCalls):
+ * profiler/Profiler.cpp: renamed "SCRIPT" and "anonymous function" to be
+ consistent with the debugger and use constants that can be localized
+ more easily.
+ (KJS::getCallIdentifiers):
+ (KJS::getCallIdentifierFromFunctionImp):
+
+2008-05-20 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Tim.
+
+ <rdar://problem/5770054> JavaScript profiler (10928)
+ Removed only profiler-internal use of currentProfile since that concept
+ is changing.
+
+ * profiler/Profile.h: Now stopProfiling takes a time and bool as
+ arguments. The time is used to calculate %s from and the bool tells
+ if this node is the head node and should be the one calculating the time.
+ (KJS::Profile::stopProfiling):
+ * profiler/ProfileNode.cpp: Ditto.
+ (KJS::ProfileNode::stopProfiling):
+ * profiler/ProfileNode.h: Ditto.
+
+2008-05-20 Kevin McCullough <kmccullough@apple.com>
+
+ Accidentally turned on the profiler.
+
+ * kjs/config.h:
+
+
+2008-05-20 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Tim.
+
+ <rdar://problem/5770054> JavaScript profiler (10928)
+ Split function name into 3 parts so that the Web Inspector can link it to
+ the resource location from whence it came.
+
+ * kjs/ustring.cpp: Implemented operator> for UStrings
+ (KJS::operator>):
+ * kjs/ustring.h:
+ * profiler/Profile.cpp:
+ (KJS::Profile::Profile): Initialize all 3 values.
+ (KJS::Profile::willExecute): Use CallIdentifier struct.
+ (KJS::Profile::didExecute): Ditto.
+ * profiler/Profile.h: Ditto and remove unused function.
+ * profiler/ProfileNode.cpp:
+ (KJS::ProfileNode::ProfileNode): Use CallIdentifier struct.
+ (KJS::ProfileNode::willExecute): Ditto and fix an issue where we
+ restarted the m_startTime even though it was already started.
+ (KJS::ProfileNode::didExecute): Ditto.
+ (KJS::ProfileNode::findChild): Ditto.
+ (KJS::functionNameDescendingComparator): Ditto and use new comparator.
+ (KJS::functionNameAscendingComparator): Ditto.
+ (KJS::ProfileNode::printDataInspectorStyle): Use CallIdentifier struct.
+ (KJS::ProfileNode::printDataSampleStyle): Ditto.
+ * profiler/ProfileNode.h:
+ (KJS::CallIdentifier::CallIdentifier): Describe the CallIdentifier struct
+ (KJS::CallIdentifier::operator== ):
+ (KJS::ProfileNode::create): Use the CallIdentifier struct.
+ (KJS::ProfileNode::callIdentifier):
+ (KJS::ProfileNode::functionName): Now only return the function name, not
+ the url and line number too.
+ (KJS::ProfileNode::url):
+ (KJS::ProfileNode::lineNumber):
+ * profiler/Profiler.cpp: Use the CallIdentifier struct.
+ (KJS::Profiler::startProfiling):
+ (KJS::Profiler::willExecute):
+ (KJS::Profiler::didExecute):
+ (KJS::getCallIdentifiers):
+ (KJS::getCallIdentifierFromFunctionImp):
+
+2008-05-20 Timothy Hatcher <timothy@apple.com>
+
+ Rename sortFileName{Ascending,Descending} to
+ sortFunctionName{Ascending,Descending}.
+
+ Reviewed by Kevin McCullough.
+
+ * JavaScriptCore.exp:
+ * kjs/config.h:
+ * profiler/Profile.h:
+ * profiler/ProfileNode.cpp:
+ (KJS::functionNameDescendingComparator):
+ (KJS::ProfileNode::sortFunctionNameDescending):
+ (KJS::functionNameAscendingComparator):
+ (KJS::ProfileNode::sortFunctionNameAscending):
+ * profiler/ProfileNode.h:
+
+2008-05-19 Timothy Hatcher <timothy@apple.com>
+
+ Make the profiler use higher than millisecond resolution time-stamps.
+
+ Reviewed by Kevin McCullough.
+
+ * kjs/DateMath.cpp:
+ (KJS::getCurrentUTCTime): Call getCurrentUTCTimeWithMicroseconds and
+ floor the result.
+ (KJS::getCurrentUTCTimeWithMicroseconds): Copied from the previous
+ implementation of getCurrentUTCTime without the floor call.
+ * kjs/DateMath.h: Addded getCurrentUTCTimeWithMicroseconds.
+ * profiler/ProfileNode.cpp:
+ (KJS::ProfileNode::ProfileNode): Use getCurrentUTCTimeWithMicroseconds.
+
+2008-05-19 Timothy Hatcher <timothy@apple.com>
+
+ Fixes a bug in the profiler where call and apply would show up
+ and double the time spent in a function. We don't want to show call
+ and apply at all in the profiles. This change excludes them.
+
+ Reviewed by Kevin McCullough.
+
+ * profiler/ProfileNode.cpp:
+ (KJS::ProfileNode::stopProfiling): Remove a second for loop and
+ calculate self time in the existing loop.
+ * profiler/Profiler.cpp:
+ (KJS::shouldExcludeFunction): Helper inline function that returns
+ true in the current function in an InternalFunctionImp and it is
+ has the functionName call or apply.
+ (KJS::Profiler::willExecute): Call shouldExcludeFunction and return
+ early if if returns true.
+ (KJS::Profiler::didExecute): Ditto.
+
+2008-05-19 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Tim.
+
+ <rdar://problem/5770054> JavaScript profiler (10928)
+ - Implement sorting by function name.
+
+ * JavaScriptCore.exp:
+ * profiler/Profile.h:
+ (KJS::Profile::sortFileNameDescending):
+ (KJS::Profile::sortFileNameAscending):
+ * profiler/ProfileNode.cpp:
+ (KJS::fileNameDescendingComparator):
+ (KJS::ProfileNode::sortFileNameDescending):
+ (KJS::fileNameAscendingComparator):
+ (KJS::ProfileNode::sortFileNameAscending):
+ * profiler/ProfileNode.h:
+
+2008-05-19 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Adam.
+
+ <rdar://problem/5770054> JavaScript profiler (10928)
+ - Pass the exec state to profiler when calling startProfiling so that if
+ profiling is started within an execution context that location is
+ recorded correctly.
+
+ * JavaScriptCore.exp:
+ * profiler/ProfileNode.cpp:
+ (KJS::ProfileNode::printDataInspectorStyle): Dump more info for debugging
+ purposes.
+ * profiler/Profiler.cpp:
+ (KJS::Profiler::startProfiling):
+ * profiler/Profiler.h:
+
+2008-05-19 Kevin McCullough <kmccullough@apple.com>
+
+ Rubberstamped by Geoff.
+
+ Turn off the profiler because it is a performance regression.
+
+ * kjs/config.h:
+
+2008-05-19 Alp Toker <alp@nuanti.com>
+
+ Reviewed by Anders and Beth.
+
+ http://bugs.webkit.org/show_bug.cgi?id=16495
+ [GTK] Accessibility support with ATK/AT-SPI
+
+ Initial ATK/AT-SPI accessibility support for the GTK+ port.
+
+ * wtf/Platform.h:
+
+2008-05-19 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Tim.
+
+ <rdar://problem/5770054> JavaScript profiler (10928)
+ -In an effort to make the profiler as efficient as possible instead of
+ prepending to a vector we keep the vector in reverse order and operate
+ over it backwards.
+
+ * profiler/Profile.cpp:
+ (KJS::Profile::willExecute):
+ (KJS::Profile::didExecute):
+ * profiler/ProfileNode.cpp:
+ (KJS::ProfileNode::didExecute):
+ (KJS::ProfileNode::endAndRecordCall):
+ * profiler/ProfileNode.h:
+ * profiler/Profiler.cpp:
+ (KJS::getStackNames):
+
+2008-05-16 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Tim.
+
+ <rdar://problem/5770054> JavaScript profiler (10928)
+ Implement sorting for the profiler.
+ I chose to sort the profileNodes in place since there is no reason they
+ need to retain their original order.
+
+ * JavaScriptCore.exp: Export the symbols.
+ * profiler/Profile.h: Add the different ways a profile can be sorted.
+ (KJS::Profile::sortTotalTimeDescending):
+ (KJS::Profile::sortTotalTimeAscending):
+ (KJS::Profile::sortSelfTimeDescending):
+ (KJS::Profile::sortSelfTimeAscending):
+ (KJS::Profile::sortCallsDescending):
+ (KJS::Profile::sortCallsAscending):
+ * profiler/ProfileNode.cpp: Implement those ways.
+ (KJS::totalTimeDescendingComparator):
+ (KJS::ProfileNode::sortTotalTimeDescending):
+ (KJS::totalTimeAscendingComparator):
+ (KJS::ProfileNode::sortTotalTimeAscending):
+ (KJS::selfTimeDescendingComparator):
+ (KJS::ProfileNode::sortSelfTimeDescending):
+ (KJS::selfTimeAscendingComparator):
+ (KJS::ProfileNode::sortSelfTimeAscending):
+ (KJS::callsDescendingComparator):
+ (KJS::ProfileNode::sortCallsDescending):
+ (KJS::callsAscendingComparator):
+ (KJS::ProfileNode::sortCallsAscending):
+ * profiler/ProfileNode.h: No longer use a Deque since it cannot be
+ sorted by std::sort and there was no reason not to use a Vector. I
+ previously had though I would do prepending but am not.
+ (KJS::ProfileNode::selfTime):
+ (KJS::ProfileNode::totalPercent):
+ (KJS::ProfileNode::selfPercent):
+ (KJS::ProfileNode::children):
+ * profiler/Profiler.cpp: Removed these functions as they can be called
+ directoy on the Profile object after getting the Vector of them.
+ (KJS::getStackNames):
+ * profiler/Profiler.h:
+
+2008-05-15 Ariya Hidayat <ariya.hidayat@trolltech.com>
+
+ Reviewed by Simon.
+
+ Since WebKitGtk is fully using autotools now, clean-up the .pro/.pri files
+ from gtk-port.
+
+ * JavaScriptCore.pro:
+ * kjs/testkjs.pro:
+
+2008-05-15 Kevin McCullough <kmccullough@apple.com>
+
+ - Build fix.
+
+ * JavaScriptCore.exp:
+
+2008-05-15 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Tim.
+
+ <rdar://problem/5770054> JavaScript profiler (10928)
+ - Cache some values to save on computing them repetitively. This will be
+ a big savings when we sort since we won't have to walk the tree for
+ every comparison!
+ - We cache these values when we end profiling because otherwise we won't
+ know which profile to get the totalTime for the whole profile from without
+ retaining a reference to the head profile or looking up the profile from
+ the list of all profiles.
+ - Also it's safe to assume we won't be asked for these values while we
+ are still profiling since the WebInspector only get's profileNodes from
+ profiles that are in the allProfiles() list and a profile is only added
+ to that list after it has finished and these values will no longer
+ change.
+
+ * JavaScriptCore.exp:
+ * profiler/ProfileNode.cpp:
+ (KJS::ProfileNode::ProfileNode):
+ (KJS::ProfileNode::stopProfiling):
+ (KJS::ProfileNode::printDataInspectorStyle):
+ (KJS::ProfileNode::printDataSampleStyle):
+ (KJS::ProfileNode::endAndRecordCall):
+ * profiler/ProfileNode.h:
+ (KJS::ProfileNode::totalTime):
+ (KJS::ProfileNode::selfTime):
+ (KJS::ProfileNode::totalPercent):
+ (KJS::ProfileNode::selfPercent):
+ * profiler/Profiler.cpp:
+ (KJS::Profiler::stopProfiling):
+
+2008-05-15 Simon Hausmann <shausman@trolltech.com>
+
+ Reviewed by Holger.
+
+ Fix compilation when compiling with MSVC and wchar_t support.
+
+ * wtf/unicode/qt4/UnicodeQt4.h:
+ (WTF::Unicode::foldCase):
+ (WTF::Unicode::umemcasecmp):
+
+2008-05-14 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Tim.
+
+ <rdar://problem/5770054> JavaScript profiler (10928)
+ - Turn on the profiler.
+
+ * kjs/config.h:
+
+2008-05-14 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Tim.
+
+ <rdar://problem/5770054> JavaScript profiler (10928)
+ - Expose the new profiler functions to the WebInspector.
+
+ * JavaScriptCore.exp:
+
+2008-05-14 Kevin McCullough <kmccullough@apple.com>
+
+ Giving credit where credit is due.
+
+ * ChangeLog:
+
+2008-05-14 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Geoff and Sam.
+
+ <rdar://problem/5770054> JavaScript profiler (10928)
+ Add the ability to get percentages of total and self time for displaying
+ in the WebInspector.
+
+ * profiler/Profile.h:
+ (KJS::Profile::totalProfileTime):
+ * profiler/ProfileNode.cpp:
+ (KJS::ProfileNode::totalPercent):
+ (KJS::ProfileNode::selfPercent):
+ * profiler/ProfileNode.h:
+ * profiler/Profiler.h:
+ (KJS::Profiler::currentProfile):
+
+2008-05-14 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Sam.
+
+ <rdar://problem/5770054> JavaScript profiler (10928)
+ - Rename FunctionCallProfile to ProfileNode.
+
+ * GNUmakefile.am:
+ * JavaScriptCore.exp:
+ * JavaScriptCore.pri:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * JavaScriptCoreSources.bkl:
+ * profiler/FunctionCallProfile.cpp: Removed.
+ * profiler/FunctionCallProfile.h: Removed.
+ * profiler/Profile.cpp:
+ (KJS::Profile::Profile):
+ (KJS::Profile::willExecute):
+ * profiler/Profile.h:
+ (KJS::Profile::callTree):
+ * profiler/ProfileNode.cpp: Copied from profiler/FunctionCallProfile.cpp.
+ (KJS::ProfileNode::ProfileNode):
+ (KJS::ProfileNode::willExecute):
+ (KJS::ProfileNode::didExecute):
+ (KJS::ProfileNode::addChild):
+ (KJS::ProfileNode::findChild):
+ (KJS::ProfileNode::stopProfiling):
+ (KJS::ProfileNode::selfTime):
+ (KJS::ProfileNode::printDataInspectorStyle):
+ (KJS::ProfileNode::printDataSampleStyle):
+ (KJS::ProfileNode::endAndRecordCall):
+ * profiler/ProfileNode.h: Copied from profiler/FunctionCallProfile.h.
+ (KJS::ProfileNode::create):
+ (KJS::ProfileNode::children):
+ * profiler/Profiler.cpp:
+
+2008-05-14 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by John.
+
+ <rdar://problem/5770054> JavaScript profiler (10928)
+ - Have each FunctionCallProfile be able to return it's total and self time.
+
+ * JavaScriptCore.exp:
+ * profiler/FunctionCallProfile.cpp:
+ (KJS::FunctionCallProfile::selfTime):
+ * profiler/FunctionCallProfile.h:
+ (KJS::FunctionCallProfile::totalTime):
+
+2008-05-14 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Darin.
+
+ <rdar://problem/5934376> REGRESSION: A script fails because of a straw BOM character in it.
+
+ <https://bugs.webkit.org/show_bug.cgi?id=4931>
+ Unicode format characters (Cf) should be removed from JavaScript source
+
+ Of all Cf characters, we are only removing BOM, because this is what Firefox trunk has
+ settled upon, after extensive discussion and investigation.
+
+ Based on Darin's work on this bug.
+
+ Test: fast/js/removing-Cf-characters.html
+
+ * kjs/lexer.cpp:
+ (KJS::Lexer::setCode): Tweak formatting. Use a call to shift(4) to read in the
+ first characters, instead of having special case code here.
+ (KJS::Lexer::shift): Add a loop when reading a character to skip BOM characters.
+
+2008-05-13 Matt Lilek <webkit@mattlilek.com>
+
+ Not reviewed, build fix.
+
+ * kjs/date_object.cpp:
+ (KJS::DateObjectFuncImp::callAsFunction):
+
+2008-05-13 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Sam.
+
+ <rdar://problem/5933644> Implement Date.now
+
+ Implement Date.now which returns the number of milliseconds since the epoch.
+
+ * kjs/CommonIdentifiers.h:
+ * kjs/date_object.cpp:
+ (KJS::DateObjectFuncImp::):
+ (KJS::DateObjectImp::DateObjectImp):
+ (KJS::DateObjectFuncImp::callAsFunction):
+
+2008-05-13 Kevin McCullough <kmccullough@apple.com>
+
+ Giving credit where credit is due.
+
+ * ChangeLog:
+
+2008-05-13 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Adam and Geoff.
+
+ <rdar://problem/5770054> JavaScript profiler (10928)
+ Use PassRefPtrs instead of RefPtrs when appropriate.
+
+ * profiler/FunctionCallProfile.cpp:
+ (KJS::FunctionCallProfile::addChild):
+ * profiler/FunctionCallProfile.h:
+ * profiler/Profile.h:
+ (KJS::Profile::callTree):
+
+2008-05-13 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Sam.
+
+ <rdar://problem/5770054> JavaScript profiler (10928)
+ - Made some functions static (as per Adam) and changed from using raw
+ pointers to RefPtr for making these JavaScript Objects.
+
+ * profiler/FunctionCallProfile.cpp:
+ (KJS::FunctionCallProfile::addChild):
+ (KJS::FunctionCallProfile::findChild):
+ * profiler/FunctionCallProfile.h:
+ (KJS::FunctionCallProfile::create):
+ * profiler/Profile.cpp:
+ (KJS::Profile::Profile):
+ (KJS::Profile::willExecute):
+ (KJS::Profile::didExecute):
+ (KJS::functionNameCountPairComparator):
+ * profiler/Profile.h:
+ (KJS::Profile::create):
+ (KJS::Profile::title):
+ (KJS::Profile::callTree):
+ * profiler/Profiler.cpp:
+ (KJS::Profiler::startProfiling):
+ * profiler/Profiler.h:
+ (KJS::Profiler::allProfiles):
+ (KJS::Profiler::clearProfiles):
+
+2008-05-13 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ <rdar://problem/4949018> JavaScriptCore API claims to work with UTF8 strings, but only works
+ with ASCII strings
+
+ * kjs/ustring.h:
+ * kjs/ustring.cpp:
+ (KJS::UString::Rep::createFromUTF8):
+ Added. Implementation adapted from JSStringCreateWithUTF8CString().
+
+ * API/JSStringRef.cpp:
+ (JSStringCreateWithUTF8CString):
+ * API/JSClassRef.cpp:
+ (OpaqueJSClass::OpaqueJSClass):
+ Use UString::Rep::createFromUTF8().
+
+2008-05-12 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Tim Hatcher.
+
+ <rdar://problem/4859666> WebKit needs availability macros in order to deprecate APIs
+
+ Create WebKit availability macros that key off the Mac OS X version being targeted to
+ determine the WebKit version being targeted. Applications can define
+ WEBKIT_VERSION_MIN_REQUIRED before including WebKit headers in order to target a specific
+ version of WebKit.
+
+ The availability header is being added to JavaScriptCore rather than WebKit as JavaScriptCore
+ is the lowest-level portion of the public WebKit API.
+
+ * API/WebKitAvailability.h: Added.
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2008-05-12 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Maciej.
+
+ https://bugs.webkit.org/show_bug.cgi?id=18828
+ Reproducible crash with PAC file
+
+ Naively moving JavaScriptCore into thread-specific data was inappropriate in the face of
+ exiting JavaScriptCore API clients, which expect a different therading model. Temporarily
+ disabling ThreadSpecific implementation until this can be sorted out.
+
+ * wtf/ThreadSpecific.h:
+ (WTF::::ThreadSpecific):
+ (WTF::::~ThreadSpecific):
+ (WTF::::get):
+ (WTF::::set):
+
+2008-05-12 Alexey Proskuryakov <ap@webkit.org>
+
+ Roll out recent threading changes (r32807, r32810, r32819, r32822) to simplify
+ SquirrelFish merging.
+
+ * API/JSBase.cpp:
+ (JSGarbageCollect):
+ * API/JSCallbackObjectFunctions.h:
+ (KJS::::staticFunctionGetter):
+ * API/JSClassRef.cpp:
+ (OpaqueJSClass::prototype):
+ * API/JSObjectRef.cpp:
+ (JSObjectMake):
+ (JSObjectMakeFunctionWithCallback):
+ (JSObjectMakeConstructor):
+ (JSObjectMakeFunction):
+ * API/JSValueRef.cpp:
+ (JSValueMakeNumber):
+ (JSValueMakeString):
+ * JavaScriptCore.exp:
+ * kjs/ExecState.h:
+ * kjs/InitializeThreading.cpp:
+ (KJS::initializeThreadingOnce):
+ * kjs/JSGlobalObject.cpp:
+ (KJS::JSGlobalObject::~JSGlobalObject):
+ (KJS::JSGlobalObject::init):
+ (KJS::JSGlobalObject::put):
+ (KJS::JSGlobalObject::reset):
+ (KJS::JSGlobalObject::tearOffActivation):
+ * kjs/JSGlobalObject.h:
+ (KJS::JSGlobalObject::head):
+ (KJS::JSGlobalObject::perThreadData):
+ * kjs/JSLock.cpp:
+ (KJS::JSLock::registerThread):
+ * kjs/JSLock.h:
+ (KJS::JSLock::JSLock):
+ * kjs/array_instance.cpp:
+ (KJS::ArrayInstance::ArrayInstance):
+ (KJS::ArrayInstance::lengthGetter):
+ * kjs/array_object.cpp:
+ (KJS::arrayProtoFuncToString):
+ (KJS::arrayProtoFuncToLocaleString):
+ (KJS::arrayProtoFuncJoin):
+ (KJS::arrayProtoFuncConcat):
+ (KJS::arrayProtoFuncPop):
+ (KJS::arrayProtoFuncPush):
+ (KJS::arrayProtoFuncShift):
+ (KJS::arrayProtoFuncSlice):
+ (KJS::arrayProtoFuncSplice):
+ (KJS::arrayProtoFuncUnShift):
+ (KJS::arrayProtoFuncFilter):
+ (KJS::arrayProtoFuncMap):
+ (KJS::arrayProtoFuncEvery):
+ (KJS::arrayProtoFuncForEach):
+ (KJS::arrayProtoFuncSome):
+ (KJS::arrayProtoFuncIndexOf):
+ (KJS::arrayProtoFuncLastIndexOf):
+ (KJS::ArrayObjectImp::ArrayObjectImp):
+ (KJS::ArrayObjectImp::construct):
+ * kjs/bool_object.cpp:
+ (KJS::BooleanPrototype::BooleanPrototype):
+ (KJS::booleanProtoFuncToString):
+ (KJS::BooleanObjectImp::BooleanObjectImp):
+ (KJS::BooleanObjectImp::construct):
+ * kjs/collector.cpp:
+ (KJS::allocateBlock):
+ (KJS::Collector::recordExtraCost):
+ (KJS::Collector::heapAllocate):
+ (KJS::Collector::allocate):
+ (KJS::Collector::allocateNumber):
+ (KJS::Collector::registerAsMainThread):
+ (KJS::onMainThread):
+ (KJS::PlatformThread::PlatformThread):
+ (KJS::getCurrentPlatformThread):
+ (KJS::Collector::Thread::Thread):
+ (KJS::destroyRegisteredThread):
+ (KJS::initializeRegisteredThreadKey):
+ (KJS::Collector::registerThread):
+ (KJS::Collector::markStackObjectsConservatively):
+ (KJS::Collector::markCurrentThreadConservativelyInternal):
+ (KJS::Collector::markCurrentThreadConservatively):
+ (KJS::suspendThread):
+ (KJS::resumeThread):
+ (KJS::getPlatformThreadRegisters):
+ (KJS::otherThreadStackPointer):
+ (KJS::Collector::markOtherThreadConservatively):
+ (KJS::protectedValues):
+ (KJS::Collector::protect):
+ (KJS::Collector::unprotect):
+ (KJS::Collector::collectOnMainThreadOnly):
+ (KJS::Collector::markProtectedObjects):
+ (KJS::Collector::markMainThreadOnlyObjects):
+ (KJS::Collector::sweep):
+ (KJS::Collector::collect):
+ (KJS::Collector::size):
+ (KJS::Collector::globalObjectCount):
+ (KJS::Collector::protectedGlobalObjectCount):
+ (KJS::Collector::protectedObjectCount):
+ (KJS::Collector::protectedObjectTypeCounts):
+ (KJS::Collector::isBusy):
+ (KJS::Collector::reportOutOfMemoryToAllExecStates):
+ * kjs/collector.h:
+ (KJS::Collector::cellBlock):
+ (KJS::Collector::cellOffset):
+ (KJS::Collector::isCellMarked):
+ (KJS::Collector::markCell):
+ (KJS::Collector::reportExtraMemoryCost):
+ * kjs/date_object.cpp:
+ (KJS::formatLocaleDate):
+ (KJS::DatePrototype::DatePrototype):
+ (KJS::DateObjectImp::DateObjectImp):
+ (KJS::DateObjectImp::construct):
+ (KJS::DateObjectImp::callAsFunction):
+ (KJS::DateObjectFuncImp::DateObjectFuncImp):
+ (KJS::DateObjectFuncImp::callAsFunction):
+ (KJS::dateProtoFuncToString):
+ (KJS::dateProtoFuncToUTCString):
+ (KJS::dateProtoFuncToDateString):
+ (KJS::dateProtoFuncToTimeString):
+ (KJS::dateProtoFuncToLocaleString):
+ (KJS::dateProtoFuncToLocaleDateString):
+ (KJS::dateProtoFuncToLocaleTimeString):
+ (KJS::dateProtoFuncValueOf):
+ (KJS::dateProtoFuncGetTime):
+ (KJS::dateProtoFuncGetFullYear):
+ (KJS::dateProtoFuncGetUTCFullYear):
+ (KJS::dateProtoFuncToGMTString):
+ (KJS::dateProtoFuncGetMonth):
+ (KJS::dateProtoFuncGetUTCMonth):
+ (KJS::dateProtoFuncGetDate):
+ (KJS::dateProtoFuncGetUTCDate):
+ (KJS::dateProtoFuncGetDay):
+ (KJS::dateProtoFuncGetUTCDay):
+ (KJS::dateProtoFuncGetHours):
+ (KJS::dateProtoFuncGetUTCHours):
+ (KJS::dateProtoFuncGetMinutes):
+ (KJS::dateProtoFuncGetUTCMinutes):
+ (KJS::dateProtoFuncGetSeconds):
+ (KJS::dateProtoFuncGetUTCSeconds):
+ (KJS::dateProtoFuncGetMilliSeconds):
+ (KJS::dateProtoFuncGetUTCMilliseconds):
+ (KJS::dateProtoFuncGetTimezoneOffset):
+ (KJS::dateProtoFuncSetTime):
+ (KJS::setNewValueFromTimeArgs):
+ (KJS::setNewValueFromDateArgs):
+ (KJS::dateProtoFuncSetYear):
+ (KJS::dateProtoFuncGetYear):
+ * kjs/error_object.cpp:
+ (KJS::ErrorPrototype::ErrorPrototype):
+ (KJS::errorProtoFuncToString):
+ (KJS::ErrorObjectImp::ErrorObjectImp):
+ (KJS::ErrorObjectImp::construct):
+ (KJS::NativeErrorPrototype::NativeErrorPrototype):
+ (KJS::NativeErrorImp::NativeErrorImp):
+ (KJS::NativeErrorImp::construct):
+ * kjs/function.cpp:
+ (KJS::FunctionImp::lengthGetter):
+ (KJS::FunctionImp::construct):
+ (KJS::Arguments::Arguments):
+ (KJS::ActivationImp::createArgumentsObject):
+ (KJS::encode):
+ (KJS::decode):
+ (KJS::globalFuncParseInt):
+ (KJS::globalFuncParseFloat):
+ (KJS::globalFuncEscape):
+ (KJS::globalFuncUnescape):
+ (KJS::PrototypeFunction::PrototypeFunction):
+ (KJS::PrototypeReflexiveFunction::PrototypeReflexiveFunction):
+ * kjs/function_object.cpp:
+ (KJS::FunctionPrototype::FunctionPrototype):
+ (KJS::functionProtoFuncToString):
+ (KJS::FunctionObjectImp::FunctionObjectImp):
+ (KJS::FunctionObjectImp::construct):
+ * kjs/internal.cpp:
+ (KJS::StringImp::toObject):
+ * kjs/internal.h:
+ (KJS::StringImp::StringImp):
+ (KJS::NumberImp::operator new):
+ * kjs/list.cpp:
+ (KJS::List::markSet):
+ (KJS::List::markProtectedListsSlowCase):
+ (KJS::List::expandAndAppend):
+ * kjs/list.h:
+ (KJS::List::List):
+ (KJS::List::~List):
+ (KJS::List::markProtectedLists):
+ * kjs/lookup.h:
+ (KJS::staticFunctionGetter):
+ (KJS::cacheGlobalObject):
+ * kjs/math_object.cpp:
+ (KJS::MathObjectImp::getValueProperty):
+ (KJS::mathProtoFuncAbs):
+ (KJS::mathProtoFuncACos):
+ (KJS::mathProtoFuncASin):
+ (KJS::mathProtoFuncATan):
+ (KJS::mathProtoFuncATan2):
+ (KJS::mathProtoFuncCeil):
+ (KJS::mathProtoFuncCos):
+ (KJS::mathProtoFuncExp):
+ (KJS::mathProtoFuncFloor):
+ (KJS::mathProtoFuncLog):
+ (KJS::mathProtoFuncMax):
+ (KJS::mathProtoFuncMin):
+ (KJS::mathProtoFuncPow):
+ (KJS::mathProtoFuncRandom):
+ (KJS::mathProtoFuncRound):
+ (KJS::mathProtoFuncSin):
+ (KJS::mathProtoFuncSqrt):
+ (KJS::mathProtoFuncTan):
+ * kjs/nodes.cpp:
+ (KJS::ParserRefCounted::ParserRefCounted):
+ (KJS::ParserRefCounted::ref):
+ (KJS::ParserRefCounted::deref):
+ (KJS::ParserRefCounted::refcount):
+ (KJS::ParserRefCounted::deleteNewObjects):
+ (KJS::Node::handleException):
+ (KJS::NumberNode::evaluate):
+ (KJS::StringNode::evaluate):
+ (KJS::ArrayNode::evaluate):
+ (KJS::PostIncResolveNode::evaluate):
+ (KJS::PostIncLocalVarNode::evaluate):
+ (KJS::PostDecResolveNode::evaluate):
+ (KJS::PostDecLocalVarNode::evaluate):
+ (KJS::PostDecLocalVarNode::inlineEvaluateToNumber):
+ (KJS::PostIncBracketNode::evaluate):
+ (KJS::PostDecBracketNode::evaluate):
+ (KJS::PostIncDotNode::evaluate):
+ (KJS::PostDecDotNode::evaluate):
+ (KJS::typeStringForValue):
+ (KJS::LocalVarTypeOfNode::evaluate):
+ (KJS::TypeOfResolveNode::evaluate):
+ (KJS::TypeOfValueNode::evaluate):
+ (KJS::PreIncLocalVarNode::evaluate):
+ (KJS::PreIncResolveNode::evaluate):
+ (KJS::PreDecLocalVarNode::evaluate):
+ (KJS::PreDecResolveNode::evaluate):
+ (KJS::PreIncConstNode::evaluate):
+ (KJS::PreDecConstNode::evaluate):
+ (KJS::PostIncConstNode::evaluate):
+ (KJS::PostDecConstNode::evaluate):
+ (KJS::PreIncBracketNode::evaluate):
+ (KJS::PreDecBracketNode::evaluate):
+ (KJS::PreIncDotNode::evaluate):
+ (KJS::PreDecDotNode::evaluate):
+ (KJS::NegateNode::evaluate):
+ (KJS::BitwiseNotNode::evaluate):
+ (KJS::MultNode::evaluate):
+ (KJS::DivNode::evaluate):
+ (KJS::ModNode::evaluate):
+ (KJS::addSlowCase):
+ (KJS::add):
+ (KJS::AddNumbersNode::evaluate):
+ (KJS::AddStringsNode::evaluate):
+ (KJS::AddStringLeftNode::evaluate):
+ (KJS::AddStringRightNode::evaluate):
+ (KJS::SubNode::evaluate):
+ (KJS::LeftShiftNode::evaluate):
+ (KJS::RightShiftNode::evaluate):
+ (KJS::UnsignedRightShiftNode::evaluate):
+ (KJS::BitXOrNode::evaluate):
+ (KJS::BitOrNode::evaluate):
+ (KJS::valueForReadModifyAssignment):
+ (KJS::ForInNode::execute):
+ (KJS::TryNode::execute):
+ (KJS::FuncDeclNode::makeFunction):
+ (KJS::FuncExprNode::evaluate):
+ * kjs/nodes.h:
+ * kjs/number_object.cpp:
+ (KJS::NumberPrototype::NumberPrototype):
+ (KJS::numberProtoFuncToString):
+ (KJS::numberProtoFuncToLocaleString):
+ (KJS::numberProtoFuncToFixed):
+ (KJS::numberProtoFuncToExponential):
+ (KJS::numberProtoFuncToPrecision):
+ (KJS::NumberObjectImp::NumberObjectImp):
+ (KJS::NumberObjectImp::getValueProperty):
+ (KJS::NumberObjectImp::construct):
+ (KJS::NumberObjectImp::callAsFunction):
+ * kjs/object.cpp:
+ (KJS::JSObject::call):
+ (KJS::JSObject::get):
+ (KJS::JSObject::put):
+ (KJS::JSObject::defineGetter):
+ (KJS::JSObject::defineSetter):
+ (KJS::JSObject::putDirect):
+ (KJS::Error::create):
+ * kjs/object.h:
+ * kjs/object_object.cpp:
+ (KJS::ObjectPrototype::ObjectPrototype):
+ (KJS::objectProtoFuncToLocaleString):
+ (KJS::objectProtoFuncToString):
+ (KJS::ObjectObjectImp::ObjectObjectImp):
+ (KJS::ObjectObjectImp::construct):
+ * kjs/property_map.h:
+ (KJS::SavedProperty::SavedProperty):
+ (KJS::SavedProperty::init):
+ (KJS::SavedProperty::~SavedProperty):
+ (KJS::SavedProperty::name):
+ (KJS::SavedProperty::value):
+ (KJS::SavedProperty::attributes):
+ * kjs/protect.h:
+ (KJS::gcProtect):
+ (KJS::gcUnprotect):
+ * kjs/regexp_object.cpp:
+ (KJS::RegExpPrototype::RegExpPrototype):
+ (KJS::regExpProtoFuncToString):
+ (KJS::RegExpImp::getValueProperty):
+ (KJS::RegExpObjectImp::RegExpObjectImp):
+ (KJS::RegExpObjectImp::arrayOfMatches):
+ (KJS::RegExpObjectImp::getBackref):
+ (KJS::RegExpObjectImp::getLastParen):
+ (KJS::RegExpObjectImp::getLeftContext):
+ (KJS::RegExpObjectImp::getRightContext):
+ (KJS::RegExpObjectImp::getValueProperty):
+ (KJS::RegExpObjectImp::createRegExpImp):
+ * kjs/regexp_object.h:
+ * kjs/string_object.cpp:
+ (KJS::StringInstance::StringInstance):
+ (KJS::StringInstance::lengthGetter):
+ (KJS::StringInstance::indexGetter):
+ (KJS::stringInstanceNumericPropertyGetter):
+ (KJS::StringPrototype::StringPrototype):
+ (KJS::replace):
+ (KJS::stringProtoFuncCharAt):
+ (KJS::stringProtoFuncCharCodeAt):
+ (KJS::stringProtoFuncConcat):
+ (KJS::stringProtoFuncIndexOf):
+ (KJS::stringProtoFuncLastIndexOf):
+ (KJS::stringProtoFuncMatch):
+ (KJS::stringProtoFuncSearch):
+ (KJS::stringProtoFuncReplace):
+ (KJS::stringProtoFuncSlice):
+ (KJS::stringProtoFuncSplit):
+ (KJS::stringProtoFuncSubstr):
+ (KJS::stringProtoFuncSubstring):
+ (KJS::stringProtoFuncToLowerCase):
+ (KJS::stringProtoFuncToUpperCase):
+ (KJS::stringProtoFuncToLocaleLowerCase):
+ (KJS::stringProtoFuncToLocaleUpperCase):
+ (KJS::stringProtoFuncLocaleCompare):
+ (KJS::stringProtoFuncBig):
+ (KJS::stringProtoFuncSmall):
+ (KJS::stringProtoFuncBlink):
+ (KJS::stringProtoFuncBold):
+ (KJS::stringProtoFuncFixed):
+ (KJS::stringProtoFuncItalics):
+ (KJS::stringProtoFuncStrike):
+ (KJS::stringProtoFuncSub):
+ (KJS::stringProtoFuncSup):
+ (KJS::stringProtoFuncFontcolor):
+ (KJS::stringProtoFuncFontsize):
+ (KJS::stringProtoFuncAnchor):
+ (KJS::stringProtoFuncLink):
+ (KJS::StringObjectImp::StringObjectImp):
+ (KJS::StringObjectImp::construct):
+ (KJS::StringObjectImp::callAsFunction):
+ (KJS::StringObjectFuncImp::StringObjectFuncImp):
+ (KJS::StringObjectFuncImp::callAsFunction):
+ * kjs/string_object.h:
+ (KJS::StringInstanceThatMasqueradesAsUndefined::StringInstanceThatMasqueradesAsUndefined):
+ * kjs/testkjs.cpp:
+ (GlobalObject::GlobalObject):
+ (functionGC):
+ (functionRun):
+ (functionReadline):
+ (kjsmain):
+ * kjs/ustring.h:
+ * kjs/value.cpp:
+ (KJS::JSCell::operator new):
+ (KJS::jsString):
+ (KJS::jsOwnedString):
+ (KJS::jsNumberCell):
+ * kjs/value.h:
+ (KJS::jsNaN):
+ (KJS::jsNumber):
+ (KJS::jsNumberFromAnd):
+ (KJS::JSCell::marked):
+ (KJS::JSCell::mark):
+ (KJS::JSValue::toJSNumber):
+ * wtf/ThreadSpecific.h:
+ (WTF::T):
+
+2008-05-10 Julien Chaffraix <jchaffraix@webkit.org>
+
+ Qt & wx build fix.
+
+ * JavaScriptCore.pri: Add profiler/Profile.cpp.
+ * JavaScriptCoreSources.bkl: Ditto.
+
+2008-05-10 Jan Michael Alonzo <jmalonzo@unpluggable.com>
+
+ Reviewed by Maciej.
+
+ Gtk+ build fix
+
+ * GNUmakefile.am: Add Profile.cpp in _sources
+
+2008-05-09 Brady Eidson <beidson@apple.com>
+
+ Build Fix. Kevin is an idiot.
+ ("My name is Kevin McCullough and I approve this message.")
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+
+2008-05-09 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Tim.
+
+ -<rdar://problem/5770054> JavaScript profiler (10928)
+ -Add Profile class so that all profiles can be stored and retrieved by
+ the WebInspector when that time comes.
+
+ * JavaScriptCore.exp: Export the new function signatures.
+ * JavaScriptCore.xcodeproj/project.pbxproj: Add the new files to the
+ project
+ * profiler/Profile.cpp: Added. This class represents a single run of the
+ profiler.
+ (KJS::Profile::Profile):
+ (KJS::Profile::willExecute):
+ (KJS::Profile::didExecute):
+ (KJS::Profile::printDataInspectorStyle):
+ (KJS::functionNameCountPairComparator):
+ (KJS::Profile::printDataSampleStyle):
+ * profiler/Profile.h: Added. Ditto
+ (KJS::Profile::stopProfiling):
+ * profiler/Profiler.cpp: Now the profiler keeps track of many profiles
+ but only runs one at a time.
+ (KJS::Profiler::startProfiling):
+ (KJS::Profiler::stopProfiling):
+ (KJS::Profiler::willExecute):
+ (KJS::Profiler::didExecute):
+ (KJS::Profiler::printDataInspectorStyle):
+ (KJS::Profiler::printDataSampleStyle):
+ * profiler/Profiler.h: Ditto.
+ (KJS::Profiler::~Profiler):
+ (KJS::Profiler::allProfiles):
+ (KJS::Profiler::clearProfiles):
+
+2008-05-08 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Mark.
+
+ Enable NPAPI plug-ins on 64-bit.
+
+ * wtf/Platform.h:
+
+2008-05-07 Julien Chaffraix <jchaffraix@webkit.org>
+
+ Reviewed by Adam Roben.
+
+ wx & Gtk build fix.
+
+ Add SIZE_MAX definition for the wx port.
+
+ * os-win32/stdint.h:
+
+2008-05-07 Ariya Hidayat <ariya.hidayat@trolltech.com>
+
+ Reviewed by Simon.
+
+ Support for isMainThread in the Qt port.
+
+ * wtf/ThreadingQt.cpp:
+ (WTF::initializeThreading): Adjusted.
+ (WTF::isMainThread): Added.
+
+2008-05-05 Darin Adler <darin@apple.com>
+
+ Reviewed by John Sullivan.
+
+ - fix debug-only leak seen on buildbot
+
+ * wtf/HashTable.h:
+ (WTF::HashTable::checkKey): After writing an empty value in, but before constructing a
+ deleted value on top of it, call the destructor so the empty value doesn't leak.
+
+2008-05-02 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ Get rid of static data in nodes.cpp (well, at least of non-debug one).
+
+ No measurable change on SunSpider.
+
+ * kjs/InitializeThreading.cpp:
+ (KJS::initializeThreadingOnce):
+ * kjs/nodes.cpp:
+ (KJS::newTrackedObjects):
+ (KJS::trackedObjectExtraRefCounts):
+ (KJS::initializeNodesThreading):
+ (KJS::ParserRefCounted::ParserRefCounted):
+ (KJS::ParserRefCounted::ref):
+ (KJS::ParserRefCounted::deref):
+ (KJS::ParserRefCounted::refcount):
+ (KJS::ParserRefCounted::deleteNewObjects):
+ * kjs/nodes.h:
+ Made newTrackedObjects and trackedObjectExtraRefCounts per-thread.
+
+2008-05-02 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Darin.
+
+ Move call stack depth counter to global object.
+
+ * kjs/ExecState.h: (KJS::ExecState::functionCallDepth): Added a recursion depth counter to
+ per-thread data.
+ * kjs/JSGlobalObject.cpp: (KJS::JSGlobalObject::init): Initialize PerThreadData.functionCallDepth.
+ * kjs/JSGlobalObject.h: (KJS::JSGlobalObject::perThreadData): Made the result non-const.
+
+ * kjs/object.cpp:
+ (KJS::throwStackSizeExceededError): Moved throwError to a separate function, since it is now
+ the only thing in JSObject::call that needs a PIC branch.
+ (KJS::JSObject::call): Use a per-thread variable instead of local static for recursion depth
+ tracking.
+
+2008-05-02 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Darin.
+
+ Make JavaScriptGlue and JavaScriptCore API functions implicitly call initializeThreading
+ for the sake of non-WebKit clients.
+
+ * API/JSBase.cpp:
+ (JSGarbageCollect):
+ * API/JSContextRef.cpp:
+ (JSGlobalContextCreate):
+ These are the JavaScriptCore API bottlenecks. There are a few other JSStringRef
+ and JSClassRef functions that can be called earlier, but they do not do anything that
+ requires initializeThreading.
+
+ * kjs/InitializeThreading.cpp:
+ (KJS::doInitializeThreading):
+ (KJS::initializeThreading):
+ On Darwin, make the initialization happen under pthread_once, since there is no guarantee
+ that non-WebKit clients won't try to call this function re-entrantly.
+
+ * kjs/InitializeThreading.h:
+ * wtf/Threading.h:
+ Spell out initializeThreading contract.
+
+ * wtf/ThreadingPthreads.cpp: (WTF::isMainThread): Make sure that results are correct on
+ Darwin, even if threading was initialized from a secondary thread.
+
+2008-05-02 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ https://bugs.webkit.org/show_bug.cgi?id=18826
+ Make JavaScript heap per-thread
+
+ * wtf/ThreadSpecific.h: Make sure to initialize POD thread-specific varaibles, too
+ (replaced "new T" with "new T()").
+
+ * kjs/collector.h: Renamed Collector to Heap, made the heap per-thread. Removed support for
+ multithreaded access to a heap.
+ (KJS::CollectorBlock): Removed collectOnMainThreadOnly bitmap, added a reference to owner heap.
+ (KJS::SmallCellCollectorBlock): Ditto.
+ (KJS::Heap::markListSet): Moved from a static variable in List.cpp to a per-thread one here.
+ (KJS::Heap::heap): Added a method to find which heap a JSValue is allocated in.
+
+ * kjs/collector.cpp: Changed "const size_t" constants to #defines, to avoid a PIC branch
+ (gcc was using one to access a constant used in std::max(), because it takes a reference,
+ even though std::max() itself was inlined).
+ (KJS::Heap::threadHeap): JS heap is now per-thread.
+ (KJS::Heap::Heap): Zero-initialize the heap.
+ (KJS::allocateBlock): Added NEVER_INLINE, because this function uses a PIC branch, so
+ inlining it in Heap::heapAllocate() is bad for performance, now that the latter doesn't
+ use any global data.
+ (KJS::Heap::heapAllocate): Initialize Block::heap.
+ (KJS::Heap::markCurrentThreadConservatively): Moved into markStackObjectsConservatively(),
+ as GC only works with a current thread's heap now.
+ (KJS::Heap::sweep): Removed collectOnMainThreadOnly checks.
+ (KJS::Heap::collect): Ditto.
+
+ * kjs/JSLock.cpp:
+ * kjs/JSLock.h:
+ (KJS::JSLock::JSLock):
+ Removed registerThread(), as the heap no longer cares.
+
+ * kjs/InitializeThreading.cpp: (KJS::initializeThreading): Initialize new per-thread
+ variables in Heap and JSGlobalObject.
+
+ * kjs/ExecState.h: (KJS::ExecState::heap): Added a heap pointer for faster access to
+ per-thread heap, and an accessor for it.
+
+ * kjs/JSGlobalObject.h: Made JSGlobalObject linked list per-thread.
+ * kjs/JSGlobalObject.cpp:
+ (KJS::JSGlobalObject::~JSGlobalObject): Fixed a bug in linked list handling. It only worked
+ right if the removed object was the head one!
+ (KJS::JSGlobalObject::head): Return a per-thread list head.
+ (KJS::JSGlobalObject::init): Store a reference to per-thread heap.
+ (KJS::JSGlobalObject::reset): Pass ExecState to functions that need it.
+ (KJS::JSGlobalObject::tearOffActivation): Ditto.
+ (KJS::JSGlobalObject::operator new): JSGlobalObject allocation cannot use an ExecState,
+ so it needs a custom operator new that directly accesses per-thread heap.
+
+ * kjs/list.h:
+ (KJS::List::List): Replaced m_isInMarkSet boolean with an actual pointer to the set, since it
+ is no longer a single static object.
+ (KJS::List::~List): Ditto.
+ * kjs/list.cpp:
+ (KJS::List::markSet): Removed, this is now stored in Heap.
+ (KJS::List::markProtectedLists): Take a reference to the list.
+ (KJS::List::expandAndAppend): Ask the current thread heap for a mark set reference.
+
+ * kjs/protect.h:
+ (KJS::gcProtect):
+ (KJS::gcUnprotect):
+ Use the newly added Heap::heap() method to find out which heap the value to be (un)protected
+ belongs to.
+
+ * kjs/property_map.h: Removed unused SavedProperty class.
+
+ * JavaScriptCore.exp:
+ * API/JSBase.cpp:
+ (JSGarbageCollect):
+ * API/JSCallbackObjectFunctions.h:
+ (KJS::::staticFunctionGetter):
+ * API/JSClassRef.cpp:
+ (OpaqueJSClass::prototype):
+ * API/JSObjectRef.cpp:
+ (JSObjectMake):
+ (JSObjectMakeFunctionWithCallback):
+ (JSObjectMakeConstructor):
+ (JSObjectMakeFunction):
+ * API/JSValueRef.cpp:
+ (JSValueMakeNumber):
+ (JSValueMakeString):
+ * kjs/array_instance.cpp:
+ (KJS::ArrayInstance::ArrayInstance):
+ (KJS::ArrayInstance::lengthGetter):
+ * kjs/array_object.cpp:
+ (KJS::arrayProtoFuncToString):
+ (KJS::arrayProtoFuncToLocaleString):
+ (KJS::arrayProtoFuncJoin):
+ (KJS::arrayProtoFuncConcat):
+ (KJS::arrayProtoFuncPop):
+ (KJS::arrayProtoFuncPush):
+ (KJS::arrayProtoFuncShift):
+ (KJS::arrayProtoFuncSlice):
+ (KJS::arrayProtoFuncSplice):
+ (KJS::arrayProtoFuncUnShift):
+ (KJS::arrayProtoFuncFilter):
+ (KJS::arrayProtoFuncMap):
+ (KJS::arrayProtoFuncEvery):
+ (KJS::arrayProtoFuncForEach):
+ (KJS::arrayProtoFuncSome):
+ (KJS::arrayProtoFuncIndexOf):
+ (KJS::arrayProtoFuncLastIndexOf):
+ (KJS::ArrayObjectImp::ArrayObjectImp):
+ (KJS::ArrayObjectImp::construct):
+ * kjs/bool_object.cpp:
+ (KJS::BooleanPrototype::BooleanPrototype):
+ (KJS::booleanProtoFuncToString):
+ (KJS::BooleanObjectImp::BooleanObjectImp):
+ (KJS::BooleanObjectImp::construct):
+ * kjs/date_object.cpp:
+ (KJS::formatLocaleDate):
+ (KJS::DatePrototype::DatePrototype):
+ (KJS::DateObjectImp::DateObjectImp):
+ (KJS::DateObjectImp::construct):
+ (KJS::DateObjectImp::callAsFunction):
+ (KJS::DateObjectFuncImp::DateObjectFuncImp):
+ (KJS::DateObjectFuncImp::callAsFunction):
+ (KJS::dateProtoFuncToString):
+ (KJS::dateProtoFuncToUTCString):
+ (KJS::dateProtoFuncToDateString):
+ (KJS::dateProtoFuncToTimeString):
+ (KJS::dateProtoFuncToLocaleString):
+ (KJS::dateProtoFuncToLocaleDateString):
+ (KJS::dateProtoFuncToLocaleTimeString):
+ (KJS::dateProtoFuncValueOf):
+ (KJS::dateProtoFuncGetTime):
+ (KJS::dateProtoFuncGetFullYear):
+ (KJS::dateProtoFuncGetUTCFullYear):
+ (KJS::dateProtoFuncToGMTString):
+ (KJS::dateProtoFuncGetMonth):
+ (KJS::dateProtoFuncGetUTCMonth):
+ (KJS::dateProtoFuncGetDate):
+ (KJS::dateProtoFuncGetUTCDate):
+ (KJS::dateProtoFuncGetDay):
+ (KJS::dateProtoFuncGetUTCDay):
+ (KJS::dateProtoFuncGetHours):
+ (KJS::dateProtoFuncGetUTCHours):
+ (KJS::dateProtoFuncGetMinutes):
+ (KJS::dateProtoFuncGetUTCMinutes):
+ (KJS::dateProtoFuncGetSeconds):
+ (KJS::dateProtoFuncGetUTCSeconds):
+ (KJS::dateProtoFuncGetMilliSeconds):
+ (KJS::dateProtoFuncGetUTCMilliseconds):
+ (KJS::dateProtoFuncGetTimezoneOffset):
+ (KJS::dateProtoFuncSetTime):
+ (KJS::setNewValueFromTimeArgs):
+ (KJS::setNewValueFromDateArgs):
+ (KJS::dateProtoFuncSetYear):
+ (KJS::dateProtoFuncGetYear):
+ * kjs/error_object.cpp:
+ (KJS::ErrorPrototype::ErrorPrototype):
+ (KJS::errorProtoFuncToString):
+ (KJS::ErrorObjectImp::ErrorObjectImp):
+ (KJS::ErrorObjectImp::construct):
+ (KJS::NativeErrorPrototype::NativeErrorPrototype):
+ (KJS::NativeErrorImp::NativeErrorImp):
+ (KJS::NativeErrorImp::construct):
+ * kjs/function.cpp:
+ (KJS::FunctionImp::lengthGetter):
+ (KJS::FunctionImp::construct):
+ (KJS::Arguments::Arguments):
+ (KJS::ActivationImp::createArgumentsObject):
+ (KJS::encode):
+ (KJS::decode):
+ (KJS::globalFuncParseInt):
+ (KJS::globalFuncParseFloat):
+ (KJS::globalFuncEscape):
+ (KJS::globalFuncUnescape):
+ (KJS::PrototypeFunction::PrototypeFunction):
+ (KJS::PrototypeReflexiveFunction::PrototypeReflexiveFunction):
+ * kjs/function_object.cpp:
+ (KJS::FunctionPrototype::FunctionPrototype):
+ (KJS::functionProtoFuncToString):
+ (KJS::FunctionObjectImp::FunctionObjectImp):
+ (KJS::FunctionObjectImp::construct):
+ * kjs/internal.cpp:
+ (KJS::StringImp::toObject):
+ * kjs/internal.h:
+ (KJS::StringImp::StringImp):
+ (KJS::NumberImp::operator new):
+ * kjs/lookup.h:
+ (KJS::staticFunctionGetter):
+ (KJS::cacheGlobalObject):
+ * kjs/math_object.cpp:
+ (KJS::MathObjectImp::getValueProperty):
+ (KJS::mathProtoFuncAbs):
+ (KJS::mathProtoFuncACos):
+ (KJS::mathProtoFuncASin):
+ (KJS::mathProtoFuncATan):
+ (KJS::mathProtoFuncATan2):
+ (KJS::mathProtoFuncCeil):
+ (KJS::mathProtoFuncCos):
+ (KJS::mathProtoFuncExp):
+ (KJS::mathProtoFuncFloor):
+ (KJS::mathProtoFuncLog):
+ (KJS::mathProtoFuncMax):
+ (KJS::mathProtoFuncMin):
+ (KJS::mathProtoFuncPow):
+ (KJS::mathProtoFuncRandom):
+ (KJS::mathProtoFuncRound):
+ (KJS::mathProtoFuncSin):
+ (KJS::mathProtoFuncSqrt):
+ (KJS::mathProtoFuncTan):
+ * kjs/nodes.cpp:
+ (KJS::Node::handleException):
+ (KJS::NumberNode::evaluate):
+ (KJS::StringNode::evaluate):
+ (KJS::ArrayNode::evaluate):
+ (KJS::PostIncResolveNode::evaluate):
+ (KJS::PostIncLocalVarNode::evaluate):
+ (KJS::PostDecResolveNode::evaluate):
+ (KJS::PostDecLocalVarNode::evaluate):
+ (KJS::PostDecLocalVarNode::inlineEvaluateToNumber):
+ (KJS::PostIncBracketNode::evaluate):
+ (KJS::PostDecBracketNode::evaluate):
+ (KJS::PostIncDotNode::evaluate):
+ (KJS::PostDecDotNode::evaluate):
+ (KJS::typeStringForValue):
+ (KJS::LocalVarTypeOfNode::evaluate):
+ (KJS::TypeOfResolveNode::evaluate):
+ (KJS::TypeOfValueNode::evaluate):
+ (KJS::PreIncLocalVarNode::evaluate):
+ (KJS::PreIncResolveNode::evaluate):
+ (KJS::PreDecLocalVarNode::evaluate):
+ (KJS::PreDecResolveNode::evaluate):
+ (KJS::PreIncConstNode::evaluate):
+ (KJS::PreDecConstNode::evaluate):
+ (KJS::PostIncConstNode::evaluate):
+ (KJS::PostDecConstNode::evaluate):
+ (KJS::PreIncBracketNode::evaluate):
+ (KJS::PreDecBracketNode::evaluate):
+ (KJS::PreIncDotNode::evaluate):
+ (KJS::PreDecDotNode::evaluate):
+ (KJS::NegateNode::evaluate):
+ (KJS::BitwiseNotNode::evaluate):
+ (KJS::MultNode::evaluate):
+ (KJS::DivNode::evaluate):
+ (KJS::ModNode::evaluate):
+ (KJS::addSlowCase):
+ (KJS::add):
+ (KJS::AddNumbersNode::evaluate):
+ (KJS::AddStringsNode::evaluate):
+ (KJS::AddStringLeftNode::evaluate):
+ (KJS::AddStringRightNode::evaluate):
+ (KJS::SubNode::evaluate):
+ (KJS::LeftShiftNode::evaluate):
+ (KJS::RightShiftNode::evaluate):
+ (KJS::UnsignedRightShiftNode::evaluate):
+ (KJS::BitXOrNode::evaluate):
+ (KJS::BitOrNode::evaluate):
+ (KJS::valueForReadModifyAssignment):
+ (KJS::ForInNode::execute):
+ (KJS::TryNode::execute):
+ (KJS::FuncDeclNode::makeFunction):
+ (KJS::FuncExprNode::evaluate):
+ * kjs/number_object.cpp:
+ (KJS::NumberPrototype::NumberPrototype):
+ (KJS::numberProtoFuncToString):
+ (KJS::numberProtoFuncToLocaleString):
+ (KJS::numberProtoFuncToFixed):
+ (KJS::numberProtoFuncToExponential):
+ (KJS::numberProtoFuncToPrecision):
+ (KJS::NumberObjectImp::NumberObjectImp):
+ (KJS::NumberObjectImp::getValueProperty):
+ (KJS::NumberObjectImp::construct):
+ (KJS::NumberObjectImp::callAsFunction):
+ * kjs/object.cpp:
+ (KJS::JSObject::defineGetter):
+ (KJS::JSObject::defineSetter):
+ (KJS::JSObject::putDirect):
+ (KJS::Error::create):
+ * kjs/object.h:
+ * kjs/object_object.cpp:
+ (KJS::ObjectPrototype::ObjectPrototype):
+ (KJS::objectProtoFuncToLocaleString):
+ (KJS::objectProtoFuncToString):
+ (KJS::ObjectObjectImp::ObjectObjectImp):
+ (KJS::ObjectObjectImp::construct):
+ * kjs/regexp_object.cpp:
+ (KJS::RegExpPrototype::RegExpPrototype):
+ (KJS::regExpProtoFuncToString):
+ (KJS::RegExpImp::getValueProperty):
+ (KJS::RegExpObjectImp::RegExpObjectImp):
+ (KJS::RegExpObjectImp::arrayOfMatches):
+ (KJS::RegExpObjectImp::getBackref):
+ (KJS::RegExpObjectImp::getLastParen):
+ (KJS::RegExpObjectImp::getLeftContext):
+ (KJS::RegExpObjectImp::getRightContext):
+ (KJS::RegExpObjectImp::getValueProperty):
+ (KJS::RegExpObjectImp::createRegExpImp):
+ * kjs/regexp_object.h:
+ * kjs/string_object.cpp:
+ (KJS::StringInstance::StringInstance):
+ (KJS::StringInstance::lengthGetter):
+ (KJS::StringInstance::indexGetter):
+ (KJS::stringInstanceNumericPropertyGetter):
+ (KJS::StringPrototype::StringPrototype):
+ (KJS::replace):
+ (KJS::stringProtoFuncCharAt):
+ (KJS::stringProtoFuncCharCodeAt):
+ (KJS::stringProtoFuncConcat):
+ (KJS::stringProtoFuncIndexOf):
+ (KJS::stringProtoFuncLastIndexOf):
+ (KJS::stringProtoFuncMatch):
+ (KJS::stringProtoFuncSearch):
+ (KJS::stringProtoFuncReplace):
+ (KJS::stringProtoFuncSlice):
+ (KJS::stringProtoFuncSplit):
+ (KJS::stringProtoFuncSubstr):
+ (KJS::stringProtoFuncSubstring):
+ (KJS::stringProtoFuncToLowerCase):
+ (KJS::stringProtoFuncToUpperCase):
+ (KJS::stringProtoFuncToLocaleLowerCase):
+ (KJS::stringProtoFuncToLocaleUpperCase):
+ (KJS::stringProtoFuncLocaleCompare):
+ (KJS::stringProtoFuncBig):
+ (KJS::stringProtoFuncSmall):
+ (KJS::stringProtoFuncBlink):
+ (KJS::stringProtoFuncBold):
+ (KJS::stringProtoFuncFixed):
+ (KJS::stringProtoFuncItalics):
+ (KJS::stringProtoFuncStrike):
+ (KJS::stringProtoFuncSub):
+ (KJS::stringProtoFuncSup):
+ (KJS::stringProtoFuncFontcolor):
+ (KJS::stringProtoFuncFontsize):
+ (KJS::stringProtoFuncAnchor):
+ (KJS::stringProtoFuncLink):
+ (KJS::StringObjectImp::StringObjectImp):
+ (KJS::StringObjectImp::construct):
+ (KJS::StringObjectImp::callAsFunction):
+ (KJS::StringObjectFuncImp::StringObjectFuncImp):
+ (KJS::StringObjectFuncImp::callAsFunction):
+ * kjs/string_object.h:
+ (KJS::StringInstanceThatMasqueradesAsUndefined::StringInstanceThatMasqueradesAsUndefined):
+ * kjs/testkjs.cpp:
+ (GlobalObject::GlobalObject):
+ (functionGC):
+ (functionRun):
+ (functionReadline):
+ (kjsmain):
+ * kjs/ustring.h:
+ * kjs/value.cpp:
+ (KJS::JSCell::operator new):
+ (KJS::jsString):
+ (KJS::jsOwnedString):
+ (KJS::jsNumberCell):
+ * kjs/value.h:
+ (KJS::jsNaN):
+ (KJS::jsNumber):
+ (KJS::jsNumberFromAnd):
+ (KJS::JSCell::marked):
+ (KJS::JSCell::mark):
+ (KJS::JSValue::toJSNumber):
+ Removed collectOnMainThreadOnly, as this is the only way to collect now. Replaced calls to
+ static Collector methods with calls to per-thread Heap ones.
+
+2008-05-02 Dan Bernstein <mitz@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ - Mac build fix
+
+ * wtf/StrHash.h: Added header guards and removed #include "config.h".
+
+2008-05-01 Ada Chan <adachan@apple.com>
+
+ #include <wtf/StrHash.h> in identifier.cpp.
+
+ Reviewed by Maciej.
+
+ * kjs/identifier.cpp:
+
+2008-05-01 Steve Falkenburg <sfalken@apple.com>
+
+ Build fix.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+
+2008-05-01 Sam Weinig <sam@webkit.org>
+
+ Fix build.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2008-05-01 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Darin.
+
+ <rdar://problem/5770054> JavaScript profiler (10928)
+ - Fix "sample" output so that it can be imported into Instruments
+ - Also keep track of number of times a function is profiled.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj: Add StrHash.h which needed
+ to be pulled out of identifier.cpp so that it could be used by the
+ profiler and identifiers.
+ * kjs/identifier.cpp: Ditto.
+ * profiler/FunctionCallProfile.cpp:
+ (KJS::FunctionCallProfile::printDataInspectorStyle): Inspector style
+ printing should show microseconds.
+ (KJS::FunctionCallProfile::printDataSampleStyle): Sample style printing
+ now counts the number of times a function is in the stack tree and does
+ not print microseconds since that does not make sense for a sampler.
+ * profiler/FunctionCallProfile.h: Keep track of number of times a
+ function is profiled.
+ (KJS::FunctionCallProfile::numberOfCalls):
+ * profiler/Profiler.cpp:
+ (KJS::functionNameCountPairComparator): Comparator for sort function in
+ printDataSampleStyle.
+ (KJS::Profiler::printDataSampleStyle): Print the number of times that a
+ function is listed in the stack tree in order of most times listed.
+ * wtf/HashCountedSet.h: Added copyToVector since it didn't exist and is
+ a more standard way to copy a HashSet to a Vector. I added on variant
+ that takes a pair as the Vector's type and so the HashCountedSet simply
+ fills in that pair with its internal pair, and another variant that
+ takes a Vector of the type of the HashCountedSet and only fills in the
+ Vector with the first element of the pair.
+ (WTF::copyToVector):
+ * wtf/StrHash.h: Added.
+ (WTF::):
+
+2008-04-29 David Kilzer <ddkilzer@apple.com>
+
+ BUILD FIX for ENABLE(DASHBOARD_SUPPORT)
+
+ * wtf/Platform.h: Defined ENABLE(DASHBOARD_SUPPORT) to 1 only for
+ PLATFORM(MAC) and PLATFORM(WIN). Changed default to 0 for other
+ ports.
+
+2008-04-29 Greg Bolsinga <bolsinga@apple.com>
+
+ Reviewed by Darin.
+
+ Wrapped Dashboard code with ENABLE(DASHBOARD_SUPPORT)
+
+ * wtf/Platform.h:
+
+2008-04-29 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Geoff.
+
+ -<rdar://problem/5770054> JavaScript profiler (10928)
+ -Keep call count.
+
+ * profiler/FunctionCallProfile.cpp:
+ (KJS::FunctionCallProfile::FunctionCallProfile):
+ (KJS::FunctionCallProfile::didExecute): Implements call count and fixed a bug where a stackIndex
+ of 0 was causing the assert to be hit.
+ (KJS::FunctionCallProfile::stopProfiling):
+ (KJS::FunctionCallProfile::endAndRecordCall):
+ * profiler/FunctionCallProfile.h:
+
+2008-04-29 Simon Hausmann <hausmann@webkit.org>
+
+ Qt/Windows build fix. The externally declared hash tables are actually
+ declared const and the const is mangled in the symbol name, so when
+ importing they also need to be marked const.
+
+ When compiling without MULTIPLE_THREADS use a const HashTable&
+ instead of a HashTable& in ThreadClassInfoHashTables to avoid
+ initializing the latter with a const reference.
+
+ * kjs/JSGlobalObject.cpp:
+
+2008-04-28 Alexey Proskuryakov <ap@webkit.org>
+
+ Windows build fix.
+
+ * kjs/ExecState.h: For whatever reason, MSVC couldn't generate a default constructor for
+ a struct that had a "const List" member. Removing the const qulifier makes the problem go away.
+
+2008-04-28 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Darin.
+
+ Fix run-webkit-tests --threading
+ and provisionally fix <https://bugs.webkit.org/show_bug.cgi?id=18661>
+ Proxy server issue in Sunday's Nightly
+
+ Changed ClassInfo objects for built-in objects to hold a getter function returning
+ a per-thread instance. This makes it safe to share these ClassInfo objects between threads -
+ and these are the only ones that need to be shared.
+
+ * kjs/lexer.cpp:
+ (KJS::Lexer::Lexer):
+ (KJS::Lexer::~Lexer):
+ * kjs/lexer.h:
+ Made mainTable a member of Lexer, so that it no longer needs to be shared between threads.
+
+ * kjs/object.cpp:
+ (KJS::JSObject::deleteProperty):
+ (KJS::JSObject::findPropertyHashEntry):
+ (KJS::JSObject::propertyIsEnumerable):
+ (KJS::JSObject::getPropertyAttributes):
+ (KJS::JSObject::getPropertyNames):
+ * kjs/object.h:
+ (KJS::ClassInfo::propHashTable):
+ Added a new classPropHashTableGetterFunction field to ClassInfo. If it is non-zero, the
+ static table is not used.
+
+ * kjs/JSGlobalObject.cpp:
+ (KJS::ThreadClassInfoHashTables::ThreadClassInfoHashTables): This new class holds per-thread
+ HashTables for built-in classes. The old static structs are copied to create per-thread
+ instances.
+ (KJS::JSGlobalObject::threadClassInfoHashTables): An accessor/initializer for the above.
+ (KJS::JSGlobalObject::init): Copy per-thread data into a single structure for faster access.
+ Also, construct globalExec.
+ (KJS::JSGlobalObject::reset): Adapted for globalExec now being an OwnPtr.
+ (KJS::JSGlobalObject::mark): Ditto.
+ (KJS::JSGlobalObject::globalExec): Ditto.
+ * kjs/JSGlobalObject.h:
+ (KJS::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData): Made JSGlobalObject::JSGlobalObjectData::globalExec an OwnPtr, so that it can
+ be initialized from JSGlobalObject::init() after them. Otherwise, ExecState constructor was
+ trying to access half-initialized JSGlobalObject to make its own copy of these table
+ references, and failed.
+ (KJS::JSGlobalObject::JSGlobalObject): Pass "this" value to init() to create globalExec.
+ (KJS::JSGlobalObject::perThreadData): An accessor for per-thread data.
+
+ * kjs/ExecState.cpp:
+ (KJS::ExecState::ExecState):
+ * kjs/ExecState.h:
+ (KJS::ExecState::propertyNames):
+ (KJS::ExecState::emptyList):
+ (KJS::ExecState::arrayTable):
+ (KJS::ExecState::dateTable):
+ (KJS::ExecState::mathTable):
+ (KJS::ExecState::numberTable):
+ (KJS::ExecState::RegExpImpTable):
+ (KJS::ExecState::RegExpObjectImpTable):
+ (KJS::ExecState::stringTable):
+ * kjs/ExecStateInlines.h:
+ (KJS::ExecState::ExecState):
+ Each ExecState holds its own reference to per-thread data, for even faster access. Moved
+ m_emptyList and m_propertyNames to the same structure, making ExecState faster to construct
+ and take less space on the stack.
+
+ * kjs/InitializeThreading.cpp: (KJS::initializeThreading): Initialize thread-static data
+ added to JSGlobalObject.
+
+ * API/JSCallbackConstructor.cpp:
+ * API/JSCallbackFunction.cpp:
+ * API/JSCallbackObject.cpp:
+ * JavaScriptCore.exp:
+ * kjs/JSVariableObject.cpp:
+ (KJS::JSVariableObject::getPropertyAttributes):
+ * kjs/JSVariableObject.h:
+ * kjs/array_instance.cpp:
+ * kjs/array_object.cpp:
+ (KJS::ArrayPrototype::getOwnPropertySlot):
+ * kjs/bool_object.cpp:
+ * kjs/create_hash_table:
+ * kjs/date_object.cpp:
+ (KJS::DatePrototype::getOwnPropertySlot):
+ (KJS::DateObjectImp::DateObjectImp):
+ * kjs/error_object.cpp:
+ * kjs/function.cpp:
+ * kjs/function_object.cpp:
+ (KJS::FunctionPrototype::FunctionPrototype):
+ * kjs/internal.cpp:
+ * kjs/lookup.h:
+ * kjs/math_object.cpp:
+ (KJS::MathObjectImp::getOwnPropertySlot):
+ * kjs/number_object.cpp:
+ (KJS::NumberObjectImp::getOwnPropertySlot):
+ * kjs/object_object.cpp:
+ (KJS::ObjectPrototype::ObjectPrototype):
+ * kjs/regexp_object.cpp:
+ (KJS::RegExpPrototype::RegExpPrototype):
+ (KJS::RegExpImp::getOwnPropertySlot):
+ (KJS::RegExpImp::put):
+ (KJS::RegExpObjectImp::getOwnPropertySlot):
+ (KJS::RegExpObjectImp::put):
+ * kjs/string_object.cpp:
+ (KJS::StringPrototype::getOwnPropertySlot):
+ Adjust for the above changes.
+
+2008-04-28 Darin Adler <darin@apple.com>
+
+ Reviewed by Adam.
+
+ - make sure RefPtr's default hash doesn't ref/deref when computing the hash
+ - remove remnants of the hash table storage type optimization
+
+ * wtf/HashFunctions.h: Used "using" to get the hash and equal functions
+ from PtrHash<P*> into PtrHash<RefPtr<P>>.
+
+ * wtf/HashMap.h: Replaced uses of PairBaseHashTraits with PairHashTraits.
+ Eliminated storage-related typedefs. Removed constructor, destructor,
+ copy constructor, and destructor since the compiler-generated ones are
+ fine. Removed refAll and derefAll. Took out unnnecessary typecasts.
+ Removed use of RefCounter.
+
+ * wtf/HashSet.h: Eliminated storage-related typedefs. Removed constructor,
+ destructor, copy constructor, and destructor since the compiler-generated
+ ones are fine. Removed refAll and derefAll. Removed unneeded template
+ arguents from HashSetTranslatorAdapter. Eliminated unneeded HashSetTranslator
+ template.
+
+ * wtf/HashTable.h: Tweaked formatting. Removed NeedsRef, RefCounterBase,
+ RefCounter, HashTableRefCounterBase, HashTableRefCounter, and Assigner
+ class templates.
+
+ * wtf/HashTraits.h: Removed StorageTraits, needsRef, PairBaseHashTraits,
+ and HashKeyStorageTraits.
+
+ * wtf/RefPtrHashMap.h: Made all the same fixes as in HashMap. Also made
+ the corresponding changes to RefPtrHashMapRawKeyTranslator.
+
+2008-04-28 Darin Adler <darin@apple.com>
+
+ Reviewed by Mitz.
+
+ - fix assertion hit every time you view www.apple.com
+
+ * kjs/PropertyNameArray.cpp:
+ (KJS::PropertyNameArray::add): Changed assertion to allow null and empty strings.
+ Now to find out why we have a property named "" and if that's a bug!
+
+2008-04-27 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Fix crash inside PtrHash::hash when loading a page.
+
+ * wtf/HashFunctions.h: Explicitly use the superclass implementation of hash to avoid infinite recursion.
+
+2008-04-27 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - fix <rdar://problem/5657459> REGRESSION: JavaScriptCore no longer builds with
+ GCC 4.2 due to pointer aliasing warnings
+
+ Fix this by removing the HashTable optimizations that allowed us to share a back end
+ implementation between hash tables with integers, pointers, RefPtr, and String objects
+ as keys. The way it worked was incompatible with strict aliasing.
+
+ This increases code size. On Mac OS X we'll have to regenerate .order files to avoid
+ slowing down Safari startup times.
+
+ This creates a slight slowdown in SunSpider, mitigated by the following four speedups:
+
+ - speed up array put slightly by moving a branch (was already done for get)
+
+ - speed up symbol table access by adding a function named inlineGet to HashMap
+ and using that in symbolTableGet/Put
+
+ - speed up PropertyNameArray creation by reducing the amount of reference count
+ churn and uniqueness checking when adding names and not doing any allocation at
+ all when building small arrays
+
+ - speed up conversion of strings to floating point numbers by eliminating the
+ malloc/free of the buffer for the ASCII copy of the string; a way to make
+ things even faster would be to change strtod to take a UTF-16 string
+
+ Note that there is considerable unused complexity now in HashSet/Map/Table to support
+ "storage types", which is no longer used. Will do in a separate patch.
+
+ * API/JSCallbackObjectFunctions.h:
+ (KJS::JSCallbackObject<Base>::getPropertyNames): Removed explicit cast to Identifier to
+ take advantage of the new PropertyNameArray::add overload and avoid reference count churn.
+ * API/JSObjectRef.cpp:
+ (JSPropertyNameAccumulatorAddName): Ditto.
+ * JavaScriptCore.exp: Updated PropertyNameArray::add entry point name.
+
+ * kjs/JSVariableObject.cpp: Removed now-unneeded IdentifierRepHashTraits::nullRepPtr
+ definition (see below).
+ (KJS::JSVariableObject::getPropertyNames): Removed explicit cast to Identifier.
+
+ * kjs/JSVariableObject.h:
+ (KJS::JSVariableObject::symbolTableGet): Use inlineGet for speed. Also changed to do
+ early exit instead of nesting the body inside an if.
+ (KJS::JSVariableObject::symbolTablePut): Ditto.
+
+ * kjs/PropertyNameArray.cpp:
+ (KJS::PropertyNameArray::add): Changed implementation to take a raw pointer instead of
+ a reference to an identifier. Do uniqueness checking by searching the vector when the
+ vector is short, only building the set once the vector is large enough.
+
+ * kjs/PropertyNameArray.h: Added an overload of add for a raw pointer, and made the old
+ add function call that one. Added an addKnownUnique function for use when the new
+ name is known to be different from any other in the array. Changed the vector to have
+ an inline capacity of 20.
+
+ * kjs/SymbolTable.h: Changed IdentifierRepHash to inherit from the default hash for
+ a RefPtr so we don't have to define so much. Added an overload of the hash function for
+ a raw pointer as required by the new RefPtrHashMap. Got rid of the now-unneeded
+ IdentifierRepHashTraits -- the default traits now work fine. Added a definition of
+ empthValueIsZero to SymbolTableIndexHashTraits; not having it was incorrect, but harmless.
+
+ * kjs/array_instance.cpp:
+ (KJS::ArrayInstance::put): Move the maxArrayIndex check inside the branch that checks
+ the index against the length, as done in the get function.
+
+ * kjs/function.cpp:
+ (KJS::globalFuncKJSPrint): Changed to use the new getCString instead of cstring.
+
+ * kjs/internal.cpp: Removed printInfo debugging function, a client of cstring.
+ If we need a debugging function we can easily make a better one and we haven't
+ used this one in a long time.
+ * kjs/internal.h: Ditto.
+
+ * kjs/object.cpp:
+ (KJS::JSObject::getPropertyNames): Removed explicit cast to Identifier.
+ * kjs/property_map.cpp:
+ (KJS::PropertyMap::getEnumerablePropertyNames): Ditto. Also added a special case for
+ the case where the propertyNames array is empty -- in that case we know we're adding
+ a set of names that are non-overlapping so we can use addKnownUnique.
+ * kjs/ustring.cpp:
+ (KJS::UString::getCString): Replaces cstring. Puts the C string into a CStringBuffer,
+ which is a char Vector with an inline capacity. Also returns a boolean to indicate if
+ the converion was lossy, which eliminates the need for a separate is8Bit call.
+ (KJS::UString::toDouble): Changed to call getCString instead of cstring.
+ * kjs/ustring.h: Ditto.
+
+ * wtf/HashFunctions.h: Overload the hash and equal functions for RefPtr's default
+ hash to take raw pointers. This works with the changes to RefPtrHashMap to avoid
+ introducing refcount churn.
+
+ * wtf/HashMap.h: Removed special code to convert the deleted value to the empty value
+ when writing a new value into the map. This is now handled elsewhere.
+ (WTF::HashMap::get): Removed code that checks for an empty hash table before calling
+ HashTable::lookup; it's slightly more efficient to do this check inside lookup.
+
+ * wtf/HashTable.h:
+ (WTF::HashTable::isDeletedBucket): Changed to use isDeletedValue instead of using
+ deletedValue and the equality operator.
+ (WTF::HashTable::deleteBucket): Changed to use constructDeletedValue instead of
+ using deletedValue and the assignment operator.
+ (WTF::HashTable::checkKey): Added. Factors out the check for values that are empty
+ or deleted keys that's used in various functions below.
+ (WTF::HashTable::lookup): Changed to use checkKey, check for a 0 table, and also
+ made public for use by RefPtrHashMap.
+ (WTF::HashTable::lookupForWriting): Changed to use checkKey.
+ (WTF::HashTable::fullLookupForWriting): Changed to use checkKey.
+ (WTF::HashTable::add): Changed to use checkKey, and call initializeBucket on a
+ deleted bucket before putting a new entry into it.
+ (WTF::HashTable::addPassingHashCode): Ditto.
+ (WTF::HashTable::deallocateTable): Check isDeletedBucket before calling ~ValueType.
+
+ * wtf/HashTraits.h: Got ridd of all the HashTraits specialization for the integer
+ types, since GeneicHashTraitsBase already deals with integers separately. Put the
+ deleted value support into GenericHashTraitsBase. Changed FloatHashTraits to
+ inherit from GenericHashTraits, and define construct/isDeletedValue rather than
+ deletedValue. Removed the ref and deref functions from RefPtr's HashTraits, and
+ defined construct/isDeletedValue. Eliminated DeletedValueAssigner. Changed
+ PairHashTraits to define construct/isDeletedValue, and also merged
+ PairBaseHashTraits in with PairHashTraits. Got rid of all specialization of
+ HashKeyStorageTraits. We'll remove that, and the needsRef data member, later.
+
+ * wtf/RefPtr.h: Added HashTableDeletedValueType, an enum type with a single value,
+ HashTableDeletedValue. Used that type to make a new constructor to construct
+ deleted values and also added an isHashTableDeletedValue function.
+
+ * wtf/RefPtrHashMap.h: Added RefPtrHashMapRawKeyTranslator and used it to implement
+ the raw pointer functions. This is a way to continue to avoid refcount thrash. We
+ can't use the old way because it depended on the underlying map using a non-RefPtr
+ type.
+ (WTF::HashMap::find): Use find with RefPtrHashMapRawKeyTranslator.
+ (WTF::HashMap::contains): Use contains with RefPtrHashMapRawKeyTranslator.
+ (WTF::HashMap::inlineAdd): Use add with RefPtrHashMapRawKeyTranslator.
+ (WTF::HashMap::get): Removed code that checks for an empty hash table before calling
+ HashTable::lookup; it's slightly more efficient to do this check inside lookup.
+ (WTF::HashMap::inlineGet): Added. Just like get, but marked inline for use in the
+ symbol table code.
+
+2008-04-25 Sam Weinig <sam@webkit.org>
+
+ Rubber-stamped by Mark Rowe.
+
+ Remove SavedBuiltins and SavedProperties classes and the methods used to
+ save data to them. The CachedPage now stores a the JSGlobalObject in full.
+
+ * JavaScriptCore.exp:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * kjs/JSGlobalObject.cpp:
+ * kjs/JSGlobalObject.h:
+ * kjs/JSVariableObject.cpp:
+ * kjs/JSVariableObject.h:
+ (KJS::JSVariableObject::localStorage):
+ * kjs/SavedBuiltins.h: Removed.
+ * kjs/object.h:
+ * kjs/property_map.cpp:
+ * kjs/property_map.h:
+
+2008-04-25 Mark Rowe <mrowe@apple.com>
+
+ Rubber-stamped by Sam Weinig.
+
+ Add some content to an empty ICU header file to prevent verification errors.
+
+ * icu/unicode/utf_old.h:
+
+2008-04-25 David Kilzer <ddkilzer@apple.com>
+
+ <rdar://problem/5819422> REGRESSION: Wrong line number passed to -willLeaveCallFrame
+
+ Patch by George Dicker and Michael Kahl. Reviewed by Darin.
+
+ When -[NSObject(WebScriptDebugDelegate) webView:willLeaveCallFrame:sourceId:line:forWebFrame:]
+ is invoked, the first line number of the function is returned instead of the last
+ line number. This regressed in r28458.
+
+ * kjs/nodes.cpp:
+ (KJS::FunctionBodyNodeWithDebuggerHooks::execute): Pass lastLine() instead of lineNo()
+ when calling Debugger::returnEvent().
+
+2008-04-25 Darin Adler <darin@apple.com>
+
+ Done with Stephanie Lewis.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj: Prepare for compilation with gcc 4.2 by
+ adding -fno-strict-aliasing to CollatorICU.cpp.
+
+2008-04-24 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ Add a #define to easily enable collecting on every allocation to aid
+ debugging GC bugs.
+
+ * kjs/collector.cpp:
+ (KJS::Collector::heapAllocate):
+
+2008-04-24 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Adam and Sam.
+
+ -<rdar://problem/5770054> JavaScript profiler (10928)
+ -Only profile the page group that starts profiling to avoid profiling
+ tools that shouldn't be profiled unless explicitly requested to.
+
+ * JavaScriptCore.exp: Export new signature.
+ * kjs/JSGlobalObject.cpp: Add unique identifiers to the JSGlobalObject.
+ (KJS::JSGlobalObject::init):
+ * kjs/JSGlobalObject.h: Ditto.
+ (KJS::JSGlobalObject::setPageGroupIdentifier):
+ (KJS::JSGlobalObject::pageGroupIdentifier):
+ * profiler/Profiler.cpp: Check the identifier of the page group of the
+ lexical global exec state and only profile if it matches the given page
+ group identifier.
+ (KJS::Profiler::startProfiling):
+ (KJS::Profiler::willExecute):
+ (KJS::Profiler::didExecute):
+ * profiler/Profiler.h: Ditto.
+ (KJS::Profiler::Profiler):
+
+2008-04-24 Julien Chaffraix <jchaffraix@webkit.org>
+
+ Reviewed by Simon.
+
+ Bug 15940: Implement threading API for Qt
+ https://bugs.webkit.org/show_bug.cgi?id=15940
+
+ Original patch by Justin Haygood, tweaked by me.
+
+ * JavaScriptCore.pri:
+ * wtf/ThreadingQt.cpp: Added.
+ (WTF::threadMapMutex):
+ (WTF::threadMap):
+ (WTF::establishIdentifierForThread):
+ (WTF::clearThreadForIdentifier):
+ (WTF::threadForIdentifier):
+ (WTF::initializeThreading):
+ (WTF::ThreadPrivate::getReturnValue):
+ (WTF::ThreadPrivate::ThreadPrivate):
+ (WTF::ThreadPrivate::run):
+ (WTF::createThread):
+ (WTF::waitForThreadCompletion): return !res to return
+ 0 on success (to match the pthreads implementation).
+ (WTF::detachThread):
+ (WTF::identifierByQthreadHandle):
+ (WTF::currentThread):
+ (WTF::Mutex::Mutex):
+ (WTF::Mutex::~Mutex):
+ (WTF::Mutex::lock):
+ (WTF::Mutex::tryLock):
+ (WTF::Mutex::unlock):
+ (WTF::ThreadCondition::ThreadCondition):
+ (WTF::ThreadCondition::~ThreadCondition):
+ (WTF::ThreadCondition::wait):
+ (WTF::ThreadCondition::timedWait):
+ (WTF::ThreadCondition::signal):
+
+2008-04-22 Darin Adler <darin@apple.com>
+
+ Reviewed by Anders.
+
+ - simplify use of HashTraits to prepare for some upcoming hash table changes
+
+ * kjs/SymbolTable.h: Made SymbolTableIndexHashTraits derive from HashTraits<size_t>
+ and specialize only the empty value.
+
+2008-04-23 Holger Hans Peter Freyther <zecke@selfish.org>
+
+ Reviewed by Simon.
+
+ Removed the #define for USE_SYSTEM_MALLOC that we set in WebKit.pri
+ already.
+
+ * wtf/Platform.h:
+
+2008-04-21 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Adam.
+
+ <rdar://problem/5770054> JavaScript profiler (10928)
+ - When stop profiling is called we need to stop the timers on all the
+ functions that are still running.
+
+ * profiler/FunctionCallProfile.cpp:
+ (KJS::FunctionCallProfile::didExecute):
+ (KJS::FunctionCallProfile::stopProfiling):
+ * profiler/FunctionCallProfile.h:
+ * profiler/Profiler.cpp:
+ (KJS::Profiler::stopProfiling):
+
+2008-04-21 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Darin.
+
+ Move collector main thread initialization from WebKit/win to KJS::initializeThreading.
+
+ * kjs/InitializeThreading.cpp:
+ (KJS::initializeThreading):
+
+2008-04-21 Adam Roben <aroben@apple.com>
+
+ MSVC build fix
+
+ Reviewed by Alexey Proskuryakov.
+
+ * kjs/ustring.h:
+ (KJS::UString::cost): Disable a warning about assigning a 32-bit
+ size_t into a 31-bit size_t.
+
+2008-04-21 Simon Hausmann <hausmann@webkit.org>
+
+ Reviewed by Lars.
+
+ Made convertValueToQVariant accessible from within WebKit/qt/Api
+
+ * bindings/qt/qt_runtime.h:
+
+2008-04-21 Holger Hans Peter Freyther <holger.freyther@trolltech.com>
+
+ Reviewed by Simon.
+
+ Build fix for Qt 4.3
+
+ * When building WebCore/internal make sure the QT_[BEGIN,END]_NAMESPACE is
+ always defined. Do this by adding defines to the compiler line
+ * For users of our API this is not feasible. Every public header file should
+ include qwebkitglobal.h. Define the QT_BEGIN_NAMESPACE and QT_END_NAMESPACE
+ when we are building everything < 4.4.0 and don't have them defined.
+
+ * kjs/testkjs.pro:
+
+2008-04-19 Matt Lilek <webkit@mattlilek.com>
+
+ Not reviewed, Windows build fix - copy the profiler headers in all
+ configurations, not just Debug_Internal.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+
+2008-04-19 Mike Hommey <glandium@debian.org>
+
+ Reviewed by Alp Toker.
+
+ Don't build testkjs with rpath.
+
+ * GNUmakefile.am:
+
+2008-04-18 Kevin Ollivier <kevino@theolliviers.com>
+
+ wx build fixes. Rename LocalStorage.h to LocalStorageEntry.h
+ to avoid header detection issues between WebCore/storage/LocalStorage.h
+ and it, and add $(PROFILER_SOURCES) to the wx JSCore build.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * jscore.bkl:
+ * kjs/ExecState.h:
+ * kjs/JSVariableObject.h:
+ * kjs/LocalStorage.h: Removed.
+ * kjs/LocalStorageEntry.h: Copied from JavaScriptCore/kjs/LocalStorage.h.
+ * kjs/function.h:
+
+2008-04-18 Jan Michael Alonzo <jmalonzo@unpluggable.com>
+
+ Reviewed by Alp Toker.
+
+ http://bugs.webkit.org/show_bug.cgi?id=16620
+ [GTK] Autotools make dist and make check support
+
+ Cleanups.
+
+ * GNUmakefile.am:
+
+2008-04-18 Jon Honeycutt <jhoneycutt@apple.com>
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Windows
+ build fix.
+
+2008-04-11 Mark Rowe <mrowe@apple.com>
+
+ Rubber-stamped by Antti Koivisto.
+
+ Silence GCC 4.3 warnings by removing extraneous consts.
+
+ * kjs/ustring.cpp:
+ * kjs/ustring.h:
+
+2008-04-18 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Sam.
+
+ -<rdar://problem/5770054> JavaScript profiler (10928)
+ - Use Deque instead of Vector since the profiler uses prepend a lot
+ and deque is faster at that.
+
+ * profiler/FunctionCallProfile.h:
+ (KJS::FunctionCallProfile::milliSecs): Corrected the name to match
+ its output.
+ * wtf/Deque.h:
+ (WTF::deleteAllValues):
+
+2008-04-18 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Sam and Adam.
+
+ -<rdar://problem/5770054> JavaScript profiler (10928)
+ - Cleaned up the header file and made some functions static, added
+ a new, sane, printing function, and fixed a few minor bugs.
+
+ * JavaScriptCore.exp:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * profiler/FunctionCallProfile.cpp:
+ (KJS::FunctionCallProfile::didExecute): Removed assertion that time is
+ > 0 because at ms resolution that may not be true and only cross-
+ platform way to get time differences is in ms.
+ (KJS::FunctionCallProfile::printDataInspectorStyle): Added a new
+ printing function for dumping data in a sane style.
+ (KJS::FunctionCallProfile::printDataSampleStyle): Fixed a bug where we
+ displayed too much precision when printing our floats. Also added logic
+ to make sure we don't display 0 because that doesn't make sense for a
+ sampling profile.
+ * profiler/FunctionCallProfile.h:
+ * profiler/Profiler.cpp: Moved functions that could be static into the
+ implementation, and chaned the ASSERTs to early returns. I did this
+ because console.profile() is a JS function and so was being profiled
+ but asserting because the profiler had not been started! In the future
+ I would like to put the ASSERTs back and not profile the calls to
+ console.profile() and console.profileEnd().
+ (KJS::Profiler::willExecute):
+ (KJS::Profiler::didExecute):
+ (KJS::getStackNames): Fixed a bug where the wrong ExecState was being
+ used.
+ (KJS::getFunctionName):
+ (KJS::Profiler::printDataInspectorStyle):
+ * profiler/Profiler.h:
+
+2008-04-18 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Darin.
+
+ Fix leaks during plugin tests (which actually excercise background JS), and potential
+ PAC brokenness that was not reported, but very likely.
+
+ The leaks shadowed a bigger problem with Identifier destruction. Identifier::remove involves
+ an IdentifierTable lookup, which is now a per-thread instance. Since garbage collection can
+ currently happen on a different thread than allocation, a wrong table was used.
+
+ No measurable change on SunSpider total, ~1% variation on individual tests.
+
+ * kjs/ustring.cpp:
+ (KJS::UString::Rep::create):
+ (KJS::UString::Rep::destroy):
+ * kjs/ustring.h:
+ Replaced isIdentifier with a pointer to IdentifierTable, so that destruction can be done
+ correctly. Took one bit from reportedCost, to avoid making UString::Rep larger (performance
+ effect was measurable on SunSpider).
+
+ * kjs/identifier.cpp:
+ (KJS::IdentifierTable::IdentifierTable):
+ (KJS::IdentifierTable::~IdentifierTable):
+ (KJS::IdentifierTable::add):
+ (KJS::IdentifierTable::remove):
+ Make IdentifierTable a real class. Its destructor needs to zero out outstanding references,
+ because some identifiers may briefly outlive it during thread destruction, and we don't want
+ them to use their stale pointers.
+
+ (KJS::LiteralIdentifierTable):
+ (KJS::Identifier::add):
+ Now that LiteralIdentifierTable is per-thread and can be destroyed not just during application
+ shutdown, it is not appropriate to simply bump refcount for strings that get there; changed
+ the table to hold RefPtrs.
+
+ (KJS::CStringTranslator::translate):
+ (KJS::UCharBufferTranslator::translate):
+ (KJS::Identifier::addSlowCase):
+ (KJS::Identifier::remove):
+ * kjs/identifier.h:
+ (KJS::Identifier::add):
+ Use and update UString::Rep::identifierTable as appropriate. Updating it is now done in
+ IdentifierTable::add, not in translators.
+
+2008-04-18 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Darin.
+
+ Get rid of static compareWithCompareFunctionArguments in array_instance.cpp.
+
+ No change on SunSpider, CelticKane or iBench JavaScript. It is probable that in some cases,
+ merge sort is still faster, but more investigation is needed to determine a new cutoff.
+ Or possibly, it would be better to do what FIXME says (change to tree sort).
+
+ Also, made arguments a local variable - not sure why it was a member of
+ CompareWithCompareFunctionArguments.
+
+ * kjs/array_instance.cpp:
+ (KJS::CompareWithCompareFunctionArguments::CompareWithCompareFunctionArguments):
+ (KJS::CompareWithCompareFunctionArguments::operator()):
+ (KJS::ArrayInstance::sort):
+
+2008-04-18 Simon Hausmann <hausmann@webkit.org>
+
+ Build fix for gcc 4.3. Include stdio.h for printf.
+
+ * profiler/FunctionCallProfile.cpp:
+ * profiler/Profiler.cpp:
+
+2008-04-17 Jon Honeycutt <jhoneycutt@apple.com>
+
+ Reviewed by mrowe.
+
+ * wtf/Platform.h: Add HAVE_ACCESSIBILITY to Platform.h.
+
+2008-04-17 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Maciej.
+
+ Thread static data destructors are not guaranteed to be called in any particular order;
+ turn ThreadSpecific into a phoenix-style singleton to avoid accessing freed memory when
+ deleted objects are interdependent (e.g. CommonIdentifiers and internal identifier tables).
+
+ No change on SunSpider.
+
+ * wtf/ThreadSpecific.h:
+ (WTF::ThreadSpecific::Data::Data):
+ (WTF::::get):
+ (WTF::::set):
+ (WTF::::destroy):
+
+2008-04-15 Srinivas Rao. M Hamse <msrinirao@gmail.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ - gcc 3.x build fix
+
+ * kjs/nodes.h: CallerType definition made public for gcc 3.x compilation
+
+2008-04-16 Brady Eidson <beidson@apple.com>
+
+ Reviewed by Sam Weinig
+
+ Change ThreadSafeShared to act like RefCounted by starting out with a single ref by default
+
+ * wtf/Threading.h:
+ (WTF::ThreadSafeShared::ThreadSafeShared):
+
+2008-04-16 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ - To keep the behavior of the WebKit and JavaScriptCore API's the same,
+ we need to hide the fact that the global object and the window object
+ are no longer the same thing, and the the global object now changes on
+ navigations. To do this, only the wrapper should ever be exposed. This
+ fixes the two remaining spots where the internal global object is exposed,
+ the windowScriptObject returned from [WebFrame windowObject] and the object
+ return by calling JSContextGetGlobalObject on [WebFrame globalContext].
+
+ * API/JSContextRef.cpp:
+ (JSContextGetGlobalObject):
+ This is a bit of a hack, this returns the "this" representation of the globalObject
+ which will be the WrapperWindow for WebCore and the globalObject for non-WebCore.
+
+ * API/JSObjectRef.cpp:
+ (JSObjectSetProperty):
+ Call the new putWithAttributes method instead of relying on lower-level calls.
+ This is needed so that the window wrapper can forward the calls.
+
+ * JavaScriptCore.exp:
+ * kjs/Activation.h:
+ * kjs/JSGlobalObject.cpp:
+ (KJS::JSGlobalObject::putWithAttributes):
+ * kjs/JSGlobalObject.h:
+ * kjs/JSVariableObject.h:
+ (KJS::JSVariableObject::symbolTablePutWithAttributes):
+ * kjs/function.cpp:
+ (KJS::ActivationImp::putWithAttributes):
+ * kjs/nodes.cpp:
+ (KJS::ConstDeclNode::handleSlowCase):
+ (KJS::ConstDeclNode::evaluateSingle):
+ (KJS::EvalNode::processDeclarations):
+ * kjs/object.cpp:
+ (KJS::JSObject::putWithAttributes):
+ * kjs/object.h:
+ Rename initializeVariable to putWithAttributes and move it down to JSObject so it
+ can be used for JSObjectSetProperty.
+
+2008-04-16 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Sam and Geoff.
+
+ -<rdar://problem/5770054> JavaScript profiler (10928)
+ Inital profiler prototype
+
+ * GNUmakefile.am: Added new files to project
+ * JavaScriptCore.pri: Ditto
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Ditto
+ * JavaScriptCore.xcodeproj/project.pbxproj: Ditto
+ * JavaScriptCoreSources.bkl: Ditto
+ * kjs/config.h: Put compiling flag in here.
+ * kjs/function.cpp: Instrument calling the function eval().
+ (KJS::eval):
+ * kjs/interpreter.cpp: Instrument evaluating global scopes.
+ (KJS::Interpreter::evaluate):
+ * kjs/object.cpp: Instrument JS function calls.
+ (KJS::JSObject::call):
+ * profiler: Added.
+ * profiler/FunctionCallProfile.cpp: Added.
+ (KJS::FunctionCallProfile::FunctionCallProfile):
+ (KJS::FunctionCallProfile::~FunctionCallProfile):
+ (KJS::FunctionCallProfile::willExecute): Call right before the JS function or executing context is executed to start the profiler's timer.
+ (KJS::FunctionCallProfile::didExecute): Call right after the JS function or executing context is executed to stop the profiler's timer.
+ (KJS::FunctionCallProfile::addChild): Add a child to the current FunctionCallProfile if it isn't already a child of the current FunctionalCallProfile.
+ (KJS::FunctionCallProfile::findChild): Return the child that matches the given name if there is one.
+ (KJS::FunctionCallProfile::printDataSampleStyle): Print the current profiled information in a format that matches sample's output.
+ * profiler/FunctionCallProfile.h: Added.
+ (KJS::FunctionCallProfile::FunctionCallProfile):
+ (KJS::FunctionCallProfile::~FunctionCallProfile):
+ (KJS::FunctionCallProfile::functionName):
+ (KJS::FunctionCallProfile::microSecs):
+ * profiler/Profiler.cpp: Added.
+ (KJS::Profiler::profiler):
+ (KJS::Profiler::sharedProfiler): Return global singleton (may change due to multi-threading concerns)
+ (KJS::Profiler::startProfiling): Don't start collecting profiling information until the user starts the profiler. Also don't clear old prfiled data until the profiler is restarted.
+ (KJS::Profiler::stopProfiling): Stop collecting profile information.
+ (KJS::Profiler::willExecute): Same as above.
+ (KJS::Profiler::didExecute): Same as above.
+ (KJS::Profiler::insertStackNamesInTree): Follow the stack of the given names and if a sub-stack is not in the current tree, add it.
+ (KJS::Profiler::getStackNames): Get the names from the different passed in parameters and order them as a stack.
+ (KJS::Profiler::getFunctionName): Get the function name from the given parameter.
+ (KJS::Profiler::printDataSampleStyle): Print the current profiled information in a format that matches sample's output.
+ (KJS::Profiler::debugLog):
+ * profiler/Profiler.h: Added.
+ (KJS::Profiler::Profiler):
+
+2008-04-16 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ - Remove kjs_ prefix from strtod, dtoa, and freedtoa and put it
+ in the KJS namespace.
+ - Make strtod, dtoa, and freedtoa c++ functions instead of extern "C".
+ - Remove mode switching from dtoa. ~2% improvement on test 26.
+ - Removes all unnecessary #defines from dtoa code.
+
+ * JavaScriptCore.exp:
+ * kjs/dtoa.cpp:
+ (KJS::ulp):
+ (KJS::b2d):
+ (KJS::d2b):
+ (KJS::ratio):
+ (KJS::strtod):
+ (KJS::freedtoa):
+ (KJS::dtoa):
+ * kjs/dtoa.h:
+ * kjs/function.cpp:
+ (KJS::parseInt):
+ * kjs/lexer.cpp:
+ (KJS::Lexer::lex):
+ * kjs/number_object.cpp:
+ (KJS::integer_part_noexp):
+ (KJS::numberProtoFuncToExponential):
+ * kjs/ustring.cpp:
+ (KJS::UString::from):
+ (KJS::UString::toDouble):
+
+2008-04-16 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Darin.
+
+ Get rid of static execForCompareByStringForQSort in array_instance.cpp.
+
+ No change on SunSpider, CelticKane or iBench JavaScript.
+
+ * kjs/array_instance.cpp:
+ (KJS::ArraySortComparator::ArraySortComparator):
+ (KJS::ArraySortComparator::operator()):
+ (KJS::ArrayInstance::sort):
+ Switch slow case to std::sort, so that ExecState can be passed in a comparator.
+
+2008-04-16 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Adam Roben.
+
+ MSVC build fix.
+
+ * kjs/CommonIdentifiers.cpp:
+ * kjs/CommonIdentifiers.h:
+ * kjs/Parser.cpp:
+ * kjs/Parser.h:
+ * kjs/identifier.cpp:
+ * kjs/lexer.h:
+ * wtf/ThreadSpecific.h:
+
+2008-04-16 Alexey Proskuryakov <ap@webkit.org>
+
+ Build fix.
+
+ * kjs/date_object.cpp:
+ * kjs/date_object.h:
+ Don't include DateMath.h from date_object.h, as the latter is used from WebCore, while
+ where the former is not available.
+
+2008-04-16 Holger Hans Peter Freyther <zecke@selfish.org>
+
+ Unreviewed build fix for MSVC. It does not want to have
+ WTF in the KJS namespace.
+
+ * kjs/CommonIdentifiers.h:
+
+2008-04-16 Holger Hans Peter Freyther <zecke@selfish.org>
+
+ Unreviewed build fix for gcc.
+
+ ::msToGregorianDateTime is not known to it.
+
+ * kjs/date_object.cpp:
+ (KJS::DateInstance::msToGregorianDateTime):
+
+2008-04-16 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Oliver Hunt.
+
+ Initialize threadMapMutex safely (as already done in ThreadingWin).
+
+ * wtf/ThreadingGtk.cpp:
+ (WTF::threadMapMutex):
+ (WTF::initializeThreading):
+ * wtf/ThreadingPthreads.cpp:
+ (WTF::threadMapMutex):
+ (WTF::initializeThreading):
+
+2008-04-16 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Adam Roben.
+
+ Cache Gregorian date/time structure on DateInstance objects for 1.027x SunSpider speedup
+ (1.65x on date-format-xparb, 1.13x on date-format-tofte).
+
+ * kjs/DateMath.h:
+ (KJS::GregorianDateTime::copyFrom): Added. It presumably makes sense to keep GregorianDateTime
+ Noncopyable, so it's not just operator=.
+
+ * kjs/date_object.h: Added a per-object cache.
+
+ * kjs/date_object.cpp:
+ (KJS::DateInstance::DateInstance):
+ (KJS::DateInstance::msToGregorianDateTime):
+ (KJS::dateProtoFuncToString):
+ (KJS::dateProtoFuncToUTCString):
+ (KJS::dateProtoFuncToDateString):
+ (KJS::dateProtoFuncToTimeString):
+ (KJS::dateProtoFuncToLocaleString):
+ (KJS::dateProtoFuncToLocaleDateString):
+ (KJS::dateProtoFuncToLocaleTimeString):
+ (KJS::dateProtoFuncGetFullYear):
+ (KJS::dateProtoFuncGetUTCFullYear):
+ (KJS::dateProtoFuncToGMTString):
+ (KJS::dateProtoFuncGetMonth):
+ (KJS::dateProtoFuncGetUTCMonth):
+ (KJS::dateProtoFuncGetDate):
+ (KJS::dateProtoFuncGetUTCDate):
+ (KJS::dateProtoFuncGetDay):
+ (KJS::dateProtoFuncGetUTCDay):
+ (KJS::dateProtoFuncGetHours):
+ (KJS::dateProtoFuncGetUTCHours):
+ (KJS::dateProtoFuncGetMinutes):
+ (KJS::dateProtoFuncGetUTCMinutes):
+ (KJS::dateProtoFuncGetSeconds):
+ (KJS::dateProtoFuncGetUTCSeconds):
+ (KJS::dateProtoFuncGetTimezoneOffset):
+ (KJS::setNewValueFromTimeArgs):
+ (KJS::setNewValueFromDateArgs):
+ (KJS::dateProtoFuncSetYear):
+ (KJS::dateProtoFuncGetYear):
+ Use the cache when converting.
+
+2008-04-16 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Darin.
+
+ Implement an abstraction for thread-specific storage, use it to get rid of some static objects.
+
+ SunSpider results were not conclusive, possibly up to 0.2% slowdown.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ Added ThreadSpecific.h
+
+ * wtf/ThreadSpecific.h: Added.
+ (WTF::::ThreadSpecific):
+ (WTF::::~ThreadSpecific):
+ (WTF::::get):
+ (WTF::::set):
+ (WTF::::destroy):
+ (WTF::T):
+ (WTF::::operator):
+ Only implemented for platforms that use pthreads.
+
+ * kjs/CommonIdentifiers.cpp:
+ (KJS::CommonIdentifiers::shared):
+ * kjs/CommonIdentifiers.h:
+ * kjs/InitializeThreading.cpp:
+ (KJS::initializeThreading):
+ * kjs/Parser.cpp:
+ (KJS::parser):
+ * kjs/Parser.h:
+ * kjs/identifier.cpp:
+ (KJS::identifierTable):
+ (KJS::literalIdentifierTable):
+ (KJS::Identifier::initializeIdentifierThreading):
+ * kjs/identifier.h:
+ * kjs/lexer.cpp:
+ (KJS::lexer):
+ * kjs/lexer.h:
+ Make static instances per-thread.
+
+2008-04-15 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Adam.
+
+ Add ENABLE_OFFLINE_WEB_APPLICATIONS to FEATURE_DEFINES.
+
+ * Configurations/JavaScriptCore.xcconfig:
+
+2008-04-15 Andre Poenitz <andre.poenitz@trolltech.com>
+
+ Reviewed by Simon.
+
+ Fix compilation with Qt namespaces
+
+ Qt can be configured to have all of its classes inside a specified namespaces.
+ This is for example used in plugin/component environments like Eclipse.
+
+ This change makes it possible to let the Qt port compile against a namespaced
+ Qt by the use of macros Qt provides to properly forward declare Qt classes in
+ the namespace.
+
+ * wtf/unicode/qt4/UnicodeQt4.h:
+
+2008-04-14 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Adam.
+
+ Don't leak the prototype class.
+
+ * API/JSClassRef.cpp:
+ (OpaqueJSClass::create):
+
+2008-04-14 Steve Falkenburg <sfalken@apple.com>
+
+ Fix build.
+
+ * wtf/ThreadingWin.cpp:
+
+2008-04-14 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Adam Roben.
+
+ https://bugs.webkit.org/show_bug.cgi?id=18488
+ FastMalloc doesn't release thread-specific data on Windows
+
+ * wtf/ThreadingWin.cpp:
+ (WTF::threadMapMutex): (WTF::initializeThreading): Call threadMapMutex once to initialize the static safely.
+ (WTF::ThreadFunctionInvocation::ThreadFunctionInvocation): Added a structure to wrap thread entry point and arguments.
+ (WTF::wtfThreadEntryPoint): Make sure to end all WTF threads with pthread_exit(), to give pthreads-win32 a chance to call
+ destructors of thread-specific data.
+ (WTF::createThread): Use _beginthreadex instead of CreateThread, because MSDN says so. Also removed a call to CreateEvent,
+ for which I could see no reason at all.
+
+2008-04-14 Alexey Proskuryakov <ap@webkit.org>
+
+ Touched a file to make JavaScriptCore.vcproj rebuild.
+
+ * wtf/MathExtras.h:
+
+2008-04-14 Adam Roben <aroben@apple.com>
+
+ Windows build fix
+
+ Rubberstamped by Alexey Proskuryakov.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Disable
+ the "potentially uninitialized variable" warning for grammar.cpp, as
+ it seems to be incorrect. yylval gets initialized by the lexer, but
+ MSVC doesn't seem to understand this.
+
+2008-04-11 Antti Koivisto <antti@apple.com>
+
+ Reviewed by Maciej.
+
+ Add default hash for pairs of hashable types.
+
+ * wtf/HashFunctions.h:
+ (WTF::PairHash::hash):
+ (WTF::PairHash::equal):
+ (WTF::):
+
+2008-04-11 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Geoff.
+
+ Make DateMath.cpp thread safe.
+
+ No measurable change on SunSpider (should be a very small speedup).
+
+ * kjs/DateMath.cpp:
+ (KJS::mimimumYearForDST): (KJS::equivalentYearForDST): Got rid of double caching of the
+ same precomputed value.
+ (KJS::calculateUTCOffset): (KJS::getUTCOffset): Factored actual UTC offset calculation code
+ out of getUTCOffset(), and notification setup into initDateMath().
+
+ (KJS::initDateMath): Added.
+
+ * kjs/DateMath.h:
+ * kjs/InitializeThreading.cpp:
+ (KJS::initializeThreading):
+ Added initDateMath().
+
+2008-04-11 Alexey Proskuryakov <ap@webkit.org>
+
+ Windows build fix.
+
+ * kjs/grammar.y:
+
+2008-04-11 Alexey Proskuryakov <ap@webkit.org>
+
+ Tiger build fix. Forward declaring a union didn't work for whatever reason, make the
+ parameters void*.
+
+ * kjs/grammar.y:
+ * kjs/lexer.cpp:
+ (kjsyylex):
+ (KJS::Lexer::lex):
+ * kjs/lexer.h:
+
+2008-04-11 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Geoff.
+
+ Generate a pure (re-entrant) parser with Bison.
+
+ No change on SunSpider.
+
+ * kjs/Parser.cpp:
+ (KJS::Parser::parse):
+ * kjs/grammar.y:
+ * kjs/lexer.cpp:
+ (kjsyylex):
+ (KJS::Lexer::lex):
+ * kjs/lexer.h:
+ Pass state as function arguments, instead of global data. Don't call lexer() as often as
+ before, as this function is about to become slower due to thread-specific storage.
+
+ * kjs/function.cpp:
+ (KJS::isStrWhiteSpace): Don't call isSeparatorSpace() for 8-bit characters, as these are
+ already taken care of. This is a small speedup, compensating for a small slowdown caused
+ by switching Bison mode.
+
+2008-04-10 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Geoff.
+
+ https://bugs.webkit.org/show_bug.cgi?id=18402
+ REGRESSION: visited element handling is incorrect in nested join/toString calls
+
+ No change on SunSpider total, possibly a tiny improvement (about 0.1%).
+
+ Test: fast/js/array-tostring-and-join.html
+
+ * kjs/JSGlobalObject.h:
+ (KJS::JSGlobalObject::visitedElements): Store visited elements HashSet here, making it
+ common to toString/toLocalizedString/join again.
+
+ * kjs/array_object.cpp:
+ (KJS::arrayProtoFuncToString):
+ (KJS::arrayProtoFuncToLocaleString):
+ (KJS::arrayProtoFuncJoin):
+ Got rid of static variables. Replaced UString with Vector to avoid O(n^2) behavior and
+ regain performance.
+
+ * wtf/Vector.h:
+ (WTF::::resize):
+ (WTF::::grow):
+ (WTF::::reserveCapacity):
+ (WTF::::append):
+ (WTF::::insert):
+ Added null checks, so that Vector methods don't crash when out of memory. The caller should
+ check that data pointer is not null before proceeding.
+
+2008-04-10 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Fix https://bugs.webkit.org/show_bug.cgi?id=18367 and the many dupes.
+ Bug 18367: Crash during celtic kane js speed 2007 test
+
+ GCC 4.2 on x86_64 Linux decided to reorder the local variables in markCurrentThreadConservatively's
+ stack frame. This lead to the range of addresses the collector treated as stack to exclude the
+ contents of volatile registers that markCurrentThreadConservatively forces onto the stack. This was
+ leading to objects being prematurely collected if the only reference to them was via a register at
+ the time a collection occurred.
+
+ The fix for this is to move the calculation of the top of the stack into a NEVER_INLINE function
+ that is called from markCurrentThreadConservatively. This forces the dummy variable we use for
+ determining the top of stack to be in a different stack frame which prevents the compiler from
+ reordering it relative to the registers that markCurrentThreadConservatively forces onto the stack.
+
+ * kjs/collector.cpp:
+ (KJS::Collector::markCurrentThreadConservativelyInternal):
+ (KJS::Collector::markCurrentThreadConservatively):
+ * kjs/collector.h:
+
+2008-04-10 Adam Roben <aroben@apple.com>
+
+ VC++ Express build fix
+
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj: Link against user32.lib so
+ that anyone who links against WTF.lib will get user32.lib
+ automatically.
+
+2008-04-09 Adam Roben <aroben@apple.com>
+
+ VC++ Express build fix
+
+ * JavaScriptCore.vcproj/testkjs/testkjs.vcproj: Link against
+ user32.lib.
+
+2008-04-09 Adam Roben <aroben@apple.com>
+
+ Build fix
+
+ * JavaScriptCore.exp: Export isMainThread.
+
+2008-04-09 Adam Roben <aroben@apple.com>
+
+ Build fix
+
+ * wtf/AlwaysInline.h: Make sure to #include Platform.h before using
+ the macros it defines.
+
+2008-04-08 Mark Rowe <mrowe@apple.com>
+
+ Export WTF::initializeThreading() from JavaScriptCore.
+
+ * JavaScriptCore.exp:
+
+2008-04-04 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ First step in implementing the "split window"
+
+ - Add a GlobalThisValue to ExecState which should be used
+ in places that used to implement the "use the global object
+ as this if null" rule.
+ - Factor out lookupGetter/lookupSetter into virtual methods
+ on JSObject so that they can be forwarded.
+ - Make defineGetter/defineSetter virtual methods for the same
+ reason.
+ - Have PrototypeReflexiveFunction store the globalObject used
+ to create it so that it can be used to get the correct thisObject
+ for eval.
+
+ * API/JSObjectRef.cpp:
+ (JSObjectCallAsFunction):
+ * JavaScriptCore.exp:
+ * kjs/Activation.h:
+ * kjs/ExecState.cpp:
+ (KJS::ExecState::ExecState):
+ (KJS::GlobalExecState::GlobalExecState):
+ * kjs/ExecState.h:
+ (KJS::ExecState::globalThisValue):
+ * kjs/ExecStateInlines.h:
+ (KJS::ExecState::ExecState):
+ (KJS::FunctionExecState::FunctionExecState):
+ * kjs/JSGlobalObject.cpp:
+ (KJS::JSGlobalObject::reset):
+ (KJS::JSGlobalObject::toGlobalObject):
+ * kjs/JSGlobalObject.h:
+ (KJS::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData):
+ (KJS::JSGlobalObject::JSGlobalObject):
+ * kjs/array_instance.cpp:
+ (KJS::CompareWithCompareFunctionArguments::CompareWithCompareFunctionArguments):
+ (KJS::compareWithCompareFunctionForQSort):
+ * kjs/array_object.cpp:
+ (KJS::arrayProtoFuncSort):
+ (KJS::arrayProtoFuncFilter):
+ (KJS::arrayProtoFuncMap):
+ (KJS::arrayProtoFuncEvery):
+ (KJS::arrayProtoFuncForEach):
+ (KJS::arrayProtoFuncSome):
+ * kjs/function.cpp:
+ (KJS::FunctionImp::callAsFunction):
+ (KJS::ActivationImp::toThisObject):
+ (KJS::globalFuncEval):
+ (KJS::PrototypeReflexiveFunction::PrototypeReflexiveFunction):
+ (KJS::PrototypeReflexiveFunction::mark):
+ * kjs/function.h:
+ (KJS::PrototypeReflexiveFunction::cachedGlobalObject):
+ * kjs/function_object.cpp:
+ (KJS::functionProtoFuncApply):
+ (KJS::functionProtoFuncCall):
+ * kjs/nodes.cpp:
+ (KJS::ExpressionNode::resolveAndCall):
+ (KJS::FunctionCallValueNode::evaluate):
+ (KJS::LocalVarFunctionCallNode::inlineEvaluate):
+ (KJS::ScopedVarFunctionCallNode::inlineEvaluate):
+ (KJS::FunctionCallBracketNode::evaluate):
+ (KJS::FunctionCallDotNode::inlineEvaluate):
+ * kjs/object.cpp:
+ (KJS::JSObject::call):
+ (KJS::JSObject::put):
+ (KJS::tryGetAndCallProperty):
+ (KJS::JSObject::lookupGetter):
+ (KJS::JSObject::lookupSetter):
+ (KJS::JSObject::toThisObject):
+ (KJS::JSObject::toGlobalObject):
+ (KJS::JSObject::fillGetterPropertySlot):
+ * kjs/object.h:
+ * kjs/object_object.cpp:
+ (KJS::objectProtoFuncLookupGetter):
+ (KJS::objectProtoFuncLookupSetter):
+ * kjs/string_object.cpp:
+ (KJS::replace):
+
+2008-04-08 Brady Eidson <beidson@apple.com>
+
+ Encourage Windows to rebuild - AGAIN...
+
+ * kjs/DateMath.cpp:
+
+2008-04-08 Adam Roben <aroben@apple.com>
+
+ Mac build fix
+
+ * JavaScriptCore.exp: Add callOnMainThread, and sorted the list.
+
+2008-04-08 Brady Eidson <beidson@apple.com>
+
+ Rubberstamped by Adam Roben
+
+ Touch some files to *strongly* encourage Windows to rebuilt with DOM_STORAGE enabled
+
+ * kjs/DateMath.cpp:
+
+2008-04-08 Adam Roben <aroben@apple.com>
+
+ Move callOnMainThread to WTF
+
+ Reviewed by Alexey Proskuryakov.
+
+ * GNUmakefile.am:
+ * JavaScriptCore.pri:
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * JavaScriptCoreSources.bkl:
+ Added new files.
+
+ * wtf/MainThread.cpp:
+ * wtf/MainThread.h:
+ * wtf/gtk/MainThreadGtk.cpp:
+ * wtf/mac/MainThreadMac.mm:
+ * wtf/qt/MainThreadQt.cpp:
+ * wtf/win/MainThreadWin.cpp:
+ * wtf/wx/MainThreadWx.cpp:
+ Moved here from WebCore/platform. Replaced all instances of "WebCore"
+ with "WTF".
+
+ * kjs/bool_object.cpp: Touched to force JavaScriptCore.vcproj to
+ build.
+ to the WTF namespace.
+ * wtf/ThreadingWin.cpp:
+ (WTF::initializeThreading): Call initializeMainThread.
+
+2008-04-07 Brady Eidson <beidson@apple.com>
+
+ Add "ENABLE_DOM_STORAGE" to keep in sync with the rest of the project
+
+ * Configurations/JavaScriptCore.xcconfig:
+
+2008-04-07 Adam Roben <aroben@apple.com>
+
+ Windows build fix
+
+ * wtf/ThreadingWin.cpp: Back out some changes I didn't mean to land.
+
+2008-04-07 Adam Roben <aroben@apple.com>
+
+ Add WTF::isMainThread
+
+ Reviewed by Alexey Proskuryakov.
+
+ * wtf/Threading.h: Declare the new function.
+ * wtf/ThreadingGtk.cpp:
+ (WTF::initializeThreading): Initialize the main thread identifier.
+ (WTF::isMainThread): Added.
+ * wtf/ThreadingNone.cpp: Ditto ThreadingGtk.cpp.
+ (WTF::initializeThreading):
+ (WTF::isMainThread):
+ * wtf/ThreadingPthreads.cpp: Ditto.
+ (WTF::initializeThreading):
+ (WTF::isMainThread):
+ * wtf/ThreadingWin.cpp: Ditto.
+ (WTF::initializeThreading):
+ (WTF::isMainThread):
+
+2008-04-06 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Darin.
+
+ Make UString thread-safe.
+
+ No change on SunSpider total, although individual tests have changed a lot, up to 3%.
+
+ * kjs/InitializeThreading.cpp: (KJS::initializeThreading): Call UString::null() to initialize
+ a static.
+
+ * kjs/identifier.cpp:
+ (KJS::CStringTranslator::translate):
+ (KJS::UCharBufferTranslator::translate):
+ Use "true" for a boolean value instead of 1, because it's C++.
+
+ * kjs/ustring.h:
+ (KJS::CString::adopt): Added a method to create from a char* buffer without copying.
+ (KJS::UString::Rep::ref): Removed an assertion for JSLock::lockCount, as it's no longer
+ necessary to hold JSLock when working with strings.
+ (KJS::UString::Rep::deref): Ditto.
+ (KJS::UString::Rep::isStatic): Added a field to quickly determine that this is an empty
+ or null static string.
+
+ * kjs/ustring.cpp:
+ (KJS::): Removed normalStatBufferSize and statBufferSize, as there is no reason to have such
+ an advanced implementation of a debug-only ascii() method. Removed a long-obsolete comment
+ about UChar.
+ (KJS::UString::Rep::createCopying): Removed an assertion for JSLock::lockCount.
+ (KJS::UString::Rep::create): Ditto.
+ (KJS::UString::Rep::destroy): Ditto. Do not do anything for static null and empty strings,
+ as refcounting is not reliable for those. Reordered branches for a noticeable speed gain -
+ apparently this functiton is hot enough for SunSpider to see an effect from this!
+ (KJS::UString::null): Moved a star, added a comment.
+ (KJS::UString::cstring): Reimplemented to not call ascii(), which is not thread-safe.
+ (KJS::UString::ascii): Simplified statBuffer handling logic.
+ (KJS::UString::toDouble): Use cstring() instead of ascii().
+
+2008-04-02 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Ensure that debug symbols are generated for x86_64 and ppc64 builds.
+
+ * Configurations/Base.xcconfig:
+
+2008-04-01 Christian Dywan <christian@imendio.com>
+
+ Build fix for GCC 4.3.
+
+ * wtf/unicode/icu/CollatorICU.cpp: include string.h
+
+2008-04-01 Alexey Proskuryakov <ap@webkit.org>
+
+ Rubber-stamped by Darin.
+
+ Turn off using 64-bit arithmetic on 32-bit hardware, as dtoa own code is faster than
+ compiler-provided emulation.
+
+ 1% speedup on Acid3 test 26.
+
+ * kjs/dtoa.cpp:
+
+2008-04-01 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Darin.
+
+ Make MathExtras.h thread safe.
+
+ * kjs/math_object.cpp:
+ (KJS::mathProtoFuncRandom): If threading is enabled, rely on initializeThreading to call
+ wtf_random_init().
+
+ * wtf/Threading.h:
+ * wtf/ThreadingGtk.cpp:
+ (WTF::initializeThreading):
+ * wtf/ThreadingNone.cpp:
+ (WTF::initializeThreading):
+ * wtf/ThreadingPthreads.cpp:
+ (WTF::initializeThreading):
+ * wtf/ThreadingWin.cpp:
+ (WTF::initializeThreading):
+ Call wtf_random_init(); made the function non-inline to avoid having to include too many
+ headers in Threading.h.
+
+2008-03-31 Eric Seidel <eric@webkit.org>
+
+ Reviewed by darin.
+
+ Make matching of regexps using ^ much faster
+ http://bugs.webkit.org/show_bug.cgi?id=18086
+
+ * pcre/pcre_compile.cpp:
+ (compileBranch):
+ (branchNeedsLineStart):
+ * pcre/pcre_exec.cpp:
+ (match):
+ (jsRegExpExecute):
+ * pcre/pcre_internal.h:
+
+2008-03-29 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Oliver Hunt.
+
+ <rdar://problem/5829556> REGRESSION: Leak in KJS::initializeThreading()
+
+ * kjs/InitializeThreading.cpp: (KJS::initializeThreading): There is no guarantee that
+ initializeThreading() is called only once; check that the mutex hasn't been already allocated.
+
+2008-03-29 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff.
+
+ Bug 17924: Crash in KJS::ConstDeclNode::evaluate with |with| and |const|
+ <http://bugs.webkit.org/show_bug.cgi?id=17924>
+ <rdar://problem/5806933>
+
+ It turns out this is trivially avoidable if we just match firefox's
+ semantics and ensure that an assignment in a const declaration always
+ writes to the variable object.
+
+ * kjs/nodes.cpp:
+ (KJS::ConstDeclNode::handleSlowCase):
+
+2008-03-28 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Sam Weinig.
+
+ Fix a dtoa thread safety issue.
+
+ WebCore can call kjs_strtod without holding JS lock, but we didn't have thread safety
+ compiled in for dtoa.
+
+ This is a 0.5% regression on SunSpider, which Sam Weinig has volunteered to cover with
+ his recent improvement.
+
+ * kjs/dtoa.cpp:
+ (Bigint::Balloc):
+ (Bigint::Bfree):
+ Changed to use fastMalloc/fastDelete - they are much faster than the dtoa custom version was
+ in the presence of locking (but somewhat slower in single-threaded case).
+ (Bigint::pow5mult): Got rid of the dreaded double-checked locking anti-pattern (had to
+ restructure the code to avoid significant performance implications).
+ (Bigint::lshift): Rewrote to avoid an allocation, if possible.
+
+ (Bigint::rv_alloc):
+ (Bigint::kjs_freedtoa):
+ (Bigint::kjs_dtoa):
+ Check for USE(MULTIPLE_THREADS), not dtoa legacy MULTIPLE_THREADS.
+
+ * kjs/InitializeThreading.cpp: Added.
+ (KJS::initializeThreading):
+ * kjs/InitializeThreading.h: Added.
+ Initialize threading at KJS level, if enabled.
+
+ * kjs/dtoa.h: Expose dtoa mutex for KJS::initializeThreading.
+
+ * kjs/testkjs.cpp: (kjsmain): Call initializeThreading.
+
+ * JavaScriptCore.exp: Export KJS::initializeThreading.
+
+ * GNUmakefile.am:
+ * JavaScriptCore.exp:
+ * JavaScriptCore.pri:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCoreSources.bkl:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ Added InitializeThreading.{h,cpp}.
+
+ * wtf/Threading.h: Removed a using directive for WTF::initializeThreading - it is only
+ to be called from KJS::initializeThreading, and having it in the global namespace is useless.
+
+2008-03-28 Brady Eidson <beidson@apple.com>
+
+ Reviewed by Darin
+
+ Export Unicode/UTF8.h and convertUTF16ToUTF8() for more flexible conversion in WebCore
+
+ * JavaScriptCore.exp:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2008-03-27 Darin Adler <darin@apple.com>
+
+ Reviewed by Mark Rowe.
+
+ <rdar://problem/5826236> Regular expressions with large nested repetition counts can have their
+ compiled length calculated incorrectly.
+
+ * pcre/pcre_compile.cpp:
+ (multiplyWithOverflowCheck):
+ (calculateCompiledPatternLength): Check for overflow when dealing with nested repetition counts
+ and bail with an error rather than returning incorrect results.
+
+2008-03-26 Mark Rowe <mrowe@apple.com>
+
+ Rubber-stamped by Brady Eidson.
+
+ Update FEATURE_DEFINES to be consistent with the other locations in which it is defined.
+
+ * Configurations/JavaScriptCore.xcconfig:
+
+2008-03-26 Adam Roben <aroben@apple.com>
+
+ Fix Bug 18060: Assertion failure (JSLock not held) beneath
+ JSCallbackObject<Base>::toString
+
+ <http://bugs.webkit.org/show_bug.cgi?id=18060>
+
+ Reviewed by Geoff Garen.
+
+ Bug fix:
+
+ * API/JSCallbackObjectFunctions.h:
+ (KJS::JSCallbackObject<Base>::toString): Make the DropAllLocks
+ instance only be in scope while calling convertToType.
+
+ Test:
+
+ * API/testapi.c:
+ (MyObject_convertToType): Implement type conversion to string.
+ * API/testapi.js: Add a test for type conversion to string.
+
+2008-03-26 Adam Roben <aroben@apple.com>
+
+ Windows build fix
+
+ * kjs/array_instance.cpp: Touched this.
+ * wtf/HashFunctions.h:
+ (WTF::intHash): Added 8- and 16-bit versions of intHash.
+
+2008-03-26 Adam Roben <aroben@apple.com>
+
+ Force JSC headers to be copied by touching a file
+
+ * kjs/array_instance.cpp:
+ (KJS::ArrayInstance::getPropertyNames):
+
+2008-03-26 Adam Roben <aroben@apple.com>
+
+ Windows build fix after r31324
+
+ Written with Darin.
+
+ Added HashTable plumbing to support using wchar_t as a key type.
+
+ * wtf/HashFunctions.h:
+ * wtf/HashTraits.h:
+ (WTF::):
+
+2008-03-26 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin.
+
+ - JSC part of fix for "SVG multichar glyph matching matches longest instead of first (affects Acid3 test 79)"
+ http://bugs.webkit.org/show_bug.cgi?id=18118
+
+ * wtf/HashFunctions.h:
+ (WTF::):
+ * wtf/HashTraits.h:
+ (WTF::):
+
+2008-03-26 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Darin.
+
+ Cache C string identifiers by address, not value, assuming that C strings can only
+ be literals.
+
+ 1% speedup on Acid3 test 26.
+
+ * kjs/identifier.cpp:
+ (KJS::literalIdentifierTable):
+ (KJS::Identifier::add):
+ Added a new table to cache UString::Reps created from C strings by address. Elements are
+ never removed from this cache, as only predefined identifiers can get there.
+
+ * kjs/identifier.h:
+ (KJS::Identifier::Identifier): Added a warning.
+
+2008-03-26 Alexey Proskuryakov <ap@webkit.org>
+
+ Rubber-stamped by Maciej.
+
+ An assertion was failing in function-toString-object-literals.html when parsing 1e-500.
+ The condition existed before, and got uncovered by turning compiled-out dtoa checks into
+ ASSERTs.
+
+ The assertion was verifying that the caller wasn't constructing a Bigint from 0.
+ This might have had some reason behind it originally, but I couldn't find any,
+ and this doesn't look like a reasonable requirement.
+
+ * kjs/dtoa.cpp: (d2b): Removed the assertion (two copies in different code paths).
+
+2008-03-25 Adam Roben <aroben@apple.com>
+
+ Fix Bug 18077: Integrate testapi.c into the Windows build
+
+ <http://bugs.webkit.org/show_bug.cgi?id=18077>
+
+ Reviewed by Steve Falkenburg.
+
+ * JavaScriptCore.vcproj/testapi/testapi.vcproj: Added.
+
+2008-03-25 Adam Roben <aroben@apple.com>
+
+ Make testapi.c compile under MSVC
+
+ Currently you must compile testapi.c as C++ code since MSVC does not
+ support many C features that GCC does.
+
+ Reviewed by Steve Falkenburg.
+
+ * API/testapi.c:
+ (nan): Added an implementation of this for MSVC.
+ (assertEqualsAsUTF8String): Use malloc instead of dynamically-sized
+ stack arrays.
+ (assertEqualsAsCharactersPtr): Ditto.
+ (print_callAsFunction): Ditto.
+ (main): Ditto, and explicitly cast from UniChar* to JSChar*.
+
+2008-03-25 Adam Roben <aroben@apple.com>
+
+ Stop using JavaScriptCore's custom stdbool.h and stdint.h on Windows
+
+ We can't remove the os-win32 directory yet because other ports (at
+ least wx) are still relying on it.
+
+ Reviewed by Steve Falkenburg.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ - Made all the include paths match the one for the Debug
+ configuration (these got out of sync in r30797)
+ - Removed os-win32 from the include path
+ - Removed os-win32 from the directories we copy to $WebKitOutputDir.
+ - Removed stdint.h from the project
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make:
+ Delete the files that we may have previously copied from the os-win32
+ directory.
+
+2008-03-25 Alexey Proskuryakov <ap@webkit.org>
+
+ Windows build fix.
+
+ * kjs/dtoa.cpp: Include stdint.h.
+
+2008-03-25 Alexey Proskuryakov <ap@webkit.org>
+
+ Rubber-stamped by Darin.
+
+ Cleanup dtoa.cpp style.
+
+ * kjs/dtoa.cpp:
+ (Bigint::Balloc):
+ (Bigint::Bfree):
+ (Bigint::multadd):
+ (Bigint::s2b):
+ (Bigint::hi0bits):
+ (Bigint::lo0bits):
+ (Bigint::i2b):
+ (Bigint::mult):
+ (Bigint::pow5mult):
+ (Bigint::lshift):
+ (Bigint::cmp):
+ (Bigint::diff):
+ (Bigint::ulp):
+ (Bigint::b2d):
+ (Bigint::d2b):
+ (Bigint::ratio):
+ (Bigint::):
+ (Bigint::match):
+ (Bigint::hexnan):
+ (Bigint::kjs_strtod):
+ (Bigint::quorem):
+ (Bigint::rv_alloc):
+ (Bigint::nrv_alloc):
+ (Bigint::kjs_freedtoa):
+ (Bigint::kjs_dtoa):
+ * kjs/dtoa.h:
+
+2008-03-24 Darin Adler <darin@apple.com>
+
+ Reviewed by Sam.
+
+ - convert a JavaScript immediate number to a string more efficiently
+
+ 2% speedup of Acid3 test 26
+
+ * kjs/JSImmediate.cpp:
+ (KJS::JSImmediate::toString): Take advantage of the fact that all immediate
+ numbers are integers, and use the faster UString function for formatting integers
+ instead of the slower one that works for floating point. I think this is a leftover
+ from when immediate numbers were floating point.
+
+2008-03-23 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ Fix http://bugs.webkit.org/show_bug.cgi?id=18048
+ The "thisObject" parameter to JSEvaluateScript is not used properly
+
+ Making passing a thisObject to JSEvaluateScript actually set the thisObject of the created
+ ExecState.
+
+ * API/testapi.c:
+ (main): Add tests for setting the thisObject when calling JSEvaluateScript.
+
+ * kjs/ExecState.cpp:
+ (KJS::ExecState::ExecState): Assign the thisObject to m_thisValue and remove the comment.
+
+2008-03-22 Jesse Ruderman <jruderman@gmail.com>
+
+ Reviewed by Sam Weinig. Landed by eseidel.
+
+ Make testkjs flush stdout after printing.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * kjs/testkjs.cpp:
+ (functionPrint):
+
+2008-03-21 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej.
+
+ Optimise lookup of Math, undefined, NaN and Infinity
+
+ Added a method to JSVariableObject to allow us to inject DontDelete properties
+ into the symbol table and localStorage. This results in a 0.4% progression in
+ SunSpider, with a 8% gain in math-partial-sums.
+
+ * kjs/JSGlobalObject.cpp:
+ (KJS::JSGlobalObject::reset):
+ * kjs/JSVariableObject.h:
+ (KJS::JSVariableObject::symbolTableInsert):
+
+2008-03-21 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Global properties that use LocalStorage are not correctly listed as enumerable.
+
+ The problem was caused by JSObject::getPropertyAttributes not being aware
+ of the JSVariableObject SymbolTable. The fix is to make getPropertyAttributes
+ virtual and override in JSVariableObject. This does not produce any performance
+ regression.
+
+ * JavaScriptCore.exp:
+ * kjs/JSVariableObject.cpp:
+ (KJS::JSVariableObject::getPropertyNames):
+ (KJS::JSVariableObject::getPropertyAttributes):
+ * kjs/JSVariableObject.h:
+ * kjs/object.h:
+
+2008-03-21 Arkadiusz Miskiewicz <arekm@maven.pl>
+
+ Webkit does not build on linux powerpc
+
+ <http://bugs.webkit.org/show_bug.cgi?id=17019>
+
+ Reviewed by David Kilzer.
+
+ * wtf/TCSpinLock.h:
+ (TCMalloc_SpinLock::Unlock):
+
+2008-03-21 Rodney Dawes <dobey@wayofthemonkey.com>
+
+ Reviewed by Holger.
+
+ http://bugs.webkit.org/show_bug.cgi?id=17981
+
+ Add javascriptcore_cppflags to Programs_minidom_CPPFLAGS.
+
+ * GNUmakefile.am:
+
+2008-03-21 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Oliver Hunt.
+
+ Consolidate static identifier initializers within CommonIdentifiers.
+
+ No reliably measurable change on SunSpider; maybe a tiny improvement (within 0.2%).
+
+ * kjs/CommonIdentifiers.h: Added static identifiers that were lazily initialized
+ throughout the code.
+
+ * kjs/date_object.cpp:
+ (KJS::DateObjectImp::DateObjectImp):
+ * kjs/function_object.cpp:
+ (KJS::FunctionPrototype::FunctionPrototype):
+ * kjs/object_object.cpp:
+ (KJS::ObjectPrototype::ObjectPrototype):
+ * kjs/regexp_object.cpp:
+ (KJS::RegExpPrototype::RegExpPrototype):
+ Use the values from CommonIdentifiers.
+
+ * kjs/lookup.h: Caching the identifier in a static wasn't a win on SunSpider, removed it.
+
+ * kjs/value.h:
+ (KJS::jsNaN): We already have a shared NaN value, no need for a duplicate here.
+
+ * wtf/MathExtras.h:
+ (wtf_atan2): Having local variables for numeric_limits constants is good for readability,
+ but there is no reason to keep them static.
+
+ * JavaScriptCore.exp: Don't needlessly export JSGlobalObject::s_head.
+
+2008-03-20 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej.
+
+ Fix for leak introduced by inline ScopeChainNode use
+
+ To avoid any extra branches when managing an inline ScopeChainNode
+ in the ScopeChain the inline node gets inserted with a refcount of
+ 2. This meant than when the ScopeChain was destroyed the ScopeChainNodes
+ above the inline node would be leaked.
+
+ We resolve this by manually popping the inline node in the
+ FunctionExecState destructor.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * kjs/ExecStateInlines.h:
+ (KJS::FunctionExecState::~FunctionExecState):
+ * kjs/scope_chain.h:
+ (KJS::ScopeChain::popInlineScopeNode):
+
+2008-03-20 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Ensure that the defines in FEATURE_DEFINES are sorted so that they will match the default settings of build-webkit.
+ This will prevent the world from being rebuilt if you happen to switch between building in Xcode and with build-webkit on the
+ command-line.
+
+ * Configurations/JavaScriptCore.xcconfig:
+
+2008-03-20 David Krause <david.krause@gmail.com>
+
+ Reviewed by David Kilzer.
+
+ Fix http://bugs.webkit.org/show_bug.cgi?id=17923
+ Bug 17923: ARM platform endian defines inaccurate
+
+ * wtf/Platform.h:
+ Replaced !defined(__ARMEL__) check with !defined(__VFP_FP__)
+ for PLATFORM(MIDDLE_ENDIAN)
+
+2008-03-20 Maciej Stachowiak <mjs@apple.com>
+
+ - fix build
+
+ * JavaScriptCore.xcodeproj/project.pbxproj: install Activation.h as private
+
+2008-03-20 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver.
+
+ - reduce function call overhead for 1.014x speedup on SunSpider
+
+ I moved some functions from ExecState.cpp to ExecStateInline.h and
+ from JSGlobalObject.cpp to JSGlobalObject.h, and declared them
+ inline; machine function call overhead for these was hurting JS
+ funcion call overhead.
+
+ * kjs/ExecState.cpp:
+ * kjs/ExecStateInlines.h: Added.
+ (KJS::ExecState::ExecState):
+ (KJS::ExecState::~ExecState):
+ (KJS::FunctionExecState::FunctionExecState):
+ (KJS::FunctionExecState::~FunctionExecState):
+ * kjs/JSGlobalObject.cpp:
+ * kjs/JSGlobalObject.h:
+ (KJS::JSGlobalObject::pushActivation):
+ (KJS::JSGlobalObject::checkActivationCount):
+ (KJS::JSGlobalObject::popActivation):
+ * kjs/function.cpp:
+
+2008-03-19 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej.
+
+ Avoid heap allocating the root scope chain node for eval and closure free functions
+
+ Maciej suggested using an inline ScopeChainNode for functions that don't use eval
+ or closures as they are unable to ever capture the scope chain. This gives us a 2.4%
+ win in sunspider, a 15% win in controlflow-recursive, and big (>5%) wins in a number
+ of other tests.
+
+ * kjs/ExecState.cpp:
+ (KJS::ExecState::ExecState):
+ * kjs/ExecState.h:
+ * kjs/scope_chain.h:
+ (KJS::ScopeChain::push):
+
+2008-03-19 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Fix release build.
+
+ * kjs/JSGlobalObject.cpp: Add missing #include.
+
+2008-03-19 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Anders Carlsson.
+
+ Fix for <rdar://problem/5785694>
+ Crash occurs at KJS::Collector::collect() when loading web clip widgets with a PAC file
+
+ Make the activeExecStates stack per JSGlobalObject instead of static to ensure
+ thread safety.
+
+ * JavaScriptCore.exp:
+ * kjs/ExecState.cpp:
+ (KJS::InterpreterExecState::InterpreterExecState):
+ (KJS::InterpreterExecState::~InterpreterExecState):
+ (KJS::EvalExecState::EvalExecState):
+ (KJS::EvalExecState::~EvalExecState):
+ (KJS::FunctionExecState::FunctionExecState):
+ (KJS::FunctionExecState::~FunctionExecState):
+ * kjs/ExecState.h:
+ * kjs/JSGlobalObject.cpp:
+ (KJS::JSGlobalObject::mark):
+ * kjs/JSGlobalObject.h:
+ (KJS::JSGlobalObject::activeExecStates):
+ * kjs/collector.cpp:
+ (KJS::Collector::collect):
+ (KJS::Collector::reportOutOfMemoryToAllExecStates): Iterate all JSGlobalObjects and report
+ the OutOfMemory condition to all the ExecStates in each.
+
+2008-03-19 Jasper Bryant-Greene <jasper@unix.geek.nz>
+
+ Reviewed by Maciej Stachowiak.
+
+ Fix http://bugs.webkit.org/show_bug.cgi?id=17941
+ Bug 17941: C++-style comments in JavaScriptCore API
+
+ * API/JSBase.h:
+ Remove C++-style comments from public JavaScriptCore API, replacing
+ with standard C90 block comments.
+
+2008-03-19 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Fix http://bugs.webkit.org/show_bug.cgi?id=17939
+ Bug 17939: Crash decompiling "const a = 1, b;"
+
+ * kjs/nodes2string.cpp:
+ (KJS::ConstDeclNode::streamTo): Null-check the correct variable.
+
+2008-03-18 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Mark Rowe.
+
+ Bug 17929: Incorrect decompilation with |const|, comma
+ http://bugs.webkit.org/show_bug.cgi?id=17929
+
+ There were actually two bugs here. First we weren't correctly handling const
+ nodes with multiple declarations. The second issue was caused by us not
+ giving the correct precedence to the initialisers.
+
+ * kjs/nodes2string.cpp:
+ (KJS::ConstDeclNode::streamTo):
+
+2008-03-18 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - Speed up JavaScript built-in properties by changing the
+ hash table to take advantage of the identifier objects
+
+ 5% speedup for Acid3 test 26
+
+ * JavaScriptCore.exp: Updated.
+ * kjs/create_hash_table: Compute size of hash table large enough so that there
+ are no collisions, but don't generate the hash table.
+ * kjs/identifier.h: Made the add function that returns a PassRefPtr public.
+ * kjs/lexer.cpp:
+ (KJS::Lexer::lex): Updated for change to HashTable interface.
+ * kjs/lookup.cpp:
+ (KJS::HashTable::changeKeysToIdentifiers): Added. Finds the identifier for
+ each property so the equality comparision can be done with pointer comparision.
+ * kjs/lookup.h: Made the key be a union of char* with UString::Rep* so it can
+ hold identifiers. Added a keysAreIdentifiers flag to the HashTable. Changed
+ the Lookup functions to be member functions of HashTable instead.
+ * kjs/object.cpp:
+ (KJS::JSObject::deleteProperty): Update for change to HashTable.
+ (KJS::JSObject::findPropertyHashEntry): Ditto.
+ (KJS::JSObject::getPropertyAttributes): Ditto.
+ (KJS::JSObject::getPropertyNames): Ditto.
+
+2008-03-18 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Fix http://bugs.webkit.org/show_bug.cgi?id=17925 and http://bugs.webkit.org/show_bug.cgi?id=17927.
+ - Bug 17925: Crash in KJS::JSObject::put after setting this.__proto__
+ - Bug 17927: Hang after attempting to create circular __proto__
+
+ * kjs/object.cpp:
+ (KJS::JSObject::put): Silently ignore attempts to set __proto__ to a non-object, non-null value.
+ Return after setting the exception when an attempt to set a cyclic __proto__ is detected so that
+ the cyclic value is not set.
+
+2008-03-18 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver.
+
+ - inline ActivationImp::init for 0.8% SunSpider speedup
+
+ * kjs/Activation.h:
+ (KJS::ActivationImp::init): Moved here from function.cpp
+ * kjs/function.cpp:
+
+2008-03-18 Simon Hausmann <hausmann@webkit.org>
+
+ Fix the Qt build.
+
+ Including config.h like in the other .cpp files gets the #ifdeffery
+ correct for rand_s.
+
+ * kjs/JSWrapperObject.cpp:
+
+2008-03-17 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ JavaScriptCore changes to support a WebCore speedup.
+
+ * JavaScriptCore.exp: Export the UString::Rep::computeHash function.
+ * wtf/HashSet.h: Added a find and contains function that take a translator,
+ like the add function.
+
+2008-03-18 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver.
+
+ - a few micro-optimizations for 1.2% SunSpider speedup
+
+ * kjs/function.cpp:
+ (KJS::FunctionImp::callAsFunction): check for Return completion before Throw,
+ it is more likely.
+ * kjs/object.cpp:
+ (KJS::JSObject::put): When walking prototype chain, instead of
+ checking isObject (a virtual call), compare to jsNull (compare to
+ a constant) since null is the only non-object that can be in a
+ prototype chain.
+
+2008-03-17 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff.
+
+ Optimise multi-scope function call resolution
+
+ Refactor multiscope variable resolution and use to add
+ optimised FunctionCallResolveNode subclasses.
+
+ 2.6% gain in sunspider performance, *25%* gain in controlflow-recursive
+
+ * kjs/nodes.cpp:
+ (KJS::getSymbolTableEntry):
+ (KJS::ResolveNode::optimizeVariableAccess):
+ (KJS::getNonLocalSymbol):
+ (KJS::ExpressionNode::resolveAndCall):
+ (KJS::FunctionCallResolveNode::optimizeVariableAccess):
+ (KJS::FunctionCallResolveNode::inlineEvaluate):
+ (KJS::ScopedVarFunctionCallNode::inlineEvaluate):
+ (KJS::ScopedVarFunctionCallNode::evaluate):
+ (KJS::ScopedVarFunctionCallNode::evaluateToNumber):
+ (KJS::ScopedVarFunctionCallNode::evaluateToBoolean):
+ (KJS::ScopedVarFunctionCallNode::evaluateToInt32):
+ (KJS::ScopedVarFunctionCallNode::evaluateToUInt32):
+ (KJS::NonLocalVarFunctionCallNode::inlineEvaluate):
+ (KJS::NonLocalVarFunctionCallNode::evaluate):
+ (KJS::NonLocalVarFunctionCallNode::evaluateToNumber):
+ (KJS::NonLocalVarFunctionCallNode::evaluateToBoolean):
+ (KJS::NonLocalVarFunctionCallNode::evaluateToInt32):
+ (KJS::NonLocalVarFunctionCallNode::evaluateToUInt32):
+ * kjs/nodes.h:
+ (KJS::ScopedVarFunctionCallNode::):
+ (KJS::NonLocalVarFunctionCallNode::):
+
+2008-03-17 David Kilzer <ddkilzer@apple.com>
+
+ Don't define PLATFORM(MIDDLE_ENDIAN) on little endian ARM.
+
+ Reviewed by Darin.
+
+ See <http://bugs.webkit.org/show_bug.cgi?id=15416#c13>.
+
+ * wtf/Platform.h: Added check for !defined(__ARMEL__) when defining
+ PLATFORM(MIDDLE_ENDIAN).
+
+2008-03-17 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff, Darin and Weinig.
+
+ Add fast multi-level scope lookup
+
+ Add logic and AST nodes to provide rapid variable resolution across
+ static scope boundaries. This also adds logic that allows us to skip
+ any static scopes that do not contain the variable to be resolved.
+
+ This results in a ~2.5% speedup in SunSpider, and gives a 25-30% speedup
+ in some simple and ad hoc closure and global variable access tests.
+
+ * JavaScriptCore.exp:
+ * kjs/Activation.h:
+ * kjs/JSGlobalObject.cpp:
+ * kjs/JSGlobalObject.h:
+ * kjs/JSVariableObject.cpp:
+ * kjs/JSVariableObject.h:
+ * kjs/function.cpp:
+ (KJS::ActivationImp::isDynamicScope):
+ * kjs/nodes.cpp:
+ (KJS::ResolveNode::optimizeVariableAccess):
+ (KJS::ScopedVarAccessNode::inlineEvaluate):
+ (KJS::ScopedVarAccessNode::evaluate):
+ (KJS::ScopedVarAccessNode::evaluateToNumber):
+ (KJS::ScopedVarAccessNode::evaluateToBoolean):
+ (KJS::ScopedVarAccessNode::evaluateToInt32):
+ (KJS::ScopedVarAccessNode::evaluateToUInt32):
+ (KJS::NonLocalVarAccessNode::inlineEvaluate):
+ (KJS::NonLocalVarAccessNode::evaluate):
+ (KJS::NonLocalVarAccessNode::evaluateToNumber):
+ (KJS::NonLocalVarAccessNode::evaluateToBoolean):
+ (KJS::NonLocalVarAccessNode::evaluateToInt32):
+ (KJS::NonLocalVarAccessNode::evaluateToUInt32):
+ (KJS::IfElseNode::optimizeVariableAccess):
+ (KJS::ScopeNode::optimizeVariableAccess):
+ * kjs/nodes.h:
+ (KJS::ScopedVarAccessNode::):
+ (KJS::NonLocalVarAccessNode::):
+ * kjs/object.h:
+
+ 2008-03-16 weihongzeng <weihong.zeng@hotmail.com>
+
+ Reviewed by Darin Adler.
+
+ http://bugs.webkit.org/show_bug.cgi?id=15416
+ Add support for mixed-endian processors
+
+ * kjs/dtoa.cpp: Add IEEE_ARM, triggered by PLATFORM(MIDDLE_ENDIAN).
+
+2008-03-16 Kevin Ollivier <kevino@theolliviers.com>
+
+ Rubber stamped by Darin.
+
+ Add set-webkit-configuration support for wx port, and centralize
+ build dir location setting.
+
+ http://bugs.webkit.org/show_bug.cgi?id=17790
+
+ * jscore.bkl:
+
+2008-03-14 Steve Falkenburg <sfalken@apple.com>
+
+ PGO build fixes.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+
+2008-03-14 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej.
+
+ Add logic to track whether a function uses a locally scoped eval or requires a closure
+
+ Now that we limit eval we can track those uses of eval that operate
+ in the local scope and functions that require a closure. We track
+ this information during initial parsing to avoid yet another tree
+ walk.
+
+ * JavaScriptCore.exp:
+ * kjs/NodeInfo.h:
+ * kjs/Parser.cpp:
+ (KJS::Parser::didFinishParsing):
+ * kjs/Parser.h:
+ (KJS::Parser::parse):
+ * kjs/grammar.y:
+ * kjs/nodes.cpp:
+ (KJS::ScopeNode::ScopeNode):
+ (KJS::ProgramNode::ProgramNode):
+ (KJS::ProgramNode::create):
+ (KJS::EvalNode::EvalNode):
+ (KJS::EvalNode::create):
+ (KJS::FunctionBodyNode::FunctionBodyNode):
+ (KJS::FunctionBodyNode::create):
+ * kjs/nodes.h:
+ (KJS::ScopeNode::):
+ (KJS::ScopeNode::usesEval):
+ (KJS::ScopeNode::needsClosure):
+
+2008-03-14 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Beth Dakin.
+
+ Fixed another problem with Vector::shrinkCapacity.
+
+ moveOverlapping isn't good enough for the case where the buffer hasn't
+ changed, because it still destroys the contents of the buffer.
+
+ * wtf/Vector.h:
+ (WTF::::shrinkCapacity): Changed to explicitly check whether the call
+ to allocateBuffer produced a new buffer. If it didn't, there's no need
+ to move.
+
+2008-03-14 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Beth Dakin.
+
+ Fixed a few problems with Vector::shrinkCapacity that I noticed in testing.
+
+ * wtf/Vector.h:
+ (WTF::VectorBufferBase::deallocateBuffer): Clear our m_buffer pointer
+ when we deallocate m_buffer, in case we're not asked to reallocate a new
+ buffer. (Otherwise, we would use a stale m_buffer if we were asked to
+ perform any operations after shrinkCapacity was called.)
+
+ (WTF::VectorBuffer::allocateBuffer): Made VectorBuffer with inline
+ capacity aware that calls to allocateBuffer might be shrinks, rather
+ than grows, so we shouldn't allocate a new buffer on the heap unless
+ our inline buffer is too small.
+
+ (WTF::::shrinkCapacity): Call resize() instead of just setting m_size,
+ so destructors run. Call resize before reallocating the buffer to make
+ sure that we still have access to the objects we need to destroy. Call
+ moveOverlapping instead of move, since a call to allocateBuffer on an
+ inline buffer may produce identical storage.
+
+2008-03-14 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Darin.
+
+ Get rid of a localime() call on platforms that have better alternatives.
+
+ * kjs/DateMath.h: Added getLocalTime();
+
+ * kjs/DateMath.cpp:
+ (KJS::getLocalTime):
+ (KJS::getDSTOffsetSimple):
+ Implementation moved from getDSTOffsetSimple().
+
+ * kjs/date_object.cpp:
+ (KJS::DateObjectImp::callAsFunction): Switched to getLocalTime().
+
+2008-03-14 David D. Kilzer <ddkilzer@apple.com>
+
+ Unify concept of enabling the Mac Java bridge.
+
+ Reviewed by Darin and Anders.
+
+ * wtf/Platform.h: Define ENABLE_MAC_JAVA_BRIDGE here.
+
+2008-03-13 Mark Mentovai <mark@moxienet.com>
+
+ Reviewed by eseidel. Landed by eseidel.
+
+ * wtf/FastMalloc.cpp: #include <wtf/HashSet.h> outside of any
+ namespaces.
+
+2008-03-13 Mark Mentovai <mark@moxienet.com>
+
+ Reviewed by eseidel. Landed by eseidel.
+
+ * pcre/pcre_exec.cpp: Fix misnamed variable, allowing -DDEBUG build
+ to succeed.
+ * wtf/ThreadingPthreads.cpp: #include <sys/time.h> for gettimeofday
+ in non-pch build.
+
+2008-03-13 Steve Falkenburg <sfalken@apple.com>
+
+ PGO build fixes.
+
+ Disable PGO for normal release builds.
+ Added work-in-progress Release_PGOInstrument/Release_PGOOptimize targets.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+
+2008-03-13 Beth Dakin <bdakin@apple.com>
+
+ Reviewed by Geoff.
+
+ Adding new functionality to Vector. Currently all of the shrink and
+ resize functions on Vector only shrink the size of the Vector, not
+ the capacity. For the Vector to take up as little memory as
+ possible, though, it is necessary to be able to shrink the capacity
+ as well. So this patch adds that functionality.
+
+ I need this for a speed up I am working on, and Geoff wants to use
+ it in a speed up he is working on also, so he asked me to commit it
+ now.
+
+ * wtf/Vector.h:
+ (WTF::VectorBufferBase::allocateBuffer):
+ (WTF::::shrinkCapacity):
+
+2008-03-13 Simon Hausmann <hausmann@webkit.org>
+
+ Reviewed by Adam Roben.
+
+ Attempt at fixing the Qt/Windows build bot. Quote using double-quotes
+ instead of single quotes.
+
+ * pcre/dftables:
+
+2008-03-12 Steve Falkenburg <sfalken@apple.com>
+
+ Build fix.
+
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+
+2008-03-12 Alp Toker <alp@atoker.com>
+
+ Another autotools testkjs build fix attempt.
+
+ * GNUmakefile.am:
+
+2008-03-12 Alp Toker <alp@atoker.com>
+
+ Attempt to fix the autotools testkjs build on systems with
+ non-standard include paths.
+
+ * GNUmakefile.am:
+
+2008-03-11 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Darin.
+
+ <rdar://problem/5787743> REGRESSION: Crash at WTF::Collator::CreateCollator() running fast/js/kde/StringObject.html on Windows
+
+ * wtf/unicode/icu/CollatorICU.cpp:
+ (WTF::Collator::createCollator): Check for null (== user default) m_locale before calling strcmp.
+
+2008-03-11 Steve Falkenburg <sfalken@apple.com>
+
+ Disable LTCG/PGO for grammar.cpp and nodes.cpp.
+ PGO on these files causes us to hang.
+
+ Copy newer vsprops files from relative WebKitLibraries path to environment variable based path.
+
+ Reviewed by Oliver.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make:
+
+2008-03-10 Darin Adler <darin@apple.com>
+
+ - Windows build fix
+
+ * kjs/function.cpp: (KJS::decode): Initialize variable.
+
+2008-03-10 Brent Fulgham <bfulgham@gmail.com>
+
+ Windows build fix
+
+ Reviewed by Adam.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make:
+ Set the PATH to include Cygwin before running touch.
+
+2008-03-10 Eric Seidel <eric@webkit.org>
+
+ Build fix for JSC on windows.
+
+ * API/JSStringRefCF.cpp:
+ (JSStringCreateWithCFString):
+ * kjs/function.cpp:
+ (KJS::decode):
+ * kjs/nodes2string.cpp:
+ (KJS::escapeStringForPrettyPrinting):
+
+2008-03-10 Eric Seidel <eric@webkit.org>
+
+ No review, build fix only.
+
+ Attempt to fix the windows build?
+
+ * kjs/ustring.h: change unsigned short to UChar
+
+2008-03-10 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Darin.
+
+ Remove KJS::UChar, use ::UChar instead
+ http://bugs.webkit.org/show_bug.cgi?id=17017
+
+ * API/JSStringRef.cpp:
+ (JSStringCreateWithCharacters):
+ (JSStringCreateWithUTF8CString):
+ * API/JSStringRefCF.cpp:
+ (JSStringCreateWithCFString):
+ * JavaScriptCore.exp:
+ * kjs/Parser.h:
+ * kjs/function.cpp:
+ (KJS::decode):
+ (KJS::parseInt):
+ (KJS::parseFloat):
+ (KJS::globalFuncEscape):
+ (KJS::globalFuncUnescape):
+ * kjs/function_object.cpp:
+ (KJS::FunctionObjectImp::construct):
+ * kjs/identifier.cpp:
+ (KJS::Identifier::equal):
+ (KJS::CStringTranslator::translate):
+ * kjs/interpreter.h:
+ * kjs/lexer.cpp:
+ (KJS::Lexer::setCode):
+ (KJS::Lexer::shift):
+ (KJS::Lexer::lex):
+ (KJS::Lexer::convertUnicode):
+ (KJS::Lexer::makeIdentifier):
+ * kjs/lookup.cpp:
+ (KJS::keysMatch):
+ * kjs/nodes2string.cpp:
+ (KJS::escapeStringForPrettyPrinting):
+ (KJS::SourceStream::operator<<):
+ * kjs/regexp.cpp:
+ (KJS::RegExp::RegExp):
+ (KJS::RegExp::match):
+ * kjs/string_object.cpp:
+ (KJS::substituteBackreferences):
+ (KJS::stringProtoFuncCharCodeAt):
+ (KJS::stringProtoFuncToLowerCase):
+ (KJS::stringProtoFuncToUpperCase):
+ (KJS::stringProtoFuncToLocaleLowerCase):
+ (KJS::stringProtoFuncToLocaleUpperCase):
+ * kjs/ustring.cpp:
+ (KJS::UString::Rep::computeHash):
+ (KJS::UString::UString):
+ (KJS::UString::append):
+ (KJS::UString::ascii):
+ (KJS::UString::operator=):
+ (KJS::UString::is8Bit):
+ (KJS::UString::toStrictUInt32):
+ (KJS::UString::find):
+ (KJS::operator==):
+ (KJS::operator<):
+ (KJS::compare):
+ (KJS::UString::UTF8String):
+ * kjs/ustring.h:
+ * pcre/pcre.h:
+
+2008-03-09 Steve Falkenburg <sfalken@apple.com>
+
+ Stop Windows build if an error occurs in a prior project.
+
+ Rubber stamped by Darin.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make:
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
+
+2008-03-09 J¸rg Billeter <j@bitron.ch>
+
+ Reviewed by Alp Toker.
+
+ Conditionalise ICU for Unicode in the GTK+ port.
+
+ * wtf/Platform.h:
+
+2008-03-07 David D. Kilzer <ddkilzer@apple.com>
+
+ Unify concept of enabling Netscape Plug-in API (NPAPI).
+
+ Reviewed by Darin.
+
+ * wtf/Platform.h: Define ENABLE_NETSCAPE_PLUGIN_API here.
+
+2008-03-07 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Fixed <rdar://problem/5689093> Stricter (ES4) eval semantics
+
+ The basic rule is:
+
+ - "eval(s)" is treated as an operator that gives the ES3 eval behavior.
+ ... but only if there is no overriding declaration of "eval" in scope.
+ - All other invocations treat eval as a function that evaluates a
+ script in the context of its "this" object.
+ ... but if its "this" object is not the global object it was
+ originally associated with, eval throws an exception.
+
+ Because only expressions of the form "eval(s)" have access to local
+ scope, the compiler can now statically determine whether a function
+ needs local scope to be dynamic.
+
+ * kjs/nodes.h: Added FunctionCallEvalNode. It works just like
+ FuncationCallResolveNode, except it statically indicates that the node
+ may execute eval in the ES3 way.
+ * kjs/nodes.cpp:
+ * kjs/nodes2string.cpp:
+
+ * tests/mozilla/expected.html: This patch happens to fix a Mozilla JS
+ test, but it's a bit of a pyrrhic victory. The test intends to test
+ Mozilla's generic API for calling eval on any object, but, in reality,
+ we only support calling eval on the global object.
+
+2008-03-06 Steve Falkenburg <sfalken@apple.com>
+
+ Build fix.
+
+ * JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
+
+2008-03-06 Steve Falkenburg <sfalken@apple.com>
+
+ Build fix.
+
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+
+2008-03-06 Alp Toker <alp@atoker.com>
+
+ Fix the build fix in r30845 to support out-of-tree builds.
+
+ * GNUmakefile.am:
+
+2008-03-06 Steve Falkenburg <sfalken@apple.com>
+
+ Build fix.
+
+ * wtf/ThreadingWin.cpp:
+ (WTF::ThreadCondition::timedWait):
+
+2008-03-06 Darin Adler <darin@apple.com>
+
+ - another small step towards fixing the Qt build
+
+ * JavaScriptCore.pri: Remove more references to the now-obsolete bindings directory.
+
+2008-03-06 Darin Adler <darin@apple.com>
+
+ - a small step towards fixing the Qt build
+
+ * JavaScriptCore.pri: Remove references to files no longer present in JavaScriptCore/bindings.
+
+2008-03-06 Brady Eidson <beidson@apple.com>
+
+ Gtk Build fix
+
+ * wtf/ThreadingGtk.cpp:
+ (WTF::ThreadCondition::timedWait):
+
+2008-03-06 Alexey Proskuryakov <ap@webkit.org>
+
+ Wx build fix.
+
+ * wtf/unicode/icu/CollatorICU.cpp:
+ (WTF::Collator::userDefault): Put ICU workaround under both PLATFORM(DARWIN) and
+ PLATFORM(CF) checks, so that each port can decide if it wants to use CF on Mac for it.
+
+2008-03-06 Brady Eidson <beidson@apple.com>
+
+ Reviewed by Darin
+
+ Add a timedWait() method to ThreadCondition
+
+ * JavaScriptCore.exp:
+
+ * wtf/Threading.h:
+
+ * wtf/ThreadingGtk.cpp:
+ (WTF::ThreadCondition::timedWait):
+
+ * wtf/ThreadingNone.cpp:
+ (WTF::ThreadCondition::timedWait):
+
+ * wtf/ThreadingPthreads.cpp:
+ (WTF::ThreadCondition::timedWait):
+
+ * wtf/ThreadingWin.cpp:
+ (WTF::ThreadCondition::timedWait): Needs implementation
+
+2008-03-06 Alexey Proskuryakov <ap@webkit.org>
+
+ More build fixes.
+
+ * jscore.bkl: Add the wtf/unicode directory.
+ * wtf/unicode/CollatorDefault.cpp:
+ (WTF::Collator::userDefault): Use a constructor that does exist.
+ * wtf/unicode/icu/CollatorICU.cpp: Mac build fix for case-sensitive file systems.
+
+2008-03-06 Darin Adler <darin@apple.com>
+
+ - try to fix the Qt build
+
+ * JavaScriptCore.pri: Add the wtf/unicode directory.
+
+2008-03-06 Darin Adler <darin@apple.com>
+
+ - try to fix the GTK build
+
+ * GNUmakefile.am: Add a -I for the wtf/unicode directory.
+
+2008-03-06 Darin Adler <darin@apple.com>
+
+ - try to fix the Mac build
+
+ * icu/unicode/parseerr.h: Copied from ../WebCore/icu/unicode/parseerr.h.
+ * icu/unicode/ucol.h: Copied from ../WebCore/icu/unicode/ucol.h.
+ * icu/unicode/uloc.h: Copied from ../WebCore/icu/unicode/uloc.h.
+ * icu/unicode/unorm.h: Copied from ../WebCore/icu/unicode/unorm.h.
+ * icu/unicode/uset.h: Copied from ../WebCore/icu/unicode/uset.h.
+
+2008-03-06 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Darin.
+
+ <rdar://problem/5687269> Need to create a Collator abstraction for WebCore and JavaScriptCore
+
+ * wtf/Threading.h:
+ (WTF::initializeThreading):
+ * wtf/ThreadingGtk.cpp:
+ (WTF::initializeThreading):
+ * wtf/ThreadingNone.cpp:
+ * wtf/ThreadingPthreads.cpp:
+ * wtf/ThreadingWin.cpp:
+ Added AtomicallyInitializedStatic.
+
+ * kjs/string_object.cpp: (KJS::localeCompare): Changed to use Collator.
+
+ * GNUmakefile.am:
+ * JavaScriptCore.exp:
+ * JavaScriptCore.pri:
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * JavaScriptCoreSources.bkl:
+ Added new fiiles to projects.
+
+ * wtf/unicode/Collator.h: Added.
+ (WTF::Collator::):
+ * wtf/unicode/CollatorDefault.cpp: Added.
+ (WTF::Collator::Collator):
+ (WTF::Collator::~Collator):
+ (WTF::Collator::setOrderLowerFirst):
+ (WTF::Collator::collate):
+ * wtf/unicode/icu/CollatorICU.cpp: Added.
+ (WTF::cachedCollatorMutex):
+ (WTF::Collator::Collator):
+ (WTF::Collator::~Collator):
+ (WTF::Collator::setOrderLowerFirst):
+ (WTF::Collator::collate):
+ (WTF::Collator::createCollator):
+ (WTF::Collator::releaseCollator):
+
+2008-03-05 Kevin Ollivier <kevino@theolliviers.com>
+
+ Fix the wx build after the bindings move.
+
+ * JavaScriptCoreSources.bkl:
+ * jscore.bkl:
+
+2008-03-05 Alp Toker <alp@atoker.com>
+
+ GTK+ build fix for breakage introduced in r30800.
+
+ Track moved bridge sources from JavaScriptCore to WebCore.
+
+ * GNUmakefile.am:
+
+2008-03-05 Brent Fulgham <bfulgham@gmail.com>
+
+ Reviewed by Adam Roben.
+
+ Remove definition of WTF_USE_SAFARI_THEME from wtf/Platform.h
+ because the PLATFORM(CG) flag is not set until config.h has
+ already included this file.
+
+ * wtf/Platform.h: Remove useless definition of WTF_USE_SAFARI_THEME
+
+2008-03-05 Brady Eidson <beidson@apple.com>
+
+ Reviewed by Alexey and Mark Rowe
+
+ Fix for <rdar://problem/5778247> - Reproducible crash on storage/execute-sql-args.html
+
+ DatabaseThread::unscheduleDatabaseTasks() manually filters through a MessageQueue,
+ removing particular items for Databases that were shutting down.
+
+ This filtering operation is not atomic, and therefore causes a race condition with the
+ MessageQueue waking up and reading from the message queue.
+
+ The end result was an attempt to dereference a null DatabaseTask. Timing-wise, this never
+ seemed to happen in a debug build, otherwise an assertion would've caught it. Replacing that
+ assertion with a crash in a release build is what revealed this bug.
+
+ * wtf/MessageQueue.h:
+ (WTF::::waitForMessage): Tweak the waiting logic to check the queue's empty state then go back
+ to sleep if the queue was empty - checking m_killed each time it wakes up.
+
+2008-03-05 David D. Kilzer <ddkilzer@apple.com>
+
+ Remove unused header includes from interpreter.cpp.
+
+ Reviewed by Darin.
+
+ * kjs/interpreter.cpp: Remove unused header includes.
+
+2008-03-05 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Sam.
+
+ Remove bindings/.
+
+ * bindings: Removed.
+
+2008-03-05 Anders Carlsson <andersca@apple.com>
+
+ Don't build bindings/ anymore.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+
+2008-03-05 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Geoff.
+
+ Don't build JavaScriptCore/bindings.
+
+ * JavaScriptCore.exp:
+ Export a couple of new functions.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ Remove bindings/
+
+ * kjs/config.h:
+ No need to define HAVE_JNI anymore.
+
+ * kjs/interpreter.cpp:
+ Remove unnecessary include.
+
+2008-03-05 David D. Kilzer <ddkilzer@apple.com>
+
+ Allow override of default script file name using command-line argument.
+
+ Reviewed by Adele.
+
+ * API/minidom.c:
+ (main): Allow first command-line argument to override the default script
+ file name of "minidom.js".
+ * API/testapi.c:
+ (main): Allow first command-line argument to override the default script
+ file name of "testapi.js".
+
+2008-03-04 Mark Rowe <mrowe@apple.com>
+
+ Mac build fix.
+
+ * JavaScriptCore.exp: Add new symbol to exports file.
+
+2008-03-03 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Anders.
+
+ Make ForInNode check for the timeout interrupt
+
+ * kjs/nodes.cpp:
+ (KJS::ForInNode::execute):
+
+2008-03-02 Brent Fulgham <bfulgham@gmail.com>
+
+ Reviewed by Alp Toker.
+
+ http://bugs.webkit.org/show_bug.cgi?id=17415
+ GTK Build (using autotools) on Mac OS (DarwinPorts) Fails
+
+ Add -lstdc++ to link flags for minidom program. This corrects
+ a build error for the GTK+ on Mac OS.
+
+ * GNUmakefile.am:
+
+2008-03-01 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Tim Hatcher.
+
+ Update Xcode configuration to support building debug and release from the mysterious future.
+
+ * Configurations/Base.xcconfig:
+ * Configurations/DebugRelease.xcconfig:
+
+2008-02-29 Brent Fulgham <bfulgham@gmail.com>
+
+ http://bugs.webkit.org/show_bug.cgi?id=17483
+ Implement scrollbars on Windows (Cairo)
+
+ Reviewed by Adam Roben.
+
+ * wtf/Platform.h:
+
+2008-02-29 Adam Roben <aroben@apple.com>
+
+ Remove unused DebuggerImp::abort and DebuggerImp::aborted
+
+ Reviewed by Tim and Sam.
+
+ * kjs/function_object.cpp:
+ (KJS::FunctionObjectImp::construct):
+ * kjs/internal.h:
+ (KJS::DebuggerImp::DebuggerImp):
+ * kjs/nodes.cpp:
+ (KJS::Node::handleException):
+ (KJS::FunctionBodyNodeWithDebuggerHooks::execute):
+
+2008-02-28 Eric Christopher <echristo@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ ** TOTAL **: 1.005x as fast 2867.6ms +/- 0.4% 2853.2ms +/- 0.3% significant
+
+ * kjs/nodes.cpp: Tell the compiler that exceptions are unexpected (for
+ the sake of branch prediction and code organization).
+
+2008-02-27 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Sam Weinig.
+
+ http://bugs.webkit.org/show_bug.cgi?id=17030
+ Small buffer overflow within initialization
+
+ * kjs/date_object.cpp:
+ (KJS::DateObjectFuncImp::callAsFunction):
+ (KJS::parseDate):
+ Remove unnecessary and incorrect memset() calls - GregorianDateTime can initialize itself.
+
+2008-02-25 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Dan Bernstein.
+
+ - Add a variant of remove that takes a position and a length.
+
+ * wtf/Vector.h:
+ (WTF::Vector::remove):
+
+2008-02-25 Mark Mentovai <mark@moxienet.com>
+
+ Reviewed by Mark Rowe.
+
+ Enable CollectorHeapIntrospector to build by itself, as well as in an AllInOneFile build.
+ http://bugs.webkit.org/show_bug.cgi?id=17538
+
+ * kjs/CollectorHeapIntrospector.cpp: Provide "using" declaration for
+ WTF::RemoteMemoryReader.
+ * kjs/collector.h: Move CollectorHeap declaration here...
+ * kjs/collector.cpp: ... from here.
+
+2008-02-25 Darin Adler <darin@apple.com>
+
+ Reviewed by Adam.
+
+ * JavaScriptCore.exp: Sort the contents of this file.
+
+2008-02-25 Adam Roben <aroben@apple.com>
+
+ MSVC build fix
+
+ * kjs/testkjs.cpp:
+ (functionQuit): Don't add a return statement after exit(0) for MSVC.
+
+2008-02-24 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Mark Rowe.
+
+ http://bugs.webkit.org/show_bug.cgi?id=17529
+ Add support for reading from stdin from testkjs
+
+ * kjs/testkjs.cpp:
+ (GlobalObject::GlobalObject): Add readline function to global object.
+ (functionReadline): Added. Reads characters from stdin until a '\n' or
+ EOF is encountered. The input is returned as a String to the caller.
+
+2008-02-24 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Mark Rowe.
+
+ http://bugs.webkit.org/show_bug.cgi?id=17528
+ Give testkjs a bath
+
+ * JavaScriptCore.exp:
+ * JavaScriptCore.xcodeproj/project.pbxproj: Make the testkjs.cpp use 4 space indentation.
+ * kjs/testkjs.cpp:
+ (StopWatch::getElapsedMS):
+ (GlobalObject::className):
+ (GlobalObject::GlobalObject):
+ Rename GlobalImp to GlobalObject and setup the global functions
+ in the GlobalObject's constructor. Also, use static functions for
+ the implementation so we can use the standard PrototypeFunction
+ class and remove TestFunctionImp.
+ (functionPrint): Move print() functionality here.
+ (functionDebug): Move debug() functionality here.
+ (functionGC): Move gc() functionality here.
+ (functionVersion): Move version() functionality here.
+ (functionRun): Move run() functionality here.
+ (functionLoad): Move load() functionality here.
+ (functionQuit): Move quit() functionality here.
+ (prettyPrintScript): Fix indentation.
+ (runWithScripts): Since all the functionality of createGlobalObject is
+ now in the GlobalObject constructor, just call new here.
+ (parseArguments): Fix indentation.
+ (kjsmain): Ditto
+ (fillBufferWithContentsOfFile): Ditto.
+
+2008-02-24 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Oliver Hunt and Mark Rowe.
+
+ http://bugs.webkit.org/show_bug.cgi?id=17505
+ Add support for getting command line arguments in testkjs
+
+ - This slightly changes the behavior of parsing arguments by requiring
+ a '-f' before all files.
+
+ * kjs/testkjs.cpp:
+ (createGlobalObject): Add a global property called 'arguments' which
+ contains an array with the parsed arguments as strings.
+ (runWithScripts): Pass in the arguments vector so that it can be passed
+ to the global object.
+ (parseArguments): Change parsing rules to require a '-f' before any script
+ file. After all '-f' and '-p' arguments have been parsed, the remaining
+ are added to the arguments vector and exposed to the script. If there is a
+ chance of ambiguity (the user wants to pass the string '-f' to the script),
+ the string '--' can be used separate the options from the pass through
+ arguments.
+ (kjsmain):
+
+2008-02-24 Dan Bernstein <mitz@apple.com>
+
+ Reviewed by Darin Adler.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=17511
+ REGRESSION: Reproducible crash in SegmentedSubstring::SegmentedSubstring(SegmentedSubstring const&)
+
+ * wtf/Deque.h:
+ (WTF::::expandCapacityIfNeeded): Fixed the case where m_start and m_end
+ are both zero but the buffer capacity is non-zero.
+ (WTF::::prepend): Added validity checks.
+
+2008-02-23 Jan Michael Alonzo <jmalonzo@unpluggable.com>
+
+ Rubber stamped by Darin.
+
+ Add separator '\' after libJavaScriptCore_la_LIBADD and cleanup
+ whitespaces introduced in the previous commit.
+
+ * GNUmakefile.am:
+
+2008-02-23 Jan Michael Alonzo <jmalonzo@unpluggable.com>
+
+ * GNUmakefile.am: Add GLOBALDEPS for testkjs and minidom.
+
+2008-02-23 Darin Adler <darin@apple.com>
+
+ Reviewed by Anders.
+
+ - http://bugs.webkit.org/show_bug.cgi?id=17496
+ make Deque use a circular array; add iterators
+
+ * wtf/Deque.h: Wrote an all-new version of this class that uses a circular
+ buffer. Growth policy is identical to vector. Added iterators.
+
+ * wtf/Vector.h: Made two small refinements while using this to implement
+ Deque: Made VectorBufferBase derive from Noncopyable, which would have
+ saved me some debugging time if it had been there. Renamed Impl and
+ m_impl to Buffer and m_buffer.
+
+2008-02-23 Darin Adler <darin@apple.com>
+
+ Reviewed by Anders.
+
+ - http://bugs.webkit.org/show_bug.cgi?id=17067
+ eliminate attributes parameter from JSObject::put for speed/clarity
+
+ * API/JSCallbackObject.h: Removed attribute arguments.
+ * API/JSCallbackObjectFunctions.h:
+ (KJS::JSCallbackObject<Base>::put): Ditto.
+ * API/JSObjectRef.cpp:
+ (JSObjectSetProperty): Use initializeVariable or putDirect when necessary
+ to set attribute values.
+ * JavaScriptCore.exp: Updated.
+ * bindings/objc/objc_runtime.h: Removed attribute arguments.
+ * bindings/objc/objc_runtime.mm:
+ (ObjcFallbackObjectImp::put): Ditto.
+ * bindings/runtime_array.cpp:
+ (RuntimeArray::put): Ditto.
+ * bindings/runtime_array.h: Ditto.
+ * bindings/runtime_object.cpp:
+ (RuntimeObjectImp::put): Ditto.
+ * bindings/runtime_object.h: Ditto. Also removed canPut which was only
+ called from one place in WebCore that can use hasProperty instead.
+
+ * kjs/Activation.h: Removed attribute argument from put and added the new
+ initializeVariable function that's used to put variables in variable objects.
+ Also made isActivationObject a const member.
+
+ * kjs/JSGlobalObject.cpp:
+ (KJS::JSGlobalObject::put): Removed attribute argument.
+ (KJS::JSGlobalObject::initializeVariable): Added. Used to give variables
+ their initial values, which can include the read-only property.
+ (KJS::JSGlobalObject::reset): Removed obsolete comments about flags.
+ Removed Internal flag, which is no longer needed.
+ * kjs/JSGlobalObject.h: More of the same.
+
+ * kjs/JSVariableObject.h: Added pure virtual initializeVariable function.
+ (KJS::JSVariableObject::symbolTablePut): Removed checkReadOnly flag; we always
+ check read-only.
+ (KJS::JSVariableObject::symbolTableInitializeVariable): Added.
+
+ * kjs/array_instance.cpp:
+ (KJS::ArrayInstance::put): Removed attribute argument.
+ * kjs/array_instance.h: Ditto.
+
+ * kjs/function.cpp:
+ (KJS::FunctionImp::put): Ditto.
+ (KJS::Arguments::put): Ditto.
+ (KJS::ActivationImp::put): Ditto.
+ (KJS::ActivationImp::initializeVariable): Added.
+ * kjs/function.h: Removed attribute arguments.
+
+ * kjs/function_object.cpp:
+ (KJS::FunctionObjectImp::construct): Removed Internal flag.
+
+ * kjs/lookup.h:
+ (KJS::lookupPut): Removed attributes argument. Also changed to use putDirect
+ instead of calling JSObject::put.
+ (KJS::cacheGlobalObject): Ditto.
+
+ * kjs/nodes.cpp:
+ (KJS::ConstDeclNode::handleSlowCase): Call initializeVariable to initialize
+ the constant.
+ (KJS::ConstDeclNode::evaluateSingle): Ditto.
+ (KJS::TryNode::execute): Use putDirect to set up the new object.
+ (KJS::FunctionBodyNode::processDeclarations): Removed Internal.
+ (KJS::ProgramNode::processDeclarations): Ditto.
+ (KJS::EvalNode::processDeclarations): Call initializeVariable to initialize
+ the variables and functions.
+ (KJS::FuncDeclNode::makeFunction): Removed Internal.
+ (KJS::FuncExprNode::evaluate): Ditto.
+
+ * kjs/object.cpp: Removed canPut, which was only being used in one code path,
+ not the normal high speed one.
+ (KJS::JSObject::put): Removed attribute argument. Moved the logic from
+ canPut here, in the one code ath that was still using it.
+ * kjs/object.h: Removed Internal attribute, ad canPut function. Removed the
+ attributes argument to the put function. Made isActivationObject const.
+
+ * kjs/regexp_object.cpp:
+ (KJS::RegExpImp::put): Removed attributes argument.
+ (KJS::RegExpImp::putValueProperty): Ditto.
+ (KJS::RegExpObjectImp::put): Ditto.
+ (KJS::RegExpObjectImp::putValueProperty): Ditto.
+ * kjs/regexp_object.h: Ditto.
+
+ * kjs/string_object.cpp:
+ (KJS::StringInstance::put): Removed attributes argument.
+ * kjs/string_object.h: Ditto.
+
+2008-02-23 Jan Michael Alonzo <jmalonzo@unpluggable.com>
+
+ Not reviewed, Gtk build fix.
+
+ * kjs/testkjs.pro:
+
+2008-02-23 Alexey Proskuryakov <ap@webkit.org>
+
+ Windows build fix - move ThreadCondition implementation from WebCore to WTF.
+
+ * wtf/ThreadingWin.cpp:
+ (WTF::ThreadCondition::ThreadCondition):
+ (WTF::ThreadCondition::~ThreadCondition):
+ (WTF::ThreadCondition::wait):
+ (WTF::ThreadCondition::signal):
+ (WTF::ThreadCondition::broadcast):
+
+2008-02-23 Alexey Proskuryakov <ap@webkit.org>
+
+ Touch some files, hoping that Windows build bot will create JSC headers.
+
+ * kjs/AllInOneFile.cpp:
+ * kjs/array_instance.cpp:
+ * wtf/HashTable.cpp:
+
+2008-02-23 Alexey Proskuryakov <ap@webkit.org>
+
+ Qt/Wx build fix - this file was still in a wrong namespace, too.
+
+ * wtf/ThreadingNone.cpp:
+
+2008-02-23 Alexey Proskuryakov <ap@webkit.org>
+
+ More build fixing - fix mismatched braces.
+
+ * JavaScriptCore.pri:
+
+2008-02-23 Alexey Proskuryakov <ap@webkit.org>
+
+ Wx and Gtk build fixes.
+
+ * JavaScriptCore.pri: Don't try to compile ThreadingPthreads.
+ * wtf/ThreadingGtk.cpp: Use a correct namespace.
+
+2008-02-23 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Darin.
+
+ Move basic threading support from WebCore to WTF.
+
+ Added mutex protection to MessageQueue::killed() for paranoia sake.
+
+ * GNUmakefile.am:
+ * JavaScriptCore.exp:
+ * JavaScriptCore.pri:
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * JavaScriptCoreSources.bkl:
+ * wtf/Locker.h: Copied from WebCore/platform/Locker.h.
+ * wtf/MessageQueue.h: Copied from WebCore/platform/MessageQueue.h.
+ (WTF::::killed):
+ * wtf/Threading.h: Copied from WebCore/platform/Threading.h.
+ * wtf/ThreadingGtk.cpp: Copied from WebCore/platform/gtk/ThreadingGtk.cpp.
+ (WebCore::createThread):
+ * wtf/ThreadingNone.cpp: Copied from WebCore/platform/ThreadingNone.cpp.
+ * wtf/ThreadingPthreads.cpp: Copied from WebCore/platform/pthreads/ThreadingPthreads.cpp.
+ (WTF::createThread):
+ * wtf/ThreadingWin.cpp: Copied from WebCore/platform/win/ThreadingWin.cpp.
+ (WTF::createThread):
+ (WTF::Mutex::Mutex):
+ (WTF::Mutex::~Mutex):
+ (WTF::Mutex::lock):
+ (WTF::Mutex::tryLock):
+ (WTF::Mutex::unlock):
+
+2008-02-22 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Partial fix for <rdar://problem/5744037> Gmail out of memory (17455)
+
+ I'm removing KJS_MEM_LIMIT for the following reasons:
+
+ - We have a few reports of KJS_MEM_LIMIT breaking important web
+ applications, like GMail and Google Reader. (For example, if you
+ simply open 12 GMail tabs, tab #12 will hit the limit.)
+
+ - Firefox has no discernable JS object count limit, so any limit, even
+ a large one, is a potential compatibility problem.
+
+ - KJS_MEM_LIMIT does not protect against malicious memory allocation,
+ since there are many ways to maliciously allocate memory without
+ increasing the JS object count.
+
+ - KJS_MEM_LIMIT is already mostly broken, since it only aborts the
+ script that breaches the limit, not any subsequent scripts.
+
+ - We've never gotten bug reports about websites that would have
+ benefited from an unbroken KJS_MEM_LIMIT. The initial check-in of
+ KJS_MEM_LIMIT (KJS revision 80061) doesn't mention a website that
+ needed it.
+
+ - Any website that brings you anywhere close to crashing due to the
+ number of live JS objects will almost certainly put up the "slow
+ script" dialog at least 20 times beforehand.
+
+ * kjs/collector.cpp:
+ (KJS::Collector::collect):
+ * kjs/collector.h:
+ * kjs/nodes.cpp:
+ (KJS::TryNode::execute):
+
+2008-02-22 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Alexey P.
+
+ <rdar://problem/5759327> REGRESSION: while(NaN) acts like while(true)
+
+ Fix yet another case where we incorrectly relied on implicit double
+ to bool coercion.
+
+ * kjs/nodes.cpp:
+ (KJS::PostDecLocalVarNode::evaluateToBoolean):
+
+2008-02-20 Michael Knaup <michael.knaup@mac.com>
+
+ Reviewed by Darin.
+
+ Fix for Bug 16753: date set methods with no args should result in NaN (Acid3 bug)
+ The set values result in NaN now when called with no args, NaN or +/- inf values.
+ The setYear, setFullYear and setUTCFullYear methods used on NaN dates work as
+ descripted in the standard.
+
+ * kjs/date_object.cpp:
+ (KJS::fillStructuresUsingTimeArgs):
+ (KJS::fillStructuresUsingDateArgs):
+ (KJS::setNewValueFromTimeArgs):
+ (KJS::setNewValueFromDateArgs):
+ (KJS::dateProtoFuncSetYear):
+
+2008-02-19 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Darin.
+
+ Change OpaqueJSClass and RootObject to start with a ref count of 1.
+
+ * API/JSClassRef.cpp:
+ (OpaqueJSClass::OpaqueJSClass):
+ (OpaqueJSClass::createNoAutomaticPrototype):
+ (OpaqueJSClass::create):
+ * API/JSClassRef.h:
+ * API/JSObjectRef.cpp:
+ (JSClassCreate):
+ * bindings/runtime_root.cpp:
+ (KJS::Bindings::RootObject::create):
+ (KJS::Bindings::RootObject::RootObject):
+
+2008-02-19 Darin Adler <darin@apple.com>
+
+ Rubber stamped by Anders.
+
+ - removed explicit initialization to 1 for RefCounted; that's now the default
+
+ * kjs/regexp.cpp:
+ (KJS::RegExp::RegExp): Removed RefCounted initializer.
+
+2008-02-19 Darin Adler <darin@apple.com>
+
+ Reviewed by Anders.
+
+ - next step for http://bugs.webkit.org/show_bug.cgi?id=17257
+ start ref counts at 1 instead of 0 for speed
+
+ * wtf/RefCounted.h:
+ (WTF::RefCounted::RefCounted): Have refcounts default to 1. This allows us to start
+ removing the explicit initialization of RefCounted from classes and eventually we
+ can remove the ability to have the initial count of 0 entirely.
+
+2008-02-18 Samuel Weinig <sam@webkit.org>
+
+ Reviewed by Geoff Garen.
+
+ Fix for http://bugs.webkit.org/show_bug.cgi?id=17419
+ Remove CompatMode from JavaScriptCore as it is never set to anything other than NativeMode
+
+ * kjs/JSGlobalObject.cpp:
+ (KJS::JSGlobalObject::init):
+ * kjs/JSGlobalObject.h:
+ (KJS::JSGlobalObject::setDebugger):
+ * kjs/date_object.cpp:
+ (KJS::dateProtoFuncGetYear):
+
+2008-02-18 Darin Adler <darin@apple.com>
+
+ Reviewed by Sam.
+
+ * wtf/ASCIICType.h:
+ (WTF::toASCIIHexValue): Added.
+
+2008-02-17 Darin Adler <darin@apple.com>
+
+ * wtf/ListHashSet.h: (WTF::swap): Removed stray return statement.
+
+2008-02-15 Adam Roben <aroben@apple.com>
+
+ Make JavaScriptCore's FEATURE_DEFINES match WebCore's
+
+ Reviewed by Mark.
+
+ * Configurations/JavaScriptCore.xcconfig:
+
+2008-02-14 Stephanie Lewis <slewis@apple.com>
+
+ Reviewed by Geoff.
+
+ Update order files.
+
+ * JavaScriptCore.order:
+
+2008-02-14 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Fixed <rdar://problem/5737835> nee http://bugs.webkit.org/show_bug.cgi?id=17329
+ Crash in JSGlobalObject::popActivation when inserting hyperlink in Wordpress (17329)
+
+ Don't reset the "activations" stack in JSGlobalObject::reset, since we
+ might be executing a script during the call to reset, and the script
+ needs to safely run to completion.
+
+ Instead, initialize the "activations" stack when the global object is
+ created, and subsequently rely on pushing and popping during normal
+ execution to maintain the stack's state.
+
+ * kjs/JSGlobalObject.cpp:
+ (KJS::JSGlobalObject::init):
+ (KJS::JSGlobalObject::reset):
+
+2008-02-13 Bernhard Rosenkraenzer <bero@arklinux.org>
+
+ Reviewed by Darin.
+
+ - http://bugs.webkit.org/show_bug.cgi?id=17339
+ JavaScriptCore does not build with gcc 4.3
+
+ * kjs/interpreter.cpp: Add include of <unistd.h>, since that's where
+ getpid() comes from.
+
+2008-02-13 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Alexey P.
+
+ <rdar://problem/5737003> REGRESSION (r27747): can't browse pictures on fastcupid.com
+
+ When converting numeric values to booleans we need to account for NaN
+
+ * kjs/nodes.cpp:
+ (KJS::MultNode::evaluateToBoolean):
+ (KJS::ModNode::evaluateToBoolean):
+
+2008-02-08 Samuel Weinig <sam@webkit.org>
+
+ Reviewed by Brady Eidson.
+
+ <rdar://problem/5659216> REGRESSION: PLT 0.3% slower due to r28868 (caching ClassNodeList and NamedNodeList)
+
+ - Tweak the statements in isASCIISpace to account for the statistical distribution of
+ usage in the PLT.
+
+ .4% speedup on my machine. Stephanie's machine shows this as .3% speedup.
+
+ * wtf/ASCIICType.h:
+ (WTF::isASCIISpace):
+
+2008-02-11 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Anders Carlsson.
+
+ Fixes for:
+ <rdar://problem/5735497> Match Firefox's cross-domain model more accurately by return the built-in version of functions even if they have been overridden
+ <rdar://problem/5735443> Crash when setting the Window objects prototype to a custom Object and then calling a method on it
+
+ - Expose the native Object.prototype.toString implementation so that it can be used for cross-domain
+ toString calling.
+
+ * JavaScriptCore.exp:
+ * kjs/object_object.cpp:
+ * kjs/object_object.h:
+
+2008-02-10 Darin Adler <darin@apple.com>
+
+ Rubber stamped by Eric.
+
+ * kjs/ExecState.h:
+ (KJS::ExecState::takeException): Added.
+
+2008-02-10 Darin Adler <darin@apple.com>
+
+ Reviewed by Eric.
+
+ - http://bugs.webkit.org/show_bug.cgi?id=17256
+ eliminate default ref. count of 0 in RefCounted class
+
+ * wtf/RefCounted.h:
+ (WTF::RefCounted::RefCounted): Remove default of 0.
+
+2008-02-10 Darin Adler <darin@apple.com>
+
+ Reviewed by Eric.
+
+ - http://bugs.webkit.org/show_bug.cgi?id=17256
+ Make clients of RefCounted explicitly set the count to 0.
+
+ * API/JSClassRef.cpp:
+ (OpaqueJSClass::OpaqueJSClass):
+ * bindings/runtime_root.cpp:
+ (KJS::Bindings::RootObject::RootObject):
+
+2008-02-09 Darin Adler <darin@apple.com>
+
+ Reviewed by Mitz.
+
+ - http://bugs.webkit.org/show_bug.cgi?id=17256
+ Change RegExp to start its ref count at 1, not 0
+
+ We'll want to do this to every RefCounted class, one at a time.
+
+ * kjs/nodes.h:
+ (KJS::RegExpNode::RegExpNode): Use RegExp::create instead of new RegExp.
+ * kjs/regexp.cpp:
+ (KJS::RegExp::RegExp): Marked inline, set initial ref count to 1.
+ (KJS::RegExp::create): Added. Calls new RegExp then adopts the initial ref.
+ * kjs/regexp.h: Reformatted. Made the constructors private. Added static
+ create functions that return objects already wrapped in PassRefPtr.
+ * kjs/regexp_object.cpp:
+ (KJS::regExpProtoFuncCompile): Use RegExp::create instead of new RegExp.
+ (KJS::RegExpObjectImp::construct): Ditto.
+ * kjs/string_object.cpp:
+ (KJS::stringProtoFuncMatch): Ditto.
+ (KJS::stringProtoFuncSearch): Ditto.
+
+2008-02-08 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej.
+
+ <rdar://problem/5731773> REGRESSION (r28973): Extraneous parentheses in function.toString()
+ https://bugs.webkit.org/show_bug.cgi?id=17214
+
+ Make a subclass of CommaNode to provide the correct precedence for each expression in
+ a variable declaration list.
+
+ * kjs/grammar.y:
+ * kjs/nodes.h:
+ (KJS::VarDeclCommaNode::):
+
+2008-02-08 Darin Adler <darin@apple.com>
+
+ Reviewed by Oliver.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=17247
+ Labelled continue/break can fail in some cases
+
+ Test: fast/js/continue-break-multiple-labels.html
+
+ * kjs/nodes.h:
+ (KJS::StatementNode::pushLabel): Made this virtual.
+ (KJS::LabelNode::pushLabel): Forward pushLabel calls to the statement inside.
+
+2008-02-08 Darin Adler <darin@apple.com>
+
+ Reviewed by Eric.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=15003
+ Function.prototype.constructor should not be DontDelete/ReadOnly (Acid3 bug)
+
+ Test: fast/js/constructor-attributes.html
+
+ * kjs/JSGlobalObject.cpp:
+ (KJS::JSGlobalObject::reset): Remove unwanted attributes from "constructor".
+ * kjs/function_object.cpp:
+ (KJS::FunctionObjectImp::construct): Ditto.
+ * kjs/nodes.cpp:
+ (KJS::FuncDeclNode::makeFunction): Ditto.
+ (KJS::FuncExprNode::evaluate): Ditto.
+
+2008-02-06 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Added an ASSERT to catch refCount underflow, since it caused a leak in
+ my last check-in.
+
+ * wtf/RefCounted.h:
+ (WTF::RefCounted::deref):
+
+2008-02-06 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ PLT speedup related to <rdar://problem/5659272> REGRESSION: PLT .4%
+ slower due to r28884 (global variable symbol table optimization)
+
+ Tweaked RefCounted::deref() to be a little more efficient.
+
+ 1% - 1.5% speedup on my machine. .7% speedup on Stephanie's machine.
+
+ * wtf/RefCounted.h:
+ (WTF::RefCounted::deref): Don't modify m_refCount if we're just going
+ to delete the object anyway. Also, use a simple == test, which might be
+ faster than <= on some hardware.
+
+2008-02-06 Darin Adler <darin@apple.com>
+
+ Reviewed by Sam.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=17094
+ Array.prototype functions create length properties with DontEnum/DontDelete
+
+ Test results match Gecko with very few obscure exceptions that seem to be
+ bugs in Gecko.
+
+ Test: fast/js/array-functions-non-arrays.html
+
+ * kjs/array_object.cpp:
+ (KJS::arrayProtoFuncConcat): Removed DontEnum and DontDelete from the call
+ to set length.
+ (KJS::arrayProtoFuncPop): Ditto. Also added missing call to deleteProperty,
+ which is not needed for real arrays, but is needed for non-arrays.
+ (KJS::arrayProtoFuncPush): Ditto.
+ (KJS::arrayProtoFuncShift): Ditto.
+ (KJS::arrayProtoFuncSlice): Ditto.
+ (KJS::arrayProtoFuncSort): Removed incorrect call to set length when
+ the array has no elements.
+ (KJS::arrayProtoFuncSplice): Removed DontEnum and DontDelete from the call
+ to set length.
+ (KJS::arrayProtoFuncUnShift): Ditto. Also added a check for 0 arguments to
+ make behavior match the specification in that case.
+ * kjs/nodes.cpp:
+ (KJS::ArrayNode::evaluate): Removed DontEnum and DontDelete from the call
+ to set length.
+
+2008-02-06 Darin Adler <darin@apple.com>
+
+ Reviewed by Sam.
+
+ - replace calls to put to set up properties with calls to putDirect, to
+ prepare for a future change where put won't take attributes any more,
+ and for a slight performance boost
+
+ * API/JSObjectRef.cpp:
+ (JSObjectMakeConstructor): Use putDirect instead of put.
+ * kjs/CommonIdentifiers.h: Removed lastIndex.
+ * kjs/JSGlobalObject.cpp:
+ (KJS::JSGlobalObject::reset): Use putDirect instead of put.
+ * kjs/array_object.cpp:
+ (KJS::arrayProtoFuncConcat): Took out extra call to get length (unused).
+ (KJS::ArrayObjectImp::ArrayObjectImp): Use putDirect instead of put.
+ * kjs/error_object.cpp:
+ (KJS::ErrorPrototype::ErrorPrototype): Use putDirect instead of put.
+ * kjs/function.cpp:
+ (KJS::Arguments::Arguments): Use putDirect instead of put.
+ (KJS::PrototypeFunction::PrototypeFunction): Use putDirect instead of put.
+ * kjs/function_object.cpp:
+ (KJS::FunctionObjectImp::construct): Use putDirect instead of put.
+ * kjs/nodes.cpp:
+ (KJS::FuncDeclNode::makeFunction): Use putDirect instead of put.
+ (KJS::FuncExprNode::evaluate): Use putDirect instead of put.
+ * kjs/regexp_object.cpp:
+ (KJS::regExpProtoFuncCompile): Use setLastIndex instead of put(lastIndex).
+ (KJS::RegExpImp::match): Get and set lastIndex by using m_lastIndex instead of
+ calling get and put.
+ * kjs/regexp_object.h:
+ (KJS::RegExpImp::setLastIndex): Added.
+ * kjs/string_object.cpp:
+ (KJS::stringProtoFuncMatch): Use setLastIndex instead of put(lastIndex).
+
+2008-02-05 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Anders Carlsson.
+
+ Fix for http://bugs.webkit.org/show_bug.cgi?id=8080
+ NodeList (and other DOM lists) items are not enumeratable using for..in
+
+ * JavaScriptCore.exp:
+
+2008-02-05 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Update versioning to support the mysterious future.
+
+ * Configurations/Version.xcconfig: Add SYSTEM_VERSION_PREFIX_1060.
+
+2008-02-04 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Oliver Hunt.
+
+ Fixes Bug 16889: REGRESSION (r29425): Canvas-based graphing calculator fails to run
+ Bug 17015: REGRESSION (r29414-29428): www.fox.com "shows" menu fails to render
+ Bug 17164: REGRESSION: JavaScript pop-up menu appears at wrong location when hovering image at http://news.chinatimes.com/
+
+ <http://bugs.webkit.org/show_bug.cgi?id=16889>
+ <rdar://problem/5696255>
+
+ <http://bugs.webkit.org/show_bug.cgi?id=17015>
+
+ <http://bugs.webkit.org/show_bug.cgi?id=17164>
+ <rdar://problem/5720947>
+
+ The ActivationImp tear-off (r29425) introduced a problem with ReadModify
+ nodes that first resolve a slot, call valueForReadModifyNode(), and then
+ store a value in the previously resolved slot. Since valueForReadModifyNode()
+ may cause a tear-off, the slot needs to be resolved again, but this was
+ not happening with the existing code.
+
+ * kjs/nodes.cpp:
+ (KJS::ReadModifyLocalVarNode::evaluate):
+ (KJS::ReadModifyResolveNode::evaluate):
+
+2008-02-04 Cameron McCormack <cam@mcc.id.au>
+
+ Reviewed by Geoff Garen.
+
+ Remove some unneccesary UNUSED_PARAMs. Clarify ownership rule of return value of JSObjectCopyPropertyNames.
+
+ * API/JSNode.c:
+ (JSNode_appendChild):
+ (JSNode_removeChild):
+ (JSNode_replaceChild):
+ (JSNode_getNodeType):
+ (JSNode_getFirstChild):
+ * API/JSNodeList.c:
+ (JSNodeList_length):
+ * API/JSObjectRef.h:
+
+2008-02-04 Rodney Dawes <dobey@wayofthemonkey.com>
+
+ Reviewed by Alp Toker and Mark Rowe.
+
+ Fix http://bugs.webkit.org/show_bug.cgi?id=17175.
+ Bug 17175: Use of C++ compiler flags in CFLAGS
+
+ * GNUmakefile.am: Use global_cxxflags as well as global_cflags in CXXFLAGS.
+
+2008-02-04 Alp Toker <alp@atoker.com>
+
+ Rubber-stamped by Mark Rowe.
+
+ Remove all trailing whitespace in the GTK+ port and related
+ components.
+
+ * GNUmakefile.am:
+
+2008-02-02 Darin Adler <darin@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ PLT speedup related to <rdar://problem/5659272> REGRESSION: PLT .4%
+ slower due to r28884 (global variable symbol table optimization)
+
+ Geoff's theory is that the slowdown was due to copying hash tables when
+ putting things into the back/forward cache. If that's true, then this
+ should fix the problem.
+
+ (According to Geoff's measurements, in a PLT that exaggerates the
+ importance of symbol table saving during cached page creation, this
+ patch is a ~3X speedup in cached page creation, and a 9% speedup overall.)
+
+ * JavaScriptCore.exp: Updated.
+
+ * kjs/JSVariableObject.cpp:
+ (KJS::JSVariableObject::saveLocalStorage): Updated for changes to SavedProperty,
+ which has been revised to avoid initializing each SavedProperty twice when building
+ the array. Store the property names too, so we don't have to store the symbol table
+ separately. Do this by iterating the symbol table instead of the local storage vector.
+ (KJS::JSVariableObject::restoreLocalStorage): Ditto. Restore the symbol table as
+ well as the local storage vector.
+
+ * kjs/JSVariableObject.h: Removed save/restoreSymbolTable and do that work inside
+ save/restoreLocalStorage instead. Made restoreLocalStorage a non-const member function
+ that takes a const reference to a SavedProperties object.
+
+ * kjs/LocalStorage.h: Changed attributes to be unsigned instead of int to match
+ other declarations of attributes elsewhere.
+
+ * kjs/property_map.cpp:
+ (KJS::SavedProperties::SavedProperties): Updated for data member name change.
+ (KJS::PropertyMap::save): Updated for data member name change and to use the new
+ inline init function instead of setting the fields directly. This allows us to
+ skip initializing the SavedProperty objects when first allocating the array, and
+ just do it when we're actually setting up the individual elements.
+ (KJS::PropertyMap::restore): Updated for SavedProperty changes.
+
+ * kjs/property_map.h: Changed SavedProperty from a struct to a class. Set it up so
+ it does not get initialized at construction time to avoid initializing twice when
+ creating an array of SavedProperty. Removed the m_ prefixes from the members of
+ the SavedProperties struct. Generally we use m_ for class members and not struct.
+
+2008-02-02 Tony Chang <idealisms@gmail.com>
+
+ Reviewed by darin. Landed by eseidel.
+
+ Add #define guards for WIN32_LEAN_AND_MEAN and _CRT_RAND_S.
+
+ * kjs/config.h:
+ * wtf/FastMalloc.cpp:
+ * wtf/TCSpinLock.h:
+
+2008-01-28 Sam Weinig <sam@webkit.org>
+
+ Rubber-stamped by Darin Adler.
+
+ - Fix whitespace in nodes.h/cpp and nodes2string.cpp.
+
+ (NOTE: Specific changed functions elided for space and clarity)
+ * kjs/nodes.cpp:
+ * kjs/nodes.h:
+ * kjs/nodes2string.cpp:
+
+2008-01-27 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Oliver Hunt.
+
+ Patch for http://bugs.webkit.org/show_bug.cgi?id=17025
+ nodes.h/cpp has been rolling around in the mud - lets hose it down
+
+ - Rename member variables to use the m_ prefix.
+
+ (NOTE: Specific changed functions elided for space and clarity)
+ * kjs/grammar.y:
+ * kjs/nodes.cpp:
+ * kjs/nodes.h:
+ * kjs/nodes2string.cpp:
+
+2008-01-27 Darin Adler <darin@apple.com>
+
+ Reviewed by Oliver.
+
+ - fix <rdar://problem/5657450> REGRESSION: const is broken
+
+ Test: fast/js/const.html
+
+ SunSpider said this was 0.3% slower. And I saw some Shark samples in
+ JSGlobalObject::put -- not a lot but a few. We may be able to regain the
+ speed, but for now we will take that small hit for correctness sake.
+
+ * kjs/JSGlobalObject.cpp:
+ (KJS::JSGlobalObject::put): Pass the checkReadOnly flag in to symbolTablePut
+ instead of passing attributes.
+
+ * kjs/JSVariableObject.h:
+ (KJS::JSVariableObject::symbolTablePut): Removed the code to set attributes
+ here, since we only set attributes when creating a property. Added the code
+ to check read-only here, since we need that to implement const!
+
+ * kjs/function.cpp:
+ (KJS::ActivationImp::put): Pass the checkReadOnly flag in to symbolTablePut
+ instead of passing attributes.
+
+ * kjs/nodes.cpp:
+ (KJS::isConstant): Added.
+ (KJS::PostIncResolveNode::optimizeVariableAccess): Create a PostIncConstNode
+ if optimizing for a local variable and the variable is constant.
+ (KJS::PostDecResolveNode::optimizeVariableAccess): Ditto. But PostDecConstNode.
+ (KJS::PreIncResolveNode::optimizeVariableAccess): Ditto. But PreIncConstNode.
+ (KJS::PreDecResolveNode::optimizeVariableAccess): Ditto. But PreDecConstNode.
+ (KJS::PreIncConstNode::evaluate): Return the value + 1.
+ (KJS::PreDecConstNode::evaluate): Return the value - 1.
+ (KJS::PostIncConstNode::evaluate): Return the value converted to a number.
+ (KJS::PostDecConstNode::evaluate): Ditto.
+ (KJS::ReadModifyResolveNode::optimizeVariableAccess): Create a ReadModifyConstNode
+ if optimizing for a local variable and the variable is constant.
+ (KJS::AssignResolveNode::optimizeVariableAccess): Ditto. But AssignConstNode.
+ (KJS::ScopeNode::optimizeVariableAccess): Pass the local storage to the
+ node optimizeVariableAccess functions, since that's where we need to look to
+ figure out if a variable is constant.
+ (KJS::FunctionBodyNode::processDeclarations): Moved the call to
+ optimizeVariableAccess until after localStorage is set up.
+ (KJS::ProgramNode::processDeclarations): Ditto.
+
+ * kjs/nodes.h: Fixed the IsConstant and HasInitializer values. They are used
+ as flag masks, so a value of 0 will not work for IsConstant. Changed the
+ first parameter to optimizeVariableAccess to be a const reference to a symbol
+ table and added a const reference to local storage. Added classes for const
+ versions of local variable access: PostIncConstNode, PostDecConstNode,
+ PreIncConstNode, PreDecConstNode, ReadModifyConstNode, and AssignConstNode.
+
+ * kjs/object.cpp:
+ (KJS::JSObject::put): Tweaked comments a bit, and changed the checkReadOnly
+ expression to match the form used at the two other call sites.
+
+2008-01-27 Darin Adler <darin@apple.com>
+
+ Reviewed by Oliver.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=16498
+ ''.constructor.toString() gives [function]
+
+ Test: fast/js/function-names.html
+
+ * kjs/array_object.cpp:
+ (KJS::ArrayObjectImp::ArrayObjectImp): Use the class name as the constructor's function name.
+ * kjs/bool_object.cpp:
+ (KJS::BooleanObjectImp::BooleanObjectImp): Ditto.
+ * kjs/date_object.cpp:
+ (KJS::DateObjectImp::DateObjectImp): Ditto.
+ * kjs/error_object.cpp:
+ (KJS::ErrorPrototype::ErrorPrototype): Make the error object be an Error.
+ (KJS::ErrorObjectImp::ErrorObjectImp): Use the class name as the constructor's function name.
+ (KJS::NativeErrorPrototype::NativeErrorPrototype): Take const UString&.
+ (KJS::NativeErrorImp::NativeErrorImp): Use the prototype's name as the constructor's function
+ name.
+ * kjs/error_object.h: Change ErrorPrototype to inherit from ErrorInstance. Change the
+ NativeErrorImp constructor to take a NativeErrorPrototype pointer for its prototype.
+ * kjs/function.h: Removed unneeded constructor for internal functions without names.
+ We want to avoid those!
+ * kjs/function_object.cpp:
+ (KJS::functionProtoFuncToString): Removed code that writes out just [function] for functions
+ that have no names. There's no reason to do that.
+ (KJS::FunctionObjectImp::FunctionObjectImp): Use the class name as the constructor's
+ function name.
+ * kjs/internal.cpp: Removed the unused constructor.
+ * kjs/number_object.cpp:
+ (KJS::fractionalPartToString): Marked static for internal linkage.
+ (KJS::exponentialPartToString): Ditto.
+ (KJS::numberProtoFuncToPrecision): Removed an unneeded else.
+ (KJS::NumberObjectImp::NumberObjectImp): Use the class name as the constructor's
+ function name.
+ (KJS::NumberObjectImp::getValueProperty): Tweaked formatting.
+ * kjs/object_object.cpp:
+ (KJS::ObjectObjectImp::ObjectObjectImp): Use "Object" for the function name.
+ * kjs/regexp_object.cpp:
+ (KJS::RegExpObjectImp::RegExpObjectImp): Use "RegExp" for the function name.
+ * kjs/string_object.cpp:
+ (KJS::StringObjectImp::StringObjectImp): Use the class name as the constructor's
+ function name.
+
+2008-01-26 Darin Adler <darin@apple.com>
+
+ Reviewed by Oliver.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=17027
+ Incorrect Function.toString behaviour with read/modify/write operators performed on negative numbers
+
+ Test: fast/js/function-toString-parentheses.html
+
+ The problem here was that a NumberNode with a negative number in it had the wrong
+ precedence. It's not a primary expression, it's a unary operator with a primary
+ expression after it.
+
+ Once the precedence of NumberNode was fixed, the cases from bug 17020 were also
+ fixed without trying to treat bracket nodes like dot nodes. That wasn't needed.
+ The reason we handle numbers before dot nodes specially is that the dot is a
+ legal character in a number. The same is not true of a bracket. Eventually we
+ could get smarter, and only add the parentheses when there is actual ambiguity.
+ There is none if the string form of the number already has a dot in it, or if
+ it's a number with a alphabetic name like infinity or NAN.
+
+ * kjs/nodes.h: Renamed back from ObjectAccess to DotExpr.
+ (KJS::NumberNode::precedence): Return PrecUnary for negative numbers, since
+ they serialize as a unary operator, not a primary expression.
+ * kjs/nodes2string.cpp:
+ (KJS::SourceStream::operator<<): Clear m_numberNeedsParens if this adds
+ parens; one set is enough.
+ (KJS::bracketNodeStreamTo): Remove unneeded special flag here. Normal
+ operator precedence suffices.
+ (KJS::NewExprNode::streamTo): Ditto.
+
+2008-01-26 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej and Darin.
+
+ Fix for http://bugs.webkit.org/show_bug.cgi?id=17020
+ Function.toString does not parenthesise numbers for the bracket accessor
+
+ It turns out that logic was there for all of the dot accessor nodes to make numbers be
+ parenthesised properly, so it was a trivial extension to extend that to the bracket nodes.
+ I renamed the enum type to reflect the fact that it is now used for both dot and bracket
+ accessors.
+
+ * kjs/nodes2string.cpp:
+ (KJS::bracketNodeStreamTo):
+ (KJS::BracketAccessorNode::streamTo):
+
+2008-01-26 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Darin.
+
+ Fix Bug 17018: Incorrect code generated from Function.toString for get/setters in object literals
+
+ Don't quote getter and setter names during output, as that is simply wrong.
+
+ * kjs/nodes2string.cpp:
+ (KJS::PropertyNode::streamTo):
+
+2008-01-26 Darin Adler <darin@apple.com>
+
+ Reviewed by Eric Seidel.
+
+ - http://bugs.webkit.org/show_bug.cgi?id=16860
+ a bit of cleanup after the Activation optimization
+
+ * JavaScriptCore.exp: Export the GlobalExecState constructor instead of
+ the global flavor of the ExecState constructor. It'd probably be cleaner
+ to not export either one, but JSGlobalObject inlines the code that
+ constructs the ExecState. If we changed that, we could remove this export.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj: Re-sorted a few things and
+ put the new source files into the kjs group rather than at the top level.
+
+ * kjs/ExecState.cpp:
+ (KJS::ExecState::ExecState): Marked inline and updated for data member
+ name changes. This is now only for use for the derived classes. Also removed
+ code that sets the unused m_savedExec data member for the global case. That
+ data member is only used for the other two types.
+ (KJS::ExecState::~ExecState): Marked inline and removed all the code.
+ The derived class destructors now inclde the appropriate code.
+ (KJS::ExecState::lexicalGlobalObject): Removed unneeded special case for
+ an empty scope chain. The bottom function already returns 0 for that case,
+ so the general case code handles it fine. Also changed to use data members
+ directly rather than calling functions.
+ (KJS::GlobalExecState::GlobalExecState): Added. Calls through to the base
+ class constructor.
+ (KJS::GlobalExecState::~GlobalExecState): Added.
+ (KJS::InterpreterExecState::InterpreterExecState): Added. Moved code to
+ manipulate activeExecStates here since we don't want to have to check for the
+ special case of globalExec.
+ (KJS::InterpreterExecState::~InterpreterExecState): Added.
+ (KJS::EvalExecState::EvalExecState): Added.
+ (KJS::EvalExecState::~EvalExecState): Added.
+ (KJS::FunctionExecState::FunctionExecState): Added.
+ (KJS::FunctionExecState::~FunctionExecState): Added.
+
+ * kjs/ExecState.h: Tweaked the header, includes, and declarations a bit.
+ Made ExecState inherit from Noncopyable. Reformatted some comments and
+ made them a bit more brief. Rearranged declarations a little bit and removed
+ unused savedExec function. Changed seenLabels function to return a reference
+ rather than a pointer. Made constructors and destructor protected, and also
+ did the same with all data members. Renamed m_thisVal to m_thisValue and
+ ls to m_labelStack. Added three new derived classes for each of the
+ types of ExecState. The primary goal here was to remove a branch from the
+ code in the destructor, but it's also clearer than overloading the arguments
+ to the ExecState constructor.
+
+ * kjs/JSGlobalObject.cpp:
+ (KJS::getCurrentTime): Fixed formatting.
+ (KJS::JSGlobalObject::pushActivation): Removed parentheses that don't make
+ the expression clearer -- other similar sites didn't have these parentheses,
+ even the one a couple lines earlier that sets stackEntry.
+ (KJS::JSGlobalObject::tearOffActivation): Got rid of unneeded static_cast
+ (I think I mentioned this during patch review) and used an early exit so that
+ the entire contents of the function aren't nested inside an if statement.
+ Also removed the check of codeType, instead checking Activation for 0.
+ For now, I kept the codeType check, but inside an assertion.
+
+ * kjs/JSGlobalObject.h: Changed type of globalExec to GlobalExecState.
+ * kjs/function.cpp:
+ (KJS::FunctionImp::callAsFunction): Changed type to FunctionExecState.
+ (KJS::GlobalFuncImp::callAsFunction): Changed type to EvalExecState.
+ * kjs/interpreter.cpp:
+ (KJS::Interpreter::evaluate): Changed type to GlobalExecState.
+
+ * kjs/nodes.cpp:
+ (KJS::ContinueNode::execute): Changed code since seenLabels() returns a
+ reference now instead of a pointer.
+ (KJS::BreakNode::execute): Ditto.
+ (KJS::LabelNode::execute): Ditto.
+
+2008-01-26 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Mark Rowe.
+
+ Cleanup node2string a little.
+ - Remove some unnecessary branching.
+ - Factor out bracket and dot streaming into static inline functions.
+
+ * kjs/nodes.h:
+ * kjs/nodes2string.cpp:
+ (KJS::bracketNodeStreamTo):
+ (KJS::dotNodeStreamTo):
+ (KJS::FunctionCallBracketNode::streamTo):
+ (KJS::FunctionCallDotNode::streamTo):
+ (KJS::PostIncBracketNode::streamTo):
+ (KJS::PostDecBracketNode::streamTo):
+ (KJS::PostIncDotNode::streamTo):
+ (KJS::PostDecDotNode::streamTo):
+ (KJS::DeleteBracketNode::streamTo):
+ (KJS::DeleteDotNode::streamTo):
+ (KJS::PreIncBracketNode::streamTo):
+ (KJS::PreDecBracketNode::streamTo):
+ (KJS::PreIncDotNode::streamTo):
+ (KJS::PreDecDotNode::streamTo):
+ (KJS::ReadModifyBracketNode::streamTo):
+ (KJS::AssignBracketNode::streamTo):
+ (KJS::ReadModifyDotNode::streamTo):
+ (KJS::AssignDotNode::streamTo):
+ (KJS::WhileNode::streamTo):
+
+2008-01-26 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Fix http://bugs.webkit.org/show_bug.cgi?id=17001
+ Bug 17001: Build error with Gtk port on Mac OS X
+
+ If both XP_MACOSX and XP_UNIX are defined then X11.h and Carbon.h will both be included.
+ These provide conflicting definitions for a type named 'Cursor'. As XP_UNIX is set by
+ the build system when targeting X11, it doesn't make sense for XP_MACOSX to also be set
+ in this instance.
+
+ * bindings/npapi.h: Don't define XP_MACOSX if XP_UNIX is defined.
+
+2008-01-26 Darin Adler <darin@apple.com>
+
+ Reviewed by Oliver.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=17013
+ JSC can't round trip certain for-loops
+
+ Test: fast/js/toString-for-var-decl.html
+
+ * kjs/nodes.h: Added PlaceholderTrueNode so we can put nodes into
+ for loops without injecting the word "true" into them (nice, but not
+ the bug fix). Fixed ForNode constructor so expr1WasVarDecl is set
+ only when there is an expression, since it's common for the actual
+ variable declaration to be moved by the parser.
+
+ * kjs/nodes2string.cpp:
+ (KJS::PlaceholderTrueNode::streamTo): Added. Empty.
+
+2008-01-25 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej.
+
+ Fix for bug 17012: REGRESSION: JSC can't round trip an object literal
+
+ Add logic to ensure that object literals and function expressions get
+ parentheses when necessary.
+
+ * kjs/nodes.h:
+ * kjs/nodes2string.cpp:
+ (KJS::SourceStream::operator<<):
+
+2008-01-24 Steve Falkenburg <sfalken@apple.com>
+
+ Build fix.
+
+ * JavaScriptCore.vcproj/JavaScriptCore.sln:
+
+2008-01-24 Steve Falkenburg <sfalken@apple.com>
+
+ Build fix.
+
+ * JavaScriptCore.vcproj/JavaScriptCoreSubmit.sln:
+
+2008-01-24 Michael Goddard <michael.goddard@trolltech.com>
+
+ Reviewed by Simon.
+
+ Fix QDateTime to JS Date conversion.
+ Several conversion errors (some UTC related, some month
+ offset related) and the conversion distance for Date
+ to DateTime conversion weights were fixed (it should never
+ be better to convert a JS Number into a Date rather than
+ an int).
+
+ * bindings/qt/qt_runtime.cpp:
+ (KJS::Bindings::convertValueToQVariant):
+ (KJS::Bindings::convertQVariantToValue):
+
+2008-01-24 Michael Goddard <michael.goddard@trolltech.com>
+
+ Reviewed by Simon.
+
+ Add support for calling QObjects.
+ Add support for invokeDefaultMethod (via a call to
+ a specific slot), and also allow using it as a
+ constructor, like QtScript.
+
+
+ * bindings/qt/qt_class.cpp:
+ (KJS::Bindings::QtClass::fallbackObject):
+ * bindings/qt/qt_instance.cpp:
+ (KJS::Bindings::QtRuntimeObjectImp::construct):
+ (KJS::Bindings::QtInstance::QtInstance):
+ (KJS::Bindings::QtInstance::~QtInstance):
+ (KJS::Bindings::QtInstance::implementsCall):
+ (KJS::Bindings::QtInstance::invokeDefaultMethod):
+ * bindings/qt/qt_instance.h:
+ * bindings/qt/qt_runtime.cpp:
+ (KJS::Bindings::findMethodIndex):
+ (KJS::Bindings::QtRuntimeMetaMethod::QtRuntimeMetaMethod):
+ (KJS::Bindings::QtRuntimeMetaMethod::callAsFunction):
+ * bindings/qt/qt_runtime.h:
+
+2008-01-24 Michael Goddard <michael.goddard@trolltech.com>
+
+ Reviewed by Simon.
+
+ Code style cleanups.
+ Add spaces before/after braces in inline function.
+
+ * bindings/qt/qt_instance.h:
+
+2008-01-24 Michael Goddard <michael.goddard@trolltech.com>
+
+ Reviewed by Simon.
+
+ Code style cleanups.
+ Remove spaces and unneeded declared parameter names.
+
+ * bindings/qt/qt_instance.cpp:
+ (KJS::Bindings::QtRuntimeObjectImp::removeFromCache):
+
+2008-01-24 Michael Goddard <michael.goddard@trolltech.com>
+
+ Reviewed by Simon.
+
+ Clear stale RuntimeObjectImps.
+ Since other objects can have refs to the QtInstance,
+ we can't rely on the QtInstance being deleted when the
+ RuntimeObjectImp is invalidate or deleted. This
+ could result in a stale JSObject being returned for
+ a valid Instance.
+
+ * bindings/qt/qt_instance.cpp:
+ (KJS::Bindings::QtRuntimeObjectImp::QtRuntimeObjectImp):
+ (KJS::Bindings::QtRuntimeObjectImp::~QtRuntimeObjectImp):
+ (KJS::Bindings::QtRuntimeObjectImp::invalidate):
+ (KJS::Bindings::QtRuntimeObjectImp::removeFromCache):
+ (KJS::Bindings::QtInstance::getRuntimeObject):
+ * bindings/runtime.cpp:
+ (KJS::Bindings::Instance::createRuntimeObject):
+ * bindings/runtime.h:
+
+2008-01-23 Alp Toker <alp@atoker.com>
+
+ Rubber-stamped by Mark Rowe.
+
+ Remove whitespace after -I in automake include lists.
+
+ * GNUmakefile.am:
+
+2008-01-23 Michael Goddard <michael.goddard@trolltech.com>
+
+ Reviewed by Lars Knoll <lars@trolltech.com>.
+
+ Reworked the JavaScriptCore Qt bindings:
+
+ * Add initial support for string and variant arrays, as well
+ as sub QObjects in the JS bindings.
+
+ * Don't expose fields marked as not scriptable by moc.
+
+ * Add support for dynamic properties and accessing named
+ QObject children of an object (like QtScript and older
+ IE DOM style JS).
+ * Add support for custom toString methods.
+
+ * Fine tune some bindings to be closer to QtScript.
+ Make void functions return undefined, and empty/
+ null QStrings return a zero length string.
+
+ * Create framework for allowing more direct method calls.
+ Since RuntimeMethod doesn't allow us to add additional
+ methods/properties to a function, add these classes.
+ Start prototyping object.signal.connect(...).
+
+ * Add signal support to the Qt bindings.
+ Allow connecting to signals (object.signal.connect(slot)),
+ disconnecting, and emitting signals. Currently chooses
+ the first signal that matches the name, so this will need
+ improvement.
+
+ * Add property names, and resolve signals closer to use.
+ Enumerating properties now returns some of the Qt properties
+ and signals. Slots and methods aren't quite present. Also,
+ resolve signal connections etc. closer to the time of use, so
+ we can do more dynamic resolution based on argument type etc.
+ Still picks the first one with the same name, at the moment.
+
+ * Make signature comparison code consistent.
+ Use the same code for checking meta signatures in
+ the method and fallback getters, and avoid a
+ QByteArray construction when we can.
+
+ * Fix minor memory leak, and handle pointers better.
+ Delete the private object in the dtors, and use RefPtrs
+ for holding Instances etc.
+
+ * Handle method lookup better.
+ Allow invocation time method lookup based on the arguments,
+ which is closer to QtScript behaviour. Also, cache the
+ method lists and delete them in the QtClass dtor (stops
+ a memory leak).
+
+ * Improve JS to Qt data type conversions.
+ Add some support for Date & RegExp JS objects,
+ and provide some metrics on the quality of the
+ conversion.
+
+ * A couple of fixes for autotest failures.
+ Better support for converting lists, read/write only
+ QMetaProperty support, modified slot search order...)
+
+ * bindings/qt/qt_class.cpp:
+ (KJS::Bindings::QtClass::QtClass):
+ (KJS::Bindings::QtClass::~QtClass):
+ (KJS::Bindings::QtClass::name):
+ (KJS::Bindings::QtClass::fallbackObject):
+ (KJS::Bindings::QtClass::methodsNamed):
+ (KJS::Bindings::QtClass::fieldNamed):
+ * bindings/qt/qt_class.h:
+ * bindings/qt/qt_instance.cpp:
+ (KJS::Bindings::QtInstance::QtInstance):
+ (KJS::Bindings::QtInstance::~QtInstance):
+ (KJS::Bindings::QtInstance::getRuntimeObject):
+ (KJS::Bindings::QtInstance::getClass):
+ (KJS::Bindings::QtInstance::implementsCall):
+ (KJS::Bindings::QtInstance::getPropertyNames):
+ (KJS::Bindings::QtInstance::invokeMethod):
+ (KJS::Bindings::QtInstance::invokeDefaultMethod):
+ (KJS::Bindings::QtInstance::stringValue):
+ (KJS::Bindings::QtInstance::booleanValue):
+ (KJS::Bindings::QtInstance::valueOf):
+ (KJS::Bindings::QtField::name):
+ (KJS::Bindings::QtField::valueFromInstance):
+ (KJS::Bindings::QtField::setValueToInstance):
+ * bindings/qt/qt_instance.h:
+ (KJS::Bindings::QtInstance::getBindingLanguage):
+ (KJS::Bindings::QtInstance::getObject):
+ * bindings/qt/qt_runtime.cpp:
+ (KJS::Bindings::QWKNoDebug::QWKNoDebug):
+ (KJS::Bindings::QWKNoDebug::~QWKNoDebug):
+ (KJS::Bindings::QWKNoDebug::operator<<):
+ (KJS::Bindings::):
+ (KJS::Bindings::valueRealType):
+ (KJS::Bindings::convertValueToQVariant):
+ (KJS::Bindings::convertQVariantToValue):
+ (KJS::Bindings::QtRuntimeMethod::QtRuntimeMethod):
+ (KJS::Bindings::QtRuntimeMethod::~QtRuntimeMethod):
+ (KJS::Bindings::QtRuntimeMethod::codeType):
+ (KJS::Bindings::QtRuntimeMethod::execute):
+ (KJS::Bindings::QtRuntimeMethodData::~QtRuntimeMethodData):
+ (KJS::Bindings::QtRuntimeMetaMethodData::~QtRuntimeMetaMethodData):
+ (KJS::Bindings::QtRuntimeConnectionMethodData::~QtRuntimeConnectionMethodData):
+ (KJS::Bindings::QtMethodMatchType::):
+ (KJS::Bindings::QtMethodMatchType::QtMethodMatchType):
+ (KJS::Bindings::QtMethodMatchType::kind):
+ (KJS::Bindings::QtMethodMatchType::isValid):
+ (KJS::Bindings::QtMethodMatchType::isVariant):
+ (KJS::Bindings::QtMethodMatchType::isMetaType):
+ (KJS::Bindings::QtMethodMatchType::isUnresolved):
+ (KJS::Bindings::QtMethodMatchType::isMetaEnum):
+ (KJS::Bindings::QtMethodMatchType::enumeratorIndex):
+ (KJS::Bindings::QtMethodMatchType::variant):
+ (KJS::Bindings::QtMethodMatchType::metaType):
+ (KJS::Bindings::QtMethodMatchType::metaEnum):
+ (KJS::Bindings::QtMethodMatchType::unresolved):
+ (KJS::Bindings::QtMethodMatchType::typeId):
+ (KJS::Bindings::QtMethodMatchType::name):
+ (KJS::Bindings::QtMethodMatchData::QtMethodMatchData):
+ (KJS::Bindings::QtMethodMatchData::isValid):
+ (KJS::Bindings::QtMethodMatchData::firstUnresolvedIndex):
+ (KJS::Bindings::indexOfMetaEnum):
+ (KJS::Bindings::findMethodIndex):
+ (KJS::Bindings::findSignalIndex):
+ (KJS::Bindings::QtRuntimeMetaMethod::QtRuntimeMetaMethod):
+ (KJS::Bindings::QtRuntimeMetaMethod::mark):
+ (KJS::Bindings::QtRuntimeMetaMethod::callAsFunction):
+ (KJS::Bindings::QtRuntimeMetaMethod::getOwnPropertySlot):
+ (KJS::Bindings::QtRuntimeMetaMethod::lengthGetter):
+ (KJS::Bindings::QtRuntimeMetaMethod::connectGetter):
+ (KJS::Bindings::QtRuntimeMetaMethod::disconnectGetter):
+ (KJS::Bindings::QtRuntimeConnectionMethod::QtRuntimeConnectionMethod):
+ (KJS::Bindings::QtRuntimeConnectionMethod::callAsFunction):
+ (KJS::Bindings::QtRuntimeConnectionMethod::getOwnPropertySlot):
+ (KJS::Bindings::QtRuntimeConnectionMethod::lengthGetter):
+ (KJS::Bindings::QtConnectionObject::QtConnectionObject):
+ (KJS::Bindings::QtConnectionObject::~QtConnectionObject):
+ (KJS::Bindings::QtConnectionObject::metaObject):
+ (KJS::Bindings::QtConnectionObject::qt_metacast):
+ (KJS::Bindings::QtConnectionObject::qt_metacall):
+ (KJS::Bindings::QtConnectionObject::execute):
+ (KJS::Bindings::QtConnectionObject::match):
+ (KJS::Bindings::::QtArray):
+ (KJS::Bindings::::~QtArray):
+ (KJS::Bindings::::rootObject):
+ (KJS::Bindings::::setValueAt):
+ (KJS::Bindings::::valueAt):
+ * bindings/qt/qt_runtime.h:
+ (KJS::Bindings::QtField::):
+ (KJS::Bindings::QtField::QtField):
+ (KJS::Bindings::QtField::fieldType):
+ (KJS::Bindings::QtMethod::QtMethod):
+ (KJS::Bindings::QtMethod::name):
+ (KJS::Bindings::QtMethod::numParameters):
+ (KJS::Bindings::QtArray::getLength):
+ (KJS::Bindings::QtRuntimeMethod::d_func):
+ (KJS::Bindings::QtRuntimeMetaMethod::d_func):
+ (KJS::Bindings::QtRuntimeConnectionMethod::d_func):
+ (KJS::Bindings::):
+ * bindings/runtime.cpp:
+ (KJS::Bindings::Instance::createBindingForLanguageInstance):
+ (KJS::Bindings::Instance::createRuntimeObject):
+ (KJS::Bindings::Instance::reallyCreateRuntimeObject):
+ * bindings/runtime.h:
+
+2008-01-22 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Darin and Adam.
+
+ <rdar://problem/5688975>
+ div element on microsoft site has wrong left offset.
+
+ Return true even if NPN_GetProperty returns null or undefined. This matches Firefox
+ (and is what the Silverlight plug-in expects).
+
+ * bindings/NP_jsobject.cpp:
+ (_NPN_GetProperty):
+
+2008-01-21 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Fixed http://bugs.webkit.org/show_bug.cgi?id=16909
+ REGRESSION: Amazon.com crash (ActivationImp)
+
+ (and a bunch of other crashes)
+
+ Plus, a .7% SunSpider speedup to boot.
+
+ Replaced the buggy currentExec and savedExec mechanisms with an
+ explicit ExecState stack.
+
+ * kjs/collector.cpp:
+ (KJS::Collector::collect): Explicitly mark the ExecState stack.
+
+ (KJS::Collector::reportOutOfMemoryToAllExecStates): Slight change in
+ behavior: We no longer throw an exception in any global ExecStates,
+ since global ExecStates are more like pseudo-ExecStates, and aren't
+ used for script execution. (It's unclear what would happen if you left
+ an exception waiting around in a global ExecState, but it probably
+ wouldn't be good.)
+
+2008-01-21 Jan Michael Alonzo <jmalonzo@unpluggable.com>
+
+ Reviewed by Alp Toker.
+
+ http://bugs.webkit.org/show_bug.cgi?id=16955
+ Get errors when cross-compile webkit-gtk
+
+ * GNUmakefile.am: removed ICU_CFLAGS
+
+2008-01-18 Kevin McCullough <kmccullough@apple.com>
+
+ - Build fix.
+
+ * kjs/ustring.h:
+
+2008-01-18 Kevin McCullough <kmccullough@apple.com>
+
+ - Build fix.
+
+ * kjs/ustring.cpp:
+ * kjs/ustring.h:
+ (KJS::UString::cost):
+
+2008-01-18 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Geoff.
+
+ - Correctly report cost of appended strings to trigger GC.
+
+ * kjs/ustring.cpp:
+ (KJS::UString::Rep::create):
+ (KJS::UString::UString): Don't create unnecssary objects.
+ (KJS::UString::cost): Report cost if necessary but also keep track of
+ reported cost.
+ * kjs/ustring.h:
+
+2008-01-18 Simon Hausmann <hausmann@webkit.org>
+
+ Reviewed by Holger.
+
+ Fix return type conversions from Qt slots to JS values.
+
+ This also fixes fast/dom/open-and-close-by-DOM.html, which called
+ layoutTestController.windowCount().
+
+ When constructing the QVariant that holds the return type we cannot
+ use the QVarian(Type) constuctor as that will create a null variant.
+ We have to use the QVariant(Type, void *) constructor instead, just
+ like in QMetaObject::read() for example.
+
+
+ * bindings/qt/qt_instance.cpp:
+ (KJS::Bindings::QtInstance::getRuntimeObject):
+
+2008-01-18 Prasanth Ullattil <prasanth.ullattil@trolltech.com>
+
+ Reviewed by Simon Hausmann <hausmann@webkit.org>.
+
+ Fix compilation on Win64(2): Implemented currentThreadStackBase on X86-64 on Windows
+
+
+ * kjs/collector.cpp:
+ (KJS::Collector::heapAllocate):
+
+2008-01-18 Prasanth Ullattil <prasanth.ullattil@trolltech.com>
+
+ Reviewed by Simon Hausmann <hausmann@webkit.org>.
+
+ Fix compilation on Win64(1): Define WTF_PLATFORM_X86_64 correctly on Win64.
+
+
+ * wtf/Platform.h:
+
+2008-01-17 Antti Koivisto <antti@apple.com>
+
+ Fix Windows build.
+
+ * kjs/regexp_object.cpp:
+ (KJS::regExpProtoFuncToString):
+
+2008-01-16 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Darin.
+
+ Fix for http://bugs.webkit.org/show_bug.cgi?id=16901
+ Convert remaining JS function objects to use the new PrototypeFunction class
+
+ - Moves Boolean, Function, RegExp, Number, Object and Global functions to their
+ own static function implementations so that they can be used with the
+ PrototypeFunction class. SunSpider says this is 1.003x as fast.
+
+ * kjs/JSGlobalObject.cpp:
+ (KJS::JSGlobalObject::reset):
+ * kjs/array_object.h:
+ * kjs/bool_object.cpp:
+ (KJS::BooleanInstance::BooleanInstance):
+ (KJS::BooleanPrototype::BooleanPrototype):
+ (KJS::booleanProtoFuncToString):
+ (KJS::booleanProtoFuncValueOf):
+ (KJS::BooleanObjectImp::BooleanObjectImp):
+ (KJS::BooleanObjectImp::implementsConstruct):
+ (KJS::BooleanObjectImp::construct):
+ (KJS::BooleanObjectImp::callAsFunction):
+ * kjs/bool_object.h:
+ (KJS::BooleanInstance::classInfo):
+ * kjs/error_object.cpp:
+ (KJS::ErrorPrototype::ErrorPrototype):
+ (KJS::errorProtoFuncToString):
+ * kjs/error_object.h:
+ * kjs/function.cpp:
+ (KJS::globalFuncEval):
+ (KJS::globalFuncParseInt):
+ (KJS::globalFuncParseFloat):
+ (KJS::globalFuncIsNaN):
+ (KJS::globalFuncIsFinite):
+ (KJS::globalFuncDecodeURI):
+ (KJS::globalFuncDecodeURIComponent):
+ (KJS::globalFuncEncodeURI):
+ (KJS::globalFuncEncodeURIComponent):
+ (KJS::globalFuncEscape):
+ (KJS::globalFuncUnEscape):
+ (KJS::globalFuncKJSPrint):
+ (KJS::PrototypeFunction::PrototypeFunction):
+ * kjs/function.h:
+ * kjs/function_object.cpp:
+ (KJS::FunctionPrototype::FunctionPrototype):
+ (KJS::functionProtoFuncToString):
+ (KJS::functionProtoFuncApply):
+ (KJS::functionProtoFuncCall):
+ * kjs/function_object.h:
+ * kjs/number_object.cpp:
+ (KJS::NumberPrototype::NumberPrototype):
+ (KJS::numberProtoFuncToString):
+ (KJS::numberProtoFuncToLocaleString):
+ (KJS::numberProtoFuncValueOf):
+ (KJS::numberProtoFuncToFixed):
+ (KJS::numberProtoFuncToExponential):
+ (KJS::numberProtoFuncToPrecision):
+ * kjs/number_object.h:
+ (KJS::NumberInstance::classInfo):
+ (KJS::NumberObjectImp::classInfo):
+ (KJS::NumberObjectImp::):
+ * kjs/object_object.cpp:
+ (KJS::ObjectPrototype::ObjectPrototype):
+ (KJS::objectProtoFuncValueOf):
+ (KJS::objectProtoFuncHasOwnProperty):
+ (KJS::objectProtoFuncIsPrototypeOf):
+ (KJS::objectProtoFuncDefineGetter):
+ (KJS::objectProtoFuncDefineSetter):
+ (KJS::objectProtoFuncLookupGetter):
+ (KJS::objectProtoFuncLookupSetter):
+ (KJS::objectProtoFuncPropertyIsEnumerable):
+ (KJS::objectProtoFuncToLocaleString):
+ (KJS::objectProtoFuncToString):
+ * kjs/object_object.h:
+ * kjs/regexp_object.cpp:
+ (KJS::RegExpPrototype::RegExpPrototype):
+ (KJS::regExpProtoFuncTest):
+ (KJS::regExpProtoFuncExec):
+ (KJS::regExpProtoFuncCompile):
+ (KJS::regExpProtoFuncToString):
+ * kjs/regexp_object.h:
+
+2008-01-16 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Maciej & Darin.
+
+ Fixes Bug 16868: Gmail crash
+ and Bug 16871: Crash when loading apple.com/startpage
+
+ <http://bugs.webkit.org/show_bug.cgi?id=16868>
+ <rdar://problem/5686108>
+
+ <http://bugs.webkit.org/show_bug.cgi?id=16871>
+ <rdar://problem/5686670>
+
+ Adds ActivationImp tear-off for cross-window eval() and fixes an
+ existing garbage collection issue exposed by the ActivationImp tear-off
+ patch (r29425) that can occur when an ExecState's m_callingExec is
+ different than its m_savedExec.
+
+ * kjs/ExecState.cpp:
+ (KJS::ExecState::mark):
+ * kjs/function.cpp:
+ (KJS::GlobalFuncImp::callAsFunction):
+
+2008-01-16 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Oliver.
+
+ Clean up MathObjectImp, it needed a little scrubbing.
+
+ * kjs/math_object.cpp:
+ (KJS::MathObjectImp::MathObjectImp):
+ (KJS::MathObjectImp::getOwnPropertySlot):
+ (KJS::MathObjectImp::getValueProperty):
+ (KJS::mathProtoFuncACos):
+ (KJS::mathProtoFuncASin):
+ (KJS::mathProtoFuncATan):
+ (KJS::mathProtoFuncATan2):
+ (KJS::mathProtoFuncCos):
+ (KJS::mathProtoFuncExp):
+ (KJS::mathProtoFuncLog):
+ (KJS::mathProtoFuncSin):
+ (KJS::mathProtoFuncSqrt):
+ (KJS::mathProtoFuncTan):
+ * kjs/math_object.h:
+ (KJS::MathObjectImp::classInfo):
+ (KJS::MathObjectImp::):
+
+2008-01-16 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ Rename Lexer variable bol to atLineStart.
+
+ * kjs/lexer.cpp:
+ (KJS::Lexer::Lexer):
+ (KJS::Lexer::setCode):
+ (KJS::Lexer::nextLine):
+ (KJS::Lexer::lex):
+ * kjs/lexer.h:
+
+2008-01-16 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen and Anders Carlsson.
+
+ Remove uses of KJS_PURE_ECMA as we don't ever build with it defined,
+ and we have many features that are not included in the ECMA spec.
+
+ * kjs/lexer.cpp:
+ (KJS::Lexer::Lexer):
+ (KJS::Lexer::setCode):
+ (KJS::Lexer::nextLine):
+ (KJS::Lexer::lex):
+ * kjs/lexer.h:
+ * kjs/string_object.cpp:
+ * kjs/string_object.h:
+
+2008-01-15 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ Fix <rdar://problem/5595552> r27608 introduced a 20% increase in JS binary size, 4% increase in WebCore binary size
+
+ - This changes the way JS functions that use Lookup tables are handled. Instead of using
+ one class per function, which allowed specialization of the virtual callAsFunction
+ method, we now use one class, PrototypeFunction, which takes a pointer to a static
+ function to use as the implementation. This significantly decreases the binary size
+ of JavaScriptCore (about 145k on an Intel only build) while still keeping some of the
+ speedup r27608 garnered (SunSpider says this is 1.005x as slow, which should leave some
+ wiggle room from the original 1% speedup) and keeps the functions implementations in separate
+ functions to help with optimizations.
+
+ * JavaScriptCore.exp:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * kjs/array_object.cpp:
+ (KJS::arrayProtoFuncToString):
+ (KJS::arrayProtoFuncToLocaleString):
+ (KJS::arrayProtoFuncJoin):
+ (KJS::arrayProtoFuncConcat):
+ (KJS::arrayProtoFuncPop):
+ (KJS::arrayProtoFuncPush):
+ (KJS::arrayProtoFuncReverse):
+ (KJS::arrayProtoFuncShift):
+ (KJS::arrayProtoFuncSlice):
+ (KJS::arrayProtoFuncSort):
+ (KJS::arrayProtoFuncSplice):
+ (KJS::arrayProtoFuncUnShift):
+ (KJS::arrayProtoFuncFilter):
+ (KJS::arrayProtoFuncMap):
+ (KJS::arrayProtoFuncEvery):
+ (KJS::arrayProtoFuncForEach):
+ (KJS::arrayProtoFuncSome):
+ (KJS::arrayProtoFuncIndexOf):
+ (KJS::arrayProtoFuncLastIndexOf):
+ * kjs/array_object.h:
+ * kjs/date_object.cpp:
+ (KJS::DatePrototype::getOwnPropertySlot):
+ (KJS::dateProtoFuncToString):
+ (KJS::dateProtoFuncToUTCString):
+ (KJS::dateProtoFuncToDateString):
+ (KJS::dateProtoFuncToTimeString):
+ (KJS::dateProtoFuncToLocaleString):
+ (KJS::dateProtoFuncToLocaleDateString):
+ (KJS::dateProtoFuncToLocaleTimeString):
+ (KJS::dateProtoFuncValueOf):
+ (KJS::dateProtoFuncGetTime):
+ (KJS::dateProtoFuncGetFullYear):
+ (KJS::dateProtoFuncGetUTCFullYear):
+ (KJS::dateProtoFuncToGMTString):
+ (KJS::dateProtoFuncGetMonth):
+ (KJS::dateProtoFuncGetUTCMonth):
+ (KJS::dateProtoFuncGetDate):
+ (KJS::dateProtoFuncGetUTCDate):
+ (KJS::dateProtoFuncGetDay):
+ (KJS::dateProtoFuncGetUTCDay):
+ (KJS::dateProtoFuncGetHours):
+ (KJS::dateProtoFuncGetUTCHours):
+ (KJS::dateProtoFuncGetMinutes):
+ (KJS::dateProtoFuncGetUTCMinutes):
+ (KJS::dateProtoFuncGetSeconds):
+ (KJS::dateProtoFuncGetUTCSeconds):
+ (KJS::dateProtoFuncGetMilliSeconds):
+ (KJS::dateProtoFuncGetUTCMilliseconds):
+ (KJS::dateProtoFuncGetTimezoneOffset):
+ (KJS::dateProtoFuncSetTime):
+ (KJS::dateProtoFuncSetMilliSeconds):
+ (KJS::dateProtoFuncSetUTCMilliseconds):
+ (KJS::dateProtoFuncSetSeconds):
+ (KJS::dateProtoFuncSetUTCSeconds):
+ (KJS::dateProtoFuncSetMinutes):
+ (KJS::dateProtoFuncSetUTCMinutes):
+ (KJS::dateProtoFuncSetHours):
+ (KJS::dateProtoFuncSetUTCHours):
+ (KJS::dateProtoFuncSetDate):
+ (KJS::dateProtoFuncSetUTCDate):
+ (KJS::dateProtoFuncSetMonth):
+ (KJS::dateProtoFuncSetUTCMonth):
+ (KJS::dateProtoFuncSetFullYear):
+ (KJS::dateProtoFuncSetUTCFullYear):
+ (KJS::dateProtoFuncSetYear):
+ (KJS::dateProtoFuncGetYear):
+ * kjs/date_object.h:
+ * kjs/function.cpp:
+ (KJS::PrototypeFunction::PrototypeFunction):
+ (KJS::PrototypeFunction::callAsFunction):
+ * kjs/function.h:
+ * kjs/lookup.h:
+ (KJS::HashEntry::):
+ (KJS::staticFunctionGetter):
+ * kjs/math_object.cpp:
+ (KJS::mathProtoFuncAbs):
+ (KJS::mathProtoFuncACos):
+ (KJS::mathProtoFuncASin):
+ (KJS::mathProtoFuncATan):
+ (KJS::mathProtoFuncATan2):
+ (KJS::mathProtoFuncCeil):
+ (KJS::mathProtoFuncCos):
+ (KJS::mathProtoFuncExp):
+ (KJS::mathProtoFuncFloor):
+ (KJS::mathProtoFuncLog):
+ (KJS::mathProtoFuncMax):
+ (KJS::mathProtoFuncMin):
+ (KJS::mathProtoFuncPow):
+ (KJS::mathProtoFuncRandom):
+ (KJS::mathProtoFuncRound):
+ (KJS::mathProtoFuncSin):
+ (KJS::mathProtoFuncSqrt):
+ (KJS::mathProtoFuncTan):
+ * kjs/math_object.h:
+ * kjs/string_object.cpp:
+ (KJS::stringProtoFuncToString):
+ (KJS::stringProtoFuncValueOf):
+ (KJS::stringProtoFuncCharAt):
+ (KJS::stringProtoFuncCharCodeAt):
+ (KJS::stringProtoFuncConcat):
+ (KJS::stringProtoFuncIndexOf):
+ (KJS::stringProtoFuncLastIndexOf):
+ (KJS::stringProtoFuncMatch):
+ (KJS::stringProtoFuncSearch):
+ (KJS::stringProtoFuncReplace):
+ (KJS::stringProtoFuncSlice):
+ (KJS::stringProtoFuncSplit):
+ (KJS::stringProtoFuncSubstr):
+ (KJS::stringProtoFuncSubstring):
+ (KJS::stringProtoFuncToLowerCase):
+ (KJS::stringProtoFuncToUpperCase):
+ (KJS::stringProtoFuncToLocaleLowerCase):
+ (KJS::stringProtoFuncToLocaleUpperCase):
+ (KJS::stringProtoFuncLocaleCompare):
+ (KJS::stringProtoFuncBig):
+ (KJS::stringProtoFuncSmall):
+ (KJS::stringProtoFuncBlink):
+ (KJS::stringProtoFuncBold):
+ (KJS::stringProtoFuncFixed):
+ (KJS::stringProtoFuncItalics):
+ (KJS::stringProtoFuncStrike):
+ (KJS::stringProtoFuncSub):
+ (KJS::stringProtoFuncSup):
+ (KJS::stringProtoFuncFontcolor):
+ (KJS::stringProtoFuncFontsize):
+ (KJS::stringProtoFuncAnchor):
+ (KJS::stringProtoFuncLink):
+ * kjs/string_object.h:
+
+2008-01-15 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Adam Roben.
+
+ Some tweaks to our headerdoc, suggested by David Gatwood on the docs
+ team.
+
+ * API/JSBase.h:
+ * API/JSObjectRef.h:
+ * API/JSStringRef.h:
+ * API/JSValueRef.h:
+
+2008-01-15 Alp Toker <alp@atoker.com>
+
+ Rubber-stamped by Anders.
+
+ Make the HTTP backend configurable in the GTK+ port. curl is currently
+ the only option.
+
+ * wtf/Platform.h: Don't hard-code WTF_USE_CURL for GTK
+
+2008-01-15 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Beth Dakin.
+
+ Remove unneeded variable.
+
+ * kjs/string_object.cpp:
+ (KJS::StringProtoFuncSubstr::callAsFunction):
+
+2008-01-14 Steve Falkenburg <sfalken@apple.com>
+
+ Use shared vsprops for most vcproj properties.
+
+ Reviewed by Darin.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Add missing Debug_Internal config.
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj: Add missing Debug_Internal config.
+ * JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
+
+2008-01-14 Adam Roben <aroben@apple.com>
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Added
+ some headers that were missing from the vcproj so their contents will
+ be included in Find in Files.
+
+2008-01-14 Adam Roben <aroben@apple.com>
+
+ Fix Bug 16871: Crash when loading apple.com/startpage
+
+ <http://bugs.webkit.org/show_bug.cgi?id=16871>
+ <rdar://problem/5686670>
+
+ Patch written by Darin, reviewed by me.
+
+ * kjs/ExecState.cpp:
+ (KJS::ExecState::mark): Call ActivationImp::markChildren if our
+ m_activation is on the stack. This is what ScopeChain::mark also does,
+ but apparently in some cases it's possible for an ExecState's
+ ActivationImp to not be in any ScopeChain.
+
+2008-01-14 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Oliver.
+
+ -<rdar://problem/5622667> REGRESSION (Leopard-ToT): Endless loading loop
+ trying to view techreport.com comments
+ - We need to set values in the map, because if they are already in the
+ map they will not be reset when we use add().
+
+ * kjs/array_instance.cpp:
+ (KJS::ArrayInstance::put):
+
+2008-01-14 Darin Adler <darin@apple.com>
+
+ Reviewed by Adam.
+
+ - re-speed-up the page load test (my StringImpl change slowed it down)
+
+ * wtf/RefCounted.h:
+ (WTF::RefCounted::RefCounted): Allow derived classes to start with a reference
+ count other than 0. Eventually everyone will want to start with a 1. This is a
+ staged change. For now, there's a default of 0, and you can specify 1. Later,
+ there will be no default and everyone will have to specify. And then later, there
+ will be a default of 1. Eventually, we can take away even the option of starting
+ with 0!
+
+ * wtf/Vector.h:
+ (WTF::Vector::Vector): Sped up creation of non-empty vectors by removing the
+ overhead of first constructing something empty and then calling resize.
+ (WTF::Vector::clear): Sped up the common case of calling clear on an empty
+ vector by adding a check for that case.
+ (WTF::Vector::releaseBuffer): Marked this function inline and removed a branch
+ in the case of vectors with no inline capacity (normal vectors) by leaving out
+ the code to copy the inline buffer in that case.
+
+2008-01-14 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by David Kilzer.
+
+ http://bugs.webkit.org/show_bug.cgi?id=16787
+ array.splice() with 1 element not working
+
+ Test: fast/js/array-splice.html
+
+ * kjs/array_object.cpp:
+ (KJS::ArrayProtoFuncSplice::callAsFunction): Implement this Mozilla extension, and fix
+ some other edge cases.
+
+2008-01-13 Steve Falkenburg <sfalken@apple.com>
+
+ Share common files across projects.
+
+ Unify vsprops files
+ Debug: common.vsprops, debug.vsprops
+ Debug_Internal: common.vsprops, debug.vsprops, debug_internal.vsprops
+ Release: common.vsprops, release.vsprops
+
+ Shared properties can go into common.vsprops, shared debug settings can go into debug.vsprops.
+ debug_internal.vsprops will be mostly empty except for file path prefix modifiers.
+
+ Reviewed by Adam Roben.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * JavaScriptCore.vcproj/debug.vsprops: Removed.
+ * JavaScriptCore.vcproj/debug_internal.vsprops: Removed.
+ * JavaScriptCore.vcproj/release.vsprops: Removed.
+ * JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
+
+2008-01-13 Marius Bugge Monsen <mbm@trolltech.com>
+
+ Contributions and review by Adriaan de Groot,
+ Simon Hausmann, Eric Seidel, and Darin Adler.
+
+ - http://bugs.webkit.org/show_bug.cgi?id=16590
+ Compilation fixes for Solaris.
+
+ * kjs/DateMath.h:
+ (KJS::GregorianDateTime::GregorianDateTime): Use the WIN_OS code path
+ for SOLARIS too, presumably because Solaris also lacks the tm_gtoff and tm_zone
+ fields.
+ (KJS::GregorianDateTime::operator tm): Ditto.
+
+ * kjs/collector.cpp:
+ (KJS::currentThreadStackBase): Use thr_stksegment on Solaris.
+
+ * wtf/MathExtras.h:
+ (isfinite): Implement for Solaris.
+ (isinf): Ditto.
+ (signbit): Ditto. But this one is wrong, so I added a FIXME.
+
+ * wtf/Platform.h: Define PLATFORM(SOLARIS) when "sun" or "__sun" is defined.
+
+2008-01-13 Michael Goddard <michael.goddard@trolltech.com>
+
+ Reviewed by Anders Carlsson.
+
+ Add binding language type to Instance.
+ Allows runtime determination of the type of an
+ Instance, to allow safe casting. Doesn't actually
+ add any safe casting yet, though.
+
+ Add a helper function to get an Instance from a JSObject*.
+ Given an object and the expected binding language, see if
+ the JSObject actually wraps an Instance of the given type
+ and return it. Otherwise return 0.
+
+ Move RuntimeObjectImp creations into Instance.
+ Make the ctor protected, and Instance a friend class, so
+ that all creation of RuntimeObjectImps goes through
+ one place.
+
+ Remove copy ctor/assignment operator for QtInstance.
+ Instance itself is Noncopyable, so QtInstance doesn't
+ need to have these.
+
+ Add caching for QtInstance and associated RuntimeObjectImps.
+ Push any dealings with QtLanguage bindings into QtInstance,
+ and cache them there, rather than in the Instance layer. Add
+ a QtRuntimeObjectImp to help with caching.
+
+ * JavaScriptCore.exp:
+ * bindings/c/c_instance.h:
+ * bindings/jni/jni_instance.h:
+ * bindings/objc/objc_instance.h:
+ * bindings/qt/qt_instance.cpp:
+ (KJS::Bindings::QtRuntimeObjectImp::QtRuntimeObjectImp):
+ (KJS::Bindings::QtRuntimeObjectImp::~QtRuntimeObjectImp):
+ (KJS::Bindings::QtRuntimeObjectImp::invalidate):
+ (KJS::Bindings::QtRuntimeObjectImp::removeFromCache):
+ (KJS::Bindings::QtInstance::QtInstance):
+ (KJS::Bindings::QtInstance::~QtInstance):
+ (KJS::Bindings::QtInstance::getQtInstance):
+ (KJS::Bindings::QtInstance::getRuntimeObject):
+ * bindings/qt/qt_instance.h:
+ (KJS::Bindings::QtInstance::getBindingLanguage):
+ * bindings/runtime.cpp:
+ (KJS::Bindings::Instance::createBindingForLanguageInstance):
+ (KJS::Bindings::Instance::createRuntimeObject):
+ (KJS::Bindings::Instance::getInstance):
+ * bindings/runtime.h:
+ * bindings/runtime_object.h:
+ (KJS::RuntimeObjectImp::getInternalInstance):
+
+2008-01-12 Alp Toker <alp@atoker.com>
+
+ Reviewed by Mark Rowe.
+
+ Hide non-public symbols in GTK+/autotools release builds.
+
+ * GNUmakefile.am:
+
+2008-01-12 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Mark Rowe.
+
+ Fix http://bugs.webkit.org/show_bug.cgi?id=16852
+ Fixes leaking of ActivationStackNode objects.
+
+ * kjs/JSGlobalObject.cpp:
+ (KJS::JSGlobalObject::deleteActivationStack):
+ (KJS::JSGlobalObject::~JSGlobalObject):
+ (KJS::JSGlobalObject::init):
+ (KJS::JSGlobalObject::reset):
+ * kjs/JSGlobalObject.h:
+
+2008-01-12 Darin Adler <darin@apple.com>
+
+ - try to fix Qt Windows build
+
+ * pcre/dftables: Remove reliance on the list form of Perl pipes.
+
+2008-01-12 Darin Adler <darin@apple.com>
+
+ - try to fix Qt build
+
+ * kjs/function.cpp: Added include of scope_chain_mark.h.
+ * kjs/scope_chain_mark.h: Added multiple-include guards.
+
+2008-01-12 Mark Rowe <mrowe@apple.com>
+
+ Another Windows build fix.
+
+ * kjs/Activation.h:
+
+2008-01-12 Mark Rowe <mrowe@apple.com>
+
+ Attempted Windows build fix. Use struct consistently when forward-declaring
+ ActivationStackNode and StackActivation.
+
+ * kjs/Activation.h:
+ * kjs/JSGlobalObject.h:
+
+2008-01-12 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Maciej.
+
+ Fixes a problem with the ActivationImp tear-off patch (r29425) where
+ some of the calls to JSGlobalObject::tearOffActivation() were using
+ the wrong test to determine whether it should leave a relic behind.
+
+ * kjs/function.cpp:
+ (KJS::FunctionImp::argumentsGetter):
+ (KJS::ActivationImp::getOwnPropertySlot):
+
+2008-01-11 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Fixed <rdar://problem/5665251> REGRESSION (r28880-r28886): Global
+ variable access (16644)
+
+ This bug was caused by var declarations shadowing built-in properties of
+ the global object.
+
+ To match Firefox, we've decided that var declarations will never shadow
+ built-in properties of the global object or its prototypes. We used to
+ behave more like IE, which allows shadowing, but walking that line got
+ us into trouble with websites that sent us down the Firefox codepath.
+
+ * kjs/JSVariableObject.h:
+ (KJS::JSVariableObject::symbolTableGet): New code to support calling
+ hasProperty before the variable object is fully initialized (so you
+ can call it during initialization).
+
+ * kjs/nodes.cpp:.
+ (KJS::ProgramNode::initializeSymbolTable): Always do a full hasProperty
+ check when looking for duplicates, not getDirect, since it only checks
+ the property map, and not hasOwnProperty, since it doesn't check
+ prototypes.
+ (KJS::EvalNode::processDeclarations): ditto
+
+ * kjs/property_slot.h:
+ (KJS::PropertySlot::ungettableGetter): Best function name evar.
+
+2008-01-11 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Maciej.
+
+ Optimized ActivationImp allocation, so that activation records are now
+ first allocated on an explicitly managed stack and only heap allocated
+ when necessary. Roughly a 5% improvement on SunSpider, and a larger
+ improvement on benchmarks that use more function calls.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * kjs/Activation.h: Added.
+ (KJS::ActivationImp::ActivationData::ActivationData):
+ (KJS::ActivationImp::ActivationImp):
+ (KJS::ActivationImp::classInfo):
+ (KJS::ActivationImp::isActivationObject):
+ (KJS::ActivationImp::isOnStack):
+ (KJS::ActivationImp::d):
+ (KJS::StackActivation::StackActivation):
+ * kjs/ExecState.cpp:
+ (KJS::ExecState::ExecState):
+ (KJS::ExecState::~ExecState):
+ * kjs/ExecState.h:
+ (KJS::ExecState::replaceScopeChainTop):
+ (KJS::ExecState::setActivationObject):
+ (KJS::ExecState::setLocalStorage):
+ * kjs/JSGlobalObject.cpp:
+ (KJS::JSGlobalObject::reset):
+ (KJS::JSGlobalObject::pushActivation):
+ (KJS::JSGlobalObject::checkActivationCount):
+ (KJS::JSGlobalObject::popActivationHelper):
+ (KJS::JSGlobalObject::popActivation):
+ (KJS::JSGlobalObject::tearOffActivation):
+ * kjs/JSGlobalObject.h:
+ * kjs/JSVariableObject.h:
+ (KJS::JSVariableObject::JSVariableObjectData::JSVariableObjectData):
+ (KJS::JSVariableObject::JSVariableObject):
+ * kjs/function.cpp:
+ (KJS::FunctionImp::argumentsGetter):
+ (KJS::ActivationImp::ActivationImp):
+ (KJS::ActivationImp::~ActivationImp):
+ (KJS::ActivationImp::init):
+ (KJS::ActivationImp::getOwnPropertySlot):
+ (KJS::ActivationImp::markHelper):
+ (KJS::ActivationImp::mark):
+ (KJS::ActivationImp::ActivationData::ActivationData):
+ (KJS::GlobalFuncImp::callAsFunction):
+ * kjs/function.h:
+ * kjs/nodes.cpp:
+ (KJS::PostIncResolveNode::evaluate):
+ (KJS::PostDecResolveNode::evaluate):
+ (KJS::PreIncResolveNode::evaluate):
+ (KJS::PreDecResolveNode::evaluate):
+ (KJS::ReadModifyResolveNode::evaluate):
+ (KJS::AssignResolveNode::evaluate):
+ (KJS::WithNode::execute):
+ (KJS::TryNode::execute):
+ (KJS::FunctionBodyNode::processDeclarations):
+ (KJS::FuncExprNode::evaluate):
+ * kjs/object.h:
+ * kjs/scope_chain.h:
+ (KJS::ScopeChain::replace):
+ * kjs/scope_chain_mark.h: Added.
+ (KJS::ScopeChain::mark):
+
+2008-01-11 Simon Hausmann <hausmann@webkit.org>
+
+ Reviewed by Mark Rowe.
+
+ Fix the (clean) qmake build. For generating chartables.c we don't
+ depend on a separate input source file anymore, the dftables perl
+ script is enough. So use that instead as value for the .input
+ variable, to ensure that qmake also generates a rule to call dftables.
+
+ * pcre/pcre.pri:
+
+2008-01-10 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by John Sullivan.
+
+ Fixed some world leak reports:
+ * <rdar://problem/5669436> PLT complains about world leak of 1 JavaScript
+ Interpreter after running cvs-base suite
+
+ * <rdar://problem/5669423> PLT complains about world leak if browser
+ window is open when PLT starts
+
+ * kjs/collector.h: Added the ability to distinguish between global
+ objects and GC-protected global objects, since we only consider the
+ latter to be world leaks.
+ * kjs/collector.cpp:
+
+2008-01-11 Mark Rowe <mrowe@apple.com>
+
+ Silence qmake warning about ctgen lacking input.
+
+ Rubber-stamped by Alp Toker.
+
+ * pcre/pcre.pri:
+
+2008-01-10 David Kilzer <ddkilzer@apple.com>
+
+ dftables should be rewritten as a script
+
+ <http://bugs.webkit.org/show_bug.cgi?id=16818>
+ <rdar://problem/5681463>
+
+ Reviewed by Darin.
+
+ Rewrote the dftables utility in Perl. Attempted to switch all
+ build systems to call the script directly instead of building
+ a binary first. Only the Xcode build was able to be tested.
+
+ * DerivedSources.make: Added pcre directory to VPATH and changed
+ to invoke dftables directly.
+ * GNUmakefile.am: Removed build information and changed to invoke
+ dftables directly.
+ * JavaScriptCore.vcproj/JavaScriptCore.sln: Removed reference to
+ dftables project.
+ * JavaScriptCore.vcproj/JavaScriptCoreSubmit.sln: Ditto.
+ * JavaScriptCore.vcproj/dftables: Removed.
+ * JavaScriptCore.vcproj/dftables/dftables.vcproj: Removed.
+ * JavaScriptCore.xcodeproj/project.pbxproj: Removed dftables target.
+ * jscore.bkl: Removed dftables executable definition.
+ * pcre/dftables: Copied from JavaScriptCore/pcre/dftables.cpp.
+ * pcre/dftables.cpp: Removed.
+ * pcre/dftables.pro: Removed.
+ * pcre/pcre.pri: Removed references to dftables.cpp and changed to
+ invoke dftables directly.
+
+2008-01-10 Dan Bernstein <mitz@apple.com>
+
+ Reviewed by Darin Adler.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=16782
+ <rdar://problem/5675331> REGRESSION(r29266): Reproducible crash in fast/replaced/image-map.html
+
+ The crash resulted from a native object (DumpRenderTree's
+ EventSender) causing its wrapper to be invalidated (by clicking a
+ link that replaced the document in the window) and consequently
+ deallocated. The fix is to use RefPtrs to protect the native object
+ from deletion by self-invalidation.
+
+ * bindings/runtime_method.cpp:
+ (RuntimeMethod::callAsFunction):
+ * bindings/runtime_object.cpp:
+ (RuntimeObjectImp::fallbackObjectGetter):
+ (RuntimeObjectImp::fieldGetter):
+ (RuntimeObjectImp::methodGetter):
+ (RuntimeObjectImp::put):
+ (RuntimeObjectImp::defaultValue):
+ (RuntimeObjectImp::callAsFunction):
+
+2008-01-07 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Turn testIsInteger assertions into compile-time asserts and move them into HashTraits.h
+ where possible.
+
+ * kjs/testkjs.cpp:
+ * wtf/HashTraits.h:
+
+2008-01-07 Nikolas Zimmermann <zimmermann@kde.org>
+
+ Reviewed by Mark.
+
+ Enable SVG_FONTS by default.
+
+ * Configurations/JavaScriptCore.xcconfig:
+
+2008-01-07 Darin Adler <darin@apple.com>
+
+ Rubber stamped by David Kilzer.
+
+ - get rid of empty fpconst.cpp
+
+ * GNUmakefile.am: Remove fpconst.cpp.
+ * JavaScriptCore.pri: Ditto.
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Ditto.
+ * JavaScriptCore.xcodeproj/project.pbxproj: Ditto.
+ * JavaScriptCoreSources.bkl: Ditto.
+
+ * kjs/fpconst.cpp: Removed.
+
+2008-01-07 Darin Adler <darin@apple.com>
+
+ Reviewed by David Kilzer.
+
+ - fix alignment problem with NaN and Inf globals
+
+ * kjs/fpconst.cpp: Move the contents of this file from here back to
+ value.cpp. The reason this was in a separate file is that the DARWIN
+ version of this used a declaration of the globals with a different
+ type to avoid creating "init routines". That's no longer necessary for
+ DARWIN and was never necessary for the non-DARWIN code path.
+ To make this patch easy to merge, I didn't actually delete this file
+ yet. We'll do that in a separate changeset.
+
+ * kjs/value.cpp: If C99's NAN and INFINITY are present, then use them,
+ othrewise use the union trick from fpconst.cpp. I think it would be
+ better to eliminate KJS::NaN and KJS::Inf and just use NAN and INFINITY
+ directly or std::numeric_limits<double>::quiet_nan() and
+ std::numeric_limits<double>::infinity(). But when I tried that, it
+ slowed down SunSpider. Someone else could do that cleanup if they
+ could do it without slowing down the engine.
+
+2008-01-07 Adam Roben <aroben@apple.com>
+
+ Windows build fix
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Added
+ JavaScript.h to the project.
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make:
+ Copy JavaScript.h to WEBKITOUTPUTDIR.
+
+2008-01-07 Timothy Hatcher <timothy@apple.com>
+
+ Reviewed by Darin.
+
+ Fix Mac build.
+
+ * API/JSNode.c:
+ * API/JSNode.h:
+ * API/JSNodeList.c:
+ * API/JSNodeList.h:
+ * API/JavaScript.h:
+ * API/JavaScriptCore.h:
+ * API/minidom.c:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2008-01-07 Alp Toker <alp@atoker.com>
+
+ Reviewed by Darin.
+
+ http://bugs.webkit.org/show_bug.cgi?id=16029
+ JavaScriptCore.h is not suitable for platforms other than Mac OS X
+
+ Introduce a new JavaScriptCore/JavaScript.h public API header. This
+ should be used by all new portable code using the JavaScriptCore API.
+
+ JavaScriptCore/JavaScriptCore.h will remain for compatibility with
+ existing applications that depend on it including JSStringRefCF.h
+ which isn't portable.
+
+ Also add minidom to the GTK+/autotools build since we can now support
+ it on all platforms.
+
+ * API/JSNode.h:
+ * API/JSNodeList.h:
+ * API/JavaScript.h: Added.
+ * API/JavaScriptCore.h:
+ * ForwardingHeaders/JavaScriptCore/JavaScript.h: Added.
+ * GNUmakefile.am:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2008-01-06 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Sam.
+
+ Abstract all DateObject.set* functions in preparation for fixing:
+ http://bugs.webkit.org/show_bug.cgi?id=16753
+
+ SunSpider had random changes here and there but was overall a wash.
+
+ * kjs/date_object.cpp:
+ (KJS::fillStructuresUsingTimeArgs):
+ (KJS::setNewValueFromTimeArgs):
+ (KJS::setNewValueFromDateArgs):
+ (KJS::DateProtoFuncSetMilliSeconds::callAsFunction):
+ (KJS::DateProtoFuncSetUTCMilliseconds::callAsFunction):
+ (KJS::DateProtoFuncSetSeconds::callAsFunction):
+ (KJS::DateProtoFuncSetUTCSeconds::callAsFunction):
+ (KJS::DateProtoFuncSetMinutes::callAsFunction):
+ (KJS::DateProtoFuncSetUTCMinutes::callAsFunction):
+ (KJS::DateProtoFuncSetHours::callAsFunction):
+ (KJS::DateProtoFuncSetUTCHours::callAsFunction):
+ (KJS::DateProtoFuncSetDate::callAsFunction):
+ (KJS::DateProtoFuncSetUTCDate::callAsFunction):
+ (KJS::DateProtoFuncSetMonth::callAsFunction):
+ (KJS::DateProtoFuncSetUTCMonth::callAsFunction):
+ (KJS::DateProtoFuncSetFullYear::callAsFunction):
+ (KJS::DateProtoFuncSetUTCFullYear::callAsFunction):
+
+2008-01-06 Nikolas Zimmermann <zimmermann@kde.org>
+
+ Reviewed by Dan.
+
+ Add new helper function isArabicChar - SVG Fonts support needs it.
+
+ * wtf/unicode/icu/UnicodeIcu.h:
+ (WTF::Unicode::isArabicChar):
+ * wtf/unicode/qt4/UnicodeQt4.h:
+ (WTF::Unicode::isArabicChar):
+
+2008-01-06 Alp Toker <alp@atoker.com>
+
+ Reviewed by Mark Rowe.
+
+ Use $(EXEEXT) to account for the .exe extension in the GTK+ Windows
+ build. (This is already done correctly in DerivedSources.make.) Issue
+ noticed by Mikkel when building in Cygwin.
+
+ Add a missing slash. This was a hack from the qmake build system that
+ isn't necessary with autotools.
+
+ * GNUmakefile.am:
+
+2008-01-05 Darin Adler <darin@apple.com>
+
+ * API/JSRetainPtr.h: One more file that needed the change below.
+
+2008-01-05 Darin Adler <darin@apple.com>
+
+ * wtf/OwnPtr.h: OwnPtr needs the same fix as RefPtr below.
+
+2008-01-05 Adam Roben <aroben@apple.com>
+
+ Build fix.
+
+ Reviewed by Maciej.
+
+ * wtf/RetainPtr.h: Use PtrType instead of T* because of the
+ RemovePointer magic.
+
+2008-01-05 Darin Adler <darin@apple.com>
+
+ Rubber stamped by Maciej Stachowiak.
+
+ - cut down own PIC branches by using a pointer-to-member-data instead of a
+ pointer-to-member-function in WTF smart pointers
+
+ * wtf/OwnArrayPtr.h:
+ * wtf/OwnPtr.h:
+ * wtf/PassRefPtr.h:
+ * wtf/RefPtr.h:
+ * wtf/RetainPtr.h:
+ Use a pointer to the m_ptr member instead of the get member.
+ The GCC compiler generates better code for this idiom.
+
+2008-01-05 Henry Mason <hmason@mac.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ http://bugs.webkit.org/show_bug.cgi?id=16738
+ Bug 16738: Collector block offset could be stored as an cell offset instead of a byte offset
+
+ Gives a 0.4% SunSpider boost and prettier code.
+
+ * kjs/collector.cpp: Switched to cell offsets from byte offsets
+ (KJS::Collector::heapAllocate):
+ (KJS::Collector::sweep):
+
+2008-01-04 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Have the two malloc zones print useful diagnostics if their free method are unexpectedly invoked.
+ Due to <rdar://problem/5671357> this can happen if an application attempts to free a pointer that
+ was not allocated by any registered malloc zone on the system.
+
+ * kjs/CollectorHeapIntrospector.h:
+ * wtf/FastMalloc.cpp:
+
+2008-01-04 Alp Toker <alp@atoker.com>
+
+ GTK+ autotools build fix. Terminate empty rules.
+
+ * GNUmakefile.am:
+
+2008-01-03 Simon Hausmann <hausmann@webkit.org>
+
+ Reviewed by Mark Rowe.
+
+ Fix compilation with gcc 4.3: limits.h is needed for INT_MAX.
+
+ * pcre/pcre_exec.cpp:
+
+2008-01-03 Darin Adler <darin@apple.com>
+
+ * tests/mozilla/expected.html: The fix for bug 16696 also fixed a test
+ case, ecma_3/RegExp/perlstress-002.js, so updated results to expect
+ that test to succeed.
+
+2008-01-02 Darin Adler <darin@apple.com>
+
+ Reviewed by Geoff.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=16696
+ JSCRE fails fails to match Acid3 regexp
+
+ Test: fast/regex/early-acid3-86.html
+
+ The problem was with the cutoff point between backreferences and octal
+ escape sequences. We need to determine the cutoff point by counting the
+ total number of capturing brackets, which requires an extra pass through
+ the expression when compiling it.
+
+ * pcre/pcre_compile.cpp:
+ (CompileData::CompileData): Added numCapturingBrackets. Removed some
+ unused fields.
+ (compileBranch): Use numCapturingBrackets when calling checkEscape.
+ (calculateCompiledPatternLength): Use numCapturingBrackets when calling
+ checkEscape, and also store the bracket count at the end of the compile.
+ (jsRegExpCompile): Call calculateCompiledPatternLength twice -- once to
+ count the number of brackets and then a second time to calculate the length.
+
+2008-01-02 Darin Adler <darin@apple.com>
+
+ Reviewed by Geoff.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=16696
+ JSCRE fails fails to match Acid3 regexp
+
+ Test: fast/regex/early-acid3-86.html
+
+ The problem was with the cutoff point between backreferences and octal
+ escape sequences. We need to determine the cutoff point by counting the
+ total number of capturing brackets, which requires an extra pass through
+ the expression when compiling it.
+
+ * pcre/pcre_compile.cpp:
+ (CompileData::CompileData): Added numCapturingBrackets. Removed some
+ unused fields.
+ (compileBranch): Use numCapturingBrackets when calling checkEscape.
+ (calculateCompiledPatternLength): Use numCapturingBrackets when calling
+ checkEscape, and also store the bracket count at the end of the compile.
+ (jsRegExpCompile): Call calculateCompiledPatternLength twice -- once to
+ count the number of brackets and then a second time to calculate the length.
+
+2008-01-02 David Kilzer <ddkilzer@webkit.org>
+
+ Reviewed and landed by Darin.
+
+ * kjs/nodes.cpp:
+ (KJS::DoWhileNode::execute): Added a missing return.
+
+2008-01-02 Darin Adler <darin@apple.com>
+
+ - try to fix Qt build
+
+ * wtf/unicode/qt4/UnicodeQt4.h:
+ (WTF::Unicode::foldCase): Add some missing const.
+
+2008-01-02 Alice Liu <alice.liu@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ need to export ASCIICType.h for use in DRT
+
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * wtf/ASCIICType.h:
+ (WTF::isASCIIUpper):
+
+2008-01-02 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Beth Dakin.
+
+ Cleanup error_object.h/cpp.
+
+ * kjs/JSGlobalObject.cpp:
+ (KJS::JSGlobalObject::reset):
+ * kjs/error_object.cpp:
+ (KJS::ErrorInstance::ErrorInstance):
+ (KJS::ErrorPrototype::ErrorPrototype):
+ (KJS::ErrorProtoFuncToString::ErrorProtoFuncToString):
+ (KJS::ErrorProtoFuncToString::callAsFunction):
+ (KJS::ErrorObjectImp::ErrorObjectImp):
+ (KJS::ErrorObjectImp::implementsConstruct):
+ (KJS::ErrorObjectImp::construct):
+ (KJS::ErrorObjectImp::callAsFunction):
+ (KJS::NativeErrorPrototype::NativeErrorPrototype):
+ (KJS::NativeErrorImp::NativeErrorImp):
+ (KJS::NativeErrorImp::implementsConstruct):
+ (KJS::NativeErrorImp::construct):
+ (KJS::NativeErrorImp::callAsFunction):
+ (KJS::NativeErrorImp::mark):
+ * kjs/error_object.h:
+ (KJS::ErrorInstance::classInfo):
+ (KJS::NativeErrorImp::classInfo):
+
+2008-01-02 Mark Rowe <mrowe@apple.com>
+
+ Rubber-stamped by Alp Toker.
+
+ * GNUmakefile.am: Add missing dependency on grammar.y.
+
+2008-01-01 Darin Adler <darin@apple.com>
+
+ Reviewed by Eric.
+
+ - fix for http://bugs.webkit.org/show_bug.cgi?id=16695
+ JSC allows non-identifier codepoints in identifiers (affects Acid3)
+
+ Test: fast/js/kde/parse.html
+
+ * kjs/lexer.cpp:
+ (KJS::Lexer::lex): Added additional states to distinguish Unicode escapes at the
+ start of identifiers from ones inside identifiers. Rejected characters that don't pass
+ the isIdentStart and isIdentPart tests.
+ (KJS::Lexer::convertUnicode): Removed incorrect FIXME comment.
+
+ * kjs/lexer.h: Added new states to distinguish \u escapes at the start of identifiers
+ from \u escapes inside identifiers.
+
+2008-01-01 Darin Adler <darin@apple.com>
+
+ - rolled scope chain optimization out; it was breaking the world
+
+2008-01-01 Darin Adler <darin@apple.com>
+
+ Reviewed by Geoff.
+
+ - http://bugs.webkit.org/show_bug.cgi?id=16685
+ eliminate List::empty() to cut down on PIC branches
+
+ Also included one other speed-up -- remove the call to reserveCapacity from
+ FunctionBodyNode::processDeclarations in all but the most unusual cases.
+
+ Together these make SunSpider 1.016x as fast.
+
+ * JavaScriptCore.exp: Updated.
+ * kjs/ExecState.cpp:
+ (KJS::globalEmptyList): Added. Called only when creating global ExecState
+ instances.
+ (KJS::ExecState::ExecState): Broke constructor up into three separate functions,
+ for the three separate node types. Also went through each of the three and
+ streamlined as much as possible, removing dead code. This prevents us from having
+ to access the global in the function body version of the constructor.
+
+ * kjs/ExecState.h: Added emptyList(). Replaced the constructor with a set of
+ three that are specific to the different node types that can create new execution
+ state objects.
+
+ * kjs/array_object.cpp:
+ (KJS::ArrayProtoFuncToLocaleString::callAsFunction): Use exec->emptyList() instead
+ of List::empty().
+ (KJS::ArrayProtoFuncConcat::callAsFunction): Ditto.
+ (KJS::ArrayProtoFuncSlice::callAsFunction): Ditto.
+ (KJS::ArrayProtoFuncSplice::callAsFunction): Ditto.
+ (KJS::ArrayProtoFuncFilter::callAsFunction): Ditto.
+ * kjs/function.cpp:
+ (KJS::FunctionImp::callAsFunction): Updated to call new ExecState constructor.
+ (KJS::GlobalFuncImp::callAsFunction): Ditto (for eval).
+ * kjs/function_object.cpp:
+ (FunctionObjectImp::construct): Use exec->emptyList() instead of List::empty().
+
+ * kjs/list.cpp: Removed List::empty.
+ * kjs/list.h: Ditto.
+
+ * kjs/nodes.cpp:
+ (KJS::ElementNode::evaluate): Use exec->emptyList() instead of List::empty().
+ (KJS::ArrayNode::evaluate): Ditto.
+ (KJS::ObjectLiteralNode::evaluate): Ditto.
+ (KJS::PropertyListNode::evaluate): Ditto.
+ (KJS::FunctionBodyNode::processDeclarations): Another speed-up. Check the capacity
+ before calling reserveCapacity, because it doesn't get inlined the local storage
+ vector is almost always big enough -- saving the function call overhead is a big
+ deal.
+ (KJS::FuncDeclNode::makeFunction): Use exec->emptyList() instead of List::empty().
+ (KJS::FuncExprNode::evaluate): Ditto.
+ * kjs/object.cpp:
+ (KJS::tryGetAndCallProperty): Ditto.
+ * kjs/property_slot.cpp:
+ (KJS::PropertySlot::functionGetter): Ditto.
+ * kjs/string_object.cpp:
+ (KJS::StringProtoFuncSplit::callAsFunction): Ditto.
+
+2008-01-01 Darin Adler <darin@apple.com>
+
+ Reviewed by Geoff.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=16648
+ REGRESSION (r28165): Yuku.com navigation prints "jsRegExpExecute failed with result -2"
+ <rdar://problem/5646486> REGRESSION (r28165): Layout test fast/regex/test1 fails intermittently
+
+ Fixes 34 failing test cases in the fast/regex/test1.html test.
+
+ Restored the stack which prevents infinite loops for brackets that match the empty
+ string; it had been removed as an optimization.
+
+ Unfortunately, restoring this stack causes the regular expression test in SunSpider
+ to be 1.095x as slow and the overall test to be 1.004x as slow. Maybe we can find
+ a correct optimization to restore the speed!
+
+ It's possible the original change was on the right track but just off by one.
+
+ * pcre/pcre_exec.cpp: Add back eptrblock, but name it BracketChainNode.
+ (MatchStack::pushNewFrame): Add back the logic needed here.
+ (startNewGroup): Ditto.
+ (match): Ditto.
+
+2008-01-01 Darin Adler <darin@apple.com>
+
+ Reviewed by Geoff.
+
+ - http://bugs.webkit.org/show_bug.cgi?id=16683
+ speed up function calls by making ScopeChain::push cheaper
+
+ This gives a 1.019x speedup on SunSpider.
+
+ After doing this, I realized this probably will be obsolete when the optimization
+ to avoid creating an activation object is done. When we do that one we should check
+ if rolling this out will speed things up, since this does add overhead at the time
+ you copy the scope chain.
+
+ * kjs/object.h: Removed the ScopeChain::release function. It was
+ marked inline, and called in exactly one place, so moved it there.
+ No idea why it was in this header file!
+
+ * kjs/scope_chain.cpp: Removed the overload of the ScopeChain::push
+ function that takes another ScopeChain. It was unused. I think we used
+ it over in WebCore at one point, but not any more.
+
+ * kjs/scope_chain.h: Changed ScopeChainNode into a struct rather than
+ a class, got rid of its constructor so we can have one that's uninitialized,
+ and moved the refCount into a derived struct, ScopeChainHeapNode. Made _node
+ mutable so it can be changed in the moveToHeap function. Changed the copy
+ constructor and assignment operator to call moveToHeap, since the top node
+ can't be shared when it's embedded in another ScopeChain object. Updated
+ functions as needed to handle the case where the first object isn't on the
+ heap or to add casts for cases where it's guaranteed to be. Changed the push
+ function to always put the new node into the ScopeChain object; it will get
+ put onto the heap when needed later.
+
+2008-01-01 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Fixed slight logic error in reserveCapacity, where we would reallocate
+ the storage buffer unnecessarily.
+
+ * wtf/Vector.h:
+ (WTF::::reserveCapacity): No need to grow the buffer if newCapacity is
+ equal to capacity().
+
+2008-01-01 Darin Adler <darin@apple.com>
+
+ Reviewed by Oliver.
+
+ - http://bugs.webkit.org/show_bug.cgi?id=16684
+ eliminate debugger overhead from function body execution
+
+ Speeds SunSpider up 1.003x. That's a small amount, but measurable.
+
+ * JavaScriptCore.exp: Updated.
+ * kjs/Parser.h:
+ (KJS::Parser::parse): Create the node with a static member function named create() instead
+ of using new explicitly.
+
+ * kjs/grammar.y: Changed calls to new FunctionBodyNode to use FunctionBodyNode::create().
+
+ * kjs/nodes.cpp:
+ (KJS::ProgramNode::create): Added. Calls new.
+ (KJS::EvalNode::create): Ditto.
+ (KJS::FunctionBodyNode::create): Ditto, but creates FunctionBodyNodeWithDebuggerHooks
+ when a debugger is present.
+ (KJS::FunctionBodyNode::execute): Removed debugger hooks.
+ (KJS::FunctionBodyNodeWithDebuggerHooks::FunctionBodyNodeWithDebuggerHooks): Added.
+ (KJS::FunctionBodyNodeWithDebuggerHooks::execute): Calls the debugger, then the code,
+ then the debugger again.
+
+ * kjs/nodes.h: Added create functions, made the constructors private and protected.
+
+2007-12-30 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Sam.
+
+ More small cleanup to array_object.cpp
+
+ * kjs/array_object.cpp:
+ (KJS::ArrayProtoFuncToString::callAsFunction):
+ (KJS::ArrayProtoFuncToLocaleString::callAsFunction):
+ (KJS::ArrayProtoFuncJoin::callAsFunction):
+ (KJS::ArrayProtoFuncConcat::callAsFunction):
+ (KJS::ArrayProtoFuncReverse::callAsFunction):
+ (KJS::ArrayProtoFuncShift::callAsFunction):
+ (KJS::ArrayProtoFuncSlice::callAsFunction):
+ (KJS::ArrayProtoFuncSort::callAsFunction):
+ (KJS::ArrayProtoFuncSplice::callAsFunction):
+ (KJS::ArrayProtoFuncUnShift::callAsFunction):
+ (KJS::ArrayProtoFuncFilter::callAsFunction):
+ (KJS::ArrayProtoFuncMap::callAsFunction):
+ (KJS::ArrayProtoFuncEvery::callAsFunction):
+
+2007-12-30 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Sam.
+
+ Apply wkstyle to array_object.cpp
+
+ * kjs/array_object.cpp:
+ (KJS::ArrayPrototype::ArrayPrototype):
+ (KJS::ArrayPrototype::getOwnPropertySlot):
+ (KJS::ArrayProtoFuncConcat::callAsFunction):
+ (KJS::ArrayProtoFuncPop::callAsFunction):
+ (KJS::ArrayProtoFuncReverse::callAsFunction):
+ (KJS::ArrayProtoFuncShift::callAsFunction):
+ (KJS::ArrayProtoFuncSlice::callAsFunction):
+ (KJS::ArrayProtoFuncSort::callAsFunction):
+ (KJS::ArrayProtoFuncSplice::callAsFunction):
+ (KJS::ArrayProtoFuncUnShift::callAsFunction):
+ (KJS::ArrayProtoFuncFilter::callAsFunction):
+ (KJS::ArrayProtoFuncMap::callAsFunction):
+ (KJS::ArrayProtoFuncEvery::callAsFunction):
+ (KJS::ArrayProtoFuncLastIndexOf::callAsFunction):
+ (KJS::ArrayObjectImp::ArrayObjectImp):
+ (KJS::ArrayObjectImp::implementsConstruct):
+ (KJS::ArrayObjectImp::construct):
+ (KJS::ArrayObjectImp::callAsFunction):
+
+2007-12-30 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Sam.
+
+ Remove maxInt/minInt, replacing with std:max/min<int>()
+
+ * kjs/array_object.cpp:
+ (KJS::ArrayProtoFuncSplice::callAsFunction):
+ * kjs/operations.cpp:
+ * kjs/operations.h:
+
+2007-12-30 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Sam.
+
+ Update Number.toString to properly throw exceptions.
+ Cleanup code in Number.toString implementation.
+
+ * kjs/number_object.cpp:
+ (KJS::numberToString):
+ * kjs/object.cpp:
+ (KJS::Error::create): Remove bogus debug lines.
+
+2007-12-28 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Oliver.
+
+ ASSERT when debugging via Drosera due to missed var lookup optimization.
+ http://bugs.webkit.org/show_bug.cgi?id=16634
+
+ No test case possible.
+
+ * kjs/nodes.cpp:
+ (KJS::BreakpointCheckStatement::optimizeVariableAccess):
+ * kjs/nodes.h:
+
+2007-12-28 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Oliver.
+
+ Fix (-0).toFixed() and re-factor a little
+ Fix (-0).toExponential() and printing of trailing 0s in toExponential
+ Fix toPrecision(nan) handling
+ http://bugs.webkit.org/show_bug.cgi?id=16640
+
+ * kjs/number_object.cpp:
+ (KJS::numberToFixed):
+ (KJS::fractionalPartToString):
+ (KJS::numberToExponential):
+ (KJS::numberToPrecision):
+
+2007-12-28 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Sam.
+
+ More changes to make number code readable
+
+ * kjs/number_object.cpp:
+ (KJS::integer_part_noexp):
+ (KJS::numberToFixed):
+ (KJS::numberToExponential):
+
+2007-12-28 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Sam.
+
+ More small cleanups to toPrecision
+
+ * kjs/number_object.cpp:
+ (KJS::numberToPrecision):
+
+2007-12-28 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Sam.
+
+ More small attempts to make number code readable
+
+ * kjs/number_object.cpp:
+ (KJS::exponentialPartToString):
+ (KJS::numberToExponential):
+ (KJS::numberToPrecision):
+
+2007-12-28 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Sam.
+
+ Break out callAsFunction implementations into static functions
+
+ * kjs/number_object.cpp:
+ (KJS::numberToString):
+ (KJS::numberToFixed):
+ (KJS::numberToExponential):
+ (KJS::numberToPrecision):
+ (KJS::NumberProtoFunc::callAsFunction):
+
+2007-12-28 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Sam.
+
+ Apply wkstyle/astyle and fix placement of *
+
+ * kjs/number_object.cpp:
+ (KJS::NumberInstance::NumberInstance):
+ (KJS::NumberPrototype::NumberPrototype):
+ (KJS::NumberProtoFunc::NumberProtoFunc):
+ (KJS::integer_part_noexp):
+ (KJS::intPow10):
+ (KJS::NumberProtoFunc::callAsFunction):
+ (KJS::NumberObjectImp::NumberObjectImp):
+ (KJS::NumberObjectImp::getOwnPropertySlot):
+ (KJS::NumberObjectImp::getValueProperty):
+ (KJS::NumberObjectImp::implementsConstruct):
+ (KJS::NumberObjectImp::construct):
+ (KJS::NumberObjectImp::callAsFunction):
+ * kjs/object.cpp:
+ (KJS::JSObject::put):
+
+2007-12-27 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Sam.
+
+ ASSERT in JavaScriptCore while viewing WICD test case
+ http://bugs.webkit.org/show_bug.cgi?id=16626
+
+ * kjs/nodes.cpp:
+ (KJS::ForInNode::execute): move KJS_CHECK_EXCEPTION to proper place
+
+2007-12-26 Jan Michael Alonzo <jmalonzo@unpluggable.com>
+
+ Reviewed by Alp Toker.
+
+ http://bugs.webkit.org/show_bug.cgi?id=16390
+ Use autotools or GNU make as the build system for the GTK port
+
+ * GNUmakefile.am: Added.
+
+2007-12-25 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver.
+
+ - Remove unnecessary redundant check from property setting
+ http://bugs.webkit.org/show_bug.cgi?id=16602
+
+ 1.3% speedup on SunSpider.
+
+ * kjs/object.cpp:
+ (KJS::JSObject::put): Don't do canPut check when not needed; let
+ the PropertyMap handle it.
+ (KJS::JSObject::canPut): Don't check the static property
+ table. lookupPut does that already.
+
+2007-12-24 Alp Toker <alp@atoker.com>
+
+ Fix builds that don't use AllInOneFile.cpp following breakage
+ introduced in r28973.
+
+ * kjs/grammar.y:
+
+2007-12-24 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Eric.
+
+ - Optimize variable declarations
+ http://bugs.webkit.org/show_bug.cgi?id=16585
+
+ 3.5% speedup on SunSpider.
+
+ var statements now result in either assignments or empty statements.
+
+ This allows a couple of optimization opportunities:
+ - No need to branch at runtime to check if there is an initializer
+ - EmptyStatementNodes can be removed entirely (also done in this patch)
+ - Assignment expressions get properly optimized for local variables
+
+ This patch also includes some code cleanup:
+ - Most of the old VarStatement/VarDecl logic is now only used for const declarations,
+ thus it is renamed appropriately
+ - AssignExprNode is gone
+
+ * JavaScriptCore.exp:
+ * kjs/NodeInfo.h:
+ * kjs/grammar.y:
+ * kjs/nodes.cpp:
+ (KJS::SourceElements::append):
+ (KJS::ConstDeclNode::ConstDeclNode):
+ (KJS::ConstDeclNode::optimizeVariableAccess):
+ (KJS::ConstDeclNode::handleSlowCase):
+ (KJS::ConstDeclNode::evaluateSingle):
+ (KJS::ConstDeclNode::evaluate):
+ (KJS::ConstStatementNode::optimizeVariableAccess):
+ (KJS::ConstStatementNode::execute):
+ (KJS::VarStatementNode::optimizeVariableAccess):
+ (KJS::VarStatementNode::execute):
+ (KJS::ForInNode::ForInNode):
+ (KJS::ForInNode::optimizeVariableAccess):
+ (KJS::ForInNode::execute):
+ (KJS::FunctionBodyNode::initializeSymbolTable):
+ (KJS::ProgramNode::initializeSymbolTable):
+ (KJS::FunctionBodyNode::processDeclarations):
+ (KJS::ProgramNode::processDeclarations):
+ (KJS::EvalNode::processDeclarations):
+ * kjs/nodes.h:
+ (KJS::DeclarationStacks::):
+ (KJS::StatementNode::):
+ (KJS::ConstDeclNode::):
+ (KJS::ConstStatementNode::):
+ (KJS::EmptyStatementNode::):
+ (KJS::VarStatementNode::):
+ (KJS::ForNode::):
+ * kjs/nodes2string.cpp:
+ (KJS::ConstDeclNode::streamTo):
+ (KJS::ConstStatementNode::streamTo):
+ (KJS::ScopeNode::streamTo):
+ (KJS::VarStatementNode::streamTo):
+ (KJS::ForNode::streamTo):
+ (KJS::ForInNode::streamTo):
+
+2007-12-21 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ * JavaScriptCore.exp: Remove unused symbol to prevent a weak external symbol
+ being generated in JavaScriptCore.framework.
+
+2007-12-21 Darin Adler <darin@apple.com>
+
+ Requested by Maciej.
+
+ * kjs/nodes.h: Use the new NEVER_INLINE here and eliminate the old
+ KJS_NO_INLINE. We don't want to have two, and we figured it was better
+ to keep the one that's in WTF.
+
+2007-12-21 Darin Adler <darin@apple.com>
+
+ Reviewed by Eric.
+
+ - http://bugs.webkit.org/show_bug.cgi?id=16561
+ remove debugger overhead from non-debugged JavaScript execution
+
+ 1.022x as fast on SunSpider.
+
+ * JavaScriptCore.exp: Updated.
+
+ * kjs/NodeInfo.h: Renamed SourceElementsStub to SourceElements,
+ since that more accurately describes the role of this object, which
+ is a reference-counted wrapper for a Vector.
+
+ * kjs/Parser.cpp:
+ (KJS::Parser::didFinishParsing): Changed parameter type to SourceElements,
+ and use plain assignment instead of set.
+ * kjs/Parser.h: Changed parameter type of didFinishParsing to a
+ SourceElements. Also changed m_sourceElements; we now use a RefPtr instead
+ of an OwnPtr as well.
+
+ * kjs/grammar.y: Got rid of all the calls to release() on SourceElements.
+ That's now handed inside the constructors for various node types, since we now
+ use vector swapping instead.
+
+ * kjs/nodes.cpp:
+ (KJS::Node::rethrowException): Added NEVER_INLINE, because this was getting inlined
+ and we want exception handling out of the normal code flow.
+ (KJS::SourceElements::append): Moved here from the header. This now handles
+ creating a BreakpointCheckStatement for each statement in the debugger case.
+ That way we can get breakpoint handling without having it in every execute function.
+ (KJS::BreakpointCheckStatement::BreakpointCheckStatement): Added.
+ (KJS::BreakpointCheckStatement::execute): Added. Contains the code that was formerly
+ in the StatementNode::hitStatement function and the KJS_BREAKPOINT macro.
+ (KJS::BreakpointCheckStatement::streamTo): Added.
+ (KJS::ArgumentListNode::evaluateList): Use KJS_CHECKEXCEPTIONVOID since the return
+ type is void.
+ (KJS::VarStatementNode::execute): Removed KJS_BREAKPOINT.
+ (KJS::BlockNode::BlockNode): Changed parameter type to SourceElements.
+ Changed code to use release since the class now contains a vector rather than
+ a vector point.
+ (KJS::BlockNode::optimizeVariableAccess): Updated since member is now a vector
+ rather than a vector pointer.
+ (KJS::BlockNode::execute): Ditto.
+ (KJS::ExprStatementNode::execute): Removed KJS_BREAKPOINT.
+ (KJS::IfNode::execute): Ditto.
+ (KJS::IfElseNode::execute): Ditto.
+ (KJS::DoWhileNode::execute): Ditto.
+ (KJS::WhileNode::execute): Ditto.
+ (KJS::ContinueNode::execute): Ditto.
+ (KJS::BreakNode::execute): Ditto.
+ (KJS::ReturnNode::execute): Ditto.
+ (KJS::WithNode::execute): Ditto.
+ (KJS::CaseClauseNode::optimizeVariableAccess): Updated since member is now a vector
+ rather than a vector pointer.
+ (KJS::CaseClauseNode::executeStatements): Ditto.
+ (KJS::SwitchNode::execute): Removed KJS_BREAKPOINT.
+ (KJS::ThrowNode::execute): Ditto.
+ (KJS::TryNode::execute): Ditto.
+ (KJS::ScopeNode::ScopeNode): Changed parameter type to SourceElements.
+ (KJS::ProgramNode::ProgramNode): Ditto.
+ (KJS::EvalNode::EvalNode): Ditto.
+ (KJS::FunctionBodyNode::FunctionBodyNode): Ditto.
+ (KJS::ScopeNode::optimizeVariableAccess): Updated since member is now a vector
+ rather than a vector pointer.
+
+ * kjs/nodes.h: Removed hitStatement. Renamed SourceElements to StatementVector.
+ Renamed SourceElementsStub to SourceElements and made it derive from
+ ParserRefCounted rather than from Node, hold a vector rather than a pointer to
+ a vector, and changed the release function to swap with another vector rather
+ than the pointer idiom. Updated BlockNode and CaseClauseNode to hold actual
+ vectors instead of pointers to vectors. Added BreakpointCheckStatement.
+
+ * kjs/nodes2string.cpp:
+ (KJS::statementListStreamTo): Changed to work on a vector instead of a pointer
+ to a vector.
+ (KJS::BlockNode::streamTo): Ditto.
+ (KJS::CaseClauseNode::streamTo): Ditto.
+
+ * wtf/AlwaysInline.h: Added NEVER_INLINE.
+ * wtf/PassRefPtr.h: Tweaked formatting. Added clear() function that matches the
+ ones in OwnPtr and auto_ptr.
+ * wtf/RefPtr.h: Ditto.
+
+2007-12-21 Darin Adler <darin@apple.com>
+
+ - fix broken regression tests
+
+ The broken tests were fast/js/do-while-expression-value.html and
+ fast/js/while-expression-value.html.
+
+ * kjs/nodes.cpp: Check in the correct version of this file. I had accidentally landed
+ an old version of my patch for bug 16471.
+ (KJS::statementListExecute): The logic here was backwards. Have to set the value
+ even for non-normal execution results.
+
+2007-12-20 Alexey Proskuryakov <ap@webkit.org>
+
+ Windows build fix
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Copy npruntime_internal.h
+ to WebKitBuild.
+
+2007-12-20 Eric Seidel <eric@webkit.org>
+
+ Reviewed by mjs.
+
+ Split IfNode into IfNode and IfElseNode for speedup.
+ http://bugs.webkit.org/show_bug.cgi?id=16470
+
+ SunSpider claims this is 1.003x as fast as before.
+ (This required running with --runs 15 to get consistent enough results to tell!)
+
+ * kjs/grammar.y:
+ * kjs/nodes.cpp:
+ (KJS::IfNode::optimizeVariableAccess):
+ (KJS::IfNode::execute):
+ (KJS::IfNode::getDeclarations):
+ (KJS::IfElseNode::optimizeVariableAccess):
+ (KJS::IfElseNode::execute):
+ (KJS::IfElseNode::getDeclarations):
+ * kjs/nodes.h:
+ (KJS::IfNode::):
+ (KJS::IfElseNode::):
+ * kjs/nodes2string.cpp:
+ (KJS::IfNode::streamTo):
+ (KJS::IfElseNode::streamTo):
+
+2007-12-20 Darin Adler <darin@apple.com>
+
+ Reviewed by Sam.
+
+ * wtf/OwnPtr.h:
+ (WTF::operator==): Added.
+ (WTF::operator!=): Added.
+
+2007-12-20 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ AST optimization: Avoid NULL-checking ForNode's child nodes.
+
+ 0.6% speedup on SunSpider.
+
+ This is a proof of concept patch that demonstrates how to optimize
+ grammar productions with optional components, like
+
+ for (optional; optional; optional) {
+ ...
+ }
+
+ The parser emits NULL for an optional component that is not present.
+
+ Instead of checking for a NULL child at execution time, a node that
+ expects an optional component to be present more often than not checks
+ for a NULL child at construction time, and substitutes a viable
+ alternative node in its place.
+
+ (We'd like the parser to start emitting NULL a lot more once we teach
+ it to emit NULL for certain no-op productions like EmptyStatement and
+ VariableStatement, so, as a foundation, it's important for nodes with
+ NULL optional components to be fast.)
+
+ * kjs/Parser.cpp:
+ (KJS::Parser::didFinishParsing): Check for NULL SourceElements. Also,
+ moved didFinishParsing into the .cpp file because adding a branch while
+ it was in the header file caused a substantial and inexplicable
+ performance regression. (Did I mention that GCC is crazy?)
+
+ * kjs/grammar.y:
+
+ * kjs/nodes.cpp:
+ (KJS::BlockNode::BlockNode): Check for NULL SourceElements.
+ (KJS::ForNode::optimizeVariableAccess): No need to check for NULL here.
+ (KJS::ForNode::execute): No need to check for NULL here.
+ * kjs/nodes.h:
+ (KJS::ForNode::): Check for NULL SourceElements. Substitute a TrueNode
+ because it's semantically harmless, and it evaluates to boolean in an
+ efficient manner.
+
+2007-12-20 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff.
+
+ Slight logic reordering in JSImmediate::from(double)
+
+ This gives a 0.6% improvement in SunSpider.
+
+ * kjs/JSImmediate.h:
+ (KJS::JSImmediate::from):
+
+2007-12-20 Eric Seidel <eric@webkit.org>
+
+ Reviewed by mjs.
+
+ Fix major Array regression introduced by 28899.
+
+ SunSpider claims this is at least 1.37x as fast as pre-regression. :)
+
+ * kjs/array_instance.cpp: make Arrays fast again!
+
+2007-12-20 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Geoff, then re-rubber-stamped by Geoff after final search/replace and testing.
+
+ Small reworking of Date code for 4% speedup on Date tests (0.2% overall)
+ http://bugs.webkit.org/show_bug.cgi?id=16537
+
+ Make msToYear human-readable
+ Make msToDayInMonth slightly more readable and avoid recalculating msToYear
+ Remove use of isInLeapYear to avoid calling msToYear
+ Remove dayInYear call by changing msToDayInMonth to dayInMonthFromDayInYear
+ Remove more duplicate calls to dayInYear and getUTCOffset for further speedup
+
+ * kjs/DateMath.cpp:
+ (KJS::daysFrom1970ToYear):
+ (KJS::msToYear):
+ (KJS::monthFromDayInYear):
+ (KJS::checkMonth):
+ (KJS::dayInMonthFromDayInYear):
+ (KJS::dateToDayInYear):
+ (KJS::getDSTOffsetSimple):
+ (KJS::getDSTOffset):
+ (KJS::gregorianDateTimeToMS):
+ (KJS::msToGregorianDateTime):
+
+2007-12-20 Rodney Dawes <dobey@wayofthemonkey.com>
+
+ Reviewed by Darin Adler.
+
+ Proxy includes of npruntime.h or npapi.h through npruntime_internal.h
+ Include stdio.h in npapi.h for the use of FILE with XP_UNIX defined
+ This is for building with X11, as some type and enum names conflict
+ with #define names in X11 headers.
+ http://bugs.webkit.org/show_bug.cgi?id=15669
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * bindings/NP_jsobject.h:
+ * bindings/npapi.h:
+ * bindings/npruntime.cpp:
+ * bindings/npruntime_impl.h:
+ * bindings/npruntime_priv.h:
+ * bindings/npruntime_internal.h:
+ * bindings/testbindings.cpp:
+ * bindings/c/c_class.h:
+ * bindings/c/c_runtime.h:
+ * bindings/c/c_utility.h:
+
+2007-12-20 Darin Adler <darin@apple.com>
+
+ - re-fix http://bugs.webkit.org/show_bug.cgi?id=16471
+ Completions need to be smaller (or not exist at all)
+
+ Same patch as last time with the test failures problem fixed.
+
+ * kjs/function.cpp:
+ (KJS::GlobalFuncImp::callAsFunction): Make sure to check the completion
+ type from newExec to see if the execute raised an exception.
+
+2007-12-20 Darin Adler <darin@apple.com>
+
+ - roll out that last change -- it was causing test failures;
+ I'll check it back in after fixing them
+
+2007-12-20 Darin Adler <darin@apple.com>
+
+ Reviewed by Eric.
+
+ - http://bugs.webkit.org/show_bug.cgi?id=16471
+ Completions need to be smaller (or not exist at all)
+
+ SuSpider shows 2.4% speedup.
+
+ Stop using completions in the execution engine.
+ Instead, the completion type and label target are both
+ stored in the ExecState.
+
+ * API/JSContextRef.cpp: Removed unneeded include of "completion.h".
+ * bindings/runtime_method.cpp: Removed unused execute function.
+ * bindings/runtime_method.h: Ditto.
+
+ * kjs/ExecState.h: Added completionType, breakOrContinueTarget,
+ setCompletionType, setNormalCompletion, setBreakCompletion,
+ setContinueCompletion, setReturnValueCompletion, setThrowCompletion,
+ setInterruptedCompletion, m_completionType, and m_breakOrContinueTarget.
+
+ * kjs/completion.h: Removed constructor and getter for target
+ for break and continue from Completion. This class is now only
+ used for the public API to Interpreter and such.
+
+ * kjs/date_object.h: Removed unused execute function.
+
+ * kjs/function.cpp:
+ (KJS::FunctionImp::callAsFunction): Removed some unneeded
+ exception processing. Updated to call the new execute function
+ and to get the completion type from the ExecState. Merged in
+ the execute function, which repeated some of the same logic and
+ was called only from here.
+ (KJS::GlobalFuncImp::callAsFunction): More of the same for eval.
+ * kjs/function.h: Removed execute.
+
+ * kjs/interpreter.cpp:
+ (KJS::Interpreter::evaluate): Added code to convert the result of
+ execut into a Completion.
+
+ * kjs/nodes.cpp:
+ (KJS::Node::setErrorCompletion): Renamed from createErrorCompletion.
+ Now sets the completion type in the ExecState.
+ (KJS::Node::rethrowException): Now sets the completion type in the
+ ExecState.
+ (KJS::StatementNode::hitStatement): Now sets the completion type in
+ the ExecState.
+ (KJS::VarStatementNode::execute): Updated to put completion type in
+ the ExecState instead of a Completion object.
+ (KJS::statementListExecute): Ditto. Also changed the for loop to use
+ indices instead of iterators.
+ (KJS::BlockNode::execute): Updated return type.
+ (KJS::EmptyStatementNode::execute): Updated to put completion type in
+ the ExecState instead of a Completion object.
+ (KJS::ExprStatementNode::execute): Ditto.
+ (KJS::IfNode::execute): Ditto.
+ (KJS::DoWhileNode::execute): Ditto. Also streamlined the logic a little
+ to make the normal case a little faster and moved the end outside the
+ loop so that "break" can do a break.
+ (KJS::WhileNode::execute): Ditto.
+ (KJS::ForNode::execute): Ditto.
+ (KJS::ForInNode::execute): Ditto.
+ (KJS::ContinueNode::execute): Updated to put completion type in
+ the ExecState instead of a Completion object.
+ (KJS::BreakNode::execute): Ditto.
+ (KJS::ReturnNode::execute): Ditto.
+ (KJS::WithNode::execute): Ditto.
+ (KJS::CaseClauseNode::executeStatements): Ditto. Also renamed to have
+ execute in its name to reflect the fact that it's a member of the same
+ family of functions.
+ (KJS::CaseBlockNode::executeBlock): Ditto.
+ (KJS::SwitchNode::execute): Ditto.
+ (KJS::LabelNode::execute): Ditto.
+ (KJS::ThrowNode::execute): Ditto.
+ (KJS::TryNode::execute): Ditto.
+ (KJS::ProgramNode::execute): Ditto.
+ (KJS::EvalNode::execute): Ditto.
+ (KJS::FunctionBodyNode::execute): Ditto.
+ (KJS::FuncDeclNode::execute): Ditto.
+
+ * kjs/nodes.h: Renamed setErrorCompletion to createErrorCompletion, made
+ hitStatement protected, changed return value of execute to a JSValue,
+ renamed evalStatements to executeStatements, and evalBlock to executeBlock.
+
+ * kjs/number_object.h: Removed unused execute function.
+
+2007-12-20 Geoffrey Garen <ggaren@apple.com>
+
+ Added Radar number.
+
+ * kjs/nodes.cpp:
+ (KJS::ProgramNode::processDeclarations):
+
+2007-12-20 Geoffrey Garen <ggaren@apple.com>
+
+ Linux build fix: config.h has to come first.
+
+ * kjs/error_object.cpp:
+
+2007-12-19 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Optimized global access to global variables, using a symbol table.
+
+ SunSpider reports a 1.5% overall speedup, a 6.2% speedup on 3d-morph,
+ and a whopping 33.1% speedup on bitops-bitwise-and.
+
+ * API/JSCallbackObjectFunctions.h: Replaced calls to JSObject:: with
+ calls to Base::, since JSObject is not always our base class. This
+ was always a bug, but the bug is even more apparent after some of my
+ changes.
+
+ (KJS::::staticFunctionGetter): Replaced use of getDirect with call to
+ getOwnPropertySlot. Global declarations are no longer stored in the
+ property map, so a call to getDirect is insufficient for finding
+ override properties.
+
+ * API/testapi.c:
+ * API/testapi.js: Added test for the getDirect change mentioned above.
+
+ * kjs/ExecState.cpp:
+ * kjs/ExecState.h: Dialed back the optimization to store a direct
+ pointer to the localStorage buffer. One ExecState can grow the global
+ object's localStorage without another ExecState's knowledge, so
+ ExecState can't store a direct pointer to the localStorage buffer
+ unless/until we invent a way to update all the relevant ExecStates.
+
+ * kjs/JSGlobalObject.cpp: Inserted the symbol table into get and put
+ operations.
+ (KJS::JSGlobalObject::reset): Reset the symbol table and local storage,
+ too. Also, clear the property map here, removing the need for a
+ separate call.
+
+ * kjs/JSVariableObject.cpp:
+ * kjs/JSVariableObject.h: Added support for saving localStorage and the
+ symbol table to the back/forward cache, and restoring them.
+
+ * kjs/function.cpp:
+ (KJS::GlobalFuncImp::callAsFunction): Renamed progNode to evalNode
+ because it's an EvalNode, not a ProgramNode.
+
+ * kjs/lookup.h:
+ (KJS::cacheGlobalObject): Replaced put with faster putDirect, since
+ that's how the rest of lookup.h works. putDirect is safe here because
+ cacheGlobalObject is only used for objects whose names are not valid
+ identifiers.
+
+ * kjs/nodes.cpp: The good stuff!
+
+ (KJS::EvalNode::processDeclarations): Replaced hasProperty with
+ the new hasOwnProperty, which is slightly faster.
+
+ * kjs/object.h: Nixed clearProperties because clear() does this job now.
+
+ * kjs/property_map.cpp:
+ * kjs/property_map.h: More back/forward cache support.
+
+ * wtf/Vector.h:
+ (WTF::::grow): Added fast non-branching grow function. I used it in
+ an earlier version of this patch, even though it's not used anymore.
+
+2007-12-09 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Build fix for non-Mac platforms. Move NodeInfo into its own header so that the YYTYPE
+ declaration in grammar.h is able to declare members of that type.
+
+ * kjs/NodeInfo.h: Added.
+ (KJS::createNodeInfo):
+ (KJS::mergeDeclarationLists):
+ (KJS::appendToVarDeclarationList):
+ * kjs/grammar.y:
+ * kjs/lexer.cpp:
+
+2007-12-19 Oliver Hunt <oliver@apple.com>
+
+ Make appendToVarDeclarationList static
+
+ RS=Weinig.
+
+ * kjs/grammar.y:
+
+2007-12-18 Oliver Hunt <oliver@apple.com>
+
+ Remove dead code due to removal of post-parse declaration discovery.
+
+ RS=Geoff.
+
+ Due to the removal of the declaration discovery pass after parsing we
+ no longer need any of the logic used for that discovery.
+
+ * kjs/nodes.cpp:
+ (KJS::Node::Node):
+ (KJS::VarDeclNode::VarDeclNode):
+ (KJS::BlockNode::BlockNode):
+ (KJS::ForInNode::ForInNode):
+ (KJS::CaseBlockNode::CaseBlockNode):
+ * kjs/nodes.h:
+ (KJS::VarStatementNode::):
+ (KJS::IfNode::):
+ (KJS::DoWhileNode::):
+ (KJS::WhileNode::):
+ (KJS::WithNode::):
+ (KJS::LabelNode::):
+ (KJS::TryNode::):
+ (KJS::FuncDeclNode::):
+ (KJS::CaseClauseNode::):
+ (KJS::ClauseListNode::):
+ (KJS::SwitchNode::):
+
+2007-12-18 Oliver Hunt <oliver@apple.com>
+
+ Replace post-parse pass to find declarations with logic in the parser itself
+
+ Reviewed by Geoff.
+
+ Instead of finding declarations in a pass following the initial parsing of
+ a program, we incorporate the logic directly into the parser. This lays
+ the groundwork for further optimisations (such as improving performance in
+ declaration expressions -- var x = y; -- to match that of standard assignment)
+ in addition to providing a 0.4% performance improvement in SunSpider.
+
+ * JavaScriptCore.exp:
+ * kjs/Parser.cpp:
+ (KJS::Parser::parse):
+ * kjs/Parser.h:
+ (KJS::Parser::didFinishParsing):
+ (KJS::Parser::parse):
+ * kjs/grammar.y:
+ * kjs/nodes.cpp:
+ (KJS::ParserTracked::ParserTracked):
+ (KJS::ParserTracked::~ParserTracked):
+ (KJS::ParserTracked::ref):
+ (KJS::ParserTracked::deref):
+ (KJS::ParserTracked::refcount):
+ (KJS::ParserTracked::clearNewTrackedObjects):
+ (KJS::Node::Node):
+ (KJS::ScopeNode::ScopeNode):
+ (KJS::ProgramNode::ProgramNode):
+ (KJS::EvalNode::EvalNode):
+ (KJS::FunctionBodyNode::FunctionBodyNode):
+ (KJS::FunctionBodyNode::initializeSymbolTable):
+ (KJS::FunctionBodyNode::processDeclarations):
+ * kjs/nodes.h:
+ (KJS::ParserTracked::):
+ (KJS::Node::):
+ (KJS::ScopeNode::):
+
+2007-12-18 Xan Lopez <xan@gnome.org>
+
+ Reviewed by Geoff.
+
+ Fix http://bugs.webkit.org/show_bug.cgi?id=14521
+ Bug 14521: JavaScriptCore fails to build on Linux/PPC gcc 4.1.2
+
+ * wtf/TCSpinLock.h:
+ (TCMalloc_SpinLock::Unlock):
+
+ Use less strict memory operand constraint on inline asm generation.
+ PLATFORM(DARWIN) left unpatched due to Apple's GCC bug.
+
+ Patch by David Kilzer <ddkilzer@webkit.org>
+
+2007-12-18 Mark Rowe <mrowe@apple.com>
+
+ Rubber-stamped by Maciej Stachowiak.
+
+ Remove outdated and non-functioning project files for the Apollo port.
+
+ * JavaScriptCore.apolloproj: Removed.
+
+2007-12-18 Darin Adler <darin@apple.com>
+
+ - fix Windows build
+
+ * pcre/pcre_exec.cpp:
+ (jsRegExpExecute): Change back from false/true to 0/1 -- I probably should not have
+ deleted MATCH_MATCH and MATCH_NOMATCH, but I'm going to leave them out.
+
+2007-12-18 Darin Adler <darin@apple.com>
+
+ Reviewed by Geoff.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=16458
+ REGRESSION (r28164): regular expressions can now hang due to lack of a match limit
+ <rdar://problem/5636067>
+
+ Test: fast/regex/slow.html
+
+ Slows down SunSpider a bit (about 1.01x); filed a bug to follow up on that:
+ http://bugs.webkit.org/show_bug.cgi?id=16503
+
+ * pcre/pcre.h: Changed name of error code to not specifically mention "recursion".
+ * pcre/pcre_exec.cpp:
+ (match): Replaced the depth limit, MATCH_RECURSION_LIMIT, with a total match looping
+ limit, matchLimit. Also eliminated the constants for MATCH_MATCH and MATCH_NOMATCH,
+ since they are just true and false (1 and 0).
+ (jsRegExpExecute): More of the MATCH_MATCH change.
+
+2007-12-17 Darin Adler <darin@apple.com>
+
+ - speculative build fix for non-gcc platforms
+
+ * pcre/pcre_exec.cpp: (match): Remove unused cases from return switch.
+
+2007-12-16 Mark Rowe <mrowe@apple.com>
+
+ Speculative build fix for non-Mac platforms.
+
+ * pcre/pcre_compile.cpp: Include string.h for memset, memmove, etc.
+
+2007-12-16 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - http://bugs.webkit.org/show_bug.cgi?id=16438
+ - removed some more unused code
+ - changed quite a few more names to WebKit-style
+ - moved more things out of pcre_internal.h
+ - changed some indentation to WebKit-style
+ - improved design of the functions for reading and writing
+ 2-byte values from the opcode stream (in pcre_internal.h)
+
+ * pcre/dftables.cpp:
+ (main): Added the kjs prefix a normal way in lieu of using macros.
+
+ * pcre/pcre_compile.cpp: Moved some definitions here from pcre_internal.h.
+ (errorText): Name changes, fewer typedefs.
+ (checkEscape): Ditto. Changed uppercase conversion to use toASCIIUpper.
+ (isCountedRepeat): Name change.
+ (readRepeatCounts): Name change.
+ (firstSignificantOpcode): Got rid of the use of OP_lengths, which is
+ very lightly used here. Hard-coded the length of OP_BRANUMBER.
+ (firstSignificantOpcodeSkippingAssertions): Ditto. Also changed to
+ use the advanceToEndOfBracket function.
+ (getOthercaseRange): Name changes.
+ (encodeUTF8): Ditto.
+ (compileBranch): Name changes. Removed unused after_manual_callout and
+ the code to handle it. Removed code to handle OP_ONCE since we never
+ emit this opcode. Changed to use advanceToEndOfBracket in more places.
+ (compileBracket): Name changes.
+ (branchIsAnchored): Removed code to handle OP_ONCE since we never emit
+ this opcode.
+ (bracketIsAnchored): Name changes.
+ (branchNeedsLineStart): More fo the same.
+ (bracketNeedsLineStart): Ditto.
+ (branchFindFirstAssertedCharacter): Removed OP_ONCE code.
+ (bracketFindFirstAssertedCharacter): More of the same.
+ (calculateCompiledPatternLengthAndFlags): Ditto.
+ (returnError): Name changes.
+ (jsRegExpCompile): Ditto.
+
+ * pcre/pcre_exec.cpp: Moved some definitions here from pcre_internal.h.
+ (matchRef): Updated names.
+ Improved macros to use the do { } while(0) idiom so they expand to single
+ statements rather than to blocks or multiple statements. And refeactored
+ the recursive match macros.
+ (MatchStack::pushNewFrame): Name changes.
+ (getUTF8CharAndIncrementLength): Name changes.
+ (match): Name changes. Removed the ONCE opcode.
+ (jsRegExpExecute): Name changes.
+
+ * pcre/pcre_internal.h: Removed quite a few unneeded includes. Rewrote
+ quite a few comments. Removed the macros that add kjs prefixes to the
+ functions with external linkage; instead renamed the functions. Removed
+ the unneeded typedefs pcre_uint16, pcre_uint32, and uschar. Removed the
+ dead and not-all-working code for LINK_SIZE values other than 2, although
+ we aim to keep the abstraction working. Removed the OP_LENGTHS macro.
+ (put2ByteValue): Replaces put2ByteOpcodeValueAtOffset.
+ (get2ByteValue): Replaces get2ByteOpcodeValueAtOffset.
+ (put2ByteValueAndAdvance): Replaces put2ByteOpcodeValueAtOffsetAndAdvance.
+ (putLinkValueAllowZero): Replaces putOpcodeValueAtOffset; doesn't do the
+ addition, since a comma is really no better than a plus sign. Added an
+ assertion to catch out of range values and changed the parameter type to
+ int rather than unsigned.
+ (getLinkValueAllowZero): Replaces getOpcodeValueAtOffset.
+ (putLinkValue): New function that most former callers of the
+ putOpcodeValueAtOffset function can use; asserts the value that is
+ being stored is non-zero and then calls putLinkValueAllowZero.
+ (getLinkValue): Ditto.
+ (putLinkValueAndAdvance): Replaces putOpcodeValueAtOffsetAndAdvance. No
+ caller was using an offset, which makes sense given the advancing behavior.
+ (putLinkValueAllowZeroAndAdvance): Ditto.
+ (isBracketOpcode): Added. For use in an assertion.
+ (advanceToEndOfBracket): Renamed from moveOpcodePtrPastAnyAlternateBranches,
+ and removed comments about how it's not well designed. This function takes
+ a pointer to the beginning of a bracket and advances to the end of the
+ bracket.
+
+ * pcre/pcre_tables.cpp: Updated names.
+ * pcre/pcre_ucp_searchfuncs.cpp:
+ (kjs_pcre_ucp_othercase): Ditto.
+ * pcre/pcre_xclass.cpp:
+ (getUTF8CharAndAdvancePointer): Ditto.
+ (kjs_pcre_xclass): Ditto.
+ * pcre/ucpinternal.h: Ditto.
+
+ * wtf/ASCIICType.h:
+ (WTF::isASCIIAlpha): Added an int overload, like the one we already have for
+ isASCIIDigit.
+ (WTF::isASCIIAlphanumeric): Ditto.
+ (WTF::isASCIIHexDigit): Ditto.
+ (WTF::isASCIILower): Ditto.
+ (WTF::isASCIISpace): Ditto.
+ (WTF::toASCIILower): Ditto.
+ (WTF::toASCIIUpper): Ditto.
+
+2007-12-16 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=16459
+ REGRESSION: assertion failure with regexp with \B in a case-ignoring character range
+ <rdar://problem/5646361>
+
+ The problem was that \B was not handled properly in character classes.
+
+ Test: fast/js/regexp-overflow.html
+
+ * pcre/pcre_compile.cpp:
+ (check_escape): Added handling of ESC_b and ESC_B in character classes here.
+ Allows us to get rid of the handling of \b in character classes from all the
+ call sites that handle it separately and to handle \B properly as well.
+ (compileBranch): Remove the ESC_b handling, since it's not needed any more.
+ (calculateCompiledPatternLengthAndFlags): Ditto.
+
+2007-12-16 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Fix http://bugs.webkit.org/show_bug.cgi?id=16448
+ Bug 16448: [GTK] Celtic Kane JavaScript performance on Array test is slow relative to Mac
+
+ * kjs/array_instance.cpp:
+ (KJS::compareByStringPairForQSort):
+ (KJS::ArrayInstance::sort): Convert JSValue's to strings once up front and then sort the
+ results. This avoids calling toString twice per comparison, but requires a temporary buffer
+ so we only use this approach in cases where the array being sorted is not too large.
+
+2007-12-16 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler and Maciej Stachowiak.
+
+ More refactoring to support global variable optimization.
+
+ Changed SymbolTable to use RefPtr<UString::Rep> as its key instead of
+ UString::Rep*. With globals, the symbol table can outlast the
+ declaration node for any given symbol, so the symbol table needs to ref
+ its symbol names.
+
+ In support, specialized HashMaps with RefPtr keys to allow lookup
+ via raw pointer, avoiding refcount churn.
+
+ SunSpider reports a .6% speedup (prolly just noise).
+
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj: Added new file: wtf/RefPtrHashMap.h
+ * JavaScriptCore.xcodeproj/project.pbxproj: ditto
+
+ * kjs/JSVariableObject.cpp:
+ (KJS::JSVariableObject::getPropertyNames): Symbol table keys are RefPtrs now.
+
+ * kjs/SymbolTable.h: Modified key traits to match RefPtr. Added a
+ static Rep* for null, which helps compute the deletedValue() trait.
+
+ * wtf/HashMap.h: #include the RefPtr specialization so everyone can use it.
+
+ * wtf/RefPtrHashMap.h: Copied from wtf/HashMap.h. Added overloaded versions
+ of find(), contains(), get(), set(), add(), remove(), and take() that take
+ raw pointers as keys.
+
+2007-12-16 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Darin.
+
+ http://bugs.webkit.org/show_bug.cgi?id=16162
+ Problems with float parsing on Linux (locale-dependent parsing was used).
+
+ * kjs/dtoa.cpp: Removed USE_LOCALE to reduce future confusion.
+ * kjs/lexer.cpp: (KJS::Lexer::lex): Parse with kjs_strtod, not the system one.
+
+2007-12-14 Alp Toker <alp@atoker.com>
+
+ Reviewed by Mark Rowe.
+
+ Enable the AllInOneFile.cpp optimization for the GTK+ port.
+
+ * JavaScriptCore.pri:
+
+2007-12-14 Mark Rowe <mrowe@apple.com>
+
+ Unreviewed. Remove commented out fprintf's that were for debugging purposes only.
+
+ * wtf/FastMalloc.cpp:
+ (WTF::TCMalloc_PageHeap::IncrementalScavenge):
+
+2007-12-14 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Don't use the MADV_DONTNEED code path for now as it has no effect on Mac OS X and is
+ currently untested on other platforms.
+
+ * wtf/TCSystemAlloc.cpp:
+ (TCMalloc_SystemRelease): Return after releasing memory rather than potentially falling
+ through into another mechanism if multiple are supported.
+
+2007-12-14 Alp Toker <alp@atoker.com>
+
+ Build fix for GTK+/Qt and ports that don't use AllInOneFile.cpp.
+
+ Include UnusedParam.h.
+
+ * wtf/TCSystemAlloc.cpp:
+
+2007-12-14 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Stephanie.
+
+ Fix build on windows
+
+ * wtf/FastMalloc.cpp:
+ (WTF::TCMalloc_PageHeap::IncrementalScavenge):
+
+2007-12-14 Dan Bernstein <mitz@apple.com>
+
+ - try again to fix the Windows build
+
+ * wtf/TCSystemAlloc.cpp:
+ (TCMalloc_SystemRelease):
+
+2007-12-14 Dan Bernstein <mitz@apple.com>
+
+ - try to fix the Windows build
+
+ * wtf/TCSystemAlloc.cpp:
+ (TCMalloc_SystemRelease):
+
+2007-12-14 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Maciej and Oliver.
+
+ Add final changes to make TCMalloc release memory to the system.
+ This results in a 0.4% regression against ToT, but this is offset
+ against the gains made by the original TCMalloc r38 merge - in fact
+ we retain around 0.3-0.4% progression overall.
+
+ * wtf/FastMalloc.cpp:
+ (WTF::InitSizeClasses):
+ (WTF::TCMalloc_PageHeap::IncrementalScavenge):
+ * wtf/TCSystemAlloc.cpp:
+ (TCMalloc_SystemRelease):
+
+2007-12-14 Darin Adler <darin@apple.com>
+
+ Reviewed by Sam.
+
+ - removed unnecessary includes of "Vector.h"
+
+ * wtf/HashMap.h:
+ (WTF::copyKeysToVector): Make the type of the vector be a template parameter.
+ This allows copying keys into a vector of a base class or one with an inline capacity.
+ (WTF::copyValuesToVector): Ditto.
+ * wtf/HashSet.h:
+ (WTF::copyToVector): Ditto.
+
+2007-12-14 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Darin and Geoff.
+
+ <rdar://problem/5619295>
+ REGRESSION: 303-304: Embedded YouTube video fails to render- JS errors (16150) (Flash 9)
+
+ Get rid of unnecessary and incorrect security checks for plug-ins accessing JavaScript objects.
+
+ The way this used to work was that each NPObject that wrapped a JSObject would have a root object
+ corresponding to the frame object (used for managing the lifecycle) and an origin root object (used for
+ doing security checks).
+
+ This would prevent a plug-in from accessing a frame's window object if it's security origin was different
+ (some parts of the window, such as the location object, can be accessed from frames with different security
+ origins, and those checks are being done in WebCore).
+
+ Also, if a plug-in were to access a window object of a frame that later went away, it could lead to that
+ Window JSObject being garbage collected and the NPObject pointing to freed memory.
+
+ How this works now is that there is no origin root object anymore, and all NPObject wrappers that are created
+ for a plug-in will have the root object of the containing frame of that plug-in.
+
+ * bindings/NP_jsobject.cpp:
+ (jsDeallocate):
+ Don't free the origin root object.
+
+ (_NPN_CreateScriptObject):
+ Remove the origin root object parameter.
+
+ (_NPN_InvokeDefault):
+ (_NPN_Invoke):
+ (_NPN_Evaluate):
+ (_NPN_GetProperty):
+ (_NPN_SetProperty):
+ (_NPN_RemoveProperty):
+ (_NPN_HasProperty):
+ (_NPN_HasMethod):
+ (_NPN_Enumerate):
+ Get rid of all security checks.
+
+ * bindings/NP_jsobject.h:
+ Remove originRootObject from the JavaScriptObject struct.
+
+ * bindings/c/c_utility.cpp:
+ (KJS::Bindings::convertValueToNPVariant):
+ Always use the root object from the ExecState.
+
+2007-12-13 Steve Falkenburg <sfalken@apple.com>
+
+ Move source file generation into its own vcproj to fix build dependencies.
+
+ Reviewed by Adam.
+
+ * JavaScriptCore.vcproj/JavaScriptCore.sln:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make: Added.
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.vcproj: Added.
+ * JavaScriptCore.vcproj/JavaScriptCoreSubmit.sln:
+
+2007-12-13 Alp Toker <alp@atoker.com>
+
+ http://bugs.webkit.org/show_bug.cgi?id=16406
+ [Gtk] JavaScriptCore needs -lpthread
+
+ Build fix for Debian and any other platforms that don't implicitly
+ link to pthread.
+
+ Link to pthread on non-Windows platforms until this dependency is
+ removed from JSC.
+
+2007-12-11 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Build fix: Note some variables that are used only for ASSERTs.
+
+ * API/testapi.c:
+ (Base_finalize):
+ (globalObject_initialize):
+ (testInitializeFinalize):
+
+2007-12-11 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Fixed: All JS tests crash on Windows.
+
+ NDEBUG wasn't defined when compiling testkjs in release builds, so the
+ HashTable definition in HashTable.h included an extra data member.
+
+ The solution was to add NDEBUG to the release testkjs configuration on
+ Windows and Mac.
+
+ For giggles, I also added other missing #defines to testkjs on Windows.
+
+ * Configurations/Base.xcconfig:
+ * Configurations/JavaScriptCore.xcconfig:
+ * JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * kjs/testkjs.cpp:
+ (main):
+
+2007-12-11 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Removed bogus ASSERT.
+
+ ASSERT should only be used when we know that a code path will not be
+ taken. This code path is taken often during the jsFunFuzz test.
+
+ * pcre/pcre_exec.cpp:
+ (jsRegExpExecute):
+
+2007-12-11 Darin Adler <darin@apple.com>
+
+ * wtf/unicode/qt4/UnicodeQt4.h: Try to fix Qt build by adding U16_IS_SINGLE.
+
+2007-12-10 Darin Adler <darin@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=16379
+ REGRESSION(r28525): Failures in http/tests/xmlhttprequest/response-encoding.html and
+ fast/dom/xmlhttprequest-html-response-encoding.html
+ and <rdar://problem/5640230> REGRESSION (306A4-ToT): Access violation in PCRE function
+ find_firstassertedchar
+
+ Test: fast/js/regexp-find-first-asserted.html
+
+ * pcre/pcre_compile.cpp:
+ (compileBracket): Take out unnecessary initialization of out parameters.
+ (branchFindFirstAssertedCharacter): Added. Broke out the half of the function that handles
+ a branch.
+ (bracketFindFirstAssertedCharacter): Renamed from find_firstassertedchar. Also removed the
+ options parameter -- the caller can handle the options.
+ (jsRegExpCompile): Changed call site to call the appropriate bracket or branch version of
+ the find_firstassertedchar function. Also put the REQ_IGNORE_CASE code here instead of
+ passing in the options.
+
+2007-12-10 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Split this:
+
+ FunctionBodyNode
+ ^
+ |
+ ProgramNode
+
+ into this:
+
+ ScopeNode
+ ^ ^ ^
+ | | |
+ FunctionBodyNode ProgramNode EvalNode
+
+ in preparation for specializing each class more while optimizing global
+ variable access.
+
+ Also removed some cruft from the FunctionBodyNode interface to simplify
+ things.
+
+ SunSpider says this patch is a .8% speedup, which seems reasonable,
+ since it eliminates a few branches and adds KJS_FAST_CALL in a few
+ places.
+
+ Layout tests and JS tests pass. Also, this baby builds on Windows! (Qt
+ mileage may vary...)
+
+2007-12-10 Geoffrey Garen <ggaren@apple.com>
+
+ RS by Mark Rowe.
+
+ Mac build fix: added some exported symbols, now that Parser::parse is
+ defined in the header.
+
+ * JavaScriptCore.exp:
+
+2007-12-10 Sam Weinig <sam@webkit.org>
+
+ Build fix.
+
+ Template methods need to be in the header.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * kjs/Parser.cpp:
+ * kjs/Parser.h:
+ (KJS::Parser::parse):
+
+2007-12-10 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Merged different implementations of Parser::parse into a single,
+ templatized implementation, in preparation for adding yet another
+ implementation for "eval" code.
+
+ JS and layout tests pass.
+
+2007-12-10 Timothy Hatcher <timothy@apple.com>
+
+ Reviewed by Mark Rowe
+
+ <rdar://problem/5639463> Bundle versions on Tiger should be 4523.x not 523.x
+
+ * Configurations/Version.xcconfig: Some Tiger versions of Xcode don't set MAC_OS_X_VERSION_MAJOR,
+ so assume Tiger and use a 4 for the SYSTEM_VERSION_PREFIX.
+
+2007-12-10 Mark Rowe <mrowe@apple.com>
+
+ Tiger build fix.
+
+ * kjs/grammar.y: Use @1 and @0 in place of @$ where Tiger's bison chokes.
+
+2007-12-10 Darin Adler <darin@apple.com>
+
+ Reviewed by Mark Rowe.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=16375
+ REGRESSION: Safari crashes on quit
+
+ Probably a debug-only issue.
+
+ * kjs/Parser.cpp:
+ (KJS::parser): Create the parser and never destroy it by using a pointer instead
+ of a global object.
+
+2007-12-09 Darin Adler <darin@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=16369
+ REGRESSION (r28525): regular expression tests failing due to bad firstByte optimization
+
+ * pcre/pcre_compile.cpp: Changed some names to use interCaps intead of under_scores.
+ (branchIsAnchored): Broke is_anchored into two separate functions; this one works on a
+ branch and the other on an anchor. The old function would only work on a bracket.
+ Also removed unneeded parameters; the anchored check does not require the bracket
+ map or the options any more because we have a reduced set of features.
+ (bracketIsAnchored): Ditto.
+ (branchNeedsLineStart): Broke canApplyFirstCharOptimization into two functions and gave
+ both a better name. This is the function that was returning the wrong value. The failure
+ was beacuse the old function would only work on a bracket.
+ (bracketNeedsLineStart): Ditto.
+ (jsRegExpCompile): Changed to call the appropriate branch or bracket flavor of the
+ functions based on whether we compiled an outer bracket. Also removed inaccurate comments
+ and unneeded parameters.
+
+ - other small changes
+
+ * pcre/pcre.h: Renumbered error codes, in a logical order. First, normal failure, then
+ the recursion limit, then running out of memory, and finally an unexpected internal error.
+
+ * pcre/pcre_exec.cpp: Fixed indentation.
+ (jsRegExpExecute): Corrected an inaccurate comment.
+
+2007-12-09 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=16370
+ REGRESSION (r28540): source URL and line number no longer set for outer function/programs
+
+ Test: fast/js/exception-linenums-in-html-1.html
+ Test: fast/js/exception-linenums-in-html-2.html
+ Test: fast/js/exception-linenums.html
+
+ By the time the ProgramNode was constructed, the source URL was empty.
+
+ * kjs/Parser.cpp:
+ (KJS::Parser::parseProgram): Added code to set and clear m_sourceURL, which is now
+ handled here instead of in the lexer; it needs to still be set when we create the
+ program node. Call setLoc to set the first and last line number.
+ (KJS::Parser::parseFunctionBody): Ditto, but for the body.
+ (KJS::Parser::parse): Removed the sourceURL argument.
+
+ * kjs/Parser.h: Added sourceURL(), m_sourceURL, and m_lastLine. Added a lastLine
+ parameter to didFinishParsing, since the bison grammar knows the last line number
+ and we otherwise do not know it. Removed the sourceURL parameter from parse, since
+ that's now handled at a higher level.
+
+ * kjs/grammar.y: Pass the last line number to didFinishParsing.
+
+ * kjs/lexer.cpp:
+ (KJS::Lexer::setCode): Removed the sourceURL argument and the code to set m_sourceURL.
+ (KJS::Lexer::clear): Ditto.
+ * kjs/lexer.h: More of the same.
+
+ * kjs/nodes.cpp:
+ (KJS::FunctionBodyNode::FunctionBodyNode): Get the source URL from the parser rather
+ than from the lexer. Removed unneeded call to setLoc, since the line numbers already
+ both default to -1.
+
+2007-12-08 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Sam W.
+
+ Split the ENABLE_SVG_EXPERIMENTAL_FEATURES flag into separate flags.
+
+ Fixes <rdar://problem/5620249> Must disable SVG animation
+ <rdar://problem/5612772> Disable SVG filters on Mac to match Windows behavior
+
+ Minor config changes.
+
+ * Configurations/JavaScriptCore.xcconfig:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2007-12-07 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Darin.
+
+ - Rename isSafeScript to allowsAccessFrom.
+
+ * bindings/NP_jsobject.cpp:
+ (_isSafeScript):
+ * kjs/JSGlobalObject.h:
+ (KJS::JSGlobalObject::allowsAccessFrom): Reverse caller/argument of allowsAccessFrom to match
+ the new call.
+
+2007-12-07 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Refactored variable access optimization: Removed the assumption that
+ the FunctionBodyNode holds the symbol table.
+
+2007-12-07 Geoffrey Garen <ggaren@apple.com>
+
+ Build fix: added #include.
+
+ * kjs/nodes.cpp:
+
+2007-12-07 Geoffrey Garen <ggaren@apple.com>
+
+ Build fix: added #include.
+
+ * kjs/interpreter.cpp:
+
+2007-12-07 Geoffrey Garen <ggaren@apple.com>
+
+ Build fix: added #include.
+
+ * kjs/grammar.y:
+
+2007-12-07 Geoffrey Garen <ggaren@apple.com>
+
+ Build fix: added #include.
+
+ * kjs/function_object.cpp:
+
+2007-12-07 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Fixed crash seen running layout tests.
+
+ Reverted a change I made earlier today. Added a comment to try to
+ discourage myself from making this mistake a third time.
+
+ * kjs/function.cpp:
+ (KJS::ActivationImp::mark):
+ * kjs/function.h:
+ (KJS::ActivationImp::ActivationImpData::ActivationImpData):
+
+2007-12-07 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Refactored parsing of global code: Removed the assumption that
+ ProgramNode inherits from FunctionBodyNode from the parser.
+
+ * kjs/Parser.cpp:
+ (KJS::Parser::parseProgram):
+ (KJS::Parser::parseFunctionBody):
+ (KJS::Parser::parse):
+ * kjs/Parser.h:
+ (KJS::Parser::didFinishParsing):
+ * kjs/function.cpp:
+ * kjs/grammar.y:
+ * kjs/nodes.h:
+
+2007-12-07 Geoffrey Garen <ggaren@apple.com>
+
+ Build fix: added JSVariableObject.cpp to the .pri file.
+
+ * JavaScriptCore.pri:
+
+2007-12-07 Geoffrey Garen <ggaren@apple.com>
+
+ Build fix: added #include.
+
+ * kjs/function.cpp:
+
+2007-12-07 Steve Falkenburg <sfalken@apple.com>
+
+ Re-named our B&I flag from BUILDBOT to PRODUCTION.
+
+ Reviewed by Sam Weinig.
+
+ * JavaScriptCore.vcproj/JavaScriptCore.make:
+ * JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
+
+2007-12-07 Geoffrey Garen <ggaren@apple.com>
+
+ Build fix: removed stray name qualification.
+
+ * kjs/function.h:
+ (KJS::ActivationImp::ActivationImp):
+
+2007-12-07 Geoffrey Garen <ggaren@apple.com>
+
+ Build fix: moved functions with qualified names outside of class
+ declaration.
+
+ * kjs/JSVariableObject.h:
+ (KJS::JSVariableObject::symbolTableGet):
+ (KJS::JSVariableObject::symbolTablePut):
+
+2007-12-07 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Next step in refactoring JSGlobalObject: Added JSVariableObject class,
+ and factored symbol-table-related code into it. (JSGlobalObject doesn't
+ use the symbol table code yet, though.)
+
+ Layout and JS tests, and testapi, pass. SunSpider reports no regression.
+
+2007-12-07 Darin Adler <darin@apple.com>
+
+ Reviewed by Geoff.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=16185
+ jsRegExpCompile should not add implicit non-capturing bracket
+
+ While this does not make SunSpider faster, it will make many regular
+ expressions a bit faster.
+
+ * pcre/pcre_compile.cpp: Moved CompileData struct in here from the
+ header since it's private to this file.
+ (compile_branch): Updated for function name change.
+ (compile_bracket): Renamed from compile_regex, since, for one thing,
+ this does not compile an entire regular expression.
+ (calculateCompiledPatternLengthAndFlags): Removed unused item_count
+ local variable. Renamed CompileData to cd instead of compile_block
+ to be consistent with other functions. Added code to set the
+ needOuterBracket flag if there's at least one "|" at the outer level.
+ (jsRegExpCompile): Renamed CompileData to cd instead of compile_block
+ to be consistent with other functions. Removed unneeded "size" field
+ from the compiled regular expression. If no outer bracket is needed,
+ then use compile_branch to compile the regular expression.
+
+ * pcre/pcre_internal.h: Removed the CompileData struct, which is now
+ private to pcre_compile.cpp. Removed the size member from JSRegExp.
+
+2007-12-06 Kevin Ollivier <kevino@theolliviers.com>
+
+ MSVC7 build fix due to a compiler bug with placement new and/or
+ templates and casting.
+
+ Reviewed by Darin Adler.
+
+ * wtf/Vector.h:
+ (WTF::::append):
+
+2007-12-06 Darin Adler <darin@apple.com>
+
+ Reviewed by Eric Seidel.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=16321
+ new RegExp("[\u0097]{4,6}", "gmy") crashes in DEBUG builds
+ <rdar://problem/5632992>
+
+ Test: fast/js/regexp-oveflow.html
+
+ * pcre/pcre_compile.cpp:
+ (calculateCompiledPatternLengthAndFlags): In the case where a single character
+ character class is optimized to not use a character class at all, the preflight
+ code was not setting the lastitemlength variable.
+
+2007-12-05 Mark Rowe <mrowe@apple.com>
+
+ Qt Windows build fix. Include the time-related headers in the correct place.
+
+ * kjs/JSGlobalObject.cpp:
+ * kjs/interpreter.cpp:
+
+2007-12-05 Darin Adler <darin@apple.com>
+
+ Not reviewed; just undoing a previous commit.
+
+ - remove earlier incorrect fix for http://bugs.webkit.org/show_bug.cgi?id=16220
+ <rdar://problem/5625221> Crash opening www.news.com (CNet)
+
+ The real bug was the backwards ?: in the compile function, which Geoff just
+ fixed. Rolling out the incorrect earlier fix.
+
+ * pcre/pcre_compile.cpp: (calculateCompiledPatternLengthAndFlags): Take out
+ the unneeded preflight change. The regression test proves this is still working
+ fine, so the bug remains fixed.
+
+2007-12-01 Mark Rowe <mrowe@apple.com>
+
+ Build fix. Include headers before trying to use the things that they declare.
+
+ * kjs/JSImmediate.cpp:
+ * kjs/nodes.cpp:
+ * kjs/object.cpp:
+ * kjs/object_object.cpp:
+ * kjs/regexp_object.cpp:
+ * kjs/string_object.cpp:
+
+2007-12-05 Geoffrey Garen <ggaren@apple.com>
+
+ Build fix: added some #includes.
+
+ * kjs/JSImmediate.cpp:
+
+2007-12-05 Geoffrey Garen <ggaren@apple.com>
+
+ Build fix: added some #includes.
+
+ * kjs/JSGlobalObject.cpp:
+ * kjs/JSImmediate.cpp:
+
+2007-12-05 Geoffrey Garen <ggaren@apple.com>
+
+ Build fix: Fixed #include spelling.
+
+ * kjs/debugger.cpp:
+
+2007-12-05 Geoffrey Garen <ggaren@apple.com>
+
+ Build fix: added #include.
+
+ * kjs/debugger.cpp:
+
+2007-12-05 Geoffrey Garen <ggaren@apple.com>
+
+ Build fix: added a forward declaration.
+
+ * kjs/debugger.h:
+
+2007-12-05 Geoffrey Garen <ggaren@apple.com>
+
+ Build fix: added an #include.
+
+ * kjs/error_object.cpp:
+
+2007-12-05 Geoffrey Garen <ggaren@apple.com>
+
+ Build fix: added an #include.
+
+ * kjs/bool_object.cpp:
+
+2007-12-05 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Third step in refactoring JSGlobalObject: Moved data members and
+ functions accessing data members from Interpreter to JSGlobalObject.
+ Changed Interpreter member functions to static functions.
+
+ This resolves a bug in global object bootstrapping, where the global
+ ExecState could be used when uninitialized.
+
+ This is a big change, but it's mostly code motion and renaming.
+
+ Layout and JS tests, and testjsglue and testapi, pass. SunSpider reports
+ a .7% regression, but Shark sees no difference related to this patch,
+ and SunSpider reported a .7% speedup from an earlier step in this
+ refactoring, so I think it's fair to call that a wash.
+
+2007-12-05 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler. (Or vice versa.)
+
+ Fixed ASSERT during run-javascriptcore-tests. (Darin just added the
+ ASSERT, but the bug wasn't new.)
+
+ * pcre/pcre_compile.cpp:
+ (compile_branch): The ?: operator here was backwards, causing us to
+ execute the loop too many times, adding stray KET opcodes to the
+ compiled regular expression.
+
+2007-12-05 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Geoff.
+
+ - Wait until local variable data is fully constructed before notifying the debugger of entering
+ or leaving a call frame.
+
+ * kjs/function.cpp:
+ (KJS::FunctionImp::callAsFunction):
+ * kjs/nodes.cpp:
+ (KJS::FunctionBodyNode::execute):
+
+2007-12-05 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Oliver.
+
+ Build fix for GCC 4.2. Cast via a union to avoid strict-aliasing issues.
+
+ * wtf/FastMalloc.cpp:
+ (WTF::):
+ (WTF::getPageHeap):
+
+2007-12-05 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Darin.
+
+ Fix testkjs in 64-bit.
+
+ When built for 64-bit the TCMalloc spin lock uses pthread mutexes rather than a custom spin lock
+ implemented in assembly. If we fail to initialize the pthread mutex, attempts to lock or unlock
+ it will fail and trigger a call to abort.
+
+ * wtf/FastMalloc.cpp: Initialize the spin lock so that we can later lock and unlock it.
+ * wtf/TCSpinLock.h: Add an Init method to the optimised spin lock.
+
+2007-12-04 Oliver Hunt <oliver@apple.com>
+
+ Fix gtk build.
+
+ * wtf/TCSystemAlloc.cpp:
+
+2007-12-03 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Mark Rowe and Geoff Garen.
+
+ Merge TCMalloc r38
+
+ It also result in a performance progression between 0.5% and
+ 0.9% depending on the test, however most if not all of this
+ gain will be consumed by the overhead involved in the later
+ change to release memory to the system.
+
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * wtf/FastMalloc.cpp:
+ (WTF::KernelSupportsTLS):
+ (WTF::CheckIfKernelSupportsTLS):
+ (WTF::):
+ (WTF::ClassIndex):
+ (WTF::SLL_Next):
+ (WTF::SLL_SetNext):
+ (WTF::SLL_Push):
+ (WTF::SLL_Pop):
+ (WTF::SLL_PopRange):
+ (WTF::SLL_PushRange):
+ (WTF::SLL_Size):
+ (WTF::SizeClass):
+ (WTF::ByteSizeForClass):
+ (WTF::NumMoveSize):
+ (WTF::InitSizeClasses):
+ (WTF::AllocationSize):
+ (WTF::TCMalloc_PageHeap::GetSizeClassIfCached):
+ (WTF::TCMalloc_PageHeap::CacheSizeClass):
+ (WTF::TCMalloc_PageHeap::init):
+ (WTF::TCMalloc_PageHeap::New):
+ (WTF::TCMalloc_PageHeap::AllocLarge):
+ (WTF::TCMalloc_PageHeap::Carve):
+ (WTF::TCMalloc_PageHeap::Delete):
+ (WTF::TCMalloc_PageHeap::IncrementalScavenge):
+ (WTF::PagesToMB):
+ (WTF::TCMalloc_PageHeap::Dump):
+ (WTF::TCMalloc_PageHeap::GrowHeap):
+ (WTF::TCMalloc_PageHeap::Check):
+ (WTF::ReleaseFreeList):
+ (WTF::TCMalloc_PageHeap::ReleaseFreePages):
+ (WTF::TCMalloc_ThreadCache_FreeList::Push):
+ (WTF::TCMalloc_ThreadCache_FreeList::PushRange):
+ (WTF::TCMalloc_ThreadCache_FreeList::PopRange):
+ (WTF::TCMalloc_ThreadCache_FreeList::Pop):
+ (WTF::TCMalloc_Central_FreeList::length):
+ (WTF::TCMalloc_Central_FreeList::tc_length):
+ (WTF::TCMalloc_Central_FreeList::Init):
+ (WTF::TCMalloc_Central_FreeList::ReleaseListToSpans):
+ (WTF::TCMalloc_Central_FreeList::EvictRandomSizeClass):
+ (WTF::TCMalloc_Central_FreeList::MakeCacheSpace):
+ (WTF::TCMalloc_Central_FreeList::ShrinkCache):
+ (WTF::TCMalloc_Central_FreeList::InsertRange):
+ (WTF::TCMalloc_Central_FreeList::RemoveRange):
+ (WTF::TCMalloc_Central_FreeList::FetchFromSpansSafe):
+ (WTF::TCMalloc_Central_FreeList::Populate):
+ (WTF::TCMalloc_ThreadCache::Init):
+ (WTF::TCMalloc_ThreadCache::Cleanup):
+ (WTF::TCMalloc_ThreadCache::Allocate):
+ (WTF::TCMalloc_ThreadCache::Deallocate):
+ (WTF::TCMalloc_ThreadCache::FetchFromCentralCache):
+ (WTF::TCMalloc_ThreadCache::ReleaseToCentralCache):
+ (WTF::TCMalloc_ThreadCache::Scavenge):
+ (WTF::TCMalloc_ThreadCache::PickNextSample):
+ (WTF::TCMalloc_ThreadCache::NewHeap):
+ (WTF::TCMalloc_ThreadCache::GetThreadHeap):
+ (WTF::TCMalloc_ThreadCache::GetCache):
+ (WTF::TCMalloc_ThreadCache::GetCacheIfPresent):
+ (WTF::TCMalloc_ThreadCache::InitTSD):
+ (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary):
+ (WTF::TCMallocStats::ExtractStats):
+ (WTF::TCMallocStats::DumpStats):
+ (WTF::TCMallocStats::DumpStackTraces):
+ (WTF::TCMallocStats::TCMallocImplementation::MarkThreadIdle):
+ (WTF::TCMallocStats::TCMallocImplementation::ReleaseFreeMemory):
+ (WTF::TCMallocStats::TCMallocGuard::TCMallocGuard):
+ (WTF::TCMallocStats::TCMallocGuard::~TCMallocGuard):
+ (WTF::TCMallocStats::DoSampledAllocation):
+ (WTF::TCMallocStats::CheckCachedSizeClass):
+ (WTF::TCMallocStats::CheckedMallocResult):
+ (WTF::TCMallocStats::SpanToMallocResult):
+ (WTF::TCMallocStats::do_malloc):
+ (WTF::TCMallocStats::do_free):
+ (WTF::TCMallocStats::do_memalign):
+ (WTF::TCMallocStats::do_malloc_stats):
+ (WTF::TCMallocStats::do_mallopt):
+ (WTF::TCMallocStats::do_mallinfo):
+ (WTF::TCMallocStats::realloc):
+ (WTF::TCMallocStats::cpp_alloc):
+ (WTF::TCMallocStats::operator new):
+ (WTF::TCMallocStats::):
+ (WTF::TCMallocStats::operator new[]):
+ (WTF::TCMallocStats::malloc_stats):
+ (WTF::TCMallocStats::mallopt):
+ (WTF::TCMallocStats::mallinfo):
+ * wtf/TCPackedCache.h: Added.
+ (PackedCache::PackedCache):
+ (PackedCache::Put):
+ (PackedCache::Has):
+ (PackedCache::GetOrDefault):
+ (PackedCache::Clear):
+ (PackedCache::EntryToValue):
+ (PackedCache::EntryToUpper):
+ (PackedCache::KeyToUpper):
+ (PackedCache::UpperToPartialKey):
+ (PackedCache::Hash):
+ (PackedCache::KeyMatch):
+ * wtf/TCPageMap.h:
+ (TCMalloc_PageMap2::PreallocateMoreMemory):
+ * wtf/TCSystemAlloc.cpp:
+ (TCMalloc_SystemRelease):
+ * wtf/TCSystemAlloc.h:
+
+2007-12-04 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Sam.
+
+ Make isSafeScript const.
+
+ * kjs/JSGlobalObject.h:
+ (KJS::JSGlobalObject::isSafeScript):
+
+2007-12-04 Darin Adler <darin@apple.com>
+
+ Reviewed by Geoff.
+
+ - fix first part of http://bugs.webkit.org/show_bug.cgi?id=16220
+ <rdar://problem/5625221> Crash opening www.news.com (CNet)
+
+ Test: fast/js/regexp-overflow.html
+
+ * pcre/pcre_compile.cpp:
+ (calculateCompiledPatternLengthAndFlags): Add room for the additional BRA/KET that
+ was generated in the compile code but not taken into account here.
+
+2007-12-03 Darin Adler <darin@apple.com>
+
+ Reviewed by Geoff.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=15618
+ <rdar://problem/5619353> REGRESSION: Stack overflow/crash in KJS::equal (15618)
+
+ Test: fast/js/recursion-limit-equal.html
+
+ * kjs/operations.cpp: (KJS::equal): Check the exception from toPrimitive.
+
+2007-12-03 Dan Bernstein <mitz@apple.com>
+
+ - fix a copy-and-paste-o
+
+ * bindings/npruntime.cpp:
+ (_NPN_GetIntIdentifier):
+
+2007-12-03 Dan Bernstein <mitz@apple.com>
+
+ Reviewed by Darin Adler.
+
+ - fix an ASSERT when getIntIdentifier is called with 0 or -1
+
+ * bindings/npruntime.cpp:
+ (_NPN_GetIntIdentifier): We cannot use the hashmap for 0 and -1 since
+ they are the empty value and the deleted value. Instead, keep the
+ identifiers for those two integers in a static array.
+
+2007-12-02 Darin Adler <darin@apple.com>
+
+ Reviewed by Mitz.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=15848
+ <rdar://problem/5619330> REGRESSION: Assertion failure viewing comments page on digg.com
+
+ Test: fast/js/sparse-array.html
+
+ * kjs/array_instance.cpp:
+ (KJS::ArrayInstance::inlineGetOwnPropertySlot): Check sparse array cutoff before looking
+ in hash map. Can't avoid the branch because we can't look for 0 in the hash.
+ (KJS::ArrayInstance::deleteProperty): Ditto.
+
+2007-12-02 Geoffrey Garen <ggaren@apple.com>
+
+ Build fix: added an #include.
+
+ * kjs/collector.cpp:
+
+2007-12-02 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Eric Seidel.
+
+ Second step in refactoring JSGlobalObject: moved virtual functions from
+ Interpreter to JSGlobalObject.
+
+ Layout and JS tests pass. SunSpider reports a .7% speedup -- don't
+ believe his lies.
+
+2007-12-01 Alp Toker <alp@atoker.com>
+
+ Reviewed by Adam Roben.
+
+ http://bugs.webkit.org/show_bug.cgi?id=16228
+ kJSClassDefinitionEmpty is not exported with JS_EXPORT
+
+ Add JS_EXPORT to kJSClassDefinitionEmpty.
+
+ Make the gcc compiler check take precedence over the WIN32||_WIN32
+ check to ensure that symbols are exported on Windows when using gcc.
+
+ Add a TODO referencing the bug about JS_EXPORT in the Win build
+ (http://bugs.webkit.org/show_bug.cgi?id=16227)
+
+ Don't define JS_EXPORT as 'extern' when the compiler is unknown since
+ it would result in the incorrect expansion:
+
+ extern extern const JSClassDefinition kJSClassDefinitionEmpty;
+
+ (This was something we inherited from CFBase.h that doesn't make sense
+ for JSBase.h)
+
+ * API/JSBase.h:
+ * API/JSObjectRef.h:
+
+2007-11-30 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Beth Dakin.
+
+ Reversed the ownership relationship between Interpreter and JSGlobalObject.
+ Now, the JSGlobalObject owns the Interpreter, and top-level objects
+ that need the two to persist just protect the JSGlobalObject from GC.
+
+ Global object bootstrapping looks a little odd right now, but it will
+ make much more sense soon, after further rounds of refactoring.
+
+ * bindings/runtime_root.h: Made this class inherit from RefCounted,
+ to avoid code duplication.
+
+ * kjs/collector.cpp:
+ (KJS::Collector::collect): No need to give special GC treatment to
+ Interpreters, since we mark their global objects, which mark them.
+
+ * kjs/interpreter.cpp:
+ (KJS::Interpreter::mark): No need to mark our global object, since it
+ marks us.
+ * kjs/interpreter.h: Don't inherit from RefCounted -- JSGlobalObject
+ owns us directly.
+
+ * kjs/testkjs.cpp: Modified to follow the new rules.
+ (createGlobalObject):
+ (runWithScripts):
+
+2007-11-30 Brent Fulgham <bfulgham@gmail.com>
+
+ Reviewed by Eric.
+
+ * ChangeLog:
+ * pcre/pcre_compile.cpp:
+ (compile_branch):
+
+2007-11-30 Eric Seidel <eric@webkit.org>
+
+ No review, build fix only.
+
+ Fix uninitialized var warnings in release build.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * pcre/pcre_compile.cpp:
+ (compile_regex):
+
+2007-11-30 Darin Adler <darin@apple.com>
+
+ Reviewed by Adam Roben.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=16207
+ JavaScript regular expressions should match UTF-16 code units rather than characters
+
+ SunSpider says this is 5.5% faster on the regexp test, 0.4% faste overall.
+
+ Test: fast/js/regexp-non-bmp.html
+
+ Renamed ANY_CHAR to NOT_NEWLINE to more-accurately reflect its meaning.
+
+ * pcre/pcre_compile.cpp:
+ (compile_branch): Removed calls to the UTF-16 character accessor functions, replacing
+ them with simple pointer dereferences in some cases, and no code at all in others.
+ (calculateCompiledPatternLengthAndFlags): Ditto.
+
+ * pcre/pcre_exec.cpp:
+ (match): Fixed indentation of some case labels (including all the BEGIN_OPCODE).
+ Removed calls to the UTF-16 character accessor functions, replacing them with simple
+ pointer dereferences in some cases, and no code at all in others. Also removed some
+ explicit UTF-16 support code in a few cases. Removed the unneeded "UTF-8" code path
+ in the ANY_CHAR repeat code, and in another case, eliminated the code to check against
+ end_subject in because it is already done outside the loop.
+ (jsRegExpExecute):
+
+ * pcre/pcre_internal.h: Removed all the UTF-16 helper functions.
+
+2007-11-30 Eric Seidel <eric@webkit.org>
+
+ Reviewed by darin.
+
+ PCRE crashes under GuardMalloc
+ http://bugs.webkit.org/show_bug.cgi?id=16127
+ check against patternEnd to make sure we don't walk off the end of the string
+
+ * pcre/pcre_compile.cpp:
+ (compile_branch):
+ (calculateCompiledPatternLengthAndFlags):
+
+2007-11-30 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Maciej.
+
+ Fix layout test regressions caused by r28186
+ http://bugs.webkit.org/show_bug.cgi?id=16195
+ change first_byte and req_byte back to shorts instead of chars
+ (I think PCRE stuffs information in the high bits)
+
+ * pcre/pcre_internal.h:
+
+2007-11-29 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej and Darin.
+
+ Make the JS collector work with multiple threads
+
+ Under heavy contention it was possible the GC to suspend other
+ threads inside the pthread spinlock, which could lead to the GC
+ thread blocking on the pthread spinlock itself.
+
+ We now determine and store each thread's stack base when it is
+ registered, thus removing the need for any calls to pthread_get_stackaddr_np
+ that needed the pthread spinlock.
+
+ * kjs/collector.cpp:
+ (KJS::Collector::Thread::Thread):
+ (KJS::Collector::registerThread):
+ (KJS::Collector::markOtherThreadConservatively):
+
+2007-11-29 Adam Roben <aroben@apple.com>
+
+ Windows build fix
+
+ Removed some unreachable code (ironically, the code was some
+ ASSERT_NOT_REACHED()s).
+
+ * pcre/pcre_compile.cpp:
+ (compile_branch):
+ * pcre/pcre_exec.cpp:
+ (match):
+
+2007-11-29 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Mark Rowe.
+
+ Fix for --guard crash of fast/js/regexp-charclass-crash introduced by r28151.
+
+ * pcre/pcre_compile.cpp:
+ (is_anchored):
+
+2007-11-28 Mark Rowe <mrowe@apple.com>
+
+ Gtk build fix. Rubber-stamped by Eric.
+
+ * pcre/pcre_exec.cpp:
+ (match): Add braces around the body of the case statement to prevent
+ wanings about jumps across the initialization of a variable.
+
+2007-11-29 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Mark Rowe.
+
+ Attempt to fix non-mac builds after PCRE cleanup.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCoreSources.bkl:
+ * pcre/pcre.pri:
+
+2007-11-28 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Maciej.
+
+ Centralize code for subjectPtr adjustments using inlines, only ever check for a single
+ trailing surrogate (as UTF16 only allows one), possibly fix PCRE bugs involving char
+ classes and garbled UTF16 strings.
+
+ * pcre/pcre_exec.cpp:
+ (match):
+ (jsRegExpExecute):
+ * pcre/pcre_internal.h:
+ (getPreviousChar):
+ (movePtrToPreviousChar):
+ (movePtrToNextChar):
+ (movePtrToStartOfCurrentChar):
+
+2007-11-28 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Maciej.
+
+ change getChar* functions to return result and push 'c' into local scopes for clarity
+
+ * pcre/pcre_compile.cpp:
+ (compile_branch):
+ (calculateCompiledPatternLengthAndFlags):
+ * pcre/pcre_exec.cpp:
+ (match):
+ * pcre/pcre_internal.h:
+ (getChar):
+ (getCharAndAdvance):
+ (getCharAndLength):
+ (getCharAndAdvanceIfSurrogate):
+
+2007-11-28 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Sam.
+
+ Comment cleanup
+
+ * pcre/pcre_exec.cpp:
+ (match):
+
+2007-11-26 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Sam.
+
+ Further cleanups to calculateCompiledPatternLengthAndFlags
+
+ * pcre/pcre_compile.cpp:
+ (calculateCompiledPatternLengthAndFlags):
+ * pcre/pcre_internal.h:
+
+2007-11-26 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Sam.
+
+ Give consistent naming to the RegExp options/compile flags
+
+ * pcre/pcre_compile.cpp:
+ (compile_branch):
+ (is_anchored):
+ (find_firstassertedchar):
+ (printCompiledRegExp):
+ (jsRegExpCompile):
+ * pcre/pcre_exec.cpp:
+ (jsRegExpExecute):
+ * pcre/pcre_internal.h:
+
+2007-11-26 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Sam.
+
+ Pull first_byte and req_byte optimizations out into separate static funtions, SunSpider reported this as a win.
+
+ * pcre/pcre_exec.cpp:
+ (tryFirstByteOptimization):
+ (tryRequiredByteOptimization):
+ (jsRegExpExecute):
+ * pcre/pcre_internal.h:
+
+2007-11-26 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Maciej.
+
+ give PCRE_MULTILINE a better name: OptionMatchAcrossMultipleLines
+
+ * pcre/pcre_compile.cpp:
+ (compile_branch):
+ (is_anchored):
+ (printCompiledRegExp):
+ (jsRegExpCompile):
+ * pcre/pcre_exec.cpp:
+ (jsRegExpExecute):
+ * pcre/pcre_internal.h:
+
+2007-11-26 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Oliver.
+
+ Deprecate jsRegExpExecute's offset-vector fallback code
+
+ * pcre/pcre_exec.cpp:
+ (jsRegExpExecute):
+
+2007-11-26 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Maciej.
+
+ Make cur_is_word and prev_is_word locals, and change OP_ANY to OP_ANY_CHAR for clarity
+
+ * pcre/pcre_compile.cpp:
+ (find_fixedlength):
+ (compile_branch):
+ (canApplyFirstCharOptimization):
+ * pcre/pcre_exec.cpp:
+ (match):
+ * pcre/pcre_internal.h:
+
+2007-11-26 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Mitz & Maciej.
+
+ Change _NC operators to use _IGNORING_CASE for clarity
+
+ * pcre/pcre_compile.cpp:
+ (find_fixedlength):
+ (compile_branch):
+ (find_firstassertedchar):
+ * pcre/pcre_exec.cpp:
+ (match):
+ * pcre/pcre_internal.h:
+
+2007-11-26 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Mitz.
+
+ Remove branch from return
+
+ * pcre/pcre_compile.cpp:
+ (compile_branch):
+ * pcre/pcre_exec.cpp:
+ (match):
+
+2007-11-26 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Maciej.
+
+ Add repeatInformationFromInstructionOffset inline
+
+ * pcre/pcre_exec.cpp:
+ (repeatInformationFromInstructionOffset):
+ (match):
+
+2007-11-26 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Maciej.
+
+ Remove no longer used error code JSRegExpErrorMatchLimit
+
+ * kjs/regexp.cpp:
+ (KJS::RegExp::match):
+ * pcre/pcre.h:
+ * pcre/pcre_internal.h:
+
+2007-11-26 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Sam.
+
+ Make i locally scoped for better code clarity
+
+ * pcre/pcre_exec.cpp:
+ (match):
+
+2007-11-26 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Maciej.
+
+ Give subjectPtr and instructionPtr sane names, reduce size of MatchFrame for a 0.2% speedup.
+
+ * pcre/pcre_compile.cpp:
+ (compile_branch):
+ (calculateCompiledPatternLengthAndFlags):
+ * pcre/pcre_exec.cpp:
+ (match_ref):
+ (MatchStack::pushNewFrame):
+ (getUTF8CharAndIncrementLength):
+ (match):
+ * pcre/pcre_internal.h:
+ (getChar):
+ (getCharAndAdvance):
+ (getCharAndLength):
+ (getCharAndAdvanceIfSurrogate):
+ * pcre/pcre_xclass.cpp:
+ (getUTF8CharAndAdvancePointer):
+
+2007-11-26 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Sam.
+
+ Small speedup (0.7%) by simplifying canUseStackBufferForNextFrame() check
+
+ * pcre/pcre_exec.cpp:
+ (MatchStack::MatchStack):
+ (MatchStack::popCurrentFrame):
+
+2007-11-25 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Sam.
+
+ Lower MATCH_LIMIT_RECURSION to more sane levels to prevent hangs on run-javascriptcore-tests
+
+ * pcre/pcre_internal.h:
+
+2007-11-25 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Maciej.
+
+ Remove match_is_group variable for another 5% speedup
+
+ * pcre/pcre_compile.cpp:
+ * pcre/pcre_exec.cpp:
+ (startNewGroup):
+ (match):
+
+2007-11-28 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Sam.
+
+ Abstract frame variables into locals and args
+
+ * pcre/pcre_compile.cpp:
+ (compile_branch):
+ * pcre/pcre_exec.cpp:
+ (match):
+ * pcre/pcre_internal.h:
+
+2007-11-28 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Sam.
+
+ Section off MatchData arguments into args struct
+
+ * pcre/pcre_exec.cpp:
+ (MatchStack::pushNewFrame):
+ (match):
+
+2007-11-24 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Sam.
+
+ Remove redundant eptrblock struct
+
+ * pcre/pcre_exec.cpp:
+ (MatchStack::pushNewFrame):
+ (match):
+
+2007-11-24 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Maciej.
+
+ Remove redundant match_call_count and move recursion check out of super-hot code path
+ SunSpider says this is at least an 8% speedup for regexp.
+
+ * pcre/pcre_exec.cpp:
+ (MatchStack::MatchStack):
+ (MatchStack::pushNewFrame):
+ (MatchStack::popCurrentFrame):
+ (MatchStack::popAllFrames):
+ (match):
+ (jsRegExpExecute):
+ * pcre/pcre_internal.h:
+
+2007-11-24 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Sam.
+
+ Get rid of GETCHAR* macros, replacing them with better named inlines
+
+ * pcre/pcre_compile.cpp:
+ (compile_branch):
+ (calculateCompiledPatternLengthAndFlags):
+ * pcre/pcre_exec.cpp:
+ (match):
+ * pcre/pcre_internal.h:
+ (getCharAndAdvance):
+ (getCharAndLength):
+ (getCharAndAdvanceIfSurrogate):
+
+2007-11-24 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Sam.
+
+ Further cleanup GET/PUT inlines
+
+ * pcre/pcre_internal.h:
+ (putOpcodeValueAtOffset):
+ (getOpcodeValueAtOffset):
+ (putOpcodeValueAtOffsetAndAdvance):
+ (put2ByteOpcodeValueAtOffset):
+ (get2ByteOpcodeValueAtOffset):
+ (put2ByteOpcodeValueAtOffsetAndAdvance):
+
+2007-11-24 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Sam.
+
+ Give GET, PUT better names, and add (poor) moveOpcodePtrPastAnyAlternateBranches
+
+ * pcre/pcre_compile.cpp:
+ (firstSignificantOpCodeSkippingAssertions):
+ (find_fixedlength):
+ (complete_callout):
+ (compile_branch):
+ (compile_regex):
+ (is_anchored):
+ (canApplyFirstCharOptimization):
+ (find_firstassertedchar):
+ * pcre/pcre_exec.cpp:
+ (match):
+ * pcre/pcre_internal.h:
+ (putOpcodeValueAtOffset):
+ (getOpcodeValueAtOffset):
+ (putOpcodeValueAtOffsetAndAdvance):
+ (put2ByteOpcodeValueAtOffset):
+ (get2ByteOpcodeValueAtOffset):
+ (moveOpcodePtrPastAnyAlternateBranches):
+ * pcre/pcre_ucp_searchfuncs.cpp:
+ (_pcre_ucp_othercase):
+
+2007-11-24 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Sam.
+
+ Add inlines for toLowerCase, isWordChar, isSpaceChar for further regexp speedup
+
+ * pcre/pcre_compile.cpp:
+ (compile_branch):
+ (jsRegExpCompile):
+ * pcre/pcre_exec.cpp:
+ (match):
+ (jsRegExpExecute):
+ * pcre/pcre_internal.h:
+ (toLowerCase):
+ (flipCase):
+ (classBitmapForChar):
+ (charTypeForChar):
+ (isWordChar):
+ (isSpaceChar):
+ (CompileData::CompileData):
+ * pcre/pcre_xclass.cpp:
+ (_pcre_xclass):
+
+2007-11-24 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Sam.
+
+ cleanup _pcre_ucp_othercase
+
+ * pcre/pcre_ucp_searchfuncs.cpp:
+ (_pcre_ucp_othercase):
+
+2007-11-24 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Maciej.
+
+ Use better variable names for case ignoring options
+
+ * pcre/pcre_compile.cpp:
+ (compile_branch):
+ (find_firstassertedchar):
+ (printCompiledRegExp):
+ (jsRegExpCompile):
+ * pcre/pcre_exec.cpp:
+ (match_ref):
+ (match):
+ (jsRegExpExecute):
+ * pcre/pcre_internal.h:
+
+2007-11-24 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Sam.
+
+ split first_significant_code into two simpler functions
+
+ * pcre/pcre_compile.cpp:
+ (firstSignificantOpCode):
+ (firstSignificantOpCodeSkippingAssertions):
+ (is_anchored):
+ (canApplyFirstCharOptimization):
+ (find_firstassertedchar):
+
+2007-11-24 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Sam.
+
+ clean up is_counted_repeat
+
+ * pcre/pcre_compile.cpp:
+ (is_counted_repeat):
+
+2007-11-24 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Sam.
+
+ clean up check_escape
+
+ * pcre/pcre_compile.cpp:
+ (check_escape):
+
+2007-11-24 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Sam.
+
+ Reformat find_fixedlength
+
+ * pcre/pcre_compile.cpp:
+ (find_fixedlength):
+
+2007-11-24 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Sam.
+
+ reformat is_anchored
+
+ * pcre/pcre_compile.cpp:
+ (is_anchored):
+
+2007-11-24 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Maciej.
+
+ Remove unused function could_be_empty_branch
+
+ * pcre/pcre_compile.cpp:
+ (first_significant_code):
+ (find_fixedlength):
+ (compile_branch):
+ (canApplyFirstCharOptimization):
+
+2007-11-24 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Sam.
+
+ Pass around MatchData objects by reference
+
+ * pcre/pcre_exec.cpp:
+ (pchars):
+ (match_ref):
+ (match):
+ (jsRegExpExecute):
+
+2007-11-24 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Sam.
+
+ give PCRE_STARTLINE a better name and rename match_data to MatchData
+
+ * pcre/pcre_compile.cpp:
+ (compile_branch):
+ (canApplyFirstCharOptimization):
+ (find_firstassertedchar):
+ (printCompiledRegExp):
+ (jsRegExpCompile):
+ * pcre/pcre_exec.cpp:
+ (pchars):
+ (jsRegExpExecute):
+ * pcre/pcre_internal.h:
+
+2007-11-24 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Sam.
+
+ Clean up find_firstassertedchar
+
+ * pcre/pcre_compile.cpp:
+ (get_othercase_range):
+ (find_firstassertedchar):
+ (calculateCompiledPatternLengthAndFlags):
+
+2007-11-24 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Tim Hatcher.
+
+ Pass around CompileData& instead of CompileData*
+
+ * pcre/pcre_compile.cpp:
+ (compile_branch):
+ (jsRegExpCompile):
+
+2007-11-24 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Sam.
+
+ Clean up compile_branch, move _pcre_ord2utf8, and rename CompileData
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * pcre/pcre_compile.cpp:
+ (_pcre_ord2utf8):
+ (calculateCompiledPatternLengthAndFlags):
+ (jsRegExpCompile):
+ * pcre/pcre_internal.h:
+ * pcre/pcre_ord2utf8.cpp: Removed.
+
+2007-11-24 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Sam.
+
+ removing more macros
+
+ * pcre/pcre_compile.cpp:
+ (could_be_empty_branch):
+ (compile_branch):
+ (calculateCompiledPatternLengthAndFlags):
+ * pcre/pcre_exec.cpp:
+ (match):
+ (jsRegExpExecute):
+ * pcre/pcre_internal.h:
+ * pcre/pcre_xclass.cpp:
+
+2007-11-24 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Maciej.
+
+ clean up formating in compile_branch
+
+ * pcre/pcre_compile.cpp:
+ (compile_branch):
+
+2007-11-24 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Sam.
+
+ Fix spacing for read_repeat_counts
+
+ * pcre/pcre_compile.cpp:
+ (read_repeat_counts):
+
+2007-11-24 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Sam.
+
+ Get rid of PCRE custom char types
+
+ * pcre/pcre_compile.cpp:
+ (check_escape):
+ (complete_callout):
+ (compile_branch):
+ (compile_regex):
+ (calculateCompiledPatternLengthAndFlags):
+ (jsRegExpCompile):
+ * pcre/pcre_exec.cpp:
+ (match_ref):
+ (match):
+ (jsRegExpExecute):
+ * pcre/pcre_internal.h:
+
+2007-11-24 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Sam.
+
+ reformat get_othercase_range
+
+ * pcre/pcre_compile.cpp:
+ (get_othercase_range):
+
+2007-11-24 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Maciej.
+
+ Remove register keyword and more cleanup
+
+ * pcre/pcre_compile.cpp:
+ (find_fixedlength):
+ (compile_branch):
+ (is_anchored):
+ (is_startline):
+ (find_firstassertedchar):
+ (calculateCompiledPatternLengthAndFlags):
+ (jsRegExpCompile):
+ * pcre/pcre_exec.cpp:
+ (MatchStack::canUseStackBufferForNextFrame):
+ (MatchStack::allocateNextFrame):
+ (MatchStack::pushNewFrame):
+ (MatchStack::frameIsStackAllocated):
+ (MatchStack::popCurrentFrame):
+ (MatchStack::unrollAnyHeapAllocatedFrames):
+ (getUTF8CharAndIncrementLength):
+ (match):
+ (jsRegExpExecute):
+ * pcre/pcre_internal.h:
+ (PUT2INC):
+ (isLeadingSurrogate):
+ (isTrailingSurrogate):
+ (decodeSurrogatePair):
+ (getChar):
+ * pcre/pcre_ord2utf8.cpp:
+ (_pcre_ord2utf8):
+ * pcre/pcre_xclass.cpp:
+ (getUTF8CharAndAdvancePointer):
+ (_pcre_xclass):
+
+2007-11-24 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Maciej.
+
+ Clean up jsRegExpExecute
+
+ * pcre/pcre_compile.cpp:
+ (returnError):
+ (jsRegExpCompile):
+ * pcre/pcre_exec.cpp:
+ (jsRegExpExecute):
+ * pcre/pcre_internal.h:
+
+2007-11-29 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff.
+
+ Merging updated system alloc and spinlock code from r38 of TCMalloc.
+
+ This is needed as a precursor to the merge of TCMalloc proper.
+
+ * wtf/FastMalloc.cpp:
+ (WTF::TCMalloc_PageHeap::GrowHeap):
+ * wtf/TCSpinLock.h:
+ (TCMalloc_SpinLock::TCMalloc_SpinLock):
+ (TCMalloc_SpinLock::):
+ (TCMalloc_SpinLock::Lock):
+ (TCMalloc_SpinLock::Unlock):
+ (TCMalloc_SpinLock::IsHeld):
+ * wtf/TCSystemAlloc.cpp:
+ (TrySbrk):
+ (TryMmap):
+ (TryVirtualAlloc):
+ (TryDevMem):
+ (TCMalloc_SystemAlloc):
+ * wtf/TCSystemAlloc.h:
+
+2007-11-28 Brady Eidson <beidson@apple.com>
+
+ Reviewed by Geoff
+
+ Add copyKeysToVector utility, mirroring copyValuesToVector
+ Also change the copyValuesToVector implementation to be a little more attractive
+
+ * wtf/HashMap.h:
+ (WTF::copyKeysToVector):
+ (WTF::copyValuesToVector):
+
+2007-11-27 Alp Toker <alp@atoker.com>
+
+ Reviewed by Mark Rowe.
+
+ Add a list of public JavaScriptCore headers for installation.
+
+ This follows the convention used for the Qt and GTK+ header lists.
+
+ * headers.pri: Added.
+
+2007-11-27 Alp Toker <alp@atoker.com>
+
+ Prospective MSVC build fix.
+
+ Roll back dllexport/dllimport support for now.
+
+ * API/JSBase.h:
+
+2007-11-27 Alp Toker <alp@atoker.com>
+
+ Reviewed by Maciej.
+
+ http://bugs.webkit.org/show_bug.cgi?id=15569
+ [gtk] GTK JavaScriptCore needs to export symbols for JSC API and WTF
+
+ Introduce JS_EXPORT to mark symbols to be exported as public API.
+
+ Export all public symbols in the JavaScriptCore C API.
+
+ This matches conventions for exporting symbols set by the CF and CG
+ frameworks.
+
+ * API/JSBase.h:
+ * API/JSContextRef.h:
+ * API/JSObjectRef.h:
+ * API/JSStringRef.h:
+ * API/JSStringRefBSTR.h:
+ * API/JSStringRefCF.h:
+ * API/JSValueRef.h:
+
+2007-11-27 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Adam.
+
+ Make PropertyNameArray and ScopeChain COMEnumVariant friendly.
+
+ * kjs/PropertyNameArray.cpp:
+ (KJS::PropertyNameArray::swap):
+ Implement PropertyNameArray::swap.
+
+ * kjs/PropertyNameArray.h:
+ Add ValueType typedef. Replace PropertyNameArrayIterator with
+ PropertyNameArray::const_iterator.
+
+ * kjs/nodes.cpp:
+ (KJS::ForInNode::execute):
+ * kjs/scope_chain.cpp:
+ (KJS::ScopeChain::print):
+ Update for changes to PropertyNameArray.
+
+ * kjs/scope_chain.h:
+ Add const_iterator and ValueType typedef.
+
+2007-11-27 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Darin.
+
+ Add a ValueType typedef.
+
+ * wtf/Vector.h:
+
+2007-11-26 Darin Adler <darin@apple.com>
+
+ Reviewed by Mitz.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=16096
+ REGRESSION (r26653-r26699): Plaxo.com addressbook does not load in webkit nightlies
+
+ Test: fast/js/regexp-overflow.html
+
+ * pcre/pcre_compile.cpp: (calculateCompiledPatternLengthAndFlags):
+ Removed a stray "ptr++" that I added by accident when merging the
+ changes between PCRE 6.4 and 6.5.
+
+2007-11-26 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Kevin McCullough.
+
+ Fixed <rdar://problem/5597937> REGRESSION (r27126): Drosera does not
+ show variables (can't enumerate ActivationImp properties)
+
+ Implemented a custom ActivationImp::getPropertyNames, since
+ ActivationImp now uses a custom property storage mechanism for local
+ variables.
+
+ * kjs/function.cpp:
+ (KJS::ActivationImp::getPropertyNames):
+ * kjs/function.h:
+
+2007-11-26 Alp Toker <alp@atoker.com>
+
+ GTK+/Qt/Wx build fix for breakage introduced in r28039.
+
+ * ForwardingHeaders/JavaScriptCore/JSRetainPtr.h: Added.
+
+2007-11-24 Laszlo Gombos <laszlo.gombos@gmail.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Fix minor compiler warning (GCC 4.1.3)
+
+ * pcre/pcre_internal.h:
+ * pcre/pcre_ucp_searchfuncs.cpp:
+ (_pcre_ucp_othercase):
+
+2007-11-25 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Dan Bernstein.
+
+ Fix http://bugs.webkit.org/show_bug.cgi?id=16129
+ Bug 16129: REGRESSION (r27761-r27811): malloc error while visiting http://mysit.es (crashes release build)
+
+ * pcre/pcre_compile.cpp: Change errorcode to be passed by reference so that any error code is propagated
+ to our caller like they expect.
+
+2007-11-23 Kevin Ollivier <kevino@theolliviers.com>
+
+ MSVC7 build fix. (rand_s doesn't exist there)
+
+ Reviewed by Adam Roben.
+
+ * kjs/config.h:
+ * wtf/MathExtras.h:
+
+2007-11-23 Kevin Ollivier <kevino@theolliviers.com>
+
+ wx build fix. Move WX_PYTHON logic into project build settings,
+ add WebKitLibraries dirs on Win, and explicitly include JSCore
+ headers in testkjs rather than getting them from a template.
+ (Include dir order of JSCore/WTF and ICU headers is important due
+ to wtf/unicode/utf8.h.)
+
+ * jscore.bkl:
+
+2007-11-23 Simon Hausmann <hausmann@webkit.org>
+
+ Reviewed by George Staikos <staikos@kde.org>.
+
+ Fix make (dist)clean on Windows.
+
+ OBJECTS_DIR_WTR does not exist anymore, use GENERATED_SOURCES_DIR.
+
+
+ * JavaScriptCore.pri:
+ * pcre/pcre.pri:
+
+2007-11-22 Simon Hausmann <hausmann@kde.org>
+
+ Reviewed by George.
+
+ Make the directory of where to put the generated sources configurable through the GENERATED_SOURCE_DIR variable
+
+ * JavaScriptCore.pri:
+ * pcre/pcre.pri:
+
+2007-11-22 Simon Hausmann <hausmann@kde.org>
+
+ Reviewed by George.
+
+ Centralize the setup for all the extra compilers in a addExtraCompiler function.
+
+ This allows adding a "generated_files" target that builds all generated files using "make generated_files".
+ For the build inside Qt we do not generate actual rules for the extra compilers but instead
+ do the variable substitution of compiler.output manually and add the generated sources to SOURCES.
+
+ * JavaScriptCore.pri:
+ * pcre/pcre.pri:
+
+2007-11-20 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Tim Hatcher.
+
+ <rdar://problem/5602936> Need to resolve new GCC 4.2 warnings
+
+ Fix all warnings emitted by GCC 4.2 when building JavaScriptCore. This allows builds with
+ -Werror to succeed. At present they will crash when executed due to code that is not safe
+ under strict aliasing (<rdar://problem/5536806>).
+
+ * Configurations/Base.xcconfig: Remove the -Wno-long-double flag.
+ * kjs/date_object.cpp:
+ (KJS::formatTime): Test whether the stack-allocated string is empty rather than at a non-null address.
+ * kjs/dtoa.cpp:
+ (Bigint::): Tweak formatting to silence warnings.
+ * pcre/pcre_exec.cpp:
+ (match): Tweak formatting to silence warnings
+ * wtf/Assertions.cpp: Add printf format attribute to functions that warrant it.
+ * wtf/Assertions.h: Ditto.
+
+2007-11-19 Kevin Ollivier <kevino@theolliviers.com>
+
+ wx port build fix (wx headers include ctype functions).
+
+ * kjs/config.h:
+
+2007-11-19 Kevin Ollivier <kevino@theolliviers.com>
+
+ Remove outdated and unused Windows port files.
+
+ Reviewed by Adam Roben.
+
+ * Makefile.vc: Removed.
+ * README-Win32.txt: Removed.
+
+2007-11-18 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Oliver.
+
+ * tests/mozilla/jsDriver.pl: exit non-0 when user aborts test run
+
+2007-11-17 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Fix: <rdar://problem/5607032> REGRESSION: testapi exits with assertion failure in debug build
+ <rdar://problem/5440659> JSGlobalContextCreate throws away globalObjectClass's prototype
+ http://bugs.webkit.org/show_bug.cgi?id=16033
+
+ Split Interpreter's initialization into two distinct steps: the creation of the global prototypes
+ and constructors, and storing them on the global object. This allows JSClassRef's passed to
+ JSGlobalContextCreate to be instantiated with the correct prototype.
+
+ * API/JSCallbackObject.cpp: Assert at compile-time that the custom global object will fit in a collector cell.
+ * API/JSCallbackObject.h:
+ * API/JSCallbackObjectFunctions.h:
+ (KJS::::JSCallbackObject):
+ (KJS::::init):
+ * API/JSContextRef.cpp:
+ (JSGlobalContextCreate): Construct and set the interpreter's global object separately. When globalObjectClass
+ is passed we need to set the interpreter's global object before doing the JSCallbackObject's initialization to
+ prevent any JSObjectInitializeCallback's being invoked before a global object is set.
+ * API/testapi.c:
+ (globalObject_initialize): Test the object passed in is correct and that it has the expected global properties.
+ (globalObject_get):
+ (globalObject_set):
+ (main):
+ * API/testapi.js: Test that any static properties exposed by the global object's custom class are found.
+ * JavaScriptCore.exp:
+ * bindings/testbindings.cpp:
+ (main): Update for changes in Interpreter method signatures.
+ * bindings/testbindings.mm:
+ (main): Ditto.
+ * kjs/ExecState.cpp:
+ (KJS::ExecState::ExecState):
+ (KJS::ExecState::mark):
+ (KJS::ExecState::setGlobalObject):
+ * kjs/ExecState.h: Rename scope to m_scopeChain.
+ * kjs/interpreter.cpp:
+ (KJS::Interpreter::Interpreter):
+ (KJS::Interpreter::init):
+ (KJS::Interpreter::globalObject):
+ (KJS::Interpreter::setGlobalObject):
+ (KJS::Interpreter::resetGlobalObjectProperties):
+ (KJS::Interpreter::createObjectsForGlobalObjectProperties):
+ (KJS::Interpreter::setGlobalObjectProperties): Switch to using putDirect to ensure that the global object's put method
+ cannot interfere with setting of the global properties. This prevents a user-written JSClassRef from attempting to
+ call back into JavaScript from the initialization of the global object's members.
+ * kjs/interpreter.h:
+ * kjs/testkjs.cpp:
+ (setupInterpreter): Update for changes in Interpreter method signatures.
+
+2007-11-17 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Prevent testapi from reporting false leaks. Clear out local variables pointing at
+ JSObjectRefs to allow their values to be collected.
+
+ * API/testapi.c:
+ (main):
+
+2007-11-17 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Prevent testapi from crashing if testapi.js can not be found by nil-checking the result of createStringWithContentsOfFile.
+
+ * API/testapi.c:
+ (main):
+
+2007-11-17 Alp Toker <alp@atoker.com>
+
+ Reviewed by Eric.
+
+ http://bugs.webkit.org/show_bug.cgi?id=16032
+ JS minidom is not portable
+
+ Use a plain UTF-8 string instead of a CFString.
+
+ Print to stdout, not stderr like CFShow() would have done, since that
+ behaviour seems unintentional.
+
+ * API/minidom.c:
+ (main):
+
+2007-11-17 Steve Falkenburg <sfalken@apple.com>
+
+ Windows build fix.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+
+2007-11-16 Mark Rowe <mrowe@apple.com>
+
+ Windows build fix.
+
+ * kjs/lexer.cpp:
+ (KJS::Lexer::record8):
+
+2007-11-16 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Eric.
+
+ Replace strings, identifier, buffer8 and buffer16 members of Lexer with vectors.
+ SunSpider claims this is a 0.7% speedup.
+
+ * kjs/lexer.cpp:
+ (KJS::Lexer::Lexer):
+ (KJS::Lexer::lex):
+ (KJS::Lexer::record8):
+ (KJS::Lexer::record16):
+ (KJS::Lexer::scanRegExp):
+ (KJS::Lexer::clear):
+ (KJS::Lexer::makeIdentifier):
+ (KJS::Lexer::makeUString):
+ * kjs/lexer.h:
+ * kjs/ustring.cpp:
+ (KJS::UString::UString): Add a convenience constructor that takes a const Vector<UChar>&.
+ * kjs/ustring.h:
+
+2007-11-16 Adam Roben <aroben@apple.com>
+
+ Windows build fix
+
+ * JavaScriptCore.vcproj/testkjs/testkjs.vcproj: Add a new include path
+ and ignore the int -> bool conversion warning.
+
+2007-11-16 Alexey Proskuryakov <ap@webkit.org>
+
+ Fix Windows debug build.
+ Rubber-stamped by Eric
+
+ * pcre/pcre_exec.cpp: (match): Removed ASSERT_NOT_REACHED assertions that were making MSVC
+ complain about unreachable code.
+
+2007-11-15 Mark Rowe <mrowe@apple.com>
+
+ Gtk build fix.
+
+ * kjs/Parser.cpp:
+
+2007-11-15 Mark Rowe <mrowe@apple.com>
+
+ Mac build and header search path sanity fix.
+
+ Reviewed by Sam Weinig and Tim Hatcher.
+
+ Move base setting for HEADER_SEARCH_PATHS into Base.xcconfig, and extend
+ it in JavaScriptCore.xcconfig. This removes the need to override it on a
+ per-target basis inside the .xcodeproj file.
+
+ * Configurations/Base.xcconfig:
+ * Configurations/JavaScriptCore.xcconfig:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2007-11-15 Mark Rowe <mrowe@apple.com>
+
+ Qt build fix.
+
+ * kjs/Parser.h:
+
+2007-11-15 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Eric Seidel.
+
+ Another round of grammar / parsing cleanup.
+
+ 1. Created distinct parser calls for parsing function bodies vs
+ programs. This will help later with optimizing global variable access.
+
+ 2. Turned Parser into a singleton. Cleaned up Lexer's singleton
+ interface.
+
+ 3. Modified Lexer to free a little more memory when done lexing. (Added
+ FIXMEs for similar issues that I didn't fix.)
+
+ 4. Changed Lexer::makeIdentifier and Lexer::makeUString to start
+ respecting the arguments passed to them. (No behavior change, but this
+ problem could have caused serious problems for an unsuspecting user of
+ these functions.)
+
+ 5. Removed KJS_DEBUG_MEM because it was bit-rotted.
+
+ 6. Removed Parser::prettyPrint because the same work was simpler to do
+ at the call site.
+
+ 7. Some renames:
+
+ "Parser::accept" => "Parser::didFinishParsing"
+ "Parser::sid" => "Parser::m_sourceID"
+ "Lexer::doneParsing" => "Lexer::clear"
+ "sid" => "sourceId"
+ "lineno" => "lineNo"
+
+ * JavaScriptCore.exp:
+ * kjs/Parser.cpp:
+ (KJS::Parser::Parser):
+ (KJS::Parser::parseProgram):
+ (KJS::Parser::parseFunctionBody):
+ (KJS::Parser::parse):
+ (KJS::Parser::didFinishParsing):
+ (KJS::parser):
+ * kjs/Parser.h:
+ (KJS::Parser::sourceId):
+ * kjs/function.cpp:
+ (KJS::GlobalFuncImp::callAsFunction):
+ * kjs/function_object.cpp:
+ (FunctionObjectImp::construct):
+ * kjs/grammar.y:
+ * kjs/interpreter.cpp:
+ (KJS::Interpreter::checkSyntax):
+ (KJS::Interpreter::evaluate):
+ * kjs/interpreter.h:
+ * kjs/lexer.cpp:
+ (kjsyylex):
+ (KJS::lexer):
+ (KJS::Lexer::Lexer):
+ (KJS::Lexer::~Lexer):
+ (KJS::Lexer::scanRegExp):
+ (KJS::Lexer::doneParsing):
+ (KJS::Lexer::makeIdentifier):
+ (KJS::Lexer::makeUString):
+ * kjs/lexer.h:
+ (KJS::Lexer::pattern):
+ (KJS::Lexer::flags):
+ (KJS::Lexer::sawError):
+ * kjs/nodes.cpp:
+ (KJS::Node::Node):
+ (KJS::FunctionBodyNode::FunctionBodyNode):
+ * kjs/nodes.h:
+ * kjs/testkjs.cpp:
+ (prettyPrintScript):
+ (kjsmain):
+ * kjs/ustring.cpp:
+ * kjs/ustring.h:
+
+2007-11-15 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Darin.
+
+ <rdar://problem/5601548> REGRESSION: All SourceElements and their children leak after a syntax error
+
+ Add a stub node to maintain the Vector of SourceElements until assignment.
+
+ * kjs/grammar.y:
+ * kjs/nodes.h:
+ (KJS::SourceElementsStub::SourceElementsStub):
+ (KJS::SourceElementsStub::append):
+ (KJS::SourceElementsStub::release):
+ (KJS::SourceElementsStub::):
+ (KJS::SourceElementsStub::precedence):
+
+2007-11-15 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Sam.
+
+ Abstract most of RMATCH into MatchStack functions.
+
+ SunSpider claims this, combined with the last 2 patches was a 1% speedup, 10% for dna-regexp.
+
+ * pcre/pcre_exec.cpp:
+ (MatchStack::canUseStackBufferForNextFrame):
+ (MatchStack::allocateNextFrame):
+ (MatchStack::pushNewFrame):
+ (MatchStack::frameIsStackAllocated):
+ (MatchStack::popCurrentFrame):
+ (MatchStack::unrollAnyHeapAllocatedFrames):
+ (match):
+
+2007-11-15 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Sam.
+
+ Remove RETURN_ERROR, add MatchStack
+
+ * pcre/pcre_exec.cpp:
+ (MatchStack::MatchStack):
+ (MatchStack::unrollAnyHeapAllocatedFrames):
+ (matchError):
+ (match):
+
+2007-11-15 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Sam.
+
+ Clean up match function to match WebKit style
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * pcre/pcre_exec.cpp:
+ (match):
+
+2007-11-15 Steve Falkenburg <sfalken@apple.com>
+
+ Windows build fix.
+
+ * JavaScriptCore.vcproj/JavaScriptCore.make:
+
+2007-11-14 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Darin.
+
+ http://bugs.webkit.org/show_bug.cgi?id=15982
+ Improve JSString UTF-8 decoding
+
+ * API/JSStringRef.cpp:
+ (JSStringCreateWithUTF8CString): Use strict decoding, return 0 on error.
+
+ * wtf/unicode/UTF8.cpp:
+ (WTF::Unicode::convertUTF16ToUTF8):
+ (WTF::Unicode::convertUTF8ToUTF16):
+ * wtf/unicode/UTF8.h:
+ Made these function names start with a lower case letter.
+
+ * kjs/ustring.cpp: (KJS::UString::UTF8String): Updated for the above renaming.
+
+ * bindings/c/c_utility.cpp:
+ (KJS::Bindings::convertUTF8ToUTF16WithLatin1Fallback): Renamed to highlight the difference
+ from convertUTF8ToUTF16 in wtf/unicode.
+ (KJS::Bindings::convertNPStringToUTF16): Updated for the above renaming.
+ (KJS::Bindings::identifierFromNPIdentifier): Ditto.
+ * bindings/c/c_utility.h: Made convertUTF8ToUTF16WithLatin1Fallback() a file static.
+
+2007-11-14 Sam Weinig <sam@webkit.org>
+
+ Rubber-stamped by Anders.
+
+ Fix the Xcode project file after it was messed up in r27402.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2007-11-14 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Oliver.
+
+ More PCRE style cleanup.
+
+ * pcre/pcre_compile.cpp:
+ (compile_regex):
+
+2007-11-14 Adam Roben <aroben@apple.com>
+
+ Clean up the bison conflict checking script
+
+ Reviewed by Geoff.
+
+ * DerivedSources.make:
+
+2007-11-14 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Geoff.
+
+ Another round of PCRE cleanups: inlines
+
+ SunSpider claims that this, combined with my previous PCRE cleanup were a 0.7% speedup, go figure.
+
+ * pcre/pcre_compile.cpp:
+ (jsRegExpCompile):
+ * pcre/pcre_exec.cpp:
+ (match):
+ (jsRegExpExecute):
+ * pcre/pcre_internal.h:
+ (PUT):
+ (GET):
+ (PUT2):
+ (GET2):
+ (isNewline):
+
+2007-11-14 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Sam.
+
+ Give PCRE a (small) bath.
+ Fix some formating and break things off into separate functions
+ http://bugs.webkit.org/show_bug.cgi?id=15993
+
+ * pcre/pcre_compile.cpp:
+ (calculateCompiledPatternLengthAndFlags):
+ (printCompiledRegExp):
+ (returnError):
+ (jsRegExpCompile):
+ * pcre/pcre_internal.h:
+ (compile_data::compile_data):
+
+2007-11-14 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Eric Seidel.
+
+ Cleaned up the JavaScript grammar a bit.
+
+ 1. Changed BlockNode to always hold a child vector (which may be empty),
+ eliminating a few NULL-check branches in the common execution case.
+
+ 2. Changed the Block production to correctly report its starting and
+ ending line numbers to the debugger. (It used to report its ending line
+ as its starting line.) Also, removed duplicate line-reporting code
+ inside the BlockNode constructor.
+
+ 3. Moved curly braces up from FunctionBody production into parent
+ productions. (I had to move the line number reporting code, too, since
+ it depends on the location of the curly braces.) This matches the ECMA
+ spec more closely, and makes some future changes I plan easier.
+
+ 4. Fixed statementList* convenience functions to deal appropriately with
+ empty Vectors.
+
+ SunSpider reports a small and statistically insignificant speedup.
+
+ * kjs/grammar.y:
+ * kjs/nodes.cpp:
+ (KJS::statementListPushFIFO):
+ (KJS::statementListGetDeclarations):
+ (KJS::statementListInitializeDeclarationStack):
+ (KJS::statementListInitializeVariableAccessStack):
+ (KJS::BlockNode::BlockNode):
+ (KJS::BlockNode::optimizeVariableAccess):
+ (KJS::BlockNode::getDeclarations):
+ (KJS::BlockNode::execute):
+ (KJS::FunctionBodyNode::initializeDeclarationStacks):
+ (KJS::FunctionBodyNode::optimizeVariableAccess):
+
+2007-11-13 Anders Carlsson <andersca@apple.com>
+
+ Add RefCounted.h (And remove Shared.h)
+
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+
+2007-11-13 Geoffrey Garen <ggaren@apple.com>
+
+ Build fix.
+
+ * kjs/regexp.h:
+
+2007-11-13 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Anders Carlsson.
+
+ Renamed Shared to RefCounted.
+
+ * API/JSClassRef.h:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * kjs/interpreter.h:
+ * kjs/regexp.h:
+ * wtf/RefCounted.h: Copied from JavaScriptCore/wtf/Shared.h.
+ (WTF::RefCounted::RefCounted):
+ * wtf/Shared.h: Removed.
+
+2007-11-13 Adam Roben <aroben@apple.com>
+
+ Build fix
+
+ Reviewed by Geoff.
+
+ * kjs/regexp.h: Added a missing #include.
+
+2007-11-13 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Moved Shared.h into wtf so it could be used in more places. Deployed
+ Shared in places where JSCore previously had hand-rolled ref-counting
+ classes.
+
+ * API/JSClassRef.cpp:
+ (OpaqueJSClass::OpaqueJSClass):
+ * API/JSClassRef.h:
+ * API/JSObjectRef.cpp:
+ (JSClassRetain):
+ (JSClassRelease):
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * kjs/interpreter.cpp:
+ (KJS::Interpreter::init):
+ * kjs/interpreter.h:
+ * kjs/regexp.cpp:
+ (KJS::RegExp::RegExp):
+ * kjs/regexp.h:
+ * wtf/Shared.h: Copied from WebCore/platform/Shared.h.
+
+2007-11-13 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Maciej.
+
+ Add an ASSERT to getTruncatedInt32 to enforce proper usage.
+ Best part about this patch? It doesn't break the web!
+
+ * kjs/JSImmediate.h:
+ (KJS::JSImmediate::getTruncatedInt32):
+ (KJS::JSImmediate::toDouble):
+ (KJS::JSImmediate::getUInt32):
+
+2007-11-13 Alexey Proskuryakov <ap@webkit.org>
+
+ Windows build fix.
+
+ * bindings/c/c_utility.cpp:
+ (KJS::Bindings::convertUTF8ToUTF16):
+ * kjs/ustring.cpp:
+ (KJS::UString::UTF8String):
+ * wtf/unicode/UTF8.cpp:
+ (WTF::Unicode::ConvertUTF8ToUTF16):
+
+2007-11-13 Darin Adler <darin@apple.com>
+
+ Reviewed by Geoff.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=11231
+ RegExp bug when handling newline characters
+ and a number of other differences between PCRE behvior
+ and JavaScript regular expressions:
+
+ + single-digit sequences like \4 should be treated as octal
+ character constants, unless there is a sufficient number
+ of brackets for them to be treated as backreferences
+
+ + \8 turns into the character "8", not a binary zero character
+ followed by "8" (same for 9)
+
+ + only the first 3 digits should be considered part of an
+ octal character constant (the old behavior was to decode
+ an arbitrarily long sequence and then mask with 0xFF)
+
+ + if \x is followed by anything other than two valid hex digits,
+ then it should simply be treated a the letter "x"; that includes
+ not supporting the \x{41} syntax
+
+ + if \u is followed by anything less than four valid hex digits,
+ then it should simply be treated a the letter "u"
+
+ + an extra "+" should be a syntax error, rather than being treated
+ as the "possessive quantifier"
+
+ + if a "]" character appears immediately after a "[" character that
+ starts a character class, then that's an empty character class,
+ rather than being the start of a character class that includes a
+ "]" character
+
+ + a "$" should not match a terminating newline; we could have gotten
+ PCRE to handle this the way we wanted by passing an appropriate option
+
+ Test: fast/js/regexp-no-extensions.html
+
+ * pcre/pcre_compile.cpp:
+ (check_escape): Check backreferences against bracount to catch both
+ overflows and things that should be treated as octal. Rewrite octal
+ loop to not go on indefinitely. Rewrite both hex loops to match and
+ remove \x{} support.
+ (compile_branch): Restructure loops so that we don't special-case a "]"
+ at the beginning of a character class. Remove code that treated "+" as
+ the possessive quantifier.
+ (jsRegExpCompile): Change the "]" handling here too.
+
+ * pcre/pcre_exec.cpp: (match): Changed CIRC to match the DOLL implementation.
+ Changed DOLL to remove handling of "terminating newline", a Perl concept
+ which we don't need.
+
+ * tests/mozilla/expected.html: Two tests are fixed now:
+ ecma_3/RegExp/regress-100199.js and ecma_3/RegExp/regress-188206.js.
+ One test fails now: ecma_3/RegExp/perlstress-002.js -- our success before
+ was due to a bug (we treated all 1-character numeric escapes as backreferences).
+ The date tests also now both expect success -- whatever was making them fail
+ before was probably due to the time being close to a DST shift; maybe we need
+ to get rid of those tests.
+
+2007-11-13 Darin Adler <darin@apple.com>
+
+ * kjs/JSImmediate.h: (KJS::JSImmediate::getTruncatedInt32):
+ Remove too-strong assert that was firing constantly and preventing even basic
+ web browsing from working in a debug build. This function is used in many
+ cases where the immediate value is not a number; the assertion could perhaps
+ be added back later with a bit of reorganization.
+
+2007-11-13 Alp Toker <alp@atoker.com>
+
+ Build fix for breakage to non-Mac builds introduced in r27746.
+
+ * kjs/ustring.cpp:
+
+2007-11-13 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Maciej.
+
+ Clean up evaluateToBoolean functions to use inlines instead of copy/paste code
+
+ * kjs/JSImmediate.h:
+ * kjs/nodes.cpp:
+ (KJS::GreaterNode::inlineEvaluateToBoolean):
+ (KJS::GreaterNode::evaluate):
+ (KJS::LessEqNode::inlineEvaluateToBoolean):
+ (KJS::LessEqNode::evaluate):
+ (KJS::GreaterEqNode::inlineEvaluateToBoolean):
+ (KJS::GreaterEqNode::evaluate):
+ (KJS::InNode::evaluateToBoolean):
+ (KJS::EqualNode::inlineEvaluateToBoolean):
+ (KJS::EqualNode::evaluate):
+ (KJS::NotEqualNode::inlineEvaluateToBoolean):
+ (KJS::NotEqualNode::evaluate):
+ (KJS::StrictEqualNode::inlineEvaluateToBoolean):
+ (KJS::StrictEqualNode::evaluate):
+ (KJS::NotStrictEqualNode::inlineEvaluateToBoolean):
+ (KJS::NotStrictEqualNode::evaluate):
+ * kjs/nodes.h:
+
+2007-11-12 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Fixed http://bugs.webkit.org/show_bug.cgi?id=15958
+ base64 spends 1.1% of total time checking for special Infinity case
+
+ Use a fast character test instead of calling strncmp.
+
+ 1.1% speedup on string-base64. SunSpider reports a .4% speedup overall;
+ Sharks reports only .1%. Who are you going to believe? Huh?
+
+ * kjs/ustring.cpp:
+ (KJS::UString::toDouble):
+
+2007-11-12 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Oliver.
+
+ Add evaluateToInt32 and evaluateUInt32 methods and deploy them.
+ Fix a few missing evaluateToBoolean methods
+ Deploy all evaluateTo* functions to more nodes to avoid slowdowns
+ http://bugs.webkit.org/show_bug.cgi?id=15950
+
+ SunSpider claims this is at least a 1.4% speedup.
+
+ * kjs/JSImmediate.h:
+ (KJS::JSImmediate::getTruncatedInt32):
+ (KJS::JSImmediate::toDouble):
+ (KJS::JSImmediate::getUInt32):
+ * kjs/nodes.cpp:
+ (KJS::ExpressionNode::evaluateToNumber):
+ (KJS::ExpressionNode::evaluateToInt32):
+ (KJS::ExpressionNode::evaluateToUInt32):
+ (KJS::NumberNode::evaluateToInt32):
+ (KJS::NumberNode::evaluateToUInt32):
+ (KJS::ImmediateNumberNode::evaluateToInt32):
+ (KJS::ImmediateNumberNode::evaluateToUInt32):
+ (KJS::ResolveNode::evaluate):
+ (KJS::ResolveNode::evaluateToNumber):
+ (KJS::ResolveNode::evaluateToBoolean):
+ (KJS::ResolveNode::evaluateToInt32):
+ (KJS::ResolveNode::evaluateToUInt32):
+ (KJS::LocalVarAccessNode::evaluateToInt32):
+ (KJS::LocalVarAccessNode::evaluateToUInt32):
+ (KJS::BracketAccessorNode::evaluateToNumber):
+ (KJS::BracketAccessorNode::evaluateToBoolean):
+ (KJS::BracketAccessorNode::evaluateToInt32):
+ (KJS::BracketAccessorNode::evaluateToUInt32):
+ (KJS::DotAccessorNode::inlineEvaluate):
+ (KJS::DotAccessorNode::evaluate):
+ (KJS::DotAccessorNode::evaluateToNumber):
+ (KJS::DotAccessorNode::evaluateToBoolean):
+ (KJS::DotAccessorNode::evaluateToInt32):
+ (KJS::DotAccessorNode::evaluateToUInt32):
+ (KJS::NewExprNode::inlineEvaluate):
+ (KJS::NewExprNode::evaluate):
+ (KJS::NewExprNode::evaluateToNumber):
+ (KJS::NewExprNode::evaluateToBoolean):
+ (KJS::NewExprNode::evaluateToInt32):
+ (KJS::NewExprNode::evaluateToUInt32):
+ (KJS::FunctionCallResolveNode::inlineEvaluate):
+ (KJS::FunctionCallResolveNode::evaluate):
+ (KJS::FunctionCallResolveNode::evaluateToNumber):
+ (KJS::FunctionCallResolveNode::evaluateToBoolean):
+ (KJS::FunctionCallResolveNode::evaluateToInt32):
+ (KJS::FunctionCallResolveNode::evaluateToUInt32):
+ (KJS::LocalVarFunctionCallNode::evaluate):
+ (KJS::LocalVarFunctionCallNode::evaluateToNumber):
+ (KJS::LocalVarFunctionCallNode::evaluateToBoolean):
+ (KJS::LocalVarFunctionCallNode::evaluateToInt32):
+ (KJS::LocalVarFunctionCallNode::evaluateToUInt32):
+ (KJS::FunctionCallDotNode::evaluate):
+ (KJS::FunctionCallDotNode::evaluateToNumber):
+ (KJS::FunctionCallDotNode::evaluateToBoolean):
+ (KJS::FunctionCallDotNode::evaluateToInt32):
+ (KJS::FunctionCallDotNode::evaluateToUInt32):
+ (KJS::PostDecLocalVarNode::inlineEvaluateToNumber):
+ (KJS::PostDecLocalVarNode::evaluateToNumber):
+ (KJS::PostDecLocalVarNode::evaluateToBoolean):
+ (KJS::PostDecLocalVarNode::evaluateToInt32):
+ (KJS::PostDecLocalVarNode::evaluateToUInt32):
+ (KJS::typeStringForValue):
+ (KJS::UnaryPlusNode::evaluate):
+ (KJS::UnaryPlusNode::evaluateToBoolean):
+ (KJS::UnaryPlusNode::evaluateToNumber):
+ (KJS::UnaryPlusNode::evaluateToInt32):
+ (KJS::BitwiseNotNode::inlineEvaluateToInt32):
+ (KJS::BitwiseNotNode::evaluate):
+ (KJS::BitwiseNotNode::evaluateToNumber):
+ (KJS::BitwiseNotNode::evaluateToBoolean):
+ (KJS::BitwiseNotNode::evaluateToInt32):
+ (KJS::MultNode::evaluateToBoolean):
+ (KJS::MultNode::evaluateToInt32):
+ (KJS::MultNode::evaluateToUInt32):
+ (KJS::DivNode::evaluateToInt32):
+ (KJS::DivNode::evaluateToUInt32):
+ (KJS::ModNode::evaluateToBoolean):
+ (KJS::ModNode::evaluateToInt32):
+ (KJS::ModNode::evaluateToUInt32):
+ (KJS::AddNode::evaluateToNumber):
+ (KJS::AddNode::evaluateToInt32):
+ (KJS::AddNode::evaluateToUInt32):
+ (KJS::AddNumbersNode::evaluateToInt32):
+ (KJS::AddNumbersNode::evaluateToUInt32):
+ (KJS::SubNode::evaluateToInt32):
+ (KJS::SubNode::evaluateToUInt32):
+ (KJS::LeftShiftNode::inlineEvaluateToInt32):
+ (KJS::LeftShiftNode::evaluate):
+ (KJS::LeftShiftNode::evaluateToNumber):
+ (KJS::LeftShiftNode::evaluateToInt32):
+ (KJS::RightShiftNode::inlineEvaluateToInt32):
+ (KJS::RightShiftNode::evaluate):
+ (KJS::RightShiftNode::evaluateToNumber):
+ (KJS::RightShiftNode::evaluateToInt32):
+ (KJS::UnsignedRightShiftNode::inlineEvaluateToUInt32):
+ (KJS::UnsignedRightShiftNode::evaluate):
+ (KJS::UnsignedRightShiftNode::evaluateToNumber):
+ (KJS::UnsignedRightShiftNode::evaluateToInt32):
+ (KJS::LessNode::inlineEvaluateToBoolean):
+ (KJS::LessNode::evaluate):
+ (KJS::LessNode::evaluateToBoolean):
+ (KJS::LessNumbersNode::inlineEvaluateToBoolean):
+ (KJS::LessNumbersNode::evaluate):
+ (KJS::LessNumbersNode::evaluateToBoolean):
+ (KJS::LessStringsNode::inlineEvaluateToBoolean):
+ (KJS::LessStringsNode::evaluate):
+ (KJS::BitAndNode::evaluate):
+ (KJS::BitAndNode::inlineEvaluateToInt32):
+ (KJS::BitAndNode::evaluateToNumber):
+ (KJS::BitAndNode::evaluateToBoolean):
+ (KJS::BitAndNode::evaluateToInt32):
+ (KJS::BitXOrNode::inlineEvaluateToInt32):
+ (KJS::BitXOrNode::evaluate):
+ (KJS::BitXOrNode::evaluateToNumber):
+ (KJS::BitXOrNode::evaluateToBoolean):
+ (KJS::BitXOrNode::evaluateToInt32):
+ (KJS::BitOrNode::inlineEvaluateToInt32):
+ (KJS::BitOrNode::evaluate):
+ (KJS::BitOrNode::evaluateToNumber):
+ (KJS::BitOrNode::evaluateToBoolean):
+ (KJS::BitOrNode::evaluateToInt32):
+ (KJS::ConditionalNode::evaluateToNumber):
+ (KJS::ConditionalNode::evaluateToInt32):
+ (KJS::ConditionalNode::evaluateToUInt32):
+ (KJS::valueForReadModifyAssignment):
+ (KJS::AssignExprNode::evaluate):
+ (KJS::AssignExprNode::evaluateToBoolean):
+ (KJS::AssignExprNode::evaluateToNumber):
+ (KJS::AssignExprNode::evaluateToInt32):
+ (KJS::VarDeclNode::handleSlowCase):
+ * kjs/nodes.h:
+ (KJS::FunctionCallResolveNode::precedence):
+ (KJS::AddNode::precedence):
+ (KJS::AddNode::):
+ (KJS::LessNumbersNode::):
+ (KJS::LessStringsNode::):
+ * kjs/value.cpp:
+ (KJS::JSValue::toInt32SlowCase):
+ (KJS::JSValue::toUInt32SlowCase):
+ * kjs/value.h:
+ (KJS::JSValue::asCell):
+ (KJS::JSValue::toInt32):
+ (KJS::JSValue::toUInt32):
+
+2007-11-12 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Darin.
+
+ http://bugs.webkit.org/show_bug.cgi?id=15953
+ Add UTF-8 encoding/decoding to WTF
+
+ * kjs/ustring.h: Moved UTF8SequenceLength() and decodeUTF8Sequence() to wtf/unicode.
+ * kjs/ustring.cpp: (KJS::UString::UTF8String): Changed this function to take a strict/lenient
+ parameter. Callers are not interested in getting decoding results in strict mode, so
+ this allows for bailing out as soon as an error is seen.
+
+ * kjs/function.cpp:
+ (KJS::encode): Updated for new UString::UTF8String() signature.
+
+ * API/JSStringRef.cpp:
+ (JSStringCreateWithCharacters): Disambiguate UChar.
+ (JSStringCreateWithUTF8CString): Actually use UTF-8 when creating the string!
+ * bindings/c/c_utility.cpp: (KJS::Bindings::convertUTF8ToUTF16): Use ConvertUTF8ToUTF16().
+
+ * wtf/unicode/UTF8.cpp: Added.
+ (WTF::Unicode::inlineUTF8SequenceLengthNonASCII):
+ (WTF::Unicode::inlineUTF8SequenceLength):
+ (WTF::Unicode::UTF8SequenceLength):
+ (WTF::Unicode::decodeUTF8Sequence):
+ (WTF::Unicode::):
+ (WTF::Unicode::ConvertUTF16ToUTF8):
+ (WTF::Unicode::isLegalUTF8):
+ (WTF::Unicode::ConvertUTF8ToUTF16):
+ * wtf/unicode/UTF8.h: Added.
+ (WTF::Unicode::):
+ Some code moved from ustring.h, some adapted from unicode.org sources.
+
+ * JavaScriptCore.exp:
+ * JavaScriptCore.pri:
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * JavaScriptCoreSources.bkl:
+ Added UTF8.{h,cpp}
+
+2007-11-12 Josh Aas <joshmoz@gmail.com>
+
+ Reviewed by Darin.
+
+ - http://bugs.webkit.org/show_bug.cgi?id=15946
+ add NPPValue NPPVpluginDrawingModel (Mozilla bug 403418 compat)
+
+ * bindings/npapi.h:
+
+2007-11-12 Darin Adler <darin@apple.com>
+
+ Reviewed by Sam.
+
+ - http://bugs.webkit.org/show_bug.cgi?id=15951
+ REGRESSION: assertion failure in regexp match() when running JS tests
+
+ Test: fast/js/regexp-many-brackets.html
+
+ * pcre/pcre_exec.cpp: (match): Added back accidentally-removed case for
+ the BRANUMBER opcode.
+
+2007-11-12 Darin Adler <darin@apple.com>
+
+ Reviewed by Geoff.
+
+ - fix use of prefix and config.h, got rid of a few unneeded things in
+ the PCRE code; no behavior changes
+
+ * API/JSBase.cpp: Added include of config.h.
+ * API/JSCallbackConstructor.cpp: Ditto.
+ * API/JSCallbackFunction.cpp: Ditto.
+ * API/JSCallbackObject.cpp: Ditto.
+ * API/JSClassRef.cpp: Ditto.
+ * API/JSContextRef.cpp: Ditto.
+ * API/JSObjectRef.cpp: Ditto.
+ * API/JSStringRef.cpp: Ditto.
+ * API/JSValueRef.cpp: Ditto.
+
+ * JavaScriptCorePrefix.h: Removed obsolete <ctype.h> workaround.
+ Moved new/delete macros after includes, as they are in WebCore's prefix.
+ Removed "config.h".
+
+ * pcre/dftables.cpp: (main): Changed back to not use a separate maketables
+ function. This is needed for PCRE, but not helpful for our use. Also changed
+ the tables to all be 128 entries long instead of 256, since only the first
+ 128 are ever used.
+
+ * pcre/pcre_compile.cpp: Added include of config.h. Eliminated digitab,
+ which was only being used to check hex digits. Changed all uses of TRUE and
+ FALSE to use the C++ true and false instead.
+ (check_escape): Just the TRUE/FALSE thing.
+ (is_counted_repeat): Ditto.
+ (could_be_empty_branch): Ditto.
+ (get_othercase_range): Ditto.
+ (compile_branch): Ditto.
+ (compile_regex): Ditto.
+ (is_anchored): Ditto.
+ (is_startline): Ditto.
+ (find_firstassertedchar): Ditto.
+ (jsRegExpCompile): Ditto.
+
+ * pcre/pcre_exec.cpp: Added include of config.h. Changed all uses of TRUE and
+ FALSE to use the C++ true and false instead.
+ (match_ref): Just the TRUE/FALSE thing.
+ (match): Ditto. Removed some unneeded braces.
+ (jsRegExpExecute): Just the TRUE/FALSE thing.
+
+ * pcre/pcre_internal.h: Moved the constants needed by dftables.cpp to the top
+ of the file instead of the bottom, so they can be used. Also changed the table
+ sizes to 128 instead of 256. Removed macro definitions of FALSE and TRUE.
+ Set array sizes for all the const arrays. Changed _pcre_utf8_table1_size to
+ be a macro instead of a extern int.
+
+ * pcre/pcre_maketables.cpp: Removed. It's all in dftables.cpp now.
+
+ * pcre/pcre_tables.cpp: Made table sizes explicit.
+
+ * pcre/pcre_xclass.cpp: Just the TRUE/FALSE thing.
+
+2007-11-12 Adam Roben <aroben@apple.com>
+
+ Build fix
+
+ * wtf/FastMalloc.h: Add missing using statement.
+
+2007-11-11 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Darin.
+
+ Add special fastZeroedMalloc function to replace a
+ number of fastCalloc calls where one argument was 1.
+
+ This results in a 0.4% progression in SunSpider, more
+ than making up for the earlier regression caused by
+ additional overflow checks.
+
+ * JavaScriptCore.exp:
+ * kjs/array_instance.cpp:
+ * kjs/property_map.cpp:
+ * wtf/FastMalloc.cpp:
+ * wtf/FastMalloc.h:
+ * wtf/HashTable.h:
+
+2007-11-11 Adam Roben <aroben@apple.com>
+
+ Fix <rdar://5578982> ASSERT in HashTable::checkTableConsistencyExceptSize beneath WebNotificationCenter
+
+ The bug was due to a mismatch between HashMap::remove and
+ HashTable::checkTableConsistency. HashMap::remove can delete the value
+ stored in the HashTable (by derefing it), which is not normally
+ allowed by HashTable. It's OK in this case because the value is about
+ to be removed from the table, but HashTable wasn't aware of this.
+
+ HashMap::remove now performs the consistency check itself before
+ derefing the value.
+
+ Darin noticed that the same bug would occur in HashSet, so I've fixed
+ it there as well.
+
+ Reviewed by Darin.
+
+ * wtf/HashMap.h:
+ (WTF::HashMap::remove): Perform the HashTable consistency check
+ manually before calling deref.
+ * wtf/HashSet.h:
+ (WTF::HashSet::remove): Ditto.
+ * wtf/HashTable.h: Made checkTableConsistency public so that HashMap
+ and HashSet can call it.
+ (WTF::HashTable::removeAndInvalidateWithoutEntryConsistencyCheck):
+ Added.
+ (WTF::HashTable::removeAndInvalidate): Added.
+ (WTF::HashTable::remove):
+ (WTF::HashTable::removeWithoutEntryConsistencyCheck): Added.
+
+2007-11-11 Mark Rowe <mrowe@apple.com>
+
+ Build fix. Use the correct filename case.
+
+ * kjs/nodes.h:
+
+2007-11-11 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Fixed http://bugs.webkit.org/show_bug.cgi?id=15902
+ 15% of string-validate-input.js is spent compiling the same regular expression
+
+ Store a compiled representation of the regular expression in the AST.
+
+ Only a .2% SunSpider speedup overall, but a 10.6% speedup on
+ string-validate-input.js.
+
+ * kjs/nodes.cpp:
+ (KJS::RegExpNode::evaluate):
+ * kjs/nodes.h:
+ (KJS::RegExpNode::):
+ * kjs/nodes2string.cpp:
+ (KJS::RegExpNode::streamTo):
+ * kjs/regexp.cpp:
+ (KJS::RegExp::flags):
+ * kjs/regexp.h:
+ (KJS::RegExp::pattern):
+ * kjs/regexp_object.cpp:
+ (KJS::RegExpObjectImp::construct):
+ (KJS::RegExpObjectImp::createRegExpImp):
+ * kjs/regexp_object.h:
+
+2007-11-11 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Eric.
+
+ Partial fix for <rdar://problem/5585334> numfuzz: integer overflows opening malformed SVG file in WebCore::ImageBuffer::create
+
+ Unfortunately this is a very slight regression, but is unavoidable.
+
+ * wtf/FastMalloc.cpp:
+
+2007-11-10 Eric Seidel <eric@webkit.org>
+
+ Reviewed by darin.
+
+ Add simple type inferencing to the parser, and create custom
+ AddNode and LessNode subclasses based on inferred types.
+ http://bugs.webkit.org/show_bug.cgi?id=15884
+
+ SunSpider claims this is at least a 0.5% speedup.
+
+ * JavaScriptCore.exp:
+ * kjs/grammar.y:
+ * kjs/internal.cpp:
+ (KJS::NumberImp::getPrimitiveNumber):
+ (KJS::GetterSetterImp::getPrimitiveNumber):
+ * kjs/internal.h:
+ * kjs/lexer.cpp:
+ (KJS::Lexer::lex):
+ * kjs/nodes.cpp:
+ (KJS::Node::Node):
+ (KJS::StringNode::evaluate):
+ (KJS::StringNode::evaluateToNumber):
+ (KJS::StringNode::evaluateToBoolean):
+ (KJS::RegExpNode::evaluate):
+ (KJS::UnaryPlusNode::optimizeVariableAccess):
+ (KJS::AddNode::evaluate):
+ (KJS::AddNode::evaluateToNumber):
+ (KJS::AddNumbersNode::inlineEvaluateToNumber):
+ (KJS::AddNumbersNode::evaluate):
+ (KJS::AddNumbersNode::evaluateToNumber):
+ (KJS::AddStringsNode::evaluate):
+ (KJS::AddStringLeftNode::evaluate):
+ (KJS::AddStringRightNode::evaluate):
+ (KJS::lessThan):
+ (KJS::lessThanEq):
+ (KJS::LessNumbersNode::evaluate):
+ (KJS::LessStringsNode::evaluate):
+ * kjs/nodes.h:
+ (KJS::ExpressionNode::):
+ (KJS::RegExpNode::):
+ (KJS::RegExpNode::precedence):
+ (KJS::TypeOfResolveNode::):
+ (KJS::LocalVarTypeOfNode::):
+ (KJS::UnaryPlusNode::):
+ (KJS::UnaryPlusNode::precedence):
+ (KJS::AddNode::):
+ (KJS::AddNode::precedence):
+ (KJS::AddNumbersNode::):
+ (KJS::AddStringLeftNode::):
+ (KJS::AddStringRightNode::):
+ (KJS::AddStringsNode::):
+ (KJS::LessNode::):
+ (KJS::LessNode::precedence):
+ (KJS::LessNumbersNode::):
+ (KJS::LessStringsNode::):
+ * kjs/nodes2string.cpp:
+ (KJS::StringNode::streamTo):
+ * kjs/object.cpp:
+ * kjs/object.h:
+ * kjs/value.h:
+ (KJS::JSValue::getPrimitiveNumber):
+
+2007-11-11 Darin Adler <darin@apple.com>
+
+ - try another way of fixing dftables builds -- refactor pcre_internal.h a bit
+
+ * pcre/pcre_internal.h: Make most of this header do nothing when DFTABLES is set.
+ Later we can break it into two files.
+
+ * JavaScriptCore.vcproj/dftables/dftables.vcproj: Take out now-unneeded include paths.
+ * pcre/dftables.cpp: Set DFTABLES. Use delete instead of free.
+ * pcre/dftables.pro: Take out now-unneeded include paths.
+ * pcre/pcre_maketables.cpp: Use new instead of malloc.
+
+2007-11-11 Darin Adler <darin@apple.com>
+
+ * pcre/dftables.pro: Try fixing Qt builds (I looked at qt-win) by adding
+ another include path.
+
+2007-11-11 Darin Adler <darin@apple.com>
+
+ * JavaScriptCore.xcodeproj/project.pbxproj: Try fixing Mac Tiger builds
+ by adding another include path.
+
+2007-11-11 Darin Adler <darin@apple.com>
+
+ Reviewed by Sam.
+
+ - http://bugs.webkit.org/show_bug.cgi?id=15924
+ next round of changes to JSRegExp (formerly PCRE)
+
+ This is a combination of converting to C++, tweaking the API, and adding
+ some additional optimizations.
+
+ Future steps will involve getting rid of the use of UTF-8 completely
+ (we'll use UTF-16 exclusively instead), eliminating more source files,
+ and some more speed-ups.
+
+ SunSpider says the current round is an 0.9% speed-up overall, and a
+ 5.3% speed-up for regexp.
+
+ * JavaScriptCore.exp: Updated for new entry points.
+
+ * JavaScriptCore.pri:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.vcproj/dftables/dftables.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * JavaScriptCoreSources.bkl:
+ * jscore.bkl:
+ Updated for new source file names and ForwardingHeaders.
+
+ * kjs/regexp.cpp:
+ (KJS::RegExp::RegExp): Changed to use the error message without calling
+ strdup on it and to pass the new types and options.
+ (KJS::RegExp::~RegExp): Removed the now-unneeded free of the error message.
+ (KJS::RegExp::match): Pass the new types and options.
+ * kjs/regexp.h: Update type of m_constructionError.
+
+ * pcre/AUTHORS: Update to reflect the status of the project -- we don't include
+ the Google parts, and this isn't the PCRE library, per se.
+ * pcre/COPYING: Ditto.
+
+ * pcre/dftables.cpp: Copied from JavaScriptCore/pcre/dftables.c.
+ (main): Removed unneeded ctype_digit.
+
+ * pcre/pcre.h: Convert to C++, tweak API a bit. Use UChar instead of JSRegExpChar.
+
+ * pcre/pcre_compile.cpp: Copied from JavaScriptCore/pcre/pcre_compile.c.
+ Moved a lot of private stuff used only within this file here from pcre_internal.h.
+ Renumbered the error codes.
+ (error_text): Use a single string with embedded nulls for the error text (I got
+ this idea from newer versions of PCRE).
+ (check_escape): Changed return type to be enum instead of int. Replaced ctype_digit
+ uses with isASCIIDigit.
+ (is_counted_repeat): Ditto.
+ (read_repeat_counts): Ditto.
+ (first_significant_code): Ditto.
+ (find_fixedlength): Ditto.
+ (could_be_empty_branch): Ditto.
+ (compile_branch): Ditto. Also removed some code that handles changing options.
+ JavaScript doesn't have any of the features that allow options to change.
+ (compile_regex): Updated for change to options parameter.
+ (is_anchored): Ditto.
+ (find_firstassertedchar): Ditto.
+ (jsRegExpCompile): Changed to take separate flags instead of an options int.
+ Also changed to call new/delete instead of pcre_malloc/free.
+ (jsRegExpFree): Ditto.
+
+ * pcre/pcre_exec.cpp: Copied from JavaScriptCore/pcre/pcre_exec.c.
+ Added a case that uses computed goto for the opcode loop, but did not turn it on.
+ Changed the RMATCH macro to handle returns more efficiently by putting the where
+ pointer in the new frame instead of the old one, allowing us to branch to the
+ return with a single statement. Switched to new/delete from pcre_malloc/free.
+ Changed many RRETURN callers to not set the return value since it's already
+ set correctly. Replaced the rrc variable with an is_match variable. Values other
+ than "match" and "no match" are now handled differently. This allows us to remove
+ the code to check for those cases in various rules.
+ (match): All the case statements use a macro BEGIN_OPCODE instead. And all the
+ continue statements, or break statements that break out of the outer case use
+ a macro NEXT_OPCODE instead. Replaced a few if statements with assertions.
+ (jsRegExpExecute): Use new/delete instead of pcre_malloc/free. Removed unused
+ start_match field from the match block.
+
+ * pcre/pcre_internal.h: Moved the last few configuration macros from pcre-config.h
+ in here. Removed various unused types. Converted from JSRegExpChar to UChar.
+ Eliminated pcre_malloc/free. Replaced the opcode enum with a macro that can be
+ used in multiple places. Unfortunately we lose the comments for each opcode; we
+ should find a place to put those back. Removed ctype_digit.
+
+ * pcre/pcre_maketables.cpp: Copied from JavaScriptCore/pcre/pcre_maketables.c.
+ (pcre_maketables): Got rid of the conditional code that allows this to be compiled
+ in -- it's only used for dftables now (and soon may be obsolete entirely).
+ Changed code for cbit_digit to not use isdigit, and took the "_" case out of the
+ loop. Removed ctype_digit.
+
+ * pcre/pcre_ord2utf8.cpp: Copied from JavaScriptCore/pcre/pcre_ord2utf8.c.
+
+ * pcre/pcre_tables.cpp: Copied from JavaScriptCore/pcre/pcre_tables.c.
+ Moved _pcre_OP_lengths out of here into pcre_exec.cpp.
+
+ * pcre/pcre_ucp_searchfuncs.cpp: Copied from JavaScriptCore/pcre/pcre_ucp_searchfuncs.c.
+ Updated for other file name changes.
+
+ * pcre/pcre_xclass.cpp: Copied from JavaScriptCore/pcre/pcre_xclass.c.
+
+ * pcre/ucpinternal.h: Updated header.
+
+ * pcre/ucptable.cpp: Copied from JavaScriptCore/pcre/ucptable.c.
+
+ * wtf/ASCIICType.h: (WTF::isASCIIDigit): Removed a branch by changing from && to
+ & for this operation. Also added an overload that takes an int because that's
+ useful for PCRE. Later we could optimize for int and overload other functions in
+ this file; stuck to this simple one for now.
+
+ * wtf/unicode/icu/UnicodeIcu.h: Removed unused isUpper.
+ * wtf/unicode/qt4/UnicodeQt4.h: Ditto.
+
+ * pcre/LICENCE: Removed.
+ * pcre/pcre-config.h: Removed.
+ * wtf/FastMallocPCRE.cpp: Removed.
+
+ * pcre/dftables.c: Renamed to cpp.
+ * pcre/pcre_compile.c: Ditto.
+ * pcre/pcre_exec.c: Ditto.
+ * pcre/pcre_maketables.c: Ditto.
+ * pcre/pcre_ord2utf8.c: Ditto.
+ * pcre/pcre_tables.c: Ditto.
+ * pcre/pcre_ucp_searchfuncs.c: Ditto.
+ * pcre/pcre_xclass.c: Ditto.
+ * pcre/ucptable.c: Ditto.
+
+2007-11-11 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Oliver.
+
+ Add KJS_CHECKEXCEPTIONBOOLEAN to match rest of nodes.cpp
+
+ * kjs/nodes.cpp:
+ (KJS::ExpressionNode::evaluateToBoolean):
+ (KJS::LessNode::evaluateToBoolean):
+ (KJS::GreaterNode::evaluateToBoolean):
+ (KJS::LessEqNode::evaluateToBoolean):
+ (KJS::GreaterEqNode::evaluateToBoolean):
+ (KJS::InstanceOfNode::evaluateToBoolean):
+ (KJS::InNode::evaluateToBoolean):
+ (KJS::EqualNode::evaluateToBoolean):
+ (KJS::NotEqualNode::evaluateToBoolean):
+ (KJS::StrictEqualNode::evaluateToBoolean):
+ (KJS::NotStrictEqualNode::evaluateToBoolean):
+ (KJS::LogicalAndNode::evaluateToBoolean):
+ (KJS::LogicalOrNode::evaluateToBoolean):
+ (KJS::ConditionalNode::evaluateToBoolean):
+
+2007-11-10 Darin Adler <darin@apple.com>
+
+ Reviewed by Sam.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=15927
+ REGRESSION(r27487): delete a.c followed by __defineGetter__("c", ...) incorrectly deletes another property
+ and <rdar://problem/5586384> REGRESSION (r27487): Can't switch out of Edit HTML Source mode on Leopard Wiki
+
+ Test: fast/js/delete-then-put.html
+
+ * kjs/property_map.cpp:
+ (KJS::PropertyMap::put): Added a missing "- 1"; code to find an empty slot was not working.
+ (KJS::PropertyMap::checkConsistency): Added a missing range check that would have caught this
+ problem before.
+
+ - roll out a last-minute change to my evaluateToBoolean patch that was incorrect.
+
+ * kjs/nodes.h: (KJS::ExprStatementNode::ExprStatementNode): Take out call to
+ optimizeForUnnecessaryResult, since the result is used in some cases.
+
+2007-11-10 Adam Roben <aroben@apple.com>
+
+ Windows build fix
+
+ Roll out some changes that were (seemingly accidentally) checked in
+ with r27664.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+
+2007-11-10 Darin Adler <darin@apple.com>
+
+ Reviewed by Sam.
+
+ - http://bugs.webkit.org/show_bug.cgi?id=15915
+ add an evaluation path for booleans like the one we have for numbers
+
+ Gives 1.1% on SunSpider.
+
+ * kjs/grammar.y: Create TrueNode and FalseNode instead of BooleanNode.
+
+ * kjs/nodes.h: Changed to use Noncopyable. Moved optimizeForUnnecessaryResult
+ down from Node to ExpressionNode. Changed some classes to not inherit from
+ ExpressionNode where not necessary, and removed unnneeded evaluate functions
+ as well as evaluate functions that need not be virtual. Call the
+ optimizeForUnnecessaryResult function on the start of a for loop too.
+ * kjs/nodes.cpp:
+ (KJS::ExpressionNode::evaluateToBoolean): Added.
+ (KJS::FalseNode::evaluate): Added.
+ (KJS::TrueNode::evaluate): Added.
+ (KJS::NumberNode::evaluateToBoolean): Added.
+ (KJS::StringNode::evaluateToBoolean): Added.
+ (KJS::LocalVarAccessNode::evaluateToBoolean): Added.
+ (KJS::BracketAccessorNode::evaluateToBoolean): Added.
+ (KJS::LogicalNotNode::evaluate): Changed to call evaluateToBoolean.
+ (KJS::LogicalNotNode::evaluateToBoolean): Added.
+ (KJS::lessThan): Changed to return bool.
+ (KJS::lessThanEq): Ditto.
+ (KJS::LessNode::evaluate): Changed since lessThan returns bool.
+ (KJS::LessNode::evaluateToBoolean): Added.
+ (KJS::GreaterNode::evaluate): Changed since lessThanEq returns bool.
+ (KJS::GreaterNode::evaluateToBoolean): Added.
+ (KJS::LessEqNode::evaluate): Changed since lessThanEq returns bool.
+ (KJS::LessEqNode::evaluateToBoolean): Added.
+ (KJS::GreaterEqNode::evaluate): Changed since lessThan returns bool.
+ (KJS::GreaterEqNode::evaluateToBoolean): Added.
+ (KJS::InstanceOfNode::evaluateToBoolean): Added.
+ (KJS::InNode::evaluateToBoolean): Added.
+ (KJS::EqualNode::evaluateToBoolean): Added.
+ (KJS::NotEqualNode::evaluateToBoolean): Added.
+ (KJS::StrictEqualNode::evaluateToBoolean): Added.
+ (KJS::NotStrictEqualNode::evaluateToBoolean): Added.
+ (KJS::ConditionalNode::evaluate): Changed to call evaluateToBoolean.
+ (KJS::IfNode::execute): Ditto.
+ (KJS::DoWhileNode::execute): Ditto.
+ (KJS::WhileNode::execute): Ditto.
+ (KJS::ForNode::execute): Ditto.
+
+ * kjs/nodes2string.cpp:
+ (KJS::FalseNode::streamTo): Added.
+ (KJS::TrueNode::streamTo): Added.
+
+2007-11-09 Adam Roben <aroben@apple.com>
+
+ Windows build fix
+
+ Reviewed by Darin.
+
+ * kjs/value.h:
+ (KJS::jsNumber): Add some explicit casts.
+
+2007-11-08 Darin Adler <darin@apple.com>
+
+ - fix build
+
+ * kjs/grammar.y:
+ * kjs/nodes.h:
+ * kjs/property_map.cpp:
+
+2007-11-08 Darin Adler <darin@apple.com>
+
+ - roll out accidentally-checked in changes
+
+ * kjs/nodes.cpp: Back to previous version.
+ * kjs/nodes.h: Ditto.
+ * kjs/grammar.y: Ditto.
+
+2007-11-08 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - http://bugs.webkit.org/show_bug.cgi?id=15912
+ fasta spends a lot of time in qsort
+
+ * kjs/property_map.cpp:
+ (KJS::PropertyMap::getEnumerablePropertyNames):
+ Use insertion sort instead of qsort for small sets of property names.
+ We can probably do some even-better speedups of for/in, but this nets
+ 0.6% overall and 6.7% on fasta.
+
+2007-11-08 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - http://bugs.webkit.org/show_bug.cgi?id=15906
+ getting characters by indexing into a string is very slow
+
+ This fixes one source of the slowness -- the conversion to an unused
+ Identifier as we call the get function from the slot -- but doesn't
+ fix others, such as the fact that we have to allocate a new UString::Rep
+ for every single character.
+
+ Speeds up string-base64 30%, and at least 0.5% overall.
+ But does slow down access-fannkuch quite a bit. Might be worth
+ revisiting in the future to see what we can do about that (although
+ I did look at a profile for a while).
+
+ * kjs/property_slot.h: Add a new marker for "numeric" property slots;
+ slots where we don't need to pass the identifier to the get function.
+ (KJS::PropertySlot::getValue): Added code to call the numeric get function.
+ (KJS::PropertySlot::setCustomNumeric): Added.
+ * kjs/string_object.cpp:
+ (KJS::StringInstance::indexGetter): Changed to use substr() instead
+ of constructing a wholly new UString each time.
+ (KJS::stringInstanceNumericPropertyGetter): Added. Like indexGetter, but
+ takes advantage of setCustomNumeric to avoid creating an Identifier.
+ (KJS::StringInstance::getOwnPropertySlot): Changed to use setCustomNumeric.
+
+2007-11-08 Darin Adler <darin@apple.com>
+
+ Reviewed by Oliver.
+
+ - http://bugs.webkit.org/show_bug.cgi?id=15904
+ more speed-ups possible by tightening up int version of JSImmediate
+
+ 1% improvement of SunSpider
+
+ * kjs/JSImmediate.h: Eliminate the now-unneeded FPBitValues struct template.
+ (KJS::JSImmediate::from): Overload for most numeric types; many types can
+ do fewer branches and checks.
+ (KJS::JSImmediate::getUInt32): Removed unneeded check for undefined.
+ (KJS::JSImmediate::getTruncatedInt32): Ditto.
+ (KJS::JSImmediate::getTruncatedUInt32): Ditto. There's no difference any more
+ between getUInt32 and getTruncatedUInt32, so that's worth a rename and merge later.
+
+ * kjs/grammar.y: Update since fromDouble is now just from.
+ * kjs/nodes.h: Ditto.
+
+ * kjs/value.h: (KJS::jsNumber): Overload for most numeric types.
+
+2007-11-08 Kevin Ollivier <kevino@theolliviers.com>
+
+ Bakefiles for building JavaScriptCore, needed by wx port.
+
+ Reviewed by Mark Rowe.
+
+ * JavaScriptCoreSources.bkl: Added.
+ * jscore.bkl: Added.
+
+2007-11-08 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej.
+
+ Fix regression caused by earlier bitwise and optimisation. 1 & undefined != 1.
+
+ The implementation of JSImmediate::areBothImmediateNumbers relies on
+ (JSImmediate::getTag(immediate1) & JSImmediate::getTag(immediate2)) having
+ a unique result when both immediate values are numbers.
+
+ The regression was due to UndefinedType & NumberType returning NumberType (3 & 1).
+ By swapping the value of NumberType and UndefinedType this ceases to be a problem.
+
+ * kjs/JSType.h:
+
+2007-11-08 Darin Adler <darin@apple.com>
+
+ - fix build
+
+ * kjs/nodes.h: Add missing parameter name.
+
+2007-11-08 Eric Seidel <eric@webkit.org>
+
+ Reviewed by darin.
+
+ Add ExpressionNode subclass of Node, use it.
+
+ * kjs/grammar.y:
+ * kjs/nodes.cpp:
+ (KJS::ForInNode::ForInNode):
+ * kjs/nodes.h:
+ (KJS::ExpressionNode::):
+ (KJS::NullNode::):
+ (KJS::NullNode::precedence):
+ (KJS::BooleanNode::):
+ (KJS::BooleanNode::precedence):
+ (KJS::RegExpNode::):
+ (KJS::RegExpNode::precedence):
+ (KJS::ThisNode::):
+ (KJS::ThisNode::precedence):
+ (KJS::ResolveNode::):
+ (KJS::ElementNode::):
+ (KJS::ArrayNode::):
+ (KJS::PropertyNode::):
+ (KJS::PropertyNode::precedence):
+ (KJS::PropertyNode::name):
+ (KJS::PropertyListNode::):
+ (KJS::ObjectLiteralNode::):
+ (KJS::ObjectLiteralNode::precedence):
+ (KJS::BracketAccessorNode::):
+ (KJS::DotAccessorNode::):
+ (KJS::DotAccessorNode::precedence):
+ (KJS::ArgumentListNode::):
+ (KJS::ArgumentsNode::):
+ (KJS::NewExprNode::):
+ (KJS::NewExprNode::precedence):
+ (KJS::FunctionCallValueNode::):
+ (KJS::FunctionCallValueNode::precedence):
+ (KJS::FunctionCallResolveNode::):
+ (KJS::FunctionCallBracketNode::):
+ (KJS::FunctionCallBracketNode::precedence):
+ (KJS::FunctionCallDotNode::):
+ (KJS::FunctionCallDotNode::precedence):
+ (KJS::PrePostResolveNode::):
+ (KJS::PostfixBracketNode::):
+ (KJS::PostfixBracketNode::precedence):
+ (KJS::PostIncBracketNode::):
+ (KJS::PostIncBracketNode::isIncrement):
+ (KJS::PostDecBracketNode::):
+ (KJS::PostDecBracketNode::isIncrement):
+ (KJS::PostfixDotNode::):
+ (KJS::PostfixDotNode::precedence):
+ (KJS::PostIncDotNode::):
+ (KJS::PostIncDotNode::isIncrement):
+ (KJS::PostDecDotNode::):
+ (KJS::PostDecDotNode::isIncrement):
+ (KJS::PostfixErrorNode::):
+ (KJS::PostfixErrorNode::precedence):
+ (KJS::DeleteResolveNode::):
+ (KJS::DeleteBracketNode::):
+ (KJS::DeleteBracketNode::precedence):
+ (KJS::DeleteDotNode::):
+ (KJS::DeleteDotNode::precedence):
+ (KJS::DeleteValueNode::):
+ (KJS::DeleteValueNode::precedence):
+ (KJS::VoidNode::):
+ (KJS::VoidNode::precedence):
+ (KJS::TypeOfResolveNode::):
+ (KJS::TypeOfValueNode::):
+ (KJS::PrefixBracketNode::):
+ (KJS::PrefixBracketNode::precedence):
+ (KJS::PreIncBracketNode::):
+ (KJS::PreIncBracketNode::isIncrement):
+ (KJS::PreDecBracketNode::):
+ (KJS::PreDecBracketNode::isIncrement):
+ (KJS::PrefixDotNode::):
+ (KJS::PrefixDotNode::precedence):
+ (KJS::PreIncDotNode::):
+ (KJS::PreIncDotNode::isIncrement):
+ (KJS::PreDecDotNode::):
+ (KJS::PreDecDotNode::isIncrement):
+ (KJS::PrefixErrorNode::):
+ (KJS::PrefixErrorNode::precedence):
+ (KJS::UnaryPlusNode::):
+ (KJS::UnaryPlusNode::precedence):
+ (KJS::NegateNode::):
+ (KJS::NegateNode::precedence):
+ (KJS::BitwiseNotNode::):
+ (KJS::BitwiseNotNode::precedence):
+ (KJS::LogicalNotNode::):
+ (KJS::LogicalNotNode::precedence):
+ (KJS::AddNode::):
+ (KJS::AddNode::precedence):
+ (KJS::LeftShiftNode::):
+ (KJS::LeftShiftNode::precedence):
+ (KJS::RightShiftNode::):
+ (KJS::RightShiftNode::precedence):
+ (KJS::UnsignedRightShiftNode::):
+ (KJS::UnsignedRightShiftNode::precedence):
+ (KJS::LessNode::):
+ (KJS::LessNode::precedence):
+ (KJS::GreaterNode::):
+ (KJS::GreaterNode::precedence):
+ (KJS::LessEqNode::):
+ (KJS::LessEqNode::precedence):
+ (KJS::GreaterEqNode::):
+ (KJS::GreaterEqNode::precedence):
+ (KJS::InstanceOfNode::):
+ (KJS::InstanceOfNode::precedence):
+ (KJS::InNode::):
+ (KJS::InNode::precedence):
+ (KJS::EqualNode::):
+ (KJS::EqualNode::precedence):
+ (KJS::NotEqualNode::):
+ (KJS::NotEqualNode::precedence):
+ (KJS::StrictEqualNode::):
+ (KJS::StrictEqualNode::precedence):
+ (KJS::NotStrictEqualNode::):
+ (KJS::NotStrictEqualNode::precedence):
+ (KJS::BitAndNode::):
+ (KJS::BitAndNode::precedence):
+ (KJS::BitOrNode::):
+ (KJS::BitOrNode::precedence):
+ (KJS::BitXOrNode::):
+ (KJS::BitXOrNode::precedence):
+ (KJS::LogicalAndNode::):
+ (KJS::LogicalAndNode::precedence):
+ (KJS::LogicalOrNode::):
+ (KJS::LogicalOrNode::precedence):
+ (KJS::ConditionalNode::):
+ (KJS::ConditionalNode::precedence):
+ (KJS::ReadModifyResolveNode::):
+ (KJS::ReadModifyResolveNode::precedence):
+ (KJS::AssignResolveNode::):
+ (KJS::AssignResolveNode::precedence):
+ (KJS::ReadModifyBracketNode::):
+ (KJS::ReadModifyBracketNode::precedence):
+ (KJS::AssignBracketNode::):
+ (KJS::AssignBracketNode::precedence):
+ (KJS::AssignDotNode::):
+ (KJS::AssignDotNode::precedence):
+ (KJS::ReadModifyDotNode::):
+ (KJS::ReadModifyDotNode::precedence):
+ (KJS::AssignErrorNode::):
+ (KJS::AssignErrorNode::precedence):
+ (KJS::CommaNode::):
+ (KJS::CommaNode::precedence):
+ (KJS::AssignExprNode::):
+ (KJS::AssignExprNode::precedence):
+ (KJS::ExprStatementNode::):
+ (KJS::IfNode::):
+ (KJS::DoWhileNode::):
+ (KJS::WhileNode::):
+ (KJS::ReturnNode::):
+ (KJS::WithNode::):
+ (KJS::ThrowNode::):
+ (KJS::ParameterNode::):
+ (KJS::CaseClauseNode::):
+ (KJS::CaseClauseNode::precedence):
+ (KJS::ClauseListNode::):
+ (KJS::SwitchNode::):
+
+2007-11-08 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Sam.
+
+ Add a fast path for bitwise-and of two immediate numbers for a 0.7% improvement in SunSpider (4% bitop improvement).
+
+ This only improves bitwise-and performance, as the additional logic required
+ for similar code paths on or, xor, and shifting requires additional operations
+ and branches that negate (and in certain cases, regress) any advantage we might
+ otherwise receive.
+
+ This improves performance on all bitop tests, the cryptography tests, as well as
+ the string-base64 and string-unpack-code tests. No significant degradation on
+ any other tests.
+
+ * kjs/JSImmediate.h:
+ (KJS::JSImmediate::areBothImmediateNumbers):
+ (KJS::JSImmediate::andImmediateNumbers):
+ * kjs/nodes.cpp:
+ (KJS::BitAndNode::evaluate):
+ * kjs/value.h:
+ (KJS::jsNumberFromAnd):
+
+2007-11-08 Adam Roben <aroben@apple.com>
+
+ Stop using KJS inside of MathExtras.h
+
+ Reviewed by Darin.
+
+ * wtf/MathExtras.h: Removed an unused header, and a now-unused
+ forward-declaration.
+ (wtf_atan2): Use std::numeric_limits intead of KJS.
+
+2007-11-08 Sam Weinig <sam@webkit.org>
+
+ Windows build fix.
+
+ * kjs/date_object.cpp:
+ (KJS::DateProtoFuncToLocaleString::callAsFunction): Fix unused arg warning.
+ (KJS::DateProtoFuncToLocaleDateString::callAsFunction): ditto
+ (KJS::DateProtoFuncToLocaleTimeString::callAsFunction): ditto
+
+2007-11-08 Mark Rowe <mrowe@apple.com>
+
+ Gtk build fix.
+
+ * kjs/lookup.h: Add missing include.
+
+2007-11-08 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Darin.
+
+ Convert JavaScript internal function objects to use one class per
+ function. This avoids a switch statement inside what used to be
+ the shared function classes and will allow Shark to better analyze
+ the code.
+
+ To make this switch, the value property of the HashEntry was changed
+ to a union of an intptr_t (which is used to continue handle valueGetters)
+ and function pointer which points to a static constructor for the
+ individual new function objects.
+
+ SunSpider claims this is a 1.0% speedup.
+
+ * kjs/array_object.cpp:
+ (KJS::ArrayPrototype::getOwnPropertySlot):
+ (KJS::getProperty):
+ (KJS::ArrayProtoFuncToString::callAsFunction):
+ (KJS::ArrayProtoFuncToLocaleString::callAsFunction):
+ (KJS::ArrayProtoFuncJoin::callAsFunction):
+ (KJS::ArrayProtoFuncConcat::callAsFunction):
+ (KJS::ArrayProtoFuncPop::callAsFunction):
+ (KJS::ArrayProtoFuncPush::callAsFunction):
+ (KJS::ArrayProtoFuncReverse::callAsFunction):
+ (KJS::ArrayProtoFuncShift::callAsFunction):
+ (KJS::ArrayProtoFuncSlice::callAsFunction):
+ (KJS::ArrayProtoFuncSort::callAsFunction):
+ (KJS::ArrayProtoFuncSplice::callAsFunction):
+ (KJS::ArrayProtoFuncUnShift::callAsFunction):
+ (KJS::ArrayProtoFuncFilter::callAsFunction):
+ (KJS::ArrayProtoFuncMap::callAsFunction):
+ (KJS::ArrayProtoFuncEvery::callAsFunction):
+ (KJS::ArrayProtoFuncForEach::callAsFunction):
+ (KJS::ArrayProtoFuncSome::callAsFunction):
+ (KJS::ArrayProtoFuncIndexOf::callAsFunction):
+ (KJS::ArrayProtoFuncLastIndexOf::callAsFunction):
+ * kjs/array_object.h:
+ (KJS::ArrayPrototype::classInfo):
+ * kjs/create_hash_table:
+ * kjs/date_object.cpp:
+ (KJS::DatePrototype::getOwnPropertySlot):
+ (KJS::DateProtoFuncToString::callAsFunction):
+ (KJS::DateProtoFuncToUTCString::callAsFunction):
+ (KJS::DateProtoFuncToDateString::callAsFunction):
+ (KJS::DateProtoFuncToTimeString::callAsFunction):
+ (KJS::DateProtoFuncToLocaleString::callAsFunction):
+ (KJS::DateProtoFuncToLocaleDateString::callAsFunction):
+ (KJS::DateProtoFuncToLocaleTimeString::callAsFunction):
+ (KJS::DateProtoFuncValueOf::callAsFunction):
+ (KJS::DateProtoFuncGetTime::callAsFunction):
+ (KJS::DateProtoFuncGetFullYear::callAsFunction):
+ (KJS::DateProtoFuncGetUTCFullYear::callAsFunction):
+ (KJS::DateProtoFuncToGMTString::callAsFunction):
+ (KJS::DateProtoFuncGetMonth::callAsFunction):
+ (KJS::DateProtoFuncGetUTCMonth::callAsFunction):
+ (KJS::DateProtoFuncGetDate::callAsFunction):
+ (KJS::DateProtoFuncGetUTCDate::callAsFunction):
+ (KJS::DateProtoFuncGetDay::callAsFunction):
+ (KJS::DateProtoFuncGetUTCDay::callAsFunction):
+ (KJS::DateProtoFuncGetHours::callAsFunction):
+ (KJS::DateProtoFuncGetUTCHours::callAsFunction):
+ (KJS::DateProtoFuncGetMinutes::callAsFunction):
+ (KJS::DateProtoFuncGetUTCMinutes::callAsFunction):
+ (KJS::DateProtoFuncGetSeconds::callAsFunction):
+ (KJS::DateProtoFuncGetUTCSeconds::callAsFunction):
+ (KJS::DateProtoFuncGetMilliSeconds::callAsFunction):
+ (KJS::DateProtoFuncGetUTCMilliseconds::callAsFunction):
+ (KJS::DateProtoFuncGetTimezoneOffset::callAsFunction):
+ (KJS::DateProtoFuncSetTime::callAsFunction):
+ (KJS::DateProtoFuncSetMilliSeconds::callAsFunction):
+ (KJS::DateProtoFuncSetUTCMilliseconds::callAsFunction):
+ (KJS::DateProtoFuncSetSeconds::callAsFunction):
+ (KJS::DateProtoFuncSetUTCSeconds::callAsFunction):
+ (KJS::DateProtoFuncSetMinutes::callAsFunction):
+ (KJS::DateProtoFuncSetUTCMinutes::callAsFunction):
+ (KJS::DateProtoFuncSetHours::callAsFunction):
+ (KJS::DateProtoFuncSetUTCHours::callAsFunction):
+ (KJS::DateProtoFuncSetDate::callAsFunction):
+ (KJS::DateProtoFuncSetUTCDate::callAsFunction):
+ (KJS::DateProtoFuncSetMonth::callAsFunction):
+ (KJS::DateProtoFuncSetUTCMonth::callAsFunction):
+ (KJS::DateProtoFuncSetFullYear::callAsFunction):
+ (KJS::DateProtoFuncSetUTCFullYear::callAsFunction):
+ (KJS::DateProtoFuncSetYear::callAsFunction):
+ (KJS::DateProtoFuncGetYear::callAsFunction):
+ * kjs/date_object.h:
+ * kjs/lookup.cpp:
+ (KJS::Lookup::find):
+ * kjs/lookup.h:
+ (KJS::HashEntry::):
+ (KJS::staticFunctionGetter):
+ (KJS::staticValueGetter):
+ (KJS::getStaticPropertySlot):
+ (KJS::getStaticFunctionSlot):
+ (KJS::lookupPut):
+ * kjs/math_object.cpp:
+ (KJS::MathObjectImp::getOwnPropertySlot):
+ (KJS::MathProtoFuncAbs::callAsFunction):
+ (KJS::MathProtoFuncACos::callAsFunction):
+ (KJS::MathProtoFuncASin::callAsFunction):
+ (KJS::MathProtoFuncATan::callAsFunction):
+ (KJS::MathProtoFuncATan2::callAsFunction):
+ (KJS::MathProtoFuncCeil::callAsFunction):
+ (KJS::MathProtoFuncCos::callAsFunction):
+ (KJS::MathProtoFuncExp::callAsFunction):
+ (KJS::MathProtoFuncFloor::callAsFunction):
+ (KJS::MathProtoFuncLog::callAsFunction):
+ (KJS::MathProtoFuncMax::callAsFunction):
+ (KJS::MathProtoFuncMin::callAsFunction):
+ (KJS::MathProtoFuncPow::callAsFunction):
+ (KJS::MathProtoFuncRandom::callAsFunction):
+ (KJS::MathProtoFuncRound::callAsFunction):
+ (KJS::MathProtoFuncSin::callAsFunction):
+ (KJS::MathProtoFuncSqrt::callAsFunction):
+ (KJS::MathProtoFuncTan::callAsFunction):
+ * kjs/math_object.h:
+ (KJS::MathObjectImp::classInfo):
+ (KJS::MathObjectImp::):
+ * kjs/string_object.cpp:
+ (KJS::StringPrototype::getOwnPropertySlot):
+ (KJS::StringProtoFuncToString::callAsFunction):
+ (KJS::StringProtoFuncValueOf::callAsFunction):
+ (KJS::StringProtoFuncCharAt::callAsFunction):
+ (KJS::StringProtoFuncCharCodeAt::callAsFunction):
+ (KJS::StringProtoFuncConcat::callAsFunction):
+ (KJS::StringProtoFuncIndexOf::callAsFunction):
+ (KJS::StringProtoFuncLastIndexOf::callAsFunction):
+ (KJS::StringProtoFuncMatch::callAsFunction):
+ (KJS::StringProtoFuncSearch::callAsFunction):
+ (KJS::StringProtoFuncReplace::callAsFunction):
+ (KJS::StringProtoFuncSlice::callAsFunction):
+ (KJS::StringProtoFuncSplit::callAsFunction):
+ (KJS::StringProtoFuncSubstr::callAsFunction):
+ (KJS::StringProtoFuncSubstring::callAsFunction):
+ (KJS::StringProtoFuncToLowerCase::callAsFunction):
+ (KJS::StringProtoFuncToUpperCase::callAsFunction):
+ (KJS::StringProtoFuncToLocaleLowerCase::callAsFunction):
+ (KJS::StringProtoFuncToLocaleUpperCase::callAsFunction):
+ (KJS::StringProtoFuncLocaleCompare::callAsFunction):
+ (KJS::StringProtoFuncBig::callAsFunction):
+ (KJS::StringProtoFuncSmall::callAsFunction):
+ (KJS::StringProtoFuncBlink::callAsFunction):
+ (KJS::StringProtoFuncBold::callAsFunction):
+ (KJS::StringProtoFuncFixed::callAsFunction):
+ (KJS::StringProtoFuncItalics::callAsFunction):
+ (KJS::StringProtoFuncStrike::callAsFunction):
+ (KJS::StringProtoFuncSub::callAsFunction):
+ (KJS::StringProtoFuncSup::callAsFunction):
+ (KJS::StringProtoFuncFontcolor::callAsFunction):
+ (KJS::StringProtoFuncFontsize::callAsFunction):
+ (KJS::StringProtoFuncAnchor::callAsFunction):
+ (KJS::StringProtoFuncLink::callAsFunction):
+ * kjs/string_object.h:
+
+2007-11-08 Adam Roben <aroben@apple.com>
+
+ Windows build fix
+
+ Reviewed by Sam and Ada.
+
+ * wtf/MathExtras.h: Get rid of a circular #include dependency to fix
+ the build.
+
+2007-11-08 Adam Roben <aroben@apple.com>
+
+ Fix a precedence warning on Windows
+
+ * kjs/JSImmediate.h:
+ (KJS::JSImmediate::toBoolean):
+
+2007-11-08 Mark Rowe <mrowe@apple.com>
+
+ Build fix for JavaScriptGlue.
+
+ * wtf/MathExtras.h: Include stdlib.h for srand and RAND_MAX.
+
+2007-11-08 Darin Adler <darin@apple.com>
+
+ - Windows build fix
+
+ * kjs/JSImmediate.h: Include MathExtras.h rather than math.h since this file uses "signbit".
+
+2007-11-08 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Darin.
+
+ Replace the use of floats for immediate values with the use of integers for a 4.5% improvement in SunSpider.
+
+ Unfortunately this change results in NaN, +Inf, -Inf, and -0 being heap allocated now, but
+ we should now have faster array access, faster immediate to double conversion, and the
+ potential to further improve bitwise operators in future.
+
+ This also removes the need for unions to avoid strict aliasing problems when extracting
+ a value from immediates.
+
+ * kjs/JSImmediate.h:
+ (KJS::JSImmediate::trueImmediate):
+ (KJS::JSImmediate::falseImmediate):
+ (KJS::JSImmediate::undefinedImmediate):
+ (KJS::JSImmediate::nullImmediate):
+ (KJS::JSImmediate::toBoolean):
+ * kjs/value.h:
+ (KJS::jsNaN):
+
+2007-11-07 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Darin and Oliver.
+
+ Add evaluateToNumber parallel evaluation tree to speed up number operations.
+ Make ImmediateNumberNode a subclass of NumberNode.
+ Share evaluate logic between evaluate and evaluateToNumber using inline functions
+ There is still a lot of improvement to be made here.
+
+ SunSpider claims this is a 1.0% speedup overall (nbody 7.9%), base64 slowing 2.0%
+ Given the huge win that this prepares us for with simple type inferencing I see the small
+ regression in base64 being worth the substantial overall improvement.
+
+ * kjs/grammar.y:
+ * kjs/nodes.cpp:
+ (KJS::Node::evaluateToNumber):
+ (KJS::NumberNode::evaluate):
+ (KJS::NumberNode::evaluateToNumber):
+ (KJS::StringNode::evaluateToNumber):
+ (KJS::LocalVarAccessNode::inlineEvaluate):
+ (KJS::LocalVarAccessNode::evaluate):
+ (KJS::LocalVarAccessNode::evaluateToNumber):
+ (KJS::BracketAccessorNode::inlineEvaluate):
+ (KJS::BracketAccessorNode::evaluate):
+ (KJS::BracketAccessorNode::evaluateToNumber):
+ (KJS::NegateNode::evaluate):
+ (KJS::NegateNode::evaluateToNumber):
+ (KJS::MultNode::inlineEvaluateToNumber):
+ (KJS::MultNode::evaluate):
+ (KJS::MultNode::evaluateToNumber):
+ (KJS::DivNode::inlineEvaluateToNumber):
+ (KJS::DivNode::evaluate):
+ (KJS::DivNode::evaluateToNumber):
+ (KJS::ModNode::inlineEvaluateToNumber):
+ (KJS::ModNode::evaluate):
+ (KJS::ModNode::evaluateToNumber):
+ (KJS::throwOutOfMemoryErrorToNumber):
+ (KJS::addSlowCaseToNumber):
+ (KJS::add):
+ (KJS::addToNumber):
+ (KJS::AddNode::evaluateToNumber):
+ (KJS::SubNode::inlineEvaluateToNumber):
+ (KJS::SubNode::evaluate):
+ (KJS::SubNode::evaluateToNumber):
+ (KJS::valueForReadModifyAssignment):
+ (KJS::ReadModifyLocalVarNode::evaluate):
+ (KJS::ReadModifyResolveNode::evaluate):
+ (KJS::ReadModifyDotNode::evaluate):
+ (KJS::ReadModifyBracketNode::evaluate):
+ * kjs/nodes.h:
+ (KJS::Node::):
+ (KJS::NumberNode::):
+ (KJS::ImmediateNumberNode::):
+ (KJS::AddNode::precedence):
+ * kjs/nodes2string.cpp:
+ (KJS::NumberNode::streamTo):
+
+2007-11-07 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Eric.
+
+ Fix up initialization after being mangled in r27572, and remove the
+ ternary expression as extraCost will always be zero for the numeric
+ heap.
+
+ * kjs/collector.cpp:
+ (KJS::Collector::heapAllocate):
+
+2007-11-07 Mark Rowe <mrowe@apple.com>
+
+ Gtk build fix.
+
+ * kjs/regexp_object.cpp:
+
+2007-11-07 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Beth Dakin.
+
+ Eliminated a bogus (though compiled-out) branch in the collector.
+
+ * kjs/collector.cpp:
+ (KJS::Collector::heapAllocate):
+
+2007-11-06 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Fixed part of http://bugs.webkit.org/show_bug.cgi?id=15861
+ 5.8% of string-validate-input.js is spent creating RegExpImps
+
+ Put RegExpImp properties into a static hashtable to avoid a slew of
+ PropertyMap churn when creating a RegExpImp.
+
+ Factored important bits of regular expression implementation out of
+ RegExpImp (the JS object) and into RegExp (the PCRE wrapper class),
+ making RegExp a ref-counted class. (This will help later.)
+
+ Removed PCRE_POSIX support because I didn't quite know how to test it
+ and keep it working with these changes.
+
+ 1.1% SunSpider speedup. 5.8% speedup on string-validate-input.js.
+
+ * kjs/regexp.h: A few interface changes:
+ 1. Renamed "subpatterns()" => "numSubpatterns()"
+ 2. Made flag enumeration private and replaced it with public getters for
+ specific flags.
+ 3. Made RegExp ref-counted so RegExps can be shared by RegExpImps.
+ 4. Made RegExp take a string of flags instead of an int, eliminating
+ duplicated flag parsing code elsewhere.
+
+ * kjs/regexp_object.cpp:
+ (KJS::RegExpProtoFunc::callAsFunction): For RegExp.compile:
+ - Fixed a bug where compile(undefined) would throw an exception.
+ - Removed some now-redundant code.
+ - Used RegExp sharing to eliminate an allocation and a bunch of
+ PropertyMap thrash. (Not a big win since compile is a deprecated
+ function. I mainly did this to test the plubming.)
+
+2007-11-07 Simon Hausmann <hausmann@kde.org>
+
+ Reviewed by nobody, Qt/Windows build fix.
+
+ JavaScriptCore.pri expects OBJECTS_DIR to be set, so set it in
+ testkjs.pro, too, where it's included from.
+
+ * kjs/testkjs.pro:
+
+2007-11-07 Simon Hausmann <shausman@trolltech.com>
+
+ Reviewed by Lars.
+
+ Fix "nmake clean" for the Qt/Windows build by replacing tmp/ with a variable that ends with the correct type of slash/backslash depending on the choice of compiler/make tool.
+
+ * JavaScriptCore.pri:
+ * pcre/pcre.pri:
+
+2007-11-07 Lars Knoll <lars@trolltech.com>
+
+ Reviewed by Simon.
+
+ fix umemcasecmp
+
+ Pretty embarrassing bug. Has the potential to fix quite a few test failures.
+
+ * wtf/unicode/qt4/UnicodeQt4.h:
+ (WTF::Unicode::umemcasecmp):
+
+2007-11-06 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Eric.
+
+ - only collect when the heap is full, unless we have lots of extra cost garbage
+
+ 1.1% SunSpider speedup.
+
+ This shouldn't hit memory use much since the extra space in those
+ blocks hangs around either way.
+
+ * kjs/collector.cpp:
+ (KJS::Collector::heapAllocate):
+ (KJS::Collector::collect): Fix logic error that reversed the sense of collect's
+ return value.
+
+2007-11-06 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej.
+
+ Avoid unnecessarily boxing the result from post inc/decrement for 0.3% gain in sunspider
+
+ We now convert the common 'for (...; ...; <var>++) ...' to the semantically identical
+ 'for (...; ...; ++<var>) ...'.
+
+ * kjs/nodes.cpp:
+ (KJS::PostIncResolveNode::optimizeForUnnecessaryResult):
+ (KJS::PostIncLocalVarNode::evaluate):
+ (KJS::PostIncLocalVarNode::optimizeForUnnecessaryResult):
+ (KJS::PostDecResolveNode::optimizeForUnnecessaryResult):
+ (KJS::PostDecLocalVarNode::evaluate):
+ (KJS::PostDecLocalVarNode::optimizeForUnnecessaryResult):
+ * kjs/nodes.h:
+ (KJS::PrePostResolveNode::):
+ (KJS::PostIncResolveNode::):
+ (KJS::PostIncLocalVarNode::):
+ (KJS::PostDecResolveNode::):
+ (KJS::PostDecLocalVarNode::):
+ (KJS::PreIncResolveNode::):
+ (KJS::PreDecResolveNode::):
+ (KJS::ForNode::ForNode):
+
+2007-11-06 Eric Seidel <eric@webkit.org>
+
+ Reviewed by darin.
+
+ This fixes a regressed layout test for string + object
+
+ SunSpider claims this was an overall 0.3% speedup, although some individual tests were slower.
+
+ * kjs/nodes.cpp:
+ (KJS::add): remove erroneous "fast path" for string + *
+
+2007-11-06 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Eric Seidel.
+
+ Added toJSNumber, a fast path for converting a JSValue to a JS number,
+ and deployed it in postfix expressions. In the fast case this
+ eliminates a call to jsNumber.
+
+ 0.4% speedup on SunSpider.
+
+ * ChangeLog:
+ * kjs/nodes.cpp:
+ (KJS::PostIncResolveNode::evaluate):
+ (KJS::PostIncLocalVarNode::evaluate):
+ (KJS::PostDecResolveNode::evaluate):
+ (KJS::PostDecLocalVarNode::evaluate):
+ (KJS::PostIncBracketNode::evaluate):
+ (KJS::PostDecBracketNode::evaluate):
+ (KJS::PostIncDotNode::evaluate):
+ (KJS::PostDecDotNode::evaluate):
+ (KJS::UnaryPlusNode::evaluate):
+ * kjs/value.h:
+ (KJS::JSValue::toJSNumber):
+
+2007-11-06 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - http://bugs.webkit.org/show_bug.cgi?id=15846
+ REGRESSION (r27387): Memory corruption when running fast/js/kde/delete.html
+
+ There was a mistake in the algorithm used to find an empty slot in the property
+ map entries vector; when we were putting in a new property value and not overwriting
+ an existing deleted sentinel, we would enlarge the entries vector, but would not
+ overwrite the stale data that's in the new part. It was easy to pin this down by
+ turning on property map consistency checks -- I never would have landed with this
+ bug if I had run the regression tests once with consistency checks on!
+
+ * kjs/property_map.cpp: (KJS::PropertyMap::put): Changed logic for the case where
+ foundDeletedElement is false to always use the item at the end of the entries vector.
+ Also allowed me to merge with the logic for the "no deleted sentinels at all" case.
+
+2007-11-06 Oliver Hunt <oliver@apple.com>
+
+ RS=Darin.
+
+ Fix previous patch to use a 3 bit shift, a 16 bit shift causes a regression in sunspider.
+
+ * kjs/nodes.cpp:
+ (KJS::add):
+
+2007-11-06 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Darin.
+
+ Replace boolean comparisons in AddNode with mask
+ comparisons for a 0.2% improvement in sunspider.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * kjs/nodes.cpp:
+ (KJS::add):
+
+2007-11-06 Eric Seidel <eric@webkit.org>
+
+ Reviewed by darin.
+
+ SunSpider claims this is a 1.1% speedup.
+
+ * kjs/nodes.cpp:
+ (KJS::throwOutOfMemoryError): Added, non inline.
+ (KJS::addSlowCase): renamed from add(), non inline.
+ (KJS::add): add fast path for String + String, Number + Number and String + *
+
+2007-11-06 Eric Seidel <eric@webkit.org>
+
+ Reviewed by mjs.
+
+ Avoid more UString creation.
+
+ SunSpider claims this is a 0.4% speedup.
+
+ * kjs/regexp_object.cpp:
+ (KJS::RegExpObjectImp::construct): use UString::find(UChar)
+
+2007-11-05 Mark Rowe <mrowe@apple.com>
+
+ Mac build fix.
+
+ * kjs/array_object.cpp:
+ (KJS::ArrayProtoFunc::callAsFunction):
+
+2007-11-05 Adam Roben <aroben@apple.com>
+
+ Windows build fix
+
+ * kjs/list.h:
+
+2007-11-05 Mark Rowe <mrowe@apple.com>
+
+ Build fix. Add missing #include.
+
+ * kjs/operations.cpp:
+
+2007-11-05 Eric Seidel <eric@webkit.org>
+
+ Reviewed by mjs.
+
+ Remove another call to toString(exec)
+
+ SunSpider claims this is a 0.5% speedup.
+
+ * kjs/operations.cpp:
+ (KJS::equal): remove another toString
+
+2007-11-05 Eric Seidel <eric@webkit.org>
+
+ * kjs/operations.cpp:
+ (KJS::equal): correct broken change.
+
+2007-11-05 Eric Seidel <eric@webkit.org>
+
+ Reviewed by mjs.
+
+ Remove one more call to toString(exec).
+
+ SunSpider claims this is a 0.7% speedup.
+
+ * kjs/operations.cpp:
+ (KJS::equal): remove a call to toString()
+
+2007-11-05 Mark Rowe <mrowe@apple.com>
+
+ Gtk build fix.
+
+ * pcre/pcre.pri:
+
+2007-11-05 Mark Rowe <mrowe@apple.com>
+
+ Gtk build fix.
+
+ * kjs/list.cpp:
+
+2007-11-05 Geoffrey Garen <ggaren@apple.com>
+
+ Touched a file to test my new HTTP access.
+
+ * kjs/scope_chain.cpp:
+
+2007-11-05 Alp Toker <alp@atoker.com>
+
+ Unreviewed build fix for qmake-based ports.
+
+ Someone with a better understanding of qmake still needs to sort out
+ the INCLUDEPATH/DEPENDPATH mess.
+
+ * JavaScriptCore.pri:
+
+2007-11-05 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ http://bugs.webkit.org/show_bug.cgi?id=15835
+
+ Switched List implementation from a custom heap allocator to an inline
+ Vector, for a disappointing .5% SunSpider speedup.
+
+ Also renamed List::slice to List::getSlice because "get" is the
+ conventional prefix for functions returning a value through an out
+ parameter.
+
+ * kjs/array_object.cpp:
+ (KJS::ArrayProtoFunc::callAsFunction): Removed some redundant function
+ calls and memory accesses.
+
+ * kjs/bool_object.cpp:
+ (BooleanObjectImp::construct): Removed questionable use of iterator.
+
+ * kjs/list.cpp:
+ * kjs/list.h: New List class, implemented in terms of Vector. Two
+ interesting differences:
+ 1. The inline capacity is 8, not 5. Many of the Lists constructed
+ during a SunSpider run are larger than 5; almost none are larger
+ than 8.
+
+ 2. The growth factor is 4, not 2. Since we can guarantee that Lists
+ aren't long-lived, we can grow them more aggressively, to avoid
+ excessive copying.
+
+ * kjs/regexp_object.cpp:
+ (RegExpObjectImp::construct): Removed redundant function calls.
+
+ * kjs/string_object.cpp:
+ (KJS::StringObjectImp::construct): Removed questionable use of iterator.
+
+ * wtf/Vector.h:
+ (WTF::::uncheckedAppend): Added a fast, unchecked version of append.
+
+2007-11-05 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Alp Toker.
+
+ Add DEPENDPATH to JavaScriptCore and pcre to help qmake with dependencies.
+
+ * JavaScriptCore.pri:
+ * pcre/pcre.pri:
+
+2007-11-04 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - http://bugs.webkit.org/show_bug.cgi?id=15826
+ optimize opcode loop and case insensitive ASCII compares for a 30% speedup
+
+ SunSpider says it's 2.6% faster overall, 32.5% in the regular expression tests.
+
+ * pcre/pcre_internal.h: Added OP_ASCII_CHAR and OP_ASCII_LETTER_NC.
+
+ * pcre/pcre_compile.c:
+ (find_fixedlength): Added cases for OP_ASCII_CHAR and OP_ASCII_LETTER_NC. Also
+ added OP_NOT since there was no reason it should not be in here.
+ (could_be_empty_branch): Ditto.
+ (compile_branch): Streamlined all the single-character cases; there was a bit of
+ duplicate code. Added cases for OP_ASCII_CHAR and OP_ASCII_LETTER_NC as needed.
+ But in particular, compile to those opcodes when the single character match is
+ ASCII.
+ (find_firstassertedchar): Added cases for OP_ASCII_CHAR and OP_ASCII_LETTER_NC.
+
+ * pcre/pcre_exec.c: (match): Removed the "min", "minimize", and "op" fields from
+ the matchframe, after I discovered that none of them needed to be saved and restored
+ across recursive match calls. Also eliminated the ignored result field from the
+ matchframe, since I discovered that rrc ("recursive result code") was already the
+ exact same thing. Moved the handling of opcodes higher than OP_BRA into the default
+ statement of the switch instead of doing them before the switch. This removes a
+ branch from each iteration of the opcode interpreter, just as removal of "op"
+ removed at least one store from each iteration. Last, but not least, add the
+ OP_ASCII_CHAR and OP_ASCII_LETTER_NC functions. Neither can ever match a
+ surrogate pair and the letter case can be handled efficiently.
+
+2007-11-04 Darin Adler <darin@apple.com>
+
+ * pcre/pcre_exec.c: (match): Try to fix the Windows build by removing unreachable code.
+
+2007-11-03 Darin Adler <darin@apple.com>
+
+ - fix non-Mac builds; remove some more unused PCRE stuff
+
+ * pcre/pcre_compile.c:
+ (compile_branch): Removed branch chain and some unused ESC values.
+ (compile_regex): Ditto.
+ (jsRegExpCompile): Ditto.
+ * pcre/pcre_exec.c:
+ (match): Removed unused branch targets. Don't use macros any more.
+ (jsRegExpExecute): More of the same.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Update for removed files.
+ * JavaScriptCore.xcodeproj/project.pbxproj: Ditto.
+ * pcre/pcre.pri: Ditto.
+
+ * pcre/MERGING: Removed.
+ * pcre/pcre_fullinfo.c: Removed.
+ * pcre/pcre_get.c: Removed.
+ * pcre/pcre_internal.h:
+ * pcre/ucp.h: Removed.
+
+2007-11-03 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - http://bugs.webkit.org/show_bug.cgi?id=15821
+ remove unused PCRE features for speed
+
+ A first step toward removing the PCRE features we don't use.
+ This gives a 0.8% speedup on SunSpider, and a 6.5% speedup on
+ the SunSpider regular expression test.
+
+ Replaced the public interface with one that doesn't use the
+ name PCRE. Removed code we don't need for JavaScript and various
+ configurations we don't use. This is in preparation for still
+ more changes in the future. We'll probably switch to C++ and
+ make some even more significant changes to the regexp engine
+ to get some additional speed.
+
+ There's probably additional unused stuff that I haven't
+ deleted yet.
+
+ This does mean that our PCRE is now a fork, but I think that's
+ not really a big deal.
+
+ * JavaScriptCore.exp: Remove the 5 old entry points and add
+ the 3 new entry points for WebCore's direct use of the regular
+ expression engine.
+
+ * kjs/config.h: Remove the USE(PCRE16) define. I decided to flip
+ its sense and now there's a USE(POSIX_REGEX) instead, which should
+ probably not be set by anyone. Maybe later we'll just get rid of it
+ altogether.
+
+ * kjs/regexp.h:
+ * kjs/regexp.cpp:
+ (KJS::RegExp::RegExp): Switch to new jsRegExp function names and
+ defines. Cut down on the number of functions used.
+ (KJS::RegExp::~RegExp): Ditto.
+ (KJS::RegExp::match): Ditto.
+
+ * pcre/dftables.c: (main): Get rid of ctype_letter and ctype_meta,
+ which are unused.
+
+ * pcre/pcre-config.h: Get rid of EBCIDIC, PCRE_DATA_SCOPE, const,
+ size_t, HAVE_STRERROR, HAVE_MEMMOVE, HAVE_BCOPY, NEWLINE,
+ POSIX_MALLOC_THRESHOLD, NO_RECURSE, SUPPORT_UCP, SUPPORT_UTF8,
+ and JAVASCRIPT. These are all no longer configurable in our copy
+ of the library.
+
+ * pcre/pcre.h: Remove the macro-based kjs prefix hack, the PCRE
+ version macros, PCRE_UTF16, the code to set up PCRE_DATA_SCOPE,
+ the include of <stdlib.h>, and most of the constants and
+ functions defined in this header. Changed the naming scheme to
+ use a JSRegExp prefix rather than a pcre prefix. In the future,
+ we'll probably change this to be a C++ header.
+
+ * pcre/pcre_compile.c: Removed all unused code branches,
+ including many whole functions and various byte codes.
+ Kept changes outside of removal to a minimum.
+ (check_escape):
+ (first_significant_code):
+ (find_fixedlength):
+ (find_recurse):
+ (could_be_empty_branch):
+ (compile_branch):
+ (compile_regex):
+ (is_anchored):
+ (is_startline):
+ (find_firstassertedchar):
+ (jsRegExpCompile): Renamed from pcre_compile2 and changed the
+ parameters around a bit.
+ (jsRegExpFree): Added.
+
+ * pcre/pcre_exec.c: Removed many unused opcodes and variables.
+ Also started tearing down the NO_RECURSE mechanism since it's
+ now the default. In some cases there were things in the explicit
+ frame that could be turned into plain old local variables and
+ other small like optimizations.
+ (pchars):
+ (match_ref):
+ (match): Changed parameters quite a bit since it's now not used
+ recursively.
+ (jsRegExpExecute): Renamed from pcre_exec.
+
+ * pcre/pcre_internal.h: Get rid of PCRE_DEFINITION, PCRE_SPTR,
+ PCRE_IMS, PCRE_ICHANGED, PCRE_NOPARTIAL, PCRE_STUDY_MAPPED,
+ PUBLIC_OPTIONS, PUBLIC_EXEC_OPTIONS, PUBLIC_DFA_EXEC_OPTIONS,
+ PUBLIC_STUDY_OPTIONS, MAGIC_NUMBER, 16 of the opcodes,
+ _pcre_utt, _pcre_utt_size, _pcre_try_flipped, _pcre_ucp_findprop,
+ and _pcre_valid_utf8. Also moved pcre_malloc and pcre_free here.
+
+ * pcre/pcre_maketables.c: Changed to only compile in dftables.
+ Also got rid of many of the tables that we don't use.
+
+ * pcre/pcre_tables.c: Removed the unused Unicode property tables.
+
+ * pcre/pcre_ucp_searchfuncs.c: Removed everything except for
+ _pcre_ucp_othercase.
+
+ * pcre/pcre_xclass.c: (_pcre_xclass): Removed uneeded support
+ for classes based on Unicode properties.
+
+ * wtf/FastMallocPCRE.cpp: Removed unused bits. It would be good
+ to eliminate this completely, but we need the regular expression
+ code to be C++ first.
+
+ * pcre/pcre_fullinfo.c:
+ * pcre/pcre_get.c:
+ * pcre/ucp.h:
+ Files that are no longer needed. I didn't remove them with this
+ check-in, because I didn't want to modify all the project files.
+
+2007-11-03 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Sam.
+
+ - remove NaN check from JSImmediate::fromDouble for 0.5% SunSpider speedup
+
+ It turns out that doing this check costs more than it saves.
+
+ * kjs/JSImmediate.h:
+ (KJS::JSImmediate::fromDouble):
+
+2007-11-03 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Oliver.
+
+ Remove dummy variable from ClassInfo reducing the size of the struct by 1 word.
+ The variable had been kept around for binary compatibility, but since nothing
+ else is there is no point in continuing to keep it around.
+
+ * API/JSCallbackConstructor.cpp:
+ * API/JSCallbackFunction.cpp:
+ * API/JSCallbackObject.cpp:
+ * bindings/objc/objc_runtime.mm:
+ * bindings/runtime_array.cpp:
+ * bindings/runtime_object.cpp:
+ * kjs/array_instance.cpp:
+ * kjs/array_object.cpp:
+ * kjs/bool_object.cpp:
+ * kjs/date_object.cpp:
+ * kjs/error_object.cpp:
+ * kjs/function.cpp:
+ * kjs/internal.cpp:
+ * kjs/lookup.h:
+ * kjs/math_object.cpp:
+ * kjs/number_object.cpp:
+ * kjs/object.h:
+ * kjs/regexp_object.cpp:
+ * kjs/string_object.cpp:
+
+2007-11-03 Kevin McCullough <kmccullough@apple.com>
+
+ - Updated testkjs results to make the build bots green until we
+ can fix the tests that are failing. The new failures are in DST.
+
+ * tests/mozilla/expected.html:
+
+2007-11-03 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Adam.
+
+ - don't print the var twice for ForInNodes with a var declaration
+
+ * kjs/nodes2string.cpp:
+ (KJS::ForInNode::streamTo):
+
+2007-11-03 Darin Adler <darin@apple.com>
+
+ * pcre/pcre_compile.c: (check_escape): Windows build fix. Get rid of
+ C-incompatible declaration.
+
+2007-11-03 Mark Rowe <mrowe@apple.com>
+
+ Gtk build fix.
+
+ * kjs/nodes.cpp: Add missing include.
+
+2007-11-03 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=15814
+ <rdar://problem/5536644> fast/js/kde/encode_decode_uri.html fails
+
+ These changes cause us to match the JavaScript specification and pass the
+ fast/js/kde/encode_decode_uri.html test.
+
+ * kjs/function.cpp: (KJS::encode): Call the UTF-8 string conversion in its
+ new strict mode, throwing an exception if there are malformed UTF-16 surrogate
+ pairs in the text.
+
+ * kjs/ustring.h: Added a strict version of the UTF-8 string conversion.
+ * kjs/ustring.cpp:
+ (KJS::decodeUTF8Sequence): Removed code to disallow U+FFFE and U+FFFF; while
+ those might be illegal in some sense, they aren't supposed to get any special
+ handling in the place where this function is currently used.
+ (KJS::UString::UTF8String): Added the strictness.
+
+2007-11-03 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - http://bugs.webkit.org/show_bug.cgi?id=15812
+ some JavaScript tests (from the Mozilla test suite) are failing
+
+ Two or three fixes get 7 more of the Mozilla tests passing.
+ This gets us down from 61 failing tests to 54.
+
+ * kjs/interpreter.h: (KJS::Interpreter::builtinRegExp):
+ Made this inline and gave it a more specific type. Some day we should
+ probably do that for all of these -- might even get a bit of a speed
+ boost from it.
+ * kjs/interpreter.cpp: Removed Interpreter::builtinRegExp now that it's
+ inline in the header.
+
+ * kjs/regexp_object.h:
+ * kjs/regexp_object.cpp:
+ (KJS::RegExpProtoFunc::callAsFunction): Moved test and exec out of the
+ switch statement into the RegExpImp object, so they can be shared with
+ RegExpImp::callAsFunction.
+ (KJS::RegExpImp::match): Added. Common code used by both test and exec.
+ (KJS::RegExpImp::test): Added.
+ (KJS::RegExpImp::exec): Added.
+ (KJS::RegExpImp::implementsCall): Added.
+ (KJS::RegExpImp::callAsFunction): Added.
+ (KJS::RegExpObjectImpPrivate::RegExpObjectImpPrivate): Initialize
+ lastInput to null rather than empty string -- we take advantage of the
+ difference in RegExpImp::match.
+ (KJS::RegExpObjectImp::input): Added. No reason to go through hash tables
+ just to get at a field like this.
+
+ * pcre/pcre_compile.c: (check_escape): Changed the \u handling to match
+ the JavaScript specification. If there are not 4 hex digits after the \u,
+ then it's processed as if it wasn't an escape sequence at all.
+
+ * pcre/pcre_internal.h: Added IS_NEWLINE, with the appropriate definition
+ for JavaScript (4 specific Unicode values).
+ * pcre/pcre_exec.c:
+ (match): Changed all call sites to use IS_NEWLINE.
+ (pcre_exec): Ditto.
+
+ * tests/mozilla/expected.html: Updated to expect 7 more successful tests.
+
+2007-11-03 David D. Kilzer <ddkilzer@webkit.org>
+
+ Sort files(...); sections of Xcode project files.
+
+ Rubber-stamped by Darin.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2007-11-03 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver.
+
+ - remove VarDeclListNode and simplify VarDeclNode evaluation for 0.4% SunSpider speedup
+
+ * kjs/grammar.y:
+ * kjs/nodes.cpp:
+ (KJS::VarDeclNode::optimizeVariableAccess):
+ (KJS::VarDeclNode::getDeclarations):
+ (KJS::VarDeclNode::handleSlowCase):
+ (KJS::VarDeclNode::evaluateSingle):
+ (KJS::VarDeclNode::evaluate):
+ (KJS::VarStatementNode::execute):
+ * kjs/nodes.h:
+ (KJS::VarDeclNode::):
+ (KJS::VarStatementNode::):
+ * kjs/nodes2string.cpp:
+ (KJS::VarDeclNode::streamTo):
+
+2007-11-03 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Darin.
+
+ http://bugs.webkit.org/show_bug.cgi?id=15800
+ REGRESSION (r27303): RegExp leaks
+
+ * kjs/regexp_object.h:
+ (KJS::RegExpImp::setRegExp):
+ (KJS::RegExpImp::regExp):
+ (KJS::RegExpImp::classInfo):
+ * kjs/regexp_object.cpp:
+ (RegExpImp::RegExpImp):
+ (RegExpImp::~RegExpImp):
+ Renamed reg member variable to m_regExp, changed it to use OwnPtr.
+
+2007-11-02 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver.
+
+ - add SourceElements as a typedef for Vector<RefPtr<StatementNode> >.
+
+ * kjs/grammar.y:
+ * kjs/nodes.cpp:
+ (KJS::statementListPushFIFO):
+ (KJS::statementListGetDeclarations):
+ (KJS::statementListInitializeDeclarationStacks):
+ (KJS::statementListInitializeVariableAccessStack):
+ (KJS::statementListExecute):
+ (KJS::BlockNode::BlockNode):
+ (KJS::FunctionBodyNode::FunctionBodyNode):
+ (KJS::ProgramNode::ProgramNode):
+ * kjs/nodes.h:
+ (KJS::CaseClauseNode::):
+
+2007-11-02 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - http://bugs.webkit.org/show_bug.cgi?id=15791
+ change property map data structure for less memory use, better speed
+
+ The property map now has an array of indices and a separate array of
+ property map entries. This slightly slows down lookup because of a second
+ memory acess, but makes property maps smaller and faster to iterate in
+ functions like mark().
+
+ SunSpider says this is 1.2% faster, although it makes the bitwise-end test
+ more than 10% slower. To fix that we'll need to optimize global variable lookup.
+
+ * kjs/property_map.cpp:
+ (KJS::PropertyMapEntry::PropertyMapEntry):
+ (KJS::PropertyMapHashTable::entries):
+ (KJS::PropertyMapHashTable::allocationSize):
+ (KJS::SavedProperties::SavedProperties):
+ (KJS::SavedProperties::~SavedProperties):
+ (KJS::PropertyMap::checkConsistency):
+ (KJS::PropertyMap::~PropertyMap):
+ (KJS::PropertyMap::clear):
+ (KJS::PropertyMap::get):
+ (KJS::PropertyMap::getLocation):
+ (KJS::PropertyMap::put):
+ (KJS::PropertyMap::insert):
+ (KJS::PropertyMap::createTable):
+ (KJS::PropertyMap::rehash):
+ (KJS::PropertyMap::remove):
+ (KJS::PropertyMap::mark):
+ (KJS::comparePropertyMapEntryIndices):
+ (KJS::PropertyMap::containsGettersOrSetters):
+ (KJS::PropertyMap::getEnumerablePropertyNames):
+ (KJS::PropertyMap::save):
+ (KJS::PropertyMap::restore):
+ * kjs/property_map.h:
+
+2007-11-02 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - http://bugs.webkit.org/show_bug.cgi?id=15807
+ HashMap needs a take() function that combines get and remove
+
+ * wtf/HashMap.h: Added take function. Simplistic implementation for now,
+ but still does only one hash table lookup.
+
+ * kjs/array_instance.cpp: (KJS::ArrayInstance::put): Use take rather than
+ a find followed by a remove.
+
+2007-11-02 David Carson <dacarson@gmail.com>
+
+ Reviewed by Darin.
+
+ Fix compiler warning "warning: suggest parentheses around && within ||"
+ http://bugs.webkit.org/show_bug.cgi?id=15764
+
+ * kjs/value.h: (KJS::JSValue::isNumber): Add parentheses.
+
+2007-11-01 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ In preparation for making List a simple stack-allocated Vector:
+
+ Removed all instances of List copying and/or assignment, and made List
+ inherit from Noncopyable.
+
+ Functions that used to return a List by copy now take List& out
+ parameters.
+
+ Layout tests and JS tests pass.
+
+ * kjs/list.cpp:
+ (KJS::List::slice): Replaced copyTail with a more generic slice
+ alternative. (JavaScriptCore only calls slice(1), but WebCore calls
+ slice(2)).
+
+2007-11-01 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Fixed http://bugs.webkit.org/show_bug.cgi?id=15785
+ REGRESSION(r27344): Crash on load at finance.yahoo.com
+
+ Reverted a small portion of my last check-in. (The speedup and the List
+ removal are still there, though.)
+
+ ActivationImp needs to hold a pointer to its function, and mark that
+ pointer (rather than accessing its function through its ExecState, and
+ counting on the active scope to mark its function) because a closure
+ can cause an ActivationImp to outlive its ExecState along with any
+ active scope.
+
+ * kjs/ExecState.cpp:
+ (KJS::ExecState::ExecState):
+ * kjs/function.cpp:
+ (KJS::FunctionImp::~FunctionImp):
+ (KJS::ActivationImp::ActivationImp):
+ * kjs/function.h:
+ (KJS::ActivationImp::ActivationImpPrivate::ActivationImpPrivate):
+
+ Also made HashTable a little more crash-happy in debug builds, so
+ problems like this will show up earlier:
+
+ * wtf/HashTable.h:
+ (WTF::HashTable::~HashTable):
+
+2007-11-01 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Adam Roben.
+
+ Addressed some of Darin's review comments.
+
+ Used perl -p, which is the shorthand while(<>) {}.
+
+ Made sure not to suppress bison's output.
+
+ Added line to removed bison_out.txt, since this script removes other
+ intermediate files, too.
+
+ * DerivedSources.make:
+
+2007-11-01 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Removed List from ActivationImp, in preparation for making all lists
+ stack-allocated.
+
+ Tests pass.
+
+ 1.0% speedup on SunSpider, presumably due to reduced List refcount thrash.
+
+ * kjs/ExecState.cpp:
+ (KJS::ExecState::ExecState):
+ (KJS::ExecState::~ExecState):
+ * kjs/function.cpp:
+ (KJS::ActivationImp::ActivationImp):
+ (KJS::ActivationImp::createArgumentsObject):
+ * kjs/function.h:
+ (KJS::ActivationImp::ActivationImpPrivate::ActivationImpPrivate):
+
+2007-11-01 Adam Roben <aroben@apple.com>
+
+ Use jsNumberCell instead of jsNumber when converting double constants to JSValues
+
+ This fixes fast/js/math.html, ecma/Date/15.9.5.10-1.js, and
+ ecma/Date/15.9.5.12-1.js, which were suffering from a bug in MSVC.
+
+ It also gets rid of an MSVC warning that we previously had to silence.
+
+ Reviewed by Geoff.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Turn
+ back on the "overflow in constant arithmetic" warning.
+ * kjs/number_object.cpp:
+ (NumberObjectImp::getValueProperty): Use jsNumberCell instead of
+ jsNumber.
+
+2007-10-31 Adam Roben <aroben@apple.com>
+
+ Windows build fix
+
+ * kjs/ExecState.h:
+
+2007-10-31 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver.
+
+ - shave some cycles off of local storage access for a 1% SunSpider speedup
+
+ Keep the LocalStorage pointer in the ExecState, instead of getting
+ it from the ActivationImp all the time.
+
+ * kjs/ExecState.cpp:
+ (KJS::ExecState::updateLocalStorage):
+ * kjs/ExecState.h:
+ (KJS::ExecState::localStorage):
+ * kjs/nodes.cpp:
+ (KJS::LocalVarAccessNode::evaluate):
+ (KJS::LocalVarFunctionCallNode::evaluate):
+ (KJS::PostIncLocalVarNode::evaluate):
+ (KJS::PostDecLocalVarNode::evaluate):
+ (KJS::LocalVarTypeOfNode::evaluate):
+ (KJS::PreIncLocalVarNode::evaluate):
+ (KJS::PreDecLocalVarNode::evaluate):
+ (KJS::ReadModifyLocalVarNode::evaluate):
+ (KJS::AssignLocalVarNode::evaluate):
+ (KJS::FunctionBodyNode::processDeclarationsForFunctionCode):
+
+2007-10-31 Adam Roben <aroben@apple.com>
+
+ Fix a crash on launch due to a static initializer race
+
+ We now use fast inline assembler spinlocks which can be statically
+ initialized at compile time.
+
+ As a side benefit, this speeds up SunSpider by 0.4%.
+
+ Reviewed by Oliver.
+
+ * wtf/FastMalloc.cpp:
+ * wtf/TCSpinLock.h:
+ (TCMalloc_SpinLock::Lock):
+ (TCMalloc_SpinLock::Unlock):
+ (TCMalloc_SlowLock):
+ * wtf/TCSystemAlloc.cpp:
+
+2007-10-31 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Sam.
+
+ - Corrected spelling.
+
+ * wtf/HashTraits.h:
+
+2007-10-31 Mark Rowe <mrowe@apple.com>
+
+ Further Gtk build fixage.
+
+ * kjs/regexp_object.cpp:
+
+2007-10-31 Mark Rowe <mrowe@apple.com>
+
+ Gtk build fix.
+
+ * kjs/regexp.h:
+
+2007-10-31 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=15749
+ RegExp/RegExpObjectImp cause needless UString creation
+
+ Speeds things up 0.4% according to SunSpider.
+
+ * kjs/config.h: Define USE(PCRE16) instead of HAVE(PCREPOSIX),
+ because this library doesn't use the real PCRE -- it uses its
+ own PCRE that works on UTF-16.
+
+ * kjs/regexp.h: Removed a few unused functions. Changed the ifdef.
+ Use Noncopyable. Change the return value of match.
+ * kjs/regexp.cpp:
+ (KJS::RegExp::RegExp): Call pcre_compile2, for a slight speed boost.
+ (KJS::RegExp::~RegExp): PCRE16 rather than PCREPOSIX.
+ (KJS::RegExp::match): Change to return the position as an int and the
+ ovector as a OwnArrayPtr<int> for efficiency and clearer storage management.
+
+ * kjs/regexp_object.h: Change performMatch and arrayOfMatches to no longer
+ require a result string.
+ * kjs/regexp_object.cpp:
+ (RegExpProtoFunc::callAsFunction): Update for new signature of performMatch.
+ (RegExpObjectImp::performMatch): Change so it doesn't return a string.
+ (RegExpObjectImp::arrayOfMatches): Simplify by unifying the handling of
+ the main result with the backreferences; now it doesn't need to take
+ a result parameter.
+ (RegExpObjectImp::getBackref): Minor tweaks.
+ (RegExpObjectImp::getLastParen): Ditto.
+ (RegExpObjectImp::getLeftContext): Ditto.
+ (RegExpObjectImp::getRightContext): Ditto.
+ (RegExpObjectImp::getValueProperty): Change LastMatch case to call
+ getBackref(0) so we don't need a separate getLastMatch function.
+
+ * kjs/string_object.cpp:
+ (KJS::replace): Update to use new performMatch, including merging the
+ matched string section with the other substrings.
+ (KJS::StringProtoFunc::callAsFunction): Update functions to use the
+ new performMatch and match. Also change to use OwnArrayPtr.
+
+2007-10-31 Oliver Hunt <oliver@apple.com>
+
+ * kjs/nodes.h: include OwnPtr.h
+
+2007-10-31 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej.
+
+ Remove SourceCodeElement class and replaced with a Vector for a 0.8% gain on sunspider
+
+ * kjs/grammar.y:
+ * kjs/nodes.cpp:
+ (KJS::statementListPushFIFO):
+ (KJS::statementListGetDeclarations):
+ (KJS::statementListInitializeDeclarationStacks):
+ (KJS::statementListInitializeVariableAccessStack):
+ (KJS::statementListExecute):
+ (KJS::BlockNode::optimizeVariableAccess):
+ (KJS::BlockNode::BlockNode):
+ (KJS::BlockNode::getDeclarations):
+ (KJS::BlockNode::execute):
+ (KJS::CaseClauseNode::optimizeVariableAccess):
+ (KJS::CaseClauseNode::getDeclarations):
+ (KJS::CaseClauseNode::evalStatements):
+ (KJS::FunctionBodyNode::initializeDeclarationStacks):
+ (KJS::FunctionBodyNode::optimizeVariableAccess):
+ * kjs/nodes.h:
+ * kjs/nodes2string.cpp:
+ (KJS::statementListStreamTo):
+ (KJS::BlockNode::streamTo):
+ (KJS::CaseClauseNode::streamTo):
+
+2007-10-30 Mark Rowe <mrowe@apple.com>
+
+ * kjs/property_map.cpp: Added a missing using directive to fix the build
+ for non-Mac ports. Mac worked only because it does the AllInOneFile compile.
+
+2007-10-31 Maciej Stachowiak <mjs@apple.com>
+
+ * kjs/property_map.cpp: Include HashTable.h the right way to fix the build
+ for non-Mac ports.
+
+2007-10-31 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Darin.
+
+ http://bugs.webkit.org/show_bug.cgi?id=11001
+ WebKit doesn't support RegExp.compile method
+
+ Test: fast/js/regexp-compile.html
+
+ * kjs/regexp_object.cpp:
+ (RegExpPrototype::RegExpPrototype):
+ (RegExpProtoFunc::callAsFunction):
+ * kjs/regexp_object.h:
+ (KJS::RegExpProtoFunc::):
+ Added RegExp.compile.
+
+ * tests/mozilla/expected.html: js1_2/regexp/compile.js now passes.
+
+2007-10-31 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver.
+
+ - get rid of integer divide in PropertyMap and HashTable for 1% SunSpider speedup
+
+ Integer divide sucks. Fortunately, a bunch of shifts and XORs
+ biased towards the high bits is sufficient to provide a good
+ double hash. Besides the SunSpider win, I used the dump statistics
+ mode for both to verify that collisions did not increase and that
+ the longest collision chain is not any longer.
+
+ * kjs/property_map.cpp:
+ (KJS::doubleHash):
+ (KJS::PropertyMap::get):
+ (KJS::PropertyMap::getLocation):
+ (KJS::PropertyMap::put):
+ (KJS::PropertyMap::insert):
+ (KJS::PropertyMap::remove):
+ (KJS::PropertyMap::checkConsistency):
+ * wtf/HashTable.h:
+ (WTF::doubleHash):
+ (WTF::::lookup):
+ (WTF::::lookupForWriting):
+ (WTF::::fullLookupForWriting):
+ (WTF::::add):
+
+2007-10-30 Adam Roben <aroben@apple.com>
+
+ * kjs/collector.h: Make HeapType public so it can be used for non-member
+ things like the HeapConstants struct template. Fixes the build on Windows.
+
+2007-10-30 Adam Roben <aroben@apple.com>
+
+ Change ALWAYS_INLINE and WTF_PRIVATE_INLINE to use __forceinline on Windows
+
+ Speeds up SunSpider by 0.4%.
+
+ Reviewed by Steve and Maciej.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Disable
+ a warning during LTCG in release builds about double -> float
+ conversion.
+ * wtf/AlwaysInline.h:
+ * wtf/FastMalloc.h:
+
+2007-10-30 Adam Roben <aroben@apple.com>
+
+ Use GetCurrentThreadId instead of pthread_self in FastMalloc
+
+ Speeds up SunSpider by 0.3%.
+
+ Reviewed by Steve.
+
+ * wtf/FastMalloc.cpp:
+ (WTF::TCMalloc_ThreadCache::InitTSD):
+ (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary):
+
+2007-10-30 Adam Roben <aroben@apple.com>
+
+ Switch to a Win32 critical section implementation of spinlocks
+
+ Speeds up SunSpider by 0.4%.
+
+ Reviewed by Steve.
+
+ * wtf/FastMalloc.cpp:
+ * wtf/TCSpinLock.h:
+ (TCMalloc_SpinLock::TCMalloc_SpinLock):
+ (TCMalloc_SpinLock::Init):
+ (TCMalloc_SpinLock::Finalize):
+ (TCMalloc_SpinLock::Lock):
+ (TCMalloc_SpinLock::Unlock):
+ * wtf/TCSystemAlloc.cpp:
+
+2007-10-30 Adam Roben <aroben@apple.com>
+
+ Fix Bug 15586: REGRESSION (r26759-r26785): Windows nightly builds crash with Safari 3 Public Beta
+
+ http://bugs.webkit.org/show_bug.cgi?id=15586
+
+ Also fixes: <rdar://5565303> Cannot use regsvr32.exe to register WebKit.dll
+
+ Use Win32 TLS functions instead of __declspec(thread), which breaks
+ delay-loading.
+
+ Reviewed by Steve.
+
+ * wtf/FastMalloc.cpp:
+ (WTF::getThreadHeap):
+ (WTF::TCMalloc_ThreadCache::InitModule):
+
+2007-10-30 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver.
+
+ - allocate numbers in half-size cells, for an 0.5% SunSpider speedup
+ http://bugs.webkit.org/show_bug.cgi?id=15772
+
+ We do this by using a single mark bit per two number cells, and
+ tweaking marking.
+
+ Besides being an 0.5% win overall, this is a 7.1% win on morph.
+
+ * kjs/collector.cpp:
+ (KJS::Collector::heapAllocate):
+ (KJS::Collector::markStackObjectsConservatively):
+ (KJS::Collector::sweep):
+ * kjs/collector.h:
+ (KJS::SmallCollectorCell::):
+
+2007-10-30 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Adam Roben, Sam Weinig.
+
+ Made conflicts in grammar.y a persistent build failure.
+
+ * DerivedSources.make:
+
+2007-10-30 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Adam and Geoff.
+
+ - Added a new cast so all the casts are in the same place.
+
+ * API/APICast.h:
+ (toGlobalRef):
+
+2007-10-30 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Fixed <rdar://problem/5567504> shift/reduce conflict introduced in r24457
+
+ JS tests, including
+
+ ecma_2/Statements/dowhile-001.js
+ ecma_2/Statements/dowhile-002.js
+ ecma_2/Statements/dowhile-003.js
+ ecma_2/Statements/dowhile-004.js
+ ecma_2/Statements/dowhile-005.js
+ ecma_2/Statements/dowhile-006.js
+ ecma_2/Statements/dowhile-007.js
+ js1_2/statements/do_while.js
+
+ and layout tests, including
+
+ do-while-expression-value.html
+ do-while-semicolon.html
+ do-while-without-semicolon.html
+
+ pass.
+
+ * kjs/grammar.y: Use the explicit "error" production, as we do with other
+ automatic semicolon insertions, to disambiguate "do { } while();" from
+ "do { } while()" followed by ";" (the empty statement).
+
+2007-10-29 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej.
+
+ Debranching remaining assignment nodes, and miscellaneous cleanup
+
+ Split read-modify code paths out of AssignBracketNode and AssignDotNode
+ Removed now unnecessary check for write-only assignment in ReadModifyLocalVarNode
+ and ReadModifyResolveNode evaluate methods
+
+ Leads to a 1% gain in SunSpider.
+
+ * kjs/grammar.y:
+ * kjs/nodes.cpp:
+ (KJS::ReadModifyLocalVarNode::evaluate):
+ (KJS::ReadModifyResolveNode::evaluate):
+ (KJS::AssignDotNode::evaluate):
+ (KJS::ReadModifyDotNode::optimizeVariableAccess):
+ (KJS::ReadModifyDotNode::evaluate):
+ (KJS::AssignBracketNode::evaluate):
+ (KJS::ReadModifyBracketNode::optimizeVariableAccess):
+ (KJS::ReadModifyBracketNode::evaluate):
+ * kjs/nodes.h:
+ (KJS::AssignBracketNode::):
+ (KJS::AssignBracketNode::precedence):
+ (KJS::AssignDotNode::):
+ (KJS::AssignDotNode::precedence):
+ * kjs/nodes2string.cpp:
+ (KJS::ReadModifyBracketNode::streamTo):
+ (KJS::AssignBracketNode::streamTo):
+ (KJS::ReadModifyDotNode::streamTo):
+ (KJS::AssignDotNode::streamTo):
+
+2007-10-29 Oliver Hunt <oliver@apple.com>
+
+ Debranching various Node::evaluate implementations
+
+ Reviewed by Maciej.
+
+ Split the read-modify-write assignment cases out of AssignResolveNode and into ReadModifyResolveNode
+ Split the increment and decrement cases for Prefix- and Postfix- ResolveNode, BracketNode, and DotNode
+
+ Gains 1.6% on SunSpider
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * kjs/grammar.y:
+ * kjs/nodes.cpp:
+ (KJS::PostIncResolveNode::optimizeVariableAccess):
+ (KJS::PostIncResolveNode::evaluate):
+ (KJS::PostIncLocalVarNode::evaluate):
+ (KJS::PostDecResolveNode::optimizeVariableAccess):
+ (KJS::PostDecResolveNode::evaluate):
+ (KJS::PostDecLocalVarNode::evaluate):
+ (KJS::PostIncBracketNode::evaluate):
+ (KJS::PostDecBracketNode::evaluate):
+ (KJS::PostIncDotNode::evaluate):
+ (KJS::PostDecDotNode::evaluate):
+ (KJS::PreIncResolveNode::optimizeVariableAccess):
+ (KJS::PreIncLocalVarNode::evaluate):
+ (KJS::PreIncResolveNode::evaluate):
+ (KJS::PreDecResolveNode::optimizeVariableAccess):
+ (KJS::PreDecLocalVarNode::evaluate):
+ (KJS::PreDecResolveNode::evaluate):
+ (KJS::PreIncBracketNode::evaluate):
+ (KJS::PreDecBracketNode::evaluate):
+ (KJS::PreIncDotNode::evaluate):
+ (KJS::PreDecDotNode::evaluate):
+ (KJS::ReadModifyResolveNode::optimizeVariableAccess):
+ (KJS::AssignResolveNode::optimizeVariableAccess):
+ (KJS::AssignLocalVarNode::evaluate):
+ (KJS::AssignResolveNode::evaluate):
+ * kjs/nodes.h:
+ (KJS::PostDecResolveNode::):
+ (KJS::PostDecResolveNode::precedence):
+ (KJS::PostDecLocalVarNode::):
+ (KJS::PostfixBracketNode::):
+ (KJS::PostfixBracketNode::precedence):
+ (KJS::PostIncBracketNode::):
+ (KJS::PostIncBracketNode::isIncrement):
+ (KJS::PostDecBracketNode::):
+ (KJS::PostDecBracketNode::isIncrement):
+ (KJS::PostfixDotNode::):
+ (KJS::PostfixDotNode::precedence):
+ (KJS::PostIncDotNode::):
+ (KJS::PostIncDotNode::isIncrement):
+ (KJS::PostDecDotNode::):
+ (KJS::PreIncResolveNode::):
+ (KJS::PreDecResolveNode::):
+ (KJS::PreDecResolveNode::precedence):
+ (KJS::PreDecLocalVarNode::):
+ (KJS::PrefixBracketNode::):
+ (KJS::PrefixBracketNode::precedence):
+ (KJS::PreIncBracketNode::):
+ (KJS::PreIncBracketNode::isIncrement):
+ (KJS::PreDecBracketNode::):
+ (KJS::PreDecBracketNode::isIncrement):
+ (KJS::PrefixDotNode::):
+ (KJS::PrefixDotNode::precedence):
+ (KJS::PreIncDotNode::):
+ (KJS::PreIncDotNode::isIncrement):
+ (KJS::PreDecDotNode::):
+ (KJS::ReadModifyResolveNode::):
+ (KJS::ReadModifyLocalVarNode::):
+ (KJS::AssignResolveNode::):
+ (KJS::AssignResolveNode::precedence):
+ * kjs/nodes2string.cpp:
+ (KJS::PostIncResolveNode::streamTo):
+ (KJS::PostDecResolveNode::streamTo):
+ (KJS::PostfixBracketNode::streamTo):
+ (KJS::PostfixDotNode::streamTo):
+ (KJS::PreIncResolveNode::streamTo):
+ (KJS::PreDecResolveNode::streamTo):
+ (KJS::ReadModifyResolveNode::streamTo):
+ (KJS::AssignResolveNode::streamTo):
+
+2007-10-29 Maciej Stachowiak <mjs@apple.com>
+
+ Not reviewed, build fix.
+
+ - Include Vector.h in a way that actually works.
+
+ * kjs/LocalStorage.h:
+
+2007-10-29 Maciej Stachowiak <mjs@apple.com>
+
+ Not reviewed, build fix.
+
+ - Install LocalStorage.h as a private header.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2007-10-29 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin.
+
+ - Define good VectorTraits for LocalStorage entry for 0.5% speed improvement on SunSpider.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * kjs/LocalStorage.h: Added.
+ (KJS::LocalStorageEntry::LocalStorageEntry):
+ (WTF::):
+ * kjs/function.h:
+ * kjs/nodes.cpp:
+ (KJS::FunctionBodyNode::processDeclarationsForFunctionCode):
+
+2007-10-29 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Some small tweaks that I notice while reviewing Oliver's last patch.
+
+ Includes removal of an unnecessary KJS_CHECKEXCEPTIONVALUE.
+
+ No change in SunSpider because SunSpider doesn't take the code path that
+ would execute the unnecessary KJS_CHECKEXCEPTIONVALUE much.
+
+ * kjs/nodes.cpp:
+ (KJS::LocalVarPostfixNode::evaluate):
+ (KJS::TypeOfResolveNode::optimizeVariableAccess):
+ (KJS::LocalVarTypeOfNode::evaluate):
+ (KJS::PrefixResolveNode::optimizeVariableAccess):
+ (KJS::LocalVarPrefixNode::evaluate):
+ (KJS::AssignResolveNode::optimizeVariableAccess):
+ (KJS::LocalVarAssignNode::evaluate):
+ * kjs/nodes.h:
+ (KJS::LocalVarTypeOfNode::):
+ (KJS::PrefixResolveNode::):
+ (KJS::LocalVarPrefixNode::):
+ (KJS::AssignResolveNode::):
+ (KJS::LocalVarAssignNode::):
+
+2007-10-29 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Maciej.
+
+ SunSpider claims this was a 0.7% speedup.
+
+ * kjs/string_object.cpp:
+ (KJS::StringProtoFunc::callAsFunction): avoid mallocing a jsString in the common case
+
+2007-10-29 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Mark.
+
+ - re-enable asserts for access to empty or deleted keys
+
+ * wtf/HashTable.h:
+ (WTF::::lookup):
+ (WTF::::lookupForWriting):
+ (WTF::::fullLookupForWriting):
+ (WTF::::add):
+
+2007-10-29 Eric Seidel <eric@webkit.org>
+
+ Build fix only, no review.
+
+ * JavaScriptCore.exp: Export symbol for new StringInstance::getOwnPropertySlot
+
+2007-10-29 Mark Rowe <mrowe@apple.com>
+
+ Gtk build fix. Move struct declarations into nodes.h.
+
+ * kjs/grammar.y:
+ * kjs/nodes.h:
+
+2007-10-29 Eric Seidel <eric@webkit.org>
+
+ Reviewed by darin.
+
+ Give StringInstance a getOwnPropertySlot(ExecState, unsigned, PropertySlot) fastpath, just like Arrays.
+ Make it a compile time error to use toString(ExecState) on a StringInstance
+
+ SunSpider claims this was a 6.6% speedup overall (22% on string-base64)
+
+ * kjs/internal.h:
+ (KJS::StringImp::getLength):
+ * kjs/string_object.cpp:
+ (KJS::StringInstance::lengthGetter):
+ (KJS::StringInstance::inlineGetOwnPropertySlot):
+ (KJS::StringInstance::getOwnPropertySlot):
+ * kjs/string_object.h:
+
+2007-10-28 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Darin.
+
+ Add nodes to allow Assignment, TypeOf, and prefix operators to
+ make use of the new optimised local variable look up.
+
+ 5% gain on sunspider
+
+ * kjs/nodes.cpp:
+ (KJS::TypeOfResolveNode::optimizeVariableAccess):
+ (KJS::LocalTypeOfAccessNode::evaluate):
+ (KJS::PrefixResolveNode::optimizeVariableAccess):
+ (KJS::PrefixLocalAccessNode::evaluate):
+ (KJS::AssignResolveNode::optimizeVariableAccess):
+ (KJS::AssignLocalAccessNode::evaluate):
+ * kjs/nodes.h:
+ (KJS::TypeOfResolveNode::):
+ (KJS::TypeOfResolveNode::precedence):
+ (KJS::LocalTypeOfAccessNode::):
+ (KJS::PrefixResolveNode::):
+ (KJS::PrefixResolveNode::precedence):
+ (KJS::PrefixLocalAccessNode::):
+ (KJS::AssignResolveNode::):
+ (KJS::AssignLocalAccessNode::):
+
+2007-10-28 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin.
+
+ - avoid creating and then breaking circular lists in the parser, instead track head and tail pointers at parse time
+ http://bugs.webkit.org/show_bug.cgi?id=15748
+
+ Not a significant speedup or slowdown on SunSpider.
+
+ * kjs/Parser.cpp:
+ (KJS::clearNewNodes):
+ * kjs/Parser.h:
+ * kjs/grammar.y:
+ * kjs/nodes.cpp:
+ (KJS::BlockNode::BlockNode):
+ (KJS::CaseBlockNode::CaseBlockNode):
+ (KJS::FunctionBodyNode::FunctionBodyNode):
+ (KJS::SourceElementsNode::SourceElementsNode):
+ (KJS::ProgramNode::ProgramNode):
+ * kjs/nodes.h:
+ (KJS::ElementNode::):
+ (KJS::ArrayNode::):
+ (KJS::PropertyListNode::):
+ (KJS::ObjectLiteralNode::):
+ (KJS::ArgumentListNode::):
+ (KJS::ArgumentsNode::):
+ (KJS::VarDeclListNode::):
+ (KJS::VarStatementNode::):
+ (KJS::ForNode::):
+ (KJS::ParameterNode::):
+ (KJS::FuncExprNode::):
+ (KJS::FuncDeclNode::):
+ (KJS::SourceElementsNode::):
+ (KJS::CaseClauseNode::):
+ (KJS::ClauseListNode::):
+
+2007-10-28 Mark Rowe <mrowe@apple.com>
+
+ Disable assertions in a manner that doesn't break the Qt Windows build.
+
+ * wtf/HashTable.h:
+ (WTF::::lookup):
+ (WTF::::lookupForWriting):
+ (WTF::::fullLookupForWriting):
+
+2007-10-28 Geoffrey Garen <ggaren@apple.com>
+
+ Temporarily disabling some ASSERTs I introduced in my last check-in
+ because of http://bugs.webkit.org/show_bug.cgi?id=15747
+ Lots of layout tests fail the !HashTranslator::equal(KeyTraits::emptyValue() ASSERT
+
+ * wtf/HashTable.h:
+ (WTF::::lookup):
+ (WTF::::lookupForWriting):
+ (WTF::::fullLookupForWriting):
+ (WTF::::add):
+
+2007-10-28 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Fixed http://bugs.webkit.org/show_bug.cgi?id=15746
+ #ifndef ASSERT_DISABLED is no good!
+
+ Replaced with #if !ASSERT_DISABLED.
+
+ * wtf/HashTable.h:
+ (WTF::::lookup):
+ (WTF::::lookupForWriting):
+ (WTF::::fullLookupForWriting):
+ (WTF::::add):
+
+2007-10-28 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Added FunctionCallResolveNode, PostfixResolveNode, and DeleteResolveNode
+ to the AST transfom that replaces slow resolve nodes with fast local
+ variable alternatives.
+
+ 2.5% speedup on SunSpider.
+
+ Also added some missing copyright notices.
+
+ * kjs/nodes.cpp:
+ (KJS::FunctionCallResolveNode::optimizeVariableAccess):
+ (KJS::FunctionCallResolveNode::evaluate):
+ (KJS::LocalVarFunctionCallNode::evaluate):
+ (KJS::PostfixResolveNode::optimizeVariableAccess):
+ (KJS::PostfixResolveNode::evaluate):
+ (KJS::LocalVarPostfixNode::evaluate):
+ (KJS::DeleteResolveNode::optimizeVariableAccess):
+ (KJS::DeleteResolveNode::evaluate):
+ (KJS::LocalVarDeleteNode::evaluate):
+ * kjs/nodes.h:
+ (KJS::FunctionCallResolveNode::):
+ (KJS::LocalVarFunctionCallNode::LocalVarFunctionCallNode):
+ (KJS::PostfixResolveNode::):
+ (KJS::LocalVarPostfixNode::LocalVarPostfixNode):
+ (KJS::DeleteResolveNode::):
+ (KJS::LocalVarDeleteNode::LocalVarDeleteNode):
+
+2007-10-28 Eric Seidel <eric@webkit.org>
+
+ Reviewed by darin.
+
+ Inline UString::Rep::deref() for a 0.8% improvement in SunSpider
+ Add virtual keyword to a few virtual functions previously unmarked.
+
+ * kjs/internal.h:
+ (KJS::StringImp::type):
+ (KJS::NumberImp::type):
+ * kjs/ustring.h:
+ (KJS::UString::Rep::deref):
+
+2007-10-28 Darin Adler <darin@apple.com>
+
+ - fix "broken everything" from the storage leak fix
+
+ * wtf/RefPtr.h: (WTF::RefPtr::RefPtr): Added a PlacementNewAdopt constructor.
+ * kjs/ustring.h: (KJS::UString::UString): Pass PlacementNewAdopt along to RefPtr.
+
+2007-10-28 Darin Adler <darin@apple.com>
+
+ Reviewed by Adam.
+
+ - turn on unused parameter waring on Mac OS X because it's already on elsewhere
+
+ * Configurations/Base.xcconfig: Took out -wno-unused-parameter.
+
+ * API/JSNode.c:
+ * API/JSNodeList.c:
+ * API/minidom.c:
+ * API/testapi.c:
+ Fixed unused variables by using them or marked them with UNUSED_PARAM.
+
+ * kjs/CollectorHeapIntrospector.h: (KJS::CollectorHeapIntrospector::zoneCalloc):
+ Removed parameter names to indicate they are unused.
+
+2007-10-28 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - fix a storage leak where we ref the UString every time we replace
+ a ResolveNode with a LocalVarAccessNode
+
+ * kjs/identifier.h: (KJS::Identifier::Identifier): Added a constructor
+ that takes PlacementNewAdopt.
+
+ * kjs/nodes.h: (KJS::ResolveNode::ResolveNode): Initialize the ident
+ with PlacementNewAdopt instead of the old value of ident.
+
+ * kjs/ustring.h: (KJS::UString::UString): Added a constructor that
+ takes PlacementNewAdopt.
+
+2007-10-28 Darin Adler <darin@apple.com>
+
+ - Windows build fix; get rid of unused parameter
+
+ * kjs/nodes.cpp: (KJS::ResolveNode::optimizeVariableAccess): Don't pass it.
+ * kjs/nodes.h: (KJS::LocalVarAccessNode::LocalVarAccessNode): Remove it.
+ The assertions weren't all that helpful.
+
+2007-10-28 Mark Rowe <mrowe@apple.com>
+
+ Gtk build fix. Add include of MathExtras.h.
+
+ * kjs/string_object.cpp:
+
+2007-10-28 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Maciej and Tim.
+
+ Replace uses of isNaN and isInf with isnan and isinf, and
+ remove isNaN and isInf.
+
+ * kjs/config.h: Remove unused HAVE_'s.
+ * kjs/date_object.cpp:
+ (KJS::DateInstance::getTime):
+ (KJS::DateInstance::getUTCTime):
+ (KJS::DateProtoFunc::callAsFunction):
+ (KJS::DateObjectImp::construct):
+ (KJS::DateObjectFuncImp::callAsFunction):
+ * kjs/function.cpp:
+ (KJS::GlobalFuncImp::callAsFunction):
+ * kjs/math_object.cpp:
+ (MathFuncImp::callAsFunction):
+ * kjs/nodes2string.cpp:
+ (KJS::isParserRoundTripNumber):
+ * kjs/number_object.cpp:
+ (NumberProtoFunc::callAsFunction):
+ * kjs/operations.cpp:
+ * kjs/operations.h:
+ * kjs/string_object.cpp:
+ (KJS::StringProtoFunc::callAsFunction):
+ * kjs/ustring.cpp:
+ (KJS::UString::from):
+ * kjs/value.cpp:
+ (KJS::JSValue::toInteger):
+ (KJS::JSValue::toInt32SlowCase):
+ (KJS::JSValue::toUInt32SlowCase):
+
+2007-10-28 Geoffrey Garen <ggaren@apple.com>
+
+ Build fix: use the new-fangled missingSymbolMarker().
+
+ * kjs/nodes.cpp:
+ (KJS::ResolveNode::optimizeVariableAccess):
+ * kjs/nodes.h:
+ (KJS::LocalVarAccessNode::LocalVarAccessNode):
+
+2007-10-28 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak, Darin Adler.
+
+ Much supporting work done by Maciej Stachowiak, Maks Orlovich, and
+ Cameron Zwarich.
+
+ AST transfom to replace slow resolve nodes with fast local variable
+ alternatives that do direct memory access. Currently, only ResolveNode
+ provides a fast local variable alternative. 6 others are soon to come.
+
+ 16.7% speedup on SunSpider.
+
+ Most of this patch is just scaffolding to support iterating all the
+ resolve nodes in the AST through optimizeResolveNodes(). In
+ optimizeResolveNodes(), most classes just push their child nodes onto
+ the processing stack, while ResolveNodes actually replace themselves in
+ the tree with more optimized alternatives, if possible.
+
+ Here are the interesting bits:
+
+ * kjs/nodes.h: Added PlacementNewAdoptTag, along with implementations
+ in Node and ResolveNode. This tag allows you to use placement new to
+ swap out a base class Node in favor of a subclass copy that holds the
+ same data. (Without this tag, default initialization would NULL out
+ RefPtrs, change line numbers, etc.)
+
+ * kjs/nodes.cpp:
+ (KJS::ResolveNode::evaluate): Since we're taking the slow path, ASSERT
+ that the fast path is impossible, to make sure we didn't leave anything
+ on the table.
+
+ (KJS::FunctionBodyNode::optimizeResolveNodes): Here's where the AST
+ transformation happens.
+
+ (KJS::ResolveNode::optimizeResolveNodes): Here's where the ResolveNode
+ optimization happens.
+
+ * kjs/function.h: Added symbolTable() accessor for, for the sake of
+ an ASSERT.
+
+2007-10-28 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Maciej.
+
+ Fix "AllInOneFile.o has a global initializer in it".
+
+ Some versions of gcc generate a global initializer for std::numeric_limits<size_t>::max().
+ We can avoid this by moving it inside an inline function.
+
+ * kjs/SymbolTable.h:
+ (KJS::missingSymbolMarker):
+ * kjs/function.cpp:
+ (KJS::ActivationImp::getOwnPropertySlot):
+ (KJS::ActivationImp::put):
+
+2007-10-28 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Mark.
+
+ - Added assertions to protect against adding empty or deleted keys to a HashTable
+
+ * wtf/HashTable.h:
+ (WTF::HashTable::lookup):
+ (WTF::HashTable::lookupForWriting):
+ (WTF::HashTable::fullLookupForWriting):
+ (WTF::HashTable::add):
+
+2007-10-28 Darin Adler <darin@apple.com>
+
+ - fix GTK build
+
+ * kjs/nodes2string.cpp: (KJS::isParserRoundTripNumber):
+ Use isNaN and isInf instead of isnan and isinf.
+
+2007-10-28 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - http://bugs.webkit.org/show_bug.cgi?id=15735
+ remove GroupNode to simplify AST and possibly get a modest speedup
+
+ This patch removes 4 node types: GroupNode, PropertyNameNode,
+ FunctionCallParenBracketNode, and FunctionCallParenDotNode.
+
+ To remove GroupNode, we add knowledge of precedence to the tree nodes,
+ and use that when serializing to determine where parentheses are needed.
+ This means we no longer have to represent parentheses in the tree.
+
+ The precedence values are named after productions in the grammar from the
+ JavaScript standard.
+
+ SunSpider says this is an 0.4% speedup.
+
+ * kjs/function.h:
+ * kjs/function.cpp: Removed escapeStringForPrettyPrinting -- it's part of
+ serialization, so I moved it to the file that takes care of that.
+
+ * kjs/grammar.y: Changed makeGetterOrSetterPropertyNode to use 0 to
+ indicate failure instead of a separate boolean. Got rid of PropertyNameNode
+ by merging the PropertyName rule into the Property rule (which was easier
+ than figuring out how to pass the Identifier from one node to another).
+ Got rid of GroupNode, nodeInsideAllParens(), FunctionCallParenBracketNode,
+ and FunctionCallParenDotNode.
+
+ * kjs/nodes.h: Removed unused forward declarations and Operator values.
+ Added Precedence enum, and precedence function to all nodes. Removed
+ nodeInsideAllParens. Added streamBinaryOperator function for serialization.
+ Removed GroupNode and PropertyNameNode. Made PropertyNode store an Identifier.
+ Removed FunctionCallParenBracketNode and FunctionCallParenDotNode.
+
+ * kjs/nodes.cpp: Removed Node::nodinsideAllParens, GroupNode, and PropertyNameNode.
+ (KJS::PropertyListNode::evaluate): Changed code to get name directly instead
+ of converting it from an Identifier to a jsString then back to a UString
+ then into an Identifier again!
+
+ * kjs/nodes2string.cpp: Changed special-token implementation to use a separate
+ function for each of Endl, Indent, Unindent, and DotExpr instead of using a
+ single function with a switch. Added a precedence that you can stream in, to
+ cause the next node serialized to add parentheses based on that precedence value.
+ (KJS::operatorString): Moved to the top of the file.
+ (KJS::escapeStringForPrettyPrinting): Moved here from function.cpp. Removed old
+ workaround for snprintf, since StringExtras.h takes care of that.
+ (KJS::operator<<): Made the char and char* versions faster by using UString's
+ character append functions instead of constructing a UString. Added the logic
+ to the Node* version to add parentheses if needed.
+ (KJS::Node::streamLeftAssociativeBinaryOperator): Added helper function.
+ (KJS::ElementNode::streamTo): Use PrecAssignment for the elements.
+ (KJS::BracketAccessorNode::streamTo): Use PrecCall for the expression before
+ the bracket.
+ (KJS::DotAccessorNode::streamTo): Use PrecCall for the expression before the dot.
+ (KJS::ArgumentListNode::streamTo): Use PrecAssignment for the arguments.
+ (KJS::NewExprNode::streamTo): Use PrecMember for the expression.
+ (KJS::FunctionCallValueNode::streamTo): Use PrecCall.
+ (KJS::FunctionCallBracketNode::streamTo): Ditto.
+ (KJS::FunctionCallDotNode::streamTo): Ditto.
+ (KJS::PostfixBracketNode::streamTo): Ditto.
+ (KJS::PostfixDotNode::streamTo): Ditto.
+ (KJS::PostfixErrorNode::streamTo): Use PrecLeftHandSide.
+ (KJS::DeleteBracketNode::streamTo): Use PrecCall.
+ (KJS::DeleteDotNode::streamTo): Ditto.
+ (KJS::DeleteValueNode::streamTo): Use PrecUnary.
+ (KJS::VoidNode::streamTo): Ditto.
+ (KJS::TypeOfValueNode::streamTo): Ditto.
+ (KJS::PrefixBracketNode::streamTo): Use PrecCall.
+ (KJS::PrefixDotNode::streamTo): Ditto.
+ (KJS::PrefixErrorNode::streamTo): Use PrecUnary.
+ (KJS::UnaryPlusNode::streamTo): Ditto.
+ (KJS::NegateNode::streamTo): Ditto.
+ (KJS::BitwiseNotNode::streamTo): Ditto.
+ (KJS::LogicalNotNode::streamTo): Ditto.
+ (KJS::MultNode::streamTo): Use streamLeftAssociativeBinaryOperator.
+ (KJS::DivNode::streamTo): Ditto.
+ (KJS::ModNode::streamTo): Ditto.
+ (KJS::AddNode::streamTo): Ditto.
+ (KJS::SubNode::streamTo): Ditto.
+ (KJS::LeftShiftNode::streamTo): Ditto.
+ (KJS::RightShiftNode::streamTo): Ditto.
+ (KJS::UnsignedRightShiftNode::streamTo): Ditto.
+ (KJS::LessNode::streamTo): Ditto.
+ (KJS::GreaterNode::streamTo): Ditto.
+ (KJS::LessEqNode::streamTo): Ditto.
+ (KJS::GreaterEqNode::streamTo): Ditto.
+ (KJS::InstanceOfNode::streamTo): Ditto.
+ (KJS::InNode::streamTo): Ditto.
+ (KJS::EqualNode::streamTo): Ditto.
+ (KJS::NotEqualNode::streamTo): Ditto.
+ (KJS::StrictEqualNode::streamTo): Ditto.
+ (KJS::NotStrictEqualNode::streamTo): Ditto.
+ (KJS::BitAndNode::streamTo): Ditto.
+ (KJS::BitXOrNode::streamTo): Ditto.
+ (KJS::BitOrNode::streamTo): Ditto.
+ (KJS::LogicalAndNode::streamTo): Ditto.
+ (KJS::LogicalOrNode::streamTo): Ditto.
+ (KJS::ConditionalNode::streamTo): Ditto.
+ (KJS::AssignResolveNode::streamTo): Use PrecAssignment for the right side.
+ (KJS::AssignBracketNode::streamTo): Use PrecCall for the expression before
+ the bracket and PrecAssignment for the right side.
+ (KJS::AssignDotNode::streamTo): Ditto.
+ (KJS::AssignErrorNode::streamTo): Use PrecLeftHandSide for the left side
+ and PrecAssignment for the right side.
+ (KJS::CommaNode::streamTo): Use PrecAssignment for both expressions.
+ (KJS::AssignExprNode::streamTo): Use PrecAssignment.
+
+2007-10-28 Kevin Ollivier <kevino@theolliviers.com>
+
+ Define wx port and set wx port USE options.
+
+ Reviewed by Adam Roben.
+
+ * wtf/Platform.h:
+
+2007-10-28 Mark Rowe <mrowe@apple.com>
+
+ We don't include "config.h" in headers.
+
+ * bindings/jni/jni_instance.h:
+ * kjs/regexp.h:
+ * wtf/TCPageMap.h:
+ * wtf/TCSpinLock.h:
+
+2007-10-28 Maciej Stachowiak <mjs@apple.com>
+
+ Rubber stamped by Mark.
+
+ - avoid using non-portable SIZE_T_MAX in favor of std::numeric_limits
+
+ * kjs/SymbolTable.h:
+ (KJS::SymbolTableIndexHashTraits::emptyValue):
+ * kjs/function.cpp:
+ (KJS::ActivationImp::getOwnPropertySlot):
+ (KJS::ActivationImp::put):
+
+2007-10-28 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Eric.
+
+ - switch SymbolTable to be a HashMap instead of a PropertyMap for 3% SunSpider speedup
+
+ * kjs/SymbolTable.h:
+ (KJS::IdentifierRepHash::hash): Special hash function for identifier reps.
+ (KJS::IdentifierRepHash::equal): ditto
+ (KJS::SymbolTableIndexHashTraits::emptyValue): Special HashTraits for the index value.
+ (KJS::SymbolTable): change to a typedef for a HashMap.
+ * kjs/function.cpp:
+ (KJS::ActivationImp::getOwnPropertySlot): Adjusted for new SymbolTable API.
+ (KJS::ActivationImp::deleteProperty): ditto
+ (KJS::ActivationImp::put): ditto
+
+ * kjs/nodes.cpp:
+ (KJS::FunctionBodyNode::initializesymbolTable): Adjusted, since
+ you now have to store a UString::rep, not an identifier.
+
+2007-10-27 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver.
+
+ - numerous HashTable performance improvements
+
+ This does not quite add up to a measurable win on SunSpider, but it allows a
+ follow-on > 3% improvement and probably helps WebCore too.
+
+ I made the following improvements, among others:
+
+ - Made HashFunctions note whether it is ok to compare a real value with the equal() function
+ to the empty or deleted value, and used this to optimize the comparisons done in hash lookup.
+
+ - Specialized lookup so it doesn't have to do so many extra branches and build so many extra
+ std::pairs for cases that don't need them. There are now four versions, one for read-only access,
+ two for writing, and one folded directly into add() (these all were improvments).
+
+ - Made HashMap::get() use lookup() directly instead of find() to avoid having to build iterators.
+
+ - Made a special constructor for iterators that knows it points to
+ a valid filled cell and so skips updating itself.
+
+ - Reordered memory accesses in the various lookup functions for better code generation
+
+ - Made simple translators avoid passing a hash code around
+
+ - Other minor tweaks
+
+ * wtf/HashTable.h:
+ (WTF::):
+ (WTF::HashTableConstIterator::HashTableConstIterator):
+ (WTF::HashTableIterator::HashTableIterator):
+ (WTF::IdentityHashTranslator::translate):
+ (WTF::HashTable::end):
+ (WTF::HashTable::lookup):
+ (WTF::HashTable::lookupForWriting):
+ (WTF::HashTable::makeKnownGoodIterator):
+ (WTF::HashTable::makeKnownGoodConstIterator):
+ (WTF::::lookup):
+ (WTF::::lookupForWriting):
+ (WTF::::fullLookupForWriting):
+ (WTF::::add):
+ (WTF::::addPassingHashCode):
+ (WTF::::reinsert):
+ (WTF::::find):
+ (WTF::::contains):
+ * kjs/identifier.cpp:
+ (WTF::):
+ * wtf/HashFunctions.h:
+ (WTF::):
+ * wtf/HashMap.h:
+ (WTF::):
+ (WTF::::get):
+ * wtf/HashSet.h:
+ (WTF::):
+ (WTF::::add):
+ * wtf/ListHashSet.h:
+ (WTF::ListHashSetTranslator::translate):
+
+2007-10-27 Darin Adler <darin@apple.com>
+
+ Reviewed by Eric.
+
+ - fix ASCIICType.h for some Windows compiles
+
+ * wtf/ASCIICType.h: Check the compiler, not the OS, since it's the
+ compiler/library that has the wchar_t that is just a typedef.
+
+2007-10-27 Kevin McCullough <kmccullough@apple.com>
+
+ - BuildFix
+ - Forgot to change the build step when I changed the filename.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+
+2007-10-27 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Fixed the rest of "ASSERTION FAILED: _hash in KJS::UString::Rep::
+ computedHash()"
+ http://bugs.webkit.org/show_bug.cgi?id=15718
+
+ * kjs/identifier.cpp: Fixed more cases where an Identifier didn't get a
+ hash value. Also changed O(n) strlen to O(1) check for empty string.
+ (KJS::Identifier::add):
+
+ * kjs/ustring.cpp: Changed O(n) strlens to O(1) checks for empty string.
+ (KJS::UString::UString):
+ (KJS::UString::operator=):
+
+2007-10-27 Darin Adler <darin@apple.com>
+
+ Reviewed by Eric.
+
+ - fix pow on Windows
+
+ * wtf/MathExtras.h: (wtf_pow): Add a special case for MSVC, which has
+ a "pow" function that does not properly handle the case where arg1 is
+ NaN and arg2 is 0.
+
+ * kjs/math_object.cpp: (MathFuncImp::callAsFunction): Don't explicity
+ specify "::pow" -- just "pow" is fine.
+
+2007-10-27 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - http://bugs.webkit.org/show_bug.cgi?id=15711
+ force JSImmediate to be inlined for roughly 1.2% SunSpider speedup
+
+ * kjs/JSImmediate.h: Put ALWAYS_INLINE on everything.
+
+ * kjs/object.h: Removed redundant includes.
+ * kjs/value.h: Ditto.
+
+2007-10-27 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Mark.
+
+ - fixed "ASSERTION FAILED: _hash in KJS::UString::Rep::computedHash()"
+ http://bugs.webkit.org/show_bug.cgi?id=15718
+
+ * kjs/identifier.cpp:
+ (KJS::Identifier::addSlowCase): Ensure that empty Identifiers have a hash computed,
+ now that we count on all Identifiers already having one.
+
+2007-10-27 Mark Rowe <mrowe@apple.com>
+
+ Silence a warning.
+
+ * kjs/SymbolTable.h:
+
+2007-10-27 Mark Rowe <mrowe@apple.com>
+
+ Gtk build fix.
+
+ * kjs/function.h:
+
+2007-10-26 Kevin McCullough <kmccullough@apple.com>
+
+ Rubber stamp by Adam.
+
+ - Renamed JSStringRefCOM to JSStringRefBSTR since it he only thing the
+ files contain are functions that operate on BSTRs.
+
+ * API/JSStringRefBSTR.cpp: Copied from API/JSStringRefCOM.cpp.
+ * API/JSStringRefBSTR.h: Copied from API/JSStringRefCOM.h.
+ * API/JSStringRefCOM.cpp: Removed.
+ * API/JSStringRefCOM.h: Removed.
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+
+2007-10-26 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Adam.
+
+ - Made JSStringCreateWithBSTR capable of handling null BSTRs.
+
+ * API/JSStringRefCOM.cpp:
+ (JSStringCreateWithBSTR):
+
+2007-10-26 Sam Weinig <sam@webkit.org>
+
+ Windows build fix.
+
+ * kjs/SymbolTable.h: Add header gaurd.
+ * kjs/nodes.h: #include "SymbolTable.h"
+
+2007-10-26 Geoffrey Garen <ggaren@apple.com>
+
+ Suggested by Anders Carlsson.
+
+ Fixed tyop.
+
+ * kjs/function.cpp:
+ (KJS::ActivationImp::getOwnPropertySlot):
+
+2007-10-26 Geoffrey Garen <ggaren@apple.com>
+
+ Suggested by Darin Adler.
+
+ Use computedHash(), which is safer than just directly accessing _hash.
+
+ * kjs/lookup.cpp:
+ (KJS::Lookup::findEntry):
+ (KJS::Lookup::find):
+
+2007-10-26 Geoffrey Garen <ggaren@apple.com>
+
+ Build fix: svn add SymbolTable.h
+
+ * kjs/SymbolTable.h: Added.
+ (KJS::SymbolTable::set):
+ (KJS::SymbolTable::get):
+
+2007-10-26 Geoffrey Garen <ggaren@apple.com>
+
+ Build fix: export SymbolTable.h to WebCore.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2007-10-26 Geoffrey Garen <ggaren@apple.com>
+
+ Comment tweak suggested by Maciej.
+
+ * kjs/function.cpp:
+ (KJS::ActivationImp::getOwnPropertySlot):
+
+2007-10-26 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Tweaked property maps to remove 2 branches. 2.5% speedup on SunSpider.
+
+ * kjs/property_map.cpp: Use a special no branch accessor to the UString's
+ hash value. Also, return immediately instead of branching to the end
+ of the loop if the value is not found.
+ (KJS::PropertyMap::get):
+ (KJS::PropertyMap::getLocation):
+ (KJS::PropertyMap::put):
+ (KJS::PropertyMap::insert):
+ (KJS::PropertyMap::remove):
+ (KJS::PropertyMap::checkConsistency):
+
+ * kjs/ustring.h:
+ (KJS::UString::Rep::computedHash): Special no branch accessor to the
+ UString's hash value. Used when the caller knows that the hash value
+ has already been computed. (For example, if the caller got the UString
+ from an Identifier.)
+
+2007-10-26 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Switched ActivationImp to using a symbol table. For now, though, all
+ clients take the slow path.
+
+ Net .6% speedup on SunSpider.
+
+ Slowdowns:
+ - ActivationImp now mallocs in its constructor
+ - Local variable hits use an extra level of indirection to retrieve
+ data
+ - Local variable misses do two lookups
+
+ Speedups:
+ - Fast initialization of local variables upon function entry
+
+ * JavaScriptCore.xcodeproj/project.pbxproj: Added SymbolTable.h
+
+ * kjs/function.cpp:
+ (KJS::ActivationImp::ActivationImp): Malloc a private structure to hold
+ data that won't fit in a JSCell.
+ (KJS::ActivationImp::argumentsGetter): Use slow symbol table path for
+ lookup.
+ (KJS::ActivationImp::getOwnPropertySlot): ditto
+ (KJS::ActivationImp::deleteProperty): ditto
+ (KJS::ActivationImp::put): ditto
+ (KJS::ActivationImp::createArgumentsObject): ditto
+
+ (KJS::ActivationImp::mark): Call JSObject::mark first so that one of
+ our properties doesn't try to recursively mark us. (This caused a crash
+ in earlier testing. Not sure why we haven't run into it before.)
+
+ * kjs/nodes.cpp: Functions now build a symbol table the first time
+ they're called.
+ (KJS::VarDeclNode::evaluate):
+ (KJS::FunctionBodyNode::FunctionBodyNode):
+ (KJS::FunctionBodyNode::initializeSymbolTable):
+ (KJS::FunctionBodyNode::processDeclarations):
+ (KJS::FunctionBodyNode::processDeclarationsForFunctionCode):
+ (KJS::FunctionBodyNode::processDeclarationsForProgramCode):
+
+ * kjs/nodes.h:
+ (KJS::FunctionBodyNode::symbolTable):
+
+ * wtf/Forward.h: Added Vector.
+
+2007-10-26 Kevin McCullough <kmccullough@apple.com>
+
+ - Corrected function name mistake in this changelog.
+
+2007-10-26 Kevin McCullough <kmccullough@apple.com>
+ Reviewed by Sam and Steve.
+
+ - Added convenience methods for converting between BSTR and JSStringRefs
+
+ * API/JSStringRefCOM.cpp: Added.
+ (JSStringCreateWithBSTR):
+ (JSStringCopyBSTR):
+ * API/JSStringRefCOM.h: Added.
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+
+2007-10-26 Mark Rowe <mrowe@apple.com>
+
+ Windows build fix.
+
+ * kjs/collector.cpp:
+ (KJS::Collector::collect):
+
+2007-10-26 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej.
+
+ Make the JSC GC use a separate heap for JSNumbers to get a 0.7-1.4% progression in SunSpider.
+
+ * kjs/CollectorHeapIntrospector.cpp:
+ (KJS::CollectorHeapIntrospector::init):
+ (KJS::CollectorHeapIntrospector::enumerate):
+ * kjs/CollectorHeapIntrospector.h:
+ * kjs/collector.cpp:
+ (KJS::Collector::recordExtraCost):
+ (KJS::Collector::heapAllocate):
+ (KJS::Collector::allocate):
+ (KJS::Collector::allocateNumber):
+ (KJS::Collector::registerThread):
+ (KJS::Collector::markStackObjectsConservatively):
+ (KJS::Collector::markMainThreadOnlyObjects):
+ (KJS::Collector::sweep):
+ (KJS::Collector::collect):
+ * kjs/collector.h:
+ * kjs/internal.h:
+ (KJS::NumberImp::operator new):
+ Force numbers to be allocated in the secondary heap.
+
+2007-10-26 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver.
+
+ - encourage GCC a little harder to inline a few hot functions for 1.5% improvement on SunSpider.
+
+ * kjs/value.h:
+ (KJS::JSValue::getUInt32):
+ (KJS::JSValue::getTruncatedInt32):
+ (KJS::JSValue::toNumber):
+ * wtf/PassRefPtr.h:
+ (WTF::PassRefPtr::~PassRefPtr):
+ * wtf/RefPtr.h:
+ (WTF::RefPtr::operator->):
+
+2007-10-26 Mark Rowe <mrowe@apple.com>
+
+ Gtk build fix.
+
+ * kjs/ExecState.h:
+
+2007-10-26 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Mark.
+
+ - Merge Context class fully into ExecState, since they are always created and used together.
+
+ No measurable performance impact but this is a useful cleanup.
+
+ * JavaScriptCore.pri:
+ * kjs/ExecState.cpp:
+ (KJS::ExecState::ExecState):
+ (KJS::ExecState::~ExecState):
+ (KJS::ExecState::mark):
+ (KJS::ExecState::lexicalInterpreter):
+ * kjs/ExecState.h:
+ (KJS::ExecState::dynamicInterpreter):
+ (KJS::ExecState::setException):
+ (KJS::ExecState::clearException):
+ (KJS::ExecState::exception):
+ (KJS::ExecState::exceptionSlot):
+ (KJS::ExecState::hadException):
+ (KJS::ExecState::scopeChain):
+ (KJS::ExecState::callingExecState):
+ (KJS::ExecState::propertyNames):
+ * kjs/collector.cpp:
+ (KJS::Collector::reportOutOfMemoryToAllInterpreters):
+ * kjs/function.cpp:
+ (KJS::FunctionImp::callAsFunction):
+ (KJS::FunctionImp::argumentsGetter):
+ (KJS::FunctionImp::callerGetter):
+ (KJS::GlobalFuncImp::callAsFunction):
+ * kjs/interpreter.cpp:
+ (KJS::Interpreter::Interpreter):
+ (KJS::Interpreter::init):
+ (KJS::Interpreter::evaluate):
+ (KJS::Interpreter::mark):
+ * kjs/interpreter.h:
+ (KJS::Interpreter::setCurrentExec):
+ (KJS::Interpreter::currentExec):
+ * kjs/nodes.cpp:
+ (KJS::currentSourceId):
+ (KJS::currentSourceURL):
+ (KJS::ThisNode::evaluate):
+ (KJS::ResolveNode::evaluate):
+ (KJS::FunctionCallResolveNode::evaluate):
+ (KJS::PostfixResolveNode::evaluate):
+ (KJS::DeleteResolveNode::evaluate):
+ (KJS::TypeOfResolveNode::evaluate):
+ (KJS::PrefixResolveNode::evaluate):
+ (KJS::AssignResolveNode::evaluate):
+ (KJS::VarDeclNode::evaluate):
+ (KJS::DoWhileNode::execute):
+ (KJS::WhileNode::execute):
+ (KJS::ForNode::execute):
+ (KJS::ForInNode::execute):
+ (KJS::ContinueNode::execute):
+ (KJS::BreakNode::execute):
+ (KJS::ReturnNode::execute):
+ (KJS::WithNode::execute):
+ (KJS::SwitchNode::execute):
+ (KJS::LabelNode::execute):
+ (KJS::TryNode::execute):
+ (KJS::FunctionBodyNode::processDeclarationsFunctionCode):
+ (KJS::FunctionBodyNode::processDeclarationsProgramCode):
+ (KJS::FunctionBodyNode::processDeclarations):
+ (KJS::FuncDeclNode::makeFunction):
+ (KJS::FuncExprNode::evaluate):
+
+2007-10-26 Mark Rowe <mrowe@apple.com>
+
+ Windows build fix.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+
+2007-10-26 Mark Rowe <mrowe@apple.com>
+
+ Gtk build fix.
+
+ * JavaScriptCore.pri:
+ * kjs/ExecState.cpp:
+
+2007-10-26 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver.
+
+ - moved Context class into ExecState.{h,cpp} in preparation for merging
+ ExecState and Context classes.
+
+ * kjs/ExecState.h: Moved CodeType enum and Context class here in
+ preparation for merging ExecState and Context.
+ * kjs/ExecState.cpp: Moved Context class here from Context.cpp.
+ (KJS::Context::Context):
+ (KJS::Context::~Context):
+ (KJS::Context::mark):
+ * kjs/context.h: Removed.
+ * kjs/Context.cpp: Removed.
+ * kjs/function.h: Removed CodeType enum.
+ * kjs/LabelStack.h: Added. Pulled LabelStack class out of internal.h.
+ * kjs/internal.h: Removed LabelStack.
+ * JavaScriptCore.xcodeproj/project.pbxproj: Added new file, removed ones that are gone.
+ * kjs/collector.cpp: Fixed includes.
+ * kjs/function.cpp: ditto
+ * kjs/internal.cpp: ditto
+ * kjs/interpreter.cpp: ditto
+ * kjs/lookup.h: ditto
+ * kjs/nodes.cpp: ditto
+
+2007-10-26 Mark Rowe <mrowe@apple.com>
+
+ Windows build fix.
+
+ * kjs/string_object.cpp:
+ (KJS::StringObjectFuncImp::callAsFunction):
+
+2007-10-25 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - http://bugs.webkit.org/show_bug.cgi?id=15703
+ fix numeric functions -- improve correctness and speed
+
+ Gives about 1% gain on SunSpider.
+
+ * kjs/value.h: Added toIntegerPreserveNan, removed toUInt16.
+ (KJS::JSValue::toInt32): Changed to call getTruncatedInt32 in a way that works
+ with both immediate and number values.
+ (KJS::JSValue::toUInt32): Ditto.
+ * kjs/value.cpp:
+ (KJS::JSValue::toInteger): Moved the logic from roundValue here, with a couple
+ differences. One is that it now correctly returns 0 for NaN, and another is that
+ there's no special case for 0 or infinity, since the general case already handles
+ those correctly.
+ (KJS::JSValue::toIntegerPreserveNaN): Added. Like toInteger, but without the
+ check for NaN.
+ (KJS::JSValue::toInt32SlowCase): Call toNumber instead of roundValue. The
+ truncation done by the typecast already does the necessary truncation that
+ roundValue was doing.
+ (KJS::JSValue::toUInt32SlowCase): Ditto.
+ (KJS::JSValue::toUInt16): Removed.
+
+ * kjs/internal.h: Removed roundValue.
+ * kjs/internal.cpp: Ditto.
+
+ * kjs/array_object.cpp: (KJS::ArrayProtoFunc::callAsFunction): Remove unneeded
+ code to handle NaN in Array.slice; toInteger now never returns NaN as specified.
+
+ * kjs/date_object.cpp:
+ (KJS::fillStructuresUsingTimeArgs): Replaced call to roundValue with a call to
+ toNumber as specified.
+ (KJS::DateProtoFunc::callAsFunction): In SetTime case, replaced call to roundValue
+ with a call to toNumber and timeClip as specified.
+ (KJS::DateObjectImp::construct): Removed unnecessary checks of numArgs in cases
+ where the default behavior of toInt32 (returning 0) was already correct. Replaced
+ call to roundValue with a call to toNumber as specified.
+ (KJS::DateObjectFuncImp::callAsFunction): Ditto.
+
+ * kjs/math_object.cpp: (MathFuncImp::callAsFunction): Removed unnecessary special
+ cases for the pow function that the library already handles correctly.
+
+ * kjs/number_object.cpp: (NumberProtoFunc::callAsFunction): Changed ToString to
+ call toIntegerPreserveNaN, so we can continue to handle the NaN case differently.
+ The real toInteger now returns 0 for NaN. Took out unneeded special case in
+ ToFixed for undefined; was only needed because our toInteger was wrong. Same
+ thing in ToExponential. Changed ToPrecision to call toIntegerPreserveNaN.
+
+ * kjs/string_object.cpp:
+ (KJS::StringProtoFunc::callAsFunction): Took out CharAt and CharCodeAt special
+ cases for undefined that were only needed because toInteger was wrong. Same in
+ IndexOf, and was able to remove some special cases. In LastIndexOf, used
+ toIntegerPreserveNaN, but was able to remove some special cases there too.
+ Changed Substr implementation to preserve correct behavior with the change
+ to toInteger and match the specification. Also made sure we weren't converting
+ an out of range double to an int.
+ (KJS::StringObjectFuncImp::callAsFunction): Changed constructor to just use
+ toUInt32, because truncating toUInt32 to 16 bits is the same thing and there's
+ no reason to have toUInt16 as a second, less-optimized function that's only
+ called at this one call site.
+
+ * wtf/MathExtras.h: Added trunc function for Windows.
+
+2007-10-25 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Tweaked the inner hashtable lookup loop to remove a branch in the "not
+ found" case. .5% speedup on SunSpider.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * wtf/HashTable.h:
+ (WTF::::lookup):
+
+2007-10-25 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver.
+
+ - fold together toPrimitive() and toNumber() conversions for 0.5% gain on SunSpider
+
+ * kjs/nodes.cpp:
+ (KJS::SubNode::evaluate): Subtract directly, since toPrimitive() is not
+ adding any value over toNumber() here.
+ (KJS::valueForReadModifyAssignment): Ditto.
+ (KJS::lessThan): Use new getPrimitiveNumber() method to avoid some virtual calls
+ and branches.
+ (KJS::lessThanEq): Ditto.
+ * JavaScriptCore.exp: Export new functions as needed.
+ * kjs/value.h:
+ (KJS::JSValue::toPrimitive): Fixed formatting.
+ (KJS::JSValue::getPrimitiveNumber): New method - this simultaneously converts
+ to number and tells you whether a toPrimitive() conversion with a Number hint
+ would have given a string.
+ * kjs/internal.cpp:
+ (KJS::StringImp::getPrimitiveNumber): Implemented.
+ (KJS::NumberImp::getPrimitiveNumber): ditto
+ (KJS::GetterSetterImp::getPrimitiveNumber): ditto
+ (KJS::StringImp::toPrimitive): Fixed formatting.
+ (KJS::NumberImp::toPrimitive): ditto
+ (KJS::GetterSetterImp::toPrimitive): ditto
+ * kjs/internal.h:
+ * kjs/object.cpp:
+ (KJS::JSObject::getPrimitiveNumber): Implemented.
+ * kjs/object.h:
+
+2007-10-25 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Adam Roben.
+
+ Remove JSStringRefCFHack from windows as it is no longer needed.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+
+2007-10-25 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Rolled out my last patch. It turns out that I needed 2 words, not 1,
+ so it didn't help.
+
+2007-10-25 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Fixed http://bugs.webkit.org/show_bug.cgi?id=15694
+ Shrink the size of an activation object by 1 word
+
+ This is in preparation for adding a symbol table to the activation
+ object.
+
+ The basic strategy here is to rely on the mutual exclusion between
+ the arguments object pointer and the function pointer (you only need
+ the latter in order to create the former), and store them in the same
+ place. The LazyArgumentsObject class encapsulates this strategy.
+
+ Also inlined the ArgumentsImp constructor, for good measure.
+
+ SunSpider reports no regression. Regression tests pass.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * kjs/Context.cpp:
+ (KJS::Context::~Context):
+ * kjs/function.cpp:
+ (KJS::ActivationImp::LazyArgumentsObject::createArgumentsObject):
+ (KJS::ActivationImp::LazyArgumentsObject::mark):
+ (KJS::ActivationImp::argumentsGetter):
+ (KJS::ActivationImp::mark):
+ * kjs/function.h:
+ (KJS::ActivationImp::LazyArgumentsObject::LazyArgumentsObject):
+ (KJS::ActivationImp::LazyArgumentsObject::getOrCreate):
+ (KJS::ActivationImp::LazyArgumentsObject::resetArguments):
+ (KJS::ActivationImp::LazyArgumentsObject::setArgumentsObject):
+ (KJS::ActivationImp::LazyArgumentsObject::argumentsObject):
+ (KJS::ActivationImp::LazyArgumentsObject::setFunction):
+ (KJS::ActivationImp::LazyArgumentsObject::function):
+ (KJS::ActivationImp::LazyArgumentsObject::createdArgumentsObject):
+ (KJS::ActivationImp::LazyArgumentsObject::):
+ (KJS::ActivationImp::ActivationImp::ActivationImp):
+ (KJS::ActivationImp::resetArguments):
+
+2007-10-25 Adam Roben <aroben@apple.com>
+
+ Change JavaScriptCore.vcproj to use DerivedSources.make
+
+ We were trying to emulate the logic of make in
+ build-generated-files.sh, but we got it wrong. We now use a
+ build-generated-files very much like the one that WebCore uses to
+ invoke make.
+
+ We also now only have a Debug configuration of dftables which we build
+ even when doing a Release build of JavaScriptCore. dftables also no
+ longer has the "_debug" name suffix.
+
+ Changes mostly made by Darin, reviewed by me.
+
+ * DerivedSources.make: Add a variable to set the extension used for
+ the dftables executable.
+ * JavaScriptCore.vcproj/JavaScriptCore.sln: Updated to use Debug
+ dftables in Release configurations.
+ * JavaScriptCore.vcproj/JavaScriptCoreSubmit.sln: Ditto.
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ - Updated include path to point to the new location of the derived
+ sources.
+ - Modified pre-build event to pass the right arguments to
+ build-generated-files.sh and not call dftables directly.
+ - Added the derived source files to the project.
+ - Removed grammarWrapper.cpp, which isn't needed now that we're
+ compiling grammar.cpp directly.
+ * JavaScriptCore.vcproj/JavaScriptCore/build-generated-files.sh:
+ Slightly modified from the WebCore version.
+ * JavaScriptCore.vcproj/JavaScriptCore/grammarWrapper.cpp: Removed.
+ * JavaScriptCore.vcproj/dftables/dftables.vcproj:
+ - Changed the output location to match Mac.
+ - Removed the Release configuration.
+ - Removed the _debug suffix.
+
+2007-10-25 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Eric Seidel.
+
+ Slightly elaborated the differences between declaration procesing in
+ Function Code and Program Code.
+
+ .3% speedup on SunSpider.
+
+ * kjs/nodes.cpp:
+ (KJS::FunctionBodyNode::processDeclarationsFunctionCode):
+ (KJS::FunctionBodyNode::processDeclarationsProgramCode): Store a
+ minimum set of attributes instead of recomputing all the time. Also,
+ ignore m_parameters, since programs don't have arguments.
+
+2007-10-25 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Maciej.
+
+ More preparation work before adding long-running mode to testkjs.
+
+ * kjs/testkjs.cpp:
+ (TestFunctionImp::callAsFunction):
+ (prettyPrintScript):
+ (runWithScripts):
+ (parseArguments):
+ (kjsmain):
+ (fillBufferWithContentsOfFile):
+
+2007-10-25 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Maciej.
+
+ Bring testkjs code out of the dark ages in preparation for more
+ radical improvements (like long-running testing support!)
+
+ * kjs/testkjs.cpp:
+ (TestFunctionImp::callAsFunction):
+ (setupInterpreter):
+ (doIt):
+ (fillBufferWithContentsOfFile):
+
+2007-10-25 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Make a fast path for declaration processing inside Function Code.
+
+ Lifted declaration processing code up from individual declaration nodes
+ and into processDeclarations.
+
+ Broke out processDeclarations into two cases, depending on the type of
+ code. This eliminates 2 branches, and facilitates more radical
+ divergeance in the future.
+
+ 2.5% SunSpider speedup.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * kjs/nodes.cpp:
+ (KJS::FunctionBodyNode::initializeDeclarationStacks):
+ (KJS::FunctionBodyNode::processDeclarationsFunctionCode):
+ (KJS::FunctionBodyNode::processDeclarationsProgramCode):
+ (KJS::FunctionBodyNode::execute):
+ (KJS::FuncDeclNode::makeFunction):
+ * kjs/nodes.h:
+
+2007-10-25 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Adam.
+
+ - add header includes needed on platforms that don't use AllInOneFile.cpp
+
+ * API/JSCallbackObject.cpp:
+ * kjs/Context.cpp:
+ * kjs/ExecState.cpp:
+ * kjs/array_instance.cpp:
+ * kjs/function_object.cpp:
+ * kjs/interpreter.cpp:
+ * kjs/nodes.cpp:
+
+2007-10-25 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Geoff.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj: re-mark JSGlobalObject.h as private
+
+2007-10-25 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Fixed http://bugs.webkit.org/show_bug.cgi?id=15683
+ Re-order declaration initialization to avoid calling hasProperty inside
+ VarDeclNode::processDeclaration
+
+ .7% speedup on SunSpider.
+
+ * kjs/function.h:
+ * kjs/function.cpp: Merged parameter processing into FunctionBodyNode's
+ other processing of declared symbols, so the order of execution could
+ change.
+
+ * kjs/nodes.cpp:
+ (KJS::VarDeclNode::getDeclarations): Added special case for the
+ "arguments" property name, explained in the comment.
+
+ (KJS::VarDeclNode::processDeclaration): Removed call to hasProperty
+ in the case of function code, since we know the declared symbol
+ management will resolve conflicts between symbols. Yay!
+
+ (KJS::VarDeclListNode::getDeclarations): Now that VarDeclNode's
+ implementation of getDeclarations is non-trivial, we can't take a
+ short-cut here any longer -- we need to put the VarDecl node on the
+ stack so it gets processed normally.
+
+ (KJS::FunctionBodyNode::processDeclarations): Changed the order of
+ processing to enforce mutual exclusion rules.
+
+ * kjs/nodes.h:
+ (KJS::DeclarationStacks::DeclarationStacks): Structure includes an
+ ExecState now, for fast access to the "arguments" property name.
+
+2007-10-24 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Maciej.
+
+ Add a JSGlobalObject class and remove the InterpreterMap
+ http://bugs.webkit.org/show_bug.cgi?id=15681
+
+ This required making JSCallbackObject a template class to allow for
+ JSGlobalObjects with JSCallbackObject functionality.
+
+ SunSpider claims this was a 0.5% speedup.
+
+ * API/JSCallbackObject.cpp:
+ * API/JSCallbackObject.h:
+ * API/JSCallbackObjectFunctions.h: Copied from API/JSCallbackObject.cpp.
+ (KJS::::JSCallbackObject):
+ (KJS::::init):
+ (KJS::::~JSCallbackObject):
+ (KJS::::initializeIfNeeded):
+ (KJS::::className):
+ (KJS::::getOwnPropertySlot):
+ (KJS::::put):
+ (KJS::::deleteProperty):
+ (KJS::::implementsConstruct):
+ (KJS::::construct):
+ (KJS::::implementsHasInstance):
+ (KJS::::hasInstance):
+ (KJS::::implementsCall):
+ (KJS::::callAsFunction):
+ (KJS::::getPropertyNames):
+ (KJS::::toNumber):
+ (KJS::::toString):
+ (KJS::::setPrivate):
+ (KJS::::getPrivate):
+ (KJS::::inherits):
+ (KJS::::cachedValueGetter):
+ (KJS::::staticValueGetter):
+ (KJS::::staticFunctionGetter):
+ (KJS::::callbackGetter):
+ * API/JSClassRef.cpp:
+ (OpaqueJSClass::prototype):
+ * API/JSContextRef.cpp:
+ (JSGlobalContextCreate):
+ * API/JSObjectRef.cpp:
+ (JSObjectMake):
+ (JSObjectGetPrivate):
+ (JSObjectSetPrivate):
+ * API/JSValueRef.cpp:
+ (JSValueIsObjectOfClass):
+ * JavaScriptCore.exp:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * bindings/c/c_utility.cpp:
+ (KJS::Bindings::convertValueToNPVariant):
+ * bindings/jni/jni_jsobject.cpp:
+ * bindings/objc/objc_utility.mm:
+ (KJS::Bindings::convertValueToObjcValue):
+ * kjs/Context.cpp:
+ (KJS::Context::Context):
+ * kjs/ExecState.cpp:
+ (KJS::ExecState::lexicalInterpreter):
+ * kjs/JSGlobalObject.h: Added.
+ (KJS::JSGlobalObject::JSGlobalObject):
+ (KJS::JSGlobalObject::isGlobalObject):
+ (KJS::JSGlobalObject::interpreter):
+ (KJS::JSGlobalObject::setInterpreter):
+ * kjs/array_instance.cpp:
+ * kjs/context.h:
+ * kjs/function.cpp:
+ (KJS::FunctionImp::callAsFunction):
+ (KJS::GlobalFuncImp::callAsFunction):
+ * kjs/interpreter.cpp:
+ (KJS::Interpreter::Interpreter):
+ (KJS::Interpreter::init):
+ (KJS::Interpreter::~Interpreter):
+ (KJS::Interpreter::globalObject):
+ (KJS::Interpreter::initGlobalObject):
+ (KJS::Interpreter::evaluate):
+ * kjs/interpreter.h:
+ * kjs/lookup.h:
+ (KJS::cacheGlobalObject):
+ * kjs/object.h:
+ (KJS::JSObject::isGlobalObject):
+ * kjs/testkjs.cpp:
+
+2007-10-24 Eric Seidel <eric@webkit.org>
+
+ Build fix for Gtk, no review.
+
+ * kjs/collector.cpp: #include "context.h"
+
+2007-10-24 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Maciej.
+
+ Stop checking isOutOfMemory after every allocation, instead let the collector
+ notify all ExecStates if we ever hit this rare condition.
+
+ SunSpider claims this was a 2.2% speedup.
+
+ * kjs/collector.cpp:
+ (KJS::Collector::collect):
+ (KJS::Collector::reportOutOfMemoryToAllInterpreters):
+ * kjs/collector.h:
+ * kjs/nodes.cpp:
+ (KJS::TryNode::execute):
+
+2007-10-24 Mark Rowe <mrowe@apple.com>
+
+ Gtk build fix.
+
+ * kjs/identifier.h: Remove extra qualification.
+
+2007-10-24 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Disable ALWAYS_INLINE in debug builds, since it drives the debugger
+ crazy.
+
+ * wtf/AlwaysInline.h:
+
+2007-10-24 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Inlined the fast path for creating an Identifier from an Identifier.
+
+ This is a .4% speedup on SunSpider overall, but as big as a 2.5%
+ speedup on certain individual tests. 65% of the Identifiers creating
+ by SunSpider are already Identifiers.
+
+ (The main reason I'm making this change is that it resolves a large
+ regression in a patch I haven't checked in yet.)
+
+ * JavaScriptCore.exp:
+ * kjs/identifier.cpp:
+ (KJS::Identifier::addSlowCase):
+ * kjs/identifier.h:
+ (KJS::Identifier::Identifier::add):
+
+2007-10-24 Lars Knoll <lars@trolltech.com>
+
+ Reviewed by Simon.
+
+ some changes to the way JS values are converted to Qt values in the script bindings. Added support for converting JS arrays into QStringList's.
+
+ * bindings/qt/qt_instance.cpp:
+ (KJS::Bindings::QtInstance::invokeMethod):
+ * bindings/qt/qt_runtime.cpp:
+ (KJS::Bindings::convertValueToQVariant):
+ (KJS::Bindings::QtField::setValueToInstance):
+
+2007-10-24 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Darin.
+
+ Remove old relation method, replace with specialised LessThan and lessThenEq functions for a 0.5-0.6% improvement in SunSpider
+
+ * kjs/nodes.cpp:
+ (KJS::lessThan):
+ (KJS::lessThanEq):
+ (KJS::LessNode::evaluate):
+ (KJS::GreaterNode::evaluate):
+ (KJS::LessEqNode::evaluate):
+ (KJS::GreaterEqNode::evaluate):
+ * kjs/operations.cpp:
+ * kjs/operations.h:
+
+2007-10-24 Eric Seidel <eric@webkit.org>
+
+ Reviewed by darin.
+
+ * kjs/nodes.h:
+ (KJS::ImmediateNumberNode::): Fix ASSERT correctness (and debug build!)
+
+2007-10-24 Darin Adler <darin@apple.com>
+
+ Reviewed by Eric.
+
+ * kjs/object.cpp: (KJS::JSObject::defaultValue): Get rid of a little
+ Identifier ref/deref for what SunSpider claims is a 0.4% speedup.
+
+2007-10-24 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - separate out the code to create a hash table the first time from the code
+ to rehash
+
+ SunSpider claims this was a 0.7% speedup.
+
+ * kjs/property_map.cpp:
+ (KJS::PropertyMap::expand): Changed to call either createTable or rehash.
+ (KJS::PropertyMap::createTable): Added. For the case where we had no table.
+ (KJS::PropertyMap::rehash): Removed code needed only in the case where we
+ had no table.
+ * kjs/property_map.h: Added createTable.
+
+2007-10-24 Eric Seidel <eric@webkit.org>
+
+ Reviewed by darin.
+
+ Add ImmediateNumberNode to hold a JSValue* instead of a double for numbers
+ which can be represented by JSImmediate.
+
+ SunSpider claims this was a 0.6% speedup.
+
+ * kjs/grammar.y:
+ * kjs/nodes.cpp:
+ (KJS::NumberNode::evaluate):
+ (KJS::ImmediateNumberNode::evaluate):
+ * kjs/nodes.h:
+ (KJS::Node::):
+ (KJS::ImmediateNumberNode::):
+ * kjs/nodes2string.cpp:
+ (ImmediateNumberNode::streamTo):
+
+2007-10-24 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - http://bugs.webkit.org/show_bug.cgi?id=15657
+ change static hash tables to use powers of two for speed
+
+ Seems to give 0.7% SunSpider speedup.
+
+ * kjs/create_hash_table: Updated to generate new format.
+ * kjs/lookup.cpp:
+ (KJS::keysMatch): Took out unneeded typecast.
+ (KJS::findEntry): Updated to expect table type 3 -- changed the printf to a plain old assert.
+ Replaced the modulus with a bit mask.
+ (KJS::Lookup::findEntry): Get the hash directly, since we know identifiers already have computed
+ their hash -- saves a branch.
+ (KJS::Lookup::find): Ditto.
+ * kjs/lookup.h: Changed attr from 2-byte value to one-byte value. Replaced hashSize with hashSizeMask.
+
+2007-10-24 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin.
+
+ - remove KJS_CHECKEXCEPTIONs in places where exceptions can't happen for 0.6% SunSpider speedup
+
+ * kjs/nodes.cpp:
+ (KJS::DoWhileNode::execute):
+ (KJS::WhileNode::execute):
+ (KJS::ForNode::execute):
+ (KJS::ForInNode::execute):
+ (KJS::SourceElementsNode::execute):
+
+2007-10-23 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ * kjs/JSImmediate.h: (KJS::JSImmediate::getUInt32):
+ Changed an && to an & for a 1% gain in SunSpider.
+
+2007-10-23 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej.
+
+ Reduce branching in implementations of some operator implementations, yielding 1.3% boost to SunSpider.
+
+ * kjs/nodes.cpp:
+ (KJS::MultNode::evaluate):
+ (KJS::DivNode::evaluate):
+ (KJS::ModNode::evaluate):
+ (KJS::add):
+ (KJS::sub):
+ (KJS::AddNode::evaluate):
+ (KJS::SubNode::evaluate):
+ (KJS::valueForReadModifyAssignment):
+ * kjs/operations.cpp:
+ * kjs/operations.h:
+
+2007-10-23 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej.
+
+ Separating all of the simple (eg. non-read-modify-write) binary operators
+ into separate classes in preparation for further JS optimisations.
+
+ Happily this produces a 0.8% to 1.0% performance increase in SunSpider with
+ no further work.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * kjs/grammar.y:
+ * kjs/nodes.cpp:
+ (KJS::MultNode::evaluate):
+ (KJS::DivNode::evaluate):
+ (KJS::ModNode::evaluate):
+ (KJS::AddNode::evaluate):
+ (KJS::SubNode::evaluate):
+ (KJS::LeftShiftNode::evaluate):
+ (KJS::RightShiftNode::evaluate):
+ (KJS::UnsignedRightShiftNode::evaluate):
+ (KJS::LessNode::evaluate):
+ (KJS::GreaterNode::evaluate):
+ (KJS::LessEqNode::evaluate):
+ (KJS::GreaterEqNode::evaluate):
+ (KJS::InstanceOfNode::evaluate):
+ (KJS::InNode::evaluate):
+ (KJS::EqualNode::evaluate):
+ (KJS::NotEqualNode::evaluate):
+ (KJS::StrictEqualNode::evaluate):
+ (KJS::NotStrictEqualNode::evaluate):
+ (KJS::BitAndNode::evaluate):
+ (KJS::BitXOrNode::evaluate):
+ (KJS::BitOrNode::evaluate):
+ (KJS::LogicalAndNode::evaluate):
+ (KJS::LogicalOrNode::evaluate):
+ * kjs/nodes.h:
+ (KJS::MultNode::):
+ (KJS::DivNode::):
+ (KJS::ModNode::):
+ (KJS::AddNode::):
+ (KJS::SubNode::):
+ (KJS::LeftShiftNode::):
+ (KJS::RightShiftNode::):
+ (KJS::UnsignedRightShiftNode::):
+ (KJS::LessNode::):
+ (KJS::GreaterNode::):
+ (KJS::LessEqNode::):
+ (KJS::GreaterEqNode::):
+ (KJS::InstanceOfNode::):
+ (KJS::InNode::):
+ (KJS::EqualNode::):
+ (KJS::NotEqualNode::):
+ (KJS::StrictEqualNode::):
+ (KJS::NotStrictEqualNode::):
+ (KJS::BitAndNode::):
+ (KJS::BitOrNode::):
+ (KJS::BitXOrNode::):
+ (KJS::LogicalAndNode::):
+ (KJS::LogicalOrNode::):
+ * kjs/nodes2string.cpp:
+ (MultNode::streamTo):
+ (DivNode::streamTo):
+ (ModNode::streamTo):
+ (AddNode::streamTo):
+ (SubNode::streamTo):
+ (LeftShiftNode::streamTo):
+ (RightShiftNode::streamTo):
+ (UnsignedRightShiftNode::streamTo):
+ (LessNode::streamTo):
+ (GreaterNode::streamTo):
+ (LessEqNode::streamTo):
+ (GreaterEqNode::streamTo):
+ (InstanceOfNode::streamTo):
+ (InNode::streamTo):
+ (EqualNode::streamTo):
+ (NotEqualNode::streamTo):
+ (StrictEqualNode::streamTo):
+ (NotStrictEqualNode::streamTo):
+ (BitAndNode::streamTo):
+ (BitXOrNode::streamTo):
+ (BitOrNode::streamTo):
+ (LogicalAndNode::streamTo):
+
+2007-10-23 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=15639
+ fix Math.abs(0), Math.ceil(-0), and Math.floor(-0)
+
+ Test: fast/js/math.html
+
+ * kjs/math_object.cpp: (MathFuncImp::callAsFunction):
+ Fix abs to look at the sign bit. Add a special case for values in the range
+ between -0 and -1 and a special case for ceil and for -0 for floor.
+
+2007-10-23 Darin Adler <darin@apple.com>
+
+ Reviewed by Eric.
+
+ - streamline exception handling code for a >1% speed-up of SunSpider
+
+ * kjs/nodes.cpp: Changed macros to use functions for everything that's not
+ part of normal execution. We'll take function call overhead when propagating
+ an exception or out of memory.
+ (KJS::createOutOfMemoryCompletion): Added.
+ (KJS::substitute): Use append instead of the relatively inefficient + operator.
+ (KJS::Node::rethrowException): Added.
+ * kjs/nodes.h: Added rethrowException.
+
+2007-10-22 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=15636
+ some JavaScriptCore regression tests are failing due to numeric conversion
+
+ This should restore correctness and make speed better too, restoring some
+ of the optimization we lost in my last check-in.
+
+ * kjs/JSImmediate.h:
+ (KJS::JSImmediate::getTruncatedInt32): Added. Uses the range checking idiom
+ I used in my patch yesterday.
+ (KJS::JSImmediate::getTruncatedUInt32): Ditto.
+
+ * kjs/internal.h: Removed getInt32 and added getTruncatedInt/UInt32.
+ * kjs/internal.cpp:
+ (KJS::NumberImp::getUInt32): Changed to always use double, since I can't find
+ a way to write this more efficiently for float.
+ (KJS::NumberImp::getTruncatedInt32): Added.
+ (KJS::NumberImp::getTruncatedUInt32): Added.
+
+ * kjs/value.h: Removed getInt32 and added getTruncatedInt/UInt32.
+ (KJS::JSValue::getUInt32):
+ (KJS::JSValue::getTruncatedInt32): Added.
+ (KJS::JSValue::getTruncatedUInt32): Added.
+ (KJS::JSValue::toInt32): Changed getInt32 call to getTruncatedInt32.
+ (KJS::JSValue::toUInt32): Changed getUInt32 call to getTruncatedUInt32.
+ * kjs/value.cpp:
+ (KJS::JSCell::getTruncatedInt32): Added.
+ (KJS::JSCell::getTruncatedUInt32): Added.
+ (KJS::JSValue::toInteger): Changed getUInt32 call to getTruncatedInt32.
+ (KJS::JSValue::toInt32SlowCase): Removed extra getInt32 call I accidentally
+ had left in here.
+ (KJS::JSValue::toUInt32SlowCase): Ditto.
+ (KJS::JSValue::toUInt16): Changed getUInt32 call to getTruncatedUInt32.
+
+ * JavaScriptCore.exp: Updated.
+
+2007-10-22 Darin Adler <darin@apple.com>
+
+ Reviewed by Geoff.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=15632
+ js1_5/Array/array-001.js test failing
+
+ One of the JavaScriptCore tests was failing; it failed because of
+ my change to NumberImp::getUInt32. The incorrect code I copied was
+ from JSImmediate::getUInt32, and was a pre-existing bug.
+
+ This patch fixes correctness, but will surely slow down SunSpider.
+ We may be able to code this tighter and get the speed back.
+
+ * kjs/JSImmediate.h:
+ (KJS::JSImmediate::getInt32): Renamed from toInt32 to more accurately
+ reflect the fact that this function only returns true if the value is
+ accurate (no fractional part, etc.). Changed code so that it returns
+ false when the value has a fraction.
+ (KJS::JSImmediate::getUInt32): Ditto.
+
+ * kjs/internal.cpp:
+ (KJS::NumberImp::getInt32): Changed code so that it returns false when
+ the value has a fraction. Restores the old behavior.
+ (KJS::NumberImp::getUInt32): Ditto.
+
+ * kjs/value.h:
+ (KJS::JSValue::getInt32): Updated for name change.
+ (KJS::JSValue::getUInt32): Ditto.
+ (KJS::JSValue::toInt32): Ditto.
+ (KJS::JSValue::toUInt32): Ditto.
+
+2007-10-22 Darin Adler <darin@apple.com>
+
+ Reviewed by Brady.
+
+ - fix crash seen when running JavaScriptCore tests
+
+ * kjs/array_instance.cpp: (KJS::ArrayInstance::mark):
+ Copy and paste error: I accidentally had code here that was
+ making a copy of the HashMap -- that's illegal inside a mark
+ function and was unnecessary. The other callsite was modifying
+ the map as it iterated it, but this function is not.
+
+2007-10-22 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver.
+
+ - Avoid moving floats into integer registers in jsNumber() for 3% speedup on SunSpider
+ http://bugs.webkit.org/show_bug.cgi?id=15627
+
+ * kjs/JSImmediate.h:
+ (KJS::JSImmediate::fromDouble): Avoid moving floats to integer
+ registers since this is very slow.
+
+2007-10-22 Darin Adler <darin@apple.com>
+
+ Reviewed by Eric Seidel.
+
+ - http://bugs.webkit.org/show_bug.cgi?id=15617
+ improve speed of integer conversions
+
+ Makes SunSpider 6% faster.
+
+ * kjs/JSImmediate.h: Added toInt32 and toUInt32, with separate versions for
+ 32-bit and 64-bit.
+ * kjs/value.h:
+ (KJS::JSValue::getUInt32): Call JSImmediate::toUInt32.
+
+ * kjs/internal.h: Added getInt32.
+ * kjs/internal.cpp:
+ (KJS::NumberImp::getInt32): Added.
+ (KJS::NumberImp::getUInt32): Replaced with more-optimal implementation
+ stolen from JSValue.
+
+ * kjs/value.h:
+ (KJS::jsNumber): Marked ALWAYS_INLINE, because this wasn't getting
+ inlined.
+ (KJS::JSValue::getInt32): Added.
+ (KJS::JSValue::getUInt32): Changed to call the new JSImmediate::toUInt32
+ to avoid converting from float to double.
+ (KJS::JSValue::toInt32): Made inline, separated out the slow case.
+ (KJS::JSValue::toUInt32): Ditto.
+ * kjs/value.cpp:
+ (KJS::JSCell::getInt32): Added.
+ (KJS::JSValue::toInt32SlowCase): Renamed from toInt32. Changed to use the
+ new getInt32. Added a faster case for in-range numbers.
+ (KJS::JSValue::toUInt32SlowCase): Ditto.
+ (KJS::JSValue::toUInt16): Added a faster case for in-range numbers.
+
+ * JavaScriptCore.exp: Updated for changes.
+
+2007-10-22 Adam Roben <aroben@apple.com>
+
+ Windows build fix
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Turn off
+ warning about implicit conversion to bool.
+
+2007-10-22 Mark Rowe <mrowe@apple.com>
+
+ Gtk build fix.
+
+ * kjs/array_instance.cpp:
+
+2007-10-22 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - http://bugs.webkit.org/show_bug.cgi?id=15606
+ make cut-off for sparse vs. dense arrays smarter for speed with large arrays
+
+ Makes the morph test in SunSpider 26% faster, and the overall
+ benchmark 3% faster.
+
+ This also fixes some small problems we had with the distinction
+ between nonexistent and undefined values in arrays.
+
+ * kjs/array_instance.h: Tweaked formatting and naming.
+ * kjs/array_instance.cpp: Copied from kjs/array_object.cpp.
+ (KJS::storageSize): Added. Computes the size of the storage given a vector length.
+ (KJS::increasedVectorLength): Added. Implements the rule for resizing the vector.
+ (KJS::isDenseEnoughForVector): Added.
+ (KJS::ArrayInstance::ArrayInstance): Initialize the new fields.
+ (KJS::ArrayInstance::~ArrayInstance): Since m_storage is now never 0, delete it.
+ (KJS::ArrayInstance::getItem): Updated for name changes.
+ (KJS::ArrayInstance::lengthGetter): Ditto.
+ (KJS::ArrayInstance::inlineGetOwnPropertySlot): Added. Allows both versions of
+ getOwnPropertySlot to share more code.
+ (KJS::ArrayInstance::getOwnPropertySlot): Just refactored, no code change.
+ (KJS::ArrayInstance::put): Added logic for extending the vector as long as the
+ array is dense enough. Also keep m_numValuesInVector up to date.
+ (KJS::ArrayInstance::deleteProperty): Added code to keep m_numValuesInVector
+ up to date.
+ (KJS::ArrayInstance::getPropertyNames): Fixed bug where this would omit names
+ for array indices with undefined values.
+ (KJS::ArrayInstance::increaseVectorLength): Renamed from resizeStorage. Also
+ simplified to only handle getting larger.
+ (KJS::ArrayInstance::setLength): Added code to update m_numValuesInVector, to
+ zero out the unused part of the vector and to delete the map if it's no longer
+ needed.
+ (KJS::ArrayInstance::mark): Tweaked formatting.
+ (KJS::compareByStringForQSort): Ditto.
+ (KJS::ArrayInstance::sort): Ditto.
+ (KJS::CompareWithCompareFunctionArguments::CompareWithCompareFunctionArguments):
+ Ditto.
+ (KJS::compareWithCompareFunctionForQSort): Ditto.
+ (KJS::ArrayInstance::compactForSorting): Fixed bug where this would turn
+ undefined values into nonexistent values in some cases.
+
+ * kjs/array_object.h: Removed MAX_ARRAY_INDEX.
+ * kjs/array_object.cpp: Removed ArrayInstance. Moved to a separate file.
+
+ * JavaScriptCore.pri: Added array_instance.cpp.
+ * JavaScriptCore.xcodeproj/project.pbxproj: Ditto.
+ * kjs/AllInOneFile.cpp: Ditto.
+
+2007-10-22 Andrew Wellington <proton@wiretapped.net>
+
+ Reviewed by Mark Rowe.
+
+ Fix for local database support after r26879
+ Ensure that ENABLE_DATABASE and ENABLE_ICONDATABASE are correctly set
+
+ * Configurations/JavaScriptCore.xcconfig:
+
+2007-10-22 Simon Hausmann <hausmann@kde.org>
+
+ Reviewed by Alp.
+
+ Build fix for the non-qmake builds.
+
+ * wtf/Platform.h: Default to enabling the database features unless
+ otherwise specified. (similar to ENABLE_ICONDATABASE)
+
+2007-10-22 Holger Freyther <zecke@selfish.org>
+
+ Reviewed by Simon Hausmann <hausmann@kde.org>.
+
+ * Do not build testkjs as an application bundle. This is
+ needed for run-javascriptcore-tests on OSX.
+ * Also, based on r26633, allow to test the WebKit/Qt port on OSX.
+ * Set DYLD_LIBRARY_PATH if it was set in the environment. It must be set
+ as we do not have -rpath on OSX.
+
+ * kjs/testkjs.pro:
+
+2007-10-21 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Alp.
+
+ http://bugs.webkit.org/show_bug.cgi?id=15575
+ Bug 15575: [GTK] Implement threading using GThread
+
+ * wtf/Platform.h: Do not enable pthreads for Gtk.
+
+2007-10-21 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Mitz.
+
+ Fix http://bugs.webkit.org/show_bug.cgi?id=15603
+ Bug 15603: Regression(r26847): Crash when sorting an empty array from JavaScript
+
+ * kjs/array_object.cpp:
+ (KJS::freeStorage): Reinstate null-check that was removed in r26847.
+
+2007-10-21 Darin Adler <darin@apple.com>
+
+ - fix Windows build
+
+ * kjs/array_instance.h: Removed unused ExecState parameter.
+ * kjs/array_object.cpp:
+ (KJS::ArrayInstance::put): Ditto.
+ (KJS::ArrayInstance::setLength): Ditto.
+
+2007-10-21 Darin Adler <darin@apple.com>
+
+ * kjs/array_object.cpp: (KJS::ArrayInstance::put):
+ Add missing assignment that was causing regression test crash.
+
+2007-10-21 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - http://bugs.webkit.org/show_bug.cgi?id=15585
+ speed up sparse arrays by using a custom map
+
+ Speeds up SunSpider by 10%.
+
+ * kjs/array_object.cpp:
+ (allocateStorage): Leave room for an additional pointer.
+ (reallocateStorage): Ditto.
+ (freeStorage): Ditto.
+ (ArrayInstance::~ArrayInstance): Delete the overflow map if present.
+ (ArrayInstance::getItem): Read values from the overflow map if present.
+ Removed the check of length, since it slows down the common case.
+ (ArrayInstance::getOwnPropertySlot): Ditto. Also removed the fallback
+ to the property map.
+ (ArrayInstance::put): Write values into the overflow map as needed.
+ Also create overflow map when needed.
+ (ArrayInstance::deleteProperty): Remove values from the overflow map
+ as appropriate.
+ (ArrayInstance::getPropertyNames): Add a name for each identifier in
+ the property map. This is extremely inefficient.
+ (ArrayInstance::setLength): Remove any values in the overflow map
+ that are past the new length, as we formerly did with the property map.
+ (ArrayInstance::mark): Mark any values in the overflow map.
+ (compareByStringForQSort): Removed unneeded undefined case, since
+ compactForSorting guarantees we will have no undefined values.
+ (compareWithCompareFunctionForQSort): Ditto.
+ (ArrayInstance::compactForSorting): Copy all the values out of the
+ overflow map and destroy it.
+
+ * kjs/property_map.h: Removed now-unused getSparseArrayPropertyNames.
+ * kjs/property_map.cpp: Ditto.
+
+2007-10-20 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - http://bugs.webkit.org/show_bug.cgi?id=15579
+ stop churning identifier reference counts copying Completion objects
+
+ * kjs/completion.h: Replace the Identifier with an Identifier*.
+ * kjs/nodes.cpp:
+ (ForInNode::execute): Update for change to Completion constructor.
+ (ContinueNode::execute): Ditto.
+ (BreakNode::execute): Ditto.
+
+2007-10-20 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Alp.
+
+ Gtk changes needed to enable HTML 5 client-side database storage.
+
+ * wtf/Platform.h: Have Gtk use pthreads for now.
+
+2007-10-20 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Fixed http://bugs.webkit.org/show_bug.cgi?id=15570
+ Store gathered declaration nodes in the function body node.
+
+ This means that you only have to gather the declaration nodes the first
+ time the function executes. Performance gain of 2.10% on SunSpider,
+ 0.90% on command-line JS iBench.
+
+ * kjs/nodes.cpp: Split declaration stack initialization code off into
+ initializeDeclarationStacks().
+ (FunctionBodyNode::FunctionBodyNode):
+ (FunctionBodyNode::initializeDeclarationStacks):
+ (FunctionBodyNode::processDeclarations):
+
+ * kjs/nodes.h: Changed DeclarationStacks structure to hold references,
+ since the actual Vectors are now stored either on the stack or in the
+ function body node.
+
+2007-10-19 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ http://bugs.webkit.org/show_bug.cgi?id=15559
+ Moved processDeclarations call into FunctionBodyNode::execute
+
+ To improve encapsulation, moved processDeclarations call into
+ FunctionBodyNode::execute. Also marked processDeclarations
+ ALWAYS_INLINE, since it has only 1 caller now. This is a .71% speedup
+ on command-line JS iBench.
+
+ * kjs/function.cpp:
+ (KJS::FunctionImp::callAsFunction):
+ (KJS::GlobalFuncImp::callAsFunction):
+ * kjs/function.h:
+ * kjs/interpreter.cpp:
+ (KJS::Interpreter::evaluate):
+ * kjs/nodes.cpp:
+ (FunctionBodyNode::execute):
+ * kjs/nodes.h:
+
+2007-10-19 Brady Eidson <beidson@apple.com>
+
+ Reviewed by Sam
+
+ Queue -> Deque! and small style tweaks
+
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
+ * wtf/Deque.h: Added.
+ (WTF::DequeNode::DequeNode):
+ (WTF::Deque::Deque):
+ (WTF::Deque::~Deque):
+ (WTF::Deque::size):
+ (WTF::Deque::isEmpty):
+ (WTF::Deque::append):
+ (WTF::Deque::prepend):
+ (WTF::Deque::first):
+ (WTF::Deque::last):
+ (WTF::Deque::removeFirst):
+ (WTF::Deque::clear):
+ * wtf/Queue.h: Removed.
+
+
+2007-10-19 Brady Eidson <beidson@apple.com>
+
+ Reviewed by Oliver
+
+ Added a simple LinkedList based Queue to wtf
+ We can make a better, more sophisticated an efficient one later, but have
+ needed one for some time, now!
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * wtf/Queue.h: Added.
+ (WTF::QueueNode::QueueNode):
+ (WTF::Queue::Queue):
+ (WTF::Queue::~Queue):
+ (WTF::Queue::size):
+ (WTF::Queue::isEmpty):
+ (WTF::Queue::append):
+ (WTF::Queue::prepend):
+ (WTF::Queue::first):
+ (WTF::Queue::last):
+ (WTF::Queue::removeFirst):
+ (WTF::Queue::clear):
+
+2007-10-19 Nikolas Zimmermann <zimmermann@kde.org>
+
+ Reviewed by Anders.
+
+ Try to fix Qt/Win build slave, by including windows.h also on Qt/Win.
+
+ * kjs/testkjs.cpp: Change PLATFORM(WIN) to PLATFORM(WIN_OS)
+
+2007-10-19 Simon Hausmann <hausmann@kde.org>
+
+ Reviewed by Lars.
+
+ Fix compilation on Windows when wchar_t is a typedef instead of a native type (triggered by -Zc:wchar_t-).
+ Don't provide the wchar_t overloads then as they conflict with the unsigned short ones.
+
+ * wtf/ASCIICType.h:
+ (WTF::isASCIIAlpha):
+ (WTF::isASCIIAlphanumeric):
+ (WTF::isASCIIDigit):
+ (WTF::isASCIIHexDigit):
+ (WTF::isASCIILower):
+ (WTF::isASCIISpace):
+ (WTF::toASCIILower):
+ (WTF::toASCIIUpper):
+
+2007-10-19 Simon Hausmann <hausmann@kde.org>
+
+ Reviewed by Lars.
+
+ Another build fix for the windows/qt build: Apply the same fix as in revision 26686 also to kjs/config.h to disable the disallowctype feature.
+
+ * kjs/config.h:
+
+2007-10-18 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Adam.
+
+ - use __declspec(thread) for fast thread-local storage on Windows
+
+ - 2.2% speedup on sunspider (on Windows)
+ - 7% speedup on the string section
+ - 6% speedup on JS iBench
+
+ - fixed <rdar://problem/5473084> PLT on Windows got 2.5% slower between r25406 and r25422
+ - fixed at least some of <rdar://5527965? i-Bench JS was 14% slower in 310A11 than 310A10
+
+
+ * wtf/FastMalloc.cpp:
+ (WTF::getThreadHeap):
+ (WTF::setThreadHeap):
+ (WTF::TCMalloc_ThreadCache::GetCache):
+ (WTF::TCMalloc_ThreadCache::GetCacheIfPresent):
+ (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary):
+
+2007-10-17 Darin Adler <darin@apple.com>
+
+ Reviewed by Mark Rowe.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=15543
+ <rdar://problem/5545639> REGRESSION (r26697):
+ GoogleDocs: Can't create new documents or open existing ones
+
+ Test: fast/js/regexp-non-character.html
+
+ * pcre/pcre_compile.c: (check_escape): Take out the checks for valid characters
+ in the \u sequences -- not needed and actively harmful.
+
+2007-10-17 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Oliver.
+
+ * wtf/Platform.h:
+ #define USE_PTHREADS on Mac.
+
+2007-10-17 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Merged DeclaredFunctionImp into FunctionImp (the base class) because
+ the distinction between the two was unused.
+
+ Removed codeType() from FunctionImp because FunctionImp and its
+ subclasses all returned FunctionCode, so it was unused, practically
+ speaking.
+
+ Removed a different codeType() from GlobalFuncImp because it was unused.
+ (Perhaps it was vestigial from a time when GlobalFuncImp used to
+ inherit from FunctionImp.)
+
+ * bindings/runtime_method.cpp:
+ * bindings/runtime_method.h:
+ * kjs/function.cpp:
+ (KJS::FunctionImp::FunctionImp):
+ (KJS::FunctionImp::callAsFunction):
+ (KJS::FunctionImp::construct):
+ (KJS::FunctionImp::execute):
+ (KJS::FunctionImp::processVarDecls):
+ * kjs/function.h:
+ (KJS::FunctionImp::implementsConstruct):
+ (KJS::FunctionImp::scope):
+ * kjs/function_object.cpp:
+ (FunctionProtoFunc::callAsFunction):
+ (FunctionObjectImp::construct):
+ * kjs/nodes.cpp:
+ (FuncDeclNode::processFuncDecl):
+ (FuncExprNode::evaluate):
+
+2007-10-17 Adam Roben <aroben@apple.com>
+
+ Windows build fix part 2.
+
+ Fix was by Darin, reviewed by Anders and Adam.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Add
+ FastMallocPCRE.cpp to the project, and let Visual Studio have its way
+ with the post-build step.
+ * pcre/pcre.h: Don't DLL export the entry points just because this
+ is Win32 -- this is an internal copy of PCRE and should be private.
+ * pcre/pcre_compile.c: Fix an uninitialized variable warning --
+ there's no real problem but it's better to quiet the compiler by
+ tweaking the code slightly than turn off the warning entirely.
+
+2007-10-17 Adam Roben <aroben@apple.com>
+
+ Windows build fix.
+
+ Reviewed by Anders.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Disable
+ some mismatched signed/unsigned comparison warnings.
+ * pcre/pcre_exec.c:
+ (match): #if-out some labels that don't seem to exist.
+
+2007-10-17 Mark Rowe <mrowe@apple.com>
+
+ Gtk build fix.
+
+ * JavaScriptCore.pri: Add FastMallocPCRE.cpp.
+ * pcre/pcre_get. #if out two functions that depend on pcre_get_stringnumber, which
+ is currently unavailable for UTF-16.
+
+2007-10-16 Darin Adler <darin@apple.com>
+
+ Reviewed by Geoff.
+
+ - merged PCRE changes between 6.4 and 6.5
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ Removed pcre_config.c, pcre_globals.c, pcre_info.c, pcre_maketables.c,
+ pcre_printint.src, pcre_refcount.c, pcre_study.c, pcre_try_flipped.c,
+ pcre_ucp_findchar.c, pcre_version.c, and ucptable.c. Added pcre_ucp_searchfuncs.c.
+
+ * pcre/AUTHORS:
+ * pcre/LICENCE:
+ * pcre/MERGING:
+ * pcre/dftables.c:
+ * pcre/pcre-config.h:
+ * pcre/pcre.h:
+ * pcre/pcre.pri:
+ * pcre/pcre_compile.c:
+ * pcre/pcre_exec.c:
+ * pcre/pcre_fullinfo.c:
+ * pcre/pcre_get.c:
+ * pcre/pcre_internal.h:
+ * pcre/pcre_maketables.c:
+ * pcre/pcre_ord2utf8.c:
+ * pcre/pcre_tables.c:
+ * pcre/pcre_ucp_searchfuncs.c: Copied from pcre/pcre_ucp_findchar.c.
+ * pcre/pcre_xclass.c:
+ * pcre/ucp.h:
+ * pcre/ucpinternal.h:
+ * pcre/ucptable.c:
+ Updated with new versions from the PCRE 6.5 release, merged with changes.
+
+ * pcre/pcre_config.c: Removed.
+ * pcre/pcre_globals.c: Removed.
+ * pcre/pcre_info.c: Removed.
+ * pcre/pcre_printint.src: Removed.
+ * pcre/pcre_refcount.c: Removed.
+ * pcre/pcre_study.c: Removed.
+ * pcre/pcre_try_flipped.c: Removed.
+ * pcre/pcre_ucp_findchar.c: Removed.
+ * pcre/pcre_version.c: Removed.
+
+2007-10-16 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Removed KJS_VERBOSE because it was getting in the way of readability,
+ and the messages didn't seem very helpful.
+
+ * kjs/function.cpp:
+ (KJS::FunctionImp::callAsFunction):
+ (KJS::FunctionImp::passInParameters):
+ * kjs/lookup.h:
+ (KJS::lookupPut):
+ * kjs/object.cpp:
+ (KJS::JSObject::put):
+ * kjs/value.h:
+
+2007-10-16 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Removed the Parameter class because it was a redundant wrapper around
+ Identifier.
+
+ * kjs/function.cpp:
+ (KJS::FunctionImp::passInParameters):
+ (KJS::FunctionImp::getParameterName):
+ * kjs/nodes.cpp:
+ (FunctionBodyNode::addParam):
+ * kjs/nodes.h:
+ (KJS::FunctionBodyNode::):
+
+2007-10-16 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Global replace of assert with ASSERT.
+
+2007-10-16 Adam Roben <aroben@apple.com>
+
+ Make testkjs not delay-load WebKit
+
+ Soon, delay-loading WebKit will be impossible (because we will be
+ using __declspec(thread) for thread-local storage). This change
+ prepares testkjs for the future.
+
+ Reviewed by Sam.
+
+ * JavaScriptCore.vcproj/JavaScriptCore.sln: Removed WebKitInitializer,
+ added FindSafari.
+ * JavaScriptCore.vcproj/testkjs/testkjs.vcproj: Don't link against
+ WebKitInitializer, don't delay-load WebKit.
+ * kjs/testkjs.cpp: Don't use WebKitInitializer.
+
+2007-10-16 Adam Roben <aroben@apple.com>
+
+ Updated testkjs for the rename of WebKit_debug.dll to WebKit.dll for the Debug configuration
+
+ Reviewed by Kevin McCullough.
+
+ * JavaScriptCore.vcproj/debug.vsprops: Added WebKitDLLConfigSuffix.
+ * JavaScriptCore.vcproj/debug_internal.vsprops: Ditto.
+ * JavaScriptCore.vcproj/release.vsprops: Ditto.
+ * JavaScriptCore.vcproj/testkjs/testkjs.vcproj: Use
+ WebKitDLLConfigSuffix when referring to WebKit.dll, and fixed a typo
+ in the name of icuuc36[_debug].dll.
+
+2007-10-16 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Re-structured variable and function declaration code.
+
+ Command-line JS iBench shows no regression.
+
+ Here are the changes:
+
+ 1. Function declarations are now processed at the same time as var
+ declarations -- namely, immediately upon entry to an execution context.
+ This does not match Firefox, which waits to process a function
+ declaration until the declaration's containing block executes, but it
+ does match IE and the ECMA spec. (10.1.3 states that var and function
+ declarations should be processed at the same time -- namely, "On
+ entering an execution context." 12.2 states that "A Block does not
+ define a new execution scope.")
+
+ 2. Declaration processing proceeds iteratively now, rather than
+ recursively, storing the nodes is finds in stacks. This will later
+ facilitate an optimization to hold on to the gathered declaration nodes,
+ rather than re-fetching them in every function call.
+ [ http://bugs.webkit.org/show_bug.cgi?id=14868 ]
+
+ Modified these tests because they expected the incorrect Mozilla
+ behavior described above:
+
+ * tests/mozilla/ecma_3/Function/scope-001.js:
+ * tests/mozilla/js1_5/Scope/regress-184107.js:
+
+2007-10-16 Darin Adler <darin@apple.com>
+
+ - try to fix the GTK build
+
+ * kjs/ustring.cpp: Include ASCIICType.h, not ASCIICtype.h.
+
+2007-10-16 Darin Adler <darin@apple.com>
+
+ - try to fix the Windows build
+
+ * kjs/date_object.cpp: (KJS::parseDate): A couple instances of isspace were
+ in here. Not sure why it wasn't failing elsewhere. Changed to isASCIISpace.
+
+2007-10-16 Darin Adler <darin@apple.com>
+
+ - try to fix the GTK build
+
+ * kjs/ustring.cpp: Include ASCIICType.h.
+
+2007-10-16 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej and Geoff (and looked over by Eric).
+
+ - http://bugs.webkit.org/show_bug.cgi?id=15519
+ eliminate use of <ctype.h> for processing ASCII
+
+ * wtf/ASCIICType.h: Added.
+ * wtf/DisallowCType.h: Added.
+
+ * kjs/config.h: Include DisallowCType.h.
+
+ * kjs/date_object.cpp:
+ (KJS::skipSpacesAndComments):
+ (KJS::findMonth):
+ (KJS::parseDate):
+ * kjs/function.cpp:
+ (KJS::decode):
+ * kjs/ustring.cpp:
+ (KJS::UString::toDouble):
+ Use ASCIICType.h functions instead of ctype.h ones.
+
+2007-10-14 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin.
+
+ - fixes for "New JavaScript benchmark"
+ http://bugs.webkit.org/show_bug.cgi?id=15515
+
+ * kjs/testkjs.cpp:
+ (TestFunctionImp::callAsFunction): Implement "load" for compatibility
+ with SpiderMonkey.
+ (TestFunctionImp::): ditto
+ (doIt): ditto
+ (kjsmain): Drop useless --> from output.
+
+2007-10-15 Geoffrey Garen <ggaren@apple.com>
+
+ Removed unnecessary #include.
+
+ * API/JSObjectRef.cpp:
+
+2007-10-15 Geoffrey Garen <ggaren@apple.com>
+
+ Double-reverse build fix. My tree was out of date.
+
+ * kjs/nodes.cpp:
+ (NumberNode::evaluate):
+
+2007-10-15 Geoffrey Garen <ggaren@apple.com>
+
+ Build fix.
+
+ * kjs/nodes.cpp:
+ (NumberNode::evaluate):
+
+2007-10-15 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Removed surprising self-named "hack" that made nested functions
+ available as named properties of their containing functions, and placed
+ containing function objects in the scope chains of nested functions.
+
+ There were a few reasons to remove this "hack:"
+
+ 1. It contradicted FF, IE, and the ECMA spec.
+
+ 2. It incurred a performance penalty, since merely parsing a function
+ required parsing its body for nested functions (and so on).
+
+ 3. SVN history contains no explanation for why it was added. It was just
+ legacy code in a large merge a long, long time ago.
+
+ [ Patch broken off from http://bugs.webkit.org/show_bug.cgi?id=14868 ]
+
+ * kjs/nodes.cpp:
+ (FuncDeclNode::processFuncDecl):
+
+2007-10-15 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Removed the concept of AnonymousCode. It was unused, and it doesn't
+ exist in the ECMA spec.
+
+ [ Patch broken off from http://bugs.webkit.org/show_bug.cgi?id=14868 ]
+
+ * kjs/Context.cpp:
+ (KJS::Context::Context):
+ * kjs/function.h:
+ * kjs/nodes.cpp:
+ (ReturnNode::execute):
+
+2007-10-15 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Made function parameters DontDelete. This matches FF and the vague
+ description in ECMA 10.1.3. It's also required in order to make
+ symbol table based lookup of function parameters valid. (If the
+ parameters aren't DontDelete, you can't guarantee that you'll find
+ them later in the symbol table.)
+
+ [ Patch broken off from http://bugs.webkit.org/show_bug.cgi?id=14868 ]
+
+ * kjs/function.cpp:
+ (KJS::FunctionImp::passInParameters):
+
+2007-10-15 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Some Vector optimizations. These are especially important when using
+ Vector as a stack for implementing recursive algorithms iteratively.
+
+ [ Broken off from http://bugs.webkit.org/show_bug.cgi?id=14868 ]
+
+ 1. Added shrink(), which is a version of resize() that you can call
+ to save a branch / improve code generation and inlining when you know
+ that the vector is not getting bigger.
+
+ 2. Changed subclassing relationship in VectorBuffer to remove a call to
+ fastFree() in the destructor for the inlineCapacity != 0 template
+ specialization. This brings inline Vectors one step closer to true
+ stack-allocated arrays.
+
+ Also changed abort() to CRASH(), since the latter works better.
+
+ * wtf/Vector.h:
+ (WTF::VectorBufferBase::allocateBuffer):
+ (WTF::VectorBufferBase::deallocateBuffer):
+ (WTF::VectorBufferBase::VectorBufferBase):
+ (WTF::VectorBufferBase::~VectorBufferBase):
+ (WTF::):
+ (WTF::VectorBuffer::VectorBuffer):
+ (WTF::VectorBuffer::~VectorBuffer):
+ (WTF::VectorBuffer::deallocateBuffer):
+ (WTF::VectorBuffer::releaseBuffer):
+ (WTF::Vector::clear):
+ (WTF::Vector::removeLast):
+ (WTF::::operator):
+ (WTF::::fill):
+ (WTF::::shrink):
+
+2007-10-12 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Fixed http://bugs.webkit.org/show_bug.cgi?id=15490
+ Iteration statements sometimes incorrectly evaluate to the empty value
+ (KDE r670547).
+
+ [ Broken off from http://bugs.webkit.org/show_bug.cgi?id=14868 ]
+
+ This patch is a merge of KDE r670547, with substantial modification
+ for performance.
+
+ It fixes do-while statements to evaluate to a value. (They used
+ to evaluate to the empty value in all cases.)
+
+ It also fixes SourceElementsNode to maintain the value of abnormal
+ completions like "break" and "continue."
+
+ It also re-works the main execution loop in SourceElementsNode so that
+ it (1) makes a little more sense and (2) avoids unnecessary work. This
+ is a .28% speedup on command-line JS iBench.
+
+ * kjs/nodes.cpp:
+ (DoWhileNode::execute):
+ (SourceElementsNode::execute):
+
+2007-10-15 Simon Hausmann <hausmann@kde.org>
+
+ Reviewed by Lars.
+
+ Fix compilation with gcc 4.3 by including 'limits' due to the use of std::numeric_limits.
+
+ * wtf/HashTraits.h:
+
+2007-10-5 Kevin Ollivier <kevino@theolliviers.com>
+
+ Reviewed by Adam.
+
+ Add support for MSVC7, and fix cases where PLATFORM(WIN) should
+ be PLATFORM(WIN_OS) for other ports building on Windows.
+
+ * kjs/DateMath.cpp:
+ (KJS::getDSTOffsetSimple):
+ * kjs/JSImmediate.h:
+ * wtf/Assertions.cpp:
+ * wtf/Assertions.h:
+ * wtf/Platform.h:
+ * wtf/StringExtras.h:
+ (snprintf):
+ (vsnprintf):
+
+2007-10-14 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Darin.
+
+ Adds NegateNode optimization from KJS. The relevant revision in KDE
+ is 666736.
+
+ * kjs/grammar.y:
+ * kjs/nodes.cpp:
+ (NumberNode::evaluate):
+ * kjs/nodes.h:
+ (KJS::Node::):
+ (KJS::NumberNode::):
+ * kjs/nodes2string.cpp:
+ (NumberNode::streamTo):
+
+2007-10-14 Jason Foreman <jason@threeve.org>
+
+ Reviewed by Maciej.
+
+ Fix http://bugs.webkit.org/show_bug.cgi?id=15145
+
+ Ensure that if adjusting n to minimize the difference of n*intPow10(e-p+1) to x,
+ that the property n < intPow10(p) is maintained.
+
+ * kjs/number_object.cpp:
+ (NumberProtoFunc::callAsFunction):
+
+== Rolled over to ChangeLog-2007-10-14 ==
diff --git a/Source/JavaScriptCore/ChangeLog-2009-06-16 b/Source/JavaScriptCore/ChangeLog-2009-06-16
new file mode 100644
index 0000000..52d3c36
--- /dev/null
+++ b/Source/JavaScriptCore/ChangeLog-2009-06-16
@@ -0,0 +1,39978 @@
+2009-06-15 Gavin Barraclough <barraclough@apple.com>
+
+ Rubber Stamped by Sam Weinig.
+
+ Rename PatchBuffer to LinkBuffer. Previously our terminology has been a little
+ mixed up, but we have decided to fix on refering to the process that takes place
+ at the end of code generation as 'linking', and on any modifications that take
+ place later (and once the code has potentially already been executed) as 'patching'.
+
+ However, the term 'PatchBuffer' is already in use, and needs to be repurposed.
+
+ To try to minimize confusion, we're going to switch the terminology over in stages,
+ so for now we'll refer to later modifications as 'repatching'. This means that the
+ new 'PatchBuffer' has been introduced with the name 'RepatchBuffer' instead.
+
+ This patch renames the old 'PatchBuffer' to 'LinkBuffer'. We'll leave ToT in this
+ state for a week or so to try to avoid to much overlap of the meaning of the term
+ 'PatchBuffer', then will come back and rename 'RepatchBuffer'.
+
+ * assembler/ARMv7Assembler.h:
+ * assembler/AbstractMacroAssembler.h:
+ (JSC::AbstractMacroAssembler::LinkBuffer::LinkBuffer):
+ (JSC::AbstractMacroAssembler::LinkBuffer::~LinkBuffer):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompile):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::privateCompilePutByIdTransition):
+ (JSC::JIT::privateCompilePatchGetArrayLength):
+ (JSC::JIT::privateCompileGetByIdProto):
+ (JSC::JIT::privateCompileGetByIdSelfList):
+ (JSC::JIT::privateCompileGetByIdProtoList):
+ (JSC::JIT::privateCompileGetByIdChainList):
+ (JSC::JIT::privateCompileGetByIdChain):
+ * yarr/RegexJIT.cpp:
+ (JSC::Yarr::RegexGenerator::compile):
+
+2009-06-15 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Having moved most of their functionality into the RepatchBuffer class,
+ we can simplify the CodeLocation* classes.
+
+ The CodeLocation* classes are currently a tangle of templatey and friendly
+ badness, burried in the middle of AbstractMacroAssembler. Having moved
+ the ability to repatch out into RepatchBufer they are now do-nothing wrappers
+ on CodePtr (MacroAssemblerCodePtr), that only exist to provide type-safety.
+
+ Simplify the code, and move them off into their own header.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * assembler/AbstractMacroAssembler.h:
+ (JSC::AbstractMacroAssembler::PatchBuffer::patch):
+ * assembler/CodeLocation.h: Copied from assembler/AbstractMacroAssembler.h.
+ (JSC::CodeLocationCommon::CodeLocationCommon):
+ (JSC::CodeLocationInstruction::CodeLocationInstruction):
+ (JSC::CodeLocationLabel::CodeLocationLabel):
+ (JSC::CodeLocationJump::CodeLocationJump):
+ (JSC::CodeLocationCall::CodeLocationCall):
+ (JSC::CodeLocationNearCall::CodeLocationNearCall):
+ (JSC::CodeLocationDataLabel32::CodeLocationDataLabel32):
+ (JSC::CodeLocationDataLabelPtr::CodeLocationDataLabelPtr):
+ (JSC::CodeLocationCommon::instructionAtOffset):
+ (JSC::CodeLocationCommon::labelAtOffset):
+ (JSC::CodeLocationCommon::jumpAtOffset):
+ (JSC::CodeLocationCommon::callAtOffset):
+ (JSC::CodeLocationCommon::nearCallAtOffset):
+ (JSC::CodeLocationCommon::dataLabelPtrAtOffset):
+ (JSC::CodeLocationCommon::dataLabel32AtOffset):
+ * assembler/MacroAssemblerCodeRef.h:
+ (JSC::MacroAssemblerCodePtr::operator!):
+ * bytecode/CodeBlock.h:
+ (JSC::getStructureStubInfoReturnLocation):
+ (JSC::getCallLinkInfoReturnLocation):
+ (JSC::getMethodCallLinkInfoReturnLocation):
+ * bytecode/Instruction.h:
+ * bytecode/JumpTable.h:
+ (JSC::StringJumpTable::ctiForValue):
+ (JSC::SimpleJumpTable::ctiForValue):
+ * bytecode/StructureStubInfo.h:
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::emitCatch):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompile):
+ * jit/JITStubs.cpp:
+ (JSC::JITStubs::DEFINE_STUB_FUNCTION):
+ (JSC::JITStubs::getPolymorphicAccessStructureListSlot):
+
+2009-06-15 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Having introduced the RepatchBuffer, ProcessorReturnAddress is now a do-nothing
+ wrapper around ReturnAddressPtr. Remove it. In tugging on this piece of string
+ it made sense to roll out the use of ReturnAddressPtr a little further into
+ JITStubs (which had always been the intention).
+
+ No performance impact.
+
+ * assembler/AbstractMacroAssembler.h:
+ (JSC::AbstractMacroAssembler::RepatchBuffer::relinkCallerToTrampoline):
+ (JSC::AbstractMacroAssembler::RepatchBuffer::relinkCallerToFunction):
+ (JSC::AbstractMacroAssembler::RepatchBuffer::relinkNearCallerToTrampoline):
+ * assembler/MacroAssemblerCodeRef.h:
+ (JSC::ReturnAddressPtr::ReturnAddressPtr):
+ * bytecode/CodeBlock.h:
+ (JSC::CodeBlock::getStubInfo):
+ (JSC::CodeBlock::getCallLinkInfo):
+ (JSC::CodeBlock::getMethodCallLinkInfo):
+ (JSC::CodeBlock::getBytecodeIndex):
+ * interpreter/Interpreter.cpp:
+ (JSC::bytecodeOffsetForPC):
+ * jit/JIT.cpp:
+ (JSC::ctiPatchNearCallByReturnAddress):
+ (JSC::ctiPatchCallByReturnAddress):
+ * jit/JIT.h:
+ (JSC::JIT::compileGetByIdProto):
+ (JSC::JIT::compileGetByIdChain):
+ (JSC::JIT::compilePutByIdTransition):
+ (JSC::JIT::compilePatchGetArrayLength):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::privateCompilePutByIdTransition):
+ (JSC::JIT::patchGetByIdSelf):
+ (JSC::JIT::patchPutByIdReplace):
+ (JSC::JIT::privateCompilePatchGetArrayLength):
+ (JSC::JIT::privateCompileGetByIdProto):
+ (JSC::JIT::privateCompileGetByIdChain):
+ * jit/JITStubs.cpp:
+ (JSC::JITThunks::tryCachePutByID):
+ (JSC::JITThunks::tryCacheGetByID):
+ (JSC::StackHack::StackHack):
+ (JSC::returnToThrowTrampoline):
+ (JSC::throwStackOverflowError):
+ (JSC::JITStubs::DEFINE_STUB_FUNCTION):
+ * jit/JITStubs.h:
+ (JSC::):
+ (JSC::JITStackFrame::returnAddressSlot):
+ * runtime/JSGlobalData.h:
+
+2009-06-15 Simon Fraser <simon.fraser@apple.com>
+
+ Reviewed by Mark Rowe.
+
+ <rdar://problem/6974857>
+
+ Define ENABLE_3D_RENDERING when building on 10.6, and move ENABLE_3D_RENDERING
+ switch from config.h to wtf/Platform.h.
+
+ * Configurations/FeatureDefines.xcconfig:
+ * wtf/Platform.h:
+
+2009-06-15 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Move repatching methods into a set of methods on a class. This will allow us to
+ coallesce memory reprotection calls. Really, we want this class to be called
+ PatchBuffer, we want the class PatchBuffer to be called LinkBuffer, we want both
+ to be memblers of MacroAssembler rather then AbstractMacroAssembler, we don't
+ want the CodeLocationFoo types anymore (they are now only really there to provide
+ type safety, and that is completely undermined by the way we use offsets). Then
+ the link & patch buffers should delegate the actual patching calls to the
+ architecture-specific layer of the MacroAssembler. Landing all these changes as a
+ sequence of patches.
+
+ No performance impact.
+
+ * assembler/AbstractMacroAssembler.h:
+ (JSC::AbstractMacroAssembler::CodeLocationCall::CodeLocationCall):
+ (JSC::AbstractMacroAssembler::CodeLocationNearCall::CodeLocationNearCall):
+ (JSC::AbstractMacroAssembler::CodeLocationNearCall::calleeReturnAddressValue):
+ (JSC::AbstractMacroAssembler::RepatchBuffer::RepatchBuffer):
+ (JSC::AbstractMacroAssembler::RepatchBuffer::relink):
+ (JSC::AbstractMacroAssembler::RepatchBuffer::repatch):
+ (JSC::AbstractMacroAssembler::RepatchBuffer::relinkCallerToTrampoline):
+ (JSC::AbstractMacroAssembler::RepatchBuffer::relinkCallerToFunction):
+ (JSC::AbstractMacroAssembler::RepatchBuffer::relinkNearCallerToTrampoline):
+ (JSC::AbstractMacroAssembler::RepatchBuffer::repatchLoadPtrToLEA):
+ * jit/JIT.cpp:
+ (JSC::ctiPatchNearCallByReturnAddress):
+ (JSC::ctiPatchCallByReturnAddress):
+ (JSC::JIT::unlinkCall):
+ (JSC::JIT::linkCall):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::privateCompilePutByIdTransition):
+ (JSC::JIT::patchGetByIdSelf):
+ (JSC::JIT::patchMethodCallProto):
+ (JSC::JIT::patchPutByIdReplace):
+ (JSC::JIT::privateCompilePatchGetArrayLength):
+ (JSC::JIT::privateCompileGetByIdProto):
+ (JSC::JIT::privateCompileGetByIdSelfList):
+ (JSC::JIT::privateCompileGetByIdProtoList):
+ (JSC::JIT::privateCompileGetByIdChainList):
+ (JSC::JIT::privateCompileGetByIdChain):
+
+2009-06-15 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Hunt & Oliver Garen.
+
+ We are currently generating two copies of the slow path for op_call for no reason. Stop that.
+
+ Originally op_call used two slow paths since the first set up the pointer to the CallLinkInfo
+ for use when linking. However this is now looked up using the return address (as we do for
+ property accesses) so the two paths are now identical.
+
+ No performance impact, reduces memory footprint.
+
+ * bytecode/CodeBlock.h:
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompile):
+ (JSC::JIT::linkCall):
+ * jit/JIT.h:
+ * jit/JITCall.cpp:
+ (JSC::JIT::compileOpCallSlowCase):
+ * jit/JITStubs.cpp:
+ (JSC::JITStubs::DEFINE_STUB_FUNCTION):
+
+2009-06-12 Dave Hyatt <hyatt@apple.com>
+
+ Reviewed by Anders Carlsson.
+
+ https://bugs.webkit.org/show_bug.cgi?id=26373
+
+ Add a new class to Threading in wtf called ReadWriteLock that handles single writer/multiple reader locking.
+ Provide a pthreads-only implementation of the lock for now, as this class is only going to be used
+ on Snow Leopard at first.
+
+ * wtf/Threading.h:
+ (WTF::ReadWriteLock::impl):
+ * wtf/ThreadingPthreads.cpp:
+ (WTF::ReadWriteLock::ReadWriteLock):
+ (WTF::ReadWriteLock::~ReadWriteLock):
+ (WTF::ReadWriteLock::readLock):
+ (WTF::ReadWriteLock::tryReadLock):
+ (WTF::ReadWriteLock::writeLock):
+ (WTF::ReadWriteLock::tryWriteLock):
+ (WTF::ReadWriteLock::unlock):
+
+2009-06-12 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Make LiteralParser non-recursive
+
+ Convert LiteralParser from using a simple recursive descent parser
+ to a hand rolled PDA. Relatively simple conversion, but required
+ modifications to MarkedArgumentBuffer to make it more suitable as
+ a generic marked vector. I'll refactor and rename MarkedArgumentBuffer
+ in future as there are many other cases where it will be useful to
+ have such a class.
+
+ * runtime/ArgList.h:
+ (JSC::MarkedArgumentBuffer::MarkedArgumentBuffer):
+ (JSC::MarkedArgumentBuffer::append):
+ (JSC::MarkedArgumentBuffer::removeLast):
+ (JSC::MarkedArgumentBuffer::last):
+ * runtime/LiteralParser.cpp:
+ (JSC::LiteralParser::parse):
+ * runtime/LiteralParser.h:
+ (JSC::LiteralParser::LiteralParser):
+ (JSC::LiteralParser::tryLiteralParse):
+ (JSC::LiteralParser::):
+
+2009-06-12 David Levin <levin@chromium.org>
+
+ Reviewed by NOBODY (build fix for windows).
+
+ Adjust the exports for JSC on Windows like what was done for OSX in
+ the previous commit.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-06-12 David Levin <levin@chromium.org>
+
+ Reviewed by Darin Adler.
+
+ UString shouldn't create sharedBuffer for SmallStrings.
+ https://bugs.webkit.org/show_bug.cgi?id=26360
+
+ The methods changed are not used by JSC, so there is no JS perf impact. However,
+ there is a potential DOM perf impact, so I re-ran several of the tests that
+ I ran previously and ensured that the perf stay the same which caused me to
+ adjust the minLengthToShare.
+
+ * JavaScriptCore.exp:
+ * runtime/UString.cpp:
+ (JSC::UString::Rep::sharedBuffer):
+ Determines if the buffer being shared is big enough before doing so.
+ Previously, BaseString::sharedBuffer was called but it would only know
+ the length of the base string (BaseString::len) which may not be the same
+ as the string being shared (Rep::len).
+ (JSC::UString::BaseString::sharedBuffer):
+ This is now only be used by Rep::sharedBuffer. which does the length check.
+ * runtime/UString.h:
+
+2009-06-12 Dimitri Glazkov <dglazkov@chromium.org>
+
+ Reviewed by Eric Seidel.
+
+ https://bugs.webkit.org/show_bug.cgi?id=26191
+ Remove xmath include in MathExtras.h, because it is not needed and also
+ breaks VS2008 builds with TR1 turned on.
+
+ * wtf/MathExtras.h: Removed xmath include.
+
+2009-06-12 Peter Kasting <pkasting@google.com>
+
+ Reviewed by Eric Seidel.
+
+ * ChangeLog-2007-10-14: Change pseudonym "Don Gibson" to me (was used while Google Chrome was not public); update my email address.
+
+2009-06-12 Kevin Ollivier <kevino@theolliviers.com>
+
+ wx build fix. Adding JSONObject.cpp to the build.
+
+ * JavaScriptCoreSources.bkl:
+
+2009-06-12 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Jan Michael Alonzo.
+
+ [Qt] Fix build break
+ https://bugs.webkit.org/show_bug.cgi?id=26340
+
+ * JavaScriptCore.pri: Add JSONObject.cpp to LUT files.
+
+2009-06-11 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by NOBODY (build fix).
+
+ Lower stringify recursion limit to deal with small windows stack.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * runtime/JSONObject.cpp:
+ (JSC::Stringifier::):
+
+2009-06-11 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Holger Freyther.
+
+ Fix compilation warnings
+ <https://bugs.webkit.org/show_bug.cgi?id=26015>
+
+ * wtf/ThreadingNone.cpp:
+ (WTF::ThreadCondition::wait): Fix compilation warning.
+ (WTF::ThreadCondition::timedWait): Ditto.
+
+2009-06-10 Brent Fulgham <bfulgham@webkit.org>
+
+ Build fix for Windows target.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ Correct missing </File> tag after @r44550 that prevents the
+ project from being loaded in the Visual Studio IDE.
+
+2009-06-09 Gavin Barraclough <barraclough@apple.com>
+
+ Rubber Stamped by Mark Rowe.
+
+ Tidy up a couple of comments.
+
+ * assembler/ARMv7Assembler.h:
+ Fix date in copyright, neaten up a couple of comments.
+ * assembler/MacroAssemblerARMv7.h:
+ Fix date in copyright.
+
+2009-06-07 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Bug 26249: Support JSON.stringify
+ <https://bugs.webkit.org/show_bug.cgi?id=26249>
+
+ Implement JSON.stringify. This patch handles all the semantics of the ES5
+ JSON.stringify function, including replacer functions and arrays and both
+ string and numeric gap arguments.
+
+ Currently uses a clamped recursive algorithm basically identical to the spec
+ description but with a few minor tweaks for performance and corrected semantics
+ discussed in the es-discuss mailing list.
+
+ * DerivedSources.make:
+ * GNUmakefile.am:
+ * JavaScriptCore.pri:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * interpreter/CallFrame.h:
+ (JSC::ExecState::jsonTable):
+ * runtime/CommonIdentifiers.h:
+ add toJSON to the list of common identifiers
+
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData):
+ (JSC::JSGlobalData::~JSGlobalData):
+ * runtime/JSGlobalData.h:
+ * runtime/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::reset):
+ Add support for the JSON object lookup table
+
+ * runtime/JSONObject.cpp: Added.
+ (JSC::):
+ (JSC::JSONObject::getOwnPropertySlot):
+ (JSC::Stringifier::):
+ (JSC::Stringifier::Stringifier):
+ (JSC::Stringifier::stringify):
+ (JSC::Stringifier::appendString):
+
+ (JSC::Stringifier::StringKeyGenerator::StringKeyGenerator):
+ (JSC::Stringifier::StringKeyGenerator::getKey):
+ (JSC::Stringifier::IntKeyGenerator::IntKeyGenerator):
+ (JSC::Stringifier::IntKeyGenerator::getKey):
+ These KeyGenerator classes are used to abstract away the lazy evaluation of keys for
+ toJSON and replacer functions.
+
+ (JSC::Stringifier::toJSONValue):
+ (JSC::Stringifier::stringifyArray):
+ (JSC::Stringifier::stringifyObject):
+ (JSC::JSONProtoFuncStringify):
+ * runtime/JSONObject.h: Added.
+ (JSC::JSONObject:::JSObject):
+ (JSC::JSONObject::classInfo):
+ (JSC::JSONObject::createStructure):
+
+2009-06-09 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Enable JIT_OPTIMIZE_CALL & JIT_OPTIMIZE_METHOD_CALLS on ARMv7 platforms.
+
+ These optimizations function correctly with no further changes.
+
+ * wtf/Platform.h:
+ Change to enable JIT_OPTIMIZE_CALL & JIT_OPTIMIZE_METHOD_CALLS.
+
+2009-06-09 Gavin Barraclough <barraclough@apple.com>
+
+ Not Reviewed, build fix.
+
+ * assembler/MacroAssemblerARMv7.h:
+
+2009-06-09 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Enable JIT_OPTIMIZE_ARITHMETIC on ARMv7 platforms.
+
+ Temporarily split support for 'branchTruncateDoubleToInt32' onto its own switch
+ ('supportsFloatingPointTruncate'). See comment in MacroAssemblerARMv7, we need
+ to work out wherther we are going to be able to support the current interface on
+ all platforms, or whether this should be refactored.
+
+ * assembler/MacroAssemblerARMv7.h:
+ (JSC::MacroAssemblerARMv7::supportsFloatingPoint):
+ Add implementation of supportsFloatingPointTruncate (returns true).
+ (JSC::MacroAssemblerARMv7::supportsFloatingPointTruncate):
+ Add implementation of supportsFloatingPointTruncate (returns false).
+ (JSC::MacroAssemblerARMv7::loadDouble):
+ (JSC::MacroAssemblerARMv7::storeDouble):
+ (JSC::MacroAssemblerARMv7::addDouble):
+ (JSC::MacroAssemblerARMv7::subDouble):
+ (JSC::MacroAssemblerARMv7::mulDouble):
+ (JSC::MacroAssemblerARMv7::convertInt32ToDouble):
+ (JSC::MacroAssemblerARMv7::branchDouble):
+ Implement FP code genertion operations.
+ * assembler/MacroAssemblerX86.h:
+ (JSC::MacroAssemblerX86::supportsFloatingPointTruncate):
+ Add implementation of supportsFloatingPointTruncate (returns true).
+ * assembler/MacroAssemblerX86_64.h:
+ (JSC::MacroAssemblerX86_64::supportsFloatingPointTruncate):
+ Add implementation of supportsFloatingPointTruncate (returns true).
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emit_op_rshift):
+ Changed to call supportsFloatingPointTruncate().
+ (JSC::JIT::emitSlow_op_rshift):
+ Changed to call supportsFloatingPointTruncate().
+ * wtf/Platform.h:
+ Change to enable JIT_OPTIMIZE_ARITHMETIC.
+
+2009-06-09 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Mark Rowe & Geoff Garen.
+
+ Enable JIT_OPTIMIZE_PROPERTY_ACCESS on ARMv7 platforms.
+
+ Firm up interface for planting load intructions that will be repatched by
+ repatchLoadPtrToLEA(). This method should now no longer be applied to just
+ any loadPtr instruction.
+
+ * assembler/MacroAssemblerARMv7.h:
+ (JSC::MacroAssemblerARMv7::loadPtrWithPatchToLEA):
+ Implement loadPtrWithPatchToLEA interface (plants a load with a fixed width address).
+ (JSC::MacroAssemblerARMv7::move):
+ (JSC::MacroAssemblerARMv7::nearCall):
+ (JSC::MacroAssemblerARMv7::call):
+ (JSC::MacroAssemblerARMv7::moveWithPatch):
+ (JSC::MacroAssemblerARMv7::tailRecursiveCall):
+ Switch to use common method 'moveFixedWidthEncoding()' to perform fixed width (often patchable) loads.
+ (JSC::MacroAssemblerARMv7::moveFixedWidthEncoding):
+ Move an immediate to a register, always plants movT3/movt instruction pair.
+ * assembler/MacroAssemblerX86.h:
+ (JSC::MacroAssemblerX86::loadPtrWithPatchToLEA):
+ Implement loadPtrWithPatchToLEA interface (just a regular 32-bit load on x86).
+ * assembler/MacroAssemblerX86_64.h:
+ (JSC::MacroAssemblerX86_64::loadPtrWithPatchToLEA):
+ Implement loadPtrWithPatchToLEA interface (just a regular 64-bit load on x86_64).
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::compileGetByIdHotPath):
+ (JSC::JIT::emit_op_put_by_id):
+ * wtf/Platform.h:
+ Change to enable JIT_OPTIMIZE_PROPERTY_ACCESS.
+
+2009-06-08 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Enable JS language JIT for ARM thumb2 platforms. Add ARMv7 specific
+ asm & constants, add appropriate configuration switches to Platform.h.
+
+ Landing this disabled until jump linking is completed (see YARR jit patch).
+
+ * assembler/MacroAssemblerARMv7.h:
+ (JSC::MacroAssemblerARMv7::load32):
+ Fix: should load pointer with ImmPtr not Imm32.
+ (JSC::MacroAssemblerARMv7::store32):
+ Fix: should load pointer with ImmPtr not Imm32.
+ (JSC::MacroAssemblerARMv7::move):
+ Fix: When moving an Imm32 that is actually a pointer, should call movT3()
+ not mov(), to ensure code generation is repeatable (for exception handling).
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ Disable JIT_OPTIMIZE_NATIVE_CALL specific code generation if the optimization is not enabled.
+ * jit/JIT.h:
+ Add ARMv7 specific values of constants & register names.
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::preverveReturnAddressAfterCall):
+ (JSC::JIT::restoreReturnAddressBeforeReturn):
+ (JSC::JIT::restoreArgumentReferenceForTrampoline):
+ Implement for ARMv7 (move value to/from lr).
+ * jit/JITStubs.cpp:
+ Add JIT entry/thow trampolines, add macro to add thunk wrapper around stub routines.
+ * jit/JITStubs.h:
+ (JSC::JITStackFrame::returnAddressSlot):
+ Add ARMv7 stack frame object.
+ * wtf/Platform.h:
+ Add changes necessary to allow JIT to build on this platform, disabled.
+
+2009-06-08 Mark Rowe <mrowe@apple.com>
+
+ Speculative GTK build fix.
+
+ * wtf/DateMath.cpp:
+
+2009-06-08 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Mark Rowe.
+
+ Previous patch caused a regression.
+
+ Restructure so no new (empty, inline) function calls are added on x86.
+
+ * jit/ExecutableAllocator.h:
+ (JSC::ExecutableAllocator::makeWritable):
+ (JSC::ExecutableAllocator::makeExecutable):
+ (JSC::ExecutableAllocator::reprotectRegion):
+ (JSC::ExecutableAllocator::cacheFlush):
+
+2009-06-08 Dimitri Glazkov <dglazkov@chromium.org>
+
+ Unreviewed, GTK build fix (thanks, bdash).
+
+ * GNUmakefile.am: Moved DateMath with all other wtf kin.
+
+2009-06-08 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Add (incomplete) support to YARR for running with the jit enabled
+ on Arm thumb2 platforms. Adds new Assembler/MacroAssembler classes,
+ along with cache flushing support, tweaks to MacroAssemblerCodePtr
+ to support decorated thumb code pointers, and new enter/exit code
+ to YARR jit for the platform.
+
+ Support for this platform is still under development - the assembler
+ currrently only supports planting and linking jumps with a 16Mb range.
+ As such, initially commiting in a disabled state.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ Add new assembler files.
+ * assembler/ARMv7Assembler.h: Added.
+ Add new Assembler.
+ * assembler/AbstractMacroAssembler.h:
+ Tweaks to ensure sizes of pointer values planted in JIT code do not change.
+ * assembler/MacroAssembler.h:
+ On ARMv7 platforms use MacroAssemblerARMv7.
+ * assembler/MacroAssemblerARMv7.h: Added.
+ Add new MacroAssembler.
+ * assembler/MacroAssemblerCodeRef.h:
+ (JSC::FunctionPtr::FunctionPtr):
+ Add better ASSERT.
+ (JSC::ReturnAddressPtr::ReturnAddressPtr):
+ Add better ASSERT.
+ (JSC::MacroAssemblerCodePtr::MacroAssemblerCodePtr):
+ On ARMv7, MacroAssemblerCodePtr's mush be 'decorated' with a low bit set,
+ to indicate to the processor that the code is thumb code, not traditional
+ 32-bit ARM.
+ (JSC::MacroAssemblerCodePtr::dataLocation):
+ On ARMv7, decoration must be removed.
+ * jit/ExecutableAllocator.h:
+ (JSC::ExecutableAllocator::makeWritable):
+ Reformatted, no change.
+ (JSC::ExecutableAllocator::makeExecutable):
+ When marking code executable also cache flush it, where necessary.
+ (JSC::ExecutableAllocator::MakeWritable::MakeWritable):
+ Only use the null implementation of this class if both !ASSEMBLER_WX_EXCLUSIVE
+ and running on x86(_64) - on other platforms we may also need ensure that
+ makeExecutable is called at the end to flush caches.
+ (JSC::ExecutableAllocator::reprotectRegion):
+ Reformatted, no change.
+ (JSC::ExecutableAllocator::cacheFlush):
+ Cache flush a region of memory, or platforms where this is necessary.
+ * wtf/Platform.h:
+ Add changes necessary to allow YARR jit to build on this platform, disabled.
+ * yarr/RegexJIT.cpp:
+ (JSC::Yarr::RegexGenerator::generateEnter):
+ (JSC::Yarr::RegexGenerator::generateReturn):
+ Add support to these methods for ARMv7.
+
+2009-06-08 Dimitri Glazkov <dglazkov@chromium.org>
+
+ Unreviewed, fix my previous fix.
+
+ * runtime/DateInstance.cpp:
+ (JSC::DateInstance::msToGregorianDateTime): Use WTF namespace qualifier to
+ disambiguate func signatures.
+
+2009-06-08 Mark Rowe <mrowe@apple.com>
+
+ Attempt to fix the Tiger build.
+
+ * wtf/Platform.h: Only test the value of the macro once we know it is defined.
+
+2009-06-08 Dimitri Glazkov <dglazkov@chromium.org>
+
+ Unreviewed, another Windows build fix.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-06-08 Dimitri Glazkov <dglazkov@chromium.org>
+
+ Unreviewed, projectile-fixing Windows build.
+
+ * runtime/DateConversion.cpp: Added StringExtras include.
+ * wtf/DateMath.cpp: Replaced math with algorithm include (looking for std::min def for Windows).
+
+2009-06-08 Dimitri Glazkov <dglazkov@chromium.org>
+
+ Unreviewed, Windows build fix.
+
+ * runtime/DateConstructor.cpp: Changed to use WTF namespace.
+ * runtime/DateConversion.cpp: Added UString include.
+ * runtime/DateInstance.cpp: Changed to use WTF namespace.
+ * wtf/DateMath.cpp: Added math include.
+
+2009-06-08 Dimitri Glazkov <dglazkov@chromium.org>
+
+ Reviewed by Eric Seidel.
+
+ https://bugs.webkit.org/show_bug.cgi?id=26238
+ Move most of runtime/DateMath functions to wtf/DateMath, and split off conversion-related
+ helpers to DateConversion.
+
+ * AllInOneFile.cpp: Changed DateMath->DateConversion.
+ * GNUmakefile.am: Ditto and added DateMath.
+ * JavaScriptCore.exp: Ditto.
+ * JavaScriptCore.pri: Ditto.
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Ditto.
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj: Added DateMath.
+ * JavaScriptCore.xcodeproj/project.pbxproj: Ditto.
+ * JavaScriptCoreSources.bkl: Ditto.
+ * pcre/pcre_exec.cpp: Changed to use DateMath.
+ * profiler/ProfileNode.cpp:
+ (JSC::getCount): Changed to use DateConversion.
+ * runtime/DateConstructor.cpp: Ditto.
+ * runtime/DateConversion.cpp: Copied from JavaScriptCore/runtime/DateMath.cpp.
+ (JSC::parseDate): Refactored to use null-terminated characters as input.
+ * runtime/DateConversion.h: Copied from JavaScriptCore/runtime/DateMath.h.
+ * runtime/DateInstance.cpp: Changed to use wtf/DateMath.
+ * runtime/DateInstance.h: Ditto.
+ * runtime/DateMath.cpp: Removed.
+ * runtime/DateMath.h: Removed.
+ * runtime/DatePrototype.cpp: Ditto.
+ * runtime/InitializeThreading.cpp: Ditto.
+ * wtf/DateMath.cpp: Copied from JavaScriptCore/runtime/DateMath.cpp.
+ * wtf/DateMath.h: Copied from JavaScriptCore/runtime/DateMath.h.
+
+2009-06-08 Steve Falkenburg <sfalken@apple.com>
+
+ Windows build fix.
+
+ * JavaScriptCore.vcproj/jsc/jscCommon.vsprops:
+
+2009-06-07 David Kilzer <ddkilzer@apple.com>
+
+ Make JavaScriptCore compile for iPhone and iPhone Simulator
+
+ Reviewed by Gavin Barraclough.
+
+ * Configurations/Base.xcconfig: Split GCC_ENABLE_OBJC_GC on
+ $(REAL_PLATFORM_NAME). Added $(ARCHS_UNIVERSAL_IPHONE_OS) to
+ VALID_ARCHS. Added REAL_PLATFORM_NAME_iphoneos,
+ REAL_PLATFORM_NAME_iphonesimulator, HAVE_DTRACE_iphoneos and
+ HAVE_DTRACE_iphonesimulator variables.
+ * Configurations/DebugRelase.xcconfig: Split ARCHS definition on
+ $(REAL_PLATFORM_NAME).
+ * Configurations/JavaScriptCore.xcconfig: Added
+ EXPORTED_SYMBOLS_FILE_armv6 and EXPORTED_SYMBOLS_FILE_armv7
+ variables. Split OTHER_LDFLAGS into OTHER_LDFLAGS_BASE and
+ OTHER_LDFLAGS_$(REAL_PLATFORM_NAME) since CoreServices.framework
+ is only linked to on Mac OS X.
+ * JavaScriptCore.xcodeproj/project.pbxproj: Removed references
+ to CoreServices.framework since it's linked using OTHER_LDFLAGS
+ in JavaScriptCore.xcconfig.
+ * profiler/ProfilerServer.mm: Added #import for iPhone
+ Simulator.
+ (-[ProfilerServer init]): Conditionalize use of
+ NSDistributedNotificationCenter to non-iPhone or iPhone
+ Simulator.
+ * wtf/FastMalloc.cpp:
+ (WTF::TCMallocStats::): Build fix for iPhone and iPhone
+ Simulator.
+ * wtf/Platform.h: Defined PLATFORM(IPHONE) and
+ PLATFORM(IPHONE_SIMULATOR).
+ * wtf/ThreadingPthreads.cpp:
+ (WTF::setThreadNameInternal): Build fix for iPhone and iPhone
+ Simulator.
+
+2009-06-08 Tor Arne Vestbø <tor.arne.vestbo@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Use $QMAKE_PATH_SEP instead of hardcoded / to fix Windows build
+
+ * JavaScriptCore.pri:
+ * JavaScriptCore.pro:
+ * jsc.pro:
+
+2009-06-07 Gavin Barraclough <barraclough@apple.com>
+
+ RS by Sam Weinig.
+
+ Remove bonus bogus \n from last commit.
+
+ * jit/JITStubs.cpp:
+ (JSC::):
+
+2009-06-07 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Change the implementation of op_throw so the stub function always modifies its
+ return address - if it doesn't find a 'catch' it will switch to a trampoline
+ to force a return from JIT execution. This saves memory, by avoiding the need
+ for a unique return for every op_throw.
+
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_throw):
+ JITStubs::cti_op_throw now always changes its return address,
+ remove return code generated after the stub call (this is now
+ handled by ctiOpThrowNotCaught).
+ * jit/JITStubs.cpp:
+ (JSC::):
+ Add ctiOpThrowNotCaught definitions.
+ (JSC::JITStubs::DEFINE_STUB_FUNCTION):
+ Change cti_op_throw to always change its return address.
+ * jit/JITStubs.h:
+ Add ctiOpThrowNotCaught declaration.
+
+2009-06-05 Gavin Barraclough <barraclough@apple.com>
+
+ Rudder stamped by Sam Weinig.
+
+ Add missing ASSERT.
+
+ * assembler/X86Assembler.h:
+ (JSC::X86Assembler::getRelocatedAddress):
+
+2009-06-05 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Switch storePtrWithPatch to take the initial immediate value as an argument.
+
+ * assembler/MacroAssemblerX86.h:
+ (JSC::MacroAssemblerX86::storePtrWithPatch):
+ * assembler/MacroAssemblerX86_64.h:
+ (JSC::MacroAssemblerX86_64::storePtrWithPatch):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_jsr):
+
+2009-06-05 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Remove patchLength..tByIdExternalLoadPrefix magic numbers from JIT.h.
+
+ These aren't really suitable values to be tracking within common code
+ of the JIT, since they are not (and realistically cannot) be checked
+ by ASSERTs, as the other repatch offsets are. Move this functionality
+ (skipping the REX prefix when patching load instructions to LEAs on
+ x86-64) into the X86Assembler.
+
+ * assembler/AbstractMacroAssembler.h:
+ (JSC::AbstractMacroAssembler::CodeLocationInstruction::repatchLoadPtrToLEA):
+ * assembler/X86Assembler.h:
+ (JSC::X86Assembler::repatchLoadPtrToLEA):
+ * jit/JIT.h:
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::patchGetByIdSelf):
+ (JSC::JIT::patchPutByIdReplace):
+
+2009-06-05 Shinichiro Hamaji <hamaji@chromium.org>
+
+ Bug 26160: Compile fails in MacOSX when GNU fileutils are installed
+
+ <https://bugs.webkit.org/show_bug.cgi?id=26160>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Use /bin/ln instead of ln for cases where this command is used with -h option.
+ As this option is not supported by GNU fileutils, this change helps users
+ who have GNU fileutils in their PATH.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2009-06-05 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Remove DoubleNotEqual floating point comparison condition for now -
+ it is not used, and it is unclear the semantics are correct (I think
+ this comparison would actually give you not-equal-or-unordered, which
+ might be what is wanted... we can revisit this interface & get it
+ right when required).
+
+ Also, fix asserts in branchArith32 ops. All adds & subs can check
+ for Signed, multiply only sets OF so can only check for overflow.
+
+ * assembler/MacroAssemblerX86Common.h:
+ (JSC::MacroAssemblerX86Common::):
+ (JSC::MacroAssemblerX86Common::branchAdd32):
+ (JSC::MacroAssemblerX86Common::branchMul32):
+ (JSC::MacroAssemblerX86Common::branchSub32):
+
+2009-06-05 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Minor tidy up in JITStubs.
+
+ * jit/JITStubs.cpp:
+ (JSC::StackHack::StackHack):
+ * jit/JITStubs.h:
+
+2009-06-05 Koen Kooi <koen@dominion.thruhere.net>
+
+ Reviewed by Xan Lopez.
+
+ Build fix for glib unicode backend.
+
+ * wtf/unicode/glib/UnicodeMacrosFromICU.h:
+
+2009-06-05 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ 3 tiny cleanups:
+
+ * assembler/MacroAssemblerX86.h:
+ * assembler/MacroAssemblerX86_64.h:
+ (JSC::MacroAssemblerX86_64::storePtrWithPatch):
+ store*() methods should take an ImplicitAddress, rather than an Address.
+ * assembler/X86Assembler.h:
+ Make patchPointer private.
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_ret):
+ Remove empty line at end of function.
+
+2009-06-05 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Encapsulate many uses of void* in the assembler & jit with types that provide
+ more semantic information. The new types are:
+
+ * MacroAssemblerCodePtr - this wraps a pointer into JIT generated code.
+ * FunctionPtr - this wraps a pointer to a C/C++ function in JSC.
+ * ReturnAddressPtr - this wraps a return address resulting from a 'call' instruction.
+
+ Wrapping these types allows for stronger type-checking than is possible with everything
+ represented a void*. For example, it is now enforced by the type system that near
+ calls can only be linked to JIT code and not to C functions in JSC (this was previously
+ required, but could not be enforced on the interface).
+
+ * assembler/AbstractMacroAssembler.h:
+ (JSC::AbstractMacroAssembler::CodeLocationCommon::CodeLocationCommon):
+ (JSC::AbstractMacroAssembler::CodeLocationCommon::dataLocation):
+ (JSC::AbstractMacroAssembler::CodeLocationCommon::executableAddress):
+ (JSC::AbstractMacroAssembler::CodeLocationCommon::reset):
+ (JSC::AbstractMacroAssembler::CodeLocationInstruction::repatchLoadToLEA):
+ (JSC::AbstractMacroAssembler::CodeLocationInstruction::CodeLocationInstruction):
+ (JSC::AbstractMacroAssembler::CodeLocationLabel::addressForSwitch):
+ (JSC::AbstractMacroAssembler::CodeLocationLabel::addressForExceptionHandler):
+ (JSC::AbstractMacroAssembler::CodeLocationLabel::addressForJSR):
+ (JSC::AbstractMacroAssembler::CodeLocationLabel::operator!):
+ (JSC::AbstractMacroAssembler::CodeLocationLabel::reset):
+ (JSC::AbstractMacroAssembler::CodeLocationLabel::CodeLocationLabel):
+ (JSC::AbstractMacroAssembler::CodeLocationLabel::getJumpDestination):
+ (JSC::AbstractMacroAssembler::CodeLocationJump::relink):
+ (JSC::AbstractMacroAssembler::CodeLocationJump::CodeLocationJump):
+ (JSC::AbstractMacroAssembler::CodeLocationCall::relink):
+ (JSC::AbstractMacroAssembler::CodeLocationCall::calleeReturnAddressValue):
+ (JSC::AbstractMacroAssembler::CodeLocationCall::CodeLocationCall):
+ (JSC::AbstractMacroAssembler::CodeLocationNearCall::relink):
+ (JSC::AbstractMacroAssembler::CodeLocationNearCall::calleeReturnAddressValue):
+ (JSC::AbstractMacroAssembler::CodeLocationNearCall::CodeLocationNearCall):
+ (JSC::AbstractMacroAssembler::CodeLocationDataLabel32::repatch):
+ (JSC::AbstractMacroAssembler::CodeLocationDataLabel32::CodeLocationDataLabel32):
+ (JSC::AbstractMacroAssembler::CodeLocationDataLabelPtr::repatch):
+ (JSC::AbstractMacroAssembler::CodeLocationDataLabelPtr::CodeLocationDataLabelPtr):
+ (JSC::AbstractMacroAssembler::ProcessorReturnAddress::relinkCallerToTrampoline):
+ (JSC::AbstractMacroAssembler::ProcessorReturnAddress::relinkCallerToFunction):
+ (JSC::AbstractMacroAssembler::ProcessorReturnAddress::relinkNearCallerToTrampoline):
+ (JSC::AbstractMacroAssembler::ProcessorReturnAddress::addressForLookup):
+ (JSC::AbstractMacroAssembler::trampolineAt):
+ (JSC::AbstractMacroAssembler::PatchBuffer::link):
+ (JSC::AbstractMacroAssembler::PatchBuffer::performFinalization):
+ (JSC::::CodeLocationCommon::instructionAtOffset):
+ (JSC::::CodeLocationCommon::labelAtOffset):
+ (JSC::::CodeLocationCommon::jumpAtOffset):
+ (JSC::::CodeLocationCommon::callAtOffset):
+ (JSC::::CodeLocationCommon::nearCallAtOffset):
+ (JSC::::CodeLocationCommon::dataLabelPtrAtOffset):
+ (JSC::::CodeLocationCommon::dataLabel32AtOffset):
+ * assembler/MacroAssemblerCodeRef.h:
+ (JSC::FunctionPtr::FunctionPtr):
+ (JSC::FunctionPtr::value):
+ (JSC::FunctionPtr::executableAddress):
+ (JSC::ReturnAddressPtr::ReturnAddressPtr):
+ (JSC::ReturnAddressPtr::value):
+ (JSC::MacroAssemblerCodePtr::MacroAssemblerCodePtr):
+ (JSC::MacroAssemblerCodePtr::executableAddress):
+ (JSC::MacroAssemblerCodePtr::dataLocation):
+ (JSC::MacroAssemblerCodeRef::MacroAssemblerCodeRef):
+ * assembler/X86Assembler.h:
+ (JSC::X86Assembler::patchPointerForCall):
+ * jit/JIT.cpp:
+ (JSC::ctiPatchNearCallByReturnAddress):
+ (JSC::ctiPatchCallByReturnAddress):
+ (JSC::JIT::privateCompile):
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ * jit/JIT.h:
+ (JSC::JIT::compileCTIMachineTrampolines):
+ * jit/JITCall.cpp:
+ (JSC::JIT::compileOpCall):
+ * jit/JITCode.h:
+ (JSC::JITCode::operator !):
+ (JSC::JITCode::addressForCall):
+ (JSC::JITCode::offsetOf):
+ (JSC::JITCode::execute):
+ (JSC::JITCode::size):
+ (JSC::JITCode::HostFunction):
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::emitNakedCall):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::privateCompilePutByIdTransition):
+ (JSC::JIT::patchGetByIdSelf):
+ (JSC::JIT::patchPutByIdReplace):
+ (JSC::JIT::privateCompilePatchGetArrayLength):
+ (JSC::JIT::privateCompileGetByIdProto):
+ (JSC::JIT::privateCompileGetByIdChain):
+ * jit/JITStubs.cpp:
+ (JSC::JITThunks::JITThunks):
+ (JSC::JITThunks::tryCachePutByID):
+ (JSC::JITThunks::tryCacheGetByID):
+ (JSC::JITStubs::DEFINE_STUB_FUNCTION):
+ * jit/JITStubs.h:
+ (JSC::JITThunks::ctiArrayLengthTrampoline):
+ (JSC::JITThunks::ctiStringLengthTrampoline):
+ (JSC::JITThunks::ctiVirtualCallPreLink):
+ (JSC::JITThunks::ctiVirtualCallLink):
+ (JSC::JITThunks::ctiVirtualCall):
+ (JSC::JITThunks::ctiNativeCallThunk):
+ * yarr/RegexJIT.h:
+ (JSC::Yarr::RegexCodeBlock::operator!):
+ (JSC::Yarr::RegexCodeBlock::execute):
+
+2009-06-05 Antti Koivisto <antti@apple.com>
+
+ Try to unbreak Windows build.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-06-03 Antti Koivisto <antti@apple.com>
+
+ Reviewed by Dave Kilzer.
+
+ https://bugs.webkit.org/show_bug.cgi?id=13128
+ Safari not obeying cache header
+
+ Export JSC::parseDate()
+
+ * JavaScriptCore.exp:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2009-06-04 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Bug in property caching of getters and setters.
+
+ Make sure that the transition logic accounts for getters and setters.
+ If we don't we end up screwing up the transition tables so that some
+ transitions will start incorrectly believing that they need to check
+ for getters and setters.
+
+ * runtime/JSObject.cpp:
+ (JSC::JSObject::defineGetter):
+ (JSC::JSObject::defineSetter):
+ * runtime/JSObject.h:
+ (JSC::):
+ * runtime/Structure.h:
+
+2009-06-04 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Minor tweak to PatchBuffer, change it so it no longer holds a CodeRef, and instead
+ holds a separate code pointer and executable pool. Since it now always holds its
+ own copy of the code size, and to simplify the construction sequence, it's neater
+ this way.
+
+ * assembler/AbstractMacroAssembler.h:
+ (JSC::AbstractMacroAssembler::PatchBuffer::PatchBuffer):
+ (JSC::AbstractMacroAssembler::PatchBuffer::finalizeCode):
+ (JSC::AbstractMacroAssembler::PatchBuffer::code):
+ (JSC::AbstractMacroAssembler::PatchBuffer::performFinalization):
+
+2009-06-04 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Remove 'JIT_STUB_ARGUMENT_STACK' this is unused and untested.
+
+ This just leaves JIT_STUB_ARGUMENT_REGISTER and JIT_STUB_ARGUMENT_VA_LIST.
+ Since JIT_STUB_ARGUMENT_REGISTER is the sensible configuration on most platforms,
+ remove this define and make this the default behaviour.
+ Platforms must now define JIT_STUB_ARGUMENT_VA_LIST to get crazy va_list voodoo,
+ if they so desire.
+
+ (Refactoring of #ifdefs only, no functional change, no performance impact.)
+
+ * jit/JIT.h:
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::restoreArgumentReference):
+ (JSC::JIT::restoreArgumentReferenceForTrampoline):
+ * jit/JITStubs.cpp:
+ (JSC::):
+ * jit/JITStubs.h:
+ * wtf/Platform.h:
+
+2009-06-04 Gavin Barraclough <barraclough@apple.com>
+
+ Rubber stamped by Sam Weinig.
+
+ * jit/JITArithmetic.cpp:
+ Remove some redundant typedefs, unused since arithmetic was added to the MacroAssembler interface.
+
+2009-06-04 Brent Fulgham <bfulgham@webkit.org>
+
+ Build fix due to header include problem.
+
+ * interpreter/Interpreter.h: Remove wtf from includes so that
+ compile can find the headers in expected places.
+
+2009-06-04 Zoltan Horvath <hzoltan@inf.u-szeged.hu>
+
+ Reviewed by Darin Adler.
+
+ HashTable class (JavaScriptCore/wtf/HashTable.h) doesn't instantiated by 'new', so
+ inheritance was removed. HashTable struct has been instantiated by operator new in
+ JSGlobalData.cpp:106.
+ HashTable couldn't inherited from FastAllocBase since struct with inheritance is
+ no longer POD, so HashTable struct has been instantiated by fastNew, destroyed by
+ fastDelete.
+
+ * interpreter/Interpreter.h:
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData):
+ (JSC::JSGlobalData::~JSGlobalData):
+ * wtf/HashTable.h:
+
+2009-06-04 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Wrap the code that plants pushes/pops planted by JIT in explanatorily named
+ methods; move property storage reallocation into a standard stub function.
+
+ ~No performance impact (possible <1% progression on x86-64, likely just noise).
+
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompile):
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ Wrap calls to push/pop.
+ * jit/JIT.h:
+ Declare the new wrapper methods.
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::preverveReturnAddressAfterCall):
+ (JSC::JIT::restoreReturnAddressBeforeReturn):
+ Define the new wrapper methods.
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_end):
+ (JSC::JIT::emit_op_ret):
+ Wrap calls to push/pop.
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::privateCompilePutByIdTransition):
+ Move property storage reallocation into a standard stub function.
+ * jit/JITStubs.cpp:
+ (JSC::JITStubs::DEFINE_STUB_FUNCTION):
+ * jit/JITStubs.h:
+ (JSC::JITStubs::):
+
+2009-06-04 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Ariya Hidayat.
+
+ [Qt] Single-threaded QtWebKit configuration
+ <https://bugs.webkit.org/show_bug.cgi?id=26015>
+
+ * JavaScriptCore.pri: Use ThreadingNone.cpp instead of
+ ThreadingQt.cpp and make sure ENABLE_JSC_MULTIPLE_THREADS is turned off
+ when ENABLE_SINGLE_THREADED is tuned on
+ * wtf/ThreadingNone.cpp:
+ (WTF::ThreadCondition::wait): Fix compilation warning.
+ (WTF::ThreadCondition::timedWait): Ditto.
+
+2009-06-02 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Anders Carlsson.
+
+ Remove workaround that was added to address <rdar://problem/5488678> as it no longer affects our Tiger builds.
+
+ * Configurations/Base.xcconfig:
+
+2009-06-02 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Sam Weinig.
+
+ Use C-style comments in Platform.h so it can be included from C
+ files.
+
+ * wtf/Platform.h:
+
+2009-06-02 Tor Arne Vestbø <tor.arne.vestbo@nokia.com>
+
+ Rubber-stamped by Simon Hausmann.
+
+ Use File::Spec->tmpdir instead of hardcoded paths for tempfile() dir
+
+ This fixes the Windows-build if the user does not have a /tmp directory.
+
+ * pcre/dftables:
+
+2009-06-02 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver ">>" Hunt.
+
+ emitSlow_op_rshift is linking the wrong number of slow cases, if !supportsFloatingPoint().
+ Fixerate, and refactor/comment the code a little to make it clearer what is going on.
+
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emit_op_rshift):
+ (JSC::JIT::emitSlow_op_rshift):
+
+2009-06-01 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by NOBODY - speculative windows build fix (errm, for the other patch!).
+
+ * jit/JITStubs.cpp:
+ (JSC::):
+
+2009-06-01 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by NOBODY - speculative windows build fix.
+
+ * assembler/AbstractMacroAssembler.h:
+ (JSC::::CodeLocationCall::CodeLocationCall):
+ (JSC::::CodeLocationNearCall::CodeLocationNearCall):
+
+2009-06-01 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Olliej Hunt.
+
+ Change JITStub functions from being static members on the JITStub class to be
+ global extern "C" functions, and switch their the function signature declaration
+ in the definition of the functions to be C-macro generated. This makes it easier
+ to work with the stub functions from assembler code (since the names no longer
+ require mangling), and by delaring the functions with a macro we can look at
+ also auto-generating asm thunks to wrap the JITStub functions to perform the
+ work currently in 'restoreArgumentReference' (as a memory saving).
+
+ Making this change also forces us to be a bit more realistic about what is private
+ on the Register and CallFrame objects. Presently most everything on these classes
+ is private, and the classes have plenty of friends. We could befriend all the
+ global functions to perpetuate the delusion of encapsulation, but using friends is
+ a bit of a sledgehammer solution here - since friends can poke around with all of
+ the class's privates, and since all the major classes taht operate on Regsiters are
+ currently friends, right there is currently in practice very little protection at
+ all. Better to start removing friend delclarations, and exposing just the parts
+ that need to be exposed.
+
+ * interpreter/CallFrame.h:
+ (JSC::ExecState::returnPC):
+ (JSC::ExecState::setCallerFrame):
+ (JSC::ExecState::returnValueRegister):
+ (JSC::ExecState::setArgumentCount):
+ (JSC::ExecState::setCallee):
+ (JSC::ExecState::setCodeBlock):
+ * interpreter/Interpreter.h:
+ * interpreter/Register.h:
+ (JSC::Register::Register):
+ (JSC::Register::i):
+ * jit/JITStubs.cpp:
+ (JSC::):
+ (JSC::JITThunks::JITThunks):
+ (JSC::JITThunks::tryCachePutByID):
+ (JSC::JITThunks::tryCacheGetByID):
+ (JSC::JITStubs::DEFINE_STUB_FUNCTION):
+ * jit/JITStubs.h:
+ (JSC::JITStubs::):
+ * runtime/JSFunction.h:
+ (JSC::JSFunction::nativeFunction):
+ (JSC::JSFunction::classInfo):
+ * runtime/JSGlobalData.h:
+
+2009-06-01 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Tidy up the literal parser.
+
+ Make the number lexing in the LiteralParser exactly match the JSON spec, which
+ makes us cover more cases, but also more strict. Also made string lexing only
+ allow double-quoted strings.
+
+ * runtime/LiteralParser.cpp:
+ (JSC::LiteralParser::Lexer::lex):
+ (JSC::LiteralParser::Lexer::lexString):
+ (JSC::LiteralParser::Lexer::lexNumber):
+
+2009-06-01 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam "WX" Weinig.
+
+ Allow the JIT to operate without relying on use of RWX memory, on platforms where this is supported.
+
+ This patch adds a switch to Platform.h (ENABLE_ASSEMBLER_WX_EXCLUSIVE) which enables this mode of operation.
+ When this flag is set, all executable memory will be allocated RX, and switched to RW only whilst being
+ modified. Upon completion of code generation the protection is switched back to RX to allow execution.
+
+ Further optimization will be required before it is desirable to enable this mode of operation by default;
+ enabling this presently incurs a 5%-10% regression.
+
+ (Submitting disabled - no performance impact).
+
+ * assembler/AbstractMacroAssembler.h:
+ (JSC::AbstractMacroAssembler::CodeLocationInstruction::repatchLoadToLEA):
+ (JSC::AbstractMacroAssembler::CodeLocationLabel::fromFunctionPointer):
+ (JSC::AbstractMacroAssembler::CodeLocationJump::relink):
+ (JSC::AbstractMacroAssembler::CodeLocationCall::relink):
+ (JSC::AbstractMacroAssembler::CodeLocationNearCall::relink):
+ (JSC::AbstractMacroAssembler::CodeLocationDataLabel32::repatch):
+ (JSC::AbstractMacroAssembler::CodeLocationDataLabelPtr::repatch):
+ (JSC::AbstractMacroAssembler::ProcessorReturnAddress::relinkCallerToTrampoline):
+ (JSC::AbstractMacroAssembler::ProcessorReturnAddress::relinkCallerToFunction):
+ (JSC::AbstractMacroAssembler::ProcessorReturnAddress::relinkNearCallerToTrampoline):
+ (JSC::AbstractMacroAssembler::ProcessorReturnAddress::relinkNearCallerToFunction):
+ (JSC::AbstractMacroAssembler::PatchBuffer::PatchBuffer):
+ (JSC::AbstractMacroAssembler::PatchBuffer::~PatchBuffer):
+ (JSC::AbstractMacroAssembler::PatchBuffer::link):
+ (JSC::AbstractMacroAssembler::PatchBuffer::patch):
+ (JSC::AbstractMacroAssembler::PatchBuffer::performFinalization):
+ (JSC::::CodeLocationCommon::nearCallAtOffset):
+ (JSC::::CodeLocationCall::CodeLocationCall):
+ (JSC::::CodeLocationNearCall::CodeLocationNearCall):
+ * assembler/AssemblerBuffer.h:
+ (JSC::AssemblerBuffer::executableCopy):
+ * assembler/X86Assembler.h:
+ (JSC::CAN_SIGN_EXTEND_U32_64):
+ (JSC::X86Assembler::linkJump):
+ (JSC::X86Assembler::linkCall):
+ (JSC::X86Assembler::patchPointer):
+ (JSC::X86Assembler::relinkJump):
+ (JSC::X86Assembler::relinkCall):
+ (JSC::X86Assembler::repatchInt32):
+ (JSC::X86Assembler::repatchPointer):
+ (JSC::X86Assembler::repatchLoadToLEA):
+ (JSC::X86Assembler::patchInt32):
+ (JSC::X86Assembler::patchRel32):
+ * jit/ExecutableAllocator.h:
+ (JSC::ExecutableAllocator::):
+ (JSC::ExecutableAllocator::makeWritable):
+ (JSC::ExecutableAllocator::makeExecutable):
+ * jit/ExecutableAllocatorFixedVMPool.cpp:
+ (JSC::FixedVMPoolAllocator::FixedVMPoolAllocator):
+ * jit/ExecutableAllocatorPosix.cpp:
+ (JSC::ExecutablePool::systemAlloc):
+ (JSC::ExecutablePool::systemRelease):
+ (JSC::ExecutableAllocator::reprotectRegion):
+ * jit/ExecutableAllocatorWin.cpp:
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::patchGetByIdSelf):
+ (JSC::JIT::patchPutByIdReplace):
+ * wtf/Platform.h:
+
+2009-05-29 Zoltan Horvath <hzoltan@inf.u-szeged.hu>
+
+ Reviewed by Darin Adler.
+
+ Inherits Interpreter class from FastAllocBase because it has been
+ instantiated by 'new' in JavaScriptCore/runtime/JSGlobalData.cpp.
+
+ * interpreter/Interpreter.h:
+
+2009-06-01 David Levin <levin@chromium.org>
+
+ Reviewed by NOBODY (windows build fix).
+
+ Add exports for windows (corresponding to the JavaScriptCore.exp modification
+ in the previous change).
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-06-01 David Levin <levin@chromium.org>
+
+ Reviewed by Darin Alder and Maciej Stachowiak.
+
+ Bug 26057: StringImpl should share buffers with UString.
+ https://bugs.webkit.org/show_bug.cgi?id=26057
+
+ * JavaScriptCore.exp:
+ * runtime/UString.cpp:
+ (JSC::UString::Rep::create):
+ (JSC::UString::BaseString::sharedBuffer): Only do the sharing when
+ the buffer exceeds a certain size. The size was tuned by running
+ various dom benchmarks with numbers ranging from 20 to 800 and finding
+ a place that seemed to do the best overall.
+ * runtime/UString.h:
+
+2009-05-31 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Olliej "you just need to change NativeFunctionWrapper.h" Hunt.
+
+ Add ENABLE_JIT_OPTIMIZE_NATIVE_CALL switch to allow JIT to operate without native call optimizations.
+
+ * runtime/NativeFunctionWrapper.h:
+ * wtf/Platform.h:
+
+2009-05-30 Darin Adler <darin@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ <rdar://problem/6935193> REGRESSION (r42734): Celtic Kane JavaScript benchmark does not run:
+ "Maximum call stack size exceeded"
+
+ * runtime/ArrayPrototype.cpp:
+ (JSC::arrayProtoFuncToString): Use the same recursion limit as the other recursion checks.
+ We need a limit of at least 100 to run the benchmark above.
+ (JSC::arrayProtoFuncToLocaleString): Ditto.
+ (JSC::arrayProtoFuncJoin): Ditto.
+
+2009-05-28 Dirk Schulze <krit@webkit.org>
+
+ Reviewed by Nikolas Zimmermann.
+
+ Added new build flag --filters for Mac. More details in WebCore/ChangeLog.
+
+ * Configurations/FeatureDefines.xcconfig:
+
+2009-05-27 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Mark Rowe.
+
+ <rdar://problem/6928025> Stack overflow in JSC::stringProtoFuncReplace() running jsFunFuzz
+
+ We should always check for exceptions after creating a CachedCall, this wasn't being done in
+ the string replace logic.
+
+ * runtime/StringPrototype.cpp:
+ (JSC::stringProtoFuncReplace):
+
+2009-05-27 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk>
+
+ Unreviewed (make distcheck) build fix; adding missing headers.
+
+ * GNUmakefile.am:
+
+2009-05-27 Jessie Berlin <jberlin@apple.com>
+
+ Reviewed by Adam Roben
+
+ Fix the Windows build.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-05-27 Fridrich Strba <fridrich.strba@bluewin.ch>
+
+ Reviewed by Gustavo Noronha.
+
+ When building on Windows, consider Windows specific files.
+
+ * GNUmakefile.am:
+
+2009-05-27 Fridrich Strba <fridrich.strba@bluewin.ch>
+
+ Reviewed by Maciej Stachowiak.
+
+ When building with MinGW, don't use the __declspec(dl{import,export})
+ decorations and rely on the linker to use its nifty auto-import feature.
+ It is extremely hard to get the decorations right with MinGW in general
+ and impossible in WebKit, where the resulting shared library is linking
+ together some static libraries.
+
+ * config.h:
+
+2009-05-26 Holger Hans Peter Freyther <zecke@selfish.org>
+
+ Reviewed by Xan Lopez.
+
+ https://bugs.webkit.org/show_bug.cgi?id=25613
+
+ Be able to use GOwnPtr for GHashTable as well. The assumption
+ is that the hash table has been created with g_hash_table_new_full
+ and has proper destruction functions.
+
+ * wtf/GOwnPtr.cpp:
+ (WTF::GHashTable):
+ * wtf/GOwnPtr.h:
+
+2009-05-26 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ <rdar://problem/6924033> REGRESSION: Assertion failure due to forward references
+
+ Add a pattern type for forward references to ensure that we don't confuse the
+ quantifier alternatives assertion.
+
+ * yarr/RegexCompiler.cpp:
+ (JSC::Yarr::RegexPatternConstructor::atomBackReference):
+ (JSC::Yarr::RegexPatternConstructor::setupAlternativeOffsets):
+ * yarr/RegexInterpreter.cpp:
+ (JSC::Yarr::ByteCompiler::emitDisjunction):
+ * yarr/RegexJIT.cpp:
+ (JSC::Yarr::RegexGenerator::generateTerm):
+ * yarr/RegexPattern.h:
+ (JSC::Yarr::PatternTerm::):
+ (JSC::Yarr::PatternTerm::PatternTerm):
+ (JSC::Yarr::PatternTerm::ForwardReference):
+
+2009-05-26 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Fix for: <rdar://problem/6918095> REGRESSION: jQuery load() issue (25981),
+ and also an ASSERT failure on http://ihasahotdog.com/.
+
+ When overwriting a property on a dictionary with a cached specific value,
+ clear the cache if new value being written is different.
+
+ * JavaScriptCore.exp:
+ Export the new symbols.
+ * jit/JITStubs.cpp:
+ (JSC::JITStubs::cti_op_get_by_id_method_check_second):
+ Close dictionary prototypes upon caching a method access, as would happen when caching
+ a regular get_by_id.
+ * runtime/JSObject.h:
+ (JSC::JSObject::propertyStorage):
+ (JSC::JSObject::locationForOffset):
+ Make these methods private.
+ (JSC::JSObject::putDirectInternal):
+ When overwriting a property on a dictionary with a cached specific value,
+ clear the cache if new value being written is different.
+ * runtime/Structure.cpp:
+ (JSC::Structure::despecifyDictionaryFunction):
+ Reset the specific value field for a given property in a dictionary.
+ (JSC::Structure::despecifyFunctionTransition):
+ Rename of 'changeFunctionTransition' (this was already internally refered to as a despecification).
+ * runtime/Structure.h:
+ Declare new method.
+
+2009-05-26 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver "pieces of eight" Hunt.
+
+ When reseting RegexPattern class, should fully reset the class, not just bits of it.
+ In particular, we delete the cached character classes (for wordchars, etc), but do
+ not reset the set of pointers to the cached classes. In the case of a repeated parse
+ due to an illegal back-reference we will continue to use the deleted character class.
+
+ * yarr/RegexPattern.h:
+ (JSC::Yarr::RegexPattern::reset):
+
+2009-05-26 Brent Fulgham <bfulgham@webkit.org>
+
+ Build fix to correct r44161.
+
+ * wtf/FastAllocBase.h:
+
+2009-05-26 Zoltan Horvath <horvath.zoltan.6@stud.u-szeged.hu>
+
+ Reviewed by Maciej Stachowiak.
+
+ Inherite HashTable from FastAllocBase, because it has been instantiated by
+ 'new' in JavaScriptCore/runtime/JSGlobalData.cpp.
+
+ * wtf/HashTable.h:
+ * wtf/FastAllocBase.h: Remove 'wtf' path from TypeTraits.h to allow use outside of wtf.
+
+2009-05-25 David Levin <levin@chromium.org>
+
+ Reviewed by Maciej Stachowiak and Oliver Hunt.
+
+ https://bugs.webkit.org/show_bug.cgi?id=25126
+ Allow the buffer underlying UString to be shared.
+
+ In order to not grow the underlying size of any structure,
+ there is a union in the Rep string which holds
+ + m_sharedBuffer -- a pointer to the shared ref counted buffer
+ if the class is BaseString and the buffer is being shared OR
+ + m_baseString -- the BaseString if the class is only UString::Rep
+ but not a UString::BaseString
+
+ Ideally, m_sharedBuffer would be a RefPtr, but it cannot be because
+ it is in a union.
+
+ No change in sunspider perf.
+
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * runtime/UString.cpp:
+ (JSC::UString::Rep::share):
+ (JSC::UString::Rep::destroy):
+ (JSC::UString::BaseString::sharedBuffer):
+ (JSC::UString::BaseString::setSharedBuffer):
+ (JSC::UString::BaseString::slowIsBufferReadOnly):
+ (JSC::expandCapacity):
+ (JSC::UString::Rep::reserveCapacity):
+ (JSC::UString::expandPreCapacity):
+ (JSC::concatenate):
+ (JSC::UString::append):
+ * runtime/UString.h:
+ (JSC::UString::Rep::Rep):
+ (JSC::UString::Rep::):
+ (JSC::UString::BaseString::isShared):
+ (JSC::UString::BaseString::isBufferReadOnly):
+ (JSC::UString::Rep::baseString):
+ * wtf/CrossThreadRefCounted.h:
+ (WTF::CrossThreadRefCounted::isShared):
+ * wtf/OwnFastMallocPtr.h: Added.
+ (WTF::OwnFastMallocPtr::OwnFastMallocPtr):
+ (WTF::OwnFastMallocPtr::~OwnFastMallocPtr):
+ (WTF::OwnFastMallocPtr::get):
+ (WTF::OwnFastMallocPtr::release):
+
+2009-05-25 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Re-add interpreter logic to jit-enabled builds as GCC mysteriously regresses without it
+
+ * wtf/Platform.h:
+
+2009-05-25 Fridrich Strba <fridrich.strba@bluewin.ch>
+
+ Reviewed by Maciej Stachowiak.
+
+ The functions written in assembly need to have a leading
+ underscore on Windows too.
+
+ * jit/JITStubs.cpp:
+
+2009-05-24 Steve Falkenburg <sfalken@apple.com>
+
+ Build fix for experimental PGO Windows target.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+
+2009-05-23 David Kilzer <ddkilzer@apple.com>
+
+ Part 1 of 2: Bug 25495: Implement PassOwnPtr and replace uses of std::auto_ptr
+
+ <https://bugs.webkit.org/show_bug.cgi?id=25495>
+
+ Reviewed by Oliver Hunt.
+
+ * GNUmakefile.am: Added OwnPtrCommon.h and PassOwnPtr.h.
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj: Ditto.
+ * JavaScriptCore.xcodeproj/project.pbxproj: Ditto.
+
+ * wtf/OwnPtr.h:
+ (WTF::OwnPtr::OwnPtr): Added constructors that take a
+ PassOwnPtr. Also added a copy constructor declaration that's
+ required when assigning a PassOwnPtr to a stack-based OwnPtr.
+ (WTF::operator=): Added assignment operator methods that take a
+ PassOwnPtr.
+ (WTF::swap): Reformatted.
+ (WTF::operator==): Whitespace changes.
+ (WTF::operator!=): Ditto.
+
+ * wtf/OwnPtrCommon.h: Added.
+ (WTF::deleteOwnedPtr):
+
+ * wtf/PassOwnPtr.h: Added.
+ (WTF::PassOwnPtr::PassOwnPtr):
+ (WTF::PassOwnPtr::~PassOwnPtr):
+ (WTF::PassOwnPtr::get):
+ (WTF::PassOwnPtr::clear):
+ (WTF::PassOwnPtr::release):
+ (WTF::PassOwnPtr::operator*):
+ (WTF::PassOwnPtr::operator->):
+ (WTF::PassOwnPtr::operator!):
+ (WTF::PassOwnPtr::operator UnspecifiedBoolType):
+ (WTF::::operator):
+ (WTF::operator==):
+ (WTF::operator!=):
+ (WTF::static_pointer_cast):
+ (WTF::const_pointer_cast):
+ (WTF::getPtr):
+
+2009-05-23 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Remove interpreter specific logic from the JIT builds.
+
+ This saves ~100k in JSC release builds.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+ * interpreter/Interpreter.h:
+ * wtf/Platform.h:
+
+2009-05-22 Mark Rowe <mrowe@apple.com>
+
+ Part two of an attempted Windows build fix.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-05-22 Mark Rowe <mrowe@apple.com>
+
+ Part one of an attempted Windows build fix.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-05-21 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ op_method_check
+
+ Optimize method calls, by caching specific function values within the Structure.
+ The new opcode is used almost like an x86 opcode prefix byte to optimize op_get_by_id,
+ where the property access is being used to read a function to be passed to op-call (i.e.
+ 'foo.bar();'). This patch modifies the Structure class such that when a property is
+ put to an object for the first time we will check if the value is a function. If it is,
+ we will cache the function value on the Structure. A Structure in such a state guarantees
+ that not only does a property with the given identifier exist on the object, but also that
+ its value is unchanged. Upon any further attempt to put a property with the same identifier
+ (but a different value) to the object, it will transition back to a normal Structure (where
+ it will guarantee the presence but not the value of the property).
+
+ op_method_check makes use of the new information made available by the Structure, by
+ augmenting the functionality of op_get_by_id. Upon generating a FunctionCallDotNode a
+ check will be emitted prior to the property access reading the function value, and the JIT
+ will generate an extra (initially unlinked but patchable) set of checks prior to the regular
+ JIT code for get_by_id. The new code will do inline structure and prototype structure check
+ (unlike a regular get_by_id, which can only handle 'self' accesses inline), and then performs
+ an immediate load of the function value, rather than using memory accesses to load the value
+ from the obejct's property storage array. If the method check fails it will revert, or if
+ the access is polymorphic, the op_get_by_id will continue to operate - and optimize itself -
+ just as any other regular op_get_by_id would.
+
+ ~2.5% on v8-tests, due to a ~9% progression on richards.
+
+ * API/JSCallbackObjectFunctions.h:
+ (JSC::::put):
+ (JSC::::staticFunctionGetter):
+ * API/JSObjectRef.cpp:
+ (JSObjectMakeConstructor):
+ * JavaScriptCore.exp:
+ * assembler/AbstractMacroAssembler.h:
+ (JSC::AbstractMacroAssembler::differenceBetween):
+ * assembler/MacroAssemblerX86.h:
+ (JSC::MacroAssemblerX86::moveWithPatch):
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::dump):
+ * bytecode/CodeBlock.h:
+ (JSC::getMethodCallLinkInfoReturnLocation):
+ (JSC::CodeBlock::getMethodCallLinkInfo):
+ (JSC::CodeBlock::addMethodCallLinkInfos):
+ (JSC::CodeBlock::methodCallLinkInfo):
+ * bytecode/Opcode.h:
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::emitMethodCheck):
+ * bytecompiler/BytecodeGenerator.h:
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ (JSC::JIT::privateCompileSlowCases):
+ (JSC::JIT::privateCompile):
+ * jit/JIT.h:
+ (JSC::MethodCallCompilationInfo::MethodCallCompilationInfo):
+ * jit/JITOpcodes.cpp:
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::emit_op_method_check):
+ (JSC::JIT::emitSlow_op_method_check):
+ (JSC::JIT::emit_op_get_by_id):
+ (JSC::JIT::emitSlow_op_get_by_id):
+ (JSC::JIT::emit_op_put_by_id):
+ (JSC::JIT::emitSlow_op_put_by_id):
+ (JSC::JIT::compileGetByIdHotPath):
+ (JSC::JIT::compileGetByIdSlowCase):
+ (JSC::JIT::patchMethodCallProto):
+ * jit/JITStubs.cpp:
+ (JSC::JITStubs::cti_op_get_by_id_method_check):
+ (JSC::JITStubs::cti_op_get_by_id_method_check_second):
+ * jit/JITStubs.h:
+ * jsc.cpp:
+ (GlobalObject::GlobalObject):
+ * parser/Nodes.cpp:
+ (JSC::FunctionCallDotNode::emitBytecode):
+ * runtime/Arguments.cpp:
+ (JSC::Arguments::put):
+ * runtime/ArrayConstructor.cpp:
+ (JSC::ArrayConstructor::ArrayConstructor):
+ * runtime/BooleanConstructor.cpp:
+ (JSC::BooleanConstructor::BooleanConstructor):
+ * runtime/DateConstructor.cpp:
+ (JSC::DateConstructor::DateConstructor):
+ * runtime/ErrorConstructor.cpp:
+ (JSC::ErrorConstructor::ErrorConstructor):
+ (JSC::constructError):
+ * runtime/ErrorPrototype.cpp:
+ (JSC::ErrorPrototype::ErrorPrototype):
+ * runtime/FunctionConstructor.cpp:
+ (JSC::FunctionConstructor::FunctionConstructor):
+ * runtime/FunctionPrototype.cpp:
+ (JSC::FunctionPrototype::FunctionPrototype):
+ * runtime/InternalFunction.cpp:
+ (JSC::InternalFunction::InternalFunction):
+ * runtime/JSActivation.cpp:
+ (JSC::JSActivation::put):
+ (JSC::JSActivation::putWithAttributes):
+ * runtime/JSByteArray.cpp:
+ (JSC::JSByteArray::JSByteArray):
+ * runtime/JSFunction.cpp:
+ (JSC::JSFunction::JSFunction):
+ (JSC::JSFunction::getOwnPropertySlot):
+ * runtime/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::putWithAttributes):
+ (JSC::JSGlobalObject::reset):
+ (JSC::JSGlobalObject::mark):
+ * runtime/JSGlobalObject.h:
+ (JSC::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData):
+ (JSC::JSGlobalObject::methodCallDummy):
+ * runtime/JSObject.cpp:
+ (JSC::JSObject::put):
+ (JSC::JSObject::putWithAttributes):
+ (JSC::JSObject::deleteProperty):
+ (JSC::JSObject::defineGetter):
+ (JSC::JSObject::defineSetter):
+ (JSC::JSObject::getPropertyAttributes):
+ (JSC::JSObject::getPropertySpecificFunction):
+ (JSC::JSObject::putDirectFunction):
+ (JSC::JSObject::putDirectFunctionWithoutTransition):
+ * runtime/JSObject.h:
+ (JSC::getJSFunction):
+ (JSC::JSObject::getDirectLocation):
+ (JSC::JSObject::putDirect):
+ (JSC::JSObject::putDirectWithoutTransition):
+ * runtime/LiteralParser.cpp:
+ (JSC::LiteralParser::parseObject):
+ * runtime/Lookup.cpp:
+ (JSC::setUpStaticFunctionSlot):
+ * runtime/Lookup.h:
+ (JSC::lookupPut):
+ * runtime/MathObject.cpp:
+ (JSC::MathObject::MathObject):
+ * runtime/NativeErrorConstructor.cpp:
+ (JSC::NativeErrorConstructor::NativeErrorConstructor):
+ (JSC::NativeErrorConstructor::construct):
+ * runtime/NativeErrorPrototype.cpp:
+ (JSC::NativeErrorPrototype::NativeErrorPrototype):
+ * runtime/NumberConstructor.cpp:
+ (JSC::NumberConstructor::NumberConstructor):
+ * runtime/ObjectConstructor.cpp:
+ (JSC::ObjectConstructor::ObjectConstructor):
+ * runtime/PropertyMapHashTable.h:
+ (JSC::PropertyMapEntry::PropertyMapEntry):
+ * runtime/PrototypeFunction.cpp:
+ (JSC::PrototypeFunction::PrototypeFunction):
+ * runtime/PutPropertySlot.h:
+ (JSC::PutPropertySlot::):
+ (JSC::PutPropertySlot::PutPropertySlot):
+ (JSC::PutPropertySlot::setNewProperty):
+ (JSC::PutPropertySlot::setDespecifyFunctionProperty):
+ (JSC::PutPropertySlot::isCacheable):
+ (JSC::PutPropertySlot::cachedOffset):
+ * runtime/RegExpConstructor.cpp:
+ (JSC::RegExpConstructor::RegExpConstructor):
+ * runtime/StringConstructor.cpp:
+ (JSC::StringConstructor::StringConstructor):
+ * runtime/StringPrototype.cpp:
+ (JSC::StringPrototype::StringPrototype):
+ * runtime/Structure.cpp:
+ (JSC::Structure::Structure):
+ (JSC::Structure::~Structure):
+ (JSC::Structure::materializePropertyMap):
+ (JSC::Structure::addPropertyTransitionToExistingStructure):
+ (JSC::Structure::addPropertyTransition):
+ (JSC::Structure::changeFunctionTransition):
+ (JSC::Structure::addPropertyWithoutTransition):
+ (JSC::Structure::get):
+ (JSC::Structure::despecifyFunction):
+ (JSC::Structure::put):
+ (JSC::Structure::remove):
+ * runtime/Structure.h:
+ (JSC::Structure::get):
+ (JSC::Structure::specificFunction):
+ * runtime/StructureTransitionTable.h:
+ (JSC::StructureTransitionTableHashTraits::emptyValue):
+ * wtf/Platform.h:
+
+2009-05-22 Brent Fulgham <bfulgham@webkit.org>
+
+ Reviewed by Steve Falkenburg.
+
+ https://bugs.webkit.org/show_bug.cgi?id=25950
+ JavaScriptCore Fails to build on Windows (Cairo) due to CoreFoundation
+ link requirement.
+
+ Modify project to add new Debug_CFLite and Release_CFLite targets. These
+ use the new JavaScriptCoreCFLite.vsprops to link against CFLite.dll.
+ Existing projects are changed to use the new JavaScriptCoreCF.vsprops
+ to link against CoreFoundation.dll.
+
+ The JavaScriptCoreCommon.vsprops is modified to remove the link
+ against CoreFoundation.dll.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCF.vsprops: Added.
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCFLite.vsprops: Added.
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops:
+
+2009-05-22 Dominik Röttsches <dominik.roettsches@access-company.com>
+
+ Reviewed by Gustavo Noronha.
+
+ https://bugs.webkit.org/show_bug.cgi?id=15914
+ [GTK] Implement Unicode functionality using GLib
+
+ Original patch by Jürg Billeter and Naiem Shaik.
+ Implementing WTF Unicode functionality based on GLib.
+
+ * GNUmakefile.am:
+ * wtf/unicode/Unicode.h:
+ * wtf/unicode/glib: Added.
+ * wtf/unicode/glib/UnicodeGLib.cpp: Added.
+ (WTF::Unicode::foldCase):
+ (WTF::Unicode::toLower):
+ (WTF::Unicode::toUpper):
+ (WTF::Unicode::direction):
+ (WTF::Unicode::umemcasecmp):
+ * wtf/unicode/glib/UnicodeGLib.h: Added.
+ (WTF::Unicode::):
+ (WTF::Unicode::toLower):
+ (WTF::Unicode::toUpper):
+ (WTF::Unicode::toTitleCase):
+ (WTF::Unicode::isArabicChar):
+ (WTF::Unicode::isFormatChar):
+ (WTF::Unicode::isSeparatorSpace):
+ (WTF::Unicode::isPrintableChar):
+ (WTF::Unicode::isDigit):
+ (WTF::Unicode::isPunct):
+ (WTF::Unicode::mirroredChar):
+ (WTF::Unicode::category):
+ (WTF::Unicode::isLower):
+ (WTF::Unicode::digitValue):
+ (WTF::Unicode::combiningClass):
+ (WTF::Unicode::decompositionType):
+ * wtf/unicode/glib/UnicodeMacrosFromICU.h: Added.
+
+2009-05-21 Xan Lopez <xlopez@igalia.com>
+
+ Unreviewed build fix.
+
+ Add MacroAssemblerCodeRef.h to file list.
+
+ * GNUmakefile.am:
+
+2009-05-21 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Darin Adler.
+ Addition of MacroAssemblerCodeRef.h rubber stamped by Geoff Garen.
+
+ Refactor JIT code-handle objects. The representation of generated code is currently
+ a bit of a mess. We have a class JITCode which wraps the pointer to a block of
+ generated code, but this object does not reference the executable pool meaning that
+ external events (the pool being derefed) could make the pointer become invalid.
+ To overcome this both the JIT and Yarr implement further (and similar) objects to
+ wrap the code pointer with a RefPtr to the pool. To add to the mire, as well as the
+ CodeBlock containing a handle onto the code the FunctionBodyNode also contains a
+ copy of the code pointer which is used almost (but not entirely) uniquely to access
+ the JIT code for a function.
+
+ Rationalization of all this:
+
+ * Add a new type 'MacroAssembler::CodeRef' as a handle for a block of JIT generated code.
+ * Change the JIT & Yarr to internally handle code using CodeRefs.
+ * Move the CodeRef (formerly anow defunct JITCodeRef) from CodeBlock to its owner node.
+ * Remove the (now) redundant code pointer from FunctionBodyNode.
+
+ While tidying this up I've made the PatchBuffer return code in new allocations using a CodeRef,
+ and have enforced an interface that the PatchBuffer will always be used, and 'finalizeCode()' or
+ 'finalizeCodeAddendum()' will always be called exactly once on the PatchBuffer to complete code generation.
+
+ This gives us a potentially useful hook ('PatchBuffer::performFinalization()') at the end of generation,
+ which may have a number of uses. It may be helpful should we wish to switch our generation
+ model to allow RW/RX exclusive memory, and it may be useful on non-cache-coherent platforms to
+ give us an oportunity to cache flush as necessary.
+
+ No performance impact.
+
+ * assembler/AbstractMacroAssembler.h:
+ (JSC::AbstractMacroAssembler::ProcessorReturnAddress::relinkCallerToTrampoline):
+ (JSC::AbstractMacroAssembler::CodeRef::CodeRef):
+ (JSC::AbstractMacroAssembler::CodeRef::trampolineAt):
+ (JSC::AbstractMacroAssembler::PatchBuffer::PatchBuffer):
+ (JSC::AbstractMacroAssembler::PatchBuffer::~PatchBuffer):
+ (JSC::AbstractMacroAssembler::PatchBuffer::link):
+ (JSC::AbstractMacroAssembler::PatchBuffer::linkTailRecursive):
+ (JSC::AbstractMacroAssembler::PatchBuffer::patch):
+ (JSC::AbstractMacroAssembler::PatchBuffer::complete):
+ (JSC::AbstractMacroAssembler::PatchBuffer::finalize):
+ (JSC::AbstractMacroAssembler::PatchBuffer::entry):
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::CodeBlock):
+ (JSC::CodeBlock::reparseForExceptionInfoIfNecessary):
+ (JSC::CodeBlock::setJITCode):
+ * bytecode/CodeBlock.h:
+ (JSC::CodeBlock::getBytecodeIndex):
+ (JSC::CodeBlock::executablePool):
+ * interpreter/CallFrameClosure.h:
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::execute):
+ (JSC::Interpreter::prepareForRepeatCall):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompile):
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ (JSC::JIT::linkCall):
+ * jit/JIT.h:
+ * jit/JITCode.h:
+ (JSC::JITCode::JITCode):
+ (JSC::JITCode::operator bool):
+ (JSC::JITCode::addressForCall):
+ (JSC::JITCode::offsetOf):
+ (JSC::JITCode::execute):
+ (JSC::JITCode::size):
+ (JSC::JITCode::executablePool):
+ (JSC::JITCode::HostFunction):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::privateCompilePutByIdTransition):
+ (JSC::JIT::privateCompilePatchGetArrayLength):
+ (JSC::JIT::privateCompileGetByIdProto):
+ (JSC::JIT::privateCompileGetByIdSelfList):
+ (JSC::JIT::privateCompileGetByIdProtoList):
+ (JSC::JIT::privateCompileGetByIdChainList):
+ (JSC::JIT::privateCompileGetByIdChain):
+ * jit/JITStubs.cpp:
+ (JSC::JITStubs::cti_vm_dontLazyLinkCall):
+ (JSC::JITStubs::cti_vm_lazyLinkCall):
+ * parser/Nodes.cpp:
+ (JSC::ProgramNode::generateJITCode):
+ (JSC::EvalNode::generateJITCode):
+ (JSC::FunctionBodyNode::FunctionBodyNode):
+ (JSC::FunctionBodyNode::createNativeThunk):
+ (JSC::FunctionBodyNode::generateJITCode):
+ * parser/Nodes.h:
+ (JSC::ScopeNode::generatedJITCode):
+ (JSC::ScopeNode::getExecutablePool):
+ (JSC::ScopeNode::setJITCode):
+ (JSC::ProgramNode::jitCode):
+ (JSC::EvalNode::jitCode):
+ (JSC::FunctionBodyNode::jitCode):
+ * runtime/RegExp.cpp:
+ (JSC::RegExp::match):
+ * yarr/RegexJIT.cpp:
+ (JSC::Yarr::RegexGenerator::compile):
+ (JSC::Yarr::jitCompileRegex):
+ (JSC::Yarr::executeRegex):
+ * yarr/RegexJIT.h:
+ (JSC::Yarr::RegexCodeBlock::RegexCodeBlock):
+ (JSC::Yarr::RegexCodeBlock::pcreFallback):
+ (JSC::Yarr::RegexCodeBlock::setFallback):
+ (JSC::Yarr::RegexCodeBlock::operator bool):
+ (JSC::Yarr::RegexCodeBlock::set):
+ (JSC::Yarr::RegexCodeBlock::execute):
+
+2009-05-21 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ <rdar://problem/6910264> REGRESSION: Cached DOM global object property access fails in browser (25921)
+ <https://bugs.webkit.org/show_bug.cgi?id=25921>
+
+ When caching properties on the global object we need to ensure that we're
+ not attempting to cache through a shell object.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::resolveGlobal):
+ * jit/JITStubs.cpp:
+ (JSC::JITStubs::cti_op_resolve_global):
+
+2009-05-21 Steve Falkenburg <sfalken@apple.com>
+
+ Windows build fix.
+
+ * JavaScriptCore.vcproj/jsc/jscCommon.vsprops:
+
+2009-05-21 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Mark Rowe.
+
+ Bug 25945: Add support for MADV_FREE to TCMalloc
+ <https://bugs.webkit.org/show_bug.cgi?id=25945>
+ <rdar://problem/6910754>
+
+ Add support for MADV_FREE to TCMalloc_SystemRelease for platforms that
+ don't also support MADV_FREE_REUSE. The code is identical to the MADV_DONTNEED
+ case except for the advice passed to madvise(), so combining the two cases
+ makes the most sense.
+
+ * wtf/Platform.h: Only define HAVE_MADV_FREE when not building on Tiger or
+ Leopard, because while it is defined on these platforms it actually does
+ nothing.
+ * wtf/TCSystemAlloc.cpp:
+ (TCMalloc_SystemRelease): use MADV_FREE if it is available; otherwise use
+ MADV_DONTNEED.
+
+2009-05-21 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Fix <https://bugs.webkit.org/show_bug.cgi?id=25917> / <rdar://problem/6910066>.
+ Bug 25917: REGRESSION (r43559?): Javascript debugger crashes when pausing page
+
+ The debugger currently retrieves the arguments object from an activation rather than pulling
+ it from a call frame. This is unreliable to due to the recent optimization to lazily create
+ the arguments object. In the long-term it should stop doing that (<rdar://problem/6911886>),
+ but for now we force eager creation of the arguments object when debugging.
+
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::BytecodeGenerator):
+
+2009-05-21 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Bug 25912: Harden NumberPrototype.cpp by removing use of strcpy()
+ <https://bugs.webkit.org/show_bug.cgi?id=25912>
+
+ This causes no change on SunSpider.
+
+ * runtime/NumberPrototype.cpp:
+ (JSC::integerPartNoExp): replace strcpy() with memcpy(), ASSERT that the
+ temporary buffer has sufficient space to store the result, and move the
+ explicit null-termination closer to the memcpy() for easier visual inspection
+ of the code.
+ (JSC::fractionalPartToString): replace strcpy() with memcpy(), and ASSERT
+ that the temporary buffer has sufficient space to store the result. There
+ is no explicit null-termination because this is done by the caller. The
+ same is already true for exponentialPartToString().
+ (JSC::numberProtoFuncToExponential): replace strcpy() with memcpy(), explicitly
+ null-terminate the result, and ASSERT that the temporary buffer has sufficient
+ space to store the result.
+
+2009-05-20 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Cameron Zwarich.
+
+ Cleanup the JSGlobalData when exiting early with the usage statement in jsc.
+
+ * jsc.cpp:
+ (printUsageStatement):
+ (parseArguments):
+ (jscmain):
+
+2009-05-20 Stephanie Lewis <slewis@apple.com>
+
+ Update the order files. <rdar://problem/6881750> Generate new order files.
+
+ * JavaScriptCore.order:
+
+2009-05-19 Kenneth Rohde Christiansen <kenneth.christiansen@openbossa.org>
+
+ Reviewed by Simon Hausmann.
+
+ Replace WREC with YARR + YARR_JIT for the Qt port. This is only
+ used when compiled with JIT support for now, so it is a drop-in
+ replacement for the WREC usage. Still including the wrec headers
+ as they are being referred from RegExp.h, though the contents of
+ that header it protected by "#if ENABLE(WREC)".
+
+ * JavaScriptCore.pri:
+
+2009-05-20 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Eric Seidel.
+
+ Fix GTK debug build.
+
+ The function dumpDisjunction, compiled with debug enabled, uses
+ printf, which needs stdio.h to be included.
+
+ * yarr/RegexInterpreter.cpp:
+
+2009-05-20 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by George Staikos.
+
+ BUG 25843: [Qt] Remove qt-port build flag
+ <https://bugs.webkit.org/show_bug.cgi?id=25843>
+
+ * JavaScriptCore.pro:
+
+
+2009-05-19 Geoffrey Garen <ggaren@apple.com>
+
+ Windows build fix.
+
+ * interpreter/RegisterFile.cpp:
+ (JSC::RegisterFile::releaseExcessCapacity): Copy-paste typo.
+
+2009-05-19 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Fixed <rdar://problem/6885680> CrashTracer: [USER] 1 crash in Install
+ Mac OS X at <unknown binary> • 0x9274241c
+
+ (Original patch by Joe Sokol and Ronnie Misra.)
+
+ SunSpider says 1.004x faster.
+
+ * interpreter/RegisterFile.cpp:
+ (JSC::RegisterFile::releaseExcessCapacity): Instead of doing complicated
+ math that sometimes used to overflow, just release the full range of the
+ register file.
+
+ * interpreter/RegisterFile.h:
+ (JSC::isPageAligned):
+ (JSC::RegisterFile::RegisterFile): Added ASSERTs to verify that it's
+ safe to release the full range of the register file.
+
+ (JSC::RegisterFile::shrink): No need to releaseExcessCapacity() if the
+ new end is not smaller than the old end. (Also, doing so used to cause
+ numeric overflow, unmapping basically the whole process from memory.)
+
+2009-05-19 Oliver Hunt <oliver@apple.com>
+
+ RS=Mark Rowe.
+
+ <rdar://problem/6888393> REGRESSION: Start Debugging JavaScript crashes browser (nightly builds only?)
+ <https://bugs.webkit.org/show_bug.cgi?id=25717>
+
+ Remove JSC_FAST_CALL as it wasn't gaining us anything, and was
+ resulting in weird bugs in the nightly builds.
+
+ * parser/Nodes.cpp:
+ * parser/Nodes.h:
+ (JSC::ExpressionNode::isNumber):
+ (JSC::ExpressionNode::isString):
+ (JSC::ExpressionNode::isNull):
+ (JSC::ExpressionNode::isPure):
+ (JSC::ExpressionNode::isLocation):
+ (JSC::ExpressionNode::isResolveNode):
+ (JSC::ExpressionNode::isBracketAccessorNode):
+ (JSC::ExpressionNode::isDotAccessorNode):
+ (JSC::ExpressionNode::isFuncExprNode):
+ (JSC::ExpressionNode::isSimpleArray):
+ (JSC::ExpressionNode::isAdd):
+ (JSC::ExpressionNode::resultDescriptor):
+ (JSC::StatementNode::firstLine):
+ (JSC::StatementNode::lastLine):
+ (JSC::StatementNode::isEmptyStatement):
+ (JSC::StatementNode::isReturnNode):
+ (JSC::StatementNode::isExprStatement):
+ (JSC::StatementNode::isBlock):
+ (JSC::NullNode::isNull):
+ (JSC::BooleanNode::isPure):
+ (JSC::NumberNode::value):
+ (JSC::NumberNode::setValue):
+ (JSC::NumberNode::isNumber):
+ (JSC::NumberNode::isPure):
+ (JSC::StringNode::isPure):
+ (JSC::StringNode::isString):
+ (JSC::ResolveNode::identifier):
+ (JSC::ResolveNode::isLocation):
+ (JSC::ResolveNode::isResolveNode):
+ (JSC::BracketAccessorNode::isLocation):
+ (JSC::BracketAccessorNode::isBracketAccessorNode):
+ (JSC::DotAccessorNode::base):
+ (JSC::DotAccessorNode::identifier):
+ (JSC::DotAccessorNode::isLocation):
+ (JSC::DotAccessorNode::isDotAccessorNode):
+ (JSC::TypeOfResolveNode::identifier):
+ (JSC::AddNode::isAdd):
+ (JSC::BlockNode::isBlock):
+ (JSC::EmptyStatementNode::isEmptyStatement):
+ (JSC::ExprStatementNode::isExprStatement):
+ (JSC::ReturnNode::isReturnNode):
+ (JSC::ScopeNode::sourceURL):
+ (JSC::ProgramNode::bytecode):
+ (JSC::EvalNode::bytecode):
+ (JSC::FunctionBodyNode::parameters):
+ (JSC::FunctionBodyNode::toSourceString):
+ (JSC::FunctionBodyNode::bytecode):
+ (JSC::FuncExprNode::isFuncExprNode):
+
+2009-05-19 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ - speed up string comparison, especially for short strings
+
+ ~1% on SunSpider
+
+ * JavaScriptCore.exp:
+ * runtime/UString.cpp:
+ * runtime/UString.h:
+ (JSC::operator==): Inline UString's operator==, since it is called from
+ hot places in the runtime. Also, specialize 2-char strings in a similar way to
+ 1-char, since we're taking the hit of a switch anyway.
+
+2009-05-18 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ - for polymorphic prototype lookups, increase the number of slots from 4 to 8
+
+ ~4% faster on v8 raytrace benchmark
+
+ * bytecode/Instruction.h:
+
+2009-05-18 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ - tighten up the code for the load_varargs stub
+
+ ~1-2% on v8-raytrace
+
+ * jit/JITStubs.cpp:
+ (JSC::JITStubs::cti_op_load_varargs): Hoist some loop invariants that
+ the compiler didn't feel like hoisting for us. Remove unneeded exception check.
+
+2009-05-18 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ - Improve code generation for access to prototype properties
+
+ ~0.4% speedup on SunSpider.
+
+ Based on a suggestion from Geoff Garen.
+
+ * jit/JIT.h:
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::compileGetDirectOffset):
+ (JSC::JIT::privateCompileGetByIdProto):
+ (JSC::JIT::privateCompileGetByIdProtoList):
+ (JSC::JIT::privateCompileGetByIdChainList):
+ (JSC::JIT::privateCompileGetByIdChain):
+
+2009-05-18 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk>
+
+ Reviewed by Gavin Barraclough.
+
+ Enable YARR, and disable WREC for GTK+.
+
+ * GNUmakefile.am:
+ * yarr/RegexParser.h:
+
+2009-05-18 Jan Michael Alonzo <jmalonzo@webkit.org>
+
+ Reviewed by Xan Lopez.
+
+ [Gtk] Various autotools build refactoring and fixes
+ https://bugs.webkit.org/show_bug.cgi?id=25286
+
+ Add -no-install and -no-fast-install to programs and tests that we
+ don't install. Also remove -O2 since this is already handled at
+ configure time.
+
+ * GNUmakefile.am:
+
+2009-05-17 Jan Michael Alonzo <jmalonzo@webkit.org>
+
+ Reviewed by Xan Lopez.
+
+ [Gtk] Various autotools build refactoring and fixes
+ https://bugs.webkit.org/show_bug.cgi?id=25286
+
+ Add JavaScriptCore/ to JSC include path only since it's not
+ required when building WebCore.
+
+ * GNUmakefile.am:
+
+2009-05-17 Steve Falkenburg <sfalken@apple.com>
+
+ Windows build fix
+
+ * JavaScriptCore.vcproj/JavaScriptCore.make:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+
+2009-05-15 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Looking like MSVC doesn't like static variables in inline methods?
+ Make the state of the SSE2 check a static variable on the class
+ MacroAssemblerX86Common as a speculative build fix for Windows.
+
+ * assembler/MacroAssemblerX86Common.h:
+ (JSC::MacroAssemblerX86Common::convertInt32ToDouble):
+ (JSC::MacroAssemblerX86Common::branchDouble):
+ (JSC::MacroAssemblerX86Common::branchTruncateDoubleToInt32):
+ (JSC::MacroAssemblerX86Common::isSSE2Present):
+ (JSC::MacroAssemblerX86Common::):
+ * jit/JIT.cpp:
+
+2009-05-15 Adam Roben <aroben@apple.com>
+
+ Add some assembler headers to JavaScriptCore.vcproj
+
+ This is just a convenience for Windows developers.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+
+2009-05-15 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Add FP support to the MacroAssembler, port JITArithmetic over to make use of this. Also add
+ API to determine whether FP support is available 'MacroAssembler::supportsFloatingPoint()',
+ FP is presently only supported on SSE2 platforms, not x87. On platforms where a suitable
+ hardware FPU is not available 'supportsFloatingPoint()' may simply return false, and all
+ other methods ASSERT_NOT_REACHED().
+
+ * assembler/AbstractMacroAssembler.h:
+ * assembler/MacroAssemblerX86.h:
+ (JSC::MacroAssemblerX86::MacroAssemblerX86):
+ (JSC::MacroAssemblerX86::branch32):
+ (JSC::MacroAssemblerX86::branchPtrWithPatch):
+ (JSC::MacroAssemblerX86::supportsFloatingPoint):
+ * assembler/MacroAssemblerX86Common.h:
+ (JSC::MacroAssemblerX86Common::):
+ (JSC::MacroAssemblerX86Common::loadDouble):
+ (JSC::MacroAssemblerX86Common::storeDouble):
+ (JSC::MacroAssemblerX86Common::addDouble):
+ (JSC::MacroAssemblerX86Common::subDouble):
+ (JSC::MacroAssemblerX86Common::mulDouble):
+ (JSC::MacroAssemblerX86Common::convertInt32ToDouble):
+ (JSC::MacroAssemblerX86Common::branchDouble):
+ (JSC::MacroAssemblerX86Common::branchTruncateDoubleToInt32):
+ (JSC::MacroAssemblerX86Common::branch32):
+ (JSC::MacroAssemblerX86Common::branch16):
+ (JSC::MacroAssemblerX86Common::branchTest32):
+ (JSC::MacroAssemblerX86Common::branchAdd32):
+ (JSC::MacroAssemblerX86Common::branchMul32):
+ (JSC::MacroAssemblerX86Common::branchSub32):
+ (JSC::MacroAssemblerX86Common::set32):
+ (JSC::MacroAssemblerX86Common::setTest32):
+ (JSC::MacroAssemblerX86Common::x86Condition):
+ (JSC::MacroAssemblerX86Common::isSSE2Present):
+ * assembler/MacroAssemblerX86_64.h:
+ (JSC::MacroAssemblerX86_64::movePtrToDouble):
+ (JSC::MacroAssemblerX86_64::moveDoubleToPtr):
+ (JSC::MacroAssemblerX86_64::setPtr):
+ (JSC::MacroAssemblerX86_64::branchPtr):
+ (JSC::MacroAssemblerX86_64::branchTestPtr):
+ (JSC::MacroAssemblerX86_64::branchAddPtr):
+ (JSC::MacroAssemblerX86_64::branchSubPtr):
+ (JSC::MacroAssemblerX86_64::supportsFloatingPoint):
+ * assembler/X86Assembler.h:
+ * jit/JIT.cpp:
+ (JSC::JIT::JIT):
+ * jit/JIT.h:
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emit_op_rshift):
+ (JSC::JIT::emitSlow_op_rshift):
+ (JSC::JIT::emitSlow_op_jnless):
+ (JSC::JIT::emitSlow_op_jnlesseq):
+ (JSC::JIT::compileBinaryArithOp):
+ (JSC::JIT::compileBinaryArithOpSlowCase):
+ (JSC::JIT::emit_op_add):
+ (JSC::JIT::emitSlow_op_add):
+ (JSC::JIT::emit_op_mul):
+ (JSC::JIT::emitSlow_op_mul):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::privateCompilePutByIdTransition):
+
+2009-05-15 Francisco Tolmasky <francisco@280north.com>
+
+ BUG 25467: JavaScript debugger should use function.displayName as the function's name in the call stack
+ <https://bugs.webkit.org/show_bug.cgi?id=25467>
+
+ Reviewed by Adam Roben.
+
+ * JavaScriptCore.exp: Added calculatedFunctionName
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: Added calculatedFunctionName
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: Added calculatedFunctionName
+ * debugger/DebuggerCallFrame.cpp: Added calculatedFunctionName to match existing one in ProfileNode.
+ (JSC::DebuggerCallFrame::calculatedFunctionName):
+ * debugger/DebuggerCallFrame.h: Added calculatedFunctionName to match existing one in ProfileNode.
+
+2009-05-14 Gavin Barraclough <barraclough@apple.com>
+
+ Build fix, not reviewed.
+
+ Quick fixes for JIT builds with OPTIMIZE flags disabled.
+
+ * jit/JITCall.cpp:
+ (JSC::JIT::compileOpCall):
+ (JSC::JIT::compileOpCallSlowCase):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::compilePutByIdHotPath):
+
+2009-05-14 Steve Falkenburg <sfalken@apple.com>
+
+ Back out incorrect Windows build fix
+
+ * JavaScriptCore.vcproj/JavaScriptCore.make:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+
+2009-05-14 Steve Falkenburg <sfalken@apple.com>
+
+ Windows build fix
+
+ * JavaScriptCore.vcproj/JavaScriptCore.make:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+
+2009-05-14 Adam Roben <aroben@apple.com>
+
+ Windows jsc build fix
+
+ r43648 modified jsc.vcproj's post-build event not to try to copy files
+ that aren't present. Then r43661 mistakenly un-did that modification.
+ This patch restores the modification from r43648, but puts the code in
+ jscCommon.vsprops (where it should have been added in r43648).
+
+ * JavaScriptCore.vcproj/jsc/jsc.vcproj: Restored empty
+ VCPostBuildEventTool tags.
+ * JavaScriptCore.vcproj/jsc/jscCommon.vsprops: Modified the post-build
+ event command line to match the one in jsc.vcproj from r43648.
+
+2009-05-14 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=25325
+
+ Make sure pthread_self() is declared before it gets called in Collector.cpp
+
+ * runtime/Collector.cpp: Include pthread.h in most Unix-like platforms
+ (not just for OPENBSD)
+
+2009-05-14 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Fix <https://bugs.webkit.org/show_bug.cgi?id=25785>.
+ Bug 25785: Segfault in mark when using JSObjectMakeConstructor
+
+ * API/JSObjectRef.cpp:
+ (JSObjectMakeConstructor): OpaqueJSClass::prototype can return 0. We need to use the default object prototype when it does.
+ * API/tests/testapi.c:
+ (main): Add a test case.
+ * runtime/JSObject.h:
+ (JSC::JSObject::putDirect): Add a clearer assertion for a null value. The assertion on the next line does catch this,
+ but the cause of the failure is not clear from the assertion itself.
+
+2009-05-14 Mark Rowe <mrowe@apple.com>
+
+ Rubber-stamped by Darin Adler.
+
+ <rdar://problem/6681868> When building with Xcode 3.1.3 should be using gcc 4.2
+
+ The meaning of XCODE_VERSION_ACTUAL is more sensible in newer versions of Xcode.
+ Update our logic to select the compiler version to use the more appropriate XCODE_VERSION_MINOR
+ if the version of Xcode supports it, and fall back to XCODE_VERSION_ACTUAL if not.
+
+ * Configurations/Base.xcconfig:
+
+2009-05-14 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Checking register file bounds should be a ptr comparison (m_end is a Register*).
+ Also, the compare should be unsigned, pointers don'ts go negative.
+
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompile):
+
+2009-05-13 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Fix <rdar://problem/6882919> REGRESSION: page at Metroauto site crashes in cti_op_loop_if_less (25730)
+
+ op_loop_if_less (imm < op) was loading op into regT1, but in the slow path spills regT0.
+ This leads to bad happen.
+
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_loop_if_less):
+ (JSC::JIT::emitSlow_op_loop_if_less):
+
+2009-05-13 Dmitry Titov <dimich@chromium.org>
+
+ Rubber-stamped by Mark Rowe.
+
+ https://bugs.webkit.org/show_bug.cgi?id=25746
+ Revert http://trac.webkit.org/changeset/43507 which caused crash in PPC nightlies with Safari 4.
+
+ * JavaScriptCore.exp:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+ * bytecode/SamplingTool.cpp:
+ (JSC::SamplingThread::start):
+ (JSC::SamplingThread::stop):
+ * bytecode/SamplingTool.h:
+ * wtf/CrossThreadRefCounted.h:
+ (WTF::CrossThreadRefCounted::CrossThreadRefCounted):
+ (WTF::::ref):
+ (WTF::::deref):
+ * wtf/Threading.h:
+ * wtf/ThreadingNone.cpp:
+ * wtf/ThreadingPthreads.cpp:
+ (WTF::threadMapMutex):
+ (WTF::initializeThreading):
+ (WTF::threadMap):
+ (WTF::identifierByPthreadHandle):
+ (WTF::establishIdentifierForPthreadHandle):
+ (WTF::pthreadHandleForIdentifier):
+ (WTF::clearPthreadHandleForIdentifier):
+ (WTF::createThreadInternal):
+ (WTF::waitForThreadCompletion):
+ (WTF::detachThread):
+ (WTF::currentThread):
+ * wtf/ThreadingWin.cpp:
+ (WTF::threadMapMutex):
+ (WTF::initializeThreading):
+ (WTF::threadMap):
+ (WTF::storeThreadHandleByIdentifier):
+ (WTF::threadHandleForIdentifier):
+ (WTF::clearThreadHandleForIdentifier):
+ (WTF::createThreadInternal):
+ (WTF::waitForThreadCompletion):
+ (WTF::detachThread):
+ (WTF::currentThread):
+ * wtf/gtk/ThreadingGtk.cpp:
+ (WTF::threadMapMutex):
+ (WTF::initializeThreading):
+ (WTF::threadMap):
+ (WTF::identifierByGthreadHandle):
+ (WTF::establishIdentifierForThread):
+ (WTF::threadForIdentifier):
+ (WTF::clearThreadForIdentifier):
+ (WTF::createThreadInternal):
+ (WTF::waitForThreadCompletion):
+ (WTF::currentThread):
+ * wtf/qt/ThreadingQt.cpp:
+ (WTF::threadMapMutex):
+ (WTF::threadMap):
+ (WTF::identifierByQthreadHandle):
+ (WTF::establishIdentifierForThread):
+ (WTF::clearThreadForIdentifier):
+ (WTF::threadForIdentifier):
+ (WTF::initializeThreading):
+ (WTF::createThreadInternal):
+ (WTF::waitForThreadCompletion):
+ (WTF::currentThread):
+
+2009-05-13 Darin Adler <darin@apple.com>
+
+ Revert the parser arena change. It was a slowdown, not a speedup.
+ Better luck next time (I'll break it up into pieces).
+
+2009-05-13 Darin Adler <darin@apple.com>
+
+ Tiger build fix.
+
+ * parser/Grammar.y: Add back empty code blocks, needed by older
+ versions of bison on certain rules.
+
+2009-05-13 Steve Falkenburg <sfalken@apple.com>
+
+ Windows build fix.
+
+ * JavaScriptCore.vcproj/jsc/jsc.vcproj:
+
+2009-05-13 Adam Roben <aroben@apple.com>
+
+ Windows build fixes after r43642
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+ Updated.
+
+ * debugger/Debugger.cpp:
+ * runtime/ArrayConstructor.cpp:
+ * runtime/JSArray.cpp:
+ * runtime/RegExp.cpp:
+ * runtime/RegExpConstructor.cpp:
+ * runtime/RegExpPrototype.cpp:
+ * runtime/StringPrototype.cpp:
+ Added missing #includes.
+
+2009-05-13 Darin Adler <darin@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ Bug 25674: syntax tree nodes should use arena allocation
+ https://bugs.webkit.org/show_bug.cgi?id=25674
+
+ Step 3: Add some actual arena allocation. About 1% SunSpider speedup.
+
+ * JavaScriptCore.exp: Updated.
+
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::BytecodeGenerator): Updated since VarStack
+ contains const Identifier* now.
+ (JSC::BytecodeGenerator::emitPushNewScope): Updated to take a const
+ Identifier&.
+ * bytecompiler/BytecodeGenerator.h: Ditto
+
+ * bytecompiler/SegmentedVector.h: Added isEmpty.
+
+ * debugger/Debugger.cpp:
+ (JSC::Debugger::recompileAllJSFunctions): Moved this function here from
+ WebCore so WebCore doesn't need the details of FunctionBodyNode.
+ * debugger/Debugger.h: Ditto.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::execute): Updated since VarStack contains const
+ Identifier* now.
+
+ * jit/JITStubs.cpp:
+ (JSC::JITStubs::cti_vm_lazyLinkCall): Call isHostFunction on the body
+ rather than on the function object, since we can't easily have inlined
+ access to the FunctionBodyNode in JSFunction.h since WebCore needs
+ access to that header.
+ (JSC::JITStubs::cti_op_construct_JSConstruct): Ditto.
+ * profiler/Profiler.cpp:
+ (JSC::Profiler::createCallIdentifier): Ditto.
+
+ * parser/Grammar.y: Use JSGlobalData* to pass the global data pointer
+ around whenever possible instead of using void*. Changed
+ SET_EXCEPTION_LOCATION from a macro to an inline function. Marked
+ the structure-creating functions inline. Changed the VarStack to use
+ identifier pointers instead of actual identifiers. This takes
+ advantage of the fact that all identifier pointers come from the
+ arena and avoids reference count churn. Changed Identifier* to
+ const Identifier* to make sure we don't modify any by accident.
+ Used identifiers for regular expression strings too, using the new
+ scanRegExp that has out parameters instead of the old one that relied
+ on side effects in the Lexer. Move the creation of numeric identifiers
+ out of this file and into the PropertyNode constructor.
+
+ * parser/Lexer.cpp:
+ (JSC::Lexer::setCode): Pass in ParserArena, used for identifiers.
+ (JSC::Lexer::makeIdentifier): Changed return type to const Identifier*
+ and changed to call ParserArena.
+ (JSC::Lexer::scanRegExp): Added out arguments that are const Identifier*
+ as well as a prefix character argument so we can handle the /= case
+ without a string append.
+ (JSC::Lexer::skipRegExp): Added. Skips a regular expression without
+ allocating Identifier objects.
+ (JSC::Lexer::clear): Removed the code to manage m_identifiers, m_pattern,
+ and m_flags, and added code to set m_arena to 0.
+ * parser/Lexer.h: Updated for changes above.
+
+ * parser/NodeConstructors.h:
+ (JSC::ParserArenaFreeable::operator new): Added. Calls allocateFreeable
+ on the arena.
+ (JSC::ParserArenaDeletable::operator new): Changed to call the
+ allocateDeletable function on the arena instead of deleteWithArena.
+ (JSC::RegExpNode::RegExpNode): Changed arguments to Identifier instead
+ of UString since these come from the parser which makes identifiers.
+ (JSC::PropertyNode::PropertyNode): Added new constructor that makes
+ numeric identifiers. Some day we might want to optimize this for
+ integers so it doesn't create a string for each one.
+ (JSC::ContinueNode::ContinueNode): Initialize m_ident to nullIdentifier
+ since it's now a const Identifier& so it can't be left uninitialized.
+ (JSC::BreakNode::BreakNode): Ditto.
+ (JSC::CaseClauseNode::CaseClauseNode): Updated to use SourceElements*
+ to keep track of the statements rather than a separate statement vector.
+ (JSC::BlockNode::BlockNode): Ditto.
+ (JSC::ForInNode::ForInNode): Initialize m_ident to nullIdentifier.
+
+ * parser/Nodes.cpp: Moved the comment explaining emitBytecode in here.
+ It seemed strangely out of place in the header.
+ (JSC::ThrowableExpressionData::emitThrowError): Added an overload for
+ UString as well as Identifier.
+ (JSC::SourceElements::singleStatement): Added.
+ (JSC::SourceElements::lastStatement): Added.
+ (JSC::RegExpNode::emitBytecode): Updated since the pattern and flags
+ are now Identifier instead of UString. Also changed the throwError code
+ to use the substitution mechanism instead of doing a string append.
+ (JSC::SourceElements::emitBytecode): Added. Replaces the old
+ statementListEmitCode function, since we now keep the SourceElements
+ objects around.
+ (JSC::BlockNode::lastStatement): Added.
+ (JSC::BlockNode::emitBytecode): Changed to use emitBytecode instead of
+ statementListEmitCode.
+ (JSC::CaseClauseNode::emitBytecode): Added.
+ (JSC::CaseBlockNode::emitBytecodeForBlock): Changed to use emitBytecode
+ instead of statementListEmitCode.
+ (JSC::ScopeNodeData::ScopeNodeData): Changed to store the
+ SourceElements* instead of using releaseContentsIntoVector.
+ (JSC::ScopeNode::emitStatementsBytecode): Added.
+ (JSC::ScopeNode::singleStatement): Added.
+ (JSC::ProgramNode::emitBytecode): Call emitStatementsBytecode instead
+ of statementListEmitCode.
+ (JSC::EvalNode::emitBytecode): Ditto.
+ (JSC::EvalNode::generateBytecode): Removed code to clear the children
+ vector. This optimization is no longer possible since everything is in
+ a single arena.
+ (JSC::FunctionBodyNode::emitBytecode): Call emitStatementsBytecode
+ insetad of statementListEmitCode and check for the return node using
+ the new functions.
+
+ * parser/Nodes.h: Changed VarStack to store const Identifier* instead
+ of Identifier and rely on the arena to control lifetime. Added a new
+ ParserArenaFreeable class. Made ParserArenaDeletable inherit from
+ FastAllocBase instead of having its own operator new. Base the Node
+ class on ParserArenaFreeable. Changed the various Node classes
+ to use const Identifier& instead of Identifier to avoid the need to
+ call their destructors and allow them to function as "freeable" in the
+ arena. Removed extraneous JSC_FAST_CALL on definitions of inline functions.
+ Changed ElementNode, PropertyNode, ArgumentsNode, ParameterNode,
+ CaseClauseNode, ClauseListNode, and CaseBlockNode to use ParserArenaFreeable
+ as a base class since they do not descend from Node. Eliminated the
+ StatementVector type and instead have various classes use SourceElements*
+ instead of StatementVector. This prevents those classes from having th
+ use ParserArenaDeletable to make sure the vector destructor is called.
+
+ * parser/Parser.cpp:
+ (JSC::Parser::parse): Pass the arena to the lexer.
+
+ * parser/Parser.h: Added an include of ParserArena.h, which is no longer
+ included by Nodes.h.
+
+ * parser/ParserArena.cpp:
+ (JSC::ParserArena::ParserArena): Added. Initializes the new members,
+ m_freeableMemory, m_freeablePoolEnd, and m_identifiers.
+ (JSC::ParserArena::freeablePool): Added. Computes the pool pointer,
+ since we store only the current pointer and the end of pool pointer.
+ (JSC::ParserArena::deallocateObjects): Added. Contains the common
+ memory-deallocation logic used by both the destructor and the
+ reset function.
+ (JSC::ParserArena::~ParserArena): Changed to call deallocateObjects.
+ (JSC::ParserArena::reset): Ditto. Also added code to zero out the
+ new structures, and switched to use clear() instead of shrink(0) since
+ we don't really reuse arenas.
+ (JSC::ParserArena::makeNumericIdentifier): Added.
+ (JSC::ParserArena::allocateFreeablePool): Added. Used when the pool
+ is empty.
+ (JSC::ParserArena::isEmpty): Added. No longer inline, which is fine
+ since this is used only for assertions at the moment.
+
+ * parser/ParserArena.h: Added an actual arena of "freeable" objects,
+ ones that don't need destructors to be called. Also added the segmented
+ vector of identifiers that used to be in the Lexer.
+
+ * runtime/FunctionConstructor.cpp:
+ (JSC::extractFunctionBody): Use singleStatement function rather than
+ getting at a StatementVector.
+
+ * runtime/FunctionPrototype.cpp:
+ (JSC::functionProtoFuncToString): Call isHostFunction on the body
+ rather than the function object.
+
+ * runtime/JSFunction.cpp:
+ (JSC::JSFunction::JSFunction): Moved the structure version of this in
+ here from the header. It's not hot enough that it needs to be inlined.
+ (JSC::JSFunction::isHostFunction): Moved this in here from the header.
+ It's now a helper to be used only within the class.
+ (JSC::JSFunction::setBody): Moved this in here. It's not hot enough that
+ it needs to be inlined, and we want to be able to compile the header
+ without the definition of FunctionBodyNode.
+
+ * runtime/JSFunction.h: Eliminated the include of "Nodes.h". This was
+ exposing too much JavaScriptCore dependency to WebCore. Because of this
+ change and some changes made to WebCore, we could now export a lot fewer
+ headers from JavaScriptCore, but I have not done that yet in this check-in.
+ Made a couple functions non-inline. Removes some isHostFunction() assertions.
+
+ * wtf/FastAllocBase.h: Added the conventional using statements we use in
+ WTF so we can use identifiers from the WTF namespace without explicit
+ namespace qualification or namespace directive. This is the usual WTF style,
+ although it's unconventional in the C++ world. We use the namespace primarily
+ for link-time disambiguation, not compile-time.
+
+ * wtf/FastMalloc.cpp: Fixed an incorrect comment.
+
+2009-05-13 Xan Lopez <xlopez@igalia.com>
+
+ Unreviewed build fix: add JITStubCall.h to files list.
+
+ * GNUmakefile.am:
+
+2009-05-13 Ariya Hidayat <ariya.hidayat@nokia.com>
+
+ Unreviewed build fix, as suggested by Yael Aharon <yael.aharon@nokia.com>.
+
+ * wtf/qt/ThreadingQt.cpp:
+ (WTF::waitForThreadCompletion): renamed IsValid to isValid.
+
+2009-05-13 Jan Michael Alonzo <jmalonzo@webkit.org>
+
+ Revert r43562 - [Gtk] WTF_USE_JSC is already defined in
+ WebCore/config.h.
+
+ * wtf/Platform.h:
+
+2009-05-12 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Add SamplingCounter tool to provide a simple mechanism for counting events in JSC
+ (enabled using ENABLE(SAMPLING_COUNTERS)). To count events within a single function
+ use the class 'SamplingCounter', where the counter may be incremented from multiple
+ functions 'GlobalSamplingCounter' may be convenient; all other counters (stack or
+ heap allocated, rather than statically declared) should use the DeletableSamplingCounter.
+ Further description of these classes is provided alongside their definition in
+ SamplingTool.h.
+
+ Counters may be incremented from c++ by calling the 'count()' method on the counter,
+ or may be incremented by JIT code by using the 'emitCount()' method within the JIT.
+
+ This patch also fixes CODEBLOCK_SAMPLING, which was missing a null pointer check.
+
+ * JavaScriptCore.exp:
+ * assembler/MacroAssemblerX86.h:
+ (JSC::MacroAssemblerX86::addWithCarry32):
+ (JSC::MacroAssemblerX86::and32):
+ (JSC::MacroAssemblerX86::or32):
+ * assembler/MacroAssemblerX86Common.h:
+ (JSC::MacroAssemblerX86Common::and32):
+ (JSC::MacroAssemblerX86Common::or32):
+ * assembler/MacroAssemblerX86_64.h:
+ (JSC::MacroAssemblerX86_64::and32):
+ (JSC::MacroAssemblerX86_64::or32):
+ (JSC::MacroAssemblerX86_64::addPtr):
+ * assembler/X86Assembler.h:
+ (JSC::X86Assembler::):
+ (JSC::X86Assembler::adcl_im):
+ (JSC::X86Assembler::addq_im):
+ (JSC::X86Assembler::andl_im):
+ (JSC::X86Assembler::orl_im):
+ * bytecode/SamplingTool.cpp:
+ (JSC::AbstractSamplingCounter::dump):
+ * bytecode/SamplingTool.h:
+ (JSC::AbstractSamplingCounter::count):
+ (JSC::GlobalSamplingCounter::name):
+ (JSC::SamplingCounter::SamplingCounter):
+ * jit/JIT.h:
+ * jit/JITCall.cpp:
+ (JSC::):
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::setSamplingFlag):
+ (JSC::JIT::clearSamplingFlag):
+ (JSC::JIT::emitCount):
+ * jsc.cpp:
+ (runWithScripts):
+ * parser/Nodes.cpp:
+ (JSC::ScopeNode::ScopeNode):
+ * wtf/Platform.h:
+
+2009-05-13 Steve Falkenburg <sfalken@apple.com>
+
+ Windows build fix.
+
+ * JavaScriptCore.vcproj/JavaScriptCore.make:
+
+2009-05-12 Steve Falkenburg <sfalken@apple.com>
+
+ Windows build fix.
+
+ * JavaScriptCore.vcproj/JavaScriptCore.make:
+
+2009-05-12 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ <rdar://problem/6881457> Crash occurs at JSC::Interpreter::execute() when loading http://www.sears.com
+
+ We created the arguments objects before an op_push_scope but not
+ before op_push_new_scope, this meant a null arguments object could
+ be resolved inside catch blocks.
+
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::emitPushNewScope):
+
+2009-05-12 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ <rdar://problem/6879881> Crash occurs at JSC::JSActivation::mark() when loading http://www.monster.com; http://www.cnet.com
+ <https://bugs.webkit.org/show_bug.cgi?id=25736> Crash loading www.google.dk/ig (and other igoogle's as well)
+
+ Following on from the lazy arguments creation patch, it's now
+ possible for an activation to to have a null register in the callframe
+ so we can't just blindly mark the local registers in an activation,
+ and must null check first instead.
+
+ * API/tests/testapi.c:
+ (functionGC):
+ * API/tests/testapi.js:
+ (bludgeonArguments.return.g):
+ (bludgeonArguments):
+ * runtime/JSActivation.cpp:
+ (JSC::JSActivation::mark):
+
+2009-05-12 Gavin Barraclough <barraclough@apple.com>
+
+ Rubber stamped by Geoff Garen.
+
+ WTF_USE_CTI_REPATCH_PIC is no longer used, remove.
+
+ * jit/JIT.h:
+ * jit/JITStubCall.h:
+
+2009-05-12 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ We've run into some problems where changing the size of the class JIT leads to
+ performance fluctuations. Try forcing alignment in an attempt to stabalize this.
+
+ * jit/JIT.h:
+
+2009-05-12 Kevin Ollivier <kevino@theolliviers.com>
+
+ wx build fix. Add ParserArena.cpp to the build.
+
+ * JavaScriptCoreSources.bkl:
+
+2009-05-12 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Unsigned underflow on 64bit cannot be treated as a negative number
+
+ This code included some placeswhere we deliberately create negative offsets
+ from unsigned values, on 32bit this is "safe", but in 64bit builds much
+ badness occurs. Solution is to use signed types as nature intended.
+
+ * jit/JITStubs.cpp:
+ (JSC::JITStubs::cti_op_load_varargs):
+
+2009-05-12 Jan Michael Alonzo <jmalonzo@webkit.org>
+
+ Reviewed by Holger Freyther.
+
+ [Gtk] Various autotools build refactoring and fixes
+ https://bugs.webkit.org/show_bug.cgi?id=25286
+
+ Define WTF_USE_JSC for the Gtk port.
+
+ * wtf/Platform.h:
+
+2009-05-12 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ - allow all of strictEqual to be inlined into cti_op_stricteq once again
+
+ We had this optimization once but accidentally lost it at some point.
+
+ * runtime/Operations.h:
+ (JSC::JSValue::strictEqualSlowCaseInline):
+ (JSC::JSValue::strictEqual):
+
+2009-05-12 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ instanceof should throw if the constructor being tested does not implement
+ 'HasInstance" (i.e. is a function). Instead we were returning false.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::isInvalidParamForIn):
+ (JSC::isInvalidParamForInstanceOf):
+ (JSC::Interpreter::privateExecute):
+ * jit/JITStubs.cpp:
+ (JSC::JITStubs::cti_op_instanceof):
+ * tests/mozilla/ecma_2/instanceof/instanceof-003.js:
+ Fix broken test case.
+ * tests/mozilla/ecma_2/instanceof/regress-7635.js:
+ Remove broken test case (was an exact duplicate of a test in instanceof-003.js).
+
+2009-05-12 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Improve function call forwarding performance
+
+ Make creation of the Arguments object occur lazily, so it
+ is not necessarily created for every function that references
+ it. Then add logic to Function.apply to allow it to avoid
+ allocating the Arguments object at all. Helps a lot with
+ the function forwarding/binding logic in jQuery, Prototype,
+ and numerous other JS libraries.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::dump):
+ * bytecode/Opcode.h:
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::BytecodeGenerator):
+ (JSC::BytecodeGenerator::registerFor):
+ (JSC::BytecodeGenerator::willResolveToArguments):
+ (JSC::BytecodeGenerator::uncheckedRegisterForArguments):
+ (JSC::BytecodeGenerator::createArgumentsIfNecessary):
+ (JSC::BytecodeGenerator::emitCallEval):
+ (JSC::BytecodeGenerator::emitPushScope):
+ * bytecompiler/BytecodeGenerator.h:
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+ (JSC::Interpreter::retrieveArguments):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ * jit/JIT.h:
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_create_arguments):
+ (JSC::JIT::emit_op_init_arguments):
+ * jit/JITStubs.cpp:
+ (JSC::JITStubs::cti_op_tear_off_arguments):
+ (JSC::JITStubs::cti_op_load_varargs):
+ * parser/Nodes.cpp:
+ (JSC::ApplyFunctionCallDotNode::emitBytecode):
+
+2009-05-11 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Enable use of SamplingFlags directly from JIT code.
+
+ * bytecode/SamplingTool.h:
+ * jit/JIT.h:
+ (JSC::JIT::sampleCodeBlock):
+ (JSC::JIT::sampleInstruction):
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::setSamplingFlag):
+ (JSC::JIT::clearSamplingFlag):
+
+2009-05-11 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ Implement JIT generation for instanceof for non-objects (always returns false).
+ Also fixes the sequencing of the prototype and value isObject checks, to no match the spec.
+
+ 0.5% progression on v8 tests overall, due to 3.5% on early-boyer.
+
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ (JSC::JIT::privateCompileSlowCases):
+ * runtime/JSObject.cpp:
+ (JSC::JSObject::hasInstance):
+ * runtime/TypeInfo.h:
+ (JSC::TypeInfo::TypeInfo):
+
+2009-05-11 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ A little more JIT refactoring.
+
+ Rearranged code to more clearly indicate what's conditionally compiled
+ and why. Now, all shared code is at the top of our JIT files, and all
+ #if'd code is at the bottom. #if'd code is delineated by large comments.
+
+ Moved functions that relate to the JIT but don't explicitly do codegen
+ into JIT.cpp. Refactored SSE2 check to store its result as a data member
+ in the JIT.
+
+ * jit/JIT.cpp:
+ (JSC::isSSE2Present):
+ (JSC::JIT::JIT):
+ (JSC::JIT::unlinkCall):
+ (JSC::JIT::linkCall):
+ * jit/JIT.h:
+ (JSC::JIT::isSSE2Present):
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emit_op_mod):
+ (JSC::JIT::emitSlow_op_mod):
+ * jit/JITCall.cpp:
+ (JSC::JIT::compileOpCallVarargs):
+ (JSC::JIT::compileOpCallVarargsSlowCase):
+
+2009-05-11 Holger Hans Peter Freyther <zecke@selfish.org>
+
+ Build fix.
+
+ * JavaScriptCore.pri: Build the new JITOpcodes.cpp
+
+2009-05-11 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ More re-factoring of JIT code generation. Use a macro to
+ forward the main switch-statement cases to the helper functions.
+
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ (JSC::JIT::privateCompileSlowCases):
+
+2009-05-11 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ More re-factoring of JIT code generation to move opcode generation
+ to helper functions outside the main switch-statement and gave those
+ helper functions standardized names. This patch covers the remaining
+ slow cases.
+
+ * jit/JIT.cpp:
+ * jit/JIT.h:
+ * jit/JITOpcodes.cpp:
+
+2009-05-11 Geoffrey Garen <ggaren@apple.com>
+
+ Build fix.
+
+ * GNUmakefile.am: Added JITOpcodes.cpp and JITStubCall.h to the project.
+
+2009-05-11 Geoffrey Garen <ggaren@apple.com>
+
+ Build fix.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Added
+ JITOpcodes.cpp and JITStubCall.h to the project.
+
+2009-05-11 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Some JIT refactoring.
+
+ Moved JITStubCall* into its own header.
+
+ Modified JITStubCall to ASSERT that its return value is handled correctly.
+ Also, replaced function template with explicit instantiations to resolve
+ some confusion.
+
+ Replaced all uses of emit{Get,Put}CTIArgument with explicit peeks, pokes,
+ and calls to killLastResultRegister().
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ (JSC::JIT::privateCompile):
+ * jit/JIT.h:
+ * jit/JITArithmetic.cpp:
+ * jit/JITCall.cpp:
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::restoreArgumentReference):
+ * jit/JITPropertyAccess.cpp:
+ * jit/JITStubCall.h: Copied from jit/JIT.h.
+ (JSC::JITStubCall::JITStubCall):
+ (JSC::JITStubCall::addArgument):
+ (JSC::JITStubCall::call):
+ (JSC::JITStubCall::):
+
+2009-05-11 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ Start re-factoring JIT code generation to move opcode generation
+ to helper functions outside the main switch-statement and gave those
+ helper functions standardized names. This patch only covers the main
+ pass and all the arithmetic opcodes in the slow path.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ (JSC::JIT::privateCompileSlowCases):
+ * jit/JIT.h:
+ * jit/JITArithmetic.cpp:
+ * jit/JITOpcodes.cpp: Copied from jit/JIT.cpp.
+ * jit/JITPropertyAccess.cpp:
+
+2009-05-11 Steve Falkenburg <sfalken@apple.com>
+
+ Re-add experimental PGO configs.
+
+ Reviewed by Adam Roben.
+
+ * JavaScriptCore.vcproj/JavaScriptCore.make:
+ * JavaScriptCore.vcproj/JavaScriptCore.sln:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.vcproj/JavaScriptCoreSubmit.sln:
+ * JavaScriptCore.vcproj/jsc/jsc.vcproj:
+
+2009-05-11 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey "1" Garen.
+
+ Rip out the !USE(CTI_REPATCH_PIC) code. It was untested and unused.
+
+ * jit/JIT.h:
+ (JSC::JIT::compileGetByIdChainList):
+ (JSC::JIT::compileGetByIdChain):
+ (JSC::JIT::compileCTIMachineTrampolines):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::privateCompileGetByIdProto):
+ (JSC::JIT::privateCompileGetByIdChainList):
+ (JSC::JIT::privateCompileGetByIdChain):
+ * jit/JITStubs.cpp:
+ (JSC::JITStubs::tryCachePutByID):
+ (JSC::JITStubs::tryCacheGetByID):
+
+2009-05-11 Dmitry Titov <dimich@chromium.org>
+
+ GTK build fix - the deprecated waitForThreadCompletion is not needed on GTK.
+
+ * wtf/ThreadingPthreads.cpp: used #ifdef PLATFORM(DARWIN) around waitForThreadCompletion().
+
+2009-05-11 Adam Roben <aroben@apple.com>
+
+ Build fix for newer versions of GCC
+
+ * wtf/ThreadingPthreads.cpp: Added a declaration of
+ waitForThreadCompletion before its definition to silence a warning.
+
+2009-05-11 Dmitry Titov <dimich@chromium.org>
+
+ Reviewed by Alexey Proskuryakov and Adam Roben.
+
+ https://bugs.webkit.org/show_bug.cgi?id=25348
+ Change WTF::ThreadIdentifier to be an actual (but wrapped) thread id, remove ThreadMap.
+
+ * wtf/Threading.h:
+ (WTF::ThreadIdentifier::ThreadIdentifier):
+ (WTF::ThreadIdentifier::isValid):
+ (WTF::ThreadIdentifier::invalidate):
+ (WTF::ThreadIdentifier::platformId):
+ ThreadIdentifier is now a class, containing a PlatformThreadIdentifier and
+ methods that are used across the code on thread ids: construction, comparisons,
+ check for 'valid' state etc. '0' is used as invalid id, which happens to just work
+ with all platform-specific thread id implementations.
+
+ All the following files repeatedly reflect the new ThreadIdentifier for each platform.
+ We remove ThreadMap and threadMapMutex from all of them, remove the functions that
+ populated/searched/cleared the map and add platform-specific comparison operators
+ for ThreadIdentifier.
+
+ There are specific temporary workarounds for Safari 4 beta on OSX and Win32 since the
+ public build uses WTF threading functions with old type of ThreadingIdentifier.
+ The next time Safari 4 is rebuilt, it will 'automatically' pick up the new type and new
+ functions so the deprecated ones can be removed.
+
+ * wtf/gtk/ThreadingGtk.cpp:
+ (WTF::ThreadIdentifier::operator==):
+ (WTF::ThreadIdentifier::operator!=):
+ (WTF::initializeThreading):
+ (WTF::createThreadInternal):
+ (WTF::waitForThreadCompletion):
+ (WTF::currentThread):
+
+ * wtf/ThreadingNone.cpp:
+ (WTF::ThreadIdentifier::operator==):
+ (WTF::ThreadIdentifier::operator!=):
+
+ * wtf/ThreadingPthreads.cpp:
+ (WTF::ThreadIdentifier::operator==):
+ (WTF::ThreadIdentifier::operator!=):
+ (WTF::initializeThreading):
+ (WTF::createThreadInternal):
+ (WTF::waitForThreadCompletion):
+ (WTF::detachThread):
+ (WTF::currentThread):
+ (WTF::waitForThreadCompletion): This is a workaround for Safari 4 beta on Mac.
+ Safari 4 is linked against old definition of ThreadIdentifier so it treats it as uint32_t.
+ This 'old' variant of waitForThreadCompletion takes uint32_t and has the old decorated name, so Safari can
+ load it from JavaScriptCore library. The other functions (CurrentThread() etc) happen to match their previous
+ decorated names and, while they return pthread_t now, it is a pointer which round-trips through a uint32_t.
+ This function will be removed as soon as Safari 4 will release next public build.
+
+ * wtf/qt/ThreadingQt.cpp:
+ (WTF::ThreadIdentifier::operator==):
+ (WTF::ThreadIdentifier::operator!=):
+ (WTF::initializeThreading):
+ (WTF::createThreadInternal):
+ (WTF::waitForThreadCompletion):
+ (WTF::currentThread):
+
+ * wtf/ThreadingWin.cpp:
+ (WTF::ThreadIdentifier::operator==):
+ (WTF::ThreadIdentifier::operator!=):
+ (WTF::initializeThreading):
+ (WTF::createThreadInternal): All the platforms (except Windows) used a sequential
+ counter as a thread ID and mapped it into platform ID. Windows was using native thread
+ id and mapped it into thread handle. Since we can always obtain a thread handle
+ by thread id, createThread now closes the handle.
+ (WTF::waitForThreadCompletion): obtains another one using OpenThread(id) API. If can not obtain a handle,
+ it means the thread already exited.
+ (WTF::detachThread):
+ (WTF::currentThread):
+ (WTF::detachThreadDeprecated): old function, renamed (for Win Safari 4 beta which uses it for now).
+ (WTF::waitForThreadCompletionDeprecated): same.
+ (WTF::currentThreadDeprecated): same.
+ (WTF::createThreadDeprecated): same.
+
+ * bytecode/SamplingTool.h:
+ * bytecode/SamplingTool.cpp: Use DEFINE_STATIC_LOCAL for a static ThreadIdentifier variable, to avoid static constructor.
+
+ * JavaScriptCore.exp: export lists - updated decorated names of the WTF threading functions
+ since they now take a different type as a parameter.
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: ditto for Windows, plus added "deprecated" functions
+ that take old parameter type - turns out public beta of Safari 4 uses those, so they need to be kept along for a while.
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: ditto.
+
+2009-05-11 Darin Adler <darin@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 25560: REGRESSION (r34821): "string value".__proto__ gets the wrong object.
+ https://bugs.webkit.org/show_bug.cgi?id=25560
+ rdar://problem/6861069
+
+ I missed this case back a year ago when I sped up handling
+ of JavaScript wrappers. Easy to fix.
+
+ * runtime/JSObject.h:
+ (JSC::JSValue::get): Return the prototype itself if the property name
+ is __proto__.
+ * runtime/JSString.cpp:
+ (JSC::JSString::getOwnPropertySlot): Ditto.
+
+2009-05-09 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Rename emitGetFromCallFrameHeader to emitGetFromCallFrameHeaderPtr
+
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ * jit/JIT.h:
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::emitGetFromCallFrameHeaderPtr):
+ (JSC::JIT::emitGetFromCallFrameHeader32):
+
+2009-05-11 Holger Hans Peter Freyther <zecke@selfish.org>
+
+ Unreviewed build fix. Build ParserAreana.cpp for Qt
+
+ * JavaScriptCore.pri:
+
+2009-05-11 Norbert Leser <norbert.leser@nokia.com>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=24536
+
+ Symbian compilers cannot resolve WTF::PassRefPtr<JSC::Profile>
+ unless Profile.h is included.
+
+ * profiler/ProfileGenerator.h:
+
+2009-05-11 Csaba Osztrogonac <oszi@inf.u-szeged.hu>
+
+ Reviewed by Holger Freyther.
+
+ https://bugs.webkit.org/show_bug.cgi?id=24284
+
+ * JavaScriptCore.pri: coding style modified
+ * jsc.pro: duplicated values removed from INCLUDEPATH, DEFINES
+
+2009-05-11 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk>
+
+ Reviewed by NOBODY (build fix).
+
+ Also add ParserArena, in addition to AllInOne, for release builds,
+ since adding it to AllInOne breaks Mac.
+
+ * GNUmakefile.am:
+
+2009-05-11 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk>
+
+ Unreviewed build fix. Adding ParserArena to the autotools build.
+
+ * GNUmakefile.am:
+
+2009-05-11 Adam Roben <aroben@apple.com>
+
+ More Windows build fixes after r43479
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+ Export ParserArena::reset.
+
+2009-05-11 Adam Roben <aroben@apple.com>
+
+ Windows build fixes after r43479
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Added
+ ParserArena to the project.
+
+ * parser/NodeConstructors.h: Added a missing include.
+ (JSC::ParserArenaDeletable::operator new): Marked these as inline.
+
+2009-05-10 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ - fixed REGRESSION(r43432): Many JavaScriptCore tests crash in 64-bit
+ https://bugs.webkit.org/show_bug.cgi?id=25680
+
+ Accound for the 64-bit instruction prefix when rewriting mov to lea on 64-bit.
+
+ * jit/JIT.h:
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::patchGetByIdSelf):
+ (JSC::JIT::patchPutByIdReplace):
+
+2009-05-10 Darin Adler <darin@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ Bug 25674: syntax tree nodes should use arena allocation
+ https://bugs.webkit.org/show_bug.cgi?id=25674
+
+ Part two: Remove reference counting from most nodes.
+
+ * JavaScriptCore.exp: Updated.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj: Added ParserArena.h and .cpp.
+
+ * parser/Grammar.y: Replaced uses of ParserRefCountedData with uses of
+ ParserArenaData. Took out now-nonfunctional code that tries to manually
+ release declaration list. Changed the new calls that create FuncDeclNode
+ and FuncExprNode so that they use the proper version of operator new for
+ the reference-counted idiom, not the deletion idiom.
+
+ * parser/NodeConstructors.h:
+ (JSC::ParserArenaDeletable::operator new): Added.
+ (JSC::ParserArenaRefCounted::ParserArenaRefCounted): Added.
+ (JSC::Node::Node): Removed ParserRefCounted initializer.
+ (JSC::ElementNode::ElementNode): Ditto.
+ (JSC::PropertyNode::PropertyNode): Ditto.
+ (JSC::ArgumentsNode::ArgumentsNode): Ditto.
+ (JSC::SourceElements::SourceElements): Ditto.
+ (JSC::ParameterNode::ParameterNode): Ditto.
+ (JSC::FuncExprNode::FuncExprNode): Added ParserArenaRefCounted initializer.
+ (JSC::FuncDeclNode::FuncDeclNode): Ditto.
+ (JSC::CaseClauseNode::CaseClauseNode): Removed ParserRefCounted initializer.
+ (JSC::ClauseListNode::ClauseListNode): Ditto.
+ (JSC::CaseBlockNode::CaseBlockNode): Ditto.
+
+ * parser/NodeInfo.h: Replaced uses of ParserRefCountedData with uses of
+ ParserArenaData.
+
+ * parser/Nodes.cpp:
+ (JSC::ScopeNode::ScopeNode): Added ParserArenaRefCounted initializer.
+ (JSC::ProgramNode::create): Use the proper version of operator new for
+ the reference-counted idiom, not the deletion idiom. Use the arena
+ contains function instead of the vecctor find function.
+ (JSC::EvalNode::create): Use the proper version of operator new for
+ the reference-counted idiom, not the deletion idiom. Use the arena
+ reset function instead of the vector shrink function.
+ (JSC::FunctionBodyNode::createNativeThunk): Use the proper version
+ of operator new for the reference-counted idiom, not the deletion idiom.
+ (JSC::FunctionBodyNode::create): More of the same.
+
+ * parser/Nodes.h: Added ParserArenaDeletable and ParserArenaRefCounted
+ to replace ParserRefCounted. Fixed inheritance so only the classes that
+ need reference counting inherit from ParserArenaRefCounted.
+
+ * parser/Parser.cpp:
+ (JSC::Parser::parse): Set m_sourceElements to 0 since it now starts
+ uninitialized. Just set it to 0 again in the failure case, since it's
+ now just a raw pointer, not an owning one.
+ (JSC::Parser::reparseInPlace): Removed now-unneeded get() function.
+ (JSC::Parser::didFinishParsing): Replaced uses of ParserRefCountedData
+ with uses of ParserArenaData.
+
+ * parser/Parser.h: Less RefPtr, more arena.
+
+ * parser/ParserArena.cpp: Added.
+ * parser/ParserArena.h: Added.
+
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::~JSGlobalData): Removed arena-related code, since it's
+ now in the Parser.
+ (JSC::JSGlobalData::createLeaked): Removed unneeded #ifndef.
+ (JSC::JSGlobalData::createNativeThunk): Tweaked #if a bit.
+
+ * runtime/JSGlobalData.h: Removed parserArena, which is now in Parser.
+
+ * wtf/RefCounted.h: Added deletionHasBegun function, for use in
+ assertions to catch deletion not done by the deref function.
+
+2009-05-10 David Kilzer <ddkilzer@apple.com>
+
+ Part 2: Try to fix the Windows build by adding a symbol which is really just a re-mangling of a changed method signature
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-05-10 David Kilzer <ddkilzer@apple.com>
+
+ Try to fix the Windows build by removing an unknown symbol
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-05-10 David Kilzer <ddkilzer@apple.com>
+
+ Touch Nodes.cpp to try to fix Windows build
+
+ * parser/Nodes.cpp: Removed whitespace.
+
+2009-05-10 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Quick fix for failures seen on buildbot. Maciej plans a better fix later.
+
+ * wtf/dtoa.cpp: Change the hardcoded number of 32-bit words in a BigInt
+ from 32 to 64. Parsing "1e500", for example, requires more than 32 words.
+
+2009-05-10 Darin Adler <darin@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Bug 25674: syntax tree nodes should use arena allocation
+ Part one: Change lifetimes so we won't have to use reference
+ counting so much, but don't eliminate the reference counts
+ entirely yet.
+
+ * JavaScriptCore.exp: Updated.
+
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::BytecodeGenerator): Update for use of raw pointers
+ instead of RefPtr.
+ (JSC::BytecodeGenerator::emitCall): Ditto.
+ (JSC::BytecodeGenerator::emitConstruct): Ditto.
+
+ * parser/Grammar.y: Update node creating code to use new (JSGlobalData*)
+ instead of the plain new. At the moment this is just a hook for future
+ arena allocation; it's inline and JSGlobalData* is not used.
+
+ * parser/NodeConstructors.h: Updated for name change of parserObjects to
+ parserArena. Also added explicit initialization for raw pointers that used
+ to be RefPtr. Also removed some uses of get() that aren't needed now that
+ the pointers are raw pointers. Also eliminated m_parameter from FuncExprNode
+ and FuncDeclNode. Also changed node-creating code to use new (JSGlobalData*)
+ as above.
+
+ * parser/Nodes.cpp: Eliminated NodeReleaser and all use of it.
+ (JSC::ParserRefCounted::ParserRefCounted): Updated for name change of
+ parserObjects to parserArena.
+ (JSC::SourceElements::append): Use raw pointers.
+ (JSC::ArrayNode::emitBytecode): Ditto.
+ (JSC::ArrayNode::isSimpleArray): Ditto.
+ (JSC::ArrayNode::toArgumentList): Ditto.
+ (JSC::ObjectLiteralNode::emitBytecode): Ditto.
+ (JSC::PropertyListNode::emitBytecode): Ditto.
+ (JSC::BracketAccessorNode::emitBytecode): Ditto.
+ (JSC::DotAccessorNode::emitBytecode): Ditto.
+ (JSC::ArgumentListNode::emitBytecode): Ditto.
+ (JSC::NewExprNode::emitBytecode): Ditto.
+ (JSC::EvalFunctionCallNode::emitBytecode): Ditto.
+ (JSC::FunctionCallValueNode::emitBytecode): Ditto.
+ (JSC::FunctionCallResolveNode::emitBytecode): Ditto.
+ (JSC::FunctionCallBracketNode::emitBytecode): Ditto.
+ (JSC::FunctionCallDotNode::emitBytecode): Ditto.
+ (JSC::CallFunctionCallDotNode::emitBytecode): Ditto.
+ (JSC::ApplyFunctionCallDotNode::emitBytecode): Ditto.
+ (JSC::PostfixBracketNode::emitBytecode): Ditto.
+ (JSC::PostfixDotNode::emitBytecode): Ditto.
+ (JSC::DeleteBracketNode::emitBytecode): Ditto.
+ (JSC::DeleteDotNode::emitBytecode): Ditto.
+ (JSC::DeleteValueNode::emitBytecode): Ditto.
+ (JSC::VoidNode::emitBytecode): Ditto.
+ (JSC::TypeOfValueNode::emitBytecode): Ditto.
+ (JSC::PrefixBracketNode::emitBytecode): Ditto.
+ (JSC::PrefixDotNode::emitBytecode): Ditto.
+ (JSC::UnaryOpNode::emitBytecode): Ditto.
+ (JSC::BinaryOpNode::emitStrcat): Ditto.
+ (JSC::BinaryOpNode::emitBytecode): Ditto.
+ (JSC::EqualNode::emitBytecode): Ditto.
+ (JSC::StrictEqualNode::emitBytecode): Ditto.
+ (JSC::ReverseBinaryOpNode::emitBytecode): Ditto.
+ (JSC::ThrowableBinaryOpNode::emitBytecode): Ditto.
+ (JSC::InstanceOfNode::emitBytecode): Ditto.
+ (JSC::LogicalOpNode::emitBytecode): Ditto.
+ (JSC::ConditionalNode::emitBytecode): Ditto.
+ (JSC::ReadModifyResolveNode::emitBytecode): Ditto.
+ (JSC::AssignResolveNode::emitBytecode): Ditto.
+ (JSC::AssignDotNode::emitBytecode): Ditto.
+ (JSC::ReadModifyDotNode::emitBytecode): Ditto.
+ (JSC::AssignBracketNode::emitBytecode): Ditto.
+ (JSC::ReadModifyBracketNode::emitBytecode): Ditto.
+ (JSC::CommaNode::emitBytecode): Ditto.
+ (JSC::ConstDeclNode::emitCodeSingle): Ditto.
+ (JSC::ConstDeclNode::emitBytecode): Ditto.
+ (JSC::ConstStatementNode::emitBytecode): Ditto.
+ (JSC::statementListEmitCode): Ditto.
+ (JSC::BlockNode::emitBytecode): Ditto.
+ (JSC::ExprStatementNode::emitBytecode): Ditto.
+ (JSC::VarStatementNode::emitBytecode): Ditto.
+ (JSC::IfNode::emitBytecode): Ditto.
+ (JSC::IfElseNode::emitBytecode): Ditto.
+ (JSC::DoWhileNode::emitBytecode): Ditto.
+ (JSC::WhileNode::emitBytecode): Ditto.
+ (JSC::ForNode::emitBytecode): Ditto.
+ (JSC::ForInNode::emitBytecode): Ditto.
+ (JSC::ReturnNode::emitBytecode): Ditto.
+ (JSC::WithNode::emitBytecode): Ditto.
+ (JSC::CaseBlockNode::tryOptimizedSwitch): Ditto.
+ (JSC::CaseBlockNode::emitBytecodeForBlock): Ditto.
+ (JSC::SwitchNode::emitBytecode): Ditto.
+ (JSC::LabelNode::emitBytecode): Ditto.
+ (JSC::ThrowNode::emitBytecode): Ditto.
+ (JSC::TryNode::emitBytecode): Ditto.
+ (JSC::ScopeNodeData::ScopeNodeData): Use swap to transfer ownership
+ of the arena, varStack and functionStack.
+ (JSC::ScopeNode::ScopeNode): Pass in the arena when creating the
+ ScopeNodeData.
+ (JSC::ProgramNode::ProgramNode): Made this inline since it's used
+ in only one place.
+ (JSC::ProgramNode::create): Changed this to return a PassRefPtr since
+ we plan to have the scope nodes be outside the arena, so they will need
+ some kind of ownership transfer (maybe auto_ptr instead of PassRefPtr
+ in the future, though). Remove the node from the newly-created arena to
+ avoid a circular reference. Later we'll keep the node out of the arena
+ by using a different operator new, but for now it's the ParserRefCounted
+ constructor that puts the node into the arena, and there's no way to
+ bypass that.
+ (JSC::EvalNode::EvalNode): Ditto.
+ (JSC::EvalNode::create): Ditto.
+ (JSC::FunctionBodyNode::FunctionBodyNode): Ditto.
+ (JSC::FunctionBodyNode::createNativeThunk): Moved the code that
+ reseets the arena here instead of the caller.
+ (JSC::FunctionBodyNode::create): Same change as the other create
+ functions above.
+ (JSC::FunctionBodyNode::emitBytecode): Use raw pointers.
+
+ * parser/Nodes.h: Removed NodeReleaser. Changed FunctionStack to
+ use raw pointers. Removed the releaseNodes function. Added an override
+ of operator new that takes a JSGlobalData* to prepare for future arena use.
+ Use raw pointers instead of RefPtr everywhere possible.
+
+ * parser/Parser.cpp:
+ (JSC::Parser::reparseInPlace): Pass the arena in.
+
+ * parser/Parser.h:
+ (JSC::Parser::parse): Updated for name change of parserObjects to parserArena.
+ (JSC::Parser::reparse): Ditto.
+ * runtime/FunctionConstructor.cpp:
+ (JSC::extractFunctionBody): Ditto.
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::~JSGlobalData): Ditto.
+ (JSC::JSGlobalData::createNativeThunk): Moved arena manipulation into the
+ FunctionBodyNode::createNativeThunk function.
+
+ * runtime/JSGlobalData.h: Tweaked formatting and renamed parserObjects to
+ parserArena.
+
+ * wtf/NotFound.h: Added the usual "using WTF" to this header to match the
+ rest of WTF.
+
+2009-05-10 Dimitri Glazkov <dglazkov@chromium.org>
+
+ Reviewed by Geoffrey Garen.
+
+ https://bugs.webkit.org/show_bug.cgi?id=25670
+ Remove no longer valid chunk of code from dtoa.
+
+ * wtf/dtoa.cpp:
+ (WTF::dtoa): Removed invalid code.
+
+2009-05-10 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Geoff Garen.
+
+ "Class const *" is the same as "const Class*", use the latter syntax consistently.
+
+ See <http://www.parashift.com/c++-faq-lite/const-correctness.html#faq-18.9>.
+
+ * pcre/pcre_compile.cpp:
+ (calculateCompiledPatternLength):
+ * runtime/JSObject.h:
+ (JSC::JSObject::offsetForLocation):
+ (JSC::JSObject::locationForOffset):
+
+2009-05-10 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Alexey Proskuryakov.
+
+ - speedup dtoa/strtod
+
+ Added a bunch of inlining, and replaced malloc with stack allocation.
+
+ 0.5% SunSpider speedup (7% on string-tagcloud).
+
+ * runtime/NumberPrototype.cpp:
+ (JSC::integerPartNoExp):
+ (JSC::numberProtoFuncToExponential):
+ * runtime/UString.cpp:
+ (JSC::concatenate):
+ (JSC::UString::from):
+ * wtf/dtoa.cpp:
+ (WTF::BigInt::BigInt):
+ (WTF::BigInt::operator=):
+ (WTF::Balloc):
+ (WTF::Bfree):
+ (WTF::multadd):
+ (WTF::s2b):
+ (WTF::i2b):
+ (WTF::mult):
+ (WTF::pow5mult):
+ (WTF::lshift):
+ (WTF::cmp):
+ (WTF::diff):
+ (WTF::b2d):
+ (WTF::d2b):
+ (WTF::ratio):
+ (WTF::strtod):
+ (WTF::quorem):
+ (WTF::freedtoa):
+ (WTF::dtoa):
+ * wtf/dtoa.h:
+
+2009-05-09 Mike Hommey <glandium@debian.org>
+
+ Reviewed by Geoffrey Garen. Landed by Jan Alonzo.
+
+ Enable JIT on x86-64 gtk+
+ https://bugs.webkit.org/show_bug.cgi?id=24724
+
+ * GNUmakefile.am:
+
+2009-05-09 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ Removed the last non-call-related manually managed JIT stub call.
+
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::compileFastArithSlow_op_rshift): Fully use the JITStubCall
+ abstraction, instead of emitPutJITStubArg.
+
+2009-05-09 Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
+
+ Reviewed by Gustavo Noronha.
+
+ https://bugs.webkit.org/show_bug.cgi?id=25653
+ PLATFORM(X86_64) inherits ia64
+
+ __ia64__ is defined by gcc in an IA64 arch and has completely
+ nothing in common with X86-64 exept both are from Intel and have
+ an 64bit address space. That's it. Since code seems to expect x86
+ here, ia64 has to go.
+
+ * wtf/Platform.h:
+
+2009-05-09 Gustavo Noronha Silva <gns@gnome.org>
+
+ Suggested by Geoffrey Garen.
+
+ Assume SSE2 is present on X86-64 and on MAC X86-32. This fixes a
+ build breakage on non-Mac X86-64 when JIT is enabled.
+
+ * jit/JITArithmetic.cpp:
+
+2009-05-09 Gustavo Noronha Silva <gns@gnome.org>
+
+ Build fix, adding missing files to make dist.
+
+ * GNUmakefile.am:
+
+2009-05-09 Geoffrey Garen <ggaren@apple.com>
+
+ Windows build fix.
+
+ * assembler/X86Assembler.h:
+ (JSC::X86Assembler::patchLoadToLEA):
+
+2009-05-09 Geoffrey Garen <ggaren@apple.com>
+
+ Windows build fix.
+
+ * assembler/X86Assembler.h:
+ (JSC::X86Assembler::patchLoadToLEA):
+
+2009-05-09 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Original patch by John McCall. Updated by Cameron Zwarich. Further refined by me.
+
+ - Assorted speedups to property access
+
+ ~.3%-1% speedup on SunSpider
+
+ 1) When we know from the structure ID that an object is using inline storage, plant direct
+ loads and stores against it; no need to indirect through storage pointer.
+
+ 2) Also because of the above, union the property storage pointer with the first inline property
+ slot and add an extra inline property slot.
+
+ * assembler/AbstractMacroAssembler.h:
+ (JSC::AbstractMacroAssembler::CodeLocationInstruction::CodeLocationInstruction):
+ (JSC::AbstractMacroAssembler::CodeLocationInstruction::patchLoadToLEA):
+ (JSC::::CodeLocationCommon::instructionAtOffset):
+ * assembler/MacroAssembler.h:
+ (JSC::MacroAssembler::storePtr):
+ * assembler/MacroAssemblerX86.h:
+ (JSC::MacroAssemblerX86::store32):
+ * assembler/MacroAssemblerX86_64.h:
+ (JSC::MacroAssemblerX86_64::storePtr):
+ * assembler/X86Assembler.h:
+ (JSC::X86Assembler::movq_EAXm):
+ (JSC::X86Assembler::movl_rm):
+ (JSC::X86Assembler::patchLoadToLEA):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ * jit/JIT.h:
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::compileGetByIdHotPath):
+ (JSC::JIT::compilePutByIdHotPath):
+ (JSC::JIT::compilePutDirectOffset):
+ (JSC::JIT::compileGetDirectOffset):
+ (JSC::JIT::privateCompilePutByIdTransition):
+ (JSC::JIT::patchGetByIdSelf):
+ (JSC::JIT::patchPutByIdReplace):
+ (JSC::JIT::privateCompileGetByIdSelf):
+ (JSC::JIT::privateCompileGetByIdProto):
+ (JSC::JIT::privateCompileGetByIdSelfList):
+ (JSC::JIT::privateCompileGetByIdProtoList):
+ (JSC::JIT::privateCompileGetByIdChainList):
+ (JSC::JIT::privateCompileGetByIdChain):
+ (JSC::JIT::privateCompilePutByIdReplace):
+ * runtime/JSObject.cpp:
+ (JSC::JSObject::mark):
+ (JSC::JSObject::removeDirect):
+ * runtime/JSObject.h:
+ (JSC::JSObject::propertyStorage):
+ (JSC::JSObject::getDirect):
+ (JSC::JSObject::getOffset):
+ (JSC::JSObject::offsetForLocation):
+ (JSC::JSObject::locationForOffset):
+ (JSC::JSObject::getDirectOffset):
+ (JSC::JSObject::putDirectOffset):
+ (JSC::JSObject::isUsingInlineStorage):
+ (JSC::JSObject::):
+ (JSC::JSObject::JSObject):
+ (JSC::JSObject::~JSObject):
+ (JSC::Structure::isUsingInlineStorage):
+ (JSC::JSObject::putDirect):
+ (JSC::JSObject::putDirectWithoutTransition):
+ (JSC::JSObject::allocatePropertyStorageInline):
+ * runtime/Structure.h:
+
+2009-05-09 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Changed all our JIT stubs so that they return a maximum of 1 JS value or
+ two non-JS pointers, and do all other value returning through out
+ parameters, in preparation for 64bit JS values on a 32bit system.
+
+ Stubs that used to return two JSValues now return one JSValue and take
+ and out parameter specifying where in the register array the second
+ value should go.
+
+ SunSpider reports no change.
+
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::compileFastArithSlow_op_post_inc):
+ (JSC::JIT::compileFastArithSlow_op_post_dec):
+ * jit/JITStubs.cpp:
+ (JSC::JITStubs::cti_op_call_arityCheck):
+ (JSC::JITStubs::cti_op_resolve_func):
+ (JSC::JITStubs::cti_op_post_inc):
+ (JSC::JITStubs::cti_op_resolve_with_base):
+ (JSC::JITStubs::cti_op_post_dec):
+ * jit/JITStubs.h:
+ (JSC::):
+
+2009-05-08 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ Fixed <rdar://problem/6634956> CrashTracer: [REGRESSION] >400 crashes
+ in Safari at com.apple.JavaScriptCore • JSC::BytecodeGenerator::emitComplexJumpScopes + 468
+ https://bugs.webkit.org/show_bug.cgi?id=25658
+
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::emitComplexJumpScopes): Guard the whole loop
+ with a bounds check. The old loop logic would decrement and read topScope
+ without a bounds check, which could cause crashes on page boundaries.
+
+2009-05-08 Jan Michael Alonzo <jmalonzo@webkit.org>
+
+ Reviewed by NOBODY (BuildFix).
+
+ Gtk fix: add LiteralParser to the build script per r43424.
+
+ Add LiteralParser to the Qt and Wx build scripts too.
+
+ * GNUmakefile.am:
+ * JavaScriptCore.pri:
+ * JavaScriptCoreSources.bkl:
+
+2009-05-08 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough and Darin Adler.
+
+ Add a limited literal parser for eval to handle object and array literals fired at eval
+
+ This is a simplified parser and lexer that we can throw at strings passed to eval
+ in case a site is using eval to parse JSON (eg. json2.js). The lexer is intentionally
+ limited (in effect it's whitelisting a limited "common" subset of the JSON grammar)
+ as this decreases the likelihood of us wating time attempting to parse any significant
+ amount of non-JSON content.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::callEval):
+ * runtime/JSGlobalObjectFunctions.cpp:
+ (JSC::globalFuncEval):
+ * runtime/LiteralParser.cpp: Added.
+ (JSC::isStringCharacter):
+ (JSC::LiteralParser::Lexer::lex):
+ (JSC::LiteralParser::Lexer::lexString):
+ (JSC::LiteralParser::Lexer::lexNumber):
+ (JSC::LiteralParser::parseStatement):
+ (JSC::LiteralParser::parseExpression):
+ (JSC::LiteralParser::parseArray):
+ (JSC::LiteralParser::parseObject):
+ (JSC::LiteralParser::StackGuard::StackGuard):
+ (JSC::LiteralParser::StackGuard::~StackGuard):
+ (JSC::LiteralParser::StackGuard::isSafe):
+ * runtime/LiteralParser.h: Added.
+ (JSC::LiteralParser::LiteralParser):
+ (JSC::LiteralParser::attemptJSONParse):
+ (JSC::LiteralParser::):
+ (JSC::LiteralParser::Lexer::Lexer):
+ (JSC::LiteralParser::Lexer::next):
+ (JSC::LiteralParser::Lexer::currentToken):
+ (JSC::LiteralParser::abortParse):
+
+2009-05-08 Geoffrey Garen <ggaren@apple.com>
+
+ Not reviewed.
+
+ Restored a Mozilla JS test I accidentally gutted.
+
+ * tests/mozilla/ecma/Array/15.4.4.2.js:
+ (getTestCases):
+ (test):
+
+2009-05-08 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ More abstraction for JITStub calls from JITed code.
+
+ Added a JITStubCall class that automatically handles things like assigning
+ arguments to different stack slots and storing return values. Deployed
+ the class in about a billion places. A bunch more places remain to be
+ fixed up, but this is a good stopping point for now.
+
+ * jit/JIT.cpp:
+ (JSC::JIT::emitTimeoutCheck):
+ (JSC::JIT::privateCompileMainPass):
+ (JSC::JIT::privateCompileSlowCases):
+ (JSC::JIT::privateCompile):
+ * jit/JIT.h:
+ (JSC::JIT::JSRInfo::JSRInfo):
+ (JSC::JITStubCall::JITStubCall):
+ (JSC::JITStubCall::addArgument):
+ (JSC::JITStubCall::call):
+ (JSC::JITStubCall::):
+ (JSC::CallEvalJITStub::CallEvalJITStub):
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::compileFastArithSlow_op_lshift):
+ (JSC::JIT::compileFastArithSlow_op_rshift):
+ (JSC::JIT::compileFastArithSlow_op_jnless):
+ (JSC::JIT::compileFastArithSlow_op_bitand):
+ (JSC::JIT::compileFastArithSlow_op_mod):
+ (JSC::JIT::compileFastArith_op_mod):
+ (JSC::JIT::compileFastArithSlow_op_post_inc):
+ (JSC::JIT::compileFastArithSlow_op_post_dec):
+ (JSC::JIT::compileFastArithSlow_op_pre_inc):
+ (JSC::JIT::compileFastArithSlow_op_pre_dec):
+ (JSC::JIT::compileFastArith_op_add):
+ (JSC::JIT::compileFastArith_op_mul):
+ (JSC::JIT::compileFastArith_op_sub):
+ (JSC::JIT::compileBinaryArithOpSlowCase):
+ (JSC::JIT::compileFastArithSlow_op_add):
+ (JSC::JIT::compileFastArithSlow_op_mul):
+ * jit/JITCall.cpp:
+ (JSC::JIT::compileOpCall):
+ (JSC::):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::compileGetByIdHotPath):
+ (JSC::JIT::compilePutByIdHotPath):
+ (JSC::JIT::compileGetByIdSlowCase):
+ (JSC::JIT::compilePutByIdSlowCase):
+ * jit/JITStubs.cpp:
+ (JSC::JITStubs::cti_op_resolve_func):
+ (JSC::JITStubs::cti_op_resolve_with_base):
+
+2009-05-08 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Maciej Stachowiak.
+
+ Add a new opcode jnlesseq, and optimize its compilation in the JIT using
+ techniques similar to what were used to optimize jnless in r43363.
+
+ This gives a 0.7% speedup on SunSpider, particularly on the tests 3d-cube,
+ control-flow-recursive, date-format-xparb, and string-base64.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::dump): Add support for dumping op_jnlesseq.
+ * bytecode/Opcode.h: Add op_jnlesseq to the list of opcodes.
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::emitJumpIfFalse): Add a peephole optimization
+ for op_jnlesseq when emitting lesseq followed by a jump.
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute): Add case for op_jnlesseq.
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass): Add case for op_jnlesseq.
+ (JSC::JIT::privateCompileSlowCases): Add case for op_jnlesseq.
+ * jit/JIT.h:
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::compileFastArith_op_jnlesseq): Added.
+ (JSC::JIT::compileFastArithSlow_op_jnlesseq): Added.
+ * jit/JITStubs.cpp:
+ (JSC::JITStubs::cti_op_jlesseq): Added.
+ * jit/JITStubs.h:
+
+2009-05-08 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ - fix test failures on 64-bit
+
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::compileFastArithSlow_op_jnless): Avoid accidentaly treating an
+ immediate int as an immediate float in the 64-bit value representation.
+
+2009-05-08 Gavin Barraclough <barraclough@apple.com>
+
+ Rubber stamped by Oliver Hunt.
+
+ Removing an empty constructor and an uncalled, empty function seems to be a
+ pretty solid 1% regeression on my machine, so I'm going to put them back.
+ Um. Yeah, this this pretty pointles and makes no sense at all. I officially
+ lose the will to live in 3... 2...
+
+ * bytecode/SamplingTool.cpp:
+ (JSC::SamplingTool::notifyOfScope):
+ * bytecode/SamplingTool.h:
+ (JSC::SamplingTool::~SamplingTool):
+
+2009-05-08 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver "I see lots of ifdefs" Hunt.
+
+ Fix (kinda) for sampling tool breakage. The codeblock sampling tool has become
+ b0rked due to recent changes in native function calling. The initialization of
+ a ScopeNode appears to now occur before the sampling tool (or possibly the
+ interpreter has been brought into existence, wihich leads to crashyness).
+
+ This patch doesn't fix the problem. The crash occurs when tracking a Scope, but
+ we shouldn't need to track scopes when we're just sampling opcodes, not
+ codeblocks. Not retaining Scopes when just opcode sampling will reduce sampling
+ overhead reducing any instrumentation skew, which is a good thing. As a side
+ benefit this patch also gets the opcode sampling going again, albeit in a bit of
+ a lame way. Will come back later with a proper fix from codeblock sampling.
+
+ * JavaScriptCore.exp:
+ * bytecode/SamplingTool.cpp:
+ (JSC::compareLineCountInfoSampling):
+ (JSC::SamplingTool::dump):
+ * bytecode/SamplingTool.h:
+ (JSC::SamplingTool::SamplingTool):
+ * parser/Nodes.cpp:
+ (JSC::ScopeNode::ScopeNode):
+
+2009-05-07 Mark Rowe <mrowe@apple.com>
+
+ Rubber-stamped by Oliver Hunt.
+
+ Fix <https://bugs.webkit.org/show_bug.cgi?id=25640>.
+ Bug 25640: Crash on quit in r43384 nightly build on Leopard w/ Safari 4 beta installed
+
+ Roll out r43366 as it removed symbols that Safari 4 Beta uses.
+
+ * JavaScriptCore.exp:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+ * bytecode/SamplingTool.cpp:
+ (JSC::SamplingThread::start):
+ (JSC::SamplingThread::stop):
+ * bytecode/SamplingTool.h:
+ * wtf/CrossThreadRefCounted.h:
+ (WTF::CrossThreadRefCounted::CrossThreadRefCounted):
+ (WTF::::ref):
+ (WTF::::deref):
+ * wtf/Threading.h:
+ * wtf/ThreadingNone.cpp:
+ * wtf/ThreadingPthreads.cpp:
+ (WTF::threadMapMutex):
+ (WTF::initializeThreading):
+ (WTF::threadMap):
+ (WTF::identifierByPthreadHandle):
+ (WTF::establishIdentifierForPthreadHandle):
+ (WTF::pthreadHandleForIdentifier):
+ (WTF::clearPthreadHandleForIdentifier):
+ (WTF::createThreadInternal):
+ (WTF::waitForThreadCompletion):
+ (WTF::detachThread):
+ (WTF::currentThread):
+ * wtf/ThreadingWin.cpp:
+ (WTF::threadMapMutex):
+ (WTF::initializeThreading):
+ (WTF::threadMap):
+ (WTF::storeThreadHandleByIdentifier):
+ (WTF::threadHandleForIdentifier):
+ (WTF::clearThreadHandleForIdentifier):
+ (WTF::createThreadInternal):
+ (WTF::waitForThreadCompletion):
+ (WTF::detachThread):
+ (WTF::currentThread):
+ * wtf/gtk/ThreadingGtk.cpp:
+ (WTF::threadMapMutex):
+ (WTF::initializeThreading):
+ (WTF::threadMap):
+ (WTF::identifierByGthreadHandle):
+ (WTF::establishIdentifierForThread):
+ (WTF::threadForIdentifier):
+ (WTF::clearThreadForIdentifier):
+ (WTF::createThreadInternal):
+ (WTF::waitForThreadCompletion):
+ (WTF::currentThread):
+ * wtf/qt/ThreadingQt.cpp:
+ (WTF::threadMapMutex):
+ (WTF::threadMap):
+ (WTF::identifierByQthreadHandle):
+ (WTF::establishIdentifierForThread):
+ (WTF::clearThreadForIdentifier):
+ (WTF::threadForIdentifier):
+ (WTF::initializeThreading):
+ (WTF::createThreadInternal):
+ (WTF::waitForThreadCompletion):
+ (WTF::currentThread):
+
+2009-05-07 Gustavo Noronha Silva <gns@gnome.org>
+
+ Suggested by Oliver Hunt.
+
+ Also check for Linux for the special-cased calling convention.
+
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ * wtf/Platform.h:
+
+2009-05-07 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Previously, when appending to an existing string and growing the underlying buffer,
+ we would actually allocate 110% of the required size in order to give us some space
+ to expand into. Now we treat strings differently based on their size:
+
+ Small Strings (up to 4 pages):
+ Expand the allocation size to 112.5% of the amount requested. This is largely sicking
+ to our previous policy, however 112.5% is cheaper to calculate.
+
+ Medium Strings (up to 128 pages):
+ For pages covering multiple pages over-allocation is less of a concern - any unused
+ space will not be paged in if it is not used, so this is purely a VM overhead. For
+ these strings allocate 2x the requested size.
+
+ Large Strings (to infinity and beyond!):
+ Revert to our 112.5% policy - probably best to limit the amount of unused VM we allow
+ any individual string be responsible for.
+
+ Additionally, round small allocations up to a multiple of 16 bytes, and medium and
+ large allocations up to a multiple of page size.
+
+ ~1.5% progression on Sunspider, due to 5% improvement on tagcloud & 15% on validate.
+
+ * runtime/UString.cpp:
+ (JSC::expandedSize):
+
+2009-05-07 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ Fixed a minor sequencing error introduced by recent Parser speedups.
+
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::createNativeThunk): Missed a spot in my last patch.
+
+2009-05-07 Geoffrey Garen <ggaren@apple.com>
+
+ Not reviewed.
+
+ * wtf/Platform.h: Reverted an accidental (and performance-catastrophic)
+ change.
+
+2009-05-07 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ Fixed a minor sequencing error introduced by recent Parser speedups.
+
+ * parser/Parser.cpp:
+ (JSC::Parser::reparseInPlace): Missed a spot in my last patch.
+
+2009-05-07 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ Fixed a minor sequencing error introduced by recent Parser speedups.
+
+ * parser/Parser.cpp:
+ (JSC::Parser::parse):
+ * parser/Parser.h:
+ (JSC::Parser::parse):
+ (JSC::Parser::reparse): Shrink the parsedObjects vector after allocating
+ the root node, to avoid leaving a stray node in the vector, since that's
+ a slight memory leak, and it causes problems during JSGlobalData teardown.
+
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::~JSGlobalData): ASSERT that we're not being torn
+ down while we think we're still parsing, since that would cause lots of
+ bad memory references during our destruction.
+
+2009-05-07 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ Replaced two more macros with references to the JITStackFrame structure.
+
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::restoreArgumentReference):
+ * jit/JITStubs.cpp:
+ (JSC::):
+ * jit/JITStubs.h:
+
+2009-05-07 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Improve native call performance
+
+ Fix the windows build by adding calling convention declarations everywhere,
+ chose fastcall as that seemed most sensible given we were having to declare
+ the convention explicitly. In addition switched to fastcall on mac in the
+ deluded belief that documented fastcall behavior on windows would match
+ actual its actual behavior.
+
+ * API/JSCallbackFunction.h:
+ * API/JSCallbackObject.h:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+ * interpreter/CallFrame.h:
+ (JSC::ExecState::argumentCount):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ * jsc.cpp:
+ (functionPrint):
+ (functionDebug):
+ (functionGC):
+ (functionVersion):
+ (functionRun):
+ (functionLoad):
+ (functionSetSamplingFlags):
+ (functionClearSamplingFlags):
+ (functionReadline):
+ (functionQuit):
+ * runtime/ArrayConstructor.cpp:
+ (JSC::callArrayConstructor):
+ * runtime/ArrayPrototype.cpp:
+ (JSC::arrayProtoFuncToString):
+ (JSC::arrayProtoFuncToLocaleString):
+ (JSC::arrayProtoFuncJoin):
+ (JSC::arrayProtoFuncConcat):
+ (JSC::arrayProtoFuncPop):
+ (JSC::arrayProtoFuncPush):
+ (JSC::arrayProtoFuncReverse):
+ (JSC::arrayProtoFuncShift):
+ (JSC::arrayProtoFuncSlice):
+ (JSC::arrayProtoFuncSort):
+ (JSC::arrayProtoFuncSplice):
+ (JSC::arrayProtoFuncUnShift):
+ (JSC::arrayProtoFuncFilter):
+ (JSC::arrayProtoFuncMap):
+ (JSC::arrayProtoFuncEvery):
+ (JSC::arrayProtoFuncForEach):
+ (JSC::arrayProtoFuncSome):
+ (JSC::arrayProtoFuncReduce):
+ (JSC::arrayProtoFuncReduceRight):
+ (JSC::arrayProtoFuncIndexOf):
+ (JSC::arrayProtoFuncLastIndexOf):
+ * runtime/BooleanConstructor.cpp:
+ (JSC::callBooleanConstructor):
+ * runtime/BooleanPrototype.cpp:
+ (JSC::booleanProtoFuncToString):
+ (JSC::booleanProtoFuncValueOf):
+ * runtime/CallData.h:
+ * runtime/DateConstructor.cpp:
+ (JSC::callDate):
+ (JSC::dateParse):
+ (JSC::dateNow):
+ (JSC::dateUTC):
+ * runtime/DatePrototype.cpp:
+ (JSC::dateProtoFuncToString):
+ (JSC::dateProtoFuncToUTCString):
+ (JSC::dateProtoFuncToDateString):
+ (JSC::dateProtoFuncToTimeString):
+ (JSC::dateProtoFuncToLocaleString):
+ (JSC::dateProtoFuncToLocaleDateString):
+ (JSC::dateProtoFuncToLocaleTimeString):
+ (JSC::dateProtoFuncGetTime):
+ (JSC::dateProtoFuncGetFullYear):
+ (JSC::dateProtoFuncGetUTCFullYear):
+ (JSC::dateProtoFuncToGMTString):
+ (JSC::dateProtoFuncGetMonth):
+ (JSC::dateProtoFuncGetUTCMonth):
+ (JSC::dateProtoFuncGetDate):
+ (JSC::dateProtoFuncGetUTCDate):
+ (JSC::dateProtoFuncGetDay):
+ (JSC::dateProtoFuncGetUTCDay):
+ (JSC::dateProtoFuncGetHours):
+ (JSC::dateProtoFuncGetUTCHours):
+ (JSC::dateProtoFuncGetMinutes):
+ (JSC::dateProtoFuncGetUTCMinutes):
+ (JSC::dateProtoFuncGetSeconds):
+ (JSC::dateProtoFuncGetUTCSeconds):
+ (JSC::dateProtoFuncGetMilliSeconds):
+ (JSC::dateProtoFuncGetUTCMilliseconds):
+ (JSC::dateProtoFuncGetTimezoneOffset):
+ (JSC::dateProtoFuncSetTime):
+ (JSC::dateProtoFuncSetMilliSeconds):
+ (JSC::dateProtoFuncSetUTCMilliseconds):
+ (JSC::dateProtoFuncSetSeconds):
+ (JSC::dateProtoFuncSetUTCSeconds):
+ (JSC::dateProtoFuncSetMinutes):
+ (JSC::dateProtoFuncSetUTCMinutes):
+ (JSC::dateProtoFuncSetHours):
+ (JSC::dateProtoFuncSetUTCHours):
+ (JSC::dateProtoFuncSetDate):
+ (JSC::dateProtoFuncSetUTCDate):
+ (JSC::dateProtoFuncSetMonth):
+ (JSC::dateProtoFuncSetUTCMonth):
+ (JSC::dateProtoFuncSetFullYear):
+ (JSC::dateProtoFuncSetUTCFullYear):
+ (JSC::dateProtoFuncSetYear):
+ (JSC::dateProtoFuncGetYear):
+ * runtime/ErrorConstructor.cpp:
+ (JSC::callErrorConstructor):
+ * runtime/ErrorPrototype.cpp:
+ (JSC::errorProtoFuncToString):
+ * runtime/FunctionConstructor.cpp:
+ (JSC::callFunctionConstructor):
+ * runtime/FunctionPrototype.cpp:
+ (JSC::callFunctionPrototype):
+ (JSC::functionProtoFuncToString):
+ (JSC::functionProtoFuncApply):
+ (JSC::functionProtoFuncCall):
+ * runtime/JSFunction.h:
+ (JSC::JSFunction::nativeFunction):
+ (JSC::JSFunction::setScopeChain):
+ * runtime/JSGlobalObjectFunctions.cpp:
+ (JSC::globalFuncEval):
+ (JSC::globalFuncParseInt):
+ (JSC::globalFuncParseFloat):
+ (JSC::globalFuncIsNaN):
+ (JSC::globalFuncIsFinite):
+ (JSC::globalFuncDecodeURI):
+ (JSC::globalFuncDecodeURIComponent):
+ (JSC::globalFuncEncodeURI):
+ (JSC::globalFuncEncodeURIComponent):
+ (JSC::globalFuncEscape):
+ (JSC::globalFuncUnescape):
+ (JSC::globalFuncJSCPrint):
+ * runtime/JSGlobalObjectFunctions.h:
+ * runtime/MathObject.cpp:
+ (JSC::mathProtoFuncAbs):
+ (JSC::mathProtoFuncACos):
+ (JSC::mathProtoFuncASin):
+ (JSC::mathProtoFuncATan):
+ (JSC::mathProtoFuncATan2):
+ (JSC::mathProtoFuncCeil):
+ (JSC::mathProtoFuncCos):
+ (JSC::mathProtoFuncExp):
+ (JSC::mathProtoFuncFloor):
+ (JSC::mathProtoFuncLog):
+ (JSC::mathProtoFuncMax):
+ (JSC::mathProtoFuncMin):
+ (JSC::mathProtoFuncPow):
+ (JSC::mathProtoFuncRandom):
+ (JSC::mathProtoFuncRound):
+ (JSC::mathProtoFuncSin):
+ (JSC::mathProtoFuncSqrt):
+ (JSC::mathProtoFuncTan):
+ * runtime/NativeErrorConstructor.cpp:
+ (JSC::callNativeErrorConstructor):
+ * runtime/NativeFunctionWrapper.h:
+ * runtime/NumberConstructor.cpp:
+ (JSC::callNumberConstructor):
+ * runtime/NumberPrototype.cpp:
+ (JSC::numberProtoFuncToString):
+ (JSC::numberProtoFuncToLocaleString):
+ (JSC::numberProtoFuncValueOf):
+ (JSC::numberProtoFuncToFixed):
+ (JSC::numberProtoFuncToExponential):
+ (JSC::numberProtoFuncToPrecision):
+ * runtime/ObjectConstructor.cpp:
+ (JSC::callObjectConstructor):
+ * runtime/ObjectPrototype.cpp:
+ (JSC::objectProtoFuncValueOf):
+ (JSC::objectProtoFuncHasOwnProperty):
+ (JSC::objectProtoFuncIsPrototypeOf):
+ (JSC::objectProtoFuncDefineGetter):
+ (JSC::objectProtoFuncDefineSetter):
+ (JSC::objectProtoFuncLookupGetter):
+ (JSC::objectProtoFuncLookupSetter):
+ (JSC::objectProtoFuncPropertyIsEnumerable):
+ (JSC::objectProtoFuncToLocaleString):
+ (JSC::objectProtoFuncToString):
+ * runtime/ObjectPrototype.h:
+ * runtime/RegExpConstructor.cpp:
+ (JSC::callRegExpConstructor):
+ * runtime/RegExpObject.cpp:
+ (JSC::callRegExpObject):
+ * runtime/RegExpPrototype.cpp:
+ (JSC::regExpProtoFuncTest):
+ (JSC::regExpProtoFuncExec):
+ (JSC::regExpProtoFuncCompile):
+ (JSC::regExpProtoFuncToString):
+ * runtime/StringConstructor.cpp:
+ (JSC::stringFromCharCode):
+ (JSC::callStringConstructor):
+ * runtime/StringPrototype.cpp:
+ (JSC::stringProtoFuncReplace):
+ (JSC::stringProtoFuncToString):
+ (JSC::stringProtoFuncCharAt):
+ (JSC::stringProtoFuncCharCodeAt):
+ (JSC::stringProtoFuncConcat):
+ (JSC::stringProtoFuncIndexOf):
+ (JSC::stringProtoFuncLastIndexOf):
+ (JSC::stringProtoFuncMatch):
+ (JSC::stringProtoFuncSearch):
+ (JSC::stringProtoFuncSlice):
+ (JSC::stringProtoFuncSplit):
+ (JSC::stringProtoFuncSubstr):
+ (JSC::stringProtoFuncSubstring):
+ (JSC::stringProtoFuncToLowerCase):
+ (JSC::stringProtoFuncToUpperCase):
+ (JSC::stringProtoFuncLocaleCompare):
+ (JSC::stringProtoFuncBig):
+ (JSC::stringProtoFuncSmall):
+ (JSC::stringProtoFuncBlink):
+ (JSC::stringProtoFuncBold):
+ (JSC::stringProtoFuncFixed):
+ (JSC::stringProtoFuncItalics):
+ (JSC::stringProtoFuncStrike):
+ (JSC::stringProtoFuncSub):
+ (JSC::stringProtoFuncSup):
+ (JSC::stringProtoFuncFontcolor):
+ (JSC::stringProtoFuncFontsize):
+ (JSC::stringProtoFuncAnchor):
+ (JSC::stringProtoFuncLink):
+ * wtf/Platform.h:
+
+2009-05-07 Geoffrey Garen <ggaren@apple.com>
+
+ Not reviewed.
+
+ Rolled out a portion of r43352 because it broke 64bit.
+
+ * jit/JITStubs.h:
+
+2009-05-07 Kevin Ollivier <kevino@theolliviers.com>
+
+ Build fix for functions reaturning ThreadIdentifier.
+
+ * wtf/ThreadingNone.cpp:
+ (WTF::createThreadInternal):
+ (WTF::currentThread):
+
+2009-05-07 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by John Honeycutt.
+
+ - enable optimization case im the last patch that I accidentally had disabled.
+
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::compileFastArithSlow_op_jnless):
+
+2009-05-07 Dmitry Titov <dimich@chromium.org>
+
+ Attempt to fix Win build.
+
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::compileFastArithSlow_op_jnless):
+
+2009-05-07 Dmitry Titov <dimich@chromium.org>
+
+ Reviewed by Alexey Proskuryakov and Adam Roben.
+
+ https://bugs.webkit.org/show_bug.cgi?id=25348
+ Change WTF::ThreadIdentifier to be an actual (but wrapped) thread id, remove ThreadMap.
+
+ * wtf/Threading.h:
+ (WTF::ThreadIdentifier::ThreadIdentifier):
+ (WTF::ThreadIdentifier::isValid):
+ (WTF::ThreadIdentifier::invalidate):
+ (WTF::ThreadIdentifier::platformId):
+ ThreadIdentifier is now a class, containing a PlatformThreadIdentifier and
+ methods that are used across the code on thread ids: construction, comparisons,
+ check for 'valid' state etc. '0' is used as invalid id, which happens to just work
+ with all platform-specific thread id implementations.
+
+ All the following files repeatedly reflect the new ThreadIdentifier for each platform.
+ We remove ThreadMap and threadMapMutex from all of them, remove the functions that
+ populated/searched/cleared the map and add platform-specific comparison operators
+ for ThreadIdentifier.
+
+ * wtf/gtk/ThreadingGtk.cpp:
+ (WTF::ThreadIdentifier::operator==):
+ (WTF::ThreadIdentifier::operator!=):
+ (WTF::initializeThreading):
+ (WTF::createThreadInternal):
+ (WTF::waitForThreadCompletion):
+ (WTF::currentThread):
+
+ * wtf/ThreadingNone.cpp:
+ (WTF::ThreadIdentifier::operator==):
+ (WTF::ThreadIdentifier::operator!=):
+
+ * wtf/ThreadingPthreads.cpp:
+ (WTF::ThreadIdentifier::operator==):
+ (WTF::ThreadIdentifier::operator!=):
+ (WTF::initializeThreading):
+ (WTF::createThreadInternal):
+ (WTF::waitForThreadCompletion):
+ (WTF::detachThread):
+ (WTF::currentThread):
+
+ * wtf/qt/ThreadingQt.cpp:
+ (WTF::ThreadIdentifier::operator==):
+ (WTF::ThreadIdentifier::operator!=):
+ (WTF::initializeThreading):
+ (WTF::createThreadInternal):
+ (WTF::waitForThreadCompletion):
+ (WTF::currentThread):
+
+ * wtf/ThreadingWin.cpp:
+ (WTF::ThreadIdentifier::operator==):
+ (WTF::ThreadIdentifier::operator!=):
+ (WTF::initializeThreading):
+ (WTF::createThreadInternal): All the platforms (except Windows) used a sequential
+ counter as a thread ID and mapped it into platform ID. Windows was using native thread
+ id and mapped it into thread handle. Since we can always obtain a thread handle
+ by thread id, createThread now closes the handle.
+ (WTF::waitForThreadCompletion): obtains another one using OpenThread(id) API. If can not obtain a handle,
+ it means the thread already exited.
+ (WTF::detachThread):
+ (WTF::currentThread):
+ (WTF::detachThreadDeprecated): old function, renamed (for Win Safari 4 beta which uses it for now).
+ (WTF::waitForThreadCompletionDeprecated): same.
+ (WTF::currentThreadDeprecated): same.
+ (WTF::createThreadDeprecated): same.
+
+ * bytecode/SamplingTool.h:
+ * bytecode/SamplingTool.cpp: Use DEFINE_STATIC_LOCAL for a static ThreadIdentifier variable, to avoid static constructor.
+
+ * JavaScriptCore.exp: export lists - updated the WTF threading functions decorated names
+ since they now take a different type as a parameter.
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: ditto for Windows, plus added "deprecated" functions
+ that take old parameter type - turns out public beta of Safari 4 uses those, so they need to be kept along for a while.
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: ditto.
+
+2009-05-07 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ - optimize various cases of branch-fused less
+
+ 1% speedup on SunSpider overall
+ 13% speedup on math-cordic
+
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ op_loop_if_less: Optimize case of constant as first operand, just as case of constant as
+ second operand.
+ op_jnless: Factored out into compileFastArith_op_jnless.
+ (JSC::JIT::privateCompileSlowCases):
+ op_jnless: Factored out into compileFastArithSlow_op_jnless.
+ * jit/JIT.h:
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::compileFastArith_op_jnless): Factored out from main compile loop.
+ - Generate inline code for comparison of constant immediate int as first operand to another
+ immediate int, as for loop_if_less
+
+ (JSC::JIT::compileFastArithSlow_op_jnless):
+ - Generate inline code for comparing two floating point numbers.
+ - Generate code for both cases of comparing a floating point number to a constant immediate
+ int.
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::dump): Fix dumping of op_jnless (tangentially related bugfix).
+
+2009-05-07 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Added the return address of a stub function to the JITStackFrame abstraction.
+
+ * jit/JIT.cpp:
+ * jit/JIT.h:
+ * jit/JITStubs.cpp:
+ (JSC::):
+ (JSC::StackHack::StackHack):
+ (JSC::StackHack::~StackHack):
+ (JSC::returnToThrowTrampoline):
+ (JSC::JITStubs::cti_op_convert_this):
+ (JSC::JITStubs::cti_op_end):
+ (JSC::JITStubs::cti_op_add):
+ (JSC::JITStubs::cti_op_pre_inc):
+ (JSC::JITStubs::cti_timeout_check):
+ (JSC::JITStubs::cti_register_file_check):
+ (JSC::JITStubs::cti_op_loop_if_less):
+ (JSC::JITStubs::cti_op_loop_if_lesseq):
+ (JSC::JITStubs::cti_op_new_object):
+ (JSC::JITStubs::cti_op_put_by_id_generic):
+ (JSC::JITStubs::cti_op_get_by_id_generic):
+ (JSC::JITStubs::cti_op_put_by_id):
+ (JSC::JITStubs::cti_op_put_by_id_second):
+ (JSC::JITStubs::cti_op_put_by_id_fail):
+ (JSC::JITStubs::cti_op_get_by_id):
+ (JSC::JITStubs::cti_op_get_by_id_second):
+ (JSC::JITStubs::cti_op_get_by_id_self_fail):
+ (JSC::JITStubs::cti_op_get_by_id_proto_list):
+ (JSC::JITStubs::cti_op_get_by_id_proto_list_full):
+ (JSC::JITStubs::cti_op_get_by_id_proto_fail):
+ (JSC::JITStubs::cti_op_get_by_id_array_fail):
+ (JSC::JITStubs::cti_op_get_by_id_string_fail):
+ (JSC::JITStubs::cti_op_instanceof):
+ (JSC::JITStubs::cti_op_del_by_id):
+ (JSC::JITStubs::cti_op_mul):
+ (JSC::JITStubs::cti_op_new_func):
+ (JSC::JITStubs::cti_op_call_JSFunction):
+ (JSC::JITStubs::cti_op_call_arityCheck):
+ (JSC::JITStubs::cti_vm_dontLazyLinkCall):
+ (JSC::JITStubs::cti_vm_lazyLinkCall):
+ (JSC::JITStubs::cti_op_push_activation):
+ (JSC::JITStubs::cti_op_call_NotJSFunction):
+ (JSC::JITStubs::cti_op_create_arguments):
+ (JSC::JITStubs::cti_op_create_arguments_no_params):
+ (JSC::JITStubs::cti_op_tear_off_activation):
+ (JSC::JITStubs::cti_op_tear_off_arguments):
+ (JSC::JITStubs::cti_op_profile_will_call):
+ (JSC::JITStubs::cti_op_profile_did_call):
+ (JSC::JITStubs::cti_op_ret_scopeChain):
+ (JSC::JITStubs::cti_op_new_array):
+ (JSC::JITStubs::cti_op_resolve):
+ (JSC::JITStubs::cti_op_construct_JSConstruct):
+ (JSC::JITStubs::cti_op_construct_NotJSConstruct):
+ (JSC::JITStubs::cti_op_get_by_val):
+ (JSC::JITStubs::cti_op_get_by_val_string):
+ (JSC::JITStubs::cti_op_get_by_val_byte_array):
+ (JSC::JITStubs::cti_op_resolve_func):
+ (JSC::JITStubs::cti_op_sub):
+ (JSC::JITStubs::cti_op_put_by_val):
+ (JSC::JITStubs::cti_op_put_by_val_array):
+ (JSC::JITStubs::cti_op_put_by_val_byte_array):
+ (JSC::JITStubs::cti_op_lesseq):
+ (JSC::JITStubs::cti_op_loop_if_true):
+ (JSC::JITStubs::cti_op_load_varargs):
+ (JSC::JITStubs::cti_op_negate):
+ (JSC::JITStubs::cti_op_resolve_base):
+ (JSC::JITStubs::cti_op_resolve_skip):
+ (JSC::JITStubs::cti_op_resolve_global):
+ (JSC::JITStubs::cti_op_div):
+ (JSC::JITStubs::cti_op_pre_dec):
+ (JSC::JITStubs::cti_op_jless):
+ (JSC::JITStubs::cti_op_not):
+ (JSC::JITStubs::cti_op_jtrue):
+ (JSC::JITStubs::cti_op_post_inc):
+ (JSC::JITStubs::cti_op_eq):
+ (JSC::JITStubs::cti_op_lshift):
+ (JSC::JITStubs::cti_op_bitand):
+ (JSC::JITStubs::cti_op_rshift):
+ (JSC::JITStubs::cti_op_bitnot):
+ (JSC::JITStubs::cti_op_resolve_with_base):
+ (JSC::JITStubs::cti_op_new_func_exp):
+ (JSC::JITStubs::cti_op_mod):
+ (JSC::JITStubs::cti_op_less):
+ (JSC::JITStubs::cti_op_neq):
+ (JSC::JITStubs::cti_op_post_dec):
+ (JSC::JITStubs::cti_op_urshift):
+ (JSC::JITStubs::cti_op_bitxor):
+ (JSC::JITStubs::cti_op_new_regexp):
+ (JSC::JITStubs::cti_op_bitor):
+ (JSC::JITStubs::cti_op_call_eval):
+ (JSC::JITStubs::cti_op_throw):
+ (JSC::JITStubs::cti_op_get_pnames):
+ (JSC::JITStubs::cti_op_next_pname):
+ (JSC::JITStubs::cti_op_push_scope):
+ (JSC::JITStubs::cti_op_pop_scope):
+ (JSC::JITStubs::cti_op_typeof):
+ (JSC::JITStubs::cti_op_is_undefined):
+ (JSC::JITStubs::cti_op_is_boolean):
+ (JSC::JITStubs::cti_op_is_number):
+ (JSC::JITStubs::cti_op_is_string):
+ (JSC::JITStubs::cti_op_is_object):
+ (JSC::JITStubs::cti_op_is_function):
+ (JSC::JITStubs::cti_op_stricteq):
+ (JSC::JITStubs::cti_op_to_primitive):
+ (JSC::JITStubs::cti_op_strcat):
+ (JSC::JITStubs::cti_op_nstricteq):
+ (JSC::JITStubs::cti_op_to_jsnumber):
+ (JSC::JITStubs::cti_op_in):
+ (JSC::JITStubs::cti_op_push_new_scope):
+ (JSC::JITStubs::cti_op_jmp_scopes):
+ (JSC::JITStubs::cti_op_put_by_index):
+ (JSC::JITStubs::cti_op_switch_imm):
+ (JSC::JITStubs::cti_op_switch_char):
+ (JSC::JITStubs::cti_op_switch_string):
+ (JSC::JITStubs::cti_op_del_by_val):
+ (JSC::JITStubs::cti_op_put_getter):
+ (JSC::JITStubs::cti_op_put_setter):
+ (JSC::JITStubs::cti_op_new_error):
+ (JSC::JITStubs::cti_op_debug):
+ (JSC::JITStubs::cti_vm_throw):
+ * jit/JITStubs.h:
+ (JSC::JITStackFrame::returnAddressSlot):
+
+2009-05-07 Darin Adler <darin@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ * parser/Lexer.cpp:
+ (JSC::Lexer::lex): Fix missing braces. This would make us always
+ take the slower case for string parsing and Visual Studio correctly
+ noticed unreachable code.
+
+2009-05-07 Darin Adler <darin@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Bug 25589: goto instead of state machine in lexer
+ https://bugs.webkit.org/show_bug.cgi?id=25589
+
+ SunSpider is 0.8% faster.
+
+ * parser/Lexer.cpp:
+ (JSC::Lexer::currentCharacter): Added.
+ (JSC::Lexer::currentOffset): Changed to call currentCharacter for clarity.
+ (JSC::Lexer::setCode): Removed code to set now-obsolete m_skipLineEnd.
+ (JSC::Lexer::shiftLineTerminator): Added. Handles line numbers and the
+ two-character line terminators.
+ (JSC::Lexer::makeIdentifier): Changed to take characters and length rather
+ than a vector, since we now make these directly out of the source buffer
+ when possible.
+ (JSC::Lexer::lastTokenWasRestrKeyword): Added.
+ (JSC::isNonASCIIIdentStart): Broke out the non-inline part.
+ (JSC::isIdentStart): Moved here.
+ (JSC::isNonASCIIIdentPart): Broke out the non-inline part.
+ (JSC::isIdentPart): Moved here.
+ (JSC::singleEscape): Moved here, and removed some unneeded cases.
+ (JSC::Lexer::record8): Moved here.
+ (JSC::Lexer::record16): Moved here.
+ (JSC::Lexer::lex): Rewrote this whole function to use goto and not use
+ a state machine. Got rid of most of the local variables. Also rolled the
+ matchPunctuator function in here.
+ (JSC::Lexer::scanRegExp): Changed to use the new version of isLineTerminator.
+ Clear m_buffer16 after using it instead of before.
+
+ * parser/Lexer.h: Removed State enum, setDone function, nextLine function,
+ lookupKeywordFunction, one of the isLineTerminator functions, m_done data member,
+ m_skipLineEnd data member, and m_state data member. Added shiftLineTerminator
+ function, currentCharacter function, and changed the arguments to the makeIdentifier
+ function. Removed one branch from the isLineTerminator function.
+
+ * runtime/StringPrototype.cpp:
+ (JSC::stringProtoFuncReplace): Streamlined the case where we don't replace anything.
+
+2009-05-07 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Removed a few more special constants, and replaced them with uses of
+ the JITStackFrame struct.
+
+ Removed one of the two possible definitions of VoidPtrPair. The Mac
+ definition was more elegant, but SunSpider doesn't think it's any
+ faster, and it's net less elegant to have two ways of doing things.
+
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ (JSC::JIT::privateCompile):
+ * jit/JITStubs.h:
+ (JSC::):
+
+2009-05-07 Darin Adler <darin@apple.com>
+
+ * runtime/ScopeChain.h:
+ (JSC::ScopeChainNode::~ScopeChainNode): Tweak formatting.
+
+2009-05-07 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Reviewed by Tor Arne Vestbø.
+
+ Fix the build thread stack base determination build on Symbian,
+ by moving the code block before PLATFORM(UNIX), which is also
+ enabled on Symbian builds.
+
+ * runtime/Collector.cpp:
+ (JSC::currentThreadStackBase):
+
+2009-05-07 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Fix crash due to incorrectly using an invalid scopechain
+
+ stringProtoFuncReplace was checking for an exception on a CachedCall
+ by asking for the cached callframes exception. Unfortunately this
+ could crash in certain circumstances as CachedCall does not guarantee
+ a valid callframe following a call. Even more unfortunately the check
+ was entirely unnecessary as there is only a single exception slot per
+ global data, so it was already checked via the initial exec->hadException()
+ check.
+
+ To make bugs like this more obvious, i've added a debug only destructor
+ to ScopeChainNode that 0's all of its fields. This exposed a crash in
+ the standard javascriptcore tests.
+
+ * runtime/ScopeChain.h:
+ (JSC::ScopeChainNode::~ScopeChainNode):
+ (JSC::ScopeChain::~ScopeChain):
+ * runtime/StringPrototype.cpp:
+ (JSC::stringProtoFuncReplace):
+
+2009-05-07 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Enable op_strcat across += assignments. This patch allows the lhs of a read/modify node
+ to be included within the concatenation operation, and also modifies the implementation
+ of the concatenation to attempt to reuse and cat onto the leftmost string, rather than
+ always allocating a new empty output string to copy into (as was previously the behaviour).
+
+ ~0.5% progression, due to a 3%-3.5% progression on the string tests (particularly validate).
+
+ * parser/Nodes.cpp:
+ (JSC::BinaryOpNode::emitStrcat):
+ (JSC::emitReadModifyAssignment):
+ (JSC::ReadModifyResolveNode::emitBytecode):
+ (JSC::ReadModifyDotNode::emitBytecode):
+ (JSC::ReadModifyBracketNode::emitBytecode):
+ * parser/Nodes.h:
+ * runtime/Operations.h:
+ (JSC::concatenateStrings):
+ * runtime/UString.cpp:
+ (JSC::UString::reserveCapacity):
+ * runtime/UString.h:
+
+2009-05-07 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Reviewed by Oliver Hunt.
+
+ Fix the build on Windows without JIT: interpreter/RegisterFile.h needs
+ roundUpAllocationSize, which is protected by #if ENABLED(ASSEMBLER).
+ Moved the #ifdef down and always offer the function.
+
+ * jit/ExecutableAllocator.h:
+
+2009-05-06 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Gavin "++" Barraclough.
+
+ Added some abstraction around the JIT stub calling convention by creating
+ a struct to represent the persistent stack frame JIT code shares with
+ JIT stubs.
+
+ SunSpider reports no change.
+
+ * jit/JIT.h:
+ * jit/JITStubs.cpp:
+ (JSC::JITStubs::cti_op_convert_this):
+ (JSC::JITStubs::cti_op_end):
+ (JSC::JITStubs::cti_op_add):
+ (JSC::JITStubs::cti_op_pre_inc):
+ (JSC::JITStubs::cti_timeout_check):
+ (JSC::JITStubs::cti_register_file_check):
+ (JSC::JITStubs::cti_op_loop_if_less):
+ (JSC::JITStubs::cti_op_loop_if_lesseq):
+ (JSC::JITStubs::cti_op_new_object):
+ (JSC::JITStubs::cti_op_put_by_id_generic):
+ (JSC::JITStubs::cti_op_get_by_id_generic):
+ (JSC::JITStubs::cti_op_put_by_id):
+ (JSC::JITStubs::cti_op_put_by_id_second):
+ (JSC::JITStubs::cti_op_put_by_id_fail):
+ (JSC::JITStubs::cti_op_get_by_id):
+ (JSC::JITStubs::cti_op_get_by_id_second):
+ (JSC::JITStubs::cti_op_get_by_id_self_fail):
+ (JSC::JITStubs::cti_op_get_by_id_proto_list):
+ (JSC::JITStubs::cti_op_get_by_id_proto_list_full):
+ (JSC::JITStubs::cti_op_get_by_id_proto_fail):
+ (JSC::JITStubs::cti_op_get_by_id_array_fail):
+ (JSC::JITStubs::cti_op_get_by_id_string_fail):
+ (JSC::JITStubs::cti_op_instanceof):
+ (JSC::JITStubs::cti_op_del_by_id):
+ (JSC::JITStubs::cti_op_mul):
+ (JSC::JITStubs::cti_op_new_func):
+ (JSC::JITStubs::cti_op_call_JSFunction):
+ (JSC::JITStubs::cti_op_call_arityCheck):
+ (JSC::JITStubs::cti_vm_dontLazyLinkCall):
+ (JSC::JITStubs::cti_vm_lazyLinkCall):
+ (JSC::JITStubs::cti_op_push_activation):
+ (JSC::JITStubs::cti_op_call_NotJSFunction):
+ (JSC::JITStubs::cti_op_create_arguments):
+ (JSC::JITStubs::cti_op_create_arguments_no_params):
+ (JSC::JITStubs::cti_op_tear_off_activation):
+ (JSC::JITStubs::cti_op_tear_off_arguments):
+ (JSC::JITStubs::cti_op_profile_will_call):
+ (JSC::JITStubs::cti_op_profile_did_call):
+ (JSC::JITStubs::cti_op_ret_scopeChain):
+ (JSC::JITStubs::cti_op_new_array):
+ (JSC::JITStubs::cti_op_resolve):
+ (JSC::JITStubs::cti_op_construct_JSConstruct):
+ (JSC::JITStubs::cti_op_construct_NotJSConstruct):
+ (JSC::JITStubs::cti_op_get_by_val):
+ (JSC::JITStubs::cti_op_get_by_val_string):
+ (JSC::JITStubs::cti_op_get_by_val_byte_array):
+ (JSC::JITStubs::cti_op_resolve_func):
+ (JSC::JITStubs::cti_op_sub):
+ (JSC::JITStubs::cti_op_put_by_val):
+ (JSC::JITStubs::cti_op_put_by_val_array):
+ (JSC::JITStubs::cti_op_put_by_val_byte_array):
+ (JSC::JITStubs::cti_op_lesseq):
+ (JSC::JITStubs::cti_op_loop_if_true):
+ (JSC::JITStubs::cti_op_load_varargs):
+ (JSC::JITStubs::cti_op_negate):
+ (JSC::JITStubs::cti_op_resolve_base):
+ (JSC::JITStubs::cti_op_resolve_skip):
+ (JSC::JITStubs::cti_op_resolve_global):
+ (JSC::JITStubs::cti_op_div):
+ (JSC::JITStubs::cti_op_pre_dec):
+ (JSC::JITStubs::cti_op_jless):
+ (JSC::JITStubs::cti_op_not):
+ (JSC::JITStubs::cti_op_jtrue):
+ (JSC::JITStubs::cti_op_post_inc):
+ (JSC::JITStubs::cti_op_eq):
+ (JSC::JITStubs::cti_op_lshift):
+ (JSC::JITStubs::cti_op_bitand):
+ (JSC::JITStubs::cti_op_rshift):
+ (JSC::JITStubs::cti_op_bitnot):
+ (JSC::JITStubs::cti_op_resolve_with_base):
+ (JSC::JITStubs::cti_op_new_func_exp):
+ (JSC::JITStubs::cti_op_mod):
+ (JSC::JITStubs::cti_op_less):
+ (JSC::JITStubs::cti_op_neq):
+ (JSC::JITStubs::cti_op_post_dec):
+ (JSC::JITStubs::cti_op_urshift):
+ (JSC::JITStubs::cti_op_bitxor):
+ (JSC::JITStubs::cti_op_new_regexp):
+ (JSC::JITStubs::cti_op_bitor):
+ (JSC::JITStubs::cti_op_call_eval):
+ (JSC::JITStubs::cti_op_throw):
+ (JSC::JITStubs::cti_op_get_pnames):
+ (JSC::JITStubs::cti_op_next_pname):
+ (JSC::JITStubs::cti_op_push_scope):
+ (JSC::JITStubs::cti_op_pop_scope):
+ (JSC::JITStubs::cti_op_typeof):
+ (JSC::JITStubs::cti_op_is_undefined):
+ (JSC::JITStubs::cti_op_is_boolean):
+ (JSC::JITStubs::cti_op_is_number):
+ (JSC::JITStubs::cti_op_is_string):
+ (JSC::JITStubs::cti_op_is_object):
+ (JSC::JITStubs::cti_op_is_function):
+ (JSC::JITStubs::cti_op_stricteq):
+ (JSC::JITStubs::cti_op_to_primitive):
+ (JSC::JITStubs::cti_op_strcat):
+ (JSC::JITStubs::cti_op_nstricteq):
+ (JSC::JITStubs::cti_op_to_jsnumber):
+ (JSC::JITStubs::cti_op_in):
+ (JSC::JITStubs::cti_op_push_new_scope):
+ (JSC::JITStubs::cti_op_jmp_scopes):
+ (JSC::JITStubs::cti_op_put_by_index):
+ (JSC::JITStubs::cti_op_switch_imm):
+ (JSC::JITStubs::cti_op_switch_char):
+ (JSC::JITStubs::cti_op_switch_string):
+ (JSC::JITStubs::cti_op_del_by_val):
+ (JSC::JITStubs::cti_op_put_getter):
+ (JSC::JITStubs::cti_op_put_setter):
+ (JSC::JITStubs::cti_op_new_error):
+ (JSC::JITStubs::cti_op_debug):
+ (JSC::JITStubs::cti_vm_throw):
+ * jit/JITStubs.h:
+ (JSC::):
+
+2009-05-06 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Maciej Stachowiak & Darin Adler.
+
+ Improve string concatenation (as coded in JS as a sequence of adds).
+
+ Detect patterns corresponding to string concatenation, and change the bytecode
+ generation to emit a new op_strcat instruction. By handling the full set of
+ additions within a single function we do not need allocate JSString wrappers
+ for intermediate results, and we can calculate the size of the output string
+ prior to allocating storage, in order to prevent reallocation of the buffer.
+
+ 1.5%-2% progression on Sunspider, largely due to a 30% progression on date-format-xparb.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::dump):
+ Add new opcodes.
+ * bytecode/Opcode.h:
+ Add new opcodes.
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::emitStrcat):
+ (JSC::BytecodeGenerator::emitToPrimitive):
+ Add generation of new opcodes.
+ * bytecompiler/BytecodeGenerator.h:
+ Add generation of new opcodes.
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+ Add implmentation of new opcodes.
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ (JSC::JIT::privateCompileSlowCases):
+ Add implmentation of new opcodes.
+ * jit/JITStubs.cpp:
+ (JSC::JITStubs::cti_op_to_primitive):
+ (JSC::JITStubs::cti_op_strcat):
+ Add implmentation of new opcodes.
+ * jit/JITStubs.h:
+ Add implmentation of new opcodes.
+ * parser/Nodes.cpp:
+ (JSC::BinaryOpNode::emitStrcat):
+ (JSC::BinaryOpNode::emitBytecode):
+ (JSC::ReadModifyResolveNode::emitBytecode):
+ Add generation of new opcodes.
+ * parser/Nodes.h:
+ (JSC::ExpressionNode::):
+ (JSC::AddNode::):
+ Add methods to allow identification of add nodes.
+ * parser/ResultType.h:
+ (JSC::ResultType::definitelyIsString):
+ (JSC::ResultType::forAdd):
+ Fix error in detection of adds that will produce string results.
+ * runtime/Operations.h:
+ (JSC::concatenateStrings):
+ Add implmentation of new opcodes.
+ * runtime/UString.cpp:
+ (JSC::UString::appendNumeric):
+ Add methods to append numbers to an existing string.
+ * runtime/UString.h:
+ (JSC::UString::Rep::createEmptyBuffer):
+ (JSC::UString::BaseString::BaseString):
+ Add support for creating an empty string with a non-zero capacity available in the BaseString.
+
+2009-05-06 Darin Adler <darin@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Made RefCounted::m_refCount private.
+
+ * runtime/Structure.h: Removed addressOfCount.
+ * wtf/RefCounted.h: Made m_refCount private.
+ Added addressOfCount.
+
+2009-05-06 Darin Adler <darin@apple.com>
+
+ Fixed assertion seen a lot!
+
+ * parser/Nodes.cpp:
+ (JSC::FunctionBodyNode::~FunctionBodyNode): Removed now-bogus assertion.
+
+2009-05-06 Darin Adler <darin@apple.com>
+
+ Working with Sam Weinig.
+
+ Redo parse tree constructor optimization without breaking the Windows
+ build the way I did yesterday. The previous try broke the build by adding
+ an include of Lexer.h and all its dependencies that had to work outside
+ the JavaScriptCore project.
+
+ * GNUmakefile.am: Added NodeConstructors.h.
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Ditto.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops:
+ Removed byteocde directory -- we no longer are trying to include Lexer.h
+ outside JavaScriptCore.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj: Change SegmentedVector.h
+ and Lexer.h back to internal files. Added NodeConstructors.h.
+
+ * parser/Grammar.y: Added include of NodeConstructors.h.
+ Changed use of ConstDeclNode to use public functions.
+
+ * parser/NodeConstructors.h: Copied from parser/Nodes.h.
+ Just contains the inlined constructors now.
+
+ * parser/Nodes.cpp: Added include of NodeConstructors.h.
+ Moved node constructors into the header.
+ (JSC::FunctionBodyNode::FunctionBodyNode): Removed m_refCount
+ initialization.
+
+ * parser/Nodes.h: Removed all the constructor definitions, and also
+ removed the JSC_FAST_CALL from them since these are all inlined, so the
+ calling convention is irrelevant. Made more things private. Used a data
+ member for operator opcodes instead of a virtual function. Removed the
+ special FunctionBodyNode::ref/deref functions since the default functions
+ are now just as fast.
+
+ * runtime/FunctionConstructor.cpp:
+ (JSC::extractFunctionBody): Fixed types here so we don't typecast until
+ after we do type checking.
+
+2009-05-06 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Reviewed by Ariya Hidayat.
+
+ Fix the Qt build on Windows.
+
+ * JavaScriptCore.pri: Define BUILDING_JavaScriptCore/WTF to get the meaning
+ of the JS_EXPORTDATA macros correct
+
+2009-05-06 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Reviewed by Ariya Hidayat.
+
+ Enable the JIT for the Qt build on Windows.
+
+ * JavaScriptCore.pri:
+
+2009-05-06 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Reviewed by Tor Arne Vestbø.
+
+ Tweak JavaScriptCore.pri for being able to override the generated sources dir for the
+ generated_files target.
+
+ * JavaScriptCore.pri:
+
+2009-05-06 Tor Arne Vestbø <tor.arne.vestbo@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Build QtWebKit as a framework on Mac
+
+ This implies both debug and release build by default, unless
+ one of the --debug or --release config options are passed to
+ the build-webkit script.
+
+ Frameworks can be disabled by passing CONFIG+=webkit_no_framework
+ to the build-webkit script.
+
+ To be able to build both debug and release targets in parallel
+ we have to use separate output directories for the generated
+ sources, which is not optimal, but required to avoid race conditions.
+
+ An optimization would be to only require this spit-up on Mac.
+
+ * JavaScriptCore.pri:
+ * JavaScriptCore.pro:
+ * jsc.pro:
+
+2009-05-06 Tor Arne Vestbø <tor.arne.vestbo@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Use $$GENERATED_SOURCES_DIR as output when running bison
+
+ A couple of the generators left the bison output file in the source
+ tree, and then moved it into $$GENERATED_SOURCES_DIR, which did not
+ work well when building release and debug configurations in parallel.
+
+ * JavaScriptCore.pri:
+
+2009-05-05 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Simplified a bit of codegen.
+
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+
+2009-05-05 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ Moved all the JIT stub related code into one place.
+
+ * jit/JIT.cpp:
+ * jit/JIT.h:
+ * jit/JITCode.h:
+ * jit/JITStubs.cpp:
+ (JSC::):
+ * jit/JITStubs.h:
+
+2009-05-05 Sam Weinig <sam@webkit.org>
+
+ Try to fix Windows build.
+
+ Move Node constructor to the .cpp file.
+
+ * parser/Nodes.cpp:
+ * parser/Nodes.h:
+
+2009-05-05 Darin Adler <darin@apple.com>
+
+ Try to fix Windows build.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+ Try to fix Mac build.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj: Made SegmentedVector.h private.
+
+2009-05-05 Darin Adler <darin@apple.com>
+
+ Try to fix Mac build.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj: Made Lexer.h private.
+
+2009-05-05 Darin Adler <darin@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Bug 25569: make ParserRefCounted use conventional reference counting
+ https://bugs.webkit.org/show_bug.cgi?id=25569
+
+ SunSpider speedup of about 1.6%.
+
+ * JavaScriptCore.exp: Updated.
+
+ * parser/Nodes.cpp:
+ (JSC::NodeReleaser::releaseAllNodes): ALWAYS_INLINE.
+ (JSC::NodeReleaser::adopt): Ditto.
+ (JSC::ParserRefCounted::ParserRefCounted): Removed most of the code.
+ Add the object to a Vector<RefPtr> that gets cleared after parsing.
+ (JSC::ParserRefCounted::~ParserRefCounted): Removed most of the code.
+
+ * parser/Nodes.h: Made ParserRefCounted inherit from RefCounted and
+ made inline versions of the constructor and destructor. Made the
+ Node constructor inline.
+
+ * parser/Parser.cpp:
+ (JSC::Parser::parse): Call globalData->parserObjects.shrink(0) after
+ parsing, where it used to call ParserRefCounted::deleteNewObjects.
+
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData): Eliminated code to manage the
+ newParserObjects and parserObjectExtraRefCounts.
+ (JSC::JSGlobalData::~JSGlobalData): Ditto.
+
+ * runtime/JSGlobalData.h: Replaced the HashSet and HashCountedSet
+ with a Vector.
+
+ * wtf/PassRefPtr.h:
+ (WTF::PassRefPtr::~PassRefPtr): The most common thing to do with a
+ PassRefPtr in hot code is to pass it and then destroy it once it's
+ set to zero. Help the optimizer by telling it that's true.
+
+2009-05-05 Xan Lopez <xlopez@igalia.com> and Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk>
+
+ Reviewed by Oliver Hunt.
+
+ Disable the NativeFunctionWrapper for all non-Mac ports for now,
+ as it is also crashing on Linux/x86.
+
+ * runtime/NativeFunctionWrapper.h:
+
+2009-05-05 Steve Falkenburg <sfalken@apple.com>
+
+ Fix build.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-05-05 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Expose toThisObject for the DOM Window
+
+ * JavaScriptCore.exp:
+
+2009-05-05 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by NOBODY (Make windows go again until i work out the
+ accursed calling convention).
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * jit/JIT.cpp:
+ * runtime/NativeFunctionWrapper.h:
+
+2009-05-05 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by NOBODY (Fix windows debug builds).
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-05-05 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by NOBODY (Hopefully the last fix).
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2009-05-05 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by NOBODY (Fix the build fix caused by a different build fix).
+
+ * parser/Nodes.cpp:
+ * parser/Nodes.h:
+
+2009-05-05 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by NOBODY (No idea how my changes could have broken these).
+
+ * runtime/DatePrototype.cpp:
+ * runtime/RegExpObject.cpp:
+
+2009-05-05 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by NOBODY (Why should i expect msvc to list all the errors in a file?).
+
+ * parser/Nodes.cpp:
+
+2009-05-05 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by NOBODY (Fix warning, and another missing include).
+
+ * jit/JIT.cpp:
+ * parser/Nodes.h:
+
+2009-05-05 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by NOBODY (More build fixes).
+
+ * runtime/ErrorPrototype.cpp:
+ * runtime/JSGlobalObject.cpp:
+ * runtime/NumberPrototype.cpp:
+ * runtime/ObjectPrototype.cpp:
+ * runtime/StringConstructor.cpp:
+
+2009-05-05 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by NOBODY (Will the fixes never end?).
+
+ * runtime/FunctionPrototype.h:
+ * runtime/Lookup.cpp:
+
+2009-05-05 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by NOBODY (More build fixes).
+
+ * jit/JIT.cpp:
+
+2009-05-05 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by NOBODY (More build fixing).
+
+ * runtime/CallData.h:
+
+2009-05-05 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by NOBODY (Build fix).
+
+ * runtime/ArrayConstructor.cpp:
+ * runtime/BooleanPrototype.cpp:
+ * runtime/DateConstructor.cpp:
+ * runtime/Error.cpp:
+ * runtime/ObjectConstructor.cpp:
+ * runtime/RegExpPrototype.cpp:
+
+2009-05-05 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by NOBODY (Buildfix).
+
+ Add missing file
+
+ * runtime/NativeFunctionWrapper.h: Copied from JavaScriptCore/jit/ExecutableAllocator.cpp.
+
+2009-05-05 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Bug 25559: Improve native function call performance
+ <https://bugs.webkit.org/show_bug.cgi?id=25559>
+
+ In order to cache calls to native functions we now make the standard
+ prototype functions use a small assembly thunk that converts the JS
+ calling convention into the native calling convention. As this is
+ only beneficial in the JIT we use the NativeFunctionWrapper typedef
+ to alternate between PrototypeFunction and JSFunction to keep the
+ code sane. This change from PrototypeFunction to NativeFunctionWrapper
+ is the bulk of this patch.
+
+ * JavaScriptCore.exp:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * assembler/MacroAssemblerX86Common.h:
+ (JSC::MacroAssemblerX86Common::call):
+ * assembler/MacroAssemblerX86_64.h:
+ (JSC::MacroAssemblerX86_64::addPtr):
+ * assembler/X86Assembler.h:
+ (JSC::X86Assembler::leaq_mr):
+ (JSC::X86Assembler::call_m):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::execute):
+ (JSC::Interpreter::prepareForRepeatCall):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ * jit/JIT.h:
+ (JSC::JIT::compileCTIMachineTrampolines):
+ * jit/JITCall.cpp:
+ (JSC::JIT::linkCall):
+ (JSC::JIT::compileOpCallInitializeCallFrame):
+ (JSC::JIT::compileOpCall):
+ * jit/JITCode.h:
+ (JSC::JITCode::operator bool):
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::emitGetFromCallFrameHeader):
+ (JSC::JIT::emitGetFromCallFrameHeader32):
+ * jit/JITStubs.cpp:
+ (JSC::JITStubs::JITStubs):
+ (JSC::JITStubs::cti_op_call_JSFunction):
+ (JSC::JITStubs::cti_vm_dontLazyLinkCall):
+ (JSC::JITStubs::cti_vm_lazyLinkCall):
+ (JSC::JITStubs::cti_op_construct_JSConstruct):
+ * jit/JITStubs.h:
+ (JSC::JITStubs::ctiNativeCallThunk):
+ * jsc.cpp:
+ (GlobalObject::GlobalObject):
+ * parser/Nodes.cpp:
+ (JSC::FunctionBodyNode::FunctionBodyNode):
+ (JSC::FunctionBodyNode::createNativeThunk):
+ (JSC::FunctionBodyNode::generateJITCode):
+ * parser/Nodes.h:
+ (JSC::FunctionBodyNode::):
+ (JSC::FunctionBodyNode::generatedJITCode):
+ (JSC::FunctionBodyNode::jitCode):
+ * profiler/Profiler.cpp:
+ (JSC::Profiler::createCallIdentifier):
+ * runtime/ArgList.h:
+ * runtime/ArrayPrototype.cpp:
+ (JSC::isNumericCompareFunction):
+ * runtime/BooleanPrototype.cpp:
+ (JSC::BooleanPrototype::BooleanPrototype):
+ * runtime/DateConstructor.cpp:
+ (JSC::DateConstructor::DateConstructor):
+ * runtime/ErrorPrototype.cpp:
+ (JSC::ErrorPrototype::ErrorPrototype):
+ * runtime/FunctionPrototype.cpp:
+ (JSC::FunctionPrototype::addFunctionProperties):
+ (JSC::functionProtoFuncToString):
+ * runtime/FunctionPrototype.h:
+ * runtime/JSFunction.cpp:
+ (JSC::JSFunction::JSFunction):
+ (JSC::JSFunction::~JSFunction):
+ (JSC::JSFunction::mark):
+ (JSC::JSFunction::getCallData):
+ (JSC::JSFunction::call):
+ (JSC::JSFunction::argumentsGetter):
+ (JSC::JSFunction::callerGetter):
+ (JSC::JSFunction::lengthGetter):
+ (JSC::JSFunction::getOwnPropertySlot):
+ (JSC::JSFunction::put):
+ (JSC::JSFunction::deleteProperty):
+ (JSC::JSFunction::getConstructData):
+ (JSC::JSFunction::construct):
+ * runtime/JSFunction.h:
+ (JSC::JSFunction::JSFunction):
+ (JSC::JSFunction::setScope):
+ (JSC::JSFunction::scope):
+ (JSC::JSFunction::isHostFunction):
+ (JSC::JSFunction::scopeChain):
+ (JSC::JSFunction::clearScopeChain):
+ (JSC::JSFunction::setScopeChain):
+ (JSC::JSFunction::nativeFunction):
+ (JSC::JSFunction::setNativeFunction):
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::~JSGlobalData):
+ (JSC::JSGlobalData::createNativeThunk):
+ * runtime/JSGlobalData.h:
+ (JSC::JSGlobalData::nativeFunctionThunk):
+ * runtime/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::reset):
+ * runtime/JSGlobalObject.h:
+ * runtime/Lookup.cpp:
+ (JSC::setUpStaticFunctionSlot):
+ * runtime/Lookup.h:
+ * runtime/NumberPrototype.cpp:
+ (JSC::NumberPrototype::NumberPrototype):
+ * runtime/ObjectPrototype.cpp:
+ (JSC::ObjectPrototype::ObjectPrototype):
+ * runtime/RegExpPrototype.cpp:
+ (JSC::RegExpPrototype::RegExpPrototype):
+ * runtime/StringConstructor.cpp:
+ (JSC::StringConstructor::StringConstructor):
+
+2009-05-05 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ For convenience, let the sampling flags tool clear multiple flags at once.
+
+ * jsc.cpp:
+ (GlobalObject::GlobalObject):
+ (functionSetSamplingFlags):
+ (functionClearSamplingFlags):
+
+2009-05-04 Maciej Stachowiak <mjs@apple.com>
+
+ Rubber stamped by Gavin.
+
+ - inline Vector::resize for a ~1.5% speedup on string-tagcloud
+
+ * wtf/Vector.h:
+ (WTF::Vector::resize): Inline
+
+2009-05-03 Steve Falkenburg <sfalken@apple.com>
+
+ Windows build fix.
+
+ * JavaScriptCore.vcproj/JavaScriptCoreSubmit.sln:
+
+2009-05-03 Mark Rowe <mrowe@apple.com>
+
+ Fix the 64-bit build.
+
+ * API/APICast.h:
+ (toJS):
+ (toRef):
+ * runtime/JSNumberCell.cpp:
+ (JSC::jsAPIMangledNumber):
+ * runtime/JSNumberCell.h:
+
+2009-05-02 Sam Weinig <sam@webkit.org>
+
+ Roll JSC API number marshaling back in one last time (I hope).
+
+2009-05-03 Sam Weinig <sam@webkit.org>
+
+ Roll JSC API number marshaling back out. It still breaks windows.
+
+2009-05-03 Sam Weinig <sam@webkit.org>
+
+ Roll JSC API number marshaling back in.
+
+2009-05-02 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Bug 25519: streamline lexer by handling BOMs differently
+ https://bugs.webkit.org/show_bug.cgi?id=25519
+
+ Roughly 1% faster SunSpider.
+
+ * parser/Grammar.y: Tweak formatting a bit.
+
+ * parser/Lexer.cpp:
+ (JSC::Lexer::Lexer): Remove unnnecessary initialization of data members
+ that are set up by setCode.
+ (JSC::Lexer::currentOffset): Added. Used where the old code would look at
+ m_currentOffset.
+ (JSC::Lexer::shift1): Replaces the old shift function. No longer does anything
+ to handle BOM characters.
+ (JSC::Lexer::shift2): Ditto.
+ (JSC::Lexer::shift3): Ditto.
+ (JSC::Lexer::shift4): Ditto.
+ (JSC::Lexer::setCode): Updated for name change from yylineno to m_line.
+ Removed now-unused m_eatNextIdentifier, m_stackToken, and m_restrKeyword.
+ Replaced m_skipLF and m_skipCR with m_skipLineEnd. Replaced the old
+ m_length with m_codeEnd and m_currentOffset with m_codeStart. Added code
+ to scan for a BOM character and call copyCodeWithoutBOMs() if we find any.
+ (JSC::Lexer::copyCodeWithoutBOMs): Added.
+ (JSC::Lexer::nextLine): Updated for name change from yylineno to m_line.
+ (JSC::Lexer::makeIdentifier): Moved up higher in the file.
+ (JSC::Lexer::matchPunctuator): Moved up higher in the file and changed to
+ use a switch statement instead of just if statements.
+ (JSC::Lexer::isLineTerminator): Moved up higher in the file and changed to
+ have fewer branches.
+ (JSC::Lexer::lastTokenWasRestrKeyword): Added. This replaces the old
+ m_restrKeyword boolean.
+ (JSC::Lexer::isIdentStart): Moved up higher in the file. Changed to use
+ fewer branches in the ASCII but not identifier case.
+ (JSC::Lexer::isIdentPart): Ditto.
+ (JSC::Lexer::singleEscape): Moved up higher in the file.
+ (JSC::Lexer::convertOctal): Moved up higher in the file.
+ (JSC::Lexer::convertHex): Moved up higher in the file. Changed to use
+ toASCIIHexValue instead of rolling our own here.
+ (JSC::Lexer::convertUnicode): Ditto.
+ (JSC::Lexer::record8): Moved up higher in the file.
+ (JSC::Lexer::record16): Moved up higher in the file.
+ (JSC::Lexer::lex): Changed type of stringType to int. Replaced m_skipLF
+ and m_skipCR with m_skipLineEnd, which requires fewer branches in the
+ main lexer loop. Use currentOffset instead of m_currentOffset. Removed
+ unneeded m_stackToken. Use isASCIIDigit instead of isDecimalDigit.
+ Split out the two cases for InIdentifierOrKeyword and InIdentifier.
+ Added special case tight loops for identifiers and other simple states.
+ Removed a branch from the code that sets m_atLineStart to false using goto.
+ Streamlined the number-handling code so we don't check for the same types
+ twice for non-numeric cases and don't add a null to m_buffer8 when it's
+ not being used. Removed m_eatNextIdentifier, which wasn't working anyway,
+ and m_restrKeyword, which is redundant with m_lastToken. Set the
+ m_delimited flag without using a branch.
+ (JSC::Lexer::scanRegExp): Tweaked style a bit.
+ (JSC::Lexer::clear): Clear m_codeWithoutBOMs so we don't use memory after
+ parsing. Clear out UString objects in the more conventional way.
+ (JSC::Lexer::sourceCode): Made this no-longer inline since it has more
+ work to do in the case where we stripped BOMs.
+
+ * parser/Lexer.h: Renamed yylineno to m_lineNumber. Removed convertHex
+ function, which is the same as toASCIIHexValue. Removed isHexDigit
+ function, which is the same as isASCIIHedDigit. Replaced shift with four
+ separate shift functions. Removed isWhiteSpace function that passes
+ m_current, instead just passing m_current explicitly. Removed isOctalDigit,
+ which is the same as isASCIIOctalDigit. Eliminated unused arguments from
+ matchPunctuator. Added copyCoodeWithoutBOMs and currentOffset. Moved the
+ makeIdentifier function out of the header. Added lastTokenWasRestrKeyword
+ function. Added new constants for m_skipLineEnd. Removed unused yycolumn,
+ m_restrKeyword, m_skipLF, m_skipCR, m_eatNextIdentifier, m_stackToken,
+ m_position, m_length, m_currentOffset, m_nextOffset1, m_nextOffset2,
+ m_nextOffset3. Added m_skipLineEnd, m_codeStart, m_codeEnd, and
+ m_codeWithoutBOMs.
+
+ * parser/SourceProvider.h: Added hasBOMs function. In the future this can
+ be used to tell the lexer about strings known not to have BOMs.
+
+ * runtime/JSGlobalObjectFunctions.cpp:
+ (JSC::globalFuncUnescape): Changed to use isASCIIHexDigit.
+
+ * wtf/ASCIICType.h: Added using statements to match the design of the
+ other WTF headers.
+
+2009-05-02 Ada Chan <adachan@apple.com>
+
+ Fix windows build (when doing a clean build)
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-05-02 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Simplified null-ish JSValues.
+
+ Replaced calls to noValue() with calls to JSValue() (which is what
+ noValue() returned). Removed noValue().
+
+ Replaced almost all uses of jsImpossibleValue() with uses of JSValue().
+ Its one remaining use is for construction of hash table deleted values.
+ For that specific task, I made a new, private constructor with a special
+ tag. Removed jsImpossibleValue().
+
+ Removed "JSValue()" initialiazers, since default construction happens...
+ by default.
+
+ * API/JSCallbackObjectFunctions.h:
+ (JSC::::call):
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::emitLoad):
+ * bytecompiler/BytecodeGenerator.h:
+ * debugger/DebuggerCallFrame.cpp:
+ (JSC::DebuggerCallFrame::evaluate):
+ * debugger/DebuggerCallFrame.h:
+ (JSC::DebuggerCallFrame::DebuggerCallFrame):
+ * interpreter/CallFrame.h:
+ (JSC::ExecState::clearException):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+ (JSC::Interpreter::retrieveLastCaller):
+ * interpreter/Register.h:
+ (JSC::Register::Register):
+ * jit/JITCall.cpp:
+ (JSC::JIT::unlinkCall):
+ (JSC::JIT::compileOpCallInitializeCallFrame):
+ (JSC::JIT::compileOpCall):
+ * jit/JITStubs.cpp:
+ (JSC::JITStubs::cti_op_call_eval):
+ (JSC::JITStubs::cti_vm_throw):
+ * profiler/Profiler.cpp:
+ (JSC::Profiler::willExecute):
+ (JSC::Profiler::didExecute):
+ * runtime/ArrayPrototype.cpp:
+ (JSC::getProperty):
+ * runtime/Completion.cpp:
+ (JSC::evaluate):
+ * runtime/Completion.h:
+ (JSC::Completion::Completion):
+ * runtime/GetterSetter.cpp:
+ (JSC::GetterSetter::getPrimitiveNumber):
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::putSlowCase):
+ (JSC::JSArray::deleteProperty):
+ (JSC::JSArray::increaseVectorLength):
+ (JSC::JSArray::setLength):
+ (JSC::JSArray::pop):
+ (JSC::JSArray::sort):
+ (JSC::JSArray::compactForSorting):
+ * runtime/JSCell.cpp:
+ (JSC::JSCell::getJSNumber):
+ * runtime/JSCell.h:
+ (JSC::JSValue::getJSNumber):
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData):
+ * runtime/JSImmediate.h:
+ (JSC::JSImmediate::fromNumberOutsideIntegerRange):
+ (JSC::JSImmediate::from):
+ * runtime/JSNumberCell.cpp:
+ (JSC::jsNumberCell):
+ * runtime/JSObject.cpp:
+ (JSC::callDefaultValueFunction):
+ * runtime/JSObject.h:
+ (JSC::JSObject::getDirect):
+ * runtime/JSPropertyNameIterator.cpp:
+ (JSC::JSPropertyNameIterator::toPrimitive):
+ * runtime/JSPropertyNameIterator.h:
+ (JSC::JSPropertyNameIterator::next):
+ * runtime/JSValue.h:
+ (JSC::JSValue::):
+ (JSC::JSValueHashTraits::constructDeletedValue):
+ (JSC::JSValueHashTraits::isDeletedValue):
+ (JSC::JSValue::JSValue):
+ * runtime/JSWrapperObject.h:
+ (JSC::JSWrapperObject::JSWrapperObject):
+ * runtime/Operations.h:
+ (JSC::resolveBase):
+ * runtime/PropertySlot.h:
+ (JSC::PropertySlot::clearBase):
+ (JSC::PropertySlot::clearValue):
+
+2009-05-02 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ - speed up the lexer in various ways
+
+ ~2% command-line SunSpider speedup
+
+ * parser/Lexer.cpp:
+ (JSC::Lexer::setCode): Moved below shift() so it can inline.
+ (JSC::Lexer::scanRegExp): Use resize(0) instead of clear() on Vectors, since the intent
+ here is not to free the underlying buffer.
+ (JSC::Lexer::lex): ditto; also, change the loop logic a bit for the main lexing loop
+ to avoid branching on !m_done twice per iteration. Now we only check it once.
+ (JSC::Lexer::shift): Make this ALWAYS_INLINE and tag an unusual branch as UNLIKELY
+ * parser/Lexer.h:
+ (JSC::Lexer::makeIdentifier): force to be ALWAYS_INLINE
+ * wtf/Vector.h:
+ (WTF::::append): force to be ALWAYS_INLINE (may have helped in ways other than parsing but it wasn't
+ getting inlined in a hot code path in the lexer)
+
+2009-05-01 Steve Falkenburg <sfalken@apple.com>
+
+ Windows build fix.
+
+ * JavaScriptCore.vcproj/JavaScriptCore.make:
+
+2009-05-01 Sam Weinig <sam@webkit.org>
+
+ Fix 64bit build.
+
+ * runtime/JSNumberCell.h:
+ (JSC::JSValue::JSValue):
+ * runtime/JSValue.h:
+ (JSC::jsNumber):
+
+2009-05-01 Sam Weinig <sam@webkit.org>
+
+ Roll out JavaScriptCore API number marshaling.
+
+ * API/APICast.h:
+ (toJS):
+ (toRef):
+ * API/JSBase.cpp:
+ (JSEvaluateScript):
+ (JSCheckScriptSyntax):
+ * API/JSCallbackConstructor.cpp:
+ (JSC::constructJSCallback):
+ * API/JSCallbackFunction.cpp:
+ (JSC::JSCallbackFunction::call):
+ * API/JSCallbackObjectFunctions.h:
+ (JSC::::getOwnPropertySlot):
+ (JSC::::put):
+ (JSC::::deleteProperty):
+ (JSC::::construct):
+ (JSC::::hasInstance):
+ (JSC::::call):
+ (JSC::::toNumber):
+ (JSC::::toString):
+ (JSC::::staticValueGetter):
+ (JSC::::callbackGetter):
+ * API/JSObjectRef.cpp:
+ (JSObjectMakeFunction):
+ (JSObjectMakeArray):
+ (JSObjectMakeDate):
+ (JSObjectMakeError):
+ (JSObjectMakeRegExp):
+ (JSObjectGetPrototype):
+ (JSObjectSetPrototype):
+ (JSObjectGetProperty):
+ (JSObjectSetProperty):
+ (JSObjectGetPropertyAtIndex):
+ (JSObjectSetPropertyAtIndex):
+ (JSObjectDeleteProperty):
+ (JSObjectCallAsFunction):
+ (JSObjectCallAsConstructor):
+ * API/JSValueRef.cpp:
+ (JSValueGetType):
+ (JSValueIsUndefined):
+ (JSValueIsNull):
+ (JSValueIsBoolean):
+ (JSValueIsNumber):
+ (JSValueIsString):
+ (JSValueIsObject):
+ (JSValueIsObjectOfClass):
+ (JSValueIsEqual):
+ (JSValueIsStrictEqual):
+ (JSValueIsInstanceOfConstructor):
+ (JSValueMakeUndefined):
+ (JSValueMakeNull):
+ (JSValueMakeBoolean):
+ (JSValueMakeNumber):
+ (JSValueMakeString):
+ (JSValueToBoolean):
+ (JSValueToNumber):
+ (JSValueToStringCopy):
+ (JSValueToObject):
+ (JSValueProtect):
+ (JSValueUnprotect):
+ * JavaScriptCore.exp:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+ * runtime/JSNumberCell.cpp:
+ * runtime/JSNumberCell.h:
+ * runtime/JSValue.h:
+
+2009-05-01 Sam Weinig <sam@webkit.org>
+
+ Fix windows build.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-05-01 Sam Weinig <sam@webkit.org>
+
+ Fix the build.
+
+ * JavaScriptCore.exp:
+
+2009-05-01 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey "Too Far!" Garen.
+
+ Move JS number construction into JSValue.
+
+ * runtime/JSImmediate.h:
+ * runtime/JSNumberCell.h:
+ (JSC::JSValue::JSValue):
+ * runtime/JSValue.h:
+ (JSC::jsNumber):
+
+2009-05-01 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoff "The Minneapolis" Garen.
+
+ Add mechanism to vend heap allocated JS numbers to JavaScriptCore API clients with a
+ representation that is independent of the number representation in the VM.
+ - Numbers leaving the interpreter are converted to a tagged JSNumberCell.
+ - The numbers coming into the interpreter (asserted to be the tagged JSNumberCell) are
+ converted back to the VM's internal number representation.
+
+ * API/APICast.h:
+ (toJS):
+ (toRef):
+ * API/JSBase.cpp:
+ (JSEvaluateScript):
+ (JSCheckScriptSyntax):
+ * API/JSCallbackConstructor.cpp:
+ (JSC::constructJSCallback):
+ * API/JSCallbackFunction.cpp:
+ (JSC::JSCallbackFunction::call):
+ * API/JSCallbackObjectFunctions.h:
+ (JSC::::getOwnPropertySlot):
+ (JSC::::put):
+ (JSC::::deleteProperty):
+ (JSC::::construct):
+ (JSC::::hasInstance):
+ (JSC::::call):
+ (JSC::::toNumber):
+ (JSC::::toString):
+ (JSC::::staticValueGetter):
+ (JSC::::callbackGetter):
+ * API/JSObjectRef.cpp:
+ (JSObjectMakeFunction):
+ (JSObjectMakeArray):
+ (JSObjectMakeDate):
+ (JSObjectMakeError):
+ (JSObjectMakeRegExp):
+ (JSObjectGetPrototype):
+ (JSObjectSetPrototype):
+ (JSObjectGetProperty):
+ (JSObjectSetProperty):
+ (JSObjectGetPropertyAtIndex):
+ (JSObjectSetPropertyAtIndex):
+ (JSObjectDeleteProperty):
+ (JSObjectCallAsFunction):
+ (JSObjectCallAsConstructor):
+ * API/JSValueRef.cpp:
+ (JSValueGetType):
+ (JSValueIsUndefined):
+ (JSValueIsNull):
+ (JSValueIsBoolean):
+ (JSValueIsNumber):
+ (JSValueIsString):
+ (JSValueIsObject):
+ (JSValueIsObjectOfClass):
+ (JSValueIsEqual):
+ (JSValueIsStrictEqual):
+ (JSValueIsInstanceOfConstructor):
+ (JSValueMakeUndefined):
+ (JSValueMakeNull):
+ (JSValueMakeBoolean):
+ (JSValueMakeNumber):
+ (JSValueMakeString):
+ (JSValueToBoolean):
+ (JSValueToNumber):
+ (JSValueToStringCopy):
+ (JSValueToObject):
+ (JSValueProtect):
+ (JSValueUnprotect):
+ * runtime/JSNumberCell.cpp:
+ (JSC::jsAPIMangledNumber):
+ * runtime/JSNumberCell.h:
+ (JSC::JSNumberCell::isAPIMangledNumber):
+ (JSC::JSNumberCell::):
+ (JSC::JSNumberCell::JSNumberCell):
+ (JSC::JSValue::isAPIMangledNumber):
+ * runtime/JSValue.h:
+
+2009-05-01 Geoffrey Garen <ggaren@apple.com>
+
+ Windows build fix take 6.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2009-05-01 Geoffrey Garen <ggaren@apple.com>
+
+ Windows build fix take 5.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-05-01 Geoffrey Garen <ggaren@apple.com>
+
+ Windows build fix take 4.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-05-01 Geoffrey Garen <ggaren@apple.com>
+
+ Windows build fix take 3.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-05-01 Geoffrey Garen <ggaren@apple.com>
+
+ Windows build fix take 2.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2009-05-01 Geoffrey Garen <ggaren@apple.com>
+
+ Windows build fix take 1.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-05-01 Geoffrey Garen <ggaren@apple.com>
+
+ Rubber Stamped by Sam Weinig.
+
+ Renamed JSValuePtr => JSValue.
+
+ * API/APICast.h:
+ (toJS):
+ (toRef):
+ * API/JSCallbackConstructor.h:
+ (JSC::JSCallbackConstructor::createStructure):
+ * API/JSCallbackFunction.cpp:
+ (JSC::JSCallbackFunction::call):
+ * API/JSCallbackFunction.h:
+ (JSC::JSCallbackFunction::createStructure):
+ * API/JSCallbackObject.h:
+ (JSC::JSCallbackObject::createStructure):
+ * API/JSCallbackObjectFunctions.h:
+ (JSC::::asCallbackObject):
+ (JSC::::put):
+ (JSC::::hasInstance):
+ (JSC::::call):
+ (JSC::::staticValueGetter):
+ (JSC::::staticFunctionGetter):
+ (JSC::::callbackGetter):
+ * API/JSContextRef.cpp:
+ * API/JSObjectRef.cpp:
+ (JSObjectMakeConstructor):
+ (JSObjectSetPrototype):
+ (JSObjectGetProperty):
+ (JSObjectSetProperty):
+ (JSObjectGetPropertyAtIndex):
+ (JSObjectSetPropertyAtIndex):
+ * API/JSValueRef.cpp:
+ (JSValueGetType):
+ (JSValueIsUndefined):
+ (JSValueIsNull):
+ (JSValueIsBoolean):
+ (JSValueIsNumber):
+ (JSValueIsString):
+ (JSValueIsObject):
+ (JSValueIsObjectOfClass):
+ (JSValueIsEqual):
+ (JSValueIsStrictEqual):
+ (JSValueIsInstanceOfConstructor):
+ (JSValueToBoolean):
+ (JSValueToNumber):
+ (JSValueToStringCopy):
+ (JSValueToObject):
+ (JSValueProtect):
+ (JSValueUnprotect):
+ * JavaScriptCore.exp:
+ * bytecode/CodeBlock.cpp:
+ (JSC::valueToSourceString):
+ (JSC::constantName):
+ (JSC::CodeBlock::dump):
+ * bytecode/CodeBlock.h:
+ (JSC::CodeBlock::getConstant):
+ (JSC::CodeBlock::addUnexpectedConstant):
+ (JSC::CodeBlock::unexpectedConstant):
+ * bytecode/EvalCodeCache.h:
+ (JSC::EvalCodeCache::get):
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::addConstant):
+ (JSC::BytecodeGenerator::addUnexpectedConstant):
+ (JSC::BytecodeGenerator::emitLoad):
+ (JSC::BytecodeGenerator::emitGetScopedVar):
+ (JSC::BytecodeGenerator::emitPutScopedVar):
+ (JSC::BytecodeGenerator::emitNewError):
+ (JSC::keyForImmediateSwitch):
+ * bytecompiler/BytecodeGenerator.h:
+ (JSC::BytecodeGenerator::JSValueHashTraits::constructDeletedValue):
+ (JSC::BytecodeGenerator::JSValueHashTraits::isDeletedValue):
+ * debugger/Debugger.cpp:
+ (JSC::evaluateInGlobalCallFrame):
+ * debugger/Debugger.h:
+ * debugger/DebuggerActivation.cpp:
+ (JSC::DebuggerActivation::put):
+ (JSC::DebuggerActivation::putWithAttributes):
+ (JSC::DebuggerActivation::lookupGetter):
+ (JSC::DebuggerActivation::lookupSetter):
+ * debugger/DebuggerActivation.h:
+ (JSC::DebuggerActivation::createStructure):
+ * debugger/DebuggerCallFrame.cpp:
+ (JSC::DebuggerCallFrame::evaluate):
+ * debugger/DebuggerCallFrame.h:
+ (JSC::DebuggerCallFrame::DebuggerCallFrame):
+ (JSC::DebuggerCallFrame::exception):
+ * interpreter/CachedCall.h:
+ (JSC::CachedCall::CachedCall):
+ (JSC::CachedCall::call):
+ (JSC::CachedCall::setThis):
+ (JSC::CachedCall::setArgument):
+ * interpreter/CallFrame.cpp:
+ (JSC::CallFrame::thisValue):
+ (JSC::CallFrame::dumpCaller):
+ * interpreter/CallFrame.h:
+ (JSC::ExecState::setException):
+ (JSC::ExecState::exception):
+ (JSC::ExecState::exceptionSlot):
+ * interpreter/CallFrameClosure.h:
+ (JSC::CallFrameClosure::setArgument):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::resolve):
+ (JSC::Interpreter::resolveSkip):
+ (JSC::Interpreter::resolveGlobal):
+ (JSC::Interpreter::resolveBase):
+ (JSC::Interpreter::resolveBaseAndProperty):
+ (JSC::Interpreter::resolveBaseAndFunc):
+ (JSC::isNotObject):
+ (JSC::Interpreter::callEval):
+ (JSC::Interpreter::unwindCallFrame):
+ (JSC::Interpreter::throwException):
+ (JSC::Interpreter::execute):
+ (JSC::Interpreter::prepareForRepeatCall):
+ (JSC::Interpreter::createExceptionScope):
+ (JSC::Interpreter::tryCachePutByID):
+ (JSC::Interpreter::tryCacheGetByID):
+ (JSC::Interpreter::privateExecute):
+ (JSC::Interpreter::retrieveArguments):
+ (JSC::Interpreter::retrieveCaller):
+ (JSC::Interpreter::retrieveLastCaller):
+ * interpreter/Interpreter.h:
+ * interpreter/Register.h:
+ (JSC::Register::):
+ (JSC::Register::Register):
+ (JSC::Register::jsValue):
+ * jit/JIT.cpp:
+ (JSC::):
+ (JSC::JIT::privateCompileMainPass):
+ * jit/JIT.h:
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::compileFastArith_op_mod):
+ * jit/JITCall.cpp:
+ (JSC::JIT::unlinkCall):
+ (JSC::JIT::compileOpCallInitializeCallFrame):
+ (JSC::JIT::compileOpCall):
+ * jit/JITCode.h:
+ (JSC::):
+ (JSC::JITCode::execute):
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::emitGetVirtualRegister):
+ (JSC::JIT::getConstantOperand):
+ (JSC::JIT::emitPutJITStubArgFromVirtualRegister):
+ (JSC::JIT::emitInitRegister):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::privateCompilePutByIdTransition):
+ (JSC::JIT::patchGetByIdSelf):
+ (JSC::JIT::patchPutByIdReplace):
+ (JSC::JIT::privateCompileGetByIdSelf):
+ (JSC::JIT::privateCompileGetByIdProto):
+ (JSC::JIT::privateCompileGetByIdSelfList):
+ (JSC::JIT::privateCompileGetByIdProtoList):
+ (JSC::JIT::privateCompileGetByIdChainList):
+ (JSC::JIT::privateCompileGetByIdChain):
+ (JSC::JIT::privateCompilePutByIdReplace):
+ * jit/JITStubs.cpp:
+ (JSC::JITStubs::tryCachePutByID):
+ (JSC::JITStubs::tryCacheGetByID):
+ (JSC::JITStubs::cti_op_convert_this):
+ (JSC::JITStubs::cti_op_add):
+ (JSC::JITStubs::cti_op_pre_inc):
+ (JSC::JITStubs::cti_op_loop_if_less):
+ (JSC::JITStubs::cti_op_loop_if_lesseq):
+ (JSC::JITStubs::cti_op_get_by_id_generic):
+ (JSC::JITStubs::cti_op_get_by_id):
+ (JSC::JITStubs::cti_op_get_by_id_second):
+ (JSC::JITStubs::cti_op_get_by_id_self_fail):
+ (JSC::JITStubs::cti_op_get_by_id_proto_list):
+ (JSC::JITStubs::cti_op_get_by_id_proto_list_full):
+ (JSC::JITStubs::cti_op_get_by_id_proto_fail):
+ (JSC::JITStubs::cti_op_get_by_id_array_fail):
+ (JSC::JITStubs::cti_op_get_by_id_string_fail):
+ (JSC::JITStubs::cti_op_instanceof):
+ (JSC::JITStubs::cti_op_del_by_id):
+ (JSC::JITStubs::cti_op_mul):
+ (JSC::JITStubs::cti_op_call_NotJSFunction):
+ (JSC::JITStubs::cti_op_resolve):
+ (JSC::JITStubs::cti_op_construct_NotJSConstruct):
+ (JSC::JITStubs::cti_op_get_by_val):
+ (JSC::JITStubs::cti_op_get_by_val_string):
+ (JSC::JITStubs::cti_op_get_by_val_byte_array):
+ (JSC::JITStubs::cti_op_resolve_func):
+ (JSC::JITStubs::cti_op_sub):
+ (JSC::JITStubs::cti_op_put_by_val):
+ (JSC::JITStubs::cti_op_put_by_val_array):
+ (JSC::JITStubs::cti_op_put_by_val_byte_array):
+ (JSC::JITStubs::cti_op_lesseq):
+ (JSC::JITStubs::cti_op_loop_if_true):
+ (JSC::JITStubs::cti_op_load_varargs):
+ (JSC::JITStubs::cti_op_negate):
+ (JSC::JITStubs::cti_op_resolve_base):
+ (JSC::JITStubs::cti_op_resolve_skip):
+ (JSC::JITStubs::cti_op_resolve_global):
+ (JSC::JITStubs::cti_op_div):
+ (JSC::JITStubs::cti_op_pre_dec):
+ (JSC::JITStubs::cti_op_jless):
+ (JSC::JITStubs::cti_op_not):
+ (JSC::JITStubs::cti_op_jtrue):
+ (JSC::JITStubs::cti_op_post_inc):
+ (JSC::JITStubs::cti_op_eq):
+ (JSC::JITStubs::cti_op_lshift):
+ (JSC::JITStubs::cti_op_bitand):
+ (JSC::JITStubs::cti_op_rshift):
+ (JSC::JITStubs::cti_op_bitnot):
+ (JSC::JITStubs::cti_op_resolve_with_base):
+ (JSC::JITStubs::cti_op_mod):
+ (JSC::JITStubs::cti_op_less):
+ (JSC::JITStubs::cti_op_neq):
+ (JSC::JITStubs::cti_op_post_dec):
+ (JSC::JITStubs::cti_op_urshift):
+ (JSC::JITStubs::cti_op_bitxor):
+ (JSC::JITStubs::cti_op_bitor):
+ (JSC::JITStubs::cti_op_call_eval):
+ (JSC::JITStubs::cti_op_throw):
+ (JSC::JITStubs::cti_op_next_pname):
+ (JSC::JITStubs::cti_op_typeof):
+ (JSC::JITStubs::cti_op_is_undefined):
+ (JSC::JITStubs::cti_op_is_boolean):
+ (JSC::JITStubs::cti_op_is_number):
+ (JSC::JITStubs::cti_op_is_string):
+ (JSC::JITStubs::cti_op_is_object):
+ (JSC::JITStubs::cti_op_is_function):
+ (JSC::JITStubs::cti_op_stricteq):
+ (JSC::JITStubs::cti_op_nstricteq):
+ (JSC::JITStubs::cti_op_to_jsnumber):
+ (JSC::JITStubs::cti_op_in):
+ (JSC::JITStubs::cti_op_switch_imm):
+ (JSC::JITStubs::cti_op_switch_char):
+ (JSC::JITStubs::cti_op_switch_string):
+ (JSC::JITStubs::cti_op_del_by_val):
+ (JSC::JITStubs::cti_op_new_error):
+ (JSC::JITStubs::cti_vm_throw):
+ * jit/JITStubs.h:
+ * jsc.cpp:
+ (functionPrint):
+ (functionDebug):
+ (functionGC):
+ (functionVersion):
+ (functionRun):
+ (functionLoad):
+ (functionSetSamplingFlag):
+ (functionClearSamplingFlag):
+ (functionReadline):
+ (functionQuit):
+ * parser/Nodes.cpp:
+ (JSC::processClauseList):
+ * profiler/ProfileGenerator.cpp:
+ (JSC::ProfileGenerator::addParentForConsoleStart):
+ * profiler/Profiler.cpp:
+ (JSC::Profiler::willExecute):
+ (JSC::Profiler::didExecute):
+ (JSC::Profiler::createCallIdentifier):
+ * profiler/Profiler.h:
+ * runtime/ArgList.cpp:
+ (JSC::MarkedArgumentBuffer::slowAppend):
+ * runtime/ArgList.h:
+ (JSC::MarkedArgumentBuffer::at):
+ (JSC::MarkedArgumentBuffer::append):
+ (JSC::ArgList::ArgList):
+ (JSC::ArgList::at):
+ * runtime/Arguments.cpp:
+ (JSC::Arguments::put):
+ * runtime/Arguments.h:
+ (JSC::Arguments::createStructure):
+ (JSC::asArguments):
+ * runtime/ArrayConstructor.cpp:
+ (JSC::callArrayConstructor):
+ * runtime/ArrayPrototype.cpp:
+ (JSC::getProperty):
+ (JSC::putProperty):
+ (JSC::arrayProtoFuncToString):
+ (JSC::arrayProtoFuncToLocaleString):
+ (JSC::arrayProtoFuncJoin):
+ (JSC::arrayProtoFuncConcat):
+ (JSC::arrayProtoFuncPop):
+ (JSC::arrayProtoFuncPush):
+ (JSC::arrayProtoFuncReverse):
+ (JSC::arrayProtoFuncShift):
+ (JSC::arrayProtoFuncSlice):
+ (JSC::arrayProtoFuncSort):
+ (JSC::arrayProtoFuncSplice):
+ (JSC::arrayProtoFuncUnShift):
+ (JSC::arrayProtoFuncFilter):
+ (JSC::arrayProtoFuncMap):
+ (JSC::arrayProtoFuncEvery):
+ (JSC::arrayProtoFuncForEach):
+ (JSC::arrayProtoFuncSome):
+ (JSC::arrayProtoFuncReduce):
+ (JSC::arrayProtoFuncReduceRight):
+ (JSC::arrayProtoFuncIndexOf):
+ (JSC::arrayProtoFuncLastIndexOf):
+ * runtime/BooleanConstructor.cpp:
+ (JSC::callBooleanConstructor):
+ (JSC::constructBooleanFromImmediateBoolean):
+ * runtime/BooleanConstructor.h:
+ * runtime/BooleanObject.h:
+ (JSC::asBooleanObject):
+ * runtime/BooleanPrototype.cpp:
+ (JSC::booleanProtoFuncToString):
+ (JSC::booleanProtoFuncValueOf):
+ * runtime/CallData.cpp:
+ (JSC::call):
+ * runtime/CallData.h:
+ * runtime/Collector.cpp:
+ (JSC::Heap::protect):
+ (JSC::Heap::unprotect):
+ (JSC::Heap::heap):
+ * runtime/Collector.h:
+ * runtime/Completion.cpp:
+ (JSC::evaluate):
+ * runtime/Completion.h:
+ (JSC::Completion::Completion):
+ (JSC::Completion::value):
+ (JSC::Completion::setValue):
+ * runtime/ConstructData.cpp:
+ (JSC::construct):
+ * runtime/ConstructData.h:
+ * runtime/DateConstructor.cpp:
+ (JSC::constructDate):
+ (JSC::callDate):
+ (JSC::dateParse):
+ (JSC::dateNow):
+ (JSC::dateUTC):
+ * runtime/DateInstance.h:
+ (JSC::asDateInstance):
+ * runtime/DatePrototype.cpp:
+ (JSC::dateProtoFuncToString):
+ (JSC::dateProtoFuncToUTCString):
+ (JSC::dateProtoFuncToDateString):
+ (JSC::dateProtoFuncToTimeString):
+ (JSC::dateProtoFuncToLocaleString):
+ (JSC::dateProtoFuncToLocaleDateString):
+ (JSC::dateProtoFuncToLocaleTimeString):
+ (JSC::dateProtoFuncGetTime):
+ (JSC::dateProtoFuncGetFullYear):
+ (JSC::dateProtoFuncGetUTCFullYear):
+ (JSC::dateProtoFuncToGMTString):
+ (JSC::dateProtoFuncGetMonth):
+ (JSC::dateProtoFuncGetUTCMonth):
+ (JSC::dateProtoFuncGetDate):
+ (JSC::dateProtoFuncGetUTCDate):
+ (JSC::dateProtoFuncGetDay):
+ (JSC::dateProtoFuncGetUTCDay):
+ (JSC::dateProtoFuncGetHours):
+ (JSC::dateProtoFuncGetUTCHours):
+ (JSC::dateProtoFuncGetMinutes):
+ (JSC::dateProtoFuncGetUTCMinutes):
+ (JSC::dateProtoFuncGetSeconds):
+ (JSC::dateProtoFuncGetUTCSeconds):
+ (JSC::dateProtoFuncGetMilliSeconds):
+ (JSC::dateProtoFuncGetUTCMilliseconds):
+ (JSC::dateProtoFuncGetTimezoneOffset):
+ (JSC::dateProtoFuncSetTime):
+ (JSC::setNewValueFromTimeArgs):
+ (JSC::setNewValueFromDateArgs):
+ (JSC::dateProtoFuncSetMilliSeconds):
+ (JSC::dateProtoFuncSetUTCMilliseconds):
+ (JSC::dateProtoFuncSetSeconds):
+ (JSC::dateProtoFuncSetUTCSeconds):
+ (JSC::dateProtoFuncSetMinutes):
+ (JSC::dateProtoFuncSetUTCMinutes):
+ (JSC::dateProtoFuncSetHours):
+ (JSC::dateProtoFuncSetUTCHours):
+ (JSC::dateProtoFuncSetDate):
+ (JSC::dateProtoFuncSetUTCDate):
+ (JSC::dateProtoFuncSetMonth):
+ (JSC::dateProtoFuncSetUTCMonth):
+ (JSC::dateProtoFuncSetFullYear):
+ (JSC::dateProtoFuncSetUTCFullYear):
+ (JSC::dateProtoFuncSetYear):
+ (JSC::dateProtoFuncGetYear):
+ * runtime/DatePrototype.h:
+ (JSC::DatePrototype::createStructure):
+ * runtime/ErrorConstructor.cpp:
+ (JSC::callErrorConstructor):
+ * runtime/ErrorPrototype.cpp:
+ (JSC::errorProtoFuncToString):
+ * runtime/ExceptionHelpers.cpp:
+ (JSC::createInterruptedExecutionException):
+ (JSC::createError):
+ (JSC::createStackOverflowError):
+ (JSC::createUndefinedVariableError):
+ (JSC::createErrorMessage):
+ (JSC::createInvalidParamError):
+ (JSC::createNotAConstructorError):
+ (JSC::createNotAFunctionError):
+ * runtime/ExceptionHelpers.h:
+ * runtime/FunctionConstructor.cpp:
+ (JSC::callFunctionConstructor):
+ * runtime/FunctionPrototype.cpp:
+ (JSC::callFunctionPrototype):
+ (JSC::functionProtoFuncToString):
+ (JSC::functionProtoFuncApply):
+ (JSC::functionProtoFuncCall):
+ * runtime/FunctionPrototype.h:
+ (JSC::FunctionPrototype::createStructure):
+ * runtime/GetterSetter.cpp:
+ (JSC::GetterSetter::toPrimitive):
+ (JSC::GetterSetter::getPrimitiveNumber):
+ * runtime/GetterSetter.h:
+ (JSC::asGetterSetter):
+ * runtime/InternalFunction.cpp:
+ (JSC::InternalFunction::displayName):
+ * runtime/InternalFunction.h:
+ (JSC::InternalFunction::createStructure):
+ (JSC::asInternalFunction):
+ * runtime/JSActivation.cpp:
+ (JSC::JSActivation::getOwnPropertySlot):
+ (JSC::JSActivation::put):
+ (JSC::JSActivation::putWithAttributes):
+ (JSC::JSActivation::argumentsGetter):
+ * runtime/JSActivation.h:
+ (JSC::JSActivation::createStructure):
+ (JSC::asActivation):
+ * runtime/JSArray.cpp:
+ (JSC::storageSize):
+ (JSC::JSArray::JSArray):
+ (JSC::JSArray::getOwnPropertySlot):
+ (JSC::JSArray::put):
+ (JSC::JSArray::putSlowCase):
+ (JSC::JSArray::deleteProperty):
+ (JSC::JSArray::setLength):
+ (JSC::JSArray::pop):
+ (JSC::JSArray::push):
+ (JSC::JSArray::mark):
+ (JSC::compareNumbersForQSort):
+ (JSC::JSArray::sortNumeric):
+ (JSC::JSArray::sort):
+ (JSC::JSArray::compactForSorting):
+ (JSC::JSArray::checkConsistency):
+ (JSC::constructArray):
+ * runtime/JSArray.h:
+ (JSC::JSArray::getIndex):
+ (JSC::JSArray::setIndex):
+ (JSC::JSArray::createStructure):
+ (JSC::asArray):
+ (JSC::isJSArray):
+ * runtime/JSByteArray.cpp:
+ (JSC::JSByteArray::createStructure):
+ (JSC::JSByteArray::put):
+ * runtime/JSByteArray.h:
+ (JSC::JSByteArray::getIndex):
+ (JSC::JSByteArray::setIndex):
+ (JSC::asByteArray):
+ (JSC::isJSByteArray):
+ * runtime/JSCell.cpp:
+ (JSC::JSCell::put):
+ (JSC::JSCell::getJSNumber):
+ * runtime/JSCell.h:
+ (JSC::asCell):
+ (JSC::JSValue::asCell):
+ (JSC::JSValue::isString):
+ (JSC::JSValue::isGetterSetter):
+ (JSC::JSValue::isObject):
+ (JSC::JSValue::getString):
+ (JSC::JSValue::getObject):
+ (JSC::JSValue::getCallData):
+ (JSC::JSValue::getConstructData):
+ (JSC::JSValue::getUInt32):
+ (JSC::JSValue::getTruncatedInt32):
+ (JSC::JSValue::getTruncatedUInt32):
+ (JSC::JSValue::mark):
+ (JSC::JSValue::marked):
+ (JSC::JSValue::toPrimitive):
+ (JSC::JSValue::getPrimitiveNumber):
+ (JSC::JSValue::toBoolean):
+ (JSC::JSValue::toNumber):
+ (JSC::JSValue::toString):
+ (JSC::JSValue::toObject):
+ (JSC::JSValue::toThisObject):
+ (JSC::JSValue::needsThisConversion):
+ (JSC::JSValue::toThisString):
+ (JSC::JSValue::getJSNumber):
+ * runtime/JSFunction.cpp:
+ (JSC::JSFunction::call):
+ (JSC::JSFunction::argumentsGetter):
+ (JSC::JSFunction::callerGetter):
+ (JSC::JSFunction::lengthGetter):
+ (JSC::JSFunction::getOwnPropertySlot):
+ (JSC::JSFunction::put):
+ (JSC::JSFunction::construct):
+ * runtime/JSFunction.h:
+ (JSC::JSFunction::createStructure):
+ (JSC::asFunction):
+ * runtime/JSGlobalData.h:
+ * runtime/JSGlobalObject.cpp:
+ (JSC::markIfNeeded):
+ (JSC::JSGlobalObject::put):
+ (JSC::JSGlobalObject::putWithAttributes):
+ (JSC::JSGlobalObject::reset):
+ (JSC::JSGlobalObject::resetPrototype):
+ * runtime/JSGlobalObject.h:
+ (JSC::JSGlobalObject::createStructure):
+ (JSC::JSGlobalObject::GlobalPropertyInfo::GlobalPropertyInfo):
+ (JSC::asGlobalObject):
+ (JSC::Structure::prototypeForLookup):
+ (JSC::Structure::prototypeChain):
+ (JSC::Structure::isValid):
+ * runtime/JSGlobalObjectFunctions.cpp:
+ (JSC::encode):
+ (JSC::decode):
+ (JSC::globalFuncEval):
+ (JSC::globalFuncParseInt):
+ (JSC::globalFuncParseFloat):
+ (JSC::globalFuncIsNaN):
+ (JSC::globalFuncIsFinite):
+ (JSC::globalFuncDecodeURI):
+ (JSC::globalFuncDecodeURIComponent):
+ (JSC::globalFuncEncodeURI):
+ (JSC::globalFuncEncodeURIComponent):
+ (JSC::globalFuncEscape):
+ (JSC::globalFuncUnescape):
+ (JSC::globalFuncJSCPrint):
+ * runtime/JSGlobalObjectFunctions.h:
+ * runtime/JSImmediate.cpp:
+ (JSC::JSImmediate::toThisObject):
+ (JSC::JSImmediate::toObject):
+ (JSC::JSImmediate::prototype):
+ (JSC::JSImmediate::toString):
+ * runtime/JSImmediate.h:
+ (JSC::JSImmediate::isImmediate):
+ (JSC::JSImmediate::isNumber):
+ (JSC::JSImmediate::isIntegerNumber):
+ (JSC::JSImmediate::isDoubleNumber):
+ (JSC::JSImmediate::isPositiveIntegerNumber):
+ (JSC::JSImmediate::isBoolean):
+ (JSC::JSImmediate::isUndefinedOrNull):
+ (JSC::JSImmediate::isEitherImmediate):
+ (JSC::JSImmediate::areBothImmediate):
+ (JSC::JSImmediate::areBothImmediateIntegerNumbers):
+ (JSC::JSImmediate::makeValue):
+ (JSC::JSImmediate::makeInt):
+ (JSC::JSImmediate::makeDouble):
+ (JSC::JSImmediate::makeBool):
+ (JSC::JSImmediate::makeUndefined):
+ (JSC::JSImmediate::makeNull):
+ (JSC::JSImmediate::doubleValue):
+ (JSC::JSImmediate::intValue):
+ (JSC::JSImmediate::uintValue):
+ (JSC::JSImmediate::boolValue):
+ (JSC::JSImmediate::rawValue):
+ (JSC::JSImmediate::trueImmediate):
+ (JSC::JSImmediate::falseImmediate):
+ (JSC::JSImmediate::undefinedImmediate):
+ (JSC::JSImmediate::nullImmediate):
+ (JSC::JSImmediate::zeroImmediate):
+ (JSC::JSImmediate::oneImmediate):
+ (JSC::JSImmediate::impossibleValue):
+ (JSC::JSImmediate::toBoolean):
+ (JSC::JSImmediate::getTruncatedUInt32):
+ (JSC::JSImmediate::fromNumberOutsideIntegerRange):
+ (JSC::JSImmediate::from):
+ (JSC::JSImmediate::getTruncatedInt32):
+ (JSC::JSImmediate::toDouble):
+ (JSC::JSImmediate::getUInt32):
+ (JSC::JSValue::JSValue):
+ (JSC::JSValue::isUndefinedOrNull):
+ (JSC::JSValue::isBoolean):
+ (JSC::JSValue::getBoolean):
+ (JSC::JSValue::toInt32):
+ (JSC::JSValue::toUInt32):
+ (JSC::JSValue::isCell):
+ (JSC::JSValue::isInt32Fast):
+ (JSC::JSValue::getInt32Fast):
+ (JSC::JSValue::isUInt32Fast):
+ (JSC::JSValue::getUInt32Fast):
+ (JSC::JSValue::makeInt32Fast):
+ (JSC::JSValue::areBothInt32Fast):
+ (JSC::JSFastMath::canDoFastBitwiseOperations):
+ (JSC::JSFastMath::equal):
+ (JSC::JSFastMath::notEqual):
+ (JSC::JSFastMath::andImmediateNumbers):
+ (JSC::JSFastMath::xorImmediateNumbers):
+ (JSC::JSFastMath::orImmediateNumbers):
+ (JSC::JSFastMath::canDoFastRshift):
+ (JSC::JSFastMath::canDoFastUrshift):
+ (JSC::JSFastMath::rightShiftImmediateNumbers):
+ (JSC::JSFastMath::canDoFastAdditiveOperations):
+ (JSC::JSFastMath::addImmediateNumbers):
+ (JSC::JSFastMath::subImmediateNumbers):
+ (JSC::JSFastMath::incImmediateNumber):
+ (JSC::JSFastMath::decImmediateNumber):
+ * runtime/JSNotAnObject.cpp:
+ (JSC::JSNotAnObject::toPrimitive):
+ (JSC::JSNotAnObject::getPrimitiveNumber):
+ (JSC::JSNotAnObject::put):
+ * runtime/JSNotAnObject.h:
+ (JSC::JSNotAnObject::createStructure):
+ * runtime/JSNumberCell.cpp:
+ (JSC::JSNumberCell::toPrimitive):
+ (JSC::JSNumberCell::getPrimitiveNumber):
+ (JSC::JSNumberCell::getJSNumber):
+ (JSC::jsNumberCell):
+ * runtime/JSNumberCell.h:
+ (JSC::JSNumberCell::createStructure):
+ (JSC::isNumberCell):
+ (JSC::asNumberCell):
+ (JSC::jsNumber):
+ (JSC::JSValue::isDoubleNumber):
+ (JSC::JSValue::getDoubleNumber):
+ (JSC::JSValue::isNumber):
+ (JSC::JSValue::uncheckedGetNumber):
+ (JSC::jsNaN):
+ (JSC::JSValue::toJSNumber):
+ (JSC::JSValue::getNumber):
+ (JSC::JSValue::numberToInt32):
+ (JSC::JSValue::numberToUInt32):
+ * runtime/JSObject.cpp:
+ (JSC::JSObject::mark):
+ (JSC::JSObject::put):
+ (JSC::JSObject::putWithAttributes):
+ (JSC::callDefaultValueFunction):
+ (JSC::JSObject::getPrimitiveNumber):
+ (JSC::JSObject::defaultValue):
+ (JSC::JSObject::defineGetter):
+ (JSC::JSObject::defineSetter):
+ (JSC::JSObject::lookupGetter):
+ (JSC::JSObject::lookupSetter):
+ (JSC::JSObject::hasInstance):
+ (JSC::JSObject::toNumber):
+ (JSC::JSObject::toString):
+ (JSC::JSObject::fillGetterPropertySlot):
+ * runtime/JSObject.h:
+ (JSC::JSObject::getDirect):
+ (JSC::JSObject::getDirectLocation):
+ (JSC::JSObject::offsetForLocation):
+ (JSC::JSObject::locationForOffset):
+ (JSC::JSObject::getDirectOffset):
+ (JSC::JSObject::putDirectOffset):
+ (JSC::JSObject::createStructure):
+ (JSC::asObject):
+ (JSC::JSObject::prototype):
+ (JSC::JSObject::setPrototype):
+ (JSC::JSValue::isObject):
+ (JSC::JSObject::inlineGetOwnPropertySlot):
+ (JSC::JSObject::getOwnPropertySlotForWrite):
+ (JSC::JSObject::getPropertySlot):
+ (JSC::JSObject::get):
+ (JSC::JSObject::putDirect):
+ (JSC::JSObject::putDirectWithoutTransition):
+ (JSC::JSObject::toPrimitive):
+ (JSC::JSValue::get):
+ (JSC::JSValue::put):
+ (JSC::JSObject::allocatePropertyStorageInline):
+ * runtime/JSPropertyNameIterator.cpp:
+ (JSC::JSPropertyNameIterator::toPrimitive):
+ (JSC::JSPropertyNameIterator::getPrimitiveNumber):
+ * runtime/JSPropertyNameIterator.h:
+ (JSC::JSPropertyNameIterator::create):
+ (JSC::JSPropertyNameIterator::next):
+ * runtime/JSStaticScopeObject.cpp:
+ (JSC::JSStaticScopeObject::put):
+ (JSC::JSStaticScopeObject::putWithAttributes):
+ * runtime/JSStaticScopeObject.h:
+ (JSC::JSStaticScopeObject::JSStaticScopeObject):
+ (JSC::JSStaticScopeObject::createStructure):
+ * runtime/JSString.cpp:
+ (JSC::JSString::toPrimitive):
+ (JSC::JSString::getPrimitiveNumber):
+ (JSC::JSString::getOwnPropertySlot):
+ * runtime/JSString.h:
+ (JSC::JSString::createStructure):
+ (JSC::asString):
+ (JSC::isJSString):
+ (JSC::JSValue::toThisJSString):
+ * runtime/JSValue.cpp:
+ (JSC::JSValue::toInteger):
+ (JSC::JSValue::toIntegerPreserveNaN):
+ * runtime/JSValue.h:
+ (JSC::JSValue::makeImmediate):
+ (JSC::JSValue::asValue):
+ (JSC::noValue):
+ (JSC::jsImpossibleValue):
+ (JSC::jsNull):
+ (JSC::jsUndefined):
+ (JSC::jsBoolean):
+ (JSC::operator==):
+ (JSC::operator!=):
+ (JSC::JSValue::encode):
+ (JSC::JSValue::decode):
+ (JSC::JSValue::JSValue):
+ (JSC::JSValue::operator bool):
+ (JSC::JSValue::operator==):
+ (JSC::JSValue::operator!=):
+ (JSC::JSValue::isUndefined):
+ (JSC::JSValue::isNull):
+ * runtime/JSVariableObject.h:
+ (JSC::JSVariableObject::symbolTablePut):
+ (JSC::JSVariableObject::symbolTablePutWithAttributes):
+ * runtime/JSWrapperObject.h:
+ (JSC::JSWrapperObject::internalValue):
+ (JSC::JSWrapperObject::setInternalValue):
+ * runtime/Lookup.cpp:
+ (JSC::setUpStaticFunctionSlot):
+ * runtime/Lookup.h:
+ (JSC::lookupPut):
+ * runtime/MathObject.cpp:
+ (JSC::mathProtoFuncAbs):
+ (JSC::mathProtoFuncACos):
+ (JSC::mathProtoFuncASin):
+ (JSC::mathProtoFuncATan):
+ (JSC::mathProtoFuncATan2):
+ (JSC::mathProtoFuncCeil):
+ (JSC::mathProtoFuncCos):
+ (JSC::mathProtoFuncExp):
+ (JSC::mathProtoFuncFloor):
+ (JSC::mathProtoFuncLog):
+ (JSC::mathProtoFuncMax):
+ (JSC::mathProtoFuncMin):
+ (JSC::mathProtoFuncPow):
+ (JSC::mathProtoFuncRandom):
+ (JSC::mathProtoFuncRound):
+ (JSC::mathProtoFuncSin):
+ (JSC::mathProtoFuncSqrt):
+ (JSC::mathProtoFuncTan):
+ * runtime/MathObject.h:
+ (JSC::MathObject::createStructure):
+ * runtime/NativeErrorConstructor.cpp:
+ (JSC::callNativeErrorConstructor):
+ * runtime/NumberConstructor.cpp:
+ (JSC::numberConstructorNaNValue):
+ (JSC::numberConstructorNegInfinity):
+ (JSC::numberConstructorPosInfinity):
+ (JSC::numberConstructorMaxValue):
+ (JSC::numberConstructorMinValue):
+ (JSC::callNumberConstructor):
+ * runtime/NumberConstructor.h:
+ (JSC::NumberConstructor::createStructure):
+ * runtime/NumberObject.cpp:
+ (JSC::NumberObject::getJSNumber):
+ (JSC::constructNumber):
+ * runtime/NumberObject.h:
+ * runtime/NumberPrototype.cpp:
+ (JSC::numberProtoFuncToString):
+ (JSC::numberProtoFuncToLocaleString):
+ (JSC::numberProtoFuncValueOf):
+ (JSC::numberProtoFuncToFixed):
+ (JSC::numberProtoFuncToExponential):
+ (JSC::numberProtoFuncToPrecision):
+ * runtime/ObjectConstructor.cpp:
+ (JSC::constructObject):
+ (JSC::callObjectConstructor):
+ * runtime/ObjectPrototype.cpp:
+ (JSC::objectProtoFuncValueOf):
+ (JSC::objectProtoFuncHasOwnProperty):
+ (JSC::objectProtoFuncIsPrototypeOf):
+ (JSC::objectProtoFuncDefineGetter):
+ (JSC::objectProtoFuncDefineSetter):
+ (JSC::objectProtoFuncLookupGetter):
+ (JSC::objectProtoFuncLookupSetter):
+ (JSC::objectProtoFuncPropertyIsEnumerable):
+ (JSC::objectProtoFuncToLocaleString):
+ (JSC::objectProtoFuncToString):
+ * runtime/ObjectPrototype.h:
+ * runtime/Operations.cpp:
+ (JSC::JSValue::equalSlowCase):
+ (JSC::JSValue::strictEqualSlowCase):
+ (JSC::throwOutOfMemoryError):
+ (JSC::jsAddSlowCase):
+ (JSC::jsTypeStringForValue):
+ (JSC::jsIsObjectType):
+ (JSC::jsIsFunctionType):
+ * runtime/Operations.h:
+ (JSC::JSValue::equal):
+ (JSC::JSValue::equalSlowCaseInline):
+ (JSC::JSValue::strictEqual):
+ (JSC::JSValue::strictEqualSlowCaseInline):
+ (JSC::jsLess):
+ (JSC::jsLessEq):
+ (JSC::jsAdd):
+ (JSC::countPrototypeChainEntriesAndCheckForProxies):
+ (JSC::resolveBase):
+ * runtime/PropertySlot.cpp:
+ (JSC::PropertySlot::functionGetter):
+ * runtime/PropertySlot.h:
+ (JSC::PropertySlot::PropertySlot):
+ (JSC::PropertySlot::getValue):
+ (JSC::PropertySlot::putValue):
+ (JSC::PropertySlot::setValueSlot):
+ (JSC::PropertySlot::setValue):
+ (JSC::PropertySlot::setCustom):
+ (JSC::PropertySlot::setCustomIndex):
+ (JSC::PropertySlot::slotBase):
+ (JSC::PropertySlot::setBase):
+ (JSC::PropertySlot::):
+ * runtime/Protect.h:
+ (JSC::gcProtect):
+ (JSC::gcUnprotect):
+ (JSC::ProtectedPtr::operator JSValue):
+ (JSC::ProtectedJSValue::ProtectedJSValue):
+ (JSC::ProtectedJSValue::get):
+ (JSC::ProtectedJSValue::operator JSValue):
+ (JSC::ProtectedJSValue::operator->):
+ (JSC::ProtectedJSValue::~ProtectedJSValue):
+ (JSC::ProtectedJSValue::operator=):
+ (JSC::operator==):
+ (JSC::operator!=):
+ * runtime/RegExpConstructor.cpp:
+ (JSC::RegExpConstructor::getBackref):
+ (JSC::RegExpConstructor::getLastParen):
+ (JSC::RegExpConstructor::getLeftContext):
+ (JSC::RegExpConstructor::getRightContext):
+ (JSC::regExpConstructorDollar1):
+ (JSC::regExpConstructorDollar2):
+ (JSC::regExpConstructorDollar3):
+ (JSC::regExpConstructorDollar4):
+ (JSC::regExpConstructorDollar5):
+ (JSC::regExpConstructorDollar6):
+ (JSC::regExpConstructorDollar7):
+ (JSC::regExpConstructorDollar8):
+ (JSC::regExpConstructorDollar9):
+ (JSC::regExpConstructorInput):
+ (JSC::regExpConstructorMultiline):
+ (JSC::regExpConstructorLastMatch):
+ (JSC::regExpConstructorLastParen):
+ (JSC::regExpConstructorLeftContext):
+ (JSC::regExpConstructorRightContext):
+ (JSC::RegExpConstructor::put):
+ (JSC::setRegExpConstructorInput):
+ (JSC::setRegExpConstructorMultiline):
+ (JSC::constructRegExp):
+ (JSC::callRegExpConstructor):
+ * runtime/RegExpConstructor.h:
+ (JSC::RegExpConstructor::createStructure):
+ (JSC::asRegExpConstructor):
+ * runtime/RegExpMatchesArray.h:
+ (JSC::RegExpMatchesArray::put):
+ * runtime/RegExpObject.cpp:
+ (JSC::regExpObjectGlobal):
+ (JSC::regExpObjectIgnoreCase):
+ (JSC::regExpObjectMultiline):
+ (JSC::regExpObjectSource):
+ (JSC::regExpObjectLastIndex):
+ (JSC::RegExpObject::put):
+ (JSC::setRegExpObjectLastIndex):
+ (JSC::RegExpObject::test):
+ (JSC::RegExpObject::exec):
+ (JSC::callRegExpObject):
+ * runtime/RegExpObject.h:
+ (JSC::RegExpObject::createStructure):
+ (JSC::asRegExpObject):
+ * runtime/RegExpPrototype.cpp:
+ (JSC::regExpProtoFuncTest):
+ (JSC::regExpProtoFuncExec):
+ (JSC::regExpProtoFuncCompile):
+ (JSC::regExpProtoFuncToString):
+ * runtime/StringConstructor.cpp:
+ (JSC::stringFromCharCodeSlowCase):
+ (JSC::stringFromCharCode):
+ (JSC::callStringConstructor):
+ * runtime/StringObject.cpp:
+ (JSC::StringObject::put):
+ * runtime/StringObject.h:
+ (JSC::StringObject::createStructure):
+ (JSC::asStringObject):
+ * runtime/StringObjectThatMasqueradesAsUndefined.h:
+ (JSC::StringObjectThatMasqueradesAsUndefined::createStructure):
+ * runtime/StringPrototype.cpp:
+ (JSC::stringProtoFuncReplace):
+ (JSC::stringProtoFuncToString):
+ (JSC::stringProtoFuncCharAt):
+ (JSC::stringProtoFuncCharCodeAt):
+ (JSC::stringProtoFuncConcat):
+ (JSC::stringProtoFuncIndexOf):
+ (JSC::stringProtoFuncLastIndexOf):
+ (JSC::stringProtoFuncMatch):
+ (JSC::stringProtoFuncSearch):
+ (JSC::stringProtoFuncSlice):
+ (JSC::stringProtoFuncSplit):
+ (JSC::stringProtoFuncSubstr):
+ (JSC::stringProtoFuncSubstring):
+ (JSC::stringProtoFuncToLowerCase):
+ (JSC::stringProtoFuncToUpperCase):
+ (JSC::stringProtoFuncLocaleCompare):
+ (JSC::stringProtoFuncBig):
+ (JSC::stringProtoFuncSmall):
+ (JSC::stringProtoFuncBlink):
+ (JSC::stringProtoFuncBold):
+ (JSC::stringProtoFuncFixed):
+ (JSC::stringProtoFuncItalics):
+ (JSC::stringProtoFuncStrike):
+ (JSC::stringProtoFuncSub):
+ (JSC::stringProtoFuncSup):
+ (JSC::stringProtoFuncFontcolor):
+ (JSC::stringProtoFuncFontsize):
+ (JSC::stringProtoFuncAnchor):
+ (JSC::stringProtoFuncLink):
+ * runtime/Structure.cpp:
+ (JSC::Structure::Structure):
+ (JSC::Structure::changePrototypeTransition):
+ * runtime/Structure.h:
+ (JSC::Structure::create):
+ (JSC::Structure::setPrototypeWithoutTransition):
+ (JSC::Structure::storedPrototype):
+
+2009-05-01 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam "That doesn't look like what I thought it looks like" Weinig.
+
+ Beefed up the JSValuePtr class and removed some non-JSValuePtr dependencies
+ on JSImmediate, in prepapration for making JSImmediate an implementation
+ detail of JSValuePtr.
+
+ SunSpider reports no change.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::compileFastArith_op_mod):
+ * runtime/JSGlobalObjectFunctions.cpp:
+ (JSC::globalFuncParseInt): Updated for interface changes.
+
+ * runtime/JSImmediate.h:
+ (JSC::JSValuePtr::JSValuePtr):
+ * runtime/JSValue.h:
+ (JSC::JSValuePtr::):
+ (JSC::jsImpossibleValue):
+ (JSC::jsNull):
+ (JSC::jsUndefined):
+ (JSC::jsBoolean):
+ (JSC::JSValuePtr::encode):
+ (JSC::JSValuePtr::decode):
+ (JSC::JSValuePtr::JSValuePtr):
+ (JSC::JSValuePtr::operator bool):
+ (JSC::JSValuePtr::operator==):
+ (JSC::JSValuePtr::operator!=):
+ (JSC::JSValuePtr::isUndefined):
+ (JSC::JSValuePtr::isNull): Changed jsImpossibleValue(), jsNull(),
+ jsUndefined(), and jsBoolean() to operate in terms of JSValuePtr instead
+ of JSImmediate.
+
+ * wtf/StdLibExtras.h:
+ (WTF::bitwise_cast): Fixed up for clarity.
+
+2009-04-30 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Bug fix for rdar:/6845379. If a case-insensitive regex contains
+ a character class containing a range with an upper bound of \uFFFF
+ the parser will infinite-loop whist adding other-case characters
+ for characters in the range that do have another case.
+
+ * yarr/RegexCompiler.cpp:
+ (JSC::Yarr::CharacterClassConstructor::putRange):
+
+2009-04-30 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ OPCODE_SAMPLING without CODEBLOCK_SAMPLING is currently broken,
+ since SamplingTool::Sample::isNull() checks the m_codeBlock
+ member (which is always null without CODEBLOCK_SAMPLING).
+
+ Restructure the checks so make this work again.
+
+ * bytecode/SamplingTool.cpp:
+ (JSC::SamplingTool::doRun):
+ * bytecode/SamplingTool.h:
+ (JSC::SamplingTool::Sample::isNull):
+
+2009-04-30 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ - Concatenate final three strings in simple replace case at one go
+
+ ~0.2% SunSpider speedup
+
+ * runtime/StringPrototype.cpp:
+ (JSC::stringProtoFuncReplace): Use new replaceRange helper instead of
+ taking substrings and concatenating three strings.
+ * runtime/UString.cpp:
+ (JSC::UString::replaceRange): New helper function.
+ * runtime/UString.h:
+
+2009-04-30 Geoffrey Garen <ggaren@apple.com>
+
+ Rubber Stamped by Gavin Barraclough.
+
+ Changed JSValueEncodedAsPtr* => EncodedJSValuePtr to support a non-pointer
+ encoding for JSValuePtrs.
+
+ * API/APICast.h:
+ (toJS):
+ * bytecompiler/BytecodeGenerator.h:
+ (JSC::BytecodeGenerator::JSValueHashTraits::constructDeletedValue):
+ (JSC::BytecodeGenerator::JSValueHashTraits::isDeletedValue):
+ * interpreter/Register.h:
+ (JSC::Register::):
+ * jit/JIT.cpp:
+ (JSC::):
+ * jit/JIT.h:
+ * jit/JITCode.h:
+ (JSC::):
+ * jit/JITStubs.cpp:
+ (JSC::JITStubs::cti_op_add):
+ (JSC::JITStubs::cti_op_pre_inc):
+ (JSC::JITStubs::cti_op_get_by_id_generic):
+ (JSC::JITStubs::cti_op_get_by_id):
+ (JSC::JITStubs::cti_op_get_by_id_second):
+ (JSC::JITStubs::cti_op_get_by_id_self_fail):
+ (JSC::JITStubs::cti_op_get_by_id_proto_list):
+ (JSC::JITStubs::cti_op_get_by_id_proto_list_full):
+ (JSC::JITStubs::cti_op_get_by_id_proto_fail):
+ (JSC::JITStubs::cti_op_get_by_id_array_fail):
+ (JSC::JITStubs::cti_op_get_by_id_string_fail):
+ (JSC::JITStubs::cti_op_instanceof):
+ (JSC::JITStubs::cti_op_del_by_id):
+ (JSC::JITStubs::cti_op_mul):
+ (JSC::JITStubs::cti_op_call_NotJSFunction):
+ (JSC::JITStubs::cti_op_resolve):
+ (JSC::JITStubs::cti_op_construct_NotJSConstruct):
+ (JSC::JITStubs::cti_op_get_by_val):
+ (JSC::JITStubs::cti_op_get_by_val_string):
+ (JSC::JITStubs::cti_op_get_by_val_byte_array):
+ (JSC::JITStubs::cti_op_sub):
+ (JSC::JITStubs::cti_op_lesseq):
+ (JSC::JITStubs::cti_op_negate):
+ (JSC::JITStubs::cti_op_resolve_base):
+ (JSC::JITStubs::cti_op_resolve_skip):
+ (JSC::JITStubs::cti_op_resolve_global):
+ (JSC::JITStubs::cti_op_div):
+ (JSC::JITStubs::cti_op_pre_dec):
+ (JSC::JITStubs::cti_op_not):
+ (JSC::JITStubs::cti_op_eq):
+ (JSC::JITStubs::cti_op_lshift):
+ (JSC::JITStubs::cti_op_bitand):
+ (JSC::JITStubs::cti_op_rshift):
+ (JSC::JITStubs::cti_op_bitnot):
+ (JSC::JITStubs::cti_op_mod):
+ (JSC::JITStubs::cti_op_less):
+ (JSC::JITStubs::cti_op_neq):
+ (JSC::JITStubs::cti_op_urshift):
+ (JSC::JITStubs::cti_op_bitxor):
+ (JSC::JITStubs::cti_op_bitor):
+ (JSC::JITStubs::cti_op_call_eval):
+ (JSC::JITStubs::cti_op_throw):
+ (JSC::JITStubs::cti_op_next_pname):
+ (JSC::JITStubs::cti_op_typeof):
+ (JSC::JITStubs::cti_op_is_undefined):
+ (JSC::JITStubs::cti_op_is_boolean):
+ (JSC::JITStubs::cti_op_is_number):
+ (JSC::JITStubs::cti_op_is_string):
+ (JSC::JITStubs::cti_op_is_object):
+ (JSC::JITStubs::cti_op_is_function):
+ (JSC::JITStubs::cti_op_stricteq):
+ (JSC::JITStubs::cti_op_nstricteq):
+ (JSC::JITStubs::cti_op_to_jsnumber):
+ (JSC::JITStubs::cti_op_in):
+ (JSC::JITStubs::cti_op_del_by_val):
+ (JSC::JITStubs::cti_vm_throw):
+ * jit/JITStubs.h:
+ * runtime/JSValue.h:
+ (JSC::JSValuePtr::encode):
+ (JSC::JSValuePtr::decode):
+
+2009-04-30 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver "Abandon Ship!" Hunt.
+
+ Fix a leak in Yarr.
+
+ All Disjunctions should be recorded in RegexPattern::m_disjunctions,
+ so that they can be freed at the end of compilation - copyDisjunction
+ is failing to do so.
+
+ * yarr/RegexCompiler.cpp:
+ (JSC::Yarr::RegexPatternConstructor::copyDisjunction):
+
+2009-04-30 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Add function to CallFrame for dumping the current JS caller
+
+ Added debug only method CallFrame::dumpCaller() that provide the call location
+ of the deepest currently executing JS function.
+
+ * interpreter/CallFrame.cpp:
+ (JSC::CallFrame::dumpCaller):
+ * interpreter/CallFrame.h:
+
+2009-04-30 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ - make BaseStrings have themselves as a base, instead of nothing, to remove common branches
+
+ ~0.7% SunSpider speedup
+
+ * runtime/UString.h:
+ (JSC::UString::Rep::Rep): For the constructor without a base, set self as base instead of null.
+ (JSC::UString::Rep::baseString): Just read m_baseString - no more branching.
+
+2009-04-30 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Two quick improvements to SamplingFlags mechanism.
+
+ SamplingFlags::ScopedFlag class to provide support for automagically
+ clearing a flag as it goes out of scope, and add a little more detail
+ to the output generated by the tool.
+
+ * bytecode/SamplingTool.cpp:
+ (JSC::SamplingFlags::stop):
+ * bytecode/SamplingTool.h:
+ (JSC::SamplingFlags::ScopedFlag::ScopedFlag):
+ (JSC::SamplingFlags::ScopedFlag::~ScopedFlag):
+
+2009-04-30 Adam Roben <aroben@apple.com>
+
+ Restore build event steps that were truncated in r43082
+
+ Rubber-stamped by Steve Falkenburg.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops:
+ * JavaScriptCore.vcproj/jsc/jscCommon.vsprops:
+ * JavaScriptCore.vcproj/testapi/testapiCommon.vsprops:
+ Re-copied the command lines for the build events from the pre-r43082
+ .vcproj files.
+
+ * JavaScriptCore.vcproj/jsc/jsc.vcproj: Removed an unnecessary
+ attribute.
+
+2009-04-30 Adam Roben <aroben@apple.com>
+
+ Move settings from .vcproj files to .vsprops files within the
+ JavaScriptCore directory
+
+ Moving the settings to a .vsprops file means that we will only have to
+ change a single setting to affect all configurations, instead of one
+ setting per configuration.
+
+ Reviewed by Steve Falkenburg.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * JavaScriptCore.vcproj/jsc/jsc.vcproj:
+ * JavaScriptCore.vcproj/testapi/testapi.vcproj:
+ Moved settings from these files to the new .vsprops files. Note that
+ testapi.vcproj had a lot of overrides of default settings that were
+ the same as the defaults, which I've removed.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops: Added.
+ * JavaScriptCore.vcproj/WTF/WTFCommon.vsprops: Added.
+ * JavaScriptCore.vcproj/jsc/jscCommon.vsprops: Added.
+ * JavaScriptCore.vcproj/testapi/testapiCommon.vsprops: Added.
+
+2009-04-30 Dimitri Glazkov <dglazkov@chromium.org>
+
+ Reviewed by Timothy Hatcher.
+
+ https://bugs.webkit.org/show_bug.cgi?id=25470
+ Extend the cover of ENABLE_JAVASCRIPT_DEBUGGER to profiler.
+
+ * Configurations/FeatureDefines.xcconfig: Added ENABLE_JAVASCRIPT_DEBUGGER define.
+
+2009-04-30 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Alexey Proskuryakov.
+
+ - speed up string concatenation by reorganizing some simple cases
+
+ 0.7% SunSpider speedup
+
+ * runtime/UString.cpp:
+ (JSC::concatenate): Put fast case for appending a single character
+ before the empty string special cases; streamline code a bit to
+ delay computing values that are not needed in the fast path.
+
+2009-04-30 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Add SamplingFlags mechanism.
+
+ This mechanism allows fine-grained JSC and JavaScript program aware
+ performance measurement. The mechanism provides a set of 32 flags,
+ numbered #1..#32. Flag #16 is initially set, and all other flags
+ are cleared. Flags may be set and cleared from within
+
+ Enable by setting ENABLE_SAMPLING_FLAGS to 1 in wtf/Platform.h.
+ Disabled by default, no performance impact. Flags may be modified
+ by calling SamplingFlags::setFlag() and SamplingFlags::clearFlag()
+ from within JSC implementation, or by calling setSamplingFlag() and
+ clearSamplingFlag() from JavaScript.
+
+ The flags are sampled with a frequency of 10000Hz, and the highest
+ set flag in recorded, allowing multiple events to be measured (with
+ the highest flag number representing the highest priority).
+
+ Disabled by default; no performance impact.
+
+ * JavaScriptCore.exp:
+ * bytecode/SamplingTool.cpp:
+ (JSC::SamplingFlags::sample):
+ (JSC::SamplingFlags::start):
+ (JSC::SamplingFlags::stop):
+ (JSC::SamplingThread::threadStartFunc):
+ (JSC::SamplingThread::start):
+ (JSC::SamplingThread::stop):
+ (JSC::ScopeSampleRecord::sample):
+ (JSC::SamplingTool::doRun):
+ (JSC::SamplingTool::sample):
+ (JSC::SamplingTool::start):
+ (JSC::SamplingTool::stop):
+ * bytecode/SamplingTool.h:
+ (JSC::SamplingFlags::setFlag):
+ (JSC::SamplingFlags::clearFlag):
+ (JSC::SamplingTool::SamplingTool):
+ * jsc.cpp:
+ (GlobalObject::GlobalObject):
+ (functionSetSamplingFlag):
+ (functionClearSamplingFlag):
+ (runWithScripts):
+ * wtf/Platform.h:
+
+2009-04-29 Sam Weinig <sam@webkit.org>
+
+ Another attempt to fix the windows build.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-04-29 Sam Weinig <sam@webkit.org>
+
+ Try and fix the windows build.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-04-29 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver "Peg-Leg" Hunt.
+
+ Coallesce input checking and reduce futzing with the index position
+ between alternatives and iterations of the main loop of a regex,
+ when run in YARR.
+
+ Consider the following regex: /foo|bar/
+
+ Prior to this patch, this will be implemented something like this pseudo-code description:
+
+ loop:
+ check_for_available_input(3) // this increments the index by 3, for the first alterantive.
+ if (available) { test "foo" }
+ decrement_index(3)
+ check_for_available_input(3) // this increments the index by 3, for the second alterantive.
+ if (available) { test "bar" }
+ decrement_index(3)
+ check_for_available_input(1) // can we loop again?
+ if (available) { goto loop }
+
+ With these changes it will look more like this:
+
+ check_for_available_input(3) // this increments the index by 3, for the first alterantive.
+ if (!available) { goto fail }
+ loop:
+ test "foo"
+ test "bar"
+ check_for_available_input(1) // can we loop again?
+ if (available) { goto loop }
+ fail:
+
+
+ This gives about a 5% gain on v8-regex, no change on Sunspider.
+
+ * yarr/RegexJIT.cpp:
+ (JSC::Yarr::RegexGenerator::TermGenerationState::linkAlternativeBacktracksTo):
+ (JSC::Yarr::RegexGenerator::generateDisjunction):
+
+2009-04-29 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Clean up ArgList to be a trivial type
+
+ Separate out old ArgList logic to handle buffering and marking arguments
+ into a distinct MarkedArgumentBuffer type. ArgList becomes a trivial
+ struct of a pointer and length.
+
+ * API/JSObjectRef.cpp:
+ (JSObjectMakeFunction):
+ (JSObjectMakeArray):
+ (JSObjectMakeDate):
+ (JSObjectMakeError):
+ (JSObjectMakeRegExp):
+ (JSObjectCallAsFunction):
+ (JSObjectCallAsConstructor):
+ * JavaScriptCore.exp:
+ * interpreter/CallFrame.h:
+ (JSC::ExecState::emptyList):
+ * runtime/ArgList.cpp:
+ (JSC::ArgList::getSlice):
+ (JSC::MarkedArgumentBuffer::markLists):
+ (JSC::MarkedArgumentBuffer::slowAppend):
+ * runtime/ArgList.h:
+ (JSC::MarkedArgumentBuffer::MarkedArgumentBuffer):
+ (JSC::MarkedArgumentBuffer::~MarkedArgumentBuffer):
+ (JSC::ArgList::ArgList):
+ (JSC::ArgList::at):
+ (JSC::ArgList::isEmpty):
+ (JSC::ArgList::size):
+ (JSC::ArgList::begin):
+ (JSC::ArgList::end):
+ * runtime/Arguments.cpp:
+ (JSC::Arguments::fillArgList):
+ * runtime/Arguments.h:
+ * runtime/ArrayPrototype.cpp:
+ (JSC::arrayProtoFuncConcat):
+ (JSC::arrayProtoFuncPush):
+ (JSC::arrayProtoFuncSort):
+ (JSC::arrayProtoFuncFilter):
+ (JSC::arrayProtoFuncMap):
+ (JSC::arrayProtoFuncEvery):
+ (JSC::arrayProtoFuncForEach):
+ (JSC::arrayProtoFuncSome):
+ (JSC::arrayProtoFuncReduce):
+ (JSC::arrayProtoFuncReduceRight):
+ * runtime/Collector.cpp:
+ (JSC::Heap::collect):
+ * runtime/Collector.h:
+ (JSC::Heap::markListSet):
+ * runtime/CommonIdentifiers.h:
+ * runtime/Error.cpp:
+ (JSC::Error::create):
+ * runtime/FunctionPrototype.cpp:
+ (JSC::functionProtoFuncApply):
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::JSArray):
+ (JSC::AVLTreeAbstractorForArrayCompare::compare_key_key):
+ (JSC::JSArray::fillArgList):
+ (JSC::constructArray):
+ * runtime/JSArray.h:
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData):
+ * runtime/JSGlobalData.h:
+ * runtime/JSObject.cpp:
+ (JSC::JSObject::put):
+ * runtime/StringConstructor.cpp:
+ (JSC::stringFromCharCodeSlowCase):
+ * runtime/StringPrototype.cpp:
+ (JSC::stringProtoFuncReplace):
+ (JSC::stringProtoFuncConcat):
+ (JSC::stringProtoFuncMatch):
+
+2009-04-29 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Sam Weinig.
+
+ https://bugs.webkit.org/show_bug.cgi?id=25334
+
+ Fix Qt build when ENABLE_JIT is explicitly set to 1
+ to overrule defaults.
+
+ * JavaScriptCore.pri:
+
+2009-04-29 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Steve Falkenburg.
+
+ Crash in profiler due to incorrect assuming displayName would be a string.
+
+ Fixed by adding a type guard.
+
+ * runtime/InternalFunction.cpp:
+ (JSC::InternalFunction::displayName):
+
+2009-04-28 Geoffrey Garen <ggaren@apple.com>
+
+ Rubber stamped by Beth Dakin.
+
+ Removed scaffolding supporting dynamically converting between 32bit and
+ 64bit value representations.
+
+ * API/JSCallbackConstructor.cpp:
+ (JSC::constructJSCallback):
+ * API/JSCallbackFunction.cpp:
+ (JSC::JSCallbackFunction::call):
+ * API/JSCallbackObjectFunctions.h:
+ (JSC::::construct):
+ (JSC::::call):
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::dump):
+ * bytecode/CodeBlock.h:
+ (JSC::CodeBlock::getConstant):
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::emitEqualityOp):
+ * interpreter/CallFrame.cpp:
+ (JSC::CallFrame::thisValue):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::callEval):
+ (JSC::Interpreter::throwException):
+ (JSC::Interpreter::createExceptionScope):
+ (JSC::Interpreter::privateExecute):
+ (JSC::Interpreter::retrieveArguments):
+ * interpreter/Register.h:
+ (JSC::Register::):
+ (JSC::Register::Register):
+ (JSC::Register::jsValue):
+ (JSC::Register::marked):
+ (JSC::Register::mark):
+ (JSC::Register::i):
+ (JSC::Register::activation):
+ (JSC::Register::arguments):
+ (JSC::Register::callFrame):
+ (JSC::Register::codeBlock):
+ (JSC::Register::function):
+ (JSC::Register::propertyNameIterator):
+ (JSC::Register::scopeChain):
+ (JSC::Register::vPC):
+ * jit/JITStubs.cpp:
+ (JSC::JITStubs::cti_op_call_NotJSFunction):
+ (JSC::JITStubs::cti_op_load_varargs):
+ (JSC::JITStubs::cti_op_call_eval):
+ * jsc.cpp:
+ (functionPrint):
+ (functionDebug):
+ (functionRun):
+ (functionLoad):
+ * runtime/ArgList.h:
+ (JSC::ArgList::at):
+ * runtime/Arguments.cpp:
+ (JSC::Arguments::copyToRegisters):
+ (JSC::Arguments::fillArgList):
+ (JSC::Arguments::getOwnPropertySlot):
+ * runtime/ArrayConstructor.cpp:
+ (JSC::constructArrayWithSizeQuirk):
+ * runtime/ArrayPrototype.cpp:
+ (JSC::arrayProtoFuncJoin):
+ (JSC::arrayProtoFuncConcat):
+ (JSC::arrayProtoFuncPush):
+ (JSC::arrayProtoFuncSlice):
+ (JSC::arrayProtoFuncSort):
+ (JSC::arrayProtoFuncSplice):
+ (JSC::arrayProtoFuncUnShift):
+ (JSC::arrayProtoFuncFilter):
+ (JSC::arrayProtoFuncMap):
+ (JSC::arrayProtoFuncEvery):
+ (JSC::arrayProtoFuncForEach):
+ (JSC::arrayProtoFuncSome):
+ (JSC::arrayProtoFuncReduce):
+ (JSC::arrayProtoFuncReduceRight):
+ (JSC::arrayProtoFuncIndexOf):
+ (JSC::arrayProtoFuncLastIndexOf):
+ * runtime/BooleanConstructor.cpp:
+ (JSC::constructBoolean):
+ (JSC::callBooleanConstructor):
+ * runtime/DateConstructor.cpp:
+ (JSC::constructDate):
+ (JSC::dateParse):
+ (JSC::dateUTC):
+ * runtime/DatePrototype.cpp:
+ (JSC::formatLocaleDate):
+ (JSC::fillStructuresUsingTimeArgs):
+ (JSC::fillStructuresUsingDateArgs):
+ (JSC::dateProtoFuncSetTime):
+ (JSC::dateProtoFuncSetYear):
+ * runtime/ErrorConstructor.cpp:
+ (JSC::constructError):
+ * runtime/FunctionConstructor.cpp:
+ (JSC::constructFunction):
+ * runtime/FunctionPrototype.cpp:
+ (JSC::functionProtoFuncApply):
+ (JSC::functionProtoFuncCall):
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::JSArray):
+ (JSC::constructArray):
+ * runtime/JSArray.h:
+ * runtime/JSGlobalObjectFunctions.cpp:
+ (JSC::encode):
+ (JSC::decode):
+ (JSC::globalFuncEval):
+ (JSC::globalFuncParseInt):
+ (JSC::globalFuncParseFloat):
+ (JSC::globalFuncIsNaN):
+ (JSC::globalFuncIsFinite):
+ (JSC::globalFuncEscape):
+ (JSC::globalFuncUnescape):
+ (JSC::globalFuncJSCPrint):
+ * runtime/MathObject.cpp:
+ (JSC::mathProtoFuncAbs):
+ (JSC::mathProtoFuncACos):
+ (JSC::mathProtoFuncASin):
+ (JSC::mathProtoFuncATan):
+ (JSC::mathProtoFuncATan2):
+ (JSC::mathProtoFuncCeil):
+ (JSC::mathProtoFuncCos):
+ (JSC::mathProtoFuncExp):
+ (JSC::mathProtoFuncFloor):
+ (JSC::mathProtoFuncLog):
+ (JSC::mathProtoFuncMax):
+ (JSC::mathProtoFuncMin):
+ (JSC::mathProtoFuncPow):
+ (JSC::mathProtoFuncRound):
+ (JSC::mathProtoFuncSin):
+ (JSC::mathProtoFuncSqrt):
+ (JSC::mathProtoFuncTan):
+ * runtime/NativeErrorConstructor.cpp:
+ (JSC::NativeErrorConstructor::construct):
+ * runtime/NumberConstructor.cpp:
+ (JSC::constructWithNumberConstructor):
+ (JSC::callNumberConstructor):
+ * runtime/NumberPrototype.cpp:
+ (JSC::numberProtoFuncToString):
+ (JSC::numberProtoFuncToFixed):
+ (JSC::numberProtoFuncToExponential):
+ (JSC::numberProtoFuncToPrecision):
+ * runtime/ObjectConstructor.cpp:
+ (JSC::constructObject):
+ * runtime/ObjectPrototype.cpp:
+ (JSC::objectProtoFuncHasOwnProperty):
+ (JSC::objectProtoFuncIsPrototypeOf):
+ (JSC::objectProtoFuncDefineGetter):
+ (JSC::objectProtoFuncDefineSetter):
+ (JSC::objectProtoFuncLookupGetter):
+ (JSC::objectProtoFuncLookupSetter):
+ (JSC::objectProtoFuncPropertyIsEnumerable):
+ * runtime/PropertySlot.h:
+ (JSC::PropertySlot::getValue):
+ * runtime/RegExpConstructor.cpp:
+ (JSC::constructRegExp):
+ * runtime/RegExpObject.cpp:
+ (JSC::RegExpObject::match):
+ * runtime/RegExpPrototype.cpp:
+ (JSC::regExpProtoFuncCompile):
+ * runtime/StringConstructor.cpp:
+ (JSC::stringFromCharCodeSlowCase):
+ (JSC::stringFromCharCode):
+ (JSC::constructWithStringConstructor):
+ (JSC::callStringConstructor):
+ * runtime/StringPrototype.cpp:
+ (JSC::stringProtoFuncReplace):
+ (JSC::stringProtoFuncCharAt):
+ (JSC::stringProtoFuncCharCodeAt):
+ (JSC::stringProtoFuncConcat):
+ (JSC::stringProtoFuncIndexOf):
+ (JSC::stringProtoFuncLastIndexOf):
+ (JSC::stringProtoFuncMatch):
+ (JSC::stringProtoFuncSearch):
+ (JSC::stringProtoFuncSlice):
+ (JSC::stringProtoFuncSplit):
+ (JSC::stringProtoFuncSubstr):
+ (JSC::stringProtoFuncSubstring):
+ (JSC::stringProtoFuncLocaleCompare):
+ (JSC::stringProtoFuncFontcolor):
+ (JSC::stringProtoFuncFontsize):
+ (JSC::stringProtoFuncAnchor):
+ (JSC::stringProtoFuncLink):
+
+2009-04-28 David Kilzer <ddkilzer@apple.com>
+
+ A little more hardening for UString
+
+ Reviewed by Maciej Stachowiak.
+
+ Revised fix for <rdar://problem/5861045> in r42644.
+
+ * runtime/UString.cpp:
+ (JSC::newCapacityWithOverflowCheck): Added.
+ (JSC::concatenate): Used newCapacityWithOverflowCheck().
+ (JSC::UString::append): Ditto.
+
+2009-04-28 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Bring back r42969, this time with correct codegen
+
+ Add logic to the codegen for right shift to avoid jumping to a helper function
+ when shifting a small floating point value.
+
+ * jit/JITArithmetic.cpp:
+ (isSSE2Present):
+ (JSC::JIT::compileFastArith_op_rshift):
+ (JSC::JIT::compileFastArithSlow_op_rshift):
+
+2009-04-28 Kevin Ollivier <kevino@theolliviers.com>
+
+ wxMSW build fix. Switch JSCore build back to static.
+
+ * API/JSBase.h:
+ * config.h:
+ * jscore.bkl:
+
+2009-04-28 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by NOBODY (Build fix).
+
+ Roll out r42969, due to hangs in build bot.
+
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::compileFastArith_op_rshift):
+ (JSC::JIT::compileFastArithSlow_op_rshift):
+ (JSC::isSSE2Present):
+
+2009-04-28 Xan Lopez <xlopez@igalia.com>
+
+ Unreviewed: fix distcheck build, add (even more) missing files to list.
+
+ * GNUmakefile.am:
+
+2009-04-28 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Improve performance of string indexing
+
+ Add a cti_get_by_val_string function to specialise indexing into a string object.
+ This gives us a slight performance win on a number of string tests.
+
+ * jit/JITStubs.cpp:
+ (JSC::JITStubs::cti_op_get_by_val):
+ (JSC::JITStubs::cti_op_get_by_val_string):
+ * jit/JITStubs.h:
+
+2009-04-28 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Improve performance of right shifts of large or otherwise floating point values.
+
+ Add logic to the codegen for right shift to avoid jumping to a helper function
+ when shifting a small floating point value.
+
+ * jit/JITArithmetic.cpp:
+ (isSSE2Present): Moved to the head of file.
+ (JSC::JIT::compileFastArith_op_rshift):
+ (JSC::JIT::compileFastArithSlow_op_rshift):
+
+2009-04-28 Xan Lopez <xlopez@igalia.com>
+
+ Unreviewed: fix distcheck build, add (more) missing files to list.
+
+ * GNUmakefile.am:
+
+2009-04-28 Xan Lopez <xlopez@igalia.com>
+
+ Unreviewed: fix distcheck build, add missing header to file list.
+
+ * GNUmakefile.am:
+
+2009-04-28 Gavin Barraclough <barraclough@apple.com>
+
+ Rubber stamped by Maciej "Henry Morgan" Stachowiak.
+
+ Enable YARR.
+ (Again.)
+
+ * wtf/Platform.h:
+
+2009-04-27 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Tweak a loop condition to keep GCC happy,
+ some GCCs seem to be having issues with this. :-/
+
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::breakTarget):
+ * wtf/Platform.h:
+
+2009-04-27 Adam Roben <aroben@apple.com>
+
+ Windows Debug build fix
+
+ Not sure why the buildbots weren't affected by this problem.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Let VS
+ re-order the file list, and added JavaScriptCore[_debug].def to the
+ project. This was not necessary for the fix, but made making the fix
+ easier.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+ Removed a function that no longer exists.
+
+2009-04-26 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Weinig Sam.
+
+ Fix for https://bugs.webkit.org/show_bug.cgi?id=25416
+ "Cached prototype accesses unsafely hoist property storage load above structure checks."
+
+ Do not hoist the load of the pointer to the property storage array.
+
+ No performance impact.
+
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::privateCompileGetByIdProto):
+ (JSC::JIT::privateCompileGetByIdProtoList):
+
+2009-04-26 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoffrey "Gaffe or energy?" Garen.
+
+ Randomize address requested by ExecutableAllocatorFixedVMPool.
+
+ * jit/ExecutableAllocatorFixedVMPool.cpp:
+ (JSC::FixedVMPoolAllocator::FixedVMPoolAllocator):
+
+2009-04-26 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ Remove scons-based build system.
+
+ * JavaScriptCore.scons: Removed.
+
+2009-04-25 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by NOBODY (Buildfix).
+
+ Make HAVE_MADV_FREE darwin only for now
+
+ * wtf/Platform.h:
+
+2009-04-25 Jan Michael Alonzo <jmalonzo@webkit.org>
+
+ Reviewed by Oliver Hunt.
+
+ Gtk build fix - check if we have MADV_FREE before using it.
+
+ * interpreter/RegisterFile.cpp:
+ (JSC::RegisterFile::releaseExcessCapacity):
+ * wtf/Platform.h:
+
+2009-04-24 Kevin Ollivier <kevino@theolliviers.com>
+
+ wx build fix. Switching JSCore from a static lib to a dynamic lib
+ to match the Apple build and fix symbol exports.
+
+ * jscore.bkl:
+
+2009-04-24 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Rubber-stamped by Mark Rowe.
+
+ https://bugs.webkit.org/show_bug.cgi?id=25337
+ Move ThreadingQt.cpp under the qt directory.
+
+ * JavaScriptCore.pri:
+ * wtf/ThreadingQt.cpp: Removed.
+ * wtf/qt/ThreadingQt.cpp: Copied from JavaScriptCore/wtf/ThreadingQt.cpp.
+
+2009-04-24 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Rubber-stamped by Mark Rowe.
+
+ https://bugs.webkit.org/show_bug.cgi?id=25338
+ Move ThreadingGtk.cpp under the gtk directory.
+
+ * GNUmakefile.am:
+ * wtf/ThreadingGtk.cpp: Removed.
+ * wtf/gtk/ThreadingGtk.cpp: Copied from JavaScriptCore/wtf/ThreadingGtk.cpp.
+
+2009-04-24 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam "Wesley" Weinig.
+
+ Improve performance to YARR interpreter.
+ (From about 3x slower than PCRE on regex-dna to about 30% slower).
+
+ * yarr/RegexCompiler.cpp:
+ (JSC::Yarr::RegexPatternConstructor::setupAlternativeOffsets):
+ * yarr/RegexInterpreter.cpp:
+ (JSC::Yarr::Interpreter::checkCharacter):
+ (JSC::Yarr::Interpreter::checkCasedCharacter):
+ (JSC::Yarr::Interpreter::backtrackPatternCharacter):
+ (JSC::Yarr::Interpreter::backtrackPatternCasedCharacter):
+ (JSC::Yarr::Interpreter::matchParentheticalAssertionBegin):
+ (JSC::Yarr::Interpreter::matchParentheticalAssertionEnd):
+ (JSC::Yarr::Interpreter::backtrackParentheticalAssertionBegin):
+ (JSC::Yarr::Interpreter::backtrackParentheticalAssertionEnd):
+ (JSC::Yarr::Interpreter::matchDisjunction):
+ (JSC::Yarr::Interpreter::interpret):
+ (JSC::Yarr::ByteCompiler::atomPatternCharacter):
+ (JSC::Yarr::ByteCompiler::atomParenthesesSubpatternBegin):
+ (JSC::Yarr::ByteCompiler::atomParentheticalAssertionBegin):
+ (JSC::Yarr::ByteCompiler::closeAlternative):
+ (JSC::Yarr::ByteCompiler::closeBodyAlternative):
+ (JSC::Yarr::ByteCompiler::atomParenthesesEnd):
+ (JSC::Yarr::ByteCompiler::regexBegin):
+ (JSC::Yarr::ByteCompiler::regexEnd):
+ (JSC::Yarr::ByteCompiler::alterantiveBodyDisjunction):
+ (JSC::Yarr::ByteCompiler::alterantiveDisjunction):
+ (JSC::Yarr::ByteCompiler::emitDisjunction):
+ * yarr/RegexInterpreter.h:
+ (JSC::Yarr::ByteTerm::):
+ (JSC::Yarr::ByteTerm::ByteTerm):
+ (JSC::Yarr::ByteTerm::BodyAlternativeBegin):
+ (JSC::Yarr::ByteTerm::BodyAlternativeDisjunction):
+ (JSC::Yarr::ByteTerm::BodyAlternativeEnd):
+ (JSC::Yarr::ByteTerm::AlternativeBegin):
+ (JSC::Yarr::ByteTerm::AlternativeDisjunction):
+ (JSC::Yarr::ByteTerm::AlternativeEnd):
+ (JSC::Yarr::ByteTerm::SubpatternBegin):
+ (JSC::Yarr::ByteTerm::SubpatternEnd):
+ * yarr/RegexJIT.cpp:
+ (JSC::Yarr::RegexGenerator::generateParentheticalAssertion):
+ * yarr/RegexPattern.h:
+
+2009-04-24 Rob Raguet-Schofield <ragfield@gmail.com>
+
+ Rubber-stamped by Mark Rowe.
+
+ * wtf/CurrentTime.h: Fix a typo in a comment.
+
+2009-04-24 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by NOBODY (Build fix).
+
+ Add reinterpret_cast
+
+ * interpreter/RegisterFile.cpp:
+ (JSC::RegisterFile::releaseExcessCapacity):
+
+2009-04-23 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ <rdar://problem/6050421> JavaScript register file should remap to release physical pages accumulated during deep recursion
+
+ We now track the maximum extent of the RegisterFile, and when we reach the final
+ return from JS (so the stack portion of the registerfile becomes empty) we see
+ if that extent is greater than maxExcessCapacity. If it is we use madvise or
+ VirtualFree to release the physical pages that were backing the excess.
+
+ * interpreter/RegisterFile.cpp:
+ (JSC::RegisterFile::releaseExcessCapacity):
+ * interpreter/RegisterFile.h:
+ (JSC::RegisterFile::RegisterFile):
+ (JSC::RegisterFile::shrink):
+ (JSC::RegisterFile::grow):
+
+2009-04-23 Mark Rowe <mrowe@apple.com>
+
+ With great sadness and a heavy heart I switch us back from YARR to WREC in
+ order to restore greenness to the world once more.
+
+ * wtf/Platform.h:
+
+2009-04-23 Mark Rowe <mrowe@apple.com>
+
+ More Windows build fixage.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-04-23 Mark Rowe <mrowe@apple.com>
+
+ Attempt to fix the Windows build.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: Remove a symbol that no longer exists.
+
+2009-04-23 Francisco Tolmasky <francisco@280north.com>
+
+ BUG 24604: WebKit profiler reports incorrect total times
+ <https://bugs.webkit.org/show_bug.cgi?id=24604>
+
+ Reviewed by Timothy Hatcher and Kevin McCullough.
+
+ * JavaScriptCore.exp:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * profiler/CallIdentifier.h:
+ (JSC::CallIdentifier::Hash::hash):
+ (JSC::CallIdentifier::Hash::equal):
+ (JSC::CallIdentifier::hash):
+ (WTF::):
+ * profiler/HeavyProfile.cpp: Removed.
+ * profiler/HeavyProfile.h: Removed.
+ * profiler/Profile.cpp: No more need for TreeProfile/HeavyProfile
+ (JSC::Profile::create):
+ * profiler/Profile.h:
+ * profiler/ProfileNode.cpp:
+ * profiler/ProfileNode.h:
+ * profiler/TreeProfile.cpp: Removed.
+ * profiler/TreeProfile.h: Removed.
+
+2009-04-23 Gavin Barraclough <barraclough@apple.com>
+
+ Not Reviewed.
+
+ Speculative Windows build fix II.
+
+ * yarr/RegexInterpreter.cpp:
+
+2009-04-23 Gavin Barraclough <barraclough@apple.com>
+
+ Not Reviewed.
+
+ Speculative Windows build fix.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * runtime/RegExp.cpp:
+
+2009-04-23 Gavin Barraclough <barraclough@apple.com>
+
+ Rubber stamped by salty sea dogs Sam & Geoff.
+
+ Enable YARR_JIT by default (where supported), replacing WREC.
+
+ * wtf/Platform.h:
+
+2009-04-23 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff "Dread Pirate Roberts" Garen.
+
+ Various small fixes to YARR JIT, in preparation for enabling it by default.
+
+ * Correctly index into the callframe when storing restart addresses for
+ nested alternatives.
+ * Allow backtracking back into matched alternatives of parentheses.
+ * Fix callframe offset calculation for parenthetical assertions.
+ * When a set of parenthese are quantified with a fixed and variable portion,
+ and the variable portion is quantified once, this should not reset the
+ pattern match on failure to match (the last match from the firxed portion
+ should be preserved).
+ * Up the pattern size limit to match PCRE's new limit.
+ * Unlclosed parentheses should be reported with the message "missing )".
+
+ * wtf/Platform.h:
+ * yarr/RegexCompiler.cpp:
+ (JSC::Yarr::RegexPatternConstructor::quantifyAtom):
+ (JSC::Yarr::RegexPatternConstructor::setupAlternativeOffsets):
+ * yarr/RegexInterpreter.cpp:
+ (JSC::Yarr::Interpreter::matchParentheses):
+ (JSC::Yarr::Interpreter::backtrackParentheses):
+ (JSC::Yarr::ByteCompiler::emitDisjunction):
+ * yarr/RegexJIT.cpp:
+ (JSC::Yarr::RegexGenerator::loadFromFrameAndJump):
+ (JSC::Yarr::RegexGenerator::generateParenthesesDisjunction):
+ (JSC::Yarr::RegexGenerator::generateParentheticalAssertion):
+ (JSC::Yarr::RegexGenerator::generateTerm):
+ (JSC::Yarr::executeRegex):
+ * yarr/RegexParser.h:
+ (JSC::Yarr::Parser::):
+ (JSC::Yarr::Parser::parseTokens):
+ (JSC::Yarr::Parser::parse):
+ * yarr/RegexPattern.h:
+ (JSC::Yarr::PatternTerm::):
+ (JSC::Yarr::PatternTerm::PatternTerm):
+
+2009-04-22 Mark Rowe <mrowe@apple.com>
+
+ Rubber-stamped by Gavin Barraclough.
+
+ Add the m_ prefix on FixedVMPoolAllocator's member variables, and fix typos in a few comments.
+
+ * jit/ExecutableAllocatorFixedVMPool.cpp:
+ (JSC::FixedVMPoolAllocator::addToFreeList):
+ (JSC::FixedVMPoolAllocator::coalesceFreeSpace):
+ (JSC::FixedVMPoolAllocator::FixedVMPoolAllocator):
+ (JSC::FixedVMPoolAllocator::alloc):
+ (JSC::FixedVMPoolAllocator::free):
+ (JSC::FixedVMPoolAllocator::isWithinVMPool):
+
+2009-04-22 Mark Rowe <mrowe@apple.com>
+
+ Rubber-stamped by Gavin Barraclough.
+
+ Add some assertions to FixedVMPoolAllocator to guard against cases where we
+ attempt to free memory that didn't originate from the pool, or we attempt to
+ hand out a bogus address from alloc.
+
+ * jit/ExecutableAllocatorFixedVMPool.cpp:
+ (JSC::FixedVMPoolAllocator::release):
+ (JSC::FixedVMPoolAllocator::FixedVMPoolAllocator):
+ (JSC::FixedVMPoolAllocator::alloc):
+ (JSC::FixedVMPoolAllocator::free):
+ (JSC::FixedVMPoolAllocator::isWithinVMPool):
+
+2009-04-22 Gavin Barraclough <barraclough@apple.com>
+
+ Rubber stamped by Sam "Blackbeard" Weinig.
+
+ Although pirates do spell the word 'generate' as 'genertate',
+ webkit developers do not. Fixertate.
+
+ * yarr/RegexJIT.cpp:
+ (JSC::Yarr::RegexGenerator::generateAssertionBOL):
+ (JSC::Yarr::RegexGenerator::generateAssertionEOL):
+ (JSC::Yarr::RegexGenerator::generateAssertionWordBoundary):
+ (JSC::Yarr::RegexGenerator::generatePatternCharacterSingle):
+ (JSC::Yarr::RegexGenerator::generatePatternCharacterPair):
+ (JSC::Yarr::RegexGenerator::generatePatternCharacterFixed):
+ (JSC::Yarr::RegexGenerator::generatePatternCharacterGreedy):
+ (JSC::Yarr::RegexGenerator::generatePatternCharacterNonGreedy):
+ (JSC::Yarr::RegexGenerator::generateCharacterClassSingle):
+ (JSC::Yarr::RegexGenerator::generateCharacterClassFixed):
+ (JSC::Yarr::RegexGenerator::generateCharacterClassGreedy):
+ (JSC::Yarr::RegexGenerator::generateCharacterClassNonGreedy):
+ (JSC::Yarr::RegexGenerator::generateTerm):
+
+2009-04-22 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam "Blackbeard" Weinig.
+
+ Improvements to YARR JIT. This patch expands support in three key areas:
+ * Add (temporary) support for falling back to PCRE for expressions not supported.
+ * Add support for x86_64 and Windows.
+ * Add support for singly quantified parentheses (? and ??), alternatives within
+ parentheses, and parenthetical assertions.
+
+ * runtime/RegExp.cpp:
+ (JSC::RegExp::match):
+ * yarr/RegexJIT.cpp:
+ (JSC::Yarr::RegexGenerator::storeToFrame):
+ (JSC::Yarr::RegexGenerator::storeToFrameWithPatch):
+ (JSC::Yarr::RegexGenerator::loadFromFrameAndJump):
+ (JSC::Yarr::RegexGenerator::AlternativeBacktrackRecord::AlternativeBacktrackRecord):
+ (JSC::Yarr::RegexGenerator::TermGenerationState::resetAlternative):
+ (JSC::Yarr::RegexGenerator::TermGenerationState::resetTerm):
+ (JSC::Yarr::RegexGenerator::TermGenerationState::jumpToBacktrack):
+ (JSC::Yarr::RegexGenerator::TermGenerationState::plantJumpToBacktrackIfExists):
+ (JSC::Yarr::RegexGenerator::TermGenerationState::addBacktrackJump):
+ (JSC::Yarr::RegexGenerator::TermGenerationState::linkAlternativeBacktracks):
+ (JSC::Yarr::RegexGenerator::TermGenerationState::propagateBacktrackingFrom):
+ (JSC::Yarr::RegexGenerator::genertateAssertionBOL):
+ (JSC::Yarr::RegexGenerator::genertateAssertionEOL):
+ (JSC::Yarr::RegexGenerator::matchAssertionWordchar):
+ (JSC::Yarr::RegexGenerator::genertateAssertionWordBoundary):
+ (JSC::Yarr::RegexGenerator::genertatePatternCharacterSingle):
+ (JSC::Yarr::RegexGenerator::genertatePatternCharacterPair):
+ (JSC::Yarr::RegexGenerator::genertatePatternCharacterFixed):
+ (JSC::Yarr::RegexGenerator::genertatePatternCharacterGreedy):
+ (JSC::Yarr::RegexGenerator::genertatePatternCharacterNonGreedy):
+ (JSC::Yarr::RegexGenerator::genertateCharacterClassSingle):
+ (JSC::Yarr::RegexGenerator::genertateCharacterClassFixed):
+ (JSC::Yarr::RegexGenerator::genertateCharacterClassGreedy):
+ (JSC::Yarr::RegexGenerator::genertateCharacterClassNonGreedy):
+ (JSC::Yarr::RegexGenerator::generateParenthesesDisjunction):
+ (JSC::Yarr::RegexGenerator::generateParenthesesSingle):
+ (JSC::Yarr::RegexGenerator::generateParentheticalAssertion):
+ (JSC::Yarr::RegexGenerator::generateTerm):
+ (JSC::Yarr::RegexGenerator::generateDisjunction):
+ (JSC::Yarr::RegexGenerator::generateEnter):
+ (JSC::Yarr::RegexGenerator::generateReturn):
+ (JSC::Yarr::RegexGenerator::RegexGenerator):
+ (JSC::Yarr::RegexGenerator::generate):
+ (JSC::Yarr::RegexGenerator::compile):
+ (JSC::Yarr::RegexGenerator::generationFailed):
+ (JSC::Yarr::jitCompileRegex):
+ (JSC::Yarr::executeRegex):
+ * yarr/RegexJIT.h:
+ (JSC::Yarr::RegexCodeBlock::RegexCodeBlock):
+ (JSC::Yarr::RegexCodeBlock::~RegexCodeBlock):
+
+2009-04-22 Sam Weinig <sam@webkit.org>
+
+ Rubber-stamped by Darin Adler.
+
+ Fix for <rdar://problem/6816957>
+ Turn off Geolocation by default
+
+ * Configurations/FeatureDefines.xcconfig:
+
+2009-04-22 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by NOBODY (Buildfix).
+
+ * interpreter/CachedCall.h:
+
+2009-04-21 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by NOBODY (Build fix).
+
+ * runtime/StringPrototype.cpp:
+
+2009-04-21 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Improve String.replace performance slightly
+
+ Apply our vm reentry caching logic to String.replace with global
+ regexes.
+
+ * runtime/StringPrototype.cpp:
+ (JSC::stringProtoFuncReplace):
+
+2009-04-21 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Cameron Zwarich and Oliver Hunt.
+
+ Re-Fixed <rdar://problem/6406045> REGRESSION: Stack overflow on PowerPC on
+ fast/workers/use-machine-stack.html (22531)
+
+ SunSpider reports no change.
+
+ Use a larger recursion limit on the main thread (because we can, and
+ there's some evidence that it may improve compatibility), and a smaller
+ recursion limit on secondary threads (because they tend to have smaller
+ stacks).
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::execute):
+ (JSC::Interpreter::prepareForRepeatCall):
+ * interpreter/Interpreter.h:
+ (JSC::): Ditto. I wrote the recursion test slightly funny, so that the
+ common case remains a simple compare to constant.
+
+ * runtime/ArrayPrototype.cpp:
+ (JSC::arrayProtoFuncToString):
+ (JSC::arrayProtoFuncToLocaleString):
+ (JSC::arrayProtoFuncJoin): Conservatively, set the array recursion limits
+ to the lower, secondary thread limit. We can do something fancier if
+ compatibility moves us, but this seems sufficient for now.
+
+2009-04-21 Geoffrey Garen <ggaren@apple.com>
+
+ Rubber-stamped by Adam Roben.
+
+ Disabled one more Mozilla JS test because it fails intermittently on Windows.
+ (See https://bugs.webkit.org/show_bug.cgi?id=25160.)
+
+ * tests/mozilla/expected.html:
+
+2009-04-21 Adam Roben <aroben@apple.com>
+
+ Rename JavaScriptCore_debug.dll to JavaScriptCore.dll in the Debug
+ configuration
+
+ This matches the naming scheme for WebKit.dll, and will be necessary
+ once Safari links against JavaScriptCore.dll. This change also causes
+ run-safari not to fail (because the launcher printed by FindSafari was
+ always looking for JavaScriptCore.dll, never
+ JavaScriptCore_debug.dll).
+
+ Part of Bug 25305: can't run safari or drt on windows
+ <https://bugs.webkit.org/show_bug.cgi?id=25305>
+
+ Reviewed by Steve Falkenburg and Sam Weinig.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.vcproj/jsc/jsc.vcproj:
+ * JavaScriptCore.vcproj/testapi/testapi.vcproj:
+ Use $(WebKitDLLConfigSuffix) for naming JavaScriptCore.{dll,lib}.
+
+2009-04-21 Adam Roben <aroben@apple.com>
+
+ Fix JavaScriptCore build on VC++ Express
+
+ Reviewed by Steve Falkenburg and Sam Weinig.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Link
+ explicitly against gdi32.lib and oleaut32.lib.
+
+2009-04-21 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Mark Rowe.
+
+ Tiger crash fix: Put VM tags in their own header file, and fixed up the
+ #ifdefs so they're not used on Tiger.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * interpreter/RegisterFile.h:
+ (JSC::RegisterFile::RegisterFile):
+ * jit/ExecutableAllocatorFixedVMPool.cpp:
+ (JSC::FixedVMPoolAllocator::FixedVMPoolAllocator):
+ * jit/ExecutableAllocatorPosix.cpp:
+ (JSC::ExecutablePool::systemAlloc):
+ * runtime/Collector.cpp:
+ (JSC::allocateBlock):
+ * wtf/VMTags.h: Added.
+
+2009-04-20 Steve Falkenburg <sfalken@apple.com>
+
+ More Windows build fixes.
+
+ * JavaScriptCore.vcproj/JavaScriptCore.make: Copy DLLs, PDBs.
+ * JavaScriptCore.vcproj/JavaScriptCore.resources: Added.
+ * JavaScriptCore.vcproj/JavaScriptCore.resources/Info.plist: Added.
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.rc: Added.
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Add version stamping, resource copying.
+
+2009-04-20 Steve Falkenburg <sfalken@apple.com>
+
+ Separate JavaScriptCore.dll from WebKit.dll.
+ Slight performance improvement or no change on benchmarks.
+
+ Allows us to break a circular dependency between CFNetwork and WebKit on Windows,
+ and simplifies standalone JavaScriptCore builds.
+
+ Reviewed by Oliver Hunt.
+
+ * API/JSBase.h: Export symbols with JS_EXPORT when using MSVC.
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj: Build JavaScriptCore as a DLL instead of a static library.
+ * config.h: Specify __declspec(dllexport/dllimport) appropriately when exporting data.
+ * runtime/InternalFunction.h: Specify JS_EXPORTDATA on exported data.
+ * runtime/JSArray.h: Specify JS_EXPORTDATA on exported data.
+ * runtime/JSFunction.h: Specify JS_EXPORTDATA on exported data.
+ * runtime/StringObject.h: Specify JS_EXPORTDATA on exported data.
+ * runtime/UString.h: Specify JS_EXPORTDATA on exported data.
+
+2009-04-20 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Kevin McCullough.
+
+ Always tag mmaped memory on darwin and clean up #defines
+ now that they are a little bigger.
+
+ * interpreter/RegisterFile.h:
+ (JSC::RegisterFile::RegisterFile):
+ * jit/ExecutableAllocatorFixedVMPool.cpp:
+ (JSC::FixedVMPoolAllocator::FixedVMPoolAllocator):
+ * jit/ExecutableAllocatorPosix.cpp:
+ (JSC::ExecutablePool::systemAlloc):
+ * runtime/Collector.cpp:
+ (JSC::allocateBlock):
+
+2009-04-20 Sam Weinig <sam@webkit.org>
+
+ Rubber-stamped by Tim Hatcher.
+
+ Add licenses for xcconfig files.
+
+ * Configurations/Base.xcconfig:
+ * Configurations/DebugRelease.xcconfig:
+ * Configurations/FeatureDefines.xcconfig:
+ * Configurations/JavaScriptCore.xcconfig:
+ * Configurations/Version.xcconfig:
+
+2009-04-20 Ariya Hidayat <ariya.hidayat@nokia.com>
+
+ Build fix for Qt port (after r42646). Not reviewed.
+
+ * wtf/unicode/qt4/UnicodeQt4.h: Added U16_PREV.
+
+2009-04-19 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ Better fix for JSStringCreateWithCFString hardening.
+
+ * API/JSStringRefCF.cpp:
+ (JSStringCreateWithCFString):
+
+2009-04-19 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Dan Bernstein.
+
+ Fix for <rdar://problem/5860954>
+ Harden JSStringCreateWithCFString against malformed CFStringRefs.
+
+ * API/JSStringRefCF.cpp:
+ (JSStringCreateWithCFString):
+
+2009-04-19 David Kilzer <ddkilzer@apple.com>
+
+ Make FEATURE_DEFINES completely dynamic
+
+ Reviewed by Darin Adler.
+
+ Make FEATURE_DEFINES depend on individual ENABLE_FEATURE_NAME
+ variables for each feature, making it possible to remove all
+ knowledge of FEATURE_DEFINES from build-webkit.
+
+ * Configurations/FeatureDefines.xcconfig: Extract a variable
+ from FEATURE_DEFINES for each feature setting.
+
+2009-04-18 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Dan Bernstein.
+
+ Fix typo. s/VM_MEMORY_JAVASCRIPT_JIT_REGISTER_FILE/VM_MEMORY_JAVASCRIPT_CORE/
+
+ * runtime/Collector.cpp:
+ (JSC::allocateBlock): Fix bozo typo.
+
+2009-04-18 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Anders Carlsson.
+
+ Fix for <rdar://problem/6801555> Tag JavaScript memory on SnowLeopard
+
+ * interpreter/RegisterFile.h:
+ (JSC::RegisterFile::RegisterFile):
+ * jit/ExecutableAllocatorFixedVMPool.cpp:
+ (JSC::FixedVMPoolAllocator::FixedVMPoolAllocator):
+ * jit/ExecutableAllocatorPosix.cpp:
+ (JSC::ExecutablePool::systemAlloc):
+ * runtime/Collector.cpp:
+ (JSC::allocateBlock):
+
+2009-04-18 Drew Wilson <amw@apple.com>
+
+ <rdar://problem/6781407> VisiblePosition.characterAfter should return UChar32
+
+ Reviewed by Dan Bernstein.
+
+ * wtf/unicode/icu/UnicodeIcu.h:
+ (WTF::Unicode::hasLineBreakingPropertyComplexContextOrIdeographic): Added.
+
+2009-04-18 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Mark Rowe.
+
+ Fix for <rdar://problem/5861045>
+ A little bit of hardening for UString.
+
+ * runtime/UString.cpp:
+ (JSC::concatenate):
+ (JSC::UString::append):
+
+2009-04-18 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Mark Rowe and Dan Bernstein.
+
+ Fix for <rdar://problem/5861188>
+ A little bit of hardening for Vector.
+
+ * wtf/Vector.h:
+ (WTF::Vector<T, inlineCapacity>::append):
+ (WTF::Vector<T, inlineCapacity>::insert):
+
+2009-04-17 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ On x86_64, make all JIT-code allocations from a new heap, managed
+ by FixedVMPoolAllocator. This class allocates a single large (2Gb)
+ pool of virtual memory from which all further allocations take place.
+ Since all JIT code is allocated from this pool, we can continue to
+ safely assume (as is already asserted) that it will always be possible
+ to link any JIT-code to JIT-code jumps and calls.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ Add new file.
+ * jit/ExecutableAllocatorFixedVMPool.cpp: Added.
+ (JSC::FreeListEntry::FreeListEntry):
+ (JSC::AVLTreeAbstractorForFreeList::get_less):
+ (JSC::AVLTreeAbstractorForFreeList::set_less):
+ (JSC::AVLTreeAbstractorForFreeList::get_greater):
+ (JSC::AVLTreeAbstractorForFreeList::set_greater):
+ (JSC::AVLTreeAbstractorForFreeList::get_balance_factor):
+ (JSC::AVLTreeAbstractorForFreeList::set_balance_factor):
+ (JSC::AVLTreeAbstractorForFreeList::null):
+ (JSC::AVLTreeAbstractorForFreeList::compare_key_key):
+ (JSC::AVLTreeAbstractorForFreeList::compare_key_node):
+ (JSC::AVLTreeAbstractorForFreeList::compare_node_node):
+ (JSC::sortFreeListEntriesByPointer):
+ (JSC::sortCommonSizedAllocations):
+ (JSC::FixedVMPoolAllocator::release):
+ (JSC::FixedVMPoolAllocator::reuse):
+ (JSC::FixedVMPoolAllocator::addToFreeList):
+ (JSC::FixedVMPoolAllocator::coalesceFreeSpace):
+ (JSC::FixedVMPoolAllocator::FixedVMPoolAllocator):
+ (JSC::FixedVMPoolAllocator::alloc):
+ (JSC::FixedVMPoolAllocator::free):
+ (JSC::ExecutableAllocator::intializePageSize):
+ (JSC::ExecutablePool::systemAlloc):
+ (JSC::ExecutablePool::systemRelease):
+ The new 2Gb heap class!
+ * jit/ExecutableAllocatorPosix.cpp:
+ Disable use of this implementation on x86_64.
+ * wtf/AVLTree.h:
+ Add missing variable initialization.
+ (WTF::::remove):
+
+2009-04-17 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Fix bug where the VM reentry cache would not correctly unroll the cached callframe
+
+ Fix a check that was intended to mark a cached call as invalid when the callframe could
+ not be constructed. Instead it was just checking that there was a place to put the
+ exception. This eventually results in a non-recoverable RegisterFile starvation.
+
+ * interpreter/CachedCall.h:
+ (JSC::CachedCall::CachedCall):
+ (JSC::CachedCall::call): add assertion to ensure we don't use a bad callframe
+
+2009-04-17 David Kilzer <ddkilzer@apple.com>
+
+ Simplify FEATURE_DEFINES definition
+
+ Reviewed by Darin Adler.
+
+ This moves FEATURE_DEFINES and its related ENABLE_FEATURE_NAME
+ variables to their own FeatureDefines.xcconfig file. It also
+ extracts a new ENABLE_GEOLOCATION variable so that
+ FEATURE_DEFINES only needs to be defined once.
+
+ * Configurations/FeatureDefines.xcconfig: Added.
+ * Configurations/JavaScriptCore.xcconfig: Removed definition of
+ ENABLE_SVG_DOM_OBJC_BINDINGS and FEATURE_DEFINES. Added include
+ of FeatureDefines.xcconfig.
+ * JavaScriptCore.xcodeproj/project.pbxproj: Added
+ FeatureDefines.xcconfig file.
+
+2009-04-08 Mihnea Ovidenie <mihnea@adobe.com>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 25027: JavaScript parseInt wrong on negative numbers
+ <https://bugs.webkit.org/show_bug.cgi?id=25027>
+
+ When dealing with negative numbers, parseInt should use ceil instead of floor.
+
+ * runtime/JSGlobalObjectFunctions.cpp:
+ (JSC::globalFuncParseInt):
+
+2009-04-16 Stephanie Lewis <slewis@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ <rdar://problem/6744652> 32-bit to 64-bit: Javascript hash tables double in size
+
+ Remove perfect hash optimization which removes 1 MB of overhead on 32-bit and almost 2 MB on 64-bit. Removing the optimization was not a regression on SunSpider and the acid 3 test still passes.
+
+ * create_hash_table:
+ * runtime/Lookup.cpp:
+ (JSC::HashTable::createTable):
+ (JSC::HashTable::deleteTable):
+ * runtime/Lookup.h:
+ (JSC::HashEntry::initialize):
+ (JSC::HashEntry::next):
+ (JSC::HashTable::entry):
+ * runtime/Structure.cpp:
+ (JSC::Structure::getEnumerableNamesFromClassInfoTable):
+
+2009-04-16 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Fix subtle error in optimised VM reentry in Array.sort
+
+ Basically to ensure we don't accidentally invalidate the cached callframe
+ we should be using the cached callframe rather than our own exec state.
+ While the old behaviour was wrong i have been unable to actually create a
+ test case where anything actually ends up going wrong.
+
+ * interpreter/CachedCall.h:
+ (JSC::CachedCall::newCallFrame):
+ * runtime/JSArray.cpp:
+ (JSC::AVLTreeAbstractorForArrayCompare::compare_key_key):
+
+2009-04-16 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Optimise op_resolve_base
+
+ If we can statically find a property we are trying to resolve
+ the base of, the base is guaranteed to be the global object.
+
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::emitResolveBase):
+
+2009-04-16 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Improve performance of read-write-modify operators
+
+ Implement cross scope optimisation for read-write-modify
+ operators, to avoid unnecessary calls to property resolve
+ helper functions.
+
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::BytecodeGenerator):
+ (JSC::BytecodeGenerator::emitLoadGlobalObject):
+ (JSC::BytecodeGenerator::emitResolveWithBase):
+ * bytecompiler/BytecodeGenerator.h:
+
+2009-04-16 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Improve performance of remaining array enumeration functions
+
+ Make use of function entry cache for remaining Array enumeration functions.
+
+ * runtime/ArrayPrototype.cpp:
+ (JSC::arrayProtoFuncMap):
+ (JSC::arrayProtoFuncEvery):
+ (JSC::arrayProtoFuncForEach):
+ (JSC::arrayProtoFuncSome):
+
+2009-04-15 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Improve performance of Array.sort
+
+ Cache the VM entry for Array.sort when using a JS comparison function.
+
+ * runtime/JSArray.cpp:
+ (JSC::AVLTreeAbstractorForArrayCompare::compare_key_key):
+ (JSC::JSArray::sort):
+
+2009-04-15 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Bug 25229: Need support for Array.prototype.reduceRight
+ <https://bugs.webkit.org/show_bug.cgi?id=25229>
+
+ Implement Array.reduceRight
+
+ * runtime/ArrayPrototype.cpp:
+ (JSC::arrayProtoFuncReduceRight):
+
+2009-04-15 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Bug 25227: Array.filter triggers an assertion when the target array shrinks while being filtered
+ <https://bugs.webkit.org/show_bug.cgi?id=25227>
+
+ We correct this simply by making the fast array path fall back on the slow path if
+ we ever discover the fast access is unsafe.
+
+ * runtime/ArrayPrototype.cpp:
+ (JSC::arrayProtoFuncFilter):
+
+2009-04-13 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Bug 25159: Support Array.prototype.reduce
+ <https://bugs.webkit.org/show_bug.cgi?id=25159>
+
+ Implement Array.prototype.reduce
+
+ * runtime/ArrayPrototype.cpp:
+ (JSC::arrayProtoFuncReduce):
+
+2009-04-15 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by NOBODY (Build fix).
+
+ Move CallFrameClosure from inside the Interpreter class to its own file.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * interpreter/CachedCall.h:
+ * interpreter/CallFrameClosure.h: Copied from JavaScriptCore/yarr/RegexJIT.h.
+ (JSC::CallFrameClosure::setArgument):
+ (JSC::CallFrameClosure::resetCallFrame):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::prepareForRepeatCall):
+ * interpreter/Interpreter.h:
+
+2009-04-14 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ Bug 25202: Improve performance of repeated callbacks into the VM
+
+ Add the concept of a CachedCall to native code for use in Array
+ prototype and similar functions where a single callback function
+ is called repeatedly with the same number of arguments.
+
+ Used Array.prototype.filter as the test function and got a 50% win
+ over a naive non-caching specialised version. This makes the native
+ implementation of Array.prototype.filter faster than the JS one once
+ more.
+
+ * JavaScriptCore.vcproj/JavaScriptCore.sln:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * interpreter/CachedCall.h: Added.
+ (JSC::CachedCall::CachedCall):
+ (JSC::CachedCall::call):
+ (JSC::CachedCall::setThis):
+ (JSC::CachedCall::setArgument):
+ (JSC::CachedCall::~CachedCall):
+ CachedCall is a wrapper that automates the calling and teardown
+ for a CallFrameClosure
+ * interpreter/CallFrame.h:
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::prepareForRepeatCall):
+ Create the basic entry closure for a function
+ (JSC::Interpreter::execute):
+ A new ::execute method to enter the interpreter from a closure
+ (JSC::Interpreter::endRepeatCall):
+ Clear the entry closure
+ * interpreter/Interpreter.h:
+ (JSC::Interpreter::CallFrameClosure::setArgument):
+ (JSC::Interpreter::CallFrameClosure::resetCallFrame):
+ Helper functions to simplify setting up the closure's callframe
+ * runtime/ArrayPrototype.cpp:
+ (JSC::arrayProtoFuncFilter):
+
+2009-04-14 Xan Lopez <xlopez@igalia.com>
+
+ Fix the build.
+
+ Add the yarr headers (and only the headers) to the build, so that
+ RegExp.cpp can compile. The headers are ifdefed out with yarr
+ disabled, so we don't need anything else for now.
+
+ * GNUmakefile.am:
+
+2009-04-14 Adam Roben <aroben@apple.com>
+
+ Remove support for profile-guided optimization on Windows
+
+ Rubber-stamped by Steve Falkenburg.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Removed
+ the Release_PGO configuration. Also let VS re-order the source files
+ list.
+
+2009-04-14 Xan Lopez <xlopez@igalia.com>
+
+ Unreviewed build fix.
+
+ * GNUmakefile.am:
+
+2009-04-14 Jan Michael Alonzo <jmalonzo@webkit.org>
+
+ Gtk build fix when building minidom. Not reviewed.
+
+ Use C-style comment instead of C++ style since autotools builds
+ minidom using gcc and not g++.
+
+ * wtf/Platform.h:
+
+2009-04-14 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by NOBODY - speculative build fix.
+
+ * runtime/RegExp.h:
+
+2009-04-13 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Cap'n Geoff Garen.
+
+ Yarr!
+ (Yet another regex runtime).
+
+ Currently disabled by default since the interpreter, whilst awesomely
+ functional, has not been optimized and is likely slower than PCRE, and
+ the JIT, whilst faster than WREC, is presently incomplete and does not
+ fallback to using an interpreter for the cases it cannot handle.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * assembler/MacroAssemblerX86Common.h:
+ (JSC::MacroAssemblerX86Common::move):
+ (JSC::MacroAssemblerX86Common::swap):
+ (JSC::MacroAssemblerX86Common::signExtend32ToPtr):
+ (JSC::MacroAssemblerX86Common::zeroExtend32ToPtr):
+ (JSC::MacroAssemblerX86Common::branch32):
+ (JSC::MacroAssemblerX86Common::branch16):
+ * assembler/X86Assembler.h:
+ (JSC::X86Assembler::cmpw_im):
+ (JSC::X86Assembler::testw_rr):
+ (JSC::X86Assembler::X86InstructionFormatter::immediate16):
+ * runtime/RegExp.cpp:
+ (JSC::RegExp::RegExp):
+ (JSC::RegExp::~RegExp):
+ (JSC::RegExp::create):
+ (JSC::RegExp::compile):
+ (JSC::RegExp::match):
+ * runtime/RegExp.h:
+ * wtf/Platform.h:
+ * yarr: Added.
+ * yarr/RegexCompiler.cpp: Added.
+ (JSC::Yarr::CharacterClassConstructor::CharacterClassConstructor):
+ (JSC::Yarr::CharacterClassConstructor::reset):
+ (JSC::Yarr::CharacterClassConstructor::append):
+ (JSC::Yarr::CharacterClassConstructor::putChar):
+ (JSC::Yarr::CharacterClassConstructor::isUnicodeUpper):
+ (JSC::Yarr::CharacterClassConstructor::isUnicodeLower):
+ (JSC::Yarr::CharacterClassConstructor::putRange):
+ (JSC::Yarr::CharacterClassConstructor::charClass):
+ (JSC::Yarr::CharacterClassConstructor::addSorted):
+ (JSC::Yarr::CharacterClassConstructor::addSortedRange):
+ (JSC::Yarr::newlineCreate):
+ (JSC::Yarr::digitsCreate):
+ (JSC::Yarr::spacesCreate):
+ (JSC::Yarr::wordcharCreate):
+ (JSC::Yarr::nondigitsCreate):
+ (JSC::Yarr::nonspacesCreate):
+ (JSC::Yarr::nonwordcharCreate):
+ (JSC::Yarr::RegexPatternConstructor::RegexPatternConstructor):
+ (JSC::Yarr::RegexPatternConstructor::~RegexPatternConstructor):
+ (JSC::Yarr::RegexPatternConstructor::reset):
+ (JSC::Yarr::RegexPatternConstructor::assertionBOL):
+ (JSC::Yarr::RegexPatternConstructor::assertionEOL):
+ (JSC::Yarr::RegexPatternConstructor::assertionWordBoundary):
+ (JSC::Yarr::RegexPatternConstructor::atomPatternCharacter):
+ (JSC::Yarr::RegexPatternConstructor::atomBuiltInCharacterClass):
+ (JSC::Yarr::RegexPatternConstructor::atomCharacterClassBegin):
+ (JSC::Yarr::RegexPatternConstructor::atomCharacterClassAtom):
+ (JSC::Yarr::RegexPatternConstructor::atomCharacterClassRange):
+ (JSC::Yarr::RegexPatternConstructor::atomCharacterClassBuiltIn):
+ (JSC::Yarr::RegexPatternConstructor::atomCharacterClassEnd):
+ (JSC::Yarr::RegexPatternConstructor::atomParenthesesSubpatternBegin):
+ (JSC::Yarr::RegexPatternConstructor::atomParentheticalAssertionBegin):
+ (JSC::Yarr::RegexPatternConstructor::atomParenthesesEnd):
+ (JSC::Yarr::RegexPatternConstructor::atomBackReference):
+ (JSC::Yarr::RegexPatternConstructor::copyDisjunction):
+ (JSC::Yarr::RegexPatternConstructor::copyTerm):
+ (JSC::Yarr::RegexPatternConstructor::quantifyAtom):
+ (JSC::Yarr::RegexPatternConstructor::disjunction):
+ (JSC::Yarr::RegexPatternConstructor::regexBegin):
+ (JSC::Yarr::RegexPatternConstructor::regexEnd):
+ (JSC::Yarr::RegexPatternConstructor::regexError):
+ (JSC::Yarr::RegexPatternConstructor::setupAlternativeOffsets):
+ (JSC::Yarr::RegexPatternConstructor::setupDisjunctionOffsets):
+ (JSC::Yarr::RegexPatternConstructor::setupOffsets):
+ (JSC::Yarr::compileRegex):
+ * yarr/RegexCompiler.h: Added.
+ * yarr/RegexInterpreter.cpp: Added.
+ (JSC::Yarr::Interpreter::appendParenthesesDisjunctionContext):
+ (JSC::Yarr::Interpreter::popParenthesesDisjunctionContext):
+ (JSC::Yarr::Interpreter::DisjunctionContext::DisjunctionContext):
+ (JSC::Yarr::Interpreter::DisjunctionContext::operator new):
+ (JSC::Yarr::Interpreter::allocDisjunctionContext):
+ (JSC::Yarr::Interpreter::freeDisjunctionContext):
+ (JSC::Yarr::Interpreter::ParenthesesDisjunctionContext::ParenthesesDisjunctionContext):
+ (JSC::Yarr::Interpreter::ParenthesesDisjunctionContext::operator new):
+ (JSC::Yarr::Interpreter::ParenthesesDisjunctionContext::restoreOutput):
+ (JSC::Yarr::Interpreter::ParenthesesDisjunctionContext::getDisjunctionContext):
+ (JSC::Yarr::Interpreter::allocParenthesesDisjunctionContext):
+ (JSC::Yarr::Interpreter::freeParenthesesDisjunctionContext):
+ (JSC::Yarr::Interpreter::InputStream::InputStream):
+ (JSC::Yarr::Interpreter::InputStream::next):
+ (JSC::Yarr::Interpreter::InputStream::rewind):
+ (JSC::Yarr::Interpreter::InputStream::read):
+ (JSC::Yarr::Interpreter::InputStream::readChecked):
+ (JSC::Yarr::Interpreter::InputStream::reread):
+ (JSC::Yarr::Interpreter::InputStream::prev):
+ (JSC::Yarr::Interpreter::InputStream::getPos):
+ (JSC::Yarr::Interpreter::InputStream::setPos):
+ (JSC::Yarr::Interpreter::InputStream::atStart):
+ (JSC::Yarr::Interpreter::InputStream::atEnd):
+ (JSC::Yarr::Interpreter::InputStream::checkInput):
+ (JSC::Yarr::Interpreter::InputStream::uncheckInput):
+ (JSC::Yarr::Interpreter::testCharacterClass):
+ (JSC::Yarr::Interpreter::tryConsumeCharacter):
+ (JSC::Yarr::Interpreter::checkCharacter):
+ (JSC::Yarr::Interpreter::tryConsumeCharacterClass):
+ (JSC::Yarr::Interpreter::checkCharacterClass):
+ (JSC::Yarr::Interpreter::tryConsumeBackReference):
+ (JSC::Yarr::Interpreter::matchAssertionBOL):
+ (JSC::Yarr::Interpreter::matchAssertionEOL):
+ (JSC::Yarr::Interpreter::matchAssertionWordBoundary):
+ (JSC::Yarr::Interpreter::matchPatternCharacter):
+ (JSC::Yarr::Interpreter::backtrackPatternCharacter):
+ (JSC::Yarr::Interpreter::matchCharacterClass):
+ (JSC::Yarr::Interpreter::backtrackCharacterClass):
+ (JSC::Yarr::Interpreter::matchBackReference):
+ (JSC::Yarr::Interpreter::backtrackBackReference):
+ (JSC::Yarr::Interpreter::recordParenthesesMatch):
+ (JSC::Yarr::Interpreter::resetMatches):
+ (JSC::Yarr::Interpreter::resetAssertionMatches):
+ (JSC::Yarr::Interpreter::parenthesesDoBacktrack):
+ (JSC::Yarr::Interpreter::matchParenthesesOnceBegin):
+ (JSC::Yarr::Interpreter::matchParenthesesOnceEnd):
+ (JSC::Yarr::Interpreter::backtrackParenthesesOnceBegin):
+ (JSC::Yarr::Interpreter::backtrackParenthesesOnceEnd):
+ (JSC::Yarr::Interpreter::matchParentheticalAssertionOnceBegin):
+ (JSC::Yarr::Interpreter::matchParentheticalAssertionOnceEnd):
+ (JSC::Yarr::Interpreter::backtrackParentheticalAssertionOnceBegin):
+ (JSC::Yarr::Interpreter::backtrackParentheticalAssertionOnceEnd):
+ (JSC::Yarr::Interpreter::matchParentheses):
+ (JSC::Yarr::Interpreter::backtrackParentheses):
+ (JSC::Yarr::Interpreter::matchTerm):
+ (JSC::Yarr::Interpreter::backtrackTerm):
+ (JSC::Yarr::Interpreter::matchAlternative):
+ (JSC::Yarr::Interpreter::matchDisjunction):
+ (JSC::Yarr::Interpreter::matchNonZeroDisjunction):
+ (JSC::Yarr::Interpreter::interpret):
+ (JSC::Yarr::Interpreter::Interpreter):
+ (JSC::Yarr::ByteCompiler::ParenthesesStackEntry::ParenthesesStackEntry):
+ (JSC::Yarr::ByteCompiler::ByteCompiler):
+ (JSC::Yarr::ByteCompiler::compile):
+ (JSC::Yarr::ByteCompiler::checkInput):
+ (JSC::Yarr::ByteCompiler::assertionBOL):
+ (JSC::Yarr::ByteCompiler::assertionEOL):
+ (JSC::Yarr::ByteCompiler::assertionWordBoundary):
+ (JSC::Yarr::ByteCompiler::atomPatternCharacter):
+ (JSC::Yarr::ByteCompiler::atomCharacterClass):
+ (JSC::Yarr::ByteCompiler::atomBackReference):
+ (JSC::Yarr::ByteCompiler::atomParenthesesSubpatternBegin):
+ (JSC::Yarr::ByteCompiler::atomParentheticalAssertionBegin):
+ (JSC::Yarr::ByteCompiler::popParenthesesStack):
+ (JSC::Yarr::ByteCompiler::dumpDisjunction):
+ (JSC::Yarr::ByteCompiler::closeAlternative):
+ (JSC::Yarr::ByteCompiler::atomParenthesesEnd):
+ (JSC::Yarr::ByteCompiler::regexBegin):
+ (JSC::Yarr::ByteCompiler::regexEnd):
+ (JSC::Yarr::ByteCompiler::alterantiveDisjunction):
+ (JSC::Yarr::ByteCompiler::emitDisjunction):
+ (JSC::Yarr::byteCompileRegex):
+ (JSC::Yarr::interpretRegex):
+ * yarr/RegexInterpreter.h: Added.
+ (JSC::Yarr::ByteTerm::):
+ (JSC::Yarr::ByteTerm::ByteTerm):
+ (JSC::Yarr::ByteTerm::BOL):
+ (JSC::Yarr::ByteTerm::CheckInput):
+ (JSC::Yarr::ByteTerm::EOL):
+ (JSC::Yarr::ByteTerm::WordBoundary):
+ (JSC::Yarr::ByteTerm::BackReference):
+ (JSC::Yarr::ByteTerm::AlternativeBegin):
+ (JSC::Yarr::ByteTerm::AlternativeDisjunction):
+ (JSC::Yarr::ByteTerm::AlternativeEnd):
+ (JSC::Yarr::ByteTerm::PatternEnd):
+ (JSC::Yarr::ByteTerm::invert):
+ (JSC::Yarr::ByteTerm::capture):
+ (JSC::Yarr::ByteDisjunction::ByteDisjunction):
+ (JSC::Yarr::BytecodePattern::BytecodePattern):
+ (JSC::Yarr::BytecodePattern::~BytecodePattern):
+ * yarr/RegexJIT.cpp: Added.
+ (JSC::Yarr::RegexGenerator::optimizeAlternative):
+ (JSC::Yarr::RegexGenerator::matchCharacterClassRange):
+ (JSC::Yarr::RegexGenerator::matchCharacterClass):
+ (JSC::Yarr::RegexGenerator::jumpIfNoAvailableInput):
+ (JSC::Yarr::RegexGenerator::jumpIfAvailableInput):
+ (JSC::Yarr::RegexGenerator::checkInput):
+ (JSC::Yarr::RegexGenerator::atEndOfInput):
+ (JSC::Yarr::RegexGenerator::notAtEndOfInput):
+ (JSC::Yarr::RegexGenerator::jumpIfCharEquals):
+ (JSC::Yarr::RegexGenerator::jumpIfCharNotEquals):
+ (JSC::Yarr::RegexGenerator::readCharacter):
+ (JSC::Yarr::RegexGenerator::storeToFrame):
+ (JSC::Yarr::RegexGenerator::loadFromFrame):
+ (JSC::Yarr::RegexGenerator::TermGenerationState::TermGenerationState):
+ (JSC::Yarr::RegexGenerator::TermGenerationState::resetAlternative):
+ (JSC::Yarr::RegexGenerator::TermGenerationState::alternativeValid):
+ (JSC::Yarr::RegexGenerator::TermGenerationState::nextAlternative):
+ (JSC::Yarr::RegexGenerator::TermGenerationState::alternative):
+ (JSC::Yarr::RegexGenerator::TermGenerationState::resetTerm):
+ (JSC::Yarr::RegexGenerator::TermGenerationState::termValid):
+ (JSC::Yarr::RegexGenerator::TermGenerationState::nextTerm):
+ (JSC::Yarr::RegexGenerator::TermGenerationState::term):
+ (JSC::Yarr::RegexGenerator::TermGenerationState::lookaheadTerm):
+ (JSC::Yarr::RegexGenerator::TermGenerationState::isSinglePatternCharacterLookaheadTerm):
+ (JSC::Yarr::RegexGenerator::TermGenerationState::inputOffset):
+ (JSC::Yarr::RegexGenerator::TermGenerationState::jumpToBacktrack):
+ (JSC::Yarr::RegexGenerator::TermGenerationState::setBacktrackGenerated):
+ (JSC::Yarr::RegexGenerator::jumpToBacktrackCheckEmitPending):
+ (JSC::Yarr::RegexGenerator::genertateAssertionBOL):
+ (JSC::Yarr::RegexGenerator::genertateAssertionEOL):
+ (JSC::Yarr::RegexGenerator::matchAssertionWordchar):
+ (JSC::Yarr::RegexGenerator::genertateAssertionWordBoundary):
+ (JSC::Yarr::RegexGenerator::genertatePatternCharacterSingle):
+ (JSC::Yarr::RegexGenerator::genertatePatternCharacterPair):
+ (JSC::Yarr::RegexGenerator::genertatePatternCharacterFixed):
+ (JSC::Yarr::RegexGenerator::genertatePatternCharacterGreedy):
+ (JSC::Yarr::RegexGenerator::genertatePatternCharacterNonGreedy):
+ (JSC::Yarr::RegexGenerator::genertateCharacterClassSingle):
+ (JSC::Yarr::RegexGenerator::genertateCharacterClassFixed):
+ (JSC::Yarr::RegexGenerator::genertateCharacterClassGreedy):
+ (JSC::Yarr::RegexGenerator::genertateCharacterClassNonGreedy):
+ (JSC::Yarr::RegexGenerator::generateParenthesesSingleDisjunctionOneAlternative):
+ (JSC::Yarr::RegexGenerator::generateParenthesesSingle):
+ (JSC::Yarr::RegexGenerator::generateTerm):
+ (JSC::Yarr::RegexGenerator::generateDisjunction):
+ (JSC::Yarr::RegexGenerator::RegexGenerator):
+ (JSC::Yarr::RegexGenerator::generate):
+ (JSC::Yarr::jitCompileRegex):
+ (JSC::Yarr::executeRegex):
+ * yarr/RegexJIT.h: Added.
+ (JSC::Yarr::RegexCodeBlock::RegexCodeBlock):
+ * yarr/RegexParser.h: Added.
+ (JSC::Yarr::):
+ (JSC::Yarr::Parser::):
+ (JSC::Yarr::Parser::CharacterClassParserDelegate::CharacterClassParserDelegate):
+ (JSC::Yarr::Parser::CharacterClassParserDelegate::begin):
+ (JSC::Yarr::Parser::CharacterClassParserDelegate::atomPatternCharacterUnescaped):
+ (JSC::Yarr::Parser::CharacterClassParserDelegate::atomPatternCharacter):
+ (JSC::Yarr::Parser::CharacterClassParserDelegate::atomBuiltInCharacterClass):
+ (JSC::Yarr::Parser::CharacterClassParserDelegate::end):
+ (JSC::Yarr::Parser::CharacterClassParserDelegate::assertionWordBoundary):
+ (JSC::Yarr::Parser::CharacterClassParserDelegate::atomBackReference):
+ (JSC::Yarr::Parser::CharacterClassParserDelegate::flush):
+ (JSC::Yarr::Parser::CharacterClassParserDelegate::):
+ (JSC::Yarr::Parser::Parser):
+ (JSC::Yarr::Parser::parseEscape):
+ (JSC::Yarr::Parser::parseAtomEscape):
+ (JSC::Yarr::Parser::parseCharacterClassEscape):
+ (JSC::Yarr::Parser::parseCharacterClass):
+ (JSC::Yarr::Parser::parseParenthesesBegin):
+ (JSC::Yarr::Parser::parseParenthesesEnd):
+ (JSC::Yarr::Parser::parseQuantifier):
+ (JSC::Yarr::Parser::parseTokens):
+ (JSC::Yarr::Parser::parse):
+ (JSC::Yarr::Parser::saveState):
+ (JSC::Yarr::Parser::restoreState):
+ (JSC::Yarr::Parser::atEndOfPattern):
+ (JSC::Yarr::Parser::peek):
+ (JSC::Yarr::Parser::peekIsDigit):
+ (JSC::Yarr::Parser::peekDigit):
+ (JSC::Yarr::Parser::consume):
+ (JSC::Yarr::Parser::consumeDigit):
+ (JSC::Yarr::Parser::consumeNumber):
+ (JSC::Yarr::Parser::consumeOctal):
+ (JSC::Yarr::Parser::tryConsume):
+ (JSC::Yarr::Parser::tryConsumeHex):
+ (JSC::Yarr::parse):
+ * yarr/RegexPattern.h: Added.
+ (JSC::Yarr::CharacterRange::CharacterRange):
+ (JSC::Yarr::):
+ (JSC::Yarr::PatternTerm::):
+ (JSC::Yarr::PatternTerm::PatternTerm):
+ (JSC::Yarr::PatternTerm::BOL):
+ (JSC::Yarr::PatternTerm::EOL):
+ (JSC::Yarr::PatternTerm::WordBoundary):
+ (JSC::Yarr::PatternTerm::invert):
+ (JSC::Yarr::PatternTerm::capture):
+ (JSC::Yarr::PatternTerm::quantify):
+ (JSC::Yarr::PatternAlternative::PatternAlternative):
+ (JSC::Yarr::PatternAlternative::lastTerm):
+ (JSC::Yarr::PatternAlternative::removeLastTerm):
+ (JSC::Yarr::PatternDisjunction::PatternDisjunction):
+ (JSC::Yarr::PatternDisjunction::~PatternDisjunction):
+ (JSC::Yarr::PatternDisjunction::addNewAlternative):
+ (JSC::Yarr::RegexPattern::RegexPattern):
+ (JSC::Yarr::RegexPattern::~RegexPattern):
+ (JSC::Yarr::RegexPattern::reset):
+ (JSC::Yarr::RegexPattern::containsIllegalBackReference):
+ (JSC::Yarr::RegexPattern::newlineCharacterClass):
+ (JSC::Yarr::RegexPattern::digitsCharacterClass):
+ (JSC::Yarr::RegexPattern::spacesCharacterClass):
+ (JSC::Yarr::RegexPattern::wordcharCharacterClass):
+ (JSC::Yarr::RegexPattern::nondigitsCharacterClass):
+ (JSC::Yarr::RegexPattern::nonspacesCharacterClass):
+ (JSC::Yarr::RegexPattern::nonwordcharCharacterClass):
+
+2009-04-13 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by NOBODY (Missed code from last patch).
+
+ * runtime/InternalFunction.cpp:
+ (JSC::InternalFunction::displayName):
+ (JSC::InternalFunction::calculatedDisplayName):
+ * runtime/InternalFunction.h:
+
+2009-04-13 Francisco Tolmasky <francisco@280north.com>
+
+ Reviewed by Oliver Hunt.
+
+ BUG 25171: It should be possible to manually set the name of an anonymous function
+ <https://bugs.webkit.org/show_bug.cgi?id=25171>
+
+ This change adds the displayName property to functions, which when set overrides the
+ normal name when appearing in the console.
+
+ * profiler/Profiler.cpp:
+ (JSC::createCallIdentifierFromFunctionImp): Changed call to InternalFunction::name to InternalFunction::calculatedDisplayName
+ * runtime/CommonIdentifiers.h: Added displayName common identifier.
+ * runtime/InternalFunction.cpp:
+ (JSC::InternalFunction::displayName): Access to user settable displayName property
+ (JSC::InternalFunction::calculatedDisplayName): Returns displayName if it exists, if not then the natural name
+
+2009-04-13 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Disabled another JavaScriptCore test because it fails on Windows but
+ not Mac, so it makes the bots red.
+
+ * tests/mozilla/expected.html:
+
+2009-04-13 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Disabled two JavaScriptCore tests because they fail on Window or Mac but
+ not both, so they make the bots red.
+
+ * tests/mozilla/expected.html: Updated expected results.
+
+2009-04-09 Ben Murdoch <benm@google.com>
+
+ Reviewed by Alexey Proskuryakov.
+
+ https://bugs.webkit.org/show_bug.cgi?id=25091
+ The Android platform requires threads to be registered with the VM.
+ This patch implements this behaviour inside ThreadingPthreads.cpp.
+
+ * wtf/ThreadingPthreads.cpp: Add a level above threadEntryPoint that takes care of (un)registering threads with the VM.
+ (WTF::runThreadWithRegistration): register the thread and run entryPoint. Unregister the thread afterwards.
+ (WTF::createThreadInternal): call runThreadWithRegistration instead of entryPoint directly.
+
+2009-04-09 David Kilzer <ddkilzer@apple.com>
+
+ Reinstating <rdar://problem/6718589> Option to turn off SVG DOM Objective-C bindings
+
+ Rolled r42345 back in. The build failure was caused by an
+ internal script which had not been updated the same way that
+ build-webkit was updated.
+
+ * Configurations/JavaScriptCore.xcconfig:
+
+2009-04-09 Alexey Proskuryakov <ap@webkit.org>
+
+ Reverting <rdar://problem/6718589> Option to turn off SVG DOM Objective-C bindings.
+ It broke Mac build, and I don't know how to fix it.
+
+ * Configurations/JavaScriptCore.xcconfig:
+
+2009-04-09 Xan Lopez <xlopez@igalia.com>
+
+ Unreviewed build fix.
+
+ Checking for __GLIBCXX__ being bigger than some date is not enough
+ to get std::tr1, C++0x has to be in use too. Add another check for
+ __GXX_EXPERIMENTAL_CXX0X__.
+
+ * wtf/TypeTraits.h:
+
+2009-04-08 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Adam Roben.
+
+ Fix assertion failure in function.apply
+
+ The result of excess arguments to function.apply is irrelevant
+ so we don't need to provide a result register. We were providing
+ temporary result register but not ref'ing it resulting in an
+ assertion failure.
+
+ * parser/Nodes.cpp:
+ (JSC::ApplyFunctionCallDotNode::emitBytecode):
+
+2009-04-08 David Kilzer <ddkilzer@apple.com>
+
+ <rdar://problem/6718589> Option to turn off SVG DOM Objective-C bindings
+
+ Reviewed by Darin Adler and Maciej Stachowiak.
+
+ Introduce the ENABLE_SVG_DOM_OBJC_BINDINGS feature define so
+ that SVG DOM Objective-C bindings may be optionally disabled.
+
+ * Configurations/JavaScriptCore.xcconfig: Added
+ ENABLE_SVG_DOM_OBJC_BINDINGS variable and use it in
+ FEATURE_DEFINES.
+
+2009-04-08 Paul Pedriana <ppedriana@ea.com>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=20422
+ Allow custom memory allocation control.
+
+ * wtf/FastAllocBase.h:
+ New added file. Implements allocation base class.
+ * wtf/TypeTraits.h:
+ Augments existing type traits support as needed by FastAllocBase.
+ * wtf/FastMalloc.h:
+ Changed to support FastMalloc match validation.
+ * wtf/FastMalloc.cpp:
+ Changed to support FastMalloc match validation.
+ * wtf/Platform.h:
+ Added ENABLE_FAST_MALLOC_MATCH_VALIDATION; defaults to 0.
+ * GNUmakefile.am:
+ Updated to include added FastAllocBase.h.
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ Updated to include added FastAllocBase.h.
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ Updated to include added FastAllocBase.h.
+
+2009-04-07 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Improve function.apply performance
+
+ Jump through a few hoops to improve performance of function.apply in the general case.
+
+ In the case of zero or one arguments, or if there are only two arguments and the
+ second is an array literal we treat function.apply as function.call.
+
+ Otherwise we use the new opcodes op_load_varargs and op_call_varargs to do the .apply call
+ without re-entering the virtual machine.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::dump):
+ * bytecode/Opcode.h:
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::emitJumpIfNotFunctionApply):
+ (JSC::BytecodeGenerator::emitLoadVarargs):
+ (JSC::BytecodeGenerator::emitCallVarargs):
+ * bytecompiler/BytecodeGenerator.h:
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ (JSC::JIT::privateCompileSlowCases):
+ * jit/JIT.h:
+ * jit/JITCall.cpp:
+ (JSC::JIT::compileOpCallSetupArgs):
+ (JSC::JIT::compileOpCallVarargsSetupArgs):
+ (JSC::JIT::compileOpCallVarargs):
+ (JSC::JIT::compileOpCallVarargsSlowCase):
+ * jit/JITStubs.cpp:
+ (JSC::JITStubs::cti_op_load_varargs):
+ * jit/JITStubs.h:
+ * parser/Grammar.y:
+ * parser/Nodes.cpp:
+ (JSC::ArrayNode::isSimpleArray):
+ (JSC::ArrayNode::toArgumentList):
+ (JSC::CallFunctionCallDotNode::emitBytecode):
+ (JSC::ApplyFunctionCallDotNode::emitBytecode):
+ * parser/Nodes.h:
+ (JSC::ExpressionNode::):
+ (JSC::ApplyFunctionCallDotNode::):
+ * runtime/Arguments.cpp:
+ (JSC::Arguments::copyToRegisters):
+ (JSC::Arguments::fillArgList):
+ * runtime/Arguments.h:
+ (JSC::Arguments::numProvidedArguments):
+ * runtime/FunctionPrototype.cpp:
+ (JSC::FunctionPrototype::addFunctionProperties):
+ * runtime/FunctionPrototype.h:
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::copyToRegisters):
+ * runtime/JSArray.h:
+ * runtime/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::reset):
+ (JSC::JSGlobalObject::mark):
+ * runtime/JSGlobalObject.h:
+
+2009-04-08 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=25073
+ JavaScriptCore tests don't run if time zone is not PST
+
+ * API/tests/testapi.c:
+ (timeZoneIsPST): Added a function that checks whether the time zone is PST, using the same
+ method as functions in DateMath.cpp do for formatting the result.
+ (main): Skip date string format test if the time zone is not PST.
+
+2009-04-07 David Levin <levin@chromium.org>
+
+ Reviewed by Sam Weinig and Geoff Garen.
+
+ https://bugs.webkit.org/show_bug.cgi?id=25039
+ UString refactoring to support UChar* sharing.
+
+ No change in sunspider perf.
+
+ * runtime/SmallStrings.cpp:
+ (JSC::SmallStringsStorage::SmallStringsStorage):
+ * runtime/UString.cpp:
+ (JSC::initializeStaticBaseString):
+ (JSC::initializeUString):
+ (JSC::UString::BaseString::isShared):
+ Encapsulate the meaning behind the refcount == 1 checks because
+ this needs to do slightly more when sharing is added.
+ (JSC::concatenate):
+ (JSC::UString::append):
+ (JSC::UString::operator=):
+ * runtime/UString.h:
+ Make m_baseString part of a union to get rid of casts, but make it protected because
+ it is tricky to use it correctly since it is only valid when the Rep is not a BaseString.
+ The void* will be filled in when sharing is added.
+
+ Add constructors due to the making members protected and it make ensuring proper
+ initialization work better (like in SmallStringsStorage).
+ (JSC::UString::Rep::create):
+ (JSC::UString::Rep::Rep):
+ (JSC::UString::Rep::):
+ (JSC::UString::BaseString::BaseString):
+ (JSC::UString::Rep::setBaseString):
+ (JSC::UString::Rep::baseString):
+
+2009-04-04 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Alexey Proskuryakov.
+
+ https://bugs.webkit.org/show_bug.cgi?id=25033
+ dtoa.cpp segfaults with g++ 4.4.0
+
+ g++ 4.4.0 seems to be more strict about aliasing rules, so it
+ produces incorrect code if dtoa.cpp is compiled with
+ -fstrict-aliasing (it also emits a ton of warnings, so fair enough
+ I guess). The problem was that we were only casting variables to
+ union types in order to do type punning, but GCC and the C
+ standard require that we actually use a union to store the value.
+
+ This patch does just that, the code is mostly copied from the dtoa
+ version in GCC:
+ http://gcc.gnu.org/viewcvs/trunk/libjava/classpath/native/fdlibm/dtoa.c?view=markup.
+
+ * wtf/dtoa.cpp:
+ (WTF::ulp):
+ (WTF::b2d):
+ (WTF::ratio):
+ (WTF::hexnan):
+ (WTF::strtod):
+ (WTF::dtoa):
+
+2009-04-04 Kevin Ollivier <kevino@theolliviers.com>
+
+ wx build fix for Win port. Build the assembler sources to get missing functions.
+
+ * JavaScriptCoreSources.bkl:
+ * jscore.bkl:
+ * wtf/Platform.h:
+
+2009-04-02 Darin Adler <darin@apple.com>
+
+ Reviewed by Kevin Decker.
+
+ <rdar://problem/6744471> crash in GC due to uninitialized callFunction pointer
+
+ * runtime/JSGlobalObject.h:
+ (JSC::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData): Initialize
+ callFunction as we do the other data members that are used in the mark function.
+
+2009-04-02 Yael Aharon <yael.aharon@nokia.com>
+
+ Reviewed by Simon Hausmann
+
+ https://bugs.webkit.org/show_bug.cgi?id=24490
+
+ Implement WTF::ThreadSpecific in the Qt build using
+ QThreadStorage.
+
+ * wtf/ThreadSpecific.h:
+
+2009-04-01 Greg Bolsinga <bolsinga@apple.com>
+
+ Reviewed by Mark Rowe.
+
+ https://bugs.webkit.org/show_bug.cgi?id=24990
+ Put SECTORDER_FLAGS into xcconfig files.
+
+ * Configurations/Base.xcconfig:
+ * Configurations/DebugRelease.xcconfig:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2009-03-27 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by NOBODY (Build fix).
+
+ Fix non-AllInOneFile builds.
+
+ * bytecompiler/BytecodeGenerator.cpp:
+
+2009-03-27 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Improve performance of Function.prototype.call
+ <https://bugs.webkit.org/show_bug.cgi?id=24907>
+
+ Optimistically assume that expression.call(..) is going to be a call to
+ Function.prototype.call, and handle it specially to attempt to reduce the
+ degree of VM reentrancy.
+
+ When everything goes right this removes the vm reentry improving .call()
+ by around a factor of 10.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::dump):
+ * bytecode/Opcode.h:
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::emitJumpIfNotFunctionCall):
+ * bytecompiler/BytecodeGenerator.h:
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ * parser/Grammar.y:
+ * parser/Nodes.cpp:
+ (JSC::CallFunctionCallDotNode::emitBytecode):
+ * parser/Nodes.h:
+ (JSC::CallFunctionCallDotNode::):
+ * runtime/FunctionPrototype.cpp:
+ (JSC::FunctionPrototype::addFunctionProperties):
+ * runtime/FunctionPrototype.h:
+ * runtime/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::reset):
+ (JSC::JSGlobalObject::mark):
+ * runtime/JSGlobalObject.h:
+
+2009-03-27 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Darin Adler.
+
+ Bug 24884: Include strings.h for strcasecmp()
+ https://bugs.webkit.org/show_bug.cgi?id=24884
+
+ * runtime/DateMath.cpp: Reversed previous change including strings.h
+ * wtf/StringExtras.h: Include strings.h here is available
+
+2009-03-26 Adam Roben <aroben@apple.com>
+
+ Copy testapi.js to $WebKitOutputDir on Windows
+
+ Part of Bug 24856: run-javascriptcore-tests should run testapi on
+ Windows
+ <https://bugs.webkit.org/show_bug.cgi?id=24856>
+
+ This matches what Mac does, which will help once we enable running
+ testapi from run-javascriptcore-tests on Windows.
+
+ Reviewed by Steve Falkenburg.
+
+ * JavaScriptCore.vcproj/testapi/testapi.vcproj: Copy testapi.js next
+ to testapi.exe.
+
+2009-03-25 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Fix exception handling for instanceof in the interpreter.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+
+2009-03-25 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ Fixed <rdar://problem/6724011> Write to freed memory in JSC::Label::deref
+ when reloading http://helpme.att.net/speedtest/
+
+ * bytecompiler/BytecodeGenerator.h: Reversed the declaration order for
+ m_labelScopes and m_labels to reverse their destruction order.
+ m_labelScopes has references to memory within m_labels, so its destructor
+ needs to run first.
+
+2009-03-24 Eli Fidler <eli.fidler@torchmobile.com>
+
+ Reviewed by George Staikos.
+
+ Correct warnings which in some environments are treated as errors.
+
+ * wtf/dtoa.cpp:
+ (WTF::b2d):
+ (WTF::d2b):
+ (WTF::strtod):
+ (WTF::dtoa):
+
+2009-03-24 Kevin Ollivier <kevino@theolliviers.com>
+
+ Reviewed by Darin Adler.
+
+ Explicitly define HAVE_LANGINFO_H on Darwin. Fixes the wx build bot jscore
+ test failure.
+
+ https://bugs.webkit.org/show_bug.cgi?id=24780
+
+ * wtf/Platform.h:
+
+2009-03-23 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ Fix className() for API defined class
+
+ * API/JSCallbackObjectFunctions.h:
+ (JSC::::className):
+ * API/tests/testapi.c:
+ (EmptyObject_class):
+ (main):
+ * API/tests/testapi.js:
+
+2009-03-23 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Make testapi assertions run in release builds, so that testapi actually
+ works in a release build.
+
+ Many of the testapi assertions have side effects that are necessary, and
+ given testapi is a testing program, perf impact of an assertion is not
+ important, so it makes sense to apply the assertions in release builds
+ anyway.
+
+ * API/tests/testapi.c:
+ (EvilExceptionObject_hasInstance):
+
+2009-03-23 David Kilzer <ddkilzer@apple.com>
+
+ Provide JavaScript exception information after slow script timeout
+
+ Reviewed by Oliver Hunt.
+
+ * runtime/Completion.cpp:
+ (JSC::evaluate): Set the exception object as the Completion
+ object's value for slow script timeouts. This is used in
+ WebCore when reporting the exception.
+ * runtime/ExceptionHelpers.cpp:
+ (JSC::InterruptedExecutionError::toString): Added. Provides a
+ description message for the exception when it is reported.
+
+2009-03-23 Gustavo Noronha Silva <gns@gnome.org> and Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
+
+ Reviewed by Adam Roben.
+
+ https://bugs.webkit.org/show_bug.cgi?id=24674
+ Crashes in !PLATFORM(MAC)'s formatLocaleDate, in very specific situations
+
+ Make sure strftime never returns 2-digits years to avoid ambiguity
+ and a crash. We wrap this new code option in HAVE_LANGINFO_H,
+ since it is apparently not available in all platforms.
+
+ * runtime/DatePrototype.cpp:
+ (JSC::formatLocaleDate):
+ * wtf/Platform.h:
+
+2009-03-22 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ Fix exception handling in API
+
+ We can't just use the ExecState exception slot for returning exceptions
+ from class introspection functions provided through the API as many JSC
+ functions will explicitly clear the ExecState exception when returning.
+
+ * API/JSCallbackObjectFunctions.h:
+ (JSC::JSCallbackObject<Base>::getOwnPropertySlot):
+ (JSC::JSCallbackObject<Base>::put):
+ (JSC::JSCallbackObject<Base>::deleteProperty):
+ (JSC::JSCallbackObject<Base>::construct):
+ (JSC::JSCallbackObject<Base>::hasInstance):
+ (JSC::JSCallbackObject<Base>::call):
+ (JSC::JSCallbackObject<Base>::toNumber):
+ (JSC::JSCallbackObject<Base>::toString):
+ (JSC::JSCallbackObject<Base>::staticValueGetter):
+ (JSC::JSCallbackObject<Base>::callbackGetter):
+ * API/tests/testapi.c:
+ (MyObject_hasProperty):
+ (MyObject_getProperty):
+ (MyObject_setProperty):
+ (MyObject_deleteProperty):
+ (MyObject_callAsFunction):
+ (MyObject_callAsConstructor):
+ (MyObject_hasInstance):
+ (EvilExceptionObject_hasInstance):
+ (EvilExceptionObject_convertToType):
+ (EvilExceptionObject_class):
+ (main):
+ * API/tests/testapi.js:
+ (EvilExceptionObject.hasInstance):
+ (EvilExceptionObject.toNumber):
+ (EvilExceptionObject.toStringExplicit):
+
+2009-03-21 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 20049: testapi failure: MyObject - 0 should be NaN but instead is 1.
+ <https://bugs.webkit.org/show_bug.cgi?id=20049>
+ <rdar://problem/6079127>
+
+ In this case, the test is wrong. According to the ECMA spec, subtraction
+ uses ToNumber, not ToPrimitive. Change the test to match the spec.
+
+ * API/tests/testapi.js:
+
+2009-03-21 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ Ensure that JSObjectMakeFunction doesn't produce incorrect line numbers.
+
+ Also make test api correctly propagate failures.
+
+ * API/tests/testapi.c:
+ (main):
+ * runtime/FunctionConstructor.cpp:
+ (JSC::constructFunction):
+
+2009-03-21 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Mark Rowe.
+
+ Improve testapi by making it report failures in a way we can pick up
+ from our test scripts.
+
+ * API/tests/testapi.c:
+ (assertEqualsAsBoolean):
+ (assertEqualsAsNumber):
+ (assertEqualsAsUTF8String):
+ (assertEqualsAsCharactersPtr):
+ (main):
+ * API/tests/testapi.js:
+ (pass):
+ (fail):
+ (shouldBe):
+ (shouldThrow):
+
+2009-03-20 Norbert Leser <norbert.leser@nokia.com>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=24535
+
+ Fixes missing line terminator character (;) after macro call.
+ It is common practice to add the trailing ";" where macros are substituted
+ and not where they are defined with #define.
+ This change is consistent with other macro declarations across webkit,
+ and it also solves compilation failure with symbian compilers.
+
+ * runtime/UString.cpp:
+ * wtf/Assertions.h:
+
+2009-03-20 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Fixed a JavaScriptCore crash on the Windows buildbot.
+
+ * bytecompiler/BytecodeGenerator.h: Reduced the AST recursion limit.
+ Apparently, Windows has small stacks.
+
+2009-03-20 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ A little cleanup in the RegisterFile code.
+
+ Moved large inline functions out of the class declaration, to make it
+ more readable.
+
+ Switched over to using the roundUpAllocationSize function to avoid
+ duplicate code and subtle bugs.
+
+ Renamed m_maxCommitted to m_commitEnd, to match m_end.
+
+ Renamed allocationSize to commitSize because it's the chunk size for
+ committing memory, not allocating memory.
+
+ SunSpider reports no change.
+
+ * interpreter/RegisterFile.h:
+ (JSC::RegisterFile::RegisterFile):
+ (JSC::RegisterFile::shrink):
+ (JSC::RegisterFile::grow):
+ * jit/ExecutableAllocator.h:
+ (JSC::roundUpAllocationSize):
+
+2009-03-19 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Fixed <rdar://problem/6033712> -- a little bit of hardening in the Collector.
+
+ SunSpider reports no change. I also verified in the disassembly that
+ we end up with a single compare to constant.
+
+ * runtime/Collector.cpp:
+ (JSC::Heap::heapAllocate):
+
+2009-03-19 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Cameron Zwarich and Oliver Hunt.
+
+ Fixed <rdar://problem/6406045> REGRESSION: Stack overflow on PowerPC on
+ fast/workers/use-machine-stack.html (22531)
+
+ Dialed down the re-entry allowance to 64 (from 128).
+
+ On a 512K stack, this leaves about 64K for other code on the stack while
+ JavaScript is running. Not perfect, but it solves our crash on PPC.
+
+ Different platforms may want to dial this down even more.
+
+ Also, substantially shrunk BytecodeGenerator. Since we allocate one on
+ the stack in order to throw a stack overflow exception -- well, let's
+ just say the old code had an appreciation for irony.
+
+ SunSpider reports no change.
+
+ * bytecompiler/BytecodeGenerator.h:
+ * interpreter/Interpreter.h:
+ (JSC::):
+
+2009-03-19 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 24350: REGRESSION: Safari 4 breaks SPAW wysiwyg editor multiple instances
+ <https://bugs.webkit.org/show_bug.cgi?id=24350>
+ <rdar://problem/6674182>
+
+ The SPAW editor's JavaScript assumes that toString() on a function
+ constructed with the Function constructor produces a function with
+ a newline after the opening brace.
+
+ * runtime/FunctionConstructor.cpp:
+ (JSC::constructFunction): Add a newline after the opening brace of the
+ function's source code.
+
+2009-03-19 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Geoff Garen.
+
+ Bug 23771: REGRESSION (r36016): JSObjectHasProperty freezes on global class without kJSClassAttributeNoAutomaticPrototype
+ <https://bugs.webkit.org/show_bug.cgi?id=23771>
+ <rdar://problem/6561016>
+
+ * API/tests/testapi.c:
+ (main): Add a test for this bug.
+ * runtime/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::resetPrototype): Don't set the prototype of the
+ last object in the prototype chain to the object prototype when the
+ object prototype is already the last object in the prototype chain.
+
+2009-03-19 Timothy Hatcher <timothy@apple.com>
+
+ <rdar://problem/6687342> -[WebView scheduleInRunLoop:forMode:] has no affect on timers
+
+ Reviewed by Darin Adler.
+
+ * wtf/Platform.h: Added HAVE_RUNLOOP_TIMER for PLATFORM(MAC).
+
+2009-03-19 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Fixed <rdar://problem/6279213> Regular expression run-time complexity
+ limit too low for long inputs (21485)
+
+ I raised PCRE's "matchLimit" (limit on backtracking) by an order of
+ magnitude. This fixes all the reported examples of timing out on legitimate
+ regular expression matches.
+
+ In my testing on a Core Duo MacBook Pro, the longest you can get stuck
+ trying to match a string is still under 1s, so this seems like a safe change.
+
+ I can think of a number of better solutions that are more complicated,
+ but this is a good improvement for now.
+
+ * pcre/pcre_exec.cpp:
+
+2009-03-19 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Fixed <rdar://problem/6603562> REGRESSION (Safari 4): regular expression
+ pattern size limit lower than Safari 3.2, other browsers, breaks SAP (14873)
+
+ Bumped the pattern size limit to 1MB, and standardized it between PCRE
+ and WREC. (Empirical testing says that we can easily compile a 1MB regular
+ expression without risking a hang. Other browsers support bigger regular
+ expressions, but also hang.)
+
+ SunSpider reports no change.
+
+ I started with a patch posted to Bugzilla by Erik Corry (erikcorry@google.com).
+
+ * pcre/pcre_internal.h:
+ (put3ByteValue):
+ (get3ByteValue):
+ (put3ByteValueAndAdvance):
+ (putLinkValueAllowZero):
+ (getLinkValueAllowZero): Made PCRE's "LINK_SIZE" (the number of bytes
+ used to record jumps between bytecodes) 3, to accomodate larger potential
+ jumps. Bumped PCRE's "MAX_PATTERN_SIZE" to 1MB. (Technically, at this
+ LINK_SIZE, we can support even larger patterns, but we risk a hang during
+ compilation, and it's not clear that such large patterns are important
+ on the web.)
+
+ * wrec/WREC.cpp:
+ (JSC::WREC::Generator::compileRegExp): Match PCRE's maximum pattern size,
+ to avoid quirks between platforms.
+
+2009-03-18 Ada Chan <adachan@apple.com>
+
+ Rolling out r41818 since it broke the windows build.
+ Error: ..\..\runtime\DatePrototype.cpp(30) : fatal error C1083: Cannot open include file: 'langinfo.h': No such file or directory
+
+ * runtime/DatePrototype.cpp:
+ (JSC::formatLocaleDate):
+
+2009-03-17 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ <rdar://problem/6692138> REGRESSION (Safari 4): Incorrect function return value when using IE "try ... finally" memory leak work-around (24654)
+ <https://bugs.webkit.org/show_bug.cgi?id=24654>
+
+ If the return value for a function is in a local register we need
+ to copy it before executing any finalisers, otherwise it is possible
+ for the finaliser to clobber the result.
+
+ * bytecompiler/BytecodeGenerator.h:
+ (JSC::BytecodeGenerator::hasFinaliser):
+ * parser/Nodes.cpp:
+ (JSC::ReturnNode::emitBytecode):
+
+2009-03-17 Kevin Ollivier <kevino@theolliviers.com>
+
+ Reviewed by Mark Rowe.
+
+ Move BUILDING_ON_* defines into Platform.h to make them available to other ports.
+ Also tweak the defines so that they work with the default values set by
+ AvailabilityMacros.h.
+
+ https://bugs.webkit.org/show_bug.cgi?id=24630
+
+ * JavaScriptCorePrefix.h:
+ * wtf/Platform.h:
+
+2009-03-15 Simon Fraser <simon.fraser@apple.com>
+
+ Revert r41718 because it broke DumpRenderTree on Tiger.
+
+ * JavaScriptCorePrefix.h:
+ * wtf/Platform.h:
+
+2009-03-15 Kevin Ollivier <kevino@theolliviers.com>
+
+ Non-Apple Mac ports build fix. Move defines for the BUILDING_ON_ macros into
+ Platform.h so that they're defined for all ports building on Mac, and tweak
+ the definitions of those macros based on Mark Rowe's suggestions to accomodate
+ cases where the values may not be <= to the .0 release for that version.
+
+ * JavaScriptCorePrefix.h:
+ * wtf/Platform.h:
+
+2009-03-13 Mark Rowe <mrowe@apple.com>
+
+ Rubber-stamped by Dan Bernstein.
+
+ Take advantage of the ability of recent versions of Xcode to easily switch the active
+ architecture.
+
+ * Configurations/DebugRelease.xcconfig:
+
+2009-03-13 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by David Kilzer.
+
+ Prevent AllInOneFile.cpp and ProfileGenerator.cpp from rebuilding unnecessarily when
+ switching between building in Xcode and via build-webkit.
+
+ build-webkit passes FEATURE_DEFINES to xcodebuild, resulting in it being present in the
+ Derived Sources build settings. When building in Xcode, this setting isn't present so
+ Xcode reruns the script build phases. This results in a new version of TracingDtrace.h
+ being generated, and the files that include it being rebuilt.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj: Don't regenerate TracingDtrace.h if it is
+ already newer than the input file.
+
+2009-03-13 Norbert Leser <norbert.leser@nokia.com>
+
+ Reviewed by Darin Adler.
+
+ Resolved name conflict with globally defined tzname in Symbian.
+ Replaced with different name instead of using namespace qualifier
+ (appeared to be less clumsy).
+
+ * runtime/DateMath.cpp:
+
+2009-03-12 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Darin Adler.
+
+ <rdar://problem/6548446> TCMalloc_SystemRelease should use madvise rather than re-mmaping span of pages
+
+ * wtf/FastMalloc.cpp:
+ (WTF::mergeDecommittedStates): If either of the spans has been released to the system, release the other
+ span as well so that the flag in the merged span is accurate.
+ * wtf/Platform.h:
+ * wtf/TCSystemAlloc.cpp: Track decommitted spans when using MADV_FREE_REUSABLE / MADV_FREE_REUSE.
+ (TCMalloc_SystemRelease): Use madvise with MADV_FREE_REUSABLE when it is available.
+ (TCMalloc_SystemCommit): Use madvise with MADV_FREE_REUSE when it is available.
+ * wtf/TCSystemAlloc.h:
+
+2009-03-12 Adam Treat <adam.treat@torchmobile.com>
+
+ Reviewed by NOBODY (Build fix).
+
+ Include string.h for strlen usage.
+
+ * wtf/Threading.cpp:
+
+2009-03-12 David Kilzer <ddkilzer@apple.com>
+
+ Add NO_RETURN attribute to runInteractive() when not using readline
+
+ Reviewed by Darin Adler.
+
+ * jsc.cpp:
+ (runInteractive): If the readline library is not used, this method
+ will never return, thus the NO_RETURN attribute is needed to prevent
+ a gcc warning.
+
+2009-03-12 Adam Roben <aroben@apple.com>
+
+ Adopt setThreadNameInternal on Windows
+
+ Also changed a Windows-only assertion about thread name length to an
+ all-platform log message.
+
+ Reviewed by Adam Treat.
+
+ * wtf/Threading.cpp:
+ (WTF::createThread): Warn if the thread name is longer than 31
+ characters, as Visual Studio will truncate names longer than that
+ length.
+
+ * wtf/ThreadingWin.cpp:
+ (WTF::setThreadNameInternal): Renamed from setThreadName and changed
+ to always operate on the current thread.
+ (WTF::initializeThreading): Changed to use setThreadNameInternal.
+ (WTF::createThreadInternal): Removed call to setThreadName. This is
+ now handled by threadEntryPoint and setThreadNameInternal.
+
+2009-03-11 David Kilzer <ddkilzer@apple.com>
+
+ Clarify comments regarding order of FEATURE_DEFINES
+
+ Rubber-stamped by Mark Rowe.
+
+ * Configurations/JavaScriptCore.xcconfig: Added warning about
+ the consequences when FEATURE_DEFINES are not kept in sync.
+
+2009-03-11 Dan Bernstein <mitz@apple.com>
+
+ Reviewed by Darin Adler.
+
+ - WTF support for fixing <rdar://problem/3919124> Thai text selection
+ in Safari is incorrect
+
+ * wtf/unicode/icu/UnicodeIcu.h:
+ (WTF::Unicode::hasLineBreakingPropertyComplexContext): Added. Returns
+ whether the character has Unicode line breaking property value SA
+ ("Complex Context").
+ * wtf/unicode/qt4/UnicodeQt4.h:
+ (WTF::Unicode::hasLineBreakingPropertyComplexContext): Added an
+ implementation that always returns false.
+
+2009-03-11 Darin Adler <darin@apple.com>
+
+ Reviewed by Mark Rowe.
+
+ Give threads names on platforms with pthread_setname_np.
+
+ * wtf/Threading.cpp:
+ (WTF::NewThreadContext::NewThreadContext): Initialize thread name.
+ (WTF::threadEntryPoint): Call setThreadNameInternal.
+ (WTF::createThread): Pass thread name.
+
+ * wtf/Threading.h: Added new comments, setThreadNameInternal.
+
+ * wtf/ThreadingGtk.cpp:
+ (WTF::setThreadNameInternal): Added. Empty.
+ * wtf/ThreadingNone.cpp:
+ (WTF::setThreadNameInternal): Added. Empty.
+ * wtf/ThreadingPthreads.cpp:
+ (WTF::setThreadNameInternal): Call pthread_setname_np when available.
+ * wtf/ThreadingQt.cpp:
+ (WTF::setThreadNameInternal): Added. Empty.
+ * wtf/ThreadingWin.cpp:
+ (WTF::setThreadNameInternal): Added. Empty.
+
+2009-03-11 Adam Roben <aroben@apple.com>
+
+ Change the Windows implementation of ThreadSpecific to use functions
+ instead of extern globals
+
+ This will make it easier to export ThreadSpecific from WebKit.
+
+ Reviewed by John Sullivan.
+
+ * API/JSBase.cpp:
+ (JSEvaluateScript):
+ Touched this file to force ThreadSpecific.h to be copied into
+ $WebKitOutputDir.
+
+ * wtf/ThreadSpecific.h: Replaced g_tls_key_count with tlsKeyCount()
+ and g_tls_keys with tlsKeys().
+
+ (WTF::::ThreadSpecific):
+ (WTF::::~ThreadSpecific):
+ (WTF::::get):
+ (WTF::::set):
+ (WTF::::destroy):
+ Updated to use the new functions.
+
+ * wtf/ThreadSpecificWin.cpp:
+ (WTF::tlsKeyCount):
+ (WTF::tlsKeys):
+ Added.
+
+ (WTF::ThreadSpecificThreadExit): Changed to use the new functions.
+
+2009-03-10 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Geoff Garen.
+
+ Bug 24291: REGRESSION (r38635): Single line JavaScript comment prevents HTML button click handler execution
+ <https://bugs.webkit.org/show_bug.cgi?id=24291>
+ <rdar://problem/6663472>
+
+ Add an extra newline to the end of the body of the program text constructed
+ by the Function constructor for parsing. This allows single line comments to
+ be handled correctly by the parser.
+
+ * runtime/FunctionConstructor.cpp:
+ (JSC::constructFunction):
+
+2009-03-09 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Bug 24447: REGRESSION (r41508): Google Maps does not complete initialization
+ <rdar://problem/6657774>
+
+ r41508 actually exposed a pre-existing bug where we were not invalidating the result
+ register cache at jump targets. This causes problems when condition loads occur in an
+ expression -- namely through the ?: and || operators. This patch corrects these issues
+ by marking the target of all forward jumps as being a jump target, and then clears the
+ result register cache when ever it starts generating code for a targeted instruction.
+
+ I do not believe it is possible to cause this class of failure outside of a single
+ expression, and expressions only provide forward branches, so this should resolve this
+ entire class of bug. That said i've included a test case that gets as close as possible
+ to hitting this bug with a back branch, to hopefully prevent anyone from introducing the
+ problem in future.
+
+ * assembler/AbstractMacroAssembler.h:
+ (JSC::AbstractMacroAssembler::Label::isUsed):
+ (JSC::AbstractMacroAssembler::Label::used):
+ * assembler/X86Assembler.h:
+ (JSC::X86Assembler::JmpDst::JmpDst):
+ (JSC::X86Assembler::JmpDst::isUsed):
+ (JSC::X86Assembler::JmpDst::used):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+
+2009-03-09 David Levin <levin@chromium.org>
+
+ Reviewed by Darin Adler.
+
+ Bug 23175: String and UString should be able to share a UChar* buffer.
+ <https://bugs.webkit.org/show_bug.cgi?id=23175>
+
+ Add CrossThreadRefCounted.
+
+ * wtf/CrossThreadRefCounted.h: Added.
+ (WTF::CrossThreadRefCounted::create):
+ (WTF::CrossThreadRefCounted::isShared):
+ (WTF::CrossThreadRefCounted::dataAccessMustBeThreadSafe):
+ (WTF::CrossThreadRefCounted::mayBePassedToAnotherThread):
+ (WTF::CrossThreadRefCounted::CrossThreadRefCounted):
+ (WTF::CrossThreadRefCounted::~CrossThreadRefCounted):
+ (WTF::CrossThreadRefCounted::ref):
+ (WTF::CrossThreadRefCounted::deref):
+ (WTF::CrossThreadRefCounted::release):
+ (WTF::CrossThreadRefCounted::copy):
+ (WTF::CrossThreadRefCounted::threadSafeDeref):
+ * wtf/RefCounted.h:
+ * wtf/Threading.h:
+ (WTF::ThreadSafeSharedBase::ThreadSafeSharedBase):
+ (WTF::ThreadSafeSharedBase::derefBase):
+ (WTF::ThreadSafeShared::ThreadSafeShared):
+ (WTF::ThreadSafeShared::deref):
+
+2009-03-09 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by George Staikos.
+
+ https://bugs.webkit.org/show_bug.cgi?id=24353
+ Allow to overrule default build options for Qt build.
+
+ * JavaScriptCore.pri: Allow to overrule ENABLE_JIT
+
+2009-03-08 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by NOBODY (build fix).
+
+ Build fix.
+
+ * runtime/ArrayPrototype.cpp:
+ (JSC::arrayProtoFuncConcat):
+
+2009-03-01 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ Bug 24268: RuntimeArray is not a fully implemented JSArray
+ <https://bugs.webkit.org/show_bug.cgi?id=24268>
+
+ Don't cast a type to JSArray, just because it reportsArray as a supertype
+ in the JS type system. Doesn't appear feasible to create a testcase
+ unfortunately as setting up the failure conditions requires internal access
+ to JSC not present in DRT.
+
+ * runtime/ArrayPrototype.cpp:
+ (JSC::arrayProtoFuncConcat):
+
+2009-03-06 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ When preforming an op_mov, preserve any existing register mapping.
+
+ ~0.5% progression on v8 tests x86-64.
+
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+
+2009-03-05 Simone Fiorentino <simone.fiorentino@consulenti.fastweb.it>
+
+ Bug 24382: request to add SH4 platform
+
+ <https://bugs.webkit.org/show_bug.cgi?id=24382>
+
+ Reviewed by David Kilzer.
+
+ * wtf/Platform.h: Added support for SH4 platform.
+
+2009-03-05 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Writes of constant values to SF registers should be made with direct memory
+ writes where possible, rather than moving the value via a hardware register.
+
+ ~3% win on SunSpider tests on x86, ~1.5% win on v8 tests on x86-64.
+
+ * assembler/MacroAssemblerX86_64.h:
+ (JSC::MacroAssemblerX86_64::storePtr):
+ * assembler/X86Assembler.h:
+ (JSC::X86Assembler::movq_i32m):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+
+2009-03-05 Mark Rowe <mrowe@apple.com>
+
+ Fix the build.
+
+ Sprinkle "static" around NumberConstructor.cpp in order to please the compiler.
+
+ * runtime/NumberConstructor.cpp:
+ (JSC::numberConstructorNaNValue):
+ (JSC::numberConstructorNegInfinity):
+ (JSC::numberConstructorPosInfinity):
+ (JSC::numberConstructorMaxValue):
+ (JSC::numberConstructorMinValue):
+
+2009-03-04 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ <rdar://problem/6354858> FastMallocZone's enumeration code reports fragmented administration space
+
+ The handling of MALLOC_ADMIN_REGION_RANGE_TYPE in FastMalloc's zone was incorrect. It was attempting
+ to record the memory containing and individual span as an administrative region, when all memory
+ allocated via MetaDataAlloc should in fact be recorded. This was causing memory regions allocated
+ via MetaDataAlloc to appear as "VM_ALLOCATE ?" in vmmap output. They are now correctly reported as
+ "MALLOC_OTHER" regions associated with the JavaScriptCore FastMalloc zone.
+
+ Memory is allocated via MetaDataAlloc from two locations: PageHeapAllocator, and TCMalloc_PageMap{2,3}.
+ These two cases are handled differently.
+
+ PageHeapAllocator is extended to keep a linked list of memory regions that it has allocated. The
+ first object in an allocated region contains the link to the previously allocated region. To record
+ the administrative regions of a PageHeapAllocator we can simply walk the linked list and record
+ each allocated region we encounter.
+
+ TCMalloc_PageMaps allocate memory via MetaDataAlloc to store each level of the radix tree. To record
+ the administrative regions of a TCMalloc_PageMap we walk the tree and record the storage used for nodes
+ at each position rather than the nodes themselves.
+
+ A small performance improvement is achieved by coalescing adjacent memory regions inside the PageMapMemoryUsageRecorder
+ so that fewer calls in to the range recorder are necessary. We further reduce the number of calls to the
+ range recorder by aggregating the in-use ranges of a given memory region into a local buffer before recording
+ them with a single call. A similar approach is also used by AdminRegionRecorder.
+
+ * wtf/FastMalloc.cpp:
+ (WTF::PageHeapAllocator::Init):
+ (WTF::PageHeapAllocator::New):
+ (WTF::PageHeapAllocator::recordAdministrativeRegions):
+ (WTF::TCMallocStats::FreeObjectFinder::isFreeObject):
+ (WTF::TCMallocStats::PageMapMemoryUsageRecorder::~PageMapMemoryUsageRecorder):
+ (WTF::TCMallocStats::PageMapMemoryUsageRecorder::recordPendingRegions):
+ (WTF::TCMallocStats::PageMapMemoryUsageRecorder::visit):
+ (WTF::TCMallocStats::AdminRegionRecorder::AdminRegionRecorder):
+ (WTF::TCMallocStats::AdminRegionRecorder::recordRegion):
+ (WTF::TCMallocStats::AdminRegionRecorder::visit):
+ (WTF::TCMallocStats::AdminRegionRecorder::recordPendingRegions):
+ (WTF::TCMallocStats::AdminRegionRecorder::~AdminRegionRecorder):
+ (WTF::TCMallocStats::FastMallocZone::enumerate):
+ (WTF::TCMallocStats::FastMallocZone::FastMallocZone):
+ (WTF::TCMallocStats::FastMallocZone::init):
+ * wtf/TCPageMap.h:
+ (TCMalloc_PageMap2::visitValues):
+ (TCMalloc_PageMap2::visitAllocations):
+ (TCMalloc_PageMap3::visitValues):
+ (TCMalloc_PageMap3::visitAllocations):
+
+2009-03-04 Antti Koivisto <antti@apple.com>
+
+ Reviewed by Dave Hyatt.
+
+ https://bugs.webkit.org/show_bug.cgi?id=24359
+ Repaint throttling mechanism
+
+ Set ENABLE_REPAINT_THROTTLING to 0 by default.
+
+ * wtf/Platform.h:
+
+2009-03-03 David Kilzer <ddkilzer@apple.com>
+
+ <rdar://problem/6581203> WebCore and WebKit should install the same set of headers during installhdrs phase as build phase
+
+ Reviewed by Mark Rowe.
+
+ * Configurations/Base.xcconfig: Defined REAL_PLATFORM_NAME based
+ on PLATFORM_NAME to work around the missing definition on Tiger.
+ Updated HAVE_DTRACE to use REAL_PLATFORM_NAME.
+
+2009-03-03 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ <rdar://problem/6639110> console.profile() doesn't work without a title
+
+ * profiler/Profiler.cpp:
+ (JSC::Profiler::startProfiling): assert if there is not title to ensure
+ we don't start profiling without one.
+
+2009-03-02 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Mark Rowe.
+
+ Enable Geolocation (except on Tiger and Leopard).
+
+ * Configurations/JavaScriptCore.xcconfig:
+
+2009-03-01 David Kilzer <ddkilzer@apple.com>
+
+ <rdar://problem/6635688> Move HAVE_DTRACE check to Base.xcconfig
+
+ Reviewed by Mark Rowe.
+
+ * Configurations/Base.xcconfig: Set HAVE_DTRACE Xcode variable
+ based on PLATFORM_NAME and MAC_OS_X_VERSION_MAJOR. Also define
+ it as a preprocessor macro by modifying
+ GCC_PREPROCESSOR_DEFINITIONS.
+ * JavaScriptCore.xcodeproj/project.pbxproj: Changed "Generate
+ DTrace header" script phase to check for HAVE_DTRACE instead of
+ MACOSX_DEPLOYMENT_TARGET.
+ * wtf/Platform.h: Removed definition of HAVE_DTRACE macro since
+ it's defined in Base.xcconfig now.
+
+2009-03-01 Horia Olaru <olaru@adobe.com>
+
+ By looking in grammar.y there are only a few types of statement nodes
+ on which the debugger should stop.
+
+ Removed isBlock and isLoop virtual calls. No need to emit debug hooks in
+ the "statementListEmitCode" method as long as the necessary hooks can be
+ added in each "emitCode".
+
+ https://bugs.webkit.org/show_bug.cgi?id=21073
+
+ Reviewed by Kevin McCullough.
+
+ * parser/Nodes.cpp:
+ (JSC::ConstStatementNode::emitBytecode):
+ (JSC::statementListEmitCode):
+ (JSC::EmptyStatementNode::emitBytecode):
+ (JSC::ExprStatementNode::emitBytecode):
+ (JSC::VarStatementNode::emitBytecode):
+ (JSC::IfNode::emitBytecode):
+ (JSC::IfElseNode::emitBytecode):
+ (JSC::DoWhileNode::emitBytecode):
+ (JSC::WhileNode::emitBytecode):
+ (JSC::ForNode::emitBytecode):
+ (JSC::ForInNode::emitBytecode):
+ (JSC::ContinueNode::emitBytecode):
+ (JSC::BreakNode::emitBytecode):
+ (JSC::ReturnNode::emitBytecode):
+ (JSC::WithNode::emitBytecode):
+ (JSC::SwitchNode::emitBytecode):
+ (JSC::LabelNode::emitBytecode):
+ (JSC::ThrowNode::emitBytecode):
+ (JSC::TryNode::emitBytecode):
+ * parser/Nodes.h:
+
+2009-02-26 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Fix bug #23614. Switches on double precision values were incorrectly
+ truncating the scrutinee value. E.g.:
+
+ switch (1.1) { case 1: print("FAIL"); }
+
+ Was resulting in FAIL.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+ * jit/JITStubs.cpp:
+ (JSC::JITStubs::cti_op_switch_imm):
+
+2009-02-26 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Integer Immediate representation need not be canonical in x86 JIT code.
+ On x86-64 we already have loosened the requirement that the int immediate
+ representation in canonical, we should bring x86 into line.
+
+ This patch is a minor (~0.5%) improvement on sunspider & v8-tests, and
+ should reduce memory footoprint (reduces JIT code size).
+
+ * jit/JIT.cpp:
+ (JSC::JIT::compileOpStrictEq):
+ (JSC::JIT::privateCompileSlowCases):
+ * jit/JIT.h:
+ (JSC::JIT::emitJumpIfImmediateNumber):
+ (JSC::JIT::emitJumpIfNotImmediateNumber):
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::putDoubleResultToJSNumberCellOrJSImmediate):
+ (JSC::JIT::compileBinaryArithOp):
+
+2009-02-26 Carol Szabo <carol.szabo@nokia.com>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=24099
+ ARM Compiler Warnings in pcre_exec.cpp
+
+ * pcre/pcre_exec.cpp:
+ (match):
+
+2009-02-25 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Gavin Barraclough.
+
+ Bug 24086: Regression (r40993): WebKit crashes after logging in to lists.zenbe
+ <https://bugs.webkit.org/show_bug.cgi?id=24086>
+ <rdar://problem/6625111>
+
+ The numeric sort optimization in r40993 generated bytecode for a function
+ without generating JIT code. This breaks an assumption in some parts of
+ the JIT's function calling logic that the presence of a CodeBlock implies
+ the existence of JIT code.
+
+ In order to fix this, we simply generate JIT code whenever we check whether
+ a function is a numeric sort function. This only incurs an additional cost
+ in the case when the function is a numeric sort function, in which case it
+ is not expensive to generate JIT code for it.
+
+ * runtime/ArrayPrototype.cpp:
+ (JSC::isNumericCompareFunction):
+
+2009-02-25 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Fixed <rdar://problem/6611174> REGRESSION (r36701): Unable to select
+ messages on hotmail (24052)
+
+ The bug was that for-in enumeration used a cached prototype chain without
+ validating that it was up-to-date.
+
+ This led me to refactor prototype chain caching so it was easier to work
+ with and harder to get wrong.
+
+ After a bit of inlining, this patch is performance-neutral on SunSpider
+ and the v8 benchmarks.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::tryCachePutByID):
+ (JSC::Interpreter::tryCacheGetByID):
+ * jit/JITStubs.cpp:
+ (JSC::JITStubs::tryCachePutByID):
+ (JSC::JITStubs::tryCacheGetByID):
+ (JSC::JITStubs::cti_op_get_by_id_proto_list): Use the new refactored goodness. See
+ lines beginning with "-" and smile.
+
+ * runtime/JSGlobalObject.h:
+ (JSC::Structure::prototypeForLookup): A shout out to const.
+
+ * runtime/JSPropertyNameIterator.h:
+ (JSC::JSPropertyNameIterator::next): We can use a pointer comparison to
+ see if our cached structure chain is equal to the object's structure chain,
+ since in the case of a cache hit, we share references to the same structure
+ chain.
+
+ * runtime/Operations.h:
+ (JSC::countPrototypeChainEntriesAndCheckForProxies): Use the new refactored
+ goodness.
+
+ * runtime/PropertyNameArray.h:
+ (JSC::PropertyNameArray::PropertyNameArray):
+ (JSC::PropertyNameArray::setShouldCache):
+ (JSC::PropertyNameArray::shouldCache): Renamed "cacheable" to "shouldCache"
+ to communicate that the client is specifying a recommendation, not a
+ capability.
+
+ * runtime/Structure.cpp:
+ (JSC::Structure::Structure): No need to initialize a RefPtr.
+ (JSC::Structure::getEnumerablePropertyNames): Moved some code into helper
+ functions.
+
+ (JSC::Structure::prototypeChain): New centralized accessor for a prototype
+ chain. Revalidates on every access, since the objects in the prototype
+ chain may have mutated.
+
+ (JSC::Structure::isValid): Helper function for revalidating a cached
+ prototype chain.
+
+ (JSC::Structure::getEnumerableNamesFromPropertyTable):
+ (JSC::Structure::getEnumerableNamesFromClassInfoTable): Factored out of
+ getEnumerablePropertyNames.
+
+ * runtime/Structure.h:
+
+ * runtime/StructureChain.cpp:
+ (JSC::StructureChain::StructureChain):
+ * runtime/StructureChain.h:
+ (JSC::StructureChain::create): No need for structureChainsAreEqual, since
+ we use pointer equality now. Refactored StructureChain to make a little
+ more sense and eliminate special cases for null prototypes.
+
+2009-02-25 Steve Falkenburg <sfalken@apple.com>
+
+ Use timeBeginPeriod to enable timing resolution greater than 16ms in command line jsc for Windows.
+ Allows more accurate reporting of benchmark times via command line jsc.exe. Doesn't affect WebKit's use of JavaScriptCore.
+
+ Reviewed by Adam Roben.
+
+ * jsc.cpp:
+ (main):
+
+2009-02-24 Geoffrey Garen <ggaren@apple.com>
+
+ Build fix?
+
+ * GNUmakefile.am:
+
+2009-02-24 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ <rdar://problem/6259220> Rename AVAILABLE_AFTER_WEBKIT_VERSION_3_1 (etc.) to match the other macros
+
+ * API/JSBasePrivate.h:
+ * API/JSContextRef.h:
+ * API/JSObjectRef.h:
+ * API/WebKitAvailability.h:
+
+2009-02-23 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Next step in splitting JIT functionality out of the Interpreter class:
+ Moved vptr storage from Interpreter to JSGlobalData, so it could be shared
+ between Interpreter and JITStubs, and moved the *Trampoline JIT stubs
+ into the JITStubs class. Also added a VPtrSet class to encapsulate vptr
+ hacks during JSGlobalData initialization.
+
+ SunSpider says 0.4% faster. Meh.
+
+ * JavaScriptCore.exp:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::Interpreter):
+ (JSC::Interpreter::tryCacheGetByID):
+ (JSC::Interpreter::privateExecute):
+ * interpreter/Interpreter.h:
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ (JSC::JIT::privateCompile):
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ * jit/JIT.h:
+ (JSC::JIT::compileCTIMachineTrampolines):
+ * jit/JITCall.cpp:
+ (JSC::JIT::compileOpCall):
+ (JSC::JIT::compileOpCallSlowCase):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::privateCompilePatchGetArrayLength):
+ * jit/JITStubs.cpp:
+ (JSC::JITStubs::JITStubs):
+ (JSC::JITStubs::tryCacheGetByID):
+ (JSC::JITStubs::cti_vm_dontLazyLinkCall):
+ (JSC::JITStubs::cti_op_get_by_val):
+ (JSC::JITStubs::cti_op_get_by_val_byte_array):
+ (JSC::JITStubs::cti_op_put_by_val):
+ (JSC::JITStubs::cti_op_put_by_val_array):
+ (JSC::JITStubs::cti_op_put_by_val_byte_array):
+ (JSC::JITStubs::cti_op_is_string):
+ * jit/JITStubs.h:
+ (JSC::JITStubs::ctiArrayLengthTrampoline):
+ (JSC::JITStubs::ctiStringLengthTrampoline):
+ (JSC::JITStubs::ctiVirtualCallPreLink):
+ (JSC::JITStubs::ctiVirtualCallLink):
+ (JSC::JITStubs::ctiVirtualCall):
+ * runtime/ArrayPrototype.cpp:
+ (JSC::arrayProtoFuncPop):
+ (JSC::arrayProtoFuncPush):
+ * runtime/FunctionPrototype.cpp:
+ (JSC::functionProtoFuncApply):
+ * runtime/JSArray.h:
+ (JSC::isJSArray):
+ * runtime/JSByteArray.h:
+ (JSC::asByteArray):
+ (JSC::isJSByteArray):
+ * runtime/JSCell.h:
+ * runtime/JSFunction.h:
+ * runtime/JSGlobalData.cpp:
+ (JSC::VPtrSet::VPtrSet):
+ (JSC::JSGlobalData::JSGlobalData):
+ (JSC::JSGlobalData::create):
+ (JSC::JSGlobalData::sharedInstance):
+ * runtime/JSGlobalData.h:
+ * runtime/JSString.h:
+ (JSC::isJSString):
+ * runtime/Operations.h:
+ (JSC::jsLess):
+ (JSC::jsLessEq):
+ * wrec/WREC.cpp:
+ (JSC::WREC::Generator::compileRegExp):
+
+2009-02-23 Csaba Osztrogonac <oszi@inf.u-szeged.hu>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 23787: Allow JIT to generate SSE2 code if using GCC
+ <https://bugs.webkit.org/show_bug.cgi?id=23787>
+
+ GCC version of the cpuid check.
+
+ * jit/JITArithmetic.cpp:
+ (JSC::isSSE2Present): previous assembly code fixed.
+
+2009-02-23 David Levin <levin@chromium.org>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Bug 24047: Need to simplify nested if's in WorkerRunLoop::runInMode
+ <https://bugs.webkit.org/show_bug.cgi?id=24047>
+
+ * wtf/MessageQueue.h:
+ (WTF::MessageQueue::infiniteTime):
+ Allows for one to call waitForMessageFilteredWithTimeout and wait forever.
+
+ (WTF::MessageQueue::alwaysTruePredicate):
+ (WTF::MessageQueue::waitForMessage):
+ Made waitForMessage call waitForMessageFilteredWithTimeout, so that there is less
+ duplicate code.
+
+ (WTF::MessageQueue::waitForMessageFilteredWithTimeout):
+
+ * wtf/ThreadingQt.cpp:
+ (WTF::ThreadCondition::timedWait):
+ * wtf/ThreadingWin.cpp:
+ (WTF::ThreadCondition::timedWait):
+ Made these two implementations consistent with the pthread and gtk implementations.
+ Currently, the time calculations would overflow when passed large values.
+
+2009-02-23 Jeremy Moskovich <jeremy@chromium.org>
+
+ Reviewed by Adam Roben.
+
+ https://bugs.webkit.org/show_bug.cgi?id=24096
+ PLATFORM(MAC)->PLATFORM(CF) since we want to use the CF functions in Chrome on OS X.
+
+ * wtf/CurrentTime.cpp:
+
+2009-02-22 Geoffrey Garen <ggaren@apple.com>
+
+ Build fix?
+
+ * GNUmakefile.am:
+
+2009-02-22 Geoffrey Garen <ggaren@apple.com>
+
+ Build fix.
+
+ * GNUmakefile.am:
+
+2009-02-22 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Next step in splitting JIT functionality out of the Interpreter class:
+ Created a JITStubs class and renamed Interpreter::cti_* to JITStubs::cti_*.
+
+ Also, moved timeout checking into its own class, located in JSGlobalData,
+ so both the Interpreter and the JIT could have access to it.
+
+ * JavaScriptCore.exp:
+ * JavaScriptCore.pri:
+ * JavaScriptCore.scons:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * JavaScriptCoreSources.bkl:
+ * interpreter/CallFrame.h:
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::Interpreter):
+ (JSC::Interpreter::privateExecute):
+ * interpreter/Interpreter.h:
+ * interpreter/Register.h:
+ * jit/JIT.cpp:
+ (JSC::):
+ (JSC::JIT::emitTimeoutCheck):
+ (JSC::JIT::privateCompileMainPass):
+ (JSC::JIT::privateCompileSlowCases):
+ (JSC::JIT::privateCompile):
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ * jit/JIT.h:
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::compileFastArithSlow_op_lshift):
+ (JSC::JIT::compileFastArithSlow_op_rshift):
+ (JSC::JIT::compileFastArithSlow_op_bitand):
+ (JSC::JIT::compileFastArithSlow_op_mod):
+ (JSC::JIT::compileFastArith_op_mod):
+ (JSC::JIT::compileFastArithSlow_op_post_inc):
+ (JSC::JIT::compileFastArithSlow_op_post_dec):
+ (JSC::JIT::compileFastArithSlow_op_pre_inc):
+ (JSC::JIT::compileFastArithSlow_op_pre_dec):
+ (JSC::JIT::compileFastArith_op_add):
+ (JSC::JIT::compileFastArith_op_mul):
+ (JSC::JIT::compileFastArith_op_sub):
+ (JSC::JIT::compileBinaryArithOpSlowCase):
+ (JSC::JIT::compileFastArithSlow_op_add):
+ (JSC::JIT::compileFastArithSlow_op_mul):
+ * jit/JITCall.cpp:
+ (JSC::JIT::compileOpCall):
+ (JSC::JIT::compileOpCallSlowCase):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::compileGetByIdHotPath):
+ (JSC::JIT::compilePutByIdHotPath):
+ (JSC::JIT::compileGetByIdSlowCase):
+ (JSC::JIT::compilePutByIdSlowCase):
+ (JSC::JIT::privateCompilePutByIdTransition):
+ (JSC::JIT::patchGetByIdSelf):
+ (JSC::JIT::patchPutByIdReplace):
+ (JSC::JIT::privateCompilePatchGetArrayLength):
+ (JSC::JIT::privateCompileGetByIdSelf):
+ (JSC::JIT::privateCompileGetByIdProto):
+ (JSC::JIT::privateCompileGetByIdChain):
+ (JSC::JIT::privateCompilePutByIdReplace):
+ * jit/JITStubs.cpp:
+ (JSC::JITStubs::tryCachePutByID):
+ (JSC::JITStubs::tryCacheGetByID):
+ (JSC::JITStubs::cti_op_convert_this):
+ (JSC::JITStubs::cti_op_end):
+ (JSC::JITStubs::cti_op_add):
+ (JSC::JITStubs::cti_op_pre_inc):
+ (JSC::JITStubs::cti_timeout_check):
+ (JSC::JITStubs::cti_register_file_check):
+ (JSC::JITStubs::cti_op_loop_if_less):
+ (JSC::JITStubs::cti_op_loop_if_lesseq):
+ (JSC::JITStubs::cti_op_new_object):
+ (JSC::JITStubs::cti_op_put_by_id_generic):
+ (JSC::JITStubs::cti_op_get_by_id_generic):
+ (JSC::JITStubs::cti_op_put_by_id):
+ (JSC::JITStubs::cti_op_put_by_id_second):
+ (JSC::JITStubs::cti_op_put_by_id_fail):
+ (JSC::JITStubs::cti_op_get_by_id):
+ (JSC::JITStubs::cti_op_get_by_id_second):
+ (JSC::JITStubs::cti_op_get_by_id_self_fail):
+ (JSC::JITStubs::cti_op_get_by_id_proto_list):
+ (JSC::JITStubs::cti_op_get_by_id_proto_list_full):
+ (JSC::JITStubs::cti_op_get_by_id_proto_fail):
+ (JSC::JITStubs::cti_op_get_by_id_array_fail):
+ (JSC::JITStubs::cti_op_get_by_id_string_fail):
+ (JSC::JITStubs::cti_op_instanceof):
+ (JSC::JITStubs::cti_op_del_by_id):
+ (JSC::JITStubs::cti_op_mul):
+ (JSC::JITStubs::cti_op_new_func):
+ (JSC::JITStubs::cti_op_call_JSFunction):
+ (JSC::JITStubs::cti_op_call_arityCheck):
+ (JSC::JITStubs::cti_vm_dontLazyLinkCall):
+ (JSC::JITStubs::cti_vm_lazyLinkCall):
+ (JSC::JITStubs::cti_op_push_activation):
+ (JSC::JITStubs::cti_op_call_NotJSFunction):
+ (JSC::JITStubs::cti_op_create_arguments):
+ (JSC::JITStubs::cti_op_create_arguments_no_params):
+ (JSC::JITStubs::cti_op_tear_off_activation):
+ (JSC::JITStubs::cti_op_tear_off_arguments):
+ (JSC::JITStubs::cti_op_profile_will_call):
+ (JSC::JITStubs::cti_op_profile_did_call):
+ (JSC::JITStubs::cti_op_ret_scopeChain):
+ (JSC::JITStubs::cti_op_new_array):
+ (JSC::JITStubs::cti_op_resolve):
+ (JSC::JITStubs::cti_op_construct_JSConstruct):
+ (JSC::JITStubs::cti_op_construct_NotJSConstruct):
+ (JSC::JITStubs::cti_op_get_by_val):
+ (JSC::JITStubs::cti_op_get_by_val_byte_array):
+ (JSC::JITStubs::cti_op_resolve_func):
+ (JSC::JITStubs::cti_op_sub):
+ (JSC::JITStubs::cti_op_put_by_val):
+ (JSC::JITStubs::cti_op_put_by_val_array):
+ (JSC::JITStubs::cti_op_put_by_val_byte_array):
+ (JSC::JITStubs::cti_op_lesseq):
+ (JSC::JITStubs::cti_op_loop_if_true):
+ (JSC::JITStubs::cti_op_negate):
+ (JSC::JITStubs::cti_op_resolve_base):
+ (JSC::JITStubs::cti_op_resolve_skip):
+ (JSC::JITStubs::cti_op_resolve_global):
+ (JSC::JITStubs::cti_op_div):
+ (JSC::JITStubs::cti_op_pre_dec):
+ (JSC::JITStubs::cti_op_jless):
+ (JSC::JITStubs::cti_op_not):
+ (JSC::JITStubs::cti_op_jtrue):
+ (JSC::JITStubs::cti_op_post_inc):
+ (JSC::JITStubs::cti_op_eq):
+ (JSC::JITStubs::cti_op_lshift):
+ (JSC::JITStubs::cti_op_bitand):
+ (JSC::JITStubs::cti_op_rshift):
+ (JSC::JITStubs::cti_op_bitnot):
+ (JSC::JITStubs::cti_op_resolve_with_base):
+ (JSC::JITStubs::cti_op_new_func_exp):
+ (JSC::JITStubs::cti_op_mod):
+ (JSC::JITStubs::cti_op_less):
+ (JSC::JITStubs::cti_op_neq):
+ (JSC::JITStubs::cti_op_post_dec):
+ (JSC::JITStubs::cti_op_urshift):
+ (JSC::JITStubs::cti_op_bitxor):
+ (JSC::JITStubs::cti_op_new_regexp):
+ (JSC::JITStubs::cti_op_bitor):
+ (JSC::JITStubs::cti_op_call_eval):
+ (JSC::JITStubs::cti_op_throw):
+ (JSC::JITStubs::cti_op_get_pnames):
+ (JSC::JITStubs::cti_op_next_pname):
+ (JSC::JITStubs::cti_op_push_scope):
+ (JSC::JITStubs::cti_op_pop_scope):
+ (JSC::JITStubs::cti_op_typeof):
+ (JSC::JITStubs::cti_op_is_undefined):
+ (JSC::JITStubs::cti_op_is_boolean):
+ (JSC::JITStubs::cti_op_is_number):
+ (JSC::JITStubs::cti_op_is_string):
+ (JSC::JITStubs::cti_op_is_object):
+ (JSC::JITStubs::cti_op_is_function):
+ (JSC::JITStubs::cti_op_stricteq):
+ (JSC::JITStubs::cti_op_nstricteq):
+ (JSC::JITStubs::cti_op_to_jsnumber):
+ (JSC::JITStubs::cti_op_in):
+ (JSC::JITStubs::cti_op_push_new_scope):
+ (JSC::JITStubs::cti_op_jmp_scopes):
+ (JSC::JITStubs::cti_op_put_by_index):
+ (JSC::JITStubs::cti_op_switch_imm):
+ (JSC::JITStubs::cti_op_switch_char):
+ (JSC::JITStubs::cti_op_switch_string):
+ (JSC::JITStubs::cti_op_del_by_val):
+ (JSC::JITStubs::cti_op_put_getter):
+ (JSC::JITStubs::cti_op_put_setter):
+ (JSC::JITStubs::cti_op_new_error):
+ (JSC::JITStubs::cti_op_debug):
+ (JSC::JITStubs::cti_vm_throw):
+ * jit/JITStubs.h:
+ (JSC::):
+ * runtime/JSFunction.h:
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData):
+ * runtime/JSGlobalData.h:
+ * runtime/JSGlobalObject.cpp:
+ * runtime/JSGlobalObject.h:
+ * runtime/TimeoutChecker.cpp: Copied from interpreter/Interpreter.cpp.
+ (JSC::TimeoutChecker::TimeoutChecker):
+ (JSC::TimeoutChecker::reset):
+ (JSC::TimeoutChecker::didTimeOut):
+ * runtime/TimeoutChecker.h: Copied from interpreter/Interpreter.h.
+ (JSC::TimeoutChecker::setTimeoutInterval):
+ (JSC::TimeoutChecker::ticksUntilNextCheck):
+ (JSC::TimeoutChecker::start):
+ (JSC::TimeoutChecker::stop):
+
+2009-02-20 Gustavo Noronha Silva <gns@gnome.org>
+
+ Unreviewed build fix after r41100.
+
+ * GNUmakefile.am:
+
+2009-02-20 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Mark Rowe.
+
+ <rdar://problem/6606660> 2==null returns true in 64bit jit
+
+ Code for op_eq_null and op_neq_null was incorrectly performing
+ a 32bit compare, which truncated the type tag from an integer
+ immediate, leading to incorrect behaviour.
+
+ * assembler/MacroAssembler.h:
+ (JSC::MacroAssembler::setPtr):
+ * assembler/MacroAssemblerX86_64.h:
+ (JSC::MacroAssemblerX86_64::setPtr):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+
+2009-02-19 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ First step in splitting JIT functionality out of the Interpreter class:
+ Created JITStubs.h/.cpp, and moved Interpreter::cti_* into JITStubs.cpp.
+
+ Functions that the Interpreter and JITStubs share moved to Operations.h/.cpp.
+
+ * GNUmakefile.am:
+ * JavaScriptCore.pri:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::resolveBase):
+ (JSC::Interpreter::checkTimeout):
+ (JSC::Interpreter::privateExecute):
+ * interpreter/Interpreter.h:
+ * jit/JITStubs.cpp: Copied from interpreter/Interpreter.cpp.
+ (JSC::Interpreter::cti_op_resolve_base):
+ * jit/JITStubs.h: Copied from interpreter/Interpreter.h.
+ * runtime/Operations.cpp:
+ (JSC::jsAddSlowCase):
+ (JSC::jsTypeStringForValue):
+ (JSC::jsIsObjectType):
+ (JSC::jsIsFunctionType):
+ * runtime/Operations.h:
+ (JSC::jsLess):
+ (JSC::jsLessEq):
+ (JSC::jsAdd):
+ (JSC::cachePrototypeChain):
+ (JSC::countPrototypeChainEntriesAndCheckForProxies):
+ (JSC::resolveBase):
+
+2009-02-19 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Fix for x86-64. Where the JavaScriptCore text segment lies outside
+ a 2gb range of the heap containing JIT generated code, callbacks
+ from JIT code to the stub functions in Interpreter will be incorrectly
+ linked.
+
+ No performance impact on Sunspider, 1% regression on v8-tests,
+ due to a 3% regression on richards.
+
+ * assembler/AbstractMacroAssembler.h:
+ (JSC::AbstractMacroAssembler::Call::Call):
+ (JSC::AbstractMacroAssembler::Jump::link):
+ (JSC::AbstractMacroAssembler::Jump::linkTo):
+ (JSC::AbstractMacroAssembler::CodeLocationJump::relink):
+ (JSC::AbstractMacroAssembler::CodeLocationCall::relink):
+ (JSC::AbstractMacroAssembler::ProcessorReturnAddress::relinkCallerToFunction):
+ (JSC::AbstractMacroAssembler::PatchBuffer::link):
+ (JSC::AbstractMacroAssembler::PatchBuffer::linkTailRecursive):
+ (JSC::AbstractMacroAssembler::differenceBetween):
+ * assembler/MacroAssembler.h:
+ (JSC::MacroAssembler::tailRecursiveCall):
+ (JSC::MacroAssembler::makeTailRecursiveCall):
+ * assembler/MacroAssemblerX86.h:
+ (JSC::MacroAssemblerX86::call):
+ * assembler/MacroAssemblerX86Common.h:
+ * assembler/MacroAssemblerX86_64.h:
+ (JSC::MacroAssemblerX86_64::call):
+ (JSC::MacroAssemblerX86_64::moveWithPatch):
+ (JSC::MacroAssemblerX86_64::branchPtrWithPatch):
+ (JSC::MacroAssemblerX86_64::storePtrWithPatch):
+ * assembler/X86Assembler.h:
+ (JSC::X86Assembler::jmp_r):
+ (JSC::X86Assembler::linkJump):
+ (JSC::X86Assembler::patchJump):
+ (JSC::X86Assembler::patchCall):
+ (JSC::X86Assembler::linkCall):
+ (JSC::X86Assembler::patchAddress):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::tryCTICachePutByID):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompile):
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ * jit/JIT.h:
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::putDoubleResultToJSNumberCellOrJSImmediate):
+ (JSC::JIT::compileBinaryArithOp):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::privateCompilePutByIdTransition):
+ (JSC::JIT::privateCompileGetByIdSelf):
+ (JSC::JIT::privateCompilePutByIdReplace):
+
+2009-02-18 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Simplified .call and .apply in preparation for optimizing them. Also,
+ a little cleanup.
+
+ * runtime/FunctionPrototype.cpp:
+ (JSC::functionProtoFuncApply):
+ (JSC::functionProtoFuncCall): No need to do any specific conversion on
+ 'this' -- op_convert_this will do it if necessary.
+
+ * runtime/JSImmediate.cpp:
+ (JSC::JSImmediate::toThisObject): Slightly relaxed the rules on
+ toThisObject to allow for 'undefined', which can be passed through
+ .call and .apply.
+
+2009-02-19 David Levin <levin@chromium.org>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Bug 23976: MessageQueue needs a way to wait for a message that satisfies an arbitrary criteria.
+ <https://bugs.webkit.org/show_bug.cgi?id=23976>
+
+ * wtf/Deque.h:
+ (WTF::Deque<T>::findIf):
+ * wtf/MessageQueue.h:
+ (WTF::MessageQueue<T>::waitForMessageFiltered):
+
+2009-02-18 David Levin <levin@chromium.org>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Bug 23974: Deque::Remove would be a useful method.
+ <https://bugs.webkit.org/show_bug.cgi?id=23974>
+
+ Add Deque::remove and DequeIteratorBase<T>::operator=.
+
+ Why was operator= added? Every concrete iterator (DequeIterator..DequeConstReverseIterator)
+ was calling DequeIteratorBase::assign(), which called Base::operator=(). Base::operator=()
+ was not implemented. This went unnoticed because the iterator copy code has been unused.
+
+ * wtf/Deque.h:
+ (WTF::Deque<T>::remove):
+ (WTF::DequeIteratorBase<T>::removeFromIteratorsList):
+ (WTF::DequeIteratorBase<T>::operator=):
+ (WTF::DequeIteratorBase<T>::~DequeIteratorBase):
+
+2009-02-18 Gustavo Noronha Silva <gns@gnome.org>
+
+ Reviewed by Holger Freyther.
+
+ Fix symbols.filter location, and add other missing files to the
+ autotools build, so that make dist works.
+
+ * GNUmakefile.am:
+
+2009-02-17 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Fixed failure in js1_5/Regress/regress-168347.js, as seen on the Oliver
+ bot.
+
+ Technically, both behaviors are OK, but we might as well keep this test
+ passing.
+
+ * runtime/FunctionPrototype.cpp:
+ (JSC::insertSemicolonIfNeeded): No need to add a trailing semicolon
+ after a trailing '}', since '}' ends a block, indicating the end of a
+ statement.
+
+2009-02-17 Geoffrey Garen <ggaren@apple.com>
+
+ Build fix.
+
+ * runtime/FunctionPrototype.cpp:
+
+2009-02-17 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Add assertion to guard against oversized pc relative calls.
+
+ * assembler/X86Assembler.h:
+ (JSC::X86Assembler::link):
+
+2009-02-17 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Fixed <rdar://problem/6595040> REGRESSION: http://www.amnestyusa.org/
+ fails to load.
+
+ amnestyusa.org uses the Optimist JavaScript library, which adds event
+ listeners by concatenating string-ified functions. This is only sure to
+ be syntactically valid if the string-ified functions end in semicolons.
+
+ * parser/Lexer.cpp:
+ (JSC::Lexer::isWhiteSpace):
+ * parser/Lexer.h:
+ (JSC::Lexer::isWhiteSpace):
+ (JSC::Lexer::isLineTerminator): Added some helper functions for examining
+ whitespace.
+
+ * runtime/FunctionPrototype.cpp:
+ (JSC::appendSemicolonIfNeeded):
+ (JSC::functionProtoFuncToString): When string-ifying a function, insert
+ a semicolon in the last non-whitespace position, if one doesn't already exist.
+
+2009-02-16 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by NOBODY (Build fix).
+
+ Roll out r41022 as it breaks qt and gtk builds
+
+ * jit/JITArithmetic.cpp:
+ (JSC::isSSE2Present):
+
+2009-02-16 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ Fix for <rdar://problem/6468156>
+ REGRESSION (r36779): Adding link, images, flash in TinyMCE blocks entire page (21382)
+
+ No performance regression.
+
+ * runtime/Arguments.cpp:
+ (JSC::Arguments::fillArgList): Add codepath for when the "length" property has been
+ overridden.
+
+2009-02-16 Mark Rowe <mrowe@apple.com>
+
+ Build fix.
+
+ * wtf/FastMalloc.cpp:
+ (WTF::TCMallocStats::):
+ (WTF::TCMallocStats::FastMallocZone::FastMallocZone):
+
+2009-02-16 Csaba Osztrogonac <oszi@inf.u-szeged.hu>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 23787: Allow JIT to generate SSE2 code if using GCC
+ <https://bugs.webkit.org/show_bug.cgi?id=23787>
+
+ GCC version of the cpuid check.
+
+ * jit/JITArithmetic.cpp:
+ (JSC::isSSE2Present): GCC assembly code added.
+ 6.6% progression on x86 Linux with JIT and WREC on SunSpider if using SSE2 capable machine.
+
+2009-02-13 Adam Treat <adam.treat@torchmobile.com>
+
+ Reviewed by George Staikos.
+
+ https://bugs.webkit.org/show_bug.cgi?id=23960
+ Crash Fix.
+
+ Don't depend on 'initializeThreading()' to come before a call to 'isMainThread()'
+ as QtWebKit only calls 'initializeThreading()' during QWebPage construction.
+
+ A client app may well make a call to QWebSettings::iconForUrl() for instance
+ before creating a QWebPage and that call to QWebSettings triggers an
+ ASSERT(isMainThread()) deep within WebCore.
+
+ * wtf/ThreadingQt.cpp:
+ (WTF::isMainThread):
+
+2009-02-13 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Some data in the instruction stream is potentially uninitialized - fix this.
+
+ Change the OperandTypes constructor so that uninitialized memory in the int
+ is zeroed, and modify the Instruction constructor taking an Opcode so that
+ if !HAVE(COMPUTED_GOTO) (i.e. when Opcode is an enum, and is potentially only
+ a byte) it zeros the Instruction first before writing the opcode.
+
+ * bytecode/Instruction.h:
+ (JSC::Instruction::Instruction):
+ * parser/ResultType.h:
+ (JSC::OperandTypes::OperandTypes):
+
+2009-02-13 Geoffrey Garen <ggaren@apple.com>
+
+ Build fix for non_JIT platforms.
+
+ * bytecode/CodeBlock.h:
+ (JSC::CodeBlock::setIsNumericCompareFunction):
+ (JSC::CodeBlock::isNumericCompareFunction):
+
+2009-02-13 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Fixed <rdar://problem/6584057> Optimize sort by JS numeric comparison
+ function not to run the comparison function
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::CodeBlock):
+ * bytecode/CodeBlock.h:
+ (JSC::CodeBlock::setIsNumericCompareFunction):
+ (JSC::CodeBlock::isNumericCompareFunction): Added the ability to track
+ whether a CodeBlock performs a sort-like numeric comparison.
+
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::generate): Set the isNumericCompareFunction bit
+ after compiling.
+
+ * parser/Nodes.cpp:
+ (JSC::FunctionBodyNode::emitBytecode): Fixed a bug that caused us to
+ codegen an extra return at the end of all functions (eek!), since this
+ made it harder / weirder to detect the numeric comparison pattern in
+ bytecode.
+
+ * runtime/ArrayPrototype.cpp:
+ (JSC::arrayProtoFuncSort): Use the isNumericCompareFunction bit to do
+ a faster sort if we can.
+
+ * runtime/FunctionConstructor.cpp:
+ (JSC::extractFunctionBody):
+ (JSC::constructFunction):
+ * runtime/FunctionConstructor.h: Renamed and exported extractFunctionBody for
+ use in initializing lazyNumericCompareFunction.
+
+ * runtime/JSArray.cpp:
+ (JSC::compareNumbersForQSort):
+ (JSC::compareByStringPairForQSort):
+ (JSC::JSArray::sortNumeric):
+ (JSC::JSArray::sort):
+ * runtime/JSArray.h: Added a fast numeric sort. Renamed ArrayQSortPair
+ to be more specific since we do different kinds of qsort now.
+
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData):
+ (JSC::JSGlobalData::numericCompareFunction):
+ (JSC::JSGlobalData::ClientData::~ClientData):
+ * runtime/JSGlobalData.h: Added helper data for computing the
+ isNumericCompareFunction bit.
+
+2009-02-13 Darin Adler <darin@apple.com>
+
+ * Configurations/JavaScriptCore.xcconfig: Undo accidental commit of this file.
+
+2009-02-12 Darin Adler <darin@apple.com>
+
+ Reviewed by Oliver Hunt and Alexey Proskuryakov.
+
+ Speed up a couple string functions.
+
+ * runtime/StringPrototype.cpp:
+ (JSC::stringProtoFuncIndexOf): Added a fast path for cases where the second
+ argument is either missing or an integer.
+ (JSC::stringProtoFuncBig): Use jsNontrivialString since the string is guaranteed
+ to be 2 or more characters long.
+ (JSC::stringProtoFuncSmall): Ditto.
+ (JSC::stringProtoFuncBlink): Ditto.
+ (JSC::stringProtoFuncBold): Ditto.
+ (JSC::stringProtoFuncItalics): Ditto.
+ (JSC::stringProtoFuncStrike): Ditto.
+ (JSC::stringProtoFuncSub): Ditto.
+ (JSC::stringProtoFuncSup): Ditto.
+ (JSC::stringProtoFuncFontcolor): Ditto.
+ (JSC::stringProtoFuncFontsize): Make the fast path Sam recently added even faster
+ by avoiding all but the minimum memory allocation.
+ (JSC::stringProtoFuncAnchor): Use jsNontrivialString.
+ (JSC::stringProtoFuncLink): Added a fast path.
+
+ * runtime/UString.cpp:
+ (JSC::UString::find): Added a fast path for single-character search strings.
+
+2009-02-13 David Levin <levin@chromium.org>
+
+ Reviewed by Darin Adler.
+
+ Bug 23926: Race condition in callOnMainThreadAndWait
+ <https://bugs.webkit.org/show_bug.cgi?id=23926>
+
+ * wtf/MainThread.cpp:
+ Removed callOnMainThreadAndWait since it isn't used.
+
+2009-02-13 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Jon Honeycutt.
+
+ Math.random is really slow on windows.
+
+ Math.random calls WTF::randomNumber which is implemented as
+ the secure rand_s on windows. Unfortunately rand_s is an order
+ of magnitude slower than arc4random. For this reason I've
+ added "weakRandomNumber" for use by JavaScript's Math Object.
+ In the long term we should look at using our own secure PRNG
+ in place of the system, but this will do for now.
+
+ 30% win on SunSpider on Windows, resolving most of the remaining
+ disparity vs. Mac.
+
+ * runtime/MathObject.cpp:
+ (JSC::MathObject::MathObject):
+ (JSC::mathProtoFuncRandom):
+ * wtf/RandomNumber.cpp:
+ (WTF::weakRandomNumber):
+ (WTF::randomNumber):
+ * wtf/RandomNumber.h:
+ * wtf/RandomNumberSeed.h:
+ (WTF::initializeWeakRandomNumberGenerator):
+
+2009-02-12 Mark Rowe <mrowe@apple.com>
+
+ Fix the build for other platforms.
+
+ * wtf/RandomNumber.cpp:
+ (WTF::randomNumber):
+
+2009-02-12 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Remove (/reduce) use of hard-wired register names from the JIT.
+ Currently there is no abstraction of registers used in the JIT,
+ which has a number of negative consequences. Hard-wiring x86
+ register names makes the JIT less portable to other platforms,
+ and prevents us from performing dynamic register allocation to
+ attempt to maintain more temporary values in machine registers.
+ (The latter will be more important on x86-64, where we have more
+ registers to make use of).
+
+ Also, remove MacroAssembler::mod32. This was not providing a
+ useful abstraction, and was not in keeping with the rest of the
+ MacroAssembler interface, in having specific register requirements.
+
+ * assembler/MacroAssemblerX86Common.h:
+ * jit/JIT.cpp:
+ (JSC::JIT::compileOpStrictEq):
+ (JSC::JIT::emitSlowScriptCheck):
+ (JSC::JIT::privateCompileMainPass):
+ (JSC::JIT::privateCompileSlowCases):
+ (JSC::JIT::privateCompile):
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ * jit/JIT.h:
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::compileFastArith_op_lshift):
+ (JSC::JIT::compileFastArithSlow_op_lshift):
+ (JSC::JIT::compileFastArith_op_rshift):
+ (JSC::JIT::compileFastArithSlow_op_rshift):
+ (JSC::JIT::compileFastArith_op_bitand):
+ (JSC::JIT::compileFastArithSlow_op_bitand):
+ (JSC::JIT::compileFastArith_op_mod):
+ (JSC::JIT::compileFastArithSlow_op_mod):
+ (JSC::JIT::compileFastArith_op_post_inc):
+ (JSC::JIT::compileFastArithSlow_op_post_inc):
+ (JSC::JIT::compileFastArith_op_post_dec):
+ (JSC::JIT::compileFastArithSlow_op_post_dec):
+ (JSC::JIT::compileFastArith_op_pre_inc):
+ (JSC::JIT::compileFastArithSlow_op_pre_inc):
+ (JSC::JIT::compileFastArith_op_pre_dec):
+ (JSC::JIT::compileFastArithSlow_op_pre_dec):
+ (JSC::JIT::compileFastArith_op_add):
+ (JSC::JIT::compileFastArith_op_mul):
+ (JSC::JIT::compileFastArith_op_sub):
+ (JSC::JIT::compileBinaryArithOp):
+ * jit/JITCall.cpp:
+ (JSC::JIT::compileOpCallInitializeCallFrame):
+ (JSC::JIT::compileOpCallSetupArgs):
+ (JSC::JIT::compileOpCallEvalSetupArgs):
+ (JSC::JIT::compileOpConstructSetupArgs):
+ (JSC::JIT::compileOpCall):
+ (JSC::JIT::compileOpCallSlowCase):
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::emitGetVirtualRegister):
+ (JSC::JIT::emitPutVirtualRegister):
+ (JSC::JIT::emitNakedCall):
+ (JSC::JIT::restoreArgumentReference):
+ (JSC::JIT::restoreArgumentReferenceForTrampoline):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::compileGetByIdHotPath):
+ (JSC::JIT::compilePutByIdHotPath):
+ (JSC::JIT::compileGetByIdSlowCase):
+ (JSC::JIT::compilePutByIdSlowCase):
+ (JSC::JIT::privateCompilePutByIdTransition):
+ (JSC::JIT::privateCompilePatchGetArrayLength):
+ (JSC::JIT::privateCompileGetByIdSelf):
+ (JSC::JIT::privateCompileGetByIdProto):
+ (JSC::JIT::privateCompileGetByIdSelfList):
+ (JSC::JIT::privateCompileGetByIdProtoList):
+ (JSC::JIT::privateCompileGetByIdChainList):
+ (JSC::JIT::privateCompileGetByIdChain):
+ (JSC::JIT::privateCompilePutByIdReplace):
+
+2009-02-12 Horia Olaru <olaru@adobe.com>
+
+ Reviewed by Oliver Hunt.
+
+ https://bugs.webkit.org/show_bug.cgi?id=23400
+
+ When throwing an exception within an eval argument string, the dst parameter was
+ modified in the functions below and the return value for eval was altered. Changed
+ the emitNode call in JSC::ThrowNode::emitBytecode to use a temporary register
+ to store its results instead of dst. The JSC::FunctionCallResolveNode::emitBytecode
+ would load the function within the dst registry, also altering the result returned
+ by eval. Replaced it with another temporary.
+
+ * parser/Nodes.cpp:
+ (JSC::FunctionCallResolveNode::emitBytecode):
+ (JSC::ThrowNode::emitBytecode):
+
+2009-02-12 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ Speed up String.prototype.fontsize.
+
+ * runtime/StringPrototype.cpp:
+ (JSC::stringProtoFuncFontsize): Specialize for defined/commonly used values.
+
+2009-02-12 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Correctness fix.
+
+ * wtf/RandomNumber.cpp:
+ (WTF::randomNumber): Divide by the maximum representable value, which
+ is different on each platform now, to get values between 0 and 1.
+
+2009-02-12 Geoffrey Garen <ggaren@apple.com>
+
+ Build fix.
+
+ * wtf/RandomNumber.cpp:
+ (WTF::randomNumber):
+
+2009-02-12 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Fixed <rdar://problem/6582048>.
+
+ * wtf/RandomNumber.cpp:
+ (WTF::randomNumber): Make only one call to the random number generator
+ on platforms where the generator is cryptographically secure. The value
+ of randomness over and above cryptographically secure randomness is not
+ clear, and it caused some performance problems.
+
+2009-02-12 Adam Roben <aroben@apple.com>
+
+ Fix lots of Perl warnings when building JavaScriptCoreGenerated on
+ Windows
+
+ Reviewed by John Sullivan.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/build-generated-files.sh:
+ Create the docs/ directory so that we can write bytecode.html into it.
+ This matches what JavaScriptCore.xcodeproj does.
+
+2009-02-12 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Rubber-stamped by Lars.
+
+ Re-enable the JIT in the Qt build with -fno-stack-protector on Linux.
+
+ * JavaScriptCore.pri:
+
+2009-02-11 Dmitry Titov <dimich@chromium.org>
+
+ Reviewed by Alexey Proskuryakov.
+
+ https://bugs.webkit.org/show_bug.cgi?id=23705
+ Fix the UI freeze caused by Worker generating a flood of messages.
+ Measure time we spend in executing posted work items. If too much time is spent
+ without returning to the run loop, exit and reschedule.
+
+ * wtf/MainThread.h:
+ Added initializeMainThreadPlatform() to initialize low-level mechanism for posting
+ work items from thread to thread. This removes #ifdefs for WIN and CHROMIUM from platform-independent code.
+
+ * wtf/MainThread.cpp:
+ (WTF::initializeMainThread):
+ (WTF::dispatchFunctionsFromMainThread):
+ Instead of dispatching all work items in the queue, dispatch them one by one
+ and measure elapsed time. After a threshold, reschedule and quit.
+
+ (WTF::callOnMainThread):
+ (WTF::callOnMainThreadAndWait):
+ Only schedule dispatch if the queue was empty - to avoid many posted messages in the run loop queue.
+
+ * wtf/mac/MainThreadMac.mm:
+ (WTF::scheduleDispatchFunctionsOnMainThread):
+ Use static instance of the mainThreadCaller instead of allocating and releasing it each time.
+ (WTF::initializeMainThreadPlatform):
+ * wtf/gtk/MainThreadChromium.cpp:
+ (WTF::initializeMainThreadPlatform):
+ * wtf/gtk/MainThreadGtk.cpp:
+ (WTF::initializeMainThreadPlatform):
+ * wtf/qt/MainThreadQt.cpp:
+ (WTF::initializeMainThreadPlatform):
+ * wtf/win/MainThreadWin.cpp:
+ (WTF::initializeMainThreadPlatform):
+ * wtf/wx/MainThreadWx.cpp:
+ (WTF::initializeMainThreadPlatform):
+
+2009-02-11 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Gavin Barraclough.
+
+ Style cleanup.
+
+ * assembler/AbstractMacroAssembler.h:
+ (JSC::AbstractMacroAssembler::CodeLocationCommon::CodeLocationCommon):
+ (JSC::AbstractMacroAssembler::CodeLocationCommon::operator bool):
+ (JSC::AbstractMacroAssembler::CodeLocationCommon::reset):
+ (JSC::AbstractMacroAssembler::CodeLocationLabel::addressForSwitch):
+ (JSC::AbstractMacroAssembler::CodeLocationLabel::addressForExceptionHandler):
+ (JSC::AbstractMacroAssembler::CodeLocationLabel::addressForJSR):
+ (JSC::AbstractMacroAssembler::CodeLocationLabel::getJumpDestination):
+ (JSC::AbstractMacroAssembler::CodeLocationJump::relink):
+ (JSC::AbstractMacroAssembler::CodeLocationJump::CodeLocationJump):
+ (JSC::AbstractMacroAssembler::CodeLocationCall::relink):
+ (JSC::AbstractMacroAssembler::CodeLocationCall::calleeReturnAddressValue):
+ (JSC::AbstractMacroAssembler::CodeLocationCall::CodeLocationCall):
+ (JSC::AbstractMacroAssembler::CodeLocationDataLabel32::repatch):
+ (JSC::AbstractMacroAssembler::CodeLocationDataLabel32::CodeLocationDataLabel32):
+ (JSC::AbstractMacroAssembler::CodeLocationDataLabelPtr::repatch):
+ (JSC::AbstractMacroAssembler::CodeLocationDataLabelPtr::CodeLocationDataLabelPtr):
+ (JSC::AbstractMacroAssembler::ProcessorReturnAddress::ProcessorReturnAddress):
+ (JSC::AbstractMacroAssembler::ProcessorReturnAddress::relinkCallerToFunction):
+ (JSC::AbstractMacroAssembler::ProcessorReturnAddress::operator void*):
+ (JSC::AbstractMacroAssembler::PatchBuffer::link):
+ (JSC::::CodeLocationCommon::labelAtOffset):
+ (JSC::::CodeLocationCommon::jumpAtOffset):
+ (JSC::::CodeLocationCommon::callAtOffset):
+ (JSC::::CodeLocationCommon::dataLabelPtrAtOffset):
+ (JSC::::CodeLocationCommon::dataLabel32AtOffset):
+
+2009-02-11 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Gavin Barraclough.
+
+ * assembler/AbstractMacroAssembler.h: Fix comments.
+
+2009-02-11 Alexey Proskuryakov <ap@webkit.org>
+
+ Trying to fix wx build.
+
+ * bytecode/JumpTable.h: Include "MacroAssembler.h", not <MacroAssembler.h>.
+ * jscore.bkl: Added assembler directory to search paths.
+
+2009-02-10 Gavin Barraclough <barraclough@apple.com>
+
+ Build
+ fix.
+ (Narrow
+ changelog
+ for
+ dhyatt).
+
+ * bytecode/Instruction.h:
+ (JSC::PolymorphicAccessStructureList::PolymorphicStubInfo::set):
+ (JSC::PolymorphicAccessStructureList::PolymorphicAccessStructureList):
+
+2009-02-10 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Reduce use of void* / reinterpret_cast in JIT repatching code,
+ add strong types for Calls and for the various types of pointers
+ we retain into the JIT generated instruction stream.
+
+ No performance impact.
+
+ * assembler/AbstractMacroAssembler.h:
+ (JSC::AbstractMacroAssembler::ImmPtr::ImmPtr):
+ (JSC::AbstractMacroAssembler::ImmPtr::asIntptr):
+ (JSC::AbstractMacroAssembler::Imm32::Imm32):
+ (JSC::AbstractMacroAssembler::Label::Label):
+ (JSC::AbstractMacroAssembler::DataLabelPtr::DataLabelPtr):
+ (JSC::AbstractMacroAssembler::Call::Call):
+ (JSC::AbstractMacroAssembler::Call::link):
+ (JSC::AbstractMacroAssembler::Call::linkTo):
+ (JSC::AbstractMacroAssembler::Jump::Jump):
+ (JSC::AbstractMacroAssembler::Jump::linkTo):
+ (JSC::AbstractMacroAssembler::CodeLocationCommon::CodeLocationCommon):
+ (JSC::AbstractMacroAssembler::CodeLocationCommon::operator bool):
+ (JSC::AbstractMacroAssembler::CodeLocationCommon::reset):
+ (JSC::AbstractMacroAssembler::CodeLocationLabel::CodeLocationLabel):
+ (JSC::AbstractMacroAssembler::CodeLocationLabel::addressForSwitch):
+ (JSC::AbstractMacroAssembler::CodeLocationLabel::addressForExceptionHandler):
+ (JSC::AbstractMacroAssembler::CodeLocationLabel::addressForJSR):
+ (JSC::AbstractMacroAssembler::CodeLocationLabel::getJumpDestination):
+ (JSC::AbstractMacroAssembler::CodeLocationJump::CodeLocationJump):
+ (JSC::AbstractMacroAssembler::CodeLocationJump::relink):
+ (JSC::AbstractMacroAssembler::CodeLocationCall::CodeLocationCall):
+ (JSC::AbstractMacroAssembler::CodeLocationCall::relink):
+ (JSC::AbstractMacroAssembler::CodeLocationCall::calleeReturnAddressValue):
+ (JSC::AbstractMacroAssembler::CodeLocationDataLabel32::CodeLocationDataLabel32):
+ (JSC::AbstractMacroAssembler::CodeLocationDataLabel32::repatch):
+ (JSC::AbstractMacroAssembler::CodeLocationDataLabelPtr::CodeLocationDataLabelPtr):
+ (JSC::AbstractMacroAssembler::CodeLocationDataLabelPtr::repatch):
+ (JSC::AbstractMacroAssembler::ProcessorReturnAddress::ProcessorReturnAddress):
+ (JSC::AbstractMacroAssembler::ProcessorReturnAddress::relinkCallerToFunction):
+ (JSC::AbstractMacroAssembler::ProcessorReturnAddress::operator void*):
+ (JSC::AbstractMacroAssembler::PatchBuffer::entry):
+ (JSC::AbstractMacroAssembler::PatchBuffer::trampolineAt):
+ (JSC::AbstractMacroAssembler::PatchBuffer::link):
+ (JSC::AbstractMacroAssembler::PatchBuffer::linkTailRecursive):
+ (JSC::AbstractMacroAssembler::PatchBuffer::patch):
+ (JSC::AbstractMacroAssembler::PatchBuffer::locationOf):
+ (JSC::AbstractMacroAssembler::PatchBuffer::returnAddressOffset):
+ (JSC::AbstractMacroAssembler::differenceBetween):
+ (JSC::::CodeLocationCommon::labelAtOffset):
+ (JSC::::CodeLocationCommon::jumpAtOffset):
+ (JSC::::CodeLocationCommon::callAtOffset):
+ (JSC::::CodeLocationCommon::dataLabelPtrAtOffset):
+ (JSC::::CodeLocationCommon::dataLabel32AtOffset):
+ * assembler/MacroAssemblerX86Common.h:
+ (JSC::MacroAssemblerX86Common::call):
+ * assembler/X86Assembler.h:
+ (JSC::X86Assembler::getCallReturnOffset):
+ * bytecode/CodeBlock.h:
+ (JSC::CallLinkInfo::CallLinkInfo):
+ (JSC::getStructureStubInfoReturnLocation):
+ (JSC::getCallLinkInfoReturnLocation):
+ * bytecode/Instruction.h:
+ (JSC::PolymorphicAccessStructureList::PolymorphicStubInfo::set):
+ (JSC::PolymorphicAccessStructureList::PolymorphicAccessStructureList):
+ * bytecode/JumpTable.h:
+ (JSC::StringJumpTable::ctiForValue):
+ (JSC::SimpleJumpTable::ctiForValue):
+ * bytecode/StructureStubInfo.h:
+ (JSC::StructureStubInfo::StructureStubInfo):
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::emitCatch):
+ (JSC::prepareJumpTableForStringSwitch):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::cti_op_get_by_id_self_fail):
+ (JSC::getPolymorphicAccessStructureListSlot):
+ (JSC::Interpreter::cti_op_throw):
+ (JSC::Interpreter::cti_op_switch_imm):
+ (JSC::Interpreter::cti_op_switch_char):
+ (JSC::Interpreter::cti_op_switch_string):
+ (JSC::Interpreter::cti_vm_throw):
+ * jit/JIT.cpp:
+ (JSC::ctiSetReturnAddress):
+ (JSC::ctiPatchCallByReturnAddress):
+ (JSC::JIT::privateCompile):
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ * jit/JIT.h:
+ (JSC::CallRecord::CallRecord):
+ (JSC::JIT::compileGetByIdSelf):
+ (JSC::JIT::compileGetByIdProto):
+ (JSC::JIT::compileGetByIdChain):
+ (JSC::JIT::compilePutByIdReplace):
+ (JSC::JIT::compilePutByIdTransition):
+ (JSC::JIT::compilePatchGetArrayLength):
+ (JSC::JIT::emitCTICall):
+ * jit/JITCall.cpp:
+ (JSC::JIT::unlinkCall):
+ (JSC::JIT::linkCall):
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::emitNakedCall):
+ (JSC::JIT::emitCTICall_internal):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::compileGetByIdSlowCase):
+ (JSC::JIT::compilePutByIdSlowCase):
+ (JSC::JIT::privateCompilePutByIdTransition):
+ (JSC::JIT::patchGetByIdSelf):
+ (JSC::JIT::patchPutByIdReplace):
+ (JSC::JIT::privateCompilePatchGetArrayLength):
+ (JSC::JIT::privateCompileGetByIdSelf):
+ (JSC::JIT::privateCompileGetByIdProto):
+ (JSC::JIT::privateCompileGetByIdSelfList):
+ (JSC::JIT::privateCompileGetByIdProtoList):
+ (JSC::JIT::privateCompileGetByIdChainList):
+ (JSC::JIT::privateCompileGetByIdChain):
+ (JSC::JIT::privateCompilePutByIdReplace):
+
+2009-02-10 Adam Roben <aroben@apple.com>
+
+ Windows build fix after r40813
+
+ * JavaScriptCore.vcproj/jsc/jsc.vcproj: Added profiler/ to the include
+ path so that Profiler.h can be found.
+
+2009-02-09 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Provide a class type for a generated block of JIT code.
+ Also changes the return address -> bytecode index map to
+ track the return addess as an unsigned offset into the code
+ instead of a ptrdiff_t in terms of void**s - the latter is
+ equal to the actual offset / sizeof(void*), making it a
+ potentially lossy representation.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * assembler/AbstractMacroAssembler.h:
+ (JSC::AbstractMacroAssembler::PatchBuffer::returnAddressOffset):
+ * assembler/X86Assembler.h:
+ (JSC::X86Assembler::getCallReturnOffset):
+ * bytecode/CodeBlock.h:
+ (JSC::CallReturnOffsetToBytecodeIndex::CallReturnOffsetToBytecodeIndex):
+ (JSC::getCallReturnOffset):
+ (JSC::CodeBlock::getBytecodeIndex):
+ (JSC::CodeBlock::jitCode):
+ (JSC::CodeBlock::callReturnIndexVector):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::execute):
+ (JSC::Interpreter::cti_vm_dontLazyLinkCall):
+ (JSC::Interpreter::cti_vm_lazyLinkCall):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompile):
+ * jit/JIT.h:
+ (JSC::):
+ * jit/JITCall.cpp:
+ (JSC::JIT::linkCall):
+ * jit/JITCode.h: Added.
+ (JSC::):
+ (JSC::JITCode::JITCode):
+ (JSC::JITCode::operator bool):
+ (JSC::JITCode::addressForCall):
+ (JSC::JITCode::offsetOf):
+ (JSC::JITCode::execute):
+
+2009-02-09 John Grabowski <jrg@chromium.org>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=23856
+ Change the definition of "main thread" for Chromium on OSX.
+ It does not match the DARWIN definition.
+
+ * wtf/ThreadingPthreads.cpp:
+ (WTF::initializeThreading):
+ (WTF::isMainThread):
+
+2009-02-09 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Minor bugfix, incorrect check meant that subtraction causing integer overflow
+ would be missed on x86-64 JIT.
+
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::compileBinaryArithOp):
+
+2009-02-09 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ A more sensible register allocation for x86-64.
+
+ When WREC was ported to x86-64 it stuck with the same register allocation as x86.
+ This requires registers to be reordered on entry into WREC generated code, since
+ argument passing is different on x86-64 and x86 (regparm(3)). This patch switches
+ x86-64 to use a native register allocation, that does not require argument registers
+ to be reordered.
+
+ * wrec/WRECGenerator.cpp:
+ (JSC::WREC::Generator::generateEnter):
+ (JSC::WREC::Generator::generateReturnSuccess):
+ (JSC::WREC::Generator::generateReturnFailure):
+ * wrec/WRECGenerator.h:
+
+2009-02-05 Adam Roben <aroben@apple.com>
+
+ Build fix
+
+ Rubberstamped by Sam Weinig.
+
+ * wtf/TypeTraits.h: Include Platform.h, since this header uses macros
+ defined there.
+
+2009-02-05 Dimitri Glazkov <dglazkov@chromium.org>
+
+ Reviewed by Eric Seidel.
+
+ https://bugs.webkit.org/show_bug.cgi?id=23747
+ Add Chromium threading-related files.
+
+ * wtf/MainThread.cpp: Added platform guard to initializeMainThread.
+ * wtf/chromium/ChromiumThreading.h: Added.
+ * wtf/chromium/MainThreadChromium.cpp: Added.
+ (WTF::initializeMainThread):
+ (WTF::scheduleDispatchFunctionsOnMainThread):
+
+2009-02-05 David Levin <levin@chromium.org>
+
+ Reviewed by Darin Adler.
+
+ Bug 23713: COMPILE_ASSERTS should be moved out of TypeTraits.h and into .cpp file
+ <https://bugs.webkit.org/show_bug.cgi?id=23713>
+
+ * GNUmakefile.am:
+ * JavaScriptCore.pri:
+ * JavaScriptCore.scons:
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * JavaScriptCoreSources.bkl:
+
+ * wtf/HashTraits.h:
+ Remove unnecessary header file that I missed when moving out the type traits form this file.
+
+ * wtf/TypeTraits.cpp: Added.
+ (WTF::):
+ * wtf/TypeTraits.h:
+ Moved the compile asserts into TypeTraits.cpp file.
+
+2009-02-04 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver 'the nun' Hunt.
+
+ Add -e switch to jsc to enable evaluation of scripts passed on the command line.
+
+ * jsc.cpp:
+ (Script::Script):
+ (runWithScripts):
+ (printUsageStatement):
+ (parseArguments):
+ (jscmain):
+
+2009-02-04 Gavin Barraclough <barraclough@apple.com>
+
+ Rubber stamped by Sam 'Big Mac' Weinig.
+
+ * assembler/AbstractMacroAssembler.h: Copied from assembler/MacroAssembler.h.
+ * assembler/MacroAssemblerX86.h: Copied from assembler/MacroAssembler.h.
+ * assembler/MacroAssemblerX86Common.h: Copied from assembler/MacroAssembler.h.
+ * assembler/MacroAssemblerX86_64.h: Copied from assembler/MacroAssembler.h.
+
+2009-02-04 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ This patch tidies up the MacroAssembler, cleaning up the code and refactoring out the
+ platform-specific parts. The MacroAssembler gets split up like a beef burger, with the
+ platform-agnostic data types being the lower bun (in the form of the class AbstractMacroAssembler),
+ the plaform-specific code generation forming a big meaty patty of methods like 'add32',
+ 'branch32', etc (MacroAssemblerX86), and finally topped off with the bun-lid of the
+ MacroAssembler class itself, providing covenience methods such as the stack peek & poke,
+ and backwards branch methods, all of which can be described in a platform independent
+ way using methods from the base class. The AbstractMacroAssembler is templated on the
+ type of the assembler class that will be used for code generation, and the three layers
+ are held together with the cocktail stick of inheritance.
+
+ The above description is a slight simplification since the MacroAssemblerX86 is actually
+ formed from two layers (in effect giving us a kind on bacon double cheeseburger) - with the
+ bulk of methods that are common between x86 & x86-64 implemented in MacroAssemblerX86Common,
+ which forms a base class for MacroAssemblerX86 and MacroAssemblerX86_64 (which add the methods
+ specific to the given platform).
+
+ I'm landing these changes first without splitting the classes across multiple files,
+ I will follow up with a second patch to split up the file MacroAssembler.h.
+
+ * assembler/MacroAssembler.h:
+ (JSC::AbstractMacroAssembler::):
+ (JSC::AbstractMacroAssembler::DataLabelPtr::DataLabelPtr):
+ (JSC::AbstractMacroAssembler::DataLabelPtr::patch):
+ (JSC::AbstractMacroAssembler::DataLabel32::DataLabel32):
+ (JSC::AbstractMacroAssembler::DataLabel32::patch):
+ (JSC::AbstractMacroAssembler::Label::Label):
+ (JSC::AbstractMacroAssembler::Jump::Jump):
+ (JSC::AbstractMacroAssembler::Jump::link):
+ (JSC::AbstractMacroAssembler::Jump::linkTo):
+ (JSC::AbstractMacroAssembler::Jump::patch):
+ (JSC::AbstractMacroAssembler::JumpList::link):
+ (JSC::AbstractMacroAssembler::JumpList::linkTo):
+ (JSC::AbstractMacroAssembler::PatchBuffer::link):
+ (JSC::AbstractMacroAssembler::PatchBuffer::addressOf):
+ (JSC::AbstractMacroAssembler::PatchBuffer::setPtr):
+ (JSC::AbstractMacroAssembler::size):
+ (JSC::AbstractMacroAssembler::copyCode):
+ (JSC::AbstractMacroAssembler::label):
+ (JSC::AbstractMacroAssembler::align):
+ (JSC::AbstractMacroAssembler::differenceBetween):
+ (JSC::MacroAssemblerX86Common::xor32):
+ (JSC::MacroAssemblerX86Common::load32WithAddressOffsetPatch):
+ (JSC::MacroAssemblerX86Common::store32WithAddressOffsetPatch):
+ (JSC::MacroAssemblerX86Common::move):
+ (JSC::MacroAssemblerX86Common::swap):
+ (JSC::MacroAssemblerX86Common::signExtend32ToPtr):
+ (JSC::MacroAssemblerX86Common::zeroExtend32ToPtr):
+ (JSC::MacroAssemblerX86Common::branch32):
+ (JSC::MacroAssemblerX86Common::jump):
+ (JSC::MacroAssemblerX86_64::add32):
+ (JSC::MacroAssemblerX86_64::sub32):
+ (JSC::MacroAssemblerX86_64::load32):
+ (JSC::MacroAssemblerX86_64::store32):
+ (JSC::MacroAssemblerX86_64::addPtr):
+ (JSC::MacroAssemblerX86_64::andPtr):
+ (JSC::MacroAssemblerX86_64::orPtr):
+ (JSC::MacroAssemblerX86_64::rshiftPtr):
+ (JSC::MacroAssemblerX86_64::subPtr):
+ (JSC::MacroAssemblerX86_64::xorPtr):
+ (JSC::MacroAssemblerX86_64::loadPtr):
+ (JSC::MacroAssemblerX86_64::loadPtrWithAddressOffsetPatch):
+ (JSC::MacroAssemblerX86_64::storePtr):
+ (JSC::MacroAssemblerX86_64::storePtrWithAddressOffsetPatch):
+ (JSC::MacroAssemblerX86_64::branchPtr):
+ (JSC::MacroAssemblerX86_64::branchTestPtr):
+ (JSC::MacroAssemblerX86_64::branchAddPtr):
+ (JSC::MacroAssemblerX86_64::branchSubPtr):
+ (JSC::MacroAssemblerX86_64::branchPtrWithPatch):
+ (JSC::MacroAssemblerX86_64::storePtrWithPatch):
+ (JSC::MacroAssemblerX86::add32):
+ (JSC::MacroAssemblerX86::sub32):
+ (JSC::MacroAssemblerX86::load32):
+ (JSC::MacroAssemblerX86::store32):
+ (JSC::MacroAssemblerX86::branch32):
+ (JSC::MacroAssemblerX86::branchPtrWithPatch):
+ (JSC::MacroAssemblerX86::storePtrWithPatch):
+ (JSC::MacroAssembler::pop):
+ (JSC::MacroAssembler::peek):
+ (JSC::MacroAssembler::poke):
+ (JSC::MacroAssembler::branchPtr):
+ (JSC::MacroAssembler::branch32):
+ (JSC::MacroAssembler::branch16):
+ (JSC::MacroAssembler::branchTestPtr):
+ (JSC::MacroAssembler::addPtr):
+ (JSC::MacroAssembler::andPtr):
+ (JSC::MacroAssembler::orPtr):
+ (JSC::MacroAssembler::rshiftPtr):
+ (JSC::MacroAssembler::subPtr):
+ (JSC::MacroAssembler::xorPtr):
+ (JSC::MacroAssembler::loadPtr):
+ (JSC::MacroAssembler::loadPtrWithAddressOffsetPatch):
+ (JSC::MacroAssembler::storePtr):
+ (JSC::MacroAssembler::storePtrWithAddressOffsetPatch):
+ (JSC::MacroAssembler::branchAddPtr):
+ (JSC::MacroAssembler::branchSubPtr):
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::compileBinaryArithOp):
+
+2009-02-04 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Sam Weinig.
+
+ https://bugs.webkit.org/show_bug.cgi?id=23681
+ Worker tests crash in debug builds if run --singly
+
+ The crash happened because worker threads continued running while debug-only static objects
+ were already being destroyed on main thread.
+
+ * runtime/Structure.cpp: Create static debug-only sets in heap, so that they don't get
+ destroyed.
+
+ * wtf/ThreadingPthreads.cpp: Changed assertions to conventional form.
+
+2009-02-03 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ https://bugs.webkit.org/show_bug.cgi?id=23715
+
+ Simplify MacroAssembler interface, by combining comparison methods.
+ Seprate operations are combined as follows:
+ jz32/jnz32/jzPtr/jnzPtr -> branchTest32/branchTestPtr,
+ j*(Add|Mul|Sub)32/j*(Add|Mul|Sub)Ptr -> branch(Add|Mul|Sub)32/branch(Add|Mul|Sub)Ptr
+ j*32/j*Ptr (all other two op combparisons) -> branch32/brnachPtr
+ set*32 -> set32
+
+ Also, represent the Scale of BaseIndex addresses as a plain enum (0,1,2,3),
+ instead of as multiplicands (1,2,4,8).
+
+ This patch singificantly reduces replication of code, and increases functionality supported
+ by the MacroAssembler. No performance impact.
+
+ * assembler/MacroAssembler.h:
+ (JSC::MacroAssembler::):
+ (JSC::MacroAssembler::branchPtr):
+ (JSC::MacroAssembler::branchPtrWithPatch):
+ (JSC::MacroAssembler::branch32):
+ (JSC::MacroAssembler::branch16):
+ (JSC::MacroAssembler::branchTestPtr):
+ (JSC::MacroAssembler::branchTest32):
+ (JSC::MacroAssembler::branchAddPtr):
+ (JSC::MacroAssembler::branchAdd32):
+ (JSC::MacroAssembler::branchMul32):
+ (JSC::MacroAssembler::branchSubPtr):
+ (JSC::MacroAssembler::branchSub32):
+ (JSC::MacroAssembler::set32):
+ (JSC::MacroAssembler::setTest32):
+ * assembler/X86Assembler.h:
+ (JSC::X86Assembler::):
+ (JSC::X86Assembler::jccRel32):
+ (JSC::X86Assembler::setccOpcode):
+ (JSC::X86Assembler::cmpq_mr):
+ (JSC::X86Assembler::setcc_r):
+ (JSC::X86Assembler::sete_r):
+ (JSC::X86Assembler::setne_r):
+ (JSC::X86Assembler::jne):
+ (JSC::X86Assembler::je):
+ (JSC::X86Assembler::jl):
+ (JSC::X86Assembler::jb):
+ (JSC::X86Assembler::jle):
+ (JSC::X86Assembler::jbe):
+ (JSC::X86Assembler::jge):
+ (JSC::X86Assembler::jg):
+ (JSC::X86Assembler::ja):
+ (JSC::X86Assembler::jae):
+ (JSC::X86Assembler::jo):
+ (JSC::X86Assembler::jp):
+ (JSC::X86Assembler::js):
+ (JSC::X86Assembler::jcc):
+ (JSC::X86Assembler::X86InstructionFormatter::putModRmSib):
+ * jit/JIT.cpp:
+ (JSC::JIT::compileOpStrictEq):
+ (JSC::JIT::emitSlowScriptCheck):
+ (JSC::JIT::privateCompileMainPass):
+ (JSC::JIT::privateCompileSlowCases):
+ (JSC::JIT::privateCompile):
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::compileFastArith_op_lshift):
+ (JSC::JIT::compileFastArith_op_mod):
+ (JSC::JIT::compileFastArith_op_post_inc):
+ (JSC::JIT::compileFastArith_op_post_dec):
+ (JSC::JIT::compileFastArith_op_pre_inc):
+ (JSC::JIT::compileFastArith_op_pre_dec):
+ (JSC::JIT::compileBinaryArithOp):
+ (JSC::JIT::compileFastArith_op_add):
+ (JSC::JIT::compileFastArith_op_mul):
+ * jit/JITCall.cpp:
+ (JSC::JIT::compileOpCall):
+ (JSC::JIT::compileOpCallSlowCase):
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::checkStructure):
+ (JSC::JIT::emitJumpIfJSCell):
+ (JSC::JIT::emitJumpIfNotJSCell):
+ (JSC::JIT::emitJumpIfImmediateNumber):
+ (JSC::JIT::emitJumpIfNotImmediateNumber):
+ (JSC::JIT::emitJumpIfImmediateInteger):
+ (JSC::JIT::emitJumpIfNotImmediateInteger):
+ (JSC::JIT::emitFastArithDeTagImmediateJumpIfZero):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::compileGetByIdHotPath):
+ (JSC::JIT::compilePutByIdHotPath):
+ (JSC::JIT::privateCompilePutByIdTransition):
+ (JSC::JIT::privateCompilePatchGetArrayLength):
+ (JSC::JIT::privateCompileGetByIdProto):
+ (JSC::JIT::privateCompileGetByIdProtoList):
+ (JSC::JIT::privateCompileGetByIdChainList):
+ (JSC::JIT::privateCompileGetByIdChain):
+ * runtime/RegExp.cpp:
+ (JSC::RegExp::match):
+ * wrec/WRECGenerator.cpp:
+ (JSC::WREC::Generator::generateEnter):
+ (JSC::WREC::Generator::generateIncrementIndex):
+ (JSC::WREC::Generator::generateLoadCharacter):
+ (JSC::WREC::Generator::generateJumpIfNotEndOfInput):
+ (JSC::WREC::Generator::generateBackreferenceQuantifier):
+ (JSC::WREC::Generator::generateNonGreedyQuantifier):
+ (JSC::WREC::Generator::generateGreedyQuantifier):
+ (JSC::WREC::Generator::generatePatternCharacterPair):
+ (JSC::WREC::Generator::generatePatternCharacter):
+ (JSC::WREC::Generator::generateCharacterClassInvertedRange):
+ (JSC::WREC::Generator::generateCharacterClassInverted):
+ (JSC::WREC::Generator::generateAssertionBOL):
+ (JSC::WREC::Generator::generateAssertionEOL):
+ (JSC::WREC::Generator::generateAssertionWordBoundary):
+ (JSC::WREC::Generator::generateBackreference):
+
+2009-02-03 David Hyatt <hyatt@apple.com>
+
+ Fix a bug in Vector's shrinkCapacity method. It did not properly copy elements into the inline buffer
+ when shrinking down from a size that was greater than the inline capacity.
+
+ Reviewed by Maciej
+
+ * wtf/Vector.h:
+ (WTF::VectorBuffer::VectorBuffer):
+ (WTF::VectorBuffer::allocateBuffer):
+
+2009-02-03 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Reviewed by Tor Arne Vestbø.
+
+ Added accessor for JSByteArray storage.
+
+ * runtime/JSByteArray.h:
+ (JSC::JSByteArray::storage):
+
+2009-02-03 Dmitry Titov <dimich@chromium.org>
+
+ Reviewed by Alexey Proskuryakov.
+
+ https://bugs.webkit.org/show_bug.cgi?id=23560
+ Implement SharedTimer on WorkerRunLoop
+
+ * JavaScriptCore.exp:
+ Forgot to expose ThreadCondition::timedWait() in one of previous patches.
+
+2009-02-02 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ <https://bugs.webkit.org/show_bug.cgi?id=21414> REGRESSION: Regular Expressions and character classes, shorthands and ranges
+ <rdar://problem/6543487>
+
+ In certain circumstances when WREC::Generator::generateCharacterClassInvertedRange invokes
+ itself recursively, it will incorrectly emit (and thus consume) the next single character
+ match in the current character class. As WREC uses a binary search this out of sequence
+ codegen could result in a character match being missed and so cause the regex to produce
+ incorrect results.
+
+ * wrec/WRECGenerator.cpp:
+ (JSC::WREC::Generator::generateCharacterClassInvertedRange):
+
+2009-02-02 Darin Adler <darin@apple.com>
+
+ Reviewed by Dave Hyatt.
+
+ Bug 23676: Speed up uses of reserveCapacity on new vectors by adding a new reserveInitialCapacity
+ https://bugs.webkit.org/show_bug.cgi?id=23676
+
+ * API/JSObjectRef.cpp:
+ (JSObjectCopyPropertyNames): Use reserveInitialCapacity.
+ * parser/Lexer.cpp:
+ (JSC::Lexer::Lexer): Ditto.
+ (JSC::Lexer::clear): Ditto.
+
+ * wtf/Vector.h: Added reserveInitialCapacity, a more efficient version of
+ reserveCapacity for use when the vector is brand new (still size 0 with no
+ capacity other than the inline capacity).
+
+2009-01-30 Mark Rowe <mrowe@apple.com>
+
+ Rubber-stamped by Oliver Hunt.
+
+ <rdar://problem/6391501> Enable the JIT on Mac OS X x86_64 as it passes all tests.
+
+ * wtf/Platform.h:
+
+2009-01-30 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Mark Rowe and Sam Weinig.
+
+ Finally fix load() to propagate exceptions correctly.
+
+ * jsc.cpp:
+ (functionLoad):
+
+2009-01-30 David Levin <levin@chromium.org>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=23618
+ Templated worker tasks should be more error proof to use.
+ Fix Chromium build.
+
+ * wtf/TypeTraits.h:
+ (WTF::IsConvertibleToInteger::IsConvertibleToDouble):
+ Avoid "possible loss of data" warning when using Microsoft's C++ compiler
+ by avoiding an implicit conversion of int types to doubles.
+
+2009-01-30 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Bug 23580: GNU mode RVCT compilation support
+ <https://bugs.webkit.org/show_bug.cgi?id=23580>
+
+ * pcre/pcre_exec.cpp: Use COMPILER(GCC) instead of __GNUC__.
+ * wtf/FastMalloc.cpp: Ditto.
+ (WTF::TCMallocStats::):
+ * wtf/Platform.h: Don't define COMPILER(GCC) with RVCT --gnu.
+
+2009-01-30 David Levin <levin@chromium.org>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Bug 23618: Templated worker tasks should be more error proof to use
+ <https://bugs.webkit.org/show_bug.cgi?id=23618>
+
+ Add the type traits needed for the generic worker tasks
+ and compile asserts for them.
+
+ Add a summary header to the TypeTraits.h file to explain what is in there.
+
+ Add a note to explain IsPod's deficiencies.
+
+ * wtf/TypeTraits.h:
+
+2009-01-30 David Levin <levin@chromium.org>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Bug 23616: Various "template helpers" should be consolidated from isolated files in JavaScriptCore.
+ <https://bugs.webkit.org/show_bug.cgi?id=23616>
+
+ * wtf/TypeTraits.h: Moved RemovePointer, IsPod, IsInteger to this file.
+
+ * wtf/OwnPtr.h: Use RemovePointer from TypeTraits.h.
+ * wtf/RetainPtr.h: Ditto.
+
+ * wtf/HashTraits.h: Use IsInteger from TypeTraits.h.
+
+ * wtf/VectorTraits.h: Use IsPod from TypeTraits.h.
+
+ * GNUmakefile.am:
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ Added TypeTraits.h.
+
+2009-01-29 Stephanie Lewis <slewis@apple.com>
+
+ RS by Oliver Hunt.
+
+ Update the order files.
+
+ * JavaScriptCore.order:
+
+2009-01-29 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 23551: Crash on page load with profiler enabled and running
+ <https://bugs.webkit.org/show_bug.cgi?id=23551>
+ <rdar://problem/6529521>
+
+ Interpreter::execute(FunctionBodyNode*, ...) calls Profiler::didExecute()
+ with a stale CallFrame. If some part of the scope chain has already been
+ freed, Profiler::didExecute() will crash when attempting to get the lexical
+ global object. The fix is to make the didExecute() call use the caller's
+ CallFrame, not the one made for the function call. In this case, the
+ willExecute() call should also be changed to match.
+
+ Since this occurs in the actual inspector JS, it is difficult to reduce.
+ I couldn't make a layout test.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::execute):
+
+2009-01-28 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Gavin Barraclough.
+
+ Fix for <rdar://problem/6525537>
+ Hang occurs when closing Installer window (iTunes, Aperture)
+
+ * JavaScriptCore.exp: Export JSGlobalData::sharedInstance.
+
+2009-01-28 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoff Garen.
+
+ Initial patch by Mark Rowe.
+
+ <rdar://problem/6519356>
+ REGRESSION (r36006): "out of memory" alert running dromaeo on Windows
+
+ Report the cost of the ArrayStorage vector more accurately/often.
+
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::JSArray): Report the extra cost even for a filled array
+ because JSString using the single character optimization and immediates
+ wont increase the cost themselves.
+ (JSC::JSArray::putSlowCase): Update the cost when increasing the size of
+ the array.
+ (JSC::JSArray::increaseVectorLength): Ditto.
+
+2009-01-28 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoff Garen.
+
+ Fix for <rdar://problem/6129678>
+ REGRESSION (Safari 3-4): Local variable not accessible from Dashcode console or variables view
+
+ Iterating the properties of activation objects accessed through the WebKit debugging
+ APIs was broken by forced conversion of JSActivation to the global object. To fix this,
+ we use a proxy activation object that acts more like a normal JSObject.
+
+ * debugger/DebuggerActivation.cpp: Added.
+ (JSC::DebuggerActivation::DebuggerActivation):
+ (JSC::DebuggerActivation::mark):
+ (JSC::DebuggerActivation::className):
+ (JSC::DebuggerActivation::getOwnPropertySlot):
+ (JSC::DebuggerActivation::put):
+ (JSC::DebuggerActivation::putWithAttributes):
+ (JSC::DebuggerActivation::deleteProperty):
+ (JSC::DebuggerActivation::getPropertyNames):
+ (JSC::DebuggerActivation::getPropertyAttributes):
+ (JSC::DebuggerActivation::defineGetter):
+ (JSC::DebuggerActivation::defineSetter):
+ (JSC::DebuggerActivation::lookupGetter):
+ (JSC::DebuggerActivation::lookupSetter):
+ * debugger/DebuggerActivation.h: Added.
+ Proxy JSActivation object for Debugging.
+
+ * runtime/JSActivation.h:
+ (JSC::JSActivation::isActivationObject): Added.
+ * runtime/JSObject.h:
+ (JSC::JSObject::isActivationObject): Added.
+
+2009-01-28 David Kilzer <ddkilzer@apple.com>
+
+ Bug 23490: Remove initialRefCount argument from RefCounted class
+
+ <https://bugs.webkit.org/show_bug.cgi?id=23490>
+
+ Reviewed by Darin Adler.
+
+ RefCountedBase now always starts with a ref count of 1, so there
+ is no need to pass the initialRefCount into the class anymore.
+
+ * wtf/ByteArray.h:
+ (WTF::ByteArray::ByteArray): Removed call to RefCounted(1).
+ * wtf/RefCounted.h:
+ (WTF::RefCountedBase::RefCountedBase): Changed to start with a
+ ref count of 1.
+ (WTF::RefCounted::RefCounted): Removed initialRefCount argument
+ and removed call to RefCounted(1).
+
+2009-01-26 Adele Peterson <adele@apple.com>
+
+ Build fix.
+
+ * debugger/Debugger.cpp:
+
+2009-01-26 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Fixes for eq null & neq null, on 64-bit JIT.
+ https://bugs.webkit.org/show_bug.cgi?id=23559
+
+ This patch degrades 64-bit JIT performance on some benchmarks,
+ due to the whole not-being-incorrect thing.
+
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+
+2009-01-26 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Gavin Barraclough.
+
+ Bug 23552: Dashcode evaluator no longer works after making ExecStates actual call frames
+ <https://bugs.webkit.org/show_bug.cgi?id=23552>
+ <rdar://problem/6398839>
+
+ * JavaScriptCore.exp:
+ * debugger/Debugger.cpp:
+ (JSC::evaluateInGlobalCallFrame): Added so that WebScriptCallFrame can
+ evaluate JS starting from a global call frame.
+ * debugger/Debugger.h:
+
+2009-01-25 Mark Rowe <mrowe@apple.com>
+
+ Rubber-stamped by Dan Bernstein.
+
+ Improve the consistency of settings in our .xcconfig files.
+
+ * Configurations/Base.xcconfig: Enable GCC_OBJC_CALL_CXX_CDTORS to match other projects.
+
+2009-01-25 Darin Adler <darin@apple.com>
+
+ Reviewed by Mark Rowe.
+
+ Bug 23352: Turn on more compiler warnings in the Mac build
+ https://bugs.webkit.org/show_bug.cgi?id=23352
+
+ Turn on the following warnings:
+
+ -Wcast-qual
+ -Wextra-tokens
+ -Wformat=2
+ -Winit-self
+ -Wmissing-noreturn
+ -Wpacked
+ -Wrendundant-decls
+
+ * Configurations/Base.xcconfig: Added the new warnings. Switched to -Wextra instead of
+ -W for clarity since we don't have to support the older versions of gcc that require the
+ old -W syntax. Since we now use -Wformat=2, removed -Wformat-security. Also removed
+ -Wno-format-y2k since we can have that one on now.
+
+2009-01-25 Judit Jasz <jasy@inf.u-szeged.hu>
+
+ Reviewed by Darin Adler.
+
+ Compilation problem fixing
+ http://bugs.webkit.org/show_bug.cgi?id=23497
+
+ * jit/JITCall.cpp:
+ (JSC::JIT::compileOpCall): Use JSValuePtr::encode.
+
+2009-01-25 Darin Adler <darin@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Bug 23352: Turn on more compiler warnings in the Mac build
+ https://bugs.webkit.org/show_bug.cgi?id=23352
+
+ Fourth patch: Deal with the last few stray warnings.
+
+ * parser/Parser.cpp: Only declare jscyyparse if it's not already declared.
+ This makes both separate compilation and all-in-one compilation work with the
+ -Wredundant-decls warning.
+
+2009-01-25 Darin Adler <darin@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Bug 23352: Turn on more compiler warnings in the Mac build
+ https://bugs.webkit.org/show_bug.cgi?id=23352
+
+ Third patch: Use the noreturn attribute on functions that don't
+ return to prepare for the use of the -Wmissing-noreturn warning.
+
+ * jit/JITCall.cpp:
+ (JSC::unreachable): Added NO_RETURN.
+ * jsc.cpp:
+ (functionQuit): Ditto.
+ (printUsageStatement): Ditto.
+ * wtf/AlwaysInline.h: Added definition of NO_RETURN.
+
+2009-01-24 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Force inlining of Lexer::matchPunctuator
+
+ 2.2% win when parsing jQuery, Mootools, Prototype, etc
+
+ * parser/Lexer.h:
+
+2009-01-23 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Fix for <rdar://problem/6126212>
+ Ensure that callbacks out from the JSC interface are only allowed
+ to return in reverse-chronological order to that in which they were
+ made. If we allow earlier callbacks to return first, then this may
+ result in setions of the RegisterFile in use by another thread
+ being trampled.
+
+ See uber-comment in JSLock.h for details.
+
+ * runtime/JSLock.cpp:
+ (JSC::JSLock::DropAllLocks::DropAllLocks):
+ (JSC::JSLock::DropAllLocks::~DropAllLocks):
+
+2009-01-23 Darin Adler <darin@apple.com>
+
+ Try to fix WX build.
+
+ * runtime/JSGlobalObjectFunctions.h: Include <wtf/unicode/Unicode.h>
+ for the definition of UChar.
+
+2009-01-23 Anders Carlsson <andersca@apple.com>
+
+ * Configurations/Base.xcconfig:
+ GCC 4.0 build fix.
+
+ * runtime/JSNumberCell.h:
+ 64-bit build fix.
+
+2009-01-23 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Turn on -Wmissing-prototypes and fix the warnings.
+
+ * API/JSClassRef.cpp:
+ (clearReferenceToPrototype):
+ * Configurations/Base.xcconfig:
+ * runtime/Collector.cpp:
+ (JSC::getPlatformThreadRegisters):
+ * runtime/ExceptionHelpers.cpp:
+ (JSC::createError):
+ * runtime/JSGlobalObjectFunctions.h:
+ * runtime/JSNumberCell.h:
+ * runtime/UString.cpp:
+ (JSC::initializeStaticBaseString):
+ (JSC::createRep):
+ * wtf/FastMalloc.cpp:
+ * wtf/Threading.cpp:
+
+2009-01-22 Mark Rowe <mrowe@apple.com>
+
+ Rubber-stamped by Anders Carlsson.
+
+ Disable GCC_WARN_ABOUT_MISSING_PROTOTYPES temporarily.
+
+ Current versions of Xcode only respect it for C and Objective-C files,
+ and our code doesn't currently compile if it is applied to C++ and
+ Objective-C++ files.
+
+ * Configurations/Base.xcconfig:
+
+2009-01-22 Steve Falkenburg <sfalken@apple.com>
+
+ https://bugs.webkit.org/show_bug.cgi?id=23489
+
+ Return currentTime() in correct units for the two early return cases.
+
+ Reviewed by Mark Rowe.
+
+ * wtf/CurrentTime.cpp:
+ (WTF::currentTime):
+
+2009-01-22 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Mark Rowe.
+
+ Fix for <rdar://problem/6439247>
+ FastMalloc allocating an extra 4MB of meta-data on 64-bit
+
+ Rely on the fact that on all known x86-64 platforms only use 48 bits of
+ address space to shrink the initial size of the PageMap from ~4MB to 120K.
+ For 64-bit we still use a 3-level radix tree, but now each level is only 12
+ bits wide.
+
+ No performance change.
+
+ * wtf/FastMalloc.cpp:
+ (WTF::MapSelector): Add specialization for 64 bit that takes into account the
+ 16 bits of unused address space on x86-64.
+
+2009-01-22 Beth Dakin <bdakin@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Fix for https://bugs.webkit.org/show_bug.cgi?id=23461 LayoutTests/
+ fast/js/numeric-conversion.html is broken, and corresponding
+ <rdar://problem/6514842>
+
+ The basic problem here is that parseInt(Infinity) should be NaN,
+ but we were returning 0. NaN matches Safari 3.2.1 and Firefox.
+
+ * runtime/JSGlobalObjectFunctions.cpp:
+ (JSC::globalFuncParseInt):
+
+2009-01-22 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ <rdar://problem/6516853> (r39682-r39736) JSFunFuzz: crash on "(function(){({ x2: x }), })()"
+ <https://bugs.webkit.org/show_bug.cgi?id=23479>
+
+ Automatic semicolon insertion was resulting in this being accepted in the initial
+ nodeless parsing, but subsequent reparsing for code generation would fail, leading
+ to a crash. The solution is to ensure that reparsing a function performs parsing
+ in the same state as the initial parse. We do this by modifying the saved source
+ ranges to include rather than exclude the opening and closing braces.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::reparseForExceptionInfoIfNecessary): add an assertion for successful recompile
+ * parser/Lexer.h:
+ (JSC::Lexer::sourceCode): include rather than exclude braces.
+ * parser/Nodes.h:
+ (JSC::FunctionBodyNode::toSourceString): No need to append braces anymore.
+
+2009-01-22 Dmitry Titov <dimich@chromium.org>
+
+ Reviewed by Alexey Proskuryakov.
+
+ https://bugs.webkit.org/show_bug.cgi?id=23373
+
+ Implement ThreadCondition::timedWait().
+ Since we borrow the code for condition variables from other sources,
+ I did the same for timedWait(). See comments in ThreadingWin.cpp for
+ rationale and more info.
+
+ * wtf/CONTRIBUTORS.pthreads-win32:
+ Added. A list of Pthreads-win32 contributors mentioned in their license. The license itself
+ is included into wtf/ThreadingWin32.cpp.
+
+ * wtf/Threading.h:
+ * wtf/ThreadingWin.cpp:
+ Additional info and Pthreads-win32 license at the beginning.
+ (WTF::PlatformCondition::timedWait): new method, derived from Pthreads-win32.
+ (WTF::PlatformCondition::signal): same
+ (WTF::ThreadCondition::ThreadCondition):
+ (WTF::ThreadCondition::~ThreadCondition):
+ (WTF::ThreadCondition::wait): this now calls PlatformCondition::timedWait.
+ (WTF::ThreadCondition::timedWait): same
+ (WTF::ThreadCondition::signal): this now calls PlatformCondition::signal.
+ (WTF::ThreadCondition::broadcast): same
+
+2009-01-21 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Fix for https://bugs.webkit.org/show_bug.cgi?id=23469.
+
+ We need to check all numbers in integer switches, not just those
+ represented as integer JSImmediates.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+ (JSC::Interpreter::cti_op_switch_imm):
+
+2009-01-21 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Fix for https://bugs.webkit.org/show_bug.cgi?id=23468.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+
+2009-01-21 Alexey Proskuryakov <ap@webkit.org>
+
+ Suggested by Oliver Hunt. Reviewed by Oliver Hunt.
+
+ https://bugs.webkit.org/show_bug.cgi?id=23456
+ Function argument names leak
+
+ * parser/Nodes.cpp: (JSC::FunctionBodyNode::~FunctionBodyNode): Destruct parameter names.
+
+2009-01-20 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by NOBODY (Build fix).
+
+ Windows build fix
+
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+
+2009-01-20 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Mark Rowe.
+
+ Structure property table deleted offset maps are being leaked.
+ Probably shouldn't be doing that.
+
+ https://bugs.webkit.org/show_bug.cgi?id=23442
+
+ * runtime/Structure.cpp:
+ (JSC::Structure::~Structure):
+
+2009-01-20 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by NOBODY (build fix).
+
+ Attempt to fix gtk build
+
+ * GNUmakefile.am:
+
+2009-01-20 Darin Adler <darin@apple.com>
+
+ * runtime/StringPrototype.cpp:
+ (JSC::substituteBackreferences): Add back the initialization to fix the build.
+
+2009-01-20 Darin Adler <darin@apple.com>
+
+ Reviewed by Mark Rowe.
+
+ Bug 23352: Turn on more compiler warnings in the Mac build
+ https://bugs.webkit.org/show_bug.cgi?id=23352
+
+ First patch: Fix some simple cases of various warnings.
+
+ * pcre/pcre_compile.cpp:
+ (jsRegExpCompile): Use const_cast to change const-ness.
+
+ * runtime/StringPrototype.cpp:
+ (JSC::substituteBackreferences): Remove unneeded initialization and
+ use UChar instead of unsigned short for UTF-16 values.
+
+ * wtf/dtoa.cpp:
+ (WTF::strtod): Use const_cast to change const-ness.
+
+2009-01-20 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by NOBODY (build fix).
+
+ Whoops, remove runtime/ByteArray references from .pri and .scons builds, update .bkl
+
+ * JavaScriptCore.pri:
+ * JavaScriptCore.scons:
+ * JavaScriptCoreSources.bkl:
+
+2009-01-20 Oliver Hunt <oliver@apple.com>
+
+ RS=Dan Bernstein.
+
+ Move runtime/ByteArray to wtf/ByteArray
+
+ * GNUmakefile.am:
+ * JavaScriptCore.exp:
+ * JavaScriptCore.pri:
+ * JavaScriptCore.scons:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * runtime/JSByteArray.cpp:
+ * runtime/JSByteArray.h:
+ * wtf/ByteArray.cpp: Renamed from JavaScriptCore/runtime/ByteArray.cpp.
+ (WTF::ByteArray::create):
+ * wtf/ByteArray.h: Renamed from JavaScriptCore/runtime/ByteArray.h.
+ (WTF::ByteArray::length):
+ (WTF::ByteArray::set):
+ (WTF::ByteArray::get):
+ (WTF::ByteArray::data):
+ (WTF::ByteArray::deref):
+ (WTF::ByteArray::ByteArray):
+
+2009-01-19 Sam Weinig <sam@webkit.org>
+
+ Rubber-stamped by Gavin Barraclough.
+
+ Remove temporary operator-> from JSValuePtr.
+
+ * API/JSCallbackFunction.cpp:
+ (JSC::JSCallbackFunction::call):
+ * API/JSCallbackObjectFunctions.h:
+ (JSC::::call):
+ (JSC::::toNumber):
+ (JSC::::toString):
+ * API/JSObjectRef.cpp:
+ (JSObjectSetPrototype):
+ * API/JSValueRef.cpp:
+ (JSValueGetType):
+ (JSValueIsUndefined):
+ (JSValueIsNull):
+ (JSValueIsBoolean):
+ (JSValueIsNumber):
+ (JSValueIsString):
+ (JSValueIsObject):
+ (JSValueIsObjectOfClass):
+ (JSValueToBoolean):
+ (JSValueToNumber):
+ (JSValueToStringCopy):
+ (JSValueToObject):
+ * bytecode/CodeBlock.cpp:
+ (JSC::valueToSourceString):
+ (JSC::CodeBlock::mark):
+ * bytecode/CodeBlock.h:
+ (JSC::CodeBlock::isKnownNotImmediate):
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::emitEqualityOp):
+ (JSC::keyForImmediateSwitch):
+ * interpreter/Interpreter.cpp:
+ (JSC::jsLess):
+ (JSC::jsLessEq):
+ (JSC::jsAddSlowCase):
+ (JSC::jsAdd):
+ (JSC::jsTypeStringForValue):
+ (JSC::jsIsObjectType):
+ (JSC::jsIsFunctionType):
+ (JSC::isNotObject):
+ (JSC::Interpreter::callEval):
+ (JSC::Interpreter::throwException):
+ (JSC::cachePrototypeChain):
+ (JSC::Interpreter::tryCachePutByID):
+ (JSC::countPrototypeChainEntriesAndCheckForProxies):
+ (JSC::Interpreter::tryCacheGetByID):
+ (JSC::Interpreter::privateExecute):
+ (JSC::Interpreter::tryCTICachePutByID):
+ (JSC::Interpreter::tryCTICacheGetByID):
+ (JSC::Interpreter::cti_op_convert_this):
+ (JSC::Interpreter::cti_op_add):
+ (JSC::Interpreter::cti_op_pre_inc):
+ (JSC::Interpreter::cti_op_put_by_id_generic):
+ (JSC::Interpreter::cti_op_get_by_id_generic):
+ (JSC::Interpreter::cti_op_put_by_id):
+ (JSC::Interpreter::cti_op_put_by_id_second):
+ (JSC::Interpreter::cti_op_put_by_id_fail):
+ (JSC::Interpreter::cti_op_get_by_id):
+ (JSC::Interpreter::cti_op_get_by_id_second):
+ (JSC::Interpreter::cti_op_get_by_id_self_fail):
+ (JSC::Interpreter::cti_op_get_by_id_proto_list):
+ (JSC::Interpreter::cti_op_get_by_id_proto_list_full):
+ (JSC::Interpreter::cti_op_get_by_id_proto_fail):
+ (JSC::Interpreter::cti_op_get_by_id_array_fail):
+ (JSC::Interpreter::cti_op_get_by_id_string_fail):
+ (JSC::Interpreter::cti_op_instanceof):
+ (JSC::Interpreter::cti_op_del_by_id):
+ (JSC::Interpreter::cti_op_mul):
+ (JSC::Interpreter::cti_op_call_JSFunction):
+ (JSC::Interpreter::cti_op_call_NotJSFunction):
+ (JSC::Interpreter::cti_op_construct_JSConstruct):
+ (JSC::Interpreter::cti_op_construct_NotJSConstruct):
+ (JSC::Interpreter::cti_op_get_by_val):
+ (JSC::Interpreter::cti_op_get_by_val_byte_array):
+ (JSC::Interpreter::cti_op_sub):
+ (JSC::Interpreter::cti_op_put_by_val):
+ (JSC::Interpreter::cti_op_put_by_val_array):
+ (JSC::Interpreter::cti_op_put_by_val_byte_array):
+ (JSC::Interpreter::cti_op_loop_if_true):
+ (JSC::Interpreter::cti_op_negate):
+ (JSC::Interpreter::cti_op_div):
+ (JSC::Interpreter::cti_op_pre_dec):
+ (JSC::Interpreter::cti_op_not):
+ (JSC::Interpreter::cti_op_jtrue):
+ (JSC::Interpreter::cti_op_post_inc):
+ (JSC::Interpreter::cti_op_lshift):
+ (JSC::Interpreter::cti_op_bitand):
+ (JSC::Interpreter::cti_op_rshift):
+ (JSC::Interpreter::cti_op_bitnot):
+ (JSC::Interpreter::cti_op_mod):
+ (JSC::Interpreter::cti_op_post_dec):
+ (JSC::Interpreter::cti_op_urshift):
+ (JSC::Interpreter::cti_op_bitxor):
+ (JSC::Interpreter::cti_op_bitor):
+ (JSC::Interpreter::cti_op_push_scope):
+ (JSC::Interpreter::cti_op_is_undefined):
+ (JSC::Interpreter::cti_op_is_boolean):
+ (JSC::Interpreter::cti_op_is_number):
+ (JSC::Interpreter::cti_op_to_jsnumber):
+ (JSC::Interpreter::cti_op_in):
+ (JSC::Interpreter::cti_op_put_by_index):
+ (JSC::Interpreter::cti_op_switch_imm):
+ (JSC::Interpreter::cti_op_switch_char):
+ (JSC::Interpreter::cti_op_switch_string):
+ (JSC::Interpreter::cti_op_del_by_val):
+ (JSC::Interpreter::cti_op_put_getter):
+ (JSC::Interpreter::cti_op_put_setter):
+ (JSC::Interpreter::cti_op_new_error):
+ * interpreter/Interpreter.h:
+ (JSC::Interpreter::isJSArray):
+ (JSC::Interpreter::isJSString):
+ (JSC::Interpreter::isJSByteArray):
+ * interpreter/Register.h:
+ (JSC::Register::marked):
+ (JSC::Register::mark):
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::getConstantOperandImmediateInt):
+ (JSC::JIT::isOperandConstantImmediateInt):
+ * jsc.cpp:
+ (functionPrint):
+ (functionDebug):
+ (functionRun):
+ (functionLoad):
+ (runWithScripts):
+ (runInteractive):
+ * parser/Nodes.cpp:
+ (JSC::processClauseList):
+ * profiler/ProfileGenerator.cpp:
+ (JSC::ProfileGenerator::addParentForConsoleStart):
+ * profiler/Profiler.cpp:
+ (JSC::Profiler::createCallIdentifier):
+ * runtime/ArrayConstructor.cpp:
+ (JSC::constructArrayWithSizeQuirk):
+ * runtime/ArrayPrototype.cpp:
+ (JSC::arrayProtoFuncToString):
+ (JSC::arrayProtoFuncToLocaleString):
+ (JSC::arrayProtoFuncJoin):
+ (JSC::arrayProtoFuncConcat):
+ (JSC::arrayProtoFuncPop):
+ (JSC::arrayProtoFuncPush):
+ (JSC::arrayProtoFuncReverse):
+ (JSC::arrayProtoFuncShift):
+ (JSC::arrayProtoFuncSlice):
+ (JSC::arrayProtoFuncSort):
+ (JSC::arrayProtoFuncSplice):
+ (JSC::arrayProtoFuncUnShift):
+ (JSC::arrayProtoFuncFilter):
+ (JSC::arrayProtoFuncMap):
+ (JSC::arrayProtoFuncEvery):
+ (JSC::arrayProtoFuncForEach):
+ (JSC::arrayProtoFuncSome):
+ (JSC::arrayProtoFuncIndexOf):
+ (JSC::arrayProtoFuncLastIndexOf):
+ * runtime/BooleanConstructor.cpp:
+ (JSC::constructBoolean):
+ (JSC::callBooleanConstructor):
+ * runtime/BooleanPrototype.cpp:
+ (JSC::booleanProtoFuncToString):
+ (JSC::booleanProtoFuncValueOf):
+ * runtime/Collector.cpp:
+ (JSC::Heap::protect):
+ (JSC::Heap::unprotect):
+ (JSC::Heap::heap):
+ (JSC::Heap::collect):
+ (JSC::typeName):
+ * runtime/Completion.cpp:
+ (JSC::evaluate):
+ * runtime/DateConstructor.cpp:
+ (JSC::constructDate):
+ (JSC::dateParse):
+ (JSC::dateUTC):
+ * runtime/DateInstance.h:
+ (JSC::DateInstance::internalNumber):
+ * runtime/DatePrototype.cpp:
+ (JSC::formatLocaleDate):
+ (JSC::fillStructuresUsingTimeArgs):
+ (JSC::fillStructuresUsingDateArgs):
+ (JSC::dateProtoFuncToString):
+ (JSC::dateProtoFuncToUTCString):
+ (JSC::dateProtoFuncToDateString):
+ (JSC::dateProtoFuncToTimeString):
+ (JSC::dateProtoFuncToLocaleString):
+ (JSC::dateProtoFuncToLocaleDateString):
+ (JSC::dateProtoFuncToLocaleTimeString):
+ (JSC::dateProtoFuncGetTime):
+ (JSC::dateProtoFuncGetFullYear):
+ (JSC::dateProtoFuncGetUTCFullYear):
+ (JSC::dateProtoFuncToGMTString):
+ (JSC::dateProtoFuncGetMonth):
+ (JSC::dateProtoFuncGetUTCMonth):
+ (JSC::dateProtoFuncGetDate):
+ (JSC::dateProtoFuncGetUTCDate):
+ (JSC::dateProtoFuncGetDay):
+ (JSC::dateProtoFuncGetUTCDay):
+ (JSC::dateProtoFuncGetHours):
+ (JSC::dateProtoFuncGetUTCHours):
+ (JSC::dateProtoFuncGetMinutes):
+ (JSC::dateProtoFuncGetUTCMinutes):
+ (JSC::dateProtoFuncGetSeconds):
+ (JSC::dateProtoFuncGetUTCSeconds):
+ (JSC::dateProtoFuncGetMilliSeconds):
+ (JSC::dateProtoFuncGetUTCMilliseconds):
+ (JSC::dateProtoFuncGetTimezoneOffset):
+ (JSC::dateProtoFuncSetTime):
+ (JSC::setNewValueFromTimeArgs):
+ (JSC::setNewValueFromDateArgs):
+ (JSC::dateProtoFuncSetYear):
+ (JSC::dateProtoFuncGetYear):
+ * runtime/ErrorConstructor.cpp:
+ (JSC::constructError):
+ * runtime/ErrorPrototype.cpp:
+ (JSC::errorProtoFuncToString):
+ * runtime/ExceptionHelpers.cpp:
+ (JSC::createError):
+ (JSC::createErrorMessage):
+ * runtime/FunctionConstructor.cpp:
+ (JSC::constructFunction):
+ * runtime/FunctionPrototype.cpp:
+ (JSC::functionProtoFuncToString):
+ (JSC::functionProtoFuncApply):
+ (JSC::functionProtoFuncCall):
+ * runtime/GetterSetter.cpp:
+ (JSC::GetterSetter::toObject):
+ * runtime/JSActivation.cpp:
+ (JSC::JSActivation::getOwnPropertySlot):
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::put):
+ (JSC::JSArray::mark):
+ (JSC::JSArray::sort):
+ (JSC::AVLTreeAbstractorForArrayCompare::compare_key_key):
+ (JSC::JSArray::compactForSorting):
+ * runtime/JSByteArray.h:
+ (JSC::JSByteArray::setIndex):
+ * runtime/JSCell.h:
+ (JSC::asCell):
+ * runtime/JSFunction.cpp:
+ (JSC::JSFunction::call):
+ (JSC::JSFunction::construct):
+ * runtime/JSGlobalObject.cpp:
+ (JSC::markIfNeeded):
+ (JSC::lastInPrototypeChain):
+ * runtime/JSGlobalObjectFunctions.cpp:
+ (JSC::encode):
+ (JSC::decode):
+ (JSC::globalFuncEval):
+ (JSC::globalFuncParseInt):
+ (JSC::globalFuncParseFloat):
+ (JSC::globalFuncIsNaN):
+ (JSC::globalFuncIsFinite):
+ (JSC::globalFuncEscape):
+ (JSC::globalFuncUnescape):
+ (JSC::globalFuncJSCPrint):
+ * runtime/JSImmediate.cpp:
+ (JSC::JSImmediate::toThisObject):
+ (JSC::JSImmediate::toObject):
+ (JSC::JSImmediate::prototype):
+ (JSC::JSImmediate::toString):
+ * runtime/JSImmediate.h:
+ * runtime/JSObject.cpp:
+ (JSC::JSObject::mark):
+ (JSC::JSObject::put):
+ (JSC::callDefaultValueFunction):
+ (JSC::JSObject::getPrimitiveNumber):
+ (JSC::JSObject::defineGetter):
+ (JSC::JSObject::defineSetter):
+ (JSC::JSObject::lookupGetter):
+ (JSC::JSObject::lookupSetter):
+ (JSC::JSObject::hasInstance):
+ (JSC::JSObject::toNumber):
+ (JSC::JSObject::toString):
+ * runtime/JSObject.h:
+ (JSC::JSObject::JSObject):
+ (JSC::JSObject::inlineGetOwnPropertySlot):
+ (JSC::JSObject::getOwnPropertySlotForWrite):
+ (JSC::JSObject::getPropertySlot):
+ (JSC::JSValuePtr::get):
+ * runtime/JSPropertyNameIterator.h:
+ (JSC::JSPropertyNameIterator::create):
+ * runtime/JSString.cpp:
+ (JSC::JSString::getOwnPropertySlot):
+ * runtime/JSValue.h:
+ * runtime/JSWrapperObject.cpp:
+ (JSC::JSWrapperObject::mark):
+ * runtime/JSWrapperObject.h:
+ (JSC::JSWrapperObject::setInternalValue):
+ * runtime/MathObject.cpp:
+ (JSC::mathProtoFuncAbs):
+ (JSC::mathProtoFuncACos):
+ (JSC::mathProtoFuncASin):
+ (JSC::mathProtoFuncATan):
+ (JSC::mathProtoFuncATan2):
+ (JSC::mathProtoFuncCeil):
+ (JSC::mathProtoFuncCos):
+ (JSC::mathProtoFuncExp):
+ (JSC::mathProtoFuncFloor):
+ (JSC::mathProtoFuncLog):
+ (JSC::mathProtoFuncMax):
+ (JSC::mathProtoFuncMin):
+ (JSC::mathProtoFuncPow):
+ (JSC::mathProtoFuncRound):
+ (JSC::mathProtoFuncSin):
+ (JSC::mathProtoFuncSqrt):
+ (JSC::mathProtoFuncTan):
+ * runtime/NativeErrorConstructor.cpp:
+ (JSC::NativeErrorConstructor::NativeErrorConstructor):
+ (JSC::NativeErrorConstructor::construct):
+ * runtime/NumberConstructor.cpp:
+ (JSC::constructWithNumberConstructor):
+ (JSC::callNumberConstructor):
+ * runtime/NumberPrototype.cpp:
+ (JSC::numberProtoFuncToString):
+ (JSC::numberProtoFuncToLocaleString):
+ (JSC::numberProtoFuncValueOf):
+ (JSC::numberProtoFuncToFixed):
+ (JSC::numberProtoFuncToExponential):
+ (JSC::numberProtoFuncToPrecision):
+ * runtime/ObjectConstructor.cpp:
+ (JSC::constructObject):
+ * runtime/ObjectPrototype.cpp:
+ (JSC::objectProtoFuncValueOf):
+ (JSC::objectProtoFuncHasOwnProperty):
+ (JSC::objectProtoFuncIsPrototypeOf):
+ (JSC::objectProtoFuncDefineGetter):
+ (JSC::objectProtoFuncDefineSetter):
+ (JSC::objectProtoFuncLookupGetter):
+ (JSC::objectProtoFuncLookupSetter):
+ (JSC::objectProtoFuncPropertyIsEnumerable):
+ (JSC::objectProtoFuncToLocaleString):
+ (JSC::objectProtoFuncToString):
+ * runtime/Operations.h:
+ (JSC::JSValuePtr::equalSlowCaseInline):
+ (JSC::JSValuePtr::strictEqual):
+ (JSC::JSValuePtr::strictEqualSlowCaseInline):
+ * runtime/Protect.h:
+ (JSC::gcProtect):
+ (JSC::gcUnprotect):
+ * runtime/RegExpConstructor.cpp:
+ (JSC::setRegExpConstructorInput):
+ (JSC::setRegExpConstructorMultiline):
+ (JSC::constructRegExp):
+ * runtime/RegExpObject.cpp:
+ (JSC::setRegExpObjectLastIndex):
+ (JSC::RegExpObject::match):
+ * runtime/RegExpPrototype.cpp:
+ (JSC::regExpProtoFuncTest):
+ (JSC::regExpProtoFuncExec):
+ (JSC::regExpProtoFuncCompile):
+ (JSC::regExpProtoFuncToString):
+ * runtime/StringConstructor.cpp:
+ (JSC::stringFromCharCodeSlowCase):
+ (JSC::stringFromCharCode):
+ (JSC::constructWithStringConstructor):
+ (JSC::callStringConstructor):
+ * runtime/StringPrototype.cpp:
+ (JSC::stringProtoFuncReplace):
+ (JSC::stringProtoFuncToString):
+ (JSC::stringProtoFuncCharAt):
+ (JSC::stringProtoFuncCharCodeAt):
+ (JSC::stringProtoFuncConcat):
+ (JSC::stringProtoFuncIndexOf):
+ (JSC::stringProtoFuncLastIndexOf):
+ (JSC::stringProtoFuncMatch):
+ (JSC::stringProtoFuncSearch):
+ (JSC::stringProtoFuncSlice):
+ (JSC::stringProtoFuncSplit):
+ (JSC::stringProtoFuncSubstr):
+ (JSC::stringProtoFuncSubstring):
+ (JSC::stringProtoFuncToLowerCase):
+ (JSC::stringProtoFuncToUpperCase):
+ (JSC::stringProtoFuncLocaleCompare):
+ (JSC::stringProtoFuncBig):
+ (JSC::stringProtoFuncSmall):
+ (JSC::stringProtoFuncBlink):
+ (JSC::stringProtoFuncBold):
+ (JSC::stringProtoFuncFixed):
+ (JSC::stringProtoFuncItalics):
+ (JSC::stringProtoFuncStrike):
+ (JSC::stringProtoFuncSub):
+ (JSC::stringProtoFuncSup):
+ (JSC::stringProtoFuncFontcolor):
+ (JSC::stringProtoFuncFontsize):
+ (JSC::stringProtoFuncAnchor):
+ (JSC::stringProtoFuncLink):
+ * runtime/Structure.cpp:
+ (JSC::Structure::Structure):
+ (JSC::Structure::getEnumerablePropertyNames):
+ (JSC::Structure::createCachedPrototypeChain):
+ * runtime/Structure.h:
+ (JSC::Structure::mark):
+ * runtime/StructureChain.cpp:
+ (JSC::StructureChain::StructureChain):
+
+2009-01-19 Darin Adler <darin@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Bug 23409: REGRESSION: RegExp 'replace()' function improperly processes '$$'
+ <https://bugs.webkit.org/show_bug.cgi?id=23409>
+ <rdar://problem/6505723>
+
+ Test: fast/js/string-replace-3.html
+
+ * runtime/StringPrototype.cpp:
+ (JSC::substituteBackreferences): Remove code that adds an extra $ -- not sure
+ how this ever worked.
+
+2009-01-16 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ On x86-64 jit, cache JSImmedate::TagMask & JSImmedate::TagTypeNumber in
+ registers, save reloading them every time they're used.
+
+ Draws x86-64 jit performance close to that of i386 jit.
+
+ * assembler/MacroAssembler.h:
+ (JSC::MacroAssembler::subPtr):
+ (JSC::MacroAssembler::jnzPtr):
+ (JSC::MacroAssembler::jzPtr):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ * jit/JIT.h:
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::compileBinaryArithOpSlowCase):
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::emitJumpIfJSCell):
+ (JSC::JIT::emitJumpIfNotJSCell):
+ (JSC::JIT::emitJumpIfImmediateNumber):
+ (JSC::JIT::emitJumpIfNotImmediateNumber):
+ (JSC::JIT::emitJumpIfImmediateInteger):
+ (JSC::JIT::emitJumpIfNotImmediateInteger):
+ (JSC::JIT::emitFastArithIntToImmNoCheck):
+
+2009-01-16 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Add support to x86-64 JIT for inline double precision arithmetic ops.
+ +5/6% on x86-64, JIT enabled, sunspider.
+
+ * assembler/MacroAssembler.h:
+ (JSC::MacroAssembler::addPtr):
+ * assembler/X86Assembler.h:
+ (JSC::X86Assembler::movq_rr):
+ * jit/JIT.h:
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::compileFastArith_op_pre_inc):
+ (JSC::JIT::compileBinaryArithOp):
+ (JSC::JIT::compileBinaryArithOpSlowCase):
+ (JSC::JIT::compileFastArith_op_add):
+ (JSC::JIT::compileFastArithSlow_op_add):
+ (JSC::JIT::compileFastArith_op_mul):
+ (JSC::JIT::compileFastArithSlow_op_mul):
+ (JSC::JIT::compileFastArith_op_sub):
+ (JSC::JIT::compileFastArithSlow_op_sub):
+ * parser/ResultType.h:
+ (JSC::ResultType::isReusable):
+ (JSC::ResultType::isInt32):
+ (JSC::ResultType::definitelyIsNumber):
+ (JSC::ResultType::mightBeNumber):
+ (JSC::ResultType::isNotNumber):
+ (JSC::ResultType::unknownType):
+
+2009-01-16 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Fixes for SamplingTool.
+
+ https://bugs.webkit.org/show_bug.cgi?id=23390
+
+ * assembler/MacroAssembler.h:
+ (JSC::MacroAssembler::storePtr):
+ * bytecode/SamplingTool.cpp:
+ (JSC::SamplingTool::run):
+ (JSC::SamplingTool::dump):
+ * bytecode/SamplingTool.h:
+ (JSC::SamplingTool::encodeSample):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ (JSC::JIT::privateCompile):
+ * jit/JIT.h:
+ (JSC::JIT::samplingToolTrackCodeBlock):
+ * jit/JITCall.cpp:
+ (JSC::JIT::compileOpCall):
+ (JSC::JIT::compileOpCallSlowCase):
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::emitCTICall_internal):
+
+2009-01-16 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Fixed <rdar://problem/6452301> REGRESSION: Latest WebKit nightlies
+ turn "c" into "" when stripping \\c_ character
+
+ * wrec/WRECParser.cpp:
+ (JSC::WREC::Parser::consumeEscape): Mimic a Firefox quirk when parsing
+ control escapes inside character classes.
+
+2009-01-16 Adam Roben <aroben@apple.com>
+
+ Windows build fix
+
+ * wrec/WRECParser.cpp:
+ (JSC::WREC::Parser::parseParentheses): Removed unreachable code.
+
+2009-01-15 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ Fixed <rdar://problem/6471394> REGRESSION (r39164): Discarding quantifier
+ on assertion gives incorrect result (23075)
+
+ https://bugs.webkit.org/show_bug.cgi?id=23075
+
+ * pcre/pcre_compile.cpp:
+ (compileBranch): Throw away an assertion if it's followed by a quantifier
+ with a 0 minimum, to match SpiderMonkey, v8, and the ECMA spec.
+
+ * wrec/WRECParser.cpp:
+ (JSC::WREC::Parser::parseParentheses): Fall back on PCRE for the rare
+ case of an assertion with a quantifier with a 0 minimum, since we
+ don't handle quantified subexpressions yet, and in this special case,
+ we can't just throw away the quantifier.
+
+2009-01-15 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Add support in ResultType to track that the results of bitops
+ are always of type int32_t.
+
+ * parser/Nodes.cpp:
+ (JSC::ReadModifyResolveNode::emitBytecode):
+ (JSC::ReadModifyDotNode::emitBytecode):
+ (JSC::ReadModifyBracketNode::emitBytecode):
+ * parser/Nodes.h:
+ (JSC::ExpressionNode::):
+ (JSC::BooleanNode::):
+ (JSC::NumberNode::):
+ (JSC::StringNode::):
+ (JSC::PrePostResolveNode::):
+ (JSC::TypeOfResolveNode::):
+ (JSC::TypeOfValueNode::):
+ (JSC::UnaryPlusNode::):
+ (JSC::NegateNode::):
+ (JSC::BitwiseNotNode::):
+ (JSC::LogicalNotNode::):
+ (JSC::MultNode::):
+ (JSC::DivNode::):
+ (JSC::ModNode::):
+ (JSC::SubNode::):
+ (JSC::LeftShiftNode::):
+ (JSC::RightShiftNode::):
+ (JSC::UnsignedRightShiftNode::):
+ (JSC::LessNode::):
+ (JSC::GreaterNode::):
+ (JSC::LessEqNode::):
+ (JSC::GreaterEqNode::):
+ (JSC::InstanceOfNode::):
+ (JSC::EqualNode::):
+ (JSC::NotEqualNode::):
+ (JSC::StrictEqualNode::):
+ (JSC::NotStrictEqualNode::):
+ (JSC::BitAndNode::):
+ (JSC::BitOrNode::):
+ (JSC::BitXOrNode::):
+ (JSC::LogicalOpNode::):
+ * parser/ResultType.h:
+ (JSC::ResultType::isInt32):
+ (JSC::ResultType::isNotNumber):
+ (JSC::ResultType::booleanType):
+ (JSC::ResultType::numberType):
+ (JSC::ResultType::numberTypeCanReuse):
+ (JSC::ResultType::numberTypeCanReuseIsInt32):
+ (JSC::ResultType::stringOrNumberTypeCanReuse):
+ (JSC::ResultType::stringType):
+ (JSC::ResultType::unknownType):
+ (JSC::ResultType::forAdd):
+ (JSC::ResultType::forBitOp):
+ (JSC::OperandTypes::OperandTypes):
+
+2009-01-15 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Add support for integer addition, subtraction and multiplication
+ in JIT code on x86-64.
+
+ * assembler/MacroAssembler.h:
+ (JSC::MacroAssembler::mul32):
+ (JSC::MacroAssembler::sub32):
+ (JSC::MacroAssembler::joMul32):
+ (JSC::MacroAssembler::joSub32):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ (JSC::JIT::privateCompileSlowCases):
+ * jit/JIT.h:
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::compileFastArith_op_add):
+ (JSC::JIT::compileFastArithSlow_op_add):
+ (JSC::JIT::compileFastArith_op_mul):
+ (JSC::JIT::compileFastArithSlow_op_mul):
+ (JSC::JIT::compileFastArith_op_sub):
+ (JSC::JIT::compileFastArithSlow_op_sub):
+
+2009-01-15 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ On x86-64 allow JSImmediate to encode 64-bit double precision values.
+ This patch only affects builds that set USE(ALTERNATE_JSIMMEDIATE).
+ Updates the implementation of JSValuePtr:: and JSImmediate:: methods
+ that operate on neumeric values to be be aware of the new representation.
+ When this representation is in use, the class JSNumberCell is redundant
+ and is compiled out.
+
+ The format of the new immediate representation is documented in JSImmediate.h.
+
+ * JavaScriptCore.exp:
+ * assembler/MacroAssembler.h:
+ (JSC::MacroAssembler::subPtr):
+ * assembler/X86Assembler.h:
+ (JSC::X86Assembler::):
+ (JSC::X86Assembler::subq_rr):
+ (JSC::X86Assembler::movq_rr):
+ (JSC::X86Assembler::ucomisd_rr):
+ (JSC::X86Assembler::X86InstructionFormatter::twoByteOp64):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::cti_op_stricteq):
+ (JSC::Interpreter::cti_op_nstricteq):
+ * jit/JIT.cpp:
+ (JSC::JIT::compileOpStrictEq):
+ (JSC::JIT::privateCompileMainPass):
+ (JSC::JIT::privateCompileSlowCases):
+ * jit/JIT.h:
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::compileFastArith_op_lshift):
+ (JSC::JIT::compileFastArith_op_rshift):
+ (JSC::JIT::compileFastArith_op_bitand):
+ (JSC::JIT::compileFastArith_op_mod):
+ (JSC::JIT::compileFastArith_op_add):
+ (JSC::JIT::compileFastArith_op_mul):
+ (JSC::JIT::compileFastArith_op_post_inc):
+ (JSC::JIT::compileFastArith_op_post_dec):
+ (JSC::JIT::compileFastArith_op_pre_inc):
+ (JSC::JIT::compileFastArith_op_pre_dec):
+ (JSC::JIT::putDoubleResultToJSNumberCellOrJSImmediate):
+ (JSC::JIT::compileBinaryArithOp):
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::emitJumpIfBothJSCells):
+ (JSC::JIT::emitJumpIfEitherNumber):
+ (JSC::JIT::emitJumpIfNotEitherNumber):
+ (JSC::JIT::emitJumpIfImmediateIntegerNumber):
+ (JSC::JIT::emitJumpIfNotImmediateIntegerNumber):
+ (JSC::JIT::emitJumpIfNotImmediateIntegerNumbers):
+ (JSC::JIT::emitJumpSlowCaseIfNotImmediateIntegerNumber):
+ (JSC::JIT::emitJumpSlowCaseIfNotImmediateIntegerNumbers):
+ (JSC::JIT::emitFastArithDeTagImmediate):
+ (JSC::JIT::emitFastArithDeTagImmediateJumpIfZero):
+ (JSC::JIT::emitFastArithReTagImmediate):
+ (JSC::JIT::emitFastArithIntToImmNoCheck):
+ * runtime/JSCell.h:
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData):
+ * runtime/JSImmediate.cpp:
+ (JSC::JSImmediate::toThisObject):
+ (JSC::JSImmediate::toObject):
+ (JSC::JSImmediate::toString):
+ * runtime/JSImmediate.h:
+ (JSC::wtf_reinterpret_cast):
+ (JSC::JSImmediate::isNumber):
+ (JSC::JSImmediate::isIntegerNumber):
+ (JSC::JSImmediate::isDoubleNumber):
+ (JSC::JSImmediate::isPositiveIntegerNumber):
+ (JSC::JSImmediate::areBothImmediateIntegerNumbers):
+ (JSC::JSImmediate::makeInt):
+ (JSC::JSImmediate::makeDouble):
+ (JSC::JSImmediate::doubleValue):
+ (JSC::doubleToBoolean):
+ (JSC::JSImmediate::toBoolean):
+ (JSC::JSImmediate::getTruncatedUInt32):
+ (JSC::JSImmediate::makeOutOfIntegerRange):
+ (JSC::JSImmediate::from):
+ (JSC::JSImmediate::getTruncatedInt32):
+ (JSC::JSImmediate::toDouble):
+ (JSC::JSImmediate::getUInt32):
+ (JSC::JSValuePtr::isInt32Fast):
+ (JSC::JSValuePtr::isUInt32Fast):
+ (JSC::JSValuePtr::areBothInt32Fast):
+ (JSC::JSFastMath::canDoFastBitwiseOperations):
+ (JSC::JSFastMath::xorImmediateNumbers):
+ (JSC::JSFastMath::canDoFastRshift):
+ (JSC::JSFastMath::canDoFastUrshift):
+ (JSC::JSFastMath::rightShiftImmediateNumbers):
+ (JSC::JSFastMath::canDoFastAdditiveOperations):
+ (JSC::JSFastMath::addImmediateNumbers):
+ (JSC::JSFastMath::subImmediateNumbers):
+ * runtime/JSNumberCell.cpp:
+ (JSC::jsNumberCell):
+ * runtime/JSNumberCell.h:
+ (JSC::createNumberStructure):
+ (JSC::isNumberCell):
+ (JSC::asNumberCell):
+ (JSC::jsNumber):
+ (JSC::JSValuePtr::isDoubleNumber):
+ (JSC::JSValuePtr::getDoubleNumber):
+ (JSC::JSValuePtr::isNumber):
+ (JSC::JSValuePtr::uncheckedGetNumber):
+ (JSC::jsNaN):
+ (JSC::JSValuePtr::getNumber):
+ (JSC::JSValuePtr::numberToInt32):
+ (JSC::JSValuePtr::numberToUInt32):
+ * runtime/JSValue.h:
+ * runtime/NumberConstructor.cpp:
+ (JSC::numberConstructorNegInfinity):
+ (JSC::numberConstructorPosInfinity):
+ (JSC::numberConstructorMaxValue):
+ (JSC::numberConstructorMinValue):
+ * runtime/NumberObject.cpp:
+ (JSC::constructNumber):
+ * runtime/NumberObject.h:
+ * runtime/Operations.h:
+ (JSC::JSValuePtr::equal):
+ (JSC::JSValuePtr::equalSlowCaseInline):
+ (JSC::JSValuePtr::strictEqual):
+ (JSC::JSValuePtr::strictEqualSlowCaseInline):
+ * wtf/Platform.h:
+
+2009-01-15 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ <rdar://problem/6045018>
+ REGRESSION (r34838): JavaScript objects appear to be leaked after loading google.com
+
+ Subtract the number of JSStrings cached in SmallStrings when calculating the
+ number of live JSObjects.
+
+ * runtime/Collector.cpp:
+ (JSC::Heap::objectCount):
+ * runtime/SmallStrings.cpp:
+ (JSC::SmallStrings::count):
+ * runtime/SmallStrings.h:
+
+2009-01-15 Sam Weinig <sam@webkit.org>
+
+ Fix Qt build.
+
+ * runtime/Collector.cpp:
+
+2009-01-15 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Gavin Barraclough.
+
+ Fix crash seen running fast/canvas.
+
+ Make sure to mark the ScopeNode and CodeBlock being created
+ in the re-parse for exception information.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::reparseForExceptionInfoIfNecessary):
+ * parser/Nodes.h:
+ (JSC::ScopeNode::mark):
+ * runtime/Collector.cpp:
+ (JSC::Heap::collect):
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData):
+ * runtime/JSGlobalData.h:
+
+2009-01-15 Craig Schlenter <craig.schlenter@gmail.com>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=23347
+ Compilation of JavaScriptCore/wtf/ThreadingPthreads.cpp fails on Linux
+
+ * wtf/ThreadingPthreads.cpp: included limits.h as INT_MAX is defined there.
+
+2009-01-15 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Bug 23225: REGRESSION: Assertion failure in reparseInPlace() (m_sourceElements) at sfgate.com
+ <https://bugs.webkit.org/show_bug.cgi?id=23225> <rdar://problem/6487432>
+
+ Character position for open and closing brace was incorrectly referencing m_position to
+ record their position in a source document, however this is unsafe as BOMs may lead to
+ m_position being an arbitrary position from the real position of the current character.
+
+ * parser/Lexer.cpp:
+ (JSC::Lexer::matchPunctuator):
+
+2009-01-14 David Kilzer <ddkilzer@apple.com>
+
+ Bug 23153: JSC build always touches JavaScriptCore/docs/bytecode.html
+
+ <https://bugs.webkit.org/show_bug.cgi?id=23153>
+
+ Reviewed by Darin Adler.
+
+ Instead of building bytecode.html into ${SRCROOT}/docs/bytecode.html, build it
+ into ${BUILT_PRODUCTS_DIR}/DerivedSources/JavaScriptCore/docs/bytecode.html.
+
+ Also fixes make-bytecode-docs.pl to actually generate documentation.
+
+ * DerivedSources.make: Changed bytecode.html to be built into local docs
+ directory in ${BUILT_PRODUCTS_DIR}/DerivedSources/JavaScriptCore.
+ * JavaScriptCore.xcodeproj/project.pbxproj: Added "/docs" to the end of the
+ "mkdir -p" command so that the docs subdirectory is automatically created.
+ * docs/make-bytecode-docs.pl: Changed BEGIN_OPCODE to DEFINE_OPCODE so that
+ documentation is actually generated.
+
+2009-01-14 Adam Treat <adam.treat@torchmobile.com>
+
+ Build fix for Qt from Dmitry Titov.
+
+ * wtf/ThreadingQt.cpp:
+ (WTF::ThreadCondition::timedWait):
+
+2009-01-14 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ Bug 22903: REGRESSION (r36267): visiting this site reliably crashes WebKit nightly
+
+ EvalCodeBlock's do not reference the functions that are declared inside the eval
+ code, this means that simply marking the EvalCodeBlock through the global object
+ is insufficient to mark the declared functions. This patch corrects this by
+ explicitly marking the CodeBlocks of all the functions declared in the cached
+ EvalNode.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::mark):
+ * bytecode/CodeBlock.h:
+ (JSC::CodeBlock::hasFunctions):
+ * bytecode/EvalCodeCache.h:
+ (JSC::EvalCodeCache::mark):
+ * parser/Nodes.cpp:
+ (JSC::ScopeNodeData::mark):
+ (JSC::EvalNode::mark):
+ * parser/Nodes.h:
+
+2009-01-14 Dmitry Titov <dimich@chromium.org>
+
+ Reviewed by Alexey Proskuryakov.
+
+ https://bugs.webkit.org/show_bug.cgi?id=23312
+ Implement MessageQueue::waitForMessageTimed()
+ Also fixed ThreadCondition::timedWait() to take absolute time, as discussed on webkit-dev.
+ Win32 version of timedWait still has to be implemented.
+
+ * wtf/MessageQueue.h:
+ (WTF::MessageQueueWaitResult: new enum for the result of MessageQueue::waitForMessageTimed.
+ (WTF::MessageQueue::waitForMessage):
+ (WTF::MessageQueue::waitForMessageTimed): New method.
+ * wtf/Threading.h:
+ * wtf/ThreadingGtk.cpp:
+ (WTF::ThreadCondition::timedWait): changed to use absolute time instead of interval.
+ * wtf/ThreadingNone.cpp:
+ (WTF::ThreadCondition::timedWait): ditto.
+ * wtf/ThreadingPthreads.cpp:
+ (WTF::ThreadCondition::timedWait): ditto.
+ * wtf/ThreadingQt.cpp:
+ (WTF::ThreadCondition::timedWait): ditto.
+ * wtf/ThreadingWin.cpp:
+ (WTF::ThreadCondition::timedWait): ditto. The actual Win32 code is still to be implemented.
+
+2009-01-14 Dean McNamee <deanm@chromium.org>
+
+ Reviewed by Darin Adler and Oliver hunt.
+
+ Correctly match allocation functions by implementing a custom deref().
+
+ https://bugs.webkit.org/show_bug.cgi?id=23315
+
+ * runtime/ByteArray.h:
+ (JSC::ByteArray::deref):
+ (JSC::ByteArray::ByteArray):
+
+2009-01-14 Dan Bernstein <mitz@apple.com>
+
+ Reviewed by John Sullivan.
+
+ - update copyright
+
+ * Info.plist:
+
+2009-01-13 Beth Dakin <bdakin@apple.com>
+
+ Reviewed by Darin Adler and Oliver Hunt.
+
+ <rdar://problem/6489314> REGRESSION: Business widget's front side
+ fails to render correctly when flipping widget
+
+ The problem here is that parseInt was parsing NaN as 0. This patch
+ corrects that by parsing NaN as NaN. This matches our old behavior
+ and Firefox.
+
+ * runtime/JSGlobalObjectFunctions.cpp:
+ (JSC::globalFuncParseInt):
+
+2009-01-13 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Fix for: https://bugs.webkit.org/show_bug.cgi?id=23292
+
+ Implementation of two argument canDoFastAdditiveOperations does not correlate well with reality.
+
+ * runtime/JSImmediate.h:
+ (JSC::JSFastMath::canDoFastAdditiveOperations):
+
+2009-01-13 Zalan Bujtas <zbujtas@gmail.com>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=23290
+ Fix JSImmediate::isImmediate(src) to !src->isCell()
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+
+2009-01-13 Dmitry Titov <dimich@chromium.org>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=23281
+ Fix the Chromium Win build.
+ Need to use PLATFORM(WIN_OS) instead of PLATFORM(WIN).
+ Moved GTK and WX up in #if sequence because they could come with WIN_OS too,
+ while they have their own implementation even on Windows.
+
+ * wtf/CurrentTime.cpp:
+ (WTF::currentTime):
+
+2009-01-12 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Make the JSImmediate interface private.
+
+ All manipulation of JS values should be through the JSValuePtr class, not by using JSImmediate
+ directly. The key missing methods on JSValuePtr are:
+
+ * isCell() - check for values that are JSCell*s, and as such where asCell() may be used.
+ * isInt32Fast() getInt32Fast() - fast check/access for integer immediates.
+ * isUInt32Fast() getUInt32Fast() - ditto for unsigned integer immediates.
+
+ The JIT is allowed full access to JSImmediate, since it needs to be able to directly
+ manipulate JSValuePtrs. The Interpreter is provided access to perform operations directly
+ on JSValuePtrs through the new JSFastMath interface.
+
+ No performance impact.
+
+ * API/JSCallbackObjectFunctions.h:
+ (JSC::::toNumber):
+ * API/JSValueRef.cpp:
+ (JSValueIsEqual):
+ (JSValueIsStrictEqual):
+ * JavaScriptCore.exp:
+ * bytecode/CodeBlock.h:
+ (JSC::CodeBlock::isKnownNotImmediate):
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::keyForImmediateSwitch):
+ * bytecompiler/BytecodeGenerator.h:
+ (JSC::BytecodeGenerator::JSValueHashTraits::constructDeletedValue):
+ (JSC::BytecodeGenerator::JSValueHashTraits::isDeletedValue):
+ * interpreter/Interpreter.cpp:
+ (JSC::jsLess):
+ (JSC::jsLessEq):
+ (JSC::jsAdd):
+ (JSC::jsIsObjectType):
+ (JSC::cachePrototypeChain):
+ (JSC::Interpreter::tryCachePutByID):
+ (JSC::Interpreter::tryCacheGetByID):
+ (JSC::Interpreter::privateExecute):
+ (JSC::Interpreter::tryCTICachePutByID):
+ (JSC::Interpreter::tryCTICacheGetByID):
+ (JSC::Interpreter::cti_op_add):
+ (JSC::Interpreter::cti_op_get_by_id_self_fail):
+ (JSC::Interpreter::cti_op_get_by_id_proto_list):
+ (JSC::Interpreter::cti_op_instanceof):
+ (JSC::Interpreter::cti_op_mul):
+ (JSC::Interpreter::cti_op_get_by_val):
+ (JSC::Interpreter::cti_op_get_by_val_byte_array):
+ (JSC::Interpreter::cti_op_sub):
+ (JSC::Interpreter::cti_op_put_by_val):
+ (JSC::Interpreter::cti_op_put_by_val_array):
+ (JSC::Interpreter::cti_op_put_by_val_byte_array):
+ (JSC::Interpreter::cti_op_negate):
+ (JSC::Interpreter::cti_op_div):
+ (JSC::Interpreter::cti_op_eq):
+ (JSC::Interpreter::cti_op_lshift):
+ (JSC::Interpreter::cti_op_bitand):
+ (JSC::Interpreter::cti_op_rshift):
+ (JSC::Interpreter::cti_op_bitnot):
+ (JSC::Interpreter::cti_op_neq):
+ (JSC::Interpreter::cti_op_urshift):
+ (JSC::Interpreter::cti_op_call_eval):
+ (JSC::Interpreter::cti_op_throw):
+ (JSC::Interpreter::cti_op_is_undefined):
+ (JSC::Interpreter::cti_op_stricteq):
+ (JSC::Interpreter::cti_op_nstricteq):
+ (JSC::Interpreter::cti_op_switch_imm):
+ (JSC::Interpreter::cti_vm_throw):
+ * interpreter/Interpreter.h:
+ (JSC::Interpreter::isJSArray):
+ (JSC::Interpreter::isJSString):
+ (JSC::Interpreter::isJSByteArray):
+ * jit/JIT.cpp:
+ (JSC::JIT::compileOpStrictEq):
+ (JSC::JIT::privateCompileMainPass):
+ * jit/JIT.h:
+ (JSC::JIT::isStrictEqCaseHandledInJITCode):
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::compileFastArith_op_rshift):
+ (JSC::JIT::compileFastArith_op_bitand):
+ (JSC::JIT::compileFastArith_op_mod):
+ * jit/JITCall.cpp:
+ (JSC::JIT::unlinkCall):
+ (JSC::JIT::compileOpCall):
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::getConstantOperandImmediateInt):
+ (JSC::JIT::isOperandConstantImmediateInt):
+ * parser/Nodes.cpp:
+ (JSC::processClauseList):
+ * runtime/ArrayPrototype.cpp:
+ (JSC::arrayProtoFuncIndexOf):
+ (JSC::arrayProtoFuncLastIndexOf):
+ * runtime/BooleanPrototype.cpp:
+ (JSC::booleanProtoFuncValueOf):
+ * runtime/Collector.cpp:
+ (JSC::Heap::protect):
+ (JSC::Heap::unprotect):
+ (JSC::Heap::heap):
+ * runtime/JSByteArray.cpp:
+ (JSC::JSByteArray::getOwnPropertySlot):
+ * runtime/JSByteArray.h:
+ (JSC::JSByteArray::getIndex):
+ * runtime/JSCell.cpp:
+ * runtime/JSCell.h:
+ (JSC::JSValuePtr::isNumberCell):
+ (JSC::JSValuePtr::asCell):
+ (JSC::JSValuePtr::isNumber):
+ * runtime/JSGlobalObjectFunctions.cpp:
+ (JSC::globalFuncParseInt):
+ * runtime/JSImmediate.h:
+ (JSC::js0):
+ (JSC::jsImpossibleValue):
+ (JSC::JSValuePtr::toInt32):
+ (JSC::JSValuePtr::toUInt32):
+ (JSC::JSValuePtr::isCell):
+ (JSC::JSValuePtr::isInt32Fast):
+ (JSC::JSValuePtr::getInt32Fast):
+ (JSC::JSValuePtr::isUInt32Fast):
+ (JSC::JSValuePtr::getUInt32Fast):
+ (JSC::JSValuePtr::makeInt32Fast):
+ (JSC::JSValuePtr::areBothInt32Fast):
+ (JSC::JSFastMath::canDoFastBitwiseOperations):
+ (JSC::JSFastMath::equal):
+ (JSC::JSFastMath::notEqual):
+ (JSC::JSFastMath::andImmediateNumbers):
+ (JSC::JSFastMath::xorImmediateNumbers):
+ (JSC::JSFastMath::orImmediateNumbers):
+ (JSC::JSFastMath::canDoFastRshift):
+ (JSC::JSFastMath::canDoFastUrshift):
+ (JSC::JSFastMath::rightShiftImmediateNumbers):
+ (JSC::JSFastMath::canDoFastAdditiveOperations):
+ (JSC::JSFastMath::addImmediateNumbers):
+ (JSC::JSFastMath::subImmediateNumbers):
+ (JSC::JSFastMath::incImmediateNumber):
+ (JSC::JSFastMath::decImmediateNumber):
+ * runtime/JSNumberCell.h:
+ (JSC::JSValuePtr::asNumberCell):
+ (JSC::jsNumber):
+ (JSC::JSValuePtr::uncheckedGetNumber):
+ (JSC::JSNumberCell::toInt32):
+ (JSC::JSNumberCell::toUInt32):
+ (JSC::JSValuePtr::toJSNumber):
+ (JSC::JSValuePtr::getNumber):
+ (JSC::JSValuePtr::numberToInt32):
+ (JSC::JSValuePtr::numberToUInt32):
+ * runtime/JSObject.h:
+ (JSC::JSValuePtr::isObject):
+ (JSC::JSValuePtr::get):
+ (JSC::JSValuePtr::put):
+ * runtime/JSValue.cpp:
+ (JSC::JSValuePtr::toInteger):
+ (JSC::JSValuePtr::toIntegerPreserveNaN):
+ * runtime/JSValue.h:
+ * runtime/Operations.cpp:
+ (JSC::JSValuePtr::equalSlowCase):
+ (JSC::JSValuePtr::strictEqualSlowCase):
+ * runtime/Operations.h:
+ (JSC::JSValuePtr::equal):
+ (JSC::JSValuePtr::equalSlowCaseInline):
+ (JSC::JSValuePtr::strictEqual):
+ (JSC::JSValuePtr::strictEqualSlowCaseInline):
+ * runtime/Protect.h:
+ (JSC::gcProtect):
+ (JSC::gcUnprotect):
+ * runtime/StringPrototype.cpp:
+ (JSC::stringProtoFuncCharAt):
+ (JSC::stringProtoFuncCharCodeAt):
+ * runtime/Structure.cpp:
+ (JSC::Structure::createCachedPrototypeChain):
+
+2009-01-12 Kevin Ollivier <kevino@theolliviers.com>
+
+ Since date time functions have moved here, now the wx port JSC
+ needs to depend on wx.
+
+ * jscore.bkl:
+
+2009-01-11 David Levin <levin@chromium.org>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=23245
+
+ Add initializeThreading to key places in JS API to ensure that
+ UString is properly initialized.
+
+ * API/JSContextRef.cpp:
+ (JSContextGroupCreate):
+ (JSGlobalContextCreate):
+ * API/JSObjectRef.cpp:
+ (JSClassCreate):
+ * API/JSStringRef.cpp:
+ (JSStringCreateWithCharacters):
+ (JSStringCreateWithUTF8CString):
+ * API/JSStringRefCF.cpp:
+ (JSStringCreateWithCFString):
+
+2009-01-11 David Levin <levin@chromium.org>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=23175
+
+ Separate out BaseString information from UString::Rep and make all baseString access go through
+ a member function, so that it may be used for something else (in the future) in the BaseString
+ case.
+
+ * runtime/SmallStrings.cpp:
+ (JSC::SmallStringsStorage::rep):
+ (JSC::SmallStringsStorage::SmallStringsStorage):
+ (JSC::SmallStrings::SmallStrings):
+ (JSC::SmallStrings::mark):
+ Adjust to account for the changes in UString and put the UString in place in
+ SmallStringsStorage to aid in locality of reference among the UChar[] and UString::Rep's.
+
+ * runtime/SmallStrings.h:
+ * runtime/UString.cpp:
+ (JSC::initializeStaticBaseString):
+ (JSC::initializeUString):
+ (JSC::UString::Rep::create):
+ (JSC::UString::Rep::destroy):
+ (JSC::UString::Rep::checkConsistency):
+ (JSC::expandCapacity):
+ (JSC::UString::expandPreCapacity):
+ (JSC::concatenate):
+ (JSC::UString::append):
+ (JSC::UString::operator=):
+ * runtime/UString.h:
+ (JSC::UString::Rep::baseIsSelf):
+ (JSC::UString::Rep::setBaseString):
+ (JSC::UString::Rep::baseString):
+ (JSC::UString::Rep::):
+ (JSC::UString::Rep::null):
+ (JSC::UString::Rep::empty):
+ (JSC::UString::Rep::data):
+ (JSC::UString::cost):
+ Separate out the items out used by base strings from those used in Rep's that only
+ point to base strings. (This potentially saves 24 bytes per Rep.)
+
+2009-01-11 Darin Adler <darin@apple.com>
+
+ Reviewed by Dan Bernstein.
+
+ Bug 23239: improve handling of unused arguments in JavaScriptCore
+ https://bugs.webkit.org/show_bug.cgi?id=23239
+
+ * runtime/DatePrototype.cpp: Moved LocaleDateTimeFormat enum outside #if
+ so we can use this on all platforms. Changed valueOf to share the same
+ function with getTime, since the contents of the two are identical. Removed
+ a FIXME since the idea isn't really specific enough or helpful enough to
+ need to sit here in the source code.
+ (JSC::formatLocaleDate): Changed the Mac version of this function to take
+ the same arguments as the non-Mac version so the caller doesn't have to
+ special-case the two platforms. Also made the formatString array be const;
+ before the characters were, but the array was a modifiable global variable.
+ (JSC::dateProtoFuncToLocaleString): Changed to call the new unified
+ version of formatLocaleDate and remove the ifdef.
+ (JSC::dateProtoFuncToLocaleDateString): Ditto.
+ (JSC::dateProtoFuncToLocaleTimeString): Ditto.
+
+ * runtime/JSNotAnObject.cpp:
+ (JSC::JSNotAnObject::toObject): Use the new ASSERT_UNUSED instead of the
+ old UNUSED_PARAM.
+
+ * runtime/RegExp.cpp:
+ (JSC::RegExp::RegExp): Changed to only use UNUSED_PARAM when the parameter
+ is actually unused.
+
+ * wtf/TCSystemAlloc.cpp:
+ (TCMalloc_SystemRelease): Changed to only use UNUSED_PARAM when the parameter
+ is actually unused.
+ (TCMalloc_SystemCommit): Changed to omit the argument names instead of using
+ UNUSED_PARAM.
+
+2009-01-11 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by NOBODY (Build fix).
+
+ Fix the build (whoops)
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::cti_op_get_by_val):
+
+2009-01-11 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Darin Adler and Anders Carlsson
+
+ Bug 23128: get/put_by_val need to respecialise in the face of ByteArray
+
+ Restructure the code slightly, and add comments per Darin's suggestions
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::cti_op_get_by_val):
+ (JSC::Interpreter::cti_op_get_by_val_byte_array):
+ (JSC::Interpreter::cti_op_put_by_val):
+ (JSC::Interpreter::cti_op_put_by_val_byte_array):
+
+2009-01-11 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Anders Carlsson.
+
+ Whoops, I accidentally removed an exception check from fast the
+ fast path for string indexing when i originally landed the
+ byte array logic.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::cti_op_get_by_val):
+
+2009-01-11 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Anders Carlsson.
+
+ Bug 23128: get/put_by_val need to respecialise in the face of ByteArray
+ <https://bugs.webkit.org/show_bug.cgi?id=23128>
+
+ Fairly simple patch, add specialised versions of cti_op_get/put_by_val
+ that assume ByteArray, thus avoiding a few branches in the case of bytearray
+ manipulation.
+
+ No effect on SunSpider. 15% win on the original testcase.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::cti_op_get_by_val):
+ (JSC::Interpreter::cti_op_get_by_val_byte_array):
+ (JSC::Interpreter::cti_op_put_by_val):
+ (JSC::Interpreter::cti_op_put_by_val_byte_array):
+ * interpreter/Interpreter.h:
+
+2009-01-11 Alexey Proskuryakov <ap@webkit.org>
+
+ Try to fix Windows build.
+
+ * wtf/CurrentTime.cpp: Added a definition of msPerSecond (previously, this code was in
+ DateMath.cpp, with constant definition in DateTime.h)
+
+2009-01-11 Alexey Proskuryakov <ap@webkit.org>
+
+ Try to fix Windows build.
+
+ * wtf/CurrentTime.cpp: Include <sys/types.h> and <sys/timeb.h>, as MSDN says to.
+
+2009-01-11 Dmitry Titov <dimich@chromium.org>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=23207
+ Moved currentTime() to from WebCore to WTF.
+
+ * GNUmakefile.am:
+ * JavaScriptCore.exp: added export for WTF::currentTime()
+ * JavaScriptCore.pri:
+ * JavaScriptCore.scons:
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * JavaScriptCoreSources.bkl:
+ * runtime/DateMath.cpp:
+ (JSC::getCurrentUTCTimeWithMicroseconds): This function had another implementation of currentTime(), essentially. Now uses WTF version.
+ * wtf/CurrentTime.cpp: Added.
+ (WTF::currentTime):
+ (WTF::highResUpTime):
+ (WTF::lowResUTCTime):
+ (WTF::qpcAvailable):
+ * wtf/CurrentTime.h: Added.
+
+2009-01-09 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Stage two of converting JSValue from a pointer to a class type.
+ Remove the class JSValue. The functionallity has been transitioned
+ into the wrapper class type JSValuePtr.
+
+ The last stage will be to rename JSValuePtr to JSValue, remove the
+ overloaded -> operator, and switch operations on JSValuePtrs from
+ using '->' to use '.' instead.
+
+ * API/APICast.h:
+ * JavaScriptCore.exp:
+ * runtime/JSCell.h:
+ (JSC::asCell):
+ (JSC::JSValuePtr::asCell):
+ (JSC::JSValuePtr::isNumber):
+ (JSC::JSValuePtr::isString):
+ (JSC::JSValuePtr::isGetterSetter):
+ (JSC::JSValuePtr::isObject):
+ (JSC::JSValuePtr::getNumber):
+ (JSC::JSValuePtr::getString):
+ (JSC::JSValuePtr::getObject):
+ (JSC::JSValuePtr::getCallData):
+ (JSC::JSValuePtr::getConstructData):
+ (JSC::JSValuePtr::getUInt32):
+ (JSC::JSValuePtr::getTruncatedInt32):
+ (JSC::JSValuePtr::getTruncatedUInt32):
+ (JSC::JSValuePtr::mark):
+ (JSC::JSValuePtr::marked):
+ (JSC::JSValuePtr::toPrimitive):
+ (JSC::JSValuePtr::getPrimitiveNumber):
+ (JSC::JSValuePtr::toBoolean):
+ (JSC::JSValuePtr::toNumber):
+ (JSC::JSValuePtr::toString):
+ (JSC::JSValuePtr::toObject):
+ (JSC::JSValuePtr::toThisObject):
+ (JSC::JSValuePtr::needsThisConversion):
+ (JSC::JSValuePtr::toThisString):
+ (JSC::JSValuePtr::getJSNumber):
+ * runtime/JSImmediate.h:
+ (JSC::JSValuePtr::isUndefined):
+ (JSC::JSValuePtr::isNull):
+ (JSC::JSValuePtr::isUndefinedOrNull):
+ (JSC::JSValuePtr::isBoolean):
+ (JSC::JSValuePtr::getBoolean):
+ (JSC::JSValuePtr::toInt32):
+ (JSC::JSValuePtr::toUInt32):
+ * runtime/JSNumberCell.h:
+ (JSC::JSValuePtr::uncheckedGetNumber):
+ (JSC::JSValuePtr::toJSNumber):
+ * runtime/JSObject.h:
+ (JSC::JSValuePtr::isObject):
+ (JSC::JSValuePtr::get):
+ (JSC::JSValuePtr::put):
+ * runtime/JSString.h:
+ (JSC::JSValuePtr::toThisJSString):
+ * runtime/JSValue.cpp:
+ (JSC::JSValuePtr::toInteger):
+ (JSC::JSValuePtr::toIntegerPreserveNaN):
+ (JSC::JSValuePtr::toInt32SlowCase):
+ (JSC::JSValuePtr::toUInt32SlowCase):
+ * runtime/JSValue.h:
+ (JSC::JSValuePtr::makeImmediate):
+ (JSC::JSValuePtr::immediateValue):
+ (JSC::JSValuePtr::JSValuePtr):
+ (JSC::JSValuePtr::operator->):
+ (JSC::JSValuePtr::operator bool):
+ (JSC::JSValuePtr::operator==):
+ (JSC::JSValuePtr::operator!=):
+ (JSC::JSValuePtr::encode):
+ (JSC::JSValuePtr::decode):
+ (JSC::JSValuePtr::toFloat):
+ (JSC::JSValuePtr::asValue):
+ (JSC::operator==):
+ (JSC::operator!=):
+
+2009-01-09 David Levin <levin@chromium.org>
+
+ Reviewed by Oliver Hunt.
+
+ https://bugs.webkit.org/show_bug.cgi?id=23175
+
+ Adjustment to previous patch. Remove call to initilizeThreading from JSGlobalCreate
+ and fix jsc.cpp instead.
+
+ * jsc.cpp:
+ (main):
+ (jscmain):
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::create):
+
+2009-01-09 Sam Weinig <sam@webkit.org>
+
+ Roll r39720 back in with a working interpreted mode.
+
+2009-01-09 David Levin <levin@chromium.org>
+
+ Reviewed by Oliver Hunt.
+
+ https://bugs.webkit.org/show_bug.cgi?id=23175
+
+ Added a template to make the pointer and flags combination
+ in UString more readable and less error prone.
+
+ * GNUmakefile.am:
+ * JavaScriptCore.exp:
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ Added PtrAndFlags.h (and sorted the xcode project file).
+
+ * runtime/Identifier.cpp:
+ (JSC::Identifier::add):
+ (JSC::Identifier::addSlowCase):
+ * runtime/InitializeThreading.cpp:
+ (JSC::initializeThreadingOnce):
+ Made the init threading initialize the UString globals. Before
+ these were initilized using {} but that became harder due to the
+ addition of this tempalte class.
+
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::create):
+ * runtime/PropertyNameArray.cpp:
+ (JSC::PropertyNameArray::add):
+ * runtime/UString.cpp:
+ (JSC::initializeStaticBaseString):
+ (JSC::initializeUString):
+ (JSC::UString::Rep::create):
+ (JSC::UString::Rep::createFromUTF8):
+ (JSC::createRep):
+ (JSC::UString::UString):
+ (JSC::concatenate):
+ (JSC::UString::operator=):
+ (JSC::UString::makeNull):
+ (JSC::UString::nullRep):
+ * runtime/UString.h:
+ (JSC::UString::Rep::identifierTable):
+ (JSC::UString::Rep::setIdentifierTable):
+ (JSC::UString::Rep::isStatic):
+ (JSC::UString::Rep::setStatic):
+ (JSC::UString::Rep::):
+ (JSC::UString::Rep::null):
+ (JSC::UString::Rep::empty):
+ (JSC::UString::isNull):
+ (JSC::UString::null):
+ (JSC::UString::UString):
+
+ * wtf/PtrAndFlags.h: Added.
+ (WTF::PtrAndFlags::PtrAndFlags):
+ (WTF::PtrAndFlags::isFlagSet):
+ (WTF::PtrAndFlags::setFlag):
+ (WTF::PtrAndFlags::clearFlag):
+ (WTF::PtrAndFlags::get):
+ (WTF::PtrAndFlags::set):
+ A simple way to layer together a pointer and 2 flags. It relies on the pointer being 4 byte aligned,
+ which should happen for all allocators (due to aligning pointers, int's, etc. on 4 byte boundaries).
+
+2009-01-08 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by -O-l-i-v-e-r- -H-u-n-t- Sam Weinig (sorry, Sam!).
+
+ Encode immediates in the low word of JSValuePtrs, on x86-64.
+
+ On 32-bit platforms a JSValuePtr may represent a 31-bit signed integer.
+ On 64-bit platforms, if USE(ALTERNATE_JSIMMEDIATE) is defined, a full
+ 32-bit integer may be stored in an immediate.
+
+ Presently USE(ALTERNATE_JSIMMEDIATE) uses the same encoding as the default
+ immediate format - the value is left shifted by one, so a one bit tag can
+ be added to indicate the value is an immediate. However this means that
+ values must be commonly be detagged (by right shifting by one) before
+ arithmetic operations can be performed on immediates. This patch modifies
+ the formattting so the the high bits of the immediate mark values as being
+ integer.
+
+ * assembler/MacroAssembler.h:
+ (JSC::MacroAssembler::not32):
+ (JSC::MacroAssembler::orPtr):
+ (JSC::MacroAssembler::zeroExtend32ToPtr):
+ (JSC::MacroAssembler::jaePtr):
+ (JSC::MacroAssembler::jbPtr):
+ (JSC::MacroAssembler::jnzPtr):
+ (JSC::MacroAssembler::jzPtr):
+ * assembler/X86Assembler.h:
+ (JSC::X86Assembler::):
+ (JSC::X86Assembler::notl_r):
+ (JSC::X86Assembler::testq_i32r):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ (JSC::JIT::privateCompileSlowCases):
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ * jit/JIT.h:
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::compileFastArith_op_lshift):
+ (JSC::JIT::compileFastArith_op_rshift):
+ (JSC::JIT::compileFastArith_op_bitand):
+ (JSC::JIT::compileFastArithSlow_op_bitand):
+ (JSC::JIT::compileFastArith_op_mod):
+ (JSC::JIT::compileFastArithSlow_op_mod):
+ (JSC::JIT::compileFastArith_op_add):
+ (JSC::JIT::compileFastArith_op_mul):
+ (JSC::JIT::compileFastArith_op_post_inc):
+ (JSC::JIT::compileFastArith_op_post_dec):
+ (JSC::JIT::compileFastArith_op_pre_inc):
+ (JSC::JIT::compileFastArith_op_pre_dec):
+ (JSC::JIT::putDoubleResultToJSNumberCellOrJSImmediate):
+ (JSC::JIT::compileBinaryArithOp):
+ * jit/JITCall.cpp:
+ (JSC::JIT::compileOpCallSlowCase):
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::emitJumpIfJSCell):
+ (JSC::JIT::emitJumpIfNotJSCell):
+ (JSC::JIT::emitJumpIfImmNum):
+ (JSC::JIT::emitJumpSlowCaseIfNotImmNum):
+ (JSC::JIT::emitJumpSlowCaseIfNotImmNums):
+ (JSC::JIT::emitFastArithDeTagImmediate):
+ (JSC::JIT::emitFastArithDeTagImmediateJumpIfZero):
+ (JSC::JIT::emitFastArithReTagImmediate):
+ (JSC::JIT::emitFastArithImmToInt):
+ (JSC::JIT::emitFastArithIntToImmNoCheck):
+ (JSC::JIT::emitTagAsBoolImmediate):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::resizePropertyStorage):
+ (JSC::JIT::privateCompilePutByIdTransition):
+ (JSC::JIT::privateCompilePatchGetArrayLength):
+ (JSC::JIT::privateCompileGetByIdSelf):
+ (JSC::JIT::privateCompileGetByIdProto):
+ (JSC::JIT::privateCompileGetByIdChain):
+ (JSC::JIT::privateCompilePutByIdReplace):
+ * runtime/JSImmediate.h:
+ (JSC::JSImmediate::isNumber):
+ (JSC::JSImmediate::isPositiveNumber):
+ (JSC::JSImmediate::areBothImmediateNumbers):
+ (JSC::JSImmediate::xorImmediateNumbers):
+ (JSC::JSImmediate::rightShiftImmediateNumbers):
+ (JSC::JSImmediate::canDoFastAdditiveOperations):
+ (JSC::JSImmediate::addImmediateNumbers):
+ (JSC::JSImmediate::subImmediateNumbers):
+ (JSC::JSImmediate::makeInt):
+ (JSC::JSImmediate::toBoolean):
+ * wtf/Platform.h:
+
+2009-01-08 Sam Weinig <sam@webkit.org>
+
+ Revert r39720. It broke Interpreted mode.
+
+2009-01-08 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Oliver Hunt.
+
+ Fix for https://bugs.webkit.org/show_bug.cgi?id=23197
+ Delay creating the PCVector until an exception is thrown
+ Part of <rdar://problem/6469060>
+ Don't store exception information for a CodeBlock until first exception is thrown
+
+ - Change the process for re-parsing/re-generating bytecode for exception information
+ to use data from the original CodeBlock (offsets of GlobalResolve instructions) to
+ aid in creating an identical instruction stream on re-parse, instead of padding
+ interchangeable opcodes, which would result in different JITed code.
+ - Fix bug where the wrong ScopeChainNode was used when re-parsing/regenerating from
+ within some odd modified scope chains.
+ - Lazily create the pcVector by re-JITing the regenerated CodeBlock and stealing the
+ the pcVector from it.
+
+ Saves ~2MB on Membuster head.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::dump):
+ (JSC::CodeBlock::reparseForExceptionInfoIfNecessary):
+ (JSC::CodeBlock::hasGlobalResolveInstructionAtBytecodeOffset):
+ (JSC::CodeBlock::hasGlobalResolveInfoAtBytecodeOffset):
+ * bytecode/CodeBlock.h:
+ (JSC::JITCodeRef::JITCodeRef):
+ (JSC::GlobalResolveInfo::GlobalResolveInfo):
+ (JSC::CodeBlock::getBytecodeIndex):
+ (JSC::CodeBlock::addGlobalResolveInstruction):
+ (JSC::CodeBlock::addGlobalResolveInfo):
+ (JSC::CodeBlock::addFunctionRegisterInfo):
+ (JSC::CodeBlock::hasExceptionInfo):
+ (JSC::CodeBlock::pcVector):
+ (JSC::EvalCodeBlock::EvalCodeBlock):
+ (JSC::EvalCodeBlock::baseScopeDepth):
+ * bytecode/Opcode.h:
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::BytecodeGenerator):
+ (JSC::BytecodeGenerator::emitResolve):
+ (JSC::BytecodeGenerator::emitGetScopedVar):
+ * bytecompiler/BytecodeGenerator.h:
+ (JSC::BytecodeGenerator::setRegeneratingForExceptionInfo):
+ * interpreter/Interpreter.cpp:
+ (JSC::bytecodeOffsetForPC):
+ (JSC::Interpreter::unwindCallFrame):
+ (JSC::Interpreter::privateExecute):
+ (JSC::Interpreter::retrieveLastCaller):
+ (JSC::Interpreter::cti_op_instanceof):
+ (JSC::Interpreter::cti_op_call_NotJSFunction):
+ (JSC::Interpreter::cti_op_resolve):
+ (JSC::Interpreter::cti_op_construct_NotJSConstruct):
+ (JSC::Interpreter::cti_op_resolve_func):
+ (JSC::Interpreter::cti_op_resolve_skip):
+ (JSC::Interpreter::cti_op_resolve_global):
+ (JSC::Interpreter::cti_op_resolve_with_base):
+ (JSC::Interpreter::cti_op_throw):
+ (JSC::Interpreter::cti_op_in):
+ (JSC::Interpreter::cti_vm_throw):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompile):
+ * parser/Nodes.cpp:
+ (JSC::EvalNode::generateBytecode):
+ (JSC::EvalNode::bytecodeForExceptionInfoReparse):
+ (JSC::FunctionBodyNode::bytecodeForExceptionInfoReparse):
+ * parser/Nodes.h:
+
+2009-01-08 Jian Li <jianli@chromium.org>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Add Win32 implementation of ThreadSpecific.
+ https://bugs.webkit.org/show_bug.cgi?id=22614
+
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * wtf/ThreadSpecific.h:
+ (WTF::ThreadSpecific::ThreadSpecific):
+ (WTF::ThreadSpecific::~ThreadSpecific):
+ (WTF::ThreadSpecific::get):
+ (WTF::ThreadSpecific::set):
+ (WTF::ThreadSpecific::destroy):
+ * wtf/ThreadSpecificWin.cpp: Added.
+ (WTF::ThreadSpecificThreadExit):
+ * wtf/ThreadingWin.cpp:
+ (WTF::wtfThreadEntryPoint):
+
+2009-01-08 Justin McPherson <justin.mcpherson@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Fix compilation with Qt on NetBSD.
+
+ * runtime/Collector.cpp:
+ (JSC::currentThreadStackBase): Use PLATFORM(NETBSD) to enter the
+ code path to retrieve the stack base using pthread_attr_get_np.
+ The PTHREAD_NP_H define is not used because the header file does
+ not exist on NetBSD, but the function is declared nevertheless.
+ * wtf/Platform.h: Introduce WTF_PLATFORM_NETBSD.
+
+2009-01-07 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ <rdar://problem/6469060> Don't store exception information for a CodeBlock until first exception is thrown
+
+ Don't initially store exception information (lineNumber/expressionRange/getByIdExcecptionInfo)
+ in CodeBlocks blocks. Instead, re-parse for the data on demand and cache it then.
+
+ One important change that was needed to make this work was to pad op_get_global_var with nops to
+ be the same length as op_resolve_global, since one could be replaced for the other on re-parsing,
+ and we want to keep the offsets bytecode offsets the same.
+
+ 1.3MB improvement on Membuster head.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::dump): Update op_get_global_var to account for the padding.
+ (JSC::CodeBlock::dumpStatistics): Add more statistic dumping.
+ (JSC::CodeBlock::CodeBlock): Initialize m_exceptionInfo.
+ (JSC::CodeBlock::reparseForExceptionInfoIfNecessary): Re-parses the CodeBlocks
+ associated SourceCode and steals the ExceptionInfo from it.
+ (JSC::CodeBlock::lineNumberForBytecodeOffset): Creates the exception info on demand.
+ (JSC::CodeBlock::expressionRangeForBytecodeOffset): Ditto.
+ (JSC::CodeBlock::getByIdExceptionInfoForBytecodeOffset): Ditto.
+ * bytecode/CodeBlock.h:
+ (JSC::CodeBlock::numberOfExceptionHandlers): Updated to account for m_exceptionInfo indirection.
+ (JSC::CodeBlock::addExceptionHandler): Ditto.
+ (JSC::CodeBlock::exceptionHandler): Ditto.
+ (JSC::CodeBlock::clearExceptionInfo): Ditto.
+ (JSC::CodeBlock::addExpressionInfo): Ditto.
+ (JSC::CodeBlock::addGetByIdExceptionInfo): Ditto.
+ (JSC::CodeBlock::numberOfLineInfos): Ditto.
+ (JSC::CodeBlock::addLineInfo): Ditto.
+ (JSC::CodeBlock::lastLineInfo): Ditto.
+
+ * bytecode/Opcode.h: Change length of op_get_global_var to match op_resolve_global.
+
+ * bytecode/SamplingTool.cpp:
+ (JSC::SamplingTool::dump): Add comment indicating why it is okay not to pass a CallFrame.
+
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::generate): Clear the exception info after generation for Function and Eval
+ Code when not in regenerate for exception info mode.
+ (JSC::BytecodeGenerator::BytecodeGenerator): Initialize m_regeneratingForExceptionInfo to false.
+ (JSC::BytecodeGenerator::emitGetScopedVar): Pad op_get_global_var with 2 nops.
+ * bytecompiler/BytecodeGenerator.h:
+ (JSC::BytecodeGenerator::setRegeneratingForExcpeptionInfo): Added.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::throwException): Pass the CallFrame to exception info accessors.
+ (JSC::Interpreter::privateExecute): Ditto.
+ (JSC::Interpreter::retrieveLastCaller): Ditto.
+ (JSC::Interpreter::cti_op_new_error): Ditto.
+
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass): Pass the current bytecode offset instead of hard coding the
+ line number, the stub will do the accessing if it gets called.
+
+ * parser/Nodes.cpp:
+ (JSC::ProgramNode::emitBytecode): Moved.
+ (JSC::ProgramNode::generateBytecode): Moved.
+ (JSC::EvalNode::create): Moved.
+ (JSC::EvalNode::bytecodeForExceptionInfoReparse): Added.
+ (JSC::FunctionBodyNode::generateBytecode): Rename reparse to reparseInPlace.
+ (JSC::FunctionBodyNode::bytecodeForExceptionInfoReparse): Addded.
+
+ * parser/Nodes.h:
+ (JSC::ScopeNode::features): Added getter.
+ * parser/Parser.cpp:
+ (JSC::Parser::reparseInPlace): Renamed from reparse.
+ * parser/Parser.h:
+ (JSC::Parser::reparse): Added. Re-parses the passed in Node into
+ a new Node.
+ * runtime/ExceptionHelpers.cpp:
+ (JSC::createUndefinedVariableError): Pass along CallFrame.
+ (JSC::createInvalidParamError): Ditto.
+ (JSC::createNotAConstructorError): Ditto.
+ (JSC::createNotAFunctionError): Ditto.
+ (JSC::createNotAnObjectError): Ditto.
+
+2009-01-06 Gavin Barraclough <baraclough@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Replace accidentally removed references in BytecodeGenerator, deleting these
+ will be hindering the sharing of constant numbers and strings.
+
+ The code to add a new constant (either number or string) to their respective
+ map works by attempting to add a null entry, then checking the result of the
+ add for null. The first time, this should return the null (or noValue).
+ The code checks for null (to see if this is the initial add), and then allocates
+ a new number / string object. This code relies on the result returned from
+ the add to the map being stored as a reference, such that the allocated object
+ will be stored in the map, and will be resused if the same constant is encountered
+ again. By failing to use a reference we will be leaking GC object for each
+ additional entry added to the map. As GC objects they should be clollected,
+ be we should no be allocatin them in the first place.
+
+ https://bugs.webkit.org/show_bug.cgi?id=23158
+
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::emitLoad):
+
+2009-01-06 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ <rdar://problem/6040850> JavaScript register file should use VirtualAlloc on Windows
+
+ Fairly simple, just reserve 4Mb of address space for the
+ register file, and then commit one section at a time. We
+ don't release committed memory as we drop back, but then
+ mac doesn't either so this probably not too much of a
+ problem.
+
+ * interpreter/RegisterFile.cpp:
+ (JSC::RegisterFile::~RegisterFile):
+ * interpreter/RegisterFile.h:
+ (JSC::RegisterFile::RegisterFile):
+ (JSC::RegisterFile::grow):
+
+2009-01-06 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=23142
+ ThreadGlobalData leaks seen on buildbot
+
+ * wtf/ThreadSpecific.h: (WTF::ThreadSpecific::destroy): Temporarily reset the thread
+ specific value to make getter work on Mac OS X.
+
+ * wtf/Platform.h: Touch this file again to make sure all Windows builds use the most recent
+ version of ThreadSpecific.h.
+
+2009-01-05 Gavin Barraclough <baraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Replace all uses of JSValue* with a new smart pointer type, JSValuePtr.
+
+ A JavaScript value may be a heap object or boxed primitive, represented by a
+ pointer, or may be an unboxed immediate value, such as an integer. Since a
+ value may dynamically need to contain either a pointer value or an immediate,
+ we encode immediates as pointer values (since all valid JSCell pointers are
+ allocated at alligned addesses, unaligned addresses are available to encode
+ immediates). As such all JavaScript values are represented using a JSValue*.
+
+ This implementation is encumbered by a number of constraints. It ties the
+ JSValue representation to the size of pointer on the platform, which, for
+ example, means that we currently can represent different ranges of integers
+ as immediates on x86 and x86-64. It also prevents us from overloading the
+ to-boolean conversion used to test for noValue() - effectively forcing us
+ to represent noValue() as 0. This would potentially be problematic were we
+ to wish to encode integer values differently (e.g. were we to use the v8
+ encoding, where pointers are tagged with 1 and integers with 0, then the
+ immediate integer 0 would conflict with noValue()).
+
+ This patch replaces all usage of JSValue* with a new class, JSValuePtr,
+ which encapsulates the pointer. JSValuePtr maintains the same interface as
+ JSValue*, overloading operator-> and operator bool such that previous
+ operations in the code on variables of type JSValue* are still supported.
+
+ In order to provide a ProtectPtr<> type with support for the new value
+ representation (without using the internal JSValue type directly), a new
+ ProtectJSValuePtr type has been added, equivalent to the previous type
+ ProtectPtr<JSValue>.
+
+ This patch is likely the first in a sequence of three changes. With the
+ value now encapsulated it will likely make sense to migrate the functionality
+ from JSValue into JSValuePtr, such that the internal pointer representation
+ need not be exposed. Through migrating the functionality to the wrapper
+ class the existing JSValue should be rendered redundant, and the class is
+ likely to be removed (the JSValuePtr now wrapping a pointer to a JSCell).
+ At this stage it will likely make sense to rename JSValuePtr to JSValue.
+
+ https://bugs.webkit.org/show_bug.cgi?id=23114
+
+ * API/APICast.h:
+ (toJS):
+ (toRef):
+ * API/JSBase.cpp:
+ (JSEvaluateScript):
+ * API/JSCallbackConstructor.h:
+ (JSC::JSCallbackConstructor::createStructure):
+ * API/JSCallbackFunction.cpp:
+ (JSC::JSCallbackFunction::call):
+ * API/JSCallbackFunction.h:
+ (JSC::JSCallbackFunction::createStructure):
+ * API/JSCallbackObject.h:
+ (JSC::JSCallbackObject::createStructure):
+ * API/JSCallbackObjectFunctions.h:
+ (JSC::::asCallbackObject):
+ (JSC::::put):
+ (JSC::::hasInstance):
+ (JSC::::call):
+ (JSC::::staticValueGetter):
+ (JSC::::staticFunctionGetter):
+ (JSC::::callbackGetter):
+ * API/JSContextRef.cpp:
+ * API/JSObjectRef.cpp:
+ (JSObjectMakeConstructor):
+ (JSObjectSetPrototype):
+ (JSObjectGetProperty):
+ (JSObjectSetProperty):
+ (JSObjectGetPropertyAtIndex):
+ (JSObjectSetPropertyAtIndex):
+ * API/JSValueRef.cpp:
+ (JSValueGetType):
+ (JSValueIsUndefined):
+ (JSValueIsNull):
+ (JSValueIsBoolean):
+ (JSValueIsNumber):
+ (JSValueIsString):
+ (JSValueIsObject):
+ (JSValueIsObjectOfClass):
+ (JSValueIsEqual):
+ (JSValueIsStrictEqual):
+ (JSValueIsInstanceOfConstructor):
+ (JSValueToBoolean):
+ (JSValueToNumber):
+ (JSValueToStringCopy):
+ (JSValueToObject):
+ (JSValueProtect):
+ (JSValueUnprotect):
+ * JavaScriptCore.exp:
+ * bytecode/CodeBlock.cpp:
+ (JSC::valueToSourceString):
+ (JSC::constantName):
+ (JSC::CodeBlock::dump):
+ * bytecode/CodeBlock.h:
+ (JSC::CodeBlock::getConstant):
+ (JSC::CodeBlock::addUnexpectedConstant):
+ (JSC::CodeBlock::unexpectedConstant):
+ * bytecode/EvalCodeCache.h:
+ (JSC::EvalCodeCache::get):
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::BytecodeGenerator):
+ (JSC::BytecodeGenerator::addConstant):
+ (JSC::BytecodeGenerator::addUnexpectedConstant):
+ (JSC::BytecodeGenerator::emitLoad):
+ (JSC::BytecodeGenerator::emitLoadJSV):
+ (JSC::BytecodeGenerator::emitGetScopedVar):
+ (JSC::BytecodeGenerator::emitPutScopedVar):
+ (JSC::BytecodeGenerator::emitNewError):
+ (JSC::keyForImmediateSwitch):
+ * bytecompiler/BytecodeGenerator.h:
+ (JSC::BytecodeGenerator::JSValueHashTraits::constructDeletedValue):
+ (JSC::BytecodeGenerator::JSValueHashTraits::isDeletedValue):
+ * debugger/DebuggerCallFrame.cpp:
+ (JSC::DebuggerCallFrame::evaluate):
+ * debugger/DebuggerCallFrame.h:
+ (JSC::DebuggerCallFrame::DebuggerCallFrame):
+ (JSC::DebuggerCallFrame::exception):
+ * interpreter/CallFrame.cpp:
+ (JSC::CallFrame::thisValue):
+ * interpreter/CallFrame.h:
+ (JSC::ExecState::setException):
+ (JSC::ExecState::exception):
+ (JSC::ExecState::exceptionSlot):
+ (JSC::ExecState::hadException):
+ * interpreter/Interpreter.cpp:
+ (JSC::fastIsNumber):
+ (JSC::fastToInt32):
+ (JSC::fastToUInt32):
+ (JSC::jsLess):
+ (JSC::jsLessEq):
+ (JSC::jsAddSlowCase):
+ (JSC::jsAdd):
+ (JSC::jsTypeStringForValue):
+ (JSC::jsIsObjectType):
+ (JSC::jsIsFunctionType):
+ (JSC::Interpreter::resolve):
+ (JSC::Interpreter::resolveSkip):
+ (JSC::Interpreter::resolveGlobal):
+ (JSC::inlineResolveBase):
+ (JSC::Interpreter::resolveBase):
+ (JSC::Interpreter::resolveBaseAndProperty):
+ (JSC::Interpreter::resolveBaseAndFunc):
+ (JSC::isNotObject):
+ (JSC::Interpreter::callEval):
+ (JSC::Interpreter::unwindCallFrame):
+ (JSC::Interpreter::throwException):
+ (JSC::Interpreter::execute):
+ (JSC::Interpreter::checkTimeout):
+ (JSC::Interpreter::createExceptionScope):
+ (JSC::cachePrototypeChain):
+ (JSC::Interpreter::tryCachePutByID):
+ (JSC::countPrototypeChainEntriesAndCheckForProxies):
+ (JSC::Interpreter::tryCacheGetByID):
+ (JSC::Interpreter::privateExecute):
+ (JSC::Interpreter::retrieveArguments):
+ (JSC::Interpreter::retrieveCaller):
+ (JSC::Interpreter::retrieveLastCaller):
+ (JSC::Interpreter::tryCTICachePutByID):
+ (JSC::Interpreter::tryCTICacheGetByID):
+ (JSC::returnToThrowTrampoline):
+ (JSC::Interpreter::cti_op_convert_this):
+ (JSC::Interpreter::cti_op_add):
+ (JSC::Interpreter::cti_op_pre_inc):
+ (JSC::Interpreter::cti_op_loop_if_less):
+ (JSC::Interpreter::cti_op_loop_if_lesseq):
+ (JSC::Interpreter::cti_op_get_by_id_generic):
+ (JSC::Interpreter::cti_op_get_by_id):
+ (JSC::Interpreter::cti_op_get_by_id_second):
+ (JSC::Interpreter::cti_op_get_by_id_self_fail):
+ (JSC::Interpreter::cti_op_get_by_id_proto_list):
+ (JSC::Interpreter::cti_op_get_by_id_proto_list_full):
+ (JSC::Interpreter::cti_op_get_by_id_proto_fail):
+ (JSC::Interpreter::cti_op_get_by_id_array_fail):
+ (JSC::Interpreter::cti_op_get_by_id_string_fail):
+ (JSC::Interpreter::cti_op_instanceof):
+ (JSC::Interpreter::cti_op_del_by_id):
+ (JSC::Interpreter::cti_op_mul):
+ (JSC::Interpreter::cti_op_call_NotJSFunction):
+ (JSC::Interpreter::cti_op_resolve):
+ (JSC::Interpreter::cti_op_construct_NotJSConstruct):
+ (JSC::Interpreter::cti_op_get_by_val):
+ (JSC::Interpreter::cti_op_resolve_func):
+ (JSC::Interpreter::cti_op_sub):
+ (JSC::Interpreter::cti_op_put_by_val):
+ (JSC::Interpreter::cti_op_put_by_val_array):
+ (JSC::Interpreter::cti_op_lesseq):
+ (JSC::Interpreter::cti_op_loop_if_true):
+ (JSC::Interpreter::cti_op_negate):
+ (JSC::Interpreter::cti_op_resolve_base):
+ (JSC::Interpreter::cti_op_resolve_skip):
+ (JSC::Interpreter::cti_op_resolve_global):
+ (JSC::Interpreter::cti_op_div):
+ (JSC::Interpreter::cti_op_pre_dec):
+ (JSC::Interpreter::cti_op_jless):
+ (JSC::Interpreter::cti_op_not):
+ (JSC::Interpreter::cti_op_jtrue):
+ (JSC::Interpreter::cti_op_post_inc):
+ (JSC::Interpreter::cti_op_eq):
+ (JSC::Interpreter::cti_op_lshift):
+ (JSC::Interpreter::cti_op_bitand):
+ (JSC::Interpreter::cti_op_rshift):
+ (JSC::Interpreter::cti_op_bitnot):
+ (JSC::Interpreter::cti_op_resolve_with_base):
+ (JSC::Interpreter::cti_op_mod):
+ (JSC::Interpreter::cti_op_less):
+ (JSC::Interpreter::cti_op_neq):
+ (JSC::Interpreter::cti_op_post_dec):
+ (JSC::Interpreter::cti_op_urshift):
+ (JSC::Interpreter::cti_op_bitxor):
+ (JSC::Interpreter::cti_op_bitor):
+ (JSC::Interpreter::cti_op_call_eval):
+ (JSC::Interpreter::cti_op_throw):
+ (JSC::Interpreter::cti_op_next_pname):
+ (JSC::Interpreter::cti_op_typeof):
+ (JSC::Interpreter::cti_op_is_undefined):
+ (JSC::Interpreter::cti_op_is_boolean):
+ (JSC::Interpreter::cti_op_is_number):
+ (JSC::Interpreter::cti_op_is_string):
+ (JSC::Interpreter::cti_op_is_object):
+ (JSC::Interpreter::cti_op_is_function):
+ (JSC::Interpreter::cti_op_stricteq):
+ (JSC::Interpreter::cti_op_nstricteq):
+ (JSC::Interpreter::cti_op_to_jsnumber):
+ (JSC::Interpreter::cti_op_in):
+ (JSC::Interpreter::cti_op_switch_imm):
+ (JSC::Interpreter::cti_op_switch_char):
+ (JSC::Interpreter::cti_op_switch_string):
+ (JSC::Interpreter::cti_op_del_by_val):
+ (JSC::Interpreter::cti_op_new_error):
+ (JSC::Interpreter::cti_vm_throw):
+ * interpreter/Interpreter.h:
+ (JSC::Interpreter::isJSArray):
+ (JSC::Interpreter::isJSString):
+ * interpreter/Register.h:
+ (JSC::Register::):
+ (JSC::Register::Register):
+ (JSC::Register::jsValue):
+ (JSC::Register::getJSValue):
+ * jit/JIT.cpp:
+ (JSC::):
+ (JSC::JIT::compileOpStrictEq):
+ (JSC::JIT::privateCompileMainPass):
+ (JSC::JIT::privateCompileSlowCases):
+ * jit/JIT.h:
+ (JSC::):
+ (JSC::JIT::execute):
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::compileFastArith_op_rshift):
+ (JSC::JIT::compileFastArithSlow_op_rshift):
+ * jit/JITCall.cpp:
+ (JSC::JIT::unlinkCall):
+ (JSC::JIT::compileOpCallInitializeCallFrame):
+ (JSC::JIT::compileOpCall):
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::emitGetVirtualRegister):
+ (JSC::JIT::getConstantOperand):
+ (JSC::JIT::isOperandConstant31BitImmediateInt):
+ (JSC::JIT::emitPutJITStubArgFromVirtualRegister):
+ (JSC::JIT::emitInitRegister):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::resizePropertyStorage):
+ (JSC::JIT::privateCompilePutByIdTransition):
+ (JSC::JIT::patchGetByIdSelf):
+ (JSC::JIT::patchPutByIdReplace):
+ (JSC::JIT::privateCompileGetByIdSelf):
+ (JSC::JIT::privateCompileGetByIdProto):
+ (JSC::JIT::privateCompileGetByIdSelfList):
+ (JSC::JIT::privateCompileGetByIdProtoList):
+ (JSC::JIT::privateCompileGetByIdChainList):
+ (JSC::JIT::privateCompileGetByIdChain):
+ (JSC::JIT::privateCompilePutByIdReplace):
+ * jsc.cpp:
+ (functionPrint):
+ (functionDebug):
+ (functionGC):
+ (functionVersion):
+ (functionRun):
+ (functionLoad):
+ (functionReadline):
+ (functionQuit):
+ * parser/Nodes.cpp:
+ (JSC::NullNode::emitBytecode):
+ (JSC::ArrayNode::emitBytecode):
+ (JSC::FunctionCallValueNode::emitBytecode):
+ (JSC::FunctionCallResolveNode::emitBytecode):
+ (JSC::VoidNode::emitBytecode):
+ (JSC::ConstDeclNode::emitCodeSingle):
+ (JSC::ReturnNode::emitBytecode):
+ (JSC::processClauseList):
+ (JSC::EvalNode::emitBytecode):
+ (JSC::FunctionBodyNode::emitBytecode):
+ (JSC::ProgramNode::emitBytecode):
+ * profiler/ProfileGenerator.cpp:
+ (JSC::ProfileGenerator::addParentForConsoleStart):
+ * profiler/Profiler.cpp:
+ (JSC::Profiler::willExecute):
+ (JSC::Profiler::didExecute):
+ (JSC::Profiler::createCallIdentifier):
+ * profiler/Profiler.h:
+ * runtime/ArgList.cpp:
+ (JSC::ArgList::slowAppend):
+ * runtime/ArgList.h:
+ (JSC::ArgList::at):
+ (JSC::ArgList::append):
+ * runtime/Arguments.cpp:
+ (JSC::Arguments::put):
+ * runtime/Arguments.h:
+ (JSC::Arguments::createStructure):
+ (JSC::asArguments):
+ * runtime/ArrayConstructor.cpp:
+ (JSC::callArrayConstructor):
+ * runtime/ArrayPrototype.cpp:
+ (JSC::getProperty):
+ (JSC::putProperty):
+ (JSC::arrayProtoFuncToString):
+ (JSC::arrayProtoFuncToLocaleString):
+ (JSC::arrayProtoFuncJoin):
+ (JSC::arrayProtoFuncConcat):
+ (JSC::arrayProtoFuncPop):
+ (JSC::arrayProtoFuncPush):
+ (JSC::arrayProtoFuncReverse):
+ (JSC::arrayProtoFuncShift):
+ (JSC::arrayProtoFuncSlice):
+ (JSC::arrayProtoFuncSort):
+ (JSC::arrayProtoFuncSplice):
+ (JSC::arrayProtoFuncUnShift):
+ (JSC::arrayProtoFuncFilter):
+ (JSC::arrayProtoFuncMap):
+ (JSC::arrayProtoFuncEvery):
+ (JSC::arrayProtoFuncForEach):
+ (JSC::arrayProtoFuncSome):
+ (JSC::arrayProtoFuncIndexOf):
+ (JSC::arrayProtoFuncLastIndexOf):
+ * runtime/BooleanConstructor.cpp:
+ (JSC::callBooleanConstructor):
+ (JSC::constructBooleanFromImmediateBoolean):
+ * runtime/BooleanConstructor.h:
+ * runtime/BooleanObject.h:
+ (JSC::asBooleanObject):
+ * runtime/BooleanPrototype.cpp:
+ (JSC::booleanProtoFuncToString):
+ (JSC::booleanProtoFuncValueOf):
+ * runtime/CallData.cpp:
+ (JSC::call):
+ * runtime/CallData.h:
+ * runtime/Collector.cpp:
+ (JSC::Heap::protect):
+ (JSC::Heap::unprotect):
+ (JSC::Heap::heap):
+ (JSC::Heap::collect):
+ * runtime/Collector.h:
+ * runtime/Completion.cpp:
+ (JSC::evaluate):
+ * runtime/Completion.h:
+ (JSC::Completion::Completion):
+ (JSC::Completion::value):
+ (JSC::Completion::setValue):
+ (JSC::Completion::isValueCompletion):
+ * runtime/ConstructData.cpp:
+ (JSC::construct):
+ * runtime/ConstructData.h:
+ * runtime/DateConstructor.cpp:
+ (JSC::constructDate):
+ (JSC::callDate):
+ (JSC::dateParse):
+ (JSC::dateNow):
+ (JSC::dateUTC):
+ * runtime/DateInstance.h:
+ (JSC::asDateInstance):
+ * runtime/DatePrototype.cpp:
+ (JSC::dateProtoFuncToString):
+ (JSC::dateProtoFuncToUTCString):
+ (JSC::dateProtoFuncToDateString):
+ (JSC::dateProtoFuncToTimeString):
+ (JSC::dateProtoFuncToLocaleString):
+ (JSC::dateProtoFuncToLocaleDateString):
+ (JSC::dateProtoFuncToLocaleTimeString):
+ (JSC::dateProtoFuncValueOf):
+ (JSC::dateProtoFuncGetTime):
+ (JSC::dateProtoFuncGetFullYear):
+ (JSC::dateProtoFuncGetUTCFullYear):
+ (JSC::dateProtoFuncToGMTString):
+ (JSC::dateProtoFuncGetMonth):
+ (JSC::dateProtoFuncGetUTCMonth):
+ (JSC::dateProtoFuncGetDate):
+ (JSC::dateProtoFuncGetUTCDate):
+ (JSC::dateProtoFuncGetDay):
+ (JSC::dateProtoFuncGetUTCDay):
+ (JSC::dateProtoFuncGetHours):
+ (JSC::dateProtoFuncGetUTCHours):
+ (JSC::dateProtoFuncGetMinutes):
+ (JSC::dateProtoFuncGetUTCMinutes):
+ (JSC::dateProtoFuncGetSeconds):
+ (JSC::dateProtoFuncGetUTCSeconds):
+ (JSC::dateProtoFuncGetMilliSeconds):
+ (JSC::dateProtoFuncGetUTCMilliseconds):
+ (JSC::dateProtoFuncGetTimezoneOffset):
+ (JSC::dateProtoFuncSetTime):
+ (JSC::setNewValueFromTimeArgs):
+ (JSC::setNewValueFromDateArgs):
+ (JSC::dateProtoFuncSetMilliSeconds):
+ (JSC::dateProtoFuncSetUTCMilliseconds):
+ (JSC::dateProtoFuncSetSeconds):
+ (JSC::dateProtoFuncSetUTCSeconds):
+ (JSC::dateProtoFuncSetMinutes):
+ (JSC::dateProtoFuncSetUTCMinutes):
+ (JSC::dateProtoFuncSetHours):
+ (JSC::dateProtoFuncSetUTCHours):
+ (JSC::dateProtoFuncSetDate):
+ (JSC::dateProtoFuncSetUTCDate):
+ (JSC::dateProtoFuncSetMonth):
+ (JSC::dateProtoFuncSetUTCMonth):
+ (JSC::dateProtoFuncSetFullYear):
+ (JSC::dateProtoFuncSetUTCFullYear):
+ (JSC::dateProtoFuncSetYear):
+ (JSC::dateProtoFuncGetYear):
+ * runtime/DatePrototype.h:
+ (JSC::DatePrototype::createStructure):
+ * runtime/ErrorConstructor.cpp:
+ (JSC::callErrorConstructor):
+ * runtime/ErrorPrototype.cpp:
+ (JSC::errorProtoFuncToString):
+ * runtime/ExceptionHelpers.cpp:
+ (JSC::createInterruptedExecutionException):
+ (JSC::createError):
+ (JSC::createStackOverflowError):
+ (JSC::createUndefinedVariableError):
+ (JSC::createErrorMessage):
+ (JSC::createInvalidParamError):
+ (JSC::createNotAConstructorError):
+ (JSC::createNotAFunctionError):
+ * runtime/ExceptionHelpers.h:
+ * runtime/FunctionConstructor.cpp:
+ (JSC::callFunctionConstructor):
+ * runtime/FunctionPrototype.cpp:
+ (JSC::callFunctionPrototype):
+ (JSC::functionProtoFuncToString):
+ (JSC::functionProtoFuncApply):
+ (JSC::functionProtoFuncCall):
+ * runtime/FunctionPrototype.h:
+ (JSC::FunctionPrototype::createStructure):
+ * runtime/GetterSetter.cpp:
+ (JSC::GetterSetter::toPrimitive):
+ (JSC::GetterSetter::getPrimitiveNumber):
+ * runtime/GetterSetter.h:
+ (JSC::asGetterSetter):
+ * runtime/InitializeThreading.cpp:
+ * runtime/InternalFunction.h:
+ (JSC::InternalFunction::createStructure):
+ (JSC::asInternalFunction):
+ * runtime/JSActivation.cpp:
+ (JSC::JSActivation::getOwnPropertySlot):
+ (JSC::JSActivation::put):
+ (JSC::JSActivation::putWithAttributes):
+ (JSC::JSActivation::argumentsGetter):
+ * runtime/JSActivation.h:
+ (JSC::JSActivation::createStructure):
+ (JSC::asActivation):
+ * runtime/JSArray.cpp:
+ (JSC::storageSize):
+ (JSC::JSArray::JSArray):
+ (JSC::JSArray::getOwnPropertySlot):
+ (JSC::JSArray::put):
+ (JSC::JSArray::putSlowCase):
+ (JSC::JSArray::deleteProperty):
+ (JSC::JSArray::getPropertyNames):
+ (JSC::JSArray::setLength):
+ (JSC::JSArray::pop):
+ (JSC::JSArray::push):
+ (JSC::JSArray::mark):
+ (JSC::JSArray::sort):
+ (JSC::JSArray::compactForSorting):
+ (JSC::JSArray::checkConsistency):
+ (JSC::constructArray):
+ * runtime/JSArray.h:
+ (JSC::JSArray::getIndex):
+ (JSC::JSArray::setIndex):
+ (JSC::JSArray::createStructure):
+ (JSC::asArray):
+ * runtime/JSCell.cpp:
+ (JSC::JSCell::put):
+ (JSC::JSCell::getJSNumber):
+ * runtime/JSCell.h:
+ (JSC::asCell):
+ (JSC::JSValue::asCell):
+ (JSC::JSValue::toPrimitive):
+ (JSC::JSValue::getPrimitiveNumber):
+ (JSC::JSValue::getJSNumber):
+ * runtime/JSFunction.cpp:
+ (JSC::JSFunction::call):
+ (JSC::JSFunction::argumentsGetter):
+ (JSC::JSFunction::callerGetter):
+ (JSC::JSFunction::lengthGetter):
+ (JSC::JSFunction::getOwnPropertySlot):
+ (JSC::JSFunction::put):
+ (JSC::JSFunction::construct):
+ * runtime/JSFunction.h:
+ (JSC::JSFunction::createStructure):
+ (JSC::asFunction):
+ * runtime/JSGlobalData.h:
+ * runtime/JSGlobalObject.cpp:
+ (JSC::markIfNeeded):
+ (JSC::JSGlobalObject::put):
+ (JSC::JSGlobalObject::putWithAttributes):
+ (JSC::JSGlobalObject::reset):
+ (JSC::JSGlobalObject::resetPrototype):
+ * runtime/JSGlobalObject.h:
+ (JSC::JSGlobalObject::createStructure):
+ (JSC::JSGlobalObject::GlobalPropertyInfo::GlobalPropertyInfo):
+ (JSC::asGlobalObject):
+ (JSC::Structure::prototypeForLookup):
+ * runtime/JSGlobalObjectFunctions.cpp:
+ (JSC::encode):
+ (JSC::decode):
+ (JSC::globalFuncEval):
+ (JSC::globalFuncParseInt):
+ (JSC::globalFuncParseFloat):
+ (JSC::globalFuncIsNaN):
+ (JSC::globalFuncIsFinite):
+ (JSC::globalFuncDecodeURI):
+ (JSC::globalFuncDecodeURIComponent):
+ (JSC::globalFuncEncodeURI):
+ (JSC::globalFuncEncodeURIComponent):
+ (JSC::globalFuncEscape):
+ (JSC::globalFuncUnescape):
+ (JSC::globalFuncJSCPrint):
+ * runtime/JSGlobalObjectFunctions.h:
+ * runtime/JSImmediate.cpp:
+ (JSC::JSImmediate::toThisObject):
+ (JSC::JSImmediate::toObject):
+ (JSC::JSImmediate::prototype):
+ (JSC::JSImmediate::toString):
+ * runtime/JSImmediate.h:
+ (JSC::JSImmediate::isImmediate):
+ (JSC::JSImmediate::isNumber):
+ (JSC::JSImmediate::isPositiveNumber):
+ (JSC::JSImmediate::isBoolean):
+ (JSC::JSImmediate::isUndefinedOrNull):
+ (JSC::JSImmediate::isNegative):
+ (JSC::JSImmediate::isEitherImmediate):
+ (JSC::JSImmediate::isAnyImmediate):
+ (JSC::JSImmediate::areBothImmediate):
+ (JSC::JSImmediate::areBothImmediateNumbers):
+ (JSC::JSImmediate::andImmediateNumbers):
+ (JSC::JSImmediate::xorImmediateNumbers):
+ (JSC::JSImmediate::orImmediateNumbers):
+ (JSC::JSImmediate::rightShiftImmediateNumbers):
+ (JSC::JSImmediate::canDoFastAdditiveOperations):
+ (JSC::JSImmediate::addImmediateNumbers):
+ (JSC::JSImmediate::subImmediateNumbers):
+ (JSC::JSImmediate::incImmediateNumber):
+ (JSC::JSImmediate::decImmediateNumber):
+ (JSC::JSImmediate::makeValue):
+ (JSC::JSImmediate::makeInt):
+ (JSC::JSImmediate::makeBool):
+ (JSC::JSImmediate::makeUndefined):
+ (JSC::JSImmediate::makeNull):
+ (JSC::JSImmediate::intValue):
+ (JSC::JSImmediate::uintValue):
+ (JSC::JSImmediate::boolValue):
+ (JSC::JSImmediate::rawValue):
+ (JSC::JSImmediate::trueImmediate):
+ (JSC::JSImmediate::falseImmediate):
+ (JSC::JSImmediate::undefinedImmediate):
+ (JSC::JSImmediate::nullImmediate):
+ (JSC::JSImmediate::zeroImmediate):
+ (JSC::JSImmediate::oneImmediate):
+ (JSC::JSImmediate::impossibleValue):
+ (JSC::JSImmediate::toBoolean):
+ (JSC::JSImmediate::getTruncatedUInt32):
+ (JSC::JSImmediate::from):
+ (JSC::JSImmediate::getTruncatedInt32):
+ (JSC::JSImmediate::toDouble):
+ (JSC::JSImmediate::getUInt32):
+ (JSC::jsNull):
+ (JSC::jsBoolean):
+ (JSC::jsUndefined):
+ (JSC::JSValue::isUndefined):
+ (JSC::JSValue::isNull):
+ (JSC::JSValue::isUndefinedOrNull):
+ (JSC::JSValue::isBoolean):
+ (JSC::JSValue::getBoolean):
+ (JSC::JSValue::toInt32):
+ (JSC::JSValue::toUInt32):
+ (JSC::toInt32):
+ (JSC::toUInt32):
+ * runtime/JSNotAnObject.cpp:
+ (JSC::JSNotAnObject::toPrimitive):
+ (JSC::JSNotAnObject::getPrimitiveNumber):
+ (JSC::JSNotAnObject::put):
+ * runtime/JSNotAnObject.h:
+ (JSC::JSNotAnObject::createStructure):
+ * runtime/JSNumberCell.cpp:
+ (JSC::JSNumberCell::toPrimitive):
+ (JSC::JSNumberCell::getPrimitiveNumber):
+ (JSC::JSNumberCell::getJSNumber):
+ (JSC::jsNumberCell):
+ (JSC::jsNaN):
+ * runtime/JSNumberCell.h:
+ (JSC::JSNumberCell::createStructure):
+ (JSC::asNumberCell):
+ (JSC::jsNumber):
+ (JSC::JSValue::toJSNumber):
+ * runtime/JSObject.cpp:
+ (JSC::JSObject::mark):
+ (JSC::JSObject::put):
+ (JSC::JSObject::putWithAttributes):
+ (JSC::callDefaultValueFunction):
+ (JSC::JSObject::getPrimitiveNumber):
+ (JSC::JSObject::defaultValue):
+ (JSC::JSObject::defineGetter):
+ (JSC::JSObject::defineSetter):
+ (JSC::JSObject::lookupGetter):
+ (JSC::JSObject::lookupSetter):
+ (JSC::JSObject::hasInstance):
+ (JSC::JSObject::toNumber):
+ (JSC::JSObject::toString):
+ (JSC::JSObject::fillGetterPropertySlot):
+ * runtime/JSObject.h:
+ (JSC::JSObject::getDirect):
+ (JSC::JSObject::getDirectLocation):
+ (JSC::JSObject::offsetForLocation):
+ (JSC::JSObject::locationForOffset):
+ (JSC::JSObject::getDirectOffset):
+ (JSC::JSObject::putDirectOffset):
+ (JSC::JSObject::createStructure):
+ (JSC::asObject):
+ (JSC::JSObject::prototype):
+ (JSC::JSObject::setPrototype):
+ (JSC::JSObject::inlineGetOwnPropertySlot):
+ (JSC::JSObject::getOwnPropertySlotForWrite):
+ (JSC::JSObject::getPropertySlot):
+ (JSC::JSObject::get):
+ (JSC::JSObject::putDirect):
+ (JSC::JSObject::putDirectWithoutTransition):
+ (JSC::JSObject::toPrimitive):
+ (JSC::JSValue::get):
+ (JSC::JSValue::put):
+ (JSC::JSObject::allocatePropertyStorageInline):
+ * runtime/JSPropertyNameIterator.cpp:
+ (JSC::JSPropertyNameIterator::toPrimitive):
+ (JSC::JSPropertyNameIterator::getPrimitiveNumber):
+ * runtime/JSPropertyNameIterator.h:
+ (JSC::JSPropertyNameIterator::create):
+ (JSC::JSPropertyNameIterator::next):
+ * runtime/JSStaticScopeObject.cpp:
+ (JSC::JSStaticScopeObject::put):
+ (JSC::JSStaticScopeObject::putWithAttributes):
+ * runtime/JSStaticScopeObject.h:
+ (JSC::JSStaticScopeObject::JSStaticScopeObject):
+ (JSC::JSStaticScopeObject::createStructure):
+ * runtime/JSString.cpp:
+ (JSC::JSString::toPrimitive):
+ (JSC::JSString::getPrimitiveNumber):
+ (JSC::JSString::getOwnPropertySlot):
+ * runtime/JSString.h:
+ (JSC::JSString::createStructure):
+ (JSC::asString):
+ * runtime/JSValue.h:
+ (JSC::JSValuePtr::makeImmediate):
+ (JSC::JSValuePtr::immediateValue):
+ (JSC::JSValuePtr::JSValuePtr):
+ (JSC::JSValuePtr::operator->):
+ (JSC::JSValuePtr::hasValue):
+ (JSC::JSValuePtr::operator==):
+ (JSC::JSValuePtr::operator!=):
+ (JSC::JSValuePtr::encode):
+ (JSC::JSValuePtr::decode):
+ (JSC::JSValue::asValue):
+ (JSC::noValue):
+ (JSC::operator==):
+ (JSC::operator!=):
+ * runtime/JSVariableObject.h:
+ (JSC::JSVariableObject::symbolTablePut):
+ (JSC::JSVariableObject::symbolTablePutWithAttributes):
+ * runtime/JSWrapperObject.cpp:
+ (JSC::JSWrapperObject::mark):
+ * runtime/JSWrapperObject.h:
+ (JSC::JSWrapperObject::internalValue):
+ (JSC::JSWrapperObject::setInternalValue):
+ * runtime/Lookup.cpp:
+ (JSC::setUpStaticFunctionSlot):
+ * runtime/Lookup.h:
+ (JSC::lookupPut):
+ * runtime/MathObject.cpp:
+ (JSC::mathProtoFuncAbs):
+ (JSC::mathProtoFuncACos):
+ (JSC::mathProtoFuncASin):
+ (JSC::mathProtoFuncATan):
+ (JSC::mathProtoFuncATan2):
+ (JSC::mathProtoFuncCeil):
+ (JSC::mathProtoFuncCos):
+ (JSC::mathProtoFuncExp):
+ (JSC::mathProtoFuncFloor):
+ (JSC::mathProtoFuncLog):
+ (JSC::mathProtoFuncMax):
+ (JSC::mathProtoFuncMin):
+ (JSC::mathProtoFuncPow):
+ (JSC::mathProtoFuncRandom):
+ (JSC::mathProtoFuncRound):
+ (JSC::mathProtoFuncSin):
+ (JSC::mathProtoFuncSqrt):
+ (JSC::mathProtoFuncTan):
+ * runtime/MathObject.h:
+ (JSC::MathObject::createStructure):
+ * runtime/NativeErrorConstructor.cpp:
+ (JSC::callNativeErrorConstructor):
+ * runtime/NumberConstructor.cpp:
+ (JSC::numberConstructorNaNValue):
+ (JSC::numberConstructorNegInfinity):
+ (JSC::numberConstructorPosInfinity):
+ (JSC::numberConstructorMaxValue):
+ (JSC::numberConstructorMinValue):
+ (JSC::callNumberConstructor):
+ * runtime/NumberConstructor.h:
+ (JSC::NumberConstructor::createStructure):
+ * runtime/NumberObject.cpp:
+ (JSC::NumberObject::getJSNumber):
+ (JSC::constructNumberFromImmediateNumber):
+ * runtime/NumberObject.h:
+ * runtime/NumberPrototype.cpp:
+ (JSC::numberProtoFuncToString):
+ (JSC::numberProtoFuncToLocaleString):
+ (JSC::numberProtoFuncValueOf):
+ (JSC::numberProtoFuncToFixed):
+ (JSC::numberProtoFuncToExponential):
+ (JSC::numberProtoFuncToPrecision):
+ * runtime/ObjectConstructor.cpp:
+ (JSC::constructObject):
+ (JSC::callObjectConstructor):
+ * runtime/ObjectPrototype.cpp:
+ (JSC::objectProtoFuncValueOf):
+ (JSC::objectProtoFuncHasOwnProperty):
+ (JSC::objectProtoFuncIsPrototypeOf):
+ (JSC::objectProtoFuncDefineGetter):
+ (JSC::objectProtoFuncDefineSetter):
+ (JSC::objectProtoFuncLookupGetter):
+ (JSC::objectProtoFuncLookupSetter):
+ (JSC::objectProtoFuncPropertyIsEnumerable):
+ (JSC::objectProtoFuncToLocaleString):
+ (JSC::objectProtoFuncToString):
+ * runtime/ObjectPrototype.h:
+ * runtime/Operations.cpp:
+ (JSC::equal):
+ (JSC::equalSlowCase):
+ (JSC::strictEqual):
+ (JSC::strictEqualSlowCase):
+ (JSC::throwOutOfMemoryError):
+ * runtime/Operations.h:
+ (JSC::equalSlowCaseInline):
+ (JSC::strictEqualSlowCaseInline):
+ * runtime/PropertySlot.cpp:
+ (JSC::PropertySlot::functionGetter):
+ * runtime/PropertySlot.h:
+ (JSC::PropertySlot::PropertySlot):
+ (JSC::PropertySlot::getValue):
+ (JSC::PropertySlot::putValue):
+ (JSC::PropertySlot::setValueSlot):
+ (JSC::PropertySlot::setValue):
+ (JSC::PropertySlot::setCustom):
+ (JSC::PropertySlot::setCustomIndex):
+ (JSC::PropertySlot::slotBase):
+ (JSC::PropertySlot::setBase):
+ (JSC::PropertySlot::):
+ * runtime/Protect.h:
+ (JSC::gcProtect):
+ (JSC::gcUnprotect):
+ (JSC::ProtectedPtr::ProtectedPtr):
+ (JSC::ProtectedPtr::operator JSValuePtr):
+ (JSC::ProtectedJSValuePtr::ProtectedJSValuePtr):
+ (JSC::ProtectedJSValuePtr::get):
+ (JSC::ProtectedJSValuePtr::operator JSValuePtr):
+ (JSC::ProtectedJSValuePtr::operator->):
+ (JSC::::ProtectedPtr):
+ (JSC::::~ProtectedPtr):
+ (JSC::::operator):
+ (JSC::ProtectedJSValuePtr::~ProtectedJSValuePtr):
+ (JSC::ProtectedJSValuePtr::operator=):
+ (JSC::operator==):
+ (JSC::operator!=):
+ * runtime/RegExpConstructor.cpp:
+ (JSC::RegExpConstructor::getBackref):
+ (JSC::RegExpConstructor::getLastParen):
+ (JSC::RegExpConstructor::getLeftContext):
+ (JSC::RegExpConstructor::getRightContext):
+ (JSC::regExpConstructorDollar1):
+ (JSC::regExpConstructorDollar2):
+ (JSC::regExpConstructorDollar3):
+ (JSC::regExpConstructorDollar4):
+ (JSC::regExpConstructorDollar5):
+ (JSC::regExpConstructorDollar6):
+ (JSC::regExpConstructorDollar7):
+ (JSC::regExpConstructorDollar8):
+ (JSC::regExpConstructorDollar9):
+ (JSC::regExpConstructorInput):
+ (JSC::regExpConstructorMultiline):
+ (JSC::regExpConstructorLastMatch):
+ (JSC::regExpConstructorLastParen):
+ (JSC::regExpConstructorLeftContext):
+ (JSC::regExpConstructorRightContext):
+ (JSC::RegExpConstructor::put):
+ (JSC::setRegExpConstructorInput):
+ (JSC::setRegExpConstructorMultiline):
+ (JSC::constructRegExp):
+ (JSC::callRegExpConstructor):
+ * runtime/RegExpConstructor.h:
+ (JSC::RegExpConstructor::createStructure):
+ (JSC::asRegExpConstructor):
+ * runtime/RegExpMatchesArray.h:
+ (JSC::RegExpMatchesArray::put):
+ * runtime/RegExpObject.cpp:
+ (JSC::regExpObjectGlobal):
+ (JSC::regExpObjectIgnoreCase):
+ (JSC::regExpObjectMultiline):
+ (JSC::regExpObjectSource):
+ (JSC::regExpObjectLastIndex):
+ (JSC::RegExpObject::put):
+ (JSC::setRegExpObjectLastIndex):
+ (JSC::RegExpObject::test):
+ (JSC::RegExpObject::exec):
+ (JSC::callRegExpObject):
+ * runtime/RegExpObject.h:
+ (JSC::RegExpObject::createStructure):
+ (JSC::asRegExpObject):
+ * runtime/RegExpPrototype.cpp:
+ (JSC::regExpProtoFuncTest):
+ (JSC::regExpProtoFuncExec):
+ (JSC::regExpProtoFuncCompile):
+ (JSC::regExpProtoFuncToString):
+ * runtime/StringConstructor.cpp:
+ (JSC::stringFromCharCodeSlowCase):
+ (JSC::stringFromCharCode):
+ (JSC::callStringConstructor):
+ * runtime/StringObject.cpp:
+ (JSC::StringObject::put):
+ * runtime/StringObject.h:
+ (JSC::StringObject::createStructure):
+ (JSC::asStringObject):
+ * runtime/StringObjectThatMasqueradesAsUndefined.h:
+ (JSC::StringObjectThatMasqueradesAsUndefined::createStructure):
+ * runtime/StringPrototype.cpp:
+ (JSC::stringProtoFuncReplace):
+ (JSC::stringProtoFuncToString):
+ (JSC::stringProtoFuncCharAt):
+ (JSC::stringProtoFuncCharCodeAt):
+ (JSC::stringProtoFuncConcat):
+ (JSC::stringProtoFuncIndexOf):
+ (JSC::stringProtoFuncLastIndexOf):
+ (JSC::stringProtoFuncMatch):
+ (JSC::stringProtoFuncSearch):
+ (JSC::stringProtoFuncSlice):
+ (JSC::stringProtoFuncSplit):
+ (JSC::stringProtoFuncSubstr):
+ (JSC::stringProtoFuncSubstring):
+ (JSC::stringProtoFuncToLowerCase):
+ (JSC::stringProtoFuncToUpperCase):
+ (JSC::stringProtoFuncLocaleCompare):
+ (JSC::stringProtoFuncBig):
+ (JSC::stringProtoFuncSmall):
+ (JSC::stringProtoFuncBlink):
+ (JSC::stringProtoFuncBold):
+ (JSC::stringProtoFuncFixed):
+ (JSC::stringProtoFuncItalics):
+ (JSC::stringProtoFuncStrike):
+ (JSC::stringProtoFuncSub):
+ (JSC::stringProtoFuncSup):
+ (JSC::stringProtoFuncFontcolor):
+ (JSC::stringProtoFuncFontsize):
+ (JSC::stringProtoFuncAnchor):
+ (JSC::stringProtoFuncLink):
+ * runtime/Structure.cpp:
+ (JSC::Structure::Structure):
+ (JSC::Structure::changePrototypeTransition):
+ (JSC::Structure::createCachedPrototypeChain):
+ * runtime/Structure.h:
+ (JSC::Structure::create):
+ (JSC::Structure::setPrototypeWithoutTransition):
+ (JSC::Structure::storedPrototype):
+
+2009-01-06 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ <https://bugs.webkit.org/show_bug.cgi?id=23085> [jsfunfuzz] Over released ScopeChainNode
+ <rdar://problem/6474110>
+
+ So this delightful bug was caused by our unwind code using a ScopeChain to perform
+ the unwind. The ScopeChain would ref the initial top of the scope chain, then deref
+ the resultant top of scope chain, which is incorrect.
+
+ This patch removes the dependency on ScopeChain for the unwind, and i've filed
+ <https://bugs.webkit.org/show_bug.cgi?id=23144> to look into the unintuitive
+ ScopeChain behaviour.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::throwException):
+
+2009-01-06 Adam Roben <aroben@apple.com>
+
+ Hopeful Windows crash-on-launch fix
+
+ * wtf/Platform.h: Force a world rebuild by touching this file.
+
+2009-01-06 Holger Hans Peter Freyther <zecke@selfish.org>
+
+ Reviewed by NOBODY (Build fix).
+
+ * GNUmakefile.am:Add ByteArray.cpp too
+
+2009-01-06 Holger Hans Peter Freyther <zecke@selfish.org>
+
+ Reviewed by NOBODY (Speculative build fix).
+
+ AllInOneFile.cpp does not include the JSByteArray.cpp include it...
+
+ * GNUmakefile.am:
+
+2009-01-05 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by NOBODY (Build fix).
+
+ Fix Wx build
+
+ * JavaScriptCoreSources.bkl:
+
+2009-01-05 Oliver Hunt <oliver@apple.com>
+
+ Windows build fixes
+
+ Rubber-stamped by Alice Liu.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::Interpreter):
+ * runtime/ByteArray.cpp:
+ (JSC::ByteArray::create):
+ * runtime/ByteArray.h:
+
+2009-01-05 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ CanvasPixelArray performance is too slow
+ <https://bugs.webkit.org/show_bug.cgi?id=23123>
+
+ The fix to this is to devirtualise get and put in a manner similar to
+ JSString and JSArray. To do this I've added a ByteArray implementation
+ and JSByteArray wrapper to JSC. We can then do vptr comparisons to
+ devirtualise the calls.
+
+ This devirtualisation improves performance by 1.5-2x in my somewhat ad
+ hoc tests.
+
+ * GNUmakefile.am:
+ * JavaScriptCore.exp:
+ * JavaScriptCore.pri:
+ * JavaScriptCore.scons:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::Interpreter):
+ (JSC::Interpreter::privateExecute):
+ (JSC::Interpreter::cti_op_get_by_val):
+ (JSC::Interpreter::cti_op_put_by_val):
+ * interpreter/Interpreter.h:
+ (JSC::Interpreter::isJSByteArray):
+ * runtime/ByteArray.cpp: Added.
+ (JSC::ByteArray::create):
+ * runtime/ByteArray.h: Added.
+ (JSC::ByteArray::length):
+ (JSC::ByteArray::set):
+ (JSC::ByteArray::get):
+ (JSC::ByteArray::data):
+ (JSC::ByteArray::ByteArray):
+ * runtime/JSByteArray.cpp: Added.
+ (JSC::):
+ (JSC::JSByteArray::JSByteArray):
+ (JSC::JSByteArray::createStructure):
+ (JSC::JSByteArray::getOwnPropertySlot):
+ (JSC::JSByteArray::put):
+ (JSC::JSByteArray::getPropertyNames):
+ * runtime/JSByteArray.h: Added.
+ (JSC::JSByteArray::canAccessIndex):
+ (JSC::JSByteArray::getIndex):
+ (JSC::JSByteArray::setIndex):
+ (JSC::JSByteArray::classInfo):
+ (JSC::JSByteArray::length):
+ (JSC::JSByteArray::):
+ (JSC::JSByteArray::JSByteArray):
+ (JSC::asByteArray):
+
+2009-01-05 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=23073
+ <rdar://problem/6471129> Workers crash on Windows Release builds
+
+ * wtf/ThreadSpecific.h:
+ (WTF::ThreadSpecific::destroy): Changed to clear the pointer only after data object
+ destruction is finished - otherwise, WebCore::ThreadGlobalData destructor was re-creating
+ the object in order to access atomic string table.
+ (WTF::ThreadSpecific::operator T*): Symmetrically, set up the per-thread pointer before
+ data constructor is called.
+
+ * wtf/ThreadingWin.cpp: (WTF::wtfThreadEntryPoint): Remove a Windows-only hack to finalize
+ a thread - pthreadVC2 is a DLL, so it gets thread detached messages, and cleans up thread
+ specific data automatically. Besides, this code wasn't even compiled in for some time now.
+
+2009-01-05 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=23115
+ Create a version of ASSERT for use with otherwise unused variables
+
+ * wtf/Assertions.h: Added ASSERT_UNUSED.
+
+ * jit/ExecutableAllocatorPosix.cpp:
+ (JSC::ExecutablePool::systemRelease):
+ * runtime/Collector.cpp:
+ (JSC::Heap::destroy):
+ (JSC::Heap::heapAllocate):
+ * runtime/JSNotAnObject.cpp:
+ (JSC::JSNotAnObject::toPrimitive):
+ (JSC::JSNotAnObject::getPrimitiveNumber):
+ (JSC::JSNotAnObject::toBoolean):
+ (JSC::JSNotAnObject::toNumber):
+ (JSC::JSNotAnObject::toString):
+ (JSC::JSNotAnObject::getOwnPropertySlot):
+ (JSC::JSNotAnObject::put):
+ (JSC::JSNotAnObject::deleteProperty):
+ (JSC::JSNotAnObject::getPropertyNames):
+ * wtf/TCSystemAlloc.cpp:
+ (TCMalloc_SystemRelease):
+ Use it in some places that used other idioms for this purpose.
+
+2009-01-04 Alice Liu <alice.liu@apple.com>
+
+ <rdar://problem/6341776> Merge m_transitionCount and m_offset in Structure.
+
+ Reviewed by Darin Adler.
+
+ * runtime/Structure.cpp:
+ (JSC::Structure::Structure): Remove m_transitionCount
+ (JSC::Structure::addPropertyTransitionToExistingStructure): No need to wait until after the assignment to offset to assert if it's notFound; move it up.
+ (JSC::Structure::addPropertyTransition): Use method for transitionCount instead of m_transitionCount. Remove line that maintains the m_transitionCount.
+ (JSC::Structure::changePrototypeTransition): Remove line that maintains the m_transitionCount.
+ (JSC::Structure::getterSetterTransition): Remove line that maintains the m_transitionCount.
+ * runtime/Structure.h:
+ Changed s_maxTransitionLength and m_offset from size_t to signed char. m_offset will never become greater than 64
+ because the structure transitions to a dictionary at that time.
+ (JSC::Structure::transitionCount): method to replace the data member
+
+2009-01-04 Darin Adler <darin@apple.com>
+
+ Reviewed by David Kilzer.
+
+ Bug 15114: Provide compile-time assertions for sizeof(UChar), sizeof(DeprecatedChar), etc.
+ https://bugs.webkit.org/show_bug.cgi?id=15114
+
+ * wtf/unicode/Unicode.h: Assert size of UChar. There is no DeprecatedChar any more.
+
+2009-01-03 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Oliver Hunt.
+
+ Change the pcVector from storing native code pointers to storing offsets
+ from the base pointer. This will allow us to generate the pcVector on demand
+ for exceptions.
+
+ * bytecode/CodeBlock.h:
+ (JSC::PC::PC):
+ (JSC::getNativePCOffset):
+ (JSC::CodeBlock::getBytecodeIndex):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompile):
+
+2009-01-02 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by NOBODY (Build fix).
+
+ * runtime/ScopeChain.cpp:
+
+2009-01-02 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ [jsfunfuzz] unwind logic for exceptions in eval fails to account for dynamic scope external to the eval
+ https://bugs.webkit.org/show_bug.cgi?id=23078
+
+ This bug was caused by eval codeblocks being generated without accounting
+ for the depth of the scope chain they inherited. This meant that exception
+ handlers would understate their expected scope chain depth, which in turn
+ led to incorrectly removing nodes from the scope chain.
+
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::BytecodeGenerator):
+ (JSC::BytecodeGenerator::emitCatch):
+ * bytecompiler/BytecodeGenerator.h:
+ * interpreter/Interpreter.cpp:
+ (JSC::depth):
+ * runtime/ScopeChain.cpp:
+ (JSC::ScopeChain::localDepth):
+ * runtime/ScopeChain.h:
+ (JSC::ScopeChainNode::deref):
+ (JSC::ScopeChainNode::ref):
+
+2009-01-02 David Smith <catfish.man@gmail.com>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=22699
+ Enable NodeList caching for getElementsByTagName
+
+ * wtf/HashFunctions.h: Moved the definition of PHI here and renamed to stringHashingStartValue
+
+2009-01-02 David Kilzer <ddkilzer@apple.com>
+
+ Attempt to fix Qt Linux build after r39553
+
+ * wtf/RandomNumberSeed.h: Include <sys/time.h> for gettimeofday().
+ Include <sys/types.h> and <unistd.h> for getpid().
+
+2009-01-02 David Kilzer <ddkilzer@apple.com>
+
+ Bug 23081: These files are no longer part of the KDE libraries
+
+ <https://bugs.webkit.org/show_bug.cgi?id=23081>
+
+ Reviewed by Darin Adler.
+
+ Removed "This file is part of the KDE libraries" comment from
+ source files. Added or updated Apple copyrights as well.
+
+ * parser/Lexer.h:
+ * wtf/HashCountedSet.h:
+ * wtf/RetainPtr.h:
+ * wtf/VectorTraits.h:
+
+2009-01-02 David Kilzer <ddkilzer@apple.com>
+
+ Bug 23080: Remove last vestiges of KJS references
+
+ <https://bugs.webkit.org/show_bug.cgi?id=23080>
+
+ Reviewed by Darin Adler.
+
+ Also updated Apple copyright statements.
+
+ * DerivedSources.make: Changed bison "kjsyy" prefix to "jscyy".
+ * GNUmakefile.am: Ditto.
+ * JavaScriptCore.pri: Ditto. Also changed KJSBISON to JSCBISON
+ and kjsbison to jscbison.
+
+ * JavaScriptCoreSources.bkl: Changed JSCORE_KJS_SOURCES to
+ JSCORE_JSC_SOURCES.
+ * jscore.bkl: Ditto.
+
+ * create_hash_table: Updated copyright and removed old comment.
+
+ * parser/Grammar.y: Changed "kjsyy" prefix to "jscyy" prefix.
+ * parser/Lexer.cpp: Ditto. Also changed KJS_DEBUG_LEX to
+ JSC_DEBUG_LEX.
+ (jscyylex):
+ (JSC::Lexer::lex):
+ * parser/Parser.cpp: Ditto.
+ (JSC::Parser::parse):
+
+ * pcre/dftables: Changed "kjs_pcre_" prefix to "jsc_pcre_".
+ * pcre/pcre_compile.cpp: Ditto.
+ (getOthercaseRange):
+ (encodeUTF8):
+ (compileBranch):
+ (calculateCompiledPatternLength):
+ * pcre/pcre_exec.cpp: Ditto.
+ (matchRef):
+ (getUTF8CharAndIncrementLength):
+ (match):
+ * pcre/pcre_internal.h: Ditto.
+ (toLowerCase):
+ (flipCase):
+ (classBitmapForChar):
+ (charTypeForChar):
+ * pcre/pcre_tables.cpp: Ditto.
+ * pcre/pcre_ucp_searchfuncs.cpp: Ditto.
+ (jsc_pcre_ucp_othercase):
+ * pcre/pcre_xclass.cpp: Ditto.
+ (getUTF8CharAndAdvancePointer):
+ (jsc_pcre_xclass):
+
+ * runtime/Collector.h: Updated header guards using the
+ clean-header-guards script.
+ * runtime/CollectorHeapIterator.h: Added missing header guard.
+ * runtime/Identifier.h: Updated header guards.
+ * runtime/JSFunction.h: Fixed end-of-namespace comment.
+
+ * runtime/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::reset): Renamed "kjsprint" debug function
+ to "jscprint". Changed implementation method from
+ globalFuncKJSPrint() to globalFuncJSCPrint().
+ * runtime/JSGlobalObjectFunctions.cpp:
+ (JSC::globalFuncJSCPrint): Renamed from globalFuncKJSPrint().
+ * runtime/JSGlobalObjectFunctions.h: Ditto.
+
+ * runtime/JSImmediate.h: Updated header guards.
+ * runtime/JSLock.h: Ditto.
+ * runtime/JSType.h: Ditto.
+ * runtime/JSWrapperObject.h: Ditto.
+ * runtime/Lookup.h: Ditto.
+ * runtime/Operations.h: Ditto.
+ * runtime/Protect.h: Ditto.
+ * runtime/RegExp.h: Ditto.
+ * runtime/UString.h: Ditto.
+
+ * tests/mozilla/js1_5/Array/regress-157652.js: Changed "KJS"
+ reference in comment to "JSC".
+
+ * wrec/CharacterClassConstructor.cpp: Change "kjs_pcre_" function
+ prefixes to "jsc_pcre_".
+ (JSC::WREC::CharacterClassConstructor::put):
+ (JSC::WREC::CharacterClassConstructor::flush):
+
+ * wtf/unicode/Unicode.h: Change "KJS_" header guard to "WTF_".
+ * wtf/unicode/icu/UnicodeIcu.h: Ditto.
+ * wtf/unicode/qt4/UnicodeQt4.h: Ditto.
+
+2009-01-02 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Make randomNumber generate 2^53 values instead of 2^32 (or 2^31 for rand() platforms)
+
+ * wtf/RandomNumber.cpp:
+ (WTF::randomNumber):
+
+2009-01-02 David Kilzer <ddkilzer@apple.com>
+
+ Remove declaration for JSC::Identifier::initializeIdentifierThreading()
+
+ Reviewed by Alexey Proskuryakov.
+
+ * runtime/Identifier.h:
+ (JSC::Identifier::initializeIdentifierThreading): Removed
+ declaration since the implementation was removed in r34412.
+
+2009-01-01 Darin Adler <darin@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ String.replace does not support $& replacement metacharacter when search term is not a RegExp
+ <https://bugs.webkit.org/show_bug.cgi?id=21431>
+ <rdar://problem/6274993>
+
+ Test: fast/js/string-replace-3.html
+
+ * runtime/StringPrototype.cpp:
+ (JSC::substituteBackreferences): Added a null check here so we won't try to handle $$-$9
+ backreferences when the search term is a string, not a RegExp. Added a check for 0 so we
+ won't try to handle $0 or $00 as a backreference.
+ (JSC::stringProtoFuncReplace): Added a call to substituteBackreferences.
+
+2009-01-01 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Allow 32-bit integers to be stored in JSImmediates, on x64-bit.
+ Presently the top 32-bits of a 64-bit JSImmediate serve as a sign extension of a 31-bit
+ int stored in the low word (shifted left by one, to make room for a tag). In the new
+ format, the top 31-bits serve as a sign extension of a 32-bit int, still shifted left by
+ one.
+
+ The new behavior is enabled using a flag in Platform.h, 'WTF_USE_ALTERNATE_JSIMMEDIATE'.
+ When this is set the constants defining the range of ints allowed to be stored as
+ JSImmediate values is extended. The code in JSImmediate.h can safely operate on either
+ format. This patch updates the JIT so that it can also operate with the new format.
+
+ ~2% progression on x86-64, with & without the JIT, on sunspider & v8 tests.
+
+ * assembler/MacroAssembler.h:
+ (JSC::MacroAssembler::addPtr):
+ (JSC::MacroAssembler::orPtr):
+ (JSC::MacroAssembler::or32):
+ (JSC::MacroAssembler::rshiftPtr):
+ (JSC::MacroAssembler::rshift32):
+ (JSC::MacroAssembler::subPtr):
+ (JSC::MacroAssembler::xorPtr):
+ (JSC::MacroAssembler::xor32):
+ (JSC::MacroAssembler::move):
+ (JSC::MacroAssembler::compareImm64ForBranch):
+ (JSC::MacroAssembler::compareImm64ForBranchEquality):
+ (JSC::MacroAssembler::jePtr):
+ (JSC::MacroAssembler::jgePtr):
+ (JSC::MacroAssembler::jlPtr):
+ (JSC::MacroAssembler::jlePtr):
+ (JSC::MacroAssembler::jnePtr):
+ (JSC::MacroAssembler::jnzSubPtr):
+ (JSC::MacroAssembler::joAddPtr):
+ (JSC::MacroAssembler::jzSubPtr):
+ * assembler/X86Assembler.h:
+ (JSC::X86Assembler::addq_rr):
+ (JSC::X86Assembler::orq_ir):
+ (JSC::X86Assembler::subq_ir):
+ (JSC::X86Assembler::xorq_rr):
+ (JSC::X86Assembler::sarq_CLr):
+ (JSC::X86Assembler::sarq_i8r):
+ (JSC::X86Assembler::cmpq_ir):
+ * jit/JIT.cpp:
+ (JSC::JIT::compileOpStrictEq):
+ (JSC::JIT::privateCompileMainPass):
+ (JSC::JIT::privateCompileSlowCases):
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ * jit/JIT.h:
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::compileFastArith_op_lshift):
+ (JSC::JIT::compileFastArithSlow_op_lshift):
+ (JSC::JIT::compileFastArith_op_rshift):
+ (JSC::JIT::compileFastArithSlow_op_rshift):
+ (JSC::JIT::compileFastArith_op_bitand):
+ (JSC::JIT::compileFastArithSlow_op_bitand):
+ (JSC::JIT::compileFastArith_op_mod):
+ (JSC::JIT::compileFastArithSlow_op_mod):
+ (JSC::JIT::compileFastArith_op_add):
+ (JSC::JIT::compileFastArithSlow_op_add):
+ (JSC::JIT::compileFastArith_op_mul):
+ (JSC::JIT::compileFastArithSlow_op_mul):
+ (JSC::JIT::compileFastArith_op_post_inc):
+ (JSC::JIT::compileFastArithSlow_op_post_inc):
+ (JSC::JIT::compileFastArith_op_post_dec):
+ (JSC::JIT::compileFastArithSlow_op_post_dec):
+ (JSC::JIT::compileFastArith_op_pre_inc):
+ (JSC::JIT::compileFastArithSlow_op_pre_inc):
+ (JSC::JIT::compileFastArith_op_pre_dec):
+ (JSC::JIT::compileFastArithSlow_op_pre_dec):
+ (JSC::JIT::compileBinaryArithOp):
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::getConstantOperand):
+ (JSC::JIT::getConstantOperandImmediateInt):
+ (JSC::JIT::isOperandConstantImmediateInt):
+ (JSC::JIT::isOperandConstant31BitImmediateInt):
+ (JSC::JIT::emitFastArithDeTagImmediate):
+ (JSC::JIT::emitFastArithDeTagImmediateJumpIfZero):
+ (JSC::JIT::emitFastArithReTagImmediate):
+ (JSC::JIT::emitFastArithImmToInt):
+ (JSC::JIT::emitFastArithIntToImmNoCheck):
+ * runtime/JSImmediate.h:
+ (JSC::JSImmediate::isPositiveNumber):
+ (JSC::JSImmediate::isNegative):
+ (JSC::JSImmediate::rightShiftImmediateNumbers):
+ (JSC::JSImmediate::canDoFastAdditiveOperations):
+ (JSC::JSImmediate::makeValue):
+ (JSC::JSImmediate::makeInt):
+ (JSC::JSImmediate::makeBool):
+ (JSC::JSImmediate::intValue):
+ (JSC::JSImmediate::rawValue):
+ (JSC::JSImmediate::toBoolean):
+ (JSC::JSImmediate::from):
+ * wtf/Platform.h:
+
+2008-12-31 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ [jsfunfuzz] Assertion + incorrect behaviour with dynamically created local variable in a catch block
+ <https://bugs.webkit.org/show_bug.cgi?id=23063>
+
+ Eval inside a catch block attempts to use the catch block's static scope in
+ an unsafe way by attempting to add new properties to the scope. This patch
+ fixes this issue simply by preventing the catch block from using a static
+ scope if it contains an eval.
+
+ * parser/Grammar.y:
+ * parser/Nodes.cpp:
+ (JSC::TryNode::emitBytecode):
+ * parser/Nodes.h:
+ (JSC::TryNode::):
+
+2008-12-31 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ [jsfunfuzz] Computed exception offset wrong when first instruction is attempt to resolve deleted eval
+ <https://bugs.webkit.org/show_bug.cgi?id=23062>
+
+ This was caused by the expression information for the initial resolve of
+ eval not being emitted. If this resolve was the first instruction that
+ could throw an exception the information search would fail leading to an
+ assertion failure. If it was not the first throwable opcode the wrong
+ expression information would used.
+
+ Fix is simply to emit the expression info.
+
+ * parser/Nodes.cpp:
+ (JSC::EvalFunctionCallNode::emitBytecode):
+
+2008-12-31 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 23054: Caching of global lookups occurs even when the global object has become a dictionary
+ <https://bugs.webkit.org/show_bug.cgi?id=23054>
+ <rdar://problem/6469905>
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::resolveGlobal): Do not cache lookup if the global
+ object has transitioned to a dictionary.
+ (JSC::Interpreter::cti_op_resolve_global): Do not cache lookup if the
+ global object has transitioned to a dictionary.
+
+2008-12-30 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Darin Adler.
+
+ <https://bugs.webkit.org/show_bug.cgi?id=23049> [jsfunfuzz] With blocks do not correctly protect their scope object
+ <rdar://problem/6469742> Crash in JSC::TypeInfo::hasStandardGetOwnPropertySlot() running jsfunfuzz
+
+ The problem that caused this was that with nodes were not correctly protecting
+ the final object that was placed in the scope chain. We correct this by forcing
+ the use of a temporary register (which stops us relying on a local register
+ protecting the scope) and changing the behaviour of op_push_scope so that it
+ will store the final scope object.
+
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::emitPushScope):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+ (JSC::Interpreter::cti_op_push_scope):
+ * interpreter/Interpreter.h:
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ * parser/Nodes.cpp:
+ (JSC::WithNode::emitBytecode):
+
+2008-12-30 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Sam Weinig.
+
+ Bug 23037: Parsing and reparsing disagree on automatic semicolon insertion
+ <https://bugs.webkit.org/show_bug.cgi?id=23037>
+ <rdar://problem/6467124>
+
+ Parsing and reparsing disagree about automatic semicolon insertion, so that a
+ function like
+
+ function() { a = 1, }
+
+ is parsed as being syntactically valid but gets a syntax error upon reparsing.
+ This leads to an assertion failure in Parser::reparse(). It is not that big of
+ an issue in practice, because in a Release build such a function will return
+ 'undefined' when called.
+
+ In this case, we are not following the spec and it should be a syntax error.
+ However, unless there is a newline separating the ',' and the '}', WebKit would
+ not treat it as a syntax error in the past either. It would be a bit of work to
+ make the automatic semicolon insertion match the spec exactly, so this patch
+ changes it to match our past behaviour.
+
+ The problem is that even during reparsing, the Lexer adds a semicolon at the
+ end of the input, which confuses allowAutomaticSemicolon(), because it is
+ expecting either a '}', the end of input, or a terminator like a newline.
+
+ * parser/Lexer.cpp:
+ (JSC::Lexer::Lexer): Initialize m_isReparsing to false.
+ (JSC::Lexer::lex): Do not perform automatic semicolon insertion in the Lexer if
+ we are in the middle of reparsing.
+ (JSC::Lexer::clear): Set m_isReparsing to false.
+ * parser/Lexer.h:
+ (JSC::Lexer::setIsReparsing): Added.
+ * parser/Parser.cpp:
+ (JSC::Parser::reparse): Call Lexer::setIsReparsing() to notify the Lexer of
+ reparsing.
+
+2008-12-29 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by NOBODY (Build fix).
+
+ Yet another attempt to fix Tiger.
+
+ * wtf/RandomNumber.cpp:
+ (WTF::randomNumber):
+
+2008-12-29 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by NOBODY (Build fix).
+
+ Tiger build fix (correct this time)
+
+ * wtf/RandomNumber.cpp:
+
+2008-12-29 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Rubber-stamped by Alexey Proskuryakov.
+
+ Revert r39509, because kjsyydebug is used in the generated code if YYDEBUG is 1.
+
+ * parser/Grammar.y:
+
+2008-12-29 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by NOBODY (Build fix).
+
+ Tiger build fix.
+
+ * wtf/RandomNumber.cpp:
+
+2008-12-29 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Mark Rowe.
+
+ <rdar://problem/6358108> Insecure randomness in Math.random() leads to user tracking
+
+ Switch to arc4random on PLATFORM(DARWIN), this is ~1.5x slower than random(), but the
+ it is still so fast that there is no fathomable way it could be a bottleneck for anything.
+
+ randomNumber is called in two places
+ * During form submission where it is called once per form
+ * Math.random in JSC. For this difference to show up you have to be looping on
+ a cached local copy of random, for a large (>10000) calls.
+
+ No change in SunSpider.
+
+ * wtf/RandomNumber.cpp:
+ (WTF::randomNumber):
+ * wtf/RandomNumberSeed.h:
+ (WTF::initializeRandomNumberGenerator):
+
+2008-12-29 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Rubber-stamped by Sam Weinig.
+
+ Remove unused kjsyydebug #define.
+
+ * parser/Grammar.y:
+
+2008-12-29 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Oliver Hunt and Sam Weinig.
+
+ Bug 23029: REGRESSION (r39337): jsfunfuzz generates identical test files
+ <https://bugs.webkit.org/show_bug.cgi?id=23029>
+ <rdar://problem/6469185>
+
+ The unification of random number generation in r39337 resulted in random()
+ being initialized on Darwin, but rand() actually being used. Fix this by
+ making randomNumber() use random() instead of rand() on Darwin.
+
+ * wtf/RandomNumber.cpp:
+ (WTF::randomNumber):
+
+2008-12-29 Sam Weinig <sam@webkit.org>
+
+ Fix buildbots.
+
+ * runtime/Structure.cpp:
+
+2008-12-29 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Oliver Hunt.
+
+ Patch for https://bugs.webkit.org/show_bug.cgi?id=23026
+ Move the deleted offsets vector into the PropertyMap
+
+ Saves 3 words per Structure.
+
+ * runtime/PropertyMapHashTable.h:
+ * runtime/Structure.cpp:
+ (JSC::Structure::addPropertyTransition):
+ (JSC::Structure::changePrototypeTransition):
+ (JSC::Structure::getterSetterTransition):
+ (JSC::Structure::toDictionaryTransition):
+ (JSC::Structure::fromDictionaryTransition):
+ (JSC::Structure::copyPropertyTable):
+ (JSC::Structure::put):
+ (JSC::Structure::remove):
+ (JSC::Structure::rehashPropertyMapHashTable):
+ * runtime/Structure.h:
+ (JSC::Structure::propertyStorageSize):
+
+2008-12-29 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Oliver Hunt.
+
+ Change code using m_body.get() as a boolean to take advantage of the
+ implicit conversion of RefPtr to boolean.
+
+ * runtime/JSFunction.cpp:
+ (JSC::JSFunction::~JSFunction):
+
+2008-12-28 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 22840: REGRESSION (r38349): Gmail doesn't load with profiling enabled
+ <https://bugs.webkit.org/show_bug.cgi?id=22840>
+ <rdar://problem/6468077>
+
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::emitNewArray): Add an assertion that the range
+ of registers passed to op_new_array is sequential.
+ (JSC::BytecodeGenerator::emitCall): Correct the relocation of registers
+ when emitting profiler hooks so that registers aren't leaked. Also, add
+ an assertion that the 'this' register is always ref'd (because it is),
+ remove the needless protection of the 'this' register when relocating,
+ and add an assertion that the range of registers passed to op_call for
+ function call arguments is sequential.
+ (JSC::BytecodeGenerator::emitConstruct): Correct the relocation of
+ registers when emitting profiler hooks so that registers aren't leaked.
+ Also, add an assertion that the range of registers passed to op_construct
+ for function call arguments is sequential.
+
+2008-12-26 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Alexey Proskuryakov.
+
+ <rdar://problem/6467376> Race condition in WTF::currentThread can lead to a thread using two different identifiers during its lifetime
+
+ If a newly-created thread calls WTF::currentThread() before WTF::createThread calls establishIdentifierForPthreadHandle
+ then more than one identifier will be used for the same thread. We can avoid this by adding some extra synchronization
+ during thread creation that delays the execution of the thread function until the thread identifier has been set up, and
+ an assertion to catch this problem should it reappear in the future.
+
+ * wtf/Threading.cpp: Added.
+ (WTF::NewThreadContext::NewThreadContext):
+ (WTF::threadEntryPoint):
+ (WTF::createThread): Add cross-platform createThread function that delays the execution of the thread function until
+ after the thread identifier has been set up.
+ * wtf/Threading.h:
+ * wtf/ThreadingGtk.cpp:
+ (WTF::establishIdentifierForThread):
+ (WTF::createThreadInternal):
+ * wtf/ThreadingNone.cpp:
+ (WTF::createThreadInternal):
+ * wtf/ThreadingPthreads.cpp:
+ (WTF::establishIdentifierForPthreadHandle):
+ (WTF::createThreadInternal):
+ * wtf/ThreadingQt.cpp:
+ (WTF::identifierByQthreadHandle):
+ (WTF::establishIdentifierForThread):
+ (WTF::createThreadInternal):
+ * wtf/ThreadingWin.cpp:
+ (WTF::storeThreadHandleByIdentifier):
+ (WTF::createThreadInternal):
+
+ Add Threading.cpp to the build.
+
+ * GNUmakefile.am:
+ * JavaScriptCore.pri:
+ * JavaScriptCore.scons:
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * JavaScriptCoreSources.bkl:
+
+2008-12-26 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Remove unused method.
+
+ * runtime/Structure.h: Remove mutableTypeInfo.
+
+2008-12-22 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Fix rounding / bounds / signed comparison bug in ExecutableAllocator.
+
+ ExecutableAllocator::alloc assumed that m_freePtr would be aligned. This was
+ not always true, since the first allocation from an additional pool would not
+ be rounded up. Subsequent allocations would be unaligned, and too much memory
+ could be erroneously allocated from the pool, when the size requested was
+ available, but the size rounded up to word granularity was not available in the
+ pool. This may result in the value of m_freePtr being greater than m_end.
+
+ Under these circumstances, the unsigned check for space will always pass,
+ resulting in pointers to memory outside of the arena being returned, and
+ ultimately segfaulty goodness when attempting to memcpy the hot freshly jitted
+ code from the AssemblerBuffer.
+
+ https://bugs.webkit.org/show_bug.cgi?id=22974
+ ... and probably many, many more.
+
+ * jit/ExecutableAllocator.h:
+ (JSC::ExecutablePool::alloc):
+ (JSC::ExecutablePool::roundUpAllocationSize):
+ (JSC::ExecutablePool::ExecutablePool):
+ (JSC::ExecutablePool::poolAllocate):
+
+2008-12-22 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Gavin Barraclough.
+
+ Rename all uses of the term "repatch" to "patch".
+
+ * assembler/MacroAssembler.h:
+ (JSC::MacroAssembler::DataLabelPtr::patch):
+ (JSC::MacroAssembler::DataLabel32::patch):
+ (JSC::MacroAssembler::Jump::patch):
+ (JSC::MacroAssembler::PatchBuffer::PatchBuffer):
+ (JSC::MacroAssembler::PatchBuffer::setPtr):
+ (JSC::MacroAssembler::loadPtrWithAddressOffsetPatch):
+ (JSC::MacroAssembler::storePtrWithAddressOffsetPatch):
+ (JSC::MacroAssembler::storePtrWithPatch):
+ (JSC::MacroAssembler::jnePtrWithPatch):
+ * assembler/X86Assembler.h:
+ (JSC::X86Assembler::patchAddress):
+ (JSC::X86Assembler::patchImmediate):
+ (JSC::X86Assembler::patchPointer):
+ (JSC::X86Assembler::patchBranchOffset):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::tryCTICachePutByID):
+ (JSC::Interpreter::tryCTICacheGetByID):
+ (JSC::Interpreter::cti_op_put_by_id):
+ (JSC::Interpreter::cti_op_get_by_id):
+ (JSC::Interpreter::cti_op_get_by_id_self_fail):
+ (JSC::Interpreter::cti_op_get_by_id_proto_list):
+ (JSC::Interpreter::cti_vm_dontLazyLinkCall):
+ * jit/JIT.cpp:
+ (JSC::ctiPatchCallByReturnAddress):
+ (JSC::JIT::privateCompileMainPass):
+ (JSC::JIT::privateCompile):
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ * jit/JIT.h:
+ * jit/JITCall.cpp:
+ (JSC::JIT::unlinkCall):
+ (JSC::JIT::linkCall):
+ (JSC::JIT::compileOpCall):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::compileGetByIdHotPath):
+ (JSC::JIT::compilePutByIdHotPath):
+ (JSC::JIT::compileGetByIdSlowCase):
+ (JSC::JIT::compilePutByIdSlowCase):
+ (JSC::JIT::privateCompilePutByIdTransition):
+ (JSC::JIT::patchGetByIdSelf):
+ (JSC::JIT::patchPutByIdReplace):
+ (JSC::JIT::privateCompilePatchGetArrayLength):
+ (JSC::JIT::privateCompileGetByIdSelf):
+ (JSC::JIT::privateCompileGetByIdProto):
+ (JSC::JIT::privateCompileGetByIdSelfList):
+ (JSC::JIT::privateCompileGetByIdProtoList):
+ (JSC::JIT::privateCompileGetByIdChainList):
+ (JSC::JIT::privateCompileGetByIdChain):
+ (JSC::JIT::privateCompilePutByIdReplace):
+
+2008-12-22 Adam Roben <aroben@apple.com>
+
+ Build fix after r39428
+
+ * jit/JITCall.cpp:
+ (JSC::JIT::compileOpCallSlowCase): Added a missing MacroAssembler::
+
+2008-12-22 Nikolas Zimmermann <nikolas.zimmermann@torchmobile.com>
+
+ Rubber-stamped by George Staikos.
+
+ Unify all TorchMobile copyright lines. Consolidate in a single line, as requested by Mark Rowe, some time ago.
+
+ * wtf/RandomNumber.cpp:
+ * wtf/RandomNumber.h:
+ * wtf/RandomNumberSeed.h:
+
+2008-12-21 Nikolas Zimmermann <nikolas.zimmermann@torchmobile.com>
+
+ Rubber-stamped by George Staikos.
+
+ Fix copyright of the new RandomNumber* files.
+
+ * wtf/RandomNumber.cpp:
+ * wtf/RandomNumber.h:
+ * wtf/RandomNumberSeed.h:
+
+2008-12-21 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt & Cameron Zwarich.
+
+ Add support for call and property access repatching on x86-64.
+
+ No change in performance on current configurations (2x impovement on v8-tests with JIT enabled on x86-64).
+
+ * assembler/MacroAssembler.h:
+ (JSC::MacroAssembler::DataLabelPtr::repatch):
+ (JSC::MacroAssembler::DataLabelPtr::operator X86Assembler::JmpDst):
+ (JSC::MacroAssembler::DataLabel32::repatch):
+ (JSC::MacroAssembler::RepatchBuffer::addressOf):
+ (JSC::MacroAssembler::add32):
+ (JSC::MacroAssembler::sub32):
+ (JSC::MacroAssembler::loadPtrWithAddressOffsetRepatch):
+ (JSC::MacroAssembler::storePtrWithAddressOffsetRepatch):
+ (JSC::MacroAssembler::jePtr):
+ (JSC::MacroAssembler::jnePtr):
+ (JSC::MacroAssembler::jnePtrWithRepatch):
+ (JSC::MacroAssembler::differenceBetween):
+ * assembler/X86Assembler.h:
+ (JSC::X86Assembler::addl_im):
+ (JSC::X86Assembler::subl_im):
+ (JSC::X86Assembler::cmpl_rm):
+ (JSC::X86Assembler::movq_rm_disp32):
+ (JSC::X86Assembler::movq_mr_disp32):
+ (JSC::X86Assembler::repatchPointer):
+ (JSC::X86Assembler::X86InstructionFormatter::oneByteOp64_disp32):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompile):
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ * jit/JIT.h:
+ * jit/JITCall.cpp:
+ (JSC::JIT::unlinkCall):
+ (JSC::JIT::linkCall):
+ (JSC::JIT::compileOpCall):
+ (JSC::JIT::compileOpCallSlowCase):
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::restoreArgumentReferenceForTrampoline):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::compileGetByIdHotPath):
+ (JSC::JIT::compileGetByIdSlowCase):
+ (JSC::JIT::compilePutByIdHotPath):
+ (JSC::JIT::compilePutByIdSlowCase):
+ (JSC::resizePropertyStorage):
+ (JSC::JIT::privateCompilePutByIdTransition):
+ (JSC::JIT::privateCompileGetByIdProto):
+ (JSC::JIT::privateCompileGetByIdProtoList):
+ (JSC::JIT::privateCompileGetByIdChainList):
+ (JSC::JIT::privateCompileGetByIdChain):
+ * wtf/Platform.h:
+
+2008-12-20 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Port optimized property access generation to the MacroAssembler.
+
+ * assembler/MacroAssembler.h:
+ (JSC::MacroAssembler::AbsoluteAddress::AbsoluteAddress):
+ (JSC::MacroAssembler::DataLabelPtr::repatch):
+ (JSC::MacroAssembler::DataLabel32::DataLabel32):
+ (JSC::MacroAssembler::DataLabel32::repatch):
+ (JSC::MacroAssembler::Label::operator X86Assembler::JmpDst):
+ (JSC::MacroAssembler::Jump::repatch):
+ (JSC::MacroAssembler::JumpList::empty):
+ (JSC::MacroAssembler::RepatchBuffer::link):
+ (JSC::MacroAssembler::add32):
+ (JSC::MacroAssembler::and32):
+ (JSC::MacroAssembler::sub32):
+ (JSC::MacroAssembler::loadPtrWithAddressRepatch):
+ (JSC::MacroAssembler::storePtrWithAddressRepatch):
+ (JSC::MacroAssembler::push):
+ (JSC::MacroAssembler::ja32):
+ (JSC::MacroAssembler::jePtr):
+ (JSC::MacroAssembler::jnePtr):
+ (JSC::MacroAssembler::jnePtrWithRepatch):
+ (JSC::MacroAssembler::align):
+ (JSC::MacroAssembler::differenceBetween):
+ * assembler/X86Assembler.h:
+ (JSC::X86Assembler::movl_rm_disp32):
+ (JSC::X86Assembler::movl_mr_disp32):
+ (JSC::X86Assembler::X86InstructionFormatter::oneByteOp_disp32):
+ (JSC::X86Assembler::X86InstructionFormatter::memoryModRM):
+ * jit/JIT.cpp:
+ (JSC::ctiRepatchCallByReturnAddress):
+ (JSC::JIT::privateCompileMainPass):
+ (JSC::JIT::privateCompile):
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ * jit/JIT.h:
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::compileGetByIdHotPath):
+ (JSC::JIT::compileGetByIdSlowCase):
+ (JSC::JIT::compilePutByIdHotPath):
+ (JSC::JIT::compilePutByIdSlowCase):
+ (JSC::resizePropertyStorage):
+ (JSC::JIT::privateCompilePutByIdTransition):
+ (JSC::JIT::patchGetByIdSelf):
+ (JSC::JIT::patchPutByIdReplace):
+ (JSC::JIT::privateCompilePatchGetArrayLength):
+ (JSC::JIT::privateCompileGetByIdSelf):
+ (JSC::JIT::privateCompileGetByIdProto):
+ (JSC::JIT::privateCompileGetByIdSelfList):
+ (JSC::JIT::privateCompileGetByIdProtoList):
+ (JSC::JIT::privateCompileGetByIdChainList):
+ (JSC::JIT::privateCompileGetByIdChain):
+ (JSC::JIT::privateCompilePutByIdReplace):
+ * wtf/RefCounted.h:
+ (WTF::RefCountedBase::addressOfCount):
+
+2008-12-19 Gustavo Noronha Silva <gns@gnome.org>
+
+ Reviewed by Holger Freyther.
+
+ https://bugs.webkit.org/show_bug.cgi?id=22686
+
+ Added file which was missing to the javascriptcore_sources
+ variable, so that it shows up in the tarball created by `make
+ dist'.
+
+ * GNUmakefile.am:
+
+2008-12-19 Holger Hans Peter Freyther <zecke@selfish.org>
+
+ Reviewed by Antti Koivisto.
+
+ Build fix when building JS API tests with a c89 c compiler
+
+ Do not use C++ style comments and convert them to C comments.
+
+ * wtf/Platform.h:
+
+2008-12-18 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Same as last revision, adding cases for pre & post inc & dec.
+
+ https://bugs.webkit.org/show_bug.cgi?id=22928
+
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+
+2008-12-18 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Fixes for the JIT's handling of JSImmediate values on x86-64.
+ On 64-bit systems, the code in JSImmediate.h relies on the upper
+ bits of a JSImmediate being a sign extension of the low 32-bits.
+ This was not being enforced by the JIT, since a number of inline
+ operations were being performed on 32-bit values in registers, and
+ when a 32-bit result is written to a register on x86-64 the value
+ is zero-extended to 64-bits.
+
+ This fix honors previous behavoir. A better fix in the long run
+ (when the JIT is enabled by default) may be to change JSImmediate.h
+ so it no longer relies on the upper bits of the pointer,... though
+ if we're going to change JSImmediate.h for 64-bit, we probably may
+ as well change the format so that the full range of 32-bit ints can
+ be stored, rather than just 31-bits.
+
+ https://bugs.webkit.org/show_bug.cgi?id=22925
+
+ * assembler/MacroAssembler.h:
+ (JSC::MacroAssembler::addPtr):
+ (JSC::MacroAssembler::andPtr):
+ (JSC::MacroAssembler::orPtr):
+ (JSC::MacroAssembler::or32):
+ (JSC::MacroAssembler::xor32):
+ (JSC::MacroAssembler::xorPtr):
+ (JSC::MacroAssembler::signExtend32ToPtr):
+ * assembler/X86Assembler.h:
+ (JSC::X86Assembler::):
+ (JSC::X86Assembler::andq_rr):
+ (JSC::X86Assembler::andq_ir):
+ (JSC::X86Assembler::orq_rr):
+ (JSC::X86Assembler::xorq_ir):
+ (JSC::X86Assembler::movsxd_rr):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::emitFastArithReTagImmediate):
+ (JSC::JIT::emitFastArithPotentiallyReTagImmediate):
+ (JSC::JIT::emitFastArithImmToInt):
+
+2008-12-18 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Just a tidy up - rename & refactor some the #defines configuring the JIT.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::cti_op_convert_this):
+ (JSC::Interpreter::cti_op_end):
+ (JSC::Interpreter::cti_op_add):
+ (JSC::Interpreter::cti_op_pre_inc):
+ (JSC::Interpreter::cti_timeout_check):
+ (JSC::Interpreter::cti_register_file_check):
+ (JSC::Interpreter::cti_op_loop_if_less):
+ (JSC::Interpreter::cti_op_loop_if_lesseq):
+ (JSC::Interpreter::cti_op_new_object):
+ (JSC::Interpreter::cti_op_put_by_id_generic):
+ (JSC::Interpreter::cti_op_get_by_id_generic):
+ (JSC::Interpreter::cti_op_put_by_id):
+ (JSC::Interpreter::cti_op_put_by_id_second):
+ (JSC::Interpreter::cti_op_put_by_id_fail):
+ (JSC::Interpreter::cti_op_get_by_id):
+ (JSC::Interpreter::cti_op_get_by_id_second):
+ (JSC::Interpreter::cti_op_get_by_id_self_fail):
+ (JSC::Interpreter::cti_op_get_by_id_proto_list):
+ (JSC::Interpreter::cti_op_get_by_id_proto_list_full):
+ (JSC::Interpreter::cti_op_get_by_id_proto_fail):
+ (JSC::Interpreter::cti_op_get_by_id_array_fail):
+ (JSC::Interpreter::cti_op_get_by_id_string_fail):
+ (JSC::Interpreter::cti_op_instanceof):
+ (JSC::Interpreter::cti_op_del_by_id):
+ (JSC::Interpreter::cti_op_mul):
+ (JSC::Interpreter::cti_op_new_func):
+ (JSC::Interpreter::cti_op_call_JSFunction):
+ (JSC::Interpreter::cti_op_call_arityCheck):
+ (JSC::Interpreter::cti_vm_dontLazyLinkCall):
+ (JSC::Interpreter::cti_vm_lazyLinkCall):
+ (JSC::Interpreter::cti_op_push_activation):
+ (JSC::Interpreter::cti_op_call_NotJSFunction):
+ (JSC::Interpreter::cti_op_create_arguments):
+ (JSC::Interpreter::cti_op_create_arguments_no_params):
+ (JSC::Interpreter::cti_op_tear_off_activation):
+ (JSC::Interpreter::cti_op_tear_off_arguments):
+ (JSC::Interpreter::cti_op_profile_will_call):
+ (JSC::Interpreter::cti_op_profile_did_call):
+ (JSC::Interpreter::cti_op_ret_scopeChain):
+ (JSC::Interpreter::cti_op_new_array):
+ (JSC::Interpreter::cti_op_resolve):
+ (JSC::Interpreter::cti_op_construct_JSConstruct):
+ (JSC::Interpreter::cti_op_construct_NotJSConstruct):
+ (JSC::Interpreter::cti_op_get_by_val):
+ (JSC::Interpreter::cti_op_resolve_func):
+ (JSC::Interpreter::cti_op_sub):
+ (JSC::Interpreter::cti_op_put_by_val):
+ (JSC::Interpreter::cti_op_put_by_val_array):
+ (JSC::Interpreter::cti_op_lesseq):
+ (JSC::Interpreter::cti_op_loop_if_true):
+ (JSC::Interpreter::cti_op_negate):
+ (JSC::Interpreter::cti_op_resolve_base):
+ (JSC::Interpreter::cti_op_resolve_skip):
+ (JSC::Interpreter::cti_op_resolve_global):
+ (JSC::Interpreter::cti_op_div):
+ (JSC::Interpreter::cti_op_pre_dec):
+ (JSC::Interpreter::cti_op_jless):
+ (JSC::Interpreter::cti_op_not):
+ (JSC::Interpreter::cti_op_jtrue):
+ (JSC::Interpreter::cti_op_post_inc):
+ (JSC::Interpreter::cti_op_eq):
+ (JSC::Interpreter::cti_op_lshift):
+ (JSC::Interpreter::cti_op_bitand):
+ (JSC::Interpreter::cti_op_rshift):
+ (JSC::Interpreter::cti_op_bitnot):
+ (JSC::Interpreter::cti_op_resolve_with_base):
+ (JSC::Interpreter::cti_op_new_func_exp):
+ (JSC::Interpreter::cti_op_mod):
+ (JSC::Interpreter::cti_op_less):
+ (JSC::Interpreter::cti_op_neq):
+ (JSC::Interpreter::cti_op_post_dec):
+ (JSC::Interpreter::cti_op_urshift):
+ (JSC::Interpreter::cti_op_bitxor):
+ (JSC::Interpreter::cti_op_new_regexp):
+ (JSC::Interpreter::cti_op_bitor):
+ (JSC::Interpreter::cti_op_call_eval):
+ (JSC::Interpreter::cti_op_throw):
+ (JSC::Interpreter::cti_op_get_pnames):
+ (JSC::Interpreter::cti_op_next_pname):
+ (JSC::Interpreter::cti_op_push_scope):
+ (JSC::Interpreter::cti_op_pop_scope):
+ (JSC::Interpreter::cti_op_typeof):
+ (JSC::Interpreter::cti_op_is_undefined):
+ (JSC::Interpreter::cti_op_is_boolean):
+ (JSC::Interpreter::cti_op_is_number):
+ (JSC::Interpreter::cti_op_is_string):
+ (JSC::Interpreter::cti_op_is_object):
+ (JSC::Interpreter::cti_op_is_function):
+ (JSC::Interpreter::cti_op_stricteq):
+ (JSC::Interpreter::cti_op_nstricteq):
+ (JSC::Interpreter::cti_op_to_jsnumber):
+ (JSC::Interpreter::cti_op_in):
+ (JSC::Interpreter::cti_op_push_new_scope):
+ (JSC::Interpreter::cti_op_jmp_scopes):
+ (JSC::Interpreter::cti_op_put_by_index):
+ (JSC::Interpreter::cti_op_switch_imm):
+ (JSC::Interpreter::cti_op_switch_char):
+ (JSC::Interpreter::cti_op_switch_string):
+ (JSC::Interpreter::cti_op_del_by_val):
+ (JSC::Interpreter::cti_op_put_getter):
+ (JSC::Interpreter::cti_op_put_setter):
+ (JSC::Interpreter::cti_op_new_error):
+ (JSC::Interpreter::cti_op_debug):
+ (JSC::Interpreter::cti_vm_throw):
+ * interpreter/Interpreter.h:
+ * jit/JIT.cpp:
+ (JSC::):
+ (JSC::JIT::privateCompileMainPass):
+ (JSC::JIT::privateCompile):
+ * jit/JIT.h:
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::restoreArgumentReference):
+ (JSC::JIT::restoreArgumentReferenceForTrampoline):
+ * wtf/Platform.h:
+
+2008-12-18 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Bug 21855: REGRESSION (r37323): Gmail complains about popup blocking when opening a link
+ <https://bugs.webkit.org/show_bug.cgi?id=21855>
+ <rdar://problem/6278244>
+
+ Move DynamicGlobalObjectScope to JSGlobalObject.h so that it can be used
+ from WebCore.
+
+ * interpreter/Interpreter.cpp:
+ * runtime/JSGlobalObject.h:
+ (JSC::DynamicGlobalObjectScope::DynamicGlobalObjectScope):
+ (JSC::DynamicGlobalObjectScope::~DynamicGlobalObjectScope):
+
+2008-12-17 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Fixed https://bugs.webkit.org/show_bug.cgi?id=22393
+ Segfault when caching property accesses to primitive cells.
+
+ Changed some asObject casts to asCell casts in cases where a primitive
+ value may be a cell and not an object.
+
+ Re-enabled property caching for primitives in cases where it had been
+ disabled because of this bug.
+
+ Updated a comment to better explain something Darin thought needed
+ explaining in an old patch review.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::countPrototypeChainEntriesAndCheckForProxies):
+ (JSC::Interpreter::tryCacheGetByID):
+ (JSC::Interpreter::tryCTICacheGetByID):
+ (JSC::Interpreter::cti_op_get_by_id_self_fail):
+ (JSC::Interpreter::cti_op_get_by_id_proto_list):
+
+2008-12-17 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ Fixes for Sunspider failures with the JIT enabled on x86-64.
+
+ * assembler/MacroAssembler.h:
+ Switch the order of the RegisterID & Address form of je32, to keep it consistent with jne32.
+ * jit/JIT.cpp:
+ * jit/JIT.h:
+ * jit/JITInlineMethods.h:
+ Port the m_ctiVirtualCall tramopline generation to use the MacroAssembler interface.
+ * jit/JITCall.cpp:
+ Fix bug in the non-optimizing code path, vptr check should have been to the memory address pointer
+ to by the register, not to the register itself.
+ * wrec/WRECGenerator.cpp:
+ See assembler/MacroAssembler.h, above.
+
+2008-12-17 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ print("Hello, 64-bit jitted world!");
+ Get hello-world working through the JIT, on x86-64.
+
+ * assembler/X86Assembler.h:
+ Fix encoding of opcode + RegisterID format instructions for 64-bit.
+ * interpreter/Interpreter.cpp:
+ * interpreter/Interpreter.h:
+ Make VoidPtrPair actually be a pair of void*s.
+ (Possibly should make this change for 32-bit Mac platforms, too - but won't change 32-bit behaviour in this patch).
+ * jit/JIT.cpp:
+ * jit/JIT.h:
+ Provide names for the timeoutCheckRegister & callFrameRegister on x86-64,
+ force x86-64 ctiTrampoline arguments onto the stack,
+ implement the asm trampolines for x86-64,
+ implement the restoreArgumentReference methods for x86-64 calling conventions.
+ * jit/JITCall.cpp:
+ * jit/JITInlineMethods.h:
+ * wtf/Platform.h:
+ Add switch settings to ENABLE(JIT), on PLATFORM(X86_64) (currently still disabled).
+
+2008-12-17 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Gavin Barraclough.
+
+ Add more CodeBlock statistics.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::dumpStatistics):
+
+2008-12-17 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ Fix for https://bugs.webkit.org/show_bug.cgi?id=22897
+ <rdar://problem/6428342>
+ Look into feasibility of discarding bytecode after native codegen
+
+ Clear the bytecode Instruction vector at the end JIT generation.
+
+ Saves 4.8 MB on Membuster head.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::dump): Add logging for the case that someone tries
+ to dump the instructions of a CodeBlock that has had its bytecode
+ vector cleared.
+ (JSC::CodeBlock::CodeBlock): Initialize the instructionCount
+ (JSC::CodeBlock::handlerForBytecodeOffset): Use instructionCount instead
+ of the size of the instruction vector in the assertion.
+ (JSC::CodeBlock::lineNumberForBytecodeOffset): Ditto.
+ (JSC::CodeBlock::expressionRangeForBytecodeOffset): Ditto.
+ (JSC::CodeBlock::getByIdExceptionInfoForBytecodeOffset): Ditto.
+ (JSC::CodeBlock::functionRegisterForBytecodeOffset): Ditto.
+ * bytecode/CodeBlock.h:
+ (JSC::CodeBlock::setInstructionCount): Store the instruction vector size
+ in debug builds for assertions.
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::generate):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompile): Clear the bytecode vector unless we
+ have compiled with Opcode sampling where we will continue to require it
+
+2008-12-17 Cary Clark <caryclark@google.com>
+
+ Reviewed by Darin Adler.
+ Landed by Adam Barth.
+
+ Add ENABLE_TEXT_CARET to permit the ANDROID platform
+ to invalidate and draw the caret in a separate thread.
+
+ * wtf/Platform.h:
+ Default ENABLE_TEXT_CARET to 1.
+
+2008-12-17 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ Don't use unique context group in JSGlobalContextCreate() on Tiger or Leopard, take two.
+
+ * API/JSContextRef.cpp: The previous patch that claimed to do this was making Tiger and
+ Leopard always use unique context group instead.
+
+2008-12-16 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ Fix for https://bugs.webkit.org/show_bug.cgi?id=22838
+ Remove dependency on the bytecode Instruction buffer in Interpreter::throwException
+ Part of <rdar://problem/6428342>
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::functionRegisterForBytecodeOffset): Added. Function to get
+ a function Register index in a callFrame for a bytecode offset.
+ (JSC::CodeBlock::shrinkToFit): Shrink m_getByIdExceptionInfo and m_functionRegisterInfos.
+ * bytecode/CodeBlock.h:
+ (JSC::FunctionRegisterInfo::FunctionRegisterInfo): Added.
+ (JSC::CodeBlock::addFunctionRegisterInfo):
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::emitCall):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::throwException): Use functionRegisterForBytecodeOffset in JIT
+ mode.
+
+2008-12-16 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Gavin Barraclough.
+
+ Fix for https://bugs.webkit.org/show_bug.cgi?id=22837
+ Remove dependency on the bytecode Instruction buffer in Interpreter::cti_op_call_NotJSFunction
+ Part of <rdar://problem/6428342>
+
+ * interpreter/CallFrame.h: Added comment regarding returnPC storing a void*.
+ * interpreter/Interpreter.cpp:
+ (JSC::bytecodeOffsetForPC): We no longer have any cases of the PC
+ being in the instruction stream for JIT, so we can remove the check.
+ (JSC::Interpreter::cti_op_call_NotJSFunction): Use the CTI_RETURN_ADDRESS
+ as the call frame returnPC as it is only necessary for looking up when
+ throwing an exception.
+ * interpreter/RegisterFile.h:
+ (JSC::RegisterFile::): Added comment regarding returnPC storing a void*.
+ * jit/JIT.h: Remove ARG_instr4.
+ * jit/JITCall.cpp:
+ (JSC::JIT::compileOpCallSetupArgs): Don't pass the instruction pointer.
+
+2008-12-16 Darin Adler <darin@apple.com>
+
+ Reviewed and landed by Cameron Zwarich.
+
+ Preparatory work for fixing
+
+ Bug 22887: Make UString::Rep use RefCounted rather than implementing its own ref counting
+ <https://bugs.webkit.org/show_bug.cgi?id=22887>
+
+ Change the various string translators used by Identifier:add() so that
+ they never zero the ref count of a newly created UString::Rep.
+
+ * runtime/Identifier.cpp:
+ (JSC::CStringTranslator::translate):
+ (JSC::Identifier::add):
+ (JSC::UCharBufferTranslator::translate):
+
+2008-12-16 Gavin Barraclough <barraclough@apple.com>
+
+ Build fix for 'doze.
+
+ * assembler/AssemblerBuffer.h:
+
+2008-12-16 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ Make the JIT compile on x86-64.
+ This largely involves populting the missing calls in MacroAssembler.h.
+ In addition some reinterpret_casts need removing from the JIT, and the
+ repatching property access code will need to be fully compiled out for
+ now. The changes in interpret.cpp are to reorder the functions so that
+ the _generic forms come before all other property access methods, and
+ then to place all property access methods other than the generic forms
+ under control of the ENABLE_JIT_OPTIMIZE_PROPERTY_ACCESS macro.
+
+ No performance impact.
+
+ * assembler/AssemblerBuffer.h:
+ (JSC::AssemblerBuffer::putInt64Unchecked):
+ * assembler/MacroAssembler.h:
+ (JSC::MacroAssembler::loadPtr):
+ (JSC::MacroAssembler::load32):
+ (JSC::MacroAssembler::storePtr):
+ (JSC::MacroAssembler::storePtrWithRepatch):
+ (JSC::MacroAssembler::store32):
+ (JSC::MacroAssembler::poke):
+ (JSC::MacroAssembler::move):
+ (JSC::MacroAssembler::testImm64):
+ (JSC::MacroAssembler::jePtr):
+ (JSC::MacroAssembler::jnePtr):
+ (JSC::MacroAssembler::jnzPtr):
+ (JSC::MacroAssembler::jzPtr):
+ * assembler/X86Assembler.h:
+ (JSC::X86Assembler::):
+ (JSC::X86Assembler::cmpq_rr):
+ (JSC::X86Assembler::cmpq_rm):
+ (JSC::X86Assembler::cmpq_im):
+ (JSC::X86Assembler::testq_i32m):
+ (JSC::X86Assembler::movl_mEAX):
+ (JSC::X86Assembler::movl_i32r):
+ (JSC::X86Assembler::movl_EAXm):
+ (JSC::X86Assembler::movq_rm):
+ (JSC::X86Assembler::movq_mEAX):
+ (JSC::X86Assembler::movq_mr):
+ (JSC::X86Assembler::movq_i64r):
+ (JSC::X86Assembler::movl_mr):
+ (JSC::X86Assembler::X86InstructionFormatter::oneByteOp64):
+ (JSC::X86Assembler::X86InstructionFormatter::immediate64):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::cti_op_put_by_id_generic):
+ (JSC::Interpreter::cti_op_get_by_id_generic):
+ (JSC::Interpreter::cti_op_put_by_id):
+ (JSC::Interpreter::cti_op_put_by_id_second):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ (JSC::JIT::privateCompile):
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ * jit/JITCall.cpp:
+ (JSC::JIT::compileOpCallSetupArgs):
+ (JSC::JIT::compileOpCall):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::compileGetByIdHotPath):
+ (JSC::JIT::compilePutByIdHotPath):
+ * runtime/JSImmediate.h:
+ (JSC::JSImmediate::makeInt):
+
+2008-12-16 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Bug 22869: REGRESSION (r38407): http://news.cnet.com/8301-13579_3-9953533-37.html crashes
+ <https://bugs.webkit.org/show_bug.cgi?id=22869>
+ <rdar://problem/6402499>
+
+ Before r38407, Structure::m_nameInPrevious was ref'd due to it being
+ stored in a PropertyMap. However, PropertyMaps are created lazily after
+ r38407, so Structure::m_nameInPrevious is not necessarily ref'd while
+ it is being used. Making it a RefPtr instead of a raw pointer fixes
+ the problem.
+
+ Unfortunately, the crash in the bug is rather intermittent, and it is
+ impossible to add an assertion in UString::Ref::ref() to catch this bug
+ because some users of UString::Rep deliberately zero out the reference
+ count. Therefore, there is no layout test accompanying this bug fix.
+
+ * runtime/Structure.cpp:
+ (JSC::Structure::~Structure): Use get().
+ (JSC::Structure::materializePropertyMap): Use get().
+ (JSC::Structure::addPropertyTransitionToExistingStructure): Use get().
+ (JSC::Structure::addPropertyTransition): Use get().
+ * runtime/Structure.h: Make Structure::m_nameInPrevious a RefPtr instead
+ of a raw pointer.
+
+2008-12-16 Nikolas Zimmermann <nikolas.zimmermann@torchmobile.com>
+
+ Not reviewed. Attempt to fix win build. No 'using namespace WTF' in this file, needs manual WTF:: prefix.
+ Not sure why the build works as is here.
+
+ * runtime/MathObject.cpp:
+ (JSC::mathProtoFuncRandom):
+
+2008-12-16 Nikolas Zimmermann <nikolas.zimmermann@torchmobile.com>
+
+ Reviewed by Darin Adler.
+
+ Fixes: https://bugs.webkit.org/show_bug.cgi?id=22876
+
+ Unify random number generation in JavaScriptCore & WebCore, by introducing
+ wtf/RandomNumber.h and moving wtf_random/wtf_random_init out of MathExtras.h.
+
+ wtf_random_init() has been renamed to initializeRandomNumberGenerator() and
+ lives in it's own private header: wtf/RandomNumberSeed.h, only intended to
+ be used from within JavaScriptCore.
+
+ wtf_random() has been renamed to randomNumber() and lives in a public header
+ wtf/RandomNumber.h, usable from within JavaScriptCore & WebCore. It encapsulates
+ the code taking care of initializing the random number generator (only when
+ building without ENABLE(JSC_MULTIPLE_THREADS), otherwhise initializeThreading()
+ already took care of that).
+
+ Functional change on darwin: Use random() instead of rand(), as it got a larger
+ period (more randomness). HTMLFormElement already contains this implementation
+ and I just moved it in randomNumber(), as special case for PLATFORM(DARWIN).
+
+ * GNUmakefile.am: Add RandomNumber.(cpp/h) / RandomNumberSeed.h.
+ * JavaScriptCore.exp: Ditto.
+ * JavaScriptCore.pri: Ditto.
+ * JavaScriptCore.scons: Ditto.
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj: Ditto.
+ * JavaScriptCore.xcodeproj/project.pbxproj: Ditto.
+ * JavaScriptCoreSources.bkl: Ditto.
+ * runtime/MathObject.cpp: Use new WTF::randomNumber() functionality.
+ (JSC::mathProtoFuncRandom):
+ * wtf/MathExtras.h: Move wtf_random / wtf_random_init to new files.
+ * wtf/RandomNumber.cpp: Added.
+ (WTF::randomNumber):
+ * wtf/RandomNumber.h: Added.
+ * wtf/RandomNumberSeed.h: Added. Internal usage within JSC only.
+ (WTF::initializeRandomNumberGenerator):
+ * wtf/ThreadingGtk.cpp: Rename wtf_random_init() to initializeRandomNumberGenerator().
+ (WTF::initializeThreading):
+ * wtf/ThreadingPthreads.cpp: Ditto.
+ (WTF::initializeThreading):
+ * wtf/ThreadingQt.cpp: Ditto.
+ (WTF::initializeThreading):
+ * wtf/ThreadingWin.cpp: Ditto.
+ (WTF::initializeThreading):
+
+2008-12-16 Yael Aharon <yael.aharon@nokia.com>
+
+ Reviewed by Tor Arne Vestbø.
+
+ Qt/Win build fix
+
+ * JavaScriptCore.pri:
+
+2008-12-15 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ Fix the build with GCC 4.0.
+
+ * Configurations/JavaScriptCore.xcconfig: GCC 4.0 appears to have a bug when compiling with -funwind-tables on,
+ so don't use it with that compiler version.
+
+2008-12-15 Mark Rowe <mrowe@apple.com>
+
+ Rubber-stamped by Cameron Zwarich.
+
+ <rdar://problem/6289933> Change WebKit-related projects to build with GCC 4.2 on Leopard.
+
+ * Configurations/Base.xcconfig:
+ * Configurations/DebugRelease.xcconfig:
+
+2008-12-15 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ Don't use unique context group in JSGlobalContextCreate() on Tiger or Leopard.
+
+ * API/JSContextRef.cpp: (JSGlobalContextCreate):
+
+2008-12-15 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ <rdar://problem/6445089> Mach ports leak from worker threads
+
+ * interpreter/Interpreter.cpp: (JSC::getCPUTime):
+ Deallocate the thread self port.
+
+2008-12-15 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Mark Rowe.
+
+ Construct stack frames in JIT code, so that backtracing can still work.
+ <rdar://problem/6447870> JIT should play nice with attempts to take stack traces
+
+ * jit/JIT.cpp:
+ (JSC::):
+ (JSC::JIT::privateCompileMainPass):
+
+2008-12-15 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ <rdar://problem/6402262> JavaScriptCore needs exception handling tables in order to get stack traces without frame pointers
+
+ * Configurations/JavaScriptCore.xcconfig:
+
+2008-12-15 Gavin Barraclough <barraclough@apple.com>
+
+ Rubber stamped by Mark Rowe.
+
+ Revert r39226 / Bug 22818: Unify JIT callback argument access OS X / Windows
+ This causes Acid3 failures – reverting for now & will revisit later.
+ https://bugs.webkit.org/show_bug.cgi?id=22873
+
+ * interpreter/Interpreter.h:
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ * jit/JIT.h:
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::restoreArgumentReference):
+ (JSC::JIT::restoreArgumentReferenceForTrampoline):
+ (JSC::JIT::emitCTICall_internal):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::privateCompilePutByIdTransition):
+ * wtf/Platform.h:
+
+2008-12-15 Darin Adler <darin@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ - fix <rdar://problem/6427048> crash due to infinite recursion after setting window.__proto__ = window
+
+ Replaced toGlobalObject with the more generally useful unwrappedObject and used it to
+ fix the cycle detection code in put(__proto__).
+
+ * JavaScriptCore.exp: Updated.
+
+ * runtime/JSGlobalObject.cpp: Removed toGlobalObject. We now use unwrappedObject instead.
+ * runtime/JSGlobalObject.h:
+ (JSC::JSGlobalObject::isGlobalObject): Ditto.
+
+ * runtime/JSGlobalObjectFunctions.cpp:
+ (JSC::globalFuncEval): Use unwrappedObject and isGlobalObject here rather than toGlobalObject.
+
+ * runtime/JSObject.cpp:
+ (JSC::JSObject::put): Rewrote prototype cycle checking loop. Use unwrappedObject in the loop now.
+ (JSC::JSObject::unwrappedObject): Replaced toGlobalObject with this new function.
+ * runtime/JSObject.h: More of the same.
+
+2008-12-15 Steve Falkenburg <sfalken@apple.com>
+
+ Windows build fix.
+
+ Visual Studio requires visibility of forward declarations to match class declaration.
+
+ * assembler/X86Assembler.h:
+
+2008-12-15 Gustavo Noronha Silva <kov@kov.eti.br>
+
+ Reviewed by Mark Rowe.
+
+ https://bugs.webkit.org/show_bug.cgi?id=22686
+
+ GTK+ build fix.
+
+ * GNUmakefile.am:
+
+2008-12-15 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Add support to X86Assembler emitting instructions that access all 16 registers on x86-64.
+ Add a new formating class, that is reponsible for both emitting the opcode bytes and the
+ ModRm bytes of an instruction in a single call; this can insert the REX byte as necessary
+ before the opcode, but has access to the register numbers to build the REX.
+
+ * assembler/AssemblerBuffer.h:
+ (JSC::AssemblerBuffer::isAligned):
+ (JSC::AssemblerBuffer::data):
+ * assembler/MacroAssembler.h:
+ (JSC::MacroAssembler::addPtr):
+ (JSC::MacroAssembler::add32):
+ (JSC::MacroAssembler::and32):
+ (JSC::MacroAssembler::or32):
+ (JSC::MacroAssembler::sub32):
+ (JSC::MacroAssembler::xor32):
+ (JSC::MacroAssembler::loadPtr):
+ (JSC::MacroAssembler::load32):
+ (JSC::MacroAssembler::load16):
+ (JSC::MacroAssembler::storePtr):
+ (JSC::MacroAssembler::storePtrWithRepatch):
+ (JSC::MacroAssembler::store32):
+ (JSC::MacroAssembler::pop):
+ (JSC::MacroAssembler::push):
+ (JSC::MacroAssembler::compareImm32ForBranch):
+ (JSC::MacroAssembler::compareImm32ForBranchEquality):
+ (JSC::MacroAssembler::testImm32):
+ (JSC::MacroAssembler::jae32):
+ (JSC::MacroAssembler::jb32):
+ (JSC::MacroAssembler::je16):
+ (JSC::MacroAssembler::jg32):
+ (JSC::MacroAssembler::jnePtr):
+ (JSC::MacroAssembler::jne32):
+ (JSC::MacroAssembler::jump):
+ * assembler/X86Assembler.h:
+ (JSC::X86::):
+ (JSC::X86Assembler::):
+ (JSC::X86Assembler::size):
+ (JSC::X86Assembler::push_r):
+ (JSC::X86Assembler::pop_r):
+ (JSC::X86Assembler::push_i32):
+ (JSC::X86Assembler::push_m):
+ (JSC::X86Assembler::pop_m):
+ (JSC::X86Assembler::addl_rr):
+ (JSC::X86Assembler::addl_mr):
+ (JSC::X86Assembler::addl_ir):
+ (JSC::X86Assembler::addq_ir):
+ (JSC::X86Assembler::addl_im):
+ (JSC::X86Assembler::andl_rr):
+ (JSC::X86Assembler::andl_ir):
+ (JSC::X86Assembler::orl_rr):
+ (JSC::X86Assembler::orl_mr):
+ (JSC::X86Assembler::orl_ir):
+ (JSC::X86Assembler::subl_rr):
+ (JSC::X86Assembler::subl_mr):
+ (JSC::X86Assembler::subl_ir):
+ (JSC::X86Assembler::subl_im):
+ (JSC::X86Assembler::xorl_rr):
+ (JSC::X86Assembler::xorl_ir):
+ (JSC::X86Assembler::sarl_i8r):
+ (JSC::X86Assembler::sarl_CLr):
+ (JSC::X86Assembler::shll_i8r):
+ (JSC::X86Assembler::shll_CLr):
+ (JSC::X86Assembler::imull_rr):
+ (JSC::X86Assembler::imull_i32r):
+ (JSC::X86Assembler::idivl_r):
+ (JSC::X86Assembler::cmpl_rr):
+ (JSC::X86Assembler::cmpl_rm):
+ (JSC::X86Assembler::cmpl_mr):
+ (JSC::X86Assembler::cmpl_ir):
+ (JSC::X86Assembler::cmpl_ir_force32):
+ (JSC::X86Assembler::cmpl_im):
+ (JSC::X86Assembler::cmpl_im_force32):
+ (JSC::X86Assembler::cmpw_rm):
+ (JSC::X86Assembler::testl_rr):
+ (JSC::X86Assembler::testl_i32r):
+ (JSC::X86Assembler::testl_i32m):
+ (JSC::X86Assembler::testq_rr):
+ (JSC::X86Assembler::testq_i32r):
+ (JSC::X86Assembler::testb_i8r):
+ (JSC::X86Assembler::sete_r):
+ (JSC::X86Assembler::setz_r):
+ (JSC::X86Assembler::setne_r):
+ (JSC::X86Assembler::setnz_r):
+ (JSC::X86Assembler::cdq):
+ (JSC::X86Assembler::xchgl_rr):
+ (JSC::X86Assembler::movl_rr):
+ (JSC::X86Assembler::movl_rm):
+ (JSC::X86Assembler::movl_mr):
+ (JSC::X86Assembler::movl_i32r):
+ (JSC::X86Assembler::movl_i32m):
+ (JSC::X86Assembler::movq_rr):
+ (JSC::X86Assembler::movq_rm):
+ (JSC::X86Assembler::movq_mr):
+ (JSC::X86Assembler::movzwl_mr):
+ (JSC::X86Assembler::movzbl_rr):
+ (JSC::X86Assembler::leal_mr):
+ (JSC::X86Assembler::call):
+ (JSC::X86Assembler::jmp):
+ (JSC::X86Assembler::jmp_r):
+ (JSC::X86Assembler::jmp_m):
+ (JSC::X86Assembler::jne):
+ (JSC::X86Assembler::jnz):
+ (JSC::X86Assembler::je):
+ (JSC::X86Assembler::jl):
+ (JSC::X86Assembler::jb):
+ (JSC::X86Assembler::jle):
+ (JSC::X86Assembler::jbe):
+ (JSC::X86Assembler::jge):
+ (JSC::X86Assembler::jg):
+ (JSC::X86Assembler::ja):
+ (JSC::X86Assembler::jae):
+ (JSC::X86Assembler::jo):
+ (JSC::X86Assembler::jp):
+ (JSC::X86Assembler::js):
+ (JSC::X86Assembler::addsd_rr):
+ (JSC::X86Assembler::addsd_mr):
+ (JSC::X86Assembler::cvtsi2sd_rr):
+ (JSC::X86Assembler::cvttsd2si_rr):
+ (JSC::X86Assembler::movd_rr):
+ (JSC::X86Assembler::movsd_rm):
+ (JSC::X86Assembler::movsd_mr):
+ (JSC::X86Assembler::mulsd_rr):
+ (JSC::X86Assembler::mulsd_mr):
+ (JSC::X86Assembler::pextrw_irr):
+ (JSC::X86Assembler::subsd_rr):
+ (JSC::X86Assembler::subsd_mr):
+ (JSC::X86Assembler::ucomis_rr):
+ (JSC::X86Assembler::int3):
+ (JSC::X86Assembler::ret):
+ (JSC::X86Assembler::predictNotTaken):
+ (JSC::X86Assembler::label):
+ (JSC::X86Assembler::align):
+ (JSC::X86Assembler::link):
+ (JSC::X86Assembler::executableCopy):
+ (JSC::X86Assembler::X86InstructionFormater::prefix):
+ (JSC::X86Assembler::X86InstructionFormater::oneByteOp):
+ (JSC::X86Assembler::X86InstructionFormater::twoByteOp):
+ (JSC::X86Assembler::X86InstructionFormater::oneByteOp64):
+ (JSC::X86Assembler::X86InstructionFormater::oneByteOp8):
+ (JSC::X86Assembler::X86InstructionFormater::twoByteOp8):
+ (JSC::X86Assembler::X86InstructionFormater::instructionImmediate8):
+ (JSC::X86Assembler::X86InstructionFormater::instructionImmediate32):
+ (JSC::X86Assembler::X86InstructionFormater::instructionRel32):
+ (JSC::X86Assembler::X86InstructionFormater::size):
+ (JSC::X86Assembler::X86InstructionFormater::isAligned):
+ (JSC::X86Assembler::X86InstructionFormater::data):
+ (JSC::X86Assembler::X86InstructionFormater::executableCopy):
+ (JSC::X86Assembler::X86InstructionFormater::registerModRM):
+ (JSC::X86Assembler::X86InstructionFormater::memoryModRM):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ (JSC::JIT::privateCompile):
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::putDoubleResultToJSNumberCellOrJSImmediate):
+ (JSC::JIT::compileBinaryArithOp):
+ * jit/JITCall.cpp:
+ (JSC::JIT::compileOpCall):
+ (JSC::JIT::compileOpCallSlowCase):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::compileGetByIdHotPath):
+ (JSC::JIT::compilePutByIdHotPath):
+ (JSC::JIT::privateCompilePutByIdTransition):
+ (JSC::JIT::privateCompilePatchGetArrayLength):
+ (JSC::JIT::privateCompileGetByIdProto):
+ (JSC::JIT::privateCompileGetByIdProtoList):
+ (JSC::JIT::privateCompileGetByIdChainList):
+ (JSC::JIT::privateCompileGetByIdChain):
+
+2008-12-15 Darin Adler <darin@apple.com>
+
+ * interpreter/RegisterFile.h: Tweak include formatting.
+
+2008-12-15 Holger Hans Peter Freyther <zecke@selfish.org>
+
+ Build fix for Gtk+.
+
+ * interpreter/RegisterFile.h: Include stdio.h for fprintf
+
+2008-12-15 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Oliver Hunt.
+
+ <rdar://problem/6444455> Worker Thread crash running multiple workers for a moderate amount of time
+
+ * interpreter/RegisterFile.h: (JSC::RegisterFile::RegisterFile):
+ Improve error handling: if mmap fails, crash immediately, and print out the reason.
+
+2008-12-13 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ Re-enable WREC on 64-bit.
+ Implements one of the MacroAssembler::jnzPtr methods, previously only implemented for 32-bit x86.
+
+ https://bugs.webkit.org/show_bug.cgi?id=22849
+
+ * assembler/MacroAssembler.h:
+ (JSC::MacroAssembler::testImm64):
+ (JSC::MacroAssembler::jnzPtr):
+ * assembler/X86Assembler.h:
+ (JSC::X86Assembler::testq_i32r):
+ (JSC::X86Assembler::testq_rr):
+ * wtf/Platform.h:
+
+2008-12-13 Gavin Barraclough <barraclough@apple.com>
+
+ Fix PPC builds.
+
+ * assembler/MacroAssembler.h:
+
+2008-12-13 Gavin Barraclough <barraclough@apple.com>
+
+ Build fix only, no review.
+
+ * bytecode/CodeBlock.h:
+
+2008-12-13 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ Port the remainder of the JIT, bar calling convention related code, and code
+ implementing optimizations which can be disabled, to use the MacroAssembler.
+
+ * assembler/MacroAssembler.h:
+ (JSC::MacroAssembler::DataLabelPtr::DataLabelPtr):
+ (JSC::MacroAssembler::RepatchBuffer::RepatchBuffer):
+ (JSC::MacroAssembler::RepatchBuffer::link):
+ (JSC::MacroAssembler::RepatchBuffer::addressOf):
+ (JSC::MacroAssembler::RepatchBuffer::setPtr):
+ (JSC::MacroAssembler::addPtr):
+ (JSC::MacroAssembler::lshift32):
+ (JSC::MacroAssembler::mod32):
+ (JSC::MacroAssembler::rshift32):
+ (JSC::MacroAssembler::storePtrWithRepatch):
+ (JSC::MacroAssembler::jnzPtr):
+ (JSC::MacroAssembler::jzPtr):
+ (JSC::MacroAssembler::jump):
+ (JSC::MacroAssembler::label):
+ * assembler/X86Assembler.h:
+ (JSC::X86Assembler::):
+ (JSC::X86Assembler::xchgl_rr):
+ (JSC::X86Assembler::jmp_m):
+ (JSC::X86Assembler::repatchAddress):
+ (JSC::X86Assembler::getRelocatedAddress):
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::CodeBlock):
+ * bytecode/CodeBlock.h:
+ (JSC::JITCodeRef::JITCodeRef):
+ (JSC::CodeBlock::setJITCode):
+ (JSC::CodeBlock::jitCode):
+ (JSC::CodeBlock::executablePool):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ (JSC::JIT::privateCompileLinkPass):
+ (JSC::JIT::privateCompile):
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ * jit/JIT.h:
+ (JSC::CallRecord::CallRecord):
+ (JSC::JumpTable::JumpTable):
+ (JSC::JIT::emitCTICall):
+ (JSC::JIT::JSRInfo::JSRInfo):
+ * jit/JITArithmetic.cpp:
+ * jit/JITCall.cpp:
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::emitNakedCall):
+ (JSC::JIT::emitCTICall_internal):
+ (JSC::JIT::checkStructure):
+ (JSC::JIT::emitFastArithDeTagImmediateJumpIfZero):
+ (JSC::JIT::addSlowCase):
+ (JSC::JIT::addJump):
+ (JSC::JIT::emitJumpSlowToHot):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::privateCompileGetByIdChainList):
+ (JSC::JIT::privateCompileGetByIdChain):
+
+2008-12-12 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Fix the failures of the following layout tests, which regressed in
+ r39255:
+
+ fast/dom/StyleSheet/ownerNode-lifetime-2.html
+ fast/xsl/transform-xhr-doc.xhtml
+
+ The binary search in CodeBlock::getByIdExceptionInfoForBytecodeOffset()
+ doesn't guarantee that it actually finds a match, so add an explicit check
+ for this.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::getByIdExceptionInfoForBytecodeOffset):
+
+2008-12-12 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ Replace emitPutCallArg methods with emitPutJITStubArg methods. Primarily to make the argument numbering
+ more sensible (1-based incrementing by 1, rather than 0-based incrementing by 4). The CTI name also seems
+ to be being deprecated from the code generally.
+
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ (JSC::JIT::privateCompileSlowCases):
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ * jit/JIT.h:
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::compileBinaryArithOp):
+ (JSC::JIT::compileBinaryArithOpSlowCase):
+ * jit/JITCall.cpp:
+ (JSC::JIT::compileOpCallSetupArgs):
+ (JSC::JIT::compileOpCallEvalSetupArgs):
+ (JSC::JIT::compileOpConstructSetupArgs):
+ (JSC::JIT::compileOpCall):
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::emitPutJITStubArg):
+ (JSC::JIT::emitPutJITStubArgConstant):
+ (JSC::JIT::emitGetJITStubArg):
+ (JSC::JIT::emitPutJITStubArgFromVirtualRegister):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::compileGetByIdHotPath):
+ (JSC::JIT::compilePutByIdHotPath):
+ (JSC::JIT::compileGetByIdSlowCase):
+ (JSC::JIT::compilePutByIdSlowCase):
+
+2008-12-12 Gavin Barraclough <barraclough@apple.com>
+
+ Fix windows builds.
+
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ (JSC::JIT::privateCompileSlowCases):
+ (JSC::JIT::privateCompile):
+
+2008-12-12 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Remove loop counter 'i' from the JIT generation passes, replace with a member m_bytecodeIndex.
+
+ No impact on performance.
+
+ * jit/JIT.cpp:
+ (JSC::JIT::compileOpStrictEq):
+ (JSC::JIT::emitSlowScriptCheck):
+ (JSC::JIT::privateCompileMainPass):
+ (JSC::JIT::privateCompileSlowCases):
+ (JSC::JIT::privateCompile):
+ * jit/JIT.h:
+ (JSC::CallRecord::CallRecord):
+ (JSC::JmpTable::JmpTable):
+ (JSC::JIT::emitCTICall):
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::compileBinaryArithOp):
+ (JSC::JIT::compileBinaryArithOpSlowCase):
+ * jit/JITCall.cpp:
+ (JSC::JIT::compileOpCall):
+ (JSC::JIT::compileOpCallSlowCase):
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::emitGetVirtualRegister):
+ (JSC::JIT::emitGetVirtualRegisters):
+ (JSC::JIT::emitNakedCall):
+ (JSC::JIT::emitCTICall_internal):
+ (JSC::JIT::emitJumpSlowCaseIfJSCell):
+ (JSC::JIT::emitJumpSlowCaseIfNotJSCell):
+ (JSC::JIT::emitJumpSlowCaseIfNotImmNum):
+ (JSC::JIT::emitJumpSlowCaseIfNotImmNums):
+ (JSC::JIT::emitFastArithIntToImmOrSlowCase):
+ (JSC::JIT::addSlowCase):
+ (JSC::JIT::addJump):
+ (JSC::JIT::emitJumpSlowToHot):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::compileGetByIdHotPath):
+ (JSC::JIT::compileGetByIdSlowCase):
+ (JSC::JIT::compilePutByIdHotPath):
+ (JSC::JIT::compilePutByIdSlowCase):
+
+2008-12-12 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Cameron Zwarich.
+
+ <rdar://problem/6428342> Look into feasibility of discarding bytecode after native codegen
+
+ Move more JIT functionality to using offsets into the Instruction buffer
+ instead of raw pointers. Two to go!
+
+ * interpreter/Interpreter.cpp:
+ (JSC::bytecodeOffsetForPC): Rename from vPCForPC.
+ (JSC::Interpreter::resolve): Pass offset to exception helper.
+ (JSC::Interpreter::resolveSkip): Ditto.
+ (JSC::Interpreter::resolveGlobal): Ditto.
+ (JSC::Interpreter::resolveBaseAndProperty): Ditto.
+ (JSC::Interpreter::resolveBaseAndFunc): Ditto.
+ (JSC::isNotObject): Ditto.
+ (JSC::Interpreter::unwindCallFrame): Call bytecodeOffsetForPC.
+ (JSC::Interpreter::throwException): Use offsets instead of vPCs.
+ (JSC::Interpreter::privateExecute): Pass offset to exception helper.
+ (JSC::Interpreter::retrieveLastCaller): Ditto.
+ (JSC::Interpreter::cti_op_instanceof): Ditto.
+ (JSC::Interpreter::cti_op_call_NotJSFunction): Ditto.
+ (JSC::Interpreter::cti_op_resolve): Pass offset to exception helper.
+ (JSC::Interpreter::cti_op_construct_NotJSConstruct): Ditto.
+ (JSC::Interpreter::cti_op_resolve_func): Ditto.
+ (JSC::Interpreter::cti_op_resolve_skip): Ditto.
+ (JSC::Interpreter::cti_op_resolve_global): Ditto.
+ (JSC::Interpreter::cti_op_resolve_with_base): Ditto.
+ (JSC::Interpreter::cti_op_throw): Ditto.
+ (JSC::Interpreter::cti_op_in): Ditto.
+ (JSC::Interpreter::cti_vm_throw): Ditto.
+ * interpreter/Interpreter.h:
+
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass): Don't pass unnecessary vPC to stub.
+ * jit/JIT.h: Remove ARG_instr1 - ARG_instr3 and ARG_instr5 - ARG_instr6.
+ * jit/JITCall.cpp:
+ (JSC::JIT::compileOpCallEvalSetupArgs): Don't pass unnecessary vPC to stub..
+ (JSC::JIT::compileOpConstructSetupArgs): Ditto.
+
+ * runtime/ExceptionHelpers.cpp:
+ (JSC::createUndefinedVariableError): Take an offset instead of vPC.
+ (JSC::createInvalidParamError): Ditto.
+ (JSC::createNotAConstructorError): Ditto.
+ (JSC::createNotAFunctionError): Ditto.
+ (JSC::createNotAnObjectError): Ditto.
+ * runtime/ExceptionHelpers.h:
+
+2008-12-12 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 22835: Crash during bytecode generation when comparing to null
+ <https://bugs.webkit.org/show_bug.cgi?id=22835>
+ <rdar://problem/6286749>
+
+ Change the special cases in bytecode generation for comparison to null
+ to use tempDestination().
+
+ * parser/Nodes.cpp:
+ (JSC::BinaryOpNode::emitBytecode):
+ (JSC::EqualNode::emitBytecode):
+
+2008-12-12 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Move slow-cases of JIT code generation over to the MacroAssembler interface.
+
+ * assembler/MacroAssembler.h:
+ (JSC::MacroAssembler::Label::Label):
+ (JSC::MacroAssembler::jae32):
+ (JSC::MacroAssembler::jg32):
+ (JSC::MacroAssembler::jzPtr):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileSlowCases):
+ (JSC::JIT::privateCompile):
+ (JSC::JIT::emitGetVariableObjectRegister):
+ (JSC::JIT::emitPutVariableObjectRegister):
+ * jit/JIT.h:
+ (JSC::SlowCaseEntry::SlowCaseEntry):
+ (JSC::JIT::getSlowCase):
+ (JSC::JIT::linkSlowCase):
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::compileBinaryArithOpSlowCase):
+ * jit/JITCall.cpp:
+ (JSC::JIT::compileOpCallInitializeCallFrame):
+ (JSC::JIT::compileOpCall):
+ (JSC::JIT::compileOpCallSlowCase):
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::emitJumpSlowCaseIfNotJSCell):
+ (JSC::JIT::linkSlowCaseIfNotJSCell):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::compileGetByIdHotPath):
+ (JSC::JIT::compilePutByIdHotPath):
+ (JSC::JIT::compileGetByIdSlowCase):
+ (JSC::JIT::compilePutByIdSlowCase):
+
+2008-12-12 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Bug 22828: Do not inspect bytecode instruction stream for op_get_by_id exception information
+ <https://bugs.webkit.org/show_bug.cgi?id=22828>
+
+ In order to remove the bytecode instruction stream after generating
+ native code, all inspection of bytecode instructions at runtime must
+ be removed. One particular instance of this is the special handling of
+ exceptions thrown by the op_get_by_id emitted directly before an
+ op_construct or an op_instanceof. This patch moves that information to
+ an auxiliary data structure in CodeBlock.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::getByIdExceptionInfoForBytecodeOffset):
+ * bytecode/CodeBlock.h:
+ (JSC::CodeBlock::addGetByIdExceptionInfo):
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::emitConstruct):
+ * bytecompiler/BytecodeGenerator.h:
+ (JSC::BytecodeGenerator::emitGetByIdExceptionInfo):
+ * parser/Nodes.cpp:
+ (JSC::InstanceOfNode::emitBytecode):
+ * runtime/ExceptionHelpers.cpp:
+ (JSC::createNotAnObjectError):
+
+2008-12-12 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ Change exception information accessors to take offsets into the bytecode
+ instruction buffer instead of pointers so that they can work even even
+ if the bytecode buffer is purged.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::instructionOffsetForNth):
+ (JSC::CodeBlock::handlerForBytecodeOffset):
+ (JSC::CodeBlock::lineNumberForBytecodeOffset):
+ (JSC::CodeBlock::expressionRangeForBytecodeOffset):
+ * bytecode/CodeBlock.h:
+ * bytecode/SamplingTool.cpp:
+ (JSC::SamplingTool::dump):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::throwException):
+ (JSC::Interpreter::privateExecute):
+ (JSC::Interpreter::retrieveLastCaller):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ * runtime/ExceptionHelpers.cpp:
+ (JSC::createUndefinedVariableError):
+ (JSC::createInvalidParamError):
+ (JSC::createNotAConstructorError):
+ (JSC::createNotAFunctionError):
+ (JSC::createNotAnObjectError):
+
+2008-12-12 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ Tiny bit of refactoring in quantifier generation.
+
+ * wrec/WRECGenerator.cpp:
+ (JSC::WREC::Generator::generateNonGreedyQuantifier):
+ (JSC::WREC::Generator::generateGreedyQuantifier):
+
+2008-12-11 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ Remove dependancy on having the Instruction buffer in order to
+ deref Structures used for property access and global resolves.
+ Instead, we put references to the necessary Structures in auxiliary
+ data structures on the CodeBlock. This is not an ideal solution,
+ as we still pay for having the Structures in two places and we
+ would like to eventually just hold on to offsets into the machine
+ code buffer.
+
+ - Also removes CodeBlock bloat in non-JIT by #ifdefing the JIT
+ only data structures.
+
+ * GNUmakefile.am:
+ * JavaScriptCore.pri:
+ * JavaScriptCore.scons:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * JavaScriptCoreSources.bkl:
+ * bytecode/CodeBlock.cpp:
+ (JSC::isGlobalResolve):
+ (JSC::isPropertyAccess):
+ (JSC::instructionOffsetForNth):
+ (JSC::printGlobalResolveInfo):
+ (JSC::printStructureStubInfo):
+ (JSC::CodeBlock::printStructures):
+ (JSC::CodeBlock::dump):
+ (JSC::CodeBlock::~CodeBlock):
+ (JSC::CodeBlock::shrinkToFit):
+ * bytecode/CodeBlock.h:
+ (JSC::GlobalResolveInfo::GlobalResolveInfo):
+ (JSC::getNativePC):
+ (JSC::CodeBlock::instructions):
+ (JSC::CodeBlock::getStubInfo):
+ (JSC::CodeBlock::getBytecodeIndex):
+ (JSC::CodeBlock::addPropertyAccessInstruction):
+ (JSC::CodeBlock::addGlobalResolveInstruction):
+ (JSC::CodeBlock::numberOfStructureStubInfos):
+ (JSC::CodeBlock::addStructureStubInfo):
+ (JSC::CodeBlock::structureStubInfo):
+ (JSC::CodeBlock::addGlobalResolveInfo):
+ (JSC::CodeBlock::globalResolveInfo):
+ (JSC::CodeBlock::numberOfCallLinkInfos):
+ (JSC::CodeBlock::addCallLinkInfo):
+ (JSC::CodeBlock::callLinkInfo):
+ * bytecode/Instruction.h:
+ (JSC::PolymorphicAccessStructureList::PolymorphicStubInfo::set):
+ (JSC::PolymorphicAccessStructureList::PolymorphicAccessStructureList):
+ * bytecode/Opcode.h:
+ (JSC::):
+ * bytecode/StructureStubInfo.cpp: Copied from bytecode/CodeBlock.cpp.
+ (JSC::StructureStubInfo::deref):
+ * bytecode/StructureStubInfo.h: Copied from bytecode/CodeBlock.h.
+ (JSC::StructureStubInfo::StructureStubInfo):
+ (JSC::StructureStubInfo::initGetByIdSelf):
+ (JSC::StructureStubInfo::initGetByIdProto):
+ (JSC::StructureStubInfo::initGetByIdChain):
+ (JSC::StructureStubInfo::initGetByIdSelfList):
+ (JSC::StructureStubInfo::initGetByIdProtoList):
+ (JSC::StructureStubInfo::initPutByIdTransition):
+ (JSC::StructureStubInfo::initPutByIdReplace):
+ (JSC::StructureStubInfo::):
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::emitResolve):
+ (JSC::BytecodeGenerator::emitGetById):
+ (JSC::BytecodeGenerator::emitPutById):
+ (JSC::BytecodeGenerator::emitCall):
+ (JSC::BytecodeGenerator::emitConstruct):
+ (JSC::BytecodeGenerator::emitCatch):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::tryCTICachePutByID):
+ (JSC::Interpreter::tryCTICacheGetByID):
+ (JSC::Interpreter::cti_op_get_by_id_self_fail):
+ (JSC::getPolymorphicAccessStructureListSlot):
+ (JSC::Interpreter::cti_op_get_by_id_proto_list):
+ (JSC::Interpreter::cti_op_resolve_global):
+ * jit/JIT.cpp:
+ (JSC::JIT::JIT):
+ (JSC::JIT::privateCompileMainPass):
+ (JSC::JIT::privateCompileSlowCases):
+ (JSC::JIT::privateCompile):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::compileGetByIdHotPath):
+ (JSC::JIT::compilePutByIdHotPath):
+ (JSC::JIT::compileGetByIdSlowCase):
+ (JSC::JIT::compilePutByIdSlowCase):
+ (JSC::JIT::privateCompileGetByIdSelfList):
+ (JSC::JIT::privateCompileGetByIdProtoList):
+ (JSC::JIT::privateCompileGetByIdChainList):
+
+2008-12-11 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Remove CTI_ARGUMENTS mode, use va_start implementation on Windows,
+ unifying JIT callback (cti_*) argument access on OS X & Windows
+
+ No performance impact.
+
+ * interpreter/Interpreter.h:
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ * jit/JIT.h:
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::emitCTICall):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::privateCompilePutByIdTransition):
+ * wtf/Platform.h:
+
+2008-12-11 Holger Freyther <zecke@selfish.org>
+
+ Reviewed by Simon Hausmann.
+
+ https://bugs.webkit.org/show_bug.cgi?id=20953
+
+ For Qt it is not pratical to have a FontCache and GlyphPageTreeNode
+ implementation. This is one of the reasons why the Qt port is currently not
+ using WebCore/platform/graphics/Font.cpp. By allowing to not use
+ the simple/fast-path the Qt port will be able to use it.
+
+ Introduce USE(FONT_FAST_PATH) and define it for every port but the
+ Qt one.
+
+ * wtf/Platform.h: Enable USE(FONT_FAST_PATH)
+
+2008-12-11 Gabor Loki <loki@inf.u-szeged.hu>
+
+ Reviewed by Darin Adler and landed by Holger Freyther.
+
+ <https://bugs.webkit.org/show_bug.cgi?id=22648>
+ Fix threading on Qt-port and Gtk-port for Sampling tool.
+
+ * wtf/ThreadingGtk.cpp:
+ (WTF::waitForThreadCompletion):
+ * wtf/ThreadingQt.cpp:
+ (WTF::waitForThreadCompletion):
+
+2008-12-10 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 22734: Debugger crashes when stepping into a function call in a return statement
+ <https://bugs.webkit.org/show_bug.cgi?id=22734>
+ <rdar://problem/6426796>
+
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::BytecodeGenerator): The DebuggerCallFrame uses
+ the 'this' value stored in a callFrame, so op_convert_this should be
+ emitted at the beginning of a function body when generating bytecode
+ with debug hooks.
+ * debugger/DebuggerCallFrame.cpp:
+ (JSC::DebuggerCallFrame::thisObject): The assertion inherent in the call
+ to asObject() here is valid, because any 'this' value should have been
+ converted to a JSObject*.
+
+2008-12-10 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Port more of the JIT to use the MacroAssembler interface.
+
+ Everything in the main pass, bar a few corner cases (operations with required
+ registers, or calling convention code). Slightly refactors array creation,
+ moving the offset calculation into the callFrame into C code (reducing code
+ planted).
+
+ Overall this appears to be a 1% win on v8-tests, due to the smaller immediates
+ being planted (in jfalse in particular).
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::cti_op_new_array):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ (JSC::JIT::privateCompileSlowCases):
+ * jit/JIT.h:
+ * wrec/WRECGenerator.cpp:
+ (JSC::WREC::Generator::generateEnter):
+
+2008-12-10 Sam Weinig <sam@webkit.org>
+
+ Fix non-JIT builds.
+
+ * bytecode/CodeBlock.h:
+
+2008-12-10 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ <rdar://problem/6428332> Remove the CTI return address table from CodeBlock
+
+ Step 2:
+
+ Convert the return address table from a HashMap to a sorted Vector. This
+ reduces the size of the data structure by ~4.5MB on Membuster head.
+
+ SunSpider reports a 0.5% progression.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::sizeInBytes): Generic method to get the cost of a Vector.
+ (JSC::CodeBlock::dumpStatistics): Add dumping of member sizes.
+ * bytecode/CodeBlock.h:
+ (JSC::PC::PC): Struct representing NativePC -> VirtualPC mappings.
+ (JSC::getNativePC): Helper for binary chop.
+ (JSC::CodeBlock::getBytecodeIndex): Used to get the VirtualPC from a
+ NativePC using a binary chop of the pcVector.
+ (JSC::CodeBlock::pcVector): Accessor.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::vPCForPC): Use getBytecodeIndex instead of jitReturnAddressVPCMap().get().
+ (JSC::Interpreter::cti_op_instanceof): Ditto.
+ (JSC::Interpreter::cti_op_resolve): Ditto.
+ (JSC::Interpreter::cti_op_resolve_func): Ditto.
+ (JSC::Interpreter::cti_op_resolve_skip): Ditto.
+ (JSC::Interpreter::cti_op_resolve_with_base): Ditto.
+ (JSC::Interpreter::cti_op_throw): Ditto.
+ (JSC::Interpreter::cti_op_in): Ditto.
+ (JSC::Interpreter::cti_vm_throw): Ditto.
+
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompile): Reserve exact capacity and fill the pcVector.
+
+2008-12-09 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Added WREC support for an assertion followed by a quantifier. Fixed
+ PCRE to match.
+
+ * wrec/WRECParser.cpp:
+ (JSC::WREC::Parser::parseParentheses): Throw away the quantifier, since
+ it's meaningless. (Firefox does the same.)
+
+ * pcre/pcre_compile.cpp:
+ (compileBranch): ditto.
+
+2008-12-09 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ In preparation for compiling WREC without PCRE:
+
+ Further relaxed WREC's parsing to be more web-compatible. Fixed PCRE to
+ match in cases where it didn't already.
+
+ Changed JavaScriptCore to report syntax errors detected by WREC, rather
+ than falling back on PCRE any time WREC sees an error.
+
+ * pcre/pcre_compile.cpp:
+ (checkEscape): Relaxed parsing of \c and \N escapes to be more
+ web-compatible.
+
+ * runtime/RegExp.cpp:
+ (JSC::RegExp::RegExp): Only fall back on PCRE if WREC has not reported
+ a syntax error.
+
+ * wrec/WREC.cpp:
+ (JSC::WREC::Generator::compileRegExp): Fixed some error reporting to
+ match PCRE.
+
+ * wrec/WRECParser.cpp: Added error messages that match PCRE.
+
+ (JSC::WREC::Parser::consumeGreedyQuantifier):
+ (JSC::WREC::Parser::parseParentheses):
+ (JSC::WREC::Parser::parseCharacterClass):
+ (JSC::WREC::Parser::parseNonCharacterEscape): Updated the above functions to
+ use the new setError API.
+
+ (JSC::WREC::Parser::consumeEscape): Relaxed parsing of \c \N \u \x \B
+ to be more web-compatible.
+
+ (JSC::WREC::Parser::parseAlternative): Distinguish between a malformed
+ quantifier and a quantifier with no prefix, like PCRE does.
+
+ (JSC::WREC::Parser::consumeParenthesesType): Updated to use the new setError API.
+
+ * wrec/WRECParser.h:
+ (JSC::WREC::Parser::error):
+ (JSC::WREC::Parser::syntaxError):
+ (JSC::WREC::Parser::parsePattern):
+ (JSC::WREC::Parser::reset):
+ (JSC::WREC::Parser::setError): Store error messages instead of error codes,
+ to provide for exception messages. Use a setter for reporting errors, so
+ errors detected early are not overwritten by errors detected later.
+
+2008-12-09 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Use va_args to access cti function arguments.
+ https://bugs.webkit.org/show_bug.cgi?id=22774
+
+ This may be a minor regression, but we'll take the hit if so to reduce fragility.
+
+ * interpreter/Interpreter.cpp:
+ * interpreter/Interpreter.h:
+
+2008-12-09 Sam Weinig <sam@webkit.org>
+
+ Reviewed twice by Cameron Zwarich.
+
+ Fix for https://bugs.webkit.org/show_bug.cgi?id=22752
+ Clear SymbolTable after codegen for Function codeblocks that
+ don't require an activation
+
+ This is a ~1.5MB improvement on Membuster-head.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::dumpStatistics): Add logging of non-empty symbol tables
+ and total size used by symbol tables.
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::generate): Clear the symbol table here.
+
+2008-12-09 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ Remove unnecessary extra lookup when throwing an exception.
+ We used to first lookup the target offset using getHandlerForVPC
+ and then we would lookup the native code stub using
+ nativeExceptionCodeForHandlerVPC. Instead, we can just pass around
+ the HandlerInfo.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::handlerForVPC): Return the HandlerInfo.
+ * bytecode/CodeBlock.h: Remove nativeExceptionCodeForHandlerVPC.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::throwException): Return a HandlerInfo instead of
+ and Instruction offset.
+ (JSC::Interpreter::privateExecute): Get the offset from HandlerInfo.
+ (JSC::Interpreter::cti_op_throw): Get the native code from the HandleInfo.
+ (JSC::Interpreter::cti_vm_throw): Ditto.
+ * interpreter/Interpreter.h:
+
+2008-12-09 Eric Seidel <eric@webkit.org>
+
+ Build fix only, no review.
+
+ Speculative fix for the Chromium-Windows bot.
+ Add JavaScriptCore/os-win32 to the include path (for stdint.h)
+ Strangely it builds fine on my local windows box (or at least doesn't hit this error)
+
+ * JavaScriptCore.scons:
+
+2008-12-09 Eric Seidel <eric@webkit.org>
+
+ No review, build fix only.
+
+ Add ExecutableAllocator files missing from Scons build.
+
+ * JavaScriptCore.scons:
+
+2008-12-09 Dimitri Glazkov <dglazkov@chromium.org>
+
+ Reviewed by Timothy Hatcher.
+
+ https://bugs.webkit.org/show_bug.cgi?id=22631
+ Allow ScriptCallFrame query names of functions in the call stack.
+
+ * JavaScriptCore.exp: added InternalFunction::name and
+ UString operator==() as exported symbol
+
+2008-12-08 Judit Jasz <jasy@inf.u-szeged.hu>
+
+ Reviewed and tweaked by Cameron Zwarich.
+
+ Bug 22352: Annotate opcodes with their length
+ <https://bugs.webkit.org/show_bug.cgi?id=22352>
+
+ * bytecode/Opcode.cpp:
+ * bytecode/Opcode.h:
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ (JSC::JIT::privateCompileSlowCases):
+
+2008-12-08 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Implemented more of the relaxed and somewhat weird rules for deciding
+ how to interpret a non-pattern-character.
+
+ * wrec/Escapes.h:
+ (JSC::WREC::Escape::):
+ (JSC::WREC::Escape::Escape): Eliminated Escape::None because it was
+ unused. If you see an '\\', it's either a valid escape or an error.
+
+ * wrec/Quantifier.h:
+ (JSC::WREC::Quantifier::Quantifier):
+ * wrec/WRECGenerator.cpp:
+ (JSC::WREC::Generator::generateNonGreedyQuantifier):
+ (JSC::WREC::Generator::generateGreedyQuantifier): Renamed "noMaxSpecified"
+ to "Infinity", since that's what it means.
+
+ * wrec/WRECParser.cpp:
+ (JSC::WREC::Parser::consumeGreedyQuantifier): Re-wrote {n,m} parsing rules
+ because they were too strict before. Added support for backtracking
+ in the case where the {n,m} fails to parse as a quantifier, and yet is
+ not a syntax error.
+
+ (JSC::WREC::Parser::parseCharacterClass):
+ (JSC::WREC::Parser::parseNonCharacterEscape): Eliminated Escape::None,
+ as above.
+
+ (JSC::WREC::Parser::consumeEscape): Don't treat ASCII and _ escapes
+ as syntax errors. See fast/regex/non-pattern-characters.html.
+
+ * wrec/WRECParser.h:
+ (JSC::WREC::Parser::SavedState::SavedState):
+ (JSC::WREC::Parser::SavedState::restore): Added a state backtracker,
+ since parsing {n,m} forms requires backtracking if the form turns out
+ not to be a quantifier.
+
+2008-12-08 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Refactored WREC parsing so that only one piece of code needs to know
+ the relaxed and somewhat weird rules for deciding how to interpret a
+ non-pattern-character, in preparation for implementing those rules.
+
+ Also, implemented the relaxed and somewhat weird rules for '}' and ']'.
+
+ * wrec/WREC.cpp: Reduced the regular expression size limit. Now that
+ WREC handles ']' properly, it compiles fast/js/regexp-charclass-crash.html,
+ which makes it hang at the old limit. (The old limit was based on the
+ misimpression that the same value in PCRE limited the regular expression
+ pattern size; in reality, it limited the expected compiled regular
+ expression size. WREC doesn't have a way to calculate an expected
+ compiled regular expression size, but this should be good enough.)
+
+ * wrec/WRECParser.cpp:
+ (JSC::WREC::parsePatternCharacterSequence): Nixed this function because
+ it contained a second copy of the logic for handling non-pattern-characters,
+ which is about to get a lot more complicated.
+
+ (JSC::WREC::PatternCharacterSequence::PatternCharacterSequence):
+ (JSC::WREC::PatternCharacterSequence::size):
+ (JSC::WREC::PatternCharacterSequence::append):
+ (JSC::WREC::PatternCharacterSequence::flush): Helper object for generating
+ an optimized sequence of pattern characters.
+
+ (JSC::WREC::Parser::parseNonCharacterEscape): Renamed to reflect the fact
+ that the main parseAlternative loop handles character escapes.
+
+ (JSC::WREC::Parser::parseAlternative): Moved pattern character sequence
+ logic from parsePatternCharacterSequence to here, using
+ PatternCharacterSequence to help with the details.
+
+ * wrec/WRECParser.h: Updated for renames.
+
+2008-12-08 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Geoff Garen.
+
+ <rdar://problem/6166088> Give JSGlobalContextCreate a behavior that is concurrency aware,
+ and un-deprecate it
+
+ * API/JSContextRef.cpp: (JSGlobalContextCreate):
+ * API/JSContextRef.h:
+ Use a unique context group for the context, unless the application was linked against old
+ JavaScriptCore.
+
+2008-12-08 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Cameron Zwarich.
+
+ Fix for <rdar://problem/6428332> Remove the CTI return address table from CodeBlock
+
+ Step 1:
+
+ Remove use of jitReturnAddressVPCMap when looking for vPC to store Structures
+ in for cached lookup. Instead, use the offset in the StructureStubInfo that is
+ already required.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::dumpStatistics): Fix extraneous semicolon.
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::tryCTICachePutByID):
+ (JSC::Interpreter::tryCTICacheGetByID):
+ (JSC::Interpreter::cti_op_get_by_id_self_fail):
+ (JSC::Interpreter::cti_op_get_by_id_proto_list):
+ * jit/JIT.h:
+ (JSC::JIT::compileGetByIdSelf):
+ (JSC::JIT::compileGetByIdProto):
+ (JSC::JIT::compileGetByIdChain):
+ (JSC::JIT::compilePutByIdReplace):
+ (JSC::JIT::compilePutByIdTransition):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::privateCompilePutByIdTransition):
+ (JSC::JIT::patchGetByIdSelf):
+ (JSC::JIT::patchPutByIdReplace):
+ (JSC::JIT::privateCompilePatchGetArrayLength): Remove extra call to getStubInfo.
+ (JSC::JIT::privateCompileGetByIdSelf):
+ (JSC::JIT::privateCompileGetByIdProto):
+ (JSC::JIT::privateCompileGetByIdChain):
+ (JSC::JIT::privateCompilePutByIdReplace):
+
+2008-12-08 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Port the op_j?n?eq_null JIT code generation to use the MacroAssembler,
+ and clean up slightly at the same time. The 'j' forms currently compare,
+ then set a register, then compare again, then branch. Branch directly on
+ the result of the first compare.
+
+ Around a 1% progression on deltablue, crypto & early boyer, for about 1/2%
+ overall on v8-tests.
+
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::compileGetByIdSlowCase):
+
+2008-12-08 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Expand MacroAssembler to support more operations, required by the JIT.
+
+ Generally adds more operations and permutations of operands to the existing
+ interface. Rename 'jset' to 'jnz' and 'jnset' to 'jz', which seem clearer,
+ and require that immediate pointer operands (though not pointer addresses to
+ load and store instructions) are wrapped in a ImmPtr() type, akin to Imm32().
+
+ No performance impact.
+
+ * assembler/MacroAssembler.h:
+ (JSC::MacroAssembler::):
+ (JSC::MacroAssembler::ImmPtr::ImmPtr):
+ (JSC::MacroAssembler::add32):
+ (JSC::MacroAssembler::and32):
+ (JSC::MacroAssembler::or32):
+ (JSC::MacroAssembler::sub32):
+ (JSC::MacroAssembler::xor32):
+ (JSC::MacroAssembler::loadPtr):
+ (JSC::MacroAssembler::load32):
+ (JSC::MacroAssembler::storePtr):
+ (JSC::MacroAssembler::store32):
+ (JSC::MacroAssembler::poke):
+ (JSC::MacroAssembler::move):
+ (JSC::MacroAssembler::testImm32):
+ (JSC::MacroAssembler::jae32):
+ (JSC::MacroAssembler::jb32):
+ (JSC::MacroAssembler::jePtr):
+ (JSC::MacroAssembler::je32):
+ (JSC::MacroAssembler::jnePtr):
+ (JSC::MacroAssembler::jne32):
+ (JSC::MacroAssembler::jnzPtr):
+ (JSC::MacroAssembler::jnz32):
+ (JSC::MacroAssembler::jzPtr):
+ (JSC::MacroAssembler::jz32):
+ (JSC::MacroAssembler::joSub32):
+ (JSC::MacroAssembler::jump):
+ (JSC::MacroAssembler::sete32):
+ (JSC::MacroAssembler::setne32):
+ (JSC::MacroAssembler::setnz32):
+ (JSC::MacroAssembler::setz32):
+ * assembler/X86Assembler.h:
+ (JSC::X86Assembler::addl_mr):
+ (JSC::X86Assembler::andl_i8r):
+ (JSC::X86Assembler::cmpl_rm):
+ (JSC::X86Assembler::cmpl_mr):
+ (JSC::X86Assembler::cmpl_i8m):
+ (JSC::X86Assembler::subl_mr):
+ (JSC::X86Assembler::testl_i32m):
+ (JSC::X86Assembler::xorl_i32r):
+ (JSC::X86Assembler::movl_rm):
+ (JSC::X86Assembler::modRm_opmsib):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::emitGetVirtualRegister):
+ (JSC::JIT::emitPutCTIArgConstant):
+ (JSC::JIT::emitPutCTIParam):
+ (JSC::JIT::emitPutImmediateToCallFrameHeader):
+ (JSC::JIT::emitInitRegister):
+ (JSC::JIT::checkStructure):
+ (JSC::JIT::emitJumpIfJSCell):
+ (JSC::JIT::emitJumpIfNotJSCell):
+ (JSC::JIT::emitJumpSlowCaseIfNotImmNum):
+
+2008-12-08 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Fixed a bug where WREC would allow a quantifier whose minimum was
+ greater than its maximum.
+
+ * wrec/Quantifier.h:
+ (JSC::WREC::Quantifier::Quantifier): ASSERT that the quantifier is not
+ backwards.
+
+ * wrec/WRECParser.cpp:
+ (JSC::WREC::Parser::consumeGreedyQuantifier): Verify that the minimum
+ is not greater than the maximum.
+
+2008-12-08 Eric Seidel <eric@webkit.org>
+
+ Build fix only, no review.
+
+ * JavaScriptCore.scons: add bytecode/JumpTable.cpp
+
+2008-12-08 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ Patch for https://bugs.webkit.org/show_bug.cgi?id=22716
+ <rdar://problem/6428315>
+ Add RareData structure to CodeBlock for infrequently used auxiliary data
+ members.
+
+ Reduces memory on Membuster-head by ~.5MB
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::dump):
+ (JSC::CodeBlock::dumpStatistics):
+ (JSC::CodeBlock::mark):
+ (JSC::CodeBlock::getHandlerForVPC):
+ (JSC::CodeBlock::nativeExceptionCodeForHandlerVPC):
+ (JSC::CodeBlock::shrinkToFit):
+ * bytecode/CodeBlock.h:
+ (JSC::CodeBlock::numberOfExceptionHandlers):
+ (JSC::CodeBlock::addExceptionHandler):
+ (JSC::CodeBlock::exceptionHandler):
+ (JSC::CodeBlock::addFunction):
+ (JSC::CodeBlock::function):
+ (JSC::CodeBlock::addUnexpectedConstant):
+ (JSC::CodeBlock::unexpectedConstant):
+ (JSC::CodeBlock::addRegExp):
+ (JSC::CodeBlock::regexp):
+ (JSC::CodeBlock::numberOfImmediateSwitchJumpTables):
+ (JSC::CodeBlock::addImmediateSwitchJumpTable):
+ (JSC::CodeBlock::immediateSwitchJumpTable):
+ (JSC::CodeBlock::numberOfCharacterSwitchJumpTables):
+ (JSC::CodeBlock::addCharacterSwitchJumpTable):
+ (JSC::CodeBlock::characterSwitchJumpTable):
+ (JSC::CodeBlock::numberOfStringSwitchJumpTables):
+ (JSC::CodeBlock::addStringSwitchJumpTable):
+ (JSC::CodeBlock::stringSwitchJumpTable):
+ (JSC::CodeBlock::evalCodeCache):
+ (JSC::CodeBlock::createRareDataIfNecessary):
+
+2008-11-26 Peter Kasting <pkasting@google.com>
+
+ Reviewed by Anders Carlsson.
+
+ https://bugs.webkit.org/show_bug.cgi?id=16814
+ Allow ports to disable ActiveX->NPAPI conversion for Media Player.
+ Improve handling of miscellaneous ActiveX objects.
+
+ * wtf/Platform.h: Add another ENABLE(...).
+
+2008-12-08 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Mark Rowe.
+
+ Add dumping of CodeBlock member structure usage.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::dumpStatistics):
+ * bytecode/EvalCodeCache.h:
+ (JSC::EvalCodeCache::isEmpty):
+
+2008-12-08 David Kilzer <ddkilzer@apple.com>
+
+ Bug 22555: Sort "children" sections in Xcode project files
+
+ <https://bugs.webkit.org/show_bug.cgi?id=22555>
+
+ Reviewed by Eric Seidel.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj: Sorted.
+
+2008-12-08 Tony Chang <tony@chromium.org>
+
+ Reviewed by Eric Seidel.
+
+ Enable Pan scrolling only when building on PLATFORM(WIN_OS)
+ Previously platforms like Apple Windows WebKit, Cairo Windows WebKit,
+ Wx and Chromium were enabling it explicitly, now we just turn it on
+ for all WIN_OS, later platforms can turn it off as needed on Windows
+ (or turn it on under Linux, etc.)
+ https://bugs.webkit.org/show_bug.cgi?id=22698
+
+ * wtf/Platform.h:
+
+2008-12-08 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Cameron Zwarich.
+
+ Add basic memory statistics dumping for CodeBlock.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::dumpStatistics):
+ (JSC::CodeBlock::CodeBlock):
+ (JSC::CodeBlock::~CodeBlock):
+ * bytecode/CodeBlock.h:
+
+2008-12-08 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Fix the Linux build with newer gcc/glibc.
+
+ * jit/ExecutableAllocatorPosix.cpp: Include unistd.h for
+ getpagesize(), according to
+ http://opengroup.org/onlinepubs/007908775/xsh/getpagesize.html
+
+2008-12-08 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Fix the build with Qt on Windows.
+
+ * JavaScriptCore.pri: Compile ExecutableAllocatorWin.cpp on Windows.
+
+2008-12-07 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by NOBODY (Buildfix).
+
+ Fix non-WREC builds
+
+ * runtime/RegExp.cpp:
+ (JSC::RegExp::RegExp):
+
+2008-12-07 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by NOBODY (Build fix).
+
+ Put ENABLE(ASSEMBLER) guards around use of ExecutableAllocator in global data
+
+ Correct Qt and Gtk project files
+
+ * GNUmakefile.am:
+ * JavaScriptCore.pri:
+ * runtime/JSGlobalData.h:
+
+2008-12-07 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by NOBODY (Build fix).
+
+ Add new files to other projects.
+
+ * GNUmakefile.am:
+ * JavaScriptCore.pri:
+ * JavaScriptCore.pro:
+
+2008-12-07 Oliver Hunt <oliver@apple.com>
+
+ Rubber stamped by Mark Rowe.
+
+ Rename ExecutableAllocatorMMAP to the more sensible ExecutableAllocatorPosix
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * jit/ExecutableAllocator.h:
+ * jit/ExecutableAllocatorPosix.cpp: Renamed from JavaScriptCore/jit/ExecutableAllocatorMMAP.cpp.
+ (JSC::ExecutableAllocator::intializePageSize):
+ (JSC::ExecutablePool::systemAlloc):
+ (JSC::ExecutablePool::systemRelease):
+
+2008-12-07 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Cameron Zwarich and Sam Weinig
+
+ <rdar://problem/6309878> Need more granular control over allocation of executable memory (21783)
+ <https://bugs.webkit.org/show_bug.cgi?id=21783>
+
+ Add a new allocator for use by the JIT that provides executable pages, so
+ we can get rid of the current hack that makes the entire heap executable.
+
+ 1-2% progression on SunSpider-v8, 1% on SunSpider. Reduces memory usage as well!
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.vcproj/jsc/jsc.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * assembler/AssemblerBuffer.h:
+ (JSC::AssemblerBuffer::size):
+ (JSC::AssemblerBuffer::executableCopy):
+ * assembler/MacroAssembler.h:
+ (JSC::MacroAssembler::size):
+ (JSC::MacroAssembler::copyCode):
+ * assembler/X86Assembler.h:
+ (JSC::X86Assembler::size):
+ (JSC::X86Assembler::executableCopy):
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::~CodeBlock):
+ * bytecode/CodeBlock.h:
+ (JSC::CodeBlock::executablePool):
+ (JSC::CodeBlock::setExecutablePool):
+ * bytecode/Instruction.h:
+ (JSC::PolymorphicAccessStructureList::derefStructures):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::~Interpreter):
+ * interpreter/Interpreter.h:
+ * jit/ExecutableAllocator.cpp: Added.
+ * jit/ExecutableAllocator.h: Added.
+ (JSC::ExecutablePool::create):
+ (JSC::ExecutablePool::alloc):
+ (JSC::ExecutablePool::~ExecutablePool):
+ (JSC::ExecutablePool::available):
+ (JSC::ExecutablePool::ExecutablePool):
+ (JSC::ExecutablePool::poolAllocate):
+ (JSC::ExecutableAllocator::ExecutableAllocator):
+ (JSC::ExecutableAllocator::poolForSize):
+ (JSC::ExecutablePool::sizeForAllocation):
+ * jit/ExecutableAllocatorMMAP.cpp: Added.
+ (JSC::ExecutableAllocator::intializePageSize):
+ (JSC::ExecutablePool::systemAlloc):
+ (JSC::ExecutablePool::systemRelease):
+ * jit/ExecutableAllocatorWin.cpp: Added.
+ (JSC::ExecutableAllocator::intializePageSize):
+ (JSC::ExecutablePool::systemAlloc):
+ (JSC::ExecutablePool::systemRelease):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompile):
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ * jit/JIT.h:
+ (JSC::JIT::compileCTIMachineTrampolines):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::privateCompilePutByIdTransition):
+ (JSC::JIT::privateCompilePatchGetArrayLength):
+ (JSC::JIT::privateCompileGetByIdSelf):
+ (JSC::JIT::privateCompileGetByIdProto):
+ (JSC::JIT::privateCompileGetByIdSelfList):
+ (JSC::JIT::privateCompileGetByIdProtoList):
+ (JSC::JIT::privateCompileGetByIdChainList):
+ (JSC::JIT::privateCompileGetByIdChain):
+ (JSC::JIT::privateCompilePutByIdReplace):
+ * parser/Nodes.cpp:
+ (JSC::RegExpNode::emitBytecode):
+ * runtime/JSGlobalData.h:
+ (JSC::JSGlobalData::poolForSize):
+ * runtime/RegExp.cpp:
+ (JSC::RegExp::RegExp):
+ (JSC::RegExp::create):
+ (JSC::RegExp::~RegExp):
+ * runtime/RegExp.h:
+ * runtime/RegExpConstructor.cpp:
+ (JSC::constructRegExp):
+ * runtime/RegExpPrototype.cpp:
+ (JSC::regExpProtoFuncCompile):
+ * runtime/StringPrototype.cpp:
+ (JSC::stringProtoFuncMatch):
+ (JSC::stringProtoFuncSearch):
+ * wrec/WREC.cpp:
+ (JSC::WREC::Generator::compileRegExp):
+ * wrec/WRECGenerator.h:
+ * wtf/FastMalloc.cpp:
+ * wtf/FastMalloc.h:
+ * wtf/TCSystemAlloc.cpp:
+ (TryMmap):
+ (TryVirtualAlloc):
+ (TryDevMem):
+ (TCMalloc_SystemRelease):
+
+2008-12-06 Sam Weinig <sam@webkit.org>
+
+ Fix the Gtk build.
+
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::compileGetByIdHotPath):
+ (JSC::JIT::compilePutByIdHotPath):
+
+2008-12-06 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Cameron Zwarich,
+
+ Move CodeBlock constructor into the .cpp file.
+
+ Sunspider reports a .7% progression, but I can only assume this
+ is noise.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::CodeBlock):
+ * bytecode/CodeBlock.h:
+
+2008-12-06 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Cameron Zwarich.
+
+ Split JumpTable code into its own file.
+
+ * GNUmakefile.am:
+ * JavaScriptCore.pri:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * JavaScriptCoreSources.bkl:
+ * bytecode/CodeBlock.cpp:
+ * bytecode/CodeBlock.h:
+ * bytecode/JumpTable.cpp: Copied from bytecode/CodeBlock.cpp.
+ * bytecode/JumpTable.h: Copied from bytecode/CodeBlock.h.
+
+2008-12-05 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Cameron Zwarich.
+
+ Fix for https://bugs.webkit.org/show_bug.cgi?id=22715
+ Encapsulate more CodeBlock members in preparation
+ of moving some of them to a rare data structure.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::locationForOffset):
+ (JSC::printConditionalJump):
+ (JSC::printGetByIdOp):
+ (JSC::printPutByIdOp):
+ (JSC::CodeBlock::printStructure):
+ (JSC::CodeBlock::printStructures):
+ (JSC::CodeBlock::dump):
+ (JSC::CodeBlock::~CodeBlock):
+ (JSC::CodeBlock::unlinkCallers):
+ (JSC::CodeBlock::derefStructures):
+ (JSC::CodeBlock::refStructures):
+ (JSC::CodeBlock::mark):
+ (JSC::CodeBlock::getHandlerForVPC):
+ (JSC::CodeBlock::nativeExceptionCodeForHandlerVPC):
+ (JSC::CodeBlock::lineNumberForVPC):
+ (JSC::CodeBlock::expressionRangeForVPC):
+ (JSC::CodeBlock::shrinkToFit):
+ * bytecode/CodeBlock.h:
+ (JSC::CodeBlock::CodeBlock):
+ (JSC::CodeBlock::addCaller):
+ (JSC::CodeBlock::removeCaller):
+ (JSC::CodeBlock::isKnownNotImmediate):
+ (JSC::CodeBlock::isConstantRegisterIndex):
+ (JSC::CodeBlock::getConstant):
+ (JSC::CodeBlock::isTemporaryRegisterIndex):
+ (JSC::CodeBlock::getStubInfo):
+ (JSC::CodeBlock::getCallLinkInfo):
+ (JSC::CodeBlock::instructions):
+ (JSC::CodeBlock::setJITCode):
+ (JSC::CodeBlock::jitCode):
+ (JSC::CodeBlock::ownerNode):
+ (JSC::CodeBlock::setGlobalData):
+ (JSC::CodeBlock::setThisRegister):
+ (JSC::CodeBlock::thisRegister):
+ (JSC::CodeBlock::setNeedsFullScopeChain):
+ (JSC::CodeBlock::needsFullScopeChain):
+ (JSC::CodeBlock::setUsesEval):
+ (JSC::CodeBlock::usesEval):
+ (JSC::CodeBlock::setUsesArguments):
+ (JSC::CodeBlock::usesArguments):
+ (JSC::CodeBlock::codeType):
+ (JSC::CodeBlock::source):
+ (JSC::CodeBlock::sourceOffset):
+ (JSC::CodeBlock::addGlobalResolveInstruction):
+ (JSC::CodeBlock::numberOfPropertyAccessInstructions):
+ (JSC::CodeBlock::addPropertyAccessInstruction):
+ (JSC::CodeBlock::propertyAccessInstruction):
+ (JSC::CodeBlock::numberOfCallLinkInfos):
+ (JSC::CodeBlock::addCallLinkInfo):
+ (JSC::CodeBlock::callLinkInfo):
+ (JSC::CodeBlock::numberOfJumpTargets):
+ (JSC::CodeBlock::addJumpTarget):
+ (JSC::CodeBlock::jumpTarget):
+ (JSC::CodeBlock::lastJumpTarget):
+ (JSC::CodeBlock::numberOfExceptionHandlers):
+ (JSC::CodeBlock::addExceptionHandler):
+ (JSC::CodeBlock::exceptionHandler):
+ (JSC::CodeBlock::addExpressionInfo):
+ (JSC::CodeBlock::numberOfLineInfos):
+ (JSC::CodeBlock::addLineInfo):
+ (JSC::CodeBlock::lastLineInfo):
+ (JSC::CodeBlock::jitReturnAddressVPCMap):
+ (JSC::CodeBlock::numberOfIdentifiers):
+ (JSC::CodeBlock::addIdentifier):
+ (JSC::CodeBlock::identifier):
+ (JSC::CodeBlock::numberOfConstantRegisters):
+ (JSC::CodeBlock::addConstantRegister):
+ (JSC::CodeBlock::constantRegister):
+ (JSC::CodeBlock::addFunction):
+ (JSC::CodeBlock::function):
+ (JSC::CodeBlock::addFunctionExpression):
+ (JSC::CodeBlock::functionExpression):
+ (JSC::CodeBlock::addUnexpectedConstant):
+ (JSC::CodeBlock::unexpectedConstant):
+ (JSC::CodeBlock::addRegExp):
+ (JSC::CodeBlock::regexp):
+ (JSC::CodeBlock::symbolTable):
+ (JSC::CodeBlock::evalCodeCache):
+ New inline setters/getters.
+
+ (JSC::ProgramCodeBlock::ProgramCodeBlock):
+ (JSC::ProgramCodeBlock::~ProgramCodeBlock):
+ (JSC::ProgramCodeBlock::clearGlobalObject):
+ * bytecode/SamplingTool.cpp:
+ (JSC::ScopeSampleRecord::sample):
+ (JSC::SamplingTool::dump):
+ * bytecompiler/BytecodeGenerator.cpp:
+ * bytecompiler/BytecodeGenerator.h:
+ * bytecompiler/Label.h:
+ * interpreter/CallFrame.cpp:
+ * interpreter/Interpreter.cpp:
+ * jit/JIT.cpp:
+ * jit/JITCall.cpp:
+ * jit/JITInlineMethods.h:
+ * jit/JITPropertyAccess.cpp:
+ * parser/Nodes.cpp:
+ * runtime/Arguments.h:
+ * runtime/ExceptionHelpers.cpp:
+ * runtime/JSActivation.cpp:
+ * runtime/JSActivation.h:
+ * runtime/JSGlobalObject.cpp:
+ Change direct access to use new getter/setters.
+
+2008-12-05 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Prevent GCC4.2 from hanging when trying to compile Interpreter.cpp.
+ Added "-fno-var-tracking" compiler flag.
+
+ https://bugs.webkit.org/show_bug.cgi?id=22704
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2008-12-05 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Ordering of branch operands in MacroAssembler in unnecessarily inconsistent.
+
+ je, jg etc take an immediate operand as the second argument, but for the
+ equality branches (je, jne) the immediate operand was the first argument. This
+ was unnecessarily inconsistent. Change je, jne methods to take the immediate
+ as the second argument.
+
+ https://bugs.webkit.org/show_bug.cgi?id=22703
+
+ * assembler/MacroAssembler.h:
+ (JSC::MacroAssembler::je32):
+ (JSC::MacroAssembler::jne32):
+ * jit/JIT.cpp:
+ (JSC::JIT::compileOpStrictEq):
+ * wrec/WRECGenerator.cpp:
+ (JSC::WREC::Generator::generateEnter):
+ (JSC::WREC::Generator::generateNonGreedyQuantifier):
+ (JSC::WREC::Generator::generateGreedyQuantifier):
+ (JSC::WREC::Generator::generatePatternCharacterPair):
+ (JSC::WREC::Generator::generatePatternCharacter):
+ (JSC::WREC::Generator::generateCharacterClassInvertedRange):
+ (JSC::WREC::Generator::generateCharacterClassInverted):
+ (JSC::WREC::Generator::generateAssertionBOL):
+ (JSC::WREC::Generator::generateAssertionWordBoundary):
+
+2008-12-05 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Second tranche of porting JIT.cpp to MacroAssembler interface.
+
+ * assembler/MacroAssembler.h:
+ (JSC::MacroAssembler::mul32):
+ (JSC::MacroAssembler::jl32):
+ (JSC::MacroAssembler::jnzSub32):
+ (JSC::MacroAssembler::joAdd32):
+ (JSC::MacroAssembler::joMul32):
+ (JSC::MacroAssembler::jzSub32):
+ * jit/JIT.cpp:
+ (JSC::JIT::emitSlowScriptCheck):
+ (JSC::JIT::privateCompileMainPass):
+ (JSC::JIT::privateCompileSlowCases):
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ * jit/JIT.h:
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::emitJumpIfNotJSCell):
+ (JSC::JIT::emitJumpSlowCaseIfNotJSCell):
+
+2008-12-05 David Kilzer <ddkilzer@apple.com>
+
+ Bug 22609: Provide a build-time choice when generating hash tables for properties of built-in DOM objects
+
+ <https://bugs.webkit.org/show_bug.cgi?id=22609>
+ <rdar://problem/6331749>
+
+ Reviewed by Darin Adler.
+
+ Initial patch by Yosen Lin. Adapted for ToT WebKit by David Kilzer.
+
+ Added back the code that generates a "compact" hash (instead of a
+ perfect hash) as a build-time option using the
+ ENABLE(PERFECT_HASH_SIZE) macro as defined in Lookup.h.
+
+ * create_hash_table: Rename variables to differentiate perfect hash
+ values from compact hash values. Added back code to compute compact
+ hash tables. Generate both hash table sizes and emit
+ conditionalized code based on ENABLE(PERFECT_HASH_SIZE).
+ * runtime/Lookup.cpp:
+ (JSC::HashTable::createTable): Added version of createTable() for
+ use with compact hash tables.
+ (JSC::HashTable::deleteTable): Updated to work with compact hash
+ tables.
+ * runtime/Lookup.h: Defined ENABLE(PERFECT_HASH_SIZE) macro here.
+ (JSC::HashEntry::initialize): Set m_next to zero when using compact
+ hash tables.
+ (JSC::HashEntry::setNext): Added for compact hash tables.
+ (JSC::HashEntry::next): Added for compact hash tables.
+ (JSC::HashTable::entry): Added version of entry() for use with
+ compact hash tables.
+ * runtime/Structure.cpp:
+ (JSC::Structure::getEnumerablePropertyNames): Updated to work with
+ compact hash tables.
+
+2008-12-05 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Remove redundant calls to JIT::emitSlowScriptCheck.
+ This is checked in the hot path, so is not needed on the slow path - and the code
+ was being planted before the start of the slow case, so was completely unreachable!
+
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileSlowCases):
+
+2008-12-05 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Move JIT::compileOpStrictEq to MacroAssembler interface.
+
+ The rewrite also looks like a small (<1%) performance progression.
+
+ https://bugs.webkit.org/show_bug.cgi?id=22697
+
+ * jit/JIT.cpp:
+ (JSC::JIT::compileOpStrictEq):
+ (JSC::JIT::privateCompileSlowCases):
+ * jit/JIT.h:
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::emitJumpIfJSCell):
+ (JSC::JIT::emitJumpSlowCaseIfJSCell):
+
+2008-12-05 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Remove m_assembler from MacroAssembler::Jump.
+ Keeping a pointer allowed for some syntactic sugar - "link()" looks nicer
+ than "link(this)". But maintaining this doubles the size of Jump, which
+ is even more unfortunate for the JIT, since there are many large structures
+ holding JmpSrcs. Probably best to remove it.
+
+ https://bugs.webkit.org/show_bug.cgi?id=22693
+
+ * assembler/MacroAssembler.h:
+ (JSC::MacroAssembler::Jump::Jump):
+ (JSC::MacroAssembler::Jump::link):
+ (JSC::MacroAssembler::Jump::linkTo):
+ (JSC::MacroAssembler::JumpList::link):
+ (JSC::MacroAssembler::JumpList::linkTo):
+ (JSC::MacroAssembler::jae32):
+ (JSC::MacroAssembler::je32):
+ (JSC::MacroAssembler::je16):
+ (JSC::MacroAssembler::jg32):
+ (JSC::MacroAssembler::jge32):
+ (JSC::MacroAssembler::jl32):
+ (JSC::MacroAssembler::jle32):
+ (JSC::MacroAssembler::jnePtr):
+ (JSC::MacroAssembler::jne32):
+ (JSC::MacroAssembler::jnset32):
+ (JSC::MacroAssembler::jset32):
+ (JSC::MacroAssembler::jump):
+ (JSC::MacroAssembler::jzSub32):
+ (JSC::MacroAssembler::joAdd32):
+ (JSC::MacroAssembler::call):
+ * wrec/WREC.cpp:
+ (JSC::WREC::Generator::compileRegExp):
+ * wrec/WRECGenerator.cpp:
+ (JSC::WREC::Generator::generateEnter):
+ (JSC::WREC::Generator::generateBackreferenceQuantifier):
+ (JSC::WREC::Generator::generateNonGreedyQuantifier):
+ (JSC::WREC::Generator::generateGreedyQuantifier):
+ (JSC::WREC::Generator::generatePatternCharacter):
+ (JSC::WREC::Generator::generateCharacterClassInvertedRange):
+ (JSC::WREC::Generator::generateCharacterClassInverted):
+ (JSC::WREC::Generator::generateCharacterClass):
+ (JSC::WREC::Generator::generateParenthesesAssertion):
+ (JSC::WREC::Generator::generateParenthesesInvertedAssertion):
+ (JSC::WREC::Generator::generateParenthesesNonGreedy):
+ (JSC::WREC::Generator::generateParenthesesResetTrampoline):
+ (JSC::WREC::Generator::generateAssertionBOL):
+ (JSC::WREC::Generator::generateAssertionEOL):
+ (JSC::WREC::Generator::generateAssertionWordBoundary):
+ (JSC::WREC::Generator::generateBackreference):
+ (JSC::WREC::Generator::terminateAlternative):
+ (JSC::WREC::Generator::terminateDisjunction):
+ * wrec/WRECParser.h:
+
+2008-12-05 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Simplify JIT generated checks for timeout code, by moving more work into the C function.
+ https://bugs.webkit.org/show_bug.cgi?id=22688
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::cti_timeout_check):
+ * interpreter/Interpreter.h:
+ * jit/JIT.cpp:
+ (JSC::JIT::emitSlowScriptCheck):
+
+2008-12-05 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ Encapsulate access to jump tables in the CodeBlock in preparation
+ of moving them to a rare data structure.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::dump):
+ (JSC::CodeBlock::shrinkToFit):
+ * bytecode/CodeBlock.h:
+ (JSC::CodeBlock::numberOfImmediateSwitchJumpTables):
+ (JSC::CodeBlock::addImmediateSwitchJumpTable):
+ (JSC::CodeBlock::immediateSwitchJumpTable):
+ (JSC::CodeBlock::numberOfCharacterSwitchJumpTables):
+ (JSC::CodeBlock::addCharacterSwitchJumpTable):
+ (JSC::CodeBlock::characterSwitchJumpTable):
+ (JSC::CodeBlock::numberOfStringSwitchJumpTables):
+ (JSC::CodeBlock::addStringSwitchJumpTable):
+ (JSC::CodeBlock::stringSwitchJumpTable):
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::generate):
+ (JSC::BytecodeGenerator::endSwitch):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+ (JSC::Interpreter::cti_op_switch_imm):
+ (JSC::Interpreter::cti_op_switch_char):
+ (JSC::Interpreter::cti_op_switch_string):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+
+2008-12-05 Adam Roben <aroben@apple.com>
+
+ Windows build fix after r39020
+
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::restoreArgumentReference):
+ (JSC::JIT::restoreArgumentReferenceForTrampoline):
+ Add some apparently-missing __.
+
+2008-12-04 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=22673
+
+ Added support for the assertion (?=) and inverted assertion (?!) atoms
+ in WREC.
+
+ * wrec/WRECGenerator.cpp:
+ (JSC::WREC::Generator::generateParenthesesAssertion):
+ (JSC::WREC::Generator::generateParenthesesInvertedAssertion): Split the
+ old (unused) generateParentheses into these two functions, with more
+ limited capabilities.
+
+ * wrec/WRECGenerator.h:
+ (JSC::WREC::Generator::): Moved an enum to the top of the class definition,
+ to match the WebKit style, and removed a defunct comment.
+
+ * wrec/WRECParser.cpp:
+ (JSC::WREC::Parser::parseParentheses):
+ (JSC::WREC::Parser::consumeParenthesesType):
+ * wrec/WRECParser.h:
+ (JSC::WREC::Parser::): Added support for parsing (?=) and (?!).
+
+2008-12-05 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Rubber-stamped by Tor Arne Vestbø.
+
+ Disable the JIT for the Qt build alltogether again, after observing
+ more miscompilations in a wider range of newer gcc versions.
+
+ * JavaScriptCore.pri:
+
+2008-12-05 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Reviewed by Tor Arne Vestbø.
+
+ Disable the JIT for the Qt build on Linux unless gcc is >= 4.2,
+ due to miscompilations.
+
+ * JavaScriptCore.pri:
+
+2008-12-04 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Start porting the JIT to use the MacroAssembler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=22671
+ No change in performance.
+
+ * assembler/MacroAssembler.h:
+ (JSC::MacroAssembler::Jump::operator X86Assembler::JmpSrc):
+ (JSC::MacroAssembler::add32):
+ (JSC::MacroAssembler::and32):
+ (JSC::MacroAssembler::lshift32):
+ (JSC::MacroAssembler::rshift32):
+ (JSC::MacroAssembler::storePtr):
+ (JSC::MacroAssembler::store32):
+ (JSC::MacroAssembler::poke):
+ (JSC::MacroAssembler::move):
+ (JSC::MacroAssembler::compareImm32ForBranchEquality):
+ (JSC::MacroAssembler::jnePtr):
+ (JSC::MacroAssembler::jnset32):
+ (JSC::MacroAssembler::jset32):
+ (JSC::MacroAssembler::jzeroSub32):
+ (JSC::MacroAssembler::joverAdd32):
+ (JSC::MacroAssembler::call):
+ * assembler/X86Assembler.h:
+ (JSC::X86Assembler::shll_i8r):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ (JSC::JIT::privateCompile):
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ * jit/JIT.h:
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::compileBinaryArithOp):
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::emitGetVirtualRegister):
+ (JSC::JIT::emitPutCTIArg):
+ (JSC::JIT::emitPutCTIArgConstant):
+ (JSC::JIT::emitGetCTIArg):
+ (JSC::JIT::emitPutCTIArgFromVirtualRegister):
+ (JSC::JIT::emitPutCTIParam):
+ (JSC::JIT::emitGetCTIParam):
+ (JSC::JIT::emitPutToCallFrameHeader):
+ (JSC::JIT::emitPutImmediateToCallFrameHeader):
+ (JSC::JIT::emitGetFromCallFrameHeader):
+ (JSC::JIT::emitPutVirtualRegister):
+ (JSC::JIT::emitInitRegister):
+ (JSC::JIT::emitNakedCall):
+ (JSC::JIT::restoreArgumentReference):
+ (JSC::JIT::restoreArgumentReferenceForTrampoline):
+ (JSC::JIT::emitCTICall):
+ (JSC::JIT::checkStructure):
+ (JSC::JIT::emitJumpSlowCaseIfNotJSCell):
+ (JSC::JIT::emitJumpSlowCaseIfNotImmNum):
+ (JSC::JIT::emitJumpSlowCaseIfNotImmNums):
+ (JSC::JIT::emitFastArithDeTagImmediate):
+ (JSC::JIT::emitFastArithDeTagImmediateJumpIfZero):
+ (JSC::JIT::emitFastArithReTagImmediate):
+ (JSC::JIT::emitFastArithPotentiallyReTagImmediate):
+ (JSC::JIT::emitFastArithImmToInt):
+ (JSC::JIT::emitFastArithIntToImmOrSlowCase):
+ (JSC::JIT::emitFastArithIntToImmNoCheck):
+ (JSC::JIT::emitTagAsBoolImmediate):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::privateCompilePutByIdTransition):
+
+2008-12-04 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Some refactoring for generateGreedyQuantifier.
+
+ SunSpider reports no change (possibly a 0.3% speedup).
+
+ * wrec/WRECGenerator.cpp:
+ (JSC::WREC::Generator::generateGreedyQuantifier): Clarified label
+ meanings and unified some logic to simplify things.
+
+ * wrec/WRECParser.h:
+ (JSC::WREC::Parser::parseAlternative): Added a version of parseAlternative
+ that can jump to a Label, instead of a JumpList, upon failure. (Eventually,
+ when we have a true Label class, this will be redundant.) This makes
+ things easier for generateGreedyQuantifier, because it can avoid
+ explicitly linking things.
+
+2008-12-04 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Reviewed by Holger Freyther.
+
+ Fix crashes in the Qt build on Linux/i386 with non-executable memory
+ by enabling TCSystemAlloc and the PROT_EXEC flag for mmap.
+
+ * JavaScriptCore.pri: Enable the use of TCSystemAlloc if the JIT is
+ enabled.
+ * wtf/TCSystemAlloc.cpp: Extend the PROT_EXEC permissions to
+ PLATFORM(QT).
+
+2008-12-04 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Reviewed by Tor Arne Vestbø.
+
+ Enable ENABLE_JIT_OPTIMIZE_CALL, ENABLE_JIT_OPTIMIZE_PROPERTY_ACCESS
+ and ENABLE_JIT_OPTIMIZE_ARITHMETIC, as suggested by Niko.
+
+ * JavaScriptCore.pri:
+
+2008-12-04 Kent Hansen <khansen@trolltech.com>
+
+ Reviewed by Simon Hausmann.
+
+ Enable the JSC jit for the Qt build by default for release builds on
+ linux-g++ and win32-msvc.
+
+ * JavaScriptCore.pri:
+
+2008-12-04 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Allow JIT to function without property access repatching and arithmetic optimizations.
+ Controlled by ENABLE_JIT_OPTIMIZE_PROPERTY_ACCESS and ENABLE_JIT_OPTIMIZE_ARITHMETIC switches.
+
+ https://bugs.webkit.org/show_bug.cgi?id=22643
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ (JSC::JIT::privateCompileSlowCases):
+ * jit/JIT.h:
+ * jit/JITArithmetic.cpp: Copied from jit/JIT.cpp.
+ (JSC::JIT::compileBinaryArithOp):
+ (JSC::JIT::compileBinaryArithOpSlowCase):
+ * jit/JITPropertyAccess.cpp: Copied from jit/JIT.cpp.
+ (JSC::JIT::compileGetByIdHotPath):
+ (JSC::JIT::compileGetByIdSlowCase):
+ (JSC::JIT::compilePutByIdHotPath):
+ (JSC::JIT::compilePutByIdSlowCase):
+ (JSC::resizePropertyStorage):
+ (JSC::transitionWillNeedStorageRealloc):
+ (JSC::JIT::privateCompilePutByIdTransition):
+ (JSC::JIT::patchGetByIdSelf):
+ (JSC::JIT::patchPutByIdReplace):
+ (JSC::JIT::privateCompilePatchGetArrayLength):
+ * wtf/Platform.h:
+
+2008-12-03 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Optimized sequences of characters in regular expressions by comparing
+ two characters at a time.
+
+ 1-2% speedup on SunSpider, 19-25% speedup on regexp-dna.
+
+ * assembler/MacroAssembler.h:
+ (JSC::MacroAssembler::load32):
+ (JSC::MacroAssembler::jge32): Filled out a few more macro methods.
+
+ * assembler/X86Assembler.h:
+ (JSC::X86Assembler::movl_mr): Added a verion of movl_mr that operates
+ without an offset, to allow the macro assembler to optmize for that case.
+
+ * wrec/WREC.cpp:
+ (JSC::WREC::Generator::compileRegExp): Test the saved value of index
+ instead of the index register when checking for "end of input." The
+ index register doesn't increment by 1 in an orderly fashion, so testing
+ it for == "end of input" is not valid.
+
+ Also, jump all the way to "return failure" upon reaching "end of input,"
+ instead of executing the next alternative. This is more logical, and
+ it's a slight optimization in the case of an expression with many alternatives.
+
+ * wrec/WRECGenerator.cpp:
+ (JSC::WREC::Generator::generateIncrementIndex): Added support for
+ jumping to a failure label in the case where the index has reached "end
+ of input."
+
+ (JSC::WREC::Generator::generatePatternCharacterSequence):
+ (JSC::WREC::Generator::generatePatternCharacterPair): This is the
+ optmization. It's basically like generatePatternCharacter, but it runs two
+ characters at a time.
+
+ (JSC::WREC::Generator::generatePatternCharacter): Changed to use isASCII,
+ since it's clearer than comparing to a magic hex value.
+
+ * wrec/WRECGenerator.h:
+
+2008-12-03 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ Allow JIT to operate without the call-repatching optimization.
+ Controlled by ENABLE(JIT_OPTIMIZE_CALL), defaults on, disabling
+ this leads to significant performance regression.
+
+ https://bugs.webkit.org/show_bug.cgi?id=22639
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileSlowCases):
+ * jit/JIT.h:
+ * jit/JITCall.cpp: Copied from jit/JIT.cpp.
+ (JSC::JIT::compileOpCallInitializeCallFrame):
+ (JSC::JIT::compileOpCallSetupArgs):
+ (JSC::JIT::compileOpCallEvalSetupArgs):
+ (JSC::JIT::compileOpConstructSetupArgs):
+ (JSC::JIT::compileOpCall):
+ (JSC::JIT::compileOpCallSlowCase):
+ (JSC::unreachable):
+ * jit/JITInlineMethods.h: Copied from jit/JIT.cpp.
+ (JSC::JIT::checkStructure):
+ (JSC::JIT::emitFastArithPotentiallyReTagImmediate):
+ (JSC::JIT::emitTagAsBoolImmediate):
+ * wtf/Platform.h:
+
+2008-12-03 Eric Seidel <eric@webkit.org>
+
+ Rubber-stamped by David Hyatt.
+
+ Make HAVE_ACCESSIBILITY only define if !defined
+
+ * wtf/Platform.h:
+
+2008-12-03 Sam Weinig <sam@webkit.org>
+
+ Fix build.
+
+ * assembler/X86Assembler.h:
+ (JSC::X86Assembler::orl_i32r):
+
+2008-12-03 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ Remove shared AssemblerBuffer 1MB buffer and instead give AssemblerBuffer
+ an 256 byte inline capacity.
+
+ 1% progression on Sunspider.
+
+ * assembler/AssemblerBuffer.h:
+ (JSC::AssemblerBuffer::AssemblerBuffer):
+ (JSC::AssemblerBuffer::~AssemblerBuffer):
+ (JSC::AssemblerBuffer::grow):
+ * assembler/MacroAssembler.h:
+ (JSC::MacroAssembler::MacroAssembler):
+ * assembler/X86Assembler.h:
+ (JSC::X86Assembler::X86Assembler):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::Interpreter):
+ * interpreter/Interpreter.h:
+ * jit/JIT.cpp:
+ (JSC::JIT::JIT):
+ * parser/Nodes.cpp:
+ (JSC::RegExpNode::emitBytecode):
+ * runtime/RegExp.cpp:
+ (JSC::RegExp::RegExp):
+ (JSC::RegExp::create):
+ * runtime/RegExp.h:
+ * runtime/RegExpConstructor.cpp:
+ (JSC::constructRegExp):
+ * runtime/RegExpPrototype.cpp:
+ (JSC::regExpProtoFuncCompile):
+ * runtime/StringPrototype.cpp:
+ (JSC::stringProtoFuncMatch):
+ (JSC::stringProtoFuncSearch):
+ * wrec/WREC.cpp:
+ (JSC::WREC::Generator::compileRegExp):
+ * wrec/WRECGenerator.h:
+ (JSC::WREC::Generator::Generator):
+ * wrec/WRECParser.h:
+ (JSC::WREC::Parser::Parser):
+
+2008-12-03 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt, with help from Gavin Barraclough.
+
+ orl_i32r was actually coded as an 8bit OR. So, I renamed orl_i32r to
+ orl_i8r, changed all orl_i32r clients to use orl_i8r, and then added
+ a new orl_i32r that actually does a 32bit OR.
+
+ (32bit OR is currently unused, but a patch I'm working on uses it.)
+
+ * assembler/MacroAssembler.h:
+ (JSC::MacroAssembler::or32): Updated to choose between 8bit and 32bit OR.
+
+ * assembler/X86Assembler.h:
+ (JSC::X86Assembler::orl_i8r): The old orl_i32r.
+ (JSC::X86Assembler::orl_i32r): The new orl_i32r.
+
+ * jit/JIT.cpp:
+ (JSC::JIT::emitFastArithPotentiallyReTagImmediate):
+ (JSC::JIT::emitTagAsBoolImmediate): Use orl_i8r, since we're ORing 8bit
+ values.
+
+2008-12-03 Dean Jackson <dino@apple.com>
+
+ Reviewed by Dan Bernstein.
+
+ Helper functions for turn -> degrees.
+ https://bugs.webkit.org/show_bug.cgi?id=22497
+
+ * wtf/MathExtras.h:
+ (turn2deg):
+ (deg2turn):
+
+2008-12-02 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Bug 22504: Crashes during code generation occur due to refing of ignoredResult()
+ <https://bugs.webkit.org/show_bug.cgi?id=22504>
+
+ Since ignoredResult() was implemented by casting 1 to a RegisterID*, any
+ attempt to ref ignoredResult() results in a crash. This will occur in
+ code generation of a function body where a node emits another node with
+ the dst that was passed to it, and then refs the returned RegisterID*.
+
+ To fix this problem, make ignoredResult() a member function of
+ BytecodeGenerator that simply returns a pointe to a fixed RegisterID
+ member of BytecodeGenerator.
+
+ * bytecompiler/BytecodeGenerator.h:
+ (JSC::BytecodeGenerator::ignoredResult):
+ * bytecompiler/RegisterID.h:
+ * parser/Nodes.cpp:
+ (JSC::NullNode::emitBytecode):
+ (JSC::BooleanNode::emitBytecode):
+ (JSC::NumberNode::emitBytecode):
+ (JSC::StringNode::emitBytecode):
+ (JSC::RegExpNode::emitBytecode):
+ (JSC::ThisNode::emitBytecode):
+ (JSC::ResolveNode::emitBytecode):
+ (JSC::ObjectLiteralNode::emitBytecode):
+ (JSC::PostfixResolveNode::emitBytecode):
+ (JSC::PostfixBracketNode::emitBytecode):
+ (JSC::PostfixDotNode::emitBytecode):
+ (JSC::DeleteValueNode::emitBytecode):
+ (JSC::VoidNode::emitBytecode):
+ (JSC::TypeOfResolveNode::emitBytecode):
+ (JSC::TypeOfValueNode::emitBytecode):
+ (JSC::PrefixResolveNode::emitBytecode):
+ (JSC::AssignResolveNode::emitBytecode):
+ (JSC::CommaNode::emitBytecode):
+ (JSC::ForNode::emitBytecode):
+ (JSC::ForInNode::emitBytecode):
+ (JSC::ReturnNode::emitBytecode):
+ (JSC::ThrowNode::emitBytecode):
+ (JSC::FunctionBodyNode::emitBytecode):
+ (JSC::FuncDeclNode::emitBytecode):
+
+2008-12-02 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ Fixed https://bugs.webkit.org/show_bug.cgi?id=22537
+ REGRESSION (r38745): Assertion failure in jsSubstring() at ge.com
+
+ The bug was that index would become greater than length, so our
+ "end of input" checks, which all check "index == length", would fail.
+
+ The solution is to check for end of input before incrementing index,
+ to ensure that index is always <= length.
+
+ As a side benefit, generateJumpIfEndOfInput can now use je instead of
+ jg, which should be slightly faster.
+
+ * wrec/WREC.cpp:
+ (JSC::WREC::Generator::compileRegExp):
+ * wrec/WRECGenerator.cpp:
+ (JSC::WREC::Generator::generateJumpIfEndOfInput):
+
+2008-12-02 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Plant shift right immediate instructions, which are awesome.
+ https://bugs.webkit.org/show_bug.cgi?id=22610
+ ~5% on the v8-crypto test.
+
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ (JSC::JIT::privateCompileSlowCases):
+
+2008-12-02 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Cleaned up SegmentedVector by abstracting segment access into helper
+ functions.
+
+ SunSpider reports no change.
+
+ * bytecompiler/SegmentedVector.h:
+ (JSC::SegmentedVector::SegmentedVector):
+ (JSC::SegmentedVector::~SegmentedVector):
+ (JSC::SegmentedVector::size):
+ (JSC::SegmentedVector::at):
+ (JSC::SegmentedVector::operator[]):
+ (JSC::SegmentedVector::last):
+ (JSC::SegmentedVector::append):
+ (JSC::SegmentedVector::removeLast):
+ (JSC::SegmentedVector::grow):
+ (JSC::SegmentedVector::clear):
+ (JSC::SegmentedVector::deleteAllSegments):
+ (JSC::SegmentedVector::segmentFor):
+ (JSC::SegmentedVector::subscriptFor):
+ (JSC::SegmentedVector::ensureSegmentsFor):
+ (JSC::SegmentedVector::ensureSegment):
+
+2008-12-02 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Geoffrey Garen. (Patch by Cameron Zwarich <zwarich@apple.com>.)
+
+ Fixed https://bugs.webkit.org/show_bug.cgi?id=22482
+ REGRESSION (r37991): Occasionally see "Scene rendered incorrectly"
+ message when running the V8 Raytrace benchmark
+
+ Rolled out r37991. It didn't properly save xmm0, which is caller-save,
+ before calling helper functions.
+
+ SunSpider and v8 benchmarks show little change -- possibly a .2%
+ SunSpider regression, possibly a .2% v8 benchmark speedup.
+
+ * assembler/X86Assembler.h:
+ (JSC::X86Assembler::):
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::dump):
+ * bytecode/Instruction.h:
+ (JSC::Instruction::):
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::emitUnaryOp):
+ * bytecompiler/BytecodeGenerator.h:
+ (JSC::BytecodeGenerator::emitToJSNumber):
+ (JSC::BytecodeGenerator::emitTypeOf):
+ (JSC::BytecodeGenerator::emitGetPropertyNames):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+ * interpreter/Interpreter.h:
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ (JSC::JIT::privateCompileSlowCases):
+ * jit/JIT.h:
+ * parser/Nodes.cpp:
+ (JSC::UnaryOpNode::emitBytecode):
+ (JSC::BinaryOpNode::emitBytecode):
+ (JSC::EqualNode::emitBytecode):
+ * parser/ResultType.h:
+ (JSC::ResultType::isReusable):
+ (JSC::ResultType::mightBeNumber):
+ * runtime/JSNumberCell.h:
+
+2008-12-01 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Remove unused (sampling only, and derivable) argument to JIT::emitCTICall.
+ https://bugs.webkit.org/show_bug.cgi?id=22587
+
+ * jit/JIT.cpp:
+ (JSC::JIT::emitCTICall):
+ (JSC::JIT::compileOpCall):
+ (JSC::JIT::emitSlowScriptCheck):
+ (JSC::JIT::compileBinaryArithOpSlowCase):
+ (JSC::JIT::privateCompileMainPass):
+ (JSC::JIT::privateCompileSlowCases):
+ (JSC::JIT::privateCompile):
+ * jit/JIT.h:
+
+2008-12-02 Dimitri Glazkov <dglazkov@chromium.org>
+
+ Reviewed by Eric Seidel.
+
+ Fix the inheritance chain for JSFunction.
+
+ * runtime/JSFunction.cpp:
+ (JSC::JSFunction::info): Add InternalFunction::info as parent class
+
+2008-12-02 Simon Hausmann <hausmann@webkit.org>
+
+ Reviewed by Tor Arne Vestbø.
+
+ Fix ability to include JavaScriptCore.pri from other .pro files.
+
+ * JavaScriptCore.pri: Moved -O3 setting into the .pro files.
+ * JavaScriptCore.pro:
+ * jsc.pro:
+
+2008-12-01 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Cameron Zwarich, with help from Gavin Barraclough.
+
+ Fixed https://bugs.webkit.org/show_bug.cgi?id=22583.
+
+ Refactored regular expression parsing to parse sequences of characters
+ as a single unit, in preparation for optimizing sequences of characters.
+
+ SunSpider reports no change.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * wrec/Escapes.h: Added. Set of classes for representing an escaped
+ token in a pattern.
+
+ * wrec/Quantifier.h:
+ (JSC::WREC::Quantifier::Quantifier): Simplified this constructor slightly,
+ to match the new Escape constructor.
+
+ * wrec/WRECGenerator.cpp:
+ (JSC::WREC::Generator::generatePatternCharacterSequence):
+ * wrec/WRECGenerator.h: Added an interface for generating a sequence
+ of pattern characters at a time. It doesn't do anything special yet.
+
+ * wrec/WRECParser.cpp:
+ (JSC::WREC::Parser::consumeGreedyQuantifier):
+ (JSC::WREC::Parser::consumeQuantifier): Renamed "parse" to "consume" in
+ these functions, to match "consumeEscape."
+
+ (JSC::WREC::Parser::parsePatternCharacterSequence): New function for
+ iteratively aggregating a sequence of characters in a pattern.
+
+ (JSC::WREC::Parser::parseCharacterClassQuantifier):
+ (JSC::WREC::Parser::parseBackreferenceQuantifier): Renamed "parse" to
+ "consume" in these functions, to match "consumeEscape."
+
+ (JSC::WREC::Parser::parseCharacterClass): Refactored to use the common
+ escape processing code in consumeEscape.
+
+ (JSC::WREC::Parser::parseEscape): Refactored to use the common
+ escape processing code in consumeEscape.
+
+ (JSC::WREC::Parser::consumeEscape): Factored escaped token processing
+ into a common function, since we were doing this in a few places.
+
+ (JSC::WREC::Parser::parseTerm): Refactored to use the common
+ escape processing code in consumeEscape.
+
+ * wrec/WRECParser.h:
+ (JSC::WREC::Parser::consumeOctal): Refactored to use a helper function
+ for reading a digit.
+
+2008-12-01 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 20340: SegmentedVector segment allocations can lead to unsafe use of temporary registers
+ <https://bugs.webkit.org/show_bug.cgi?id=20340>
+
+ SegmentedVector currently frees segments and reallocates them when used
+ as a stack. This can lead to unsafe use of pointers into freed segments.
+
+ In order to fix this problem, SegmentedVector will be changed to only
+ grow and never shrink. Also, rename the reserveCapacity() member
+ function to grow() to match the actual usage in BytecodeGenerator, where
+ this function is used to allocate a group of registers at once, rather
+ than merely saving space for them.
+
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::BytecodeGenerator): Use grow() instead of
+ reserveCapacity().
+ * bytecompiler/SegmentedVector.h:
+ (JSC::SegmentedVector::SegmentedVector):
+ (JSC::SegmentedVector::last):
+ (JSC::SegmentedVector::append):
+ (JSC::SegmentedVector::removeLast):
+ (JSC::SegmentedVector::grow): Renamed from reserveCapacity().
+ (JSC::SegmentedVector::clear):
+
+2008-12-01 Mark Rowe <mrowe@apple.com>
+
+ Rubber-stamped by Anders Carlsson.
+
+ Disable WREC for x86_64 since memory allocated by the system allocator is not marked executable,
+ which causes 64-bit debug builds to crash. Once we have a dedicated allocator for executable
+ memory we can turn this back on.
+
+ * wtf/Platform.h:
+
+2008-12-01 Antti Koivisto <antti@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Restore inline buffer after vector is shrunk back below its inline capacity.
+
+ * wtf/Vector.h:
+ (WTF::):
+ (WTF::VectorBuffer::restoreInlineBufferIfNeeded):
+ (WTF::::shrinkCapacity):
+
+2008-11-30 Antti Koivisto <antti@apple.com>
+
+ Reviewed by Mark Rowe.
+
+ Try to return free pages in the current thread cache too.
+
+ * wtf/FastMalloc.cpp:
+ (WTF::TCMallocStats::releaseFastMallocFreeMemory):
+
+2008-12-01 David Levin <levin@chromium.org>
+
+ Reviewed by Alexey Proskuryakov.
+
+ https://bugs.webkit.org/show_bug.cgi?id=22567
+ Make HashTable work as expected with respect to threads. Specifically, it has class-level
+ thread safety and constant methods work on constant objects without synchronization.
+
+ No observable change in behavior, so no test. This only affects debug builds.
+
+ * wtf/HashTable.cpp:
+ (WTF::hashTableStatsMutex):
+ (WTF::HashTableStats::~HashTableStats):
+ (WTF::HashTableStats::recordCollisionAtCount):
+ Guarded variable access with a mutex.
+
+ * wtf/HashTable.h:
+ (WTF::::lookup):
+ (WTF::::lookupForWriting):
+ (WTF::::fullLookupForWriting):
+ (WTF::::add):
+ (WTF::::reinsert):
+ (WTF::::remove):
+ (WTF::::rehash):
+ Changed increments of static variables to use atomicIncrement.
+
+ (WTF::::invalidateIterators):
+ (WTF::addIterator):
+ (WTF::removeIterator):
+ Guarded mutable access with a mutex.
+
+2008-11-29 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ Enable WREC on PLATFORM(X86_64). This change predominantly requires changes to the
+ WREC::Generator::generateEnter method to support the x86-64 ABI, and addition of
+ support for a limited number of quadword operations in the X86Assembler.
+
+ This patch will cause the JS heap to be allocated with RWX permissions on 64-bit Mac
+ platforms. This is a regression with respect to previous 64-bit behaviour, but is no
+ more permissive than on 32-bit builds. This issue should be addressed at some point.
+ (This is tracked by bug #21783.)
+
+ https://bugs.webkit.org/show_bug.cgi?id=22554
+ Greater than 4x speedup on regexp-dna, on x86-64.
+
+ * assembler/MacroAssembler.h:
+ (JSC::MacroAssembler::addPtr):
+ (JSC::MacroAssembler::loadPtr):
+ (JSC::MacroAssembler::storePtr):
+ (JSC::MacroAssembler::pop):
+ (JSC::MacroAssembler::push):
+ (JSC::MacroAssembler::move):
+ * assembler/X86Assembler.h:
+ (JSC::X86Assembler::):
+ (JSC::X86Assembler::movq_rr):
+ (JSC::X86Assembler::addl_i8m):
+ (JSC::X86Assembler::addl_i32r):
+ (JSC::X86Assembler::addq_i8r):
+ (JSC::X86Assembler::addq_i32r):
+ (JSC::X86Assembler::movq_mr):
+ (JSC::X86Assembler::movq_rm):
+ * wrec/WREC.h:
+ * wrec/WRECGenerator.cpp:
+ (JSC::WREC::Generator::generateEnter):
+ (JSC::WREC::Generator::generateReturnSuccess):
+ (JSC::WREC::Generator::generateReturnFailure):
+ * wtf/Platform.h:
+ * wtf/TCSystemAlloc.cpp:
+
+2008-12-01 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Preliminary work for bug 20340: SegmentedVector segment allocations can lead to unsafe use of temporary registers
+ <https://bugs.webkit.org/show_bug.cgi?id=20340>
+
+ SegmentedVector currently frees segments and reallocates them when used
+ as a stack. This can lead to unsafe use of pointers into freed segments.
+
+ In order to fix this problem, SegmentedVector will be changed to only
+ grow and never shrink, with the sole exception of clearing all of its
+ data, a capability that is required by Lexer. This patch changes the
+ public interface to only allow for these capabilities.
+
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::BytecodeGenerator): Use reserveCapacity()
+ instead of resize() for m_globals and m_parameters.
+ * bytecompiler/SegmentedVector.h:
+ (JSC::SegmentedVector::resize): Removed.
+ (JSC::SegmentedVector::reserveCapacity): Added.
+ (JSC::SegmentedVector::clear): Added.
+ (JSC::SegmentedVector::shrink): Removed.
+ (JSC::SegmentedVector::grow): Removed.
+ * parser/Lexer.cpp:
+ (JSC::Lexer::clear): Use clear() instead of resize(0).
+
+2008-11-30 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Mark Rowe.
+
+ Renames jumps to m_jumps in JumpList.
+
+ * assembler/MacroAssembler.h:
+ (JSC::MacroAssembler::JumpList::link):
+ (JSC::MacroAssembler::JumpList::linkTo):
+ (JSC::MacroAssembler::JumpList::append):
+
+2008-11-30 Antti Koivisto <antti@apple.com>
+
+ Reviewed by Mark Rowe.
+
+ https://bugs.webkit.org/show_bug.cgi?id=22557
+
+ Report free size in central and thread caches too.
+
+ * wtf/FastMalloc.cpp:
+ (WTF::TCMallocStats::fastMallocStatistics):
+ * wtf/FastMalloc.h:
+
+2008-11-29 Antti Koivisto <antti@apple.com>
+
+ Reviewed by Dan Bernstein.
+
+ https://bugs.webkit.org/show_bug.cgi?id=22557
+ Add statistics for JavaScript GC heap.
+
+ * JavaScriptCore.exp:
+ * runtime/Collector.cpp:
+ (JSC::Heap::objectCount):
+ (JSC::addToStatistics):
+ (JSC::Heap::statistics):
+ * runtime/Collector.h:
+
+2008-11-29 Antti Koivisto <antti@apple.com>
+
+ Fix debug build by adding a stub method.
+
+ * wtf/FastMalloc.cpp:
+ (WTF::fastMallocStatistics):
+
+2008-11-29 Antti Koivisto <antti@apple.com>
+
+ Reviewed by Alexey Proskuryakov.
+
+ https://bugs.webkit.org/show_bug.cgi?id=22557
+
+ Add function for getting basic statistics from FastMalloc.
+
+ * JavaScriptCore.exp:
+ * wtf/FastMalloc.cpp:
+ (WTF::DLL_Length):
+ (WTF::TCMalloc_PageHeap::ReturnedBytes):
+ (WTF::TCMallocStats::fastMallocStatistics):
+ * wtf/FastMalloc.h:
+
+2008-11-29 Cameron Zwarich <zwarich@apple.com>
+
+ Not reviewed.
+
+ The C++ standard does not automatically grant the friendships of an
+ enclosing class to its nested subclasses, so we should do so explicitly.
+ This fixes the GCC 4.0 build, although both GCC 4.2 and Visual C++ 2005
+ accept the incorrect code as it is.
+
+ * assembler/MacroAssembler.h:
+
+2008-11-29 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ Add the class MacroAssembler to provide some abstraction of code generation,
+ and change WREC to make use of this class, rather than directly accessing
+ the X86Assembler.
+
+ This patch also allows WREC to be compiled without the rest of the JIT enabled.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * assembler/MacroAssembler.h: Added.
+ (JSC::MacroAssembler::):
+ (JSC::MacroAssembler::MacroAssembler):
+ (JSC::MacroAssembler::copyCode):
+ (JSC::MacroAssembler::Address::Address):
+ (JSC::MacroAssembler::ImplicitAddress::ImplicitAddress):
+ (JSC::MacroAssembler::BaseIndex::BaseIndex):
+ (JSC::MacroAssembler::Label::Label):
+ (JSC::MacroAssembler::Jump::Jump):
+ (JSC::MacroAssembler::Jump::link):
+ (JSC::MacroAssembler::Jump::linkTo):
+ (JSC::MacroAssembler::JumpList::link):
+ (JSC::MacroAssembler::JumpList::linkTo):
+ (JSC::MacroAssembler::JumpList::append):
+ (JSC::MacroAssembler::Imm32::Imm32):
+ (JSC::MacroAssembler::add32):
+ (JSC::MacroAssembler::or32):
+ (JSC::MacroAssembler::sub32):
+ (JSC::MacroAssembler::loadPtr):
+ (JSC::MacroAssembler::load32):
+ (JSC::MacroAssembler::load16):
+ (JSC::MacroAssembler::storePtr):
+ (JSC::MacroAssembler::store32):
+ (JSC::MacroAssembler::pop):
+ (JSC::MacroAssembler::push):
+ (JSC::MacroAssembler::peek):
+ (JSC::MacroAssembler::poke):
+ (JSC::MacroAssembler::move):
+ (JSC::MacroAssembler::compareImm32ForBranch):
+ (JSC::MacroAssembler::compareImm32ForBranchEquality):
+ (JSC::MacroAssembler::jae32):
+ (JSC::MacroAssembler::je32):
+ (JSC::MacroAssembler::je16):
+ (JSC::MacroAssembler::jg32):
+ (JSC::MacroAssembler::jge32):
+ (JSC::MacroAssembler::jl32):
+ (JSC::MacroAssembler::jle32):
+ (JSC::MacroAssembler::jne32):
+ (JSC::MacroAssembler::jump):
+ (JSC::MacroAssembler::breakpoint):
+ (JSC::MacroAssembler::ret):
+ * assembler/X86Assembler.h:
+ (JSC::X86Assembler::cmpw_rm):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::Interpreter):
+ * interpreter/Interpreter.h:
+ (JSC::Interpreter::assemblerBuffer):
+ * runtime/RegExp.cpp:
+ (JSC::RegExp::RegExp):
+ * wrec/WREC.cpp:
+ (JSC::WREC::Generator::compileRegExp):
+ * wrec/WREC.h:
+ * wrec/WRECFunctors.cpp:
+ (JSC::WREC::GeneratePatternCharacterFunctor::generateAtom):
+ (JSC::WREC::GenerateCharacterClassFunctor::generateAtom):
+ (JSC::WREC::GenerateBackreferenceFunctor::generateAtom):
+ (JSC::WREC::GenerateParenthesesNonGreedyFunctor::generateAtom):
+ * wrec/WRECFunctors.h:
+ (JSC::WREC::GenerateParenthesesNonGreedyFunctor::GenerateParenthesesNonGreedyFunctor):
+ * wrec/WRECGenerator.cpp:
+ (JSC::WREC::Generator::generateEnter):
+ (JSC::WREC::Generator::generateReturnSuccess):
+ (JSC::WREC::Generator::generateSaveIndex):
+ (JSC::WREC::Generator::generateIncrementIndex):
+ (JSC::WREC::Generator::generateLoadCharacter):
+ (JSC::WREC::Generator::generateJumpIfEndOfInput):
+ (JSC::WREC::Generator::generateJumpIfNotEndOfInput):
+ (JSC::WREC::Generator::generateReturnFailure):
+ (JSC::WREC::Generator::generateBacktrack1):
+ (JSC::WREC::Generator::generateBacktrackBackreference):
+ (JSC::WREC::Generator::generateBackreferenceQuantifier):
+ (JSC::WREC::Generator::generateNonGreedyQuantifier):
+ (JSC::WREC::Generator::generateGreedyQuantifier):
+ (JSC::WREC::Generator::generatePatternCharacter):
+ (JSC::WREC::Generator::generateCharacterClassInvertedRange):
+ (JSC::WREC::Generator::generateCharacterClassInverted):
+ (JSC::WREC::Generator::generateCharacterClass):
+ (JSC::WREC::Generator::generateParentheses):
+ (JSC::WREC::Generator::generateParenthesesNonGreedy):
+ (JSC::WREC::Generator::generateParenthesesResetTrampoline):
+ (JSC::WREC::Generator::generateAssertionBOL):
+ (JSC::WREC::Generator::generateAssertionEOL):
+ (JSC::WREC::Generator::generateAssertionWordBoundary):
+ (JSC::WREC::Generator::generateBackreference):
+ (JSC::WREC::Generator::terminateAlternative):
+ (JSC::WREC::Generator::terminateDisjunction):
+ * wrec/WRECGenerator.h:
+ (JSC::WREC::Generator::Generator):
+ * wrec/WRECParser.cpp:
+ (JSC::WREC::Parser::parsePatternCharacterQualifier):
+ (JSC::WREC::Parser::parseCharacterClassQuantifier):
+ (JSC::WREC::Parser::parseBackreferenceQuantifier):
+ (JSC::WREC::Parser::parseParentheses):
+ (JSC::WREC::Parser::parseCharacterClass):
+ (JSC::WREC::Parser::parseOctalEscape):
+ (JSC::WREC::Parser::parseEscape):
+ (JSC::WREC::Parser::parseTerm):
+ (JSC::WREC::Parser::parseDisjunction):
+ * wrec/WRECParser.h:
+ (JSC::WREC::Parser::Parser):
+ (JSC::WREC::Parser::parsePattern):
+ (JSC::WREC::Parser::parseAlternative):
+ * wtf/Platform.h:
+
+2008-11-28 Simon Hausmann <hausmann@webkit.org>
+
+ Reviewed by Tor Arne Vestbø.
+
+ Fix compilation on Windows CE
+
+ Port away from the use of errno after calling strtol(), instead
+ detect conversion errors by checking the result and the stop
+ position.
+
+ * runtime/DateMath.cpp:
+ (JSC::parseLong):
+ (JSC::parseDate):
+
+2008-11-28 Joerg Bornemann <joerg.bornemann@trolltech.com>
+
+ Reviewed by Simon Hausmann.
+
+ Implement lowResUTCTime() on Windows CE using GetSystemTime as _ftime() is not available.
+
+ * runtime/DateMath.cpp:
+ (JSC::lowResUTCTime):
+
+2008-11-28 Simon Hausmann <hausmann@webkit.org>
+
+ Rubber-stamped by Tor Arne Vestbø.
+
+ Removed unnecessary inclusion of errno.h, which also fixes compilation on Windows CE.
+
+ * runtime/JSGlobalObjectFunctions.cpp:
+
+2008-11-27 Cameron Zwarich <zwarich@apple.com>
+
+ Not reviewed.
+
+ r38825 made JSFunction::m_body private, but some inspector code in
+ WebCore sets the field. Add setters for it.
+
+ * runtime/JSFunction.h:
+ (JSC::JSFunction::setBody):
+
+2008-11-27 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Cameron Zwarich.
+
+ Fix FIXME by adding accessor for JSFunction's m_body property.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::cti_op_call_JSFunction):
+ (JSC::Interpreter::cti_vm_dontLazyLinkCall):
+ (JSC::Interpreter::cti_vm_lazyLinkCall):
+ * profiler/Profiler.cpp:
+ (JSC::createCallIdentifierFromFunctionImp):
+ * runtime/Arguments.h:
+ (JSC::Arguments::getArgumentsData):
+ (JSC::Arguments::Arguments):
+ * runtime/FunctionPrototype.cpp:
+ (JSC::functionProtoFuncToString):
+ * runtime/JSFunction.h:
+ (JSC::JSFunction::JSFunction):
+ (JSC::JSFunction::body):
+
+2008-11-27 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Oliver Hunt.
+
+ Remove unused member variables from ProgramNode.
+
+ * parser/Nodes.h:
+
+2008-11-27 Brent Fulgham <bfulgham@gmail.com>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Enable mouse panning feaure on Windows Cairo build.
+ See http://bugs.webkit.org/show_bug.cgi?id=22525
+
+ * wtf/Platform.h: Enable mouse panning feaure on Windows Cairo build.
+
+2008-11-27 Alp Toker <alp@nuanti.com>
+
+ Change recently introduced C++ comments in Platform.h to C comments to
+ fix the minidom build with traditional C.
+
+ Build GtkLauncher and minidom with the '-ansi' compiler flag to detect
+ API header breakage at build time.
+
+ * GNUmakefile.am:
+ * wtf/Platform.h:
+
+2008-11-27 Alp Toker <alp@nuanti.com>
+
+ Remove C++ comment from JavaScriptCore API headers (introduced r35449).
+ Fixes build for ANSI C applications using the public API.
+
+ * API/WebKitAvailability.h:
+
+2008-11-26 Eric Seidel <eric@webkit.org>
+
+ No review, build fix only.
+
+ Fix the JSC Chromium Mac build by adding JavaScriptCore/icu into the include path
+
+ * JavaScriptCore.scons:
+
+2008-11-25 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Remove the unused member function JSFunction::getParameterName().
+
+ * runtime/JSFunction.cpp:
+ * runtime/JSFunction.h:
+
+2008-11-24 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Polymorpic caching for get by id chain. Similar to the polymorphic caching already implemented
+ for self and proto accesses (implemented by allowing multiple trampolines to be JIT genertaed,
+ and linked together) - the get by id chain caching is implemented as a genericization of the
+ proto list caching, allowing cached access lists to contain a mix of proto and proto chain
+ accesses (since in JS style inheritance hierarchies you may commonly see a mix of properties
+ being overridden on the direct prototype, or higher up its prototype chain).
+
+ In order to allow this patch to compile there is a fix to appease gcc 4.2 compiler issues
+ (removing the jumps between fall-through cases in privateExecute).
+
+ This patch also removes redundant immediate checking from the reptach code, and fixes a related
+ memory leak (failure to deallocate trampolines).
+
+ ~2% progression on v8 tests (bulk on the win on deltablue)
+
+ * bytecode/Instruction.h:
+ (JSC::PolymorphicAccessStructureList::PolymorphicStubInfo::):
+ (JSC::PolymorphicAccessStructureList::PolymorphicStubInfo::set):
+ (JSC::PolymorphicAccessStructureList::PolymorphicAccessStructureList):
+ (JSC::PolymorphicAccessStructureList::derefStructures):
+ * interpreter/Interpreter.cpp:
+ (JSC::countPrototypeChainEntriesAndCheckForProxies):
+ (JSC::Interpreter::tryCacheGetByID):
+ (JSC::Interpreter::privateExecute):
+ (JSC::Interpreter::tryCTICacheGetByID):
+ (JSC::Interpreter::cti_op_get_by_id_self_fail):
+ (JSC::getPolymorphicAccessStructureListSlot):
+ (JSC::Interpreter::cti_op_get_by_id_proto_list):
+ * interpreter/Interpreter.h:
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileGetByIdProto):
+ (JSC::JIT::privateCompileGetByIdSelfList):
+ (JSC::JIT::privateCompileGetByIdProtoList):
+ (JSC::JIT::privateCompileGetByIdChainList):
+ (JSC::JIT::privateCompileGetByIdChain):
+ (JSC::JIT::privateCompilePatchGetArrayLength):
+ * jit/JIT.h:
+ (JSC::JIT::compileGetByIdChainList):
+
+2008-11-25 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Move the collect() call in Heap::heapAllocate() that is conditionally
+ compiled under COLLECT_ON_EVERY_ALLOCATION so that it is before we get
+ information about the heap. This was causing assertion failures for me
+ while I was reducing a bug.
+
+ * runtime/Collector.cpp:
+ (JSC::Heap::heapAllocate):
+
+2008-11-24 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Bug 13790: Function declarations are not treated as statements (used to affect starcraft2.com)
+ <https://bugs.webkit.org/show_bug.cgi?id=13790>
+
+ Modify the parser to treat function declarations as statements,
+ simplifying the grammar in the process. Technically, according to the
+ grammar in the ECMA spec, function declarations are not statements and
+ can not be used everywhere that statements can, but it is not worth the
+ possibility compatibility issues just to stick to the spec in this case.
+
+ * parser/Grammar.y:
+ * parser/Nodes.cpp:
+ (JSC::FuncDeclNode::emitBytecode): Avoid returning ignoredResult()
+ as a result, because it causes a crash in DoWhileNode::emitBytecode().
+
+2008-11-24 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Unroll the regexp matching loop by 1. 10% speedup on simple matching
+ stress test. No change on SunSpider.
+
+ (I decided not to unroll to arbitrary levels because the returns diminsh
+ quickly.)
+
+ * wrec/WREC.cpp:
+ (JSC::WREC::compileRegExp):
+ * wrec/WRECGenerator.cpp:
+ (JSC::WREC::Generator::generateJumpIfEndOfInput):
+ (JSC::WREC::Generator::generateJumpIfNotEndOfInput):
+ * wrec/WRECGenerator.h:
+ * wrec/WRECParser.h:
+ (JSC::WREC::Parser::error):
+ (JSC::WREC::Parser::parsePattern):
+
+2008-11-24 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Removed some unnecessary "Generator::" prefixes.
+
+ * wrec/WRECGenerator.cpp:
+ (JSC::WREC::Generator::generateEnter):
+ (JSC::WREC::Generator::generateReturnSuccess):
+ (JSC::WREC::Generator::generateSaveIndex):
+ (JSC::WREC::Generator::generateIncrementIndex):
+ (JSC::WREC::Generator::generateLoopIfNotEndOfInput):
+ (JSC::WREC::Generator::generateReturnFailure):
+
+2008-11-24 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Made a bunch of WREC::Parser functions private, and added an explicit
+ "reset()" function, so a parser can be reused.
+
+ * wrec/WRECParser.h:
+ (JSC::WREC::Parser::Parser):
+ (JSC::WREC::Parser::generator):
+ (JSC::WREC::Parser::ignoreCase):
+ (JSC::WREC::Parser::multiline):
+ (JSC::WREC::Parser::recordSubpattern):
+ (JSC::WREC::Parser::numSubpatterns):
+ (JSC::WREC::Parser::parsePattern):
+ (JSC::WREC::Parser::parseAlternative):
+ (JSC::WREC::Parser::reset):
+
+2008-11-24 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ Implement repatching for get by id chain.
+ Previously the access is performed in a function stub, in the repatch form
+ the trampoline is not called to; instead the hot path is relinked to jump
+ directly to the trampoline, if it fails it will jump to the slow case.
+
+ https://bugs.webkit.org/show_bug.cgi?id=22449
+ 3% progression on deltablue.
+
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileGetByIdProto):
+ (JSC::JIT::privateCompileGetByIdChain):
+
+2008-11-24 Joerg Bornemann <joerg.bornemann@trolltech.com>
+
+ Reviewed by Simon Hausmann.
+
+ https://bugs.webkit.org/show_bug.cgi?id=20746
+
+ Various small compilation fixes to make the Qt port of WebKit
+ compile on Windows CE.
+
+ * config.h: Don't set _CRT_RAND_S for CE, it's not available.
+ * jsc.cpp: Disabled use of debugger includes for CE. It
+ does not have the debugging functions.
+ * runtime/DateMath.cpp: Use localtime() on Windows CE.
+ * wtf/Assertions.cpp: Compile on Windows CE without debugger.
+ * wtf/Assertions.h: Include windows.h before defining ASSERT.
+ * wtf/MathExtras.h: Include stdlib.h instead of xmath.h.
+ * wtf/Platform.h: Disable ERRNO_H and detect endianess based
+ on the Qt endianess. On Qt for Windows CE the endianess is
+ defined by the vendor specific build spec.
+ * wtf/Threading.h: Use the volatile-less atomic functions.
+ * wtf/dtoa.cpp: Compile without errno.
+ * wtf/win/MainThreadWin.cpp: Don't include windows.h on CE after
+ Assertions.h due to the redefinition of ASSERT.
+
+2008-11-22 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ Replace accidentally deleted immediate check from get by id chain trampoline.
+ https://bugs.webkit.org/show_bug.cgi?id=22413
+
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileGetByIdChain):
+
+2008-11-21 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Add (really) polymorphic caching for get by id self.
+ Very similar to caching of prototype accesses, described below.
+
+ Oh, also, probably shouldn't have been leaking those structure list objects.
+
+ 4% preogression on deltablue.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::dump):
+ (JSC::CodeBlock::derefStructures):
+ (JSC::PrototypeStructureList::derefStructures):
+ * bytecode/Instruction.h:
+ * bytecode/Opcode.h:
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+ (JSC::Interpreter::cti_op_get_by_id_self_fail):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ (JSC::JIT::privateCompileGetByIdSelfList):
+ (JSC::JIT::patchGetByIdSelf):
+ * jit/JIT.h:
+ (JSC::JIT::compileGetByIdSelfList):
+
+2008-11-21 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Fixed many crashes seen 'round the world (but only in release builds).
+
+ Update outputParameter offset to reflect slight re-ordering of push
+ instructions in r38669.
+
+ * wrec/WRECGenerator.cpp:
+
+2008-11-21 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ A little more RegExp refactoring.
+
+ Deployed a helper function for reading the next character. Used the "link
+ vector of jumps" helper in a place I missed before.
+
+ * wrec/WRECGenerator.cpp:
+ (JSC::WREC::Generator::generateLoadCharacter):
+ (JSC::WREC::Generator::generatePatternCharacter):
+ (JSC::WREC::Generator::generateCharacterClass):
+ (JSC::WREC::Generator::generateAssertionEOL):
+ (JSC::WREC::Generator::generateAssertionWordBoundary):
+ * wrec/WRECGenerator.h:
+
+2008-11-21 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Dan Bernstein.
+
+ https://bugs.webkit.org/show_bug.cgi?id=22402
+ Replace abort() with CRASH()
+
+ * wtf/Assertions.h: Added a different method to crash, which should work even is 0xbbadbeef
+ is a valid memory address.
+
+ * runtime/Collector.cpp:
+ * wtf/FastMalloc.cpp:
+ * wtf/FastMalloc.h:
+ * wtf/TCSpinLock.h:
+ Replace abort() with CRASH().
+
+2008-11-21 Alexey Proskuryakov <ap@webkit.org>
+
+ Reverted fix for bug 22042 (Replace abort() with CRASH()), because it was breaking
+ FOR_EACH_OPCODE_ID macro somehow, making Safari crash.
+
+ * runtime/Collector.cpp:
+ (JSC::Heap::heapAllocate):
+ (JSC::Heap::collect):
+ * wtf/Assertions.h:
+ * wtf/FastMalloc.cpp:
+ (WTF::fastMalloc):
+ (WTF::fastCalloc):
+ (WTF::fastRealloc):
+ (WTF::InitSizeClasses):
+ (WTF::PageHeapAllocator::New):
+ (WTF::TCMallocStats::do_malloc):
+ * wtf/FastMalloc.h:
+ * wtf/TCSpinLock.h:
+ (TCMalloc_SpinLock::Init):
+ (TCMalloc_SpinLock::Finalize):
+ (TCMalloc_SpinLock::Lock):
+ (TCMalloc_SpinLock::Unlock):
+
+2008-11-21 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ A little more RegExp refactoring.
+
+ Moved all assembly from WREC.cpp into WRECGenerator helper functions.
+ This should help with portability and readability.
+
+ Removed ASSERTs after calls to executableCopy(), and changed
+ executableCopy() to ASSERT instead.
+
+ * assembler/X86Assembler.h:
+ (JSC::X86Assembler::executableCopy):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompile):
+ (JSC::JIT::privateCompileGetByIdSelf):
+ (JSC::JIT::privateCompileGetByIdProto):
+ (JSC::JIT::privateCompileGetByIdChain):
+ (JSC::JIT::privateCompilePutByIdReplace):
+ (JSC::JIT::privateCompilePutByIdTransition):
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ (JSC::JIT::privateCompilePatchGetArrayLength):
+ * wrec/WREC.cpp:
+ (JSC::WREC::compileRegExp):
+ * wrec/WRECGenerator.cpp:
+ (JSC::WREC::Generator::generateEnter):
+ (JSC::WREC::Generator::generateReturnSuccess):
+ (JSC::WREC::Generator::generateSaveIndex):
+ (JSC::WREC::Generator::generateIncrementIndex):
+ (JSC::WREC::Generator::generateLoopIfNotEndOfInput):
+ (JSC::WREC::Generator::generateReturnFailure):
+ * wrec/WRECGenerator.h:
+ * wrec/WRECParser.h:
+ (JSC::WREC::Parser::ignoreCase):
+ (JSC::WREC::Parser::generator):
+
+2008-11-21 Alexey Proskuryakov <ap@webkit.org>
+
+ Build fix.
+
+ * wtf/Assertions.h: Use ::abort for C++ code.
+
+2008-11-21 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Sam Weinig.
+
+ https://bugs.webkit.org/show_bug.cgi?id=22402
+ Replace abort() with CRASH()
+
+ * wtf/Assertions.h: Added abort() after an attempt to crash for extra safety.
+
+ * runtime/Collector.cpp:
+ * wtf/FastMalloc.cpp:
+ * wtf/FastMalloc.h:
+ * wtf/TCSpinLock.h:
+ Replace abort() with CRASH().
+
+2008-11-21 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Renamed wrec => generator.
+
+ * wrec/WRECFunctors.cpp:
+ (JSC::WREC::GeneratePatternCharacterFunctor::generateAtom):
+ (JSC::WREC::GeneratePatternCharacterFunctor::backtrack):
+ (JSC::WREC::GenerateCharacterClassFunctor::generateAtom):
+ (JSC::WREC::GenerateCharacterClassFunctor::backtrack):
+ (JSC::WREC::GenerateBackreferenceFunctor::generateAtom):
+ (JSC::WREC::GenerateBackreferenceFunctor::backtrack):
+ (JSC::WREC::GenerateParenthesesNonGreedyFunctor::generateAtom):
+
+2008-11-19 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Add support for (really) polymorphic caching of prototype accesses.
+
+ If a cached prototype access misses, cti_op_get_by_id_proto_list is called.
+ When this occurs the Structure pointers from the instruction stream are copied
+ off into a new ProtoStubInfo object. A second prototype access trampoline is
+ generated, and chained onto the first. Subsequent missed call to
+ cti_op_get_by_id_proto_list_append, which append futher new trampolines, up to
+ PROTOTYPE_LIST_CACHE_SIZE (currently 4). If any of the misses result in an
+ access other than to a direct prototype property, list formation is halted (or
+ for the initial miss, does not take place at all).
+
+ Separate fail case functions are provided for each access since this contributes
+ to the performance progression (enables better processor branch prediction).
+
+ Overall this is a near 5% progression on v8, with around 10% wins on richards
+ and deltablue.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::dump):
+ (JSC::CodeBlock::derefStructures):
+ * bytecode/Instruction.h:
+ (JSC::ProtoStructureList::ProtoStubInfo::set):
+ (JSC::ProtoStructureList::ProtoStructureList):
+ (JSC::Instruction::Instruction):
+ (JSC::Instruction::):
+ * bytecode/Opcode.h:
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+ (JSC::Interpreter::tryCTICacheGetByID):
+ (JSC::Interpreter::cti_op_put_by_id_fail):
+ (JSC::Interpreter::cti_op_get_by_id_self_fail):
+ (JSC::Interpreter::cti_op_get_by_id_proto_list):
+ (JSC::Interpreter::cti_op_get_by_id_proto_list_append):
+ (JSC::Interpreter::cti_op_get_by_id_proto_list_full):
+ (JSC::Interpreter::cti_op_get_by_id_proto_fail):
+ (JSC::Interpreter::cti_op_get_by_id_chain_fail):
+ (JSC::Interpreter::cti_op_get_by_id_array_fail):
+ (JSC::Interpreter::cti_op_get_by_id_string_fail):
+ * interpreter/Interpreter.h:
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ (JSC::JIT::privateCompileGetByIdSelf):
+ (JSC::JIT::privateCompileGetByIdProto):
+ (JSC::JIT::privateCompileGetByIdProtoList):
+ (JSC::JIT::privateCompileGetByIdChain):
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ (JSC::JIT::privateCompilePatchGetArrayLength):
+ * jit/JIT.h:
+ (JSC::JIT::compileGetByIdProtoList):
+
+2008-11-20 Sam Weinig <sam@webkit.org>
+
+ Try and fix the tiger build.
+
+ * parser/Grammar.y:
+
+2008-11-20 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ Make JavaScriptCore Chromium build under Windows (cmd only, cygwin almost works)
+ https://bugs.webkit.org/show_bug.cgi?id=22347
+
+ * JavaScriptCore.scons:
+ * parser/Parser.cpp: Add using std::auto_ptr since we use auto_ptr
+
+2008-11-20 Steve Falkenburg <sfalken@apple.com>
+
+ Fix build.
+
+ Reviewed by Sam Weinig.
+
+ * parser/Parser.cpp:
+ (JSC::Parser::reparse):
+
+2008-11-20 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ A little more RegExp refactoring.
+
+ Created a helper function in the assembler for linking a vector of
+ JmpSrc to a location, and deployed it in a bunch of places.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * assembler/X86Assembler.h:
+ (JSC::X86Assembler::link):
+ * wrec/WREC.cpp:
+ (JSC::WREC::compileRegExp):
+ * wrec/WRECGenerator.cpp:
+ (JSC::WREC::Generator::generateNonGreedyQuantifier):
+ (JSC::WREC::Generator::generateGreedyQuantifier):
+ (JSC::WREC::Generator::generateCharacterClassInverted):
+ (JSC::WREC::Generator::generateParentheses):
+ (JSC::WREC::Generator::generateParenthesesResetTrampoline):
+ (JSC::WREC::Generator::generateAssertionBOL):
+ (JSC::WREC::Generator::generateAssertionEOL):
+ (JSC::WREC::Generator::generateAssertionWordBoundary):
+ (JSC::WREC::Generator::terminateAlternative):
+ (JSC::WREC::Generator::terminateDisjunction):
+ * wrec/WRECParser.cpp:
+ * wrec/WRECParser.h:
+ (JSC::WREC::Parser::consumeHex):
+
+2008-11-20 Sam Weinig <sam@webkit.org>
+
+ Fix non-mac builds.
+
+ * parser/Lexer.cpp:
+ * parser/Parser.cpp:
+
+2008-11-20 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ Patch for https://bugs.webkit.org/show_bug.cgi?id=22385
+ <rdar://problem/6390179>
+ Lazily reparse FunctionBodyNodes on first execution.
+
+ - Saves 57MB on Membuster head.
+
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::generate): Remove vector shrinking since this is now
+ handled by destroying the ScopeNodeData after generation.
+
+ * parser/Grammar.y: Add alternate NoNode version of the grammar
+ that does not create nodes. This is used to lazily create FunctionBodyNodes
+ on first execution.
+
+ * parser/Lexer.cpp:
+ (JSC::Lexer::setCode): Fix bug where on reparse, the Lexer was confused about
+ what position and length meant. Position is the current position in the original
+ data buffer (important for getting correct line/column information) and length
+ the end offset in the original buffer.
+ * parser/Lexer.h:
+ (JSC::Lexer::sourceCode): Positions are relative to the beginning of the buffer.
+
+ * parser/Nodes.cpp:
+ (JSC::ScopeNodeData::ScopeNodeData): Move initialization of ScopeNode data here.
+ (JSC::ScopeNode::ScopeNode): Add constructor that only sets the JSGlobalData
+ for FunctionBodyNode stubs.
+ (JSC::ScopeNode::~ScopeNode): Release m_children now that we don't inherit from
+ BlockNode.
+ (JSC::ScopeNode::releaseNodes): Ditto.
+ (JSC::EvalNode::generateBytecode): Only shrink m_children, as we need to keep around
+ the rest of the data.
+ (JSC::FunctionBodyNode::FunctionBodyNode): Add constructor that only sets the
+ JSGlobalData.
+ (JSC::FunctionBodyNode::create): Ditto.
+ (JSC::FunctionBodyNode::generateBytecode): If we don't have the data, do a reparse
+ to construct it. Then after generation, destroy the data.
+ (JSC::ProgramNode::generateBytecode): After generation, destroy the AST data.
+ * parser/Nodes.h:
+ (JSC::ExpressionNode::): Add isFuncExprNode for FunctionConstructor.
+ (JSC::StatementNode::): Add isExprStatementNode for FunctionConstructor.
+ (JSC::ExprStatementNode::): Ditto.
+ (JSC::ExprStatementNode::expr): Add accessor for FunctionConstructor.
+ (JSC::FuncExprNode::): Add isFuncExprNode for FunctionConstructor
+
+ (JSC::ScopeNode::adoptData): Adopts a ScopeNodeData.
+ (JSC::ScopeNode::data): Accessor for ScopeNodeData.
+ (JSC::ScopeNode::destroyData): Deletes the ScopeNodeData.
+ (JSC::ScopeNode::setFeatures): Added.
+ (JSC::ScopeNode::varStack): Added assert.
+ (JSC::ScopeNode::functionStack): Ditto.
+ (JSC::ScopeNode::children): Ditto.
+ (JSC::ScopeNode::neededConstants): Ditto.
+ Factor m_varStack, m_functionStack, m_children and m_numConstants into ScopeNodeData.
+
+ * parser/Parser.cpp:
+ (JSC::Parser::reparse): Reparse the SourceCode in the FunctionBodyNode and set
+ set up the ScopeNodeData for it.
+ * parser/Parser.h:
+
+ * parser/SourceCode.h:
+ (JSC::SourceCode::endOffset): Added for use in the lexer.
+
+ * runtime/FunctionConstructor.cpp:
+ (JSC::getFunctionBody): Assuming a ProgramNode with one FunctionExpression in it,
+ get the FunctionBodyNode. Any issues signifies a parse failure in constructFunction.
+ (JSC::constructFunction): Make parsing functions in the form new Function(""), easier
+ by concatenating the strings together (with some glue) and parsing the function expression
+ as a ProgramNode from which we can receive the FunctionBodyNode. This has the added benefit
+ of not having special parsing code for the arguments and lazily constructing the
+ FunctionBodyNode's AST on first execution.
+
+ * runtime/Identifier.h:
+ (JSC::operator!=): Added.
+
+2008-11-20 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ Speedup the lexer to offset coming re-parsing patch.
+
+ - .6% progression on Sunspider.
+
+ * bytecompiler/SegmentedVector.h:
+ (JSC::SegmentedVector::shrink): Fixed bug where m_size would not be
+ set when shrinking to 0.
+
+ * parser/Lexer.cpp:
+ (JSC::Lexer::Lexer):
+ (JSC::Lexer::isIdentStart): Use isASCIIAlpha and isASCII to avoid going into ICU in the common cases.
+ (JSC::Lexer::isIdentPart): Use isASCIIAlphanumeric and isASCII to avoid going into ICU in the common cases
+ (JSC::isDecimalDigit): Use version in ASCIICType.h. Inlining it was a regression.
+ (JSC::Lexer::isHexDigit): Ditto.
+ (JSC::Lexer::isOctalDigit): Ditto.
+ (JSC::Lexer::clear): Resize the m_identifiers SegmentedVector to initial
+ capacity
+ * parser/Lexer.h: Remove unused m_strings vector. Make m_identifiers
+ a SegmentedVector<Identifier> to avoid allocating a new Identifier* for
+ each identifier found. The SegmentedVector is need so we can passes
+ references to the Identifier to the parser, which remain valid even when
+ the vector is resized.
+ (JSC::Lexer::makeIdentifier): Inline and return a reference to the added
+ Identifier.
+
+2008-11-20 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ Add isASCII to ASCIICType. Use coming soon!
+
+ * wtf/ASCIICType.h:
+ (WTF::isASCII):
+
+2008-11-20 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ Add OwnPtr constructor and OwnPtr::adopt that take an auto_ptr.
+
+ * wtf/OwnPtr.h:
+ (WTF::OwnPtr::OwnPtr):
+ (WTF::OwnPtr::adopt):
+
+2008-11-20 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=22364
+ Crashes seen on Tiger buildbots due to worker threads exhausting pthread keys
+
+ * runtime/Collector.cpp:
+ (JSC::Heap::Heap):
+ (JSC::Heap::destroy):
+ (JSC::Heap::makeUsableFromMultipleThreads):
+ (JSC::Heap::registerThread):
+ * runtime/Collector.h:
+ Pthread key for tracking threads is only created on request now, because this is a limited
+ resource, and thread tracking is not needed for worker heaps, or for WebCore heap.
+
+ * API/JSContextRef.cpp: (JSGlobalContextCreateInGroup): Call makeUsableFromMultipleThreads().
+
+ * runtime/JSGlobalData.cpp: (JSC::JSGlobalData::sharedInstance): Ditto.
+
+ * runtime/JSGlobalData.h: (JSC::JSGlobalData::makeUsableFromMultipleThreads): Just forward
+ the call to Heap, which clients need not know about, ideally.
+
+2008-11-20 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ A little more WREC refactoring.
+
+ Removed the "Register" suffix from register names in WREC, and renamed:
+ currentPosition => index
+ currentValue => character
+ quantifierCount => repeatCount
+
+ Added a top-level parsePattern function to the WREC parser, which
+ allowed me to remove the error() and atEndOfPattern() accessors.
+
+ Factored out an MSVC customization into a constant.
+
+ Renamed nextLabel => beginPattern.
+
+ * wrec/WREC.cpp:
+ (JSC::WREC::compileRegExp):
+ * wrec/WRECGenerator.cpp:
+ (JSC::WREC::Generator::generateBacktrack1):
+ (JSC::WREC::Generator::generateBacktrackBackreference):
+ (JSC::WREC::Generator::generateBackreferenceQuantifier):
+ (JSC::WREC::Generator::generateNonGreedyQuantifier):
+ (JSC::WREC::Generator::generateGreedyQuantifier):
+ (JSC::WREC::Generator::generatePatternCharacter):
+ (JSC::WREC::Generator::generateCharacterClassInvertedRange):
+ (JSC::WREC::Generator::generateCharacterClassInverted):
+ (JSC::WREC::Generator::generateCharacterClass):
+ (JSC::WREC::Generator::generateParentheses):
+ (JSC::WREC::Generator::generateParenthesesResetTrampoline):
+ (JSC::WREC::Generator::generateAssertionBOL):
+ (JSC::WREC::Generator::generateAssertionEOL):
+ (JSC::WREC::Generator::generateAssertionWordBoundary):
+ (JSC::WREC::Generator::generateBackreference):
+ (JSC::WREC::Generator::generateDisjunction):
+ (JSC::WREC::Generator::terminateDisjunction):
+ * wrec/WRECGenerator.h:
+ * wrec/WRECParser.h:
+ (JSC::WREC::Parser::parsePattern):
+
+2008-11-19 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=22361
+ A little more RegExp refactoring.
+
+ Consistently named variables holding the starting position at which
+ regexp matching should begin to "startOffset".
+
+ A few more "regExpObject" => "regExpConstructor" changes.
+
+ Refactored RegExpObject::match for clarity, and replaced a slow "get"
+ of the "global" property with a fast access to the global bit.
+
+ Made the error message you see when RegExpObject::match has no input a
+ little more informative, as in Firefox.
+
+ * runtime/RegExp.cpp:
+ (JSC::RegExp::match):
+ * runtime/RegExp.h:
+ * runtime/RegExpObject.cpp:
+ (JSC::RegExpObject::match):
+ * runtime/StringPrototype.cpp:
+ (JSC::stringProtoFuncReplace):
+ (JSC::stringProtoFuncMatch):
+ (JSC::stringProtoFuncSearch):
+
+2008-11-19 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ A little more refactoring.
+
+ Removed the "emit" and "emitUnlinked" prefixes from the assembler.
+
+ Moved the JmpSrc and JmpDst class definitions to the top of the X86
+ assembler class, in accordance with WebKit style guidelines.
+
+ * assembler/X86Assembler.h:
+ (JSC::X86Assembler::JmpSrc::JmpSrc):
+ (JSC::X86Assembler::JmpDst::JmpDst):
+ (JSC::X86Assembler::int3):
+ (JSC::X86Assembler::pushl_m):
+ (JSC::X86Assembler::popl_m):
+ (JSC::X86Assembler::movl_rr):
+ (JSC::X86Assembler::addl_rr):
+ (JSC::X86Assembler::addl_i8r):
+ (JSC::X86Assembler::addl_i8m):
+ (JSC::X86Assembler::addl_i32r):
+ (JSC::X86Assembler::addl_mr):
+ (JSC::X86Assembler::andl_rr):
+ (JSC::X86Assembler::andl_i32r):
+ (JSC::X86Assembler::cmpl_i8r):
+ (JSC::X86Assembler::cmpl_rr):
+ (JSC::X86Assembler::cmpl_rm):
+ (JSC::X86Assembler::cmpl_mr):
+ (JSC::X86Assembler::cmpl_i32r):
+ (JSC::X86Assembler::cmpl_i32m):
+ (JSC::X86Assembler::cmpl_i8m):
+ (JSC::X86Assembler::cmpw_rm):
+ (JSC::X86Assembler::orl_rr):
+ (JSC::X86Assembler::orl_mr):
+ (JSC::X86Assembler::orl_i32r):
+ (JSC::X86Assembler::subl_rr):
+ (JSC::X86Assembler::subl_i8r):
+ (JSC::X86Assembler::subl_i8m):
+ (JSC::X86Assembler::subl_i32r):
+ (JSC::X86Assembler::subl_mr):
+ (JSC::X86Assembler::testl_i32r):
+ (JSC::X86Assembler::testl_i32m):
+ (JSC::X86Assembler::testl_rr):
+ (JSC::X86Assembler::xorl_i8r):
+ (JSC::X86Assembler::xorl_rr):
+ (JSC::X86Assembler::sarl_i8r):
+ (JSC::X86Assembler::sarl_CLr):
+ (JSC::X86Assembler::shl_i8r):
+ (JSC::X86Assembler::shll_CLr):
+ (JSC::X86Assembler::imull_rr):
+ (JSC::X86Assembler::imull_i32r):
+ (JSC::X86Assembler::idivl_r):
+ (JSC::X86Assembler::negl_r):
+ (JSC::X86Assembler::movl_mr):
+ (JSC::X86Assembler::movzbl_rr):
+ (JSC::X86Assembler::movzwl_mr):
+ (JSC::X86Assembler::movl_rm):
+ (JSC::X86Assembler::movl_i32r):
+ (JSC::X86Assembler::movl_i32m):
+ (JSC::X86Assembler::leal_mr):
+ (JSC::X86Assembler::jmp_r):
+ (JSC::X86Assembler::jmp_m):
+ (JSC::X86Assembler::movsd_mr):
+ (JSC::X86Assembler::xorpd_mr):
+ (JSC::X86Assembler::movsd_rm):
+ (JSC::X86Assembler::movd_rr):
+ (JSC::X86Assembler::cvtsi2sd_rr):
+ (JSC::X86Assembler::cvttsd2si_rr):
+ (JSC::X86Assembler::addsd_mr):
+ (JSC::X86Assembler::subsd_mr):
+ (JSC::X86Assembler::mulsd_mr):
+ (JSC::X86Assembler::addsd_rr):
+ (JSC::X86Assembler::subsd_rr):
+ (JSC::X86Assembler::mulsd_rr):
+ (JSC::X86Assembler::ucomis_rr):
+ (JSC::X86Assembler::pextrw_irr):
+ (JSC::X86Assembler::call):
+ (JSC::X86Assembler::jmp):
+ (JSC::X86Assembler::jne):
+ (JSC::X86Assembler::jnz):
+ (JSC::X86Assembler::je):
+ (JSC::X86Assembler::jl):
+ (JSC::X86Assembler::jb):
+ (JSC::X86Assembler::jle):
+ (JSC::X86Assembler::jbe):
+ (JSC::X86Assembler::jge):
+ (JSC::X86Assembler::jg):
+ (JSC::X86Assembler::ja):
+ (JSC::X86Assembler::jae):
+ (JSC::X86Assembler::jo):
+ (JSC::X86Assembler::jp):
+ (JSC::X86Assembler::js):
+ (JSC::X86Assembler::predictNotTaken):
+ (JSC::X86Assembler::convertToFastCall):
+ (JSC::X86Assembler::restoreArgumentReference):
+ (JSC::X86Assembler::restoreArgumentReferenceForTrampoline):
+ (JSC::X86Assembler::modRm_rr):
+ (JSC::X86Assembler::modRm_rr_Unchecked):
+ (JSC::X86Assembler::modRm_rm):
+ (JSC::X86Assembler::modRm_rm_Unchecked):
+ (JSC::X86Assembler::modRm_rmsib):
+ (JSC::X86Assembler::modRm_opr):
+ (JSC::X86Assembler::modRm_opr_Unchecked):
+ (JSC::X86Assembler::modRm_opm):
+ (JSC::X86Assembler::modRm_opm_Unchecked):
+ (JSC::X86Assembler::modRm_opmsib):
+ * jit/JIT.cpp:
+ (JSC::JIT::emitNakedCall):
+ (JSC::JIT::emitNakedFastCall):
+ (JSC::JIT::emitCTICall):
+ (JSC::JIT::emitJumpSlowCaseIfNotJSCell):
+ (JSC::JIT::emitJumpSlowCaseIfNotImmNum):
+ (JSC::JIT::emitFastArithDeTagImmediateJumpIfZero):
+ (JSC::JIT::emitFastArithIntToImmOrSlowCase):
+ (JSC::JIT::emitArithIntToImmWithJump):
+ (JSC::JIT::compileOpCall):
+ (JSC::JIT::compileOpStrictEq):
+ (JSC::JIT::emitSlowScriptCheck):
+ (JSC::JIT::putDoubleResultToJSNumberCellOrJSImmediate):
+ (JSC::JIT::compileBinaryArithOp):
+ (JSC::JIT::privateCompileMainPass):
+ (JSC::JIT::privateCompileSlowCases):
+ (JSC::JIT::privateCompile):
+ (JSC::JIT::privateCompileGetByIdSelf):
+ (JSC::JIT::privateCompileGetByIdProto):
+ (JSC::JIT::privateCompileGetByIdChain):
+ (JSC::JIT::privateCompilePutByIdReplace):
+ (JSC::JIT::privateCompilePutByIdTransition):
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ (JSC::JIT::privateCompilePatchGetArrayLength):
+ * wrec/WREC.cpp:
+ (JSC::WREC::compileRegExp):
+ * wrec/WRECGenerator.cpp:
+ (JSC::WREC::Generator::generateBackreferenceQuantifier):
+ (JSC::WREC::Generator::generateNonGreedyQuantifier):
+ (JSC::WREC::Generator::generateGreedyQuantifier):
+ (JSC::WREC::Generator::generatePatternCharacter):
+ (JSC::WREC::Generator::generateCharacterClassInvertedRange):
+ (JSC::WREC::Generator::generateCharacterClassInverted):
+ (JSC::WREC::Generator::generateCharacterClass):
+ (JSC::WREC::Generator::generateParentheses):
+ (JSC::WREC::Generator::generateParenthesesNonGreedy):
+ (JSC::WREC::Generator::generateParenthesesResetTrampoline):
+ (JSC::WREC::Generator::generateAssertionBOL):
+ (JSC::WREC::Generator::generateAssertionEOL):
+ (JSC::WREC::Generator::generateAssertionWordBoundary):
+ (JSC::WREC::Generator::generateBackreference):
+ (JSC::WREC::Generator::generateDisjunction):
+
+2008-11-19 Simon Hausmann <hausmann@webkit.org>
+
+ Sun CC build fix, removed trailing comman for last enum value.
+
+ * wtf/unicode/qt4/UnicodeQt4.h:
+ (WTF::Unicode::):
+
+2008-11-19 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Expand the workaround for Apple GCC compiler bug <rdar://problem/6354696> to all versions of GCC 4.0.1.
+ It has been observed with builds 5465 (Xcode 3.0) and 5484 (Xcode 3.1), and there is no evidence
+ that it has been fixed in newer builds of GCC 4.0.1.
+
+ This addresses <https://bugs.webkit.org/show_bug.cgi?id=22351> (WebKit nightly crashes on launch on 10.4.11).
+
+ * wtf/StdLibExtras.h:
+
+2008-11-18 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Maciej Stachowiak and Geoff Garen.
+
+ Bug 22287: ASSERTION FAILED: Not enough jumps linked in slow case codegen in CTI::privateCompileSlowCases())
+ <https://bugs.webkit.org/show_bug.cgi?id=22287>
+
+ Fix a typo in the number cell reuse code where the first and second
+ operands are sometimes confused.
+
+ * jit/JIT.cpp:
+ (JSC::JIT::compileBinaryArithOpSlowCase):
+
+2008-11-18 Dan Bernstein <mitz@apple.com>
+
+ - try to fix the Windows build
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+
+2008-11-18 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Minor RegExp cleanup.
+
+ SunSpider says no change.
+
+ * runtime/RegExpObject.cpp:
+ (JSC::RegExpObject::match): Renamed "regExpObj" to "regExpConstructor".
+
+ * wrec/WREC.cpp:
+ (JSC::WREC::compileRegExp): Instead of checking for a NULL output vector,
+ ASSERT that the output vector is not NULL. (The rest of WREC is not
+ safe to use with a NULL output vector, and we probably don't want to
+ spend the time and/or performance to make it safe.)
+
+2008-11-18 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ A little more renaming and refactoring.
+
+ VM_CHECK_EXCEPTION() => CHECK_FOR_EXCEPTION().
+ NEXT_INSTRUCTION => NEXT_INSTRUCTION().
+
+ Removed the "Error_" and "TempError_" prefixes from WREC error types.
+
+ Refactored the WREC parser so it doesn't need a "setError" function,
+ and changed "isEndOfPattern" and its use -- they read kind of backwards
+ before.
+
+ Changed our "TODO:" error messages at least to say something, since you
+ can't say "TODO:" in shipping software.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+ (JSC::Interpreter::cti_op_convert_this):
+ (JSC::Interpreter::cti_op_add):
+ (JSC::Interpreter::cti_op_pre_inc):
+ (JSC::Interpreter::cti_op_loop_if_less):
+ (JSC::Interpreter::cti_op_loop_if_lesseq):
+ (JSC::Interpreter::cti_op_put_by_id):
+ (JSC::Interpreter::cti_op_put_by_id_second):
+ (JSC::Interpreter::cti_op_put_by_id_generic):
+ (JSC::Interpreter::cti_op_put_by_id_fail):
+ (JSC::Interpreter::cti_op_get_by_id):
+ (JSC::Interpreter::cti_op_get_by_id_second):
+ (JSC::Interpreter::cti_op_get_by_id_generic):
+ (JSC::Interpreter::cti_op_get_by_id_fail):
+ (JSC::Interpreter::cti_op_instanceof):
+ (JSC::Interpreter::cti_op_del_by_id):
+ (JSC::Interpreter::cti_op_mul):
+ (JSC::Interpreter::cti_op_call_NotJSFunction):
+ (JSC::Interpreter::cti_op_resolve):
+ (JSC::Interpreter::cti_op_construct_NotJSConstruct):
+ (JSC::Interpreter::cti_op_get_by_val):
+ (JSC::Interpreter::cti_op_resolve_func):
+ (JSC::Interpreter::cti_op_sub):
+ (JSC::Interpreter::cti_op_put_by_val):
+ (JSC::Interpreter::cti_op_put_by_val_array):
+ (JSC::Interpreter::cti_op_lesseq):
+ (JSC::Interpreter::cti_op_loop_if_true):
+ (JSC::Interpreter::cti_op_negate):
+ (JSC::Interpreter::cti_op_resolve_skip):
+ (JSC::Interpreter::cti_op_resolve_global):
+ (JSC::Interpreter::cti_op_div):
+ (JSC::Interpreter::cti_op_pre_dec):
+ (JSC::Interpreter::cti_op_jless):
+ (JSC::Interpreter::cti_op_not):
+ (JSC::Interpreter::cti_op_jtrue):
+ (JSC::Interpreter::cti_op_post_inc):
+ (JSC::Interpreter::cti_op_eq):
+ (JSC::Interpreter::cti_op_lshift):
+ (JSC::Interpreter::cti_op_bitand):
+ (JSC::Interpreter::cti_op_rshift):
+ (JSC::Interpreter::cti_op_bitnot):
+ (JSC::Interpreter::cti_op_resolve_with_base):
+ (JSC::Interpreter::cti_op_mod):
+ (JSC::Interpreter::cti_op_less):
+ (JSC::Interpreter::cti_op_neq):
+ (JSC::Interpreter::cti_op_post_dec):
+ (JSC::Interpreter::cti_op_urshift):
+ (JSC::Interpreter::cti_op_bitxor):
+ (JSC::Interpreter::cti_op_bitor):
+ (JSC::Interpreter::cti_op_push_scope):
+ (JSC::Interpreter::cti_op_to_jsnumber):
+ (JSC::Interpreter::cti_op_in):
+ (JSC::Interpreter::cti_op_del_by_val):
+ * wrec/WREC.cpp:
+ (JSC::WREC::compileRegExp):
+ * wrec/WRECParser.cpp:
+ (JSC::WREC::Parser::parseGreedyQuantifier):
+ (JSC::WREC::Parser::parseParentheses):
+ (JSC::WREC::Parser::parseCharacterClass):
+ (JSC::WREC::Parser::parseEscape):
+ * wrec/WRECParser.h:
+ (JSC::WREC::Parser::):
+ (JSC::WREC::Parser::atEndOfPattern):
+
+2008-11-18 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=22337
+ Enable workers by default
+
+ * Configurations/JavaScriptCore.xcconfig: Define ENABLE_WORKERS.
+
+2008-11-18 Alexey Proskuryakov <ap@webkit.org>
+
+ - Windows build fix
+
+ * wrec/WRECFunctors.h:
+ * wrec/WRECGenerator.h:
+ * wrec/WRECParser.h:
+ CharacterClass is a struct, not a class, fix forward declarations.
+
+2008-11-18 Dan Bernstein <mitz@apple.com>
+
+ - Windows build fix
+
+ * assembler/X86Assembler.h:
+
+2008-11-17 Geoffrey Garen <ggaren@apple.com>
+
+ Not reviewed.
+
+ Try to fix gtk build.
+
+ * wrec/Quantifier.h:
+
+2008-11-17 Geoffrey Garen <ggaren@apple.com>
+
+ Not reviewed.
+
+ Try to fix gtk build.
+
+ * assembler/AssemblerBuffer.h:
+
+2008-11-17 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Split WREC classes out into individual files, with a few modifications
+ to more closely match the WebKit coding style.
+
+ * GNUmakefile.am:
+ * JavaScriptCore.scons:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * assembler/X86Assembler.h:
+ * runtime/RegExp.cpp:
+ * wrec/CharacterClass.cpp: Copied from wrec/CharacterClassConstructor.cpp.
+ (JSC::WREC::CharacterClass::newline):
+ (JSC::WREC::CharacterClass::digits):
+ (JSC::WREC::CharacterClass::spaces):
+ (JSC::WREC::CharacterClass::wordchar):
+ (JSC::WREC::CharacterClass::nondigits):
+ (JSC::WREC::CharacterClass::nonspaces):
+ (JSC::WREC::CharacterClass::nonwordchar):
+ * wrec/CharacterClass.h: Copied from wrec/CharacterClassConstructor.h.
+ * wrec/CharacterClassConstructor.cpp:
+ (JSC::WREC::CharacterClassConstructor::addSortedRange):
+ (JSC::WREC::CharacterClassConstructor::append):
+ * wrec/CharacterClassConstructor.h:
+ * wrec/Quantifier.h: Copied from wrec/WREC.h.
+ * wrec/WREC.cpp:
+ (JSC::WREC::compileRegExp):
+ * wrec/WREC.h:
+ * wrec/WRECFunctors.cpp: Copied from wrec/WREC.cpp.
+ * wrec/WRECFunctors.h: Copied from wrec/WREC.cpp.
+ (JSC::WREC::GenerateAtomFunctor::~GenerateAtomFunctor):
+ (JSC::WREC::GeneratePatternCharacterFunctor::GeneratePatternCharacterFunctor):
+ (JSC::WREC::GenerateCharacterClassFunctor::GenerateCharacterClassFunctor):
+ (JSC::WREC::GenerateBackreferenceFunctor::GenerateBackreferenceFunctor):
+ (JSC::WREC::GenerateParenthesesNonGreedyFunctor::GenerateParenthesesNonGreedyFunctor):
+ * wrec/WRECGenerator.cpp: Copied from wrec/WREC.cpp.
+ (JSC::WREC::Generator::generatePatternCharacter):
+ (JSC::WREC::Generator::generateCharacterClassInvertedRange):
+ (JSC::WREC::Generator::generateCharacterClassInverted):
+ (JSC::WREC::Generator::generateCharacterClass):
+ (JSC::WREC::Generator::generateParentheses):
+ (JSC::WREC::Generator::generateAssertionBOL):
+ (JSC::WREC::Generator::generateAssertionEOL):
+ (JSC::WREC::Generator::generateAssertionWordBoundary):
+ * wrec/WRECGenerator.h: Copied from wrec/WREC.h.
+ * wrec/WRECParser.cpp: Copied from wrec/WREC.cpp.
+ (JSC::WREC::Parser::parseGreedyQuantifier):
+ (JSC::WREC::Parser::parseCharacterClassQuantifier):
+ (JSC::WREC::Parser::parseParentheses):
+ (JSC::WREC::Parser::parseCharacterClass):
+ (JSC::WREC::Parser::parseEscape):
+ (JSC::WREC::Parser::parseTerm):
+ * wrec/WRECParser.h: Copied from wrec/WREC.h.
+ (JSC::WREC::Parser::):
+ (JSC::WREC::Parser::Parser):
+ (JSC::WREC::Parser::setError):
+ (JSC::WREC::Parser::error):
+ (JSC::WREC::Parser::recordSubpattern):
+ (JSC::WREC::Parser::numSubpatterns):
+ (JSC::WREC::Parser::ignoreCase):
+ (JSC::WREC::Parser::multiline):
+
+2008-11-17 Geoffrey Garen <ggaren@apple.com>
+
+ Not reviewed.
+
+ Try to fix a few builds.
+
+ * JavaScriptCoreSources.bkl:
+
+2008-11-17 Geoffrey Garen <ggaren@apple.com>
+
+ Not reviewed.
+
+ Try to fix a few builds.
+
+ * JavaScriptCore.pri:
+ * JavaScriptCore.scons:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+
+2008-11-17 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Moved VM/CTI.* => jit/JIT.*.
+
+ Removed VM.
+
+ * GNUmakefile.am:
+ * JavaScriptCore.pri:
+ * JavaScriptCore.scons:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * VM/CTI.cpp: Removed.
+ * VM/CTI.h: Removed.
+ * bytecode/CodeBlock.cpp:
+ * interpreter/Interpreter.cpp:
+ * jit: Added.
+ * jit/JIT.cpp: Copied from VM/CTI.cpp.
+ * jit/JIT.h: Copied from VM/CTI.h.
+ * runtime/RegExp.cpp:
+
+2008-11-17 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Moved runtime/ExecState.* => interpreter/CallFrame.*.
+
+ * API/JSBase.cpp:
+ * API/OpaqueJSString.cpp:
+ * GNUmakefile.am:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * debugger/DebuggerCallFrame.h:
+ * interpreter/CallFrame.cpp: Copied from runtime/ExecState.cpp.
+ * interpreter/CallFrame.h: Copied from runtime/ExecState.h.
+ * interpreter/Interpreter.cpp:
+ * parser/Nodes.cpp:
+ * profiler/ProfileGenerator.cpp:
+ * profiler/Profiler.cpp:
+ * runtime/ClassInfo.h:
+ * runtime/Collector.cpp:
+ * runtime/Completion.cpp:
+ * runtime/ExceptionHelpers.cpp:
+ * runtime/ExecState.cpp: Removed.
+ * runtime/ExecState.h: Removed.
+ * runtime/Identifier.cpp:
+ * runtime/JSFunction.cpp:
+ * runtime/JSGlobalObjectFunctions.cpp:
+ * runtime/JSLock.cpp:
+ * runtime/JSNumberCell.h:
+ * runtime/JSObject.h:
+ * runtime/JSString.h:
+ * runtime/Lookup.h:
+ * runtime/PropertyNameArray.h:
+
+2008-11-17 Geoffrey Garen <ggaren@apple.com>
+
+ Not reviewed.
+
+ Try to fix Windows build.
+
+ * API/APICast.h:
+
+2008-11-17 Geoffrey Garen <ggaren@apple.com>
+
+ Not reviewed.
+
+ Try to fix Windows build.
+
+ * API/APICast.h:
+ * runtime/ExecState.h:
+
+2008-11-17 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Moved VM/SamplingTool.* => bytecode/SamplingTool.*.
+
+ * GNUmakefile.am:
+ * JavaScriptCore.pri:
+ * JavaScriptCore.scons:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * JavaScriptCoreSources.bkl:
+ * VM/SamplingTool.cpp: Removed.
+ * VM/SamplingTool.h: Removed.
+ * bytecode/SamplingTool.cpp: Copied from VM/SamplingTool.cpp.
+ * bytecode/SamplingTool.h: Copied from VM/SamplingTool.h.
+ * jsc.cpp:
+ (runWithScripts):
+
+2008-11-17 Geoffrey Garen <ggaren@apple.com>
+
+ Not reviewed.
+
+ Try to fix Windows build.
+
+ * runtime/ExecState.h:
+
+2008-11-17 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Moved VM/ExceptionHelpers.cpp => runtime/ExceptionHelpers.cpp.
+
+ * GNUmakefile.am:
+ * JavaScriptCore.pri:
+ * JavaScriptCore.scons:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * JavaScriptCoreSources.bkl:
+ * VM/ExceptionHelpers.cpp: Removed.
+ * runtime/ExceptionHelpers.cpp: Copied from VM/ExceptionHelpers.cpp.
+
+2008-11-17 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Moved VM/RegisterFile.cpp => interpreter/RegisterFile.cpp.
+
+ * AllInOneFile.cpp:
+ * GNUmakefile.am:
+ * JavaScriptCore.pri:
+ * JavaScriptCore.scons:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * JavaScriptCoreSources.bkl:
+ * VM/RegisterFile.cpp: Removed.
+ * interpreter/RegisterFile.cpp: Copied from VM/RegisterFile.cpp.
+
+2008-11-17 Geoffrey Garen <ggaren@apple.com>
+
+ Not reviewed.
+
+ Try to fix Windows build.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+
+2008-11-17 Geoffrey Garen <ggaren@apple.com>
+
+ Not reviewed.
+
+ Try to fix Windows build.
+
+ * JavaScriptCore.vcproj/jsc/jsc.vcproj:
+
+2008-11-17 Geoffrey Garen <ggaren@apple.com>
+
+ Not reviewed.
+
+ Try to fix Windows build.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+
+2008-11-17 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Moved:
+ VM/ExceptionHelpers.h => runtime/ExceptionHelpers.h
+ VM/Register.h => interpreter/Register.h
+ VM/RegisterFile.h => interpreter/RegisterFile.h
+
+
+ * GNUmakefile.am:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * VM/ExceptionHelpers.h: Removed.
+ * VM/Register.h: Removed.
+ * VM/RegisterFile.h: Removed.
+ * interpreter/Register.h: Copied from VM/Register.h.
+ * interpreter/RegisterFile.h: Copied from VM/RegisterFile.h.
+ * runtime/ExceptionHelpers.h: Copied from VM/ExceptionHelpers.h.
+
+2008-11-17 Geoffrey Garen <ggaren@apple.com>
+
+ Not reviewed.
+
+ Try to fix Qt build.
+
+ * JavaScriptCore.pri:
+
+2008-11-17 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Moved VM/Machine.cpp => interpreter/Interpreter.cpp.
+
+ * DerivedSources.make:
+ * GNUmakefile.am:
+ * JavaScriptCore.pri:
+ * JavaScriptCore.scons:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * JavaScriptCoreSources.bkl:
+ * VM/Machine.cpp: Removed.
+ * interpreter/Interpreter.cpp: Copied from VM/Machine.cpp.
+
+2008-11-17 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Moved VM/Machine.h => interpreter/Interpreter.h
+
+ * GNUmakefile.am:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * VM/CTI.cpp:
+ * VM/CTI.h:
+ * VM/ExceptionHelpers.cpp:
+ * VM/Machine.cpp:
+ * VM/Machine.h: Removed.
+ * VM/SamplingTool.cpp:
+ * bytecode/CodeBlock.cpp:
+ * bytecompiler/BytecodeGenerator.cpp:
+ * bytecompiler/BytecodeGenerator.h:
+ * debugger/DebuggerCallFrame.cpp:
+ * interpreter: Added.
+ * interpreter/Interpreter.h: Copied from VM/Machine.h.
+ * profiler/ProfileGenerator.cpp:
+ * runtime/Arguments.h:
+ * runtime/ArrayPrototype.cpp:
+ * runtime/Collector.cpp:
+ * runtime/Completion.cpp:
+ * runtime/ExecState.h:
+ * runtime/FunctionPrototype.cpp:
+ * runtime/JSActivation.cpp:
+ * runtime/JSFunction.cpp:
+ * runtime/JSGlobalData.cpp:
+ * runtime/JSGlobalObject.cpp:
+ * runtime/JSGlobalObjectFunctions.cpp:
+ * wrec/WREC.cpp:
+
+2008-11-17 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Moved runtime/Interpreter.cpp => runtime/Completion.cpp.
+
+ Moved functions from Interpreter.h to Completion.h, and removed
+ Interpreter.h from the project.
+
+ * API/JSBase.cpp:
+ * AllInOneFile.cpp:
+ * GNUmakefile.am:
+ * JavaScriptCore.pri:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * JavaScriptCoreSources.bkl:
+ * jsc.cpp:
+ * runtime/Completion.cpp: Copied from runtime/Interpreter.cpp.
+ * runtime/Completion.h:
+ * runtime/Interpreter.cpp: Removed.
+ * runtime/Interpreter.h: Removed.
+
+2008-11-17 Gabor Loki <loki@inf.u-szeged.hu>
+
+ Reviewed by Darin Adler.
+
+ <https://bugs.webkit.org/show_bug.cgi?id=22312>
+ Fix PCRE include path problem on Qt-port
+
+ * JavaScriptCore.pri:
+ * pcre/pcre.pri:
+
+2008-11-17 Gabor Loki <loki@inf.u-szeged.hu>
+
+ Reviewed by Darin Adler.
+
+ <https://bugs.webkit.org/show_bug.cgi?id=22313>
+ Add missing CTI source to the build system on Qt-port
+
+ * JavaScriptCore.pri:
+
+2008-11-17 Geoffrey Garen <ggaren@apple.com>
+
+ Not reviewed.
+
+ Try to fix JSGlue build.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2008-11-17 Geoffrey Garen <ggaren@apple.com>
+
+ Not reviewed.
+
+ Try to fix Qt build.
+
+ * jsc.pro:
+
+2008-11-17 Geoffrey Garen <ggaren@apple.com>
+
+ Not reviewed.
+
+ Try to fix Qt build.
+
+ * JavaScriptCore.pri:
+
+2008-11-17 Geoffrey Garen <ggaren@apple.com>
+
+ Not reviewed.
+
+ Try to fix Qt build.
+
+ * JavaScriptCore.pri:
+
+2008-11-17 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ More file moves:
+
+ VM/CodeBlock.* => bytecode/CodeBlock.*
+ VM/EvalCodeCache.h => bytecode/EvalCodeCache.h
+ VM/Instruction.h => bytecode/Instruction.h
+ VM/Opcode.* => bytecode/Opcode.*
+
+ * GNUmakefile.am:
+ * JavaScriptCore.scons:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.vcproj/jsc/jsc.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * JavaScriptCoreSources.bkl:
+ * VM/CodeBlock.cpp: Removed.
+ * VM/CodeBlock.h: Removed.
+ * VM/EvalCodeCache.h: Removed.
+ * VM/Instruction.h: Removed.
+ * VM/Opcode.cpp: Removed.
+ * VM/Opcode.h: Removed.
+ * bytecode: Added.
+ * bytecode/CodeBlock.cpp: Copied from VM/CodeBlock.cpp.
+ * bytecode/CodeBlock.h: Copied from VM/CodeBlock.h.
+ * bytecode/EvalCodeCache.h: Copied from VM/EvalCodeCache.h.
+ * bytecode/Instruction.h: Copied from VM/Instruction.h.
+ * bytecode/Opcode.cpp: Copied from VM/Opcode.cpp.
+ * bytecode/Opcode.h: Copied from VM/Opcode.h.
+ * jsc.pro:
+ * jscore.bkl:
+
+2008-11-17 Geoffrey Garen <ggaren@apple.com>
+
+ Not reviewed.
+
+ Try to fix a few more builds.
+
+ * GNUmakefile.am:
+ * JavaScriptCore.pri:
+ * JavaScriptCore.scons:
+ * JavaScriptCoreSources.bkl:
+
+2008-11-17 Geoffrey Garen <ggaren@apple.com>
+
+ Not reviewed.
+
+ Try to fix gtk build.
+
+ * GNUmakefile.am:
+
+2008-11-17 Geoffrey Garen <ggaren@apple.com>
+
+ Not reviewed.
+
+ Try to fix Windows build.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+
+2008-11-17 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Some file moves:
+
+ VM/LabelID.h => bytecompiler/Label.h
+ VM/RegisterID.h => bytecompiler/RegisterID.h
+ VM/SegmentedVector.h => bytecompiler/SegmentedVector.h
+ bytecompiler/CodeGenerator.* => bytecompiler/BytecodeGenerator.*
+
+ * AllInOneFile.cpp:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * VM/LabelID.h: Removed.
+ * VM/RegisterID.h: Removed.
+ * VM/SegmentedVector.h: Removed.
+ * bytecompiler/BytecodeGenerator.cpp: Copied from bytecompiler/CodeGenerator.cpp.
+ * bytecompiler/BytecodeGenerator.h: Copied from bytecompiler/CodeGenerator.h.
+ * bytecompiler/CodeGenerator.cpp: Removed.
+ * bytecompiler/CodeGenerator.h: Removed.
+ * bytecompiler/Label.h: Copied from VM/LabelID.h.
+ * bytecompiler/LabelScope.h:
+ * bytecompiler/RegisterID.h: Copied from VM/RegisterID.h.
+ * bytecompiler/SegmentedVector.h: Copied from VM/SegmentedVector.h.
+ * jsc.cpp:
+ * parser/Nodes.cpp:
+
+2008-11-17 Geoffrey Garen <ggaren@apple.com>
+
+ Not reviewed.
+
+ Try to fix Windows build.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+
+2008-11-17 Geoffrey Garen <ggaren@apple.com>
+
+ Not reviewed.
+
+ Try to fix Windows build.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+
+2008-11-17 Geoffrey Garen <ggaren@apple.com>
+
+ Not reviewed.
+
+ Try to fix Windows build.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+
+2008-11-16 Geoffrey Garen <ggaren@apple.com>
+
+ Not reviewed.
+
+ Try to fix Windows build.
+
+ * JavaScriptCore.vcproj/jsc/jsc.vcproj:
+
+2008-11-16 Geoffrey Garen <ggaren@apple.com>
+
+ Not reviewed.
+
+ Try to fix Windows build.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+
+2008-11-16 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Moved masm => assembler and split "AssemblerBuffer.h" out of "X86Assembler.h".
+
+ Also renamed ENABLE_MASM to ENABLE_ASSEMBLER.
+
+ * GNUmakefile.am:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * assembler: Added.
+ * assembler/AssemblerBuffer.h: Copied from masm/X86Assembler.h.
+ (JSC::AssemblerBuffer::AssemblerBuffer):
+ (JSC::AssemblerBuffer::~AssemblerBuffer):
+ (JSC::AssemblerBuffer::ensureSpace):
+ (JSC::AssemblerBuffer::isAligned):
+ (JSC::AssemblerBuffer::putByteUnchecked):
+ (JSC::AssemblerBuffer::putByte):
+ (JSC::AssemblerBuffer::putShortUnchecked):
+ (JSC::AssemblerBuffer::putShort):
+ (JSC::AssemblerBuffer::putIntUnchecked):
+ (JSC::AssemblerBuffer::putInt):
+ (JSC::AssemblerBuffer::data):
+ (JSC::AssemblerBuffer::size):
+ (JSC::AssemblerBuffer::reset):
+ (JSC::AssemblerBuffer::executableCopy):
+ (JSC::AssemblerBuffer::grow):
+ * assembler/X86Assembler.h: Copied from masm/X86Assembler.h.
+ * masm: Removed.
+ * masm/X86Assembler.h: Removed.
+ * wtf/Platform.h:
+
+2008-11-16 Geoffrey Garen <ggaren@apple.com>
+
+ Not reviewed.
+
+ Try to fix gtk build.
+
+ * GNUmakefile.am:
+
+2008-11-16 Geoffrey Garen <ggaren@apple.com>
+
+ Not reviewed.
+
+ Fixed tyop.
+
+ * VM/CTI.cpp:
+
+2008-11-16 Geoffrey Garen <ggaren@apple.com>
+
+ Not reviewed.
+
+ Try to fix windows build.
+
+ * VM/CTI.cpp:
+
+2008-11-16 Geoffrey Garen <ggaren@apple.com>
+
+ Not reviewed.
+
+ Try to fix gtk build.
+
+ * GNUmakefile.am:
+
+2008-11-16 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Renamed ENABLE_CTI and ENABLE(CTI) to ENABLE_JIT and ENABLE(JIT).
+
+ * VM/CTI.cpp:
+ * VM/CTI.h:
+ * VM/CodeBlock.cpp:
+ (JSC::CodeBlock::~CodeBlock):
+ * VM/CodeBlock.h:
+ (JSC::CodeBlock::CodeBlock):
+ * VM/Machine.cpp:
+ (JSC::Interpreter::Interpreter):
+ (JSC::Interpreter::initialize):
+ (JSC::Interpreter::~Interpreter):
+ (JSC::Interpreter::execute):
+ (JSC::Interpreter::privateExecute):
+ * VM/Machine.h:
+ * bytecompiler/CodeGenerator.cpp:
+ (JSC::prepareJumpTableForStringSwitch):
+ * runtime/JSFunction.cpp:
+ (JSC::JSFunction::~JSFunction):
+ * runtime/JSGlobalData.h:
+ * wrec/WREC.h:
+ * wtf/Platform.h:
+ * wtf/TCSystemAlloc.cpp:
+
+2008-11-16 Geoffrey Garen <ggaren@apple.com>
+
+ Not reviewed.
+
+ Try to fix gtk build.
+
+ * VM/CTI.cpp:
+
+2008-11-16 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by a few people on squirrelfish-dev.
+
+ Renamed CTI => JIT.
+
+ * VM/CTI.cpp:
+ (JSC::JIT::killLastResultRegister):
+ (JSC::JIT::emitGetVirtualRegister):
+ (JSC::JIT::emitGetVirtualRegisters):
+ (JSC::JIT::emitPutCTIArgFromVirtualRegister):
+ (JSC::JIT::emitPutCTIArg):
+ (JSC::JIT::emitGetCTIArg):
+ (JSC::JIT::emitPutCTIArgConstant):
+ (JSC::JIT::getConstantImmediateNumericArg):
+ (JSC::JIT::emitPutCTIParam):
+ (JSC::JIT::emitGetCTIParam):
+ (JSC::JIT::emitPutToCallFrameHeader):
+ (JSC::JIT::emitGetFromCallFrameHeader):
+ (JSC::JIT::emitPutVirtualRegister):
+ (JSC::JIT::emitInitRegister):
+ (JSC::JIT::printBytecodeOperandTypes):
+ (JSC::JIT::emitAllocateNumber):
+ (JSC::JIT::emitNakedCall):
+ (JSC::JIT::emitNakedFastCall):
+ (JSC::JIT::emitCTICall):
+ (JSC::JIT::emitJumpSlowCaseIfNotJSCell):
+ (JSC::JIT::linkSlowCaseIfNotJSCell):
+ (JSC::JIT::emitJumpSlowCaseIfNotImmNum):
+ (JSC::JIT::emitJumpSlowCaseIfNotImmNums):
+ (JSC::JIT::getDeTaggedConstantImmediate):
+ (JSC::JIT::emitFastArithDeTagImmediate):
+ (JSC::JIT::emitFastArithDeTagImmediateJumpIfZero):
+ (JSC::JIT::emitFastArithReTagImmediate):
+ (JSC::JIT::emitFastArithPotentiallyReTagImmediate):
+ (JSC::JIT::emitFastArithImmToInt):
+ (JSC::JIT::emitFastArithIntToImmOrSlowCase):
+ (JSC::JIT::emitFastArithIntToImmNoCheck):
+ (JSC::JIT::emitArithIntToImmWithJump):
+ (JSC::JIT::emitTagAsBoolImmediate):
+ (JSC::JIT::JIT):
+ (JSC::JIT::compileOpCallInitializeCallFrame):
+ (JSC::JIT::compileOpCallSetupArgs):
+ (JSC::JIT::compileOpCallEvalSetupArgs):
+ (JSC::JIT::compileOpConstructSetupArgs):
+ (JSC::JIT::compileOpCall):
+ (JSC::JIT::compileOpStrictEq):
+ (JSC::JIT::emitSlowScriptCheck):
+ (JSC::JIT::putDoubleResultToJSNumberCellOrJSImmediate):
+ (JSC::JIT::compileBinaryArithOp):
+ (JSC::JIT::compileBinaryArithOpSlowCase):
+ (JSC::JIT::privateCompileMainPass):
+ (JSC::JIT::privateCompileLinkPass):
+ (JSC::JIT::privateCompileSlowCases):
+ (JSC::JIT::privateCompile):
+ (JSC::JIT::privateCompileGetByIdSelf):
+ (JSC::JIT::privateCompileGetByIdProto):
+ (JSC::JIT::privateCompileGetByIdChain):
+ (JSC::JIT::privateCompilePutByIdReplace):
+ (JSC::JIT::privateCompilePutByIdTransition):
+ (JSC::JIT::unlinkCall):
+ (JSC::JIT::linkCall):
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ (JSC::JIT::freeCTIMachineTrampolines):
+ (JSC::JIT::patchGetByIdSelf):
+ (JSC::JIT::patchPutByIdReplace):
+ (JSC::JIT::privateCompilePatchGetArrayLength):
+ (JSC::JIT::emitGetVariableObjectRegister):
+ (JSC::JIT::emitPutVariableObjectRegister):
+ * VM/CTI.h:
+ (JSC::JIT::compile):
+ (JSC::JIT::compileGetByIdSelf):
+ (JSC::JIT::compileGetByIdProto):
+ (JSC::JIT::compileGetByIdChain):
+ (JSC::JIT::compilePutByIdReplace):
+ (JSC::JIT::compilePutByIdTransition):
+ (JSC::JIT::compileCTIMachineTrampolines):
+ (JSC::JIT::compilePatchGetArrayLength):
+ * VM/CodeBlock.cpp:
+ (JSC::CodeBlock::unlinkCallers):
+ * VM/Machine.cpp:
+ (JSC::Interpreter::initialize):
+ (JSC::Interpreter::~Interpreter):
+ (JSC::Interpreter::execute):
+ (JSC::Interpreter::tryCTICachePutByID):
+ (JSC::Interpreter::tryCTICacheGetByID):
+ (JSC::Interpreter::cti_op_call_JSFunction):
+ (JSC::Interpreter::cti_vm_dontLazyLinkCall):
+ (JSC::Interpreter::cti_vm_lazyLinkCall):
+ * VM/Machine.h:
+ * VM/RegisterFile.h:
+ * parser/Nodes.h:
+ * runtime/JSArray.h:
+ * runtime/JSCell.h:
+ * runtime/JSFunction.h:
+ * runtime/JSImmediate.h:
+ * runtime/JSNumberCell.h:
+ * runtime/JSObject.h:
+ * runtime/JSString.h:
+ * runtime/JSVariableObject.h:
+ * runtime/ScopeChain.h:
+ * runtime/Structure.h:
+ * runtime/TypeInfo.h:
+ * runtime/UString.h:
+
+2008-11-16 Geoffrey Garen <ggaren@apple.com>
+
+ Not reviewed.
+
+ Try to fix wx build.
+
+ * jscore.bkl:
+
+2008-11-16 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Nixed X86:: and X86Assembler:: prefixes in a lot of places using typedefs.
+
+ * VM/CTI.cpp:
+ (JSC::CTI::emitGetVirtualRegister):
+ (JSC::CTI::emitGetVirtualRegisters):
+ (JSC::CTI::emitPutCTIArgFromVirtualRegister):
+ (JSC::CTI::emitPutCTIArg):
+ (JSC::CTI::emitGetCTIArg):
+ (JSC::CTI::emitPutCTIParam):
+ (JSC::CTI::emitGetCTIParam):
+ (JSC::CTI::emitPutToCallFrameHeader):
+ (JSC::CTI::emitGetFromCallFrameHeader):
+ (JSC::CTI::emitPutVirtualRegister):
+ (JSC::CTI::emitNakedCall):
+ (JSC::CTI::emitNakedFastCall):
+ (JSC::CTI::emitCTICall):
+ (JSC::CTI::emitJumpSlowCaseIfNotJSCell):
+ (JSC::CTI::emitJumpSlowCaseIfNotImmNum):
+ (JSC::CTI::emitJumpSlowCaseIfNotImmNums):
+ (JSC::CTI::emitFastArithDeTagImmediate):
+ (JSC::CTI::emitFastArithDeTagImmediateJumpIfZero):
+ (JSC::CTI::emitFastArithReTagImmediate):
+ (JSC::CTI::emitFastArithPotentiallyReTagImmediate):
+ (JSC::CTI::emitFastArithImmToInt):
+ (JSC::CTI::emitFastArithIntToImmOrSlowCase):
+ (JSC::CTI::emitFastArithIntToImmNoCheck):
+ (JSC::CTI::emitArithIntToImmWithJump):
+ (JSC::CTI::emitTagAsBoolImmediate):
+ (JSC::CTI::compileOpCall):
+ (JSC::CTI::compileOpStrictEq):
+ (JSC::CTI::emitSlowScriptCheck):
+ (JSC::CTI::putDoubleResultToJSNumberCellOrJSImmediate):
+ (JSC::CTI::compileBinaryArithOp):
+ (JSC::CTI::compileBinaryArithOpSlowCase):
+ (JSC::CTI::privateCompileMainPass):
+ (JSC::CTI::privateCompileSlowCases):
+ (JSC::CTI::privateCompile):
+ (JSC::CTI::privateCompileGetByIdSelf):
+ (JSC::CTI::privateCompileGetByIdProto):
+ (JSC::CTI::privateCompileGetByIdChain):
+ (JSC::CTI::privateCompilePutByIdReplace):
+ (JSC::CTI::privateCompilePutByIdTransition):
+ (JSC::CTI::privateCompileCTIMachineTrampolines):
+ (JSC::CTI::privateCompilePatchGetArrayLength):
+ (JSC::CTI::emitGetVariableObjectRegister):
+ (JSC::CTI::emitPutVariableObjectRegister):
+ * VM/CTI.h:
+ (JSC::CallRecord::CallRecord):
+ (JSC::JmpTable::JmpTable):
+ (JSC::SlowCaseEntry::SlowCaseEntry):
+ (JSC::CTI::JSRInfo::JSRInfo):
+ * wrec/WREC.h:
+
+2008-11-16 Geoffrey Garen <ggaren@apple.com>
+
+ Not reviewed.
+
+ Try to fix Qt build.
+
+ * JavaScriptCore.pri:
+
+2008-11-16 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Renamed OBJECT_OFFSET => FIELD_OFFSET
+
+ Nixed use of OBJECT_OFFSET outside of CTI.cpp by making CTI a friend in
+ more places.
+
+ * VM/CTI.cpp:
+ (JSC::CTI::compileOpCallInitializeCallFrame):
+ (JSC::CTI::compileOpCall):
+ (JSC::CTI::emitSlowScriptCheck):
+ (JSC::CTI::putDoubleResultToJSNumberCellOrJSImmediate):
+ (JSC::CTI::compileBinaryArithOp):
+ (JSC::CTI::privateCompileMainPass):
+ (JSC::CTI::privateCompileSlowCases):
+ (JSC::CTI::privateCompile):
+ (JSC::CTI::privateCompileGetByIdSelf):
+ (JSC::CTI::privateCompileGetByIdProto):
+ (JSC::CTI::privateCompileGetByIdChain):
+ (JSC::CTI::privateCompilePutByIdReplace):
+ (JSC::CTI::privateCompilePutByIdTransition):
+ (JSC::CTI::privateCompileCTIMachineTrampolines):
+ (JSC::CTI::privateCompilePatchGetArrayLength):
+ (JSC::CTI::emitGetVariableObjectRegister):
+ (JSC::CTI::emitPutVariableObjectRegister):
+ * runtime/JSValue.h:
+ * runtime/JSVariableObject.h:
+
+2008-11-16 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Renames:
+
+ X86Assembler::copy => X86Assembler::executableCopy
+ AssemblerBuffer::copy => AssemblerBuffer::executableCopy
+
+ * VM/CTI.cpp:
+ (JSC::CTI::privateCompile):
+ (JSC::CTI::privateCompileGetByIdSelf):
+ (JSC::CTI::privateCompileGetByIdProto):
+ (JSC::CTI::privateCompileGetByIdChain):
+ (JSC::CTI::privateCompilePutByIdReplace):
+ (JSC::CTI::privateCompilePutByIdTransition):
+ (JSC::CTI::privateCompileCTIMachineTrampolines):
+ (JSC::CTI::privateCompilePatchGetArrayLength):
+ * masm/X86Assembler.h:
+ (JSC::AssemblerBuffer::executableCopy):
+ (JSC::X86Assembler::executableCopy):
+ * wrec/WREC.cpp:
+ (JSC::WREC::compileRegExp):
+
+2008-11-16 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Renamed WREC => JSC::WREC, removing JSC:: prefix in a lot of places.
+ Renamed WRECFunction => WREC::CompiledRegExp, and deployed this type
+ name in place of a few casts.
+
+ * runtime/RegExp.cpp:
+ (JSC::RegExp::RegExp):
+ (JSC::RegExp::~RegExp):
+ (JSC::RegExp::match):
+ * runtime/RegExp.h:
+ * wrec/CharacterClassConstructor.cpp:
+ * wrec/CharacterClassConstructor.h:
+ * wrec/WREC.cpp:
+ (JSC::WREC::compileRegExp):
+ * wrec/WREC.h:
+ (JSC::WREC::Generator::Generator):
+ (JSC::WREC::Parser::Parser):
+ (JSC::WREC::Parser::parseAlternative):
+
+2008-11-16 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Renamed BytecodeInterpreter => Interpreter.
+
+ * JavaScriptCore.exp:
+ * VM/CTI.cpp:
+ (JSC::):
+ (JSC::CTI::compileOpCall):
+ (JSC::CTI::emitSlowScriptCheck):
+ (JSC::CTI::compileBinaryArithOpSlowCase):
+ (JSC::CTI::privateCompileMainPass):
+ (JSC::CTI::privateCompileSlowCases):
+ (JSC::CTI::privateCompile):
+ (JSC::CTI::privateCompileGetByIdSelf):
+ (JSC::CTI::privateCompileGetByIdProto):
+ (JSC::CTI::privateCompileGetByIdChain):
+ (JSC::CTI::privateCompilePutByIdReplace):
+ (JSC::CTI::privateCompilePutByIdTransition):
+ (JSC::CTI::privateCompileCTIMachineTrampolines):
+ (JSC::CTI::freeCTIMachineTrampolines):
+ (JSC::CTI::patchGetByIdSelf):
+ (JSC::CTI::patchPutByIdReplace):
+ (JSC::CTI::privateCompilePatchGetArrayLength):
+ * VM/CTI.h:
+ * VM/CodeBlock.cpp:
+ (JSC::CodeBlock::printStructures):
+ (JSC::CodeBlock::derefStructures):
+ (JSC::CodeBlock::refStructures):
+ * VM/Machine.cpp:
+ (JSC::jsLess):
+ (JSC::jsLessEq):
+ (JSC::Interpreter::resolve):
+ (JSC::Interpreter::resolveSkip):
+ (JSC::Interpreter::resolveGlobal):
+ (JSC::Interpreter::resolveBase):
+ (JSC::Interpreter::resolveBaseAndProperty):
+ (JSC::Interpreter::resolveBaseAndFunc):
+ (JSC::Interpreter::slideRegisterWindowForCall):
+ (JSC::Interpreter::callEval):
+ (JSC::Interpreter::Interpreter):
+ (JSC::Interpreter::initialize):
+ (JSC::Interpreter::~Interpreter):
+ (JSC::Interpreter::dumpCallFrame):
+ (JSC::Interpreter::dumpRegisters):
+ (JSC::Interpreter::isOpcode):
+ (JSC::Interpreter::unwindCallFrame):
+ (JSC::Interpreter::throwException):
+ (JSC::Interpreter::execute):
+ (JSC::Interpreter::debug):
+ (JSC::Interpreter::resetTimeoutCheck):
+ (JSC::Interpreter::checkTimeout):
+ (JSC::Interpreter::createExceptionScope):
+ (JSC::Interpreter::tryCachePutByID):
+ (JSC::Interpreter::uncachePutByID):
+ (JSC::Interpreter::tryCacheGetByID):
+ (JSC::Interpreter::uncacheGetByID):
+ (JSC::Interpreter::privateExecute):
+ (JSC::Interpreter::retrieveArguments):
+ (JSC::Interpreter::retrieveCaller):
+ (JSC::Interpreter::retrieveLastCaller):
+ (JSC::Interpreter::findFunctionCallFrame):
+ (JSC::Interpreter::tryCTICachePutByID):
+ (JSC::Interpreter::tryCTICacheGetByID):
+ (JSC::Interpreter::cti_op_convert_this):
+ (JSC::Interpreter::cti_op_end):
+ (JSC::Interpreter::cti_op_add):
+ (JSC::Interpreter::cti_op_pre_inc):
+ (JSC::Interpreter::cti_timeout_check):
+ (JSC::Interpreter::cti_register_file_check):
+ (JSC::Interpreter::cti_op_loop_if_less):
+ (JSC::Interpreter::cti_op_loop_if_lesseq):
+ (JSC::Interpreter::cti_op_new_object):
+ (JSC::Interpreter::cti_op_put_by_id):
+ (JSC::Interpreter::cti_op_put_by_id_second):
+ (JSC::Interpreter::cti_op_put_by_id_generic):
+ (JSC::Interpreter::cti_op_put_by_id_fail):
+ (JSC::Interpreter::cti_op_get_by_id):
+ (JSC::Interpreter::cti_op_get_by_id_second):
+ (JSC::Interpreter::cti_op_get_by_id_generic):
+ (JSC::Interpreter::cti_op_get_by_id_fail):
+ (JSC::Interpreter::cti_op_instanceof):
+ (JSC::Interpreter::cti_op_del_by_id):
+ (JSC::Interpreter::cti_op_mul):
+ (JSC::Interpreter::cti_op_new_func):
+ (JSC::Interpreter::cti_op_call_JSFunction):
+ (JSC::Interpreter::cti_op_call_arityCheck):
+ (JSC::Interpreter::cti_vm_dontLazyLinkCall):
+ (JSC::Interpreter::cti_vm_lazyLinkCall):
+ (JSC::Interpreter::cti_op_push_activation):
+ (JSC::Interpreter::cti_op_call_NotJSFunction):
+ (JSC::Interpreter::cti_op_create_arguments):
+ (JSC::Interpreter::cti_op_create_arguments_no_params):
+ (JSC::Interpreter::cti_op_tear_off_activation):
+ (JSC::Interpreter::cti_op_tear_off_arguments):
+ (JSC::Interpreter::cti_op_profile_will_call):
+ (JSC::Interpreter::cti_op_profile_did_call):
+ (JSC::Interpreter::cti_op_ret_scopeChain):
+ (JSC::Interpreter::cti_op_new_array):
+ (JSC::Interpreter::cti_op_resolve):
+ (JSC::Interpreter::cti_op_construct_JSConstruct):
+ (JSC::Interpreter::cti_op_construct_NotJSConstruct):
+ (JSC::Interpreter::cti_op_get_by_val):
+ (JSC::Interpreter::cti_op_resolve_func):
+ (JSC::Interpreter::cti_op_sub):
+ (JSC::Interpreter::cti_op_put_by_val):
+ (JSC::Interpreter::cti_op_put_by_val_array):
+ (JSC::Interpreter::cti_op_lesseq):
+ (JSC::Interpreter::cti_op_loop_if_true):
+ (JSC::Interpreter::cti_op_negate):
+ (JSC::Interpreter::cti_op_resolve_base):
+ (JSC::Interpreter::cti_op_resolve_skip):
+ (JSC::Interpreter::cti_op_resolve_global):
+ (JSC::Interpreter::cti_op_div):
+ (JSC::Interpreter::cti_op_pre_dec):
+ (JSC::Interpreter::cti_op_jless):
+ (JSC::Interpreter::cti_op_not):
+ (JSC::Interpreter::cti_op_jtrue):
+ (JSC::Interpreter::cti_op_post_inc):
+ (JSC::Interpreter::cti_op_eq):
+ (JSC::Interpreter::cti_op_lshift):
+ (JSC::Interpreter::cti_op_bitand):
+ (JSC::Interpreter::cti_op_rshift):
+ (JSC::Interpreter::cti_op_bitnot):
+ (JSC::Interpreter::cti_op_resolve_with_base):
+ (JSC::Interpreter::cti_op_new_func_exp):
+ (JSC::Interpreter::cti_op_mod):
+ (JSC::Interpreter::cti_op_less):
+ (JSC::Interpreter::cti_op_neq):
+ (JSC::Interpreter::cti_op_post_dec):
+ (JSC::Interpreter::cti_op_urshift):
+ (JSC::Interpreter::cti_op_bitxor):
+ (JSC::Interpreter::cti_op_new_regexp):
+ (JSC::Interpreter::cti_op_bitor):
+ (JSC::Interpreter::cti_op_call_eval):
+ (JSC::Interpreter::cti_op_throw):
+ (JSC::Interpreter::cti_op_get_pnames):
+ (JSC::Interpreter::cti_op_next_pname):
+ (JSC::Interpreter::cti_op_push_scope):
+ (JSC::Interpreter::cti_op_pop_scope):
+ (JSC::Interpreter::cti_op_typeof):
+ (JSC::Interpreter::cti_op_is_undefined):
+ (JSC::Interpreter::cti_op_is_boolean):
+ (JSC::Interpreter::cti_op_is_number):
+ (JSC::Interpreter::cti_op_is_string):
+ (JSC::Interpreter::cti_op_is_object):
+ (JSC::Interpreter::cti_op_is_function):
+ (JSC::Interpreter::cti_op_stricteq):
+ (JSC::Interpreter::cti_op_nstricteq):
+ (JSC::Interpreter::cti_op_to_jsnumber):
+ (JSC::Interpreter::cti_op_in):
+ (JSC::Interpreter::cti_op_push_new_scope):
+ (JSC::Interpreter::cti_op_jmp_scopes):
+ (JSC::Interpreter::cti_op_put_by_index):
+ (JSC::Interpreter::cti_op_switch_imm):
+ (JSC::Interpreter::cti_op_switch_char):
+ (JSC::Interpreter::cti_op_switch_string):
+ (JSC::Interpreter::cti_op_del_by_val):
+ (JSC::Interpreter::cti_op_put_getter):
+ (JSC::Interpreter::cti_op_put_setter):
+ (JSC::Interpreter::cti_op_new_error):
+ (JSC::Interpreter::cti_op_debug):
+ (JSC::Interpreter::cti_vm_throw):
+ * VM/Machine.h:
+ * VM/Register.h:
+ * VM/SamplingTool.h:
+ (JSC::SamplingTool::SamplingTool):
+ * bytecompiler/CodeGenerator.cpp:
+ (JSC::BytecodeGenerator::generate):
+ (JSC::BytecodeGenerator::BytecodeGenerator):
+ * jsc.cpp:
+ (runWithScripts):
+ * runtime/ExecState.h:
+ (JSC::ExecState::interpreter):
+ * runtime/JSCell.h:
+ * runtime/JSFunction.h:
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData):
+ * runtime/JSGlobalData.h:
+ * runtime/JSString.h:
+ * wrec/WREC.cpp:
+ (WREC::compileRegExp):
+ * wrec/WREC.h:
+
+2008-11-16 Geoffrey Garen <ggaren@apple.com>
+
+ Roll out r38461 (my last patch) because it broke the world.
+
+2008-11-16 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ A few more renames:
+
+ BytecodeInterpreter => Interpreter
+ WREC => JSC::WREC, removing JSC:: prefix in a lot of places
+ X86Assembler::copy => X86Assembler::executableCopy
+ AssemblerBuffer::copy => AssemblerBuffer::executableCopy
+ WRECFunction => WREC::RegExpFunction
+ OBJECT_OFFSET => FIELD_OFFSET
+
+ Also:
+
+ Nixed use of OBJECT_OFFSET outside of CTI.cpp by making CTI a friend in more places.
+ Nixed X86:: and X86Assembler:: prefixes in a lot of places using typedefs
+
+ * JavaScriptCore.exp:
+ * VM/CTI.cpp:
+ (JSC::):
+ (JSC::CTI::emitGetVirtualRegister):
+ (JSC::CTI::emitGetVirtualRegisters):
+ (JSC::CTI::emitPutCTIArgFromVirtualRegister):
+ (JSC::CTI::emitPutCTIArg):
+ (JSC::CTI::emitGetCTIArg):
+ (JSC::CTI::emitPutCTIParam):
+ (JSC::CTI::emitGetCTIParam):
+ (JSC::CTI::emitPutToCallFrameHeader):
+ (JSC::CTI::emitGetFromCallFrameHeader):
+ (JSC::CTI::emitPutVirtualRegister):
+ (JSC::CTI::emitNakedCall):
+ (JSC::CTI::emitNakedFastCall):
+ (JSC::CTI::emitCTICall):
+ (JSC::CTI::emitJumpSlowCaseIfNotJSCell):
+ (JSC::CTI::emitJumpSlowCaseIfNotImmNum):
+ (JSC::CTI::emitJumpSlowCaseIfNotImmNums):
+ (JSC::CTI::emitFastArithDeTagImmediate):
+ (JSC::CTI::emitFastArithDeTagImmediateJumpIfZero):
+ (JSC::CTI::emitFastArithReTagImmediate):
+ (JSC::CTI::emitFastArithPotentiallyReTagImmediate):
+ (JSC::CTI::emitFastArithImmToInt):
+ (JSC::CTI::emitFastArithIntToImmOrSlowCase):
+ (JSC::CTI::emitFastArithIntToImmNoCheck):
+ (JSC::CTI::emitArithIntToImmWithJump):
+ (JSC::CTI::emitTagAsBoolImmediate):
+ (JSC::CTI::compileOpCallInitializeCallFrame):
+ (JSC::CTI::compileOpCall):
+ (JSC::CTI::compileOpStrictEq):
+ (JSC::CTI::emitSlowScriptCheck):
+ (JSC::CTI::putDoubleResultToJSNumberCellOrJSImmediate):
+ (JSC::CTI::compileBinaryArithOp):
+ (JSC::CTI::compileBinaryArithOpSlowCase):
+ (JSC::CTI::privateCompileMainPass):
+ (JSC::CTI::privateCompileSlowCases):
+ (JSC::CTI::privateCompile):
+ (JSC::CTI::privateCompileGetByIdSelf):
+ (JSC::CTI::privateCompileGetByIdProto):
+ (JSC::CTI::privateCompileGetByIdChain):
+ (JSC::CTI::privateCompilePutByIdReplace):
+ (JSC::CTI::privateCompilePutByIdTransition):
+ (JSC::CTI::privateCompileCTIMachineTrampolines):
+ (JSC::CTI::freeCTIMachineTrampolines):
+ (JSC::CTI::patchGetByIdSelf):
+ (JSC::CTI::patchPutByIdReplace):
+ (JSC::CTI::privateCompilePatchGetArrayLength):
+ (JSC::CTI::emitGetVariableObjectRegister):
+ (JSC::CTI::emitPutVariableObjectRegister):
+ * VM/CTI.h:
+ (JSC::CallRecord::CallRecord):
+ (JSC::JmpTable::JmpTable):
+ (JSC::SlowCaseEntry::SlowCaseEntry):
+ (JSC::CTI::JSRInfo::JSRInfo):
+ * VM/CodeBlock.cpp:
+ (JSC::CodeBlock::printStructures):
+ (JSC::CodeBlock::derefStructures):
+ (JSC::CodeBlock::refStructures):
+ * VM/Machine.cpp:
+ (JSC::jsLess):
+ (JSC::jsLessEq):
+ (JSC::Interpreter::resolve):
+ (JSC::Interpreter::resolveSkip):
+ (JSC::Interpreter::resolveGlobal):
+ (JSC::Interpreter::resolveBase):
+ (JSC::Interpreter::resolveBaseAndProperty):
+ (JSC::Interpreter::resolveBaseAndFunc):
+ (JSC::Interpreter::slideRegisterWindowForCall):
+ (JSC::Interpreter::callEval):
+ (JSC::Interpreter::Interpreter):
+ (JSC::Interpreter::initialize):
+ (JSC::Interpreter::~Interpreter):
+ (JSC::Interpreter::dumpCallFrame):
+ (JSC::Interpreter::dumpRegisters):
+ (JSC::Interpreter::isOpcode):
+ (JSC::Interpreter::unwindCallFrame):
+ (JSC::Interpreter::throwException):
+ (JSC::Interpreter::execute):
+ (JSC::Interpreter::debug):
+ (JSC::Interpreter::resetTimeoutCheck):
+ (JSC::Interpreter::checkTimeout):
+ (JSC::Interpreter::createExceptionScope):
+ (JSC::Interpreter::tryCachePutByID):
+ (JSC::Interpreter::uncachePutByID):
+ (JSC::Interpreter::tryCacheGetByID):
+ (JSC::Interpreter::uncacheGetByID):
+ (JSC::Interpreter::privateExecute):
+ (JSC::Interpreter::retrieveArguments):
+ (JSC::Interpreter::retrieveCaller):
+ (JSC::Interpreter::retrieveLastCaller):
+ (JSC::Interpreter::findFunctionCallFrame):
+ (JSC::Interpreter::tryCTICachePutByID):
+ (JSC::Interpreter::tryCTICacheGetByID):
+ (JSC::):
+ (JSC::Interpreter::cti_op_convert_this):
+ (JSC::Interpreter::cti_op_end):
+ (JSC::Interpreter::cti_op_add):
+ (JSC::Interpreter::cti_op_pre_inc):
+ (JSC::Interpreter::cti_timeout_check):
+ (JSC::Interpreter::cti_register_file_check):
+ (JSC::Interpreter::cti_op_loop_if_less):
+ (JSC::Interpreter::cti_op_loop_if_lesseq):
+ (JSC::Interpreter::cti_op_new_object):
+ (JSC::Interpreter::cti_op_put_by_id):
+ (JSC::Interpreter::cti_op_put_by_id_second):
+ (JSC::Interpreter::cti_op_put_by_id_generic):
+ (JSC::Interpreter::cti_op_put_by_id_fail):
+ (JSC::Interpreter::cti_op_get_by_id):
+ (JSC::Interpreter::cti_op_get_by_id_second):
+ (JSC::Interpreter::cti_op_get_by_id_generic):
+ (JSC::Interpreter::cti_op_get_by_id_fail):
+ (JSC::Interpreter::cti_op_instanceof):
+ (JSC::Interpreter::cti_op_del_by_id):
+ (JSC::Interpreter::cti_op_mul):
+ (JSC::Interpreter::cti_op_new_func):
+ (JSC::Interpreter::cti_op_call_JSFunction):
+ (JSC::Interpreter::cti_op_call_arityCheck):
+ (JSC::Interpreter::cti_vm_dontLazyLinkCall):
+ (JSC::Interpreter::cti_vm_lazyLinkCall):
+ (JSC::Interpreter::cti_op_push_activation):
+ (JSC::Interpreter::cti_op_call_NotJSFunction):
+ (JSC::Interpreter::cti_op_create_arguments):
+ (JSC::Interpreter::cti_op_create_arguments_no_params):
+ (JSC::Interpreter::cti_op_tear_off_activation):
+ (JSC::Interpreter::cti_op_tear_off_arguments):
+ (JSC::Interpreter::cti_op_profile_will_call):
+ (JSC::Interpreter::cti_op_profile_did_call):
+ (JSC::Interpreter::cti_op_ret_scopeChain):
+ (JSC::Interpreter::cti_op_new_array):
+ (JSC::Interpreter::cti_op_resolve):
+ (JSC::Interpreter::cti_op_construct_JSConstruct):
+ (JSC::Interpreter::cti_op_construct_NotJSConstruct):
+ (JSC::Interpreter::cti_op_get_by_val):
+ (JSC::Interpreter::cti_op_resolve_func):
+ (JSC::Interpreter::cti_op_sub):
+ (JSC::Interpreter::cti_op_put_by_val):
+ (JSC::Interpreter::cti_op_put_by_val_array):
+ (JSC::Interpreter::cti_op_lesseq):
+ (JSC::Interpreter::cti_op_loop_if_true):
+ (JSC::Interpreter::cti_op_negate):
+ (JSC::Interpreter::cti_op_resolve_base):
+ (JSC::Interpreter::cti_op_resolve_skip):
+ (JSC::Interpreter::cti_op_resolve_global):
+ (JSC::Interpreter::cti_op_div):
+ (JSC::Interpreter::cti_op_pre_dec):
+ (JSC::Interpreter::cti_op_jless):
+ (JSC::Interpreter::cti_op_not):
+ (JSC::Interpreter::cti_op_jtrue):
+ (JSC::Interpreter::cti_op_post_inc):
+ (JSC::Interpreter::cti_op_eq):
+ (JSC::Interpreter::cti_op_lshift):
+ (JSC::Interpreter::cti_op_bitand):
+ (JSC::Interpreter::cti_op_rshift):
+ (JSC::Interpreter::cti_op_bitnot):
+ (JSC::Interpreter::cti_op_resolve_with_base):
+ (JSC::Interpreter::cti_op_new_func_exp):
+ (JSC::Interpreter::cti_op_mod):
+ (JSC::Interpreter::cti_op_less):
+ (JSC::Interpreter::cti_op_neq):
+ (JSC::Interpreter::cti_op_post_dec):
+ (JSC::Interpreter::cti_op_urshift):
+ (JSC::Interpreter::cti_op_bitxor):
+ (JSC::Interpreter::cti_op_new_regexp):
+ (JSC::Interpreter::cti_op_bitor):
+ (JSC::Interpreter::cti_op_call_eval):
+ (JSC::Interpreter::cti_op_throw):
+ (JSC::Interpreter::cti_op_get_pnames):
+ (JSC::Interpreter::cti_op_next_pname):
+ (JSC::Interpreter::cti_op_push_scope):
+ (JSC::Interpreter::cti_op_pop_scope):
+ (JSC::Interpreter::cti_op_typeof):
+ (JSC::Interpreter::cti_op_is_undefined):
+ (JSC::Interpreter::cti_op_is_boolean):
+ (JSC::Interpreter::cti_op_is_number):
+ (JSC::Interpreter::cti_op_is_string):
+ (JSC::Interpreter::cti_op_is_object):
+ (JSC::Interpreter::cti_op_is_function):
+ (JSC::Interpreter::cti_op_stricteq):
+ (JSC::Interpreter::cti_op_nstricteq):
+ (JSC::Interpreter::cti_op_to_jsnumber):
+ (JSC::Interpreter::cti_op_in):
+ (JSC::Interpreter::cti_op_push_new_scope):
+ (JSC::Interpreter::cti_op_jmp_scopes):
+ (JSC::Interpreter::cti_op_put_by_index):
+ (JSC::Interpreter::cti_op_switch_imm):
+ (JSC::Interpreter::cti_op_switch_char):
+ (JSC::Interpreter::cti_op_switch_string):
+ (JSC::Interpreter::cti_op_del_by_val):
+ (JSC::Interpreter::cti_op_put_getter):
+ (JSC::Interpreter::cti_op_put_setter):
+ (JSC::Interpreter::cti_op_new_error):
+ (JSC::Interpreter::cti_op_debug):
+ (JSC::Interpreter::cti_vm_throw):
+ * VM/Machine.h:
+ * VM/Register.h:
+ * VM/SamplingTool.cpp:
+ (JSC::SamplingTool::dump):
+ * VM/SamplingTool.h:
+ (JSC::SamplingTool::SamplingTool):
+ * bytecompiler/CodeGenerator.cpp:
+ (JSC::BytecodeGenerator::generate):
+ (JSC::BytecodeGenerator::BytecodeGenerator):
+ * jsc.cpp:
+ (runWithScripts):
+ * masm/X86Assembler.h:
+ (JSC::AssemblerBuffer::executableCopy):
+ (JSC::X86Assembler::executableCopy):
+ * runtime/ExecState.h:
+ (JSC::ExecState::interpreter):
+ * runtime/JSCell.h:
+ * runtime/JSFunction.h:
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData):
+ * runtime/JSGlobalData.h:
+ * runtime/JSImmediate.h:
+ * runtime/JSString.h:
+ * runtime/JSValue.h:
+ * runtime/JSVariableObject.h:
+ * runtime/RegExp.cpp:
+ (JSC::RegExp::RegExp):
+ (JSC::RegExp::~RegExp):
+ (JSC::RegExp::match):
+ * runtime/RegExp.h:
+ * wrec/CharacterClassConstructor.cpp:
+ * wrec/CharacterClassConstructor.h:
+ * wrec/WREC.cpp:
+ (JSC::WREC::compileRegExp):
+ * wrec/WREC.h:
+ (JSC::WREC::Generator::Generator):
+ (JSC::WREC::Parser::):
+ (JSC::WREC::Parser::Parser):
+ (JSC::WREC::Parser::parseAlternative):
+
+2008-11-16 Greg Bolsinga <bolsinga@apple.com>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=21810
+ Remove use of static C++ objects that are destroyed at exit time (destructors)
+
+ Conditionally have the DEFINE_STATIC_LOCAL workaround <rdar://problem/6354696>
+ (Codegen issue with C++ static reference in gcc build 5465) based upon the compiler
+ build versions. It will use the:
+ static T& = *new T;
+ style for all other compilers.
+
+ * wtf/StdLibExtras.h:
+
+2008-11-16 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Dan Bernstein.
+
+ https://bugs.webkit.org/show_bug.cgi?id=22290
+ Remove cross-heap GC and MessagePort multi-threading support
+
+ It is broken (and may not be implementable at all), and no longer needed, as we
+ don't use MessagePorts for communication with workers any more.
+
+ * JavaScriptCore.exp:
+ * runtime/Collector.cpp:
+ (JSC::Heap::collect):
+ * runtime/JSGlobalObject.cpp:
+ * runtime/JSGlobalObject.h:
+ Remove hooks for cross-heap GC.
+
+2008-11-15 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Cameron Zwarich.
+
+ Cleanup jsc command line code a little.
+
+ * jsc.cpp:
+ (functionQuit):
+ (main): Use standard exit status macros
+ (cleanupGlobalData): Factor out cleanup code into this function.
+ (printUsageStatement): Use standard exit status macros.
+
+2008-11-15 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Cameron Zwarich.
+
+ Cleanup BytecodeGenerator constructors.
+
+ * bytecompiler/CodeGenerator.cpp:
+ (JSC::BytecodeGenerator::BytecodeGenerator):
+ * bytecompiler/CodeGenerator.h:
+ * parser/Nodes.cpp:
+ (JSC::ProgramNode::generateBytecode):
+
+2008-11-15 Darin Adler <darin@apple.com>
+
+ Rubber stamped by Geoff Garen.
+
+ - do the long-planned StructureID -> Structure rename
+
+ * API/JSCallbackConstructor.cpp:
+ (JSC::JSCallbackConstructor::JSCallbackConstructor):
+ * API/JSCallbackConstructor.h:
+ (JSC::JSCallbackConstructor::createStructure):
+ * API/JSCallbackFunction.h:
+ (JSC::JSCallbackFunction::createStructure):
+ * API/JSCallbackObject.h:
+ (JSC::JSCallbackObject::createStructure):
+ * API/JSCallbackObjectFunctions.h:
+ (JSC::::JSCallbackObject):
+ * API/JSValueRef.cpp:
+ (JSValueIsInstanceOfConstructor):
+ * GNUmakefile.am:
+ * JavaScriptCore.exp:
+ * JavaScriptCore.pri:
+ * JavaScriptCore.scons:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * JavaScriptCoreSources.bkl:
+ * VM/CTI.cpp:
+ (JSC::CTI::compileBinaryArithOp):
+ (JSC::CTI::privateCompileMainPass):
+ (JSC::CTI::privateCompileGetByIdSelf):
+ (JSC::CTI::privateCompileGetByIdProto):
+ (JSC::CTI::privateCompileGetByIdChain):
+ (JSC::CTI::privateCompilePutByIdReplace):
+ (JSC::transitionWillNeedStorageRealloc):
+ (JSC::CTI::privateCompilePutByIdTransition):
+ (JSC::CTI::patchGetByIdSelf):
+ (JSC::CTI::patchPutByIdReplace):
+ * VM/CTI.h:
+ (JSC::CTI::compileGetByIdSelf):
+ (JSC::CTI::compileGetByIdProto):
+ (JSC::CTI::compileGetByIdChain):
+ (JSC::CTI::compilePutByIdReplace):
+ (JSC::CTI::compilePutByIdTransition):
+ * VM/CodeBlock.cpp:
+ (JSC::CodeBlock::printStructure):
+ (JSC::CodeBlock::printStructures):
+ (JSC::CodeBlock::dump):
+ (JSC::CodeBlock::~CodeBlock):
+ (JSC::CodeBlock::derefStructures):
+ (JSC::CodeBlock::refStructures):
+ * VM/CodeBlock.h:
+ * VM/Instruction.h:
+ (JSC::Instruction::Instruction):
+ (JSC::Instruction::):
+ * VM/Machine.cpp:
+ (JSC::jsTypeStringForValue):
+ (JSC::jsIsObjectType):
+ (JSC::BytecodeInterpreter::resolveGlobal):
+ (JSC::BytecodeInterpreter::BytecodeInterpreter):
+ (JSC::cachePrototypeChain):
+ (JSC::BytecodeInterpreter::tryCachePutByID):
+ (JSC::BytecodeInterpreter::uncachePutByID):
+ (JSC::BytecodeInterpreter::tryCacheGetByID):
+ (JSC::BytecodeInterpreter::uncacheGetByID):
+ (JSC::BytecodeInterpreter::privateExecute):
+ (JSC::BytecodeInterpreter::tryCTICachePutByID):
+ (JSC::BytecodeInterpreter::tryCTICacheGetByID):
+ (JSC::BytecodeInterpreter::cti_op_instanceof):
+ (JSC::BytecodeInterpreter::cti_op_construct_JSConstruct):
+ (JSC::BytecodeInterpreter::cti_op_resolve_global):
+ (JSC::BytecodeInterpreter::cti_op_is_undefined):
+ * runtime/Arguments.h:
+ (JSC::Arguments::createStructure):
+ * runtime/ArrayConstructor.cpp:
+ (JSC::ArrayConstructor::ArrayConstructor):
+ * runtime/ArrayConstructor.h:
+ * runtime/ArrayPrototype.cpp:
+ (JSC::ArrayPrototype::ArrayPrototype):
+ * runtime/ArrayPrototype.h:
+ * runtime/BatchedTransitionOptimizer.h:
+ (JSC::BatchedTransitionOptimizer::BatchedTransitionOptimizer):
+ (JSC::BatchedTransitionOptimizer::~BatchedTransitionOptimizer):
+ * runtime/BooleanConstructor.cpp:
+ (JSC::BooleanConstructor::BooleanConstructor):
+ * runtime/BooleanConstructor.h:
+ * runtime/BooleanObject.cpp:
+ (JSC::BooleanObject::BooleanObject):
+ * runtime/BooleanObject.h:
+ * runtime/BooleanPrototype.cpp:
+ (JSC::BooleanPrototype::BooleanPrototype):
+ * runtime/BooleanPrototype.h:
+ * runtime/DateConstructor.cpp:
+ (JSC::DateConstructor::DateConstructor):
+ * runtime/DateConstructor.h:
+ * runtime/DateInstance.cpp:
+ (JSC::DateInstance::DateInstance):
+ * runtime/DateInstance.h:
+ * runtime/DatePrototype.cpp:
+ (JSC::DatePrototype::DatePrototype):
+ * runtime/DatePrototype.h:
+ (JSC::DatePrototype::createStructure):
+ * runtime/ErrorConstructor.cpp:
+ (JSC::ErrorConstructor::ErrorConstructor):
+ * runtime/ErrorConstructor.h:
+ * runtime/ErrorInstance.cpp:
+ (JSC::ErrorInstance::ErrorInstance):
+ * runtime/ErrorInstance.h:
+ * runtime/ErrorPrototype.cpp:
+ (JSC::ErrorPrototype::ErrorPrototype):
+ * runtime/ErrorPrototype.h:
+ * runtime/FunctionConstructor.cpp:
+ (JSC::FunctionConstructor::FunctionConstructor):
+ * runtime/FunctionConstructor.h:
+ * runtime/FunctionPrototype.cpp:
+ (JSC::FunctionPrototype::FunctionPrototype):
+ (JSC::FunctionPrototype::addFunctionProperties):
+ * runtime/FunctionPrototype.h:
+ (JSC::FunctionPrototype::createStructure):
+ * runtime/GlobalEvalFunction.cpp:
+ (JSC::GlobalEvalFunction::GlobalEvalFunction):
+ * runtime/GlobalEvalFunction.h:
+ * runtime/Identifier.h:
+ * runtime/InternalFunction.cpp:
+ (JSC::InternalFunction::InternalFunction):
+ * runtime/InternalFunction.h:
+ (JSC::InternalFunction::createStructure):
+ (JSC::InternalFunction::InternalFunction):
+ * runtime/JSActivation.cpp:
+ (JSC::JSActivation::JSActivation):
+ * runtime/JSActivation.h:
+ (JSC::JSActivation::createStructure):
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::JSArray):
+ * runtime/JSArray.h:
+ (JSC::JSArray::createStructure):
+ * runtime/JSCell.h:
+ (JSC::JSCell::JSCell):
+ (JSC::JSCell::isObject):
+ (JSC::JSCell::isString):
+ (JSC::JSCell::structure):
+ (JSC::JSValue::needsThisConversion):
+ * runtime/JSFunction.cpp:
+ (JSC::JSFunction::construct):
+ * runtime/JSFunction.h:
+ (JSC::JSFunction::JSFunction):
+ (JSC::JSFunction::createStructure):
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData):
+ (JSC::JSGlobalData::createLeaked):
+ * runtime/JSGlobalData.h:
+ * runtime/JSGlobalObject.cpp:
+ (JSC::markIfNeeded):
+ (JSC::JSGlobalObject::reset):
+ * runtime/JSGlobalObject.h:
+ (JSC::JSGlobalObject::JSGlobalObject):
+ (JSC::JSGlobalObject::argumentsStructure):
+ (JSC::JSGlobalObject::arrayStructure):
+ (JSC::JSGlobalObject::booleanObjectStructure):
+ (JSC::JSGlobalObject::callbackConstructorStructure):
+ (JSC::JSGlobalObject::callbackFunctionStructure):
+ (JSC::JSGlobalObject::callbackObjectStructure):
+ (JSC::JSGlobalObject::dateStructure):
+ (JSC::JSGlobalObject::emptyObjectStructure):
+ (JSC::JSGlobalObject::errorStructure):
+ (JSC::JSGlobalObject::functionStructure):
+ (JSC::JSGlobalObject::numberObjectStructure):
+ (JSC::JSGlobalObject::prototypeFunctionStructure):
+ (JSC::JSGlobalObject::regExpMatchesArrayStructure):
+ (JSC::JSGlobalObject::regExpStructure):
+ (JSC::JSGlobalObject::stringObjectStructure):
+ (JSC::JSGlobalObject::createStructure):
+ (JSC::Structure::prototypeForLookup):
+ * runtime/JSNotAnObject.h:
+ (JSC::JSNotAnObject::createStructure):
+ * runtime/JSNumberCell.h:
+ (JSC::JSNumberCell::createStructure):
+ (JSC::JSNumberCell::JSNumberCell):
+ * runtime/JSObject.cpp:
+ (JSC::JSObject::mark):
+ (JSC::JSObject::put):
+ (JSC::JSObject::deleteProperty):
+ (JSC::JSObject::defineGetter):
+ (JSC::JSObject::defineSetter):
+ (JSC::JSObject::getPropertyAttributes):
+ (JSC::JSObject::getPropertyNames):
+ (JSC::JSObject::removeDirect):
+ (JSC::JSObject::createInheritorID):
+ * runtime/JSObject.h:
+ (JSC::JSObject::getDirect):
+ (JSC::JSObject::getDirectLocation):
+ (JSC::JSObject::hasCustomProperties):
+ (JSC::JSObject::hasGetterSetterProperties):
+ (JSC::JSObject::createStructure):
+ (JSC::JSObject::JSObject):
+ (JSC::JSObject::~JSObject):
+ (JSC::JSObject::prototype):
+ (JSC::JSObject::setPrototype):
+ (JSC::JSObject::setStructure):
+ (JSC::JSObject::inheritorID):
+ (JSC::JSObject::inlineGetOwnPropertySlot):
+ (JSC::JSObject::getOwnPropertySlotForWrite):
+ (JSC::JSCell::fastGetOwnPropertySlot):
+ (JSC::JSObject::putDirect):
+ (JSC::JSObject::putDirectWithoutTransition):
+ (JSC::JSObject::transitionTo):
+ * runtime/JSPropertyNameIterator.h:
+ (JSC::JSPropertyNameIterator::next):
+ * runtime/JSStaticScopeObject.h:
+ (JSC::JSStaticScopeObject::JSStaticScopeObject):
+ (JSC::JSStaticScopeObject::createStructure):
+ * runtime/JSString.h:
+ (JSC::JSString::JSString):
+ (JSC::JSString::createStructure):
+ * runtime/JSVariableObject.h:
+ (JSC::JSVariableObject::JSVariableObject):
+ * runtime/JSWrapperObject.h:
+ (JSC::JSWrapperObject::JSWrapperObject):
+ * runtime/MathObject.cpp:
+ (JSC::MathObject::MathObject):
+ * runtime/MathObject.h:
+ (JSC::MathObject::createStructure):
+ * runtime/NativeErrorConstructor.cpp:
+ (JSC::NativeErrorConstructor::NativeErrorConstructor):
+ * runtime/NativeErrorConstructor.h:
+ * runtime/NativeErrorPrototype.cpp:
+ (JSC::NativeErrorPrototype::NativeErrorPrototype):
+ * runtime/NativeErrorPrototype.h:
+ * runtime/NumberConstructor.cpp:
+ (JSC::NumberConstructor::NumberConstructor):
+ * runtime/NumberConstructor.h:
+ (JSC::NumberConstructor::createStructure):
+ * runtime/NumberObject.cpp:
+ (JSC::NumberObject::NumberObject):
+ * runtime/NumberObject.h:
+ * runtime/NumberPrototype.cpp:
+ (JSC::NumberPrototype::NumberPrototype):
+ * runtime/NumberPrototype.h:
+ * runtime/ObjectConstructor.cpp:
+ (JSC::ObjectConstructor::ObjectConstructor):
+ * runtime/ObjectConstructor.h:
+ * runtime/ObjectPrototype.cpp:
+ (JSC::ObjectPrototype::ObjectPrototype):
+ * runtime/ObjectPrototype.h:
+ * runtime/Operations.h:
+ (JSC::equalSlowCaseInline):
+ * runtime/PropertyNameArray.h:
+ (JSC::PropertyNameArrayData::setCachedStructure):
+ (JSC::PropertyNameArrayData::cachedStructure):
+ (JSC::PropertyNameArrayData::setCachedPrototypeChain):
+ (JSC::PropertyNameArrayData::cachedPrototypeChain):
+ (JSC::PropertyNameArrayData::PropertyNameArrayData):
+ * runtime/PrototypeFunction.cpp:
+ (JSC::PrototypeFunction::PrototypeFunction):
+ * runtime/PrototypeFunction.h:
+ * runtime/RegExpConstructor.cpp:
+ (JSC::RegExpConstructor::RegExpConstructor):
+ * runtime/RegExpConstructor.h:
+ (JSC::RegExpConstructor::createStructure):
+ * runtime/RegExpObject.cpp:
+ (JSC::RegExpObject::RegExpObject):
+ * runtime/RegExpObject.h:
+ (JSC::RegExpObject::createStructure):
+ * runtime/RegExpPrototype.cpp:
+ (JSC::RegExpPrototype::RegExpPrototype):
+ * runtime/RegExpPrototype.h:
+ * runtime/StringConstructor.cpp:
+ (JSC::StringConstructor::StringConstructor):
+ * runtime/StringConstructor.h:
+ * runtime/StringObject.cpp:
+ (JSC::StringObject::StringObject):
+ * runtime/StringObject.h:
+ (JSC::StringObject::createStructure):
+ * runtime/StringObjectThatMasqueradesAsUndefined.h:
+ (JSC::StringObjectThatMasqueradesAsUndefined::create):
+ (JSC::StringObjectThatMasqueradesAsUndefined::StringObjectThatMasqueradesAsUndefined):
+ (JSC::StringObjectThatMasqueradesAsUndefined::createStructure):
+ * runtime/StringPrototype.cpp:
+ (JSC::StringPrototype::StringPrototype):
+ * runtime/StringPrototype.h:
+ * runtime/Structure.cpp: Copied from JavaScriptCore/runtime/StructureID.cpp.
+ (JSC::Structure::dumpStatistics):
+ (JSC::Structure::Structure):
+ (JSC::Structure::~Structure):
+ (JSC::Structure::startIgnoringLeaks):
+ (JSC::Structure::stopIgnoringLeaks):
+ (JSC::Structure::materializePropertyMap):
+ (JSC::Structure::getEnumerablePropertyNames):
+ (JSC::Structure::clearEnumerationCache):
+ (JSC::Structure::growPropertyStorageCapacity):
+ (JSC::Structure::addPropertyTransitionToExistingStructure):
+ (JSC::Structure::addPropertyTransition):
+ (JSC::Structure::removePropertyTransition):
+ (JSC::Structure::changePrototypeTransition):
+ (JSC::Structure::getterSetterTransition):
+ (JSC::Structure::toDictionaryTransition):
+ (JSC::Structure::fromDictionaryTransition):
+ (JSC::Structure::addPropertyWithoutTransition):
+ (JSC::Structure::removePropertyWithoutTransition):
+ (JSC::Structure::createCachedPrototypeChain):
+ (JSC::Structure::checkConsistency):
+ (JSC::Structure::copyPropertyTable):
+ (JSC::Structure::get):
+ (JSC::Structure::put):
+ (JSC::Structure::remove):
+ (JSC::Structure::insertIntoPropertyMapHashTable):
+ (JSC::Structure::createPropertyMapHashTable):
+ (JSC::Structure::expandPropertyMapHashTable):
+ (JSC::Structure::rehashPropertyMapHashTable):
+ (JSC::Structure::getEnumerablePropertyNamesInternal):
+ * runtime/Structure.h: Copied from JavaScriptCore/runtime/StructureID.h.
+ (JSC::Structure::create):
+ (JSC::Structure::previousID):
+ (JSC::Structure::setCachedPrototypeChain):
+ (JSC::Structure::cachedPrototypeChain):
+ (JSC::Structure::):
+ (JSC::Structure::get):
+ * runtime/StructureChain.cpp: Copied from JavaScriptCore/runtime/StructureIDChain.cpp.
+ (JSC::StructureChain::StructureChain):
+ (JSC::structureChainsAreEqual):
+ * runtime/StructureChain.h: Copied from JavaScriptCore/runtime/StructureIDChain.h.
+ (JSC::StructureChain::create):
+ (JSC::StructureChain::head):
+ * runtime/StructureID.cpp: Removed.
+ * runtime/StructureID.h: Removed.
+ * runtime/StructureIDChain.cpp: Removed.
+ * runtime/StructureIDChain.h: Removed.
+ * runtime/StructureIDTransitionTable.h: Removed.
+ * runtime/StructureTransitionTable.h: Copied from JavaScriptCore/runtime/StructureIDTransitionTable.h.
+
+2008-11-15 Darin Adler <darin@apple.com>
+
+ - fix non-WREC build
+
+ * runtime/RegExp.cpp: Put "using namespace WREC" inside #if ENABLE(WREC).
+
+2008-11-15 Kevin Ollivier <kevino@theolliviers.com>
+
+ Reviewed by Timothy Hatcher.
+
+ As ThreadingNone doesn't implement threads, isMainThread should return true,
+ not false.
+
+ https://bugs.webkit.org/show_bug.cgi?id=22285
+
+ * wtf/ThreadingNone.cpp:
+ (WTF::isMainThread):
+
+2008-11-15 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Moved all WREC-related code into WREC.cpp and put it in a WREC namespace.
+ Removed the WREC prefix from class names.
+
+ * VM/CTI.cpp:
+ * VM/CTI.h:
+ * VM/Machine.h:
+ (JSC::BytecodeInterpreter::assemblerBuffer):
+ * masm/X86Assembler.h:
+ * runtime/RegExp.cpp:
+ (JSC::RegExp::RegExp):
+ * wrec/CharacterClassConstructor.cpp:
+ * wrec/CharacterClassConstructor.h:
+ * wrec/WREC.cpp:
+ (WREC::GenerateParenthesesNonGreedyFunctor::GenerateParenthesesNonGreedyFunctor):
+ (WREC::GeneratePatternCharacterFunctor::generateAtom):
+ (WREC::GeneratePatternCharacterFunctor::backtrack):
+ (WREC::GenerateCharacterClassFunctor::generateAtom):
+ (WREC::GenerateCharacterClassFunctor::backtrack):
+ (WREC::GenerateBackreferenceFunctor::generateAtom):
+ (WREC::GenerateBackreferenceFunctor::backtrack):
+ (WREC::GenerateParenthesesNonGreedyFunctor::generateAtom):
+ (WREC::GenerateParenthesesNonGreedyFunctor::backtrack):
+ (WREC::Generator::generateBacktrack1):
+ (WREC::Generator::generateBacktrackBackreference):
+ (WREC::Generator::generateBackreferenceQuantifier):
+ (WREC::Generator::generateNonGreedyQuantifier):
+ (WREC::Generator::generateGreedyQuantifier):
+ (WREC::Generator::generatePatternCharacter):
+ (WREC::Generator::generateCharacterClassInvertedRange):
+ (WREC::Generator::generateCharacterClassInverted):
+ (WREC::Generator::generateCharacterClass):
+ (WREC::Generator::generateParentheses):
+ (WREC::Generator::generateParenthesesNonGreedy):
+ (WREC::Generator::generateParenthesesResetTrampoline):
+ (WREC::Generator::generateAssertionBOL):
+ (WREC::Generator::generateAssertionEOL):
+ (WREC::Generator::generateAssertionWordBoundary):
+ (WREC::Generator::generateBackreference):
+ (WREC::Generator::generateDisjunction):
+ (WREC::Generator::terminateDisjunction):
+ (WREC::Parser::parseGreedyQuantifier):
+ (WREC::Parser::parseQuantifier):
+ (WREC::Parser::parsePatternCharacterQualifier):
+ (WREC::Parser::parseCharacterClassQuantifier):
+ (WREC::Parser::parseBackreferenceQuantifier):
+ (WREC::Parser::parseParentheses):
+ (WREC::Parser::parseCharacterClass):
+ (WREC::Parser::parseOctalEscape):
+ (WREC::Parser::parseEscape):
+ (WREC::Parser::parseTerm):
+ (WREC::Parser::parseDisjunction):
+ (WREC::compileRegExp):
+ * wrec/WREC.h:
+ (WREC::Generator::Generator):
+ (WREC::Parser::Parser):
+ (WREC::Parser::parseAlternative):
+
+2008-11-15 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Changed another case of "m_jit" to "m_assembler".
+
+ * VM/CTI.cpp:
+ * wrec/WREC.cpp:
+ * wrec/WREC.h:
+ (JSC::WRECGenerator::WRECGenerator):
+ (JSC::WRECParser::WRECParser):
+
+2008-11-15 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Renamed "jit" to "assembler" and, for brevity, replaced *jit.* with __
+ using a macro.
+
+ * VM/CTI.cpp:
+ (JSC::CTI::emitGetVirtualRegister):
+ (JSC::CTI::emitPutCTIArgFromVirtualRegister):
+ (JSC::CTI::emitPutCTIArg):
+ (JSC::CTI::emitGetCTIArg):
+ (JSC::CTI::emitPutCTIArgConstant):
+ (JSC::CTI::emitPutCTIParam):
+ (JSC::CTI::emitGetCTIParam):
+ (JSC::CTI::emitPutToCallFrameHeader):
+ (JSC::CTI::emitGetFromCallFrameHeader):
+ (JSC::CTI::emitPutVirtualRegister):
+ (JSC::CTI::emitInitRegister):
+ (JSC::CTI::emitAllocateNumber):
+ (JSC::CTI::emitNakedCall):
+ (JSC::CTI::emitNakedFastCall):
+ (JSC::CTI::emitCTICall):
+ (JSC::CTI::emitJumpSlowCaseIfNotJSCell):
+ (JSC::CTI::linkSlowCaseIfNotJSCell):
+ (JSC::CTI::emitJumpSlowCaseIfNotImmNum):
+ (JSC::CTI::emitJumpSlowCaseIfNotImmNums):
+ (JSC::CTI::emitFastArithDeTagImmediate):
+ (JSC::CTI::emitFastArithDeTagImmediateJumpIfZero):
+ (JSC::CTI::emitFastArithReTagImmediate):
+ (JSC::CTI::emitFastArithPotentiallyReTagImmediate):
+ (JSC::CTI::emitFastArithImmToInt):
+ (JSC::CTI::emitFastArithIntToImmOrSlowCase):
+ (JSC::CTI::emitFastArithIntToImmNoCheck):
+ (JSC::CTI::emitArithIntToImmWithJump):
+ (JSC::CTI::emitTagAsBoolImmediate):
+ (JSC::CTI::CTI):
+ (JSC::CTI::compileOpCallInitializeCallFrame):
+ (JSC::CTI::compileOpCall):
+ (JSC::CTI::compileOpStrictEq):
+ (JSC::CTI::emitSlowScriptCheck):
+ (JSC::CTI::putDoubleResultToJSNumberCellOrJSImmediate):
+ (JSC::CTI::compileBinaryArithOp):
+ (JSC::CTI::compileBinaryArithOpSlowCase):
+ (JSC::CTI::privateCompileMainPass):
+ (JSC::CTI::privateCompileLinkPass):
+ (JSC::CTI::privateCompileSlowCases):
+ (JSC::CTI::privateCompile):
+ (JSC::CTI::privateCompileGetByIdSelf):
+ (JSC::CTI::privateCompileGetByIdProto):
+ (JSC::CTI::privateCompileGetByIdChain):
+ (JSC::CTI::privateCompilePutByIdReplace):
+ (JSC::CTI::privateCompilePutByIdTransition):
+ (JSC::CTI::privateCompileCTIMachineTrampolines):
+ (JSC::CTI::privateCompilePatchGetArrayLength):
+ (JSC::CTI::emitGetVariableObjectRegister):
+ (JSC::CTI::emitPutVariableObjectRegister):
+ (JSC::CTI::compileRegExp):
+ * VM/CTI.h:
+ * wrec/WREC.cpp:
+ (JSC::WRECGenerator::generateBacktrack1):
+ (JSC::WRECGenerator::generateBacktrackBackreference):
+ (JSC::WRECGenerator::generateBackreferenceQuantifier):
+ (JSC::WRECGenerator::generateNonGreedyQuantifier):
+ (JSC::WRECGenerator::generateGreedyQuantifier):
+ (JSC::WRECGenerator::generatePatternCharacter):
+ (JSC::WRECGenerator::generateCharacterClassInvertedRange):
+ (JSC::WRECGenerator::generateCharacterClassInverted):
+ (JSC::WRECGenerator::generateCharacterClass):
+ (JSC::WRECGenerator::generateParentheses):
+ (JSC::WRECGenerator::generateParenthesesNonGreedy):
+ (JSC::WRECGenerator::generateParenthesesResetTrampoline):
+ (JSC::WRECGenerator::generateAssertionBOL):
+ (JSC::WRECGenerator::generateAssertionEOL):
+ (JSC::WRECGenerator::generateAssertionWordBoundary):
+ (JSC::WRECGenerator::generateBackreference):
+ (JSC::WRECGenerator::generateDisjunction):
+ (JSC::WRECGenerator::terminateDisjunction):
+
+2008-11-15 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ Remove dead method declaration.
+
+ * bytecompiler/CodeGenerator.h:
+
+2008-11-15 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Renamed LabelID to Label, Label::isForwardLabel to Label::isForward.
+
+ * VM/LabelID.h:
+ (JSC::Label::Label):
+ (JSC::Label::isForward):
+ * bytecompiler/CodeGenerator.cpp:
+ (JSC::BytecodeGenerator::newLabel):
+ (JSC::BytecodeGenerator::emitLabel):
+ (JSC::BytecodeGenerator::emitJump):
+ (JSC::BytecodeGenerator::emitJumpIfTrue):
+ (JSC::BytecodeGenerator::emitJumpIfFalse):
+ (JSC::BytecodeGenerator::pushFinallyContext):
+ (JSC::BytecodeGenerator::emitComplexJumpScopes):
+ (JSC::BytecodeGenerator::emitJumpScopes):
+ (JSC::BytecodeGenerator::emitNextPropertyName):
+ (JSC::BytecodeGenerator::emitCatch):
+ (JSC::BytecodeGenerator::emitJumpSubroutine):
+ (JSC::prepareJumpTableForImmediateSwitch):
+ (JSC::prepareJumpTableForCharacterSwitch):
+ (JSC::prepareJumpTableForStringSwitch):
+ (JSC::BytecodeGenerator::endSwitch):
+ * bytecompiler/CodeGenerator.h:
+ * bytecompiler/LabelScope.h:
+ (JSC::LabelScope::LabelScope):
+ (JSC::LabelScope::breakTarget):
+ (JSC::LabelScope::continueTarget):
+ * parser/Nodes.cpp:
+ (JSC::LogicalOpNode::emitBytecode):
+ (JSC::ConditionalNode::emitBytecode):
+ (JSC::IfNode::emitBytecode):
+ (JSC::IfElseNode::emitBytecode):
+ (JSC::DoWhileNode::emitBytecode):
+ (JSC::WhileNode::emitBytecode):
+ (JSC::ForNode::emitBytecode):
+ (JSC::ForInNode::emitBytecode):
+ (JSC::ReturnNode::emitBytecode):
+ (JSC::CaseBlockNode::emitBytecodeForBlock):
+ (JSC::TryNode::emitBytecode):
+
+2008-11-15 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Renamed JITCodeBuffer to AssemblerBuffer and renamed its data members
+ to be more like the rest of our buffer classes, with a size and a
+ capacity.
+
+ Added an assert in the unchecked put case to match the test in the checked
+ put case.
+
+ Changed a C-style cast to a C++-style cast.
+
+ Renamed MAX_INSTRUCTION_SIZE to maxInstructionSize.
+
+ * VM/CTI.cpp:
+ (JSC::CTI::CTI):
+ (JSC::CTI::compileRegExp):
+ * VM/Machine.cpp:
+ (JSC::BytecodeInterpreter::BytecodeInterpreter):
+ * VM/Machine.h:
+ (JSC::BytecodeInterpreter::assemblerBuffer):
+ * masm/X86Assembler.h:
+ (JSC::AssemblerBuffer::AssemblerBuffer):
+ (JSC::AssemblerBuffer::~AssemblerBuffer):
+ (JSC::AssemblerBuffer::ensureSpace):
+ (JSC::AssemblerBuffer::isAligned):
+ (JSC::AssemblerBuffer::putByteUnchecked):
+ (JSC::AssemblerBuffer::putByte):
+ (JSC::AssemblerBuffer::putShortUnchecked):
+ (JSC::AssemblerBuffer::putShort):
+ (JSC::AssemblerBuffer::putIntUnchecked):
+ (JSC::AssemblerBuffer::putInt):
+ (JSC::AssemblerBuffer::data):
+ (JSC::AssemblerBuffer::size):
+ (JSC::AssemblerBuffer::reset):
+ (JSC::AssemblerBuffer::copy):
+ (JSC::AssemblerBuffer::grow):
+ (JSC::X86Assembler::):
+ (JSC::X86Assembler::X86Assembler):
+ (JSC::X86Assembler::testl_i32r):
+ (JSC::X86Assembler::movl_mr):
+ (JSC::X86Assembler::movl_rm):
+ (JSC::X86Assembler::movl_i32m):
+ (JSC::X86Assembler::emitCall):
+ (JSC::X86Assembler::label):
+ (JSC::X86Assembler::emitUnlinkedJmp):
+ (JSC::X86Assembler::emitUnlinkedJne):
+ (JSC::X86Assembler::emitUnlinkedJe):
+ (JSC::X86Assembler::emitUnlinkedJl):
+ (JSC::X86Assembler::emitUnlinkedJb):
+ (JSC::X86Assembler::emitUnlinkedJle):
+ (JSC::X86Assembler::emitUnlinkedJbe):
+ (JSC::X86Assembler::emitUnlinkedJge):
+ (JSC::X86Assembler::emitUnlinkedJg):
+ (JSC::X86Assembler::emitUnlinkedJa):
+ (JSC::X86Assembler::emitUnlinkedJae):
+ (JSC::X86Assembler::emitUnlinkedJo):
+ (JSC::X86Assembler::emitUnlinkedJp):
+ (JSC::X86Assembler::emitUnlinkedJs):
+ (JSC::X86Assembler::link):
+ (JSC::X86Assembler::emitModRm_rr):
+ (JSC::X86Assembler::emitModRm_rm):
+ (JSC::X86Assembler::emitModRm_opr):
+
+2008-11-15 Geoffrey Garen <ggaren@apple.com>
+
+ Suggested by Maciej Stachowiak.
+
+ Reverted most "opcode" => "bytecode" renames. We use "bytecode" as a
+ mass noun to refer to a stream of instructions. Each instruction may be
+ an opcode or an operand.
+
+ * VM/CTI.cpp:
+ (JSC::CTI::emitCTICall):
+ (JSC::CTI::compileOpCall):
+ (JSC::CTI::compileBinaryArithOp):
+ (JSC::CTI::compileBinaryArithOpSlowCase):
+ (JSC::CTI::privateCompileMainPass):
+ (JSC::CTI::privateCompileSlowCases):
+ (JSC::CTI::privateCompile):
+ * VM/CTI.h:
+ * VM/CodeBlock.cpp:
+ (JSC::CodeBlock::printStructureIDs):
+ (JSC::CodeBlock::dump):
+ (JSC::CodeBlock::derefStructureIDs):
+ (JSC::CodeBlock::refStructureIDs):
+ * VM/CodeBlock.h:
+ * VM/ExceptionHelpers.cpp:
+ (JSC::createNotAnObjectError):
+ * VM/Instruction.h:
+ (JSC::Instruction::Instruction):
+ (JSC::Instruction::):
+ * VM/Machine.cpp:
+ (JSC::BytecodeInterpreter::isOpcode):
+ (JSC::BytecodeInterpreter::throwException):
+ (JSC::BytecodeInterpreter::tryCachePutByID):
+ (JSC::BytecodeInterpreter::uncachePutByID):
+ (JSC::BytecodeInterpreter::tryCacheGetByID):
+ (JSC::BytecodeInterpreter::uncacheGetByID):
+ (JSC::BytecodeInterpreter::privateExecute):
+ (JSC::BytecodeInterpreter::tryCTICachePutByID):
+ (JSC::BytecodeInterpreter::tryCTICacheGetByID):
+ * VM/Machine.h:
+ (JSC::BytecodeInterpreter::getOpcode):
+ (JSC::BytecodeInterpreter::getOpcodeID):
+ (JSC::BytecodeInterpreter::isCallBytecode):
+ * VM/Opcode.cpp:
+ (JSC::):
+ (JSC::OpcodeStats::OpcodeStats):
+ (JSC::compareOpcodeIndices):
+ (JSC::compareOpcodePairIndices):
+ (JSC::OpcodeStats::~OpcodeStats):
+ (JSC::OpcodeStats::recordInstruction):
+ (JSC::OpcodeStats::resetLastInstruction):
+ * VM/Opcode.h:
+ (JSC::):
+ (JSC::padOpcodeName):
+ * VM/SamplingTool.cpp:
+ (JSC::ScopeSampleRecord::sample):
+ (JSC::SamplingTool::run):
+ (JSC::compareOpcodeIndicesSampling):
+ (JSC::SamplingTool::dump):
+ * VM/SamplingTool.h:
+ (JSC::ScopeSampleRecord::ScopeSampleRecord):
+ (JSC::SamplingTool::SamplingTool):
+ * bytecompiler/CodeGenerator.cpp:
+ (JSC::BytecodeGenerator::BytecodeGenerator):
+ (JSC::BytecodeGenerator::emitLabel):
+ (JSC::BytecodeGenerator::emitOpcode):
+ (JSC::BytecodeGenerator::emitJump):
+ (JSC::BytecodeGenerator::emitJumpIfTrue):
+ (JSC::BytecodeGenerator::emitJumpIfFalse):
+ (JSC::BytecodeGenerator::emitMove):
+ (JSC::BytecodeGenerator::emitUnaryOp):
+ (JSC::BytecodeGenerator::emitPreInc):
+ (JSC::BytecodeGenerator::emitPreDec):
+ (JSC::BytecodeGenerator::emitPostInc):
+ (JSC::BytecodeGenerator::emitPostDec):
+ (JSC::BytecodeGenerator::emitBinaryOp):
+ (JSC::BytecodeGenerator::emitEqualityOp):
+ (JSC::BytecodeGenerator::emitUnexpectedLoad):
+ (JSC::BytecodeGenerator::emitInstanceOf):
+ (JSC::BytecodeGenerator::emitResolve):
+ (JSC::BytecodeGenerator::emitGetScopedVar):
+ (JSC::BytecodeGenerator::emitPutScopedVar):
+ (JSC::BytecodeGenerator::emitResolveBase):
+ (JSC::BytecodeGenerator::emitResolveWithBase):
+ (JSC::BytecodeGenerator::emitResolveFunction):
+ (JSC::BytecodeGenerator::emitGetById):
+ (JSC::BytecodeGenerator::emitPutById):
+ (JSC::BytecodeGenerator::emitPutGetter):
+ (JSC::BytecodeGenerator::emitPutSetter):
+ (JSC::BytecodeGenerator::emitDeleteById):
+ (JSC::BytecodeGenerator::emitGetByVal):
+ (JSC::BytecodeGenerator::emitPutByVal):
+ (JSC::BytecodeGenerator::emitDeleteByVal):
+ (JSC::BytecodeGenerator::emitPutByIndex):
+ (JSC::BytecodeGenerator::emitNewObject):
+ (JSC::BytecodeGenerator::emitNewArray):
+ (JSC::BytecodeGenerator::emitNewFunction):
+ (JSC::BytecodeGenerator::emitNewRegExp):
+ (JSC::BytecodeGenerator::emitNewFunctionExpression):
+ (JSC::BytecodeGenerator::emitCall):
+ (JSC::BytecodeGenerator::emitReturn):
+ (JSC::BytecodeGenerator::emitUnaryNoDstOp):
+ (JSC::BytecodeGenerator::emitConstruct):
+ (JSC::BytecodeGenerator::emitPopScope):
+ (JSC::BytecodeGenerator::emitDebugHook):
+ (JSC::BytecodeGenerator::emitComplexJumpScopes):
+ (JSC::BytecodeGenerator::emitJumpScopes):
+ (JSC::BytecodeGenerator::emitNextPropertyName):
+ (JSC::BytecodeGenerator::emitCatch):
+ (JSC::BytecodeGenerator::emitNewError):
+ (JSC::BytecodeGenerator::emitJumpSubroutine):
+ (JSC::BytecodeGenerator::emitSubroutineReturn):
+ (JSC::BytecodeGenerator::emitPushNewScope):
+ (JSC::BytecodeGenerator::beginSwitch):
+ * bytecompiler/CodeGenerator.h:
+ * jsc.cpp:
+ (runWithScripts):
+ * masm/X86Assembler.h:
+ (JSC::X86Assembler::):
+ (JSC::X86Assembler::emitModRm_opr):
+ (JSC::X86Assembler::emitModRm_opr_Unchecked):
+ (JSC::X86Assembler::emitModRm_opm):
+ (JSC::X86Assembler::emitModRm_opm_Unchecked):
+ (JSC::X86Assembler::emitModRm_opmsib):
+ * parser/Nodes.cpp:
+ (JSC::UnaryOpNode::emitBytecode):
+ (JSC::BinaryOpNode::emitBytecode):
+ (JSC::ReverseBinaryOpNode::emitBytecode):
+ (JSC::ThrowableBinaryOpNode::emitBytecode):
+ (JSC::emitReadModifyAssignment):
+ (JSC::ScopeNode::ScopeNode):
+ * parser/Nodes.h:
+ (JSC::UnaryPlusNode::):
+ (JSC::NegateNode::):
+ (JSC::BitwiseNotNode::):
+ (JSC::LogicalNotNode::):
+ (JSC::MultNode::):
+ (JSC::DivNode::):
+ (JSC::ModNode::):
+ (JSC::AddNode::):
+ (JSC::SubNode::):
+ (JSC::LeftShiftNode::):
+ (JSC::RightShiftNode::):
+ (JSC::UnsignedRightShiftNode::):
+ (JSC::LessNode::):
+ (JSC::GreaterNode::):
+ (JSC::LessEqNode::):
+ (JSC::GreaterEqNode::):
+ (JSC::InstanceOfNode::):
+ (JSC::InNode::):
+ (JSC::EqualNode::):
+ (JSC::NotEqualNode::):
+ (JSC::StrictEqualNode::):
+ (JSC::NotStrictEqualNode::):
+ (JSC::BitAndNode::):
+ (JSC::BitOrNode::):
+ (JSC::BitXOrNode::):
+ * runtime/StructureID.cpp:
+ (JSC::StructureID::fromDictionaryTransition):
+ * wtf/Platform.h:
+
+2008-11-15 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Renames:
+
+ CodeGenerator => BytecodeGenerator
+ emitCodeForBlock => emitBytecodeForBlock
+ generatedByteCode => generatedBytecode
+ generateCode => generateBytecode
+
+ * JavaScriptCore.exp:
+ * bytecompiler/CodeGenerator.cpp:
+ (JSC::BytecodeGenerator::setDumpsGeneratedCode):
+ (JSC::BytecodeGenerator::generate):
+ (JSC::BytecodeGenerator::addVar):
+ (JSC::BytecodeGenerator::addGlobalVar):
+ (JSC::BytecodeGenerator::allocateConstants):
+ (JSC::BytecodeGenerator::BytecodeGenerator):
+ (JSC::BytecodeGenerator::addParameter):
+ (JSC::BytecodeGenerator::registerFor):
+ (JSC::BytecodeGenerator::constRegisterFor):
+ (JSC::BytecodeGenerator::isLocal):
+ (JSC::BytecodeGenerator::isLocalConstant):
+ (JSC::BytecodeGenerator::newRegister):
+ (JSC::BytecodeGenerator::newTemporary):
+ (JSC::BytecodeGenerator::highestUsedRegister):
+ (JSC::BytecodeGenerator::newLabelScope):
+ (JSC::BytecodeGenerator::newLabel):
+ (JSC::BytecodeGenerator::emitLabel):
+ (JSC::BytecodeGenerator::emitBytecode):
+ (JSC::BytecodeGenerator::retrieveLastBinaryOp):
+ (JSC::BytecodeGenerator::retrieveLastUnaryOp):
+ (JSC::BytecodeGenerator::rewindBinaryOp):
+ (JSC::BytecodeGenerator::rewindUnaryOp):
+ (JSC::BytecodeGenerator::emitJump):
+ (JSC::BytecodeGenerator::emitJumpIfTrue):
+ (JSC::BytecodeGenerator::emitJumpIfFalse):
+ (JSC::BytecodeGenerator::addConstant):
+ (JSC::BytecodeGenerator::addUnexpectedConstant):
+ (JSC::BytecodeGenerator::addRegExp):
+ (JSC::BytecodeGenerator::emitMove):
+ (JSC::BytecodeGenerator::emitUnaryOp):
+ (JSC::BytecodeGenerator::emitPreInc):
+ (JSC::BytecodeGenerator::emitPreDec):
+ (JSC::BytecodeGenerator::emitPostInc):
+ (JSC::BytecodeGenerator::emitPostDec):
+ (JSC::BytecodeGenerator::emitBinaryOp):
+ (JSC::BytecodeGenerator::emitEqualityOp):
+ (JSC::BytecodeGenerator::emitLoad):
+ (JSC::BytecodeGenerator::emitUnexpectedLoad):
+ (JSC::BytecodeGenerator::findScopedProperty):
+ (JSC::BytecodeGenerator::emitInstanceOf):
+ (JSC::BytecodeGenerator::emitResolve):
+ (JSC::BytecodeGenerator::emitGetScopedVar):
+ (JSC::BytecodeGenerator::emitPutScopedVar):
+ (JSC::BytecodeGenerator::emitResolveBase):
+ (JSC::BytecodeGenerator::emitResolveWithBase):
+ (JSC::BytecodeGenerator::emitResolveFunction):
+ (JSC::BytecodeGenerator::emitGetById):
+ (JSC::BytecodeGenerator::emitPutById):
+ (JSC::BytecodeGenerator::emitPutGetter):
+ (JSC::BytecodeGenerator::emitPutSetter):
+ (JSC::BytecodeGenerator::emitDeleteById):
+ (JSC::BytecodeGenerator::emitGetByVal):
+ (JSC::BytecodeGenerator::emitPutByVal):
+ (JSC::BytecodeGenerator::emitDeleteByVal):
+ (JSC::BytecodeGenerator::emitPutByIndex):
+ (JSC::BytecodeGenerator::emitNewObject):
+ (JSC::BytecodeGenerator::emitNewArray):
+ (JSC::BytecodeGenerator::emitNewFunction):
+ (JSC::BytecodeGenerator::emitNewRegExp):
+ (JSC::BytecodeGenerator::emitNewFunctionExpression):
+ (JSC::BytecodeGenerator::emitCall):
+ (JSC::BytecodeGenerator::emitCallEval):
+ (JSC::BytecodeGenerator::emitReturn):
+ (JSC::BytecodeGenerator::emitUnaryNoDstOp):
+ (JSC::BytecodeGenerator::emitConstruct):
+ (JSC::BytecodeGenerator::emitPushScope):
+ (JSC::BytecodeGenerator::emitPopScope):
+ (JSC::BytecodeGenerator::emitDebugHook):
+ (JSC::BytecodeGenerator::pushFinallyContext):
+ (JSC::BytecodeGenerator::popFinallyContext):
+ (JSC::BytecodeGenerator::breakTarget):
+ (JSC::BytecodeGenerator::continueTarget):
+ (JSC::BytecodeGenerator::emitComplexJumpScopes):
+ (JSC::BytecodeGenerator::emitJumpScopes):
+ (JSC::BytecodeGenerator::emitNextPropertyName):
+ (JSC::BytecodeGenerator::emitCatch):
+ (JSC::BytecodeGenerator::emitNewError):
+ (JSC::BytecodeGenerator::emitJumpSubroutine):
+ (JSC::BytecodeGenerator::emitSubroutineReturn):
+ (JSC::BytecodeGenerator::emitPushNewScope):
+ (JSC::BytecodeGenerator::beginSwitch):
+ (JSC::BytecodeGenerator::endSwitch):
+ (JSC::BytecodeGenerator::emitThrowExpressionTooDeepException):
+ * bytecompiler/CodeGenerator.h:
+ * jsc.cpp:
+ (runWithScripts):
+ * parser/Nodes.cpp:
+ (JSC::ThrowableExpressionData::emitThrowError):
+ (JSC::NullNode::emitBytecode):
+ (JSC::BooleanNode::emitBytecode):
+ (JSC::NumberNode::emitBytecode):
+ (JSC::StringNode::emitBytecode):
+ (JSC::RegExpNode::emitBytecode):
+ (JSC::ThisNode::emitBytecode):
+ (JSC::ResolveNode::isPure):
+ (JSC::ResolveNode::emitBytecode):
+ (JSC::ArrayNode::emitBytecode):
+ (JSC::ObjectLiteralNode::emitBytecode):
+ (JSC::PropertyListNode::emitBytecode):
+ (JSC::BracketAccessorNode::emitBytecode):
+ (JSC::DotAccessorNode::emitBytecode):
+ (JSC::ArgumentListNode::emitBytecode):
+ (JSC::NewExprNode::emitBytecode):
+ (JSC::EvalFunctionCallNode::emitBytecode):
+ (JSC::FunctionCallValueNode::emitBytecode):
+ (JSC::FunctionCallResolveNode::emitBytecode):
+ (JSC::FunctionCallBracketNode::emitBytecode):
+ (JSC::FunctionCallDotNode::emitBytecode):
+ (JSC::emitPreIncOrDec):
+ (JSC::emitPostIncOrDec):
+ (JSC::PostfixResolveNode::emitBytecode):
+ (JSC::PostfixBracketNode::emitBytecode):
+ (JSC::PostfixDotNode::emitBytecode):
+ (JSC::PostfixErrorNode::emitBytecode):
+ (JSC::DeleteResolveNode::emitBytecode):
+ (JSC::DeleteBracketNode::emitBytecode):
+ (JSC::DeleteDotNode::emitBytecode):
+ (JSC::DeleteValueNode::emitBytecode):
+ (JSC::VoidNode::emitBytecode):
+ (JSC::TypeOfResolveNode::emitBytecode):
+ (JSC::TypeOfValueNode::emitBytecode):
+ (JSC::PrefixResolveNode::emitBytecode):
+ (JSC::PrefixBracketNode::emitBytecode):
+ (JSC::PrefixDotNode::emitBytecode):
+ (JSC::PrefixErrorNode::emitBytecode):
+ (JSC::UnaryOpNode::emitBytecode):
+ (JSC::BinaryOpNode::emitBytecode):
+ (JSC::EqualNode::emitBytecode):
+ (JSC::StrictEqualNode::emitBytecode):
+ (JSC::ReverseBinaryOpNode::emitBytecode):
+ (JSC::ThrowableBinaryOpNode::emitBytecode):
+ (JSC::InstanceOfNode::emitBytecode):
+ (JSC::LogicalOpNode::emitBytecode):
+ (JSC::ConditionalNode::emitBytecode):
+ (JSC::emitReadModifyAssignment):
+ (JSC::ReadModifyResolveNode::emitBytecode):
+ (JSC::AssignResolveNode::emitBytecode):
+ (JSC::AssignDotNode::emitBytecode):
+ (JSC::ReadModifyDotNode::emitBytecode):
+ (JSC::AssignErrorNode::emitBytecode):
+ (JSC::AssignBracketNode::emitBytecode):
+ (JSC::ReadModifyBracketNode::emitBytecode):
+ (JSC::CommaNode::emitBytecode):
+ (JSC::ConstDeclNode::emitCodeSingle):
+ (JSC::ConstDeclNode::emitBytecode):
+ (JSC::ConstStatementNode::emitBytecode):
+ (JSC::statementListEmitCode):
+ (JSC::BlockNode::emitBytecode):
+ (JSC::EmptyStatementNode::emitBytecode):
+ (JSC::DebuggerStatementNode::emitBytecode):
+ (JSC::ExprStatementNode::emitBytecode):
+ (JSC::VarStatementNode::emitBytecode):
+ (JSC::IfNode::emitBytecode):
+ (JSC::IfElseNode::emitBytecode):
+ (JSC::DoWhileNode::emitBytecode):
+ (JSC::WhileNode::emitBytecode):
+ (JSC::ForNode::emitBytecode):
+ (JSC::ForInNode::emitBytecode):
+ (JSC::ContinueNode::emitBytecode):
+ (JSC::BreakNode::emitBytecode):
+ (JSC::ReturnNode::emitBytecode):
+ (JSC::WithNode::emitBytecode):
+ (JSC::CaseBlockNode::emitBytecodeForBlock):
+ (JSC::SwitchNode::emitBytecode):
+ (JSC::LabelNode::emitBytecode):
+ (JSC::ThrowNode::emitBytecode):
+ (JSC::TryNode::emitBytecode):
+ (JSC::EvalNode::emitBytecode):
+ (JSC::EvalNode::generateBytecode):
+ (JSC::FunctionBodyNode::generateBytecode):
+ (JSC::FunctionBodyNode::emitBytecode):
+ (JSC::ProgramNode::emitBytecode):
+ (JSC::ProgramNode::generateBytecode):
+ (JSC::FuncDeclNode::emitBytecode):
+ (JSC::FuncExprNode::emitBytecode):
+ * parser/Nodes.h:
+ (JSC::ExpressionNode::):
+ (JSC::BooleanNode::):
+ (JSC::NumberNode::):
+ (JSC::StringNode::):
+ (JSC::ProgramNode::):
+ (JSC::EvalNode::):
+ (JSC::FunctionBodyNode::):
+ * runtime/Arguments.h:
+ (JSC::Arguments::getArgumentsData):
+ (JSC::JSActivation::copyRegisters):
+ * runtime/JSActivation.cpp:
+ (JSC::JSActivation::mark):
+ * runtime/JSActivation.h:
+ (JSC::JSActivation::JSActivationData::JSActivationData):
+ * runtime/JSFunction.cpp:
+ (JSC::JSFunction::~JSFunction):
+
+2008-11-15 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Renamed all forms of "byte code" "opcode" "op code" "code" "bitcode"
+ etc. to "bytecode".
+
+ * VM/CTI.cpp:
+ (JSC::CTI::printBytecodeOperandTypes):
+ (JSC::CTI::emitAllocateNumber):
+ (JSC::CTI::emitNakedCall):
+ (JSC::CTI::emitNakedFastCall):
+ (JSC::CTI::emitCTICall):
+ (JSC::CTI::emitJumpSlowCaseIfNotJSCell):
+ (JSC::CTI::emitJumpSlowCaseIfNotImmNum):
+ (JSC::CTI::emitJumpSlowCaseIfNotImmNums):
+ (JSC::CTI::emitFastArithIntToImmOrSlowCase):
+ (JSC::CTI::compileOpCall):
+ (JSC::CTI::emitSlowScriptCheck):
+ (JSC::CTI::compileBinaryArithOp):
+ (JSC::CTI::compileBinaryArithOpSlowCase):
+ (JSC::CTI::privateCompileMainPass):
+ (JSC::CTI::privateCompileSlowCases):
+ (JSC::CTI::privateCompile):
+ * VM/CTI.h:
+ (JSC::CallRecord::CallRecord):
+ (JSC::SwitchRecord::SwitchRecord):
+ * VM/CodeBlock.cpp:
+ (JSC::CodeBlock::printStructureIDs):
+ (JSC::CodeBlock::dump):
+ (JSC::CodeBlock::~CodeBlock):
+ (JSC::CodeBlock::derefStructureIDs):
+ (JSC::CodeBlock::refStructureIDs):
+ * VM/CodeBlock.h:
+ (JSC::StructureStubInfo::StructureStubInfo):
+ * VM/ExceptionHelpers.cpp:
+ (JSC::createNotAnObjectError):
+ * VM/Instruction.h:
+ (JSC::Instruction::Instruction):
+ (JSC::Instruction::):
+ * VM/Machine.cpp:
+ (JSC::BytecodeInterpreter::isBytecode):
+ (JSC::BytecodeInterpreter::throwException):
+ (JSC::BytecodeInterpreter::execute):
+ (JSC::BytecodeInterpreter::tryCachePutByID):
+ (JSC::BytecodeInterpreter::uncachePutByID):
+ (JSC::BytecodeInterpreter::tryCacheGetByID):
+ (JSC::BytecodeInterpreter::uncacheGetByID):
+ (JSC::BytecodeInterpreter::privateExecute):
+ (JSC::BytecodeInterpreter::tryCTICachePutByID):
+ (JSC::BytecodeInterpreter::tryCTICacheGetByID):
+ (JSC::BytecodeInterpreter::cti_op_call_JSFunction):
+ (JSC::BytecodeInterpreter::cti_vm_dontLazyLinkCall):
+ (JSC::BytecodeInterpreter::cti_vm_lazyLinkCall):
+ * VM/Machine.h:
+ (JSC::BytecodeInterpreter::getBytecode):
+ (JSC::BytecodeInterpreter::getBytecodeID):
+ (JSC::BytecodeInterpreter::isCallBytecode):
+ * VM/Opcode.cpp:
+ (JSC::):
+ (JSC::BytecodeStats::BytecodeStats):
+ (JSC::compareBytecodeIndices):
+ (JSC::compareBytecodePairIndices):
+ (JSC::BytecodeStats::~BytecodeStats):
+ (JSC::BytecodeStats::recordInstruction):
+ (JSC::BytecodeStats::resetLastInstruction):
+ * VM/Opcode.h:
+ (JSC::):
+ (JSC::padBytecodeName):
+ * VM/SamplingTool.cpp:
+ (JSC::ScopeSampleRecord::sample):
+ (JSC::SamplingTool::run):
+ (JSC::compareBytecodeIndicesSampling):
+ (JSC::SamplingTool::dump):
+ * VM/SamplingTool.h:
+ (JSC::ScopeSampleRecord::ScopeSampleRecord):
+ (JSC::SamplingTool::SamplingTool):
+ * bytecompiler/CodeGenerator.cpp:
+ (JSC::CodeGenerator::generate):
+ (JSC::CodeGenerator::CodeGenerator):
+ (JSC::CodeGenerator::emitLabel):
+ (JSC::CodeGenerator::emitBytecode):
+ (JSC::CodeGenerator::emitJump):
+ (JSC::CodeGenerator::emitJumpIfTrue):
+ (JSC::CodeGenerator::emitJumpIfFalse):
+ (JSC::CodeGenerator::emitMove):
+ (JSC::CodeGenerator::emitUnaryOp):
+ (JSC::CodeGenerator::emitPreInc):
+ (JSC::CodeGenerator::emitPreDec):
+ (JSC::CodeGenerator::emitPostInc):
+ (JSC::CodeGenerator::emitPostDec):
+ (JSC::CodeGenerator::emitBinaryOp):
+ (JSC::CodeGenerator::emitEqualityOp):
+ (JSC::CodeGenerator::emitUnexpectedLoad):
+ (JSC::CodeGenerator::emitInstanceOf):
+ (JSC::CodeGenerator::emitResolve):
+ (JSC::CodeGenerator::emitGetScopedVar):
+ (JSC::CodeGenerator::emitPutScopedVar):
+ (JSC::CodeGenerator::emitResolveBase):
+ (JSC::CodeGenerator::emitResolveWithBase):
+ (JSC::CodeGenerator::emitResolveFunction):
+ (JSC::CodeGenerator::emitGetById):
+ (JSC::CodeGenerator::emitPutById):
+ (JSC::CodeGenerator::emitPutGetter):
+ (JSC::CodeGenerator::emitPutSetter):
+ (JSC::CodeGenerator::emitDeleteById):
+ (JSC::CodeGenerator::emitGetByVal):
+ (JSC::CodeGenerator::emitPutByVal):
+ (JSC::CodeGenerator::emitDeleteByVal):
+ (JSC::CodeGenerator::emitPutByIndex):
+ (JSC::CodeGenerator::emitNewObject):
+ (JSC::CodeGenerator::emitNewArray):
+ (JSC::CodeGenerator::emitNewFunction):
+ (JSC::CodeGenerator::emitNewRegExp):
+ (JSC::CodeGenerator::emitNewFunctionExpression):
+ (JSC::CodeGenerator::emitCall):
+ (JSC::CodeGenerator::emitReturn):
+ (JSC::CodeGenerator::emitUnaryNoDstOp):
+ (JSC::CodeGenerator::emitConstruct):
+ (JSC::CodeGenerator::emitPopScope):
+ (JSC::CodeGenerator::emitDebugHook):
+ (JSC::CodeGenerator::emitComplexJumpScopes):
+ (JSC::CodeGenerator::emitJumpScopes):
+ (JSC::CodeGenerator::emitNextPropertyName):
+ (JSC::CodeGenerator::emitCatch):
+ (JSC::CodeGenerator::emitNewError):
+ (JSC::CodeGenerator::emitJumpSubroutine):
+ (JSC::CodeGenerator::emitSubroutineReturn):
+ (JSC::CodeGenerator::emitPushNewScope):
+ (JSC::CodeGenerator::beginSwitch):
+ (JSC::CodeGenerator::endSwitch):
+ * bytecompiler/CodeGenerator.h:
+ (JSC::CodeGenerator::emitNode):
+ * jsc.cpp:
+ (runWithScripts):
+ * masm/X86Assembler.h:
+ (JSC::X86Assembler::):
+ (JSC::X86Assembler::emitModRm_opr):
+ (JSC::X86Assembler::emitModRm_opr_Unchecked):
+ (JSC::X86Assembler::emitModRm_opm):
+ (JSC::X86Assembler::emitModRm_opm_Unchecked):
+ (JSC::X86Assembler::emitModRm_opmsib):
+ * parser/Nodes.cpp:
+ (JSC::NullNode::emitBytecode):
+ (JSC::BooleanNode::emitBytecode):
+ (JSC::NumberNode::emitBytecode):
+ (JSC::StringNode::emitBytecode):
+ (JSC::RegExpNode::emitBytecode):
+ (JSC::ThisNode::emitBytecode):
+ (JSC::ResolveNode::emitBytecode):
+ (JSC::ArrayNode::emitBytecode):
+ (JSC::ObjectLiteralNode::emitBytecode):
+ (JSC::PropertyListNode::emitBytecode):
+ (JSC::BracketAccessorNode::emitBytecode):
+ (JSC::DotAccessorNode::emitBytecode):
+ (JSC::ArgumentListNode::emitBytecode):
+ (JSC::NewExprNode::emitBytecode):
+ (JSC::EvalFunctionCallNode::emitBytecode):
+ (JSC::FunctionCallValueNode::emitBytecode):
+ (JSC::FunctionCallResolveNode::emitBytecode):
+ (JSC::FunctionCallBracketNode::emitBytecode):
+ (JSC::FunctionCallDotNode::emitBytecode):
+ (JSC::PostfixResolveNode::emitBytecode):
+ (JSC::PostfixBracketNode::emitBytecode):
+ (JSC::PostfixDotNode::emitBytecode):
+ (JSC::PostfixErrorNode::emitBytecode):
+ (JSC::DeleteResolveNode::emitBytecode):
+ (JSC::DeleteBracketNode::emitBytecode):
+ (JSC::DeleteDotNode::emitBytecode):
+ (JSC::DeleteValueNode::emitBytecode):
+ (JSC::VoidNode::emitBytecode):
+ (JSC::TypeOfResolveNode::emitBytecode):
+ (JSC::TypeOfValueNode::emitBytecode):
+ (JSC::PrefixResolveNode::emitBytecode):
+ (JSC::PrefixBracketNode::emitBytecode):
+ (JSC::PrefixDotNode::emitBytecode):
+ (JSC::PrefixErrorNode::emitBytecode):
+ (JSC::UnaryOpNode::emitBytecode):
+ (JSC::BinaryOpNode::emitBytecode):
+ (JSC::EqualNode::emitBytecode):
+ (JSC::StrictEqualNode::emitBytecode):
+ (JSC::ReverseBinaryOpNode::emitBytecode):
+ (JSC::ThrowableBinaryOpNode::emitBytecode):
+ (JSC::InstanceOfNode::emitBytecode):
+ (JSC::LogicalOpNode::emitBytecode):
+ (JSC::ConditionalNode::emitBytecode):
+ (JSC::emitReadModifyAssignment):
+ (JSC::ReadModifyResolveNode::emitBytecode):
+ (JSC::AssignResolveNode::emitBytecode):
+ (JSC::AssignDotNode::emitBytecode):
+ (JSC::ReadModifyDotNode::emitBytecode):
+ (JSC::AssignErrorNode::emitBytecode):
+ (JSC::AssignBracketNode::emitBytecode):
+ (JSC::ReadModifyBracketNode::emitBytecode):
+ (JSC::CommaNode::emitBytecode):
+ (JSC::ConstDeclNode::emitBytecode):
+ (JSC::ConstStatementNode::emitBytecode):
+ (JSC::BlockNode::emitBytecode):
+ (JSC::EmptyStatementNode::emitBytecode):
+ (JSC::DebuggerStatementNode::emitBytecode):
+ (JSC::ExprStatementNode::emitBytecode):
+ (JSC::VarStatementNode::emitBytecode):
+ (JSC::IfNode::emitBytecode):
+ (JSC::IfElseNode::emitBytecode):
+ (JSC::DoWhileNode::emitBytecode):
+ (JSC::WhileNode::emitBytecode):
+ (JSC::ForNode::emitBytecode):
+ (JSC::ForInNode::emitBytecode):
+ (JSC::ContinueNode::emitBytecode):
+ (JSC::BreakNode::emitBytecode):
+ (JSC::ReturnNode::emitBytecode):
+ (JSC::WithNode::emitBytecode):
+ (JSC::SwitchNode::emitBytecode):
+ (JSC::LabelNode::emitBytecode):
+ (JSC::ThrowNode::emitBytecode):
+ (JSC::TryNode::emitBytecode):
+ (JSC::ScopeNode::ScopeNode):
+ (JSC::EvalNode::emitBytecode):
+ (JSC::FunctionBodyNode::emitBytecode):
+ (JSC::ProgramNode::emitBytecode):
+ (JSC::FuncDeclNode::emitBytecode):
+ (JSC::FuncExprNode::emitBytecode):
+ * parser/Nodes.h:
+ (JSC::UnaryPlusNode::):
+ (JSC::NegateNode::):
+ (JSC::BitwiseNotNode::):
+ (JSC::LogicalNotNode::):
+ (JSC::MultNode::):
+ (JSC::DivNode::):
+ (JSC::ModNode::):
+ (JSC::AddNode::):
+ (JSC::SubNode::):
+ (JSC::LeftShiftNode::):
+ (JSC::RightShiftNode::):
+ (JSC::UnsignedRightShiftNode::):
+ (JSC::LessNode::):
+ (JSC::GreaterNode::):
+ (JSC::LessEqNode::):
+ (JSC::GreaterEqNode::):
+ (JSC::InstanceOfNode::):
+ (JSC::InNode::):
+ (JSC::EqualNode::):
+ (JSC::NotEqualNode::):
+ (JSC::StrictEqualNode::):
+ (JSC::NotStrictEqualNode::):
+ (JSC::BitAndNode::):
+ (JSC::BitOrNode::):
+ (JSC::BitXOrNode::):
+ (JSC::ProgramNode::):
+ (JSC::EvalNode::):
+ (JSC::FunctionBodyNode::):
+ * runtime/JSNotAnObject.h:
+ * runtime/StructureID.cpp:
+ (JSC::StructureID::fromDictionaryTransition):
+ * wtf/Platform.h:
+
+2008-11-15 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Renamed Machine to BytecodeInterpreter.
+
+ Nixed the Interpreter class, and changed its two functions to stand-alone
+ functions.
+
+ * JavaScriptCore.exp:
+ * VM/CTI.cpp:
+ (JSC::):
+ (JSC::CTI::emitCTICall):
+ (JSC::CTI::CTI):
+ (JSC::CTI::compileOpCall):
+ (JSC::CTI::emitSlowScriptCheck):
+ (JSC::CTI::compileBinaryArithOpSlowCase):
+ (JSC::CTI::privateCompileMainPass):
+ (JSC::CTI::privateCompileSlowCases):
+ (JSC::CTI::privateCompile):
+ (JSC::CTI::privateCompileGetByIdSelf):
+ (JSC::CTI::privateCompileGetByIdProto):
+ (JSC::CTI::privateCompileGetByIdChain):
+ (JSC::CTI::privateCompilePutByIdReplace):
+ (JSC::CTI::privateCompilePutByIdTransition):
+ (JSC::CTI::privateCompileCTIMachineTrampolines):
+ (JSC::CTI::freeCTIMachineTrampolines):
+ (JSC::CTI::patchGetByIdSelf):
+ (JSC::CTI::patchPutByIdReplace):
+ (JSC::CTI::privateCompilePatchGetArrayLength):
+ (JSC::CTI::compileRegExp):
+ * VM/CTI.h:
+ * VM/CodeBlock.cpp:
+ (JSC::CodeBlock::printStructureIDs):
+ (JSC::CodeBlock::dump):
+ (JSC::CodeBlock::derefStructureIDs):
+ (JSC::CodeBlock::refStructureIDs):
+ * VM/ExceptionHelpers.cpp:
+ (JSC::createNotAnObjectError):
+ * VM/Machine.cpp:
+ (JSC::jsLess):
+ (JSC::jsLessEq):
+ (JSC::BytecodeInterpreter::resolve):
+ (JSC::BytecodeInterpreter::resolveSkip):
+ (JSC::BytecodeInterpreter::resolveGlobal):
+ (JSC::BytecodeInterpreter::resolveBase):
+ (JSC::BytecodeInterpreter::resolveBaseAndProperty):
+ (JSC::BytecodeInterpreter::resolveBaseAndFunc):
+ (JSC::BytecodeInterpreter::slideRegisterWindowForCall):
+ (JSC::BytecodeInterpreter::callEval):
+ (JSC::BytecodeInterpreter::BytecodeInterpreter):
+ (JSC::BytecodeInterpreter::initialize):
+ (JSC::BytecodeInterpreter::~BytecodeInterpreter):
+ (JSC::BytecodeInterpreter::dumpCallFrame):
+ (JSC::BytecodeInterpreter::dumpRegisters):
+ (JSC::BytecodeInterpreter::isOpcode):
+ (JSC::BytecodeInterpreter::unwindCallFrame):
+ (JSC::BytecodeInterpreter::throwException):
+ (JSC::BytecodeInterpreter::execute):
+ (JSC::BytecodeInterpreter::debug):
+ (JSC::BytecodeInterpreter::resetTimeoutCheck):
+ (JSC::BytecodeInterpreter::checkTimeout):
+ (JSC::BytecodeInterpreter::createExceptionScope):
+ (JSC::BytecodeInterpreter::tryCachePutByID):
+ (JSC::BytecodeInterpreter::uncachePutByID):
+ (JSC::BytecodeInterpreter::tryCacheGetByID):
+ (JSC::BytecodeInterpreter::uncacheGetByID):
+ (JSC::BytecodeInterpreter::privateExecute):
+ (JSC::BytecodeInterpreter::retrieveArguments):
+ (JSC::BytecodeInterpreter::retrieveCaller):
+ (JSC::BytecodeInterpreter::retrieveLastCaller):
+ (JSC::BytecodeInterpreter::findFunctionCallFrame):
+ (JSC::BytecodeInterpreter::tryCTICachePutByID):
+ (JSC::BytecodeInterpreter::tryCTICacheGetByID):
+ (JSC::BytecodeInterpreter::cti_op_convert_this):
+ (JSC::BytecodeInterpreter::cti_op_end):
+ (JSC::BytecodeInterpreter::cti_op_add):
+ (JSC::BytecodeInterpreter::cti_op_pre_inc):
+ (JSC::BytecodeInterpreter::cti_timeout_check):
+ (JSC::BytecodeInterpreter::cti_register_file_check):
+ (JSC::BytecodeInterpreter::cti_op_loop_if_less):
+ (JSC::BytecodeInterpreter::cti_op_loop_if_lesseq):
+ (JSC::BytecodeInterpreter::cti_op_new_object):
+ (JSC::BytecodeInterpreter::cti_op_put_by_id):
+ (JSC::BytecodeInterpreter::cti_op_put_by_id_second):
+ (JSC::BytecodeInterpreter::cti_op_put_by_id_generic):
+ (JSC::BytecodeInterpreter::cti_op_put_by_id_fail):
+ (JSC::BytecodeInterpreter::cti_op_get_by_id):
+ (JSC::BytecodeInterpreter::cti_op_get_by_id_second):
+ (JSC::BytecodeInterpreter::cti_op_get_by_id_generic):
+ (JSC::BytecodeInterpreter::cti_op_get_by_id_fail):
+ (JSC::BytecodeInterpreter::cti_op_instanceof):
+ (JSC::BytecodeInterpreter::cti_op_del_by_id):
+ (JSC::BytecodeInterpreter::cti_op_mul):
+ (JSC::BytecodeInterpreter::cti_op_new_func):
+ (JSC::BytecodeInterpreter::cti_op_call_JSFunction):
+ (JSC::BytecodeInterpreter::cti_op_call_arityCheck):
+ (JSC::BytecodeInterpreter::cti_vm_dontLazyLinkCall):
+ (JSC::BytecodeInterpreter::cti_vm_lazyLinkCall):
+ (JSC::BytecodeInterpreter::cti_op_push_activation):
+ (JSC::BytecodeInterpreter::cti_op_call_NotJSFunction):
+ (JSC::BytecodeInterpreter::cti_op_create_arguments):
+ (JSC::BytecodeInterpreter::cti_op_create_arguments_no_params):
+ (JSC::BytecodeInterpreter::cti_op_tear_off_activation):
+ (JSC::BytecodeInterpreter::cti_op_tear_off_arguments):
+ (JSC::BytecodeInterpreter::cti_op_profile_will_call):
+ (JSC::BytecodeInterpreter::cti_op_profile_did_call):
+ (JSC::BytecodeInterpreter::cti_op_ret_scopeChain):
+ (JSC::BytecodeInterpreter::cti_op_new_array):
+ (JSC::BytecodeInterpreter::cti_op_resolve):
+ (JSC::BytecodeInterpreter::cti_op_construct_JSConstruct):
+ (JSC::BytecodeInterpreter::cti_op_construct_NotJSConstruct):
+ (JSC::BytecodeInterpreter::cti_op_get_by_val):
+ (JSC::BytecodeInterpreter::cti_op_resolve_func):
+ (JSC::BytecodeInterpreter::cti_op_sub):
+ (JSC::BytecodeInterpreter::cti_op_put_by_val):
+ (JSC::BytecodeInterpreter::cti_op_put_by_val_array):
+ (JSC::BytecodeInterpreter::cti_op_lesseq):
+ (JSC::BytecodeInterpreter::cti_op_loop_if_true):
+ (JSC::BytecodeInterpreter::cti_op_negate):
+ (JSC::BytecodeInterpreter::cti_op_resolve_base):
+ (JSC::BytecodeInterpreter::cti_op_resolve_skip):
+ (JSC::BytecodeInterpreter::cti_op_resolve_global):
+ (JSC::BytecodeInterpreter::cti_op_div):
+ (JSC::BytecodeInterpreter::cti_op_pre_dec):
+ (JSC::BytecodeInterpreter::cti_op_jless):
+ (JSC::BytecodeInterpreter::cti_op_not):
+ (JSC::BytecodeInterpreter::cti_op_jtrue):
+ (JSC::BytecodeInterpreter::cti_op_post_inc):
+ (JSC::BytecodeInterpreter::cti_op_eq):
+ (JSC::BytecodeInterpreter::cti_op_lshift):
+ (JSC::BytecodeInterpreter::cti_op_bitand):
+ (JSC::BytecodeInterpreter::cti_op_rshift):
+ (JSC::BytecodeInterpreter::cti_op_bitnot):
+ (JSC::BytecodeInterpreter::cti_op_resolve_with_base):
+ (JSC::BytecodeInterpreter::cti_op_new_func_exp):
+ (JSC::BytecodeInterpreter::cti_op_mod):
+ (JSC::BytecodeInterpreter::cti_op_less):
+ (JSC::BytecodeInterpreter::cti_op_neq):
+ (JSC::BytecodeInterpreter::cti_op_post_dec):
+ (JSC::BytecodeInterpreter::cti_op_urshift):
+ (JSC::BytecodeInterpreter::cti_op_bitxor):
+ (JSC::BytecodeInterpreter::cti_op_new_regexp):
+ (JSC::BytecodeInterpreter::cti_op_bitor):
+ (JSC::BytecodeInterpreter::cti_op_call_eval):
+ (JSC::BytecodeInterpreter::cti_op_throw):
+ (JSC::BytecodeInterpreter::cti_op_get_pnames):
+ (JSC::BytecodeInterpreter::cti_op_next_pname):
+ (JSC::BytecodeInterpreter::cti_op_push_scope):
+ (JSC::BytecodeInterpreter::cti_op_pop_scope):
+ (JSC::BytecodeInterpreter::cti_op_typeof):
+ (JSC::BytecodeInterpreter::cti_op_is_undefined):
+ (JSC::BytecodeInterpreter::cti_op_is_boolean):
+ (JSC::BytecodeInterpreter::cti_op_is_number):
+ (JSC::BytecodeInterpreter::cti_op_is_string):
+ (JSC::BytecodeInterpreter::cti_op_is_object):
+ (JSC::BytecodeInterpreter::cti_op_is_function):
+ (JSC::BytecodeInterpreter::cti_op_stricteq):
+ (JSC::BytecodeInterpreter::cti_op_nstricteq):
+ (JSC::BytecodeInterpreter::cti_op_to_jsnumber):
+ (JSC::BytecodeInterpreter::cti_op_in):
+ (JSC::BytecodeInterpreter::cti_op_push_new_scope):
+ (JSC::BytecodeInterpreter::cti_op_jmp_scopes):
+ (JSC::BytecodeInterpreter::cti_op_put_by_index):
+ (JSC::BytecodeInterpreter::cti_op_switch_imm):
+ (JSC::BytecodeInterpreter::cti_op_switch_char):
+ (JSC::BytecodeInterpreter::cti_op_switch_string):
+ (JSC::BytecodeInterpreter::cti_op_del_by_val):
+ (JSC::BytecodeInterpreter::cti_op_put_getter):
+ (JSC::BytecodeInterpreter::cti_op_put_setter):
+ (JSC::BytecodeInterpreter::cti_op_new_error):
+ (JSC::BytecodeInterpreter::cti_op_debug):
+ (JSC::BytecodeInterpreter::cti_vm_throw):
+ * VM/Machine.h:
+ * VM/Register.h:
+ * VM/SamplingTool.cpp:
+ (JSC::SamplingTool::run):
+ * VM/SamplingTool.h:
+ (JSC::SamplingTool::SamplingTool):
+ * bytecompiler/CodeGenerator.cpp:
+ (JSC::CodeGenerator::generate):
+ (JSC::CodeGenerator::CodeGenerator):
+ (JSC::CodeGenerator::emitOpcode):
+ * debugger/DebuggerCallFrame.cpp:
+ (JSC::DebuggerCallFrame::evaluate):
+ * jsc.cpp:
+ (runWithScripts):
+ * parser/Nodes.cpp:
+ (JSC::ScopeNode::ScopeNode):
+ * profiler/ProfileGenerator.cpp:
+ (JSC::ProfileGenerator::addParentForConsoleStart):
+ * runtime/ArrayPrototype.cpp:
+ (JSC::arrayProtoFuncPop):
+ (JSC::arrayProtoFuncPush):
+ * runtime/Collector.cpp:
+ (JSC::Heap::collect):
+ * runtime/ExecState.h:
+ (JSC::ExecState::interpreter):
+ * runtime/FunctionPrototype.cpp:
+ (JSC::functionProtoFuncApply):
+ * runtime/Interpreter.cpp:
+ (JSC::Interpreter::evaluate):
+ * runtime/JSCell.h:
+ * runtime/JSFunction.cpp:
+ (JSC::JSFunction::call):
+ (JSC::JSFunction::argumentsGetter):
+ (JSC::JSFunction::callerGetter):
+ (JSC::JSFunction::construct):
+ * runtime/JSFunction.h:
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData):
+ (JSC::JSGlobalData::~JSGlobalData):
+ * runtime/JSGlobalData.h:
+ * runtime/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::~JSGlobalObject):
+ (JSC::JSGlobalObject::setTimeoutTime):
+ (JSC::JSGlobalObject::startTimeoutCheck):
+ (JSC::JSGlobalObject::stopTimeoutCheck):
+ (JSC::JSGlobalObject::mark):
+ * runtime/JSGlobalObjectFunctions.cpp:
+ (JSC::globalFuncEval):
+ * runtime/JSString.h:
+ * runtime/RegExp.cpp:
+ (JSC::RegExp::RegExp):
+
+2008-11-15 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ - Remove SymbolTable from FunctionBodyNode and move it to CodeBlock
+
+ It's not needed for functions that have never been executed, so no
+ need to waste the memory. Saves ~4M on membuster after 30 pages.
+
+ * VM/CodeBlock.h:
+ * VM/Machine.cpp:
+ (JSC::Machine::retrieveArguments):
+ * parser/Nodes.cpp:
+ (JSC::EvalNode::generateCode):
+ (JSC::FunctionBodyNode::generateCode):
+ * parser/Nodes.h:
+ * runtime/JSActivation.h:
+ (JSC::JSActivation::JSActivationData::JSActivationData):
+
+2008-11-14 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Bug 22259: Make all opcodes use eax as their final result register
+ <https://bugs.webkit.org/show_bug.cgi?id=22259>
+
+ Change one case of op_add (and the corresponding slow case) to use eax
+ rather than edx. Also, change the order in which the two results of
+ resolve_func and resolve_base are emitted so that the retrieved value is
+ put last into eax.
+
+ This gives no performance change on SunSpider or the V8 benchmark suite
+ when run in either harness.
+
+ * VM/CTI.cpp:
+ (JSC::CTI::privateCompileMainPass):
+ (JSC::CTI::privateCompileSlowCases):
+
+2008-11-14 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Geoff has this wacky notion that emitGetArg and emitPutArg should be related to
+ doing the same thing. Crazy.
+
+ Rename the methods for accessing virtual registers to say 'VirtualRegister' in the
+ name, and those for setting up the arguments for CTI methods to contain 'CTIArg'.
+
+ * VM/CTI.cpp:
+ (JSC::CTI::emitGetVirtualRegister):
+ (JSC::CTI::emitGetVirtualRegisters):
+ (JSC::CTI::emitPutCTIArgFromVirtualRegister):
+ (JSC::CTI::emitPutCTIArg):
+ (JSC::CTI::emitGetCTIArg):
+ (JSC::CTI::emitPutCTIArgConstant):
+ (JSC::CTI::emitPutVirtualRegister):
+ (JSC::CTI::compileOpCallSetupArgs):
+ (JSC::CTI::compileOpCallEvalSetupArgs):
+ (JSC::CTI::compileOpConstructSetupArgs):
+ (JSC::CTI::compileOpCall):
+ (JSC::CTI::compileOpStrictEq):
+ (JSC::CTI::putDoubleResultToJSNumberCellOrJSImmediate):
+ (JSC::CTI::compileBinaryArithOp):
+ (JSC::CTI::compileBinaryArithOpSlowCase):
+ (JSC::CTI::privateCompileMainPass):
+ (JSC::CTI::privateCompileSlowCases):
+ (JSC::CTI::privateCompileCTIMachineTrampolines):
+ * VM/CTI.h:
+
+2008-11-14 Greg Bolsinga <bolsinga@apple.com>
+
+ Reviewed by Antti Koivisto
+
+ Fix potential build break by adding StdLibExtras.h
+
+ * GNUmakefile.am:
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+
+2008-11-14 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Generate less code for the slow cases of op_call and op_construct.
+ https://bugs.webkit.org/show_bug.cgi?id=22272
+
+ 1% progression on v8 tests.
+
+ * VM/CTI.cpp:
+ (JSC::CTI::emitRetrieveArg):
+ (JSC::CTI::emitNakedCall):
+ (JSC::CTI::compileOpCallInitializeCallFrame):
+ (JSC::CTI::compileOpCall):
+ (JSC::CTI::privateCompileSlowCases):
+ (JSC::CTI::privateCompileCTIMachineTrampolines):
+ * VM/CTI.h:
+ * VM/CodeBlock.h:
+ (JSC::getCallLinkInfoReturnLocation):
+ (JSC::CodeBlock::getCallLinkInfo):
+ * VM/Machine.cpp:
+ (JSC::Machine::Machine):
+ (JSC::Machine::cti_vm_dontLazyLinkCall):
+ (JSC::Machine::cti_vm_lazyLinkCall):
+ * VM/Machine.h:
+
+2008-11-14 Greg Bolsinga <bolsinga@apple.com>
+
+ Reviewed by Darin Alder.
+
+ https://bugs.webkit.org/show_bug.cgi?id=21810
+ Remove use of static C++ objects that are destroyed at exit time (destructors)
+
+ Create DEFINE_STATIC_LOCAL macro. Change static local objects to leak to avoid
+ exit-time destructor. Update code that was changed to fix this issue that ran
+ into a gcc bug (<rdar://problem/6354696> Codegen issue with C++ static reference
+ in gcc build 5465). Also typdefs for template types needed to be added in some
+ cases so the type could make it through the macro successfully.
+
+ Basically code of the form:
+ static T m;
+ becomes:
+ DEFINE_STATIC_LOCAL(T, m, ());
+
+ Also any code of the form:
+ static T& m = *new T;
+ also becomes:
+ DEFINE_STATIC_LOCAL(T, m, ());
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * wtf/MainThread.cpp:
+ (WTF::mainThreadFunctionQueueMutex):
+ (WTF::functionQueue):
+ * wtf/StdLibExtras.h: Added. Add DEFINE_STATIC_LOCAL macro
+ * wtf/ThreadingPthreads.cpp:
+ (WTF::threadMapMutex):
+ (WTF::threadMap):
+ (WTF::identifierByPthreadHandle):
+
+2008-11-13 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Darin Adler
+
+ Fix for https://bugs.webkit.org/show_bug.cgi?id=22269
+ Reduce PropertyMap usage
+
+ From observation of StructureID statistics, it became clear that many
+ StructureID's were not being used as StructureIDs themselves, but rather
+ only being necessary as links in the transition chain. Acknowledging this
+ and that PropertyMaps stored in StructureIDs can be treated as caches, that
+ is that they can be reconstructed on demand, it became clear that we could
+ reduce the memory consumption of StructureIDs by only keeping PropertyMaps
+ for the StructureIDs that need them the most.
+
+ The specific strategy used to reduce the number of StructureIDs with
+ PropertyMaps is to take the previous StructureIDs PropertyMap when initially
+ transitioning (addPropertyTransition) from it and clearing out the pointer
+ in the process. The next time we need to do the same transition, for instance
+ repeated calls to the same constructor, we use the new addPropertyTransitionToExistingStructure
+ first, which allows us not to need the PropertyMap to determine if the property
+ exists already, since a transition to that property would require it not already
+ be present in the StructureID. Should there be no transition, the PropertyMap
+ can be constructed on demand (via materializePropertyMap) to determine if the put is a
+ replace or a transition to a new StructureID.
+
+ Reduces memory use on Membuster head test (30 pages open) by ~15MB.
+
+ * JavaScriptCore.exp:
+ * runtime/JSObject.h:
+ (JSC::JSObject::putDirect): First use addPropertyTransitionToExistingStructure
+ so that we can avoid building the PropertyMap on subsequent similar object
+ creations.
+ * runtime/PropertyMapHashTable.h:
+ (JSC::PropertyMapEntry::PropertyMapEntry): Add version of constructor which takes
+ all values to be used when lazily building the PropertyMap.
+ * runtime/StructureID.cpp:
+ (JSC::StructureID::dumpStatistics): Add statistics on the number of StructureIDs
+ with PropertyMaps.
+ (JSC::StructureID::StructureID): Rename m_cachedTransistionOffset to m_offset
+ (JSC::isPowerOf2):
+ (JSC::nextPowerOf2):
+ (JSC::sizeForKeyCount): Returns the expected size of a PropertyMap for a key count.
+ (JSC::StructureID::materializePropertyMap): Builds the PropertyMap out of its previous pointer chain.
+ (JSC::StructureID::addPropertyTransitionToExistingStructure): Only transitions if there is a
+ an existing transition.
+ (JSC::StructureID::addPropertyTransition): Instead of always copying the ProperyMap, try and take
+ it from it previous pointer.
+ (JSC::StructureID::removePropertyTransition): Simplify by calling toDictionaryTransition() to do
+ transition work.
+ (JSC::StructureID::changePrototypeTransition): Build the PropertyMap if necessary before transitioning
+ because once you have transitioned, you will not be able to reconstruct it afterwards as there is no
+ previous pointer, pinning the ProperyMap as well.
+ (JSC::StructureID::getterSetterTransition): Ditto.
+ (JSC::StructureID::toDictionaryTransition): Pin the PropertyMap so that it is not destroyed on further transitions.
+ (JSC::StructureID::fromDictionaryTransition): We can only transition back from a dictionary transition if there
+ are no deleted offsets.
+ (JSC::StructureID::addPropertyWithoutTransition): Build PropertyMap on demands and pin.
+ (JSC::StructureID::removePropertyWithoutTransition): Ditto.
+ (JSC::StructureID::get): Build on demand.
+ (JSC::StructureID::createPropertyMapHashTable): Add version of create that takes a size
+ for on demand building.
+ (JSC::StructureID::expandPropertyMapHashTable):
+ (JSC::StructureID::rehashPropertyMapHashTable):
+ (JSC::StructureID::getEnumerablePropertyNamesInternal): Build PropertyMap on demand.
+ * runtime/StructureID.h:
+ (JSC::StructureID::propertyStorageSize): Account for StructureIDs without PropertyMaps.
+ (JSC::StructureID::isEmpty): Ditto.
+ (JSC::StructureID::materializePropertyMapIfNecessary):
+ (JSC::StructureID::get): Build PropertyMap on demand
+
+2008-11-14 Csaba Osztrogonac <oszi@inf.u-szeged.hu>
+
+ Reviewed by Simon Hausmann.
+
+ <https://bugs.webkit.org/show_bug.cgi?id=21500>
+
+ JavaScriptCore build with -O3 flag instead of -O2 (gcc).
+ 2.02% speedup on SunSpider (Qt-port on Linux)
+ 1.10% speedup on V8 (Qt-port on Linux)
+ 3.45% speedup on WindScorpion (Qt-port on Linux)
+
+ * JavaScriptCore.pri:
+
+2008-11-14 Kristian Amlie <kristian.amlie@trolltech.com>
+
+ Reviewed by Darin Adler.
+
+ Compile fix for RVCT.
+
+ In reality, it is two fixes:
+
+ 1. Remove typename. I believe typename can only be used when the named
+ type depends on the template parameters, which it doesn't in this
+ case, so I think this is more correct.
+ 2. Replace ::iterator scope with specialized typedef. This is to work
+ around a bug in RVCT.
+
+ https://bugs.webkit.org/show_bug.cgi?id=22260
+
+ * wtf/ListHashSet.h:
+ (WTF::::find):
+
+2008-11-14 Kristian Amlie <kristian.amlie@trolltech.com>
+
+ Reviewed by Darin Adler.
+
+ Compile fix for WINSCW.
+
+ This fix doesn't protect against implicit conversions from bool to
+ integers, but most likely that will be caught on another platform.
+
+ https://bugs.webkit.org/show_bug.cgi?id=22260
+
+ * wtf/PassRefPtr.h:
+ (WTF::PassRefPtr::operator bool):
+ * wtf/RefPtr.h:
+ (WTF::RefPtr::operator bool):
+
+2008-11-14 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Bug 22245: Move wtf/dtoa.h into the WTF namespace
+ <https://bugs.webkit.org/show_bug.cgi?id=22245>
+
+ Move wtf/dtoa.h into the WTF namespace from the JSC namespace. This
+ introduces some ambiguities in name lookups, so I changed all uses of
+ the functions in wtf/dtoa.h to explicitly state the namespace.
+
+ * JavaScriptCore.exp:
+ * parser/Lexer.cpp:
+ (JSC::Lexer::lex):
+ * runtime/InitializeThreading.cpp:
+ * runtime/JSGlobalObjectFunctions.cpp:
+ (JSC::parseInt):
+ * runtime/NumberPrototype.cpp:
+ (JSC::integerPartNoExp):
+ (JSC::numberProtoFuncToExponential):
+ * runtime/UString.cpp:
+ (JSC::concatenate):
+ (JSC::UString::from):
+ (JSC::UString::toDouble):
+ * wtf/dtoa.cpp:
+ * wtf/dtoa.h:
+
+2008-11-14 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Bug 22257: Enable redundant read optimizations for results generated by compileBinaryArithOp()
+ <https://bugs.webkit.org/show_bug.cgi?id=22257>
+
+ This shows no change in performance on either SunSpider or the V8
+ benchmark suite, but it removes an ugly special case and allows for
+ future optimizations to be implemented in a cleaner fashion.
+
+ This patch was essentially given to me by Gavin Barraclough upon my
+ request, but I did regression and performance testing so that he could
+ work on something else.
+
+ * VM/CTI.cpp:
+ (JSC::CTI::putDoubleResultToJSNumberCellOrJSImmediate): Move the final
+ result to eax if it is not already there.
+ (JSC::CTI::compileBinaryArithOp): Remove the killing of the final result
+ register that disables the optimization.
+
+2008-11-13 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Adam Roben.
+
+ Add a Scons-based build system for building
+ the Chromium-Mac build of JavaScriptCore.
+ https://bugs.webkit.org/show_bug.cgi?id=21991
+
+ * JavaScriptCore.scons: Added.
+ * SConstruct: Added.
+
+2008-11-13 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Adam Roben.
+
+ Add PLATFORM(CHROMIUM) to the "we don't use cairo" blacklist
+ until https://bugs.webkit.org/show_bug.cgi?id=22250 is fixed.
+
+ * wtf/Platform.h:
+
+2008-11-13 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ In r38375 the 'jsc' shell was changed to improve teardown on quit. The
+ main() function in jsc.cpp uses Structured Exception Handling, so Visual
+ C++ emits a warning when destructors are used.
+
+ In order to speculatively fix the Windows build, this patch changes that
+ code to use explicit pointer manipulation and locking rather than smart
+ pointers and RAII.
+
+ * jsc.cpp:
+ (main):
+
+2008-11-13 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Bug 22246: Get arguments for opcodes together to eliminate more redundant memory reads
+ <https://bugs.webkit.org/show_bug.cgi?id=22246>
+
+ It is common for opcodes to read their first operand into eax and their
+ second operand into edx. If the value intended for the second operand is
+ in eax, we should first move eax to the register for the second operand
+ and then read the first operand into eax.
+
+ This is a 0.5% speedup on SunSpider and a 2.0% speedup on the V8
+ benchmark suite when measured using the V8 harness.
+
+ * VM/CTI.cpp:
+ (JSC::CTI::emitGetArgs):
+ (JSC::CTI::compileOpStrictEq):
+ (JSC::CTI::compileBinaryArithOp):
+ (JSC::CTI::privateCompileMainPass):
+ (JSC::CTI::privateCompileSlowCases):
+ * VM/CTI.h:
+
+2008-11-13 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Bug 22238: Avoid unnecessary reads of temporaries when the target machine register is not eax
+ <https://bugs.webkit.org/show_bug.cgi?id=22238>
+
+ Enable the optimization of not reading a value back from memory that we
+ just wrote when the target machine register is not eax. In order to do
+ this, the code generation for op_put_global_var must be changed to
+ read its argument into a register before overwriting eax.
+
+ This is a 0.5% speedup on SunSpider and shows no change on the V8
+ benchmark suite when run in either harness.
+
+ * VM/CTI.cpp:
+ (JSC::CTI::emitGetArg):
+ (JSC::CTI::privateCompileMainPass):
+
+2008-11-13 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Perform teardown in the 'jsc' shell in order to suppress annoying and
+ misleading leak messages. There is still a lone JSC::Node leaking when
+ quit() is called, but hopefully that can be fixed as well.
+
+ * jsc.cpp:
+ (functionQuit):
+ (main):
+
+2008-11-13 Mike Pinkerton <pinkerton@chromium.org>
+
+ Reviewed by Sam Weinig.
+
+ Fix for https://bugs.webkit.org/show_bug.cgi?id=22087
+ Need correct platform defines for Mac Chromium
+
+ Set the appropriate platform defines for Mac Chromium, which is
+ similar to PLATFORM(MAC), but isn't.
+
+ * wtf/Platform.h:
+
+2008-11-13 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ - remove immediate checks from native codegen for known non-immediate cases like "this"
+
+ ~.5% speedup on v8 benchmarks
+
+ In the future we can extend this model to remove all sorts of
+ typechecks based on local type info or type inference.
+
+ I also added an assertion to verify that all slow cases linked as
+ many slow case jumps as the corresponding fast case generated, and
+ fixed the pre-existing cases where this was not true.
+
+ * VM/CTI.cpp:
+ (JSC::CTI::emitJumpSlowCaseIfNotJSCell):
+ (JSC::CTI::linkSlowCaseIfNotJSCell):
+ (JSC::CTI::compileBinaryArithOp):
+ (JSC::CTI::compileBinaryArithOpSlowCase):
+ (JSC::CTI::privateCompileMainPass):
+ (JSC::CTI::privateCompileSlowCases):
+ * VM/CTI.h:
+ * VM/CodeBlock.h:
+ (JSC::CodeBlock::isKnownNotImmediate):
+
+2008-11-13 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Bug 21943: Avoid needless reads of temporary values in CTI code
+ <https://bugs.webkit.org/show_bug.cgi?id=21943>
+
+ If an opcode needs to load a virtual register and a previous opcode left
+ the contents of that virtual register in a machine register, use the
+ value in the machine register rather than getting it from memory.
+
+ In order to perform this optimization, it is necessary to know the
+ jump tagets in the CodeBlock. For temporaries, the only problematic
+ jump targets are binary logical operators and the ternary conditional
+ operator. However, if this optimization were to be extended to local
+ variable registers as well, other jump targets would need to be
+ included, like switch statement cases and the beginnings of catch
+ blocks.
+
+ This optimization also requires that the fast case and the slow case
+ of an opcode use emitPutResult() on the same register, which was chosen
+ to be eax, as that is the register into which we read the first operand
+ of opcodes. In order to make this the case, we needed to add some mov
+ instructions to the slow cases of some instructions.
+
+ This optimizaton is not applied whenever compileBinaryArithOp() is used
+ to compile an opcode, because different machine registers may be used to
+ store the final result. It seems possible to rewrite the code generation
+ in compileBinaryArithOp() to allow for this optimization.
+
+ This optimization is also not applied when generating slow cases,
+ because some fast cases overwrite the value of eax before jumping to the
+ slow case. In the future, it may be possible to apply this optimization
+ to slow cases as well, but it did not seem to be a speedup when testing
+ an early version of this patch.
+
+ This is a 1.0% speedup on SunSpider and a 6.3% speedup on the V8
+ benchmark suite.
+
+ * VM/CTI.cpp:
+ (JSC::CTI::killLastResultRegister):
+ (JSC::CTI::emitGetArg):
+ (JSC::CTI::emitGetPutArg):
+ (JSC::CTI::emitGetCTIParam):
+ (JSC::CTI::emitGetFromCallFrameHeader):
+ (JSC::CTI::emitPutResult):
+ (JSC::CTI::emitCTICall):
+ (JSC::CTI::CTI):
+ (JSC::CTI::compileOpCall):
+ (JSC::CTI::compileOpStrictEq):
+ (JSC::CTI::emitSlowScriptCheck):
+ (JSC::CTI::compileBinaryArithOp):
+ (JSC::CTI::privateCompileMainPass):
+ (JSC::CTI::privateCompileSlowCases):
+ (JSC::CTI::privateCompileGetByIdProto):
+ (JSC::CTI::privateCompilePatchGetArrayLength):
+ * VM/CTI.h:
+ * VM/CodeBlock.h:
+ (JSC::CodeBlock::isTemporaryRegisterIndex):
+ * bytecompiler/CodeGenerator.cpp:
+ (JSC::CodeGenerator::emitLabel):
+
+2008-11-12 Alp Toker <alp@nuanti.com>
+
+ autotools build system fix-up only. Add FloatQuad.h to the source
+ lists and sort them.
+
+ * GNUmakefile.am:
+
+2008-11-12 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Fixed https://bugs.webkit.org/show_bug.cgi?id=22192
+ +37 failures in fast/profiler
+
+ along with Darin's review comments in
+ https://bugs.webkit.org/show_bug.cgi?id=22174
+ Simplified op_call by nixing its responsibility for moving the value of
+ "this" into the first argument slot
+
+ * VM/Machine.cpp:
+ (JSC::returnToThrowTrampoline):
+ (JSC::throwStackOverflowError):
+ (JSC::Machine::cti_register_file_check):
+ (JSC::Machine::cti_op_call_arityCheck):
+ (JSC::Machine::cti_vm_throw): Moved the throw logic into a function, since
+ functions are better than macros.
+
+ * bytecompiler/CodeGenerator.cpp:
+ (JSC::CodeGenerator::emitCall):
+ (JSC::CodeGenerator::emitConstruct): Ensure that the function register
+ is preserved if profiling is enabled, since the profiler uses that
+ register.
+
+ * runtime/JSGlobalData.h: Renamed throwReturnAddress to exceptionLocation,
+ because I had a hard time understanding what "throwReturnAddress" meant.
+
+2008-11-12 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Roll in r38322, now that test failures have been fixed.
+
+ * VM/CTI.cpp:
+ (JSC::CTI::compileOpCallSetupArgs):
+ (JSC::CTI::compileOpCallEvalSetupArgs):
+ (JSC::CTI::compileOpConstructSetupArgs):
+ (JSC::CTI::compileOpCall):
+ (JSC::CTI::privateCompileMainPass):
+ (JSC::CTI::privateCompileSlowCases):
+ * VM/CTI.h:
+ * VM/CodeBlock.cpp:
+ (JSC::CodeBlock::dump):
+ * VM/Machine.cpp:
+ (JSC::Machine::callEval):
+ (JSC::Machine::dumpCallFrame):
+ (JSC::Machine::dumpRegisters):
+ (JSC::Machine::execute):
+ (JSC::Machine::privateExecute):
+ (JSC::Machine::cti_register_file_check):
+ (JSC::Machine::cti_op_call_arityCheck):
+ (JSC::Machine::cti_op_call_NotJSFunction):
+ (JSC::Machine::cti_op_construct_JSConstruct):
+ (JSC::Machine::cti_op_construct_NotJSConstruct):
+ (JSC::Machine::cti_op_call_eval):
+ (JSC::Machine::cti_vm_throw):
+ * VM/Machine.h:
+ * bytecompiler/CodeGenerator.cpp:
+ (JSC::CodeGenerator::emitCall):
+ (JSC::CodeGenerator::emitCallEval):
+ (JSC::CodeGenerator::emitConstruct):
+ * bytecompiler/CodeGenerator.h:
+ * parser/Nodes.cpp:
+ (JSC::EvalFunctionCallNode::emitCode):
+ (JSC::FunctionCallValueNode::emitCode):
+ (JSC::FunctionCallResolveNode::emitCode):
+ (JSC::FunctionCallBracketNode::emitCode):
+ (JSC::FunctionCallDotNode::emitCode):
+ * parser/Nodes.h:
+ (JSC::ScopeNode::neededConstants):
+
+2008-11-12 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ Fix for https://bugs.webkit.org/show_bug.cgi?id=22201
+ Integer conversion in array.length was safe signed values,
+ but the length is unsigned.
+
+ * VM/CTI.cpp:
+ (JSC::CTI::privateCompilePatchGetArrayLength):
+
+2008-11-12 Cameron Zwarich <zwarich@apple.com>
+
+ Rubber-stamped by Mark Rowe.
+
+ Roll out r38322 due to test failures on the bots.
+
+ * VM/CTI.cpp:
+ (JSC::CTI::compileOpCallSetupArgs):
+ (JSC::CTI::compileOpCall):
+ (JSC::CTI::privateCompileMainPass):
+ (JSC::CTI::privateCompileSlowCases):
+ * VM/CTI.h:
+ * VM/CodeBlock.cpp:
+ (JSC::CodeBlock::dump):
+ * VM/Machine.cpp:
+ (JSC::Machine::callEval):
+ (JSC::Machine::dumpCallFrame):
+ (JSC::Machine::dumpRegisters):
+ (JSC::Machine::execute):
+ (JSC::Machine::privateExecute):
+ (JSC::Machine::throwStackOverflowPreviousFrame):
+ (JSC::Machine::cti_register_file_check):
+ (JSC::Machine::cti_op_call_arityCheck):
+ (JSC::Machine::cti_op_call_NotJSFunction):
+ (JSC::Machine::cti_op_construct_JSConstruct):
+ (JSC::Machine::cti_op_construct_NotJSConstruct):
+ (JSC::Machine::cti_op_call_eval):
+ (JSC::Machine::cti_vm_throw):
+ * VM/Machine.h:
+ * bytecompiler/CodeGenerator.cpp:
+ (JSC::CodeGenerator::emitCall):
+ (JSC::CodeGenerator::emitCallEval):
+ (JSC::CodeGenerator::emitConstruct):
+ * bytecompiler/CodeGenerator.h:
+ * parser/Nodes.cpp:
+ (JSC::EvalFunctionCallNode::emitCode):
+ (JSC::FunctionCallValueNode::emitCode):
+ (JSC::FunctionCallResolveNode::emitCode):
+ (JSC::FunctionCallBracketNode::emitCode):
+ (JSC::FunctionCallDotNode::emitCode):
+ * parser/Nodes.h:
+ (JSC::ScopeNode::neededConstants):
+
+2008-11-11 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Fixed https://bugs.webkit.org/show_bug.cgi?id=22174
+ Simplified op_call by nixing its responsibility for moving the value of
+ "this" into the first argument slot.
+
+ Instead, the caller emits an explicit load or mov instruction, or relies
+ on implicit knowledge that "this" is already in the first argument slot.
+ As a result, two operands to op_call are gone: firstArg and thisVal.
+
+ SunSpider and v8 tests show no change in bytecode or CTI.
+
+ * VM/CTI.cpp:
+ (JSC::CTI::compileOpCallSetupArgs):
+ (JSC::CTI::compileOpCallEvalSetupArgs):
+ (JSC::CTI::compileOpConstructSetupArgs): Split apart these three versions
+ of setting up arguments to op_call, because they're more different than
+ they are the same -- even more so with this patch.
+
+ (JSC::CTI::compileOpCall): Updated for the fact that op_construct doesn't
+ match op_call anymore.
+
+ (JSC::CTI::privateCompileMainPass):
+ (JSC::CTI::privateCompileSlowCases): Merged a few call cases. Updated
+ for changes mentioned above.
+
+ * VM/CTI.h:
+
+ * VM/CodeBlock.cpp:
+ (JSC::CodeBlock::dump): Updated for new bytecode format of call / construct.
+
+ * VM/Machine.cpp:
+ (JSC::Machine::callEval): Updated for new bytecode format of call / construct.
+
+ (JSC::Machine::dumpCallFrame):
+ (JSC::Machine::dumpRegisters): Simplified these debugging functions,
+ taking advantage of the new call frame layout.
+
+ (JSC::Machine::execute): Fixed up the eval version of execute to be
+ friendlier to calls in the new format.
+
+ (JSC::Machine::privateExecute): Implemented the new call format in
+ bytecode.
+
+ (JSC::Machine::cti_op_call_NotJSFunction):
+ (JSC::Machine::cti_op_construct_JSConstruct):
+ (JSC::Machine::cti_op_construct_NotJSConstruct):
+ (JSC::Machine::cti_op_call_eval): Updated CTI helpers to match the new
+ call format.
+
+ Fixed a latent bug in stack overflow checking that is now hit because
+ the register layout has changed a bit -- namely: when throwing a stack
+ overflow exception inside an op_call helper, we need to account for the
+ fact that the current call frame is only half-constructed, and use the
+ parent call frame instead.
+
+ * VM/Machine.h:
+
+ * bytecompiler/CodeGenerator.cpp:
+ (JSC::CodeGenerator::emitCall):
+ (JSC::CodeGenerator::emitCallEval):
+ (JSC::CodeGenerator::emitConstruct):
+ * bytecompiler/CodeGenerator.h: Updated codegen to match the new call
+ format.
+
+ * parser/Nodes.cpp:
+ (JSC::EvalFunctionCallNode::emitCode):
+ (JSC::FunctionCallValueNode::emitCode):
+ (JSC::FunctionCallResolveNode::emitCode):
+ (JSC::FunctionCallBracketNode::emitCode):
+ (JSC::FunctionCallDotNode::emitCode):
+ * parser/Nodes.h:
+ (JSC::ScopeNode::neededConstants): ditto
+
+2008-11-11 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Remove an unused forwarding header for a file that no longer exists.
+
+ * ForwardingHeaders/JavaScriptCore/JSLock.h: Removed.
+
+2008-11-11 Mark Rowe <mrowe@apple.com>
+
+ Fix broken dependencies building JavaScriptCore on a freezing cold cat, caused
+ by failure to update all instances of "kjs" to their new locations.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2008-11-11 Alexey Proskuryakov <ap@webkit.org>
+
+ Rubber-stamped by Adam Roben.
+
+ * wtf/AVLTree.h: (WTF::AVLTree::Iterator::start_iter):
+ Fix indentation a little more.
+
+2008-11-11 Cameron Zwarich <zwarich@apple.com>
+
+ Rubber-stamped by Sam Weinig.
+
+ Clean up EvalCodeCache to match our coding style a bit more.
+
+ * VM/EvalCodeCache.h:
+ (JSC::EvalCodeCache::get):
+
+2008-11-11 Cameron Zwarich <zwarich@apple.com>
+
+ Rubber-stamped by Sam Weinig.
+
+ Bug 22179: Move EvalCodeCache from CodeBlock.h into its own file
+ <https://bugs.webkit.org/show_bug.cgi?id=22179>
+
+ * GNUmakefile.am:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * VM/CodeBlock.h:
+ * VM/EvalCodeCache.h: Copied from VM/CodeBlock.h.
+ * VM/Machine.cpp:
+
+2008-11-11 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Remove the 'm_' prefix from the fields of the SwitchRecord struct.
+
+ * VM/CTI.cpp:
+ (JSC::CTI::privateCompile):
+ * VM/CTI.h:
+ (JSC::SwitchRecord):
+ (JSC::SwitchRecord::SwitchRecord):
+
+2008-11-11 Cameron Zwarich <zwarich@apple.com>
+
+ Rubber-stamped by Sam Weinig.
+
+ Make asInteger() a static function so that it has internal linkage.
+
+ * VM/CTI.cpp:
+ (JSC::asInteger):
+
+2008-11-11 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Mark Rowe.
+
+ - shrink CodeBlock and AST related Vectors to exact fit (5-10M savings on membuster test)
+
+ No perf regression combined with the last patch (each seems like a small regression individually)
+
+ * bytecompiler/CodeGenerator.cpp:
+ (JSC::CodeGenerator::generate):
+ * parser/Nodes.h:
+ (JSC::SourceElements::releaseContentsIntoVector):
+ * wtf/Vector.h:
+ (WTF::Vector::shrinkToFit):
+
+2008-11-11 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Mark Rowe.
+
+ - remove inline capacity from declaration stacks (15M savings on membuster test)
+
+ No perf regression on SunSpider or V8 test combined with other upcoming memory improvement patch.
+
+ * JavaScriptCore.exp:
+ * parser/Nodes.h:
+
+2008-11-11 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ While r38286 removed the need for the m_callFrame member variable of
+ CTI, it should be also be removed.
+
+ * VM/CTI.h:
+
+2008-11-10 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Make CTI::asInteger() a non-member function, since it needs no access to
+ any of CTI's member variables.
+
+ * VM/CTI.cpp:
+ (JSC::asInteger):
+ * VM/CTI.h:
+
+2008-11-10 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Use 'value' instead of 'js' in CTI as a name for JSValue* to match our
+ usual convention elsewhere.
+
+ * VM/CTI.cpp:
+ (JSC::CTI::emitGetArg):
+ (JSC::CTI::emitGetPutArg):
+ (JSC::CTI::getConstantImmediateNumericArg):
+ (JSC::CTI::printOpcodeOperandTypes):
+
+2008-11-10 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Make CTI::getConstant() a member function of CodeBlock instead.
+
+ * VM/CTI.cpp:
+ (JSC::CTI::emitGetArg):
+ (JSC::CTI::emitGetPutArg):
+ (JSC::CTI::getConstantImmediateNumericArg):
+ (JSC::CTI::printOpcodeOperandTypes):
+ (JSC::CTI::privateCompileMainPass):
+ * VM/CTI.h:
+ * VM/CodeBlock.h:
+ (JSC::CodeBlock::getConstant):
+
+2008-11-10 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Rename CodeBlock::isConstant() to isConstantRegisterIndex().
+
+ * VM/CTI.cpp:
+ (JSC::CTI::emitGetArg):
+ (JSC::CTI::emitGetPutArg):
+ (JSC::CTI::getConstantImmediateNumericArg):
+ (JSC::CTI::printOpcodeOperandTypes):
+ (JSC::CTI::privateCompileMainPass):
+ * VM/CodeBlock.h:
+ (JSC::CodeBlock::isConstantRegisterIndex):
+ * bytecompiler/CodeGenerator.cpp:
+ (JSC::CodeGenerator::emitEqualityOp):
+
+2008-11-10 Gavin Barraclough <barraclough@apple.com>
+
+ Build fix for non-CTI builds.
+
+ * VM/Machine.cpp:
+ (JSC::Machine::initialize):
+
+2008-11-10 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Remove the unused labels member variable of CodeBlock.
+
+ * VM/CodeBlock.h:
+ * VM/LabelID.h:
+ (JSC::LabelID::setLocation):
+
+2008-11-10 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ Batch compile the set of static trampolines at the point Machine is constructed, using a single allocation.
+ Refactor out m_callFrame from CTI, since this is only needed to access the global data (instead store a
+ pointer to the global data directly, since this is available at the point the Machine is constructed).
+ Add a method to align the code buffer, to allow JIT generation for multiple trampolines in one block.
+
+ * VM/CTI.cpp:
+ (JSC::CTI::getConstant):
+ (JSC::CTI::emitGetArg):
+ (JSC::CTI::emitGetPutArg):
+ (JSC::CTI::getConstantImmediateNumericArg):
+ (JSC::CTI::printOpcodeOperandTypes):
+ (JSC::CTI::CTI):
+ (JSC::CTI::compileBinaryArithOp):
+ (JSC::CTI::privateCompileMainPass):
+ (JSC::CTI::privateCompileGetByIdProto):
+ (JSC::CTI::privateCompileGetByIdChain):
+ (JSC::CTI::privateCompileCTIMachineTrampolines):
+ (JSC::CTI::freeCTIMachineTrampolines):
+ * VM/CTI.h:
+ (JSC::CTI::compile):
+ (JSC::CTI::compileGetByIdSelf):
+ (JSC::CTI::compileGetByIdProto):
+ (JSC::CTI::compileGetByIdChain):
+ (JSC::CTI::compilePutByIdReplace):
+ (JSC::CTI::compilePutByIdTransition):
+ (JSC::CTI::compileCTIMachineTrampolines):
+ (JSC::CTI::compilePatchGetArrayLength):
+ * VM/Machine.cpp:
+ (JSC::Machine::initialize):
+ (JSC::Machine::~Machine):
+ (JSC::Machine::execute):
+ (JSC::Machine::tryCTICachePutByID):
+ (JSC::Machine::tryCTICacheGetByID):
+ (JSC::Machine::cti_op_call_JSFunction):
+ (JSC::Machine::cti_vm_lazyLinkCall):
+ * VM/Machine.h:
+ * masm/X86Assembler.h:
+ (JSC::JITCodeBuffer::isAligned):
+ (JSC::X86Assembler::):
+ (JSC::X86Assembler::align):
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData):
+
+2008-11-10 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Antti Koivisto.
+
+ - Make Vector::clear() release the Vector's memory (1MB savings on membuster)
+ https://bugs.webkit.org/show_bug.cgi?id=22170
+
+ * wtf/Vector.h:
+ (WTF::VectorBufferBase::deallocateBuffer): Set capacity to 0 as
+ well as size, otherwise shrinking capacity to 0 can fail to reset
+ the capacity and thus cause a future crash.
+ (WTF::Vector::~Vector): Shrink size not capacity; we only need
+ to call destructors, the buffer will be freed anyway.
+ (WTF::Vector::clear): Change this to shrinkCapacity(0), not just shrink(0).
+ (WTF::::shrinkCapacity): Use shrink() instead of resize() for case where
+ the size is greater than the new capacity, to work with types that have no
+ default constructor.
+
+2008-11-10 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Split multiple definitions into separate lines.
+
+ * VM/CTI.cpp:
+ (JSC::CTI::compileBinaryArithOp):
+
+2008-11-10 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Bug 22162: Remove cachedValueGetter from the JavaScriptCore API implementation
+ <https://bugs.webkit.org/show_bug.cgi?id=22162>
+
+ There is no more need for the cachedValueGetter hack now that we have
+ PropertySlot::setValue(), so we should remove it.
+
+ * API/JSCallbackObject.h:
+ * API/JSCallbackObjectFunctions.h:
+ (JSC::::getOwnPropertySlot):
+
+2008-11-10 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Bug 22152: Remove asObject() call from JSCallbackObject::getOwnPropertySlot()
+ <https://bugs.webkit.org/show_bug.cgi?id=22152>
+
+ With the recent change to adopt asType() style cast functions with
+ assertions instead of static_casts in many places, the assertion for
+ the asObject() call in JSCallbackObject::getOwnPropertySlot() has been
+ failing when using any nontrivial client of the JavaScriptCore API.
+ The cast isn't even necessary to call slot.setCustom(), so it should
+ be removed.
+
+ * API/JSCallbackObjectFunctions.h:
+ (JSC::JSCallbackObject::getOwnPropertySlot):
+
+2008-11-10 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Adam Roben.
+
+ A few coding style fixes for AVLTree.
+
+ * wtf/AVLTree.h: Moved to WTF namespace, Removed "KJS_" from include guards.
+ (WTF::AVLTree::Iterator::start_iter): Fixed indentation
+
+ * runtime/JSArray.cpp: Added "using namepace WTF".
+
+2008-11-09 Cameron Zwarich <zwarich@apple.com>
+
+ Not reviewed.
+
+ Speculatively fix the non-AllInOne build.
+
+ * runtime/NativeErrorConstructor.cpp:
+
+2008-11-09 Darin Adler <darin@apple.com>
+
+ Reviewed by Tim Hatcher.
+
+ - https://bugs.webkit.org/show_bug.cgi?id=22149
+ remove unused code from the parser
+
+ * AllInOneFile.cpp: Removed nodes2string.cpp.
+ * GNUmakefile.am: Ditto.
+ * JavaScriptCore.exp: Ditto.
+ * JavaScriptCore.pri: Ditto.
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Ditto.
+ * JavaScriptCore.xcodeproj/project.pbxproj: Ditto.
+ * JavaScriptCoreSources.bkl: Ditto.
+
+ * VM/CodeBlock.h: Added include.
+
+ * VM/Machine.cpp: (JSC::Machine::execute): Use the types from
+ DeclarationStacks as DeclarationStacks:: rather than Node:: since
+ "Node" really has little to do with it.
+ * bytecompiler/CodeGenerator.cpp:
+ (JSC::CodeGenerator::CodeGenerator): Ditto.
+
+ * jsc.cpp:
+ (Options::Options): Removed prettyPrint option.
+ (runWithScripts): Ditto.
+ (printUsageStatement): Ditto.
+ (parseArguments): Ditto.
+ (jscmain): Ditto.
+
+ * parser/Grammar.y: Removed use of obsolete ImmediateNumberNode.
+
+ * parser/Nodes.cpp:
+ (JSC::ThrowableExpressionData::emitThrowError): Use inline functions
+ instead of direct member access for ThrowableExpressionData values.
+ (JSC::BracketAccessorNode::emitCode): Ditto.
+ (JSC::DotAccessorNode::emitCode): Ditto.
+ (JSC::NewExprNode::emitCode): Ditto.
+ (JSC::EvalFunctionCallNode::emitCode): Ditto.
+ (JSC::FunctionCallValueNode::emitCode): Ditto.
+ (JSC::FunctionCallResolveNode::emitCode): Ditto.
+ (JSC::FunctionCallBracketNode::emitCode): Ditto.
+ (JSC::FunctionCallDotNode::emitCode): Ditto.
+ (JSC::PostfixResolveNode::emitCode): Ditto.
+ (JSC::PostfixBracketNode::emitCode): Ditto.
+ (JSC::PostfixDotNode::emitCode): Ditto.
+ (JSC::DeleteResolveNode::emitCode): Ditto.
+ (JSC::DeleteBracketNode::emitCode): Ditto.
+ (JSC::DeleteDotNode::emitCode): Ditto.
+ (JSC::PrefixResolveNode::emitCode): Ditto.
+ (JSC::PrefixBracketNode::emitCode): Ditto.
+ (JSC::PrefixDotNode::emitCode): Ditto.
+ (JSC::ThrowableBinaryOpNode::emitCode): Ditto.
+ (JSC::InstanceOfNode::emitCode): Ditto.
+ (JSC::ReadModifyResolveNode::emitCode): Ditto.
+ (JSC::AssignResolveNode::emitCode): Ditto.
+ (JSC::AssignDotNode::emitCode): Ditto.
+ (JSC::ReadModifyDotNode::emitCode): Ditto.
+ (JSC::AssignBracketNode::emitCode): Ditto.
+ (JSC::ReadModifyBracketNode::emitCode): Ditto.
+ (JSC::statementListEmitCode): Take a const StatementVector instead
+ of a non-const one. Also removed unused statementListPushFIFO.
+ (JSC::ForInNode::emitCode): Inline functions instead of member access.
+ (JSC::ThrowNode::emitCode): Ditto.
+ (JSC::EvalNode::emitCode): Ditto.
+ (JSC::FunctionBodyNode::emitCode): Ditto.
+ (JSC::ProgramNode::emitCode): Ditto.
+
+ * parser/Nodes.h: Removed unused includes and forward declarations.
+ Removed Precedence enum. Made many more members private instead of
+ protected or public. Removed unused NodeStack typedef. Moved the
+ VarStack and FunctionStack typedefs from Node to ScopeNode. Made
+ Node::emitCode pure virtual and changed classes that don't emit
+ any code to inherit from ParserRefCounted rather than Node.
+ Moved isReturnNode from Node to StatementNode. Removed the
+ streamTo, precedence, and needsParensIfLeftmost functions from
+ all classes. Removed the ImmediateNumberNode class and make
+ NumberNode::setValue nonvirtual.
+
+ * parser/nodes2string.cpp: Removed.
+
+2008-11-09 Darin Adler <darin@apple.com>
+
+ Reviewed by Sam Weinig and Maciej Stachowiak.
+ Includes some work done by Chris Brichford.
+
+ - fix https://bugs.webkit.org/show_bug.cgi?id=14886
+ Stack overflow due to deeply nested parse tree doing repeated string concatentation
+
+ Test: fast/js/large-expressions.html
+
+ 1) Code generation is recursive, so takes stack proportional to the complexity
+ of the source code expression. Fixed by setting an arbitrary recursion limit
+ of 10,000 nodes.
+
+ 2) Destruction of the syntax tree was recursive. Fixed by introducing a
+ non-recursive mechanism for destroying the tree.
+
+ * bytecompiler/CodeGenerator.cpp:
+ (JSC::CodeGenerator::CodeGenerator): Initialize depth to 0.
+ (JSC::CodeGenerator::emitThrowExpressionTooDeepException): Added. Emits the code
+ to throw a "too deep" exception.
+ * bytecompiler/CodeGenerator.h:
+ (JSC::CodeGenerator::emitNode): Check depth and emit an exception if we exceed
+ the maximum depth.
+
+ * parser/Nodes.cpp:
+ (JSC::NodeReleaser::releaseAllNodes): Added. To be called inside node destructors
+ to avoid recursive calls to destructors for nodes inside this one.
+ (JSC::NodeReleaser::release): Added. To be called inside releaseNodes functions.
+ Also added releaseNodes functions and calls to releaseAllNodes inside destructors
+ for each class derived from Node that has RefPtr to other nodes.
+ (JSC::NodeReleaser::adopt): Added. Used by the release function.
+ (JSC::NodeReleaser::adoptFunctionBodyNode): Added.
+
+ * parser/Nodes.h: Added declarations of releaseNodes and destructors in all classes
+ that needed it. Eliminated use of ListRefPtr and releaseNext, which are the two parts
+ of an older solution to the non-recursive destruction problem that works only for
+ lists, whereas the new solution works for other graphs. Changed ReverseBinaryOpNode
+ to use BinaryOpNode as a base class to avoid some duplicated code.
+
+2008-11-08 Kevin Ollivier <kevino@theolliviers.com>
+
+ wx build fixes after addition of JSCore parser and bycompiler dirs. Also cleanup
+ the JSCore Bakefile's group names to be consistent.
+
+ * JavaScriptCoreSources.bkl:
+ * jscore.bkl:
+
+2008-11-07 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Bug 21801: REGRESSION (r37821): YUI date formatting JavaScript puts the letter 'd' in place of the day
+ <https://bugs.webkit.org/show_bug.cgi?id=21801>
+
+ Fix the constant register check in the 'typeof' optimization in
+ CodeGenerator, which was completely broken after r37821.
+
+ * bytecompiler/CodeGenerator.cpp:
+ (JSC::CodeGenerator::emitEqualityOp):
+
+2008-11-07 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Bug 22129: Move CTI::isConstant() to CodeBlock
+ <https://bugs.webkit.org/show_bug.cgi?id=22129>
+
+ * VM/CTI.cpp:
+ (JSC::CTI::emitGetArg):
+ (JSC::CTI::emitGetPutArg):
+ (JSC::CTI::getConstantImmediateNumericArg):
+ (JSC::CTI::printOpcodeOperandTypes):
+ (JSC::CTI::privateCompileMainPass):
+ * VM/CTI.h:
+ * VM/CodeBlock.h:
+ (JSC::CodeBlock::isConstant):
+
+2008-11-07 Alp Toker <alp@nuanti.com>
+
+ autotools fix. Always use the configured perl binary (which may be
+ different to the one in $PATH) when generating sources.
+
+ * GNUmakefile.am:
+
+2008-11-07 Cameron Zwarich <zwarich@apple.com>
+
+ Not reviewed.
+
+ Change grammar.cpp to Grammar.cpp and grammar.h to Grammar.h in several
+ build scripts.
+
+ * DerivedSources.make:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCoreSources.bkl:
+
+2008-11-07 Alp Toker <alp@nuanti.com>
+
+ More grammar.cpp -> Grammar.cpp build fixes.
+
+ * AllInOneFile.cpp:
+ * GNUmakefile.am:
+
+2008-11-07 Simon Hausmann <hausmann@webkit.org>
+
+ Fix the build on case-sensitive file systems. grammar.y was renamed to
+ Grammar.y but Lexer.cpp includes grammar.h. The build bots didn't
+ notice this change because of stale files.
+
+ * parser/Lexer.cpp:
+
+2008-11-07 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Rename the m_nextGlobal, m_nextParameter, and m_nextConstant member
+ variables of CodeGenerator to m_nextGlobalIndex, m_nextParameterIndex,
+ and m_nextConstantIndex respectively. This is to distinguish these from
+ member variables like m_lastConstant, which are actually RefPtrs to
+ Registers.
+
+ * bytecompiler/CodeGenerator.cpp:
+ (JSC::CodeGenerator::addGlobalVar):
+ (JSC::CodeGenerator::allocateConstants):
+ (JSC::CodeGenerator::CodeGenerator):
+ (JSC::CodeGenerator::addParameter):
+ (JSC::CodeGenerator::addConstant):
+ * bytecompiler/CodeGenerator.h:
+
+2008-11-06 Gavin Barraclough barraclough@apple.com
+
+ Reviewed by Oliver Hunt.
+
+ Do not make a cti_* call to perform an op_call unless either:
+ (1) The codeblock for the function body has not been generated.
+ (2) The number of arguments passed does not match the callee arity.
+
+ ~1% progression on sunspider --v8
+
+ * VM/CTI.cpp:
+ (JSC::CTI::compileOpCallInitializeCallFrame):
+ (JSC::CTI::compileOpCall):
+ (JSC::CTI::privateCompileSlowCases):
+ * VM/CTI.h:
+ * VM/Machine.cpp:
+ (JSC::Machine::cti_op_call_JSFunction):
+ (JSC::Machine::cti_op_call_arityCheck):
+ (JSC::Machine::cti_op_construct_JSConstruct):
+ * VM/Machine.h:
+ * kjs/nodes.h:
+
+2008-11-06 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Move the remaining files in the kjs subdirectory of JavaScriptCore to
+ a new parser subdirectory, and remove the kjs subdirectory entirely.
+
+ * AllInOneFile.cpp:
+ * DerivedSources.make:
+ * GNUmakefile.am:
+ * JavaScriptCore.pri:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * JavaScriptCore.vcproj/jsc/jsc.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * JavaScriptCoreSources.bkl:
+ * VM/CodeBlock.h:
+ * VM/ExceptionHelpers.cpp:
+ * VM/SamplingTool.h:
+ * bytecompiler/CodeGenerator.h:
+ * jsc.pro:
+ * jscore.bkl:
+ * kjs: Removed.
+ * kjs/NodeInfo.h: Removed.
+ * kjs/Parser.cpp: Removed.
+ * kjs/Parser.h: Removed.
+ * kjs/ResultType.h: Removed.
+ * kjs/SourceCode.h: Removed.
+ * kjs/SourceProvider.h: Removed.
+ * kjs/grammar.y: Removed.
+ * kjs/keywords.table: Removed.
+ * kjs/lexer.cpp: Removed.
+ * kjs/lexer.h: Removed.
+ * kjs/nodes.cpp: Removed.
+ * kjs/nodes.h: Removed.
+ * kjs/nodes2string.cpp: Removed.
+ * parser: Added.
+ * parser/Grammar.y: Copied from kjs/grammar.y.
+ * parser/Keywords.table: Copied from kjs/keywords.table.
+ * parser/Lexer.cpp: Copied from kjs/lexer.cpp.
+ * parser/Lexer.h: Copied from kjs/lexer.h.
+ * parser/NodeInfo.h: Copied from kjs/NodeInfo.h.
+ * parser/Nodes.cpp: Copied from kjs/nodes.cpp.
+ * parser/Nodes.h: Copied from kjs/nodes.h.
+ * parser/Parser.cpp: Copied from kjs/Parser.cpp.
+ * parser/Parser.h: Copied from kjs/Parser.h.
+ * parser/ResultType.h: Copied from kjs/ResultType.h.
+ * parser/SourceCode.h: Copied from kjs/SourceCode.h.
+ * parser/SourceProvider.h: Copied from kjs/SourceProvider.h.
+ * parser/nodes2string.cpp: Copied from kjs/nodes2string.cpp.
+ * pcre/pcre.pri:
+ * pcre/pcre_exec.cpp:
+ * runtime/FunctionConstructor.cpp:
+ * runtime/JSActivation.h:
+ * runtime/JSFunction.h:
+ * runtime/JSGlobalData.cpp:
+ * runtime/JSGlobalObjectFunctions.cpp:
+ * runtime/JSObject.cpp:
+ (JSC::JSObject::toNumber):
+ * runtime/RegExp.cpp:
+
+2008-11-06 Adam Roben <aroben@apple.com>
+
+ Windows build fix after r38196
+
+ * JavaScriptCore.vcproj/jsc/jsc.vcproj: Added bytecompiler/ to the
+ include path.
+
+2008-11-06 Cameron Zwarich <zwarich@apple.com>
+
+ Rubber-stamped by Sam Weinig.
+
+ Create a new bytecompiler subdirectory of JavaScriptCore and move some
+ relevant files to it.
+
+ * AllInOneFile.cpp:
+ * GNUmakefile.am:
+ * JavaScriptCore.pri:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * JavaScriptCoreSources.bkl:
+ * VM/CodeGenerator.cpp: Removed.
+ * VM/CodeGenerator.h: Removed.
+ * bytecompiler: Added.
+ * bytecompiler/CodeGenerator.cpp: Copied from VM/CodeGenerator.cpp.
+ * bytecompiler/CodeGenerator.h: Copied from VM/CodeGenerator.h.
+ * bytecompiler/LabelScope.h: Copied from kjs/LabelScope.h.
+ * jscore.bkl:
+ * kjs/LabelScope.h: Removed.
+
+2008-11-06 Adam Roben <aroben@apple.com>
+
+ Windows clean build fix after r38155
+
+ Rubberstamped by Cameron Zwarich.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Update
+ the post-build event for the move of create_hash_table out of kjs/.
+
+2008-11-06 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=22107
+
+ Bug uncovered during RVCT port in functions not used. get_lt() and
+ get_gt() takes only one argument - remove second argument where
+ applicable.
+
+ * wtf/AVLTree.h:
+ (JSC::AVLTree::remove): Remove second argument of get_lt/get_gt().
+ (JSC::AVLTree::subst): Ditto.
+
+2008-11-06 Alp Toker <alp@nuanti.com>
+
+ Reviewed by Cameron Zwarich.
+
+ https://bugs.webkit.org/show_bug.cgi?id=22033
+ [GTK] CTI/Linux r38064 crashes; JIT requires executable memory
+
+ Mark pages allocated by the FastMalloc mmap code path executable with
+ PROT_EXEC. This fixes crashes seen on CPUs and kernels that enforce
+ non-executable memory (like ExecShield on Fedora Linux) when the JIT
+ is enabled.
+
+ This patch does not resolve the issue on debug builds so affected
+ developers may still need to pass --disable-jit to configure.
+
+ * wtf/TCSystemAlloc.cpp:
+ (TryMmap):
+ (TryDevMem):
+ (TCMalloc_SystemRelease):
+
+2008-11-06 Peter Gal <galpeter@inf.u-szeged.hu>
+
+ Reviewed by Cameron Zwarich.
+
+ Bug 22099: Make the Qt port build the JSC shell in the correct place
+ <https://bugs.webkit.org/show_bug.cgi?id=22099>
+
+ Adjust include paths and build destination dir for the 'jsc' executable
+ in the Qt build.
+
+ * jsc.pro:
+
+2008-11-06 Kristian Amlie <kristian.amlie@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Implemented the block allocation on Symbian through heap allocation.
+
+ Unfortunately there is no way to allocate virtual memory. The Posix
+ layer provides mmap() but no anonymous mapping. So this is a very slow
+ solution but it should work as a start.
+
+ * runtime/Collector.cpp:
+ (JSC::allocateBlock):
+ (JSC::freeBlock):
+
+2008-11-06 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Borrow some math functions from the MSVC port to the build with the
+ RVCT compiler.
+
+ * wtf/MathExtras.h:
+ (isinf):
+ (isnan):
+ (signbit):
+
+2008-11-06 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Include strings.h for strncasecmp().
+ This is needed for compilation inside Symbian and it is also
+ confirmed by the man-page on Linux.
+
+ * runtime/DateMath.cpp:
+
+2008-11-06 Norbert Leser <norbert.leser@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Implemented currentThreadStackBase for Symbian.
+
+ * runtime/Collector.cpp:
+ (JSC::currentThreadStackBase):
+
+2008-11-06 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ RVCT does not support tm_gmtoff field, so disable that code just like
+ for MSVC.
+
+ * runtime/DateMath.h:
+ (JSC::GregorianDateTime::GregorianDateTime):
+ (JSC::GregorianDateTime::operator tm):
+
+2008-11-06 Kristian Amlie <kristian.amlie@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Define PLATFORM(UNIX) for S60. Effectively WebKit on S60 is compiled
+ on top of the Posix layer.
+
+ * wtf/Platform.h:
+
+2008-11-06 Norbert Leser <norbert.leser@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Added __SYMBIAN32__ condition for defining PLATFORM(SYMBIAN).
+
+ * wtf/Platform.h:
+
+2008-11-06 Ariya Hidayat <ariya.hidayat@trolltech.com>
+
+ Reviewed by Simon Hausmann.
+
+ Added WINSCW compiler define for Symbian S60.
+
+ * wtf/Platform.h:
+
+2008-11-06 Kristian Amlie <kristian.amlie@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Use the GCC defines of the WTF_ALIGN* macros for the RVCT and the
+ MINSCW compiler.
+
+ * wtf/Vector.h:
+
+2008-11-06 Kristian Amlie <kristian.amlie@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Define capabilities of the SYMBIAN platform. Some of the system
+ headers are actually dependent on RVCT.
+
+ * wtf/Platform.h:
+
+2008-11-06 Kristian Amlie <kristian.amlie@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Add missing stddef.h header needed for compilation in Symbian.
+
+ * runtime/Collector.h:
+
+2008-11-06 Kristian Amlie <kristian.amlie@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Added COMPILER(RVCT) to detect the ARM RVCT compiler used in the Symbian environment.
+
+ * wtf/Platform.h:
+
+2008-11-06 Simon Hausmann <hausmann@webkit.org>
+
+ Fix the Qt build, adjust include paths after move of jsc.pro.
+
+ * jsc.pro:
+
+2008-11-06 Cameron Zwarich <zwarich@apple.com>
+
+ Rubber-stamped by Sam Weinig.
+
+ Move kjs/Shell.cpp to the top level of the JavaScriptCore directory and
+ rename it to jsc.cpp to reflect the name of the binary compiled from it.
+
+ * GNUmakefile.am:
+ * JavaScriptCore.vcproj/jsc/jsc.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * jsc.cpp: Copied from kjs/Shell.cpp.
+ * jsc.pro:
+ * jscore.bkl:
+ * kjs/Shell.cpp: Removed.
+
+2008-11-06 Cameron Zwarich <zwarich@apple.com>
+
+ Rubber-stamped by Sam Weinig.
+
+ Move create_hash_table and jsc.pro out of the kjs directory and into the
+ root directory of JavaScriptCore.
+
+ * DerivedSources.make:
+ * JavaScriptCore.pri:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * create_hash_table: Copied from kjs/create_hash_table.
+ * jsc.pro: Copied from kjs/jsc.pro.
+ * kjs/create_hash_table: Removed.
+ * kjs/jsc.pro: Removed.
+ * make-generated-sources.sh:
+
+2008-11-05 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ https://bugs.webkit.org/show_bug.cgi?id=22094
+
+ Fix for bug where the callee incorrectly recieves the caller's lexical
+ global object as this, rather than its own. Implementation closely
+ follows the spec, passing jsNull, checking in the callee and replacing
+ with the global object where necessary.
+
+ * VM/CTI.cpp:
+ (JSC::CTI::compileOpCall):
+ * VM/Machine.cpp:
+ (JSC::Machine::cti_op_call_NotJSFunction):
+ (JSC::Machine::cti_op_call_eval):
+ * runtime/JSCell.h:
+ (JSC::JSValue::toThisObject):
+ * runtime/JSImmediate.cpp:
+ (JSC::JSImmediate::toThisObject):
+ * runtime/JSImmediate.h:
+
+2008-11-05 Kevin Ollivier <kevino@theolliviers.com>
+
+ wx build fix after Operations.cpp move.
+
+ * JavaScriptCoreSources.bkl:
+
+2008-11-05 Cameron Zwarich <zwarich@apple.com>
+
+ Not reviewed.
+
+ Fix the build for case-sensitive build systems and wxWindows.
+
+ * JavaScriptCoreSources.bkl:
+ * kjs/create_hash_table:
+
+2008-11-05 Cameron Zwarich <zwarich@apple.com>
+
+ Not reviewed.
+
+ Fix the build for case-sensitive build systems.
+
+ * JavaScriptCoreSources.bkl:
+ * kjs/Shell.cpp:
+ * runtime/Interpreter.cpp:
+ * runtime/JSArray.cpp:
+
+2008-11-05 Cameron Zwarich <zwarich@apple.com>
+
+ Not reviewed.
+
+ Fix the build for case-sensitive build systems.
+
+ * API/JSBase.cpp:
+ * API/JSObjectRef.cpp:
+ * runtime/CommonIdentifiers.h:
+ * runtime/Identifier.cpp:
+ * runtime/InitializeThreading.cpp:
+ * runtime/InternalFunction.h:
+ * runtime/JSString.h:
+ * runtime/Lookup.h:
+ * runtime/PropertyNameArray.h:
+ * runtime/PropertySlot.h:
+ * runtime/StructureID.cpp:
+ * runtime/StructureID.h:
+ * runtime/UString.cpp:
+
+2008-11-05 Cameron Zwarich <zwarich@apple.com>
+
+ Rubber-stamped by Sam Weinig.
+
+ Move more files to the runtime subdirectory of JavaScriptCore.
+
+ * API/APICast.h:
+ * API/JSBase.cpp:
+ * API/JSCallbackObject.cpp:
+ * API/JSClassRef.cpp:
+ * API/JSClassRef.h:
+ * API/JSStringRefCF.cpp:
+ * API/JSValueRef.cpp:
+ * API/OpaqueJSString.cpp:
+ * API/OpaqueJSString.h:
+ * AllInOneFile.cpp:
+ * GNUmakefile.am:
+ * JavaScriptCore.pri:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * JavaScriptCoreSources.bkl:
+ * VM/CodeBlock.h:
+ * VM/CodeGenerator.cpp:
+ * VM/Machine.cpp:
+ * VM/RegisterFile.h:
+ * debugger/Debugger.h:
+ * kjs/SourceProvider.h:
+ * kjs/TypeInfo.h: Removed.
+ * kjs/collector.cpp: Removed.
+ * kjs/collector.h: Removed.
+ * kjs/completion.h: Removed.
+ * kjs/create_hash_table:
+ * kjs/identifier.cpp: Removed.
+ * kjs/identifier.h: Removed.
+ * kjs/interpreter.cpp: Removed.
+ * kjs/interpreter.h: Removed.
+ * kjs/lexer.cpp:
+ * kjs/lexer.h:
+ * kjs/lookup.cpp: Removed.
+ * kjs/lookup.h: Removed.
+ * kjs/nodes.cpp:
+ * kjs/nodes.h:
+ * kjs/operations.cpp: Removed.
+ * kjs/operations.h: Removed.
+ * kjs/protect.h: Removed.
+ * kjs/regexp.cpp: Removed.
+ * kjs/regexp.h: Removed.
+ * kjs/ustring.cpp: Removed.
+ * kjs/ustring.h: Removed.
+ * pcre/pcre_exec.cpp:
+ * profiler/CallIdentifier.h:
+ * profiler/Profile.h:
+ * runtime/ArrayConstructor.cpp:
+ * runtime/ArrayPrototype.cpp:
+ * runtime/ArrayPrototype.h:
+ * runtime/Collector.cpp: Copied from kjs/collector.cpp.
+ * runtime/Collector.h: Copied from kjs/collector.h.
+ * runtime/CollectorHeapIterator.h:
+ * runtime/Completion.h: Copied from kjs/completion.h.
+ * runtime/ErrorPrototype.cpp:
+ * runtime/Identifier.cpp: Copied from kjs/identifier.cpp.
+ * runtime/Identifier.h: Copied from kjs/identifier.h.
+ * runtime/InitializeThreading.cpp:
+ * runtime/Interpreter.cpp: Copied from kjs/interpreter.cpp.
+ * runtime/Interpreter.h: Copied from kjs/interpreter.h.
+ * runtime/JSCell.h:
+ * runtime/JSGlobalData.cpp:
+ * runtime/JSGlobalData.h:
+ * runtime/JSLock.cpp:
+ * runtime/JSNumberCell.cpp:
+ * runtime/JSNumberCell.h:
+ * runtime/JSObject.cpp:
+ * runtime/JSValue.h:
+ * runtime/Lookup.cpp: Copied from kjs/lookup.cpp.
+ * runtime/Lookup.h: Copied from kjs/lookup.h.
+ * runtime/MathObject.cpp:
+ * runtime/NativeErrorPrototype.cpp:
+ * runtime/NumberPrototype.cpp:
+ * runtime/Operations.cpp: Copied from kjs/operations.cpp.
+ * runtime/Operations.h: Copied from kjs/operations.h.
+ * runtime/PropertyMapHashTable.h:
+ * runtime/Protect.h: Copied from kjs/protect.h.
+ * runtime/RegExp.cpp: Copied from kjs/regexp.cpp.
+ * runtime/RegExp.h: Copied from kjs/regexp.h.
+ * runtime/RegExpConstructor.cpp:
+ * runtime/RegExpObject.h:
+ * runtime/RegExpPrototype.cpp:
+ * runtime/SmallStrings.h:
+ * runtime/StringObjectThatMasqueradesAsUndefined.h:
+ * runtime/StructureID.cpp:
+ * runtime/StructureID.h:
+ * runtime/StructureIDTransitionTable.h:
+ * runtime/SymbolTable.h:
+ * runtime/TypeInfo.h: Copied from kjs/TypeInfo.h.
+ * runtime/UString.cpp: Copied from kjs/ustring.cpp.
+ * runtime/UString.h: Copied from kjs/ustring.h.
+ * wrec/CharacterClassConstructor.h:
+ * wrec/WREC.h:
+
+2008-11-05 Geoffrey Garen <ggaren@apple.com>
+
+ Suggested by Darin Adler.
+
+ Removed two copy constructors that the compiler can generate for us
+ automatically.
+
+ * VM/LabelID.h:
+ (JSC::LabelID::setLocation):
+ (JSC::LabelID::offsetFrom):
+ (JSC::LabelID::ref):
+ (JSC::LabelID::refCount):
+ * kjs/LabelScope.h:
+
+2008-11-05 Anders Carlsson <andersca@apple.com>
+
+ Fix Snow Leopard build.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2008-11-04 Cameron Zwarich <zwarich@apple.com>
+
+ Rubber-stamped by Steve Falkenburg.
+
+ Move dtoa.cpp and dtoa.h to the WTF Visual Studio project to reflect
+ their movement in the filesystem.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+
+2008-11-04 Cameron Zwarich <zwarich@apple.com>
+
+ Rubber-stamped by Sam Weinig.
+
+ Move kjs/dtoa.h to the wtf subdirectory of JavaScriptCore.
+
+ * AllInOneFile.cpp:
+ * GNUmakefile.am:
+ * JavaScriptCore.pri:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * JavaScriptCoreSources.bkl:
+ * kjs/dtoa.cpp: Removed.
+ * kjs/dtoa.h: Removed.
+ * wtf/dtoa.cpp: Copied from kjs/dtoa.cpp.
+ * wtf/dtoa.h: Copied from kjs/dtoa.h.
+
+2008-11-04 Cameron Zwarich <zwarich@apple.com>
+
+ Rubber-stamped by Sam Weinig.
+
+ Move kjs/config.h to the top level of JavaScriptCore.
+
+ * GNUmakefile.am:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * config.h: Copied from kjs/config.h.
+ * kjs/config.h: Removed.
+
+2008-11-04 Darin Adler <darin@apple.com>
+
+ Reviewed by Tim Hatcher.
+
+ * wtf/ThreadingNone.cpp: Tweak formatting.
+
+2008-11-03 Darin Adler <darin@apple.com>
+
+ Reviewed by Tim Hatcher.
+
+ - https://bugs.webkit.org/show_bug.cgi?id=22061
+ create script to check for exit-time destructors
+
+ * JavaScriptCore.exp: Changed to export functions rather than
+ a global for the atomically initialized static mutex.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj: Added a script
+ phase that runs the check-for-exit-time-destructors script.
+
+ * wtf/MainThread.cpp:
+ (WTF::mainThreadFunctionQueueMutex): Changed to leak an object
+ rather than using an exit time destructor.
+ (WTF::functionQueue): Ditto.
+ * wtf/unicode/icu/CollatorICU.cpp:
+ (WTF::cachedCollatorMutex): Ditto.
+
+ * wtf/Threading.h: Changed other platforms to share the Windows
+ approach where the mutex is internal and the functions are exported.
+ * wtf/ThreadingGtk.cpp:
+ (WTF::lockAtomicallyInitializedStaticMutex): Ditto.
+ (WTF::unlockAtomicallyInitializedStaticMutex): Ditto.
+ * wtf/ThreadingNone.cpp:
+ (WTF::lockAtomicallyInitializedStaticMutex): Ditto.
+ (WTF::unlockAtomicallyInitializedStaticMutex): Ditto.
+ * wtf/ThreadingPthreads.cpp:
+ (WTF::threadMapMutex): Changed to leak an object rather than using
+ an exit time destructor.
+ (WTF::lockAtomicallyInitializedStaticMutex): Mutex change.
+ (WTF::unlockAtomicallyInitializedStaticMutex): Ditto.
+ (WTF::threadMap): Changed to leak an object rather than using
+ an exit time destructor.
+ * wtf/ThreadingQt.cpp:
+ (WTF::lockAtomicallyInitializedStaticMutex): Mutex change.
+ (WTF::unlockAtomicallyInitializedStaticMutex): Ditto.
+ * wtf/ThreadingWin.cpp:
+ (WTF::lockAtomicallyInitializedStaticMutex): Added an assertion.
+
+2008-11-04 Adam Roben <aroben@apple.com>
+
+ Windows build fix
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Update
+ the location of JSStaticScopeObject.{cpp,h}.
+
+2008-11-04 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Move AllInOneFile.cpp to the top level of JavaScriptCore.
+
+ * AllInOneFile.cpp: Copied from kjs/AllInOneFile.cpp.
+ * GNUmakefile.am:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * kjs/AllInOneFile.cpp: Removed.
+
+2008-11-04 Cameron Zwarich <zwarich@apple.com>
+
+ Rubber-stamped by Alexey Proskuryakov.
+
+ Add NodeInfo.h to the JavaScriptCore Xcode project.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2008-11-03 Cameron Zwarich <zwarich@apple.com>
+
+ Rubber-stamped by Maciej Stachowiak.
+
+ Move more files into the runtime subdirectory of JavaScriptCore.
+
+ * API/JSBase.cpp:
+ * API/JSCallbackConstructor.cpp:
+ * API/JSCallbackFunction.cpp:
+ * API/JSClassRef.cpp:
+ * API/OpaqueJSString.cpp:
+ * GNUmakefile.am:
+ * JavaScriptCore.pri:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * JavaScriptCoreSources.bkl:
+ * kjs/AllInOneFile.cpp:
+ * kjs/ArgList.cpp: Removed.
+ * kjs/ArgList.h: Removed.
+ * kjs/Arguments.cpp: Removed.
+ * kjs/Arguments.h: Removed.
+ * kjs/BatchedTransitionOptimizer.h: Removed.
+ * kjs/CollectorHeapIterator.h: Removed.
+ * kjs/CommonIdentifiers.cpp: Removed.
+ * kjs/CommonIdentifiers.h: Removed.
+ * kjs/ExecState.cpp: Removed.
+ * kjs/ExecState.h: Removed.
+ * kjs/GetterSetter.cpp: Removed.
+ * kjs/GetterSetter.h: Removed.
+ * kjs/InitializeThreading.cpp: Removed.
+ * kjs/InitializeThreading.h: Removed.
+ * kjs/JSActivation.cpp: Removed.
+ * kjs/JSActivation.h: Removed.
+ * kjs/JSGlobalData.cpp: Removed.
+ * kjs/JSGlobalData.h: Removed.
+ * kjs/JSLock.cpp: Removed.
+ * kjs/JSLock.h: Removed.
+ * kjs/JSStaticScopeObject.cpp: Removed.
+ * kjs/JSStaticScopeObject.h: Removed.
+ * kjs/JSType.h: Removed.
+ * kjs/PropertyNameArray.cpp: Removed.
+ * kjs/PropertyNameArray.h: Removed.
+ * kjs/ScopeChain.cpp: Removed.
+ * kjs/ScopeChain.h: Removed.
+ * kjs/ScopeChainMark.h: Removed.
+ * kjs/SymbolTable.h: Removed.
+ * kjs/Tracing.d: Removed.
+ * kjs/Tracing.h: Removed.
+ * runtime/ArgList.cpp: Copied from kjs/ArgList.cpp.
+ * runtime/ArgList.h: Copied from kjs/ArgList.h.
+ * runtime/Arguments.cpp: Copied from kjs/Arguments.cpp.
+ * runtime/Arguments.h: Copied from kjs/Arguments.h.
+ * runtime/BatchedTransitionOptimizer.h: Copied from kjs/BatchedTransitionOptimizer.h.
+ * runtime/CollectorHeapIterator.h: Copied from kjs/CollectorHeapIterator.h.
+ * runtime/CommonIdentifiers.cpp: Copied from kjs/CommonIdentifiers.cpp.
+ * runtime/CommonIdentifiers.h: Copied from kjs/CommonIdentifiers.h.
+ * runtime/ExecState.cpp: Copied from kjs/ExecState.cpp.
+ * runtime/ExecState.h: Copied from kjs/ExecState.h.
+ * runtime/GetterSetter.cpp: Copied from kjs/GetterSetter.cpp.
+ * runtime/GetterSetter.h: Copied from kjs/GetterSetter.h.
+ * runtime/InitializeThreading.cpp: Copied from kjs/InitializeThreading.cpp.
+ * runtime/InitializeThreading.h: Copied from kjs/InitializeThreading.h.
+ * runtime/JSActivation.cpp: Copied from kjs/JSActivation.cpp.
+ * runtime/JSActivation.h: Copied from kjs/JSActivation.h.
+ * runtime/JSGlobalData.cpp: Copied from kjs/JSGlobalData.cpp.
+ * runtime/JSGlobalData.h: Copied from kjs/JSGlobalData.h.
+ * runtime/JSLock.cpp: Copied from kjs/JSLock.cpp.
+ * runtime/JSLock.h: Copied from kjs/JSLock.h.
+ * runtime/JSStaticScopeObject.cpp: Copied from kjs/JSStaticScopeObject.cpp.
+ * runtime/JSStaticScopeObject.h: Copied from kjs/JSStaticScopeObject.h.
+ * runtime/JSType.h: Copied from kjs/JSType.h.
+ * runtime/PropertyNameArray.cpp: Copied from kjs/PropertyNameArray.cpp.
+ * runtime/PropertyNameArray.h: Copied from kjs/PropertyNameArray.h.
+ * runtime/ScopeChain.cpp: Copied from kjs/ScopeChain.cpp.
+ * runtime/ScopeChain.h: Copied from kjs/ScopeChain.h.
+ * runtime/ScopeChainMark.h: Copied from kjs/ScopeChainMark.h.
+ * runtime/SymbolTable.h: Copied from kjs/SymbolTable.h.
+ * runtime/Tracing.d: Copied from kjs/Tracing.d.
+ * runtime/Tracing.h: Copied from kjs/Tracing.h.
+
+2008-11-03 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Mark Rowe.
+
+ Move #define to turn on dumping StructureID statistics to StructureID.cpp so that
+ turning it on does not require a full rebuild.
+
+ * runtime/StructureID.cpp:
+ (JSC::StructureID::dumpStatistics):
+ * runtime/StructureID.h:
+
+2008-11-03 Alp Toker <alp@nuanti.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Fix warning when building on Darwin without JSC_MULTIPLE_THREADS
+ enabled.
+
+ * kjs/InitializeThreading.cpp:
+
+2008-11-02 Matt Lilek <webkit@mattlilek.com>
+
+ Reviewed by Cameron Zwarich.
+
+ Bug 22042: REGRESSION(r38066): ASSERTION FAILED: source in CodeBlock
+ <https://bugs.webkit.org/show_bug.cgi?id=22042>
+
+ Rename parameter name to avoid ASSERT.
+
+ * VM/CodeBlock.h:
+ (JSC::CodeBlock::CodeBlock):
+ (JSC::ProgramCodeBlock::ProgramCodeBlock):
+ (JSC::EvalCodeBlock::EvalCodeBlock):
+
+2008-11-02 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 22035: Remove the '_' suffix on constructor parameter names for structs
+ <https://bugs.webkit.org/show_bug.cgi?id=22035>
+
+ * API/JSCallbackObject.h:
+ (JSC::JSCallbackObject::JSCallbackObjectData::JSCallbackObjectData):
+ * VM/CodeBlock.h:
+ (JSC::CodeBlock::CodeBlock):
+ (JSC::ProgramCodeBlock::ProgramCodeBlock):
+ (JSC::EvalCodeBlock::EvalCodeBlock):
+ * wrec/WREC.h:
+ (JSC::Quantifier::Quantifier):
+
+2008-10-31 Cameron Zwarich <zwarich@apple.com>
+
+ Rubber-stamped by Geoff Garen.
+
+ Rename SourceRange.h to SourceCode.h.
+
+ * API/JSBase.cpp:
+ * GNUmakefile.am:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * VM/CodeBlock.h:
+ * kjs/SourceCode.h: Copied from kjs/SourceRange.h.
+ * kjs/SourceRange.h: Removed.
+ * kjs/grammar.y:
+ * kjs/lexer.h:
+ * kjs/nodes.cpp:
+ (JSC::ForInNode::ForInNode):
+ * kjs/nodes.h:
+ (JSC::ThrowableExpressionData::setExceptionSourceCode):
+
+2008-10-31 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Bug 22019: Move JSC::Interpreter::shouldPrintExceptions() to WebCore::Console
+ <https://bugs.webkit.org/show_bug.cgi?id=22019>
+
+ The JSC::Interpreter::shouldPrintExceptions() function is not used at
+ all in JavaScriptCore, so it should be moved to WebCore::Console, its
+ only user.
+
+ * JavaScriptCore.exp:
+ * kjs/interpreter.cpp:
+ * kjs/interpreter.h:
+
+2008-10-31 Cameron Zwarich <zwarich@apple.com>
+
+ Not reviewed.
+
+ Windows build fix.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+
+2008-10-31 Cameron Zwarich <zwarich@apple.com>
+
+ Rubber-stamped by Sam Weinig.
+
+ Remove the call to Interpreter::setShouldPrintExceptions() from the
+ GlobalObject constructor in the shell. The shouldPrintExceptions()
+ information is not used anywhere in JavaScriptCore, only in WebCore.
+
+ * kjs/Shell.cpp:
+ (GlobalObject::GlobalObject):
+
+2008-10-31 Kevin Ollivier <kevino@theolliviers.com>
+
+ wxMSW build fix.
+
+ * wtf/Threading.h:
+
+2008-10-31 Cameron Zwarich <zwarich@apple.com>
+
+ Rubber-stamped by Sam Weinig.
+
+ Move more files from the kjs subdirectory of JavaScriptCore to the
+ runtime subdirectory.
+
+ * GNUmakefile.am:
+ * JavaScriptCore.pri:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * JavaScriptCoreSources.bkl:
+ * kjs/AllInOneFile.cpp:
+ * kjs/RegExpConstructor.cpp: Removed.
+ * kjs/RegExpConstructor.h: Removed.
+ * kjs/RegExpMatchesArray.h: Removed.
+ * kjs/RegExpObject.cpp: Removed.
+ * kjs/RegExpObject.h: Removed.
+ * kjs/RegExpPrototype.cpp: Removed.
+ * kjs/RegExpPrototype.h: Removed.
+ * runtime/RegExpConstructor.cpp: Copied from kjs/RegExpConstructor.cpp.
+ * runtime/RegExpConstructor.h: Copied from kjs/RegExpConstructor.h.
+ * runtime/RegExpMatchesArray.h: Copied from kjs/RegExpMatchesArray.h.
+ * runtime/RegExpObject.cpp: Copied from kjs/RegExpObject.cpp.
+ * runtime/RegExpObject.h: Copied from kjs/RegExpObject.h.
+ * runtime/RegExpPrototype.cpp: Copied from kjs/RegExpPrototype.cpp.
+ * runtime/RegExpPrototype.h: Copied from kjs/RegExpPrototype.h.
+
+2008-10-31 Mark Rowe <mrowe@apple.com>
+
+ Revert an incorrect portion of r38034.
+
+ * profiler/ProfilerServer.mm:
+
+2008-10-31 Mark Rowe <mrowe@apple.com>
+
+ Fix the 64-bit build.
+
+ Disable strict aliasing in ProfilerServer.mm as it leads to the compiler being unhappy
+ with the common Obj-C idiom self = [super init];
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2008-10-31 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Change a header guard to match our coding style.
+
+ * kjs/InitializeThreading.h:
+
+2008-10-30 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Fixed a small bit of https://bugs.webkit.org/show_bug.cgi?id=21962
+ AST uses way too much memory
+
+ Removed a word from StatementNode by nixing LabelStack and turning it
+ into a compile-time data structure managed by CodeGenerator.
+
+ v8 tests and SunSpider, run by Gavin, report no change.
+
+ * GNUmakefile.am:
+ * JavaScriptCore.order:
+ * JavaScriptCore.pri:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * kjs/AllInOneFile.cpp:
+ * JavaScriptCoreSources.bkl: I sure hope this builds!
+
+ * VM/CodeGenerator.cpp:
+ (JSC::CodeGenerator::CodeGenerator):
+ (JSC::CodeGenerator::newLabelScope):
+ (JSC::CodeGenerator::breakTarget):
+ (JSC::CodeGenerator::continueTarget):
+ * VM/CodeGenerator.h: Nixed the JumpContext system because it depended
+ on a LabelStack in the AST, and it was a little cumbersome on the client
+ side. Replaced with LabelScope, which tracks all break / continue
+ information in the CodeGenerator, just like we track LabelIDs and other
+ stacks of compile-time data.
+
+ * kjs/LabelScope.h: Added.
+ (JSC::LabelScope::):
+ (JSC::LabelScope::LabelScope):
+ (JSC::LabelScope::ref):
+ (JSC::LabelScope::deref):
+ (JSC::LabelScope::refCount):
+ (JSC::LabelScope::breakTarget):
+ (JSC::LabelScope::continueTarget):
+ (JSC::LabelScope::type):
+ (JSC::LabelScope::name):
+ (JSC::LabelScope::scopeDepth): Simple abstraction for holding everything
+ you might want to know about a break-able / continue-able scope.
+
+ * kjs/LabelStack.cpp: Removed.
+ * kjs/LabelStack.h: Removed.
+
+ * kjs/grammar.y: No need to push labels at parse time -- we don't store
+ LabelStacks in the AST anymore.
+
+ * kjs/nodes.cpp:
+ (JSC::DoWhileNode::emitCode):
+ (JSC::WhileNode::emitCode):
+ (JSC::ForNode::emitCode):
+ (JSC::ForInNode::emitCode):
+ (JSC::ContinueNode::emitCode):
+ (JSC::BreakNode::emitCode):
+ (JSC::SwitchNode::emitCode):
+ (JSC::LabelNode::emitCode):
+ * kjs/nodes.h:
+ (JSC::StatementNode::):
+ (JSC::LabelNode::): Use LabelScope where we used to use JumpContext.
+ Simplified a bunch of code. Touched up label-related error messages a
+ bit.
+
+ * kjs/nodes2string.cpp:
+ (JSC::LabelNode::streamTo): Updated for rename.
+
+2008-10-31 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Bug 22005: Move StructureIDChain into its own file
+ <https://bugs.webkit.org/show_bug.cgi?id=22005>
+
+ * GNUmakefile.am:
+ * JavaScriptCore.pri:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * JavaScriptCoreSources.bkl:
+ * runtime/StructureID.cpp:
+ * runtime/StructureID.h:
+ * runtime/StructureIDChain.cpp: Copied from runtime/StructureID.cpp.
+ * runtime/StructureIDChain.h: Copied from runtime/StructureID.h.
+
+2008-10-31 Steve Falkenburg <sfalken@apple.com>
+
+ Build fix.
+
+ * JavaScriptCore.vcproj/jsc/jsc.vcproj:
+
+2008-10-31 Steve Falkenburg <sfalken@apple.com>
+
+ Build fix.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+
+2008-10-31 Darin Adler <darin@apple.com>
+
+ Reviewed by Dan Bernstein.
+
+ - fix storage leak seen on buildbot
+
+ Some other cleanup too. The storage leak was caused by the fact
+ that HashTraits<CallIdentifier>::needsDestruction was false, so
+ the call identifier objects didn't get deleted.
+
+ * profiler/CallIdentifier.h:
+
+ Added a default constructor to create empty call identifiers.
+
+ Changed the normal constructor to use const UString&
+ to avoid extra copying and reference count thrash.
+
+ Removed the explicit copy constructor definition, since it's what
+ the compiler will automatically generate. (Rule of thumb: Either
+ you need both a custom copy constructor and a custom assignment
+ operator, or neither.)
+
+ Moved the CallIdentifier hash function out of the WTF namespace;
+ there's no reason to put it there.
+
+ Changed the CallIdentifier hash function to be a struct rather than
+ a specialization of the IntHash struct template. Having it be
+ a specialization made no sense, since CallIdentifier is not an integer,
+ and did no good.
+
+ Removed explicit definition of emptyValueIsZero in the hash traits,
+ since inheriting from GenericHashTraits already makes that false.
+
+ Removed explicit definition of emptyValue, instead relying on the
+ default constructor and GenericHashTraits.
+
+ Removed explicit definition of needsDestruction, because we want it
+ to have its default value: true, not false. This fixes the leak!
+
+ Changed constructDeletedValue and isDeletedValue to use a line number
+ of numeric_limits<unsigned>::max() to indicate a value is deleted.
+ Previously this used empty strings for the empty value and null strings
+ for the deleted value, but it's more efficient to use null for both.
+
+2008-10-31 Timothy Hatcher <timothy@apple.com>
+
+ Emit the WillExecuteStatement debugger hook before the for loop body
+ when the statement node for the body isn't a block. This allows
+ breakpoints on those statements in the Web Inspector.
+
+ https://bugs.webkit.org/show_bug.cgi?id=22004
+
+ Reviewed by Darin Adler.
+
+ * kjs/nodes.cpp:
+ (JSC::ForNode::emitCode): Emit the WillExecuteStatement
+ debugger hook before the statement node if isn't a block.
+ Also emit the WillExecuteStatement debugger hook for the
+ loop as the first op-code.
+ (JSC::ForInNode::emitCode): Ditto.
+
+2008-10-31 Timothy Hatcher <timothy@apple.com>
+
+ Fixes console warnings about not having an autorelease pool.
+ Also fixes the build for Snow Leopard, by including individual
+ Foundation headers instead of Foundation.h.
+
+ https://bugs.webkit.org/show_bug.cgi?id=21995
+
+ Reviewed by Oliver Hunt.
+
+ * profiler/ProfilerServer.mm:
+ (-[ProfilerServer init]): Create a NSAutoreleasePool and drain it.
+
+2008-10-31 Cameron Zwarich <zwarich@apple.com>
+
+ Not reviewed.
+
+ Speculative wxWindows build fix.
+
+ * JavaScriptCoreSources.bkl:
+ * jscore.bkl:
+
+2008-10-31 Cameron Zwarich <zwarich@apple.com>
+
+ Rubber-stamped by Maciej Stachowiak.
+
+ Move VM/JSPropertyNameIterator.cpp and VM/JSPropertyNameIterator.h to
+ the runtime directory.
+
+ * GNUmakefile.am:
+ * JavaScriptCore.pri:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * JavaScriptCoreSources.bkl:
+ * VM/JSPropertyNameIterator.cpp: Removed.
+ * VM/JSPropertyNameIterator.h: Removed.
+ * runtime/JSPropertyNameIterator.cpp: Copied from VM/JSPropertyNameIterator.cpp.
+ * runtime/JSPropertyNameIterator.h: Copied from VM/JSPropertyNameIterator.h.
+
+2008-10-31 Cameron Zwarich <zwarich@apple.com>
+
+ Not reviewed.
+
+ Speculative wxWindows build fix.
+
+ * jscore.bkl:
+
+2008-10-30 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Jon Homeycutt.
+
+ Explicitly default to building for only the native architecture in debug and release builds.
+
+ * Configurations/DebugRelease.xcconfig:
+
+2008-10-30 Cameron Zwarich <zwarich@apple.com>
+
+ Rubber-stamped by Sam Weinig.
+
+ Create a debugger directory in JavaScriptCore and move the relevant
+ files to it.
+
+ * GNUmakefile.am:
+ * JavaScriptCore.pri:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * VM/CodeBlock.cpp:
+ * VM/CodeGenerator.h:
+ * VM/Machine.cpp:
+ * debugger: Added.
+ * debugger/Debugger.cpp: Copied from kjs/debugger.cpp.
+ * debugger/Debugger.h: Copied from kjs/debugger.h.
+ * debugger/DebuggerCallFrame.cpp: Copied from kjs/DebuggerCallFrame.cpp.
+ * debugger/DebuggerCallFrame.h: Copied from kjs/DebuggerCallFrame.h.
+ * kjs/AllInOneFile.cpp:
+ * kjs/DebuggerCallFrame.cpp: Removed.
+ * kjs/DebuggerCallFrame.h: Removed.
+ * kjs/Parser.cpp:
+ * kjs/Parser.h:
+ * kjs/debugger.cpp: Removed.
+ * kjs/debugger.h: Removed.
+ * kjs/interpreter.cpp:
+ * kjs/nodes.cpp:
+ * runtime/FunctionConstructor.cpp:
+ * runtime/JSGlobalObject.cpp:
+
+2008-10-30 Benjamin K. Stuhl <bks24@cornell.edu>
+
+ gcc 4.3.3/linux-x86 generates "suggest parentheses around && within ||"
+ warnings; add some parentheses to disambiguate things. No functional
+ changes, so no tests.
+
+ https://bugs.webkit.org/show_bug.cgi?id=21973
+ Add parentheses to clean up some gcc warnings
+
+ Reviewed by Dan Bernstein.
+
+ * wtf/ASCIICType.h:
+ (WTF::isASCIIAlphanumeric):
+ (WTF::isASCIIHexDigit):
+
+2008-10-30 Kevin Lindeman <klindeman@apple.com>
+
+ Adds ProfilerServer, which is a distributed notification listener
+ that allows starting and stopping the profiler remotely for use
+ in conjunction with the profiler's DTace probes.
+
+ https://bugs.webkit.org/show_bug.cgi?id=21719
+
+ Reviewed by Timothy Hatcher.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * kjs/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData): Calls startProfilerServerIfNeeded.
+ * profiler/ProfilerServer.h: Added.
+ * profiler/ProfilerServer.mm: Added.
+ (+[ProfilerServer sharedProfileServer]):
+ (-[ProfilerServer init]):
+ (-[ProfilerServer startProfiling]):
+ (-[ProfilerServer stopProfiling]):
+ (JSC::startProfilerServerIfNeeded):
+
+2008-10-30 Kevin Ollivier <kevino@theolliviers.com>
+
+ wx build fix after PropertyMap and StructureID merge.
+
+ * JavaScriptCoreSources.bkl:
+
+2008-10-30 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Mark Rowe.
+
+ Change the JavaScriptCore Xcode project to use relative paths for the
+ PCRE source files.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2008-10-30 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Cameron Zwarich and Geoffrey Garen.
+
+ Fix for https://bugs.webkit.org/show_bug.cgi?id=21989
+ Merge PropertyMap and StructureID
+
+ - Move PropertyMap code into StructureID in preparation for lazily
+ creating the map on gets.
+ - Make remove with transition explicit by adding removePropertyTransition.
+ - Make the put/remove without transition explicit.
+ - Make cache invalidation part of put/remove without transition.
+
+ 1% speedup on SunSpider; 0.5% speedup on v8 suite.
+
+ * GNUmakefile.am:
+ * JavaScriptCore.exp:
+ * JavaScriptCore.pri:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * JavaScriptCoreSources.bkl:
+ * kjs/AllInOneFile.cpp:
+ * kjs/identifier.h:
+ * runtime/JSObject.cpp:
+ (JSC::JSObject::removeDirect):
+ * runtime/JSObject.h:
+ (JSC::JSObject::putDirect):
+ * runtime/PropertyMap.cpp: Removed.
+ * runtime/PropertyMap.h: Removed.
+ * runtime/PropertyMapHashTable.h: Copied from runtime/PropertyMap.h.
+ * runtime/StructureID.cpp:
+ (JSC::StructureID::dumpStatistics):
+ (JSC::StructureID::StructureID):
+ (JSC::StructureID::~StructureID):
+ (JSC::StructureID::getEnumerablePropertyNames):
+ (JSC::StructureID::addPropertyTransition):
+ (JSC::StructureID::removePropertyTransition):
+ (JSC::StructureID::toDictionaryTransition):
+ (JSC::StructureID::changePrototypeTransition):
+ (JSC::StructureID::getterSetterTransition):
+ (JSC::StructureID::addPropertyWithoutTransition):
+ (JSC::StructureID::removePropertyWithoutTransition):
+ (JSC::PropertyMapStatisticsExitLogger::~PropertyMapStatisticsExitLogger):
+ (JSC::StructureID::checkConsistency):
+ (JSC::StructureID::copyPropertyTable):
+ (JSC::StructureID::get):
+ (JSC::StructureID::put):
+ (JSC::StructureID::remove):
+ (JSC::StructureID::insertIntoPropertyMapHashTable):
+ (JSC::StructureID::expandPropertyMapHashTable):
+ (JSC::StructureID::createPropertyMapHashTable):
+ (JSC::StructureID::rehashPropertyMapHashTable):
+ (JSC::comparePropertyMapEntryIndices):
+ (JSC::StructureID::getEnumerablePropertyNamesInternal):
+ * runtime/StructureID.h:
+ (JSC::StructureID::propertyStorageSize):
+ (JSC::StructureID::isEmpty):
+ (JSC::StructureID::get):
+
+2008-10-30 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 21987: CTI::putDoubleResultToJSNumberCellOrJSImmediate() hardcodes its result register
+ <https://bugs.webkit.org/show_bug.cgi?id=21987>
+
+ CTI::putDoubleResultToJSNumberCellOrJSImmediate() hardcodes its result
+ register as ecx, but it should be tempReg1, which is ecx at all of its
+ callsites.
+
+ * VM/CTI.cpp:
+ (JSC::CTI::putDoubleResultToJSNumberCellOrJSImmediate):
+
+2008-10-30 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Bug 21985: Opcodes should use eax as their destination register whenever possible
+ <https://bugs.webkit.org/show_bug.cgi?id=21985>
+
+ Change more opcodes to use eax as the register for their final result,
+ and change calls to emitPutResult() that pass eax to rely on the default
+ value of eax.
+
+ * VM/CTI.cpp:
+ (JSC::CTI::privateCompileMainPass):
+
+2008-10-30 Alp Toker <alp@nuanti.com>
+
+ Build fix attempt for older gcc on the trunk-mac-intel build bot
+ (error: initializer for scalar variable requires one element).
+
+ Modify the initializer syntax slightly with an additional comma.
+
+ * VM/Machine.cpp:
+ (JSC::Machine::cti_op_call_JSFunction):
+ (JSC::Machine::cti_op_construct_JSConstruct):
+ (JSC::Machine::cti_op_resolve_func):
+ (JSC::Machine::cti_op_post_inc):
+ (JSC::Machine::cti_op_resolve_with_base):
+ (JSC::Machine::cti_op_post_dec):
+
+2008-10-30 Alp Toker <alp@nuanti.com>
+
+ Reviewed by Alexey Proskuryakov.
+
+ https://bugs.webkit.org/show_bug.cgi?id=21571
+ VoidPtrPair breaks CTI on Linux
+
+ The VoidPtrPair return change made in r37457 does not work on Linux
+ since POD structs aren't passed in registers.
+
+ This patch uses a union to vectorize VoidPtrPair to a uint64_t and
+ matches Darwin/MSVC fixing CTI/WREC on Linux.
+
+ Alexey reports no measurable change in Mac performance with this fix.
+
+ * VM/Machine.cpp:
+ (JSC::Machine::cti_op_call_JSFunction):
+ (JSC::Machine::cti_op_construct_JSConstruct):
+ (JSC::Machine::cti_op_resolve_func):
+ (JSC::Machine::cti_op_post_inc):
+ (JSC::Machine::cti_op_resolve_with_base):
+ (JSC::Machine::cti_op_post_dec):
+ * VM/Machine.h:
+ (JSC::):
+
+2008-10-29 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Initial work to reduce cost of JSNumberCell allocation
+
+ This does the initial work needed to bring more of number
+ allocation into CTI code directly, rather than just falling
+ back onto the slow paths if we can't guarantee that a number
+ cell can be reused.
+
+ Initial implementation only used by op_negate to make sure
+ it all works. In a negate heavy (though not dominated) test
+ it results in a 10% win in the non-reusable cell case.
+
+ * VM/CTI.cpp:
+ (JSC::):
+ (JSC::CTI::emitAllocateNumber):
+ (JSC::CTI::emitNakedFastCall):
+ (JSC::CTI::emitArithIntToImmWithJump):
+ (JSC::CTI::privateCompileMainPass):
+ (JSC::CTI::privateCompileSlowCases):
+ * VM/CTI.h:
+ * VM/CodeBlock.cpp:
+ (JSC::CodeBlock::dump):
+ * VM/CodeGenerator.cpp:
+ (JSC::CodeGenerator::emitUnaryOp):
+ * VM/CodeGenerator.h:
+ (JSC::CodeGenerator::emitToJSNumber):
+ (JSC::CodeGenerator::emitTypeOf):
+ (JSC::CodeGenerator::emitGetPropertyNames):
+ * VM/Machine.cpp:
+ (JSC::Machine::privateExecute):
+ * VM/Machine.h:
+ * kjs/ResultType.h:
+ (JSC::ResultType::isReusableNumber):
+ (JSC::ResultType::toInt):
+ * kjs/nodes.cpp:
+ (JSC::UnaryOpNode::emitCode):
+ (JSC::BinaryOpNode::emitCode):
+ (JSC::EqualNode::emitCode):
+ * masm/X86Assembler.h:
+ (JSC::X86Assembler::):
+ (JSC::X86Assembler::negl_r):
+ (JSC::X86Assembler::xorpd_mr):
+ * runtime/JSNumberCell.h:
+ (JSC::JSNumberCell::JSNumberCell):
+
+2008-10-29 Steve Falkenburg <sfalken@apple.com>
+
+ <rdar://problem/6326563> Crash on launch
+
+ For Windows, export explicit functions rather than exporting data for atomicallyInitializedStaticMutex.
+
+ Exporting data from a DLL on Windows requires specifying __declspec(dllimport) in the header used by
+ callers, but __declspec(dllexport) when defined in the DLL implementation. By instead exporting
+ the explicit lock/unlock functions, we can avoid this.
+
+ Fixes a crash on launch, since we were previously erroneously exporting atomicallyInitializedStaticMutex as a function.
+
+ Reviewed by Darin Adler.
+
+ * wtf/Threading.h:
+ (WTF::lockAtomicallyInitializedStaticMutex):
+ (WTF::unlockAtomicallyInitializedStaticMutex):
+ * wtf/ThreadingWin.cpp:
+ (WTF::lockAtomicallyInitializedStaticMutex):
+ (WTF::unlockAtomicallyInitializedStaticMutex):
+
+2008-10-29 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Oliver Hunt.
+
+ Remove direct use of PropertyMap.
+
+ * JavaScriptCore.exp:
+ * runtime/JSObject.cpp:
+ (JSC::JSObject::mark):
+ (JSC::JSObject::put):
+ (JSC::JSObject::deleteProperty):
+ (JSC::JSObject::getPropertyAttributes):
+ (JSC::JSObject::removeDirect):
+ * runtime/JSObject.h:
+ (JSC::JSObject::getDirect):
+ (JSC::JSObject::getDirectLocation):
+ (JSC::JSObject::hasCustomProperties):
+ (JSC::JSObject::JSObject):
+ (JSC::JSObject::putDirect):
+ * runtime/PropertyMap.cpp:
+ (JSC::PropertyMap::get):
+ * runtime/PropertyMap.h:
+ (JSC::PropertyMap::isEmpty):
+ (JSC::PropertyMap::get):
+ * runtime/StructureID.cpp:
+ (JSC::StructureID::dumpStatistics):
+ * runtime/StructureID.h:
+ (JSC::StructureID::propertyStorageSize):
+ (JSC::StructureID::get):
+ (JSC::StructureID::put):
+ (JSC::StructureID::remove):
+ (JSC::StructureID::isEmpty):
+
+2008-10-29 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ Rename and move the StructureID transition table to its own file.
+
+ * GNUmakefile.am:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * runtime/StructureID.cpp:
+ (JSC::StructureID::addPropertyTransition):
+ * runtime/StructureID.h:
+ (JSC::StructureID::):
+ * runtime/StructureIDTransitionTable.h: Copied from runtime/StructureID.h.
+ (JSC::StructureIDTransitionTableHash::hash):
+ (JSC::StructureIDTransitionTableHash::equal):
+
+2008-10-29 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Cameron Zwarich.
+
+ Fix for https://bugs.webkit.org/show_bug.cgi?id=21958
+ Pack bits in StructureID to reduce the size of each StructureID by 2 words.
+
+ * runtime/PropertyMap.h:
+ (JSC::PropertyMap::propertyMapSize):
+ * runtime/StructureID.cpp:
+ (JSC::StructureID::dumpStatistics): Add additional size statistics when dumping.
+ (JSC::StructureID::StructureID):
+ * runtime/StructureID.h:
+
+2008-10-29 Kevin Ollivier <kevino@theolliviers.com>
+
+ wx build fixes after addition of runtime and ImageBuffer changes.
+
+ * JavaScriptCoreSources.bkl:
+ * jscore.bkl:
+
+2008-10-29 Timothy Hatcher <timothy@apple.com>
+
+ Emit the WillExecuteStatement debugger hook before the "else" body
+ when there is no block for the "else" body. This allows breakpoints
+ on those statements in the Web Inspector.
+
+ https://bugs.webkit.org/show_bug.cgi?id=21944
+
+ Reviewed by Maciej Stachowiak.
+
+ * kjs/nodes.cpp:
+ (JSC::IfElseNode::emitCode): Emit the WillExecuteStatement
+ debugger hook before the else node if isn't a block.
+
+2008-10-29 Alexey Proskuryakov <ap@webkit.org>
+
+ Build fix.
+
+ * JavaScriptCore.exp: Export HashTable::deleteTable().
+
+2008-10-28 Alp Toker <alp@nuanti.com>
+
+ Fix builddir != srcdir builds after kjs -> runtime breakage. Sources
+ may now be generated in both kjs/ and runtime/.
+
+ Also sort the sources list for readability.
+
+ * GNUmakefile.am:
+
+2008-10-28 Alp Toker <alp@nuanti.com>
+
+ Reviewed by Cameron Zwarich.
+
+ Build fix attempt after kjs -> runtime rename.
+
+ * GNUmakefile.am:
+
+2008-10-28 Cameron Zwarich <zwarich@apple.com>
+
+ Not reviewed.
+
+ Remove a duplicate includes directory.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+
+2008-10-28 Cameron Zwarich <zwarich@apple.com>
+
+ Not reviewed.
+
+ Attempt to fix the Windows build.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.vcproj/jsc/jsc.vcproj:
+
+2008-10-28 Dan Bernstein <mitz@apple.com>
+
+ Reviewed by Mark Rowe.
+
+ - export WTF::atomicallyInitializedStaticMutex
+
+ * JavaScriptCore.exp:
+
+2008-10-28 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ Fixed CodeBlock dumping to accurately report constant register indices.
+
+ * VM/CodeBlock.cpp:
+ (JSC::CodeBlock::dump):
+
+2008-10-28 Cameron Zwarich <zwarich@apple.com>
+
+ Not reviewed.
+
+ More Qt build fixes.
+
+ * JavaScriptCore.pri:
+
+2008-10-28 Cameron Zwarich <zwarich@apple.com>
+
+ Not reviewed.
+
+ Fix the Qt build, hopefully for real this time.
+
+ * JavaScriptCore.pri:
+
+2008-10-28 Cameron Zwarich <zwarich@apple.com>
+
+ Not reviewed.
+
+ Fix the Qt build.
+
+ * JavaScriptCore.pri:
+
+2008-10-28 Cameron Zwarich <zwarich@apple.com>
+
+ Not reviewed.
+
+ Fix the Windows build.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+
+2008-10-28 Cameron Zwarich <zwarich@apple.com>
+
+ Rubber-stamped by Sam Weinig.
+
+ Create a runtime directory in JavaScriptCore and begin moving files to
+ it. This is the first step towards removing the kjs directory and
+ placing files in more meaningful subdirectories of JavaScriptCore.
+
+ * API/JSBase.cpp:
+ * API/JSCallbackConstructor.cpp:
+ * API/JSCallbackConstructor.h:
+ * API/JSCallbackFunction.cpp:
+ * API/JSClassRef.cpp:
+ * API/JSClassRef.h:
+ * API/JSStringRefCF.cpp:
+ * API/JSValueRef.cpp:
+ * API/OpaqueJSString.cpp:
+ * DerivedSources.make:
+ * GNUmakefile.am:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * kjs/AllInOneFile.cpp:
+ * kjs/ArrayConstructor.cpp: Removed.
+ * kjs/ArrayConstructor.h: Removed.
+ * kjs/ArrayPrototype.cpp: Removed.
+ * kjs/ArrayPrototype.h: Removed.
+ * kjs/BooleanConstructor.cpp: Removed.
+ * kjs/BooleanConstructor.h: Removed.
+ * kjs/BooleanObject.cpp: Removed.
+ * kjs/BooleanObject.h: Removed.
+ * kjs/BooleanPrototype.cpp: Removed.
+ * kjs/BooleanPrototype.h: Removed.
+ * kjs/CallData.cpp: Removed.
+ * kjs/CallData.h: Removed.
+ * kjs/ClassInfo.h: Removed.
+ * kjs/ConstructData.cpp: Removed.
+ * kjs/ConstructData.h: Removed.
+ * kjs/DateConstructor.cpp: Removed.
+ * kjs/DateConstructor.h: Removed.
+ * kjs/DateInstance.cpp: Removed.
+ * kjs/DateInstance.h: Removed.
+ * kjs/DateMath.cpp: Removed.
+ * kjs/DateMath.h: Removed.
+ * kjs/DatePrototype.cpp: Removed.
+ * kjs/DatePrototype.h: Removed.
+ * kjs/Error.cpp: Removed.
+ * kjs/Error.h: Removed.
+ * kjs/ErrorConstructor.cpp: Removed.
+ * kjs/ErrorConstructor.h: Removed.
+ * kjs/ErrorInstance.cpp: Removed.
+ * kjs/ErrorInstance.h: Removed.
+ * kjs/ErrorPrototype.cpp: Removed.
+ * kjs/ErrorPrototype.h: Removed.
+ * kjs/FunctionConstructor.cpp: Removed.
+ * kjs/FunctionConstructor.h: Removed.
+ * kjs/FunctionPrototype.cpp: Removed.
+ * kjs/FunctionPrototype.h: Removed.
+ * kjs/GlobalEvalFunction.cpp: Removed.
+ * kjs/GlobalEvalFunction.h: Removed.
+ * kjs/InternalFunction.cpp: Removed.
+ * kjs/InternalFunction.h: Removed.
+ * kjs/JSArray.cpp: Removed.
+ * kjs/JSArray.h: Removed.
+ * kjs/JSCell.cpp: Removed.
+ * kjs/JSCell.h: Removed.
+ * kjs/JSFunction.cpp: Removed.
+ * kjs/JSFunction.h: Removed.
+ * kjs/JSGlobalObject.cpp: Removed.
+ * kjs/JSGlobalObject.h: Removed.
+ * kjs/JSGlobalObjectFunctions.cpp: Removed.
+ * kjs/JSGlobalObjectFunctions.h: Removed.
+ * kjs/JSImmediate.cpp: Removed.
+ * kjs/JSImmediate.h: Removed.
+ * kjs/JSNotAnObject.cpp: Removed.
+ * kjs/JSNotAnObject.h: Removed.
+ * kjs/JSNumberCell.cpp: Removed.
+ * kjs/JSNumberCell.h: Removed.
+ * kjs/JSObject.cpp: Removed.
+ * kjs/JSObject.h: Removed.
+ * kjs/JSString.cpp: Removed.
+ * kjs/JSString.h: Removed.
+ * kjs/JSValue.cpp: Removed.
+ * kjs/JSValue.h: Removed.
+ * kjs/JSVariableObject.cpp: Removed.
+ * kjs/JSVariableObject.h: Removed.
+ * kjs/JSWrapperObject.cpp: Removed.
+ * kjs/JSWrapperObject.h: Removed.
+ * kjs/MathObject.cpp: Removed.
+ * kjs/MathObject.h: Removed.
+ * kjs/NativeErrorConstructor.cpp: Removed.
+ * kjs/NativeErrorConstructor.h: Removed.
+ * kjs/NativeErrorPrototype.cpp: Removed.
+ * kjs/NativeErrorPrototype.h: Removed.
+ * kjs/NumberConstructor.cpp: Removed.
+ * kjs/NumberConstructor.h: Removed.
+ * kjs/NumberObject.cpp: Removed.
+ * kjs/NumberObject.h: Removed.
+ * kjs/NumberPrototype.cpp: Removed.
+ * kjs/NumberPrototype.h: Removed.
+ * kjs/ObjectConstructor.cpp: Removed.
+ * kjs/ObjectConstructor.h: Removed.
+ * kjs/ObjectPrototype.cpp: Removed.
+ * kjs/ObjectPrototype.h: Removed.
+ * kjs/PropertyMap.cpp: Removed.
+ * kjs/PropertyMap.h: Removed.
+ * kjs/PropertySlot.cpp: Removed.
+ * kjs/PropertySlot.h: Removed.
+ * kjs/PrototypeFunction.cpp: Removed.
+ * kjs/PrototypeFunction.h: Removed.
+ * kjs/PutPropertySlot.h: Removed.
+ * kjs/SmallStrings.cpp: Removed.
+ * kjs/SmallStrings.h: Removed.
+ * kjs/StringConstructor.cpp: Removed.
+ * kjs/StringConstructor.h: Removed.
+ * kjs/StringObject.cpp: Removed.
+ * kjs/StringObject.h: Removed.
+ * kjs/StringObjectThatMasqueradesAsUndefined.h: Removed.
+ * kjs/StringPrototype.cpp: Removed.
+ * kjs/StringPrototype.h: Removed.
+ * kjs/StructureID.cpp: Removed.
+ * kjs/StructureID.h: Removed.
+ * kjs/completion.h:
+ * kjs/interpreter.h:
+ * runtime: Added.
+ * runtime/ArrayConstructor.cpp: Copied from kjs/ArrayConstructor.cpp.
+ * runtime/ArrayConstructor.h: Copied from kjs/ArrayConstructor.h.
+ * runtime/ArrayPrototype.cpp: Copied from kjs/ArrayPrototype.cpp.
+ * runtime/ArrayPrototype.h: Copied from kjs/ArrayPrototype.h.
+ * runtime/BooleanConstructor.cpp: Copied from kjs/BooleanConstructor.cpp.
+ * runtime/BooleanConstructor.h: Copied from kjs/BooleanConstructor.h.
+ * runtime/BooleanObject.cpp: Copied from kjs/BooleanObject.cpp.
+ * runtime/BooleanObject.h: Copied from kjs/BooleanObject.h.
+ * runtime/BooleanPrototype.cpp: Copied from kjs/BooleanPrototype.cpp.
+ * runtime/BooleanPrototype.h: Copied from kjs/BooleanPrototype.h.
+ * runtime/CallData.cpp: Copied from kjs/CallData.cpp.
+ * runtime/CallData.h: Copied from kjs/CallData.h.
+ * runtime/ClassInfo.h: Copied from kjs/ClassInfo.h.
+ * runtime/ConstructData.cpp: Copied from kjs/ConstructData.cpp.
+ * runtime/ConstructData.h: Copied from kjs/ConstructData.h.
+ * runtime/DateConstructor.cpp: Copied from kjs/DateConstructor.cpp.
+ * runtime/DateConstructor.h: Copied from kjs/DateConstructor.h.
+ * runtime/DateInstance.cpp: Copied from kjs/DateInstance.cpp.
+ * runtime/DateInstance.h: Copied from kjs/DateInstance.h.
+ * runtime/DateMath.cpp: Copied from kjs/DateMath.cpp.
+ * runtime/DateMath.h: Copied from kjs/DateMath.h.
+ * runtime/DatePrototype.cpp: Copied from kjs/DatePrototype.cpp.
+ * runtime/DatePrototype.h: Copied from kjs/DatePrototype.h.
+ * runtime/Error.cpp: Copied from kjs/Error.cpp.
+ * runtime/Error.h: Copied from kjs/Error.h.
+ * runtime/ErrorConstructor.cpp: Copied from kjs/ErrorConstructor.cpp.
+ * runtime/ErrorConstructor.h: Copied from kjs/ErrorConstructor.h.
+ * runtime/ErrorInstance.cpp: Copied from kjs/ErrorInstance.cpp.
+ * runtime/ErrorInstance.h: Copied from kjs/ErrorInstance.h.
+ * runtime/ErrorPrototype.cpp: Copied from kjs/ErrorPrototype.cpp.
+ * runtime/ErrorPrototype.h: Copied from kjs/ErrorPrototype.h.
+ * runtime/FunctionConstructor.cpp: Copied from kjs/FunctionConstructor.cpp.
+ * runtime/FunctionConstructor.h: Copied from kjs/FunctionConstructor.h.
+ * runtime/FunctionPrototype.cpp: Copied from kjs/FunctionPrototype.cpp.
+ * runtime/FunctionPrototype.h: Copied from kjs/FunctionPrototype.h.
+ * runtime/GlobalEvalFunction.cpp: Copied from kjs/GlobalEvalFunction.cpp.
+ * runtime/GlobalEvalFunction.h: Copied from kjs/GlobalEvalFunction.h.
+ * runtime/InternalFunction.cpp: Copied from kjs/InternalFunction.cpp.
+ * runtime/InternalFunction.h: Copied from kjs/InternalFunction.h.
+ * runtime/JSArray.cpp: Copied from kjs/JSArray.cpp.
+ * runtime/JSArray.h: Copied from kjs/JSArray.h.
+ * runtime/JSCell.cpp: Copied from kjs/JSCell.cpp.
+ * runtime/JSCell.h: Copied from kjs/JSCell.h.
+ * runtime/JSFunction.cpp: Copied from kjs/JSFunction.cpp.
+ * runtime/JSFunction.h: Copied from kjs/JSFunction.h.
+ * runtime/JSGlobalObject.cpp: Copied from kjs/JSGlobalObject.cpp.
+ * runtime/JSGlobalObject.h: Copied from kjs/JSGlobalObject.h.
+ * runtime/JSGlobalObjectFunctions.cpp: Copied from kjs/JSGlobalObjectFunctions.cpp.
+ * runtime/JSGlobalObjectFunctions.h: Copied from kjs/JSGlobalObjectFunctions.h.
+ * runtime/JSImmediate.cpp: Copied from kjs/JSImmediate.cpp.
+ * runtime/JSImmediate.h: Copied from kjs/JSImmediate.h.
+ * runtime/JSNotAnObject.cpp: Copied from kjs/JSNotAnObject.cpp.
+ * runtime/JSNotAnObject.h: Copied from kjs/JSNotAnObject.h.
+ * runtime/JSNumberCell.cpp: Copied from kjs/JSNumberCell.cpp.
+ * runtime/JSNumberCell.h: Copied from kjs/JSNumberCell.h.
+ * runtime/JSObject.cpp: Copied from kjs/JSObject.cpp.
+ * runtime/JSObject.h: Copied from kjs/JSObject.h.
+ * runtime/JSString.cpp: Copied from kjs/JSString.cpp.
+ * runtime/JSString.h: Copied from kjs/JSString.h.
+ * runtime/JSValue.cpp: Copied from kjs/JSValue.cpp.
+ * runtime/JSValue.h: Copied from kjs/JSValue.h.
+ * runtime/JSVariableObject.cpp: Copied from kjs/JSVariableObject.cpp.
+ * runtime/JSVariableObject.h: Copied from kjs/JSVariableObject.h.
+ * runtime/JSWrapperObject.cpp: Copied from kjs/JSWrapperObject.cpp.
+ * runtime/JSWrapperObject.h: Copied from kjs/JSWrapperObject.h.
+ * runtime/MathObject.cpp: Copied from kjs/MathObject.cpp.
+ * runtime/MathObject.h: Copied from kjs/MathObject.h.
+ * runtime/NativeErrorConstructor.cpp: Copied from kjs/NativeErrorConstructor.cpp.
+ * runtime/NativeErrorConstructor.h: Copied from kjs/NativeErrorConstructor.h.
+ * runtime/NativeErrorPrototype.cpp: Copied from kjs/NativeErrorPrototype.cpp.
+ * runtime/NativeErrorPrototype.h: Copied from kjs/NativeErrorPrototype.h.
+ * runtime/NumberConstructor.cpp: Copied from kjs/NumberConstructor.cpp.
+ * runtime/NumberConstructor.h: Copied from kjs/NumberConstructor.h.
+ * runtime/NumberObject.cpp: Copied from kjs/NumberObject.cpp.
+ * runtime/NumberObject.h: Copied from kjs/NumberObject.h.
+ * runtime/NumberPrototype.cpp: Copied from kjs/NumberPrototype.cpp.
+ * runtime/NumberPrototype.h: Copied from kjs/NumberPrototype.h.
+ * runtime/ObjectConstructor.cpp: Copied from kjs/ObjectConstructor.cpp.
+ * runtime/ObjectConstructor.h: Copied from kjs/ObjectConstructor.h.
+ * runtime/ObjectPrototype.cpp: Copied from kjs/ObjectPrototype.cpp.
+ * runtime/ObjectPrototype.h: Copied from kjs/ObjectPrototype.h.
+ * runtime/PropertyMap.cpp: Copied from kjs/PropertyMap.cpp.
+ * runtime/PropertyMap.h: Copied from kjs/PropertyMap.h.
+ * runtime/PropertySlot.cpp: Copied from kjs/PropertySlot.cpp.
+ * runtime/PropertySlot.h: Copied from kjs/PropertySlot.h.
+ * runtime/PrototypeFunction.cpp: Copied from kjs/PrototypeFunction.cpp.
+ * runtime/PrototypeFunction.h: Copied from kjs/PrototypeFunction.h.
+ * runtime/PutPropertySlot.h: Copied from kjs/PutPropertySlot.h.
+ * runtime/SmallStrings.cpp: Copied from kjs/SmallStrings.cpp.
+ * runtime/SmallStrings.h: Copied from kjs/SmallStrings.h.
+ * runtime/StringConstructor.cpp: Copied from kjs/StringConstructor.cpp.
+ * runtime/StringConstructor.h: Copied from kjs/StringConstructor.h.
+ * runtime/StringObject.cpp: Copied from kjs/StringObject.cpp.
+ * runtime/StringObject.h: Copied from kjs/StringObject.h.
+ * runtime/StringObjectThatMasqueradesAsUndefined.h: Copied from kjs/StringObjectThatMasqueradesAsUndefined.h.
+ * runtime/StringPrototype.cpp: Copied from kjs/StringPrototype.cpp.
+ * runtime/StringPrototype.h: Copied from kjs/StringPrototype.h.
+ * runtime/StructureID.cpp: Copied from kjs/StructureID.cpp.
+ * runtime/StructureID.h: Copied from kjs/StructureID.h.
+
+2008-10-28 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Fixed https://bugs.webkit.org/show_bug.cgi?id=21919
+ Sampler reports bogus time in op_enter during 3d-raytrace.js
+
+ Fixed a bug where we would pass the incorrect Instruction* during some
+ parts of CTI codegen.
+
+ * VM/CTI.cpp:
+ (JSC::CTI::privateCompileMainPass):
+ (JSC::CTI::privateCompileSlowCases):
+ * VM/SamplingTool.cpp:
+ (JSC::SamplingTool::run):
+ * wtf/Platform.h:
+
+2008-10-28 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Dan Bernstein.
+
+ -Removed unused includes.
+ Apparent .4% speedup in Sunspider
+
+ * kjs/JSObject.cpp:
+ * kjs/interpreter.cpp:
+
+2008-10-28 Alp Toker <alp@nuanti.com>
+
+ Include copyright license files in the autotools dist target.
+
+ Change suggested by Mike Hommey.
+
+ * GNUmakefile.am:
+
+2008-10-27 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Stop discarding CodeBlock samples that can't be charged to a specific
+ opcode. Instead, charge the relevant CodeBlock, and provide a footnote
+ explaining the situation.
+
+ This will help us tell which CodeBlocks are hot, even if we can't
+ identify specific lines of code within the CodeBlocks.
+
+ * VM/SamplingTool.cpp:
+ (JSC::ScopeSampleRecord::sample):
+ (JSC::compareScopeSampleRecords):
+ (JSC::SamplingTool::dump):
+
+ * VM/SamplingTool.h:
+ (JSC::ScopeSampleRecord::ScopeSampleRecord):
+ (JSC::ScopeSampleRecord::~ScopeSampleRecord):
+
+2008-10-27 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Added a mutex around the SamplingTool's ScopeNode* map, to solve a crash
+ when sampling the v8 tests.
+
+ * VM/SamplingTool.cpp:
+ (JSC::SamplingTool::run):
+ (JSC::SamplingTool::notifyOfScope):
+ * VM/SamplingTool.h: Since new ScopeNodes can be created after
+ the SamplingTools has begun sampling, reads and writes to / from the
+ map need to be synchronized. Shark says this doesn't measurably increase
+ sampling overhead.
+
+2008-10-25 Geoffrey Garen <ggaren@apple.com>
+
+ Not reviewed.
+
+ Try to fix Windows build.
+
+ * VM/Machine.cpp:
+ (JSC::Machine::privateExecute): Provide a dummy value to the
+ HostCallRecord in CTI non-sampling builds, to silence compiler warning.
+
+2008-10-25 Geoffrey Garen <ggaren@apple.com>
+
+ Not reviewed.
+
+ Try to fix Windows build.
+
+ * VM/SamplingTool.h:
+ (JSC::SamplingTool::encodeSample): Explicitly cast bool to int, to
+ silence compiler warning.
+
+2008-10-25 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig, with Gavin Barraclough's help.
+
+ Fixed Sampling Tool:
+ - Made CodeBlock sampling work with CTI
+ - Improved accuracy by unifying most sampling data into a single
+ 32bit word, which can be written / read atomically.
+ - Split out three different #ifdefs for modularity: OPCODE_SAMPLING;
+ CODEBLOCK_SAMPLING; OPCODE_STATS.
+ - Improved reporting clarity
+ - Refactored for code clarity
+
+ * JavaScriptCore.exp: Exported another symbol.
+
+ * VM/CTI.cpp:
+ (JSC::CTI::emitCTICall):
+ (JSC::CTI::compileOpCall):
+ (JSC::CTI::emitSlowScriptCheck):
+ (JSC::CTI::compileBinaryArithOpSlowCase):
+ (JSC::CTI::privateCompileMainPass):
+ (JSC::CTI::privateCompileSlowCases):
+ (JSC::CTI::privateCompile):
+ * VM/CTI.h: Updated CTI codegen to use the unified SamplingTool interface
+ for encoding samples. (This required passing the current vPC to a lot
+ more functions, since the unified interface samples the current vPC.)
+ Added hooks for writing the current CodeBlock* on function entry and
+ after a function call, for the sake of the CodeBlock sampler. Removed
+ obsolete hook for clearing the current sample inside op_end. Also removed
+ the custom enum used to differentiate flavors of op_call, since the
+ OpcodeID enum works just as well. (This was important in an earlier
+ version of the patch, but now it's just cleanup.)
+
+ * VM/CodeBlock.cpp:
+ (JSC::CodeBlock::lineNumberForVPC):
+ * VM/CodeBlock.h: Upated for refactored #ifdefs. Changed lineNumberForVPC
+ to be robust against vPCs not recorded for exception handling, since
+ the Sampler may ask for an arbitrary vPC.
+
+ * VM/Machine.cpp:
+ (JSC::Machine::execute):
+ (JSC::Machine::privateExecute):
+ (JSC::Machine::cti_op_call_NotJSFunction):
+ (JSC::Machine::cti_op_construct_NotJSConstruct):
+ * VM/Machine.h:
+ (JSC::Machine::setSampler):
+ (JSC::Machine::sampler):
+ (JSC::Machine::jitCodeBuffer): Upated for refactored #ifdefs. Changed
+ Machine to use SamplingTool helper objects to record movement in and
+ out of host code. This makes samples a bit more precise.
+
+ * VM/Opcode.cpp:
+ (JSC::OpcodeStats::~OpcodeStats):
+ * VM/Opcode.h: Upated for refactored #ifdefs. Added a little more padding,
+ to accomodate our more verbose opcode names.
+
+ * VM/SamplingTool.cpp:
+ (JSC::ScopeSampleRecord::sample): Only count a sample toward our total
+ if we actually record it. This solves cases where a CodeBlock will
+ claim to have been sampled many times, with reported samples that don't
+ match.
+
+ (JSC::SamplingTool::run): Read the current sample into a Sample helper
+ object, to ensure that the data doesn't change while we're analyzing it,
+ and to help decode the data. Only access the CodeBlock sampling hash
+ table if CodeBlock sampling has been enabled, so non-CodeBlock sampling
+ runs can operate with even less overhead.
+
+ (JSC::SamplingTool::dump): I reorganized this code a lot to print the
+ most important info at the top, print as a table, annotate and document
+ the stuff I didn't understand when I started, etc.
+
+ * VM/SamplingTool.h: New helper classes, described above.
+
+ * kjs/Parser.h:
+ * kjs/Shell.cpp:
+ (runWithScripts):
+ * kjs/nodes.cpp:
+ (JSC::ScopeNode::ScopeNode): Updated for new sampling APIs.
+
+ * wtf/Platform.h: Moved sampling #defines here, since our custom is to
+ put ENABLE #defines into Platform.h. Made explicit the fact that
+ CODEBLOCK_SAMPLING depends on OPCODE_SAMPLING.
+
+2008-10-25 Jan Michael Alonzo <jmalonzo@webkit.org>
+
+ JSC Build fix, not reviewed.
+
+ * VM/CTI.cpp: add missing include stdio.h for debug builds
+
+2008-10-24 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ Get rid of a bonus ASSERT when using a null string as a regexp.
+ Specifically calling: RegularExpression::match() with String::empty()
+ will hit this ASSERT.
+ Chromium hits this, but I don't know of any way to make a layout test.
+
+ * pcre/pcre_exec.cpp:
+ (jsRegExpExecute):
+
+2008-10-24 Alexey Proskuryakov <ap@webkit.org>
+
+ Suggested and rubber-stamped by Geoff Garen.
+
+ Fix a crash when opening Font Picker.
+
+ The change also hopefully fixes this bug, which I could never reproduce:
+ https://bugs.webkit.org/show_bug.cgi?id=20241
+ <rdar://problem/6290576> Safari crashes at JSValueUnprotect() when fontpicker view close
+
+ * API/JSContextRef.cpp: (JSContextGetGlobalObject): Use lexical global object instead of
+ dynamic one.
+
+2008-10-24 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Remove ScopeChainNode::bottom() and inline it into its only caller,
+ ScopeChainnode::globalObject().
+
+ * kjs/JSGlobalObject.h:
+ (JSC::ScopeChainNode::globalObject):
+ * kjs/ScopeChain.h:
+ (JSC::ScopeChain::bottom):
+
+2008-10-24 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Bug 21862: Create JSFunction prototype property lazily
+ <https://bugs.webkit.org/show_bug.cgi?id=21862>
+
+ This is a 1.5% speedup on SunSpider and a 1.4% speedup on the V8
+ benchmark suite, including a 3.8% speedup on Earley-Boyer.
+
+ * kjs/JSFunction.cpp:
+ (JSC::JSFunction::getOwnPropertySlot):
+ * kjs/nodes.cpp:
+ (JSC::FuncDeclNode::makeFunction):
+ (JSC::FuncExprNode::makeFunction):
+
+2008-10-24 Greg Bolsinga <bolsinga@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ https://bugs.webkit.org/show_bug.cgi?id=21475
+
+ Provide support for the Geolocation API
+
+ http://dev.w3.org/geo/api/spec-source.html
+
+ * wtf/Platform.h: ENABLE_GEOLOCATION defaults to 0
+
+2008-10-24 Darin Adler <darin@apple.com>
+
+ - finish rolling out https://bugs.webkit.org/show_bug.cgi?id=21732
+
+ * API/APICast.h:
+ * API/JSCallbackConstructor.h:
+ * API/JSCallbackFunction.cpp:
+ * API/JSCallbackFunction.h:
+ * API/JSCallbackObject.h:
+ * API/JSCallbackObjectFunctions.h:
+ * API/JSContextRef.cpp:
+ * API/JSObjectRef.cpp:
+ * API/JSValueRef.cpp:
+ * VM/CTI.cpp:
+ * VM/CTI.h:
+ * VM/CodeBlock.cpp:
+ * VM/CodeBlock.h:
+ * VM/CodeGenerator.cpp:
+ * VM/CodeGenerator.h:
+ * VM/ExceptionHelpers.cpp:
+ * VM/ExceptionHelpers.h:
+ * VM/JSPropertyNameIterator.cpp:
+ * VM/JSPropertyNameIterator.h:
+ * VM/Machine.cpp:
+ * VM/Machine.h:
+ * VM/Register.h:
+ * kjs/ArgList.cpp:
+ * kjs/ArgList.h:
+ * kjs/Arguments.cpp:
+ * kjs/Arguments.h:
+ * kjs/ArrayConstructor.cpp:
+ * kjs/ArrayPrototype.cpp:
+ * kjs/BooleanConstructor.cpp:
+ * kjs/BooleanConstructor.h:
+ * kjs/BooleanObject.h:
+ * kjs/BooleanPrototype.cpp:
+ * kjs/CallData.cpp:
+ * kjs/CallData.h:
+ * kjs/ConstructData.cpp:
+ * kjs/ConstructData.h:
+ * kjs/DateConstructor.cpp:
+ * kjs/DateInstance.h:
+ * kjs/DatePrototype.cpp:
+ * kjs/DatePrototype.h:
+ * kjs/DebuggerCallFrame.cpp:
+ * kjs/DebuggerCallFrame.h:
+ * kjs/ErrorConstructor.cpp:
+ * kjs/ErrorPrototype.cpp:
+ * kjs/ExecState.cpp:
+ * kjs/ExecState.h:
+ * kjs/FunctionConstructor.cpp:
+ * kjs/FunctionPrototype.cpp:
+ * kjs/FunctionPrototype.h:
+ * kjs/GetterSetter.cpp:
+ * kjs/GetterSetter.h:
+ * kjs/InternalFunction.h:
+ * kjs/JSActivation.cpp:
+ * kjs/JSActivation.h:
+ * kjs/JSArray.cpp:
+ * kjs/JSArray.h:
+ * kjs/JSCell.cpp:
+ * kjs/JSCell.h:
+ * kjs/JSFunction.cpp:
+ * kjs/JSFunction.h:
+ * kjs/JSGlobalData.h:
+ * kjs/JSGlobalObject.cpp:
+ * kjs/JSGlobalObject.h:
+ * kjs/JSGlobalObjectFunctions.cpp:
+ * kjs/JSGlobalObjectFunctions.h:
+ * kjs/JSImmediate.cpp:
+ * kjs/JSImmediate.h:
+ * kjs/JSNotAnObject.cpp:
+ * kjs/JSNotAnObject.h:
+ * kjs/JSNumberCell.cpp:
+ * kjs/JSNumberCell.h:
+ * kjs/JSObject.cpp:
+ * kjs/JSObject.h:
+ * kjs/JSStaticScopeObject.cpp:
+ * kjs/JSStaticScopeObject.h:
+ * kjs/JSString.cpp:
+ * kjs/JSString.h:
+ * kjs/JSValue.h:
+ * kjs/JSVariableObject.h:
+ * kjs/JSWrapperObject.h:
+ * kjs/MathObject.cpp:
+ * kjs/MathObject.h:
+ * kjs/NativeErrorConstructor.cpp:
+ * kjs/NumberConstructor.cpp:
+ * kjs/NumberConstructor.h:
+ * kjs/NumberObject.cpp:
+ * kjs/NumberObject.h:
+ * kjs/NumberPrototype.cpp:
+ * kjs/ObjectConstructor.cpp:
+ * kjs/ObjectPrototype.cpp:
+ * kjs/ObjectPrototype.h:
+ * kjs/PropertyMap.h:
+ * kjs/PropertySlot.cpp:
+ * kjs/PropertySlot.h:
+ * kjs/RegExpConstructor.cpp:
+ * kjs/RegExpConstructor.h:
+ * kjs/RegExpMatchesArray.h:
+ * kjs/RegExpObject.cpp:
+ * kjs/RegExpObject.h:
+ * kjs/RegExpPrototype.cpp:
+ * kjs/Shell.cpp:
+ * kjs/StringConstructor.cpp:
+ * kjs/StringObject.cpp:
+ * kjs/StringObject.h:
+ * kjs/StringObjectThatMasqueradesAsUndefined.h:
+ * kjs/StringPrototype.cpp:
+ * kjs/StructureID.cpp:
+ * kjs/StructureID.h:
+ * kjs/collector.cpp:
+ * kjs/collector.h:
+ * kjs/completion.h:
+ * kjs/grammar.y:
+ * kjs/interpreter.cpp:
+ * kjs/interpreter.h:
+ * kjs/lookup.cpp:
+ * kjs/lookup.h:
+ * kjs/nodes.h:
+ * kjs/operations.cpp:
+ * kjs/operations.h:
+ * kjs/protect.h:
+ * profiler/ProfileGenerator.cpp:
+ * profiler/Profiler.cpp:
+ * profiler/Profiler.h:
+ Use JSValue* instead of JSValuePtr.
+
+2008-10-24 David Kilzer <ddkilzer@apple.com>
+
+ Rolled out r37840.
+
+ * wtf/Platform.h:
+
+2008-10-23 Greg Bolsinga <bolsinga@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ https://bugs.webkit.org/show_bug.cgi?id=21475
+
+ Provide support for the Geolocation API
+
+ http://dev.w3.org/geo/api/spec-source.html
+
+ * wtf/Platform.h: ENABLE_GEOLOCATION defaults to 0
+
+2008-10-23 David Kilzer <ddkilzer@apple.com>
+
+ Bug 21832: Fix scripts using 'new File::Temp' for Perl 5.10
+
+ <https://bugs.webkit.org/show_bug.cgi?id=21832>
+
+ Reviewed by Sam Weinig.
+
+ * pcre/dftables: Use imported tempfile() from File::Temp instead of
+ 'new File::Temp' to make the script work with Perl 5.10.
+
+2008-10-23 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Fix hideous pathological case performance when looking up repatch info, bug #21727.
+
+ When repatching JIT code to optimize we look up records providing information about
+ the generated code (also used to track recsources used in linking to be later released).
+ The lookup was being performed using a linear scan of all such records.
+
+ (1) Split up the different types of reptach information. This means we can search them
+ separately, and in some cases should reduce their size.
+ (2) In the case of property accesses, search with a binary chop over the data.
+ (3) In the case of calls, pass a pointer to the repatch info into the relink function.
+
+ * VM/CTI.cpp:
+ (JSC::CTI::CTI):
+ (JSC::CTI::compileOpCall):
+ (JSC::CTI::privateCompileMainPass):
+ (JSC::CTI::privateCompileSlowCases):
+ (JSC::CTI::privateCompile):
+ (JSC::CTI::unlinkCall):
+ (JSC::CTI::linkCall):
+ * VM/CTI.h:
+ * VM/CodeBlock.cpp:
+ (JSC::CodeBlock::dump):
+ (JSC::CodeBlock::~CodeBlock):
+ (JSC::CodeBlock::unlinkCallers):
+ (JSC::CodeBlock::derefStructureIDs):
+ * VM/CodeBlock.h:
+ (JSC::StructureStubInfo::StructureStubInfo):
+ (JSC::CallLinkInfo::CallLinkInfo):
+ (JSC::CallLinkInfo::setUnlinked):
+ (JSC::CallLinkInfo::isLinked):
+ (JSC::getStructureStubInfoReturnLocation):
+ (JSC::binaryChop):
+ (JSC::CodeBlock::addCaller):
+ (JSC::CodeBlock::getStubInfo):
+ * VM/CodeGenerator.cpp:
+ (JSC::CodeGenerator::emitResolve):
+ (JSC::CodeGenerator::emitGetById):
+ (JSC::CodeGenerator::emitPutById):
+ (JSC::CodeGenerator::emitCall):
+ (JSC::CodeGenerator::emitConstruct):
+ * VM/Machine.cpp:
+ (JSC::Machine::cti_vm_lazyLinkCall):
+
+2008-10-23 Peter Kasting <pkasting@google.com>
+
+ Reviewed by Adam Roben.
+
+ https://bugs.webkit.org/show_bug.cgi?id=21833
+ Place JavaScript Debugger hooks under #if ENABLE(JAVASCRIPT_DEBUGGER).
+
+ * wtf/Platform.h:
+
+2008-10-23 David Kilzer <ddkilzer@apple.com>
+
+ Bug 21831: Fix create_hash_table for Perl 5.10
+
+ <https://bugs.webkit.org/show_bug.cgi?id=21831>
+
+ Reviewed by Sam Weinig.
+
+ * kjs/create_hash_table: Escaped square brackets so that Perl 5.10
+ doesn't try to use @nameEntries.
+
+2008-10-23 Darin Adler <darin@apple.com>
+
+ - roll out https://bugs.webkit.org/show_bug.cgi?id=21732
+ to remove the JSValuePtr class, to fix two problems
+
+ 1) slowness under MSVC, since it doesn't handle a
+ class with a single pointer in it as efficiently
+ as a pointer
+
+ 2) uninitialized pointers in Vector
+
+ * JavaScriptCore.exp: Updated.
+
+ * API/APICast.h:
+ (toRef):
+ * VM/CTI.cpp:
+ (JSC::CTI::asInteger):
+ * VM/CodeGenerator.cpp:
+ (JSC::CodeGenerator::addConstant):
+ * VM/CodeGenerator.h:
+ (JSC::CodeGenerator::JSValueHashTraits::constructDeletedValue):
+ (JSC::CodeGenerator::JSValueHashTraits::isDeletedValue):
+ * VM/Machine.cpp:
+ (JSC::Machine::cti_op_add):
+ (JSC::Machine::cti_op_pre_inc):
+ (JSC::Machine::cti_op_get_by_id):
+ (JSC::Machine::cti_op_get_by_id_second):
+ (JSC::Machine::cti_op_get_by_id_generic):
+ (JSC::Machine::cti_op_get_by_id_fail):
+ (JSC::Machine::cti_op_instanceof):
+ (JSC::Machine::cti_op_del_by_id):
+ (JSC::Machine::cti_op_mul):
+ (JSC::Machine::cti_op_call_NotJSFunction):
+ (JSC::Machine::cti_op_resolve):
+ (JSC::Machine::cti_op_construct_NotJSConstruct):
+ (JSC::Machine::cti_op_get_by_val):
+ (JSC::Machine::cti_op_sub):
+ (JSC::Machine::cti_op_lesseq):
+ (JSC::Machine::cti_op_negate):
+ (JSC::Machine::cti_op_resolve_base):
+ (JSC::Machine::cti_op_resolve_skip):
+ (JSC::Machine::cti_op_resolve_global):
+ (JSC::Machine::cti_op_div):
+ (JSC::Machine::cti_op_pre_dec):
+ (JSC::Machine::cti_op_not):
+ (JSC::Machine::cti_op_eq):
+ (JSC::Machine::cti_op_lshift):
+ (JSC::Machine::cti_op_bitand):
+ (JSC::Machine::cti_op_rshift):
+ (JSC::Machine::cti_op_bitnot):
+ (JSC::Machine::cti_op_mod):
+ (JSC::Machine::cti_op_less):
+ (JSC::Machine::cti_op_neq):
+ (JSC::Machine::cti_op_urshift):
+ (JSC::Machine::cti_op_bitxor):
+ (JSC::Machine::cti_op_bitor):
+ (JSC::Machine::cti_op_call_eval):
+ (JSC::Machine::cti_op_throw):
+ (JSC::Machine::cti_op_next_pname):
+ (JSC::Machine::cti_op_typeof):
+ (JSC::Machine::cti_op_is_undefined):
+ (JSC::Machine::cti_op_is_boolean):
+ (JSC::Machine::cti_op_is_number):
+ (JSC::Machine::cti_op_is_string):
+ (JSC::Machine::cti_op_is_object):
+ (JSC::Machine::cti_op_is_function):
+ (JSC::Machine::cti_op_stricteq):
+ (JSC::Machine::cti_op_nstricteq):
+ (JSC::Machine::cti_op_to_jsnumber):
+ (JSC::Machine::cti_op_in):
+ (JSC::Machine::cti_op_del_by_val):
+ (JSC::Machine::cti_vm_throw):
+ Removed calls to payload functions.
+
+ * VM/Register.h:
+ (JSC::Register::Register): Removed overload for JSCell and call
+ to payload function.
+
+ * kjs/JSCell.h: Changed JSCell to derive from JSValue again.
+ Removed JSValuePtr constructor.
+ (JSC::asCell): Changed cast from reinterpret_cast to static_cast.
+
+ * kjs/JSImmediate.h: Removed JSValuePtr class. Added typedef back.
+
+ * kjs/JSValue.h:
+ (JSC::JSValue::JSValue): Added empty protected inline constructor back.
+ (JSC::JSValue::~JSValue): Same for destructor.
+ Removed == and != operator for JSValuePtr.
+
+ * kjs/PropertySlot.h:
+ (JSC::PropertySlot::PropertySlot): Chnaged argument to const JSValue*
+ and added a const_cast.
+
+ * kjs/protect.h: Removed overloads and specialization for JSValuePtr.
+
+2008-10-22 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Really "fix" CTI mode on windows 2k3.
+
+ This adds new methods fastMallocExecutable and fastFreeExecutable
+ to wrap allocation for cti code. This still just makes fastMalloc
+ return executable memory all the time, which will be fixed in a
+ later patch.
+
+ However in windows debug builds all executable allocations will be
+ allocated on separate executable pages, which should resolve any
+ remaining 2k3 issues. Conveniently the 2k3 bot will now also fail
+ if there are any fastFree vs. fastFreeExecutable errors.
+
+ * ChangeLog:
+ * VM/CodeBlock.cpp:
+ (JSC::CodeBlock::~CodeBlock):
+ * kjs/regexp.cpp:
+ (JSC::RegExp::~RegExp):
+ * masm/X86Assembler.h:
+ (JSC::JITCodeBuffer::copy):
+ * wtf/FastMalloc.cpp:
+ (WTF::fastMallocExecutable):
+ (WTF::fastFreeExecutable):
+ (WTF::TCMallocStats::fastMallocExecutable):
+ (WTF::TCMallocStats::fastFreeExecutable):
+ * wtf/FastMalloc.h:
+
+2008-10-22 Darin Adler <darin@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ - fix https://bugs.webkit.org/show_bug.cgi?id=21294
+ Bug 21294: Devirtualize getOwnPropertySlot()
+
+ A bit over 3% faster on V8 tests.
+
+ * JavascriptCore.exp: Export leak-related functions..
+
+ * API/JSCallbackConstructor.h:
+ (JSC::JSCallbackConstructor::createStructureID): Set HasStandardGetOwnPropertySlot
+ since this class doesn't override getPropertySlot.
+ * API/JSCallbackFunction.h:
+ (JSC::JSCallbackFunction::createStructureID): Ditto.
+
+ * VM/ExceptionHelpers.cpp:
+ (JSC::InterruptedExecutionError::InterruptedExecutionError): Use a structure
+ that's created just for this class instead of trying to share a single "null
+ prototype" structure.
+
+ * VM/Machine.cpp:
+ (JSC::Machine::cti_op_create_arguments_no_params): Rename
+ Arguments::ArgumentsNoParameters to Arguments::NoParameters.
+
+ * kjs/Arguments.h: Rename the enum from Arguments::ArgumentsParameters to
+ Arguments::NoParametersType and the value from Arguments::ArgumentsNoParameters
+ to Arguments::NoParameters.
+ (JSC::Arguments::createStructureID): Added. Returns a structure without
+ HasStandardGetOwnPropertySlot since this class overrides getOwnPropertySlot.
+ (JSC::Arguments::Arguments): Added an assertion that there are no parameters.
+
+ * kjs/DatePrototype.h:
+ (JSC::DatePrototype::createStructureID): Added. Returns a structure without
+ HasStandardGetOwnPropertySlot since this class overrides getOwnPropertySlot.
+
+ * kjs/FunctionPrototype.h:
+ (JSC::FunctionPrototype::createStructureID): Set HasStandardGetOwnPropertySlot
+ since this class doesn't override getPropertySlot.
+ * kjs/InternalFunction.h:
+ (JSC::InternalFunction::createStructureID): Ditto.
+
+ * kjs/JSArray.h:
+ (JSC::JSArray::createStructureID): Added. Returns a structure without
+ HasStandardGetOwnPropertySlot since this class overrides getOwnPropertySlot.
+
+ * kjs/JSCell.h: Added declaration of fastGetOwnPropertySlot; a non-virtual
+ version that uses the structure bit to decide whether to call the virtual
+ version.
+
+ * kjs/JSFunction.h:
+ (JSC::JSFunction::createStructureID): Added. Returns a structure without
+ HasStandardGetOwnPropertySlot since this class overrides getOwnPropertySlot.
+
+ * kjs/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData): Initialize new structures; removed
+ nullProtoStructureID.
+ * kjs/JSGlobalData.h: Added new structures. Removed nullProtoStructureID.
+
+ * kjs/JSGlobalObject.h:
+ (JSC::JSGlobalObject::createStructureID): Added. Returns a structure without
+ HasStandardGetOwnPropertySlot since this class overrides getOwnPropertySlot.
+
+ * kjs/JSNotAnObject.h:
+ (JSC::JSNotAnObjectErrorStub::JSNotAnObjectErrorStub): Use a structure
+ that's created just for this class instead of trying to share a single "null
+ prototype" structure.
+ (JSC::JSNotAnObjectErrorStub::isNotAnObjectErrorStub): Marked this function
+ virtual for clarity and made it private since no one should call it if they
+ already have a pointer to this specific type.
+ (JSC::JSNotAnObject::JSNotAnObject): Use a structure that's created just
+ for this class instead of trying to share a single "null prototype" structure.
+ (JSC::JSNotAnObject::createStructureID): Added. Returns a structure without
+ HasStandardGetOwnPropertySlot since this class overrides getOwnPropertySlot.
+
+ * kjs/JSObject.h:
+ (JSC::JSObject::createStructureID): Added HasStandardGetOwnPropertySlot.
+ (JSC::JSObject::inlineGetOwnPropertySlot): Added. Used so we can share code
+ between getOwnPropertySlot and fastGetOwnPropertySlot.
+ (JSC::JSObject::getOwnPropertySlot): Moved so that functions are above the
+ functions that call them. Moved the guts of this function into
+ inlineGetOwnPropertySlot.
+ (JSC::JSCell::fastGetOwnPropertySlot): Added. Checks the
+ HasStandardGetOwnPropertySlot bit and if it's set, calls
+ inlineGetOwnPropertySlot, otherwise calls getOwnPropertySlot.
+ (JSC::JSObject::getPropertySlot): Changed to call fastGetOwnPropertySlot.
+ (JSC::JSValue::get): Changed to call fastGetOwnPropertySlot.
+
+ * kjs/JSWrapperObject.h: Made constructor protected to emphasize that
+ this class is only a base class and never instantiated.
+
+ * kjs/MathObject.h:
+ (JSC::MathObject::createStructureID): Added. Returns a structure without
+ HasStandardGetOwnPropertySlot since this class overrides getOwnPropertySlot.
+ * kjs/NumberConstructor.h:
+ (JSC::NumberConstructor::createStructureID): Ditto.
+ * kjs/RegExpConstructor.h:
+ (JSC::RegExpConstructor::createStructureID): Ditto.
+ * kjs/RegExpObject.h:
+ (JSC::RegExpObject::createStructureID): Ditto.
+ * kjs/StringObject.h:
+ (JSC::StringObject::createStructureID): Ditto.
+
+ * kjs/TypeInfo.h: Added HasStandardGetOwnPropertySlot flag and
+ hasStandardGetOwnPropertySlot accessor function.
+
+2008-10-22 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Bug 21803: Fuse op_jfalse with op_eq_null and op_neq_null
+ <https://bugs.webkit.org/show_bug.cgi?id=21803>
+
+ Fuse op_jfalse with op_eq_null and op_neq_null to make the new opcodes
+ op_jeq_null and op_jneq_null.
+
+ This is a 2.6% speedup on the V8 Raytrace benchmark, and strangely also
+ a 4.7% speedup on the V8 Arguments benchmark, even though it uses
+ neither of the two new opcodes.
+
+ * VM/CTI.cpp:
+ (JSC::CTI::privateCompileMainPass):
+ * VM/CodeBlock.cpp:
+ (JSC::CodeBlock::dump):
+ * VM/CodeGenerator.cpp:
+ (JSC::CodeGenerator::emitJumpIfTrue):
+ (JSC::CodeGenerator::emitJumpIfFalse):
+ * VM/Machine.cpp:
+ (JSC::Machine::privateExecute):
+ * VM/Opcode.h:
+
+2008-10-22 Darin Fisher <darin@chromium.org>
+
+ Reviewed by Eric Seidel.
+
+ Should not define PLATFORM(WIN,MAC,GTK) when PLATFORM(CHROMIUM) is defined
+ https://bugs.webkit.org/show_bug.cgi?id=21757
+
+ PLATFORM(CHROMIUM) implies HAVE_ACCESSIBILITY
+
+ * wtf/Platform.h:
+
+2008-10-22 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Correct opcode names in documentation.
+
+ * VM/Machine.cpp:
+ (JSC::Machine::privateExecute):
+
+2008-10-21 Oliver Hunt <oliver@apple.com>
+
+ RS=Maciej Stachowiak.
+
+ Force FastMalloc to make all allocated pages executable in
+ a vague hope this will allow the Win2k3 bot to be able to
+ run tests.
+
+ Filed Bug 21783: Need more granular control over allocation of executable memory
+ to cover a more granular version of this patch.
+
+ * wtf/TCSystemAlloc.cpp:
+ (TryVirtualAlloc):
+
+2008-10-21 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=21769
+ MessagePort should be GC protected if there are messages to be delivered
+
+ * wtf/MessageQueue.h:
+ (WTF::::isEmpty): Added. Also added a warning for methods that return a snapshot of queue
+ state, thus likely to cause race conditions.
+
+2008-10-21 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ - convert post-increment to pre-increment in a couple more places for speed
+
+ Speeds up V8 benchmarks a little on most computers. (But, strangely, slows
+ them down a little on my computer.)
+
+ * kjs/nodes.cpp:
+ (JSC::statementListEmitCode): Removed default argument, since we always want
+ to specify this explicitly.
+ (JSC::ForNode::emitCode): Tolerate ignoredResult() as the dst -- means the
+ same thing as 0.
+ (JSC::ReturnNode::emitCode): Ditto.
+ (JSC::ThrowNode::emitCode): Ditto.
+ (JSC::FunctionBodyNode::emitCode): Pass ignoredResult() so that we know we
+ don't have to compute the result of function statements.
+
+2008-10-21 Peter Kasting <pkasting@google.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Fix an include of a non-public header to use "" instead of <>.
+
+ * API/JSProfilerPrivate.cpp:
+
+2008-10-20 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Cameron Zwarich.
+
+ Fix for https://bugs.webkit.org/show_bug.cgi?id=21766
+ REGRESSION: 12 JSC tests fail
+
+ The JSGlobalObject was mutating the shared nullProtoStructureID when
+ used in jsc. Instead of using nullProtoStructureID, use a new StructureID.
+
+ * API/JSCallbackObject.h:
+ * API/JSCallbackObjectFunctions.h:
+ (JSC::::JSCallbackObject):
+ * API/JSContextRef.cpp:
+ (JSGlobalContextCreateInGroup):
+ * kjs/JSGlobalObject.h:
+ (JSC::JSGlobalObject::JSGlobalObject):
+ * kjs/Shell.cpp:
+ (GlobalObject::GlobalObject):
+ (jscmain):
+
+2008-10-20 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Remove an untaken branch in CodeGenerator::emitJumpIfFalse(). This
+ function is never called with a backwards target LabelID, and there is
+ even an assertion to this effect at the top of the function body.
+
+ * VM/CodeGenerator.cpp:
+ (JSC::CodeGenerator::emitJumpIfFalse):
+
+2008-10-20 Cameron Zwarich <zwarich@apple.com>
+
+ Rubber-stamped by Sam Weinig.
+
+ Add opcode documentation for undocumented opcodes.
+
+ * VM/Machine.cpp:
+ (JSC::Machine::privateExecute):
+
+2008-10-16 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Cameron Zwarich.
+
+ Fix for https://bugs.webkit.org/show_bug.cgi?id=21683
+ Don't create intermediate StructureIDs for builtin objects
+
+ Second stage in reduce number of StructureIDs created when initializing the
+ JSGlobalObject.
+
+ - Use putDirectWithoutTransition for the remaining singleton objects to reduce
+ the number of StructureIDs create for about:blank from 132 to 73.
+
+ * kjs/ArrayConstructor.cpp:
+ (JSC::ArrayConstructor::ArrayConstructor):
+ * kjs/BooleanConstructor.cpp:
+ (JSC::BooleanConstructor::BooleanConstructor):
+ * kjs/BooleanPrototype.cpp:
+ (JSC::BooleanPrototype::BooleanPrototype):
+ * kjs/DateConstructor.cpp:
+ (JSC::DateConstructor::DateConstructor):
+ * kjs/ErrorConstructor.cpp:
+ (JSC::ErrorConstructor::ErrorConstructor):
+ * kjs/ErrorPrototype.cpp:
+ (JSC::ErrorPrototype::ErrorPrototype):
+ * kjs/FunctionConstructor.cpp:
+ (JSC::FunctionConstructor::FunctionConstructor):
+ * kjs/FunctionPrototype.cpp:
+ (JSC::FunctionPrototype::FunctionPrototype):
+ (JSC::FunctionPrototype::addFunctionProperties):
+ * kjs/FunctionPrototype.h:
+ (JSC::FunctionPrototype::createStructureID):
+ * kjs/InternalFunction.cpp:
+ * kjs/InternalFunction.h:
+ (JSC::InternalFunction::InternalFunction):
+ * kjs/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::reset):
+ * kjs/JSObject.h:
+ * kjs/MathObject.cpp:
+ (JSC::MathObject::MathObject):
+ * kjs/NumberConstructor.cpp:
+ (JSC::NumberConstructor::NumberConstructor):
+ * kjs/NumberPrototype.cpp:
+ (JSC::NumberPrototype::NumberPrototype):
+ * kjs/ObjectConstructor.cpp:
+ (JSC::ObjectConstructor::ObjectConstructor):
+ * kjs/RegExpConstructor.cpp:
+ (JSC::RegExpConstructor::RegExpConstructor):
+ * kjs/RegExpPrototype.cpp:
+ (JSC::RegExpPrototype::RegExpPrototype):
+ * kjs/StringConstructor.cpp:
+ (JSC::StringConstructor::StringConstructor):
+ * kjs/StringPrototype.cpp:
+ (JSC::StringPrototype::StringPrototype):
+ * kjs/StructureID.cpp:
+ (JSC::StructureID::dumpStatistics):
+ * kjs/StructureID.h:
+ (JSC::StructureID::setPrototypeWithoutTransition):
+
+2008-10-20 Alp Toker <alp@nuanti.com>
+
+ Fix autotools dist build target by listing recently added header
+ files only. Not reviewed.
+
+ * GNUmakefile.am:
+
+2008-10-20 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Anders Carlsson.
+
+ * VM/Machine.cpp:
+ (JSC::Machine::tryCacheGetByID): Removed a redundant and sometimes
+ incorrect cast, which started ASSERTing after Darin's last checkin.
+
+2008-10-20 Geoffrey Garen <ggaren@apple.com>
+
+ Not reviewed.
+
+ Re-enable CTI, which I accidentally disabled while checking in fixes
+ to bytecode.
+
+ * wtf/Platform.h:
+
+2008-10-20 Alp Toker <alp@nuanti.com>
+
+ Rubber-stamped by Mark Rowe.
+
+ Typo fix in function name: mimimum -> minimum.
+
+ * kjs/DateMath.cpp:
+ (JSC::minimumYearForDST):
+ (JSC::equivalentYearForDST):
+
+2008-10-20 Alp Toker <alp@nuanti.com>
+
+ Reviewed by Mark Rowe.
+
+ Use pthread instead of GThread where possible in the GTK+ port. This
+ fixes issues with global initialisation, particularly on GTK+/Win32
+ where a late g_thread_init() will cause hangs.
+
+ * GNUmakefile.am:
+ * wtf/Platform.h:
+ * wtf/Threading.h:
+ * wtf/ThreadingGtk.cpp:
+ * wtf/ThreadingPthreads.cpp:
+
+2008-10-20 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Fixed https://bugs.webkit.org/show_bug.cgi?id=21735
+ Emit profiling instrumentation only if the Web Inspector's profiling
+ feature is enabled
+
+ 22.2% speedup on empty function call benchmark.
+ 2.9% speedup on v8 benchmark.
+ 0.7% speedup on SunSpider.
+
+ Lesser but similar speedups in bytecode.
+
+ * VM/CTI.cpp:
+ (JSC::CTI::compileOpCall):
+ (JSC::CTI::privateCompileMainPass):
+ (JSC::CTI::privateCompileSlowCases): Nixed JITed profiler hooks. Profiler
+ hooks now have their own opcodes. Added support for compiling profiler
+ hook opcodes.
+
+ (JSC::CodeBlock::dump): Dump support for the new profiling opcodes.
+
+ * VM/CodeGenerator.h:
+ * VM/CodeGenerator.cpp:
+ (JSC::CodeGenerator::CodeGenerator):
+ (JSC::CodeGenerator::emitCall):
+ (JSC::CodeGenerator::emitConstruct): Conditionally emit profiling hooks
+ around call and construct, at the call site. (It's easier to get things
+ right this way, if you have profiled code calling non-profiled code.
+ Also, you get a slightly more accurate profile, since you charge the full
+ cost of the call / construct operation to the callee.)
+
+ Also, fixed a bug where construct would fetch the ".prototype" property
+ from the constructor before evaluating the arguments to the constructor,
+ incorrectly allowing an "invalid constructor" exception to short-circuit
+ argument evaluation. I encountered this bug when trying to make
+ constructor exceptions work with profiling.
+
+ * VM/Machine.cpp:
+ (JSC::Machine::callEval): Removed obsolete profiler hooks.
+
+ (JSC::Machine::throwException): Added a check for an exception thrown
+ within a call instruction. We didn't need this before because the call
+ instruction would check for a valid call before involing the profiler.
+ (JSC::Machine::execute): Added a didExecute hook at the end of top-level
+ function invocation, since op_ret no longer does this for us.
+
+ (JSC::Machine::privateExecute): Removed obsolete profiler hooks. Added
+ profiler opcodes. Changed some ++vPC to vPC[x] notation, since the
+ latter is better for performance, and it makes reasoning about the
+ current opcode in exception handling much simpler.
+
+ (JSC::Machine::cti_op_call_NotJSFunction): Removed obsolete profiler
+ hooks.
+
+ (JSC::Machine::cti_op_create_arguments_no_params): Added missing
+ CTI_STACK_HACK that I noticed when adding CTI_STACK_HACK to the new
+ profiler opcode functions.
+
+ (JSC::Machine::cti_op_profile_will_call):
+ (JSC::Machine::cti_op_profile_did_call): The new profiler opcode
+ functions.
+
+ (JSC::Machine::cti_op_construct_NotJSConstruct): Removed obsolete profiler
+ hooks.
+
+ * VM/Machine.h:
+ (JSC::Machine::isCallOpcode): Helper for exception handling.
+
+ * VM/Opcode.h: Declare new opcodes.
+
+ * kjs/JSGlobalObject.h:
+ (JSC::JSGlobalObject::supportsProfiling): Added virtual interface that
+ allows WebCore to specify whether the target global object has the Web
+ Inspector's profiling feature enabled.
+
+ * profiler/Profiler.cpp:
+ (JSC::Profiler::willExecute):
+ (JSC::Profiler::didExecute):
+ (JSC::Profiler::createCallIdentifier):
+ * profiler/Profiler.h: Added support for invoking the profiler with
+ an arbitrary JSValue*, and not a known object. We didn't need this
+ before because the call instruction would check for a valid call before
+ involing the profiler.
+
+2008-10-20 Darin Adler <darin@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ - get CTI working on Windows again
+
+ * VM/CTI.cpp:
+ (JSC::CTI::emitCTICall): Add an overload for functions that
+ return JSObject*.
+ * VM/CTI.h: Use JSValue* and JSObject* as return types for
+ cti_op functions. Apparently, MSVC doesn't handle returning
+ the JSValuePtr struct in a register. We'll have to look into
+ this more.
+
+ * VM/Machine.cpp:
+ (JSC::Machine::cti_op_convert_this):
+ (JSC::Machine::cti_op_add):
+ (JSC::Machine::cti_op_pre_inc):
+ (JSC::Machine::cti_op_new_object):
+ (JSC::Machine::cti_op_get_by_id):
+ (JSC::Machine::cti_op_get_by_id_second):
+ (JSC::Machine::cti_op_get_by_id_generic):
+ (JSC::Machine::cti_op_get_by_id_fail):
+ (JSC::Machine::cti_op_instanceof):
+ (JSC::Machine::cti_op_del_by_id):
+ (JSC::Machine::cti_op_mul):
+ (JSC::Machine::cti_op_new_func):
+ (JSC::Machine::cti_op_push_activation):
+ (JSC::Machine::cti_op_call_NotJSFunction):
+ (JSC::Machine::cti_op_new_array):
+ (JSC::Machine::cti_op_resolve):
+ (JSC::Machine::cti_op_construct_JSConstructFast):
+ (JSC::Machine::cti_op_construct_NotJSConstruct):
+ (JSC::Machine::cti_op_get_by_val):
+ (JSC::Machine::cti_op_sub):
+ (JSC::Machine::cti_op_lesseq):
+ (JSC::Machine::cti_op_negate):
+ (JSC::Machine::cti_op_resolve_base):
+ (JSC::Machine::cti_op_resolve_skip):
+ (JSC::Machine::cti_op_resolve_global):
+ (JSC::Machine::cti_op_div):
+ (JSC::Machine::cti_op_pre_dec):
+ (JSC::Machine::cti_op_not):
+ (JSC::Machine::cti_op_eq):
+ (JSC::Machine::cti_op_lshift):
+ (JSC::Machine::cti_op_bitand):
+ (JSC::Machine::cti_op_rshift):
+ (JSC::Machine::cti_op_bitnot):
+ (JSC::Machine::cti_op_new_func_exp):
+ (JSC::Machine::cti_op_mod):
+ (JSC::Machine::cti_op_less):
+ (JSC::Machine::cti_op_neq):
+ (JSC::Machine::cti_op_urshift):
+ (JSC::Machine::cti_op_bitxor):
+ (JSC::Machine::cti_op_new_regexp):
+ (JSC::Machine::cti_op_bitor):
+ (JSC::Machine::cti_op_call_eval):
+ (JSC::Machine::cti_op_throw):
+ (JSC::Machine::cti_op_next_pname):
+ (JSC::Machine::cti_op_typeof):
+ (JSC::Machine::cti_op_is_undefined):
+ (JSC::Machine::cti_op_is_boolean):
+ (JSC::Machine::cti_op_is_number):
+ (JSC::Machine::cti_op_is_string):
+ (JSC::Machine::cti_op_is_object):
+ (JSC::Machine::cti_op_is_function):
+ (JSC::Machine::cti_op_stricteq):
+ (JSC::Machine::cti_op_nstricteq):
+ (JSC::Machine::cti_op_to_jsnumber):
+ (JSC::Machine::cti_op_in):
+ (JSC::Machine::cti_op_push_new_scope):
+ (JSC::Machine::cti_op_del_by_val):
+ (JSC::Machine::cti_op_new_error):
+ (JSC::Machine::cti_vm_throw):
+ Change these functions to return pointer types, and never
+ JSValuePtr.
+ * VM/Machine.h: Ditto.
+
+2008-10-20 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Fixed some recent break-age in bytecode mode.
+
+ * VM/CodeBlock.cpp:
+ (JSC::CodeBlock::printStructureIDs): Fixed up an ASSERT caused by
+ Gavin's last checkin. This is a temporary fix so I can keep on moving.
+ I'll send email about what I think is an underlying problem soon.
+
+ * VM/Machine.cpp:
+ (JSC::Machine::privateExecute): Removed a redundant and sometimes
+ incorrect cast, which started ASSERTing after Darin's last checkin.
+
+2008-10-20 Darin Adler <darin@apple.com>
+
+ - another similar Windows build fix
+
+ * VM/CTI.cpp: Changed return type to JSObject* instead of JSValuePtr.
+
+2008-10-20 Darin Adler <darin@apple.com>
+
+ - try to fix Windows build
+
+ * VM/CTI.cpp: Use JSValue* instead of JSValuePtr for ctiTrampoline.
+ * VM/CTI.h: Ditto.
+
+2008-10-19 Darin Adler <darin@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ - finish https://bugs.webkit.org/show_bug.cgi?id=21732
+ improve performance by eliminating JSValue as a base class for JSCell
+
+ * VM/Machine.cpp:
+ (JSC::Machine::cti_op_call_profiler): Use asFunction.
+ (JSC::Machine::cti_vm_lazyLinkCall): Ditto.
+ (JSC::Machine::cti_op_construct_JSConstructFast): Use asObject.
+
+ * kjs/JSCell.h: Re-sort friend classes. Eliminate inheritance from
+ JSValue. Changed cast in asCell from static_cast to reinterpret_cast.
+ Removed JSValue::getNumber(double&) and one of JSValue::getObject
+ overloads.
+
+ * kjs/JSValue.h: Made the private constructor and destructor both
+ non-virtual and also remove the definitions. This class can never
+ be instantiated or derived.
+
+2008-10-19 Darin Adler <darin@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ - next step of https://bugs.webkit.org/show_bug.cgi?id=21732
+ improve performance by eliminating JSValue as a base class for JSCell
+
+ Change JSValuePtr from a typedef into a class. This allows us to support
+ conversion from JSCell* to JSValuePtr even if JSCell isn't derived from
+ JSValue.
+
+ * JavaScriptCore.exp: Updated symbols that involve JSValuePtr, since
+ it's now a distinct type.
+
+ * API/APICast.h:
+ (toRef): Extract the JSValuePtr payload explicitly since we can't just
+ cast any more.
+ * VM/CTI.cpp:
+ (JSC::CTI::asInteger): Ditto.
+
+ * VM/CodeGenerator.cpp:
+ (JSC::CodeGenerator::addConstant): Get at the payload directly.
+ (JSC::CodeGenerator::emitLoad): Added an overload of JSCell* because
+ otherwise classes derived from JSValue end up calling the bool
+ overload instead of JSValuePtr.
+ * VM/CodeGenerator.h: Ditto. Also update traits to use JSValue*
+ and the payload functions.
+
+ * VM/Register.h: Added a JSCell* overload and use of payload functions.
+
+ * kjs/JSCell.h:
+ (JSC::asCell): Use payload function.
+ (JSC::JSValue::asCell): Use JSValue* instead of JSValuePtr.
+ (JSC::JSValuePtr::JSValuePtr): Added. Constructor that takes JSCell*
+ and creates a JSValuePtr.
+
+ * kjs/JSImmediate.h: Added JSValuePtr class. Also updated makeValue
+ and makeInt to work with JSValue* and the payload function.
+
+ * kjs/JSValue.h: Added == and != operators for JSValuePtr. Put them
+ here because eventually all the JSValue functions should go here
+ except what's needed by JSImmediate. Also fix asValue to use
+ JSValue* instead of JSValuePtr.
+
+ * kjs/PropertySlot.h: Change constructor to take JSValuePtr.
+
+ * kjs/protect.h: Update gcProtect functions to work with JSCell*
+ as well as JSValuePtr. Also updated the ProtectedPtr<JSValuePtr>
+ specialization to work more directly. Also changed all the call
+ sites to use gcProtectNullTolerant.
+
+2008-10-19 Darin Adler <darin@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ - next step of https://bugs.webkit.org/show_bug.cgi?id=21732
+ improve performance by eliminating JSValue as a base class for JSCell
+
+ Remove most uses of JSValue, which will be removed in a future patch.
+
+ * VM/Machine.cpp:
+ (JSC::fastToUInt32): Call toUInt32SlowCase function; no longer a member
+ of JSValue.
+ * kjs/JSNumberCell.h:
+ (JSC::JSNumberCell::toInt32): Ditto.
+ (JSC::JSNumberCell::toUInt32): Ditto.
+
+ * kjs/JSValue.cpp:
+ (JSC::toInt32SlowCase): Made a non-member function.
+ (JSC::JSValue::toInt32SlowCase): Changed to call non-member function.
+ (JSC::toUInt32SlowCase): More of the same.
+ (JSC::JSValue::toUInt32SlowCase): Ditto.
+
+ * kjs/JSValue.h: Moved static member function so they are no longer
+ member functions at all.
+
+ * VM/CTI.h: Removed forward declaration of JSValue.
+ * VM/ExceptionHelpers.h: Ditto.
+ * kjs/CallData.h: Ditto.
+ * kjs/ConstructData.h: Ditto.
+ * kjs/JSGlobalObjectFunctions.h: Ditto.
+ * kjs/PropertyMap.h: Ditto.
+ * kjs/StructureID.h: Ditto.
+ * kjs/collector.h: Ditto.
+ * kjs/completion.h: Ditto.
+
+ * kjs/grammar.y:
+ (JSC::makeBitwiseNotNode): Call new non-member toInt32 function.
+ (JSC::makeLeftShiftNode): More of the same.
+ (JSC::makeRightShiftNode): Ditto.
+
+ * kjs/protect.h: Added a specialization for ProtectedPtr<JSValuePtr>
+ so this can be used with JSValuePtr.
+
+2008-10-18 Darin Adler <darin@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ - next step of https://bugs.webkit.org/show_bug.cgi?id=21732
+ improve performance by eliminating JSValue as a base class for JSCell
+
+ Tweak a little more to get closer to where we can make JSValuePtr a class.
+
+ * API/APICast.h:
+ (toJS): Change back to JSValue* here, since we're converting the
+ pointer type.
+ * VM/CTI.cpp:
+ (JSC::CTI::unlinkCall): Call asPointer.
+ * VM/CTI.h: Cast to JSValue* here, since it's a pointer cast.
+ * kjs/DebuggerCallFrame.h:
+ (JSC::DebuggerCallFrame::DebuggerCallFrame): Call noValue.
+ * kjs/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData): Call noValue.
+ * kjs/JSImmediate.cpp:
+ (JSC::JSImmediate::toObject): Remove unneeded const_cast.
+ * kjs/JSWrapperObject.h:
+ (JSC::JSWrapperObject::JSWrapperObject): Call noValue.
+
+2008-10-18 Darin Adler <darin@apple.com>
+
+ - fix non-all-in-one build
+
+ * kjs/completion.h:
+ (JSC::Completion::Completion): Add include of JSValue.h.
+
+2008-10-18 Darin Adler <darin@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ - fix assertions I introduced with my casting changes
+
+ These were showing up as failures in the JavaScriptCore tests.
+
+ * VM/Machine.cpp:
+ (JSC::Machine::cti_op_instanceof): Remove the bogus asCell casting that
+ was at the top of the function, and instead cast at the point of use.
+ (JSC::Machine::cti_op_construct_NotJSConstruct): Moved the cast to
+ object after checking the construct type.
+
+2008-10-18 Darin Adler <darin@apple.com>
+
+ - fix non-all-in-one build
+
+ * kjs/JSGlobalObjectFunctions.h: Add include of JSImmedate.h (for now).
+
+2008-10-18 Darin Adler <darin@apple.com>
+
+ - fix build
+
+ * kjs/interpreter.h: Include JSValue.h instead of JSImmediate.h.
+
+2008-10-18 Darin Adler <darin@apple.com>
+
+ * kjs/interpreter.h: Fix include of JSImmediate.h.
+
+2008-10-18 Darin Adler <darin@apple.com>
+
+ - fix non-all-in-one build
+
+ * kjs/interpreter.h: Add include of JSImmediate.h.
+
+2008-10-18 Darin Adler <darin@apple.com>
+
+ - fix non-all-in-one build
+
+ * kjs/ConstructData.h: Add include of JSImmedate.h (for now).
+
+2008-10-18 Darin Adler <darin@apple.com>
+
+ - try to fix Windows build
+
+ * VM/Machine.cpp:
+ (JSC::Machine::Machine): Use JSCell* type since MSVC seems to only allow
+ calling ~JSCell directly if it's a JSCell*.
+
+2008-10-18 Darin Adler <darin@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ - next step on https://bugs.webkit.org/show_bug.cgi?id=21732
+ improve performance by eliminating JSValue as a base class for JSCell
+
+ Use JSValuePtr everywhere instead of JSValue*. In the future, we'll be
+ changing JSValuePtr to be a class, and then eventually renaming it
+ to JSValue once that's done.
+
+ * JavaScriptCore.exp: Update entry points, since some now take JSValue*
+ instead of const JSValue*.
+
+ * API/APICast.h:
+ * API/JSCallbackConstructor.h:
+ * API/JSCallbackFunction.cpp:
+ * API/JSCallbackFunction.h:
+ * API/JSCallbackObject.h:
+ * API/JSCallbackObjectFunctions.h:
+ * API/JSContextRef.cpp:
+ * API/JSObjectRef.cpp:
+ * API/JSValueRef.cpp:
+ * VM/CTI.cpp:
+ * VM/CTI.h:
+ * VM/CodeBlock.cpp:
+ * VM/CodeBlock.h:
+ * VM/CodeGenerator.cpp:
+ * VM/CodeGenerator.h:
+ * VM/ExceptionHelpers.cpp:
+ * VM/ExceptionHelpers.h:
+ * VM/JSPropertyNameIterator.cpp:
+ * VM/JSPropertyNameIterator.h:
+ * VM/Machine.cpp:
+ * VM/Machine.h:
+ * VM/Register.h:
+ * kjs/ArgList.cpp:
+ * kjs/ArgList.h:
+ * kjs/Arguments.cpp:
+ * kjs/Arguments.h:
+ * kjs/ArrayConstructor.cpp:
+ * kjs/ArrayPrototype.cpp:
+ * kjs/BooleanConstructor.cpp:
+ * kjs/BooleanConstructor.h:
+ * kjs/BooleanObject.h:
+ * kjs/BooleanPrototype.cpp:
+ * kjs/CallData.cpp:
+ * kjs/CallData.h:
+ * kjs/ConstructData.cpp:
+ * kjs/ConstructData.h:
+ * kjs/DateConstructor.cpp:
+ * kjs/DateInstance.h:
+ * kjs/DatePrototype.cpp:
+ * kjs/DebuggerCallFrame.cpp:
+ * kjs/DebuggerCallFrame.h:
+ * kjs/ErrorConstructor.cpp:
+ * kjs/ErrorPrototype.cpp:
+ * kjs/ExecState.cpp:
+ * kjs/ExecState.h:
+ * kjs/FunctionConstructor.cpp:
+ * kjs/FunctionPrototype.cpp:
+ * kjs/GetterSetter.cpp:
+ * kjs/GetterSetter.h:
+ * kjs/InternalFunction.h:
+ * kjs/JSActivation.cpp:
+ * kjs/JSActivation.h:
+ * kjs/JSArray.cpp:
+ * kjs/JSArray.h:
+ * kjs/JSCell.cpp:
+ * kjs/JSCell.h:
+ * kjs/JSFunction.cpp:
+ * kjs/JSFunction.h:
+ * kjs/JSGlobalData.h:
+ * kjs/JSGlobalObject.cpp:
+ * kjs/JSGlobalObject.h:
+ * kjs/JSGlobalObjectFunctions.cpp:
+ * kjs/JSGlobalObjectFunctions.h:
+ * kjs/JSImmediate.cpp:
+ * kjs/JSImmediate.h:
+ * kjs/JSNotAnObject.cpp:
+ * kjs/JSNotAnObject.h:
+ * kjs/JSNumberCell.cpp:
+ * kjs/JSNumberCell.h:
+ * kjs/JSObject.cpp:
+ * kjs/JSObject.h:
+ * kjs/JSStaticScopeObject.cpp:
+ * kjs/JSStaticScopeObject.h:
+ * kjs/JSString.cpp:
+ * kjs/JSString.h:
+ * kjs/JSValue.h:
+ * kjs/JSVariableObject.h:
+ * kjs/JSWrapperObject.h:
+ * kjs/MathObject.cpp:
+ * kjs/NativeErrorConstructor.cpp:
+ * kjs/NumberConstructor.cpp:
+ * kjs/NumberConstructor.h:
+ * kjs/NumberObject.cpp:
+ * kjs/NumberObject.h:
+ * kjs/NumberPrototype.cpp:
+ * kjs/ObjectConstructor.cpp:
+ * kjs/ObjectPrototype.cpp:
+ * kjs/ObjectPrototype.h:
+ * kjs/PropertyMap.h:
+ * kjs/PropertySlot.cpp:
+ * kjs/PropertySlot.h:
+ * kjs/RegExpConstructor.cpp:
+ * kjs/RegExpConstructor.h:
+ * kjs/RegExpMatchesArray.h:
+ * kjs/RegExpObject.cpp:
+ * kjs/RegExpObject.h:
+ * kjs/RegExpPrototype.cpp:
+ * kjs/Shell.cpp:
+ * kjs/StringConstructor.cpp:
+ * kjs/StringObject.cpp:
+ * kjs/StringObject.h:
+ * kjs/StringObjectThatMasqueradesAsUndefined.h:
+ * kjs/StringPrototype.cpp:
+ * kjs/StructureID.cpp:
+ * kjs/StructureID.h:
+ * kjs/collector.cpp:
+ * kjs/collector.h:
+ * kjs/completion.h:
+ * kjs/grammar.y:
+ * kjs/interpreter.cpp:
+ * kjs/interpreter.h:
+ * kjs/lookup.cpp:
+ * kjs/lookup.h:
+ * kjs/nodes.h:
+ * kjs/operations.cpp:
+ * kjs/operations.h:
+ * kjs/protect.h:
+ * profiler/ProfileGenerator.cpp:
+ Replace JSValue* with JSValuePtr.
+
+2008-10-18 Darin Adler <darin@apple.com>
+
+ * VM/Machine.cpp:
+ (JSC::Machine::cti_op_call_eval): Removed stray parentheses from my
+ last check-in.
+
+2008-10-18 Darin Adler <darin@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ - first step of https://bugs.webkit.org/show_bug.cgi?id=21732
+ improve performance by eliminating JSValue as a base class for JSCell
+
+ Remove casts from JSValue* to derived classes, replacing them with
+ calls to inline casting functions. These functions are also a bit
+ better than aidrect cast because they also do a runtime assertion.
+
+ Removed use of 0 as for JSValue*, changing call sites to use a
+ noValue() function instead.
+
+ Move things needed by classes derived from JSValue out of the class,
+ since the classes won't be deriving from JSValue any more soon.
+
+ I did most of these changes by changing JSValue to not be JSValue* any
+ more, then fixing a lot of the compilation problems, then rolling out
+ the JSValue change.
+
+ 1.011x as fast on SunSpider (presumably due to some of the Machine.cpp changes)
+
+ * API/APICast.h: Removed unneeded forward declarations.
+
+ * API/JSCallbackObject.h: Added an asCallbackObject function for casting.
+ * API/JSCallbackObjectFunctions.h:
+ (JSC::JSCallbackObject::asCallbackObject): Added.
+ (JSC::JSCallbackObject::getOwnPropertySlot): Use asObject.
+ (JSC::JSCallbackObject::call): Use noValue.
+ (JSC::JSCallbackObject::staticValueGetter): Use asCallbackObject.
+ (JSC::JSCallbackObject::staticFunctionGetter): Ditto.
+ (JSC::JSCallbackObject::callbackGetter): Ditto.
+
+ * JavaScriptCore.exp: Updated.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj: Added RegExpMatchesArray.h.
+
+ * VM/CTI.cpp:
+ (JSC::CTI::asInteger): Added. For use casting a JSValue to an integer.
+ (JSC::CTI::emitGetArg): Use asInteger.
+ (JSC::CTI::emitGetPutArg): Ditto.
+ (JSC::CTI::getConstantImmediateNumericArg): Ditto. Also use noValue.
+ (JSC::CTI::emitInitRegister): Use asInteger.
+ (JSC::CTI::getDeTaggedConstantImmediate): Ditto.
+ (JSC::CTI::compileOpCallInitializeCallFrame): Ditto.
+ (JSC::CTI::compileOpCall): Ditto.
+ (JSC::CTI::compileOpStrictEq): Ditto.
+ (JSC::CTI::privateCompileMainPass): Ditto.
+ (JSC::CTI::privateCompileGetByIdProto): Ditto.
+ (JSC::CTI::privateCompileGetByIdChain): Ditto.
+ (JSC::CTI::privateCompilePutByIdTransition): Ditto.
+ * VM/CTI.h: Rewrite the ARG-related macros to use C++ casts instead of
+ C casts and get rid of some extra parentheses. Addd declaration of
+ asInteger.
+
+ * VM/CodeGenerator.cpp:
+ (JSC::CodeGenerator::emitEqualityOp): Use asString.
+ (JSC::CodeGenerator::emitLoad): Use noValue.
+ (JSC::CodeGenerator::findScopedProperty): Change globalObject argument
+ to JSObject* instead of JSValue*.
+ (JSC::CodeGenerator::emitResolve): Remove unneeded cast.
+ (JSC::CodeGenerator::emitGetScopedVar): Use asCell.
+ (JSC::CodeGenerator::emitPutScopedVar): Ditto.
+ * VM/CodeGenerator.h: Changed out argument of findScopedProperty.
+ Also change the JSValueMap to use PtrHash explicitly instead of
+ getting it from DefaultHash.
+
+ * VM/JSPropertyNameIterator.cpp:
+ (JSC::JSPropertyNameIterator::toPrimitive): Use noValue.
+ * VM/JSPropertyNameIterator.h:
+ (JSC::JSPropertyNameIterator::next): Ditto.
+
+ * VM/Machine.cpp:
+ (JSC::fastIsNumber): Moved isImmediate check here instead of
+ checking for 0 inside Heap::isNumber. Use asCell and asNumberCell.
+ (JSC::fastToInt32): Ditto.
+ (JSC::fastToUInt32): Ditto.
+ (JSC::jsLess): Use asString.
+ (JSC::jsLessEq): Ditto.
+ (JSC::jsAdd): Ditto.
+ (JSC::jsTypeStringForValue): Use asObject.
+ (JSC::jsIsObjectType): Ditto.
+ (JSC::jsIsFunctionType): Ditto.
+ (JSC::inlineResolveBase): Use noValue.
+ (JSC::Machine::callEval): Use asString. Initialize result to
+ undefined, not 0.
+ (JSC::Machine::Machine): Remove unneeded casts to JSCell*.
+ (JSC::Machine::throwException): Use asObject.
+ (JSC::Machine::debug): Remove explicit calls to the DebuggerCallFrame
+ constructor.
+ (JSC::Machine::checkTimeout): Use noValue.
+ (JSC::cachePrototypeChain): Use asObject.
+ (JSC::Machine::tryCachePutByID): Use asCell.
+ (JSC::Machine::tryCacheGetByID): Use aCell and asObject.
+ (JSC::Machine::privateExecute): Use noValue, asCell, asObject, asString,
+ asArray, asActivation, asFunction. Changed code that creates call frames
+ for host functions to pass 0 for the function pointer -- the call frame
+ needs a JSFunction* and a host function object is not one. This was
+ caught by the assertions in the casting functions. Also remove some
+ unneeded casts in cases where two values are compared.
+ (JSC::Machine::retrieveLastCaller): Use noValue.
+ (JSC::Machine::tryCTICachePutByID): Use asCell.
+ (JSC::Machine::tryCTICacheGetByID): Use aCell and asObject.
+ (JSC::setUpThrowTrampolineReturnAddress): Added this function to restore
+ the PIC-branch-avoidance that was recently lost.
+ (JSC::Machine::cti_op_add): Use asString.
+ (JSC::Machine::cti_op_instanceof): Use asCell and asObject.
+ (JSC::Machine::cti_op_call_JSFunction): Use asFunction.
+ (JSC::Machine::cti_op_call_NotJSFunction): Changed code to pass 0 for
+ the function pointer, since we don't have a JSFunction. Use asObject.
+ (JSC::Machine::cti_op_tear_off_activation): Use asActivation.
+ (JSC::Machine::cti_op_construct_JSConstruct): Use asFunction and asObject.
+ (JSC::Machine::cti_op_construct_NotJSConstruct): use asObject.
+ (JSC::Machine::cti_op_get_by_val): Use asArray and asString.
+ (JSC::Machine::cti_op_resolve_func): Use asPointer; this helps prepare
+ us for a situation where JSValue is not a pointer.
+ (JSC::Machine::cti_op_put_by_val): Use asArray.
+ (JSC::Machine::cti_op_put_by_val_array): Ditto.
+ (JSC::Machine::cti_op_resolve_global): Use asGlobalObject.
+ (JSC::Machine::cti_op_post_inc): Change VM_CHECK_EXCEPTION_2 to
+ VM_CHECK_EXCEPTION_AT_END, since there's no observable work done after
+ that point. Also use asPointer.
+ (JSC::Machine::cti_op_resolve_with_base): Use asPointer.
+ (JSC::Machine::cti_op_post_dec): Change VM_CHECK_EXCEPTION_2 to
+ VM_CHECK_EXCEPTION_AT_END, since there's no observable work done after
+ that point. Also use asPointer.
+ (JSC::Machine::cti_op_call_eval): Use asObject, noValue, and change
+ VM_CHECK_EXCEPTION_ARG to VM_THROW_EXCEPTION_AT_END.
+ (JSC::Machine::cti_op_throw): Change return value to a JSValue*.
+ (JSC::Machine::cti_op_in): Use asObject.
+ (JSC::Machine::cti_op_switch_char): Use asString.
+ (JSC::Machine::cti_op_switch_string): Ditto.
+ (JSC::Machine::cti_op_put_getter): Use asObject.
+ (JSC::Machine::cti_op_put_setter): Ditto.
+ (JSC::Machine::cti_vm_throw): Change return value to a JSValue*.
+ Use noValue.
+ * VM/Machine.h: Change return values of both cti_op_throw and
+ cti_vm_throw to JSValue*.
+
+ * VM/Register.h: Remove nullJSValue, which is the same thing
+ as noValue(). Also removed unneeded definition of JSValue.
+
+ * kjs/ArgList.h: Removed unneeded definition of JSValue.
+
+ * kjs/Arguments.h:
+ (JSC::asArguments): Added.
+
+ * kjs/ArrayPrototype.cpp:
+ (JSC::getProperty): Use noValue.
+ (JSC::arrayProtoFuncToString): Use asArray.
+ (JSC::arrayProtoFuncToLocaleString): Ditto.
+ (JSC::arrayProtoFuncConcat): Ditto.
+ (JSC::arrayProtoFuncPop): Ditto. Also removed unneeded initialization
+ of the result, which is set in both sides of the branch.
+ (JSC::arrayProtoFuncPush): Ditto.
+ (JSC::arrayProtoFuncShift): Removed unneeded initialization
+ of the result, which is set in both sides of the branch.
+ (JSC::arrayProtoFuncSort): Use asArray.
+
+ * kjs/BooleanObject.h:
+ (JSC::asBooleanObject): Added.
+
+ * kjs/BooleanPrototype.cpp:
+ (JSC::booleanProtoFuncToString): Use asBooleanObject.
+ (JSC::booleanProtoFuncValueOf): Ditto.
+
+ * kjs/CallData.cpp:
+ (JSC::call): Use asObject and asFunction.
+ * kjs/ConstructData.cpp:
+ (JSC::construct): Ditto.
+
+ * kjs/DateConstructor.cpp:
+ (JSC::constructDate): Use asDateInstance.
+
+ * kjs/DateInstance.h:
+ (JSC::asDateInstance): Added.
+
+ * kjs/DatePrototype.cpp:
+ (JSC::dateProtoFuncToString): Use asDateInstance.
+ (JSC::dateProtoFuncToUTCString): Ditto.
+ (JSC::dateProtoFuncToDateString): Ditto.
+ (JSC::dateProtoFuncToTimeString): Ditto.
+ (JSC::dateProtoFuncToLocaleString): Ditto.
+ (JSC::dateProtoFuncToLocaleDateString): Ditto.
+ (JSC::dateProtoFuncToLocaleTimeString): Ditto.
+ (JSC::dateProtoFuncValueOf): Ditto.
+ (JSC::dateProtoFuncGetTime): Ditto.
+ (JSC::dateProtoFuncGetFullYear): Ditto.
+ (JSC::dateProtoFuncGetUTCFullYear): Ditto.
+ (JSC::dateProtoFuncToGMTString): Ditto.
+ (JSC::dateProtoFuncGetMonth): Ditto.
+ (JSC::dateProtoFuncGetUTCMonth): Ditto.
+ (JSC::dateProtoFuncGetDate): Ditto.
+ (JSC::dateProtoFuncGetUTCDate): Ditto.
+ (JSC::dateProtoFuncGetDay): Ditto.
+ (JSC::dateProtoFuncGetUTCDay): Ditto.
+ (JSC::dateProtoFuncGetHours): Ditto.
+ (JSC::dateProtoFuncGetUTCHours): Ditto.
+ (JSC::dateProtoFuncGetMinutes): Ditto.
+ (JSC::dateProtoFuncGetUTCMinutes): Ditto.
+ (JSC::dateProtoFuncGetSeconds): Ditto.
+ (JSC::dateProtoFuncGetUTCSeconds): Ditto.
+ (JSC::dateProtoFuncGetMilliSeconds): Ditto.
+ (JSC::dateProtoFuncGetUTCMilliseconds): Ditto.
+ (JSC::dateProtoFuncGetTimezoneOffset): Ditto.
+ (JSC::dateProtoFuncSetTime): Ditto.
+ (JSC::setNewValueFromTimeArgs): Ditto.
+ (JSC::setNewValueFromDateArgs): Ditto.
+ (JSC::dateProtoFuncSetYear): Ditto.
+ (JSC::dateProtoFuncGetYear): Ditto.
+
+ * kjs/DebuggerCallFrame.cpp:
+ (JSC::DebuggerCallFrame::thisObject): Use asObject.
+ (JSC::DebuggerCallFrame::evaluate): Use noValue.
+ * kjs/DebuggerCallFrame.h: Added a constructor that
+ takes only a callFrame.
+
+ * kjs/ExecState.h:
+ (JSC::ExecState::clearException): Use noValue.
+
+ * kjs/FunctionPrototype.cpp:
+ (JSC::functionProtoFuncToString): Use asFunction.
+ (JSC::functionProtoFuncApply): Use asArguments and asArray.
+
+ * kjs/GetterSetter.cpp:
+ (JSC::GetterSetter::getPrimitiveNumber): Use noValue.
+
+ * kjs/GetterSetter.h:
+ (JSC::asGetterSetter): Added.
+
+ * kjs/InternalFunction.cpp:
+ (JSC::InternalFunction::name): Use asString.
+
+ * kjs/InternalFunction.h:
+ (JSC::asInternalFunction): Added.
+
+ * kjs/JSActivation.cpp:
+ (JSC::JSActivation::argumentsGetter): Use asActivation.
+
+ * kjs/JSActivation.h:
+ (JSC::asActivation): Added.
+
+ * kjs/JSArray.cpp:
+ (JSC::JSArray::putSlowCase): Use noValue.
+ (JSC::JSArray::deleteProperty): Ditto.
+ (JSC::JSArray::increaseVectorLength): Ditto.
+ (JSC::JSArray::setLength): Ditto.
+ (JSC::JSArray::pop): Ditto.
+ (JSC::JSArray::sort): Ditto.
+ (JSC::JSArray::compactForSorting): Ditto.
+ * kjs/JSArray.h:
+ (JSC::asArray): Added.
+
+ * kjs/JSCell.cpp:
+ (JSC::JSCell::getJSNumber): Use noValue.
+
+ * kjs/JSCell.h:
+ (JSC::asCell): Added.
+ (JSC::JSValue::asCell): Changed to not preserve const.
+ Given the wide use of JSValue* and JSCell*, it's not
+ really useful to use const.
+ (JSC::JSValue::isNumber): Use asValue.
+ (JSC::JSValue::isString): Ditto.
+ (JSC::JSValue::isGetterSetter): Ditto.
+ (JSC::JSValue::isObject): Ditto.
+ (JSC::JSValue::getNumber): Ditto.
+ (JSC::JSValue::getString): Ditto.
+ (JSC::JSValue::getObject): Ditto.
+ (JSC::JSValue::getCallData): Ditto.
+ (JSC::JSValue::getConstructData): Ditto.
+ (JSC::JSValue::getUInt32): Ditto.
+ (JSC::JSValue::getTruncatedInt32): Ditto.
+ (JSC::JSValue::getTruncatedUInt32): Ditto.
+ (JSC::JSValue::mark): Ditto.
+ (JSC::JSValue::marked): Ditto.
+ (JSC::JSValue::toPrimitive): Ditto.
+ (JSC::JSValue::getPrimitiveNumber): Ditto.
+ (JSC::JSValue::toBoolean): Ditto.
+ (JSC::JSValue::toNumber): Ditto.
+ (JSC::JSValue::toString): Ditto.
+ (JSC::JSValue::toObject): Ditto.
+ (JSC::JSValue::toThisObject): Ditto.
+ (JSC::JSValue::needsThisConversion): Ditto.
+ (JSC::JSValue::toThisString): Ditto.
+ (JSC::JSValue::getJSNumber): Ditto.
+
+ * kjs/JSFunction.cpp:
+ (JSC::JSFunction::argumentsGetter): Use asFunction.
+ (JSC::JSFunction::callerGetter): Ditto.
+ (JSC::JSFunction::lengthGetter): Ditto.
+ (JSC::JSFunction::construct): Use asObject.
+
+ * kjs/JSFunction.h:
+ (JSC::asFunction): Added.
+
+ * kjs/JSGlobalObject.cpp:
+ (JSC::lastInPrototypeChain): Use asObject.
+
+ * kjs/JSGlobalObject.h:
+ (JSC::asGlobalObject): Added.
+ (JSC::ScopeChainNode::globalObject): Use asGlobalObject.
+
+ * kjs/JSImmediate.h: Added noValue, asPointer, and makeValue
+ functions. Use rawValue, makeValue, and noValue consistently
+ instead of doing reinterpret_cast in various functions.
+
+ * kjs/JSNumberCell.h:
+ (JSC::asNumberCell): Added.
+ (JSC::JSValue::uncheckedGetNumber): Use asValue and asNumberCell.
+ (JSC::JSValue::toJSNumber): Use asValue.
+
+ * kjs/JSObject.cpp:
+ (JSC::JSObject::put): Use asObject and asGetterSetter.
+ (JSC::callDefaultValueFunction): Use noValue.
+ (JSC::JSObject::defineGetter): Use asGetterSetter.
+ (JSC::JSObject::defineSetter): Ditto.
+ (JSC::JSObject::lookupGetter): Ditto. Also use asObject.
+ (JSC::JSObject::lookupSetter): Ditto.
+ (JSC::JSObject::hasInstance): Use asObject.
+ (JSC::JSObject::fillGetterPropertySlot): Use asGetterSetter.
+
+ * kjs/JSObject.h:
+ (JSC::JSObject::getDirect): Use noValue.
+ (JSC::asObject): Added.
+ (JSC::JSValue::isObject): Use asValue.
+ (JSC::JSObject::get): Removed unneeded const_cast.
+ (JSC::JSObject::getPropertySlot): Use asObject.
+ (JSC::JSValue::get): Removed unneeded const_cast.
+ Use asValue, asCell, and asObject.
+ (JSC::JSValue::put): Ditto.
+ (JSC::JSObject::allocatePropertyStorageInline): Fixed spelling
+ of "oldPropertStorage".
+
+ * kjs/JSString.cpp:
+ (JSC::JSString::getOwnPropertySlot): Use asObject.
+
+ * kjs/JSString.h:
+ (JSC::asString): Added.
+ (JSC::JSValue::toThisJSString): Use asValue.
+
+ * kjs/JSValue.h: Make PreferredPrimitiveType a top level enum
+ instead of a member of JSValue. Added an asValue function that
+ returns this. Removed overload of asCell for const. Use asValue
+ instead of getting right at this.
+
+ * kjs/ObjectPrototype.cpp:
+ (JSC::objectProtoFuncIsPrototypeOf): Use asObject.
+ (JSC::objectProtoFuncDefineGetter): Ditto.
+ (JSC::objectProtoFuncDefineSetter): Ditto.
+
+ * kjs/PropertySlot.h:
+ (JSC::PropertySlot::PropertySlot): Take a const JSValue* so the
+ callers don't have to worry about const.
+ (JSC::PropertySlot::clearBase): Use noValue.
+ (JSC::PropertySlot::clearValue): Ditto.
+
+ * kjs/RegExpConstructor.cpp:
+ (JSC::regExpConstructorDollar1): Use asRegExpConstructor.
+ (JSC::regExpConstructorDollar2): Ditto.
+ (JSC::regExpConstructorDollar3): Ditto.
+ (JSC::regExpConstructorDollar4): Ditto.
+ (JSC::regExpConstructorDollar5): Ditto.
+ (JSC::regExpConstructorDollar6): Ditto.
+ (JSC::regExpConstructorDollar7): Ditto.
+ (JSC::regExpConstructorDollar8): Ditto.
+ (JSC::regExpConstructorDollar9): Ditto.
+ (JSC::regExpConstructorInput): Ditto.
+ (JSC::regExpConstructorMultiline): Ditto.
+ (JSC::regExpConstructorLastMatch): Ditto.
+ (JSC::regExpConstructorLastParen): Ditto.
+ (JSC::regExpConstructorLeftContext): Ditto.
+ (JSC::regExpConstructorRightContext): Ditto.
+ (JSC::setRegExpConstructorInput): Ditto.
+ (JSC::setRegExpConstructorMultiline): Ditto.
+ (JSC::constructRegExp): Use asObject.
+
+ * kjs/RegExpConstructor.h:
+ (JSC::asRegExpConstructor): Added.
+
+ * kjs/RegExpObject.cpp:
+ (JSC::regExpObjectGlobal): Use asRegExpObject.
+ (JSC::regExpObjectIgnoreCase): Ditto.
+ (JSC::regExpObjectMultiline): Ditto.
+ (JSC::regExpObjectSource): Ditto.
+ (JSC::regExpObjectLastIndex): Ditto.
+ (JSC::setRegExpObjectLastIndex): Ditto.
+ (JSC::callRegExpObject): Ditto.
+
+ * kjs/RegExpObject.h:
+ (JSC::asRegExpObject): Added.
+
+ * kjs/RegExpPrototype.cpp:
+ (JSC::regExpProtoFuncTest): Use asRegExpObject.
+ (JSC::regExpProtoFuncExec): Ditto.
+ (JSC::regExpProtoFuncCompile): Ditto.
+ (JSC::regExpProtoFuncToString): Ditto.
+
+ * kjs/StringObject.h:
+ (JSC::StringObject::internalValue): Use asString.
+ (JSC::asStringObject): Added.
+
+ * kjs/StringPrototype.cpp:
+ (JSC::stringProtoFuncReplace): Use asRegExpObject.
+ (JSC::stringProtoFuncToString): Ue asStringObject.
+ (JSC::stringProtoFuncMatch): Use asRegExpObject.
+ (JSC::stringProtoFuncSearch): Ditto.
+ (JSC::stringProtoFuncSplit): Ditto.
+
+ * kjs/StructureID.cpp:
+ (JSC::StructureID::getEnumerablePropertyNames): Use asObject.
+ (JSC::StructureID::createCachedPrototypeChain): Ditto.
+ (JSC::StructureIDChain::StructureIDChain): Use asCell and asObject.
+
+ * kjs/collector.h:
+ (JSC::Heap::isNumber): Removed null handling. This can only be called
+ on valid cells.
+ (JSC::Heap::cellBlock): Removed overload for const and non-const.
+ Whether the JSCell* is const or not really should have no effect on
+ whether you can modify the collector block it's in.
+
+ * kjs/interpreter.cpp:
+ (JSC::Interpreter::evaluate): Use noValue and noObject.
+
+ * kjs/nodes.cpp:
+ (JSC::FunctionCallResolveNode::emitCode): Use JSObject for the global
+ object rather than JSValue.
+ (JSC::PostfixResolveNode::emitCode): Ditto.
+ (JSC::PrefixResolveNode::emitCode): Ditto.
+ (JSC::ReadModifyResolveNode::emitCode): Ditto.
+ (JSC::AssignResolveNode::emitCode): Ditto.
+
+ * kjs/operations.h:
+ (JSC::equalSlowCaseInline): Use asString, asCell, asNumberCell,
+ (JSC::strictEqualSlowCaseInline): Ditto.
+
+2008-10-18 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 21702: Special op_create_activation for the case where there are no named parameters
+ <https://bugs.webkit.org/show_bug.cgi?id=21702>
+
+ This is a 2.5% speedup on the V8 Raytrace benchmark and a 1.1% speedup
+ on the V8 Earley-Boyer benchmark.
+
+ * VM/CTI.cpp:
+ (JSC::CTI::privateCompileMainPass):
+ * VM/Machine.cpp:
+ (JSC::Machine::cti_op_create_arguments_no_params):
+ * VM/Machine.h:
+ * kjs/Arguments.h:
+ (JSC::Arguments::):
+ (JSC::Arguments::Arguments):
+
+2008-10-17 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ - in debug builds, alter the stack to avoid blowing out MallocStackLogging
+
+ (In essence, while executing a CTI function we alter the return
+ address to jscGeneratedNativeCode so that a single consistent
+ function is on the stack instead of many random functions without
+ symbols.)
+
+ * VM/CTI.h:
+ * VM/Machine.cpp:
+ (JSC::doSetReturnAddress):
+ (JSC::):
+ (JSC::StackHack::StackHack):
+ (JSC::StackHack::~StackHack):
+ (JSC::Machine::cti_op_convert_this):
+ (JSC::Machine::cti_op_end):
+ (JSC::Machine::cti_op_add):
+ (JSC::Machine::cti_op_pre_inc):
+ (JSC::Machine::cti_timeout_check):
+ (JSC::Machine::cti_register_file_check):
+ (JSC::Machine::cti_op_loop_if_less):
+ (JSC::Machine::cti_op_loop_if_lesseq):
+ (JSC::Machine::cti_op_new_object):
+ (JSC::Machine::cti_op_put_by_id):
+ (JSC::Machine::cti_op_put_by_id_second):
+ (JSC::Machine::cti_op_put_by_id_generic):
+ (JSC::Machine::cti_op_put_by_id_fail):
+ (JSC::Machine::cti_op_get_by_id):
+ (JSC::Machine::cti_op_get_by_id_second):
+ (JSC::Machine::cti_op_get_by_id_generic):
+ (JSC::Machine::cti_op_get_by_id_fail):
+ (JSC::Machine::cti_op_instanceof):
+ (JSC::Machine::cti_op_del_by_id):
+ (JSC::Machine::cti_op_mul):
+ (JSC::Machine::cti_op_new_func):
+ (JSC::Machine::cti_op_call_profiler):
+ (JSC::Machine::cti_op_call_JSFunction):
+ (JSC::Machine::cti_vm_lazyLinkCall):
+ (JSC::Machine::cti_vm_compile):
+ (JSC::Machine::cti_op_push_activation):
+ (JSC::Machine::cti_op_call_NotJSFunction):
+ (JSC::Machine::cti_op_create_arguments):
+ (JSC::Machine::cti_op_tear_off_activation):
+ (JSC::Machine::cti_op_tear_off_arguments):
+ (JSC::Machine::cti_op_ret_profiler):
+ (JSC::Machine::cti_op_ret_scopeChain):
+ (JSC::Machine::cti_op_new_array):
+ (JSC::Machine::cti_op_resolve):
+ (JSC::Machine::cti_op_construct_JSConstructFast):
+ (JSC::Machine::cti_op_construct_JSConstruct):
+ (JSC::Machine::cti_op_construct_NotJSConstruct):
+ (JSC::Machine::cti_op_get_by_val):
+ (JSC::Machine::cti_op_resolve_func):
+ (JSC::Machine::cti_op_sub):
+ (JSC::Machine::cti_op_put_by_val):
+ (JSC::Machine::cti_op_put_by_val_array):
+ (JSC::Machine::cti_op_lesseq):
+ (JSC::Machine::cti_op_loop_if_true):
+ (JSC::Machine::cti_op_negate):
+ (JSC::Machine::cti_op_resolve_base):
+ (JSC::Machine::cti_op_resolve_skip):
+ (JSC::Machine::cti_op_resolve_global):
+ (JSC::Machine::cti_op_div):
+ (JSC::Machine::cti_op_pre_dec):
+ (JSC::Machine::cti_op_jless):
+ (JSC::Machine::cti_op_not):
+ (JSC::Machine::cti_op_jtrue):
+ (JSC::Machine::cti_op_post_inc):
+ (JSC::Machine::cti_op_eq):
+ (JSC::Machine::cti_op_lshift):
+ (JSC::Machine::cti_op_bitand):
+ (JSC::Machine::cti_op_rshift):
+ (JSC::Machine::cti_op_bitnot):
+ (JSC::Machine::cti_op_resolve_with_base):
+ (JSC::Machine::cti_op_new_func_exp):
+ (JSC::Machine::cti_op_mod):
+ (JSC::Machine::cti_op_less):
+ (JSC::Machine::cti_op_neq):
+ (JSC::Machine::cti_op_post_dec):
+ (JSC::Machine::cti_op_urshift):
+ (JSC::Machine::cti_op_bitxor):
+ (JSC::Machine::cti_op_new_regexp):
+ (JSC::Machine::cti_op_bitor):
+ (JSC::Machine::cti_op_call_eval):
+ (JSC::Machine::cti_op_throw):
+ (JSC::Machine::cti_op_get_pnames):
+ (JSC::Machine::cti_op_next_pname):
+ (JSC::Machine::cti_op_push_scope):
+ (JSC::Machine::cti_op_pop_scope):
+ (JSC::Machine::cti_op_typeof):
+ (JSC::Machine::cti_op_is_undefined):
+ (JSC::Machine::cti_op_is_boolean):
+ (JSC::Machine::cti_op_is_number):
+ (JSC::Machine::cti_op_is_string):
+ (JSC::Machine::cti_op_is_object):
+ (JSC::Machine::cti_op_is_function):
+ (JSC::Machine::cti_op_stricteq):
+ (JSC::Machine::cti_op_nstricteq):
+ (JSC::Machine::cti_op_to_jsnumber):
+ (JSC::Machine::cti_op_in):
+ (JSC::Machine::cti_op_push_new_scope):
+ (JSC::Machine::cti_op_jmp_scopes):
+ (JSC::Machine::cti_op_put_by_index):
+ (JSC::Machine::cti_op_switch_imm):
+ (JSC::Machine::cti_op_switch_char):
+ (JSC::Machine::cti_op_switch_string):
+ (JSC::Machine::cti_op_del_by_val):
+ (JSC::Machine::cti_op_put_getter):
+ (JSC::Machine::cti_op_put_setter):
+ (JSC::Machine::cti_op_new_error):
+ (JSC::Machine::cti_op_debug):
+ (JSC::Machine::cti_vm_throw):
+
+2008-10-17 Gavin Barraclough <barraclough@apple.com>
+
+ Optimize op_call by allowing call sites to be directly linked to callees.
+
+ For the hot path of op_call, CTI now generates a check (initially for an impossible
+ value), and the first time the call is executed we attempt to link the call directly
+ to the callee. We can currently only do so if the arity of the caller and callee
+ match. The (optimized) setup for the call on the hot path is linked directly to
+ the ctiCode for the callee, without indirection.
+
+ Two forms of the slow case of the call are generated, the first will be executed the
+ first time the call is reached. As well as this path attempting to link the call to
+ a callee, it also relinks the slow case to a second slow case, which will not continue
+ to attempt relinking the call. (This policy could be changed in future, but for not
+ this is intended to prevent thrashing).
+
+ If a callee that the caller has been linked to is garbage collected, then the link
+ in the caller's JIt code will be reset back to a value that cannot match - to prevent
+ any false positive matches.
+
+ ~20% progression on deltablue & richards, >12% overall reduction in v8-tests
+ runtime, one or two percent progression on sunspider.
+
+ Reviewed by Oliver Hunt.
+
+ * VM/CTI.cpp:
+ (JSC::):
+ (JSC::CTI::emitNakedCall):
+ (JSC::unreachable):
+ (JSC::CTI::compileOpCallInitializeCallFrame):
+ (JSC::CTI::compileOpCallSetupArgs):
+ (JSC::CTI::compileOpCall):
+ (JSC::CTI::privateCompileMainPass):
+ (JSC::CTI::privateCompileSlowCases):
+ (JSC::CTI::privateCompile):
+ (JSC::CTI::unlinkCall):
+ (JSC::CTI::linkCall):
+ * VM/CTI.h:
+ * VM/CodeBlock.cpp:
+ (JSC::CodeBlock::~CodeBlock):
+ (JSC::CodeBlock::unlinkCallers):
+ (JSC::CodeBlock::derefStructureIDs):
+ * VM/CodeBlock.h:
+ (JSC::StructureStubInfo::StructureStubInfo):
+ (JSC::CallLinkInfo::CallLinkInfo):
+ (JSC::CodeBlock::addCaller):
+ (JSC::CodeBlock::removeCaller):
+ (JSC::CodeBlock::getStubInfo):
+ * VM/CodeGenerator.cpp:
+ (JSC::CodeGenerator::emitCall):
+ (JSC::CodeGenerator::emitConstruct):
+ * VM/Machine.cpp:
+ (JSC::Machine::cti_op_call_profiler):
+ (JSC::Machine::cti_op_call_JSFunction):
+ (JSC::Machine::cti_vm_lazyLinkCall):
+ (JSC::Machine::cti_op_construct_JSConstructFast):
+ (JSC::Machine::cti_op_construct_JSConstruct):
+ (JSC::Machine::cti_op_construct_NotJSConstruct):
+ * VM/Machine.h:
+ * kjs/JSFunction.cpp:
+ (JSC::JSFunction::~JSFunction):
+ * kjs/JSFunction.h:
+ * kjs/nodes.h:
+ (JSC::FunctionBodyNode::):
+ * masm/X86Assembler.h:
+ (JSC::X86Assembler::getDifferenceBetweenLabels):
+
+2008-10-17 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ - remove ASSERT that makes the leaks buildbot cry
+
+ * kjs/JSFunction.cpp:
+ (JSC::JSFunction::JSFunction):
+
+2008-10-17 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Cameron Zwarich
+
+ - don't bother to do arguments tearoff when it will have no effect
+
+ ~1% on v8 raytrace
+
+ * VM/CodeGenerator.cpp:
+ (JSC::CodeGenerator::emitReturn):
+
+2008-10-17 Marco Barisione <marco.barisione@collabora.co.uk>
+
+ Reviewed by Sam Weinig. Landed by Jan Alonzo.
+
+ https://bugs.webkit.org/show_bug.cgi?id=21603
+ [GTK] Minor fixes to GOwnPtr
+
+ * wtf/GOwnPtr.cpp:
+ (WTF::GError):
+ (WTF::GList):
+ (WTF::GCond):
+ (WTF::GMutex):
+ (WTF::GPatternSpec):
+ (WTF::GDir):
+ * wtf/GOwnPtr.h:
+ (WTF::freeOwnedGPtr):
+ (WTF::GOwnPtr::~GOwnPtr):
+ (WTF::GOwnPtr::outPtr):
+ (WTF::GOwnPtr::set):
+ (WTF::GOwnPtr::clear):
+ * wtf/Threading.h:
+
+2008-10-17 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ - speed up transitions that resize the property storage a fair bit
+
+ ~3% speedup on v8 RayTrace benchmark, ~1% on DeltaBlue
+
+ * VM/CTI.cpp:
+ (JSC::resizePropertyStorage): renamed from transitionObject, and reduced to just resize
+ the object's property storage with one inline call.
+ (JSC::CTI::privateCompilePutByIdTransition): Use a separate function for property storage
+ resize, but still do all the rest of the work in assembly in that case, and pass the known
+ compile-time constants of old and new size rather than structureIDs, saving a bunch of
+ redundant memory access.
+ * kjs/JSObject.cpp:
+ (JSC::JSObject::allocatePropertyStorage): Just call the inline version.
+ * kjs/JSObject.h:
+ (JSC::JSObject::allocatePropertyStorageInline): Inline version of allocatePropertyStorage
+ * masm/X86Assembler.h:
+ (JSC::X86Assembler::):
+ (JSC::X86Assembler::pushl_i32): Add code to assmeble push of a constant; code originally by Cameron Zwarich.
+
+2008-10-17 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Remove some C style casts.
+
+ * masm/X86Assembler.h:
+ (JSC::JITCodeBuffer::putIntUnchecked):
+ (JSC::X86Assembler::link):
+ (JSC::X86Assembler::linkAbsoluteAddress):
+ (JSC::X86Assembler::getRelocatedAddress):
+
+2008-10-17 Cameron Zwarich <zwarich@apple.com>
+
+ Rubber-stamped by Maciej Stachowiak.
+
+ Remove some C style casts.
+
+ * VM/CTI.cpp:
+ (JSC::CTI::patchGetByIdSelf):
+ (JSC::CTI::patchPutByIdReplace):
+ * VM/Machine.cpp:
+ (JSC::Machine::tryCTICachePutByID):
+ (JSC::Machine::tryCTICacheGetByID):
+ (JSC::Machine::cti_op_put_by_id):
+ (JSC::Machine::cti_op_put_by_id_fail):
+ (JSC::Machine::cti_op_get_by_id):
+ (JSC::Machine::cti_op_get_by_id_fail):
+
+2008-10-17 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ - Avoid restoring the caller's 'r' value in op_ret
+ https://bugs.webkit.org/show_bug.cgi?id=21319
+
+ This patch stops writing the call frame at call and return points;
+ instead it does so immediately before any CTI call.
+
+ 0.5% speedup or so on the v8 benchmark
+
+ * VM/CTI.cpp:
+ (JSC::CTI::emitCTICall):
+ (JSC::CTI::compileOpCall):
+ (JSC::CTI::emitSlowScriptCheck):
+ (JSC::CTI::compileBinaryArithOpSlowCase):
+ (JSC::CTI::privateCompileMainPass):
+ (JSC::CTI::privateCompileSlowCases):
+ (JSC::CTI::privateCompile):
+ * VM/CTI.h:
+
+2008-10-17 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Make WREC require CTI because it won't actually compile otherwise.
+
+ * wtf/Platform.h:
+
+2008-10-16 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ - fixed <rdar://problem/5806316> JavaScriptCore should not force building with gcc 4.0
+ - use gcc 4.2 when building with Xcode 3.1 or newer on Leopard, even though this is not the default
+
+ This time there is no performance regression; we can avoid having
+ to use the fastcall calling convention for CTI functions by using
+ varargs to prevent the compiler from moving things around on the
+ stack.
+
+ * Configurations/DebugRelease.xcconfig:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * VM/CTI.cpp:
+ * VM/Machine.h:
+ * wtf/Platform.h:
+
+2008-10-16 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ - fix for REGRESSION: r37631 causing crashes on buildbot
+ https://bugs.webkit.org/show_bug.cgi?id=21682
+
+ * kjs/collector.cpp:
+ (JSC::Heap::collect): Avoid crashing when a GC occurs while no global objects are live.
+
+2008-10-16 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Maciej Stachowiak.
+
+ Fix for https://bugs.webkit.org/show_bug.cgi?id=21683
+ Don't create intermediate StructureIDs for builtin objects
+
+ First step in reduce number of StructureIDs created when initializing the
+ JSGlobalObject.
+
+ - In order to avoid creating the intermediate StructureIDs use the new putDirectWithoutTransition
+ and putDirectFunctionWithoutTransition to add properties to JSObjects without transitioning
+ the StructureID. This patch just implements this strategy for ObjectPrototype but alone
+ reduces the number of StructureIDs create for about:blank by 10, from 142 to 132.
+
+ * kjs/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::reset):
+ * kjs/JSObject.cpp:
+ (JSC::JSObject::putDirectFunctionWithoutTransition):
+ * kjs/JSObject.h:
+ (JSC::JSObject::putDirectWithoutTransition):
+ * kjs/ObjectPrototype.cpp:
+ (JSC::ObjectPrototype::ObjectPrototype):
+ * kjs/ObjectPrototype.h:
+ * kjs/StructureID.cpp:
+ (JSC::StructureID::addPropertyWithoutTransition):
+ * kjs/StructureID.h:
+
+2008-10-16 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ - fix for: REGRESSION: over 100 StructureIDs leak loading about:blank (result of fix for bug 21633)
+
+ Apparent slight progression (< 0.5%) on v8 benchmarks and SunSpider.
+
+ * kjs/StructureID.cpp:
+ (JSC::StructureID::~StructureID): Don't deref this object's parent's pointer to
+ itself from the destructor; that doesn't even make sense.
+ (JSC::StructureID::addPropertyTransition): Don't refer the single transition;
+ the rule is that parent StructureIDs are ref'd but child ones are not. Refing
+ the child creates a cycle.
+
+2008-10-15 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=21609
+ Make MessagePorts protect their peers across heaps
+
+ * JavaScriptCore.exp:
+ * kjs/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::markCrossHeapDependentObjects):
+ * kjs/JSGlobalObject.h:
+ * kjs/collector.cpp:
+ (JSC::Heap::collect):
+ Before GC sweep phase, a function supplied by global object is now called for all global
+ objects in the heap, making it possible to implement cross-heap dependencies.
+
+2008-10-15 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=21610
+ run-webkit-threads --threaded crashes in StructureID destructor
+
+ * kjs/StructureID.cpp:
+ (JSC::StructureID::StructureID):
+ (JSC::StructureID::~StructureID):
+ Protect access to a static (debug-only) HashSet with a lock.
+
+2008-10-15 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Goeffrey Garen.
+
+ Add function to dump statistics for StructureIDs.
+
+ * kjs/StructureID.cpp:
+ (JSC::StructureID::dumpStatistics):
+ (JSC::StructureID::StructureID):
+ (JSC::StructureID::~StructureID):
+ * kjs/StructureID.h:
+
+2008-10-15 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Bug 21633: Avoid using a HashMap when there is only a single transition
+ <https://bugs.webkit.org/show_bug.cgi?id=21633>
+
+ This is a 0.8% speedup on SunSpider and between a 0.5% and 1.0% speedup
+ on the V8 benchmark suite, depending on which harness we use. It will
+ also slightly reduce the memory footprint of a StructureID.
+
+ * kjs/StructureID.cpp:
+ (JSC::StructureID::StructureID):
+ (JSC::StructureID::~StructureID):
+ (JSC::StructureID::addPropertyTransition):
+ * kjs/StructureID.h:
+ (JSC::StructureID::):
+
+2008-10-15 Csaba Osztrogonac <oszi@inf.u-szeged.hu>
+
+ Reviewed by Geoffrey Garen.
+
+ 1.40% speedup on SunSpider, 1.44% speedup on V8. (Linux)
+
+ No change on Mac.
+
+ * VM/Machine.cpp:
+ (JSC::fastIsNumber): ALWAYS_INLINE modifier added.
+
+2008-10-15 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ Fixed https://bugs.webkit.org/show_bug.cgi?id=21345
+ Start the debugger without reloading the inspected page
+
+ * JavaScriptCore.exp: New symbols.
+ * JavaScriptCore.xcodeproj/project.pbxproj: New files.
+
+ * VM/CodeBlock.h:
+ (JSC::EvalCodeCache::get): Updated for tweak to parsing API.
+
+ * kjs/CollectorHeapIterator.h: Added. An iterator for the object heap,
+ which we use to find all the live functions and recompile them.
+
+ * kjs/DebuggerCallFrame.cpp:
+ (JSC::DebuggerCallFrame::evaluate): Updated for tweak to parsing API.
+
+ * kjs/FunctionConstructor.cpp:
+ (JSC::constructFunction): Updated for tweak to parsing API.
+
+ * kjs/JSFunction.cpp:
+ (JSC::JSFunction::JSFunction): Try to validate our SourceCode in debug
+ builds by ASSERTing that it's syntactically valid. This doesn't catch
+ all SourceCode bugs, but it catches a lot of them.
+
+ * kjs/JSGlobalObjectFunctions.cpp:
+ (JSC::globalFuncEval): Updated for tweak to parsing API.
+
+ * kjs/Parser.cpp:
+ (JSC::Parser::parse):
+ * kjs/Parser.h:
+ (JSC::Parser::parse): Tweaked the parser to make it possible to parse
+ without an ExecState, and to allow the client to specify a debugger to
+ notify (or not) about the source we parse. This allows the inspector
+ to recompile even though no JavaScript is executing, then notify the
+ debugger about all source code when it's done.
+
+ * kjs/Shell.cpp:
+ (prettyPrintScript): Updated for tweak to parsing API.
+
+ * kjs/SourceRange.h:
+ (JSC::SourceCode::isNull): Added to help with ASSERTs.
+
+ * kjs/collector.cpp:
+ (JSC::Heap::heapAllocate):
+ (JSC::Heap::sweep):
+ (JSC::Heap::primaryHeapBegin):
+ (JSC::Heap::primaryHeapEnd):
+ * kjs/collector.h:
+ (JSC::): Moved a bunch of declarations around to enable compilation of
+ CollectorHeapIterator.
+
+ * kjs/interpreter.cpp:
+ (JSC::Interpreter::checkSyntax):
+ (JSC::Interpreter::evaluate): Updated for tweak to parsing API.
+
+ * kjs/lexer.h:
+ (JSC::Lexer::sourceCode): BUG FIX: Calculate SourceCode ranges relative
+ to the SourceCode range in which we're lexing, otherwise nested functions
+ that are compiled individually get SourceCode ranges that don't reflect
+ their nesting.
+
+ * kjs/nodes.cpp:
+ (JSC::FunctionBodyNode::FunctionBodyNode):
+ (JSC::FunctionBodyNode::finishParsing):
+ (JSC::FunctionBodyNode::create):
+ (JSC::FunctionBodyNode::copyParameters):
+ * kjs/nodes.h:
+ (JSC::ScopeNode::setSource):
+ (JSC::FunctionBodyNode::parameterCount): Added some helper functions for
+ copying one FunctionBodyNode's parameters to another. The recompiler uses
+ these when calling "finishParsing".
+
+2008-10-15 Joerg Bornemann <joerg.bornemann@trolltech.com>
+
+ Reviewed by Darin Adler.
+
+ - part of https://bugs.webkit.org/show_bug.cgi?id=20746
+ Fix compilation on Windows CE.
+
+ str(n)icmp, strdup and vsnprintf are not available on Windows CE,
+ they are called _str(n)icmp, etc. instead
+
+ * wtf/StringExtras.h: Added inline function implementations.
+
+2008-10-15 Gabor Loki <loki@inf.u-szeged.hu>
+
+ Reviewed by Cameron Zwarich.
+
+ <https://bugs.webkit.org/show_bug.cgi?id=20912>
+ Use simple uint32_t multiplication on op_mul if both operands are
+ immediate number and they are between zero and 0x7FFF.
+
+ * VM/Machine.cpp:
+ (JSC::Machine::privateExecute):
+
+2008-10-09 Darin Fisher <darin@chromium.org>
+
+ Reviewed by Sam Weinig.
+
+ Make pan scrolling a platform configurable option.
+ https://bugs.webkit.org/show_bug.cgi?id=21515
+
+ * wtf/Platform.h: Add ENABLE_PAN_SCROLLING
+
+2008-10-14 Maciej Stachowiak <mjs@apple.com>
+
+ Rubber stamped by Sam Weinig.
+
+ - revert r37572 and r37581 for now
+
+ Turns out GCC 4.2 is still a (small) regression, we'll have to do
+ more work to turn it on.
+
+ * Configurations/DebugRelease.xcconfig:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * VM/CTI.cpp:
+ * VM/CTI.h:
+ * VM/Machine.cpp:
+ (JSC::Machine::cti_op_convert_this):
+ (JSC::Machine::cti_op_end):
+ (JSC::Machine::cti_op_add):
+ (JSC::Machine::cti_op_pre_inc):
+ (JSC::Machine::cti_timeout_check):
+ (JSC::Machine::cti_register_file_check):
+ (JSC::Machine::cti_op_loop_if_less):
+ (JSC::Machine::cti_op_loop_if_lesseq):
+ (JSC::Machine::cti_op_new_object):
+ (JSC::Machine::cti_op_put_by_id):
+ (JSC::Machine::cti_op_put_by_id_second):
+ (JSC::Machine::cti_op_put_by_id_generic):
+ (JSC::Machine::cti_op_put_by_id_fail):
+ (JSC::Machine::cti_op_get_by_id):
+ (JSC::Machine::cti_op_get_by_id_second):
+ (JSC::Machine::cti_op_get_by_id_generic):
+ (JSC::Machine::cti_op_get_by_id_fail):
+ (JSC::Machine::cti_op_instanceof):
+ (JSC::Machine::cti_op_del_by_id):
+ (JSC::Machine::cti_op_mul):
+ (JSC::Machine::cti_op_new_func):
+ (JSC::Machine::cti_op_call_JSFunction):
+ (JSC::Machine::cti_vm_compile):
+ (JSC::Machine::cti_op_push_activation):
+ (JSC::Machine::cti_op_call_NotJSFunction):
+ (JSC::Machine::cti_op_create_arguments):
+ (JSC::Machine::cti_op_tear_off_activation):
+ (JSC::Machine::cti_op_tear_off_arguments):
+ (JSC::Machine::cti_op_ret_profiler):
+ (JSC::Machine::cti_op_ret_scopeChain):
+ (JSC::Machine::cti_op_new_array):
+ (JSC::Machine::cti_op_resolve):
+ (JSC::Machine::cti_op_construct_JSConstruct):
+ (JSC::Machine::cti_op_construct_NotJSConstruct):
+ (JSC::Machine::cti_op_get_by_val):
+ (JSC::Machine::cti_op_resolve_func):
+ (JSC::Machine::cti_op_sub):
+ (JSC::Machine::cti_op_put_by_val):
+ (JSC::Machine::cti_op_put_by_val_array):
+ (JSC::Machine::cti_op_lesseq):
+ (JSC::Machine::cti_op_loop_if_true):
+ (JSC::Machine::cti_op_negate):
+ (JSC::Machine::cti_op_resolve_base):
+ (JSC::Machine::cti_op_resolve_skip):
+ (JSC::Machine::cti_op_resolve_global):
+ (JSC::Machine::cti_op_div):
+ (JSC::Machine::cti_op_pre_dec):
+ (JSC::Machine::cti_op_jless):
+ (JSC::Machine::cti_op_not):
+ (JSC::Machine::cti_op_jtrue):
+ (JSC::Machine::cti_op_post_inc):
+ (JSC::Machine::cti_op_eq):
+ (JSC::Machine::cti_op_lshift):
+ (JSC::Machine::cti_op_bitand):
+ (JSC::Machine::cti_op_rshift):
+ (JSC::Machine::cti_op_bitnot):
+ (JSC::Machine::cti_op_resolve_with_base):
+ (JSC::Machine::cti_op_new_func_exp):
+ (JSC::Machine::cti_op_mod):
+ (JSC::Machine::cti_op_less):
+ (JSC::Machine::cti_op_neq):
+ (JSC::Machine::cti_op_post_dec):
+ (JSC::Machine::cti_op_urshift):
+ (JSC::Machine::cti_op_bitxor):
+ (JSC::Machine::cti_op_new_regexp):
+ (JSC::Machine::cti_op_bitor):
+ (JSC::Machine::cti_op_call_eval):
+ (JSC::Machine::cti_op_throw):
+ (JSC::Machine::cti_op_get_pnames):
+ (JSC::Machine::cti_op_next_pname):
+ (JSC::Machine::cti_op_push_scope):
+ (JSC::Machine::cti_op_pop_scope):
+ (JSC::Machine::cti_op_typeof):
+ (JSC::Machine::cti_op_is_undefined):
+ (JSC::Machine::cti_op_is_boolean):
+ (JSC::Machine::cti_op_is_number):
+ (JSC::Machine::cti_op_is_string):
+ (JSC::Machine::cti_op_is_object):
+ (JSC::Machine::cti_op_is_function):
+ (JSC::Machine::cti_op_stricteq):
+ (JSC::Machine::cti_op_nstricteq):
+ (JSC::Machine::cti_op_to_jsnumber):
+ (JSC::Machine::cti_op_in):
+ (JSC::Machine::cti_op_push_new_scope):
+ (JSC::Machine::cti_op_jmp_scopes):
+ (JSC::Machine::cti_op_put_by_index):
+ (JSC::Machine::cti_op_switch_imm):
+ (JSC::Machine::cti_op_switch_char):
+ (JSC::Machine::cti_op_switch_string):
+ (JSC::Machine::cti_op_del_by_val):
+ (JSC::Machine::cti_op_put_getter):
+ (JSC::Machine::cti_op_put_setter):
+ (JSC::Machine::cti_op_new_error):
+ (JSC::Machine::cti_op_debug):
+ (JSC::Machine::cti_vm_throw):
+ * VM/Machine.h:
+ * masm/X86Assembler.h:
+ (JSC::X86Assembler::emitRestoreArgumentReference):
+ (JSC::X86Assembler::emitRestoreArgumentReferenceForTrampoline):
+ * wtf/Platform.h:
+
+2008-10-14 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=20256
+ Array.push and other standard methods disappear
+
+ * kjs/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData):
+ (JSC::JSGlobalData::~JSGlobalData):
+ Don't use static hash tables even on platforms that don't enable JSC_MULTIPLE_THREADS -
+ these tables reference IdentifierTable, which is always per-GlobalData.
+
+2008-10-14 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ - always use CTI_ARGUMENTS and CTI_ARGUMENTS_FASTCALL
+
+ This is a small regression for GCC 4.0, but simplifies the code
+ for future improvements and lets us focus on GCC 4.2+ and MSVC.
+
+ * VM/CTI.cpp:
+ * VM/CTI.h:
+ * VM/Machine.cpp:
+ (JSC::Machine::cti_op_convert_this):
+ (JSC::Machine::cti_op_end):
+ (JSC::Machine::cti_op_add):
+ (JSC::Machine::cti_op_pre_inc):
+ (JSC::Machine::cti_timeout_check):
+ (JSC::Machine::cti_register_file_check):
+ (JSC::Machine::cti_op_loop_if_less):
+ (JSC::Machine::cti_op_loop_if_lesseq):
+ (JSC::Machine::cti_op_new_object):
+ (JSC::Machine::cti_op_put_by_id):
+ (JSC::Machine::cti_op_put_by_id_second):
+ (JSC::Machine::cti_op_put_by_id_generic):
+ (JSC::Machine::cti_op_put_by_id_fail):
+ (JSC::Machine::cti_op_get_by_id):
+ (JSC::Machine::cti_op_get_by_id_second):
+ (JSC::Machine::cti_op_get_by_id_generic):
+ (JSC::Machine::cti_op_get_by_id_fail):
+ (JSC::Machine::cti_op_instanceof):
+ (JSC::Machine::cti_op_del_by_id):
+ (JSC::Machine::cti_op_mul):
+ (JSC::Machine::cti_op_new_func):
+ (JSC::Machine::cti_op_call_JSFunction):
+ (JSC::Machine::cti_vm_compile):
+ (JSC::Machine::cti_op_push_activation):
+ (JSC::Machine::cti_op_call_NotJSFunction):
+ (JSC::Machine::cti_op_create_arguments):
+ (JSC::Machine::cti_op_tear_off_activation):
+ (JSC::Machine::cti_op_tear_off_arguments):
+ (JSC::Machine::cti_op_ret_profiler):
+ (JSC::Machine::cti_op_ret_scopeChain):
+ (JSC::Machine::cti_op_new_array):
+ (JSC::Machine::cti_op_resolve):
+ (JSC::Machine::cti_op_construct_JSConstruct):
+ (JSC::Machine::cti_op_construct_NotJSConstruct):
+ (JSC::Machine::cti_op_get_by_val):
+ (JSC::Machine::cti_op_resolve_func):
+ (JSC::Machine::cti_op_sub):
+ (JSC::Machine::cti_op_put_by_val):
+ (JSC::Machine::cti_op_put_by_val_array):
+ (JSC::Machine::cti_op_lesseq):
+ (JSC::Machine::cti_op_loop_if_true):
+ (JSC::Machine::cti_op_negate):
+ (JSC::Machine::cti_op_resolve_base):
+ (JSC::Machine::cti_op_resolve_skip):
+ (JSC::Machine::cti_op_resolve_global):
+ (JSC::Machine::cti_op_div):
+ (JSC::Machine::cti_op_pre_dec):
+ (JSC::Machine::cti_op_jless):
+ (JSC::Machine::cti_op_not):
+ (JSC::Machine::cti_op_jtrue):
+ (JSC::Machine::cti_op_post_inc):
+ (JSC::Machine::cti_op_eq):
+ (JSC::Machine::cti_op_lshift):
+ (JSC::Machine::cti_op_bitand):
+ (JSC::Machine::cti_op_rshift):
+ (JSC::Machine::cti_op_bitnot):
+ (JSC::Machine::cti_op_resolve_with_base):
+ (JSC::Machine::cti_op_new_func_exp):
+ (JSC::Machine::cti_op_mod):
+ (JSC::Machine::cti_op_less):
+ (JSC::Machine::cti_op_neq):
+ (JSC::Machine::cti_op_post_dec):
+ (JSC::Machine::cti_op_urshift):
+ (JSC::Machine::cti_op_bitxor):
+ (JSC::Machine::cti_op_new_regexp):
+ (JSC::Machine::cti_op_bitor):
+ (JSC::Machine::cti_op_call_eval):
+ (JSC::Machine::cti_op_throw):
+ (JSC::Machine::cti_op_get_pnames):
+ (JSC::Machine::cti_op_next_pname):
+ (JSC::Machine::cti_op_push_scope):
+ (JSC::Machine::cti_op_pop_scope):
+ (JSC::Machine::cti_op_typeof):
+ (JSC::Machine::cti_op_is_undefined):
+ (JSC::Machine::cti_op_is_boolean):
+ (JSC::Machine::cti_op_is_number):
+ (JSC::Machine::cti_op_is_string):
+ (JSC::Machine::cti_op_is_object):
+ (JSC::Machine::cti_op_is_function):
+ (JSC::Machine::cti_op_stricteq):
+ (JSC::Machine::cti_op_nstricteq):
+ (JSC::Machine::cti_op_to_jsnumber):
+ (JSC::Machine::cti_op_in):
+ (JSC::Machine::cti_op_push_new_scope):
+ (JSC::Machine::cti_op_jmp_scopes):
+ (JSC::Machine::cti_op_put_by_index):
+ (JSC::Machine::cti_op_switch_imm):
+ (JSC::Machine::cti_op_switch_char):
+ (JSC::Machine::cti_op_switch_string):
+ (JSC::Machine::cti_op_del_by_val):
+ (JSC::Machine::cti_op_put_getter):
+ (JSC::Machine::cti_op_put_setter):
+ (JSC::Machine::cti_op_new_error):
+ (JSC::Machine::cti_op_debug):
+ (JSC::Machine::cti_vm_throw):
+ * VM/Machine.h:
+ * masm/X86Assembler.h:
+ (JSC::X86Assembler::emitRestoreArgumentReference):
+ (JSC::X86Assembler::emitRestoreArgumentReferenceForTrampoline):
+ * wtf/Platform.h:
+
+2008-10-13 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ - make Machine::getArgumentsData an Arguments method and inline it
+
+ ~2% on v8 raytrace
+
+ * VM/Machine.cpp:
+ * kjs/Arguments.h:
+ (JSC::Machine::getArgumentsData):
+
+2008-10-13 Alp Toker <alp@nuanti.com>
+
+ Fix autotools dist build target by listing recently added header
+ files only. Not reviewed.
+
+ * GNUmakefile.am:
+
+2008-10-13 Maciej Stachowiak <mjs@apple.com>
+
+ Rubber stamped by Mark Rowe.
+
+ - fixed <rdar://problem/5806316> JavaScriptCore should not force building with gcc 4.0
+ - use gcc 4.2 when building with Xcode 3.1 or newer on Leopard, even though this is not the default
+
+ * Configurations/DebugRelease.xcconfig:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2008-10-13 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Bug 21541: Move RegisterFile growth check to callee
+ <https://bugs.webkit.org/show_bug.cgi?id=21541>
+
+ Move the RegisterFile growth check to the callee in the common case,
+ where some of the information is known statically at JIT time. There is
+ still a check in the caller in the case where the caller provides too
+ few arguments.
+
+ This is a 2.1% speedup on the V8 benchmark, including a 5.1% speedup on
+ the Richards benchmark, a 4.1% speedup on the DeltaBlue benchmark, and a
+ 1.4% speedup on the Earley-Boyer benchmark. It is also a 0.5% speedup on
+ SunSpider.
+
+ * VM/CTI.cpp:
+ (JSC::CTI::privateCompile):
+ * VM/Machine.cpp:
+ (JSC::Machine::cti_register_file_check):
+ (JSC::Machine::cti_op_call_JSFunction):
+ (JSC::Machine::cti_op_construct_JSConstruct):
+ * VM/Machine.h:
+ * VM/RegisterFile.h:
+ * masm/X86Assembler.h:
+ (JSC::X86Assembler::):
+ (JSC::X86Assembler::cmpl_mr):
+ (JSC::X86Assembler::emitUnlinkedJg):
+
+2008-10-13 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Dan Bernstein.
+
+ Fix for https://bugs.webkit.org/show_bug.cgi?id=21577
+ 5 false positive StructureID leaks
+
+ - Add leak ignore set to StructureID to selectively ignore leaking some StructureIDs.
+ - Add create method to JSGlolalData to be used when the data will be intentionally
+ leaked and ignore all leaks caused the StructureIDs stored in it.
+
+ * JavaScriptCore.exp:
+ * kjs/JSGlobalData.cpp:
+ (JSC::JSGlobalData::createLeaked):
+ * kjs/JSGlobalData.h:
+ * kjs/StructureID.cpp:
+ (JSC::StructureID::StructureID):
+ (JSC::StructureID::~StructureID):
+ (JSC::StructureID::startIgnoringLeaks):
+ (JSC::StructureID::stopIgnoringLeaks):
+ * kjs/StructureID.h:
+
+2008-10-13 Marco Barisione <marco.barisione@collabora.co.uk>
+
+ Reviewed by Darin Adler. Landed by Jan Alonzo.
+
+ WebKit GTK Port needs a smartpointer to handle g_free (GFreePtr?)
+ http://bugs.webkit.org/show_bug.cgi?id=20483
+
+ Add a GOwnPtr smart pointer (similar to OwnPtr) to handle memory
+ allocated by GLib and start the conversion to use it.
+
+ * GNUmakefile.am:
+ * wtf/GOwnPtr.cpp: Added.
+ (WTF::GError):
+ (WTF::GList):
+ (WTF::GCond):
+ (WTF::GMutex):
+ (WTF::GPatternSpec):
+ (WTF::GDir):
+ * wtf/GOwnPtr.h: Added.
+ (WTF::freeOwnedPtr):
+ (WTF::GOwnPtr::GOwnPtr):
+ (WTF::GOwnPtr::~GOwnPtr):
+ (WTF::GOwnPtr::get):
+ (WTF::GOwnPtr::release):
+ (WTF::GOwnPtr::rawPtr):
+ (WTF::GOwnPtr::set):
+ (WTF::GOwnPtr::clear):
+ (WTF::GOwnPtr::operator*):
+ (WTF::GOwnPtr::operator->):
+ (WTF::GOwnPtr::operator!):
+ (WTF::GOwnPtr::operator UnspecifiedBoolType):
+ (WTF::GOwnPtr::swap):
+ (WTF::swap):
+ (WTF::operator==):
+ (WTF::operator!=):
+ (WTF::getPtr):
+ * wtf/Threading.h:
+ * wtf/ThreadingGtk.cpp:
+ (WTF::Mutex::~Mutex):
+ (WTF::Mutex::lock):
+ (WTF::Mutex::tryLock):
+ (WTF::Mutex::unlock):
+ (WTF::ThreadCondition::~ThreadCondition):
+ (WTF::ThreadCondition::wait):
+ (WTF::ThreadCondition::timedWait):
+ (WTF::ThreadCondition::signal):
+ (WTF::ThreadCondition::broadcast):
+
+2008-10-12 Gabriella Toth <gtoth@inf.u-szeged.hu>
+
+ Reviewed by Darin Adler.
+
+ - part of https://bugs.webkit.org/show_bug.cgi?id=21055
+ Bug 21055: not invoked functions
+
+ * kjs/nodes.cpp: Deleted a function that is not invoked:
+ statementListInitializeVariableAccessStack.
+
+2008-10-12 Darin Adler <darin@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ * wtf/unicode/icu/UnicodeIcu.h: Fixed indentation to match WebKit coding style.
+ * wtf/unicode/qt4/UnicodeQt4.h: Ditto.
+
+2008-10-12 Darin Adler <darin@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ - https://bugs.webkit.org/show_bug.cgi?id=21556
+ Bug 21556: non-ASCII digits are allowed in places where only ASCII should be
+
+ * wtf/unicode/icu/UnicodeIcu.h: Removed isDigit, digitValue, and isFormatChar.
+ * wtf/unicode/qt4/UnicodeQt4.h: Ditto.
+
+2008-10-12 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Make the append method that takes a Vector more strict - it now requires the elements
+ of the vector to be appended same type as the elements of the Vector they're being appended to.
+
+ This would cause problems when dealing with Vectors containing other Vectors.
+
+ * wtf/Vector.h:
+ (WTF::::append):
+
+2008-10-11 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Clean up RegExpMatchesArray.h to match our coding style.
+
+ * kjs/RegExpMatchesArray.h:
+ (JSC::RegExpMatchesArray::getOwnPropertySlot):
+ (JSC::RegExpMatchesArray::put):
+ (JSC::RegExpMatchesArray::deleteProperty):
+ (JSC::RegExpMatchesArray::getPropertyNames):
+
+2008-10-11 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Bug 21525: 55 StructureID leaks on Wikitravel's main page
+ <https://bugs.webkit.org/show_bug.cgi?id=21525>
+
+ Bug 21533: Simple JavaScript code leaks StructureIDs
+ <https://bugs.webkit.org/show_bug.cgi?id=21533>
+
+ StructureID::getEnumerablePropertyNames() ends up calling back to itself
+ via JSObject::getPropertyNames(), which causes the PropertyNameArray to
+ be cached twice. This leads to a memory leak in almost every use of
+ JSObject::getPropertyNames() on an object. The fix here is based on a
+ suggestion of Sam Weinig.
+
+ This patch also fixes every StructureID leaks that occurs while running
+ the Mozilla MemBuster test.
+
+ * kjs/PropertyNameArray.h:
+ (JSC::PropertyNameArray::PropertyNameArray):
+ (JSC::PropertyNameArray::setCacheable):
+ (JSC::PropertyNameArray::cacheable):
+ * kjs/StructureID.cpp:
+ (JSC::StructureID::getEnumerablePropertyNames):
+
+2008-10-10 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ Use fastcall calling convention on GCC > 4.0
+
+ Results in a 2-3% improvement in GCC 4.2 performance, so
+ that it is no longer a regression vs. GCC 4.0
+
+ * VM/CTI.cpp:
+ * VM/Machine.h:
+ * wtf/Platform.h:
+
+2008-10-10 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ - Add a workaround for a bug in ceil in Darwin libc.
+ - Remove old workarounds for JS math functions that are not needed
+ anymore.
+
+ The math functions are heavily tested by fast/js/math.html.
+
+ * kjs/MathObject.cpp:
+ (JSC::mathProtoFuncAbs): Remove workaround.
+ (JSC::mathProtoFuncCeil): Ditto.
+ (JSC::mathProtoFuncFloor): Ditto.
+ * wtf/MathExtras.h:
+ (wtf_ceil): Add ceil workaround for darwin.
+
+2008-10-10 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Darin Adler
+
+ Add Assertions to JSObject constructor.
+
+ * kjs/JSObject.h:
+ (JSC::JSObject::JSObject):
+
+2008-10-10 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Cameron Zwarich.
+
+ Remove now unused m_getterSetterFlag variable from PropertyMap.
+
+ * kjs/PropertyMap.cpp:
+ (JSC::PropertyMap::operator=):
+ * kjs/PropertyMap.h:
+ (JSC::PropertyMap::PropertyMap):
+
+2008-10-09 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Maciej Stachowiak.
+
+ Add leaks checking to StructureID.
+
+ * kjs/StructureID.cpp:
+ (JSC::StructureID::StructureID):
+ (JSC::StructureID::~StructureID):
+
+2008-10-09 Alp Toker <alp@nuanti.com>
+
+ Reviewed by Mark Rowe.
+
+ https://bugs.webkit.org/show_bug.cgi?id=20760
+ Implement support for x86 Linux in CTI
+
+ Prepare to enable CTI/WREC on supported architectures.
+
+ Make it possible to use the CTI_ARGUMENT workaround with GCC as well
+ as MSVC by fixing some preprocessor conditionals.
+
+ Note that CTI/WREC no longer requires CTI_ARGUMENT on Linux so we
+ don't actually enable it except when building with MSVC. GCC on Win32
+ remains untested.
+
+ Adapt inline ASM code to use the global symbol underscore prefix only
+ on Darwin and to call the properly mangled Machine::cti_vm_throw
+ symbol name depending on CTI_ARGUMENT.
+
+ Also avoid global inclusion of the JIT infrastructure headers
+ throughout WebCore and WebKit causing recompilation of about ~1500
+ source files after modification to X86Assembler.h, CTI.h, WREC.h,
+ which are only used deep inside JavaScriptCore.
+
+ * GNUmakefile.am:
+ * VM/CTI.cpp:
+ * VM/CTI.h:
+ * VM/Machine.cpp:
+ * VM/Machine.h:
+ * kjs/regexp.cpp:
+ (JSC::RegExp::RegExp):
+ (JSC::RegExp::~RegExp):
+ (JSC::RegExp::match):
+ * kjs/regexp.h:
+ * masm/X86Assembler.h:
+ (JSC::X86Assembler::emitConvertToFastCall):
+ (JSC::X86Assembler::emitRestoreArgumentReferenceForTrampoline):
+ (JSC::X86Assembler::emitRestoreArgumentReference):
+
+2008-10-09 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ Fix for bug #21160, x=0;1/(x*-1) == -Infinity
+
+ * ChangeLog:
+ * VM/CTI.cpp:
+ (JSC::CTI::emitFastArithDeTagImmediate):
+ (JSC::CTI::emitFastArithDeTagImmediateJumpIfZero):
+ (JSC::CTI::compileBinaryArithOp):
+ (JSC::CTI::compileBinaryArithOpSlowCase):
+ (JSC::CTI::privateCompileMainPass):
+ (JSC::CTI::privateCompileSlowCases):
+ * VM/CTI.h:
+ * masm/X86Assembler.h:
+ (JSC::X86Assembler::):
+ (JSC::X86Assembler::emitUnlinkedJs):
+
+2008-10-09 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 21459: REGRESSION (r37324): Safari crashes inside JavaScriptCore while browsing hulu.com
+ <https://bugs.webkit.org/show_bug.cgi?id=21459>
+
+ After r37324, an Arguments object does not mark an associated activation
+ object. This change was made because Arguments no longer directly used
+ the activation object in any way. However, if an activation is torn off,
+ then the backing store of Arguments becomes the register array of the
+ activation object. Arguments directly marks all of the arguments, but
+ the activation object is being collected, which causes its register
+ array to be freed and new memory to be allocated in its place.
+
+ Unfortunately, it does not seem possible to reproduce this issue in a
+ layout test.
+
+ * kjs/Arguments.cpp:
+ (JSC::Arguments::mark):
+ * kjs/Arguments.h:
+ (JSC::Arguments::setActivation):
+ (JSC::Arguments::Arguments):
+ (JSC::JSActivation::copyRegisters):
+
+2008-10-09 Ariya Hidayat <ariya.hidayat@trolltech.com>
+
+ Reviewed by Simon.
+
+ Build fix for MinGW.
+
+ * wtf/AlwaysInline.h:
+
+2008-10-08 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Bug 21497: REGRESSION (r37433): Bytecode JSC tests are severely broken
+ <https://bugs.webkit.org/show_bug.cgi?id=21497>
+
+ Fix a typo in r37433 that causes the failure of a large number of JSC
+ tests with the bytecode interpreter enabled.
+
+ * VM/Machine.cpp:
+ (JSC::Machine::privateExecute):
+
+2008-10-08 Mark Rowe <mrowe@apple.com>
+
+ Windows build fix.
+
+ * VM/CTI.cpp:
+ (JSC::): Update type of argument to ctiTrampoline.
+
+2008-10-08 Darin Adler <darin@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ - https://bugs.webkit.org/show_bug.cgi?id=21403
+ Bug 21403: use new CallFrame class rather than Register* for call frame manipulation
+
+ Add CallFrame as a synonym for ExecState. Arguably, some day we should switch every
+ client over to the new name.
+
+ Use CallFrame* consistently rather than Register* or ExecState* in low-level code such
+ as Machine.cpp and CTI.cpp. Similarly, use callFrame rather than r as its name and use
+ accessor functions to get at things in the frame.
+
+ Eliminate other uses of ExecState* that aren't needed, replacing in some cases with
+ JSGlobalData* and in other cases eliminating them entirely.
+
+ * API/JSObjectRef.cpp:
+ (JSObjectMakeFunctionWithCallback):
+ (JSObjectMakeFunction):
+ (JSObjectHasProperty):
+ (JSObjectGetProperty):
+ (JSObjectSetProperty):
+ (JSObjectDeleteProperty):
+ * API/OpaqueJSString.cpp:
+ * API/OpaqueJSString.h:
+ * VM/CTI.cpp:
+ (JSC::CTI::getConstant):
+ (JSC::CTI::emitGetArg):
+ (JSC::CTI::emitGetPutArg):
+ (JSC::CTI::getConstantImmediateNumericArg):
+ (JSC::CTI::printOpcodeOperandTypes):
+ (JSC::CTI::CTI):
+ (JSC::CTI::compileOpCall):
+ (JSC::CTI::compileBinaryArithOp):
+ (JSC::CTI::privateCompileMainPass):
+ (JSC::CTI::privateCompile):
+ (JSC::CTI::privateCompileGetByIdProto):
+ (JSC::CTI::privateCompileGetByIdChain):
+ (JSC::CTI::compileRegExp):
+ * VM/CTI.h:
+ * VM/CodeBlock.h:
+ * VM/CodeGenerator.cpp:
+ (JSC::CodeGenerator::emitEqualityOp):
+ (JSC::CodeGenerator::emitLoad):
+ (JSC::CodeGenerator::emitUnexpectedLoad):
+ (JSC::CodeGenerator::emitConstruct):
+ * VM/CodeGenerator.h:
+ * VM/Machine.cpp:
+ (JSC::jsLess):
+ (JSC::jsLessEq):
+ (JSC::jsAddSlowCase):
+ (JSC::jsAdd):
+ (JSC::jsTypeStringForValue):
+ (JSC::Machine::resolve):
+ (JSC::Machine::resolveSkip):
+ (JSC::Machine::resolveGlobal):
+ (JSC::inlineResolveBase):
+ (JSC::Machine::resolveBase):
+ (JSC::Machine::resolveBaseAndProperty):
+ (JSC::Machine::resolveBaseAndFunc):
+ (JSC::Machine::slideRegisterWindowForCall):
+ (JSC::isNotObject):
+ (JSC::Machine::callEval):
+ (JSC::Machine::dumpCallFrame):
+ (JSC::Machine::dumpRegisters):
+ (JSC::Machine::unwindCallFrame):
+ (JSC::Machine::throwException):
+ (JSC::DynamicGlobalObjectScope::DynamicGlobalObjectScope):
+ (JSC::DynamicGlobalObjectScope::~DynamicGlobalObjectScope):
+ (JSC::Machine::execute):
+ (JSC::Machine::debug):
+ (JSC::Machine::createExceptionScope):
+ (JSC::cachePrototypeChain):
+ (JSC::Machine::tryCachePutByID):
+ (JSC::Machine::tryCacheGetByID):
+ (JSC::Machine::privateExecute):
+ (JSC::Machine::retrieveArguments):
+ (JSC::Machine::retrieveCaller):
+ (JSC::Machine::retrieveLastCaller):
+ (JSC::Machine::findFunctionCallFrame):
+ (JSC::Machine::getArgumentsData):
+ (JSC::Machine::tryCTICachePutByID):
+ (JSC::Machine::getCTIArrayLengthTrampoline):
+ (JSC::Machine::getCTIStringLengthTrampoline):
+ (JSC::Machine::tryCTICacheGetByID):
+ (JSC::Machine::cti_op_convert_this):
+ (JSC::Machine::cti_op_end):
+ (JSC::Machine::cti_op_add):
+ (JSC::Machine::cti_op_pre_inc):
+ (JSC::Machine::cti_timeout_check):
+ (JSC::Machine::cti_op_loop_if_less):
+ (JSC::Machine::cti_op_loop_if_lesseq):
+ (JSC::Machine::cti_op_new_object):
+ (JSC::Machine::cti_op_put_by_id):
+ (JSC::Machine::cti_op_put_by_id_second):
+ (JSC::Machine::cti_op_put_by_id_generic):
+ (JSC::Machine::cti_op_put_by_id_fail):
+ (JSC::Machine::cti_op_get_by_id):
+ (JSC::Machine::cti_op_get_by_id_second):
+ (JSC::Machine::cti_op_get_by_id_generic):
+ (JSC::Machine::cti_op_get_by_id_fail):
+ (JSC::Machine::cti_op_instanceof):
+ (JSC::Machine::cti_op_del_by_id):
+ (JSC::Machine::cti_op_mul):
+ (JSC::Machine::cti_op_new_func):
+ (JSC::Machine::cti_op_call_JSFunction):
+ (JSC::Machine::cti_vm_compile):
+ (JSC::Machine::cti_op_push_activation):
+ (JSC::Machine::cti_op_call_NotJSFunction):
+ (JSC::Machine::cti_op_create_arguments):
+ (JSC::Machine::cti_op_tear_off_activation):
+ (JSC::Machine::cti_op_tear_off_arguments):
+ (JSC::Machine::cti_op_ret_profiler):
+ (JSC::Machine::cti_op_ret_scopeChain):
+ (JSC::Machine::cti_op_new_array):
+ (JSC::Machine::cti_op_resolve):
+ (JSC::Machine::cti_op_construct_JSConstruct):
+ (JSC::Machine::cti_op_construct_NotJSConstruct):
+ (JSC::Machine::cti_op_get_by_val):
+ (JSC::Machine::cti_op_resolve_func):
+ (JSC::Machine::cti_op_sub):
+ (JSC::Machine::cti_op_put_by_val):
+ (JSC::Machine::cti_op_put_by_val_array):
+ (JSC::Machine::cti_op_lesseq):
+ (JSC::Machine::cti_op_loop_if_true):
+ (JSC::Machine::cti_op_negate):
+ (JSC::Machine::cti_op_resolve_base):
+ (JSC::Machine::cti_op_resolve_skip):
+ (JSC::Machine::cti_op_resolve_global):
+ (JSC::Machine::cti_op_div):
+ (JSC::Machine::cti_op_pre_dec):
+ (JSC::Machine::cti_op_jless):
+ (JSC::Machine::cti_op_not):
+ (JSC::Machine::cti_op_jtrue):
+ (JSC::Machine::cti_op_post_inc):
+ (JSC::Machine::cti_op_eq):
+ (JSC::Machine::cti_op_lshift):
+ (JSC::Machine::cti_op_bitand):
+ (JSC::Machine::cti_op_rshift):
+ (JSC::Machine::cti_op_bitnot):
+ (JSC::Machine::cti_op_resolve_with_base):
+ (JSC::Machine::cti_op_new_func_exp):
+ (JSC::Machine::cti_op_mod):
+ (JSC::Machine::cti_op_less):
+ (JSC::Machine::cti_op_neq):
+ (JSC::Machine::cti_op_post_dec):
+ (JSC::Machine::cti_op_urshift):
+ (JSC::Machine::cti_op_bitxor):
+ (JSC::Machine::cti_op_new_regexp):
+ (JSC::Machine::cti_op_bitor):
+ (JSC::Machine::cti_op_call_eval):
+ (JSC::Machine::cti_op_throw):
+ (JSC::Machine::cti_op_get_pnames):
+ (JSC::Machine::cti_op_next_pname):
+ (JSC::Machine::cti_op_push_scope):
+ (JSC::Machine::cti_op_pop_scope):
+ (JSC::Machine::cti_op_typeof):
+ (JSC::Machine::cti_op_to_jsnumber):
+ (JSC::Machine::cti_op_in):
+ (JSC::Machine::cti_op_push_new_scope):
+ (JSC::Machine::cti_op_jmp_scopes):
+ (JSC::Machine::cti_op_put_by_index):
+ (JSC::Machine::cti_op_switch_imm):
+ (JSC::Machine::cti_op_switch_char):
+ (JSC::Machine::cti_op_switch_string):
+ (JSC::Machine::cti_op_del_by_val):
+ (JSC::Machine::cti_op_put_getter):
+ (JSC::Machine::cti_op_put_setter):
+ (JSC::Machine::cti_op_new_error):
+ (JSC::Machine::cti_op_debug):
+ (JSC::Machine::cti_vm_throw):
+ * VM/Machine.h:
+ * VM/Register.h:
+ * VM/RegisterFile.h:
+ * kjs/Arguments.h:
+ * kjs/DebuggerCallFrame.cpp:
+ (JSC::DebuggerCallFrame::functionName):
+ (JSC::DebuggerCallFrame::type):
+ (JSC::DebuggerCallFrame::thisObject):
+ (JSC::DebuggerCallFrame::evaluate):
+ * kjs/DebuggerCallFrame.h:
+ * kjs/ExecState.cpp:
+ (JSC::CallFrame::thisValue):
+ * kjs/ExecState.h:
+ * kjs/FunctionConstructor.cpp:
+ (JSC::constructFunction):
+ * kjs/JSActivation.cpp:
+ (JSC::JSActivation::JSActivation):
+ (JSC::JSActivation::argumentsGetter):
+ * kjs/JSActivation.h:
+ * kjs/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::init):
+ * kjs/JSGlobalObjectFunctions.cpp:
+ (JSC::globalFuncEval):
+ * kjs/JSVariableObject.h:
+ * kjs/Parser.cpp:
+ (JSC::Parser::parse):
+ * kjs/RegExpConstructor.cpp:
+ (JSC::constructRegExp):
+ * kjs/RegExpPrototype.cpp:
+ (JSC::regExpProtoFuncCompile):
+ * kjs/Shell.cpp:
+ (prettyPrintScript):
+ * kjs/StringPrototype.cpp:
+ (JSC::stringProtoFuncMatch):
+ (JSC::stringProtoFuncSearch):
+ * kjs/identifier.cpp:
+ (JSC::Identifier::checkSameIdentifierTable):
+ * kjs/interpreter.cpp:
+ (JSC::Interpreter::checkSyntax):
+ (JSC::Interpreter::evaluate):
+ * kjs/nodes.cpp:
+ (JSC::ThrowableExpressionData::emitThrowError):
+ (JSC::RegExpNode::emitCode):
+ (JSC::ArrayNode::emitCode):
+ (JSC::InstanceOfNode::emitCode):
+ * kjs/nodes.h:
+ * kjs/regexp.cpp:
+ (JSC::RegExp::RegExp):
+ (JSC::RegExp::create):
+ * kjs/regexp.h:
+ * profiler/HeavyProfile.h:
+ * profiler/Profile.h:
+ * wrec/WREC.cpp:
+ * wrec/WREC.h:
+
+2008-10-08 Mark Rowe <mrowe@apple.com>
+
+ Typed by Maciej Stachowiak, reviewed by Mark Rowe.
+
+ Fix crash in fast/js/constant-folding.html with CTI disabled.
+
+ * VM/Machine.cpp:
+ (JSC::Machine::privateExecute):
+
+2008-10-08 Timothy Hatcher <timothy@apple.com>
+
+ Roll out r37427 because it causes an infinite recursion loading about:blank.
+
+ https://bugs.webkit.org/show_bug.cgi?id=21476
+
+2008-10-08 Darin Adler <darin@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ - https://bugs.webkit.org/show_bug.cgi?id=21403
+ Bug 21403: use new CallFrame class rather than Register* for call frame manipulation
+
+ Add CallFrame as a synonym for ExecState. Arguably, some day we should switch every
+ client over to the new name.
+
+ Use CallFrame* consistently rather than Register* or ExecState* in low-level code such
+ as Machine.cpp and CTI.cpp. Similarly, use callFrame rather than r as its name and use
+ accessor functions to get at things in the frame.
+
+ Eliminate other uses of ExecState* that aren't needed, replacing in some cases with
+ JSGlobalData* and in other cases eliminating them entirely.
+
+ * API/JSObjectRef.cpp:
+ (JSObjectMakeFunctionWithCallback):
+ (JSObjectMakeFunction):
+ (JSObjectHasProperty):
+ (JSObjectGetProperty):
+ (JSObjectSetProperty):
+ (JSObjectDeleteProperty):
+ * API/OpaqueJSString.cpp:
+ * API/OpaqueJSString.h:
+ * VM/CTI.cpp:
+ (JSC::CTI::getConstant):
+ (JSC::CTI::emitGetArg):
+ (JSC::CTI::emitGetPutArg):
+ (JSC::CTI::getConstantImmediateNumericArg):
+ (JSC::CTI::printOpcodeOperandTypes):
+ (JSC::CTI::CTI):
+ (JSC::CTI::compileOpCall):
+ (JSC::CTI::compileBinaryArithOp):
+ (JSC::CTI::privateCompileMainPass):
+ (JSC::CTI::privateCompile):
+ (JSC::CTI::privateCompileGetByIdProto):
+ (JSC::CTI::privateCompileGetByIdChain):
+ (JSC::CTI::compileRegExp):
+ * VM/CTI.h:
+ * VM/CodeBlock.h:
+ * VM/CodeGenerator.cpp:
+ (JSC::CodeGenerator::emitEqualityOp):
+ (JSC::CodeGenerator::emitLoad):
+ (JSC::CodeGenerator::emitUnexpectedLoad):
+ (JSC::CodeGenerator::emitConstruct):
+ * VM/CodeGenerator.h:
+ * VM/Machine.cpp:
+ (JSC::jsLess):
+ (JSC::jsLessEq):
+ (JSC::jsAddSlowCase):
+ (JSC::jsAdd):
+ (JSC::jsTypeStringForValue):
+ (JSC::Machine::resolve):
+ (JSC::Machine::resolveSkip):
+ (JSC::Machine::resolveGlobal):
+ (JSC::inlineResolveBase):
+ (JSC::Machine::resolveBase):
+ (JSC::Machine::resolveBaseAndProperty):
+ (JSC::Machine::resolveBaseAndFunc):
+ (JSC::Machine::slideRegisterWindowForCall):
+ (JSC::isNotObject):
+ (JSC::Machine::callEval):
+ (JSC::Machine::dumpCallFrame):
+ (JSC::Machine::dumpRegisters):
+ (JSC::Machine::unwindCallFrame):
+ (JSC::Machine::throwException):
+ (JSC::DynamicGlobalObjectScope::DynamicGlobalObjectScope):
+ (JSC::DynamicGlobalObjectScope::~DynamicGlobalObjectScope):
+ (JSC::Machine::execute):
+ (JSC::Machine::debug):
+ (JSC::Machine::createExceptionScope):
+ (JSC::cachePrototypeChain):
+ (JSC::Machine::tryCachePutByID):
+ (JSC::Machine::tryCacheGetByID):
+ (JSC::Machine::privateExecute):
+ (JSC::Machine::retrieveArguments):
+ (JSC::Machine::retrieveCaller):
+ (JSC::Machine::retrieveLastCaller):
+ (JSC::Machine::findFunctionCallFrame):
+ (JSC::Machine::getArgumentsData):
+ (JSC::Machine::tryCTICachePutByID):
+ (JSC::Machine::getCTIArrayLengthTrampoline):
+ (JSC::Machine::getCTIStringLengthTrampoline):
+ (JSC::Machine::tryCTICacheGetByID):
+ (JSC::Machine::cti_op_convert_this):
+ (JSC::Machine::cti_op_end):
+ (JSC::Machine::cti_op_add):
+ (JSC::Machine::cti_op_pre_inc):
+ (JSC::Machine::cti_timeout_check):
+ (JSC::Machine::cti_op_loop_if_less):
+ (JSC::Machine::cti_op_loop_if_lesseq):
+ (JSC::Machine::cti_op_new_object):
+ (JSC::Machine::cti_op_put_by_id):
+ (JSC::Machine::cti_op_put_by_id_second):
+ (JSC::Machine::cti_op_put_by_id_generic):
+ (JSC::Machine::cti_op_put_by_id_fail):
+ (JSC::Machine::cti_op_get_by_id):
+ (JSC::Machine::cti_op_get_by_id_second):
+ (JSC::Machine::cti_op_get_by_id_generic):
+ (JSC::Machine::cti_op_get_by_id_fail):
+ (JSC::Machine::cti_op_instanceof):
+ (JSC::Machine::cti_op_del_by_id):
+ (JSC::Machine::cti_op_mul):
+ (JSC::Machine::cti_op_new_func):
+ (JSC::Machine::cti_op_call_JSFunction):
+ (JSC::Machine::cti_vm_compile):
+ (JSC::Machine::cti_op_push_activation):
+ (JSC::Machine::cti_op_call_NotJSFunction):
+ (JSC::Machine::cti_op_create_arguments):
+ (JSC::Machine::cti_op_tear_off_activation):
+ (JSC::Machine::cti_op_tear_off_arguments):
+ (JSC::Machine::cti_op_ret_profiler):
+ (JSC::Machine::cti_op_ret_scopeChain):
+ (JSC::Machine::cti_op_new_array):
+ (JSC::Machine::cti_op_resolve):
+ (JSC::Machine::cti_op_construct_JSConstruct):
+ (JSC::Machine::cti_op_construct_NotJSConstruct):
+ (JSC::Machine::cti_op_get_by_val):
+ (JSC::Machine::cti_op_resolve_func):
+ (JSC::Machine::cti_op_sub):
+ (JSC::Machine::cti_op_put_by_val):
+ (JSC::Machine::cti_op_put_by_val_array):
+ (JSC::Machine::cti_op_lesseq):
+ (JSC::Machine::cti_op_loop_if_true):
+ (JSC::Machine::cti_op_negate):
+ (JSC::Machine::cti_op_resolve_base):
+ (JSC::Machine::cti_op_resolve_skip):
+ (JSC::Machine::cti_op_resolve_global):
+ (JSC::Machine::cti_op_div):
+ (JSC::Machine::cti_op_pre_dec):
+ (JSC::Machine::cti_op_jless):
+ (JSC::Machine::cti_op_not):
+ (JSC::Machine::cti_op_jtrue):
+ (JSC::Machine::cti_op_post_inc):
+ (JSC::Machine::cti_op_eq):
+ (JSC::Machine::cti_op_lshift):
+ (JSC::Machine::cti_op_bitand):
+ (JSC::Machine::cti_op_rshift):
+ (JSC::Machine::cti_op_bitnot):
+ (JSC::Machine::cti_op_resolve_with_base):
+ (JSC::Machine::cti_op_new_func_exp):
+ (JSC::Machine::cti_op_mod):
+ (JSC::Machine::cti_op_less):
+ (JSC::Machine::cti_op_neq):
+ (JSC::Machine::cti_op_post_dec):
+ (JSC::Machine::cti_op_urshift):
+ (JSC::Machine::cti_op_bitxor):
+ (JSC::Machine::cti_op_new_regexp):
+ (JSC::Machine::cti_op_bitor):
+ (JSC::Machine::cti_op_call_eval):
+ (JSC::Machine::cti_op_throw):
+ (JSC::Machine::cti_op_get_pnames):
+ (JSC::Machine::cti_op_next_pname):
+ (JSC::Machine::cti_op_push_scope):
+ (JSC::Machine::cti_op_pop_scope):
+ (JSC::Machine::cti_op_typeof):
+ (JSC::Machine::cti_op_to_jsnumber):
+ (JSC::Machine::cti_op_in):
+ (JSC::Machine::cti_op_push_new_scope):
+ (JSC::Machine::cti_op_jmp_scopes):
+ (JSC::Machine::cti_op_put_by_index):
+ (JSC::Machine::cti_op_switch_imm):
+ (JSC::Machine::cti_op_switch_char):
+ (JSC::Machine::cti_op_switch_string):
+ (JSC::Machine::cti_op_del_by_val):
+ (JSC::Machine::cti_op_put_getter):
+ (JSC::Machine::cti_op_put_setter):
+ (JSC::Machine::cti_op_new_error):
+ (JSC::Machine::cti_op_debug):
+ (JSC::Machine::cti_vm_throw):
+ * VM/Machine.h:
+ * VM/Register.h:
+ * VM/RegisterFile.h:
+ * kjs/Arguments.h:
+ * kjs/DebuggerCallFrame.cpp:
+ (JSC::DebuggerCallFrame::functionName):
+ (JSC::DebuggerCallFrame::type):
+ (JSC::DebuggerCallFrame::thisObject):
+ (JSC::DebuggerCallFrame::evaluate):
+ * kjs/DebuggerCallFrame.h:
+ * kjs/ExecState.cpp:
+ (JSC::CallFrame::thisValue):
+ * kjs/ExecState.h:
+ * kjs/FunctionConstructor.cpp:
+ (JSC::constructFunction):
+ * kjs/JSActivation.cpp:
+ (JSC::JSActivation::JSActivation):
+ (JSC::JSActivation::argumentsGetter):
+ * kjs/JSActivation.h:
+ * kjs/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::init):
+ * kjs/JSGlobalObjectFunctions.cpp:
+ (JSC::globalFuncEval):
+ * kjs/JSVariableObject.h:
+ * kjs/Parser.cpp:
+ (JSC::Parser::parse):
+ * kjs/RegExpConstructor.cpp:
+ (JSC::constructRegExp):
+ * kjs/RegExpPrototype.cpp:
+ (JSC::regExpProtoFuncCompile):
+ * kjs/Shell.cpp:
+ (prettyPrintScript):
+ * kjs/StringPrototype.cpp:
+ (JSC::stringProtoFuncMatch):
+ (JSC::stringProtoFuncSearch):
+ * kjs/identifier.cpp:
+ (JSC::Identifier::checkSameIdentifierTable):
+ * kjs/interpreter.cpp:
+ (JSC::Interpreter::checkSyntax):
+ (JSC::Interpreter::evaluate):
+ * kjs/nodes.cpp:
+ (JSC::ThrowableExpressionData::emitThrowError):
+ (JSC::RegExpNode::emitCode):
+ (JSC::ArrayNode::emitCode):
+ (JSC::InstanceOfNode::emitCode):
+ * kjs/nodes.h:
+ * kjs/regexp.cpp:
+ (JSC::RegExp::RegExp):
+ (JSC::RegExp::create):
+ * kjs/regexp.h:
+ * profiler/HeavyProfile.h:
+ * profiler/Profile.h:
+ * wrec/WREC.cpp:
+ * wrec/WREC.h:
+
+2008-10-08 Prasanth Ullattil <pullatti@trolltech.com>
+
+ Reviewed by Oliver Hunt.
+
+ Avoid endless loops when compiling without the computed goto
+ optimization.
+
+ NEXT_OPCODE expands to "continue", which will not work inside
+ loops.
+
+ * VM/Machine.cpp:
+ (JSC::Machine::privateExecute):
+
+2008-10-08 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Re-landing the following fix with the crashing bug in it fixed (r37405):
+
+ - optimize away multiplication by constant 1.0
+
+ 2.3% speedup on v8 RayTrace benchmark
+
+ Apparently it's not uncommon for JavaScript code to multiply by
+ constant 1.0 in the mistaken belief that this converts integer to
+ floating point and that there is any operational difference.
+
+ * VM/CTI.cpp:
+ (JSC::CTI::privateCompileMainPass): Optimize to_jsnumber for
+ case where parameter is already number.
+ (JSC::CTI::privateCompileSlowCases): ditto
+ * VM/Machine.cpp:
+ (JSC::Machine::privateExecute): ditto
+ * kjs/grammar.y:
+ (makeMultNode): Transform as follows:
+ +FOO * BAR ==> FOO * BAR
+ FOO * +BAR ==> FOO * BAR
+ FOO * 1 ==> +FOO
+ 1 * FOO ==> +FOO
+ (makeDivNode): Transform as follows:
+ +FOO / BAR ==> FOO / BAR
+ FOO / +BAR ==> FOO / BAR
+ (makeSubNode): Transform as follows:
+ +FOO - BAR ==> FOO - BAR
+ FOO - +BAR ==> FOO - BAR
+ * kjs/nodes.h:
+ (JSC::ExpressionNode::stripUnaryPlus): Helper for above
+ grammar.y changes
+ (JSC::UnaryPlusNode::stripUnaryPlus): ditto
+
+2008-10-08 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ - correctly handle appending -0 to a string, it should stringify as just 0
+
+ * kjs/ustring.cpp:
+ (JSC::concatenate):
+
+2008-10-08 Prasanth Ullattil <pullatti@trolltech.com>
+
+ Reviewed by Simon.
+
+ Fix WebKit compilation with VC2008SP1
+
+ Apply the TR1 workaround for JavaScriptCore, too.
+
+ * JavaScriptCore.pro:
+
+2008-10-08 Prasanth Ullattil <pullatti@trolltech.com>
+
+ Reviewed by Simon.
+
+ Fix compilation errors on VS2008 64Bit
+
+ * kjs/collector.cpp:
+ (JSC::currentThreadStackBase):
+
+2008-10-08 André Pönitz <apoenitz@trolltech.com>
+
+ Reviewed by Simon.
+
+ Fix compilation with Qt namespaces.
+
+ * wtf/Threading.h:
+
+2008-10-07 Sam Weinig <sam@webkit.org>
+
+ Roll out r37405.
+
+2008-10-07 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ Switch CTI runtime calls to the fastcall calling convention
+
+ Basically this means that we get to store the argument for CTI
+ calls in the ECX register, which saves a register->memory write
+ and subsequent memory->register read.
+
+ This is a 1.7% progression in SunSpider and 2.4% on commandline
+ v8 tests on Windows
+
+ * VM/CTI.cpp:
+ (JSC::):
+ (JSC::CTI::privateCompilePutByIdTransition):
+ (JSC::CTI::privateCompilePatchGetArrayLength):
+ * VM/CTI.h:
+ * VM/Machine.h:
+ * masm/X86Assembler.h:
+ (JSC::X86Assembler::emitRestoreArgumentReference):
+ (JSC::X86Assembler::emitRestoreArgumentReferenceForTrampoline):
+ We need this to correctly reload ecx from inside certain property access
+ trampolines.
+ * wtf/Platform.h:
+
+2008-10-07 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Mark Rowe.
+
+ - optimize away multiplication by constant 1.0
+
+ 2.3% speedup on v8 RayTrace benchmark
+
+ Apparently it's not uncommon for JavaScript code to multiply by
+ constant 1.0 in the mistaken belief that this converts integer to
+ floating point and that there is any operational difference.
+
+ * VM/CTI.cpp:
+ (JSC::CTI::privateCompileMainPass): Optimize to_jsnumber for
+ case where parameter is already number.
+ (JSC::CTI::privateCompileSlowCases): ditto
+ * VM/Machine.cpp:
+ (JSC::Machine::privateExecute): ditto
+ * kjs/grammar.y:
+ (makeMultNode): Transform as follows:
+ +FOO * BAR ==> FOO * BAR
+ FOO * +BAR ==> FOO * BAR
+ FOO * 1 ==> +FOO
+ 1 * FOO ==> +FOO
+ (makeDivNode): Transform as follows:
+ +FOO / BAR ==> FOO / BAR
+ FOO / +BAR ==> FOO / BAR
+ (makeSubNode): Transform as follows:
+ +FOO - BAR ==> FOO - BAR
+ FOO - +BAR ==> FOO - BAR
+ * kjs/nodes.h:
+ (JSC::ExpressionNode::stripUnaryPlus): Helper for above
+ grammar.y changes
+ (JSC::UnaryPlusNode::stripUnaryPlus): ditto
+
+2008-10-07 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ - make constant folding code more consistent
+
+ Added a makeSubNode to match add, mult and div; use the makeFooNode functions always,
+ instead of allocating nodes directly in other places in the grammar.
+
+ * kjs/grammar.y:
+
+2008-10-07 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Cameron Zwarich.
+
+ Move hasGetterSetterProperties flag from PropertyMap to StructureID.
+
+ * kjs/JSObject.cpp:
+ (JSC::JSObject::put):
+ (JSC::JSObject::defineGetter):
+ (JSC::JSObject::defineSetter):
+ * kjs/JSObject.h:
+ (JSC::JSObject::hasGetterSetterProperties):
+ (JSC::JSObject::getOwnPropertySlotForWrite):
+ (JSC::JSObject::getOwnPropertySlot):
+ * kjs/PropertyMap.h:
+ * kjs/StructureID.cpp:
+ (JSC::StructureID::StructureID):
+ (JSC::StructureID::addPropertyTransition):
+ (JSC::StructureID::toDictionaryTransition):
+ (JSC::StructureID::changePrototypeTransition):
+ (JSC::StructureID::getterSetterTransition):
+ * kjs/StructureID.h:
+ (JSC::StructureID::hasGetterSetterProperties):
+ (JSC::StructureID::setHasGetterSetterProperties):
+
+2008-10-07 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Cameron Zwarich.
+
+ Roll r37370 back in with bug fixes.
+
+ - PropertyMap::storageSize() should reflect the number of keys + deletedOffsets
+ and has nothing to do with the internal deletedSentinel count anymore.
+
+2008-10-07 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Move callframe initialization into JIT code, again.
+
+ As a part of the restructuring the second result from functions is now
+ returned in edx, allowing the new value of 'r' to be returned via a
+ register, and stored to the stack from JIT code, too.
+
+ 4.5% progression on v8-tests. (3% in their harness)
+
+ * VM/CTI.cpp:
+ (JSC::):
+ (JSC::CTI::emitCall):
+ (JSC::CTI::compileOpCall):
+ (JSC::CTI::privateCompileMainPass):
+ (JSC::CTI::privateCompileSlowCases):
+ (JSC::CTI::privateCompile):
+ * VM/CTI.h:
+ (JSC::CallRecord::CallRecord):
+ * VM/Machine.cpp:
+ (JSC::Machine::cti_op_call_JSFunction):
+ (JSC::Machine::cti_op_construct_JSConstruct):
+ (JSC::Machine::cti_op_resolve_func):
+ (JSC::Machine::cti_op_post_inc):
+ (JSC::Machine::cti_op_resolve_with_base):
+ (JSC::Machine::cti_op_post_dec):
+ * VM/Machine.h:
+ * kjs/JSFunction.h:
+ * kjs/ScopeChain.h:
+
+2008-10-07 Mark Rowe <mrowe@apple.com>
+
+ Fix typo in method name.
+
+ * wrec/WREC.cpp:
+ * wrec/WREC.h:
+
+2008-10-07 Cameron Zwarich <zwarich@apple.com>
+
+ Rubber-stamped by Mark Rowe.
+
+ Roll out r37370.
+
+2008-10-06 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Cameron Zwarich.
+
+ Fix for https://bugs.webkit.org/show_bug.cgi?id=21415
+ Improve the division between PropertyStorageArray and PropertyMap
+
+ - Rework ProperyMap to store offsets in the value so that they don't
+ change when rehashing. This allows us not to have to keep the
+ PropertyStorageArray in sync and thus not have to pass it in.
+ - Rename PropertyMap::getOffset -> PropertyMap::get since put/remove
+ now also return offsets.
+ - A Vector of deleted offsets is now needed since the storage is out of
+ band.
+
+ 1% win on SunSpider. Wash on V8 suite.
+
+ * JavaScriptCore.exp:
+ * VM/CTI.cpp:
+ (JSC::transitionWillNeedStorageRealloc):
+ * VM/Machine.cpp:
+ (JSC::Machine::privateExecute):
+ Transition logic can be greatly simplified by the fact that
+ the storage capacity is always known, and is correct for the
+ inline case.
+ * kjs/JSObject.cpp:
+ (JSC::JSObject::put): Rename getOffset -> get.
+ (JSC::JSObject::deleteProperty): Ditto.
+ (JSC::JSObject::getPropertyAttributes): Ditto.
+ (JSC::JSObject::removeDirect): Use returned offset to
+ clear the value in the PropertyNameArray.
+ (JSC::JSObject::allocatePropertyStorage): Add assert.
+ * kjs/JSObject.h:
+ (JSC::JSObject::getDirect): Rename getOffset -> get
+ (JSC::JSObject::getDirectLocation): Rename getOffset -> get
+ (JSC::JSObject::putDirect): Use propertyStorageCapacity to determine whether
+ or not to resize. Also, since put now returns an offset (and thus
+ addPropertyTransition does also) setting of the PropertyStorageArray is
+ now done here.
+ (JSC::JSObject::transitionTo):
+ * kjs/PropertyMap.cpp:
+ (JSC::PropertyMap::checkConsistency): PropertyStorageArray is no longer
+ passed in.
+ (JSC::PropertyMap::operator=): Copy the delete offsets vector.
+ (JSC::PropertyMap::put): Instead of setting the PropertyNameArray
+ explicitly, return the offset where the value should go.
+ (JSC::PropertyMap::remove): Instead of removing from the PropertyNameArray
+ explicitly, return the offset where the value should be removed.
+ (JSC::PropertyMap::get): Switch to using the stored offset, instead
+ of the implicit one.
+ (JSC::PropertyMap::insert):
+ (JSC::PropertyMap::expand): This is never called when m_table is null,
+ so remove that branch and add it as an assertion.
+ (JSC::PropertyMap::createTable): Consistency checks no longer take
+ a PropertyNameArray.
+ (JSC::PropertyMap::rehash): No need to rehash the PropertyNameArray
+ now that it is completely out of band.
+ * kjs/PropertyMap.h:
+ (JSC::PropertyMapEntry::PropertyMapEntry): Store offset into PropertyNameArray.
+ (JSC::PropertyMap::get): Switch to using the stored offset, instead
+ of the implicit one.
+ * kjs/StructureID.cpp:
+ (JSC::StructureID::StructureID): Initialize the propertyStorageCapacity to
+ JSObject::inlineStorageCapacity.
+ (JSC::StructureID::growPropertyStorageCapacity): Grow the storage capacity as
+ described below.
+ (JSC::StructureID::addPropertyTransition): Copy the storage capacity.
+ (JSC::StructureID::toDictionaryTransition): Ditto.
+ (JSC::StructureID::changePrototypeTransition): Ditto.
+ (JSC::StructureID::getterSetterTransition): Ditto.
+ * kjs/StructureID.h:
+ (JSC::StructureID::propertyStorageCapacity): Add propertyStorageCapacity
+ which is the current capacity for the JSObjects PropertyStorageArray.
+ It starts at the JSObject::inlineStorageCapacity (currently 2), then
+ when it first needs to be resized moves to the JSObject::nonInlineBaseStorageCapacity
+ (currently 16), and after that doubles each time.
+
+2008-10-06 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 21396: Remove the OptionalCalleeActivation call frame slot
+ <https://bugs.webkit.org/show_bug.cgi?id=21396>
+
+ Remove the OptionalCalleeActivation call frame slot. We have to be
+ careful to store the activation object in a register, because objects
+ in the scope chain do not get marked.
+
+ This is a 0.3% speedup on both SunSpider and the V8 benchmark.
+
+ * VM/CTI.cpp:
+ (JSC::CTI::privateCompileMainPass):
+ * VM/CodeBlock.cpp:
+ (JSC::CodeBlock::dump):
+ * VM/CodeGenerator.cpp:
+ (JSC::CodeGenerator::CodeGenerator):
+ (JSC::CodeGenerator::emitReturn):
+ * VM/CodeGenerator.h:
+ * VM/Machine.cpp:
+ (JSC::Machine::dumpRegisters):
+ (JSC::Machine::unwindCallFrame):
+ (JSC::Machine::privateExecute):
+ (JSC::Machine::cti_op_call_JSFunction):
+ (JSC::Machine::cti_op_push_activation):
+ (JSC::Machine::cti_op_tear_off_activation):
+ (JSC::Machine::cti_op_construct_JSConstruct):
+ * VM/Machine.h:
+ (JSC::Machine::initializeCallFrame):
+ * VM/RegisterFile.h:
+ (JSC::RegisterFile::):
+
+2008-10-06 Tony Chang <tony@chromium.org>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Chromium doesn't use pthreads on windows, so make its use conditional.
+
+ Also convert a WORD to a DWORD to avoid a compiler warning. This
+ matches the other methods around it.
+
+ * wtf/ThreadingWin.cpp:
+ (WTF::wtfThreadEntryPoint):
+ (WTF::ThreadCondition::broadcast):
+
+2008-10-06 Mark Mentovai <mark@moxienet.com>
+
+ Reviewed by Tim Hatcher.
+
+ Allow ENABLE_DASHBOARD_SUPPORT and ENABLE_MAC_JAVA_BRIDGE to be
+ disabled on the Mac.
+
+ https://bugs.webkit.org/show_bug.cgi?id=21333
+
+ * wtf/Platform.h:
+
+2008-10-06 Steve Falkenburg <sfalken@apple.com>
+
+ https://bugs.webkit.org/show_bug.cgi?id=21416
+ Pass 0 for size to VirtualAlloc, as documented by MSDN.
+ Identified by Application Verifier.
+
+ Reviewed by Darin Adler.
+
+ * kjs/collector.cpp:
+ (KJS::freeBlock):
+
+2008-10-06 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Tim Hatcheri and Oliver Hunt.
+
+ https://bugs.webkit.org/show_bug.cgi?id=21412
+ Bug 21412: Refactor user initiated profile count to be more stable
+ - Export UString::from for use with creating the profile title.
+
+ * JavaScriptCore.exp:
+
+2008-10-06 Maciej Stachowiak <mjs@apple.com>
+
+ Not reviewed. Build fix.
+
+ - revert toBoolean changes (r37333 and r37335); need to make WebCore work with these
+
+ * API/JSValueRef.cpp:
+ (JSValueToBoolean):
+ * ChangeLog:
+ * JavaScriptCore.exp:
+ * VM/CodeBlock.cpp:
+ (JSC::CodeBlock::dump):
+ * VM/Machine.cpp:
+ (JSC::Machine::privateExecute):
+ (JSC::Machine::cti_op_loop_if_true):
+ (JSC::Machine::cti_op_not):
+ (JSC::Machine::cti_op_jtrue):
+ * kjs/ArrayPrototype.cpp:
+ (JSC::arrayProtoFuncFilter):
+ (JSC::arrayProtoFuncEvery):
+ (JSC::arrayProtoFuncSome):
+ * kjs/BooleanConstructor.cpp:
+ (JSC::constructBoolean):
+ (JSC::callBooleanConstructor):
+ * kjs/GetterSetter.h:
+ * kjs/JSCell.h:
+ (JSC::JSValue::toBoolean):
+ * kjs/JSNumberCell.cpp:
+ (JSC::JSNumberCell::toBoolean):
+ * kjs/JSNumberCell.h:
+ * kjs/JSObject.cpp:
+ (JSC::JSObject::toBoolean):
+ * kjs/JSObject.h:
+ * kjs/JSString.cpp:
+ (JSC::JSString::toBoolean):
+ * kjs/JSString.h:
+ * kjs/JSValue.h:
+ * kjs/RegExpConstructor.cpp:
+ (JSC::setRegExpConstructorMultiline):
+ * kjs/RegExpObject.cpp:
+ (JSC::RegExpObject::match):
+ * kjs/RegExpPrototype.cpp:
+ (JSC::regExpProtoFuncToString):
+
+2008-10-06 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ - optimize op_jtrue, op_loop_if_true and op_not in various ways
+ https://bugs.webkit.org/show_bug.cgi?id=21404
+
+ 1) Make JSValue::toBoolean nonvirtual and completely inline by
+ making use of the StructureID type field.
+
+ 2) Make JSValue::toBoolean not take an ExecState; doesn't need it.
+
+ 3) Make op_not, op_loop_if_true and op_jtrue not read the
+ ExecState (toBoolean doesn't need it any more) and not check
+ exceptions (toBoolean can't throw).
+
+ * API/JSValueRef.cpp:
+ (JSValueToBoolean):
+ * JavaScriptCore.exp:
+ * VM/CodeBlock.cpp:
+ (JSC::CodeBlock::dump):
+ * VM/Machine.cpp:
+ (JSC::Machine::privateExecute):
+ (JSC::Machine::cti_op_loop_if_true):
+ (JSC::Machine::cti_op_not):
+ (JSC::Machine::cti_op_jtrue):
+ * kjs/ArrayPrototype.cpp:
+ (JSC::arrayProtoFuncFilter):
+ (JSC::arrayProtoFuncEvery):
+ (JSC::arrayProtoFuncSome):
+ * kjs/BooleanConstructor.cpp:
+ (JSC::constructBoolean):
+ (JSC::callBooleanConstructor):
+ * kjs/GetterSetter.h:
+ * kjs/JSCell.h:
+ (JSC::JSValue::toBoolean):
+ * kjs/JSNumberCell.cpp:
+ * kjs/JSNumberCell.h:
+ (JSC::JSNumberCell::toBoolean):
+ * kjs/JSObject.cpp:
+ * kjs/JSObject.h:
+ (JSC::JSObject::toBoolean):
+ (JSC::JSCell::toBoolean):
+ * kjs/JSString.cpp:
+ * kjs/JSString.h:
+ (JSC::JSString::toBoolean):
+ * kjs/JSValue.h:
+ * kjs/RegExpConstructor.cpp:
+ (JSC::setRegExpConstructorMultiline):
+ * kjs/RegExpObject.cpp:
+ (JSC::RegExpObject::match):
+ * kjs/RegExpPrototype.cpp:
+ (JSC::regExpProtoFuncToString):
+
+2008-10-06 Ariya Hidayat <ariya.hidayat@trolltech.com>
+
+ Reviewed by Simon.
+
+ Build fix for MinGW.
+
+ * JavaScriptCore.pri:
+ * kjs/DateMath.cpp:
+ (JSC::highResUpTime):
+
+2008-10-05 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Remove ScopeNode::containsClosures() now that it is unused.
+
+ * kjs/nodes.h:
+ (JSC::ScopeNode::containsClosures):
+
+2008-10-05 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ - fix releas-only test failures caused by the fix to bug 21375
+
+ * VM/Machine.cpp:
+ (JSC::Machine::unwindCallFrame): Update ExecState while unwinding call frames;
+ it now matters more to have a still-valid ExecState, since dynamicGlobalObject
+ will make use of the ExecState's scope chain.
+ * VM/Machine.h:
+
+2008-10-05 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 21364: Remove the branch in op_ret for OptionalCalleeActivation and OptionalCalleeArguments
+ <https://bugs.webkit.org/show_bug.cgi?id=21364>
+
+ Use information from the parser to detect whether an activation is
+ needed or 'arguments' is used, and emit explicit instructions to tear
+ them off before op_ret. This allows a branch to be removed from op_ret
+ and simplifies some other code. This does cause a small change in the
+ behaviour of 'f.arguments'; it is no longer live when 'arguments' is not
+ mentioned in the lexical scope of the function.
+
+ It should now be easy to remove the OptionaCalleeActivation slot in the
+ call frame, but this will be done in a later patch.
+
+ * VM/CTI.cpp:
+ (JSC::CTI::privateCompileMainPass):
+ * VM/CodeBlock.cpp:
+ (JSC::CodeBlock::dump):
+ * VM/CodeGenerator.cpp:
+ (JSC::CodeGenerator::emitReturn):
+ * VM/CodeGenerator.h:
+ * VM/Machine.cpp:
+ (JSC::Machine::unwindCallFrame):
+ (JSC::Machine::privateExecute):
+ (JSC::Machine::retrieveArguments):
+ (JSC::Machine::cti_op_create_arguments):
+ (JSC::Machine::cti_op_tear_off_activation):
+ (JSC::Machine::cti_op_tear_off_arguments):
+ * VM/Machine.h:
+ * VM/Opcode.h:
+ * kjs/Arguments.cpp:
+ (JSC::Arguments::mark):
+ * kjs/Arguments.h:
+ (JSC::Arguments::isTornOff):
+ (JSC::Arguments::Arguments):
+ (JSC::Arguments::copyRegisters):
+ (JSC::JSActivation::copyRegisters):
+ * kjs/JSActivation.cpp:
+ (JSC::JSActivation::argumentsGetter):
+ * kjs/JSActivation.h:
+
+2008-10-05 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ - fixed "REGRESSION (r37297): fast/js/deep-recursion-test takes too long and times out"
+ https://bugs.webkit.org/show_bug.cgi?id=21375
+
+ The problem is that dynamicGlobalObject had become O(N) in number
+ of call frames, but unwinding the stack for an exception called it
+ for every call frame, resulting in O(N^2) behavior for an
+ exception thrown from inside deep recursion.
+
+ Instead of doing it that way, stash the dynamic global object in JSGlobalData.
+
+ * JavaScriptCore.exp:
+ * VM/Machine.cpp:
+ (JSC::DynamicGlobalObjectScope::DynamicGlobalObjectScope): Helper class to temporarily
+ store and later restore a dynamicGlobalObject in JSGlobalData.
+ (JSC::DynamicGlobalObjectScope::~DynamicGlobalObjectScope):
+ (JSC::Machine::execute): In each version, establish a DynamicGlobalObjectScope.
+ For ProgramNode, always establish set new dynamicGlobalObject, for FunctionBody and Eval,
+ only if none is currently set.
+ * VM/Machine.h:
+ * kjs/ExecState.h:
+ * kjs/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData): Ininitalize new dynamicGlobalObject field to 0.
+ * kjs/JSGlobalData.h:
+ * kjs/JSGlobalObject.h:
+ (JSC::ExecState::dynamicGlobalObject): Moved here from ExecState for benefit of inlining.
+ Return lexical global object if this is a globalExec(), otherwise look in JSGlobalData
+ for the one stashed there.
+
+2008-10-05 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Maciej Stachowiak.
+
+ Avoid an extra lookup when transitioning to an existing StructureID
+ by caching the offset of property that caused the transition.
+
+ 1% win on V8 suite. Wash on SunSpider.
+
+ * kjs/PropertyMap.cpp:
+ (JSC::PropertyMap::put):
+ * kjs/PropertyMap.h:
+ * kjs/StructureID.cpp:
+ (JSC::StructureID::StructureID):
+ (JSC::StructureID::addPropertyTransition):
+ * kjs/StructureID.h:
+ (JSC::StructureID::setCachedTransistionOffset):
+ (JSC::StructureID::cachedTransistionOffset):
+
+2008-10-05 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Bug 21364: Remove the branch in op_ret for OptionalCalleeActivation and OptionalCalleeArguments
+ <https://bugs.webkit.org/show_bug.cgi?id=21364>
+
+ This patch does not yet remove the branch, but it does a bit of refactoring
+ so that a CodeGenerator now knows whether the associated CodeBlock will need
+ a full scope before doing any code generation. This makes it possible to emit
+ explicit tear-off instructions before every op_ret.
+
+ * VM/CodeBlock.h:
+ (JSC::CodeBlock::CodeBlock):
+ * VM/CodeGenerator.cpp:
+ (JSC::CodeGenerator::generate):
+ (JSC::CodeGenerator::CodeGenerator):
+ (JSC::CodeGenerator::emitPushScope):
+ (JSC::CodeGenerator::emitPushNewScope):
+ * kjs/nodes.h:
+ (JSC::ScopeNode::needsActivation):
+
+2008-10-05 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ Fix for bug #21387 - using SamplingTool with CTI.
+
+ (1) A repatch offset offset changes due to an additional instruction to update SamplingTool state.
+ (2) Fix an incusion order problem due to ExecState changes.
+ (3) Change to a MACHINE_SAMPLING macro, use of exec should now be accessing global data.
+
+ * VM/CTI.h:
+ (JSC::CTI::execute):
+ * VM/SamplingTool.h:
+ (JSC::SamplingTool::privateExecuteReturned):
+ * kjs/Shell.cpp:
+
+2008-10-04 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Tim Hatcher.
+
+ Add a 'Check For Weak VTables' build phase to catch weak vtables as early as possible.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2008-10-04 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Oliver Hunt.
+
+ Fix https://bugs.webkit.org/show_bug.cgi?id=21320
+ leaks of PropertyNameArrayData seen on buildbot
+
+ - Fix RefPtr cycle by making PropertyNameArrayData's pointer back
+ to the StructureID a weak pointer.
+
+ * kjs/PropertyNameArray.h:
+ (JSC::PropertyNameArrayData::setCachedStructureID):
+ (JSC::PropertyNameArrayData::cachedStructureID):
+ * kjs/StructureID.cpp:
+ (JSC::StructureID::getEnumerablePropertyNames):
+ (JSC::StructureID::clearEnumerationCache):
+ (JSC::StructureID::~StructureID):
+
+2008-10-04 Darin Adler <darin@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ - https://bugs.webkit.org/show_bug.cgi?id=21295
+ Bug 21295: Replace ExecState with a call frame Register pointer
+
+ 10% faster on Richards; other v8 benchmarks faster too.
+ A wash on SunSpider.
+
+ This does the minimum necessary to get the speedup. Next step in
+ cleaning this up is to replace ExecState with a CallFrame class,
+ and be more judicious about when to pass a call frame and when
+ to pass a global data pointer, global object pointer, or perhaps
+ something else entirely.
+
+ * VM/CTI.cpp: Remove the debug-only check of the exception in
+ ctiVMThrowTrampoline -- already checked in the code the trampoline
+ jumps to, so not all that useful. Removed the exec argument from
+ ctiTrampoline. Removed emitDebugExceptionCheck -- no longer needed.
+ (JSC::CTI::emitCall): Removed code to set ExecState::m_callFrame.
+ (JSC::CTI::privateCompileMainPass): Removed code in catch to extract
+ the exception from ExecState::m_exception; instead, the code that
+ jumps into catch will make sure the exception is already in eax.
+ * VM/CTI.h: Removed exec from the ctiTrampoline. Also removed the
+ non-helpful "volatile". Temporarily left ARG_exec in as a synonym
+ for ARG_r; I'll change that on a future cleanup pass when introducing
+ more use of the CallFrame type.
+ (JSC::CTI::execute): Removed the ExecState* argument.
+
+ * VM/ExceptionHelpers.cpp:
+ (JSC::InterruptedExecutionError::InterruptedExecutionError): Take
+ JSGlobalData* instead of ExecState*.
+ (JSC::createInterruptedExecutionException): Ditto.
+ * VM/ExceptionHelpers.h: Ditto. Also removed an unneeded include.
+
+ * VM/Machine.cpp:
+ (JSC::slideRegisterWindowForCall): Removed the exec and
+ exceptionValue arguments. Changed to return 0 when there's a stack
+ overflow rather than using a separate exception argument to cut
+ down on memory accesses in the calling convention.
+ (JSC::Machine::unwindCallFrame): Removed the exec argument when
+ constructing a DebuggerCallFrame. Also removed code to set
+ ExecState::m_callFrame.
+ (JSC::Machine::throwException): Removed the exec argument when
+ construction a DebuggerCallFrame.
+ (JSC::Machine::execute): Updated to use the register instead of
+ ExecState and also removed various uses of ExecState.
+ (JSC::Machine::debug):
+ (JSC::Machine::privateExecute): Put globalData into a local
+ variable so it can be used throughout the interpreter. Changed
+ the VM_CHECK_EXCEPTION to get the exception in globalData instead
+ of through ExecState.
+ (JSC::Machine::retrieveLastCaller): Turn exec into a registers
+ pointer by calling registers() instead of by getting m_callFrame.
+ (JSC::Machine::callFrame): Ditto.
+ Tweaked exception macros. Made new versions for when you know
+ you have an exception. Get at global exception with ARG_globalData.
+ Got rid of the need to pass in the return value type.
+ (JSC::Machine::cti_op_add): Update to use new version of exception
+ macros.
+ (JSC::Machine::cti_op_pre_inc): Ditto.
+ (JSC::Machine::cti_timeout_check): Ditto.
+ (JSC::Machine::cti_op_instanceof): Ditto.
+ (JSC::Machine::cti_op_new_func): Ditto.
+ (JSC::Machine::cti_op_call_JSFunction): Optimized by using the
+ ARG values directly instead of through local variables -- this gets
+ rid of code that just shuffles things around in the stack frame.
+ Also get rid of ExecState and update for the new way exceptions are
+ handled in slideRegisterWindowForCall.
+ (JSC::Machine::cti_vm_compile): Update to make exec out of r since
+ they are both the same thing now.
+ (JSC::Machine::cti_op_call_NotJSFunction): Ditto.
+ (JSC::Machine::cti_op_init_arguments): Ditto.
+ (JSC::Machine::cti_op_resolve): Ditto.
+ (JSC::Machine::cti_op_construct_JSConstruct): Ditto.
+ (JSC::Machine::cti_op_construct_NotJSConstruct): Ditto.
+ (JSC::Machine::cti_op_resolve_func): Ditto.
+ (JSC::Machine::cti_op_put_by_val): Ditto.
+ (JSC::Machine::cti_op_put_by_val_array): Ditto.
+ (JSC::Machine::cti_op_resolve_skip): Ditto.
+ (JSC::Machine::cti_op_resolve_global): Ditto.
+ (JSC::Machine::cti_op_post_inc): Ditto.
+ (JSC::Machine::cti_op_resolve_with_base): Ditto.
+ (JSC::Machine::cti_op_post_dec): Ditto.
+ (JSC::Machine::cti_op_call_eval): Ditto.
+ (JSC::Machine::cti_op_throw): Ditto. Also rearranged to return
+ the exception value as the return value so it can be used by
+ op_catch.
+ (JSC::Machine::cti_op_push_scope): Ditto.
+ (JSC::Machine::cti_op_in): Ditto.
+ (JSC::Machine::cti_op_del_by_val): Ditto.
+ (JSC::Machine::cti_vm_throw): Ditto. Also rearranged to return
+ the exception value as the return value so it can be used by
+ op_catch.
+
+ * kjs/DebuggerCallFrame.cpp:
+ (JSC::DebuggerCallFrame::functionName): Pass globalData.
+ (JSC::DebuggerCallFrame::evaluate): Eliminated code to make a
+ new ExecState.
+ * kjs/DebuggerCallFrame.h: Removed ExecState argument from
+ constructor.
+
+ * kjs/ExecState.h: Eliminated all data members and made ExecState
+ inherit privately from Register instead. Also added a typedef to
+ the future name for this class, which is CallFrame. It's just a
+ Register* that knows it's a pointer at a call frame. The new class
+ can't be constructed or copied. Changed all functions to use
+ the this pointer instead of m_callFrame. Changed exception-related
+ functions to access an exception in JSGlobalData. Removed functions
+ used by CTI to pass the return address to the throw machinery --
+ this is now done directly with a global in the global data.
+
+ * kjs/FunctionPrototype.cpp:
+ (JSC::functionProtoFuncToString): Pass globalData instead of exec.
+
+ * kjs/InternalFunction.cpp:
+ (JSC::InternalFunction::name): Take globalData instead of exec.
+ * kjs/InternalFunction.h: Ditto.
+
+ * kjs/JSGlobalData.cpp: Initialize the new exception global to 0.
+ * kjs/JSGlobalData.h: Declare two new globals. One for the current
+ exception and another for the return address used by CTI to
+ implement the throw operation.
+
+ * kjs/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::init): Removed code to set up globalExec,
+ which is now the same thing as globalCallFrame.
+ (JSC::JSGlobalObject::reset): Get globalExec from our globalExec
+ function so we don't have to repeat the logic twice.
+ (JSC::JSGlobalObject::mark): Removed code to mark the exception;
+ the exception is now stored in JSGlobalData and marked there.
+ (JSC::JSGlobalObject::globalExec): Return a pointer to the end
+ of the global call frame.
+ * kjs/JSGlobalObject.h: Removed the globalExec data member.
+
+ * kjs/JSObject.cpp:
+ (JSC::JSObject::putDirectFunction): Pass globalData instead of exec.
+
+ * kjs/collector.cpp:
+ (JSC::Heap::collect): Mark the global exception.
+
+ * profiler/ProfileGenerator.cpp:
+ (JSC::ProfileGenerator::addParentForConsoleStart): Pass globalData
+ instead of exec to createCallIdentifier.
+
+ * profiler/Profiler.cpp:
+ (JSC::Profiler::willExecute): Pass globalData instead of exec to
+ createCallIdentifier.
+ (JSC::Profiler::didExecute): Ditto.
+ (JSC::Profiler::createCallIdentifier): Take globalData instead of
+ exec.
+ (JSC::createCallIdentifierFromFunctionImp): Ditto.
+ * profiler/Profiler.h: Change interface to take a JSGlobalData
+ instead of an ExecState.
+
+2008-10-04 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Bug 21369: Add opcode documentation for all undocumented opcodes
+ <https://bugs.webkit.org/show_bug.cgi?id=21369>
+
+ This patch adds opcode documentation for all undocumented opcodes, and
+ it also renames op_init_arguments to op_create_arguments.
+
+ * VM/CTI.cpp:
+ (JSC::CTI::privateCompileMainPass):
+ * VM/CodeBlock.cpp:
+ (JSC::CodeBlock::dump):
+ * VM/CodeGenerator.cpp:
+ (JSC::CodeGenerator::CodeGenerator):
+ * VM/Machine.cpp:
+ (JSC::Machine::privateExecute):
+ (JSC::Machine::cti_op_create_arguments):
+ * VM/Machine.h:
+ * VM/Opcode.h:
+
+2008-10-03 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ - "this" object in methods called on primitives should be wrapper object
+ https://bugs.webkit.org/show_bug.cgi?id=21362
+
+ I changed things so that functions which use "this" do a fast
+ version of toThisObject conversion if needed. Currently we miss
+ the conversion entirely, at least for primitive types. Using
+ TypeInfo and the primitive check, I made the fast case bail out
+ pretty fast.
+
+ This is inexplicably an 1.007x SunSpider speedup (and a wash on V8 benchmarks).
+
+ Also renamed some opcodes for clarity:
+
+ init ==> enter
+ init_activation ==> enter_with_activation
+
+ * VM/CTI.cpp:
+ (JSC::CTI::privateCompileMainPass):
+ (JSC::CTI::privateCompileSlowCases):
+ * VM/CodeBlock.cpp:
+ (JSC::CodeBlock::dump):
+ * VM/CodeGenerator.cpp:
+ (JSC::CodeGenerator::generate):
+ (JSC::CodeGenerator::CodeGenerator):
+ * VM/Machine.cpp:
+ (JSC::Machine::privateExecute):
+ (JSC::Machine::cti_op_convert_this):
+ * VM/Machine.h:
+ * VM/Opcode.h:
+ * kjs/JSActivation.cpp:
+ (JSC::JSActivation::JSActivation):
+ * kjs/JSActivation.h:
+ (JSC::JSActivation::createStructureID):
+ * kjs/JSCell.h:
+ (JSC::JSValue::needsThisConversion):
+ * kjs/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData):
+ * kjs/JSGlobalData.h:
+ * kjs/JSNumberCell.h:
+ (JSC::JSNumberCell::createStructureID):
+ * kjs/JSStaticScopeObject.h:
+ (JSC::JSStaticScopeObject::JSStaticScopeObject):
+ (JSC::JSStaticScopeObject::createStructureID):
+ * kjs/JSString.h:
+ (JSC::JSString::createStructureID):
+ * kjs/JSValue.h:
+ * kjs/TypeInfo.h:
+ (JSC::TypeInfo::needsThisConversion):
+ * kjs/nodes.h:
+ (JSC::ScopeNode::usesThis):
+
+2008-10-03 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Bug 21356: The size of the RegisterFile differs depending on 32-bit / 64-bit and Debug / Release
+ <https://bugs.webkit.org/show_bug.cgi?id=21356>
+
+ The RegisterFile decreases in size (measured in terms of numbers of
+ Registers) as the size of a Register increases. This causes
+
+ js1_5/Regress/regress-159334.js
+
+ to fail in 64-bit debug builds. This fix makes the RegisterFile on all
+ platforms the same size that it is in 32-bit Release builds.
+
+ * VM/RegisterFile.h:
+ (JSC::RegisterFile::RegisterFile):
+
+2008-10-03 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ - Some code cleanup to how we handle code features.
+
+ 1) Rename FeatureInfo typedef to CodeFeatures.
+ 2) Rename NodeFeatureInfo template to NodeInfo.
+ 3) Keep CodeFeature bitmask in ScopeNode instead of trying to break it out into individual bools.
+ 4) Rename misleadingly named "needsClosure" method to "containsClosures", which better describes the meaning
+ of ClosureFeature.
+ 5) Make setUsersArguments() not take an argument since it only goes one way.
+
+ * JavaScriptCore.exp:
+ * VM/CodeBlock.h:
+ (JSC::CodeBlock::CodeBlock):
+ * kjs/NodeInfo.h:
+ * kjs/Parser.cpp:
+ (JSC::Parser::didFinishParsing):
+ * kjs/Parser.h:
+ (JSC::Parser::parse):
+ * kjs/grammar.y:
+ * kjs/nodes.cpp:
+ (JSC::ScopeNode::ScopeNode):
+ (JSC::ProgramNode::ProgramNode):
+ (JSC::ProgramNode::create):
+ (JSC::EvalNode::EvalNode):
+ (JSC::EvalNode::create):
+ (JSC::FunctionBodyNode::FunctionBodyNode):
+ (JSC::FunctionBodyNode::create):
+ * kjs/nodes.h:
+ (JSC::ScopeNode::usesEval):
+ (JSC::ScopeNode::containsClosures):
+ (JSC::ScopeNode::usesArguments):
+ (JSC::ScopeNode::setUsesArguments):
+
+2008-10-03 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Bug 21343: REGRESSSION (r37160): ecma_3/ExecutionContexts/10.1.3-1.js and js1_4/Functions/function-001.js fail on 64-bit
+ <https://bugs.webkit.org/show_bug.cgi?id=21343>
+
+ A fix was landed for this issue in r37253, and the ChangeLog assumes
+ that it is a compiler bug, but it turns out that it is a subtle issue
+ with mixing signed and unsigned 32-bit values in a 64-bit environment.
+ In order to properly fix this bug, we should convert our signed offsets
+ into the register file to use ptrdiff_t.
+
+ This may not be the only instance of this issue, but I will land this
+ fix first and look for more later.
+
+ * VM/Machine.cpp:
+ (JSC::Machine::getArgumentsData):
+ * VM/Machine.h:
+ * kjs/Arguments.cpp:
+ (JSC::Arguments::getOwnPropertySlot):
+ * kjs/Arguments.h:
+ (JSC::Arguments::init):
+
+2008-10-03 Darin Adler <darin@apple.com>
+
+ * VM/CTI.cpp: Another Windows build fix. Change the args of ctiTrampoline.
+
+ * kjs/JSNumberCell.h: A build fix for newer versions of gcc. Added
+ declarations of JSGlobalData overloads of jsNumberCell.
+
+2008-10-03 Darin Adler <darin@apple.com>
+
+ - try to fix Windows build
+
+ * kjs/ScopeChain.h: Add forward declaration of JSGlobalData.
+
+2008-10-03 Darin Adler <darin@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ - next step of https://bugs.webkit.org/show_bug.cgi?id=21295
+ Turn ExecState into a call frame pointer.
+
+ Remove m_globalObject and m_globalData from ExecState.
+
+ SunSpider says this is a wash (slightly faster but not statistically
+ significant); which is good enough since it's a preparation step and
+ not supposed to be a spedup.
+
+ * API/JSCallbackFunction.cpp:
+ (JSC::JSCallbackFunction::JSCallbackFunction):
+ * kjs/ArrayConstructor.cpp:
+ (JSC::ArrayConstructor::ArrayConstructor):
+ * kjs/BooleanConstructor.cpp:
+ (JSC::BooleanConstructor::BooleanConstructor):
+ * kjs/DateConstructor.cpp:
+ (JSC::DateConstructor::DateConstructor):
+ * kjs/ErrorConstructor.cpp:
+ (JSC::ErrorConstructor::ErrorConstructor):
+ * kjs/FunctionPrototype.cpp:
+ (JSC::FunctionPrototype::FunctionPrototype):
+ * kjs/JSFunction.cpp:
+ (JSC::JSFunction::JSFunction):
+ * kjs/NativeErrorConstructor.cpp:
+ (JSC::NativeErrorConstructor::NativeErrorConstructor):
+ * kjs/NumberConstructor.cpp:
+ (JSC::NumberConstructor::NumberConstructor):
+ * kjs/ObjectConstructor.cpp:
+ (JSC::ObjectConstructor::ObjectConstructor):
+ * kjs/PrototypeFunction.cpp:
+ (JSC::PrototypeFunction::PrototypeFunction):
+ * kjs/RegExpConstructor.cpp:
+ (JSC::RegExpConstructor::RegExpConstructor):
+ * kjs/StringConstructor.cpp:
+ (JSC::StringConstructor::StringConstructor):
+ Pass JSGlobalData* instead of ExecState* to the InternalFunction
+ constructor.
+
+ * API/OpaqueJSString.cpp: Added now-needed include.
+
+ * JavaScriptCore.exp: Updated.
+
+ * VM/CTI.cpp:
+ (JSC::CTI::emitSlowScriptCheck): Changed to use ARGS_globalData
+ instead of ARGS_exec.
+
+ * VM/CTI.h: Added a new argument to the CTI, the global data pointer.
+ While it's possible to get to the global data pointer using the
+ ExecState pointer, it's slow enough that it's better to just keep
+ it around in the CTI arguments.
+
+ * VM/CodeBlock.h: Moved the CodeType enum here from ExecState.h.
+
+ * VM/Machine.cpp:
+ (JSC::Machine::execute): Pass fewer arguments when constructing
+ ExecState, and pass the global data pointer when invoking CTI.
+ (JSC::Machine::firstCallFrame): Added. Used to get the dynamic global
+ object, which is in the scope chain of the first call frame.
+ (JSC::Machine::cti_op_add): Use globalData instead of exec when
+ possible, to keep fast cases fast, since it's now more expensive to
+ get to it through the exec pointer.
+ (JSC::Machine::cti_timeout_check): Ditto.
+ (JSC::Machine::cti_op_put_by_id_second): Ditto.
+ (JSC::Machine::cti_op_get_by_id_second): Ditto.
+ (JSC::Machine::cti_op_mul): Ditto.
+ (JSC::Machine::cti_vm_compile): Ditto.
+ (JSC::Machine::cti_op_get_by_val): Ditto.
+ (JSC::Machine::cti_op_sub): Ditto.
+ (JSC::Machine::cti_op_put_by_val): Ditto.
+ (JSC::Machine::cti_op_put_by_val_array): Ditto.
+ (JSC::Machine::cti_op_negate): Ditto.
+ (JSC::Machine::cti_op_div): Ditto.
+ (JSC::Machine::cti_op_pre_dec): Ditto.
+ (JSC::Machine::cti_op_post_inc): Ditto.
+ (JSC::Machine::cti_op_lshift): Ditto.
+ (JSC::Machine::cti_op_bitand): Ditto.
+ (JSC::Machine::cti_op_rshift): Ditto.
+ (JSC::Machine::cti_op_bitnot): Ditto.
+ (JSC::Machine::cti_op_mod): Ditto.
+ (JSC::Machine::cti_op_post_dec): Ditto.
+ (JSC::Machine::cti_op_urshift): Ditto.
+ (JSC::Machine::cti_op_bitxor): Ditto.
+ (JSC::Machine::cti_op_bitor): Ditto.
+ (JSC::Machine::cti_op_call_eval): Ditto.
+ (JSC::Machine::cti_op_throw): Ditto.
+ (JSC::Machine::cti_op_is_string): Ditto.
+ (JSC::Machine::cti_op_debug): Ditto.
+ (JSC::Machine::cti_vm_throw): Ditto.
+
+ * VM/Machine.h: Added firstCallFrame.
+
+ * kjs/DebuggerCallFrame.cpp:
+ (JSC::DebuggerCallFrame::evaluate): Pass fewer arguments when
+ constructing ExecState.
+
+ * kjs/ExecState.cpp: Deleted contents. Later we'll remove the
+ file altogether.
+
+ * kjs/ExecState.h: Removed m_globalObject and m_globalData.
+ Moved CodeType into another header.
+ (JSC::ExecState::ExecState): Take only a single argument, a
+ call frame pointer.
+ (JSC::ExecState::dynamicGlobalObject): Get the object from
+ the first call frame since it's no longer stored.
+ (JSC::ExecState::globalData): Get the global data from the
+ scope chain, since we no longer store a pointer to it here.
+ (JSC::ExecState::identifierTable): Ditto.
+ (JSC::ExecState::propertyNames): Ditto.
+ (JSC::ExecState::emptyList): Ditto.
+ (JSC::ExecState::lexer): Ditto.
+ (JSC::ExecState::parser): Ditto.
+ (JSC::ExecState::machine): Ditto.
+ (JSC::ExecState::arrayTable): Ditto.
+ (JSC::ExecState::dateTable): Ditto.
+ (JSC::ExecState::mathTable): Ditto.
+ (JSC::ExecState::numberTable): Ditto.
+ (JSC::ExecState::regExpTable): Ditto.
+ (JSC::ExecState::regExpConstructorTable): Ditto.
+ (JSC::ExecState::stringTable): Ditto.
+ (JSC::ExecState::heap): Ditto.
+
+ * kjs/FunctionConstructor.cpp:
+ (JSC::FunctionConstructor::FunctionConstructor): Pass
+ JSGlobalData* instead of ExecState* to the InternalFunction
+ constructor.
+ (JSC::constructFunction): Pass the global data pointer when
+ constructing a new scope chain.
+
+ * kjs/InternalFunction.cpp:
+ (JSC::InternalFunction::InternalFunction): Take a JSGlobalData*
+ instead of an ExecState*. Later we can change more places to
+ work this way -- it's more efficient to take the type you need
+ since the caller might already have it.
+ * kjs/InternalFunction.h: Ditto.
+
+ * kjs/JSCell.h:
+ (JSC::JSCell::operator new): Added an overload that takes a
+ JSGlobalData* so you can construct without an ExecState*.
+
+ * kjs/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::init): Moved creation of the global scope
+ chain in here, since it now requires a pointer to the global data.
+ Moved the initialization of the call frame in here since it requires
+ the global scope chain node. Removed the extra argument to ExecState
+ when creating the global ExecState*.
+ * kjs/JSGlobalObject.h: Removed initialization of globalScopeChain
+ and the call frame from the JSGlobalObjectData constructor. Added
+ a thisValue argument to the init function.
+
+ * kjs/JSNumberCell.cpp: Added versions of jsNumberCell that take
+ JSGlobalData* rather than ExecState*.
+ * kjs/JSNumberCell.h:
+ (JSC::JSNumberCell::operator new): Added a version that takes
+ JSGlobalData*.
+ (JSC::JSNumberCell::JSNumberCell): Ditto.
+ (JSC::jsNumber): Ditto.
+ * kjs/JSString.cpp:
+ (JSC::jsString): Ditto.
+ (JSC::jsSubstring): Ditto.
+ (JSC::jsOwnedString): Ditto.
+ * kjs/JSString.h:
+ (JSC::JSString::JSString): Changed to take JSGlobalData*.
+ (JSC::jsEmptyString): Added a version that takes JSGlobalData*.
+ (JSC::jsSingleCharacterString): Ditto.
+ (JSC::jsSingleCharacterSubstring): Ditto.
+ (JSC::jsNontrivialString): Ditto.
+ (JSC::JSString::getIndex): Ditto.
+ (JSC::jsString): Ditto.
+ (JSC::jsSubstring): Ditto.
+ (JSC::jsOwnedString): Ditto.
+
+ * kjs/ScopeChain.h: Added a globalData pointer to each node.
+ (JSC::ScopeChainNode::ScopeChainNode): Initialize the globalData
+ pointer.
+ (JSC::ScopeChainNode::push): Set the global data pointer in the
+ new node.
+ (JSC::ScopeChain::ScopeChain): Take a globalData argument.
+
+ * kjs/SmallStrings.cpp:
+ (JSC::SmallStrings::createEmptyString): Take JSGlobalData* instead of
+ ExecState*.
+ (JSC::SmallStrings::createSingleCharacterString): Ditto.
+ * kjs/SmallStrings.h:
+ (JSC::SmallStrings::emptyString): Ditto.
+ (JSC::SmallStrings::singleCharacterString): Ditto.
+
+2008-10-03 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Bug 21343: REGRESSSION (r37160): ecma_3/ExecutionContexts/10.1.3-1.js and js1_4/Functions/function-001.js fail on 64-bit
+ <https://bugs.webkit.org/show_bug.cgi?id=21343>
+
+ Add a workaround for a bug in GCC, which affects GCC 4.0, GCC 4.2, and
+ llvm-gcc 4.2. I put it in an #ifdef because it was a slight regression
+ on SunSpider in 32-bit, although that might be entirely random.
+
+ * kjs/Arguments.cpp:
+ (JSC::Arguments::getOwnPropertySlot):
+
+2008-10-03 Darin Adler <darin@apple.com>
+
+ Rubber stamped by Alexey Proskuryakov.
+
+ * kjs/Shell.cpp: (main): Don't delete JSGlobalData. Later, we need to change
+ this tool to use public JavaScriptCore API instead.
+
+2008-10-03 Darin Adler <darin@apple.com>
+
+ Suggested by Alexey Proskuryakov.
+
+ * kjs/JSGlobalData.cpp:
+ (JSC::JSGlobalData::~JSGlobalData): Remove call to heap.destroy() because
+ it's too late to ref the JSGlobalData object once it's already being
+ destroyed. In practice this is not a problem because WebCore's JSGlobalData
+ is never destroyed and JSGlobalContextRelease takes care of calling
+ heap.destroy() in advance.
+
+2008-10-02 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Replace SSE3 check with an SSE2 check, and implement SSE2 check on windows.
+
+ 5.6% win on SunSpider on windows.
+
+ * VM/CTI.cpp:
+ (JSC::isSSE2Present):
+ (JSC::CTI::compileBinaryArithOp):
+ (JSC::CTI::compileBinaryArithOpSlowCase):
+
+2008-10-03 Maciej Stachowiak <mjs@apple.com>
+
+ Rubber stamped by Cameron Zwarich.
+
+ - fix mistaken change of | to || which caused a big perf regression on EarleyBoyer
+
+ * kjs/grammar.y:
+
+2008-10-02 Darin Adler <darin@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ - https://bugs.webkit.org/show_bug.cgi?id=21321
+ Bug 21321: speed up JavaScriptCore by inlining Heap in JSGlobalData
+
+ 1.019x as fast on SunSpider.
+
+ * API/JSBase.cpp:
+ (JSEvaluateScript): Use heap. instead of heap-> to work with the heap.
+ (JSCheckScriptSyntax): Ditto.
+ (JSGarbageCollect): Ditto.
+ (JSReportExtraMemoryCost): Ditto.
+ * API/JSContextRef.cpp:
+ (JSGlobalContextRetain): Ditto.
+ (JSGlobalContextRelease): Destroy the heap with the destroy function instead
+ of the delete operator.
+ (JSContextGetGlobalObject): Use heap. instead of heap-> to work with the heap.
+ * API/JSObjectRef.cpp:
+ (JSObjectMake): Use heap. instead of heap-> to work with the heap.
+ (JSObjectMakeFunctionWithCallback): Ditto.
+ (JSObjectMakeConstructor): Ditto.
+ (JSObjectMakeFunction): Ditto.
+ (JSObjectMakeArray): Ditto.
+ (JSObjectMakeDate): Ditto.
+ (JSObjectMakeError): Ditto.
+ (JSObjectMakeRegExp): Ditto.
+ (JSObjectHasProperty): Ditto.
+ (JSObjectGetProperty): Ditto.
+ (JSObjectSetProperty): Ditto.
+ (JSObjectGetPropertyAtIndex): Ditto.
+ (JSObjectSetPropertyAtIndex): Ditto.
+ (JSObjectDeleteProperty): Ditto.
+ (JSObjectCallAsFunction): Ditto.
+ (JSObjectCallAsConstructor): Ditto.
+ (JSObjectCopyPropertyNames): Ditto.
+ (JSPropertyNameAccumulatorAddName): Ditto.
+ * API/JSValueRef.cpp:
+ (JSValueIsEqual): Ditto.
+ (JSValueIsInstanceOfConstructor): Ditto.
+ (JSValueMakeNumber): Ditto.
+ (JSValueMakeString): Ditto.
+ (JSValueToNumber): Ditto.
+ (JSValueToStringCopy): Ditto.
+ (JSValueToObject): Ditto.
+ (JSValueProtect): Ditto.
+ (JSValueUnprotect): Ditto.
+
+ * kjs/ExecState.h:
+ (JSC::ExecState::heap): Update to use the & operator.
+
+ * kjs/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData): Update to initialize a heap member
+ instead of calling new to make a heap.
+ (JSC::JSGlobalData::~JSGlobalData): Destroy the heap with the destroy
+ function instead of the delete operator.
+ * kjs/JSGlobalData.h: Change from Heap* to a Heap.
+ * kjs/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::mark): Use the & operator here.
+ (JSC::JSGlobalObject::operator new): Use heap. instead of heap-> to work
+ with the heap.
+
+2008-10-02 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Bug 21317: Replace RegisterFile size and capacity information with Register pointers
+ <https://bugs.webkit.org/show_bug.cgi?id=21317>
+
+ This is a 2.3% speedup on the V8 DeltaBlue benchmark, a 3.3% speedup on
+ the V8 Raytrace benchmark, and a 1.0% speedup on SunSpider.
+
+ * VM/Machine.cpp:
+ (JSC::slideRegisterWindowForCall):
+ (JSC::Machine::callEval):
+ (JSC::Machine::execute):
+ (JSC::Machine::privateExecute):
+ (JSC::Machine::cti_op_call_JSFunction):
+ (JSC::Machine::cti_op_construct_JSConstruct):
+ * VM/RegisterFile.cpp:
+ (JSC::RegisterFile::~RegisterFile):
+ * VM/RegisterFile.h:
+ (JSC::RegisterFile::RegisterFile):
+ (JSC::RegisterFile::start):
+ (JSC::RegisterFile::end):
+ (JSC::RegisterFile::size):
+ (JSC::RegisterFile::shrink):
+ (JSC::RegisterFile::grow):
+ (JSC::RegisterFile::lastGlobal):
+ (JSC::RegisterFile::markGlobals):
+ (JSC::RegisterFile::markCallFrames):
+ * kjs/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::copyGlobalsTo):
+
+2008-10-02 Cameron Zwarich <zwarich@apple.com>
+
+ Rubber-stamped by Darin Adler.
+
+ Change bitwise operations introduced in r37166 to boolean operations. We
+ only use bitwise operations over boolean operations for increasing
+ performance in extremely hot code, but that does not apply to anything
+ in the parser.
+
+ * kjs/grammar.y:
+
+2008-10-02 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Fix for bug #21232 - should reset m_isPendingDash on flush,
+ and should allow '\-' as beginning or end of a range (though
+ not to specifiy a range itself).
+
+ * ChangeLog:
+ * wrec/CharacterClassConstructor.cpp:
+ (JSC::CharacterClassConstructor::put):
+ (JSC::CharacterClassConstructor::flush):
+ * wrec/CharacterClassConstructor.h:
+ (JSC::CharacterClassConstructor::flushBeforeEscapedHyphen):
+ * wrec/WREC.cpp:
+ (JSC::WRECGenerator::generateDisjunction):
+ (JSC::WRECParser::parseCharacterClass):
+ (JSC::WRECParser::parseDisjunction):
+ * wrec/WREC.h:
+
+2008-10-02 Darin Adler <darin@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ - remove the "static" from declarations in a header file, since we
+ don't want them to have internal linkage
+
+ * VM/Machine.h: Remove the static keyword from the constant and the
+ three inline functions that Geoff just moved here.
+
+2008-10-02 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Fixed https://bugs.webkit.org/show_bug.cgi?id=21283.
+ Profiler Crashes When Started
+
+ * VM/Machine.cpp:
+ * VM/Machine.h:
+ (JSC::makeHostCallFramePointer):
+ (JSC::isHostCallFrame):
+ (JSC::stripHostCallFrameBit): Moved some things to the header so
+ JSGlobalObject could use them.
+
+ * kjs/JSGlobalObject.h:
+ (JSC::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData): Call the
+ new makeHostCallFramePointer API, since 0 no longer indicates a host
+ call frame.
+
+2008-10-02 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=21304
+ Stop using a static wrapper map for WebCore JS bindings
+
+ * kjs/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData):
+ (JSC::JSGlobalData::~JSGlobalData):
+ (JSC::JSGlobalData::ClientData::~ClientData):
+ * kjs/JSGlobalData.h:
+ Added a client data member to JSGlobalData. WebCore will use it to store bindings-related
+ global data.
+
+ * JavaScriptCore.exp: Export virtual ClientData destructor.
+
+2008-10-02 Geoffrey Garen <ggaren@apple.com>
+
+ Not reviewed.
+
+ Try to fix Qt build.
+
+ * kjs/Error.h:
+
+2008-10-01 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler and Cameron Zwarich.
+
+ Preliminary step toward dynamic recompilation: Standardized and
+ simplified the parsing interface.
+
+ The main goal in this patch is to make it easy to ask for a duplicate
+ compilation, and get back a duplicate result -- same source URL, same
+ debugger / profiler ID, same toString behavior, etc.
+
+ The basic unit of compilation and evaluation is now SourceCode, which
+ encompasses a SourceProvider, a range in that provider, and a starting
+ line number.
+
+ A SourceProvider now encompasses a source URL, and *is* a source ID,
+ since a pointer is a unique identifier.
+
+ * API/JSBase.cpp:
+ (JSEvaluateScript):
+ (JSCheckScriptSyntax): Provide a SourceCode to the Interpreter, since
+ other APIs are no longer supported.
+
+ * VM/CodeBlock.h:
+ (JSC::EvalCodeCache::get): Provide a SourceCode to the Interpreter, since
+ other APIs are no longer supported.
+ (JSC::CodeBlock::CodeBlock): ASSERT something that used to be ASSERTed
+ by our caller -- this is a better bottleneck.
+
+ * VM/CodeGenerator.cpp:
+ (JSC::CodeGenerator::CodeGenerator): Updated for the fact that
+ FunctionBodyNode's parameters are no longer a WTF::Vector.
+
+ * kjs/Arguments.cpp:
+ (JSC::Arguments::Arguments): ditto
+
+ * kjs/DebuggerCallFrame.cpp:
+ (JSC::DebuggerCallFrame::evaluate): Provide a SourceCode to the Parser,
+ since other APIs are no longer supported.
+
+ * kjs/FunctionConstructor.cpp:
+ (JSC::constructFunction): Provide a SourceCode to the Parser, since
+ other APIs are no longer supported. Adopt FunctionBodyNode's new
+ "finishParsing" API.
+
+ * kjs/JSFunction.cpp:
+ (JSC::JSFunction::lengthGetter):
+ (JSC::JSFunction::getParameterName): Updated for the fact that
+ FunctionBodyNode's parameters are no longer a wtf::Vector.
+
+ * kjs/JSFunction.h: Nixed some cruft.
+
+ * kjs/JSGlobalObjectFunctions.cpp:
+ (JSC::globalFuncEval): Provide a SourceCode to the Parser, since
+ other APIs are no longer supported.
+
+ * kjs/Parser.cpp:
+ (JSC::Parser::parse): Require a SourceCode argument, instead of a bunch
+ of broken out parameters. Stop tracking sourceId as an integer, since we
+ use the SourceProvider pointer for this now. Don't clamp the
+ startingLineNumber, since SourceCode does that now.
+
+ * kjs/Parser.h:
+ (JSC::Parser::parse): Standardized the parsing interface to require a
+ SourceCode.
+
+ * kjs/Shell.cpp:
+ (functionRun):
+ (functionLoad):
+ (prettyPrintScript):
+ (runWithScripts):
+ (runInteractive): Provide a SourceCode to the Interpreter, since
+ other APIs are no longer supported.
+
+ * kjs/SourceProvider.h:
+ (JSC::SourceProvider::SourceProvider):
+ (JSC::SourceProvider::url):
+ (JSC::SourceProvider::asId):
+ (JSC::UStringSourceProvider::create):
+ (JSC::UStringSourceProvider::UStringSourceProvider): Added new
+ responsibilities described above.
+
+ * kjs/SourceRange.h:
+ (JSC::SourceCode::SourceCode):
+ (JSC::SourceCode::toString):
+ (JSC::SourceCode::provider):
+ (JSC::SourceCode::firstLine):
+ (JSC::SourceCode::data):
+ (JSC::SourceCode::length): Added new responsibilities described above.
+ Renamed SourceRange to SourceCode, based on review feedback. Added
+ a makeSource function for convenience.
+
+ * kjs/debugger.h: Provide a SourceCode to the client, since other APIs
+ are no longer supported.
+
+ * kjs/grammar.y: Provide startingLineNumber when creating a SourceCode.
+
+ * kjs/debugger.h: Treat sourceId as intptr_t to avoid loss of precision
+ on 64bit platforms.
+
+ * kjs/interpreter.cpp:
+ (JSC::Interpreter::checkSyntax):
+ (JSC::Interpreter::evaluate):
+ * kjs/interpreter.h: Require a SourceCode instead of broken out arguments.
+
+ * kjs/lexer.cpp:
+ (JSC::Lexer::setCode):
+ * kjs/lexer.h:
+ (JSC::Lexer::sourceRange): Fold together the SourceProvider and line number
+ into a SourceCode. Fixed a bug where the Lexer would accidentally keep
+ alive the last SourceProvider forever.
+
+ * kjs/nodes.cpp:
+ (JSC::ScopeNode::ScopeNode):
+ (JSC::ProgramNode::ProgramNode):
+ (JSC::ProgramNode::create):
+ (JSC::EvalNode::EvalNode):
+ (JSC::EvalNode::generateCode):
+ (JSC::EvalNode::create):
+ (JSC::FunctionBodyNode::FunctionBodyNode):
+ (JSC::FunctionBodyNode::finishParsing):
+ (JSC::FunctionBodyNode::create):
+ (JSC::FunctionBodyNode::generateCode):
+ (JSC::ProgramNode::generateCode):
+ (JSC::FunctionBodyNode::paramString):
+ * kjs/nodes.h:
+ (JSC::ScopeNode::):
+ (JSC::ScopeNode::sourceId):
+ (JSC::FunctionBodyNode::):
+ (JSC::FunctionBodyNode::parameterCount):
+ (JSC::FuncExprNode::):
+ (JSC::FuncDeclNode::): Store a SourceCode in all ScopeNodes, since
+ SourceCode is now responsible for tracking URL, ID, etc. Streamlined
+ some ad hoc FunctionBodyNode fixups into a "finishParsing" function, to
+ help make clear what you need to do in order to finish parsing a
+ FunctionBodyNode.
+
+ * wtf/Vector.h:
+ (WTF::::releaseBuffer): Don't ASSERT that releaseBuffer() is only called
+ when buffer is not 0, since FunctionBodyNode is more than happy
+ to get back a 0 buffer, and other functions like RefPtr::release() allow
+ for 0, too.
+
+2008-10-01 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Bug 21289: REGRESSION (r37160): Inspector crashes on load
+ <https://bugs.webkit.org/show_bug.cgi?id=21289>
+
+ The code in Arguments::mark() in r37160 was wrong. It marks indices in
+ d->registers, but that makes no sense (they are local variables, not
+ arguments). It should mark those indices in d->registerArray instead.
+
+ This patch also changes Arguments::copyRegisters() to use d->numParameters
+ instead of recomputing it.
+
+ * kjs/Arguments.cpp:
+ (JSC::Arguments::mark):
+ * kjs/Arguments.h:
+ (JSC::Arguments::copyRegisters):
+
+2008-09-30 Darin Adler <darin@apple.com>
+
+ Reviewed by Eric Seidel.
+
+ - https://bugs.webkit.org/show_bug.cgi?id=21214
+ work on getting rid of ExecState
+
+ Eliminate some unneeded uses of dynamicGlobalObject.
+
+ * API/JSClassRef.cpp:
+ (OpaqueJSClass::contextData): Changed to use a map in the global data instead
+ of on the global object. Also fixed to use only a single hash table lookup.
+
+ * API/JSObjectRef.cpp:
+ (JSObjectMakeConstructor): Use lexicalGlobalObject rather than dynamicGlobalObject
+ to get the object prototype.
+
+ * kjs/ArrayPrototype.cpp:
+ (JSC::arrayProtoFuncToString): Use arrayVisitedElements set in global data rather
+ than in the global object.
+ (JSC::arrayProtoFuncToLocaleString): Ditto.
+ (JSC::arrayProtoFuncJoin): Ditto.
+
+ * kjs/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData): Don't initialize opaqueJSClassData, since
+ it's no longer a pointer.
+ (JSC::JSGlobalData::~JSGlobalData): We still need to delete all the values, but
+ we don't need to delete the map since it's no longer a pointer.
+
+ * kjs/JSGlobalData.h: Made opaqueJSClassData a map instead of a pointer to a map.
+ Also added arrayVisitedElements.
+
+ * kjs/JSGlobalObject.h: Removed arrayVisitedElements.
+
+ * kjs/Shell.cpp:
+ (functionRun): Use lexicalGlobalObject instead of dynamicGlobalObject.
+ (functionLoad): Ditto.
+
+2008-10-01 Cameron Zwarich <zwarich@apple.com>
+
+ Not reviewed.
+
+ Speculative Windows build fix.
+
+ * kjs/grammar.y:
+
+2008-10-01 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Bug 21123: using "arguments" in a function should not force creation of an activation object
+ <https://bugs.webkit.org/show_bug.cgi?id=21123>
+
+ Make the 'arguments' object not require a JSActivation. We store the
+ 'arguments' object in the OptionalCalleeArguments call frame slot. We
+ need to be able to get the original 'arguments' object to tear it off
+ when returning from a function, but 'arguments' may be assigned to in a
+ number of ways.
+
+ Therefore, we use the OptionalCalleeArguments slot when we want to get
+ the original activation or we know that 'arguments' was not assigned a
+ different value. When 'arguments' may have been assigned a new value,
+ we use a new local variable that is initialized with 'arguments'. Since
+ a function parameter named 'arguments' may overwrite the value of
+ 'arguments', we also need to be careful to look up 'arguments' in the
+ symbol table, so we get the parameter named 'arguments' instead of the
+ local variable that we have added for holding the 'arguments' object.
+
+ This is a 19.1% win on the V8 Raytrace benchmark using the SunSpider
+ harness, and a 20.7% win using the V8 harness. This amounts to a 6.5%
+ total speedup on the V8 benchmark suite using the V8 harness.
+
+ * VM/CTI.cpp:
+ (JSC::CTI::privateCompileMainPass):
+ * VM/CodeBlock.h:
+ * VM/CodeGenerator.cpp:
+ (JSC::CodeGenerator::CodeGenerator):
+ * VM/Machine.cpp:
+ (JSC::Machine::unwindCallFrame):
+ (JSC::Machine::privateExecute):
+ (JSC::Machine::retrieveArguments):
+ (JSC::Machine::cti_op_init_arguments):
+ (JSC::Machine::cti_op_ret_activation_arguments):
+ * VM/Machine.h:
+ * VM/RegisterFile.h:
+ (JSC::RegisterFile::):
+ * kjs/Arguments.cpp:
+ (JSC::Arguments::mark):
+ (JSC::Arguments::fillArgList):
+ (JSC::Arguments::getOwnPropertySlot):
+ (JSC::Arguments::put):
+ * kjs/Arguments.h:
+ (JSC::Arguments::setRegisters):
+ (JSC::Arguments::init):
+ (JSC::Arguments::Arguments):
+ (JSC::Arguments::copyRegisters):
+ (JSC::JSActivation::copyRegisters):
+ * kjs/JSActivation.cpp:
+ (JSC::JSActivation::argumentsGetter):
+ * kjs/JSActivation.h:
+ (JSC::JSActivation::JSActivationData::JSActivationData):
+ * kjs/grammar.y:
+ * kjs/nodes.h:
+ (JSC::ScopeNode::setUsesArguments):
+ * masm/X86Assembler.h:
+ (JSC::X86Assembler::):
+ (JSC::X86Assembler::orl_mr):
+
+2008-10-01 Kevin McCullough <kmccullough@apple.com>
+
+ Rubberstamped by Geoff Garen.
+
+ Remove BreakpointCheckStatement because it's not used anymore.
+ No effect on sunspider or the jsc tests.
+
+ * kjs/nodes.cpp:
+ * kjs/nodes.h:
+
+2008-09-30 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Improve performance of CTI on windows.
+
+ Currently on platforms where the compiler doesn't allow us to safely
+ index relative to the address of a parameter we need to actually
+ provide a pointer to CTI runtime call arguments. This patch improves
+ performance in this case by making the CTI logic for restoring this
+ parameter much less conservative by only resetting it before we actually
+ make a call, rather than between each and every SF bytecode we generate
+ code for.
+
+ This results in a 3.6% progression on the v8 benchmark when compiled with MSVC.
+
+ * VM/CTI.cpp:
+ (JSC::CTI::emitCall):
+ (JSC::CTI::compileOpCall):
+ (JSC::CTI::privateCompileMainPass):
+ (JSC::CTI::privateCompileSlowCases):
+ (JSC::CTI::privateCompilePutByIdTransition):
+ * VM/CTI.h:
+ * masm/X86Assembler.h:
+ * wtf/Platform.h:
+
+2008-09-30 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ - track uses of "this", "with" and "catch" in the parser
+
+ Knowing this up front will be useful for future optimizations.
+
+ Perf and correctness remain the same.
+
+ * kjs/NodeInfo.h:
+ * kjs/grammar.y:
+
+2008-09-30 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Mark Rowe.
+
+ Add WebKitAvailability macros for JSObjectMakeArray, JSObjectMakeDate, JSObjectMakeError,
+ and JSObjectMakeRegExp
+
+ * API/JSObjectRef.h:
+
+2008-09-30 Darin Adler <darin@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ - https://bugs.webkit.org/show_bug.cgi?id=21214
+ work on getting rid of ExecState
+
+ Replaced the m_prev field of ExecState with a bit in the
+ call frame pointer to indicate "host" call frames.
+
+ * VM/Machine.cpp:
+ (JSC::makeHostCallFramePointer): Added. Sets low bit.
+ (JSC::isHostCallFrame): Added. Checks low bit.
+ (JSC::stripHostCallFrameBit): Added. Clears low bit.
+ (JSC::Machine::unwindCallFrame): Replaced null check that was
+ formerly used to detect host call frames with an isHostCallFrame check.
+ (JSC::Machine::execute): Pass in a host call frame pointer rather than
+ always passing 0 when starting execution from the host. This allows us
+ to follow the entire call frame pointer chain when desired, or to stop
+ at the host calls when that's desired.
+ (JSC::Machine::privateExecute): Replaced null check that was
+ formerly used to detect host call frames with an isHostCallFrame check.
+ (JSC::Machine::retrieveCaller): Ditto.
+ (JSC::Machine::retrieveLastCaller): Ditto.
+ (JSC::Machine::callFrame): Removed the code to walk up m_prev pointers
+ and replaced it with code that uses the caller pointer and uses the
+ stripHostCallFrameBit function.
+
+ * kjs/ExecState.cpp: Removed m_prev.
+ * kjs/ExecState.h: Ditto.
+
+2008-09-30 Cameron Zwarich <zwarich@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Move all detection of 'arguments' in a lexical scope to the parser, in
+ preparation for fixing
+
+ Bug 21123: using "arguments" in a function should not force creation of an activation object
+ <https://bugs.webkit.org/show_bug.cgi?id=21123>
+
+ * VM/CodeGenerator.cpp:
+ (JSC::CodeGenerator::CodeGenerator):
+ * kjs/NodeInfo.h:
+ * kjs/grammar.y:
+
+2008-09-30 Geoffrey Garen <ggaren@apple.com>
+
+ Not reviewed.
+
+ * kjs/Shell.cpp:
+ (runWithScripts): Fixed indentation.
+
+2008-09-30 Mark Rowe <mrowe@apple.com>
+
+ Rubber-stamped by Sam Weinig.
+
+ Build fix. Move InternalFunction::classInfo implementation into the .cpp
+ file to prevent the vtable for InternalFunction being generated as a weak symbol.
+ Has no effect on SunSpider.
+
+ * kjs/InternalFunction.cpp:
+ (JSC::InternalFunction::classInfo):
+ * kjs/InternalFunction.h:
+
+2008-09-29 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin Adler.
+
+ - optimize appending a number to a string
+ https://bugs.webkit.org/show_bug.cgi?id=21203
+
+ It's pretty common in real-world code (and on some of the v8
+ benchmarks) to append a number to a string, so I made this one of
+ the fast cases, and also added support to UString to do it
+ directly without allocating a temporary UString.
+
+ ~1% speedup on v8 benchmark.
+
+ * VM/Machine.cpp:
+ (JSC::jsAddSlowCase): Make this NEVER_INLINE because somehow otherwise
+ the change is a regression.
+ (JSC::jsAdd): Handle number + string special case.
+ (JSC::Machine::cti_op_add): Integrate much of the logic of jsAdd to
+ avoid exception check in the str + str, num + num and str + num cases.
+ * kjs/ustring.cpp:
+ (JSC::expandedSize): Make this a non-member function, since it needs to be
+ called in non-member functions but not outside this file.
+ (JSC::expandCapacity): Ditto.
+ (JSC::UString::expandCapacity): Call the non-member version.
+ (JSC::createRep): Helper to make a rep from a char*.
+ (JSC::UString::UString): Use above helper.
+ (JSC::concatenate): Guts of concatenating constructor for cases where first
+ item is a UString::Rep, and second is a UChar* and length, or a char*.
+ (JSC::UString::append): Implement for cases where first item is a UString::Rep,
+ and second is an int or double. Sadly duplicates logic of UString::from(int)
+ and UString::from(double).
+ * kjs/ustring.h:
+
+2008-09-29 Darin Adler <darin@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ - https://bugs.webkit.org/show_bug.cgi?id=21214
+ work on getting rid of ExecState
+
+ * JavaScriptCore.exp: Updated since JSGlobalObject::init
+ no longer takes a parameter.
+
+ * VM/Machine.cpp:
+ (JSC::Machine::execute): Removed m_registerFile argument
+ for ExecState constructors.
+
+ * kjs/DebuggerCallFrame.cpp:
+ (JSC::DebuggerCallFrame::evaluate): Removed globalThisValue
+ argument for ExecState constructor.
+
+ * kjs/ExecState.cpp:
+ (JSC::ExecState::ExecState): Removed globalThisValue and
+ registerFile arguments to constructors.
+
+ * kjs/ExecState.h: Removed m_globalThisValue and
+ m_registerFile data members.
+
+ * kjs/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::init): Removed globalThisValue
+ argument for ExecState constructor.
+
+ * kjs/JSGlobalObject.h:
+ (JSC::JSGlobalObject::JSGlobalObject): Got rid of parameter
+ for the init function.
+
+2008-09-29 Geoffrey Garen <ggaren@apple.com>
+
+ Rubber-stamped by Cameron Zwarich.
+
+ Fixed https://bugs.webkit.org/show_bug.cgi?id=21225
+ Machine::retrieveLastCaller should check for a NULL codeBlock
+
+ In order to crash, you would need to call retrieveCaller in a situation
+ where you had two host call frames in a row in the register file. I
+ don't know how to make that happen, or if it's even possible, so I don't
+ have a test case -- but better safe than sorry!
+
+ * VM/Machine.cpp:
+ (JSC::Machine::retrieveLastCaller):
+
+2008-09-29 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ Store the callee ScopeChain, not the caller ScopeChain, in the call frame
+ header. Nix the "scopeChain" local variable and ExecState::m_scopeChain, and
+ access the callee ScopeChain through the call frame header instead.
+
+ Profit: call + return are simpler, because they don't have to update the
+ "scopeChain" local variable, or ExecState::m_scopeChain.
+
+ Because CTI keeps "r" in a register, reading the callee ScopeChain relative
+ to "r" can be very fast, in any cases we care to optimize.
+
+ 0% speedup on empty function call benchmark. (5.5% speedup in bytecode.)
+ 0% speedup on SunSpider. (7.5% speedup on controlflow-recursive.)
+ 2% speedup on SunSpider --v8.
+ 2% speedup on v8 benchmark.
+
+ * VM/CTI.cpp: Changed scope chain access to read the scope chain from
+ the call frame header. Sped up op_ret by changing it not to fuss with
+ the "scopeChain" local variable or ExecState::m_scopeChain.
+
+ * VM/CTI.h: Updated CTI trampolines not to take a ScopeChainNode*
+ argument, since that's stored in the call frame header now.
+
+ * VM/Machine.cpp: Access "scopeChain" and "codeBlock" through new helper
+ functions that read from the call frame header. Updated functions operating
+ on ExecState::m_callFrame to account for / take advantage of the fact that
+ Exec:m_callFrame is now never NULL.
+
+ Fixed a bug in op_construct, where it would use the caller's default
+ object prototype, rather than the callee's, when constructing a new object.
+
+ * VM/Machine.h: Made some helper functions available. Removed
+ ScopeChainNode* arguments to a lot of functions, since the ScopeChainNode*
+ is now stored in the call frame header.
+
+ * VM/RegisterFile.h: Renamed "CallerScopeChain" to "ScopeChain", since
+ that's what it is now.
+
+ * kjs/DebuggerCallFrame.cpp: Updated for change to ExecState signature.
+
+ * kjs/ExecState.cpp:
+ * kjs/ExecState.h: Nixed ExecState::m_callFrame, along with the unused
+ isGlobalObject function.
+
+ * kjs/JSGlobalObject.cpp:
+ * kjs/JSGlobalObject.h: Gave the global object a fake call frame in
+ which to store the global scope chain, since our code now assumes that
+ it can always read the scope chain out of the ExecState's call frame.
+
+2008-09-29 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Sam Weinig.
+
+ Remove the isActivationObject() virtual method on JSObject and use
+ StructureID information instead. This should be slightly faster, but
+ isActivationObject() is only used in assertions and unwinding the stack
+ for exceptions.
+
+ * VM/Machine.cpp:
+ (JSC::depth):
+ (JSC::Machine::unwindCallFrame):
+ (JSC::Machine::privateExecute):
+ (JSC::Machine::cti_op_ret_activation):
+ * kjs/JSActivation.cpp:
+ * kjs/JSActivation.h:
+ * kjs/JSObject.h:
+
+2008-09-29 Peter Gal <galpeter@inf.u-szeged.hu>
+
+ Reviewed and tweaked by Darin Adler.
+
+ Fix build for non-all-in-one platforms.
+
+ * kjs/StringPrototype.cpp: Added missing ASCIICType.h include.
+
+2008-09-29 Bradley T. Hughes <bradley.hughes@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Fix compilation with icpc
+
+ * wtf/HashSet.h:
+ (WTF::::find):
+ (WTF::::contains):
+
+2008-09-29 Thiago Macieira <thiago.macieira@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Changed copyright from Trolltech ASA to Nokia.
+
+ Nokia acquired Trolltech ASA, assets were transferred on September 26th 2008.
+
+
+ * wtf/qt/MainThreadQt.cpp:
+
+2008-09-29 Simon Hausmann <hausmann@webkit.org>
+
+ Reviewed by Lars Knoll.
+
+ Don't accidentially install libJavaScriptCore.a for the build inside
+ Qt.
+
+ * JavaScriptCore.pro:
+
+2008-09-28 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Maciej Stachowiak.
+
+ Bug 21200: Allow direct access to 'arguments' without using op_resolve
+ <https://bugs.webkit.org/show_bug.cgi?id=21200>
+
+ Allow fast access to the 'arguments' object by adding an extra slot to
+ the callframe to store it.
+
+ This is a 3.0% speedup on the V8 Raytrace benchmark.
+
+ * JavaScriptCore.exp:
+ * VM/CTI.cpp:
+ (JSC::CTI::privateCompileMainPass):
+ * VM/CodeBlock.cpp:
+ (JSC::CodeBlock::dump):
+ * VM/CodeGenerator.cpp:
+ (JSC::CodeGenerator::CodeGenerator):
+ (JSC::CodeGenerator::registerFor):
+ * VM/CodeGenerator.h:
+ (JSC::CodeGenerator::registerFor):
+ * VM/Machine.cpp:
+ (JSC::Machine::initializeCallFrame):
+ (JSC::Machine::dumpRegisters):
+ (JSC::Machine::privateExecute):
+ (JSC::Machine::retrieveArguments):
+ (JSC::Machine::cti_op_call_JSFunction):
+ (JSC::Machine::cti_op_create_arguments):
+ (JSC::Machine::cti_op_construct_JSConstruct):
+ * VM/Machine.h:
+ * VM/Opcode.h:
+ * VM/RegisterFile.h:
+ (JSC::RegisterFile::):
+ * kjs/JSActivation.cpp:
+ (JSC::JSActivation::mark):
+ (JSC::JSActivation::argumentsGetter):
+ * kjs/JSActivation.h:
+ (JSC::JSActivation::JSActivationData::JSActivationData):
+ * kjs/NodeInfo.h:
+ * kjs/Parser.cpp:
+ (JSC::Parser::didFinishParsing):
+ * kjs/Parser.h:
+ (JSC::Parser::parse):
+ * kjs/grammar.y:
+ * kjs/nodes.cpp:
+ (JSC::ScopeNode::ScopeNode):
+ (JSC::ProgramNode::ProgramNode):
+ (JSC::ProgramNode::create):
+ (JSC::EvalNode::EvalNode):
+ (JSC::EvalNode::create):
+ (JSC::FunctionBodyNode::FunctionBodyNode):
+ (JSC::FunctionBodyNode::create):
+ * kjs/nodes.h:
+ (JSC::ScopeNode::usesArguments):
+
+2008-09-28 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Add an ASCII fast-path to toLowerCase and toUpperCase.
+
+ The fast path speeds up the common case of an ASCII-only string by up to 60% while adding a less than 5% penalty
+ to the less common non-ASCII case.
+
+ This also removes stringProtoFuncToLocaleLowerCase and stringProtoFuncToLocaleUpperCase, which were identical
+ to the non-locale variants of the functions. toLocaleLowerCase and toLocaleUpperCase now use the non-locale
+ variants of the functions directly.
+
+ * kjs/StringPrototype.cpp:
+ (JSC::stringProtoFuncToLowerCase):
+ (JSC::stringProtoFuncToUpperCase):
+
+2008-09-28 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ Speed up parseInt and parseFloat.
+
+ Repeatedly indexing into a UString is slow, so retrieve a pointer into the underlying buffer once up front
+ and use that instead. This is a 7% win on a parseInt/parseFloat micro-benchmark.
+
+ * kjs/JSGlobalObjectFunctions.cpp:
+ (JSC::parseInt):
+ (JSC::parseFloat):
+
+2008-09-28 Simon Hausmann <hausmann@webkit.org>
+
+ Reviewed by David Hyatt.
+
+ In Qt's initializeThreading re-use an existing thread identifier for the main
+ thread if it exists.
+
+ currentThread() implicitly creates new identifiers and it could be that
+ it is called before initializeThreading().
+
+ * wtf/ThreadingQt.cpp:
+ (WTF::initializeThreading):
+
+2008-09-27 Keishi Hattori <casey.hattori@gmail.com>
+
+ Added Machine::retrieveCaller to the export list.
+
+ Reviewed by Kevin McCullough and Tim Hatcher.
+
+ * JavaScriptCore.exp: Added Machine::retrieveCaller.
+
+2008-09-27 Anders Carlsson <andersca@apple.com>
+
+ Fix build.
+
+ * VM/CTI.cpp:
+ (JSC::):
+
+2008-09-27 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ https://bugs.webkit.org/show_bug.cgi?id=21175
+
+ Store the callee CodeBlock, not the caller CodeBlock, in the call frame
+ header. Nix the "codeBlock" local variable, and access the callee
+ CodeBlock through the call frame header instead.
+
+ Profit: call + return are simpler, because they don't have to update the
+ "codeBlock" local variable.
+
+ Because CTI keeps "r" in a register, reading the callee CodeBlock relative
+ to "r" can be very fast, in any cases we care to optimize. Presently,
+ no such cases seem important.
+
+ Also, stop writing "dst" to the call frame header. CTI doesn't use it.
+
+ 21.6% speedup on empty function call benchmark.
+ 3.8% speedup on SunSpider --v8.
+ 2.1% speedup on v8 benchmark.
+ 0.7% speedup on SunSpider (6% speedup on controlflow-recursive).
+
+ Small regression in bytecode, because currently every op_ret reads the
+ callee CodeBlock to check needsFullScopeChain, and bytecode does not
+ keep "r" in a register. On-balance, this is probably OK, since CTI is
+ our high-performance execution model. Also, this should go away once
+ we make needsFullScopeChain statically determinable at parse time.
+
+ * VM/CTI.cpp:
+ (JSC::CTI::compileOpCall): The speedup!
+ (JSC::CTI::privateCompileSlowCases): ditto
+
+ * VM/CTI.h:
+ (JSC::): Fixed up magic trampoline constants to account for the nixed
+ "codeBlock" argument.
+ (JSC::CTI::execute): Changed trampoline function not to take a "codeBlock"
+ argument, since codeBlock is now stored in the call frame header.
+
+ * VM/Machine.cpp: Read the callee CodeBlock from the register file. Use
+ a NULL CallerRegisters in the call frame header to signal a built-in
+ caller, since CodeBlock is now never NULL.
+
+ * VM/Machine.h: Made some stand-alone functions Machine member functions
+ so they could call the private codeBlock() accessor in the Register
+ class, of which Machine is a friend. Renamed "CallerCodeBlock" to
+ "CodeBlock", since it's no longer the caller's CodeBlock.
+
+ * VM/RegisterFile.h: Marked some methods const to accommodate a
+ const RegisterFile* being passed around in Machine.cpp.
+
+2008-09-26 Jan Michael Alonzo <jmalonzo@webkit.org>
+
+ Gtk build fix. Not reviewed.
+
+ Narrow-down the target of the JavaScriptCore .lut.h generator so
+ it won't try to create the WebCore .lut.hs.
+
+ * GNUmakefile.am:
+
+2008-09-26 Matt Lilek <webkit@mattlilek.com>
+
+ Reviewed by Tim Hatcher.
+
+ Update FEATURE_DEFINES after ENABLE_CROSS_DOCUMENT_MESSAGING was removed.
+
+ * Configurations/JavaScriptCore.xcconfig:
+
+2008-09-26 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Rubber-stamped by Anders Carlson.
+
+ Change the name 'sc' to 'scopeChainNode' in a few places.
+
+ * kjs/nodes.cpp:
+ (JSC::EvalNode::generateCode):
+ (JSC::FunctionBodyNode::generateCode):
+ (JSC::ProgramNode::generateCode):
+
+2008-09-26 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ Patch for https://bugs.webkit.org/show_bug.cgi?id=21152
+ Speedup static property get/put
+
+ Convert getting/setting static property values to use static functions
+ instead of storing an integer and switching in getValueProperty/putValueProperty.
+
+ * kjs/JSObject.cpp:
+ (JSC::JSObject::deleteProperty):
+ (JSC::JSObject::getPropertyAttributes):
+ * kjs/MathObject.cpp:
+ (JSC::MathObject::getOwnPropertySlot):
+ * kjs/NumberConstructor.cpp:
+ (JSC::numberConstructorNaNValue):
+ (JSC::numberConstructorNegInfinity):
+ (JSC::numberConstructorPosInfinity):
+ (JSC::numberConstructorMaxValue):
+ (JSC::numberConstructorMinValue):
+ * kjs/PropertySlot.h:
+ (JSC::PropertySlot::):
+ * kjs/RegExpConstructor.cpp:
+ (JSC::regExpConstructorDollar1):
+ (JSC::regExpConstructorDollar2):
+ (JSC::regExpConstructorDollar3):
+ (JSC::regExpConstructorDollar4):
+ (JSC::regExpConstructorDollar5):
+ (JSC::regExpConstructorDollar6):
+ (JSC::regExpConstructorDollar7):
+ (JSC::regExpConstructorDollar8):
+ (JSC::regExpConstructorDollar9):
+ (JSC::regExpConstructorInput):
+ (JSC::regExpConstructorMultiline):
+ (JSC::regExpConstructorLastMatch):
+ (JSC::regExpConstructorLastParen):
+ (JSC::regExpConstructorLeftContext):
+ (JSC::regExpConstructorRightContext):
+ (JSC::setRegExpConstructorInput):
+ (JSC::setRegExpConstructorMultiline):
+ (JSC::RegExpConstructor::setInput):
+ (JSC::RegExpConstructor::setMultiline):
+ (JSC::RegExpConstructor::multiline):
+ * kjs/RegExpConstructor.h:
+ * kjs/RegExpObject.cpp:
+ (JSC::regExpObjectGlobal):
+ (JSC::regExpObjectIgnoreCase):
+ (JSC::regExpObjectMultiline):
+ (JSC::regExpObjectSource):
+ (JSC::regExpObjectLastIndex):
+ (JSC::setRegExpObjectLastIndex):
+ * kjs/RegExpObject.h:
+ (JSC::RegExpObject::setLastIndex):
+ (JSC::RegExpObject::lastIndex):
+ (JSC::RegExpObject::RegExpObjectData::RegExpObjectData):
+ * kjs/StructureID.cpp:
+ (JSC::StructureID::getEnumerablePropertyNames):
+ * kjs/create_hash_table:
+ * kjs/lexer.cpp:
+ (JSC::Lexer::lex):
+ * kjs/lookup.cpp:
+ (JSC::HashTable::createTable):
+ (JSC::HashTable::deleteTable):
+ (JSC::setUpStaticFunctionSlot):
+ * kjs/lookup.h:
+ (JSC::HashEntry::initialize):
+ (JSC::HashEntry::setKey):
+ (JSC::HashEntry::key):
+ (JSC::HashEntry::attributes):
+ (JSC::HashEntry::function):
+ (JSC::HashEntry::functionLength):
+ (JSC::HashEntry::propertyGetter):
+ (JSC::HashEntry::propertyPutter):
+ (JSC::HashEntry::lexerValue):
+ (JSC::HashEntry::):
+ (JSC::HashTable::entry):
+ (JSC::getStaticPropertySlot):
+ (JSC::getStaticValueSlot):
+ (JSC::lookupPut):
+
+2008-09-26 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Maciej Stachowiak & Oliver Hunt.
+
+ Add support for reusing temporary JSNumberCells. This change is based on the observation
+ that if the result of certain operations is a JSNumberCell and is consumed by a subsequent
+ operation that would produce a JSNumberCell, we can reuse the object rather than allocating
+ a fresh one. E.g. given the expression ((a * b) * c), we can statically determine that
+ (a * b) will have a numeric result (or else it will have thrown an exception), so the result
+ will either be a JSNumberCell or a JSImmediate.
+
+ This patch changes three areas of JSC:
+ * The AST now tracks type information about the result of each node.
+ * This information is consumed in bytecode compilation, and certain bytecode operations
+ now carry the statically determined type information about their operands.
+ * CTI uses the information in a number of fashions:
+ * Where an operand to certain arithmetic operations is reusable, it will plant code
+ to try to perform the operation in JIT code & reuse the cell, where appropriate.
+ * Where it can be statically determined that an operand can only be numeric (typically
+ the result of another arithmetic operation) the code will not redundantly check that
+ the JSCell is a JSNumberCell.
+ * Where either of the operands to an add are non-numeric do not plant an optimized
+ arithmetic code path, just call straight out to the C function.
+
+ +6% Sunspider (10% progression on 3D, 16% progression on math, 60% progression on access-nbody),
+ +1% v8-tests (improvements in raytrace & crypto)
+
+ * VM/CTI.cpp: Add optimized code generation with reuse of temporary JSNumberCells.
+ * VM/CTI.h:
+ * kjs/JSNumberCell.h:
+ * masm/X86Assembler.h:
+
+ * VM/CodeBlock.cpp: Add type information to specific bytecodes.
+ * VM/CodeGenerator.cpp:
+ * VM/CodeGenerator.h:
+ * VM/Machine.cpp:
+
+ * kjs/nodes.cpp: Track static type information for nodes.
+ * kjs/nodes.h:
+ * kjs/ResultDescriptor.h: (Added)
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2008-09-26 Yichao Yin <yichao.yin@torchmobile.com.cn>
+
+ Reviewed by George Staikos, Maciej Stachowiak.
+
+ Add utility functions needed for upcoming WML code.
+
+ * wtf/ASCIICType.h:
+ (WTF::isASCIIPrintable):
+
+2008-09-26 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Reverted the part of r36614 that used static data because static data
+ is not thread-safe.
+
+2008-09-26 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Removed dynamic check for whether the callee needs an activation object.
+ Replaced with callee code to create the activation object.
+
+ 0.5% speedup on SunSpider.
+ No change on v8 benchmark. (Might be a speedup, but it's in range of the
+ variance.)
+
+ 0.7% speedup on v8 benchmark in bytecode.
+ 1.3% speedup on empty call benchmark in bytecode.
+
+ * VM/CTI.cpp:
+ (JSC::CTI::privateCompileMainPass): Added support for op_init_activation,
+ the new opcode that specifies that the callee's initialization should
+ create an activation object.
+ (JSC::CTI::privateCompile): Removed previous code that did a similar
+ thing in an ad-hoc way.
+
+ * VM/CodeBlock.cpp:
+ (JSC::CodeBlock::dump): Added a case for dumping op_init_activation.
+
+ * VM/CodeGenerator.cpp:
+ (JSC::CodeGenerator::generate): Added fixup code to change op_init to
+ op_init_activation if necessary. (With a better parser, we would know
+ which to use from the beginning.)
+
+ * VM/Instruction.h:
+ (JSC::Instruction::Instruction):
+ (WTF::): Faster traits for the instruction vector. An earlier version
+ of this patch relied on inserting at the beginning of the vector, and
+ depended on this change for speed.
+
+ * VM/Machine.cpp:
+ (JSC::Machine::execute): Removed clients of setScopeChain, the old
+ abstraction for dynamically checking for whether an activation object
+ needed to be created.
+ (JSC::Machine::privateExecute): ditto
+
+ (JSC::Machine::cti_op_push_activation): Renamed this function from
+ cti_vm_updateScopeChain, and made it faster by removing the call to
+ setScopeChain.
+ * VM/Machine.h:
+
+ * VM/Opcode.h: Declared op_init_activation.
+
+2008-09-24 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Move most of the return code back into the callee, now that the callee
+ doesn't have to calculate anything dynamically.
+
+ 11.5% speedup on empty function call benchmark.
+
+ SunSpider says 0.3% faster. SunSpider --v8 says no change.
+
+ * VM/CTI.cpp:
+ (JSC::CTI::compileOpCall):
+ (JSC::CTI::privateCompileMainPass):
+ (JSC::CTI::privateCompileSlowCases):
+
+2008-09-24 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Maciej Stachowiak.
+
+ Remove staticFunctionGetter. There is only one remaining user of
+ staticFunctionGetter and it can be converted to use setUpStaticFunctionSlot.
+
+ * JavaScriptCore.exp:
+ * kjs/lookup.cpp:
+ * kjs/lookup.h:
+
+2008-09-24 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ - inline JIT fast case of op_neq
+ - remove extra level of function call indirection from slow cases of eq and neq
+
+ 1% speedup on Richards
+
+ * VM/CTI.cpp:
+ (JSC::CTI::privateCompileMainPass):
+ (JSC::CTI::privateCompileSlowCases):
+ * VM/Machine.cpp:
+ (JSC::Machine::privateExecute):
+ (JSC::Machine::cti_op_eq):
+ (JSC::Machine::cti_op_neq):
+ * kjs/operations.cpp:
+ (JSC::equal):
+ (JSC::equalSlowCase):
+ * kjs/operations.h:
+ (JSC::equalSlowCaseInline):
+
+2008-09-24 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ Fix for https://bugs.webkit.org/show_bug.cgi?id=21080
+ <rdar://problem/6243534>
+ Crash below Function.apply when using a runtime array as the argument list
+
+ Test: plugins/bindings-array-apply-crash.html
+
+ * kjs/FunctionPrototype.cpp:
+ (JSC::functionProtoFuncApply): Revert to the slow case if the object inherits from
+ JSArray (via ClassInfo) but is not a JSArray.
+
+2008-09-24 Kevin McCullough <kmccullough@apple.com>
+
+ Style change.
+
+ * kjs/nodes.cpp:
+ (JSC::statementListEmitCode):
+
+2008-09-24 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Geoff.
+
+ Bug 21031: Breakpoints in the condition of loops only breaks the first
+ time
+ - Now when setting breakpoints in the condition of a loop (for, while,
+ for in, and do while) will successfully break each time throught the
+ loop.
+ - For 'for' loops we need a little more complicated behavior that cannot
+ be accomplished without some more significant changes:
+ https://bugs.webkit.org/show_bug.cgi?id=21073
+
+ * kjs/nodes.cpp:
+ (JSC::statementListEmitCode): We don't want to blindly emit a debug hook
+ at the first line of loops, instead let the loop emit the debug hooks.
+ (JSC::DoWhileNode::emitCode):
+ (JSC::WhileNode::emitCode):
+ (JSC::ForNode::emitCode):
+ (JSC::ForInNode::emitCode):
+ * kjs/nodes.h:
+ (JSC::StatementNode::):
+ (JSC::DoWhileNode::):
+ (JSC::WhileNode::):
+ (JSC::ForInNode::):
+
+2008-09-24 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Fixed <rdar://problem/5605532> Need a SPI for telling JS the size of
+ the objects it retains
+
+ * API/tests/testapi.c: Test the new SPI a little.
+
+ * API/JSSPI.cpp: Add the new SPI.
+ * API/JSSPI.h: Add the new SPI.
+ * JavaScriptCore.exp: Add the new SPI.
+ * JavaScriptCore.xcodeproj/project.pbxproj: Add the new SPI.
+
+2008-09-24 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ * API/JSBase.h: Filled in some missing function names.
+
+2008-09-24 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ Fixed https://bugs.webkit.org/show_bug.cgi?id=21057
+ Crash in RegisterID::deref() running fast/canvas/canvas-putImageData.html
+
+ * VM/CodeGenerator.h: Changed declaration order to ensure the
+ m_lastConstant, which is a RefPtr that points into m_calleeRegisters,
+ has its destructor called before the destructor for m_calleeRegisters.
+
+2008-09-24 Darin Adler <darin@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ - https://bugs.webkit.org/show_bug.cgi?id=21047
+ speed up ret_activation with inlining
+
+ About 1% on v8-raytrace.
+
+ * JavaScriptCore.exp: Removed JSVariableObject::setRegisters.
+
+ * kjs/JSActivation.cpp: Moved copyRegisters to the header to make it inline.
+ * kjs/JSActivation.h:
+ (JSC::JSActivation::copyRegisters): Moved here. Also removed the registerArraySize
+ argument to setRegisters, since the object doesn't need to store the number of
+ registers.
+
+ * kjs/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::reset): Removed unnecessary clearing left over from when we
+ used this on objects that weren't brand new. These days, this function is really
+ just part of the constructor.
+
+ * kjs/JSGlobalObject.h: Added registerArraySize to JSGlobalObjectData, since
+ JSVariableObjectData no longer needs it. Added a setRegisters override here
+ that handles storing the size.
+
+ * kjs/JSStaticScopeObject.h: Removed code to set registerArraySize, since it
+ no longer exists.
+
+ * kjs/JSVariableObject.cpp: Moved copyRegisterArray and setRegisters to the
+ header to make them inline.
+ * kjs/JSVariableObject.h: Removed registerArraySize from JSVariableObjectData,
+ since it was only used for the global object.
+ (JSC::JSVariableObject::copyRegisterArray): Moved here ot make it inline.
+ (JSC::JSVariableObject::setRegisters): Moved here to make it inline. Also
+ removed the code to set registerArraySize and changed an if statement into
+ an assert to save an unnnecessary branch.
+
+2008-09-24 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ - inline PropertyMap::getOffset to speed up polymorphic lookups
+
+ ~1.5% speedup on v8 benchmark
+ no effect on SunSpider
+
+ * JavaScriptCore.exp:
+ * kjs/PropertyMap.cpp:
+ * kjs/PropertyMap.h:
+ (JSC::PropertyMap::getOffset):
+
+2008-09-24 Jan Michael Alonzo <jmalonzo@webkit.org>
+
+ Reviewed by Alp Toker.
+
+ https://bugs.webkit.org/show_bug.cgi?id=20992
+ Build fails on GTK+ Mac OS
+
+ * wtf/ThreadingGtk.cpp: Remove platform ifdef as suggested by
+ Richard Hult.
+ (WTF::initializeThreading):
+
+2008-09-23 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Bug 19968: Slow Script at www.huffingtonpost.com
+ <https://bugs.webkit.org/show_bug.cgi?id=19968>
+
+ Finally found the cause of this accursed issue. It is triggered
+ by synchronous creation of a new global object from JS. The new
+ global object resets the timer state in this execution group's
+ Machine, taking timerCheckCount to 0. Then when JS returns the
+ timerCheckCount is decremented making it non-zero. The next time
+ we execute JS we will start the timeout counter, however the non-zero
+ timeoutCheckCount means we don't reset the timer information. This
+ means that the timeout check is now checking the cumulative time
+ since the creation of the global object rather than the time since
+ JS was last entered. At this point the slow script dialog is guaranteed
+ to eventually be displayed incorrectly unless a page is loaded
+ asynchronously (which will reset everything into a sane state).
+
+ The fix for this is rather trivial -- the JSGlobalObject constructor
+ should not be resetting the machine timer state.
+
+ * VM/Machine.cpp:
+ (JSC::Machine::Machine):
+ Now that we can't rely on the GlobalObject initialising the timeout
+ state, we do it in the Machine constructor.
+
+ * VM/Machine.h:
+ (JSC::Machine::stopTimeoutCheck):
+ Add assertions to guard against this happening.
+
+ * kjs/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::init):
+ Don't reset the timeout state.
+
+2008-09-23 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Fixed https://bugs.webkit.org/show_bug.cgi?id=21038 | <rdar://problem/6240812>
+ Uncaught exceptions in regex replace callbacks crash webkit
+
+ This was a combination of two problems:
+
+ (1) the replace function would continue execution after an exception
+ had been thrown.
+
+ (2) In some cases, the Machine would return 0 in the case of an exception,
+ despite the fact that a few clients dereference the Machine's return
+ value without first checking for an exception.
+
+ * VM/Machine.cpp:
+ (JSC::Machine::execute):
+
+ ^ Return jsNull() instead of 0 in the case of an exception, since some
+ clients depend on using our return value.
+
+ ^ ASSERT that execution does not continue after an exception has been
+ thrown, to help catch problems like this in the future.
+
+ * kjs/StringPrototype.cpp:
+ (JSC::stringProtoFuncReplace):
+
+ ^ Stop execution if an exception has been thrown.
+
+2008-09-23 Geoffrey Garen <ggaren@apple.com>
+
+ Try to fix the windows build.
+
+ * VM/CTI.cpp:
+ (JSC::CTI::compileOpCall):
+ (JSC::CTI::privateCompileMainPass):
+
+2008-09-23 Alp Toker <alp@nuanti.com>
+
+ Build fix.
+
+ * VM/CTI.h:
+
+2008-09-23 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ * wtf/Platform.h: Removed duplicate #if.
+
+2008-09-23 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Changed the layout of the call frame from
+
+ { header, parameters, locals | constants, temporaries }
+
+ to
+
+ { parameters, header | locals, constants, temporaries }
+
+ This simplifies function entry+exit, and enables a number of future
+ optimizations.
+
+ 13.5% speedup on empty call benchmark for bytecode; 23.6% speedup on
+ empty call benchmark for CTI.
+
+ SunSpider says no change. SunSpider --v8 says 1% faster.
+
+ * VM/CTI.cpp:
+
+ Added a bit of abstraction for calculating whether a register is a
+ constant, since this patch changes that calculation:
+ (JSC::CTI::isConstant):
+ (JSC::CTI::getConstant):
+ (JSC::CTI::emitGetArg):
+ (JSC::CTI::emitGetPutArg):
+ (JSC::CTI::getConstantImmediateNumericArg):
+
+ Updated for changes to callframe header location:
+ (JSC::CTI::emitPutToCallFrameHeader):
+ (JSC::CTI::emitGetFromCallFrameHeader):
+ (JSC::CTI::printOpcodeOperandTypes):
+
+ Renamed to spite Oliver:
+ (JSC::CTI::emitInitRegister):
+
+ Added an abstraction for emitting a call through a register, so that
+ calls through registers generate exception info, too:
+ (JSC::CTI::emitCall):
+
+ Updated to match the new callframe header layout, and to support calls
+ through registers, which have no destination address:
+ (JSC::CTI::compileOpCall):
+ (JSC::CTI::privateCompileMainPass):
+ (JSC::CTI::privateCompileSlowCases):
+ (JSC::CTI::privateCompile):
+
+ * VM/CTI.h:
+
+ More of the above:
+ (JSC::CallRecord::CallRecord):
+
+ * VM/CodeBlock.cpp:
+
+ Updated for new register layout:
+ (JSC::registerName):
+ (JSC::CodeBlock::dump):
+
+ * VM/CodeBlock.h:
+
+ Updated CodeBlock to track slightly different information about the
+ register frame, and tweaked the style of an ASSERT_NOT_REACHED.
+ (JSC::CodeBlock::CodeBlock):
+ (JSC::CodeBlock::getStubInfo):
+
+ * VM/CodeGenerator.cpp:
+
+ Added some abstraction around constant register allocation, since this
+ patch changes it, changed codegen to account for the new callframe
+ layout, and added abstraction around register fetching code
+ that used to assume that all local registers lived at negative indices,
+ since vars now live at positive indices:
+ (JSC::CodeGenerator::generate):
+ (JSC::CodeGenerator::addVar):
+ (JSC::CodeGenerator::addGlobalVar):
+ (JSC::CodeGenerator::allocateConstants):
+ (JSC::CodeGenerator::CodeGenerator):
+ (JSC::CodeGenerator::addParameter):
+ (JSC::CodeGenerator::registerFor):
+ (JSC::CodeGenerator::constRegisterFor):
+ (JSC::CodeGenerator::newRegister):
+ (JSC::CodeGenerator::newTemporary):
+ (JSC::CodeGenerator::highestUsedRegister):
+ (JSC::CodeGenerator::addConstant):
+
+ ASSERT that our caller referenced the registers it passed to us.
+ Otherwise, we might overwrite them with parameters:
+ (JSC::CodeGenerator::emitCall):
+ (JSC::CodeGenerator::emitConstruct):
+
+ * VM/CodeGenerator.h:
+
+ Added some abstraction for getting a RegisterID for a given index,
+ since the rules are a little weird:
+ (JSC::CodeGenerator::registerFor):
+
+ * VM/Machine.cpp:
+
+ Utility function to transform a machine return PC to a virtual machine
+ return VPC, for the sake of stack unwinding, since both PCs are stored
+ in the same location now:
+ (JSC::vPCForPC):
+
+ Tweaked to account for new call frame:
+ (JSC::Machine::initializeCallFrame):
+
+ Tweaked to account for registerOffset supplied by caller:
+ (JSC::slideRegisterWindowForCall):
+
+ Tweaked to account for new register layout:
+ (JSC::scopeChainForCall):
+ (JSC::Machine::callEval):
+ (JSC::Machine::dumpRegisters):
+ (JSC::Machine::unwindCallFrame):
+ (JSC::Machine::execute):
+
+ Changed op_call and op_construct to implement the new calling convention:
+ (JSC::Machine::privateExecute):
+
+ Tweaked to account for the new register layout:
+ (JSC::Machine::retrieveArguments):
+ (JSC::Machine::retrieveCaller):
+ (JSC::Machine::retrieveLastCaller):
+ (JSC::Machine::callFrame):
+ (JSC::Machine::getArgumentsData):
+
+ Changed CTI call helpers to implement the new calling convention:
+ (JSC::Machine::cti_op_call_JSFunction):
+ (JSC::Machine::cti_op_call_NotJSFunction):
+ (JSC::Machine::cti_op_ret_activation):
+ (JSC::Machine::cti_op_ret_profiler):
+ (JSC::Machine::cti_op_construct_JSConstruct):
+ (JSC::Machine::cti_op_construct_NotJSConstruct):
+ (JSC::Machine::cti_op_call_eval):
+
+ * VM/Machine.h:
+
+ * VM/Opcode.h:
+
+ Renamed op_initialise_locals to op_init, because this opcode
+ doesn't initialize all locals, and it doesn't initialize only locals.
+ Also, to spite Oliver.
+
+ * VM/RegisterFile.h:
+
+ New call frame enumeration values:
+ (JSC::RegisterFile::):
+
+ Simplified the calculation of whether a RegisterID is a temporary,
+ since we can no longer assume that all positive non-constant registers
+ are temporaries:
+ * VM/RegisterID.h:
+ (JSC::RegisterID::RegisterID):
+ (JSC::RegisterID::setTemporary):
+ (JSC::RegisterID::isTemporary):
+
+ Renamed firstArgumentIndex to firstParameterIndex because the assumption
+ that this variable pertained to the actual arguments supplied by the
+ caller caused me to write some buggy code:
+ * kjs/Arguments.cpp:
+ (JSC::ArgumentsData::ArgumentsData):
+ (JSC::Arguments::Arguments):
+ (JSC::Arguments::fillArgList):
+ (JSC::Arguments::getOwnPropertySlot):
+ (JSC::Arguments::put):
+
+ Updated for new call frame layout:
+ * kjs/DebuggerCallFrame.cpp:
+ (JSC::DebuggerCallFrame::functionName):
+ (JSC::DebuggerCallFrame::type):
+ * kjs/DebuggerCallFrame.h:
+
+ Changed the activation object to account for the fact that a call frame
+ header now sits between parameters and local variables. This change
+ requires all variable objects to do their own marking, since they
+ now use their register storage differently:
+ * kjs/JSActivation.cpp:
+ (JSC::JSActivation::mark):
+ (JSC::JSActivation::copyRegisters):
+ (JSC::JSActivation::createArgumentsObject):
+ * kjs/JSActivation.h:
+
+ Updated global object to use the new interfaces required by the change
+ to JSActivation above:
+ * kjs/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::reset):
+ (JSC::JSGlobalObject::mark):
+ (JSC::JSGlobalObject::copyGlobalsFrom):
+ (JSC::JSGlobalObject::copyGlobalsTo):
+ * kjs/JSGlobalObject.h:
+ (JSC::JSGlobalObject::addStaticGlobals):
+
+ Updated static scope object to use the new interfaces required by the
+ change to JSActivation above:
+ * kjs/JSStaticScopeObject.cpp:
+ (JSC::JSStaticScopeObject::mark):
+ (JSC::JSStaticScopeObject::~JSStaticScopeObject):
+ * kjs/JSStaticScopeObject.h:
+ (JSC::JSStaticScopeObject::JSStaticScopeObject):
+ (JSC::JSStaticScopeObject::d):
+
+ Updated variable object to use the new interfaces required by the
+ change to JSActivation above:
+ * kjs/JSVariableObject.cpp:
+ (JSC::JSVariableObject::copyRegisterArray):
+ (JSC::JSVariableObject::setRegisters):
+ * kjs/JSVariableObject.h:
+
+ Changed the bit twiddling in symbol table not to assume that all indices
+ are negative, since they can be positive now:
+ * kjs/SymbolTable.h:
+ (JSC::SymbolTableEntry::SymbolTableEntry):
+ (JSC::SymbolTableEntry::isNull):
+ (JSC::SymbolTableEntry::getIndex):
+ (JSC::SymbolTableEntry::getAttributes):
+ (JSC::SymbolTableEntry::setAttributes):
+ (JSC::SymbolTableEntry::isReadOnly):
+ (JSC::SymbolTableEntry::pack):
+ (JSC::SymbolTableEntry::isValidIndex):
+
+ Changed call and construct nodes to ref their functions and/or bases,
+ so that emitCall/emitConstruct doesn't overwrite them with parameters.
+ Also, updated for rename to registerFor:
+ * kjs/nodes.cpp:
+ (JSC::ResolveNode::emitCode):
+ (JSC::NewExprNode::emitCode):
+ (JSC::EvalFunctionCallNode::emitCode):
+ (JSC::FunctionCallValueNode::emitCode):
+ (JSC::FunctionCallResolveNode::emitCode):
+ (JSC::FunctionCallBracketNode::emitCode):
+ (JSC::FunctionCallDotNode::emitCode):
+ (JSC::PostfixResolveNode::emitCode):
+ (JSC::DeleteResolveNode::emitCode):
+ (JSC::TypeOfResolveNode::emitCode):
+ (JSC::PrefixResolveNode::emitCode):
+ (JSC::ReadModifyResolveNode::emitCode):
+ (JSC::AssignResolveNode::emitCode):
+ (JSC::ConstDeclNode::emitCodeSingle):
+ (JSC::ForInNode::emitCode):
+
+ Added abstraction for getting exception info out of a call through a
+ register:
+ * masm/X86Assembler.h:
+ (JSC::X86Assembler::emitCall):
+
+ Removed duplicate #if:
+ * wtf/Platform.h:
+
+2008-09-23 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Darin.
+
+ Bug 21030: The JS debugger breaks on the do of a do-while not the while
+ (where the conditional statement is)
+ https://bugs.webkit.org/show_bug.cgi?id=21030
+ Now the statementListEmitCode detects if a do-while node is being
+ emited and emits the debug hook on the last line instead of the first.
+
+ This change had no effect on sunspider.
+
+ * kjs/nodes.cpp:
+ (JSC::statementListEmitCode):
+ * kjs/nodes.h:
+ (JSC::StatementNode::isDoWhile):
+ (JSC::DoWhileNode::isDoWhile):
+
+2008-09-23 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ - inline the fast case of instanceof
+ https://bugs.webkit.org/show_bug.cgi?id=20818
+
+ ~2% speedup on EarleyBoyer test.
+
+ * VM/CTI.cpp:
+ (JSC::CTI::privateCompileMainPass):
+ (JSC::CTI::privateCompileSlowCases):
+ * VM/Machine.cpp:
+ (JSC::Machine::cti_op_instanceof):
+
+2008-09-23 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ - add forgotten slow case logic for !==
+
+ * VM/CTI.cpp:
+ (JSC::CTI::privateCompileSlowCases):
+
+2008-09-23 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ - inline the fast cases of !==, same as for ===
+
+ 2.9% speedup on EarleyBoyer benchmark
+
+ * VM/CTI.cpp:
+ (JSC::CTI::compileOpStrictEq): Factored stricteq codegen into this function,
+ and parameterized so it can do the reverse version as well.
+ (JSC::CTI::privateCompileMainPass): Use the above for stricteq and nstricteq.
+ * VM/CTI.h:
+ (JSC::CTI::): Declare above stuff.
+ * VM/Machine.cpp:
+ (JSC::Machine::cti_op_nstricteq): Removed fast cases, now handled inline.
+
+2008-09-23 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 20989: Aguments constructor should put 'callee' and 'length' properties in a more efficient way
+ <https://bugs.webkit.org/show_bug.cgi?id=20989>
+
+ Make special cases for the 'callee' and 'length' properties in the
+ Arguments object.
+
+ This is somewhere between a 7.8% speedup and a 10% speedup on the V8
+ Raytrace benchmark, depending on whether it is run alone or with the
+ other V8 benchmarks.
+
+ * kjs/Arguments.cpp:
+ (JSC::ArgumentsData::ArgumentsData):
+ (JSC::Arguments::Arguments):
+ (JSC::Arguments::mark):
+ (JSC::Arguments::getOwnPropertySlot):
+ (JSC::Arguments::put):
+ (JSC::Arguments::deleteProperty):
+
+2008-09-23 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin.
+
+ - speed up instanceof some more
+ https://bugs.webkit.org/show_bug.cgi?id=20818
+
+ ~2% speedup on EarleyBoyer
+
+ The idea here is to record in the StructureID whether the class
+ needs a special hasInstance or if it can use the normal logic from
+ JSObject.
+
+ Based on this I inlined the real work directly into
+ cti_op_instanceof and put the fastest checks up front and the
+ error handling at the end (so it should be fairly straightforward
+ to split off the beginning to be inlined if desired).
+
+ I only did this for CTI, not the bytecode interpreter.
+
+ * API/JSCallbackObject.h:
+ (JSC::JSCallbackObject::createStructureID):
+ * ChangeLog:
+ * VM/Machine.cpp:
+ (JSC::Machine::cti_op_instanceof):
+ * kjs/JSImmediate.h:
+ (JSC::JSImmediate::isAnyImmediate):
+ * kjs/TypeInfo.h:
+ (JSC::TypeInfo::overridesHasInstance):
+ (JSC::TypeInfo::flags):
+
+2008-09-22 Darin Adler <darin@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ - https://bugs.webkit.org/show_bug.cgi?id=21019
+ make FunctionBodyNode::ref/deref fast
+
+ Speeds up v8-raytrace by 7.2%.
+
+ * kjs/nodes.cpp:
+ (JSC::FunctionBodyNode::FunctionBodyNode): Initialize m_refCount to 0.
+ * kjs/nodes.h:
+ (JSC::FunctionBodyNode::ref): Call base class ref once, and thereafter use
+ m_refCount.
+ (JSC::FunctionBodyNode::deref): Ditto, but the deref side.
+
+2008-09-22 Darin Adler <darin@apple.com>
+
+ Pointed out by Sam Weinig.
+
+ * kjs/Arguments.cpp:
+ (JSC::Arguments::fillArgList): Fix bad copy and paste. Oops!
+
+2008-09-22 Darin Adler <darin@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ - https://bugs.webkit.org/show_bug.cgi?id=20983
+ ArgumentsData should have some room to allocate some extra arguments inline
+
+ Speeds up v8-raytrace by 5%.
+
+ * kjs/Arguments.cpp:
+ (JSC::ArgumentsData::ArgumentsData): Use a fixed buffer if there are 4 or fewer
+ extra arguments.
+ (JSC::Arguments::Arguments): Use a fixed buffer if there are 4 or fewer
+ extra arguments.
+ (JSC::Arguments::~Arguments): Delete the buffer if necessary.
+ (JSC::Arguments::mark): Update since extraArguments are now Register.
+ (JSC::Arguments::fillArgList): Added special case for the only case that's
+ actually used in the practice, when there are no parameters. There are some
+ other special cases in there too, but that's the only one that matters.
+ (JSC::Arguments::getOwnPropertySlot): Updated to use setValueSlot since there's
+ no operation to get you at the JSValue* inside a Register as a "slot".
+
+2008-09-22 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Maciej Stachowiak.
+
+ Patch for https://bugs.webkit.org/show_bug.cgi?id=21014
+ Speed up for..in by using StructureID to avoid calls to hasProperty
+
+ Speeds up fasta by 8%.
+
+ * VM/JSPropertyNameIterator.cpp:
+ (JSC::JSPropertyNameIterator::invalidate):
+ * VM/JSPropertyNameIterator.h:
+ (JSC::JSPropertyNameIterator::next):
+ * kjs/PropertyNameArray.h:
+ (JSC::PropertyNameArrayData::begin):
+ (JSC::PropertyNameArrayData::end):
+ (JSC::PropertyNameArrayData::setCachedStructureID):
+ (JSC::PropertyNameArrayData::cachedStructureID):
+ * kjs/StructureID.cpp:
+ (JSC::StructureID::getEnumerablePropertyNames):
+ (JSC::structureIDChainsAreEqual):
+ * kjs/StructureID.h:
+
+2008-09-22 Kelvin Sherlock <ksherlock@gmail.com>
+
+ Updated and tweaked by Sam Weinig.
+
+ Reviewed by Geoffrey Garen.
+
+ Bug 20020: Proposed enhancement to JavaScriptCore API
+ <https://bugs.webkit.org/show_bug.cgi?id=20020>
+
+ Add JSObjectMakeArray, JSObjectMakeDate, JSObjectMakeError, and JSObjectMakeRegExp
+ functions to create JavaScript Array, Date, Error, and RegExp objects, respectively.
+
+ * API/JSObjectRef.cpp: The functions
+ * API/JSObjectRef.h: Function prototype and documentation
+ * JavaScriptCore.exp: Added functions to exported function list
+ * API/tests/testapi.c: Added basic functionality tests.
+
+ * kjs/DateConstructor.cpp:
+ Replaced static JSObject* constructDate(ExecState* exec, JSObject*, const ArgList& args)
+ with JSObject* constructDate(ExecState* exec, const ArgList& args).
+ Added static JSObject* constructWithDateConstructor(ExecState* exec, JSObject*, const ArgList& args) function
+
+ * kjs/DateConstructor.h:
+ added prototype for JSObject* constructDate(ExecState* exec, const ArgList& args)
+
+ * kjs/ErrorConstructor.cpp:
+ removed static qualifier from ErrorInstance* constructError(ExecState* exec, const ArgList& args)
+
+ * kjs/ErrorConstructor.h:
+ added prototype for ErrorInstance* constructError(ExecState* exec, const ArgList& args)
+
+ * kjs/RegExpConstructor.cpp:
+ removed static qualifier from JSObject* constructRegExp(ExecState* exec, const ArgList& args)
+
+ * kjs/RegExpConstructor.h:
+ added prototype for JSObject* constructRegExp(ExecState* exec, const ArgList& args)
+
+2008-09-22 Matt Lilek <webkit@mattlilek.com>
+
+ Not reviewed, Windows build fix.
+
+ * kjs/Arguments.cpp:
+ * kjs/FunctionPrototype.cpp:
+
+2008-09-22 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ Patch for https://bugs.webkit.org/show_bug.cgi?id=20982
+ Speed up the apply method of functions by special-casing array and 'arguments' objects
+
+ 1% speedup on v8-raytrace.
+
+ Test: fast/js/function-apply.html
+
+ * kjs/Arguments.cpp:
+ (JSC::Arguments::fillArgList):
+ * kjs/Arguments.h:
+ * kjs/FunctionPrototype.cpp:
+ (JSC::functionProtoFuncApply):
+ * kjs/JSArray.cpp:
+ (JSC::JSArray::fillArgList):
+ * kjs/JSArray.h:
+
+2008-09-22 Darin Adler <darin@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ - https://bugs.webkit.org/show_bug.cgi?id=20993
+ Array.push/pop need optimized cases for JSArray
+
+ 3% or so speedup on DeltaBlue benchmark.
+
+ * kjs/ArrayPrototype.cpp:
+ (JSC::arrayProtoFuncPop): Call JSArray::pop when appropriate.
+ (JSC::arrayProtoFuncPush): Call JSArray::push when appropriate.
+
+ * kjs/JSArray.cpp:
+ (JSC::JSArray::putSlowCase): Set m_fastAccessCutoff when appropriate, getting
+ us into the fast code path.
+ (JSC::JSArray::pop): Added.
+ (JSC::JSArray::push): Added.
+ * kjs/JSArray.h: Added push and pop.
+
+ * kjs/operations.cpp:
+ (JSC::throwOutOfMemoryError): Don't inline this. Helps us avoid PIC branches.
+
+2008-09-22 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ - speed up instanceof operator by replacing implementsHasInstance method with a TypeInfo flag
+
+ Partial work towards <https://bugs.webkit.org/show_bug.cgi?id=20818>
+
+ 2.2% speedup on EarleyBoyer benchmark.
+
+ * API/JSCallbackConstructor.cpp:
+ * API/JSCallbackConstructor.h:
+ (JSC::JSCallbackConstructor::createStructureID):
+ * API/JSCallbackFunction.cpp:
+ * API/JSCallbackFunction.h:
+ (JSC::JSCallbackFunction::createStructureID):
+ * API/JSCallbackObject.h:
+ (JSC::JSCallbackObject::createStructureID):
+ * API/JSCallbackObjectFunctions.h:
+ (JSC::::hasInstance):
+ * API/JSValueRef.cpp:
+ (JSValueIsInstanceOfConstructor):
+ * JavaScriptCore.exp:
+ * VM/Machine.cpp:
+ (JSC::Machine::privateExecute):
+ (JSC::Machine::cti_op_instanceof):
+ * kjs/InternalFunction.cpp:
+ * kjs/InternalFunction.h:
+ (JSC::InternalFunction::createStructureID):
+ * kjs/JSObject.cpp:
+ * kjs/JSObject.h:
+ * kjs/TypeInfo.h:
+ (JSC::TypeInfo::implementsHasInstance):
+
+2008-09-22 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Dave Hyatt.
+
+ Based on initial work by Darin Adler.
+
+ - replace masqueradesAsUndefined virtual method with a flag in TypeInfo
+ - use this to JIT inline code for eq_null and neq_null
+ https://bugs.webkit.org/show_bug.cgi?id=20823
+
+ 0.5% speedup on SunSpider
+ ~4% speedup on Richards benchmark
+
+ * VM/CTI.cpp:
+ (JSC::CTI::privateCompileMainPass):
+ * VM/Machine.cpp:
+ (JSC::jsTypeStringForValue):
+ (JSC::jsIsObjectType):
+ (JSC::Machine::privateExecute):
+ (JSC::Machine::cti_op_is_undefined):
+ * VM/Machine.h:
+ * kjs/JSCell.h:
+ * kjs/JSValue.h:
+ * kjs/StringObjectThatMasqueradesAsUndefined.h:
+ (JSC::StringObjectThatMasqueradesAsUndefined::create):
+ (JSC::StringObjectThatMasqueradesAsUndefined::createStructureID):
+ * kjs/StructureID.h:
+ (JSC::StructureID::mutableTypeInfo):
+ * kjs/TypeInfo.h:
+ (JSC::TypeInfo::TypeInfo):
+ (JSC::TypeInfo::masqueradesAsUndefined):
+ * kjs/operations.cpp:
+ (JSC::equal):
+ * masm/X86Assembler.h:
+ (JSC::X86Assembler::):
+ (JSC::X86Assembler::setne_r):
+ (JSC::X86Assembler::setnz_r):
+ (JSC::X86Assembler::testl_i32m):
+
+2008-09-22 Tor Arne Vestbø <tavestbo@trolltech.com>
+
+ Reviewed by Simon.
+
+ Initialize QCoreApplication in kjs binary/Shell.cpp
+
+ This allows us to use QCoreApplication::instance() to
+ get the main thread in ThreadingQt.cpp
+
+ * kjs/Shell.cpp:
+ (main):
+ * wtf/ThreadingQt.cpp:
+ (WTF::initializeThreading):
+
+2008-09-21 Darin Adler <darin@apple.com>
+
+ - blind attempt to fix non-all-in-one builds
+
+ * kjs/JSGlobalObject.cpp: Added includes of Arguments.h and RegExpObject.h.
+
+2008-09-21 Darin Adler <darin@apple.com>
+
+ - fix debug build
+
+ * kjs/StructureID.cpp:
+ (JSC::StructureID::addPropertyTransition): Use typeInfo().type() instead of m_type.
+ (JSC::StructureID::createCachedPrototypeChain): Ditto.
+
+2008-09-21 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin Adler.
+
+ - introduce a TypeInfo class, for holding per-type (in the C++ class sense) date in StructureID
+ https://bugs.webkit.org/show_bug.cgi?id=20981
+
+ * JavaScriptCore.exp:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * VM/CTI.cpp:
+ (JSC::CTI::privateCompileMainPass):
+ (JSC::CTI::privateCompilePutByIdTransition):
+ * VM/Machine.cpp:
+ (JSC::jsIsObjectType):
+ (JSC::Machine::Machine):
+ * kjs/AllInOneFile.cpp:
+ * kjs/JSCell.h:
+ (JSC::JSCell::isObject):
+ (JSC::JSCell::isString):
+ * kjs/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData):
+ * kjs/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::reset):
+ * kjs/JSGlobalObject.h:
+ (JSC::StructureID::prototypeForLookup):
+ * kjs/JSNumberCell.h:
+ (JSC::JSNumberCell::createStructureID):
+ * kjs/JSObject.cpp:
+ (JSC::JSObject::createInheritorID):
+ * kjs/JSObject.h:
+ (JSC::JSObject::createStructureID):
+ * kjs/JSString.h:
+ (JSC::JSString::createStructureID):
+ * kjs/NativeErrorConstructor.cpp:
+ (JSC::NativeErrorConstructor::NativeErrorConstructor):
+ * kjs/RegExpConstructor.cpp:
+ * kjs/RegExpMatchesArray.h: Added.
+ (JSC::RegExpMatchesArray::getOwnPropertySlot):
+ (JSC::RegExpMatchesArray::put):
+ (JSC::RegExpMatchesArray::deleteProperty):
+ (JSC::RegExpMatchesArray::getPropertyNames):
+ * kjs/StructureID.cpp:
+ (JSC::StructureID::StructureID):
+ (JSC::StructureID::addPropertyTransition):
+ (JSC::StructureID::toDictionaryTransition):
+ (JSC::StructureID::changePrototypeTransition):
+ (JSC::StructureID::getterSetterTransition):
+ * kjs/StructureID.h:
+ (JSC::StructureID::create):
+ (JSC::StructureID::typeInfo):
+ * kjs/TypeInfo.h: Added.
+ (JSC::TypeInfo::TypeInfo):
+ (JSC::TypeInfo::type):
+
+2008-09-21 Darin Adler <darin@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ - fix crash logging into Gmail due to recent Arguments change
+
+ * kjs/Arguments.cpp:
+ (JSC::Arguments::Arguments): Fix window where mark() function could
+ see d->extraArguments with uninitialized contents.
+ (JSC::Arguments::mark): Check d->extraArguments for 0 to handle two
+ cases: 1) Inside the constructor before it's initialized.
+ 2) numArguments <= numParameters.
+
+2008-09-21 Darin Adler <darin@apple.com>
+
+ - fix loose end from the "duplicate constant values" patch
+
+ * VM/CodeGenerator.cpp:
+ (JSC::CodeGenerator::emitLoad): Add a special case for values the
+ hash table can't handle.
+
+2008-09-21 Mark Rowe <mrowe@apple.com>
+
+ Fix the non-AllInOneFile build.
+
+ * kjs/Arguments.cpp: Add missing #include.
+
+2008-09-21 Darin Adler <darin@apple.com>
+
+ Reviewed by Cameron Zwarich and Mark Rowe.
+
+ - fix test failure caused by my recent IndexToNameMap patch
+
+ * kjs/Arguments.cpp:
+ (JSC::Arguments::deleteProperty): Added the accidentally-omitted
+ check of the boolean result from toArrayIndex.
+
+2008-09-21 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ - https://bugs.webkit.org/show_bug.cgi?id=20975
+ inline immediate-number case of ==
+
+ * VM/CTI.h: Renamed emitJumpSlowCaseIfNotImm to
+ emitJumpSlowCaseIfNotImmNum, since the old name was incorrect.
+
+ * VM/CTI.cpp: Updated for new name.
+ (JSC::CTI::privateCompileMainPass): Added op_eq.
+ (JSC::CTI::privateCompileSlowCases): Added op_eq.
+
+ * VM/Machine.cpp:
+ (JSC::Machine::cti_op_eq): Removed fast case, since it's now
+ compiled.
+
+2008-09-21 Peter Gal <galpter@inf.u-szeged.hu>
+
+ Reviewed by Tim Hatcher and Eric Seidel.
+
+ Fix the QT/Linux JavaScriptCore segmentation fault.
+ https://bugs.webkit.org/show_bug.cgi?id=20914
+
+ * wtf/ThreadingQt.cpp:
+ (WTF::initializeThreading): Use currentThread() if
+ platform is not a MAC (like in pre 36541 revisions)
+
+2008-09-21 Darin Adler <darin@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ * kjs/debugger.h: Removed some unneeded includes and declarations.
+
+2008-09-21 Darin Adler <darin@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ - https://bugs.webkit.org/show_bug.cgi?id=20972
+ speed up Arguments further by eliminating the IndexToNameMap
+
+ No change on SunSpider. 1.29x as fast on V8 Raytrace.
+
+ * kjs/Arguments.cpp: Moved ArgumentsData in here. Eliminated the
+ indexToNameMap and hadDeletes data members. Changed extraArguments into
+ an OwnArrayPtr and added deletedArguments, another OwnArrayPtr.
+ Replaced numExtraArguments with numParameters, since that's what's
+ used more directly in hot code paths.
+ (JSC::Arguments::Arguments): Pass in argument count instead of ArgList.
+ Initialize ArgumentsData the new way.
+ (JSC::Arguments::mark): Updated.
+ (JSC::Arguments::getOwnPropertySlot): Overload for the integer form so
+ we don't have to convert integers to identifiers just to get an argument.
+ Integrated the deleted case with the fast case.
+ (JSC::Arguments::put): Ditto.
+ (JSC::Arguments::deleteProperty): Ditto.
+
+ * kjs/Arguments.h: Minimized includes. Made everything private. Added
+ overloads for the integral property name case. Eliminated mappedIndexSetter.
+ Moved ArgumentsData into the .cpp file.
+
+ * kjs/IndexToNameMap.cpp: Emptied out and prepared for deletion.
+ * kjs/IndexToNameMap.h: Ditto.
+
+ * kjs/JSActivation.cpp:
+ (JSC::JSActivation::createArgumentsObject): Elminated ArgList.
+
+ * GNUmakefile.am:
+ * JavaScriptCore.pri:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * JavaScriptCoreSources.bkl:
+ * kjs/AllInOneFile.cpp:
+ Removed IndexToNameMap.
+
+2008-09-21 Darin Adler <darin@apple.com>
+
+ * VM/CodeGenerator.cpp:
+ (JSC::CodeGenerator::emitLoad): One more tweak: Wrote this in a slightly
+ clearer style.
+
+2008-09-21 Judit Jasz <jasy@inf.u-szeged.hu>
+
+ Reviewed and tweaked by Darin Adler.
+
+ - https://bugs.webkit.org/show_bug.cgi?id=20645
+ Elminate duplicate constant values in CodeBlocks.
+
+ Seems to be a wash on SunSpider.
+
+ * VM/CodeGenerator.cpp:
+ (JSC::CodeGenerator::emitLoad): Use m_numberMap and m_stringMap to guarantee
+ we emit the same JSValue* for identical numbers and strings.
+ * VM/CodeGenerator.h: Added overload of emitLoad for const Identifier&.
+ Add NumberMap and IdentifierStringMap types and m_numberMap and m_stringMap.
+ * kjs/nodes.cpp:
+ (JSC::StringNode::emitCode): Call the new emitLoad and let it do the
+ JSString creation.
+
+2008-09-21 Paul Pedriana <webkit@pedriana.com>
+
+ Reviewed and tweaked by Darin Adler.
+
+ - https://bugs.webkit.org/show_bug.cgi?id=16925
+ Fixed lack of Vector buffer alignment for both GCC and MSVC.
+ Since there's no portable way to do this, for now we don't support
+ other compilers.
+
+ * wtf/Vector.h: Added WTF_ALIGH_ON, WTF_ALIGNED, AlignedBufferChar, and AlignedBuffer.
+ Use AlignedBuffer insteadof an array of char in VectorBuffer.
+
+2008-09-21 Gabor Loki <loki@inf.u-szeged.hu>
+
+ Reviewed by Darin Adler.
+
+ - https://bugs.webkit.org/show_bug.cgi?id=19408
+ Add lightweight constant folding to the parser for *, /, + (only for numbers), <<, >>, ~ operators.
+
+ 1.008x as fast on SunSpider.
+
+ * kjs/grammar.y:
+ (makeNegateNode): Fold if expression is a number > 0.
+ (makeBitwiseNotNode): Fold if expression is a number.
+ (makeMultNode): Fold if expressions are both numbers.
+ (makeDivNode): Fold if expressions are both numbers.
+ (makeAddNode): Fold if expressions are both numbers.
+ (makeLeftShiftNode): Fold if expressions are both numbers.
+ (makeRightShiftNode): Fold if expressions are both numbers.
+
+2008-09-21 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver.
+
+ - speed up === operator by generating inline machine code for the fast paths
+ https://bugs.webkit.org/show_bug.cgi?id=20820
+
+ * VM/CTI.cpp:
+ (JSC::CTI::emitJumpSlowCaseIfNotImmediateNumber):
+ (JSC::CTI::emitJumpSlowCaseIfNotImmediateNumbers):
+ (JSC::CTI::emitJumpSlowCaseIfNotImmediates):
+ (JSC::CTI::emitTagAsBoolImmediate):
+ (JSC::CTI::privateCompileMainPass):
+ (JSC::CTI::privateCompileSlowCases):
+ * VM/CTI.h:
+ * VM/Machine.cpp:
+ (JSC::Machine::cti_op_stricteq):
+ * masm/X86Assembler.h:
+ (JSC::X86Assembler::):
+ (JSC::X86Assembler::sete_r):
+ (JSC::X86Assembler::setz_r):
+ (JSC::X86Assembler::movzbl_rr):
+ (JSC::X86Assembler::emitUnlinkedJnz):
+
+2008-09-21 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Maciej Stachowiak.
+
+ Free memory allocated for extra arguments in the destructor of the
+ Arguments object.
+
+ * kjs/Arguments.cpp:
+ (JSC::Arguments::~Arguments):
+ * kjs/Arguments.h:
+
+2008-09-21 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Maciej Stachowiak.
+
+ Bug 20815: 'arguments' object creation is non-optimal
+ <https://bugs.webkit.org/show_bug.cgi?id=20815>
+
+ Fix our inefficient way of creating the arguments object by only
+ creating named properties for each of the arguments after a use of the
+ 'delete' statement. This patch also speeds up access to the 'arguments'
+ object slightly, but it still does not use the array fast path for
+ indexed access that exists for many opcodes.
+
+ This is about a 20% improvement on the V8 Raytrace benchmark, and a 1.5%
+ improvement on the Earley-Boyer benchmark, which gives a 4% improvement
+ overall.
+
+ * kjs/Arguments.cpp:
+ (JSC::Arguments::Arguments):
+ (JSC::Arguments::mark):
+ (JSC::Arguments::getOwnPropertySlot):
+ (JSC::Arguments::put):
+ (JSC::Arguments::deleteProperty):
+ * kjs/Arguments.h:
+ (JSC::Arguments::ArgumentsData::ArgumentsData):
+ * kjs/IndexToNameMap.h:
+ (JSC::IndexToNameMap::size):
+ * kjs/JSActivation.cpp:
+ (JSC::JSActivation::createArgumentsObject):
+ * kjs/JSActivation.h:
+ (JSC::JSActivation::uncheckedSymbolTableGet):
+ (JSC::JSActivation::uncheckedSymbolTableGetValue):
+ (JSC::JSActivation::uncheckedSymbolTablePut):
+ * kjs/JSFunction.h:
+ (JSC::JSFunction::numParameters):
+
+2008-09-20 Darin Adler <darin@apple.com>
+
+ Reviewed by Mark Rowe.
+
+ - fix crash seen on buildbot
+
+ * kjs/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::mark): Add back mark of arrayPrototype,
+ deleted by accident in my recent check-in.
+
+2008-09-20 Maciej Stachowiak <mjs@apple.com>
+
+ Not reviewed, build fix.
+
+ - speculative fix for non-AllInOne builds
+
+ * kjs/operations.h:
+
+2008-09-20 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin Adler.
+
+ - assorted optimizations to === and !== operators
+ (work towards <https://bugs.webkit.org/show_bug.cgi?id=20820>)
+
+ 2.5% speedup on earley-boyer test
+
+ * VM/Machine.cpp:
+ (JSC::Machine::cti_op_stricteq): Use inline version of
+ strictEqualSlowCase; remove unneeded exception check.
+ (JSC::Machine::cti_op_nstricteq): ditto
+ * kjs/operations.cpp:
+ (JSC::strictEqual): Use strictEqualSlowCaseInline
+ (JSC::strictEqualSlowCase): ditto
+ * kjs/operations.h:
+ (JSC::strictEqualSlowCaseInline): Version of strictEqualSlowCase that can be inlined,
+ since the extra function call indirection is a lose for CTI.
+
+2008-09-20 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ - finish https://bugs.webkit.org/show_bug.cgi?id=20858
+ make each distinct C++ class get a distinct JSC::Structure
+
+ This also includes some optimizations that make the change an overall
+ small speedup. Without those it was a bit of a slowdown.
+
+ * API/JSCallbackConstructor.cpp:
+ (JSC::JSCallbackConstructor::JSCallbackConstructor): Take a structure.
+ * API/JSCallbackConstructor.h: Ditto.
+ * API/JSCallbackFunction.cpp:
+ (JSC::JSCallbackFunction::JSCallbackFunction): Pass a structure.
+ * API/JSCallbackObject.h: Take a structure.
+ * API/JSCallbackObjectFunctions.h:
+ (JSC::JSCallbackObject::JSCallbackObject): Ditto.
+
+ * API/JSClassRef.cpp:
+ (OpaqueJSClass::prototype): Pass in a structure. Call setPrototype
+ if there's a custom prototype involved.
+ * API/JSObjectRef.cpp:
+ (JSObjectMake): Ditto.
+ (JSObjectMakeConstructor): Pass in a structure.
+
+ * JavaScriptCore.exp: Updated.
+
+ * VM/Machine.cpp:
+ (JSC::jsLess): Added a special case for when both arguments are strings.
+ This avoids converting both strings to with UString::toDouble.
+ (JSC::jsLessEq): Ditto.
+ (JSC::Machine::privateExecute): Pass in a structure.
+ (JSC::Machine::cti_op_construct_JSConstruct): Ditto.
+ (JSC::Machine::cti_op_new_regexp): Ditto.
+ (JSC::Machine::cti_op_is_string): Ditto.
+ * VM/Machine.h: Made isJSString public so it can be used in the CTI.
+
+ * kjs/Arguments.cpp:
+ (JSC::Arguments::Arguments): Pass in a structure.
+
+ * kjs/JSCell.h: Mark constructor explicit.
+
+ * kjs/JSGlobalObject.cpp:
+ (JSC::markIfNeeded): Added an overload for marking structures.
+ (JSC::JSGlobalObject::reset): Eliminate code to set data members to
+ zero. We now do that in the constructor, and we no longer use this
+ anywhere except in the constructor. Added code to create structures.
+ Pass structures rather than prototypes when creating objects.
+ (JSC::JSGlobalObject::mark): Mark the structures.
+
+ * kjs/JSGlobalObject.h: Removed unneeded class declarations.
+ Added initializers for raw pointers in JSGlobalObjectData so
+ everything starts with a 0. Added structure data and accessor
+ functions.
+
+ * kjs/JSImmediate.cpp:
+ (JSC::JSImmediate::nonInlineNaN): Added.
+ * kjs/JSImmediate.h:
+ (JSC::JSImmediate::toDouble): Rewrote to avoid PIC branches.
+
+ * kjs/JSNumberCell.cpp:
+ (JSC::jsNumberCell): Made non-inline to avoid PIC branches
+ in functions that call this one.
+ (JSC::jsNaN): Ditto.
+ * kjs/JSNumberCell.h: Ditto.
+
+ * kjs/JSObject.h: Removed constructor that takes a prototype.
+ All callers now pass structures.
+
+ * kjs/ArrayConstructor.cpp:
+ (JSC::ArrayConstructor::ArrayConstructor):
+ (JSC::constructArrayWithSizeQuirk):
+ * kjs/ArrayConstructor.h:
+ * kjs/ArrayPrototype.cpp:
+ (JSC::ArrayPrototype::ArrayPrototype):
+ * kjs/ArrayPrototype.h:
+ * kjs/BooleanConstructor.cpp:
+ (JSC::BooleanConstructor::BooleanConstructor):
+ (JSC::constructBoolean):
+ (JSC::constructBooleanFromImmediateBoolean):
+ * kjs/BooleanConstructor.h:
+ * kjs/BooleanObject.cpp:
+ (JSC::BooleanObject::BooleanObject):
+ * kjs/BooleanObject.h:
+ * kjs/BooleanPrototype.cpp:
+ (JSC::BooleanPrototype::BooleanPrototype):
+ * kjs/BooleanPrototype.h:
+ * kjs/DateConstructor.cpp:
+ (JSC::DateConstructor::DateConstructor):
+ (JSC::constructDate):
+ * kjs/DateConstructor.h:
+ * kjs/DateInstance.cpp:
+ (JSC::DateInstance::DateInstance):
+ * kjs/DateInstance.h:
+ * kjs/DatePrototype.cpp:
+ (JSC::DatePrototype::DatePrototype):
+ * kjs/DatePrototype.h:
+ * kjs/ErrorConstructor.cpp:
+ (JSC::ErrorConstructor::ErrorConstructor):
+ (JSC::constructError):
+ * kjs/ErrorConstructor.h:
+ * kjs/ErrorInstance.cpp:
+ (JSC::ErrorInstance::ErrorInstance):
+ * kjs/ErrorInstance.h:
+ * kjs/ErrorPrototype.cpp:
+ (JSC::ErrorPrototype::ErrorPrototype):
+ * kjs/ErrorPrototype.h:
+ * kjs/FunctionConstructor.cpp:
+ (JSC::FunctionConstructor::FunctionConstructor):
+ * kjs/FunctionConstructor.h:
+ * kjs/FunctionPrototype.cpp:
+ (JSC::FunctionPrototype::FunctionPrototype):
+ (JSC::FunctionPrototype::addFunctionProperties):
+ * kjs/FunctionPrototype.h:
+ * kjs/GlobalEvalFunction.cpp:
+ (JSC::GlobalEvalFunction::GlobalEvalFunction):
+ * kjs/GlobalEvalFunction.h:
+ * kjs/InternalFunction.cpp:
+ (JSC::InternalFunction::InternalFunction):
+ * kjs/InternalFunction.h:
+ (JSC::InternalFunction::InternalFunction):
+ * kjs/JSArray.cpp:
+ (JSC::JSArray::JSArray):
+ (JSC::constructEmptyArray):
+ (JSC::constructArray):
+ * kjs/JSArray.h:
+ * kjs/JSFunction.cpp:
+ (JSC::JSFunction::JSFunction):
+ (JSC::JSFunction::construct):
+ * kjs/JSObject.cpp:
+ (JSC::constructEmptyObject):
+ * kjs/JSString.cpp:
+ (JSC::StringObject::create):
+ * kjs/JSWrapperObject.h:
+ * kjs/MathObject.cpp:
+ (JSC::MathObject::MathObject):
+ * kjs/MathObject.h:
+ * kjs/NativeErrorConstructor.cpp:
+ (JSC::NativeErrorConstructor::NativeErrorConstructor):
+ (JSC::NativeErrorConstructor::construct):
+ * kjs/NativeErrorConstructor.h:
+ * kjs/NativeErrorPrototype.cpp:
+ (JSC::NativeErrorPrototype::NativeErrorPrototype):
+ * kjs/NativeErrorPrototype.h:
+ * kjs/NumberConstructor.cpp:
+ (JSC::NumberConstructor::NumberConstructor):
+ (JSC::constructWithNumberConstructor):
+ * kjs/NumberConstructor.h:
+ * kjs/NumberObject.cpp:
+ (JSC::NumberObject::NumberObject):
+ (JSC::constructNumber):
+ (JSC::constructNumberFromImmediateNumber):
+ * kjs/NumberObject.h:
+ * kjs/NumberPrototype.cpp:
+ (JSC::NumberPrototype::NumberPrototype):
+ * kjs/NumberPrototype.h:
+ * kjs/ObjectConstructor.cpp:
+ (JSC::ObjectConstructor::ObjectConstructor):
+ (JSC::constructObject):
+ * kjs/ObjectConstructor.h:
+ * kjs/ObjectPrototype.cpp:
+ (JSC::ObjectPrototype::ObjectPrototype):
+ * kjs/ObjectPrototype.h:
+ * kjs/PrototypeFunction.cpp:
+ (JSC::PrototypeFunction::PrototypeFunction):
+ * kjs/PrototypeFunction.h:
+ * kjs/RegExpConstructor.cpp:
+ (JSC::RegExpConstructor::RegExpConstructor):
+ (JSC::RegExpMatchesArray::RegExpMatchesArray):
+ (JSC::constructRegExp):
+ * kjs/RegExpConstructor.h:
+ * kjs/RegExpObject.cpp:
+ (JSC::RegExpObject::RegExpObject):
+ * kjs/RegExpObject.h:
+ * kjs/RegExpPrototype.cpp:
+ (JSC::RegExpPrototype::RegExpPrototype):
+ * kjs/RegExpPrototype.h:
+ * kjs/Shell.cpp:
+ (GlobalObject::GlobalObject):
+ * kjs/StringConstructor.cpp:
+ (JSC::StringConstructor::StringConstructor):
+ (JSC::constructWithStringConstructor):
+ * kjs/StringConstructor.h:
+ * kjs/StringObject.cpp:
+ (JSC::StringObject::StringObject):
+ * kjs/StringObject.h:
+ * kjs/StringObjectThatMasqueradesAsUndefined.h:
+ (JSC::StringObjectThatMasqueradesAsUndefined::StringObjectThatMasqueradesAsUndefined):
+ * kjs/StringPrototype.cpp:
+ (JSC::StringPrototype::StringPrototype):
+ * kjs/StringPrototype.h:
+ Take and pass structures.
+
+2008-09-19 Alp Toker <alp@nuanti.com>
+
+ Build fix for the 'gold' linker and recent binutils. New behaviour
+ requires that we link to used libraries explicitly.
+
+ * GNUmakefile.am:
+
+2008-09-19 Sam Weinig <sam@webkit.org>
+
+ Roll r36694 back in. It did not cause the crash.
+
+ * JavaScriptCore.exp:
+ * VM/JSPropertyNameIterator.cpp:
+ (JSC::JSPropertyNameIterator::~JSPropertyNameIterator):
+ (JSC::JSPropertyNameIterator::invalidate):
+ * VM/JSPropertyNameIterator.h:
+ (JSC::JSPropertyNameIterator::JSPropertyNameIterator):
+ (JSC::JSPropertyNameIterator::create):
+ * kjs/JSObject.cpp:
+ (JSC::JSObject::getPropertyNames):
+ * kjs/PropertyMap.cpp:
+ (JSC::PropertyMap::getEnumerablePropertyNames):
+ * kjs/PropertyMap.h:
+ * kjs/PropertyNameArray.cpp:
+ (JSC::PropertyNameArray::add):
+ * kjs/PropertyNameArray.h:
+ (JSC::PropertyNameArrayData::create):
+ (JSC::PropertyNameArrayData::propertyNameVector):
+ (JSC::PropertyNameArrayData::setCachedPrototypeChain):
+ (JSC::PropertyNameArrayData::cachedPrototypeChain):
+ (JSC::PropertyNameArrayData::begin):
+ (JSC::PropertyNameArrayData::end):
+ (JSC::PropertyNameArrayData::PropertyNameArrayData):
+ (JSC::PropertyNameArray::PropertyNameArray):
+ (JSC::PropertyNameArray::addKnownUnique):
+ (JSC::PropertyNameArray::size):
+ (JSC::PropertyNameArray::operator[]):
+ (JSC::PropertyNameArray::begin):
+ (JSC::PropertyNameArray::end):
+ (JSC::PropertyNameArray::setData):
+ (JSC::PropertyNameArray::data):
+ (JSC::PropertyNameArray::releaseData):
+ * kjs/StructureID.cpp:
+ (JSC::structureIDChainsAreEqual):
+ (JSC::StructureID::getEnumerablePropertyNames):
+ (JSC::StructureID::clearEnumerationCache):
+ (JSC::StructureID::createCachedPrototypeChain):
+ * kjs/StructureID.h:
+
+2008-09-19 Sam Weinig <sam@webkit.org>
+
+ Roll out r36694.
+
+ * JavaScriptCore.exp:
+ * VM/JSPropertyNameIterator.cpp:
+ (JSC::JSPropertyNameIterator::~JSPropertyNameIterator):
+ (JSC::JSPropertyNameIterator::invalidate):
+ * VM/JSPropertyNameIterator.h:
+ (JSC::JSPropertyNameIterator::JSPropertyNameIterator):
+ (JSC::JSPropertyNameIterator::create):
+ * kjs/JSObject.cpp:
+ (JSC::JSObject::getPropertyNames):
+ * kjs/PropertyMap.cpp:
+ (JSC::PropertyMap::getEnumerablePropertyNames):
+ * kjs/PropertyMap.h:
+ * kjs/PropertyNameArray.cpp:
+ (JSC::PropertyNameArray::add):
+ * kjs/PropertyNameArray.h:
+ (JSC::PropertyNameArray::PropertyNameArray):
+ (JSC::PropertyNameArray::addKnownUnique):
+ (JSC::PropertyNameArray::begin):
+ (JSC::PropertyNameArray::end):
+ (JSC::PropertyNameArray::size):
+ (JSC::PropertyNameArray::operator[]):
+ (JSC::PropertyNameArray::releaseIdentifiers):
+ * kjs/StructureID.cpp:
+ (JSC::StructureID::getEnumerablePropertyNames):
+ * kjs/StructureID.h:
+ (JSC::StructureID::clearEnumerationCache):
+
+2008-09-19 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Improve peformance of local variable initialisation.
+
+ Pull local and constant initialisation out of slideRegisterWindowForCall
+ and into its own opcode. This allows the JIT to generate the initialisation
+ code for a function directly into the instruction stream and so avoids a few
+ branches on function entry.
+
+ Results a 1% progression in SunSpider, particularly in a number of the bitop
+ tests where the called functions are very fast.
+
+ * VM/CTI.cpp:
+ (JSC::CTI::emitInitialiseRegister):
+ (JSC::CTI::privateCompileMainPass):
+ * VM/CTI.h:
+ * VM/CodeBlock.cpp:
+ (JSC::CodeBlock::dump):
+ * VM/CodeGenerator.cpp:
+ (JSC::CodeGenerator::CodeGenerator):
+ * VM/Machine.cpp:
+ (JSC::slideRegisterWindowForCall):
+ (JSC::Machine::privateExecute):
+ * VM/Opcode.h:
+
+2008-09-19 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ Patch for https://bugs.webkit.org/show_bug.cgi?id=20928
+ Speed up JS property enumeration by caching entire PropertyNameArray
+
+ 1.3% speedup on Sunspider, 30% on string-fasta.
+
+ * JavaScriptCore.exp:
+ * VM/JSPropertyNameIterator.cpp:
+ (JSC::JSPropertyNameIterator::~JSPropertyNameIterator):
+ (JSC::JSPropertyNameIterator::invalidate):
+ * VM/JSPropertyNameIterator.h:
+ (JSC::JSPropertyNameIterator::JSPropertyNameIterator):
+ (JSC::JSPropertyNameIterator::create):
+ * kjs/JSObject.cpp:
+ (JSC::JSObject::getPropertyNames):
+ * kjs/PropertyMap.cpp:
+ (JSC::PropertyMap::getEnumerablePropertyNames):
+ * kjs/PropertyMap.h:
+ * kjs/PropertyNameArray.cpp:
+ (JSC::PropertyNameArray::add):
+ * kjs/PropertyNameArray.h:
+ (JSC::PropertyNameArrayData::create):
+ (JSC::PropertyNameArrayData::propertyNameVector):
+ (JSC::PropertyNameArrayData::setCachedPrototypeChain):
+ (JSC::PropertyNameArrayData::cachedPrototypeChain):
+ (JSC::PropertyNameArrayData::begin):
+ (JSC::PropertyNameArrayData::end):
+ (JSC::PropertyNameArrayData::PropertyNameArrayData):
+ (JSC::PropertyNameArray::PropertyNameArray):
+ (JSC::PropertyNameArray::addKnownUnique):
+ (JSC::PropertyNameArray::size):
+ (JSC::PropertyNameArray::operator[]):
+ (JSC::PropertyNameArray::begin):
+ (JSC::PropertyNameArray::end):
+ (JSC::PropertyNameArray::setData):
+ (JSC::PropertyNameArray::data):
+ (JSC::PropertyNameArray::releaseData):
+ * kjs/ScopeChain.cpp:
+ (JSC::ScopeChainNode::print):
+ * kjs/StructureID.cpp:
+ (JSC::structureIDChainsAreEqual):
+ (JSC::StructureID::getEnumerablePropertyNames):
+ (JSC::StructureID::clearEnumerationCache):
+ (JSC::StructureID::createCachedPrototypeChain):
+ * kjs/StructureID.h:
+
+2008-09-19 Holger Hans Peter Freyther <zecke@selfish.org>
+
+ Reviewed by Maciej Stachowiak.
+
+ Fix a mismatched new[]/delete in JSObject::allocatePropertyStorage
+
+ * kjs/JSObject.cpp:
+ (JSC::JSObject::allocatePropertyStorage): Spotted by valgrind.
+
+2008-09-19 Darin Adler <darin@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ - part 2 of https://bugs.webkit.org/show_bug.cgi?id=20858
+ make each distinct C++ class get a distinct JSC::Structure
+
+ * JavaScriptCore.exp: Exported constructEmptyObject for use in WebCore.
+
+ * kjs/JSGlobalObject.h: Changed the protected constructor to take a
+ structure instead of a prototype.
+
+ * kjs/JSVariableObject.h: Removed constructor that takes a prototype.
+
+2008-09-19 Julien Chaffraix <jchaffraix@pleyo.com>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Use the template hoisting technique on the RefCounted class. This reduces the code bloat due to
+ non-template methods' code been copied for each instance of the template.
+ The patch splits RefCounted between a base class that holds non-template methods and attributes
+ and the template RefCounted class that keeps the same functionnality.
+
+ On my Linux with gcc 4.3 for the Gtk port, this is:
+ - a ~600KB save on libwebkit.so in release.
+ - a ~1.6MB save on libwebkit.so in debug.
+
+ It is a wash on Sunspider and a small win on Dromaeo (not sure it is relevant).
+ On the whole, it should be a small win as we reduce the compiled code size and the only
+ new function call should be inlined by the compiler.
+
+ * wtf/RefCounted.h:
+ (WTF::RefCountedBase::ref): Copied from RefCounted.
+ (WTF::RefCountedBase::hasOneRef): Ditto.
+ (WTF::RefCountedBase::refCount): Ditto.
+ (WTF::RefCountedBase::RefCountedBase): Ditto.
+ (WTF::RefCountedBase::~RefCountedBase): Ditto.
+ (WTF::RefCountedBase::derefBase): Tweaked from the RefCounted version to remove
+ template section.
+ (WTF::RefCounted::RefCounted):
+ (WTF::RefCounted::deref): Small wrapper around RefCountedBase::derefBase().
+ (WTF::RefCounted::~RefCounted): Keep private destructor.
+
+2008-09-18 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ - part 1 of https://bugs.webkit.org/show_bug.cgi?id=20858
+ make each distinct C++ class get a distinct JSC::Structure
+
+ * kjs/lookup.h: Removed things here that were used only in WebCore:
+ cacheGlobalObject, JSC_DEFINE_PROTOTYPE, JSC_DEFINE_PROTOTYPE_WITH_PROTOTYPE,
+ and JSC_IMPLEMENT_PROTOTYPE.
+
+2008-09-18 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ - https://bugs.webkit.org/show_bug.cgi?id=20927
+ simplify/streamline the code to turn strings into identifiers while parsing
+
+ * kjs/grammar.y: Get rid of string from the union, and use ident for STRING as
+ well as for IDENT.
+
+ * kjs/lexer.cpp:
+ (JSC::Lexer::lex): Use makeIdentifier instead of makeUString for String.
+ * kjs/lexer.h: Remove makeUString.
+
+ * kjs/nodes.h: Changed StringNode to hold an Identifier instead of UString.
+
+ * VM/CodeGenerator.cpp:
+ (JSC::keyForCharacterSwitch): Updated since StringNode now holds an Identifier.
+ (JSC::prepareJumpTableForStringSwitch): Ditto.
+ * kjs/nodes.cpp:
+ (JSC::StringNode::emitCode): Ditto. The comment from here is now in the lexer.
+ (JSC::processClauseList): Ditto.
+ * kjs/nodes2string.cpp:
+ (JSC::StringNode::streamTo): Ditto.
+
+2008-09-18 Sam Weinig <sam@webkit.org>
+
+ Fix style.
+
+ * VM/Instruction.h:
+ (JSC::Instruction::Instruction):
+
+2008-09-18 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Bug 20911: REGRESSION(r36480?): Reproducible assertion failure below derefStructureIDs 64-bit JavaScriptCore
+ <https://bugs.webkit.org/show_bug.cgi?id=20911>
+
+ The problem was simply caused by the int constructor for Instruction
+ failing to initialise the full struct in 64bit builds.
+
+ * VM/Instruction.h:
+ (JSC::Instruction::Instruction):
+
+2008-09-18 Darin Adler <darin@apple.com>
+
+ - fix release build
+
+ * wtf/RefCountedLeakCounter.cpp: Removed stray "static".
+
+2008-09-18 Darin Adler <darin@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ * kjs/JSGlobalObject.h: Tiny style guideline tweak.
+
+2008-09-18 Darin Adler <darin@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ - fix https://bugs.webkit.org/show_bug.cgi?id=20925
+ LEAK messages appear every time I quit
+
+ * JavaScriptCore.exp: Updated, and also added an export
+ needed for future WebCore use of JSC::StructureID.
+
+ * wtf/RefCountedLeakCounter.cpp:
+ (WTF::RefCountedLeakCounter::suppressMessages): Added.
+ (WTF::RefCountedLeakCounter::cancelMessageSuppression): Added.
+ (WTF::RefCountedLeakCounter::RefCountedLeakCounter): Tweaked a bit.
+ (WTF::RefCountedLeakCounter::~RefCountedLeakCounter): Added code to
+ log the reason there was no leak checking done.
+ (WTF::RefCountedLeakCounter::increment): Tweaked a bit.
+ (WTF::RefCountedLeakCounter::decrement): Ditto.
+
+ * wtf/RefCountedLeakCounter.h: Replaced setLogLeakMessages with two
+ new functions, suppressMessages and cancelMessageSuppression. Also
+ added m_ prefixes to the data member names.
+
+2008-09-18 Holger Hans Peter Freyther <zecke@selfish.org>
+
+ Reviewed by Mark Rowe.
+
+ https://bugs.webkit.org/show_bug.cgi?id=20437
+
+ Add a proper #define to define which XML Parser implementation to use. Client
+ code can use #if USE(QXMLSTREAM) to decide if the Qt XML StreamReader
+ implementation is going to be used.
+
+ * wtf/Platform.h:
+
+2008-09-18 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Maciej Stachowiak.
+
+ Make a Unicode non-breaking space count as a whitespace character in
+ PCRE. This change was already made in WREC, and it fixes one of the
+ Mozilla JS tests. Since it is now fixed in PCRE as well, we can check
+ in a new set of expected test results.
+
+ * pcre/pcre_internal.h:
+ (isSpaceChar):
+ * tests/mozilla/expected.html:
+
+2008-09-18 Stephanie Lewis <slewis@apple.com>
+
+ Reviewed by Mark Rowe and Maciej Stachowiak.
+
+ add an option use arch to specify which architecture to run.
+
+ * tests/mozilla/jsDriver.pl:
+
+2008-09-17 Oliver Hunt <oliver@apple.com>
+
+ Correctly restore argument reference prior to SFX runtime calls.
+
+ Reviewed by Steve Falkenburg.
+
+ * VM/CTI.cpp:
+ (JSC::CTI::privateCompileSlowCases):
+ (JSC::CTI::privateCompile):
+
+2008-09-17 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Maciej Stachowiak.
+
+ Bug 20876: REGRESSION (r36417, r36427): fast/js/exception-expression-offset.html fails
+ <https://bugs.webkit.org/show_bug.cgi?id=20876>
+
+ r36417 and r36427 caused an get_by_id opcode to be emitted before the
+ instanceof and construct opcodes, in order to enable inline caching of
+ the prototype property. Unfortunately, this regressed some tests dealing
+ with exceptions thrown by 'instanceof' and the 'new' operator. We fix
+ these problems by detecting whether an "is not an object" exception is
+ thrown before op_instanceof or op_construct, and emit the proper
+ exception in those cases.
+
+ * VM/CodeGenerator.cpp:
+ (JSC::CodeGenerator::emitConstruct):
+ * VM/CodeGenerator.h:
+ * VM/ExceptionHelpers.cpp:
+ (JSC::createInvalidParamError):
+ (JSC::createNotAConstructorError):
+ (JSC::createNotAnObjectError):
+ * VM/ExceptionHelpers.h:
+ * VM/Machine.cpp:
+ (JSC::Machine::getOpcode):
+ (JSC::Machine::privateExecute):
+ * VM/Machine.h:
+ * kjs/nodes.cpp:
+ (JSC::NewExprNode::emitCode):
+ (JSC::InstanceOfNode::emitCode):
+
+2008-09-17 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ JIT generation cti_op_construct_verify.
+
+ Quarter to half percent progression on v8-tests.
+ Roughly not change on SunSpider (possible minor progression).
+
+ * VM/CTI.cpp:
+ (JSC::CTI::privateCompileMainPass):
+ * VM/Machine.cpp:
+ * VM/Machine.h:
+
+2008-09-15 Steve Falkenburg <sfalken@apple.com>
+
+ Improve timer accuracy for JavaScript Date object on Windows.
+
+ Use a combination of ftime and QueryPerformanceCounter.
+ ftime returns the information we want, but doesn't have sufficient resolution.
+ QueryPerformanceCounter has high resolution, but is only usable to measure time intervals.
+ To combine them, we call ftime and QueryPerformanceCounter initially. Later calls will use
+ QueryPerformanceCounter by itself, adding the delta to the saved ftime. We re-sync to
+ correct for drift if the low-res and high-res elapsed time between calls differs by more
+ than twice the low-resolution timer resolution.
+
+ QueryPerformanceCounter may be inaccurate due to a problems with:
+ - some PCI bridge chipsets (http://support.microsoft.com/kb/274323)
+ - BIOS bugs (http://support.microsoft.com/kb/895980/)
+ - BIOS/HAL bugs on multiprocessor/multicore systems (http://msdn.microsoft.com/en-us/library/ms644904.aspx)
+
+ Reviewed by Darin Adler.
+
+ * kjs/DateMath.cpp:
+ (JSC::highResUpTime):
+ (JSC::lowResUTCTime):
+ (JSC::qpcAvailable):
+ (JSC::getCurrentUTCTimeWithMicroseconds):
+
+2008-09-17 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Implement JIT generation of CallFrame initialization, for op_call.
+
+ 1% sunspider 2.5% v8-tests.
+
+ * VM/CTI.cpp:
+ (JSC::CTI::compileOpCall):
+ * VM/Machine.cpp:
+ (JSC::Machine::cti_op_call_JSFunction):
+ (JSC::Machine::cti_op_call_NotJSFunction):
+
+2008-09-17 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Optimizations for op_call in CTI. Move check for (ctiCode == 0) into JIT code,
+ move copying of scopeChain for CodeBlocks that needFullScopeChain into head of
+ functions, instead of checking prior to making the call.
+
+ 3% on v8-tests (4% on richards, 6% in delta-blue)
+
+ * VM/CTI.cpp:
+ (JSC::CTI::compileOpCall):
+ (JSC::CTI::privateCompileSlowCases):
+ (JSC::CTI::privateCompile):
+ * VM/Machine.cpp:
+ (JSC::Machine::execute):
+ (JSC::Machine::cti_op_call_JSFunction):
+ (JSC::Machine::cti_vm_compile):
+ (JSC::Machine::cti_vm_updateScopeChain):
+ (JSC::Machine::cti_op_construct_JSConstruct):
+ * VM/Machine.h:
+
+2008-09-17 Tor Arne Vestbø <tavestbo@trolltech.com>
+
+ Fix the QtWebKit/Mac build
+
+ * wtf/ThreadingQt.cpp:
+ (WTF::initializeThreading): use QCoreApplication to get the main thread
+
+2008-09-16 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Maciej Stachowiak.
+
+ Bug 20857: REGRESSION (r36427): ASSERTION FAILED: m_refCount >= 0 in RegisterID::deref()
+ <https://bugs.webkit.org/show_bug.cgi?id=20857>
+
+ Fix a problem stemming from the slightly unsafe behaviour of the
+ CodeGenerator::finalDestination() method by putting the "func" argument
+ of the emitConstruct() method in a RefPtr in its caller. Also, add an
+ assertion guaranteeing that this is always the case.
+
+ CodeGenerator::finalDestination() is still incorrect and can cause
+ problems with a different allocator; see bug 20340 for more details.
+
+ * VM/CodeGenerator.cpp:
+ (JSC::CodeGenerator::emitConstruct):
+ * kjs/nodes.cpp:
+ (JSC::NewExprNode::emitCode):
+
+2008-09-16 Alice Liu <alice.liu@apple.com>
+
+ build fix.
+
+ * VM/CTI.cpp:
+ (JSC::CTI::privateCompileMainPass):
+
+2008-09-16 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ CTI code generation for op_ret. The majority of the work
+ (updating variables on the stack & on exec) can be performed
+ directly in generated code.
+
+ We still need to check, & to call out to C-code to handle
+ activation records, profiling, and full scope chains.
+
+ +1.5% Sunspider, +5/6% v8 tests.
+
+ * VM/CTI.cpp:
+ (JSC::CTI::emitPutCTIParam):
+ (JSC::CTI::compileOpCall):
+ (JSC::CTI::privateCompileMainPass):
+ * VM/CTI.h:
+ * VM/Machine.cpp:
+ (JSC::Machine::cti_op_ret_activation):
+ (JSC::Machine::cti_op_ret_profiler):
+ (JSC::Machine::cti_op_ret_scopeChain):
+ * VM/Machine.h:
+
+2008-09-16 Dimitri Glazkov <dglazkov@chromium.org>
+
+ Fix the Windows build.
+
+ Add some extra parentheses to stop MSVC from complaining so much.
+
+ * VM/Machine.cpp:
+ (JSC::Machine::privateExecute):
+ (JSC::Machine::cti_op_stricteq):
+ (JSC::Machine::cti_op_nstricteq):
+ * kjs/operations.cpp:
+ (JSC::strictEqual):
+
+2008-09-15 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ - speed up the === and !== operators by choosing the fast cases better
+
+ No effect on SunSpider but speeds up the V8 EarlyBoyer benchmark about 4%.
+
+ * VM/Machine.cpp:
+ (JSC::Machine::privateExecute):
+ (JSC::Machine::cti_op_stricteq):
+ (JSC::Machine::cti_op_nstricteq):
+ * kjs/JSImmediate.h:
+ (JSC::JSImmediate::areBothImmediate):
+ * kjs/operations.cpp:
+ (JSC::strictEqual):
+ (JSC::strictEqualSlowCase):
+ * kjs/operations.h:
+
+2008-09-15 Oliver Hunt <oliver@apple.com>
+
+ RS=Sam Weinig.
+
+ Coding style cleanup.
+
+ * VM/Machine.cpp:
+ (JSC::Machine::privateExecute):
+
+2008-09-15 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ Bug 20874: op_resolve does not do any form of caching
+ <https://bugs.webkit.org/show_bug.cgi?id=20874>
+
+ This patch adds an op_resolve_global opcode to handle (and cache)
+ property lookup we can statically determine must occur on the global
+ object (if at all).
+
+ 3% progression on sunspider, 3.2x improvement to bitops-bitwise-and, and
+ 10% in math-partial-sums
+
+ * VM/CTI.cpp:
+ (JSC::CTI::privateCompileMainPass):
+ * VM/CTI.h:
+ * VM/CodeBlock.cpp:
+ (JSC::CodeBlock::dump):
+ * VM/CodeGenerator.cpp:
+ (JSC::CodeGenerator::findScopedProperty):
+ (JSC::CodeGenerator::emitResolve):
+ * VM/Machine.cpp:
+ (JSC::resolveGlobal):
+ (JSC::Machine::privateExecute):
+ (JSC::Machine::cti_op_resolve_global):
+ * VM/Machine.h:
+ * VM/Opcode.h:
+
+2008-09-15 Sam Weinig <sam@webkit.org>
+
+ Roll out r36462. It broke document.all.
+
+ * VM/CTI.cpp:
+ (JSC::CTI::privateCompileMainPass):
+ (JSC::CTI::privateCompileSlowCases):
+ * VM/CTI.h:
+ * VM/Machine.cpp:
+ (JSC::Machine::Machine):
+ (JSC::Machine::cti_op_eq_null):
+ (JSC::Machine::cti_op_neq_null):
+ * VM/Machine.h:
+ (JSC::Machine::isJSString):
+ * kjs/JSCell.h:
+ * kjs/JSWrapperObject.h:
+ * kjs/StringObject.h:
+ * kjs/StringObjectThatMasqueradesAsUndefined.h:
+
+2008-09-15 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Maciej Stachowiak.
+
+ Bug 20863: ASSERTION FAILED: addressOffset < instructions.size() in CodeBlock::getHandlerForVPC
+ <https://bugs.webkit.org/show_bug.cgi?id=20863>
+
+ r36427 changed the number of arguments to op_construct without changing
+ the argument index for the vPC in the call to initializeCallFrame() in
+ the CTI case. This caused a JSC test failure. Correcting the argument
+ index fixes the test failure.
+
+ * VM/Machine.cpp:
+ (JSC::Machine::cti_op_construct_JSConstruct):
+
+2008-09-15 Mark Rowe <mrowe@apple.com>
+
+ Fix GCC 4.2 build.
+
+ * VM/CTI.h:
+
+2008-09-15 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Fixed a typo in op_get_by_id_chain that caused it to miss every time
+ in the interpreter.
+
+ Also, a little cleanup.
+
+ * VM/Machine.cpp:
+ (JSC::Machine::privateExecute): Set up baseObject before entering the
+ loop, so we compare against the right values.
+
+2008-09-15 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Removed the CalledAsConstructor flag from the call frame header. Now,
+ we use an explicit opcode at the call site to fix up constructor results.
+
+ SunSpider says 0.4% faster.
+
+ cti_op_construct_verify is an out-of-line function call for now, but we
+ can fix that once StructureID holds type information like isObject.
+
+ * VM/CTI.cpp:
+ (JSC::CTI::privateCompileMainPass): Codegen for the new opcode.
+
+ * VM/CodeBlock.cpp:
+ (JSC::CodeBlock::dump):
+
+ * VM/CodeGenerator.cpp: Codegen for the new opcode. Also...
+ (JSC::CodeGenerator::emitCall): ... don't test for known non-zero value.
+ (JSC::CodeGenerator::emitConstruct): ... ditto.
+
+ * VM/Machine.cpp: No more CalledAsConstructor
+ (JSC::Machine::privateExecute): Implementation for the new opcode.
+ (JSC::Machine::cti_op_ret): The speedup: no need to check whether we were
+ called as a constructor.
+ (JSC::Machine::cti_op_construct_verify): Implementation for the new opcode.
+ * VM/Machine.h:
+
+ * VM/Opcode.h: Declare new opcode.
+
+ * VM/RegisterFile.h:
+ (JSC::RegisterFile::): No more CalledAsConstructor
+
+2008-09-15 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Inline code generation of eq_null/neq_null for CTI. Uses vptr checking for
+ StringObjectsThatAreMasqueradingAsBeingUndefined. In the long run, the
+ masquerading may be handled differently (through the StructureIDs - see bug
+ #20823).
+
+ >1% on v8-tests.
+
+ * VM/CTI.cpp:
+ (JSC::CTI::emitJumpSlowCaseIfIsJSCell):
+ (JSC::CTI::privateCompileMainPass):
+ (JSC::CTI::privateCompileSlowCases):
+ * VM/CTI.h:
+ * VM/Machine.cpp:
+ (JSC::Machine::Machine):
+ (JSC::Machine::cti_op_eq_null):
+ (JSC::Machine::cti_op_neq_null):
+ * VM/Machine.h:
+ (JSC::Machine::doesMasqueradesAsUndefined):
+ * kjs/JSWrapperObject.h:
+ (JSC::JSWrapperObject::):
+ (JSC::JSWrapperObject::JSWrapperObject):
+ * kjs/StringObject.h:
+ (JSC::StringObject::StringObject):
+ * kjs/StringObjectThatMasqueradesAsUndefined.h:
+ (JSC::StringObjectThatMasqueradesAsUndefined::StringObjectThatMasqueradesAsUndefined):
+
+2008-09-15 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Rubber-stamped by Oliver Hunt.
+
+ r36427 broke CodeBlock::dump() by changing the number of arguments to
+ op_construct without changing the code that prints it. This patch fixes
+ it by printing the additional argument.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * VM/CodeBlock.cpp:
+ (JSC::CodeBlock::dump):
+
+2008-09-15 Adam Roben <aroben@apple.com>
+
+ Build fix
+
+ * kjs/StructureID.cpp: Removed a stray semicolon.
+
+2008-09-15 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Maciej Stachowiak.
+
+ Fix a crash in fast/js/exception-expression-offset.html caused by not
+ updating all mentions of the length of op_construct in r36427.
+
+ * VM/Machine.cpp:
+ (JSC::Machine::cti_op_construct_NotJSConstruct):
+
+2008-09-15 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ - fix layout test failure introduced by fix for 20849
+
+ (The failing test was fast/js/delete-then-put.html)
+
+ * kjs/JSObject.cpp:
+ (JSC::JSObject::removeDirect): Clear enumeration cache
+ in the dictionary case.
+ * kjs/JSObject.h:
+ (JSC::JSObject::putDirect): Ditto.
+ * kjs/StructureID.h:
+ (JSC::StructureID::clearEnumerationCache): Inline to handle the
+ clear.
+
+2008-09-15 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ - fix JSC test failures introduced by fix for 20849
+
+ * kjs/PropertyMap.cpp:
+ (JSC::PropertyMap::getEnumerablePropertyNames): Use the correct count.
+
+2008-09-15 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Maciej Stachowiak.
+
+ Bug 20851: REGRESSION (r36410): fast/js/kde/GlobalObject.html fails
+ <https://bugs.webkit.org/show_bug.cgi?id=20851>
+
+ r36410 introduced an optimization for parseInt() that is incorrect when
+ its argument is larger than the range of a 32-bit integer. If the
+ argument is a number that is not an immediate integer, then the correct
+ behaviour is to return the floor of its value, unless it is an infinite
+ value, in which case the correct behaviour is to return 0.
+
+ * kjs/JSGlobalObjectFunctions.cpp:
+ (JSC::globalFuncParseInt):
+
+2008-09-15 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Maciej Stachowiak.
+
+ Patch for https://bugs.webkit.org/show_bug.cgi?id=20849
+ Cache property names for getEnumerablePropertyNames in the StructureID.
+
+ ~0.5% speedup on Sunspider overall (9.7% speedup on string-fasta). ~1% speedup
+ on the v8 test suite.
+
+ * kjs/JSObject.cpp:
+ (JSC::JSObject::getPropertyNames):
+ * kjs/PropertyMap.cpp:
+ (JSC::PropertyMap::getEnumerablePropertyNames):
+ * kjs/PropertyMap.h:
+ * kjs/StructureID.cpp:
+ (JSC::StructureID::StructureID):
+ (JSC::StructureID::getEnumerablePropertyNames):
+ * kjs/StructureID.h:
+
+2008-09-14 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ - speed up JS construction by extracting "prototype" lookup so PIC applies.
+
+ ~0.5% speedup on SunSpider
+ Speeds up some of the V8 tests as well, most notably earley-boyer.
+
+ * VM/CTI.cpp:
+ (JSC::CTI::compileOpCall): Account for extra arg for prototype.
+ (JSC::CTI::privateCompileMainPass): Account for increased size of op_construct.
+ * VM/CodeGenerator.cpp:
+ (JSC::CodeGenerator::emitConstruct): Emit separate lookup to get prototype property.
+ * VM/Machine.cpp:
+ (JSC::Machine::privateExecute): Expect prototype arg in op_construct.
+ (JSC::Machine::cti_op_construct_JSConstruct): ditto
+ (JSC::Machine::cti_op_construct_NotJSConstruct): ditto
+
+2008-09-10 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ Add a protected destructor for RefCounted.
+
+ It is wrong to call its destructor directly, because (1) this should be taken care of by
+ deref(), and (2) many classes that use RefCounted have non-virtual destructors.
+
+ No change in behavior.
+
+ * wtf/RefCounted.h: (WTF::RefCounted::~RefCounted):
+
+2008-09-14 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Accelerated property accesses.
+
+ Inline more of the array access code into the JIT code for get/put_by_val.
+ Accelerate get/put_by_id by speculatively inlining a disable direct access
+ into the hot path of the code, and repatch this with the correct StructureID
+ and property map offset once these are known. In the case of accesses to the
+ prototype and reading the array-length a trampoline is genertaed, and the
+ branch to the slow-case is relinked to jump to this.
+
+ By repatching, we mean rewriting the x86 instruction stream. Instructions are
+ only modified in a simple fasion - altering immediate operands, memory access
+ deisplacements, and branch offsets.
+
+ For regular get_by_id/put_by_id accesses to an object, a StructureID in an
+ instruction's immediate operant is updateded, and a memory access operation's
+ displacement is updated to access the correct field on the object. In the case
+ of more complex accesses (array length and get_by_id_prototype) the offset on
+ the branch to slow-case is updated, to now jump to a trampoline.
+
+ +2.8% sunspider, +13% v8-tests
+
+ * VM/CTI.cpp:
+ (JSC::CTI::emitCall):
+ (JSC::CTI::emitJumpSlowCaseIfNotJSCell):
+ (JSC::CTI::CTI):
+ (JSC::CTI::privateCompileMainPass):
+ (JSC::CTI::privateCompileSlowCases):
+ (JSC::CTI::privateCompile):
+ (JSC::CTI::privateCompileGetByIdSelf):
+ (JSC::CTI::privateCompileGetByIdProto):
+ (JSC::CTI::privateCompileGetByIdChain):
+ (JSC::CTI::privateCompilePutByIdReplace):
+ (JSC::CTI::privateCompilePutByIdTransition):
+ (JSC::CTI::privateCompileArrayLengthTrampoline):
+ (JSC::CTI::privateCompileStringLengthTrampoline):
+ (JSC::CTI::patchGetByIdSelf):
+ (JSC::CTI::patchPutByIdReplace):
+ (JSC::CTI::privateCompilePatchGetArrayLength):
+ (JSC::CTI::privateCompilePatchGetStringLength):
+ * VM/CTI.h:
+ (JSC::CTI::compileGetByIdSelf):
+ (JSC::CTI::compileGetByIdProto):
+ (JSC::CTI::compileGetByIdChain):
+ (JSC::CTI::compilePutByIdReplace):
+ (JSC::CTI::compilePutByIdTransition):
+ (JSC::CTI::compileArrayLengthTrampoline):
+ (JSC::CTI::compileStringLengthTrampoline):
+ (JSC::CTI::compilePatchGetArrayLength):
+ (JSC::CTI::compilePatchGetStringLength):
+ * VM/CodeBlock.cpp:
+ (JSC::CodeBlock::dump):
+ (JSC::CodeBlock::~CodeBlock):
+ * VM/CodeBlock.h:
+ (JSC::StructureStubInfo::StructureStubInfo):
+ (JSC::CodeBlock::getStubInfo):
+ * VM/Machine.cpp:
+ (JSC::Machine::tryCTICachePutByID):
+ (JSC::Machine::tryCTICacheGetByID):
+ (JSC::Machine::cti_op_put_by_val_array):
+ * VM/Machine.h:
+ * masm/X86Assembler.h:
+ (JSC::X86Assembler::):
+ (JSC::X86Assembler::cmpl_i8m):
+ (JSC::X86Assembler::emitUnlinkedJa):
+ (JSC::X86Assembler::getRelocatedAddress):
+ (JSC::X86Assembler::getDifferenceBetweenLabels):
+ (JSC::X86Assembler::emitModRm_opmsib):
+
+2008-09-14 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ - split the "prototype" lookup for hasInstance into opcode stream so it can be cached
+
+ ~5% speedup on v8 earley-boyer test
+
+ * API/JSCallbackObject.h: Add a parameter for the pre-looked-up prototype.
+ * API/JSCallbackObjectFunctions.h:
+ (JSC::::hasInstance): Ditto.
+ * API/JSValueRef.cpp:
+ (JSValueIsInstanceOfConstructor): Look up and pass in prototype.
+ * JavaScriptCore.exp:
+ * VM/CTI.cpp:
+ (JSC::CTI::privateCompileMainPass): Pass along prototype.
+ * VM/CodeBlock.cpp:
+ (JSC::CodeBlock::dump): Print third arg.
+ * VM/CodeGenerator.cpp:
+ (JSC::CodeGenerator::emitInstanceOf): Implement this, now that there
+ is a third argument.
+ * VM/CodeGenerator.h:
+ * VM/Machine.cpp:
+ (JSC::Machine::privateExecute): Pass along the prototype.
+ (JSC::Machine::cti_op_instanceof): ditto
+ * kjs/JSObject.cpp:
+ (JSC::JSObject::hasInstance): Expect to get a pre-looked-up prototype.
+ * kjs/JSObject.h:
+ * kjs/nodes.cpp:
+ (JSC::InstanceOfNode::emitCode): Emit a get_by_id of the prototype
+ property and pass that register to instanceof.
+ * kjs/nodes.h:
+
+2008-09-14 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Remove unnecessary virtual function call from cti_op_call_JSFunction -
+ ~5% on richards, ~2.5% on v8-tests, ~0.5% on sunspider.
+
+ * VM/Machine.cpp:
+ (JSC::Machine::cti_op_call_JSFunction):
+
+2008-09-14 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Maciej Stachowiak.
+
+ Bug 20827: the 'typeof' operator is slow
+ <https://bugs.webkit.org/show_bug.cgi?id=20827>
+
+ Optimize the 'typeof' operator when its result is compared to a constant
+ string.
+
+ This is a 5.5% speedup on the V8 Earley-Boyer test.
+
+ * VM/CTI.cpp:
+ (JSC::CTI::privateCompileMainPass):
+ * VM/CodeBlock.cpp:
+ (JSC::CodeBlock::dump):
+ * VM/CodeGenerator.cpp:
+ (JSC::CodeGenerator::emitEqualityOp):
+ * VM/CodeGenerator.h:
+ * VM/Machine.cpp:
+ (JSC::jsIsObjectType):
+ (JSC::jsIsFunctionType):
+ (JSC::Machine::privateExecute):
+ (JSC::Machine::cti_op_is_undefined):
+ (JSC::Machine::cti_op_is_boolean):
+ (JSC::Machine::cti_op_is_number):
+ (JSC::Machine::cti_op_is_string):
+ (JSC::Machine::cti_op_is_object):
+ (JSC::Machine::cti_op_is_function):
+ * VM/Machine.h:
+ * VM/Opcode.h:
+ * kjs/nodes.cpp:
+ (JSC::BinaryOpNode::emitCode):
+ (JSC::EqualNode::emitCode):
+ (JSC::StrictEqualNode::emitCode):
+ * kjs/nodes.h:
+
+2008-09-14 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Cameron Zwarich.
+
+ Patch for https://bugs.webkit.org/show_bug.cgi?id=20844
+ Speed up parseInt for numbers
+
+ Sunspider reports this as 1.029x as fast overall and 1.37x as fast on string-unpack-code.
+ No change on the v8 suite.
+
+ * kjs/JSGlobalObjectFunctions.cpp:
+ (JSC::globalFuncParseInt): Don't convert numbers to strings just to
+ convert them back to numbers.
+
+2008-09-14 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 20816: op_lesseq should be optimized
+ <https://bugs.webkit.org/show_bug.cgi?id=20816>
+
+ Add a loop_if_lesseq opcode that is similar to the loop_if_less opcode.
+
+ This is a 9.4% speedup on the V8 Crypto benchmark.
+
+ * VM/CTI.cpp:
+ (JSC::CTI::privateCompileMainPass):
+ (JSC::CTI::privateCompileSlowCases):
+ * VM/CodeBlock.cpp:
+ (JSC::CodeBlock::dump):
+ * VM/CodeGenerator.cpp:
+ (JSC::CodeGenerator::emitJumpIfTrue):
+ * VM/Machine.cpp:
+ (JSC::Machine::privateExecute):
+ (JSC::Machine::cti_op_loop_if_lesseq):
+ * VM/Machine.h:
+ * VM/Opcode.h:
+
+2008-09-14 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Cameron Zwarich.
+
+ Cleanup Sampling code.
+
+ * VM/CTI.cpp:
+ (JSC::CTI::emitCall):
+ (JSC::CTI::privateCompileMainPass):
+ * VM/CTI.h:
+ (JSC::CTI::execute):
+ * VM/SamplingTool.cpp:
+ (JSC::):
+ (JSC::SamplingTool::run):
+ (JSC::SamplingTool::dump):
+ * VM/SamplingTool.h:
+ (JSC::SamplingTool::callingHostFunction):
+
+2008-09-13 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ Bug 20821: Cache property transitions to speed up object initialization
+ https://bugs.webkit.org/show_bug.cgi?id=20821
+
+ Implement a transition cache to improve the performance of new properties
+ being added to objects. This is extremely beneficial in constructors and
+ shows up as a 34% improvement on access-binary-trees in SunSpider (0.8%
+ overall)
+
+ * VM/CTI.cpp:
+ (JSC::CTI::privateCompileMainPass):
+ (JSC::):
+ (JSC::transitionWillNeedStorageRealloc):
+ (JSC::CTI::privateCompilePutByIdTransition):
+ * VM/CTI.h:
+ (JSC::CTI::compilePutByIdTransition):
+ * VM/CodeBlock.cpp:
+ (JSC::printPutByIdOp):
+ (JSC::CodeBlock::printStructureIDs):
+ (JSC::CodeBlock::dump):
+ (JSC::CodeBlock::derefStructureIDs):
+ (JSC::CodeBlock::refStructureIDs):
+ * VM/CodeGenerator.cpp:
+ (JSC::CodeGenerator::emitPutById):
+ * VM/Machine.cpp:
+ (JSC::cachePrototypeChain):
+ (JSC::Machine::tryCachePutByID):
+ (JSC::Machine::tryCacheGetByID):
+ (JSC::Machine::privateExecute):
+ (JSC::Machine::tryCTICachePutByID):
+ (JSC::Machine::tryCTICacheGetByID):
+ * VM/Machine.h:
+ * VM/Opcode.h:
+ * kjs/JSObject.h:
+ (JSC::JSObject::putDirect):
+ (JSC::JSObject::transitionTo):
+ * kjs/PutPropertySlot.h:
+ (JSC::PutPropertySlot::PutPropertySlot):
+ (JSC::PutPropertySlot::wasTransition):
+ (JSC::PutPropertySlot::setWasTransition):
+ * kjs/StructureID.cpp:
+ (JSC::StructureID::transitionTo):
+ (JSC::StructureIDChain::StructureIDChain):
+ * kjs/StructureID.h:
+ (JSC::StructureID::previousID):
+ (JSC::StructureID::setCachedPrototypeChain):
+ (JSC::StructureID::cachedPrototypeChain):
+ (JSC::StructureID::propertyMap):
+ * masm/X86Assembler.h:
+ (JSC::X86Assembler::addl_i8m):
+ (JSC::X86Assembler::subl_i8m):
+
+2008-09-12 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Maciej Stachowiak.
+
+ Bug 20819: JSValue::isObject() is slow
+ <https://bugs.webkit.org/show_bug.cgi?id=20819>
+
+ Optimize JSCell::isObject() and JSCell::isString() by making them
+ non-virtual calls that rely on the StructureID type information.
+
+ This is a 0.7% speedup on SunSpider and a 1.0% speedup on the V8
+ benchmark suite.
+
+ * JavaScriptCore.exp:
+ * kjs/JSCell.cpp:
+ * kjs/JSCell.h:
+ (JSC::JSCell::isObject):
+ (JSC::JSCell::isString):
+ * kjs/JSObject.cpp:
+ * kjs/JSObject.h:
+ * kjs/JSString.cpp:
+ * kjs/JSString.h:
+ (JSC::JSString::JSString):
+ * kjs/StructureID.h:
+ (JSC::StructureID::type):
+
+2008-09-11 Stephanie Lewis <slewis@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Turn off PGO Optimization on CTI.cpp -> <rdar://problem/6207709>. Fixes
+ crash on CNN and on Dromaeo.
+ Fix Missing close tag in vcproj.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+
+2008-09-11 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Not reviewed.
+
+ Correct an SVN problem with the last commit and actually add the new
+ files.
+
+ * wrec/CharacterClassConstructor.cpp: Added.
+ (JSC::):
+ (JSC::getCharacterClassNewline):
+ (JSC::getCharacterClassDigits):
+ (JSC::getCharacterClassSpaces):
+ (JSC::getCharacterClassWordchar):
+ (JSC::getCharacterClassNondigits):
+ (JSC::getCharacterClassNonspaces):
+ (JSC::getCharacterClassNonwordchar):
+ (JSC::CharacterClassConstructor::addSorted):
+ (JSC::CharacterClassConstructor::addSortedRange):
+ (JSC::CharacterClassConstructor::put):
+ (JSC::CharacterClassConstructor::flush):
+ (JSC::CharacterClassConstructor::append):
+ * wrec/CharacterClassConstructor.h: Added.
+ (JSC::CharacterClassConstructor::CharacterClassConstructor):
+ (JSC::CharacterClassConstructor::isUpsideDown):
+ (JSC::CharacterClassConstructor::charClass):
+
+2008-09-11 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Maciej Stachowiak.
+
+ Bug 20788: Split CharacterClassConstructor into its own file
+ <https://bugs.webkit.org/show_bug.cgi?id=20788>
+
+ Split CharacterClassConstructor into its own file and clean up some
+ style issues.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * wrec/CharacterClassConstructor.cpp: Added.
+ (JSC::):
+ (JSC::getCharacterClassNewline):
+ (JSC::getCharacterClassDigits):
+ (JSC::getCharacterClassSpaces):
+ (JSC::getCharacterClassWordchar):
+ (JSC::getCharacterClassNondigits):
+ (JSC::getCharacterClassNonspaces):
+ (JSC::getCharacterClassNonwordchar):
+ (JSC::CharacterClassConstructor::addSorted):
+ (JSC::CharacterClassConstructor::addSortedRange):
+ (JSC::CharacterClassConstructor::put):
+ (JSC::CharacterClassConstructor::flush):
+ (JSC::CharacterClassConstructor::append):
+ * wrec/CharacterClassConstructor.h: Added.
+ (JSC::CharacterClassConstructor::CharacterClassConstructor):
+ (JSC::CharacterClassConstructor::isUpsideDown):
+ (JSC::CharacterClassConstructor::charClass):
+ * wrec/WREC.cpp:
+ (JSC::WRECParser::parseCharacterClass):
+
+2008-09-10 Simon Hausmann <hausmann@webkit.org>
+
+ Not reviewed but trivial one-liner for yet unused macro.
+
+ Changed PLATFORM(WINCE) to PLATFORM(WIN_CE) as requested by Mark.
+
+ (part of https://bugs.webkit.org/show_bug.cgi?id=20746)
+
+ * wtf/Platform.h:
+
+2008-09-10 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Rubber-stamped by Oliver Hunt.
+
+ Fix a typo by renaming the overloaded orl_rr that takes an immediate to
+ orl_i32r.
+
+ * VM/CTI.cpp:
+ (JSC::CTI::emitFastArithPotentiallyReTagImmediate):
+ * masm/X86Assembler.h:
+ (JSC::X86Assembler::orl_i32r):
+ * wrec/WREC.cpp:
+ (JSC::WRECGenerator::generatePatternCharacter):
+ (JSC::WRECGenerator::generateCharacterClassInverted):
+
+2008-09-10 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoff Garen.
+
+ Add inline property storage for JSObject.
+
+ 1.2% progression on Sunspider. .5% progression on the v8 test suite.
+
+ * JavaScriptCore.exp:
+ * VM/CTI.cpp:
+ (JSC::CTI::privateCompileGetByIdProto):
+ (JSC::CTI::privateCompileGetByIdChain):
+ * kjs/JSObject.cpp:
+ (JSC::JSObject::mark): There is no reason to check storageSize now that
+ we start from 0.
+ (JSC::JSObject::allocatePropertyStorage): Allocates/reallocates heap storage.
+ * kjs/JSObject.h:
+ (JSC::JSObject::offsetForLocation): m_propertyStorage is not an OwnArrayPtr
+ now so there is no reason to .get()
+ (JSC::JSObject::usingInlineStorage):
+ (JSC::JSObject::JSObject): Start with m_propertyStorage pointing to the
+ inline storage.
+ (JSC::JSObject::~JSObject): Free the heap storage if not using the inline
+ storage.
+ (JSC::JSObject::putDirect): Switch to the heap storage only when we know
+ we know that we are about to add a property that will overflow the inline
+ storage.
+ * kjs/PropertyMap.cpp:
+ (JSC::PropertyMap::createTable): Don't allocate the propertyStorage, that is
+ now handled by JSObject.
+ (JSC::PropertyMap::rehash): PropertyStorage is not a OwnArrayPtr anymore.
+ * kjs/PropertyMap.h:
+ (JSC::PropertyMap::storageSize): Rename from markingCount.
+ * kjs/StructureID.cpp:
+ (JSC::StructureID::addPropertyTransition): Don't resize the property storage
+ if we are using inline storage.
+ * kjs/StructureID.h:
+
+2008-09-10 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Inline immediate number version of op_mul.
+
+ Renamed mull_rr to imull_rr as that's what it's
+ actually doing, and added imull_i32r for the constant
+ case immediate multiply.
+
+ 1.1% improvement to SunSpider.
+
+ * VM/CTI.cpp:
+ (JSC::CTI::privateCompileMainPass):
+ (JSC::CTI::privateCompileSlowCases):
+ * masm/X86Assembler.h:
+ (JSC::X86Assembler::):
+ (JSC::X86Assembler::imull_rr):
+ (JSC::X86Assembler::imull_i32r):
+
+2008-09-10 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Not reviewed.
+
+ Mac build fix.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2008-09-09 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Add optimised access to known properties on the global object.
+
+ Improve cross scope access to the global object by emitting
+ code to access it directly rather than by walking the scope chain.
+
+ This is a 0.8% win in SunSpider and a 1.7% win in the v8 benchmarks.
+
+ * VM/CTI.cpp:
+ (JSC::CTI::privateCompileMainPass):
+ (JSC::CTI::emitGetVariableObjectRegister):
+ (JSC::CTI::emitPutVariableObjectRegister):
+ * VM/CTI.h:
+ * VM/CodeBlock.cpp:
+ (JSC::CodeBlock::dump):
+ * VM/CodeGenerator.cpp:
+ (JSC::CodeGenerator::findScopedProperty):
+ (JSC::CodeGenerator::emitResolve):
+ (JSC::CodeGenerator::emitGetScopedVar):
+ (JSC::CodeGenerator::emitPutScopedVar):
+ * VM/CodeGenerator.h:
+ * VM/Machine.cpp:
+ (JSC::Machine::privateExecute):
+ * VM/Opcode.h:
+ * kjs/nodes.cpp:
+ (JSC::FunctionCallResolveNode::emitCode):
+ (JSC::PostfixResolveNode::emitCode):
+ (JSC::PrefixResolveNode::emitCode):
+ (JSC::ReadModifyResolveNode::emitCode):
+ (JSC::AssignResolveNode::emitCode):
+
+2008-09-10 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver.
+
+ - enable polymorphic inline caching of properties of primitives
+
+ 1.012x speedup on SunSpider.
+
+ We create special structure IDs for JSString and
+ JSNumberCell. Unlike normal structure IDs, these cannot hold the
+ true prototype. Due to JS autoboxing semantics, the prototype used
+ when looking up string or number properties depends on the lexical
+ global object of the call site, not the creation site. Thus we
+ enable StructureIDs to handle this quirk for primitives.
+
+ Everything else should be straightforward.
+
+ * VM/CTI.cpp:
+ (JSC::CTI::privateCompileGetByIdProto):
+ (JSC::CTI::privateCompileGetByIdChain):
+ * VM/CTI.h:
+ (JSC::CTI::compileGetByIdProto):
+ (JSC::CTI::compileGetByIdChain):
+ * VM/JSPropertyNameIterator.h:
+ (JSC::JSPropertyNameIterator::JSPropertyNameIterator):
+ * VM/Machine.cpp:
+ (JSC::Machine::Machine):
+ (JSC::cachePrototypeChain):
+ (JSC::Machine::tryCachePutByID):
+ (JSC::Machine::tryCacheGetByID):
+ (JSC::Machine::privateExecute):
+ (JSC::Machine::tryCTICachePutByID):
+ (JSC::Machine::tryCTICacheGetByID):
+ * kjs/GetterSetter.h:
+ (JSC::GetterSetter::GetterSetter):
+ * kjs/JSCell.h:
+ * kjs/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData):
+ * kjs/JSGlobalData.h:
+ * kjs/JSGlobalObject.h:
+ (JSC::StructureID::prototypeForLookup):
+ * kjs/JSNumberCell.h:
+ (JSC::JSNumberCell::JSNumberCell):
+ (JSC::jsNumberCell):
+ * kjs/JSObject.h:
+ (JSC::JSObject::prototype):
+ * kjs/JSString.cpp:
+ (JSC::jsString):
+ (JSC::jsSubstring):
+ (JSC::jsOwnedString):
+ * kjs/JSString.h:
+ (JSC::JSString::JSString):
+ (JSC::JSString::):
+ (JSC::jsSingleCharacterString):
+ (JSC::jsSingleCharacterSubstring):
+ (JSC::jsNontrivialString):
+ * kjs/SmallStrings.cpp:
+ (JSC::SmallStrings::createEmptyString):
+ (JSC::SmallStrings::createSingleCharacterString):
+ * kjs/StructureID.cpp:
+ (JSC::StructureID::StructureID):
+ (JSC::StructureID::addPropertyTransition):
+ (JSC::StructureID::getterSetterTransition):
+ (JSC::StructureIDChain::StructureIDChain):
+ * kjs/StructureID.h:
+ (JSC::StructureID::create):
+ (JSC::StructureID::storedPrototype):
+
+2008-09-09 Joerg Bornemann <joerg.bornemann@trolltech.com>
+
+ Reviewed by Sam Weinig.
+
+ https://bugs.webkit.org/show_bug.cgi?id=20746
+
+ Added WINCE platform macro.
+
+ * wtf/Platform.h:
+
+2008-09-09 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Mark Rowe.
+
+ Remove unnecessary override of getOffset.
+
+ Sunspider reports this as a .6% progression.
+
+ * JavaScriptCore.exp:
+ * kjs/JSObject.h:
+ (JSC::JSObject::getDirectLocation):
+ (JSC::JSObject::getOwnPropertySlotForWrite):
+ (JSC::JSObject::putDirect):
+ * kjs/PropertyMap.cpp:
+ * kjs/PropertyMap.h:
+
+2008-09-09 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Maciej Stachowiak.
+
+ Bug 20759: Remove MacroAssembler
+ <https://bugs.webkit.org/show_bug.cgi?id=20759>
+
+ Remove MacroAssembler and move its functionality to X86Assembler.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * VM/CTI.cpp:
+ (JSC::CTI::emitGetArg):
+ (JSC::CTI::emitGetPutArg):
+ (JSC::CTI::emitPutArg):
+ (JSC::CTI::emitPutCTIParam):
+ (JSC::CTI::emitGetCTIParam):
+ (JSC::CTI::emitPutToCallFrameHeader):
+ (JSC::CTI::emitGetFromCallFrameHeader):
+ (JSC::CTI::emitPutResult):
+ (JSC::CTI::emitDebugExceptionCheck):
+ (JSC::CTI::emitJumpSlowCaseIfNotImm):
+ (JSC::CTI::emitJumpSlowCaseIfNotImms):
+ (JSC::CTI::emitFastArithDeTagImmediate):
+ (JSC::CTI::emitFastArithReTagImmediate):
+ (JSC::CTI::emitFastArithPotentiallyReTagImmediate):
+ (JSC::CTI::emitFastArithImmToInt):
+ (JSC::CTI::emitFastArithIntToImmOrSlowCase):
+ (JSC::CTI::emitFastArithIntToImmNoCheck):
+ (JSC::CTI::compileOpCall):
+ (JSC::CTI::emitSlowScriptCheck):
+ (JSC::CTI::privateCompileMainPass):
+ (JSC::CTI::privateCompileSlowCases):
+ (JSC::CTI::privateCompile):
+ (JSC::CTI::privateCompileGetByIdSelf):
+ (JSC::CTI::privateCompileGetByIdProto):
+ (JSC::CTI::privateCompileGetByIdChain):
+ (JSC::CTI::privateCompilePutByIdReplace):
+ (JSC::CTI::privateArrayLengthTrampoline):
+ (JSC::CTI::privateStringLengthTrampoline):
+ (JSC::CTI::compileRegExp):
+ * VM/CTI.h:
+ (JSC::CallRecord::CallRecord):
+ (JSC::JmpTable::JmpTable):
+ (JSC::SlowCaseEntry::SlowCaseEntry):
+ (JSC::CTI::JSRInfo::JSRInfo):
+ * masm/MacroAssembler.h: Removed.
+ * masm/MacroAssemblerWin.cpp: Removed.
+ * masm/X86Assembler.h:
+ (JSC::X86Assembler::emitConvertToFastCall):
+ (JSC::X86Assembler::emitRestoreArgumentReference):
+ * wrec/WREC.h:
+ (JSC::WRECGenerator::WRECGenerator):
+ (JSC::WRECParser::WRECParser):
+
+2008-09-09 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Cameron Zwarich.
+
+ Don't waste the first item in the PropertyStorage.
+
+ - Fix typo (makingCount -> markingCount)
+ - Remove undefined method declaration.
+
+ No change on Sunspider.
+
+ * kjs/JSObject.cpp:
+ (JSC::JSObject::mark):
+ * kjs/PropertyMap.cpp:
+ (JSC::PropertyMap::put):
+ (JSC::PropertyMap::remove):
+ (JSC::PropertyMap::getOffset):
+ (JSC::PropertyMap::insert):
+ (JSC::PropertyMap::rehash):
+ (JSC::PropertyMap::resizePropertyStorage):
+ (JSC::PropertyMap::checkConsistency):
+ * kjs/PropertyMap.h:
+ (JSC::PropertyMap::markingCount): Fix typo.
+
+2008-09-09 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Not reviewed.
+
+ Speculative Windows build fix.
+
+ * masm/MacroAssemblerWin.cpp:
+ (JSC::MacroAssembler::emitConvertToFastCall):
+ (JSC::MacroAssembler::emitRestoreArgumentReference):
+
+2008-09-09 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Maciej Stachowiak.
+
+ Bug 20755: Create an X86 namespace for register names and other things
+ <https://bugs.webkit.org/show_bug.cgi?id=20755>
+
+ Create an X86 namespace to put X86 register names. Perhaps I will move
+ opcode names here later as well.
+
+ * VM/CTI.cpp:
+ (JSC::CTI::emitGetArg):
+ (JSC::CTI::emitGetPutArg):
+ (JSC::CTI::emitPutArg):
+ (JSC::CTI::emitPutArgConstant):
+ (JSC::CTI::emitPutCTIParam):
+ (JSC::CTI::emitGetCTIParam):
+ (JSC::CTI::emitPutToCallFrameHeader):
+ (JSC::CTI::emitGetFromCallFrameHeader):
+ (JSC::CTI::emitPutResult):
+ (JSC::CTI::emitDebugExceptionCheck):
+ (JSC::CTI::emitJumpSlowCaseIfNotImms):
+ (JSC::CTI::compileOpCall):
+ (JSC::CTI::emitSlowScriptCheck):
+ (JSC::CTI::privateCompileMainPass):
+ (JSC::CTI::privateCompileSlowCases):
+ (JSC::CTI::privateCompile):
+ (JSC::CTI::privateCompileGetByIdSelf):
+ (JSC::CTI::privateCompileGetByIdProto):
+ (JSC::CTI::privateCompileGetByIdChain):
+ (JSC::CTI::privateCompilePutByIdReplace):
+ (JSC::CTI::privateArrayLengthTrampoline):
+ (JSC::CTI::privateStringLengthTrampoline):
+ (JSC::CTI::compileRegExp):
+ * VM/CTI.h:
+ * masm/X86Assembler.h:
+ (JSC::X86::):
+ (JSC::X86Assembler::emitModRm_rm):
+ (JSC::X86Assembler::emitModRm_rm_Unchecked):
+ (JSC::X86Assembler::emitModRm_rmsib):
+ * wrec/WREC.cpp:
+ (JSC::WRECGenerator::generateNonGreedyQuantifier):
+ (JSC::WRECGenerator::generateGreedyQuantifier):
+ (JSC::WRECGenerator::generateParentheses):
+ (JSC::WRECGenerator::generateBackreference):
+ (JSC::WRECGenerator::gernerateDisjunction):
+ * wrec/WREC.h:
+
+2008-09-09 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ Remove unnecessary friend declaration.
+
+ * kjs/PropertyMap.h:
+
+2008-09-09 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ Replace uses of PropertyMap::get and PropertyMap::getLocation with
+ PropertyMap::getOffset.
+
+ Sunspider reports this as a .6% improvement.
+
+ * JavaScriptCore.exp:
+ * kjs/JSObject.cpp:
+ (JSC::JSObject::put):
+ (JSC::JSObject::deleteProperty):
+ (JSC::JSObject::getPropertyAttributes):
+ * kjs/JSObject.h:
+ (JSC::JSObject::getDirect):
+ (JSC::JSObject::getDirectLocation):
+ (JSC::JSObject::locationForOffset):
+ * kjs/PropertyMap.cpp:
+ (JSC::PropertyMap::remove):
+ (JSC::PropertyMap::getOffset):
+ * kjs/PropertyMap.h:
+
+2008-09-09 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Sam Weinig.
+
+ Bug 20754: Remove emit prefix from assembler opcode methods
+ <https://bugs.webkit.org/show_bug.cgi?id=20754>
+
+ * VM/CTI.cpp:
+ (JSC::CTI::emitGetArg):
+ (JSC::CTI::emitGetPutArg):
+ (JSC::CTI::emitPutArg):
+ (JSC::CTI::emitPutArgConstant):
+ (JSC::CTI::emitPutCTIParam):
+ (JSC::CTI::emitGetCTIParam):
+ (JSC::CTI::emitPutToCallFrameHeader):
+ (JSC::CTI::emitGetFromCallFrameHeader):
+ (JSC::CTI::emitPutResult):
+ (JSC::CTI::emitDebugExceptionCheck):
+ (JSC::CTI::emitCall):
+ (JSC::CTI::emitJumpSlowCaseIfNotImm):
+ (JSC::CTI::emitJumpSlowCaseIfNotImms):
+ (JSC::CTI::emitFastArithDeTagImmediate):
+ (JSC::CTI::emitFastArithReTagImmediate):
+ (JSC::CTI::emitFastArithPotentiallyReTagImmediate):
+ (JSC::CTI::emitFastArithImmToInt):
+ (JSC::CTI::emitFastArithIntToImmOrSlowCase):
+ (JSC::CTI::emitFastArithIntToImmNoCheck):
+ (JSC::CTI::compileOpCall):
+ (JSC::CTI::emitSlowScriptCheck):
+ (JSC::CTI::privateCompileMainPass):
+ (JSC::CTI::privateCompileSlowCases):
+ (JSC::CTI::privateCompile):
+ (JSC::CTI::privateCompileGetByIdSelf):
+ (JSC::CTI::privateCompileGetByIdProto):
+ (JSC::CTI::privateCompileGetByIdChain):
+ (JSC::CTI::privateCompilePutByIdReplace):
+ (JSC::CTI::privateArrayLengthTrampoline):
+ (JSC::CTI::privateStringLengthTrampoline):
+ (JSC::CTI::compileRegExp):
+ * masm/MacroAssemblerWin.cpp:
+ (JSC::MacroAssembler::emitConvertToFastCall):
+ (JSC::MacroAssembler::emitRestoreArgumentReference):
+ * masm/X86Assembler.h:
+ (JSC::X86Assembler::pushl_r):
+ (JSC::X86Assembler::pushl_m):
+ (JSC::X86Assembler::popl_r):
+ (JSC::X86Assembler::popl_m):
+ (JSC::X86Assembler::movl_rr):
+ (JSC::X86Assembler::addl_rr):
+ (JSC::X86Assembler::addl_i8r):
+ (JSC::X86Assembler::addl_i32r):
+ (JSC::X86Assembler::addl_mr):
+ (JSC::X86Assembler::andl_rr):
+ (JSC::X86Assembler::andl_i32r):
+ (JSC::X86Assembler::cmpl_i8r):
+ (JSC::X86Assembler::cmpl_rr):
+ (JSC::X86Assembler::cmpl_rm):
+ (JSC::X86Assembler::cmpl_i32r):
+ (JSC::X86Assembler::cmpl_i32m):
+ (JSC::X86Assembler::cmpw_rm):
+ (JSC::X86Assembler::orl_rr):
+ (JSC::X86Assembler::subl_rr):
+ (JSC::X86Assembler::subl_i8r):
+ (JSC::X86Assembler::subl_i32r):
+ (JSC::X86Assembler::subl_mr):
+ (JSC::X86Assembler::testl_i32r):
+ (JSC::X86Assembler::testl_rr):
+ (JSC::X86Assembler::xorl_i8r):
+ (JSC::X86Assembler::xorl_rr):
+ (JSC::X86Assembler::sarl_i8r):
+ (JSC::X86Assembler::sarl_CLr):
+ (JSC::X86Assembler::shl_i8r):
+ (JSC::X86Assembler::shll_CLr):
+ (JSC::X86Assembler::mull_rr):
+ (JSC::X86Assembler::idivl_r):
+ (JSC::X86Assembler::cdq):
+ (JSC::X86Assembler::movl_mr):
+ (JSC::X86Assembler::movzwl_mr):
+ (JSC::X86Assembler::movl_rm):
+ (JSC::X86Assembler::movl_i32r):
+ (JSC::X86Assembler::movl_i32m):
+ (JSC::X86Assembler::leal_mr):
+ (JSC::X86Assembler::ret):
+ (JSC::X86Assembler::jmp_r):
+ (JSC::X86Assembler::jmp_m):
+ (JSC::X86Assembler::call_r):
+ * wrec/WREC.cpp:
+ (JSC::WRECGenerator::generateBacktrack1):
+ (JSC::WRECGenerator::generateBacktrackBackreference):
+ (JSC::WRECGenerator::generateBackreferenceQuantifier):
+ (JSC::WRECGenerator::generateNonGreedyQuantifier):
+ (JSC::WRECGenerator::generateGreedyQuantifier):
+ (JSC::WRECGenerator::generatePatternCharacter):
+ (JSC::WRECGenerator::generateCharacterClassInvertedRange):
+ (JSC::WRECGenerator::generateCharacterClassInverted):
+ (JSC::WRECGenerator::generateCharacterClass):
+ (JSC::WRECGenerator::generateParentheses):
+ (JSC::WRECGenerator::gererateParenthesesResetTrampoline):
+ (JSC::WRECGenerator::generateAssertionBOL):
+ (JSC::WRECGenerator::generateAssertionEOL):
+ (JSC::WRECGenerator::generateAssertionWordBoundary):
+ (JSC::WRECGenerator::generateBackreference):
+ (JSC::WRECGenerator::gernerateDisjunction):
+
+2008-09-09 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Maciej Stachowiak.
+
+ Clean up the WREC code some more.
+
+ * VM/CTI.cpp:
+ (JSC::CTI::compileRegExp):
+ * wrec/WREC.cpp:
+ (JSC::getCharacterClassNewline):
+ (JSC::getCharacterClassDigits):
+ (JSC::getCharacterClassSpaces):
+ (JSC::getCharacterClassWordchar):
+ (JSC::getCharacterClassNondigits):
+ (JSC::getCharacterClassNonspaces):
+ (JSC::getCharacterClassNonwordchar):
+ (JSC::WRECGenerator::generateBacktrack1):
+ (JSC::WRECGenerator::generateBacktrackBackreference):
+ (JSC::WRECGenerator::generateBackreferenceQuantifier):
+ (JSC::WRECGenerator::generateNonGreedyQuantifier):
+ (JSC::WRECGenerator::generateGreedyQuantifier):
+ (JSC::WRECGenerator::generatePatternCharacter):
+ (JSC::WRECGenerator::generateCharacterClassInvertedRange):
+ (JSC::WRECGenerator::generateCharacterClassInverted):
+ (JSC::WRECGenerator::generateCharacterClass):
+ (JSC::WRECGenerator::generateParentheses):
+ (JSC::WRECGenerator::gererateParenthesesResetTrampoline):
+ (JSC::WRECGenerator::generateAssertionBOL):
+ (JSC::WRECGenerator::generateAssertionEOL):
+ (JSC::WRECGenerator::generateAssertionWordBoundary):
+ (JSC::WRECGenerator::generateBackreference):
+ (JSC::WRECGenerator::gernerateDisjunction):
+ (JSC::WRECParser::parseCharacterClass):
+ (JSC::WRECParser::parseEscape):
+ (JSC::WRECParser::parseTerm):
+ * wrec/WREC.h:
+
+2008-09-09 Mark Rowe <mrowe@apple.com>
+
+ Build fix, rubber-stamped by Anders Carlsson.
+
+ Silence spurious build warnings about missing format attributes on functions in Assertions.cpp.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2008-09-09 Mark Rowe <mrowe@apple.com>
+
+ Rubber-stamped by Oliver Hunt.
+
+ Fix builds using the "debug" variant.
+
+ This reverts r36130 and tweaks Identifier to export the same symbols for Debug
+ and Release configurations.
+
+ * Configurations/JavaScriptCore.xcconfig:
+ * DerivedSources.make:
+ * JavaScriptCore.Debug.exp: Removed.
+ * JavaScriptCore.base.exp: Removed.
+ * JavaScriptCore.exp: Added.
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * kjs/identifier.cpp:
+ (JSC::Identifier::addSlowCase): #ifdef the call to checkSameIdentifierTable so that
+ there is no overhead in Release builds.
+ (JSC::Identifier::checkSameIdentifierTable): Add empty functions for Release builds.
+ * kjs/identifier.h:
+ (JSC::Identifier::add): #ifdef the calls to checkSameIdentifierTable so that there is
+ no overhead in Release builds, and remove the inline definitions of checkSameIdentifierTable.
+
+2008-09-09 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Maciej Stachowiak.
+
+ Clean up WREC a bit to bring it closer to our coding style guidelines.
+
+ * wrec/WREC.cpp:
+ (JSC::):
+ (JSC::getCharacterClass_newline):
+ (JSC::getCharacterClass_d):
+ (JSC::getCharacterClass_s):
+ (JSC::getCharacterClass_w):
+ (JSC::getCharacterClass_D):
+ (JSC::getCharacterClass_S):
+ (JSC::getCharacterClass_W):
+ (JSC::CharacterClassConstructor::append):
+ (JSC::WRECGenerator::generateNonGreedyQuantifier):
+ (JSC::WRECGenerator::generateGreedyQuantifier):
+ (JSC::WRECGenerator::generateCharacterClassInverted):
+ (JSC::WRECParser::parseQuantifier):
+ (JSC::WRECParser::parsePatternCharacterQualifier):
+ (JSC::WRECParser::parseCharacterClassQuantifier):
+ (JSC::WRECParser::parseBackreferenceQuantifier):
+ * wrec/WREC.h:
+ (JSC::Quantifier::):
+ (JSC::Quantifier::Quantifier):
+
+2008-09-09 Jungshik Shin <jungshik.shin@gmail.com>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Try MIME charset names before trying IANA names
+ ( https://bugs.webkit.org/show_bug.cgi?id=17537 )
+
+ * wtf/StringExtras.h: (strcasecmp): Added.
+
+2008-09-09 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Mark Rowe.
+
+ Bug 20719: REGRESSION (r36135-36244): Hangs, then crashes after several seconds
+ <https://bugs.webkit.org/show_bug.cgi?id=20719>
+ <rdar://problem/6205787>
+
+ Fix a typo in the case-insensitive matching of character patterns.
+
+ * wrec/WREC.cpp:
+ (JSC::WRECGenerator::generatePatternCharacter):
+
+2008-09-09 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ - allow polymorphic inline cache to handle Math object functions and possibly other similar things
+
+ 1.012x speedup on SunSpider.
+
+ * kjs/MathObject.cpp:
+ (JSC::MathObject::getOwnPropertySlot):
+ * kjs/lookup.cpp:
+ (JSC::setUpStaticFunctionSlot):
+ * kjs/lookup.h:
+ (JSC::getStaticPropertySlot):
+
+2008-09-08 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Maciej Stachowiak and Oliver Hunt.
+
+ Split storage of properties out of the PropertyMap and into the JSObject
+ to allow sharing PropertyMap on the StructureID. In order to get this
+ function correctly, the StructureID's transition mappings were changed to
+ transition based on property name and attribute pairs, instead of just
+ property name.
+
+ - Removes the single property optimization now that the PropertyMap is shared.
+ This will be replaced by in-lining some values on the JSObject.
+
+ This is a wash on Sunspider and a 6.7% win on the v8 test suite.
+
+ * JavaScriptCore.base.exp:
+ * VM/CTI.cpp:
+ (JSC::CTI::privateCompileGetByIdSelf): Get the storage directly off the JSObject.
+ (JSC::CTI::privateCompileGetByIdProto): Ditto.
+ (JSC::CTI::privateCompileGetByIdChain): Ditto.
+ (JSC::CTI::privateCompilePutByIdReplace): Ditto.
+ * kjs/JSObject.cpp:
+ (JSC::JSObject::mark): Mark the PropertyStorage.
+ (JSC::JSObject::put): Update to get the propertyMap of the StructureID.
+ (JSC::JSObject::deleteProperty): Ditto.
+ (JSC::JSObject::defineGetter): Return early if the property is already a getter/setter.
+ (JSC::JSObject::defineSetter): Ditto.
+ (JSC::JSObject::getPropertyAttributes): Update to get the propertyMap of the StructureID
+ (JSC::JSObject::getPropertyNames): Ditto.
+ (JSC::JSObject::removeDirect): Ditto.
+ * kjs/JSObject.h: Remove PropertyMap and add PropertyStorage.
+ (JSC::JSObject::propertyStorage): return the PropertyStorage.
+ (JSC::JSObject::getDirect): Update to get the propertyMap of the StructureID.
+ (JSC::JSObject::getDirectLocation): Ditto.
+ (JSC::JSObject::offsetForLocation): Compute location directly.
+ (JSC::JSObject::hasCustomProperties): Update to get the propertyMap of the StructureID.
+ (JSC::JSObject::hasGetterSetterProperties): Ditto.
+ (JSC::JSObject::getDirectOffset): Get by indexing into PropertyStorage.
+ (JSC::JSObject::putDirectOffset): Put by indexing into PropertyStorage.
+ (JSC::JSObject::getOwnPropertySlotForWrite): Update to get the propertyMap of the StructureID.
+ (JSC::JSObject::getOwnPropertySlot): Ditto.
+ (JSC::JSObject::putDirect): Move putting into the StructureID unless the property already exists.
+ * kjs/PropertyMap.cpp: Use the propertyStorage as the storage for the JSValues.
+ (JSC::PropertyMap::checkConsistency):
+ (JSC::PropertyMap::operator=):
+ (JSC::PropertyMap::~PropertyMap):
+ (JSC::PropertyMap::get):
+ (JSC::PropertyMap::getLocation):
+ (JSC::PropertyMap::put):
+ (JSC::PropertyMap::getOffset):
+ (JSC::PropertyMap::insert):
+ (JSC::PropertyMap::expand):
+ (JSC::PropertyMap::rehash):
+ (JSC::PropertyMap::createTable):
+ (JSC::PropertyMap::resizePropertyStorage): Resize the storage to match the size of the map
+ (JSC::PropertyMap::remove):
+ (JSC::PropertyMap::getEnumerablePropertyNames):
+ * kjs/PropertyMap.h:
+ (JSC::PropertyMapEntry::PropertyMapEntry):
+ (JSC::PropertyMap::isEmpty):
+ (JSC::PropertyMap::size):
+ (JSC::PropertyMap::makingCount):
+ (JSC::PropertyMap::PropertyMap):
+
+ * kjs/StructureID.cpp:
+ (JSC::StructureID::addPropertyTransition): Transitions now are based off the property name
+ and attributes.
+ (JSC::StructureID::toDictionaryTransition): Copy the map.
+ (JSC::StructureID::changePrototypeTransition): Copy the map.
+ (JSC::StructureID::getterSetterTransition): Copy the map.
+ (JSC::StructureID::~StructureID):
+ * kjs/StructureID.h:
+ (JSC::TransitionTableHash::hash): Custom hash for transition map.
+ (JSC::TransitionTableHash::equal): Ditto.
+ (JSC::TransitionTableHashTraits::emptyValue): Custom traits for transition map
+ (JSC::TransitionTableHashTraits::constructDeletedValue): Ditto.
+ (JSC::TransitionTableHashTraits::isDeletedValue): Ditto.
+ (JSC::StructureID::propertyMap): Added.
+
+2008-09-08 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Mark Rowe.
+
+ Bug 20694: Slow Script error pops up when running Dromaeo tests
+
+ Correct error in timeout logic where execution tick count would
+ be reset to incorrect value due to incorrect offset and indirection.
+ Codegen for the slow script dialog was factored out into a separate
+ method (emitSlowScriptCheck) rather than having multiple copies of
+ the same code. Also added calls to generate slow script checks
+ for loop_if_less and loop_if_true opcodes.
+
+ * VM/CTI.cpp:
+ (JSC::CTI::emitSlowScriptCheck):
+ (JSC::CTI::privateCompileMainPass):
+ (JSC::CTI::privateCompileSlowCases):
+ * VM/CTI.h:
+
+2008-09-08 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Maciej Stachowiak.
+
+ Remove references to the removed WRECompiler class.
+
+ * VM/Machine.h:
+ * wrec/WREC.h:
+
+2008-09-08 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Rubber-stamped by Mark Rowe.
+
+ Fix the build with CTI enabled but WREC disabled.
+
+ * VM/CTI.cpp:
+ * VM/CTI.h:
+
+2008-09-08 Dan Bernstein <mitz@apple.com>
+
+ - build fix
+
+ * kjs/nodes.h:
+ (JSC::StatementNode::):
+ (JSC::BlockNode::):
+
+2008-09-08 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Geoff.
+
+ <rdar://problem/6134407> Breakpoints in for loops, while loops or
+ conditions without curly braces don't break. (19306)
+ -Statement Lists already emit debug hooks but conditionals without
+ brackets are not lists.
+
+ * kjs/nodes.cpp:
+ (KJS::IfNode::emitCode):
+ (KJS::IfElseNode::emitCode):
+ (KJS::DoWhileNode::emitCode):
+ (KJS::WhileNode::emitCode):
+ (KJS::ForNode::emitCode):
+ (KJS::ForInNode::emitCode):
+ * kjs/nodes.h:
+ (KJS::StatementNode::):
+ (KJS::BlockNode::):
+
+2008-09-08 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Anders Carlsson.
+
+ - Cache the code generated for eval to speed up SunSpider and web sites
+ https://bugs.webkit.org/show_bug.cgi?id=20718
+
+ 1.052x on SunSpider
+ 2.29x on date-format-tofte
+
+ Lots of real sites seem to get many hits on this cache as well,
+ including GMail, Google Spreadsheets, Slate and Digg (the last of
+ these gets over 100 hits on initial page load).
+
+ * VM/CodeBlock.h:
+ (JSC::EvalCodeCache::get):
+ * VM/Machine.cpp:
+ (JSC::Machine::callEval):
+ (JSC::Machine::privateExecute):
+ (JSC::Machine::cti_op_call_eval):
+ * VM/Machine.h:
+
+2008-09-07 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 20711: Change KJS prefix on preprocessor macros to JSC
+ <https://bugs.webkit.org/show_bug.cgi?id=20711>
+
+ * kjs/CommonIdentifiers.cpp:
+ (JSC::CommonIdentifiers::CommonIdentifiers):
+ * kjs/CommonIdentifiers.h:
+ * kjs/PropertySlot.h:
+ (JSC::PropertySlot::getValue):
+ (JSC::PropertySlot::putValue):
+ (JSC::PropertySlot::setValueSlot):
+ (JSC::PropertySlot::setValue):
+ (JSC::PropertySlot::setRegisterSlot):
+ * kjs/lookup.h:
+ * kjs/nodes.cpp:
+ * kjs/nodes.h:
+ (JSC::Node::):
+ (JSC::ExpressionNode::):
+ (JSC::StatementNode::):
+ (JSC::NullNode::):
+ (JSC::BooleanNode::):
+ (JSC::NumberNode::):
+ (JSC::ImmediateNumberNode::):
+ (JSC::StringNode::):
+ (JSC::RegExpNode::):
+ (JSC::ThisNode::):
+ (JSC::ResolveNode::):
+ (JSC::ElementNode::):
+ (JSC::ArrayNode::):
+ (JSC::PropertyNode::):
+ (JSC::PropertyListNode::):
+ (JSC::ObjectLiteralNode::):
+ (JSC::BracketAccessorNode::):
+ (JSC::DotAccessorNode::):
+ (JSC::ArgumentListNode::):
+ (JSC::ArgumentsNode::):
+ (JSC::NewExprNode::):
+ (JSC::EvalFunctionCallNode::):
+ (JSC::FunctionCallValueNode::):
+ (JSC::FunctionCallResolveNode::):
+ (JSC::FunctionCallBracketNode::):
+ (JSC::FunctionCallDotNode::):
+ (JSC::PrePostResolveNode::):
+ (JSC::PostfixResolveNode::):
+ (JSC::PostfixBracketNode::):
+ (JSC::PostfixDotNode::):
+ (JSC::PostfixErrorNode::):
+ (JSC::DeleteResolveNode::):
+ (JSC::DeleteBracketNode::):
+ (JSC::DeleteDotNode::):
+ (JSC::DeleteValueNode::):
+ (JSC::VoidNode::):
+ (JSC::TypeOfResolveNode::):
+ (JSC::TypeOfValueNode::):
+ (JSC::PrefixResolveNode::):
+ (JSC::PrefixBracketNode::):
+ (JSC::PrefixDotNode::):
+ (JSC::PrefixErrorNode::):
+ (JSC::UnaryPlusNode::):
+ (JSC::NegateNode::):
+ (JSC::BitwiseNotNode::):
+ (JSC::LogicalNotNode::):
+ (JSC::MultNode::):
+ (JSC::DivNode::):
+ (JSC::ModNode::):
+ (JSC::AddNode::):
+ (JSC::SubNode::):
+ (JSC::LeftShiftNode::):
+ (JSC::RightShiftNode::):
+ (JSC::UnsignedRightShiftNode::):
+ (JSC::LessNode::):
+ (JSC::GreaterNode::):
+ (JSC::LessEqNode::):
+ (JSC::GreaterEqNode::):
+ (JSC::ThrowableBinaryOpNode::):
+ (JSC::InstanceOfNode::):
+ (JSC::InNode::):
+ (JSC::EqualNode::):
+ (JSC::NotEqualNode::):
+ (JSC::StrictEqualNode::):
+ (JSC::NotStrictEqualNode::):
+ (JSC::BitAndNode::):
+ (JSC::BitOrNode::):
+ (JSC::BitXOrNode::):
+ (JSC::LogicalOpNode::):
+ (JSC::ConditionalNode::):
+ (JSC::ReadModifyResolveNode::):
+ (JSC::AssignResolveNode::):
+ (JSC::ReadModifyBracketNode::):
+ (JSC::AssignBracketNode::):
+ (JSC::AssignDotNode::):
+ (JSC::ReadModifyDotNode::):
+ (JSC::AssignErrorNode::):
+ (JSC::CommaNode::):
+ (JSC::VarDeclCommaNode::):
+ (JSC::ConstDeclNode::):
+ (JSC::ConstStatementNode::):
+ (JSC::EmptyStatementNode::):
+ (JSC::DebuggerStatementNode::):
+ (JSC::ExprStatementNode::):
+ (JSC::VarStatementNode::):
+ (JSC::IfNode::):
+ (JSC::IfElseNode::):
+ (JSC::DoWhileNode::):
+ (JSC::WhileNode::):
+ (JSC::ForNode::):
+ (JSC::ContinueNode::):
+ (JSC::BreakNode::):
+ (JSC::ReturnNode::):
+ (JSC::WithNode::):
+ (JSC::LabelNode::):
+ (JSC::ThrowNode::):
+ (JSC::TryNode::):
+ (JSC::ParameterNode::):
+ (JSC::ScopeNode::):
+ (JSC::ProgramNode::):
+ (JSC::EvalNode::):
+ (JSC::FunctionBodyNode::):
+ (JSC::FuncExprNode::):
+ (JSC::FuncDeclNode::):
+ (JSC::CaseClauseNode::):
+ (JSC::ClauseListNode::):
+ (JSC::CaseBlockNode::):
+ (JSC::SwitchNode::):
+
+2008-09-07 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Maciej Stachowiak.
+
+ Bug 20704: Replace the KJS namespace
+ <https://bugs.webkit.org/show_bug.cgi?id=20704>
+
+ Rename the KJS namespace to JSC. There are still some uses of KJS in
+ preprocessor macros and comments, but these will also be changed some
+ time in the near future.
+
+ * API/APICast.h:
+ (toJS):
+ (toRef):
+ (toGlobalRef):
+ * API/JSBase.cpp:
+ * API/JSCallbackConstructor.cpp:
+ * API/JSCallbackConstructor.h:
+ * API/JSCallbackFunction.cpp:
+ * API/JSCallbackFunction.h:
+ * API/JSCallbackObject.cpp:
+ * API/JSCallbackObject.h:
+ * API/JSCallbackObjectFunctions.h:
+ * API/JSClassRef.cpp:
+ (OpaqueJSClass::staticValues):
+ (OpaqueJSClass::staticFunctions):
+ * API/JSClassRef.h:
+ * API/JSContextRef.cpp:
+ * API/JSObjectRef.cpp:
+ * API/JSProfilerPrivate.cpp:
+ * API/JSStringRef.cpp:
+ * API/JSValueRef.cpp:
+ (JSValueGetType):
+ * API/OpaqueJSString.cpp:
+ * API/OpaqueJSString.h:
+ * JavaScriptCore.Debug.exp:
+ * JavaScriptCore.base.exp:
+ * VM/CTI.cpp:
+ (JSC::):
+ * VM/CTI.h:
+ * VM/CodeBlock.cpp:
+ * VM/CodeBlock.h:
+ * VM/CodeGenerator.cpp:
+ * VM/CodeGenerator.h:
+ * VM/ExceptionHelpers.cpp:
+ * VM/ExceptionHelpers.h:
+ * VM/Instruction.h:
+ * VM/JSPropertyNameIterator.cpp:
+ * VM/JSPropertyNameIterator.h:
+ * VM/LabelID.h:
+ * VM/Machine.cpp:
+ * VM/Machine.h:
+ * VM/Opcode.cpp:
+ * VM/Opcode.h:
+ * VM/Register.h:
+ (WTF::):
+ * VM/RegisterFile.cpp:
+ * VM/RegisterFile.h:
+ * VM/RegisterID.h:
+ (WTF::):
+ * VM/SamplingTool.cpp:
+ * VM/SamplingTool.h:
+ * VM/SegmentedVector.h:
+ * kjs/ArgList.cpp:
+ * kjs/ArgList.h:
+ * kjs/Arguments.cpp:
+ * kjs/Arguments.h:
+ * kjs/ArrayConstructor.cpp:
+ * kjs/ArrayConstructor.h:
+ * kjs/ArrayPrototype.cpp:
+ * kjs/ArrayPrototype.h:
+ * kjs/BatchedTransitionOptimizer.h:
+ * kjs/BooleanConstructor.cpp:
+ * kjs/BooleanConstructor.h:
+ * kjs/BooleanObject.cpp:
+ * kjs/BooleanObject.h:
+ * kjs/BooleanPrototype.cpp:
+ * kjs/BooleanPrototype.h:
+ * kjs/CallData.cpp:
+ * kjs/CallData.h:
+ * kjs/ClassInfo.h:
+ * kjs/CommonIdentifiers.cpp:
+ * kjs/CommonIdentifiers.h:
+ * kjs/ConstructData.cpp:
+ * kjs/ConstructData.h:
+ * kjs/DateConstructor.cpp:
+ * kjs/DateConstructor.h:
+ * kjs/DateInstance.cpp:
+ (JSC::DateInstance::msToGregorianDateTime):
+ * kjs/DateInstance.h:
+ * kjs/DateMath.cpp:
+ * kjs/DateMath.h:
+ * kjs/DatePrototype.cpp:
+ * kjs/DatePrototype.h:
+ * kjs/DebuggerCallFrame.cpp:
+ * kjs/DebuggerCallFrame.h:
+ * kjs/Error.cpp:
+ * kjs/Error.h:
+ * kjs/ErrorConstructor.cpp:
+ * kjs/ErrorConstructor.h:
+ * kjs/ErrorInstance.cpp:
+ * kjs/ErrorInstance.h:
+ * kjs/ErrorPrototype.cpp:
+ * kjs/ErrorPrototype.h:
+ * kjs/ExecState.cpp:
+ * kjs/ExecState.h:
+ * kjs/FunctionConstructor.cpp:
+ * kjs/FunctionConstructor.h:
+ * kjs/FunctionPrototype.cpp:
+ * kjs/FunctionPrototype.h:
+ * kjs/GetterSetter.cpp:
+ * kjs/GetterSetter.h:
+ * kjs/GlobalEvalFunction.cpp:
+ * kjs/GlobalEvalFunction.h:
+ * kjs/IndexToNameMap.cpp:
+ * kjs/IndexToNameMap.h:
+ * kjs/InitializeThreading.cpp:
+ * kjs/InitializeThreading.h:
+ * kjs/InternalFunction.cpp:
+ * kjs/InternalFunction.h:
+ (JSC::InternalFunction::InternalFunction):
+ * kjs/JSActivation.cpp:
+ * kjs/JSActivation.h:
+ * kjs/JSArray.cpp:
+ * kjs/JSArray.h:
+ * kjs/JSCell.cpp:
+ * kjs/JSCell.h:
+ * kjs/JSFunction.cpp:
+ * kjs/JSFunction.h:
+ (JSC::JSFunction::JSFunction):
+ * kjs/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData):
+ * kjs/JSGlobalData.h:
+ * kjs/JSGlobalObject.cpp:
+ * kjs/JSGlobalObject.h:
+ * kjs/JSGlobalObjectFunctions.cpp:
+ * kjs/JSGlobalObjectFunctions.h:
+ * kjs/JSImmediate.cpp:
+ * kjs/JSImmediate.h:
+ * kjs/JSLock.cpp:
+ * kjs/JSLock.h:
+ * kjs/JSNotAnObject.cpp:
+ * kjs/JSNotAnObject.h:
+ * kjs/JSNumberCell.cpp:
+ * kjs/JSNumberCell.h:
+ * kjs/JSObject.cpp:
+ * kjs/JSObject.h:
+ * kjs/JSStaticScopeObject.cpp:
+ * kjs/JSStaticScopeObject.h:
+ * kjs/JSString.cpp:
+ * kjs/JSString.h:
+ * kjs/JSType.h:
+ * kjs/JSValue.cpp:
+ * kjs/JSValue.h:
+ * kjs/JSVariableObject.cpp:
+ * kjs/JSVariableObject.h:
+ * kjs/JSWrapperObject.cpp:
+ * kjs/JSWrapperObject.h:
+ * kjs/LabelStack.cpp:
+ * kjs/LabelStack.h:
+ * kjs/MathObject.cpp:
+ * kjs/MathObject.h:
+ * kjs/NativeErrorConstructor.cpp:
+ * kjs/NativeErrorConstructor.h:
+ * kjs/NativeErrorPrototype.cpp:
+ * kjs/NativeErrorPrototype.h:
+ * kjs/NodeInfo.h:
+ * kjs/NumberConstructor.cpp:
+ * kjs/NumberConstructor.h:
+ * kjs/NumberObject.cpp:
+ * kjs/NumberObject.h:
+ * kjs/NumberPrototype.cpp:
+ * kjs/NumberPrototype.h:
+ * kjs/ObjectConstructor.cpp:
+ * kjs/ObjectConstructor.h:
+ * kjs/ObjectPrototype.cpp:
+ * kjs/ObjectPrototype.h:
+ * kjs/Parser.cpp:
+ * kjs/Parser.h:
+ * kjs/PropertyMap.cpp:
+ (JSC::PropertyMapStatisticsExitLogger::~PropertyMapStatisticsExitLogger):
+ * kjs/PropertyMap.h:
+ * kjs/PropertyNameArray.cpp:
+ * kjs/PropertyNameArray.h:
+ * kjs/PropertySlot.cpp:
+ * kjs/PropertySlot.h:
+ * kjs/PrototypeFunction.cpp:
+ * kjs/PrototypeFunction.h:
+ * kjs/PutPropertySlot.h:
+ * kjs/RegExpConstructor.cpp:
+ * kjs/RegExpConstructor.h:
+ * kjs/RegExpObject.cpp:
+ * kjs/RegExpObject.h:
+ * kjs/RegExpPrototype.cpp:
+ * kjs/RegExpPrototype.h:
+ * kjs/ScopeChain.cpp:
+ * kjs/ScopeChain.h:
+ * kjs/ScopeChainMark.h:
+ * kjs/Shell.cpp:
+ (jscmain):
+ * kjs/SmallStrings.cpp:
+ * kjs/SmallStrings.h:
+ * kjs/SourceProvider.h:
+ * kjs/SourceRange.h:
+ * kjs/StringConstructor.cpp:
+ * kjs/StringConstructor.h:
+ * kjs/StringObject.cpp:
+ * kjs/StringObject.h:
+ * kjs/StringObjectThatMasqueradesAsUndefined.h:
+ * kjs/StringPrototype.cpp:
+ * kjs/StringPrototype.h:
+ * kjs/StructureID.cpp:
+ * kjs/StructureID.h:
+ * kjs/SymbolTable.h:
+ * kjs/collector.cpp:
+ * kjs/collector.h:
+ * kjs/completion.h:
+ * kjs/create_hash_table:
+ * kjs/debugger.cpp:
+ * kjs/debugger.h:
+ * kjs/dtoa.cpp:
+ * kjs/dtoa.h:
+ * kjs/grammar.y:
+ * kjs/identifier.cpp:
+ * kjs/identifier.h:
+ (JSC::Identifier::equal):
+ * kjs/interpreter.cpp:
+ * kjs/interpreter.h:
+ * kjs/lexer.cpp:
+ (JSC::Lexer::Lexer):
+ (JSC::Lexer::clear):
+ (JSC::Lexer::makeIdentifier):
+ * kjs/lexer.h:
+ * kjs/lookup.cpp:
+ * kjs/lookup.h:
+ * kjs/nodes.cpp:
+ * kjs/nodes.h:
+ * kjs/nodes2string.cpp:
+ * kjs/operations.cpp:
+ * kjs/operations.h:
+ * kjs/protect.h:
+ * kjs/regexp.cpp:
+ * kjs/regexp.h:
+ * kjs/ustring.cpp:
+ * kjs/ustring.h:
+ (JSC::operator!=):
+ (JSC::IdentifierRepHash::hash):
+ (WTF::):
+ * masm/MacroAssembler.h:
+ * masm/MacroAssemblerWin.cpp:
+ * masm/X86Assembler.h:
+ * pcre/pcre_exec.cpp:
+ * profiler/CallIdentifier.h:
+ (WTF::):
+ * profiler/HeavyProfile.cpp:
+ * profiler/HeavyProfile.h:
+ * profiler/Profile.cpp:
+ * profiler/Profile.h:
+ * profiler/ProfileGenerator.cpp:
+ * profiler/ProfileGenerator.h:
+ * profiler/ProfileNode.cpp:
+ * profiler/ProfileNode.h:
+ * profiler/Profiler.cpp:
+ * profiler/Profiler.h:
+ * profiler/TreeProfile.cpp:
+ * profiler/TreeProfile.h:
+ * wrec/WREC.cpp:
+ * wrec/WREC.h:
+ * wtf/AVLTree.h:
+
+2008-09-07 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Dan Bernstein.
+
+ - rename IA32MacroAssembler class to X86Assembler
+
+ We otherwise call the platform X86, and also, I don't see any macros.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * masm/IA32MacroAsm.h: Removed.
+ * masm/MacroAssembler.h:
+ (KJS::MacroAssembler::MacroAssembler):
+ * masm/MacroAssemblerWin.cpp:
+ (KJS::MacroAssembler::emitRestoreArgumentReference):
+ * masm/X86Assembler.h: Copied from masm/IA32MacroAsm.h.
+ (KJS::X86Assembler::X86Assembler):
+ * wrec/WREC.cpp:
+ (KJS::WRECGenerator::generateNonGreedyQuantifier):
+ (KJS::WRECGenerator::generateGreedyQuantifier):
+ (KJS::WRECGenerator::generateParentheses):
+ (KJS::WRECGenerator::generateBackreference):
+ (KJS::WRECGenerator::gernerateDisjunction):
+ * wrec/WREC.h:
+
+2008-09-07 Cameron Zwarich <cwzwarich@webkit.org>
+
+ Not reviewed.
+
+ Visual C++ seems to have some odd casting rules, so just convert the
+ offending cast back to a C-style cast for now.
+
+ * kjs/collector.cpp:
+ (KJS::otherThreadStackPointer):
+
+2008-09-07 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Mark Rowe.
+
+ Attempt to fix the Windows build by using a const_cast to cast regs.Esp
+ to a uintptr_t instead of a reinterpret_cast.
+
+ * kjs/collector.cpp:
+ (KJS::otherThreadStackPointer):
+
+2008-09-07 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Sam Weinig.
+
+ Remove C-style casts from kjs/collector.cpp.
+
+ * kjs/collector.cpp:
+ (KJS::Heap::heapAllocate):
+ (KJS::currentThreadStackBase):
+ (KJS::Heap::markConservatively):
+ (KJS::otherThreadStackPointer):
+ (KJS::Heap::markOtherThreadConservatively):
+ (KJS::Heap::sweep):
+
+2008-09-07 Mark Rowe <mrowe@apple.com>
+
+ Build fix for the debug variant.
+
+ * DerivedSources.make: Also use the .Debug.exp exports file when building the debug variant.
+
+2008-09-07 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Timothy Hatcher.
+
+ Remove C-style casts from the CTI code.
+
+ * VM/CTI.cpp:
+ (KJS::CTI::emitGetArg):
+ (KJS::CTI::emitGetPutArg):
+ (KJS::ctiRepatchCallByReturnAddress):
+ (KJS::CTI::compileOpCall):
+ (KJS::CTI::privateCompileMainPass):
+ (KJS::CTI::privateCompileGetByIdSelf):
+ (KJS::CTI::privateCompileGetByIdProto):
+ (KJS::CTI::privateCompileGetByIdChain):
+ (KJS::CTI::privateCompilePutByIdReplace):
+ (KJS::CTI::privateArrayLengthTrampoline):
+ (KJS::CTI::privateStringLengthTrampoline):
+
+=== End merge of squirrelfish-extreme ===
+
+2008-09-06 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig. Adapted somewhat by Maciej Stachowiak.
+
+ - refactor WREC to share more of the JIT infrastructure with CTI
+
+ * VM/CTI.cpp:
+ (KJS::CTI::emitGetArg):
+ (KJS::CTI::emitGetPutArg):
+ (KJS::CTI::emitPutArg):
+ (KJS::CTI::emitPutArgConstant):
+ (KJS::CTI::emitPutCTIParam):
+ (KJS::CTI::emitGetCTIParam):
+ (KJS::CTI::emitPutToCallFrameHeader):
+ (KJS::CTI::emitGetFromCallFrameHeader):
+ (KJS::CTI::emitPutResult):
+ (KJS::CTI::emitDebugExceptionCheck):
+ (KJS::CTI::emitJumpSlowCaseIfNotImm):
+ (KJS::CTI::emitJumpSlowCaseIfNotImms):
+ (KJS::CTI::emitFastArithDeTagImmediate):
+ (KJS::CTI::emitFastArithReTagImmediate):
+ (KJS::CTI::emitFastArithPotentiallyReTagImmediate):
+ (KJS::CTI::emitFastArithImmToInt):
+ (KJS::CTI::emitFastArithIntToImmOrSlowCase):
+ (KJS::CTI::emitFastArithIntToImmNoCheck):
+ (KJS::CTI::CTI):
+ (KJS::CTI::compileOpCall):
+ (KJS::CTI::privateCompileMainPass):
+ (KJS::CTI::privateCompileSlowCases):
+ (KJS::CTI::privateCompile):
+ (KJS::CTI::privateCompileGetByIdSelf):
+ (KJS::CTI::privateCompileGetByIdProto):
+ (KJS::CTI::privateCompileGetByIdChain):
+ (KJS::CTI::privateCompilePutByIdReplace):
+ (KJS::CTI::privateArrayLengthTrampoline):
+ (KJS::CTI::privateStringLengthTrampoline):
+ (KJS::CTI::compileRegExp):
+ * VM/CTI.h:
+ (KJS::CallRecord::CallRecord):
+ (KJS::JmpTable::JmpTable):
+ (KJS::SlowCaseEntry::SlowCaseEntry):
+ (KJS::CTI::JSRInfo::JSRInfo):
+ * kjs/regexp.cpp:
+ (KJS::RegExp::RegExp):
+ * wrec/WREC.cpp:
+ (KJS::GenerateParenthesesNonGreedyFunctor::GenerateParenthesesNonGreedyFunctor):
+ (KJS::GeneratePatternCharacterFunctor::generateAtom):
+ (KJS::GeneratePatternCharacterFunctor::backtrack):
+ (KJS::GenerateCharacterClassFunctor::generateAtom):
+ (KJS::GenerateCharacterClassFunctor::backtrack):
+ (KJS::GenerateBackreferenceFunctor::generateAtom):
+ (KJS::GenerateBackreferenceFunctor::backtrack):
+ (KJS::GenerateParenthesesNonGreedyFunctor::generateAtom):
+ (KJS::GenerateParenthesesNonGreedyFunctor::backtrack):
+ (KJS::WRECGenerate::generateBacktrack1):
+ (KJS::WRECGenerate::generateBacktrackBackreference):
+ (KJS::WRECGenerate::generateBackreferenceQuantifier):
+ (KJS::WRECGenerate::generateNonGreedyQuantifier):
+ (KJS::WRECGenerate::generateGreedyQuantifier):
+ (KJS::WRECGenerate::generatePatternCharacter):
+ (KJS::WRECGenerate::generateCharacterClassInvertedRange):
+ (KJS::WRECGenerate::generateCharacterClassInverted):
+ (KJS::WRECGenerate::generateCharacterClass):
+ (KJS::WRECGenerate::generateParentheses):
+ (KJS::WRECGenerate::generateParenthesesNonGreedy):
+ (KJS::WRECGenerate::gererateParenthesesResetTrampoline):
+ (KJS::WRECGenerate::generateAssertionBOL):
+ (KJS::WRECGenerate::generateAssertionEOL):
+ (KJS::WRECGenerate::generateAssertionWordBoundary):
+ (KJS::WRECGenerate::generateBackreference):
+ (KJS::WRECGenerate::gernerateDisjunction):
+ (KJS::WRECGenerate::terminateDisjunction):
+ (KJS::WRECParser::parseGreedyQuantifier):
+ (KJS::WRECParser::parseQuantifier):
+ (KJS::WRECParser::parsePatternCharacterQualifier):
+ (KJS::WRECParser::parseCharacterClassQuantifier):
+ (KJS::WRECParser::parseBackreferenceQuantifier):
+ (KJS::WRECParser::parseParentheses):
+ (KJS::WRECParser::parseCharacterClass):
+ (KJS::WRECParser::parseOctalEscape):
+ (KJS::WRECParser::parseEscape):
+ (KJS::WRECParser::parseTerm):
+ (KJS::WRECParser::parseDisjunction):
+ * wrec/WREC.h:
+ (KJS::WRECGenerate::WRECGenerate):
+ (KJS::WRECParser::):
+ (KJS::WRECParser::WRECParser):
+ (KJS::WRECParser::parseAlternative):
+ (KJS::WRECParser::isEndOfPattern):
+
+2008-09-06 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by NOBODY (Build fix).
+
+ Fix the sampler build.
+
+ * VM/SamplingTool.h:
+
+2008-09-06 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Jump through the necessary hoops required to make MSVC cooperate with SFX
+
+ We now explicitly declare the calling convention on all cti_op_* cfunctions,
+ and return int instead of bool where appropriate (despite the cdecl calling
+ convention seems to state MSVC generates code that returns the result value
+ through ecx). SFX behaves slightly differently under MSVC, specifically it
+ stores the base argument address for the cti_op_* functions in the first
+ argument, and then does the required stack manipulation through that pointer.
+ This is necessary as MSVC's optimisations assume they have complete control
+ of the stack, and periodically elide our stack manipulations, or move
+ values in unexpected ways. MSVC also frequently produces tail calls which may
+ clobber the first argument, so the MSVC path is slightly less efficient due
+ to the need to restore it.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * VM/CTI.cpp:
+ (KJS::):
+ (KJS::CTI::compileOpCall):
+ (KJS::CTI::privateCompileMainPass):
+ (KJS::CTI::privateCompileSlowCases):
+ * VM/CTI.h:
+ * VM/Machine.cpp:
+ * VM/Machine.h:
+ * masm/MacroAssembler.h:
+ (KJS::MacroAssembler::emitConvertToFastCall):
+ * masm/MacroAssemblerIA32GCC.cpp: Removed.
+ For performance reasons we need these no-op functions to be inlined.
+
+ * masm/MacroAssemblerWin.cpp:
+ (KJS::MacroAssembler::emitRestoreArgumentReference):
+ * wtf/Platform.h:
+
+2008-09-05 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak, or maybe the other way around.
+
+ Added the ability to coalesce JITCode buffer grow operations by first
+ growing the buffer and then executing unchecked puts to it.
+
+ About a 2% speedup on date-format-tofte.
+
+ * VM/CTI.cpp:
+ (KJS::CTI::compileOpCall):
+ * masm/IA32MacroAsm.h:
+ (KJS::JITCodeBuffer::ensureSpace):
+ (KJS::JITCodeBuffer::putByteUnchecked):
+ (KJS::JITCodeBuffer::putByte):
+ (KJS::JITCodeBuffer::putShortUnchecked):
+ (KJS::JITCodeBuffer::putShort):
+ (KJS::JITCodeBuffer::putIntUnchecked):
+ (KJS::JITCodeBuffer::putInt):
+ (KJS::IA32MacroAssembler::emitTestl_i32r):
+ (KJS::IA32MacroAssembler::emitMovl_mr):
+ (KJS::IA32MacroAssembler::emitMovl_rm):
+ (KJS::IA32MacroAssembler::emitMovl_i32m):
+ (KJS::IA32MacroAssembler::emitUnlinkedJe):
+ (KJS::IA32MacroAssembler::emitModRm_rr):
+ (KJS::IA32MacroAssembler::emitModRm_rr_Unchecked):
+ (KJS::IA32MacroAssembler::emitModRm_rm_Unchecked):
+ (KJS::IA32MacroAssembler::emitModRm_rm):
+ (KJS::IA32MacroAssembler::emitModRm_opr):
+ (KJS::IA32MacroAssembler::emitModRm_opr_Unchecked):
+ (KJS::IA32MacroAssembler::emitModRm_opm_Unchecked):
+
+2008-09-05 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Disable WREC and CTI on platforms that we have not yet had a chance to test with.
+
+ * wtf/Platform.h:
+
+2008-09-05 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Use jo instead of a mask compare when fetching array.length and
+ string.length. 4% speedup on array.length / string.length torture
+ test.
+
+ * VM/CTI.cpp:
+ (KJS::CTI::privateArrayLengthTrampoline):
+ (KJS::CTI::privateStringLengthTrampoline):
+
+2008-09-05 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Removed a CTI compilation pass by recording labels during bytecode
+ generation. This is more to reduce complexity than it is to improve
+ performance.
+
+ SunSpider reports no change.
+
+ CodeBlock now keeps a "labels" set, which holds the offsets of all the
+ instructions that can be jumped to.
+
+ * VM/CTI.cpp: Nixed a pass.
+
+ * VM/CodeBlock.h: Added a "labels" set.
+
+ * VM/LabelID.h: No need for a special LableID for holding jump
+ destinations, since the CodeBlock now knows all jump destinations.
+
+ * wtf/HashTraits.h: New hash traits to accomodate putting offset 0 in
+ the set.
+
+ * kjs/nodes.cpp:
+ (KJS::TryNode::emitCode): Emit a dummy label to record sret targets.
+
+2008-09-05 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Oliver Hunt and Gavin Barraclough.
+
+ Move the JITCodeBuffer onto Machine and remove the static variables.
+
+ * VM/CTI.cpp: Initialize m_jit with the Machine's code buffer.
+ * VM/Machine.cpp:
+ (KJS::Machine::Machine): Allocate a JITCodeBuffer.
+ * VM/Machine.h:
+ * kjs/RegExpConstructor.cpp:
+ (KJS::constructRegExp): Pass the ExecState through.
+ * kjs/RegExpPrototype.cpp:
+ (KJS::regExpProtoFuncCompile): Ditto.
+ * kjs/StringPrototype.cpp:
+ (KJS::stringProtoFuncMatch): Ditto.
+ (KJS::stringProtoFuncSearch): Ditto.
+ * kjs/nodes.cpp:
+ (KJS::RegExpNode::emitCode): Compile the pattern at code generation time
+ so that we have access to an ExecState.
+ * kjs/nodes.h:
+ (KJS::RegExpNode::):
+ * kjs/nodes2string.cpp:
+ * kjs/regexp.cpp:
+ (KJS::RegExp::RegExp): Pass the ExecState through.
+ (KJS::RegExp::create): Ditto.
+ * kjs/regexp.h:
+ * masm/IA32MacroAsm.h:
+ (KJS::IA32MacroAssembler::IA32MacroAssembler): Reset the JITCodeBuffer when we are
+ constructed.
+ * wrec/WREC.cpp:
+ (KJS::WRECompiler::compile): Retrieve the JITCodeBuffer from the Machine.
+ * wrec/WREC.h:
+
+2008-09-05 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Oliver Hunt and Gavin Barraclough.
+
+ Fix the build when CTI is disabled.
+
+ * VM/CodeBlock.cpp:
+ (KJS::CodeBlock::~CodeBlock):
+ * VM/CodeGenerator.cpp:
+ (KJS::prepareJumpTableForStringSwitch):
+ * VM/Machine.cpp:
+ (KJS::Machine::Machine):
+ (KJS::Machine::~Machine):
+
+2008-09-05 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Mark Rowe.
+
+ Fix some windows abi issues.
+
+ * VM/CTI.cpp:
+ (KJS::CTI::privateCompileMainPass):
+ (KJS::CTI::privateCompileSlowCases):
+ * VM/CTI.h:
+ (KJS::CallRecord::CallRecord):
+ (KJS::):
+ * VM/Machine.cpp:
+ (KJS::Machine::cti_op_resolve_func):
+ (KJS::Machine::cti_op_post_inc):
+ (KJS::Machine::cti_op_resolve_with_base):
+ (KJS::Machine::cti_op_post_dec):
+ * VM/Machine.h:
+
+2008-09-05 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Fix ecma/FunctionObjects/15.3.5.3.js after I broke it in r93.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::cti_op_call_NotJSFunction): Restore m_callFrame to the correct value after making the native call.
+ (KJS::Machine::cti_op_construct_NotJSConstruct): Ditto.
+
+2008-09-04 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Fix fast/dom/Window/console-functions.html.
+
+ The call frame on the ExecState was not being updated on calls into native functions. This meant that functions
+ such as console.log would use the line number of the last JS function on the call stack.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::cti_op_call_NotJSFunction): Update the ExecState's call frame before making a native function call,
+ and restore it when the function is done.
+ (KJS::Machine::cti_op_construct_NotJSConstruct): Ditto.
+
+2008-09-05 Oliver Hunt <oliver@apple.com>
+
+ Start bringing up SFX on windows.
+
+ Reviewed by Mark Rowe and Sam Weinig
+
+ Start doing the work to bring up SFX on windows. Initially
+ just working on WREC, as it does not make any calls so reduces
+ the amount of code that needs to be corrected.
+
+ Start abstracting the CTI JIT codegen engine.
+
+ * ChangeLog:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * VM/CTI.cpp:
+ * masm/IA32MacroAsm.h:
+ * masm/MacroAssembler.h: Added.
+ (KJS::MacroAssembler::MacroAssembler):
+ * masm/MacroAssemblerIA32GCC.cpp: Added.
+ (KJS::MacroAssembler::emitConvertToFastCall):
+ * masm/MacroAssemblerWin.cpp: Added.
+ (KJS::MacroAssembler::emitConvertToFastCall):
+ * wrec/WREC.cpp:
+ (KJS::WRECompiler::parseGreedyQuantifier):
+ (KJS::WRECompiler::parseCharacterClass):
+ (KJS::WRECompiler::parseEscape):
+ (KJS::WRECompiler::compilePattern):
+ * wrec/WREC.h:
+
+2008-09-04 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Support for slow scripts (timeout checking).
+
+ * VM/CTI.cpp:
+ (KJS::CTI::privateCompileMainPass):
+ (KJS::CTI::privateCompile):
+ * VM/Machine.cpp:
+ (KJS::slideRegisterWindowForCall):
+ (KJS::Machine::cti_timeout_check):
+ (KJS::Machine::cti_vm_throw):
+
+2008-09-04 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Mark Rowe.
+
+ Third round of style cleanup.
+
+ * VM/CTI.cpp:
+ * VM/CTI.h:
+ * VM/CodeBlock.h:
+ * VM/Machine.cpp:
+ * VM/Machine.h:
+ * kjs/ExecState.h:
+
+2008-09-04 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Jon Honeycutt.
+
+ Second round of style cleanup.
+
+ * VM/CTI.cpp:
+ * VM/CTI.h:
+ * wrec/WREC.h:
+
+2008-09-04 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Mark Rowe.
+
+ First round of style cleanup.
+
+ * VM/CTI.cpp:
+ * VM/CTI.h:
+ * masm/IA32MacroAsm.h:
+ * wrec/WREC.cpp:
+ * wrec/WREC.h:
+
+2008-09-04 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Mark Rowe.
+
+ Merged http://trac.webkit.org/changeset/36081 to work with CTI.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::tryCtiCacheGetByID):
+
+2008-09-04 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Enable profiling in CTI.
+
+ * VM/CTI.h:
+ (KJS::):
+ (KJS::CTI::execute):
+ * VM/Machine.cpp:
+ (KJS::Machine::cti_op_call_JSFunction):
+ (KJS::Machine::cti_op_call_NotJSFunction):
+ (KJS::Machine::cti_op_ret):
+ (KJS::Machine::cti_op_construct_JSConstruct):
+ (KJS::Machine::cti_op_construct_NotJSConstruct):
+
+2008-09-04 Victor Hernandez <vhernandez@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Fixed an #if to support using WREC without CTI.
+
+ * kjs/regexp.cpp:
+ (KJS::RegExp::match):
+
+2008-09-04 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ The array/string length trampolines are owned by the Machine, not the codeblock that compiled them.
+
+ * VM/CTI.cpp:
+ (KJS::CTI::privateArrayLengthTrampoline):
+ (KJS::CTI::privateStringLengthTrampoline):
+ * VM/Machine.cpp:
+ (KJS::Machine::~Machine):
+ * VM/Machine.h:
+
+2008-09-04 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Gavin Barraclough and Sam Weinig.
+
+ Fix a crash on launch of jsc when GuardMalloc is enabled.
+
+ * kjs/ScopeChain.h:
+ (KJS::ScopeChain::ScopeChain): Initialize m_node to 0 when we have no valid scope chain.
+ (KJS::ScopeChain::~ScopeChain): Null-check m_node before calling deref.
+
+2008-09-03 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough and Geoff Garen.
+
+ Fix inspector and fast array access so that it bounds
+ checks correctly.
+
+ * VM/CTI.cpp:
+ (KJS::CTI::privateCompile_pass2_Main):
+ * masm/IA32MacroAsm.h:
+ (KJS::IA32MacroAssembler::):
+ (KJS::IA32MacroAssembler::emitUnlinkedJb):
+ (KJS::IA32MacroAssembler::emitUnlinkedJbe):
+
+2008-09-03 Mark Rowe <mrowe@apple.com>
+
+ Move the assertion after the InitializeAndReturn block, as
+ that is used even when CTI is enabled.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+
+2008-09-03 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Replace calls to exit with ASSERT_WITH_MESSAGE or ASSERT_NOT_REACHED.
+
+ * VM/CTI.cpp:
+ (KJS::CTI::privateCompile_pass1_Scan):
+ (KJS::CTI::privateCompile_pass2_Main):
+ (KJS::CTI::privateCompile_pass4_SlowCases):
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+ (KJS::Machine::cti_vm_throw):
+
+2008-09-03 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Tweak JavaScriptCore to compile on non-x86 platforms. This is achieved
+ by wrapping more code with ENABLE(CTI), ENABLE(WREC), and PLATFORM(X86)
+ #if's.
+
+ * VM/CTI.cpp:
+ * VM/CTI.h:
+ * VM/CodeBlock.cpp:
+ (KJS::CodeBlock::printStructureIDs): Use %td as the format specifier for
+ printing a ptrdiff_t.
+ * VM/Machine.cpp:
+ * VM/Machine.h:
+ * kjs/regexp.cpp:
+ (KJS::RegExp::RegExp):
+ (KJS::RegExp::~RegExp):
+ (KJS::RegExp::match):
+ * kjs/regexp.h:
+ * masm/IA32MacroAsm.h:
+ * wrec/WREC.cpp:
+ * wrec/WREC.h:
+ * wtf/Platform.h: Only enable CTI and WREC on x86. Add an extra define to
+ track whether any MASM-using features are enabled.
+
+2008-09-03 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Copy Geoff's array/string length optimization for CTI.
+
+ * VM/CTI.cpp:
+ (KJS::CTI::privateArrayLengthTrampoline):
+ (KJS::CTI::privateStringLengthTrampoline):
+ * VM/CTI.h:
+ (KJS::CTI::compileArrayLengthTrampoline):
+ (KJS::CTI::compileStringLengthTrampoline):
+ * VM/Machine.cpp:
+ (KJS::Machine::Machine):
+ (KJS::Machine::getCtiArrayLengthTrampoline):
+ (KJS::Machine::getCtiStringLengthTrampoline):
+ (KJS::Machine::tryCtiCacheGetByID):
+ (KJS::Machine::cti_op_get_by_id_second):
+ * VM/Machine.h:
+ * kjs/JSString.h:
+ * kjs/ustring.h:
+
+2008-09-03 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Implement fast array accesses in CTI - 2-3% progression on sunspider.
+
+ * VM/CTI.cpp:
+ (KJS::CTI::emitFastArithIntToImmNoCheck):
+ (KJS::CTI::compileOpCall):
+ (KJS::CTI::privateCompile_pass2_Main):
+ (KJS::CTI::privateCompile_pass4_SlowCases):
+ * VM/CTI.h:
+ * kjs/JSArray.h:
+
+2008-09-02 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Enable fast property access support in CTI.
+
+ * VM/CTI.cpp:
+ (KJS::ctiSetReturnAddress):
+ (KJS::ctiRepatchCallByReturnAddress):
+ (KJS::CTI::privateCompile_pass2_Main):
+ (KJS::CTI::privateCompile):
+ (KJS::CTI::privateCompileGetByIdSelf):
+ (KJS::CTI::privateCompileGetByIdProto):
+ (KJS::CTI::privateCompileGetByIdChain):
+ (KJS::CTI::privateCompilePutByIdReplace):
+ * VM/CTI.h:
+ (KJS::CTI::compileGetByIdSelf):
+ (KJS::CTI::compileGetByIdProto):
+ (KJS::CTI::compileGetByIdChain):
+ (KJS::CTI::compilePutByIdReplace):
+ * VM/CodeBlock.cpp:
+ (KJS::CodeBlock::~CodeBlock):
+ * VM/CodeBlock.h:
+ * VM/Machine.cpp:
+ (KJS::doSetReturnAddressVmThrowTrampoline):
+ (KJS::Machine::tryCtiCachePutByID):
+ (KJS::Machine::tryCtiCacheGetByID):
+ (KJS::Machine::cti_op_put_by_id):
+ (KJS::Machine::cti_op_put_by_id_second):
+ (KJS::Machine::cti_op_put_by_id_generic):
+ (KJS::Machine::cti_op_put_by_id_fail):
+ (KJS::Machine::cti_op_get_by_id):
+ (KJS::Machine::cti_op_get_by_id_second):
+ (KJS::Machine::cti_op_get_by_id_generic):
+ (KJS::Machine::cti_op_get_by_id_fail):
+ (KJS::Machine::cti_op_throw):
+ (KJS::Machine::cti_vm_throw):
+ * VM/Machine.h:
+ * kjs/JSCell.h:
+ * kjs/JSObject.h:
+ * kjs/PropertyMap.h:
+ * kjs/StructureID.cpp:
+ (KJS::StructureIDChain::StructureIDChain):
+ * masm/IA32MacroAsm.h:
+ (KJS::IA32MacroAssembler::emitCmpl_i32m):
+ (KJS::IA32MacroAssembler::emitMovl_mr):
+ (KJS::IA32MacroAssembler::emitMovl_rm):
+
+2008-09-02 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Gavin Barraclough and Mark Rowe.
+
+ A backslash (\) at the of a RegEx should produce an error.
+ Fixes fast/regex/test1.html.
+
+ * wrec/WREC.cpp:
+ (KJS::WRECompiler::parseEscape):
+
+2008-09-02 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoff Garen.
+
+ Link jumps for the slow case of op_loop_if_less. Fixes acid3.
+
+ * VM/CTI.cpp:
+ (KJS::CTI::privateCompile_pass4_SlowCases):
+
+2008-09-01 Sam Weinig <sam@webkit.org>
+
+ Rubber-stamped by Maciej Stachowiak.
+
+ Switch WREC on by default.
+
+ * wtf/Platform.h:
+
+2008-09-01 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Mark Rowe.
+
+ Fix two failures in fast/regex/test1.html
+ - \- in a character class should be treated as a literal -
+ - A missing max quantifier needs to be treated differently than
+ a null max quantifier.
+
+ * wrec/WREC.cpp:
+ (KJS::WRECompiler::generateNonGreedyQuantifier):
+ (KJS::WRECompiler::generateGreedyQuantifier):
+ (KJS::WRECompiler::parseCharacterClass):
+ * wrec/WREC.h:
+ (KJS::Quantifier::Quantifier):
+
+2008-09-01 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Mark Rowe.
+
+ Fix crash in fast/js/kde/evil-n.html
+
+ * kjs/regexp.cpp: Always pass a non-null offset vector to the wrec function.
+
+2008-09-01 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Gavin Barraclough and Mark Rowe.
+
+ Add pattern length limit fixing one test in fast/js.
+
+ * wrec/WREC.cpp:
+ (KJS::WRECompiler::compile):
+ * wrec/WREC.h:
+ (KJS::WRECompiler::):
+
+2008-09-01 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Gavin Barraclough and Mark Rowe.
+
+ Make octal escape parsing/back-reference parsing more closely match
+ prior behavior fixing one test in fast/js.
+
+ * wrec/WREC.cpp:
+ (KJS::WRECompiler::parseCharacterClass): 8 and 9 should be IdentityEscaped
+ (KJS::WRECompiler::parseEscape):
+ * wrec/WREC.h:
+ (KJS::WRECompiler::peekDigit):
+
+2008-09-01 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Gavin Barraclough and Mark Rowe.
+
+ Fix one mozilla test.
+
+ * wrec/WREC.cpp:
+ (KJS::WRECompiler::generateCharacterClassInverted): Fix incorrect not
+ ascii upper check.
+
+2008-09-01 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Gavin Barraclough and Mark Rowe.
+
+ Parse octal escapes in character classes fixing one mozilla test.
+
+ * wrec/WREC.cpp:
+ (KJS::WRECompiler::parseCharacterClass):
+ (KJS::WRECompiler::parseOctalEscape):
+ * wrec/WREC.h:
+ (KJS::WRECompiler::consumeOctal):
+
+2008-09-01 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Oliver Hunt.
+
+ Fixes two mozilla tests with WREC enabled.
+
+ * wrec/WREC.cpp:
+ (KJS::CharacterClassConstructor::append): Keep the character class sorted
+ when appending another character class.
+
+2008-09-01 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Gavin Barraclough and Mark Rowe.
+
+ Fixes two mozilla tests with WREC enabled.
+
+ * wrec/WREC.cpp:
+ (KJS::CharacterClassConstructor::addSortedRange): Insert the range at the correct position
+ instead of appending it to the end.
+
+2008-09-01 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Move cross-compilation unit call into NEVER_INLINE function.
+
+ * VM/Machine.cpp:
+ (KJS::doSetReturnAddressVmThrowTrampoline):
+
+2008-09-01 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Gavin Barraclough and Geoff Garen.
+
+ Fix one test in fast/js.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::cti_op_construct_NotJSConstruct): Throw a createNotAConstructorError,
+ instead of a createNotAFunctionError.
+
+2008-08-31 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Zero-cost exception handling. This patch takes the exception checking
+ back of the hot path. When an exception occurs in a Machine::cti*
+ method, the return address to JIT code is recorded, and is then
+ overwritten with a pointer to a trampoline routine. When the method
+ returns the trampoline will cause the cti_vm_throw method to be invoked.
+
+ cti_vm_throw uses the return address preserved above, to discover the
+ vPC of the bytecode that raised the exception (using a map build during
+ translation). From the VPC of the faulting bytecode the vPC of a catch
+ routine may be discovered (unwinding the stack where necesary), and then
+ a bytecode address for the catch routine is looked up. Final cti_vm_throw
+ overwrites its return address to JIT code again, to trampoline directly
+ to the catch routine.
+
+ cti_op_throw is handled in a similar fashion.
+
+ * VM/CTI.cpp:
+ (KJS::CTI::emitPutCTIParam):
+ (KJS::CTI::emitPutToCallFrameHeader):
+ (KJS::CTI::emitGetFromCallFrameHeader):
+ (KJS::ctiSetReturnAddressForArgs):
+ (KJS::CTI::emitDebugExceptionCheck):
+ (KJS::CTI::printOpcodeOperandTypes):
+ (KJS::CTI::emitCall):
+ (KJS::CTI::compileOpCall):
+ (KJS::CTI::privateCompile_pass2_Main):
+ (KJS::CTI::privateCompile):
+ * VM/CTI.h:
+ (KJS::CallRecord::CallRecord):
+ (KJS::):
+ (KJS::CTI::execute):
+ * VM/CodeBlock.h:
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+ (KJS::Machine::cti_op_instanceof):
+ (KJS::Machine::cti_op_call_NotJSFunction):
+ (KJS::Machine::cti_op_resolve):
+ (KJS::Machine::cti_op_resolve_func):
+ (KJS::Machine::cti_op_resolve_skip):
+ (KJS::Machine::cti_op_resolve_with_base):
+ (KJS::Machine::cti_op_throw):
+ (KJS::Machine::cti_op_in):
+ (KJS::Machine::cti_vm_throw):
+ * VM/RegisterFile.h:
+ (KJS::RegisterFile::):
+ * kjs/ExecState.h:
+ (KJS::ExecState::setCtiReturnAddress):
+ (KJS::ExecState::ctiReturnAddress):
+ * masm/IA32MacroAsm.h:
+ (KJS::IA32MacroAssembler::):
+ (KJS::IA32MacroAssembler::emitPushl_m):
+ (KJS::IA32MacroAssembler::emitPopl_m):
+ (KJS::IA32MacroAssembler::getRelocatedAddress):
+
+2008-08-31 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Fall back to PCRE for any regexp containing parentheses until we correctly backtrack within them.
+
+ * wrec/WREC.cpp:
+ (KJS::WRECompiler::parseParentheses):
+ * wrec/WREC.h:
+ (KJS::WRECompiler::):
+
+2008-08-31 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Fix several issues within ecma_3/RegExp/perlstress-001.js with WREC enabled.
+
+ * wrec/WREC.cpp:
+ (KJS::WRECompiler::generateNonGreedyQuantifier): Compare with the maximum quantifier count rather than the minimum.
+ (KJS::WRECompiler::generateAssertionEOL): Do a register-to-register comparison rather than immediate-to-register.
+ (KJS::WRECompiler::parseCharacterClass): Pass through the correct inversion flag.
+
+2008-08-30 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Re-fix the six remaining failures in the Mozilla JavaScript tests in a manner that does not kill performance.
+ This shows up as a 0.6% progression on SunSpider on my machine.
+
+ Grow the JITCodeBuffer's underlying buffer when we run out of space rather than just bailing out.
+
+ * VM/CodeBlock.h:
+ (KJS::CodeBlock::~CodeBlock): Switch to using fastFree now that JITCodeBuffer::copy uses fastMalloc.
+ * kjs/regexp.cpp: Ditto.
+ * masm/IA32MacroAsm.h:
+ (KJS::JITCodeBuffer::growBuffer):
+ (KJS::JITCodeBuffer::JITCodeBuffer):
+ (KJS::JITCodeBuffer::~JITCodeBuffer):
+ (KJS::JITCodeBuffer::putByte):
+ (KJS::JITCodeBuffer::putShort):
+ (KJS::JITCodeBuffer::putInt):
+ (KJS::JITCodeBuffer::reset):
+ (KJS::JITCodeBuffer::copy):
+
+2008-08-29 Oliver Hunt <oliver@apple.com>
+
+ RS=Maciej
+
+ Roll out previous patch as it causes a 5% performance regression
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * VM/CTI.cpp:
+ (KJS::getJCB):
+ (KJS::CTI::privateCompile):
+ * VM/CodeBlock.h:
+ (KJS::CodeBlock::~CodeBlock):
+ * masm/IA32MacroAsm.h:
+ (KJS::JITCodeBuffer::JITCodeBuffer):
+ (KJS::JITCodeBuffer::putByte):
+ (KJS::JITCodeBuffer::putShort):
+ (KJS::JITCodeBuffer::putInt):
+ (KJS::JITCodeBuffer::getEIP):
+ (KJS::JITCodeBuffer::start):
+ (KJS::JITCodeBuffer::getOffset):
+ (KJS::JITCodeBuffer::reset):
+ (KJS::JITCodeBuffer::copy):
+ (KJS::IA32MacroAssembler::emitModRm_rr):
+ (KJS::IA32MacroAssembler::emitModRm_rm):
+ (KJS::IA32MacroAssembler::emitModRm_rmsib):
+ (KJS::IA32MacroAssembler::IA32MacroAssembler):
+ (KJS::IA32MacroAssembler::emitInt3):
+ (KJS::IA32MacroAssembler::emitPushl_r):
+ (KJS::IA32MacroAssembler::emitPopl_r):
+ (KJS::IA32MacroAssembler::emitMovl_rr):
+ (KJS::IA32MacroAssembler::emitAddl_rr):
+ (KJS::IA32MacroAssembler::emitAddl_i8r):
+ (KJS::IA32MacroAssembler::emitAddl_i32r):
+ (KJS::IA32MacroAssembler::emitAddl_mr):
+ (KJS::IA32MacroAssembler::emitAndl_rr):
+ (KJS::IA32MacroAssembler::emitAndl_i32r):
+ (KJS::IA32MacroAssembler::emitCmpl_i8r):
+ (KJS::IA32MacroAssembler::emitCmpl_rr):
+ (KJS::IA32MacroAssembler::emitCmpl_rm):
+ (KJS::IA32MacroAssembler::emitCmpl_i32r):
+ (KJS::IA32MacroAssembler::emitCmpl_i32m):
+ (KJS::IA32MacroAssembler::emitCmpw_rm):
+ (KJS::IA32MacroAssembler::emitOrl_rr):
+ (KJS::IA32MacroAssembler::emitOrl_i8r):
+ (KJS::IA32MacroAssembler::emitSubl_rr):
+ (KJS::IA32MacroAssembler::emitSubl_i8r):
+ (KJS::IA32MacroAssembler::emitSubl_i32r):
+ (KJS::IA32MacroAssembler::emitSubl_mr):
+ (KJS::IA32MacroAssembler::emitTestl_i32r):
+ (KJS::IA32MacroAssembler::emitTestl_rr):
+ (KJS::IA32MacroAssembler::emitXorl_i8r):
+ (KJS::IA32MacroAssembler::emitXorl_rr):
+ (KJS::IA32MacroAssembler::emitSarl_i8r):
+ (KJS::IA32MacroAssembler::emitSarl_CLr):
+ (KJS::IA32MacroAssembler::emitShl_i8r):
+ (KJS::IA32MacroAssembler::emitShll_CLr):
+ (KJS::IA32MacroAssembler::emitMull_rr):
+ (KJS::IA32MacroAssembler::emitIdivl_r):
+ (KJS::IA32MacroAssembler::emitCdq):
+ (KJS::IA32MacroAssembler::emitMovl_mr):
+ (KJS::IA32MacroAssembler::emitMovzwl_mr):
+ (KJS::IA32MacroAssembler::emitMovl_rm):
+ (KJS::IA32MacroAssembler::emitMovl_i32r):
+ (KJS::IA32MacroAssembler::emitMovl_i32m):
+ (KJS::IA32MacroAssembler::emitLeal_mr):
+ (KJS::IA32MacroAssembler::emitRet):
+ (KJS::IA32MacroAssembler::emitJmpN_r):
+ (KJS::IA32MacroAssembler::emitJmpN_m):
+ (KJS::IA32MacroAssembler::emitCall):
+ (KJS::IA32MacroAssembler::label):
+ (KJS::IA32MacroAssembler::emitUnlinkedJmp):
+ (KJS::IA32MacroAssembler::emitUnlinkedJne):
+ (KJS::IA32MacroAssembler::emitUnlinkedJe):
+ (KJS::IA32MacroAssembler::emitUnlinkedJl):
+ (KJS::IA32MacroAssembler::emitUnlinkedJle):
+ (KJS::IA32MacroAssembler::emitUnlinkedJge):
+ (KJS::IA32MacroAssembler::emitUnlinkedJae):
+ (KJS::IA32MacroAssembler::emitUnlinkedJo):
+ (KJS::IA32MacroAssembler::link):
+ * wrec/WREC.cpp:
+ (KJS::WRECompiler::compilePattern):
+ (KJS::WRECompiler::compile):
+ * wrec/WREC.h:
+
+2008-08-29 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Have JITCodeBuffer manage a Vector containing the generated code so that it can grow
+ as needed when generating code for a large function. This fixes all six remaining failures
+ in Mozilla tests in both debug and release builds.
+
+ * VM/CTI.cpp:
+ (KJS::CTI::privateCompile):
+ * VM/CodeBlock.h:
+ (KJS::CodeBlock::~CodeBlock):
+ * masm/IA32MacroAsm.h:
+ (KJS::JITCodeBuffer::putByte):
+ (KJS::JITCodeBuffer::putShort):
+ (KJS::JITCodeBuffer::putInt):
+ (KJS::JITCodeBuffer::getEIP):
+ (KJS::JITCodeBuffer::start):
+ (KJS::JITCodeBuffer::getOffset):
+ (KJS::JITCodeBuffer::getCode):
+ (KJS::IA32MacroAssembler::emitModRm_rr):
+ * wrec/WREC.cpp:
+ (KJS::WRECompiler::compilePattern):
+ * wrec/WREC.h:
+
+2008-08-29 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Implement parsing of octal escapes in regular expressions. This fixes three Mozilla tests.
+
+ * wrec/WREC.cpp:
+ (KJS::WRECompiler::parseOctalEscape):
+ (KJS::WRECompiler::parseEscape): Parse the escape sequence as an octal escape if it has a leading zero.
+ Add a FIXME about treating invalid backreferences as octal escapes in the future.
+ * wrec/WREC.h:
+ (KJS::WRECompiler::consumeNumber): Multiply by 10 rather than 0 so that we handle numbers with more than
+ one digit.
+ * wtf/ASCIICType.h:
+ (WTF::isASCIIOctalDigit):
+
+2008-08-29 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Mark Rowe.
+
+ Pass vPC to instanceof method. Fixes 2 mozilla tests in debug.
+
+ * VM/CTI.cpp:
+ (KJS::CTI::privateCompile_pass2_Main):
+ * VM/Machine.cpp:
+ (KJS::Machine::cti_op_instanceof):
+
+2008-08-29 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Mark Rowe.
+
+ Pass vPCs to resolve methods for correct exception creation. Fixes
+ 17 mozilla tests in debug.
+
+ * VM/CTI.cpp:
+ (KJS::CTI::privateCompile_pass2_Main):
+ * VM/CTI.h:
+ * VM/Machine.cpp:
+ (KJS::Machine::cti_op_resolve):
+ (KJS::Machine::cti_op_resolve_func):
+ (KJS::Machine::cti_op_resolve_skip):
+ (KJS::Machine::cti_op_resolve_with_base):
+
+2008-08-29 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Remembering to actually throw the exception passed to op throw helps.
+ Regressions 19 -> 6.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::cti_op_throw):
+ (KJS::Machine::cti_vm_throw):
+
+2008-08-29 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Support for exception unwinding the stack.
+
+ Once upon a time, Sam asked me for a bettr ChangeLog entry. The return address
+ is now preserved on entry to a JIT code function (if we preserve lazily we need
+ restore the native return address during exception stack unwind). This takes
+ the number of regressions down from ~150 to 19.
+
+ * VM/CTI.cpp:
+ (KJS::getJCB):
+ (KJS::CTI::emitExceptionCheck):
+ (KJS::CTI::compileOpCall):
+ (KJS::CTI::privateCompile_pass2_Main):
+ (KJS::CTI::privateCompile):
+ * VM/CTI.h:
+ (KJS::):
+ * VM/Machine.cpp:
+ (KJS::Machine::throwException):
+ (KJS::Machine::cti_op_call_JSFunction):
+ (KJS::Machine::cti_op_call_NotJSFunction):
+ (KJS::Machine::cti_op_construct_JSConstruct):
+ (KJS::Machine::cti_op_construct_NotJSConstruct):
+ (KJS::Machine::cti_op_throw):
+ (KJS::Machine::cti_vm_throw):
+
+2008-08-29 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Fix js1_2/regexp/word_boundary.js and four other Mozilla tests with WREC enabled.
+
+ * wrec/WREC.cpp:
+ (KJS::WRECompiler::generateCharacterClassInvertedRange): If none of the exact matches
+ succeeded, jump to failure.
+ (KJS::WRECompiler::compilePattern): Restore and increment the current position stored
+ on the stack to ensure that it will be reset to the correct position after a failed
+ match has consumed input.
+
+2008-08-29 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Fix a hang in ecma_3/RegExp/15.10.2-1.js with WREC enabled.
+ A backreference with a quantifier would get stuck in an infinite
+ loop if the captured range was empty.
+
+ * wrec/WREC.cpp:
+ (KJS::WRECompiler::generateBackreferenceQuantifier): If the captured range
+ was empty, do not attempt to match the backreference.
+ (KJS::WRECompiler::parseBackreferenceQuantifier):
+ * wrec/WREC.h:
+ (KJS::Quantifier::):
+
+2008-08-28 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Oliver Hunt.
+
+ Implement op_debug.
+
+ * VM/CTI.cpp:
+ (KJS::CTI::privateCompile_pass1_Scan):
+ (KJS::CTI::privateCompile_pass2_Main):
+ * VM/Machine.cpp:
+ (KJS::Machine::debug):
+ (KJS::Machine::privateExecute):
+ (KJS::Machine::cti_op_debug):
+ * VM/Machine.h:
+
+2008-08-28 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Gavin Barraclough and Geoff Garen.
+
+ Implement op_switch_string fixing 1 mozilla test and one test in fast/js.
+
+ * VM/CTI.cpp:
+ (KJS::CTI::privateCompile_pass1_Scan):
+ (KJS::CTI::privateCompile_pass2_Main):
+ (KJS::CTI::privateCompile):
+ * VM/CTI.h:
+ (KJS::SwitchRecord::):
+ (KJS::SwitchRecord::SwitchRecord):
+ * VM/CodeBlock.cpp:
+ (KJS::CodeBlock::dump):
+ * VM/CodeBlock.h:
+ (KJS::ExpressionRangeInfo::):
+ (KJS::StringJumpTable::offsetForValue):
+ (KJS::StringJumpTable::ctiForValue):
+ (KJS::SimpleJumpTable::add):
+ (KJS::SimpleJumpTable::ctiForValue):
+ * VM/CodeGenerator.cpp:
+ (KJS::prepareJumpTableForStringSwitch):
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+ (KJS::Machine::cti_op_switch_string):
+ * VM/Machine.h:
+
+2008-08-28 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Do not recurse on the machine stack when executing op_call.
+
+ * VM/CTI.cpp:
+ (KJS::CTI::emitGetPutArg):
+ (KJS::CTI::emitPutArg):
+ (KJS::CTI::emitPutArgConstant):
+ (KJS::CTI::compileOpCall):
+ (KJS::CTI::privateCompile_pass2_Main):
+ (KJS::CTI::privateCompile):
+ * VM/CTI.h:
+ (KJS::):
+ (KJS::CTI::compile):
+ (KJS::CTI::execute):
+ (KJS::CTI::):
+ * VM/Machine.cpp:
+ (KJS::Machine::Machine):
+ (KJS::Machine::execute):
+ (KJS::Machine::cti_op_call_JSFunction):
+ (KJS::Machine::cti_op_call_NotJSFunction):
+ (KJS::Machine::cti_op_ret):
+ (KJS::Machine::cti_op_construct_JSConstruct):
+ (KJS::Machine::cti_op_construct_NotJSConstruct):
+ (KJS::Machine::cti_op_call_eval):
+ * VM/Machine.h:
+ * VM/Register.h:
+ (KJS::Register::Register):
+ * VM/RegisterFile.h:
+ (KJS::RegisterFile::):
+ * kjs/InternalFunction.h:
+ (KJS::InternalFunction::InternalFunction):
+ * kjs/JSFunction.h:
+ (KJS::JSFunction::JSFunction):
+ * kjs/ScopeChain.h:
+ (KJS::ScopeChain::ScopeChain):
+ * masm/IA32MacroAsm.h:
+ (KJS::IA32MacroAssembler::):
+ (KJS::IA32MacroAssembler::emitModRm_opm):
+ (KJS::IA32MacroAssembler::emitCmpl_i32m):
+ (KJS::IA32MacroAssembler::emitCallN_r):
+
+2008-08-28 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Mark Rowe.
+
+ Exit instead of crashing in ctiUnsupported and ctiTimedOut.
+
+ * VM/Machine.cpp:
+ (KJS::ctiUnsupported):
+ (KJS::ctiTimedOut):
+
+2008-08-28 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Implement codegen for op_jsr and op_sret.
+
+ * VM/CTI.cpp:
+ (KJS::CTI::privateCompile_pass1_Scan):
+ (KJS::CTI::privateCompile_pass2_Main):
+ (KJS::CTI::privateCompile):
+ * VM/CTI.h:
+ (KJS::CTI::JSRInfo::JSRInfo):
+ * masm/IA32MacroAsm.h:
+ (KJS::IA32MacroAssembler::emitJmpN_m):
+ (KJS::IA32MacroAssembler::linkAbsoluteAddress):
+
+2008-08-28 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Initial support for exceptions (throw / catch must occur in same CodeBlock).
+
+ * VM/CTI.cpp:
+ (KJS::CTI::emitExceptionCheck):
+ (KJS::CTI::emitCall):
+ (KJS::CTI::privateCompile_pass2_Main):
+ (KJS::CTI::privateCompile_pass4_SlowCases):
+ (KJS::CTI::privateCompile):
+ * VM/CTI.h:
+ * VM/CodeBlock.cpp:
+ (KJS::CodeBlock::nativeExceptionCodeForHandlerVPC):
+ * VM/CodeBlock.h:
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::emitCatch):
+ * VM/Machine.cpp:
+ (KJS::Machine::throwException):
+ (KJS::Machine::privateExecute):
+ (KJS::ctiUnsupported):
+ (KJS::ctiTimedOut):
+ (KJS::Machine::cti_op_add):
+ (KJS::Machine::cti_op_pre_inc):
+ (KJS::Machine::cti_timeout_check):
+ (KJS::Machine::cti_op_loop_if_less):
+ (KJS::Machine::cti_op_put_by_id):
+ (KJS::Machine::cti_op_get_by_id):
+ (KJS::Machine::cti_op_instanceof):
+ (KJS::Machine::cti_op_del_by_id):
+ (KJS::Machine::cti_op_mul):
+ (KJS::Machine::cti_op_call):
+ (KJS::Machine::cti_op_resolve):
+ (KJS::Machine::cti_op_construct):
+ (KJS::Machine::cti_op_get_by_val):
+ (KJS::Machine::cti_op_resolve_func):
+ (KJS::Machine::cti_op_sub):
+ (KJS::Machine::cti_op_put_by_val):
+ (KJS::Machine::cti_op_lesseq):
+ (KJS::Machine::cti_op_loop_if_true):
+ (KJS::Machine::cti_op_negate):
+ (KJS::Machine::cti_op_resolve_skip):
+ (KJS::Machine::cti_op_div):
+ (KJS::Machine::cti_op_pre_dec):
+ (KJS::Machine::cti_op_jless):
+ (KJS::Machine::cti_op_not):
+ (KJS::Machine::cti_op_jtrue):
+ (KJS::Machine::cti_op_post_inc):
+ (KJS::Machine::cti_op_eq):
+ (KJS::Machine::cti_op_lshift):
+ (KJS::Machine::cti_op_bitand):
+ (KJS::Machine::cti_op_rshift):
+ (KJS::Machine::cti_op_bitnot):
+ (KJS::Machine::cti_op_resolve_with_base):
+ (KJS::Machine::cti_op_mod):
+ (KJS::Machine::cti_op_less):
+ (KJS::Machine::cti_op_neq):
+ (KJS::Machine::cti_op_post_dec):
+ (KJS::Machine::cti_op_urshift):
+ (KJS::Machine::cti_op_bitxor):
+ (KJS::Machine::cti_op_bitor):
+ (KJS::Machine::cti_op_call_eval):
+ (KJS::Machine::cti_op_throw):
+ (KJS::Machine::cti_op_push_scope):
+ (KJS::Machine::cti_op_stricteq):
+ (KJS::Machine::cti_op_nstricteq):
+ (KJS::Machine::cti_op_to_jsnumber):
+ (KJS::Machine::cti_op_in):
+ (KJS::Machine::cti_op_del_by_val):
+ (KJS::Machine::cti_vm_throw):
+ * VM/Machine.h:
+ * kjs/ExecState.h:
+ * masm/IA32MacroAsm.h:
+ (KJS::IA32MacroAssembler::emitCmpl_i32m):
+
+2008-08-28 Mark Rowe <mrowe@apple.com>
+
+ Rubber-stamped by Oliver Hunt.
+
+ Print debugging info to stderr so that run-webkit-tests can capture it.
+ This makes it easy to check whether test failures are due to unimplemented
+ op codes, missing support for exceptions, etc.
+
+ * VM/CTI.cpp:
+ (KJS::CTI::privateCompile_pass1_Scan):
+ (KJS::CTI::printOpcodeOperandTypes):
+ (KJS::CTI::privateCompile_pass2_Main):
+ (KJS::CTI::privateCompile_pass4_SlowCases):
+ (KJS::CTI::privateCompile):
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+ (KJS::ctiException):
+ (KJS::ctiUnsupported):
+ (KJS::Machine::cti_op_call):
+ (KJS::Machine::cti_op_resolve):
+ (KJS::Machine::cti_op_construct):
+ (KJS::Machine::cti_op_get_by_val):
+ (KJS::Machine::cti_op_resolve_func):
+ (KJS::Machine::cti_op_resolve_skip):
+ (KJS::Machine::cti_op_resolve_with_base):
+ (KJS::Machine::cti_op_call_eval):
+
+2008-08-27 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Gavin Barraclough and Maciej Stachowiak.
+
+ Fix fast/js/bitwise-and-on-undefined.html.
+
+ A temporary value in the slow path of op_bitand was being stored in edx, but was
+ being clobbered by emitGetPutArg before we used it. To fix this, emitGetPutArg
+ now takes a third argument that specifies the scratch register to use when loading
+ from memory. This allows us to avoid clobbering the temporary in op_bitand.
+
+ * VM/CTI.cpp:
+ (KJS::CTI::emitGetPutArg):
+ (KJS::CTI::privateCompile_pass2_Main):
+ (KJS::CTI::privateCompile_pass4_SlowCases):
+ * VM/CTI.h:
+
+2008-08-27 Mark Rowe <mrowe@apple.com>
+
+ Rubber-stamped by Oliver Hunt.
+
+ Switch CTI on by default.
+
+ * wtf/Platform.h:
+
+2008-08-27 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Fix the build of the full WebKit stack.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj: Mark two new headers as private so they can be pulled in from WebCore.
+ * VM/CTI.h: Fix build issues that show up when compiled with GCC 4.2 as part of WebCore.
+ * wrec/WREC.h: Ditto.
+
+2008-08-27 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Implement op_new_error. Does not fix any tests as it is always followed by the unimplemented op_throw.
+
+ * VM/CTI.cpp:
+ (KJS::CTI::privateCompile_pass1_Scan):
+ (KJS::CTI::privateCompile_pass2_Main):
+ * VM/Machine.cpp:
+ (KJS::Machine::cti_op_new_error):
+ * VM/Machine.h:
+
+2008-08-27 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Gavin Barraclough and Geoff Garen.
+
+ Implement op_put_getter and op_put_setter.
+
+ * VM/CTI.cpp:
+ (KJS::CTI::privateCompile_pass1_Scan):
+ (KJS::CTI::privateCompile_pass2_Main):
+ * VM/Machine.cpp:
+ (KJS::Machine::cti_op_put_getter):
+ (KJS::Machine::cti_op_put_setter):
+ * VM/Machine.h:
+
+2008-08-27 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Gavin Barraclough and Geoff Garen.
+
+ Implement op_del_by_val fixing 3 mozilla tests.
+
+ * VM/CTI.cpp:
+ (KJS::CTI::privateCompile_pass1_Scan):
+ (KJS::CTI::privateCompile_pass2_Main):
+ * VM/Machine.cpp:
+ (KJS::Machine::cti_op_del_by_val):
+ * VM/Machine.h:
+
+2008-08-27 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Quick & dirty fix to get SamplingTool sampling op_call.
+
+ * VM/SamplingTool.h:
+ (KJS::SamplingTool::callingHostFunction):
+
+2008-08-27 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Gavin Barraclough and Geoff Garen.
+
+ Fix op_put_by_index.
+
+ * VM/CTI.cpp:
+ (KJS::CTI::privateCompile_pass2_Main): Use emitPutArgConstant instead of emitGetPutArg
+ for the property value.
+ * VM/Machine.cpp:
+ (KJS::Machine::cti_op_put_by_index): Get the property value from the correct argument.
+
+2008-08-27 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Gavin Barraclough and Geoff Garen.
+
+ Implement op_switch_imm in the CTI fixing 13 mozilla tests.
+
+ * VM/CTI.cpp:
+ (KJS::CTI::privateCompile_pass1_Scan):
+ (KJS::CTI::privateCompile_pass2_Main):
+ * VM/Machine.cpp:
+ (KJS::Machine::cti_op_switch_imm):
+ * VM/Machine.h:
+
+2008-08-27 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Implement op_switch_char in CTI.
+
+ * VM/CTI.cpp:
+ (KJS::CTI::emitCall):
+ (KJS::CTI::privateCompile_pass1_Scan):
+ (KJS::CTI::privateCompile_pass2_Main):
+ (KJS::CTI::privateCompile):
+ * VM/CTI.h:
+ (KJS::CallRecord::CallRecord):
+ (KJS::SwitchRecord::SwitchRecord):
+ * VM/CodeBlock.h:
+ (KJS::SimpleJumpTable::SimpleJumpTable::ctiForValue):
+ * VM/Machine.cpp:
+ (KJS::Machine::cti_op_switch_char):
+ * VM/Machine.h:
+ * masm/IA32MacroAsm.h:
+ (KJS::IA32MacroAssembler::):
+ (KJS::IA32MacroAssembler::emitJmpN_r):
+ (KJS::IA32MacroAssembler::getRelocatedAddress):
+ * wtf/Platform.h:
+
+2008-08-26 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Mark Rowe.
+
+ Implement op_put_by_index to fix 1 mozilla test.
+
+ * VM/CTI.cpp:
+ (KJS::CTI::privateCompile_pass1_Scan):
+ (KJS::CTI::privateCompile_pass2_Main):
+ * VM/Machine.cpp:
+ (KJS::Machine::cti_op_put_by_index):
+ * VM/Machine.h:
+
+2008-08-26 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ More fixes from Geoff's review.
+
+ * VM/CTI.cpp:
+ (KJS::CTI::emitGetArg):
+ (KJS::CTI::emitGetPutArg):
+ (KJS::CTI::emitPutArg):
+ (KJS::CTI::emitPutArgConstant):
+ (KJS::CTI::getConstantImmediateNumericArg):
+ (KJS::CTI::emitGetCTIParam):
+ (KJS::CTI::emitPutResult):
+ (KJS::CTI::emitCall):
+ (KJS::CTI::emitJumpSlowCaseIfNotImm):
+ (KJS::CTI::emitJumpSlowCaseIfNotImms):
+ (KJS::CTI::getDeTaggedConstantImmediate):
+ (KJS::CTI::emitFastArithDeTagImmediate):
+ (KJS::CTI::emitFastArithReTagImmediate):
+ (KJS::CTI::emitFastArithPotentiallyReTagImmediate):
+ (KJS::CTI::emitFastArithImmToInt):
+ (KJS::CTI::emitFastArithIntToImmOrSlowCase):
+ (KJS::CTI::privateCompile_pass2_Main):
+ (KJS::CTI::privateCompile_pass4_SlowCases):
+ (KJS::CTI::privateCompile):
+ * VM/CTI.h:
+
+2008-08-26 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Gavin Barraclough and Geoff Garen.
+
+ Implement op_jmp_scopes to fix 2 Mozilla tests.
+
+ * VM/CTI.cpp:
+ (KJS::CTI::privateCompile_pass1_Scan):
+ (KJS::CTI::privateCompile_pass2_Main):
+ * VM/Machine.cpp:
+ (KJS::Machine::cti_op_push_new_scope): Update ExecState::m_scopeChain after calling ARG_setScopeChain.
+ (KJS::Machine::cti_op_jmp_scopes):
+ * VM/Machine.h:
+
+2008-08-26 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ WebKit Regular Expression Compiler. (set ENABLE_WREC = 1 in Platform.h).
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * kjs/regexp.cpp:
+ * kjs/regexp.h:
+ * wrec: Added.
+ * wrec/WREC.cpp: Added.
+ * wrec/WREC.h: Added.
+ * wtf/Platform.h:
+
+2008-08-26 Sam Weinig <sam@webkit.org>
+
+ Rubber-stamped by Oliver Hunt.
+
+ Remove bogus assertion.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::cti_op_del_by_id):
+
+2008-08-26 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Implement op_push_new_scope and stub out op_catch. This fixes 11 Mozilla tests.
+
+ * VM/CTI.cpp:
+ (KJS::CTI::privateCompile_pass1_Scan):
+ (KJS::CTI::privateCompile_pass2_Main):
+ * VM/Machine.cpp:
+ (KJS::Machine::cti_op_push_new_scope):
+ (KJS::Machine::cti_op_catch):
+ * VM/Machine.h:
+
+2008-08-26 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Clean up op_resolve_base so that it shares its implementation with the bytecode interpreter.
+
+ * VM/Machine.cpp:
+ (KJS::inlineResolveBase):
+ (KJS::resolveBase):
+
+2008-08-26 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Add codegen support for op_instanceof, fixing 15 mozilla tests.
+
+ * VM/CTI.cpp:
+ (KJS::CTI::privateCompile_pass1_Scan):
+ (KJS::CTI::privateCompile_pass2_Main):
+ * VM/Machine.cpp:
+ (KJS::Machine::cti_op_instanceof):
+ (KJS::Machine::cti_op_del_by_id):
+ * VM/Machine.h:
+ * wtf/Platform.h:
+
+2008-08-26 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Fixes for initial review comments.
+
+ * VM/CTI.cpp:
+ (KJS::CTI::ctiCompileGetArg):
+ (KJS::CTI::ctiCompileGetPutArg):
+ (KJS::CTI::ctiCompilePutResult):
+ (KJS::CTI::ctiCompileCall):
+ (KJS::CTI::CTI):
+ (KJS::CTI::privateCompile_pass1_Scan):
+ (KJS::CTI::printOpcodeOperandTypes):
+ (KJS::CTI::privateCompile_pass2_Main):
+ (KJS::CTI::privateCompile_pass4_SlowCases):
+ (KJS::CTI::privateCompile):
+ * VM/CTI.h:
+ * VM/Register.h:
+ * kjs/JSValue.h:
+
+2008-08-26 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Gavin Barraclough and Geoff Garen.
+
+ Fix up exception checking code.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::cti_op_call):
+ (KJS::Machine::cti_op_resolve):
+ (KJS::Machine::cti_op_construct):
+ (KJS::Machine::cti_op_resolve_func):
+ (KJS::Machine::cti_op_resolve_skip):
+ (KJS::Machine::cti_op_resolve_with_base):
+ (KJS::Machine::cti_op_call_eval):
+
+2008-08-26 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Oliver Hunt.
+
+ Fix slowcase for op_post_inc and op_post_dec fixing 2 mozilla tests.
+
+ * VM/CTI.cpp:
+ (KJS::CTI::privateCompile_pass4_SlowCases):
+
+2008-08-26 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Implement op_in, fixing 8 mozilla tests.
+
+ * VM/CTI.cpp:
+ (KJS::CTI::privateCompile_pass1_Scan):
+ (KJS::CTI::privateCompile_pass2_Main):
+ * VM/Machine.cpp:
+ (KJS::Machine::cti_op_in):
+ * VM/Machine.h:
+
+2008-08-26 Mark Rowe <mrowe@apple.com>
+
+ Rubber-stamped by Oliver Hunt.
+
+ Don't hardcode the size of a Register for op_new_array. Fixes a crash
+ seen during the Mozilla tests.
+
+ * VM/CTI.cpp:
+ (KJS::CTI::privateCompile_pass2_Main):
+
+2008-08-26 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Gavin Barraclough and Geoff Garen.
+
+ Add support for op_push_scope and op_pop_scope, fixing 20 mozilla tests.
+
+ * VM/CTI.cpp:
+ (KJS::CTI::privateCompile_pass1_Scan):
+ (KJS::CTI::privateCompile_pass2_Main):
+ * VM/CTI.h:
+ * VM/Machine.cpp:
+ (KJS::Machine::cti_op_push_scope):
+ (KJS::Machine::cti_op_pop_scope):
+ * VM/Machine.h:
+
+2008-08-26 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Add codegen support for op_del_by_id, fixing 49 mozilla tests.
+
+ * VM/CTI.cpp:
+ (KJS::CTI::privateCompile_pass1_Scan):
+ (KJS::CTI::privateCompile_pass2_Main):
+ * VM/Machine.cpp:
+ (KJS::Machine::cti_op_del_by_id):
+ * VM/Machine.h:
+
+2008-08-26 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Gavin Barraclough and Geoff Garen.
+
+ Don't hardcode the size of a Register for op_get_scoped_var and op_put_scoped_var
+ fixing 513 mozilla tests in debug build.
+
+ * VM/CTI.cpp:
+ (KJS::CTI::privateCompile_pass2_Main):
+
+2008-08-26 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Added code generator support for op_loop, fixing around 60 mozilla tests.
+
+ * VM/CTI.cpp:
+ (KJS::CTI::privateCompile_pass1_Scan):
+ (KJS::CTI::privateCompile_pass2_Main):
+
+2008-08-26 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Set -fomit-frame-pointer in the correct location.
+
+ * Configurations/JavaScriptCore.xcconfig:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2008-08-26 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Inital cut of CTI, Geoff's review fixes to follow.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * VM/CTI.cpp: Added.
+ (KJS::getJCB):
+ (KJS::CTI::ctiCompileGetArg):
+ (KJS::CTI::ctiCompileGetPutArg):
+ (KJS::CTI::ctiCompilePutArg):
+ (KJS::CTI::ctiCompilePutArgImm):
+ (KJS::CTI::ctiImmediateNumericArg):
+ (KJS::CTI::ctiCompileGetCTIParam):
+ (KJS::CTI::ctiCompilePutResult):
+ (KJS::CTI::ctiCompileCall):
+ (KJS::CTI::slowCaseIfNotImm):
+ (KJS::CTI::slowCaseIfNotImms):
+ (KJS::CTI::ctiFastArithDeTagConstImmediate):
+ (KJS::CTI::ctiFastArithDeTagImmediate):
+ (KJS::CTI::ctiFastArithReTagImmediate):
+ (KJS::CTI::ctiFastArithPotentiallyReTagImmediate):
+ (KJS::CTI::ctiFastArithImmToInt):
+ (KJS::CTI::ctiFastArithIntToImmOrSlowCase):
+ (KJS::CTI::CTI):
+ (KJS::CTI::privateCompile_pass1_Scan):
+ (KJS::CTI::ctiCompileAdd):
+ (KJS::CTI::ctiCompileAddImm):
+ (KJS::CTI::ctiCompileAddImmNotInt):
+ (KJS::CTI::TEMP_HACK_PRINT_TYPES):
+ (KJS::CTI::privateCompile_pass2_Main):
+ (KJS::CTI::privateCompile_pass3_Link):
+ (KJS::CTI::privateCompile_pass4_SlowCases):
+ (KJS::CTI::privateCompile):
+ * VM/CTI.h: Added.
+ (KJS::CTI2Result::CTI2Result):
+ (KJS::CallRecord::CallRecord):
+ (KJS::JmpTable::JmpTable):
+ (KJS::SlowCaseEntry::SlowCaseEntry):
+ (KJS::CTI::compile):
+ (KJS::CTI::LabelInfo::LabelInfo):
+ * VM/CodeBlock.h:
+ (KJS::CodeBlock::CodeBlock):
+ (KJS::CodeBlock::~CodeBlock):
+ * VM/Machine.cpp:
+ (KJS::Machine::execute):
+ (KJS::Machine::privateExecute):
+ (KJS::ctiException):
+ (KJS::ctiUnsupported):
+ (KJS::ctiTimedOut):
+ (KJS::Machine::cti_op_end):
+ (KJS::Machine::cti_op_add):
+ (KJS::Machine::cti_op_pre_inc):
+ (KJS::Machine::cti_timeout_check):
+ (KJS::Machine::cti_op_loop_if_less):
+ (KJS::Machine::cti_op_new_object):
+ (KJS::Machine::cti_op_put_by_id):
+ (KJS::Machine::cti_op_get_by_id):
+ (KJS::Machine::cti_op_mul):
+ (KJS::Machine::cti_op_new_func):
+ (KJS::Machine::cti_op_call):
+ (KJS::Machine::cti_op_ret):
+ (KJS::Machine::cti_op_new_array):
+ (KJS::Machine::cti_op_resolve):
+ (KJS::Machine::cti_op_construct):
+ (KJS::Machine::cti_op_get_by_val):
+ (KJS::Machine::cti_op_resolve_func):
+ (KJS::Machine::cti_op_sub):
+ (KJS::Machine::cti_op_put_by_val):
+ (KJS::Machine::cti_op_lesseq):
+ (KJS::Machine::cti_op_loop_if_true):
+ (KJS::Machine::cti_op_negate):
+ (KJS::Machine::cti_op_resolve_base):
+ (KJS::Machine::cti_op_resolve_skip):
+ (KJS::Machine::cti_op_div):
+ (KJS::Machine::cti_op_pre_dec):
+ (KJS::Machine::cti_op_jless):
+ (KJS::Machine::cti_op_not):
+ (KJS::Machine::cti_op_jtrue):
+ (KJS::Machine::cti_op_post_inc):
+ (KJS::Machine::cti_op_eq):
+ (KJS::Machine::cti_op_lshift):
+ (KJS::Machine::cti_op_bitand):
+ (KJS::Machine::cti_op_rshift):
+ (KJS::Machine::cti_op_bitnot):
+ (KJS::Machine::cti_op_resolve_with_base):
+ (KJS::Machine::cti_op_new_func_exp):
+ (KJS::Machine::cti_op_mod):
+ (KJS::Machine::cti_op_less):
+ (KJS::Machine::cti_op_neq):
+ (KJS::Machine::cti_op_post_dec):
+ (KJS::Machine::cti_op_urshift):
+ (KJS::Machine::cti_op_bitxor):
+ (KJS::Machine::cti_op_new_regexp):
+ (KJS::Machine::cti_op_bitor):
+ (KJS::Machine::cti_op_call_eval):
+ (KJS::Machine::cti_op_throw):
+ (KJS::Machine::cti_op_get_pnames):
+ (KJS::Machine::cti_op_next_pname):
+ (KJS::Machine::cti_op_typeof):
+ (KJS::Machine::cti_op_stricteq):
+ (KJS::Machine::cti_op_nstricteq):
+ (KJS::Machine::cti_op_to_jsnumber):
+ * VM/Machine.h:
+ * VM/Register.h:
+ (KJS::Register::jsValue):
+ (KJS::Register::getJSValue):
+ (KJS::Register::codeBlock):
+ (KJS::Register::scopeChain):
+ (KJS::Register::i):
+ (KJS::Register::r):
+ (KJS::Register::vPC):
+ (KJS::Register::jsPropertyNameIterator):
+ * VM/SamplingTool.cpp:
+ (KJS::):
+ (KJS::SamplingTool::run):
+ (KJS::SamplingTool::dump):
+ * VM/SamplingTool.h:
+ * kjs/JSImmediate.h:
+ (KJS::JSImmediate::zeroImmediate):
+ (KJS::JSImmediate::oneImmediate):
+ * kjs/JSValue.h:
+ * kjs/JSVariableObject.h:
+ (KJS::JSVariableObject::JSVariableObjectData::offsetOf_registers):
+ (KJS::JSVariableObject::offsetOf_d):
+ (KJS::JSVariableObject::offsetOf_Data_registers):
+ * masm: Added.
+ * masm/IA32MacroAsm.h: Added.
+ (KJS::JITCodeBuffer::JITCodeBuffer):
+ (KJS::JITCodeBuffer::putByte):
+ (KJS::JITCodeBuffer::putShort):
+ (KJS::JITCodeBuffer::putInt):
+ (KJS::JITCodeBuffer::getEIP):
+ (KJS::JITCodeBuffer::start):
+ (KJS::JITCodeBuffer::getOffset):
+ (KJS::JITCodeBuffer::reset):
+ (KJS::JITCodeBuffer::copy):
+ (KJS::IA32MacroAssembler::):
+ (KJS::IA32MacroAssembler::emitModRm_rr):
+ (KJS::IA32MacroAssembler::emitModRm_rm):
+ (KJS::IA32MacroAssembler::emitModRm_rmsib):
+ (KJS::IA32MacroAssembler::emitModRm_opr):
+ (KJS::IA32MacroAssembler::emitModRm_opm):
+ (KJS::IA32MacroAssembler::IA32MacroAssembler):
+ (KJS::IA32MacroAssembler::emitInt3):
+ (KJS::IA32MacroAssembler::emitPushl_r):
+ (KJS::IA32MacroAssembler::emitPopl_r):
+ (KJS::IA32MacroAssembler::emitMovl_rr):
+ (KJS::IA32MacroAssembler::emitAddl_rr):
+ (KJS::IA32MacroAssembler::emitAddl_i8r):
+ (KJS::IA32MacroAssembler::emitAddl_i32r):
+ (KJS::IA32MacroAssembler::emitAddl_mr):
+ (KJS::IA32MacroAssembler::emitAndl_rr):
+ (KJS::IA32MacroAssembler::emitAndl_i32r):
+ (KJS::IA32MacroAssembler::emitCmpl_i8r):
+ (KJS::IA32MacroAssembler::emitCmpl_rr):
+ (KJS::IA32MacroAssembler::emitCmpl_rm):
+ (KJS::IA32MacroAssembler::emitCmpl_i32r):
+ (KJS::IA32MacroAssembler::emitCmpw_rm):
+ (KJS::IA32MacroAssembler::emitOrl_rr):
+ (KJS::IA32MacroAssembler::emitOrl_i8r):
+ (KJS::IA32MacroAssembler::emitSubl_rr):
+ (KJS::IA32MacroAssembler::emitSubl_i8r):
+ (KJS::IA32MacroAssembler::emitSubl_i32r):
+ (KJS::IA32MacroAssembler::emitSubl_mr):
+ (KJS::IA32MacroAssembler::emitTestl_i32r):
+ (KJS::IA32MacroAssembler::emitTestl_rr):
+ (KJS::IA32MacroAssembler::emitXorl_i8r):
+ (KJS::IA32MacroAssembler::emitXorl_rr):
+ (KJS::IA32MacroAssembler::emitSarl_i8r):
+ (KJS::IA32MacroAssembler::emitSarl_CLr):
+ (KJS::IA32MacroAssembler::emitShl_i8r):
+ (KJS::IA32MacroAssembler::emitShll_CLr):
+ (KJS::IA32MacroAssembler::emitMull_rr):
+ (KJS::IA32MacroAssembler::emitIdivl_r):
+ (KJS::IA32MacroAssembler::emitCdq):
+ (KJS::IA32MacroAssembler::emitMovl_mr):
+ (KJS::IA32MacroAssembler::emitMovzwl_mr):
+ (KJS::IA32MacroAssembler::emitMovl_rm):
+ (KJS::IA32MacroAssembler::emitMovl_i32r):
+ (KJS::IA32MacroAssembler::emitMovl_i32m):
+ (KJS::IA32MacroAssembler::emitLeal_mr):
+ (KJS::IA32MacroAssembler::emitRet):
+ (KJS::IA32MacroAssembler::JmpSrc::JmpSrc):
+ (KJS::IA32MacroAssembler::JmpDst::JmpDst):
+ (KJS::IA32MacroAssembler::emitCall):
+ (KJS::IA32MacroAssembler::label):
+ (KJS::IA32MacroAssembler::emitUnlinkedJmp):
+ (KJS::IA32MacroAssembler::emitUnlinkedJne):
+ (KJS::IA32MacroAssembler::emitUnlinkedJe):
+ (KJS::IA32MacroAssembler::emitUnlinkedJl):
+ (KJS::IA32MacroAssembler::emitUnlinkedJle):
+ (KJS::IA32MacroAssembler::emitUnlinkedJge):
+ (KJS::IA32MacroAssembler::emitUnlinkedJae):
+ (KJS::IA32MacroAssembler::emitUnlinkedJo):
+ (KJS::IA32MacroAssembler::emitPredictionNotTaken):
+ (KJS::IA32MacroAssembler::link):
+ (KJS::IA32MacroAssembler::copy):
+ * wtf/Platform.h:
+
+2008-08-26 Oliver Hunt <oliver@apple.com>
+
+ RS=Maciej.
+
+ Enabled -fomit-frame-pointer on Release and Production builds, add additional Profiling build config for shark, etc.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+=== Start merge of squirrelfish-extreme ===
+
+2008-09-06 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Maciej Stachowiak.
+
+ Fix the Mac Debug build by adding symbols that are exported only in a
+ Debug configuration.
+
+ * Configurations/JavaScriptCore.xcconfig:
+ * DerivedSources.make:
+ * JavaScriptCore.Debug.exp: Added.
+ * JavaScriptCore.base.exp: Copied from JavaScriptCore.exp.
+ * JavaScriptCore.exp: Removed.
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2008-09-05 Darin Adler <darin@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ - https://bugs.webkit.org/show_bug.cgi?id=20681
+ JSPropertyNameIterator functions need to be inlined
+
+ 1.007x as fast on SunSpider overall
+ 1.081x as fast on SunSpider math-cordic
+
+ * VM/JSPropertyNameIterator.cpp: Moved functions out of here.
+ * VM/JSPropertyNameIterator.h:
+ (KJS::JSPropertyNameIterator::JSPropertyNameIterator): Moved
+ this into the header and marked it inline.
+ (KJS::JSPropertyNameIterator::create): Ditto.
+ (KJS::JSPropertyNameIterator::next): Ditto.
+
+2008-09-05 Darin Adler <darin@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ - fix https://bugs.webkit.org/show_bug.cgi?id=20673
+ single-character strings are churning in the Identifier table
+
+ 1.007x as fast on SunSpider overall
+ 1.167x as fast on SunSpider string-fasta
+
+ * JavaScriptCore.exp: Updated.
+ * kjs/SmallStrings.cpp:
+ (KJS::SmallStrings::singleCharacterStringRep): Added.
+ * kjs/SmallStrings.h: Added singleCharacterStringRep for clients that
+ need just a UString, not a JSString.
+ * kjs/identifier.cpp:
+ (KJS::Identifier::add): Added special cases for single character strings
+ so that the UString::Rep that ends up in the identifier table is the one
+ from the single-character string optimization; otherwise we end up having
+ to look it up in the identifier table over and over again.
+ (KJS::Identifier::addSlowCase): Ditto.
+ (KJS::Identifier::checkSameIdentifierTable): Made this function an empty
+ inline in release builds so that callers don't have to put #ifndef NDEBUG
+ at each call site.
+ * kjs/identifier.h:
+ (KJS::Identifier::add): Removed #ifndef NDEBUG around the calls to
+ checkSameIdentifierTable.
+ (KJS::Identifier::checkSameIdentifierTable): Added. Empty inline version
+ for NDEBUG builds.
+
+2008-09-05 Mark Rowe <mrowe@apple.com>
+
+ Build fix.
+
+ * kjs/JSObject.h: Move the inline virtual destructor after a non-inline
+ virtual function so that the symbol for the vtable is not marked as a
+ weakly exported symbol.
+
+2008-09-05 Darin Adler <darin@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ - fix https://bugs.webkit.org/show_bug.cgi?id=20671
+ JavaScriptCore string manipulation spends too much time in memcpy
+
+ 1.011x as fast on SunSpider overall
+ 1.028x as fast on SunSpider string tests
+
+ For small strings, use a loop rather than calling memcpy. The loop can
+ be faster because there's no function call overhead, and because it can
+ assume the pointers are aligned instead of checking that. Currently the
+ threshold is set at 20 characters, based on some testing on one particular
+ computer. Later we can tune this for various platforms by setting
+ USTRING_COPY_CHARS_INLINE_CUTOFF appropriately, but it does no great harm
+ if not perfectly tuned.
+
+ * kjs/ustring.cpp:
+ (KJS::overflowIndicator): Removed bogus const.
+ (KJS::maxUChars): Ditto.
+ (KJS::copyChars): Added.
+ (KJS::UString::Rep::createCopying): Call copyChars instead of memcpy.
+ Also eliminated need for const_cast.
+ (KJS::UString::expandPreCapacity): Ditto.
+ (KJS::concatenate): Ditto.
+ (KJS::UString::spliceSubstringsWithSeparators): Ditto.
+ (KJS::UString::append): Ditto.
+
+2008-09-05 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Sam and Alexey.
+
+ Make the profiler work with a null exec state. This will allow other
+ applications start the profiler to get DTrace probes going without
+ needing a WebView.
+
+ * ChangeLog:
+ * profiler/ProfileGenerator.cpp:
+ (KJS::ProfileGenerator::ProfileGenerator):
+ (KJS::ProfileGenerator::willExecute):
+ (KJS::ProfileGenerator::didExecute):
+ * profiler/Profiler.cpp:
+ (KJS::Profiler::startProfiling):
+ (KJS::Profiler::stopProfiling):
+ (KJS::dispatchFunctionToProfiles):
+
+2008-09-04 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Fixed an off-by-one error that would cause the StructureIDChain to
+ be one object too short.
+
+ Can't construct a test case because other factors make this not crash
+ (yet!).
+
+ * kjs/StructureID.cpp:
+ (KJS::StructureIDChain::StructureIDChain):
+
+2008-09-04 Kevin Ollivier <kevino@theolliviers.com>
+
+ wx build fixes.
+
+ * JavaScriptCoreSources.bkl:
+
+2008-09-04 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Eric Seidel.
+
+ Fix https://bugs.webkit.org/show_bug.cgi?id=20639.
+ Bug 20639: ENABLE_DASHBOARD_SUPPORT does not need to be a FEATURE_DEFINE
+
+ * Configurations/JavaScriptCore.xcconfig: Remove ENABLE_DASHBOARD_SUPPORT from FEATURE_DEFINES.
+ * wtf/Platform.h: Set ENABLE_DASHBOARD_SUPPORT for PLATFORM(MAC).
+
+2008-09-04 Adele Peterson <adele@apple.com>
+
+ Build fix.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * JavaScriptCore.vcproj/jsc/jsc.vcproj:
+
+2008-09-04 Mark Rowe <mrowe@apple.com>
+
+ Mac build fix.
+
+ * kjs/config.h: Only check the value of HAVE_CONFIG_H if it is defined.
+
+2008-09-04 Marco Barisione <marco.barisione@collabora.co.uk>
+
+ Reviewed by Eric Seidel.
+
+ http://bugs.webkit.org/show_bug.cgi?id=20380
+ [GTK][AUTOTOOLS] Include autotoolsconfig.h from config.h
+
+ * kjs/config.h: Include the configuration header generated by
+ autotools if available.
+
+2008-09-04 Tor Arne Vestbø <tavestbo@trolltech.com>
+
+ Reviewed by Simon.
+
+ Fix the QtWebKit build to match changes in r36016
+
+ * JavaScriptCore.pri:
+
+2008-09-04 Mark Rowe <mrowe@apple.com>
+
+ Fix the 64-bit build.
+
+ * VM/CodeBlock.cpp:
+ (KJS::CodeBlock::printStructureID): Store the instruction offset into an unsigned local
+ to avoid a warning related to format specifiers.
+ (KJS::CodeBlock::printStructureIDs): Ditto.
+
+2008-09-04 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Rubber-stamped by Oliver Hunt.
+
+ Correct the spelling of 'entryIndices'.
+
+ * kjs/PropertyMap.cpp:
+ (KJS::PropertyMap::get):
+ (KJS::PropertyMap::getLocation):
+ (KJS::PropertyMap::put):
+ (KJS::PropertyMap::insert):
+ (KJS::PropertyMap::remove):
+ (KJS::PropertyMap::checkConsistency):
+ * kjs/PropertyMap.h:
+ (KJS::PropertyMapHashTable::entries):
+ (KJS::PropertyMap::getOffset):
+ (KJS::PropertyMap::putOffset):
+ (KJS::PropertyMap::offsetForTableLocation):
+
+2008-09-03 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ Fixed <rdar://problem/6193925> REGRESSION: Crash occurs at
+ KJS::Machine::privateExecute() when attempting to load my Mobile Gallery
+ (http://www.me.com/gallery/#home)
+
+ also
+
+ https://bugs.webkit.org/show_bug.cgi?id=20633 Crash in privateExecute
+ @ cs.byu.edu
+
+ The underlying problem was that we would cache prototype properties
+ even if the prototype was a dictionary.
+
+ The fix is to transition a prototype back from dictionary to normal
+ status when an opcode caches access to it. (This is better than just
+ refusing to cache, since a heavily accessed prototype is almost
+ certainly not a true dictionary.)
+
+ * VM/Machine.cpp:
+ (KJS::Machine::tryCacheGetByID):
+ * kjs/JSObject.h:
+
+2008-09-03 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Sam.
+
+ Clean up Platform.h and add PLATFORM(CHROMIUM), PLATFORM(SKIA) and USE(V8_BINDINGS)
+
+ * Configurations/JavaScriptCore.xcconfig: add missing ENABLE_*
+ * wtf/ASCIICType.h: include <wtf/Assertions.h> since it depends on it.
+ * wtf/Platform.h:
+
+2008-09-03 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Tim.
+
+ Remove the rest of the "zombie" code from the profiler.
+ - There is no longer a need for the ProfilerClient callback mechanism.
+
+ * API/JSProfilerPrivate.cpp:
+ (JSStartProfiling):
+ * JavaScriptCore.exp:
+ * profiler/HeavyProfile.h:
+ * profiler/ProfileGenerator.cpp:
+ (KJS::ProfileGenerator::create):
+ (KJS::ProfileGenerator::ProfileGenerator):
+ * profiler/ProfileGenerator.h:
+ (KJS::ProfileGenerator::profileGroup):
+ * profiler/Profiler.cpp:
+ (KJS::Profiler::startProfiling):
+ (KJS::Profiler::stopProfiling): Immediately return the profile when
+ stopped instead of using a callback.
+ * profiler/Profiler.h:
+ * profiler/TreeProfile.h:
+
+2008-09-03 Adele Peterson <adele@apple.com>
+
+ Build fix.
+
+ * wtf/win/MainThreadWin.cpp:
+
+2008-09-02 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Darin and Tim.
+
+ Remove most of the "zombie" mode from the profiler. Next we will need
+ to remove the client callback mechanism in profiles.
+
+ - This simplifies the code, leverages the recent changes I've made in
+ getting line numbers from SquirrelFish, and is a slight speed
+ improvement on SunSpider.
+ - Also the "zombie" mode was a constant source of odd edge cases and
+ obscure bugs so it's good to remove since all of its issues may not have
+ been found.
+
+ * API/JSProfilerPrivate.cpp: No need to call didFinishAllExecution() any
+ more.
+ (JSEndProfiling):
+ * JavaScriptCore.exp: Export the new signature of retrieveLastCaller()
+ * VM/Machine.cpp:
+ (KJS::Machine::execute): No need to call didFinishAllExecution() any
+ more.
+ (KJS::Machine::retrieveCaller): Now operates on InternalFunctions now
+ since the RegisterFile is no longer guaranteeded to store only
+ JSFunctions
+ (KJS::Machine::retrieveLastCaller): Now also retrieve the function's
+ name
+ (KJS::Machine::callFrame): A result of changing retrieveCaller()
+ * VM/Machine.h:
+ * VM/Register.h:
+ * kjs/JSGlobalObject.cpp:
+ (KJS::JSGlobalObject::~JSGlobalObject):
+ * kjs/nodes.h:
+ * profiler/ProfileGenerator.cpp:
+ (KJS::ProfileGenerator::create): Now pass the original exec and get the
+ global exec and client when necessary. We need the original exec so we
+ can have the stack frame where profiling started.
+ (KJS::ProfileGenerator::ProfileGenerator): ditto.
+ (KJS::ProfileGenerator::addParentForConsoleStart): This is where the
+ parent to star of the profile is added, if there is one.
+ (KJS::ProfileGenerator::willExecute): Remove uglyness!
+ (KJS::ProfileGenerator::didExecute): Ditto!
+ (KJS::ProfileGenerator::stopProfiling):
+ (KJS::ProfileGenerator::removeProfileStart): Use a better way to find
+ and remove the function we are looking for.
+ (KJS::ProfileGenerator::removeProfileEnd): Ditto.
+ * profiler/ProfileGenerator.h:
+ (KJS::ProfileGenerator::client):
+ * profiler/ProfileNode.cpp:
+ (KJS::ProfileNode::removeChild): Add a better way to remove a child from
+ a ProfileNode.
+ (KJS::ProfileNode::stopProfiling):
+ (KJS::ProfileNode::debugPrintData): Modified a debug-only diagnostic
+ function to be sane.
+ * profiler/ProfileNode.h:
+ * profiler/Profiler.cpp: Change to pass the original exec state.
+ (KJS::Profiler::startProfiling):
+ (KJS::Profiler::stopProfiling):
+ (KJS::Profiler::willExecute):
+ (KJS::Profiler::didExecute):
+ (KJS::Profiler::createCallIdentifier):
+ * profiler/Profiler.h:
+
+2008-09-01 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ Implement callOnMainThreadAndWait().
+
+ This will be useful when a background thread needs to perform UI calls synchronously
+ (e.g. an openDatabase() call cannot return until the user answers to a confirmation dialog).
+
+ * wtf/MainThread.cpp:
+ (WTF::FunctionWithContext::FunctionWithContext): Added a ThreadCondition member. When
+ non-zero, the condition is signalled after the function is called.
+ (WTF::mainThreadFunctionQueueMutex): Renamed from functionQueueMutex, sinc this is no longer
+ static. Changed to be initialized from initializeThreading() to avoid lock contention.
+ (WTF::initializeMainThread): On non-Windows platforms, just call mainThreadFunctionQueueMutex.
+ (WTF::dispatchFunctionsFromMainThread): Signal synchronous calls when done.
+ (WTF::callOnMainThread): Updated for functionQueueMutex rename.
+ (WTF::callOnMainThreadAndWait): Added.
+
+ * wtf/MainThread.h: Added callOnMainThreadAndWait(); initializeMainThread() now exists on
+ all platforms.
+
+ * wtf/win/MainThreadWin.cpp: (WTF::initializeMainThread): Added a callOnMainThreadAndWait()
+ call to initialize function queue mutex.
+
+ * wtf/ThreadingGtk.cpp: (WTF::initializeThreading):
+ * wtf/ThreadingPthreads.cpp: (WTF::initializeThreading):
+ * wtf/ThreadingQt.cpp: (WTF::initializeThreading):
+ Only initialize mainThreadIdentifier on non-Darwin platforms. It was not guaranteed to be
+ accurate on Darwin.
+
+2008-09-03 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Use isUndefinedOrNull() instead of separate checks for each in op_eq_null
+ and op_neq_null.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+
+2008-09-02 Csaba Osztrogonac <oszi@inf.u-szeged.hu>
+
+ Reviewed by Darin Adler.
+
+ Bug 20296: OpcodeStats doesn't build on platforms which don't have mergesort().
+ <https://bugs.webkit.org/show_bug.cgi?id=20296>
+
+ * VM/Opcode.cpp:
+ (KJS::OpcodeStats::~OpcodeStats): mergesort() replaced with qsort()
+
+2008-09-02 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Fast path for array.length and string.length.
+
+ SunSpider says 0.5% faster.
+
+2008-09-02 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Anders Carlsson.
+
+ Added optimized paths for comparing to null.
+
+ SunSpider says 0.5% faster.
+
+2008-09-02 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Changed jsDriver.pl to dump the exact text you would need in order to
+ reproduce a test result. This enables a fast workflow where you copy
+ and paste a test failure in the terminal.
+
+ * tests/mozilla/jsDriver.pl:
+
+2008-09-02 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Implemented the rest of Darin's review comments for the 09-01 inline
+ caching patch.
+
+ SunSpider says 0.5% faster, but that seems like noise.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj: Put PutPropertySlot into
+ its own file, and added BatchedTransitionOptimizer.
+
+ * VM/CodeBlock.cpp:
+ (KJS::CodeBlock::~CodeBlock): Use array indexing instead of a pointer
+ iterator.
+
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::CodeGenerator): Used BatchedTransitionOptimizer to
+ make batched put and remove for declared variables fast, without forever
+ pessimizing the global object. Removed the old getDirect/removeDirect hack
+ that tried to do the same in a more limited way.
+
+ * VM/CodeGenerator.h: Moved IdentifierRepHash to the KJS namespace since
+ it doesn't specialize anything in WTF.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::Machine): Nixed the DummyConstruct tag because it was
+ confusingly named.
+
+ (KJS::Machine::execute): Used BatchedTransitionOptimizer, as above. Fixed
+ up some comments.
+
+ (KJS::cachePrototypeChain): Cast to JSObject*, since it's more specific.
+
+ (KJS::Machine::tryCachePutByID): Use isNull() instead of comparing to
+ jsNull(), since isNull() leaves more options open for the future.
+ (KJS::Machine::tryCacheGetByID): ditto
+ (KJS::Machine::privateExecute): ditto
+
+ * VM/SamplingTool.cpp:
+ (KJS::SamplingTool::dump): Use C++-style cast, to match our style
+ guidelines.
+
+ * kjs/BatchedTransitionOptimizer.h: Added. New class that allows host
+ code to add a batch of properties to an object in an efficient way.
+
+ * kjs/JSActivation.cpp: Use isNull(), as above.
+
+ * kjs/JSArray.cpp: Get rid of DummyConstruct tag, as above.
+ * kjs/JSArray.h:
+
+ * kjs/JSGlobalData.cpp: Nixed two unused StructureIDs.
+ * kjs/JSGlobalData.h:
+
+ * kjs/JSImmediate.cpp: Use isNull(), as above.
+
+ * kjs/JSObject.cpp:
+ (KJS::JSObject::mark): Moved mark tracing code elsewhere, to make this
+ function more readable.
+
+ (KJS::JSObject::put): Use isNull(), as above.
+
+ (KJS::JSObject::createInheritorID): Return a raw pointer, since the
+ object is owned by a data member, not necessarily the caller.
+ * kjs/JSObject.h:
+
+ * kjs/JSString.cpp: Use isNull(), as above.
+
+ * kjs/PropertyMap.h: Updated to use PropertySlot::invalidOffset.
+
+ * kjs/PropertySlot.h: Changed KJS_INVALID_OFFSET to WTF::notFound
+ because C macros are so 80's.
+
+ * kjs/PutPropertySlot.h: Added. Split out of PropertySlot.h. Also renamed
+ PutPropertySlot::SlotType to PutPropertySlot::Type, and slotBase to base,
+ since "slot" was redundant.
+
+ * kjs/StructureID.cpp: Added a new transition *away* from dictionary
+ status, to support BatchedTransitionOptimizer.
+
+ (KJS::StructureIDChain::StructureIDChain): No need to store m_size as
+ a data member, so keep it in a local, which might be faster.
+ * kjs/StructureID.h:
+
+ * kjs/SymbolTable.h: Moved IdentifierRepHash to KJS namespace, as above.
+ * kjs/ustring.h:
+
+2008-09-02 Adam Roben <aroben@apple.com>
+
+ Windows build fixes
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Add
+ StructureID.{cpp,h} to the project. Also let VS reorder this file.
+ * VM/CodeBlock.cpp: Include StringExtras so that snprintf will be
+ defined on Windows.
+
+2008-09-01 Sam Weinig <sam@webkit.org>
+
+ Fix release build.
+
+ * JavaScriptCore.exp:
+
+2008-09-01 Jan Michael Alonzo <jmalonzo@webkit.org>
+
+ Reviewed by Oliver Hunt.
+
+ Gtk buildfix
+
+ * GNUmakefile.am:
+ * kjs/PropertyMap.cpp: rename Identifier.h to identifier.h
+ * kjs/StructureID.cpp: include JSObject.h
+
+2008-09-01 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ First cut at inline caching for access to vanilla JavaScript properties.
+
+ SunSpider says 4% faster. Tests heavy on dictionary-like access have
+ regressed a bit -- we have a lot of room to improve in this area,
+ but this patch is over-ripe as-is.
+
+ JSCells now have a StructureID that uniquely identifies their layout,
+ and holds their prototype.
+
+ JSValue::put takes a PropertySlot& argument, so it can fill in details
+ about where it put a value, for the sake of caching.
+
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::CodeGenerator): Avoid calling removeDirect if we
+ can, since it disables inline caching in the global object. This can
+ probably improve in the future.
+
+ * kjs/JSGlobalObject.cpp: Nixed reset(), since it complicates caching, and
+ wasn't really necessary.
+
+ * kjs/JSObject.cpp: Tweaked getter / setter behavior not to rely on the
+ IsGetterSetter flag, since the flag was buggy. This is necessary in order
+ to avoid accidentally accessing a getter / setter as a normal property.
+
+ Also changed getter / setter creation to honor ReadOnly, matching Mozilla.
+
+ * kjs/PropertyMap.cpp: Nixed clear(), since it complicates caching and
+ isn't necessary.
+
+ * kjs/Shell.cpp: Moved SamplingTool dumping outside the loop. This allows
+ you to aggregate sampling of multiple files (or the same file repeatedly),
+ which helped me track down regressions.
+
+ * kjs/ustring.h: Moved IdentifierRepHash here to share it.
+
+2008-09-01 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Eagerly allocate the Math object's numeric constants. This avoids
+ constantly reallocating them in loops, and also ensures that the Math
+ object will not use the single property optimization, which makes
+ properties ineligible for caching.
+
+ SunSpider reports a small speedup, in combination with inline caching.
+
+ * kjs/MathObject.cpp:
+ (KJS::MathObject::MathObject):
+ (KJS::MathObject::getOwnPropertySlot):
+ * kjs/MathObject.h:
+
+2008-09-01 Jan Michael Alonzo <jmalonzo@webkit.org>
+
+ Gtk build fix, not reviewed.
+
+ * GNUmakefile.am: Add SmallStrings.cpp in both release and debug builds
+
+2008-08-31 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Maciej Stachowiak.
+
+ Bug 20577: REGRESSION (r36006): Gmail is broken
+ <https://bugs.webkit.org/show_bug.cgi?id=20577>
+
+ r36006 changed stringProtoFuncSubstr() so that it is uses the more
+ efficient jsSubstring(), rather than using UString::substr() and then
+ calling jsString(). However, the change did not account for the case
+ where the start and the length of the substring extend beyond the length
+ of the original string. This patch corrects that.
+
+ * kjs/StringPrototype.cpp:
+ (KJS::stringProtoFuncSubstr):
+
+2008-08-31 Simon Hausmann <hausmann@wekit.org>
+
+ Unreviewed build fix (with gcc 4.3)
+
+ * kjs/ustring.h: Properly forward declare operator== for UString and
+ the the concatenate functions inside the KJS namespace.
+
+2008-08-30 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - https://bugs.webkit.org/show_bug.cgi?id=20333
+ improve JavaScript speed when handling single-character strings
+
+ 1.035x as fast on SunSpider overall.
+ 1.127x as fast on SunSpider string tests.
+ 1.910x as fast on SunSpider string-base64 test.
+
+ * API/JSObjectRef.cpp:
+ (JSObjectMakeFunction): Removed unneeded explicit construction of UString.
+
+ * GNUmakefile.am: Added SmallStrings.h and SmallStrings.cpp.
+ * JavaScriptCore.pri: Ditto.
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ Ditto.
+ * JavaScriptCore.xcodeproj/project.pbxproj: Ditto.
+ * JavaScriptCoreSources.bkl: Ditto.
+
+ * JavaScriptCore.exp: Updated.
+
+ * VM/Machine.cpp:
+ (KJS::jsAddSlowCase): Changed to use a code path that doesn't involve
+ a UString constructor. This avoids an extra jump caused by the "in charge"
+ vs. "not in charge" constructors.
+ (KJS::jsAdd): Ditto.
+ (KJS::jsTypeStringForValue): Adopted jsNontrivialString.
+
+ * kjs/ArrayPrototype.cpp:
+ (KJS::arrayProtoFuncToString): Adopted jsEmptyString.
+ (KJS::arrayProtoFuncToLocaleString): Ditto.
+ (KJS::arrayProtoFuncJoin): Ditto.
+ * kjs/BooleanPrototype.cpp:
+ (KJS::booleanProtoFuncToString): Adopted jsNontrivialString.
+ * kjs/DateConstructor.cpp:
+ (KJS::callDate): Ditto.
+ * kjs/DatePrototype.cpp:
+ (KJS::formatLocaleDate): Adopted jsEmptyString and jsNontrivialString.
+ (KJS::dateProtoFuncToString): Ditto.
+ (KJS::dateProtoFuncToUTCString): Ditto.
+ (KJS::dateProtoFuncToDateString): Ditto.
+ (KJS::dateProtoFuncToTimeString): Ditto.
+ (KJS::dateProtoFuncToLocaleString): Ditto.
+ (KJS::dateProtoFuncToLocaleDateString): Ditto.
+ (KJS::dateProtoFuncToLocaleTimeString): Ditto.
+ (KJS::dateProtoFuncToGMTString): Ditto.
+
+ * kjs/ErrorPrototype.cpp:
+ (KJS::ErrorPrototype::ErrorPrototype): Ditto.
+ (KJS::errorProtoFuncToString): Ditto.
+
+ * kjs/JSGlobalData.h: Added SmallStrings.
+
+ * kjs/JSString.cpp:
+ (KJS::jsString): Eliminated the overload that takes a const char*.
+ Added code to use SmallStrings to get strings of small sizes rather
+ than creating a new JSString every time.
+ (KJS::jsSubstring): Added. Used when creating a string from a substring
+ to avoid creating a JSString in cases where the substring will end up
+ empty or as one character.
+ (KJS::jsOwnedString): Added the same code as in jsString.
+
+ * kjs/JSString.h: Added new functions jsEmptyString, jsSingleCharacterString,
+ jsSingleCharacterSubstring, jsSubstring, and jsNontrivialString for various
+ cases where we want to create JSString, and want special handling for small
+ strings.
+ (KJS::JSString::JSString): Added an overload that takes a PassRefPtr of
+ a UString::Rep so you don't have to construct a UString; PassRefPtr can be
+ more efficient.
+ (KJS::jsEmptyString): Added.
+ (KJS::jsSingleCharacterString): Added.
+ (KJS::jsSingleCharacterSubstring): Added.
+ (KJS::jsNontrivialString): Added.
+ (KJS::JSString::getIndex): Adopted jsSingleCharacterSubstring.
+ (KJS::JSString::getStringPropertySlot): Ditto.
+
+ * kjs/NumberPrototype.cpp:
+ (KJS::numberProtoFuncToFixed): Adopted jsNontrivialString.
+ (KJS::numberProtoFuncToExponential): Ditto.
+ (KJS::numberProtoFuncToPrecision): Ditto.
+
+ * kjs/ObjectPrototype.cpp:
+ (KJS::objectProtoFuncToLocaleString): Adopted toThisJSString.
+ (KJS::objectProtoFuncToString): Adopted jsNontrivialString.
+
+ * kjs/RegExpConstructor.cpp: Separated the lastInput value that's used
+ with the lastOvector to return matches from the input value that can be
+ changed via JavaScript. They will be equal in many cases, but not all.
+ (KJS::RegExpConstructor::performMatch): Set input.
+ (KJS::RegExpMatchesArray::RegExpMatchesArray): Ditto.
+ (KJS::RegExpMatchesArray::fillArrayInstance): Adopted jsSubstring. Also,
+ use input rather than lastInput in the appropriate place.
+ (KJS::RegExpConstructor::getBackref): Adopted jsSubstring and jsEmptyString.
+ Added code to handle the case where there is no backref -- before this
+ depended on range checking in UString::substr which is not present in
+ jsSubstring.
+ (KJS::RegExpConstructor::getLastParen): Ditto.
+ (KJS::RegExpConstructor::getLeftContext): Ditto.
+ (KJS::RegExpConstructor::getRightContext): Ditto.
+ (KJS::RegExpConstructor::getValueProperty): Use input rather than lastInput.
+ Also adopt jsEmptyString.
+ (KJS::RegExpConstructor::putValueProperty): Ditto.
+ (KJS::RegExpConstructor::input): Ditto.
+
+ * kjs/RegExpPrototype.cpp:
+ (KJS::regExpProtoFuncToString): Adopt jsNonTrivialString. Also changed to
+ use UString::append to append single characters rather than using += and
+ a C-style string.
+
+ * kjs/SmallStrings.cpp: Added.
+ (KJS::SmallStringsStorage::SmallStringsStorage): Construct the
+ buffer and UString::Rep for all 256 single-character strings for
+ the U+0000 through U+00FF. This covers all the values used in
+ the base64 test as well as most values seen elsewhere on the web
+ as well. It's possible that later we might fix this to only work
+ for U+0000 through U+007F but the others are used quite a bit in
+ the current version of the base64 test.
+ (KJS::SmallStringsStorage::~SmallStringsStorage): Free memory.
+ (KJS::SmallStrings::SmallStrings): Create a set of small strings,
+ initially not created; created later when they are used.
+ (KJS::SmallStrings::~SmallStrings): Deallocate. Not left compiler
+ generated because the SmallStringsStorage class's destructor needs
+ to be visible.
+ (KJS::SmallStrings::mark): Mark all the strings.
+ (KJS::SmallStrings::createEmptyString): Create a cell for the
+ empty string. Called only the first time.
+ (KJS::SmallStrings::createSingleCharacterString): Create a cell
+ for one of the single-character strings. Called only the first time.
+ * kjs/SmallStrings.h: Added.
+
+ * kjs/StringConstructor.cpp:
+ (KJS::stringFromCharCodeSlowCase): Factored out of strinFromCharCode.
+ Only used for cases where the caller does not pass exactly one argument.
+ (KJS::stringFromCharCode): Adopted jsSingleCharacterString.
+ (KJS::callStringConstructor): Adopted jsEmptyString.
+
+ * kjs/StringObject.cpp:
+ (KJS::StringObject::StringObject): Adopted jsEmptyString.
+
+ * kjs/StringPrototype.cpp:
+ (KJS::stringProtoFuncReplace): Adopted jsSubstring.
+ (KJS::stringProtoFuncCharAt): Adopted jsEmptyString and
+ jsSingleCharacterSubstring and also added a special case when the
+ index is an immediate number to avoid conversion to and from floating
+ point, since that's the common case.
+ (KJS::stringProtoFuncCharCodeAt): Ditto.
+ (KJS::stringProtoFuncMatch): Adopted jsSubstring and jsEmptyString.
+ (KJS::stringProtoFuncSlice): Adopted jsSubstring and
+ jsSingleCharacterSubstring. Also got rid of some unneeded locals and
+ removed unneeded code to set the length property of the array, since it
+ is automatically updated as values are added to the array.
+ (KJS::stringProtoFuncSplit): Adopted jsEmptyString.
+ (KJS::stringProtoFuncSubstr): Adopted jsSubstring.
+ (KJS::stringProtoFuncSubstring): Ditto.
+
+ * kjs/collector.cpp:
+ (KJS::Heap::collect): Added a call to mark SmallStrings.
+
+ * kjs/ustring.cpp:
+ (KJS::UString::expandedSize): Made this a static member function since
+ it doesn't need to look at any data members.
+ (KJS::UString::expandCapacity): Use a non-inline function, makeNull, to
+ set the rep to null in failure cases. This avoids adding a PIC branch for
+ the normal case when there is no failure.
+ (KJS::UString::expandPreCapacity): Ditto.
+ (KJS::UString::UString): Ditto.
+ (KJS::concatenate): Refactored the concatenation constructor into this
+ separate function. Calling the concatenation constructor was leading to
+ an extra branch because of the in-charge vs. not-in-charge versions not
+ both being inlined, and this was showing up as nearly 1% on Shark. Also
+ added a special case for when the second string is a single character,
+ since it's a common idiom to build up a string that way and we can do
+ things much more quickly, without involving memcpy for example. Also
+ adopted the non-inline function, nullRep, for the same reason given for
+ makeNull above.
+ (KJS::UString::append): Adopted makeNull for failure cases.
+ (KJS::UString::operator=): Ditto.
+ (KJS::UString::toDouble): Added a special case for converting single
+ character strings to numbers. We're doing this a ton of times while
+ running the base64 test.
+ (KJS::operator==): Added special cases so we can compare single-character
+ strings without calling memcmp. Later we might want to special case other
+ short lengths similarly.
+ (KJS::UString::makeNull): Added.
+ (KJS::UString::nullRep): Added.
+ * kjs/ustring.h: Added declarations for the nullRep and makeNull. Changed
+ expandedSize to be a static member function. Added a declaration of the
+ concatenate function. Removed the concatenation constructor. Rewrote
+ operator+ to use the concatenate function.
+
+2008-08-29 Anders Carlsson <andersca@apple.com>
+
+ Build fix.
+
+ * VM/Machine.cpp:
+ (KJS::getCPUTime):
+
+2008-08-29 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Darin Adler.
+
+ <rdar://problem/6174667>
+ When a machine is under heavy load, the Slow Script dialog often comes up many times and just gets in the way
+
+ Instead of using clock time, use the CPU time spent executing the current thread when
+ determining if the script has been running for too long.
+
+ * VM/Machine.cpp:
+ (KJS::getCPUTime):
+ (KJS::Machine::checkTimeout):
+
+2008-08-28 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Rubber-stamped by Sam Weinig.
+
+ Change 'term' to 'expr' in variable names to standardize terminology.
+
+ * kjs/nodes.cpp:
+ (KJS::BinaryOpNode::emitCode):
+ (KJS::ReverseBinaryOpNode::emitCode):
+ (KJS::ThrowableBinaryOpNode::emitCode):
+ * kjs/nodes.h:
+ (KJS::BinaryOpNode::BinaryOpNode):
+ (KJS::ReverseBinaryOpNode::ReverseBinaryOpNode):
+ (KJS::MultNode::):
+ (KJS::DivNode::):
+ (KJS::ModNode::):
+ (KJS::AddNode::):
+ (KJS::SubNode::):
+ (KJS::LeftShiftNode::):
+ (KJS::RightShiftNode::):
+ (KJS::UnsignedRightShiftNode::):
+ (KJS::LessNode::):
+ (KJS::GreaterNode::):
+ (KJS::LessEqNode::):
+ (KJS::GreaterEqNode::):
+ (KJS::ThrowableBinaryOpNode::):
+ (KJS::InstanceOfNode::):
+ (KJS::InNode::):
+ (KJS::EqualNode::):
+ (KJS::NotEqualNode::):
+ (KJS::StrictEqualNode::):
+ (KJS::NotStrictEqualNode::):
+ (KJS::BitAndNode::):
+ (KJS::BitOrNode::):
+ (KJS::BitXOrNode::):
+ * kjs/nodes2string.cpp:
+ (KJS::MultNode::streamTo):
+ (KJS::DivNode::streamTo):
+ (KJS::ModNode::streamTo):
+ (KJS::AddNode::streamTo):
+ (KJS::SubNode::streamTo):
+ (KJS::LeftShiftNode::streamTo):
+ (KJS::RightShiftNode::streamTo):
+ (KJS::UnsignedRightShiftNode::streamTo):
+ (KJS::LessNode::streamTo):
+ (KJS::GreaterNode::streamTo):
+ (KJS::LessEqNode::streamTo):
+ (KJS::GreaterEqNode::streamTo):
+ (KJS::InstanceOfNode::streamTo):
+ (KJS::InNode::streamTo):
+ (KJS::EqualNode::streamTo):
+ (KJS::NotEqualNode::streamTo):
+ (KJS::StrictEqualNode::streamTo):
+ (KJS::NotStrictEqualNode::streamTo):
+ (KJS::BitAndNode::streamTo):
+ (KJS::BitXOrNode::streamTo):
+ (KJS::BitOrNode::streamTo):
+
+2008-08-28 Alp Toker <alp@nuanti.com>
+
+ GTK+ dist/build fix. List newly added header files.
+
+ * GNUmakefile.am:
+
+2008-08-28 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Oliver Hunt.
+
+ Change to throw a ReferenceError at runtime instead of a ParseError
+ at parse time, when the left hand side expression of a for-in statement
+ is not an lvalue.
+
+ * kjs/grammar.y:
+ * kjs/nodes.cpp:
+ (KJS::ForInNode::emitCode):
+
+2008-08-28 Alexey Proskuryakov <ap@webkit.org>
+
+ Not reviewed, build fix (at least for OpenBSD, posssibly more).
+
+ https://bugs.webkit.org/show_bug.cgi?id=20545
+ missing #include <unistd.h> in JavaScriptCore/VM/SamplingTool.cpp
+
+ * VM/SamplingTool.cpp: add the missing include.
+
+2008-08-26 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Geoff and Cameron.
+
+ <rdar://problem/6174603> Hitting assertion in Register::codeBlock when
+ loading facebook (20516).
+
+ - This was a result of my line numbers change. After a host function is
+ called the stack does not get reset correctly.
+ - Oddly this also appears to be a slight speedup on SunSpider.
+
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+
+2008-08-26 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Geoff and Tim.
+
+ Export new API methods.
+
+ * JavaScriptCore.exp:
+
+2008-08-25 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Geoff, Tim and Mark.
+
+ <rdar://problem/6150623> JSProfiler: It would be nice if the profiles
+ in the console said what file and line number they came from
+ - Lay the foundation for getting line numbers and other data from the
+ JavaScript engine. With the cleanup in kjs/ExecState this is actually
+ a slight performance improvement.
+
+ * JavaScriptCore.exp: Export retrieveLastCaller() for WebCore.
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * VM/Machine.cpp: Now Host and JS functions set a call frame on the
+ exec state, so this and the profiler code were pulled out of the
+ branches.
+ (KJS::Machine::privateExecute):
+ (KJS::Machine::retrieveLastCaller): This get's the lineNumber, sourceID
+ and sourceURL for the previously called function.
+ * VM/Machine.h:
+ * kjs/ExecState.cpp: Remove references to JSFunction since it's not used
+ anywhere.
+ * kjs/ExecState.h:
+
+2008-08-25 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ Ensure that JSGlobalContextRelease() performs garbage collection, even if there are other
+ contexts in the current context's group.
+
+ This is only really necessary when the last reference is released, but there is no way to
+ determine that, and no harm in collecting slightly more often.
+
+ * API/JSContextRef.cpp: (JSGlobalContextRelease): Explicitly collect the heap if it is not
+ being destroyed.
+
+2008-08-24 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 20093: JSC shell does not clear exceptions after it executes toString on an expression
+ <https://bugs.webkit.org/show_bug.cgi?id=20093>
+
+ Clear exceptions after evaluating any code in the JSC shell. We do not
+ report exceptions that are caused by calling toString on the final
+ valued, but at least we avoid incorrect behaviour.
+
+ Also, print any exceptions that occurred while evaluating code at the
+ interactive prompt, not just while evaluating code from a file.
+
+ * kjs/Shell.cpp:
+ (runWithScripts):
+ (runInteractive):
+
+2008-08-24 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Oliver.
+
+ Remove an unnecessary RefPtr to a RegisterID.
+
+ * kjs/nodes.cpp:
+ (KJS::DeleteBracketNode::emitCode):
+
+2008-08-24 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Use the correct version number for when JSGlobalContextCreate was introduced.
+
+ * API/JSContextRef.h:
+
+2008-08-23 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Rubber-stamped by Mark Rowe.
+
+ Remove modelines.
+
+ * API/APICast.h:
+ * API/JSBase.cpp:
+ * API/JSCallbackConstructor.cpp:
+ * API/JSCallbackConstructor.h:
+ * API/JSCallbackFunction.cpp:
+ * API/JSCallbackFunction.h:
+ * API/JSCallbackObject.cpp:
+ * API/JSCallbackObject.h:
+ * API/JSCallbackObjectFunctions.h:
+ * API/JSClassRef.cpp:
+ * API/JSContextRef.cpp:
+ * API/JSObjectRef.cpp:
+ * API/JSProfilerPrivate.cpp:
+ * API/JSStringRef.cpp:
+ * API/JSStringRefBSTR.cpp:
+ * API/JSStringRefCF.cpp:
+ * API/JSValueRef.cpp:
+ * API/tests/JSNode.c:
+ * API/tests/JSNode.h:
+ * API/tests/JSNodeList.c:
+ * API/tests/JSNodeList.h:
+ * API/tests/Node.c:
+ * API/tests/Node.h:
+ * API/tests/NodeList.c:
+ * API/tests/NodeList.h:
+ * API/tests/minidom.c:
+ * API/tests/minidom.js:
+ * API/tests/testapi.c:
+ * API/tests/testapi.js:
+ * JavaScriptCore.pro:
+ * kjs/FunctionConstructor.h:
+ * kjs/FunctionPrototype.h:
+ * kjs/JSArray.h:
+ * kjs/JSString.h:
+ * kjs/JSWrapperObject.cpp:
+ * kjs/NumberConstructor.h:
+ * kjs/NumberObject.h:
+ * kjs/NumberPrototype.h:
+ * kjs/lexer.h:
+ * kjs/lookup.h:
+ * wtf/Assertions.cpp:
+ * wtf/Assertions.h:
+ * wtf/HashCountedSet.h:
+ * wtf/HashFunctions.h:
+ * wtf/HashIterators.h:
+ * wtf/HashMap.h:
+ * wtf/HashSet.h:
+ * wtf/HashTable.h:
+ * wtf/HashTraits.h:
+ * wtf/ListHashSet.h:
+ * wtf/ListRefPtr.h:
+ * wtf/Noncopyable.h:
+ * wtf/OwnArrayPtr.h:
+ * wtf/OwnPtr.h:
+ * wtf/PassRefPtr.h:
+ * wtf/Platform.h:
+ * wtf/RefPtr.h:
+ * wtf/RefPtrHashMap.h:
+ * wtf/RetainPtr.h:
+ * wtf/UnusedParam.h:
+ * wtf/Vector.h:
+ * wtf/VectorTraits.h:
+ * wtf/unicode/Unicode.h:
+ * wtf/unicode/icu/UnicodeIcu.h:
+
+2008-08-22 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Oliver.
+
+ Some cleanup to match our coding style.
+
+ * VM/CodeGenerator.h:
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+ * kjs/ExecState.cpp:
+ * kjs/ExecState.h:
+ * kjs/completion.h:
+ * kjs/identifier.cpp:
+ (KJS::Identifier::equal):
+ (KJS::CStringTranslator::hash):
+ (KJS::CStringTranslator::equal):
+ (KJS::CStringTranslator::translate):
+ (KJS::UCharBufferTranslator::equal):
+ (KJS::UCharBufferTranslator::translate):
+ (KJS::Identifier::remove):
+ * kjs/operations.h:
+
+2008-08-20 Alexey Proskuryakov <ap@webkit.org>
+
+ Windows build fix.
+
+ * API/WebKitAvailability.h: Define DEPRECATED_ATTRIBUTE.
+
+2008-08-19 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Geoff Garen.
+
+ Bring back shared JSGlobalData and implicit locking, because too many clients rely on it.
+
+ * kjs/JSGlobalData.cpp:
+ (KJS::JSGlobalData::~JSGlobalData):
+ (KJS::JSGlobalData::JSGlobalData): Re-add shared instance.
+ (KJS::JSGlobalData::sharedInstanceExists): Ditto.
+ (KJS::JSGlobalData::sharedInstance): Ditto.
+ (KJS::JSGlobalData::sharedInstanceInternal): Ditto.
+
+ * API/JSContextRef.h: Deprecated JSGlobalContextCreate(). Added a very conservative
+ description of its threading model (nothing is allowed).
+
+ * API/JSContextRef.cpp:
+ (JSGlobalContextCreate): Use shared JSGlobalData.
+ (JSGlobalContextCreateInGroup): Support passing NULL group to request a unique one.
+ (JSGlobalContextRetain): Added back locking.
+ (JSGlobalContextRelease): Ditto.
+ (JSContextGetGlobalObject): Ditto.
+
+ * API/tests/minidom.c: (main):
+ * API/tests/testapi.c: (main):
+ Switched to JSGlobalContextCreateInGroup() to avoid deprecation warnings.
+
+ * JavaScriptCore.exp: Re-added JSLock methods. Added JSGlobalContextCreateInGroup (d'oh!).
+
+ * API/JSBase.cpp:
+ (JSEvaluateScript):
+ (JSCheckScriptSyntax):
+ (JSGarbageCollect):
+ * API/JSCallbackConstructor.cpp:
+ (KJS::constructJSCallback):
+ * API/JSCallbackFunction.cpp:
+ (KJS::JSCallbackFunction::call):
+ * API/JSCallbackObjectFunctions.h:
+ (KJS::::init):
+ (KJS::::getOwnPropertySlot):
+ (KJS::::put):
+ (KJS::::deleteProperty):
+ (KJS::::construct):
+ (KJS::::hasInstance):
+ (KJS::::call):
+ (KJS::::getPropertyNames):
+ (KJS::::toNumber):
+ (KJS::::toString):
+ (KJS::::staticValueGetter):
+ (KJS::::callbackGetter):
+ * API/JSObjectRef.cpp:
+ (JSObjectMake):
+ (JSObjectMakeFunctionWithCallback):
+ (JSObjectMakeConstructor):
+ (JSObjectMakeFunction):
+ (JSObjectHasProperty):
+ (JSObjectGetProperty):
+ (JSObjectSetProperty):
+ (JSObjectGetPropertyAtIndex):
+ (JSObjectSetPropertyAtIndex):
+ (JSObjectDeleteProperty):
+ (JSObjectCallAsFunction):
+ (JSObjectCallAsConstructor):
+ (JSObjectCopyPropertyNames):
+ (JSPropertyNameArrayRelease):
+ (JSPropertyNameAccumulatorAddName):
+ * API/JSValueRef.cpp:
+ (JSValueIsEqual):
+ (JSValueIsInstanceOfConstructor):
+ (JSValueMakeNumber):
+ (JSValueMakeString):
+ (JSValueToNumber):
+ (JSValueToStringCopy):
+ (JSValueToObject):
+ (JSValueProtect):
+ (JSValueUnprotect):
+ * ForwardingHeaders/JavaScriptCore/JSLock.h: Added.
+ * GNUmakefile.am:
+ * JavaScriptCore.pri:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * JavaScriptCoreSources.bkl:
+ * kjs/AllInOneFile.cpp:
+ * kjs/JSGlobalData.h:
+ * kjs/JSGlobalObject.cpp:
+ (KJS::JSGlobalObject::~JSGlobalObject):
+ (KJS::JSGlobalObject::init):
+ * kjs/JSLock.cpp: Added.
+ (KJS::createJSLockCount):
+ (KJS::JSLock::lockCount):
+ (KJS::setLockCount):
+ (KJS::JSLock::JSLock):
+ (KJS::JSLock::lock):
+ (KJS::JSLock::unlock):
+ (KJS::JSLock::currentThreadIsHoldingLock):
+ (KJS::JSLock::DropAllLocks::DropAllLocks):
+ (KJS::JSLock::DropAllLocks::~DropAllLocks):
+ * kjs/JSLock.h: Added.
+ (KJS::JSLock::JSLock):
+ (KJS::JSLock::~JSLock):
+ * kjs/Shell.cpp:
+ (functionGC):
+ (jscmain):
+ * kjs/collector.cpp:
+ (KJS::Heap::~Heap):
+ (KJS::Heap::heapAllocate):
+ (KJS::Heap::setGCProtectNeedsLocking):
+ (KJS::Heap::protect):
+ (KJS::Heap::unprotect):
+ (KJS::Heap::collect):
+ * kjs/identifier.cpp:
+ * kjs/interpreter.cpp:
+ (KJS::Interpreter::checkSyntax):
+ (KJS::Interpreter::evaluate):
+ Re-added implicit locking.
+
+2008-08-19 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Tim and Mark.
+
+ Implement DTrace hooks for dashcode and instruments.
+
+ * API/JSProfilerPrivate.cpp: Added. Expose SPI so that profiling can be
+ turned on from a client. The DTrace probes were added within the
+ profiler mechanism for performance reasons so the profiler must be
+ started to enable tracing.
+ (JSStartProfiling):
+ (JSEndProfiling):
+ * API/JSProfilerPrivate.h: Added. Ditto.
+ * JavaScriptCore.exp: Exposing the start/stop methods to clients.
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * kjs/Tracing.d: Define the DTrace probes.
+ * kjs/Tracing.h: Ditto.
+ * profiler/ProfileGenerator.cpp: Implement the DTrace probes in the
+ profiler.
+ (KJS::ProfileGenerator::willExecute):
+ (KJS::ProfileGenerator::didExecute):
+
+2008-08-19 Steve Falkenburg <sfalken@apple.com>
+
+ Build fix.
+
+ * kjs/operations.cpp:
+ (KJS::equal):
+
+2008-08-18 Timothy Hatcher <timothy@apple.com>
+
+ Fix an assertion when generating a heavy profile because the
+ empty value and deleted value of CallIdentifier where equal.
+
+ https://bugs.webkit.org/show_bug.cgi?id=20439
+
+ Reviewed by Dan Bernstein.
+
+ * profiler/CallIdentifier.h: Make the emptyValue for CallIdentifier
+ use empty strings for URL and function name.
+
+2008-08-12 Darin Adler <darin@apple.com>
+
+ Reviewed by Geoff.
+
+ - eliminate JSValue::type()
+
+ This will make it slightly easier to change the JSImmediate design without
+ having to touch so many call sites.
+
+ SunSpider says this change is a wash (looked like a slight speedup, but not
+ statistically significant).
+
+ * API/JSStringRef.cpp: Removed include of JSType.h.
+ * API/JSValueRef.cpp: Removed include of JSType.h.
+ (JSValueGetType): Replaced use of JSValue::type() with
+ JSValue::is functions.
+
+ * JavaScriptCore.exp: Updated.
+
+ * VM/JSPropertyNameIterator.cpp: Removed type() implementation.
+ (KJS::JSPropertyNameIterator::toPrimitive): Changed to take
+ PreferredPrimitiveType argument instead of JSType.
+ * VM/JSPropertyNameIterator.h: Ditto.
+
+ * VM/Machine.cpp:
+ (KJS::fastIsNumber): Updated for name change.
+ (KJS::fastToInt32): Ditto.
+ (KJS::fastToUInt32): Ditto.
+ (KJS::jsAddSlowCase): Updated toPrimitive caller for change from
+ JSType to PreferredPrimitiveType.
+ (KJS::jsAdd): Replaced calls to JSValue::type() with calls to
+ JSValue::isString().
+ (KJS::jsTypeStringForValue): Replaced calls to JSValue::type()
+ with multiple calls to JSValue::is -- we could make this a
+ virtual function instead if we want to have faster performance.
+ (KJS::Machine::privateExecute): Renamed JSImmediate::toTruncatedUInt32
+ to JSImmediate::getTruncatedUInt32 for consistency with other functions.
+ Changed two calls of JSValue::type() to JSValue::isString().
+
+ * kjs/GetterSetter.cpp:
+ (KJS::GetterSetter::toPrimitive): Changed to take
+ PreferredPrimitiveType argument instead of JSType.
+ (KJS::GetterSetter::isGetterSetter): Added.
+ * kjs/GetterSetter.h:
+
+ * kjs/JSCell.cpp:
+ (KJS::JSCell::isString): Added.
+ (KJS::JSCell::isGetterSetter): Added.
+ (KJS::JSCell::isObject): Added.
+
+ * kjs/JSCell.h: Eliminated type function. Added isGetterSetter.
+ Made isString and isObject virtual. Changed toPrimitive to take
+ PreferredPrimitiveType argument instead of JSType.
+ (KJS::JSCell::isNumber): Use Heap::isNumber for faster performance.
+ (KJS::JSValue::isGetterSetter): Added.
+ (KJS::JSValue::toPrimitive): Changed to take
+ PreferredPrimitiveType argument instead of JSType.
+
+ * kjs/JSImmediate.h: Removed JSValue::type() and replaced
+ JSValue::toTruncatedUInt32 with JSValue::getTruncatedUInt32.
+ (KJS::JSImmediate::isEitherImmediate): Added.
+
+ * kjs/JSNotAnObject.cpp:
+ (KJS::JSNotAnObject::toPrimitive): Changed to take
+ PreferredPrimitiveType argument instead of JSType.
+ * kjs/JSNotAnObject.h: Ditto.
+ * kjs/JSNumberCell.cpp:
+ (KJS::JSNumberCell::toPrimitive): Ditto.
+ * kjs/JSNumberCell.h:
+ (KJS::JSNumberCell::toInt32): Renamed from fastToInt32. There's no
+ other "slow" version of this once you have a JSNumberCell, so there's
+ no need for "fast" in the name. It's a feature that this hides the
+ base class toInt32, which does the same job less efficiently (and has
+ an additional ExecState argument).
+ (KJS::JSNumberCell::toUInt32): Ditto.
+
+ * kjs/JSObject.cpp:
+ (KJS::callDefaultValueFunction): Use isGetterSetter instead of type.
+ (KJS::JSObject::getPrimitiveNumber): Use PreferredPrimitiveType.
+ (KJS::JSObject::defaultValue): Ditto.
+ (KJS::JSObject::defineGetter): Use isGetterSetter.
+ (KJS::JSObject::defineSetter): Ditto.
+ (KJS::JSObject::lookupGetter): Ditto.
+ (KJS::JSObject::lookupSetter): Ditto.
+ (KJS::JSObject::toNumber): Use PreferredPrimitiveType.
+ (KJS::JSObject::toString): Ditto.
+ (KJS::JSObject::isObject): Added.
+
+ * kjs/JSObject.h:
+ (KJS::JSObject::inherits): Call the isObject from JSCell; it's now
+ hidden by our override of isObject.
+ (KJS::JSObject::getOwnPropertySlotForWrite): Use isGetterSetter
+ instead of type.
+ (KJS::JSObject::getOwnPropertySlot): Ditto.
+ (KJS::JSObject::toPrimitive): Use PreferredPrimitiveType.
+
+ * kjs/JSString.cpp:
+ (KJS::JSString::toPrimitive): Use PreferredPrimitiveType.
+ (KJS::JSString::isString): Added.
+ * kjs/JSString.h: Ditto.
+
+ * kjs/JSValue.h: Removed type(), added isGetterSetter(). Added
+ PreferredPrimitiveType enum and used it as the argument for the
+ toPrimitive function.
+ (KJS::JSValue::getBoolean): Simplified a bit an removed a branch.
+
+ * kjs/collector.cpp:
+ (KJS::typeName): Changed to use JSCell::is functions instead of
+ calling JSCell::type.
+
+ * kjs/collector.h:
+ (KJS::Heap::isNumber): Renamed from fastIsNumber.
+
+ * kjs/nodes.h: Added now-needed include of JSType, since the type
+ is used here to record types of values in the tree.
+
+ * kjs/operations.cpp:
+ (KJS::equal): Rewrote to no longer depend on type().
+ (KJS::strictEqual): Ditto.
+
+2008-08-18 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Tim.
+
+ If there are no nodes in a profile all the time should be attributed to
+ (idle)
+
+ * profiler/Profile.cpp: If ther are no nodes make sure we still process
+ the head.
+ (KJS::Profile::forEach):
+ * profiler/ProfileGenerator.cpp: Remove some useless code.
+ (KJS::ProfileGenerator::stopProfiling):
+
+2008-08-18 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Maciej.
+
+ Make JSGlobalContextRetain/Release actually work.
+
+ * API/JSContextRef.cpp:
+ (JSGlobalContextRetain):
+ (JSGlobalContextRelease):
+ Ref/deref global data to give checking for globalData.refCount() some sense.
+
+ * API/tests/testapi.c: (main): Added a test for this bug.
+
+ * kjs/JSGlobalData.cpp:
+ (KJS::JSGlobalData::~JSGlobalData):
+ While checking for memory leaks, found that JSGlobalData::emptyList has changed to
+ a pointer, but it was not destructed, causing a huge leak in run-webkit-tests --threaded.
+
+2008-08-17 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Maciej.
+
+ Change the counting of constants so that preincrement and predecrement of
+ const local variables are considered unexpected loads.
+
+ * kjs/nodes.cpp:
+ (KJS::PrefixResolveNode::emitCode):
+ * kjs/nodes.h:
+ (KJS::ScopeNode::neededConstants):
+
+2008-08-17 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ <rdar://problem/6150322> In Gmail, a crash occurs at KJS::Machine::privateExecute() when applying list styling to text after a quote had been removed
+ <https://bugs.webkit.org/show_bug.cgi?id=20386>
+
+ This crash was caused by "depth()" incorrectly determining the scope depth
+ of a 0 depth function without a full scope chain. Because such a function
+ would not have an activation the depth function would return the scope depth
+ of the parent frame, thus triggering an incorrect unwind. Any subsequent
+ look up that walked the scope chain would result in incorrect behaviour,
+ leading to a crash or incorrect variable resolution. This can only actually
+ happen in try...finally statements as that's the only path that can result in
+ the need to unwind the scope chain, but not force the function to need a
+ full scope chain.
+
+ The fix is simply to check for this case before attempting to walk the scope chain.
+
+ * VM/Machine.cpp:
+ (KJS::depth):
+ (KJS::Machine::throwException):
+
+2008-08-17 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Maciej.
+
+ Bug 20419: Remove op_jless
+ <https://bugs.webkit.org/show_bug.cgi?id=20419>
+
+ Remove op_jless, which is rarely used now that we have op_loop_if_less.
+
+ * VM/CodeBlock.cpp:
+ (KJS::CodeBlock::dump):
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::emitJumpIfTrue):
+ * VM/Machine.cpp:
+ (KJS::Machine::privateExecute):
+ * VM/Opcode.h:
+
+2008-08-17 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+
+ Reviewed by Dan Bernstein.
+
+ Fix a typo in r35807 that is also causing build failures for
+ non-AllInOne builds.
+
+ * kjs/NumberConstructor.cpp:
+
+2008-08-17 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ Made room for a free word in JSCell.
+
+ SunSpider says no change.
+
+ I changed JSCallbackObjectData, Arguments, JSArray, and RegExpObject to
+ store auxiliary data in a secondary structure.
+
+ I changed InternalFunction to store the function's name in the property
+ map.
+
+ I changed JSGlobalObjectData to use a virtual destructor, so WebCore's
+ JSDOMWindowBaseData could inherit from it safely. (It's a strange design
+ for JSDOMWindowBase to allocate an object that JSGlobalObject deletes,
+ but that's really our only option, given the size constraint.)
+
+ I also added a bunch of compile-time ASSERTs, and removed lots of comments
+ in JSObject.h because they were often out of date, and they got in the
+ way of reading what was actually going on.
+
+ Also renamed JSArray::getLength to JSArray::length, to match our style
+ guidelines.
+
+2008-08-16 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Sped up property access for array.length and string.length by adding a
+ mechanism for returning a temporary value directly instead of returning
+ a pointer to a function that retrieves the value.
+
+ Also removed some unused cruft from PropertySlot.
+
+ SunSpider says 0.5% - 1.2% faster.
+
+ NOTE: This optimization is not a good idea in general, because it's
+ actually a pessimization in the case of resolve for assignment,
+ and it may get in the way of other optimizations in the future.
+
+2008-08-16 Dan Bernstein <mitz@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Disable dead code stripping in debug builds.
+
+ * Configurations/Base.xcconfig:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2008-08-15 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ <rdar://problem/6143072> FastMallocZone's enumeration code makes assumptions about handling of remote memory regions that overlap
+
+ * wtf/FastMalloc.cpp:
+ (WTF::TCMalloc_Central_FreeList::enumerateFreeObjects): Don't directly compare pointers mapped into the local process with
+ a pointer that has not been mapped. Instead, calculate a local address for the pointer and compare with that.
+ (WTF::TCMallocStats::FreeObjectFinder::findFreeObjects): Pass in the remote address of the central free list so that it can
+ be used when calculating local addresses.
+ (WTF::TCMallocStats::FastMallocZone::enumerate): Ditto.
+
+2008-08-15 Mark Rowe <mrowe@apple.com>
+
+ Rubber-stamped by Geoff Garen.
+
+ <rdar://problem/6139914> Please include a _debug version of JavaScriptCore framework
+
+ * Configurations/Base.xcconfig: Factor out the debug-only settings so that they can shared
+ between the Debug configuration and debug Production variant.
+ * JavaScriptCore.xcodeproj/project.pbxproj: Enable the debug variant.
+
+2008-08-15 Mark Rowe <mrowe@apple.com>
+
+ Fix the 64-bit build.
+
+ Add extra cast to avoid warnings about loss of precision when casting from
+ JSValue* to an integer type.
+
+ * kjs/JSImmediate.h:
+ (KJS::JSImmediate::intValue):
+ (KJS::JSImmediate::uintValue):
+
+2008-08-15 Alexey Proskuryakov <ap@webkit.org>
+
+ Still fixing Windows build.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make: Added OpaqueJSString
+ to yet another place.
+
+2008-08-15 Alexey Proskuryakov <ap@webkit.org>
+
+ Trying to fix non-Apple builds.
+
+ * ForwardingHeaders/JavaScriptCore/OpaqueJSString.h: Added.
+
+2008-08-15 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Allow JSImmediate to hold 31 bit signed integer immediate values. The low two bits of a
+ JSValue* are a tag, with the tag value 00 indicating the JSValue* is a pointer to a
+ JSCell. Non-zero tag values used to indicate that the JSValue* is not a real pointer,
+ but instead holds an immediate value encoded within the pointer. This patch changes the
+ encoding so both the tag values 01 and 11 indicate the value is a signed integer, allowing
+ a 31 bit value to be stored. All other immediates are tagged with the value 10, and
+ distinguished by a secondary tag.
+
+ Roughly +2% on SunSpider.
+
+ * kjs/JSImmediate.h: Encoding of JSImmediates has changed - see comment at head of file for
+ descption of new layout.
+
+2008-08-15 Alexey Proskuryakov <ap@webkit.org>
+
+ More build fixes.
+
+ * API/OpaqueJSString.h: Add a namespace to friend declaration to appease MSVC.
+ * API/JSStringRefCF.h: (JSStringCreateWithCFString) Cast UniChar* to UChar* explicitly.
+ * JavaScriptCore.exp: Added OpaqueJSString::create(const KJS::UString&) to fix WebCore build.
+
+2008-08-15 Alexey Proskuryakov <ap@webkit.org>
+
+ Build fix.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj: Marked OpaqueJSString as private
+
+ * kjs/identifier.cpp:
+ (KJS::Identifier::checkSameIdentifierTable):
+ * kjs/identifier.h:
+ (KJS::Identifier::add):
+ Since checkSameIdentifierTable is exported for debug build's sake, gcc wants it to be
+ non-inline in release builds, too.
+
+ * JavaScriptCore.exp: Don't export inline OpaqueJSString destructor.
+
+2008-08-15 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Geoff Garen.
+
+ JSStringRef is created context-free, but can get linked to one via an identifier table,
+ breaking an implicit API contract.
+
+ Made JSStringRef point to OpaqueJSString, which is a new string object separate from UString.
+
+ * API/APICast.h: Removed toRef/toJS conversions for JSStringRef, as this is no longer a
+ simple typecast.
+
+ * kjs/identifier.cpp:
+ (KJS::Identifier::checkSameIdentifierTable):
+ * kjs/identifier.h:
+ (KJS::Identifier::add):
+ (KJS::UString::checkSameIdentifierTable):
+ Added assertions to verify that an identifier is not being added to a different JSGlobalData.
+
+ * API/JSObjectRef.cpp:
+ (OpaqueJSPropertyNameArray::OpaqueJSPropertyNameArray): Changed OpaqueJSPropertyNameArray to
+ hold JSStringRefs. This is necessary to avoid having to construct (and leak) a new instance
+ in JSPropertyNameArrayGetNameAtIndex(), now that making a JSStringRef is not just a typecast.
+
+ * API/OpaqueJSString.cpp: Added.
+ (OpaqueJSString::create):
+ (OpaqueJSString::ustring):
+ (OpaqueJSString::identifier):
+ * API/OpaqueJSString.h: Added.
+ (OpaqueJSString::create):
+ (OpaqueJSString::characters):
+ (OpaqueJSString::length):
+ (OpaqueJSString::OpaqueJSString):
+ (OpaqueJSString::~OpaqueJSString):
+
+ * API/JSBase.cpp:
+ (JSEvaluateScript):
+ (JSCheckScriptSyntax):
+ * API/JSCallbackObjectFunctions.h:
+ (KJS::::getOwnPropertySlot):
+ (KJS::::put):
+ (KJS::::deleteProperty):
+ (KJS::::staticValueGetter):
+ (KJS::::callbackGetter):
+ * API/JSStringRef.cpp:
+ (JSStringCreateWithCharacters):
+ (JSStringCreateWithUTF8CString):
+ (JSStringRetain):
+ (JSStringRelease):
+ (JSStringGetLength):
+ (JSStringGetCharactersPtr):
+ (JSStringGetMaximumUTF8CStringSize):
+ (JSStringGetUTF8CString):
+ (JSStringIsEqual):
+ * API/JSStringRefCF.cpp:
+ (JSStringCreateWithCFString):
+ (JSStringCopyCFString):
+ * API/JSValueRef.cpp:
+ (JSValueMakeString):
+ (JSValueToStringCopy):
+ Updated to use OpaqueJSString.
+
+ * GNUmakefile.am:
+ * JavaScriptCore.exp:
+ * JavaScriptCore.pri:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * JavaScriptCoreSources.bkl:
+ Added OpaqueJSString.
+
+2008-08-14 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Tim.
+
+ <rdar://problem/6115819> Notify of profile in console
+ - Profiles now have a unique ID so that they can be linked to the
+ console message that announces that a profile completed.
+
+ * profiler/HeavyProfile.cpp:
+ (KJS::HeavyProfile::HeavyProfile):
+ * profiler/Profile.cpp:
+ (KJS::Profile::create):
+ (KJS::Profile::Profile):
+ * profiler/Profile.h:
+ (KJS::Profile::uid):
+ * profiler/ProfileGenerator.cpp:
+ (KJS::ProfileGenerator::create):
+ (KJS::ProfileGenerator::ProfileGenerator):
+ * profiler/ProfileGenerator.h:
+ * profiler/Profiler.cpp:
+ (KJS::Profiler::startProfiling):
+ * profiler/TreeProfile.cpp:
+ (KJS::TreeProfile::create):
+ (KJS::TreeProfile::TreeProfile):
+ * profiler/TreeProfile.h:
+
+2008-08-13 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Nixed a PIC branch from JSObject::getOwnPropertySlot, by forcing
+ fillGetterProperty, which references a global function pointer,
+ out-of-line.
+
+ .2% SunSpider speedup, 4.3% access-nbody speedup, 8.7% speedup on a
+ custom property access benchmark for objects with one property.
+
+ * kjs/JSObject.cpp:
+ (KJS::JSObject::fillGetterPropertySlot):
+
+2008-08-13 Alp Toker <alp@nuanti.com>
+
+ Reviewed by Eric Seidel.
+
+ https://bugs.webkit.org/show_bug.cgi?id=20349
+ WTF::initializeThreading() fails if threading is already initialized
+
+ Fix threading initialization logic to support cases where
+ g_thread_init() has already been called elsewhere.
+
+ Resolves database-related crashers reported in several applications.
+
+ * wtf/ThreadingGtk.cpp:
+ (WTF::initializeThreading):
+
+2008-08-13 Brad Hughes <bhughes@trolltech.com>
+
+ Reviewed by Simon.
+
+ Fix compiling of QtWebKit in release mode with the Intel C++ Compiler for Linux
+
+ The latest upgrade of the intel compiler allows us to compile all of
+ Qt with optimizations enabled (yay!).
+
+ * JavaScriptCore.pro:
+
+2008-08-12 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Add peephole optimisation to 'op_not... jfalse...' (eg. if(!...) )
+
+ This is a very slight win in sunspider, and a fairly substantial win
+ in hot code that does if(!...), etc.
+
+ * VM/CodeGenerator.cpp:
+ (KJS::CodeGenerator::retrieveLastUnaryOp):
+ (KJS::CodeGenerator::rewindBinaryOp):
+ (KJS::CodeGenerator::rewindUnaryOp):
+ (KJS::CodeGenerator::emitJumpIfFalse):
+ * VM/CodeGenerator.h:
+
+2008-08-12 Dan Bernstein <mitz@apple.com>
+
+ - JavaScriptCore part of <rdar://problem/6121636>
+ Make fast*alloc() abort() on failure and add "try" variants that
+ return NULL on failure.
+
+ Reviewed by Darin Adler.
+
+ * JavaScriptCore.exp: Exported tryFastCalloc().
+ * VM/RegisterFile.h:
+ (KJS::RegisterFile::RegisterFile): Removed an ASSERT().
+ * kjs/JSArray.cpp:
+ (KJS::JSArray::putSlowCase): Changed to use tryFastRealloc().
+ (KJS::JSArray::increaseVectorLength): Ditto.
+ * kjs/ustring.cpp:
+ (KJS::allocChars): Changed to use tryFastMalloc().
+ (KJS::reallocChars): Changed to use tryFastRealloc().
+ * wtf/FastMalloc.cpp:
+ (WTF::fastZeroedMalloc): Removed null checking of fastMalloc()'s result
+ and removed extra call to InvokeNewHook().
+ (WTF::tryFastZeroedMalloc): Added. Uses tryFastMalloc().
+ (WTF::tryFastMalloc): Renamed fastMalloc() to this.
+ (WTF::fastMalloc): Added. This version abort()s if allocation fails.
+ (WTF::tryFastCalloc): Renamed fastCalloc() to this.
+ (WTF::fastCalloc): Added. This version abort()s if allocation fails.
+ (WTF::tryFastRealloc): Renamed fastRealloc() to this.
+ (WTF::fastRealloc): Added. This version abort()s if allocation fails.
+ (WTF::do_malloc): Made this a function template. When the abortOnFailure
+ template parameter is set, the function abort()s on failure to allocate.
+ Otherwise, it sets errno to ENOMEM and returns zero.
+ (WTF::TCMallocStats::fastMalloc): Defined to abort() on failure.
+ (WTF::TCMallocStats::tryFastMalloc): Added. Does not abort() on
+ failure.
+ (WTF::TCMallocStats::fastCalloc): Defined to abort() on failure.
+ (WTF::TCMallocStats::tryFastCalloc): Added. Does not abort() on
+ failure.
+ (WTF::TCMallocStats::fastRealloc): Defined to abort() on failure.
+ (WTF::TCMallocStats::tryFastRealloc): Added. Does not abort() on
+ failure.
+ * wtf/FastMalloc.h: Declared the "try" variants.
+
+2008-08-11 Adam Roben <aroben@apple.com>
+
+ Move WTF::notFound into its own header so that it can be used
+ independently of Vector
+
+ Rubberstamped by Darin Adler.
+
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ Added NotFound.h to the project.
+ * wtf/NotFound.h: Added. Moved the notFound constant here...
+ * wtf/Vector.h: ...from here.
+
+2008-08-11 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Mark Rowe.
+
+ <rdar://problem/6130393> REGRESSION: PhotoBooth hangs after launching under TOT Webkit
+
+ * API/JSContextRef.cpp: (JSGlobalContextRelease): Corrected a comment.
+
+ * kjs/collector.cpp: (KJS::Heap::~Heap): Ensure that JSGlobalData is not deleted while
+ sweeping the heap.
+
+== Rolled over to ChangeLog-2008-08-10 ==
diff --git a/Source/JavaScriptCore/ChangeLog-2010-05-24 b/Source/JavaScriptCore/ChangeLog-2010-05-24
new file mode 100644
index 0000000..e6ec0f1
--- /dev/null
+++ b/Source/JavaScriptCore/ChangeLog-2010-05-24
@@ -0,0 +1,28211 @@
+2010-05-24 Gavin Barraclough <barraclough@apple.com>
+
+ Rubber Stamped by Sam Weinig.
+
+ Accidentally committed double write of codeblock in Interpreter.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+
+2010-05-24 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ https://bugs.webkit.org/show_bug.cgi?id=39583
+ Move creation of 'this' object from caller to callee in construction.
+
+ Presently the caller of a constructor is responsible for providing a this
+ object. Instead, move the object creation into a new op_create_this opcode,
+ planted in the head of the contructor bytecode for a function. Since the
+ prototype for the object is provided by performing a get_by_id on the callee,
+ also add a new get_callee opcode (this is used to get the callee JSFunction
+ into a register so that a normal get_by_id can be used).
+
+ Currently the caller is also responsible for detecting when op_construct is
+ performed on a JSFunction representing a host function, in which case an
+ exception is thrown – and this check currently takes place when constructing
+ the this object. Instead, mirroring the recent changes for non-host functions,
+ add a parallel code-path for native constructors to follow, with a thunk for
+ invoking native constructors provided by JITStubs, and a constructor-specific
+ NativeFunction on NativeExecutable. Provide an implementation of a host
+ constructor which will throw an exception.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::dump):
+ (JSC::CodeBlock::getByIdExceptionInfoForBytecodeOffset):
+ * bytecode/CodeBlock.h:
+ * bytecode/Opcode.h:
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::BytecodeGenerator):
+ (JSC::BytecodeGenerator::emitConstruct):
+ * bytecompiler/BytecodeGenerator.h:
+ (JSC::BytecodeGenerator::emitGetByIdExceptionInfo):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ * jit/JIT.h:
+ * jit/JITCall.cpp:
+ (JSC::JIT::compileOpCall):
+ (JSC::JIT::compileOpCallSlowCase):
+ * jit/JITCall32_64.cpp:
+ (JSC::JIT::compileOpCall):
+ (JSC::JIT::compileOpCallSlowCase):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ (JSC::JIT::privateCompileCTINativeCall):
+ (JSC::JIT::emit_op_neq_null):
+ (JSC::JIT::emit_op_convert_this):
+ (JSC::JIT::emit_op_get_callee):
+ (JSC::JIT::emit_op_create_this):
+ * jit/JITOpcodes32_64.cpp:
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ (JSC::JIT::privateCompileCTINativeCall):
+ (JSC::JIT::emit_op_get_callee):
+ (JSC::JIT::emit_op_create_this):
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+ (JSC::JITThunks::hostFunctionStub):
+ * jit/JITStubs.h:
+ (JSC::JITThunks::ctiNativeConstruct):
+ (JSC::):
+ * runtime/ExceptionHelpers.cpp:
+ (JSC::createNotAnObjectError):
+ * runtime/Executable.h:
+ (JSC::NativeExecutable::create):
+ (JSC::NativeExecutable::NativeExecutable):
+ * runtime/JSFunction.cpp:
+ (JSC::callHostFunctionAsConstructor):
+ * runtime/JSFunction.h:
+
+2010-05-23 Sam Weinig <sam@webkit.org>
+
+ Fix windows build.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-05-23 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Oliver Hunt.
+
+ Fix for https://bugs.webkit.org/show_bug.cgi?id=39575
+ Make JS DOMObject inherit from JSObjectWithGlobalObject instead of JSObject
+
+ Expose the global object stored in JSObjectWithGlobalObject.
+
+ * JavaScriptCore.exp:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * runtime/JSObjectWithGlobalObject.cpp:
+ (JSC::JSObjectWithGlobalObject::JSObjectWithGlobalObject):
+ (JSC::JSObjectWithGlobalObject::globalObject):
+ * runtime/JSObjectWithGlobalObject.h:
+
+2010-05-21 Oliver Hunt <oliver@apple.com>
+
+ "asm volatile" isn't valid outside of functions.
+
+ Reviewed by Gavin Barraclough.
+
+ * jit/JITStubs.cpp:
+
+2010-05-21 Gavin Barraclough <barraclough@apple.com>
+
+ Unreviewed build fix.
+
+ Interpreter fix following r59974.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+ * runtime/JSPropertyNameIterator.cpp:
+ (JSC::JSPropertyNameIterator::get):
+ * runtime/JSPropertyNameIterator.h:
+
+2010-05-21 Gavin Barraclough <barraclough@apple.com>
+
+ Rubber stamped by Oliver Hunt.
+
+ Interpreter fix following r59939.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+
+2010-05-21 David Levin <levin@chromium.org>
+
+ Unreviewed build fix.
+
+ * wtf/SizeLimits.cpp: Removed a check while I figure out how to write it properly.
+
+2010-05-21 David Levin <levin@chromium.org>
+
+ Reviewed by Darin Adler.
+
+ Enforce size constraints on various data structures in JavaScriptCore/wtf.
+ https://bugs.webkit.org/show_bug.cgi?id=39327
+
+ I only modified the default build for OSX and Chromium's build file to include WTFCompileAsserts.cpp
+ as those should be sufficient to catch regressions on the size of the data structures.
+
+ * JavaScriptCore.gypi: Added the WTFCompileAsserts.cpp file.
+ * JavaScriptCore.xcodeproj/project.pbxproj: Added the WTFCompileAsserts.cpp file.
+ * runtime/UString.cpp: Added a compile assert for UString size.
+ * wtf/SizeLimits.cpp: Added compile asserts for data structures that didn't have cpp files.
+ * wtf/text/StringImpl.cpp: Added a compile assert for StringImpl size.
+
+2010-05-21 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 39509 - Exceptions raised when JSString::value() is called not always properly thrown.
+ Missing some CHECK_FOR_EXCEPTION()s, cleanup NativeError construction (adding a property
+ via the prototype was inefficient, and whilst trivially true that the property is is not
+ a rope - and thus couldn't except - it would be hard to prove this).
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::callEval):
+ (JSC::Interpreter::privateExecute):
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+ * runtime/InternalFunction.cpp:
+ (JSC::InternalFunction::name):
+ (JSC::InternalFunction::displayName):
+ * runtime/JSFunction.cpp:
+ (JSC::JSFunction::name):
+ (JSC::JSFunction::displayName):
+ * runtime/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::reset):
+ * runtime/JSPropertyNameIterator.cpp:
+ * runtime/JSPropertyNameIterator.h:
+ * runtime/JSString.h:
+ (JSC::RopeBuilder::tryGetValue):
+ (JSC::JSString::getIndex):
+ * runtime/NativeErrorConstructor.cpp:
+ (JSC::NativeErrorConstructor::NativeErrorConstructor):
+ * runtime/NativeErrorConstructor.h:
+ * runtime/NativeErrorPrototype.cpp:
+ (JSC::NativeErrorPrototype::NativeErrorPrototype):
+ * runtime/NativeErrorPrototype.h:
+ * runtime/StringPrototype.cpp:
+ (JSC::stringProtoFuncReplace):
+
+2010-05-21 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by NOBODY (build fix).
+
+ Fix interpreter build.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+
+2010-05-21 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Split out JITCall32_64.cpp, and tightened up some #ifdefs in the hopes
+ of improving compile times.
+ https://bugs.webkit.org/show_bug.cgi?id=39507
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * jit/JIT.cpp:
+ * jit/JITArithmetic.cpp:
+ * jit/JITArithmetic32_64.cpp:
+ * jit/JITCall.cpp:
+ * jit/JITCall32_64.cpp: Copied from jit/JITCall.cpp.
+ * jit/JITOpcodes.cpp:
+ * jit/JITOpcodes32_64.cpp:
+ * jit/JITPropertyAccess.cpp:
+ * jit/JITPropertyAccess32_64.cpp:
+ * jit/JITStubs.cpp:
+
+2010-05-21 Csaba Osztrogonác <ossy@webkit.org>
+
+ Unreviewed buildfix for Qt after r59941.
+
+ * JavaScriptCore.pro: missing runtime/JSObjectWithGlobalObject.cpp added to SOURCES.
+
+2010-05-21 Oliver Hunt <oliver@apple.com>
+
+ Windows build fix #3
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-05-21 Oliver Hunt <oliver@apple.com>
+
+ Windows build fix #2
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-05-21 Oliver Hunt <oliver@apple.com>
+
+ Windows build fix #1
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-05-21 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ All callable objects should have a global object reference
+ https://bugs.webkit.org/show_bug.cgi?id=39495
+
+ All objects that may ever return a value other CallTypeNone
+ or ConstructTypeNone now get a global object in their constructor
+ and store that in their first anonymous slot. We add a new type
+ JSObjectWithGlobalObject to allow us to share this logic as much
+ as possible, however some objects have specific inheritance
+ requirements so we can't just use it universally.
+
+ To enforce this requirement JSValue::getCallData and getConstructData
+ make use of a new "isValidCallee" function to assert that any object
+ that returns a value other than CallType/ConstructTypeNone has a
+ global object in anonymous slot 0.
+
+ In order to ensure that static function slots are converted into
+ function objects with the correct global object, all prototype objects
+ and other classes with static function slots also gain a global object
+ reference. Happily this fixes the long standing issue where host
+ function objects get a prototype from the lexical global object of the
+ first function that calls them, instead of the global object that they
+ are defined on.
+
+ * API/JSCallbackConstructor.cpp:
+ (JSC::JSCallbackConstructor::JSCallbackConstructor):
+ * API/JSCallbackConstructor.h:
+ * API/JSCallbackFunction.cpp:
+ (JSC::JSCallbackFunction::JSCallbackFunction):
+ * API/JSCallbackFunction.h:
+ * API/JSCallbackObject.cpp:
+ (JSC::):
+ * API/JSCallbackObject.h:
+ * API/JSCallbackObjectFunctions.h:
+ (JSC::::JSCallbackObject):
+ (JSC::::staticFunctionGetter):
+ * API/JSClassRef.cpp:
+ (OpaqueJSClass::prototype):
+ * API/JSContextRef.cpp:
+ * API/JSObjectRef.cpp:
+ (JSObjectMake):
+ (JSObjectMakeFunctionWithCallback):
+ (JSObjectMakeConstructor):
+ (JSObjectGetPrivate):
+ (JSObjectSetPrivate):
+ (JSObjectGetPrivateProperty):
+ (JSObjectSetPrivateProperty):
+ (JSObjectDeletePrivateProperty):
+ * API/JSValueRef.cpp:
+ (JSValueIsObjectOfClass):
+ * API/JSWeakObjectMapRefPrivate.cpp:
+ * CMakeLists.txt:
+ * GNUmakefile.am:
+ * JavaScriptCore.exp:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+ * jsc.cpp:
+ (GlobalObject::GlobalObject):
+ * runtime/ArrayConstructor.cpp:
+ (JSC::ArrayConstructor::ArrayConstructor):
+ * runtime/ArrayConstructor.h:
+ * runtime/ArrayPrototype.cpp:
+ (JSC::ArrayPrototype::ArrayPrototype):
+ * runtime/ArrayPrototype.h:
+ (JSC::ArrayPrototype::createStructure):
+ * runtime/BooleanConstructor.cpp:
+ (JSC::BooleanConstructor::BooleanConstructor):
+ * runtime/BooleanConstructor.h:
+ * runtime/BooleanPrototype.cpp:
+ (JSC::BooleanPrototype::BooleanPrototype):
+ * runtime/BooleanPrototype.h:
+ * runtime/DateConstructor.cpp:
+ (JSC::DateConstructor::DateConstructor):
+ * runtime/DateConstructor.h:
+ * runtime/DatePrototype.cpp:
+ (JSC::DatePrototype::DatePrototype):
+ * runtime/DatePrototype.h:
+ * runtime/ErrorConstructor.cpp:
+ (JSC::ErrorConstructor::ErrorConstructor):
+ * runtime/ErrorConstructor.h:
+ * runtime/ErrorPrototype.cpp:
+ (JSC::ErrorPrototype::ErrorPrototype):
+ * runtime/ErrorPrototype.h:
+ * runtime/FunctionConstructor.cpp:
+ (JSC::FunctionConstructor::FunctionConstructor):
+ * runtime/FunctionConstructor.h:
+ * runtime/FunctionPrototype.cpp:
+ (JSC::FunctionPrototype::FunctionPrototype):
+ (JSC::FunctionPrototype::addFunctionProperties):
+ * runtime/FunctionPrototype.h:
+ * runtime/GlobalEvalFunction.cpp:
+ (JSC::GlobalEvalFunction::GlobalEvalFunction):
+ * runtime/GlobalEvalFunction.h:
+ * runtime/InternalFunction.cpp:
+ (JSC::InternalFunction::InternalFunction):
+ * runtime/InternalFunction.h:
+ * runtime/JSCell.h:
+ (JSC::JSValue::getCallData):
+ (JSC::JSValue::getConstructData):
+ * runtime/JSFunction.cpp:
+ (JSC::JSFunction::JSFunction):
+ * runtime/JSFunction.h:
+ * runtime/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::reset):
+ * runtime/JSGlobalObject.h:
+ (JSC::JSGlobalObject::JSGlobalObject):
+ * runtime/JSONObject.cpp:
+ (JSC::JSONObject::JSONObject):
+ * runtime/JSONObject.h:
+ * runtime/JSObject.h:
+ * runtime/JSObjectWithGlobalObject.cpp: Added.
+ (JSC::JSObjectWithGlobalObject::JSObjectWithGlobalObject):
+ * runtime/JSObjectWithGlobalObject.h: Added.
+ (JSC::JSObjectWithGlobalObject::createStructure):
+ (JSC::JSObjectWithGlobalObject::JSObjectWithGlobalObject):
+ * runtime/JSValue.cpp:
+ (JSC::JSValue::isValidCallee):
+ * runtime/JSValue.h:
+ * runtime/Lookup.cpp:
+ (JSC::setUpStaticFunctionSlot):
+ * runtime/MathObject.cpp:
+ (JSC::MathObject::MathObject):
+ * runtime/MathObject.h:
+ * runtime/NativeErrorConstructor.cpp:
+ (JSC::NativeErrorConstructor::NativeErrorConstructor):
+ * runtime/NativeErrorConstructor.h:
+ * runtime/NativeErrorPrototype.cpp:
+ (JSC::NativeErrorPrototype::NativeErrorPrototype):
+ * runtime/NativeErrorPrototype.h:
+ * runtime/NumberConstructor.cpp:
+ (JSC::NumberConstructor::NumberConstructor):
+ * runtime/NumberConstructor.h:
+ * runtime/NumberPrototype.cpp:
+ (JSC::NumberPrototype::NumberPrototype):
+ * runtime/NumberPrototype.h:
+ * runtime/ObjectConstructor.cpp:
+ (JSC::ObjectConstructor::ObjectConstructor):
+ * runtime/ObjectConstructor.h:
+ * runtime/ObjectPrototype.cpp:
+ (JSC::ObjectPrototype::ObjectPrototype):
+ * runtime/ObjectPrototype.h:
+ * runtime/PrototypeFunction.cpp:
+ (JSC::PrototypeFunction::PrototypeFunction):
+ * runtime/PrototypeFunction.h:
+ * runtime/RegExpConstructor.cpp:
+ (JSC::RegExpConstructor::RegExpConstructor):
+ (JSC::constructRegExp):
+ * runtime/RegExpConstructor.h:
+ * runtime/RegExpObject.cpp:
+ (JSC::RegExpObject::RegExpObject):
+ * runtime/RegExpObject.h:
+ * runtime/RegExpPrototype.cpp:
+ (JSC::RegExpPrototype::RegExpPrototype):
+ * runtime/RegExpPrototype.h:
+ * runtime/StringConstructor.cpp:
+ (JSC::StringConstructor::StringConstructor):
+ * runtime/StringConstructor.h:
+ * runtime/StringPrototype.cpp:
+ (JSC::StringPrototype::StringPrototype):
+ * runtime/StringPrototype.h:
+
+2010-05-21 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Removed the unused entry in the CallFrame
+ https://bugs.webkit.org/show_bug.cgi?id=39470
+
+ Removed the unused entry in the CallFrame, and reordered CallFrame
+ writes on the hot path to be in forwards order.
+
+ SunSpider says 0.3% faster.
+
+ * interpreter/RegisterFile.h:
+ (JSC::RegisterFile::):
+ * jit/JITCall.cpp:
+ (JSC::JIT::compileOpCall):
+
+2010-05-21 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Split the QScriptValue autotest into smaller chunks.
+
+ File tst_qscriptvalue_generated.cpp was huge and it was difficult to compile
+ it with MSVS2008, because of the code optimization.
+
+ Tests were splited into a few files for better use of distributed
+ compilation.
+ Repeated calls to insert() and operator<<() where replaced by loops,
+ that should reduce time of code optimizing.
+
+ New files were generated by the same application, test logic wasn't changed.
+
+ [Qt] The QScriptValue autotest should be refactored.
+ https://bugs.webkit.org/show_bug.cgi?id=38987
+
+ * qt/tests/qscriptvalue/qscriptvalue.pro:
+ * qt/tests/qscriptvalue/tst_qscriptvalue.h:
+ * qt/tests/qscriptvalue/tst_qscriptvalue_generated.cpp: Removed.
+ * qt/tests/qscriptvalue/tst_qscriptvalue_generated_init.cpp: Added.
+ (tst_QScriptValue::initScriptValues):
+ * qt/tests/qscriptvalue/tst_qscriptvalue_generated_istype.cpp: Added.
+ (tst_QScriptValue::isValid_initData):
+ (tst_QScriptValue::isValid_makeData):
+ (tst_QScriptValue::isValid_test):
+ (tst_QScriptValue::isBool_initData):
+ (tst_QScriptValue::isBool_makeData):
+ (tst_QScriptValue::isBool_test):
+ (tst_QScriptValue::isBoolean_initData):
+ (tst_QScriptValue::isBoolean_makeData):
+ (tst_QScriptValue::isBoolean_test):
+ (tst_QScriptValue::isNumber_initData):
+ (tst_QScriptValue::isNumber_makeData):
+ (tst_QScriptValue::isNumber_test):
+ (tst_QScriptValue::isFunction_initData):
+ (tst_QScriptValue::isFunction_makeData):
+ (tst_QScriptValue::isFunction_test):
+ (tst_QScriptValue::isNull_initData):
+ (tst_QScriptValue::isNull_makeData):
+ (tst_QScriptValue::isNull_test):
+ (tst_QScriptValue::isString_initData):
+ (tst_QScriptValue::isString_makeData):
+ (tst_QScriptValue::isString_test):
+ (tst_QScriptValue::isUndefined_initData):
+ (tst_QScriptValue::isUndefined_makeData):
+ (tst_QScriptValue::isUndefined_test):
+ (tst_QScriptValue::isObject_initData):
+ (tst_QScriptValue::isObject_makeData):
+ (tst_QScriptValue::isObject_test):
+ * qt/tests/qscriptvalue/tst_qscriptvalue_generated_totype.cpp: Added.
+ (tst_QScriptValue::toString_initData):
+ (tst_QScriptValue::toString_makeData):
+ (tst_QScriptValue::toString_test):
+ (tst_QScriptValue::toNumber_initData):
+ (tst_QScriptValue::toNumber_makeData):
+ (tst_QScriptValue::toNumber_test):
+ (tst_QScriptValue::toBool_initData):
+ (tst_QScriptValue::toBool_makeData):
+ (tst_QScriptValue::toBool_test):
+ (tst_QScriptValue::toBoolean_initData):
+ (tst_QScriptValue::toBoolean_makeData):
+ (tst_QScriptValue::toBoolean_test):
+ (tst_QScriptValue::toInteger_initData):
+ (tst_QScriptValue::toInteger_makeData):
+ (tst_QScriptValue::toInteger_test):
+ (tst_QScriptValue::toInt32_initData):
+ (tst_QScriptValue::toInt32_makeData):
+ (tst_QScriptValue::toInt32_test):
+ (tst_QScriptValue::toUInt32_initData):
+ (tst_QScriptValue::toUInt32_makeData):
+ (tst_QScriptValue::toUInt32_test):
+ (tst_QScriptValue::toUInt16_initData):
+ (tst_QScriptValue::toUInt16_makeData):
+ (tst_QScriptValue::toUInt16_test):
+
+2010-05-21 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Eric Seidel.
+
+ Add COMPILER(MSVC) guard for strnstr
+ https://bugs.webkit.org/show_bug.cgi?id=39397
+
+ BREWMP uses MSVC for simulator build, but it is not OS(WINDOWS).
+ Add COMPILER(MSVC) guard for strnstr.
+
+ * wtf/StringExtras.h:
+
+2010-05-21 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Eric Seidel.
+
+ [BREWMP] Add !PLATFORM(BREWMP) guard for isMainThread
+ https://bugs.webkit.org/show_bug.cgi?id=39396
+
+ BREWMP sets ENABLE(SINGLE_THREADED), so it uses isMainThread from ThreadingNone.cpp.
+ Exclude isMainThread in MainThread.cpp.
+
+ * wtf/MainThread.cpp:
+
+2010-05-20 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Eric Seidel.
+
+ [BREWMP] Use skia as BREW MP's graphics backend.
+ https://bugs.webkit.org/show_bug.cgi?id=39407
+
+ Define WTF_PLATFORM_SKIA=1 for BREW MP.
+
+ * wtf/Platform.h:
+
+2010-05-20 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Beth Dakin.
+
+ Fixed naming mixup: it's op_call_put_result, not ret_result.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::dump):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+
+2010-05-20 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Whittling away at CodeBlock use: Removed a little wonkiness in closure lookup
+ https://bugs.webkit.org/show_bug.cgi?id=39444
+
+ Calculate all lookup depths at compile time. I'm not sure why we couldn't
+ do this before, but whatever the reason, it seems to be gone now.
+
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::findScopedProperty):
+ * bytecompiler/BytecodeGenerator.h:
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::resolveSkip):
+ (JSC::Interpreter::resolveGlobalDynamic):
+ (JSC::Interpreter::privateExecute):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_get_scoped_var):
+ (JSC::JIT::emit_op_put_scoped_var):
+ (JSC::JIT::emit_op_resolve_skip):
+ (JSC::JIT::emit_op_resolve_global_dynamic):
+ (JSC::JIT::emitSlow_op_resolve_global_dynamic):
+ * jit/JITOpcodes32_64.cpp:
+ (JSC::JIT::emit_op_get_scoped_var):
+ (JSC::JIT::emit_op_put_scoped_var):
+ (JSC::JIT::emit_op_resolve_skip):
+
+2010-05-20 Darin Adler <darin@apple.com>
+
+ Reviewed by Eric Seidel.
+
+ Fix warnings seen on the buildbots today
+ https://bugs.webkit.org/show_bug.cgi?id=39368
+
+ * profiler/ProfileNode.cpp:
+ (JSC::getCount): Removed unneeded initialization of global variable.
+ These are all initialized to zero anyway, so no need to try to initialize
+ it and get a warning.
+
+ * wtf/CurrentTime.cpp:
+ (WTF::currentTime): Removed unused global variable.
+
+2010-05-20 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Removed some reliance on callFame[CodeBlock] by storing CodeBlock in a
+ local variable in the Interpreter.
+ https://bugs.webkit.org/show_bug.cgi?id=39447
+
+ Small speedup on SunSpider in Interpreter mode.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+ * jsc.cpp:
+ * wtf/Platform.h:
+
+2010-05-19 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 39408 - Unify JIT/interpreter return behaviour.
+
+ Presently the JIT and the interpreter have differing implementations in how
+ they handle storing the result of a function call back to the register file.
+ In both cases the op_call ( / _eval / _varargs / op_construct) opcode has an
+ operand indicating the VM register in which the result should be stored.
+ The JIT plants code after the call to store the result, so the value will be
+ stored as soon as the callee has returned. In the interpreter the call
+ passes the return value register id into the callee via the callee callframe,
+ and the callee is responsible for writing the result back into its callers
+ register file after it has restored the parents callframe pointer, but before
+ returning.
+
+ Instead, move the task of writing the call result to the register file into a
+ new opcode (op_call_put_result), and after returning the callee should leave
+ the return value in a canonical location. In the case of the interpreter,
+ this canonical location is a local variable in privateExecute
+ (functionReturnValue), in the case of the JIT this is the normal return value
+ registers (regT0, or regT1:regT0 in JSVALUE32_64). op_call_put_result stores
+ the result from the canonical location to the registerfile.
+
+ In addition to unifying JIT & interpreter behaviour this change allows us to
+ remove a slot from the callframe, omit the write of the result where the
+ return value from the call is not used, and provides a 2% speedup on sunspider
+ in the interpreter.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::dump):
+ * bytecode/Opcode.h:
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::emitCall):
+ (JSC::BytecodeGenerator::emitCallVarargs):
+ (JSC::BytecodeGenerator::emitConstruct):
+ * bytecompiler/BytecodeGenerator.h:
+ (JSC::BytecodeGenerator::finalDestinationOrIgnored):
+ * bytecompiler/NodesCodegen.cpp:
+ (JSC::NewExprNode::emitBytecode):
+ (JSC::FunctionCallValueNode::emitBytecode):
+ (JSC::FunctionCallResolveNode::emitBytecode):
+ (JSC::FunctionCallBracketNode::emitBytecode):
+ (JSC::FunctionCallDotNode::emitBytecode):
+ (JSC::CallFunctionCallDotNode::emitBytecode):
+ (JSC::ApplyFunctionCallDotNode::emitBytecode):
+ * interpreter/CallFrame.h:
+ (JSC::ExecState::init):
+ (JSC::ExecState::noCaller):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::dumpRegisters):
+ (JSC::Interpreter::throwException):
+ (JSC::Interpreter::privateExecute):
+ * interpreter/RegisterFile.h:
+ (JSC::RegisterFile::):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ * jit/JIT.h:
+ * jit/JITCall.cpp:
+ (JSC::JIT::compileOpCallSetupArgs):
+ (JSC::JIT::compileOpConstructSetupArgs):
+ (JSC::JIT::emit_op_call_put_result):
+ (JSC::JIT::compileOpCallVarargs):
+ (JSC::JIT::compileOpCallVarargsSlowCase):
+ (JSC::JIT::compileOpCall):
+ (JSC::JIT::compileOpCallSlowCase):
+ (JSC::JIT::compileOpCallVarargsSetupArgs):
+
+2010-05-20 Steve Block <steveblock@google.com>
+
+ Reviewed by Jeremy Orlow.
+
+ Provide bindings for DeviceOrientation
+ https://bugs.webkit.org/show_bug.cgi?id=39210
+
+ Adds ENABLE_DEVICE_ORIENTATION to XCode project file, always disabled.
+
+ * Configurations/FeatureDefines.xcconfig:
+
+2010-05-19 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Errk! rename op_constructor_ret as requested in review of Bug 39399.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::dump):
+ * bytecode/Opcode.h:
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::emitReturn):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ * jit/JIT.h:
+ * jit/JITCall.cpp:
+ (JSC::JIT::emit_op_ret_object_or_this):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_ret_object_or_this):
+
+2010-05-19 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Bug 39399 - Move responsibility for verifying constructors return objects from the caller to the callee.
+
+ This is a necessary step to move object creation from caller to callee.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::dump):
+ * bytecode/Opcode.h:
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::BytecodeGenerator):
+ (JSC::BytecodeGenerator::emitReturn):
+ (JSC::BytecodeGenerator::emitConstruct):
+ * bytecompiler/BytecodeGenerator.h:
+ (JSC::BytecodeGenerator::isConstructor):
+ * bytecompiler/NodesCodegen.cpp:
+ (JSC::FunctionBodyNode::emitBytecode):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ (JSC::JIT::privateCompileSlowCases):
+ * jit/JIT.h:
+ * jit/JITCall.cpp:
+ (JSC::JIT::emit_op_constructor_ret):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_constructor_ret):
+
+2010-05-19 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by NOBODY (build fix).
+
+ Fix windows build II.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-05-19 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by NOBODY (build fix).
+
+ Fix windows build.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-05-19 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 39393 - JSFunction need not be a subclass of InternalFunction.
+
+ re-landing r59800.
+
+ * JavaScriptCore.exp:
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::retrieveCaller):
+ (JSC::Interpreter::findFunctionCallFrame):
+ * interpreter/Interpreter.h:
+ * profiler/Profiler.cpp:
+ (JSC::Profiler::createCallIdentifier):
+ * runtime/FunctionPrototype.cpp:
+ (JSC::functionProtoFuncToString):
+ * runtime/JSFunction.cpp:
+ (JSC::):
+ (JSC::JSFunction::JSFunction):
+ (JSC::JSFunction::name):
+ (JSC::JSFunction::displayName):
+ (JSC::JSFunction::calculatedDisplayName):
+ * runtime/JSFunction.h:
+ * runtime/JSObject.cpp:
+ (JSC::JSObject::putDirectFunction):
+ (JSC::JSObject::putDirectFunctionWithoutTransition):
+ * runtime/JSObject.h:
+ * runtime/Lookup.cpp:
+ (JSC::setUpStaticFunctionSlot):
+
+2010-05-19 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by NOBODY (build fix).
+
+ Reverting r59800, this b0rked stuff.
+
+ * JavaScriptCore.exp:
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::retrieveCaller):
+ (JSC::Interpreter::findFunctionCallFrame):
+ * interpreter/Interpreter.h:
+ * profiler/Profiler.cpp:
+ (JSC::Profiler::createCallIdentifier):
+ * runtime/FunctionPrototype.cpp:
+ (JSC::functionProtoFuncToString):
+ * runtime/JSFunction.cpp:
+ (JSC::):
+ (JSC::JSFunction::JSFunction):
+ * runtime/JSFunction.h:
+ * runtime/JSObject.cpp:
+ * runtime/JSObject.h:
+ * runtime/Lookup.cpp:
+ (JSC::setUpStaticFunctionSlot):
+
+2010-05-19 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 39393 - JSFunction need not be a subclass of InternalFunction.
+
+ This may prevent us from introducing a more useful parent class to
+ JSFunction, e.g. a JSObject that holds an executable, which could
+ also reference an eval or program executable.
+
+ * JavaScriptCore.exp:
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::retrieveCaller):
+ (JSC::Interpreter::findFunctionCallFrame):
+ * interpreter/Interpreter.h:
+ * profiler/Profiler.cpp:
+ (JSC::Profiler::createCallIdentifier):
+ * runtime/FunctionPrototype.cpp:
+ (JSC::functionProtoFuncToString):
+ * runtime/JSFunction.cpp:
+ (JSC::):
+ (JSC::JSFunction::JSFunction):
+ (JSC::JSFunction::name):
+ (JSC::JSFunction::displayName):
+ (JSC::JSFunction::calculatedDisplayName):
+ * runtime/JSFunction.h:
+ * runtime/JSObject.cpp:
+ (JSC::JSObject::putDirectFunction):
+ (JSC::JSObject::putDirectFunctionWithoutTransition):
+ * runtime/JSObject.h:
+ * runtime/Lookup.cpp:
+ (JSC::setUpStaticFunctionSlot):
+
+2010-05-19 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ emitJumpIfNotJSCell should special case constant immediate values
+ https://bugs.webkit.org/show_bug.cgi?id=39392
+ <rdar://problem/8001324>
+
+ Make emitJumpSlowCaseIfNotJSCell special case constant immediate
+ values, in addition to the immediate JSCell optimisation.
+
+ Also add assertions to make sure no one else produces code that
+ attempts to load constants from the register file.
+
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::emitJumpSlowCaseIfNotJSCell):
+ * jit/JSInterfaceJIT.h:
+ (JSC::JSInterfaceJIT::emitJumpIfNotJSCell):
+ (JSC::JSInterfaceJIT::emitLoadInt32):
+ (JSC::JSInterfaceJIT::tagFor):
+ (JSC::JSInterfaceJIT::payloadFor):
+ (JSC::JSInterfaceJIT::emitLoadDouble):
+ (JSC::JSInterfaceJIT::addressFor):
+ * jit/ThunkGenerators.cpp:
+
+2010-05-19 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Slight refactoring to CodeBlock bytecode access
+ https://bugs.webkit.org/show_bug.cgi?id=39384
+
+ * bytecode/CodeBlock.h:
+ (JSC::CodeBlock::bytecodeOffset):
+ * interpreter/CallFrame.h:
+ (JSC::ExecState::returnPC):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::unwindCallFrame):
+ (JSC::Interpreter::retrieveLastCaller): Moved bytecode access into a
+ CodeBlock helper function. Changed CallFrame to accurately represent
+ how the returnPC is stored in JIT vs Interpreter.
+
+2010-05-19 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Don't build the Interpreter into JIT builds.
+ https://bugs.webkit.org/show_bug.cgi?id=39373
+
+ SunSpider says no change.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+ * interpreter/Interpreter.h:
+ * wtf/Platform.h:
+
+2010-05-19 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Standardized naming: "bytecode offset" wins; "bytecode index" loses.
+
+ Also renamed getBytecodeOffset to bytecodeOffset, to match the WebKit
+ naming style.
+
+ * bytecode/CodeBlock.h:
+ (JSC::CallReturnOffsetToBytecodeOffset::CallReturnOffsetToBytecodeOffset):
+ (JSC::getCallReturnOffset):
+ (JSC::CodeBlock::bytecodeOffset):
+ (JSC::CodeBlock::callReturnIndexVector):
+ * interpreter/Interpreter.cpp:
+ (JSC::bytecodeOffsetForPC):
+ * jit/JIT.cpp:
+ (JSC::JIT::JIT):
+ (JSC::JIT::privateCompileMainPass):
+ (JSC::JIT::privateCompileLinkPass):
+ (JSC::JIT::privateCompileSlowCases):
+ (JSC::JIT::privateCompile):
+ * jit/JIT.h:
+ (JSC::CallRecord::CallRecord):
+ (JSC::JumpTable::JumpTable):
+ (JSC::SwitchRecord::SwitchRecord):
+ * jit/JITCall.cpp:
+ (JSC::JIT::compileOpCallVarargsSlowCase):
+ (JSC::JIT::compileOpCall):
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::emitNakedCall):
+ (JSC::JIT::addSlowCase):
+ (JSC::JIT::addJump):
+ (JSC::JIT::emitJumpSlowToHot):
+ (JSC::JIT::isLabeled):
+ (JSC::JIT::map):
+ (JSC::JIT::unmap):
+ (JSC::JIT::isMapped):
+ (JSC::JIT::getMappedPayload):
+ (JSC::JIT::getMappedTag):
+ (JSC::JIT::emitGetVirtualRegister):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_switch_imm):
+ (JSC::JIT::emit_op_switch_char):
+ (JSC::JIT::emit_op_switch_string):
+ (JSC::JIT::emit_op_new_error):
+ * jit/JITOpcodes32_64.cpp:
+ (JSC::JIT::emit_op_mov):
+ (JSC::JIT::emit_op_get_global_var):
+ (JSC::JIT::emit_op_put_global_var):
+ (JSC::JIT::emit_op_get_scoped_var):
+ (JSC::JIT::emit_op_put_scoped_var):
+ (JSC::JIT::emit_op_to_primitive):
+ (JSC::JIT::emit_op_resolve_global):
+ (JSC::JIT::emit_op_to_jsnumber):
+ (JSC::JIT::emit_op_catch):
+ (JSC::JIT::emit_op_switch_imm):
+ (JSC::JIT::emit_op_switch_char):
+ (JSC::JIT::emit_op_switch_string):
+ (JSC::JIT::emit_op_new_error):
+ (JSC::JIT::emit_op_convert_this):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::emit_op_method_check):
+ (JSC::JIT::emitSlow_op_method_check):
+ * jit/JITPropertyAccess32_64.cpp:
+ (JSC::JIT::emit_op_method_check):
+ (JSC::JIT::emitSlow_op_method_check):
+ (JSC::JIT::emit_op_get_by_val):
+ (JSC::JIT::emit_op_get_by_id):
+ (JSC::JIT::emit_op_get_by_pname):
+ * jit/JITStubCall.h:
+ (JSC::JITStubCall::call):
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+
+2010-05-19 Peter Varga <pvarga@inf.u-szeged.hu>
+
+ Reviewed by Darin Adler.
+
+ The backtrackParenthesesOnceEnd function should store the start position
+ of the subpattern's non-greedy match at the place of the subpattern's
+ start index in the output array instead of the place of the
+ subpattern's end index.
+ Add layout test for checking of non-greedy matching of subpattern in
+ regular expressions.
+ https://bugs.webkit.org/show_bug.cgi?id=39289
+
+ * yarr/RegexInterpreter.cpp:
+ (JSC::Yarr::Interpreter::backtrackParenthesesOnceEnd):
+
+2010-05-18 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Bug 39343 - Dynamically generate a native call thunk per NativeFunction
+
+ https://bugs.webkit.org/show_bug.cgi?id=39252 regressed performance on i386,
+ by adding an extra indirection to making a native call. By introducing per-
+ NativeFunction thunks we can hard code the function pointer into the thunk
+ so that it need not be loaded from the callee.
+
+ * jit/JIT.h:
+ (JSC::JIT::compileCTINativeCall):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::privateCompileCTINativeCall):
+ * jit/JITOpcodes32_64.cpp:
+ (JSC::JIT::privateCompileCTINativeCall):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::emitSlow_op_get_by_val):
+ * jit/JITPropertyAccess32_64.cpp:
+ (JSC::JIT::emitSlow_op_get_by_val):
+ * jit/JITStubs.cpp:
+ (JSC::JITThunks::ctiStub):
+ (JSC::JITThunks::hostFunctionStub):
+ * jit/JITStubs.h:
+ * jit/SpecializedThunkJIT.h:
+ (JSC::SpecializedThunkJIT::finalize):
+ * jit/ThunkGenerators.cpp:
+ (JSC::charCodeAtThunkGenerator):
+ (JSC::charAtThunkGenerator):
+ (JSC::fromCharCodeThunkGenerator):
+ (JSC::sqrtThunkGenerator):
+ (JSC::powThunkGenerator):
+ * runtime/JSFunction.cpp:
+ (JSC::JSFunction::JSFunction):
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::getHostFunction):
+ * runtime/JSGlobalData.h:
+ (JSC::JSGlobalData::getCTIStub):
+ * runtime/Lookup.cpp:
+ (JSC::setUpStaticFunctionSlot):
+ * runtime/StringConstructor.cpp:
+ (JSC::StringConstructor::StringConstructor):
+ * wtf/Platform.h:
+
+2010-05-18 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Simplified handling of 'arguments' -- 1.2% SunSpider speedup
+ https://bugs.webkit.org/show_bug.cgi?id=39200
+
+ Removed the reserved OptionalCalleeArguments slot from the CallFrame.
+ Now, slots for 'arguments' are allocated and initialized only by
+ functions that might need them.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::dump): Updated for new bytecode operands.
+
+ (JSC::CodeBlock::CodeBlock):
+ * bytecode/CodeBlock.h:
+ (JSC::unmodifiedArgumentsRegister): Added a helper function for mapping
+ from the arguments register to its unmodified counterpart.
+
+ (JSC::CodeBlock::setArgumentsRegister):
+ (JSC::CodeBlock::argumentsRegister):
+ (JSC::CodeBlock::usesArguments): Changed from a "usesArguments" bool to
+ an optional int index representing the arguments register.
+
+ * bytecode/Opcode.h: Updated for new bytecode operands.
+
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::addVar): Factored out a helper function for
+ allocating an anonymous var.
+
+ (JSC::BytecodeGenerator::BytecodeGenerator): Merged / simplified some
+ arguments vs activation logic, and added code to allocate the arguments
+ registers when needed.
+
+ (JSC::BytecodeGenerator::createArgumentsIfNecessary): Updated for new bytecode operands.
+
+ (JSC::BytecodeGenerator::emitCallEval): No need to create the arguments
+ object before calling eval; the activation object will lazily create the
+ arguments object if eval resolves it.
+
+ (JSC::BytecodeGenerator::emitReturn): Updated for new bytecode operands.
+
+ (JSC::BytecodeGenerator::emitPushScope):
+ (JSC::BytecodeGenerator::emitPushNewScope): Ditto emitCallEval.
+
+ * bytecompiler/BytecodeGenerator.h:
+ (JSC::BytecodeGenerator::addVar): Factored out a helper function for
+ allocating an anonymous var.
+
+ (JSC::BytecodeGenerator::registerFor): No more need for special handling
+ of the arguments registers; they're allocated just like normal registers
+ now.
+
+ * interpreter/CallFrame.h:
+ (JSC::ExecState::callerFrame):
+ (JSC::ExecState::init):
+ * interpreter/CallFrameClosure.h:
+ (JSC::CallFrameClosure::resetCallFrame): Nixed optionalCalleeArguments.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::dumpRegisters):
+ (JSC::Interpreter::unwindCallFrame):
+ (JSC::Interpreter::privateExecute):
+ (JSC::Interpreter::retrieveArguments): Opcodes accessing 'arguments' now
+ take operands specifying registers, just like all other opcodes.
+ JSActivation::copyRegisters is no longer responsible for tearing off the
+ arguments object; instead, the VM is responsible for both.
+
+ Also, a behavior change: Each access to f.arguments creates a new object,
+ unless f itself uses 'arguments'. This matches Chrome, and is necessary
+ for the optimization. f.arguments is a nonstandard, deprecated feature,
+ so high fidelity to a given implementation is not necessarily a goal.
+ Also, as illustrated by the new test case, the identity of f.arguments
+ has been broken since 2008, except in the case where f itself accesses
+ f.arguments -- but nobody seemed to notice. So, hopefully this change won't
+ break the web.
+
+ * interpreter/Register.h: Nixed the special arguments accessor. It's no
+ longer needed.
+
+ * interpreter/RegisterFile.h:
+ (JSC::RegisterFile::):
+ * jit/JITCall.cpp:
+ (JSC::JIT::compileOpCallInitializeCallFrame):
+ (JSC::JIT::compileOpCall):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_tear_off_activation):
+ (JSC::JIT::emit_op_tear_off_arguments):
+ (JSC::JIT::emit_op_create_arguments):
+ (JSC::JIT::emit_op_init_arguments):
+ * jit/JITOpcodes32_64.cpp:
+ (JSC::JIT::emit_op_tear_off_activation):
+ (JSC::JIT::emit_op_tear_off_arguments):
+ (JSC::JIT::emit_op_create_arguments):
+ (JSC::JIT::emit_op_init_arguments): The actual optimization: Removed
+ OptionalCalleeArguments from the callframe slot. Now, it doesn't need
+ to be initialized for most calls.
+
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+ * jit/JITStubs.h:
+ (JSC::): Updated stubs to support arbitrary 'arguments' registers,
+ instead of hard-coding something in the call frame.
+
+ * runtime/Arguments.h:
+ (JSC::JSActivation::copyRegisters): Removed some obfuscatory abstraction.
+
+ * runtime/Executable.h:
+ (JSC::FunctionExecutable::generatedByteCode): Added a helper for accessing
+ the 'arguments' register. In a future patch, that kind of data should
+ probably move out of CodeBlock and into Executable.
+
+ * runtime/JSActivation.cpp:
+ (JSC::JSActivation::getOwnPropertySlot):
+ (JSC::JSActivation::argumentsGetter):
+ * runtime/JSActivation.h: Simplified / fixed access to 'arguments' via
+ the activation object. It now implements the same behavior implemented
+ by optimized variable access in the VM. This simplifies some other
+ things, too -- like eval code generation.
+
+2010-05-18 Sam Weinig <sam@webkit.org>
+
+ Try to fix the windows build.
+
+ * API/JSStringRefBSTR.cpp:
+
+2010-05-18 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Add an inlineCapacity template parameter to ListHashSet and use it to shrink the positioned object list hash set.
+ https://bugs.webkit.org/show_bug.cgi?id=39304
+ <rdar://problem/7998366>
+
+ Add an inlineCapacity template parameter to ListHashSet.
+
+ * wtf/ListHashSet.h:
+ (WTF::::ListHashSet):
+ (WTF::::operator):
+ (WTF::::swap):
+ (WTF::::~ListHashSet):
+ (WTF::::size):
+ (WTF::::capacity):
+ (WTF::::isEmpty):
+ (WTF::::begin):
+ (WTF::::end):
+ (WTF::::find):
+ (WTF::::contains):
+ (WTF::::add):
+ (WTF::::insertBefore):
+ (WTF::::remove):
+ (WTF::::clear):
+ (WTF::::unlinkAndDelete):
+ (WTF::::appendNode):
+ (WTF::::insertNodeBefore):
+ (WTF::::deleteAllNodes):
+ (WTF::::makeIterator):
+ (WTF::::makeConstIterator):
+ (WTF::deleteAllValues):
+
+2010-05-18 Gabor Loki <loki@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ Fix the interpreter after r59637
+ https://bugs.webkit.org/show_bug.cgi?id=39287
+
+ * runtime/Executable.h:
+ * runtime/JSFunction.cpp:
+ (JSC::JSFunction::JSFunction):
+ (JSC::JSFunction::getCallData):
+ * runtime/JSGlobalData.cpp:
+ * runtime/JSGlobalData.h:
+
+2010-05-17 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Oops, meant ebx not eax there. Fix Qt (and probably Win too).
+
+ * jit/JITOpcodes32_64.cpp:
+
+2010-05-17 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Bug 39252 - Move host/native JSFunction's NativeFunction onto NativeExecutable.
+
+ Currently host functions reuse JSFunction's ScopeChain as storage for their
+ NativeFunction (the C function pointer to the host function implementation).
+ Instead, move this onto NativeExecutable. This will allow host functions to
+ have a scopechain (which will be implemented as a separate patch).
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * jit/JIT.h:
+ * jit/JITCall.cpp:
+ (JSC::JIT::compileOpCallInitializeCallFrame):
+ (JSC::JIT::compileOpCall):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ * jit/JITOpcodes32_64.cpp:
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::stringGetByValStubGenerator):
+ (JSC::JIT::emitSlow_op_get_by_val):
+ * jit/JITPropertyAccess32_64.cpp:
+ (JSC::JIT::stringGetByValStubGenerator):
+ (JSC::JIT::emitSlow_op_get_by_val):
+ * jit/JITStubs.cpp:
+ (JSC::JITThunks::specializedThunk):
+ * jit/JITStubs.h:
+ (JSC::JITThunks::ctiNativeCall):
+ * jit/SpecializedThunkJIT.h:
+ (JSC::SpecializedThunkJIT::finalize):
+ * jit/ThunkGenerators.cpp:
+ (JSC::charCodeAtThunkGenerator):
+ (JSC::charAtThunkGenerator):
+ (JSC::fromCharCodeThunkGenerator):
+ (JSC::sqrtThunkGenerator):
+ (JSC::powThunkGenerator):
+ * jit/ThunkGenerators.h:
+ * runtime/Executable.h:
+ (JSC::NativeExecutable::create):
+ (JSC::NativeExecutable::function):
+ (JSC::NativeExecutable::NativeExecutable):
+ (JSC::JSFunction::nativeFunction):
+ * runtime/JSFunction.cpp:
+ (JSC::JSFunction::JSFunction):
+ (JSC::JSFunction::~JSFunction):
+ (JSC::JSFunction::markChildren):
+ (JSC::JSFunction::getCallData):
+ (JSC::JSFunction::call):
+ (JSC::JSFunction::getOwnPropertySlot):
+ (JSC::JSFunction::getConstructData):
+ (JSC::JSFunction::construct):
+ * runtime/JSFunction.h:
+ (JSC::JSFunction::scope):
+ * runtime/JSGlobalData.h:
+ (JSC::JSGlobalData::getThunk):
+ * runtime/Lookup.cpp:
+ (JSC::setUpStaticFunctionSlot):
+ * runtime/StringConstructor.cpp:
+ (JSC::StringConstructor::StringConstructor):
+
+2010-05-17 Patrick Gansterer <paroga@paroga.com>
+
+ Reviewed by Laszlo Gombos.
+
+ [Qt] Remove WinCE endian dedection.
+ https://bugs.webkit.org/show_bug.cgi?id=38511
+
+ Windows CE supports little-endian format only.
+ Correct dedection was added in r57804.
+
+ * wtf/Platform.h:
+
+2010-05-16 Simon Fraser <simon.fraser@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Reduce the size of FunctionExecutable
+ https://bugs.webkit.org/show_bug.cgi?id=39180
+
+ Change m_numVariables from a size_t to 31 bits in a bitfield,
+ packed with another bit for m_forceUsesArguments (which in turn
+ get packed with the base class).
+
+ Reduces the size of FunctionExecutable from 160 to 152 bytes.
+
+ * runtime/Executable.h:
+ (JSC::FunctionExecutable::variableCount):
+ (JSC::FunctionExecutable::FunctionExecutable):
+
+2010-05-15 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Incorrect codegen for slowcase of < in 64-bit
+ https://bugs.webkit.org/show_bug.cgi?id=39151
+
+ Call the correct stud for the slowcases of the < operator.
+
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emitSlow_op_jnless):
+ (JSC::JIT::emitSlow_op_jless):
+
+2010-05-15 Leo Yang <leo.yang@torchmobile.com.cn>
+
+ Reviewed by Darin Adler.
+
+ Fix bug https://bugs.webkit.org/show_bug.cgi?id=38890
+
+ * runtime/DatePrototype.cpp:
+ (JSC::formatLocaleDate):
+
+2010-05-15 Leandro Pereira <leandro@profusion.mobi>
+
+ Reviewed by Adam Treat.
+
+ [EFL] Add build system for the EFL port.
+ http://webkit.org/b/37945
+
+ * CMakeLists.txt: Added.
+ * CMakeListsEfl.txt: Added.
+ * config.h: Add conditional to look for cmakeconfig.h.
+ * jsc/CMakeLists.txt: Added.
+ * jsc/CMakeListsEfl.txt: Added.
+ * wtf/CMakeLists.txt: Added.
+ * wtf/CMakeListsEfl.txt: Added.
+
+2010-05-15 Chao-ying Fu <fu@mips.com>
+
+ Reviewed by Oliver Hunt.
+
+ Update MIPS JIT for unsigned right shift, Math.sqrt, load16
+ https://bugs.webkit.org/show_bug.cgi?id=38412
+
+ Fixed MIPS build failure.
+
+ * assembler/MIPSAssembler.h:
+ (JSC::MIPSAssembler::srl):
+ (JSC::MIPSAssembler::srlv):
+ (JSC::MIPSAssembler::sqrtd):
+ * assembler/MacroAssemblerMIPS.h:
+ (JSC::MacroAssemblerMIPS::urshift32):
+ (JSC::MacroAssemblerMIPS::sqrtDouble):
+ (JSC::MacroAssemblerMIPS::load16):
+ (JSC::MacroAssemblerMIPS::supportsFloatingPointSqrt):
+ * jit/JSInterfaceJIT.h:
+
+2010-05-15 Ilya Tikhonovsky <loislo@chromium.org>
+
+ Reviewed by Geoffrey Garen.
+
+ WebInspector: JSC Should provide heap size info for Timeline panel.
+ https://bugs.webkit.org/show_bug.cgi?id=38420
+
+ * JavaScriptCore.exp:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * runtime/Collector.cpp:
+ (JSC::Heap::size):
+ * runtime/Collector.h:
+
+2010-05-15 Dave Tapuska <dtapuska@rim.com>
+
+ Reviewed by Darin Adler.
+
+ Add a new define for we need strict arena alignment. ARMv5 with
+ double word instructions set this value.
+
+ * wtf/Platform.h:
+
+2010-05-14 Stephanie Lewis <slewis@apple.com>
+
+ Rubber-stamped by Mark Rowe.
+
+ Update order files.
+
+ * JavaScriptCore.order:
+
+2010-05-14 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Implementation of QtScript API that provide method to convert a value to an object.
+
+ [Qt] QtScript is missing toObject API
+ https://bugs.webkit.org/show_bug.cgi?id=36594
+
+ * qt/api/qscriptengine.cpp:
+ (QScriptEngine::toObject):
+ * qt/api/qscriptengine.h:
+ * qt/api/qscriptvalue.cpp:
+ (QScriptValue::toObject):
+ * qt/api/qscriptvalue.h:
+ * qt/api/qscriptvalue_p.h:
+ (QScriptValuePrivate::toObject):
+ * qt/tests/qscriptengine/tst_qscriptengine.cpp:
+ (tst_QScriptEngine::toObject):
+ (tst_QScriptEngine::toObjectTwoEngines):
+ * qt/tests/qscriptvalue/tst_qscriptvalue.cpp:
+ (tst_QScriptValue::toObjectSimple):
+ * qt/tests/qscriptvalue/tst_qscriptvalue.h:
+
+2010-05-14 Chao-ying Fu <fu@mips.com>
+
+ Reviewed by Oliver Hunt.
+
+ String Indexing Failure on JSVALUE32 targets
+ https://bugs.webkit.org/show_bug.cgi?id=39034
+
+ Remove zero-extend/shift-right code on regT1, because we already have
+ it in emit_op_get_by_val().
+
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::stringGetByValStubGenerator):
+
+2010-05-10 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Fix a VS2010 assert in std::copy
+ https://bugs.webkit.org/show_bug.cgi?id=38630
+
+ The assert complains that the output iterator is null.
+
+ * wtf/Vector.h:
+ (WTF::::operator):
+
+2010-05-13 Maciej Stachowiak <mjs@apple.com>
+
+ No review, attempted build fix.
+
+ Try to fix Tiger build with some gratuitous initialization of
+ seemingly uninitialized variables.
+
+ * wtf/text/StringImpl.h:
+ (WebCore::StringImpl::tryCreateUninitialized):
+
+2010-05-13 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Mark Rowe.
+
+ Various JavaScript string optimizations
+ https://bugs.webkit.org/show_bug.cgi?id=39051
+
+ Approximately 1% SunSpider speedup.
+
+ * runtime/ArrayPrototype.cpp:
+ (JSC::arrayProtoFuncJoin): Remove branches from the hot code path
+ by moving the first pass outside the loop, and duplicating the hot loop
+ to extract the loop-invariant branch.
+ * runtime/RegExp.cpp:
+ (JSC::RegExp::match): resize ovector to 0 instead of clearing to avoid
+ thrash in case of large matches.
+ * runtime/RegExpConstructor.h:
+ (JSC::RegExpConstructor::performMatch): Mark ALWAYS_INLINE to make the
+ compiler respect our authority.
+ * runtime/StringPrototype.cpp:
+ (JSC::jsSpliceSubstringsWithSeparators): Inline.
+ (JSC::stringProtoFuncSubstring): Rewrite boundary condition checks to
+ reduce the number of floating point comparisons and branches.
+
+2010-05-12 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ https://bugs.webkit.org/show_bug.cgi?id=39039
+ Provide support for separate bytecode/JIT code translations for call/construct usage
+ This will allow us to produce code generated specifically for use as a constructor, not for general function use.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::CodeBlock):
+ (JSC::CodeBlock::unlinkCallers):
+ * bytecode/CodeBlock.h:
+ (JSC::CodeBlock::getBytecodeIndex):
+ (JSC::CodeBlock::getJITCode):
+ (JSC::CodeBlock::executablePool):
+ (JSC::GlobalCodeBlock::GlobalCodeBlock):
+ (JSC::FunctionCodeBlock::FunctionCodeBlock):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::executeCall):
+ (JSC::Interpreter::executeConstruct):
+ (JSC::Interpreter::prepareForRepeatCall):
+ (JSC::Interpreter::execute):
+ (JSC::Interpreter::privateExecute):
+ * interpreter/Interpreter.h:
+ * jit/JIT.cpp:
+ (JSC::JIT::unlinkCallOrConstruct):
+ (JSC::JIT::linkConstruct):
+ * jit/JIT.h:
+ * jit/JITCall.cpp:
+ (JSC::JIT::compileOpCall):
+ (JSC::JIT::compileOpCallSlowCase):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ * jit/JITOpcodes32_64.cpp:
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::emitSlow_op_get_by_val):
+ * jit/JITPropertyAccess32_64.cpp:
+ (JSC::JIT::emitSlow_op_get_by_val):
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+ * jit/JITStubs.h:
+ (JSC::JITThunks::ctiVirtualConstructLink):
+ (JSC::JITThunks::ctiVirtualConstruct):
+ (JSC::):
+ * jit/SpecializedThunkJIT.h:
+ (JSC::SpecializedThunkJIT::finalize):
+ * runtime/Arguments.h:
+ (JSC::JSActivation::copyRegisters):
+ * runtime/ArrayPrototype.cpp:
+ (JSC::isNumericCompareFunction):
+ * runtime/Executable.cpp:
+ (JSC::FunctionExecutable::~FunctionExecutable):
+ (JSC::FunctionExecutable::compileForCall):
+ (JSC::FunctionExecutable::compileForConstruct):
+ (JSC::EvalExecutable::generateJITCode):
+ (JSC::ProgramExecutable::generateJITCode):
+ (JSC::FunctionExecutable::generateJITCodeForCall):
+ (JSC::FunctionExecutable::generateJITCodeForConstruct):
+ (JSC::FunctionExecutable::markAggregate):
+ (JSC::FunctionExecutable::reparseExceptionInfo):
+ (JSC::EvalExecutable::reparseExceptionInfo):
+ (JSC::FunctionExecutable::recompile):
+ * runtime/Executable.h:
+ (JSC::ExecutableBase::ExecutableBase):
+ (JSC::ExecutableBase::isHostFunction):
+ (JSC::ExecutableBase::generatedJITCodeForCall):
+ (JSC::ExecutableBase::generatedJITCodeForConstruct):
+ (JSC::NativeExecutable::NativeExecutable):
+ (JSC::EvalExecutable::jitCode):
+ (JSC::ProgramExecutable::jitCode):
+ (JSC::FunctionExecutable::bytecodeForCall):
+ (JSC::FunctionExecutable::isGeneratedForCall):
+ (JSC::FunctionExecutable::generatedBytecodeForCall):
+ (JSC::FunctionExecutable::bytecodeForConstruct):
+ (JSC::FunctionExecutable::isGeneratedForConstruct):
+ (JSC::FunctionExecutable::generatedBytecodeForConstruct):
+ (JSC::FunctionExecutable::symbolTable):
+ (JSC::FunctionExecutable::FunctionExecutable):
+ (JSC::FunctionExecutable::jitCodeForCall):
+ (JSC::FunctionExecutable::jitCodeForConstruct):
+ * runtime/JSActivation.h:
+ (JSC::JSActivation::JSActivationData::JSActivationData):
+ * runtime/JSFunction.cpp:
+ (JSC::JSFunction::~JSFunction):
+ (JSC::JSFunction::call):
+ (JSC::JSFunction::construct):
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::numericCompareFunction):
+
+2010-05-12 Oliver Hunt <oliver@apple.com>
+
+ build fix
+
+ <rdar://problem/7977960> REGRESSION (r59282): Tiger PPC build broken
+
+ * runtime/UString.h:
+ (JSC::tryMakeString):
+
+2010-05-12 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ <rdar://7969718> Incorrect 32-bit codegen for op_jnlesseq
+ https://bugs.webkit.org/show_bug.cgi?id=39038
+
+ Correct the use of incorrect comparison operators.
+
+ * jit/JITArithmetic32_64.cpp:
+ (JSC::JIT::emit_op_jlesseq):
+ (JSC::JIT::emitBinaryDoubleOp):
+
+2010-05-12 Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
+
+ Reviewed by Eric Seidel.
+
+ JavaScriptCore: fix build when some optimizations are disabled
+ https://bugs.webkit.org/show_bug.cgi?id=38800
+
+ Remove outdated UNUSED_PARAMs when using JIT but with
+ ENABLE_JIT_OPTIMIZE_CALL and ENABLE_JIT_OPTIMIZE_PROPERTY_ACCESS
+ disabled.
+
+ * jit/JITOpcodes.cpp:
+ * jit/JITOpcodes32_64.cpp:
+
+2010-05-12 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Work around GCC stupidity by either explicitly inlining or by
+ using ALWAYS_INLINE
+
+ * runtime/StringPrototype.cpp:
+ (JSC::stringProtoFuncReplace):
+ * runtime/UString.h:
+ (JSC::UString::~UString):
+ * wtf/RefPtr.h:
+ (WTF::RefPtr::RefPtr):
+ (WTF::RefPtr::~RefPtr):
+ * wtf/text/StringImpl.h:
+ (WebCore::StringImpl::create):
+ (WebCore::StringImpl::tryCreateUninitialized):
+
+2010-05-12 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] Detect debug mode consistently
+ https://bugs.webkit.org/show_bug.cgi?id=38863
+
+ * JavaScriptCore.pri:
+ * JavaScriptCore.pro:
+ * jsc.pro:
+ * qt/api/QtScript.pro:
+
+2010-05-12 Peter Varga <pvarga@inf.u-szeged.hu>
+
+ Reviewed by Gavin Barraclough.
+
+ Remove a direct jump in generatePatternCharacterGreedy() and
+ generatePatternCharacterClassGreedy() functions if quantityCount of the term
+ is unlimited.
+ https://bugs.webkit.org/show_bug.cgi?id=38898
+
+ * yarr/RegexJIT.cpp:
+ (JSC::Yarr::RegexGenerator::generatePatternCharacterGreedy):
+ (JSC::Yarr::RegexGenerator::generateCharacterClassGreedy):
+
+2010-05-11 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Slight simplification to the calling convention: read RegisterFile::end()
+ from an absolute address, instead of from a pointer to the RegisterFile
+ on the stack.
+
+ SunSpider reports no change.
+
+ This should free us to remove the RegisterFile argument from the stack.
+
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompile):
+
+2010-05-11 Brian Weinstein <bweinstein@apple.com>
+
+ Possible Gtk build fix - use ALWAYS_INLINE on functions that were inlined.
+
+ * wtf/text/AtomicString.h:
+ (WebCore::AtomicString::add): Use ALWAYS_INLINE.
+ * wtf/text/WTFString.h:
+ (WebCore::String::length): Ditto.
+ (WebCore::String::isEmpty): Ditto.
+
+2010-05-11 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Add a compile time assert that sizeof(String) == sizeof(AtomicString).
+
+ * wtf/text/AtomicString.cpp:
+
+2010-05-11 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Mark Rowe.
+
+ https://bugs.webkit.org/show_bug.cgi?id=38961
+ Move some member variables around to reduce class sizes.
+
+ Make AtomicString no longer inherit from FastAllocBase.
+
+ Since AtomicString's first (and only) member variable, a RefPtr, also inherits from FastAllocBase this
+ was causing the size of AtomicString to contain sizeof(void*) bytes of padding.
+
+ * wtf/text/AtomicString.h:
+
+2010-05-11 Brian Weinstein <bweinstein@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+ Patch by Gavin Barraclough.
+
+ Rest of REGRESSION (r57900-57919): 3% PLT Regression from moving strings into WTF.
+ https://bugs.webkit.org/show_bug.cgi?id=38930
+ <rdar://problem/7937188>
+
+ Inline string functions that are commonly used in WTFString, CString, and AtomicString.
+
+ * JavaScriptCore.exp: Remove exports of inline functions.
+ * wtf/text/AtomicString.cpp:
+ (WebCore::AtomicString::addSlowCase): Rename add to addSlowCase, and inline the fast path
+ of add.
+ * wtf/text/AtomicString.h:
+ (WebCore::AtomicString::add): Inline the fast path of add.
+ * wtf/text/CString.cpp: Inline implementation of data and length in the header.
+ * wtf/text/CString.h:
+ (WTF::CString::data): Inline implementation of data.
+ (WTF::CString::length): Inline implementation of length.
+ * wtf/text/WTFString.cpp: Remove implementations of functions to be inlined.
+ * wtf/text/WTFString.h:
+ (WebCore::String::String): Inline implementation.
+ (WebCore::String::length): Ditto.
+ (WebCore::String::characters): Ditto.
+ (WebCore::String::operator[]): Ditto.
+ (WebCore::String::isEmpty): Ditto.
+
+2010-05-11 Brian Weinstein <bweinstein@apple.com>
+
+ Reviewed by Steve Falkenburg and Jon Honeycutt.
+ Patch by Gavin Barraclough.
+
+ REGRESSION (r57900-57919): 3% PLT Regression from moving strings into WTF.
+ https://bugs.webkit.org/show_bug.cgi?id=38930
+ <rdar://problem/7937188>
+
+ When the String classes were moved from WebCore to WTF, it meant that on Windows, all operations
+ on Strings in WebCore had to cross a DLL boundary (from WebKit.dll to JavaScript.dll).
+
+ We fix this by refactoring some of the WTF string code, so the code in AtomicString, StringImpl, and
+ WTFString can be built by both WebCore and WTF, and we don't need to talk across a DLL to do operations
+ on Strings.
+
+ * GNUmakefile.am: Add new file to build system.
+ * JavaScriptCore.gypi: Ditto.
+ * JavaScriptCore.pro: Ditto.
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: Remove string exports, because these are now
+ handled in WebCore.
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Remove the post-build step that was added
+ here (the post build step is in JavaScriptCoreCommon.vsprops).
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops: Copy the three cpp files that need to be compiled
+ by WebCore into the WebKitOutputDir directory.
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj: Add the StringStatics file.
+ * JavaScriptCore.vcproj/jsc/jsc.vcproj: Add the three WTF string cpp files to this project.
+ * JavaScriptCore.vcproj/jsc/jscCommon.vsprops: Remove the need to link against WTF.lib (since jsc links against JavaScriptCore).
+ * JavaScriptCore.xcodeproj/project.pbxproj: Add the StringStatics file.
+ * wtf/text/AtomicString.cpp: Moved code to StringStatics.
+ * wtf/text/StringImpl.cpp: Ditto.
+ * wtf/text/StringStatics.cpp: Added. Move functions in WTF Strings that define static variables to here, so
+ the rest of the files can be compiled in WebCore.
+ (WebCore::StringImpl::empty): Moved from StringImpl.cpp to here.
+ (WebCore::AtomicString::init): Moved from AtomicString.cpp to here.
+
+2010-05-11 Alice Liu <alice.liu@apple.com>
+
+ Rubber-stamped by Gavin Barraclough.
+
+ Fix build error when enabling debugging block in WebKit win painting code
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-05-11 Mark Rowe <mrowe@apple.com>
+
+ Fix the world.
+
+ In r59162 a change was made to WebCore's FeatureDefines.xcconfig that enabled FILE_READER and FILE_WRITER.
+ The author and reviewer of that patch ignored the carefully-worded warning at the top of that file asking
+ that changes to the file be kept in sync across JavaScriptCore, WebCore and WebKit, as well as being kept
+ in sync with build-webkit. This led to WebCore and WebKit having different views of Document's vtable
+ and results in crashes in Safari shortly after launch when virtual function calls resulted in the wrong
+ function in WebCore being called.
+
+ We fix this by bringing the FeatureDefines.xcconfig files in to sync. Based on the ChangeLog message and
+ other changes in r59162 it appears that enabling FILE_WRITER was unintentional so that particular change
+ has been reverted.
+
+ * Configurations/FeatureDefines.xcconfig:
+
+2010-05-11 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r59171.
+ http://trac.webkit.org/changeset/59171
+ https://bugs.webkit.org/show_bug.cgi?id=38933
+
+ "Broke the world" (Requested by bweinstein on #webkit).
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops:
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * JavaScriptCore.vcproj/jsc/jsc.vcproj:
+ * JavaScriptCore.vcproj/jsc/jscCommon.vsprops:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * wtf/text/AtomicString.cpp:
+ (WebCore::AtomicString::init):
+ * wtf/text/StringImpl.cpp:
+ (WebCore::StringImpl::empty):
+ * wtf/text/StringStatics.cpp: Removed.
+
+2010-05-11 Brian Weinstein <bweinstein@apple.com>
+
+ Reviewed by Steve Falkenburg.
+ Patch by Gavin Barraclough.
+
+ REGRESSION (r57900-57919): 3% PLT Regression from moving strings into WTF.
+ https://bugs.webkit.org/show_bug.cgi?id=38930
+ <rdar://problem/7937188>
+
+ When the String classes were moved from WebCore to WTF, it meant that on Windows, all operations
+ on Strings in WebCore had to cross a DLL boundary (from WebKit.dll to JavaScript.dll).
+
+ We fix this by refactoring some of the WTF string code, so the code in AtomicString, StringImpl, and
+ WTFString can be built by both WebCore and WTF, and we don't need to talk across a DLL to do operations
+ on Strings.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: Remove string exports, because these are now
+ handled in WebCore.
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Remove the post-build step that was added
+ here (the post build step is in JavaScriptCoreCommon.vsprops).
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops: Copy the three cpp files that need to be compiled
+ by WebCore into the WebKitOutputDir directory.
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj: Add the StringStatics file.
+ * JavaScriptCore.vcproj/jsc/jsc.vcproj: Add the three WTF string cpp files to this project.
+ * JavaScriptCore.vcproj/jsc/jscCommon.vsprops: Remove the need to link against WTF.lib (since jsc links against JavaScriptCore).
+ * JavaScriptCore.xcodeproj/project.pbxproj: Add the StringStatics file.
+ * wtf/text/AtomicString.cpp: Moved code to StringStatics.
+ * wtf/text/StringImpl.cpp: Ditto.
+ * wtf/text/StringStatics.cpp: Added. Move functions in WTF Strings that define static variables to here, so
+ the rest of the files can be compiled in WebCore.
+ (WebCore::StringImpl::empty): Moved from StringImpl.cpp to here.
+ (WebCore::AtomicString::init): Moved from AtomicString.cpp to here.
+
+2010-05-11 Geoffrey Garen <ggaren@apple.com>
+
+ Fixed test failures seen on SnowLeopard buildbot.
+
+ * runtime/JSString.cpp:
+ (JSC::JSString::replaceCharacter): Don't use size_t and wtf::notFound.
+ Instead, use the individual types and notFound values of the string APIs
+ we're using, since they're not necessarily the same in 64bit.
+
+2010-05-11 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt and Darin Adler.
+
+ Start using ropes in String.prototype.replace.
+
+ 1%-1.5% speedup on SunSpider.
+
+ * runtime/JSString.cpp:
+ (JSC::JSString::resolveRope): Updated for RopeImpl refactoring.
+
+ (JSC::JSString::replaceCharacter): Added a replaceCharacter function, which creates
+ a rope for the resulting replacement.
+
+ * runtime/JSString.h: A few changes here:
+ (JSC::):
+ (JSC::RopeBuilder::RopeIterator::RopeIterator):
+ (JSC::RopeBuilder::RopeIterator::operator++):
+ (JSC::RopeBuilder::RopeIterator::operator*):
+ (JSC::RopeBuilder::RopeIterator::operator!=):
+ (JSC::RopeBuilder::RopeIterator::WorkItem::WorkItem):
+ (JSC::RopeBuilder::RopeIterator::WorkItem::operator!=):
+ (JSC::RopeBuilder::RopeIterator::skipRopes): Created a RopeIterator abstraction.
+ We use this to do a substring find without having to resolve the rope.
+ (We could use this iterator when resolving ropes, too, but resolving
+ ropes backwards is usually more efficient.)
+
+ (JSC::RopeBuilder::JSString): Added constructors for 2 & 3 UStrings.
+
+ (JSC::RopeBuilder::appendValueInConstructAndIncrementLength):
+ (JSC::RopeBuilder::size): Updated for RopeImpl refactoring.
+
+ * runtime/Operations.h: Updated for RopeImpl refactoring.
+ (JSC::jsString): Added jsString functions for 2 & 3 UStrings.
+
+ * runtime/RopeImpl.cpp:
+ (JSC::RopeImpl::derefFibersNonRecursive):
+ * runtime/RopeImpl.h:
+ (JSC::RopeImpl::initializeFiber):
+ (JSC::RopeImpl::size):
+ (JSC::RopeImpl::fibers):
+ (JSC::RopeImpl::deref):
+ (JSC::RopeImpl::RopeImpl): A little refactoring to make this patch easier:
+ Moved statics to the top of the class; put multi-statement functions on
+ multiple lines; renamed "fiberCount" to "size" to match other collections;
+ changed the "fibers" accessor to return the fibers buffer, instead of an
+ item in the buffer, to make iteration easier.
+
+ * runtime/StringPrototype.cpp:
+ (JSC::stringProtoFuncReplace): Don't resolve a rope unless we need to. Do
+ use our new replaceCharacter function if possible. Do use a rope to
+ represent splicing three strings together.
+
+2010-05-10 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Darin Adler.
+
+ [Qt] Disable JIT support for mingw-w64
+ https://bugs.webkit.org/show_bug.cgi?id=38747
+
+ Disale JIT for mingw-w64 as it is reportedly
+ unstable.
+
+ Thanks for Vanboxem Rruben for the investigation.
+
+ * wtf/Platform.h:
+
+2010-05-09 Fumitoshi Ukai <ukai@chromium.org>
+
+ Reviewed by Eric Seidel.
+
+ JavaScriptCore/wtf/MD5.h: checksum should take a reference to output.
+ https://bugs.webkit.org/show_bug.cgi?id=38723
+
+ * JavaScriptCore.exp:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * wtf/MD5.cpp:
+ (WTF::expectMD5):
+ Fix for checksum change.
+ (WTF::MD5::checksum):
+ Take a reference to output, instead of returning the result by value, to reduce coping for performance.
+ * wtf/MD5.h:
+
+2010-05-09 Oliver Hunt <oliver@apple.com>
+
+ Build fix.
+
+ Fix accidental repeat addition of emit_op_new_regexp
+
+ * jit/JITOpcodes.cpp:
+
+2010-05-09 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ REGRESSION(r57955): RegExp literals should not actually be cached, so r57955 should be rolled out.
+ https://bugs.webkit.org/show_bug.cgi?id=38828
+ <rdar://problem/7961634>
+
+ Rollout r57955
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::regexpToSourceString):
+ (JSC::regexpName):
+ (JSC::CodeBlock::dump):
+ (JSC::CodeBlock::shrinkToFit):
+ * bytecode/CodeBlock.h:
+ (JSC::CodeBlock::addRegExp):
+ (JSC::CodeBlock::regexp):
+ * bytecode/Opcode.h:
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::addRegExp):
+ (JSC::BytecodeGenerator::emitNewRegExp):
+ * bytecompiler/BytecodeGenerator.h:
+ * bytecompiler/NodesCodegen.cpp:
+ (JSC::RegExpNode::emitBytecode):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ * jit/JIT.h:
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_new_regexp):
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+ * jit/JITStubs.h:
+ (JSC::):
+
+2010-05-09 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Reserve a large-ish initial capacity for Lexer::m_buffer16.
+
+ SunSpider says 0.3% faster.
+
+ m_buffer16 is used when parsing complex strings -- for example, strings
+ with escape sequences in them. These kinds of strings can be really long,
+ and we want to avoid repeatedly copying as we grow m_buffer16.
+
+ The net memory cost is quite low, since it's proporitional to source
+ code we already have in memory, and we throw away m_buffer16 right when
+ we're done parsing.
+
+ * parser/Lexer.cpp:
+ (JSC::Lexer::Lexer): No need to reserve initial capacity in our constructor,
+ since setCode will be called before we're asked to lex anything.
+ (JSC::Lexer::setCode): Reserve enough space to lex half the source code
+ as a complex string without having to copy.
+ (JSC::Lexer::clear): No need to reserve initial capacity here either,
+ since setCode will be called before we're asked to lex anything.
+
+2010-05-09 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Eric Seidel.
+
+ [Qt] Remove YARR configuration rules from Qt make system
+ https://bugs.webkit.org/show_bug.cgi?id=38819
+
+ Setting YARR based on JIT seeting is now in Platform.h
+ for all ports. This patch essentially reverses r49238.
+
+ * JavaScriptCore.pri:
+
+2010-05-09 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Improve string indexing performance
+ https://bugs.webkit.org/show_bug.cgi?id=38814
+
+ Add an assembly stub to do indexed loads from strings much
+ more cheaply than the current stub dispatch logic. We can
+ do this because we are able to make guarantees about the
+ register contents when entering the stub so the call overhead
+ is negligible.
+
+ * jit/JIT.h:
+ * jit/JITInlineMethods.h:
+ * jit/JITOpcodes.cpp:
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::stringGetByValStubGenerator):
+ (JSC::JIT::emitSlow_op_get_by_val):
+ Moved from JITOpcodes.cpp to keep the slowcase next to
+ the normal case codegen as we do for everything else.
+ * jit/JITPropertyAccess32_64.cpp:
+ (JSC::JIT::stringGetByValStubGenerator):
+ (JSC::JIT::emitSlow_op_get_by_val):
+ * jit/JSInterfaceJIT.h:
+ (JSC::JSInterfaceJIT::emitFastArithImmToInt):
+
+2010-05-09 Maciej Stachowiak <mjs@apple.com>
+
+ Fixed version of: "Optimized o[s] where o is a cell and s is a string"
+ https://bugs.webkit.org/show_bug.cgi?id=38815
+
+ Fixed the previous patch for this from Geoff Garen.
+
+ The two problems were a missing exception check and a PropertySlot
+ initialized improperly, leading to crashes and failures in the case
+ of getters accessed with bracket syntax.
+
+ Previous patch:
+
+ Optimized o[s] where o is a cell and s is a string, removing some old
+ code that wasn't really tuned for the JIT.
+
+ SunSpider says 0.8% faster.
+
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+ * runtime/JSCell.h:
+
+2010-05-08 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Unreviewed, build fix.
+
+ Fix missing terminating ' character warning
+
+ The warning has been only seen on the Gtk buildbots.
+
+ * wtf/Platform.h:
+
+2010-05-08 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Refactor YARR and YARR_JIT default rules in Platform.h
+ https://bugs.webkit.org/show_bug.cgi?id=38727
+
+ Turn on YARR and YARR JIT by default of JIT is enabled.
+ Ports can overrule this default decisions as they wish.
+
+ * wtf/Platform.h:
+
+2010-05-08 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Split JSVALUE32_64 code out of JITOpcodes.cpp and into JITOpcodes32_64.cpp
+ https://bugs.webkit.org/show_bug.cgi?id=38808
+
+ * GNUmakefile.am:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.pro:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * jit/JITOpcodes.cpp:
+ * jit/JITOpcodes32_64.cpp: Added.
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ (JSC::JIT::emit_op_mov):
+ (JSC::JIT::emit_op_end):
+ (JSC::JIT::emit_op_jmp):
+ (JSC::JIT::emit_op_loop_if_lesseq):
+ (JSC::JIT::emitSlow_op_loop_if_lesseq):
+ (JSC::JIT::emit_op_new_object):
+ (JSC::JIT::emit_op_instanceof):
+ (JSC::JIT::emitSlow_op_instanceof):
+ (JSC::JIT::emit_op_new_func):
+ (JSC::JIT::emit_op_get_global_var):
+ (JSC::JIT::emit_op_put_global_var):
+ (JSC::JIT::emit_op_get_scoped_var):
+ (JSC::JIT::emit_op_put_scoped_var):
+ (JSC::JIT::emit_op_tear_off_activation):
+ (JSC::JIT::emit_op_tear_off_arguments):
+ (JSC::JIT::emit_op_new_array):
+ (JSC::JIT::emit_op_resolve):
+ (JSC::JIT::emit_op_to_primitive):
+ (JSC::JIT::emitSlow_op_to_primitive):
+ (JSC::JIT::emit_op_strcat):
+ (JSC::JIT::emit_op_resolve_base):
+ (JSC::JIT::emit_op_resolve_skip):
+ (JSC::JIT::emit_op_resolve_global):
+ (JSC::JIT::emitSlow_op_resolve_global):
+ (JSC::JIT::emit_op_not):
+ (JSC::JIT::emitSlow_op_not):
+ (JSC::JIT::emit_op_jfalse):
+ (JSC::JIT::emitSlow_op_jfalse):
+ (JSC::JIT::emit_op_jtrue):
+ (JSC::JIT::emitSlow_op_jtrue):
+ (JSC::JIT::emit_op_jeq_null):
+ (JSC::JIT::emit_op_jneq_null):
+ (JSC::JIT::emit_op_jneq_ptr):
+ (JSC::JIT::emit_op_jsr):
+ (JSC::JIT::emit_op_sret):
+ (JSC::JIT::emit_op_eq):
+ (JSC::JIT::emitSlow_op_eq):
+ (JSC::JIT::emit_op_neq):
+ (JSC::JIT::emitSlow_op_neq):
+ (JSC::JIT::compileOpStrictEq):
+ (JSC::JIT::emit_op_stricteq):
+ (JSC::JIT::emitSlow_op_stricteq):
+ (JSC::JIT::emit_op_nstricteq):
+ (JSC::JIT::emitSlow_op_nstricteq):
+ (JSC::JIT::emit_op_eq_null):
+ (JSC::JIT::emit_op_neq_null):
+ (JSC::JIT::emit_op_resolve_with_base):
+ (JSC::JIT::emit_op_new_func_exp):
+ (JSC::JIT::emit_op_throw):
+ (JSC::JIT::emit_op_get_pnames):
+ (JSC::JIT::emit_op_next_pname):
+ (JSC::JIT::emit_op_push_scope):
+ (JSC::JIT::emit_op_pop_scope):
+ (JSC::JIT::emit_op_to_jsnumber):
+ (JSC::JIT::emitSlow_op_to_jsnumber):
+ (JSC::JIT::emit_op_push_new_scope):
+ (JSC::JIT::emit_op_catch):
+ (JSC::JIT::emit_op_jmp_scopes):
+ (JSC::JIT::emit_op_switch_imm):
+ (JSC::JIT::emit_op_switch_char):
+ (JSC::JIT::emit_op_switch_string):
+ (JSC::JIT::emit_op_new_error):
+ (JSC::JIT::emit_op_debug):
+ (JSC::JIT::emit_op_enter):
+ (JSC::JIT::emit_op_enter_with_activation):
+ (JSC::JIT::emit_op_create_arguments):
+ (JSC::JIT::emit_op_init_arguments):
+ (JSC::JIT::emit_op_convert_this):
+ (JSC::JIT::emitSlow_op_convert_this):
+ (JSC::JIT::emit_op_profile_will_call):
+ (JSC::JIT::emit_op_profile_did_call):
+
+2010-05-08 Gabor Loki <loki@webkit.org>
+
+ Reviewed by Gavin Barraclough.
+
+ Fix halfword loads on ARM
+ https://bugs.webkit.org/show_bug.cgi?id=38741
+
+ The BaseIndex and ImplicitAddress are contain 32bit wide offset, but
+ the load16 functions were working with 8 bit data (encoded in the
+ instruction). If the offset cannot be encoded in an instruction, it
+ should be stored in a temporary register.
+
+ * assembler/ARMAssembler.h:
+ (JSC::ARMAssembler::getOffsetForHalfwordDataTransfer):
+ * assembler/MacroAssemblerARM.h:
+ (JSC::MacroAssemblerARM::load16):
+
+2010-05-08 Gabor Loki <loki@webkit.org>
+
+ Reviewed by Gavin Barraclough.
+
+ Fix spanning branch instruction on Cortex-A8 with Thumb-2 JIT
+ https://bugs.webkit.org/show_bug.cgi?id=38280
+
+ If the 32-bit Thumb-2 branch instruction spans two 4KiB regions and
+ the target of the branch falls within the first region it is
+ possible for the processor to incorrectly determine the branch
+ instruction, and it is also possible in some cases for the processor
+ to enter a deadlock state.
+
+ * assembler/ARMv7Assembler.h:
+ (JSC::ARMv7Assembler::linkJumpAbsolute):
+
+2010-05-08 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Darin Fisher.
+
+ [WTFURL] Add a buffer for managing the output of the canonicalizer
+ https://bugs.webkit.org/show_bug.cgi?id=38671
+
+ The canonicalizer produces a stream of canonicalized characters, which
+ we will store in a URLBuffer. URLBuffer is quite similar to Vector,
+ but serves as an abstraction to isolate us from the underlying
+ character storage. In the case of WebKit, we'll probably implement a
+ subclass of URLBuffer with Vector. In Chromium, the backing store is a
+ std::string, which avoids an unnecessary memcpy that would be caused by
+ using Vector instead.
+
+ * wtf/url/src/URLBuffer.h: Added.
+ (WTF::URLBuffer::URLBuffer):
+ (WTF::URLBuffer::~URLBuffer):
+ (WTF::URLBuffer::at):
+ (WTF::URLBuffer::set):
+ (WTF::URLBuffer::capacity):
+ (WTF::URLBuffer::length):
+ (WTF::URLBuffer::data):
+ (WTF::URLBuffer::setLength):
+ (WTF::URLBuffer::append):
+ (WTF::URLBuffer::grow):
+
+2010-05-08 Eric Seidel <eric@webkit.org>
+
+ Unreviewed, just reverting commit.
+
+ REGRESSION(59000): r59000 contained all sorts of changes it should not have, needs revert.
+ https://bugs.webkit.org/show_bug.cgi?id=38798
+
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::emitResolve):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_resolve_global):
+
+2010-05-04 Jer Noble <jer.noble@apple.com>
+
+ Reviewed by Maciej Stachowiak
+
+ Safari pegs CPU and drops tons of frames using HTML5 Vimeo player
+ <https://bugs.webkit.org/show_bug.cgi?id=34005>
+ <rdar://problem/7569713>
+
+ Added cancelCallOnMainThread. callOnMainThread should always now be paired
+ with cancelCallOnMainThread in situations where the refcon passed to callOnMainThread
+ may be dealloced before the main thread function can be dispatched.
+
+ * wtf/MainThread.cpp:
+ (WTF::FunctionWithContext::operator == ): Supports the FunctionWithContextFinder predicate functor.
+ (WTF::FunctionWithContextFinder::FunctionWithContextFinder): Predicate functor for use with Dequeue::findIf
+ (WTF::FunctionWithContextFinder::operator()):
+ (WTF::cancelCallOnMainThread):
+ * wtf/MainThread.h:
+
+2010-05-07 Oliver Hunt <oliver@apple.com>
+
+ Windows build fix.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-05-07 Eric Seidel <eric@webkit.org>
+
+ Unreviewed, rolling out r58990.
+ http://trac.webkit.org/changeset/58990
+
+ Broke 4 tests on Snow Leopard and Qt.
+
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+ * runtime/JSCell.h:
+
+2010-05-07 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Optimize access to the global object from a function that uses eval
+ https://bugs.webkit.org/show_bug.cgi?id=38644
+
+ Fix bug where cross scope access to a global var (vs. property) would
+ be allowed without checking for intervening dynamic scopes.
+
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::emitResolve):
+
+2010-05-07 Oliver Hunt <oliver@apple.com>
+
+ 32-bit buildfix.
+
+ Macro expansion I stab at thee!
+
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_resolve_global):
+
+2010-05-07 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Optimized o[s] where o is a cell and s is a string, removing some old
+ code that wasn't really tuned for the JIT.
+
+ SunSpider says 0.8% faster.
+
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+ * runtime/JSCell.h:
+
+2010-05-07 Oliver Hunt <oliver@apple.com>
+
+ Windows build fix.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-05-07 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Optimize access to the global object from a function that uses eval
+ https://bugs.webkit.org/show_bug.cgi?id=38644
+
+ Add op_resolve_global_dynamic, a variant of op_resolve_global that
+ checks each node in the scope chain for dynamically inserted properties
+ and falls back to the normal resolve logic in that case.
+
+ * JavaScriptCore.exp:
+ * bytecode/CodeBlock.cpp:
+ (JSC::isGlobalResolve):
+ (JSC::CodeBlock::printStructures):
+ (JSC::CodeBlock::dump):
+ (JSC::CodeBlock::derefStructures):
+ * bytecode/Opcode.h:
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::findScopedProperty):
+ Now take an additional reference parameter to used to indicate that
+ there were nodes that may gain dynamic properties
+ (JSC::BytecodeGenerator::emitResolve):
+ (JSC::BytecodeGenerator::emitResolveBase):
+ (JSC::BytecodeGenerator::emitResolveWithBase):
+ deal with additional argument to findScopedProperty
+ * bytecompiler/BytecodeGenerator.h:
+ * bytecompiler/NodesCodegen.cpp:
+ (JSC::FunctionCallResolveNode::emitBytecode):
+ (JSC::PostfixResolveNode::emitBytecode):
+ (JSC::PrefixResolveNode::emitBytecode):
+ (JSC::ReadModifyResolveNode::emitBytecode):
+ (JSC::AssignResolveNode::emitBytecode):
+ These functions use findScopedProperty directly in order to
+ optimise lookup. They cannot trivially handle any degree of
+ dynamism in the lookup so we just give up in such case.
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::resolveGlobalDynamic):
+ (JSC::Interpreter::execute):
+ (JSC::Interpreter::privateExecute):
+ * interpreter/Interpreter.h:
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ (JSC::JIT::privateCompileSlowCases):
+ * jit/JIT.h:
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_resolve_global):
+ (JSC::JIT::emit_op_resolve_global_dynamic):
+ (JSC::JIT::emitSlow_op_resolve_global):
+ (JSC::JIT::emitSlow_op_resolve_global_dynamic):
+ Happily resolve_global_dynamic can share the slow case!
+ * jit/JITStubs.h:
+ (JSC::):
+ * runtime/JSActivation.cpp:
+ (JSC::JSActivation::isDynamicScope):
+ * runtime/JSActivation.h:
+ * runtime/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::isDynamicScope):
+ * runtime/JSGlobalObject.h:
+ * runtime/JSStaticScopeObject.cpp:
+ (JSC::JSStaticScopeObject::isDynamicScope):
+ * runtime/JSStaticScopeObject.h:
+ * runtime/JSVariableObject.h:
+
+2010-05-07 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Fixed Sputnik failure seen on buildbot.
+
+ * runtime/NumberPrototype.cpp:
+ (JSC::numberProtoFuncToString): Cast to unsigned before checking magnitude,
+ to efficiently exclude negative numbers, which require two characters
+ instead of one.
+
+2010-05-07 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Slightly more effective way to guarantee a compile-time constant, at
+ least on gcc.
+
+ * runtime/NumberPrototype.cpp:
+ (JSC::numberProtoFuncToString): Use pointer notation instead of array
+ notation, so the compiler treats the string and its contents as constant.
+
+2010-05-07 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Alexey Proskuryakov.
+
+ [WTFURL] Add core URL parser
+ https://bugs.webkit.org/show_bug.cgi?id=38572
+
+ This patch adds the core of the URL parser. The URL parser uses a
+ templated notion of a code unit to support different string types.
+ Later we'll add some non-templated APIs with concrete types that
+ clients can use more conveniently.
+
+ The URLParser has a couple calls to ASSERT(), which I've commented out
+ for now. I'm not 100% sure how to handle the dependency issues there
+ yet, so I've punted on the issue for now.
+
+ Also, there are a number of methods that are declared public in this
+ patch that are only used by the canonicalizer. My plan is to make
+ those private or protected and make the canonicalizer a friend of the
+ parser. The details will be in a later patch.
+
+ * wtf/url/src/URLComponent.h:
+ (WTF::URLComponent::fromRange):
+ (WTF::URLComponent::isNonEmpty):
+ (WTF::URLComponent::isEmptyOrInvalid):
+ * wtf/url/src/URLParser.h: Added.
+ (WTF::URLParser::):
+ (WTF::URLParser::isPossibleAuthorityTerminator):
+ (WTF::URLParser::parseAuthority):
+ (WTF::URLParser::extractScheme):
+ (WTF::URLParser::parseAfterScheme):
+ (WTF::URLParser::parseStandardURL):
+ (WTF::URLParser::parsePath):
+ (WTF::URLParser::parsePathURL):
+ (WTF::URLParser::parseMailtoURL):
+ (WTF::URLParser::parsePort):
+ (WTF::URLParser::extractFileName):
+ (WTF::URLParser::extractQueryKeyValue):
+ (WTF::URLParser::isURLSlash):
+ (WTF::URLParser::shouldTrimFromURL):
+ (WTF::URLParser::trimURL):
+ (WTF::URLParser::consecutiveSlashes):
+ (WTF::URLParser::isPortDigit):
+ (WTF::URLParser::nextAuthorityTerminator):
+ (WTF::URLParser::parseUserInfo):
+ (WTF::URLParser::parseServerInfo):
+
+2010-05-07 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Added a fast path for number-to-character conversion via
+ Number.prototype.toString base 36.
+
+ 0.7% speedup on SunSpider.
+
+ * runtime/NumberPrototype.cpp:
+ (JSC::numberProtoFuncToString): Made radix interpretation a little more
+ efficient by keeping it in int space. Turned "const char" into
+ "static const char" just in case. Added a fast path for base 36
+ conversion of something that will turn into a character.
+
+2010-05-07 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Darin Fisher.
+
+ [WTFURL] Add a malloc-backed URLBuffer
+ https://bugs.webkit.org/show_bug.cgi?id=38694
+
+ This patch adds a URLBuffer that uses new/delete to manage the backing
+ store for the buffer.
+
+ * wtf/url/src/RawURLBuffer.h: Added.
+ (WTF::RawURLBuffer::RawURLBuffer):
+ (WTF::RawURLBuffer::~RawURLBuffer):
+ (WTF::RawURLBuffer::resize):
+
+2010-05-06 Fumitoshi Ukai <ukai@chromium.org>
+
+ Reviewed by Alexey Proskuryakov.
+
+ JavaScriptCore/wtf/RandomNumber.h should provide using WTF::*
+ https://bugs.webkit.org/show_bug.cgi?id=38719
+
+ * wtf/RandomNumber.h:
+ Add using directives.
+
+2010-05-06 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] Enable YARR_JIT for X86 Mac for QtWebKit
+ https://bugs.webkit.org/show_bug.cgi?id=38668
+
+ * wtf/Platform.h:
+
+2010-05-06 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Bug 38714 - Add result caching for Math.sin
+
+ Math.sin is frequently called with the same operand, caching the result should
+ improve performance. CachedTranscendentalFunction adds a generic mechanism to
+ cache results for pure functions with the signature "double func(double)", and
+ where NaN maps to NaN.
+
+ CachedTranscendentalFunction uses a very simple hash function designed to be
+ fast to execute since we cannot cache the result, and trivial to JIT generate,
+ should we wish to do so.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * runtime/CachedTranscendentalFunction.h: Added.
+ (JSC::CachedTranscendentalFunction::CachedTranscendentalFunction):
+ (JSC::CachedTranscendentalFunction::~CachedTranscendentalFunction):
+ (JSC::CachedTranscendentalFunction::operator()):
+ (JSC::CachedTranscendentalFunction::initialize):
+ (JSC::CachedTranscendentalFunction::hash):
+ * runtime/JSGlobalData.h:
+ * runtime/MathObject.cpp:
+ (JSC::mathProtoFuncSin):
+ * wtf/Platform.h:
+
+2010-05-06 Geoffrey Garen <ggaren@apple.com>
+
+ Windows build fix.
+
+ * bytecode/SamplingTool.cpp:
+ (JSC::SamplingFlags::sample): Use a cast, so Windows will be happy when
+ this code is enabled.
+ * wtf/Platform.h: Reverted last change to this file, which seems to have
+ been accidental.
+
+2010-05-06 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Add compile switch to make debugger keyword plant breakpoint instructions.
+
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::emitDebugHook):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_debug):
+ * wtf/Platform.h:
+
+2010-05-06 Oliver Hunt <oliver@apple.com>
+
+ Build fix
+
+ Fix ARM builds
+
+ * assembler/MacroAssemblerARM.h:
+ (JSC::MacroAssemblerARM::load16):
+ * assembler/MacroAssemblerARMv7.h:
+ (JSC::MacroAssemblerARMv7::load16):
+
+2010-05-06 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Improve performance of single character string compares
+ https://bugs.webkit.org/show_bug.cgi?id=38659
+
+ Add logic to the jit to identify comparisons to single character string literals
+ and then just perform the comparison inline, rather than ignoring the evidence
+ and attempting to perform an integer comparison.
+
+ Multiple changes required -- add jnlesseq opcode, add helper function to identify
+ single character string constants, add a helper to load single character strings.
+ Then add the 32_64 and normal codepaths to the JIT.
+
+ * assembler/MacroAssemblerX86Common.h:
+ (JSC::MacroAssemblerX86Common::load16):
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::dump):
+ * bytecode/Opcode.h:
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::emitJumpIfTrue):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ (JSC::JIT::privateCompileSlowCases):
+ * jit/JIT.h:
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emit_op_jnless):
+ (JSC::JIT::emitSlow_op_jnless):
+ (JSC::JIT::emit_op_jless):
+ (JSC::JIT::emitSlow_op_jless):
+ (JSC::JIT::emit_op_jlesseq):
+ (JSC::JIT::emit_op_jnlesseq):
+ (JSC::JIT::emitSlow_op_jlesseq):
+ (JSC::JIT::emitSlow_op_jnlesseq):
+ * jit/JITArithmetic32_64.cpp:
+ (JSC::JIT::emit_op_jnless):
+ (JSC::JIT::emitSlow_op_jnless):
+ (JSC::JIT::emit_op_jless):
+ (JSC::JIT::emitSlow_op_jless):
+ (JSC::JIT::emit_op_jlesseq):
+ (JSC::JIT::emit_op_jnlesseq):
+ (JSC::JIT::emitSlow_op_jlesseq):
+ (JSC::JIT::emitSlow_op_jnlesseq):
+ (JSC::JIT::emitBinaryDoubleOp):
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::emitLoadCharacterString):
+ (JSC::JIT::isOperandConstantImmediateChar):
+ * jit/JSInterfaceJIT.h:
+ (JSC::ThunkHelpers::stringImplDataOffset):
+ (JSC::ThunkHelpers::jsStringLengthOffset):
+ (JSC::ThunkHelpers::jsStringValueOffset):
+ Moved from ThunkGenerators to make it possible to share.
+ * jit/ThunkGenerators.cpp:
+
+2010-05-06 Martin Robinson <mrobinson@webkit.org>
+
+ Reviewed by Gustavo Noronha Silva.
+
+ [GTK] Enable DOM clipboard and drag-and-drop access
+ https://bugs.webkit.org/show_bug.cgi?id=30623
+
+ Convert dragging portion of drag-and-drop to use DataObjectGtk.
+
+ * wtf/gobject/GRefPtr.h: Add forward declarations for GObject functions.
+
+2010-05-06 Steve Block <steveblock@google.com>
+
+ Reviewed by Eric Seidel.
+
+ MAC_JAVA_BRIDGE should be renamed JAVA_BRIDGE
+ https://bugs.webkit.org/show_bug.cgi?id=38544
+
+ * wtf/Platform.h:
+
+2010-05-06 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Maciej Stachowiak.
+
+ [WTFURL] Add a class to represent the segments of a URL
+ https://bugs.webkit.org/show_bug.cgi?id=38566
+
+ When paired with a string, this class represents a parsed URL.
+
+ * wtf/url/src/URLSegments.cpp: Added.
+ (WTF::URLSegments::length):
+ (WTF::URLSegments::charactersBefore):
+ * wtf/url/src/URLSegments.h: Added.
+ (WTF::URLSegments::):
+ (WTF::URLSegments::URLSegments):
+ * wtf/url/wtfurl.gyp:
+
+2010-05-05 Tony Gentilcore <tonyg@chromium.org>
+
+ Reviewed by Adam Barth.
+
+ Adding comment with link to RefPtr documentation.
+ https://bugs.webkit.org/show_bug.cgi?id=38601
+
+ * wtf/RefPtr.h:
+
+2010-05-05 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Bug 38604 - workers-gc2 crashing on Qt
+
+ This appears to be due to a couple of issues.
+ (1) When the atomic string table is deleted it does not clear the 'inTable' bit
+ on AtomicStrings - it implicitly assumes that all AtomicStrings have already
+ been deleted at this point (otherwise they will crash in their destructor when
+ they try to remove themselves from the atomic string table).
+ (2) We don't fix the ordering in which WTF::WTFThreadData and
+ WebCore::ThreadGlobalData are destructed.
+
+ We should make sure that ThreadGlobalData is cleaned up before worker threads
+ terminate and WTF::WTFThreadData is destroyed, and we should clear the inTable
+ bit of members on atomic string table destruction.
+
+ WTF changes (fix issue 1, above) - ensure inTable property is cleared when the
+ atomic string table is destroyed (also, rename InTable to IsAtomic, to make it
+ clear which table we are refering to!)
+
+ * wtf/text/AtomicString.cpp:
+ (WebCore::AtomicStringTable::destroy):
+ (WebCore::CStringTranslator::translate):
+ (WebCore::UCharBufferTranslator::translate):
+ (WebCore::HashAndCharactersTranslator::translate):
+ (WebCore::AtomicString::add):
+ * wtf/text/StringImpl.cpp:
+ (WebCore::StringImpl::~StringImpl):
+ * wtf/text/StringImpl.h:
+ (WebCore::StringImpl::isAtomic):
+ (WebCore::StringImpl::setIsAtomic):
+ * wtf/text/StringImplBase.h:
+
+2010-05-05 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Make Array.join specialised for actual arrays
+ https://bugs.webkit.org/show_bug.cgi?id=38592
+
+ Bring Array.join in line with the other array methods by specialising for
+ this === an array.
+
+ * runtime/ArrayPrototype.cpp:
+ (JSC::arrayProtoFuncJoin):
+
+2010-05-04 Yongjun Zhang <yongjun_zhang@apple.com>
+
+ Reviewed by Darin Adler.
+
+ WebKit crashes at DebuggerCallFrame::functionName() if m_callFrame is the top global callframe.
+ https://bugs.webkit.org/show_bug.cgi?id=38535
+
+ Don't call asFunction if callee is not a FunctionType to prevent assertion failure
+ in JSCell::isObject().
+
+ * debugger/DebuggerCallFrame.cpp:
+ (JSC::DebuggerCallFrame::functionName):
+ (JSC::DebuggerCallFrame::calculatedFunctionName):
+
+2010-05-04 Steve Falkenburg <sfalken@apple.com>
+
+ Remove redundant exports to fix Windows build warnings.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-05-04 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
+
+ Reviewed by Holger Freyther.
+
+ Fix a memory leak inside the QScriptValue.
+
+ QSciptValuePrivate::toString should release all temporary variables.
+
+ [Qt] QScriptValue::toString have a memory leak.
+ https://bugs.webkit.org/show_bug.cgi?id=38112
+
+ * qt/api/qscriptvalue_p.h:
+ (QScriptValuePrivate::toString):
+
+2010-05-04 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk>
+
+ Reviewed by Darin Adler.
+
+ Does not work on SPARC because of alignment issues
+ https://bugs.webkit.org/show_bug.cgi?id=38455
+
+ Use AllocAlignmentInteger instead of void* on pageheap_memory to
+ avoid crashing at runtime in some architectures. Investigated by
+ Mike Hommey <mh@glandium.org>, change suggested by Darin Adler.
+
+ * wtf/FastMalloc.cpp:
+
+2010-05-04 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Maciej Stachowiak.
+
+ Add first WTFURL file
+ https://bugs.webkit.org/show_bug.cgi?id=38470
+
+ This class represents a component of a URL, such as the scheme or path.
+ Essentially, the class is an index into a string buffer.
+
+ * wtf/url: Added.
+ - There was some discussion about where to put the URL library.
+ There are a number of reasonable options, but putting the library
+ in the WTF directory seems like a reasonable alternative. This
+ location will make more sense once WTF is moved out of
+ JavaScriptCore and into a top-level directory.
+ * wtf/url/src: Added.
+ - I've added this extra directory to the usual structure because we
+ eventually want a "public" folder that defines the public
+ interface to this library that clients outside of svn.webkit.org
+ can rely upon, much like the various subfolders of the WebKit
+ directory often define a public API.
+ * wtf/url/src/URLComponent.h: Added.
+ - I've added this somewhat trivial class to get the ball rolling.
+ (WTF::URLComponent::URLComponent):
+ (WTF::URLComponent::isValid):
+ (WTF::URLComponent::isNonempty):
+ (WTF::URLComponent::reset):
+ (WTF::URLComponent::operator==):
+ (WTF::URLComponent::begin):
+ (WTF::URLComponent::setBegin):
+ (WTF::URLComponent::length):
+ (WTF::URLComponent::setLength):
+ (WTF::URLComponent::end):
+ * wtf/url/wtfurl.gyp: Added.
+ - WTFURL will be an independently buildable library, hence the
+ beginnings of a wtfurl.gyp file.
+
+2010-05-03 Stephanie Lewis <slewis@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ https://bugs.webkit.org/show_bug.cgi?id=38368
+ <rdar://problem/7834433> REGRESSSION: 1.5% PLT regression due to 56028
+ (return memory quicker).
+ Instead of returning everything but the smallest spans spread out
+ the spans kept over several size lists.
+
+ * wtf/FastMalloc.cpp:
+ (WTF::TCMalloc_PageHeap::scavenge):
+
+2010-05-03 James Robinson <jamesr@chromium.org>
+
+ Reviewed by Eric Seidel.
+
+ Clean up a few compiler warnings
+ https://bugs.webkit.org/show_bug.cgi?id=38073
+
+ * wtf/text/StringImpl.cpp:
+ (WebCore::StringImpl::ascii):
+
+2010-05-03 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by NOBODY (reverting previous commit).
+
+ Rolling out r58114 - this introduced memory leaks of
+ AtomicStrings then workers terminated.
+
+ * GNUmakefile.am:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * jit/ThunkGenerators.cpp:
+ (JSC::ThunkHelpers::stringImplDataOffset):
+ * runtime/Identifier.cpp:
+ (JSC::IdentifierTable::~IdentifierTable):
+ (JSC::IdentifierTable::add):
+ (JSC::IdentifierCStringTranslator::hash):
+ (JSC::IdentifierCStringTranslator::equal):
+ (JSC::IdentifierCStringTranslator::translate):
+ (JSC::Identifier::add):
+ (JSC::IdentifierUCharBufferTranslator::hash):
+ (JSC::IdentifierUCharBufferTranslator::equal):
+ (JSC::IdentifierUCharBufferTranslator::translate):
+ (JSC::Identifier::addSlowCase):
+ * runtime/Identifier.h:
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData):
+ (JSC::JSGlobalData::~JSGlobalData):
+ * runtime/JSGlobalData.h:
+ * wtf/WTFThreadData.cpp:
+ (WTF::WTFThreadData::WTFThreadData):
+ (WTF::WTFThreadData::~WTFThreadData):
+ * wtf/WTFThreadData.h:
+ (JSC::IdentifierTable::remove):
+ (JSC::IdentifierTable::literalTable):
+ (WTF::WTFThreadData::atomicStringTable):
+ * wtf/text/AtomicString.cpp:
+ (WebCore::AtomicStringTable::create):
+ (WebCore::AtomicStringTable::table):
+ (WebCore::AtomicStringTable::destroy):
+ (WebCore::stringTable):
+ (WebCore::CStringTranslator::hash):
+ (WebCore::CStringTranslator::equal):
+ (WebCore::CStringTranslator::translate):
+ (WebCore::operator==):
+ (WebCore::AtomicString::add):
+ (WebCore::equal):
+ (WebCore::UCharBufferTranslator::hash):
+ (WebCore::UCharBufferTranslator::equal):
+ (WebCore::UCharBufferTranslator::translate):
+ (WebCore::HashAndCharactersTranslator::hash):
+ (WebCore::HashAndCharactersTranslator::equal):
+ (WebCore::HashAndCharactersTranslator::translate):
+ (WebCore::AtomicString::find):
+ (WebCore::AtomicString::remove):
+ * wtf/text/AtomicStringTable.h: Removed.
+ * wtf/text/StringImpl.cpp:
+ (WebCore::StringImpl::~StringImpl):
+ * wtf/text/StringImpl.h:
+ (WebCore::StringImpl::inTable):
+ (WebCore::StringImpl::setInTable):
+ (WebCore::equal):
+ * wtf/text/StringImplBase.h:
+ (WTF::StringImplBase::StringImplBase):
+
+2010-05-03 Kevin Watters <kevinwatters@gmail.com>
+
+ Reviewed by Kevin Ollivier.
+
+ [wx] Implement scheduleDispatchFunctionsOnMainThread for wx port.
+ https://bugs.webkit.org/show_bug.cgi?id=38480
+
+ * wtf/wx/MainThreadWx.cpp:
+ (wxCallAfter::wxCallAfter):
+ (wxCallAfter::OnCallback):
+ (WTF::scheduleDispatchFunctionsOnMainThread):
+
+2010-05-03 Kevin Watters <kevinwatters@gmail.com>
+
+ Reviewed by Kevin Ollivier.
+
+ [wx] Build and use Mac's ComplexTextController to support complex text in wx.
+ https://bugs.webkit.org/show_bug.cgi?id=38482
+
+ * wtf/Platform.h:
+
+2010-05-03 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Interpreter crashes due to incorrect refcounting of cached structures.
+ https://bugs.webkit.org/show_bug.cgi?id=38491
+ rdar://problem/7926160
+
+ Make sure we ref/deref structures used for cached custom property getters
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::derefStructures):
+ (JSC::CodeBlock::refStructures):
+
+2010-05-02 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Eric Seidel.
+
+ [Qt] Enable JIT for QtWebKit on Symbian
+ https://bugs.webkit.org/show_bug.cgi?id=38339
+
+ JIT on Symbian has been stable for quite some time, it
+ is time to turn it on by default.
+
+ * wtf/Platform.h:
+
+2010-04-29 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Add codegen support for unsigned right shift
+ https://bugs.webkit.org/show_bug.cgi?id=38375
+
+ Expose unsigned right shift in the macro assembler, and make use of it
+ from the jit. Currently if the result is outside the range 0..2^31-1
+ we simply fall back to the slow case, even in JSVALUE64 and JSVALUE32_64
+ where technically we could still return an immediate value.
+
+ * assembler/MacroAssemblerARM.h:
+ (JSC::MacroAssemblerARM::urshift32):
+ * assembler/MacroAssemblerARMv7.h:
+ (JSC::MacroAssemblerARMv7::urshift32):
+ * assembler/MacroAssemblerX86Common.h:
+ (JSC::MacroAssemblerX86Common::urshift32):
+ * assembler/X86Assembler.h:
+ (JSC::X86Assembler::):
+ (JSC::X86Assembler::shrl_i8r):
+ (JSC::X86Assembler::shrl_CLr):
+ Add unsigned right shift to the x86 assembler
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ (JSC::JIT::privateCompileSlowCases):
+ op_rshift no longer simply get thrown to a stub function
+ * jit/JIT.h:
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emit_op_urshift):
+ (JSC::JIT::emitSlow_op_urshift):
+ JSVALUE32 and JSVALUE64 implementation. Only supports
+ double lhs in JSVALUE64.
+ * jit/JITArithmetic32_64.cpp:
+ (JSC::JIT::emit_op_rshift):
+ (JSC::JIT::emitSlow_op_rshift):
+ (JSC::JIT::emit_op_urshift):
+ (JSC::JIT::emitSlow_op_urshift):
+ Refactor right shift code to have shared implementation between signed
+ and unsigned versions.
+
+2010-04-29 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Handle double on righthand side of a right shift
+ https://bugs.webkit.org/show_bug.cgi?id=38363
+
+ In 64-bit we support right shift of a double, and there's no
+ reason not to in 32-bit either. This is a 1.1% sunspider
+ improvement in 32bit.
+
+ Given high performance javascript code frequently makes
+ use of bit operators to perform double->int conversion i'll
+ follow this patch up with similar patches for bitwise 'and'
+ and 'or'.
+
+ * jit/JITArithmetic32_64.cpp:
+ (JSC::JIT::emit_op_rshift):
+ (JSC::JIT::emitSlow_op_rshift):
+
+2010-04-29 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Hoist JSVALUE32_64 arithmetic implementations into a separate file.
+
+ * GNUmakefile.am:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.pro:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emitSlow_op_jnless):
+ (JSC::JIT::emitSlow_op_jless):
+ (JSC::JIT::emitSlow_op_jnlesseq):
+ (JSC::JIT::emit_op_mod):
+ (JSC::JIT::compileBinaryArithOpSlowCase):
+ (JSC::JIT::emit_op_div):
+ (JSC::JIT::compileBinaryArithOp):
+ * jit/JITArithmetic32_64.cpp: Added.
+ (JSC::JIT::emit_op_negate):
+ (JSC::JIT::emitSlow_op_negate):
+ (JSC::JIT::emit_op_jnless):
+ (JSC::JIT::emitSlow_op_jnless):
+ (JSC::JIT::emit_op_jless):
+ (JSC::JIT::emitSlow_op_jless):
+ (JSC::JIT::emit_op_jnlesseq):
+ (JSC::JIT::emitSlow_op_jnlesseq):
+ (JSC::JIT::emit_op_lshift):
+ (JSC::JIT::emitSlow_op_lshift):
+ (JSC::JIT::emit_op_rshift):
+ (JSC::JIT::emitSlow_op_rshift):
+ (JSC::JIT::emit_op_bitand):
+ (JSC::JIT::emitSlow_op_bitand):
+ (JSC::JIT::emit_op_bitor):
+ (JSC::JIT::emitSlow_op_bitor):
+ (JSC::JIT::emit_op_bitxor):
+ (JSC::JIT::emitSlow_op_bitxor):
+ (JSC::JIT::emit_op_bitnot):
+ (JSC::JIT::emitSlow_op_bitnot):
+ (JSC::JIT::emit_op_post_inc):
+ (JSC::JIT::emitSlow_op_post_inc):
+ (JSC::JIT::emit_op_post_dec):
+ (JSC::JIT::emitSlow_op_post_dec):
+ (JSC::JIT::emit_op_pre_inc):
+ (JSC::JIT::emitSlow_op_pre_inc):
+ (JSC::JIT::emit_op_pre_dec):
+ (JSC::JIT::emitSlow_op_pre_dec):
+ (JSC::JIT::emit_op_add):
+ (JSC::JIT::emitAdd32Constant):
+ (JSC::JIT::emitSlow_op_add):
+ (JSC::JIT::emit_op_sub):
+ (JSC::JIT::emitSub32Constant):
+ (JSC::JIT::emitSlow_op_sub):
+ (JSC::JIT::emitBinaryDoubleOp):
+ (JSC::JIT::emit_op_mul):
+ (JSC::JIT::emitSlow_op_mul):
+ (JSC::JIT::emit_op_div):
+ (JSC::JIT::emitSlow_op_div):
+ (JSC::JIT::emit_op_mod):
+ (JSC::JIT::emitSlow_op_mod):
+
+2010-04-29 Zoltan Herczeg <zherczeg@webkit.org>
+
+ Reviewed by Oliver Hunt
+
+ Add sqrt() instruction support for ARM assembler (using VFP)
+ https://bugs.webkit.org/show_bug.cgi?id=38312
+
+ * assembler/ARMAssembler.h:
+ (JSC::ARMAssembler::):
+ (JSC::ARMAssembler::fsqrtd_r):
+ * assembler/MacroAssemblerARM.h:
+ (JSC::MacroAssemblerARM::supportsFloatingPointSqrt):
+ (JSC::MacroAssemblerARM::sqrtDouble):
+
+2010-04-29 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Refactor qtscriptglobal.h
+ https://bugs.webkit.org/show_bug.cgi?id=37953
+
+ Use the same pattern in qtscriptglobal.h as in
+ qwebkitglobal.h without checking for specific OSs.
+
+ * qt/api/qtscriptglobal.h:
+
+2010-04-29 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Small cleanup.
+
+ QScriptValuePrivate constructor shouldn't take QScriptEngine pointer
+ as a parameter, because it breaks a private / public separation rule.
+ QScriptEnginePrivate::get(QScriptEngine*) should return
+ a QScriptEnginePrivate pointer instead of a QScriptEnginePtr, it simplifies
+ implementation.
+
+ [Qt] QScriptValuePrivate class needs some cleanup.
+ https://bugs.webkit.org/show_bug.cgi?id=37729
+
+ * qt/api/qscriptengine_p.h:
+ (QScriptEnginePrivate::get):
+ * qt/api/qscriptvalue.cpp:
+ (QScriptValue::QScriptValue):
+ * qt/api/qscriptvalue_p.h:
+ (QScriptValuePrivate::QScriptValuePrivate):
+
+2010-04-29 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Simon Hausmann.
+
+ [WINCE] Export g_stackBase with JS_EXPORTDATA
+ https://bugs.webkit.org/show_bug.cgi?id=37437
+
+ Export g_stackBase with JS_EXPORTDATA as it is used by SharedTimerWince.cpp.
+
+ * runtime/Collector.cpp:
+
+2010-04-28 Oliver Hunt <oliver@apple.com>
+
+ Do an unordered compare so that we don't treat NaN incorrectly.
+
+ RS=Gavin Barraclough
+
+ * jit/ThunkGenerators.cpp:
+ (JSC::powThunkGenerator):
+
+2010-04-28 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Add fast paths for Math.pow and Math.sqrt
+ https://bugs.webkit.org/show_bug.cgi?id=38294
+
+ Add specialized thunks for Math.pow and Math.sqrt.
+ This requires adding a sqrtDouble function to the MacroAssembler
+ and sqrtsd to the x86 assembler.
+
+ Math.pow is slightly more complicated, in that we have
+ to implement exponentiation ourselves rather than relying
+ on hardware support. The inline exponentiation is restricted
+ to positive integer exponents on a numeric base. Exponentiation
+ is finally performed through the "Exponentiation by Squaring"
+ algorithm.
+
+ * assembler/AbstractMacroAssembler.h:
+ (JSC::AbstractMacroAssembler::ImmPtr::ImmPtr):
+ * assembler/MacroAssemblerARM.h:
+ (JSC::MacroAssemblerARM::supportsFloatingPointSqrt):
+ (JSC::MacroAssemblerARM::loadDouble):
+ (JSC::MacroAssemblerARM::sqrtDouble):
+ * assembler/MacroAssemblerARMv7.h:
+ (JSC::MacroAssemblerARMv7::supportsFloatingPointSqrt):
+ (JSC::MacroAssemblerARMv7::sqrtDouble):
+ * assembler/MacroAssemblerX86.h:
+ (JSC::MacroAssemblerX86::loadDouble):
+ (JSC::MacroAssemblerX86::supportsFloatingPointSqrt):
+ * assembler/MacroAssemblerX86Common.h:
+ (JSC::MacroAssemblerX86Common::sqrtDouble):
+ * assembler/MacroAssemblerX86_64.h:
+ (JSC::MacroAssemblerX86_64::loadDouble):
+ (JSC::MacroAssemblerX86_64::supportsFloatingPointSqrt):
+ * assembler/X86Assembler.h:
+ (JSC::X86Assembler::):
+ (JSC::X86Assembler::movsd_mr):
+ (JSC::X86Assembler::sqrtsd_rr):
+ (JSC::X86Assembler::X86InstructionFormatter::twoByteOp):
+ (JSC::X86Assembler::X86InstructionFormatter::memoryModRM):
+ * create_hash_table:
+ * jit/JIT.h:
+ * jit/JITInlineMethods.h:
+ * jit/JITOpcodes.cpp:
+ * jit/JITStubs.h:
+ (JSC::JITThunks::ctiNativeCallThunk):
+ * jit/JSInterfaceJIT.h:
+ (JSC::JSInterfaceJIT::emitLoadDouble):
+ (JSC::JSInterfaceJIT::emitJumpIfImmediateNumber):
+ (JSC::JSInterfaceJIT::emitJumpIfNotImmediateNumber):
+ (JSC::JSInterfaceJIT::emitLoadInt32):
+ * jit/SpecializedThunkJIT.h:
+ (JSC::SpecializedThunkJIT::loadDoubleArgument):
+ (JSC::SpecializedThunkJIT::loadInt32Argument):
+ (JSC::SpecializedThunkJIT::returnJSValue):
+ (JSC::SpecializedThunkJIT::returnDouble):
+ (JSC::SpecializedThunkJIT::finalize):
+ * jit/ThunkGenerators.cpp:
+ (JSC::sqrtThunkGenerator):
+ (JSC::powThunkGenerator):
+ * jit/ThunkGenerators.h:
+ * runtime/Executable.h:
+ (JSC::NativeExecutable::NativeExecutable):
+ * runtime/JSFunction.cpp:
+ (JSC::JSFunction::JSFunction):
+
+2010-04-28 Mike Thole <mthole@apple.com>
+
+ Reviewed by Mark Rowe.
+
+ Reenable WTF_USE_PROTECTION_SPACE_AUTH_CALLBACK now that an
+ exports file for it has been added.
+
+ * wtf/Platform.h:
+
+2010-04-28 Mike Thole <mthole@apple.com>
+
+ Build fix, not reviewed.
+
+ * wtf/Platform.h:
+ Disable WTF_USE_PROTECTION_SPACE_AUTH_CALLBACK until an exports file is created.
+
+2010-04-28 Mike Thole <mthole@apple.com>
+
+ Reviewed by David Kilzer.
+
+ Add canAuthenticateAgainstProtectionSpace() to frame loader so that a protection space
+ can be inspected before attempting to authenticate against it
+ https://bugs.webkit.org/show_bug.cgi?id=38271
+
+ * wtf/Platform.h: Add WTF_USE_PROTECTION_SPACE_AUTH_CALLBACK define.
+
+2010-04-28 Darin Adler <darin@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Don't use CFAbsoluteTimeGetCurrent on Mac OS X, since it's just a cover
+ for gettimeofday anyway.
+
+ * wtf/CurrentTime.cpp:
+ (WTF::currentTime): Remove the CF version of this. Change the "other POSIX"
+ version to pass 0 for the time zone instead of ignoring a return value.
+ Also get rid of unneeded type casts, since operations involving both
+ integers and doubles are always evaluated as doubles in C without explicit
+ type casting.
+
+2010-04-28 Darin Fisher <darin@chromium.org>
+
+ Reviewed by David Levin.
+
+ [Chromium] callOnMainThread should equate to MessageLoop::PostTask
+ https://bugs.webkit.org/show_bug.cgi?id=38276
+
+ * JavaScriptCore.gyp/JavaScriptCore.gyp:
+ * wtf/MainThread.cpp:
+ * wtf/chromium/ChromiumThreading.h:
+ * wtf/chromium/MainThreadChromium.cpp:
+ (WTF::initializeMainThread):
+ (WTF::callOnMainThread):
+ (WTF::callOnMainThreadAndWait):
+ (WTF::setMainThreadCallbacksPaused):
+ (WTF::isMainThread):
+
+2010-04-28 Simon Hausmann <simon.hausmann@nokia.com>, Kent Hansen <kent.hansen@nokia.com>
+
+ Reviewed by Darin Adler.
+
+ JSC's currentThreadStackBase is not reentrant on some platforms
+ https://bugs.webkit.org/show_bug.cgi?id=37195
+
+ This function needs to be reentrant to avoid memory corruption on platforms where
+ the implementation uses global variables.
+
+ This patch adds a mutex lock where necessary and makes the Symbian implementation
+ reentrant.
+
+ * runtime/Collector.cpp:
+ (JSC::currentThreadStackBaseMutex):
+ (JSC::currentThreadStackBase):
+
+2010-04-28 Thiago Macieira <thiago.macieira@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Fix compilation with gcc 3.4.
+
+ AtomicStringImpl.h:29: error: base `WebCore::StringImpl' with only
+ non-default constructor in class without a constructor
+
+ * wtf/text/AtomicStringImpl.h:
+ (WebCore::AtomicStringImpl::AtomicStringImpl): Provide a default constructor.
+ * wtf/text/StringImpl.h: Allow AtomicStringImpl to call a StringImpl constructor through a friend declaration.
+
+2010-04-27 Stephanie Lewis <slewis@apple.com>
+
+ Fix Tiger build.
+
+ * wtf/FastMalloc.cpp:
+ (WTF::TCMalloc_PageHeap::Carve):
+
+2010-04-26 Stephanie Lewis <slewis@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ https://bugs.webkit.org/show_bug.cgi?id=38154 FastMalloc calls madvise too often.
+ <rdar://problem/7834433> REGRESSSION: 1.5% PLT regression due to 56028 (return memory quicker).
+ To save on madvise calls when recommitting memory recommit the entire span and then carve it
+ instead of carving the span up and only committing the part that will be used immediately.
+
+ * wtf/FastMalloc.cpp:
+ (WTF::TCMalloc_PageHeap::New):
+ (WTF::TCMalloc_PageHeap::AllocLarge):
+ (WTF::TCMalloc_PageHeap::Carve):
+
+2010-04-26 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Add specialized thunks for a char code related string functions
+ https://bugs.webkit.org/show_bug.cgi?id=38177
+
+ This is a simple extension to my prior patch. Basically hoist the
+ existing character loading logic from the charCodeAt thunk and into
+ a helper function, then add a helper to load strings from the small
+ string cache. This allows trivial implementations of fromCharCode
+ and charAt.
+
+ * create_hash_table:
+ * jit/SpecializedThunkJIT.h:
+ (JSC::SpecializedThunkJIT::returnJSCell):
+ (JSC::SpecializedThunkJIT::tagReturnAsJSCell):
+ * jit/ThunkGenerators.cpp:
+ (JSC::stringCharLoad):
+ (JSC::charToString):
+ (JSC::charCodeAtThunkGenerator):
+ (JSC::charAtThunkGenerator):
+ (JSC::fromCharCodeThunkGenerator):
+ * jit/ThunkGenerators.h:
+ * runtime/SmallStrings.h:
+ (JSC::SmallStrings::singleCharacterStrings):
+ * runtime/StringConstructor.cpp:
+ (JSC::StringConstructor::StringConstructor):
+
+2010-04-27 Thomas Zander <t.zander@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Fix the build on Symbian on Linux using the Makefile based mkspec
+
+ * JavaScriptCore.pri: It is necessary to specify the library search path
+ when linking against JavaScriptCore.
+
+2010-04-21 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Compile fix for Visual Studio 2010
+ https://bugs.webkit.org/show_bug.cgi?id=37867
+
+ Patch by Prasanth Ullattil <prasanth.ullattil@nokia.com>
+
+ * runtime/Structure.cpp:
+ (JSC::Structure::transitionTableAdd):
+ * wtf/MathExtras.h:
+ * wtf/Platform.h:
+
+2010-04-27 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Rename COMPILER(MSVC7) to COMPILER(MSVC7_OR_LOWER)
+
+ * config.h:
+ (JSC::Structure::transitionTableAdd):
+ * wtf/Assertions.h:
+ * wtf/Atomics.h:
+ * wtf/CurrentTime.h:
+ (WTF::getLocalTime):
+ * wtf/Platform.h:
+ * wtf/StaticConstructors.h:
+ * wtf/StringExtras.h:
+ * wtf/Vector.h:
+ (WTF::::append):
+
+2010-04-15 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
+
+ Reviewed by Tor Arne Vestbø.
+
+ [Qt] Fix Mac build break.
+
+ https://bugs.webkit.org/show_bug.cgi?id=37867
+ - Make sure JavaScriptCore's debug_and_release config follows that
+ of WebCore.
+ - Use different name for JavaScriptCore target in debug and release
+ since they might be written in the same path at the same time on
+ parallel builds
+ - Consolidate the DESTDIR determination logic in JavaScriptCore.pri
+
+ * JavaScriptCore.pri:
+ * JavaScriptCore.pro:
+
+2010-04-21 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] Make sure WebKit is not compiled using C++0x.
+ https://bugs.webkit.org/show_bug.cgi?id=37867
+
+ As the rest of Qt compiles in the C++0x mode, people might start
+ compiling it in this mode. WebKit don't support this yet.
+
+ Patch by Thiago Macieira <thiago.macieira@nokia.com>
+
+ * JavaScriptCore.pro:
+
+2010-04-26 Oliver Hunt <oliver@apple.com>
+
+ Fix windows
+
+ * jit/SpecializedThunkJIT.h:
+ (JSC::SpecializedThunkJIT::argumentToVirtualRegister):
+
+2010-04-26 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Need to support more efficient dispatch of lightweight builtins
+ https://bugs.webkit.org/show_bug.cgi?id=38155
+
+ The problem with calling lightweight builtins is that marshalling
+ the call from the nitro calling convention to the system calling
+ convention is very expensive relative to the cost of the actually
+ evaluating the function. To work around this problem this patch
+ adds the ability to define a custom thunk for a builtin.
+
+ This allows us to use high performance custom implementations of
+ the common and sensible versions of simple builtins. This patch
+ includes a simple (use of which is currently hardcoded) thunk for
+ charCodeAt.
+
+ This adds a JSInterfaceJIT subclass called SpecializedThunkJIT
+ that has helper functions to remove (or at least reduce) the need
+ to have separate thunk implementations for each JSValue encoding.
+
+ * GNUmakefile.am:
+ * JavaScriptCore.pro:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ Many project file updates
+
+ * create_hash_table:
+ Add thunk generation callbacks to the hash tables, currently
+ we hardcode the script to only support charCodeAt
+
+ * jit/JITStubCall.h:
+ * jit/JITStubs.cpp:
+ (JSC::JITThunks::~JITThunks):
+ (JSC::JITThunks::specializedThunk):
+ * jit/JITStubs.h:
+ * jit/SpecializedThunkJIT.h: Added.
+ (JSC::SpecializedThunkJIT::SpecializedThunkJIT):
+ (JSC::SpecializedThunkJIT::loadCellArgument):
+ (JSC::SpecializedThunkJIT::loadJSStringArgument):
+ (JSC::SpecializedThunkJIT::loadInt32Argument):
+ (JSC::SpecializedThunkJIT::appendFailure):
+ (JSC::SpecializedThunkJIT::returnInt32):
+ (JSC::SpecializedThunkJIT::finalize):
+ (JSC::SpecializedThunkJIT::argumentToVirtualRegister):
+ (JSC::SpecializedThunkJIT::tagReturnAsInt32):
+ * jit/ThunkGenerators.cpp: Added.
+ (JSC::ThunkHelpers::stringImplDataOffset):
+ (JSC::ThunkHelpers::jsStringLengthOffset):
+ (JSC::ThunkHelpers::jsStringValueOffset):
+ (JSC::charCodeAtThunkGenerator):
+ * jit/ThunkGenerators.h: Added.
+ * runtime/Executable.h:
+ (JSC::NativeExecutable::NativeExecutable):
+ * runtime/JSFunction.cpp:
+ (JSC::JSFunction::JSFunction):
+ * runtime/JSFunction.h:
+ * runtime/JSGlobalData.h:
+ (JSC::JSGlobalData::getThunk):
+ * runtime/JSString.h:
+ (JSC::):
+ * runtime/JSValue.h:
+ Protect some of the JSVALUE32 and JSVALUE32_64 only constants
+ and function behind appropriate USE() guards to make it harder
+ to use the wrong flags for the target build.
+ * runtime/Lookup.cpp:
+ (JSC::HashTable::createTable):
+ (JSC::setUpStaticFunctionSlot):
+ * runtime/Lookup.h:
+ (JSC::HashEntry::initialize):
+ (JSC::HashEntry::generator):
+ (JSC::HashEntry::):
+ Make the lookup tables use a specialized thunkGenerator
+ if present
+ * wtf/text/StringImpl.h:
+
+2010-04-26 Oliver Hunt <oliver@apple.com>
+
+ Build fix
+
+ * runtime/JSImmediate.h:
+ * runtime/JSValue.h:
+
+2010-04-26 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Factor some basic JS interface logic out of JIT and into a superclass
+ https://bugs.webkit.org/show_bug.cgi?id=38163
+
+ Create JSInterfaceJIT to hold some common low level functions for
+ interacting with the JS RegisterFile. Doing this separately from
+ https://bugs.webkit.org/show_bug.cgi?id=38155 to ease reviewing.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * jit/JIT.h:
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::emitJumpSlowCaseIfNotJSCell):
+ * jit/JSInterfaceJIT.h: Added.
+ (JSC::JSInterfaceJIT::emitLoadJSCell):
+ (JSC::JSInterfaceJIT::emitJumpIfNotJSCell):
+ (JSC::JSInterfaceJIT::emitLoadInt32):
+ (JSC::JSInterfaceJIT::tagFor):
+ (JSC::JSInterfaceJIT::payloadFor):
+ (JSC::JSInterfaceJIT::addressFor):
+
+2010-04-26 Sam Weinig <sam@webkit.org>
+
+ Fix Tiger build.
+
+ * wtf/mac/MainThreadMac.mm:
+ (WTF::isMainThread):
+
+2010-04-26 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ <rdar://problem/7766413>
+
+ Fixed a crash seen when using the JavaScriptCore API with WebKit.
+
+ No layout test because DumpRenderTree doesn't use the JavaScriptCore API
+ in this way.
+
+ * interpreter/RegisterFile.cpp:
+ (JSC::RegisterFile::setGlobalObject):
+ (JSC::RegisterFile::clearGlobalObject):
+ (JSC::RegisterFile::globalObject):
+ * interpreter/RegisterFile.h:
+ (JSC::RegisterFile::RegisterFile): Use WeakGCPtr for managing m_globalObject,
+ since it's a weak pointer. (We never noticed this error before because,
+ in WebKit, global objects always have a self-reference in a global variable,
+ so marking the register file's global variables would keep m_globalObject
+ alive. In the JavaScriptCore API, you can allocate a global object with
+ no self-reference.)
+
+ * runtime/JSActivation.h: Removed unneeded #include.
+
+ * runtime/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::~JSGlobalObject): Don't use ==, since a weak
+ pointer is 0 when the object it points to runs its destructor.
+
+ * runtime/WeakGCPtr.h:
+ (JSC::WeakGCPtr::clear): Changed to return a bool indicating whether the
+ clear actually happened.
+ (JSC::WeakGCPtr::assign): Changed to forbid assignment of 0 as a shorthand
+ for calling clear(). A client should never clear by assigning 0, since
+ clear() should be conditional on whether the object doing the clearing
+ is still pointed to by the weak pointer. (Otherwise, a zombie object might
+ clear a pointer to a new, valid object.)
+
+2010-04-25 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Maciej Stachowiak.
+
+ Fix for https://bugs.webkit.org/show_bug.cgi?id=38097
+ Disentangle initializing the main thread from initializing threading
+
+ This is the first step in getting rid of the WEB_THREAD #define and
+ paving the way to allowing mac both WebKit and WebKit2 to use the same
+ WebCore.
+
+ * JavaScriptCore.exp: Export initializeMainThread and initializeMainThreadToProcessMainThread.
+ * JavaScriptCore.xcodeproj/project.pbxproj: Sort files.
+
+ * wtf/MainThread.cpp:
+ (WTF::mainThreadInitializationMutex):
+ (WTF::mainThreadFunctionQueueMutex):
+ (WTF::initializeMainThread):
+ (WTF::deprecatedInitializeMainThread):
+ * wtf/MainThread.h:
+ Added Mac only initializeMainThreadToProcessMainThread which sets up callOnMainThread
+ and isMainThead calls to assume that WebCore's main thread is also the
+ process's main thread. Since it is possible that both initializeMainThread
+ and initializeMainThreadToProcessMainThread could be called, the first one called
+ wins (either will work).
+
+ * wtf/Threading.h: Moved to top of file.
+
+ * wtf/ThreadingPthreads.cpp:
+ (WTF::initializeThreading): Remove call to initializeMainThread.
+ * wtf/ThreadingWin.cpp:
+ (WTF::initializeThreading): Ditto.
+ * wtf/gtk/ThreadingGtk.cpp:
+ (WTF::initializeThreading): Ditto.
+
+ * wtf/mac/MainThreadMac.mm:
+ (WTF::initializeMainThreadPlatform):
+ (WTF::initializeMainThreadToProcessMainThread):
+ (WTF::scheduleDispatchFunctionsOnMainThread):
+ (WTF::isMainThread):
+ Add runtime switch between the old behavior of using the system's main
+ thread and a stored pointer to the main thread. Tiger always uses the
+ system's main thread.
+
+ * wtf/qt/ThreadingQt.cpp:
+ (WTF::initializeThreading): Remove call to initializeMainThread.
+ * wtf/win/MainThreadWin.cpp:
+ (WTF::initializeMainThreadPlatform): Add call to initializeCurrentThreadInternal
+ removed from initializeThreading.
+
+2010-04-26 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Fix a memory leak in the QScriptString.
+
+ QScriptStringPrivate's constructor shouldn't call JSStringRetain as
+ QScriptConverter implicitly pass a JSStringRef ownership.
+
+ [Qt] QScriptStringPrivate c'tor problem
+ https://bugs.webkit.org/show_bug.cgi?id=38110
+
+ * qt/api/qscriptstring_p.h:
+ (QScriptStringPrivate::QScriptStringPrivate):
+
+2010-04-24 Darin Adler <darin@apple.com>
+
+ Reviewed by Dan Bernstein.
+
+ REGRESSION (r56560): Crash in parseFloat if passed invalid UTF-16 data
+ https://bugs.webkit.org/show_bug.cgi?id=38083
+ rdar://problem/7901044
+
+ Tests: fast/js/ToNumber.html
+ fast/js/parseFloat.html
+
+ * runtime/JSGlobalObjectFunctions.cpp:
+ (JSC::parseInt): Added a FIXME comment about a problem I noticed.
+ (JSC::parseFloat): Added a FIXME comment about a problem I noticed;
+ covered by test cases in the test I added.
+ * runtime/UString.cpp:
+ (JSC::UString::toDouble): Added FIXME comments about two problems I
+ noticed; covered by test cases in the tests I added. Added a return
+ statement so we don't crash when illegal UTF-16 sequences are present.
+
+2010-04-24 Anton Muhin <antonm@chromium.org>
+
+ Reviewed by Darin Adler.
+
+ Allow to construct HashTraits<WebCore::QualifiedName>::constructDeletedValue
+
+ Former implementation attempted to use AtomicString(HashTableDeletedValue)
+ however those values cannot be used that way: one cannot construct
+ QualifiedNameImpl out of such AtomicString as we'll try to lookup this string
+ in the table, for example.
+ https://bugs.webkit.org/show_bug.cgi?id=37722
+
+ * wtf/RefPtr.h: expose hash table deleted value
+
+2010-04-23 Sam Weinig <sam@webkit.org>
+
+ Reviewed by David Levin.
+
+ Fix for https://bugs.webkit.org/show_bug.cgi?id=38060
+ Split up Threading.h
+
+ Move bits for of Threading.h into 3 new files.
+ - Atomics.h for atomic operations.
+ - ThreadSafeShared.h for the ThreadSafeShared class.
+ - ThreadingPrimitives.h for the primitives and platform types.
+
+ Basic threading operations (creation, etc.) remain in Threading.h.
+
+ * GNUmakefile.am:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * wtf/Atomics.h: Copied from wtf/Threading.h.
+ * wtf/ThreadSafeShared.h: Copied from wtf/Threading.h.
+ * wtf/Threading.h:
+ * wtf/ThreadingPrimitives.h: Copied from wtf/Threading.h.
+
+2010-04-23 Sam Weinig <sam@webkit.org>
+
+ Fix Qt build.
+
+ * wtf/qt/MainThreadQt.cpp: #include <QThread>
+
+2010-04-22 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Anders Carlsson.
+
+ Fix for https://bugs.webkit.org/show_bug.cgi?id=38022
+ Move isMainThread predicate function to MainThread.h
+
+ * wtf/MainThread.cpp:
+ (WTF::initializeMainThread):
+ (WTF::isMainThread):
+ * wtf/MainThread.h:
+ * wtf/Threading.h:
+ * wtf/ThreadingPthreads.cpp:
+ (WTF::initializeThreading):
+ * wtf/ThreadingWin.cpp:
+ (WTF::initializeThreading):
+ * wtf/gtk/ThreadingGtk.cpp:
+ (WTF::initializeThreading):
+ * wtf/mac/MainThreadMac.mm:
+ (WTF::initializeMainThreadPlatform):
+ (WTF::isMainThread):
+ * wtf/qt/MainThreadQt.cpp:
+ (WTF::isMainThread):
+ * wtf/qt/ThreadingQt.cpp:
+ (WTF::initializeThreading):
+ * wtf/text/AtomicString.cpp:
+
+2010-04-23 Gabor Rapcsanyi <rgabor@inf.u-szeged.hu>
+
+ Reviewed by Laszlo Gombos.
+
+ Add RVCT support for Linux
+
+ Developed in cooperation with Gabor Loki.
+
+ * API/JSStringRef.h:
+ * jit/ExecutableAllocator.h:
+ * jit/ExecutableAllocatorPosix.cpp:
+ (JSC::ExecutableAllocator::cacheFlush):
+ * jit/JITStubs.cpp:
+ * wtf/MathExtras.h:
+ * wtf/unicode/qt4/UnicodeQt4.h:
+
+2010-04-23 Patrick Gansterer <paroga@paroga.com>
+
+ Reviewed by Laszlo Gombos.
+
+ [WIN] Move OwnPtrWin.cpp into platform specific folder.
+ https://bugs.webkit.org/show_bug.cgi?id=38042
+
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * wtf/OwnPtrWin.cpp: Removed.
+ * wtf/win/OwnPtrWin.cpp: Copied from JavaScriptCore/wtf/OwnPtrWin.cpp.
+
+2010-04-23 Patrick Gansterer <paroga@paroga.com>
+
+ Reviewed by Laszlo Gombos.
+
+ [BREWMP] Move OwnPtrBrew.cpp into platform specific folder.
+ https://bugs.webkit.org/show_bug.cgi?id=38042
+
+ * wtf/OwnPtrBrew.cpp: Removed.
+ * wtf/brew/OwnPtrBrew.cpp: Copied from JavaScriptCore/wtf/OwnPtrBrew.cpp.
+
+2010-04-22 Steve Block <steveblock@google.com>
+
+ Reviewed by Adam Barth.
+
+ Update Android to use isfinite, isinf, isnan and signbit from namespace std.
+ https://bugs.webkit.org/show_bug.cgi?id=37948
+
+ * wtf/MathExtras.h:
+
+2010-04-22 Fumitoshi Ukai <ukai@chromium.org>
+
+ Unreviewed build fix.
+
+ * wtf/MD5.cpp: fix include path of CString.h
+
+2010-04-22 Fumitoshi Ukai <ukai@chromium.org>
+
+ Reviewed by Adam Barth.
+
+ MD5 is required for WebSocket new protocol implementation
+ https://bugs.webkit.org/show_bug.cgi?id=37913
+
+ * GNUmakefile.am:
+ * JavaScriptCore.exp:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.pro:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * wtf/MD5.cpp: Added.
+ * wtf/MD5.h: Added.
+
+2010-04-22 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by NOBODY (build fix).
+ Errk, accidentally committed commenting out two ASSERTs! reverting.
+
+ * runtime/Collector.cpp:
+ (JSC::Heap::protect):
+ (JSC::Heap::unprotect):
+
+2010-04-22 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ https://bugs.webkit.org/show_bug.cgi?id=38006
+ Change lifetime of JSC::IdentifierTables used by WebCores to match AtomicStringTable
+
+ Presently JSC's IdentifierTables are owned by the JSGlobalData. For
+ JSGlobalData objects created via the API this should continue to be the case,
+ but for the JSGlobalData objects used by WebCore (the main thread's common
+ global data, and those for workers) use a IdentifierTable provided (and owned)
+ by wtfThreadData. This allow the lifetime of these IdentifierTable to match
+ those of the corresponding AtomicStringTables.
+
+ * API/APIShims.h:
+ (JSC::APIEntryShim::APIEntryShim):
+ * API/JSContextRef.cpp:
+ (JSContextGroupCreate):
+ * runtime/Collector.cpp:
+ (JSC::Heap::protect):
+ (JSC::Heap::unprotect):
+ (JSC::Heap::markRoots):
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData):
+ (JSC::JSGlobalData::~JSGlobalData):
+ (JSC::JSGlobalData::createContextGroup):
+ (JSC::JSGlobalData::create):
+ (JSC::JSGlobalData::sharedInstance):
+ * runtime/JSGlobalData.h:
+ (JSC::JSGlobalData::):
+ (JSC::JSGlobalData::isSharedInstance):
+ * runtime/JSLock.cpp:
+ (JSC::JSLock::JSLock):
+ (JSC::JSLock::lock):
+ (JSC::JSLock::unlock):
+ (JSC::JSLock::DropAllLocks::DropAllLocks):
+ * wtf/WTFThreadData.cpp:
+ (WTF::WTFThreadData::WTFThreadData):
+ (WTF::WTFThreadData::~WTFThreadData):
+
+2010-04-22 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r58110.
+ http://trac.webkit.org/changeset/58110
+ https://bugs.webkit.org/show_bug.cgi?id=38007
+
+ Caused an internal compiler error on Qt (Requested by abarth
+ on #webkit).
+
+ * wtf/MathExtras.h:
+
+2010-04-22 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by NOBODY (windows build fix).
+
+ * API/JSWeakObjectMapRefPrivate.cpp:
+
+2010-04-22 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by NOBODY (windows build fix).
+
+ * API/JSBase.cpp:
+ * API/JSCallbackObject.cpp:
+
+2010-04-22 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ https://bugs.webkit.org/show_bug.cgi?id=37978
+ Unify JSC::IdentifierTable and WebCore::AtomicStringTable implementations.
+
+ These two classes both implement a HashSet of uniqued StringImpls, with
+ translator classes to avoid unnecessary object creation. The only difference
+ between the classes is which flag (isIdentifier or inTable) is set.
+ Combine the two classes using a template predicated on which flag to use.
+
+ New class AtomicStringTable created, containing all the goodness from
+ IdentifierTable & AtomicStringTable, expect for Identifier's literalTable,
+ which has been moved onto JSGlobalData. Removed duplicate string translator
+ classes. Renamed StringImpl's inTable flag to more explicit 'isAtomic',
+ and set this on the empty string (which matches Identifier behaviour, and
+ removes a redundant check for zero-length).
+
+ * GNUmakefile.am:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * runtime/Identifier.cpp:
+ (JSC::createLiteralTable):
+ (JSC::deleteLiteralTable):
+ (JSC::Identifier::add):
+ (JSC::Identifier::addSlowCase):
+ * runtime/Identifier.h:
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData):
+ (JSC::JSGlobalData::~JSGlobalData):
+ * runtime/JSGlobalData.h:
+ * wtf/WTFThreadData.cpp:
+ (WTF::WTFThreadData::WTFThreadData):
+ (WTF::WTFThreadData::~WTFThreadData):
+ * wtf/WTFThreadData.h:
+ (WTF::WTFThreadData::atomicStringTable):
+ * wtf/text/AtomicString.cpp:
+ (WebCore::table):
+ (WebCore::operator==):
+ (WebCore::AtomicString::add):
+ (WebCore::AtomicString::find):
+ (WebCore::AtomicString::remove):
+ * wtf/text/AtomicStringTable.h: Added.
+ (WTF::CStringTranslator::hash):
+ (WTF::CStringTranslator::equal):
+ (WTF::CStringTranslator::translate):
+ (WTF::UCharBufferTranslator::hash):
+ (WTF::UCharBufferTranslator::equal):
+ (WTF::UCharBufferTranslator::translate):
+ (WTF::HashAndCharactersTranslator::hash):
+ (WTF::HashAndCharactersTranslator::equal):
+ (WTF::HashAndCharactersTranslator::translate):
+ (WTF::IdentifierOrAtomicStringTable::remove):
+ (WTF::::~IdentifierOrAtomicStringTable):
+ (WTF::::add):
+ (WTF::::find):
+ * wtf/text/StringImpl.cpp:
+ (WebCore::StringImpl::~StringImpl):
+ * wtf/text/StringImpl.h:
+ (WebCore::StringImpl::isAtomic):
+ (WebCore::StringImpl::setIsAtomic):
+ (WebCore::equal):
+ * wtf/text/StringImplBase.h:
+ (WTF::StringImplBase::StringImplBase):
+
+2010-04-22 Steve Block <steveblock@google.com>
+
+ Reviewed by Adam Barth.
+
+ Update Android to use isfinite, isinf, isnan and signbit from namespace std.
+ https://bugs.webkit.org/show_bug.cgi?id=37948
+
+ * wtf/MathExtras.h:
+
+2010-04-22 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] Remove dependency of JSC to QtGui
+ https://bugs.webkit.org/show_bug.cgi?id=37867
+
+ The patch also make sure that hal.h is in the include path on Symbian.
+ The dependency to QtGui took care of that before.
+
+ Patch by Thiago Macieira <thiago.macieira@nokia.com>
+ and Rohan McGovern <rohan.mcgovern@nokia.com>
+
+ * JavaScriptCore.pri:
+ * JavaScriptCore.pro:
+
+2010-04-22 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
+
+ Reviewed by Tor Arne Vestbø.
+
+ [Qt] Corrects symbols visibility for JavaScriptCore.
+
+ https://bugs.webkit.org/show_bug.cgi?id=37867
+
+ * JavaScriptCore.pro:
+
+2010-04-22 Gabor Loki <loki@webkit.org>
+
+ Reviewed by Gavin Barraclough.
+
+ Use BLX and BX to keep happy the return stack predictor above ARMv4
+ https://bugs.webkit.org/show_bug.cgi?id=37862
+
+ Inspired by Jacob Bramley's patch from JaegerMonkey
+
+ * assembler/ARMAssembler.cpp:
+ (JSC::ARMAssembler::executableCopy):
+ * assembler/ARMAssembler.h:
+ (JSC::ARMAssembler::):
+ (JSC::ARMAssembler::bx):
+ (JSC::ARMAssembler::blx):
+ (JSC::ARMAssembler::loadBranchTarget):
+ (JSC::ARMAssembler::jmp):
+ (JSC::ARMAssembler::getLdrImmAddress):
+ * assembler/MacroAssemblerARM.h:
+ (JSC::MacroAssemblerARM::jump):
+ (JSC::MacroAssemblerARM::nearCall):
+ (JSC::MacroAssemblerARM::call):
+ (JSC::MacroAssemblerARM::ret):
+ (JSC::MacroAssemblerARM::prepareCall):
+ (JSC::MacroAssemblerARM::call32):
+
+2010-04-21 Andy Estes <aestes@apple.com>
+
+ Rubber stamped by Mark Rowe.
+
+ Export WTF::deleteOwnedPtr(HFONT).
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-04-21 Gavin Barraclough <barraclough@apple.com>
+
+ Rubber Stamped by Oliver Hunt.
+
+ Make SmallStrings store an array of RefPtr<StringImpl>,
+ instead of a direct array of StringImpls. This allows
+ us to remove a friend (and a layering violation) from
+ WTF::StringImpl, and makes it so that all StringImpls
+ are individually heap allocated.
+
+ * runtime/SmallStrings.cpp:
+ (JSC::SmallStringsStorage::rep):
+ (JSC::SmallStringsStorage::SmallStringsStorage):
+ * wtf/text/StringImpl.h:
+
+2010-04-21 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ Fix for https://bugs.webkit.org/show_bug.cgi?id=37937
+ Wean JavaScriptCore off calls to isMainThread()
+
+ - Replace use of isMainThread() for interpreter reentry checks
+ with a stored value on the JSGlobalData.
+ - Replace use of isMainThread() for useMainThread only check in the
+ collector with a stored exclusive thread.
+
+ * API/JSContextRef.cpp:
+ (JSContextGroupCreate):
+ Always default to a small stack type for uses of the JSC API. It is
+ unlikely that the interpreter reentry required on the web will be as
+ important for other uses of JavaScriptCore.
+
+ * JavaScriptCore.exp:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ Update exports.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::execute):
+ (JSC::Interpreter::prepareForRepeatCall):
+ Use new stored JSGlobalData::maxReentryDepth instead of isMainThread().
+
+ * interpreter/Interpreter.h:
+ Rename MaxMainThreadReentryDepth to MaxLargeThreadReentryDepth and
+ MaxSecondaryThreadReentryDepth to MaxSmallThreadReentryDepth.
+
+ * jsc.cpp:
+ (main): Use the a large stack for jsc since it is always using the
+ main thread.
+
+ * runtime/ArrayPrototype.cpp:
+ (JSC::arrayProtoFuncToString):
+ (JSC::arrayProtoFuncToLocaleString):
+ (JSC::arrayProtoFuncJoin):
+ Use new stored JSGlobalData::maxReentryDepth instead of isMainThread().
+
+ * runtime/Collector.cpp:
+ (JSC::Heap::registerThread):
+ Use the concept of making JSC run on an exclusiveThread instead of
+ forcing a mainThreadOnly assertion.
+
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData):
+ (JSC::JSGlobalData::createNonDefault):
+ (JSC::JSGlobalData::create):
+ (JSC::JSGlobalData::createLeaked):
+ (JSC::JSGlobalData::sharedInstance):
+ * runtime/JSGlobalData.h:
+ Add ThreadStackType argument to JSGlobalData constructors and set
+ maxReentryDepth based on it.
+
+2010-04-21 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by NOBODY (windows build fix pt. 3).
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-04-21 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by NOBODY (windows build fix pt. 2).
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-04-21 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by NOBODY (Qt build fix).
+
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.pro:
+ * wtf/qt/StringQt.cpp: Copied from WebCore/platform/text/qt/StringQt.cpp.
+
+2010-04-21 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by NOBODY (windows build fix).
+
+ * API/JSValueRef.cpp:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * runtime/Identifier.cpp:
+ (JSC::IdentifierTable::~IdentifierTable):
+ (JSC::IdentifierTable::add):
+ * runtime/Identifier.h:
+ * wtf/WTFThreadData.h:
+ (JSC::IdentifierTable::remove):
+ (JSC::IdentifierTable::literalTable):
+ * wtf/text/StringImpl.cpp:
+ (WebCore::StringImpl::~StringImpl):
+
+2010-04-20 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt, Darin Adler.
+
+ Bug 37906 - Remove JSC::UStringImpl; unify with StringImpl.
+
+ JSC::UStringImpl and WebCore::StringImpl (soon to be renamed to
+ WTF::StringImpl) are almost identical. Remove duplication of code by unifying
+ the two, move missing features from UStringImpl into StringImpl & delete the
+ class UStringImpl.
+
+ * API/JSClassRef.cpp:
+ * API/JSContextRef.cpp:
+ * GNUmakefile.am:
+ * JavaScriptCore.exp:
+ * JavaScriptCore.pro:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * bytecode/EvalCodeCache.h:
+ * bytecode/JumpTable.cpp:
+ * profiler/ProfileNode.cpp:
+ * runtime/Identifier.cpp:
+ (JSC::Identifier::add):
+ * runtime/Identifier.h:
+ (JSC::Identifier::equal):
+ * runtime/UString.cpp:
+ * runtime/UString.h:
+ (WTF::):
+ * runtime/UStringImpl.cpp: Removed.
+ * runtime/UStringImpl.h:
+ * wtf/text/StringHash.h:
+ (WebCore::StringHash::equal):
+ (WebCore::CaseFoldingHash::equal):
+ * wtf/text/StringImpl.cpp:
+ (WebCore::StringImpl::~StringImpl):
+ (WebCore::StringImpl::empty):
+ (WebCore::StringImpl::sharedBuffer):
+ (WebCore::equal):
+ * wtf/text/StringImpl.h:
+ (WebCore::StringImpl::StringImpl):
+ (WebCore::StringImpl::create):
+ (WebCore::StringImpl::tryCreateUninitialized):
+ (WebCore::StringImpl::cost):
+ (WebCore::StringImpl::isIdentifier):
+ (WebCore::StringImpl::setIsIdentifier):
+ (WebCore::StringImpl::computeHash):
+ (WebCore::StringImpl::copyChars):
+ (WebCore::StringImpl::):
+
+2010-04-21 Patrick Gansterer <paroga@paroga.com>
+
+ Reviewed by Darin Adler.
+
+ Added missing #include "Lookup.h" in LUT source files.
+ https://bugs.webkit.org/show_bug.cgi?id=37903
+
+ * runtime/ArrayPrototype.cpp:
+ * runtime/DatePrototype.cpp:
+ * runtime/JSONObject.cpp:
+ * runtime/MathObject.cpp:
+ * runtime/NumberConstructor.cpp:
+ * runtime/RegExpConstructor.cpp:
+ * runtime/RegExpObject.cpp:
+ * runtime/StringPrototype.cpp:
+
+2010-04-21 Gustavo Sverzut Barbieri <barbieri@profusion.mobi>
+
+ Reviewed by Nikolas Zimmermann.
+
+ Add missing EFL JavaScriptCore file.
+ http://webkit.org/b/37854
+
+ * wtf/efl: Added.
+ * wtf/efl/MainThreadEfl.cpp: Added.
+ (WTF::initializeMainThreadPlatform):
+ (WTF::timeoutFired):
+ (WTF::scheduleDispatchFunctionsOnMainThread):
+
+2010-04-20 Xan Lopez <xlopez@igalia.com>
+
+ Another attempt to fix the build.
+
+ * GNUmakefile.am:
+
+2010-04-20 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ [ES5] RegExp literals are constants that should be persistent across multiple function calls.
+ https://bugs.webkit.org/show_bug.cgi?id=37908
+
+ Dump the separate RegExp constant pool, and just use the standard JS constant pool
+ in codeblock. This allows us to drop op_new_regexp and all associated code as well.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::dump):
+ (JSC::CodeBlock::shrinkToFit):
+ * bytecode/CodeBlock.h:
+ * bytecode/Opcode.h:
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::emitLoad):
+ * bytecompiler/BytecodeGenerator.h:
+ * bytecompiler/NodesCodegen.cpp:
+ (JSC::RegExpNode::emitBytecode):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ * jit/JIT.h:
+ * jit/JITOpcodes.cpp:
+ * jit/JITStubs.cpp:
+ * jit/JITStubs.h:
+ (JSC::):
+
+2010-04-20 Oliver Hunt <oliver@apple.com>
+
+ Fix license on create_regex_tables
+
+ * create_regex_tables:
+
+2010-04-20 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by NOBODY (Build fix).
+
+ Fix gtk
+
+ * GNUmakefile.am:
+ * make-generated-sources.sh:
+
+2010-04-20 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 37895 - Share common code from UStringImplBase with StringImpl
+
+ The implementation of StringImpl & UStringImpl is very similar. Restructure
+ StringImpl to match UStringImpl, moving the flags and length into a base class,
+ so that this can be shared between both string types to increase code reuse.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * runtime/RopeImpl.h:
+ (JSC::RopeImpl::RopeImpl):
+ * runtime/UStringImpl.h:
+ (JSC::UStringImpl::UStringImpl):
+ * wtf/text/StringImpl.h:
+ (WebCore::StringImpl::StringImpl):
+ (WebCore::StringImpl::characters):
+ * wtf/text/StringImplBase.h: Copied from JavaScriptCore/runtime/UStringImpl.h.
+ (WTF::StringImplBase::length):
+ (WTF::StringImplBase::operator new):
+ (WTF::StringImplBase::StringImplBase):
+
+2010-04-20 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Autogenerate yarr character tables
+ https://bugs.webkit.org/show_bug.cgi?id=37877
+
+ Use a python script to automatically generate character tables
+ for the builtin YARR character classes. This allows us to generate
+ actual tables as well, by using these tables we can both increase
+ performance of the check (for complex builtins) and reduce the actual
+ code size.
+
+ 4-8% win on string-unpack-code, but lots of noise on other tests so
+ i'm only confident saying its a 1% win overall.
+
+ * DerivedSources.make:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * assembler/AbstractMacroAssembler.h:
+ (JSC::AbstractMacroAssembler::ExtendedAddress::ExtendedAddress):
+ * assembler/MacroAssembler.h:
+ (JSC::MacroAssembler::branchTest8):
+ * assembler/MacroAssemblerX86Common.h:
+ (JSC::MacroAssemblerX86Common::branchTest8):
+ * assembler/MacroAssemblerX86_64.h:
+ (JSC::MacroAssemblerX86_64::branchTest8):
+ * assembler/X86Assembler.h:
+ (JSC::X86Assembler::cmpb_im):
+ (JSC::X86Assembler::testb_im):
+ * bytecode/SamplingTool.cpp:
+ (JSC::SamplingTool::dump):
+ * create_regex_tables: Added.
+ * yarr/RegexCompiler.cpp:
+ (JSC::Yarr::CharacterClassConstructor::charClass):
+ * yarr/RegexJIT.cpp:
+ (JSC::Yarr::RegexGenerator::matchCharacterClass):
+ (JSC::Yarr::RegexGenerator::generatePatternCharacterGreedy):
+ (JSC::Yarr::RegexGenerator::generatePatternCharacterNonGreedy):
+ (JSC::Yarr::RegexGenerator::generateCharacterClassGreedy):
+ * yarr/RegexPattern.h:
+ (JSC::Yarr::CharacterClassTable::create):
+ (JSC::Yarr::CharacterClassTable::CharacterClassTable):
+ (JSC::Yarr::CharacterClass::CharacterClass):
+
+2010-04-20 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by NOBODY (speculative windows fix - missed a bit!).
+
+ * wtf/text/AtomicString.h:
+
+2010-04-20 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by NOBODY (speculative windows fix).
+
+ * wtf/text/AtomicString.h:
+
+2010-04-20 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by NOBODY (windows build fix).
+
+ Add missing .def file entries.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-04-20 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Bug 37869 - Move URopeImpl to its own .h/.cpp
+
+ Currently Ropes are implemented by the class URopeImpl, which is defined in
+ UStringImpl.h, and then typedefed to the name JSString::Rope. Remove the
+ typedef, and rename all uses of URopeImpl and JSString::Rope to just RopeImpl.
+
+ Move RopeImpl to its own header, and remove all remaining references to ropes
+ from UStringImpl (rename UStringOrRopeImpl to UStringImplBase, rename or move
+ the isRope & deref methods from UStringOrRopeImpl).
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * runtime/JSString.cpp:
+ (JSC::JSString::resolveRope):
+ * runtime/JSString.h:
+ (JSC::):
+ (JSC::RopeBuilder::JSString):
+ (JSC::RopeBuilder::~JSString):
+ (JSC::RopeBuilder::appendStringInConstruct):
+ (JSC::RopeBuilder::JSStringFinalizerStruct::):
+ * runtime/RopeImpl.cpp: Copied from JavaScriptCore/runtime/UStringImpl.cpp.
+ (JSC::RopeImpl::derefFibersNonRecursive):
+ (JSC::RopeImpl::destructNonRecursive):
+ * runtime/RopeImpl.h: Copied from JavaScriptCore/runtime/UStringImpl.h.
+ (JSC::RopeImpl::tryCreateUninitialized):
+ (JSC::RopeImpl::isRope):
+ (JSC::RopeImpl::deref):
+ (JSC::RopeImpl::RopeImpl):
+ * runtime/UStringImpl.cpp:
+ * runtime/UStringImpl.h:
+ (JSC::UStringImplBase::isInvalid):
+ (JSC::UStringImplBase::ref):
+ (JSC::UStringImplBase::UStringImplBase):
+ (JSC::UStringImplBase::):
+ (JSC::UStringImpl::UStringImpl):
+
+2010-04-20 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Bug 37828 - Move WebCore's String classes to WTF
+
+ Move these classes up to WTF so they are available to all clients of WTF (in
+ particular JSC).
+
+ As a first patch, making the most minimal change possible, since this patch
+ could easily grow rather large since we'll have to change every class forward
+ declaration ( e.g. every "namespace WebCore { class String; }" much change to
+ "namespace WTF { class String; }").
+
+ Moving the files, but leaving the classes logically in the WebCore namespace -
+ which is technically a layering violation - I'll come back and fix this up in a
+ subsequent patch.
+
+ * Android.mk:
+ * Android.v8.wtf.mk:
+ * GNUmakefile.am:
+ * JavaScriptCore.exp:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.pro:
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * config.h:
+ * wtf/StaticConstructors.h: Copied from WebCore/platform/StaticConstructors.h.
+ * wtf/text/AtomicString.cpp: Copied from WebCore/platform/text/AtomicString.cpp.
+ * wtf/text/AtomicString.h: Copied from WebCore/platform/text/AtomicString.h.
+ * wtf/text/AtomicStringImpl.h: Copied from WebCore/platform/text/AtomicStringImpl.h.
+ * wtf/text/StringBuffer.h: Copied from WebCore/platform/text/StringBuffer.h.
+ * wtf/text/StringHash.h: Copied from WebCore/platform/text/StringHash.h.
+ * wtf/text/StringImpl.cpp: Copied from WebCore/platform/text/StringImpl.cpp.
+ * wtf/text/StringImpl.h: Copied from WebCore/platform/text/StringImpl.h.
+ * wtf/text/WTFString.cpp: Copied from WebCore/platform/text/String.cpp.
+ (WebCore::charactersToFloat):
+ * wtf/text/WTFString.h: Copied from WebCore/platform/text/PlatformString.h.
+
+2010-04-20 Csaba Osztrogonác <ossy@webkit.org>
+
+ [Qt] Unreviewed speculative buildfix for WinCE after r57882
+ https://bugs.webkit.org/show_bug.cgi?id=37701
+
+ * JavaScriptCore.pri: missing wince* case added.
+
+2010-04-20 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by NOBODY (build fix).
+ Speculative Chromium/Win build fix, attempt #2.
+
+ * config.h:
+
+2010-04-20 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by NOBODY (build fix).
+ Speculative Chromium/Win build fix.
+
+ * config.h: JS_EXPORTDATA should do nothing on !JSC builds.
+
+2010-04-20 Csaba Osztrogonác <ossy@webkit.org>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Target(WebCore,jsc,...) must depends on static library of JavaScriptCore
+ https://bugs.webkit.org/show_bug.cgi?id=37701
+
+ * JavaScriptCore.pri: dependency added.
+
+2010-04-20 Gavin Barraclough <barraclough@apple.com>
+
+ Rubber stamped by Maciej Stachowiak (relanding r57829).
+ Added missing JS_EXPORTDATA
+
+ * API/APIShims.h:
+ (JSC::APIEntryShimWithoutLock::APIEntryShimWithoutLock):
+ (JSC::APIEntryShimWithoutLock::~APIEntryShimWithoutLock):
+ (JSC::APICallbackShim::APICallbackShim):
+ (JSC::APICallbackShim::~APICallbackShim):
+ * API/JSContextRef.cpp:
+ * Android.mk:
+ * Android.v8.wtf.mk:
+ * GNUmakefile.am:
+ * JavaScriptCore.exp:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.pro:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * runtime/Completion.cpp:
+ (JSC::checkSyntax):
+ (JSC::evaluate):
+ * runtime/Identifier.cpp:
+ (JSC::Identifier::remove):
+ (JSC::Identifier::checkCurrentIdentifierTable):
+ * runtime/Identifier.h:
+ * runtime/InitializeThreading.cpp:
+ (JSC::initializeThreadingOnce):
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::create):
+ * wtf/WTFThreadData.cpp: Copied from JavaScriptCore/wtf/WTFThreadData.cpp.
+ * wtf/WTFThreadData.h: Copied from JavaScriptCore/wtf/WTFThreadData.h.
+
+2010-04-19 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by NOBODY (rolling out r57829).
+ This broke windows.
+
+ * API/APIShims.h:
+ (JSC::APIEntryShimWithoutLock::APIEntryShimWithoutLock):
+ (JSC::APIEntryShimWithoutLock::~APIEntryShimWithoutLock):
+ (JSC::APICallbackShim::APICallbackShim):
+ (JSC::APICallbackShim::~APICallbackShim):
+ * API/JSContextRef.cpp:
+ * Android.mk:
+ * Android.v8.wtf.mk:
+ * GNUmakefile.am:
+ * JavaScriptCore.exp:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.pro:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * runtime/Completion.cpp:
+ (JSC::checkSyntax):
+ (JSC::evaluate):
+ * runtime/Identifier.cpp:
+ (JSC::Identifier::remove):
+ (JSC::Identifier::checkCurrentIdentifierTable):
+ (JSC::createIdentifierTableSpecificCallback):
+ (JSC::createIdentifierTableSpecific):
+ * runtime/Identifier.h:
+ (JSC::ThreadIdentifierTableData::ThreadIdentifierTableData):
+ (JSC::defaultIdentifierTable):
+ (JSC::setDefaultIdentifierTable):
+ (JSC::currentIdentifierTable):
+ (JSC::setCurrentIdentifierTable):
+ (JSC::resetCurrentIdentifierTable):
+ * runtime/InitializeThreading.cpp:
+ (JSC::initializeThreadingOnce):
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::create):
+ * wtf/WTFThreadData.cpp: Removed.
+ * wtf/WTFThreadData.h: Removed.
+
+2010-04-19 Douglas Gregor <dgregor@apple.com>
+
+ Reviewed and landed by Anders Carlsson.
+
+ * runtime/UStringImpl.h:
+ Fix class/struct declaration mismatches.
+
+2010-04-19 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Beth Dakin.
+
+ Checked in these tests I wrote becuase Balazs Kelemen wanted to use them.
+
+ * tests/perf: Added.
+ * tests/perf/bench-allocate-nonretained.js: Added.
+ * tests/perf/bench-allocate-retained.js: Added.
+
+2010-04-19 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by NOBODY (windows build fix).
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-04-16 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ https://bugs.webkit.org/show_bug.cgi?id=37745
+ Move string uniquing tables to (new) WTFThreadData class.
+
+ Remove AtomicString's dependency on ThreadGlobalData so that we can move
+ WebCore's string classes up to WTF.
+
+ WTFThreadData.cpp/.h are based on ThreadGlobalData from WebCore.
+ Moved JSC & WebCore's string uniquing tables to this class.
+
+ This patch introduces a temporary layering violation in providing forward
+ declarations of classes from JSC and WTF; this will be resolved as we move
+ more string code up to WTF.
+
+ * API/APIShims.h:
+ (JSC::APIEntryShimWithoutLock::APIEntryShimWithoutLock):
+ (JSC::APIEntryShimWithoutLock::~APIEntryShimWithoutLock):
+ (JSC::APICallbackShim::APICallbackShim):
+ (JSC::APICallbackShim::~APICallbackShim):
+ * API/JSContextRef.cpp:
+ * JavaScriptCore.exp:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * runtime/Completion.cpp:
+ (JSC::checkSyntax):
+ (JSC::evaluate):
+ * runtime/Identifier.cpp:
+ (JSC::Identifier::remove):
+ (JSC::Identifier::checkCurrentIdentifierTable):
+ * runtime/Identifier.h:
+ * runtime/InitializeThreading.cpp:
+ (JSC::initializeThreadingOnce):
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::create):
+ * wtf/WTFThreadData.cpp: Copied from WebCore/platform/ThreadGlobalData.cpp.
+ (WTF::WTFThreadData::WTFThreadData):
+ (WTF::WTFThreadData::~WTFThreadData):
+ * wtf/WTFThreadData.h: Copied from WebCore/platform/ThreadGlobalData.h.
+ (WTF::WTFThreadData::atomicStringTable):
+ (WTF::WTFThreadData::initializeIdentifierTable):
+ (WTF::WTFThreadData::currentIdentifierTable):
+ (WTF::WTFThreadData::setCurrentIdentifierTable):
+ (WTF::WTFThreadData::resetCurrentIdentifierTable):
+ (WTF::wtfThreadData):
+
+2010-04-19 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Build fix for WinCE.
+
+ Moved the include of the non-existing errno.h header file inside
+ platform guard macros.
+
+ * jit/ExecutableAllocatorFixedVMPool.cpp:
+
+2010-04-18 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Laszlo Gombos.
+
+ [WINCE] Don't define WTF_CPU_MIDDLE_ENDIAN=1
+ https://bugs.webkit.org/show_bug.cgi?id=37434
+
+ Windows CE supports little-endian format only, so don't define
+ WTF_CPU_MIDDLE_ENDIAN=1.
+
+ * wtf/Platform.h:
+
+2010-04-18 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Reviewed by Laszlo Gombos.
+
+ [Qt] Fix JavaScriptCore's include path for WinCE builds
+
+ https://bugs.webkit.org/show_bug.cgi?id=36751
+
+ * JavaScriptCore.pri:
+
+2010-04-16 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by nobody, build fix.
+
+2010-04-16 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by nobody, build fix.
+
+2010-04-16 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 37730 - Remove JSC::UString dependencies from WebCore::StringImpl
+ (Following on from bug #37675).
+
+ Make the argument ordering for UStringImpl's constructor & create
+ methods match, when passed a shared buffer.
+
+ * JavaScriptCore.exp:
+ * runtime/UStringImpl.cpp:
+ (JSC::UStringImpl::create):
+ * runtime/UStringImpl.h:
+
+2010-04-15 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Fix memory leak in QScriptEngine::evaluate().
+
+ QScriptEnginePrivate::evaluate should release temporary variables.
+
+ [Qt] QScriptEngine::evaluate has memory leak.
+ https://bugs.webkit.org/show_bug.cgi?id=37596
+
+ * qt/api/qscriptengine_p.cpp:
+ (QScriptEnginePrivate::evaluate):
+ * qt/api/qscriptengine_p.h:
+
+2010-04-14 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Fix a memory leak in QScriptValue::inherits.
+
+ [Qt] QScriptValue::inherits has a memory leak.
+ https://bugs.webkit.org/show_bug.cgi?id=37617
+
+ * qt/api/qscriptvalue_p.h:
+ (QScriptValuePrivate::inherits):
+
+2010-04-14 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Fix a few memory leaks in QScriptEngine.
+
+ Syntax checking caused memory leak, not all temporary variables were released.
+
+ [Qt] Syntax checking in the QtScript cause a memory leak.
+ https://bugs.webkit.org/show_bug.cgi?id=37610
+
+ * qt/api/qscriptengine_p.cpp:
+ (QScriptEnginePrivate::checkSyntax):
+ * qt/api/qscriptsyntaxcheckresult.cpp:
+ (QScriptSyntaxCheckResultPrivate::errorMessage):
+ (QScriptSyntaxCheckResultPrivate::errorLineNumber):
+
+2010-04-14 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Fix memory leak inside QScriptEnginePrivate::makeJSValue.
+
+ QScriptEnginePrivate::makeJSValue should release temporary JSStringRef variable.
+
+ [Qt] tst_QScriptValue::toString has a memory leak.
+ https://bugs.webkit.org/show_bug.cgi?id=37598
+
+ * qt/api/qscriptengine_p.h:
+ (QScriptEnginePrivate::makeJSValue):
+
+2010-04-14 Peter Varga <pvarga@inf.u-szeged.hu>
+
+ Reviewed by Geoffrey Garen.
+
+ Move the YARR JIT fallback detection from RegexJIT.cpp to
+ RegexCompiler.cpp.
+
+ https://bugs.webkit.org/show_bug.cgi?id=37571
+
+ * yarr/RegexCompiler.cpp:
+ (JSC::Yarr::RegexPatternConstructor::atomBackReference):
+ (JSC::Yarr::RegexPatternConstructor::quantifyAtom):
+ * yarr/RegexJIT.cpp:
+ (JSC::Yarr::RegexGenerator::generateTerm):
+ (JSC::Yarr::RegexGenerator::RegexGenerator):
+ (JSC::Yarr::jitCompileRegex):
+ * yarr/RegexJIT.h:
+ (JSC::Yarr::RegexCodeBlock::operator!):
+ * yarr/RegexPattern.h:
+ (JSC::Yarr::RegexPattern::RegexPattern):
+ (JSC::Yarr::RegexPattern::reset):
+
+2010-04-14 Kent Hansen <kent.hansen@nokia.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Mac OS X: Use deployment target to determine whether memory tagging should be enabled
+ https://bugs.webkit.org/show_bug.cgi?id=34888
+
+ When building on (Snow) Leopard but targeting Tiger
+ (TARGETING_TIGER defined, BUILDING_ON_TIGER not defined),
+ WebKit would crash on Tiger because the tags passed to mmap
+ caused those function calls to fail.
+
+ Conversely, when building on Tiger but targeting Leopard
+ (BUILDING_ON_TIGER defined, TARGETING_LEOPARD defined), WebKit
+ would crash on Leopard because the tags passed to vm_map and
+ vm_allocate caused those function calls to fail.
+
+ Solution: Use TARGETING_TIGER rather than BUILDING_ON_TIGER to
+ govern the tag definitions. Use the same tags for vm_map and
+ vm_allocate regardless of target, since they work on
+ both. Fall back to the mmap tags that work on Tiger (that is,
+ "no tags") if targeting Tiger, since those tags also work on
+ Leopard.
+
+ * wtf/VMTags.h:
+
+2010-04-12 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
+
+ Reviewed by nobody, build fix.
+
+ [Qt] Build fix for Mac when building with build-webkit --qt
+
+ Specifying no configuration on Mac builds WebCore both in debug
+ and release. JavaScriptCore has to follow this rule as well.
+
+ * JavaScriptCore.pro:
+
+2010-04-11 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ <rdar://problem/7851332> Fix the build.
+
+ * wtf/FastMalloc.cpp:
+ (WTF::TCMallocStats::): Initialize extra members of malloc_introspection_t to zero.
+
+2010-04-09 Mikhail Naganov <mnaganov@chromium.org>
+
+ Reviewed by Pavel Feldman.
+
+ Make CallIdentifier constructor to handle null urls.
+
+ https://bugs.webkit.org/show_bug.cgi?id=37341
+
+ * profiler/CallIdentifier.h:
+ (JSC::CallIdentifier::CallIdentifier):
+
+2010-04-09 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Fix crashes with package builds in release
+
+ Add NDEBUG to the defines for package build in JavaScriptCore.pri,
+ so that it's consistently used for JavaScriptCore, WebCore, jsc and all
+ other tools using wtf, etc. data structures directly. Mixing NDEBUG with
+ non-NDEBUG builds causes crashes due to differences in data structures when
+ assertions/checks are enabled.
+
+ * JavaScriptCore.pri:
+
+2010-04-09 Patrick Gansterer <paroga@paroga.com>
+
+ Reviewed by Darin Adler.
+
+ Implement NO_RETURN for COMPILER(MSVC).
+ https://bugs.webkit.org/show_bug.cgi?id=33056
+
+ Added NO_RETURN_WITH_VALUE for functions with non-void return type.
+
+ * jsc.cpp:
+ * wtf/AlwaysInline.h:
+ * wtf/FastMalloc.cpp:
+
+2010-04-08 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Simon Hausmann.
+
+ [WINCE] Check if ARM or _ARM_ is defined
+ https://bugs.webkit.org/show_bug.cgi?id=37200
+
+ MSVC defines ARM and _ARM_ for Windows CE ARM. Define WTF_CPU_ARM=1
+ when either ARM or _ARM_ is defined.
+
+ * wtf/Platform.h:
+
+2010-04-08 Csaba Osztrogonác <ossy@webkit.org>
+
+ Reviewed Oliver Hunt.
+
+ [Qt]r57240 broke Qt build (might be a gcc bug)
+ https://bugs.webkit.org/show_bug.cgi?id=37253
+
+ Workaround until fix. On PLATFORM(QT) use inline instead of ALWAYS_INLINE.
+
+ * wtf/PassRefPtr.h: Qt guards added.
+
+2010-04-07 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Anders Carlsson.
+
+ Vector<UString> makes many needless calls to UString::UString and UString::~UString
+
+ Add a VectorTrait<UString> specialisation to allow vector to simply memset/memcpy
+ data around. Only difference from the VectorTrait<RefPtr<T> > traits is the inability
+ to use memset to initialize data.
+
+ * runtime/UString.h:
+ (WTF::):
+
+2010-04-07 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Beat gcc with a clue bat -- force inlining of refIfNotNull and derefIfNotNull
+
+ * wtf/PassRefPtr.h:
+
+2010-04-07 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Darin Adler.
+
+ Replace isprint with isASCIIPrintable
+ https://bugs.webkit.org/show_bug.cgi?id=37223
+
+ WebKit does not use functions in <ctype.h> as they are dependent on the current
+ locale. Use the equivalent functions in <wtf/ASCIICType.h>. isASCIIPrintable
+ replaces isprint.
+
+ * pcre/pcre_exec.cpp:
+ (pchars):
+
+2010-04-07 Enrica Casucci <enrica@apple.com>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=37219
+
+ This change disables text caret for the iPhone platflorm.
+
+ * wtf/Platform.h: Disabled text caret for iPhone.
+
+2010-04-06 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ REGRESSION: Worker termination via JS timeout may cause worker tests like fast/workers/worker-terminate.html fail.
+ https://bugs.webkit.org/show_bug.cgi?id=36646
+
+ Add a new exception type for forcibly terminating a JavaScript stack.
+ The new exception functions similarly to the
+ InterruptedExecutionException but is conceptually different because
+ execution is terminated instead of just interrupted.
+
+ * GNUmakefile.am:
+ - Added new Terminator.h file.
+ * JavaScriptCore.gypi:
+ - Added new Terminator.h file.
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ - Added new Terminator.h file.
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ - Added new Terminator.h file.
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::throwException):
+ - Fully unwind the stack for TerminatedExecutionException.
+ (JSC::Interpreter::privateExecute):
+ - Check if we've been terminated at the same time we check if we've
+ timed out.
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+ - Check if we've been terminated at the same time we check if we've
+ timed out.
+ * runtime/Completion.cpp:
+ - Some exceptions define special completion types so that calls can
+ see why we terminated evaluation.
+ (JSC::evaluate):
+ * runtime/Completion.h:
+ - Define a new completion type for termination.
+ (JSC::):
+ * runtime/ExceptionHelpers.cpp:
+ - Define TerminatedExecutionException and refactor pseudo-RTTI
+ virtual function to be more semantic.
+ (JSC::InterruptedExecutionError::exceptionType):
+ (JSC::TerminatedExecutionError::TerminatedExecutionError):
+ (JSC::TerminatedExecutionError::exceptionType):
+ (JSC::TerminatedExecutionError::toString):
+ (JSC::createTerminatedExecutionException):
+ * runtime/ExceptionHelpers.h:
+ - Entry point for generating a TerminatedExecutionException.
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData):
+ - Add a Terminator object that can be used to asynchronously
+ terminate a JavaScript execution stack.
+ * runtime/JSGlobalData.h:
+ * runtime/JSObject.h:
+ (JSC::JSObject::exceptionType):
+ - Define that, by default, thrown objects have a normal exception
+ type.
+ * runtime/Terminator.h: Added.
+ - Added a new controller object that can be used to terminate
+ execution asynchronously. This object is more or less a
+ glorified bool.
+ (JSC::Terminator::Terminator):
+ (JSC::Terminator::termianteSoon):
+ (JSC::Terminator::shouldTerminate):
+
+2010-04-05 Oliver Hunt <oliver@apple.com>
+
+ And another one.
+
+ * JavaScriptCore.vcproj/jsc/jscCommon.vsprops:
+
+2010-04-05 Oliver Hunt <oliver@apple.com>
+
+ And another build fix.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make:
+
+2010-04-05 Oliver Hunt <oliver@apple.com>
+
+ Build fix
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+
+2010-04-05 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Support weak maps in JSC
+ https://bugs.webkit.org/show_bug.cgi?id=37132
+
+ Expose an API to allow creation of a map for storing
+ weak JS references.
+
+ * API/JSWeakObjectMapRefInternal.h: Added.
+ (OpaqueJSWeakObjectMap::create):
+ (OpaqueJSWeakObjectMap::map):
+ (OpaqueJSWeakObjectMap::~OpaqueJSWeakObjectMap):
+ (OpaqueJSWeakObjectMap::OpaqueJSWeakObjectMap):
+ * API/JSWeakObjectMapRefPrivate.cpp: Added.
+ * API/JSWeakObjectMapRefPrivate.h: Added.
+ * JavaScriptCore.exp:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * runtime/JSGlobalObject.h:
+ (JSC::JSGlobalObject::registerWeakMap):
+ (JSC::JSGlobalObject::deregisterWeakMap):
+
+2010-04-05 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Symbian] Consolidate Symbian WINSCW environment configuration
+ https://bugs.webkit.org/show_bug.cgi?id=37100
+
+ Move the "undefinition" of WIN32 and _WIN32 from WebCore/config.h
+ to JavaScriptCore/wtf/Platform.h as it is not specific to WebCore.
+
+ PLATFORM(WIN) and OS(WIN) no longer needs to be undefined as
+ undefining WIN32 takes care of it.
+
+ * wtf/Platform.h:
+
+2010-04-03 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ https://bugs.webkit.org/show_bug.cgi?id=37068
+ Change UString to use a 0 rep for null strings instead of a null object.
+
+ No performance impact.
+
+ * JavaScriptCore.exp:
+ * runtime/InternalFunction.cpp:
+ (JSC::InternalFunction::InternalFunction):
+ * runtime/JSString.h:
+ (JSC::RopeBuilder::JSString):
+ * runtime/UString.cpp:
+ (JSC::initializeUString):
+ * runtime/UString.h:
+ (JSC::UString::UString):
+ (JSC::UString::data):
+ (JSC::UString::size):
+ (JSC::UString::isNull):
+ (JSC::UString::isEmpty):
+ (JSC::UString::cost):
+
+2010-04-03 Balazs Kelemen <kb@inf.u-szeged.hu>
+
+ Reviewed by Oliver Hunt.
+
+ Fix uninitalised members in CallLinkInfo and BytecodeGenerator.
+
+ https://bugs.webkit.org/show_bug.cgi?id=36816
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::CodeBlock):
+ * bytecode/CodeBlock.h:
+ (JSC::CallLinkInfo::CallLinkInfo):
+
+2010-04-03 yael aharon <yael.aharon@nokia.com>
+
+ Reviewed by Darin Adler.
+
+ Enable HTMLProgressElement for Safari on OSX
+ https://bugs.webkit.org/show_bug.cgi?id=36961
+
+ * Configurations/FeatureDefines.xcconfig:
+
+2010-04-02 Ruben Van Boxem <vanboxem.ruben@gmail.com>
+
+ Reviewed by Eric Seidel.
+
+ Mingw-w64 fixes for JavaScriptCore
+ https://bugs.webkit.org/show_bug.cgi?id=35607
+
+ * runtime/Collector.cpp: use the msvc code for mingw-w64 (but not mingw-w32)
+ (JSC::Heap::allocateBlock):
+ (JSC::Heap::freeBlockPtr):
+ (JSC::currentThreadStackBase):
+ (JSC::currentThreadStackBase):
+ * wtf/Platform.h: added COMPILER(MINGW64) check to differentiate between mingw.org and mingw-w64 functions
+
+2010-04-02 Geoffrey Garen <ggaren@apple.com>
+
+ Build fix: updated the .def file.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-04-02 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Inlined toThisString and toThisJSString to avoid virtual function call overhead
+ https://bugs.webkit.org/show_bug.cgi?id=37039
+
+ Maybe a 1% speedup on iBench JS.
+
+ * JavaScriptCore.exp: New exports.
+
+ * runtime/JSCell.cpp:
+ * runtime/JSCell.h:
+ * runtime/JSNumberCell.cpp:
+ * runtime/JSNumberCell.h:
+ * runtime/JSString.cpp:
+ * runtime/JSString.h:
+ * runtime/JSValue.h:
+ * runtime/JSZombie.h:
+ (JSC::JSZombie::toThisObject): Nixed the old virtual-type implementation.
+
+ * runtime/JSObject.h:
+ (JSC::JSValue::toThisString):
+ (JSC::JSValue::toThisJSString): Added the inlined implementation.
+
+2010-04-02 Jeremy Moskovich <jeremy@chromium.org>
+
+ Reviewed by Geoffrey Garen.
+
+ Beef up documentation for ASSERT* and CRASH macros a bit.
+
+ https://bugs.webkit.org/show_bug.cgi?id=36527
+
+ * wtf/Assertions.h:
+
+2010-04-02 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Unreviewed, minor build fix.
+
+ Change the order of the member initialisation list
+ in constructor to match declaration order
+
+ * runtime/Collector.cpp:
+ (JSC::Heap::Heap):
+
+2010-04-01 Kinuko Yasuda <kinuko@chromium.org>
+
+ Reviewed by Dmitry Titov.
+
+ Add FileThread for async file operation support in FileReader and FileWriter
+ https://bugs.webkit.org/show_bug.cgi?id=36896
+
+ Add ENABLE_FILE_READER and ENABLE_FILE_WRITER flags.
+
+ * Configurations/FeatureDefines.xcconfig:
+
+2010-03-31 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by NOBODY (windows build fix pt II).
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-03-31 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by NOBODY (windows build fix).
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-03-31 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Bug 36871 - Remove JSC::CString
+ Use WTF::CString instead (which until recently was WebCore::CString).
+
+ * JavaScriptCore.exp:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * runtime/UString.cpp:
+ * runtime/UString.h:
+
+2010-03-31 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Unreviewed, fix after r56842.
+
+ Add UNUSED_PARAM a to silence warning.
+
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+
+2010-03-31 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Unreviewed, Symbian build fix.
+
+ Refactor JITStubs.cpp so that the list of STUB_FUNCTIONs
+ are not dependent on the JSVALUE32_64 guard.
+
+ * jit/JITStubs.cpp: Place the JSVALUE32_64 guard inside
+ the body of cti_op_eq_strings.
+ * jit/JITStubs.h: Remove JSVALUE32_64 guard from
+ cti_op_eq_strings stub.
+
+2010-03-30 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by NOBODY (windows build fix).
+
+ Fixing b0rked version of JavaScriptCore.vcproj - added lines were truncated.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+
+2010-03-30 Gavin Barraclough <barraclough@apple.com>
+
+ Rubber stamped by Sam Weinig.
+
+ https://bugs.webkit.org/show_bug.cgi?id=36866
+ Move CString to WTF
+
+ * Android.mk:
+ * GNUmakefile.am:
+ * JavaScriptCore.exp:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.pro:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * wtf/text: Added.
+ * wtf/text/CString.cpp: Copied from WebCore/platform/text/CString.cpp.
+ * wtf/text/CString.h: Copied from WebCore/platform/text/CString.h.
+ (WTF::CStringBuffer::data):
+ (WTF::CStringBuffer::length):
+ (WTF::CStringBuffer::create):
+ (WTF::CStringBuffer::CStringBuffer):
+ (WTF::CStringBuffer::mutableData):
+ (WTF::CString::CString):
+ (WTF::CString::isNull):
+ (WTF::CString::buffer):
+ (WTF::operator!=):
+
+2010-03-30 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
+
+ Reviewed by nobody, build break.
+
+ [Qt] Fix build break on Qt Mac.
+
+ DESTDIR path on Mac do not include the configuration path by default
+ like on Windows. Have to force it.
+
+ * JavaScriptCore.pro:
+
+2010-03-29 Alice Liu <alice.liu@apple.com>
+
+ Reviewed by NOBODY (build fix).
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make:
+ add JSObjectRefPrivate.h
+
+2010-03-29 Chao-ying Fu <fu@mips.com>
+
+ Reviewed by Oliver Hunt.
+
+ MIPS JIT Supports
+ https://bugs.webkit.org/show_bug.cgi?id=30144
+
+ The following changes enable MIPS JIT.
+
+ * assembler/MIPSAssembler.h:
+ (JSC::MIPSAssembler::lbu):
+ (JSC::MIPSAssembler::linkWithOffset):
+ * assembler/MacroAssemblerMIPS.h:
+ (JSC::MacroAssemblerMIPS::load8):
+ (JSC::MacroAssemblerMIPS::branch8):
+ (JSC::MacroAssemblerMIPS::branchTest8):
+ (JSC::MacroAssemblerMIPS::setTest8):
+ (JSC::MacroAssemblerMIPS::setTest32):
+ * jit/JIT.h:
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::preserveReturnAddressAfterCall):
+ (JSC::JIT::restoreReturnAddressBeforeReturn):
+ * jit/JITOpcodes.cpp:
+ * jit/JITStubs.cpp:
+ (JSC::JITThunks::JITThunks):
+ * jit/JITStubs.h:
+ (JSC::JITStackFrame::returnAddressSlot):
+ * wtf/Platform.h:
+
+2010-02-26 Kenneth Rohde Christiansen <kenneth@webkit.org>
+
+ Reviewed by Simon Fraser.
+
+ Add support for Widgets 1.0: View Mode Media Feature
+ https://bugs.webkit.org/show_bug.cgi?id=35446
+
+ Add an enable flag for the Widgets (http://www.w3.org/TR/widgets-reqs/)
+ and turn it on for Qt only.
+
+ * wtf/Platform.h:
+
+2010-03-29 Patrick Gansterer <paroga@paroga.com>
+
+ Reviewed by Darin Adler.
+
+ Corrected name of (u)int64_t compile time assert.
+ https://bugs.webkit.org/show_bug.cgi?id=36739
+
+ int64_t_is_four_bytes -> int64_t_is_eight_bytes
+
+ * os-win32/stdint.h:
+
+2010-03-29 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Use the -l syntax for linking against JavaScriptCore on Windows.
+ This allow qmake to extract dependencies correctly when generating VS
+ solutions.
+
+ * JavaScriptCore.pri:
+
+2010-03-29 Thomas Zander <t.zander@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ https://bugs.webkit.org/show_bug.cgi?id=36742
+
+ gcc for Symbian doesn't support gcc extensions like atomicity.h - disable
+
+ * wtf/Threading.h: also detect os symbian
+
+2010-03-28 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Remove the definition of WTF_CHANGES guards from the build system
+ https://bugs.webkit.org/show_bug.cgi?id=31670
+
+ * JavaScriptCore.pro: Remove the definition of WTF_CHANGES
+ as it is already defined in config.h
+
+2010-03-28 Kent Hansen <kent.hansen@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Add API for reporting additional memory cost of JavaScript objects
+ https://bugs.webkit.org/show_bug.cgi?id=36650
+
+ * qt/api/qscriptengine.cpp:
+ (QScriptEngine::reportAdditionalMemoryCost):
+ * qt/api/qscriptengine.h:
+ * qt/api/qscriptengine_p.h:
+ (QScriptEnginePrivate::reportAdditionalMemoryCost):
+ * qt/tests/qscriptengine/tst_qscriptengine.cpp:
+ (tst_QScriptEngine::reportAdditionalMemoryCost):
+
+2010-03-28 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ QScriptEngine API was enriched by globalObject() method
+ which give an access to the global object.
+
+ [Qt] QScriptEngine doesn't give an access to global object
+ https://bugs.webkit.org/show_bug.cgi?id=36603
+
+ * qt/api/qscriptengine.cpp:
+ (QScriptEngine::globalObject):
+ * qt/api/qscriptengine.h:
+ * qt/api/qscriptengine_p.cpp:
+ (QScriptEnginePrivate::globalObject):
+ * qt/api/qscriptengine_p.h:
+ * qt/tests/qscriptengine/tst_qscriptengine.cpp:
+ (tst_QScriptEngine::globalObject):
+
+2010-03-26 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Build JavaScriptCore as a static library.
+ https://bugs.webkit.org/show_bug.cgi?id=36590
+
+ This patch takes what was left of the unused JavaScriptCore.pro
+ and moved the compilation logic from JavaScriptCore.pri to
+ JavaScriptCore.pro.
+
+ * JavaScriptCore.pri:
+ * JavaScriptCore.pro:
+ * jsc.pro:
+ * qt/api/QtScript.pro:
+
+2010-03-25 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by NOBODY (build fix).
+
+ * profiler/ProfileGenerator.cpp:
+ (JSC::ProfileGenerator::willExecute):
+ (JSC::ProfileGenerator::didExecute):
+
+2010-03-25 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Bug 36611 - Cleanup JSC::CString
+ Rename CString::c_str() -> CString::data(), CString::size() -> CString::length(),
+ remove UString::getCString() (all uses are wrong, should use UString::UTF8String()).
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::printUnaryOp):
+ (JSC::CodeBlock::printBinaryOp):
+ (JSC::CodeBlock::printConditionalJump):
+ (JSC::CodeBlock::printGetByIdOp):
+ (JSC::CodeBlock::printPutByIdOp):
+ (JSC::printGlobalResolveInfo):
+ (JSC::printStructureStubInfo):
+ (JSC::CodeBlock::printStructure):
+ (JSC::CodeBlock::printStructures):
+ (JSC::CodeBlock::dump):
+ * jsc.cpp:
+ (functionPrint):
+ (functionDebug):
+ (runInteractive):
+ (fillBufferWithContentsOfFile):
+ * profiler/CallIdentifier.h:
+ (JSC::CallIdentifier::c_str):
+ * profiler/Profile.cpp:
+ (JSC::Profile::debugPrintDataSampleStyle):
+ * profiler/ProfileNode.cpp:
+ (JSC::ProfileNode::debugPrintData):
+ (JSC::ProfileNode::debugPrintDataSampleStyle):
+ * runtime/DateConversion.cpp:
+ (JSC::parseDate):
+ * runtime/JSGlobalObjectFunctions.cpp:
+ (JSC::encode):
+ (JSC::globalFuncJSCPrint):
+ * runtime/UString.cpp:
+ (JSC::operator==):
+ (JSC::UString::toDouble):
+ * runtime/UString.h:
+ (JSC::CString::length):
+ (JSC::CString::data):
+
+2010-03-25 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
+
+ Reviewed by nobody, build fix.
+
+ [Qt] Build fix on MSVC. Reverts r55633 for stdint.h
+
+ This file gets included in generated moc files which don't
+ include the prefix header.
+
+ * os-win32/stdint.h:
+
+2010-03-24 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by NOBODY (windows build fix).
+
+2010-03-24 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Switch String::latin1, String::utf8, String::fromUTF8 to
+ use WTF's Unicode conversion methods rather than TextEncoder.
+ These methods only perform simple conversion, and don't need
+ really require TextEncoder's full capability (to look up arbitrary
+ encodings by name), switching to only be dependent on WTF will
+ make it easier if we chose to move WebCore::String to WTF.
+
+ * JavaScriptCore.exp:
+
+2010-03-24 Alexey Proskuryakov <ap@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ * wtf/FastMalloc.h: Added a using directive for fastMallocSize, like we do for all public
+ WTF symbols. Also sorted the list alphabetically.
+
+2010-03-23 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by NOBODY (speculative windows build fix part II).
+
+2010-03-23 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by NOBODY (speculative windows build fix).
+
+2010-03-23 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 36519 - JSGlobalContextRelease is unnecessarily slow
+
+ Since [ http://trac.webkit.org/changeset/35917 ], calling
+ JSGlobalContextRelease always triggers a GC heap collection
+ (if not a full destroy). As per 35917's changelog "This is
+ only really necessary when the (JSGlobalObject's) last
+ reference is released, but there is no way to determine that,
+ and no harm in collecting slightly more often."
+
+ Well, we now know of cases of API clients who are harmed by
+ the performance penalty of collecting too often, so it's time
+ to add a way to determine whether a call to JSGlobalContextRelease
+ is removing the last protect from it's global object. If further
+ protects are retaining the global object (likely from other
+ JSGlobalContextRefs), then don't trigger a GC collection.
+
+ * API/JSContextRef.cpp:
+ * runtime/Collector.cpp:
+ (JSC::Heap::unprotect): return a boolean indicating that the value is now unprotected.
+ * runtime/Collector.h:
+ * wtf/HashCountedSet.h:
+ (WTF::::remove): return a boolean indicating whether the value was removed from the set.
+
+2010-03-23 Mark Rowe <mrowe@apple.com>
+
+ Build fix.
+
+ * runtime/ArrayPrototype.cpp:
+ (JSC::arrayProtoFuncSplice): Some versions of GCC emit a warning about the implicit 64- to 32-bit truncation
+ that takes place here. An explicit cast is sufficient to silence it.
+
+2010-03-23 Alexey Proskuryakov <ap@apple.com>
+
+ Build fix.
+
+ * runtime/ArrayPrototype.cpp: (JSC::arrayProtoFuncSplice): Fixed a typo - length doesn't
+ need to be converted with toInteger().
+
+2010-03-23 Alexey Proskuryakov <ap@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ https://bugs.webkit.org/show_bug.cgi?id=36511
+ <rdar://problem/7753498> Safari freezes when using SPUTNIK JavaScript conformance check
+
+ Test: fast/js/sputnik-S15.4.4.12_A3_T3.html
+
+ * runtime/ArrayPrototype.cpp: (JSC::arrayProtoFuncSplice): We were incorrectly computing
+ the start offset, and iterated over (almost) all integers. Note that this can be fixed
+ without using doubles, but the code would be much more complicated, and there is no important
+ reason to stick to integers here.
+
+2010-03-23 Kent Hansen <kent.hansen@nokia.com>
+
+ Reviewed by Darin Adler.
+
+ Fix compilation on Itanium in 32-bit mode
+ https://bugs.webkit.org/show_bug.cgi?id=36494
+
+ * wtf/Platform.h: Introduce CPU(IA64_32). Don't define
+ WTF_USE_JSVALUE64 if the CPU is in 32-bit mode.
+
+2010-03-23 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Mark Rowe.
+
+ Interpreter fix for <rdar://problem/7728196> REGRESSION (r46701): -(-2147483648)
+ evaluates to -2147483648 on 32 bit (35842)
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute): Only take the fast negate path if
+ a bit other than bit 31 is set. If none of bits 0-30 are set, then the
+ value we're negating can only be 0 or -2147483648, and neither can be
+ negated in int space.
+
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emit_op_negate):
+ (JSC::JIT::emitSlow_op_negate): Updated the JIT implementation to match
+ the interpreter, since it's slightly simpler.
+
+2010-03-22 Siddharth Mathur <siddharth.mathur@nokia.com>
+
+ Reviewed by Laszlo Gombos.
+
+ [Symbian] More efficient aligned memory allocation for JSC Collector
+ https://bugs.webkit.org/show_bug.cgi?id=34350
+
+ * JavaScriptCore.pri: Added 2 new Symbian source files and HAL linkage
+
+ * runtime/Collector.cpp: Reduced port-specific code and added private data member
+ (JSC::Heap::Heap):
+ (JSC::Heap::~Heap):
+ (JSC::Heap::destroy):
+ (JSC::Heap::allocateBlock):
+ (JSC::Heap::freeBlockPtr):
+
+ * runtime/Collector.h: Added private data member
+
+ * wtf/symbian: Added.
+ * wtf/symbian/BlockAllocatorSymbian.cpp: Added.
+ (WTF::AlignedBlockAllocator::AlignedBlockAllocator): Helper class to allocate
+ aligned blocks more efficiently as required by Collector
+ (WTF::AlignedBlockAllocator::alloc):
+ (WTF::AlignedBlockAllocator::free):
+ (WTF::AlignedBlockAllocator::destroy):
+ (WTF::AlignedBlockAllocator::~AlignedBlockAllocator):
+ * wtf/symbian/BlockAllocatorSymbian.h: Added.
+
+2010-03-22 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Fixed <rdar://problem/7728196> REGRESSION (r46701): -(-2147483648)
+ evaluates to -2147483648 on 32 bit (35842)
+
+ Two ways to fix the same bug:
+
+ 1. Check for overflow when negating, since negating the largest negative
+ int causes overflow.
+
+ 2. Constant-fold even when negating a negative, since, like they say in
+ high school, "math works."
+
+ * assembler/MacroAssemblerARM.h:
+ (JSC::MacroAssemblerARM::branchNeg32):
+ * assembler/MacroAssemblerX86Common.h:
+ (JSC::MacroAssemblerX86Common::branchNeg32): Added a branching version
+ of the negate operator.
+
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emit_op_negate): Use the branching version of the negate
+ operator to check for overflow.
+
+ (JSC::JIT::emitSlow_op_negate): Link the check for overflow to a slow case.
+ (We could emit inline code for this, since we know what the result would
+ be, but that's probably just a waste of generated code.)
+
+ * parser/Grammar.y: Constant fold even when negating a negative.
+
+2010-03-22 David Kilzer <ddkilzer@apple.com>
+
+ <http://webkit.org/b/36431> Clean up 'int' use in UString.cpp after r54789
+
+ Reviewed by Darin Adler.
+
+ * runtime/UString.cpp:
+ (JSC::UString::from): Changed argument type from 'unsigned int'
+ to 'unsigned' to match WebKit coding style.
+ (JSC::UString::find): Changed static_cast<int>() to
+ static_cast<unsigned>() now that this method returns unsigned.
+ (JSC::UString::rfind): Ditto.
+ * runtime/UString.h:
+ (JSC::UString::from): Changed argument type from 'unsigned int'
+ to 'unsigned' to match WebKit coding style.
+
+2010-03-22 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Add support for syntax checking in the QtScript API.
+
+ New class was created; the QScriptSyntaxCheckResult which main
+ responsibility is to provide results of the ECMA Script code
+ syntax check. The class is not fully functional as the JSC C API
+ doesn't expose an error column number, but it is a good start point
+ for a future development.
+
+ [Qt] QtScript functionality should be extended by syntax checking.
+ https://bugs.webkit.org/show_bug.cgi?id=36123
+
+ * qt/api/QtScript.pro:
+ * qt/api/qscriptengine.cpp:
+ (QScriptEngine::checkSyntax):
+ * qt/api/qscriptengine.h:
+ * qt/api/qscriptengine_p.cpp:
+ (QScriptEnginePrivate::checkSyntax):
+ * qt/api/qscriptengine_p.h:
+ * qt/api/qscriptsyntaxcheckresult.cpp: Added.
+ (QScriptSyntaxCheckResult::QScriptSyntaxCheckResult):
+ (QScriptSyntaxCheckResult::~QScriptSyntaxCheckResult):
+ (QScriptSyntaxCheckResult::operator=):
+ (QScriptSyntaxCheckResult::state):
+ (QScriptSyntaxCheckResult::errorLineNumber):
+ (QScriptSyntaxCheckResult::errorColumnNumber):
+ (QScriptSyntaxCheckResult::errorMessage):
+ * qt/api/qscriptsyntaxcheckresult.h: Added.
+ * qt/api/qscriptsyntaxcheckresult_p.cpp: Added.
+ (QScriptSyntaxCheckResultPrivate::~QScriptSyntaxCheckResultPrivate):
+ (QScriptSyntaxCheckResultPrivate::errorMessage):
+ (QScriptSyntaxCheckResultPrivate::errorLineNumber):
+ * qt/api/qscriptsyntaxcheckresult_p.h: Added.
+ (QScriptSyntaxCheckResultPrivate::get):
+ (QScriptSyntaxCheckResultPrivate::QScriptSyntaxCheckResultPrivate):
+ (QScriptSyntaxCheckResultPrivate::state):
+ (QScriptSyntaxCheckResultPrivate::errorColumnNumber):
+ * qt/tests/qscriptengine/tst_qscriptengine.cpp:
+ (tst_QScriptEngine::checkSyntax_data):
+ (tst_QScriptEngine::checkSyntax):
+
+2010-03-21 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ New class; QScriptProgram.
+
+ The class should be used to evaluate the same script multiple times
+ more efficiently.
+
+ [Qt] QtScript should have QScriptProgram class
+ https://bugs.webkit.org/show_bug.cgi?id=36008
+
+ * qt/api/QtScript.pro:
+ * qt/api/qscriptengine.cpp:
+ (QScriptEngine::evaluate):
+ * qt/api/qscriptengine.h:
+ * qt/api/qscriptengine_p.cpp:
+ (QScriptEnginePrivate::evaluate):
+ * qt/api/qscriptengine_p.h:
+ (QScriptEnginePrivate::evaluate):
+ * qt/api/qscriptprogram.cpp: Added.
+ (QScriptProgram::QScriptProgram):
+ (QScriptProgram::~QScriptProgram):
+ (QScriptProgram::operator=):
+ (QScriptProgram::isNull):
+ (QScriptProgram::sourceCode):
+ (QScriptProgram::fileName):
+ (QScriptProgram::firstLineNumber):
+ (QScriptProgram::operator==):
+ (QScriptProgram::operator!=):
+ * qt/api/qscriptprogram.h: Added.
+ * qt/api/qscriptprogram_p.h: Added.
+ (QScriptProgramPrivate::get):
+ (QScriptProgramPrivate::QScriptProgramPrivate):
+ (QScriptProgramPrivate::~QScriptProgramPrivate):
+ (QScriptProgramPrivate::isNull):
+ (QScriptProgramPrivate::sourceCode):
+ (QScriptProgramPrivate::fileName):
+ (QScriptProgramPrivate::firstLineNumber):
+ (QScriptProgramPrivate::operator==):
+ (QScriptProgramPrivate::operator!=):
+ (QScriptProgramPrivate::program):
+ (QScriptProgramPrivate::file):
+ (QScriptProgramPrivate::line):
+ * qt/tests/qscriptengine/tst_qscriptengine.cpp:
+ (tst_QScriptEngine::evaluateProgram):
+
+2010-03-21 David Kilzer <ddkilzer@apple.com>
+
+ Blind attempt #2 to fix the Windows build after r56314
+
+ * API/tests/testapi.c: Include JSObjectRefPrivate.h for the new
+ methods instead of declaring them locally (and non-extern).
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ Backed out previous change.
+
+2010-03-21 David Kilzer <ddkilzer@apple.com>
+
+ Blind attempt to fix the Windows build after r56314
+
+ Try to fix the following errors on the Windows buildbot:
+
+ Linking...
+ testapi.obj : error LNK2001: unresolved external symbol "bool __cdecl JSObjectSetPrivateProperty(struct OpaqueJSContext const *,struct OpaqueJSValue *,struct OpaqueJSString *,struct OpaqueJSValue const *)" (?JSObjectSetPrivateProperty@@YA_NPBUOpaqueJSContext@@PAUOpaqueJSValue@@PAUOpaqueJSString@@PBU2@@Z)
+ testapi.obj : error LNK2001: unresolved external symbol "struct OpaqueJSValue const * __cdecl JSObjectGetPrivateProperty(struct OpaqueJSContext const *,struct OpaqueJSValue *,struct OpaqueJSString *)" (?JSObjectGetPrivateProperty@@YAPBUOpaqueJSValue@@PBUOpaqueJSContext@@PAU1@PAUOpaqueJSString@@@Z)
+ C:\cygwin\home\buildbot\slave\win-release\build\WebKitBuild\bin\testapi.exe : fatal error LNK1120: 2 unresolved externals
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: Added
+ missing symbols to be exported.
+
+2010-03-21 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Documentation fix for previous patch.
+
+ * API/JSObjectRefPrivate.h:
+
+2010-03-20 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ JSC needs an API to allow custom objects to have aprivate GC-accessible properties
+ https://bugs.webkit.org/show_bug.cgi?id=36420
+
+ Add new API methods to support "private" properties on custom
+ objects.
+
+ * API/JSCallbackObject.h:
+ (JSC::JSCallbackObjectData::JSCallbackObjectData):
+ (JSC::JSCallbackObjectData::~JSCallbackObjectData):
+ (JSC::JSCallbackObjectData::getPrivateProperty):
+ (JSC::JSCallbackObjectData::setPrivateProperty):
+ (JSC::JSCallbackObjectData::deletePrivateProperty):
+ (JSC::JSCallbackObjectData::markChildren):
+ (JSC::JSCallbackObjectData::JSPrivatePropertyMap::getPrivateProperty):
+ (JSC::JSCallbackObjectData::JSPrivatePropertyMap::setPrivateProperty):
+ (JSC::JSCallbackObjectData::JSPrivatePropertyMap::deletePrivateProperty):
+ (JSC::JSCallbackObjectData::JSPrivatePropertyMap::markChildren):
+ (JSC::JSCallbackObject::getPrivateProperty):
+ (JSC::JSCallbackObject::setPrivateProperty):
+ (JSC::JSCallbackObject::deletePrivateProperty):
+ (JSC::JSCallbackObject::markChildren):
+ * API/JSObjectRef.cpp:
+ (JSObjectGetPrivateProperty):
+ (JSObjectSetPrivateProperty):
+ (JSObjectDeletePrivateProperty):
+ * API/JSObjectRefPrivate.h: Added.
+ * API/tests/testapi.c:
+ (main):
+ * JavaScriptCore.exp:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2010-03-20 Kevin Ollivier <kevino@theolliviers.com>
+
+ [wx] Build fixes after introduction of Brew files.
+
+ * wscript:
+
+2010-03-18 Tom Callaway <tcallawa@redhat.com>
+
+ Reviewed by Darin Adler.
+
+ Bug 35429: Fix compile on SPARC64
+ https://bugs.webkit.org/show_bug.cgi?id=35429
+
+ * wtf/Platform.h: Set WTF_USE_JSVALUE64 for SPARC64
+
+2010-03-18 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Add API to directly expose JSON parsing
+ https://bugs.webkit.org/show_bug.cgi?id=34887
+
+ Add API to expose JSON parsing directly, and add tests to testapi
+
+ * API/JSValueRef.cpp:
+ (JSValueMakeFromJSONString):
+ (JSValueCreateJSONString):
+ * API/tests/testapi.c:
+ (main):
+ * JavaScriptCore.exp:
+ * runtime/JSONObject.cpp:
+ (JSC::JSONStringify):
+ * runtime/JSONObject.h:
+
+2010-03-16 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Darin Adler and Mark Rowe.
+
+ Update WebKit availability macros for release after 4.0.
+
+ * API/WebKitAvailability.h:
+
+2010-03-17 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ undefined, NaN, and Infinity should be ReadOnly
+ https://bugs.webkit.org/show_bug.cgi?id=36263
+
+ Simply add the ReadOnly flag to these properties.
+
+ * runtime/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::reset):
+
+2010-03-17 Darin Adler <darin@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Speed up Math.round a little by removing unneeded special case
+ https://bugs.webkit.org/show_bug.cgi?id=36107
+
+ Test: fast/js/math.html
+
+ * runtime/MathObject.cpp:
+ (JSC::mathProtoFuncRound): This function had a special case for numbers
+ between -0.5 and -0.0 to return -0.0. But the algorithm in the function
+ already yields -0.0 for those cases, so the extra checking and branching
+ is unneeded.
+
+2010-03-17 Mike Homey <glandium@debian.org>
+
+ Reviewed by Gustavo Noronha.
+
+ Build fix for SPARC. Fix missing macro value.
+
+ * wtf/Platform.h:
+
+2010-03-16 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt, Darin Adler.
+
+ Bug 36083 - REGRESSION (r55772-r55834): Crash in JavaScriptCore RegExp code on PowerPC
+
+ The problem is a bug in our port of PCRE - that a read may take place from the first character in an
+ empty string. For the time being, revert to using a valid pointer in the data segment rather than
+ an invalid non-null pointer into the zero-page for the empty string's data pointer. A better fix for
+ this will be to remove PCRE.
+
+ * runtime/UStringImpl.cpp:
+ (JSC::UStringImpl::empty):
+
+2010-03-16 Darin Adler <darin@apple.com>
+
+ Rolled out r56081 since it broke the Windows build.
+
+2010-03-16 Zoltan Horvath <zoltan@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ Remove extra <new> include and add guards to operator new/delete definitions
+ https://bugs.webkit.org/show_bug.cgi?id=35967
+
+ Remove extra <new> header include from FastAlloc.cpp since it is included in
+ FastAlloc.h. Add ENABLE(GLOBAL_FASTMALLOC_NEW) macro guard to operator
+ new/delete/new []/delete [] definitions.
+
+ * wtf/FastMalloc.cpp:
+
+2010-03-15 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Eric Seidel.
+
+ [BREWMP] Add a function to create a BREW instance without local variable declarations.
+ https://bugs.webkit.org/show_bug.cgi?id=34705
+
+ Add a template function to create a BREW instance in one line.
+
+ * wtf/brew/ShellBrew.h: Added.
+ (WTF::createInstance):
+
+2010-03-15 Geoffrey Garen <ggaren@apple.com>
+
+ Not reviewed.
+
+ Removed a now-incorrect comment I forgot to remove in my last check-in.
+
+ * wtf/FastMalloc.cpp:
+ (WTF::TCMalloc_PageHeap::scavenge):
+
+2010-03-15 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Fixed a portion of:
+ <rdar://problem/7165917> | https://bugs.webkit.org/show_bug.cgi?id=28676
+ Safari 4 does not release memory back to the operating system fast enough (28676)
+
+ Every few seconds, release a percentage of the minimum unused page count
+ during that time period.
+
+ SunSpider reports no change, command-line or in-browser, Mac or Windows.
+
+ * wtf/FastMalloc.cpp:
+ (WTF::TCMalloc_PageHeap::init):
+ (WTF::TCMalloc_PageHeap::signalScavenger):
+ (WTF::TCMalloc_PageHeap::initializeScavenger): Renamed shouldContinueScavenging
+ to shouldScavenge, since scavenging is no longer something that we interrupt.
+
+ (WTF::TCMalloc_PageHeap::scavenge): The new scavenging algorithm. Fixes
+ a bug where the old code would release only one item from each size class
+ per scavenge, potentially leaving large numbers of large-sized objects
+ unreleased for a long time.
+
+ (WTF::TCMalloc_PageHeap::shouldScavenge):
+ (WTF::TCMalloc_PageHeap::New):
+ (WTF::TCMalloc_PageHeap::AllocLarge):
+ (WTF::TCMalloc_PageHeap::Delete):
+ (WTF::TCMalloc_PageHeap::GrowHeap):
+ (WTF::TCMalloc_PageHeap::scavengerThread):
+ (WTF::TCMalloc_PageHeap::periodicScavenge): Updated to track the minimum
+ value of free_committed_pages_ during a given scavenge period.
+
+2010-03-15 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ https://bugs.webkit.org/show_bug.cgi?id=35843
+ Re-land reverted fix to JSString::getIndex()
+
+ Calling getIndex() on a JSString in rope form may result in a JSException being thrown
+ if there is insuficient memory so value(exec) returns UString() with length zero,
+ which will be passed to jsSingleCharacterSubstring.
+ Add a slow case function to trap the error & return a safe null value, until the
+ exception is handled.
+
+ * runtime/JSString.cpp:
+ (JSC::JSString::getIndexSlowCase):
+ (JSC::JSString::getStringPropertyDescriptor):
+ * runtime/JSString.h:
+ (JSC::jsSingleCharacterSubstring):
+ (JSC::JSString::getIndex):
+ (JSC::jsSingleCharacterString):
+ (JSC::JSString::getStringPropertySlot):
+
+2010-03-04 Kenneth Rohde Christiansen <kenneth@webkit.org>
+
+ Reviewed by Adam Roben.
+
+ Add a long long version of abs() for MSVC.
+
+ * wtf/MathExtras.h:
+ (abs):
+
+2010-03-15 Gabor Loki <loki@webkit.org>
+
+ Reviewed by Gavin Barraclough.
+
+ Combine ctiTrampolines on ARM and Thumb-2
+ https://bugs.webkit.org/show_bug.cgi?id=36014
+
+ * jit/JITStubs.cpp:
+ (JSC::JITThunks::JITThunks):
+
+2010-03-12 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by NOBODY (build fix).
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-03-12 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by NOBODY (build fix).
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-03-11 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 36075 - Clean up screwyness re static string impls & Identifiers.
+
+ * API/JSClassRef.cpp:
+ (OpaqueJSClass::~OpaqueJSClass): Classname may be null/empty, and these are an identifer. This is okay, since the null/empty strings are shared across all threads.
+ * JavaScriptCore.exp:
+ * runtime/Identifier.cpp:
+ (JSC::Identifier::add): No need to explicitly hash null reps, this is done in the ststic UStringImpl constructor.
+ (JSC::Identifier::addSlowCase): UStringImpl::empty() handled & checkCurrentIdentifierTable now called in the header.
+ (JSC::Identifier::checkCurrentIdentifierTable): Replaces checkSameIdentifierTable (this no longer checked the rep since the identifierTable pointer was removed from UString::Rep long ago).
+ * runtime/Identifier.h:
+ (JSC::Identifier::add): Replace call to checkSameIdentifierTable with call to checkCurrentIdentifierTable at head of function.
+ * runtime/UStringImpl.cpp:
+ (JSC::UStringImpl::~UStringImpl): Remove call to checkConsistency - this function no longer checks anything interesting.
+ * runtime/UStringImpl.h:
+ (JSC::UStringOrRopeImpl::UStringOrRopeImpl): Set s_refCountFlagIsIdentifier in static constructor.
+ (JSC::UStringImpl::UStringImpl): remove calls to checkConsistency (see above), add new ASSERT to substring constructor.
+ (JSC::UStringImpl::setHash): ASSERT not static (static strings set the hash in their constructor, should not reach this code path).
+ (JSC::UStringImpl::create): Add missing ASSERT.
+ (JSC::UStringImpl::setIsIdentifier): ASSERT !isStatic() (static strings hash set in constructor).
+
+2010-03-12 Peter Varga <pvarga@inf.u-szeged.hu>
+
+ Reviewed by David Levin.
+
+ Two functions tryConsumeCharacter() and tryConsumeCharacterClass() are
+ removed from yarr/RegexInterpreter.cpp because they are never called.
+
+ * yarr/RegexInterpreter.cpp:
+
+2010-03-11 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ The JSNative state was renamed to JSPrimitive. The new name better
+ coresponds to the ECMAScript standard.
+
+ Enum QScriptValuePrivate::States was renamed to State to obey Qt
+ coding style rules ("States" name suggests that a state could
+ mixed together with an other state using bitwise logic operators.
+
+ [Qt] QScriptValuePrivate::States has naming issues
+ https://bugs.webkit.org/show_bug.cgi?id=35968
+
+ * qt/api/qscriptvalue_p.h:
+ (QScriptValuePrivate::):
+ (QScriptValuePrivate::QScriptValuePrivate):
+ (QScriptValuePrivate::isBool):
+ (QScriptValuePrivate::isNumber):
+ (QScriptValuePrivate::isNull):
+ (QScriptValuePrivate::isString):
+ (QScriptValuePrivate::isUndefined):
+ (QScriptValuePrivate::toString):
+ (QScriptValuePrivate::toNumber):
+ (QScriptValuePrivate::toBool):
+ (QScriptValuePrivate::assignEngine):
+ (QScriptValuePrivate::refinedJSValue):
+
+2010-03-11 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by NOBODY (Windows build fix).
+
+ Add export.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-03-11 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by NOBODY (Windows build fix).
+
+ Add export.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-03-11 Gavin Barraclough <barraclough@apple.com>
+
+ Rubber stamped by Oliver Hunt.
+
+ Remove nonsense comments used in development & commited in error.
+
+ * runtime/UStringImpl.h:
+
+2010-03-11 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by NOBODY (Windows build fix).
+
+ Remove export.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-03-11 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ https://bugs.webkit.org/show_bug.cgi?id=36041
+ Remove unnecessary differences in common code between WebCore::StringImpl & JSC::UStringImpl
+
+ Much of the code in WebCore::StringImpl and JSC::UStringImpl is now very similar,
+ but has trivial and unnecessary formatting differences, such as the exact wording
+ of comments, missing ASSERTs, functions implemented in the .h vs .cpp etc.
+
+ * runtime/Identifier.cpp:
+ (JSC::Identifier::add): UStringImpl::empty() now automatically hashes, uas per WebCore strings.
+ (JSC::Identifier::addSlowCase): UStringImpl::empty() now automatically hashes, uas per WebCore strings.
+ * runtime/UStringImpl.cpp:
+ (JSC::UStringImpl::~UStringImpl): Only call bufferOwnership() once, add missing ASSERTs.
+ (JSC::UStringImpl::createUninitialized): Move from .h, not commonly called, no need to inline.
+ (JSC::UStringImpl::create): Move from .h, not commonly called, no need to inline.
+ (JSC::UStringImpl::sharedBuffer): Rewritten to more closely match WebCore implementation, remove need for separate baseSharedBuffer() method.
+ * runtime/UStringImpl.h:
+ (JSC::UStringImpl::UStringImpl): Automatically hash static strings, ASSERT m_data & m_length are non-null/non-zero in non-static strings.
+ (JSC::UStringImpl::setHash): Add missing ASSERT.
+ (JSC::UStringImpl::create): Moved to .cpp / added missing check for empty string creation.
+ (JSC::UStringImpl::adopt): Vector.size() returns size_t, not unsigned.
+ (JSC::UStringImpl::cost): Renamed m_bufferSubstring -> m_substringBuffer
+ (JSC::UStringImpl::hash): Reordered in file.
+ (JSC::UStringImpl::existingHash): Reordered in file.
+ (JSC::UStringImpl::computeHash): Reordered in file, renamed parameter.
+ (JSC::UStringImpl::checkConsistency): rewrote ASSERT.
+ (JSC::UStringImpl::bufferOwnership): Return type should be BufferOwnership.
+ (JSC::UStringImpl::): Moved friends to head of class.
+
+2010-03-11 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by David Kilzer.
+
+ <rdar://problem/7745082> Make it possible to build WebKit for older Mac OS X versions from the current Mac OS X version
+
+ Default to using the appropriate SDK if the target Mac OS X version is not the current Mac OS X version.
+
+ * Configurations/Base.xcconfig:
+
+2010-03-11 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Tim Hatcher.
+
+ <rdar://problem/7745082> Make it possible to build WebKit for older Mac OS X versions from the current Mac OS X version
+
+ Introduce TARGET_MAC_OS_X_VERSION_MAJOR to represent the Mac OS X version that is being targeted. It defaults to the
+ current Mac OS X version unless otherwise specified.
+
+ Key off TARGET_MAC_OS_X_VERSION_MAJOR where we'd previously been keying off MAC_OS_X_VERSION_MAJOR.
+
+ Explicitly map from the target Mac OS X version to the preferred compiler since Xcode's default compiler choice
+ may not be usable when targetting a different Mac OS X version.
+
+ Key off TARGET_GCC_VERSION rather than MAC_OS_X_VERSION_MAJOR in locations where we'd previously been keying off
+ MAC_OS_X_VERSION_MAJOR but the decision is really related to the compiler version being used.
+
+ * Configurations/Base.xcconfig:
+ * Configurations/DebugRelease.xcconfig:
+ * Configurations/FeatureDefines.xcconfig:
+ * Configurations/JavaScriptCore.xcconfig:
+ * Configurations/Version.xcconfig:
+
+2010-03-11 Simon Fraser <simon.fraser@apple.com>
+
+ Reviewed by Mark Rowe.
+
+ Sort the project file.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2010-03-11 Simon Fraser <simon.fraser@apple.com>
+
+ Reviewed by Mark Rowe.
+
+ Sort the project file .
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2010-03-11 Gabor Loki <loki@webkit.org>
+
+ Reviewed by Gavin Barraclough.
+
+ Buildfix for Thumb-2 after r55684. Add branch8 and branchTest8 functions.
+ https://bugs.webkit.org/show_bug.cgi?id=35892
+
+ * assembler/ARMv7Assembler.h:
+ (JSC::ARMv7Assembler::):
+ (JSC::ARMv7Assembler::ldrb):
+ * assembler/MacroAssemblerARMv7.h:
+ (JSC::MacroAssemblerARMv7::load8):
+ (JSC::MacroAssemblerARMv7::branch8):
+ (JSC::MacroAssemblerARMv7::branchTest8):
+ (JSC::MacroAssemblerARMv7::setTest8):
+
+2010-03-10 Gavin Barraclough <barraclough@apple.com>
+
+ Rubber stamped by Oliver Hunt.
+
+ Rename JSC::UStringImpl::data() to characters(), to match WebCore::StringImpl.
+
+ * API/JSClassRef.cpp:
+ (OpaqueJSClassContextData::OpaqueJSClassContextData):
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::keyForCharacterSwitch):
+ * bytecompiler/NodesCodegen.cpp:
+ (JSC::processClauseList):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+ * runtime/ArrayPrototype.cpp:
+ (JSC::arrayProtoFuncToString):
+ * runtime/Identifier.cpp:
+ (JSC::Identifier::equal):
+ (JSC::Identifier::addSlowCase):
+ * runtime/JSString.cpp:
+ (JSC::JSString::resolveRope):
+ * runtime/UString.cpp:
+ (JSC::UString::toStrictUInt32):
+ (JSC::equal):
+ * runtime/UString.h:
+ (JSC::UString::data):
+ * runtime/UStringImpl.h:
+ (JSC::UStringImpl::characters):
+ (JSC::UStringImpl::hash):
+ (JSC::UStringImpl::setHash):
+
+2010-03-10 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Darin Adler, Geoffrey Garen, Maciej Stachowiak.
+
+ https://bugs.webkit.org/show_bug.cgi?id=35991
+ Would be faster to not use a thread specific to implement StringImpl::empty()
+
+ Change JSC::UStringImpl's implementation of empty() match to match StringImpl's new implementation
+ (use a static defined within the empty() method), and change the interface to match too (return
+ a pointer not a reference).
+
+ ~0% performance impact (possible minor progression from moving empty() from .h to .cpp).
+
+ * JavaScriptCore.exp:
+ * runtime/Identifier.cpp:
+ (JSC::Identifier::add):
+ (JSC::Identifier::addSlowCase):
+ * runtime/PropertyNameArray.cpp:
+ (JSC::PropertyNameArray::add):
+ * runtime/UString.cpp:
+ (JSC::initializeUString):
+ (JSC::UString::UString):
+ * runtime/UStringImpl.cpp:
+ (JSC::UStringImpl::empty):
+ (JSC::UStringImpl::create):
+ * runtime/UStringImpl.h:
+ (JSC::UStringImpl::adopt):
+ (JSC::UStringImpl::createUninitialized):
+ (JSC::UStringImpl::tryCreateUninitialized):
+
+2010-03-10 Dmitry Titov <dimich@chromium.org>
+
+ Not reviewed, fixing Snow Leopard build.
+
+ * wtf/mac/MainThreadMac.mm: Forgot 'static' for a new local function.
+ (WTF::postTimer):
+
+2010-03-10 Dmitry Titov <dimich@chromium.org>
+
+ Reviewed by Darin Adler.
+
+ Make Document::postTask to use a single queue of tasks, to fire them in order
+ https://bugs.webkit.org/show_bug.cgi?id=35943
+
+ The patch uses CFRunLoopTimer to schedule execution of tasks instead of performSelectorOnMainThread which apparently can starve other event sources.
+ The timer is used when the schedule request is coming on the main thread itself. This happens when the task is posted on the main thread or
+ when too many tasks are posted and the queue does 'stop and re-schedule' to make sure run loop has a chance to execute other events.
+
+ * wtf/mac/MainThreadMac.mm:
+ (WTF::timerFired):
+ (WTF::postTimer):
+ (WTF::scheduleDispatchFunctionsOnMainThread): Use timer posted to the current RunLoop if scheduling the task execution while on the main thread.
+
+2010-03-10 Geoffrey Garen <ggaren@apple.com>
+
+ Windows build fix: added new symbol.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-03-10 Geoffrey Garen <ggaren@apple.com>
+
+ Windows build fix: removed old symbol.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-03-09 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Alexey Proskuryakov, Darin Adler, and Sam Weinig.
+
+ Refactored fastCheckConsistency to match some review comments:
+ - renamed fastCheckConsistency to fastMallocSize, and changed ValueCheck
+ to ASSERT that a pointer's fastMallocSize is not 0.
+ - implemented a version of fastMallocSize for tcmalloc.
+
+ Also moved some pre-existing code around to avoid a problem related to
+ mismatched #define/#undef of malloc/free in this source file.
+
+ * JavaScriptCore.exp:
+ * wtf/FastMalloc.cpp:
+ (WTF::fastMallocSize): Renamed. Fixed indentation.
+
+ (WTF::TCMalloc_PageHeap::scavenge): Removed an incorrect ASSERT that
+ got in the way of testing the tcmalloc implementation. (More information
+ on why this ASSERT is incorrect is in <rdar://problem/7165917>.)
+
+ (WTF::TCMallocStats::fastMallocSize): Implemented for tcmalloc.
+
+ * wtf/FastMalloc.h: Updated for rename.
+
+ * wtf/ValueCheck.h:
+ (WTF::): Moved the ASSERT that used to be in fastCheckConsistency here.
+
+2010-03-10 Kevin Ollivier <kevino@theolliviers.com>
+
+ Reviewed by Eric Seidel.
+
+ Make global new/delete operators configurable for all ports and disable it
+ for the wx port for now.
+
+ * wtf/FastMalloc.h:
+ * wtf/Platform.h:
+
+2010-03-09 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by NOBODY (reverting r54510).
+
+ This caused a performance regression, by breaking the code
+ generator's logic to calculate the skip level for resolving
+ variables (traced by rdar:7683350) Reverting for now.
+
+ * parser/Grammar.y:
+ * parser/NodeConstructors.h:
+ (JSC::ContinueNode::ContinueNode):
+ (JSC::BreakNode::BreakNode):
+ (JSC::ForInNode::ForInNode):
+ * runtime/CommonIdentifiers.cpp:
+ (JSC::CommonIdentifiers::CommonIdentifiers):
+ * runtime/CommonIdentifiers.h:
+ * runtime/FunctionPrototype.cpp:
+ (JSC::FunctionPrototype::FunctionPrototype):
+ * runtime/Identifier.cpp:
+ (JSC::Identifier::add):
+ * runtime/PropertyNameArray.cpp:
+ (JSC::PropertyNameArray::add):
+
+2010-03-09 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Changed FastMalloc statistics reporting to be a bit clearer. We now
+ report:
+ - Reserved VM Bytes: the VM that has been mapped into the process.
+ - Committed VM Bytes: the subset of Reserved VM Bytes actually in use.
+ - Free List Bytes: the subset of Committed VM Bytes in a free list.
+
+ * wtf/FastMalloc.cpp:
+ (WTF::fastMallocStatistics):
+ (WTF::TCMallocStats::fastMallocStatistics): Updated to report the statistics
+ above. Standardized use of "ifdef WTF_CHANGES". Added a SpinLockHolder
+ around all statistics gathering, since it reads from the page heap.
+
+ * wtf/FastMalloc.h: Updated to report the statistics above.
+
+2010-03-09 Gabor Loki <loki@webkit.org>
+
+ Rubber-stamped by Maciej Stachowiak.
+
+ Buildfix for ARM after r55684. Add branch8 and branchTest8 functions.
+ https://bugs.webkit.org/show_bug.cgi?id=35892
+
+ * assembler/ARMAssembler.cpp:
+ (JSC::ARMAssembler::dataTransfer32):
+ * assembler/ARMAssembler.h:
+ (JSC::ARMAssembler::):
+ * assembler/MacroAssemblerARM.h:
+ (JSC::MacroAssemblerARM::load8):
+ (JSC::MacroAssemblerARM::branch8):
+ (JSC::MacroAssemblerARM::branchTest8):
+
+2010-03-08 Geoffrey Garen <ggaren@apple.com>
+
+ Windows build fix: 'P' is not a type. Luckily, 'void' is.
+
+ * wtf/FastMalloc.cpp:
+ (WTF::fastCheckConsistency):
+
+2010-03-08 Geoffrey Garen <ggaren@apple.com>
+
+ Windows build fix: export a new symbol.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-03-08 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Switching malloc implementations requires a world rebuild
+ https://bugs.webkit.org/show_bug.cgi?id=35899
+
+ * wtf/FastMalloc.cpp:
+ (WTF::fastCheckConsistency):
+ (WTF::TCMallocStats::fastCheckConsistency):
+ * wtf/FastMalloc.h:
+ * wtf/ValueCheck.h:
+ (WTF::): Moved pointer checking into a helper function in FastMalloc.cpp,
+ so you can switch malloc implementations without rebuilding the world.
+
+2010-03-07 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Darin Adler.
+
+ TypeInfo is unnecessarily large
+ https://bugs.webkit.org/show_bug.cgi?id=35850
+
+ Reduce the size of the type and flags members to a single
+ byte each, reducing the size of Structure by 8 bytes.
+
+ * assembler/MacroAssemblerX86Common.h:
+ (JSC::MacroAssemblerX86Common::branch8):
+ (JSC::MacroAssemblerX86Common::branchTest8):
+ (JSC::MacroAssemblerX86Common::setTest8):
+ Add single byte branches, and correct setTest8 to do a
+ single byte read from memory, and actually store the result
+ * assembler/X86Assembler.h:
+ (JSC::X86Assembler::):
+ (JSC::X86Assembler::cmpb_im):
+ (JSC::X86Assembler::testb_im):
+ * jit/JITCall.cpp:
+ (JSC::JIT::emit_op_construct_verify):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_instanceof):
+ (JSC::JIT::emit_op_jeq_null):
+ (JSC::JIT::emit_op_jneq_null):
+ (JSC::JIT::emit_op_get_pnames):
+ (JSC::JIT::emit_op_convert_this):
+ (JSC::JIT::emit_op_construct_verify):
+ (JSC::JIT::emit_op_to_jsnumber):
+ (JSC::JIT::emit_op_eq_null):
+ (JSC::JIT::emit_op_neq_null):
+ * runtime/JSTypeInfo.h:
+ (JSC::TypeInfo::TypeInfo):
+ (JSC::TypeInfo::type):
+
+2010-03-08 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by NOBODY (reverting regression).
+
+ Reverting 55035, this caused a regression.
+ (https://bugs.webkit.org/show_bug.cgi?id=35843)
+
+ * runtime/JSString.cpp:
+ (JSC::JSString::resolveRope):
+ (JSC::JSString::getStringPropertyDescriptor):
+ * runtime/JSString.h:
+ (JSC::jsSingleCharacterSubstring):
+ (JSC::JSString::getIndex):
+ (JSC::JSString::getStringPropertySlot):
+ * runtime/UStringImpl.cpp:
+ * runtime/UStringImpl.h:
+
+2010-03-08 Stuart Morgan <stuartmorgan@chromium.org>
+
+ Reviewed by Darin Adler.
+
+ Added a new USE definition for secure text mode on the Mac.
+ https://bugs.webkit.org/show_bug.cgi?id=31265
+
+ * wtf/Platform.h:
+
+2010-03-08 Jian Li <jianli@chromium.org>
+
+ Reviewed by Dmitry Titov.
+
+ Blob.slice support.
+ https://bugs.webkit.org/show_bug.cgi?id=32993
+
+ Add ENABLE_BLOB_SLICE feature define.
+ Also fix a problem that JSValue.toInteger is not exposed on Windows.
+
+ * Configurations/FeatureDefines.xcconfig:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-03-07 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Small performance fix in the QScriptConverter::toString().
+
+ The QByteArray was replaced by the QVarLengthArray which doesn't
+ have to allocate any memory on heap.
+
+ [Qt] QScriptConverter::toString() should use QVarLengthArray instead of QByteArray
+ https://bugs.webkit.org/show_bug.cgi?id=35577
+
+ * qt/api/qscriptconverter_p.h:
+ (QScriptConverter::toString):
+
+2010-03-06 Mark Rowe <mrowe@apple.com>
+
+ Rubber-stamped by Sam Weinig.
+
+ Remove unnecessary includes of wtf/Platform.h. This is already pulled in by config.h.
+
+ * API/APICast.h:
+ * API/JSCallbackFunction.cpp:
+ * API/JSContextRef.cpp:
+ * API/JSObjectRef.cpp:
+ * API/JSValueRef.cpp:
+ * assembler/ARMAssembler.h:
+ * assembler/ARMv7Assembler.h:
+ * assembler/AbstractMacroAssembler.h:
+ * assembler/AssemblerBuffer.h:
+ * assembler/AssemblerBufferWithConstantPool.h:
+ * assembler/CodeLocation.h:
+ * assembler/LinkBuffer.h:
+ * assembler/MIPSAssembler.h:
+ * assembler/MacroAssembler.h:
+ * assembler/MacroAssemblerARM.h:
+ * assembler/MacroAssemblerARMv7.h:
+ * assembler/MacroAssemblerCodeRef.h:
+ * assembler/MacroAssemblerMIPS.h:
+ * assembler/MacroAssemblerX86.h:
+ * assembler/MacroAssemblerX86Common.h:
+ * assembler/MacroAssemblerX86_64.h:
+ * assembler/RepatchBuffer.h:
+ * assembler/X86Assembler.h:
+ * jit/JIT.h:
+ * jit/JITCode.h:
+ * jit/JITInlineMethods.h:
+ * jit/JITStubs.h:
+ * os-win32/stdint.h:
+ * runtime/JSAPIValueWrapper.h:
+ * runtime/JSImmediate.h:
+ * wtf/ASCIICType.h:
+ * wtf/StdLibExtras.h:
+ * wtf/VMTags.h:
+ * yarr/RegexCompiler.h:
+ * yarr/RegexInterpreter.h:
+ * yarr/RegexJIT.h:
+ * yarr/RegexParser.h:
+ * yarr/RegexPattern.h:
+
+2010-03-06 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Eric Seidel.
+
+ [BREWMP] Share OwnPtr.
+ https://bugs.webkit.org/show_bug.cgi?id=35776
+
+ Share OwnPtr implementation with BREW MP and remove OwnPtrBrew.
+
+ * wtf/OwnPtrBrew.cpp: Added.
+ (WTF::deleteOwnedPtr):
+ * wtf/OwnPtrCommon.h:
+ * wtf/brew/OwnPtrBrew.cpp: Removed.
+ * wtf/brew/OwnPtrBrew.h: Removed.
+
+2010-03-06 Patrick Gansterer <paroga@paroga.com>
+
+ Reviewed by Eric Seidel.
+
+ Implemented JIT_OPTIMIZE_NATIVE_CALL for WinCE
+ https://bugs.webkit.org/show_bug.cgi?id=33426
+
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+
+2010-03-05 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by NOBODY (build fix).
+
+ Add enw exports to windows
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-03-05 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ JSC should cache int to Identifier conversion as it does for ordinary strings
+ https://bugs.webkit.org/show_bug.cgi?id=35814
+
+ Make the NumericStrings cache cache unsigned ints in addition to signed.
+ We keep them separate from the int cache as it both simplifies code, and
+ also because the unsigned path is exclusive to property access and therefore
+ seems to have different usage patterns.
+
+ The primary trigger for the unsigned to Identifier propertyName conversion
+ is the construction of array-like objects out of normal objects. Given these
+ tend to be relative small numbers, and the array-like behaviour lends itself
+ to sequential values this patch also adds a non-colliding cache for all small
+ numbers.
+
+ * JavaScriptCore.exp:
+ * runtime/Identifier.cpp:
+ (JSC::Identifier::from):
+ * runtime/Identifier.h:
+ * runtime/NumericStrings.h:
+ (JSC::NumericStrings::add):
+ (JSC::NumericStrings::lookup):
+ (JSC::NumericStrings::lookupSmallString):
+
+2010-03-03 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Allow static property getters to interact with JSCs caching
+ https://bugs.webkit.org/show_bug.cgi?id=35716
+
+ Add new opcodes for handling cached lookup of static value getters.
+ More or less the same as with JS getters, all that changes is that
+ instead of calling through a JSFunction we always know that we have
+ a C function to call.
+
+ For the patching routines in the JIT we now need to pass a few
+ new parameters to allow us to pass enough information to the stub
+ function to allow us to call the C function correctly. Logically
+ this shouldn't actually be necessary as all of these functions ignore
+ the identifier, but removing the ident parameter would require
+ somewhat involved changes to the way we implement getOwnPropertySlot,
+ etc.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::dump):
+ (JSC::CodeBlock::derefStructures):
+ (JSC::CodeBlock::refStructures):
+ * bytecode/Instruction.h:
+ (JSC::Instruction::Instruction):
+ (JSC::Instruction::):
+ * bytecode/Opcode.h:
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::tryCacheGetByID):
+ (JSC::Interpreter::privateExecute):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ * jit/JIT.h:
+ (JSC::JIT::compileGetByIdProto):
+ (JSC::JIT::compileGetByIdSelfList):
+ (JSC::JIT::compileGetByIdProtoList):
+ (JSC::JIT::compileGetByIdChainList):
+ (JSC::JIT::compileGetByIdChain):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::privateCompileGetByIdProto):
+ (JSC::JIT::privateCompileGetByIdSelfList):
+ (JSC::JIT::privateCompileGetByIdProtoList):
+ (JSC::JIT::privateCompileGetByIdChainList):
+ (JSC::JIT::privateCompileGetByIdChain):
+ * jit/JITPropertyAccess32_64.cpp:
+ (JSC::JIT::privateCompileGetByIdProto):
+ (JSC::JIT::privateCompileGetByIdSelfList):
+ (JSC::JIT::privateCompileGetByIdProtoList):
+ (JSC::JIT::privateCompileGetByIdChainList):
+ (JSC::JIT::privateCompileGetByIdChain):
+ * jit/JITStubs.cpp:
+ (JSC::JITThunks::tryCacheGetByID):
+ (JSC::DEFINE_STUB_FUNCTION):
+ * jit/JITStubs.h:
+ (JSC::):
+ * runtime/JSFunction.cpp:
+ (JSC::JSFunction::getOwnPropertySlot):
+ * runtime/Lookup.h:
+ (JSC::getStaticPropertySlot):
+ (JSC::getStaticValueSlot):
+ * runtime/PropertySlot.h:
+ (JSC::PropertySlot::):
+ (JSC::PropertySlot::PropertySlot):
+ (JSC::PropertySlot::cachedPropertyType):
+ (JSC::PropertySlot::isCacheable):
+ (JSC::PropertySlot::isCacheableValue):
+ (JSC::PropertySlot::setValueSlot):
+ (JSC::PropertySlot::setCacheableCustom):
+ (JSC::PropertySlot::setGetterSlot):
+ (JSC::PropertySlot::setCacheableGetterSlot):
+ (JSC::PropertySlot::clearOffset):
+ (JSC::PropertySlot::customGetter):
+
+2010-03-04 Shinichiro Hamaji <hamaji@chromium.org>
+
+ Unreviewed. Remove a non-ASCII character introduced in the following bug.
+
+ put_by_id does will incorrectly cache writes where a specific value exists, where at the point of caching the same value is being written.
+ https://bugs.webkit.org/show_bug.cgi?id=35537
+
+ * runtime/JSObject.h:
+ (JSC::JSObject::putDirectInternal):
+
+2010-03-04 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
+
+ Reviewed by Tor Arne Vestbø.
+
+ [Qt] Make the OUTPUT_DIR variable in qmake projects independent of build-webkit's logic.
+
+ This also allows shadow builds relying only on qmake to work properly.
+ * jsc.pro:
+ * qt/api/QtScript.pro:
+ * qt/tests/qscriptengine/qscriptengine.pro:
+ * qt/tests/qscriptvalue/qscriptvalue.pro:
+ * qt/tests/tests.pri:
+
+2010-03-03 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ QScriptValue::isObject fix.
+
+ Fix broken internal state evaluation from JSValue to JSNative / JSObject.
+ New function was introduced which should take care about promoting
+ JSValue state inside QScriptValuePrivate. It should be used instead of a
+ direct JSC C API call.
+
+ The bug exposed a weakness in autotest suite, as the QScriptValuePrivate
+ is based on state machine with lazy state evaluation, there is a possibility
+ that serial sequencial calls to the same public const function could return
+ different results. The patch fix the issue.
+
+ [Qt] Sometimes QScriptValue::isObject returns an incorrect value
+ https://bugs.webkit.org/show_bug.cgi?id=35387
+
+ * qt/api/qscriptvalue_p.h:
+ (QScriptValuePrivate::isBool):
+ (QScriptValuePrivate::isNumber):
+ (QScriptValuePrivate::isNull):
+ (QScriptValuePrivate::isString):
+ (QScriptValuePrivate::isUndefined):
+ (QScriptValuePrivate::isError):
+ (QScriptValuePrivate::isObject):
+ (QScriptValuePrivate::isFunction):
+ (QScriptValuePrivate::call):
+ (QScriptValuePrivate::refineJSValue):
+ * qt/tests/qscriptvalue/tst_qscriptvalue_generated.cpp:
+ (tst_QScriptValue::initScriptValues):
+ (tst_QScriptValue::isValid_makeData):
+ (tst_QScriptValue::isValid_test):
+ (tst_QScriptValue::isBool_makeData):
+ (tst_QScriptValue::isBool_test):
+ (tst_QScriptValue::isBoolean_makeData):
+ (tst_QScriptValue::isBoolean_test):
+ (tst_QScriptValue::isNumber_makeData):
+ (tst_QScriptValue::isNumber_test):
+ (tst_QScriptValue::isFunction_test):
+ (tst_QScriptValue::isNull_makeData):
+ (tst_QScriptValue::isNull_test):
+ (tst_QScriptValue::isString_makeData):
+ (tst_QScriptValue::isString_test):
+ (tst_QScriptValue::isUndefined_makeData):
+ (tst_QScriptValue::isUndefined_test):
+ (tst_QScriptValue::isObject_makeData):
+ (tst_QScriptValue::isObject_test):
+ (tst_QScriptValue::toString_makeData):
+ (tst_QScriptValue::toString_test):
+ (tst_QScriptValue::toNumber_makeData):
+ (tst_QScriptValue::toNumber_test):
+ (tst_QScriptValue::toBool_makeData):
+ (tst_QScriptValue::toBool_test):
+ (tst_QScriptValue::toBoolean_makeData):
+ (tst_QScriptValue::toBoolean_test):
+ (tst_QScriptValue::toInteger_makeData):
+ (tst_QScriptValue::toInteger_test):
+ (tst_QScriptValue::toInt32_makeData):
+ (tst_QScriptValue::toInt32_test):
+ (tst_QScriptValue::toUInt32_makeData):
+ (tst_QScriptValue::toUInt32_test):
+ (tst_QScriptValue::toUInt16_makeData):
+ (tst_QScriptValue::toUInt16_test):
+
+2010-03-03 Chao-ying Fu <fu@mips.com>
+
+ Reviewed by Gavin Barraclough.
+
+ MIPS JIT Supports
+ https://bugs.webkit.org/show_bug.cgi?id=30144
+
+ The following changes enable MIPS YARR and YARR_JIT.
+
+ * assembler/AbstractMacroAssembler.h:
+ (JSC::AbstractMacroAssembler::Imm32::Imm32):
+ * assembler/MIPSAssembler.h: Added.
+ (JSC::MIPSRegisters::):
+ (JSC::MIPSAssembler::MIPSAssembler):
+ (JSC::MIPSAssembler::):
+ (JSC::MIPSAssembler::JmpSrc::JmpSrc):
+ (JSC::MIPSAssembler::JmpDst::JmpDst):
+ (JSC::MIPSAssembler::JmpDst::isUsed):
+ (JSC::MIPSAssembler::JmpDst::used):
+ (JSC::MIPSAssembler::emitInst):
+ (JSC::MIPSAssembler::nop):
+ (JSC::MIPSAssembler::loadDelayNop):
+ (JSC::MIPSAssembler::copDelayNop):
+ (JSC::MIPSAssembler::move):
+ (JSC::MIPSAssembler::li):
+ (JSC::MIPSAssembler::lui):
+ (JSC::MIPSAssembler::addiu):
+ (JSC::MIPSAssembler::addu):
+ (JSC::MIPSAssembler::subu):
+ (JSC::MIPSAssembler::mult):
+ (JSC::MIPSAssembler::mfhi):
+ (JSC::MIPSAssembler::mflo):
+ (JSC::MIPSAssembler::mul):
+ (JSC::MIPSAssembler::andInsn):
+ (JSC::MIPSAssembler::andi):
+ (JSC::MIPSAssembler::nor):
+ (JSC::MIPSAssembler::orInsn):
+ (JSC::MIPSAssembler::ori):
+ (JSC::MIPSAssembler::xorInsn):
+ (JSC::MIPSAssembler::xori):
+ (JSC::MIPSAssembler::slt):
+ (JSC::MIPSAssembler::sltu):
+ (JSC::MIPSAssembler::sltiu):
+ (JSC::MIPSAssembler::sll):
+ (JSC::MIPSAssembler::sllv):
+ (JSC::MIPSAssembler::sra):
+ (JSC::MIPSAssembler::srav):
+ (JSC::MIPSAssembler::lw):
+ (JSC::MIPSAssembler::lwl):
+ (JSC::MIPSAssembler::lwr):
+ (JSC::MIPSAssembler::lhu):
+ (JSC::MIPSAssembler::sw):
+ (JSC::MIPSAssembler::jr):
+ (JSC::MIPSAssembler::jalr):
+ (JSC::MIPSAssembler::jal):
+ (JSC::MIPSAssembler::bkpt):
+ (JSC::MIPSAssembler::bgez):
+ (JSC::MIPSAssembler::bltz):
+ (JSC::MIPSAssembler::beq):
+ (JSC::MIPSAssembler::bne):
+ (JSC::MIPSAssembler::bc1t):
+ (JSC::MIPSAssembler::bc1f):
+ (JSC::MIPSAssembler::newJmpSrc):
+ (JSC::MIPSAssembler::appendJump):
+ (JSC::MIPSAssembler::addd):
+ (JSC::MIPSAssembler::subd):
+ (JSC::MIPSAssembler::muld):
+ (JSC::MIPSAssembler::lwc1):
+ (JSC::MIPSAssembler::ldc1):
+ (JSC::MIPSAssembler::swc1):
+ (JSC::MIPSAssembler::sdc1):
+ (JSC::MIPSAssembler::mtc1):
+ (JSC::MIPSAssembler::mfc1):
+ (JSC::MIPSAssembler::truncwd):
+ (JSC::MIPSAssembler::cvtdw):
+ (JSC::MIPSAssembler::ceqd):
+ (JSC::MIPSAssembler::cngtd):
+ (JSC::MIPSAssembler::cnged):
+ (JSC::MIPSAssembler::cltd):
+ (JSC::MIPSAssembler::cled):
+ (JSC::MIPSAssembler::cueqd):
+ (JSC::MIPSAssembler::coled):
+ (JSC::MIPSAssembler::coltd):
+ (JSC::MIPSAssembler::culed):
+ (JSC::MIPSAssembler::cultd):
+ (JSC::MIPSAssembler::label):
+ (JSC::MIPSAssembler::align):
+ (JSC::MIPSAssembler::getRelocatedAddress):
+ (JSC::MIPSAssembler::getDifferenceBetweenLabels):
+ (JSC::MIPSAssembler::size):
+ (JSC::MIPSAssembler::executableCopy):
+ (JSC::MIPSAssembler::getCallReturnOffset):
+ (JSC::MIPSAssembler::linkJump):
+ (JSC::MIPSAssembler::linkCall):
+ (JSC::MIPSAssembler::linkPointer):
+ (JSC::MIPSAssembler::relinkJump):
+ (JSC::MIPSAssembler::relinkCall):
+ (JSC::MIPSAssembler::repatchInt32):
+ (JSC::MIPSAssembler::repatchPointer):
+ (JSC::MIPSAssembler::repatchLoadPtrToLEA):
+ (JSC::MIPSAssembler::relocateJumps):
+ (JSC::MIPSAssembler::linkWithOffset):
+ (JSC::MIPSAssembler::linkCallInternal):
+ * assembler/MacroAssembler.h:
+ * assembler/MacroAssemblerMIPS.h: Added.
+ (JSC::MacroAssemblerMIPS::MacroAssemblerMIPS):
+ (JSC::MacroAssemblerMIPS::):
+ (JSC::MacroAssemblerMIPS::add32):
+ (JSC::MacroAssemblerMIPS::and32):
+ (JSC::MacroAssemblerMIPS::lshift32):
+ (JSC::MacroAssemblerMIPS::mul32):
+ (JSC::MacroAssemblerMIPS::not32):
+ (JSC::MacroAssemblerMIPS::or32):
+ (JSC::MacroAssemblerMIPS::rshift32):
+ (JSC::MacroAssemblerMIPS::sub32):
+ (JSC::MacroAssemblerMIPS::xor32):
+ (JSC::MacroAssemblerMIPS::load32):
+ (JSC::MacroAssemblerMIPS::load32WithUnalignedHalfWords):
+ (JSC::MacroAssemblerMIPS::load32WithAddressOffsetPatch):
+ (JSC::MacroAssemblerMIPS::loadPtrWithPatchToLEA):
+ (JSC::MacroAssemblerMIPS::loadPtrWithAddressOffsetPatch):
+ (JSC::MacroAssemblerMIPS::load16):
+ (JSC::MacroAssemblerMIPS::store32WithAddressOffsetPatch):
+ (JSC::MacroAssemblerMIPS::store32):
+ (JSC::MacroAssemblerMIPS::supportsFloatingPoint):
+ (JSC::MacroAssemblerMIPS::supportsFloatingPointTruncate):
+ (JSC::MacroAssemblerMIPS::pop):
+ (JSC::MacroAssemblerMIPS::push):
+ (JSC::MacroAssemblerMIPS::move):
+ (JSC::MacroAssemblerMIPS::swap):
+ (JSC::MacroAssemblerMIPS::signExtend32ToPtr):
+ (JSC::MacroAssemblerMIPS::zeroExtend32ToPtr):
+ (JSC::MacroAssemblerMIPS::branch32):
+ (JSC::MacroAssemblerMIPS::branch32WithUnalignedHalfWords):
+ (JSC::MacroAssemblerMIPS::branch16):
+ (JSC::MacroAssemblerMIPS::branchTest32):
+ (JSC::MacroAssemblerMIPS::jump):
+ (JSC::MacroAssemblerMIPS::branchAdd32):
+ (JSC::MacroAssemblerMIPS::branchMul32):
+ (JSC::MacroAssemblerMIPS::branchSub32):
+ (JSC::MacroAssemblerMIPS::breakpoint):
+ (JSC::MacroAssemblerMIPS::nearCall):
+ (JSC::MacroAssemblerMIPS::call):
+ (JSC::MacroAssemblerMIPS::ret):
+ (JSC::MacroAssemblerMIPS::set32):
+ (JSC::MacroAssemblerMIPS::setTest32):
+ (JSC::MacroAssemblerMIPS::moveWithPatch):
+ (JSC::MacroAssemblerMIPS::branchPtrWithPatch):
+ (JSC::MacroAssemblerMIPS::storePtrWithPatch):
+ (JSC::MacroAssemblerMIPS::tailRecursiveCall):
+ (JSC::MacroAssemblerMIPS::makeTailRecursiveCall):
+ (JSC::MacroAssemblerMIPS::loadDouble):
+ (JSC::MacroAssemblerMIPS::storeDouble):
+ (JSC::MacroAssemblerMIPS::addDouble):
+ (JSC::MacroAssemblerMIPS::subDouble):
+ (JSC::MacroAssemblerMIPS::mulDouble):
+ (JSC::MacroAssemblerMIPS::convertInt32ToDouble):
+ (JSC::MacroAssemblerMIPS::insertRelaxationWords):
+ (JSC::MacroAssemblerMIPS::branchTrue):
+ (JSC::MacroAssemblerMIPS::branchFalse):
+ (JSC::MacroAssemblerMIPS::branchEqual):
+ (JSC::MacroAssemblerMIPS::branchNotEqual):
+ (JSC::MacroAssemblerMIPS::branchDouble):
+ (JSC::MacroAssemblerMIPS::branchTruncateDoubleToInt32):
+ (JSC::MacroAssemblerMIPS::linkCall):
+ (JSC::MacroAssemblerMIPS::repatchCall):
+ * jit/ExecutableAllocator.h:
+ (JSC::ExecutableAllocator::cacheFlush):
+ * wtf/Platform.h:
+ * yarr/RegexJIT.cpp:
+ (JSC::Yarr::RegexGenerator::generateEnter):
+ (JSC::Yarr::RegexGenerator::generateReturn):
+
+2010-03-03 Steve Falkenburg <sfalken@apple.com>
+
+ Windows build fix.
+
+ * JavaScriptCore.vcproj/jsc/jsc.vcproj:
+ * JavaScriptCore.vcproj/jsc/jscCommon.vsprops:
+
+2010-03-03 Steve Falkenburg <sfalken@apple.com>
+
+ Windows build fix.
+
+ * JavaScriptCore.vcproj/jsc/jsc.vcproj:
+
+2010-03-03 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Add virtual memory tags for TCMalloc and WebCore's purgeable buffers.
+
+ * wtf/TCSystemAlloc.cpp:
+ (TryMmap): Use the VM tag.
+ * wtf/VMTags.h: Make use of VM_MEMORY_TCMALLOC and VM_MEMORY_WEBCORE_PURGEABLE_BUFFERS.
+
+2010-03-03 Steve Falkenburg <sfalken@apple.com>
+
+ Rubber stamped by Adam Roben.
+
+ Fix bogus xcopy that was polluting source tree at build time.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops:
+
+2010-03-02 Fridrich Strba <fridrich.strba@bluewin.ch>
+
+ Reviewed by Oliver Hunt.
+
+ Allow building smoothly on win32 and win64 using GCC
+ https://bugs.webkit.org/show_bug.cgi?id=35607
+
+ * jit/JITStubs.h:
+ * runtime/Collector.cpp:
+ (JSC::Heap::allocateBlock):
+ (JSC::Heap::freeBlockPtr):
+ (JSC::currentThreadStackBase):
+
+2010-03-02 Jeremy Orlow <jorlow@chromium.org>
+
+ Reviewed by David Levin.
+
+ Revert database thread changes that are no longer required
+ https://bugs.webkit.org/show_bug.cgi?id=35519
+
+ Jochen Eisinger created 55214 and 55247 to track which database
+ owns which thread. Dmitry suggested that this could also
+ be done via TLS, though. After exploring the options, Jochen
+ chose to go the TLS route, so these patches are no longer needed.
+
+ * wtf/Threading.h:
+ * wtf/ThreadingNone.cpp:
+ (WTF::isMainThread):
+ * wtf/ThreadingPthreads.cpp:
+ (WTF::identifierByPthreadHandle):
+ (WTF::establishIdentifierForPthreadHandle):
+ (WTF::pthreadHandleForIdentifier):
+ (WTF::createThreadInternal):
+ (WTF::currentThread):
+ * wtf/ThreadingWin.cpp:
+ (WTF::threadMap):
+ (WTF::storeThreadHandleByIdentifier):
+ (WTF::threadHandleForIdentifier):
+ (WTF::createThreadInternal):
+
+2010-03-02 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Fix QScriptValue::toString().
+
+ More ECMA Script compliance, especially for values as NaN, Inifinite
+ and really big/small numbers.
+
+ [Qt] QScriptValue::toString() returns incorrect values
+ https://bugs.webkit.org/show_bug.cgi?id=34850
+
+ * qt/api/qscriptconverter_p.h:
+ (QScriptConverter::toString):
+ * qt/api/qscriptvalue_p.h:
+ (QScriptValuePrivate::toString):
+ * qt/tests/qscriptvalue/tst_qscriptvalue.cpp:
+ * qt/tests/qscriptvalue/tst_qscriptvalue.h:
+ * qt/tests/qscriptvalue/tst_qscriptvalue_generated.cpp:
+ (tst_QScriptValue::toString_initData):
+ (tst_QScriptValue::toString_makeData):
+ (tst_QScriptValue::toString_test):
+
+2010-03-02 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Introduce a new class; QScriptString.
+
+ The QScriptString class should act as a handle to "interned"
+ strings in a QScriptEngine.
+
+ [Qt] QtScript should provide QScriptString
+ https://bugs.webkit.org/show_bug.cgi?id=34843
+
+ * qt/api/QtScript.pro:
+ * qt/api/qscriptengine.cpp:
+ (QScriptEngine::toStringHandle):
+ * qt/api/qscriptengine.h:
+ * qt/api/qscriptengine_p.h:
+ (QScriptEnginePrivate::toStringHandle):
+ * qt/api/qscriptstring.cpp: Added.
+ (QScriptString::QScriptString):
+ (QScriptString::~QScriptString):
+ (QScriptString::operator=):
+ (QScriptString::isValid):
+ (QScriptString::operator==):
+ (QScriptString::operator!=):
+ (QScriptString::toArrayIndex):
+ (QScriptString::toString):
+ (QScriptString::operator QString):
+ (qHash):
+ * qt/api/qscriptstring.h: Added.
+ * qt/api/qscriptstring_p.h: Added.
+ (QScriptStringPrivate::QScriptStringPrivate):
+ (QScriptStringPrivate::~QScriptStringPrivate):
+ (QScriptStringPrivate::get):
+ (QScriptStringPrivate::isValid):
+ (QScriptStringPrivate::operator==):
+ (QScriptStringPrivate::operator!=):
+ (QScriptStringPrivate::toArrayIndex):
+ (QScriptStringPrivate::toString):
+ (QScriptStringPrivate::id):
+ * qt/tests/qscriptstring/qscriptstring.pro: Added.
+ * qt/tests/qscriptstring/tst_qscriptstring.cpp: Added.
+ (tst_QScriptString::tst_QScriptString):
+ (tst_QScriptString::~tst_QScriptString):
+ (tst_QScriptString::test):
+ (tst_QScriptString::hash):
+ (tst_QScriptString::toArrayIndex_data):
+ (tst_QScriptString::toArrayIndex):
+ * qt/tests/tests.pro:
+
+2010-03-02 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by NOBODY (Build fix).
+
+ Export function on windows.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-03-01 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Refactor named getter function signature to be in line with indexing getter signature
+ https://bugs.webkit.org/show_bug.cgi?id=35563
+
+ This removes the PropertySlot argument from getter functions, and makes them directly
+ pass the slot base. This makes the semantics for the functions match that of the
+ indexing getters.
+
+ On the down side, this means that we can no longer simply use a proxy function for
+ JS getters, so we now add another marker value to indicate that a getter is present
+ and branch accordingly.
+
+ Against all rationality sunspider reports this as a perf win, but i suspect it's just noise.
+
+ * API/JSCallbackObject.h:
+ * API/JSCallbackObjectFunctions.h:
+ (JSC::::staticValueGetter):
+ (JSC::::staticFunctionGetter):
+ (JSC::::callbackGetter):
+ * JavaScriptCore.exp:
+ * runtime/JSActivation.cpp:
+ (JSC::JSActivation::argumentsGetter):
+ * runtime/JSActivation.h:
+ * runtime/JSFunction.cpp:
+ (JSC::JSFunction::argumentsGetter):
+ (JSC::JSFunction::callerGetter):
+ (JSC::JSFunction::lengthGetter):
+ * runtime/JSFunction.h:
+ * runtime/NumberConstructor.cpp:
+ (JSC::numberConstructorNaNValue):
+ (JSC::numberConstructorNegInfinity):
+ (JSC::numberConstructorPosInfinity):
+ (JSC::numberConstructorMaxValue):
+ (JSC::numberConstructorMinValue):
+ * runtime/PropertySlot.cpp:
+ (JSC::PropertySlot::functionGetter):
+ * runtime/PropertySlot.h:
+ (JSC::PropertySlot::getValue):
+ (JSC::PropertySlot::setGetterSlot):
+ (JSC::PropertySlot::setCacheableGetterSlot):
+ * runtime/RegExpConstructor.cpp:
+ (JSC::regExpConstructorDollar1):
+ (JSC::regExpConstructorDollar2):
+ (JSC::regExpConstructorDollar3):
+ (JSC::regExpConstructorDollar4):
+ (JSC::regExpConstructorDollar5):
+ (JSC::regExpConstructorDollar6):
+ (JSC::regExpConstructorDollar7):
+ (JSC::regExpConstructorDollar8):
+ (JSC::regExpConstructorDollar9):
+ (JSC::regExpConstructorInput):
+ (JSC::regExpConstructorMultiline):
+ (JSC::regExpConstructorLastMatch):
+ (JSC::regExpConstructorLastParen):
+ (JSC::regExpConstructorLeftContext):
+ (JSC::regExpConstructorRightContext):
+ * runtime/RegExpObject.cpp:
+ (JSC::regExpObjectGlobal):
+ (JSC::regExpObjectIgnoreCase):
+ (JSC::regExpObjectMultiline):
+ (JSC::regExpObjectSource):
+ (JSC::regExpObjectLastIndex):
+
+2010-03-01 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ PropertySlot::getValue(ExecState, unsigned) unnecessarily converts index to an Identifier
+ https://bugs.webkit.org/show_bug.cgi?id=35561
+
+ Fix this by defining a separate property getter function for index getters. This allows
+ us to pass an unsigned number without the conversion to an Identifier. We then update
+ setCustomIndex to take this new getter type.
+
+ * runtime/PropertySlot.h:
+ (JSC::PropertySlot::getValue):
+ (JSC::PropertySlot::setCustom):
+ (JSC::PropertySlot::setCustomIndex):
+
+2010-03-01 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 35537 - put_by_id does will incorrectly cache writes where a specific value exists,
+ where at the point of caching the same value is being written.
+
+ When performing a put_by_id that is replacing a property already present on the object,
+ there are three interesting cases regarding the state of the specific value:
+
+ (1) No specific value set - nothing to do, leave the structure in it's current state,
+ can cache.
+ (2) A specific value was set, the new put is not of a specified value (i.e. function),
+ or is of a different specific value - in these cases we need to perform a despecifying
+ transition to clear the specific value in the structure, but having done so this is a
+ normal property so as such we can again cache normally.
+ (3) A specific value was set, and we are overwriting with the same value - in these cases
+ leave the structure unchanged, but since a specific value is set we cannot cache this
+ put (we would need the JIT to dynamically check the value being written matched).
+
+ Unfortunately, the current behaviour does not match this. the checks for a specific value
+ being present & the value matching are combined in such a way that in case (2), above we
+ will unnecessarily prevent the transition being cached, but in case (3) we will incorrectly
+ fail to prevent caching.
+
+ The bug exposes itself if multiple puts of the same specific value are performed to a
+ property, and erroneously the put is allowed to be cached by the JIT. Method checks may be
+ generated caching calls of this structure. Subsequent puts performed from JIT code may
+ write different values without triggering a despecify transition, and as such cached method
+ checks will continue to pass, despite the value having changed.
+
+ * runtime/JSObject.h:
+ (JSC::JSObject::putDirectInternal):
+
+2010-03-01 Tor Arne Vestbø <tor.arne.vestbo@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Fix the Qt build on Mac OS X/Cocoa 64-bit
+
+ * JavaScriptCore.pri: Add missing implementation file to resolve JSC symbols
+
+2010-02-26 Gavin Barraclough <barraclough@apple.com>
+
+ Rubber Stamped by Geoff Garen.
+
+ Remove wrec. All builds should have switched to yarr by now.
+
+ * Android.mk:
+ * GNUmakefile.am:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.pri:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops:
+ * JavaScriptCore.vcproj/jsc/jscCommon.vsprops:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * runtime/RegExp.cpp:
+ (JSC::RegExp::match):
+ * runtime/RegExp.h:
+ * wrec: Removed.
+ * wrec/CharacterClass.cpp: Removed.
+ * wrec/CharacterClass.h: Removed.
+ * wrec/CharacterClassConstructor.cpp: Removed.
+ * wrec/CharacterClassConstructor.h: Removed.
+ * wrec/Escapes.h: Removed.
+ * wrec/Quantifier.h: Removed.
+ * wrec/WREC.cpp: Removed.
+ * wrec/WREC.h: Removed.
+ * wrec/WRECFunctors.cpp: Removed.
+ * wrec/WRECFunctors.h: Removed.
+ * wrec/WRECGenerator.cpp: Removed.
+ * wrec/WRECGenerator.h: Removed.
+ * wrec/WRECParser.cpp: Removed.
+ * wrec/WRECParser.h: Removed.
+ * wscript:
+
+2010-02-26 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Make the lookup table generator include an explicit cast to expected
+ type of the function. We do this because otherwise the blind intptr_t
+ cast that is subsequently applied allows incorrectly typed functions
+ to be inserted into the table, where they will only fail at runtime.
+ This change makes such errors produce a compile time failure.
+
+ * create_hash_table:
+
+2010-02-26 Janne Koskinen <janne.p.koskinen@digia.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Symbian specific getCPUTime implemetation
+ https://bugs.webkit.org/show_bug.cgi?id=34742
+
+ Default implementation doesn't work on Symbian devices.
+ This change adds a proper implementation by
+ asking thread execution time from the current thread.
+
+ * runtime/TimeoutChecker.cpp:
+ (JSC::getCPUTime):
+
+2010-02-25 Alexey Proskuryakov <ap@apple.com>
+
+ Reviewed by Anders Carlsson.
+
+ https://bugs.webkit.org/show_bug.cgi?id=35406
+ <rdar://problem/6945502> Make generic array methods work with JavaArray
+
+ Renamed lazyCreationData to subclassData. This is extra data that can be used by JSArray
+ subclasses (you can't add new data members, because it wouldn't fit in JSCell otherwise).
+
+ * JavaScriptCore.exp:
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::JSArray):
+ (JSC::JSArray::subclassData):
+ (JSC::JSArray::setSubclassData):
+ * runtime/JSArray.h:
+ * runtime/RegExpConstructor.cpp:
+ (JSC::RegExpMatchesArray::RegExpMatchesArray):
+ (JSC::RegExpMatchesArray::~RegExpMatchesArray):
+ (JSC::RegExpMatchesArray::fillArrayInstance):
+ * runtime/RegExpMatchesArray.h:
+ (JSC::RegExpMatchesArray::getOwnPropertySlot):
+ (JSC::RegExpMatchesArray::getOwnPropertyDescriptor):
+ (JSC::RegExpMatchesArray::put):
+ (JSC::RegExpMatchesArray::deleteProperty):
+ (JSC::RegExpMatchesArray::getOwnPropertyNames):
+
+2010-02-25 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ JSC crashes like crazy in the JSPropertyNameIterator destructor
+
+ Add back null check of m_cachedStructure. Curse last minute changes.
+
+ * runtime/JSPropertyNameIterator.cpp:
+ (JSC::JSPropertyNameIterator::~JSPropertyNameIterator):
+
+2010-02-25 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Race condition in JSPropertyNameIterator and Structure destruction
+ https://bugs.webkit.org/show_bug.cgi?id=35398
+
+ JSPropertyNameIterator and Structure have a cyclic dependency that they
+ manage by clearing the appropriate reference in each other during their
+ destruction. However if the Structure is destroyed while the
+ JSPropertyNameIterator is dead but not yet finalized the Structures
+ WeakGCPtr will return null, and so prevent Structure from clearing
+ the m_cachedStructure pointer of the iterator. When the iterator is
+ then finalised the m_cachedStructure is invalid, and the attempt to
+ clear the structures back reference fails.
+
+ To fix this we simply make JSPropertyNameIterator keep the Structure
+ alive, using the weak pointer to break the ref cycle.
+
+ * runtime/JSPropertyNameIterator.cpp:
+ (JSC::JSPropertyNameIterator::~JSPropertyNameIterator):
+ The iterator now keeps m_cachedStructure alive itself, so no longer needs
+ to check for it being cleared
+ * runtime/JSPropertyNameIterator.h:
+ (JSC::JSPropertyNameIterator::setCachedStructure):
+ Add an assertion to ensure correct usage
+ (JSC::JSPropertyNameIterator::cachedStructure):
+ Add .get()
+ * runtime/Structure.cpp:
+ (JSC::Structure::~Structure):
+ Add an assertion that our iterator isn't already dead, and remove
+ the now unnecessary attempt to clear the ref in the iterator
+ * runtime/WeakGCPtr.h:
+ (JSC::WeakGCPtr::hasDeadObject):
+ An assert-only function to allow us to assert correct behaviour
+ in the Structure destructor
+
+2010-02-25 Jochen Eisinger <jochen@chromium.org>
+
+ Reviewed by Jeremy Orlow.
+
+ Make the context that was passed to the ThreadFunction accessible.
+ https://bugs.webkit.org/show_bug.cgi?id=35379
+
+ When a database is opened, right now you
+ don't have any context from where it is opened. The problem is that
+ the actual calls that open a database go through the sqlite3 vfs
+ layer, so there's no easy way to pass this function down to to
+ platform/sql/chromium/SQLFileSystemChromium*.cpp
+
+ This patch will allow you to get from anywhere within webkit a pointer
+ to the Thread object that actually created the thread you're currently
+ on (in case of the database, this can be either a thread forked of
+ from the main thread or from a worker thread), and query the object
+ for context information.
+
+ * wtf/Threading.h:
+ * wtf/ThreadingNone.cpp:
+ (WTF::threadContext):
+ * wtf/ThreadingPthreads.cpp:
+ (WTF::):
+ (WTF::identifierByPthreadHandle):
+ (WTF::establishIdentifierForPthreadHandle):
+ (WTF::pthreadHandleForIdentifier):
+ (WTF::contextForIdentifier):
+ (WTF::createThreadInternal):
+ (WTF::currentThread):
+ (WTF::threadContext):
+ * wtf/ThreadingWin.cpp:
+ (WTF::):
+ (WTF::threadMap):
+ (WTF::storeThreadHandleByIdentifier):
+ (WTF::threadHandleForIdentifier):
+ (WTF::contextForIdentifier):
+ (WTF::createThreadInternal):
+ (WTF::threadContext):
+
+2010-02-25 Jeremy Orlow <jorlow@chromium.org>
+
+ Reverting to re-submit with better change log.
+
+ * wtf/Threading.h:
+ * wtf/ThreadingNone.cpp:
+ (WTF::isMainThread):
+ * wtf/ThreadingPthreads.cpp:
+ (WTF::identifierByPthreadHandle):
+ (WTF::establishIdentifierForPthreadHandle):
+ (WTF::pthreadHandleForIdentifier):
+ (WTF::createThreadInternal):
+ (WTF::currentThread):
+ * wtf/ThreadingWin.cpp:
+ (WTF::threadMap):
+ (WTF::storeThreadHandleByIdentifier):
+ (WTF::threadHandleForIdentifier):
+ (WTF::createThreadInternal):
+
+2010-02-25 Jochen Eisinger <jochen@chromium.org>
+
+ Reviewed by Jeremy Orlow.
+
+ Make the context that was passed to the ThreadFunction accessible.
+ https://bugs.webkit.org/show_bug.cgi?id=35379
+
+ * wtf/Threading.h:
+ * wtf/ThreadingNone.cpp:
+ (WTF::threadContext):
+ * wtf/ThreadingPthreads.cpp:
+ (WTF::):
+ (WTF::identifierByPthreadHandle):
+ (WTF::establishIdentifierForPthreadHandle):
+ (WTF::pthreadHandleForIdentifier):
+ (WTF::contextForIdentifier):
+ (WTF::createThreadInternal):
+ (WTF::currentThread):
+ (WTF::threadContext):
+ * wtf/ThreadingWin.cpp:
+ (WTF::):
+ (WTF::threadMap):
+ (WTF::storeThreadHandleByIdentifier):
+ (WTF::threadHandleForIdentifier):
+ (WTF::contextForIdentifier):
+ (WTF::createThreadInternal):
+ (WTF::threadContext):
+
+2010-02-24 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ [REGRESSION in r55185] EXC_BAD_ACCESS on opening inspector.
+ https://bugs.webkit.org/show_bug.cgi?id=35335
+
+ compileGetDirectOffset modifies the contents of the object register
+ when the object is not using the inline storage array. As the object
+ register contains our 'this' pointer we can't allow it to be clobbered.
+ The fix is simply to copy the register into a separate scratch register
+ when we're loading off an object that doesn't use inline storage.
+
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::privateCompileGetByIdSelfList):
+ * jit/JITPropertyAccess32_64.cpp:
+ (JSC::JIT::privateCompileGetByIdSelfList):
+
+2010-02-24 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Speed up getter performance in the jit
+ https://bugs.webkit.org/show_bug.cgi?id=35332
+
+ Implement getter lookup caching in the interpreter.
+ The getter stubs are generated through basically the
+ same code paths as the normal get_by_id caching.
+ Instead of simply loading a property and returning,
+ we load the getter slot, and pass the getter, base value
+ and return address to a shared stub used for getter
+ dispatch.
+
+ * jit/JIT.h:
+ (JSC::JIT::compileGetByIdProto):
+ (JSC::JIT::compileGetByIdSelfList):
+ (JSC::JIT::compileGetByIdProtoList):
+ (JSC::JIT::compileGetByIdChainList):
+ (JSC::JIT::compileGetByIdChain):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::privateCompileGetByIdProto):
+ (JSC::JIT::privateCompileGetByIdSelfList):
+ (JSC::JIT::privateCompileGetByIdProtoList):
+ (JSC::JIT::privateCompileGetByIdChainList):
+ (JSC::JIT::privateCompileGetByIdChain):
+ * jit/JITPropertyAccess32_64.cpp:
+ (JSC::JIT::privateCompileGetByIdProto):
+ (JSC::JIT::privateCompileGetByIdSelfList):
+ (JSC::JIT::privateCompileGetByIdProtoList):
+ (JSC::JIT::privateCompileGetByIdChainList):
+ (JSC::JIT::privateCompileGetByIdChain):
+ * jit/JITStubs.cpp:
+ (JSC::JITThunks::tryCacheGetByID):
+ (JSC::DEFINE_STUB_FUNCTION):
+ * jit/JITStubs.h:
+ (JSC::):
+ * runtime/GetterSetter.h:
+
+2010-02-23 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Web Inspector: Regression: r55027+: Inspector broken
+ https://bugs.webkit.org/show_bug.cgi?id=35253
+
+ op_get_by_id_getter_chain was not passing the correct this parameter.
+ The bug was caused by incorrect use of baseCell instead of baseValue,
+ baseValue contains the original object for the lookup (and hence the
+ correct this object), baseCell is clobbered as part of walking the
+ prototype chain.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+
+2010-02-23 Gustavo Noronha Silva <gns@gnome.org>
+
+ Rubber-stamped by Dimitri Glazkov.
+
+ Chromium build fix.
+
+ * JavaScriptCore.gyp/JavaScriptCore.gyp:
+
+2010-02-23 Leandro Pereira <leandro@profusion.mobi>
+
+ Reviewed by Gustavo Noronha Silva.
+
+ Changes references of GOwnPtr to reflect their new place.
+ http://webkit.org/b/35084
+
+ * JavaScriptCore/JavaScriptCore.gypi:
+ * JavaScriptCore/wtf/Threading.h:
+ * JavaScriptCore/wtf/unicode/glib/UnicodeGLib.h:
+
+2010-02-23 Leandro Pereira <leandro@profusion.mobi>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Adding the EFL implementation of JavaScriptCore.
+ See https://bugs.webkit.org/show_bug.cgi?id=35084 for details.
+
+ * GNUmakefile.am: Updated to reflect the new location of GOwnPtr and
+ GRefPtr.
+ * wtf/efl/MainThreadEfl.cpp: Added.
+ * wtf/gobject/GOwnPtr.cpp: Moved from wtf/gtk.
+ * wtf/gobject/GOwnPtr.h: Moved from wtf/gtk.
+ * wtf/gobject/GRefPtr.cpp: Moved from wtf/gtk.
+ * wtf/gobject/GRefPtr.h: Moved from wtf/gtk.
+
+2010-02-22 Julien Chaffraix <jchaffraix@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ Remove auto_ptr usage in JavaScriptCore.
+ https://bugs.webkit.org/show_bug.cgi?id=35221
+
+ * parser/Nodes.h: Removed now unneeded adopt method.
+ * parser/Parser.cpp: Removed <memory> include as it is not required anymore.
+ * wtf/OwnPtr.h: Removed the constructor from auto_ptr.
+ * wtf/VectorTraits.h: Removed a template specialization for auto_ptr.
+ * wtf/unicode/Collator.h: Made userDefault return a PassOwnPtr.
+ * wtf/unicode/CollatorDefault.cpp:
+ (WTF::Collator::userDefault): Changed the method to match the next signature.
+ * wtf/unicode/icu/CollatorICU.cpp:
+ (WTF::Collator::userDefault): Ditto.
+
+2010-02-22 Huahui Wu <hwu@google.com>
+
+ Reviewed by Eric Seidel.
+
+ Add code that enables SquirrelFish Extreme (a.k.a JSCX, JSC JIT)
+ in Android. It's disabled by default, but is enabled when the
+ enveronment variable ENABLE_JSC_JIT is set to true.
+ https://bugs.webkit.org/show_bug.cgi?id=34855
+
+ * Android.mk:
+ * wtf/Platform.h:
+
+2010-02-22 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ JSStringBuilder should not CRASH if allocation fails, it should throw a JSException.
+
+ * runtime/JSGlobalObjectFunctions.cpp:
+ * runtime/JSStringBuilder.h:
+ (JSC::JSStringBuilder::JSStringBuilder):
+ (JSC::JSStringBuilder::append):
+ (JSC::JSStringBuilder::build):
+ * runtime/StringBuilder.h:
+ (JSC::StringBuilder::build):
+ * wtf/Vector.h:
+ (WTF::VectorBufferBase::tryAllocateBuffer):
+ (WTF::):
+ (WTF::VectorBuffer::tryAllocateBuffer):
+ (WTF::::tryExpandCapacity):
+ (WTF::::tryReserveCapacity):
+ (WTF::::tryAppend):
+
+2010-02-22 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Eric Seidel.
+
+ [BREWMP] Map FastMalloc to BREW memory allocator
+ https://bugs.webkit.org/show_bug.cgi?id=33570
+
+ Use MALLOC macro instead of the standard malloc function.
+ Although RVCT provides malloc, we can't use it in BREW
+ because the loader does not initialize the base address properly.
+
+ * wtf/FastMalloc.cpp:
+ * wtf/brew/SystemMallocBrew.h: Added.
+ (mallocBrew):
+ (callocBrew):
+ (freeBrew):
+ (reallocBrew):
+
+2010-02-22 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk>
+
+ Build fix for make distcheck.
+
+ * GNUmakefile.am:
+
+2010-02-22 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Unreviewed build fix.
+
+ [Qt] Build fix for RVCT.
+
+ Fix after r55024. The "-i" option is for perl not for the
+ script.
+
+ * DerivedSources.pro:
+
+2010-02-21 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Make UString::m_data be const, and make the UChar owned/ref-counted by CrossThreadRefCounted be const too.
+
+ * runtime/UStringImpl.cpp:
+ (JSC::UStringImpl::baseSharedBuffer):
+ (JSC::UStringImpl::~UStringImpl):
+ * runtime/UStringImpl.h:
+ (JSC::UStringImpl::create):
+ (JSC::UStringImpl::data):
+ (JSC::UStringImpl::UStringImpl):
+ * wtf/OwnFastMallocPtr.h:
+ (WTF::OwnFastMallocPtr::~OwnFastMallocPtr):
+
+2010-02-21 Yuta Kitamura <yutak@chromium.org>
+
+ Reviewed by Darin Adler.
+
+ HashMapTranslatorAdapter::translate() needs to set the mapped value.
+
+ HTTPHeaderMap::add(const char*, const String&) does not work
+ https://bugs.webkit.org/show_bug.cgi?id=35227
+
+ * wtf/HashMap.h:
+ (WTF::HashMapTranslatorAdapter::translate):
+
+2010-02-19 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by David Levin.
+
+ Add an ENABLE flag for sandboxed iframes to make it possible to disable it in releases
+ https://bugs.webkit.org/show_bug.cgi?id=35147
+
+ * Configurations/FeatureDefines.xcconfig:
+
+2010-02-19 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ JSString::getIndex() calls value() to resolve the string value (is a rope)
+ to a UString, then passes the result to jsSingleCharacterSubstring without
+ checking for an exception. In case of out-of-memory the returned UString
+ is null(), which may result in an out-of-buounds substring being created.
+ This is bad.
+
+ Simple fix is to be able to get an index from a rope without resolving to
+ UString. This may be a useful optimization in some test cases.
+
+ The same bug exists in some other methods is JSString, these can be fixed
+ by changing them to call getIndex().
+
+ * runtime/JSString.cpp:
+ (JSC::JSString::resolveRope):
+ (JSC::JSString::getStringPropertyDescriptor):
+ * runtime/JSString.h:
+ (JSC::jsSingleCharacterSubstring):
+ (JSC::JSString::getIndex):
+ (JSC::jsSingleCharacterString):
+ (JSC::JSString::getStringPropertySlot):
+ * runtime/UStringImpl.cpp:
+ (JSC::singleCharacterSubstring):
+ * runtime/UStringImpl.h:
+ (JSC::UStringImpl::singleCharacterSubstring):
+
+2010-02-19 Oliver Hunt <oliver@apple.com>
+
+ RS = Gavin Barraclough.
+
+ Split the 32/64 version of JITPropertyAccess into a separate file.
+
+ * GNUmakefile.am:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.pri:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * jit/JITPropertyAccess.cpp:
+ * jit/JITPropertyAccess32_64.cpp: Added.
+ (JSC::JIT::emit_op_put_by_index):
+ (JSC::JIT::emit_op_put_getter):
+ (JSC::JIT::emit_op_put_setter):
+ (JSC::JIT::emit_op_del_by_id):
+ (JSC::JIT::emit_op_method_check):
+ (JSC::JIT::emitSlow_op_method_check):
+ (JSC::JIT::emit_op_get_by_val):
+ (JSC::JIT::emitSlow_op_get_by_val):
+ (JSC::JIT::emit_op_put_by_val):
+ (JSC::JIT::emitSlow_op_put_by_val):
+ (JSC::JIT::emit_op_get_by_id):
+ (JSC::JIT::emitSlow_op_get_by_id):
+ (JSC::JIT::emit_op_put_by_id):
+ (JSC::JIT::emitSlow_op_put_by_id):
+ (JSC::JIT::compileGetByIdHotPath):
+ (JSC::JIT::compileGetByIdSlowCase):
+ (JSC::JIT::compilePutDirectOffset):
+ (JSC::JIT::compileGetDirectOffset):
+ (JSC::JIT::testPrototype):
+ (JSC::JIT::privateCompilePutByIdTransition):
+ (JSC::JIT::patchGetByIdSelf):
+ (JSC::JIT::patchMethodCallProto):
+ (JSC::JIT::patchPutByIdReplace):
+ (JSC::JIT::privateCompilePatchGetArrayLength):
+ (JSC::JIT::privateCompileGetByIdProto):
+ (JSC::JIT::privateCompileGetByIdSelfList):
+ (JSC::JIT::privateCompileGetByIdProtoList):
+ (JSC::JIT::privateCompileGetByIdChainList):
+ (JSC::JIT::privateCompileGetByIdChain):
+ (JSC::JIT::emit_op_get_by_pname):
+ (JSC::JIT::emitSlow_op_get_by_pname):
+
+2010-02-19 Patrick Gansterer <paroga@paroga.com>
+
+ Reviewed by Laszlo Gombos.
+
+ Added additional parameter to create_rvct_stubs
+ for setting the regularexpression prefix.
+ Renamed it because it now works for other platforms too.
+ https://bugs.webkit.org/show_bug.cgi?id=34951
+
+ * DerivedSources.pro:
+ * create_jit_stubs: Copied from JavaScriptCore/create_rvct_stubs.
+ * create_rvct_stubs: Removed.
+
+2010-02-18 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Improve interpreter getter performance
+ https://bugs.webkit.org/show_bug.cgi?id=35138
+
+ Improve the performance of getter dispatch by making it possible
+ for the interpreter to cache the GetterSetter object lookup.
+
+ To do this we simply need to make PropertySlot aware of getters
+ as a potentially cacheable property, and record the base and this
+ objects for a getter access. This allows us to use more-or-less
+ identical code to that used by the normal get_by_id caching, with
+ the dispatch being the only actual difference.
+
+ I'm holding off of implementing this in the JIT until I do some
+ cleanup to try and making coding in the JIT not be as horrible
+ as it is currently.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::dump):
+ (JSC::CodeBlock::derefStructures):
+ (JSC::CodeBlock::refStructures):
+ * bytecode/Opcode.h:
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::resolveGlobal):
+ (JSC::Interpreter::tryCacheGetByID):
+ (JSC::Interpreter::privateExecute):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ * jit/JITStubs.cpp:
+ (JSC::JITThunks::tryCacheGetByID):
+ (JSC::DEFINE_STUB_FUNCTION):
+ * runtime/JSObject.cpp:
+ (JSC::JSObject::fillGetterPropertySlot):
+ * runtime/PropertySlot.cpp:
+ (JSC::PropertySlot::functionGetter):
+ * runtime/PropertySlot.h:
+ (JSC::PropertySlot::isGetter):
+ (JSC::PropertySlot::isCacheable):
+ (JSC::PropertySlot::isCacheableValue):
+ (JSC::PropertySlot::setValueSlot):
+ (JSC::PropertySlot::setGetterSlot):
+ (JSC::PropertySlot::setCacheableGetterSlot):
+ (JSC::PropertySlot::clearOffset):
+ (JSC::PropertySlot::thisValue):
+
+2010-02-17 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Fixed a portion of:
+ <rdar://problem/7165917> | https://bugs.webkit.org/show_bug.cgi?id=28676
+ Safari 4 does not release memory back to the operating system fast enough (28676)
+
+ This patch fixes a surprisingly common edge case in which the page heap
+ would have only one free span, but that span would be larger than the
+ minimum free size, so we would decide not to free it, even though it
+ could be as large as 100MB or more!
+
+ SunSpider reports no change on Mac or Windows.
+
+ * wtf/FastMalloc.cpp:
+ (WTF::TCMalloc_PageHeap::scavenge): Call shouldContinueScavenging() instead
+ of doing the math ourselves. Don't keep a local value for pagesDecommitted
+ because that lets free_committed_pages_ be wrong temporarily. Instead,
+ update free_committed_pages_ as we go. ASSERT that we aren't releasing
+ a span that has already been released, because we think this is impossible.
+ Finally, don't be afraid to release all free memory in the page heap when
+ scavenging. We only scavenge after 5 seconds of the application's working
+ set not growing, and we keep both thread caches and a central cache on
+ top of the page heap, so the extra free pages in the page heap were just
+ overkill.
+
+2010-02-17 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ https://bugs.webkit.org/show_bug.cgi?id=35070
+ Addition of 2 strings of length 2^31 may result in a string of length 0.
+
+ Check for overflow when creating a new JSString as a result of an addition
+ or concatenation, throw an out of memory exception.
+
+ * runtime/JSString.h:
+ (JSC::):
+ * runtime/Operations.h:
+ (JSC::jsString):
+
+2010-02-17 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Gustavo Noronha.
+
+ [Linux] Webkit incompatible with Java plugins
+ https://bugs.webkit.org/show_bug.cgi?id=24912
+
+ Add support for GFile to GOwnPtr.
+
+ Based on original work by Gustavo Noronha.
+
+ * wtf/gtk/GOwnPtr.cpp:
+ (WTF::GFile):
+ * wtf/gtk/GOwnPtr.h:
+
+2010-02-16 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Mark Rowe.
+
+ Fix a handful of other leaks seen on the buildbot.
+
+ * runtime/UStringImpl.h:
+ (JSC::UStringOrRopeImpl::deref): Delegate through to the subclass version of deref to ensure that
+ the correct cleanup takes place. This function previously featured some code that attempted to
+ skip deletion of static UStringImpl's. Closer inspection revealed that it was in fact equivalent
+ to "if (false)", meaning that UStringImpl's which had their final deref performed via this function
+ were leaked.
+
+2010-02-16 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Fix a handful of leaks seen on the buildbot.
+
+ * runtime/UStringImpl.h:
+ (JSC::UStringOrRopeImpl::deref): Call URopeImpl::destructNonRecursive rather than delete
+ to ensure that the rope's fibers are also destroyed.
+
+2010-02-16 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34964
+ Leaks tool reports false memory leaks due to Rope implementation.
+
+ A rope is a recursive data structure where each node in the rope holds a set of
+ pointers, each of which may reference either a string (in UStringImpl form) or
+ another rope node. A low bit in each pointer is used to distinguish between
+ rope & string elements, in a fashion similar to the recently-removed
+ PtrAndFlags class (see https://bugs.webkit.org/show_bug.cgi?id=33731 ). Again,
+ this causes a problem for Leaks - refactor to remove the magic pointer
+ mangling.
+
+ Move Rope out from JSString.h and rename to URopeImpl, to match UStringImpl.
+ Give UStringImpl and URopeImpl a common parent class, UStringOrRopeImpl.
+ Repurpose an otherwise invalid permutation to flags (static & should report
+ memory cost) to identify ropes.
+
+ This allows us to change the rope's fibers to interrogate the object rather
+ than storing a bool within the low bits of the pointer (or in some cases the
+ use of a common parent class removes the need to determine the type at all -
+ there is a common interface to ref or get the length of either ropes or strings).
+
+ * API/JSClassRef.cpp:
+ (OpaqueJSClass::OpaqueJSClass):
+ (OpaqueJSClassContextData::OpaqueJSClassContextData):
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::keyForCharacterSwitch):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+ * runtime/ArrayPrototype.cpp:
+ (JSC::arrayProtoFuncToString):
+ * runtime/Identifier.cpp:
+ (JSC::Identifier::equal):
+ (JSC::Identifier::addSlowCase):
+ * runtime/JSString.cpp:
+ (JSC::JSString::resolveRope):
+ * runtime/JSString.h:
+ (JSC::):
+ (JSC::RopeBuilder::JSString):
+ (JSC::RopeBuilder::~JSString):
+ (JSC::RopeBuilder::appendStringInConstruct):
+ (JSC::RopeBuilder::appendValueInConstructAndIncrementLength):
+ (JSC::RopeBuilder::JSStringFinalizerStruct::JSStringFinalizerStruct):
+ (JSC::RopeBuilder::JSStringFinalizerStruct::):
+ * runtime/UString.cpp:
+ (JSC::UString::toStrictUInt32):
+ (JSC::equal):
+ * runtime/UString.h:
+ (JSC::UString::isEmpty):
+ (JSC::UString::size):
+ * runtime/UStringImpl.cpp:
+ (JSC::URopeImpl::derefFibersNonRecursive):
+ (JSC::URopeImpl::destructNonRecursive):
+ * runtime/UStringImpl.h:
+ (JSC::UStringOrRopeImpl::isRope):
+ (JSC::UStringOrRopeImpl::length):
+ (JSC::UStringOrRopeImpl::ref):
+ (JSC::UStringOrRopeImpl::):
+ (JSC::UStringOrRopeImpl::operator new):
+ (JSC::UStringOrRopeImpl::UStringOrRopeImpl):
+ (JSC::UStringImpl::adopt):
+ (JSC::UStringImpl::createUninitialized):
+ (JSC::UStringImpl::tryCreateUninitialized):
+ (JSC::UStringImpl::data):
+ (JSC::UStringImpl::cost):
+ (JSC::UStringImpl::deref):
+ (JSC::UStringImpl::UStringImpl):
+ (JSC::UStringImpl::):
+ (JSC::URopeImpl::tryCreateUninitialized):
+ (JSC::URopeImpl::initializeFiber):
+ (JSC::URopeImpl::fiberCount):
+ (JSC::URopeImpl::fibers):
+ (JSC::URopeImpl::deref):
+ (JSC::URopeImpl::URopeImpl):
+ (JSC::URopeImpl::hasOneRef):
+ (JSC::UStringOrRopeImpl::deref):
+
+2010-02-15 Gabor Loki <loki@webkit.org>
+
+ Reviewed by Gavin Barraclough.
+
+ Fix the SP at ctiOpThrowNotCaught on Thumb2 (JSVALUE32)
+ https://bugs.webkit.org/show_bug.cgi?id=34939
+
+ * jit/JITStubs.cpp:
+
+2010-02-15 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by NOBODY (Build Fix!).
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-02-15 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Some general Rope related refactoring.
+
+ Rename Rope::m_ropeLength to m_fiberCount, to be more descriptive.
+ Rename Rope::m_stringLength to simply m_length (since this is the
+ more conventional name for the length of a string). Move append
+ behaviour out into a new RopeBuilder class, so that Rope no longer
+ needs any knowledge of the JSString or UString implementation.
+
+ Make Rope no longer be nested within JSString.
+ (Rope now no-longer need reside within JSString.h, but leaving
+ the change of moving this out to a different header as a separate
+ change from these renames).
+
+ * JavaScriptCore.exp:
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ * runtime/JSString.cpp:
+ (JSC::Rope::destructNonRecursive):
+ (JSC::Rope::~Rope):
+ (JSC::JSString::resolveRope):
+ (JSC::JSString::toBoolean):
+ (JSC::JSString::getStringPropertyDescriptor):
+ * runtime/JSString.h:
+ (JSC::Rope::Fiber::Fiber):
+ (JSC::Rope::Fiber::deref):
+ (JSC::Rope::Fiber::ref):
+ (JSC::Rope::Fiber::refAndGetLength):
+ (JSC::Rope::Fiber::isRope):
+ (JSC::Rope::Fiber::rope):
+ (JSC::Rope::Fiber::isString):
+ (JSC::Rope::Fiber::string):
+ (JSC::Rope::Fiber::nonFiber):
+ (JSC::Rope::tryCreateUninitialized):
+ (JSC::Rope::append):
+ (JSC::Rope::fiberCount):
+ (JSC::Rope::length):
+ (JSC::Rope::fibers):
+ (JSC::Rope::Rope):
+ (JSC::Rope::operator new):
+ (JSC::):
+ (JSC::RopeBuilder::JSString):
+ (JSC::RopeBuilder::~JSString):
+ (JSC::RopeBuilder::length):
+ (JSC::RopeBuilder::canGetIndex):
+ (JSC::RopeBuilder::appendStringInConstruct):
+ (JSC::RopeBuilder::appendValueInConstructAndIncrementLength):
+ (JSC::RopeBuilder::isRope):
+ (JSC::RopeBuilder::fiberCount):
+ (JSC::JSString::getStringPropertySlot):
+ * runtime/Operations.h:
+ (JSC::jsString):
+
+2010-02-15 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by NOBODY (Build fix).
+
+ Add missing cast for !YARR (PPC) builds.
+
+ * runtime/RegExp.cpp:
+ (JSC::RegExp::match):
+
+2010-02-14 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=33731
+ Many false leaks in release builds due to PtrAndFlags
+
+ StructureTransitionTable was effectively a smart pointer type,
+ one machine word in size and wholly contained as a member of
+ of Structure. It either pointed to an actual table, or could
+ be used to describe a single transtion entry without use of a
+ table.
+
+ This, however, worked by using a PtrAndFlags, which is not
+ compatible with the leaks tool. Since there is no clear way to
+ obtain another bit for 'free' here, and since there are bits
+ available up in Structure, merge this functionality back up into
+ Structure. Having this in a separate class was quite clean
+ from an enacapsulation perspective, but this solution doesn't
+ seem to bad - all table access is now intermediated through the
+ Structure::structureTransitionTableFoo methods, keeping the
+ optimization fairly well contained.
+
+ This was the last use of PtrAndFlags, so removing the file too.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * bytecode/CodeBlock.h:
+ * runtime/Structure.cpp:
+ (JSC::Structure::Structure):
+ (JSC::Structure::~Structure):
+ (JSC::Structure::addPropertyTransitionToExistingStructure):
+ (JSC::Structure::addPropertyTransition):
+ (JSC::Structure::hasTransition):
+ * runtime/Structure.h:
+ (JSC::Structure::):
+ (JSC::Structure::structureTransitionTableContains):
+ (JSC::Structure::structureTransitionTableGet):
+ (JSC::Structure::structureTransitionTableHasTransition):
+ (JSC::Structure::structureTransitionTableRemove):
+ (JSC::Structure::structureTransitionTableAdd):
+ (JSC::Structure::structureTransitionTable):
+ (JSC::Structure::setStructureTransitionTable):
+ (JSC::Structure::singleTransition):
+ (JSC::Structure::setSingleTransition):
+ * runtime/StructureTransitionTable.h:
+ * wtf/PtrAndFlags.h: Removed.
+
+2010-02-15 Gavin Barraclough <barraclough@apple.com>
+
+ Rubber Stamped by Geoff Garen.
+
+ Bug 34948 - tryMakeString should fail on error in length calculation
+
+ Ooops! - "bool overflow" argument should have been "bool& overflow".
+
+ * runtime/UString.h:
+ (JSC::sumWithOverflow):
+ (JSC::tryMakeString):
+
+2010-02-15 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by NOBODY (Build Fix (pt 2!)).
+
+ Some symbol names have changed, remove, will readd if required.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-02-15 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by NOBODY (Build Fix (pt 1?)).
+
+ Some symbol names have changed, remove, will readd if required.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-02-15 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Removed some mistaken code added in http://trac.webkit.org/changeset/53860.
+
+ * API/APIShims.h:
+ (JSC::APICallbackShim::APICallbackShim):
+ (JSC::APICallbackShim::~APICallbackShim): No need to start/stop the
+ timeout checker when calling out from the API to the client; we want to
+ monitor the VM for timeouts, not the client. This mistake was harmless /
+ undetectable, since it's totally redundant with the APIEntryShim, which
+ also starts / stops the timeout checker.
+
+2010-02-15 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Bug 34952 - String lengths in UString should be unsigned.
+ This matches WebCore::StringImpl, and better unifies behaviour throughout JSC.
+
+ * JavaScriptCore.exp:
+ * bytecode/EvalCodeCache.h:
+ * runtime/Identifier.cpp:
+ (JSC::Identifier::equal):
+ * runtime/Identifier.h:
+ * runtime/JSGlobalObjectFunctions.cpp:
+ (JSC::globalFuncEscape):
+ * runtime/JSONObject.cpp:
+ (JSC::gap):
+ (JSC::Stringifier::indent):
+ * runtime/NumberPrototype.cpp:
+ (JSC::numberProtoFuncToFixed):
+ (JSC::numberProtoFuncToPrecision):
+ * runtime/RegExp.cpp:
+ (JSC::RegExp::match):
+ * runtime/StringPrototype.cpp:
+ (JSC::substituteBackreferencesSlow):
+ (JSC::stringProtoFuncReplace):
+ (JSC::stringProtoFuncSplit):
+ (JSC::trimString):
+ * runtime/UString.cpp:
+ (JSC::UString::UString):
+ (JSC::UString::from):
+ (JSC::UString::getCString):
+ (JSC::UString::ascii):
+ (JSC::UString::operator[]):
+ (JSC::UString::toStrictUInt32):
+ (JSC::UString::find):
+ (JSC::UString::rfind):
+ (JSC::UString::substr):
+ (JSC::operator<):
+ (JSC::operator>):
+ (JSC::compare):
+ (JSC::equal):
+ (JSC::UString::UTF8String):
+ * runtime/UString.h:
+ (JSC::UString::size):
+ (JSC::operator==):
+ * runtime/UStringImpl.cpp:
+ (JSC::UStringImpl::create):
+ * runtime/UStringImpl.h:
+ (JSC::UStringImpl::create):
+ (JSC::UStringImpl::size):
+ (JSC::UStringImpl::computeHash):
+ (JSC::UStringImpl::UStringImpl):
+
+2010-02-15 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Bug 34948 - tryMakeString should fail on error in length calculation
+
+ The sum of the length of substrings could overflow.
+
+ * runtime/UString.h:
+ (JSC::sumWithOverflow):
+ (JSC::tryMakeString):
+
+2010-02-15 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Fixed <rdar://problem/7628524> Crash beneath JSGlobalContextRelease when
+ typing in Google search field with GuardMalloc/full page heap enabled
+
+ * API/JSContextRef.cpp: Don't use APIEntryShim, since that requires
+ a JSGlobalData, which this function destroys. Do use setCurrentIdentifierTable
+ and JSLock instead, since those are the two features of APIEntryShim we
+ require.
+
+2010-02-15 Patrick Gansterer <paroga@paroga.com>
+
+ Reviewed by Laszlo Gombos.
+
+ Added additional parameter to create_rvct_stubs
+ for setting the offset of thunkReturnAddress.
+ https://bugs.webkit.org/show_bug.cgi?id=34657
+
+ * create_rvct_stubs:
+ * jit/JITStubs.cpp:
+
+2010-02-15 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Fix QScriptValue::toIntXX methods.
+
+ More ECMA Script compliance.
+
+ [Qt] QScriptValue::toIntXX returns incorrect values
+ https://bugs.webkit.org/show_bug.cgi?id=34847
+
+ * qt/api/qscriptvalue_p.h:
+ (QScriptValuePrivate::toInteger):
+ (QScriptValuePrivate::toInt32):
+ (QScriptValuePrivate::toUInt32):
+ (QScriptValuePrivate::toUInt16):
+ * qt/tests/qscriptvalue/tst_qscriptvalue.h:
+ * qt/tests/qscriptvalue/tst_qscriptvalue_generated.cpp:
+ (tst_QScriptValue::toInteger_initData):
+ (tst_QScriptValue::toInteger_makeData):
+ (tst_QScriptValue::toInteger_test):
+ (tst_QScriptValue::toInt32_initData):
+ (tst_QScriptValue::toInt32_makeData):
+ (tst_QScriptValue::toInt32_test):
+ (tst_QScriptValue::toUInt32_initData):
+ (tst_QScriptValue::toUInt32_makeData):
+ (tst_QScriptValue::toUInt32_test):
+ (tst_QScriptValue::toUInt16_initData):
+ (tst_QScriptValue::toUInt16_makeData):
+ (tst_QScriptValue::toUInt16_test):
+
+2010-02-14 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Adam Barth.
+
+ Implement NEVER_INLINE and NO_RETURN for RVCT
+ https://bugs.webkit.org/show_bug.cgi?id=34740
+
+ * wtf/AlwaysInline.h:
+
+2010-02-12 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ https://bugs.webkit.org/show_bug.cgi?id=33731
+ Remove uses of PtrAndFlags from JIT data stuctures.
+
+ These break the OS X Leaks tool. Free up a bit in CallLinkInfo, and invalid
+ permutation of pointer states in MethodCallLinkInfo to represent the removed bits.
+
+ * bytecode/CodeBlock.h:
+ (JSC::CallLinkInfo::seenOnce):
+ (JSC::CallLinkInfo::setSeen):
+ (JSC::MethodCallLinkInfo::MethodCallLinkInfo):
+ (JSC::MethodCallLinkInfo::seenOnce):
+ (JSC::MethodCallLinkInfo::setSeen):
+ * jit/JIT.cpp:
+ (JSC::JIT::unlinkCall):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::patchMethodCallProto):
+ * runtime/UString.h:
+
+2010-02-12 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=33731
+ Many false leaks in release builds due to PtrAndFlags
+
+ Remove UntypedPtrAndBitfield (similar to PtrAndFlags) in UStringImpl,
+ and steal bits from the refCount instead.
+
+ * runtime/UStringImpl.cpp:
+ (JSC::UStringImpl::baseSharedBuffer):
+ (JSC::UStringImpl::~UStringImpl):
+ * runtime/UStringImpl.h:
+ (JSC::UStringImpl::cost):
+ (JSC::UStringImpl::isIdentifier):
+ (JSC::UStringImpl::setIsIdentifier):
+ (JSC::UStringImpl::ref):
+ (JSC::UStringImpl::deref):
+ (JSC::UStringImpl::UStringImpl):
+ (JSC::UStringImpl::bufferOwnerString):
+ (JSC::UStringImpl::bufferOwnership):
+ (JSC::UStringImpl::isStatic):
+ (JSC::UStringImpl::):
+
+2010-02-12 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Removed an unnecessary data dependency from my last patch.
+
+ * runtime/SmallStrings.cpp:
+ (JSC::SmallStrings::markChildren): Since isAnyStringMarked being false
+ is a condition of entering the loop, we can just use '=' instead of '|='.
+
+2010-02-12 Janne Koskinen <janne.p.koskinen@digia.com>
+
+ Reviewed by Tor Arne Vestbø.
+
+ Additional refptr/passrefptr workarounds for WINSCW compiler
+ https://bugs.webkit.org/show_bug.cgi?id=28054
+
+ * wtf/PassRefPtr.h:
+ (WTF::refIfNotNull):
+ (WTF::PassRefPtr::PassRefPtr):
+ (WTF::PassRefPtr::~PassRefPtr):
+ (WTF::PassRefPtr::clear):
+ (WTF::::operator):
+ * wtf/RefPtr.h:
+ (WTF::RefPtr::RefPtr):
+ (WTF::::operator):
+
+2010-02-12 Janne Koskinen <janne.p.koskinen@digia.com>
+
+ Reviewed by Tor Arne Vestbø.
+
+ Additional refptr/passrefptr workarounds for WINSCW compiler
+ https://bugs.webkit.org/show_bug.cgi?id=28054
+
+ * wtf/PassRefPtr.h:
+ (WTF::refIfNotNull):
+ (WTF::PassRefPtr::PassRefPtr):
+ (WTF::PassRefPtr::~PassRefPtr):
+ (WTF::PassRefPtr::clear):
+ (WTF::::operator):
+ * wtf/RefPtr.h:
+ (WTF::RefPtr::RefPtr):
+ (WTF::::operator):
+
+2010-02-12 Janne Koskinen <janne.p.koskinen@digia.com>
+
+ Reviewed by Tor Arne Vestbø.
+
+ Additional refptr/passrefptr workarounds for WINSCW compiler
+ https://bugs.webkit.org/show_bug.cgi?id=28054
+
+ * wtf/PassRefPtr.h:
+ (WTF::refIfNotNull):
+ (WTF::PassRefPtr::PassRefPtr):
+ (WTF::PassRefPtr::~PassRefPtr):
+ (WTF::PassRefPtr::clear):
+ (WTF::::operator):
+ * wtf/RefPtr.h:
+ (WTF::RefPtr::RefPtr):
+ (WTF::::operator):
+
+2010-02-12 Janne Koskinen <janne.p.koskinen@digia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Don't import the cmath functions from std:: for WINSCW.
+
+ * wtf/MathExtras.h:
+
+2010-02-12 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Adam Barth.
+
+ Typedef both JSChar and UChar to wchar_t in RVCT.
+ https://bugs.webkit.org/show_bug.cgi?id=34560
+
+ Define both JSChar and UChar to wchar_t as the size
+ of wchar_t is 2 bytes in RVCT.
+
+ * API/JSStringRef.h:
+ * wtf/unicode/qt4/UnicodeQt4.h:
+
+2010-02-11 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt and Darin Adler.
+
+ The rest of the fix for
+ https://bugs.webkit.org/show_bug.cgi?id=34864 | <rdar://problem/7594198>
+ Many objects left uncollected after visiting mail.google.com and closing
+ window
+
+ Don't unconditionally hang onto small strings. Instead, hang onto all
+ small strings as long as any small string is still referenced.
+
+ SunSpider reports no change.
+
+ * runtime/Collector.cpp:
+ (JSC::Heap::markRoots): Mark the small strings cache last, so it can
+ check if anything else has kept any strings alive.
+
+ * runtime/SmallStrings.cpp:
+ (JSC::isMarked):
+ (JSC::SmallStrings::markChildren): Only keep our strings alive if some
+ other reference to at least one of them exists, too.
+
+2010-02-11 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Some progress toward fixing
+ https://bugs.webkit.org/show_bug.cgi?id=34864 | <rdar://problem/7594198>
+ Many objects left uncollected after visiting mail.google.com and closing
+ window
+
+ SunSpider reports no change.
+
+ Keep weak references, rather than protected references, to cached for-in
+ property name enumerators.
+
+ One problem with protected references is that a chain like
+ [ gc object 1 ] => [ non-gc object ] => [ gc object 2 ]
+ takes two GC passes to break, since the first pass collects [ gc object 1 ],
+ releasing [ non-gc object ] and unprotecting [ gc object 2 ], and only
+ then can a second pass collect [ gc object 2 ].
+
+ Another problem with protected references is that they can keep a bunch
+ of strings alive long after they're useful. In SunSpider and a few popular
+ websites, the size-speed tradeoff seems to favor weak references.
+
+ * runtime/JSPropertyNameIterator.cpp:
+ (JSC::JSPropertyNameIterator::JSPropertyNameIterator): Moved this constructor
+ into the .cpp file, since it's not used elsewhere.
+
+ (JSC::JSPropertyNameIterator::~JSPropertyNameIterator): Added a destructor
+ to support our weak reference.
+
+ * runtime/JSPropertyNameIterator.h:
+ (JSC::Structure::setEnumerationCache):
+ (JSC::Structure::clearEnumerationCache):
+ (JSC::Structure::enumerationCache): Added a function for clearing a
+ Structure's enumeration cache, used by our new destructor. Also fixed
+ indentation to match the rest of the file.
+
+ * runtime/Structure.h: Changed from protected pointer to weak pointer.
+
+2010-02-11 Chris Rogers <crogers@google.com>
+
+ Reviewed by David Levin.
+
+ audio engine: add Complex number class
+ https://bugs.webkit.org/show_bug.cgi?id=34538
+
+ * wtf/Complex.h: Added.
+ (WebCore::complexFromMagnitudePhase):
+
+2010-02-10 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Added an SPI for asking about all the different live objects on the heap.
+ Useful for memory debugging.
+
+ * JavaScriptCore.exp: Export the new SPI.
+
+ * runtime/Collector.cpp:
+ (JSC::typeName): Use a little capitalization. Don't crash in the case of
+ a non-object cell, since it might just be an uninitialized cell.
+
+ (JSC::Heap::objectTypeCounts): The new SPI.
+
+ * runtime/Collector.h:
+ * runtime/CollectorHeapIterator.h:
+ (JSC::CollectorHeapIterator::advance):
+ (JSC::LiveObjectIterator::operator++):
+ (JSC::DeadObjectIterator::operator++):
+ (JSC::ObjectIterator::operator++): Made 2 tweaks to these iterators:
+ (1) Skip the last cell in the block, since it's a dummy sentinel, and
+ we don't want it to confuse the object count; (2) Fixed a logic error
+ in LiveObjectIterator that could cause it to iterate dead objects if
+ m_block were equal to m_heap.nextBlock and m_cell were less than
+ m_heap.nextCell. No test for this since I can't think of a way that this
+ could make WebKit behave badly.
+
+2010-02-11 Steve Block <steveblock@google.com>
+
+ Reviewed by Darin Adler.
+
+ Guard cmath using declarations in MathExtras.h on Android
+ https://bugs.webkit.org/show_bug.cgi?id=34840
+
+ Android does not provide these functions.
+
+ * wtf/MathExtras.h:
+
+2010-02-08 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Cameron Zwarich.
+
+ Restore ENABLE_RUBY flag so vendors can ship with Ruby disabled if they choose.
+ https://bugs.webkit.org/show_bug.cgi?id=34698
+
+ * Configurations/FeatureDefines.xcconfig:
+
+2010-02-10 Kevin Watters <kevinwatters@gmail.com>
+
+ Reviewed by Kevin Ollivier.
+
+ [wx] Add Windows complex text support and Mac support for containsCharacters.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34759
+
+ * wscript:
+
+2010-02-10 Alexey Proskuryakov <ap@apple.com>
+
+ Addressing issues found by style bot.
+
+ * wtf/ValueCheck.h: Renamed header guard to match final file name.
+
+ * wtf/Vector.h: (WTF::::checkConsistency): Remove braces around a one-line clause.
+
+2010-02-09 Alexey Proskuryakov <ap@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34490
+ WebCore::ImageEventSender::dispatchPendingEvents() crashes in certain conditions
+
+ * GNUmakefile.am:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ Added ValueCheck.h.
+
+ * wtf/ValueCheck.h: Added. Moved code out of HashTraits, since it would be awkward to
+ include that from Vector.h.
+ (WTF::ValueCheck::checkConsistency): Allow null pointers, those are pretty consistent.
+
+ * wtf/HashTraits.h: Moved value checking code out of here.
+
+ * wtf/HashTable.h: (WTF::::checkTableConsistencyExceptSize): Updated for the above changes.
+
+ * wtf/Vector.h:
+ (WTF::::checkConsistency): Check all vector elements.
+ (WTF::ValueCheck): Support checking a Vector as an element in other containers. Currently
+ unused.
+
+2010-02-10 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Fix QScriptValue::toBool.
+
+ Fix ECMA compliance in the QScriptValue for values like 0, NaN and
+ empty strings.
+
+ [Qt] QScriptValue::toBool problem
+ https://bugs.webkit.org/show_bug.cgi?id=34793
+
+ * qt/api/qscriptvalue_p.h:
+ (QScriptValuePrivate::toBool):
+ * qt/tests/qscriptvalue/tst_qscriptvalue.h:
+ * qt/tests/qscriptvalue/tst_qscriptvalue_generated.cpp:
+ (tst_QScriptValue::toBool_initData):
+ (tst_QScriptValue::toBool_makeData):
+ (tst_QScriptValue::toBool_test):
+ (tst_QScriptValue::toBoolean_initData):
+ (tst_QScriptValue::toBoolean_makeData):
+ (tst_QScriptValue::toBoolean_test):
+
+2009-10-06 Yongjun Zhang <yongjun.zhang@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Use derefIfNotNull() to work around WINSCW compiler forward declaration bug
+
+ The compiler bug is reported at
+ https://xdabug001.ext.nokia.com/bugzilla/show_bug.cgi?id=9812.
+
+ The change should be reverted when the above bug is fixed in WINSCW compiler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=28054
+
+2009-10-06 Yongjun Zhang <yongjun.zhang@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Get rid of WINSCW hack for UnSpecifiedBoolType
+
+ Add parenthesis around (RefPtr::*UnspecifiedBoolType) to make the WINSCW
+ compiler work with the default UnSpecifiedBoolType() operator.
+
+ https://bugs.webkit.org/show_bug.cgi?id=28054
+
+ * wtf/RefPtr.h:
+
+2010-02-09 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ New functions nullValue() and undefinedValue().
+
+ [Qt] QScriptEngine should contain nullValue and undefinedValue methods
+ https://bugs.webkit.org/show_bug.cgi?id=34749
+
+ * qt/api/qscriptengine.cpp:
+ (QScriptEngine::nullValue):
+ (QScriptEngine::undefinedValue):
+ * qt/api/qscriptengine.h:
+ * qt/tests/qscriptengine/tst_qscriptengine.cpp:
+ (tst_QScriptEngine::nullValue):
+ (tst_QScriptEngine::undefinedValue):
+
+2010-02-09 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Fixes for QScriptValue::toNumber().
+
+ Fix ECMA compliance in QScriptValue for values unbound
+ to a QScriptEngine.
+
+ [Qt] QScriptValue::toNumber() is broken
+ https://bugs.webkit.org/show_bug.cgi?id=34592
+
+ * qt/api/qscriptvalue_p.h:
+ (QScriptValuePrivate::toNumber):
+ * qt/tests/qscriptvalue/tst_qscriptvalue.h:
+ * qt/tests/qscriptvalue/tst_qscriptvalue_generated.cpp:
+ (tst_QScriptValue::toNumber_initData):
+ (tst_QScriptValue::toNumber_makeData):
+ (tst_QScriptValue::toNumber_test):
+
+2010-02-09 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Fix QScriptValue::isNumber().
+
+ The isNumber() should return 'true' if the value is in the CNumber
+ state.
+
+ [Qt] QScriptValue::isNumber() returns an incorrect value
+ https://bugs.webkit.org/show_bug.cgi?id=34575
+
+ * qt/api/qscriptvalue_p.h:
+ (QScriptValuePrivate::isNumber):
+ * qt/tests/qscriptvalue/tst_qscriptvalue.h:
+ * qt/tests/qscriptvalue/tst_qscriptvalue_generated.cpp:
+ (tst_QScriptValue::isNumber_initData):
+ (tst_QScriptValue::isNumber_makeData):
+ (tst_QScriptValue::isNumber_test):
+
+2010-02-09 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Small refactoring to the small strings cache to allow it to be cleared
+ dynamically.
+
+ * runtime/SmallStrings.cpp:
+ (JSC::SmallStrings::SmallStrings):
+ (JSC::SmallStrings::clear):
+ * runtime/SmallStrings.h: Moved initialization code into a shared function,
+ and changed the constructor to call it.
+
+2010-02-09 Gavin Barraclough <barraclough@apple.com>
+
+ Rubber Stamped by Geoff Garen.
+
+ Rename StringBuilder::release && JSStringBuilder::releaseJSString
+ to 'build()'.
+
+ * runtime/ArrayPrototype.cpp:
+ (JSC::arrayProtoFuncToLocaleString):
+ (JSC::arrayProtoFuncJoin):
+ * runtime/Executable.cpp:
+ (JSC::FunctionExecutable::paramString):
+ * runtime/FunctionConstructor.cpp:
+ (JSC::constructFunction):
+ * runtime/JSGlobalObjectFunctions.cpp:
+ (JSC::encode):
+ (JSC::decode):
+ (JSC::globalFuncEscape):
+ (JSC::globalFuncUnescape):
+ * runtime/JSONObject.cpp:
+ (JSC::Stringifier::stringify):
+ * runtime/JSStringBuilder.h:
+ (JSC::JSStringBuilder::build):
+ * runtime/LiteralParser.cpp:
+ (JSC::LiteralParser::Lexer::lexString):
+ * runtime/NumberPrototype.cpp:
+ (JSC::integerPartNoExp):
+ (JSC::numberProtoFuncToFixed):
+ * runtime/StringBuilder.h:
+ (JSC::StringBuilder::build):
+
+2010-02-09 John Sullivan <sullivan@apple.com>
+
+ https://bugs.webkit.org/show_bug.cgi?id=34772
+ Overzealous new assertion in URStringImpl::adopt()
+
+ Reviewed by Adam Barth.
+
+ * runtime/UStringImpl.h:
+ (JSC::UStringImpl::adopt):
+ Only assert that vector.data() is non-zero if vector.size() is non-zero.
+
+2010-02-09 Nikolas Zimmermann <nzimmermann@rim.com>
+
+ Not reviewed. Try to fix build problem on SnowLeopard slaves to bring them back.
+
+ * API/JSClassRef.cpp:
+ (tryCreateStringFromUTF8): Mark method as 'static inline' to suppress "warning: no previous prototype for ..."
+
+2010-02-09 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Three small string fixes:
+ (1) StringBuilder::release should CRASH if the buffer allocation failed.
+ (2) Remove weird, dead code from JSString::tryGetValue, replace with an ASSERT.
+ (3) Move UString::createFromUTF8 out to the API, as tryCreateStringFromUTF8.
+ This is only used from the API, and (now) unlike other UString::create
+ methods may return UString::null() to indicate failure cases. Better
+ handle these in the API.
+
+ * API/JSClassRef.cpp:
+ (tryCreateStringFromUTF8):
+ (OpaqueJSClass::OpaqueJSClass):
+ (OpaqueJSClassContextData::OpaqueJSClassContextData):
+ * runtime/JSString.h:
+ (JSC::Fiber::tryGetValue):
+ * runtime/StringBuilder.h:
+ (JSC::StringBuilder::release):
+ * runtime/UString.cpp:
+ (JSC::UString::UString):
+ (JSC::UString::from):
+ (JSC::UString::find):
+ * runtime/UString.h:
+
+2010-02-09 Janne Koskinen <janne.p.koskinen@digia.com>
+
+ Reviewed by Laszlo Gombos.
+
+ [Qt] use nanval() for Symbian as nonInlineNaN
+ https://bugs.webkit.org/show_bug.cgi?id=34170
+
+ numeric_limits<double>::quiet_NaN is broken in Symbian
+ causing NaN to be evaluated as a number.
+
+ * runtime/JSValue.cpp:
+ (JSC::nonInlineNaN):
+
+2010-02-09 Tamas Szirbucz <szirbucz@inf.u-szeged.hu>
+
+ Reviewed by Gavin Barraclough.
+
+ Add a soft modulo operation to ARM JIT using a trampoline function.
+ The performance progression is about ~1.8% on ARMv7
+ https://bugs.webkit.org/show_bug.cgi?id=34424
+
+ Developed in cooperation with Gabor Loki.
+
+ * jit/JIT.h:
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emit_op_mod):
+ (JSC::JIT::emitSlow_op_mod):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::softModulo):
+ * jit/JITStubs.h:
+ (JSC::JITThunks::ctiSoftModulo):
+ * wtf/Platform.h:
+
+2010-02-08 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by NOBODY (SL/win build fixes).
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * runtime/StringPrototype.cpp:
+
+2010-02-08 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt
+
+ Make String.replace throw an exception on out-of-memory, rather than
+ returning a null (err, empty-ish) string. Move String::replaceRange
+ and String::spliceSubstringsWithSeparators out to StringPrototype -
+ these were fairly specific use anyway, and we can better integrate
+ throwing the JS expcetion this way.
+
+ Also removes redundant assignment operator from UString.
+
+ * JavaScriptCore.exp:
+ * runtime/StringPrototype.cpp:
+ (JSC::StringRange::StringRange):
+ (JSC::jsSpliceSubstringsWithSeparators):
+ (JSC::jsReplaceRange):
+ (JSC::stringProtoFuncReplace):
+ * runtime/UString.cpp:
+ * runtime/UString.h:
+
+2010-02-08 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Eric Seidel.
+
+ [BREWMP] Undefine WTF_OS_WINDOWS and WTF_PLATFORM_WIN
+ https://bugs.webkit.org/show_bug.cgi?id=34561
+
+ As the binary for simulator is built with MSVC 2005,
+ WTF_OS_WINDOWS and WTF_PLATFORM_WIN are defined.
+ Undefine them as we don't target Windows.
+
+ * wtf/Platform.h:
+
+2010-02-08 Chris Rogers <crogers@google.com>
+
+ Reviewed by Darin Adler.
+
+ audio engine: add Vector3 class
+ https://bugs.webkit.org/show_bug.cgi?id=34548
+
+ * wtf/Vector3.h: Added.
+ (WebCore::Vector3::Vector3):
+ (WebCore::Vector3::abs):
+ (WebCore::Vector3::isZero):
+ (WebCore::Vector3::normalize):
+ (WebCore::Vector3::x):
+ (WebCore::Vector3::y):
+ (WebCore::Vector3::z):
+ (WebCore::operator+):
+ (WebCore::operator-):
+ (WebCore::operator*):
+ (WebCore::dot):
+ (WebCore::cross):
+ (WebCore::distance):
+
+2010-02-08 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Fix warning in clang++
+
+ * runtime/Structure.h:
+ (JSC::Structure::propertyStorageSize):
+
+2010-02-08 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Make makeString CRASH if we fail to allocate a string.
+
+ (tryMakeString or jsMakeNontrivialString can be used where we
+ expect allocation may fail and want to handle the error).
+
+ * runtime/JSStringBuilder.h:
+ (JSC::jsMakeNontrivialString):
+ * runtime/UString.h:
+ (JSC::tryMakeString):
+ (JSC::makeString):
+
+2010-02-08 Gavin Barraclough <barraclough@apple.com>
+
+ Rubber Stamped by Oliver Hunt.
+
+ Remove a couple of unnecesary C-style casts spotted by Darin.
+
+ * runtime/JSGlobalObjectFunctions.cpp:
+ (JSC::encode):
+ (JSC::globalFuncEscape):
+
+2010-02-08 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Switch some more StringBuilder/jsNontrivialString code to use
+ JSStringBuilder/jsMakeNontrivialString - these methods will
+ throw an exception if we hit out-of-memory, rather than just
+ CRASHing.
+
+ * runtime/FunctionPrototype.cpp:
+ (JSC::functionProtoFuncToString):
+ * runtime/JSGlobalObjectFunctions.cpp:
+ (JSC::encode):
+ (JSC::decode):
+ (JSC::globalFuncEscape):
+
+2010-02-08 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Use an empty identifier instead of a null identifier for parse
+ tokens without an identifier.
+
+ This helps encapsulate the null UStringImpl within UString.
+
+ * parser/Grammar.y:
+ * parser/NodeConstructors.h:
+ (JSC::ContinueNode::ContinueNode):
+ (JSC::BreakNode::BreakNode):
+ (JSC::ForInNode::ForInNode):
+ * runtime/CommonIdentifiers.cpp:
+ (JSC::CommonIdentifiers::CommonIdentifiers):
+ * runtime/CommonIdentifiers.h:
+ * runtime/FunctionPrototype.cpp:
+ (JSC::FunctionPrototype::FunctionPrototype):
+
+2010-02-08 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk>
+
+ Build fix for make distcheck.
+
+ * GNUmakefile.am:
+
+2010-02-08 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Unreviewed RVCT build fix.
+
+ Similar to r54391, don't import the cmath functions from std:: for RVCT.
+
+ * wtf/MathExtras.h:
+
+2010-02-05 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Change UStringImpl::create to CRASH if the string cannot be allocated,
+ rather than returning a null string (which will behave like a zero-length
+ string if used).
+
+ Also move createRep function from UString to become new overloaded
+ UStringImpl::create methods. In doing so, bring their behaviour closer to
+ being in line with WebCore::StringImpl, in removing the behaviour that they
+ can be used to produce null UStrings (ASSERT the char* provided is non-null).
+ This behaviour of converting null C-strings to null UStrings is inefficient
+ (cmompared to just using UString::null()), incompatible with WebCore::StringImpl's
+ behaviour, and may generate unexpected behaviour, since in many cases a null
+ UString can be used like an empty string.
+
+ With these changes UStringImpl need not have a concept of null impls, we can
+ start transitioning this to become an implementation detail of UString, that
+ internally it chooses to use a null-object rather than an actually zero impl
+ pointer.
+
+ * JavaScriptCore.exp:
+ * debugger/Debugger.cpp:
+ (JSC::Debugger::recompileAllJSFunctions):
+ * debugger/DebuggerCallFrame.cpp:
+ (JSC::DebuggerCallFrame::calculatedFunctionName):
+ * parser/Parser.cpp:
+ (JSC::Parser::parse):
+ * profiler/Profile.cpp:
+ (JSC::Profile::Profile):
+ * profiler/ProfileGenerator.cpp:
+ (JSC::ProfileGenerator::stopProfiling):
+ * runtime/Error.cpp:
+ (JSC::Error::create):
+ (JSC::throwError):
+ * runtime/ExceptionHelpers.cpp:
+ (JSC::createError):
+ * runtime/Identifier.cpp:
+ (JSC::Identifier::add):
+ * runtime/PropertyNameArray.cpp:
+ (JSC::PropertyNameArray::add):
+ * runtime/UString.cpp:
+ (JSC::initializeUString):
+ (JSC::UString::UString):
+ (JSC::UString::operator=):
+ * runtime/UString.h:
+ (JSC::UString::isNull):
+ (JSC::UString::null):
+ (JSC::UString::rep):
+ (JSC::UString::UString):
+ * runtime/UStringImpl.cpp:
+ (JSC::UStringImpl::create):
+ * runtime/UStringImpl.h:
+
+2010-02-05 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Eric Seidel.
+
+ [BREWMP] Define SYSTEM_MALLOC 1
+ https://bugs.webkit.org/show_bug.cgi?id=34640
+
+ Make BREWMP use system malloc because FastMalloc is not ported.
+
+ * wtf/Platform.h:
+
+2010-02-05 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Don't call CRASH() in fastMalloc and fastCalloc when the requested memory size is 0
+ https://bugs.webkit.org/show_bug.cgi?id=34569
+
+ With USE_SYSTEM_MALLOC=1, fastMalloc and fastCalloc call CRASH()
+ if the return value of malloc and calloc is 0.
+
+ However, these functions can return 0 when the request size is 0.
+ Libc manual says, "If size is 0, then malloc() returns either NULL,
+ or a unique pointer value that can later be successfully passed to free()."
+ Though malloc returns a unique pointer in most systems,
+ 0 can be returned in some systems. For instance, BREW's MALLOC returns 0
+ when size is 0.
+
+ If malloc or calloc returns 0 due to allocation size, increase the size
+ to 1 and try again.
+
+ * wtf/FastMalloc.cpp:
+ (WTF::fastMalloc):
+ (WTF::fastCalloc):
+
+2010-02-04 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Timothy Hatcher.
+
+ Build fix. Remove a symbol corresponding to an inline function from the linker export
+ file to prevent a weak external failure.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj: Accommodate rename of script.
+
+2010-02-04 Daniel Bates <dbates@webkit.org>
+
+ [Qt] Unreviewed, build fix for Qt bot.
+
+ * runtime/JSStringBuilder.h: Changed #include <X.h> notation #include "X.h".
+
+2010-02-04 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Clearing a WeakGCPtr is weird
+ https://bugs.webkit.org/show_bug.cgi?id=34627
+
+ Added a WeakGCPtr::clear interface.
+
+ As discussed in https://bugs.webkit.org/show_bug.cgi?id=33383, the old
+ interface made it pretty weird for a client to conditionally clear a
+ WeakGCPtr, which is exactly what clients want to do when objects are
+ finalized.
+
+ * API/JSClassRef.cpp:
+ (clearReferenceToPrototype): Use the new WeakGCPtr::clear() interface.
+
+ * runtime/WeakGCPtr.h:
+ (JSC::WeakGCPtr::clear): Added an interface for clearing a WeakGCPtr,
+ iff its current value is the value passed in. It's cumbersome for the
+ client to do this test, since WeakGCPtr sometimes pretends to be null.
+
+2010-02-04 Geoffrey Garen <ggaren@apple.com>
+
+ Build fix: export a header.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2010-02-04 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Add a JSStringBuilder class (similar-to, and derived-from StringBuilder) to
+ construct JSStrings, throwing a JS exception should we run out of memory whilst
+ allocating storage for the string.
+
+ Similarly, add jsMakeNontrivialString methods to use in cases where previously
+ we were calling makeString & passing the result to jsNontrivialString. Again,
+ these new methods throw if we hit an out of memory condition.
+
+ Move throwOutOfMemoryError into ExceptionHelpers, to make it more widely available.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * runtime/ArrayPrototype.cpp:
+ (JSC::arrayProtoFuncToString):
+ (JSC::arrayProtoFuncToLocaleString):
+ (JSC::arrayProtoFuncJoin):
+ * runtime/DateConstructor.cpp:
+ (JSC::callDate):
+ * runtime/DatePrototype.cpp:
+ (JSC::dateProtoFuncToString):
+ (JSC::dateProtoFuncToUTCString):
+ (JSC::dateProtoFuncToGMTString):
+ * runtime/ErrorPrototype.cpp:
+ (JSC::errorProtoFuncToString):
+ * runtime/ExceptionHelpers.cpp:
+ (JSC::throwOutOfMemoryError):
+ * runtime/ExceptionHelpers.h:
+ * runtime/JSStringBuilder.h: Added.
+ (JSC::JSStringBuilder::releaseJSString):
+ (JSC::jsMakeNontrivialString):
+ * runtime/NumberPrototype.cpp:
+ (JSC::numberProtoFuncToPrecision):
+ * runtime/ObjectPrototype.cpp:
+ (JSC::objectProtoFuncToString):
+ * runtime/Operations.cpp:
+ * runtime/Operations.h:
+ * runtime/RegExpPrototype.cpp:
+ (JSC::regExpProtoFuncToString):
+ * runtime/StringBuilder.h:
+ (JSC::StringBuilder::append):
+ * runtime/StringPrototype.cpp:
+ (JSC::stringProtoFuncBig):
+ (JSC::stringProtoFuncSmall):
+ (JSC::stringProtoFuncBlink):
+ (JSC::stringProtoFuncBold):
+ (JSC::stringProtoFuncFixed):
+ (JSC::stringProtoFuncItalics):
+ (JSC::stringProtoFuncStrike):
+ (JSC::stringProtoFuncSub):
+ (JSC::stringProtoFuncSup):
+ (JSC::stringProtoFuncFontcolor):
+ (JSC::stringProtoFuncFontsize):
+ (JSC::stringProtoFuncAnchor):
+
+2010-02-04 Steve Falkenburg <sfalken@apple.com>
+
+ Windows build fix.
+
+ * wtf/MathExtras.h:
+
+2010-02-04 Darin Adler <darin@apple.com>
+
+ Reviewed by David Levin.
+
+ Make MathExtras.h compatible with <cmath>
+ https://bugs.webkit.org/show_bug.cgi?id=34618
+
+ * wtf/MathExtras.h: Include <cmath> instead of <math.h>.
+ Use "using" as we do elsewhere in WTF for the four functions from <cmath>
+ we want to use without the prefix. Later we could consider making the std
+ explicit at call sites instead.
+
+2010-02-04 Tamas Szirbucz <szirbucz@inf.u-szeged.hu>
+
+ Reviewed by Gavin Barraclough.
+
+ Use an easily appendable structure for trampolines instead of pointer parameters.
+ https://bugs.webkit.org/show_bug.cgi?id=34424
+
+ * assembler/ARMAssembler.cpp:
+ (JSC::ARMAssembler::executableCopy):
+ * jit/JIT.h:
+ (JSC::JIT::compileCTIMachineTrampolines):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ * jit/JITStubs.cpp:
+ (JSC::JITThunks::JITThunks):
+ * jit/JITStubs.h:
+ (JSC::JITThunks::ctiStringLengthTrampoline):
+ (JSC::JITThunks::ctiVirtualCallLink):
+ (JSC::JITThunks::ctiVirtualCall):
+ (JSC::JITThunks::ctiNativeCallThunk):
+
+2010-02-04 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Increase test coverage for the QScriptValue.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34533
+
+ * qt/tests/qscriptvalue/qscriptvalue.pro:
+ * qt/tests/qscriptvalue/tst_qscriptvalue.cpp:
+ (tst_QScriptValue::tst_QScriptValue):
+ (tst_QScriptValue::~tst_QScriptValue):
+ (tst_QScriptValue::dataHelper):
+ (tst_QScriptValue::newRow):
+ (tst_QScriptValue::testHelper):
+ (tst_QScriptValue::ctor):
+ * qt/tests/qscriptvalue/tst_qscriptvalue.h: Added.
+ * qt/tests/qscriptvalue/tst_qscriptvalue_generated.cpp: Added.
+ (tst_QScriptValue::initScriptValues):
+ (tst_QScriptValue::isValid_initData):
+ (tst_QScriptValue::isValid_makeData):
+ (tst_QScriptValue::isValid_test):
+ (tst_QScriptValue::isBool_initData):
+ (tst_QScriptValue::isBool_makeData):
+ (tst_QScriptValue::isBool_test):
+ (tst_QScriptValue::isBoolean_initData):
+ (tst_QScriptValue::isBoolean_makeData):
+ (tst_QScriptValue::isBoolean_test):
+ (tst_QScriptValue::isFunction_initData):
+ (tst_QScriptValue::isFunction_makeData):
+ (tst_QScriptValue::isFunction_test):
+ (tst_QScriptValue::isNull_initData):
+ (tst_QScriptValue::isNull_makeData):
+ (tst_QScriptValue::isNull_test):
+ (tst_QScriptValue::isString_initData):
+ (tst_QScriptValue::isString_makeData):
+ (tst_QScriptValue::isString_test):
+ (tst_QScriptValue::isUndefined_initData):
+ (tst_QScriptValue::isUndefined_makeData):
+ (tst_QScriptValue::isUndefined_test):
+ (tst_QScriptValue::isObject_initData):
+ (tst_QScriptValue::isObject_makeData):
+ (tst_QScriptValue::isObject_test):
+
+2010-02-03 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Eric Seidel.
+
+ [BREWMP] Define WTF_PLATFORM_BREWMP_SIMULATOR when AEE_SIMULATOR is defined
+ https://bugs.webkit.org/show_bug.cgi?id=34514
+
+ PLATFORM(BREWMP_SIMULATOR) guard is needed to make distinction between BREWMP
+ and BREWMP simulator.
+
+ * wtf/Platform.h:
+
+2010-02-03 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Eric Seidel.
+
+ [BREWMP] Remove COMPILE_ASSERT conflict with the underlying PLATFORM
+ https://bugs.webkit.org/show_bug.cgi?id=34190
+
+ COMPILE_ASSERT conflicts with the underlying PLATFORM because it is defined
+ both in WTF's Assertions.h and BREWMP's AEEClassIDs.h. Include AEEClassIDs.h
+ in Assertions.h and undef COMPILE_ASSERT to avoid redefining COMPILE_ASSERT.
+
+ * wtf/Assertions.h:
+
+2010-02-03 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Eric Seidel.
+
+ [BREWMP] Implement OwnPtrBrew to make sure BREW instances are freed.
+ https://bugs.webkit.org/show_bug.cgi?id=34518
+
+ Add OwnPtrBrew to release IFile, IFileMgr and IBitmap instances.
+
+ * wtf/brew/OwnPtrBrew.cpp: Added.
+ (WTF::IFileMgr):
+ (WTF::IFile):
+ (WTF::IBitmap):
+ (WTF::freeOwnedPtrBrew):
+ * wtf/brew/OwnPtrBrew.h: Added.
+ (WTF::OwnPtrBrew::OwnPtrBrew):
+ (WTF::OwnPtrBrew::~OwnPtrBrew):
+ (WTF::OwnPtrBrew::get):
+ (WTF::OwnPtrBrew::release):
+ (WTF::OwnPtrBrew::outPtr):
+ (WTF::OwnPtrBrew::set):
+ (WTF::OwnPtrBrew::clear):
+ (WTF::OwnPtrBrew::operator*):
+ (WTF::OwnPtrBrew::operator->):
+ (WTF::OwnPtrBrew::operator!):
+ (WTF::OwnPtrBrew::operator UnspecifiedBoolType):
+ (WTF::OwnPtrBrew::swap):
+ (WTF::swap):
+ (WTF::operator==):
+ (WTF::operator!=):
+ (WTF::getPtr):
+
+2010-02-03 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Darin Adler.
+
+ Export WTF::fastStrDup symbol
+ https://bugs.webkit.org/show_bug.cgi?id=34526
+
+ * JavaScriptCore.exp:
+
+2010-02-03 Kevin Watters <kevinwatters@gmail.com>
+
+ Reviewed by Kevin Ollivier.
+
+ [wx] Enable JIT compilation for wx.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34536
+
+ * wtf/Platform.h:
+
+2010-02-02 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Crash in CollectorBitmap::get at nbcolympics.com
+ https://bugs.webkit.org/show_bug.cgi?id=34504
+
+ This was caused by the use of m_offset to determine the offset of
+ a new property into the property storage. This patch corrects
+ the effected cases by incorporating the anonymous slot count. It
+ also removes the duplicate copy of anonymous slot count from the
+ property table as keeping this up to date merely increased the
+ chance of a mismatch. Finally I've added a large number of
+ assertions in an attempt to prevent such a bug from happening
+ again.
+
+ With the new assertions in place the existing anonymous slot tests
+ all fail without the m_offset fixes.
+
+ * runtime/PropertyMapHashTable.h:
+ * runtime/Structure.cpp:
+ (JSC::Structure::materializePropertyMap):
+ (JSC::Structure::addPropertyTransitionToExistingStructure):
+ (JSC::Structure::addPropertyTransition):
+ (JSC::Structure::removePropertyTransition):
+ (JSC::Structure::flattenDictionaryStructure):
+ (JSC::Structure::addPropertyWithoutTransition):
+ (JSC::Structure::removePropertyWithoutTransition):
+ (JSC::Structure::copyPropertyTable):
+ (JSC::Structure::get):
+ (JSC::Structure::put):
+ (JSC::Structure::remove):
+ (JSC::Structure::insertIntoPropertyMapHashTable):
+ (JSC::Structure::createPropertyMapHashTable):
+ (JSC::Structure::rehashPropertyMapHashTable):
+ (JSC::Structure::checkConsistency):
+
+2010-02-02 Steve Falkenburg <sfalken@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Copyright year updating for Windows version resources should be automatic
+ https://bugs.webkit.org/show_bug.cgi?id=34503
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.rc:
+
+2010-02-02 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Eric Seidel.
+
+ [BREWMP] Add dummy main thread functions
+ https://bugs.webkit.org/show_bug.cgi?id=33569
+
+ Add dummy initializeMainThreadPlatform and
+ scheduleDispatchFunctionsOnMainThread.
+
+ * wtf/brew/MainThreadBrew.cpp: Added.
+ (WTF::initializeMainThreadPlatform):
+ (WTF::scheduleDispatchFunctionsOnMainThread):
+
+2010-02-02 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Darin Adler.
+
+ Add using WTF::getLocalTime to CurrentTime.h
+ https://bugs.webkit.org/show_bug.cgi?id=34493
+
+ * wtf/CurrentTime.h:
+
+2010-02-02 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Eric Seidel.
+
+ [BREWMP] Add HAVE_XXX definitions
+ https://bugs.webkit.org/show_bug.cgi?id=34414
+
+ Add HAVE_ERRNO_H=1
+
+ * wtf/Platform.h:
+
+2010-02-02 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Eric Seidel.
+
+ [BREWMP] Don't define HAVE_TM_GMTOFF, HAVE_TM_ZONE and HAVE_TIMEGM
+ https://bugs.webkit.org/show_bug.cgi?id=34388
+
+ BREWMP does not have these features.
+
+ * wtf/Platform.h:
+
+2010-02-02 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Eric Seidel.
+
+ [BREWMP] Define WTF_PLATFORM_BREWMP=1 when BUILDING_BREWMP is defined
+ https://bugs.webkit.org/show_bug.cgi?id=34386
+
+ Define WTF_PLATFORM_BREWMP=1 so that PLATFORM(BREWMP) guard can be used.
+
+ * wtf/Platform.h:
+
+2010-02-01 Kent Tamura <tkent@chromium.org>
+
+ Reviewed by Darin Adler.
+
+ Date.UTC() should apply TimeClip operation.
+ https://bugs.webkit.org/show_bug.cgi?id=34461
+
+ ECMAScript 5 15.9.4.3:
+ > 9 Return TimeClip(MakeDate(MakeDay(yr, m, dt), MakeTime(h, min, s, milli))).
+
+ * runtime/DateConstructor.cpp:
+ (JSC::dateUTC): Calls WTF::timeClip().
+
+2010-02-01 Kent Tamura <tkent@chromium.org>
+
+ Reviewed by Darin Adler.
+
+ Fix a bug that Math.round() retunrs incorrect results for huge integers
+ https://bugs.webkit.org/show_bug.cgi?id=34462
+
+ * runtime/MathObject.cpp:
+ (JSC::mathProtoFuncRound): Avoid "arg + 0.5".
+
+2010-02-01 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Eric Seidel.
+
+ [BREWMP] Port WTF's currentTime
+ https://bugs.webkit.org/show_bug.cgi?id=33567
+
+ Combine GETUTCSECONDS and GETTIMEMS to calculate the number
+ of milliseconds since 1970/01/01 00:00:00 UTC.
+
+ * wtf/CurrentTime.cpp:
+ (WTF::currentTime):
+
+2010-02-01 Patrick Gansterer <paroga@paroga.com>
+
+ Reviewed by Darin Adler.
+
+ [Qt] WinCE buildfix after r52729 and fix for Q_BIG_ENDIAN typo.
+ https://bugs.webkit.org/show_bug.cgi?id=34378
+
+ * wtf/Platform.h:
+
+2010-02-01 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Structure not accounting for anonymous slots when computing property storage size
+ https://bugs.webkit.org/show_bug.cgi?id=34441
+
+ Previously any Structure with anonymous storage would have a property map, so we
+ were only including anonymous slot size if there was a property map. Given this
+ is no longer the case we should always include the anonymous slot count in the
+ property storage size.
+
+ * runtime/Structure.h:
+ (JSC::Structure::propertyStorageSize):
+
+2010-02-01 Oliver Hunt <oliver@apple.com>
+
+ Windows build fix, update exports file (again)
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-02-01 Oliver Hunt <oliver@apple.com>
+
+ Windows build fix, update exports file
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-01-31 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ JSC is failing to propagate anonymous slot count on some transitions
+ https://bugs.webkit.org/show_bug.cgi?id=34321
+
+ Remove secondary Structure constructor, and make Structure store a copy
+ of the number of anonymous slots directly so saving an immediate allocation
+ of a property map for all structures with anonymous storage, which also
+ avoids the leaked property map on new property transition in the original
+ version of this patch.
+
+ We need to propagate the the anonymous slot count otherwise we can end up
+ with a structure recording incorrect information about the available and
+ needed space for property storage, or alternatively incorrectly reusing
+ some slots.
+
+ * JavaScriptCore.exp:
+ * runtime/Structure.cpp:
+ (JSC::Structure::Structure):
+ (JSC::Structure::materializePropertyMap):
+ (JSC::Structure::addPropertyTransition):
+ (JSC::Structure::changePrototypeTransition):
+ (JSC::Structure::despecifyFunctionTransition):
+ (JSC::Structure::getterSetterTransition):
+ (JSC::Structure::toDictionaryTransition):
+ (JSC::Structure::flattenDictionaryStructure):
+ (JSC::Structure::copyPropertyTable):
+ (JSC::Structure::put):
+ (JSC::Structure::remove):
+ (JSC::Structure::insertIntoPropertyMapHashTable):
+ (JSC::Structure::createPropertyMapHashTable):
+ * runtime/Structure.h:
+ (JSC::Structure::create):
+ (JSC::Structure::hasAnonymousSlots):
+ (JSC::Structure::anonymousSlotCount):
+
+2010-01-31 Patrick Gansterer <paroga@paroga.com>
+
+ Reviewed by Darin Adler.
+
+ Buildfix for WinCE + style fixes (TLS_OUT_OF_INDEXES is not defined).
+ https://bugs.webkit.org/show_bug.cgi?id=34380
+
+ * wtf/ThreadSpecific.h:
+
+2010-01-31 Kent Tamura <tkent@chromium.org>
+
+ Reviewed by Darin Adler.
+
+ [Windows] Fix a bug of round() with huge integral numbers
+ https://bugs.webkit.org/show_bug.cgi?id=34297
+
+ Fix a bug that round() for huge integral numbers returns incorrect
+ results. For example, round(8639999913600001) returns
+ 8639999913600002 without this change though the double type can
+ represent 8639999913600001 precisely.
+
+ Math.round() of JavaScript has a similar problem. But this change
+ doesn't fix it because Math.round() doesn't use round() of
+ MathExtra.h.
+
+ * wtf/MathExtras.h:
+ (round): Avoid to do "num + 0.5" or "num - 0.5".
+ (roundf): Fixed similarly.
+ (llround): Calls round().
+ (llroundf): Calls roundf().
+ (lround): Calls round().
+ (lroundf): Calls roundf().
+
+2010-01-29 Mark Rowe <mrowe@apple.com>
+
+ Sort Xcode projects.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2010-01-29 Mark Rowe <mrowe@apple.com>
+
+ Fix the Mac build.
+
+ Disable ENABLE_INDEXED_DATABASE since it is "completely non-functional".
+
+ As the comment in FeatureDefines.xcconfig notes, the list of feature defines
+ needs to be kept in sync across the various files. The default values also
+ need to be kept in sync between these files and build-webkit.
+
+ * Configurations/FeatureDefines.xcconfig:
+
+2010-01-29 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Rubber-stamped by Maciej Stachowiak.
+
+ Fix the ARM build.
+
+ * runtime/JSNumberCell.h:
+ (JSC::JSNumberCell::createStructure): Call the right Structure::create overload.
+
+2010-01-28 Kevin Ollivier <kevino@theolliviers.com>
+
+ [wx] Build fix for MSW, use ThreadingWin.cpp as the Windows pthreads implementation
+ implements pthread_t in a way that makes it impossible to check its validity,
+ which is needed by ThreadingPthreads.cpp.
+
+ * wscript:
+
+2010-01-28 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ DOM Objects shouldn't all require custom mark functions
+ https://bugs.webkit.org/show_bug.cgi?id=34291
+
+ Make getAnonymousValue const-friendly
+
+ * runtime/JSObject.h:
+ (JSC::JSObject::getAnonymousValue):
+
+2010-01-28 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Simplify anonymous slot implementation
+ https://bugs.webkit.org/show_bug.cgi?id=34282
+
+ A class must now specify the number of slots it needs at construction time
+ rather than later on with a transition. This makes many things simpler,
+ we no longer need to need an additional transition on object creation to
+ add the anonymous slots, and we remove the need for a number of transition
+ type checks.
+
+ * API/JSCallbackConstructor.h:
+ (JSC::JSCallbackConstructor::createStructure):
+ * API/JSCallbackFunction.h:
+ (JSC::JSCallbackFunction::createStructure):
+ * API/JSCallbackObject.h:
+ (JSC::JSCallbackObject::createStructure):
+ * JavaScriptCore.exp:
+ * debugger/DebuggerActivation.h:
+ (JSC::DebuggerActivation::createStructure):
+ * runtime/Arguments.h:
+ (JSC::Arguments::createStructure):
+ * runtime/BooleanObject.h:
+ (JSC::BooleanObject::createStructure):
+ * runtime/DateInstance.h:
+ (JSC::DateInstance::createStructure):
+ * runtime/DatePrototype.h:
+ (JSC::DatePrototype::createStructure):
+ * runtime/FunctionPrototype.h:
+ (JSC::FunctionPrototype::createStructure):
+ * runtime/GetterSetter.h:
+ (JSC::GetterSetter::createStructure):
+ * runtime/GlobalEvalFunction.h:
+ (JSC::GlobalEvalFunction::createStructure):
+ * runtime/InternalFunction.h:
+ (JSC::InternalFunction::createStructure):
+ * runtime/JSAPIValueWrapper.h:
+ (JSC::JSAPIValueWrapper::createStructure):
+ * runtime/JSActivation.h:
+ (JSC::JSActivation::createStructure):
+ * runtime/JSArray.h:
+ (JSC::JSArray::createStructure):
+ * runtime/JSByteArray.cpp:
+ (JSC::JSByteArray::createStructure):
+ * runtime/JSCell.h:
+ (JSC::JSCell::createDummyStructure):
+ * runtime/JSFunction.h:
+ (JSC::JSFunction::createStructure):
+ * runtime/JSGlobalObject.h:
+ (JSC::JSGlobalObject::createStructure):
+ * runtime/JSNotAnObject.h:
+ (JSC::JSNotAnObject::createStructure):
+ * runtime/JSONObject.h:
+ (JSC::JSONObject::createStructure):
+ * runtime/JSObject.h:
+ (JSC::JSObject::createStructure):
+ (JSC::JSObject::putAnonymousValue):
+ (JSC::JSObject::getAnonymousValue):
+ * runtime/JSPropertyNameIterator.h:
+ (JSC::JSPropertyNameIterator::createStructure):
+ * runtime/JSStaticScopeObject.h:
+ (JSC::JSStaticScopeObject::createStructure):
+ * runtime/JSString.h:
+ (JSC::Fiber::createStructure):
+ * runtime/JSVariableObject.h:
+ (JSC::JSVariableObject::createStructure):
+ * runtime/JSWrapperObject.h:
+ (JSC::JSWrapperObject::createStructure):
+ (JSC::JSWrapperObject::JSWrapperObject):
+ * runtime/MathObject.h:
+ (JSC::MathObject::createStructure):
+ * runtime/NumberConstructor.h:
+ (JSC::NumberConstructor::createStructure):
+ * runtime/NumberObject.h:
+ (JSC::NumberObject::createStructure):
+ * runtime/RegExpConstructor.h:
+ (JSC::RegExpConstructor::createStructure):
+ * runtime/RegExpObject.h:
+ (JSC::RegExpObject::createStructure):
+ * runtime/StringObject.h:
+ (JSC::StringObject::createStructure):
+ * runtime/StringObjectThatMasqueradesAsUndefined.h:
+ (JSC::StringObjectThatMasqueradesAsUndefined::createStructure):
+ * runtime/Structure.cpp:
+ (JSC::Structure::~Structure):
+ (JSC::Structure::materializePropertyMap):
+ * runtime/Structure.h:
+ (JSC::Structure::create):
+ (JSC::Structure::anonymousSlotCount):
+ * runtime/StructureTransitionTable.h:
+
+2010-01-27 Oliver Hunt <oliver@apple.com>
+
+ Windows build fix.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-01-27 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ MessageEvent.data should deserialize in the context of the MessageEvent's global object
+ https://bugs.webkit.org/show_bug.cgi?id=34227
+
+ Add logic to allow us to create an Object, Array, or Date instance
+ so we can create them in the context of a specific global object,
+ rather than just using the current lexical global object.
+
+ * JavaScriptCore.exp:
+ * runtime/DateInstance.cpp:
+ (JSC::DateInstance::DateInstance):
+ * runtime/DateInstance.h:
+ * runtime/JSGlobalObject.h:
+ (JSC::constructEmptyObject):
+ (JSC::constructEmptyArray):
+
+2010-01-27 Alexey Proskuryakov <ap@apple.com>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34150
+ WebKit needs a mechanism to catch stale HashMap entries
+
+ It is very difficult to catch stale pointers that are HashMap keys - since a pointer's hash
+ is just its value, it is very unlikely that any observable problem is reproducible.
+
+ This extends hash table consistency checks to check that pointers are referencing allocated
+ memory blocks, and makes it possible to invoke the checks explicitly (it is not feasible
+ to enable CHECK_HASHTABLE_CONSISTENCY by default, because that affects performance too much).
+
+ * wtf/HashMap.h: (WTF::::checkConsistency): Call through to HashTable implementation. We can
+ add similar calls to HashSet and HashCountedSet, but I haven't seen hard to debug problems
+ with those yet.
+
+ * wtf/HashSet.h: (WTF::::remove): The version of checkTableConsistency that's guarded by
+ CHECK_HASHTABLE_CONSISTENCY is now called internalCheckTableConsistency().
+
+ * wtf/HashTable.h:
+ (WTF::HashTable::internalCheckTableConsistency):
+ (WTF::HashTable::internalCheckTableConsistencyExceptSize):
+ (WTF::HashTable::checkTableConsistencyExceptSize):
+ Expose checkTableConsistency() even if CHECK_HASHTABLE_CONSISTENCY is off.
+ (WTF::::add): Updated for checkTableConsistency renaming.
+ (WTF::::addPassingHashCode): Ditto.
+ (WTF::::removeAndInvalidate): Ditto.
+ (WTF::::remove): Ditto.
+ (WTF::::rehash): Ditto.
+ (WTF::::checkTableConsistency): The assertion for !shouldExpand() was not correct - this
+ function returns true for tables with m_table == 0.
+ (WTF::::checkTableConsistencyExceptSize): Call checkValueConsistency for key. Potentially,
+ we could do the same for values.
+
+ * wtf/HashTraits.h:
+ (WTF::GenericHashTraits::checkValueConsistency): An empty function that can be overridden
+ to add checks. Currently, the only override is for pointer hashes.
+
+ * wtf/RefPtrHashMap.h: (WTF::::remove): Updated for checkTableConsistency renaming.
+
+2010-01-27 Anton Muhin <antonm@chromium.org>
+
+ Reviewed by Darin Adler.
+
+ Remove trailing \ from inline function code
+ https://bugs.webkit.org/show_bug.cgi?id=34223
+
+ * assembler/ARMv7Assembler.h:
+ (JSC::ARMThumbImmediate::countLeadingZerosPartial):
+
+2010-01-27 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Eric Seidel.
+
+ [BREWMP] Port WTF's randomNumber
+ https://bugs.webkit.org/show_bug.cgi?id=33566
+
+ Use GETRAND to generate 4 byte random byte sequence to implement
+ weakRandomNumber. Create a secure random number generator with
+ AEECLSID_RANDOM to implement randomNumber.
+
+ * wtf/RandomNumber.cpp:
+ (WTF::weakRandomNumber):
+ (WTF::randomNumber):
+
+2010-01-27 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Eric Seidel.
+
+ [BREWMP] Port getCPUTime
+ https://bugs.webkit.org/show_bug.cgi?id=33572
+
+ Use GETUPTIMEMS which returns a continuously and
+ linearly increasing millisecond timer from the time the device
+ was powered on. This function is enough to implement getCPUTime.
+
+ * runtime/TimeoutChecker.cpp:
+ (JSC::getCPUTime):
+
+2010-01-27 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Oliver Hunt.
+
+ [BREWMP] Add MarkStack fastMalloc implementation for platforms without VirtualAlloc or mmap.
+ https://bugs.webkit.org/show_bug.cgi?id=33582
+
+ Use fastMalloc and fastFree to implement MarkStack::allocateStack and
+ MarkStack::releaseStack for platforms without page level allocation.
+
+ * runtime/MarkStack.h:
+ (JSC::MarkStack::MarkStackArray::shrinkAllocation):
+ * runtime/MarkStackNone.cpp: Added.
+ (JSC::MarkStack::initializePagesize):
+ (JSC::MarkStack::allocateStack):
+ (JSC::MarkStack::releaseStack):
+
+2010-01-27 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Eric Seidel.
+
+ [BREWMP] Don't use time function
+ https://bugs.webkit.org/show_bug.cgi?id=33577
+
+ Calling time(0) in BREW devices causes a crash because time
+ is not properly ported in most devices. Cast currentTime() to
+ time_t to get the same result as time(0).
+
+ * wtf/DateMath.cpp:
+ (WTF::calculateUTCOffset):
+
+2010-01-27 Alexey Proskuryakov <ap@apple.com>
+
+ Revert r53899 (HashMap<AtomicStringImpl*, Value> key checks) and subsequent build fixes,
+ because they make SVG tests crash in release builds.
+
+ * wtf/HashMap.h:
+ (WTF::::remove):
+ * wtf/HashSet.h:
+ (WTF::::remove):
+ * wtf/HashTable.h:
+ (WTF::::add):
+ (WTF::::addPassingHashCode):
+ (WTF::::removeAndInvalidate):
+ (WTF::::remove):
+ (WTF::::rehash):
+ (WTF::::checkTableConsistency):
+ (WTF::::checkTableConsistencyExceptSize):
+ * wtf/HashTraits.h:
+ (WTF::GenericHashTraits::emptyValue):
+ (WTF::):
+ * wtf/RefPtrHashMap.h:
+ (WTF::::remove):
+
+2010-01-26 Alexey Proskuryakov <ap@apple.com>
+
+ More Windows build fixing.
+
+ * wtf/HashTraits.h: _msize takes void*, remove const qualifier from type.
+
+2010-01-26 Alexey Proskuryakov <ap@apple.com>
+
+ Windows build fix.
+
+ * wtf/HashTraits.h: Include malloc.h for _msize().
+
+2010-01-26 Alexey Proskuryakov <ap@apple.com>
+
+ Build fix.
+
+ * wtf/HashTable.h: (WTF::HashTable::checkTableConsistencyExceptSize): Remove const from a
+ static (empty) version of this function.
+
+2010-01-26 Alexey Proskuryakov <ap@apple.com>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34150
+ WebKit needs a mechanism to catch stale HashMap entries
+
+ It is very difficult to catch stale pointers that are HashMap keys - since a pointer's hash
+ is just its value, it is very unlikely that any observable problem is reproducible.
+
+ This extends hash table consistency checks to check that pointers are referencing allocated
+ memory blocks, and makes it possible to invoke the checks explicitly (it is not feasible
+ to enable CHECK_HASHTABLE_CONSISTENCY by default, because that affects performance too much).
+
+ * wtf/HashMap.h: (WTF::::checkConsistency): Call through to HashTable implementation. We can
+ add similar calls to HashSet and HashCountedSet, but I haven't seen hard to debug problems
+ with those yet.
+
+ * wtf/HashSet.h: (WTF::::remove): The version of checkTableConsistency that's guarded by
+ CHECK_HASHTABLE_CONSISTENCY is now called internalCheckTableConsistency().
+
+ * wtf/HashTable.h:
+ (WTF::HashTable::internalCheckTableConsistency):
+ (WTF::HashTable::internalCheckTableConsistencyExceptSize):
+ (WTF::HashTable::checkTableConsistencyExceptSize):
+ Expose checkTableConsistency() even if CHECK_HASHTABLE_CONSISTENCY is off.
+ (WTF::::add): Updated for checkTableConsistency renaming.
+ (WTF::::addPassingHashCode): Ditto.
+ (WTF::::removeAndInvalidate): Ditto.
+ (WTF::::remove): Ditto.
+ (WTF::::rehash): Ditto.
+ (WTF::::checkTableConsistency): The assertion for !shouldExpand() was not correct - this
+ function returns true for tables with m_table == 0.
+ (WTF::::checkTableConsistencyExceptSize): Call checkValueConsistency for key. Potentially,
+ we could do the same for values.
+
+ * wtf/HashTraits.h:
+ (WTF::GenericHashTraits::checkValueConsistency): An empty function that can be overridden
+ to add checks. Currently, the only override is for pointer hashes.
+
+ * wtf/RefPtrHashMap.h: (WTF::::remove): Updated for checkTableConsistency renaming.
+
+2010-01-26 Lyon Chen <liachen@rim.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Opcode.h use const void* for Opcode cause error #1211 for RVCT compiler
+ https://bugs.webkit.org/show_bug.cgi?id=33902
+
+ * bytecode/Opcode.h:
+
+2010-01-26 Steve Falkenburg <sfalken@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Windows build references non-existent include paths
+ https://bugs.webkit.org/show_bug.cgi?id=34175
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops:
+ * JavaScriptCore.vcproj/WTF/WTFCommon.vsprops:
+ * JavaScriptCore.vcproj/jsc/jscCommon.vsprops:
+ * JavaScriptCore.vcproj/testapi/testapi.vcproj:
+ * JavaScriptCore.vcproj/testapi/testapiCommon.vsprops:
+
+2010-01-26 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Using JavaScriptCore API with a webkit vended context can result in slow script dialog
+ https://bugs.webkit.org/show_bug.cgi?id=34172
+
+ Make the APIShim correctly increment and decrement the timeout
+ entry counter.
+
+ * API/APIShims.h:
+ (JSC::APIEntryShimWithoutLock::APIEntryShimWithoutLock):
+ (JSC::APIEntryShimWithoutLock::~APIEntryShimWithoutLock):
+ (JSC::APICallbackShim::APICallbackShim):
+ (JSC::APICallbackShim::~APICallbackShim):
+
+2010-01-26 Simon Hausmann <simon.hausmann@nokia.com>
+
+ [Qt] Fix compilation of QtScript with non-gcc compilers
+
+ Variable length stack arrays are a gcc extension. Use QVarLengthArray
+ as a more portable solution that still tries to allocate on the stack
+ first.
+
+ * qt/api/qscriptvalue_p.h:
+ (QScriptValuePrivate::call):
+
+2010-01-26 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Reviewed by Tor Arne Vestbø.
+
+ [Qt] Fix the build on platforms without JIT support.
+
+ The JIT support should be determined at compile-time via wtf/Platform.h
+
+ * qt/api/QtScript.pro:
+
+2010-01-26 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ First steps of the QtScript API.
+
+ Two new classes were created; QScriptEngine and QScriptValue.
+ The first should encapsulate a javascript context and the second a script
+ value.
+
+ This API is still in development, so it isn't compiled by default.
+ To trigger compilation, pass --qmakearg="CONFIG+=build-qtscript" to
+ build-webkit.
+
+ https://bugs.webkit.org/show_bug.cgi?id=32565
+
+ * qt/api/QtScript.pro: Added.
+ * qt/api/qscriptconverter_p.h: Added.
+ (QScriptConverter::toString):
+ * qt/api/qscriptengine.cpp: Added.
+ (QScriptEngine::QScriptEngine):
+ (QScriptEngine::~QScriptEngine):
+ (QScriptEngine::evaluate):
+ (QScriptEngine::collectGarbage):
+ * qt/api/qscriptengine.h: Added.
+ * qt/api/qscriptengine_p.cpp: Added.
+ (QScriptEnginePrivate::QScriptEnginePrivate):
+ (QScriptEnginePrivate::~QScriptEnginePrivate):
+ (QScriptEnginePrivate::evaluate):
+ * qt/api/qscriptengine_p.h: Added.
+ (QScriptEnginePrivate::get):
+ (QScriptEnginePrivate::collectGarbage):
+ (QScriptEnginePrivate::makeJSValue):
+ (QScriptEnginePrivate::context):
+ * qt/api/qscriptvalue.cpp: Added.
+ (QScriptValue::QScriptValue):
+ (QScriptValue::~QScriptValue):
+ (QScriptValue::isValid):
+ (QScriptValue::isBool):
+ (QScriptValue::isBoolean):
+ (QScriptValue::isNumber):
+ (QScriptValue::isNull):
+ (QScriptValue::isString):
+ (QScriptValue::isUndefined):
+ (QScriptValue::isError):
+ (QScriptValue::isObject):
+ (QScriptValue::isFunction):
+ (QScriptValue::toString):
+ (QScriptValue::toNumber):
+ (QScriptValue::toBool):
+ (QScriptValue::toBoolean):
+ (QScriptValue::toInteger):
+ (QScriptValue::toInt32):
+ (QScriptValue::toUInt32):
+ (QScriptValue::toUInt16):
+ (QScriptValue::call):
+ (QScriptValue::engine):
+ (QScriptValue::operator=):
+ (QScriptValue::equals):
+ (QScriptValue::strictlyEquals):
+ * qt/api/qscriptvalue.h: Added.
+ (QScriptValue::):
+ * qt/api/qscriptvalue_p.h: Added.
+ (QScriptValuePrivate::):
+ (QScriptValuePrivate::get):
+ (QScriptValuePrivate::QScriptValuePrivate):
+ (QScriptValuePrivate::isValid):
+ (QScriptValuePrivate::isBool):
+ (QScriptValuePrivate::isNumber):
+ (QScriptValuePrivate::isNull):
+ (QScriptValuePrivate::isString):
+ (QScriptValuePrivate::isUndefined):
+ (QScriptValuePrivate::isError):
+ (QScriptValuePrivate::isObject):
+ (QScriptValuePrivate::isFunction):
+ (QScriptValuePrivate::toString):
+ (QScriptValuePrivate::toNumber):
+ (QScriptValuePrivate::toBool):
+ (QScriptValuePrivate::toInteger):
+ (QScriptValuePrivate::toInt32):
+ (QScriptValuePrivate::toUInt32):
+ (QScriptValuePrivate::toUInt16):
+ (QScriptValuePrivate::equals):
+ (QScriptValuePrivate::strictlyEquals):
+ (QScriptValuePrivate::assignEngine):
+ (QScriptValuePrivate::call):
+ (QScriptValuePrivate::engine):
+ (QScriptValuePrivate::context):
+ (QScriptValuePrivate::value):
+ (QScriptValuePrivate::object):
+ (QScriptValuePrivate::inherits):
+ (QScriptValuePrivate::isJSBased):
+ (QScriptValuePrivate::isNumberBased):
+ (QScriptValuePrivate::isStringBased):
+ * qt/api/qtscriptglobal.h: Added.
+ * qt/tests/qscriptengine/qscriptengine.pro: Added.
+ * qt/tests/qscriptengine/tst_qscriptengine.cpp: Added.
+ (tst_QScriptEngine::tst_QScriptEngine):
+ (tst_QScriptEngine::~tst_QScriptEngine):
+ (tst_QScriptEngine::init):
+ (tst_QScriptEngine::cleanup):
+ (tst_QScriptEngine::collectGarbage):
+ (tst_QScriptEngine::evaluate):
+ * qt/tests/qscriptvalue/qscriptvalue.pro: Added.
+ * qt/tests/qscriptvalue/tst_qscriptvalue.cpp: Added.
+ (tst_QScriptValue::tst_QScriptValue):
+ (tst_QScriptValue::~tst_QScriptValue):
+ (tst_QScriptValue::init):
+ (tst_QScriptValue::cleanup):
+ (tst_QScriptValue::ctor):
+ (tst_QScriptValue::toString_data):
+ (tst_QScriptValue::toString):
+ (tst_QScriptValue::copyConstructor_data):
+ (tst_QScriptValue::copyConstructor):
+ (tst_QScriptValue::assignOperator_data):
+ (tst_QScriptValue::assignOperator):
+ (tst_QScriptValue::dataSharing):
+ (tst_QScriptValue::constructors_data):
+ (tst_QScriptValue::constructors):
+ (tst_QScriptValue::call):
+ * qt/tests/tests.pri: Added.
+ * qt/tests/tests.pro: Added.
+
+2010-01-25 Dmitry Titov <dimich@chromium.org>
+
+ Reviewed by David Levin.
+
+ Fix Chromium Linux tests: the pthread functions on Linux produce segfault if they receive 0 thread handle.
+ After r53714, we can have 0 thread handles passed to pthread_join and pthread_detach if corresponding threads
+ were already terminated and their threadMap entries cleared.
+ Add a 0 check.
+
+ * wtf/ThreadingPthreads.cpp:
+ (WTF::waitForThreadCompletion):
+ (WTF::detachThread):
+
+2010-01-24 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Refactor JITStubs.cpp so that DEFINE_STUB_FUNCTION is only used once for each function
+ https://bugs.webkit.org/show_bug.cgi?id=33866
+
+ Place the guard USE(JSVALUE32_64) inside the body of the DEFINE_STUB_FUNCTION
+ macro for those functions that are always present.
+
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+
+2010-01-22 Kevin Watters <kevinwatters@gmail.com>
+
+ Reviewed by Kevin Ollivier.
+
+ [wx] Remove the Bakefile build system, which is no longer being used.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34022
+
+ * JavaScriptCoreSources.bkl: Removed.
+ * jscore.bkl: Removed.
+
+2010-01-22 Steve Falkenburg <sfalken@apple.com>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34025
+ Enable client-based Geolocation abstraction for Mac, Windows AppleWebKit targets.
+
+ * Configurations/FeatureDefines.xcconfig:
+
+2010-01-22 Dmitry Titov <dimich@chromium.org>
+
+ Not reviewed, attempted Snow Leopard build fix.
+
+ * wtf/ThreadingPthreads.cpp: Add a forward declaration of a function which is not 'static'.
+
+2009-01-22 Dmitry Titov <dimich@chromium.org>
+
+ Reviewed by Maciej Stachowiak.
+
+ Fix the leak of ThreadIdentifiers in threadMap across threads.
+ https://bugs.webkit.org/show_bug.cgi?id=32689
+
+ Test is added to DumpRenderTree.mm.
+
+ * Android.mk: Added file ThreadIdentifierDataPthreads.(h|cpp) to build.
+ * Android.v8.wtf.mk: Ditto.
+ * GNUmakefile.am: Ditto.
+ * JavaScriptCore.gyp/JavaScriptCore.gyp: Ditto.
+ * JavaScriptCore.gypi: Ditto.
+ * JavaScriptCore.xcodeproj/project.pbxproj: Ditto.
+
+ * wtf/ThreadIdentifierDataPthreads.cpp: Added. Contains custom implementation of thread-specific data that uses custom destructor.
+ (WTF::ThreadIdentifierData::~ThreadIdentifierData): Removes the ThreadIdentifier from the threadMap.
+ (WTF::ThreadIdentifierData::identifier):
+ (WTF::ThreadIdentifierData::initialize):
+ (WTF::ThreadIdentifierData::destruct): Custom thread-specific destructor. Resets the value for the key again to cause second invoke.
+ (WTF::ThreadIdentifierData::initializeKeyOnceHelper):
+ (WTF::ThreadIdentifierData::initializeKeyOnce): Need to use pthread_once since initialization may come on any thread(s).
+ * wtf/ThreadIdentifierDataPthreads.h: Added.
+ (WTF::ThreadIdentifierData::ThreadIdentifierData):
+
+ * wtf/Threading.cpp:
+ (WTF::threadEntryPoint): Move initializeCurrentThreadInternal to after the lock to make
+ sure it is invoked when ThreadIdentifier is already established.
+
+ * wtf/Threading.h: Rename setThreadNameInternal -> initializeCurrentThreadInternal since it does more then only set the name now.
+ * wtf/ThreadingNone.cpp:
+ (WTF::initializeCurrentThreadInternal): Ditto.
+ * wtf/ThreadingWin.cpp:
+ (WTF::initializeCurrentThreadInternal): Ditto.
+ (WTF::initializeThreading): Ditto.
+ * wtf/gtk/ThreadingGtk.cpp:
+ (WTF::initializeCurrentThreadInternal): Ditto.
+ * wtf/qt/ThreadingQt.cpp:
+ (WTF::initializeCurrentThreadInternal): Ditto.
+
+ * wtf/ThreadingPthreads.cpp:
+ (WTF::establishIdentifierForPthreadHandle):
+ (WTF::clearPthreadHandleForIdentifier): Make it not 'static' so the ~ThreadIdentifierData() in another file can call it.
+ (WTF::initializeCurrentThreadInternal): Set the thread-specific data. The ThreadIdentifier is already established by creating thread.
+ (WTF::waitForThreadCompletion): Remove call to clearPthreadHandleForIdentifier(threadID) since it is now done in ~ThreadIdentifierData().
+ (WTF::detachThread): Ditto.
+ (WTF::currentThread): Use the thread-specific data to get the ThreadIdentifier. It's many times faster then Mutex-protected iteration through the map.
+ Also, set the thread-specific data if called first time on the thread.
+
+2010-01-21 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Add ThreadSpecific for ENABLE(SINGLE_THREADED)
+ https://bugs.webkit.org/show_bug.cgi?id=33878
+
+ Implement ThreadSpecific with a simple getter/setter
+ when ENABLE(SINGLE_THREADED) is true.
+
+ Due to the change in https://bugs.webkit.org/show_bug.cgi?id=33236,
+ an implementation of ThreadSpecific must be available to build WebKit.
+ This causes a build failure for platforms without a proper
+ ThreadSpecific implementation.
+
+ * wtf/ThreadSpecific.h:
+ (WTF::::ThreadSpecific):
+ (WTF::::~ThreadSpecific):
+ (WTF::::get):
+ (WTF::::set):
+ (WTF::::destroy):
+
+2010-01-21 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Maciej Stachowiak.
+
+ Add fastStrDup to FastMalloc
+ https://bugs.webkit.org/show_bug.cgi?id=33937
+
+ The new string returned by fastStrDup is obtained with fastMalloc,
+ and can be freed with fastFree. This makes the memory management
+ more consistent because we don't need to keep strdup allocated pointers
+ and free them with free(). Instead we can use fastFree everywhere.
+
+ * wtf/FastMalloc.cpp:
+ (WTF::fastStrDup):
+ * wtf/FastMalloc.h:
+
+2010-01-21 Brady Eidson <beidson@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ history.back() for same-document history traversals isn't synchronous as the specification states.
+ <rdar://problem/7535011> and https://bugs.webkit.org/show_bug.cgi?id=33538
+
+ * wtf/Platform.h: Add a "HISTORY_ALWAYS_ASYNC" enable and turn it on for Chromium.
+
+2010-01-21 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Always create a prototype for automatically managed classes.
+
+ This fixes some errors where prototype chains were not correctly hooked
+ up, and also ensures that API classes work correctly with features like
+ instanceof.
+
+ * API/JSClassRef.cpp:
+ (OpaqueJSClass::create): Cleaned up some of this code. Also changed it
+ to always create a prototype class.
+
+ * API/tests/testapi.c:
+ (Derived2_class):
+ (main): Fixed a null value crash in the exception checking code.
+ * API/tests/testapi.js: Added some tests for the case where a prototype
+ chain would not be hooked up correctly.
+
+2010-01-21 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Force JSC to create a prototype chain for API classes with a
+ parent class but no static functions.
+
+ * API/JSClassRef.cpp:
+ (OpaqueJSClass::create):
+
+2010-01-21 Kent Hansen <kent.hansen@nokia.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Object.getOwnPropertyDescriptor always returns undefined for JS API objects
+ https://bugs.webkit.org/show_bug.cgi?id=33946
+
+ Ideally the getOwnPropertyDescriptor() reimplementation should return an
+ access descriptor that wraps the property getter and setter callbacks, but
+ that approach is much more involved than returning a value descriptor.
+ Keep it simple for now.
+
+ * API/JSCallbackObject.h:
+ * API/JSCallbackObjectFunctions.h:
+ (JSC::::getOwnPropertyDescriptor):
+ * API/tests/testapi.js:
+
+2010-01-20 Mark Rowe <mrowe@apple.com>
+
+ Build fix.
+
+ * wtf/FastMalloc.cpp:
+ (WTF::TCMalloc_PageHeap::initializeScavenger): Remove unnecessary function call.
+
+2010-01-20 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Use the inline i386 assembly for x86_64 as well rather than falling back to using pthread mutexes.
+
+ * wtf/TCSpinLock.h:
+ (TCMalloc_SpinLock::Lock):
+ (TCMalloc_SpinLock::Unlock):
+ (TCMalloc_SlowLock):
+
+2010-01-20 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ <rdar://problem/7215063> Use GCD instead of an extra thread for FastMalloc scavenging on platforms where it is supported
+
+ Abstract the background scavenging slightly so that an alternate implementation that uses GCD can be used on platforms
+ where it is supported.
+
+ * wtf/FastMalloc.cpp:
+ (WTF::TCMalloc_PageHeap::init):
+ (WTF::TCMalloc_PageHeap::initializeScavenger):
+ (WTF::TCMalloc_PageHeap::signalScavenger):
+ (WTF::TCMalloc_PageHeap::shouldContinueScavenging):
+ (WTF::TCMalloc_PageHeap::Delete):
+ (WTF::TCMalloc_PageHeap::periodicScavenge):
+ * wtf/Platform.h:
+
+2010-01-20 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ <rdar://problem/7562708> REGRESSION(53460): Heap::destroy may not run
+ all destructors
+
+ * runtime/Collector.cpp:
+ (JSC::Heap::freeBlocks): Instead of fully marking protected objects,
+ just set their mark bits. This prevents protected objects from keeping
+ unprotected objects alive. Destructor order is not guaranteed, so it's
+ OK to destroy objects pointed to by protected objects before destroying
+ protected objects.
+
+2010-01-19 David Levin <levin@chromium.org>
+
+ Reviewed by Oliver Hunt.
+
+ CrossThreadCopier needs to support ThreadSafeShared better.
+ https://bugs.webkit.org/show_bug.cgi?id=33698
+
+ * wtf/TypeTraits.cpp: Added tests for the new type traits.
+ * wtf/TypeTraits.h:
+ (WTF::IsSubclass): Determines if a class is a derived from another class.
+ (WTF::IsSubclassOfTemplate): Determines if a class is a derived from a
+ template class (with one parameter that is unknown).
+ (WTF::RemoveTemplate): Reveals the type for a template parameter.
+
+2010-01-20 Steve Falkenburg <sfalken@apple.com>
+
+ Reviewed by Darin Adler and Adam Roben.
+
+ Feature defines are difficult to maintain on Windows builds
+ https://bugs.webkit.org/show_bug.cgi?id=33883
+
+ FeatureDefines.vsprops are now maintained in a way similar to
+ Configurations/FeatureDefines.xcconfig, with the added advantage
+ of having a single FeatureDefines file across all projects.
+
+ * Configurations/FeatureDefines.xcconfig: Add comments about keeping feature definitions in sync.
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Add FeatureDefines.vsprops inherited property sheet.
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj: Add FeatureDefines.vsprops inherited property sheet.
+
+2010-01-20 Csaba Osztrogonác <ossy@webkit.org>
+
+ [Qt] Unreviewed buildfix for r53547.
+
+ * DerivedSources.pro:
+
+2010-01-20 Tor Arne Vestbø <tor.arne.vestbo@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Make extraCompilers for generated sources depend on their scripts
+
+ * DerivedSources.pro:
+
+2010-01-19 Brian Weinstein <bweinstein@apple.com>
+
+ Reviewed by Tim Hatcher.
+
+ When JavaScriptCore calls Debugger::Exception, have it pass a
+ hasHandler variable that represents if exception is being handled
+ in the same function (not in a parent on the call stack).
+
+ This just adds a new parameter, no behavior is changed.
+
+ * debugger/Debugger.h:
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::throwException):
+
+2010-01-18 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Adam Barth.
+
+ Inline functions that are hot in DOM manipulation
+ https://bugs.webkit.org/show_bug.cgi?id=33820
+
+ (3% speedup on Dromaeo DOM Core tests)
+
+ * runtime/WeakGCMap.h:
+ (JSC::::get): inline
+
+2010-01-19 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Unreviewed build fix for JIT with RVCT.
+
+ Remove IMPORT statement; cti_vm_throw is already defined in JITStubs.h.
+ Remove extra ')'.
+
+ * jit/JITStubs.cpp:
+ (JSC::ctiVMThrowTrampoline):
+
+2010-01-19 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ REGRESSION (52082): Crash on worker thread when reloading http://radnan.public.iastate.edu/procedural/
+ https://bugs.webkit.org/show_bug.cgi?id=33826
+
+ This bug was caused by a GC-protected object being destroyed early by
+ Heap::destroy. Clients of the GC protect APIs (reasonably) expect pointers
+ to GC-protected memory to be valid.
+
+ The solution is to do two passes of tear-down in Heap::destroy. The first
+ pass tears down all unprotected objects. The second pass ASSERTs that all
+ previously protected objects are now unprotected, and then tears down
+ all perviously protected objects. These two passes simulate the two passes
+ that would have been required to free a protected object during normal GC.
+
+ * API/JSContextRef.cpp: Removed some ASSERTs that have moved into Heap.
+
+ * runtime/Collector.cpp:
+ (JSC::Heap::destroy): Moved ASSERTs to here.
+ (JSC::Heap::freeBlock): Tidied up the use of didShrink by moving its
+ setter to the function that does the shrinking.
+ (JSC::Heap::freeBlocks): Implemented above algorithm.
+ (JSC::Heap::shrinkBlocks): Tidied up the use of didShrink.
+
+2010-01-19 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by NOBODY (build fix).
+
+ Reverting r53455, breaks 2 javascriptcore tests.
+
+ * API/JSContextRef.cpp:
+ * runtime/Collector.cpp:
+ (JSC::Heap::destroy):
+ (JSC::Heap::freeBlock):
+ (JSC::Heap::freeBlocks):
+ (JSC::Heap::shrinkBlocks):
+
+2010-01-18 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by NOBODY (build fix).
+
+ Revert r53454, since it causes much sadness in this world.
+
+ * runtime/UString.cpp:
+ (JSC::UString::spliceSubstringsWithSeparators):
+ (JSC::UString::replaceRange):
+ * runtime/UStringImpl.cpp:
+ (JSC::UStringImpl::baseSharedBuffer):
+ (JSC::UStringImpl::sharedBuffer):
+ (JSC::UStringImpl::~UStringImpl):
+ * runtime/UStringImpl.h:
+ (JSC::UntypedPtrAndBitfield::UntypedPtrAndBitfield):
+ (JSC::UntypedPtrAndBitfield::asPtr):
+ (JSC::UntypedPtrAndBitfield::operator&=):
+ (JSC::UntypedPtrAndBitfield::operator|=):
+ (JSC::UntypedPtrAndBitfield::operator&):
+ (JSC::UStringImpl::create):
+ (JSC::UStringImpl::cost):
+ (JSC::UStringImpl::isIdentifier):
+ (JSC::UStringImpl::setIsIdentifier):
+ (JSC::UStringImpl::ref):
+ (JSC::UStringImpl::deref):
+ (JSC::UStringImpl::checkConsistency):
+ (JSC::UStringImpl::UStringImpl):
+ (JSC::UStringImpl::bufferOwnerString):
+ (JSC::UStringImpl::bufferOwnership):
+ (JSC::UStringImpl::isStatic):
+ * wtf/StringHashFunctions.h:
+ (WTF::stringHash):
+
+2010-01-18 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ REGRESSION (52082): Crash on worker thread when reloading http://radnan.public.iastate.edu/procedural/
+ https://bugs.webkit.org/show_bug.cgi?id=33826
+
+ This bug was caused by a GC-protected object being destroyed early by
+ Heap::destroy. Clients of the GC protect APIs (reasonably) expect pointers
+ to GC-protected memory to be valid.
+
+ The solution is to do two passes of tear-down in Heap::destroy. The first
+ pass tears down all unprotected objects. The second pass ASSERTs that all
+ previously protected objects are now unprotected, and then tears down
+ all perviously protected objects. These two passes simulate the two passes
+ that would have been required to free a protected object during normal GC.
+
+ * API/JSContextRef.cpp: Removed some ASSERTs that have moved into Heap.
+
+ * runtime/Collector.cpp:
+ (JSC::Heap::destroy): Moved ASSERTs to here.
+ (JSC::Heap::freeBlock): Tidied up the use of didShrink by moving its
+ setter to the function that does the shrinking.
+ (JSC::Heap::freeBlocks): Implemented above algorithm.
+ (JSC::Heap::shrinkBlocks): Tidied up the use of didShrink.
+
+2010-01-18 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ https://bugs.webkit.org/show_bug.cgi?id=33731
+ Remove UntypedPtrAndBitfield from UStringImpl (akin to PtrAndFlags).
+
+ This break the OS X Leaks tool. Instead, free up some more bits from the refCount.
+
+ * runtime/UStringImpl.cpp:
+ (JSC::UStringImpl::sharedBuffer):
+ (JSC::UStringImpl::~UStringImpl):
+ * runtime/UStringImpl.h:
+ (JSC::UStringImpl::cost):
+ (JSC::UStringImpl::checkConsistency):
+ (JSC::UStringImpl::UStringImpl):
+ (JSC::UStringImpl::bufferOwnerString):
+ (JSC::UStringImpl::):
+ * wtf/StringHashFunctions.h:
+ (WTF::stringHash):
+
+2010-01-18 Kent Tamura <tkent@chromium.org>
+
+ Reviewed by Darin Adler.
+
+ HTMLInputElement::valueAsDate setter support for type=month.
+ https://bugs.webkit.org/show_bug.cgi?id=33021
+
+ Expose the following functions to be used by WebCore:
+ - WTF::msToyear()
+ - WTF::dayInYear()
+ - WTF::monthFromDayInYear()
+ - WTF::dayInMonthFromDayInYear()
+
+ * JavaScriptCore.exp:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * wtf/DateMath.cpp:
+ (WTF::msToYear): Remove "static inline".
+ (WTF::dayInYear): Remove "static inline".
+ (WTF::monthFromDayInYear): Remove "static inline".
+ (WTF::dayInMonthFromDayInYear): Remove "static inline".
+ * wtf/DateMath.h: Declare the above functions.
+
+2010-01-18 Darin Adler <darin@apple.com>
+
+ Fix build by reverting the previous change.
+
+ * runtime/UString.h: Rolled out the FastAllocBase base class.
+ It was making UString larger, and therefore JSString larger,
+ and too big for a garbage collection cell.
+
+ This raises the unpleasant possibility that many classes became
+ larger because we added the FastAllocBase base class. I am
+ worried about this, and it needs to be investigated.
+
+2010-01-18 Zoltan Horvath <zoltan@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ Allow custom memory allocation control for UString class
+ https://bugs.webkit.org/show_bug.cgi?id=27831
+
+ Inherits the following class from FastAllocBase because it is
+ instantiated by 'new' and no need to be copyable:
+
+ class name - instantiated at:
+ classs UString - JavaScriptCore/runtime/UString.cpp:160
+
+ * runtime/UString.h:
+
+2010-01-18 Evan Cheng <evan.cheng@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Add some ALWAYS_INLINE for key functions not inlined by some versions of GCC.
+ rdar://problem/7553780
+
+ * runtime/JSObject.h:
+ (JSC::JSObject::getPropertySlot): ALWAYS_INLINE both overloads.
+ * runtime/JSString.h:
+ (JSC::JSString::JSString): ALWAYS_INLINE the version that takes a UString.
+ * runtime/UString.h:
+ (JSC::operator==): ALWAYS_INLINE the version that compares two UString objects.
+
+2010-01-18 Csaba Osztrogonác <ossy@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ Delete dftables-xxxxxxxx.in files automatically.
+ https://bugs.webkit.org/show_bug.cgi?id=33796
+
+ * pcre/dftables: unlink unnecessary temporary file.
+
+2010-01-18 Tor Arne Vestbø <tor.arne.vestbo@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Force qmake to generate a single makefile for DerivedSources.pro
+
+ * DerivedSources.pro:
+
+2010-01-18 Csaba Osztrogonác <ossy@webkit.org>
+
+ Rubber-stamped by Gustavo Noronha Silva.
+
+ Rolling out r53391 and r53392 because of random crashes on buildbots.
+ https://bugs.webkit.org/show_bug.cgi?id=33731
+
+ * bytecode/CodeBlock.h:
+ (JSC::CallLinkInfo::seenOnce):
+ (JSC::CallLinkInfo::setSeen):
+ (JSC::MethodCallLinkInfo::MethodCallLinkInfo):
+ (JSC::MethodCallLinkInfo::seenOnce):
+ (JSC::MethodCallLinkInfo::setSeen):
+ * jit/JIT.cpp:
+ (JSC::JIT::unlinkCall):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::patchMethodCallProto):
+ * runtime/UString.cpp:
+ (JSC::UString::spliceSubstringsWithSeparators):
+ (JSC::UString::replaceRange):
+ * runtime/UString.h:
+ * runtime/UStringImpl.cpp:
+ (JSC::UStringImpl::baseSharedBuffer):
+ (JSC::UStringImpl::sharedBuffer):
+ (JSC::UStringImpl::~UStringImpl):
+ * runtime/UStringImpl.h:
+ (JSC::UntypedPtrAndBitfield::UntypedPtrAndBitfield):
+ (JSC::UntypedPtrAndBitfield::asPtr):
+ (JSC::UntypedPtrAndBitfield::operator&=):
+ (JSC::UntypedPtrAndBitfield::operator|=):
+ (JSC::UntypedPtrAndBitfield::operator&):
+ (JSC::UStringImpl::create):
+ (JSC::UStringImpl::cost):
+ (JSC::UStringImpl::isIdentifier):
+ (JSC::UStringImpl::setIsIdentifier):
+ (JSC::UStringImpl::ref):
+ (JSC::UStringImpl::deref):
+ (JSC::UStringImpl::checkConsistency):
+ (JSC::UStringImpl::UStringImpl):
+ (JSC::UStringImpl::bufferOwnerString):
+ (JSC::UStringImpl::bufferOwnership):
+ (JSC::UStringImpl::isStatic):
+ * wtf/StringHashFunctions.h:
+ (WTF::stringHash):
+
+2010-01-18 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Fix the build with strict gcc and RVCT versions: It's not legal to cast a
+ pointer to a function to a void* without an intermediate cast to a non-pointer
+ type. A cast to a ptrdiff_t inbetween fixes it.
+
+ * runtime/JSString.h:
+ (JSC::Fiber::JSString):
+
+2010-01-15 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ https://bugs.webkit.org/show_bug.cgi?id=33731
+ Remove UntypedPtrAndBitfield from UStringImpl (akin to PtrAndFlags).
+
+ This break the OS X Leaks tool. Instead, free up some more bits from the refCount.
+
+ * runtime/UStringImpl.cpp:
+ (JSC::UStringImpl::sharedBuffer):
+ (JSC::UStringImpl::~UStringImpl):
+ * runtime/UStringImpl.h:
+ (JSC::UStringImpl::cost):
+ (JSC::UStringImpl::checkConsistency):
+ (JSC::UStringImpl::UStringImpl):
+ (JSC::UStringImpl::bufferOwnerString):
+ (JSC::UStringImpl::):
+ * wtf/StringHashFunctions.h:
+ (WTF::stringHash):
+
+2010-01-15 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ https://bugs.webkit.org/show_bug.cgi?id=33731
+ Remove uses of PtrAndFlags from JIT data stuctures.
+
+ These break the OS X Leaks tool. Free up a bit in CallLinkInfo, and invalid
+ permutation of pointer states in MethodCallLinkInfo to represent the removed bits.
+
+ * bytecode/CodeBlock.h:
+ (JSC::CallLinkInfo::seenOnce):
+ (JSC::CallLinkInfo::setSeen):
+ (JSC::MethodCallLinkInfo::MethodCallLinkInfo):
+ (JSC::MethodCallLinkInfo::seenOnce):
+ (JSC::MethodCallLinkInfo::setSeen):
+ * jit/JIT.cpp:
+ (JSC::JIT::unlinkCall):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::patchMethodCallProto):
+ * runtime/UString.h:
+
+2010-01-16 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Cache JS string values made from DOM strings (Dromaeo speedup)
+ https://bugs.webkit.org/show_bug.cgi?id=33768
+ <rdar://problem/7353576>
+
+ * runtime/JSString.h:
+ (JSC::jsStringWithFinalizer): Added new mechanism for a string to have an optional
+ finalizer callback, for the benefit of weak-referencing caches.
+ (JSC::):
+ (JSC::Fiber::JSString):
+ (JSC::Fiber::~JSString):
+ * runtime/JSString.cpp:
+ (JSC::JSString::resolveRope): Clear fibers so this doesn't look like a string with a finalizer.
+ * runtime/WeakGCMap.h: Include "Collector.h" to make this header includable by itself.
+
+2010-01-15 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Maciej Stachowiak.
+
+ Fix for <rdar://problem/7548432>
+ Add ALWAYS_INLINE to jsLess for a 1% speedup on llvm-gcc.
+
+ * runtime/Operations.h:
+ (JSC::jsLess):
+
+2010-01-14 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ REGRESISON: Google maps buttons not working properly
+ https://bugs.webkit.org/show_bug.cgi?id=31871
+
+ REGRESSION(r52948): JavaScript exceptions thrown on Google Maps when
+ getting directions for a second time
+ https://bugs.webkit.org/show_bug.cgi?id=33446
+
+ SunSpider and v8 report no change.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::tryCacheGetByID): Update our cached offset in case
+ flattening the dictionary changed any of its offsets.
+
+ * jit/JITStubs.cpp:
+ (JSC::JITThunks::tryCacheGetByID):
+ (JSC::DEFINE_STUB_FUNCTION):
+ * runtime/Operations.h:
+ (JSC::normalizePrototypeChain): ditto
+
+2010-01-14 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ https://bugs.webkit.org/show_bug.cgi?id=33705
+ UStringImpl::create() should use internal storage
+
+ When creating a UStringImpl copying of a UChar*, we can use an internal buffer,
+ by calling UStringImpl::tryCreateUninitialized().
+
+ Also, remove duplicate of copyChars from JSString, call UStringImpl's version.
+
+ Small (max 0.5%) progression on Sunspidey.
+
+ * runtime/JSString.cpp:
+ (JSC::JSString::resolveRope):
+ * runtime/UStringImpl.h:
+ (JSC::UStringImpl::create):
+
+2010-01-14 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Make naming & behaviour of UString[Impl] methods more consistent.
+ https://bugs.webkit.org/show_bug.cgi?id=33702
+
+ UString::create() creates a copy of the UChar* passed, but UStringImpl::create() assumes
+ that it should assume ownership of the provided buffer (with UString::createNonCopying()
+ and UStringImpl::createCopying() providing the alternate behaviours). Unify on create()
+ taking a copy of the provided buffer. For non-copying cases, use the name 'adopt', and
+ make this method take a Vector<UChar>&. For cases where non-copying construction was being
+ used, other than from a Vector<UChar>, change the code to allocate the storage along with
+ the UStringImpl using UStringImpl::createUninitialized(). (The adopt() method also more
+ closely matches that of WebCore::StringImpl).
+
+ Also, UString::createUninitialized() and UStringImpl::createUninitialized() have incompatible
+ behaviours, in that the UString form sets the provided UChar* to a null or non-null value to
+ indicate success or failure, but UStringImpl uses the returned PassRefPtr<UStringImpl> to
+ indicate when allocation has failed (potentially leaving the output Char* uninitialized).
+ This is also incompatible with WebCore::StringImpl's behaviour, in that
+ StringImpl::createUninitialized() will CRASH() if unable to allocate. Some uses of
+ createUninitialized() in JSC are unsafe, since they do not test the result for null.
+ UStringImpl's indication is preferable, since we may want a successful call to set the result
+ buffer to 0 (specifically, StringImpl returns 0 for the buffer where createUninitialized()
+ returns the empty string, which seems reasonable to catch bugs early). UString's method
+ cannot support UStringImpl's behaviour directly, since it returns an object rather than a
+ pointer.
+ - remove UString::createUninitialized(), replace with calls to UStringImpl::createUninitialized()
+ - create a UStringImpl::tryCreateUninitialized() form UStringImpl::createUninitialized(),
+ with current behaviour, make createUninitialized() crash on failure to allocate.
+ - make cases in JSC that do not check the result call createUninitialized(), and cases that do
+ check call tryCreateUninitialized().
+
+ Rename computedHash() to existingHash(), to bring this in line wih WebCore::StringImpl.
+
+ * API/JSClassRef.cpp:
+ (OpaqueJSClassContextData::OpaqueJSClassContextData):
+ * JavaScriptCore.exp:
+ * runtime/ArrayPrototype.cpp:
+ (JSC::arrayProtoFuncToString):
+ * runtime/Identifier.cpp:
+ (JSC::CStringTranslator::translate):
+ (JSC::UCharBufferTranslator::translate):
+ * runtime/JSString.cpp:
+ (JSC::JSString::resolveRope):
+ * runtime/Lookup.cpp:
+ (JSC::HashTable::createTable):
+ * runtime/Lookup.h:
+ (JSC::HashTable::entry):
+ * runtime/StringBuilder.h:
+ (JSC::StringBuilder::release):
+ * runtime/StringConstructor.cpp:
+ (JSC::stringFromCharCodeSlowCase):
+ * runtime/StringPrototype.cpp:
+ (JSC::substituteBackreferencesSlow):
+ (JSC::stringProtoFuncToLowerCase):
+ (JSC::stringProtoFuncToUpperCase):
+ (JSC::stringProtoFuncFontsize):
+ (JSC::stringProtoFuncLink):
+ * runtime/Structure.cpp:
+ (JSC::Structure::despecifyDictionaryFunction):
+ (JSC::Structure::get):
+ (JSC::Structure::despecifyFunction):
+ (JSC::Structure::put):
+ (JSC::Structure::remove):
+ (JSC::Structure::insertIntoPropertyMapHashTable):
+ (JSC::Structure::checkConsistency):
+ * runtime/Structure.h:
+ (JSC::Structure::get):
+ * runtime/StructureTransitionTable.h:
+ (JSC::StructureTransitionTableHash::hash):
+ * runtime/UString.cpp:
+ (JSC::createRep):
+ (JSC::UString::UString):
+ (JSC::UString::spliceSubstringsWithSeparators):
+ (JSC::UString::replaceRange):
+ (JSC::UString::operator=):
+ * runtime/UString.h:
+ (JSC::UString::adopt):
+ (JSC::IdentifierRepHash::hash):
+ (JSC::makeString):
+ * runtime/UStringImpl.h:
+ (JSC::UStringImpl::adopt):
+ (JSC::UStringImpl::create):
+ (JSC::UStringImpl::createUninitialized):
+ (JSC::UStringImpl::tryCreateUninitialized):
+ (JSC::UStringImpl::existingHash):
+
+2010-01-13 Kent Hansen <kent.hansen@nokia.com>
+
+ Reviewed by Oliver Hunt.
+
+ JSON.stringify and JSON.parse needlessly process properties in the prototype chain
+ https://bugs.webkit.org/show_bug.cgi?id=33053
+
+ * runtime/JSONObject.cpp:
+ (JSC::Stringifier::Holder::appendNextProperty):
+ (JSC::Walker::walk):
+
+2010-01-13 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by NOBODY (buildfix).
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-01-13 Alexey Proskuryakov <ap@apple.com>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=33641
+ Assertion failure in Lexer.cpp if input stream ends while in string escape
+
+ Test: fast/js/end-in-string-escape.html
+
+ * parser/Lexer.cpp: (JSC::Lexer::lex): Bail out quickly on end of stream, not giving the
+ assertion a chance to fire.
+
+2010-01-13 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by NOBODY (buildfix).
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-01-13 Gavin Barraclough <barraclough@apple.com>
+
+ Rubber stamped by Sam Weinig & Darin Adler.
+
+ Three quick fixes to UStringImpl.
+ - The destroy() method can be switched back to a normal destructor; since we've switched
+ the way we protect static strings to be using an odd ref-count the destroy() won't abort.
+ - The cost() calculation logic was wrong. If you have multiple JSStrings wrapping substrings
+ of a base string, they would each report the full cost of the base string to the heap.
+ Instead we should only be reporting once for the base string.
+ - Remove the overloaded new operator calling fastMalloc, replace this with a 'using' to pick
+ up the implementation from the parent class.
+
+ * JavaScriptCore.exp:
+ * runtime/UStringImpl.cpp:
+ (JSC::UStringImpl::~UStringImpl):
+ * runtime/UStringImpl.h:
+ (JSC::UStringImpl::cost):
+ (JSC::UStringImpl::deref):
+
+2010-01-13 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Split the build process in two different .pro files.
+ This allows qmake to be run once all source files are available.
+
+ * DerivedSources.pro: Added.
+ * JavaScriptCore.pri: Moved source generation to DerivedSources.pro
+ * pcre/pcre.pri: Moved source generation to DerivedSources.pro
+
+2010-01-12 Kent Hansen <kent.hansen@nokia.com>
+
+ Reviewed by Geoffrey Garen.
+
+ [ES5] Implement Object.getOwnPropertyNames
+ https://bugs.webkit.org/show_bug.cgi?id=32242
+
+ Add an extra argument to getPropertyNames() and getOwnPropertyNames()
+ (and all reimplementations thereof) that indicates whether non-enumerable
+ properties should be added.
+
+ * API/JSCallbackObject.h:
+ * API/JSCallbackObjectFunctions.h:
+ (JSC::::getOwnPropertyNames):
+ * JavaScriptCore.exp:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * debugger/DebuggerActivation.cpp:
+ (JSC::DebuggerActivation::getOwnPropertyNames):
+ * debugger/DebuggerActivation.h:
+ * runtime/Arguments.cpp:
+ (JSC::Arguments::getOwnPropertyNames):
+ * runtime/Arguments.h:
+ * runtime/CommonIdentifiers.h:
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::getOwnPropertyNames):
+ * runtime/JSArray.h:
+ * runtime/JSByteArray.cpp:
+ (JSC::JSByteArray::getOwnPropertyNames):
+ * runtime/JSByteArray.h:
+ * runtime/JSFunction.cpp:
+ (JSC::JSFunction::getOwnPropertyNames):
+ * runtime/JSFunction.h:
+ * runtime/JSNotAnObject.cpp:
+ (JSC::JSNotAnObject::getOwnPropertyNames):
+ * runtime/JSNotAnObject.h:
+ * runtime/JSObject.cpp:
+ (JSC::getClassPropertyNames):
+ (JSC::JSObject::getPropertyNames):
+ (JSC::JSObject::getOwnPropertyNames):
+ * runtime/JSObject.h:
+ * runtime/JSVariableObject.cpp:
+ (JSC::JSVariableObject::getOwnPropertyNames):
+ * runtime/JSVariableObject.h:
+ * runtime/ObjectConstructor.cpp:
+ (JSC::ObjectConstructor::ObjectConstructor):
+ (JSC::objectConstructorGetOwnPropertyNames):
+ * runtime/RegExpMatchesArray.h:
+ (JSC::RegExpMatchesArray::getOwnPropertyNames):
+ * runtime/StringObject.cpp:
+ (JSC::StringObject::getOwnPropertyNames):
+ * runtime/StringObject.h:
+ * runtime/Structure.cpp: Rename getEnumerablePropertyNames() to getPropertyNames(), which takes an extra argument.
+ (JSC::Structure::getPropertyNames):
+ * runtime/Structure.h:
+ (JSC::):
+
+2010-01-12 Alexey Proskuryakov <ap@apple.com>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=33540
+ Make it possible to build in debug mode with assertions disabled
+
+ * jit/JITStubs.cpp: (JSC::DEFINE_STUB_FUNCTION):
+ * runtime/Identifier.cpp: (JSC::Identifier::checkSameIdentifierTable):
+ * wtf/FastMalloc.cpp:
+ * wtf/HashTable.h: (WTF::HashTableConstIterator::checkValidity):
+ * yarr/RegexCompiler.cpp: (JSC::Yarr::compileRegex):
+
+2009-11-23 Yong Li <yoli@rim.com>
+
+ Reviewed by Adam Treat.
+
+ Make GIF decoder support down-sampling
+ https://bugs.webkit.org/show_bug.cgi?id=31806
+
+ * platform/image-decoders/ImageDecoder.cpp:
+ (WebCore::ImageDecoder::upperBoundScaledY):
+ (WebCore::ImageDecoder::lowerBoundScaledY):
+ * platform/image-decoders/ImageDecoder.h:
+ (WebCore::RGBA32Buffer::scaledRect):
+ (WebCore::RGBA32Buffer::setScaledRect):
+ (WebCore::ImageDecoder::scaledSize):
+ * platform/image-decoders/gif/GIFImageDecoder.cpp:
+ (WebCore::GIFImageDecoder::sizeNowAvailable):
+ (WebCore::GIFImageDecoder::initFrameBuffer):
+ (WebCore::copyOnePixel):
+ (WebCore::GIFImageDecoder::haveDecodedRow):
+ (WebCore::GIFImageDecoder::frameComplete):
+
+2010-01-12 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ ecma/Date/15.9.5.12-1.js fails every night at midnight
+ https://bugs.webkit.org/show_bug.cgi?id=28041
+
+ Change the test to use a concrete time instead of "now".
+
+ * tests/mozilla/ecma/Date/15.9.5.10-1.js:
+ * tests/mozilla/ecma/Date/15.9.5.12-1.js:
+
+2010-01-11 Csaba Osztrogonác <ossy@webkit.org>
+
+ Reviewed by Ariya Hidayat.
+
+ [Qt] Enable JIT and YARR_JIT if (CPU(X86_64) && OS(LINUX) && GCC_VERSION >= 40100)
+
+ * wtf/Platform.h:
+
+2010-01-11 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Alexey Proskuryakov.
+
+ https://bugs.webkit.org/show_bug.cgi?id=33481
+ Uninitialized data members in ArrayStorage
+
+ SunSpider reports no change.
+
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::JSArray): Initialize missing data members in the two cases
+ where we don't use fastZeroedMalloc, so it doesn't happen automatically.
+
+2010-01-11 Steve Falkenburg <sfalken@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ https://bugs.webkit.org/show_bug.cgi?id=33480
+
+ Improve debugging reliability for WTF on Windows.
+ Store WTF static library's PDB file into a better location.
+
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+
+2010-01-11 Steve Falkenburg <sfalken@apple.com>
+
+ Windows build fix.
+ Remove extraneous entries from def file causing build warning.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-01-10 Kent Hansen <kent.hansen@nokia.com>
+
+ Reviewed by Darin Adler.
+
+ RegExp.prototype.toString returns "//" for empty regular expressions
+ https://bugs.webkit.org/show_bug.cgi?id=33319
+
+ "//" starts a single-line comment, hence "/(?:)/" should be used, according to ECMA.
+
+ * runtime/RegExpPrototype.cpp:
+ (JSC::regExpProtoFuncToString):
+
+ * tests/mozilla/ecma_2/RegExp/properties-001.js:
+ (AddRegExpCases):
+ * tests/mozilla/js1_2/regexp/toString.js:
+ Update relevant Mozilla tests (Mozilla has had this behavior since November 2003).
+
+2010-01-10 Darin Adler <darin@apple.com>
+
+ * tests/mozilla/ecma/Array/15.4.1.1.js: Added property allow-tabs.
+ * tests/mozilla/ecma/Array/15.4.1.2.js: Added property allow-tabs.
+ * tests/mozilla/ecma/Array/15.4.2.1-1.js: Added property allow-tabs.
+ * tests/mozilla/ecma/Array/15.4.2.2-1.js: Added property allow-tabs.
+ * tests/mozilla/ecma/Array/15.4.2.2-2.js: Added property allow-tabs.
+ * tests/mozilla/ecma/Array/15.4.2.3.js: Added property allow-tabs.
+ * tests/mozilla/ecma/Array/15.4.3.2.js: Added property allow-tabs.
+ * tests/mozilla/ecma/Array/15.4.3.js: Added property allow-tabs.
+ * tests/mozilla/ecma/Array/15.4.4.1.js: Added property allow-tabs.
+ * tests/mozilla/ecma/Array/15.4.4.js: Added property allow-tabs.
+ * tests/mozilla/ecma/LexicalConventions/7.7.4.js: Added property allow-tabs.
+ * tests/mozilla/ecma/Math/15.8.2.13.js: Added property allow-tabs.
+ * tests/mozilla/ecma/Math/15.8.2.16.js: Added property allow-tabs.
+ * tests/mozilla/ecma/Math/15.8.2.18.js: Added property allow-tabs.
+ * tests/mozilla/ecma/Math/15.8.2.2.js: Added property allow-tabs.
+ * tests/mozilla/ecma/Math/15.8.2.4.js: Added property allow-tabs.
+ * tests/mozilla/ecma/Math/15.8.2.5.js: Added property allow-tabs.
+ * tests/mozilla/ecma/Math/15.8.2.7.js: Added property allow-tabs.
+ * tests/mozilla/ecma/String/15.5.1.js: Added property allow-tabs.
+ * tests/mozilla/ecma/String/15.5.2.js: Added property allow-tabs.
+ * tests/mozilla/ecma/String/15.5.3.1-3.js: Added property allow-tabs.
+ * tests/mozilla/ecma/String/15.5.3.1-4.js: Added property allow-tabs.
+ * tests/mozilla/ecma/String/15.5.3.js: Added property allow-tabs.
+ * tests/mozilla/ecma/TypeConversion/9.5-2.js: Added property allow-tabs.
+ * tests/mozilla/ecma/jsref.js: Modified property allow-tabs.
+ * tests/mozilla/ecma/shell.js: Modified property allow-tabs.
+ * tests/mozilla/ecma_2/LexicalConventions/keywords-001.js: Added property allow-tabs.
+ * tests/mozilla/ecma_2/RegExp/exec-001.js: Added property allow-tabs.
+ * tests/mozilla/ecma_2/String/match-004.js: Added property allow-tabs.
+ * tests/mozilla/ecma_2/String/replace-001.js: Added property allow-tabs.
+ * tests/mozilla/ecma_2/String/split-002.js: Added property allow-tabs.
+ * tests/mozilla/ecma_2/jsref.js: Modified property allow-tabs.
+ * tests/mozilla/ecma_2/shell.js: Added property allow-tabs.
+ * tests/mozilla/ecma_3/Date/shell.js: Modified property allow-tabs.
+ * tests/mozilla/ecma_3/Exceptions/regress-181654.js: Added property allow-tabs.
+ * tests/mozilla/ecma_3/RegExp/regress-209067.js: Added property allow-tabs.
+ * tests/mozilla/ecma_3/RegExp/regress-85721.js: Added property allow-tabs.
+ * tests/mozilla/importList.html: Added property allow-tabs.
+ * tests/mozilla/js1_1/shell.js: Added property allow-tabs.
+ * tests/mozilla/js1_2/Array/general1.js: Added property allow-tabs.
+ * tests/mozilla/js1_2/Array/general2.js: Added property allow-tabs.
+ * tests/mozilla/js1_2/Array/slice.js: Added property allow-tabs.
+ * tests/mozilla/js1_2/Array/splice1.js: Added property allow-tabs.
+ * tests/mozilla/js1_2/Array/splice2.js: Added property allow-tabs.
+ * tests/mozilla/js1_2/Objects/toString-001.js: Added property allow-tabs.
+ * tests/mozilla/js1_2/String/charCodeAt.js: Added property allow-tabs.
+ * tests/mozilla/js1_2/String/concat.js: Modified property allow-tabs.
+ * tests/mozilla/js1_2/String/match.js: Added property allow-tabs.
+ * tests/mozilla/js1_2/String/slice.js: Added property allow-tabs.
+ * tests/mozilla/js1_2/function/Function_object.js: Added property allow-tabs.
+ * tests/mozilla/js1_2/function/Number.js: Modified property allow-tabs.
+ * tests/mozilla/js1_2/function/String.js: Modified property allow-tabs.
+ * tests/mozilla/js1_2/function/nesting.js: Added property allow-tabs.
+ * tests/mozilla/js1_2/function/regexparg-1.js: Added property allow-tabs.
+ * tests/mozilla/js1_2/function/regexparg-2-n.js: Added property allow-tabs.
+ * tests/mozilla/js1_2/jsref.js: Added property allow-tabs.
+ * tests/mozilla/js1_2/operator/equality.js: Added property allow-tabs.
+ * tests/mozilla/js1_2/operator/strictEquality.js: Added property allow-tabs.
+ * tests/mozilla/js1_2/regexp/RegExp_dollar_number.js: Added property allow-tabs.
+ * tests/mozilla/js1_2/regexp/RegExp_input.js: Added property allow-tabs.
+ * tests/mozilla/js1_2/regexp/RegExp_input_as_array.js: Added property allow-tabs.
+ * tests/mozilla/js1_2/regexp/RegExp_lastIndex.js: Added property allow-tabs.
+ * tests/mozilla/js1_2/regexp/RegExp_lastMatch.js: Added property allow-tabs.
+ * tests/mozilla/js1_2/regexp/RegExp_lastMatch_as_array.js: Added property allow-tabs.
+ * tests/mozilla/js1_2/regexp/RegExp_lastParen.js: Added property allow-tabs.
+ * tests/mozilla/js1_2/regexp/RegExp_lastParen_as_array.js: Added property allow-tabs.
+ * tests/mozilla/js1_2/regexp/RegExp_leftContext.js: Added property allow-tabs.
+ * tests/mozilla/js1_2/regexp/RegExp_leftContext_as_array.js: Added property allow-tabs.
+ * tests/mozilla/js1_2/regexp/RegExp_multiline.js: Added property allow-tabs.
+ * tests/mozilla/js1_2/regexp/RegExp_multiline_as_array.js: Added property allow-tabs.
+ * tests/mozilla/js1_2/regexp/RegExp_object.js: Added property allow-tabs.
+ * tests/mozilla/js1_2/regexp/RegExp_rightContext.js: Added property allow-tabs.
+ * tests/mozilla/js1_2/regexp/RegExp_rightContext_as_array.js: Added property allow-tabs.
+ * tests/mozilla/js1_2/regexp/alphanumeric.js: Added property allow-tabs.
+ * tests/mozilla/js1_2/regexp/asterisk.js: Added property allow-tabs.
+ * tests/mozilla/js1_2/regexp/backslash.js: Added property allow-tabs.
+ * tests/mozilla/js1_2/regexp/backspace.js: Added property allow-tabs.
+ * tests/mozilla/js1_2/regexp/beginLine.js: Added property allow-tabs.
+ * tests/mozilla/js1_2/regexp/character_class.js: Added property allow-tabs.
+ * tests/mozilla/js1_2/regexp/compile.js: Added property allow-tabs.
+ * tests/mozilla/js1_2/regexp/control_characters.js: Added property allow-tabs.
+ * tests/mozilla/js1_2/regexp/digit.js: Added property allow-tabs.
+ * tests/mozilla/js1_2/regexp/dot.js: Added property allow-tabs.
+ * tests/mozilla/js1_2/regexp/endLine.js: Added property allow-tabs.
+ * tests/mozilla/js1_2/regexp/everything.js: Added property allow-tabs.
+ * tests/mozilla/js1_2/regexp/exec.js: Added property allow-tabs.
+ * tests/mozilla/js1_2/regexp/flags.js: Added property allow-tabs.
+ * tests/mozilla/js1_2/regexp/global.js: Added property allow-tabs.
+ * tests/mozilla/js1_2/regexp/hexadecimal.js: Added property allow-tabs.
+ * tests/mozilla/js1_2/regexp/ignoreCase.js: Added property allow-tabs.
+ * tests/mozilla/js1_2/regexp/interval.js: Added property allow-tabs.
+ * tests/mozilla/js1_2/regexp/octal.js: Added property allow-tabs.
+ * tests/mozilla/js1_2/regexp/parentheses.js: Added property allow-tabs.
+ * tests/mozilla/js1_2/regexp/plus.js: Added property allow-tabs.
+ * tests/mozilla/js1_2/regexp/question_mark.js: Added property allow-tabs.
+ * tests/mozilla/js1_2/regexp/simple_form.js: Added property allow-tabs.
+ * tests/mozilla/js1_2/regexp/source.js: Added property allow-tabs.
+ * tests/mozilla/js1_2/regexp/special_characters.js: Added property allow-tabs.
+ * tests/mozilla/js1_2/regexp/string_replace.js: Added property allow-tabs.
+ * tests/mozilla/js1_2/regexp/string_search.js: Added property allow-tabs.
+ * tests/mozilla/js1_2/regexp/string_split.js: Added property allow-tabs.
+ * tests/mozilla/js1_2/regexp/test.js: Added property allow-tabs.
+ * tests/mozilla/js1_2/regexp/toString.js: Added property allow-tabs.
+ * tests/mozilla/js1_2/regexp/vertical_bar.js: Added property allow-tabs.
+ * tests/mozilla/js1_2/regexp/whitespace.js: Added property allow-tabs.
+ * tests/mozilla/js1_2/regexp/word_boundary.js: Added property allow-tabs.
+ * tests/mozilla/js1_2/shell.js: Added property allow-tabs.
+ * tests/mozilla/js1_2/statements/break.js: Added property allow-tabs.
+ * tests/mozilla/js1_2/statements/continue.js: Added property allow-tabs.
+ * tests/mozilla/js1_2/statements/do_while.js: Added property allow-tabs.
+ * tests/mozilla/js1_2/statements/switch.js: Added property allow-tabs.
+ * tests/mozilla/js1_2/statements/switch2.js: Added property allow-tabs.
+ * tests/mozilla/js1_3/shell.js: Added property allow-tabs.
+ * tests/mozilla/js1_4/shell.js: Added property allow-tabs.
+ * tests/mozilla/js1_5/Regress/regress-111557.js: Added property allow-tabs.
+ * tests/mozilla/js1_5/Regress/regress-216320.js: Added property allow-tabs.
+ * tests/mozilla/menuhead.html: Added property allow-tabs.
+ * tests/mozilla/mklistpage.pl: Added property allow-tabs.
+ * tests/mozilla/runtests.pl: Added property allow-tabs.
+
+2010-01-08 Daniel Bates <dbates@webkit.org>
+
+ Reviewed by Adam Barth.
+
+ https://bugs.webkit.org/show_bug.cgi?id=33417
+
+ Cleans up style errors exposed by the patch for bug #33198.
+ Moreover, fixes all "Weird number of spaces at line-start. Are you using a 4-space indent?"
+ errors reported by check-webkit-style.
+
+ No functionality was changed. So, no new tests.
+
+ * wtf/Platform.h:
+
+2010-01-08 Kent Hansen <kent.hansen@nokia.com>
+
+ Reviewed by Eric Seidel.
+
+ Don't store RegExp flags string representation
+ https://bugs.webkit.org/show_bug.cgi?id=33321
+
+ It's unused; the string representation is reconstructed from flags.
+
+ * runtime/RegExp.cpp:
+ (JSC::RegExp::RegExp):
+ * runtime/RegExp.h:
+
+2010-01-08 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Memory use grows grows possibly unbounded in this JavaScript Array test case
+ https://bugs.webkit.org/show_bug.cgi?id=31675
+
+ This fixes one observed bug in this test case, which is that
+ arrays don't report extra cost for the sparse value maps.
+
+ SunSpider reports a small speedup.
+
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::putSlowCase): Report extra memory cost for
+ the sparse value map.
+ * runtime/JSArray.h:
+
+2010-01-08 Yong Li <yoli@rim.com>
+
+ Reviewed by Darin Adler.
+
+ Remove unnecessary #include from FastMalloc.cpp
+ https://bugs.webkit.org/show_bug.cgi?id=33393
+
+ * wtf/FastMalloc.cpp:
+
+2010-01-08 Eric Seidel <eric@webkit.org>
+
+ No review, rolling out r52983.
+ http://trac.webkit.org/changeset/52983
+ https://bugs.webkit.org/show_bug.cgi?id=33321
+
+ Broke 59 JavaScriptCore tests. I don't think Kent knew about
+ run-javascriptcore-tests. Sadly neither does the commit-bot,
+ yet.
+
+ * runtime/RegExp.cpp:
+ (JSC::RegExp::RegExp):
+ * runtime/RegExp.h:
+ (JSC::RegExp::flags):
+
+2010-01-08 Eric Seidel <eric@webkit.org>
+
+ No review, rolling out r52981.
+ http://trac.webkit.org/changeset/52981
+ https://bugs.webkit.org/show_bug.cgi?id=33319
+
+ Caused two JS tests to start failing:
+ ecma_2/RegExp/properties-001.js and js1_2/regexp/toString.js
+
+ * runtime/RegExpPrototype.cpp:
+ (JSC::regExpProtoFuncToString):
+
+2010-01-08 Kent Hansen <kent.hansen@nokia.com>
+
+ Reviewed by Darin Adler.
+
+ Don't store RegExp flags string representation
+ https://bugs.webkit.org/show_bug.cgi?id=33321
+
+ It's unused; the string representation is reconstructed from flags.
+
+ * runtime/RegExp.cpp:
+ (JSC::RegExp::RegExp):
+ * runtime/RegExp.h:
+
+2010-01-08 Kent Hansen <kent.hansen@nokia.com>
+
+ Reviewed by Darin Adler.
+
+ RegExp.prototype.toString returns "//" for empty regular expressions
+ https://bugs.webkit.org/show_bug.cgi?id=33319
+
+ "//" starts a single-line comment, hence "/(?:)/" should be used, according to ECMA.
+
+ * runtime/RegExpPrototype.cpp:
+ (JSC::regExpProtoFuncToString):
+
+2010-01-08 Norbert Leser <norbert.leser@nokia.com>
+
+ Reviewed by Darin Adler.
+
+ RVCT compiler with "-Otime -O3" optimization tries to optimize out
+ inline new'ed pointers that are passed as arguments.
+ Proposed patch assigns new'ed pointer explicitly outside function call.
+
+ https://bugs.webkit.org/show_bug.cgi?id=33084
+
+ * API/JSClassRef.cpp:
+ (OpaqueJSClass::OpaqueJSClass):
+ (OpaqueJSClassContextData::OpaqueJSClassContextData):
+
+2010-01-08 Gabor Loki <loki@webkit.org>
+
+ Reviewed by Gavin Barraclough.
+
+ Remove an unnecessary cacheFlush from ARM_TRADITIONAL JIT
+ https://bugs.webkit.org/show_bug.cgi?id=33203
+
+ * assembler/ARMAssembler.cpp: Remove obsolete linkBranch function.
+ (JSC::ARMAssembler::executableCopy): Inline a clean linkBranch code.
+ * assembler/ARMAssembler.h:
+ (JSC::ARMAssembler::getLdrImmAddress): Use inline function.
+ (JSC::ARMAssembler::getLdrImmAddressOnPool): Ditto.
+ (JSC::ARMAssembler::patchPointerInternal): Remove an unnecessary cacheFlush.
+ (JSC::ARMAssembler::linkJump): Use patchPointerInternal instead of linkBranch.
+ (JSC::ARMAssembler::linkCall): Ditto.
+ (JSC::ARMAssembler::relinkCall): Ditto.
+
+2010-01-07 Gabor Loki <loki@webkit.org>
+
+ Reviewed by Gavin Barraclough.
+
+ Build fix for JSVALUE32 when ENABLE_JIT_OPTIMIZE* are disabled
+ https://bugs.webkit.org/show_bug.cgi?id=33311
+
+ Move compileGetDirectOffset function to common part of JSVALUE32
+
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::compileGetDirectOffset):
+
+2010-01-07 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Allow call sites to determine if ASSERT_* and LOG_* macros are operational
+ https://bugs.webkit.org/show_bug.cgi?id=33020
+
+ * wtf/Assertions.h: Set ASSERT_MSG_DISABLED, FATAL_DISABLED,
+ ERROR_DISABLED, LOG_DISABLED to 1 if the compiler does not support
+ variadic macros. Refactor for better readibility.
+
+2010-01-07 Daniel Bates <dbates@rim.com>
+
+ Reviewed by Eric Seidel.
+
+ https://bugs.webkit.org/show_bug.cgi?id=32987
+
+ Added ENABLE_XHTMLMP flag. Disabled by default.
+
+ * Configurations/FeatureDefines.xcconfig:
+
+2010-01-07 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Gavin Barraclough.
+
+ [Symbian] Port ARM traditional JIT Trampolines to RVCT
+ https://bugs.webkit.org/show_bug.cgi?id=30552
+
+ Take the GCC implementation and mechanically convert
+ it to RVCT syntax.
+
+ Use 'bx rX' instead of 'mov pc, rX' when it is available.
+
+ Developed in cooperation with Iain Campbell and Gabor Loki.
+
+ * JavaScriptCore.pri: Extra step to generate RVCT stubs. The
+ script generation intentionally executed all the time not just
+ for RVCT targets.
+
+ * create_rvct_stubs: Added. Perl script to expand precompiler macros
+ for RVCT assembler - the template is defined in JITStubs.cpp.
+
+ * jit/JITStubs.cpp:
+ (JSC::ctiTrampoline):
+ (JSC::ctiVMThrowTrampoline):
+ (JSC::ctiOpThrowNotCaught):
+
+2010-01-07 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Fix a crash seen on the buildbots.
+
+ * runtime/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::init): Disable specific function tracking here,
+ instead of in WebCore, to ensure that the disabling happens before a
+ specific function can be registered.
+
+2010-01-07 Alexey Proskuryakov <ap@apple.com>
+
+ Mac build fix.
+
+ * JavaScriptCore.exp: Export new JSGlobalData static data members.
+
+2010-01-07 Alexey Proskuryakov <ap@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ https://bugs.webkit.org/show_bug.cgi?id=33057
+ REGRESSION(r49365): typeof(xhr.responseText) != "string" in Windows
+
+ <rdar://problem/7296920> REGRESSION: WebKit fails to start PeaceKeeper benchmark
+
+ Test: fast/js/webcore-string-comparison.html
+
+ In r49365, some code was moved from JSString.cpp to JSString.h, and as a result, WebCore
+ got a way to directly instantiate JSStrings over DLL borders. Since vftable for JSString was
+ not exported, objects created from WebCore got a different vptr, and JavaScriptCore
+ optimizations that relied on vptr of all JSString objects being equal failed.
+
+ * config.h: Added a JS_EXPORTCLASS macro for exporting classes. It's currently the same as
+ JS_EXPORTDATA, but it clearly needed a new name.
+
+ * runtime/InitializeThreading.cpp:
+ (JSC::initializeThreadingOnce):
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::storeVPtrs):
+ (JSC::JSGlobalData::JSGlobalData):
+ (JSC::JSGlobalData::createNonDefault):
+ (JSC::JSGlobalData::create):
+ (JSC::JSGlobalData::sharedInstance):
+ * runtime/JSGlobalData.h:
+ Store vptrs just once, no need to repeatedly pick and copy them. This makes it possible to
+ assert vptr correctness in object destructors (which don't have access to JSGlobalData,
+ and even Heap::heap(this) will fail for fake objects created from storeVPtrs()).
+
+ * runtime/JSArray.cpp: (JSC::JSArray::~JSArray): Assert that vptr is what we expect it to be.
+ It's important to assert in destructor, because MSVC changes the vptr after constructor
+ is invoked.
+ * runtime/JSByteArray.cpp: (JSC::JSByteArray::~JSByteArray): Ditto.
+ * runtime/JSByteArray.h: Ditto.
+ * runtime/JSFunction.h: Ditto.
+ * runtime/JSFunction.cpp: (JSC::JSFunction::~JSFunction): Ditto.
+
+ * runtime/JSCell.h: (JSC::JSCell::setVPtr): Added a method to substitute vptr for another
+ one.
+
+ * runtime/JSString.h: Export JSString class together with its vftable, and tell other
+ libraries tp import it. This is needed on platforms that have a separate JavaScriptCore
+ dynamic library - and on Mac, we already did the export via JavaScriptCore.exp.
+ (JSC::JSString::~JSString): Assert tha vptr is what we expect it to be.
+ (JSC::fixupVPtr): Store a previously saved primary vftable pointer (do nothing if building
+ JavaScriptCore itself).
+ (JSC::jsSingleCharacterString): Call fixupVPtr in case this is call across DLL boundary.
+ (JSC::jsSingleCharacterSubstring): Ditto.
+ (JSC::jsNontrivialString): Ditto.
+ (JSC::jsString): Ditto.
+ (JSC::jsSubstring): Ditto.
+ (JSC::jsOwnedString): Ditto.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: Export the new static
+ JSGlobalData members that are used in WebCore via inline functions.
+
+2010-01-07 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Safari memory usage skyrockets using new Google AdWords interface
+ https://bugs.webkit.org/show_bug.cgi?id=33343
+
+ The memory use was caused by the global object creating too many structures
+ as it thrashed between different specific functions.
+
+ * runtime/Structure.cpp:
+ (JSC::Structure::Structure):
+ (JSC::Structure::addPropertyTransition):
+ (JSC::Structure::changePrototypeTransition):
+ (JSC::Structure::despecifyFunctionTransition):
+ (JSC::Structure::addAnonymousSlotsTransition):
+ (JSC::Structure::getterSetterTransition):
+ (JSC::Structure::toDictionaryTransition):
+ (JSC::Structure::addPropertyWithoutTransition):
+ (JSC::Structure::despecifyAllFunctions):
+ * runtime/Structure.h:
+ (JSC::Structure::disableSpecificFunctionTracking): Track a thrash count
+ for specific functions. Disable specific function tracking once the
+ thrash count has been hit.
+
+2010-01-07 Csaba Osztrogonác <ossy@webkit.org>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Enable JIT in debug mode on win32 after r51141 fixed the crashes.
+
+ * JavaScriptCore.pri:
+
+2010-01-07 Zoltan Horvath <zoltan@webkit.org>
+
+ Reviewed by Holger Freyther.
+
+ [Mac] Build fix when FAST_MALLOC_MATCH_VALIDATION=1
+ https://bugs.webkit.org/show_bug.cgi?id=33312
+
+ Using of operator += cause compile error on Mac, so it is changed to
+ "= static_cast<AllocAlignmentInteger*>(old_ptr) + 1".
+
+ * wtf/FastMalloc.cpp:
+ (WTF::TCMallocStats::realloc):
+
+2010-01-07 Zoltan Horvath <zoltan@webkit.org>
+
+ Reviewed by Holger Freyther.
+
+ [Qt] Build fix when FAST_MALLOC_MATCH_VALIDATION=1
+ https://bugs.webkit.org/show_bug.cgi?id=33312
+
+ Remove pByte (committed in r42344 from #20422), because pByte doesn't
+ exist and it is unnecessary.
+
+ * wtf/FastMalloc.cpp:
+ (WTF::TCMallocStats::realloc):
+
+2010-01-06 Gavin Barraclough <barraclough@apple.com>
+
+ QT build fix.
+
+ * runtime/Identifier.cpp:
+ (JSC::createIdentifierTableSpecific):
+
+2010-01-06 Gavin Barraclough <barraclough@apple.com>
+
+ Windows build fix part I.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2010-01-06 Dan Bernstein <mitz@apple.com>
+
+ Build fix
+
+ * runtime/Identifier.cpp:
+ (JSC::createIdentifierTableSpecificCallback):
+
+2010-01-05 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ https://bugs.webkit.org/show_bug.cgi?id=33236
+ Remove m_identifierTable pointer from UString
+
+ Currently every string holds a pointer so that during destruction,
+ if a string has been used as an identifier, it can remove itself
+ from the table. By instead accessing the identifierTable via a
+ thread specific tracking the table associated with the current
+ globaldata, we can save the memory cost of this pointer.
+
+ * API/APIShims.h:
+ (JSC::APIEntryShimWithoutLock::APIEntryShimWithoutLock):
+ (JSC::APIEntryShimWithoutLock::~APIEntryShimWithoutLock):
+ (JSC::APICallbackShim::APICallbackShim):
+ (JSC::APICallbackShim::~APICallbackShim):
+
+ - change the API shims to track the identifierTable of the current JSGlobalData.
+
+ * API/JSContextRef.cpp:
+ (JSContextGroupCreate):
+
+ - update creation of JSGlobalData for API usage to use new create method.
+ - fix shim instanciation bug in JSGlobalContextCreateInGroup.
+
+ * JavaScriptCore.exp:
+ * runtime/Completion.cpp:
+ (JSC::checkSyntax):
+ (JSC::evaluate):
+
+ - add asserts to check the identifierTable is being tracked correctly.
+
+ * runtime/Identifier.cpp:
+ (JSC::IdentifierTable::~IdentifierTable):
+ (JSC::IdentifierTable::add):
+ (JSC::Identifier::remove):
+ (JSC::Identifier::checkSameIdentifierTable):
+ (JSC::createIdentifierTableSpecificCallback):
+ (JSC::createIdentifierTableSpecific):
+ (JSC::createDefaultDataSpecific):
+
+ - Use currentIdentifierTable() instead of UStringImpl::m_identifierTable.
+ - Define methods to access the thread specific identifier tables.
+
+ * runtime/Identifier.h:
+ (JSC::ThreadIdentifierTableData::ThreadIdentifierTableData):
+ (JSC::defaultIdentifierTable):
+ (JSC::setDefaultIdentifierTable):
+ (JSC::currentIdentifierTable):
+ (JSC::setCurrentIdentifierTable):
+ (JSC::resetCurrentIdentifierTable):
+
+ - Declare methods to access the thread specific identifier tables.
+
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::createNonDefault):
+ (JSC::JSGlobalData::create):
+ (JSC::JSGlobalData::sharedInstance):
+
+ - creation of JSGlobalData objects, other than for API usage, associate themselves with the current thread.
+
+ * runtime/JSGlobalData.h:
+ * runtime/UStringImpl.cpp:
+ (JSC::UStringImpl::destroy):
+
+ - destroy() method should be using isIdentifier().
+
+ * runtime/UStringImpl.h:
+ (JSC::UStringImpl::isIdentifier):
+ (JSC::UStringImpl::setIsIdentifier):
+ (JSC::UStringImpl::checkConsistency):
+ (JSC::UStringImpl::UStringImpl):
+
+ - replace m_identifierTable with a single m_isIdentifier bit.
+
+ * wtf/StringHashFunctions.h:
+ (WTF::stringHash):
+
+ - change string hash result from 32-bit to 31-bit, to free a bit in UStringImpl for m_isIdentifier.
+
+2009-12-25 Patrick Gansterer <paroga@paroga.com>
+
+ Reviewed by Eric Seidel.
+
+ Buildfix for WinCE + style fixes.
+ https://bugs.webkit.org/show_bug.cgi?id=32939
+
+ * jsc.cpp:
+ (functionPrint):
+ (functionQuit):
+ (parseArguments):
+ (fillBufferWithContentsOfFile):
+
+2010-01-05 Patrick Gansterer <paroga@paroga.com>
+
+ Reviewed by Eric Seidel.
+
+ WinCE buildfix after r52791 (renamed PLATFORM(WINCE) to OS(WINCE)).
+ https://bugs.webkit.org/show_bug.cgi?id=33205
+
+ * jit/ExecutableAllocator.h:
+
+2010-01-05 Patrick Gansterer <paroga@paroga.com>
+
+ Reviewed by Darin Adler.
+
+ Added compiler error for unsupported platforms.
+ https://bugs.webkit.org/show_bug.cgi?id=33112
+
+ * jit/JITStubs.cpp:
+
+2010-01-05 Gabor Loki <loki@webkit.org>
+
+ Reviewed by Maciej Stachowiak.
+
+ Follow r52729 in ARMAssembler.
+ https://bugs.webkit.org/show_bug.cgi?id=33208
+
+ Use WTF_ARM_ARCH_AT_LEAST instead of ARM_ARCH_VERSION
+
+ * assembler/ARMAssembler.cpp:
+ (JSC::ARMAssembler::encodeComplexImm): Move tmp declaration to ARMv7
+ * assembler/ARMAssembler.h:
+ (JSC::ARMAssembler::):
+ (JSC::ARMAssembler::bkpt):
+
+2010-01-05 Maciej Stachowiak <mjs@apple.com>
+
+ Unreviewed build fix for Gtk+
+
+ Don't use // comments in Platform.h, at least some of them seem to make the version of GCC
+ used on the Gtk buildbot unhappy.
+
+ * wtf/Platform.h:
+
+2010-01-04 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin Fisher.
+
+ Reorganize, document and rename OS() platform macros.
+ https://bugs.webkit.org/show_bug.cgi?id=33198
+
+ * wtf/Platform.h: Rename, reorganize and document OS() macros.
+
+ Adapt to name changes. Also fixed a few incorrect OS checks.
+
+ * API/JSContextRef.cpp:
+ * assembler/MacroAssemblerARM.cpp:
+ (JSC::isVFPPresent):
+ * assembler/MacroAssemblerX86Common.h:
+ * bytecode/SamplingTool.cpp:
+ * config.h:
+ * interpreter/RegisterFile.cpp:
+ (JSC::RegisterFile::~RegisterFile):
+ * interpreter/RegisterFile.h:
+ (JSC::RegisterFile::RegisterFile):
+ (JSC::RegisterFile::grow):
+ * jit/ExecutableAllocator.h:
+ * jit/ExecutableAllocatorFixedVMPool.cpp:
+ * jit/ExecutableAllocatorPosix.cpp:
+ * jit/ExecutableAllocatorSymbian.cpp:
+ * jit/ExecutableAllocatorWin.cpp:
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ * jit/JITStubs.cpp:
+ * jsc.cpp:
+ (main):
+ * parser/Grammar.y:
+ * profiler/ProfileNode.cpp:
+ (JSC::getCount):
+ * runtime/Collector.cpp:
+ (JSC::Heap::Heap):
+ (JSC::Heap::allocateBlock):
+ (JSC::Heap::freeBlockPtr):
+ (JSC::currentThreadStackBase):
+ (JSC::getCurrentPlatformThread):
+ (JSC::suspendThread):
+ (JSC::resumeThread):
+ (JSC::getPlatformThreadRegisters):
+ (JSC::otherThreadStackPointer):
+ * runtime/Collector.h:
+ * runtime/DateConstructor.cpp:
+ * runtime/DatePrototype.cpp:
+ (JSC::formatLocaleDate):
+ * runtime/InitializeThreading.cpp:
+ (JSC::initializeThreading):
+ * runtime/MarkStack.h:
+ (JSC::MarkStack::MarkStackArray::shrinkAllocation):
+ * runtime/MarkStackPosix.cpp:
+ * runtime/MarkStackSymbian.cpp:
+ * runtime/MarkStackWin.cpp:
+ * runtime/StringPrototype.cpp:
+ (JSC::stringProtoFuncLastIndexOf):
+ * runtime/TimeoutChecker.cpp:
+ (JSC::getCPUTime):
+ * runtime/UString.cpp:
+ (JSC::UString::from):
+ * wtf/Assertions.cpp:
+ * wtf/Assertions.h:
+ * wtf/CurrentTime.cpp:
+ (WTF::lowResUTCTime):
+ * wtf/CurrentTime.h:
+ (WTF::getLocalTime):
+ * wtf/DateMath.cpp:
+ * wtf/FastMalloc.cpp:
+ (WTF::TCMalloc_ThreadCache::InitModule):
+ (WTF::TCMallocStats::):
+ * wtf/FastMalloc.h:
+ * wtf/MathExtras.h:
+ * wtf/RandomNumber.cpp:
+ (WTF::randomNumber):
+ * wtf/RandomNumberSeed.h:
+ (WTF::initializeRandomNumberGenerator):
+ * wtf/StringExtras.h:
+ * wtf/TCSpinLock.h:
+ (TCMalloc_SpinLock::Unlock):
+ (TCMalloc_SlowLock):
+ * wtf/TCSystemAlloc.cpp:
+ * wtf/ThreadSpecific.h:
+ (WTF::::destroy):
+ * wtf/Threading.h:
+ * wtf/ThreadingPthreads.cpp:
+ (WTF::initializeThreading):
+ (WTF::isMainThread):
+ * wtf/ThreadingWin.cpp:
+ (WTF::wtfThreadEntryPoint):
+ (WTF::createThreadInternal):
+ * wtf/VMTags.h:
+ * wtf/unicode/icu/CollatorICU.cpp:
+ (WTF::Collator::userDefault):
+ * wtf/win/MainThreadWin.cpp:
+ (WTF::initializeMainThreadPlatform):
+
+2010-01-04 Gustavo Noronha Silva <gns@gnome.org>
+
+ Add missing files to the build system - make distcheck build fix.
+
+ * GNUmakefile.am:
+
+2010-01-04 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig, additional coding by Mark Rowe.
+
+ https://bugs.webkit.org/show_bug.cgi?id=33163
+ Add string hashing functions to WTF.
+ Use WTF's string hashing functions from UStringImpl.
+
+ * GNUmakefile.am:
+ * JavaScriptCore.exp:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * runtime/UStringImpl.cpp:
+ * runtime/UStringImpl.h:
+ (JSC::UStringImpl::computeHash):
+ * wtf/HashFunctions.h:
+ * wtf/StringHashFunctions.h: Added.
+ (WTF::stringHash):
+
+2010-01-04 Dmitry Titov <dimich@chromium.org>
+
+ Not reviewed, attempt to fix ARM bulid.
+
+ * wtf/Platform.h:
+
+2010-01-04 Gavin Barraclough <barraclough@apple.com>
+
+ Rubber stamped by Geoff Garen.
+
+ Add an 'isIdentifier' to UStringImpl, use this where appropriate
+ (where previously 'identifierTable' was being tested).
+
+ * API/JSClassRef.cpp:
+ (OpaqueJSClass::~OpaqueJSClass):
+ (OpaqueJSClassContextData::OpaqueJSClassContextData):
+ * runtime/Identifier.cpp:
+ (JSC::Identifier::addSlowCase):
+ * runtime/Identifier.h:
+ (JSC::Identifier::add):
+ * runtime/PropertyNameArray.cpp:
+ (JSC::PropertyNameArray::add):
+ * runtime/UStringImpl.h:
+ (JSC::UStringImpl::isIdentifier):
+
+2010-01-04 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam "Shimmey Shimmey" Weinig.
+
+ https://bugs.webkit.org/show_bug.cgi?id=33158
+ Refactor JSC API entry/exit to use RAII instead of copy/pasting code.
+ Make it easier to change set of actions taken when passing across the API boundary.
+
+ * API/APIShims.h: Added.
+ (JSC::APIEntryShimWithoutLock::APIEntryShimWithoutLock):
+ (JSC::APIEntryShimWithoutLock::~APIEntryShimWithoutLock):
+ (JSC::APIEntryShim::APIEntryShim):
+ (JSC::APICallbackShim::APICallbackShim):
+ (JSC::APICallbackShim::~APICallbackShim):
+ * API/JSBase.cpp:
+ (JSEvaluateScript):
+ (JSCheckScriptSyntax):
+ (JSGarbageCollect):
+ (JSReportExtraMemoryCost):
+ * API/JSCallbackConstructor.cpp:
+ (JSC::constructJSCallback):
+ * API/JSCallbackFunction.cpp:
+ (JSC::JSCallbackFunction::call):
+ * API/JSCallbackObjectFunctions.h:
+ (JSC::::init):
+ (JSC::::getOwnPropertySlot):
+ (JSC::::put):
+ (JSC::::deleteProperty):
+ (JSC::::construct):
+ (JSC::::hasInstance):
+ (JSC::::call):
+ (JSC::::getOwnPropertyNames):
+ (JSC::::toNumber):
+ (JSC::::toString):
+ (JSC::::staticValueGetter):
+ (JSC::::callbackGetter):
+ * API/JSContextRef.cpp:
+ * API/JSObjectRef.cpp:
+ (JSObjectMake):
+ (JSObjectMakeFunctionWithCallback):
+ (JSObjectMakeConstructor):
+ (JSObjectMakeFunction):
+ (JSObjectMakeArray):
+ (JSObjectMakeDate):
+ (JSObjectMakeError):
+ (JSObjectMakeRegExp):
+ (JSObjectGetPrototype):
+ (JSObjectSetPrototype):
+ (JSObjectHasProperty):
+ (JSObjectGetProperty):
+ (JSObjectSetProperty):
+ (JSObjectGetPropertyAtIndex):
+ (JSObjectSetPropertyAtIndex):
+ (JSObjectDeleteProperty):
+ (JSObjectCallAsFunction):
+ (JSObjectCallAsConstructor):
+ (JSObjectCopyPropertyNames):
+ (JSPropertyNameArrayRelease):
+ (JSPropertyNameAccumulatorAddName):
+ * API/JSValueRef.cpp:
+ (JSValueGetType):
+ (JSValueIsUndefined):
+ (JSValueIsNull):
+ (JSValueIsBoolean):
+ (JSValueIsNumber):
+ (JSValueIsString):
+ (JSValueIsObject):
+ (JSValueIsObjectOfClass):
+ (JSValueIsEqual):
+ (JSValueIsStrictEqual):
+ (JSValueIsInstanceOfConstructor):
+ (JSValueMakeUndefined):
+ (JSValueMakeNull):
+ (JSValueMakeBoolean):
+ (JSValueMakeNumber):
+ (JSValueMakeString):
+ (JSValueToBoolean):
+ (JSValueToNumber):
+ (JSValueToStringCopy):
+ (JSValueToObject):
+ (JSValueProtect):
+ (JSValueUnprotect):
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2010-01-04 Dan Bernstein <mitz@apple.com>
+
+ Reviewed by Ada Chan and Mark Rowe.
+
+ Updated copyright string
+
+ * Info.plist:
+ * JavaScriptCore.vcproj/JavaScriptCore.resources/Info.plist:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.rc:
+
+2010-01-04 Adam Roben <aroben@apple.com>
+
+ No review, rolling out r52741.
+ http://trac.webkit.org/changeset/52741
+ https://bugs.webkit.org/show_bug.cgi?id=33056
+
+ * wtf/AlwaysInline.h:
+
+2010-01-04 Patrick Gansterer <paroga@paroga.com>
+
+ Reviewed by Darin Adler.
+
+ Add cacheFlush support for WinCE
+ https://bugs.webkit.org/show_bug.cgi?id=33110
+
+ * jit/ExecutableAllocator.h:
+ (JSC::ExecutableAllocator::cacheFlush):
+
+2010-01-04 Patrick Gansterer <paroga@paroga.com>
+
+ Reviewed by Adam Roben.
+
+ Implement NO_RETURN for COMPILER(MSVC).
+ https://bugs.webkit.org/show_bug.cgi?id=33056
+
+ * wtf/AlwaysInline.h:
+
+2010-01-04 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Simon Hausmann.
+
+ Fix some PLATFORM(*_ENDIAN) uses to CPU()
+ https://bugs.webkit.org/show_bug.cgi?id=33148
+
+ * runtime/JSCell.cpp:
+ (JSC::):
+ * runtime/JSValue.h:
+ (JSC::JSValue::):
+
+2010-01-04 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Adam Barth.
+
+ Document CPU() macros in comments.
+ https://bugs.webkit.org/show_bug.cgi?id=33147
+
+ * wtf/Platform.h:
+
+2010-01-04 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Adam Barth.
+
+ Reorganize, document and rename CPU() platform macros.
+ https://bugs.webkit.org/show_bug.cgi?id=33145
+ ExecutableAllocatorSymbian appears to have buggy ARM version check
+ https://bugs.webkit.org/show_bug.cgi?id=33138
+
+ * wtf/Platform.h:
+ Rename all macros related to detection of particular CPUs or
+ classes of CPUs to CPU(), reorganize and document them.
+
+ All remaining changes are adapting to the renames, plus fixing the
+ second bug cited above.
+
+ * assembler/ARMAssembler.cpp:
+ * assembler/ARMAssembler.h:
+ * assembler/ARMv7Assembler.h:
+ * assembler/AbstractMacroAssembler.h:
+ (JSC::AbstractMacroAssembler::Imm32::Imm32):
+ * assembler/MacroAssembler.h:
+ * assembler/MacroAssemblerARM.cpp:
+ * assembler/MacroAssemblerARM.h:
+ * assembler/MacroAssemblerCodeRef.h:
+ (JSC::MacroAssemblerCodePtr::MacroAssemblerCodePtr):
+ * assembler/MacroAssemblerX86.h:
+ * assembler/MacroAssemblerX86Common.h:
+ * assembler/MacroAssemblerX86_64.h:
+ * assembler/X86Assembler.h:
+ (JSC::X86Registers::):
+ (JSC::X86Assembler::):
+ (JSC::X86Assembler::movl_mEAX):
+ (JSC::X86Assembler::movl_EAXm):
+ (JSC::X86Assembler::repatchLoadPtrToLEA):
+ (JSC::X86Assembler::X86InstructionFormatter::memoryModRM):
+ * jit/ExecutableAllocator.h:
+ * jit/ExecutableAllocatorFixedVMPool.cpp:
+ * jit/ExecutableAllocatorPosix.cpp:
+ * jit/ExecutableAllocatorSymbian.cpp:
+ (JSC::ExecutableAllocator::intializePageSize):
+ * jit/JIT.cpp:
+ * jit/JIT.h:
+ * jit/JITArithmetic.cpp:
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::beginUninterruptedSequence):
+ (JSC::JIT::restoreArgumentReferenceForTrampoline):
+ (JSC::JIT::emitCount):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::privateCompileGetByIdProto):
+ (JSC::JIT::privateCompileGetByIdProtoList):
+ (JSC::JIT::privateCompileGetByIdChainList):
+ (JSC::JIT::privateCompileGetByIdChain):
+ * jit/JITStubs.cpp:
+ (JSC::JITThunks::JITThunks):
+ * jit/JITStubs.h:
+ * runtime/Collector.cpp:
+ (JSC::currentThreadStackBase):
+ (JSC::getPlatformThreadRegisters):
+ (JSC::otherThreadStackPointer):
+ * wrec/WREC.h:
+ * wrec/WRECGenerator.cpp:
+ (JSC::WREC::Generator::generateEnter):
+ (JSC::WREC::Generator::generateReturnSuccess):
+ (JSC::WREC::Generator::generateReturnFailure):
+ * wrec/WRECGenerator.h:
+ * wtf/FastMalloc.cpp:
+ * wtf/TCSpinLock.h:
+ (TCMalloc_SpinLock::Lock):
+ (TCMalloc_SpinLock::Unlock):
+ (TCMalloc_SlowLock):
+ * wtf/Threading.h:
+ * wtf/dtoa.cpp:
+ * yarr/RegexJIT.cpp:
+ (JSC::Yarr::RegexGenerator::generateEnter):
+ (JSC::Yarr::RegexGenerator::generateReturn):
+ * yarr/RegexJIT.h:
+
+2010-01-04 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Adam Barth.
+
+ Clean up COMPILER macros and remove unused ones.
+ https://bugs.webkit.org/show_bug.cgi?id=33132
+
+ Removed values are COMPILER(BORLAND) and COMPILER(CYGWIN) - they were
+ not used anywhere.
+
+ * wtf/Platform.h:
+
+2010-01-03 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Eric Seidel.
+
+ Update wtf/Platform.h to document the new system for porting macros.
+ https://bugs.webkit.org/show_bug.cgi?id=33130
+
+ * wtf/Platform.h:
+
+2009-12-29 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ PLATFORM(CAIRO) should be defined by WIN_CAIRO define
+ https://bugs.webkit.org/show_bug.cgi?id=22250
+
+ * wtf/Platform.h: Define WTF_PLATFORM_CAIRO for GTK port only
+ For the WinCairo port WTF_PLATFORM_CAIRO is already defined in config.h
+
+2009-12-28 Shu Chang <Chang.Shu@nokia.com>
+
+ Reviewed by Laszlo Gombos.
+
+ [Qt] Delete ThreadPrivate instance after it is finished.
+ https://bugs.webkit.org/show_bug.cgi?id=32614
+
+ * wtf/qt/ThreadingQt.cpp:
+ (WTF::ThreadMonitor::instance):
+ (WTF::ThreadMonitor::threadFinished):
+ (WTF::createThreadInternal):
+ (WTF::detachThread):
+
+2009-12-28 Patrick Gansterer <paroga@paroga.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Cleanup of #define JS_EXPORT.
+
+ * API/JSBase.h:
+
+2009-12-27 Patrick Gansterer <paroga@paroga.com>
+
+ Reviewed by Adam Barth.
+
+ WinCE buildfix (HWND_MESSAGE isn't supported there)
+
+ * wtf/win/MainThreadWin.cpp:
+ (WTF::initializeMainThreadPlatform):
+
+2009-12-27 Patrick Gansterer <paroga@paroga.com>
+
+ Reviewed by Adam Barth.
+
+ Added a file with WinMain function to link agains in WinCE.
+
+ * os-win32/WinMain.cpp: Added.
+ (convertToUtf8):
+ (WinMain):
+
+2009-12-24 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Unreviewed; revert of r52550.
+
+ The change regressed the following LayoutTests for QtWebKit.
+
+ fast/workers/worker-call.html -> crashed
+ fast/workers/worker-close.html -> crashed
+
+ * wtf/qt/ThreadingQt.cpp:
+ (WTF::waitForThreadCompletion):
+ (WTF::detachThread):
+
+2009-12-24 Shu Chang <Chang.Shu@nokia.com>
+
+ Reviewed by Laszlo Gombos.
+
+ [Qt] Fix memory leak by deleting instance of ThreadPrivate
+ in function waitForThreadCompletion(), synchronously, or in
+ detachThread(), asynchronously.
+ https://bugs.webkit.org/show_bug.cgi?id=32614
+
+ * wtf/qt/ThreadingQt.cpp:
+ (WTF::waitForThreadCompletion):
+ (WTF::detachThread):
+
+2009-12-23 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Laszlo Gombos.
+
+ Include stddef.h for ptrdiff_t
+ https://bugs.webkit.org/show_bug.cgi?id=32891
+
+ ptrdiff_t is typedef-ed in stddef.h.
+ Include stddef.h in jit/ExecutableAllocator.h.
+
+ * jit/ExecutableAllocator.h:
+
+2009-12-23 Patrick Gansterer <paroga@paroga.com>
+
+ Reviewed by Eric Seidel.
+
+ Buildfix after r47092.
+
+ * wtf/wince/MemoryManager.cpp:
+ (WTF::tryFastMalloc):
+ (WTF::tryFastZeroedMalloc):
+ (WTF::tryFastCalloc):
+ (WTF::tryFastRealloc):
+
+2009-12-23 Kent Tamura <tkent@chromium.org>
+
+ Reviewed by Darin Adler.
+
+ HTMLInputElement::valueAsDate getter support.
+ https://bugs.webkit.org/show_bug.cgi?id=32876
+
+ Expose dateToDaysFrom1970().
+
+ * JavaScriptCore.exp:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * wtf/DateMath.cpp:
+ (WTF::dateToDaysFrom1970):
+ * wtf/DateMath.h:
+
+2009-12-22 Darin Adler <darin@apple.com>
+
+ Reviewed by Mark Rowe.
+
+ Turn off datagrid by default, at least for all platforms Apple ships.
+ The datagrid implementation isn't ready for general web use yet.
+
+ * Configurations/FeatureDefines.xcconfig: Turn off datagrid by default.
+
+2009-12-22 Steve Block <steveblock@google.com>
+
+ Reviewed by David Levin.
+
+ Updates Android's scheduleDispatchFunctionsOnMainThread() to use new
+ AndroidThreading class, rather than using JavaSharedClient directly.
+ This fixes the current layering violation.
+ https://bugs.webkit.org/show_bug.cgi?id=32651
+
+ The pattern is copied from Chromium, which uses the ChromiumThreading
+ class. This patch also fixes the style in ChromiumThreading.h.
+
+ * wtf/android/AndroidThreading.h: Added. Declares AndroidThreading.
+ * wtf/android/MainThreadAndroid.cpp: Modified
+ (WTF::scheduleDispatchFunctionsOnMainThread): Uses AndroidThreading.
+ * wtf/chromium/ChromiumThreading.h: Modified. Fixes style.
+
+2009-12-22 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Fix a couple of problems with UntypedPtrAndBitfield.
+
+ Add a m_leaksPtr to reduce false positives from leaks in debug builds
+ (this isn't perfect because we'd like a solution for release builds,
+ but this is now at least as good as a PtrAndFlags would be).
+
+ Switch SmallStringsto use a regular string for the base, rather than
+ a static one. UntypedPtrAndBitfield assumes all strings are at least
+ 8 byte aligned; this migt not be true of static strings. Shared buffers
+ are heap allocated, as are all UStringImpls other than static strings.
+ Static strings cannot end up being the owner string of substrings,
+ since the only static strings are length 0.
+
+ * runtime/SmallStrings.cpp:
+ (JSC::SmallStringsStorage::SmallStringsStorage):
+ * runtime/UStringImpl.h:
+ (JSC::UntypedPtrAndBitfield::UntypedPtrAndBitfield):
+ (JSC::UStringImpl::UStringImpl):
+
+2009-12-22 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Darin Adler.
+
+ RVCT (__ARMCC_VERSION < 400000) does not provide strcasecmp and strncasecmp
+ https://bugs.webkit.org/show_bug.cgi?id=32857
+
+ Add implementation of strcasecmp and strncasecmp for RVCT < 4.0
+ because earlier versions of RVCT 4.0 does not provide these functions.
+
+ * wtf/StringExtras.cpp: Added.
+ (strcasecmp):
+ (strncasecmp):
+ * wtf/StringExtras.h:
+
+2009-12-22 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Darin Adler.
+
+ Define ALWAYS_INLINE and WTF_PRIVATE_INLINE to __forceinline for RVCT
+ https://bugs.webkit.org/show_bug.cgi?id=32853
+
+ Use __forceinline forces RVCT to compile a C or C++ function
+ inline. The compiler attempts to inline the function, regardless of
+ the characteristics of the function.
+
+ * wtf/AlwaysInline.h:
+ * wtf/FastMalloc.h:
+
+2009-12-21 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Prospective GTK build fix: Add UStringImpl.cpp/h to the build.
+
+ * GNUmakefile.am:
+
+2009-12-21 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Fix the Qt build, add UStringImpl.cpp to the build.
+
+ * JavaScriptCore.pri:
+
+2009-12-21 Gavin Barraclough <barraclough@apple.com>
+
+ Windows Build fix part 5.
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+
+2009-12-21 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by NOBODY (build fix).
+ Fix breakage of world introduced in build fix to r52463.
+
+ * runtime/UStringImpl.h:
+
+2009-12-21 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=32831
+ Replace UString::Rep implementation, following introduction of ropes to JSC.
+
+ * Remove redundant overcapacity mechanisms.
+ * Reduce memory cost of Rep's.
+ * Add an inline storage mechanism akin to that in WebCore's StringImpl.
+
+ ~1% Sunspider progression.
+
+ * JavaScriptCore.exp:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * runtime/JSString.cpp:
+ (JSC::JSString::resolveRope):
+ * runtime/SmallStrings.cpp:
+ (JSC::SmallStringsStorage::SmallStringsStorage):
+ * runtime/UString.cpp:
+ (JSC::initializeUString):
+ (JSC::createRep):
+ (JSC::UString::createFromUTF8):
+ (JSC::UString::createUninitialized):
+ (JSC::UString::spliceSubstringsWithSeparators):
+ (JSC::UString::replaceRange):
+ (JSC::UString::ascii):
+ (JSC::UString::operator=):
+ (JSC::UString::toStrictUInt32):
+ (JSC::equal):
+ * runtime/UString.h:
+ (JSC::UString::isEmpty):
+ (JSC::UString::cost):
+ (JSC::makeString):
+ * runtime/UStringImpl.cpp: Added.
+ (JSC::UStringImpl::baseSharedBuffer):
+ (JSC::UStringImpl::sharedBuffer):
+ (JSC::UStringImpl::destroy):
+ (JSC::UStringImpl::computeHash):
+ * runtime/UStringImpl.h: Added.
+ (JSC::UntypedPtrAndBitfield::UntypedPtrAndBitfield):
+ (JSC::UntypedPtrAndBitfield::asPtr):
+ (JSC::UntypedPtrAndBitfield::operator&=):
+ (JSC::UntypedPtrAndBitfield::operator|=):
+ (JSC::UntypedPtrAndBitfield::operator&):
+ (JSC::UStringImpl::create):
+ (JSC::UStringImpl::createCopying):
+ (JSC::UStringImpl::createUninitialized):
+ (JSC::UStringImpl::data):
+ (JSC::UStringImpl::size):
+ (JSC::UStringImpl::cost):
+ (JSC::UStringImpl::hash):
+ (JSC::UStringImpl::computedHash):
+ (JSC::UStringImpl::setHash):
+ (JSC::UStringImpl::identifierTable):
+ (JSC::UStringImpl::setIdentifierTable):
+ (JSC::UStringImpl::ref):
+ (JSC::UStringImpl::deref):
+ (JSC::UStringImpl::allocChars):
+ (JSC::UStringImpl::copyChars):
+ (JSC::UStringImpl::computeHash):
+ (JSC::UStringImpl::null):
+ (JSC::UStringImpl::empty):
+ (JSC::UStringImpl::checkConsistency):
+ (JSC::UStringImpl::):
+ (JSC::UStringImpl::UStringImpl):
+ (JSC::UStringImpl::operator new):
+ (JSC::UStringImpl::bufferOwnerString):
+ (JSC::UStringImpl::bufferOwnership):
+ (JSC::UStringImpl::isStatic):
+
+2009-12-18 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Move some build decisions from Qt build system into source files
+ https://bugs.webkit.org/show_bug.cgi?id=31956
+
+ * JavaScriptCore.pri: Compile files unconditionally
+ * jit/ExecutableAllocatorPosix.cpp: Guard with PLATFORM(UNIX) && !PLATFORM(SYMBIAN)
+ * jit/ExecutableAllocatorWin.cpp: Guard with PLATFORM(WIN_OS)
+ * runtime/MarkStackPosix.cpp: Guard with PLATFORM(UNIX) && !PLATFORM(SYMBIAN)
+ * runtime/MarkStackSymbian.cpp: Guard with PLATFORM(SYMBIAN)
+ * runtime/MarkStackWin.cpp: Guard with PLATFORM(WIN_OS)
+ * wtf/Platform.h: Guard ENABLE_JSC_MULTIPLE_THREADS with ENABLE_SINGLE_THREADED for the Qt port
+ * wtf/ThreadingNone.cpp: Guard with ENABLE(SINGLE_THREADED)
+ * wtf/qt/ThreadingQt.cpp: Guard with !ENABLE(SINGLE_THREADED)
+
+2009-12-18 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Add createNonCopying method to UString to make replace constructor passed bool,
+ to make behaviour more explicit. Add createFromUTF8 to UString (wrapping method
+ on UString::Rep), since other cases of transliteration (e.g. from ascii) are
+ performed in UString constructors. Add/use setHash & size() accessors on Rep,
+ rather than accessing _hash/len directly.
+
+ * API/JSClassRef.cpp:
+ (OpaqueJSClass::OpaqueJSClass):
+ * API/OpaqueJSString.cpp:
+ (OpaqueJSString::ustring):
+ * JavaScriptCore.exp:
+ * runtime/ArrayPrototype.cpp:
+ (JSC::arrayProtoFuncToString):
+ * runtime/Identifier.cpp:
+ (JSC::Identifier::equal):
+ (JSC::CStringTranslator::translate):
+ (JSC::UCharBufferTranslator::translate):
+ (JSC::Identifier::addSlowCase):
+ * runtime/JSString.cpp:
+ (JSC::JSString::resolveRope):
+ * runtime/JSString.h:
+ (JSC::JSString::Rope::Fiber::refAndGetLength):
+ (JSC::JSString::Rope::append):
+ * runtime/StringBuilder.h:
+ (JSC::StringBuilder::release):
+ * runtime/StringConstructor.cpp:
+ (JSC::stringFromCharCodeSlowCase):
+ * runtime/StringPrototype.cpp:
+ (JSC::substituteBackreferencesSlow):
+ (JSC::stringProtoFuncToLowerCase):
+ (JSC::stringProtoFuncToUpperCase):
+ (JSC::stringProtoFuncFontsize):
+ (JSC::stringProtoFuncLink):
+ * runtime/UString.cpp:
+ (JSC::UString::UString):
+ (JSC::UString::createNonCopying):
+ (JSC::UString::createFromUTF8):
+ * runtime/UString.h:
+ (JSC::UString::Rep::setHash):
+ (JSC::UString::~UString):
+ (JSC::makeString):
+
+2009-12-18 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Cameron Zwarich and Gavin Barraclough.
+
+ Changed Register constructors to assignment operators, to streamline
+ moving values into registers. (In theory, there's no difference between
+ the two, since the constructor should just inline away, but there seems
+ to be a big difference in the addled mind of the GCC optimizer.)
+
+ In the interpreter, this is a 3.5% SunSpider speedup and a 1K-2K
+ reduction in stack usage per privateExecute stack frame.
+
+ * interpreter/CallFrame.h:
+ (JSC::ExecState::setCalleeArguments):
+ (JSC::ExecState::setCallerFrame):
+ (JSC::ExecState::setScopeChain):
+ (JSC::ExecState::init):
+ (JSC::ExecState::setArgumentCount):
+ (JSC::ExecState::setCallee):
+ (JSC::ExecState::setCodeBlock): Added a little bit of casting so these
+ functions could use the new Register assignment operators.
+
+ * interpreter/Register.h:
+ (JSC::Register::withInt):
+ (JSC::Register::Register):
+ (JSC::Register::operator=): Swapped in assignment operators for constructors.
+
+2009-12-18 Yongjun Zhang <yongjun.zhang@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ https://bugs.webkit.org/show_bug.cgi?id=32713
+ [Qt] make wtf/Assertions.h compile in winscw compiler.
+
+ Add string arg before ellipsis to help winscw compiler resolve variadic
+ macro definitions in wtf/Assertions.h.
+
+ * wtf/Assertions.h:
+
+2009-12-18 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Adam Roben.
+
+ Fixed intermittent failure seen on Windows buildbot, and in other JSC
+ API clients.
+
+ Added a WeakGCPtr class and changed OpaqueJSClass::cachedPrototype to
+ use it, to avoid vending a stale object as a prototype.
+
+ * API/JSClassRef.cpp:
+ (OpaqueJSClassContextData::OpaqueJSClassContextData):
+ (OpaqueJSClass::prototype):
+ * API/JSClassRef.h: Use WeakGCPtr.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * runtime/WeakGCPtr.h: Added.
+ (JSC::WeakGCPtr::WeakGCPtr):
+ (JSC::WeakGCPtr::get):
+ (JSC::WeakGCPtr::clear):
+ (JSC::WeakGCPtr::operator*):
+ (JSC::WeakGCPtr::operator->):
+ (JSC::WeakGCPtr::operator!):
+ (JSC::WeakGCPtr::operator bool):
+ (JSC::WeakGCPtr::operator UnspecifiedBoolType):
+ (JSC::WeakGCPtr::assign):
+ (JSC::::operator):
+ (JSC::operator==):
+ (JSC::operator!=):
+ (JSC::static_pointer_cast):
+ (JSC::const_pointer_cast):
+ (JSC::getPtr): Added WeakGCPtr to the project.
+
+2009-12-18 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ https://bugs.webkit.org/show_bug.cgi?id=32720
+
+ * JavaScriptCore.exp:
+ - Remove exports for UString::append
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ - Make StringBuilder a private header (was project).
+
+2009-12-18 Martin Robinson <martin.james.robinson@gmail.com>
+
+ Reviewed by Gustavo Noronha Silva.
+
+ [GTK] GRefPtr does not take a reference when assigned a raw pointer
+ https://bugs.webkit.org/show_bug.cgi?id=32709
+
+ Ensure that when assigning a raw pointer to a GRefPtr, the reference
+ count is incremented. Also remove the GRefPtr conversion overload as
+ GRefPtr types have necessarily incompatible reference counting.
+
+ * wtf/gtk/GRefPtr.h:
+ (WTF::GRefPtr::operator=):
+
+2009-12-18 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Reviewed by Tor Arne Vestbø.
+
+ [Qt] Clean up the qmake build system to distinguish between trunk builds and package builds
+
+ https://bugs.webkit.org/show_bug.cgi?id=32716
+
+ * pcre/pcre.pri: Use standalone_package instead of QTDIR_build
+
+2009-12-18 Martin Robinson <martin.james.robinson@gmail.com>
+
+ Reviewed by Gustavo Noronha Silva.
+
+ [GTK] Compile warning from line 29 of GRefPtr.cpp
+ https://bugs.webkit.org/show_bug.cgi?id=32703
+
+ Fix memory leak and compiler warning in GRefPtr GHashTable template
+ specialization.
+
+ * wtf/gtk/GRefPtr.cpp:
+ (WTF::refGPtr):
+
+2009-12-17 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Mark Rowe.
+
+ Add BUILDING_ON_SNOW_LEOPARD and TARGETING_SNOW_LEOPARD #defines.
+
+ * wtf/Platform.h:
+
+2009-12-17 Adam Roben <aroben@apple.com>
+
+ Sync JavaScriptCore.vcproj with JavaScriptCore.xcodeproj and the
+ source tree
+
+ Fixes <http://webkit.org/b/32665>.
+
+ Reviewed by Ada Chan.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Moved
+ around files and filters so that the structure matches
+ JavaScriptCore.xcodeproj and the source tree. A few headers that were
+ previously omitted have been added, as well as JSZombie.{cpp,h}.
+
+2009-12-17 Adam Roben <aroben@apple.com>
+
+ Remove HeavyProfile and TreeProfile completely
+
+ These were mostly removed in r42808, but the empty files were left in
+ place.
+
+ Fixes <http://webkit.org/b/32664>.
+
+ Reviewed by John Sullivan.
+
+ * Android.mk:
+ * GNUmakefile.am:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.pri:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCoreSources.bkl:
+ Removed HeavyProfile/TreeProfile source files.
+
+ * profiler/HeavyProfile.cpp: Removed.
+ * profiler/HeavyProfile.h: Removed.
+ * profiler/TreeProfile.cpp: Removed.
+ * profiler/TreeProfile.h: Removed.
+
+2009-12-17 Martin Robinson <martin.james.robinson@gmail.com>
+
+ Reviewed by Gustavo Noronha Silva.
+
+ [GTK] WebKit GTK needs a wrapper for ref counted glib/gobject structs
+ https://bugs.webkit.org/show_bug.cgi?id=21599
+
+ Implement GRefPtr, a smart pointer for reference counted GObject types.
+
+ * GNUmakefile.am:
+ * wtf/gtk/GOwnPtr.cpp:
+ (WTF::GDir):
+ * wtf/gtk/GRefPtr.h: Added.
+ (WTF::):
+ (WTF::GRefPtr::GRefPtr):
+ (WTF::GRefPtr::~GRefPtr):
+ (WTF::GRefPtr::clear):
+ (WTF::GRefPtr::get):
+ (WTF::GRefPtr::operator*):
+ (WTF::GRefPtr::operator->):
+ (WTF::GRefPtr::operator!):
+ (WTF::GRefPtr::operator UnspecifiedBoolType):
+ (WTF::GRefPtr::hashTableDeletedValue):
+ (WTF::::operator):
+ (WTF::::swap):
+ (WTF::swap):
+ (WTF::operator==):
+ (WTF::operator!=):
+ (WTF::static_pointer_cast):
+ (WTF::const_pointer_cast):
+ (WTF::getPtr):
+ (WTF::adoptGRef):
+ (WTF::refGPtr):
+ (WTF::derefGPtr):
+
+2009-12-17 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk>
+
+ Unreviewed. Build fixes for make distcheck.
+
+ * GNUmakefile.am:
+
+2009-12-16 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Fixed <rdar://problem/7355025> Interpreter::privateExecute macro generates
+ bloated code
+
+ This patch cuts Interpreter stack use by about a third.
+
+ * bytecode/Opcode.h: Changed Opcode to const void* to work with the
+ const static initiliazation we want to do in Interpreter::privateExecute.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::Interpreter): Moved hashtable initialization here to
+ avoid polluting Interpreter::privateExecute's stack, and changed it from a
+ series of add() calls to one add() call in a loop, to cut down on code size.
+
+ (JSC::Interpreter::privateExecute): Changed a series of label computations
+ to a copy of a compile-time constant array to cut down on code size.
+
+2009-12-16 Mark Rowe <mrowe@apple.com>
+
+ Build fix. Disable debug variants of WebKit frameworks.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2009-12-15 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam "r=me" Weinig.
+
+ https://bugs.webkit.org/show_bug.cgi?id=32498
+ <rdar://problem/7471495>
+ REGRESSION(r51978-r52039): AJAX "Mark This Forum Read" function no longer
+ works
+
+ Fixed a tyop.
+
+ * runtime/Operations.h:
+ (JSC::jsAdd): Use the '&&' operator, not the ',' operator.
+
+2009-12-15 Geoffrey Garen <ggaren@apple.com>
+
+ Try to fix the windows build: don't export this inlined function.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2009-12-15 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Beth Dakin.
+
+ Inlined JSCell's operator new.
+
+ 3.7% speedup on bench-allocate-nonretained.js.
+
+ * JavaScriptCore.exp:
+ * runtime/JSCell.cpp:
+ * runtime/JSCell.h:
+ (JSC::JSCell::operator new):
+
+2009-12-15 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Removed the number heap, replacing it with a one-item free list for
+ numbers, taking advantage of the fact that two number cells fit inside
+ the space for one regular cell, and number cells don't require destruction.
+
+ SunSpider says 1.6% faster in JSVALUE32 mode (the only mode that
+ heap-allocates numbers).
+
+ SunSpider says 1.1% faster in JSVALUE32_64 mode. v8 says 0.8% faster
+ in JSVALUE32_64 mode. 10% speedup on bench-alloc-nonretained.js. 6%
+ speedup on bench-alloc-retained.js.
+
+ There's a lot of formulaic change in this patch, but not much substance.
+
+ * JavaScriptCore.exp:
+ * debugger/Debugger.cpp:
+ (JSC::Debugger::recompileAllJSFunctions):
+ * runtime/Collector.cpp:
+ (JSC::Heap::Heap):
+ (JSC::Heap::destroy):
+ (JSC::Heap::allocateBlock):
+ (JSC::Heap::freeBlock):
+ (JSC::Heap::freeBlockPtr):
+ (JSC::Heap::freeBlocks):
+ (JSC::Heap::recordExtraCost):
+ (JSC::Heap::allocate):
+ (JSC::Heap::resizeBlocks):
+ (JSC::Heap::growBlocks):
+ (JSC::Heap::shrinkBlocks):
+ (JSC::Heap::markConservatively):
+ (JSC::Heap::clearMarkBits):
+ (JSC::Heap::markedCells):
+ (JSC::Heap::sweep):
+ (JSC::Heap::markRoots):
+ (JSC::Heap::objectCount):
+ (JSC::Heap::addToStatistics):
+ (JSC::Heap::statistics):
+ (JSC::Heap::isBusy):
+ (JSC::Heap::reset):
+ (JSC::Heap::collectAllGarbage):
+ (JSC::Heap::primaryHeapBegin):
+ (JSC::Heap::primaryHeapEnd):
+ * runtime/Collector.h:
+ (JSC::): Removed all code pertaining to the number heap, and changed all
+ heap template functions and classes to non-template functions and classes.
+
+ (JSC::Heap::allocateNumber): A new optimization to replace the number
+ heap: allocate half-sized number cells in pairs, returning the first
+ cell and caching the second cell for the next allocation.
+
+ * runtime/CollectorHeapIterator.h:
+ (JSC::LiveObjectIterator::LiveObjectIterator):
+ (JSC::LiveObjectIterator::operator++):
+ (JSC::DeadObjectIterator::DeadObjectIterator):
+ (JSC::DeadObjectIterator::operator++):
+ (JSC::ObjectIterator::ObjectIterator):
+ (JSC::ObjectIterator::operator++):
+ * runtime/JSCell.h:
+ (JSC::JSCell::isNumber): Removed all code pertaining to the number heap,
+ and changed all heap template functions and classes to non-template functions
+ and classes.
+
+2009-12-15 Zoltan Horvath <zoltan@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ Allow custom memory allocation control for WeakGCMap class
+ https://bugs.webkit.org/show_bug.cgi?id=32547
+
+ Inherits WeakGCMap from FastAllocBase because it is instantiated by
+ 'new' at: WebCore/dom/Document.cpp:512.
+
+ * runtime/WeakGCMap.h:
+
+2009-12-15 Zoltan Horvath <zoltan@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ Allow custom memory allocation control for dtoa's P5Node struct
+ https://bugs.webkit.org/show_bug.cgi?id=32544
+
+ Inherits P5Node struct from Noncopyable because it is instantiated by
+ 'new' at wtf/dtoa.cpp:588 and don't need to be copyable.
+
+ * wtf/dtoa.cpp:
+
+2009-12-14 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Simon Fraser.
+
+ https://bugs.webkit.org/show_bug.cgi?id=32524
+ REGRESSION(52084): fast/dom/prototypes.html failing two CSS tests
+
+ * wtf/StdLibExtras.h:
+ (WTF::bitCount): The original patch put the parentheses in the wrong
+ place, completely changing the calculation and making it almost always
+ wrong. Moved the parentheses around the '+' operation, like the original
+ compiler warning suggested.
+
+2009-12-14 Gabor Loki <loki@inf.u-szeged.hu>
+
+ Unreviewed trivial buildfix.
+
+ Fix crosses initialization of usedPrimaryBlocks for JSValue32
+
+ * runtime/Collector.cpp:
+ (JSC::Heap::markConservatively):
+
+2009-12-14 Csaba Osztrogonác <ossy@webkit.org>
+
+ Reviewed by Simon Hausmann.
+
+ GCC 4.3.x warning fixed. Suggested parantheses added.
+ warning: ../../../JavaScriptCore/wtf/StdLibExtras.h:77: warning: suggest parentheses around + or - in operand of &
+
+ * wtf/StdLibExtras.h:
+ (WTF::bitCount):
+
+2009-12-13 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Changed GC from mark-sweep to mark-allocate.
+
+ Added WeakGCMap to keep WebCore blissfully ignorant about objects that
+ have become garbage but haven't run their destructors yet.
+
+ 1% SunSpider speedup.
+ 7.6% v8 speedup (37% splay speedup).
+ 17% speedup on bench-alloc-nonretained.js.
+ 18% speedup on bench-alloc-retained.js.
+
+ * API/JSBase.cpp:
+ (JSGarbageCollect):
+ * API/JSContextRef.cpp:
+ * JavaScriptCore.exp:
+ * JavaScriptCore.xcodeproj/project.pbxproj: Updated for renames and new
+ files.
+
+ * debugger/Debugger.cpp:
+ (JSC::Debugger::recompileAllJSFunctions): Updated to use the Collector
+ iterator abstraction.
+
+ * jsc.cpp:
+ (functionGC): Updated for rename.
+
+ * runtime/Collector.cpp: Slightly reduced the number of allocations per
+ collection, so that small workloads only allocate on collector block,
+ rather than two.
+
+ (JSC::Heap::Heap): Updated to use the new allocateBlock function.
+
+ (JSC::Heap::destroy): Updated to use the new freeBlocks function.
+
+ (JSC::Heap::allocateBlock): New function to initialize a block when
+ allocating it.
+
+ (JSC::Heap::freeBlock): Consolidated the responsibility for running
+ destructors into this function.
+
+ (JSC::Heap::freeBlocks): Updated to use freeBlock.
+
+ (JSC::Heap::recordExtraCost): Sweep the heap in this reporting function,
+ so that allocation, which is more common, doesn't have to check extraCost.
+
+ (JSC::Heap::heapAllocate): Run destructors right before recycling a
+ garbage cell. This has better cache utilization than a separate sweep phase.
+
+ (JSC::Heap::resizeBlocks):
+ (JSC::Heap::growBlocks):
+ (JSC::Heap::shrinkBlocks): New set of functions for managing the size of
+ the heap, now that the heap doesn't maintain any information about its
+ size.
+
+ (JSC::isPointerAligned):
+ (JSC::isHalfCellAligned):
+ (JSC::isPossibleCell):
+ (JSC::isCellAligned):
+ (JSC::Heap::markConservatively): Cleaned up this code a bit.
+
+ (JSC::Heap::clearMarkBits):
+ (JSC::Heap::markedCells): Some helper functions for examining the the mark
+ bitmap.
+
+ (JSC::Heap::sweep): Simplified this function by using a DeadObjectIterator.
+
+ (JSC::Heap::markRoots): Reordered some operations for clarity.
+
+ (JSC::Heap::objectCount):
+ (JSC::Heap::addToStatistics):
+ (JSC::Heap::statistics): Rewrote these functions to calculate an object
+ count on demand, since the heap doesn't maintain this information by
+ itself.
+
+ (JSC::Heap::reset): New function for resetting the heap once we've
+ exhausted heap space.
+
+ (JSC::Heap::collectAllGarbage): This function matches the old collect()
+ behavior, but it's now an uncommon function used only by API.
+
+ * runtime/Collector.h:
+ (JSC::CollectorBitmap::count):
+ (JSC::CollectorBitmap::isEmpty): Added some helper functions for managing
+ the collector mark bitmap.
+
+ (JSC::Heap::reportExtraMemoryCost): Changed reporting from cell equivalents
+ to bytes, so it's easier to understand.
+
+ * runtime/CollectorHeapIterator.h:
+ (JSC::CollectorHeapIterator::CollectorHeapIterator):
+ (JSC::CollectorHeapIterator::operator!=):
+ (JSC::CollectorHeapIterator::operator*):
+ (JSC::CollectorHeapIterator::advance):
+ (JSC::::LiveObjectIterator):
+ (JSC::::operator):
+ (JSC::::DeadObjectIterator):
+ (JSC::::ObjectIterator): New iterators for encapsulating details about
+ heap layout, and what's live and dead on the heap.
+
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::putSlowCase):
+ (JSC::JSArray::increaseVectorLength): Delay reporting extra cost until
+ we're fully constructed, so the heap mark phase won't visit us in an
+ invalid state.
+
+ * runtime/JSCell.h:
+ (JSC::JSCell::):
+ (JSC::JSCell::createDummyStructure):
+ (JSC::JSCell::JSCell):
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData):
+ * runtime/JSGlobalData.h: Added a dummy cell to simplify allocation logic.
+
+ * runtime/JSString.h:
+ (JSC::jsSubstring): Don't report extra cost for substrings, since they
+ share a buffer that's already reported extra cost.
+
+ * runtime/Tracing.d:
+ * runtime/Tracing.h: Changed these dtrace hooks not to report object
+ counts, since they're no longer cheap to compute.
+
+ * runtime/UString.h: Updated for renames.
+
+ * runtime/WeakGCMap.h: Added.
+ (JSC::WeakGCMap::isEmpty):
+ (JSC::WeakGCMap::uncheckedGet):
+ (JSC::WeakGCMap::uncheckedBegin):
+ (JSC::WeakGCMap::uncheckedEnd):
+ (JSC::::get):
+ (JSC::::take):
+ (JSC::::set):
+ (JSC::::uncheckedRemove): Mentioned above.
+
+ * wtf/StdLibExtras.h:
+ (WTF::bitCount): Added a bit population count function, so the heap can
+ count live objects to fulfill statistics questions.
+
+The very last cell in the block is not allocated -- should not be marked.
+
+2009-12-13 Geoffrey Garen <ggaren@apple.com>
+
+ Windows build fix: Export some new symbols.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2009-12-13 Geoffrey Garen <ggaren@apple.com>
+
+ Windows build fix: Removed some old exports.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2009-12-13 Geoffrey Garen <ggaren@apple.com>
+
+ Windows build fix: Use unsigned instead of uint32_t to avoid dependencies.
+
+ * wtf/StdLibExtras.h:
+ (WTF::bitCount):
+
+2009-12-13 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by NOBODY (speculative Windows build fix).
+
+ * runtime/JSGlobalObjectFunctions.cpp:
+
+2009-12-13 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ https://bugs.webkit.org/show_bug.cgi?id=32496
+ Switch remaining cases of string construction to use StringBuilder.
+ Builds strings using a vector rather than using string append / addition.
+
+ * JavaScriptCore.exp:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * runtime/Executable.cpp:
+ (JSC::FunctionExecutable::paramString):
+ * runtime/FunctionConstructor.cpp:
+ (JSC::constructFunction):
+ * runtime/JSGlobalObjectFunctions.cpp:
+ (JSC::encode):
+ (JSC::decode):
+ (JSC::globalFuncEscape):
+ (JSC::globalFuncUnescape):
+ * runtime/JSONObject.cpp:
+ (JSC::Stringifier::stringify):
+ (JSC::Stringifier::indent):
+ * runtime/JSString.h:
+ * runtime/LiteralParser.cpp:
+ (JSC::LiteralParser::Lexer::lexString):
+ * runtime/NumberPrototype.cpp:
+ (JSC::integerPartNoExp):
+ (JSC::numberProtoFuncToFixed):
+ (JSC::numberProtoFuncToPrecision):
+ * runtime/Operations.h:
+ (JSC::jsString):
+ * runtime/StringPrototype.cpp:
+ (JSC::substituteBackreferencesSlow):
+ (JSC::substituteBackreferences):
+ (JSC::stringProtoFuncConcat):
+
+2009-12-08 Jeremy Moskovich <jeremy@chromium.org>
+
+ Reviewed by Eric Seidel.
+
+ Add code to allow toggling ATSUI/Core Text rendering at runtime in ComplexTextController.
+ https://bugs.webkit.org/show_bug.cgi?id=31802
+
+ The goal here is to allow for a zero runtime hit for ports that decide to select
+ the API at compile time.
+ When both USE(ATSUI) and USE(CORE_TEXT) are true, the API is toggled
+ at runtime. Core Text is used for OS Versions >= 10.6.
+
+ * wtf/Platform.h: #define USE_CORE_TEXT and USE_ATSUI on Chrome/Mac.
+
+2009-12-11 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Unify codegen for forward and backward variants of branches
+ https://bugs.webkit.org/show_bug.cgi?id=32463
+
+ * jit/JIT.h:
+ (JSC::JIT::emit_op_loop): Implemented in terms of forward variant.
+ (JSC::JIT::emit_op_loop_if_true): ditto
+ (JSC::JIT::emitSlow_op_loop_if_true): ditto
+ (JSC::JIT::emit_op_loop_if_false): ditto
+ (JSC::JIT::emitSlow_op_loop_if_false): ditto
+ (JSC::JIT::emit_op_loop_if_less): ditto
+ (JSC::JIT::emitSlow_op_loop_if_less): ditto
+ * jit/JITOpcodes.cpp:
+
+2009-12-11 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Anders Carlsson.
+
+ Allow WTFs concept of the main thread to differ from pthreads when necessary.
+
+ * wtf/ThreadingPthreads.cpp:
+ (WTF::initializeThreading):
+ (WTF::isMainThread):
+ * wtf/mac/MainThreadMac.mm:
+ (WTF::initializeMainThreadPlatform):
+ (WTF::scheduleDispatchFunctionsOnMainThread):
+
+2009-12-11 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ https://bugs.webkit.org/show_bug.cgi?id=32454
+ Refactor construction of simple strings to avoid string concatenation.
+
+ Building strings through concatenation has a memory and performance cost -
+ a memory cost since we must over-allocate the buffer to leave space to append
+ into, and performance in that the string may still require reallocation (and
+ thus copying during construction). Instead move the full construction to
+ within a single function call (makeString), so that the arguments' lengths
+ can be calculated and an appropriate sized buffer allocated before copying
+ any characters.
+
+ ~No performance change (~2% progression on date tests).
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::escapeQuotes):
+ (JSC::valueToSourceString):
+ (JSC::constantName):
+ (JSC::idName):
+ (JSC::CodeBlock::registerName):
+ (JSC::regexpToSourceString):
+ (JSC::regexpName):
+ * bytecompiler/NodesCodegen.cpp:
+ (JSC::substitute):
+ * profiler/Profiler.cpp:
+ (JSC::Profiler::createCallIdentifier):
+ * runtime/DateConstructor.cpp:
+ (JSC::callDate):
+ * runtime/DateConversion.cpp:
+ (JSC::formatDate):
+ (JSC::formatDateUTCVariant):
+ (JSC::formatTime):
+ (JSC::formatTimeUTC):
+ * runtime/DateConversion.h:
+ (JSC::):
+ * runtime/DatePrototype.cpp:
+ (JSC::dateProtoFuncToString):
+ (JSC::dateProtoFuncToUTCString):
+ (JSC::dateProtoFuncToDateString):
+ (JSC::dateProtoFuncToTimeString):
+ (JSC::dateProtoFuncToGMTString):
+ * runtime/ErrorPrototype.cpp:
+ (JSC::errorProtoFuncToString):
+ * runtime/ExceptionHelpers.cpp:
+ (JSC::createUndefinedVariableError):
+ (JSC::createErrorMessage):
+ (JSC::createInvalidParamError):
+ * runtime/FunctionPrototype.cpp:
+ (JSC::insertSemicolonIfNeeded):
+ (JSC::functionProtoFuncToString):
+ * runtime/ObjectPrototype.cpp:
+ (JSC::objectProtoFuncToString):
+ * runtime/RegExpConstructor.cpp:
+ (JSC::constructRegExp):
+ * runtime/RegExpObject.cpp:
+ (JSC::RegExpObject::match):
+ * runtime/RegExpPrototype.cpp:
+ (JSC::regExpProtoFuncCompile):
+ (JSC::regExpProtoFuncToString):
+ * runtime/StringPrototype.cpp:
+ (JSC::stringProtoFuncBig):
+ (JSC::stringProtoFuncSmall):
+ (JSC::stringProtoFuncBlink):
+ (JSC::stringProtoFuncBold):
+ (JSC::stringProtoFuncFixed):
+ (JSC::stringProtoFuncItalics):
+ (JSC::stringProtoFuncStrike):
+ (JSC::stringProtoFuncSub):
+ (JSC::stringProtoFuncSup):
+ (JSC::stringProtoFuncFontcolor):
+ (JSC::stringProtoFuncFontsize):
+ (JSC::stringProtoFuncAnchor):
+ * runtime/UString.h:
+ (JSC::):
+ (JSC::makeString):
+
+2009-12-10 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ https://bugs.webkit.org/show_bug.cgi?id=32400
+ Switch remaining cases of string addition to use ropes.
+
+ Re-landing r51975 - added toPrimitiveString method,
+ performs toPrimitive then subsequent toString operations.
+
+ ~1% progression on Sunspidey.
+
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+ * runtime/JSString.h:
+ (JSC::JSString::JSString):
+ (JSC::JSString::appendStringInConstruct):
+ * runtime/Operations.cpp:
+ (JSC::jsAddSlowCase):
+ * runtime/Operations.h:
+ (JSC::jsString):
+ (JSC::jsAdd):
+
+2009-12-11 Adam Roben <aroben@apple.com>
+
+ Windows build fix
+
+ * JavaScriptCore.vcproj/jsc/jscCommon.vsprops: Added
+ $(WebKitOutputDir)/include/private to the include path.
+
+2009-12-11 Adam Roben <aroben@apple.com>
+
+ Move QuartzCorePresent.h to include/private
+
+ This fixes other projects that use wtf/Platform.h
+
+ Rubber-stamped by Steve Falkenburg.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Let VS do its thang.
+ * JavaScriptCore.vcproj/JavaScriptCore/build-generated-files.sh: Write
+ QuartzCorePresent.h to $(WebKitOutputDir)/include/private.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops:
+ * JavaScriptCore.vcproj/WTF/WTFCommon.vsprops:
+ Added $(WebKitOutputDir)/include/private to the include path.
+
+2009-12-11 Adam Roben <aroben@apple.com>
+
+ Fix clean builds and everything rebuilding on every build
+
+ Reviewed by Sam Weinig.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/build-generated-files.sh: Don't
+ write out QuartzCorePresent.h if it exists but is older than
+ QuartzCore.h. Also, create the directory we write QuartzCorePresent.h
+ into first.
+
+2009-12-11 Adam Roben <aroben@apple.com>
+
+ Windows build fix for systems with spaces in their paths
+
+ * JavaScriptCore.vcproj/JavaScriptCore/build-generated-files.sh: Quote some paths.
+
+2009-12-11 Chris Marrin <cmarrin@apple.com>
+
+ Reviewed by Adam Roben.
+
+ Add check for presence of QuartzCore headers
+ https://bugs.webkit.org/show_bug.cgi?id=31856
+
+ The script now checks for the presence of QuartzCore.h. If present
+ it will turn on ACCELERATED_COMPOSITING and 3D_RENDERING to enable
+ HW compositing on Windows. The script writes QuartzCorePresent.h to
+ the build directory which has a define telling whether QuartzCore is
+ present.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/build-generated-files.sh:
+ * wtf/Platform.h:
+
+2009-12-11 Kent Tamura <tkent@chromium.org>
+
+ Reviewed by Darin Adler.
+
+ Fix a problem that JSC::gregorianDateTimeToMS() returns a negative
+ value for a huge year value.
+ https://bugs.webkit.org/show_bug.cgi?id=32304
+
+ * wtf/DateMath.cpp:
+ (WTF::dateToDaysFrom1970): Renamed from dateToDayInYear, and changed the return type to double.
+ (WTF::calculateDSTOffset): Follow the dateToDaysFrom1970() change.
+ (WTF::timeClip): Use maxECMAScriptTime.
+ (JSC::gregorianDateTimeToMS): Follow the dateToDaysFrom1970() change.
+
+2009-12-10 Adam Barth <abarth@webkit.org>
+
+ No review, rolling out r51975.
+ http://trac.webkit.org/changeset/51975
+
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+ * runtime/JSString.h:
+ (JSC::JSString::JSString):
+ (JSC::JSString::appendStringInConstruct):
+ * runtime/Operations.cpp:
+ (JSC::jsAddSlowCase):
+ * runtime/Operations.h:
+ (JSC::jsString):
+ (JSC::jsAdd):
+
+2009-12-10 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Incorrect caching of prototype lookup with dictionary base
+ https://bugs.webkit.org/show_bug.cgi?id=32402
+
+ Make sure we don't add cached prototype lookup to the proto_list
+ lookup chain if the top level object is a dictionary.
+
+ * jit/JITStubs.cpp:
+ (JSC::JITThunks::tryCacheGetByID):
+
+2009-12-10 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ https://bugs.webkit.org/show_bug.cgi?id=32400
+ Switch remaining cases of string addition to use ropes.
+
+ ~1% progression on Sunspidey.
+
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+ * runtime/JSString.h:
+ (JSC::JSString::JSString):
+ (JSC::JSString::appendStringInConstruct):
+ * runtime/Operations.cpp:
+ (JSC::jsAddSlowCase):
+ * runtime/Operations.h:
+ (JSC::jsString):
+ (JSC::jsAdd):
+
+2009-12-10 Kent Hansen <kent.hansen@nokia.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Remove JSObject::getPropertyAttributes() and all usage of it.
+ https://bugs.webkit.org/show_bug.cgi?id=31933
+
+ getOwnPropertyDescriptor() should be used instead.
+
+ * JavaScriptCore.exp:
+ * JavaScriptCore.order:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * debugger/DebuggerActivation.cpp:
+ (JSC::DebuggerActivation::getOwnPropertyDescriptor):
+ * debugger/DebuggerActivation.h:
+ * runtime/JSObject.cpp:
+ (JSC::JSObject::propertyIsEnumerable):
+ * runtime/JSObject.h:
+ * runtime/JSVariableObject.cpp:
+ * runtime/JSVariableObject.h:
+
+2009-12-10 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt & Mark Rowe.
+
+ https://bugs.webkit.org/show_bug.cgi?id=32367
+ Add support for short Ropes (up to 3 entries) inline within JSString.
+ (rather than externally allocating an object to hold the rope).
+ Switch jsAdd of (JSString* + JSString*) to now make use of Ropes.
+
+ ~1% progression on Sunspidey.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+ * runtime/JSString.cpp:
+ (JSC::JSString::resolveRope):
+ (JSC::JSString::toBoolean):
+ (JSC::JSString::getStringPropertyDescriptor):
+ * runtime/JSString.h:
+ (JSC::JSString::Rope::Fiber::deref):
+ (JSC::JSString::Rope::Fiber::ref):
+ (JSC::JSString::Rope::Fiber::refAndGetLength):
+ (JSC::JSString::Rope::append):
+ (JSC::JSString::JSString):
+ (JSC::JSString::~JSString):
+ (JSC::JSString::value):
+ (JSC::JSString::tryGetValue):
+ (JSC::JSString::length):
+ (JSC::JSString::canGetIndex):
+ (JSC::JSString::appendStringInConstruct):
+ (JSC::JSString::appendValueInConstructAndIncrementLength):
+ (JSC::JSString::isRope):
+ (JSC::JSString::string):
+ (JSC::JSString::ropeLength):
+ (JSC::JSString::getStringPropertySlot):
+ * runtime/Operations.h:
+ (JSC::jsString):
+ (JSC::jsAdd):
+ (JSC::resolveBase):
+
+2009-12-09 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Fix three more things found by compiling with clang++.
+
+ * runtime/Structure.h:
+ (JSC::StructureTransitionTable::reifySingleTransition):
+ Add the 'std' qualifier to the call to make_pair.
+
+ * wtf/DateMath.cpp:
+ (WTF::initializeDates):
+ Incrementing a bool is deprecated according to the C++ specification.
+
+ * wtf/PtrAndFlags.h:
+ (WTF::PtrAndFlags::PtrAndFlags):
+ Name lookup should not be done in dependent bases, so explicitly qualify the call to set.
+
+2009-12-09 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Google reader gets stuck in the "Loading..." state and does not complete
+ https://bugs.webkit.org/show_bug.cgi?id=32256
+ <rdar://problem/7456388>
+
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emitSlow_op_jless): Fix some backward branches.
+
+2009-12-09 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ https://bugs.webkit.org/show_bug.cgi?id=32228
+ Make destruction of ropes non-recursive to prevent stack exhaustion.
+ Also, pass a UString& into initializeFiber rather than a Ustring::Rep*,
+ since the Rep is not being ref counted this could result in usage of a
+ Rep with refcount zero (where the Rep comes from a temporary UString
+ returned from a function).
+
+ * runtime/JSString.cpp:
+ (JSC::JSString::Rope::destructNonRecursive):
+ (JSC::JSString::Rope::~Rope):
+ * runtime/JSString.h:
+ (JSC::JSString::Rope::initializeFiber):
+ * runtime/Operations.h:
+ (JSC::concatenateStrings):
+
+2009-12-09 Zoltan Herczeg <zherczeg@inf.u-szeged.hu>
+
+ Reviewed by Eric Seidel.
+
+ https://bugs.webkit.org/show_bug.cgi?id=31930
+
+ Update to r51457. ASSERTs changed to COMPILE_ASSERTs.
+ The speedup is 25%.
+
+ * runtime/JSGlobalData.cpp:
+ (JSC::VPtrSet::VPtrSet):
+
+2009-12-09 Steve Block <steveblock@google.com>
+
+ Reviewed by Adam Barth.
+
+ Updates Android Makefiles with latest additions.
+ https://bugs.webkit.org/show_bug.cgi?id=32278
+
+ * Android.mk: Modified.
+ * Android.v8.wtf.mk: Modified.
+
+2009-12-09 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Gavin Barraclough.
+
+ Fix a bug found while trying to compile JavaScriptCore with clang++.
+
+ * yarr/RegexPattern.h:
+ (JSC::Yarr::PatternTerm::PatternTerm): Don't self assign here. Use false instead.
+
+2009-12-09 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Attempt to fix the Windows build.
+
+ * wtf/FastMalloc.h:
+
+2009-12-09 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Fix some things found while trying to compile JavaScriptCore with clang++.
+
+ * wtf/FastMalloc.h:
+ Add correct exception specifications for the allocation/deallocation operators.
+
+ * wtf/Vector.h:
+ * wtf/VectorTraits.h:
+ Fix a bunch of struct/class mismatches.
+
+2009-12-08 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin Adler.
+
+ move code generation portions of Nodes.cpp to bytecompiler directory
+ https://bugs.webkit.org/show_bug.cgi?id=32284
+
+ * bytecompiler/NodesCodegen.cpp: Copied from parser/Nodes.cpp. Removed parts that
+ are not about codegen.
+ * parser/Nodes.cpp: Removed everything that is about codegen.
+
+ Update build systems:
+
+ * Android.mk:
+ * GNUmakefile.am:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.pri:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * JavaScriptCoreSources.bkl:
+
+2009-12-08 Kevin Watters <kevinwatters@gmail.com>
+
+ Reviewed by Kevin Ollivier.
+
+ [wx] Mac plugins support.
+
+ https://bugs.webkit.org/show_bug.cgi?id=32236
+
+ * wtf/Platform.h:
+
+2009-12-08 Dmitry Titov <dimich@chromium.org>
+
+ Rubber-stamped by David Levin.
+
+ Revert and reopen "Add asserts to RefCounted to make sure ref/deref happens on the right thread."
+ It may have caused massive increase of reported leaks on the bots.
+ https://bugs.webkit.org/show_bug.cgi?id=31639
+
+ * GNUmakefile.am:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * runtime/Structure.cpp:
+ (JSC::Structure::Structure):
+ * wtf/RefCounted.h:
+ (WTF::RefCountedBase::ref):
+ (WTF::RefCountedBase::hasOneRef):
+ (WTF::RefCountedBase::refCount):
+ (WTF::RefCountedBase::derefBase):
+ * wtf/ThreadVerifier.h: Removed.
+
+2009-12-08 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk>
+
+ Reviewed by Darin Adler.
+
+ Make WebKit build correctly on FreeBSD, IA64, and Alpha.
+ Based on work by Petr Salinger <Petr.Salinger@seznam.cz>,
+ and Colin Watson <cjwatson@ubuntu.com>.
+
+ * wtf/Platform.h:
+
+2009-12-08 Dmitry Titov <dimich@chromium.org>
+
+ Reviewed by Darin Adler.
+
+ Add asserts to RefCounted to make sure ref/deref happens on the right thread.
+ https://bugs.webkit.org/show_bug.cgi?id=31639
+
+ * runtime/Structure.cpp:
+ (JSC::Structure::Structure): Disable thread verification on this class since it uses addressOfCount().
+ * wtf/RefCounted.h:
+ (WTF::RefCountedBase::ref): Add ASSERT.
+ (WTF::RefCountedBase::hasOneRef): Ditto.
+ (WTF::RefCountedBase::refCount): Ditto.
+ (WTF::RefCountedBase::derefBase): Ditto.
+ (WTF::RefCountedBase::disableThreadVerification): delegate to ThreadVerifier method.
+ * wtf/ThreadVerifier.h: Added.
+ (WTF::ThreadVerifier::ThreadVerifier): New Debug-only class to verify that ref/deref of RefCounted is done on the same thread.
+ (WTF::ThreadVerifier::activate): Activates checks. Called when ref count becomes above 2.
+ (WTF::ThreadVerifier::deactivate): Deactivates checks. Called when ref count drops below 2.
+ (WTF::ThreadVerifier::disableThreadVerification): used on objects that should not be checked (StringImpl etc)
+ (WTF::ThreadVerifier::verifyThread):
+ * GNUmakefile.am: Add ThreadVerifier.h to the build file.
+ * JavaScriptCore.gypi: Ditto.
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj: Ditto.
+ * JavaScriptCore.xcodeproj/project.pbxproj: Ditto.
+
+2009-12-08 Steve Block <steveblock@google.com>
+
+ Reviewed by Adam Barth.
+
+ [Android] Adds Makefiles for Android port.
+ https://bugs.webkit.org/show_bug.cgi?id=31325
+
+ * Android.mk: Added.
+ * Android.v8.wtf.mk: Added.
+
+2009-12-07 Dmitry Titov <dimich@chromium.org>
+
+ Rubber-stamped by Darin Adler.
+
+ Remove ENABLE_SHARED_SCRIPT flags
+ https://bugs.webkit.org/show_bug.cgi?id=32245
+ This patch was obtained by "git revert" command and then un-reverting of ChangeLog files.
+
+ * Configurations/FeatureDefines.xcconfig:
+ * wtf/Platform.h:
+
+2009-12-07 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by NOBODY (Windows build fixage part I).
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2009-12-05 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ https://bugs.webkit.org/show_bug.cgi?id=32184
+ Handle out-of-memory conditions with JSC Ropes with a JS exception, rather than crashing.
+ Switch from using fastMalloc to tryFastMalloc, pass an ExecState to record the exception on.
+
+ * API/JSCallbackObjectFunctions.h:
+ (JSC::::toString):
+ * API/JSValueRef.cpp:
+ (JSValueIsStrictEqual):
+ * JavaScriptCore.exp:
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::emitEqualityOp):
+ * debugger/DebuggerCallFrame.cpp:
+ (JSC::DebuggerCallFrame::functionName):
+ (JSC::DebuggerCallFrame::calculatedFunctionName):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::callEval):
+ (JSC::Interpreter::privateExecute):
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+ * profiler/ProfileGenerator.cpp:
+ (JSC::ProfileGenerator::addParentForConsoleStart):
+ * profiler/Profiler.cpp:
+ (JSC::Profiler::willExecute):
+ (JSC::Profiler::didExecute):
+ (JSC::Profiler::createCallIdentifier):
+ (JSC::createCallIdentifierFromFunctionImp):
+ * profiler/Profiler.h:
+ * runtime/ArrayPrototype.cpp:
+ (JSC::arrayProtoFuncIndexOf):
+ (JSC::arrayProtoFuncLastIndexOf):
+ * runtime/DateConstructor.cpp:
+ (JSC::constructDate):
+ * runtime/FunctionPrototype.cpp:
+ (JSC::functionProtoFuncToString):
+ * runtime/InternalFunction.cpp:
+ (JSC::InternalFunction::name):
+ (JSC::InternalFunction::displayName):
+ (JSC::InternalFunction::calculatedDisplayName):
+ * runtime/InternalFunction.h:
+ * runtime/JSCell.cpp:
+ (JSC::JSCell::getString):
+ * runtime/JSCell.h:
+ (JSC::JSValue::getString):
+ * runtime/JSONObject.cpp:
+ (JSC::gap):
+ (JSC::Stringifier::Stringifier):
+ (JSC::Stringifier::appendStringifiedValue):
+ * runtime/JSObject.cpp:
+ (JSC::JSObject::putDirectFunction):
+ (JSC::JSObject::putDirectFunctionWithoutTransition):
+ (JSC::JSObject::defineOwnProperty):
+ * runtime/JSObject.h:
+ * runtime/JSPropertyNameIterator.cpp:
+ (JSC::JSPropertyNameIterator::get):
+ * runtime/JSString.cpp:
+ (JSC::JSString::Rope::~Rope):
+ (JSC::JSString::resolveRope):
+ (JSC::JSString::getPrimitiveNumber):
+ (JSC::JSString::toNumber):
+ (JSC::JSString::toString):
+ (JSC::JSString::toThisString):
+ (JSC::JSString::getStringPropertyDescriptor):
+ * runtime/JSString.h:
+ (JSC::JSString::Rope::createOrNull):
+ (JSC::JSString::Rope::operator new):
+ (JSC::JSString::value):
+ (JSC::JSString::tryGetValue):
+ (JSC::JSString::getIndex):
+ (JSC::JSString::getStringPropertySlot):
+ (JSC::JSValue::toString):
+ * runtime/JSValue.h:
+ * runtime/NativeErrorConstructor.cpp:
+ (JSC::NativeErrorConstructor::NativeErrorConstructor):
+ * runtime/Operations.cpp:
+ (JSC::JSValue::strictEqualSlowCase):
+ * runtime/Operations.h:
+ (JSC::JSValue::equalSlowCaseInline):
+ (JSC::JSValue::strictEqualSlowCaseInline):
+ (JSC::JSValue::strictEqual):
+ (JSC::jsLess):
+ (JSC::jsLessEq):
+ (JSC::jsAdd):
+ (JSC::concatenateStrings):
+ * runtime/PropertyDescriptor.cpp:
+ (JSC::PropertyDescriptor::equalTo):
+ * runtime/PropertyDescriptor.h:
+ * runtime/StringPrototype.cpp:
+ (JSC::stringProtoFuncReplace):
+ (JSC::stringProtoFuncToLowerCase):
+ (JSC::stringProtoFuncToUpperCase):
+
+2009-12-07 Nikolas Zimmermann <nzimmermann@rim.com>
+
+ Reviewed by Holger Freyther.
+
+ Turn on (SVG) Filters support, by default.
+ https://bugs.webkit.org/show_bug.cgi?id=32224
+
+ * Configurations/FeatureDefines.xcconfig: Enable FILTERS build flag.
+
+2009-12-07 Steve Falkenburg <sfalken@apple.com>
+
+ Build fix. Be flexible about which version of ICU is used on Windows.
+
+ * JavaScriptCore.vcproj/jsc/jscCommon.vsprops: Add optional xcopy commands to copy ICU 4.2.
+
+2009-12-07 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ op_loop_if_less JIT codegen is broken for 64-bit
+ https://bugs.webkit.org/show_bug.cgi?id=32221
+
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_loop_if_false): Fix codegen in this version - test was backwards.
+
+2009-12-07 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Object.create fails if properties on the descriptor are getters
+ https://bugs.webkit.org/show_bug.cgi?id=32219
+
+ Correctly initialise the PropertySlots with the descriptor object.
+
+ * runtime/ObjectConstructor.cpp:
+ (JSC::toPropertyDescriptor):
+
+2009-12-06 Maciej Stachowiak <mjs@apple.com>
+
+ Not reviewed, build fix.
+
+ Actually tested 64-bit *and* 32-bit build this time.
+
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_loop_if_false):
+
+2009-12-06 Maciej Stachowiak <mjs@apple.com>
+
+ Not reviewed, build fix.
+
+ Really really fix 64-bit build for prior patch (actually tested this time).
+
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_loop_if_false):
+ (JSC::JIT::emitSlow_op_loop_if_false):
+
+2009-12-06 Maciej Stachowiak <mjs@apple.com>
+
+ Not reviewed, build fix.
+
+ Really fix 64-bit build for prior patch.
+
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emitSlow_op_jless):
+
+2009-12-06 Maciej Stachowiak <mjs@apple.com>
+
+ Not reviewed, build fix.
+
+ Fix 64-bit build for prior patch.
+
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emitSlow_op_loop_if_less):
+
+2009-12-05 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ conway benchmark spends half it's time in op_less (jump fusion fails)
+ https://bugs.webkit.org/show_bug.cgi?id=32190
+
+ <1% speedup on SunSpider and V8
+ 2x speedup on "conway" benchmark
+
+ Two optimizations:
+ 1) Improve codegen for logical operators &&, || and ! in a condition context
+
+ When generating code for combinations of &&, || and !, in a
+ condition context (i.e. in an if statement or loop condition), we
+ used to produce a value, and then separately jump based on its
+ truthiness. Now we pass the false and true targets in, and let the
+ logical operators generate jumps directly. This helps in four
+ ways:
+
+ a) Individual clauses of a short-circuit logical operator can now
+ jump directly to the then or else clause of an if statement (or to
+ the top or exit of a loop) instead of jumping to a jump.
+
+ b) It used to be that jump fusion with the condition of the first
+ clause of a logical operator was inhibited, because the register
+ was ref'd to be used later, in the actual condition jump; this no
+ longer happens since a jump straight to the final target is
+ generated directly.
+
+ c) It used to be that jump fusion with the condition of the second
+ clause of a logical operator was inhibited, because there was a
+ jump target right after the second clause and before the actual
+ condition jump. But now it's no longer necessary for the first
+ clause to jump there so jump fusion is not blocked.
+
+ d) We avoid generating excess mov statements in some cases.
+
+ As a concrete example this source:
+
+ if (!((x < q && y < q) || (t < q && z < q))) {
+ // ...
+ }
+
+ Used to generate this bytecode:
+
+ [ 34] less r1, r-15, r-19
+ [ 38] jfalse r1, 7(->45)
+ [ 41] less r1, r-16, r-19
+ [ 45] jtrue r1, 14(->59)
+ [ 48] less r1, r-17, r-19
+ [ 52] jfalse r1, 7(->59)
+ [ 55] less r1, r-18, r-19
+ [ 59] jtrue r1, 17(->76)
+
+ And now generates this bytecode (also taking advantage of the second optimization below):
+
+ [ 34] jnless r-15, r-19, 8(->42)
+ [ 38] jless r-16, r-19, 26(->64)
+ [ 42] jnless r-17, r-19, 8(->50)
+ [ 46] jless r-18, r-19, 18(->64)
+
+ Note the jump fusion and the fact that there's less jump
+ indirection - three of the four jumps go straight to the target
+ clause instead of indirecting through another jump.
+
+ 2) Implement jless opcode to take advantage of the above, since we'll now often generate
+ a less followed by a jtrue where fusion is not forbidden.
+
+ * parser/Nodes.h:
+ (JSC::ExpressionNode::hasConditionContextCodegen): Helper function to determine
+ whether a node supports special conditional codegen. Return false as this is the default.
+ (JSC::ExpressionNode::emitBytecodeInConditionContext): Assert not reached - only really
+ defined for nodes that do have conditional codegen.
+ (JSC::UnaryOpNode::expr): Add const version.
+ (JSC::LogicalNotNode::hasConditionContextCodegen): Returne true only if subexpression
+ supports it.
+ (JSC::LogicalOpNode::hasConditionContextCodegen): Return true.
+ * parser/Nodes.cpp:
+ (JSC::LogicalNotNode::emitBytecodeInConditionContext): Implemented - just swap
+ the true and false targets for the child node.
+ (JSC::LogicalOpNode::emitBytecodeInConditionContext): Implemented - handle jumps
+ directly, improving codegen quality. Also handles further nested conditional codegen.
+ (JSC::ConditionalNode::emitBytecode): Use condition context codegen when available.
+ (JSC::IfNode::emitBytecode): ditto
+ (JSC::IfElseNode::emitBytecode): ditto
+ (JSC::DoWhileNode::emitBytecode): ditto
+ (JSC::WhileNode::emitBytecode): ditto
+ (JSC::ForNode::emitBytecode): ditto
+
+ * bytecode/Opcode.h:
+ - Added loop_if_false opcode - needed now that falsey jumps can be backwards.
+ - Added jless opcode to take advantage of new fusion opportunities.
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::dump): Handle above.
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::emitJumpIfTrue): Add peephole for less + jtrue ==> jless.
+ (JSC::BytecodeGenerator::emitJumpIfFalse): Add handling of backwrds falsey jumps.
+ * bytecompiler/BytecodeGenerator.h:
+ (JSC::BytecodeGenerator::emitNodeInConditionContext): Wrapper to handle tracking of
+ overly deep expressions etc.
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute): Implement the two new opcodes (loop_if_false, jless).
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass): Implement JIT support for the two new opcodes.
+ (JSC::JIT::privateCompileSlowCases): ditto
+ * jit/JIT.h:
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emit_op_jless):
+ (JSC::JIT::emitSlow_op_jless): ditto
+ (JSC::JIT::emitBinaryDoubleOp): ditto
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emitSlow_op_loop_if_less): ditto
+ (JSC::JIT::emit_op_loop_if_false): ditto
+ (JSC::JIT::emitSlow_op_loop_if_false): ditto
+ * jit/JITStubs.cpp:
+ * jit/JITStubs.h:
+ (JSC::):
+
+2009-12-04 Kent Hansen <kent.hansen@nokia.com>
+
+ Reviewed by Darin Adler.
+
+ JavaScript delete operator should return false for string properties
+ https://bugs.webkit.org/show_bug.cgi?id=32012
+
+ * runtime/StringObject.cpp:
+ (JSC::StringObject::deleteProperty):
+
+2009-12-03 Drew Wilson <atwilson@chromium.org>
+
+ Rolled back r51633 because it causes a perf regression in Chromium.
+
+ * wtf/Platform.h:
+
+2009-12-03 Gavin Barraclough <barraclough@apple.com>
+
+ Try and fix the Windows build.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: Export a symbol that should be exported.
+
+2009-12-03 Mark Rowe <mrowe@apple.com>
+
+ Try and fix the Mac build.
+
+ * JavaScriptCore.exp: Export a symbol that should be exported.
+
+2009-12-03 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ REGRESSION(4.0.3-48777): Crash in JSC::ExecState::propertyNames() (Debug-only?)
+ https://bugs.webkit.org/show_bug.cgi?id=32133
+
+ Work around odd GCC-ism and correct the scopechain for use by
+ calls made while a cachedcall is active on the callstack.
+
+ * interpreter/CachedCall.h:
+ (JSC::CachedCall::newCallFrame):
+ * runtime/JSArray.cpp:
+ (JSC::AVLTreeAbstractorForArrayCompare::compare_key_key):
+ * runtime/StringPrototype.cpp:
+ (JSC::stringProtoFuncReplace):
+
+2009-12-03 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver "Brraaaaiiiinnnnnzzzzzzzz" Hunt.
+
+ https://bugs.webkit.org/show_bug.cgi?id=32136
+ Add a rope representation to JSString. Presently JSString always holds its data in UString form.
+ Instead, allow the result of a string concatenation to be represented in a tree form - with a
+ variable sized, reference-counted rope node retaining a set of UString::Reps (or other rope nopes).
+
+ Strings must still currently be resolved down to a flat UString representation before being used,
+ but by holding the string in a rope representation during construction we can avoid copying data
+ until we know the final size of the string.
+
+ ~2% progression on SunSpider (~25% on date-format-xparb, ~20% on string-validate-input).
+
+ * JavaScriptCore.exp:
+
+ - Update exports.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+
+ - Make use of new JSString::length() method to avoid prematurely resolving ropes.
+
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+
+ - Switch the string length trampoline to read the length directly from JSString::m_length,
+ rather than from the JSString's UString::Rep's 'len' property.
+
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+
+ - Modify op_add such that addition of two strings, where either or both strings are already
+ in rope representation, produces a rope as a result.
+
+ * runtime/JSString.cpp:
+ (JSC::JSString::Rope::~Rope):
+ (JSC::copyChars):
+ (JSC::JSString::resolveRope):
+ (JSC::JSString::getPrimitiveNumber):
+ (JSC::JSString::toBoolean):
+ (JSC::JSString::toNumber):
+ (JSC::JSString::toString):
+ (JSC::JSString::toThisString):
+ (JSC::JSString::getStringPropertyDescriptor):
+ * runtime/JSString.h:
+ (JSC::JSString::Rope::Fiber::Fiber):
+ (JSC::JSString::Rope::Fiber::destroy):
+ (JSC::JSString::Rope::Fiber::isRope):
+ (JSC::JSString::Rope::Fiber::rope):
+ (JSC::JSString::Rope::Fiber::string):
+ (JSC::JSString::Rope::create):
+ (JSC::JSString::Rope::initializeFiber):
+ (JSC::JSString::Rope::ropeLength):
+ (JSC::JSString::Rope::stringLength):
+ (JSC::JSString::Rope::fibers):
+ (JSC::JSString::Rope::Rope):
+ (JSC::JSString::Rope::operator new):
+ (JSC::JSString::JSString):
+ (JSC::JSString::value):
+ (JSC::JSString::length):
+ (JSC::JSString::isRope):
+ (JSC::JSString::rope):
+ (JSC::JSString::string):
+ (JSC::JSString::canGetIndex):
+ (JSC::jsSingleCharacterSubstring):
+ (JSC::JSString::getIndex):
+ (JSC::jsSubstring):
+ (JSC::JSString::getStringPropertySlot):
+
+ - Add rope form.
+
+ * runtime/Operations.h:
+ (JSC::jsAdd):
+ (JSC::concatenateStrings):
+
+ - Update string concatenation, and addition of ropes, to produce ropes.
+
+ * runtime/StringObject.cpp:
+ (JSC::StringObject::getOwnPropertyNames):
+
+ - Make use of new JSString::length() method to avoid prematurely resolving ropes.
+
+2009-11-23 Jeremy Moskovich <jeremy@chromium.org>
+
+ Reviewed by Eric Seidel.
+
+ Switch Chrome/Mac to use Core Text APIs rather than ATSUI APIs.
+ https://bugs.webkit.org/show_bug.cgi?id=31802
+
+ No test since this is already covered by existing pixel tests.
+
+ * wtf/Platform.h: #define USE_CORE_TEXT for Chrome/Mac.
+
+2009-12-02 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Add files missed in prior patch.
+
+ * runtime/JSZombie.cpp:
+ (JSC::):
+ (JSC::JSZombie::leakedZombieStructure):
+ * runtime/JSZombie.h: Added.
+ (JSC::JSZombie::JSZombie):
+ (JSC::JSZombie::isZombie):
+ (JSC::JSZombie::classInfo):
+ (JSC::JSZombie::isGetterSetter):
+ (JSC::JSZombie::isAPIValueWrapper):
+ (JSC::JSZombie::isPropertyNameIterator):
+ (JSC::JSZombie::getCallData):
+ (JSC::JSZombie::getConstructData):
+ (JSC::JSZombie::getUInt32):
+ (JSC::JSZombie::toPrimitive):
+ (JSC::JSZombie::getPrimitiveNumber):
+ (JSC::JSZombie::toBoolean):
+ (JSC::JSZombie::toNumber):
+ (JSC::JSZombie::toString):
+ (JSC::JSZombie::toObject):
+ (JSC::JSZombie::markChildren):
+ (JSC::JSZombie::put):
+ (JSC::JSZombie::deleteProperty):
+ (JSC::JSZombie::toThisObject):
+ (JSC::JSZombie::toThisString):
+ (JSC::JSZombie::toThisJSString):
+ (JSC::JSZombie::getJSNumber):
+ (JSC::JSZombie::getOwnPropertySlot):
+
+2009-12-02 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Add zombies to JSC
+ https://bugs.webkit.org/show_bug.cgi?id=32103
+
+ Add a compile time flag to make the JSC collector replace "unreachable"
+ objects with zombie objects. The zombie object is a JSCell subclass that
+ ASSERTs on any attempt to use the JSCell methods. In addition there are
+ a number of additional assertions in bottleneck code to catch zombie usage
+ as quickly as possible.
+
+ Grrr. Argh. Brains.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * interpreter/Register.h:
+ (JSC::Register::Register):
+ * runtime/ArgList.h:
+ (JSC::MarkedArgumentBuffer::append):
+ (JSC::ArgList::ArgList):
+ * runtime/Collector.cpp:
+ (JSC::Heap::destroy):
+ (JSC::Heap::sweep):
+ * runtime/Collector.h:
+ * runtime/JSCell.h:
+ (JSC::JSCell::isZombie):
+ (JSC::JSValue::isZombie):
+ * runtime/JSValue.h:
+ (JSC::JSValue::decode):
+ (JSC::JSValue::JSValue):
+ * wtf/Platform.h:
+
+2009-12-01 Jens Alfke <snej@chromium.org>
+
+ Reviewed by Darin Adler.
+
+ Added variants of find/contains/add that allow a foreign key type to be used.
+ This will allow AtomicString-keyed maps to be queried by C string without
+ having to create a temporary AtomicString (see HTTPHeaderMap.)
+ The code for this is adapted from the equivalent in HashSet.h.
+
+ * wtf/HashMap.h:
+ (WTF::HashMap::find):
+ (WTF::HashMap::contains):
+ (WTF::HashMap::add):
+ * wtf/HashSet.h: Changed "method" to "function member" in a comment.
+
+2009-12-01 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk>
+
+ Revert 51551 because it broke GTK+.
+
+ * wtf/Platform.h:
+
+2009-11-30 Gavin Barraclough <barraclough@apple.com>
+
+ Windows Build fix. Reviewed by NOBODY.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2009-11-24 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Bug 31859 - Make world selection for JSC IsolatedWorlds automagical.
+
+ WebCore presently has to explicitly specify the world before entering into JSC,
+ which is a little fragile (particularly since property access via a
+ getter/setter might invoke execution). Instead derive the current world from
+ the lexical global object.
+
+ Remove the temporary duct tape of willExecute/didExecute virtual hooks on the JSGlobalData::ClientData - these are no longer necessary.
+
+ * API/JSBase.cpp:
+ (JSEvaluateScript):
+ * API/JSObjectRef.cpp:
+ (JSObjectCallAsFunction):
+ * JavaScriptCore.exp:
+ * runtime/JSGlobalData.cpp:
+ * runtime/JSGlobalData.h:
+
+2009-11-30 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] Remove obsolete PLATFORM(KDE) code
+ https://bugs.webkit.org/show_bug.cgi?id=31958
+
+ KDE is now using unpatched QtWebKit.
+
+ * parser/Lexer.cpp: Remove obsolete KDE_USE_FINAL guard
+ * wtf/Platform.h: Remove PLATFORM(KDE) definition and code
+ section that is guarded with it.
+
+2009-11-30 Jan-Arve Sæther <jan-arve.saether@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Fix compilation with win32-icc
+
+ The Intel compiler does not support the __has_trivial_constructor type
+ trait. The Intel Compiler can report itself as _MSC_VER >= 1400. The
+ reason for that is that the Intel Compiler depends on the Microsoft
+ Platform SDK, and in order to try to be "fully" MS compatible it will
+ "pretend" to be the same MS compiler as was shipped with the MS PSDK.
+ (Thus, compiling with win32-icc with VC8 SDK will make the source code
+ "think" the compiler at hand supports this type trait).
+
+ * wtf/TypeTraits.h:
+
+2009-11-29 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Eric Seidel.
+
+ [Qt] Mac build has JIT disabled
+ https://bugs.webkit.org/show_bug.cgi?id=31828
+
+ * wtf/Platform.h: Enable JIT for Qt Mac builds
+
+2009-11-28 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Eric Seidel.
+
+ Apply workaround for the limitation of VirtualFree with MEM_RELEASE to all ports running on Windows
+ https://bugs.webkit.org/show_bug.cgi?id=31943
+
+ * runtime/MarkStack.h:
+ (JSC::MarkStack::MarkStackArray::shrinkAllocation):
+
+2009-11-28 Zoltan Herczeg <zherczeg@inf.u-szeged.hu>
+
+ Reviewed by Gavin Barraclough.
+
+ https://bugs.webkit.org/show_bug.cgi?id=31930
+
+ Seems a typo. We don't need ~270k memory to determine the vptrs.
+
+ * runtime/JSGlobalData.cpp:
+ (JSC::VPtrSet::VPtrSet):
+
+2009-11-27 Shinichiro Hamaji <hamaji@chromium.org>
+
+ Unreviewed.
+
+ Move GOwnPtr* from wtf to wtf/gtk
+ https://bugs.webkit.org/show_bug.cgi?id=31793
+
+ Build fix for chromium after r51423.
+ Exclude gtk directory from chromium build.
+
+ * JavaScriptCore.gyp/JavaScriptCore.gyp:
+
+2009-11-25 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Incorrect behaviour of jneq_null in the interpreter
+ https://bugs.webkit.org/show_bug.cgi?id=31901
+
+ Correct the logic of jneq_null. This is already covered by existing tests.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+
+2009-11-26 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Oliver Hunt.
+
+ Move GOwnPtr* from wtf to wtf/gtk
+ https://bugs.webkit.org/show_bug.cgi?id=31793
+
+ * GNUmakefile.am: Change the path for GOwnPtr.*.
+ * JavaScriptCore.gyp/JavaScriptCore.gyp: Remove
+ GOwnPtr.cpp from the exclude list.
+ * JavaScriptCore.gypi: Change the path for GOwnPtr.*.
+ * wscript: Remove GOwnPtr.cpp from the exclude list.
+ * wtf/GOwnPtr.cpp: Removed.
+ * wtf/GOwnPtr.h: Removed.
+ * wtf/Threading.h: Change the path for GOwnPtr.h.
+ * wtf/gtk/GOwnPtr.cpp: Copied from JavaScriptCore/wtf/GOwnPtr.cpp.
+ * wtf/gtk/GOwnPtr.h: Copied from JavaScriptCore/wtf/GOwnPtr.h.
+ * wtf/unicode/glib/UnicodeGLib.h: Change the path for GOwnPtr.h.
+
+2009-11-24 Dmitry Titov <dimich@chromium.org>
+
+ Reviewed by Eric Seidel.
+
+ Add ENABLE_SHARED_SCRIPT feature define and flag for build-webkit
+ https://bugs.webkit.org/show_bug.cgi?id=31444
+
+ * Configurations/FeatureDefines.xcconfig:
+ * wtf/Platform.h:
+
+2009-11-24 Chris Marrin <cmarrin@apple.com>
+
+ Reviewed by Simon Fraser.
+
+ Add ability to enable ACCELERATED_COMPOSITING on Windows (currently disabled)
+ https://bugs.webkit.org/show_bug.cgi?id=27314
+
+ * wtf/Platform.h:
+
+2009-11-24 Jason Smith <dark.panda@gmail.com>
+
+ Reviewed by Alexey Proskuryakov.
+
+ RegExp#exec's returned Array-like object behaves differently from
+ regular Arrays
+ https://bugs.webkit.org/show_bug.cgi?id=31689
+
+ * JavaScriptCore/runtime/RegExpConstructor.cpp: ensure that undefined
+ values are added to the returned RegExpMatchesArray
+
+2009-11-24 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Alexey Proskuryakov.
+
+ JSON.stringify performance on undefined is very poor
+ https://bugs.webkit.org/show_bug.cgi?id=31839
+
+ Switch from a UString to a Vector<UChar> when building
+ the JSON string, allowing us to safely remove the substr-copy
+ we otherwise did when unwinding an undefined property.
+
+ Also turns out to be a ~5% speedup on stringification.
+
+ * runtime/JSONObject.cpp:
+ (JSC::Stringifier::StringBuilder::append):
+ (JSC::Stringifier::stringify):
+ (JSC::Stringifier::Holder::appendNextProperty):
+
+2009-11-24 Mark Rowe <mrowe@apple.com>
+
+ Fix production builds where the source tree may be read-only.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2009-11-23 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Include "config.h" to meet Coding Style Guidelines
+ https://bugs.webkit.org/show_bug.cgi?id=31792
+
+ * wtf/unicode/UTF8.cpp:
+ * wtf/unicode/glib/UnicodeGLib.cpp:
+ * wtf/unicode/wince/UnicodeWince.cpp:
+
+2009-11-23 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Streamlined some Math functions where we expect or know the result not
+ to be representable as an int.
+
+ SunSpider says 0.6% faster.
+
+ * runtime/JSNumberCell.h:
+ (JSC::JSValue::JSValue):
+ * runtime/JSValue.h:
+ (JSC::JSValue::):
+ (JSC::jsDoubleNumber):
+ (JSC::JSValue::JSValue): Added a function for making a numeric JSValue
+ and skipping the "can I encode this as an int?" check, avoiding the
+ overhead of int <-> double roundtripping and double <-> double comparison
+ and branching.
+
+ * runtime/MathObject.cpp:
+ (JSC::mathProtoFuncACos):
+ (JSC::mathProtoFuncASin):
+ (JSC::mathProtoFuncATan):
+ (JSC::mathProtoFuncATan2):
+ (JSC::mathProtoFuncCos):
+ (JSC::mathProtoFuncExp):
+ (JSC::mathProtoFuncLog):
+ (JSC::mathProtoFuncRandom):
+ (JSC::mathProtoFuncSin):
+ (JSC::mathProtoFuncSqrt):
+ (JSC::mathProtoFuncTan): For these functions, which we expect or know
+ to produce results not representable as ints, call jsDoubleNumber instead
+ of jsNumber.
+
+2009-11-23 Mark Rowe <mrowe@apple.com>
+
+ Unreviewed. Unbreak the regression tests after r51329.
+
+ * API/JSBase.cpp:
+ (JSEvaluateScript): Null-check clientData before dereferencing it.
+ * API/JSObjectRef.cpp:
+ (JSObjectCallAsFunction): Ditto.
+
+2009-11-23 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Part 1/3 of <rdar://problem/7377477> REGRESSION: Many web pages fail to render after interesting script runs in isolated world
+
+ Some clients of the JavaScriptCore API expect to be able to make callbacks over the JSC API,
+ and for this to automagically cause execution to take place in the world associated with the
+ global object associated with the ExecState (JSContextRef) passed. However this is not how
+ things work - the world must be explicitly set within WebCore.
+
+ Making this work just for API calls to evaluate & call will be a far from perfect solution,
+ since direct (non-API) use of JSC still relies on WebCore setting the current world correctly.
+ A better solution would be to make this all work automagically all throughout WebCore, but this
+ will require more refactoring.
+
+ Since the API is in JSC but worlds only exist in WebCore, add callbacks on the JSGlobalData::ClientData
+ to allow it to update the current world on entry/exit via the JSC API. This is temporary duck
+ tape, and should be removed once the current world no longer needs to be explicitly tracked.
+
+ * API/JSBase.cpp:
+ (JSEvaluateScript):
+ * API/JSObjectRef.cpp:
+ (JSObjectCallAsFunction):
+ * JavaScriptCore.exp:
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::ClientData::beginningExecution):
+ (JSC::JSGlobalData::ClientData::completedExecution):
+ * runtime/JSGlobalData.h:
+
+2009-11-23 Steve Block <steveblock@google.com>
+
+ Reviewed by Dmitry Titov.
+
+ Adds MainThreadAndroid.cpp with Android-specific WTF threading functions.
+ https://bugs.webkit.org/show_bug.cgi?id=31807
+
+ * wtf/android: Added.
+ * wtf/android/MainThreadAndroid.cpp: Added.
+ (WTF::timeoutFired):
+ (WTF::initializeMainThreadPlatform):
+ (WTF::scheduleDispatchFunctionsOnMainThread):
+
+2009-11-23 Alexey Proskuryakov <ap@apple.com>
+
+ Reviewed by Brady Eidson.
+
+ https://bugs.webkit.org/show_bug.cgi?id=31748
+ Make WebSocketHandleCFNet respect proxy auto-configuration files via CFProxySupport
+
+ * JavaScriptCore.exp: Export callOnMainThreadAndWait.
+
+2009-11-23 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Symbian] Fix lastIndexOf() for Symbian
+ https://bugs.webkit.org/show_bug.cgi?id=31773
+
+ Symbian soft floating point library has problems with operators
+ comparing NaN to numbers. Without a workaround lastIndexOf()
+ function does not work.
+
+ Patch developed by David Leong.
+
+ * runtime/StringPrototype.cpp:
+ (JSC::stringProtoFuncLastIndexOf):Add an extra test
+ to check for NaN for Symbian.
+
+2009-11-23 Steve Block <steveblock@google.com>
+
+ Reviewed by Eric Seidel.
+
+ Android port lacks implementation of atomicIncrement and atomicDecrement.
+ https://bugs.webkit.org/show_bug.cgi?id=31715
+
+ * wtf/Threading.h: Modified.
+ (WTF::atomicIncrement): Added Android implementation.
+ (WTF::atomicDecrement): Added Android implementation.
+
+2009-11-22 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Unreviewed.
+
+ [Qt] Sort source lists and remove obsolete comments
+ from the build system.
+
+ * JavaScriptCore.pri:
+
+2009-11-21 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Eric Seidel.
+
+ [Qt][Mac] Turn on multiple JavaScript threads for QtWebkit on Mac
+ https://bugs.webkit.org/show_bug.cgi?id=31753
+
+ * wtf/Platform.h:
+
+2009-11-19 Steve Block <steveblock@google.com>
+
+ Android port lacks configuration in Platform.h and config.h.
+ https://bugs.webkit.org/show_bug.cgi?id=31671
+
+ * wtf/Platform.h: Modified. Added Android-specific configuration.
+
+2009-11-19 Alexey Proskuryakov <ap@apple.com>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=31690
+ Make SocketStreamHandleCFNet work on Windows
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * wtf/MainThread.cpp:
+ (WTF::FunctionWithContext::FunctionWithContext):
+ (WTF::dispatchFunctionsFromMainThread):
+ (WTF::callOnMainThreadAndWait):
+ * wtf/MainThread.h:
+ Re-add callOnMainThreadAndWait(), which was removed in bug 23926.
+
+2009-11-19 Dmitry Titov <dimich@chromium.org>
+
+ Reviewed by David Levin.
+
+ isMainThread() on Chromium (Mac and Linux) is so slow it timeouts LayoutTests..
+ https://bugs.webkit.org/show_bug.cgi?id=31693
+
+ * wtf/ThreadingPthreads.cpp:
+ (WTF::initializeThreading): grab and use the pthread_t of the main thread instead of ThreadIdentifier.
+ (WTF::isMainThread): Ditto.
+
+2009-11-19 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Darin Adler.
+
+ Remove HAVE(STRING_H) guard from JavaScriptCore
+ https://bugs.webkit.org/show_bug.cgi?id=31668
+
+ * config.h:
+ * runtime/UString.cpp:
+
+2009-11-19 Dumitru Daniliuc <dumi@chromium.org>
+
+ Reviewed by Dmitry Titov.
+
+ Fixing a bug in MessageQueue::removeIf() that leads to an
+ assertion failure.
+
+ https://bugs.webkit.org/show_bug.cgi?id=31657
+
+ * wtf/MessageQueue.h:
+ (WTF::MessageQueue::removeIf):
+
+2009-11-19 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Darin Adler.
+
+ Remove HAVE(FLOAT_H) guard
+ https://bugs.webkit.org/show_bug.cgi?id=31661
+
+ JavaScriptCore has a dependency on float.h, there is
+ no need to guard float.h.
+
+ * runtime/DatePrototype.cpp: Remove include directive
+ for float.h as it is included in MathExtras.h already.
+ * runtime/Operations.cpp: Ditto.
+ * runtime/UString.cpp: Ditto.
+ * wtf/dtoa.cpp: Ditto.
+ * wtf/MathExtras.h: Remove HAVE(FLOAT_H) guard.
+ * wtf/Platform.h: Ditto.
+
+2009-11-19 Thiago Macieira <thiago.macieira@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Build fix for 32-bit Sparc machines: these machines are big-endian.
+
+ * wtf/Platform.h:
+
+2009-11-18 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] Remove support for Qt v4.3 or older versions
+ https://bugs.webkit.org/show_bug.cgi?id=29469
+
+ * JavaScriptCore.pro:
+ * jsc.pro:
+ * wtf/unicode/qt4/UnicodeQt4.h:
+
+2009-11-18 Kent Tamura <tkent@chromium.org>
+
+ Reviewed by Darin Adler.
+
+ Move UString::from(double) implementation to new
+ WTF::doubleToStringInJavaScriptFormat(), and expose it because WebCore
+ code will use it.
+ https://bugs.webkit.org/show_bug.cgi?id=31330
+
+ - Introduce new function createRep(const char*, unsigned) and
+ UString::UString(const char*, unsigned) to reduce 2 calls to strlen().
+ - Fix a bug that dtoa() doesn't update *rve if the input value is NaN
+ or Infinity.
+
+ No new tests because this doesn't change the behavior.
+
+ * JavaScriptCore.exp:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * runtime/UString.cpp:
+ (JSC::createRep):
+ (JSC::UString::UString):
+ (JSC::UString::from): Move the code to doubleToStringInJavaScriptFormat().
+ * runtime/UString.h:
+ * wtf/dtoa.cpp:
+ (WTF::dtoa): Fix a bug about rve.
+ (WTF::append): A helper for doubleToStringInJavaScriptFormat().
+ (WTF::doubleToStringInJavaScriptFormat): Move the code from UString::from(double).
+ * wtf/dtoa.h:
+
+2009-11-18 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] Remove WTF_USE_JAVASCRIPTCORE_BINDINGS as it is no longer used
+ https://bugs.webkit.org/show_bug.cgi?id=31643
+
+ * JavaScriptCore.pro:
+
+2009-11-18 Nate Chapin <japhet@chromium.org>
+
+ Reviewed by Darin Fisher.
+
+ Remove Chromium's unnecessary dependency on wtf's tcmalloc files.
+
+ https://bugs.webkit.org/show_bug.cgi?id=31648
+
+ * JavaScriptCore.gyp/JavaScriptCore.gyp:
+
+2009-11-18 Thiago Macieira <thiago.macieira@nokia.com>
+
+ Reviewed by Gavin Barraclough.
+
+ [Qt] Implement symbol hiding for JSC's JIT functions.
+
+ These functions are implemented directly in assembly, so they need the
+ proper directives to enable/disable visibility. On ELF systems, it's
+ .hidden, whereas on Mach-O systems (Mac) it's .private_extern. On
+ Windows, it's not necessary since you have to explicitly export. I
+ also implemented the AIX idiom, though it's unlikely anyone will
+ implement AIX/POWER JIT.
+ https://bugs.webkit.org/show_bug.cgi?id=30864
+
+ * jit/JITStubs.cpp:
+
+2009-11-18 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Interpreter may do an out of range access when throwing an exception in the profiler.
+ https://bugs.webkit.org/show_bug.cgi?id=31635
+
+ Add bounds check.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::throwException):
+
+2009-11-18 Gabor Loki <loki@inf.u-szeged.hu>
+
+ Reviewed by Darin Adler.
+
+ Fix the clobber list of cacheFlush for ARM and Thumb2 on Linux
+ https://bugs.webkit.org/show_bug.cgi?id=31631
+
+ * jit/ExecutableAllocator.h:
+ (JSC::ExecutableAllocator::cacheFlush):
+
+2009-11-18 Harald Fernengel <harald.fernengel@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Fix detection of linux-g++
+
+ Never use "linux-g++*" to check for linux-g++, since this will break embedded
+ builds which use linux-arm-g++ and friends. Use 'linux*-g++*' to check for any
+ g++ on linux mkspec.
+
+ * JavaScriptCore.pri:
+
+2009-11-17 Jon Honeycutt <jhoneycutt@apple.com>
+
+ Add JSContextRefPrivate.h to list of copied files.
+
+ Reviewed by Mark Rowe.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make:
+
+2009-11-17 Martin Robinson <martin.james.robinson@gmail.com>
+
+ Reviewed by Adam Barth.
+
+ [GTK] Style cleanup for GOwnPtr
+ https://bugs.webkit.org/show_bug.cgi?id=31506
+
+ Remove forward declaration in GOwnPtr and do some style cleanup.
+
+ * wtf/GOwnPtr.cpp:
+ * wtf/GOwnPtr.h:
+ (WTF::GOwnPtr::GOwnPtr):
+ (WTF::GOwnPtr::~GOwnPtr):
+ (WTF::GOwnPtr::get):
+ (WTF::GOwnPtr::release):
+ (WTF::GOwnPtr::outPtr):
+ (WTF::GOwnPtr::set):
+ (WTF::GOwnPtr::clear):
+ (WTF::GOwnPtr::operator*):
+ (WTF::GOwnPtr::operator->):
+ (WTF::GOwnPtr::operator!):
+ (WTF::GOwnPtr::operator UnspecifiedBoolType):
+ (WTF::GOwnPtr::swap):
+ (WTF::swap):
+ (WTF::operator==):
+ (WTF::operator!=):
+ (WTF::getPtr):
+ (WTF::freeOwnedGPtr):
+
+2009-11-17 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Incorrect use of JavaScriptCore API in DumpRenderTree
+ https://bugs.webkit.org/show_bug.cgi?id=31577
+
+ Add assertions to the 'toJS' functions to catch mistakes like
+ this early. Restructure existing code which blindly passed potentially
+ null values to toJS when forwarding exceptions so that a null check is
+ performed first.
+
+ * API/APICast.h:
+ (toJS):
+ (toJSForGC):
+ * API/JSCallbackObjectFunctions.h:
+ (JSC::::getOwnPropertySlot):
+ (JSC::::put):
+ (JSC::::deleteProperty):
+ (JSC::::construct):
+ (JSC::::hasInstance):
+ (JSC::::call):
+ (JSC::::toNumber):
+ (JSC::::toString):
+ (JSC::::staticValueGetter):
+ (JSC::::callbackGetter):
+ * API/tests/testapi.c: Fix errors in the API tester.
+ (MyObject_getProperty):
+ (MyObject_convertToType):
+ (EvilExceptionObject_convertToType):
+
+2009-11-16 Zoltan Herczeg <zherczeg@inf.u-szeged.hu>
+
+ Reviewed by Gavin Barraclough.
+
+ https://bugs.webkit.org/show_bug.cgi?id=31050
+
+ Minor fixes for JSVALUE32_64: branchConvertDoubleToInt32
+ failed on a CortexA8 CPU, but not on a simulator; and
+ JITCall.cpp modifications was somehow not committed to mainline.
+
+ * assembler/ARMAssembler.h:
+ (JSC::ARMAssembler::fmrs_r):
+ * assembler/MacroAssemblerARM.h:
+ (JSC::MacroAssemblerARM::branchConvertDoubleToInt32):
+ * jit/JITCall.cpp:
+ (JSC::JIT::compileOpCall):
+
+2009-11-16 Joerg Bornemann <joerg.bornemann@trolltech.com>
+
+ Reviewed by Simon Hausmann.
+
+ Fix Qt build on Windows CE 6.
+
+ * JavaScriptCore.pri: Add missing include path.
+ * wtf/Platform.h: Include ce_time.h for Windows CE 6.
+
+2009-11-13 Zoltan Herczeg <zherczeg@inf.u-szeged.hu>
+
+ Reviewed by Gavin Barraclough.
+
+ https://bugs.webkit.org/show_bug.cgi?id=31050
+
+ Adding optimization support for mode JSVALUE32_64
+ on ARM systems.
+
+ * jit/JIT.h:
+ * jit/JITCall.cpp:
+ (JSC::JIT::compileOpCall):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::emit_op_method_check):
+ (JSC::JIT::compileGetByIdHotPath):
+ (JSC::JIT::compileGetByIdSlowCase):
+ (JSC::JIT::emit_op_put_by_id):
+
+2009-11-14 Zoltan Herczeg <zherczeg@inf.u-szeged.hu>
+
+ Reviewed by Gavin Barraclough.
+
+ https://bugs.webkit.org/show_bug.cgi?id=31050
+
+ Adding JSVALUE32_64 support for ARM (but not turning it
+ on by default). All optimizations must be disabled, since
+ this patch is only the first of a series of patches.
+
+ During the work, a lot of x86 specific code revealed and
+ made platform independent.
+ See revisions: 50531 50541 50593 50594 50595
+
+ * assembler/ARMAssembler.h:
+ (JSC::ARMAssembler::):
+ (JSC::ARMAssembler::fdivd_r):
+ * assembler/MacroAssemblerARM.h:
+ (JSC::MacroAssemblerARM::lshift32):
+ (JSC::MacroAssemblerARM::neg32):
+ (JSC::MacroAssemblerARM::rshift32):
+ (JSC::MacroAssemblerARM::branchOr32):
+ (JSC::MacroAssemblerARM::set8):
+ (JSC::MacroAssemblerARM::setTest8):
+ (JSC::MacroAssemblerARM::loadDouble):
+ (JSC::MacroAssemblerARM::divDouble):
+ (JSC::MacroAssemblerARM::convertInt32ToDouble):
+ (JSC::MacroAssemblerARM::zeroDouble):
+ * jit/JIT.cpp:
+ * jit/JIT.h:
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ * jit/JITStubs.cpp:
+ * wtf/StdLibExtras.h:
+
+2009-11-13 Dominik Röttsches <dominik.roettsches@access-company.com>
+
+ Reviewed by Eric Seidel.
+
+ Unify TextBoundaries implementations by only relying on WTF Unicode abstractions
+ https://bugs.webkit.org/show_bug.cgi?id=31468
+
+ Adding isAlphanumeric abstraction, required
+ by TextBoundaries.cpp.
+
+ * wtf/unicode/glib/UnicodeGLib.h:
+ (WTF::Unicode::isAlphanumeric):
+ * wtf/unicode/icu/UnicodeIcu.h:
+ (WTF::Unicode::isAlphanumeric):
+
+2009-11-13 Norbert Leser <norbert.leser&nokia.com>
+
+ Reviewed by Eric Seidel.
+
+ Added macros for USERINCLUDE paths within symbian blocks
+ to guarantee inclusion of respective header files from local path
+ first (to avoid clashes with same names of header files in system include path).
+
+ * JavaScriptCore.pri:
+
+2009-11-13 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ JSValueProtect and JSValueUnprotect don't protect API wrapper values
+ https://bugs.webkit.org/show_bug.cgi?id=31485
+
+ Make JSValueProtect/Unprotect use a new 'toJS' function, 'toJSForGC' that
+ does not attempt to to strip out API wrapper objects.
+
+ * API/APICast.h:
+ (toJSForGC):
+ * API/JSValueRef.cpp:
+ (JSValueProtect):
+ (JSValueUnprotect):
+ * API/tests/testapi.c:
+ (makeGlobalNumberValue):
+ (main):
+
+2009-11-13 İsmail Dönmez <ismail@namtrac.org>
+
+ Reviewed by Antti Koivisto.
+
+ Fix typo, ce_time.cpp should be ce_time.c
+
+ * JavaScriptCore.pri:
+
+2009-11-12 Steve VanDeBogart <vandebo@chromium.org>
+
+ Reviewed by Adam Barth.
+
+ Calculate the time offset only if we were able to parse
+ the date string. This saves an IPC in Chromium for
+ invalid date strings.
+ https://bugs.webkit.org/show_bug.cgi?id=31416
+
+ * wtf/DateMath.cpp:
+ (WTF::parseDateFromNullTerminatedCharacters):
+ (JSC::parseDateFromNullTerminatedCharacters):
+
+2009-11-12 Oliver Hunt <oliver@apple.com>
+
+ Rollout r50896 until i can work out why it causes failures.
+
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::emitReturn):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::execute):
+ * parser/Nodes.cpp:
+ (JSC::EvalNode::emitBytecode):
+
+2009-11-12 Steve Falkenburg <sfalken@apple.com>
+
+ Reviewed by Stephanie Lewis.
+
+ Remove LIBRARY directive from def file to fix Debug_All target.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2009-11-12 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk>
+
+ Rubber-stamped by Holger Freyther.
+
+ Revert r50204, since it makes DRT crash on 32 bits release builds
+ for GTK+.
+
+ * wtf/FastMalloc.h:
+
+2009-11-12 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Start unifying entry logic for function and eval code.
+
+ Eval now uses a ret instruction to end execution, and sets up
+ a callframe more in line with what we do for function entry.
+
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::emitReturn):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::execute):
+ * parser/Nodes.cpp:
+ (JSC::EvalNode::emitBytecode):
+
+2009-11-12 Richard Moe Gustavsen <richard.gustavsen@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] Disable pthread_setname_np.
+
+ This allows Qt builds on Mac from 10.6 to run on earlier version
+ where this symbol is not present.
+ https://bugs.webkit.org/show_bug.cgi?id=31403
+
+ * wtf/Platform.h:
+
+2009-11-12 Thiago Macieira <thiago.macieira@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] Fix linking on Linux 32-bit.
+
+ It was missing the ".text" directive at the top of the file,
+ indicating that code would follow. Without it, the assembler created
+ "NOTYPE" symbols, which would result in linker errors.
+ https://bugs.webkit.org/show_bug.cgi?id=30863
+
+ * jit/JITStubs.cpp:
+
+2009-11-11 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Refactor multiple JavaScriptCore threads
+ https://bugs.webkit.org/show_bug.cgi?id=31328
+
+ Remove the id field from the PlatformThread structure
+ as it is not used.
+
+ * runtime/Collector.cpp:
+ (JSC::getCurrentPlatformThread):
+ (JSC::suspendThread):
+ (JSC::resumeThread):
+ (JSC::getPlatformThreadRegisters):
+
+2009-11-10 Geoffrey Garen <ggaren@apple.com>
+
+ Linux build fix: Added an #include for UINT_MAX.
+
+ * runtime/WeakRandom.h:
+
+2009-11-10 Geoffrey Garen <ggaren@apple.com>
+
+ JavaScriptGlue build fix: Marked a file 'private' instead of 'project'.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2009-11-10 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Gavin "avGni arBalroguch" Barraclough.
+
+ Faster Math.random, based on GameRand.
+
+ SunSpider says 1.4% faster.
+
+ * GNUmakefile.am:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj: Added the header to the project.
+
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData):
+ * runtime/JSGlobalData.h: Use an object to track random number generation
+ state, initialized to the current time.
+
+ * runtime/MathObject.cpp:
+ (JSC::MathObject::MathObject):
+ (JSC::mathProtoFuncRandom): Use the new hotness.
+
+ * runtime/WeakRandom.h: Added.
+ (JSC::WeakRandom::WeakRandom):
+ (JSC::WeakRandom::get):
+ (JSC::WeakRandom::advance): The new hotness.
+
+2009-11-09 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Imported the v8 DST cache.
+
+ SunSpider says 1.5% faster.
+
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::resetDateCache): Reset the DST cache when resetting
+ other date data.
+
+ * runtime/JSGlobalData.h:
+ (JSC::DSTOffsetCache::DSTOffsetCache):
+ (JSC::DSTOffsetCache::reset): Added a struct for the DST cache.
+
+ * wtf/DateMath.cpp:
+ (WTF::calculateDSTOffsetSimple):
+ (WTF::calculateDSTOffset):
+ (WTF::parseDateFromNullTerminatedCharacters):
+ (JSC::getDSTOffset):
+ (JSC::gregorianDateTimeToMS):
+ (JSC::msToGregorianDateTime):
+ (JSC::parseDateFromNullTerminatedCharacters):
+ * wtf/DateMath.h: The imported code for probing and updating the cache.
+
+2009-11-09 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Fixed an edge case that could cause the engine not to notice a timezone
+ change.
+
+ No test because this case would require manual intervention to change
+ the timezone during the test.
+
+ SunSpider reports no change.
+
+ * runtime/DateInstanceCache.h:
+ (JSC::DateInstanceCache::DateInstanceCache):
+ (JSC::DateInstanceCache::reset): Added a helper function for resetting
+ this cache. Also, shrank the cache, since we'll be resetting it often.
+
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::resetDateCache): Include resetting the DateInstanceCache
+ in resetting Date data. (Otherwise, a cache hit could bypass a necessary
+ timezone update check.)
+
+2009-11-09 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Some manual inlining and constant propogation in Date code.
+
+ SunSpider reports a 0.4% speedup on date-*, no overall speedup. Shark
+ says some previously evident stalls are now gone.
+
+ * runtime/DateConstructor.cpp:
+ (JSC::callDate):
+ * runtime/DateConversion.cpp:
+ (JSC::formatTime):
+ (JSC::formatTimeUTC): Split formatTime into UTC and non-UTC variants.
+
+ * runtime/DateConversion.h:
+ * runtime/DateInstance.cpp:
+ (JSC::DateInstance::calculateGregorianDateTime):
+ (JSC::DateInstance::calculateGregorianDateTimeUTC):
+ * runtime/DateInstance.h:
+ (JSC::DateInstance::gregorianDateTime):
+ (JSC::DateInstance::gregorianDateTimeUTC): Split gregorianDateTime into
+ a UTC and non-UTC variant, and split each variant into a fast inline
+ case and a slow out-of-line case.
+
+ * runtime/DatePrototype.cpp:
+ (JSC::formatLocaleDate):
+ (JSC::dateProtoFuncToString):
+ (JSC::dateProtoFuncToUTCString):
+ (JSC::dateProtoFuncToISOString):
+ (JSC::dateProtoFuncToDateString):
+ (JSC::dateProtoFuncToTimeString):
+ (JSC::dateProtoFuncGetFullYear):
+ (JSC::dateProtoFuncGetUTCFullYear):
+ (JSC::dateProtoFuncToGMTString):
+ (JSC::dateProtoFuncGetMonth):
+ (JSC::dateProtoFuncGetUTCMonth):
+ (JSC::dateProtoFuncGetDate):
+ (JSC::dateProtoFuncGetUTCDate):
+ (JSC::dateProtoFuncGetDay):
+ (JSC::dateProtoFuncGetUTCDay):
+ (JSC::dateProtoFuncGetHours):
+ (JSC::dateProtoFuncGetUTCHours):
+ (JSC::dateProtoFuncGetMinutes):
+ (JSC::dateProtoFuncGetUTCMinutes):
+ (JSC::dateProtoFuncGetSeconds):
+ (JSC::dateProtoFuncGetUTCSeconds):
+ (JSC::dateProtoFuncGetTimezoneOffset):
+ (JSC::setNewValueFromTimeArgs):
+ (JSC::setNewValueFromDateArgs):
+ (JSC::dateProtoFuncSetYear):
+ (JSC::dateProtoFuncGetYear): Updated for the gregorianDateTime change above.
+
+2009-11-09 Geoffrey Garen <ggaren@apple.com>
+
+ Build fix: export a new symbol.
+
+ * JavaScriptCore.exp:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2009-11-09 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam "Home Wrecker" Weinig.
+
+ Added a tiny cache for Date parsing.
+
+ SunSpider says 1.2% faster.
+
+ * runtime/DateConversion.cpp:
+ (JSC::parseDate): Try to reuse the last parsed Date, if present.
+
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::resetDateCache):
+ * runtime/JSGlobalData.h: Added storage for last parsed Date. Refactored
+ this code to make resetting the date cache easier.
+
+ * runtime/JSGlobalObject.h:
+ (JSC::DynamicGlobalObjectScope::DynamicGlobalObjectScope): Updated for
+ refactoring.
+
+ * wtf/DateMath.cpp:
+ (JSC::parseDateFromNullTerminatedCharacters):
+ * wtf/DateMath.h: Changed ExecState to be first parameter, as is the JSC custom.
+
+2009-11-09 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Can cache prototype lookups on uncacheable dictionaries.
+ https://bugs.webkit.org/show_bug.cgi?id=31198
+
+ Replace fromDictionaryTransition with flattenDictionaryObject and
+ flattenDictionaryStructure. This change is necessary as we need to
+ guarantee that our attempt to convert away from a dictionary structure
+ will definitely succeed, and in some cases this requires mutating the
+ object storage itself.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::tryCacheGetByID):
+ * jit/JITStubs.cpp:
+ (JSC::JITThunks::tryCacheGetByID):
+ (JSC::DEFINE_STUB_FUNCTION):
+ * runtime/BatchedTransitionOptimizer.h:
+ (JSC::BatchedTransitionOptimizer::~BatchedTransitionOptimizer):
+ * runtime/JSObject.h:
+ (JSC::JSObject::flattenDictionaryObject):
+ * runtime/Operations.h:
+ (JSC::normalizePrototypeChain):
+ * runtime/Structure.cpp:
+ (JSC::Structure::flattenDictionaryStructure):
+ (JSC::comparePropertyMapEntryIndices):
+ * runtime/Structure.h:
+
+2009-11-09 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Not reviewed, build fix.
+
+ Remove extra character from r50701.
+
+ * JavaScriptCore.pri:
+
+2009-11-09 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Not reviewed, build fix.
+
+ Revert r50695 because it broke QtWebKit (clean builds).
+
+ * JavaScriptCore.pri:
+
+2009-11-09 Norbert Leser <norbert.leser@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Prepended $$PWD to GENERATED_SOURCES_DIR to avoid potential ambiguities when included from WebCore.pro.
+ Some preprocessors consider this GENERATED_SOURCES_DIR relative to current invoking dir (e.g., ./WebCore),
+ and not the working dir of JavaCriptCore.pri (i.e., ../JavaScriptCore/).
+
+ * JavaScriptCore.pri:
+
+2009-11-09 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Use explicit parentheses to silence gcc 4.4 -Wparentheses warnings
+ https://bugs.webkit.org/show_bug.cgi?id=31040
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+
+2009-11-08 David Levin <levin@chromium.org>
+
+ Reviewed by NOBODY (speculative snow leopard and windows build fixes).
+
+ * wtf/DateMath.cpp:
+ (WTF::parseDateFromNullTerminatedCharacters):
+ (JSC::gregorianDateTimeToMS):
+ (JSC::msToGregorianDateTime):
+ (JSC::parseDateFromNullTerminatedCharacters):
+ * wtf/DateMath.h:
+ (JSC::GregorianDateTime::GregorianDateTime):
+
+2009-11-08 David Levin <levin@chromium.org>
+
+ Reviewed by NOBODY (chromium build fix).
+
+ Hopefully, the last build fix.
+
+ Create better separation in DateMath about the JSC
+ and non-JSC portions. Also, only expose the non-JSC
+ version in the exports.
+
+ * JavaScriptCore.exp:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * wtf/DateMath.cpp:
+ (WTF::parseDateFromNullTerminatedCharacters):
+ (JSC::getUTCOffset):
+ (JSC::gregorianDateTimeToMS):
+ (JSC::msToGregorianDateTime):
+ (JSC::parseDateFromNullTerminatedCharacters):
+ * wtf/DateMath.h:
+ (JSC::gmtoffset):
+
+2009-11-08 David Levin <levin@chromium.org>
+
+ Reviewed by NOBODY (chromium build fix).
+
+ For the change in DateMath.
+
+ * config.h:
+ * wtf/DateMath.cpp:
+
+2009-11-06 Geoffrey Garen <ggaren@apple.com>
+
+ Windows build fix: export some symbols.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2009-11-06 Geoffrey Garen <ggaren@apple.com>
+
+ Build fix: updated export file.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
+2009-11-06 Geoffrey Garen <ggaren@apple.com>
+
+ Build fix: added some #includes.
+
+ * wtf/CurrentTime.h:
+ * wtf/DateMath.h:
+
+2009-11-06 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ https://bugs.webkit.org/show_bug.cgi?id=31197
+ Implemented a timezone cache not based on Mac OS X's notify_check API.
+
+ If the VM calculates the local timezone offset from UTC, it caches the
+ result until the end of the current VM invocation. (We don't want to cache
+ forever, because the user's timezone may change over time.)
+
+ This removes notify_* overhead on Mac, and, more significantly, removes
+ OS time and date call overhead on non-Mac platforms.
+
+ ~8% speedup on Date microbenchmark on Mac. SunSpider reports maybe a tiny
+ speedup on Mac. (Speedup on non-Mac platforms should be even more noticeable.)
+
+ * JavaScriptCore.exp:
+
+ * interpreter/CachedCall.h:
+ (JSC::CachedCall::CachedCall):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::execute):
+ * runtime/JSGlobalObject.h:
+ (JSC::DynamicGlobalObjectScope::DynamicGlobalObjectScope): Made the
+ DynamicGlobalObjectScope constructor responsible for checking whether a
+ dynamicGlobalObject has already been set. This eliminated some duplicate
+ client code, and allowed me to avoid adding even more duplicate client
+ code. Made DynamicGlobalObjectScope responsible for resetting the
+ local timezone cache upon first entry to the VM.
+
+ * runtime/DateConstructor.cpp:
+ (JSC::constructDate):
+ (JSC::callDate):
+ (JSC::dateParse):
+ (JSC::dateUTC):
+ * runtime/DateConversion.cpp:
+ (JSC::parseDate):
+ * runtime/DateConversion.h:
+ * runtime/DateInstance.cpp:
+ (JSC::DateInstance::gregorianDateTime):
+ * runtime/DateInstance.h:
+ * runtime/DateInstanceCache.h:
+ * runtime/DatePrototype.cpp:
+ (JSC::setNewValueFromTimeArgs):
+ (JSC::setNewValueFromDateArgs):
+ (JSC::dateProtoFuncSetYear):
+ * runtime/InitializeThreading.cpp:
+ (JSC::initializeThreadingOnce):
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData):
+ * runtime/JSGlobalData.h:
+ * wtf/DateMath.cpp:
+ (WTF::getCurrentUTCTime):
+ (WTF::getCurrentUTCTimeWithMicroseconds):
+ (WTF::getLocalTime):
+ (JSC::getUTCOffset): Use the new cache. Also, see below.
+ (JSC::gregorianDateTimeToMS):
+ (JSC::msToGregorianDateTime):
+ (JSC::initializeDates):
+ (JSC::parseDateFromNullTerminatedCharacters): Simplified the way this function
+ accounts for the local timezone offset, to accomodate our new caching API,
+ and a (possibly misguided) caller in WebCore. Also, see below.
+ * wtf/DateMath.h:
+ (JSC::GregorianDateTime::GregorianDateTime): Moved most of the code in
+ DateMath.* into the JSC namespace. The code needed to move so it could
+ naturally interact with ExecState and JSGlobalData to support caching.
+ Logically, it seemed right to move it, too, since this code is not really
+ as low-level as the WTF namespace might imply -- it implements a set of
+ date parsing and conversion quirks that are finely tuned to the JavaScript
+ language. Also removed the Mac OS X notify_* infrastructure.
+
+ * wtf/CurrentTime.h:
+ (WTF::currentTimeMS):
+ (WTF::getLocalTime): Moved the rest of the DateMath code here, and renamed
+ it to make it consistent with WTF's currentTime function.
+
+2009-11-06 Gabor Loki <loki@inf.u-szeged.hu>
+
+ Unreviewed trivial buildfix after r50595.
+
+ Rename the remaining rshiftPtr calls to rshift32
+
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emit_op_rshift):
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::emitFastArithImmToInt):
+
+2009-11-06 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Tidy up the shift methods on the macro-assembler interface.
+
+ Currently behaviour of shifts of a magnitude > 0x1f is undefined.
+ Instead defined that all shifts are masked to this range. This makes a lot of
+ practical sense, both since having undefined behaviour is not particularly
+ desirable, and because this behaviour is commonly required (particularly since
+ it is required bt ECMA-262 for shifts).
+
+ Update the ARM assemblers to provide this behaviour. Remove (now) redundant
+ masks from JITArithmetic, and remove rshiftPtr (this was used in case that
+ could be rewritten in a simpler form using rshift32, only optimized JSVALUE32
+ on x86-64, which uses JSVALUE64!)
+
+ * assembler/MacroAssembler.h:
+ * assembler/MacroAssemblerARM.h:
+ (JSC::MacroAssemblerARM::lshift32):
+ (JSC::MacroAssemblerARM::rshift32):
+ * assembler/MacroAssemblerARMv7.h:
+ (JSC::MacroAssemblerARMv7::lshift32):
+ (JSC::MacroAssemblerARMv7::rshift32):
+ * assembler/MacroAssemblerX86_64.h:
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emit_op_lshift):
+ (JSC::JIT::emit_op_rshift):
+
+2009-11-05 Gavin Barraclough <barraclough@apple.com>
+
+ Rubber Stamped by Oliver Hunt.
+
+ Remove a magic number (1) from the JIT, instead compute the value with OBJECT_OFFSET.
+
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::emitPutJITStubArg):
+ (JSC::JIT::emitPutJITStubArgConstant):
+ (JSC::JIT::emitGetJITStubArg):
+ (JSC::JIT::emitPutJITStubArgFromVirtualRegister):
+ * jit/JITStubCall.h:
+ (JSC::JITStubCall::JITStubCall):
+ (JSC::JITStubCall::getArgument):
+ * jit/JITStubs.h:
+
+2009-11-05 Zoltan Herczeg <zherczeg@inf.u-szeged.hu>
+
+ Reviewed by Gavin Barraclough.
+
+ https://bugs.webkit.org/show_bug.cgi?id=31159
+ Fix branchDouble behaviour on ARM THUMB2 JIT.
+
+ The x86 branchDouble behaviour is reworked, and all JIT
+ ports should follow the x86 port. See bug 31104 and 31151
+
+ This patch contains a fix for the traditional ARM port
+
+ * assembler/ARMAssembler.h:
+ (JSC::ARMAssembler::):
+ (JSC::ARMAssembler::fmrs_r):
+ (JSC::ARMAssembler::ftosid_r):
+ * assembler/MacroAssemblerARM.h:
+ (JSC::MacroAssemblerARM::):
+ (JSC::MacroAssemblerARM::branchDouble):
+ (JSC::MacroAssemblerARM::branchConvertDoubleToInt32):
+
+2009-11-05 Chris Jerdonek <chris.jerdonek@gmail.com>
+
+ Reviewed by Eric Seidel.
+
+ Removed the "this is part of the KDE project" comments from
+ all *.h, *.cpp, *.idl, and *.pm files.
+
+ https://bugs.webkit.org/show_bug.cgi?id=31167
+
+ The maintenance and architecture page in the project wiki lists
+ this as a task.
+
+ This change includes no changes or additions to test cases
+ since the change affects only comments.
+
+ * wtf/wince/FastMallocWince.h:
+
+2009-11-05 Gabor Loki <loki@inf.u-szeged.hu>
+
+ Reviewed by Gavin Barraclough.
+
+ Use ARMv7 specific encoding for immediate constants on ARMv7 target
+ https://bugs.webkit.org/show_bug.cgi?id=31060
+
+ * assembler/ARMAssembler.cpp:
+ (JSC::ARMAssembler::getOp2): Use INVALID_IMM
+ (JSC::ARMAssembler::getImm): Use encodeComplexImm for complex immediate
+ (JSC::ARMAssembler::moveImm): Ditto.
+ (JSC::ARMAssembler::encodeComplexImm): Encode a constant by one or two
+ instructions or a PC relative load.
+ * assembler/ARMAssembler.h: Use INVALID_IMM if a constant cannot be
+ encoded as an immediate constant.
+ (JSC::ARMAssembler::):
+ (JSC::ARMAssembler::movw_r): 16-bit immediate load
+ (JSC::ARMAssembler::movt_r): High halfword 16-bit immediate load
+ (JSC::ARMAssembler::getImm16Op2): Encode immediate constant for
+ movw_r and mowt_r
+
+2009-11-04 Mark Mentovai <mark@chromium.org>
+
+ Reviewed by Mark Rowe.
+
+ Provide TARGETING_TIGER and TARGETING_LEOPARD as analogues to
+ BUILDING_ON_TIGER and BUILDING_ON_LEOPARD. The TARGETING_ macros
+ consider the deployment target; the BUILDING_ON_ macros consider the
+ headers being built against.
+
+ * wtf/Platform.h:
+
+2009-11-04 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ https://bugs.webkit.org/show_bug.cgi?id=31151
+ Fix branchDouble behaviour on ARM THUMB2 JIT.
+
+ The ARMv7 JIT is currently using ARMv7Assembler::ConditionEQ to branch
+ for DoubleEqualOrUnordered, however this is incorrect - ConditionEQ won't
+ branch on unordered operands. Similarly, DoubleLessThanOrUnordered &
+ DoubleLessThanOrEqualOrUnordered use ARMv7Assembler::ConditionLO &
+ ARMv7Assembler::ConditionLS, whereas they should be using
+ ARMv7Assembler::ConditionLT & ARMv7Assembler::ConditionLE.
+
+ Fix these, and fill out the missing DoubleConditions.
+
+ * assembler/MacroAssemblerARMv7.h:
+ (JSC::MacroAssemblerARMv7::):
+ (JSC::MacroAssemblerARMv7::branchDouble):
+
+2009-11-04 Gavin Barraclough <barraclough@apple.com>
+
+ Rubber Stamped by Oliver Hunt.
+
+ Enable native call optimizations on ARMv7. (Existing ARM_TRADITIONAL
+ implementation was generic, worked perfectly, just needed turning on).
+
+ * jit/JITOpcodes.cpp:
+ * wtf/Platform.h:
+
+2009-11-04 Gavin Barraclough <barraclough@apple.com>
+
+ Rubber Stamped by Mark Rowe, Oliver Hunt, and Sam Weinig.
+
+ Add a missing assert to the ARMv7 JIT.
+
+ * assembler/ARMv7Assembler.h:
+ (JSC::ARMThumbImmediate::ARMThumbImmediate):
+
+2009-11-04 Mark Rowe <mrowe@apple.com>
+
+ Rubber-stamped by Oliver Hunt.
+
+ Remove bogus op_ prefix on dumped version of three opcodes.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::dump):
+
+2009-11-04 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Fix dumping of constants in bytecode so that they aren't printed as large positive register numbers.
+
+ We do this by having the registerName function return information about the constant if the register
+ number corresponds to a constant. This requires that registerName, and several functions that call it,
+ be converted to member functions of CodeBlock so that the constant value can be retrieved. The
+ ExecState also needs to be threaded down through these functions so that it can be passed on to
+ constantName when needed.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::constantName):
+ (JSC::CodeBlock::registerName):
+ (JSC::CodeBlock::printUnaryOp):
+ (JSC::CodeBlock::printBinaryOp):
+ (JSC::CodeBlock::printConditionalJump):
+ (JSC::CodeBlock::printGetByIdOp):
+ (JSC::CodeBlock::printPutByIdOp):
+ (JSC::CodeBlock::dump):
+ * bytecode/CodeBlock.h:
+ (JSC::CodeBlock::isConstantRegisterIndex):
+
+2009-11-04 Pavel Heimlich <tropikhajma@gmail.com>
+
+ Reviewed by Alexey Proskuryakov.
+
+ https://bugs.webkit.org/show_bug.cgi?id=30647
+ Solaris build failure due to strnstr.
+
+ * wtf/StringExtras.h: Enable strnstr on Solaris, too.
+
+2009-11-04 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ https://bugs.webkit.org/show_bug.cgi?id=31104
+ Refactor x86-specific behaviour out of the JIT.
+
+ - Add explicit double branch conditions for ordered and unordered comparisons (presently the brehaviour is a mix).
+ - Refactor double to int conversion out into the MacroAssembler.
+ - Remove broken double to int conversion for !JSVALUE32_64 builds - this code was broken and slowing us down, fixing it showed it not to be an improvement.
+ - Remove exclusion of double to int conversion from (1 % X) cases in JSVALUE32_64 builds - if this was of benefit this is no longer the case; simplify.
+
+ * assembler/MacroAssemblerARM.h:
+ (JSC::MacroAssemblerARM::):
+ * assembler/MacroAssemblerARMv7.h:
+ (JSC::MacroAssemblerARMv7::):
+ * assembler/MacroAssemblerX86Common.h:
+ (JSC::MacroAssemblerX86Common::):
+ (JSC::MacroAssemblerX86Common::convertInt32ToDouble):
+ (JSC::MacroAssemblerX86Common::branchDouble):
+ (JSC::MacroAssemblerX86Common::branchConvertDoubleToInt32):
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emitBinaryDoubleOp):
+ (JSC::JIT::emit_op_div):
+ (JSC::JIT::emitSlow_op_jnless):
+ (JSC::JIT::emitSlow_op_jnlesseq):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_jfalse):
+
+2009-11-04 Mark Mentovai <mark@chromium.org>
+
+ Reviewed by Eric Seidel.
+
+ Remove BUILDING_ON_LEOPARD from JavaScriptCore.gyp. This is supposed
+ to be set as needed only in wtf/Platform.h.
+
+ * JavaScriptCore.gyp/JavaScriptCore.gyp:
+
+2009-11-02 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ REGRESSION (r48573): JSC may incorrectly cache chain lookups with a dictionary at the head of the chain
+ https://bugs.webkit.org/show_bug.cgi?id=31045
+
+ Add guards to prevent caching of prototype chain lookups with dictionaries at the
+ head of the chain. Also add a few tighter assertions to cached prototype lookups
+ to catch this in future.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::tryCacheGetByID):
+ (JSC::Interpreter::privateExecute):
+ * jit/JITStubs.cpp:
+ (JSC::JITThunks::tryCacheGetByID):
+
+2009-11-02 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Darin Adler.
+
+ PLATFORM(CF) should be set when building for Qt on Darwin
+ https://bugs.webkit.org/show_bug.cgi?id=23671
+
+ * wtf/Platform.h: Turn on CF support if both QT and DARWIN
+ platforms are defined.
+
+2009-11-02 Dmitry Titov <dimich@chromium.org>
+
+ Reviewed by David Levin.
+
+ Remove threadsafe refcounting from tasks used with WTF::MessageQueue.
+ https://bugs.webkit.org/show_bug.cgi?id=30612
+
+ * wtf/MessageQueue.h:
+ (WTF::MessageQueue::alwaysTruePredicate):
+ (WTF::MessageQueue::~MessageQueue):
+ (WTF::MessageQueue::append):
+ (WTF::MessageQueue::appendAndCheckEmpty):
+ (WTF::MessageQueue::prepend):
+ (WTF::MessageQueue::waitForMessage):
+ (WTF::MessageQueue::waitForMessageFilteredWithTimeout):
+ (WTF::MessageQueue::tryGetMessage):
+ (WTF::MessageQueue::removeIf):
+ The MessageQueue is changed to act as a queue of OwnPtr<DataType>. It takes ownership
+ of posted tasks and passes it to the new owner (in another thread) when the task is fetched.
+ All methods have arguments of type PassOwnPtr<DataType> and return the same type.
+
+ * wtf/Threading.cpp:
+ (WTF::createThread):
+ Superficial change to trigger rebuild of JSC project on Windows,
+ workaround for https://bugs.webkit.org/show_bug.cgi?id=30890
+
+2009-10-30 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Fixed failing layout test: restore a special case I accidentally deleted.
+
+ * runtime/DatePrototype.cpp:
+ (JSC::setNewValueFromDateArgs): In the case of applying a change to a date
+ that is NaN, reset the date to 0 *and* then apply the change; don't just
+ reset the date to 0.
+
+2009-10-30 Geoffrey Garen <ggaren@apple.com>
+
+ Windows build fix: update for object-to-pointer change.
+
+ * runtime/DatePrototype.cpp:
+ (JSC::formatLocaleDate):
+
+2009-10-29 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=30942
+ Use pointers instead of copies to pass GregorianDateTime objects around.
+
+ SunSpider reports a shocking 4.5% speedup on date-format-xparb, and 1.3%
+ speedup on date-format-tofte.
+
+ * runtime/DateInstance.cpp:
+ (JSC::DateInstance::gregorianDateTime):
+ * runtime/DateInstance.h:
+ * runtime/DatePrototype.cpp:
+ (JSC::formatLocaleDate):
+ (JSC::dateProtoFuncToString):
+ (JSC::dateProtoFuncToUTCString):
+ (JSC::dateProtoFuncToISOString):
+ (JSC::dateProtoFuncToDateString):
+ (JSC::dateProtoFuncToTimeString):
+ (JSC::dateProtoFuncGetFullYear):
+ (JSC::dateProtoFuncGetUTCFullYear):
+ (JSC::dateProtoFuncToGMTString):
+ (JSC::dateProtoFuncGetMonth):
+ (JSC::dateProtoFuncGetUTCMonth):
+ (JSC::dateProtoFuncGetDate):
+ (JSC::dateProtoFuncGetUTCDate):
+ (JSC::dateProtoFuncGetDay):
+ (JSC::dateProtoFuncGetUTCDay):
+ (JSC::dateProtoFuncGetHours):
+ (JSC::dateProtoFuncGetUTCHours):
+ (JSC::dateProtoFuncGetMinutes):
+ (JSC::dateProtoFuncGetUTCMinutes):
+ (JSC::dateProtoFuncGetSeconds):
+ (JSC::dateProtoFuncGetUTCSeconds):
+ (JSC::dateProtoFuncGetTimezoneOffset):
+ (JSC::setNewValueFromTimeArgs):
+ (JSC::setNewValueFromDateArgs):
+ (JSC::dateProtoFuncSetYear):
+ (JSC::dateProtoFuncGetYear): Renamed getGregorianDateTime to gregorianDateTime,
+ since it no longer has an out parameter. Uses 0 to indicate invalid dates.
+
+2009-10-30 Zoltan Horvath <zoltan@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ Allow custom memory allocation control for JavaScriptCore's ListHashSet
+ https://bugs.webkit.org/show_bug.cgi?id=30853
+
+ Inherits ListHashSet class from FastAllocBase because it is
+ instantiated by 'new' in WebCore/rendering/RenderBlock.cpp:1813.
+
+ * wtf/ListHashSet.h:
+
+2009-10-30 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Regression: crash enumerating properties of an object with getters or setters
+ https://bugs.webkit.org/show_bug.cgi?id=30948
+
+ Add a guard to prevent us trying to cache property enumeration on
+ objects with getters or setters.
+
+ * runtime/JSPropertyNameIterator.cpp:
+ (JSC::JSPropertyNameIterator::create):
+
+2009-10-30 Roland Steiner <rolandsteiner@chromium.org>
+
+ Reviewed by Eric Seidel.
+
+ Remove ENABLE_RUBY guards as discussed with Dave Hyatt and Maciej Stachowiak.
+
+ Bug 28420 - Implement HTML5 <ruby> rendering
+ (https://bugs.webkit.org/show_bug.cgi?id=28420)
+
+ No new tests (no functional change).
+
+ * Configurations/FeatureDefines.xcconfig:
+
+2009-10-29 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ REGRESSION (r50218-r50262): E*TRADE accounts page is missing content
+ https://bugs.webkit.org/show_bug.cgi?id=30947
+ <rdar://problem/7348833>
+
+ The logic for flagging that a structure has non-enumerable properties
+ was in addPropertyWithoutTransition, rather than in the core Structure::put
+ method. Despite this I was unable to produce a testcase that caused
+ the failure that etrade was experiencing, but the new assertion in
+ getEnumerablePropertyNames triggers on numerous layout tests without
+ the fix, so in effecti all for..in enumeration in any test ends up
+ doing the required consistency check.
+
+ * runtime/Structure.cpp:
+ (JSC::Structure::addPropertyWithoutTransition):
+ (JSC::Structure::put):
+ (JSC::Structure::getEnumerablePropertyNames):
+ (JSC::Structure::checkConsistency):
+
+2009-10-29 Gabor Loki <loki@inf.u-szeged.hu>
+
+ Reviewed by Gavin Barraclough.
+
+ Add cacheFlush support for Thumb-2 on Linux
+ https://bugs.webkit.org/show_bug.cgi?id=30865
+
+ * jit/ExecutableAllocator.h:
+ (JSC::ExecutableAllocator::cacheFlush):
+
+2009-10-28 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ JSC JIT on ARMv7 cannot link jumps >16Mb range
+ https://bugs.webkit.org/show_bug.cgi?id=30891
+
+ Start planing all relative jumps as move-32-bit-immediate-to-register-BX.
+ In the cases where the jump would fall within a relative jump range, use a relative jump.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * assembler/ARMv7Assembler.h:
+ (JSC::ARMv7Assembler::~ARMv7Assembler):
+ (JSC::ARMv7Assembler::LinkRecord::LinkRecord):
+ (JSC::ARMv7Assembler::):
+ (JSC::ARMv7Assembler::executableCopy):
+ (JSC::ARMv7Assembler::linkJump):
+ (JSC::ARMv7Assembler::relinkJump):
+ (JSC::ARMv7Assembler::setInt32):
+ (JSC::ARMv7Assembler::isB):
+ (JSC::ARMv7Assembler::isBX):
+ (JSC::ARMv7Assembler::isMOV_imm_T3):
+ (JSC::ARMv7Assembler::isMOVT):
+ (JSC::ARMv7Assembler::isNOP_T1):
+ (JSC::ARMv7Assembler::isNOP_T2):
+ (JSC::ARMv7Assembler::linkJumpAbsolute):
+ (JSC::ARMv7Assembler::twoWordOp5i6Imm4Reg4EncodedImmFirst):
+ (JSC::ARMv7Assembler::twoWordOp5i6Imm4Reg4EncodedImmSecond):
+ (JSC::ARMv7Assembler::ARMInstructionFormatter::twoWordOp5i6Imm4Reg4EncodedImm):
+ * assembler/MacroAssemblerARMv7.h:
+ (JSC::MacroAssemblerARMv7::makeJump):
+ (JSC::MacroAssemblerARMv7::makeBranch):
+ * jit/JIT.h:
+ * wtf/Platform.h:
+
+2009-10-28 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Improve for..in enumeration performance
+ https://bugs.webkit.org/show_bug.cgi?id=30887
+
+ Improve indexing of an object with a for..in iterator by
+ identifying cases where get_by_val is being used with a iterator
+ as the subscript and replace it with a new get_by_pname
+ bytecode. get_by_pname then optimizes lookups that directly access
+ the base object.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::dump):
+ * bytecode/Opcode.h:
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::emitGetByVal):
+ * bytecompiler/BytecodeGenerator.h:
+ (JSC::BytecodeGenerator::pushOptimisedForIn):
+ (JSC::BytecodeGenerator::popOptimisedForIn):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ (JSC::JIT::privateCompileSlowCases):
+ * jit/JIT.h:
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::compileGetDirectOffset):
+ (JSC::JIT::emit_op_get_by_pname):
+ (JSC::JIT::emitSlow_op_get_by_pname):
+ * parser/Nodes.cpp:
+ (JSC::ForInNode::emitBytecode):
+ * runtime/JSObject.h:
+ * runtime/JSPropertyNameIterator.cpp:
+ (JSC::JSPropertyNameIterator::create):
+ * runtime/JSPropertyNameIterator.h:
+ (JSC::JSPropertyNameIterator::getOffset):
+ (JSC::JSPropertyNameIterator::JSPropertyNameIterator):
+ * runtime/JSValue.h:
+ (JSC::JSValue::):
+ * runtime/Structure.cpp:
+ (JSC::Structure::addPropertyTransition):
+ (JSC::Structure::changePrototypeTransition):
+ (JSC::Structure::despecifyFunctionTransition):
+ (JSC::Structure::addAnonymousSlotsTransition):
+ (JSC::Structure::getterSetterTransition):
+ (JSC::Structure::toDictionaryTransition):
+ (JSC::Structure::addPropertyWithoutTransition):
+ Track the existence (or not) of non-enumerable properties.
+ * runtime/Structure.h:
+ (JSC::Structure::propertyStorageCapacity):
+ (JSC::Structure::propertyStorageSize):
+ (JSC::Structure::hasNonEnumerableProperties):
+ (JSC::Structure::hasAnonymousSlots):
+
+2009-10-28 Dmitry Titov <dimich@chromium.org>
+
+ Not reviewed, attemp to fix Windows build.
+
+ Touch the cpp file to cause recompile.
+
+ * wtf/Threading.cpp:
+ (WTF::threadEntryPoint):
+
+2009-10-28 Dmitry Titov <dimich@chromium.org>
+
+ Reviewed by David Levin.
+
+ https://bugs.webkit.org/show_bug.cgi?id=30805
+ Add MessageQueue::removeIf(Predicate&) to remove certain tasks without pulling them from the queue.
+ Existing Database tests cover this since Database removes tasks when it is stopped.
+
+ * wtf/MessageQueue.h:
+ (WTF::::removeIf):
+
+2009-10-28 Afonso R. Costa Jr. <afonso.costa@openbossa.org>
+
+ Reviewed by Oliver Hunt.
+
+ [Qt] Enable YARR when YARR_JIT is enabled
+ https://bugs.webkit.org/show_bug.cgi?id=30730
+
+ When enabling or disabling JIT using JAVASCRIPTCORE_JIT, the ENABLE_YARR should
+ be toggled also.
+
+ * JavaScriptCore.pri:
+
+2009-10-24 Martin Robinson <martin.james.robinson@gmail.com>
+
+ Reviewed by Oliver Hunt.
+
+ Fix strict aliasing warning by switching reinterpret_cast to bitwise_cast.
+
+ strict-aliasing warnings in JSFunction.h
+ https://bugs.webkit.org/show_bug.cgi?id=27869
+
+ * runtime/JSFunction.h:
+ (JSC::JSFunction::nativeFunction):
+ (JSC::JSFunction::scopeChain):
+ (JSC::JSFunction::setScopeChain):
+ (JSC::JSFunction::setNativeFunction):
+
+2009-10-28 Jan-Arve Sæther <jan-arve.saether@nokia.com>
+
+ Reviewed by Tor Arne Vestbø.
+
+ Build-fix for 64-bit Windows
+
+ * wtf/Platform.h: Make sure to use WTF_USE_JSVALUE64
+
+2009-10-28 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by NOBODY (build fix!).
+
+ * jit/JIT.h:
+
+2009-10-26 Holger Hans Peter Freyther <zecke@selfish.org>
+
+ Rubber-stamped by Darin Adler.
+
+ Export fastMalloc, fastCalloc, fastRealloc and fastFree on GCC/Unix
+ https://bugs.webkit.org/show_bug.cgi?id=30769
+
+ When using -fvisibility=hidden to hide all internal symbols by default
+ the malloc symbols will be hidden as well. For memory instrumentation
+ it is needed to provide an instrumented version of these symbols and
+ override the normal routines and by changing the visibility back to
+ default this becomes possible.
+
+ The only other solution would be to use system malloc instead of the
+ TCmalloc implementation but this will not allow to analyze memory
+ behavior with the default allocator.
+
+ * wtf/FastMalloc.h: Define WTF_FAST_MALLOC_EXPORT for GCC and !darwin
+
+2009-10-27 Gavin Barraclough <barraclough@apple.com>
+
+ Rubber Stamped by Samuel Q. Weinig.
+
+ Make the asserts protecting the offsets in the JIT more descriptive.
+
+ * jit/JIT.h:
+ * jit/JITCall.cpp:
+ (JSC::JIT::compileOpCall):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::emit_op_method_check):
+ (JSC::JIT::compileGetByIdHotPath):
+ (JSC::JIT::compileGetByIdSlowCase):
+ (JSC::JIT::emit_op_put_by_id):
+
+2009-10-27 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ A little bit of refactoring in the date code.
+
+ * JavaScriptCore.exp: Don't export this unused symbol.
+
+ * runtime/DateConstructor.cpp:
+ (JSC::constructDate):
+
+ * runtime/DateInstance.cpp:
+ (JSC::DateInstance::DateInstance):
+ * runtime/DateInstance.h: Removed some unused functions. Changed the default
+ constructor to ensure that a DateInstance is always initialized.
+
+ * runtime/DatePrototype.cpp:
+ (JSC::DatePrototype::DatePrototype): Pass an initializer to our constructor,
+ since it now requires one.
+
+ * wtf/DateMath.cpp:
+ (WTF::msToGregorianDateTime): Only compute our offset from UTC if our
+ output will require it. Otherwise, our offset is 0.
+
+2009-10-27 Geoffrey Garen <ggaren@apple.com>
+
+ Build fix: Mark DateInstaceCache.h private, so other frameworks can see it.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2009-10-27 Geoffrey Garen <ggaren@apple.com>
+
+ Build fix: re-readded this file.
+
+ * runtime/DateInstanceCache.h: Added.
+ (JSC::DateInstanceData::create):
+ (JSC::DateInstanceData::DateInstanceData):
+ (JSC::DateInstanceCache::DateInstanceCache):
+ (JSC::DateInstanceCache::add):
+ (JSC::DateInstanceCache::lookup):
+
+2009-10-27 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler and Oliver Hunt.
+
+ https://bugs.webkit.org/show_bug.cgi?id=30800
+ Cache recently computed date data.
+
+ SunSpider reports a ~0.5% speedup, mostly from date-format-tofte.js.
+
+ * GNUmakefile.am:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj: Added new file.
+
+ * runtime/DateInstance.cpp:
+ (JSC::DateInstance::DateInstance):
+ (JSC::DateInstance::getGregorianDateTime): Use the shared cache.
+
+ * runtime/DateInstance.h: Renamed m_cache to m_data, to avoid the confusion
+ of a "cache cache".
+
+ * runtime/DatePrototype.cpp:
+ (JSC::formatLocaleDate):
+ (JSC::dateProtoFuncToString):
+ (JSC::dateProtoFuncToUTCString):
+ (JSC::dateProtoFuncToISOString):
+ (JSC::dateProtoFuncToDateString):
+ (JSC::dateProtoFuncToTimeString):
+ (JSC::dateProtoFuncGetFullYear):
+ (JSC::dateProtoFuncGetUTCFullYear):
+ (JSC::dateProtoFuncToGMTString):
+ (JSC::dateProtoFuncGetMonth):
+ (JSC::dateProtoFuncGetUTCMonth):
+ (JSC::dateProtoFuncGetDate):
+ (JSC::dateProtoFuncGetUTCDate):
+ (JSC::dateProtoFuncGetDay):
+ (JSC::dateProtoFuncGetUTCDay):
+ (JSC::dateProtoFuncGetHours):
+ (JSC::dateProtoFuncGetUTCHours):
+ (JSC::dateProtoFuncGetMinutes):
+ (JSC::dateProtoFuncGetUTCMinutes):
+ (JSC::dateProtoFuncGetSeconds):
+ (JSC::dateProtoFuncGetUTCSeconds):
+ (JSC::dateProtoFuncGetTimezoneOffset):
+ (JSC::setNewValueFromTimeArgs):
+ (JSC::setNewValueFromDateArgs):
+ (JSC::dateProtoFuncSetYear):
+ (JSC::dateProtoFuncGetYear): Pass an ExecState to these functions, so they
+ can access the DateInstanceCache.
+
+ * runtime/JSGlobalData.h: Keep a DateInstanceCache.
+
+2009-10-27 James Robinson <jamesr@chromium.org>
+
+ Reviewed by Darin Fisher.
+
+ Ensures that JavaScriptCore/wtf/CurrentTime.cpp is not built in PLATFORM(CHROMIUM) builds.
+
+ Chromium uses a different method to calculate the current time than is used in
+ JavaScriptCore/wtf/CurrentTime.cpp. This can lead to time skew when calls to currentTime() and Chromium's time
+ function are mixed. In particular, timers can get scheduled in the past which leads to 100% CPU use.
+ See http://code.google.com/p/chromium/issues/detail?id=25892 for an example.
+
+ https://bugs.webkit.org/show_bug.cgi?id=30833
+
+ * JavaScriptCore.gyp/JavaScriptCore.gyp:
+ * wtf/CurrentTime.cpp:
+
+2009-10-27 Peter Varga <pvarga@inf.u-szeged.hu>
+
+ Rubber-stamped by Tor Arne Vestbø.
+
+ Fix typo in RegexInterpreter.cpp and RegexJIT.cpp alterantive to
+ alternative.
+
+ * yarr/RegexInterpreter.cpp:
+ (JSC::Yarr::ByteCompiler::alternativeBodyDisjunction):
+ (JSC::Yarr::ByteCompiler::alternativeDisjunction):
+ (JSC::Yarr::ByteCompiler::emitDisjunction):
+ * yarr/RegexJIT.cpp:
+ (JSC::Yarr::RegexGenerator::generateDisjunction):
+
+2009-10-26 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Darin Adler.
+
+ Make .rc files compile on Windows without depending on MFC headers
+ https://bugs.webkit.org/show_bug.cgi?id=30750
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.rc: Use
+ winresrc.h because it exists even when MFC is not installed, and is
+ all that's needed here.
+
+2009-10-26 Gabor Loki <loki@inf.u-szeged.hu>
+
+ Reviewed by Gavin Barraclough.
+
+ The thunkReturnAddress is on JITStackFrame on ARM JIT as well
+ https://bugs.webkit.org/show_bug.cgi?id=30782
+
+ Move the thunkReturnAddress from top of the stack into the JITStackFrame
+ structure. This is a requirement for JSValue32_64 support on ARM.
+
+ * assembler/MacroAssemblerARM.h:
+ (JSC::MacroAssemblerARM::ret): Return with link register
+ (JSC::MacroAssemblerARM::prepareCall): Store the return address in link register
+ * jit/JIT.h: Remove unused ctiReturnRegister
+ * jit/JITInlineMethods.h: Same as ARMv7
+ (JSC::JIT::restoreArgumentReference): Ditto.
+ (JSC::JIT::restoreArgumentReferenceForTrampoline): Ditto.
+ * jit/JITOpcodes.cpp: Remove ctiReturnRegister related instruction
+ * jit/JITStubs.cpp: Store thunkReturnAddress on JITStackFrame. Use
+ small trampoline functions which handle return addresses for each
+ CTI_STUB_FUNCTION.
+ * jit/JITStubs.h: Store thunkReturnAddress on JITStackFrame
+ (JSC::JITStackFrame::returnAddressSlot): Return with the address of thunkReturnAddress
+ * yarr/RegexJIT.cpp:
+ (JSC::Yarr::RegexGenerator::generateEnter): Remove the unnecessary instruction
+
+2009-10-26 Steve Block <steveblock@google.com>
+
+ Reviewed by Darin Adler.
+
+ Adds ability to disable ReadWriteLock on platforms (eg Android) that use pthreads but do not support pthread_rwlock.
+ https://bugs.webkit.org/show_bug.cgi?id=30713
+
+ * wtf/Platform.h: Modified. Defines HAVE_PTHREAD_RWLOCK for all platforms currently using pthreads.
+ * wtf/Threading.h: Modified. Use pthread_rwlock_t only when HAVE_PTHREAD_RWLOCK is defined.
+ * wtf/ThreadingPthreads.cpp: Modified. Build ReadWriteLock methods only when HAVE_PTHREAD_RWLOCK is defined.
+
+2009-10-24 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Holger Freyther.
+
+ [Qt] [Symbian] Set the capability and memory required to run QtWebKit for Symbian
+ https://bugs.webkit.org/show_bug.cgi?id=30476
+
+ Assign ReadUserData WriteUserData NetworkServices Symbian capabilities
+ to jsc.exe.
+
+ * jsc.pro:
+
+2009-10-23 Steve Block <steveblock@google.com>
+
+ Reviewed by Dmitry Titov.
+
+ Fixes a leak in createThreadInternal on Android.
+ https://bugs.webkit.org/show_bug.cgi?id=30698
+
+ * wtf/ThreadingPthreads.cpp: Modified.
+ (WTF::createThreadInternal): Avoid leaking a ThreadData object on failure.
+
+2009-10-22 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Fixed ASSERT when opening Safari's Caches window while the Web Inspector
+ is open.
+
+ * runtime/Collector.cpp:
+ (JSC::typeName): Added two new types to the type name list in the Collector.
+ These types have been around for a while, but nobody remembered to consider them here.
+
+ * runtime/JSCell.h:
+ (JSC::JSCell::isPropertyNameIterator):
+ * runtime/JSPropertyNameIterator.h:
+ (JSC::JSPropertyNameIterator::isPropertyNameIterator): Give the Collector
+ a way to tell if a cell is a JSPropertyNameIterator.
+
+2009-10-22 Steve Falkenburg <sfalken@apple.com>
+
+ Reviewed by Jon Honeycutt.
+
+ https://bugs.webkit.org/show_bug.cgi?id=30686
+ Remove debug-specific def file.
+ Only Debug_All target uses JavaScriptCore_debug.dll naming, and since
+ that target is only used internally, maintaining two files just to
+ suppress a single link warning isn't worthwhile.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: Removed.
+
+2009-10-21 Jon Honeycutt <jhoneycutt@apple.com>
+
+ <rdar://problem/7270320> Screenshots of off-screen plug-ins are blank
+ <rdar://problem/7270314> After halting a transparent PluginView on
+ Windows, the transparency is applied twice
+
+ Reviewed by Dan Bernstein.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ Export WTF::deleteOwnedPtr(HDC).
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+ Ditto.
+
+2009-10-20 Geoffrey Garen <ggaren@apple.com>
+
+ Windows build fix: updated variable name.
+
+ * runtime/DatePrototype.cpp:
+ (JSC::formatLocaleDate):
+
+2009-10-20 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Mark Rowe.
+
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_next_pname): Slightly tweaked this #ifdef to match the
+ size of a JSValue because m_jsStrings is an array of JSValues.
+
+2009-10-20 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Mark Rowe.
+
+ Fixed a 64-bit regression caused by the fix for
+ https://bugs.webkit.org/show_bug.cgi?id=30570.
+
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_next_pname): Use TimesEight stepping on 64-bit, since
+ 64-bit pointers are eight bytes long.
+
+2009-10-20 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Refactored DateInstance::msToGregorianDateTime so that a DateInstance's
+ caller doesn't need to supply the DateInstance's own internal value to
+ the DateInstance.
+
+ * runtime/DateInstance.cpp:
+ (JSC::DateInstance::getGregorianDateTime): Renamed from "msToGregorianDateTime".
+
+ * runtime/DateInstance.h:
+ * runtime/DatePrototype.cpp:
+ (JSC::formatLocaleDate):
+ (JSC::dateProtoFuncToString):
+ (JSC::dateProtoFuncToUTCString):
+ (JSC::dateProtoFuncToISOString):
+ (JSC::dateProtoFuncToDateString):
+ (JSC::dateProtoFuncToTimeString):
+ (JSC::dateProtoFuncToLocaleString):
+ (JSC::dateProtoFuncToLocaleDateString):
+ (JSC::dateProtoFuncToLocaleTimeString):
+ (JSC::dateProtoFuncGetTime):
+ (JSC::dateProtoFuncGetFullYear):
+ (JSC::dateProtoFuncGetUTCFullYear):
+ (JSC::dateProtoFuncToGMTString):
+ (JSC::dateProtoFuncGetMonth):
+ (JSC::dateProtoFuncGetUTCMonth):
+ (JSC::dateProtoFuncGetDate):
+ (JSC::dateProtoFuncGetUTCDate):
+ (JSC::dateProtoFuncGetDay):
+ (JSC::dateProtoFuncGetUTCDay):
+ (JSC::dateProtoFuncGetHours):
+ (JSC::dateProtoFuncGetUTCHours):
+ (JSC::dateProtoFuncGetMinutes):
+ (JSC::dateProtoFuncGetUTCMinutes):
+ (JSC::dateProtoFuncGetSeconds):
+ (JSC::dateProtoFuncGetUTCSeconds):
+ (JSC::dateProtoFuncGetTimezoneOffset):
+ (JSC::setNewValueFromTimeArgs):
+ (JSC::setNewValueFromDateArgs):
+ (JSC::dateProtoFuncSetYear):
+ (JSC::dateProtoFuncGetYear): Also renamed "utc" to "outputIsUTC", for clarity.
+
+2009-10-20 Gabor Loki <loki@inf.u-szeged.hu>
+
+ Reviewed by Geoffrey Garen.
+
+ The op_next_pname should use 4 bytes addressing mode in case of JSValue32
+ https://bugs.webkit.org/show_bug.cgi?id=30570
+
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_next_pname):
+
+2009-10-20 Gabor Loki <loki@inf.u-szeged.hu>
+
+ Reviewed by Oliver Hunt.
+
+ Move OverridesMarkChildren flag from DatePrototype to its parent class
+ https://bugs.webkit.org/show_bug.cgi?id=30372
+
+ * runtime/DateInstance.h:
+ (JSC::DateInstance::createStructure):
+ * runtime/DatePrototype.h:
+
+2009-10-19 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Tightened up some put_by_id_transition code generation.
+ https://bugs.webkit.org/show_bug.cgi?id=30539
+
+ * jit/JIT.h:
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::testPrototype):
+ (JSC::JIT::privateCompilePutByIdTransition): No need to do object type
+ checks or read Structures and prototypes from objects: they're all known
+ constants at compile time.
+
+2009-10-19 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Added a private API for getting a global context from a context, for
+ clients who want to preserve a context for a later callback.
+
+ * API/APICast.h:
+ (toGlobalRef): Added an ASSERT, since this function is used more often
+ than before.
+
+ * API/JSContextRef.cpp:
+ * API/JSContextRefPrivate.h: Added. The new API.
+
+ * API/tests/testapi.c:
+ (print_callAsFunction):
+ (main): Test the new API.
+
+ * JavaScriptCore.exp:
+ * JavaScriptCore.xcodeproj/project.pbxproj: Build and export the new API.
+
+2009-10-17 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Tightened up some instanceof code generation.
+ https://bugs.webkit.org/show_bug.cgi?id=30488
+
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_instanceof):
+ (JSC::JIT::emitSlow_op_instanceof): No need to do object type checks -
+ cell type checks and ImplementsDefaultHasIntance checks implicitly
+ supersede object type checks.
+
+2009-10-18 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Darin Adler.
+
+ Use _stricmp and _strnicmp instead of deprecated stricmp and strnicmp.
+ https://bugs.webkit.org/show_bug.cgi?id=30474
+
+ stricmp and strnicmp are deprecated beginning in Visual
+ C++ 2005. Use _stricmp and _strnicmp instead in StringExtras.h.
+
+ * wtf/StringExtras.h:
+ (strncasecmp):
+ (strcasecmp):
+
+2009-10-16 Geoffrey Garen <ggaren@apple.com>
+
+ Build fix: apparently we shouldn't export those symbols?
+
+ * JavaScriptCore.exp:
+
+2009-10-16 Geoffrey Garen <ggaren@apple.com>
+
+ Build fix: export some symbols.
+
+ * JavaScriptCore.exp:
+
+2009-10-16 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ structure typeinfo flags should be inherited.
+ https://bugs.webkit.org/show_bug.cgi?id=30468
+
+ Add StructureFlag constant to the various JSC classes and use
+ it for the TypeInfo construction. This allows us to simply
+ accumulate flags by basing each classes StructureInfo on its parents.
+
+ * API/JSCallbackConstructor.h:
+ (JSC::JSCallbackConstructor::createStructure):
+ * API/JSCallbackFunction.h:
+ (JSC::JSCallbackFunction::createStructure):
+ * API/JSCallbackObject.h:
+ (JSC::JSCallbackObject::createStructure):
+ * debugger/DebuggerActivation.h:
+ (JSC::DebuggerActivation::createStructure):
+ * runtime/Arguments.h:
+ (JSC::Arguments::createStructure):
+ * runtime/BooleanObject.h:
+ (JSC::BooleanObject::createStructure):
+ * runtime/DatePrototype.h:
+ (JSC::DatePrototype::createStructure):
+ * runtime/FunctionPrototype.h:
+ (JSC::FunctionPrototype::createStructure):
+ * runtime/GlobalEvalFunction.h:
+ (JSC::GlobalEvalFunction::createStructure):
+ * runtime/InternalFunction.h:
+ (JSC::InternalFunction::createStructure):
+ * runtime/JSActivation.h:
+ (JSC::JSActivation::createStructure):
+ * runtime/JSArray.h:
+ (JSC::JSArray::createStructure):
+ * runtime/JSByteArray.cpp:
+ (JSC::JSByteArray::createStructure):
+ * runtime/JSByteArray.h:
+ * runtime/JSFunction.h:
+ (JSC::JSFunction::createStructure):
+ * runtime/JSGlobalObject.h:
+ (JSC::JSGlobalObject::createStructure):
+ * runtime/JSNotAnObject.h:
+ (JSC::JSNotAnObject::createStructure):
+ * runtime/JSONObject.h:
+ (JSC::JSONObject::createStructure):
+ * runtime/JSObject.h:
+ (JSC::JSObject::createStructure):
+ * runtime/JSStaticScopeObject.h:
+ (JSC::JSStaticScopeObject::createStructure):
+ * runtime/JSVariableObject.h:
+ (JSC::JSVariableObject::createStructure):
+ * runtime/JSWrapperObject.h:
+ (JSC::JSWrapperObject::createStructure):
+ * runtime/MathObject.h:
+ (JSC::MathObject::createStructure):
+ * runtime/NumberConstructor.h:
+ (JSC::NumberConstructor::createStructure):
+ * runtime/NumberObject.h:
+ (JSC::NumberObject::createStructure):
+ * runtime/RegExpConstructor.h:
+ (JSC::RegExpConstructor::createStructure):
+ * runtime/RegExpObject.h:
+ (JSC::RegExpObject::createStructure):
+ * runtime/StringObject.h:
+ (JSC::StringObject::createStructure):
+ * runtime/StringObjectThatMasqueradesAsUndefined.h:
+ (JSC::StringObjectThatMasqueradesAsUndefined::createStructure):
+
+2009-10-16 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Fast for-in enumeration: Cache JSPropertyNameIterator; cache JSStrings
+ in JSPropertyNameIterator; inline more code.
+
+ 1.024x as fast on SunSpider (fasta: 1.43x as fast).
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::dump):
+ * bytecode/Opcode.h:
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::emitGetPropertyNames):
+ (JSC::BytecodeGenerator::emitNextPropertyName):
+ * bytecompiler/BytecodeGenerator.h: Added a few extra operands to
+ op_get_pnames and op_next_pname so that we can track iteration state
+ in the register file instead of in the JSPropertyNameIterator. (To be
+ cacheable, the JSPropertyNameIterator must be stateless.)
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::tryCachePutByID):
+ (JSC::Interpreter::tryCacheGetByID): Updated for rename to
+ "normalizePrototypeChain" and removal of "isCacheable".
+
+ (JSC::Interpreter::privateExecute): Updated for in-RegisterFile
+ iteration state tracking.
+
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ * jit/JIT.h:
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_get_pnames): Updated for in-RegisterFile
+ iteration state tracking.
+
+ (JSC::JIT::emit_op_next_pname): Inlined code generation for op_next_pname.
+
+ * jit/JITStubs.cpp:
+ (JSC::JITThunks::tryCachePutByID):
+ (JSC::JITThunks::tryCacheGetByID): Updated for rename to
+ "normalizePrototypeChain" and removal of "isCacheable".
+
+ (JSC::DEFINE_STUB_FUNCTION):
+ * jit/JITStubs.h:
+ (JSC::): Added has_property and to_object stubs. Removed op_next_pname
+ stub, since has_property is all we need anymore.
+
+ * parser/Nodes.cpp:
+ (JSC::ForInNode::emitBytecode): Updated for in-RegisterFile
+ iteration state tracking.
+
+ * runtime/JSCell.h:
+ * runtime/JSObject.cpp:
+ (JSC::JSObject::getPropertyNames): Don't do caching at this layer
+ anymore, since we don't create a JSPropertyNameIterator at this layer.
+
+ * runtime/JSPropertyNameIterator.cpp:
+ (JSC::JSPropertyNameIterator::create): Do do caching at this layer.
+ (JSC::JSPropertyNameIterator::get): Updated for in-RegisterFile
+ iteration state tracking.
+ (JSC::JSPropertyNameIterator::markChildren): Mark our JSStrings.
+
+ * runtime/JSPropertyNameIterator.h:
+ (JSC::JSPropertyNameIterator::size):
+ (JSC::JSPropertyNameIterator::setCachedStructure):
+ (JSC::JSPropertyNameIterator::cachedStructure):
+ (JSC::JSPropertyNameIterator::setCachedPrototypeChain):
+ (JSC::JSPropertyNameIterator::cachedPrototypeChain):
+ (JSC::JSPropertyNameIterator::JSPropertyNameIterator):
+ (JSC::Structure::setEnumerationCache): Don't store iteration state in
+ a JSPropertyNameIterator. Do cache a JSPropertyNameIterator in a
+ Structure.
+
+ * runtime/JSValue.h:
+ (JSC::asCell):
+ * runtime/MarkStack.h: Make those mischievous #include gods happy.
+
+ * runtime/ObjectConstructor.cpp:
+
+ * runtime/Operations.h:
+ (JSC::normalizePrototypeChain): Renamed countPrototypeChainEntriesAndCheckForProxies
+ to normalizePrototypeChain, since it changes dictionary prototypes to
+ non-dictionary objects.
+
+ * runtime/PropertyNameArray.cpp:
+ (JSC::PropertyNameArray::add):
+ * runtime/PropertyNameArray.h:
+ (JSC::PropertyNameArrayData::PropertyNameArrayData):
+ (JSC::PropertyNameArray::data):
+ (JSC::PropertyNameArray::size):
+ (JSC::PropertyNameArray::begin):
+ (JSC::PropertyNameArray::end): Simplified some code here to help with
+ current and future refactoring.
+
+ * runtime/Protect.h:
+ * runtime/Structure.cpp:
+ (JSC::Structure::~Structure):
+ (JSC::Structure::addPropertyWithoutTransition):
+ (JSC::Structure::removePropertyWithoutTransition): No need to clear
+ the enumeration cache with adding / removing properties without
+ transition. It is an error to add / remove properties without transition
+ once an object has been observed, and we can ASSERT to catch that.
+
+ * runtime/Structure.h:
+ (JSC::Structure::enumerationCache): Changed the enumeration cache to
+ hold a JSPropertyNameIterator.
+
+ * runtime/StructureChain.cpp:
+ * runtime/StructureChain.h:
+ (JSC::StructureChain::head): Removed StructureChain::isCacheable because
+ it was wrong-headed in two ways: (1) It gave up when a prototype was a
+ dictionary, but instead we want un-dictionary heavily accessed
+ prototypes; (2) It folded a test for hasDefaultGetPropertyNames() into
+ a generic test for "cacheable-ness", but hasDefaultGetPropertyNames()
+ is only releavant to for-in caching.
+
+2009-10-16 Steve Falkenburg <sfalken@apple.com>
+
+ Reviewed by Adam Roben.
+
+ Add a Debug_All configuration to build entire stack as debug.
+ Change Debug_Internal to:
+ - stop using _debug suffix for all WebKit/Safari binaries
+ - not use _debug as a DLL naming suffix
+ - use non-debug C runtime lib.
+
+ * JavaScriptCore.vcproj/JavaScriptCore.make: Debug build in makefile should build Debug_All.
+ * JavaScriptCore.vcproj/JavaScriptCore.sln: Add Debug_All configuration.
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Add Debug_All configuration.
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.vcproj: Renamed single configuration from "Release" to "all".
+ * JavaScriptCore.vcproj/JavaScriptCoreSubmit.sln: Add Debug_All configuration.
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj: Add Debug_All configuration.
+ * JavaScriptCore.vcproj/jsc/jsc.vcproj: Add Debug_All configuration.
+ * JavaScriptCore.vcproj/testapi/testapi.vcproj: Add Debug_All configuration.
+
+2009-10-16 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Make typeinfo flags default to false
+ https://bugs.webkit.org/show_bug.cgi?id=30372
+
+ Last part -- replace HasDefaultGetPropertyNames with OverridesGetPropertyNames
+ flag.
+
+ * API/JSCallbackConstructor.h:
+ (JSC::JSCallbackConstructor::createStructure):
+ * API/JSCallbackObject.h:
+ (JSC::JSCallbackObject::createStructure):
+ * debugger/DebuggerActivation.h:
+ (JSC::DebuggerActivation::createStructure):
+ * runtime/Arguments.h:
+ (JSC::Arguments::createStructure):
+ * runtime/BooleanObject.h:
+ (JSC::BooleanObject::createStructure):
+ * runtime/DatePrototype.h:
+ (JSC::DatePrototype::createStructure):
+ * runtime/FunctionPrototype.h:
+ (JSC::FunctionPrototype::createStructure):
+ * runtime/GlobalEvalFunction.h:
+ (JSC::GlobalEvalFunction::createStructure):
+ * runtime/JSAPIValueWrapper.h:
+ (JSC::JSAPIValueWrapper::createStructure):
+ * runtime/JSActivation.h:
+ (JSC::JSActivation::createStructure):
+ * runtime/JSArray.h:
+ (JSC::JSArray::createStructure):
+ * runtime/JSByteArray.cpp:
+ (JSC::JSByteArray::createStructure):
+ * runtime/JSFunction.h:
+ (JSC::JSFunction::createStructure):
+ * runtime/JSGlobalObject.h:
+ (JSC::JSGlobalObject::createStructure):
+ * runtime/JSNotAnObject.h:
+ (JSC::JSNotAnObject::createStructure):
+ * runtime/JSONObject.h:
+ (JSC::JSONObject::createStructure):
+ * runtime/JSObject.cpp:
+ (JSC::JSObject::getPropertyNames):
+ * runtime/JSObject.h:
+ (JSC::JSObject::createStructure):
+ * runtime/JSStaticScopeObject.h:
+ (JSC::JSStaticScopeObject::createStructure):
+ * runtime/JSTypeInfo.h:
+ (JSC::TypeInfo::overridesGetPropertyNames):
+ * runtime/JSVariableObject.h:
+ (JSC::JSVariableObject::createStructure):
+ * runtime/JSWrapperObject.h:
+ (JSC::JSWrapperObject::createStructure):
+ * runtime/MathObject.h:
+ (JSC::MathObject::createStructure):
+ * runtime/NumberConstructor.h:
+ (JSC::NumberConstructor::createStructure):
+ * runtime/NumberObject.h:
+ (JSC::NumberObject::createStructure):
+ * runtime/RegExpConstructor.h:
+ (JSC::RegExpConstructor::createStructure):
+ * runtime/RegExpObject.h:
+ (JSC::RegExpObject::createStructure):
+ * runtime/StringObject.h:
+ (JSC::StringObject::createStructure):
+ * runtime/StringObjectThatMasqueradesAsUndefined.h:
+ (JSC::StringObjectThatMasqueradesAsUndefined::createStructure):
+ * runtime/StructureChain.cpp:
+ (JSC::StructureChain::isCacheable):
+
+2009-10-16 Kevin Ollivier <kevino@theolliviers.com>
+
+ wxMSW build fix, we can't use the simple hash there because the PlatformModuleVersion
+ structure differs.
+
+ * wtf/Platform.h:
+
+2009-10-16 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Implement ExecutableAllocator for Symbian
+ https://bugs.webkit.org/show_bug.cgi?id=29946
+
+ Tested with YARR JIT enabled for Symbian;
+ This patch does not (yet) enable YARR JIT by default.
+
+ * JavaScriptCore.pri:
+ * jit/ExecutableAllocator.h:
+ * jit/ExecutableAllocatorSymbian.cpp: Added.
+ (JSC::ExecutableAllocator::intializePageSize):
+ (JSC::ExecutablePool::systemAlloc):
+ (JSC::ExecutablePool::systemRelease):
+
+2009-10-15 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Make typeinfo flags default to false
+ https://bugs.webkit.org/show_bug.cgi?id=30372
+
+ Part 2 -- Reverse the TypeInfo HasDefaultMark flag to OverridesMarkChildren, etc
+
+ * API/JSCallbackConstructor.h:
+ (JSC::JSCallbackConstructor::createStructure):
+ * API/JSCallbackFunction.h:
+ (JSC::JSCallbackFunction::createStructure):
+ * API/JSCallbackObject.h:
+ (JSC::JSCallbackObject::createStructure):
+ * debugger/DebuggerActivation.h:
+ (JSC::DebuggerActivation::createStructure):
+ * runtime/Arguments.h:
+ (JSC::Arguments::createStructure):
+ * runtime/BooleanObject.h:
+ (JSC::BooleanObject::createStructure):
+ * runtime/DatePrototype.h:
+ (JSC::DatePrototype::createStructure):
+ * runtime/FunctionPrototype.h:
+ (JSC::FunctionPrototype::createStructure):
+ * runtime/GetterSetter.h:
+ (JSC::GetterSetter::createStructure):
+ * runtime/GlobalEvalFunction.h:
+ (JSC::GlobalEvalFunction::createStructure):
+ * runtime/InternalFunction.h:
+ (JSC::InternalFunction::createStructure):
+ * runtime/JSAPIValueWrapper.h:
+ (JSC::JSAPIValueWrapper::createStructure):
+ * runtime/JSActivation.h:
+ (JSC::JSActivation::createStructure):
+ * runtime/JSArray.h:
+ (JSC::JSArray::createStructure):
+ (JSC::MarkStack::markChildren):
+ * runtime/JSByteArray.cpp:
+ (JSC::JSByteArray::createStructure):
+ * runtime/JSFunction.h:
+ (JSC::JSFunction::createStructure):
+ * runtime/JSGlobalObject.h:
+ (JSC::JSGlobalObject::createStructure):
+ * runtime/JSNotAnObject.h:
+ (JSC::JSNotAnObject::createStructure):
+ * runtime/JSNumberCell.h:
+ (JSC::JSNumberCell::createStructure):
+ * runtime/JSONObject.h:
+ (JSC::JSONObject::createStructure):
+ * runtime/JSObject.h:
+ (JSC::JSObject::createStructure):
+ * runtime/JSPropertyNameIterator.h:
+ (JSC::JSPropertyNameIterator::createStructure):
+ * runtime/JSStaticScopeObject.h:
+ (JSC::JSStaticScopeObject::createStructure):
+ * runtime/JSString.h:
+ (JSC::JSString::createStructure):
+ * runtime/JSTypeInfo.h:
+ (JSC::TypeInfo::overridesMarkChildren):
+ * runtime/JSVariableObject.h:
+ (JSC::JSVariableObject::createStructure):
+ * runtime/JSWrapperObject.h:
+ (JSC::JSWrapperObject::createStructure):
+ * runtime/MathObject.h:
+ (JSC::MathObject::createStructure):
+ * runtime/NumberConstructor.h:
+ (JSC::NumberConstructor::createStructure):
+ * runtime/NumberObject.h:
+ (JSC::NumberObject::createStructure):
+ * runtime/RegExpConstructor.h:
+ (JSC::RegExpConstructor::createStructure):
+ * runtime/RegExpObject.h:
+ (JSC::RegExpObject::createStructure):
+ * runtime/StringObject.h:
+ (JSC::StringObject::createStructure):
+ * runtime/StringObjectThatMasqueradesAsUndefined.h:
+ (JSC::StringObjectThatMasqueradesAsUndefined::createStructure):
+
+2009-10-14 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Make typeinfo flags default to false
+ https://bugs.webkit.org/show_bug.cgi?id=30372
+
+ Part 1. Reverse the HasStandardGetOwnPropertySlot flag.
+
+ * API/JSCallbackConstructor.h:
+ (JSC::JSCallbackConstructor::createStructure):
+ * API/JSCallbackFunction.h:
+ (JSC::JSCallbackFunction::createStructure):
+ * API/JSCallbackObject.h:
+ (JSC::JSCallbackObject::createStructure):
+ * debugger/DebuggerActivation.h:
+ (JSC::DebuggerActivation::createStructure):
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+ * runtime/Arguments.h:
+ (JSC::Arguments::createStructure):
+ * runtime/BooleanObject.h:
+ (JSC::BooleanObject::createStructure):
+ * runtime/DatePrototype.h:
+ (JSC::DatePrototype::createStructure):
+ * runtime/FunctionPrototype.h:
+ (JSC::FunctionPrototype::createStructure):
+ * runtime/GlobalEvalFunction.h:
+ (JSC::GlobalEvalFunction::createStructure):
+ * runtime/InternalFunction.h:
+ (JSC::InternalFunction::createStructure):
+ * runtime/JSActivation.h:
+ (JSC::JSActivation::createStructure):
+ * runtime/JSArray.h:
+ (JSC::JSArray::createStructure):
+ * runtime/JSByteArray.cpp:
+ (JSC::JSByteArray::createStructure):
+ * runtime/JSFunction.h:
+ (JSC::JSFunction::createStructure):
+ * runtime/JSGlobalObject.h:
+ (JSC::JSGlobalObject::createStructure):
+ * runtime/JSNumberCell.h:
+ (JSC::JSNumberCell::createStructure):
+ * runtime/JSONObject.h:
+ (JSC::JSONObject::createStructure):
+ * runtime/JSObject.h:
+ (JSC::JSObject::createStructure):
+ (JSC::JSCell::fastGetOwnPropertySlot):
+ * runtime/JSStaticScopeObject.h:
+ (JSC::JSStaticScopeObject::createStructure):
+ * runtime/JSString.h:
+ (JSC::JSString::createStructure):
+ * runtime/JSTypeInfo.h:
+ (JSC::TypeInfo::overridesGetOwnPropertySlot):
+ * runtime/JSVariableObject.h:
+ (JSC::JSVariableObject::createStructure):
+ * runtime/JSWrapperObject.h:
+ (JSC::JSWrapperObject::createStructure):
+ * runtime/MathObject.h:
+ (JSC::MathObject::createStructure):
+ * runtime/NumberConstructor.h:
+ (JSC::NumberConstructor::createStructure):
+ * runtime/NumberObject.h:
+ (JSC::NumberObject::createStructure):
+ * runtime/RegExpConstructor.h:
+ (JSC::RegExpConstructor::createStructure):
+ * runtime/RegExpObject.h:
+ (JSC::RegExpObject::createStructure):
+ * runtime/StringObject.h:
+ (JSC::StringObject::createStructure):
+ * runtime/StringObjectThatMasqueradesAsUndefined.h:
+ (JSC::StringObjectThatMasqueradesAsUndefined::createStructure):
+
+2009-10-14 Kevin Ollivier <kevino@theolliviers.com>
+2009-10-14 Darin Adler <darin@apple.com>
+
+ Additions so fix for https://bugs.webkit.org/show_bug.cgi?id=18994
+ can build on Windows.
+
+ * wtf/MathExtras.h: Added llround and llroundf for Windows.
+
+2009-10-14 Kevin Ollivier <kevino@theolliviers.com>
+
+ wx build fix. Set ENABLE_PLUGIN_PACKAGE_SIMPLE_HASH for plugins while we're still building stubs.
+
+ * wtf/Platform.h:
+
+2009-10-13 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Refactor ENABLE_PLUGIN_PACKAGE_SIMPLE_HASH
+ https://bugs.webkit.org/show_bug.cgi?id=30278
+
+ Move the definition of ENABLE_PLUGIN_PACKAGE_SIMPLE_HASH
+ from the make system into common code.
+
+ * wtf/Platform.h:
+
+2009-10-13 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Darin Adler.
+
+ ARM compiler does not understand reinterpret_cast<void*>
+ https://bugs.webkit.org/show_bug.cgi?id=29034
+
+ Change reinterpret_cast<void*> to regular C style (void*) cast
+ for the ARM RVCT compiler.
+
+ * assembler/MacroAssemblerCodeRef.h:
+ (JSC::FunctionPtr::FunctionPtr):
+ * jit/JITOpcodes.cpp: Cast to FunctionPtr first
+ instead of directly casting to reinterpret_cast
+ * jit/JITStubCall.h: Ditto + change the type of m_stub
+ from void* to FunctionPtr.
+ (JSC::JITStubCall::JITStubCall):
+ (JSC::JITStubCall::call):
+ * jit/JITStubs.cpp: Ditto.
+ (JSC::DEFINE_STUB_FUNCTION(EncodedJSValue, op_throw)):
+
+2009-10-11 Oliver Hunt <oliver@apple.com>
+
+ Re-enable the JIT.
+
+ * wtf/Platform.h:
+
+2009-10-10 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Support for String.trim(), String.trimLeft() and String.trimRight() methods
+ https://bugs.webkit.org/show_bug.cgi?id=26590
+
+ Implement trim, trimLeft, and trimRight
+
+ * runtime/StringPrototype.cpp:
+ (JSC::isTrimWhitespace):
+ Our normal string whitespace function does not include U+200B which
+ is needed for compatibility with mozilla's implementation of trim.
+ U+200B does not appear to be expected according to spec, however I am
+ choosing to be lax, and match mozilla behavior so have added this
+ exception.
+ (JSC::trimString):
+
+2009-10-09 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Eliminated some legacy bytecode weirdness.
+
+ Use vPC[x] subscripting instead of ++vPC to access instruction operands.
+ This is simpler, and often more efficient.
+
+ To support this, and to remove use of hard-coded offsets in bytecode and
+ JIT code generation and dumping, calculate jump offsets from the beginning
+ of an instruction, rather than the middle or end.
+
+ Also, use OPCODE_LENGTH instead of hard-coded constants for the sizes of
+ opcodes.
+
+ SunSpider reports no change in JIT mode, and a 1.01x speedup in Interpreter
+ mode.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::printConditionalJump):
+ (JSC::CodeBlock::dump):
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::emitJump):
+ (JSC::BytecodeGenerator::emitJumpIfTrue):
+ (JSC::BytecodeGenerator::emitJumpIfFalse):
+ (JSC::BytecodeGenerator::emitJumpIfNotFunctionCall):
+ (JSC::BytecodeGenerator::emitJumpIfNotFunctionApply):
+ (JSC::BytecodeGenerator::emitComplexJumpScopes):
+ (JSC::BytecodeGenerator::emitJumpScopes):
+ (JSC::BytecodeGenerator::emitNextPropertyName):
+ (JSC::BytecodeGenerator::emitCatch):
+ (JSC::BytecodeGenerator::emitJumpSubroutine):
+ (JSC::prepareJumpTableForImmediateSwitch):
+ (JSC::prepareJumpTableForCharacterSwitch):
+ (JSC::prepareJumpTableForStringSwitch):
+ (JSC::BytecodeGenerator::endSwitch):
+ * bytecompiler/Label.h:
+ (JSC::Label::setLocation):
+ (JSC::Label::bind):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::resolve):
+ (JSC::Interpreter::resolveSkip):
+ (JSC::Interpreter::resolveGlobal):
+ (JSC::Interpreter::resolveBase):
+ (JSC::Interpreter::resolveBaseAndProperty):
+ (JSC::Interpreter::createExceptionScope):
+ (JSC::Interpreter::privateExecute):
+ * interpreter/Interpreter.h:
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompile):
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emit_op_jnless):
+ (JSC::JIT::emitSlow_op_jnless):
+ (JSC::JIT::emit_op_jnlesseq):
+ (JSC::JIT::emitSlow_op_jnlesseq):
+ (JSC::JIT::emitBinaryDoubleOp):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_jmp):
+ (JSC::JIT::emit_op_loop):
+ (JSC::JIT::emit_op_loop_if_less):
+ (JSC::JIT::emitSlow_op_loop_if_less):
+ (JSC::JIT::emit_op_loop_if_lesseq):
+ (JSC::JIT::emitSlow_op_loop_if_lesseq):
+ (JSC::JIT::emit_op_loop_if_true):
+ (JSC::JIT::emitSlow_op_loop_if_true):
+ (JSC::JIT::emit_op_jfalse):
+ (JSC::JIT::emitSlow_op_jfalse):
+ (JSC::JIT::emit_op_jtrue):
+ (JSC::JIT::emitSlow_op_jtrue):
+ (JSC::JIT::emit_op_jeq_null):
+ (JSC::JIT::emit_op_jneq_null):
+ (JSC::JIT::emit_op_jneq_ptr):
+ (JSC::JIT::emit_op_jsr):
+ (JSC::JIT::emit_op_next_pname):
+ (JSC::JIT::emit_op_jmp_scopes):
+
+2009-10-09 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Migrated some code that didn't belong out of Structure.
+
+ SunSpider says maybe 1.03x faster.
+
+ * runtime/JSCell.h: Nixed Structure::markAggregate, and made marking of
+ a Structure's prototype the direct responsility of the object using it.
+ (Giving Structure a mark function was misleading because it implied that
+ all live structures get marked during GC, when they don't.)
+
+ * runtime/JSGlobalObject.cpp:
+ (JSC::markIfNeeded):
+ (JSC::JSGlobalObject::markChildren): Added code to mark prototypes stored
+ on the global object. Maybe this wasn't necessary, but now we don't have
+ to wonder.
+
+ * runtime/JSObject.cpp:
+ (JSC::JSObject::getPropertyNames):
+ (JSC::JSObject::getOwnPropertyNames):
+ (JSC::JSObject::getEnumerableNamesFromClassInfoTable):
+ * runtime/JSObject.h:
+ (JSC::JSObject::markChildrenDirect):
+ * runtime/PropertyNameArray.h:
+ * runtime/Structure.cpp:
+ * runtime/Structure.h:
+ (JSC::Structure::setEnumerationCache):
+ (JSC::Structure::enumerationCache): Moved property name gathering code
+ from Structure to JSObject because having a Structure iterate its JSObject
+ was a layering violation. A JSObject is implemented using a Structure; not
+ the other way around.
+
+2009-10-09 Mark Rowe <mrowe@apple.com>
+
+ Attempt to fix the GTK release build.
+
+ * GNUmakefile.am: Include Grammar.cpp in release builds now that
+ AllInOneFile.cpp is gone.
+
+2009-10-09 Gabor Loki <loki@inf.u-szeged.hu>
+
+ Rubber-stamped by Eric Seidel.
+
+ Add ARM JIT support for Gtk port (disabled by default)
+ https://bugs.webkit.org/show_bug.cgi?id=30228
+
+ * GNUmakefile.am:
+
+2009-10-08 Geoffrey Garen <ggaren@apple.com>
+
+ Tiger build fix: added a few more variable initializations.
+
+ * runtime/StringPrototype.cpp:
+ (JSC::stringProtoFuncReplace):
+ (JSC::stringProtoFuncSearch):
+
+2009-10-08 Geoffrey Garen <ggaren@apple.com>
+
+ Qt build fix: added missing #include.
+
+ * jsc.cpp:
+
+2009-10-08 Geoffrey Garen <ggaren@apple.com>
+
+ Tiger build fix: initialize variable whose initialization the compiler
+ can't otherwise figure out.
+
+ * runtime/RegExpObject.cpp:
+ (JSC::RegExpObject::match):
+
+2009-10-08 Geoffrey Garen <ggaren@apple.com>
+
+ Windows build fix: updated exports.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-10-08 Geoffrey Garen <ggaren@apple.com>
+
+ Tiger build fix: fixed file name case.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2009-10-08 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ At long last, I pronounce the death of AllInOneFile.cpp.
+
+ SunSpider reports a 1.01x speedup.
+
+ * AllInOneFile.cpp: Removed.
+ * GNUmakefile.am:
+ * JavaScriptCore.exp:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.xcodeproj/project.pbxproj: Added missing project files
+ to compilation stages.
+
+ * parser/Grammar.y:
+ * parser/Lexer.cpp:
+ * parser/Lexer.h:
+ (JSC::jscyylex):
+ * runtime/ArrayConstructor.cpp:
+ (JSC::constructArrayWithSizeQuirk):
+ * runtime/Collector.h:
+ * runtime/JSCell.cpp:
+ (JSC::JSCell::operator new):
+ * runtime/JSCell.h:
+ (JSC::JSCell::operator new):
+ * runtime/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::operator new):
+ * runtime/JSNumberCell.h:
+ (JSC::JSNumberCell::operator new):
+ * runtime/JSString.cpp:
+ * runtime/JSString.h:
+ (JSC::jsString):
+ (JSC::jsSubstring):
+ (JSC::jsOwnedString):
+ * runtime/RegExpConstructor.cpp:
+ * runtime/RegExpConstructor.h:
+ (JSC::RegExpConstructorPrivate::RegExpConstructorPrivate):
+ (JSC::RegExpConstructorPrivate::lastOvector):
+ (JSC::RegExpConstructorPrivate::tempOvector):
+ (JSC::RegExpConstructorPrivate::changeLastOvector):
+ (JSC::RegExpConstructor::performMatch):
+ * runtime/StringPrototype.cpp:
+ (JSC::stringProtoFuncMatch):
+ * yarr/RegexJIT.cpp:
+ * yarr/RegexJIT.h:
+ (JSC::Yarr::executeRegex): Inlined a few things that Shark said
+ were hot, on the presumption that AllInOneFile.cpp used to inline them
+ automatically.
+
+2009-10-08 Zoltan Herczeg <zherczeg@inf.u-szeged.hu>
+
+ Reviewed by Gavin Barraclough.
+
+ Fix for JIT'ed op_call instructions (evals, constructs, etc.)
+ when !ENABLE(JIT_OPTIMIZE_CALL) && USE(JSVALUE32_64)
+
+ https://bugs.webkit.org/show_bug.cgi?id=30201
+
+ * jit/JITCall.cpp:
+ (JSC::JIT::compileOpCall):
+
+2009-10-07 Geoffrey Garen <ggaren@apple.com>
+
+ Windows build fix: removed no longer exported symbol.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-10-07 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Fixed <rdar://problem/5751979> Database code takes JSLock on secondary
+ thread, permanently slowing down JavaScript
+
+ Removed the optional lock from Heap::protect, Heap::unprotect, and friends,
+ since WebCore no longer uses it.
+
+ * JavaScriptCore.exp:
+ * runtime/Collector.cpp:
+ (JSC::Heap::protect):
+ (JSC::Heap::unprotect):
+ (JSC::Heap::markProtectedObjects):
+ (JSC::Heap::protectedGlobalObjectCount):
+ (JSC::Heap::protectedObjectCount):
+ (JSC::Heap::protectedObjectTypeCounts):
+ * runtime/Collector.h:
+
+2009-10-07 Zoltan Horvath <zoltan@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ Allow custom memory allocation control for JavaScriptCore's IdentifierArena
+ https://bugs.webkit.org/show_bug.cgi?id=30158
+
+ Inherits IdentifierArena class from FastAllocBase because it has been
+ instantiated by 'new' in JavaScriptCore/parser/ParserArena.cpp:36.
+
+ * parser/ParserArena.h:
+
+2009-10-07 Adam Roben <aroben@apple.com>
+
+ Export DateInstance::info in a way that works on Windows
+
+ Fixes <http://webkit.org/b/30171>
+ fast/dom/Window/window-postmessage-clone.html fails on Windows
+
+ Reviewed by Anders Carlsson.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+ Removed the export of DateInstance::info from here.
+
+ * runtime/DateInstance.h: Use JS_EXPORTDATA to export
+ DateInstance::info, which is the required way of exporting data on
+ Windows.
+
+2009-10-07 Jørgen Lind <jorgen.lind@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ When enabling or disabling the JIT through .qmake.cache, make sure
+ to also toggle ENABLE_YARR_JIT.
+
+ * JavaScriptCore.pri:
+
+2009-10-06 Priit Laes <plaes@plaes.org>
+
+ Reviewed by Gavin Barraclough.
+
+ Linking fails with "relocation R_X86_64_PC32 against symbol
+ `cti_vm_throw'"
+ https://bugs.webkit.org/show_bug.cgi?id=28422
+
+ * jit/JITStubs.cpp:
+ Mark cti_vm_throw symbol as PLT-indirect symbol, so it doesn't end up
+ in text segment causing relocation errors on amd64 architecture.
+ Introduced new define SYMBOL_STRING_RELOCATION for such symbols.
+
+2009-10-06 Oliver Hunt <oliver@apple.com>
+
+ Windows linking fix
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-10-06 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by NOBODY (build fix).
+
+ Windows build fix.
+
+ * runtime/DateInstance.cpp:
+
+2009-10-05 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ It should be possible to post (clone) built-in JS objects to Workers
+ https://bugs.webkit.org/show_bug.cgi?id=22878
+
+ Expose helpers to throw correct exceptions during object graph walk
+ used for cloning and add a helper function to create Date instances
+ without going through the JS Date constructor function.
+
+ * JavaScriptCore.exp:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * runtime/DateInstance.cpp:
+ (JSC::DateInstance::DateInstance):
+ * runtime/DateInstance.h:
+ * runtime/ExceptionHelpers.cpp:
+ (JSC::createTypeError):
+ * runtime/ExceptionHelpers.h:
+
+2009-10-06 David Levin <levin@chromium.org>
+
+ Reviewed by Oliver Hunt.
+
+ StringImpl needs a method to get an instance for another thread which doesn't copy the underlying buffer.
+ https://bugs.webkit.org/show_bug.cgi?id=30095
+
+ * wtf/CrossThreadRefCounted.h:
+ Removed an unused function and assert improvement.
+ (WTF::CrossThreadRefCounted::isOwnedByCurrentThread): Moved out common code from asserts.
+ (WTF::CrossThreadRefCounted::ref): Changed assert to use the common method.
+ (WTF::CrossThreadRefCounted::deref): Changed assert to use the common method.
+ (WTF::CrossThreadRefCounted::crossThreadCopy): Since this includes a potentially
+ non-threadsafe operation, add an assert that the class is owned by the current thread.
+
+2009-10-05 Kevin Ollivier <kevino@theolliviers.com>
+
+ wx build fix. Add Symbian files to the list of excludes.
+
+ * wscript:
+
+2009-10-05 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Remove precompiled header from JavaScriptCore compilation to
+ prevent qmake warning during autonomous compilation.
+ https://bugs.webkit.org/show_bug.cgi?id=30069
+
+ * JavaScriptCore.pro:
+
+2009-10-02 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Removed the concept of a "fast access cutoff" in arrays, because it
+ punished some patterns of array access too much, and made things too
+ complex for inlining in some cases.
+
+ 1.3% speedup on SunSpider.
+
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emitSlow_op_get_by_val):
+ (JSC::JIT::emitSlow_op_put_by_val):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::emit_op_get_by_val):
+ (JSC::JIT::emitSlow_op_get_by_val):
+ (JSC::JIT::emit_op_put_by_val):
+ (JSC::JIT::emitSlow_op_put_by_val):
+ * jit/JITStubs.cpp:
+ * jit/JITStubs.h:
+ (JSC::): Check m_vectorLength instead of m_fastAccessCutoff when
+ getting / putting from / to an array. Inline putting past the end of
+ the array.
+
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::JSArray):
+ (JSC::JSArray::getOwnPropertySlot):
+ (JSC::JSArray::getOwnPropertyDescriptor):
+ (JSC::JSArray::put):
+ (JSC::JSArray::putSlowCase):
+ (JSC::JSArray::deleteProperty):
+ (JSC::JSArray::getOwnPropertyNames):
+ (JSC::JSArray::increaseVectorLength):
+ (JSC::JSArray::setLength):
+ (JSC::JSArray::pop):
+ (JSC::JSArray::push):
+ (JSC::JSArray::sort):
+ (JSC::JSArray::fillArgList):
+ (JSC::JSArray::copyToRegisters):
+ (JSC::JSArray::compactForSorting):
+ (JSC::JSArray::checkConsistency):
+ * runtime/JSArray.h:
+ (JSC::JSArray::canGetIndex):
+ (JSC::JSArray::canSetIndex):
+ (JSC::JSArray::setIndex):
+ (JSC::JSArray::markChildrenDirect): Removed m_fastAccessCutoff, and
+ replaced with checks for JSValue() to detect reads and writes from / to
+ uninitialized parts of the array.
+
+2009-10-02 Jonni Rainisto <jonni.rainisto@nokia.com>
+
+ Reviewed by Darin Adler.
+
+ Math.random() gives too low values on Win32 when _CRT_RAND_S is not defined
+ https://bugs.webkit.org/show_bug.cgi?id=29956
+
+ * wtf/RandomNumber.cpp:
+ (WTF::randomNumber): Added PLATFORM(WIN_OS) to handle 15bit rand()
+
+2009-10-02 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Take one branch instead of two to test for JSValue().
+
+ 1.1% SunSpider speedup.
+
+ * jit/JITCall.cpp:
+ (JSC::JIT::compileOpCall):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_to_jsnumber):
+ (JSC::JIT::emit_op_create_arguments):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::emitSlow_op_get_by_val):
+ (JSC::JIT::emit_op_put_by_val): Test for the empty value tag, instead
+ of testing for the cell tag with a 0 payload.
+
+ * runtime/JSValue.cpp:
+ (JSC::JSValue::description): Added support for dumping the new empty value,
+ and deleted values, in debug builds.
+
+ * runtime/JSValue.h:
+ (JSC::JSValue::JSValue()): Construct JSValue() with the empty value tag.
+
+ (JSC::JSValue::JSValue(JSCell*)): Convert null pointer to the empty value
+ tag, to avoid having two different c++ versions of null / empty.
+
+ (JSC::JSValue::operator bool): Test for the empty value tag, instead
+ of testing for the cell tag with a 0 payload.
+
+2009-10-02 Steve Falkenburg <sfalken@apple.com>
+
+ Reviewed by Mark Rowe.
+
+ <https://bugs.webkit.org/show_bug.cgi?id=29989>
+ Safari version number shouldn't be exposed in WebKit code
+
+ For a WebKit version of 532.3.4:
+ Product version is: 5.32.3.4 (was 4.0.3.0)
+ File version is: 5.32.3.4 (was 4.532.3.4)
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.rc:
+
+2009-10-02 Tor Arne Vestbø <tor.arne.vestbo@nokia.com>
+
+ Rubber-stamped by Simon Hausmann.
+
+ Fix the Qt on Mac OS X build.
+
+ * wtf/FastMalloc.cpp:
+
+2009-10-02 Jørgen Lind <jorgen.lind@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Allow enabling and disabling of the JIT through a qmake variable.
+
+ Qt's configure may set this variable through .qmake.cache if a
+ commandline option is given and/or the compile test for hwcap.h
+ failed/succeeded.
+
+ * JavaScriptCore.pri:
+
+2009-10-01 Mark Rowe <mrowe@apple.com>
+
+ Fix the Tiger build. Don't unconditionally enable 3D canvas as it is not supported on Tiger.
+
+ * Configurations/FeatureDefines.xcconfig:
+
+2009-10-01 Yongjun Zhang <yongjun.zhang@nokia.com>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=29187
+
+ Don't inline ~ListRefPtr() to work around winscw compiler forward declaration
+ bug regarding templated classes.
+
+ The compiler bug is reported at:
+ https://xdabug001.ext.nokia.com/bugzilla/show_bug.cgi?id=9812
+
+ The change will be reverted when the above bug is fixed in winscw compiler.
+
+ * wtf/ListRefPtr.h:
+ (WTF::::~ListRefPtr):
+
+2009-10-01 Zoltan Horvath <zoltan@webkit.org>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Allow custom memory allocation control for the whole JavaScriptCore
+ https://bugs.webkit.org/show_bug.cgi?id=27029
+
+ Since in JavaScriptCore almost every class which has been instantiated by operator new is
+ inherited from FastAllocBase (bug #20422), we disable customizing global operator new for the Qt-port
+ when USE_SYSTEM_MALLOC=0.
+
+ Add #include <unistd.h> to FastMalloc.cpp because it's used by TCMalloc_PageHeap::scavengerThread().
+ (It's needed for the functionality of TCmalloc.)
+
+ Add TCSystemAlloc.cpp to JavaScriptCore.pri if USE_SYSTEM_MALLOC is disabled.
+
+ * JavaScriptCore.pri:
+ * wtf/FastMalloc.cpp:
+ (WTF::sleep):
+ * wtf/FastMalloc.h:
+
+2009-09-30 Gabor Loki <loki@inf.u-szeged.hu>
+
+ Reviewed by George Staikos.
+
+ Defines two pseudo-platforms for ARM and Thumb-2 instruction set.
+ https://bugs.webkit.org/show_bug.cgi?id=29122
+
+ Introduces WTF_PLATFORM_ARM_TRADITIONAL and WTF_PLATFORM_ARM_THUMB2
+ macros on ARM platforms. The PLATFORM(ARM_THUMB2) should be used
+ when Thumb-2 instruction set is the required target. The
+ PLATFORM(ARM_TRADITIONAL) is for generic ARM instruction set. In
+ case where the code is common the PLATFORM(ARM) have to be used.
+
+ Modified by George Wright <gwright@rim.com> to correctly work
+ with the RVCT-defined __TARGET_ARCH_ARM and __TARGET_ARCH_THUMB
+ compiler macros, as well as adding readability changes.
+
+ * wtf/Platform.h:
+
+2009-09-30 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Devirtualise array toString conversion
+
+ Tweak the implementation of Array.prototype.toString to have a fast path
+ when acting on a true JSArray.
+
+ * runtime/ArrayPrototype.cpp:
+ (JSC::arrayProtoFuncToString):
+
+2009-09-30 Csaba Osztrogonac <oszi@inf.u-szeged.hu>
+
+ Reviewed by Geoffrey Garen.
+
+ Buildfix for platforms using JSVALUE32.
+ https://bugs.webkit.org/show_bug.cgi?id=29915
+
+ After http://trac.webkit.org/changeset/48905 the build broke in JSVALUE32 case.
+ Also removed unreachable code.
+
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emit_op_add):
+ - Declaration of "OperandTypes types" moved before first use.
+ - Typos fixed: dst modified to result, regT2 added.
+ - Unreachable code removed.
+ (JSC::JIT::emitSlow_op_add):
+ - Missing declaration of "OperandTypes types" added.
+
+2009-09-30 Janne Koskinen <janne.p.koskinen@digia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Reduce heap size on Symbian from 64MB to 8MB.
+
+ This is not a perfect fix, it requires more fine tuning.
+ But this makes it possible again to debug in the emulator,
+ which is more important in order to be able to fix other
+ run-time issues.
+
+ * runtime/Collector.h:
+
+2009-09-30 Janne Koskinen <janne.p.koskinen@digia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Fix CRASH() macro for Symbian build.
+
+ * wtf/Assertions.h: Added missing }
+
+2009-09-29 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Inlined a few math operations.
+
+ ~1% SunSpider speedup.
+
+ * jit/JIT.h:
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::compileBinaryArithOpSlowCase):
+ (JSC::JIT::emitSlow_op_add):
+ (JSC::JIT::emitSlow_op_mul):
+ (JSC::JIT::emit_op_sub):
+ (JSC::JIT::emitSlow_op_sub): Don't take a stub call when operating on
+ a constant int and a double.
+
+2009-09-28 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Tidy up codeblock sampler
+ https://bugs.webkit.org/show_bug.cgi?id=29836
+
+ Some rather simple refactoring of codeblock sampler so that
+ it's easier for us to use it to find problems in non-jsc
+ environments
+
+ * JavaScriptCore.exp:
+ * bytecode/SamplingTool.h:
+ * debugger/Debugger.cpp:
+ (JSC::evaluateInGlobalCallFrame):
+ * debugger/DebuggerCallFrame.cpp:
+ (JSC::DebuggerCallFrame::evaluate):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::Interpreter):
+ (JSC::Interpreter::execute):
+ (JSC::Interpreter::privateExecute):
+ (JSC::Interpreter::enableSampler):
+ (JSC::Interpreter::dumpSampleData):
+ (JSC::Interpreter::startSampling):
+ (JSC::Interpreter::stopSampling):
+ * interpreter/Interpreter.h:
+ (JSC::Interpreter::sampler):
+ * jit/JIT.h:
+ * jsc.cpp:
+ (runWithScripts):
+ * runtime/Completion.cpp:
+ (JSC::checkSyntax):
+ (JSC::evaluate):
+ * runtime/Executable.h:
+ (JSC::EvalExecutable::EvalExecutable):
+ (JSC::ProgramExecutable::create):
+ (JSC::ProgramExecutable::ProgramExecutable):
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::startSampling):
+ (JSC::JSGlobalData::stopSampling):
+ (JSC::JSGlobalData::dumpSampleData):
+ * runtime/JSGlobalData.h:
+ * runtime/JSGlobalObjectFunctions.cpp:
+ (JSC::globalFuncEval):
+
+2009-09-29 Jeremy Orlow <jorlow@chromium.org>
+
+ Reviewed by Dimitri Glazkov.
+
+ Add GYP generated files to svn:ignore
+ https://bugs.webkit.org/show_bug.cgi?id=29895
+
+ The following files are generated by JavaScriptCore's GYP file and should be ignored:
+
+ pcre.mk
+ wtf.scons
+ wtf.mk
+ SConstruct
+ wtf_config.scons
+ wtf_config.mk
+ pcre.scons
+
+ * JavaScriptCore.gyp: Changed property svn:ignore.
+
+2009-09-29 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Standardized an optimization for adding non-numbers.
+
+ SunSpider says maybe a tiny speedup.
+
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emit_op_add):
+ (JSC::JIT::emitSlow_op_add):
+
+2009-09-29 Geoffrey Garen <ggaren@apple.com>
+
+ Windows build fix: export a new symbol.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-09-28 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Removed virtual destructor from JSGlobalObjectData to eliminate pointer
+ fix-ups when accessing JSGlobalObject::d.
+
+ Replaced with an explicit destructor function pointer.
+
+ 6% speedup on bench-alloc-nonretained.js.
+
+ * JavaScriptCore.exp:
+ * runtime/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::~JSGlobalObject):
+ (JSC::JSGlobalObject::destroyJSGlobalObjectData):
+ * runtime/JSGlobalObject.h:
+ (JSC::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData):
+ (JSC::JSGlobalObject::JSGlobalObject):
+
+2009-09-29 Janne Koskinen <janne.p.koskinen@digia.com>
+
+ Reviewed by David Kilzer.
+
+ [Qt] Assert messages prints visible in Symbian
+ https://bugs.webkit.org/show_bug.cgi?id=29808
+
+ Asserts use vprintf to print the messages to stderr.
+ In Symbian Open C it is not possible to see stderr so
+ I routed the messages to stdout instead.
+
+ * wtf/Assertions.cpp:
+
+2009-09-29 Janne Koskinen <janne.p.koskinen@digia.com>
+
+ Reviewed by Darin Adler.
+
+ [Qt] Symbian CRASH macro implementation
+
+ Added Symbian specific crash macro that
+ stops to crash line if JIT debugging is used.
+ Additional differentiation of access violation
+ (KERN-EXEC 3) and CRASH panic.
+
+ * wtf/Assertions.h:
+
+2009-09-28 Mark Rowe <mrowe@apple.com>
+
+ Fix the PowerPC build.
+
+ * JavaScriptCore.exp:
+
+2009-09-28 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ <rdar://problem/7195704> JavaScriptCore fails to mark registers when built for x86_64 using LLVM GCC.
+
+ * runtime/Collector.cpp:
+ (JSC::Heap::markCurrentThreadConservatively): Force jmp_buf to use the appropriate alignment for a pointer
+ to ensure that we correctly interpret the contents of registers during marking.
+
+2009-09-28 Geoffrey Garen <ggaren@apple.com>
+
+ Windows build fix: added new exports.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-09-28 Geoffrey Garen <ggaren@apple.com>
+
+ Windows build fix: removed exports that no longer exist.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-09-28 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ NotNullPassRefPtr: smart pointer optimized for passing references that are not null
+ https://bugs.webkit.org/show_bug.cgi?id=29822
+
+ Added NotNullPassRefPtr, and deployed it in all places that initialize
+ JavaScript objects.
+
+ 2.2% speedup on bench-allocate-nonretained.js.
+
+ * API/JSCallbackConstructor.cpp:
+ (JSC::JSCallbackConstructor::JSCallbackConstructor):
+ * API/JSCallbackConstructor.h:
+ * API/JSCallbackObject.h:
+ * API/JSCallbackObjectFunctions.h:
+ (JSC::JSCallbackObject::JSCallbackObject):
+ * JavaScriptCore.exp:
+ * bytecode/CodeBlock.h:
+ (JSC::CodeBlock::addFunctionDecl):
+ (JSC::CodeBlock::addFunctionExpr):
+ * runtime/ArrayConstructor.cpp:
+ (JSC::ArrayConstructor::ArrayConstructor):
+ * runtime/ArrayConstructor.h:
+ * runtime/ArrayPrototype.cpp:
+ (JSC::ArrayPrototype::ArrayPrototype):
+ * runtime/ArrayPrototype.h:
+ * runtime/BooleanConstructor.cpp:
+ (JSC::BooleanConstructor::BooleanConstructor):
+ * runtime/BooleanConstructor.h:
+ * runtime/BooleanObject.cpp:
+ (JSC::BooleanObject::BooleanObject):
+ * runtime/BooleanObject.h:
+ * runtime/BooleanPrototype.cpp:
+ (JSC::BooleanPrototype::BooleanPrototype):
+ * runtime/BooleanPrototype.h:
+ * runtime/DateConstructor.cpp:
+ (JSC::DateConstructor::DateConstructor):
+ * runtime/DateConstructor.h:
+ * runtime/DateInstance.cpp:
+ (JSC::DateInstance::DateInstance):
+ * runtime/DateInstance.h:
+ * runtime/DatePrototype.cpp:
+ (JSC::DatePrototype::DatePrototype):
+ * runtime/DatePrototype.h:
+ * runtime/ErrorConstructor.cpp:
+ (JSC::ErrorConstructor::ErrorConstructor):
+ * runtime/ErrorConstructor.h:
+ * runtime/ErrorInstance.cpp:
+ (JSC::ErrorInstance::ErrorInstance):
+ * runtime/ErrorInstance.h:
+ * runtime/ErrorPrototype.cpp:
+ (JSC::ErrorPrototype::ErrorPrototype):
+ * runtime/ErrorPrototype.h:
+ * runtime/FunctionConstructor.cpp:
+ (JSC::FunctionConstructor::FunctionConstructor):
+ * runtime/FunctionConstructor.h:
+ * runtime/FunctionPrototype.cpp:
+ (JSC::FunctionPrototype::FunctionPrototype):
+ * runtime/FunctionPrototype.h:
+ * runtime/GlobalEvalFunction.cpp:
+ (JSC::GlobalEvalFunction::GlobalEvalFunction):
+ * runtime/GlobalEvalFunction.h:
+ * runtime/InternalFunction.cpp:
+ (JSC::InternalFunction::InternalFunction):
+ * runtime/InternalFunction.h:
+ (JSC::InternalFunction::InternalFunction):
+ * runtime/JSActivation.cpp:
+ (JSC::JSActivation::JSActivation):
+ * runtime/JSActivation.h:
+ (JSC::JSActivation::JSActivationData::JSActivationData):
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::JSArray):
+ * runtime/JSArray.h:
+ * runtime/JSByteArray.cpp:
+ (JSC::JSByteArray::JSByteArray):
+ * runtime/JSByteArray.h:
+ * runtime/JSFunction.cpp:
+ (JSC::JSFunction::JSFunction):
+ * runtime/JSFunction.h:
+ * runtime/JSGlobalObject.h:
+ (JSC::JSGlobalObject::JSGlobalObject):
+ * runtime/JSONObject.h:
+ (JSC::JSONObject::JSONObject):
+ * runtime/JSObject.h:
+ (JSC::JSObject::JSObject):
+ (JSC::JSObject::setStructure):
+ * runtime/JSVariableObject.h:
+ (JSC::JSVariableObject::JSVariableObject):
+ * runtime/JSWrapperObject.h:
+ (JSC::JSWrapperObject::JSWrapperObject):
+ * runtime/MathObject.cpp:
+ (JSC::MathObject::MathObject):
+ * runtime/MathObject.h:
+ * runtime/NativeErrorConstructor.cpp:
+ (JSC::NativeErrorConstructor::NativeErrorConstructor):
+ * runtime/NativeErrorConstructor.h:
+ * runtime/NativeErrorPrototype.cpp:
+ (JSC::NativeErrorPrototype::NativeErrorPrototype):
+ * runtime/NativeErrorPrototype.h:
+ * runtime/NumberConstructor.cpp:
+ (JSC::NumberConstructor::NumberConstructor):
+ * runtime/NumberConstructor.h:
+ * runtime/NumberObject.cpp:
+ (JSC::NumberObject::NumberObject):
+ * runtime/NumberObject.h:
+ * runtime/NumberPrototype.cpp:
+ (JSC::NumberPrototype::NumberPrototype):
+ * runtime/NumberPrototype.h:
+ * runtime/ObjectConstructor.cpp:
+ (JSC::ObjectConstructor::ObjectConstructor):
+ * runtime/ObjectConstructor.h:
+ * runtime/ObjectPrototype.cpp:
+ (JSC::ObjectPrototype::ObjectPrototype):
+ * runtime/ObjectPrototype.h:
+ * runtime/PropertyNameArray.h:
+ (JSC::PropertyNameArrayData::setCachedPrototypeChain):
+ * runtime/PrototypeFunction.cpp:
+ (JSC::PrototypeFunction::PrototypeFunction):
+ * runtime/PrototypeFunction.h:
+ * runtime/RegExpConstructor.cpp:
+ (JSC::RegExpConstructor::RegExpConstructor):
+ * runtime/RegExpConstructor.h:
+ * runtime/RegExpObject.cpp:
+ (JSC::RegExpObject::RegExpObject):
+ * runtime/RegExpObject.h:
+ (JSC::RegExpObject::RegExpObjectData::RegExpObjectData):
+ * runtime/RegExpPrototype.cpp:
+ (JSC::RegExpPrototype::RegExpPrototype):
+ * runtime/RegExpPrototype.h:
+ * runtime/StringConstructor.cpp:
+ (JSC::StringConstructor::StringConstructor):
+ * runtime/StringConstructor.h:
+ * runtime/StringObject.cpp:
+ (JSC::StringObject::StringObject):
+ * runtime/StringObject.h:
+ * runtime/StringObjectThatMasqueradesAsUndefined.h:
+ (JSC::StringObjectThatMasqueradesAsUndefined::StringObjectThatMasqueradesAsUndefined):
+ * runtime/StringPrototype.cpp:
+ (JSC::StringPrototype::StringPrototype):
+ * runtime/StringPrototype.h:
+ * wtf/PassRefPtr.h:
+ (WTF::NotNullPassRefPtr::NotNullPassRefPtr):
+ (WTF::NotNullPassRefPtr::~NotNullPassRefPtr):
+ (WTF::NotNullPassRefPtr::get):
+ (WTF::NotNullPassRefPtr::clear):
+ (WTF::NotNullPassRefPtr::releaseRef):
+ (WTF::NotNullPassRefPtr::operator*):
+ (WTF::NotNullPassRefPtr::operator->):
+ (WTF::NotNullPassRefPtr::operator!):
+ (WTF::NotNullPassRefPtr::operator UnspecifiedBoolType):
+ * wtf/RefPtr.h:
+ (WTF::RefPtr::RefPtr):
+ (WTF::operator==):
+
+2009-09-28 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Hard dependency on SSE2 instruction set with JIT
+ https://bugs.webkit.org/show_bug.cgi?id=29779
+
+ Add floating point support checks to op_jfalse and op_jtrue, and
+ fix the logic for the slow case of op_add
+
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emitSlow_op_add):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_jfalse):
+ (JSC::JIT::emit_op_jtrue):
+
+2009-09-28 Yaar Schnitman <yaar@chromium.org>
+
+ Reviewed by Dimitri Glazkov.
+
+ Chromium port - recognize we are being built independently
+ of chromium and look for dependencies under webkit/chromium rather
+ than chromium/src.
+
+ https://bugs.webkit.org/show_bug.cgi?id=29722
+
+ * JavaScriptCore.gyp/JavaScriptCore.gyp:
+
+2009-09-28 Jakub Wieczorek <faw217@gmail.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Implement XSLT support with QtXmlPatterns.
+ https://bugs.webkit.org/show_bug.cgi?id=28303
+
+ * wtf/Platform.h: Add a WTF_USE_QXMLQUERY #define.
+
+2009-09-28 Gabor Loki <loki@inf.u-szeged.hu>
+
+ Reviewed by Simon Hausmann.
+
+ Remove __clear_cache which is an internal function of GCC
+ https://bugs.webkit.org/show_bug.cgi?id=28886
+
+ Although __clear_cache is exported from GCC, this is an internal
+ function. GCC makes no promises about it.
+
+ * jit/ExecutableAllocator.h:
+ (JSC::ExecutableAllocator::cacheFlush):
+
+2009-09-28 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Oliver Hunt.
+
+ Fix an absolute path to somewhere in Oliver's machine to a relative path
+ for derived JSONObject.lut.h.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2009-09-28 Joerg Bornemann <joerg.bornemann@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Add ARM version detection for Windows CE.
+
+ * wtf/Platform.h:
+
+2009-09-26 Yongjun Zhang <yongjun.zhang@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Add MarkStackSymbian.cpp to build JavascriptCore for Symbian.
+
+ Re-use Windows shrinkAllocation implementation because Symbian doesn't
+ support releasing part of memory region.
+
+ Use fastMalloc and fastFree to implement allocateStack and releaseStack
+ for Symbian port.
+
+ * JavaScriptCore.pri:
+ * runtime/MarkStack.h:
+ (JSC::MarkStack::MarkStackArray::shrinkAllocation):
+ * runtime/MarkStackSymbian.cpp: Added.
+ (JSC::MarkStack::initializePagesize):
+ (JSC::MarkStack::allocateStack):
+ (JSC::MarkStack::releaseStack):
+
+2009-09-25 Gabor Loki <loki@inf.u-szeged.hu>
+
+ Reviewed by Gavin Barraclough.
+
+ Fix unaligned data access in YARR_JIT on ARMv5 and below.
+ https://bugs.webkit.org/show_bug.cgi?id=29695
+
+ On ARMv5 and below all data access should be naturally aligned.
+ In the YARR_JIT there is a case when character pairs are
+ loaded from the input string, but this data access is not
+ naturally aligned. This fix introduces load32WithUnalignedHalfWords
+ and branch32WithUnalignedHalfWords functions which contain
+ naturally aligned memory loads - half word loads - on ARMv5 and below.
+
+ * assembler/MacroAssemblerARM.cpp:
+ (JSC::MacroAssemblerARM::load32WithUnalignedHalfWords):
+ * assembler/MacroAssemblerARM.h:
+ (JSC::MacroAssemblerARM::load32WithUnalignedHalfWords):
+ (JSC::MacroAssemblerARM::branch32WithUnalignedHalfWords):
+ * assembler/MacroAssemblerARMv7.h:
+ (JSC::MacroAssemblerARMv7::load32WithUnalignedHalfWords):
+ (JSC::MacroAssemblerARMv7::branch32):
+ (JSC::MacroAssemblerARMv7::branch32WithUnalignedHalfWords):
+ * assembler/MacroAssemblerX86Common.h:
+ (JSC::MacroAssemblerX86Common::load32WithUnalignedHalfWords):
+ (JSC::MacroAssemblerX86Common::branch32WithUnalignedHalfWords):
+ * wtf/Platform.h:
+ * yarr/RegexJIT.cpp:
+ (JSC::Yarr::RegexGenerator::generatePatternCharacterPair):
+
+2009-09-25 Jeremy Orlow <jorlow@chromium.org>
+
+ This is breaking Chromium try bots, so I'm counting this as a build fix.
+
+ Add more svn:ignore exceptions. On different platforms, these files are
+ generated with different case for JavaScriptCore. Also there are some
+ wtf project files that get built apparently.
+
+ * JavaScriptCore.gyp: Changed property svn:ignore.
+
+2009-09-25 Ada Chan <adachan@apple.com>
+
+ Build fix.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-09-25 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Inlined some object creation code, including lexicalGlobalObject access
+ https://bugs.webkit.org/show_bug.cgi?id=29750
+
+ SunSpider says 0.5% faster.
+
+ 0.8% speedup on bench-alloc-nonretained.js.
+ 2.5% speedup on v8-splay.js.
+
+ * interpreter/CachedCall.h:
+ (JSC::CachedCall::CachedCall):
+ * interpreter/CallFrame.h:
+ (JSC::ExecState::lexicalGlobalObject):
+ (JSC::ExecState::globalThisValue):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::dumpRegisters):
+ (JSC::Interpreter::execute):
+ (JSC::Interpreter::privateExecute):
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+ * runtime/FunctionConstructor.cpp:
+ (JSC::constructFunction):
+ * runtime/ScopeChain.cpp:
+ (JSC::ScopeChainNode::print):
+ * runtime/ScopeChain.h:
+ (JSC::ScopeChainNode::ScopeChainNode):
+ (JSC::ScopeChainNode::~ScopeChainNode):
+ (JSC::ScopeChainNode::push):
+ (JSC::ScopeChain::ScopeChain):
+ (JSC::ScopeChain::globalObject): Added a globalObject data member to ScopeChainNode.
+ Replaced accessor function for globalObject() with data member. Replaced
+ globalThisObject() accessor with direct access to globalThis, to match.
+
+ * runtime/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::init):
+ * runtime/JSGlobalObject.h: Inlined array and object construction.
+
+2009-09-25 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Add ARM version detection rules for Symbian
+ https://bugs.webkit.org/show_bug.cgi?id=29715
+
+ * wtf/Platform.h:
+
+2009-09-24 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Mark "Do It!" Rowe.
+
+ Some GCC versions don't like C++-style comments in preprocessor
+ directives, change to C-style to shut them up.
+
+ * wtf/Platform.h:
+
+2009-09-24 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Division is needlessly slow in 64-bit
+ https://bugs.webkit.org/show_bug.cgi?id=29723
+
+ Add codegen for op_div on x86-64
+
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ (JSC::JIT::privateCompileSlowCases):
+ * jit/JIT.h:
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::compileBinaryArithOpSlowCase):
+ (JSC::JIT::emit_op_div):
+ (JSC::JIT::emitSlow_op_div):
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::isOperandConstantImmediateDouble):
+ (JSC::JIT::addressFor):
+ (JSC::JIT::emitLoadDouble):
+ (JSC::JIT::emitLoadInt32ToDouble):
+ (JSC::JIT::emitJumpSlowCaseIfNotImmediateNumber):
+
+2009-09-24 Jeremy Orlow <jorlow@chromium.org>
+
+ Reviewed by Dimitri Glazkov.
+
+ Add GYP generated files to svn:ignore
+ https://bugs.webkit.org/show_bug.cgi?id=29724
+
+ Adding the following files to the svn:ignore list (all in the
+ JavaScriptCore/JavaScriptCore.gyp directory)
+
+ JavaScriptCore.xcodeproj
+ JavaScriptCore.sln
+ JavaScriptCore.vcproj
+ JavaScriptCore_Debug.rules
+ JavaScriptCore_Release.rules
+ JavaScriptCore_Release - no tcmalloc.rules
+ JavaScriptCore_Purify.rules
+ JavaScriptCore.mk
+ JavaScriptCore_Debug_rules.mk
+ JavaScriptCore_Release_rules.mk
+ JavaScriptCore_Release - no tcmalloc_rules.mk
+ JavaScriptCore_Purify_rules.mk
+ JavaScriptCore.scons
+ JavaScriptCore_main.scons
+
+ * JavaScriptCore.gyp: Changed property svn:ignore.
+
+2009-09-24 Yong Li <yong.li@torchmobile.com>
+
+ Reviewed by Adam Barth.
+
+ Replace platform-dependent code with WTF::currentTime()
+ https://bugs.webkit.org/show_bug.cgi?id=29148
+
+ * jsc.cpp:
+ (StopWatch::start):
+ (StopWatch::stop):
+ (StopWatch::getElapsedMS):
+ * runtime/TimeoutChecker.cpp:
+ (JSC::getCPUTime):
+
+2009-09-24 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ <rdar://problem/7215058> FastMalloc scavenging thread should be named
+
+ * wtf/FastMalloc.cpp:
+ (WTF::TCMalloc_PageHeap::scavengerThread): Set the thread name.
+ * wtf/Platform.h: Move the knowledge of whether pthread_setname_np exists to here as HAVE(PTHREAD_SETNAME_NP).
+ * wtf/ThreadingPthreads.cpp:
+ (WTF::setThreadNameInternal): Use HAVE(PTHREAD_SETNAME_NP).
+
+2009-09-24 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Renamed clear to removeAll, as suggested by Darin Adler.
+
+ * wtf/HashCountedSet.h:
+ (WTF::::removeAll):
+
+2009-09-24 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Fix FastMalloc to build with assertions enabled.
+
+ * wtf/FastMalloc.cpp:
+ (WTF::TCMalloc_Central_FreeList::ReleaseToSpans):
+ * wtf/TCSpinLock.h:
+ (TCMalloc_SpinLock::IsHeld):
+
+2009-09-24 Geoffrey Garen <ggaren@apple.com>
+
+ Suggested by Darin Adler.
+
+ Removed some unnecessary parameter names.
+
+ * wtf/HashCountedSet.h:
+
+2009-09-24 Janne Koskinen <janne.p.koskinen@digia.com>
+
+ Reviewed by Simon Hausmann.
+
+ On Windows JSChar is typedef'ed to wchar_t.
+
+ When building with WINSCW for Symbian we need to do the
+ same typedef.
+
+ * API/JSStringRef.h:
+
+2009-09-23 Geoffrey Garen <ggaren@apple.com>
+
+ A piece of my last patch that I forgot.
+
+ * wtf/HashCountedSet.h:
+ (WTF::::clear): Added HashCountedSet::clear.
+
+2009-09-24 Gabor Loki <loki@inf.u-szeged.hu>
+
+ Reviewed by Gavin Barraclough.
+
+ Avoid __clear_cache built-in function if DISABLE_BUILTIN_CLEAR_CACHE define is set
+ https://bugs.webkit.org/show_bug.cgi?id=28886
+
+ There are some GCC packages (for example GCC-2006q3 from CodeSourcery)
+ which contain __clear_cache built-in function only for C while the C++
+ version of __clear_cache is missing on ARM architectures.
+
+ Fixed a small bug in the inline assembly of cacheFlush function on
+ ARM_TRADITIONAL.
+
+ * jit/ExecutableAllocator.h:
+ (JSC::ExecutableAllocator::cacheFlush):
+
+2009-09-23 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Added the ability to swap vectors with inline capacities, so you can
+ store a vector with inline capacity in a hash table.
+
+ * wtf/Vector.h:
+ (WTF::swap):
+ (WTF::VectorBuffer::swap):
+
+2009-09-23 David Kilzer <ddkilzer@apple.com>
+
+ Move definition of USE(PLUGIN_HOST_PROCESS) from WebKitPrefix.h to Platform.h
+
+ Reviewed by Mark Rowe.
+
+ * wtf/Platform.h: Define WTF_USE_PLUGIN_HOST_PROCESS to 1 when
+ building on 64-bit SnowLeopard. Define to 0 elsewhere.
+
+2009-09-22 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Code sampling builds are broken.
+ https://bugs.webkit.org/show_bug.cgi?id=29662
+
+ Fix build.
+
+ * bytecode/EvalCodeCache.h:
+ (JSC::EvalCodeCache::get):
+ * bytecode/SamplingTool.cpp:
+ (JSC::ScriptSampleRecord::sample):
+ (JSC::SamplingTool::doRun):
+ (JSC::SamplingTool::notifyOfScope):
+ (JSC::compareScriptSampleRecords):
+ (JSC::SamplingTool::dump):
+ * bytecode/SamplingTool.h:
+ (JSC::ScriptSampleRecord::ScriptSampleRecord):
+ (JSC::ScriptSampleRecord::~ScriptSampleRecord):
+ (JSC::SamplingTool::SamplingTool):
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::BytecodeGenerator):
+ (JSC::BytecodeGenerator::emitNewFunction):
+ (JSC::BytecodeGenerator::emitNewFunctionExpression):
+ * bytecompiler/BytecodeGenerator.h:
+ (JSC::BytecodeGenerator::makeFunction):
+ * debugger/Debugger.cpp:
+ (JSC::evaluateInGlobalCallFrame):
+ * debugger/DebuggerCallFrame.cpp:
+ (JSC::DebuggerCallFrame::evaluate):
+ * parser/Nodes.cpp:
+ (JSC::ScopeNode::ScopeNode):
+ * runtime/Completion.cpp:
+ (JSC::checkSyntax):
+ (JSC::evaluate):
+ * runtime/Executable.cpp:
+ (JSC::FunctionExecutable::fromGlobalCode):
+ * runtime/Executable.h:
+ (JSC::ScriptExecutable::ScriptExecutable):
+ (JSC::EvalExecutable::EvalExecutable):
+ (JSC::EvalExecutable::create):
+ (JSC::ProgramExecutable::ProgramExecutable):
+ (JSC::FunctionExecutable::create):
+ (JSC::FunctionExecutable::FunctionExecutable):
+ * runtime/JSGlobalObjectFunctions.cpp:
+ (JSC::globalFuncEval):
+
+2009-09-22 Darin Adler <darin@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ * wtf/Forward.h: Added PassOwnPtr.
+
+2009-09-22 Yaar Schnitman <yaar@chromium.org>
+
+ Reviewed by David Levin.
+
+ Ported chromium.org's javascriptcore.gyp for the webkit chromium port.
+
+ https://bugs.webkit.org/show_bug.cgi?id=29617
+
+ * JavaScriptCore.gyp/JavaScriptCore.gyp: Added.
+
+2009-09-22 Thiago Macieira <thiago.macieira@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Fix compilation with WINSCW: no varargs macros
+
+ Disable variadic arguments for WINSCW just like we do
+ for MSVC7.
+
+ * wtf/Assertions.h:
+
+2009-09-22 Kent Hansen <khansen@trolltech.com>
+
+ Reviewed by Simon Hausmann.
+
+ Disable variadic macros on MSVC7.
+
+ This was originally added in r26589 but not extended
+ when LOG_DISABLED/ASSERT_DISABLED was introduced.
+
+ * wtf/Assertions.h:
+
+2009-09-22 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Unreviewed build fix for Windows CE < 5
+
+ Define WINCEBASIC to disable the IsDebuggerPresent() code in
+ wtf/Assertions.cpp.
+
+ * JavaScriptCore.pri:
+
+2009-09-22 Joerg Bornemann <joerg.bornemann@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Fix major memory leak in JavaScriptCore RegisterFile on Windows CE
+
+ https://bugs.webkit.org/show_bug.cgi?id=29367
+
+ On Widows CE we must decommit all committed pages before we release
+ them. See VirtualFree documentation.
+ Desktop Windows behaves much smoother in this situation.
+
+ * interpreter/RegisterFile.cpp:
+ (JSC::RegisterFile::~RegisterFile):
+
+2009-09-21 Greg Bolsinga <bolsinga@apple.com>
+
+ Reviewed by Simon Fraser & Sam Weinig.
+
+ Add ENABLE(ORIENTATION_EVENTS)
+ https://bugs.webkit.org/show_bug.cgi?id=29508
+
+ * wtf/Platform.h: Also sort PLATFORM(IPHONE) #defines.
+
+2009-09-21 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
+
+ Reviewed by Eric Seidel.
+
+ [Fix] SourceCode's uninitialized member
+
+ Potential source of crashes and bugs was fixed. Default constructor
+ didn't initialized m_provider member.
+
+ https://bugs.webkit.org/show_bug.cgi?id=29364
+
+ * parser/SourceCode.h:
+ (JSC::SourceCode::SourceCode):
+
+2009-09-21 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ REGRESSION (r48582): Crash in StructureStubInfo::initPutByIdTransition when reloading trac.webkit.org
+ https://bugs.webkit.org/show_bug.cgi?id=29599
+
+ It is unsafe to attempt to cache new property transitions on
+ dictionaries of any type.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::tryCachePutByID):
+ * jit/JITStubs.cpp:
+ (JSC::JITThunks::tryCachePutByID):
+
+2009-09-21 Oliver Hunt <oliver@apple.com>
+
+ RS=Maciej Stachowiak.
+
+ Re-land SNES fix with corrected assertion.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::resolveGlobal):
+ (JSC::Interpreter::tryCachePutByID):
+ (JSC::Interpreter::tryCacheGetByID):
+ * jit/JITStubs.cpp:
+ (JSC::JITThunks::tryCachePutByID):
+ (JSC::JITThunks::tryCacheGetByID):
+ (JSC::DEFINE_STUB_FUNCTION):
+ * runtime/BatchedTransitionOptimizer.h:
+ (JSC::BatchedTransitionOptimizer::BatchedTransitionOptimizer):
+ * runtime/JSObject.cpp:
+ (JSC::JSObject::removeDirect):
+ * runtime/Structure.cpp:
+ (JSC::Structure::Structure):
+ (JSC::Structure::getEnumerablePropertyNames):
+ (JSC::Structure::despecifyDictionaryFunction):
+ (JSC::Structure::addPropertyTransitionToExistingStructure):
+ (JSC::Structure::addPropertyTransition):
+ (JSC::Structure::removePropertyTransition):
+ (JSC::Structure::toDictionaryTransition):
+ (JSC::Structure::toCacheableDictionaryTransition):
+ (JSC::Structure::toUncacheableDictionaryTransition):
+ (JSC::Structure::fromDictionaryTransition):
+ (JSC::Structure::removePropertyWithoutTransition):
+ * runtime/Structure.h:
+ (JSC::Structure::isDictionary):
+ (JSC::Structure::isUncacheableDictionary):
+ (JSC::Structure::):
+ * runtime/StructureChain.cpp:
+ (JSC::StructureChain::isCacheable):
+
+2009-09-21 Adam Roben <aroben@apple.com>
+
+ Revert r48573, as it caused many assertion failures
+
+ * interpreter/Interpreter.cpp:
+ * jit/JITStubs.cpp:
+ * runtime/BatchedTransitionOptimizer.h:
+ * runtime/JSObject.cpp:
+ * runtime/Structure.cpp:
+ * runtime/Structure.h:
+ * runtime/StructureChain.cpp:
+
+2009-09-21 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk>
+
+ Unreviewed make dist build fix. Missing files.
+
+ * GNUmakefile.am:
+
+2009-09-19 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam 'Cabin Boy' Weinig.
+
+ Fix stack alignment with ARM THUMB2 JIT.
+ https://bugs.webkit.org/show_bug.cgi?id=29526
+
+ Stack is currently being decremented by 0x3c, bump this to 0x40 to make this a
+ multiple of 16 bytes.
+
+ * jit/JITStubs.cpp:
+ (JSC::JITThunks::JITThunks):
+ * jit/JITStubs.h:
+
+2009-09-20 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ SNES is too slow
+ https://bugs.webkit.org/show_bug.cgi?id=29534
+
+ The problem was that the emulator used multiple classes with
+ more properties than our dictionary cutoff allowed, this resulted
+ in more or less all critical logic inside the emulator requiring
+ uncached property access.
+
+ Rather than simply bumping the dictionary cutoff, this patch
+ recognises that there are two ways to create a "dictionary"
+ structure. Either by adding a large number of properties, or
+ by removing a property. In the case of adding properties we
+ know all the existing properties will maintain their existing
+ offsets, so we could cache access to those properties, if we
+ know they won't be removed.
+
+ To make this possible, this patch adds the logic required to
+ distinguish a dictionary created by addition from one created
+ by removal. With this logic in place we can now cache access
+ to objects with large numbers of properties.
+
+ SNES performance improved by more than 6x.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::resolveGlobal):
+ (JSC::Interpreter::tryCachePutByID):
+ (JSC::Interpreter::tryCacheGetByID):
+ * jit/JITStubs.cpp:
+ (JSC::JITThunks::tryCachePutByID):
+ (JSC::JITThunks::tryCacheGetByID):
+ (JSC::DEFINE_STUB_FUNCTION):
+ * runtime/BatchedTransitionOptimizer.h:
+ (JSC::BatchedTransitionOptimizer::BatchedTransitionOptimizer):
+ * runtime/JSObject.cpp:
+ (JSC::JSObject::removeDirect):
+ * runtime/Structure.cpp:
+ (JSC::Structure::Structure):
+ (JSC::Structure::getEnumerablePropertyNames):
+ (JSC::Structure::despecifyDictionaryFunction):
+ (JSC::Structure::addPropertyTransitionToExistingStructure):
+ (JSC::Structure::addPropertyTransition):
+ (JSC::Structure::removePropertyTransition):
+ (JSC::Structure::toDictionaryTransition):
+ (JSC::Structure::toCacheableDictionaryTransition):
+ (JSC::Structure::toUncacheableDictionaryTransition):
+ (JSC::Structure::fromDictionaryTransition):
+ (JSC::Structure::removePropertyWithoutTransition):
+ * runtime/Structure.h:
+ (JSC::Structure::isDictionary):
+ (JSC::Structure::isUncacheableDictionary):
+ (JSC::Structure::):
+ * runtime/StructureChain.cpp:
+ (JSC::StructureChain::isCacheable):
+
+2009-09-19 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Implement ES5 Object.create function
+ https://bugs.webkit.org/show_bug.cgi?id=29524
+
+ Implement Object.create. Very simple patch, effectively Object.defineProperties
+ only creating the target object itself.
+
+ * runtime/CommonIdentifiers.h:
+ * runtime/ObjectConstructor.cpp:
+ (JSC::ObjectConstructor::ObjectConstructor):
+ (JSC::objectConstructorCreate):
+
+2009-09-19 Dan Bernstein <mitz@apple.com>
+
+ Fix clean debug builds.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-09-19 Joerg Bornemann <joerg.bornemann@nokia.com>
+
+ Reviewed by George Staikos.
+
+ QtWebKit Windows CE compile fix
+
+ https://bugs.webkit.org/show_bug.cgi?id=29379
+
+ There is no _aligned_alloc or _aligned_free on Windows CE.
+ We just use the Windows code that was there before and use VirtualAlloc.
+ But that also means that the BLOCK_SIZE must be 64K as this function
+ allocates on 64K boundaries.
+
+ * runtime/Collector.cpp:
+ (JSC::Heap::allocateBlock):
+ (JSC::Heap::freeBlock):
+ * runtime/Collector.h:
+
+2009-09-19 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Implement ES5 Object.defineProperties function
+ https://bugs.webkit.org/show_bug.cgi?id=29522
+
+ Implement Object.defineProperties. Fairly simple patch, simply makes use of
+ existing functionality used for defineProperty.
+
+ * runtime/CommonIdentifiers.h:
+ * runtime/ObjectConstructor.cpp:
+ (JSC::ObjectConstructor::ObjectConstructor):
+ (JSC::defineProperties):
+ (JSC::objectConstructorDefineProperties):
+
+2009-09-19 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by NOBODY (Build fix).
+
+ Windows build fix part2
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-09-19 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by NOBODY (Buildfix).
+
+ Windows build fix part 1.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-09-18 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Implement ES5 Object.defineProperty function
+ https://bugs.webkit.org/show_bug.cgi?id=29503
+
+ Implement Object.defineProperty. This requires adding the API to
+ ObjectConstructor, along with a helper function that implements the
+ ES5 internal [[ToPropertyDescriptor]] function. It then adds
+ JSObject::defineOwnProperty that implements the appropriate ES5 semantics.
+ Currently defineOwnProperty uses a delete followed by a put to redefine
+ attributes of a property, clearly this is less efficient than it could be
+ but we can improve this if it needs to be possible in future.
+
+ * JavaScriptCore.exp:
+ * debugger/DebuggerActivation.cpp:
+ (JSC::DebuggerActivation::defineGetter):
+ (JSC::DebuggerActivation::defineSetter):
+ * debugger/DebuggerActivation.h:
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+ * jit/JITStubs.cpp:
+ Update defineGetter/Setter calls
+ * runtime/CommonIdentifiers.h:
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::getOwnPropertySlot):
+ * runtime/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::defineGetter):
+ (JSC::JSGlobalObject::defineSetter):
+ * runtime/JSGlobalObject.h:
+ * runtime/JSObject.cpp:
+ (JSC::JSObject::defineGetter):
+ (JSC::JSObject::defineSetter):
+ (JSC::putDescriptor):
+ (JSC::JSObject::defineOwnProperty):
+ * runtime/JSObject.h:
+ * runtime/ObjectConstructor.cpp:
+ (JSC::ObjectConstructor::ObjectConstructor):
+ (JSC::objectConstructorGetOwnPropertyDescriptor):
+ (JSC::toPropertyDescriptor):
+ (JSC::objectConstructorDefineProperty):
+ * runtime/ObjectPrototype.cpp:
+ (JSC::objectProtoFuncDefineGetter):
+ (JSC::objectProtoFuncDefineSetter):
+ * runtime/PropertyDescriptor.cpp:
+ (JSC::PropertyDescriptor::writable):
+ (JSC::PropertyDescriptor::enumerable):
+ (JSC::PropertyDescriptor::configurable):
+ (JSC::PropertyDescriptor::isDataDescriptor):
+ (JSC::PropertyDescriptor::isGenericDescriptor):
+ (JSC::PropertyDescriptor::isAccessorDescriptor):
+ (JSC::PropertyDescriptor::getter):
+ (JSC::PropertyDescriptor::setter):
+ (JSC::PropertyDescriptor::setDescriptor):
+ (JSC::PropertyDescriptor::setAccessorDescriptor):
+ (JSC::PropertyDescriptor::setWritable):
+ (JSC::PropertyDescriptor::setEnumerable):
+ (JSC::PropertyDescriptor::setConfigurable):
+ (JSC::PropertyDescriptor::setSetter):
+ (JSC::PropertyDescriptor::setGetter):
+ (JSC::PropertyDescriptor::equalTo):
+ (JSC::PropertyDescriptor::attributesEqual):
+ (JSC::PropertyDescriptor::attributesWithOverride):
+ * runtime/PropertyDescriptor.h:
+ (JSC::PropertyDescriptor::PropertyDescriptor):
+ (JSC::PropertyDescriptor::value):
+ (JSC::PropertyDescriptor::setValue):
+ (JSC::PropertyDescriptor::isEmpty):
+ (JSC::PropertyDescriptor::writablePresent):
+ (JSC::PropertyDescriptor::enumerablePresent):
+ (JSC::PropertyDescriptor::configurablePresent):
+ (JSC::PropertyDescriptor::setterPresent):
+ (JSC::PropertyDescriptor::getterPresent):
+ (JSC::PropertyDescriptor::operator==):
+ (JSC::PropertyDescriptor::):
+
+2009-09-18 Gabor Loki <loki@inf.u-szeged.hu>
+
+ Reviewed by Gavin Barraclough.
+
+ Build fix to enable ARM_THUMB2 on Linux
+ https://bugs.webkit.org/show_bug.cgi?id=
+
+ * jit/ExecutableAllocator.h:
+ (JSC::ExecutableAllocator::cacheFlush):
+ * jit/JITStubs.cpp:
+ * wtf/Platform.h:
+
+2009-09-18 Gabor Loki <loki@inf.u-szeged.hu>
+
+ Reviewed by Gavin Barraclough.
+
+ Defines two pseudo-platforms for ARM and Thumb-2 instruction set.
+ https://bugs.webkit.org/show_bug.cgi?id=29122
+
+ Introduces WTF_PLATFORM_ARM_TRADITIONAL and WTF_PLATFORM_ARM_THUMB2
+ macros on ARM platforms. The PLATFORM(ARM_THUMB2) should be used
+ when Thumb-2 instruction set is the required target. The
+ PLATFORM(ARM_TRADITIONAL) is for generic ARM instruction set. In
+ case where the code is common the PLATFORM(ARM) have to be used.
+
+ * assembler/ARMAssembler.cpp:
+ * assembler/ARMAssembler.h:
+ * assembler/ARMv7Assembler.h:
+ * assembler/MacroAssembler.h:
+ * assembler/MacroAssemblerARM.cpp:
+ * assembler/MacroAssemblerARM.h:
+ * assembler/MacroAssemblerCodeRef.h:
+ (JSC::MacroAssemblerCodePtr::MacroAssemblerCodePtr):
+ * jit/ExecutableAllocator.h:
+ * jit/JIT.h:
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::beginUninterruptedSequence):
+ (JSC::JIT::preserveReturnAddressAfterCall):
+ (JSC::JIT::restoreReturnAddressBeforeReturn):
+ (JSC::JIT::restoreArgumentReference):
+ (JSC::JIT::restoreArgumentReferenceForTrampoline):
+ * jit/JITOpcodes.cpp:
+ * jit/JITStubs.cpp:
+ (JSC::JITThunks::JITThunks):
+ * jit/JITStubs.h:
+ * wtf/Platform.h:
+ * yarr/RegexJIT.cpp:
+ (JSC::Yarr::RegexGenerator::generateEnter):
+
+2009-09-18 Joerg Bornemann <joerg.bornemann@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Fix the Qt/Windows CE build.
+
+ * JavaScriptCore.pri: Build the ce_time.cpp functions from
+ within Qt externally.
+ * wtf/DateMath.cpp: Removed unnecessary Qt #ifdef, for the
+ Qt build these functions are no external, too.
+
+2009-09-17 Janne Koskinen <janne.p.koskinen@digia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Symbian/WINSCW build fox.
+
+ Repeat Q_OS_WIN wchar_t hack for WINSCW, similar to
+ revision 24774.
+
+ WINSCW defines wchar_t, thus UChar has to be wchar_t
+
+ * wtf/unicode/qt4/UnicodeQt4.h:
+
+2009-09-17 Janne Koskinen <janne.p.koskinen@digia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Symbian/WINSCW build fix.
+
+ https://bugs.webkit.org/show_bug.cgi?id=29186
+
+ WINSCW Template specialisation name in declaration must the be the same as in implementation.
+
+ * runtime/LiteralParser.h:
+
+2009-09-15 Norbert Leser <norbert.leser@nokia.com>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=27060
+
+ Symbian compiler for emulator target (WINSCW) fails with
+ "illegal operand" for m_attributesInPrevious in structure.ccp
+ (when calling make_pair functions).
+ This error is apparently due to the compiler not properly
+ resolving the unsigned type of the declared bitfield.
+
+ Initial patch explicitly casted m_attributesInPrevious
+ to unsigned, but since bitfield optimization is not critical for
+ the emulator target, this conditional change in header file
+ appears to be least intrusive.
+
+ * runtime/Structure.h:
+
+2009-09-16 Gabor Loki <loki@inf.u-szeged.hu>
+
+ Reviewed by Darin Adler.
+
+ Fix GCC warnings on ARM_THUMB2 platform
+
+ * assembler/ARMv7Assembler.h:
+ (JSC::ARMThumbImmediate::countLeadingZerosPartial):
+ * assembler/MacroAssemblerARMv7.h:
+ (JSC::MacroAssemblerARMv7::branchTruncateDoubleToInt32):
+ (JSC::MacroAssemblerARMv7::moveFixedWidthEncoding):
+
+2009-09-16 Greg Bolsinga <bolsinga@apple.com>
+
+ Add ENABLE(INSPECTOR)
+ https://bugs.webkit.org/show_bug.cgi?id=29260
+
+ Reviewed by David Kilzer.
+
+ * wtf/Platform.h:
+
+2009-09-16 Greg Bolsinga <bolsinga@apple.com>
+
+ Add ENABLE(CONTEXT_MENUS)
+ https://bugs.webkit.org/show_bug.cgi?id=29225
+
+ Reviewed by David Kilzer.
+
+ * wtf/Platform.h:
+
+2009-09-16 Benjamin C Meyer <benjamin.meyer@torchmobile.com>
+
+ Reviewed by Eric Seidel.
+
+ The webkit stdint and stdbool headers exists because
+ the compiler MSVC doesn't include them. The check
+ should not check for PLATFORM(WIN_OS) but for MSVC.
+
+ * os-win32/stdbool.h:
+ * os-win32/stdint.h:
+
+2009-09-16 Greg Bolsinga <bolsinga@apple.com>
+
+ Add ENABLE(DRAG_SUPPORT)
+ https://bugs.webkit.org/show_bug.cgi?id=29233
+
+ Reviewed by David Kilzer.
+
+ * wtf/Platform.h:
+
+2009-09-16 Kevin Ollivier <kevino@theolliviers.com>
+
+ waf build fix after flag was moved to correct place.
+
+ * wscript:
+
+2009-09-16 Tor Arne Vestbø <tor.arne.vestbo@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Build fix for 64-bit Qt on Mac OS X
+
+ * wtf/Platform.h: Use JSVALUE64 on DARWIN, not only on MAC
+
+2009-09-16 Zoltan Herczeg <zherczeg@inf.u-szeged.hu>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Fix wtf/ThreadSpecific.h under Qt to free thread local objects.
+ https://bugs.webkit.org/show_bug.cgi?id=29295
+
+ This is an important fix when JavaScript workers are in use, since
+ unfreed ThreadGlobalDatas leak a big amount of memory (50-100k each).
+ QThreadStorage calls the destructor of a given object, which is the
+ ThreadSpecific::Data. Unlike pthread, Qt is object oriented, and does
+ not support the calling of a static utility function when the thread
+ is about to close. In this patch we call the ThreadSpecific::destroy()
+ utility function from the destructor of ThreadSpecific::Data. Moreover,
+ since Qt resets all thread local values to 0 before the calling of the
+ appropriate destructors, we set back the pointer to its original value.
+ This is necessary because the get() method of the ThreadSpecific
+ object may be called during the exuction of the destructor.
+
+ * wtf/ThreadSpecific.h:
+ (WTF::ThreadSpecific::Data::~Data):
+ (WTF::::~ThreadSpecific):
+ (WTF::::set):
+ (WTF::::destroy):
+
+2009-09-10 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Allow anonymous storage inside JSObject
+ https://bugs.webkit.org/show_bug.cgi?id=29168
+
+ Add the concept of anonymous slots to Structures so that it is
+ possible to store references to values that need marking in the
+ standard JSObject storage buffer. This allows us to reduce the
+ malloc overhead of some objects (by allowing them to store JS
+ values in the inline storage of the object) and reduce the
+ dependence of custom mark functions (if all an objects children
+ are in the standard object property storage there's no need to
+ mark them manually).
+
+ * JavaScriptCore.exp:
+ * runtime/JSObject.h:
+ (JSC::JSObject::putAnonymousValue):
+ (JSC::JSObject::getAnonymousValue):
+ (JSC::JSObject::addAnonymousSlots):
+ * runtime/JSWrapperObject.h:
+ (JSC::JSWrapperObject::createStructure):
+ (JSC::JSWrapperObject::JSWrapperObject):
+ (JSC::JSWrapperObject::setInternalValue):
+ * runtime/PropertyMapHashTable.h:
+ * runtime/Structure.cpp:
+ (JSC::Structure::~Structure):
+ (JSC::Structure::materializePropertyMap):
+ (JSC::Structure::addAnonymousSlotsTransition):
+ (JSC::Structure::copyPropertyTable):
+ (JSC::Structure::put):
+ (JSC::Structure::rehashPropertyMapHashTable):
+ * runtime/Structure.h:
+ (JSC::Structure::propertyStorageSize):
+ (JSC::StructureTransitionTable::reifySingleTransition):
+ * runtime/StructureTransitionTable.h:
+ (JSC::StructureTransitionTable::TransitionTable::addSlotTransition):
+ (JSC::StructureTransitionTable::TransitionTable::removeSlotTransition):
+ (JSC::StructureTransitionTable::TransitionTable::getSlotTransition):
+ (JSC::StructureTransitionTable::getAnonymousSlotTransition):
+ (JSC::StructureTransitionTable::addAnonymousSlotTransition):
+ (JSC::StructureTransitionTable::removeAnonymousSlotTransition):
+
+2009-09-15 Alex Milowski <alex@milowski.com>
+
+ Reviewed by Tor Arne Vestbø.
+
+ Added the ENABLE_MATHML define to the features
+
+ * Configurations/FeatureDefines.xcconfig:
+
+2009-09-15 Csaba Osztrogonac <oszi@inf.u-szeged.hu>
+
+ Reviewed by Tor Arne Vestbø.
+
+ [Qt] Build fix for windows.
+
+ After http://trac.webkit.org/changeset/47795 the MinGW build broke,
+ because MinGW has __mingw_aligned_malloc instead of _aligned_malloc.
+
+ * runtime/Collector.cpp:
+ (JSC::Heap::allocateBlock): MinGW case added.
+ (JSC::Heap::freeBlock): MinGW case added.
+
+2009-09-15 Csaba Osztrogonac <oszi@inf.u-szeged.hu>
+
+ Reviewed by Tor Arne Vestbø.
+
+ [Qt] Build fix for Windows/MinGW
+
+ https://bugs.webkit.org/show_bug.cgi?id=29268
+
+ * wtf/Platform.h: JSVALUE32_64 temporarily disabled on PLATFORM(WIN_OS) with COMPILER(MINGW)
+
+2009-09-14 Gabor Loki <loki@inf.u-szeged.hu>
+
+ Reviewed by Gavin Barraclough.
+
+ Detect VFP at runtime in generic ARM port on Linux platform.
+ https://bugs.webkit.org/show_bug.cgi?id=29076
+
+ * JavaScriptCore.pri:
+ * assembler/MacroAssemblerARM.cpp: Added.
+ (JSC::isVFPPresent):
+ * assembler/MacroAssemblerARM.h:
+ (JSC::MacroAssemblerARM::supportsFloatingPoint):
+
+2009-09-14 Csaba Osztrogonac <oszi@inf.u-szeged.hu>
+
+ Reviewed by Tor Arne Vestbø.
+
+ [Qt] Build fix for windows build.
+
+ * JavaScriptCore.pri: Correct a logic error.
+ * pcre/dftables: Add missing paranthesis for tmpdir function.
+
+2009-09-12 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by NOBODY (Build fix).
+
+ Build fix for windows exports (again).
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-09-12 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by NOBODY (Build fix).
+
+ Build fix for windows exports.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-09-12 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by NOBODY (Build fix).
+
+ Correct fix for non-allinonefile builds
+
+ * runtime/ObjectConstructor.cpp:
+
+2009-09-12 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by NOBODY (Build fix).
+
+ Fix non-allinonefile builds
+
+ * runtime/ObjectConstructor.cpp:
+
+2009-09-12 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ [ES5] Implement Object.keys
+ https://bugs.webkit.org/show_bug.cgi?id=29170
+
+ This patch basically requires two separate steps, the first is to split getPropertyNames
+ into two functions -- getOwnPropertyNames and getPropertyNames, basically making them behave
+ in the same way as getOwnPropertySlot and getPropertySlot. In essence getOwnPropertyNames
+ produces the list of properties on an object excluding its prototype chain and getPropertyNames
+ just iterates the the object and its prototype chain calling getOwnPropertyNames at each level.
+
+ * API/JSCallbackObject.h:
+ * API/JSCallbackObjectFunctions.h:
+ (JSC::::getOwnPropertyNames):
+ * JavaScriptCore.exp:
+ * debugger/DebuggerActivation.cpp:
+ (JSC::DebuggerActivation::getOwnPropertyNames):
+ * debugger/DebuggerActivation.h:
+ * runtime/CommonIdentifiers.h:
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::getOwnPropertyNames):
+ * runtime/JSArray.h:
+ * runtime/JSByteArray.cpp:
+ (JSC::JSByteArray::getOwnPropertyNames):
+ * runtime/JSByteArray.h:
+ * runtime/JSNotAnObject.cpp:
+ (JSC::JSNotAnObject::getOwnPropertyNames):
+ * runtime/JSNotAnObject.h:
+ * runtime/JSObject.cpp:
+ (JSC::JSObject::getOwnPropertyNames):
+ * runtime/JSObject.h:
+ * runtime/JSVariableObject.cpp:
+ (JSC::JSVariableObject::getOwnPropertyNames):
+ * runtime/JSVariableObject.h:
+ * runtime/ObjectConstructor.cpp:
+ (JSC::ObjectConstructor::ObjectConstructor):
+ (JSC::objectConstructorKeys):
+ * runtime/RegExpMatchesArray.h:
+ (JSC::RegExpMatchesArray::getOwnPropertyNames):
+ * runtime/StringObject.cpp:
+ (JSC::StringObject::getOwnPropertyNames):
+ * runtime/StringObject.h:
+ * runtime/Structure.cpp:
+ (JSC::Structure::getOwnEnumerablePropertyNames):
+ (JSC::Structure::getEnumerablePropertyNames):
+ * runtime/Structure.h:
+
+2009-09-11 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ getPropertyNames caching is invalid when the prototype chain contains objects with custom getPropertyNames
+ https://bugs.webkit.org/show_bug.cgi?id=29214
+
+ Add a flag to TypeInfo to indicate whether a type overrides getPropertyNames.
+ This flag is used to make sure that caching of the property name data is safe.
+
+ * API/JSCallbackConstructor.h:
+ (JSC::JSCallbackConstructor::createStructure):
+ * debugger/DebuggerActivation.h:
+ (JSC::DebuggerActivation::createStructure):
+ * runtime/BooleanObject.h:
+ (JSC::BooleanObject::createStructure):
+ * runtime/DatePrototype.h:
+ (JSC::DatePrototype::createStructure):
+ * runtime/FunctionPrototype.h:
+ (JSC::FunctionPrototype::createStructure):
+ * runtime/JSONObject.h:
+ (JSC::JSONObject::createStructure):
+ * runtime/JSObject.h:
+ (JSC::JSObject::createStructure):
+ * runtime/JSTypeInfo.h:
+ (JSC::TypeInfo::hasDefaultGetPropertyNames):
+ * runtime/JSVariableObject.h:
+ (JSC::JSVariableObject::createStructure):
+ * runtime/JSWrapperObject.h:
+ (JSC::JSWrapperObject::createStructure):
+ * runtime/MathObject.h:
+ (JSC::MathObject::createStructure):
+ * runtime/NumberConstructor.h:
+ (JSC::NumberConstructor::createStructure):
+ * runtime/NumberObject.h:
+ (JSC::NumberObject::createStructure):
+ * runtime/RegExpConstructor.h:
+ (JSC::RegExpConstructor::createStructure):
+ * runtime/RegExpObject.h:
+ (JSC::RegExpObject::createStructure):
+ * runtime/StructureChain.cpp:
+ (JSC::StructureChain::isCacheable):
+
+2009-09-11 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Geoff Garen.
+
+ https://bugs.webkit.org/show_bug.cgi?id=29207
+ Add checks for using WebCore JS context on secondary threads
+
+ * runtime/JSGlobalData.cpp: (JSC::JSGlobalData::JSGlobalData):
+ * runtime/JSGlobalData.h:
+ Added a new mainThreadOnly flag that WebCore would set.
+
+ * runtime/Collector.cpp: (JSC::Heap::registerThread): JSC API methods always call this,
+ so this is a good place to check that the API isn't used form a wrong thread.
+
+2009-09-11 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Compiling JavaScriptCore on sparc 64 with gcc fails.
+
+ ThreadSafeShared uses the atomic __gnu_cxx::__exchange_and_add with an int,
+ however on sparc 64 the _Atomic_word argument is typedefed to long (8 bytes).
+
+ The patch disables WTF_USE_LOCKFREE_THREADSAFESHARED in ThreadSafeShared to use
+ a mutex instead when compiling for sparc 64 with gcc.
+
+ https://bugs.webkit.org/show_bug.cgi?id=29175
+
+ * wtf/Platform.h:
+ __sparc64__ is not defined on all OS.
+ Uses instead: __sparc__ && __arch64__ || __sparcv9
+ * wtf/Threading.h:
+
+2009-09-11 Prasanth Ullattil <prasanth.ullattil@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Fix compile error on Windows7(64Bit) with latest SDK.
+
+ Added the missing include file.
+
+ * runtime/UString.cpp:
+
+2009-09-11 Joerg Bornemann <joerg.bornemann@trolltech.com>
+
+ Reviewed by Simon Hausmann.
+
+ Qt/Windows CE compile fix, include the executable allocator and
+ markstack implementation in the windows build.
+
+ * JavaScriptCore.pri:
+
+2009-09-08 John Abd-El-Malek <jam@chromium.org>
+
+ Reviewed by Dimitri Glazkov.
+
+ Remove unneeded define for ActiveX.
+ https://bugs.webkit.org/show_bug.cgi?id=29054
+
+ * wtf/Platform.h:
+
+2009-09-10 Mark Rowe <mrowe@apple.com>
+
+ Rubber-stamped by Sam Weinig.
+
+ Update JavaScriptCore and WebKit's FeatureDefines.xcconfig so that they are in sync with WebCore as they need to be.
+
+ * Configurations/FeatureDefines.xcconfig:
+
+2009-09-10 Fumitoshi Ukai <ukai@chromium.org>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Export WTF::tryFastMalloc used in WebSocketChannel.
+ https://bugs.webkit.org/show_bug.cgi?id=28038
+
+ * JavaScriptCore.exp:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-09-10 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by NOBODY (Build fix).
+
+ Make StructureTransitionTable use an enum for the PtrAndFlags member
+ used for the single transition slot optimisation.
+
+ * runtime/StructureTransitionTable.h:
+ (JSC::StructureTransitionTable::StructureTransitionTable):
+ (JSC::StructureTransitionTable::usingSingleTransitionSlot):
+ (JSC::StructureTransitionTable::):
+
+2009-09-10 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Refactor StructureTransitionTable and Structure to unify handling of the single slot optimization
+ https://bugs.webkit.org/show_bug.cgi?id=29141
+
+ Make StructureTransitionTable encapsulate the single transition slot optimization.
+
+ * runtime/Structure.cpp:
+ (JSC::Structure::Structure):
+ (JSC::Structure::~Structure):
+ (JSC::Structure::addPropertyTransitionToExistingStructure):
+ (JSC::Structure::addPropertyTransition):
+ (JSC::Structure::addPropertyWithoutTransition):
+ (JSC::Structure::removePropertyWithoutTransition):
+ (JSC::Structure::hasTransition):
+ * runtime/Structure.h:
+ (JSC::StructureTransitionTable::contains):
+ (JSC::StructureTransitionTable::get):
+ (JSC::StructureTransitionTable::hasTransition):
+ (JSC::StructureTransitionTable::reifySingleTransition):
+ * runtime/StructureTransitionTable.h:
+ (JSC::StructureTransitionTable::StructureTransitionTable):
+ (JSC::StructureTransitionTable::~StructureTransitionTable):
+ (JSC::StructureTransitionTable::remove):
+ (JSC::StructureTransitionTable::add):
+ (JSC::StructureTransitionTable::table):
+ (JSC::StructureTransitionTable::singleTransition):
+ (JSC::StructureTransitionTable::usingSingleTransitionSlot):
+ (JSC::StructureTransitionTable::setSingleTransition):
+ (JSC::StructureTransitionTable::setTransitionTable):
+ (JSC::StructureTransitionTable::):
+ * wtf/PtrAndFlags.h:
+ (WTF::PtrAndFlags::PtrAndFlags):
+
+2009-09-10 Zoltan Horvath <zoltan@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ Implement fastDeleteSkippingDestructor for FastAllocBase and fastDeleteAllValues for HashSet
+ https://bugs.webkit.org/show_bug.cgi?id=25930
+
+ FastAllocBase has been extended with fastDeleteSkippingDestructor function which
+ releases memory without destructor call. fastDeleteAllValues has been implemented
+ similar as deleteAllValues but it uses fastDelete function to release memory.
+
+ * wtf/FastAllocBase.h:
+ (WTF::fastDeleteSkippingDestructor):
+ * wtf/HashSet.h:
+ (WTF::fastDeleteAllValues):
+
+2009-09-10 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Darin Adler.
+
+ ARM compiler does not understand GCC visibility attribute
+ https://bugs.webkit.org/show_bug.cgi?id=29079
+
+ * API/JSBase.h: Make the test more specific to hit only
+ the GCC compiler
+
+2009-09-10 Adam Barth <abarth@webkit.org>
+
+ Unreviewed revert of the previous change. It broke the tests.
+
+ * wtf/dtoa.cpp:
+ (WTF::dtoa):
+
+2009-09-10 Ben Laurie <benl@google.com>
+
+ Reviewed by Adam Barth.
+
+ <https://bugs.webkit.org/show_bug.cgi?id=26836>
+
+ If dtoa was given a small buffer and the number was either infinite or
+ NaN, then the buffer would be overflowed.
+
+ * wtf/dtoa.cpp:
+
+2009-09-09 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Darin Adler.
+
+ Change reinterpret_cast to static_cast in r48212.
+
+ * jit/ExecutableAllocator.h:
+ (JSC::ExecutableAllocator::cacheFlush):
+
+2009-09-09 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Darin Adler.
+
+ Remove WTF_PLATFORM_FORCE_PACK as it is no longer used
+ https://bugs.webkit.org/show_bug.cgi?id=29066
+
+ * wtf/Platform.h:
+
+2009-09-09 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Ariya Hidayat.
+
+ Implement flushing the instruction cache for Symbian
+ https://bugs.webkit.org/show_bug.cgi?id=29075
+
+ * jit/ExecutableAllocator.h:
+ (JSC::ExecutableAllocator::cacheFlush): Call IMB_Range to flush
+ the instruction cache on Symbian
+
+2009-09-09 Kent Hansen <khansen@trolltech.com>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=29024
+ Make JavaScriptCore compile on platforms with case-insensitive file systems and typeinfo.h in STL
+
+ These platforms include Microsoft Visual Studio 2003, and Symbian with Metrowerks compiler.
+
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * runtime/JSTypeInfo.h: Copied from JavaScriptCore/runtime/TypeInfo.h.
+ * runtime/Structure.h:
+ * runtime/TypeInfo.h: Removed.
+
+2009-09-08 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ JSON.stringify(Date) loses the milliseconds information
+ https://bugs.webkit.org/show_bug.cgi?id=29063
+
+ Make sure we include milliseconds in the output of toISOString.
+
+ * runtime/DatePrototype.cpp:
+ (JSC::dateProtoFuncToISOString):
+
+2009-09-08 Kevin Ollivier <kevino@theolliviers.com>
+
+ wx build fix, generate derived sources earlier in order to make sure
+ they're found by the build system when generating the list of sources to build.
+
+ * wscript:
+
+2009-09-08 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Build fix when USE(LOCKFREE_THREADSAFESHARED) is not defined
+ https://bugs.webkit.org/show_bug.cgi?id=29011
+
+ * wtf/Threading.h: Use LOCKFREE_THREADSAFESHARED guard for
+ atomicIncrement and atomicDecrement
+
+2009-09-07 Zoltan Horvath <zoltan@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ Allow custom memory allocation control in Yarr's RegexInterpreter
+ https://bugs.webkit.org/show_bug.cgi?id=29025
+
+ Inherits RegexInterpreter classes from FastAllocBase (bug #20422), which has
+ been instantiated by 'new':
+
+ class ByteDisjunction
+ -> instantiated in JavaScriptCore/yarr/RegexInterpreter.cpp:1462
+
+ struct BytecodePattern
+ -> instantiated in JavaScriptCore/yarr/RegexInterpreter.cpp:1279
+
+ * yarr/RegexInterpreter.h:
+
+2009-09-07 Drew Wilson <atwilson@google.com>
+
+ Reverting r48121 to fix Windows build errors.
+
+ * JavaScriptCore.exp:
+
+2009-09-07 Drew Wilson <atwilson@google.com>
+
+ Reviewed by David Levin.
+
+ Enable SHARED_WORKERS by default
+ https://bugs.webkit.org/show_bug.cgi?id=28959
+
+ * Configurations/FeatureDefines.xcconfig:
+
+2009-09-07 Fumitoshi Ukai <ukai@chromium.org>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Export WTF::tryFastMalloc used in WebSocketChannel.
+ https://bugs.webkit.org/show_bug.cgi?id=28038
+
+ * JavaScriptCore.exp:
+
+2009-09-04 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by NOBODY (Build fix).
+
+ Fix windows export files
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-09-04 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ [[ToString]] conversion should use the actual toString function for String objects.
+
+ Remove incorrect specialisations of toString conversions on StringObject.
+
+ * JavaScriptCore.exp:
+ * runtime/StringObject.cpp:
+ * runtime/StringObject.h:
+
+2009-09-04 Steve Falkenburg <sfalken@apple.com>
+
+ Windows build fix.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: Add new export.
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: Add new export.
+
+2009-09-04 Steve Falkenburg <sfalken@apple.com>
+
+ Windows build fix.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: Remove unneeded export.
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: Remove unneeded export.
+
+2009-09-04 Darin Adler <darin@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ DateInstance object collected on ARM JIT (JSValue: WTF_USE_JSVALUE32)
+ https://bugs.webkit.org/show_bug.cgi?id=28909
+
+ Part two.
+
+ Make some improvements to garbage collection code:
+
+ 1) Create a runtime assertion that catches any classes that
+ override markChildren but have the HasDefaultMark bit set.
+ 2) Remove checks of the mark bit outside the MarkStack::append
+ function; they are redundant.
+ 3) Improve the efficiency of the asObject and asArray functions
+ when called on JSCell* to avoid a round trip to JSValue.
+ 4) Make more callers use the checked asCell and asObject
+ casting functions rather than unchecked casts.
+ 5) Removed the JSCell::marked function and other GC-related
+ functions because these operations are no longer things that
+ code other than the core GC code needs to do directly. Fixed
+ callers that were calling them.
+
+ * runtime/Collector.cpp:
+ (JSC::Heap::markConservatively): Removed unneeded call to MarkStack::drain.
+ (JSC::Heap::markProtectedObjects): Removed unneeded check of the mark
+ bit and call to MarkStack::drain.
+ (JSC::Heap::collect): Removed unneeded checks of the mark bit and also
+ changed call to SmallStrings::mark to call markChildren instead to match
+ the rest of the objects.
+ (JSC::typeName): Removed unneeded cast to JSObject*.
+
+ * runtime/JSArray.h:
+ (JSC::asArray): Added an overload for JSCell* and changed the JSValue
+ version to call it. Removed some unneeded casts.
+ (JSC::JSArray::markChildrenDirect): Marked this function inline. It's in
+ a header, and if not marked inline this could lead to linking problems.
+ (JSC::MarkStack::markChildren): Added. This helper function is used by
+ the drain function to avoid repating code. Also added the code here to
+ check fro default mark violations in debug code. If a markChildren
+ function adds something to the mark stack, but the type info claimed
+ hasDefaultMark was true, then we will get an assertion now. Also fixed
+ the assertion about the mark bit to use the Heap function directly
+ because we don't have a JSCell::marked function any more.
+ (JSC::MarkStack::drain): Changed a local variable from "v" to "value",
+ and from "currentCell" to "cell". Changed to call markChildren in two
+ places instead of repeating a chain of if statements twice. Changed
+ code that reads and writes the mark bit to use Heap::isCellMarked and
+ Heap::markCell so we can eliminate the JSCell::marked and
+ JSCell::markCellDirect functions.
+
+ * runtime/JSCell.h: Removed JSCell's markCellDirect and marked member
+ functions. Added a comment explaining that asCell should be deprecated
+ in favor of the JSValue asCell member function.
+ (JSC::MarkStack::append): Added the assertion that catches callers
+ that have set the HasDefaultMark bit incorrectly. Changed
+ code that reads and writes the mark bit to use Heap::isCellMarked and
+ Heap::markCell so we can eliminate the JSCell::marked and
+ JSCell::markCellDirect functions. Moved the overload of
+ MarkStack::append for JSValue here so it can call through to the cell
+ version. The old version had a copy of all the code instead, but that
+ repeated the conversion from JSValue to JSCell* and the check for
+ whether a value is a cell multiple times.
+ (JSC::Structure::markAggregate): Moved this function here to avoid
+ dependencies for Structure.h, since this calls MarkStack::append.
+
+ * runtime/JSObject.cpp:
+ (JSC::JSObject::markChildren): Added code to clear
+ m_isCheckingForDefaultMarkViolation so the marking done by JSObject
+ doesn't trigger the assertion.
+
+ * runtime/JSValue.h: Moved some stray includes that were outside the
+ header guard inside it. Not sure how that happened! Removed the
+ GC-related member functions markChildren, hasChildren, marked, and
+ markDirect.
+
+ * runtime/JSWrapperObject.h: Made markChildren private.
+ (JSC::JSWrapperObject::createStructure): Added. Fixes a bug where the
+ HasDefaultMark bit was set.
+
+ * runtime/MarkStack.h: Added m_isCheckingForDefaultMarkViolation and
+ initialized it to false. Moved the append function body from here to
+ JSCell.h. Added a declaration of a private markChildren function used
+ inside the drain function.
+
+ * runtime/SmallStrings.cpp:
+ (JSC::SmallStrings::markChildren): Changed the name and style of this
+ function to match other functions. This allows us to share the normal
+ mark stack code path.
+
+ * runtime/SmallStrings.h: Changed the name and interface of mark to
+ the more-normal markChildren style.
+
+ * runtime/Structure.h: Moved the body of markAggregate into the
+ JSCell.h to avoid a circular dependency with JSCell.h.
+
+2009-09-04 Darin Adler <darin@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ DateInstance object collected on ARM JIT (JSValue: WTF_USE_JSVALUE32)
+ https://bugs.webkit.org/show_bug.cgi?id=28909
+
+ Part one.
+
+ Make some improvements to garbage collection code:
+
+ 1) Fix the two classes that had the default mark bit set but
+ should not.
+ 2) Remove checks of the mark bit outside the MarkStack::append
+ function; they are redundant.
+ 3) Make more callers use the checked asCell and asObject
+ casting functions rather than unchecked casts.
+ 4) Removed some GC-related functions because these operations are
+ no longer things that code other than the core GC code needs
+ to do directly. Fixed callers that were calling them.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::markAggregate): Removed unneeded check of the mark
+ bit before calling MarkStack::append.
+
+ * interpreter/Register.h: Removed unneeded marked and markChildren
+ functions.
+
+ * jit/JITStubs.cpp:
+ (op_eq): Removed unneeded assertions, instead using checked casting
+ functions such as asObject.
+
+ * runtime/ArgList.h: Added now-needed forward declaration of MarkStack.
+
+ * runtime/GetterSetter.cpp:
+ (JSC::GetterSetter::markChildren): Remmoved unneeded check of the mark bit.
+
+ * runtime/GlobalEvalFunction.h:
+ (JSC::GlobalEvalFunction::createStructure): Added. Fixes a bug where the
+ HasDefaultMark bit was set.
+
+ * runtime/JSCell.cpp:
+ (JSC::JSCell::getObject): Use asObject to avoid a direct static_cast.
+
+ * runtime/JSObject.h:
+ (JSC::asObject): Added an overload for JSCell* and changed the JSValue
+ version to call it.
+ (JSC::JSValue::get): Use asObject to avoid a direct static_cast.
+
+ * runtime/JSWrapperObject.h: Made markChildren private.
+ (JSC::JSWrapperObject::createStructure): Added. Fixes a bug where the
+ HasDefaultMark bit was set. Later we may want to optimize this for
+ wrapper types that never have cells in their internal values, but there
+ is no measured performance regression in SunSpider or V8 doing this
+ all the time.
+
+ * runtime/MarkStack.cpp: Tweaked formatting.
+
+2009-09-04 Kevin Ollivier <kevino@theolliviers.com>
+
+ wx build fix. Switch USE_ defines over to the compiler so that they can be
+ checked by files not including config.h (like WebCorePrefix.h).
+
+ * wtf/Platform.h:
+
+2009-09-03 Yong Li <yong.li@torchmobile.com>
+
+ Reviewed by David Levin.
+
+ Remove unnecessary dependency on unistd.h
+ https://bugs.webkit.org/show_bug.cgi?id=28962
+
+ * runtime/Completion.cpp:
+
+2009-09-03 Fumitoshi Ukai <ukai@chromium.org>
+
+ Reviewed by Eric Seidel.
+
+ Add strnstr for Linux and Windows in StringExtras.h
+ https://bugs.webkit.org/show_bug.cgi?id=28901
+
+ * wtf/StringExtras.h:
+ (strnstr):
+
+2009-09-03 Zoltan Horvath <hzoltan@inf.u-szeged.hu>
+
+ Reviewed by Darin Adler.
+
+ Allow custom memory allocation control for JavaScriptCore's HashEntry class
+ https://bugs.webkit.org/show_bug.cgi?id=27830
+
+ Inherits HashEntry class from FastAllocBase because it has been
+ instantiated by 'new' JavaScriptCore/runtime/Lookup.cpp:32.
+
+ * runtime/Lookup.h:
+
+2009-09-02 Gavin Barraclough <barraclough@apple.com>
+
+ Should crash if JIT code buffer allocation fails.
+
+ https://bugs.webkit.org/show_bug.cgi?id=28926
+ <rdar://problem/7031922>
+
+ * jit/ExecutableAllocatorPosix.cpp:
+ (JSC::ExecutablePool::systemAlloc):
+ * jit/ExecutableAllocatorWin.cpp:
+ (JSC::ExecutablePool::systemAlloc):
+
+2009-09-02 Kevin Ollivier <kevino@theolliviers.com>
+
+ waf build fixes for Windows/MSVC.
+
+ * wscript:
+
+2009-09-02 Kevin Ollivier <kevino@theolliviers.com>
+
+ Build fix for building on Windows.
+
+ * wtf/ThreadingPthreads.cpp:
+
+2009-09-02 Norbert Leser <norbert.leser@nokia.com>
+
+ Reviewed by Eric Seidel.
+
+ Use fastMalloc when neither MMAP nor VIRTUALALLOC are enabled
+
+ RegisterFile constructor currently throws #error when both
+ MMAP and VIRTUALALLOC conditions fail.
+ On any platform that does not provide these features
+ (for instance, Symbian),
+ the fallback should be regular malloc (or fastMalloc).
+ It is functionally equivalent in this case, even though it may
+ have certain drawbacks such as lack of dynamic pre-allocation.
+
+ * interpreter/RegisterFile.cpp:
+ (JSC::RegisterFile::~RegisterFile):
+ * interpreter/RegisterFile.h:
+ (JSC::RegisterFile::RegisterFile):
+
+2009-08-31 Robert Agoston <Agoston.Robert@stud.u-szeged.hu>
+
+ Reviewed by Gavin Barraclough.
+
+ Fixed typo.
+ https://bugs.webkit.org/show_bug.cgi?id=28691
+
+ * parser/Parser.h:
+ (JSC::Parser::parse):
+
+2009-08-27 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ JSON Stringifier does not follow ES5 spec for handling of Number, String and Boolean objects
+ https://bugs.webkit.org/show_bug.cgi?id=28797
+
+ Fixed unwrapBoxedPrimitive to do the right thing, which necessitated a couple of new exception
+ checks, and corrected the logic in gap to correctly convert Number and String objects.
+
+ * runtime/JSONObject.cpp:
+ (JSC::unwrapBoxedPrimitive):
+ (JSC::gap):
+ (JSC::Stringifier::Stringifier):
+ (JSC::Stringifier::appendStringifiedValue):
+
+2009-08-27 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Adam Roben.
+
+ JSON.stringify replacer array does not accept values that are not string primitives.
+ https://bugs.webkit.org/show_bug.cgi?id=28788
+
+ Update the JSON stringifier to initialise its replacer array according to the most
+ recent version of the spec.
+
+ * runtime/Identifier.h:
+ (JSC::Identifier::from):
+ * runtime/JSONObject.cpp:
+ (JSC::Stringifier::Stringifier):
+
+2009-08-27 Alexey Proskuryakov <ap@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ https://bugs.webkit.org/show_bug.cgi?id=28753
+ <rdar://problem/7173448> Excessive number of threads (and a crash)
+
+ * wtf/Threading.h: (WTF::atomicIncrement): Changed atomicIncrement to match decrement
+ and return the new value. Also added using directives for these functions, to match
+ te rest of WTF.
+
+2009-08-27 Brent Fulgham <bfulgham@webkit.org>
+
+ Reviewed by Adam Roben.
+
+ Link the testapi against CFLite when building the WinCairo port.
+
+ * JavaScriptCore.vcproj/testapi/testapi.vcproj: Add new Release_CFLite
+ target. Update all targets to inherit from either the
+ JavaScriptCF.vsprops (Apple target) or the JavaScriptCFLite.vsprops
+ file (WinCairo target).
+ * JavaScriptCore.vcproj/testapi/testapiCommon.vsprops: Remove
+ input file CoreFoundation.lib. This is provided by either the
+ JavaScriptCF.vsprops or JavaScriptCFLite.vsprops file.
+
+2009-08-27 Steve Falkenburg <sfalken@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Fix Windows-specific crash due to missing memory clearing call.
+
+ * runtime/Collector.cpp:
+ (JSC::Heap::allocateBlock):
+
+2009-08-27 Brent Fulgham <bfulgham@webkit.org>
+
+ Build fix: JavaScriptCore_debug.def missing some exports. Apple
+ Windows build does not use this file, so it was not noticed previously.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-08-27 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ x86-64 GTK broken due to code offsets changing, pointers sometimes packed into immediates.
+ https://bugs.webkit.org/show_bug.cgi?id=28317
+
+ Missed one, fix part II.
+
+ * assembler/MacroAssemblerX86Common.h:
+ (JSC::MacroAssemblerX86Common::move):
+ * assembler/X86Assembler.h:
+ (JSC::CAN_SIGN_EXTEND_8_32):
+
+2009-08-27 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Adam Roben.
+
+ JSON.stringify replacer array does not accept values that are not string primitives.
+ https://bugs.webkit.org/show_bug.cgi?id=28788
+
+ Update the JSON stringifier to initialise its replacer array according to the most
+ recent version of the spec.
+
+ * runtime/Identifier.h:
+ (JSC::Identifier::from):
+ * runtime/JSONObject.cpp:
+ (JSC::Stringifier::Stringifier):
+
+2009-08-27 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Alexey Proskuryakov.
+
+ JSON parser accepts trailing comma in array literals
+ https://bugs.webkit.org/show_bug.cgi?id=28779
+
+ Update parser to correctly fail if there's a trailing comma.
+
+ * runtime/LiteralParser.cpp:
+ (JSC::LiteralParser::parse):
+
+2009-08-26 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ 'this' in JSON.parse reviver is the global object
+ https://bugs.webkit.org/show_bug.cgi?id=28752
+
+ This is a technically simple change, we merely update the code for calling
+ the reviver function to pass the correct this object. Doing so however
+ exposes the holder to arbitrary mutation by the reviver function so it is
+ necessary for us to now guard all property accesses against the possibility
+ of failure.
+
+ * runtime/JSArray.h:
+ JSON needs to delete a property from the array, so we friend its
+ Walker class so that we can make a non-virtual call to the arrays
+ delete and getOwnPropertySlot methods.
+ * runtime/JSONObject.cpp:
+ (JSC::Walker::callReviver):
+ We need to pass the correct this object
+ (JSC::Walker::walk):
+ Update calls to callReviver, and update property logic logic
+ to correctly handle the holder being mutated by the reviver
+ function.
+
+2009-08-26 Alice Liu <alice.liu@apple.com>
+
+ Windows build fix: added some exported symbols
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-08-26 Geoffrey Garen <ggaren@apple.com>
+
+ Windows build fix: Removed some exported symbols that no longer exist.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-08-26 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Olliejver Hunt.
+
+ x86-64 GTK broken due to code offsets changing, pointers sometimes packed into immediates.
+ https://bugs.webkit.org/show_bug.cgi?id=28317
+
+ We rely on a slightly OS X specific behaviour, that x86-64 applications have a 4Gb zero page,
+ so pointers are never representable as a 32-bit integer, and always have to be represented by
+ a separate immediate load instruction, rather than within the immediate field of an arithmetic
+ or memory operation.
+
+ We explicitly check for a couple of cases where a value might be representable in 32-bit, but
+ these probably never kick in on Mac OS, and only kick in to hose GTK. Deleting these does not
+ show a performance degradation on SunSpider. Remove.
+
+ * assembler/MacroAssemblerX86_64.h:
+ (JSC::MacroAssemblerX86_64::storePtr):
+ (JSC::MacroAssemblerX86_64::branchPtr):
+
+2009-08-26 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ A bit of Collector refatoring.
+
+ SunSpider says no change. v8 says 1.003x faster (1.02x faster on splay).
+
+ * JavaScriptCore.exp:
+
+ * runtime/JSCell.cpp:
+ (JSC::JSCell::toPrimitive):
+ (JSC::JSCell::getPrimitiveNumber):
+ (JSC::JSCell::toBoolean):
+ (JSC::JSCell::toNumber):
+ (JSC::JSCell::toString):
+ (JSC::JSCell::toObject): Removed pure virtual functions from
+ JSCell, so the collector can construct one. This allowed
+ me to remove a bunch of ASSERT_NOT_REACHED throughout the
+ code, too.
+
+ * runtime/JSCell.h:
+ (JSC::JSCell::JSCell): ditto
+ (JSC::Heap::heap): Inlined this function because it's trivial.
+
+ * JavaScriptCore.exp:
+
+ * runtime/Collector.cpp:
+ (JSC::Heap::destroy):
+ (JSC::Heap::allocateBlock):
+ (JSC::Heap::freeBlock):
+ (JSC::Heap::freeBlocks): Renamed freeHeap to freeBlocks, since
+ it doesn't actually free the Heap object.
+ (JSC::Heap::heapAllocate):
+ (JSC::Heap::sweep):
+ * runtime/Collector.h: Refactored block allocation and destruction
+ into helper functions.
+
+ * runtime/GetterSetter.cpp:
+ * runtime/JSAPIValueWrapper.cpp:
+ * runtime/JSPropertyNameIterator.cpp: Removed dummy implementations
+ of pure virtual functions. (See above.)
+
+=== End re-roll-in of r47738:47740 with Windows crash fixed ===
+
+2009-08-26 Geoffrey Garen <ggaren@apple.com>
+
+ Build fix: start out with a 32-bit value to avoid a shortening warning.
+
+ * runtime/Collector.cpp:
+ (JSC::Heap::sweep):
+
+2009-08-24 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Substantially reduced VM thrash in the GC heap.
+
+ 1.08x faster on v8 (1.60x faster on v8-splay).
+
+ 1.40x faster on bench-alloc-nonretained.
+
+ 1.90x faster on bench-alloc-retained.
+
+ SunSpider says no change.
+
+ * runtime/Collector.cpp:
+ (JSC::Heap::heapAllocate): Fixed a long-standing bug: update a few local
+ variables unconditionally after calling collect(), since they may be used
+ even if we don't "goto scan". (In the bug I saw, usedBlocks got out of
+ sync with heap.usedBlocks).
+ (JSC::Heap::sweep): Keep enough free heap space to accomodate
+ the number of objects we'll allocate before the next GC, plus 25%, for
+ good measure.
+ * runtime/Collector.h: Bumped the block size to 256k. This seems to give
+ the best cache performance, and it prevents us from initiating lots of
+ VM traffic to recover very small chunks of memory.
+
+=== Begin re-roll-in of r47738:47740 with Windows crash fixed ===
+
+2009-08-25 Drew Wilson <atwilson@google.com>
+
+ Reviewed by David Levin.
+
+ postMessage() spec now supports sending arrays of ports
+ https://bugs.webkit.org/show_bug.cgi?id=26902
+
+ Added OwnPtr to VectorTraits so we can store OwnPtrs in Vectors.
+
+ * wtf/VectorTraits.h:
+
+2009-08-26 Xan Lopez <xlopez@igalia.com>
+
+ Rubber-stamped by Gustavo Noronha.
+
+ Remove duplicated files from file list.
+
+ * GNUmakefile.am:
+
+2009-08-26 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by NOBODY (Build fix).
+
+ More export fixes.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-08-26 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by NOBODY (Build fix).
+
+ Hopefully fix all the exports from JSC on windows
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-08-26 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by NOBODY (Build fixes).
+
+ Forgot I added files to JavaScriptCore.
+
+ * GNUmakefile.am:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.pri:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCoreSources.bkl:
+
+2009-08-25 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ [ES5] Implement getOwnPropertyDescriptor
+ https://bugs.webkit.org/show_bug.cgi?id=28724
+
+ Implement the core runtime support for getOwnPropertyDescriptor.
+ This adds a virtual getOwnPropertyDescriptor method to every class
+ that implements getOwnPropertySlot that shadows the behaviour of
+ getOwnPropertySlot. The alternative would be to make getOwnPropertySlot
+ (or PropertySlots in general) provide property attribute information,
+ but quick testing showed this to be a regression.
+
+ * JavaScriptCore.exp:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * runtime/Arguments.cpp:
+ (JSC::Arguments::getOwnPropertyDescriptor):
+ * runtime/Arguments.h:
+ * runtime/ArrayPrototype.cpp:
+ (JSC::ArrayPrototype::getOwnPropertyDescriptor):
+ * runtime/ArrayPrototype.h:
+ * runtime/CommonIdentifiers.h:
+ * runtime/DatePrototype.cpp:
+ (JSC::DatePrototype::getOwnPropertyDescriptor):
+ * runtime/DatePrototype.h:
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::getOwnPropertyDescriptor):
+ * runtime/JSArray.h:
+ * runtime/JSByteArray.cpp:
+ (JSC::JSByteArray::getOwnPropertyDescriptor):
+ * runtime/JSByteArray.h:
+ * runtime/JSFunction.cpp:
+ (JSC::JSFunction::getOwnPropertyDescriptor):
+ * runtime/JSFunction.h:
+ * runtime/JSGlobalObject.h:
+ (JSC::JSGlobalObject::getOwnPropertyDescriptor):
+ * runtime/JSNotAnObject.cpp:
+ (JSC::JSNotAnObject::getOwnPropertyDescriptor):
+ * runtime/JSNotAnObject.h:
+ * runtime/JSONObject.cpp:
+ (JSC::JSONObject::getOwnPropertySlot):
+ (JSC::JSONObject::getOwnPropertyDescriptor):
+ * runtime/JSONObject.h:
+ * runtime/JSObject.cpp:
+ (JSC::JSObject::getOwnPropertyDescriptor):
+ (JSC::JSObject::getPropertyDescriptor):
+ * runtime/JSObject.h:
+ * runtime/JSString.cpp:
+ (JSC::JSString::getStringPropertyDescriptor):
+ (JSC::JSString::getOwnPropertyDescriptor):
+ * runtime/JSString.h:
+ * runtime/JSVariableObject.cpp:
+ (JSC::JSVariableObject::symbolTableGet):
+ * runtime/JSVariableObject.h:
+ * runtime/Lookup.h:
+ (JSC::getStaticPropertyDescriptor):
+ (JSC::getStaticFunctionDescriptor):
+ (JSC::getStaticValueDescriptor):
+ Add property descriptor equivalents of the lookup
+ table access functions
+
+ * runtime/MathObject.cpp:
+ (JSC::MathObject::getOwnPropertySlot):
+ (JSC::MathObject::getOwnPropertyDescriptor):
+ * runtime/MathObject.h:
+ * runtime/NumberConstructor.cpp:
+ (JSC::NumberConstructor::getOwnPropertyDescriptor):
+ * runtime/NumberConstructor.h:
+ * runtime/ObjectConstructor.cpp:
+ (JSC::ObjectConstructor::ObjectConstructor):
+ (JSC::objectConstructorGetOwnPropertyDescriptor):
+ * runtime/PropertyDescriptor.cpp: Added.
+ (JSC::PropertyDescriptor::writable):
+ (JSC::PropertyDescriptor::enumerable):
+ (JSC::PropertyDescriptor::configurable):
+ (JSC::PropertyDescriptor::hasAccessors):
+ (JSC::PropertyDescriptor::setUndefined):
+ (JSC::PropertyDescriptor::getter):
+ (JSC::PropertyDescriptor::setter):
+ (JSC::PropertyDescriptor::setDescriptor):
+ (JSC::PropertyDescriptor::setAccessorDescriptor):
+ * runtime/PropertyDescriptor.h: Added.
+ (JSC::PropertyDescriptor::PropertyDescriptor):
+ (JSC::PropertyDescriptor::attributes):
+ (JSC::PropertyDescriptor::isValid):
+ (JSC::PropertyDescriptor::value):
+ * runtime/RegExpConstructor.cpp:
+ (JSC::RegExpConstructor::getOwnPropertyDescriptor):
+ * runtime/RegExpConstructor.h:
+ * runtime/RegExpMatchesArray.h:
+ (JSC::RegExpMatchesArray::getOwnPropertyDescriptor):
+ * runtime/RegExpObject.cpp:
+ (JSC::RegExpObject::getOwnPropertyDescriptor):
+ * runtime/RegExpObject.h:
+ * runtime/StringObject.cpp:
+ (JSC::StringObject::getOwnPropertyDescriptor):
+ * runtime/StringObject.h:
+ * runtime/StringPrototype.cpp:
+ (JSC::StringPrototype::getOwnPropertyDescriptor):
+ * runtime/StringPrototype.h:
+
+2009-08-24 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Darin Adler.
+
+ How many copies of the parameters do you need?
+ https://bugs.webkit.org/show_bug.cgi?id=28701
+
+ The function parameters in JSC get copied a lot - and unnecessarily so.
+
+ Originally this happened due to duplicating FunctionBodyNodes on recompilation,
+ though the problem has been exacerbated by copying the parameters from the
+ original function body onto the executable, then back onto the real body that
+ will be generated (this happens on every function). And this is all made worse
+ since the data structures in question are a little ugly - C style arrays of C++
+ objects containing ref counts, so they need a full copy-construct (rather than
+ a simple memcpy).
+
+ This can all be greatly simplified by just punting the parameters off into
+ their own ref-counted object, and forgoing all the copying.
+
+ ~no performance change, possible slight progression.
+
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::BytecodeGenerator):
+ * bytecompiler/BytecodeGenerator.h:
+ (JSC::BytecodeGenerator::makeFunction):
+ * parser/Nodes.cpp:
+ (JSC::FunctionParameters::FunctionParameters):
+ (JSC::FunctionBodyNode::FunctionBodyNode):
+ (JSC::FunctionBodyNode::finishParsing):
+ * parser/Nodes.h:
+ (JSC::FunctionBodyNode::parameters):
+ (JSC::FunctionBodyNode::parameterCount):
+ * runtime/Executable.cpp:
+ (JSC::FunctionExecutable::~FunctionExecutable):
+ (JSC::FunctionExecutable::compile):
+ (JSC::FunctionExecutable::reparseExceptionInfo):
+ (JSC::FunctionExecutable::fromGlobalCode):
+ (JSC::FunctionExecutable::paramString):
+ * runtime/Executable.h:
+ (JSC::FunctionExecutable::FunctionExecutable):
+ (JSC::FunctionExecutable::parameterCount):
+
+2009-08-25 Brent Fulgham <bfulgham@webkit.org>
+
+ Reviewed by NOBODY (Buildfix).
+
+ * JavaScriptCore.vcproj/jsc/jsc.vcproj: Add Debug_CFLite target
+ that inherits from the debug_wincairo property sheet and therefore
+ links to the proper debug library.
+ * JavaScriptCore.vcproj/testapi/testapi.vcproj: Add Debug_CFLite target
+ that inherits from the debug_wincairo property sheet and therefore
+ links to the proper debug library.
+
+2009-08-25 Chris Marrin <cmarrin@apple.com>
+
+ Reviewed by Simon Fraser.
+
+ Export tryFastMalloc for Canvas3D work
+ https://bugs.webkit.org/show_bug.cgi?id=28018
+
+ * JavaScriptCore.exp:
+
+2009-08-25 David Levin <levin@chromium.org>
+
+ Reviewed by Adam Roben.
+
+ PLATFORM(CFNETWORK) should be USE(CFNETWORK).
+ https://bugs.webkit.org/show_bug.cgi?id=28713
+
+ * wtf/Platform.h: Added a #define to catch this issue in the
+ future. The define would generate an error on gcc without the
+ space in the expansion, but Visual C++ needs the space to cause an error.
+
+2009-08-24 Brent Fulgham <bfulgham@webkit.org>
+
+ Reviewed by Steve Falkenburg.
+
+ Revise CFLite Debug build to emit DLL's with _debug label.
+ https://bugs.webkit.org/show_bug.cgi?id=28695.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Modify
+ Cairo debug build to inherit from new debug_cairo property sheet.
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCFLite.vsprops:
+ Modify to look for debug CFLite when in debug build.
+
+2009-08-24 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Adler & Darin Hunt.
+
+ https://bugs.webkit.org/show_bug.cgi?id=28691
+ Do not retain ScopeNodes outside of parsing
+
+ There is now no need for these to exist outside of parsing - their use in the runtime is replaced by Executable types.
+
+ * bytecode/EvalCodeCache.h:
+ (JSC::EvalCodeCache::get):
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::BytecodeGenerator):
+ (JSC::BytecodeGenerator::emitNewFunction):
+ (JSC::BytecodeGenerator::emitNewFunctionExpression):
+ * bytecompiler/BytecodeGenerator.h:
+ (JSC::BytecodeGenerator::makeFunction):
+ * debugger/Debugger.cpp:
+ (JSC::Debugger::recompileAllJSFunctions):
+ (JSC::evaluateInGlobalCallFrame):
+ * debugger/DebuggerCallFrame.cpp:
+ (JSC::DebuggerCallFrame::evaluate):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::execute):
+ (JSC::Interpreter::prepareForRepeatCall):
+ (JSC::Interpreter::privateExecute):
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+ * parser/Nodes.cpp:
+ (JSC::ScopeNodeData::ScopeNodeData):
+ (JSC::ProgramNode::create):
+ (JSC::EvalNode::create):
+ (JSC::FunctionBodyNode::create):
+ * parser/Nodes.h:
+ (JSC::ScopeNode::adoptData):
+ (JSC::FunctionBodyNode::parameterCount):
+ * parser/Parser.cpp:
+ * parser/Parser.h:
+ (JSC::Parser::arena):
+ (JSC::Parser::Parser):
+ (JSC::Parser::parse):
+ * runtime/ArrayPrototype.cpp:
+ (JSC::isNumericCompareFunction):
+ (JSC::arrayProtoFuncSort):
+ * runtime/Completion.cpp:
+ (JSC::checkSyntax):
+ (JSC::evaluate):
+ * runtime/Executable.cpp:
+ (JSC::FunctionExecutable::~FunctionExecutable):
+ (JSC::EvalExecutable::compile):
+ (JSC::ProgramExecutable::checkSyntax):
+ (JSC::ProgramExecutable::compile):
+ (JSC::FunctionExecutable::compile):
+ (JSC::EvalExecutable::generateJITCode):
+ (JSC::ProgramExecutable::generateJITCode):
+ (JSC::FunctionExecutable::generateJITCode):
+ (JSC::FunctionExecutable::reparseExceptionInfo):
+ (JSC::EvalExecutable::reparseExceptionInfo):
+ (JSC::FunctionExecutable::recompile):
+ (JSC::FunctionExecutable::fromGlobalCode):
+ (JSC::FunctionExecutable::copyParameters):
+ (JSC::FunctionExecutable::paramString):
+ * runtime/Executable.h:
+ (JSC::ScriptExecutable::ScriptExecutable):
+ (JSC::ScriptExecutable::sourceID):
+ (JSC::ScriptExecutable::sourceURL):
+ (JSC::ScriptExecutable::lineNo):
+ (JSC::ScriptExecutable::lastLine):
+ (JSC::ScriptExecutable::usesEval):
+ (JSC::ScriptExecutable::usesArguments):
+ (JSC::ScriptExecutable::needsActivation):
+ (JSC::ScriptExecutable::recordParse):
+ (JSC::EvalExecutable::bytecode):
+ (JSC::EvalExecutable::jitCode):
+ (JSC::ProgramExecutable::bytecode):
+ (JSC::ProgramExecutable::reparseExceptionInfo):
+ (JSC::ProgramExecutable::jitCode):
+ (JSC::FunctionExecutable::FunctionExecutable):
+ (JSC::FunctionExecutable::make):
+ (JSC::FunctionExecutable::bytecode):
+ (JSC::FunctionExecutable::isGenerated):
+ (JSC::FunctionExecutable::name):
+ (JSC::FunctionExecutable::parameterCount):
+ (JSC::FunctionExecutable::jitCode):
+ * runtime/FunctionConstructor.cpp:
+ (JSC::constructFunction):
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::numericCompareFunction):
+ * runtime/JSGlobalObjectFunctions.cpp:
+ (JSC::globalFuncEval):
+
+2009-08-24 Darin Adler <darin@apple.com>
+
+ * runtime/ObjectPrototype.cpp:
+ (JSC::ObjectPrototype::put): Landed revised version I had tested but forgot
+ to land. Leave out the branch, since we don't need one.
+
+2009-08-24 Darin Adler <darin@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Array index miss case creates a string every time
+ https://bugs.webkit.org/show_bug.cgi?id=28664
+
+ SunSpider test results I saw:
+
+ 0.5% faster overall
+ 1% faster on crypto-aes
+ 20% faster on crypto-md5
+ 13% faster on crypto-sha1
+
+ * runtime/ObjectPrototype.cpp:
+ (JSC::ObjectPrototype::ObjectPrototype): Initialize m_hasNoPropertiesWithUInt32Names
+ to true.
+ (JSC::ObjectPrototype::put): Clearly m_hasNoPropertiesWithUInt32Names if the new
+ property has a name that is the string form of a UInt32.
+ (JSC::ObjectPrototype::getOwnPropertySlot): Don't call JSObject::getOwnPropertySlot
+ if m_hasNoPropertiesWithUInt32Names is true, and it is highly likely to be true.
+
+ * runtime/ObjectPrototype.h: Added declarations for the above.
+
+2009-08-24 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk>
+
+ Unreviewed. Fix a typo in my distcheck build fix.
+
+ * GNUmakefile.am:
+
+2009-08-23 Gustavo Noronha Silva <gns@gnome.org>
+
+ Unreviewed build fix for make distcheck.
+
+ * GNUmakefile.am: Added files required for the build.
+
+2009-08-22 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Mark Rowe.
+
+ REGRESSION(r47639-r47660): Webkit crashes on launch on PowerPC
+ https://bugs.webkit.org/show_bug.cgi?id=28655
+
+ * runtime/JSFunction.cpp:
+ (JSC::JSFunction::JSFunction): Initialize properly with a VPtrHackExecutable.
+ * wtf/Platform.h:
+
+2009-08-22 Darin Adler <darin@apple.com>
+
+ Fix storage leak from syntax tree arena allocation patch.
+
+ * parser/Nodes.h: CommaNode needs to inherit from ParserArenaDeletable
+ because it has a vector.
+
+2009-08-21 Darin Adler <darin@apple.com>
+
+ Fix Qt build.
+
+ * parser/Nodes.cpp:
+ (JSC::ScopeNodeData::ScopeNodeData): Made non-inline again.
+ This is used outside Nodes.cpp so can't be inline unless
+ it is in the header.
+
+2009-08-21 Darin Adler <darin@apple.com>
+
+ Two loose ends from the last commit.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj: Made ParserArena.h
+ and create_hash_table project-internal instead of "private".
+ * runtime/Executable.h: Removed accidentally-added constructor.
+
+2009-08-21 Darin Adler <darin@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Syntax tree nodes should use arena allocation
+ https://bugs.webkit.org/show_bug.cgi?id=25674
+
+ Use an actual arena now. 0.6% speedup on SunSpider.
+
+ New and improved with 100% less leaking of the universe.
+
+ * JavaScriptCore.exp:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+ Removed all exports involving the class FunctionBodyNode, which no
+ longer needs to be used outside JavaScriptCore.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj: Made Nodes.h and
+ Executable.h project-internal instead of "private".
+
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::BytecodeGenerator): Updated since VarStack
+ contains const Identifier* now.
+
+ * parser/Grammar.y: Made identifiers from the lexer be const
+ Identifier* and updated since VarStack contains const Identifier* now.
+
+ * parser/Lexer.cpp:
+ (JSC::Lexer::setCode): Pass in ParserArena, used for identifiers.
+ (JSC::Lexer::makeIdentifier): Changed return type to const Identifier*
+ and changed to call ParserArena.
+ (JSC::Lexer::clear): Removed the code to manage m_identifiers and
+ added code to set m_arena to 0.
+ * parser/Lexer.h: Updated for changes above.
+
+ * parser/NodeConstructors.h:
+ (JSC::ParserArenaFreeable::operator new): Added. Calls allocateFreeable
+ on the arena.
+ (JSC::ParserArenaDeletable::operator new): Changed to call the
+ allocateDeletable function on the arena instead of deleteWithArena.
+ (JSC::PropertyNode::PropertyNode): Added new constructor that makes
+ numeric identifiers. Some day we might want to optimize this for
+ integers so it doesn't create a string for each one.
+ (JSC::ContinueNode::ContinueNode): Initialize m_ident to nullIdentifier
+ since it's now a const Identifier& so it can't be left uninitialized.
+ (JSC::BreakNode::BreakNode): Ditto.
+ (JSC::CaseClauseNode::CaseClauseNode): Updated to use SourceElements*
+ to keep track of the statements rather than a separate statement vector.
+ (JSC::BlockNode::BlockNode): Ditto.
+ (JSC::ForInNode::ForInNode): Initialize m_ident to nullIdentifier.
+
+ * parser/Nodes.cpp: Moved the comment explaining emitBytecode in here.
+ It seemed strangely out of place in the header.
+ (JSC::ThrowableExpressionData::emitThrowError): Added an overload for
+ UString as well as Identifier.
+ (JSC::SourceElements::singleStatement): Added.
+ (JSC::SourceElements::lastStatement): Added.
+ (JSC::RegExpNode::emitBytecode): Changed the throwError code to use
+ the substitution mechanism instead of doing a string append.
+ (JSC::SourceElements::emitBytecode): Added. Replaces the old
+ statementListEmitCode function, since we now keep the SourceElements
+ objects around.
+ (JSC::BlockNode::lastStatement): Added.
+ (JSC::BlockNode::emitBytecode): Changed to use emitBytecode instead of
+ statementListEmitCode.
+ (JSC::CaseClauseNode::emitBytecode): Added.
+ (JSC::CaseBlockNode::emitBytecodeForBlock): Changed to use emitBytecode
+ instead of statementListEmitCode.
+ (JSC::ScopeNodeData::ScopeNodeData): Changed to store the
+ SourceElements* instead of using releaseContentsIntoVector.
+ (JSC::ScopeNode::emitStatementsBytecode): Added.
+ (JSC::ScopeNode::singleStatement): Added.
+ (JSC::ProgramNode::emitBytecode): Call emitStatementsBytecode instead
+ of statementListEmitCode.
+ (JSC::EvalNode::emitBytecode): Ditto.
+ (JSC::FunctionBodyNode::emitBytecode): Call emitStatementsBytecode
+ insetad of statementListEmitCode and check for the return node using
+ the new functions.
+
+ * parser/Nodes.h: Changed VarStack to store const Identifier* instead
+ of Identifier and rely on the arena to control lifetime. Added a new
+ ParserArenaFreeable class. Made ParserArenaDeletable inherit from
+ FastAllocBase instead of having its own operator new. Base the Node
+ class on ParserArenaFreeable. Changed the various Node classes
+ to use const Identifier& instead of Identifier to avoid the need to
+ call their destructors and allow them to function as "freeable" in the
+ arena. Removed extraneous JSC_FAST_CALL on definitions of inline functions.
+ Changed ElementNode, PropertyNode, ArgumentsNode, ParameterNode,
+ CaseClauseNode, ClauseListNode, and CaseBlockNode to use ParserArenaFreeable
+ as a base class since they do not descend from Node. Eliminated the
+ StatementVector type and instead have various classes use SourceElements*
+ instead of StatementVector. This prevents those classes from having to
+ use ParserArenaDeletable to make sure the vector destructor is called.
+
+ * parser/Parser.cpp:
+ (JSC::Parser::parse): Pass the arena to the lexer.
+
+ * parser/Parser.h: Added an include of ParserArena.h, which is no longer
+ included by Nodes.h.
+ (JSC::Parser::parseFunctionFromGlobalCode): Changed to use the
+ singleStatement function, since there is no longer any children function.
+ Removed some unneeded use of RefPtr.
+
+ * parser/ParserArena.cpp:
+ (JSC::ParserArena::ParserArena): Added. Initializes the new members,
+ m_freeableMemory, m_freeablePoolEnd, and m_identifiers.
+ (JSC::ParserArena::freeablePool): Added. Computes the pool pointer,
+ since we store only the current pointer and the end of pool pointer.
+ (JSC::ParserArena::deallocateObjects): Added. Contains the common
+ memory-deallocation logic used by both the destructor and the
+ reset function.
+ (JSC::ParserArena::~ParserArena): Changed to call deallocateObjects.
+ (JSC::ParserArena::reset): Ditto. Also added code to zero out the
+ new structures, and switched to use clear() instead of shrink(0) since
+ we don't really reuse arenas.
+ (JSC::ParserArena::makeNumericIdentifier): Added.
+ (JSC::ParserArena::allocateFreeablePool): Added. Used when the pool
+ is empty.
+ (JSC::ParserArena::isEmpty): Added. No longer inline, which is fine
+ since this is used only for assertions at the moment.
+ (JSC::ParserArena::derefWithArena): Make non-inline.
+
+ * parser/ParserArena.h: Added an actual arena of "freeable" objects,
+ ones that don't need destructors to be called. Also added a separate
+ IdentifierArena object, a segmented vector of identifiers that used
+ to be in the Lexer.
+
+ * runtime/Executable.h: Moved the definition of the
+ FunctionExecutable::make function here. It can't go in JSFunction.h
+ since that header has to be used outside JavaScriptCore and so can't
+ include this, which includes Nodes.h. The function could be moved
+ elswhere if we don't want to include JSFunction.h in this header, but
+ for now this seems to be the best place.
+
+ * runtime/JSFunction.h: Removed the include of Executable.h and
+ definition of the FunctionExecutable::make function.
+
+ * wtf/FastMalloc.cpp: Fixed an incorrect comment.
+
+2009-08-21 Mark Rowe <mrowe@apple.com>
+
+ Fix the non-JIT build.
+
+ * runtime/Executable.cpp:
+ * runtime/Executable.h:
+
+2009-08-21 Gavin Barraclough <barraclough@apple.com>
+
+ Speculative QuickTime build fix.
+
+ * runtime/JSArray.cpp:
+
+2009-08-21 Gavin Barraclough <barraclough@apple.com>
+
+ Speculative QT build fix.
+
+ * runtime/StringPrototype.cpp:
+
+2009-08-21 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Restructure Executable types so that host functions do not hold a FunctionExecutable.
+ https://bugs.webkit.org/show_bug.cgi?id=28621
+
+ All JSFunction objects have a pointer to an Executable*. This is currently always a
+ FunctionExecutable, however this has a couple of drawbacks. Host functions do not
+ store a range of information that the FunctionExecutable provides (source, name,
+ CodeBlock & information presently held on the FunctionBodyNode).
+
+ [ * nearly all... see below! ]
+
+ Instead, make JSFunctions hold a pointer to an ExecutableBase, move fields specific
+ to JS sourced executable types (source, node) into a new subclass (ScriptExecutable),
+ and create a new NativeExecutable type. We now provide a new method in JSFunction
+ to access & downcast to FunctionExecutable, but in doing so we can make an early
+ check (with an ASSERT) to ensure that the Executable read from a function will only
+ be treated as a FunctionExecutable (and thus the JS sepcific fields will only be
+ accessed) if the JSFunction is not a host function.
+
+ There is one JSFunction that currently does not have an Executable, which is the
+ object created to allow us to read out the vtable pointer. By making this change
+ we can also add a new Executable type fror this object (VPtrHackExecutable).
+ Since this means that really all JSFunctions have an Executable we no longer have
+ to null-check m_executable before us it - particularly in isHostFunction().
+
+ This patch removes CacheableEvalExecutable, since all subclasses of ExecutableBase
+ can now be ref-counted - since both JSFunction holds (and ref-counts) an ExecutableBase
+ that might be a FunctionExecutable or a NativeExecutable. This does now mean that all
+ ProgramExecutables and EvalExecutables (unnecessarily) provide an interface to be
+ ref-counted, however this seems less-bad than host functions unnecessarily providing
+ interface to access non-host specific information.
+
+ The class hierarcy has changed from this:
+
+ - ExecutableBase
+ - ProgramExecutable
+ - EvalExecutable
+ - CacheableEvalExecutable (also RefCounted by multiple-inheritance)
+ - FunctionExecutable (also RefCounted by multiple-inheritance, 'special' FunctionExecutable also used for host functions)
+
+ To this:
+
+ - RefCounted
+ - ExecutableBase
+ - NativeExecutable
+ - VPtrHackExecutable
+ - ScriptExecutable
+ - ProgramExecutable
+ - EvalExecutable
+ - FunctionExecutable
+
+ This patch speeds up sunspidey by a couple of ms (presumably due to the changes to isHostFunction()).
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::CodeBlock):
+ * bytecode/CodeBlock.h:
+ (JSC::CodeBlock::ownerExecutable):
+ (JSC::GlobalCodeBlock::GlobalCodeBlock):
+ * bytecode/EvalCodeCache.h:
+ (JSC::EvalCodeCache::get):
+ * debugger/Debugger.cpp:
+ (JSC::Debugger::recompileAllJSFunctions):
+ * interpreter/CachedCall.h:
+ (JSC::CachedCall::CachedCall):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::callEval):
+ (JSC::Interpreter::privateExecute):
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+ * profiler/Profiler.cpp:
+ (JSC::createCallIdentifierFromFunctionImp):
+ * runtime/Arguments.h:
+ (JSC::Arguments::getArgumentsData):
+ (JSC::Arguments::Arguments):
+ * runtime/Executable.cpp:
+ (JSC::NativeExecutable::~NativeExecutable):
+ (JSC::VPtrHackExecutable::~VPtrHackExecutable):
+ * runtime/Executable.h:
+ (JSC::ExecutableBase::ExecutableBase):
+ (JSC::ExecutableBase::~ExecutableBase):
+ (JSC::ExecutableBase::isHostFunction):
+ (JSC::NativeExecutable::NativeExecutable):
+ (JSC::VPtrHackExecutable::VPtrHackExecutable):
+ (JSC::ScriptExecutable::ScriptExecutable):
+ (JSC::ScriptExecutable::source):
+ (JSC::ScriptExecutable::sourceID):
+ (JSC::ScriptExecutable::sourceURL):
+ (JSC::ScriptExecutable::lineNo):
+ (JSC::ScriptExecutable::lastLine):
+ (JSC::ScriptExecutable::usesEval):
+ (JSC::ScriptExecutable::usesArguments):
+ (JSC::ScriptExecutable::needsActivation):
+ (JSC::EvalExecutable::EvalExecutable):
+ (JSC::EvalExecutable::create):
+ (JSC::ProgramExecutable::ProgramExecutable):
+ (JSC::FunctionExecutable::FunctionExecutable):
+ * runtime/FunctionPrototype.cpp:
+ (JSC::functionProtoFuncToString):
+ * runtime/JSFunction.cpp:
+ (JSC::JSFunction::JSFunction):
+ (JSC::JSFunction::~JSFunction):
+ (JSC::JSFunction::markChildren):
+ (JSC::JSFunction::getCallData):
+ (JSC::JSFunction::call):
+ (JSC::JSFunction::lengthGetter):
+ (JSC::JSFunction::getConstructData):
+ (JSC::JSFunction::construct):
+ * runtime/JSFunction.h:
+ (JSC::JSFunction::executable):
+ (JSC::JSFunction::jsExecutable):
+ (JSC::JSFunction::isHostFunction):
+
+2009-08-20 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Browser hangs on opening Web Inspector.
+ https://bugs.webkit.org/show_bug.cgi?id=28438
+
+ Code generation needs to be able to walk the entire scopechain in some
+ cases, however the symbol table used by activations was a member of the
+ codeblock. Following recompilation this may no longer exist, leading
+ to a crash or hang on lookup.
+
+ We fix this by introducing a refcounted SymbolTable subclass, SharedSymbolTable,
+ for the CodeBlocks used by function code. This allows activations to
+ maintain ownership of a copy of the symbol table even after recompilation so
+ they can continue to work.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::CodeBlock):
+ * bytecode/CodeBlock.h:
+ (JSC::CodeBlock::symbolTable):
+ (JSC::CodeBlock::sharedSymbolTable):
+ (JSC::GlobalCodeBlock::GlobalCodeBlock):
+ (JSC::FunctionCodeBlock::FunctionCodeBlock):
+ (JSC::FunctionCodeBlock::~FunctionCodeBlock):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::retrieveArguments):
+ * runtime/Executable.cpp:
+ (JSC::EvalExecutable::generateBytecode):
+ (JSC::FunctionExecutable::generateBytecode):
+ (JSC::FunctionExecutable::reparseExceptionInfo):
+ (JSC::EvalExecutable::reparseExceptionInfo):
+ * runtime/JSActivation.h:
+ (JSC::JSActivation::JSActivationData::JSActivationData):
+ (JSC::JSActivation::JSActivationData::~JSActivationData):
+ * runtime/SymbolTable.h:
+
+2009-08-20 Xan Lopez <xlopez@igalia.com>
+
+ Add new file to GTK+ build.
+
+ * GNUmakefile.am:
+
+2009-08-20 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Added a number => string cache.
+
+ 1.07x faster on v8 (1.7x faster on v8-splay).
+ 1.004x faster on SunSpider.
+
+ * runtime/JSCell.h: Moved JSValue::toString to JSString.h.
+ * runtime/JSGlobalData.h: Holds the cache.
+ * runtime/JSNumberCell.cpp:
+ (JSC::JSNumberCell::toString):
+ (JSC::JSNumberCell::toThisString): Removed -0 special case.
+ UString handles this now, since too many clients were
+ special-casing it.
+
+ * runtime/JSString.h:
+ (JSC::JSValue::toString): Use the cache when converting
+ an int or double to string.
+
+ * runtime/Operations.h:
+ (JSC::concatenateStrings): Call toString to take advantage
+ of the cache.
+
+ * runtime/SmallStrings.h:
+ (JSC::NumericStrings::add):
+ (JSC::NumericStrings::lookup): The cache.
+
+ * runtime/UString.cpp:
+ (JSC::UString::from): Added -0 special case mentioned above.
+ Removed appendNumeric because it's mutually exclusive with the
+ cache.
+
+2009-08-20 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ REGRESSION: fast/profiler/call.html is crashing occasionally
+ https://bugs.webkit.org/show_bug.cgi?id=28476
+
+ Using the codeblock for information about how many parameters and
+ locals a function has is unsafe in certain circumstances. The
+ basic scenario is all function code being cleared in response to
+ the debugger or profiler being enabled, and then an activation is
+ marked before its associated function is re-executed.
+
+ To deal with this scenario we store the variable count of a function
+ directly in the FunctionExecutable, and then use that information.
+
+ * runtime/Arguments.h:
+ (JSC::Arguments::getArgumentsData):
+ * runtime/Executable.cpp:
+ (JSC::FunctionExecutable::generateBytecode):
+ * runtime/Executable.h:
+ (JSC::FunctionExecutable::FunctionExecutable):
+ (JSC::FunctionExecutable::variableCount):
+ * runtime/JSActivation.cpp:
+ (JSC::JSActivation::markChildren):
+
+2009-08-20 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Numbering of arguments to emitGetJITStubArg/emitPutJITStubArg incorrect
+ <bug lost in the great bug disasteroony of 08/20/09!>
+
+ The argumentNumber argument to emitGetJITStubArg/emitPutJITStubArg should match
+ the argument number used within the stub functions in JITStubs.cpp, but it doesn't.
+
+ Firstly, all the numbers changed when we added a void* 'reserved' as the first slot
+ (rather than leaving argument 0 unused), and secondly in 32_64 builds the index to
+ peek/poke needs to be multiplies by 2 (since the argument to peek/poke is a number
+ of machine words, and on 32_64 build the argument slots to stub functions are two
+ words wide).
+
+ * jit/JIT.h:
+ * jit/JITCall.cpp:
+ (JSC::JIT::compileOpCallSetupArgs):
+ (JSC::JIT::compileOpConstructSetupArgs):
+ (JSC::JIT::compileOpCallVarargsSetupArgs):
+ (JSC::JIT::compileOpCall):
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::emitPutJITStubArg):
+ (JSC::JIT::emitPutJITStubArgConstant):
+ (JSC::JIT::emitGetJITStubArg):
+ (JSC::JIT::emitPutJITStubArgFromVirtualRegister):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::privateCompilePutByIdTransition):
+
+2009-08-20 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ REGRESSION: significant slowdown on Celtic Kane "AJAX declaration" subtest
+ https://bugs.webkit.org/show_bug.cgi?id=28332
+
+ Follow up style fixes that were missed in review.
+
+ * runtime/Structure.cpp:
+ (JSC::Structure::hasTransition):
+ * runtime/Structure.h:
+ (JSC::Structure::get):
+ (JSC::StructureTransitionTable::contains):
+ * runtime/StructureTransitionTable.h:
+ (JSC::StructureTransitionTable::add):
+
+2009-08-20 Oliver Hunt <oliver@apple.com>
+
+ Add new exports to windows jsc build
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-08-20 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ REGRESSION: significant slowdown on Celtic Kane "AJAX declaration" subtest
+ https://bugs.webkit.org/show_bug.cgi?id=28332
+
+ The method check optimisation made transitions aware of the value being
+ assigned when a transition was assigning a function. This had the side
+ effect of making every assignment of a function expression result in a
+ new transition, and thus a new Structure. The net result of this is that
+ the common JS idiom of
+
+ function MyObject() {
+ this.myFunction = function(...){...};
+ }
+ new MyObject();
+
+ Will produce a unique structure on every iteration, meaning that all
+ caching is defeated and there is a significant amount of structure churn.
+
+ The fix is to return the transition to its original form where it is
+ keyed off a property name + attributes tuple, but have each transition
+ support an optional transition on a specific value.
+
+ * JavaScriptCore.exp:
+ * runtime/JSObject.h:
+ (JSC::JSObject::putDirectInternal):
+ * runtime/Structure.cpp:
+ (JSC::Structure::~Structure):
+ (JSC::Structure::addPropertyTransitionToExistingStructure):
+ (JSC::Structure::addPropertyTransition):
+ (JSC::Structure::hasTransition):
+ * runtime/Structure.h:
+ (JSC::Structure::transitionedFor):
+ (JSC::Structure::hasTransition):
+ (JSC::Structure::):
+ (JSC::StructureTransitionTable::contains):
+ (JSC::StructureTransitionTable::get):
+ * runtime/StructureTransitionTable.h:
+ (JSC::StructureTransitionTableHashTraits::emptyValue):
+ (JSC::StructureTransitionTable::hasTransition):
+ (JSC::StructureTransitionTable::remove):
+ (JSC::StructureTransitionTable::add):
+
+2009-08-20 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Remove FunctionCodeBlock.
+ https://bugs.webkit.org/show_bug.cgi?id=28502
+
+ These only exist to allow JIT code to dereference properties off the
+ CodeBlock for any callee, regardless of whether it is a host function.
+
+ Instead just use the FunctionExecutable. Copy the m_parameters field
+ from the CodeBlock into the Executable, and use this to distinguish
+ between host functions, functions that have been bytecompiled, and
+ functions that have not.
+
+ m_parameters is moved to ExecutableBase rather than FunctionExecutable
+ so that (as a separate change) we can move make a separate class of
+ executable for host code, which is not devived from FunctionExecutable
+ (host code does not feature any of the properties that normal executable
+ do and will provide, such as source, attributes, and a parsed name).
+
+ 1% win on v8 tests, 0.5% on sunspider.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::derefStructures):
+ (JSC::CodeBlock::refStructures):
+ (JSC::CodeBlock::reparseForExceptionInfoIfNecessary):
+ (JSC::CodeBlock::handlerForBytecodeOffset):
+ (JSC::CodeBlock::lineNumberForBytecodeOffset):
+ (JSC::CodeBlock::expressionRangeForBytecodeOffset):
+ (JSC::CodeBlock::getByIdExceptionInfoForBytecodeOffset):
+ (JSC::CodeBlock::functionRegisterForBytecodeOffset):
+ (JSC::CodeBlock::hasGlobalResolveInstructionAtBytecodeOffset):
+ (JSC::CodeBlock::hasGlobalResolveInfoAtBytecodeOffset):
+ * bytecode/CodeBlock.h:
+ (JSC::):
+ (JSC::CodeBlock::source):
+ (JSC::CodeBlock::sourceOffset):
+ (JSC::CodeBlock::evalCodeCache):
+ (JSC::CodeBlock::createRareDataIfNecessary):
+
+ remove NativeCodeBlocks and the NativeCode code type.
+
+ * jit/JIT.cpp:
+ (JSC::JIT::linkCall):
+
+ Revert to previous behaviour (as currently still commented!) that Hhost functions have a null codeblock.
+
+ * jit/JITCall.cpp:
+ (JSC::JIT::compileOpCallInitializeCallFrame):
+ (JSC::JIT::compileOpCallSetupArgs):
+ (JSC::JIT::compileOpCallVarargsSetupArgs):
+ (JSC::JIT::compileOpConstructSetupArgs):
+ (JSC::JIT::compileOpCallVarargs):
+ (JSC::JIT::compileOpCall):
+ (JSC::JIT::compileOpCallSlowCase):
+
+ Bring the 32_64 & non-32_64 JITs into line with each other, callee in regT0.
+
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+
+ Rewrite call trampolines to not use the CodeBlock.
+
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+
+ Make call_JSFunction & call_arityCheck return the callee, don't expect to be passed the CodeBlock.
+
+ * runtime/Executable.cpp:
+ (JSC::FunctionExecutable::generateBytecode):
+ (JSC::FunctionExecutable::recompile):
+ (JSC::FunctionExecutable::FunctionExecutable):
+ * runtime/Executable.h:
+ (JSC::ExecutableBase::):
+ (JSC::ExecutableBase::ExecutableBase):
+ (JSC::FunctionExecutable::isHostFunction):
+
+ Add m_numParameters.
+
+ * runtime/JSFunction.cpp:
+ (JSC::JSFunction::~JSFunction):
+
+ Only call generatedBytecode() on JSFunctions non-host FunctionExecutables.
+
+2009-08-20 Yongjun Zhang <yongjun.zhang@nokia.com>
+
+ Reviewed by Eric Seidel.
+
+ https://bugs.webkit.org/show_bug.cgi?id=28054
+
+ Use a helper function to work around winscw compiler forward declaration bug
+ regarding templated classes.
+
+ Add parenthesis around (PassRefPtr::*UnspecifiedBoolType) to make winscw compiler
+ work with the default UnSpecifiedBoolType() operator, which removes the winscw
+ specific bool cast hack.
+
+ * wtf/PassRefPtr.h:
+ (WTF::derefIfNotNull):
+ (WTF::PassRefPtr::~PassRefPtr):
+
+2009-08-19 Yong Li <yong.li@torchmobile.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Change namespace ARM to ARMRegisters
+ X86 to X86Registers to avoid conflict with macros
+ https://bugs.webkit.org/show_bug.cgi?id=28428
+
+ * assembler/ARMAssembler.cpp:
+ * assembler/ARMAssembler.h:
+ * assembler/ARMv7Assembler.h:
+ * assembler/MacroAssemblerARM.h:
+ * assembler/MacroAssemblerARMv7.h:
+ * assembler/MacroAssemblerX86Common.h:
+ * assembler/MacroAssemblerX86_64.h:
+ * assembler/X86Assembler.h:
+ * jit/JIT.h:
+ * jit/JITArithmetic.cpp:
+ * jit/JITInlineMethods.h:
+ * jit/JITOpcodes.cpp:
+ * wrec/WRECGenerator.cpp:
+ * wrec/WRECGenerator.h:
+ * yarr/RegexJIT.cpp:
+
+2009-08-19 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Devirtualise marking
+ https://bugs.webkit.org/show_bug.cgi?id=28294
+
+ We actually need to mark the value in a number object if we're using the
+ 32bit number representation.
+
+ * runtime/NumberObject.h:
+ (JSC::NumberObject::createStructure):
+
+2009-08-19 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Darin Adler.
+
+ We probably shouldn't be keeping the AST for eval nodes around forevar.
+ https://bugs.webkit.org/show_bug.cgi?id=28469
+
+ EvalNodes don't destroyData() (delete their parser data) since they need to hold onto
+ their varStack. Copy a list of variable onto EvalCodeBlock, and this can go away.
+
+ * bytecode/CodeBlock.h:
+ (JSC::EvalCodeBlock::variable):
+ (JSC::EvalCodeBlock::numVariables):
+ (JSC::EvalCodeBlock::adoptVariables):
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::BytecodeGenerator):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::execute):
+ * parser/Nodes.h:
+ * runtime/Executable.cpp:
+ (JSC::EvalExecutable::generateBytecode):
+ * runtime/Executable.h:
+
+2009-08-19 Jungshik Shin <jshin@chromium.org>
+
+ Reviewed by Darin Adler.
+
+ http://bugs.webkit.org/show_bug.cgi?id=28441
+
+ Fix a build issue with ICU 4.2 or later on Windows with Visual C++.
+ Instead of defining all isXXX and toupper/tolower as
+ WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h,
+ #define them to be different by prepending 'WTF_...ASCIIType_h' with
+ the originial names like 'toupper_WTF_...ASCIIType_h'.
+
+ * wtf/DisallowCType.h:
+
+2009-08-18 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Assigning a function to an object should always use the existing transition, even if the transition is not specialized
+ https://bugs.webkit.org/show_bug.cgi?id=28442
+
+ Check for an unspecialized transition as an alternative to always failing if specialisation does not match.
+
+ * runtime/Structure.cpp:
+ (JSC::Structure::addPropertyTransitionToExistingStructure):
+
+2009-08-18 Dirk Schulze <krit@webkit.org>
+
+ Reviewed by Oliver Hunt.
+
+ Added additional getter to ByteArray with an unsigned char as return.
+ ByteArray can take unsigned char directly now.
+
+ * wtf/ByteArray.h:
+ (WTF::ByteArray::set):
+ (WTF::ByteArray::get):
+
+2009-08-18 Peter Kasting <pkasting@google.com>
+
+ Reviewed by Eric Seidel.
+
+ https://bugs.webkit.org/show_bug.cgi?id=28415
+ Set svn:eol-style CRLF on all .sln and .vcproj files that don't already
+ have it.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.vcproj:
+ * JavaScriptCore.vcproj/testapi/testapi.vcproj:
+
+2009-08-18 Xan Lopez <xlopez@igalia.com>
+
+ Try to fix the GTK+ build.
+
+ * GNUmakefile.am:
+
+2009-08-17 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ No, silly runtime, AST nodes are not for you.
+
+ We still use AST nodes (ScopeNodes, particularly FunctionBodyNodes) within
+ the runtime, which means that these nodes must be persisted outside of the
+ arena, contain both parser & runtime data, etc. This is all a bit of a mess.
+
+ Move functionality into a new FunctionExecutable class.
+
+ * API/JSCallbackFunction.cpp:
+ * API/JSObjectRef.cpp:
+ * JavaScriptCore.exp:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::CodeBlock):
+ (JSC::CodeBlock::markAggregate):
+ (JSC::CodeBlock::reparseForExceptionInfoIfNecessary):
+ (JSC::CodeBlock::lineNumberForBytecodeOffset):
+ (JSC::CodeBlock::shrinkToFit):
+ * bytecode/CodeBlock.h:
+ (JSC::CodeBlock::getBytecodeIndex):
+ (JSC::CodeBlock::discardBytecode):
+ (JSC::CodeBlock::instructionCount):
+ (JSC::CodeBlock::getJITCode):
+ (JSC::CodeBlock::executablePool):
+ (JSC::CodeBlock::ownerExecutable):
+ (JSC::CodeBlock::extractExceptionInfo):
+ (JSC::CodeBlock::addFunctionDecl):
+ (JSC::CodeBlock::functionDecl):
+ (JSC::CodeBlock::numberOfFunctionDecls):
+ (JSC::CodeBlock::addFunctionExpr):
+ (JSC::CodeBlock::functionExpr):
+ (JSC::GlobalCodeBlock::GlobalCodeBlock):
+ (JSC::ProgramCodeBlock::ProgramCodeBlock):
+ (JSC::EvalCodeBlock::EvalCodeBlock):
+ (JSC::FunctionCodeBlock::FunctionCodeBlock):
+ (JSC::NativeCodeBlock::NativeCodeBlock):
+ * bytecode/EvalCodeCache.h:
+ * bytecode/SamplingTool.cpp:
+ (JSC::SamplingTool::doRun):
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::BytecodeGenerator):
+ (JSC::BytecodeGenerator::emitNewFunction):
+ (JSC::BytecodeGenerator::emitNewFunctionExpression):
+ * bytecompiler/BytecodeGenerator.h:
+ * debugger/Debugger.cpp:
+ (JSC::Debugger::recompileAllJSFunctions):
+ * interpreter/CachedCall.h:
+ (JSC::CachedCall::CachedCall):
+ * interpreter/CallFrameClosure.h:
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::unwindCallFrame):
+ (JSC::Interpreter::throwException):
+ (JSC::Interpreter::execute):
+ (JSC::Interpreter::prepareForRepeatCall):
+ (JSC::Interpreter::debug):
+ (JSC::Interpreter::privateExecute):
+ (JSC::Interpreter::retrieveLastCaller):
+ * interpreter/Interpreter.h:
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompile):
+ * jit/JIT.h:
+ (JSC::JIT::compile):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ (JSC::JIT::emit_op_new_func):
+ (JSC::JIT::emit_op_new_func_exp):
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+ * jit/JITStubs.h:
+ (JSC::):
+ * parser/Nodes.cpp:
+ (JSC::FunctionBodyNode::reparseDataIfNecessary):
+ * parser/Nodes.h:
+ (JSC::EvalNode::partialDestroyData):
+ * parser/Parser.h:
+ * profiler/ProfileGenerator.cpp:
+ * profiler/Profiler.cpp:
+ (JSC::Profiler::createCallIdentifier):
+ (JSC::createCallIdentifierFromFunctionImp):
+ * runtime/Arguments.h:
+ (JSC::Arguments::getArgumentsData):
+ (JSC::Arguments::Arguments):
+ (JSC::JSActivation::copyRegisters):
+ * runtime/ArrayPrototype.cpp:
+ (JSC::isNumericCompareFunction):
+ * runtime/CallData.h:
+ (JSC::):
+ * runtime/Collector.cpp:
+ (JSC::Heap::collect):
+ * runtime/ConstructData.h:
+ (JSC::):
+ * runtime/ExceptionHelpers.cpp:
+ (JSC::createUndefinedVariableError):
+ (JSC::createInvalidParamError):
+ (JSC::createNotAConstructorError):
+ (JSC::createNotAFunctionError):
+ (JSC::createNotAnObjectError):
+ * runtime/Executable.cpp: Added.
+ (JSC::EvalExecutable::generateBytecode):
+ (JSC::ProgramExecutable::generateBytecode):
+ (JSC::FunctionExecutable::generateBytecode):
+ (JSC::EvalExecutable::generateJITCode):
+ (JSC::ProgramExecutable::generateJITCode):
+ (JSC::FunctionExecutable::generateJITCode):
+ (JSC::FunctionExecutable::isHostFunction):
+ (JSC::FunctionExecutable::markAggregate):
+ (JSC::FunctionExecutable::reparseExceptionInfo):
+ (JSC::EvalExecutable::reparseExceptionInfo):
+ (JSC::FunctionExecutable::recompile):
+ (JSC::FunctionExecutable::FunctionExecutable):
+ * runtime/Executable.h:
+ (JSC::ExecutableBase::~ExecutableBase):
+ (JSC::ExecutableBase::ExecutableBase):
+ (JSC::ExecutableBase::source):
+ (JSC::ExecutableBase::sourceID):
+ (JSC::ExecutableBase::lastLine):
+ (JSC::ExecutableBase::usesEval):
+ (JSC::ExecutableBase::usesArguments):
+ (JSC::ExecutableBase::needsActivation):
+ (JSC::ExecutableBase::astNode):
+ (JSC::ExecutableBase::generatedJITCode):
+ (JSC::ExecutableBase::getExecutablePool):
+ (JSC::EvalExecutable::EvalExecutable):
+ (JSC::EvalExecutable::bytecode):
+ (JSC::EvalExecutable::varStack):
+ (JSC::EvalExecutable::evalNode):
+ (JSC::EvalExecutable::jitCode):
+ (JSC::ProgramExecutable::ProgramExecutable):
+ (JSC::ProgramExecutable::reparseExceptionInfo):
+ (JSC::ProgramExecutable::bytecode):
+ (JSC::ProgramExecutable::programNode):
+ (JSC::ProgramExecutable::jitCode):
+ (JSC::FunctionExecutable::FunctionExecutable):
+ (JSC::FunctionExecutable::name):
+ (JSC::FunctionExecutable::bytecode):
+ (JSC::FunctionExecutable::generatedBytecode):
+ (JSC::FunctionExecutable::usesEval):
+ (JSC::FunctionExecutable::usesArguments):
+ (JSC::FunctionExecutable::parameterCount):
+ (JSC::FunctionExecutable::paramString):
+ (JSC::FunctionExecutable::isGenerated):
+ (JSC::FunctionExecutable::body):
+ (JSC::FunctionExecutable::jitCode):
+ (JSC::FunctionExecutable::createNativeThunk):
+ * runtime/FunctionConstructor.cpp:
+ (JSC::constructFunction):
+ * runtime/FunctionPrototype.cpp:
+ (JSC::functionProtoFuncToString):
+ * runtime/JSActivation.cpp:
+ (JSC::JSActivation::JSActivation):
+ (JSC::JSActivation::markChildren):
+ (JSC::JSActivation::isDynamicScope):
+ (JSC::JSActivation::argumentsGetter):
+ * runtime/JSActivation.h:
+ (JSC::JSActivation::JSActivationData::JSActivationData):
+ * runtime/JSFunction.cpp:
+ (JSC::JSFunction::isHostFunction):
+ (JSC::JSFunction::JSFunction):
+ (JSC::JSFunction::~JSFunction):
+ (JSC::JSFunction::markChildren):
+ (JSC::JSFunction::getCallData):
+ (JSC::JSFunction::call):
+ (JSC::JSFunction::lengthGetter):
+ (JSC::JSFunction::getConstructData):
+ (JSC::JSFunction::construct):
+ * runtime/JSFunction.h:
+ (JSC::JSFunction::executable):
+ (JSC::FunctionExecutable::make):
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData):
+ (JSC::JSGlobalData::numericCompareFunction):
+ * runtime/JSGlobalData.h:
+
+2009-08-17 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Fix 300,000+ leaks seen during the regression tests.
+
+ EvalCodeCache::get was heap-allocating an EvalExecutable instance without adopting the initial reference.
+ While fixing this we noticed that EvalExecutable was a RefCounted type that was sometimes stack allocated.
+ To make this cleaner and to prevent clients from attempting to ref a stack-allocated instance, we move the
+ refcounting down to a new CacheableEvalExecutable class that derives from EvalExecutable. EvalCodeCache::get
+ now uses CacheableEvalExecutable::create and avoids the leak.
+
+ * bytecode/EvalCodeCache.h:
+ (JSC::EvalCodeCache::get):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::callEval):
+ * runtime/Executable.h:
+ (JSC::CacheableEvalExecutable::create):
+ (JSC::CacheableEvalExecutable::CacheableEvalExecutable):
+
+2009-08-17 Oliver Hunt <oliver@apple.com>
+
+ RS=Mark Rowe.
+
+ REGRESSION (r47292): Prototype.js is broken by ES5 Arguments changes
+ https://bugs.webkit.org/show_bug.cgi?id=28341
+ <rdar://problem/7145615>
+
+ Reverting r47292. Alas Prototype.js breaks with Arguments inheriting
+ from Array as ES5 attempted. Prototype.js defines $A in terms of a
+ function it places on (among other global objects) the Array prototype,
+ thus breaking $A for arrays.
+
+ * runtime/Arguments.h:
+ (JSC::Arguments::Arguments):
+ * runtime/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::reset):
+ (JSC::JSGlobalObject::markChildren):
+ * runtime/JSGlobalObject.h:
+ (JSC::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData):
+ * runtime/ObjectPrototype.cpp:
+ (JSC::ObjectPrototype::ObjectPrototype):
+ * runtime/ObjectPrototype.h:
+ * tests/mozilla/ecma_3/Function/arguments-001.js:
+
+2009-08-17 Peter Kasting <pkasting@google.com>
+
+ Reviewed by Steve Falkenburg.
+
+ https://bugs.webkit.org/show_bug.cgi?id=27323
+ Only add Cygwin to the path when it isn't already there. This avoids
+ causing problems for people who purposefully have non-Cygwin versions of
+ executables like svn in front of the Cygwin ones in their paths.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.vcproj:
+ * JavaScriptCore.vcproj/WTF/WTFCommon.vsprops:
+ * JavaScriptCore.vcproj/jsc/jscCommon.vsprops:
+ * JavaScriptCore.vcproj/testapi/testapiCommon.vsprops:
+
+2009-08-17 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Mark Rowe.
+
+ Fix build with FAST_MALLOC_MATCH_VALIDATION enabled.
+
+ * wtf/FastMalloc.cpp:
+ (WTF::fastMalloc):
+ (WTF::fastCalloc):
+ (WTF::fastRealloc):
+
+2009-08-16 Holger Hans Peter Freyther <zecke@selfish.org>
+
+ Reviewed by Mark Rowe.
+
+ Fix crash on ./ecma_2/RegExp/exec-002.js.
+ https://bugs.webkit.org/show_bug.cgi?id=28353
+
+ Change the order of freeParenthesesDisjunctionContext and
+ popParenthesesDisjunctionContext on all call sites as the pop
+ method is accessing backTrack->lastContext which is the context
+ that is about to be freed.
+
+ * yarr/RegexInterpreter.cpp:
+ (JSC::Yarr::Interpreter::parenthesesDoBacktrack):
+ (JSC::Yarr::Interpreter::backtrackParentheses):
+
+2009-08-16 Holger Hans Peter Freyther <zecke@selfish.org>
+
+ Reviewed by Mark Rowe.
+
+ https://bugs.webkit.org/show_bug.cgi?id=28352
+
+ Fix coding style violations. Use m_ for C++ class members. Remove
+ trailing whitespace on empty lines.
+
+ * yarr/RegexInterpreter.cpp:
+ (JSC::Yarr::Interpreter::ParenthesesDisjunctionContext::ParenthesesDisjunctionContext):
+ (JSC::Yarr::Interpreter::tryConsumeCharacter):
+ (JSC::Yarr::Interpreter::tryConsumeBackReference):
+ (JSC::Yarr::Interpreter::parenthesesDoBacktrack):
+ (JSC::Yarr::Interpreter::backtrackParentheses):
+ (JSC::Yarr::ByteCompiler::ByteCompiler):
+ (JSC::Yarr::ByteCompiler::compile):
+ (JSC::Yarr::ByteCompiler::checkInput):
+ (JSC::Yarr::ByteCompiler::assertionBOL):
+ (JSC::Yarr::ByteCompiler::assertionEOL):
+ (JSC::Yarr::ByteCompiler::assertionWordBoundary):
+ (JSC::Yarr::ByteCompiler::atomPatternCharacter):
+ (JSC::Yarr::ByteCompiler::atomCharacterClass):
+ (JSC::Yarr::ByteCompiler::atomBackReference):
+ (JSC::Yarr::ByteCompiler::atomParenthesesSubpatternBegin):
+ (JSC::Yarr::ByteCompiler::atomParentheticalAssertionBegin):
+ (JSC::Yarr::ByteCompiler::popParenthesesStack):
+ (JSC::Yarr::ByteCompiler::closeAlternative):
+ (JSC::Yarr::ByteCompiler::closeBodyAlternative):
+ (JSC::Yarr::ByteCompiler::atomParenthesesEnd):
+ (JSC::Yarr::ByteCompiler::regexBegin):
+ (JSC::Yarr::ByteCompiler::alterantiveBodyDisjunction):
+ (JSC::Yarr::ByteCompiler::alterantiveDisjunction):
+ (JSC::Yarr::ByteCompiler::emitDisjunction):
+
+2009-08-15 Mark Rowe <mrowe@apple.com>
+
+ Fix the build with JIT disabled.
+
+ * runtime/Arguments.h: Only compile the jitCode method when the JIT is enabled.
+ * runtime/Executable.h: Include PrototypeFunction.h so the compiler knows what
+ NativeFunctionWrapper is when the JIT is disabled.
+
+2009-08-15 Adam Bergkvist <adam.bergkvist@ericsson.com>
+
+ Reviewed by Sam Weinig.
+
+ Added ENABLE_EVENTSOURCE flag.
+ https://bugs.webkit.org/show_bug.cgi?id=14997
+
+ * Configurations/FeatureDefines.xcconfig:
+
+2009-08-14 Gavin Barraclough <barraclough@apple.com>
+
+ * parser/Parser.h:
+ (JSC::EvalExecutable::parse):
+ (JSC::ProgramExecutable::parse):
+ * runtime/Executable.h:
+
+2009-08-14 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Remove AST nodes from use within the Runtime (outside of parsing), stage 1
+ https://bugs.webkit.org/show_bug.cgi?id=28330
+
+ Remove the EvalNode and ProgramNode from use in the runtime. They still exist
+ after this patch, but are hidden behind EvalExecutable and FunctionExecutable,
+ and are also still reachable behind CodeBlock::m_ownerNode.
+
+ The next step will be to beat back FunctionBodyNode in the same fashion.
+ Then remove the usage via CodeBlock, then only construct these nodes only on
+ demand during bytecode generation.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * bytecode/CodeBlock.h:
+ (JSC::GlobalCodeBlock::GlobalCodeBlock):
+ (JSC::GlobalCodeBlock::~GlobalCodeBlock):
+ (JSC::ProgramCodeBlock::ProgramCodeBlock):
+ (JSC::EvalCodeBlock::EvalCodeBlock):
+ (JSC::FunctionCodeBlock::FunctionCodeBlock):
+ (JSC::NativeCodeBlock::NativeCodeBlock):
+ * bytecode/EvalCodeCache.h:
+ (JSC::EvalCodeCache::get):
+ * debugger/Debugger.cpp:
+ (JSC::evaluateInGlobalCallFrame):
+ * debugger/DebuggerCallFrame.cpp:
+ (JSC::DebuggerCallFrame::evaluate):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::callEval):
+ (JSC::Interpreter::execute):
+ * interpreter/Interpreter.h:
+ * parser/Nodes.cpp:
+ (JSC::FunctionBodyNode::createNativeThunk):
+ (JSC::FunctionBodyNode::generateBytecode):
+ (JSC::FunctionBodyNode::bytecodeForExceptionInfoReparse):
+ * parser/Parser.h:
+ (JSC::Parser::parse):
+ (JSC::Parser::reparse):
+ (JSC::Parser::parseFunctionFromGlobalCode):
+ (JSC::::parse):
+ * runtime/Completion.cpp:
+ (JSC::checkSyntax):
+ (JSC::evaluate):
+ * runtime/Error.cpp:
+ (JSC::throwError):
+ * runtime/Error.h:
+ * runtime/Executable.h: Added.
+ (JSC::TemplateExecutable::TemplateExecutable):
+ (JSC::TemplateExecutable::markAggregate):
+ (JSC::TemplateExecutable::sourceURL):
+ (JSC::TemplateExecutable::lineNo):
+ (JSC::TemplateExecutable::bytecode):
+ (JSC::TemplateExecutable::jitCode):
+ (JSC::EvalExecutable::EvalExecutable):
+ (JSC::ProgramExecutable::ProgramExecutable):
+ * runtime/FunctionConstructor.cpp:
+ (JSC::constructFunction):
+ * runtime/FunctionConstructor.h:
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::numericCompareFunction):
+ * runtime/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::~JSGlobalObject):
+ (JSC::JSGlobalObject::markChildren):
+ * runtime/JSGlobalObject.h:
+ (JSC::JSGlobalObject::codeBlocks):
+ * runtime/JSGlobalObjectFunctions.cpp:
+ (JSC::globalFuncEval):
+
+2009-08-14 Darin Adler <darin@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Rename the confusing isObject(<class>) to inherits(<class>).
+ It still works on non-objects, returning false.
+
+ * runtime/ArrayConstructor.cpp:
+ (JSC::arrayConstructorIsArray): Removed unneeded isObject call
+ and updated remaining isObject call to new name, inherits.
+
+ * runtime/JSCell.h: Renamed isObject(<class>) to inherits(<class>)
+ but more importantly, made it non-virtual (it was already inline)
+ so it is now as fast as JSObject::inherits was.
+
+ * runtime/JSObject.h: Removed inherits function since the one
+ in the base class is fine as-is. Also made various JSCell functions
+ that should not be called on JSObject uncallable by making them
+ both private and not implemented.
+ (JSC::JSCell::inherits): Updated name.
+ (JSC::JSValue::inherits): Ditto.
+
+ * debugger/Debugger.cpp:
+ (JSC::Debugger::recompileAllJSFunctions):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::unwindCallFrame):
+ * runtime/ArrayPrototype.cpp:
+ (JSC::arrayProtoFuncToString):
+ (JSC::arrayProtoFuncToLocaleString):
+ (JSC::arrayProtoFuncConcat):
+ * runtime/BooleanPrototype.cpp:
+ (JSC::booleanProtoFuncToString):
+ (JSC::booleanProtoFuncValueOf):
+ * runtime/DateConstructor.cpp:
+ (JSC::constructDate):
+ * runtime/DatePrototype.cpp:
+ (JSC::dateProtoFuncToString):
+ (JSC::dateProtoFuncToUTCString):
+ (JSC::dateProtoFuncToISOString):
+ (JSC::dateProtoFuncToDateString):
+ (JSC::dateProtoFuncToTimeString):
+ (JSC::dateProtoFuncToLocaleString):
+ (JSC::dateProtoFuncToLocaleDateString):
+ (JSC::dateProtoFuncToLocaleTimeString):
+ (JSC::dateProtoFuncGetTime):
+ (JSC::dateProtoFuncGetFullYear):
+ (JSC::dateProtoFuncGetUTCFullYear):
+ (JSC::dateProtoFuncToGMTString):
+ (JSC::dateProtoFuncGetMonth):
+ (JSC::dateProtoFuncGetUTCMonth):
+ (JSC::dateProtoFuncGetDate):
+ (JSC::dateProtoFuncGetUTCDate):
+ (JSC::dateProtoFuncGetDay):
+ (JSC::dateProtoFuncGetUTCDay):
+ (JSC::dateProtoFuncGetHours):
+ (JSC::dateProtoFuncGetUTCHours):
+ (JSC::dateProtoFuncGetMinutes):
+ (JSC::dateProtoFuncGetUTCMinutes):
+ (JSC::dateProtoFuncGetSeconds):
+ (JSC::dateProtoFuncGetUTCSeconds):
+ (JSC::dateProtoFuncGetMilliSeconds):
+ (JSC::dateProtoFuncGetUTCMilliseconds):
+ (JSC::dateProtoFuncGetTimezoneOffset):
+ (JSC::dateProtoFuncSetTime):
+ (JSC::setNewValueFromTimeArgs):
+ (JSC::setNewValueFromDateArgs):
+ (JSC::dateProtoFuncSetYear):
+ (JSC::dateProtoFuncGetYear):
+ * runtime/FunctionPrototype.cpp:
+ (JSC::functionProtoFuncToString):
+ * runtime/JSActivation.cpp:
+ (JSC::JSActivation::argumentsGetter):
+ * runtime/JSValue.h:
+ * runtime/RegExpConstructor.cpp:
+ (JSC::constructRegExp):
+ * runtime/RegExpPrototype.cpp:
+ (JSC::regExpProtoFuncTest):
+ (JSC::regExpProtoFuncExec):
+ (JSC::regExpProtoFuncCompile):
+ (JSC::regExpProtoFuncToString):
+ * runtime/ScopeChain.cpp:
+ (JSC::ScopeChain::localDepth):
+ * runtime/StringPrototype.cpp:
+ (JSC::stringProtoFuncReplace):
+ (JSC::stringProtoFuncToString):
+ (JSC::stringProtoFuncMatch):
+ (JSC::stringProtoFuncSearch):
+ (JSC::stringProtoFuncSplit):
+ Updated to new name, inherits, from old name, isObject.
+
+2009-07-31 Harald Fernengel <harald.fernengel@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Adding QNX as a platform. Currently only tested with Qt.
+
+ https://bugs.webkit.org/show_bug.cgi?id=27885
+
+ * JavaScriptCore/runtime/Collector.cpp: Added retrieving of stack base
+ since QNX doesn't have the pthread _nt functions
+ * JavaScriptCore/wtf/Platform.h: Added WTF_PLATFORM_QNX and corresponding
+ defines
+ * WebCore/bridge/npapi.h: Build fix for missing typedefs on QNX
+
+2009-08-14 Gabor Loki <loki@inf.u-szeged.hu>
+
+ Reviewed by Simon Hausmann.
+
+ Currently generic ARM and ARMv7 platforms work only with JSVALUE32
+ https://bugs.webkit.org/show_bug.cgi?id=28300
+
+ * wtf/Platform.h:
+
+2009-08-14 Gabor Loki <loki@inf.u-szeged.hu>
+
+ Reviewed by Simon Hausmann.
+
+ Enable JIT on ARM for QT by default
+ https://bugs.webkit.org/show_bug.cgi?id=28259
+
+ * wtf/Platform.h:
+
+2009-08-14 Gabor Loki <loki@inf.u-szeged.hu>
+
+ Reviewed by Simon Hausmann.
+
+ Enable YARR_JIT on ARM for QT by default
+ https://bugs.webkit.org/show_bug.cgi?id=28259
+
+ * wtf/Platform.h:
+
+2009-08-14 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ [ES5] Arguments object should inherit from Array
+ https://bugs.webkit.org/show_bug.cgi?id=28298
+
+ Make the Arguments object conform to the behaviour specified in ES5.
+ The simple portion of this is to make Arguments use Array.prototype
+ as its prototype rather than Object.prototype.
+
+ The spec then requires us to set instance.constructor to the pristine
+ Object constructor, and instance.toString and instance.toLocaleString
+ to the pristine versions from Object.prototype. To do this we now
+ make the ObjectPrototype constructor return its toString and
+ toLocaleString functions (similar to the call and apply functions
+ from FunctionPrototype).
+
+ Oddly enough this reports itself as a slight win, but given the code
+ isn't hit in the tests that claim to have improved I put this down to
+ code motion.
+
+ * runtime/Arguments.h:
+ (JSC::Arguments::Arguments):
+ (JSC::Arguments::initializeStandardProperties):
+ * runtime/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::reset):
+ (JSC::JSGlobalObject::markChildren):
+ * runtime/JSGlobalObject.h:
+ (JSC::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData):
+ (JSC::JSGlobalObject::objectConstructor):
+ (JSC::JSGlobalObject::objectToStringFunction):
+ (JSC::JSGlobalObject::objectToLocaleStringFunction):
+ * runtime/ObjectPrototype.cpp:
+ (JSC::ObjectPrototype::ObjectPrototype):
+ * runtime/ObjectPrototype.h:
+ * tests/mozilla/ecma_3/Function/arguments-001.js:
+ Update test to new es5 behaviour
+
+2009-08-14 Oliver Hunt <oliver@apple.com>
+
+ Remove MarkStack::drain from the JSC exports file
+
+ MarkStack::drain is now marked inline, the including it in the exports file
+ produces an ld warning
+
+ * JavaScriptCore.exp:
+
+2009-08-13 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Oliver Hunt.
+
+ Remove accidentally left in debugging statement.
+
+ * runtime/JSArray.h:
+ (JSC::MarkStack::drain):
+
+2009-08-13 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ [ES5] Implement Array.isArray
+ https://bugs.webkit.org/show_bug.cgi?id=28296
+
+ Add support for Array.isArray to the Array constructor
+
+ * runtime/ArrayConstructor.cpp:
+ (JSC::ArrayConstructor::ArrayConstructor):
+ (JSC::arrayConstructorIsArray):
+ * runtime/ArrayConstructor.h:
+ * runtime/CommonIdentifiers.h:
+ * runtime/JSArray.h:
+ (JSC::MarkStack::drain):
+ * runtime/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::reset):
+
+2009-08-13 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by NOBODY (Buildfix).
+
+ Attempt to fix windows build
+
+ * runtime/Collector.cpp:
+
+2009-08-13 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Devirtualise marking
+ https://bugs.webkit.org/show_bug.cgi?id=28294
+
+ Add a bit to TypeInfo to indicate that an object uses the standard
+ JSObject::markChildren method. This allows us to devirtualise marking
+ of most objects (though a branch is still needed). We also add a branch
+ to identify arrays thus devirtualising marking in that case as well.
+
+ In order to make the best use of this devirtualisation I've also reworked
+ the MarkStack::drain() logic to make the iteration more efficient.
+
+ * API/JSCallbackConstructor.h:
+ (JSC::JSCallbackConstructor::createStructure):
+ * API/JSCallbackFunction.h:
+ (JSC::JSCallbackFunction::createStructure):
+ * JavaScriptCore.exp:
+ * runtime/BooleanObject.h:
+ (JSC::BooleanObject::createStructure):
+ * runtime/FunctionPrototype.h:
+ (JSC::FunctionPrototype::createStructure):
+ * runtime/InternalFunction.h:
+ (JSC::InternalFunction::createStructure):
+ * runtime/JSAPIValueWrapper.h:
+ (JSC::JSAPIValueWrapper::JSAPIValueWrapper):
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::markChildren):
+ * runtime/JSArray.h:
+ (JSC::JSArray::markChildrenDirect):
+ (JSC::MarkStack::drain):
+ * runtime/JSByteArray.cpp:
+ (JSC::JSByteArray::createStructure):
+ * runtime/JSCell.h:
+ (JSC::MarkStack::append):
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData):
+ * runtime/JSNumberCell.h:
+ (JSC::JSNumberCell::createStructure):
+ * runtime/JSONObject.h:
+ (JSC::JSONObject::createStructure):
+ * runtime/JSObject.cpp:
+ (JSC::JSObject::markChildren):
+ * runtime/JSObject.h:
+ (JSC::JSObject::markChildrenDirect):
+ (JSC::JSObject::createStructure):
+ * runtime/JSString.h:
+ (JSC::JSString::createStructure):
+ * runtime/JSType.h:
+ (JSC::):
+ * runtime/MarkStack.h:
+ (JSC::MarkStack::MarkStack):
+ (JSC::MarkStack::MarkSet::MarkSet):
+ (JSC::MarkStack::MarkStackArray::last):
+ * runtime/MathObject.h:
+ (JSC::MathObject::createStructure):
+ * runtime/NumberConstructor.h:
+ (JSC::NumberConstructor::createStructure):
+ * runtime/NumberObject.h:
+ (JSC::NumberObject::createStructure):
+ * runtime/RegExpConstructor.h:
+ (JSC::RegExpConstructor::createStructure):
+ * runtime/RegExpObject.h:
+ (JSC::RegExpObject::createStructure):
+ * runtime/StringObjectThatMasqueradesAsUndefined.h:
+ (JSC::StringObjectThatMasqueradesAsUndefined::createStructure):
+ * runtime/TypeInfo.h:
+ (JSC::TypeInfo::hasDefaultMark):
+
+2009-08-13 Darin Adler <darin@apple.com>
+
+ Reviewed by Mark Rowe.
+
+ Some small bits of housekeeping.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj: Make Parser.h
+ project instead of private. Remove JSONObject.lut.h.
+
+ * assembler/ARMAssembler.h: Remove unneeded WTF prefix.
+ * assembler/AssemblerBufferWithConstantPool.h: Ditto.
+ * bytecompiler/BytecodeGenerator.h: Ditto.
+
+ * wtf/SegmentedVector.h: Add a "using" statement as we do
+ with the other WTF headers.
+
+2009-08-13 Darin Adler <darin@apple.com>
+
+ Fix Tiger build.
+
+ * parser/Grammar.y: Use a template function so we can compile
+ setStatementLocation even if it comes before YYLTYPE is defined.
+
+2009-08-13 Darin Adler <darin@apple.com>
+
+ Reviewed by George Staikos.
+
+ Too much use of void* in Grammar.y
+ https://bugs.webkit.org/show_bug.cgi?id=28287
+
+ * parser/Grammar.y: Changed all the helper functions to
+ take a JSGlobalData* instead of a void*. A couple formatting
+ tweaks that I missed when breaking this into pieces.
+
+2009-08-13 Darin Adler <darin@apple.com>
+
+ Reviewed by George Staikos.
+
+ Another part of https://bugs.webkit.org/show_bug.cgi?id=28287
+
+ * parser/Grammar.y: Reduced and sorted includes. Tweaked comment
+ format. Marked a few more functions inline.
+
+2009-08-13 Darin Adler <darin@apple.com>
+
+ Reviewed by George Staikos.
+
+ Another part of https://bugs.webkit.org/show_bug.cgi?id=28287
+
+ * parser/Grammar.y: Pass the number to the PropertyNode instead of
+ first turning it into an Identifier.
+
+ * parser/NodeConstructors.h:
+ (JSC::PropertyNode::PropertyNode): Add an overload that takes a double
+ so the code to convert to a string can be here instead of Grammar.y.
+ * parser/Nodes.h: Ditto.
+
+2009-08-13 Darin Adler <darin@apple.com>
+
+ Reviewed by George Staikos.
+
+ Another part of https://bugs.webkit.org/show_bug.cgi?id=28287
+
+ * parser/Grammar.y: Eliminate the DBG macro.
+
+2009-08-13 Darin Adler <darin@apple.com>
+
+ Reviewed by George Staikos.
+
+ Another part of https://bugs.webkit.org/show_bug.cgi?id=28287
+
+ * parser/Grammar.y: Eliminate the SET_EXCEPTION_LOCATION macro.
+
+2009-08-13 Darin Adler <darin@apple.com>
+
+ Reviewed by George Staikos.
+
+ George asked me to break the patch from
+ https://bugs.webkit.org/show_bug.cgi?id=28287
+ into smaller pieces and land it in stages.
+
+ * parser/Grammar.y: Eliminate the LEXER macro.
+
+2009-08-13 Mark Rowe <mrowe@apple.com>
+
+ Try some more to fix the Windows build.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: Export a new symbol.
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: Ditto.
+
+2009-08-13 Mark Rowe <mrowe@apple.com>
+
+ Try and fix the Windows build.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: Export a new symbol.
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: Ditto.
+
+2009-08-13 Darin Adler <darin@apple.com>
+
+ Reviewed by David Levin.
+
+ JavaScriptCore tweaks to get ready for the parser arena
+ https://bugs.webkit.org/show_bug.cgi?id=28243
+
+ Eliminate dependencies on Nodes.h outside JavaScriptCore,
+ and cut down on them inside JavaScriptCore.
+
+ Change regular expression parsing to use identifiers as
+ with other strings we parse.
+
+ Fix a couple things that are needed to use const Identifier
+ more, which will be part of the parser arena work.
+
+ * JavaScriptCore.exp: Resorted and updated.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj: Changed
+ CollectorHeapIterator.h to be project-internal.
+
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::emitPushNewScope): Added const.
+ * bytecompiler/BytecodeGenerator.h: Ditto.
+
+ * debugger/Debugger.cpp:
+ (JSC::Debugger::recompileAllJSFunctions): Moved this function
+ here from WebCore. Here is better since it uses so many internals.
+ Removed unimportant optimization for the no listener case.
+ * debugger/Debugger.h: Ditto. Also removed unneeded include
+ and tweaked formatting and comments.
+
+ * debugger/DebuggerCallFrame.cpp:
+ (JSC::DebuggerCallFrame::functionName): Call asFunction instead
+ of doing the unchecked static_cast.
+ (JSC::DebuggerCallFrame::calculatedFunctionName): Ditto.
+
+ * jit/JITStubs.cpp:
+ (JSC::op_call_JSFunction): Call isHostFunction on the body rather
+ than on the JSFunction.
+ (JSC::vm_lazyLinkCall): Ditto.
+ (JSC::op_construct_JSConstruct): Ditto.
+
+ * parser/Grammar.y: Changed callers to use new scanRegExp with
+ out arguments instead of relying on state in the Lexer. And
+ callers that just want to skip a regular expression to use
+ skipRegExp.
+
+ * parser/Lexer.cpp:
+ (JSC::Lexer::scanRegExp): Changed to use out arguments, and to
+ add a prefix argument so we can add in the "=" character as needed.
+ Also rewrote to streamline the logic a bit inspired by suggestions
+ by David Levin.
+ (JSC::Lexer::skipRegExp): Added. Version of the function above that
+ does not actually put the regular expression into a string.
+ (JSC::Lexer::clear): Removed code to clear m_pattern and m_flags.
+ * parser/Lexer.h: Changed scanRegExp to have out arguments. Added
+ skipRegExp. Eliminated pattern, flags, m_pattern, and m_flags.
+
+ * parser/NodeConstructors.h:
+ (JSC::RegExpNode::RegExpNode): Changed to take const Identifier&.
+ * parser/Nodes.cpp:
+ (JSC::RegExpNode::emitBytecode): Changed since m_pattern and
+ m_flags are now Identifier instead of UString.
+ (JSC::FunctionBodyNode::make): Moved this function here instead
+ of putting it in the JSFunction.h header.
+ * parser/Nodes.h: Changed RegExpNode to use Identifier.
+
+ * profiler/Profiler.cpp:
+ (JSC::Profiler::createCallIdentifier): Changed to use isHostFunction
+ on the body instead of on the JSFunction object.
+ * runtime/FunctionPrototype.cpp:
+ (JSC::functionProtoFuncToString): Ditto.
+
+ * runtime/JSFunction.cpp:
+ (JSC::JSFunction::isHostFunction): Moved here from header.
+ (JSC::JSFunction::isHostFunctionNonInline): Added.
+ (JSC::JSFunction::JSFunction): Removed unneeded initialization of
+ m_body to 0.
+ (JSC::JSFunction::setBody): Moved here from header.
+
+ * runtime/JSFunction.h: Removed unneeded includes. Moved private
+ constructor down to the private section. Made virtual functions
+ private. Removed unneeded overload of setBody and moved the body
+ of the function into the .cpp file. Changed assertions to use
+ the non-inline version of isHostFunction.
+
+ * runtime/PropertySlot.cpp:
+ (JSC::PropertySlot::functionGetter): Use asFunction instead
+ of doing the unchecked static_cast.
+
+ * wtf/SegmentedVector.h:
+ (WTF::SegmentedVector::isEmpty): Added.
+
+2009-08-13 Mark Rowe <mrowe@apple.com>
+
+ Rubber-stamped by Darin Adler.
+
+ Use the version of operator new that takes a JSGlobalData when allocating FuncDeclNode and FuncExprNode
+ from within the grammar to prevent these nodes from being leaked.
+
+ * parser/Grammar.y:
+
+2009-08-13 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Reviewed by Ariya Hidayat.
+
+ Remove the special-case for Qt wrt JSVALUE_32 introduced in
+ r46709. It must've been a dependency issue on the bot, as
+ after a manual build all the tests pass on amd64 and ia32.
+
+ * wtf/Platform.h:
+
+2009-08-12 Gabor Loki <loki@inf.u-szeged.hu>
+
+ Reviewed by Gavin Barraclough.
+
+ Add optimize call and property access support for ARM JIT.
+ https://bugs.webkit.org/show_bug.cgi?id=24986
+
+ For tightly coupled sequences the BEGIN_UNINTERRUPTED_SEQUENCE and
+ END_UNINTERRUPTED_SEQUENCE macros have been introduced which ensure
+ space for instructions and constants of the named sequence. This
+ method is vital for those architecture which are using constant pool.
+
+ The 'latePatch' method - which was linked to JmpSrc - is replaced with
+ a port specific solution (each calls are marked to place their address
+ on the constant pool).
+
+ * assembler/ARMAssembler.cpp:
+ (JSC::ARMAssembler::linkBranch):
+ (JSC::ARMAssembler::executableCopy): Add extra align for constant pool.
+ * assembler/ARMAssembler.h:
+ (JSC::ARMAssembler::JmpSrc::JmpSrc):
+ (JSC::ARMAssembler::sizeOfConstantPool):
+ (JSC::ARMAssembler::jmp):
+ (JSC::ARMAssembler::linkCall):
+ * assembler/ARMv7Assembler.h:
+ * assembler/AbstractMacroAssembler.h:
+ * assembler/AssemblerBufferWithConstantPool.h:
+ (JSC::AssemblerBufferWithConstantPool::flushIfNoSpaceFor): Fix the
+ computation of the remaining space.
+ * assembler/MacroAssemblerARM.h:
+ (JSC::MacroAssemblerARM::branch32):
+ (JSC::MacroAssemblerARM::nearCall):
+ (JSC::MacroAssemblerARM::call):
+ (JSC::MacroAssemblerARM::branchPtrWithPatch):
+ (JSC::MacroAssemblerARM::ensureSpace):
+ (JSC::MacroAssemblerARM::sizeOfConstantPool):
+ (JSC::MacroAssemblerARM::prepareCall):
+ * assembler/X86Assembler.h:
+ * jit/JIT.h:
+ * jit/JITCall.cpp:
+ (JSC::JIT::compileOpCall):
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::beginUninterruptedSequence):
+ (JSC::JIT::endUninterruptedSequence):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::emit_op_method_check):
+ (JSC::JIT::compileGetByIdHotPath):
+ (JSC::JIT::compileGetByIdSlowCase):
+ (JSC::JIT::emit_op_put_by_id):
+
+2009-08-12 Gavin Barraclough <barraclough@apple.com>
+
+ Rubber Stamped by Dave Kilzer.
+
+ Disable WTF_USE_JSVALUE32_64 on iPhone for now (support not yet added for ARMv7).
+
+ * wtf/Platform.h:
+
+2009-08-12 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Maciej Stachoviak.
+
+ Ooops - moved code that had been accidentally added to op_new_func instead of
+ op_new_func_exp, to where it shoulds be.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+ * wtf/Platform.h:
+
+2009-08-12 Ada Chan <adachan@apple.com>
+
+ Added workaround for the limitation that VirtualFree with MEM_RELEASE
+ can only accept the base address returned by VirtualAlloc when the region
+ was reserved and it can only free the entire region, and not a part of it.
+
+ Reviewed by Oliver Hunt.
+
+ * runtime/MarkStack.h:
+ (JSC::MarkStack::MarkStackArray::shrinkAllocation):
+ * runtime/MarkStackWin.cpp:
+ (JSC::MarkStack::releaseStack):
+
+2009-08-12 Balazs Kelemen <kelemen.balazs.3@stud.u-szeged.hu>
+
+ Reviewed by Ariya Hidayat.
+
+ Build fix: use std::numeric_limits<long long>::min() instead of LLONG_MIN
+ since LLONG_MIN is not defined in standard c++.
+
+ * runtime/UString.cpp:
+ (JSC::UString::from):
+
+2009-08-12 Benjamin Otte <otte@gnome.org>
+
+ Reviewed by Jan Alonzo.
+
+ Buildfix for Gtk platforms debug builds.
+
+ * GNUmakefile.am: Choose MarkStackPosix.cpp or MarkStackWin.cpp
+ depending on platform.
+
+2009-08-12 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Prospective build fix for Mac and 32-bit Windows.
+
+ * runtime/UString.cpp: Include wtf/StringExtras.h for snprintf.
+ (JSC::UString::from): Use %lld instead of %I64d for snprintf
+ on non-windows platforms.
+
+2009-08-12 Prasanth Ullattil <prasanth.ullattil@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Fix compile error on 64Bit Windows, when UString::from
+ is called with an intptr_t.
+
+ Added new UString::From overload with long long parameter.
+
+ Thanks to Holger for the long long idea.
+
+ * runtime/UString.cpp:
+ (JSC::UString::from):
+ * runtime/UString.h:
+
+2009-08-11 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Mark Rowe.
+
+ Minor style fixes.
+
+ * runtime/UString.h:
+ (JSC::UString::Rep::createEmptyBuffer):
+ * wtf/FastMalloc.h:
+ (WTF::TryMallocReturnValue::getValue):
+
+2009-08-11 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Make it harder to misuse try* allocation routines
+ https://bugs.webkit.org/show_bug.cgi?id=27469
+
+ Jump through a few hoops to make it much harder to accidentally
+ miss null-checking of values returned by the try-* allocation
+ routines.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::putSlowCase):
+ (JSC::JSArray::increaseVectorLength):
+ * runtime/StringPrototype.cpp:
+ (JSC::stringProtoFuncFontsize):
+ (JSC::stringProtoFuncLink):
+ * runtime/UString.cpp:
+ (JSC::allocChars):
+ (JSC::reallocChars):
+ (JSC::expandCapacity):
+ (JSC::UString::Rep::reserveCapacity):
+ (JSC::UString::expandPreCapacity):
+ (JSC::createRep):
+ (JSC::concatenate):
+ (JSC::UString::spliceSubstringsWithSeparators):
+ (JSC::UString::replaceRange):
+ (JSC::UString::append):
+ (JSC::UString::operator=):
+ * runtime/UString.h:
+ (JSC::UString::Rep::createEmptyBuffer):
+ * wtf/FastMalloc.cpp:
+ (WTF::tryFastZeroedMalloc):
+ (WTF::tryFastMalloc):
+ (WTF::tryFastCalloc):
+ (WTF::tryFastRealloc):
+ (WTF::TCMallocStats::tryFastMalloc):
+ (WTF::TCMallocStats::tryFastCalloc):
+ (WTF::TCMallocStats::tryFastRealloc):
+ * wtf/FastMalloc.h:
+ (WTF::TryMallocReturnValue::TryMallocReturnValue):
+ (WTF::TryMallocReturnValue::~TryMallocReturnValue):
+ (WTF::TryMallocReturnValue::operator PossiblyNull<T>):
+ (WTF::TryMallocReturnValue::getValue):
+ * wtf/Platform.h:
+ * wtf/PossiblyNull.h: Added.
+ (WTF::PossiblyNull::PossiblyNull):
+ (WTF::PossiblyNull::~PossiblyNull):
+ (WTF::::getValue):
+
+2009-08-11 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by NOBODY (build fix part deux).
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-08-11 Gavin Barraclough <barraclough@apple.com>
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-08-11 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Restrict use of FuncDeclNode & FuncExprNode to the parser.
+ https://bugs.webkit.org/show_bug.cgi?id=28209
+
+ These objects were also being referenced from the CodeBlock. By changing this
+ to just retain pointers to FunctionBodyNodes these classes can be restricted to
+ use during parsing.
+
+ No performance impact (or sub-percent progression).
+
+ * JavaScriptCore.exp:
+ Update symbols.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::mark):
+ (JSC::CodeBlock::reparseForExceptionInfoIfNecessary):
+ (JSC::CodeBlock::shrinkToFit):
+ * bytecode/CodeBlock.h:
+ (JSC::CodeBlock::addFunction):
+ (JSC::CodeBlock::function):
+ Unify m_functions & m_functionExpressions into a single Vector<RefPtr<FuncExprNode> >.
+
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::BytecodeGenerator):
+ (JSC::BytecodeGenerator::addConstant):
+ (JSC::BytecodeGenerator::emitNewFunction):
+ (JSC::BytecodeGenerator::emitNewFunctionExpression):
+ * bytecompiler/BytecodeGenerator.h:
+ FunctionStacks now contain FunctionBodyNodes not FuncDeclNodes.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::execute):
+ (JSC::Interpreter::privateExecute):
+ Update to reflect chnages in CodeBlock.
+
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_new_func_exp):
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+ * jit/JITStubs.h:
+ (JSC::):
+ Update to reflect chnages in CodeBlock.
+
+ * parser/Grammar.y:
+ FunctionStacks now contain FunctionBodyNodes not FuncDeclNodes.
+
+ * parser/NodeConstructors.h:
+ (JSC::FuncExprNode::FuncExprNode):
+ (JSC::FuncDeclNode::FuncDeclNode):
+ * parser/Nodes.cpp:
+ (JSC::ScopeNodeData::mark):
+ (JSC::FunctionBodyNode::finishParsing):
+ * parser/Nodes.h:
+ (JSC::FunctionBodyNode::ident):
+ Move m_ident & make methods from FuncDeclNode & FuncExprNode to FunctionBodyNode.
+
+ * runtime/JSFunction.h:
+ (JSC::FunctionBodyNode::make):
+ Make this method inline (was FuncDeclNode::makeFunction).
+
+2009-08-11 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Native JSON.stringify does not omit functions
+ https://bugs.webkit.org/show_bug.cgi?id=28117
+
+ Objects that are callable should be treated as undefined when
+ serialising to JSON.
+
+ * runtime/JSONObject.cpp:
+ (JSC::Stringifier::appendStringifiedValue):
+
+2009-08-11 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ REGRESSION: Hang/crash in BytecodeGenerator::constRegisterFor loading simple page
+ https://bugs.webkit.org/show_bug.cgi?id=28169
+
+ Handle the case where someone has attempted to shadow a property
+ on the global object with a constant.
+
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::constRegisterFor):
+ * parser/Nodes.cpp:
+ (JSC::ConstDeclNode::emitCodeSingle):
+
+2009-08-11 John Gregg <johnnyg@google.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Desktop Notifications API
+ https://bugs.webkit.org/show_bug.cgi?id=25463
+
+ Adds ENABLE_NOTIFICATION flag.
+
+ * Configurations/FeatureDefines.xcconfig:
+ * wtf/Platform.h:
+
+2009-08-11 Maxime Simon <simon.maxime@gmail.com>
+
+ Reviewed by Eric Seidel.
+
+ Modifications on JavaScriptCore to allow Haiku port.
+ https://bugs.webkit.org/show_bug.cgi?id=28121
+
+ * runtime/Collector.cpp: Haiku doesn't have sys/mman.h, using OS.h instead.
+ (JSC::currentThreadStackBase): Haiku uses its own threading system.
+ * wtf/Platform.h: Defining all Haiku platform values.
+ * wtf/haiku/MainThreadHaiku.cpp: Adding a missing header (NotImplemented.h).
+
+2009-08-11 Jessie Berlin <jberlin@apple.com>
+
+ Reviewed by Adam Roben.
+
+ Fix windows build.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-08-11 Csaba Osztrogonac <oszi@inf.u-szeged.hu>
+
+ Reviewed by Tor Arne Vestbø.
+
+ Buildfix for Qt-win platforms.
+
+ * JavaScriptCore.pri: Choose MarkStackPosix.cpp or MarkStackWin.cpp depend on platform.
+
+2009-08-10 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by NOBODY (And another build fix).
+
+ Add new exports for MSVC
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2009-08-10 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by NOBODY (yet another build fix).
+
+ Remove obsolete entries from MSVC exports file
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-08-10 Oliver Hunt <oliver@apple.com>
+
+ Add includes needed for non-allinonefile builds
+
+ * runtime/GetterSetter.h:
+ * runtime/ScopeChain.h:
+
+2009-08-10 Oliver Hunt <oliver@apple.com>
+
+ Fix export file for last build fix
+
+ * JavaScriptCore.exp:
+
+2009-08-10 Oliver Hunt <oliver@apple.com>
+
+ Hoist page size initialization into platform specific code.
+
+ * jit/ExecutableAllocatorPosix.cpp:
+ * jit/ExecutableAllocatorWin.cpp:
+ * runtime/MarkStack.h:
+ (JSC::MarkStack::pageSize):
+ * runtime/MarkStackPosix.cpp:
+ (JSC::MarkStack::initializePagesize):
+ * runtime/MarkStackWin.cpp:
+ (JSC::MarkStack::initializePagesize):
+
+2009-08-07 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Stack overflow crash in JavaScript garbage collector mark pass
+ https://bugs.webkit.org/show_bug.cgi?id=12216
+
+ Make the GC mark phase iterative by using an explicit mark stack.
+ To do this marking any single object is performed in multiple stages
+ * The object is appended to the MarkStack, this sets the marked
+ bit for the object using the new markDirect() function, and then
+ returns
+ * When the MarkStack is drain()ed the object is popped off the stack
+ and markChildren(MarkStack&) is called on the object to collect
+ all of its children. drain() then repeats until the stack is empty.
+
+ Additionally I renamed a number of methods from 'mark' to 'markAggregate'
+ in order to make it more clear that marking of those object was not
+ going to result in an actual recursive mark.
+
+ * GNUmakefile.am
+ * JavaScriptCore.exp:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.pri:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::markAggregate):
+ * bytecode/CodeBlock.h:
+ * bytecode/EvalCodeCache.h:
+ (JSC::EvalCodeCache::markAggregate):
+ * debugger/DebuggerActivation.cpp:
+ (JSC::DebuggerActivation::markChildren):
+ * debugger/DebuggerActivation.h:
+ * interpreter/Register.h:
+ * interpreter/RegisterFile.h:
+ (JSC::RegisterFile::markGlobals):
+ (JSC::RegisterFile::markCallFrames):
+ * parser/Nodes.cpp:
+ (JSC::ScopeNodeData::markAggregate):
+ (JSC::EvalNode::markAggregate):
+ (JSC::FunctionBodyNode::markAggregate):
+ * parser/Nodes.h:
+ (JSC::ScopeNode::markAggregate):
+ * runtime/ArgList.cpp:
+ (JSC::MarkedArgumentBuffer::markLists):
+ * runtime/ArgList.h:
+ * runtime/Arguments.cpp:
+ (JSC::Arguments::markChildren):
+ * runtime/Arguments.h:
+ * runtime/Collector.cpp:
+ (JSC::Heap::markConservatively):
+ (JSC::Heap::markCurrentThreadConservativelyInternal):
+ (JSC::Heap::markCurrentThreadConservatively):
+ (JSC::Heap::markOtherThreadConservatively):
+ (JSC::Heap::markStackObjectsConservatively):
+ (JSC::Heap::markProtectedObjects):
+ (JSC::Heap::collect):
+ * runtime/Collector.h:
+ * runtime/GetterSetter.cpp:
+ (JSC::GetterSetter::markChildren):
+ * runtime/GetterSetter.h:
+ (JSC::GetterSetter::GetterSetter):
+ (JSC::GetterSetter::createStructure):
+ * runtime/GlobalEvalFunction.cpp:
+ (JSC::GlobalEvalFunction::markChildren):
+ * runtime/GlobalEvalFunction.h:
+ * runtime/JSActivation.cpp:
+ (JSC::JSActivation::markChildren):
+ * runtime/JSActivation.h:
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::markChildren):
+ * runtime/JSArray.h:
+ * runtime/JSCell.h:
+ (JSC::JSCell::markCellDirect):
+ (JSC::JSCell::markChildren):
+ (JSC::JSValue::markDirect):
+ (JSC::JSValue::markChildren):
+ (JSC::JSValue::hasChildren):
+ (JSC::MarkStack::append):
+ (JSC::MarkStack::drain):
+ * runtime/JSFunction.cpp:
+ (JSC::JSFunction::markChildren):
+ * runtime/JSFunction.h:
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData):
+ * runtime/JSGlobalData.h:
+ * runtime/JSGlobalObject.cpp:
+ (JSC::markIfNeeded):
+ (JSC::JSGlobalObject::markChildren):
+ * runtime/JSGlobalObject.h:
+ * runtime/JSNotAnObject.cpp:
+ (JSC::JSNotAnObject::markChildren):
+ * runtime/JSNotAnObject.h:
+ * runtime/JSONObject.cpp:
+ (JSC::Stringifier::markAggregate):
+ (JSC::JSONObject::markStringifiers):
+ * runtime/JSONObject.h:
+ * runtime/JSObject.cpp:
+ (JSC::JSObject::markChildren):
+ (JSC::JSObject::defineGetter):
+ (JSC::JSObject::defineSetter):
+ * runtime/JSObject.h:
+ * runtime/JSPropertyNameIterator.cpp:
+ (JSC::JSPropertyNameIterator::markChildren):
+ * runtime/JSPropertyNameIterator.h:
+ (JSC::JSPropertyNameIterator::createStructure):
+ (JSC::JSPropertyNameIterator::JSPropertyNameIterator):
+ (JSC::JSPropertyNameIterator::create):
+ * runtime/JSStaticScopeObject.cpp:
+ (JSC::JSStaticScopeObject::markChildren):
+ * runtime/JSStaticScopeObject.h:
+ * runtime/JSType.h:
+ (JSC::):
+ * runtime/JSValue.h:
+ * runtime/JSWrapperObject.cpp:
+ (JSC::JSWrapperObject::markChildren):
+ * runtime/JSWrapperObject.h:
+ * runtime/MarkStack.cpp: Added.
+ (JSC::MarkStack::compact):
+ * runtime/MarkStack.h: Added.
+ (JSC::):
+ (JSC::MarkStack::MarkStack):
+ (JSC::MarkStack::append):
+ (JSC::MarkStack::appendValues):
+ (JSC::MarkStack::~MarkStack):
+ (JSC::MarkStack::MarkSet::MarkSet):
+ (JSC::MarkStack::pageSize):
+
+ MarkStackArray is a non-shrinking, mmap-based vector type
+ used for storing objects to be marked.
+ (JSC::MarkStack::MarkStackArray::MarkStackArray):
+ (JSC::MarkStack::MarkStackArray::~MarkStackArray):
+ (JSC::MarkStack::MarkStackArray::expand):
+ (JSC::MarkStack::MarkStackArray::append):
+ (JSC::MarkStack::MarkStackArray::removeLast):
+ (JSC::MarkStack::MarkStackArray::isEmpty):
+ (JSC::MarkStack::MarkStackArray::size):
+ (JSC::MarkStack::MarkStackArray::shrinkAllocation):
+ * runtime/MarkStackPosix.cpp: Added.
+ (JSC::MarkStack::allocateStack):
+ (JSC::MarkStack::releaseStack):
+ * runtime/MarkStackWin.cpp: Added.
+ (JSC::MarkStack::allocateStack):
+ (JSC::MarkStack::releaseStack):
+
+ * runtime/ScopeChain.h:
+ * runtime/ScopeChainMark.h:
+ (JSC::ScopeChain::markAggregate):
+ * runtime/SmallStrings.cpp:
+ (JSC::SmallStrings::mark):
+ * runtime/Structure.h:
+ (JSC::Structure::markAggregate):
+
+2009-08-10 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Fix hundreds of "pointer being freed was not allocated" errors seen on the build bot.
+
+ * wtf/FastMalloc.h: Implement nothrow variants of the delete and delete[] operators since
+ we implement the nothrow variants of new and new[]. The nothrow variant of delete is called
+ explicitly in the implementation of std::sort which was resulting in FastMalloc-allocated
+ memory being passed to the system allocator to free.
+
+2009-08-10 Jan Michael Alonzo <jmalonzo@webkit.org>
+
+ [Gtk] Unreviewed build fix. Move JSAPIValueWrapper.cpp/.h in the debug
+ section. This file is already part of AllInOneFile in Release builds.
+
+ * GNUmakefile.am:
+
+2009-08-10 Darin Adler <darin@apple.com>
+
+ * wtf/FastMalloc.h: Fix build.
+
+2009-08-10 Darin Adler <darin@apple.com>
+
+ Reviewed by Mark Rowe.
+
+ FastMalloc.h has cross-platform code but marked as WinCE-only
+ https://bugs.webkit.org/show_bug.cgi?id=28160
+
+ 1) The support for nothrow was inside #if PLATFORM(WINCE) even though it is
+ not platform-specific.
+ 2) The code tried to override operator delete nothrow, which does not exist.
+ 3) The code in the header checks the value of USE_SYSTEM_MALLOC, but the code
+ in FastMalloc.cpp checks only if the macro is defined.
+
+ * wtf/FastMalloc.h: See above.
+ * wtf/FastMalloc.cpp: Ditto.
+
+2009-08-10 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Anders Carlsson.
+
+ Fix an annoying indentation issue.
+
+ * runtime/DateConstructor.cpp:
+ (JSC::constructDate):
+
+2009-08-10 Xan Lopez <xlopez@igalia.com>
+
+ Unreviewed build fix.
+
+ Add new files to makefile.
+
+ * GNUmakefile.am:
+
+2009-08-10 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Fix compilation with the interpreter instead of the JIT by including
+ PrototypeFunction.h as forward-declared through NativeFunctionWrapper.h.
+
+ * runtime/ObjectConstructor.cpp:
+
+2009-08-09 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by George Staikos.
+
+ JSON.stringify replacer returning undefined does not omit object properties
+ https://bugs.webkit.org/show_bug.cgi?id=28118
+
+ Correct behaviour of stringify when using a replacer function that returns
+ undefined. This is a simple change to move the undefined value check to
+ after the replacer function is called. This means that the replacer function
+ is now called for properties with the value undefined, however i've confirmed
+ that this behaviour is correct.
+
+ In addition I've made the cyclic object exception have a more useful error
+ message.
+
+ * runtime/JSONObject.cpp:
+ (JSC::Stringifier::appendStringifiedValue):
+
+2009-08-08 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Eric Seidel and Sam Weinig.
+
+ [ES5] Implement Object.getPrototypeOf
+ https://bugs.webkit.org/show_bug.cgi?id=28114
+
+ Implement getPrototypeOf
+
+ * runtime/CommonIdentifiers.h:
+ * runtime/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::reset):
+ * runtime/ObjectConstructor.cpp:
+ (JSC::ObjectConstructor::ObjectConstructor):
+ (JSC::objectConsGetPrototypeOf):
+ * runtime/ObjectConstructor.h:
+
+2009-08-07 Zoltan Horvath <hzoltan@inf.u-szeged.hu>
+
+ Reviewed by Eric Seidel.
+
+ Allow custom memory allocation control for Noncopyable class
+ https://bugs.webkit.org/show_bug.cgi?id=27879
+
+ Several classes which are inherited from Noncopyable are instantiated by
+ operator new, so Noncopyable class has been inherited from FastAllocBase.
+
+ * wtf/Noncopyable.h:
+
+2009-08-07 George Staikos <george.staikos@torchmobile.com>
+
+ Reviewed by Eric Seidel.
+
+ https://bugs.webkit.org/show_bug.cgi?id=27305
+ Implement WinCE-specific unicode layer.
+ Written by George Staikos <george.staikos@torchmobile.com>
+ with bug fixes by Yong Li <yong.li@torchmobile.com>
+ refactored by Joe Mason <joe.mason@torchmobile.com>
+
+ * wtf/Platform.h:
+ * wtf/unicode/Unicode.h:
+ * wtf/unicode/wince/UnicodeWince.cpp: Added.
+ (WTF::Unicode::toLower):
+ (WTF::Unicode::toUpper):
+ (WTF::Unicode::foldCase):
+ (WTF::Unicode::isPrintableChar):
+ (WTF::Unicode::isSpace):
+ (WTF::Unicode::isLetter):
+ (WTF::Unicode::isUpper):
+ (WTF::Unicode::isLower):
+ (WTF::Unicode::isDigit):
+ (WTF::Unicode::isPunct):
+ (WTF::Unicode::toTitleCase):
+ (WTF::Unicode::direction):
+ (WTF::Unicode::category):
+ (WTF::Unicode::decompositionType):
+ (WTF::Unicode::combiningClass):
+ (WTF::Unicode::mirroredChar):
+ (WTF::Unicode::digitValue):
+ * wtf/unicode/wince/UnicodeWince.h: Added.
+ (WTF::Unicode::):
+ (WTF::Unicode::isSeparatorSpace):
+ (WTF::Unicode::isHighSurrogate):
+ (WTF::Unicode::isLowSurrogate):
+ (WTF::Unicode::isArabicChar):
+ (WTF::Unicode::hasLineBreakingPropertyComplexContext):
+ (WTF::Unicode::umemcasecmp):
+ (WTF::Unicode::surrogateToUcs4):
+
+2009-08-07 Yongjun Zhang <yongjun.zhang@nokia.com>
+
+ Reviewed by Eric Seidel.
+
+ https://bugs.webkit.org/show_bug.cgi?id=28069
+
+ Add inline to help winscw compiler resolve specialized argument in
+ templated functions.
+
+ * runtime/LiteralParser.cpp:
+ (JSC::LiteralParser::Lexer::lexString):
+
+2009-08-07 Zoltan Horvath <hzoltan@inf.u-szeged.hu>
+
+ Reviewed by Eric Seidel.
+
+ Allow custom memory allocation control for RegExpObjectData struct
+ http://bugs.webkit.org/show_bug.cgi?id=26750
+
+ Inherits RegExpObjectData struct from FastAllocBase because
+ it has been instantiated by 'new' in JavaScriptCore/runtime/RegExpObject.cpp:62
+
+ * runtime/RegExpObject.h:
+
+2009-08-06 Norbert Leser <norbert.leser@nokia.com>
+
+ Reviewed by Darin Adler.
+
+ Updated patch for bug #27059:
+ Symbian platform always uses little endian encoding,
+ regardless of compiler.
+ We need to make sure that we correctly detect EABI architecture
+ for armv5 targets on Symbian,
+ where __EABI__ is set but not __ARM_EABI__
+
+ * wtf/Platform.h:
+
+2009-08-06 Adam Barth <abarth@webkit.org>
+
+ Unreviewed revert.
+
+ http://bugs.webkit.org/show_bug.cgi?id=27879
+
+ Revert 46877 because it broke GTK.
+
+ * wtf/Noncopyable.h:
+
+2009-08-06 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Make get_by_id/put_by_id/method_check/call defer optimization using a data flag rather than a code modification.
+ ( https://bugs.webkit.org/show_bug.cgi?id=27635 )
+
+ This improves performance of ENABLE(ASSEMBLER_WX_EXCLUSIVE) builds by 2-2.5%, reducing the overhead to about 2.5%.
+ (No performance impact with ASSEMBLER_WX_EXCLUSIVE disabled).
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::printStructureStubInfo):
+ - Make StructureStubInfo store the type as an integer, rather than an OpcodeID.
+
+ * bytecode/CodeBlock.h:
+ (JSC::):
+ (JSC::CallLinkInfo::seenOnce):
+ (JSC::CallLinkInfo::setSeen):
+ (JSC::MethodCallLinkInfo::seenOnce):
+ (JSC::MethodCallLinkInfo::setSeen):
+ - Change a pointer in CallLinkInfo/MethodCallLinkInfo to use a PtrAndFlags, use a flag to track when an op has been executed once.
+
+ * bytecode/StructureStubInfo.cpp:
+ (JSC::StructureStubInfo::deref):
+ - Make StructureStubInfo store the type as an integer, rather than an OpcodeID.
+
+ * bytecode/StructureStubInfo.h:
+ (JSC::StructureStubInfo::StructureStubInfo):
+ (JSC::StructureStubInfo::initGetByIdSelf):
+ (JSC::StructureStubInfo::initGetByIdProto):
+ (JSC::StructureStubInfo::initGetByIdChain):
+ (JSC::StructureStubInfo::initGetByIdSelfList):
+ (JSC::StructureStubInfo::initGetByIdProtoList):
+ (JSC::StructureStubInfo::initPutByIdTransition):
+ (JSC::StructureStubInfo::initPutByIdReplace):
+ (JSC::StructureStubInfo::seenOnce):
+ (JSC::StructureStubInfo::setSeen):
+ - Make StructureStubInfo store the type as an integer, rather than an OpcodeID, add a flag to track when an op has been executed once.
+
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::emitGetById):
+ (JSC::BytecodeGenerator::emitPutById):
+ - Make StructureStubInfo store the type as an integer, rather than an OpcodeID.
+
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ (JSC::JIT::unlinkCall):
+ - Remove the "don't lazy link" stage of calls.
+
+ * jit/JIT.h:
+ (JSC::JIT::compileCTIMachineTrampolines):
+ - Remove the "don't lazy link" stage of calls.
+
+ * jit/JITCall.cpp:
+ (JSC::JIT::compileOpCallSlowCase):
+ - Remove the "don't lazy link" stage of calls.
+
+ * jit/JITStubs.cpp:
+ (JSC::JITThunks::JITThunks):
+ (JSC::JITThunks::tryCachePutByID):
+ (JSC::JITThunks::tryCacheGetByID):
+ (JSC::JITStubs::DEFINE_STUB_FUNCTION):
+ (JSC::JITStubs::getPolymorphicAccessStructureListSlot):
+ - Remove the "don't lazy link" stage of calls, and the "_second" stage of get_by_id/put_by_id/method_check.
+
+ * jit/JITStubs.h:
+ (JSC::JITThunks::ctiStringLengthTrampoline):
+ (JSC::JITStubs::):
+ - Remove the "don't lazy link" stage of calls, and the "_second" stage of get_by_id/put_by_id/method_check.
+
+ * wtf/PtrAndFlags.h:
+ (WTF::PtrAndFlags::PtrAndFlags):
+ (WTF::PtrAndFlags::operator!):
+ (WTF::PtrAndFlags::operator->):
+ - Add ! and -> operators, add constuctor with pointer argument.
+
+2009-08-06 Zoltan Horvath <hzoltan@inf.u-szeged.hu>
+
+ Reviewed by Adam Barth.
+
+ Allow custom memory allocation control for Noncopyable class
+ https://bugs.webkit.org/show_bug.cgi?id=27879
+
+ Several classes which inherited from Noncopyable are instantiated by
+ operator new, so Noncopyable class has been inherited from FastAllocBase.
+
+ * wtf/Noncopyable.h:
+
+2009-08-06 Mark Rowe <mrowe@apple.com>
+
+ Rubber-stamped by Sam Weinig.
+
+ Add explicit dependencies for our build verification scripts to ensure that they always run after linking has completed.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2009-08-06 Mark Rowe <mrowe@apple.com>
+
+ Bring a little order to our otherwise out of control lives.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2009-08-06 Zoltan Horvath <hzoltan@inf.u-szeged.hu>
+
+ Reviewed by Darin Adler.
+
+ Allow custom memory allocation control for JavaScriptCore's PolymorphicAccessStructureList struct
+ https://bugs.webkit.org/show_bug.cgi?id=27877
+
+ Inherits PolymorphicAccessStructureList struct from FastAllocBase because it has been instantiated by
+ 'new' in JavaScriptCore/jit/JITStubs.cpp:1229.
+
+ * bytecode/Instruction.h:
+
+2009-08-05 Zoltan Horvath <hzoltan@inf.u-szeged.hu>
+
+ Reviewed by Darin Adler.
+
+ Allow custom memory allocation control for JavaScriptCore's ScopeNodeData struct
+ https://bugs.webkit.org/show_bug.cgi?id=27875
+
+ Inherits ScopeNodeData struct from FastAllocBase because it has been instantiated by
+ 'new' in JavaScriptCore/parser/Nodes.cpp:1848.
+
+ * parser/Nodes.h:
+
+2009-08-05 Zoltan Herczeg <zherczeg@inf.u-szeged.hu>
+
+ Reviewed by Gavin Barraclough.
+
+ Add floating point support for generic ARM port.
+ https://bugs.webkit.org/show_bug.cgi?id=24986
+
+ * assembler/ARMAssembler.cpp:
+ (JSC::ARMAssembler::doubleTransfer):
+ * assembler/ARMAssembler.h:
+ (JSC::ARM::):
+ (JSC::ARMAssembler::):
+ (JSC::ARMAssembler::faddd_r):
+ (JSC::ARMAssembler::fsubd_r):
+ (JSC::ARMAssembler::fmuld_r):
+ (JSC::ARMAssembler::fcmpd_r):
+ (JSC::ARMAssembler::fdtr_u):
+ (JSC::ARMAssembler::fdtr_d):
+ (JSC::ARMAssembler::fmsr_r):
+ (JSC::ARMAssembler::fsitod_r):
+ (JSC::ARMAssembler::fmstat):
+ * assembler/MacroAssemblerARM.h:
+ (JSC::MacroAssemblerARM::):
+ (JSC::MacroAssemblerARM::supportsFloatingPoint):
+ (JSC::MacroAssemblerARM::loadDouble):
+ (JSC::MacroAssemblerARM::storeDouble):
+ (JSC::MacroAssemblerARM::addDouble):
+ (JSC::MacroAssemblerARM::subDouble):
+ (JSC::MacroAssemblerARM::mulDouble):
+ (JSC::MacroAssemblerARM::convertInt32ToDouble):
+ (JSC::MacroAssemblerARM::branchDouble):
+ * jit/JIT.h:
+
+2009-08-05 Zoltan Herczeg <zherczeg@inf.u-szeged.hu>
+
+ Reviewed by Gavin Barraclough.
+
+ Add JIT support for generic ARM port without optimizations.
+ https://bugs.webkit.org/show_bug.cgi?id=24986
+
+ All JIT optimizations are disabled.
+
+ Signed off by Zoltan Herczeg <zherczeg@inf.u-szeged.hu>
+ Signed off by Gabor Loki <loki@inf.u-szeged.hu>
+
+ * assembler/ARMAssembler.cpp:
+ (JSC::ARMAssembler::baseIndexTransfer32):
+ * assembler/AbstractMacroAssembler.h:
+ (JSC::AbstractMacroAssembler::Imm32::Imm32):
+ * assembler/MacroAssemblerARM.h:
+ (JSC::MacroAssemblerARM::store32):
+ (JSC::MacroAssemblerARM::move):
+ (JSC::MacroAssemblerARM::branch32):
+ (JSC::MacroAssemblerARM::add32):
+ (JSC::MacroAssemblerARM::sub32):
+ (JSC::MacroAssemblerARM::load32):
+ * bytecode/CodeBlock.h:
+ (JSC::CodeBlock::getBytecodeIndex):
+ * jit/JIT.h:
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::restoreArgumentReference):
+ * jit/JITOpcodes.cpp:
+ * jit/JITStubs.cpp:
+ * jit/JITStubs.h:
+ (JSC::JITStackFrame::returnAddressSlot):
+ * wtf/Platform.h:
+
+2009-08-04 Gavin Barraclough <barraclough@apple.com>
+
+ Rubber Stamped by Oiver Hunt.
+
+ Revert r46643 since this breaks the Yarr::Interpreter running the v8 tests.
+ https://bugs.webkit.org/show_bug.cgi?id=27874
+
+ * yarr/RegexInterpreter.cpp:
+ (JSC::Yarr::Interpreter::allocDisjunctionContext):
+ (JSC::Yarr::Interpreter::freeDisjunctionContext):
+ (JSC::Yarr::Interpreter::allocParenthesesDisjunctionContext):
+ (JSC::Yarr::Interpreter::freeParenthesesDisjunctionContext):
+
+2009-08-04 Oliver Hunt <oliver@apple.com>
+
+ PPC64 Build fix
+
+ * wtf/Platform.h:
+
+2009-08-04 Benjamin C Meyer <benjamin.meyer@torchmobile.com>
+
+ Reviewed by Adam Treat
+
+ Explicitly include limits.h header when using INT_MAX and INT_MIN
+
+ * interpreter/Interpreter.cpp
+
+2009-08-03 Harald Fernengel <harald.fernengel@nokia.com>
+
+ Reviewed by Darin Adler.
+
+ Fix compile error for ambigous call to abs()
+ https://bugs.webkit.org/show_bug.cgi?id=27873
+
+ Fix ambiguity in abs(long int) call by calling labs() instead
+
+ * wtf/DateMath.cpp: replace call to abs() with labs()
+
+2009-08-03 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Eric Seidel.
+
+ [Qt] Consolidate common gcc flags to WebKit.pri
+ https://bugs.webkit.org/show_bug.cgi?id=27934
+
+ * JavaScriptCore.pro:
+
+2009-08-03 Ada Chan <adachan@apple.com>
+
+ Fixed the Tiger build.
+
+ * wtf/FastMalloc.cpp:
+
+2009-08-03 Ada Chan <adachan@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Don't use background thread to scavenge memory on Tiger until we figure out why it causes a crash.
+ https://bugs.webkit.org/show_bug.cgi?id=27900
+
+ * wtf/FastMalloc.cpp:
+
+2009-08-03 Fumitoshi Ukai <ukai@chromium.org>
+
+ Reviewed by Jan Alonzo.
+
+ Fix build break on Gtk/x86_64.
+ https://bugs.webkit.org/show_bug.cgi?id=27936
+
+ Use JSVALUE64 for X86_64 LINUX, except Qt.
+
+ * wtf/Platform.h:
+
+2009-08-02 Xan Lopez <xlopez@igalia.com>
+
+ Fix the GTK+ build.
+
+ * wtf/Platform.h:
+
+2009-08-02 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Disabled JSVALUE32_64 on Qt builds, since all layout tests mysteriously
+ crash with it enabled.
+
+ * wtf/Platform.h:
+
+2009-08-02 Geoffrey Garen <ggaren@apple.com>
+
+ Qt build fix.
+
+ Added JSAPIValueWrapper.cpp to the build.
+
+ * JavaScriptCore.pri:
+
+2009-08-02 Geoffrey Garen <ggaren@apple.com>
+
+ Windows build fix.
+
+ Exported symbols for JSAPIValueWrapper.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-08-02 Geoffrey Garen <ggaren@apple.com>
+
+ GTK build fix.
+
+ * jit/JITStubs.cpp: #include <stdarg.h>, for a definition of va_start.
+
+2009-08-02 Geoffrey Garen <ggaren@apple.com>
+
+ Qt build fix.
+
+ * runtime/Collector.cpp: #include <limits.h>, for a definition of ULONG_MAX.
+
+2009-08-02 Geoffrey Garen <ggaren@apple.com>
+
+ Windows build fix: Nixed JSImmediate::prototype, JSImmediate::toObject,
+ and JSImmediate::toThisObject, and removed their exported symbols.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+ * runtime/JSImmediate.cpp:
+ * runtime/JSImmediate.h:
+
+2009-08-02 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Mark Rowe.
+
+ Enabled JSVALUE32_64 by default on all platforms other than x86_64 (which uses JSVALUE64).
+
+ * wtf/Platform.h:
+
+2009-08-02 Kevin Ollivier <kevino@theolliviers.com>
+
+ Reviewed by Jan Alonzo.
+
+ Script for building the JavaScriptCore library for wx.
+ https://bugs.webkit.org/show_bug.cgi?id=27619
+
+ * wscript: Added.
+
+2009-08-02 Yong Li <yong.li@torchmobile.com>
+
+ Reviewed by George Staikos.
+
+ DateMath depends on strftime and localtime, which need to be imported manually on WinCE
+ https://bugs.webkit.org/show_bug.cgi?id=26558
+
+ * wtf/DateMath.cpp:
+
+2009-08-01 David Kilzer <ddkilzer@apple.com>
+
+ wtf/Threading.h: added include of Platform.h
+
+ Reviewed by Mark Rowe.
+
+ * wtf/Threading.h: Added #include "Platform.h" since this header
+ uses PLATFORM() and other macros.
+
+2009-08-01 Mark Rowe <mrowe@apple.com>
+
+ Rubber-stamped by Oliver Hunt.
+
+ Roll out r46668 as it was misinformed. ScopeChain is only used with placement new.
+
+ * runtime/ScopeChain.h:
+
+2009-08-01 Zoltan Horvath <hzoltan@inf.u-szeged.hu>
+
+ Allow custom memory allocation control for JavaScriptCore's HashMap class
+ http://bugs.webkit.org/show_bug.cgi?id=27871
+
+ Inherits HashMap class from FastAllocBase because it has been
+ instantiated by 'new' in JavaScriptCore/API/JSClassRef.cpp:148.
+
+ * wtf/RefPtrHashMap.h:
+ (WTF::):
+
+2009-08-01 Zoltan Horvath <hzoltan@inf.u-szeged.hu>
+
+ Allow custom memory allocation control for JavaScriptCore's ScopeChain class
+ https://bugs.webkit.org/show_bug.cgi?id=27834
+
+ Inherits ScopeChain class from FastAllocBase because it has been
+ instantiated by 'new' in JavaScriptCore/runtime/JSFunction.h:109.
+
+ * runtime/ScopeChain.h:
+
+2009-08-01 Zoltan Horvath <hzoltan@inf.u-szeged.hu>
+
+ Reviewed by Darin Adler.
+
+ Allow custom memory allocation control for JavaScriptCore's RegExpConstructorPrivate struct
+ https://bugs.webkit.org/show_bug.cgi?id=27833
+
+ Inherits RegExpConstructorPrivate class from FastAllocBase because it has been
+ instantiated by 'new' in JavaScriptCore/runtime/RegExpConstructor.cpp:152.
+
+ * runtime/RegExpConstructor.cpp:
+
+2009-07-31 Yong Li <yong.li@torchmobile.com>
+
+ Reviewed by George Staikos.
+
+ Resurrect the old GetTickCount implementation of currentTime, controlled by WTF_USE_QUERY_PERFORMANCE_COUNTER
+ currentSystemTime taken from older WebKit; currentTime written by Yong Li <yong.li@torchmobile.com>; cleanup by Joe Mason <joe.mason@torchmobile.com>
+ https://bugs.webkit.org/show_bug.cgi?id=27848
+
+ * wtf/CurrentTime.cpp:
+ (WTF::currentSystemTime): get current time with GetCurrentFT
+ (WTF::currentTime): track msec elapsed since first currentSystemTime call using GetTickCount
+ * wtf/Platform.h:
+
+2009-07-31 Ada Chan <adachan@apple.com>
+
+ Fixes the Windows release-PGO build.
+
+ Reviewed by Jon Honeycutt.
+
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj: Suppresses the warning about unreachable code that we get by adding "return 0" to WTF::TCMalloc_PageHeap::runScavengerThread().
+ * wtf/FastMalloc.cpp:
+ (WTF::TCMalloc_PageHeap::runScavengerThread): Fixes the error about the method not returning a value in the release-PGO build.
+
+2009-07-31 Zoltan Horvath <hzoltan@inf.u-szeged.hu>
+
+ Change malloc to fastMalloc and free to fastFree in Yarr's RegexInterpreter.cpp
+ https://bugs.webkit.org/show_bug.cgi?id=27874
+
+ Use fastMalloc and fastFree instead of malloc and free in RegexInterpreter.cpp's methods.
+
+ * yarr/RegexInterpreter.cpp:
+ (JSC::Yarr::Interpreter::allocDisjunctionContext):
+ (JSC::Yarr::Interpreter::freeDisjunctionContext):
+ (JSC::Yarr::Interpreter::allocParenthesesDisjunctionContext):
+ (JSC::Yarr::Interpreter::freeParenthesesDisjunctionContext):
+
+2009-07-30 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Jan Alonzo.
+
+ Fix compiler warning.
+
+ GCC does not like C++-style comments in preprocessor directives.
+
+ * wtf/Platform.h:
+
+2009-07-30 John McCall <rjmccall@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Optimize the X86_64 trampolines: avoid the need for filler arguments
+ and move the stub-args area closer to the stack pointer.
+
+ * jit/JIT.h: adjust patch offsets because of slight code-size change
+ * jit/JITCode.h:
+ (JSC::JITCode::execute): don't pass filler args
+ * jit/JITStubs.cpp:
+ (ctiTrampoline): (X86_64): push args onto stack, use args directly
+ (ctiVMThrowTrampoline): (X86_64): adjust %rsp by correct displacement
+ (ctiOpThrowNotCaught): (X86_64): adjust %rsp by correct displacement
+ * jit/JITStubs.h:
+ (JITStackFrame): (X86_64): move args area earlier
+ (ctiTrampoline): remove filler args from prototype
+
+2009-07-30 Gavin Barraclough <barraclough@apple.com>
+
+ Temporarily revert r46618 since this is b0rking on Linux.
+
+2009-07-23 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Make get_by_id/put_by_id/method_check/call defer optimization using a data flag rather than a code modification.
+ ( https://bugs.webkit.org/show_bug.cgi?id=27635 )
+
+ This improves performance of ENABLE(ASSEMBLER_WX_EXCLUSIVE) builds by 2-2.5%, reducing the overhead to about 2.5%.
+ (No performance impact with ASSEMBLER_WX_EXCLUSIVE disabled).
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::printStructureStubInfo):
+ - Make StructureStubInfo store the type as an integer, rather than an OpcodeID.
+
+ * bytecode/CodeBlock.h:
+ (JSC::):
+ (JSC::CallLinkInfo::seenOnce):
+ (JSC::CallLinkInfo::setSeen):
+ (JSC::MethodCallLinkInfo::seenOnce):
+ (JSC::MethodCallLinkInfo::setSeen):
+ - Change a pointer in CallLinkInfo/MethodCallLinkInfo to use a PtrAndFlags, use a flag to track when an op has been executed once.
+
+ * bytecode/StructureStubInfo.cpp:
+ (JSC::StructureStubInfo::deref):
+ - Make StructureStubInfo store the type as an integer, rather than an OpcodeID.
+
+ * bytecode/StructureStubInfo.h:
+ (JSC::StructureStubInfo::StructureStubInfo):
+ (JSC::StructureStubInfo::initGetByIdSelf):
+ (JSC::StructureStubInfo::initGetByIdProto):
+ (JSC::StructureStubInfo::initGetByIdChain):
+ (JSC::StructureStubInfo::initGetByIdSelfList):
+ (JSC::StructureStubInfo::initGetByIdProtoList):
+ (JSC::StructureStubInfo::initPutByIdTransition):
+ (JSC::StructureStubInfo::initPutByIdReplace):
+ (JSC::StructureStubInfo::seenOnce):
+ (JSC::StructureStubInfo::setSeen):
+ - Make StructureStubInfo store the type as an integer, rather than an OpcodeID, add a flag to track when an op has been executed once.
+
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::emitGetById):
+ (JSC::BytecodeGenerator::emitPutById):
+ - Make StructureStubInfo store the type as an integer, rather than an OpcodeID.
+
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ (JSC::JIT::unlinkCall):
+ - Remove the "don't lazy link" stage of calls.
+
+ * jit/JIT.h:
+ (JSC::JIT::compileCTIMachineTrampolines):
+ - Remove the "don't lazy link" stage of calls.
+
+ * jit/JITCall.cpp:
+ (JSC::JIT::compileOpCallSlowCase):
+ - Remove the "don't lazy link" stage of calls.
+
+ * jit/JITStubs.cpp:
+ (JSC::JITThunks::JITThunks):
+ (JSC::JITThunks::tryCachePutByID):
+ (JSC::JITThunks::tryCacheGetByID):
+ (JSC::JITStubs::DEFINE_STUB_FUNCTION):
+ (JSC::JITStubs::getPolymorphicAccessStructureListSlot):
+ - Remove the "don't lazy link" stage of calls, and the "_second" stage of get_by_id/put_by_id/method_check.
+
+ * jit/JITStubs.h:
+ (JSC::JITThunks::ctiStringLengthTrampoline):
+ (JSC::JITStubs::):
+ - Remove the "don't lazy link" stage of calls, and the "_second" stage of get_by_id/put_by_id/method_check.
+
+ * wtf/PtrAndFlags.h:
+ (WTF::PtrAndFlags::PtrAndFlags):
+ (WTF::PtrAndFlags::operator!):
+ (WTF::PtrAndFlags::operator->):
+ - Add ! and -> operators, add constuctor with pointer argument.
+
+2009-07-30 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Fixed failing tests seen on Windows buildbot.
+
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+ * jit/JITStubs.h:
+ (JSC::): Use "int" instead of "bool" to guarantee a 32-bit result,
+ regardless of compiler. gcc on mac uses 32-bit values for bool,
+ but gcc on linux and MSVC on Windows use 8-bit values.
+
+2009-07-30 Geoffrey Garen <ggaren@apple.com>
+
+ Windows build fix: added missing symbols on Windows.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-07-30 Geoffrey Garen <ggaren@apple.com>
+
+ Windows build fix: removed stale symbols on Windows.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+=== End merge of nitro-extreme branch 2009-07-30 ===
+
+2009-07-20 Geoffrey Garen <ggaren@apple.com>
+
+ Fixed a post-review typo in r46066 that caused tons of test failures.
+
+ SunSpider reports no change.
+
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::JSArray): Initialize the full vector capacity, to avoid
+ uninitialized members at the end.
+
+2009-07-20 Geoffrey Garen <ggaren@apple.com>
+
+ Windows WebKit build fix: Added some missing exports.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-07-17 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Get the branch working on windows.
+ https://bugs.webkit.org/show_bug.cgi?id=27391
+
+ SunSpider says 0.3% faster.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: Updated
+ MSVC export lists to fix linker errors.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Added / removed
+ new / old project files.
+
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileCTIMachineTrampolines): Used #pragma pack to tell
+ MSVC that these structures represent actual memory layout, and should not be
+ automatically aligned. Changed the return value load to load a 64bit quantity
+ into the canonical registers.
+
+ * jit/JIT.h: Moved OBJECT_OFFSETOF definition to StdLibExtras.h because
+ it's needed by more than just the JIT, and it supplements a standard library
+ macro (offsetof).
+
+ * jit/JITCall.cpp:
+ (JSC::JIT::compileOpCallInitializeCallFrame): Fixed an incorrectly signed
+ cast to resolve an MSVC warning.
+
+ * jit/JITStubs.h: Used #pragma pack to tell MSVC that these structures
+ represent actual memory layout, and should not be automatically aligned.
+
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::JSArray): Replaced memset_pattern8 with a for loop, since
+ memset_pattern8 is not portable. (I verified that this version of the loop
+ gives the best performance / generated code in GCC.)
+
+ * runtime/JSObject.h:
+ (JSC::JSObject::JSObject): Removed accidental usage of FIELD_OFFSET --
+ OBJECT_OFFSETOF is our new macro name. (FIELD_OFFSET conflicts with a
+ definition in winnt.h.)
+
+ * runtime/JSValue.cpp: Added some headers needed by non-all-in-one builds.
+
+ * runtime/JSValue.h:
+ (JSC::JSValue::): Made the tag signed, to match MSVC's signed enum values.
+ (GCC doesn't seem to care one way or the other.)
+
+ * wtf/MainThread.cpp: Moved the StdLibExtras.h #include -- I did this a
+ while ago to resolve a conflict with winnt.h. I can't remember if it's truly
+ still needed, but what the heck.
+
+ * wtf/StdLibExtras.h: Moved OBJECT_OFFSETOF definition here.
+
+2009-07-06 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig (?).
+
+ Fixed an assertion seen during the stress test.
+
+ Don't assume that, if op1 is constant, op2 is not, and vice versa. Sadly,
+ not all constants get folded.
+
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emit_op_jnless):
+ (JSC::JIT::emitSlow_op_jnless):
+ (JSC::JIT::emit_op_jnlesseq):
+ (JSC::JIT::emitSlow_op_jnlesseq):
+
+2009-07-06 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Include op_convert_this in result caching.
+
+ No change on SunSpider or v8.
+
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_convert_this):
+
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+ * jit/JITStubs.h:
+ (JSC::): Made the op_convert_this JIT stub return an EncodedJSValue, so
+ to maintain the result caching contract that { tag, payload } can be
+ found in { regT1, regT0 }.
+
+2009-07-06 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Implemented result chaining.
+
+ 1% faster on SunSpider. 4%-5% faster on v8.
+
+ * assembler/MacroAssemblerX86Common.h:
+ (JSC::MacroAssemblerX86Common::move):
+ * assembler/X86Assembler.h:
+ (JSC::X86Assembler::movl_rr): Added an optimization to eliminate
+ no-op mov instructions, to simplify chaining.
+
+ * jit/JIT.cpp:
+ (JSC::JIT::JIT):
+ * jit/JIT.h: Added data members and helper functions for recording
+ chained results. We record both a mapping from virtual to machine register
+ and the opcode for which the mapping is valid, to help ensure that the
+ mapping isn't used after the mapped register has been stomped by other
+ instructions.
+
+ * jit/JITCall.cpp:
+ (JSC::JIT::compileOpCallVarargs):
+ (JSC::JIT::compileOpCallVarargsSlowCase):
+ (JSC::JIT::emit_op_ret):
+ (JSC::JIT::emit_op_construct_verify):
+ (JSC::JIT::compileOpCall):
+ (JSC::JIT::compileOpCallSlowCase): Chain function call results.
+
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::emitLoadTag):
+ (JSC::JIT::emitLoadPayload):
+ (JSC::JIT::emitLoad):
+ (JSC::JIT::emitLoad2):
+ (JSC::JIT::isLabeled):
+ (JSC::JIT::map):
+ (JSC::JIT::unmap):
+ (JSC::JIT::isMapped):
+ (JSC::JIT::getMappedPayload):
+ (JSC::JIT::getMappedTag): Use helper functions when loading virtual
+ registers into machine registers, in case the loads can be eliminated
+ by chaining.
+
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_mov):
+ (JSC::JIT::emit_op_end):
+ (JSC::JIT::emit_op_instanceof):
+ (JSC::JIT::emit_op_get_global_var):
+ (JSC::JIT::emit_op_put_global_var):
+ (JSC::JIT::emit_op_get_scoped_var):
+ (JSC::JIT::emit_op_put_scoped_var):
+ (JSC::JIT::emit_op_to_primitive):
+ (JSC::JIT::emit_op_resolve_global):
+ (JSC::JIT::emit_op_jneq_ptr):
+ (JSC::JIT::emit_op_next_pname):
+ (JSC::JIT::emit_op_to_jsnumber):
+ (JSC::JIT::emit_op_catch): Chain results from these opcodes.
+
+ (JSC::JIT::emit_op_profile_will_call):
+ (JSC::JIT::emit_op_profile_did_call): Load the profiler into regT2 to
+ avoid stomping a chained result.
+
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::emit_op_method_check):
+ (JSC::JIT::emit_op_get_by_val):
+ (JSC::JIT::emit_op_get_by_id): Chain results from these opcodes.
+
+ * jit/JITStubCall.h:
+ (JSC::JITStubCall::addArgument): Always use { regT1, regT0 }, to facilitate
+ chaining.
+
+ (JSC::JITStubCall::call): Unmap all mapped registers, since our callee
+ stub might stomp them.
+
+2009-07-01 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Gavin Barraclough.
+
+ Don't reload values in emitBinaryDoubleOp.
+
+ SunSpider reports a 0.6% progression.
+
+ * jit/JIT.h:
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emit_op_jnless):
+ (JSC::JIT::emit_op_jnlesseq):
+ (JSC::JIT::emitBinaryDoubleOp):
+
+2009-07-01 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ Convert op_div to load op1 and op2 up front.
+
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emit_op_div):
+
+2009-07-01 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ Don't emit code in emitBinaryDoubleOp if code is unreachable, observable
+ via an empty (unlinked) jumplist passed in. This only effects op_jnless
+ and op_jnlesseq at present.
+
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emitSlow_op_jnless):
+ (JSC::JIT::emitSlow_op_jnlesseq):
+ (JSC::JIT::emitBinaryDoubleOp):
+
+2009-07-01 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Converted op_mod to put { tag, payload } in { regT1, regT0 }, and
+ tidied up its constant case.
+
+ SunSpider reports a 0.2% regression, but a micro-benchmark of op_mod
+ shows a 12% speedup, and the SunSpider test that uses op_mod most should
+ benefit a lot from result caching in the end, since it almost always
+ performs (expression) % constant.
+
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emit_op_mod):
+ (JSC::JIT::emitSlow_op_mod):
+
+2009-06-30 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ Converted some more arithmetic ops to put { tag, payload } in
+ { regT1, regT0 }.
+
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emit_op_mul):
+ (JSC::JIT::emitSlow_op_mul):
+
+2009-06-30 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Converted some more arithmetic ops to put { tag, payload } in
+ { regT1, regT0 }, and added a case for subtract constant.
+
+ SunSpider says no change. v8 says 0.3% slower.
+
+ * jit/JIT.h:
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emit_op_add):
+ (JSC::JIT::emitAdd32Constant):
+ (JSC::JIT::emitSlow_op_add):
+ (JSC::JIT::emit_op_sub):
+ (JSC::JIT::emitSub32Constant):
+ (JSC::JIT::emitSlow_op_sub):
+
+2009-06-30 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Remove more uses of addressFor(), load double constants directly from
+ the constantpool in the CodeBlock, rather than from the register file.
+
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emitAdd32Constant):
+ (JSC::JIT::emitBinaryDoubleOp):
+
+2009-06-30 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Fixed a bug in postfix ops, where we would treat x = x++ and x = x--
+ as a no-op, even if x were not an int, and the ++/-- could have side-effects.
+
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emit_op_post_inc):
+ (JSC::JIT::emitSlow_op_post_inc):
+ (JSC::JIT::emit_op_post_dec):
+ (JSC::JIT::emitSlow_op_post_dec):
+
+2009-06-30 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Converted some arithmetic ops to put { tag, payload } in
+ { regT1, regT0 }.
+
+ SunSpider says 0.7% faster. v8 says no change.
+
+ * jit/JIT.h:
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emit_op_jnless):
+ (JSC::JIT::emit_op_jnlesseq):
+ (JSC::JIT::emit_op_lshift):
+ (JSC::JIT::emit_op_rshift):
+ (JSC::JIT::emit_op_bitand):
+ (JSC::JIT::emit_op_bitor):
+ (JSC::JIT::emit_op_bitxor):
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::isOperandConstantImmediateInt):
+ (JSC::JIT::getOperandConstantImmediateInt):
+
+2009-06-30 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Start removing cases of addressFor().
+
+ * jit/JIT.h:
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emitAdd32Constant):
+ (JSC::JIT::emitBinaryDoubleOp):
+ (JSC::JIT::emit_op_div):
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::emitLoadDouble):
+ (JSC::JIT::emitLoadInt32ToDouble):
+ (JSC::JIT::emitStoreDouble):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_jfalse):
+ (JSC::JIT::emit_op_jtrue):
+
+2009-06-30 Geoffrey Garen <ggaren@apple.com>
+
+ Rolled back in my last patch with regression fixed.
+
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileSlowCases):
+ * jit/JIT.h:
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_loop_if_less):
+ (JSC::JIT::emit_op_loop_if_lesseq):
+ (JSC::JIT::emit_op_resolve_global):
+ (JSC::JIT::emitSlow_op_resolve_global):
+ (JSC::JIT::emit_op_eq):
+ (JSC::JIT::emitSlow_op_eq):
+ (JSC::JIT::emit_op_neq):
+ (JSC::JIT::emitSlow_op_neq):
+
+2009-06-30 Geoffrey Garen <ggaren@apple.com>
+
+ Rolled out my last patch because it was a 2% SunSpider regression.
+
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileSlowCases):
+ * jit/JIT.h:
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_loop_if_less):
+ (JSC::JIT::emit_op_loop_if_lesseq):
+ (JSC::JIT::emit_op_resolve_global):
+ (JSC::JIT::emit_op_eq):
+ (JSC::JIT::emitSlow_op_eq):
+ (JSC::JIT::emit_op_neq):
+ (JSC::JIT::emitSlow_op_neq):
+
+2009-06-30 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Gavin "Sam Weinig" Barraclough.
+
+ Standardized the rest of our opcodes to put { tag, payload } in
+ { regT1, regT0 } where possible.
+
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileSlowCases):
+ * jit/JIT.h:
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_loop_if_less):
+ (JSC::JIT::emit_op_loop_if_lesseq):
+ (JSC::JIT::emit_op_resolve_global):
+ (JSC::JIT::emitSlow_op_resolve_global):
+ (JSC::JIT::emit_op_eq):
+ (JSC::JIT::emitSlow_op_eq):
+ (JSC::JIT::emit_op_neq):
+ (JSC::JIT::emitSlow_op_neq):
+
+2009-06-30 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ Replace calls to store32(tagFor()) and store32(payloadFor())
+ with emitStoreInt32(), emitStoreBool(), and emitStoreCell().
+
+ * jit/JIT.h:
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emit_op_negate):
+ (JSC::JIT::emit_op_lshift):
+ (JSC::JIT::emit_op_rshift):
+ (JSC::JIT::emit_op_bitand):
+ (JSC::JIT::emitBitAnd32Constant):
+ (JSC::JIT::emit_op_bitor):
+ (JSC::JIT::emitBitOr32Constant):
+ (JSC::JIT::emit_op_bitxor):
+ (JSC::JIT::emitBitXor32Constant):
+ (JSC::JIT::emit_op_bitnot):
+ (JSC::JIT::emit_op_post_inc):
+ (JSC::JIT::emit_op_post_dec):
+ (JSC::JIT::emit_op_pre_inc):
+ (JSC::JIT::emit_op_pre_dec):
+ (JSC::JIT::emit_op_add):
+ (JSC::JIT::emitAdd32Constant):
+ (JSC::JIT::emit_op_sub):
+ (JSC::JIT::emitSub32ConstantLeft):
+ (JSC::JIT::emitSub32ConstantRight):
+ (JSC::JIT::emit_op_mul):
+ (JSC::JIT::emitSlow_op_mul):
+ (JSC::JIT::emit_op_div):
+ (JSC::JIT::emit_op_mod):
+ * jit/JITCall.cpp:
+ (JSC::JIT::emit_op_load_varargs):
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::emitStoreInt32):
+ (JSC::JIT::emitStoreCell):
+ (JSC::JIT::emitStoreBool):
+ (JSC::JIT::emitStore):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_instanceof):
+ (JSC::JIT::emit_op_not):
+ (JSC::JIT::emit_op_eq):
+ (JSC::JIT::emitSlow_op_eq):
+ (JSC::JIT::emit_op_neq):
+ (JSC::JIT::emitSlow_op_neq):
+ (JSC::JIT::compileOpStrictEq):
+ (JSC::JIT::emit_op_eq_null):
+ (JSC::JIT::emit_op_neq_null):
+ * jit/JITStubCall.h:
+ (JSC::JITStubCall::call):
+
+2009-06-30 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Standardized the rest of the property access instructions to put { tag,
+ payload } in { regT1, regT0 }.
+
+ Small v8 speedup, 0.2% SunSpider slowdown.
+
+ * jit/JIT.h:
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::emitLoad):
+ (JSC::JIT::emitLoad2):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::emit_op_get_by_val):
+ (JSC::JIT::emitSlow_op_get_by_val):
+ (JSC::JIT::emit_op_put_by_val):
+ (JSC::JIT::emitSlow_op_put_by_val):
+ (JSC::JIT::emit_op_put_by_id):
+ (JSC::JIT::emitSlow_op_put_by_id):
+ (JSC::JIT::patchPutByIdReplace):
+
+2009-06-29 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Gavin Barraclough.
+
+ Various cleanups.
+ - Use fpRegT* instead of X86::xmm*.
+ - Use a switch statement in emitBinaryDoubleOp instead of a bunch of
+ if/elses.
+
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emitAdd32Constant):
+ (JSC::JIT::emitBinaryDoubleOp):
+ (JSC::JIT::emit_op_div):
+
+2009-06-29 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ Add inline code dealing with doubles for op_jfalse and op_jtrue.
+
+ * assembler/MacroAssemblerX86Common.h:
+ (JSC::MacroAssemblerX86Common::):
+ (JSC::MacroAssemblerX86Common::zeroDouble):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_jfalse):
+ (JSC::JIT::emit_op_jtrue):
+
+2009-06-28 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Standardized op_get_by_id to put { tag, payload } in { regT1, regT0 }.
+
+ SunSpider and v8 report maybe 0.2%-0.4% regressions, but the optimization
+ this enables will win much more than that back.
+
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ * jit/JIT.h:
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::emit_op_method_check):
+ (JSC::JIT::emit_op_get_by_id):
+ (JSC::JIT::compileGetByIdHotPath):
+ (JSC::JIT::compileGetByIdSlowCase):
+ (JSC::JIT::patchGetByIdSelf):
+ (JSC::JIT::privateCompilePatchGetArrayLength):
+ (JSC::JIT::privateCompileGetByIdProto):
+ (JSC::JIT::privateCompileGetByIdSelfList):
+ (JSC::JIT::privateCompileGetByIdProtoList):
+ (JSC::JIT::privateCompileGetByIdChainList):
+ (JSC::JIT::privateCompileGetByIdChain):
+
+2009-06-26 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Standardized op_call to put { tag, payload } in { regT1, regT0 }.
+
+ SunSpider and v8 report no change.
+
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ * jit/JITCall.cpp:
+ (JSC::JIT::compileOpCallInitializeCallFrame):
+ (JSC::JIT::compileOpCallSetupArgs):
+ (JSC::JIT::compileOpConstructSetupArgs):
+ (JSC::JIT::compileOpCallVarargsSetupArgs):
+ (JSC::JIT::compileOpCallVarargs):
+ (JSC::JIT::compileOpCall):
+ (JSC::JIT::compileOpCallSlowCase):
+
+2009-06-26 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ Handle multiplying by zero a little better by
+ inlining the case that both operands are non-negative
+ into the slowpath.
+
+ * assembler/MacroAssemblerX86Common.h:
+ (JSC::MacroAssemblerX86Common::branchOr32):
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emit_op_mul):
+ (JSC::JIT::emitSlow_op_mul):
+
+2009-06-25 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Optimize x++ to ++x inside for loops.
+
+ Sadly, no measurable speedup, but this should help with result chaining.
+
+ * parser/Nodes.cpp:
+ (JSC::ForNode::emitBytecode):
+
+2009-06-25 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Standardized some more opcodes to put { tag, payload } in { regT1, regT0 }.
+
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emitSlow_op_bitnot):
+ (JSC::JIT::emit_op_post_inc):
+
+2009-06-25 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Standardized some more opcodes to put { tag, payload } in { regT1, regT0 }.
+
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emit_op_bitnot):
+ (JSC::JIT::emit_op_post_dec):
+ (JSC::JIT::emit_op_pre_inc):
+ (JSC::JIT::emitSlow_op_pre_inc):
+ (JSC::JIT::emit_op_pre_dec):
+ (JSC::JIT::emitSlow_op_pre_dec):
+
+2009-06-25 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Standardized some more opcodes to put { tag, payload } in { regT1, regT0 }.
+
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emit_op_negate):
+ (JSC::JIT::emitSlow_op_negate):
+ * jit/JITCall.cpp:
+ (JSC::JIT::emit_op_construct_verify):
+ (JSC::JIT::emitSlow_op_construct_verify):
+
+2009-06-25 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Standardized some more opcodes to put { tag, payload } in { regT1, regT0 }.
+
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_loop_if_true):
+ (JSC::JIT::emit_op_jfalse):
+ (JSC::JIT::emit_op_jtrue):
+ (JSC::JIT::emit_op_jeq_null):
+ (JSC::JIT::emit_op_jneq_null):
+ (JSC::JIT::emit_op_eq_null):
+ (JSC::JIT::emit_op_neq_null):
+
+2009-06-25 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig (sort of, maybe).
+
+ Fixed some ASSERTs in http/tests/security.
+
+ These ASSERTs were introduced by http://trac.webkit.org/changeset/45057,
+ but the underlying problem was actually older. http://trac.webkit.org/changeset/45057
+ just exposed the problem by enabling optimization in more cases.
+
+ The ASSERTs fired because we tested PropertySlot::slotBase() for validity,
+ but slotBase() ASSERTs if it's invalid, so we would ASSERT before
+ the test could happen. Solution: Remove the ASSERT. Maybe it was valid
+ once, but it clearly goes against a pattern we've deployed of late.
+
+ The underlying problem was that WebCore would re-use a PropertySlot in
+ the case of a forwarding access, and the second use would not completely
+ overwrite the first use. Solution: Make sure to overwrite m_offset when
+ setting a value on a PropertySlot. (Other values already get implicitly
+ overwritten during reuse.)
+
+ * runtime/PropertySlot.h:
+ (JSC::PropertySlot::PropertySlot):
+ (JSC::PropertySlot::setValueSlot):
+ (JSC::PropertySlot::setValue):
+ (JSC::PropertySlot::setRegisterSlot):
+ (JSC::PropertySlot::setUndefined):
+ (JSC::PropertySlot::slotBase):
+ (JSC::PropertySlot::clearOffset):
+
+2009-06-24 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Enable JIT_OPTIMIZE_METHOD_CALLS on the branch, implementation matches current implemenatation in ToT.
+
+ * jit/JIT.h:
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::emit_op_method_check):
+ (JSC::JIT::emitSlow_op_method_check):
+ (JSC::JIT::emit_op_get_by_id):
+ (JSC::JIT::compileGetByIdHotPath):
+ (JSC::JIT::emitSlow_op_get_by_id):
+ (JSC::JIT::compileGetByIdSlowCase):
+
+2009-06-23 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Bit off a tiny bit more of standardizing opcode behavior to help with result
+ caching.
+
+ SunSpider reports no change, v8 maybe a tiny speedup.
+
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_to_jsnumber):
+ (JSC::JIT::emitSlow_op_to_jsnumber):
+ (JSC::JIT::emit_op_convert_this):
+ (JSC::JIT::emitSlow_op_convert_this):
+
+2009-06-23 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Bit off a tiny bit more of standardizing opcode behavior to help with result
+ caching -- including removing my old enemy, op_resolve_function, because
+ it was non-standard, and removing it felt better than helping it limp along.
+
+ SunSpider reports no change, v8 maybe a tiny speedup.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::dump):
+ * bytecode/Opcode.h:
+ * bytecompiler/BytecodeGenerator.cpp:
+ * bytecompiler/BytecodeGenerator.h:
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ * jit/JIT.h:
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_get_scoped_var):
+ (JSC::JIT::emit_op_put_scoped_var):
+ (JSC::JIT::emit_op_to_primitive):
+ (JSC::JIT::emitSlow_op_to_primitive):
+ * jit/JITStubs.cpp:
+ * jit/JITStubs.h:
+ * parser/Nodes.cpp:
+ (JSC::FunctionCallResolveNode::emitBytecode):
+
+2009-06-23 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Bit off a tiny bit of standardizing opcode behavior to help with result
+ caching.
+
+ 0.6% SunSpider speedup. 0.3% v8 speedup.
+
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::emitLoad): Accomodate a base register that overlaps with payload
+ by loading tag before payload, to avoid stomping base/payload.
+
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_mov): Abide by the standard "tag in regT1, payload in
+ regT0" semantics.
+
+ (JSC::JIT::emit_op_get_global_var):
+ (JSC::JIT::emit_op_put_global_var): Ditto. Also, removed some irrelevent
+ loads while I was at it. The global object's "d" pointer never changes
+ after construction.
+
+2009-06-23 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Remove 'arguments' field from Register union (again).
+ This time do so without breaking tests (radical, I know).
+
+ * interpreter/CallFrame.h:
+ (JSC::ExecState::optionalCalleeArguments):
+ (JSC::ExecState::setArgumentCount):
+ (JSC::ExecState::init):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::dumpRegisters):
+ (JSC::Interpreter::unwindCallFrame):
+ (JSC::Interpreter::privateExecute):
+ (JSC::Interpreter::retrieveArguments):
+ * interpreter/Register.h:
+ (JSC::Register::withInt):
+ (JSC::Register::):
+ (JSC::Register::Register):
+ (JSC::Register::i):
+ * jit/JITStubs.cpp:
+ (JSC::JITStubs::cti_op_tear_off_arguments):
+ * runtime/Arguments.h:
+ (JSC::JSActivation::copyRegisters):
+ (JSC::Register::arguments):
+ * runtime/JSActivation.cpp:
+ (JSC::JSActivation::argumentsGetter):
+ * runtime/JSActivation.h:
+
+2009-06-23 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Removed some result register tracking cruft in preparation for a new
+ result tracking mechanism.
+
+ SunSpider reports no change.
+
+ * assembler/AbstractMacroAssembler.h:
+ * assembler/X86Assembler.h:
+ (JSC::X86Assembler::JmpDst::JmpDst): No need to track jump targets in
+ machine code; we already do this in bytecode.
+
+ * jit/JIT.cpp:
+ (JSC::JIT::JIT):
+ (JSC::JIT::emitTimeoutCheck): Make sure to save and restore the result
+ registers, so an opcode with a timeout check can still benefit from result
+ register caching.
+
+ (JSC::JIT::privateCompileMainPass):
+ (JSC::JIT::privateCompileSlowCases): Removed calls to killLastResultRegister()
+ in preparation for something new.
+
+ * jit/JIT.h:
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emit_op_jnless):
+ (JSC::JIT::emit_op_jnlesseq):
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::emitGetFromCallFrameHeaderPtr):
+ (JSC::JIT::emitGetFromCallFrameHeader32):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_jmp):
+ (JSC::JIT::emit_op_jfalse):
+ (JSC::JIT::emit_op_jtrue):
+ (JSC::JIT::emit_op_jeq_null):
+ (JSC::JIT::emit_op_jneq_null):
+ (JSC::JIT::emit_op_jneq_ptr):
+ (JSC::JIT::emit_op_jsr):
+ (JSC::JIT::emit_op_sret):
+ (JSC::JIT::emit_op_jmp_scopes): ditto
+
+ * jit/JITStubCall.h:
+ (JSC::JITStubCall::JITStubCall):
+ (JSC::JITStubCall::getArgument): added a mechanism for reloading an argument
+ you passed to a JIT stub, for use in emitTimeoutCheck.
+
+2009-06-23 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ Remove now-useless inplace variants of binary ops.
+
+ * jit/JIT.h:
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emit_op_bitand):
+ (JSC::JIT::emit_op_bitor):
+ (JSC::JIT::emit_op_bitxor):
+ (JSC::JIT::emit_op_add):
+ (JSC::JIT::emit_op_sub):
+ (JSC::JIT::emit_op_mul):
+
+2009-06-23 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ Move off memory operands to aid in re-enabling result caching.
+
+ - No regression measured.
+
+ * jit/JIT.h:
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emit_op_negate):
+ (JSC::JIT::emit_op_jnless):
+ (JSC::JIT::emit_op_jnlesseq):
+ (JSC::JIT::emit_op_lshift):
+ (JSC::JIT::emit_op_rshift):
+ (JSC::JIT::emit_op_bitand):
+ (JSC::JIT::emitBitAnd32Constant):
+ (JSC::JIT::emitBitAnd32InPlace):
+ (JSC::JIT::emit_op_bitor):
+ (JSC::JIT::emitBitOr32Constant):
+ (JSC::JIT::emitBitOr32InPlace):
+ (JSC::JIT::emit_op_bitxor):
+ (JSC::JIT::emitBitXor32Constant):
+ (JSC::JIT::emitBitXor32InPlace):
+ (JSC::JIT::emit_op_bitnot):
+ (JSC::JIT::emit_op_post_inc):
+ (JSC::JIT::emit_op_post_dec):
+ (JSC::JIT::emit_op_pre_inc):
+ (JSC::JIT::emitSlow_op_pre_inc):
+ (JSC::JIT::emit_op_pre_dec):
+ (JSC::JIT::emitSlow_op_pre_dec):
+ (JSC::JIT::emit_op_add):
+ (JSC::JIT::emitAdd32Constant):
+ (JSC::JIT::emitAdd32InPlace):
+ (JSC::JIT::emitSlow_op_add):
+ (JSC::JIT::emitSlowAdd32Constant):
+ (JSC::JIT::emit_op_sub):
+ (JSC::JIT::emitSlow_op_sub):
+ (JSC::JIT::emitSub32ConstantLeft):
+ (JSC::JIT::emitSub32ConstantRight):
+ (JSC::JIT::emitSub32InPlaceLeft):
+ (JSC::JIT::emitSub32InPlaceRight):
+ (JSC::JIT::emitBinaryDoubleOp):
+ (JSC::JIT::emit_op_mul):
+ (JSC::JIT::emitMul32InPlace):
+ (JSC::JIT::emit_op_div):
+ (JSC::JIT::emit_op_mod):
+ * jit/JITCall.cpp:
+ (JSC::JIT::compileOpCallVarargs):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_loop_if_less):
+ (JSC::JIT::emit_op_loop_if_lesseq):
+ (JSC::JIT::emit_op_instanceof):
+ (JSC::JIT::emit_op_to_primitive):
+ (JSC::JIT::emit_op_not):
+ (JSC::JIT::emit_op_jneq_ptr):
+ (JSC::JIT::emit_op_eq):
+ (JSC::JIT::emit_op_neq):
+ (JSC::JIT::emit_op_to_jsnumber):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::emit_op_get_by_val):
+ (JSC::JIT::emit_op_put_by_val):
+
+2009-06-23 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Fixed some missing and/or misplaced labels in bytecode generation, so
+ we don't have to work around them in JIT code generation.
+
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::emitJumpSubroutine):
+ * parser/Nodes.cpp:
+ (JSC::TryNode::emitBytecode):
+
+2009-06-22 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ For member function calls, emit "this" directly into the "this" slot
+ for the function call, instead of moving it there later. This reduces
+ time spent in op_mov during certain calls, like "a.b.c()".
+
+ 1%-2% speedup on v8, mostly richards and delta-blue.
+
+ * parser/Nodes.cpp:
+ (JSC::FunctionCallDotNode::emitBytecode):
+
+2009-06-22 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Remove 'arguments' field from Register union. Having JSCell derived types in the union is
+ dangerous since it opens the possibility for the field to be written as a raw pointer but
+ then read as a JSValue. This will lead to statle data being read for the tag, which may
+ be dangerous. Having removed Arguments* types form Register, all arguments objects must
+ always explicitly be stored in the register file as JSValues.
+
+ * interpreter/CallFrame.h:
+ (JSC::ExecState::optionalCalleeArguments):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::unwindCallFrame):
+ (JSC::Interpreter::privateExecute):
+ (JSC::Interpreter::retrieveArguments):
+ * interpreter/Register.h:
+ (JSC::Register::):
+ * jit/JITStubs.cpp:
+ (JSC::JITStubs::cti_op_tear_off_arguments):
+ * runtime/Arguments.h:
+ (JSC::JSActivation::copyRegisters):
+ * runtime/JSActivation.cpp:
+ (JSC::JSActivation::argumentsGetter):
+ * runtime/JSActivation.h:
+
+2009-06-03 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ Add back known this value optimization by abstracting
+ slow case if not JSCell jumps.
+
+ * jit/JIT.h:
+ * jit/JITCall.cpp:
+ (JSC::JIT::compileOpCallVarargs):
+ (JSC::JIT::compileOpCallVarargsSlowCase):
+ (JSC::JIT::compileOpCall):
+ (JSC::JIT::compileOpCallSlowCase):
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::emitJumpSlowCaseIfNotJSCell):
+ (JSC::JIT::linkSlowCaseIfNotJSCell):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_instanceof):
+ (JSC::JIT::emitSlow_op_instanceof):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::emit_op_get_by_val):
+ (JSC::JIT::emitSlow_op_get_by_val):
+ (JSC::JIT::emit_op_put_by_val):
+ (JSC::JIT::emitSlow_op_put_by_val):
+ (JSC::JIT::emit_op_get_by_id):
+ (JSC::JIT::emitSlow_op_get_by_id):
+ (JSC::JIT::emit_op_put_by_id):
+ (JSC::JIT::emitSlow_op_put_by_id):
+
+2009-06-01 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Fixed some of the regression in crypto-aes.js. (8.5% speedup in
+ crypto-aes.js.)
+
+ SunSpider reports no change overall.
+
+ Division was producing double results, which took the slow path through
+ array access code.
+
+ Strangely, all my attempts at versions of this patch that modified array
+ access code to accept ints encoded as doubles along the fast or slow paths
+ were regressions. So I did this instead.
+
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emit_op_div): When dividing an int by an int, go ahead and try
+ to turn the result into an int. Don't just do int division, though, because
+ testing shows it to be slower than SSE double division, and the corner
+ cases are pretty complicated / lengthy on top of that. Also, don't try
+ to canonicalize division of known tiny numerators into ints, since that's a
+ waste of time.
+
+2009-05-26 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Fixed a regression caused by my recent fix for NaN.
+
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emitBinaryDoubleOp): Actually do the comparison in reverse
+ order, like the ChangeLog said we would, bokay?
+
+2009-05-26 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig and Oliver Hunt.
+
+ Fixed two edge cases in %:
+
+ - Don't do -2147483648 % x as a fast case, since you might do -2147483648 % -1,
+ which will signal a hardware exception due to overflow.
+
+ - In the case of a zero remainder, be sure to store negative zero if the
+ dividend was zero.
+
+ SunSpider reports no change.
+
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emit_op_mod):
+ (JSC::JIT::emitSlow_op_mod):
+
+2009-05-25 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Fixed a regression when comparing to NaN.
+
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emitBinaryDoubleOp): For op_jnless and op_jnless_eq, do the
+ comparison in reverse order, and jump if the result is below or
+ below-or-equal. This ensures that we do jump in the case of NaN.
+
+2009-05-25 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ SunSpider says no change.
+
+ Fixed regressions in fast/js/var-declarations-shadowing.html and
+ fast/js/equality.html, caused by recent == and != optimizations.
+
+ * jit/JITStubs.cpp:
+ (JSC::JITStubs::cti_op_eq): Don't treat "compare to string" as always
+ numeric or string comparison. If the second operand is an object, you
+ need to ToPrimitive it, and start all over again. Also, I wrote out each
+ of the possible cases explicitly, to cut down on redundant branching.
+
+2009-05-25 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Mark Rowe.
+
+ Fix bug in fast/js/constant-folding.html where we were not negating
+ -0 properly.
+
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emit_op_negate):
+
+2009-05-23 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Refactored new slow case codegen for == and !=.
+
+ SunSpider reports no change, maybe a tiny speedup.
+
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emitSlow_op_eq):
+ (JSC::JIT::emitSlow_op_neq): Made a vptr comparison a *Ptr operation,
+ instead of *32, to make it portable to 64bit. Reorganized the string
+ and generic cases to make their control flow a little clearer.
+
+2009-05-23 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Optimized == and != for our new value representation -- especially for strings.
+
+ 14% speedup on date-format-tofte.
+
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_eq):
+ (JSC::JIT::emitSlow_op_eq):
+ (JSC::JIT::emit_op_neq):
+ (JSC::JIT::emitSlow_op_neq):
+ * jit/JITStubCall.h:
+ (JSC::JITStubCall::JITStubCall):
+ * jit/JITStubs.cpp:
+ (JSC::JITStubs::cti_op_eq):
+ (JSC::JITStubs::cti_op_eq_strings):
+ (JSC::JITStubs::cti_op_call_eval):
+ * jit/JITStubs.h:
+ (JSC::):
+ * runtime/JSValue.h:
+
+2009-05-22 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Gavin Barraclough.
+
+ Fix non-SSE enabled builds.
+
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emitSlow_op_add): Don't early return here, we still need to call the JIT stub.
+ (JSC::JIT::emitSlow_op_sub): Ditto.
+
+2009-05-22 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Here's a thought: let's not take a jit stub call just to multiply by 1,
+ bokay?
+
+ imul doesn't set the zero flag, so to test for a zero result, we need
+ an explicit instruction. (Luckily, it does set the overflow flag, so
+ we can still use that.)
+
+ * jit/JIT.h:
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emit_op_mul):
+ (JSC::JIT::emitSlow_op_mul):
+ (JSC::JIT::emitMul32InPlace):
+
+2009-05-22 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey "Premature Commit" Garen.
+
+ Add back constant integer cases for op_add.
+
+ * jit/JIT.h:
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emit_op_add):
+ (JSC::JIT::emitAdd32Constant):
+ (JSC::JIT::emitSlow_op_add):
+ (JSC::JIT::emitSlowAdd32Constant):
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::getConstantOperandImmediateDouble):
+ (JSC::JIT::isOperandConstantImmediateDouble):
+
+2009-05-22 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Added fast double cases for op_jnless and op_jnlesseq.
+
+ * assembler/AbstractMacroAssembler.h:
+ (JSC::AbstractMacroAssembler::JumpList::jumps): New accesor, used by
+ addSlowCase.
+
+ * assembler/X86Assembler.h:
+ (JSC::X86Assembler::ucomisd_rm): New method for comparing register to
+ memory.
+
+ * jit/JIT.h:
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emit_op_jnless):
+ (JSC::JIT::emitSlow_op_jnless):
+ (JSC::JIT::emit_op_jnlesseq):
+ (JSC::JIT::emitSlow_op_jnlesseq):
+ (JSC::JIT::emit_op_add):
+ (JSC::JIT::emit_op_sub):
+ (JSC::JIT::emitBinaryDoubleOp):
+ (JSC::JIT::emit_op_mul):
+ (JSC::JIT::emit_op_div): Modified emitBinaryDoubleOp to accept comparison/jump
+ operations in addition to operations with explicit result registers.
+
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::addSlowCase): Added an "addSlowCase" for JumpLists, so clients
+ can track multiple jumps to the same slow case condition together.
+
+2009-05-21 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Gavin Barraclough.
+
+ Implement op_negate inline fast cases.
+
+ * assembler/MacroAssemblerX86Common.h:
+ (JSC::MacroAssemblerX86Common::neg32):
+ * assembler/X86Assembler.h:
+ (JSC::X86Assembler::):
+ (JSC::X86Assembler::negl_m):
+ (JSC::X86Assembler::xorpd_rr):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ (JSC::JIT::privateCompileSlowCases):
+ * jit/JIT.h:
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emit_op_negate):
+ (JSC::JIT::emitSlow_op_negate):
+
+2009-05-20 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Gavin Barraclough.
+
+ Update the patchOffsetGetByIdSlowCaseCall constant for the
+ case that OPCODE_SAMPLING is enabled.
+
+ * jit/JIT.h:
+
+2009-05-20 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Added support for inline subtraction of doubles.
+
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emit_op_sub):
+ (JSC::JIT::emitSlow_op_sub):
+ (JSC::JIT::emitSlowSub32InPlaceLeft):
+ (JSC::JIT::emitBinaryDoubleOp):
+
+2009-05-20 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ Added support for inline division.
+
+ * assembler/X86Assembler.h:
+ (JSC::X86Assembler::):
+ (JSC::X86Assembler::divsd_rr):
+ (JSC::X86Assembler::divsd_mr):
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::dump):
+ * bytecode/Opcode.h:
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::emitBinaryOp):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ (JSC::JIT::privateCompileSlowCases):
+ * jit/JIT.h:
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emitBinaryDoubleOp):
+ (JSC::JIT::emit_op_div):
+ (JSC::JIT::emitSlow_op_div):
+
+2009-05-20 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Added support for inline addition of doubles.
+
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emit_op_add):
+ (JSC::JIT::emitSlow_op_add):
+ (JSC::JIT::emitSlowAdd32InPlace):
+ (JSC::JIT::emitBinaryDoubleOp):
+ (JSC::JIT::emit_op_mul):
+ (JSC::JIT::emitSlow_op_mul):
+
+2009-05-20 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Factored inline double operations into a helper function, so that we
+ can reuse this code for other math operations.
+
+ * jit/JIT.h:
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emitBinaryDoubleOp):
+ (JSC::JIT::emit_op_mul):
+ * jit/JITCall.cpp:
+ (JSC::JIT::compileOpCallInitializeCallFrame):
+
+2009-05-20 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Added support for inline multiplication of doubles.
+
+ * assembler/X86Assembler.h:
+ (JSC::X86Assembler::cvtsi2sd_mr): New function, useful for loading an
+ int32 into a double register.
+
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emit_op_mul):
+ (JSC::JIT::emitSlow_op_mul): Filled out these cases for double arithmetic.
+
+ * jit/JIT.h:
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::addressFor): New function, useful for addressing a JSValue's
+ full 64bits as a double.
+
+2009-05-19 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ Implement and enable optimized calls.
+
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileCTIMachineTrampolines): Add ENABLE(JIT_OPTIMIZE_CALL) guards
+ around the the optimize call only trampolines (virtualCallPreLink and virtualCallLink).
+ Update the trampolines to account for the new JSValue representation.
+ (JSC::JIT::unlinkCall): Use NULL instead of JSValue noValue.
+
+ * jit/JITCall.cpp:
+ (JSC::JIT::compileOpCall): Update to account for the new JSValue representation
+ (JSC::JIT::compileOpCallSlowCase): Ditto.
+
+ * jit/JITStubs.h: Remove incorrect !ENABLE(JIT_OPTIMIZE_CALL) guard.
+
+ * wtf/Platform.h: Enable ENABLE_JIT_OPTIMIZE_CALL.
+
+2009-05-19 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ Implement and enable optimized property access.
+
+ * assembler/AbstractMacroAssembler.h: Fix comment.
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileCTIMachineTrampolines): Remove array length trampoline
+ and implement the string length trampoline.
+ * jit/JIT.h: Add new constants for patch offsets.
+ * jit/JITInlineMethods.h: Remove FIELD_OFFSET which is now in StdLibExtras.h.
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::emit_op_get_by_id):
+ (JSC::JIT::emitSlow_op_get_by_id):
+ (JSC::JIT::emit_op_put_by_id):
+ (JSC::JIT::emitSlow_op_put_by_id):
+ (JSC::JIT::compilePutDirectOffset):
+ (JSC::JIT::compileGetDirectOffset):
+ (JSC::JIT::privateCompilePutByIdTransition):
+ (JSC::JIT::patchGetByIdSelf):
+ (JSC::JIT::patchPutByIdReplace):
+ (JSC::JIT::privateCompilePatchGetArrayLength):
+ (JSC::JIT::privateCompileGetByIdProto):
+ (JSC::JIT::privateCompileGetByIdSelfList):
+ (JSC::JIT::privateCompileGetByIdProtoList):
+ (JSC::JIT::privateCompileGetByIdChainList):
+ (JSC::JIT::privateCompileGetByIdChain):
+ * jit/JITStubCall.h:
+ (JSC::JITStubCall::addArgument): Add version of addArgument that takes
+ two registers for the tag and payload.
+ * jit/JITStubs.cpp:
+ (JSC::JITStubs::JITStubs): Remove array length trampoline pointer.
+ (JSC::JITStubs::cti_op_get_by_id_self_fail):
+ * jit/JITStubs.h:
+ * runtime/JSObject.h:
+ (JSC::JSObject::JSObject): Move m_inheritorID below the property storage
+ to align it to a 16 byte boundary.
+ * wtf/Platform.h: Enable ENABLE_JIT_OPTIMIZE_PROPERTY_ACCESS
+ * wtf/StdLibExtras.h: Move FIELD_OFFSET here.
+
+2009-05-17 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ Remove unneeded ExecState parameter from the number JSValue constructors.
+
+ * runtime/JSValue.h:
+ (JSC::jsNumber):
+ (JSC::jsNaN):
+ (JSC::JSValue::JSValue):
+
+2009-05-15 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ Implemented fast path for op_put_by_val when putting to arrays.
+
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::emit_op_put_by_val):
+ (JSC::JIT::emitSlow_op_put_by_val):
+
+2009-05-15 Geoffrey Garen <ggaren@apple.com> (Mostly by Sam)
+
+ Reviewed by Sam Weinig.
+
+ Implemented fast path for op_get_by_val when accessing array.
+
+ * jit/JIT.cpp:
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::emit_op_get_by_val):
+ (JSC::JIT::emitSlow_op_get_by_val):
+
+2009-05-14 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Fixed a failure in fast/js/math-transforms.html caused by failing to
+ preserve -0 in multiplication.
+
+ * assembler/X86Assembler.h:
+ (JSC::X86Assembler::jz):
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emit_op_mul):
+ (JSC::JIT::emitSlow_op_mul):
+ (JSC::JIT::emitMul32Constant):
+ (JSC::JIT::emitMul32InPlace): Check both for overflow and for zero when
+ doing multiplication. Use a slow case to get these right.
+
+2009-05-14 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Fixed a bug in the varargs calling convention.
+
+ * jit/JITCall.cpp:
+ (JSC::JIT::compileOpCallVarargs): Move the argument count into regT1,
+ since that's where ctiVirtualCall expects it to be.
+
+2009-05-14 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Fixed a small bug in instanceof's looping code.
+
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_instanceof): NULL means the object has no prototype,
+ so only loop when *not* equal to NULL.
+
+2009-05-14 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Fixed a small bug in instanceof's result writing code.
+
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_instanceof): Make sure to fill out the payload bits
+ in all cases.
+
+2009-05-14 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ Removed an invalid assertion in cti_op_urshift which
+ depended on a fast path for op_urshift which has
+ never existed.
+
+ * jit/JITStubs.cpp:
+ (JSC::JITStubs::cti_op_urshift):
+
+2009-05-14 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Fixed loop_if_true, which had the same reversed test that jtrue had.
+
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_loop_if_true):
+
+2009-05-14 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ In op_neq, we apparently want to check that one value
+ does *not* equal another. Go figure.
+
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_neq):
+
+2009-05-14 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ The slow case of op_mod should call op_mod's jit stub,
+ not op_mul. That would be dumb.
+
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emitSlow_op_mod):
+
+2009-05-14 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Fixed problems when using 'arguments' due to a half-initialized register.
+
+ * interpreter/CallFrame.h:
+ (JSC::ExecState::setCalleeArguments):
+ (JSC::ExecState::init): Require a full JSValue when setting up the
+ 'arguments' virtual register, since this register is accessible from JIT
+ code and bytecode, and needs to be a true JSValue.
+
+ * interpreter/CallFrameClosure.h:
+ (JSC::CallFrameClosure::resetCallFrame): ditto
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute): ditto
+
+ * interpreter/Register.h: Removed the constructor that allowed assignment
+ of a JSArguments* to a register. That is not safe. See above.
+
+ * jit/JITStubs.cpp:
+ (JSC::JITStubs::cti_op_create_arguments):
+ (JSC::JITStubs::cti_op_create_arguments_no_params): ditto
+
+2009-05-14 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ We really want to go to the slow case in op_jfalse and
+ op_jtrue if the value is *not* boolean.
+
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_jfalse):
+ (JSC::JIT::emit_op_jtrue):
+
+2009-05-14 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ Flipped the condition when emitting a an op_loop_if_less or op_loop_if_lesseq
+ if the first operand is a constant.
+
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_loop_if_less):
+ (JSC::JIT::emit_op_loop_if_lesseq):
+
+2009-05-14 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ Added missing return in op_jnless and op_jnlesseq.
+
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emit_op_jnless):
+ (JSC::JIT::emit_op_jnlesseq):
+
+2009-05-14 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ Load constants into the the register file as a temporary measure to
+ aid bring up. This allows us to use to treat constants like any
+ other virtual register.
+
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_enter):
+ (JSC::JIT::emit_op_enter_with_activation):
+
+2009-05-14 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Implemented op_strict_eq. Original patch by Snowy, by way of Sam and Gavin.
+
+ * assembler/MacroAssemblerX86Common.h:
+ (JSC::MacroAssemblerX86Common::set8): Added set8, since it's slightly
+ faster than set32, and the new value representation usually doesn't
+ need set32.
+
+ * jit/JIT.cpp:
+ * jit/JIT.h:
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::emitLoadTag):
+ (JSC::JIT::emitLoadPayload): Added helper functions for dealing with
+ constants. Eventually, we should write special cases for all constants,
+ but these are helpful in the short term.
+
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::compileOpStrictEq):
+ (JSC::JIT::emitSlow_op_stricteq):
+ (JSC::JIT::emitSlow_op_nstricteq): teh opcodez.
+
+ * runtime/JSValue.h:
+ (JSC::JSValue::):
+ (JSC::JSValue::isDouble): Added a LowestTag for clarity.
+
+2009-05-13 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Fixed some bugs in host function calls.
+
+ testapi now passes!
+
+ * jit/JIT.cpp: Changed some registers around to avoid overwriting edx:eax,
+ which is how JSValues are now returned. Also changed the code that
+ passes thisValue to pass the full 64bits of the value. Also added
+ an #error compiler directive to other platform builds, since the JSValue
+ return signature probably won't return in edx:eax on those platforms,
+ and we'll have to investigate a solution.
+
+2009-05-13 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Removed parameters from functions that are intended never to use their
+ parameters.
+
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::emitSlow_op_get_by_val):
+ (JSC::JIT::emitSlow_op_put_by_val):
+
+2009-05-13 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Ported op_instance_of from TOT. It's basically the same, but some register
+ stuff changed to memory stuff.
+
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::emitPutJITStubArgFromVirtualRegister):
+ (JSC::JIT::emitStore): Changed to use helper functions.
+
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_instanceof):
+ (JSC::JIT::emitSlow_op_instanceof): Ported from TOT.
+
+2009-05-13 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Added a comment to explain an exception-handling subtelty that we found
+ hard to remember when reviewing my last patch.
+
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_catch):
+
+2009-05-13 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Implemented try/catch.
+
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_throw): Updated to use JITStackFrame abstraction.
+ (JSC::JIT::emit_op_catch): Filled out.
+
+2009-05-13 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ Implemented op_loop_if_true, op_jfalse, op_jtrue, op_jeq_null and op_jneq_null
+
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emitSlow_op_instanceof): Moved from below to be next to its
+ fast brother.
+
+ (JSC::JIT::emit_op_loop_if_true): Similar to the old version
+ in that it tries to do the integer case first and reduce the
+ number of jumps you might need to take.
+ (JSC::JIT::emitSlow_op_loop_if_true):
+
+ (JSC::JIT::emit_op_jfalse): Very similar to op_loop_if_true, only
+ the inverse and without a timeout check.
+ (JSC::JIT::emitSlow_op_jfalse):
+
+ (JSC::JIT::emit_op_jtrue): Very similar to op_loop_if_true except
+ without the timeout check.
+ (JSC::JIT::emitSlow_op_jtrue):
+
+ (JSC::JIT::emit_op_jeq_null): Very similar to the implementation
+ of op_eq, except it takes jumps instead of copying the condition
+ to a dst.
+ (JSC::JIT::emit_op_jneq_null): Ditto but for op_neq.
+
+2009-05-13 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Implemented op_call_varargs.
+
+ * jit/JITCall.cpp:
+ (JSC::JIT::compileOpCallVarargsSetupArgs):
+ (JSC::JIT::compileOpCallVarargs):
+ (JSC::JIT::emit_op_call):
+ (JSC::JIT::emit_op_call_eval):
+ (JSC::JIT::emit_op_load_varargs):
+ (JSC::JIT::emit_op_call_varargs):
+ (JSC::JIT::emit_op_construct):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_jneq_ptr):
+
+2009-05-13 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Implemented op_call_eval.
+
+ * jit/JITCall.cpp:
+ (JSC::JIT::compileOpCallVarargsSetupArgs):
+ (JSC::JIT::compileOpCall):
+ * jit/JITStubCall.h:
+ (JSC::CallEvalJITStub::CallEvalJITStub):
+
+2009-05-13 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Gavin Barraclough.
+
+ Implemented op_not. (Gavin did most of the work!)
+
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_not):
+ (JSC::JIT::emitSlow_op_not):
+
+2009-05-13 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Implemented op_global_resolve.
+
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_loop_if_less):
+ (JSC::JIT::emit_op_loop_if_lesseq): Added back accidentally removed
+ early returns.
+
+ (JSC::JIT::emit_op_resolve_global):
+ * jit/JITStubs.cpp:
+ (JSC::JITStubs::cti_op_resolve_global): Pretty similar to the old code,
+ but we need two reads and a TimesEight step in order to account for the
+ 64bit value size.
+
+ * jit/JITStubs.h:
+ (JSC::): Slightly tweaked this code to specialize for a JSGlobalObject*,
+ to avoid having to pass an irrelevant tag pointer to the stub.
+
+2009-05-13 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ Implemented op_to_jsnumber.
+
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_to_jsnumber):
+ (JSC::JIT::emitSlow_op_to_jsnumber):
+
+2009-05-13 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ Implemented op_convert_this.
+
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_convert_this):
+ (JSC::JIT::emitSlow_op_convert_this):
+
+2009-05-13 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Got basic JS function and constructor calls working.
+
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ * jit/JIT.h:
+ * jit/JITCall.cpp:
+ (JSC::JIT::compileOpCallSetupArgs):
+ (JSC::JIT::compileOpCallVarargsSetupArgs):
+ (JSC::JIT::compileOpConstructSetupArgs):
+ (JSC::JIT::emit_op_ret):
+ (JSC::JIT::emit_op_construct_verify):
+ (JSC::JIT::emitSlow_op_construct_verify):
+ (JSC::JIT::emitSlow_op_call):
+ (JSC::JIT::emitSlow_op_call_eval):
+ (JSC::JIT::emitSlow_op_call_varargs):
+ (JSC::JIT::emitSlow_op_construct):
+ (JSC::JIT::compileOpCall): Filled out these cases, with call_eval #if'd out.
+
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::emitPutJITStubArgFromVirtualRegister):
+ (JSC::JIT::emitLoad): Restored some legacy "*CTIArg*" functions,
+ since I wanted to avoid the complexity of revamping the API here while
+ trying to bring it up. Eventually, we should re-remove all of these functions.
+
+ (JSC::JIT::recordJumpTarget): Removed unnecessary macro cruft. You will
+ not silence me, Sam Weinig! The world will know that you are a crufty,
+ crufty, crufty programmer!!!
+
+ * jit/JITOpcodes.cpp:
+ * jit/JITStubs.cpp:
+ (JSC::):
+ * jit/JITStubs.h: Changed up some offsets in the JITStackFrame class, since
+ and off-by-one error was causing stack misalignment.
+
+2009-05-13 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ Implement op_eq_null and op_neq_null.
+
+ * assembler/MacroAssemblerX86Common.h:
+ (JSC::MacroAssemblerX86Common::set8):
+ (JSC::MacroAssemblerX86Common::setTest8):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_stricteq):
+ (JSC::JIT::emitSlow_op_stricteq):
+ (JSC::JIT::emit_op_nstricteq):
+ (JSC::JIT::emitSlow_op_nstricteq):
+ (JSC::JIT::emit_op_eq_null):
+ (JSC::JIT::emit_op_neq_null):
+ * jsc.cpp:
+
+2009-05-12 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ Implement op_new_error.
+
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_new_error):
+ * jit/JITStubCall.h:
+ (JSC::JITStubCall::addArgument): Add a version of addArgument
+ that takes a constant JSValue.
+
+2009-05-12 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ Remove now unused emitGetVariableObjectRegister and emitPutVariableObjectRegister.
+
+ * jit/JIT.cpp:
+ * jit/JIT.h:
+
+2009-05-12 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ Implement op_to_primitive and op_next_pname.
+
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emitSlow_op_construct_verify):
+ (JSC::JIT::emit_op_to_primitive):
+ (JSC::JIT::emitSlow_op_to_primitive):
+ (JSC::JIT::emitSlow_op_loop_if_true):
+ (JSC::JIT::emit_op_jtrue):
+ (JSC::JIT::emit_op_next_pname):
+
+2009-05-12 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ Add op_get_global_var, op_put_global_var, emit_op_get_scoped_var, emit_op_put_scoped_var and
+ op_unexpected_load.
+
+ * jit/JIT.h:
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::tagFor):
+ (JSC::JIT::payloadFor):
+ (JSC::JIT::emitLoad):
+ (JSC::JIT::emitStore):
+ (JSC::JIT::emitLoadReturnValue):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_get_global_var):
+ (JSC::JIT::emit_op_put_global_var):
+ (JSC::JIT::emit_op_get_scoped_var):
+ (JSC::JIT::emit_op_put_scoped_var):
+ (JSC::JIT::emit_op_unexpected_load):
+
+2009-05-12 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Added overflow handling to op_sub.
+
+ * jit/JIT.h:
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emitSlow_op_sub):
+ (JSC::JIT::emitSlowSub32InPlaceLeft):
+
+2009-05-12 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ Remove a function call by folding op_get_by_id and op_put_by_id into
+ their respective compile functions.
+
+ * jit/JIT.h:
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::emit_op_get_by_id):
+ (JSC::JIT::emitSlow_op_get_by_id):
+ (JSC::JIT::emit_op_put_by_id):
+ (JSC::JIT::emitSlow_op_put_by_id):
+
+2009-05-12 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ Make JITStubCall work in 64bit by making the stack index
+ step dependent on the size of void*.
+
+ * jit/JITStubCall.h:
+ (JSC::JITStubCall::JITStubCall):
+ (JSC::JITStubCall::addArgument):
+
+2009-05-12 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ Implement simple version of property access opcodes
+ which just call a stub functions.
+
+ * jit/JITOpcodes.cpp:
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::emitSlow_op_put_by_id):
+ (JSC::JIT::emitSlow_op_get_by_id):
+ (JSC::JIT::emit_op_get_by_val):
+ (JSC::JIT::emitSlow_op_get_by_val):
+ (JSC::JIT::emit_op_put_by_val):
+ (JSC::JIT::emitSlow_op_put_by_val):
+ (JSC::JIT::emit_op_put_by_index):
+ (JSC::JIT::emit_op_put_getter):
+ (JSC::JIT::emit_op_put_setter):
+ (JSC::JIT::emit_op_del_by_id):
+ (JSC::JIT::compileGetByIdHotPath):
+ (JSC::JIT::compilePutByIdHotPath):
+ * jit/JITStubCall.h:
+ (JSC::JITStubCall::addArgument):
+ * jsc.cpp:
+
+2009-05-12 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Added work-around for XCode debugging echo problem.
+
+ * jsc.cpp:
+ (runInteractive):
+
+2009-05-12 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Added overflow handling to op_add.
+
+ * jit/JIT.h:
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emitSlow_op_add):
+ (JSC::JIT::emitSlowAdd32InPlace):
+
+2009-05-12 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ Add slow cases for op_jnless or emit_op_jnlesseq.
+
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emitSlow_op_jnless):
+ (JSC::JIT::emitSlow_op_jnlesseq):
+
+2009-05-12 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ Add implementations for op_jnless, emit_op_jnlesseq, op_loop_if_less and op_loop_if_lesseq.
+ No slow cases for op_jnless or emit_op_jnlesseq yet.
+
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emit_op_jnless):
+ (JSC::JIT::emitSlow_op_jnless):
+ (JSC::JIT::emit_op_jnlesseq):
+ (JSC::JIT::emitSlow_op_jnlesseq):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_loop_if_less):
+ (JSC::JIT::emitSlow_op_loop_if_less):
+ (JSC::JIT::emit_op_loop_if_lesseq):
+ (JSC::JIT::emitSlow_op_loop_if_lesseq):
+
+2009-05-12 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ Turn the RECORD_JUMP_TARGET macro into an inline function.
+
+ * jit/JIT.h:
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::recordJumpTarget):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_jmp):
+ (JSC::JIT::emit_op_jsr):
+ (JSC::JIT::emit_op_jmp_scopes):
+
+2009-05-12 Sam Weinig <sam@webkit.org>
+
+ Add MacroAssemblerX86Common::set8 to fix the build.
+
+ * assembler/MacroAssemblerX86Common.h:
+ (JSC::MacroAssemblerX86Common::set8):
+
+2009-05-12 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Added overflow recovery for pre_inc and pre_dec.
+
+ Turned some short-circuit code into early returns, as is the WebKit style.
+
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emit_op_post_inc):
+ (JSC::JIT::emitSlow_op_post_inc):
+ (JSC::JIT::emit_op_post_dec):
+ (JSC::JIT::emitSlow_op_post_dec):
+ (JSC::JIT::emitSlow_op_pre_inc):
+ (JSC::JIT::emitSlow_op_pre_dec):
+
+2009-05-12 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ Implement op_jmp, op_loop, op_eq and op_neq.
+
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_jmp):
+ (JSC::JIT::emit_op_loop):
+ (JSC::JIT::emit_op_eq):
+ (JSC::JIT::emitSlow_op_eq):
+ (JSC::JIT::emit_op_neq):
+ (JSC::JIT::emitSlow_op_neq):
+ (JSC::JIT::emit_op_enter):
+ (JSC::JIT::emit_op_enter_with_activation):
+
+2009-05-12 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ Implement the slow cases for arithmetic opcodes.
+
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emitSlow_op_lshift):
+ (JSC::JIT::emitSlow_op_rshift):
+ (JSC::JIT::emitSlow_op_bitand):
+ (JSC::JIT::emitSlow_op_bitor):
+ (JSC::JIT::emitSlow_op_bitxor):
+ (JSC::JIT::emitSlow_op_bitnot):
+ (JSC::JIT::emitSlow_op_sub):
+ (JSC::JIT::emitSlow_op_mul):
+ (JSC::JIT::emitSlow_op_mod):
+ (JSC::JIT::emit_op_mod):
+
+2009-05-12 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ Implement op_bitnot.
+
+ * assembler/MacroAssemblerX86Common.h:
+ (JSC::MacroAssemblerX86Common::not32):
+ * assembler/X86Assembler.h:
+ (JSC::X86Assembler::notl_m):
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emit_op_bitnot):
+
+2009-05-12 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ Add arithmetic opcode implementations from the old nitro-extreme branch.
+
+ * jit/JIT.h:
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emit_op_jnless):
+ (JSC::JIT::emitSlow_op_jnless):
+ (JSC::JIT::emit_op_jnlesseq):
+ (JSC::JIT::emitSlow_op_jnlesseq):
+ (JSC::JIT::emit_op_lshift):
+ (JSC::JIT::emitSlow_op_lshift):
+ (JSC::JIT::emit_op_rshift):
+ (JSC::JIT::emitSlow_op_rshift):
+ (JSC::JIT::emit_op_bitand):
+ (JSC::JIT::emitBitAnd32Constant):
+ (JSC::JIT::emitBitAnd32InPlace):
+ (JSC::JIT::emit_op_bitor):
+ (JSC::JIT::emitSlow_op_bitor):
+ (JSC::JIT::emitBitOr32Constant):
+ (JSC::JIT::emitBitOr32InPlace):
+ (JSC::JIT::emit_op_bitxor):
+ (JSC::JIT::emitSlow_op_bitxor):
+ (JSC::JIT::emitBitXor32Constant):
+ (JSC::JIT::emitBitXor32InPlace):
+ (JSC::JIT::emit_op_bitnot):
+ (JSC::JIT::emitSlow_op_bitnot):
+ (JSC::JIT::emit_op_post_inc):
+ (JSC::JIT::emitSlow_op_post_inc):
+ (JSC::JIT::emit_op_post_dec):
+ (JSC::JIT::emitSlow_op_post_dec):
+ (JSC::JIT::emit_op_pre_inc):
+ (JSC::JIT::emitSlow_op_pre_inc):
+ (JSC::JIT::emit_op_pre_dec):
+ (JSC::JIT::emitSlow_op_pre_dec):
+ (JSC::JIT::emit_op_add):
+ (JSC::JIT::emitAdd32Constant):
+ (JSC::JIT::emitAdd32InPlace):
+ (JSC::JIT::emitSlow_op_add):
+ (JSC::JIT::emit_op_sub):
+ (JSC::JIT::emitSlow_op_sub):
+ (JSC::JIT::emitSub32ConstantLeft):
+ (JSC::JIT::emitSub32ConstantRight):
+ (JSC::JIT::emitSub32InPlaceLeft):
+ (JSC::JIT::emitSub32InPlaceRight):
+ (JSC::JIT::emit_op_mul):
+ (JSC::JIT::emitSlow_op_mul):
+ (JSC::JIT::emitMul32Constant):
+ (JSC::JIT::emitMul32InPlace):
+ (JSC::JIT::emit_op_mod):
+ (JSC::JIT::emitSlow_op_mod):
+ * jit/JITOpcodes.cpp:
+
+2009-05-12 Geoffrey Garen <ggaren@apple.com>
+
+ Removed JIT_OPTIMIZE_ARITHMETIC setting, since it was all about 32bit
+ value representations.
+
+ Added JSAPIValueWrapper to the repository.
+
+ * jit/JIT.h:
+ * jit/JITArithmetic.cpp:
+ * runtime/JSAPIValueWrapper.cpp: Added.
+ (JSC::JSAPIValueWrapper::toPrimitive):
+ (JSC::JSAPIValueWrapper::getPrimitiveNumber):
+ (JSC::JSAPIValueWrapper::toBoolean):
+ (JSC::JSAPIValueWrapper::toNumber):
+ (JSC::JSAPIValueWrapper::toString):
+ (JSC::JSAPIValueWrapper::toObject):
+ * runtime/JSAPIValueWrapper.h: Added.
+ (JSC::JSAPIValueWrapper::value):
+ (JSC::JSAPIValueWrapper::isAPIValueWrapper):
+ (JSC::JSAPIValueWrapper::JSAPIValueWrapper):
+ (JSC::jsAPIValueWrapper):
+ * wtf/Platform.h:
+
+2009-05-12 Geoffrey Garen <ggaren@apple.com>
+
+ Turned on the JIT and got it building and running the most trivial of
+ programs.
+
+ All configurable optimizations are turned off, and a few opcodes are ad
+ hoc #if'd out.
+
+ So far, I've only merged op_mov and op_end, but some stub-reliant
+ opcodes work as-is from TOT.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::~CodeBlock):
+ * bytecode/CodeBlock.h:
+ * jit/JIT.cpp:
+ (JSC::JIT::compileOpStrictEq):
+ * jit/JIT.h:
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emit_op_lshift):
+ (JSC::JIT::emitSlow_op_lshift):
+ (JSC::JIT::emit_op_rshift):
+ (JSC::JIT::emitSlow_op_rshift):
+ (JSC::JIT::emit_op_jnless):
+ (JSC::JIT::emitSlow_op_jnless):
+ (JSC::JIT::emit_op_jnlesseq):
+ (JSC::JIT::emitSlow_op_jnlesseq):
+ (JSC::JIT::emit_op_bitand):
+ (JSC::JIT::emitSlow_op_bitand):
+ (JSC::JIT::emit_op_post_inc):
+ (JSC::JIT::emitSlow_op_post_inc):
+ (JSC::JIT::emit_op_post_dec):
+ (JSC::JIT::emitSlow_op_post_dec):
+ (JSC::JIT::emit_op_pre_inc):
+ (JSC::JIT::emitSlow_op_pre_inc):
+ (JSC::JIT::emit_op_pre_dec):
+ (JSC::JIT::emitSlow_op_pre_dec):
+ (JSC::JIT::emit_op_mod):
+ (JSC::JIT::emitSlow_op_mod):
+ (JSC::JIT::emit_op_add):
+ (JSC::JIT::emit_op_mul):
+ (JSC::JIT::emit_op_sub):
+ (JSC::JIT::compileBinaryArithOpSlowCase):
+ (JSC::JIT::emitSlow_op_add):
+ (JSC::JIT::emitSlow_op_mul):
+ * jit/JITCall.cpp:
+ (JSC::JIT::compileOpCallInitializeCallFrame):
+ (JSC::JIT::compileOpConstructSetupArgs):
+ (JSC::JIT::compileOpCallVarargs):
+ (JSC::JIT::compileOpCall):
+ (JSC::JIT::compileOpCallSlowCase):
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::getConstantOperandImmediateInt):
+ (JSC::JIT::isOperandConstantImmediateInt):
+ (JSC::JIT::emitInitRegister):
+ (JSC::JIT::addSlowCase):
+ (JSC::JIT::addJump):
+ (JSC::JIT::emitJumpSlowToHot):
+ (JSC::JIT::tagFor):
+ (JSC::JIT::payloadFor):
+ (JSC::JIT::emitLoad):
+ (JSC::JIT::emitLoadReturnValue):
+ (JSC::JIT::emitStore):
+ (JSC::JIT::emitStoreReturnValue):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_mov):
+ (JSC::JIT::emit_op_end):
+ (JSC::JIT::emit_op_jmp):
+ (JSC::JIT::emit_op_loop):
+ (JSC::JIT::emit_op_loop_if_less):
+ (JSC::JIT::emit_op_loop_if_lesseq):
+ (JSC::JIT::emit_op_instanceof):
+ (JSC::JIT::emit_op_get_global_var):
+ (JSC::JIT::emit_op_put_global_var):
+ (JSC::JIT::emit_op_get_scoped_var):
+ (JSC::JIT::emit_op_put_scoped_var):
+ (JSC::JIT::emit_op_tear_off_activation):
+ (JSC::JIT::emit_op_ret):
+ (JSC::JIT::emit_op_construct_verify):
+ (JSC::JIT::emit_op_to_primitive):
+ (JSC::JIT::emit_op_loop_if_true):
+ (JSC::JIT::emit_op_resolve_global):
+ (JSC::JIT::emit_op_not):
+ (JSC::JIT::emit_op_jfalse):
+ (JSC::JIT::emit_op_jeq_null):
+ (JSC::JIT::emit_op_jneq_null):
+ (JSC::JIT::emit_op_jneq_ptr):
+ (JSC::JIT::emit_op_unexpected_load):
+ (JSC::JIT::emit_op_eq):
+ (JSC::JIT::emit_op_bitnot):
+ (JSC::JIT::emit_op_jtrue):
+ (JSC::JIT::emit_op_neq):
+ (JSC::JIT::emit_op_bitxor):
+ (JSC::JIT::emit_op_bitor):
+ (JSC::JIT::emit_op_throw):
+ (JSC::JIT::emit_op_next_pname):
+ (JSC::JIT::emit_op_push_scope):
+ (JSC::JIT::emit_op_to_jsnumber):
+ (JSC::JIT::emit_op_push_new_scope):
+ (JSC::JIT::emit_op_catch):
+ (JSC::JIT::emit_op_switch_imm):
+ (JSC::JIT::emit_op_switch_char):
+ (JSC::JIT::emit_op_switch_string):
+ (JSC::JIT::emit_op_new_error):
+ (JSC::JIT::emit_op_eq_null):
+ (JSC::JIT::emit_op_neq_null):
+ (JSC::JIT::emit_op_convert_this):
+ (JSC::JIT::emit_op_profile_will_call):
+ (JSC::JIT::emit_op_profile_did_call):
+ (JSC::JIT::emitSlow_op_construct_verify):
+ (JSC::JIT::emitSlow_op_get_by_val):
+ (JSC::JIT::emitSlow_op_loop_if_less):
+ (JSC::JIT::emitSlow_op_loop_if_lesseq):
+ (JSC::JIT::emitSlow_op_put_by_val):
+ (JSC::JIT::emitSlow_op_not):
+ (JSC::JIT::emitSlow_op_instanceof):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::emit_op_get_by_val):
+ (JSC::JIT::emit_op_put_by_val):
+ (JSC::JIT::emit_op_put_by_index):
+ (JSC::JIT::emit_op_put_getter):
+ (JSC::JIT::emit_op_put_setter):
+ (JSC::JIT::emit_op_del_by_id):
+ (JSC::JIT::compileGetByIdHotPath):
+ (JSC::JIT::compilePutByIdHotPath):
+ * jit/JITStubCall.h:
+ (JSC::JITStubCall::JITStubCall):
+ (JSC::JITStubCall::addArgument):
+ (JSC::JITStubCall::call):
+ (JSC::JITStubCall::):
+ (JSC::CallEvalJITStub::CallEvalJITStub):
+ * jit/JITStubs.cpp:
+ (JSC::):
+ (JSC::JITStubs::cti_op_add):
+ (JSC::JITStubs::cti_op_pre_inc):
+ (JSC::JITStubs::cti_op_mul):
+ (JSC::JITStubs::cti_op_get_by_val):
+ (JSC::JITStubs::cti_op_get_by_val_string):
+ (JSC::JITStubs::cti_op_get_by_val_byte_array):
+ (JSC::JITStubs::cti_op_sub):
+ (JSC::JITStubs::cti_op_put_by_val):
+ (JSC::JITStubs::cti_op_put_by_val_array):
+ (JSC::JITStubs::cti_op_put_by_val_byte_array):
+ (JSC::JITStubs::cti_op_negate):
+ (JSC::JITStubs::cti_op_div):
+ (JSC::JITStubs::cti_op_pre_dec):
+ (JSC::JITStubs::cti_op_post_inc):
+ (JSC::JITStubs::cti_op_eq):
+ (JSC::JITStubs::cti_op_lshift):
+ (JSC::JITStubs::cti_op_bitand):
+ (JSC::JITStubs::cti_op_rshift):
+ (JSC::JITStubs::cti_op_bitnot):
+ (JSC::JITStubs::cti_op_mod):
+ (JSC::JITStubs::cti_op_neq):
+ (JSC::JITStubs::cti_op_post_dec):
+ (JSC::JITStubs::cti_op_urshift):
+ (JSC::JITStubs::cti_op_bitxor):
+ (JSC::JITStubs::cti_op_bitor):
+ (JSC::JITStubs::cti_op_switch_imm):
+ * jit/JITStubs.h:
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::JSArray):
+ * runtime/JSFunction.cpp:
+ (JSC::JSFunction::~JSFunction):
+ * runtime/JSValue.h:
+ (JSC::JSValue::payload):
+ * wtf/Platform.h:
+
+2009-05-07 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Geoffrey Garen.
+
+ Add some new MacroAssembler and assembler functions that will be needed shortly.
+
+ * assembler/MacroAssemblerX86Common.h:
+ (JSC::MacroAssemblerX86Common::add32):
+ (JSC::MacroAssemblerX86Common::and32):
+ (JSC::MacroAssemblerX86Common::mul32):
+ (JSC::MacroAssemblerX86Common::neg32):
+ (JSC::MacroAssemblerX86Common::or32):
+ (JSC::MacroAssemblerX86Common::sub32):
+ (JSC::MacroAssemblerX86Common::xor32):
+ (JSC::MacroAssemblerX86Common::branchAdd32):
+ (JSC::MacroAssemblerX86Common::branchMul32):
+ (JSC::MacroAssemblerX86Common::branchSub32):
+ * assembler/X86Assembler.h:
+ (JSC::X86Assembler::):
+ (JSC::X86Assembler::addl_rm):
+ (JSC::X86Assembler::andl_mr):
+ (JSC::X86Assembler::andl_rm):
+ (JSC::X86Assembler::andl_im):
+ (JSC::X86Assembler::negl_r):
+ (JSC::X86Assembler::notl_r):
+ (JSC::X86Assembler::orl_rm):
+ (JSC::X86Assembler::orl_im):
+ (JSC::X86Assembler::subl_rm):
+ (JSC::X86Assembler::xorl_mr):
+ (JSC::X86Assembler::xorl_rm):
+ (JSC::X86Assembler::xorl_im):
+ (JSC::X86Assembler::imull_mr):
+
+2009-05-11 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Cameron Zwarich.
+
+ Remove the NumberHeap.
+
+ * JavaScriptCore.exp:
+ * runtime/Collector.cpp:
+ (JSC::Heap::Heap):
+ (JSC::Heap::destroy):
+ (JSC::Heap::recordExtraCost):
+ (JSC::Heap::heapAllocate):
+ (JSC::Heap::markConservatively):
+ (JSC::Heap::sweep):
+ (JSC::Heap::collect):
+ (JSC::Heap::objectCount):
+ (JSC::Heap::statistics):
+ (JSC::typeName):
+ (JSC::Heap::isBusy):
+ * runtime/Collector.h:
+ (JSC::Heap::globalData):
+ * runtime/JSCell.h:
+
+2009-05-11 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Land initial commit of new number representation for 32 bit platforms,
+ with JIT disabled.
+
+ * API/APICast.h:
+ (toJS):
+ (toRef):
+ * API/JSCallbackObjectFunctions.h:
+ (JSC::::hasInstance):
+ (JSC::::toNumber):
+ (JSC::::toString):
+ * API/tests/testapi.c:
+ (EvilExceptionObject_convertToType):
+ * AllInOneFile.cpp:
+ * JavaScriptCore.exp:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * bytecode/CodeBlock.cpp:
+ (JSC::valueToSourceString):
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::emitLoad):
+ (JSC::BytecodeGenerator::emitUnexpectedLoad):
+ (JSC::keyForImmediateSwitch):
+ * bytecompiler/BytecodeGenerator.h:
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::dumpRegisters):
+ (JSC::Interpreter::privateExecute):
+ * parser/Nodes.cpp:
+ (JSC::ArrayNode::emitBytecode):
+ (JSC::processClauseList):
+ * runtime/ArgList.h:
+ * runtime/Collector.h:
+ (JSC::sizeof):
+ * runtime/DateMath.cpp:
+ * runtime/ExceptionHelpers.h:
+ * runtime/InitializeThreading.cpp:
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::JSArray):
+ * runtime/JSCell.cpp:
+ * runtime/JSCell.h:
+ (JSC::JSCell::isAPIValueWrapper):
+ (JSC::JSValue::isString):
+ (JSC::JSValue::isGetterSetter):
+ (JSC::JSValue::isObject):
+ (JSC::JSValue::getString):
+ (JSC::JSValue::getObject):
+ (JSC::JSValue::getCallData):
+ (JSC::JSValue::getConstructData):
+ (JSC::JSValue::getUInt32):
+ (JSC::JSValue::marked):
+ (JSC::JSValue::toPrimitive):
+ (JSC::JSValue::getPrimitiveNumber):
+ (JSC::JSValue::toBoolean):
+ (JSC::JSValue::toNumber):
+ (JSC::JSValue::toString):
+ (JSC::JSValue::needsThisConversion):
+ (JSC::JSValue::toThisString):
+ (JSC::JSValue::getJSNumber):
+ (JSC::JSValue::toObject):
+ (JSC::JSValue::toThisObject):
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData):
+ * runtime/JSGlobalData.h:
+ * runtime/JSGlobalObject.h:
+ (JSC::Structure::prototypeForLookup):
+ * runtime/JSGlobalObjectFunctions.cpp:
+ (JSC::globalFuncParseInt):
+ * runtime/JSImmediate.h:
+ * runtime/JSNumberCell.cpp: Removed.
+ * runtime/JSNumberCell.h: Removed.
+ * runtime/JSObject.h:
+ (JSC::JSValue::get):
+ (JSC::JSValue::put):
+ * runtime/JSString.h:
+ (JSC::JSValue::toThisJSString):
+ * runtime/JSValue.cpp:
+ (JSC::JSValue::toInteger):
+ (JSC::JSValue::toIntegerPreserveNaN):
+ (JSC::JSValue::toObjectSlowCase):
+ (JSC::JSValue::toThisObjectSlowCase):
+ (JSC::JSValue::synthesizeObject):
+ (JSC::JSValue::synthesizePrototype):
+ (JSC::JSValue::description):
+ (JSC::nonInlineNaN):
+ * runtime/JSValue.h:
+ (JSC::JSValue::):
+ (JSC::EncodedJSValueHashTraits::emptyValue):
+ (JSC::jsNaN):
+ (JSC::operator==):
+ (JSC::operator!=):
+ (JSC::toInt32):
+ (JSC::toUInt32):
+ (JSC::JSValue::encode):
+ (JSC::JSValue::decode):
+ (JSC::JSValue::JSValue):
+ (JSC::JSValue::operator bool):
+ (JSC::JSValue::operator==):
+ (JSC::JSValue::operator!=):
+ (JSC::JSValue::isUndefined):
+ (JSC::JSValue::isNull):
+ (JSC::JSValue::isUndefinedOrNull):
+ (JSC::JSValue::isCell):
+ (JSC::JSValue::isInt32):
+ (JSC::JSValue::isUInt32):
+ (JSC::JSValue::isDouble):
+ (JSC::JSValue::isTrue):
+ (JSC::JSValue::isFalse):
+ (JSC::JSValue::tag):
+ (JSC::JSValue::asInt32):
+ (JSC::JSValue::asUInt32):
+ (JSC::JSValue::asDouble):
+ (JSC::JSValue::asCell):
+ (JSC::JSValue::isNumber):
+ (JSC::JSValue::isBoolean):
+ (JSC::JSValue::getBoolean):
+ (JSC::JSValue::uncheckedGetNumber):
+ (JSC::JSValue::toJSNumber):
+ (JSC::JSValue::getNumber):
+ (JSC::JSValue::toInt32):
+ (JSC::JSValue::toUInt32):
+ * runtime/Operations.h:
+ (JSC::JSValue::equal):
+ (JSC::JSValue::equalSlowCaseInline):
+ (JSC::JSValue::strictEqual):
+ (JSC::JSValue::strictEqualSlowCaseInline):
+ (JSC::jsLess):
+ (JSC::jsLessEq):
+ (JSC::jsAdd):
+ * runtime/PropertySlot.h:
+ * runtime/StringPrototype.cpp:
+ (JSC::stringProtoFuncCharAt):
+ (JSC::stringProtoFuncCharCodeAt):
+ (JSC::stringProtoFuncIndexOf):
+ * wtf/Platform.h:
+
+=== Start merge of nitro-extreme branch 2009-07-30 ===
+
+2009-07-29 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by George Staikos.
+
+ Resolve class/struct mixup in forward declarations
+ https://bugs.webkit.org/show_bug.cgi?id=27708
+
+ * API/JSClassRef.h:
+ * bytecode/SamplingTool.h:
+ * interpreter/Interpreter.h:
+ * jit/JIT.h:
+ * profiler/ProfileGenerator.h:
+ * profiler/Profiler.h:
+ * runtime/ClassInfo.h:
+ * runtime/ExceptionHelpers.h:
+ * runtime/JSByteArray.h:
+ * runtime/JSCell.h:
+ * runtime/JSFunction.h:
+ * runtime/JSGlobalData.h:
+ * runtime/JSObject.h:
+ * runtime/JSString.h:
+
+2009-07-28 Ada Chan <adachan@apple.com>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=27236
+ - Implement TCMalloc_SystemRelease and TCMalloc_SystemCommit for Windows.
+ - Use a background thread to periodically scavenge memory to release back to the system.
+
+ * wtf/FastMalloc.cpp:
+ (WTF::TCMalloc_PageHeap::init):
+ (WTF::TCMalloc_PageHeap::runScavengerThread):
+ (WTF::TCMalloc_PageHeap::scavenge):
+ (WTF::TCMalloc_PageHeap::shouldContinueScavenging):
+ (WTF::TCMalloc_PageHeap::New):
+ (WTF::TCMalloc_PageHeap::AllocLarge):
+ (WTF::TCMalloc_PageHeap::Delete):
+ (WTF::TCMalloc_PageHeap::GrowHeap):
+ (WTF::sleep):
+ (WTF::TCMalloc_PageHeap::scavengerThread):
+ * wtf/TCSystemAlloc.cpp:
+ (TCMalloc_SystemRelease):
+ (TCMalloc_SystemCommit):
+ * wtf/TCSystemAlloc.h:
+
+2009-07-28 Xan Lopez <xlopez@igalia.com>
+
+ Add new files, fixes distcheck.
+
+ * GNUmakefile.am:
+
+2009-07-28 Csaba Osztrogonac <oszi@inf.u-szeged.hu>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Determining whether to use JIT or interpreter
+ moved from JavaScriptCore.pri to Platform.h
+
+ * JavaScriptCore.pri:
+ * wtf/Platform.h:
+
+2009-07-27 Brian Weinstein <bweinstein@apple.com>
+
+ Fix of misuse of sort command.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-07-27 Brian Weinstein <bweinstein@apple.com>
+
+ Build fix for Windows.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-07-27 Gavin Barraclough <barraclough@apple.com>
+
+ Rubber stamped by Oliver Hunt.
+
+ Fix tyop in JIT, renamed preverveReturnAddressAfterCall -> preserveReturnAddressAfterCall.
+
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompile):
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ * jit/JIT.h:
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::preserveReturnAddressAfterCall):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::privateCompilePutByIdTransition):
+
+2009-07-27 Alexey Proskuryakov <ap@webkit.org>
+
+ Gtk build fix.
+
+ * runtime/JSLock.cpp: (JSC::JSLock::JSLock): Fix "no threading" case.
+
+2009-07-27 Alexey Proskuryakov <ap@webkit.org>
+
+ Release build fix.
+
+ * runtime/JSLock.h: (JSC::JSLock::~JSLock):
+
+2009-07-27 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=27735
+ Give a helpful name to JSLock constructor argument
+
+ * API/JSBase.cpp:
+ (JSGarbageCollect):
+ * API/JSContextRef.cpp:
+ * API/JSObjectRef.cpp:
+ (JSPropertyNameArrayRelease):
+ (JSPropertyNameAccumulatorAddName):
+ * JavaScriptCore.exp:
+ * jsc.cpp:
+ (functionGC):
+ (cleanupGlobalData):
+ (jscmain):
+ * runtime/Collector.cpp:
+ (JSC::Heap::destroy):
+ * runtime/JSLock.cpp:
+ (JSC::JSLock::JSLock):
+ (JSC::JSLock::lock):
+ (JSC::JSLock::unlock):
+ (JSC::JSLock::DropAllLocks::DropAllLocks):
+ (JSC::JSLock::DropAllLocks::~DropAllLocks):
+ * runtime/JSLock.h:
+ (JSC::):
+ (JSC::JSLock::JSLock):
+ (JSC::JSLock::~JSLock):
+
+2009-07-25 Zoltan Horvath <hzoltan@inf.u-szeged.hu>
+
+ Reviewed by Eric Seidel.
+
+ Allow custom memory allocation control for OpaqueJSPropertyNameArray struct
+ https://bugs.webkit.org/show_bug.cgi?id=27342
+
+ Inherits OpaqueJSPropertyNameArray struct from FastAllocBase because it has been
+ instantiated by 'new' JavaScriptCore/API/JSObjectRef.cpp:473.
+
+ * API/JSObjectRef.cpp:
+
+2009-07-24 Ada Chan <adachan@apple.com>
+
+ In preparation for https://bugs.webkit.org/show_bug.cgi?id=27236:
+ Remove TCMALLOC_TRACK_DECOMMITED_SPANS. We'll always track decommitted spans.
+ We have tested this and show it has little impact on performance.
+
+ Reviewed by Mark Rowe.
+
+ * wtf/FastMalloc.cpp:
+ (WTF::TCMalloc_PageHeap::New):
+ (WTF::TCMalloc_PageHeap::AllocLarge):
+ (WTF::propagateDecommittedState):
+ (WTF::mergeDecommittedStates):
+ (WTF::TCMalloc_PageHeap::Delete):
+ (WTF::TCMalloc_PageHeap::IncrementalScavenge):
+
+2009-07-24 Csaba Osztrogonac <oszi@inf.u-szeged.hu>
+
+ Reviewed by Darin Adler and Adam Barth.
+
+ Build fix for x86 platforms.
+ https://bugs.webkit.org/show_bug.cgi?id=27602
+
+ * jit/JIT.cpp:
+
+2009-07-23 Kevin Ollivier <kevino@theolliviers.com>
+
+ wx build fix, adding missing header.
+
+ * jit/JIT.cpp:
+
+2009-07-22 Yong Li <yong.li@torchmobile.com>
+
+ Reviewed by George Staikos.
+
+ Add wince specific memory files into wtf/wince
+ https://bugs.webkit.org/show_bug.cgi?id=27550
+
+ * wtf/wince/FastMallocWince.h: Added.
+ * wtf/wince/MemoryManager.cpp: Added.
+ * wtf/wince/MemoryManager.h: Added.
+
+2009-07-23 Norbert Leser <norbert.leser@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Fix for missing mmap features in Symbian
+ https://bugs.webkit.org/show_bug.cgi?id=24540
+
+ Fix, conditionally for PLATFORM(SYMBIAN), as an alternative
+ to missing support for the MAP_ANON property flag in mmap.
+ It utilizes Symbian specific memory allocation features.
+
+ * runtime/Collector.cpp
+
+2009-07-22 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ With ENABLE(ASSEMBLER_WX_EXCLUSIVE), only change permissions once per repatch event.
+ ( https://bugs.webkit.org/show_bug.cgi?id=27564 )
+
+ Currently we change permissions forwards and backwards for each instruction modified,
+ instead we should only change permissions once per complete repatching event.
+
+ 2.5% progression running with ENABLE(ASSEMBLER_WX_EXCLUSIVE) enabled,
+ which recoups 1/3 of the penalty of running with this mode enabled.
+
+ * assembler/ARMAssembler.cpp:
+ (JSC::ARMAssembler::linkBranch):
+ - Replace usage of MakeWritable with cacheFlush.
+
+ * assembler/ARMAssembler.h:
+ (JSC::ARMAssembler::patchPointerInternal):
+ (JSC::ARMAssembler::repatchLoadPtrToLEA):
+ - Replace usage of MakeWritable with cacheFlush.
+
+ * assembler/ARMv7Assembler.h:
+ (JSC::ARMv7Assembler::relinkJump):
+ (JSC::ARMv7Assembler::relinkCall):
+ (JSC::ARMv7Assembler::repatchInt32):
+ (JSC::ARMv7Assembler::repatchPointer):
+ (JSC::ARMv7Assembler::repatchLoadPtrToLEA):
+ (JSC::ARMv7Assembler::setInt32):
+ - Replace usage of MakeWritable with cacheFlush.
+
+ * assembler/LinkBuffer.h:
+ (JSC::LinkBuffer::performFinalization):
+ - Make explicit call to cacheFlush.
+
+ * assembler/MacroAssemblerCodeRef.h:
+ (JSC::MacroAssemblerCodeRef::MacroAssemblerCodeRef):
+ - Make size always available.
+
+ * assembler/RepatchBuffer.h:
+ (JSC::RepatchBuffer::RepatchBuffer):
+ (JSC::RepatchBuffer::~RepatchBuffer):
+ - Add calls to MakeWritable & makeExecutable.
+
+ * assembler/X86Assembler.h:
+ (JSC::X86Assembler::relinkJump):
+ (JSC::X86Assembler::relinkCall):
+ (JSC::X86Assembler::repatchInt32):
+ (JSC::X86Assembler::repatchPointer):
+ (JSC::X86Assembler::repatchLoadPtrToLEA):
+ - Remove usage of MakeWritable.
+
+ * bytecode/CodeBlock.h:
+ (JSC::CodeBlock::getJITCode):
+ - Provide access to CodeBlock's JITCode.
+
+ * jit/ExecutableAllocator.h:
+ (JSC::ExecutableAllocator::makeExecutable):
+ (JSC::ExecutableAllocator::cacheFlush):
+ - Remove MakeWritable, make cacheFlush public.
+
+ * jit/JIT.cpp:
+ (JSC::ctiPatchNearCallByReturnAddress):
+ (JSC::ctiPatchCallByReturnAddress):
+ (JSC::JIT::privateCompile):
+ (JSC::JIT::unlinkCall):
+ (JSC::JIT::linkCall):
+ - Add CodeBlock argument to RepatchBuffer.
+
+ * jit/JIT.h:
+ - Pass CodeBlock argument for use by RepatchBuffer.
+
+ * jit/JITCode.h:
+ (JSC::JITCode::start):
+ (JSC::JITCode::size):
+ - Provide access to code start & size.
+
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::privateCompilePutByIdTransition):
+ (JSC::JIT::patchGetByIdSelf):
+ (JSC::JIT::patchMethodCallProto):
+ (JSC::JIT::patchPutByIdReplace):
+ (JSC::JIT::privateCompilePatchGetArrayLength):
+ (JSC::JIT::privateCompileGetByIdProto):
+ (JSC::JIT::privateCompileGetByIdSelfList):
+ (JSC::JIT::privateCompileGetByIdProtoList):
+ (JSC::JIT::privateCompileGetByIdChainList):
+ (JSC::JIT::privateCompileGetByIdChain):
+ - Add CodeBlock argument to RepatchBuffer.
+
+ * jit/JITStubs.cpp:
+ (JSC::JITThunks::tryCachePutByID):
+ (JSC::JITThunks::tryCacheGetByID):
+ (JSC::JITStubs::DEFINE_STUB_FUNCTION):
+ - Pass CodeBlock argument for use by RepatchBuffer.
+
+2009-07-21 Zoltan Herczeg <zherczeg@inf.u-szeged.hu>
+
+ Reviewed by Gavin Barraclough.
+
+ Cache not only the structure of the method, but the
+ structure of its prototype as well.
+ https://bugs.webkit.org/show_bug.cgi?id=27077
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::~CodeBlock):
+ * bytecode/CodeBlock.h:
+ (JSC::MethodCallLinkInfo::MethodCallLinkInfo):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::patchMethodCallProto):
+
+2009-07-21 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Move call linking / repatching down from AbstractMacroAssembler into MacroAssemblerARCH classes.
+ ( https://bugs.webkit.org/show_bug.cgi?id=27527 )
+
+ This allows the implementation to be defined per architecture. Specifically this addresses the
+ fact that x86-64 MacroAssembler implements far calls as a load to register, followed by a call
+ to register. Patching the call actually requires the pointer load to be patched, rather than
+ the call to be patched. This is implementation detail specific to MacroAssemblerX86_64, and as
+ such is best handled there.
+
+ * assembler/AbstractMacroAssembler.h:
+ * assembler/MacroAssemblerARM.h:
+ (JSC::MacroAssemblerARM::linkCall):
+ (JSC::MacroAssemblerARM::repatchCall):
+ * assembler/MacroAssemblerARMv7.h:
+ (JSC::MacroAssemblerARMv7::linkCall):
+ (JSC::MacroAssemblerARMv7::repatchCall):
+ * assembler/MacroAssemblerX86.h:
+ (JSC::MacroAssemblerX86::linkCall):
+ (JSC::MacroAssemblerX86::repatchCall):
+ * assembler/MacroAssemblerX86_64.h:
+ (JSC::MacroAssemblerX86_64::linkCall):
+ (JSC::MacroAssemblerX86_64::repatchCall):
+
+2009-07-21 Adam Treat <adam.treat@torchmobile.com>
+
+ Reviewed by George Staikos.
+
+ Every wtf file includes other wtf files with <> style includes
+ except this one. Fix the exception.
+
+ * wtf/ByteArray.h:
+
+2009-07-21 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Move LinkBuffer/RepatchBuffer out of AbstractMacroAssembler.
+ ( https://bugs.webkit.org/show_bug.cgi?id=27485 )
+
+ This change is the first step in a process to move code that should be in
+ the architecture-specific MacroAssembler classes up out of Assmbler and
+ AbstractMacroAssembler.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ - added new files
+
+ * assembler/ARMAssembler.h:
+ (JSC::ARMAssembler::linkPointer):
+ - rename patchPointer to bring it in line with the current link/repatch naming scheme
+
+ * assembler/ARMv7Assembler.h:
+ (JSC::ARMv7Assembler::linkCall):
+ (JSC::ARMv7Assembler::linkPointer):
+ (JSC::ARMv7Assembler::relinkCall):
+ (JSC::ARMv7Assembler::repatchInt32):
+ (JSC::ARMv7Assembler::repatchPointer):
+ (JSC::ARMv7Assembler::setInt32):
+ (JSC::ARMv7Assembler::setPointer):
+ - rename patchPointer to bring it in line with the current link/repatch naming scheme
+
+ * assembler/AbstractMacroAssembler.h:
+ (JSC::AbstractMacroAssembler::linkJump):
+ (JSC::AbstractMacroAssembler::linkCall):
+ (JSC::AbstractMacroAssembler::linkPointer):
+ (JSC::AbstractMacroAssembler::getLinkerAddress):
+ (JSC::AbstractMacroAssembler::getLinkerCallReturnOffset):
+ (JSC::AbstractMacroAssembler::repatchJump):
+ (JSC::AbstractMacroAssembler::repatchCall):
+ (JSC::AbstractMacroAssembler::repatchNearCall):
+ (JSC::AbstractMacroAssembler::repatchInt32):
+ (JSC::AbstractMacroAssembler::repatchPointer):
+ (JSC::AbstractMacroAssembler::repatchLoadPtrToLEA):
+ - remove the LinkBuffer/RepatchBuffer classes, but leave a set of (private, friended) methods to interface to the Assembler
+
+ * assembler/LinkBuffer.h: Added.
+ (JSC::LinkBuffer::LinkBuffer):
+ (JSC::LinkBuffer::~LinkBuffer):
+ (JSC::LinkBuffer::link):
+ (JSC::LinkBuffer::patch):
+ (JSC::LinkBuffer::locationOf):
+ (JSC::LinkBuffer::locationOfNearCall):
+ (JSC::LinkBuffer::returnAddressOffset):
+ (JSC::LinkBuffer::finalizeCode):
+ (JSC::LinkBuffer::finalizeCodeAddendum):
+ (JSC::LinkBuffer::code):
+ (JSC::LinkBuffer::performFinalization):
+ - new file containing the LinkBuffer class, previously a member of AbstractMacroAssembler
+
+ * assembler/RepatchBuffer.h: Added.
+ (JSC::RepatchBuffer::RepatchBuffer):
+ (JSC::RepatchBuffer::relink):
+ (JSC::RepatchBuffer::repatch):
+ (JSC::RepatchBuffer::repatchLoadPtrToLEA):
+ (JSC::RepatchBuffer::relinkCallerToTrampoline):
+ (JSC::RepatchBuffer::relinkCallerToFunction):
+ (JSC::RepatchBuffer::relinkNearCallerToTrampoline):
+ - new file containing the RepatchBuffer class, previously a member of AbstractMacroAssembler
+
+ * assembler/X86Assembler.h:
+ (JSC::X86Assembler::linkJump):
+ (JSC::X86Assembler::linkCall):
+ (JSC::X86Assembler::linkPointerForCall):
+ (JSC::X86Assembler::linkPointer):
+ (JSC::X86Assembler::relinkJump):
+ (JSC::X86Assembler::relinkCall):
+ (JSC::X86Assembler::repatchInt32):
+ (JSC::X86Assembler::repatchPointer):
+ (JSC::X86Assembler::setPointer):
+ (JSC::X86Assembler::setInt32):
+ (JSC::X86Assembler::setRel32):
+ - rename patchPointer to bring it in line with the current link/repatch naming scheme
+
+ * jit/JIT.cpp:
+ (JSC::ctiPatchNearCallByReturnAddress):
+ (JSC::ctiPatchCallByReturnAddress):
+ - include new headers
+ - remove MacroAssembler:: specification from RepatchBuffer usage
+
+ * jit/JITPropertyAccess.cpp:
+ * yarr/RegexJIT.cpp:
+ - include new headers
+
+2009-07-21 Robert Agoston <Agoston.Robert@stud.u-szeged.hu>
+
+ Reviewed by David Levin.
+
+ Fixed #undef typo.
+ https://bugs.webkit.org/show_bug.cgi?id=27506
+
+ * bytecode/Opcode.h:
+
+2009-07-21 Adam Roben <aroben@apple.com>
+
+ Roll out r46153, r46154, and r46155
+
+ These changes were causing build failures and assertion failures on
+ Windows.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * runtime/JSArray.cpp:
+ * runtime/StringPrototype.cpp:
+ * runtime/UString.cpp:
+ * runtime/UString.h:
+ * wtf/FastMalloc.cpp:
+ * wtf/FastMalloc.h:
+ * wtf/Platform.h:
+ * wtf/PossiblyNull.h: Removed.
+
+2009-07-21 Roland Steiner <rolandsteiner@google.com>
+
+ Reviewed by David Levin.
+
+ Add ENABLE_RUBY to list of build options
+ https://bugs.webkit.org/show_bug.cgi?id=27324
+
+ * Configurations/FeatureDefines.xcconfig: Added flag ENABLE_RUBY.
+
+2009-07-20 Oliver Hunt <oliver@apple.com>
+
+ Build fix attempt #2
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-07-20 Oliver Hunt <oliver@apple.com>
+
+ Build fix attempt #1
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-07-20 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ Make it harder to misuse try* allocation routines
+ https://bugs.webkit.org/show_bug.cgi?id=27469
+
+ Jump through a few hoops to make it much harder to accidentally
+ miss null-checking of values returned by the try-* allocation
+ routines.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::putSlowCase):
+ (JSC::JSArray::increaseVectorLength):
+ * runtime/StringPrototype.cpp:
+ (JSC::stringProtoFuncFontsize):
+ (JSC::stringProtoFuncLink):
+ * runtime/UString.cpp:
+ (JSC::allocChars):
+ (JSC::reallocChars):
+ (JSC::expandCapacity):
+ (JSC::UString::Rep::reserveCapacity):
+ (JSC::UString::expandPreCapacity):
+ (JSC::createRep):
+ (JSC::concatenate):
+ (JSC::UString::spliceSubstringsWithSeparators):
+ (JSC::UString::replaceRange):
+ (JSC::UString::append):
+ (JSC::UString::operator=):
+ * runtime/UString.h:
+ (JSC::UString::Rep::createEmptyBuffer):
+ * wtf/FastMalloc.cpp:
+ (WTF::tryFastZeroedMalloc):
+ (WTF::tryFastMalloc):
+ (WTF::tryFastCalloc):
+ (WTF::tryFastRealloc):
+ (WTF::TCMallocStats::tryFastMalloc):
+ (WTF::TCMallocStats::tryFastCalloc):
+ (WTF::TCMallocStats::tryFastRealloc):
+ * wtf/FastMalloc.h:
+ (WTF::TryMallocReturnValue::TryMallocReturnValue):
+ (WTF::TryMallocReturnValue::~TryMallocReturnValue):
+ (WTF::TryMallocReturnValue::operator Maybe<T>):
+ (WTF::TryMallocReturnValue::getValue):
+ * wtf/PossiblyNull.h:
+ (WTF::PossiblyNull::PossiblyNull):
+ (WTF::PossiblyNull::~PossiblyNull):
+ (WTF::PossiblyNull::getValue):
+ * wtf/Platform.h:
+
+2009-07-20 Gavin Barraclough <barraclough@apple.com>
+
+ RS Oliver Hunt.
+
+ Add ARM assembler files to xcodeproj, for convenience editing.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2009-07-20 Jessie Berlin <jberlin@apple.com>
+
+ Reviewed by David Levin.
+
+ Fix an incorrect assertion in Vector::remove.
+
+ https://bugs.webkit.org/show_bug.cgi?id=27477
+
+ * wtf/Vector.h:
+ (WTF::::remove):
+ Assert that the position at which to start removing elements + the
+ length (the number of elements to remove) is less than or equal to the
+ size of the entire Vector.
+
+2009-07-20 Peter Kasting <pkasting@google.com>
+
+ Reviewed by Mark Rowe.
+
+ https://bugs.webkit.org/show_bug.cgi?id=27468
+ Back out r46060, which caused problems for some Apple developers.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.vcproj:
+ * JavaScriptCore.vcproj/WTF/WTFCommon.vsprops:
+ * JavaScriptCore.vcproj/jsc/jscCommon.vsprops:
+ * JavaScriptCore.vcproj/testapi/testapiCommon.vsprops:
+
+2009-07-20 Zoltan Horvath <hzoltan@inf.u-szeged.hu>
+
+ Reviewed by Oliver Hunt.
+
+ Allow custom memory allocation control in NewThreadContext
+ https://bugs.webkit.org/show_bug.cgi?id=27338
+
+ Inherits NewThreadContext struct from FastAllocBase because it
+ has been instantiated by 'new' JavaScriptCore/wtf/Threading.cpp:76.
+
+ * wtf/Threading.cpp:
+
+2009-07-20 Zoltan Horvath <hzoltan@inf.u-szeged.hu>
+
+ Reviewed by Oliver Hunt.
+
+ Allow custom memory allocation control in JavaScriptCore's JSClassRef.h
+ https://bugs.webkit.org/show_bug.cgi?id=27340
+
+ Inherit StaticValueEntry and StaticFunctionEntry struct from FastAllocBase because these
+ have been instantiated by 'new' in JavaScriptCore/API/JSClassRef.cpp:153
+ and in JavaScriptCore/API/JSClassRef.cpp:166.
+
+ * API/JSClassRef.h:
+
+2009-07-20 Zoltan Horvath <hzoltan@inf.u-szeged.hu>
+
+ Reviewed by Darin Adler.
+
+ Allow custom memory allocation control in JavaScriptCore's RegexPattern.h
+ https://bugs.webkit.org/show_bug.cgi?id=27343
+
+ Inherits RegexPattern.h's structs (which have been instantiated by operator new) from FastAllocBase:
+
+ CharacterClass (new call: JavaScriptCore/yarr/RegexCompiler.cpp:144)
+ PatternAlternative (new call: JavaScriptCore/yarr/RegexPattern.h:221)
+ PatternDisjunction (new call: JavaScriptCore/yarr/RegexCompiler.cpp:446)
+
+ * yarr/RegexPattern.h:
+
+2009-07-20 Zoltan Horvath <hzoltan@inf.u-szeged.hu>
+
+ Reviewed by Darin Adler.
+
+ Allow custom memory allocation control for JavaScriptCore's MatchFrame struct
+ https://bugs.webkit.org/show_bug.cgi?id=27344
+
+ Inherits MatchFrame struct from FastAllocBase because it has
+ been instantiated by 'new' JavaScriptCore/pcre/pcre_exec.cpp:359.
+
+ * pcre/pcre_exec.cpp:
+
+2009-07-20 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Holger Freyther.
+
+ Remove some outdated S60 platform specific code
+ https://bugs.webkit.org/show_bug.cgi?id=27423
+
+ * wtf/Platform.h:
+
+2009-07-20 Csaba Osztrogonac <oszi@inf.u-szeged.hu>
+
+ Reviewed by Simon Hausmann.
+
+ Qt build fix with MSVC and MinGW.
+
+ * jsc.pro: Make sure jsc is a console application, and turn off
+ exceptions and stl support to fix the build.
+
+2009-07-20 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Gustavo Noronha.
+
+ Do not use C++-style comments in preprocessor directives.
+
+ GCC does not like this in some configurations, using C-style
+ comments is safer.
+
+ * wtf/Platform.h:
+
+2009-07-17 Peter Kasting <pkasting@google.com>
+
+ Reviewed by Steve Falkenburg.
+
+ https://bugs.webkit.org/show_bug.cgi?id=27323
+ Only add Cygwin to the path when it isn't already there. This avoids
+ causing problems for people who purposefully have non-Cygwin versions of
+ executables like svn in front of the Cygwin ones in their paths.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.vcproj:
+ * JavaScriptCore.vcproj/WTF/WTFCommon.vsprops:
+ * JavaScriptCore.vcproj/jsc/jscCommon.vsprops:
+ * JavaScriptCore.vcproj/testapi/testapiCommon.vsprops:
+
+2009-07-17 Gabor Loki <loki@inf.u-szeged.hu>
+
+ Reviewed by Gavin Barraclough.
+
+ Add YARR support for generic ARM platforms (disabled by default).
+ https://bugs.webkit.org/show_bug.cgi?id=24986
+
+ Add generic ARM port for MacroAssembler. It supports the whole
+ MacroAssembler functionality except floating point.
+
+ The class JmpSrc is extended with a flag which enables to patch
+ the jump destination offset during execution. This feature is
+ required for generic ARM port.
+
+ Signed off by Zoltan Herczeg <zherczeg@inf.u-szeged.hu>
+ Signed off by Gabor Loki <loki@inf.u-szeged.hu>
+
+ * JavaScriptCore.pri:
+ * assembler/ARMAssembler.cpp: Added.
+ (JSC::ARMAssembler::getLdrImmAddress):
+ (JSC::ARMAssembler::linkBranch):
+ (JSC::ARMAssembler::patchConstantPoolLoad):
+ (JSC::ARMAssembler::getOp2):
+ (JSC::ARMAssembler::genInt):
+ (JSC::ARMAssembler::getImm):
+ (JSC::ARMAssembler::moveImm):
+ (JSC::ARMAssembler::dataTransfer32):
+ (JSC::ARMAssembler::baseIndexTransfer32):
+ (JSC::ARMAssembler::executableCopy):
+ * assembler/ARMAssembler.h: Added.
+ (JSC::ARM::):
+ (JSC::ARMAssembler::ARMAssembler):
+ (JSC::ARMAssembler::):
+ (JSC::ARMAssembler::JmpSrc::JmpSrc):
+ (JSC::ARMAssembler::JmpSrc::enableLatePatch):
+ (JSC::ARMAssembler::JmpDst::JmpDst):
+ (JSC::ARMAssembler::JmpDst::isUsed):
+ (JSC::ARMAssembler::JmpDst::used):
+ (JSC::ARMAssembler::emitInst):
+ (JSC::ARMAssembler::and_r):
+ (JSC::ARMAssembler::ands_r):
+ (JSC::ARMAssembler::eor_r):
+ (JSC::ARMAssembler::eors_r):
+ (JSC::ARMAssembler::sub_r):
+ (JSC::ARMAssembler::subs_r):
+ (JSC::ARMAssembler::rsb_r):
+ (JSC::ARMAssembler::rsbs_r):
+ (JSC::ARMAssembler::add_r):
+ (JSC::ARMAssembler::adds_r):
+ (JSC::ARMAssembler::adc_r):
+ (JSC::ARMAssembler::adcs_r):
+ (JSC::ARMAssembler::sbc_r):
+ (JSC::ARMAssembler::sbcs_r):
+ (JSC::ARMAssembler::rsc_r):
+ (JSC::ARMAssembler::rscs_r):
+ (JSC::ARMAssembler::tst_r):
+ (JSC::ARMAssembler::teq_r):
+ (JSC::ARMAssembler::cmp_r):
+ (JSC::ARMAssembler::orr_r):
+ (JSC::ARMAssembler::orrs_r):
+ (JSC::ARMAssembler::mov_r):
+ (JSC::ARMAssembler::movs_r):
+ (JSC::ARMAssembler::bic_r):
+ (JSC::ARMAssembler::bics_r):
+ (JSC::ARMAssembler::mvn_r):
+ (JSC::ARMAssembler::mvns_r):
+ (JSC::ARMAssembler::mul_r):
+ (JSC::ARMAssembler::muls_r):
+ (JSC::ARMAssembler::mull_r):
+ (JSC::ARMAssembler::ldr_imm):
+ (JSC::ARMAssembler::ldr_un_imm):
+ (JSC::ARMAssembler::dtr_u):
+ (JSC::ARMAssembler::dtr_ur):
+ (JSC::ARMAssembler::dtr_d):
+ (JSC::ARMAssembler::dtr_dr):
+ (JSC::ARMAssembler::ldrh_r):
+ (JSC::ARMAssembler::ldrh_d):
+ (JSC::ARMAssembler::ldrh_u):
+ (JSC::ARMAssembler::strh_r):
+ (JSC::ARMAssembler::push_r):
+ (JSC::ARMAssembler::pop_r):
+ (JSC::ARMAssembler::poke_r):
+ (JSC::ARMAssembler::peek_r):
+ (JSC::ARMAssembler::clz_r):
+ (JSC::ARMAssembler::bkpt):
+ (JSC::ARMAssembler::lsl):
+ (JSC::ARMAssembler::lsr):
+ (JSC::ARMAssembler::asr):
+ (JSC::ARMAssembler::lsl_r):
+ (JSC::ARMAssembler::lsr_r):
+ (JSC::ARMAssembler::asr_r):
+ (JSC::ARMAssembler::size):
+ (JSC::ARMAssembler::ensureSpace):
+ (JSC::ARMAssembler::label):
+ (JSC::ARMAssembler::align):
+ (JSC::ARMAssembler::jmp):
+ (JSC::ARMAssembler::patchPointerInternal):
+ (JSC::ARMAssembler::patchConstantPoolLoad):
+ (JSC::ARMAssembler::patchPointer):
+ (JSC::ARMAssembler::repatchInt32):
+ (JSC::ARMAssembler::repatchPointer):
+ (JSC::ARMAssembler::repatchLoadPtrToLEA):
+ (JSC::ARMAssembler::linkJump):
+ (JSC::ARMAssembler::relinkJump):
+ (JSC::ARMAssembler::linkCall):
+ (JSC::ARMAssembler::relinkCall):
+ (JSC::ARMAssembler::getRelocatedAddress):
+ (JSC::ARMAssembler::getDifferenceBetweenLabels):
+ (JSC::ARMAssembler::getCallReturnOffset):
+ (JSC::ARMAssembler::getOp2Byte):
+ (JSC::ARMAssembler::placeConstantPoolBarrier):
+ (JSC::ARMAssembler::RM):
+ (JSC::ARMAssembler::RS):
+ (JSC::ARMAssembler::RD):
+ (JSC::ARMAssembler::RN):
+ (JSC::ARMAssembler::getConditionalField):
+ * assembler/ARMv7Assembler.h:
+ (JSC::ARMv7Assembler::JmpSrc::enableLatePatch):
+ * assembler/AbstractMacroAssembler.h:
+ (JSC::AbstractMacroAssembler::Call::enableLatePatch):
+ (JSC::AbstractMacroAssembler::Jump::enableLatePatch):
+ * assembler/MacroAssembler.h:
+ * assembler/MacroAssemblerARM.h: Added.
+ (JSC::MacroAssemblerARM::):
+ (JSC::MacroAssemblerARM::add32):
+ (JSC::MacroAssemblerARM::and32):
+ (JSC::MacroAssemblerARM::lshift32):
+ (JSC::MacroAssemblerARM::mul32):
+ (JSC::MacroAssemblerARM::not32):
+ (JSC::MacroAssemblerARM::or32):
+ (JSC::MacroAssemblerARM::rshift32):
+ (JSC::MacroAssemblerARM::sub32):
+ (JSC::MacroAssemblerARM::xor32):
+ (JSC::MacroAssemblerARM::load32):
+ (JSC::MacroAssemblerARM::load32WithAddressOffsetPatch):
+ (JSC::MacroAssemblerARM::loadPtrWithPatchToLEA):
+ (JSC::MacroAssemblerARM::load16):
+ (JSC::MacroAssemblerARM::store32WithAddressOffsetPatch):
+ (JSC::MacroAssemblerARM::store32):
+ (JSC::MacroAssemblerARM::pop):
+ (JSC::MacroAssemblerARM::push):
+ (JSC::MacroAssemblerARM::move):
+ (JSC::MacroAssemblerARM::swap):
+ (JSC::MacroAssemblerARM::signExtend32ToPtr):
+ (JSC::MacroAssemblerARM::zeroExtend32ToPtr):
+ (JSC::MacroAssemblerARM::branch32):
+ (JSC::MacroAssemblerARM::branch16):
+ (JSC::MacroAssemblerARM::branchTest32):
+ (JSC::MacroAssemblerARM::jump):
+ (JSC::MacroAssemblerARM::branchAdd32):
+ (JSC::MacroAssemblerARM::mull32):
+ (JSC::MacroAssemblerARM::branchMul32):
+ (JSC::MacroAssemblerARM::branchSub32):
+ (JSC::MacroAssemblerARM::breakpoint):
+ (JSC::MacroAssemblerARM::nearCall):
+ (JSC::MacroAssemblerARM::call):
+ (JSC::MacroAssemblerARM::ret):
+ (JSC::MacroAssemblerARM::set32):
+ (JSC::MacroAssemblerARM::setTest32):
+ (JSC::MacroAssemblerARM::tailRecursiveCall):
+ (JSC::MacroAssemblerARM::makeTailRecursiveCall):
+ (JSC::MacroAssemblerARM::moveWithPatch):
+ (JSC::MacroAssemblerARM::branchPtrWithPatch):
+ (JSC::MacroAssemblerARM::storePtrWithPatch):
+ (JSC::MacroAssemblerARM::supportsFloatingPoint):
+ (JSC::MacroAssemblerARM::supportsFloatingPointTruncate):
+ (JSC::MacroAssemblerARM::loadDouble):
+ (JSC::MacroAssemblerARM::storeDouble):
+ (JSC::MacroAssemblerARM::addDouble):
+ (JSC::MacroAssemblerARM::subDouble):
+ (JSC::MacroAssemblerARM::mulDouble):
+ (JSC::MacroAssemblerARM::convertInt32ToDouble):
+ (JSC::MacroAssemblerARM::branchDouble):
+ (JSC::MacroAssemblerARM::branchTruncateDoubleToInt32):
+ (JSC::MacroAssemblerARM::ARMCondition):
+ (JSC::MacroAssemblerARM::prepareCall):
+ (JSC::MacroAssemblerARM::call32):
+ * assembler/X86Assembler.h:
+ (JSC::X86Assembler::JmpSrc::enableLatePatch):
+ * jit/ExecutableAllocator.h:
+ (JSC::ExecutableAllocator::cacheFlush):
+ * wtf/Platform.h:
+ * yarr/RegexJIT.cpp:
+ (JSC::Yarr::RegexGenerator::generateEnter):
+ (JSC::Yarr::RegexGenerator::generateReturn):
+
+2009-07-17 Gabor Loki <loki@inf.u-szeged.hu>
+
+ Reviewed by Gavin Barraclough.
+
+ Extend AssemblerBuffer with constant pool handling mechanism.
+ https://bugs.webkit.org/show_bug.cgi?id=24986
+
+ Add a platform independed constant pool framework.
+ This pool can store 32 or 64 bits values which is enough to hold
+ any integer, pointer or double constant.
+
+ * assembler/AssemblerBuffer.h:
+ (JSC::AssemblerBuffer::putIntUnchecked):
+ (JSC::AssemblerBuffer::putInt64Unchecked):
+ (JSC::AssemblerBuffer::append):
+ (JSC::AssemblerBuffer::grow):
+ * assembler/AssemblerBufferWithConstantPool.h: Added.
+ (JSC::):
+
+2009-07-17 Eric Roman <eroman@chromium.org>
+
+ Reviewed by Darin Adler.
+
+ Build fix for non-Darwin.
+ Add a guard for inclusion of RetainPtr.h which includes CoreFoundation.h
+
+ https://bugs.webkit.org/show_bug.cgi?id=27382
+
+ * wtf/unicode/icu/CollatorICU.cpp:
+
+2009-07-17 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by John Sullivan.
+
+ Get user default collation order via a CFLocale API when available.
+
+ * wtf/unicode/icu/CollatorICU.cpp: (WTF::Collator::userDefault):
+
+2009-07-17 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Fix the include path for the Symbian port
+ https://bugs.webkit.org/show_bug.cgi?id=27358
+
+ * JavaScriptCore.pri:
+
+2009-07-17 Csaba Osztrogonac <oszi@inf.u-szeged.hu>
+
+ Reviewed by David Levin.
+
+ Build fix on platforms don't have MMAP.
+ https://bugs.webkit.org/show_bug.cgi?id=27365
+
+ * interpreter/RegisterFile.h: Including stdio.h irrespectively of HAVE(MMAP)
+
+2009-07-16 Fumitoshi Ukai <ukai@chromium.org>
+
+ Reviewed by David Levin.
+
+ Add --web-sockets flag and ENABLE_WEB_SOCKETS define.
+ https://bugs.webkit.org/show_bug.cgi?id=27206
+
+ Add ENABLE_WEB_SOCKETS
+
+ * Configurations/FeatureDefines.xcconfig: add ENABLE_WEB_SOCKETS
+
+2009-07-16 Maxime Simon <simon.maxime@gmail.com>
+
+ Reviewed by Eric Seidel.
+
+ Added Haiku-specific files for JavaScriptCore.
+ https://bugs.webkit.org/show_bug.cgi?id=26620
+
+ * wtf/haiku/MainThreadHaiku.cpp: Added.
+ (WTF::initializeMainThreadPlatform):
+ (WTF::scheduleDispatchFunctionsOnMainThread):
+
+2009-07-16 Gavin Barraclough <barraclough@apple.com>
+
+ RS by Oliver Hunt.
+
+ Revert r45969, this fix does not appear to be valid.
+ https://bugs.webkit.org/show_bug.cgi?id=27077
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::~CodeBlock):
+ (JSC::CodeBlock::unlinkCallers):
+ * jit/JIT.cpp:
+ * jit/JIT.h:
+
+2009-07-16 Zoltan Horvath <hzoltan@inf.u-szeged.hu>
+
+ Reviewed by Oliver Hunt.
+
+ Allow custom memory allocation control in ExceptionInfo and RareData struct
+ https://bugs.webkit.org/show_bug.cgi?id=27336
+
+ Inherits ExceptionInfo and RareData struct from FastAllocBase because these
+ have been instantiated by 'new' in JavaScriptCore/bytecode/CodeBlock.cpp:1289 and
+ in JavaScriptCore/bytecode/CodeBlock.h:453.
+
+ Remove unnecessary WTF:: namespace from CodeBlock inheritance.
+
+ * bytecode/CodeBlock.h:
+
+2009-07-16 Mark Rowe <mrowe@apple.com>
+
+ Rubber-stamped by Geoff Garen.
+
+ Fix FeatureDefines.xcconfig to not be out of sync with the rest of the world.
+
+ * Configurations/FeatureDefines.xcconfig:
+
+2009-07-16 Yong Li <yong.li@torchmobile.com>
+
+ Reviewed by George Staikos.
+
+ https://bugs.webkit.org/show_bug.cgi?id=27320
+ _countof is only included in CE6; for CE5 we need to define it ourself
+
+ * wtf/Platform.h:
+
+2009-07-16 Zoltan Herczeg <zherczeg@inf.u-szeged.hu>
+
+ Reviewed by Oliver Hunt.
+
+ Workers + garbage collector: weird crashes
+ https://bugs.webkit.org/show_bug.cgi?id=27077
+
+ We need to unlink cached method call sites when a function is destroyed.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::~CodeBlock):
+ (JSC::CodeBlock::unlinkCallers):
+ * jit/JIT.cpp:
+ (JSC::JIT::unlinkMethodCall):
+ * jit/JIT.h:
+
+2009-07-15 Steve Falkenburg <sfalken@apple.com>
+
+ Windows Build fix.
+
+ Visual Studio reset our intermediate directory on us.
+ This sets it back.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.vcproj/testapi/testapi.vcproj:
+
+2009-07-15 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Eric Seidel.
+
+ https://bugs.webkit.org/show_bug.cgi?id=26794
+ Make Yacc-generated parsers to use fastMalloc/fastFree.
+
+ Define YYMALLOC and YYFREE to fastMalloc and fastFree
+ respectively.
+
+ * parser/Grammar.y:
+
+2009-07-15 Darin Adler <darin@apple.com>
+
+ Fix a build for a particular Apple configuration.
+
+ * wtf/FastAllocBase.h: Change include to use "" style for
+ including another wtf header. This is the style we use for
+ including other public headers in the same directory.
+
+2009-07-15 George Staikos <george.staikos@torchmobile.com>
+
+ Reviewed by Adam Treat.
+
+ https://bugs.webkit.org/show_bug.cgi?id=27303
+ Implement createThreadInternal for WinCE.
+ Contains changes by George Staikos <george.staikos@torchmobile.com> and Joe Mason <joe.mason@torchmobile.com>
+
+ * wtf/ThreadingWin.cpp:
+ (WTF::createThreadInternal):
+
+2009-07-15 Joe Mason <joe.mason@torchmobile.com>
+
+ Reviewed by George Staikos.
+
+ https://bugs.webkit.org/show_bug.cgi?id=27298
+ Platform defines for WINCE.
+ Contains changes by Yong Li <yong.li@torchmobile.com>,
+ George Staikos <george.staikos@torchmobile.com> and Joe Mason <joe.mason@torchmobile.com>
+
+ * wtf/Platform.h:
+
+2009-07-15 Yong Li <yong.li@torchmobile.com>
+
+ Reviewed by Adam Treat.
+
+ https://bugs.webkit.org/show_bug.cgi?id=27306
+ Use RegisterClass instead of RegisterClassEx on WinCE.
+
+ * wtf/win/MainThreadWin.cpp:
+ (WTF::initializeMainThreadPlatform):
+
+2009-07-15 Yong Li <yong.li@torchmobile.com>
+
+ Reviewed by George Staikos.
+
+ https://bugs.webkit.org/show_bug.cgi?id=27301
+ Use OutputDebugStringW on WinCE since OutputDebugStringA is not supported
+ Originally written by Yong Li <yong.li@torchmobile.com> and refactored by
+ Joe Mason <joe.mason@torchmobile.com>
+
+ * wtf/Assertions.cpp: vprintf_stderr_common
+
+2009-07-15 Yong Li <yong.li@torchmobile.com>
+
+ Reviewed by George Staikos.
+
+ https://bugs.webkit.org/show_bug.cgi?id=27020
+ msToGregorianDateTime should set utcOffset to 0 when outputIsUTC is false
+
+ * wtf/DateMath.cpp:
+ (WTF::gregorianDateTimeToMS):
+
+2009-07-15 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Cleanup - Remove obsolete code from the make system
+ https://bugs.webkit.org/show_bug.cgi?id=27299
+
+ * JavaScriptCore.pro:
+ * jsc.pro:
+
+2009-07-07 Norbert Leser <norbert.leser@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ https://bugs.webkit.org/show_bug.cgi?id=27056
+
+ Alternate bool operator for codewarrior compiler (WINSCW).
+ Compiler (latest b482) reports error for UnspecifiedBoolType construct:
+ "illegal explicit conversion from 'WTF::OwnArrayPtr<JSC::Register>' to 'bool'"
+
+ Same fix as in r38391.
+
+ * JavaScriptCore/wtf/OwnArrayPtr.h:
+
+2009-07-15 Norbert Leser <norbert.leser@nokia.com>
+
+ Reviewed by Darin Adler.
+
+ Qualify include path with wtf to fix compilation
+ on Symbian.
+ https://bugs.webkit.org/show_bug.cgi?id=27055
+
+ * interpreter/Interpreter.h:
+
+2009-07-15 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Dave Kilzer.
+
+ Turn off non-portable date manipulations for SYMBIAN
+ https://bugs.webkit.org/show_bug.cgi?id=27064
+
+ Introduce HAVE(TM_GMTOFF), HAVE(TM_ZONE) and HAVE(TIMEGM) guards
+ and place the rules for controlling the guards in Platform.h.
+ Turn off these newly introduced guards for SYMBIAN.
+
+ * wtf/DateMath.cpp:
+ (WTF::calculateUTCOffset):
+ * wtf/DateMath.h:
+ (WTF::GregorianDateTime::GregorianDateTime):
+ (WTF::GregorianDateTime::operator tm):
+ * wtf/Platform.h:
+
+2009-07-15 Norbert Leser <norbert.leser@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Undef ASSERT on Symbian, to avoid excessive warnings
+ https://bugs.webkit.org/show_bug.cgi?id=27052
+
+ * wtf/Assertions.h:
+
+2009-07-15 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Simon Hausmann.
+
+ REGRESSION: fast/js/postfix-syntax.html fails with interpreter
+ https://bugs.webkit.org/show_bug.cgi?id=27294
+
+ When postfix operators operating on locals assign to the same local
+ the order of operations has to be to store the incremented value, then
+ store the unmodified number. Rather than implementing this subtle
+ semantic in the interpreter I've just made the logic explicit in the
+ bytecode generator, so x=x++ effectively becomes x=ToNumber(x) (for a
+ local var x).
+
+ * parser/Nodes.cpp:
+ (JSC::emitPostIncOrDec):
+
+2009-07-15 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Simon Hausmann.
+
+ REGRESSION(43559): fast/js/kde/arguments-scope.html fails with interpreter
+ https://bugs.webkit.org/show_bug.cgi?id=27259
+
+ The interpreter was incorrectly basing its need to create the arguments object
+ based on the presence of the callframe's argument reference rather than the local
+ arguments reference. Based on this it then overrode the local variable reference.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+
+2009-07-14 Steve Falkenburg <sfalken@apple.com>
+
+ Reorganize JavaScriptCore headers into:
+ API: include/JavaScriptCore/
+ Private: include/private/JavaScriptCore/
+
+ Reviewed by Darin Adler.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make:
+ * JavaScriptCore.vcproj/testapi/testapi.vcproj:
+ * JavaScriptCore.vcproj/testapi/testapiCommon.vsprops:
+
+2009-07-14 Zoltan Horvath <hzoltan@inf.u-szeged.hu>
+
+ Reviewed by Darin Adler.
+
+ Change JSCell's superclass to NoncopyableCustomAllocated
+ https://bugs.webkit.org/show_bug.cgi?id=27248
+
+ JSCell class customizes operator new, since Noncopyable will be
+ inherited from FastAllocBase, NoncopyableCustomAllocated has
+ to be used.
+
+ * runtime/JSCell.h:
+
+2009-07-14 Zoltan Horvath <hzoltan@inf.u-szeged.hu>
+
+ Reviewed by Darin Adler.
+
+ Change all Noncopyable inheriting visibility to public.
+ https://bugs.webkit.org/show_bug.cgi?id=27225
+
+ Change all Noncopyable inheriting visibility to public because
+ it is needed to the custom allocation framework (bug #20422).
+
+ * bytecode/SamplingTool.h:
+ * bytecompiler/RegisterID.h:
+ * interpreter/CachedCall.h:
+ * interpreter/RegisterFile.h:
+ * parser/Lexer.h:
+ * parser/Parser.h:
+ * runtime/ArgList.h:
+ * runtime/BatchedTransitionOptimizer.h:
+ * runtime/Collector.h:
+ * runtime/CommonIdentifiers.h:
+ * runtime/JSCell.h:
+ * runtime/JSGlobalObject.h:
+ * runtime/JSLock.h:
+ * runtime/JSONObject.cpp:
+ * runtime/SmallStrings.cpp:
+ * runtime/SmallStrings.h:
+ * wtf/CrossThreadRefCounted.h:
+ * wtf/GOwnPtr.h:
+ * wtf/Locker.h:
+ * wtf/MessageQueue.h:
+ * wtf/OwnArrayPtr.h:
+ * wtf/OwnFastMallocPtr.h:
+ * wtf/OwnPtr.h:
+ * wtf/RefCounted.h:
+ * wtf/ThreadSpecific.h:
+ * wtf/Threading.h:
+ * wtf/Vector.h:
+ * wtf/unicode/Collator.h:
+
+2009-07-14 Zoltan Horvath <hzoltan@inf.u-szeged.hu>
+
+ Reviewed by Darin Adler.
+
+ Change ParserArenaRefCounted's superclass to RefCountedCustomAllocated
+ https://bugs.webkit.org/show_bug.cgi?id=27249
+
+ ParserArenaDeletable customizes operator new, to avoid double inheritance
+ ParserArenaDeletable's superclass has been changed to RefCountedCustomAllocated.
+
+ * parser/Nodes.h:
+
+2009-07-14 Zoltan Horvath <hzoltan@inf.u-szeged.hu>
+
+ Reviewed by Darin Adler.
+
+ Add RefCountedCustomAllocated to RefCounted.h
+ https://bugs.webkit.org/show_bug.cgi?id=27232
+
+ Some class which are inherited from RefCounted customize
+ operator new, but RefCounted is inherited from Noncopyable
+ which will be inherited from FastAllocBase. To avoid
+ conflicts Noncopyable inheriting was moved down to RefCounted
+ and to avoid double inheritance this class has been added.
+
+ * wtf/RefCounted.h:
+ (WTF::RefCountedCustomAllocated::deref):
+ (WTF::RefCountedCustomAllocated::~RefCountedCustomAllocated):
+
+2009-07-14 Zoltan Horvath <hzoltan@inf.u-szeged.hu>
+
+ Reviewed by Darin Adler.
+
+ Add NoncopyableCustomAllocated to Noncopyable.h.
+ https://bugs.webkit.org/show_bug.cgi?id=27228
+
+ Some classes which inherited from Noncopyable overrides operator new
+ since Noncopyable'll be inherited from FastAllocBase, Noncopyable.h
+ needs to be extended with this new class to support the overriding.
+
+ * wtf/Noncopyable.h:
+ (WTFNoncopyable::NoncopyableCustomAllocated::NoncopyableCustomAllocated):
+ (WTFNoncopyable::NoncopyableCustomAllocated::~NoncopyableCustomAllocated):
+
+2009-07-14 Zoltan Horvath <hzoltan@inf.u-szeged.hu>
+
+ Reviewed by Darin Adler.
+
+ Allow custom memory allocation control for JavaScriptCore's IdentifierTable class
+ https://bugs.webkit.org/show_bug.cgi?id=27260
+
+ Inherits IdentifierTable class from FastAllocBase because it has been
+ instantiated by 'new' in JavaScriptCore/runtime/Identifier.cpp:70.
+
+ * runtime/Identifier.cpp:
+
+2009-07-14 Zoltan Horvath <hzoltan@inf.u-szeged.hu>
+
+ Reviewed by Darin Adler.
+
+ Allow custom memory allocation control for JavaScriptCore's Profiler class
+ https://bugs.webkit.org/show_bug.cgi?id=27253
+
+ Inherits Profiler class from FastAllocBase because it has been instantiated by
+ 'new' in JavaScriptCore/profiler/Profiler.cpp:56.
+
+ * profiler/Profiler.h:
+
+2009-07-06 George Staikos <george.staikos@torchmobile.com>
+
+ Reviewed by Adam Treat.
+
+ Authors: George Staikos <george.staikos@torchmobile.com>, Joe Mason <joe.mason@torchmobile.com>, Makoto Matsumoto <matumoto@math.keio.ac.jp>, Takuji Nishimura
+
+ https://bugs.webkit.org/show_bug.cgi?id=27030
+ Implement custom RNG for WinCE using Mersenne Twister
+
+ * wtf/RandomNumber.cpp:
+ (WTF::randomNumber):
+ * wtf/RandomNumberSeed.h:
+ (WTF::initializeRandomNumberGenerator):
+ * wtf/wince/mt19937ar.c: Added.
+ (init_genrand):
+ (init_by_array):
+ (genrand_int32):
+ (genrand_int31):
+ (genrand_real1):
+ (genrand_real2):
+ (genrand_real3):
+ (genrand_res53):
+
+2009-07-13 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk>
+
+ Unreviewed make dist build fix.
+
+ * GNUmakefile.am:
+
+2009-07-13 Drew Wilson <atwilson@google.com>
+
+ Reviewed by David Levin.
+
+ Add ENABLE(SHARED_WORKERS) flag and define SharedWorker APIs
+ https://bugs.webkit.org/show_bug.cgi?id=26932
+
+ Added ENABLE(SHARED_WORKERS) flag (off by default).
+
+ * Configurations/FeatureDefines.xcconfig:
+
+2009-07-07 Norbert Leser <norbert.leser@nokia.com>
+
+ Reviewed by Maciej Stachoviak.
+
+ https://bugs.webkit.org/show_bug.cgi?id=27058
+
+ Removed superfluous parenthesis around single expression.
+ Compilers on Symbian platform fail to properly parse and compile.
+
+ * JavaScriptCore/wtf/Platform.h:
+
+2009-07-13 Norbert Leser <norbert.leser@nokia.com>
+
+ Reviewed by Maciej Stachoviak.
+
+ https://bugs.webkit.org/show_bug.cgi?id=27054
+
+ Renamed Translator to HashTranslator
+
+ Codewarrior compiler (WINSCW) latest b482 cannot resolve typename
+ mismatch between template declaration and definition
+ (HashTranslator / Translator)
+
+ * wtf/HashSet.h:
+
+2009-07-13 Norbert Leser <norbert.leser@nokia.com>
+
+ Reviewed by Eric Seidel.
+
+ https://bugs.webkit.org/show_bug.cgi?id=27053
+
+ Ambiguity in LabelScope initialization
+
+ Codewarrior compiler (WINSCW) latest b482 on Symbian cannot resolve
+ type of "0" unambiguously. Set expression explicitly to
+ PassRefPtr<Label>::PassRefPtr()
+
+ * bytecompiler/BytecodeGenerator.cpp
+
+2009-07-11 Simon Fraser <simon.fraser@apple.com>
+
+ Enable support for accelerated compositing and 3d transforms on Leopard.
+ <https://bugs.webkit.org/show_bug.cgi?id=20166>
+ <rdar://problem/6120614>
+
+ Reviewed by Oliver Hunt.
+
+ * Configurations/FeatureDefines.xcconfig:
+ * wtf/Platform.h:
+
+2009-07-10 Mark Rowe <mrowe@apple.com>
+
+ Second part of the "make Windows happier" dance.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-07-10 Mark Rowe <mrowe@apple.com>
+
+ Try and make the Windows build happy.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-07-10 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Geoffrey Garen.
+
+ * debugger/Debugger.h: Made this function virtual for use in WebCore's
+ WebInspector.
+
+2009-07-10 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Darin Adler.
+
+ ParserArenaDeletable should override delete
+ https://bugs.webkit.org/show_bug.cgi?id=26790
+
+ ParserArenaDeletable overrides new, but it does not override delete.
+ ParserArenaDeletable must be freed by fastFree
+ because it is allocated by fastMalloc.
+
+ * parser/NodeConstructors.h:
+ (JSC::ParserArenaDeletable::operator delete):
+ * parser/Nodes.h:
+
+2009-07-10 Adam Roben <aroben@apple.com>
+
+ Sort all our Xcode projects
+
+ Accomplished using sort-Xcode-project-file.
+
+ Requested by Dave Kilzer.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
+2009-07-09 Maciej Stachowiak <mjs@apple.com>
+
+ Not reviewed, build fix.
+
+ Windows build fix for the last change.
+
+ * wtf/dtoa.cpp: Forgot to include Vector.h
+
+2009-07-09 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin Adler.
+
+ REGRESSION: crash in edge cases of floating point parsing.
+ https://bugs.webkit.org/show_bug.cgi?id=27110
+ <rdar://problem/7044458>
+
+ Tests: fast/css/number-parsing-crash.html
+ fast/css/number-parsing-crash.html
+ fast/js/number-parsing-crash.html
+
+ * wtf/dtoa.cpp:
+ (WTF::BigInt::BigInt): Converted this to more a proper class, using a Vector
+ with inline capacity
+
+ (WTF::lshift): Rearranged logic somewhat nontrivially to deal with the new way of sizing BigInts.
+ Added an assertion to verify that invariants are maintained.
+
+ All other functions are adapted fairly mechanically to the above changes.
+ (WTF::BigInt::clear):
+ (WTF::BigInt::size):
+ (WTF::BigInt::resize):
+ (WTF::BigInt::words):
+ (WTF::BigInt::append):
+ (WTF::multadd):
+ (WTF::s2b):
+ (WTF::i2b):
+ (WTF::mult):
+ (WTF::cmp):
+ (WTF::diff):
+ (WTF::b2d):
+ (WTF::d2b):
+ (WTF::ratio):
+ (WTF::strtod):
+ (WTF::quorem):
+ (WTF::dtoa):
+
+2009-07-09 Drew Wilson <atwilson@google.com>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Turned on CHANNEL_MESSAGING by default because the MessageChannel API
+ can now be implemented for Web Workers and is reasonably stable.
+
+ * Configurations/FeatureDefines.xcconfig:
+
+2009-07-09 Oliver Hunt <oliver@apple.com>
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+
+2009-07-09 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Bug 27016 - Interpreter crashes due to invalid array indexes
+ <https://bugs.webkit.org/show_bug.cgi?id=27016>
+
+ Unsigned vs signed conversions results in incorrect behaviour in
+ 64bit interpreter builds.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::privateExecute):
+
+2009-07-09 Dimitri Glazkov <dglazkov@chromium.org>
+
+ Reviewed by Darin Fisher.
+
+ [Chromium] Upstream JavaScriptCore.gypi, the project file for Chromium build.
+ https://bugs.webkit.org/show_bug.cgi?id=27135
+
+ * JavaScriptCore.gypi: Added.
+
+2009-07-09 Joe Mason <joe.mason@torchmobile.com>
+
+ Reviewed by George Staikos.
+
+ Authors: Yong Li <yong.li@torchmobile.com>, Joe Mason <joe.mason@torchmobile.com>
+
+ https://bugs.webkit.org/show_bug.cgi?id=27031
+ Add an override for deleteOwnedPtr(HDC) on Windows
+
+ * wtf/OwnPtrCommon.h:
+ * wtf/OwnPtrWin.cpp:
+ (WTF::deleteOwnedPtr):
+
+2009-07-09 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Darin Adler.
+
+ Guard singal.h dependency with HAVE(SIGNAL_H) to enable building jsc
+ on SYMBIAN.
+
+ https://bugs.webkit.org/show_bug.cgi?id=27026
+
+ Based on Norbert Leser's work.
+
+ * jsc.cpp:
+ (printUsageStatement):
+ (parseArguments):
+ * wtf/Platform.h:
+
+2009-07-07 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Stop loading constants into the register file.
+
+ Instead, use high register values (highest bit bar the sign bit set) to indicate
+ constants in the instruction stream, and when we encounter such a value load it
+ directly from the CodeBlock.
+
+ Since constants are no longer copied into the register file, this patch renders
+ the 'unexpected constant' mechanism redundant, and removes it.
+
+ 2% improvement, thanks to Sam Weinig.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::dump):
+ (JSC::CodeBlock::CodeBlock):
+ (JSC::CodeBlock::mark):
+ (JSC::CodeBlock::shrinkToFit):
+ * bytecode/CodeBlock.h:
+ (JSC::CodeBlock::isTemporaryRegisterIndex):
+ (JSC::CodeBlock::constantRegister):
+ (JSC::CodeBlock::isConstantRegisterIndex):
+ (JSC::CodeBlock::getConstant):
+ (JSC::ExecState::r):
+ * bytecode/Opcode.h:
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::preserveLastVar):
+ (JSC::BytecodeGenerator::BytecodeGenerator):
+ (JSC::BytecodeGenerator::addConstantValue):
+ (JSC::BytecodeGenerator::emitEqualityOp):
+ (JSC::BytecodeGenerator::emitLoad):
+ (JSC::BytecodeGenerator::emitResolveBase):
+ (JSC::BytecodeGenerator::emitResolveWithBase):
+ (JSC::BytecodeGenerator::emitNewError):
+ * bytecompiler/BytecodeGenerator.h:
+ (JSC::BytecodeGenerator::emitNode):
+ * interpreter/CallFrame.h:
+ (JSC::ExecState::noCaller):
+ (JSC::ExecState::hasHostCallFrameFlag):
+ (JSC::ExecState::addHostCallFrameFlag):
+ (JSC::ExecState::removeHostCallFrameFlag):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::resolve):
+ (JSC::Interpreter::resolveSkip):
+ (JSC::Interpreter::resolveGlobal):
+ (JSC::Interpreter::resolveBase):
+ (JSC::Interpreter::resolveBaseAndProperty):
+ (JSC::Interpreter::resolveBaseAndFunc):
+ (JSC::Interpreter::dumpRegisters):
+ (JSC::Interpreter::throwException):
+ (JSC::Interpreter::createExceptionScope):
+ (JSC::Interpreter::privateExecute):
+ (JSC::Interpreter::retrieveArguments):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileMainPass):
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::emitLoadDouble):
+ (JSC::JIT::emitLoadInt32ToDouble):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_new_error):
+ (JSC::JIT::emit_op_enter):
+ (JSC::JIT::emit_op_enter_with_activation):
+ * parser/Nodes.cpp:
+ (JSC::DeleteResolveNode::emitBytecode):
+ (JSC::DeleteValueNode::emitBytecode):
+ (JSC::PrefixResolveNode::emitBytecode):
+ * runtime/JSActivation.cpp:
+ (JSC::JSActivation::JSActivation):
+ * wtf/Platform.h:
+
+2009-07-07 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Fix <https://bugs.webkit.org/show_bug.cgi?id=27025> / <rdar://problem/7033448>.
+ Bug 27025: Crashes and regression test failures related to regexps in 64-bit
+
+ For x86_64 RegexGenerator uses rbx, a callee-save register, as a scratch register but
+ neglects to save and restore it. The change in handling of the output vector in r45545
+ altered code generation so that the RegExp::match was now storing important data in rbx,
+ which caused crashes and bogus results when it was clobbered.
+
+ * yarr/RegexJIT.cpp:
+ (JSC::Yarr::RegexGenerator::generateEnter): Save rbx.
+ (JSC::Yarr::RegexGenerator::generateReturn): Restore rbx.
+
+2009-07-06 Ada Chan <adachan@apple.com>
+
+ Reviewed by Darin Adler and Mark Rowe.
+
+ Decommitted spans are added to the list of normal spans rather than
+ the returned spans in TCMalloc_PageHeap::Delete().
+ https://bugs.webkit.org/show_bug.cgi?id=26998
+
+ In TCMalloc_PageHeap::Delete(), the deleted span can be decommitted in
+ the process of merging with neighboring spans that are also decommitted.
+ The merged span needs to be placed in the list of returned spans (spans
+ whose memory has been returned to the system). Right now it's always added
+ to the list of the normal spans which can theoretically cause thrashing.
+
+ * wtf/FastMalloc.cpp:
+ (WTF::TCMalloc_PageHeap::Delete):
+
+2009-07-05 Lars Knoll <lars.knoll@nokia.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ https://bugs.webkit.org/show_bug.cgi?id=26843
+
+ Fix run-time crashes in JavaScriptCore with the Metrowerks compiler on Symbian.
+
+ The Metrowerks compiler on the Symbian platform moves the globally
+ defined Hashtables into read-only memory, despite one of the members
+ being mutable. This causes crashes at run-time due to write access to
+ read-only memory.
+
+ Avoid the use of const with this compiler by introducing the
+ JSC_CONST_HASHTABLE macro.
+
+ Based on idea by Norbert Leser.
+
+ * runtime/Lookup.h: Define JSC_CONST_HASHTABLE as const for !WINSCW.
+ * create_hash_table: Use JSC_CONST_HASHTABLE for hashtables.
+ * runtime/JSGlobalData.cpp: Import various global hashtables via the macro.
+
+2009-07-04 Dan Bernstein <mitz@apple.com>
+
+ - debug build fix
+
+ * runtime/RegExpConstructor.cpp:
+ (JSC::RegExpConstructor::getLastParen):
+
+2009-07-03 Yong Li <yong.li@torchmobile.com>
+
+ Reviewed by Maciej Stachowiak (and revised slightly)
+
+ RegExp::match to be optimized
+ https://bugs.webkit.org/show_bug.cgi?id=26957
+
+ Allow regexp matching to use Vectors with inline capacity instead of
+ allocating a new ovector buffer every time.
+
+ ~5% speedup on SunSpider string-unpack-code test, 0.3% on SunSpider overall.
+
+ * runtime/RegExp.cpp:
+ (JSC::RegExp::match):
+ * runtime/RegExp.h:
+ * runtime/RegExpConstructor.cpp:
+ (JSC::RegExpConstructorPrivate::RegExpConstructorPrivate):
+ (JSC::RegExpConstructorPrivate::lastOvector):
+ (JSC::RegExpConstructorPrivate::tempOvector):
+ (JSC::RegExpConstructorPrivate::changeLastOvector):
+ (JSC::RegExpConstructor::performMatch):
+ (JSC::RegExpMatchesArray::RegExpMatchesArray):
+ (JSC::RegExpMatchesArray::fillArrayInstance):
+ (JSC::RegExpConstructor::getBackref):
+ (JSC::RegExpConstructor::getLastParen):
+ (JSC::RegExpConstructor::getLeftContext):
+ (JSC::RegExpConstructor::getRightContext):
+ * runtime/StringPrototype.cpp:
+ (JSC::stringProtoFuncSplit):
+
+2009-06-30 Kwang Yul Seo <skyul@company100.net>
+
+ Reviewed by Eric Seidel.
+
+ Override operator new/delete with const std::nothrow_t& as the second
+ argument.
+ https://bugs.webkit.org/show_bug.cgi?id=26792
+
+ On Windows CE, operator new/delete, new[]/delete[] with const
+ std::nothrow_t& must be overrided because some standard template
+ libraries use these operators.
+
+ The problem occurs when memory allocated by new(size_t s, const
+ std::nothrow_t&) is freed by delete(void* p). This causes the umatched
+ malloc/free problem.
+
+ The patch overrides all new, delete, new[] and delete[] to use
+ fastMaloc and fastFree consistently.
+
+ * wtf/FastMalloc.h:
+ (throw):
+
+2009-06-30 Gabor Loki <loki@inf.u-szeged.hu>
+
+ Reviewed by Sam Weinig.
+
+ <https://bugs.webkit.org/show_bug.cgi?id=24986>
+
+ Remove unnecessary references to AssemblerBuffer.
+
+ * interpreter/Interpreter.cpp:
+ * interpreter/Interpreter.h:
+
+2009-06-29 David Levin <levin@chromium.org>
+
+ Reviewed by Oliver Hunt.
+
+ Still seeing occasional leaks from UString::sharedBuffer code
+ https://bugs.webkit.org/show_bug.cgi?id=26420
+
+ The problem is that the pointer to the memory allocation isn't visible
+ by "leaks" due to the lower bits being used as flags. The fix is to
+ make the pointer visible in memory (in debug only). The downside of
+ this fix that the memory allocated by sharedBuffer will still look like
+ a leak in non-debug builds when any flags are set.
+
+ * wtf/PtrAndFlags.h:
+ (WTF::PtrAndFlags::set):
+
+2009-06-29 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Mark Rowe.
+
+ Remove more unused scons support.
+
+ * SConstruct: Removed.
+
+2009-06-29 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ <rdar://problem/7016214> JSON.parse fails to parse valid JSON with most Unicode characters
+ <https://bugs.webkit.org/show_bug.cgi?id=26802>
+
+ In the original JSON.parse patch unicode was handled correctly, however in some last
+ minute "clean up" I oversimplified isSafeStringCharacter. This patch corrects this bug.
+
+ * runtime/LiteralParser.cpp:
+ (JSC::isSafeStringCharacter):
+ (JSC::LiteralParser::Lexer::lexString):
+
+2009-06-26 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Dan Bernstein.
+
+ <rdar://problem/7009684> REGRESSION(r45039): Crashes inside JSEvent::put on PowerPC (26746)
+ <https://bugs.webkit.org/show_bug.cgi?id=26746>
+
+ Fix for r45039 incorrectly uncached a get_by_id by converting it to put_by_id. Clearly this
+ is less than correct. This patch corrects that error.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::tryCacheGetByID):
+
+2009-06-26 Eric Seidel <eric@webkit.org>
+
+ No review, only rolling out r45259.
+
+ Roll out r45259 after crash appeared on the bots:
+ plugins/undefined-property-crash.html
+ ASSERTION FAILED: s <= HeapConstants<heapType>::cellSize
+ (leopard-intel-debug-tests/build/JavaScriptCore/runtime/Collector.cpp:278
+ void* JSC::Heap::heapAllocate(size_t) [with JSC::HeapType heapType = PrimaryHeap])
+
+ * runtime/DateInstance.cpp:
+ * runtime/Identifier.cpp:
+ * runtime/Lookup.h:
+ * runtime/RegExpConstructor.cpp:
+ * runtime/RegExpObject.h:
+ * runtime/ScopeChain.h:
+ * runtime/UString.h:
+
+2009-06-26 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Add support for QDataStream operators to Vector.
+
+ * wtf/Vector.h:
+ (WTF::operator<<):
+ (WTF::operator>>):
+
+2009-06-24 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Gavin Barraclough.
+
+ Make the opcode sampler work once again.
+
+ * jit/JIT.h:
+ (JSC::JIT::compileGetByIdProto):
+ (JSC::JIT::compileGetByIdSelfList):
+ (JSC::JIT::compileGetByIdProtoList):
+ (JSC::JIT::compileGetByIdChainList):
+ (JSC::JIT::compileGetByIdChain):
+ (JSC::JIT::compilePutByIdTransition):
+ (JSC::JIT::compileCTIMachineTrampolines):
+ (JSC::JIT::compilePatchGetArrayLength):
+ * jit/JITStubCall.h:
+ (JSC::JITStubCall::call):
+
+2009-06-24 Zoltan Horvath <hzoltan@inf.u-szeged.hu>
+
+ Reviewed by Maciej Stachowiak.
+
+ Extend FastAllocBase.h with 'using WTF::FastAllocBase' to avoid
+ unnecessary WTF:: usings.
+ Remove existing unnecessary WTF:: usings.
+
+ * interpreter/Interpreter.h:
+ * profiler/CallIdentifier.h:
+ * runtime/ScopeChain.h:
+ * wtf/FastAllocBase.h:
+
+2009-06-24 David Levin <levin@chromium.org>
+
+ Fix all builds.
+
+ * bytecode/CodeBlock.h:
+ * bytecompiler/BytecodeGenerator.h:
+ * interpreter/Register.h:
+
+2009-06-24 Zoltan Horvath <hzoltan@inf.u-szeged.hu>
+
+ Reviewed by Maciej Stachowiak.
+
+ https://bugs.webkit.org/show_bug.cgi?id=26677
+
+ Inherits CodeBlock class from FastAllocBase because it
+ has been instantiated by 'new' in JavaScriptCore/bytecode/CodeBlock.h:217.
+
+ * bytecode/CodeBlock.h:
+
+2009-06-24 Zoltan Horvath <hzoltan@inf.u-szeged.hu>
+
+ Reviewed by Maciej Stachowiak.
+
+ https://bugs.webkit.org/show_bug.cgi?id=26676
+
+ Inherits BytecodeGenerator class from FastAllocBase because it has been
+ instantiated by 'new' in JavaScriptCore/parser/Nodes.cpp:1892.
+
+ * bytecompiler/BytecodeGenerator.h:
+
+2009-06-24 Zoltan Horvath <hzoltan@inf.u-szeged.hu>
+
+ Reviewed by Maciej Stachowiak.
+
+ https://bugs.webkit.org/show_bug.cgi?id=26675
+
+ Inherits Register class from FastAllocBase because it has been
+ instantiated by 'new' in JavaScriptCore/runtime/JSVariableObject.h:149.
+
+ * interpreter/Register.h:
+
+2009-06-24 Zoltan Horvath <hzoltan@inf.u-szeged.hu>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=26674
+
+ Inherits HashMap class from FastAllocBase because it has been
+ instantiated by 'new' in JavaScriptCore/runtime/Structure.cpp:458.
+
+ * wtf/HashMap.h:
+
+2009-06-24 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Darin Adler.
+
+ <rdar://problem/6940519> REGRESSION (Safari 4 Public Beta - TOT): google.com/adplanner shows blank page instead of site details in "basic research'
+
+ The problem was caused by the page returned with a function using a
+ var declaration list containing around ~3000 variables. The solution
+ to this is to flatten the comma expression representation and make
+ codegen comma expressions and initializer lists iterative rather than
+ recursive.
+
+ * parser/Grammar.y:
+ * parser/NodeConstructors.h:
+ (JSC::CommaNode::CommaNode):
+ * parser/Nodes.cpp:
+ (JSC::CommaNode::emitBytecode):
+ * parser/Nodes.h:
+ (JSC::ExpressionNode::isCommaNode):
+ (JSC::CommaNode::isCommaNode):
+ (JSC::CommaNode::append):
+
+2009-06-24 Zoltan Horvath <hzoltan@inf.u-szeged.hu>
+
+ Reviewed by Maciej Stachowiak.
+
+ https://bugs.webkit.org/show_bug.cgi?id=26645
+
+ Inherits ScopeChainNode class from FastAllocBase because it has been
+ instantiated by 'new' in JavaScriptCore/runtime/ScopeChain.h:95.
+
+ * wtf/RefPtr.h:
+
+2009-06-24 Zoltan Horvath <hzoltan@inf.u-szeged.hu>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=26648
+
+ Inherits Deque class from FastAllocBase because it has been
+ instantiated by 'new' with DEFINE_STATIC_LOCAL macro in
+ JavaScriptCore/wtf/MainThread.cpp:62.
+
+ * wtf/Deque.h:
+
+2009-06-24 Zoltan Horvath <hzoltan@inf.u-szeged.hu>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=26644
+
+ Inherits RefPtr class from FastAllocBase because it has been
+ instantiated by 'new' in JavaScriptCore/runtime/StructureChain.cpp:41.
+
+ * wtf/RefPtr.h:
+
+2009-06-24 Zoltan Horvath <hzoltan@inf.u-szeged.hu>
+
+ Reviewed by Darin Adler.
+
+ Inherits HashSet class from FastAllocBase, because it has been
+ instantiated by 'new' in JavaScriptCore/runtime/Collector.h:116.
+
+ * wtf/HashSet.h:
+
+2009-06-24 Zoltan Horvath <hzoltan@inf.u-szeged.hu>
+
+ Reviewed by Darin Adler.
+
+ Inherits Vector class from FastAllocBase because it has been
+ instantiated by 'new' in JavaScriptCore/runtime/Structure.cpp:633.
+
+ * wtf/Vector.h:
+
+2009-06-24 Norbert Leser <norbert.leser@nokia.com>
+
+ Reviewed by Maciej Stachoviak.
+
+ The BytecodeGenerator objects were instantiated on stack, which takes up ~38kB per instance
+ (each instance includes copy of JSC::CodeBlock with large SymbolTable, etc.).
+ Specifically, since there is nested invocation (e.g., GlobalCode --> FunctionCode),
+ the stack overflows immediately on Symbian hardware (max. 80 kB).
+ Proposed change allocates generator objects on heap.
+ Performance impact (if any) should be negligible and change is proposed as general fix,
+ rather than ifdef'd for SYMBIAN.
+
+ * parser/Nodes.cpp:
+ (JSC::ProgramNode::generateBytecode):
+ (JSC::EvalNode::generateBytecode):
+ (JSC::EvalNode::bytecodeForExceptionInfoReparse):
+ (JSC::FunctionBodyNode::generateBytecode):
+ (JSC::FunctionBodyNode::bytecodeForExceptionInfoReparse):
+
+2009-06-23 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ <rdar://problem/6992806> REGRESSION: Enumeration can skip new properties in cases of prototypes that have more than 64 (26593)
+ <https://bugs.webkit.org/show_bug.cgi?id=26593>
+
+ Do not attempt to cache structure chains if they contain a dictionary at any level.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::tryCachePutByID):
+ (JSC::Interpreter::tryCacheGetByID):
+ * jit/JITStubs.cpp:
+ (JSC::JITThunks::tryCachePutByID):
+ * runtime/Structure.cpp:
+ (JSC::Structure::getEnumerablePropertyNames):
+ (JSC::Structure::addPropertyTransition):
+ * runtime/StructureChain.cpp:
+ (JSC::StructureChain::isCacheable):
+ * runtime/StructureChain.h:
+
+2009-06-23 Yong Li <yong.li@torchmobile.com>
+
+ Reviewed by George Staikos.
+
+ https://bugs.webkit.org/show_bug.cgi?id=26654
+ Add the proper export define for the JavaScriptCore API when building for WINCE.
+
+ * API/JSBase.h:
+
+2009-06-23 Joe Mason <joe.mason@torchmobile.com>
+
+ Reviewed by Adam Treat.
+
+ Authors: Yong Li <yong.li@torchmobile.com>, Joe Mason <joe.mason@torchmobile.com>
+
+ https://bugs.webkit.org/show_bug.cgi?id=26611
+ Implement currentThreadStackBase on WINCE by adding a global,
+ g_stackBase, which must be set to the address of a local variable
+ by the caller before calling any WebKit function that invokes JSC.
+
+ * runtime/Collector.cpp:
+ (JSC::isPageWritable):
+ (JSC::getStackBase):
+ Starts at the top of the stack and returns the entire range of
+ consecutive writable pages as an estimate of the actual stack.
+ This will be much bigger than the actual stack range, so some
+ dead objects can't be collected, but it guarantees live objects
+ aren't collected prematurely.
+
+ (JSC::currentThreadStackBase):
+ On WinCE, returns g_stackBase if set or call getStackBase as a
+ fallback if not.
+
+2009-06-23 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Fix stupid performance problem in the LiteralParser
+
+ The LiteralParser was making a new UString in order to use
+ toDouble, however UString's toDouble allows a much wider range
+ of numberic strings than the LiteralParser accepts, and requires
+ an additional heap allocation or two for the construciton of the
+ UString. To rectify this we just call WTF::dtoa directly using
+ a stack allocated buffer to hold the validated numeric literal.
+
+ * runtime/LiteralParser.cpp:
+ (JSC::LiteralParser::Lexer::lexNumber):
+ (JSC::LiteralParser::parse):
+ * runtime/LiteralParser.h:
+
+2009-06-22 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Bug 26640: JSON.stringify needs to special case Boolean objects
+ <https://bugs.webkit.org/show_bug.cgi?id=26640>
+
+ Add special case handling of the Boolean object so we match current
+ ES5 errata.
+
+ * runtime/JSONObject.cpp:
+ (JSC::unwrapBoxedPrimitive): renamed from unwrapNumberOrString
+ (JSC::gap):
+ (JSC::Stringifier::appendStringifiedValue):
+
+2009-06-22 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Bug 26591: Support revivers in JSON.parse
+ <https://bugs.webkit.org/show_bug.cgi?id=26591>
+
+ Add reviver support to JSON.parse. This completes the JSON object.
+
+ * runtime/JSONObject.cpp:
+ (JSC::Walker::Walker):
+ (JSC::Walker::callReviver):
+ (JSC::Walker::walk):
+ (JSC::JSONProtoFuncParse):
+
+2009-06-21 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Bug 26592: Support standard toJSON functions
+ <https://bugs.webkit.org/show_bug.cgi?id=26592>
+
+ Add support for the standard Date.toJSON function.
+
+ * runtime/DatePrototype.cpp:
+ (JSC::dateProtoFuncToJSON):
+
+2009-06-21 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Bug 26594: JSC needs to support Date.toISOString
+ <https://bugs.webkit.org/show_bug.cgi?id=26594>
+
+ Add support for Date.toISOString.
+
+ * runtime/DatePrototype.cpp:
+ (JSC::dateProtoFuncToISOString):
+
+2009-06-21 Oliver Hunt <oliver@apple.com>
+
+ Remove dead code.
+
+ * runtime/LiteralParser.cpp:
+ (JSC::LiteralParser::parse):
+
+2009-06-21 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Darin Adler and Cameron Zwarich.
+
+ Bug 26587: Support JSON.parse
+ <https://bugs.webkit.org/show_bug.cgi?id=26587>
+
+ Extend the LiteralParser to support the full strict JSON
+ grammar, fix a few places where the grammar was incorrectly
+ lenient. Doesn't yet support the JSON.parse reviver function
+ but that does not block the JSON.parse functionality itself.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::callEval):
+ * runtime/JSGlobalObjectFunctions.cpp:
+ (JSC::globalFuncEval):
+ * runtime/JSONObject.cpp:
+ (JSC::JSONProtoFuncParse):
+ * runtime/LiteralParser.cpp:
+ (JSC::LiteralParser::Lexer::lex):
+ (JSC::isSafeStringCharacter):
+ (JSC::LiteralParser::Lexer::lexString):
+ (JSC::LiteralParser::parse):
+ * runtime/LiteralParser.h:
+ (JSC::LiteralParser::LiteralParser):
+ (JSC::LiteralParser::tryJSONParse):
+ (JSC::LiteralParser::):
+ (JSC::LiteralParser::Lexer::Lexer):
+
+2009-06-21 David Levin <levin@chromium.org>
+
+ Reviewed by NOBODY (speculative build fix for windows).
+
+ Simply removed some whitespace form this file to make windows build wtf and
+ hopefully copy the new MessageQueque.h so that WebCore picks it up.
+
+ * wtf/Assertions.cpp:
+
+2009-06-21 Drew Wilson <atwilson@google.com>
+
+ Reviewed by David Levin.
+
+ <https://bugs.webkit.org/show_bug.cgi?id=25043>
+ Added support for multi-threaded MessagePorts.
+
+ * wtf/MessageQueue.h:
+ (WTF::::appendAndCheckEmpty):
+ Added API to test whether the queue was empty before adding an element.
+
+2009-06-20 David D. Kilzer <ddkilzer@webkit.org>
+
+ Fix namespace comment in SegmentedVector.h
+
+ * wtf/SegmentedVector.h: Updated namespace comment to reflect
+ new namespace after r44897.
+
+2009-06-20 Zoltan Herczeg <zherczeg@inf.u-szeged.hu>
+
+ Bug 24986: ARM JIT port
+ <https://bugs.webkit.org/show_bug.cgi?id=24986>
+
+ Reviewed by Oliver Hunt.
+
+ An Iterator added for SegmentedVector. Currently
+ only the pre ++ operator is supported.
+
+ * wtf/SegmentedVector.h:
+ (WTF::SegmentedVectorIterator::~SegmentedVectorIterator):
+ (WTF::SegmentedVectorIterator::operator*):
+ (WTF::SegmentedVectorIterator::operator->):
+ (WTF::SegmentedVectorIterator::operator++):
+ (WTF::SegmentedVectorIterator::operator==):
+ (WTF::SegmentedVectorIterator::operator!=):
+ (WTF::SegmentedVectorIterator::operator=):
+ (WTF::SegmentedVectorIterator::SegmentedVectorIterator):
+ (WTF::SegmentedVector::alloc):
+ (WTF::SegmentedVector::begin):
+ (WTF::SegmentedVector::end):
+
+2009-06-20 Zoltan Herczeg <zherczeg@inf.u-szeged.hu>
+
+ Bug 24986: ARM JIT port
+ <https://bugs.webkit.org/show_bug.cgi?id=24986>
+
+ Reviewed by Oliver Hunt.
+
+ Move SegmentedVector to /wtf subdirectory
+ and change "namespace JSC" to "namespace WTF"
+
+ Additional build file updates by David Kilzer.
+
+ * GNUmakefile.am: Updated path to SegmentedVector.h.
+ * JavaScriptCore.order: Updated SegmentedVector namespace from
+ JSC to WTF in mangled C++ method name.
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ Removed reference to bytecompiler\SegmentedVector.h.
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj: Added reference to
+ wtf\SegmentedVector.h.
+ * JavaScriptCore.xcodeproj/project.pbxproj: Moved
+ SegmentedVector.h definition from bytecompiler subdirectory to
+ wtf subdirectory.
+ * bytecompiler/BytecodeGenerator.h: Updated #include path to
+ SegmentedVector.h and prepended WTF:: namespace to its use.
+ * parser/Lexer.h: Ditto.
+ * wtf/SegmentedVector.h: Renamed from JavaScriptCore/bytecompiler/SegmentedVector.h.
+ (WTF::SegmentedVector::SegmentedVector):
+ (WTF::SegmentedVector::~SegmentedVector):
+ (WTF::SegmentedVector::size):
+ (WTF::SegmentedVector::at):
+ (WTF::SegmentedVector::operator[]):
+ (WTF::SegmentedVector::last):
+ (WTF::SegmentedVector::append):
+ (WTF::SegmentedVector::removeLast):
+ (WTF::SegmentedVector::grow):
+ (WTF::SegmentedVector::clear):
+ (WTF::SegmentedVector::deleteAllSegments):
+ (WTF::SegmentedVector::segmentExistsFor):
+ (WTF::SegmentedVector::segmentFor):
+ (WTF::SegmentedVector::subscriptFor):
+ (WTF::SegmentedVector::ensureSegmentsFor):
+ (WTF::SegmentedVector::ensureSegment):
+
+2009-06-19 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by NOBODY (build fix take 2 - rename FIELD_OFFSET to something that doesn't conflict with winnt.h).
+
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompile):
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ (JSC::JIT::emitGetVariableObjectRegister):
+ (JSC::JIT::emitPutVariableObjectRegister):
+ * jit/JIT.h:
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emit_op_rshift):
+ (JSC::JIT::emitSlow_op_jnless):
+ (JSC::JIT::emitSlow_op_jnlesseq):
+ (JSC::JIT::compileBinaryArithOp):
+ * jit/JITCall.cpp:
+ (JSC::JIT::compileOpCallInitializeCallFrame):
+ (JSC::JIT::compileOpCall):
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::restoreArgumentReference):
+ (JSC::JIT::checkStructure):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_instanceof):
+ (JSC::JIT::emit_op_get_scoped_var):
+ (JSC::JIT::emit_op_put_scoped_var):
+ (JSC::JIT::emit_op_construct_verify):
+ (JSC::JIT::emit_op_resolve_global):
+ (JSC::JIT::emit_op_jeq_null):
+ (JSC::JIT::emit_op_jneq_null):
+ (JSC::JIT::emit_op_to_jsnumber):
+ (JSC::JIT::emit_op_catch):
+ (JSC::JIT::emit_op_eq_null):
+ (JSC::JIT::emit_op_neq_null):
+ (JSC::JIT::emit_op_convert_this):
+ (JSC::JIT::emit_op_profile_will_call):
+ (JSC::JIT::emit_op_profile_did_call):
+ (JSC::JIT::emitSlow_op_get_by_val):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::emit_op_get_by_val):
+ (JSC::JIT::emit_op_put_by_val):
+ (JSC::JIT::emit_op_method_check):
+ (JSC::JIT::compileGetByIdHotPath):
+ (JSC::JIT::emit_op_put_by_id):
+ (JSC::JIT::compilePutDirectOffset):
+ (JSC::JIT::compileGetDirectOffset):
+ (JSC::JIT::privateCompilePutByIdTransition):
+ (JSC::JIT::privateCompilePatchGetArrayLength):
+ * jit/JITStubs.cpp:
+ (JSC::JITThunks::JITThunks):
+
+2009-06-19 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by NOBODY (Windows build fix).
+
+ * jit/JIT.h:
+ * jit/JITInlineMethods.h:
+
+2009-06-19 Gabor Loki <loki@inf.u-szeged.hu>
+
+ Reviewed by Gavin Barraclough.
+
+ Reorganize ARM architecture specific macros.
+ Use PLATFORM_ARM_ARCH(7) instead of PLATFORM(ARM_V7).
+
+ Bug 24986: ARM JIT port
+ <https://bugs.webkit.org/show_bug.cgi?id=24986>
+
+ * assembler/ARMv7Assembler.h:
+ * assembler/AbstractMacroAssembler.h:
+ (JSC::AbstractMacroAssembler::Imm32::Imm32):
+ * assembler/MacroAssembler.h:
+ * assembler/MacroAssemblerCodeRef.h:
+ (JSC::MacroAssemblerCodePtr::MacroAssemblerCodePtr):
+ * jit/ExecutableAllocator.h:
+ (JSC::ExecutableAllocator::cacheFlush):
+ * jit/JIT.h:
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::restoreArgumentReferenceForTrampoline):
+ * jit/JITStubs.cpp:
+ * jit/JITStubs.h:
+ * wtf/Platform.h:
+ * yarr/RegexJIT.cpp:
+ (JSC::Yarr::RegexGenerator::generateEnter):
+ (JSC::Yarr::RegexGenerator::generateReturn):
+
+2009-06-19 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Fix armv7 JIT build issues.
+
+ Unfortunate the arm compiler does not like the use of offsetof on JITStackFrame (since it now contains non POD types),
+ and the FIELD_OFFSET macro does not appear constantish enough for it to be happy with its use in COMPILE_ASSERT macros.
+
+ * Replace offsetofs with FIELD_OFFSETs (safe on C++ objects).
+ * Move COMPILE_ASSERTs defending layout of JITStackFrame structure on armv7 into JITThunks constructor.
+
+ * jit/JIT.cpp:
+ * jit/JIT.h:
+ * jit/JITInlineMethods.h:
+ (JSC::JIT::restoreArgumentReference):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_catch):
+ * jit/JITStubs.cpp:
+ (JSC::JITThunks::JITThunks):
+
+2009-06-19 Adam Treat <adam.treat@torchmobile.com>
+
+ Blind attempt at build fix.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-06-19 Zoltan Horvath <hzoltan@inf.u-szeged.hu>
+
+ Reviewed by Oliver Hunt.
+
+ Inherits CallIdentifier struct from FastAllocBase because it has been
+ instantiated by 'new' in JavaScriptCore/profiler/CallIdentifier.h:86.
+
+ * wtf/HashCountedSet.h:
+
+2009-06-19 Adam Treat <adam.treat@torchmobile.com>
+
+ Reviewed by Oliver Hunt.
+
+ https://bugs.webkit.org/show_bug.cgi?id=26540
+ Modify the test shell to add a new function 'checkSyntax' that will
+ only parse the source instead of executing it. In this way we can test
+ pure parsing performance against some of the larger scripts in the wild.
+
+ * jsc.cpp:
+ (GlobalObject::GlobalObject):
+ (functionCheckSyntax):
+
+2009-06-19 Zoltan Horvath <hzoltan@inf.u-szeged.hu>
+
+ Reviewed by Darin Adler.
+
+ Inherits HashCountedSet class from FastAllocBase because it has been
+ instantiated by 'new' in JavaScriptCore/runtime/Collector.cpp:1095.
+
+ * wtf/HashCountedSet.h:
+
+2009-06-19 Yong Li <yong.li@torchmobile.com>
+
+ Reviewed by George Staikos.
+
+ https://bugs.webkit.org/show_bug.cgi?id=26558
+ Declare these symbols extern for WINCE as they are provided by libce.
+
+ * runtime/DateConstructor.cpp:
+ * runtime/DatePrototype.cpp:
+ (JSC::formatLocaleDate):
+
+2009-06-19 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ <rdar://problem/6988973> ScopeChain leak in interpreter builds
+
+ Move the Scopechain destruction code in JSFunction outside of the ENABLE(JIT)
+ path.
+
+ * runtime/JSFunction.cpp:
+ (JSC::JSFunction::~JSFunction):
+ * wtf/Platform.h:
+
+2009-06-19 Yong Li <yong.li@torchmobile.com>
+
+ Reviewed by George Staikos.
+
+ https://bugs.webkit.org/show_bug.cgi?id=26543
+ Windows CE uses 'GetLastError' instead of 'errno.'
+
+ * interpreter/RegisterFile.h:
+ (JSC::RegisterFile::RegisterFile):
+ (JSC::RegisterFile::grow):
+
+2009-06-19 David Levin <levin@chromium.org>
+
+ Reviewed by NOBODY (Windows build fix).
+
+ Add export for Windows corresponding to OSX export done in r44844.
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
+
+2009-06-18 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin "Viceroy of Venezuela" Barraclough.
+
+ Bug 26532: Native functions do not correctly unlink from optimised callsites when they're collected
+ <https://bugs.webkit.org/show_bug.cgi?id=26532> <rdar://problem/6625385>
+
+ We need to make sure that each native function instance correctly unlinks any references to it
+ when it is collected. Allowing this to happen required a few changes:
+ * Every native function needs a codeblock to track the link information
+ * To have this codeblock, every function now also needs its own functionbodynode
+ so we no longer get to have a single shared instance.
+ * Identifying a host function is now done by looking for CodeBlock::codeType() == NativeCode
+
+ * JavaScriptCore.exp:
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::CodeBlock):
+ Constructor for NativeCode CodeBlock
+ (JSC::CodeBlock::derefStructures):
+ (JSC::CodeBlock::refStructures):
+ (JSC::CodeBlock::reparseForExceptionInfoIfNecessary):
+ (JSC::CodeBlock::handlerForBytecodeOffset):
+ (JSC::CodeBlock::lineNumberForBytecodeOffset):
+ (JSC::CodeBlock::expressionRangeForBytecodeOffset):
+ (JSC::CodeBlock::getByIdExceptionInfoForBytecodeOffset):
+ (JSC::CodeBlock::functionRegisterForBytecodeOffset):
+ (JSC::CodeBlock::hasGlobalResolveInstructionAtBytecodeOffset):
+ (JSC::CodeBlock::hasGlobalResolveInfoAtBytecodeOffset):
+ (JSC::CodeBlock::setJITCode):
+ Add assertions to ensure we don't try and use NativeCode CodeBlocks as
+ a normal codeblock.
+
+ * bytecode/CodeBlock.h:
+ (JSC::):
+ (JSC::CodeBlock::source):
+ (JSC::CodeBlock::sourceOffset):
+ (JSC::CodeBlock::evalCodeCache):
+ (JSC::CodeBlock::createRareDataIfNecessary):
+ More assertions.
+
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompileCTIMachineTrampolines):
+ (JSC::JIT::linkCall):
+ Update logic to allow native function caching
+
+ * jit/JITStubs.cpp:
+ * parser/Nodes.cpp:
+ (JSC::FunctionBodyNode::createNativeThunk):
+ (JSC::FunctionBodyNode::isHostFunction):
+ * parser/Nodes.h:
+ * runtime/JSFunction.cpp:
+ (JSC::JSFunction::JSFunction):
+ (JSC::JSFunction::~JSFunction):
+ (JSC::JSFunction::mark):
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::~JSGlobalData):
+ * runtime/JSGlobalData.h:
+
+2009-06-18 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by NOBODY (Windows build fix).
+
+ * wtf/DateMath.cpp:
+ (WTF::calculateUTCOffset):
+
+2009-06-18 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Timezone calculation incorrect in Venezuela.
+
+ https://bugs.webkit.org/show_bug.cgi?id=26531
+ <rdar://problem/6646169> Time is incorrectly reported to JavaScript in both Safari 3 and Firefox 3
+
+ The problem is that we're calculating the timezone relative to 01/01/2000,
+ but the VET timezone changed from -4 hours to -4:30 hours on 12/09/2007.
+ According to the spec, section 15.9.1.9 states "the time since the beginning
+ of the year", presumably meaning the *current* year. Change the calculation
+ to be based on whatever the current year is, rather than a canned date.
+
+ No performance impact.
+
+ * wtf/DateMath.cpp:
+ (WTF::calculateUTCOffset):
+
+2009-06-18 Gavin Barraclough <barraclough@apple.com>
+
+ Rubber Stamped by Mark Rowe (originally reviewed by Sam Weinig).
+
+ (Reintroducing patch added in r44492, and reverted in r44796.)
+
+ Change the implementation of op_throw so the stub function always modifies its
+ return address - if it doesn't find a 'catch' it will switch to a trampoline
+ to force a return from JIT execution. This saves memory, by avoiding the need
+ for a unique return for every op_throw.
+
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_throw):
+ JITStubs::cti_op_throw now always changes its return address,
+ remove return code generated after the stub call (this is now
+ handled by ctiOpThrowNotCaught).
+ * jit/JITStubs.cpp:
+ (JSC::):
+ Add ctiOpThrowNotCaught definitions.
+ (JSC::JITStubs::DEFINE_STUB_FUNCTION):
+ Change cti_op_throw to always change its return address.
+ * jit/JITStubs.h:
+ Add ctiOpThrowNotCaught declaration.
+
+2009-06-18 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ <rdar://problem/6940880> REGRESSION: Breakpoints don't break in 64-bit
+
+ - Exposed functions now needed by WebCore.
+
+ * JavaScriptCore.exp:
+
+2009-06-17 Darin Adler <darin@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 26429: Make JSON.stringify non-recursive so it can handle objects
+ of arbitrary complexity
+ https://bugs.webkit.org/show_bug.cgi?id=26429
+
+ For marking I decided not to use gcProtect, because this is inside the engine
+ so it's easy enough to just do marking. And that darned gcProtect does locking!
+ Oliver tried to convince me to used MarkedArgumentBuffer, but the constructor
+ for that class says "FIXME: Remove all clients of this API, then remove this API."
+
+ * runtime/Collector.cpp:
+ (JSC::Heap::collect): Add a call to JSONObject::markStringifiers.
+
+ * runtime/CommonIdentifiers.cpp:
+ (JSC::CommonIdentifiers::CommonIdentifiers): Added emptyIdentifier.
+ * runtime/CommonIdentifiers.h: Ditto.
+
+ * runtime/JSGlobalData.cpp:
+ (JSC::JSGlobalData::JSGlobalData): Initialize firstStringifierToMark to 0.
+ * runtime/JSGlobalData.h: Added firstStringifierToMark.
+
+ * runtime/JSONObject.cpp: Cut down the includes to the needed ones only.
+ (JSC::unwrapNumberOrString): Added. Helper for unwrapping number and string
+ objects to get their number and string values.
+ (JSC::ReplacerPropertyName::ReplacerPropertyName): Added. The class is used
+ to wrap an identifier or integer so we don't have to do any work unless we
+ actually call a replacer.
+ (JSC::ReplacerPropertyName::value): Added.
+ (JSC::gap): Added. Helper function for the Stringifier constructor.
+ (JSC::PropertyNameForFunctionCall::PropertyNameForFunctionCall): Added.
+ The class is used to wrap an identifier or integer so we don't have to
+ allocate a number or string until we actually call toJSON or a replacer.
+ (JSC::PropertyNameForFunctionCall::asJSValue): Added.
+ (JSC::Stringifier::Stringifier): Updated and moved out of the class
+ definition. Added code to hook this into a singly linked list for marking.
+ (JSC::Stringifier::~Stringifier): Remove from the singly linked list.
+ (JSC::Stringifier::mark): Mark all the objects in the holder stacks.
+ (JSC::Stringifier::stringify): Updated.
+ (JSC::Stringifier::appendQuotedString): Tweaked and streamlined a bit.
+ (JSC::Stringifier::toJSON): Renamed from toJSONValue.
+ (JSC::Stringifier::appendStringifiedValue): Renamed from stringify.
+ Added code to use the m_holderStack to do non-recursive stringify of
+ objects and arrays. This code also uses the timeout checker since in
+ pathological cases it could be slow even without calling into the
+ JavaScript virtual machine.
+ (JSC::Stringifier::willIndent): Added.
+ (JSC::Stringifier::indent): Added.
+ (JSC::Stringifier::unindent): Added.
+ (JSC::Stringifier::startNewLine): Added.
+ (JSC::Stringifier::Holder::Holder): Added.
+ (JSC::Stringifier::Holder::appendNextProperty): Added. This is the
+ function that handles the format of arrays and objects.
+ (JSC::JSONObject::getOwnPropertySlot): Moved this down to the bottom
+ of the file so the JSONObject class is not interleaved with the
+ Stringifier class.
+ (JSC::JSONObject::markStringifiers): Added. Calls mark.
+ (JSC::JSONProtoFuncStringify): Streamlined the code here. The code
+ to compute the gap string is now a separate function.
+
+ * runtime/JSONObject.h: Made everything private. Added markStringifiers.
+
+2009-06-17 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ <rdar://problem/6974140> REGRESSION(r43849): Crash in cti_op_call_NotJSFunction when getting directions on maps.google.com
+
+ Roll out r43849 as it appears that we cannot rely on the address of
+ an objects property storage being constant even if the structure is
+ unchanged.
+
+ * jit/JIT.h:
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::compileGetDirectOffset):
+ (JSC::JIT::privateCompileGetByIdProto):
+ (JSC::JIT::privateCompileGetByIdProtoList):
+ (JSC::JIT::privateCompileGetByIdChainList):
+ (JSC::JIT::privateCompileGetByIdChain):
+
+2009-06-17 Gavin Barraclough <barraclough@apple.com>
+
+ Rubber Stamped by Mark Rowe.
+
+ Fully revert r44492 & r44748 while we fix a bug they cause on internal builds <rdar://problem/6955963>.
+
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_throw):
+ * jit/JITStubs.cpp:
+ (JSC::):
+ (JSC::JITStubs::DEFINE_STUB_FUNCTION):
+ * jit/JITStubs.h:
+
+2009-06-17 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Mark Rowe.
+
+ <rdar://problem/6947426> sunspider math-cordic.js exhibits different intermediate results running 32-bit vs. 64-bit
+
+ On 64-bit, NaN-encoded values must be detagged before they can be used in rshift.
+
+ No performance impact.
+
+ * jit/JITArithmetic.cpp:
+ (JSC::JIT::emit_op_rshift):
+
+2009-06-17 Adam Treat <adam.treat@torchmobile.com>
+
+ Reviewed by George Staikos.
+
+ https://bugs.webkit.org/show_bug.cgi?id=23155
+ Move WIN_CE -> WINCE as previously discussed with Qt WINCE folks.
+
+ * jsc.cpp:
+ (main):
+
+2009-06-17 George Staikos <george.staikos@torchmobile.com>
+
+ Reviewed by Adam Treat.
+
+ https://bugs.webkit.org/show_bug.cgi?id=23155
+ Move WIN_CE -> WINCE as previously discussed with Qt WINCE folks.
+
+ * config.h:
+ * jsc.cpp:
+ * wtf/Assertions.cpp:
+ * wtf/Assertions.h:
+ * wtf/CurrentTime.cpp:
+ (WTF::lowResUTCTime):
+ * wtf/DateMath.cpp:
+ (WTF::getLocalTime):
+ * wtf/MathExtras.h:
+ * wtf/Platform.h:
+ * wtf/StringExtras.h:
+ * wtf/Threading.h:
+ * wtf/win/MainThreadWin.cpp:
+
+2009-06-17 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ <rdar://problem/6974175> ASSERT in JITStubs.cpp at appsaccess.apple.com
+
+ Remove PropertySlot::putValue - PropertySlots should only be used for getting,
+ not putting. Rename JSGlobalObject::getOwnPropertySlot to hasOwnPropertyForWrite,
+ which is what it really was being used to ask, and remove some other getOwnPropertySlot
+ & getOwnPropertySlotForWrite methods, which were unused and likely to lead to confusion.
+
+ * runtime/JSGlobalObject.h:
+ (JSC::JSGlobalObject::hasOwnPropertyForWrite):
+ * runtime/JSObject.h:
+ * runtime/JSStaticScopeObject.cpp:
+ * runtime/JSStaticScopeObject.h:
+ * runtime/PropertySlot.h:
+
+2009-06-16 Gavin Barraclough <barraclough@apple.com>
+
+ Reviewed by Oliver hunt.
+
+ Temporarily partially disable r44492, since this is causing some problems on internal builds.
+
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_throw):
+ * jit/JITStubs.cpp:
+ (JSC::JITStubs::DEFINE_STUB_FUNCTION):
+
+2009-06-16 Sam Weinig <sam@webkit.org>
+
+ Fix windows build.
+
+ * jit/JIT.cpp:
+ (JSC::JIT::JIT):
+
+2009-06-16 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Oliver Hunt.
+
+ Initialize m_bytecodeIndex to -1 in JIT, and correctly initialize
+ it for each type of stub using the return address to find the correct
+ offset.
+
+ * jit/JIT.cpp:
+ (JSC::JIT::JIT):
+ * jit/JIT.h:
+ (JSC::JIT::compileGetByIdProto):
+ (JSC::JIT::compileGetByIdSelfList):
+ (JSC::JIT::compileGetByIdProtoList):
+ (JSC::JIT::compileGetByIdChainList):
+ (JSC::JIT::compileGetByIdChain):
+ (JSC::JIT::compilePutByIdTransition):
+ (JSC::JIT::compileCTIMachineTrampolines):
+ (JSC::JIT::compilePatchGetArrayLength):
+ * jit/JITStubCall.h:
+ (JSC::JITStubCall::call):
+
+== Rolled over to ChangeLog-2009-06-16 ==
diff --git a/Source/JavaScriptCore/Configurations/Base.xcconfig b/Source/JavaScriptCore/Configurations/Base.xcconfig
new file mode 100644
index 0000000..09b6de1
--- /dev/null
+++ b/Source/JavaScriptCore/Configurations/Base.xcconfig
@@ -0,0 +1,141 @@
+// Copyright (C) 2009, 2010 Apple Inc. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+DEBUG_INFORMATION_FORMAT = dwarf;
+GCC_C_LANGUAGE_STANDARD = gnu99;
+GCC_DEBUGGING_SYMBOLS = default;
+GCC_DYNAMIC_NO_PIC = NO;
+GCC_ENABLE_CPP_EXCEPTIONS = NO;
+GCC_ENABLE_CPP_RTTI = NO;
+GCC_ENABLE_OBJC_EXCEPTIONS = YES;
+GCC_ENABLE_OBJC_GC = $(GCC_ENABLE_OBJC_GC_$(REAL_PLATFORM_NAME));
+GCC_ENABLE_OBJC_GC_iphoneos = NO;
+GCC_ENABLE_OBJC_GC_iphonesimulator = NO;
+GCC_ENABLE_OBJC_GC_macosx = supported;
+GCC_ENABLE_SYMBOL_SEPARATION = NO;
+GCC_FAST_OBJC_DISPATCH = YES;
+GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+GCC_INLINES_ARE_PRIVATE_EXTERN = YES;
+GCC_MODEL_TUNING = $(GCC_MODEL_TUNING_$(REAL_PLATFORM_NAME));
+GCC_MODEL_TUNING_macosx = G5;
+GCC_OBJC_CALL_CXX_CDTORS = YES;
+GCC_PRECOMPILE_PREFIX_HEADER = YES;
+GCC_PREPROCESSOR_DEFINITIONS = $(DEBUG_DEFINES) HAVE_DTRACE=$(HAVE_DTRACE) WEBKIT_VERSION_MIN_REQUIRED=WEBKIT_VERSION_LATEST $(GCC_PREPROCESSOR_DEFINITIONS);
+GCC_STRICT_ALIASING = YES;
+GCC_THREADSAFE_STATICS = NO;
+GCC_TREAT_WARNINGS_AS_ERRORS = YES;
+GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO;
+GCC_WARN_ABOUT_MISSING_NEWLINE = YES;
+GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
+GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES;
+LINKER_DISPLAYS_MANGLED_NAMES = YES;
+PREBINDING = NO;
+VALID_ARCHS = $(VALID_ARCHS_$(REAL_PLATFORM_NAME));
+VALID_ARCHS_iphoneos = $(ARCHS_STANDARD_32_BIT);
+VALID_ARCHS_iphonesimulator = $(ARCHS_STANDARD_32_BIT);
+VALID_ARCHS_macosx = i386 ppc x86_64 ppc64 $(ARCHS_UNIVERSAL_IPHONE_OS);
+WARNING_CFLAGS_BASE = -Wall -Wextra -Wcast-qual -Wchar-subscripts -Wextra-tokens -Wformat=2 -Winit-self -Wmissing-format-attribute -Wmissing-noreturn -Wpacked -Wpointer-arith -Wredundant-decls -Wundef -Wwrite-strings;
+WARNING_CFLAGS = $(WARNING_CFLAGS_$(REAL_PLATFORM_NAME));
+WARNING_CFLAGS_iphoneos = $(WARNING_CFLAGS_BASE) -Wshorten-64-to-32;
+WARNING_CFLAGS_iphonesimulator = $(WARNING_CFLAGS_BASE) -Wshorten-64-to-32;
+WARNING_CFLAGS_macosx = $(WARNING_CFLAGS_macosx_$(CURRENT_ARCH));
+WARNING_CFLAGS_macosx_ = $(WARNING_CFLAGS_BASE) -Wshorten-64-to-32;
+WARNING_CFLAGS_macosx_i386 = $(WARNING_CFLAGS_BASE) -Wshorten-64-to-32;
+WARNING_CFLAGS_macosx_ppc = $(WARNING_CFLAGS_BASE) -Wshorten-64-to-32;
+// FIXME: JavaScriptCore 64-bit builds should build with -Wshorten-64-to-32
+WARNING_CFLAGS_macosx_ppc64 = $(WARNING_CFLAGS_BASE);
+WARNING_CFLAGS_macosx_x86_64 = $(WARNING_CFLAGS_BASE);
+HEADER_SEARCH_PATHS = . icu $(HEADER_SEARCH_PATHS);
+
+
+REAL_PLATFORM_NAME = $(REAL_PLATFORM_NAME_$(PLATFORM_NAME));
+REAL_PLATFORM_NAME_ = $(REAL_PLATFORM_NAME_macosx);
+REAL_PLATFORM_NAME_iphoneos = iphoneos;
+REAL_PLATFORM_NAME_iphonesimulator = iphonesimulator;
+REAL_PLATFORM_NAME_macosx = macosx;
+
+TARGET_MAC_OS_X_VERSION_MAJOR = $(MAC_OS_X_VERSION_MAJOR);
+
+
+// DEBUG_DEFINES, GCC_OPTIMIZATION_LEVEL, STRIP_INSTALLED_PRODUCT and DEAD_CODE_STRIPPING vary between the debug and normal variants.
+// We set up the values for each variant here, and have the Debug configuration in the Xcode project use the _debug variant.
+DEBUG_DEFINES_debug = ;
+DEBUG_DEFINES_normal = NDEBUG;
+DEBUG_DEFINES = $(DEBUG_DEFINES_$(CURRENT_VARIANT));
+
+GCC_OPTIMIZATION_LEVEL = $(GCC_OPTIMIZATION_LEVEL_$(CURRENT_VARIANT));
+GCC_OPTIMIZATION_LEVEL_normal = 3;
+GCC_OPTIMIZATION_LEVEL_debug = 0;
+
+STRIP_INSTALLED_PRODUCT = $(STRIP_INSTALLED_PRODUCT_$(CURRENT_VARIANT));
+STRIP_INSTALLED_PRODUCT_normal = YES;
+STRIP_INSTALLED_PRODUCT_debug = NO;
+
+DEAD_CODE_STRIPPING_debug = NO;
+DEAD_CODE_STRIPPING_normal = YES;
+DEAD_CODE_STRIPPING = $(DEAD_CODE_STRIPPING_$(CURRENT_VARIANT));
+
+SECTORDER_FLAGS = -sectorder __TEXT __text JavaScriptCore.order;
+
+// Use GCC 4.2 with Xcode 3.1, which includes GCC 4.2 but defaults to GCC 4.0.
+// Note that Xcode versions as new as 3.1.2 use XCODE_VERSION_ACTUAL for the minor version
+// number. Newer versions of Xcode use XCODE_VERSION_MINOR for the minor version, and
+// XCODE_VERSION_ACTUAL for the full version number.
+TARGET_GCC_VERSION = $(TARGET_GCC_VERSION_$(REAL_PLATFORM_NAME));
+TARGET_GCC_VERSION_iphoneos = LLVM_GCC_42;
+TARGET_GCC_VERSION_iphonesimulator = GCC_42;
+TARGET_GCC_VERSION_macosx = $(TARGET_GCC_VERSION_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR));
+TARGET_GCC_VERSION_macosx_ = $(TARGET_GCC_VERSION_macosx_1040);
+TARGET_GCC_VERSION_macosx_1040 = GCC_40;
+TARGET_GCC_VERSION_macosx_1050 = $(TARGET_GCC_VERSION_macosx_1050_$(XCODE_VERSION_MINOR));
+TARGET_GCC_VERSION_macosx_1050_ = $(TARGET_GCC_VERSION_macosx_1050_$(XCODE_VERSION_ACTUAL));
+TARGET_GCC_VERSION_macosx_1050_0310 = GCC_42;
+TARGET_GCC_VERSION_macosx_1050_0320 = GCC_42;
+TARGET_GCC_VERSION_macosx_1060 = GCC_42;
+TARGET_GCC_VERSION_macosx_1070 = LLVM_GCC_42;
+
+GCC_VERSION = $(GCC_VERSION_$(TARGET_GCC_VERSION));
+GCC_VERSION_GCC_40 = 4.0;
+GCC_VERSION_GCC_42 = 4.2;
+GCC_VERSION_LLVM_GCC_42 = com.apple.compilers.llvmgcc42;
+
+// If the target Mac OS X version does not match the current Mac OS X version then we'll want to build using the target version's SDK.
+SDKROOT = $(SDKROOT_$(MAC_OS_X_VERSION_MAJOR)_$(TARGET_MAC_OS_X_VERSION_MAJOR));
+SDKROOT_1050_1040 = macosx10.4;
+SDKROOT_1060_1040 = macosx10.4;
+SDKROOT_1060_1050 = macosx10.5;
+SDKROOT_1070_1040 = macosx10.4;
+SDKROOT_1070_1050 = macosx10.5;
+SDKROOT_1070_1060 = macosx10.6;
+
+
+// HAVE_DTRACE is disabled on Leopard due to <rdar://problem/5628149>
+HAVE_DTRACE = $(HAVE_DTRACE_$(REAL_PLATFORM_NAME));
+HAVE_DTRACE_iphoneos = 1;
+HAVE_DTRACE_iphonesimulator = 1;
+HAVE_DTRACE_macosx = $(HAVE_DTRACE_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR));
+HAVE_DTRACE_macosx_ = $(HAVE_DTRACE_macosx_1040);
+HAVE_DTRACE_macosx_1040 = 0;
+HAVE_DTRACE_macosx_1050 = 0;
+HAVE_DTRACE_macosx_1060 = 1;
+HAVE_DTRACE_macosx_1070 = 1;
diff --git a/Source/JavaScriptCore/Configurations/DebugRelease.xcconfig b/Source/JavaScriptCore/Configurations/DebugRelease.xcconfig
new file mode 100644
index 0000000..a98e1ce
--- /dev/null
+++ b/Source/JavaScriptCore/Configurations/DebugRelease.xcconfig
@@ -0,0 +1,50 @@
+// Copyright (C) 2009, 2010 Apple Inc. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#include "Base.xcconfig"
+
+ARCHS = $(ARCHS_$(REAL_PLATFORM_NAME));
+ARCHS_iphoneos = $(ARCHS_UNIVERSAL_IPHONE_OS);
+ARCHS_iphonesimulator = $(NATIVE_ARCH);
+ARCHS_macosx = $(ARCHS_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR));
+ARCHS_macosx_ = $(ARCHS_macosx_1040);
+ARCHS_macosx_1040 = $(NATIVE_ARCH);
+ARCHS_macosx_1050 = $(NATIVE_ARCH);
+ARCHS_macosx_1060 = $(ARCHS_STANDARD_32_64_BIT);
+ARCHS_macosx_1070 = $(ARCHS_STANDARD_32_64_BIT);
+
+ONLY_ACTIVE_ARCH = YES;
+
+MACOSX_DEPLOYMENT_TARGET = $(MACOSX_DEPLOYMENT_TARGET_$(REAL_PLATFORM_NAME));
+MACOSX_DEPLOYMENT_TARGET_iphoneos = 10.5;
+MACOSX_DEPLOYMENT_TARGET_iphonesimulator = 10.5;
+MACOSX_DEPLOYMENT_TARGET_macosx = $(MACOSX_DEPLOYMENT_TARGET_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR));
+MACOSX_DEPLOYMENT_TARGET_macosx_ = 10.4;
+MACOSX_DEPLOYMENT_TARGET_macosx_1040 = 10.4;
+MACOSX_DEPLOYMENT_TARGET_macosx_1050 = 10.5;
+MACOSX_DEPLOYMENT_TARGET_macosx_1060 = 10.6;
+MACOSX_DEPLOYMENT_TARGET_macosx_1070 = 10.7;
+
+GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = YES;
+
+SECTORDER_FLAGS = ;
diff --git a/Source/JavaScriptCore/Configurations/FeatureDefines.xcconfig b/Source/JavaScriptCore/Configurations/FeatureDefines.xcconfig
new file mode 100644
index 0000000..46d5de4
--- /dev/null
+++ b/Source/JavaScriptCore/Configurations/FeatureDefines.xcconfig
@@ -0,0 +1,124 @@
+// Copyright (C) 2009, 2010 Apple Inc. All rights reserved.
+// Copyright (C) 2009 Google Inc. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The contents of this file must be kept in sync with FeatureDefines.xcconfig in JavaScriptCore,
+// WebCore and WebKit. Also the default values of the ENABLE_FEATURE_NAME macros in build-webkit
+// should match the values below, but they do not need to be in the same order.
+
+// Keep this list of features (not enabled/disabled state) in sync with FeatureDefines.vsprops
+// and FeatureDefinesCairo.vsprops in WebKitLibraries/win/tools/vsprops.
+
+// Set any ENABLE_FEATURE_NAME macro to an empty string to disable that feature.
+
+ENABLE_LINK_PREFETCH = ;
+
+ENABLE_ACCELERATED_2D_CANVAS = $(ENABLE_ACCELERATED_2D_CANVAS_$(REAL_PLATFORM_NAME));
+ENABLE_ACCELERATED_2D_CANVAS_macosx = $(ENABLE_ACCELERATED_2D_CANVAS_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR));
+ENABLE_ACCELERATED_2D_CANVAS_macosx_1060 = ;
+ENABLE_ACCELERATED_2D_CANVAS_macosx_1070 = ;
+
+ENABLE_3D_CANVAS = $(ENABLE_3D_CANVAS_$(REAL_PLATFORM_NAME));
+ENABLE_3D_CANVAS_macosx = $(ENABLE_3D_CANVAS_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR));
+ENABLE_3D_CANVAS_macosx_1060 = ENABLE_3D_CANVAS;
+ENABLE_3D_CANVAS_macosx_1070 = ENABLE_3D_CANVAS;
+
+ENABLE_3D_RENDERING = $(ENABLE_3D_RENDERING_$(REAL_PLATFORM_NAME));
+ENABLE_3D_RENDERING_iphoneos = ENABLE_3D_RENDERING;
+ENABLE_3D_RENDERING_iphonesimulator = $(ENABLE_3D_RENDERING_iphoneos);
+ENABLE_3D_RENDERING_macosx = $(ENABLE_3D_RENDERING_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR));
+ENABLE_3D_RENDERING_macosx_1050 = ENABLE_3D_RENDERING;
+ENABLE_3D_RENDERING_macosx_1060 = ENABLE_3D_RENDERING;
+ENABLE_3D_RENDERING_macosx_1070 = ENABLE_3D_RENDERING;
+
+ENABLE_BLOB = $(ENABLE_BLOB_$(REAL_PLATFORM_NAME));
+ENABLE_BLOB_macosx = ENABLE_BLOB;
+
+ENABLE_CHANNEL_MESSAGING = $(ENABLE_CHANNEL_MESSAGING_$(REAL_PLATFORM_NAME));
+ENABLE_CHANNEL_MESSAGING_macosx = ENABLE_CHANNEL_MESSAGING;
+
+ENABLE_CLIENT_BASED_GEOLOCATION = $(ENABLE_CLIENT_BASED_GEOLOCATION_$(REAL_PLATFORM_NAME));
+ENABLE_CLIENT_BASED_GEOLOCATION_macosx = ENABLE_CLIENT_BASED_GEOLOCATION;
+
+ENABLE_DATABASE = ENABLE_DATABASE;
+ENABLE_DATAGRID = ;
+
+ENABLE_DATALIST = $(ENABLE_DATALIST_$(REAL_PLATFORM_NAME));
+ENABLE_DATALIST_macosx = ENABLE_DATALIST;
+
+ENABLE_DEVICE_ORIENTATION = ;
+ENABLE_DIRECTORY_UPLOAD = ;
+ENABLE_DOM_STORAGE = ENABLE_DOM_STORAGE;
+ENABLE_EVENTSOURCE = ENABLE_EVENTSOURCE;
+
+ENABLE_FILTERS = $(ENABLE_FILTERS_$(REAL_PLATFORM_NAME));
+ENABLE_FILTERS_macosx = ENABLE_FILTERS;
+
+ENABLE_FILE_SYSTEM = ;
+ENABLE_FULLSCREEN_API = ENABLE_FULLSCREEN_API;
+ENABLE_GEOLOCATION = ENABLE_GEOLOCATION;
+
+ENABLE_ICONDATABASE = $(ENABLE_ICONDATABASE_$(REAL_PLATFORM_NAME));
+ENABLE_ICONDATABASE_macosx = ENABLE_ICONDATABASE;
+
+ENABLE_IMAGE_RESIZER = ;
+ENABLE_INDEXED_DATABASE = ;
+ENABLE_INPUT_SPEECH = ;
+ENABLE_JAVASCRIPT_DEBUGGER = ENABLE_JAVASCRIPT_DEBUGGER;
+ENABLE_MATHML = ENABLE_MATHML;
+ENABLE_METER_TAG = ENABLE_METER_TAG;
+ENABLE_NOTIFICATIONS = ;
+ENABLE_OFFLINE_WEB_APPLICATIONS = ENABLE_OFFLINE_WEB_APPLICATIONS;
+ENABLE_PROGRESS_TAG = ENABLE_PROGRESS_TAG;
+
+ENABLE_SHARED_WORKERS = $(ENABLE_SHARED_WORKERS_$(REAL_PLATFORM_NAME));
+ENABLE_SHARED_WORKERS_macosx = ENABLE_SHARED_WORKERS;
+
+ENABLE_SVG = ENABLE_SVG;
+ENABLE_SVG_ANIMATION = ENABLE_SVG_ANIMATION;
+ENABLE_SVG_AS_IMAGE = ENABLE_SVG_AS_IMAGE;
+
+ENABLE_SVG_DOM_OBJC_BINDINGS = $(ENABLE_SVG_DOM_OBJC_BINDINGS_$(REAL_PLATFORM_NAME));
+ENABLE_SVG_DOM_OBJC_BINDINGS_macosx = ENABLE_SVG_DOM_OBJC_BINDINGS;
+
+ENABLE_SVG_FONTS = ENABLE_SVG_FONTS;
+ENABLE_SVG_FOREIGN_OBJECT = ENABLE_SVG_FOREIGN_OBJECT;
+ENABLE_SVG_USE = ENABLE_SVG_USE;
+ENABLE_VIDEO = ENABLE_VIDEO;
+
+ENABLE_WEB_AUDIO = ;
+
+ENABLE_WEB_SOCKETS = $(ENABLE_WEB_SOCKETS_$(REAL_PLATFORM_NAME));
+ENABLE_WEB_SOCKETS_macosx = ENABLE_WEB_SOCKETS;
+
+ENABLE_WEB_TIMING = ;
+ENABLE_WML = ;
+
+ENABLE_WORKERS = $(ENABLE_WORKERS_$(REAL_PLATFORM_NAME));
+ENABLE_WORKERS_macosx = ENABLE_WORKERS;
+
+ENABLE_XHTMLMP = ;
+ENABLE_XPATH = ENABLE_XPATH;
+ENABLE_XSLT = ENABLE_XSLT;
+
+FEATURE_DEFINES = $(ENABLE_LINK_PREFETCH) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_3D_CANVAS) $(ENABLE_3D_RENDERING) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CLIENT_BASED_GEOLOCATION) $(ENABLE_DATABASE) $(ENABLE_DATAGRID) $(ENABLE_DATALIST) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_DOM_STORAGE) $(ENABLE_EVENTSOURCE) $(ENABLE_FILTERS) $(ENABLE_FILE_SYSTEM) $(ENABLE_FULLSCREEN_API) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_IMAGE_RESIZER) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_SPEECH) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_MATHML) $(ENABLE_METER_TAG) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFLINE_WEB_APPLICATIONS) $(ENABLE_PROGRESS_TAG) $(ENABLE_SHARED_WORKERS) $(ENABLE_SVG) $(ENABLE_SVG_ANIMATION) $(ENABLE_SVG_AS_IMAGE) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_SVG_FOREIGN_OBJECT) $(ENABLE_SVG_USE) $(ENABLE_VIDEO) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WML) $(ENABLE_WORKERS) $(ENABLE_XHTMLMP) $(ENABLE_XPATH) $(ENABLE_XSLT);
diff --git a/Source/JavaScriptCore/Configurations/JavaScriptCore.xcconfig b/Source/JavaScriptCore/Configurations/JavaScriptCore.xcconfig
new file mode 100644
index 0000000..69b2491
--- /dev/null
+++ b/Source/JavaScriptCore/Configurations/JavaScriptCore.xcconfig
@@ -0,0 +1,53 @@
+// Copyright (C) 2009 Apple Inc. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#include "FeatureDefines.xcconfig"
+#include "Version.xcconfig"
+
+JSVALUE_MODEL = $(JSVALUE_MODEL_$(CURRENT_ARCH));
+JSVALUE_MODEL_ = UNKNOWN_JSVALUE_MODEL;
+JSVALUE_MODEL_armv6 = 32;
+JSVALUE_MODEL_armv7 = 32_64;
+JSVALUE_MODEL_i386 = 32_64;
+JSVALUE_MODEL_ppc = 32_64;
+JSVALUE_MODEL_ppc64 = 32;
+JSVALUE_MODEL_x86_64 = 64;
+
+EXPORTED_SYMBOLS_FILE = $(BUILT_PRODUCTS_DIR)/DerivedSources/JavaScriptCore/JavaScriptCore.JSVALUE$(JSVALUE_MODEL).exp;
+OTHER_LDFLAGS_BASE = -lobjc -Wl,-Y,3;
+OTHER_LDFLAGS = $(OTHER_LDFLAGS_$(REAL_PLATFORM_NAME));
+OTHER_LDFLAGS_iphoneos = $(OTHER_LDFLAGS_BASE);
+OTHER_LDFLAGS_iphonesimulator = $(OTHER_LDFLAGS_iphoneos);
+OTHER_LDFLAGS_macosx = $(OTHER_LDFLAGS_BASE) -sub_library libobjc -framework CoreServices $(OTHER_LDFLAGS_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR));
+OTHER_LDFLAGS_macosx_1070 = -Xlinker -objc_gc_compaction;
+GCC_PREFIX_HEADER = JavaScriptCorePrefix.h;
+HEADER_SEARCH_PATHS = "${BUILT_PRODUCTS_DIR}/DerivedSources/JavaScriptCore" $(HEADER_SEARCH_PATHS);
+INFOPLIST_FILE = Info.plist;
+INSTALL_PATH = $(SYSTEM_LIBRARY_DIR)/Frameworks;
+PRODUCT_NAME = JavaScriptCore;
+
+OTHER_CFLAGS = $(OTHER_CFLAGS_$(CONFIGURATION)_$(CURRENT_VARIANT));
+OTHER_CFLAGS_Release_normal = $(OTHER_CFLAGS_normal_$(TARGET_GCC_VERSION));
+OTHER_CFLAGS_Production_normal = $(OTHER_CFLAGS_normal_$(TARGET_GCC_VERSION));
+OTHER_CFLAGS_normal_GCC_42 = -fomit-frame-pointer -funwind-tables;
+OTHER_CFLAGS_normal_LLVM_GCC_42 = $(OTHER_CFLAGS_normal_GCC_42);
diff --git a/Source/JavaScriptCore/Configurations/Version.xcconfig b/Source/JavaScriptCore/Configurations/Version.xcconfig
new file mode 100644
index 0000000..4b884e2
--- /dev/null
+++ b/Source/JavaScriptCore/Configurations/Version.xcconfig
@@ -0,0 +1,58 @@
+// Copyright (C) 2009 Apple Inc. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+MAJOR_VERSION = 534;
+MINOR_VERSION = 16;
+TINY_VERSION = 0;
+FULL_VERSION = $(MAJOR_VERSION).$(MINOR_VERSION);
+
+// The bundle version and short version string are set based on the current build configuration, see below.
+BUNDLE_VERSION = $(BUNDLE_VERSION_$(CONFIGURATION));
+SHORT_VERSION_STRING = $(SHORT_VERSION_STRING_$(CONFIGURATION))
+
+// The system version prefix is based on the current system version.
+SYSTEM_VERSION_PREFIX = $(SYSTEM_VERSION_PREFIX_$(TARGET_MAC_OS_X_VERSION_MAJOR));
+SYSTEM_VERSION_PREFIX_ = 4; // Some Tiger versions of Xcode don't set MAC_OS_X_VERSION_MAJOR.
+SYSTEM_VERSION_PREFIX_1040 = 4;
+SYSTEM_VERSION_PREFIX_1050 = 5;
+SYSTEM_VERSION_PREFIX_1060 = 6;
+SYSTEM_VERSION_PREFIX_1070 = 7;
+
+// The production build always uses the full version with a system version prefix.
+BUNDLE_VERSION_Production = $(SYSTEM_VERSION_PREFIX)$(FULL_VERSION);
+BUNDLE_VERSION_ = $(BUNDLE_VERSION_Production);
+
+// The production build always uses the major version with a system version prefix
+SHORT_VERSION_STRING_Production = $(SYSTEM_VERSION_PREFIX)$(MAJOR_VERSION);
+SHORT_VERSION_STRING_ = $(SHORT_VERSION_STRING_Production);
+
+// Local builds are the full version with a plus suffix.
+BUNDLE_VERSION_Release = $(FULL_VERSION)+;
+BUNDLE_VERSION_Debug = $(BUNDLE_VERSION_Release);
+
+// Local builds use the major version with a plus suffix
+SHORT_VERSION_STRING_Release = $(MAJOR_VERSION)+;
+SHORT_VERSION_STRING_Debug = $(SHORT_VERSION_STRING_Release);
+
+DYLIB_COMPATIBILITY_VERSION = 1;
+DYLIB_CURRENT_VERSION = $(FULL_VERSION);
diff --git a/Source/JavaScriptCore/DerivedSources.make b/Source/JavaScriptCore/DerivedSources.make
new file mode 100644
index 0000000..2e8adb4
--- /dev/null
+++ b/Source/JavaScriptCore/DerivedSources.make
@@ -0,0 +1,82 @@
+# Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+# its contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+VPATH = \
+ $(JavaScriptCore) \
+ $(JavaScriptCore)/parser \
+ $(JavaScriptCore)/pcre \
+ $(JavaScriptCore)/docs \
+ $(JavaScriptCore)/runtime \
+ $(JavaScriptCore)/interpreter \
+ $(JavaScriptCore)/jit \
+#
+
+.PHONY : all
+all : \
+ ArrayPrototype.lut.h \
+ chartables.c \
+ DatePrototype.lut.h \
+ JSONObject.lut.h \
+ Lexer.lut.h \
+ MathObject.lut.h \
+ NumberConstructor.lut.h \
+ RegExpConstructor.lut.h \
+ RegExpObject.lut.h \
+ StringPrototype.lut.h \
+ docs/bytecode.html \
+ RegExpJitTables.h \
+ JavaScriptCore.JSVALUE32.exp \
+ JavaScriptCore.JSVALUE32_64.exp \
+ JavaScriptCore.JSVALUE64.exp \
+#
+
+# lookup tables for classes
+
+%.lut.h: create_hash_table %.cpp
+ $^ -i > $@
+Lexer.lut.h: create_hash_table Keywords.table
+ $^ > $@
+
+# character tables for PCRE
+
+chartables.c : dftables
+ $^ $@
+
+docs/bytecode.html: make-bytecode-docs.pl Interpreter.cpp
+ perl $^ $@
+
+#character tables for Yarr
+RegExpJitTables.h: create_regex_tables
+ python $^ > $@
+
+JavaScriptCore.JSVALUE32.exp: JavaScriptCore.exp JavaScriptCore.JSVALUE32only.exp
+ cat $^ > $@
+
+JavaScriptCore.JSVALUE32_64.exp: JavaScriptCore.exp JavaScriptCore.JSVALUE32_64only.exp
+ cat $^ > $@
+
+JavaScriptCore.JSVALUE64.exp: JavaScriptCore.exp JavaScriptCore.JSVALUE64only.exp
+ cat $^ > $@
diff --git a/Source/JavaScriptCore/DerivedSources.pro b/Source/JavaScriptCore/DerivedSources.pro
new file mode 100644
index 0000000..4d724be
--- /dev/null
+++ b/Source/JavaScriptCore/DerivedSources.pro
@@ -0,0 +1,100 @@
+# DerivedSources - qmake build info
+
+CONFIG -= debug_and_release
+
+TEMPLATE = lib
+TARGET = dummy
+
+QMAKE_EXTRA_TARGETS += generated_files
+
+CONFIG(standalone_package) {
+ isEmpty(JSC_GENERATED_SOURCES_DIR):JSC_GENERATED_SOURCES_DIR = $$PWD/generated
+} else {
+ isEmpty(JSC_GENERATED_SOURCES_DIR):JSC_GENERATED_SOURCES_DIR = generated
+}
+
+LUT_FILES += \
+ runtime/ArrayPrototype.cpp \
+ runtime/DatePrototype.cpp \
+ runtime/JSONObject.cpp \
+ runtime/MathObject.cpp \
+ runtime/NumberConstructor.cpp \
+ runtime/RegExpConstructor.cpp \
+ runtime/RegExpObject.cpp \
+ runtime/StringPrototype.cpp
+
+KEYWORDLUT_FILES += \
+ parser/Keywords.table
+
+JIT_STUB_FILES += \
+ jit/JITStubs.cpp
+
+defineTest(addExtraCompiler) {
+ eval($${1}.CONFIG = target_predeps no_link)
+ eval($${1}.variable_out =)
+ eval($${1}.dependency_type = TYPE_C)
+
+ wkScript = $$eval($${1}.wkScript)
+ eval($${1}.depends += $$wkScript)
+
+ export($${1}.CONFIG)
+ export($${1}.variable_out)
+ export($${1}.dependency_type)
+ export($${1}.depends)
+
+ QMAKE_EXTRA_COMPILERS += $$1
+ generated_files.depends += compiler_$${1}_make_all
+ export(QMAKE_EXTRA_COMPILERS)
+ export(generated_files.depends)
+ return(true)
+}
+
+# GENERATOR 1-A: LUT creator
+lut.output = $${JSC_GENERATED_SOURCES_DIR}$${QMAKE_DIR_SEP}${QMAKE_FILE_BASE}.lut.h
+lut.input = LUT_FILES
+lut.wkScript = $$PWD/create_hash_table
+lut.commands = perl $$lut.wkScript ${QMAKE_FILE_NAME} -i > ${QMAKE_FILE_OUT}
+lut.depends = ${QMAKE_FILE_NAME}
+addExtraCompiler(lut)
+
+# GENERATOR 1-B: particular LUT creator (for 1 file only)
+keywordlut.output = $${JSC_GENERATED_SOURCES_DIR}$${QMAKE_DIR_SEP}Lexer.lut.h
+keywordlut.input = KEYWORDLUT_FILES
+keywordlut.wkScript = $$PWD/create_hash_table
+keywordlut.commands = perl $$keywordlut.wkScript ${QMAKE_FILE_NAME} -i > ${QMAKE_FILE_OUT}
+keywordlut.depends = ${QMAKE_FILE_NAME}
+addExtraCompiler(keywordlut)
+
+# GENERATOR 2-A: JIT Stub functions for RVCT
+rvctstubs.output = $${JSC_GENERATED_SOURCES_DIR}$${QMAKE_DIR_SEP}Generated${QMAKE_FILE_BASE}_RVCT.h
+rvctstubs.wkScript = $$PWD/create_jit_stubs
+rvctstubs.commands = perl -i $$rvctstubs.wkScript --prefix RVCT ${QMAKE_FILE_NAME} > ${QMAKE_FILE_OUT}
+rvctstubs.depends = ${QMAKE_FILE_NAME}
+rvctstubs.input = JIT_STUB_FILES
+rvctstubs.CONFIG += no_link
+addExtraCompiler(rvctstubs)
+
+# GENERATOR 2-B: JIT Stub functions for MSVC
+msvcstubs.output = $${JSC_GENERATED_SOURCES_DIR}$${QMAKE_DIR_SEP}Generated${QMAKE_FILE_BASE}_MSVC.asm
+msvcstubs.wkScript = $$PWD/create_jit_stubs
+msvcstubs.commands = perl -i $$msvcstubs.wkScript --prefix MSVC ${QMAKE_FILE_NAME} > ${QMAKE_FILE_OUT}
+msvcstubs.depends = ${QMAKE_FILE_NAME}
+msvcstubs.input = JIT_STUB_FILES
+msvcstubs.CONFIG += no_link
+addExtraCompiler(msvcstubs)
+
+# GENERATOR: "chartables.c": compile and execute the chartables generator (and add it to sources)
+win32-msvc*|wince*: PREPROCESSOR = "--preprocessor=\"$$QMAKE_CC /E\""
+ctgen.output = $$JSC_GENERATED_SOURCES_DIR/chartables.c
+ctgen.wkScript = $$PWD/pcre/dftables
+ctgen.input = ctgen.wkScript
+ctgen.commands = perl $$ctgen.wkScript ${QMAKE_FILE_OUT} $$PREPROCESSOR
+ctgen.clean = ${QMAKE_FILE_OUT} ${QMAKE_VAR_JSC_GENERATED_SOURCES_DIR}${QMAKE_FILE_BASE}
+addExtraCompiler(ctgen)
+
+#GENERATOR: "RegExpJitTables.h": tables used by Yarr
+retgen.output = $$JSC_GENERATED_SOURCES_DIR/RegExpJitTables.h
+retgen.wkScript = $$PWD/create_regex_tables
+retgen.input = retgen.wkScript
+retgen.commands = python $$retgen.wkScript > ${QMAKE_FILE_OUT}
+addExtraCompiler(retgen)
diff --git a/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/APICast.h b/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/APICast.h
new file mode 100644
index 0000000..06b566b
--- /dev/null
+++ b/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/APICast.h
@@ -0,0 +1 @@
+#include <JavaScriptCore/API/APICast.h>
diff --git a/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSBase.h b/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSBase.h
new file mode 100644
index 0000000..25b2aa4
--- /dev/null
+++ b/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSBase.h
@@ -0,0 +1 @@
+#include <JavaScriptCore/API/JSBase.h>
diff --git a/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSContextRef.h b/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSContextRef.h
new file mode 100644
index 0000000..f7e57be
--- /dev/null
+++ b/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSContextRef.h
@@ -0,0 +1 @@
+#include <JavaScriptCore/API/JSContextRef.h>
diff --git a/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSObjectRef.h b/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSObjectRef.h
new file mode 100644
index 0000000..7713722
--- /dev/null
+++ b/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSObjectRef.h
@@ -0,0 +1 @@
+#include <JavaScriptCore/API/JSObjectRef.h>
diff --git a/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSRetainPtr.h b/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSRetainPtr.h
new file mode 100644
index 0000000..e048d34
--- /dev/null
+++ b/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSRetainPtr.h
@@ -0,0 +1 @@
+#include <JavaScriptCore/API/JSRetainPtr.h>
diff --git a/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSStringRef.h b/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSStringRef.h
new file mode 100644
index 0000000..d32e0c7
--- /dev/null
+++ b/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSStringRef.h
@@ -0,0 +1 @@
+#include <JavaScriptCore/API/JSStringRef.h>
diff --git a/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSStringRefCF.h b/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSStringRefCF.h
new file mode 100644
index 0000000..11ae723
--- /dev/null
+++ b/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSStringRefCF.h
@@ -0,0 +1 @@
+#include <JavaScriptCore/API/JSStringRefCF.h>
diff --git a/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSValueRef.h b/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSValueRef.h
new file mode 100644
index 0000000..7186287
--- /dev/null
+++ b/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSValueRef.h
@@ -0,0 +1 @@
+#include <JavaScriptCore/API/JSValueRef.h>
diff --git a/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JavaScript.h b/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JavaScript.h
new file mode 100644
index 0000000..ab90c6d
--- /dev/null
+++ b/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JavaScript.h
@@ -0,0 +1 @@
+#include <JavaScriptCore/API/JavaScript.h>
diff --git a/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JavaScriptCore.h b/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JavaScriptCore.h
new file mode 100644
index 0000000..7dc8e08
--- /dev/null
+++ b/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JavaScriptCore.h
@@ -0,0 +1 @@
+#include <JavaScriptCore/API/JavaScriptCore.h>
diff --git a/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/OpaqueJSString.h b/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/OpaqueJSString.h
new file mode 100644
index 0000000..51e029e
--- /dev/null
+++ b/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/OpaqueJSString.h
@@ -0,0 +1 @@
+#include <JavaScriptCore/API/OpaqueJSString.h>
diff --git a/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/WebKitAvailability.h b/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/WebKitAvailability.h
new file mode 100644
index 0000000..0c58890
--- /dev/null
+++ b/Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/WebKitAvailability.h
@@ -0,0 +1 @@
+#include <JavaScriptCore/API/WebKitAvailability.h>
diff --git a/Source/JavaScriptCore/GNUmakefile.am b/Source/JavaScriptCore/GNUmakefile.am
new file mode 100644
index 0000000..93f10ee
--- /dev/null
+++ b/Source/JavaScriptCore/GNUmakefile.am
@@ -0,0 +1,696 @@
+javascriptcore_cppflags += \
+ -I$(srcdir)/Source \
+ -I$(srcdir)/Source/JavaScriptCore \
+ -I$(srcdir)/Source/JavaScriptCore/API \
+ -I$(srcdir)/Source/JavaScriptCore/assembler \
+ -I$(srcdir)/Source/JavaScriptCore/bytecode \
+ -I$(srcdir)/Source/JavaScriptCore/bytecompiler \
+ -I$(srcdir)/Source/JavaScriptCore/debugger \
+ -I$(srcdir)/Source/JavaScriptCore/ForwardingHeaders \
+ -I$(srcdir)/Source/JavaScriptCore/interpreter \
+ -I$(srcdir)/Source/JavaScriptCore/jit \
+ -I$(srcdir)/Source/JavaScriptCore/jit \
+ -I$(srcdir)/Source/JavaScriptCore/parser \
+ -I$(srcdir)/Source/JavaScriptCore/pcre \
+ -I$(srcdir)/Source/JavaScriptCore/profiler \
+ -I$(srcdir)/Source/JavaScriptCore/runtime \
+ -I$(srcdir)/Source/JavaScriptCore/wtf \
+ -I$(srcdir)/Source/JavaScriptCore/wtf \
+ -I$(srcdir)/Source/JavaScriptCore/wtf/gobject \
+ -I$(srcdir)/Source/JavaScriptCore/wtf/gtk \
+ -I$(srcdir)/Source/JavaScriptCore/wtf/text \
+ -I$(srcdir)/Source/JavaScriptCore/wtf/unicode \
+ -I$(srcdir)/Source/JavaScriptCore/yarr \
+ -I$(top_builddir)/Source/JavaScriptCore \
+ -I$(top_builddir)/Source/JavaScriptCore/parser \
+ -I$(top_builddir)/Source/JavaScriptCore/pcre \
+ -I$(top_builddir)/Source/JavaScriptCore/runtime
+
+javascriptcore_h_api += \
+ Source/JavaScriptCore/API/JSBase.h \
+ Source/JavaScriptCore/API/JSContextRef.h \
+ Source/JavaScriptCore/API/JSObjectRef.h \
+ Source/JavaScriptCore/API/JSStringRef.h \
+ Source/JavaScriptCore/API/JSStringRefBSTR.h \
+ Source/JavaScriptCore/API/JSStringRefCF.h \
+ Source/JavaScriptCore/API/JSValueRef.h \
+ Source/JavaScriptCore/API/JavaScript.h \
+ Source/JavaScriptCore/API/JavaScriptCore.h \
+ Source/JavaScriptCore/API/WebKitAvailability.h
+
+javascriptcore_built_nosources += \
+ Source/JavaScriptCore/Lexer.lut.h \
+ Source/JavaScriptCore/RegExpJitTables.h \
+ Source/JavaScriptCore/runtime/ArrayPrototype.lut.h \
+ Source/JavaScriptCore/runtime/DatePrototype.lut.h \
+ Source/JavaScriptCore/runtime/JSONObject.lut.h \
+ Source/JavaScriptCore/runtime/MathObject.lut.h \
+ Source/JavaScriptCore/runtime/NumberConstructor.lut.h \
+ Source/JavaScriptCore/runtime/RegExpConstructor.lut.h \
+ Source/JavaScriptCore/runtime/RegExpObject.lut.h \
+ Source/JavaScriptCore/runtime/StringPrototype.lut.h \
+ Source/JavaScriptCore/pcre/chartables.c
+
+javascriptcore_sources += \
+ Source/JavaScriptCore/API/APICast.h \
+ Source/JavaScriptCore/API/APIShims.h \
+ Source/JavaScriptCore/API/JSBase.cpp \
+ Source/JavaScriptCore/API/JSBasePrivate.h \
+ Source/JavaScriptCore/API/JSCallbackConstructor.cpp \
+ Source/JavaScriptCore/API/JSCallbackConstructor.h \
+ Source/JavaScriptCore/API/JSCallbackFunction.cpp \
+ Source/JavaScriptCore/API/JSCallbackFunction.h \
+ Source/JavaScriptCore/API/JSCallbackObject.cpp \
+ Source/JavaScriptCore/API/JSCallbackObjectFunctions.h \
+ Source/JavaScriptCore/API/JSCallbackObject.h \
+ Source/JavaScriptCore/API/JSClassRef.cpp \
+ Source/JavaScriptCore/API/JSClassRef.h \
+ Source/JavaScriptCore/API/JSContextRef.cpp \
+ Source/JavaScriptCore/API/JSContextRefPrivate.h \
+ Source/JavaScriptCore/API/JSObjectRef.cpp \
+ Source/JavaScriptCore/API/JSObjectRefPrivate.h \
+ Source/JavaScriptCore/API/JSRetainPtr.h \
+ Source/JavaScriptCore/API/JSStringRef.cpp \
+ Source/JavaScriptCore/API/JSValueRef.cpp \
+ Source/JavaScriptCore/API/JSWeakObjectMapRefInternal.h \
+ Source/JavaScriptCore/API/OpaqueJSString.cpp \
+ Source/JavaScriptCore/API/OpaqueJSString.h \
+ Source/JavaScriptCore/assembler/AbstractMacroAssembler.h \
+ Source/JavaScriptCore/assembler/ARMAssembler.cpp \
+ Source/JavaScriptCore/assembler/ARMAssembler.h \
+ Source/JavaScriptCore/assembler/AssemblerBuffer.h \
+ Source/JavaScriptCore/assembler/AssemblerBufferWithConstantPool.h \
+ Source/JavaScriptCore/assembler/CodeLocation.h \
+ Source/JavaScriptCore/assembler/LinkBuffer.h \
+ Source/JavaScriptCore/assembler/MacroAssemblerARM.cpp \
+ Source/JavaScriptCore/assembler/MacroAssemblerARM.h \
+ Source/JavaScriptCore/assembler/MacroAssemblerCodeRef.h \
+ Source/JavaScriptCore/assembler/MacroAssembler.h \
+ Source/JavaScriptCore/assembler/MacroAssemblerX86_64.h \
+ Source/JavaScriptCore/assembler/MacroAssemblerX86Common.h \
+ Source/JavaScriptCore/assembler/MacroAssemblerX86.h \
+ Source/JavaScriptCore/assembler/RepatchBuffer.h \
+ Source/JavaScriptCore/assembler/X86Assembler.h \
+ Source/JavaScriptCore/bytecode/CodeBlock.cpp \
+ Source/JavaScriptCore/bytecode/CodeBlock.h \
+ Source/JavaScriptCore/bytecode/EvalCodeCache.h \
+ Source/JavaScriptCore/bytecode/Instruction.h \
+ Source/JavaScriptCore/bytecode/JumpTable.cpp \
+ Source/JavaScriptCore/bytecode/JumpTable.h \
+ Source/JavaScriptCore/bytecode/Opcode.cpp \
+ Source/JavaScriptCore/bytecode/Opcode.h \
+ Source/JavaScriptCore/bytecode/SamplingTool.cpp \
+ Source/JavaScriptCore/bytecode/SamplingTool.h \
+ Source/JavaScriptCore/bytecode/StructureStubInfo.cpp \
+ Source/JavaScriptCore/bytecode/StructureStubInfo.h \
+ Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp \
+ Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h \
+ Source/JavaScriptCore/bytecompiler/Label.h \
+ Source/JavaScriptCore/bytecompiler/LabelScope.h \
+ Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp \
+ Source/JavaScriptCore/bytecompiler/RegisterID.h \
+ Source/JavaScriptCore/config.h \
+ Source/JavaScriptCore/debugger/DebuggerActivation.cpp \
+ Source/JavaScriptCore/debugger/DebuggerActivation.h \
+ Source/JavaScriptCore/debugger/DebuggerCallFrame.cpp \
+ Source/JavaScriptCore/debugger/DebuggerCallFrame.h \
+ Source/JavaScriptCore/debugger/Debugger.cpp \
+ Source/JavaScriptCore/debugger/Debugger.h \
+ Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/APICast.h \
+ Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JavaScriptCore.h \
+ Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JavaScript.h \
+ Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSBase.h \
+ Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSContextRef.h \
+ Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSObjectRef.h \
+ Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSRetainPtr.h \
+ Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSStringRefCF.h \
+ Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSStringRef.h \
+ Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSValueRef.h \
+ Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/OpaqueJSString.h \
+ Source/JavaScriptCore/ForwardingHeaders/JavaScriptCore/WebKitAvailability.h \
+ Source/JavaScriptCore/icu/unicode/parseerr.h \
+ Source/JavaScriptCore/icu/unicode/platform.h \
+ Source/JavaScriptCore/icu/unicode/putil.h \
+ Source/JavaScriptCore/icu/unicode/uchar.h \
+ Source/JavaScriptCore/icu/unicode/ucnv_err.h \
+ Source/JavaScriptCore/icu/unicode/ucnv.h \
+ Source/JavaScriptCore/icu/unicode/ucol.h \
+ Source/JavaScriptCore/icu/unicode/uconfig.h \
+ Source/JavaScriptCore/icu/unicode/uenum.h \
+ Source/JavaScriptCore/icu/unicode/uiter.h \
+ Source/JavaScriptCore/icu/unicode/uloc.h \
+ Source/JavaScriptCore/icu/unicode/umachine.h \
+ Source/JavaScriptCore/icu/unicode/unorm.h \
+ Source/JavaScriptCore/icu/unicode/urename.h \
+ Source/JavaScriptCore/icu/unicode/uset.h \
+ Source/JavaScriptCore/icu/unicode/ustring.h \
+ Source/JavaScriptCore/icu/unicode/utf16.h \
+ Source/JavaScriptCore/icu/unicode/utf8.h \
+ Source/JavaScriptCore/icu/unicode/utf.h \
+ Source/JavaScriptCore/icu/unicode/utf_old.h \
+ Source/JavaScriptCore/icu/unicode/utypes.h \
+ Source/JavaScriptCore/icu/unicode/uversion.h \
+ Source/JavaScriptCore/interpreter/CachedCall.h \
+ Source/JavaScriptCore/interpreter/CallFrameClosure.h \
+ Source/JavaScriptCore/interpreter/CallFrame.cpp \
+ Source/JavaScriptCore/interpreter/CallFrame.h \
+ Source/JavaScriptCore/interpreter/Interpreter.cpp \
+ Source/JavaScriptCore/interpreter/Interpreter.h \
+ Source/JavaScriptCore/interpreter/RegisterFile.cpp \
+ Source/JavaScriptCore/interpreter/RegisterFile.h \
+ Source/JavaScriptCore/interpreter/Register.h \
+ Source/JavaScriptCore/JavaScriptCorePrefix.h \
+ Source/JavaScriptCore/jit/ExecutableAllocator.cpp \
+ Source/JavaScriptCore/jit/ExecutableAllocator.h \
+ Source/JavaScriptCore/jit/JITArithmetic32_64.cpp \
+ Source/JavaScriptCore/jit/JITArithmetic.cpp \
+ Source/JavaScriptCore/jit/JITCall32_64.cpp \
+ Source/JavaScriptCore/jit/JITCall.cpp \
+ Source/JavaScriptCore/jit/JITCode.h \
+ Source/JavaScriptCore/jit/JIT.cpp \
+ Source/JavaScriptCore/jit/JIT.h \
+ Source/JavaScriptCore/jit/JITInlineMethods.h \
+ Source/JavaScriptCore/jit/JITOpcodes32_64.cpp \
+ Source/JavaScriptCore/jit/JITOpcodes.cpp \
+ Source/JavaScriptCore/jit/JITPropertyAccess32_64.cpp \
+ Source/JavaScriptCore/jit/JITPropertyAccess.cpp \
+ Source/JavaScriptCore/jit/JITStubCall.h \
+ Source/JavaScriptCore/jit/JITStubs.cpp \
+ Source/JavaScriptCore/jit/JITStubs.h \
+ Source/JavaScriptCore/jit/JSInterfaceJIT.h \
+ Source/JavaScriptCore/jit/SpecializedThunkJIT.h \
+ Source/JavaScriptCore/jit/ThunkGenerators.cpp \
+ Source/JavaScriptCore/jit/ThunkGenerators.h \
+ Source/JavaScriptCore/os-win32/stdbool.h \
+ Source/JavaScriptCore/os-win32/stdint.h \
+ Source/JavaScriptCore/parser/ASTBuilder.h \
+ Source/JavaScriptCore/parser/JSParser.cpp \
+ Source/JavaScriptCore/parser/JSParser.h \
+ Source/JavaScriptCore/parser/Lexer.cpp \
+ Source/JavaScriptCore/parser/Lexer.h \
+ Source/JavaScriptCore/parser/NodeConstructors.h \
+ Source/JavaScriptCore/parser/NodeInfo.h \
+ Source/JavaScriptCore/parser/Nodes.cpp \
+ Source/JavaScriptCore/parser/Nodes.h \
+ Source/JavaScriptCore/parser/ParserArena.cpp \
+ Source/JavaScriptCore/parser/ParserArena.h \
+ Source/JavaScriptCore/parser/Parser.cpp \
+ Source/JavaScriptCore/parser/Parser.h \
+ Source/JavaScriptCore/parser/ResultType.h \
+ Source/JavaScriptCore/parser/SourceCode.h \
+ Source/JavaScriptCore/parser/SourceProvider.h \
+ Source/JavaScriptCore/parser/SyntaxChecker.h \
+ Source/JavaScriptCore/pcre/pcre_compile.cpp \
+ Source/JavaScriptCore/pcre/pcre_exec.cpp \
+ Source/JavaScriptCore/pcre/pcre.h \
+ Source/JavaScriptCore/pcre/pcre_internal.h \
+ Source/JavaScriptCore/pcre/pcre_tables.cpp \
+ Source/JavaScriptCore/pcre/pcre_ucp_searchfuncs.cpp \
+ Source/JavaScriptCore/pcre/pcre_xclass.cpp \
+ Source/JavaScriptCore/pcre/ucpinternal.h \
+ Source/JavaScriptCore/profiler/CallIdentifier.h \
+ Source/JavaScriptCore/profiler/Profile.cpp \
+ Source/JavaScriptCore/profiler/ProfileGenerator.cpp \
+ Source/JavaScriptCore/profiler/ProfileGenerator.h \
+ Source/JavaScriptCore/profiler/Profile.h \
+ Source/JavaScriptCore/profiler/ProfileNode.cpp \
+ Source/JavaScriptCore/profiler/ProfileNode.h \
+ Source/JavaScriptCore/profiler/Profiler.cpp \
+ Source/JavaScriptCore/profiler/Profiler.h \
+ Source/JavaScriptCore/runtime/ArgList.cpp \
+ Source/JavaScriptCore/runtime/ArgList.h \
+ Source/JavaScriptCore/runtime/Arguments.cpp \
+ Source/JavaScriptCore/runtime/Arguments.h \
+ Source/JavaScriptCore/runtime/ArrayConstructor.cpp \
+ Source/JavaScriptCore/runtime/ArrayConstructor.h \
+ Source/JavaScriptCore/runtime/ArrayPrototype.cpp \
+ Source/JavaScriptCore/runtime/ArrayPrototype.h \
+ Source/JavaScriptCore/runtime/BatchedTransitionOptimizer.h \
+ Source/JavaScriptCore/runtime/BooleanConstructor.cpp \
+ Source/JavaScriptCore/runtime/BooleanConstructor.h \
+ Source/JavaScriptCore/runtime/BooleanObject.cpp \
+ Source/JavaScriptCore/runtime/BooleanObject.h \
+ Source/JavaScriptCore/runtime/BooleanPrototype.cpp \
+ Source/JavaScriptCore/runtime/BooleanPrototype.h \
+ Source/JavaScriptCore/runtime/CachedTranscendentalFunction.h \
+ Source/JavaScriptCore/runtime/CallData.cpp \
+ Source/JavaScriptCore/runtime/CallData.h \
+ Source/JavaScriptCore/runtime/ClassInfo.h \
+ Source/JavaScriptCore/runtime/Collector.cpp \
+ Source/JavaScriptCore/runtime/Collector.h \
+ Source/JavaScriptCore/runtime/CollectorHeapIterator.h \
+ Source/JavaScriptCore/runtime/CommonIdentifiers.cpp \
+ Source/JavaScriptCore/runtime/CommonIdentifiers.h \
+ Source/JavaScriptCore/runtime/Completion.cpp \
+ Source/JavaScriptCore/runtime/Completion.h \
+ Source/JavaScriptCore/runtime/ConstructData.cpp \
+ Source/JavaScriptCore/runtime/ConstructData.h \
+ Source/JavaScriptCore/runtime/DateConstructor.cpp \
+ Source/JavaScriptCore/runtime/DateConstructor.h \
+ Source/JavaScriptCore/runtime/DateConversion.cpp \
+ Source/JavaScriptCore/runtime/DateConversion.h \
+ Source/JavaScriptCore/runtime/DateInstanceCache.h \
+ Source/JavaScriptCore/runtime/DateInstance.cpp \
+ Source/JavaScriptCore/runtime/DateInstance.h \
+ Source/JavaScriptCore/runtime/DatePrototype.cpp \
+ Source/JavaScriptCore/runtime/DatePrototype.h \
+ Source/JavaScriptCore/runtime/ErrorConstructor.cpp \
+ Source/JavaScriptCore/runtime/ErrorConstructor.h \
+ Source/JavaScriptCore/runtime/Error.cpp \
+ Source/JavaScriptCore/runtime/Error.h \
+ Source/JavaScriptCore/runtime/ErrorInstance.cpp \
+ Source/JavaScriptCore/runtime/ErrorInstance.h \
+ Source/JavaScriptCore/runtime/ErrorPrototype.cpp \
+ Source/JavaScriptCore/runtime/ErrorPrototype.h \
+ Source/JavaScriptCore/runtime/ExceptionHelpers.cpp \
+ Source/JavaScriptCore/runtime/ExceptionHelpers.h \
+ Source/JavaScriptCore/runtime/Executable.cpp \
+ Source/JavaScriptCore/runtime/Executable.h \
+ Source/JavaScriptCore/runtime/FunctionConstructor.cpp \
+ Source/JavaScriptCore/runtime/FunctionConstructor.h \
+ Source/JavaScriptCore/runtime/FunctionPrototype.cpp \
+ Source/JavaScriptCore/runtime/FunctionPrototype.h \
+ Source/JavaScriptCore/runtime/GCActivityCallback.cpp \
+ Source/JavaScriptCore/runtime/GCActivityCallback.h \
+ Source/JavaScriptCore/runtime/GCHandle.cpp \
+ Source/JavaScriptCore/runtime/GCHandle.h \
+ Source/JavaScriptCore/runtime/GetterSetter.cpp \
+ Source/JavaScriptCore/runtime/GetterSetter.h \
+ Source/JavaScriptCore/runtime/GlobalEvalFunction.cpp \
+ Source/JavaScriptCore/runtime/GlobalEvalFunction.h \
+ Source/JavaScriptCore/runtime/Identifier.cpp \
+ Source/JavaScriptCore/runtime/Identifier.h \
+ Source/JavaScriptCore/runtime/InitializeThreading.cpp \
+ Source/JavaScriptCore/runtime/InitializeThreading.h \
+ Source/JavaScriptCore/runtime/InternalFunction.cpp \
+ Source/JavaScriptCore/runtime/InternalFunction.h \
+ Source/JavaScriptCore/runtime/JSActivation.cpp \
+ Source/JavaScriptCore/runtime/JSActivation.h \
+ Source/JavaScriptCore/runtime/JSAPIValueWrapper.cpp \
+ Source/JavaScriptCore/runtime/JSAPIValueWrapper.h \
+ Source/JavaScriptCore/runtime/JSArray.cpp \
+ Source/JavaScriptCore/runtime/JSArray.h \
+ Source/JavaScriptCore/runtime/JSByteArray.cpp \
+ Source/JavaScriptCore/runtime/JSByteArray.h \
+ Source/JavaScriptCore/runtime/JSCell.cpp \
+ Source/JavaScriptCore/runtime/JSCell.h \
+ Source/JavaScriptCore/runtime/JSFunction.cpp \
+ Source/JavaScriptCore/runtime/JSFunction.h \
+ Source/JavaScriptCore/runtime/JSGlobalData.cpp \
+ Source/JavaScriptCore/runtime/JSGlobalData.h \
+ Source/JavaScriptCore/runtime/JSGlobalObject.cpp \
+ Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp \
+ Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.h \
+ Source/JavaScriptCore/runtime/JSGlobalObject.h \
+ Source/JavaScriptCore/runtime/JSImmediate.cpp \
+ Source/JavaScriptCore/runtime/JSImmediate.h \
+ Source/JavaScriptCore/runtime/JSLock.cpp \
+ Source/JavaScriptCore/runtime/JSLock.h \
+ Source/JavaScriptCore/runtime/JSNotAnObject.cpp \
+ Source/JavaScriptCore/runtime/JSNotAnObject.h \
+ Source/JavaScriptCore/runtime/JSNumberCell.cpp \
+ Source/JavaScriptCore/runtime/JSNumberCell.h \
+ Source/JavaScriptCore/runtime/JSObject.cpp \
+ Source/JavaScriptCore/runtime/JSObject.h \
+ Source/JavaScriptCore/runtime/JSObjectWithGlobalObject.cpp \
+ Source/JavaScriptCore/runtime/JSObjectWithGlobalObject.h \
+ Source/JavaScriptCore/runtime/JSONObject.cpp \
+ Source/JavaScriptCore/runtime/JSONObject.h \
+ Source/JavaScriptCore/runtime/JSPropertyNameIterator.cpp \
+ Source/JavaScriptCore/runtime/JSPropertyNameIterator.h \
+ Source/JavaScriptCore/runtime/JSStaticScopeObject.cpp \
+ Source/JavaScriptCore/runtime/JSStaticScopeObject.h \
+ Source/JavaScriptCore/runtime/JSStringBuilder.h \
+ Source/JavaScriptCore/runtime/JSString.cpp \
+ Source/JavaScriptCore/runtime/JSString.h \
+ Source/JavaScriptCore/runtime/JSType.h \
+ Source/JavaScriptCore/runtime/JSTypeInfo.h \
+ Source/JavaScriptCore/runtime/JSValue.cpp \
+ Source/JavaScriptCore/runtime/JSValue.h \
+ Source/JavaScriptCore/runtime/JSVariableObject.cpp \
+ Source/JavaScriptCore/runtime/JSVariableObject.h \
+ Source/JavaScriptCore/runtime/JSWrapperObject.cpp \
+ Source/JavaScriptCore/runtime/JSWrapperObject.h \
+ Source/JavaScriptCore/runtime/JSZombie.h \
+ Source/JavaScriptCore/runtime/LiteralParser.cpp \
+ Source/JavaScriptCore/runtime/LiteralParser.h \
+ Source/JavaScriptCore/runtime/Lookup.cpp \
+ Source/JavaScriptCore/runtime/Lookup.h \
+ Source/JavaScriptCore/runtime/MarkStack.cpp \
+ Source/JavaScriptCore/runtime/MarkStack.h \
+ Source/JavaScriptCore/runtime/MathObject.cpp \
+ Source/JavaScriptCore/runtime/MathObject.h \
+ Source/JavaScriptCore/runtime/NativeErrorConstructor.cpp \
+ Source/JavaScriptCore/runtime/NativeErrorConstructor.h \
+ Source/JavaScriptCore/runtime/NativeErrorPrototype.cpp \
+ Source/JavaScriptCore/runtime/NativeErrorPrototype.h \
+ Source/JavaScriptCore/runtime/NativeFunctionWrapper.h \
+ Source/JavaScriptCore/runtime/NumberConstructor.cpp \
+ Source/JavaScriptCore/runtime/NumberConstructor.h \
+ Source/JavaScriptCore/runtime/NumberObject.cpp \
+ Source/JavaScriptCore/runtime/NumberObject.h \
+ Source/JavaScriptCore/runtime/NumberPrototype.cpp \
+ Source/JavaScriptCore/runtime/NumberPrototype.h \
+ Source/JavaScriptCore/runtime/NumericStrings.h \
+ Source/JavaScriptCore/runtime/ObjectConstructor.cpp \
+ Source/JavaScriptCore/runtime/ObjectConstructor.h \
+ Source/JavaScriptCore/runtime/ObjectPrototype.cpp \
+ Source/JavaScriptCore/runtime/ObjectPrototype.h \
+ Source/JavaScriptCore/runtime/Operations.cpp \
+ Source/JavaScriptCore/runtime/Operations.h \
+ Source/JavaScriptCore/runtime/PropertyDescriptor.cpp \
+ Source/JavaScriptCore/runtime/PropertyDescriptor.h \
+ Source/JavaScriptCore/runtime/PropertyMapHashTable.h \
+ Source/JavaScriptCore/runtime/PropertyNameArray.cpp \
+ Source/JavaScriptCore/runtime/PropertyNameArray.h \
+ Source/JavaScriptCore/runtime/PropertySlot.cpp \
+ Source/JavaScriptCore/runtime/PropertySlot.h \
+ Source/JavaScriptCore/runtime/Protect.h \
+ Source/JavaScriptCore/runtime/PrototypeFunction.cpp \
+ Source/JavaScriptCore/runtime/PrototypeFunction.h \
+ Source/JavaScriptCore/runtime/PutPropertySlot.h \
+ Source/JavaScriptCore/runtime/RegExpCache.cpp \
+ Source/JavaScriptCore/runtime/RegExpCache.h \
+ Source/JavaScriptCore/runtime/RegExpConstructor.cpp \
+ Source/JavaScriptCore/runtime/RegExpConstructor.h \
+ Source/JavaScriptCore/runtime/RegExp.cpp \
+ Source/JavaScriptCore/runtime/RegExp.h \
+ Source/JavaScriptCore/runtime/RegExpKey.h \
+ Source/JavaScriptCore/runtime/RegExpMatchesArray.h \
+ Source/JavaScriptCore/runtime/RegExpObject.cpp \
+ Source/JavaScriptCore/runtime/RegExpObject.h \
+ Source/JavaScriptCore/runtime/RegExpPrototype.cpp \
+ Source/JavaScriptCore/runtime/RegExpPrototype.h \
+ Source/JavaScriptCore/runtime/RopeImpl.cpp \
+ Source/JavaScriptCore/runtime/RopeImpl.h \
+ Source/JavaScriptCore/runtime/ScopeChain.cpp \
+ Source/JavaScriptCore/runtime/ScopeChain.h \
+ Source/JavaScriptCore/runtime/ScopeChainMark.h \
+ Source/JavaScriptCore/runtime/SmallStrings.cpp \
+ Source/JavaScriptCore/runtime/SmallStrings.h \
+ Source/JavaScriptCore/runtime/StrictEvalActivation.cpp \
+ Source/JavaScriptCore/runtime/StrictEvalActivation.h \
+ Source/JavaScriptCore/runtime/StringConstructor.cpp \
+ Source/JavaScriptCore/runtime/StringConstructor.h \
+ Source/JavaScriptCore/runtime/StringObject.cpp \
+ Source/JavaScriptCore/runtime/StringObject.h \
+ Source/JavaScriptCore/runtime/StringObjectThatMasqueradesAsUndefined.h \
+ Source/JavaScriptCore/runtime/StringPrototype.cpp \
+ Source/JavaScriptCore/runtime/StringPrototype.h \
+ Source/JavaScriptCore/runtime/StructureChain.cpp \
+ Source/JavaScriptCore/runtime/StructureChain.h \
+ Source/JavaScriptCore/runtime/Structure.cpp \
+ Source/JavaScriptCore/runtime/Structure.h \
+ Source/JavaScriptCore/runtime/StructureTransitionTable.h \
+ Source/JavaScriptCore/runtime/SymbolTable.h \
+ Source/JavaScriptCore/runtime/Terminator.h \
+ Source/JavaScriptCore/runtime/TimeoutChecker.cpp \
+ Source/JavaScriptCore/runtime/TimeoutChecker.h \
+ Source/JavaScriptCore/runtime/Tracing.h \
+ Source/JavaScriptCore/runtime/UString.cpp \
+ Source/JavaScriptCore/runtime/UString.h \
+ Source/JavaScriptCore/runtime/UStringBuilder.h \
+ Source/JavaScriptCore/runtime/UStringConcatenate.h \
+ Source/JavaScriptCore/runtime/WeakGCMap.h \
+ Source/JavaScriptCore/runtime/WeakGCPtr.h \
+ Source/JavaScriptCore/runtime/WeakRandom.h \
+ Source/JavaScriptCore/wtf/AlwaysInline.h \
+ Source/JavaScriptCore/wtf/ASCIICType.h \
+ Source/JavaScriptCore/wtf/Assertions.cpp \
+ Source/JavaScriptCore/wtf/Assertions.h \
+ Source/JavaScriptCore/wtf/Atomics.h \
+ Source/JavaScriptCore/wtf/AVLTree.h \
+ Source/JavaScriptCore/wtf/Bitmap.h \
+ Source/JavaScriptCore/wtf/BumpPointerAllocator.h \
+ Source/JavaScriptCore/wtf/ByteArray.cpp \
+ Source/JavaScriptCore/wtf/ByteArray.h \
+ Source/JavaScriptCore/wtf/CrossThreadRefCounted.h \
+ Source/JavaScriptCore/wtf/CurrentTime.cpp \
+ Source/JavaScriptCore/wtf/CurrentTime.h \
+ Source/JavaScriptCore/wtf/DateMath.cpp \
+ Source/JavaScriptCore/wtf/DateMath.h \
+ Source/JavaScriptCore/wtf/DecimalNumber.h \
+ Source/JavaScriptCore/wtf/DecimalNumber.cpp \
+ Source/JavaScriptCore/wtf/Decoder.h \
+ Source/JavaScriptCore/wtf/Deque.h \
+ Source/JavaScriptCore/wtf/DisallowCType.h \
+ Source/JavaScriptCore/wtf/dtoa.cpp \
+ Source/JavaScriptCore/wtf/dtoa.h \
+ Source/JavaScriptCore/wtf/Encoder.h \
+ Source/JavaScriptCore/wtf/FastAllocBase.h \
+ Source/JavaScriptCore/wtf/FastMalloc.cpp \
+ Source/JavaScriptCore/wtf/FastMalloc.h \
+ Source/JavaScriptCore/wtf/FixedArray.h \
+ Source/JavaScriptCore/wtf/Forward.h \
+ Source/JavaScriptCore/wtf/GetPtr.h \
+ Source/JavaScriptCore/wtf/gobject/GOwnPtr.cpp \
+ Source/JavaScriptCore/wtf/gobject/GOwnPtr.h \
+ Source/JavaScriptCore/wtf/gobject/GRefPtr.cpp \
+ Source/JavaScriptCore/wtf/gobject/GRefPtr.h \
+ Source/JavaScriptCore/wtf/gobject/GTypedefs.h \
+ Source/JavaScriptCore/wtf/gtk/MainThreadGtk.cpp \
+ Source/JavaScriptCore/wtf/gtk/ThreadingGtk.cpp \
+ Source/JavaScriptCore/wtf/HashCountedSet.h \
+ Source/JavaScriptCore/wtf/HashFunctions.h \
+ Source/JavaScriptCore/wtf/HashIterators.h \
+ Source/JavaScriptCore/wtf/HashMap.h \
+ Source/JavaScriptCore/wtf/HashSet.h \
+ Source/JavaScriptCore/wtf/HashTable.cpp \
+ Source/JavaScriptCore/wtf/HashTable.h \
+ Source/JavaScriptCore/wtf/HashTraits.h \
+ Source/JavaScriptCore/wtf/ListHashSet.h \
+ Source/JavaScriptCore/wtf/ListRefPtr.h \
+ Source/JavaScriptCore/wtf/Locker.h \
+ Source/JavaScriptCore/wtf/MainThread.cpp \
+ Source/JavaScriptCore/wtf/MainThread.h \
+ Source/JavaScriptCore/wtf/MallocZoneSupport.h \
+ Source/JavaScriptCore/wtf/MathExtras.h \
+ Source/JavaScriptCore/wtf/MD5.cpp \
+ Source/JavaScriptCore/wtf/MD5.h \
+ Source/JavaScriptCore/wtf/MessageQueue.h \
+ Source/JavaScriptCore/wtf/NonCopyingSort.h \
+ Source/JavaScriptCore/wtf/Noncopyable.h \
+ Source/JavaScriptCore/wtf/NotFound.h \
+ Source/JavaScriptCore/wtf/NullPtr.h \
+ Source/JavaScriptCore/wtf/OSAllocator.h \
+ Source/JavaScriptCore/wtf/OwnArrayPtr.h \
+ Source/JavaScriptCore/wtf/OwnFastMallocPtr.h \
+ Source/JavaScriptCore/wtf/OwnArrayPtrCommon.h \
+ Source/JavaScriptCore/wtf/OwnPtrCommon.h \
+ Source/JavaScriptCore/wtf/OwnPtr.h \
+ Source/JavaScriptCore/wtf/PageAllocation.h \
+ Source/JavaScriptCore/wtf/PageAllocationAligned.cpp \
+ Source/JavaScriptCore/wtf/PageAllocationAligned.h \
+ Source/JavaScriptCore/wtf/PageReservation.h \
+ Source/JavaScriptCore/wtf/PageBlock.cpp \
+ Source/JavaScriptCore/wtf/PageBlock.h \
+ Source/JavaScriptCore/wtf/PassOwnArrayPtr.h \
+ Source/JavaScriptCore/wtf/PassOwnPtr.h \
+ Source/JavaScriptCore/wtf/PassRefPtr.h \
+ Source/JavaScriptCore/wtf/Platform.h \
+ Source/JavaScriptCore/wtf/PossiblyNull.h \
+ Source/JavaScriptCore/wtf/RandomNumber.cpp \
+ Source/JavaScriptCore/wtf/RandomNumber.h \
+ Source/JavaScriptCore/wtf/RandomNumberSeed.h \
+ Source/JavaScriptCore/wtf/RefCounted.h \
+ Source/JavaScriptCore/wtf/RefCountedLeakCounter.cpp \
+ Source/JavaScriptCore/wtf/RefCountedLeakCounter.h \
+ Source/JavaScriptCore/wtf/RefPtr.h \
+ Source/JavaScriptCore/wtf/RefPtrHashMap.h \
+ Source/JavaScriptCore/wtf/RetainPtr.h \
+ Source/JavaScriptCore/wtf/SegmentedVector.h \
+ Source/JavaScriptCore/wtf/StackBounds.cpp \
+ Source/JavaScriptCore/wtf/StackBounds.h \
+ Source/JavaScriptCore/wtf/StaticConstructors.h \
+ Source/JavaScriptCore/wtf/StdLibExtras.h \
+ Source/JavaScriptCore/wtf/StringExtras.h \
+ Source/JavaScriptCore/wtf/StringHasher.h \
+ Source/JavaScriptCore/wtf/TCPackedCache.h \
+ Source/JavaScriptCore/wtf/TCPageMap.h \
+ Source/JavaScriptCore/wtf/TCSpinLock.h \
+ Source/JavaScriptCore/wtf/TCSystemAlloc.cpp \
+ Source/JavaScriptCore/wtf/TCSystemAlloc.h \
+ Source/JavaScriptCore/wtf/text/AtomicString.cpp \
+ Source/JavaScriptCore/wtf/text/AtomicString.h \
+ Source/JavaScriptCore/wtf/text/AtomicStringHash.h \
+ Source/JavaScriptCore/wtf/text/AtomicStringImpl.h \
+ Source/JavaScriptCore/wtf/text/CString.cpp \
+ Source/JavaScriptCore/wtf/text/CString.h \
+ Source/JavaScriptCore/wtf/text/StringBuffer.h \
+ Source/JavaScriptCore/wtf/text/StringBuilder.cpp \
+ Source/JavaScriptCore/wtf/text/StringBuilder.h \
+ Source/JavaScriptCore/wtf/text/StringConcatenate.h \
+ Source/JavaScriptCore/wtf/text/StringHash.h \
+ Source/JavaScriptCore/wtf/text/StringImplBase.h \
+ Source/JavaScriptCore/wtf/text/StringImpl.cpp \
+ Source/JavaScriptCore/wtf/text/StringImpl.h \
+ Source/JavaScriptCore/wtf/text/StringStatics.cpp \
+ Source/JavaScriptCore/wtf/text/TextPosition.h \
+ Source/JavaScriptCore/wtf/text/WTFString.cpp \
+ Source/JavaScriptCore/wtf/text/WTFString.h \
+ Source/JavaScriptCore/wtf/ThreadIdentifierDataPthreads.cpp \
+ Source/JavaScriptCore/wtf/ThreadIdentifierDataPthreads.h \
+ Source/JavaScriptCore/wtf/Threading.cpp \
+ Source/JavaScriptCore/wtf/Threading.h \
+ Source/JavaScriptCore/wtf/ThreadingPrimitives.h \
+ Source/JavaScriptCore/wtf/ThreadingPthreads.cpp \
+ Source/JavaScriptCore/wtf/ThreadSafeShared.h \
+ Source/JavaScriptCore/wtf/ThreadSpecific.h \
+ Source/JavaScriptCore/wtf/TypeTraits.cpp \
+ Source/JavaScriptCore/wtf/TypeTraits.h \
+ Source/JavaScriptCore/wtf/unicode/CollatorDefault.cpp \
+ Source/JavaScriptCore/wtf/unicode/Collator.h \
+ Source/JavaScriptCore/wtf/unicode/Unicode.h \
+ Source/JavaScriptCore/wtf/unicode/UTF8.cpp \
+ Source/JavaScriptCore/wtf/unicode/UTF8.h \
+ Source/JavaScriptCore/wtf/UnusedParam.h \
+ Source/JavaScriptCore/wtf/ValueCheck.h \
+ Source/JavaScriptCore/wtf/Vector.h \
+ Source/JavaScriptCore/wtf/VectorTraits.h \
+ Source/JavaScriptCore/wtf/VMTags.h \
+ Source/JavaScriptCore/wtf/WTFThreadData.cpp \
+ Source/JavaScriptCore/wtf/WTFThreadData.h \
+ Source/JavaScriptCore/yarr/RegexInterpreter.cpp \
+ Source/JavaScriptCore/yarr/RegexInterpreter.h \
+ Source/JavaScriptCore/yarr/RegexJIT.cpp \
+ Source/JavaScriptCore/yarr/RegexJIT.h \
+ Source/JavaScriptCore/yarr/RegexParser.h \
+ Source/JavaScriptCore/yarr/RegexPattern.cpp \
+ Source/JavaScriptCore/yarr/RegexPattern.h
+
+if TARGET_WIN32
+javascriptcore_sources += \
+ Source/JavaScriptCore/runtime/MarkStackWin.cpp \
+ Source/JavaScriptCore/wtf/OSAllocatorWin.cpp
+else
+javascriptcore_sources += \
+ Source/JavaScriptCore/jit/ExecutableAllocatorFixedVMPool.cpp \
+ Source/JavaScriptCore/runtime/MarkStackPosix.cpp \
+ Source/JavaScriptCore/wtf/OSAllocatorPosix.cpp
+endif
+
+# ----
+# icu unicode backend
+# ----
+if USE_ICU_UNICODE
+javascriptcore_sources += \
+ Source/JavaScriptCore/wtf/unicode/icu/CollatorICU.cpp \
+ Source/JavaScriptCore/wtf/unicode/icu/UnicodeIcu.h
+endif # USE_ICU_UNICODE
+
+# ----
+# glib unicode backend
+# ----
+if USE_GLIB_UNICODE
+javascriptcore_sources += \
+ Source/JavaScriptCore/wtf/unicode/UnicodeMacrosFromICU.h \
+ Source/JavaScriptCore/wtf/unicode/glib/UnicodeGLib.h \
+ Source/JavaScriptCore/wtf/unicode/glib/UnicodeGLib.cpp
+endif
+
+Source/JavaScriptCore/Lexer.lut.h: $(srcdir)/Source/JavaScriptCore/create_hash_table $(srcdir)/Source/JavaScriptCore/parser/Keywords.table
+ $(AM_V_GEN)$(PERL) $^ > $@
+
+Source/JavaScriptCore/%.lut.h: $(srcdir)/Source/JavaScriptCore/create_hash_table $(srcdir)/Source/JavaScriptCore/%.cpp
+ $(AM_V_GEN)$(PERL) $^ -i > $@
+
+Source/JavaScriptCore/RegExpJitTables.h: $(srcdir)/Source/JavaScriptCore/create_regex_tables
+ $(AM_V_GEN)$(PYTHON) $^ > $@
+
+Source/JavaScriptCore/pcre/chartables.c: $(srcdir)/Source/JavaScriptCore/pcre/dftables
+ $(AM_V_GEN)$(PERL) $^ $@
+
+jsc: $(javascriptcore_built_nosources) Programs/jsc-@WEBKITGTK_API_MAJOR_VERSION@$(EXEEXT);
+
+bin_PROGRAMS += \
+ Programs/jsc-@WEBKITGTK_API_MAJOR_VERSION@$(EXEEXT)
+
+noinst_PROGRAMS += \
+ Programs/jsc \
+ Programs/minidom
+
+# minidom
+Programs_minidom_SOURCES = \
+ Source/JavaScriptCore/API/tests/JSNode.c \
+ Source/JavaScriptCore/API/tests/JSNode.h \
+ Source/JavaScriptCore/API/tests/JSNodeList.c \
+ Source/JavaScriptCore/API/tests/JSNodeList.h \
+ Source/JavaScriptCore/API/tests/Node.c \
+ Source/JavaScriptCore/API/tests/Node.h \
+ Source/JavaScriptCore/API/tests/NodeList.c \
+ Source/JavaScriptCore/API/tests/NodeList.h \
+ Source/JavaScriptCore/API/tests/minidom.c
+
+Programs_minidom_CPPFLAGS = \
+ $(global_cppflags) \
+ $(javascriptcore_cppflags)
+
+Programs_minidom_CFLAGS = \
+ -ansi \
+ -fno-strict-aliasing \
+ $(global_cflags) \
+ $(GLOBALDEPS_CFLAGS)
+
+Programs_minidom_LDADD = \
+ libJavaScriptCore.la \
+ $(WINMM_LIBS) \
+ -lm \
+ -lstdc++
+
+Programs_minidom_LDFLAGS = \
+ -no-install \
+ -no-fast-install
+
+# jsc
+Programs/jsc-@WEBKITGTK_API_MAJOR_VERSION@$(EXEEXT): Programs/jsc$(EXEEXT)
+ $(AM_V_GEN)cp -f Programs/jsc$(EXEEXT) Programs/jsc-@WEBKITGTK_API_MAJOR_VERSION@$(EXEEXT)
+Programs_jsc_@WEBKITGTK_API_MAJOR_VERSION@_LDADD =
+Programs_jsc_@WEBKITGTK_API_MAJOR_VERSION@_SOURCES =
+
+Programs_jsc_SOURCES = \
+ Source/JavaScriptCore/jsc.cpp
+
+Programs_jsc_CPPFLAGS = \
+ $(global_cppflags) \
+ $(javascriptcore_cppflags)
+
+Programs_jsc_CXXFLAGS = \
+ -fno-strict-aliasing \
+ $(global_cxxflags) \
+ $(global_cflags) \
+ $(GLOBALDEPS_CFLAGS) \
+ $(UNICODE_CFLAGS)
+
+Programs_jsc_LDADD = \
+ libJavaScriptCore.la \
+ $(WINMM_LIBS)
+
+EXTRA_DIST += \
+ Source/JavaScriptCore/AUTHORS \
+ Source/JavaScriptCore/ChangeLog \
+ Source/JavaScriptCore/COPYING.LIB \
+ Source/JavaScriptCore/create_hash_table \
+ Source/JavaScriptCore/create_regex_tables \
+ Source/JavaScriptCore/icu/LICENSE \
+ Source/JavaScriptCore/icu/README \
+ Source/JavaScriptCore/parser/Keywords.table \
+ Source/JavaScriptCore/pcre/AUTHORS \
+ Source/JavaScriptCore/pcre/COPYING \
+ Source/JavaScriptCore/pcre/dftables \
+ Source/JavaScriptCore/pcre/ucptable.cpp \
+ Source/JavaScriptCore/THANKS
+
+# Clean rules for JavaScriptCore
+CLEANFILES += \
+ Source/JavaScriptCore/runtime/ArrayPrototype.lut.h \
+ Source/JavaScriptCore/runtime/DatePrototype.lut.h \
+ Source/JavaScriptCore/runtime/JSONObject.lut.h \
+ Source/JavaScriptCore/runtime/MathObject.lut.h \
+ Source/JavaScriptCore/runtime/NumberConstructor.lut.h \
+ Source/JavaScriptCore/runtime/RegExpConstructor.lut.h \
+ Source/JavaScriptCore/runtime/RegExpObject.lut.h \
+ Source/JavaScriptCore/runtime/StringPrototype.lut.h \
+ Source/JavaScriptCore/pcre/chartables.c \
+ Programs/jsc \
+ Programs/jsc-@WEBKITGTK_API_MAJOR_VERSION@ \
+ Programs/minidom
diff --git a/Source/JavaScriptCore/Info.plist b/Source/JavaScriptCore/Info.plist
new file mode 100644
index 0000000..a8ae5cc
--- /dev/null
+++ b/Source/JavaScriptCore/Info.plist
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleExecutable</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundleGetInfoString</key>
+ <string>${BUNDLE_VERSION}, Copyright 2003-2011 Apple Inc.; Copyright 1999-2001 Harri Porten &lt;porten@kde.org&gt;; Copyright 2001 Peter Kelly &lt;pmk@post.com&gt;; Copyright 1997-2005 University of Cambridge; Copyright 1991, 2000, 2001 by Lucent Technologies.</string>
+ <key>CFBundleIdentifier</key>
+ <string>com.apple.${PRODUCT_NAME}</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundlePackageType</key>
+ <string>FMWK</string>
+ <key>CFBundleShortVersionString</key>
+ <string>${SHORT_VERSION_STRING}</string>
+ <key>CFBundleVersion</key>
+ <string>${BUNDLE_VERSION}</string>
+</dict>
+</plist>
diff --git a/Source/JavaScriptCore/JavaScriptCore.JSVALUE32_64only.exp b/Source/JavaScriptCore/JavaScriptCore.JSVALUE32_64only.exp
new file mode 100644
index 0000000..7e520ae
--- /dev/null
+++ b/Source/JavaScriptCore/JavaScriptCore.JSVALUE32_64only.exp
@@ -0,0 +1,2 @@
+__ZN3JSC10JSFunctionC1EPNS_9ExecStateEPNS_14JSGlobalObjectEN3WTF17NonNullPassRefPtrINS_9StructureEEEiRKNS_10IdentifierEPFxS2_E
+__ZN3JSC17PrototypeFunctionC1EPNS_9ExecStateEPNS_14JSGlobalObjectEN3WTF17NonNullPassRefPtrINS_9StructureEEEiRKNS_10IdentifierEPFxS2_E
diff --git a/Source/JavaScriptCore/JavaScriptCore.JSVALUE32only.exp b/Source/JavaScriptCore/JavaScriptCore.JSVALUE32only.exp
new file mode 100644
index 0000000..73efb9d
--- /dev/null
+++ b/Source/JavaScriptCore/JavaScriptCore.JSVALUE32only.exp
@@ -0,0 +1,2 @@
+__ZN3JSC10JSFunctionC1EPNS_9ExecStateEPNS_14JSGlobalObjectEN3WTF17NonNullPassRefPtrINS_9StructureEEEiRKNS_10IdentifierEPFPvS2_E
+__ZN3JSC17PrototypeFunctionC1EPNS_9ExecStateEPNS_14JSGlobalObjectEN3WTF17NonNullPassRefPtrINS_9StructureEEEiRKNS_10IdentifierEPFPvS2_E
diff --git a/Source/JavaScriptCore/JavaScriptCore.JSVALUE64only.exp b/Source/JavaScriptCore/JavaScriptCore.JSVALUE64only.exp
new file mode 100644
index 0000000..73efb9d
--- /dev/null
+++ b/Source/JavaScriptCore/JavaScriptCore.JSVALUE64only.exp
@@ -0,0 +1,2 @@
+__ZN3JSC10JSFunctionC1EPNS_9ExecStateEPNS_14JSGlobalObjectEN3WTF17NonNullPassRefPtrINS_9StructureEEEiRKNS_10IdentifierEPFPvS2_E
+__ZN3JSC17PrototypeFunctionC1EPNS_9ExecStateEPNS_14JSGlobalObjectEN3WTF17NonNullPassRefPtrINS_9StructureEEEiRKNS_10IdentifierEPFPvS2_E
diff --git a/Source/JavaScriptCore/JavaScriptCore.exp b/Source/JavaScriptCore/JavaScriptCore.exp
new file mode 100644
index 0000000..2e999ef
--- /dev/null
+++ b/Source/JavaScriptCore/JavaScriptCore.exp
@@ -0,0 +1,595 @@
+_JSCheckScriptSyntax
+_JSClassCreate
+_JSClassRelease
+_JSClassRetain
+_JSContextGetGlobalContext
+_JSContextGetGlobalObject
+_JSContextGetGroup
+_JSContextGroupCreate
+_JSContextGroupRelease
+_JSContextGroupRetain
+_JSEndProfiling
+_JSEvaluateScript
+_JSGarbageCollect
+_JSGlobalContextCreate
+_JSGlobalContextCreateInGroup
+_JSGlobalContextRelease
+_JSGlobalContextRetain
+_JSObjectCallAsConstructor
+_JSObjectCallAsFunction
+_JSObjectCopyPropertyNames
+_JSObjectDeletePrivateProperty
+_JSObjectDeleteProperty
+_JSObjectGetPrivate
+_JSObjectGetPrivateProperty
+_JSObjectGetProperty
+_JSObjectGetPropertyAtIndex
+_JSObjectGetPrototype
+_JSObjectHasProperty
+_JSObjectIsConstructor
+_JSObjectIsFunction
+_JSObjectMake
+_JSObjectMakeArray
+_JSObjectMakeConstructor
+_JSObjectMakeDate
+_JSObjectMakeError
+_JSObjectMakeFunction
+_JSObjectMakeFunctionWithCallback
+_JSObjectMakeRegExp
+_JSObjectSetPrivate
+_JSObjectSetPrivateProperty
+_JSObjectSetProperty
+_JSObjectSetPropertyAtIndex
+_JSObjectSetPrototype
+_JSPropertyNameAccumulatorAddName
+_JSPropertyNameArrayGetCount
+_JSPropertyNameArrayGetNameAtIndex
+_JSPropertyNameArrayRelease
+_JSPropertyNameArrayRetain
+_JSReportExtraMemoryCost
+_JSStartProfiling
+_JSStringCopyCFString
+_JSStringCreateWithCFString
+_JSStringCreateWithCharacters
+_JSStringCreateWithUTF8CString
+_JSStringGetCharactersPtr
+_JSStringGetLength
+_JSStringGetMaximumUTF8CStringSize
+_JSStringGetUTF8CString
+_JSStringIsEqual
+_JSStringIsEqualToUTF8CString
+_JSStringRelease
+_JSStringRetain
+_JSValueCreateJSONString
+_JSValueGetType
+_JSValueIsBoolean
+_JSValueIsEqual
+_JSValueIsInstanceOfConstructor
+_JSValueIsNull
+_JSValueIsNumber
+_JSValueIsObject
+_JSValueIsObjectOfClass
+_JSValueIsStrictEqual
+_JSValueIsString
+_JSValueIsUndefined
+_JSValueMakeBoolean
+_JSValueMakeFromJSONString
+_JSValueMakeNull
+_JSValueMakeNumber
+_JSValueMakeString
+_JSValueMakeUndefined
+_JSValueProtect
+_JSValueToBoolean
+_JSValueToNumber
+_JSValueToObject
+_JSValueToStringCopy
+_JSValueUnprotect
+_JSWeakObjectMapClear
+_JSWeakObjectMapCreate
+_JSWeakObjectMapGet
+_JSWeakObjectMapSet
+_WTFLog
+_WTFLogVerbose
+_WTFReportArgumentAssertionFailure
+_WTFReportAssertionFailure
+_WTFReportAssertionFailureWithMessage
+_WTFReportError
+_WTFReportFatalError
+__Z12jsRegExpFreeP8JSRegExp
+__Z15jsRegExpCompilePKti24JSRegExpIgnoreCaseOption23JSRegExpMultilineOptionPjPPKc
+__Z15jsRegExpExecutePK8JSRegExpPKtiiPii
+__ZN14OpaqueJSString6createERKN3JSC7UStringE
+__ZN3JSC10Identifier11addSlowCaseEPNS_12JSGlobalDataEPN3WTF10StringImplE
+__ZN3JSC10Identifier11addSlowCaseEPNS_9ExecStateEPN3WTF10StringImplE
+__ZN3JSC10Identifier27checkCurrentIdentifierTableEPNS_12JSGlobalDataE
+__ZN3JSC10Identifier27checkCurrentIdentifierTableEPNS_9ExecStateE
+__ZN3JSC10Identifier3addEPNS_9ExecStateEPKc
+__ZN3JSC10Identifier4fromEPNS_9ExecStateEi
+__ZN3JSC10Identifier4fromEPNS_9ExecStateEj
+__ZN3JSC10Identifier5equalEPKN3WTF10StringImplEPKc
+__ZN3JSC10Identifier8toUInt32ERKNS_7UStringERb
+__ZN3JSC10JSFunction4infoE
+__ZN3JSC10JSFunction4nameEPNS_9ExecStateE
+__ZN3JSC10throwErrorEPNS_9ExecStateENS_7JSValueE
+__ZN3JSC10throwErrorEPNS_9ExecStateEPNS_8JSObjectE
+__ZN3JSC11JSByteArray15createStructureENS_7JSValueE
+__ZN3JSC11JSByteArrayC1EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_9StructureEEEPNS3_9ByteArrayEPKNS_9ClassInfoE
+__ZN3JSC11ParserArena5resetEv
+__ZN3JSC11checkSyntaxEPNS_9ExecStateERKNS_10SourceCodeE
+__ZN3JSC11createErrorEPNS_9ExecStateERKNS_7UStringE
+__ZN3JSC12DateInstance4infoE
+__ZN3JSC12DateInstanceC1EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_9StructureEEEd
+__ZN3JSC12DateInstanceC1EPNS_9ExecStateEd
+__ZN3JSC12JSGlobalData10ClientDataD2Ev
+__ZN3JSC12JSGlobalData11jsArrayVPtrE
+__ZN3JSC12JSGlobalData12createLeakedENS_15ThreadStackTypeE
+__ZN3JSC12JSGlobalData12jsStringVPtrE
+__ZN3JSC12JSGlobalData12stopSamplingEv
+__ZN3JSC12JSGlobalData13startSamplingEv
+__ZN3JSC12JSGlobalData14dumpSampleDataEPNS_9ExecStateE
+__ZN3JSC12JSGlobalData14resetDateCacheEv
+__ZN3JSC12JSGlobalData14sharedInstanceEv
+__ZN3JSC12JSGlobalData15dumpRegExpTraceEv
+__ZN3JSC12JSGlobalData6createENS_15ThreadStackTypeE
+__ZN3JSC12JSGlobalDataD1Ev
+__ZN3JSC12RegExpObject4infoE
+__ZN3JSC12RegExpObjectC1EPNS_14JSGlobalObjectEN3WTF17NonNullPassRefPtrINS_9StructureEEENS4_INS_6RegExpEEE
+__ZN3JSC12SamplingTool5setupEv
+__ZN3JSC12SmallStrings17createEmptyStringEPNS_12JSGlobalDataE
+__ZN3JSC12SmallStrings27createSingleCharacterStringEPNS_12JSGlobalDataEh
+__ZN3JSC12StringObject14deletePropertyEPNS_9ExecStateERKNS_10IdentifierE
+__ZN3JSC12StringObject18getOwnPropertySlotEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE
+__ZN3JSC12StringObject18getOwnPropertySlotEPNS_9ExecStateEjRNS_12PropertySlotE
+__ZN3JSC12StringObject19getOwnPropertyNamesEPNS_9ExecStateERNS_17PropertyNameArrayENS_15EnumerationModeE
+__ZN3JSC12StringObject24getOwnPropertyDescriptorEPNS_9ExecStateERKNS_10IdentifierERNS_18PropertyDescriptorE
+__ZN3JSC12StringObject3putEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueERNS_15PutPropertySlotE
+__ZN3JSC12StringObject4infoE
+__ZN3JSC12StringObjectC2EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_9StructureEEERKNS_7UStringE
+__ZN3JSC12WeakGCHandle4poolEv
+__ZN3JSC12jsNumberCellEPNS_9ExecStateEd
+__ZN3JSC12nonInlineNaNEv
+__ZN3JSC13SamplingFlags4stopEv
+__ZN3JSC13SamplingFlags5startEv
+__ZN3JSC13SamplingFlags7s_flagsE
+__ZN3JSC13StatementNode6setLocEii
+__ZN3JSC14JSGlobalObject10globalExecEv
+__ZN3JSC14JSGlobalObject12defineGetterEPNS_9ExecStateERKNS_10IdentifierEPNS_8JSObjectEj
+__ZN3JSC14JSGlobalObject12defineSetterEPNS_9ExecStateERKNS_10IdentifierEPNS_8JSObjectEj
+__ZN3JSC14JSGlobalObject12markChildrenERNS_9MarkStackE
+__ZN3JSC14JSGlobalObject17putWithAttributesEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueEj
+__ZN3JSC14JSGlobalObject25destroyJSGlobalObjectDataEPv
+__ZN3JSC14JSGlobalObject3putEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueERNS_15PutPropertySlotE
+__ZN3JSC14JSGlobalObject4initEPNS_8JSObjectE
+__ZN3JSC14JSGlobalObjectD2Ev
+__ZN3JSC14JSGlobalObjectnwEmPNS_12JSGlobalDataE
+__ZN3JSC14SamplingThread4stopEv
+__ZN3JSC14SamplingThread5startEj
+__ZN3JSC14TimeoutChecker10didTimeOutEPNS_9ExecStateE
+__ZN3JSC14TimeoutChecker5resetEv
+__ZN3JSC14heapStatisticsEPNS_12JSGlobalDataE
+__ZN3JSC14throwTypeErrorEPNS_9ExecStateE
+__ZN3JSC15JSWrapperObject12markChildrenERNS_9MarkStackE
+__ZN3JSC15createTypeErrorEPNS_9ExecStateERKNS_7UStringE
+__ZN3JSC16InternalFunction4infoE
+__ZN3JSC16InternalFunction4nameEPNS_9ExecStateE
+__ZN3JSC16InternalFunctionC2EPNS_12JSGlobalDataEPNS_14JSGlobalObjectEN3WTF17NonNullPassRefPtrINS_9StructureEEERKNS_10IdentifierE
+__ZN3JSC16JSVariableObject14deletePropertyEPNS_9ExecStateERKNS_10IdentifierE
+__ZN3JSC16JSVariableObject14symbolTableGetERKNS_10IdentifierERNS_18PropertyDescriptorE
+__ZN3JSC16JSVariableObject19getOwnPropertyNamesEPNS_9ExecStateERNS_17PropertyNameArrayENS_15EnumerationModeE
+__ZN3JSC16WeakGCHandlePool4freeEPNS_12WeakGCHandleE
+__ZN3JSC16createRangeErrorEPNS_9ExecStateERKNS_7UStringE
+__ZN3JSC16throwSyntaxErrorEPNS_9ExecStateE
+__ZN3JSC17BytecodeGenerator21setDumpsGeneratedCodeEb
+__ZN3JSC17PropertyNameArray3addEPN3WTF10StringImplE
+__ZN3JSC17constructFunctionEPNS_9ExecStateERKNS_7ArgListERKNS_10IdentifierERKNS_7UStringEi
+__ZN3JSC17createSyntaxErrorEPNS_9ExecStateERKNS_7UStringE
+__ZN3JSC18DebuggerActivationC1EPNS_8JSObjectE
+__ZN3JSC18PropertyDescriptor11setWritableEb
+__ZN3JSC18PropertyDescriptor12setUndefinedEv
+__ZN3JSC18PropertyDescriptor13setDescriptorENS_7JSValueEj
+__ZN3JSC18PropertyDescriptor13setEnumerableEb
+__ZN3JSC18PropertyDescriptor15setConfigurableEb
+__ZN3JSC18PropertyDescriptor17defaultAttributesE
+__ZN3JSC18PropertyDescriptor21setAccessorDescriptorENS_7JSValueES1_j
+__ZN3JSC18PropertyDescriptor9setGetterENS_7JSValueE
+__ZN3JSC18PropertyDescriptor9setSetterENS_7JSValueE
+__ZN3JSC19initializeThreadingEv
+__ZN3JSC20MarkedArgumentBuffer10slowAppendENS_7JSValueE
+__ZN3JSC20createReferenceErrorEPNS_9ExecStateERKNS_7UStringE
+__ZN3JSC22globalMemoryStatisticsEv
+__ZN3JSC23AbstractSamplingCounter4dumpEv
+__ZN3JSC23objectProtoFuncToStringEPNS_9ExecStateE
+__ZN3JSC23setUpStaticFunctionSlotEPNS_9ExecStateEPKNS_9HashEntryEPNS_8JSObjectERKNS_10IdentifierERNS_12PropertySlotE
+__ZN3JSC24DynamicGlobalObjectScopeC1EPNS_9ExecStateEPNS_14JSGlobalObjectE
+__ZN3JSC24JSObjectWithGlobalObjectC2EPNS_14JSGlobalObjectEN3WTF17NonNullPassRefPtrINS_9StructureEEE
+__ZN3JSC24createStackOverflowErrorEPNS_9ExecStateE
+__ZN3JSC24createStackOverflowErrorEPNS_9ExecStateE
+__ZN3JSC25evaluateInGlobalCallFrameERKNS_7UStringERNS_7JSValueEPNS_14JSGlobalObjectE
+__ZN3JSC35createInterruptedExecutionExceptionEPNS_12JSGlobalDataE
+__ZN3JSC3NaNE
+__ZN3JSC4Heap14primaryHeapEndEv
+__ZN3JSC4Heap15addWeakGCHandleEPNS_6JSCellE
+__ZN3JSC4Heap15recordExtraCostEm
+__ZN3JSC4Heap16objectTypeCountsEv
+__ZN3JSC4Heap16primaryHeapBeginEv
+__ZN3JSC4Heap17collectAllGarbageEv
+__ZN3JSC4Heap17globalObjectCountEv
+__ZN3JSC4Heap19setActivityCallbackEN3WTF10PassOwnPtrINS_18GCActivityCallbackEEE
+__ZN3JSC4Heap20protectedObjectCountEv
+__ZN3JSC4Heap25protectedObjectTypeCountsEv
+__ZN3JSC4Heap26protectedGlobalObjectCountEv
+__ZN3JSC4Heap6isBusyEv
+__ZN3JSC4Heap7destroyEv
+__ZN3JSC4Heap7protectENS_7JSValueE
+__ZN3JSC4Heap8allocateEm
+__ZN3JSC4Heap9unprotectENS_7JSValueE
+__ZN3JSC4callEPNS_9ExecStateENS_7JSValueENS_8CallTypeERKNS_8CallDataES2_RKNS_7ArgListE
+__ZN3JSC6JSCell11getCallDataERNS_8CallDataE
+__ZN3JSC6JSCell11getJSNumberEv
+__ZN3JSC6JSCell14deletePropertyEPNS_9ExecStateERKNS_10IdentifierE
+__ZN3JSC6JSCell14deletePropertyEPNS_9ExecStateEj
+__ZN3JSC6JSCell16getConstructDataERNS_13ConstructDataE
+__ZN3JSC6JSCell18getOwnPropertySlotEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE
+__ZN3JSC6JSCell18getOwnPropertySlotEPNS_9ExecStateEjRNS_12PropertySlotE
+__ZN3JSC6JSCell18getPrimitiveNumberEPNS_9ExecStateERdRNS_7JSValueE
+__ZN3JSC6JSCell3putEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueERNS_15PutPropertySlotE
+__ZN3JSC6JSCell3putEPNS_9ExecStateEjNS_7JSValueE
+__ZN3JSC6JSCell9getObjectEv
+__ZN3JSC6JSLock12DropAllLocksC1ENS_14JSLockBehaviorE
+__ZN3JSC6JSLock12DropAllLocksC1EPNS_9ExecStateE
+__ZN3JSC6JSLock12DropAllLocksD1Ev
+__ZN3JSC6JSLock4lockENS_14JSLockBehaviorE
+__ZN3JSC6JSLock6unlockENS_14JSLockBehaviorE
+__ZN3JSC6JSLock9lockCountEv
+__ZN3JSC6JSLockC1EPNS_9ExecStateE
+__ZN3JSC6RegExp6createEPNS_12JSGlobalDataERKNS_7UStringES5_
+__ZN3JSC6RegExpD1Ev
+__ZN3JSC7JSArray12markChildrenERNS_9MarkStackE
+__ZN3JSC7JSArray15setSubclassDataEPv
+__ZN3JSC7JSArray18getOwnPropertySlotEPNS_9ExecStateEjRNS_12PropertySlotE
+__ZN3JSC7JSArray4infoE
+__ZN3JSC7JSArray9setLengthEj
+__ZN3JSC7JSArrayC1EN3WTF17NonNullPassRefPtrINS_9StructureEEE
+__ZN3JSC7JSArrayC1EN3WTF17NonNullPassRefPtrINS_9StructureEEERKNS_7ArgListE
+__ZN3JSC7JSArrayC2EN3WTF17NonNullPassRefPtrINS_9StructureEEE
+__ZN3JSC7JSArrayD2Ev
+__ZN3JSC7JSValue13isValidCalleeEv
+__ZN3JSC7Profile10restoreAllEv
+__ZN3JSC7Profile5focusEPKNS_11ProfileNodeE
+__ZN3JSC7Profile7excludeEPKNS_11ProfileNodeE
+__ZN3JSC7Profile7forEachEMNS_11ProfileNodeEFvvE
+__ZN3JSC7UString6numberEd
+__ZN3JSC7UString6numberEi
+__ZN3JSC7UString6numberEj
+__ZN3JSC7UString6numberEl
+__ZN3JSC7UStringC1EPKc
+__ZN3JSC7UStringC1EPKcj
+__ZN3JSC7UStringC1EPKt
+__ZN3JSC7UStringC1EPKtj
+__ZN3JSC7toInt32Ed
+__ZN3JSC8Debugger23recompileAllJSFunctionsEPNS_12JSGlobalDataE
+__ZN3JSC8Debugger6attachEPNS_14JSGlobalObjectE
+__ZN3JSC8Debugger6detachEPNS_14JSGlobalObjectE
+__ZN3JSC8DebuggerD2Ev
+__ZN3JSC8JSObject11hasInstanceEPNS_9ExecStateENS_7JSValueES3_
+__ZN3JSC8JSObject12defineGetterEPNS_9ExecStateERKNS_10IdentifierEPS0_j
+__ZN3JSC8JSObject12defineSetterEPNS_9ExecStateERKNS_10IdentifierEPS0_j
+__ZN3JSC8JSObject12lookupGetterEPNS_9ExecStateERKNS_10IdentifierE
+__ZN3JSC8JSObject12lookupSetterEPNS_9ExecStateERKNS_10IdentifierE
+__ZN3JSC8JSObject12markChildrenERNS_9MarkStackE
+__ZN3JSC8JSObject14deletePropertyEPNS_9ExecStateERKNS_10IdentifierE
+__ZN3JSC8JSObject14deletePropertyEPNS_9ExecStateEj
+__ZN3JSC8JSObject15unwrappedObjectEv
+__ZN3JSC8JSObject16getPropertyNamesEPNS_9ExecStateERNS_17PropertyNameArrayENS_15EnumerationModeE
+__ZN3JSC8JSObject17createInheritorIDEv
+__ZN3JSC8JSObject17defineOwnPropertyEPNS_9ExecStateERKNS_10IdentifierERNS_18PropertyDescriptorEb
+__ZN3JSC8JSObject17putDirectFunctionEPNS_9ExecStateEPNS_10JSFunctionEj
+__ZN3JSC8JSObject17putDirectFunctionEPNS_9ExecStateEPNS_16InternalFunctionEj
+__ZN3JSC8JSObject17putWithAttributesEPNS_12JSGlobalDataERKNS_10IdentifierENS_7JSValueEj
+__ZN3JSC8JSObject17putWithAttributesEPNS_12JSGlobalDataERKNS_10IdentifierENS_7JSValueEjbRNS_15PutPropertySlotE
+__ZN3JSC8JSObject17putWithAttributesEPNS_12JSGlobalDataEjNS_7JSValueEj
+__ZN3JSC8JSObject17putWithAttributesEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueEj
+__ZN3JSC8JSObject17putWithAttributesEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueEjbRNS_15PutPropertySlotE
+__ZN3JSC8JSObject17putWithAttributesEPNS_9ExecStateEjNS_7JSValueEj
+__ZN3JSC8JSObject18getOwnPropertySlotEPNS_9ExecStateEjRNS_12PropertySlotE
+__ZN3JSC8JSObject18getPrimitiveNumberEPNS_9ExecStateERdRNS_7JSValueE
+__ZN3JSC8JSObject19getOwnPropertyNamesEPNS_9ExecStateERNS_17PropertyNameArrayENS_15EnumerationModeE
+__ZN3JSC8JSObject21getPropertyDescriptorEPNS_9ExecStateERKNS_10IdentifierERNS_18PropertyDescriptorE
+__ZN3JSC8JSObject22fillGetterPropertySlotERNS_12PropertySlotEPNS_7JSValueE
+__ZN3JSC8JSObject23allocatePropertyStorageEmm
+__ZN3JSC8JSObject24getOwnPropertyDescriptorEPNS_9ExecStateERKNS_10IdentifierERNS_18PropertyDescriptorE
+__ZN3JSC8JSObject3putEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueERNS_15PutPropertySlotE
+__ZN3JSC8JSObject3putEPNS_9ExecStateEjNS_7JSValueE
+__ZN3JSC8Profiler13stopProfilingEPNS_9ExecStateERKNS_7UStringE
+__ZN3JSC8Profiler14startProfilingEPNS_9ExecStateERKNS_7UStringE
+__ZN3JSC8Profiler8profilerEv
+__ZN3JSC8evaluateEPNS_9ExecStateERNS_10ScopeChainERKNS_10SourceCodeENS_7JSValueE
+__ZN3JSC9CodeBlockD1Ev
+__ZN3JSC9CodeBlockD2Ev
+__ZN3JSC9MarkStack10s_pageSizeE
+__ZN3JSC9MarkStack18initializePagesizeEv
+__ZN3JSC9Structure13hasTransitionEPN3WTF10StringImplEj
+__ZN3JSC9Structure17stopIgnoringLeaksEv
+__ZN3JSC9Structure18startIgnoringLeaksEv
+__ZN3JSC9Structure21addPropertyTransitionEPS0_RKNS_10IdentifierEjPNS_6JSCellERm
+__ZN3JSC9Structure22materializePropertyMapEv
+__ZN3JSC9Structure25changePrototypeTransitionEPS0_NS_7JSValueE
+__ZN3JSC9Structure27despecifyDictionaryFunctionERKNS_10IdentifierE
+__ZN3JSC9Structure27despecifyFunctionTransitionEPS0_RKNS_10IdentifierE
+__ZN3JSC9Structure28addPropertyWithoutTransitionERKNS_10IdentifierEjPNS_6JSCellE
+__ZN3JSC9Structure3getEPKN3WTF10StringImplERjRPNS_6JSCellE
+__ZN3JSC9Structure40addPropertyTransitionToExistingStructureEPS0_RKNS_10IdentifierEjPNS_6JSCellERm
+__ZN3JSC9StructureC1ENS_7JSValueERKNS_8TypeInfoEj
+__ZN3JSC9StructureD1Ev
+__ZN3JSC9constructEPNS_9ExecStateENS_7JSValueENS_13ConstructTypeERKNS_13ConstructDataERKNS_7ArgListE
+__ZN3JSCeqERKNS_7UStringEPKc
+__ZN3JSCgtERKNS_7UStringES2_
+__ZN3JSCltERKNS_7UStringES2_
+__ZN3WTF10StringImpl11reverseFindEPS0_j
+__ZN3WTF10StringImpl11reverseFindEtj
+__ZN3WTF10StringImpl12sharedBufferEv
+__ZN3WTF10StringImpl16findIgnoringCaseEPKcj
+__ZN3WTF10StringImpl16findIgnoringCaseEPS0_j
+__ZN3WTF10StringImpl18simplifyWhiteSpaceEv
+__ZN3WTF10StringImpl19characterStartingAtEj
+__ZN3WTF10StringImpl19createUninitializedEjRPt
+__ZN3WTF10StringImpl22containsOnlyWhitespaceEv
+__ZN3WTF10StringImpl23defaultWritingDirectionEv
+__ZN3WTF10StringImpl23reverseFindIgnoringCaseEPS0_j
+__ZN3WTF10StringImpl37createStrippingNullCharactersSlowCaseEPKtj
+__ZN3WTF10StringImpl4findEPFbtEj
+__ZN3WTF10StringImpl4findEPKcj
+__ZN3WTF10StringImpl4findEPS0_j
+__ZN3WTF10StringImpl4findEtj
+__ZN3WTF10StringImpl5adoptERNS_12StringBufferE
+__ZN3WTF10StringImpl5emptyEv
+__ZN3WTF10StringImpl5lowerEv
+__ZN3WTF10StringImpl5toIntEPb
+__ZN3WTF10StringImpl5upperEv
+__ZN3WTF10StringImpl6createEPKc
+__ZN3WTF10StringImpl6createEPKcj
+__ZN3WTF10StringImpl6createEPKtj
+__ZN3WTF10StringImpl6secureEtNS0_21LastCharacterBehaviorE
+__ZN3WTF10StringImpl7replaceEPS0_S1_
+__ZN3WTF10StringImpl7replaceEjjPS0_
+__ZN3WTF10StringImpl7replaceEtPS0_
+__ZN3WTF10StringImpl7replaceEtt
+__ZN3WTF10StringImpl8endsWithEPS0_b
+__ZN3WTF10StringImpl9substringEjj
+__ZN3WTF10StringImplD1Ev
+__ZN3WTF10fastCallocEmm
+__ZN3WTF10fastMallocEm
+__ZN3WTF10fastStrDupEPKc
+__ZN3WTF11OSAllocator16reserveAndCommitEmNS0_5UsageEbb
+__ZN3WTF11OSAllocator18releaseDecommittedEPvm
+__ZN3WTF11commentAtomE
+__ZN3WTF11currentTimeEv
+__ZN3WTF11dtoaRoundDPEPcdiRbRiRj
+__ZN3WTF11dtoaRoundSFEPcdiRbRiRj
+__ZN3WTF11fastReallocEPvm
+__ZN3WTF12AtomicString11addSlowCaseEPNS_10StringImplE
+__ZN3WTF12AtomicString3addEPKc
+__ZN3WTF12AtomicString3addEPKt
+__ZN3WTF12AtomicString3addEPKtj
+__ZN3WTF12AtomicString3addEPKtjj
+__ZN3WTF12AtomicString4findEPKtjj
+__ZN3WTF12AtomicString4initEv
+__ZN3WTF12AtomicString8fromUTF8EPKc
+__ZN3WTF12AtomicString8fromUTF8EPKcm
+__ZN3WTF12createThreadEPFPvS0_ES0_
+__ZN3WTF12createThreadEPFPvS0_ES0_PKc
+__ZN3WTF12detachThreadEj
+__ZN3WTF12isMainThreadEv
+__ZN3WTF12randomNumberEv
+__ZN3WTF13StringBuilder11reifyStringEv
+__ZN3WTF13StringBuilder11shrinkToFitEv
+__ZN3WTF13StringBuilder6appendEPKcj
+__ZN3WTF13StringBuilder6appendEPKtj
+__ZN3WTF13StringBuilder6resizeEj
+__ZN3WTF13WTFThreadData10staticDataE
+__ZN3WTF13WTFThreadDataC1Ev
+__ZN3WTF13WTFThreadDataD1Ev
+__ZN3WTF13currentThreadEv
+__ZN3WTF13tryFastCallocEmm
+__ZN3WTF13tryFastMallocEm
+__ZN3WTF14fastMallocSizeEPKv
+__ZN3WTF14numberToStringEdPt
+__ZN3WTF14tryFastReallocEPvm
+__ZN3WTF15ThreadCondition4waitERNS_5MutexE
+__ZN3WTF15ThreadCondition6signalEv
+__ZN3WTF15ThreadCondition9broadcastEv
+__ZN3WTF15ThreadCondition9timedWaitERNS_5MutexEd
+__ZN3WTF15ThreadConditionC1Ev
+__ZN3WTF15ThreadConditionD1Ev
+__ZN3WTF15charactersToIntEPKtmPb
+__ZN3WTF16callOnMainThreadEPFvPvES0_
+__ZN3WTF16codePointCompareERKNS_6StringES2_
+__ZN3WTF16fastZeroedMallocEm
+__ZN3WTF17charactersToFloatEPKtmPb
+__ZN3WTF17equalIgnoringCaseEPKtPKcj
+__ZN3WTF17equalIgnoringCaseEPNS_10StringImplEPKc
+__ZN3WTF17equalIgnoringCaseEPNS_10StringImplES1_
+__ZN3WTF18calculateDSTOffsetEdd
+__ZN3WTF18calculateUTCOffsetEv
+__ZN3WTF18charactersToDoubleEPKtmPb
+__ZN3WTF18dateToDaysFrom1970Eiii
+__ZN3WTF18monthFromDayInYearEib
+__ZN3WTF19initializeThreadingEv
+__ZN3WTF20equalIgnoringNullityEPNS_10StringImplES1_
+__ZN3WTF20fastMallocStatisticsEv
+__ZN3WTF20initializeMainThreadEv
+__ZN3WTF21RefCountedLeakCounter16suppressMessagesEPKc
+__ZN3WTF21RefCountedLeakCounter24cancelMessageSuppressionEPKc
+__ZN3WTF21RefCountedLeakCounter9decrementEv
+__ZN3WTF21RefCountedLeakCounter9incrementEv
+__ZN3WTF21RefCountedLeakCounterC1EPKc
+__ZN3WTF21RefCountedLeakCounterD1Ev
+__ZN3WTF21charactersToIntStrictEPKtmPbi
+__ZN3WTF22charactersToUIntStrictEPKtmPbi
+__ZN3WTF23callOnMainThreadAndWaitEPFvPvES0_
+__ZN3WTF23dayInMonthFromDayInYearEib
+__ZN3WTF23waitForThreadCompletionEjPPv
+__ZN3WTF27releaseFastMallocFreeMemoryEv
+__ZN3WTF28setMainThreadCallbacksPausedEb
+__ZN3WTF36lockAtomicallyInitializedStaticMutexEv
+__ZN3WTF37parseDateFromNullTerminatedCharactersEPKc
+__ZN3WTF38unlockAtomicallyInitializedStaticMutexEv
+__ZN3WTF39initializeMainThreadToProcessMainThreadEv
+__ZN3WTF3MD58addBytesEPKhm
+__ZN3WTF3MD58checksumERNS_6VectorIhLm16EEE
+__ZN3WTF3MD5C1Ev
+__ZN3WTF4dtoaEPcdRbRiRj
+__ZN3WTF5Mutex4lockEv
+__ZN3WTF5Mutex6unlockEv
+__ZN3WTF5Mutex7tryLockEv
+__ZN3WTF5MutexC1Ev
+__ZN3WTF5MutexD1Ev
+__ZN3WTF5equalEPKNS_10StringImplEPKc
+__ZN3WTF5equalEPKNS_10StringImplES2_
+__ZN3WTF5yieldEv
+__ZN3WTF6String26fromUTF8WithLatin1FallbackEPKcm
+__ZN3WTF6String29charactersWithNullTerminationEv
+__ZN3WTF6String6appendEPKtj
+__ZN3WTF6String6appendERKS0_
+__ZN3WTF6String6appendEc
+__ZN3WTF6String6appendEt
+__ZN3WTF6String6formatEPKcz
+__ZN3WTF6String6insertERKS0_j
+__ZN3WTF6String6numberEd
+__ZN3WTF6String6numberEi
+__ZN3WTF6String6numberEj
+__ZN3WTF6String6numberEl
+__ZN3WTF6String6numberEm
+__ZN3WTF6String6numberEt
+__ZN3WTF6String6numberEx
+__ZN3WTF6String6numberEy
+__ZN3WTF6String6removeEji
+__ZN3WTF6String8fromUTF8EPKc
+__ZN3WTF6String8fromUTF8EPKcm
+__ZN3WTF6String8truncateEj
+__ZN3WTF6StringC1EPKc
+__ZN3WTF6StringC1EPKcj
+__ZN3WTF6StringC1EPKt
+__ZN3WTF6StringC1EPKtj
+__ZN3WTF6strtodEPKcPPc
+__ZN3WTF7CString11mutableDataEv
+__ZN3WTF7CString16newUninitializedEmRPc
+__ZN3WTF7CStringC1EPKc
+__ZN3WTF7CStringC1EPKcm
+__ZN3WTF7Unicode18convertUTF16ToUTF8EPPKtS2_PPcS4_b
+__ZN3WTF7Unicode18convertUTF8ToUTF16EPPKcS2_PPtS4_b
+__ZN3WTF7xmlAtomE
+__ZN3WTF8Collator18setOrderLowerFirstEb
+__ZN3WTF8CollatorC1EPKc
+__ZN3WTF8CollatorD1Ev
+__ZN3WTF8fastFreeEPv
+__ZN3WTF8msToYearEd
+__ZN3WTF8nullAtomE
+__ZN3WTF8starAtomE
+__ZN3WTF8textAtomE
+__ZN3WTF9ByteArray6createEm
+__ZN3WTF9dayInYearEdi
+__ZN3WTF9emptyAtomE
+__ZN3WTF9xmlnsAtomE
+__ZN3WTFeqERKNS_12AtomicStringEPKc
+__ZN3WTFeqERKNS_12AtomicStringERKNS_6VectorItLm0EEE
+__ZN3WTFeqERKNS_7CStringES2_
+__ZN3WTFplEPKcRKNS_6StringE
+__ZN3WTFplERKNS_6StringEPKc
+__ZN3WTFplERKNS_6StringES2_
+__ZNK3JSC10JSFunction23isHostFunctionNonInlineEv
+__ZNK3JSC11Interpreter14retrieveCallerEPNS_9ExecStateEPNS_10JSFunctionE
+__ZNK3JSC11Interpreter18retrieveLastCallerEPNS_9ExecStateERiRlRNS_7UStringERNS_7JSValueE
+__ZNK3JSC12PropertySlot14functionGetterEPNS_9ExecStateE
+__ZNK3JSC14JSGlobalObject14isDynamicScopeERb
+__ZNK3JSC16InternalFunction9classInfoEv
+__ZNK3JSC16JSVariableObject16isVariableObjectEv
+__ZNK3JSC17DebuggerCallFrame10thisObjectEv
+__ZNK3JSC17DebuggerCallFrame12functionNameEv
+__ZNK3JSC17DebuggerCallFrame22calculatedFunctionNameEv
+__ZNK3JSC17DebuggerCallFrame4typeEv
+__ZNK3JSC17DebuggerCallFrame8evaluateERKNS_7UStringERNS_7JSValueE
+__ZNK3JSC18PropertyDescriptor10enumerableEv
+__ZNK3JSC18PropertyDescriptor12configurableEv
+__ZNK3JSC18PropertyDescriptor16isDataDescriptorEv
+__ZNK3JSC18PropertyDescriptor20isAccessorDescriptorEv
+__ZNK3JSC18PropertyDescriptor6getterEv
+__ZNK3JSC18PropertyDescriptor6setterEv
+__ZNK3JSC18PropertyDescriptor8writableEv
+__ZNK3JSC24JSObjectWithGlobalObject12globalObjectEv
+__ZNK3JSC4Heap10statisticsEv
+__ZNK3JSC4Heap11objectCountEv
+__ZNK3JSC4Heap4sizeEv
+__ZNK3JSC6JSCell11toPrimitiveEPNS_9ExecStateENS_22PreferredPrimitiveTypeE
+__ZNK3JSC6JSCell12toThisObjectEPNS_9ExecStateE
+__ZNK3JSC6JSCell14isGetterSetterEv
+__ZNK3JSC6JSCell8toNumberEPNS_9ExecStateE
+__ZNK3JSC6JSCell8toObjectEPNS_9ExecStateE
+__ZNK3JSC6JSCell8toStringEPNS_9ExecStateE
+__ZNK3JSC6JSCell9classInfoEv
+__ZNK3JSC6JSCell9getStringEPNS_9ExecStateE
+__ZNK3JSC6JSCell9getStringEPNS_9ExecStateERNS_7UStringE
+__ZNK3JSC6JSCell9getUInt32ERj
+__ZNK3JSC6JSCell9toBooleanEPNS_9ExecStateE
+__ZNK3JSC7ArgList8getSliceEiRS0_
+__ZNK3JSC7JSArray12subclassDataEv
+__ZNK3JSC7JSValue16toObjectSlowCaseEPNS_9ExecStateE
+__ZNK3JSC7JSValue19synthesizePrototypeEPNS_9ExecStateE
+__ZNK3JSC7JSValue20toThisObjectSlowCaseEPNS_9ExecStateE
+__ZNK3JSC7JSValue9toIntegerEPNS_9ExecStateE
+__ZNK3JSC7UString20substringSharingImplEjj
+__ZNK3JSC7UString4utf8Eb
+__ZNK3JSC7UString5asciiEv
+__ZNK3JSC8JSObject11hasPropertyEPNS_9ExecStateERKNS_10IdentifierE
+__ZNK3JSC8JSObject11hasPropertyEPNS_9ExecStateEj
+__ZNK3JSC8JSObject12defaultValueEPNS_9ExecStateENS_22PreferredPrimitiveTypeE
+__ZNK3JSC8JSObject12toThisObjectEPNS_9ExecStateE
+__ZNK3JSC8JSObject18toStrictThisObjectEPNS_9ExecStateE
+__ZNK3JSC8JSObject8toNumberEPNS_9ExecStateE
+__ZNK3JSC8JSObject8toObjectEPNS_9ExecStateE
+__ZNK3JSC8JSObject8toStringEPNS_9ExecStateE
+__ZNK3JSC8JSObject9classNameEv
+__ZNK3JSC8JSObject9toBooleanEPNS_9ExecStateE
+__ZNK3JSC8JSString11resolveRopeEPNS_9ExecStateE
+__ZNK3JSC9HashTable11createTableEPNS_12JSGlobalDataE
+__ZNK3JSC9HashTable11deleteTableEv
+__ZNK3WTF12AtomicString5lowerEv
+__ZNK3WTF13DecimalNumber15toStringDecimalEPtj
+__ZNK3WTF13DecimalNumber28bufferLengthForStringDecimalEv
+__ZNK3WTF6String11toIntStrictEPbi
+__ZNK3WTF6String12toUIntStrictEPbi
+__ZNK3WTF6String13toInt64StrictEPbi
+__ZNK3WTF6String14threadsafeCopyEv
+__ZNK3WTF6String15stripWhiteSpaceEv
+__ZNK3WTF6String16removeCharactersEPFbtE
+__ZNK3WTF6String17crossThreadStringEv
+__ZNK3WTF6String18simplifyWhiteSpaceEv
+__ZNK3WTF6String19characterStartingAtEj
+__ZNK3WTF6String4utf8Eb
+__ZNK3WTF6String5asciiEv
+__ZNK3WTF6String5lowerEv
+__ZNK3WTF6String5splitERKS0_RNS_6VectorIS0_Lm0EEE
+__ZNK3WTF6String5splitERKS0_bRNS_6VectorIS0_Lm0EEE
+__ZNK3WTF6String5splitEtRNS_6VectorIS0_Lm0EEE
+__ZNK3WTF6String5splitEtbRNS_6VectorIS0_Lm0EEE
+__ZNK3WTF6String5toIntEPb
+__ZNK3WTF6String5upperEv
+__ZNK3WTF6String6latin1Ev
+__ZNK3WTF6String6toUIntEPb
+__ZNK3WTF6String7toFloatEPb
+__ZNK3WTF6String8foldCaseEv
+__ZNK3WTF6String8toDoubleEPb
+__ZNK3WTF6String8toIntPtrEPb
+__ZNK3WTF6String8toUInt64EPb
+__ZNK3WTF6String9substringEjj
+__ZNK3WTF8Collator7collateEPKtmS2_m
+__ZTVN3JSC12StringObjectE
+__ZTVN3JSC14JSGlobalObjectE
+__ZTVN3JSC15JSWrapperObjectE
+__ZTVN3JSC16InternalFunctionE
+__ZTVN3JSC16JSVariableObjectE
+__ZTVN3JSC8DebuggerE
+__ZTVN3JSC8JSObjectE
+__ZTVN3JSC8JSStringE
+_jscore_fastmalloc_introspection
+_kJSClassDefinitionEmpty
diff --git a/Source/JavaScriptCore/JavaScriptCore.gyp/JavaScriptCore.gyp b/Source/JavaScriptCore/JavaScriptCore.gyp/JavaScriptCore.gyp
new file mode 100644
index 0000000..d24b083
--- /dev/null
+++ b/Source/JavaScriptCore/JavaScriptCore.gyp/JavaScriptCore.gyp
@@ -0,0 +1,216 @@
+#
+# Copyright (C) 2009 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+{
+ 'includes': [
+ # FIXME: Sense whether upstream or downstream build, and
+ # include the right features.gypi
+ '../../../WebKit/chromium/features.gypi',
+ '../JavaScriptCore.gypi',
+ ],
+ 'variables': {
+ # Location of the chromium src directory.
+ 'conditions': [
+ ['inside_chromium_build==0', {
+ # Webkit is being built outside of the full chromium project.
+ 'chromium_src_dir': '../../../WebKit/chromium',
+ },{
+ # WebKit is checked out in src/chromium/third_party/WebKit
+ 'chromium_src_dir': '../../../../..',
+ }],
+ ],
+ },
+ 'targets': [
+ {
+ # This target sets up defines and includes that are required by WTF and
+ # its dependents.
+ 'target_name': 'wtf_config',
+ 'type': 'none',
+ 'msvs_guid': '2E2D3301-2EC4-4C0F-B889-87073B30F673',
+ 'direct_dependent_settings': {
+ 'defines': [
+ # Import features_defines from features.gypi
+ '<@(feature_defines)',
+
+ # Turns on #if PLATFORM(CHROMIUM)
+ 'BUILDING_CHROMIUM__=1',
+ # Controls wtf/FastMalloc
+ # FIXME: consider moving into config.h
+ 'USE_SYSTEM_MALLOC=1',
+ ],
+ 'conditions': [
+ ['OS=="win"', {
+ 'defines': [
+ '__STD_C',
+ '_CRT_SECURE_NO_DEPRECATE',
+ '_SCL_SECURE_NO_DEPRECATE',
+ 'CRASH=__debugbreak',
+ ],
+ 'include_dirs': [
+ '../os-win32',
+ ],
+ }],
+ ['OS=="mac"', {
+ 'defines': [
+ # Use USE_NEW_THEME on Mac.
+ 'WTF_USE_NEW_THEME=1',
+ ],
+ }],
+ ['OS=="linux" or OS=="freebsd"', {
+ 'defines': [
+ 'WTF_USE_PTHREADS=1',
+ ],
+ }],
+ ],
+ }
+ },
+ {
+ 'target_name': 'wtf',
+ 'type': '<(library)',
+ 'msvs_guid': 'AA8A5A85-592B-4357-BC60-E0E91E026AF6',
+ 'dependencies': [
+ 'wtf_config',
+ '<(chromium_src_dir)/third_party/icu/icu.gyp:icui18n',
+ '<(chromium_src_dir)/third_party/icu/icu.gyp:icuuc',
+ ],
+ 'include_dirs': [
+ '../',
+ '../wtf',
+ '../wtf/unicode',
+ ],
+ 'sources': [
+ '<@(javascriptcore_files)',
+ ],
+ 'sources/': [
+ # First exclude everything ...
+ ['exclude', '../'],
+ # ... Then include what we want.
+ ['include', '../wtf/'],
+ # GLib/GTK, even though its name doesn't really indicate.
+ ['exclude', '/(gtk|glib|gobject)/.*\\.(cpp|h)$'],
+ ['exclude', '(Default|Gtk|Mac|None|Qt|Win|Wx)\\.(cpp|mm)$'],
+ ['exclude', 'wtf/CurrentTime\\.cpp$'],
+ ['exclude', 'wtf/MainThread.cpp$'],
+ ['exclude', 'wtf/TC.*\\.(cpp|h)$'],
+ ],
+ 'direct_dependent_settings': {
+ 'include_dirs': [
+ '../',
+ '../wtf',
+ ],
+ # Some warnings occur in JSC headers, so they must also be disabled
+ # in targets that use JSC.
+ 'msvs_disabled_warnings': [
+ # Don't complain about calling specific versions of templatized
+ # functions (e.g. in RefPtrHashMap.h).
+ 4344,
+ # Don't complain about using "this" in an initializer list
+ # (e.g. in StringImpl.h).
+ 4355,
+ ],
+ },
+ 'export_dependent_settings': [
+ 'wtf_config',
+ '<(chromium_src_dir)/third_party/icu/icu.gyp:icui18n',
+ '<(chromium_src_dir)/third_party/icu/icu.gyp:icuuc',
+ ],
+ 'msvs_disabled_warnings': [4127, 4355, 4510, 4512, 4610, 4706],
+ 'conditions': [
+ ['OS=="win"', {
+ 'sources/': [
+ ['exclude', 'ThreadIdentifierDataPthreads\\.(h|cpp)$'],
+ ['exclude', 'ThreadingPthreads\\.cpp$'],
+ ['include', 'Thread(ing|Specific)Win\\.cpp$'],
+ ['exclude', 'OSAllocatorPosix\\.cpp$'],
+ ['include', 'OSAllocatorWin\\.cpp$']
+ ],
+ 'include_dirs!': [
+ '<(SHARED_INTERMEDIATE_DIR)/webkit',
+ ],
+ 'conditions': [
+ ['inside_chromium_build==1 and component=="shared_library"', {
+ # Chromium windows multi-dll build enables c++ exception and this
+ # causes wtf generates 4291 warning due to operator new/delete
+ # implementations. Disable the warning for chromium windows
+ # multi-dll build.
+ 'msvs_disabled_warnings': [4291],
+ 'direct_dependent_settings': {
+ 'msvs_disabled_warnings': [4291],
+ },
+ }],
+ ],
+ }],
+ ],
+ },
+ {
+ 'target_name': 'pcre',
+ 'type': '<(library)',
+ 'dependencies': [
+ 'wtf',
+ ],
+ 'conditions': [
+ ['OS=="win"', {
+ 'dependencies': ['<(chromium_src_dir)/build/win/system.gyp:cygwin'],
+ }],
+ ],
+ 'msvs_guid': '49909552-0B0C-4C14-8CF6-DB8A2ADE0934',
+ 'actions': [
+ {
+ 'action_name': 'dftables',
+ 'inputs': [
+ '../pcre/dftables',
+ ],
+ 'outputs': [
+ '<(INTERMEDIATE_DIR)/chartables.c',
+ ],
+ 'action': ['perl', '-w', '<@(_inputs)', '<@(_outputs)'],
+ },
+ ],
+ 'include_dirs': [
+ '<(INTERMEDIATE_DIR)',
+ ],
+ 'sources': [
+ '<@(javascriptcore_files)',
+ ],
+ 'sources/': [
+ # First exclude everything ...
+ ['exclude', '../'],
+ # ... Then include what we want.
+ ['include', '../pcre/'],
+ # ucptable.cpp is #included by pcre_ucp_searchfunchs.cpp and is not
+ # intended to be compiled directly.
+ ['exclude', '../pcre/ucptable.cpp$'],
+ ],
+ 'export_dependent_settings': [
+ 'wtf',
+ ],
+ },
+ ], # targets
+}
diff --git a/Source/JavaScriptCore/JavaScriptCore.gypi b/Source/JavaScriptCore/JavaScriptCore.gypi
new file mode 100644
index 0000000..e60969e
--- /dev/null
+++ b/Source/JavaScriptCore/JavaScriptCore.gypi
@@ -0,0 +1,504 @@
+{
+ 'variables': {
+ 'javascriptcore_files': [
+ 'API/APICast.h',
+ 'API/JavaScript.h',
+ 'API/JavaScriptCore.h',
+ 'API/JSBase.cpp',
+ 'API/JSBase.h',
+ 'API/JSBasePrivate.h',
+ 'API/JSCallbackConstructor.cpp',
+ 'API/JSCallbackConstructor.h',
+ 'API/JSCallbackFunction.cpp',
+ 'API/JSCallbackFunction.h',
+ 'API/JSCallbackObject.cpp',
+ 'API/JSCallbackObject.h',
+ 'API/JSCallbackObjectFunctions.h',
+ 'API/JSClassRef.cpp',
+ 'API/JSClassRef.h',
+ 'API/JSContextRef.cpp',
+ 'API/JSContextRef.h',
+ 'API/JSContextRefPrivate.h',
+ 'API/JSObjectRef.cpp',
+ 'API/JSObjectRef.h',
+ 'API/JSProfilerPrivate.cpp',
+ 'API/JSProfilerPrivate.h',
+ 'API/JSRetainPtr.h',
+ 'API/JSStringRef.cpp',
+ 'API/JSStringRef.h',
+ 'API/JSStringRefBSTR.cpp',
+ 'API/JSStringRefBSTR.h',
+ 'API/JSStringRefCF.cpp',
+ 'API/JSStringRefCF.h',
+ 'API/JSValueRef.cpp',
+ 'API/JSValueRef.h',
+ 'API/OpaqueJSString.cpp',
+ 'API/OpaqueJSString.h',
+ 'API/tests/JSNode.h',
+ 'API/tests/JSNodeList.h',
+ 'API/tests/Node.h',
+ 'API/tests/NodeList.h',
+ 'API/WebKitAvailability.h',
+ 'assembler/AbstractMacroAssembler.h',
+ 'assembler/ARMv7Assembler.h',
+ 'assembler/AssemblerBuffer.h',
+ 'assembler/CodeLocation.h',
+ 'assembler/MacroAssembler.h',
+ 'assembler/MacroAssemblerARMv7.h',
+ 'assembler/MacroAssemblerCodeRef.h',
+ 'assembler/MacroAssemblerX86.h',
+ 'assembler/MacroAssemblerX86_64.h',
+ 'assembler/MacroAssemblerX86Common.h',
+ 'assembler/X86Assembler.h',
+ 'bytecode/CodeBlock.cpp',
+ 'bytecode/CodeBlock.h',
+ 'bytecode/EvalCodeCache.h',
+ 'bytecode/Instruction.h',
+ 'bytecode/JumpTable.cpp',
+ 'bytecode/JumpTable.h',
+ 'bytecode/Opcode.cpp',
+ 'bytecode/Opcode.h',
+ 'bytecode/SamplingTool.cpp',
+ 'bytecode/SamplingTool.h',
+ 'bytecode/StructureStubInfo.cpp',
+ 'bytecode/StructureStubInfo.h',
+ 'bytecompiler/BytecodeGenerator.cpp',
+ 'bytecompiler/BytecodeGenerator.h',
+ 'bytecompiler/NodesCodegen.cpp',
+ 'bytecompiler/Label.h',
+ 'bytecompiler/LabelScope.h',
+ 'bytecompiler/RegisterID.h',
+ 'config.h',
+ 'debugger/Debugger.cpp',
+ 'debugger/Debugger.h',
+ 'debugger/DebuggerActivation.cpp',
+ 'debugger/DebuggerActivation.h',
+ 'debugger/DebuggerCallFrame.cpp',
+ 'debugger/DebuggerCallFrame.h',
+ 'icu/unicode/parseerr.h',
+ 'icu/unicode/platform.h',
+ 'icu/unicode/putil.h',
+ 'icu/unicode/uchar.h',
+ 'icu/unicode/ucnv.h',
+ 'icu/unicode/ucnv_err.h',
+ 'icu/unicode/ucol.h',
+ 'icu/unicode/uconfig.h',
+ 'icu/unicode/uenum.h',
+ 'icu/unicode/uiter.h',
+ 'icu/unicode/uloc.h',
+ 'icu/unicode/umachine.h',
+ 'icu/unicode/unorm.h',
+ 'icu/unicode/urename.h',
+ 'icu/unicode/uset.h',
+ 'icu/unicode/ustring.h',
+ 'icu/unicode/utf.h',
+ 'icu/unicode/utf16.h',
+ 'icu/unicode/utf8.h',
+ 'icu/unicode/utf_old.h',
+ 'icu/unicode/utypes.h',
+ 'icu/unicode/uversion.h',
+ 'interpreter/CachedCall.h',
+ 'interpreter/CallFrame.cpp',
+ 'interpreter/CallFrame.h',
+ 'interpreter/CallFrameClosure.h',
+ 'interpreter/Interpreter.cpp',
+ 'interpreter/Interpreter.h',
+ 'interpreter/Register.h',
+ 'interpreter/RegisterFile.cpp',
+ 'interpreter/RegisterFile.h',
+ 'JavaScriptCorePrefix.h',
+ 'jit/ExecutableAllocator.cpp',
+ 'jit/ExecutableAllocator.h',
+ 'jit/ExecutableAllocatorFixedVMPool.cpp',
+ 'jit/JIT.cpp',
+ 'jit/JIT.h',
+ 'jit/JITArithmetic.cpp',
+ 'jit/JITArithmetic32_64.cpp',
+ 'jit/JITCall.cpp',
+ 'jit/JITCall32_64.cpp',
+ 'jit/JITCode.h',
+ 'jit/JITInlineMethods.h',
+ 'jit/JITOpcodes.cpp',
+ 'jit/JITOpcodes32_64.cpp',
+ 'jit/JITPropertyAccess.cpp',
+ 'jit/JITPropertyAccess32_64.cpp',
+ 'jit/JITStubCall.h',
+ 'jit/JITStubs.cpp',
+ 'jit/JITStubs.h',
+ 'jsc.cpp',
+ 'os-win32/stdbool.h',
+ 'os-win32/stdint.h',
+ 'parser/ASTBuilder.h',
+ 'parser/JSParser.cpp',
+ 'parser/JSParser.h',
+ 'parser/Lexer.cpp',
+ 'parser/Lexer.h',
+ 'parser/NodeConstructors.h',
+ 'parser/NodeInfo.h',
+ 'parser/Nodes.cpp',
+ 'parser/Nodes.h',
+ 'parser/Parser.cpp',
+ 'parser/Parser.h',
+ 'parser/ParserArena.cpp',
+ 'parser/ParserArena.h',
+ 'parser/ResultType.h',
+ 'parser/SourceCode.h',
+ 'parser/SourceProvider.h',
+ 'parser/SyntaxChecker.h',
+ 'pcre/pcre.h',
+ 'pcre/pcre_compile.cpp',
+ 'pcre/pcre_exec.cpp',
+ 'pcre/pcre_internal.h',
+ 'pcre/pcre_tables.cpp',
+ 'pcre/pcre_ucp_searchfuncs.cpp',
+ 'pcre/pcre_xclass.cpp',
+ 'pcre/ucpinternal.h',
+ 'pcre/ucptable.cpp',
+ 'profiler/CallIdentifier.h',
+ 'profiler/Profile.cpp',
+ 'profiler/Profile.h',
+ 'profiler/ProfileGenerator.cpp',
+ 'profiler/ProfileGenerator.h',
+ 'profiler/ProfileNode.cpp',
+ 'profiler/ProfileNode.h',
+ 'profiler/Profiler.cpp',
+ 'profiler/Profiler.h',
+ 'profiler/ProfilerServer.h',
+ 'runtime/ArgList.cpp',
+ 'runtime/ArgList.h',
+ 'runtime/Arguments.cpp',
+ 'runtime/Arguments.h',
+ 'runtime/ArrayConstructor.cpp',
+ 'runtime/ArrayConstructor.h',
+ 'runtime/ArrayPrototype.cpp',
+ 'runtime/ArrayPrototype.h',
+ 'runtime/BatchedTransitionOptimizer.h',
+ 'runtime/BooleanConstructor.cpp',
+ 'runtime/BooleanConstructor.h',
+ 'runtime/BooleanObject.cpp',
+ 'runtime/BooleanObject.h',
+ 'runtime/BooleanPrototype.cpp',
+ 'runtime/BooleanPrototype.h',
+ 'runtime/CallData.cpp',
+ 'runtime/CallData.h',
+ 'runtime/ClassInfo.h',
+ 'runtime/Collector.cpp',
+ 'runtime/Collector.h',
+ 'runtime/CollectorHeapIterator.h',
+ 'runtime/CommonIdentifiers.cpp',
+ 'runtime/CommonIdentifiers.h',
+ 'runtime/Completion.cpp',
+ 'runtime/Completion.h',
+ 'runtime/ConstructData.cpp',
+ 'runtime/ConstructData.h',
+ 'runtime/DateConstructor.cpp',
+ 'runtime/DateConstructor.h',
+ 'runtime/DateConversion.cpp',
+ 'runtime/DateConversion.h',
+ 'runtime/DateInstance.cpp',
+ 'runtime/DateInstance.h',
+ 'runtime/DateInstanceCache.h',
+ 'runtime/DatePrototype.cpp',
+ 'runtime/DatePrototype.h',
+ 'runtime/Error.cpp',
+ 'runtime/Error.h',
+ 'runtime/ErrorConstructor.cpp',
+ 'runtime/ErrorConstructor.h',
+ 'runtime/ErrorInstance.cpp',
+ 'runtime/ErrorInstance.h',
+ 'runtime/ErrorPrototype.cpp',
+ 'runtime/ErrorPrototype.h',
+ 'runtime/ExceptionHelpers.cpp',
+ 'runtime/ExceptionHelpers.h',
+ 'runtime/FunctionConstructor.cpp',
+ 'runtime/FunctionConstructor.h',
+ 'runtime/FunctionPrototype.cpp',
+ 'runtime/FunctionPrototype.h',
+ 'runtime/GCActivityCallback.cpp',
+ 'runtime/GCActivityCallback.h',
+ 'runtime/GCHandle.cpp',
+ 'runtime/GCHandle.h',
+ 'runtime/GetterSetter.cpp',
+ 'runtime/GetterSetter.h',
+ 'runtime/GlobalEvalFunction.cpp',
+ 'runtime/GlobalEvalFunction.h',
+ 'runtime/Identifier.cpp',
+ 'runtime/Identifier.h',
+ 'runtime/InitializeThreading.cpp',
+ 'runtime/InitializeThreading.h',
+ 'runtime/InternalFunction.cpp',
+ 'runtime/InternalFunction.h',
+ 'runtime/JSActivation.cpp',
+ 'runtime/JSActivation.h',
+ 'runtime/JSArray.cpp',
+ 'runtime/JSArray.h',
+ 'runtime/JSByteArray.cpp',
+ 'runtime/JSByteArray.h',
+ 'runtime/JSCell.cpp',
+ 'runtime/JSCell.h',
+ 'runtime/JSFunction.cpp',
+ 'runtime/JSFunction.h',
+ 'runtime/JSGlobalData.cpp',
+ 'runtime/JSGlobalData.h',
+ 'runtime/JSGlobalObject.cpp',
+ 'runtime/JSGlobalObject.h',
+ 'runtime/JSGlobalObjectFunctions.cpp',
+ 'runtime/JSGlobalObjectFunctions.h',
+ 'runtime/JSImmediate.cpp',
+ 'runtime/JSImmediate.h',
+ 'runtime/JSLock.cpp',
+ 'runtime/JSLock.h',
+ 'runtime/JSNotAnObject.cpp',
+ 'runtime/JSNotAnObject.h',
+ 'runtime/JSNumberCell.cpp',
+ 'runtime/JSNumberCell.h',
+ 'runtime/JSObject.cpp',
+ 'runtime/JSObject.h',
+ 'runtime/JSObjectWithGlobalObject.cpp',
+ 'runtime/JSObjectWithGlobalObject.h',
+ 'runtime/JSONObject.cpp',
+ 'runtime/JSONObject.h',
+ 'runtime/JSPropertyNameIterator.cpp',
+ 'runtime/JSPropertyNameIterator.h',
+ 'runtime/JSStaticScopeObject.cpp',
+ 'runtime/JSStaticScopeObject.h',
+ 'runtime/JSString.cpp',
+ 'runtime/JSString.h',
+ 'runtime/JSType.h',
+ 'runtime/JSTypeInfo.h',
+ 'runtime/JSValue.cpp',
+ 'runtime/JSValue.h',
+ 'runtime/JSVariableObject.cpp',
+ 'runtime/JSVariableObject.h',
+ 'runtime/JSWrapperObject.cpp',
+ 'runtime/JSWrapperObject.h',
+ 'runtime/LiteralParser.cpp',
+ 'runtime/LiteralParser.h',
+ 'runtime/Lookup.cpp',
+ 'runtime/Lookup.h',
+ 'runtime/MarkStack.cpp',
+ 'runtime/MarkStack.h',
+ 'runtime/MarkStackWin.cpp',
+ 'runtime/MathObject.cpp',
+ 'runtime/MathObject.h',
+ 'runtime/NativeErrorConstructor.cpp',
+ 'runtime/NativeErrorConstructor.h',
+ 'runtime/NativeErrorPrototype.cpp',
+ 'runtime/NativeErrorPrototype.h',
+ 'runtime/NativeFunctionWrapper.h',
+ 'runtime/NumberConstructor.cpp',
+ 'runtime/NumberConstructor.h',
+ 'runtime/NumberObject.cpp',
+ 'runtime/NumberObject.h',
+ 'runtime/NumberPrototype.cpp',
+ 'runtime/NumberPrototype.h',
+ 'runtime/ObjectConstructor.cpp',
+ 'runtime/ObjectConstructor.h',
+ 'runtime/ObjectPrototype.cpp',
+ 'runtime/ObjectPrototype.h',
+ 'runtime/Operations.cpp',
+ 'runtime/Operations.h',
+ 'runtime/PropertyDescriptor.cpp',
+ 'runtime/PropertyDescriptor.h',
+ 'runtime/PropertyMapHashTable.h',
+ 'runtime/PropertyNameArray.cpp',
+ 'runtime/PropertyNameArray.h',
+ 'runtime/PropertySlot.cpp',
+ 'runtime/PropertySlot.h',
+ 'runtime/Protect.h',
+ 'runtime/PrototypeFunction.cpp',
+ 'runtime/PrototypeFunction.h',
+ 'runtime/PutPropertySlot.h',
+ 'runtime/RegExp.cpp',
+ 'runtime/RegExp.h',
+ 'runtime/RegExpCache.cpp',
+ 'runtime/RegExpCache.h',
+ 'runtime/RegExpConstructor.cpp',
+ 'runtime/RegExpConstructor.h',
+ 'runtime/RegExpKey.h',
+ 'runtime/RegExpMatchesArray.h',
+ 'runtime/RegExpObject.cpp',
+ 'runtime/RegExpObject.h',
+ 'runtime/RegExpPrototype.cpp',
+ 'runtime/RegExpPrototype.h',
+ 'runtime/ScopeChain.cpp',
+ 'runtime/ScopeChain.h',
+ 'runtime/ScopeChainMark.h',
+ 'runtime/SmallStrings.cpp',
+ 'runtime/SmallStrings.h',
+ 'runtime/StringConstructor.cpp',
+ 'runtime/StringConstructor.h',
+ 'runtime/StringObject.cpp',
+ 'runtime/StringObject.h',
+ 'runtime/StringObjectThatMasqueradesAsUndefined.h',
+ 'runtime/StringPrototype.cpp',
+ 'runtime/StringPrototype.h',
+ 'runtime/Structure.cpp',
+ 'runtime/Structure.h',
+ 'runtime/StructureChain.cpp',
+ 'runtime/StructureChain.h',
+ 'runtime/StructureTransitionTable.h',
+ 'runtime/SymbolTable.h',
+ 'runtime/Terminator.h',
+ 'runtime/TimeoutChecker.cpp',
+ 'runtime/TimeoutChecker.h',
+ 'runtime/Tracing.h',
+ 'runtime/UString.cpp',
+ 'runtime/UString.h',
+ 'runtime/UStringBuilder.h',
+ 'runtime/UStringConcatenate.h',
+ 'runtime/WeakRandom.h',
+ 'wtf/AlwaysInline.h',
+ 'wtf/ASCIICType.h',
+ 'wtf/Assertions.cpp',
+ 'wtf/Assertions.h',
+ 'wtf/Atomics.h',
+ 'wtf/AVLTree.h',
+ 'wtf/Bitmap.h',
+ 'wtf/ByteArray.cpp',
+ 'wtf/ByteArray.h',
+ 'wtf/chromium/ChromiumThreading.h',
+ 'wtf/chromium/MainThreadChromium.cpp',
+ 'wtf/CrossThreadRefCounted.h',
+ 'wtf/CurrentTime.cpp',
+ 'wtf/CurrentTime.h',
+ 'wtf/DateMath.cpp',
+ 'wtf/DateMath.h',
+ 'wtf/DecimalNumber.cpp',
+ 'wtf/Deque.h',
+ 'wtf/DisallowCType.h',
+ 'wtf/dtoa.cpp',
+ 'wtf/dtoa.h',
+ 'wtf/FastAllocBase.h',
+ 'wtf/FastMalloc.cpp',
+ 'wtf/FastMalloc.h',
+ 'wtf/Forward.h',
+ 'wtf/GetPtr.h',
+ 'wtf/gobject/GOwnPtr.cpp',
+ 'wtf/gobject/GOwnPtr.h',
+ 'wtf/gtk/MainThreadGtk.cpp',
+ 'wtf/gtk/ThreadingGtk.cpp',
+ 'wtf/HashCountedSet.h',
+ 'wtf/HashFunctions.h',
+ 'wtf/HashIterators.h',
+ 'wtf/HashMap.h',
+ 'wtf/HashSet.h',
+ 'wtf/HashTable.cpp',
+ 'wtf/HashTable.h',
+ 'wtf/HashTraits.h',
+ 'wtf/ListHashSet.h',
+ 'wtf/ListRefPtr.h',
+ 'wtf/Locker.h',
+ 'wtf/MD5.cpp',
+ 'wtf/MD5.h',
+ 'wtf/MainThread.cpp',
+ 'wtf/MainThread.h',
+ 'wtf/MallocZoneSupport.h',
+ 'wtf/MathExtras.h',
+ 'wtf/MessageQueue.h',
+ 'wtf/NonCopyingSort.h',
+ 'wtf/Noncopyable.h',
+ 'wtf/NotFound.h',
+ 'wtf/OSAllocatorPosix.cpp',
+ 'wtf/OSAllocatorWin.cpp',
+ 'wtf/OSAllocator.h',
+ 'wtf/OwnArrayPtr.h',
+ 'wtf/OwnFastMallocPtr.h',
+ 'wtf/OwnPtr.h',
+ 'wtf/OwnPtrCommon.h',
+ 'wtf/PageBlock.cpp',
+ 'wtf/PageAllocation.h',
+ 'wtf/PageAllocationAligned.cpp',
+ 'wtf/PageAllocationAligned.h',
+ 'wtf/PageReservation',
+ 'wtf/PassOwnPtr.h',
+ 'wtf/PassRefPtr.h',
+ 'wtf/Platform.h',
+ 'wtf/PtrAndFlags.h',
+ 'wtf/RandomNumber.cpp',
+ 'wtf/RandomNumber.h',
+ 'wtf/RandomNumberSeed.h',
+ 'wtf/RefCounted.h',
+ 'wtf/RefCountedLeakCounter.cpp',
+ 'wtf/RefCountedLeakCounter.h',
+ 'wtf/RefPtr.h',
+ 'wtf/RefPtrHashMap.h',
+ 'wtf/RetainPtr.h',
+ 'wtf/SegmentedVector.h',
+ 'wtf/SizeLimits.cpp',
+ 'wtf/StackBounds.cpp',
+ 'wtf/StackBounds.h',
+ 'wtf/StaticConstructors.h',
+ 'wtf/StdLibExtras.h',
+ 'wtf/StringExtras.h',
+ 'wtf/StringHasher.h',
+ 'wtf/TCPackedCache.h',
+ 'wtf/qt/MainThreadQt.cpp',
+ 'wtf/qt/StringQt.cpp',
+ 'wtf/qt/ThreadingQt.cpp',
+ 'wtf/TCPageMap.h',
+ 'wtf/TCSpinLock.h',
+ 'wtf/TCSystemAlloc.cpp',
+ 'wtf/TCSystemAlloc.h',
+ 'wtf/ThreadFunctionInvocation.h',
+ 'wtf/ThreadIdentifierDataPthreads.cpp',
+ 'wtf/ThreadIdentifierDataPthreads.h',
+ 'wtf/Threading.cpp',
+ 'wtf/Threading.h',
+ 'wtf/ThreadingNone.cpp',
+ 'wtf/ThreadingPrimitives.h',
+ 'wtf/ThreadingPthreads.cpp',
+ 'wtf/ThreadingWin.cpp',
+ 'wtf/ThreadSafeShared.h',
+ 'wtf/ThreadSpecific.h',
+ 'wtf/ThreadSpecificWin.cpp',
+ 'wtf/TypeTraits.cpp',
+ 'wtf/TypeTraits.h',
+ 'wtf/text/AtomicString.cpp',
+ 'wtf/text/AtomicString.h',
+ 'wtf/text/AtomicStringHash.h',
+ 'wtf/text/AtomicStringImpl.h',
+ 'wtf/text/CString.cpp',
+ 'wtf/text/CString.h',
+ 'wtf/text/StringBuffer.h',
+ 'wtf/text/StringBuilder.cpp',
+ 'wtf/text/StringBuilder.h',
+ 'wtf/text/StringConcatenate.h',
+ 'wtf/text/StringHash.h',
+ 'wtf/text/StringImpl.cpp',
+ 'wtf/text/StringImpl.h',
+ 'wtf/text/StringStatics.cpp',
+ 'wtf/text/TextPosition.h',
+ 'wtf/text/WTFString.cpp',
+ 'wtf/text/WTFString.h',
+ 'wtf/unicode/Collator.h',
+ 'wtf/unicode/CollatorDefault.cpp',
+ 'wtf/unicode/glib/UnicodeGLib.cpp',
+ 'wtf/unicode/glib/UnicodeGLib.h',
+ 'wtf/unicode/glib/UnicodeMacrosFromICU.h',
+ 'wtf/unicode/icu/CollatorICU.cpp',
+ 'wtf/unicode/icu/UnicodeIcu.h',
+ 'wtf/unicode/qt4/UnicodeQt4.h',
+ 'wtf/unicode/Unicode.h',
+ 'wtf/unicode/UTF8.cpp',
+ 'wtf/unicode/UTF8.h',
+ 'wtf/UnusedParam.h',
+ 'wtf/ValueCheck.h',
+ 'wtf/Vector.h',
+ 'wtf/VectorTraits.h',
+ 'wtf/VMTags.h',
+ 'wtf/WTFThreadData.cpp',
+ 'wtf/WTFThreadData.h',
+ 'wtf/win/MainThreadWin.cpp',
+ 'wtf/win/OwnPtrWin.cpp',
+ 'wtf/wx/MainThreadWx.cpp',
+ 'yarr/RegexInterpreter.cpp',
+ 'yarr/RegexInterpreter.h',
+ 'yarr/RegexJIT.cpp',
+ 'yarr/RegexJIT.h',
+ 'yarr/RegexParser.h',
+ 'yarr/RegexPattern.cpp',
+ 'yarr/RegexPattern.h',
+ ]
+ }
+}
diff --git a/Source/JavaScriptCore/JavaScriptCore.order b/Source/JavaScriptCore/JavaScriptCore.order
new file mode 100644
index 0000000..3cb3d1d
--- /dev/null
+++ b/Source/JavaScriptCore/JavaScriptCore.order
@@ -0,0 +1,2135 @@
+__ZN3WTF10fastMallocEm
+__ZN3WTF20TCMalloc_ThreadCache10InitModuleEv
+__ZN3WTFL15InitSizeClassesEv
+__Z20TCMalloc_SystemAllocmPmm
+__ZN3WTFL13MetaDataAllocEm
+__ZN3WTF17TCMalloc_PageHeap19initializeScavengerEv
+__ZN3WTF20TCMalloc_ThreadCache22CreateCacheIfNecessaryEv
+__ZN3WTF25TCMalloc_Central_FreeList11RemoveRangeEPPvS2_Pi
+__ZN3WTF25TCMalloc_Central_FreeList18FetchFromSpansSafeEv
+__ZN3WTF17TCMalloc_PageHeap10AllocLargeEm
+__ZN3WTF17TCMalloc_PageHeap8GrowHeapEm
+__ZN3WTF17TCMalloc_PageHeap6DeleteEPNS_4SpanE
+__ZN3WTF8fastFreeEPv
+__ZN3WTF19initializeThreadingEv
+__ZN3WTF36lockAtomicallyInitializedStaticMutexEv
+__ZN3WTF38unlockAtomicallyInitializedStaticMutexEv
+__ZN3JSC19initializeThreadingEv
+__ZN3JSCL23initializeThreadingOnceEv
+__ZN3WTF13WTFThreadDataC1Ev
+__ZN3JSC17initializeUStringEv
+__ZN7WebCore10StringImpl5emptyEv
+__ZN3JSC12JSGlobalData10storeVPtrsEv
+__ZN3JSC9StructureC1ENS_7JSValueERKNS_8TypeInfoEj
+__ZN3JSC7JSArrayC1EN3WTF17NonNullPassRefPtrINS_9StructureEEE
+__ZN3WTF16fastZeroedMallocEm
+__ZN3JSC7JSArrayD1Ev
+__ZN3JSC7JSArrayD2Ev
+__ZN3JSC9StructureD1Ev
+__ZN3JSC9StructureD2Ev
+__ZN3JSC11JSByteArray15createStructureENS_7JSValueE
+__ZN3JSC11JSByteArrayD1Ev
+__ZN3JSC8JSStringD1Ev
+__ZN3JSC10JSFunctionC1EN3WTF17NonNullPassRefPtrINS_9StructureEEE
+__ZN3JSC10JSFunctionC2EN3WTF17NonNullPassRefPtrINS_9StructureEEE
+__ZN3JSC10JSFunctionD1Ev
+__ZN3JSC10JSFunctionD2Ev
+__ZN3JSC18VPtrHackExecutableD0Ev
+__ZN3WTF5MutexC1Ev
+__ZN3WTF15initializeDatesEv
+__ZN3WTF11currentTimeEv
+__ZN3WTF8msToYearEd
+__ZN3WTF39initializeMainThreadToProcessMainThreadEv
+__ZN3WTFL43initializeMainThreadToProcessMainThreadOnceEv
+__ZN3WTF47initializeMainThreadToProcessMainThreadPlatformEv
+__ZN3WTF20initializeMainThreadEv
+__ZN3WTF15ThreadConditionC1Ev
+__ZN7WebCore10StringImpl6createEPKtj
+__ZN7WebCore10StringImpl19createUninitializedEjRPt
+__ZN3WTF5Mutex4lockEv
+__ZN3WTF5Mutex6unlockEv
+__ZNK7WebCore6String17crossThreadStringEv
+__ZN7WebCore10StringImpl17crossThreadStringEv
+__ZN7WebCore10StringImpl12sharedBufferEv
+__ZN7WebCore6StringC1EPKc
+__ZN7WebCore10StringImpl6createEPKc
+__ZN7WebCore10StringImpl6createEPKcj
+__ZNK7WebCore6String14threadsafeCopyEv
+__ZNK7WebCore10StringImpl14threadsafeCopyEv
+__ZN7WebCore10StringImpl8endsWithEPS0_b
+__ZN7WebCore10StringImpl4findEPS0_ib
+__ZN7WebCore10StringImplD1Ev
+__ZN7WebCore10StringImplD2Ev
+__ZN7WebCoreplERKNS_6StringEPKc
+__ZN7WebCore6String6appendERKS0_
+__ZN7WebCoreplERKNS_6StringES2_
+__ZN3WTF12createThreadEPFPvS0_ES0_PKc
+__ZN3WTF20createThreadInternalEPFPvS0_ES0_PKc
+__ZN3WTFL35establishIdentifierForPthreadHandleERKP17_opaque_pthread_t
+__ZN3WTF9HashTableIjSt4pairIjP17_opaque_pthread_tENS_18PairFirstExtractorIS4_EENS_7IntHashIjEENS_14PairHashTraitsINS_10HashTrai
+__ZN3WTFL16threadEntryPointEPv
+__ZN3WTF31initializeCurrentThreadInternalEPKc
+__ZN3WTF20ThreadIdentifierData10initializeEj
+__ZN3WTF20ThreadIdentifierData23initializeKeyOnceHelperEv
+__ZN3WTF5MutexD1Ev
+__ZN3WTF12isMainThreadEv
+__ZN3WTF7CString16newUninitializedEmRPc
+__ZNK3WTF7CString4dataEv
+__ZN3WTF14FastMallocZone4sizeEP14_malloc_zone_tPKv
+__ZN7WebCore6String29charactersWithNullTerminationEv
+__ZN7WebCore10StringImpl34createWithTerminatingNullCharacterERKS0_
+__ZN3WTF13currentThreadEv
+__ZN3WTF20ThreadIdentifierData10identifierEv
+__ZNK7WebCore6String15stripWhiteSpaceEv
+__ZN7WebCore10StringImpl15stripWhiteSpaceEv
+__ZN7WebCore5equalEPKNS_10StringImplES2_
+__ZN7WebCoreplEPKcRKNS_6StringE
+__ZN7WebCore6StringC1EPKt
+__ZN7WebCore6StringC2EPKt
+__ZNK7WebCore6String7isEmptyEv
+__ZN3WTF16callOnMainThreadEPFvPvES0_
+__ZN3WTF5DequeINS_19FunctionWithContextEE14expandCapacityEv
+__ZN3WTF37scheduleDispatchFunctionsOnMainThreadEv
+__ZN3WTF15ThreadCondition4waitERNS_5MutexE
+__ZN3WTF17TCMalloc_PageHeap3NewEm
+__ZN7WebCore12AtomicString4initEv
+__ZN3WTF7HashSetIPN7WebCore10StringImplENS1_10StringHashENS_10HashTraitsIS3_EEE3addIPKcNS1_17CStringTranslatorEEESt4pairINS_24H
+__ZN3WTF9HashTableIPN7WebCore10StringImplES3_NS_17IdentityExtractorIS3_EENS1_10StringHashENS_10HashTraitsIS3_EES8_E6rehashEi
+__ZN7WebCore12AtomicString3addEPKc
+__ZN7WebCore12AtomicString3addEPNS_10StringImplE
+__ZN7WebCore6StringC1EPKcj
+__ZN7WebCore5equalEPKNS_10StringImplEPKc
+__ZNK7WebCore6String6lengthEv
+__ZNK7WebCore6StringixEj
+__ZNK7WebCore6String9substringEjj
+__ZN7WebCore10StringImpl9substringEjj
+__ZNK7WebCore6String5lowerEv
+__ZN7WebCore10StringImpl5lowerEv
+__ZN7WebCore10StringImpl4findEti
+__ZNK7WebCore6String10charactersEv
+__ZN7WebCore17equalIgnoringCaseEPNS_10StringImplES1_
+__ZN7WebCore17equalIgnoringCaseEPNS_10StringImplEPKc
+__ZN7WebCore12AtomicString3addEPKtj
+__ZN3WTF7HashSetIPN7WebCore10StringImplENS1_10StringHashENS_10HashTraitsIS3_EEE3addINS1_11UCharBufferENS1_21UCharBufferTranslat
+__ZN7WebCore18charactersToDoubleEPKtmPb
+__ZN3WTF6strtodEPKcPPc
+__ZN3WTF15ThreadCondition9broadcastEv
+__ZN3WTF15ThreadCondition6signalEv
+__ZN7WebCore12AtomicString6removeEPNS_10StringImplE
+__ZN3JSC12JSGlobalData12createLeakedENS_15ThreadStackTypeE
+__ZN3JSC9Structure18startIgnoringLeaksEv
+__ZN3JSC12JSGlobalDataC2ENS0_14GlobalDataTypeENS_15ThreadStackTypeE
+__ZN3JSC17CommonIdentifiersC1EPNS_12JSGlobalDataE
+__ZN3JSC17CommonIdentifiersC2EPNS_12JSGlobalDataE
+__ZN3JSC10Identifier3addEPNS_12JSGlobalDataEPKc
+__ZN3WTF7HashSetIPN7WebCore10StringImplENS1_10StringHashENS_10HashTraitsIS3_EEE3addIPKcN3JSC27IdentifierCStringTranslatorEEESt4
+__ZN3WTF9HashTableIPN7WebCore10StringImplES3_NS_17IdentityExtractorIS3_EENS1_10StringHashENS_10HashTraitsIS3_EES8_E6expandEv
+__ZN3WTF9HashTableIPKcSt4pairIS2_NS_6RefPtrIN7WebCore10StringImplEEEENS_18PairFirstExtractorIS8_EENS_7PtrHashIS2_EENS_14PairHas
+__ZN3JSC10IdentifierC1EPNS_12JSGlobalDataEPKc
+__ZN3JSC12SmallStringsC1Ev
+__ZN3JSC19ExecutableAllocator17intializePageSizeEv
+__ZN3JSC14ExecutablePool11systemAllocEm
+__ZN3JSC5LexerC1EPNS_12JSGlobalDataE
+__ZN3JSC11ParserArenaC1Ev
+__ZN3JSC11ParserArenaC2Ev
+__ZN3JSC11InterpreterC1Ev
+__ZN3JSC11InterpreterC2Ev
+__ZN3JSC9JITThunksC1EPNS_12JSGlobalDataE
+__ZN3JSC3JITC1EPNS_12JSGlobalDataEPNS_9CodeBlockE
+__ZN3JSC3JITC2EPNS_12JSGlobalDataEPNS_9CodeBlockE
+__ZN3JSC3JIT35privateCompileCTIMachineTrampolinesEPN3WTF6RefPtrINS_14ExecutablePoolEEEPNS_12JSGlobalDataEPNS_19TrampolineStruct
+__ZN3JSC20MacroAssemblerX86_6413branchTestPtrENS_23MacroAssemblerX86Common9ConditionENS_12X86Registers10RegisterIDES4_
+__ZN3JSC12X86Assembler23X86InstructionFormatter11oneByteOp64ENS0_15OneByteOpcodeIDEiNS_12X86Registers10RegisterIDE
+__ZN3JSC12X86Assembler3jCCENS0_9ConditionE
+__ZN3JSC12X86Assembler23X86InstructionFormatter11oneByteOp64ENS0_15OneByteOpcodeIDEiNS_12X86Registers10RegisterIDEi
+__ZN3JSC12X86Assembler23X86InstructionFormatter9oneByteOpENS0_15OneByteOpcodeIDEiNS_12X86Registers10RegisterIDEi
+__ZN3JSC12X86Assembler23X86InstructionFormatter11memoryModRMEiNS_12X86Registers10RegisterIDEi
+__ZN3JSC12X86Assembler23X86InstructionFormatter9oneByteOpENS0_15OneByteOpcodeIDEiNS_12X86Registers10RegisterIDE
+__ZN3JSC15AssemblerBuffer11ensureSpaceEi
+__ZN3JSC20MacroAssemblerX86_644callEv
+__ZN3JSC20MacroAssemblerX86_647loadPtrENS_22AbstractMacroAssemblerINS_12X86AssemblerEE15ImplicitAddressENS_12X86Registers10Regi
+__ZN3JSC12X86Assembler23X86InstructionFormatter9oneByteOpENS0_15OneByteOpcodeIDENS_12X86Registers10RegisterIDE
+__ZN3JSC3JIT32compileOpCallInitializeCallFrameEv
+__ZN3JSC15AssemblerBuffer4growEi
+__ZN3WTF11fastReallocEPvm
+__ZN3WTF11fastReallocILb1EEEPvS1_m
+__ZN3WTF10RefCountedIN3JSC14ExecutablePoolEE5derefEv
+__ZN3JSC14TimeoutCheckerC1Ev
+__ZN3JSC4HeapC1EPNS_12JSGlobalDataE
+__ZN3JSC4Heap13allocateBlockEv
+__ZN3JSC9MarkStack18initializePagesizeEv
+__ZN3JSC9MarkStack13allocateStackEm
+__ZN3JSC27startProfilerServerIfNeededEv
++[ProfilerServer sharedProfileServer]
+-[ProfilerServer init]
+__ZN3JSC9Structure17stopIgnoringLeaksEv
+__ZNK7WebCore6String6latin1Ev
+__ZNK3WTF7CString6lengthEv
+__ZN7WebCore10StringImpl22containsOnlyWhitespaceEv
+__ZN7WebCore12AtomicString3addEPKt
+__ZN7WebCore10StringImpl11reverseFindEPS0_ib
+__ZN7WebCore10StringImpl5adoptERNS_12StringBufferE
+__ZNK7WebCore6String5splitEtRN3WTF6VectorIS0_Lm0EEE
+__ZNK7WebCore6String5splitERKS0_bRN3WTF6VectorIS0_Lm0EEE
+-[WTFMainThreadCaller call]
+__ZN3WTF31dispatchFunctionsFromMainThreadEv
+__ZN3WTF15ThreadCondition9timedWaitERNS_5MutexEd
+__ZN3WTF14FastMallocZone9forceLockEP14_malloc_zone_t
+__ZN3WTF14FastMallocZone11forceUnlockEP14_malloc_zone_t
+__ZN3WTF20TCMalloc_ThreadCache18DestroyThreadCacheEPv
+__ZN3WTF20TCMalloc_ThreadCache11DeleteCacheEPS0_
+__ZN3WTF25TCMalloc_Central_FreeList11InsertRangeEPvS1_i
+__ZN3WTF25TCMalloc_Central_FreeList18ReleaseListToSpansEPv
+__ZN3WTF20ThreadIdentifierData8destructEPv
+__ZN3WTF31clearPthreadHandleForIdentifierEj
+__ZN3WTF12detachThreadEj
+__ZN3WTFL26pthreadHandleForIdentifierEj
+__ZN7WebCore6StringC1EPKtj
+__Z15jsRegExpCompilePKti24JSRegExpIgnoreCaseOption23JSRegExpMultilineOptionPjPPKc
+__ZL30calculateCompiledPatternLengthPKti24JSRegExpIgnoreCaseOptionR11CompileDataR9ErrorCode
+__ZL11checkEscapePPKtS0_P9ErrorCodeib
+__ZL13compileBranchiPiPPhPPKtS3_P9ErrorCodeS_S_R11CompileData
+__Z15jsRegExpExecutePK8JSRegExpPKtiiPii
+__ZL5matchPKtPKhiR9MatchData
+__ZN7WebCore6String6formatEPKcz
+__ZNK7WebCore6String19characterStartingAtEj
+__ZN7WebCore10StringImpl19characterStartingAtEj
+__ZN3WTF25TCMalloc_Central_FreeList11ShrinkCacheEib
+__ZNK7WebCore6String16removeCharactersEPFbtE
+__ZN7WebCore10StringImpl16removeCharactersEPFbtE
+__ZN7WebCore10StringImpl7replaceEtt
+__ZNK7WebCore6String4utf8Ev
+__ZN3WTF7Unicode18convertUTF16ToUTF8EPPKtS2_PPcS4_b
+__ZN3WTF7CStringC1EPKcj
+__ZN3WTF7CString4initEPKcj
+__ZN7WebCore10StringImpl4findEPFbtEi
+__ZN3JSC4Heap8allocateEm
+__ZN3JSC6JSCellD1Ev
+__ZN3JSC4Heap7protectENS_7JSValueE
+__ZN3WTF9HashTableIPN3JSC6JSCellESt4pairIS3_jENS_18PairFirstExtractorIS5_EENS_7PtrHashIS3_EENS_14PairHashTraitsINS_10HashTraits
+__ZN3JSC14JSGlobalObjectnwEmPNS_12JSGlobalDataE
+__ZN3JSC14JSGlobalObject4initEPNS_8JSObjectE
+__ZN3JSC14JSGlobalObject5resetENS_7JSValueE
+__ZN3JSC17FunctionPrototypeC1EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_9StructureEEE
+__ZN3JSC17FunctionPrototypeC2EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_9StructureEEE
+__ZN3JSC16InternalFunctionC2EPNS_12JSGlobalDataEN3WTF17NonNullPassRefPtrINS_9StructureEEERKNS_10IdentifierE
+__ZN3JSC7UStringC1EPKc
+__ZN3JSC12SmallStrings17createEmptyStringEPNS_12JSGlobalDataE
+__ZN3JSC8JSObject17putDirectInternalERKNS_10IdentifierENS_7JSValueEjbRNS_15PutPropertySlotEPNS_6JSCellE
+__ZN3JSC9Structure40addPropertyTransitionToExistingStructureEPS0_RKNS_10IdentifierEjPNS_6JSCellERm
+__ZN3JSC9Structure3getEPKN7WebCore10StringImplERjRPNS_6JSCellE
+__ZN3JSC9Structure21addPropertyTransitionEPS0_RKNS_10IdentifierEjPNS_6JSCellERm
+__ZN3JSC9Structure3putERKNS_10IdentifierEjPNS_6JSCellE
+__ZN3JSC9Structure28addPropertyWithoutTransitionERKNS_10IdentifierEjPNS_6JSCellE
+__ZN3JSC17FunctionPrototype21addFunctionPropertiesEPNS_9ExecStateEPNS_9StructureEPPNS_10JSFunctionES7_
+__ZN3JSC10JSFunctionC1EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_9StructureEEEiRKNS_10IdentifierEPFNS_7JSValueES2_PNS_8JSObjec
+__ZN3JSC10JSFunctionC2EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_9StructureEEEiRKNS_10IdentifierEPFNS_7JSValueES2_PNS_8JSObjec
+__ZN3JSC8JSObject34putDirectFunctionWithoutTransitionEPNS_9ExecStateEPNS_16InternalFunctionEj
+__ZN3JSC16InternalFunction4nameEPNS_9ExecStateE
+__ZN3JSC15ObjectPrototypeC1EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_9StructureEEEPS5_
+__ZN3JSC15ObjectPrototypeC2EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_9StructureEEEPS5_
+__ZN3JSC9Structure26rehashPropertyMapHashTableEj
+__ZN3JSC8JSObject17createInheritorIDEv
+__ZN3JSC14ArrayPrototypeC1EN3WTF17NonNullPassRefPtrINS_9StructureEEE
+__ZN3JSC7JSArrayC2EN3WTF17NonNullPassRefPtrINS_9StructureEEE
+__ZN3JSC15StringPrototypeC1EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_9StructureEEE
+__ZN3JSC15StringPrototypeC2EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_9StructureEEE
+__ZN3JSC12StringObjectC2EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_9StructureEEE
+__ZN3JSC16BooleanPrototypeC1EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_9StructureEEEPS5_
+__ZN3JSC16BooleanPrototypeC2EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_9StructureEEEPS5_
+__ZN3JSC13BooleanObjectC2EN3WTF17NonNullPassRefPtrINS_9StructureEEE
+__ZN3JSC15NumberPrototypeC1EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_9StructureEEEPS5_
+__ZN3JSC15NumberPrototypeC2EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_9StructureEEEPS5_
+__ZN3JSC12NumberObjectC2EN3WTF17NonNullPassRefPtrINS_9StructureEEE
+__ZN3JSC13DatePrototypeC1EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_9StructureEEE
+__ZN3JSC12DateInstanceC2EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_9StructureEEE
+__ZN3JSC15RegExpPrototypeC1EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_9StructureEEEPS5_
+__ZN3JSC15RegExpPrototypeC2EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_9StructureEEEPS5_
+__ZN3JSC14ErrorPrototypeC1EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_9StructureEEEPS5_
+__ZN3JSC14ErrorPrototypeC2EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_9StructureEEEPS5_
+__ZN3JSC13ErrorInstanceC2EN3WTF17NonNullPassRefPtrINS_9StructureEEE
+__ZN3JSC20NativeErrorPrototypeC1EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_9StructureEEERKNS_7UStringES9_
+__ZN3JSC20NativeErrorPrototypeC2EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_9StructureEEERKNS_7UStringES9_
+__ZN3JSC17ObjectConstructorC1EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_9StructureEEEPNS_15ObjectPrototypeEPS5_
+__ZN3JSC17ObjectConstructorC2EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_9StructureEEEPNS_15ObjectPrototypeEPS5_
+__ZN3JSC10Identifier3addEPNS_9ExecStateEPKc
+__ZN3JSC19FunctionConstructorC1EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_9StructureEEEPNS_17FunctionPrototypeE
+__ZN3JSC19FunctionConstructorC2EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_9StructureEEEPNS_17FunctionPrototypeE
+__ZNK3JSC16InternalFunction9classInfoEv
+__ZN3JSC16ArrayConstructorC1EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_9StructureEEEPNS_14ArrayPrototypeEPS5_
+__ZN3JSC16ArrayConstructorC2EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_9StructureEEEPNS_14ArrayPrototypeEPS5_
+__ZNK3JSC14ArrayPrototype9classInfoEv
+__ZN3JSC17StringConstructorC1EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_9StructureEEEPS5_PNS_15StringPrototypeE
+__ZN3JSC17StringConstructorC2EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_9StructureEEEPS5_PNS_15StringPrototypeE
+__ZNK3JSC15StringPrototype9classInfoEv
+__ZN3JSC9JITThunks16specializedThunkEPNS_12JSGlobalDataEPFN3WTF10PassRefPtrINS_16NativeExecutableEEES2_PNS_14ExecutablePoolEE
+__ZN3JSC26fromCharCodeThunkGeneratorEPNS_12JSGlobalDataEPNS_14ExecutablePoolE
+__ZN3JSC22AbstractMacroAssemblerINS_12X86AssemblerEE8JumpList6appendENS2_4JumpE
+__ZN3JSCL12charToStringERNS_19SpecializedThunkJITEPNS_12JSGlobalDataENS_12X86Registers10RegisterIDES5_S5_
+__ZN3JSC19SpecializedThunkJIT8finalizeEv
+__ZN3JSC10JSFunctionC1EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_9StructureEEEiRKNS_10IdentifierEPNS_16NativeExecutableEPFNS_7
+__ZN3JSC10JSFunctionC2EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_9StructureEEEiRKNS_10IdentifierEPNS_16NativeExecutableEPFNS_7
+__ZN3JSC8JSObject23allocatePropertyStorageEmm
+__ZN3JSC18BooleanConstructorC1EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_9StructureEEEPNS_16BooleanPrototypeE
+__ZN3JSC18BooleanConstructorC2EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_9StructureEEEPNS_16BooleanPrototypeE
+__ZNK3JSC13BooleanObject9classInfoEv
+__ZN3JSC17NumberConstructorC1EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_9StructureEEEPNS_15NumberPrototypeE
+__ZN3JSC17NumberConstructorC2EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_9StructureEEEPNS_15NumberPrototypeE
+__ZN3JSC15DateConstructorC1EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_9StructureEEEPS5_PNS_13DatePrototypeE
+__ZN3JSC15DateConstructorC2EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_9StructureEEEPS5_PNS_13DatePrototypeE
+__ZNK3JSC13DatePrototype9classInfoEv
+__ZN3JSC17RegExpConstructorC1EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_9StructureEEEPNS_15RegExpPrototypeE
+__ZN3JSC17RegExpConstructorC2EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_9StructureEEEPNS_15RegExpPrototypeE
+__ZN3JSC16ErrorConstructorC1EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_9StructureEEEPNS_14ErrorPrototypeE
+__ZN3JSC16ErrorConstructorC2EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_9StructureEEEPNS_14ErrorPrototypeE
+__ZNK3JSC13ErrorInstance9classInfoEv
+__ZN3JSC22NativeErrorConstructorC1EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_9StructureEEEPNS_20NativeErrorPrototypeE
+__ZN3JSC22NativeErrorConstructorC2EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_9StructureEEEPNS_20NativeErrorPrototypeE
+__ZNK3JSC6JSCell9getStringEPNS_9ExecStateE
+__ZN3JSC10Identifier11addSlowCaseEPNS_9ExecStateEPN7WebCore10StringImplE
+__ZN3WTF7HashSetIPN7WebCore10StringImplENS1_10StringHashENS_10HashTraitsIS3_EEE3addERKS3_
+__ZN3JSC10MathObjectC1EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_9StructureEEE
+__ZN3JSC10MathObjectC2EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_9StructureEEE
+__ZN3JSC12SmallStrings24singleCharacterStringRepEh
+__ZN3JSC19SmallStringsStorageC2Ev
+__ZN3JSC18GlobalEvalFunctionC1EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_9StructureEEEiRKNS_10IdentifierEPFNS_7JSValueES2_PNS_
+__ZN3JSC17PrototypeFunctionC2EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_9StructureEEEiRKNS_10IdentifierEPFNS_7JSValueES2_PNS_8
+__ZN3JSC9Structure25changePrototypeTransitionEPS0_NS_7JSValueE
+__ZN3JSC9Structure17copyPropertyTableEv
+__ZN3WTF10RefCountedIN3JSC9StructureEE5derefEv
+__ZN3JSC14JSGlobalObject10globalExecEv
+__ZN3JSC4Heap9unprotectENS_7JSValueE
+__ZN3JSC14TimeoutChecker5resetEv
+__ZN3JSC8evaluateEPNS_9ExecStateERNS_10ScopeChainERKNS_10SourceCodeENS_7JSValueE
+__ZN3JSC6JSLockC1EPNS_9ExecStateE
+__ZN3JSC6JSLock4lockENS_14JSLockBehaviorE
+__ZN3JSC17ProgramExecutable7compileEPNS_9ExecStateEPNS_14ScopeChainNodeE
+__ZN3JSC6Parser5parseINS_11ProgramNodeEEEN3WTF10PassRefPtrIT_EEPNS_12JSGlobalDataEPNS_8DebuggerEPNS_9ExecStateERKNS_10SourceCod
+__ZN3JSC6Parser5parseEPNS_12JSGlobalDataEPiPNS_7UStringE
+__ZN3JSC5Lexer7setCodeERKNS_10SourceCodeERNS_11ParserArenaE
+__Z10jscyyparsePv
+__ZN3JSC5Lexer3lexEPvS1_
+__ZN3JSC10Identifier3addEPNS_12JSGlobalDataEPKti
+__ZN3WTF7HashSetIPN7WebCore10StringImplENS1_10StringHashENS_10HashTraitsIS3_EEE3addIN3JSC11UCharBufferENS9_31IdentifierUCharBuf
+__ZNK3JSC9HashTable11createTableEPNS_12JSGlobalDataE
+__ZN3JSC11ParserArena20allocateFreeablePoolEv
+__ZL20makeFunctionCallNodePN3JSC12JSGlobalDataENS_8NodeInfoIPNS_14ExpressionNodeEEENS2_IPNS_13ArgumentsNodeEEEiii
+__ZNK3JSC15DotAccessorNode10isLocationEv
+__ZNK3JSC14ExpressionNode13isResolveNodeEv
+__ZNK3JSC14ExpressionNode21isBracketAccessorNodeEv
+__ZL14makeAssignNodePN3JSC12JSGlobalDataEPNS_14ExpressionNodeENS_8OperatorES3_bbiii
+__ZNK3JSC11ResolveNode10isLocationEv
+__ZNK3JSC11ResolveNode13isResolveNodeEv
+__ZN3JSC13StatementNode6setLocEii
+__ZN3WTF6VectorIPN3JSC20ParserArenaDeletableELm0EE14expandCapacityEm
+__ZN3JSC14SourceElements6appendEPNS_13StatementNodeE
+__ZNK3JSC13StatementNode16isEmptyStatementEv
+__ZN3WTF6VectorIPN3JSC13StatementNodeELm0EE14expandCapacityEm
+__ZN3JSC6Parser16didFinishParsingEPNS_14SourceElementsEPNS_15ParserArenaDataIN3WTF6VectorISt4pairIPKNS_10IdentifierEjELm0EEEEEP
+__ZN3JSC5Lexer5clearEv
+__ZN3JSC11ProgramNode6createEPNS_12JSGlobalDataEPNS_14SourceElementsEPN3WTF6VectorISt4pairIPKNS_10IdentifierEjELm0EEEPNS6_IPNS_
+__ZN3JSC9ScopeNodeC2EPNS_12JSGlobalDataERKNS_10SourceCodeEPNS_14SourceElementsEPN3WTF6VectorISt4pairIPKNS_10IdentifierEjELm0EEE
+__ZN3JSC11ParserArena14derefWithArenaEN3WTF10PassRefPtrINS_21ParserArenaRefCountedEEE
+__ZN3JSC11ParserArena10removeLastEv
+__ZN3JSC11ParserArena5resetEv
+__ZN3WTF6VectorIN3JSC10IdentifierELm64EE14shrinkCapacityEm
+__ZN3JSC9CodeBlockC2EPNS_16ScriptExecutableENS_8CodeTypeEN3WTF10PassRefPtrINS_14SourceProviderEEEjPNS4_7HashMapINS4_6RefPtrIN7W
+__ZN3WTF7HashSetIPN3JSC15GlobalCodeBlockENS_7PtrHashIS3_EENS_10HashTraitsIS3_EEE3addERKS3_
+__ZN3WTF9HashTableIPN3JSC15GlobalCodeBlockES3_NS_17IdentityExtractorIS3_EENS_7PtrHashIS3_EENS_10HashTraitsIS3_EES9_E6rehashEi
+__ZN3JSC17BytecodeGeneratorC1EPNS_11ProgramNodeEPKNS_8DebuggerERKNS_10ScopeChainEPN3WTF7HashMapINS9_6RefPtrIN7WebCore10StringIm
+__ZN3JSC17BytecodeGeneratorC2EPNS_11ProgramNodeEPKNS_8DebuggerERKNS_10ScopeChainEPN3WTF7HashMapINS9_6RefPtrIN7WebCore10StringIm
+__ZN3WTF6VectorIN3JSC11InstructionELm0EE15reserveCapacityEm
+__ZN3JSC9Structure31toCacheableDictionaryTransitionEPS0_
+__ZN3JSC9Structure22toDictionaryTransitionEPS0_NS0_14DictionaryKindE
+__ZN3JSC9Structure26flattenDictionaryStructureEPNS_8JSObjectE
+__ZN3JSC17BytecodeGenerator8generateEv
+__ZN3JSC11ProgramNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZN3JSC17BytecodeGenerator13emitDebugHookENS_11DebugHookIDEii
+__ZN3JSC17BytecodeGenerator12newTemporaryEv
+__ZN3JSC17BytecodeGenerator11newRegisterEv
+__ZN3JSC17BytecodeGenerator8emitLoadEPNS_10RegisterIDENS_7JSValueE
+__ZN3JSC17BytecodeGenerator16addConstantValueENS_7JSValueE
+__ZN3WTF9HashTableIPvSt4pairIS1_jENS_18PairFirstExtractorIS3_EENS_7PtrHashIS1_EENS_14PairHashTraitsIN3JSC24EncodedJSValueHashTr
+__ZN3WTF6VectorIN3JSC8RegisterELm0EE15reserveCapacityEm
+__ZN3WTF6VectorIN3JSC8LineInfoELm0EE14expandCapacityEm
+__ZN3JSC17ExprStatementNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZN3JSC17AssignResolveNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZN3JSC17BytecodeGenerator11registerForERKNS_10IdentifierE
+__ZN3JSC17BytecodeGenerator18findScopedPropertyERKNS_10IdentifierERiRmbRbRPNS_8JSObjectE
+__ZN3JSC17BytecodeGenerator15emitResolveBaseEPNS_10RegisterIDERKNS_10IdentifierE
+__ZN3JSC19FunctionCallDotNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZN3JSC11NewExprNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZN3JSC11ResolveNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZN3WTF6VectorIN3JSC19ExpressionRangeInfoELm0EE14expandCapacityEm
+__ZN3JSC17BytecodeGenerator11emitResolveEPNS_10RegisterIDERKNS_10IdentifierE
+__ZN3WTF6VectorIN3JSC17GlobalResolveInfoELm0EE14expandCapacityEm
+__ZN3JSC17BytecodeGenerator11addConstantERKNS_10IdentifierE
+__ZN3WTF9HashTableINS_6RefPtrIN7WebCore10StringImplEEESt4pairIS4_iENS_18PairFirstExtractorIS6_EEN3JSC17IdentifierRepHashENS_14P
+__ZN3WTF6VectorIN3JSC10IdentifierELm0EE14expandCapacityEmPKS2_
+__ZN3WTF6VectorIN3JSC10IdentifierELm0EE15reserveCapacityEm
+__ZN3JSC17BytecodeGenerator13emitConstructEPNS_10RegisterIDES2_PNS_13ArgumentsNodeEjjj
+__ZN3WTF6VectorIN3JSC20GetByIdExceptionInfoELm0EE14expandCapacityEm
+__ZN3JSC17BytecodeGenerator11emitGetByIdEPNS_10RegisterIDES2_RKNS_10IdentifierE
+__ZN3WTF6VectorIN3JSC17StructureStubInfoELm0EE14expandCapacityEm
+__ZN3WTF6VectorIN3JSC12CallLinkInfoELm0EE15reserveCapacityEm
+__ZN3JSC17BytecodeGenerator15emitMethodCheckEv
+__ZN3JSC17BytecodeGenerator8emitCallEPNS_10RegisterIDES2_S2_PNS_13ArgumentsNodeEjjj
+__ZN3JSC17BytecodeGenerator8emitCallENS_8OpcodeIDEPNS_10RegisterIDES3_S3_PNS_13ArgumentsNodeEjjj
+__ZN3JSC17BytecodeGenerator11emitPutByIdEPNS_10RegisterIDERKNS_10IdentifierES2_
+__ZN3JSC17BytecodeGenerator16emitUnaryNoDstOpENS_8OpcodeIDEPNS_10RegisterIDE
+__ZN3JSC12JSGlobalData22numericCompareFunctionEPNS_9ExecStateE
+__ZNK3JSC21UStringSourceProvider6lengthEv
+__ZN3JSC18FunctionExecutable14fromGlobalCodeERKNS_10IdentifierEPNS_9ExecStateEPNS_8DebuggerERKNS_10SourceCodeEPiPNS_7UStringE
+__ZNK3JSC21UStringSourceProvider4dataEv
+__ZN3JSC16FunctionBodyNode6createEPNS_12JSGlobalDataE
+__ZN3JSC5Lexer10sourceCodeEiii
+__ZN3JSC16FunctionBodyNode13finishParsingERKNS_10SourceCodeEPNS_13ParameterNodeERKNS_10IdentifierE
+__ZN3WTF6VectorIN3JSC10IdentifierELm0EE14expandCapacityEm
+__ZN3JSC16FunctionBodyNode13finishParsingEN3WTF10PassRefPtrINS_18FunctionParametersEEERKNS_10IdentifierE
+__ZNK3JSC9ScopeNode15singleStatementEv
+__ZNK3JSC17ExprStatementNode15isExprStatementEv
+__ZNK3JSC12FuncExprNode14isFuncExprNodeEv
+__ZThn16_N3JSC11ProgramNodeD0Ev
+__ZN3JSC11ProgramNodeD0Ev
+__ZN3JSC11ParserArenaD1Ev
+__ZN3JSC14SourceElementsD1Ev
+__ZThn16_N3JSC16FunctionBodyNodeD0Ev
+__ZN3JSC16FunctionBodyNodeD0Ev
+__ZN3JSC18FunctionExecutable7compileEPNS_9ExecStateEPNS_14ScopeChainNodeE
+__ZN3JSC6Parser5parseINS_16FunctionBodyNodeEEEN3WTF10PassRefPtrIT_EEPNS_12JSGlobalDataEPNS_8DebuggerEPNS_9ExecStateERKNS_10Sour
+__ZL11makeSubNodePN3JSC12JSGlobalDataEPNS_14ExpressionNodeES3_b
+__ZN3JSC14ExpressionNode14stripUnaryPlusEv
+__ZNK3JSC14ExpressionNode8isNumberEv
+__ZN3JSC16FunctionBodyNode6createEPNS_12JSGlobalDataEPNS_14SourceElementsEPN3WTF6VectorISt4pairIPKNS_10IdentifierEjELm0EEEPNS6_
+__ZN3JSC17BytecodeGeneratorC1EPNS_16FunctionBodyNodeEPKNS_8DebuggerERKNS_10ScopeChainEPN3WTF7HashMapINS9_6RefPtrIN7WebCore10Str
+__ZN3JSC17BytecodeGeneratorC2EPNS_16FunctionBodyNodeEPKNS_8DebuggerERKNS_10ScopeChainEPN3WTF7HashMapINS9_6RefPtrIN7WebCore10Str
+__ZN3JSC17BytecodeGenerator12addParameterERKNS_10IdentifierE
+__ZN3JSC16FunctionBodyNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZN3JSC9BlockNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZN3JSC10ReturnNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZN3JSC12BinaryOpNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZNK3JSC11ResolveNode6isPureERNS_17BytecodeGeneratorE
+__ZN3JSC17BytecodeGenerator7isLocalERKNS_10IdentifierE
+__ZN3JSC17BytecodeGenerator12emitBinaryOpENS_8OpcodeIDEPNS_10RegisterIDES3_S3_NS_12OperandTypesE
+__ZN3JSC17BytecodeGenerator10emitReturnEPNS_10RegisterIDE
+__ZNK3JSC9BlockNode7isBlockEv
+__ZNK3JSC10ReturnNode12isReturnNodeEv
+__ZN3JSC9CodeBlock11shrinkToFitEv
+__ZN3WTF6VectorIN3JSC11InstructionELm0EE14shrinkCapacityEm
+__ZN3WTF6VectorIPN3JSC12CallLinkInfoELm0EE14shrinkCapacityEm
+__ZN3WTF6VectorIN3JSC10IdentifierELm0EE14shrinkCapacityEm
+__ZN3JSC17BytecodeGeneratorD2Ev
+__ZN3WTF6VectorIN3JSC11InstructionELm0EEaSERKS3_
+__ZN3JSC18FunctionExecutableD0Ev
+__ZN3JSC17FunctionCodeBlockD0Ev
+__ZN3JSC9CodeBlockD2Ev
+__ZN3JSC21UStringSourceProviderD0Ev
+__ZNK3JSC8JSObject8toObjectEPNS_9ExecStateE
+__ZN3JSC11Interpreter7executeEPNS_17ProgramExecutableEPNS_9ExecStateEPNS_14ScopeChainNodeEPNS_8JSObjectEPNS_7JSValueE
+__ZN3JSC12JSGlobalData14resetDateCacheEv
+__ZN3JSC12RegisterFile12globalObjectEv
+__ZN3JSC14JSGlobalObject13copyGlobalsToERNS_12RegisterFileE
+__ZN3JSC12RegisterFile15setGlobalObjectEPNS_14JSGlobalObjectE
+__ZN3JSC17ProgramExecutable15generateJITCodeEPNS_9ExecStateEPNS_14ScopeChainNodeE
+__ZN3JSC3JIT14privateCompileEv
+__ZN3JSC3JIT22privateCompileMainPassEv
+__ZN3JSC3JIT13emit_op_enterEPNS_11InstructionE
+__ZN3JSC3JIT11emit_op_movEPNS_11InstructionE
+__ZN3JSC3JIT22emit_op_resolve_globalEPNS_11InstructionEb
+__ZN3JSC23MacroAssemblerX86Common4moveENS_12X86Registers10RegisterIDES2_
+__ZN3WTF6VectorIN3JSC13SlowCaseEntryELm0EE14expandCapacityEmPKS2_
+__ZN3WTF6VectorIN3JSC13SlowCaseEntryELm0EE14expandCapacityEm
+__ZN3JSC3JIT17emit_op_get_by_idEPNS_11InstructionE
+__ZN3JSC3JIT21compileGetByIdHotPathEiiPNS_10IdentifierEj
+__ZN3JSC3JIT17emit_op_constructEPNS_11InstructionE
+__ZN3JSC3JIT13compileOpCallENS_8OpcodeIDEPNS_11InstructionEj
+__ZN3JSC11JITStubCall4callEv
+__ZN3WTF6VectorIN3JSC10CallRecordELm0EE14expandCapacityEm
+__ZN3JSC3JIT24emit_op_construct_verifyEPNS_11InstructionE
+__ZN3JSC3JIT20emit_op_method_checkEPNS_11InstructionE
+__ZN3WTF6VectorIN3JSC25MethodCallCompilationInfoELm0EE14expandCapacityEm
+__ZN3JSC3JIT12emit_op_callEPNS_11InstructionE
+__ZN3JSC3JIT17emit_op_put_by_idEPNS_11InstructionE
+__ZN3JSC3JIT11emit_op_endEPNS_11InstructionE
+__ZN3WTF6VectorIN3JSC9JumpTableELm0EE14shrinkCapacityEm
+__ZN3JSC3JIT23privateCompileSlowCasesEv
+__ZN3JSC3JIT26emitSlow_op_resolve_globalEPNS_11InstructionERPNS_13SlowCaseEntryE
+__ZN3JSC20MacroAssemblerX86_648storePtrENS_22AbstractMacroAssemblerINS_12X86AssemblerEE6ImmPtrENS3_15ImplicitAddressE
+__ZN3JSC11JITStubCall4callEj
+__ZN3JSC3JIT21emitSlow_op_get_by_idEPNS_11InstructionERPNS_13SlowCaseEntryE
+__ZN3JSC3JIT22compileGetByIdSlowCaseEiiPNS_10IdentifierERPNS_13SlowCaseEntryEb
+__ZN3JSC3JIT21emitSlow_op_constructEPNS_11InstructionERPNS_13SlowCaseEntryE
+__ZN3JSC3JIT21compileOpCallSlowCaseEPNS_11InstructionERPNS_13SlowCaseEntryEjNS_8OpcodeIDE
+__ZN3JSC3JIT27compileOpConstructSetupArgsEPNS_11InstructionE
+__ZN3JSC3JIT28emitSlow_op_construct_verifyEPNS_11InstructionERPNS_13SlowCaseEntryE
+__ZN3JSC3JIT24emitSlow_op_method_checkEPNS_11InstructionERPNS_13SlowCaseEntryE
+__ZN3JSC3JIT16emitSlow_op_callEPNS_11InstructionERPNS_13SlowCaseEntryE
+__ZN3JSC3JIT22compileOpCallSetupArgsEPNS_11InstructionE
+__ZN3JSC3JIT21emitSlow_op_put_by_idEPNS_11InstructionERPNS_13SlowCaseEntryE
+__ZN3WTF6VectorIN3JSC18MethodCallLinkInfoELm0EE14expandCapacityEm
+__ZN3JSC17BytecodeGenerator18dumpsGeneratedCodeEv
+_ctiTrampoline
+_cti_op_resolve_global
+_cti_op_get_by_id
+__ZNK3JSC7JSValue3getEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE
+_cti_op_construct_NotJSConstruct
+__ZN3JSC15DateConstructor16getConstructDataERNS_13ConstructDataE
+__ZN3JSCL28constructWithDateConstructorEPNS_9ExecStateEPNS_8JSObjectERKNS_7ArgListE
+__ZN3JSC13constructDateEPNS_9ExecStateERKNS_7ArgListE
+__ZN3JSC12DateInstanceC1EPNS_9ExecStateEd
+__ZN3JSC12DateInstanceC2EPNS_9ExecStateEd
+__ZN3WTF8timeClipEd
+_cti_op_get_by_id_method_check
+__ZN3JSC13DatePrototype18getOwnPropertySlotEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE
+__ZN3JSC23setUpStaticFunctionSlotEPNS_9ExecStateEPKNS_9HashEntryEPNS_8JSObjectERKNS_10IdentifierERNS_12PropertySlotE
+__ZN3JSC9Structure13hasTransitionEPN7WebCore10StringImplEj
+_cti_vm_lazyLinkCall
+__ZN3JSCL20dateProtoFuncGetTimeEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZNK3JSC12DateInstance9classInfoEv
+_cti_op_put_by_id
+__ZN3JSC14JSGlobalObject3putEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueERNS_15PutPropertySlotE
+__ZN3JSC8JSObject3putEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueERNS_15PutPropertySlotE
+__ZN3JSC17ProgramExecutableD0Ev
+__ZN3JSC16ProgramCodeBlockD0Ev
+__ZN3WTF9HashTableIPN3JSC15GlobalCodeBlockES3_NS_17IdentityExtractorIS3_EENS_7PtrHashIS3_EENS_10HashTraitsIS3_EES9_E4findIS3_NS
+__ZN3JSC17StructureStubInfo5derefEv
+__ZN7WebCore6String8truncateEj
+__ZN3JSC5Lexer10skipRegExpEv
+__ZNK3JSC14ExpressionNode10isLocationEv
+__ZN3WTF6VectorIPN3JSC16FunctionBodyNodeELm0EE14expandCapacityEm
+__ZNK3JSC18EmptyStatementNode16isEmptyStatementEv
+__ZN3WTF6VectorISt4pairIPKN3JSC10IdentifierEjELm0EE14expandCapacityEm
+__ZN3JSC8JSObject12removeDirectERKNS_10IdentifierE
+__ZN3JSC9Structure24removePropertyTransitionEPS0_RKNS_10IdentifierERm
+__ZN3JSC9Structure6removeERKNS_10IdentifierE
+__ZN3JSC17BytecodeGenerator12addGlobalVarERKNS_10IdentifierEbRPNS_10RegisterIDE
+__ZN3JSC17BytecodeGenerator15emitNewFunctionEPNS_10RegisterIDEPNS_16FunctionBodyNodeE
+__ZN3WTF6VectorINS_6RefPtrIN3JSC18FunctionExecutableEEELm0EE14expandCapacityEm
+__ZN3JSC9Structure31removePropertyWithoutTransitionERKNS_10IdentifierE
+__ZNK3JSC8JSObject11hasPropertyEPNS_9ExecStateERKNS_10IdentifierE
+__ZNK3JSC7UString14toStrictUInt32EPb
+__ZN7WebCore12AtomicString4findEPKtjj
+__ZN3WTF9HashTableINS_6RefPtrIN7WebCore10StringImplEEESt4pairIS4_N3JSC16SymbolTableEntryEENS_18PairFirstExtractorIS8_EENS6_17Id
+__ZN3JSCL30comparePropertyMapEntryIndicesEPKvS1_
+__ZN3JSC13AssignDotNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZNK3JSC14ExpressionNode6isPureERNS_17BytecodeGeneratorE
+__ZN3JSC17BytecodeGenerator8emitMoveEPNS_10RegisterIDES2_
+__ZN3JSC17ObjectLiteralNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZN3JSC17BytecodeGenerator13emitNewObjectEPNS_10RegisterIDE
+__ZN3JSC21FunctionCallValueNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZN3JSC12FuncExprNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZN3JSC17BytecodeGenerator25emitNewFunctionExpressionEPNS_10RegisterIDEPNS_12FuncExprNodeE
+__ZN3JSC12FuncDeclNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZN3JSC15DotAccessorNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZN3JSC16VarStatementNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZN3JSC17BytecodeGenerator15isLocalConstantERKNS_10IdentifierE
+__ZN3JSC16ArgumentListNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZN3JSC11BooleanNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZN3JSC17BytecodeGenerator8emitLoadEPNS_10RegisterIDEb
+__ZN3JSC9ArrayNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZN3JSC17BytecodeGenerator12emitNewArrayEPNS_10RegisterIDEPNS_11ElementNodeE
+__ZN3JSC23FunctionCallResolveNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZN3JSC17BytecodeGenerator19emitResolveWithBaseEPNS_10RegisterIDES2_RKNS_10IdentifierE
+__ZN3JSC10NumberNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZN3JSC17BytecodeGenerator8emitLoadEPNS_10RegisterIDEd
+__ZN3WTF9HashTableIdSt4pairIdN3JSC7JSValueEENS_18PairFirstExtractorIS4_EENS_9FloatHashIdEENS_14PairHashTraitsINS_10HashTraitsId
+__ZN3JSC10StringNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZN3JSC17BytecodeGenerator8emitLoadEPNS_10RegisterIDERKNS_10IdentifierE
+__ZN3WTF9HashTableIPN7WebCore10StringImplESt4pairIS3_PN3JSC8JSStringEENS_18PairFirstExtractorIS8_EENS5_17IdentifierRepHashENS_1
+__ZN3JSC12SmallStrings27createSingleCharacterStringEPNS_12JSGlobalDataEh
+__ZN3JSC8NullNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZN3JSC15ParserArenaDataIN3WTF6VectorIPNS_16FunctionBodyNodeELm0EEEED1Ev
+__ZN3JSC15ParserArenaDataIN3WTF6VectorISt4pairIPKNS_10IdentifierEjELm0EEEED1Ev
+__ZN3JSC3JIT16emit_op_new_funcEPNS_11InstructionE
+__ZN3JSC3JIT18emit_op_new_objectEPNS_11InstructionE
+__ZN3JSC3JIT20emit_op_new_func_expEPNS_11InstructionE
+__ZN3JSC3JIT17emit_op_new_arrayEPNS_11InstructionE
+__ZN3JSC3JIT25emit_op_resolve_with_baseEPNS_11InstructionE
+_cti_op_new_func
+__ZN3JSC10JSFunctionC1EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_18FunctionExecutableEEEPNS_14ScopeChainNodeE
+_cti_op_new_object
+_cti_op_new_func_exp
+_cti_op_call_JSFunction
+__ZN3JSC18FunctionExecutable15generateJITCodeEPNS_9ExecStateEPNS_14ScopeChainNodeE
+__ZN3WTF7HashSetINS_6RefPtrIN7WebCore10StringImplEEEN3JSC17IdentifierRepHashENS_10HashTraitsIS4_EEE3addERKS4_
+__ZN3WTF9HashTableINS_6RefPtrIN7WebCore10StringImplEEES4_NS_17IdentityExtractorIS4_EEN3JSC17IdentifierRepHashENS_10HashTraitsIS
+__ZN3JSC17BytecodeGenerator6addVarERKNS_10IdentifierEbRPNS_10RegisterIDE
+__ZNK3JSC16JSVariableObject16isVariableObjectEv
+__ZN3JSC17BytecodeGenerator16emitGetScopedVarEPNS_10RegisterIDEmiNS_7JSValueE
+__ZNK3JSC13StatementNode12isReturnNodeEv
+__ZN3JSC3JIT29emit_op_enter_with_activationEPNS_11InstructionE
+__ZN3JSC3JIT22emit_op_get_global_varEPNS_11InstructionE
+__ZN3JSC3JIT29emitGetVariableObjectRegisterENS_12X86Registers10RegisterIDEiS2_
+__ZN3JSC3JIT27emit_op_tear_off_activationEPNS_11InstructionE
+__ZN3JSC11JITStubCall11addArgumentEjNS_12X86Registers10RegisterIDE
+__ZN3JSC3JIT11emit_op_retEPNS_11InstructionE
+_cti_register_file_check
+_cti_op_push_activation
+__ZN3JSC12JSActivationC1EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_18FunctionExecutableEEE
+__ZN3JSC12JSActivationC2EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_18FunctionExecutableEEE
+_cti_op_tear_off_activation
+_cti_op_ret_scopeChain
+__ZN3JSC10JSFunction18getOwnPropertySlotEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE
+__ZN3JSC9Structure18transitionTableAddERKSt4pairIN3WTF6RefPtrIN7WebCore10StringImplEEEjEPS0_PNS_6JSCellE
+__ZN3WTF7HashMapISt4pairINS_6RefPtrIN7WebCore10StringImplEEEjES1_IPN3JSC9StructureES9_ENS7_28StructureTransitionTableHashENS7_3
+__ZN3WTF9HashTableISt4pairINS_6RefPtrIN7WebCore10StringImplEEEjES1_IS6_S1_IPN3JSC9StructureES9_EENS_18PairFirstExtractorISB_EEN
+_cti_op_new_array
+__ZN3JSC7JSArrayC1EN3WTF17NonNullPassRefPtrINS_9StructureEEERKNS_7ArgListE
+_cti_op_construct_JSConstruct
+__ZNK3JSC10NumberNode6isPureERNS_17BytecodeGeneratorE
+__ZN3JSC8ThisNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZN3JSC3JIT20emit_op_convert_thisEPNS_11InstructionE
+__ZN3JSC3JIT24emitSlow_op_convert_thisEPNS_11InstructionERPNS_13SlowCaseEntryE
+_cti_op_resolve_with_base
+__ZN3JSC10JSFunction11getCallDataERNS_8CallDataE
+__ZNK3JSC7ArgList8getSliceEiRS0_
+__ZN3JSC9Structure22materializePropertyMapEv
+_cti_op_end
+__ZNK7WebCore6String7toFloatEPb
+__ZN7WebCore10StringImpl7toFloatEPb
+__ZN7WebCore17charactersToFloatEPKtmPb
+__ZN7WebCoreeqERKNS_12AtomicStringEPKc
+__ZNK7WebCore6String5toIntEPb
+__ZN7WebCore10StringImpl5toIntEPb
+__ZN7WebCore15charactersToIntEPKtmPb
+__ZN7WebCore6String6numberEi
+__ZNK7WebCore6String11toIntStrictEPbi
+__ZN7WebCore10StringImpl11toIntStrictEPbi
+__ZN7WebCore21charactersToIntStrictEPKtmPbi
+__ZN7WebCore10StringImpl7replaceEPS0_S1_
+__ZN7WebCore6String6numberEt
+__ZL11makeDivNodePN3JSC12JSGlobalDataEPNS_14ExpressionNodeES3_b
+__ZNK3JSC10NumberNode8isNumberEv
+__ZN3WTF6VectorIPvLm0EE14expandCapacityEm
+__ZN3WTF6VectorIjLm16EE6resizeEm
+__ZN3WTFL7multaddERNS_6BigIntEii
+__ZN3WTF6VectorIjLm16EEaSERKS1_
+__ZN3WTFL4multERNS_6BigIntERKS0_
+__ZL11makeAddNodePN3JSC12JSGlobalDataEPNS_14ExpressionNodeES3_b
+__ZN3WTF6VectorIPNS0_IN3JSC10IdentifierELm64EEELm32EE15reserveCapacityEm
+__ZL14makePrefixNodePN3JSC12JSGlobalDataEPNS_14ExpressionNodeENS_8OperatorEiii
+__ZN3WTF6VectorIPN3JSC10RegisterIDELm32EE15reserveCapacityEm
+__ZN3JSC16PropertyListNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZN3JSC15ConditionalNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZN3JSC17BytecodeGenerator8newLabelEv
+__ZNK3JSC14ExpressionNode26hasConditionContextCodegenEv
+__ZN3JSC17BytecodeGenerator15emitJumpIfFalseEPNS_10RegisterIDEPNS_5LabelE
+__ZN3JSC17BytecodeGenerator8emitJumpEPNS_5LabelE
+__ZN3JSC17BytecodeGenerator9emitLabelEPNS_5LabelE
+__ZN3WTF6VectorIjLm0EE14expandCapacityEm
+__ZN3JSC17BytecodeGenerator14emitPutByIndexEPNS_10RegisterIDEjS2_
+__ZN3JSC6IfNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZNK3JSC14LogicalNotNode26hasConditionContextCodegenEv
+__ZN3JSC11UnaryOpNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZN3JSC17BytecodeGenerator11emitUnaryOpENS_8OpcodeIDEPNS_10RegisterIDES3_
+__ZNK3JSC10StringNode6isPureERNS_17BytecodeGeneratorE
+__ZNK3JSC14ExpressionNode5isAddEv
+__ZN3JSC7ForNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZN3JSC17BytecodeGenerator13newLabelScopeENS_10LabelScope4TypeEPKNS_10IdentifierE
+__ZN3JSC19BracketAccessorNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZN3JSC17BytecodeGenerator12emitGetByValEPNS_10RegisterIDES2_S2_
+__ZN3JSC17PrefixResolveNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZN3JSC17BytecodeGenerator10emitPreIncEPNS_10RegisterIDE
+__ZN3JSC17BytecodeGenerator14emitJumpIfTrueEPNS_10RegisterIDEPNS_5LabelE
+__ZN3JSC3JIT11emit_op_divEPNS_11InstructionE
+__ZN3JSC20MacroAssemblerX86_649branchPtrENS_23MacroAssemblerX86Common9ConditionENS_12X86Registers10RegisterIDES4_
+__ZN3JSC12X86Assembler11cvtsi2sd_rrENS_12X86Registers10RegisterIDENS1_13XMMRegisterIDE
+__ZN3JSC12X86Assembler23X86InstructionFormatter9twoByteOpENS0_15TwoByteOpcodeIDEiNS_12X86Registers10RegisterIDE
+__ZN3JSC12X86Assembler7movq_rrENS_12X86Registers10RegisterIDENS1_13XMMRegisterIDE
+__ZN3JSC23MacroAssemblerX86Common4moveENS_22AbstractMacroAssemblerINS_12X86AssemblerEE5Imm32ENS_12X86Registers10RegisterIDE
+__ZN3JSC15AssemblerBuffer7putByteEi
+__ZN3JSC3JIT14emit_op_jfalseEPNS_11InstructionE
+__ZN3JSC20MacroAssemblerX86_649branchPtrENS_23MacroAssemblerX86Common9ConditionENS_12X86Registers10RegisterIDENS_22AbstractMacr
+__ZN3WTF6VectorIN3JSC9JumpTableELm0EE14expandCapacityEmPKS2_
+__ZN3WTF6VectorIN3JSC9JumpTableELm0EE14expandCapacityEm
+__ZN3JSC3JIT11emit_op_jmpEPNS_11InstructionE
+__ZN3JSC3JIT20emit_op_put_by_indexEPNS_11InstructionE
+__ZN3JSC3JIT13emit_op_jtrueEPNS_11InstructionE
+__ZN3JSC3JIT11emit_op_addEPNS_11InstructionE
+__ZN3JSC3JIT18emit_op_get_by_valEPNS_11InstructionE
+__ZN3JSC20MacroAssemblerX86_649branchPtrENS_23MacroAssemblerX86Common9ConditionENS_22AbstractMacroAssemblerINS_12X86AssemblerEE
+__ZN3JSC12X86Assembler23X86InstructionFormatter11oneByteOp64ENS0_15OneByteOpcodeIDEiNS_12X86Registers10RegisterIDES4_ii
+__ZN3JSC3JIT15emit_op_pre_incEPNS_11InstructionE
+__ZN3JSC3JIT16emitTimeoutCheckEv
+__ZN3JSC3JIT13emit_op_jlessEPNS_11InstructionE
+__ZN3JSC3JIT15emitSlow_op_divEPNS_11InstructionERPNS_13SlowCaseEntryE
+__ZN3JSC3JIT18emitSlow_op_jfalseEPNS_11InstructionERPNS_13SlowCaseEntryE
+__ZN3JSC23MacroAssemblerX86Common12branchTest32ENS0_9ConditionENS_12X86Registers10RegisterIDENS_22AbstractMacroAssemblerINS_12X
+__ZN3JSC3JIT17emitSlow_op_jtrueEPNS_11InstructionERPNS_13SlowCaseEntryE
+__ZN3JSC3JIT22emitSlow_op_get_by_valEPNS_11InstructionERPNS_13SlowCaseEntryE
+__ZN3JSC3JIT27stringGetByValStubGeneratorEPNS_12JSGlobalDataEPNS_14ExecutablePoolE
+__ZN3JSC15AssemblerBuffer14executableCopyEPNS_14ExecutablePoolE
+__ZN3JSC3JIT19emitSlow_op_pre_incEPNS_11InstructionERPNS_13SlowCaseEntryE
+__ZN3JSC11JITStubCall11addArgumentENS_12X86Registers10RegisterIDE
+__ZN3JSC3JIT17emitSlow_op_jlessEPNS_11InstructionERPNS_13SlowCaseEntryE
+__ZN3JSC23MacroAssemblerX86Common12branchDoubleENS0_15DoubleConditionENS_12X86Registers13XMMRegisterIDES3_
+__ZNK3JSC13LogicalOpNode26hasConditionContextCodegenEv
+__ZN3JSC13LogicalOpNode30emitBytecodeInConditionContextERNS_17BytecodeGeneratorEPNS_5LabelES4_b
+__ZN3JSC21ReadModifyResolveNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZN3JSC3JIT11emit_op_subEPNS_11InstructionE
+__ZN3JSC3JIT20compileBinaryArithOpENS_8OpcodeIDEjjjNS_12OperandTypesE
+__ZN3JSC3JIT15emitSlow_op_subEPNS_11InstructionERPNS_13SlowCaseEntryE
+__ZN3JSC3JIT28compileBinaryArithOpSlowCaseENS_8OpcodeIDERPNS_13SlowCaseEntryEjjjNS_12OperandTypesEbb
+__ZN3JSC3JIT15emitSlow_op_addEPNS_11InstructionERPNS_13SlowCaseEntryE
+__ZNK3JSC14JSGlobalObject14isDynamicScopeERb
+_cti_op_jtrue
+__ZNK3JSC8JSObject9toBooleanEPNS_9ExecStateE
+__ZNK3JSC8JSObject24getPropertySpecificValueEPNS_9ExecStateERKNS_10IdentifierERPNS_6JSCellE
+__ZN3JSC27ctiPatchCallByReturnAddressEPNS_9CodeBlockENS_16ReturnAddressPtrENS_11FunctionPtrE
+__ZN3JSC3JIT8linkCallEPNS_10JSFunctionEPNS_9CodeBlockES4_RNS_7JITCodeEPNS_12CallLinkInfoEiPNS_12JSGlobalDataE
+_cti_op_add
+__ZN3JSC13jsAddSlowCaseEPNS_9ExecStateENS_7JSValueES2_
+__ZNK3JSC8JSString11toPrimitiveEPNS_9ExecStateENS_22PreferredPrimitiveTypeE
+__ZNK3JSC7JSValue8toStringEPNS_9ExecStateE
+__ZN3JSC7UString4fromEi
+__ZNK3JSC8JSString11resolveRopeEPNS_9ExecStateE
+__ZN3WTF13tryFastMallocEm
+__ZN7WebCore10StringImpl4findEPKcib
+__ZN3JSC13LogicalOpNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZNK3JSC14ExpressionNode6isNullEv
+__ZN3JSC3JIT11emit_op_neqEPNS_11InstructionE
+__ZN3JSC12X86Assembler8shll_i8rEiNS_12X86Registers10RegisterIDE
+__ZN3JSC12X86Assembler6orl_irEiNS_12X86Registers10RegisterIDE
+__ZN3JSC3JIT15emitSlow_op_neqEPNS_11InstructionERPNS_13SlowCaseEntryE
+_cti_op_call_arityCheck
+_cti_op_eq
+__ZN3JSC9JITThunks15tryCacheGetByIDEPNS_9ExecStateEPNS_9CodeBlockENS_16ReturnAddressPtrENS_7JSValueERKNS_10IdentifierERKNS_12Pr
+__ZN3JSC14StructureChainC1EPNS_9StructureE
+__ZN3JSC14StructureChainC2EPNS_9StructureE
+__ZN3JSC3JIT26privateCompileGetByIdChainEPNS_17StructureStubInfoEPNS_9StructureEPNS_14StructureChainEmRKNS_10IdentifierERKNS_12
+__ZN3JSC3JIT22compileGetDirectOffsetEPNS_8JSObjectENS_12X86Registers10RegisterIDES4_m
+_cti_op_get_by_id_self_fail
+__ZN3JSC3JIT29privateCompileGetByIdSelfListEPNS_17StructureStubInfoEPNS_30PolymorphicAccessStructureListEiPNS_9StructureERKNS_1
+_cti_op_get_by_id_custom_stub
+__ZN3JSC10MathObject18getOwnPropertySlotEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE
+__ZN3JSCL16mathProtoFuncMaxEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZL17combineCommaNodesPN3JSC12JSGlobalDataEPNS_14ExpressionNodeES3_
+__ZNK3JSC14ExpressionNode11isCommaNodeEv
+__ZNK3JSC9CommaNode11isCommaNodeEv
+__ZN3JSC9CommaNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZN3JSC19ReverseBinaryOpNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZN3JSC9BreakNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZN3JSC17BytecodeGenerator11breakTargetERKNS_10IdentifierE
+__ZN3JSC17BytecodeGenerator14emitJumpScopesEPNS_5LabelEi
+__ZN3JSC9CommaNodeD1Ev
+__ZN3JSC3JIT14emit_op_jnlessEPNS_11InstructionE
+__ZN3JSC3JIT18emitSlow_op_jnlessEPNS_11InstructionERPNS_13SlowCaseEntryE
+__ZN3JSC7JSArray18getOwnPropertySlotEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE
+_cti_op_jless
+__ZN3JSC3JIT33privateCompilePatchGetArrayLengthENS_16ReturnAddressPtrE
+__ZN3JSC3JIT16patchGetByIdSelfEPNS_9CodeBlockEPNS_17StructureStubInfoEPNS_9StructureEmNS_16ReturnAddressPtrE
+__ZNK3JSC7AddNode5isAddEv
+__ZN3JSC9JITThunks15tryCachePutByIDEPNS_9ExecStateEPNS_9CodeBlockENS_16ReturnAddressPtrENS_7JSValueERKNS_15PutPropertySlotEPNS_
+_cti_op_negate
+__ZN3JSC7UString4fromEj
+__ZL12makeMultNodePN3JSC12JSGlobalDataEPNS_14ExpressionNodeES3_b
+__ZN3JSC9EqualNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZN3JSC17BytecodeGenerator14emitEqualityOpENS_8OpcodeIDEPNS_10RegisterIDES3_S3_
+__ZN3JSC3JIT11emit_op_notEPNS_11InstructionE
+__ZN3JSC3JIT11emit_op_mulEPNS_11InstructionE
+__ZN3JSC3JIT10emit_op_eqEPNS_11InstructionE
+__ZN3JSC3JIT15emitSlow_op_notEPNS_11InstructionERPNS_13SlowCaseEntryE
+__ZN3JSC3JIT15emitSlow_op_mulEPNS_11InstructionERPNS_13SlowCaseEntryE
+__ZN3JSC3JIT14emitSlow_op_eqEPNS_11InstructionERPNS_13SlowCaseEntryE
+_cti_op_not
+__ZN3JSC17ReadModifyDotNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZN3JSC17BytecodeGenerator10emitPreDecEPNS_10RegisterIDE
+__ZN3JSC3JIT16emit_op_jnlesseqEPNS_11InstructionE
+__ZN3JSC3JIT15emit_op_jlesseqEPNS_11InstructionEb
+__ZN3JSC3JIT15emit_op_pre_decEPNS_11InstructionE
+__ZN3JSC3JIT22emit_op_loop_if_lesseqEPNS_11InstructionE
+__ZN3JSC3JIT20emitSlow_op_jnlesseqEPNS_11InstructionERPNS_13SlowCaseEntryE
+__ZN3JSC3JIT19emitSlow_op_jlesseqEPNS_11InstructionERPNS_13SlowCaseEntryEb
+__ZN3JSC3JIT19emitSlow_op_pre_decEPNS_11InstructionERPNS_13SlowCaseEntryE
+__ZN3JSC3JIT26emitSlow_op_loop_if_lesseqEPNS_11InstructionERPNS_13SlowCaseEntryE
+__ZN3JSC17powThunkGeneratorEPNS_12JSGlobalDataEPNS_14ExecutablePoolE
+__ZN3JSC19SpecializedThunkJIT12returnDoubleENS_12X86Registers13XMMRegisterIDE
+__ZN3JSC19SpecializedThunkJITD1Ev
+__ZN3JSCL16mathProtoFuncSinEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSCL16mathProtoFuncMinEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSCL18mathProtoFuncRoundEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSCL16mathProtoFuncLogEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSC3JIT20patchMethodCallProtoEPNS_9CodeBlockERNS_18MethodCallLinkInfoEPNS_10JSFunctionEPNS_9StructureEPNS_8JSObjectENS_16R
+__ZN3JSC3JIT31privateCompilePutByIdTransitionEPNS_17StructureStubInfoEPNS_9StructureES4_mPNS_14StructureChainENS_16ReturnAddres
+__ZN3JSC3JIT13testPrototypeEPNS_9StructureERNS_22AbstractMacroAssemblerINS_12X86AssemblerEE8JumpListE
+__ZN3JSCL16mathProtoFuncAbsEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+_cti_op_jlesseq
+__ZN3WTF6VectorIPN3JSC12CallLinkInfoELm0EE15reserveCapacityEm
+__ZN3JSC10IfElseNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZN3JSC17TypeOfResolveNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZN3JSC7TryNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZN3JSC17BytecodeGenerator9emitCatchEPNS_10RegisterIDEPNS_5LabelES4_
+__ZN3JSC9CodeBlock25createRareDataIfNecessaryEv
+__ZN3WTF6VectorIN3JSC11HandlerInfoELm0EE14expandCapacityEm
+__ZN3JSC17BytecodeGenerator16emitPushNewScopeEPNS_10RegisterIDERKNS_10IdentifierES2_
+__ZN3WTF6VectorIN3JSC18ControlFlowContextELm0EE14expandCapacityEm
+__ZN3JSC15TypeOfValueNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZN3JSCeqERKNS_7UStringEPKc
+__ZN3JSC17BytecodeGenerator12emitPopScopeEv
+__ZN3WTF6VectorIN3JSC15SimpleJumpTableELm0EE14shrinkCapacityEm
+__ZN3WTF6VectorIN3JSC15StringJumpTableELm0EE14shrinkCapacityEm
+__ZN3JSC3JIT13emit_op_catchEPNS_11InstructionE
+__ZN3JSC3JIT22emit_op_push_new_scopeEPNS_11InstructionE
+__ZN3JSC3JIT15emit_op_resolveEPNS_11InstructionE
+__ZN3JSC3JIT20emit_op_resolve_baseEPNS_11InstructionE
+__ZN3JSC3JIT17emit_op_pop_scopeEPNS_11InstructionE
+__ZL15makePostfixNodePN3JSC12JSGlobalDataEPNS_14ExpressionNodeENS_8OperatorEiii
+__ZN3JSC12BinaryOpNode10emitStrcatERNS_17BytecodeGeneratorEPNS_10RegisterIDES4_PNS_21ReadModifyResolveNodeE
+__ZNK3JSC10StringNode8isStringEv
+__ZNK3JSC14ExpressionNode8isStringEv
+__ZN3JSC17BytecodeGenerator15emitToPrimitiveEPNS_10RegisterIDES2_
+__ZN3JSC17BytecodeGenerator10emitStrcatEPNS_10RegisterIDES2_i
+__ZN3JSC18PostfixResolveNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZN3JSC3JIT11emit_op_modEPNS_11InstructionE
+__ZN3JSC23MacroAssemblerX86Common8branch32ENS0_9ConditionENS_12X86Registers10RegisterIDENS_22AbstractMacroAssemblerINS_12X86Ass
+__ZN3JSC3JIT20emit_op_to_primitiveEPNS_11InstructionE
+__ZN3JSC23MacroAssemblerX86Common4moveENS_22AbstractMacroAssemblerINS_12X86AssemblerEE6ImmPtrENS_12X86Registers10RegisterIDE
+__ZN3JSC3JIT14emit_op_strcatEPNS_11InstructionE
+__ZN3JSC3JIT15emitSlow_op_modEPNS_11InstructionERPNS_13SlowCaseEntryE
+__ZN3JSC3JIT24emitSlow_op_to_primitiveEPNS_11InstructionERPNS_13SlowCaseEntryE
+__ZN3JSCL18mathProtoFuncFloorEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSCL17mathProtoFuncCeilEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+_cti_op_strcat
+__ZNK3JSC19BracketAccessorNode10isLocationEv
+__ZNK3JSC19BracketAccessorNode21isBracketAccessorNodeEv
+__ZN3JSC17AssignBracketNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZN3JSC17BytecodeGenerator12emitPutByValEPNS_10RegisterIDES2_S2_
+__ZN3JSC3JIT18emit_op_put_by_valEPNS_11InstructionE
+__ZN3JSC3JIT22emitSlow_op_put_by_valEPNS_11InstructionERPNS_13SlowCaseEntryE
+__ZN3JSC14ArrayPrototype18getOwnPropertySlotEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE
+__ZN3JSC14LogicalNotNode30emitBytecodeInConditionContextERNS_17BytecodeGeneratorEPNS_5LabelES4_b
+__ZN3JSC8JSString18getOwnPropertySlotEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE
+__ZN3JSC15StringPrototype18getOwnPropertySlotEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE
+__ZN3JSC12StringObject18getOwnPropertySlotEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE
+__ZN3JSCL21stringProtoFuncSubstrEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZNK3JSC7JSValue9toIntegerEPNS_9ExecStateE
+__ZN7WebCore10StringImpl6createEN3WTF10PassRefPtrIS0_EEjj
+__ZN3WTF6RefPtrIN7WebCore10StringImplEED1Ev
+__ZN3JSCL18arrayProtoFuncJoinEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZNK3JSC8JSObject12toThisObjectEPNS_9ExecStateE
+__ZN3WTF7HashSetIPN3JSC8JSObjectENS_7PtrHashIS3_EENS_10HashTraitsIS3_EEE3addERKS3_
+__ZN3WTF9HashTableIPN3JSC8JSObjectES3_NS_17IdentityExtractorIS3_EENS_7PtrHashIS3_EENS_10HashTraitsIS3_EES9_E6rehashEi
+__ZNK3JSC8JSObject3getEPNS_9ExecStateERKNS_10IdentifierE
+__ZN3JSC15JSStringBuilder5buildEPNS_9ExecStateE
+__ZN3WTF6VectorItLm64EE17tryExpandCapacityEm
+__ZN3JSCL18arrayProtoFuncPushEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSC7JSArray4pushEPNS_9ExecStateENS_7JSValueE
+__ZN3WTF14tryFastReallocEPvm
+__ZN3JSC4Heap15recordExtraCostEm
+__ZN3JSC17BytecodeGenerator16emitPutScopedVarEmiPNS_10RegisterIDENS_7JSValueE
+__ZN3JSC3JIT22emit_op_put_scoped_varEPNS_11InstructionE
+__ZN3JSC3JIT29emitPutVariableObjectRegisterENS_12X86Registers10RegisterIDES2_i
+__ZN3JSC3JIT22emit_op_put_global_varEPNS_11InstructionE
+_cti_op_put_by_index
+__ZN3JSC7JSArray3putEPNS_9ExecStateEjNS_7JSValueE
+__ZN3JSC7JSArray11putSlowCaseEPNS_9ExecStateEjNS_7JSValueE
+__ZNK3JSC11BooleanNode6isPureERNS_17BytecodeGeneratorE
+__ZN3JSC10JSFunction3putEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueERNS_15PutPropertySlotE
+__ZNK7WebCore12AtomicString5lowerEv
+_cti_op_get_by_id_proto_list
+__ZN3JSC3JIT30privateCompileGetByIdChainListEPNS_17StructureStubInfoEPNS_30PolymorphicAccessStructureListEiPNS_9StructureEPNS_1
+__ZN3JSC3JIT22emit_op_get_scoped_varEPNS_11InstructionE
+_cti_op_put_by_val
+__ZNK3JSC12JSActivation14isDynamicScopeERb
+__ZN3JSC24ApplyFunctionCallDotNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZNK3JSC14ExpressionNode13isSimpleArrayEv
+__ZN3JSC17BytecodeGenerator26emitJumpIfNotFunctionApplyEPNS_10RegisterIDEPNS_5LabelE
+__ZN3JSC17BytecodeGenerator22willResolveToArgumentsERKNS_10IdentifierE
+__ZN3JSC17BytecodeGenerator15emitLoadVarargsEPNS_10RegisterIDES2_
+__ZN3JSC17BytecodeGenerator15emitCallVarargsEPNS_10RegisterIDES2_S2_S2_jjj
+__ZN3JSC3JIT16emit_op_jneq_ptrEPNS_11InstructionE
+__ZN3JSC3JIT20emit_op_load_varargsEPNS_11InstructionE
+__ZN3JSC3JIT20emit_op_call_varargsEPNS_11InstructionE
+__ZN3JSC3JIT20compileOpCallVarargsEPNS_11InstructionE
+__ZN3JSC3JIT29compileOpCallVarargsSetupArgsEPNS_11InstructionE
+__ZN3JSC3JIT24emitSlow_op_call_varargsEPNS_11InstructionERPNS_13SlowCaseEntryE
+__ZN3JSC3JIT28compileOpCallVarargsSlowCaseEPNS_11InstructionERPNS_13SlowCaseEntryE
+__ZN3JSC14ExecutablePool13systemReleaseERKNS0_10AllocationE
+_JSStringCreateWithCFString
+_JSStringRetain
+_JSStringRelease
+_JSEvaluateScript
+__ZN3JSC4Heap14registerThreadEv
+__ZNK14OpaqueJSString7ustringEv
+__ZN3JSC7UStringC1EPKtj
+__ZN3JSC5Lexer10scanRegExpERPKNS_10IdentifierES4_t
+__ZN3JSC18ConstStatementNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZN3JSC13ConstDeclNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZN3JSC13ConstDeclNode14emitCodeSingleERNS_17BytecodeGeneratorE
+__ZN3JSC17BytecodeGenerator16constRegisterForERKNS_10IdentifierE
+__ZN3JSC10RegExpNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZN3JSC6RegExp6createEPNS_12JSGlobalDataERKNS_7UStringES5_
+__ZNK3JSC7UString4findEtj
+__ZN3JSC4Yarr15jitCompileRegexEPNS_12JSGlobalDataERNS0_14RegexCodeBlockERKNS_7UStringERjRPKcbb
+__ZN3JSC4Yarr12compileRegexERKNS_7UStringERNS0_12RegexPatternE
+__ZN3JSC4Yarr6ParserINS0_23RegexPatternConstructorEE5parseEv
+__ZN3JSC4Yarr18PatternDisjunction17addNewAlternativeEv
+__ZN3WTF6VectorIPN3JSC4Yarr18PatternAlternativeELm0EE15reserveCapacityEm
+__ZN3JSC4Yarr23RegexPatternConstructor20atomPatternCharacterEt
+__ZN3WTF6VectorIN3JSC4Yarr11PatternTermELm0EE14expandCapacityEmPKS3_
+__ZN3WTF6VectorIN3JSC4Yarr11PatternTermELm0EE14expandCapacityEm
+__ZN3JSC4Yarr6ParserINS0_23RegexPatternConstructorEE11parseEscapeILb0ES2_EEbRT0_
+__ZN3JSC4Yarr14RegexGenerator19generateDisjunctionEPNS0_18PatternDisjunctionE
+__ZN3JSC12X86Assembler7addl_irEiNS_12X86Registers10RegisterIDE
+__ZN3JSC23MacroAssemblerX86Common8branch32ENS0_9ConditionENS_12X86Registers10RegisterIDES3_
+__ZN3JSC4Yarr14RegexGenerator12generateTermERNS1_19TermGenerationStateE
+__ZN3JSC12X86Assembler23X86InstructionFormatter9oneByteOpENS0_15OneByteOpcodeIDEiNS_12X86Registers10RegisterIDES4_ii
+__ZN3JSC4Yarr14RegexGenerator19TermGenerationState15jumpToBacktrackENS_22AbstractMacroAssemblerINS_12X86AssemblerEE4JumpEPNS_14
+__ZN3JSC4Yarr14RegexGenerator19jumpIfCharNotEqualsEti
+__ZN3JSC12X86Assembler7subl_irEiNS_12X86Registers10RegisterIDE
+__ZN3JSC22AbstractMacroAssemblerINS_12X86AssemblerEE8JumpList4linkEPS2_
+__ZN3WTF15deleteAllValuesIPN3JSC4Yarr18PatternDisjunctionELm4EEEvRKNS_6VectorIT_XT0_EEE
+__ZN3WTF15deleteAllValuesIPN3JSC4Yarr14CharacterClassELm0EEEvRKNS_6VectorIT_XT0_EEE
+__ZN3JSC17BytecodeGenerator8emitLoadEPNS_10RegisterIDEPNS_6RegExpE
+__ZN3JSC12RegExpObjectC1EN3WTF17NonNullPassRefPtrINS_9StructureEEENS2_INS_6RegExpEEE
+__ZN3JSC12RegExpObjectC2EN3WTF17NonNullPassRefPtrINS_9StructureEEENS2_INS_6RegExpEEE
+__ZN3JSC4Yarr23RegexPatternConstructor30atomParenthesesSubpatternBeginEb
+__ZN3JSC4Yarr25CharacterClassConstructor7putCharEt
+__ZN3JSC4Yarr25CharacterClassConstructor9addSortedERN3WTF6VectorItLm0EEEt
+__ZN3WTF6VectorItLm0EE14expandCapacityEm
+__ZN3JSC4Yarr23RegexPatternConstructor21atomCharacterClassEndEv
+__ZN3WTF6VectorIPN3JSC4Yarr14CharacterClassELm0EE14expandCapacityEmPKS4_
+__ZN3WTF6VectorIPN3JSC4Yarr14CharacterClassELm0EE14expandCapacityEm
+__ZN3WTF6VectorIPN3JSC4Yarr18PatternDisjunctionELm4EE14expandCapacityEm
+__ZN3JSC4Yarr23RegexPatternConstructor23setupDisjunctionOffsetsEPNS0_18PatternDisjunctionEjj
+__ZN3JSC4Yarr14RegexGenerator25generateParenthesesSingleERNS1_19TermGenerationStateE
+__ZN3JSC4Yarr14RegexGenerator30generateParenthesesDisjunctionERNS0_11PatternTermERNS1_19TermGenerationStateEj
+__ZN3WTF6VectorIN3JSC4Yarr14RegexGenerator26AlternativeBacktrackRecordELm0EE14expandCapacityEm
+__ZN3JSC4Yarr14RegexGenerator28generateCharacterClassGreedyERNS1_19TermGenerationStateE
+__ZN3JSC4Yarr14RegexGenerator19matchCharacterClassENS_12X86Registers10RegisterIDERNS_22AbstractMacroAssemblerINS_12X86Assembler
+__ZN3JSC23MacroAssemblerX86Common4jumpEv
+__ZN3JSC4Yarr14RegexGenerator13readCharacterEiNS_12X86Registers10RegisterIDE
+__ZN3JSC12StringObject3putEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueERNS_15PutPropertySlotE
+_JSContextGetGlobalObject
+__ZN3WTF13wtfThreadDataEv
+_JSClassCreate
+__ZN13OpaqueJSClass6createEPK17JSClassDefinition
+__ZN13OpaqueJSClassC2EPK17JSClassDefinitionPS_
+__ZN3WTF7Unicode18convertUTF8ToUTF16EPPKcS2_PPtS4_b
+_JSClassRetain
+_JSObjectMake
+__ZN3JSC16JSCallbackObjectINS_8JSObjectEE4initEPNS_9ExecStateE
+__ZN13OpaqueJSClass9prototypeEPN3JSC9ExecStateE
+__ZN13OpaqueJSClass11contextDataEPN3JSC9ExecStateE
+__ZN3WTF9HashTableIP13OpaqueJSClassSt4pairIS2_P24OpaqueJSClassContextDataENS_18PairFirstExtractorIS6_EENS_7PtrHashIS2_EENS_14Pa
+__ZN24OpaqueJSClassContextDataC2EP13OpaqueJSClass
+_JSStringCreateWithUTF8CString
+_JSObjectSetProperty
+__ZN3JSC12APIEntryShimC1EPNS_9ExecStateEb
+__ZNK14OpaqueJSString10identifierEPN3JSC12JSGlobalDataE
+_JSClassRelease
+_JSContextGetGlobalContext
+_JSGlobalContextRetain
+_JSObjectGetProperty
+_JSValueToObject
+_JSValueProtect
+_JSObjectIsFunction
+_JSObjectCallAsFunction
+__ZN3JSC4callEPNS_9ExecStateENS_7JSValueENS_8CallTypeERKNS_8CallDataES2_RKNS_7ArgListE
+__ZN3JSC10JSFunction4callEPNS_9ExecStateENS_7JSValueERKNS_7ArgListE
+__ZN3JSC11Interpreter7executeEPNS_18FunctionExecutableEPNS_9ExecStateEPNS_10JSFunctionEPNS_8JSObjectERKNS_7ArgListEPNS_14ScopeC
+__ZNK3JSC8NullNode6isNullEv
+__ZN3JSC3JIT16emit_op_neq_nullEPNS_11InstructionE
+__ZNK3JSC19JSStaticScopeObject14isDynamicScopeERb
+__ZN3JSC12RegExpObject18getOwnPropertySlotEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE
+__ZN3JSCL19regExpProtoFuncTestEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZNK3JSC12RegExpObject9classInfoEv
+__ZN3JSC12RegExpObject4testEPNS_9ExecStateERKNS_7ArgListE
+__ZN3JSC12RegExpObject5matchEPNS_9ExecStateERKNS_7ArgListE
+__ZN3JSC6RegExp5matchERKNS_7UStringEiPN3WTF6VectorIiLm32EEE
+__ZN3JSC9WhileNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZN3JSC15StrictEqualNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZN3JSC3JIT16emit_op_stricteqEPNS_11InstructionE
+__ZN3JSC3JIT17compileOpStrictEqEPNS_11InstructionENS0_21CompileOpStrictEqTypeE
+__ZN3JSC3JIT17emit_op_nstricteqEPNS_11InstructionE
+__ZN3JSC3JIT20emitSlow_op_stricteqEPNS_11InstructionERPNS_13SlowCaseEntryE
+__ZN3JSC3JIT21emitSlow_op_nstricteqEPNS_11InstructionERPNS_13SlowCaseEntryE
+__ZN3JSC12ContinueNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZN3JSC17BytecodeGenerator14continueTargetERKNS_10IdentifierE
+__ZN3JSCL7dateNowEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+_cti_op_get_by_val
+__ZN7WebCore10StringImpl5upperEv
+_cti_op_get_by_id_generic
+_cti_op_put_by_id_fail
+__ZNK3JSC7UString8toUInt32EPbb
+__ZNK3JSC7UString8toDoubleEbb
+__ZNK3JSC7UString10UTF8StringEb
+__ZN3JSC18globalFuncParseIntEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSC12nonInlineNaNEv
+__ZN3JSC15toInt32SlowCaseEdRb
+__ZN3JSCL8parseIntERKNS_7UStringEi
+__ZN3JSC15globalFuncIsNaNEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZNK7WebCore6String8toDoubleEPb
+__ZN7WebCore10StringImpl8toDoubleEPb
+__ZN3JSC4Yarr6ParserINS0_23RegexPatternConstructorEE11parseEscapeILb1ENS3_28CharacterClassParserDelegateEEEbRT0_
+__ZN3JSC4Yarr12spacesCreateEv
+__ZN3WTF6VectorIN3JSC4Yarr14CharacterRangeELm0EE14expandCapacityEmPKS3_
+__ZN3WTF6VectorIN3JSC4Yarr14CharacterRangeELm0EE14expandCapacityEm
+__ZN3JSC4Yarr25CharacterClassConstructor6appendEPKNS0_14CharacterClassE
+__ZN3JSC4Yarr25CharacterClassConstructor14addSortedRangeERN3WTF6VectorINS0_14CharacterRangeELm0EEEtt
+__ZN3JSC4Yarr6ParserINS0_23RegexPatternConstructorEE28CharacterClassParserDelegate20atomPatternCharacterEt
+__ZN3JSC4Yarr14RegexGenerator24matchCharacterClassRangeENS_12X86Registers10RegisterIDERNS_22AbstractMacroAssemblerINS_12X86Asse
+__ZN3WTF6VectorIN3JSC22AbstractMacroAssemblerINS1_12X86AssemblerEE4JumpELm16EED1Ev
+_cti_op_nstricteq
+__ZN3JSC27ctiPatchCallByReturnAddressEPNS_9CodeBlockENS_16ReturnAddressPtrENS_21MacroAssemblerCodePtrE
+__ZNK3JSC8JSString9toBooleanEPNS_9ExecStateE
+_cti_op_is_string
+__ZN3JSCL16mathProtoFuncPowEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+_cti_op_get_by_id_proto_list_full
+_cti_op_put_by_id_transition_realloc
+_cti_timeout_check
+__ZN3JSC14TimeoutChecker10didTimeOutEPNS_9ExecStateE
+_cti_op_mul
+__ZN3JSC4Yarr23RegexPatternConstructor25atomBuiltInCharacterClassENS0_23BuiltInCharacterClassIDEb
+_cti_op_convert_this
+__ZNK3JSC8JSString12toThisObjectEPNS_9ExecStateE
+__ZN3JSC12StringObjectC1EN3WTF17NonNullPassRefPtrINS_9StructureEEEPNS_8JSStringE
+__ZN3JSCL22stringProtoFuncReplaceEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZNK3JSC7JSValue12toThisObjectEPNS_9ExecStateE
+__ZNK3JSC8JSObject8toStringEPNS_9ExecStateE
+__ZNK3JSC8JSObject11toPrimitiveEPNS_9ExecStateENS_22PreferredPrimitiveTypeE
+__ZNK3JSC8JSObject12defaultValueEPNS_9ExecStateENS_22PreferredPrimitiveTypeE
+__ZN3JSCL23stringProtoFuncToStringEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZNK3JSC12StringObject9classInfoEv
+__ZN7WebCore10StringImpl4costEv
+__ZN3JSC6JSCell11getCallDataERNS_8CallDataE
+__ZN3JSC24charCodeAtThunkGeneratorEPNS_12JSGlobalDataEPNS_14ExecutablePoolE
+__ZN3JSCL14stringCharLoadERNS_19SpecializedThunkJITE
+_cti_op_get_by_val_string
+_JSValueToBoolean
+_JSValueUnprotect
+_JSGlobalContextRelease
+__ZN3JSC4Heap17collectAllGarbageEv
+__ZN3JSC4Heap9markRootsEv
+__ZN3JSC4Heap30markStackObjectsConservativelyERNS_9MarkStackE
+__ZN3JSC4Heap31markCurrentThreadConservativelyERNS_9MarkStackE
+__ZN3JSC4Heap39markCurrentThreadConservativelyInternalERNS_9MarkStackE
+__ZN3JSC4Heap18markConservativelyERNS_9MarkStackEPvS3_
+__ZN3JSC9MarkStack12markChildrenEPNS_6JSCellE
+__ZN3JSC8JSObject12markChildrenERNS_9MarkStackE
+__ZN3JSC14JSGlobalObject12markChildrenERNS_9MarkStackE
+__ZN3JSCL12markIfNeededERNS_9MarkStackENS_7JSValueE
+__ZN3JSC10JSFunction12markChildrenERNS_9MarkStackE
+__ZN3JSC18FunctionExecutable13markAggregateERNS_9MarkStackE
+__ZN3JSC12JSActivation12markChildrenERNS_9MarkStackE
+__ZN3JSC15JSWrapperObject12markChildrenERNS_9MarkStackE
+__ZN3JSC7JSArray12markChildrenERNS_9MarkStackE
+__ZN3JSC18GlobalEvalFunction12markChildrenERNS_9MarkStackE
+__ZN3JSC9CodeBlock13markAggregateERNS_9MarkStackE
+__ZN3JSC16JSCallbackObjectINS_8JSObjectEE12markChildrenERNS_9MarkStackE
+__ZN3JSC19JSStaticScopeObject12markChildrenERNS_9MarkStackE
+__ZN3JSC9MarkStack12releaseStackEPvm
+__ZN3JSC4Heap20markProtectedObjectsERNS_9MarkStackE
+__ZN3JSC12SmallStrings12markChildrenERNS_9MarkStackE
+__ZN3JSC9MarkStack7compactEv
+__ZN3JSC4Heap5sweepEv
+__ZN3JSC12DateInstanceD1Ev
+__ZN3JSC9CodeBlock13unlinkCallersEv
+__ZN3JSC8JSObjectD1Ev
+__ZN3JSC12JSActivationD1Ev
+__ZN3JSC12JSActivationD2Ev
+__ZN3JSC12StringObjectD1Ev
+__ZN3JSC4Heap12resizeBlocksEv
+__ZN3WTF6VectorIPN3JSC14ExpressionNodeELm8EE14expandCapacityEm
+__ZN3WTF6VectorIPNS0_IN3JSC10RegisterIDELm32EEELm32EE14expandCapacityEmPKS4_
+__ZN3WTF6VectorIPNS0_IN3JSC10RegisterIDELm32EEELm32EE15reserveCapacityEm
+__ZN3JSC8VoidNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZN3JSC4Yarr6ParserINS0_23RegexPatternConstructorEE15parseQuantifierEbjj
+__ZN3JSC4Yarr14RegexGenerator19TermGenerationState15jumpToBacktrackERNS_22AbstractMacroAssemblerINS_12X86AssemblerEE8JumpListEP
+__ZN3JSC4Yarr14wordcharCreateEv
+__ZN3JSC4Yarr12digitsCreateEv
+__ZN3JSC4Yarr14RegexGenerator30generatePatternCharacterGreedyERNS1_19TermGenerationStateE
+__ZN3WTF6VectorINS_6RefPtrIN3JSC10RegisterIDEEELm16EE14expandCapacityEm
+___initializeScavenger_block_invoke_1
+__Z22TCMalloc_SystemReleasePvm
+__Z21TCMalloc_SystemCommitPvm
+__ZNK3JSC7JSValue20toThisObjectSlowCaseEPNS_9ExecStateE
+__ZN3JSCL19mathProtoFuncRandomEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZNK3JSC7JSValue19synthesizePrototypeEPNS_9ExecStateE
+__ZN3JSCL23numberProtoFuncToStringEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSC17NumberConstructor18getOwnPropertySlotEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE
+__ZN3JSCL25numberConstructorMaxValueEPNS_9ExecStateENS_7JSValueERKNS_10IdentifierE
+__ZN3JSC18sqrtThunkGeneratorEPNS_12JSGlobalDataEPNS_14ExecutablePoolE
+__ZN3JSC3JIT26privateCompileGetByIdProtoEPNS_17StructureStubInfoEPNS_9StructureES4_RKNS_10IdentifierERKNS_12PropertySlotEmNS_16
+__ZN3JSC8JSObject3putEPNS_9ExecStateEjNS_7JSValueE
+__ZN3JSC10Identifier4fromEPNS_9ExecStateEj
+__ZN3JSC4Yarr13newlineCreateEv
+__ZN3JSC4Yarr14RegexGenerator29generateAssertionWordBoundaryERNS1_19TermGenerationStateE
+__ZN3JSC4Yarr14RegexGenerator22matchAssertionWordcharERNS1_19TermGenerationStateERNS_22AbstractMacroAssemblerINS_12X86Assembler
+__ZN3JSCL26stringProtoFuncToLowerCaseEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSCL22stringProtoFuncIndexOfEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZNK3JSC7UString4findERKS0_j
+__ZN3JSC17RegExpConstructor18getOwnPropertySlotEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE
+__ZN3JSC17RegExpConstructor16getConstructDataERNS_13ConstructDataE
+__ZN3JSCL30constructWithRegExpConstructorEPNS_9ExecStateEPNS_8JSObjectERKNS_7ArgListE
+__ZN3JSC15constructRegExpEPNS_9ExecStateERKNS_7ArgListE
+__ZNK3JSC6JSCell9classInfoEv
+__ZN3JSCL19regExpProtoFuncExecEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSC12RegExpObject4execEPNS_9ExecStateERKNS_7ArgListE
+__ZNK3JSC17RegExpConstructor14arrayOfMatchesEPNS_9ExecStateE
+__ZN3JSC18RegExpMatchesArrayC2EPNS_9ExecStateEPNS_24RegExpConstructorPrivateE
+__ZN3JSC7JSArrayC2EN3WTF17NonNullPassRefPtrINS_9StructureEEEj
+__ZN3JSC7JSArray15setSubclassDataEPv
+__ZN3JSCL24regExpConstructorDollar1EPNS_9ExecStateENS_7JSValueERKNS_10IdentifierE
+__ZNK3JSC17RegExpConstructor10getBackrefEPNS_9ExecStateEj
+__ZN3JSC20globalFuncParseFloatEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+_cti_op_put_by_id_generic
+__ZN3JSC17BytecodeGenerator29uncheckedRegisterForArgumentsEv
+__ZN3JSC3JIT22emit_op_init_argumentsEPNS_11InstructionE
+__ZN3JSC3JIT24emit_op_create_argumentsEPNS_11InstructionE
+__ZN3JSC20MacroAssemblerX86_6413branchTestPtrENS_23MacroAssemblerX86Common9ConditionENS_22AbstractMacroAssemblerINS_12X86Assemb
+_cti_op_load_varargs
+__ZN3JSC3JIT19patchPutByIdReplaceEPNS_9CodeBlockEPNS_17StructureStubInfoEPNS_9StructureEmNS_16ReturnAddressPtrE
+__ZN3JSC21ThrowableBinaryOpNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZN3JSCL20stringProtoFuncSplitEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+_cti_op_in
+__ZN3JSCL19arrayProtoFuncShiftEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZNK3JSC7JSValue8toUInt32EPNS_9ExecStateE
+__ZN3JSC7JSArray18getOwnPropertySlotEPNS_9ExecStateEjRNS_12PropertySlotE
+__ZN3JSC7JSArray14deletePropertyEPNS_9ExecStateEj
+__ZN3JSC7JSArray3putEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueERNS_15PutPropertySlotE
+__ZN3JSC7JSArray9setLengthEj
+__ZN3JSC23CallFunctionCallDotNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZN3JSC17BytecodeGenerator25emitJumpIfNotFunctionCallEPNS_10RegisterIDEPNS_5LabelE
+_cti_op_create_arguments
+__ZN3JSC9Arguments18getOwnPropertySlotEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE
+__ZN3JSC3JIT30privateCompileGetByIdProtoListEPNS_17StructureStubInfoEPNS_30PolymorphicAccessStructureListEiPNS_9StructureES6_RK
+__ZN3JSC9ForInNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZN3JSC17BytecodeGenerator20emitGetPropertyNamesEPNS_10RegisterIDES2_S2_S2_PNS_5LabelE
+__ZN3WTF6VectorIN3JSC12ForInContextELm0EE15reserveCapacityEm
+__ZN3JSC17BytecodeGenerator20emitNextPropertyNameEPNS_10RegisterIDES2_S2_S2_S2_PNS_5LabelE
+__ZN3JSC3JIT18emit_op_get_pnamesEPNS_11InstructionE
+__ZN3JSC3JIT20emit_op_get_by_pnameEPNS_11InstructionE
+__ZN3JSC3JIT22compileGetDirectOffsetENS_12X86Registers10RegisterIDES2_S2_S2_S2_
+__ZN3JSC3JIT18emit_op_next_pnameEPNS_11InstructionE
+__ZN3JSC3JIT24emitSlow_op_get_by_pnameEPNS_11InstructionERPNS_13SlowCaseEntryE
+_cti_op_get_pnames
+__ZN3JSC22JSPropertyNameIterator6createEPNS_9ExecStateEPNS_8JSObjectE
+__ZN3JSC8JSObject16getPropertyNamesEPNS_9ExecStateERNS_17PropertyNameArrayENS_15EnumerationModeE
+__ZN3JSC8JSObject19getOwnPropertyNamesEPNS_9ExecStateERNS_17PropertyNameArrayENS_15EnumerationModeE
+__ZN3JSC9Structure16getPropertyNamesERNS_17PropertyNameArrayENS_15EnumerationModeE
+__ZN3JSCL29objectProtoFuncHasOwnPropertyEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZNK3JSC8JSObject14hasOwnPropertyEPNS_9ExecStateERKNS_10IdentifierE
+__ZN3JSC8JSObject18getOwnPropertySlotEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE
+_cti_op_typeof
+__ZN3JSC20jsTypeStringForValueEPNS_9ExecStateENS_7JSValueE
+__ZN3JSC9Structure27despecifyFunctionTransitionEPS0_RKNS_10IdentifierE
+_cti_has_property
+__ZN3JSC3JIT26emit_op_tear_off_argumentsEPNS_11InstructionE
+__ZN3JSCL19arrayProtoFuncSliceEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSCL11getPropertyEPNS_9ExecStateEPNS_8JSObjectEj
+__ZN3JSC9Arguments18getOwnPropertySlotEPNS_9ExecStateEjRNS_12PropertySlotE
+_cti_op_tear_off_arguments
+__ZN3JSC10JSFunction19getOwnPropertyNamesEPNS_9ExecStateERNS_17PropertyNameArrayENS_15EnumerationModeE
+__ZNK3JSC10JSFunction9classInfoEv
+__ZN3JSC17DeleteBracketNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZN3JSC17BytecodeGenerator15emitDeleteByValEPNS_10RegisterIDES2_S2_
+__ZN3JSC8JSObject18getOwnPropertySlotEPNS_9ExecStateEjRNS_12PropertySlotE
+_cti_op_del_by_val
+__ZN3JSC8JSObject14deletePropertyEPNS_9ExecStateERKNS_10IdentifierE
+_cti_op_is_boolean
+__ZN3JSC10SwitchNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZN3JSC13CaseBlockNode20emitBytecodeForBlockERNS_17BytecodeGeneratorEPNS_10RegisterIDES4_
+__ZN3JSC13CaseBlockNode18tryOptimizedSwitchERN3WTF6VectorIPNS_14ExpressionNodeELm8EEERiS7_
+__ZN3JSCL17processClauseListEPNS_14ClauseListNodeERN3WTF6VectorIPNS_14ExpressionNodeELm8EEERNS_10SwitchKindERbRiSB_
+__ZN3JSC17BytecodeGenerator11beginSwitchEPNS_10RegisterIDENS_10SwitchInfo10SwitchTypeE
+__ZN3WTF6VectorIN3JSC10SwitchInfoELm0EE14expandCapacityEm
+__ZN3JSC17BytecodeGenerator9endSwitchEjPN3WTF6RefPtrINS_5LabelEEEPPNS_14ExpressionNodeEPS3_ii
+__ZN3WTF6VectorIN3JSC15SimpleJumpTableELm0EE14expandCapacityEm
+__ZNK3JSC5Label4bindEii
+__ZN3JSC3JIT18emit_op_switch_immEPNS_11InstructionE
+__ZN3WTF6VectorIN3JSC12SwitchRecordELm0EE14expandCapacityEm
+__ZN3WTF6VectorIN3JSC17CodeLocationLabelELm0EE4growEm
+_cti_op_switch_imm
+__ZN3JSC4Yarr23RegexPatternConstructor8copyTermERNS0_11PatternTermE
+__ZL14compileBracketiPiPPhPPKtS3_P9ErrorCodeiS_S_R11CompileData
+__ZL32branchFindFirstAssertedCharacterPKhb
+__ZL20branchNeedsLineStartPKhjj
+__ZL17bracketIsAnchoredPKh
+_cti_op_get_by_id_array_fail
+__ZN3JSC17PropertyNameArray3addEPN7WebCore10StringImplE
+__ZN3WTF7HashSetIPN7WebCore10StringImplENS_7PtrHashIS3_EENS_10HashTraitsIS3_EEE3addERKS3_
+__ZN3WTF9HashTableIPN7WebCore10StringImplES3_NS_17IdentityExtractorIS3_EENS_7PtrHashIS3_EENS_10HashTraitsIS3_EES9_E6rehashEi
+__ZN3WTF6VectorIN3JSC10IdentifierELm20EE14expandCapacityEm
+__ZN3JSCL28numberConstructorPosInfinityEPNS_9ExecStateENS_7JSValueERKNS_10IdentifierE
+__ZN3JSCL28numberConstructorNegInfinityEPNS_9ExecStateENS_7JSValueERKNS_10IdentifierE
+__ZN3JSC4Heap5resetEv
+__ZN3JSC9Arguments12markChildrenERNS_9MarkStackE
+__ZN3JSC22JSPropertyNameIterator12markChildrenERNS_9MarkStackE
+__ZN3JSC3JIT10unlinkCallEPNS_12CallLinkInfoE
+__ZN3JSC9LabelNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZN3JSC12RegExpObjectD1Ev
+__ZN3JSC18RegExpMatchesArrayD1Ev
+__ZNK3JSC7JSArray12subclassDataEv
+__ZN3JSC15ObjectPrototype18getOwnPropertySlotEPNS_9ExecStateEjRNS_12PropertySlotE
+__ZN3JSC22JSPropertyNameIteratorD1Ev
+__ZN3JSC22JSPropertyNameIteratorD2Ev
+__ZNK3JSC7JSArray9classInfoEv
+__ZN3JSC7JSArray15copyToRegistersEPNS_9ExecStateEPNS_8RegisterEj
+__ZN3JSC9ArgumentsD1Ev
+__ZN3JSC9ArgumentsD2Ev
+__ZN3JSC7UString4fromEd
+__ZN3WTF32doubleToStringInJavaScriptFormatEdPcPj
+__ZN3WTF4dtoaEPcdiPiS1_PS0_
+__ZN3JSC10Identifier11addSlowCaseEPNS_12JSGlobalDataEPN7WebCore10StringImplE
+__ZN3WTF6VectorIPN3JSC9StructureELm8EE14expandCapacityEm
+_cti_op_resolve_base
+__ZN3JSC12JSActivation18getOwnPropertySlotEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE
+__ZN3JSC20charAtThunkGeneratorEPNS_12JSGlobalDataEPNS_14ExecutablePoolE
+__ZN3JSCL21stringProtoFuncCharAtEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSC17PrefixBracketNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZN3JSC14PostfixDotNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZN3JSC17BytecodeGenerator11emitPostIncEPNS_10RegisterIDES2_
+__ZN3JSC3JIT16emit_op_post_incEPNS_11InstructionE
+__ZN3JSC3JIT20emitSlow_op_post_incEPNS_11InstructionERPNS_13SlowCaseEntryE
+__ZN3JSC18PostfixBracketNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZN3JSC17BytecodeGenerator18pushFinallyContextEPNS_5LabelEPNS_10RegisterIDE
+__ZN3JSC17BytecodeGenerator17popFinallyContextEv
+__ZN3JSC17BytecodeGenerator19highestUsedRegisterEv
+__ZN3JSC17BytecodeGenerator18emitJumpSubroutineEPNS_10RegisterIDEPNS_5LabelE
+__ZN3JSC17BytecodeGenerator20emitSubroutineReturnEPNS_10RegisterIDE
+__ZN3JSC3JIT11emit_op_jsrEPNS_11InstructionE
+__ZN3WTF6VectorIN3JSC3JIT7JSRInfoELm0EE14expandCapacityEm
+__ZN3JSC3JIT13emit_op_throwEPNS_11InstructionE
+__ZN3JSC3JIT12emit_op_sretEPNS_11InstructionE
+__ZN3JSC21ReadModifyBracketNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+_cti_op_lesseq
+__ZN3JSCL20stringProtoFuncMatchEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSC18RegExpMatchesArray18getOwnPropertySlotEPNS_9ExecStateEjRNS_12PropertySlotE
+__ZN3JSC18RegExpMatchesArray17fillArrayInstanceEPNS_9ExecStateE
+__ZN3JSC14jsReplaceRangeEPNS_9ExecStateERKNS_7UStringEiiS4_
+__ZN3JSC18RegExpMatchesArray18getOwnPropertySlotEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE
+__ZNK3JSC8JSObject11hasPropertyEPNS_9ExecStateEj
+__ZN3JSCL24stringProtoFuncSubstringEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+_cti_op_create_arguments_no_params
+__ZN3JSCL21arrayProtoFuncUnShiftEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+_cti_op_pre_dec
+_cti_op_is_undefined
+__ZN3JSC13DeleteDotNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZN3JSC17BytecodeGenerator14emitDeleteByIdEPNS_10RegisterIDES2_RKNS_10IdentifierE
+__ZN3JSC23FunctionCallBracketNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZN3JSC3JIT17emit_op_del_by_idEPNS_11InstructionE
+_cti_op_del_by_id
+__ZN3WTF37parseDateFromNullTerminatedCharactersEPKc
+__ZN3WTFL37parseDateFromNullTerminatedCharactersEPKcRbRi
+_cti_op_get_by_id_proto_fail
+__ZN3JSC17constructFunctionEPNS_9ExecStateERKNS_7ArgListERKNS_10IdentifierERKNS_7UStringEi
+__ZN3WTF6VectorItLm64EE15reserveCapacityEm
+__ZN3JSC20EvalFunctionCallNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZN3JSC17BytecodeGenerator12emitCallEvalEPNS_10RegisterIDES2_S2_PNS_13ArgumentsNodeEjjj
+__ZN3JSC3JIT17emit_op_call_evalEPNS_11InstructionE
+__ZN3JSC3JIT21emitSlow_op_call_evalEPNS_11InstructionERPNS_13SlowCaseEntryE
+_cti_op_resolve
+_cti_op_call_eval
+__ZN3JSC11Interpreter8callEvalEPNS_9ExecStateEPNS_12RegisterFileEPNS_8RegisterEiiRNS_7JSValueE
+__ZN3JSC13LiteralParser5Lexer3lexERNS1_18LiteralParserTokenE
+__ZN3JSC13LiteralParser5parseENS0_11ParserStateE
+__ZN3JSC14EvalExecutable7compileEPNS_9ExecStateEPNS_14ScopeChainNodeE
+__ZN3JSC6Parser5parseINS_8EvalNodeEEEN3WTF10PassRefPtrIT_EEPNS_12JSGlobalDataEPNS_8DebuggerEPNS_9ExecStateERKNS_10SourceCodeEPi
+__ZN3JSC8EvalNode6createEPNS_12JSGlobalDataEPNS_14SourceElementsEPN3WTF6VectorISt4pairIPKNS_10IdentifierEjELm0EEEPNS6_IPNS_16Fu
+__ZNK3JSC10ScopeChain10localDepthEv
+__ZNK3JSC12JSActivation9classInfoEv
+__ZN3JSC17BytecodeGeneratorC1EPNS_8EvalNodeEPKNS_8DebuggerERKNS_10ScopeChainEPN3WTF7HashMapINS9_6RefPtrIN7WebCore10StringImplEE
+__ZN3JSC17BytecodeGeneratorC2EPNS_8EvalNodeEPKNS_8DebuggerERKNS_10ScopeChainEPN3WTF7HashMapINS9_6RefPtrIN7WebCore10StringImplEE
+__ZN3JSC8EvalNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZThn16_N3JSC8EvalNodeD0Ev
+__ZN3JSC8EvalNodeD0Ev
+__ZN3WTF9HashTableINS_6RefPtrIN7WebCore10StringImplEEESt4pairIS4_NS1_IN3JSC14EvalExecutableEEEENS_18PairFirstExtractorIS9_EENS2
+__ZN3JSC9ExecState9thisValueEv
+__ZN3JSC11Interpreter7executeEPNS_14EvalExecutableEPNS_9ExecStateEPNS_8JSObjectEiPNS_14ScopeChainNodeEPNS_7JSValueE
+__ZN3JSC14EvalExecutable15generateJITCodeEPNS_9ExecStateEPNS_14ScopeChainNodeE
+__ZN3JSC9ThrowNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+_cti_op_throw
+__ZN3JSC9CodeBlock34reparseForExceptionInfoIfNecessaryEPNS_9ExecStateE
+__ZN3JSC18FunctionExecutable20reparseExceptionInfoEPNS_12JSGlobalDataEPNS_14ScopeChainNodeEPNS_9CodeBlockE
+__ZN3JSC11Interpreter14throwExceptionERPNS_9ExecStateERNS_7JSValueEjb
+__ZN3JSC9CodeBlock24handlerForBytecodeOffsetEj
+__ZN3JSC11Interpreter15unwindCallFrameERPNS_9ExecStateENS_7JSValueERjRPNS_9CodeBlockE
+__ZN3JSC9CodeBlock36hasGlobalResolveInfoAtBytecodeOffsetEj
+_cti_op_push_new_scope
+__ZN3WTF7HashMapINS_6RefPtrIN7WebCore10StringImplEEEN3JSC16SymbolTableEntryENS5_17IdentifierRepHashENS_10HashTraitsIS4_EENS5_26
+__ZN3JSC19JSStaticScopeObject18getOwnPropertySlotEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE
+__ZN3JSC12JSActivation3putEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueERNS_15PutPropertySlotE
+_cti_op_pop_scope
+_cti_op_is_number
+__ZN3JSCL20arrayProtoFuncConcatEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+_cti_op_stricteq
+__ZN3JSCL20arrayProtoFuncSpliceEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZNK3JSC11Interpreter18retrieveLastCallerEPNS_9ExecStateERiRlRNS_7UStringERNS_7JSValueE
+__ZN3JSC9CodeBlock27lineNumberForBytecodeOffsetEPNS_9ExecStateEj
+__ZN3JSC8RopeImpl20destructNonRecursiveEv
+__ZN3JSC8RopeImpl23derefFibersNonRecursiveERN3WTF6VectorIPS0_Lm32EEE
+__ZN3JSCL17arrayProtoFuncPopEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSC7JSArray3popEv
+__ZN7WebCore6String6numberEd
+__ZN3JSC10Identifier5equalEPKN7WebCore10StringImplEPKc
+__ZNK3JSC9Arguments9classInfoEv
+__ZN3JSC9Arguments15copyToRegistersEPNS_9ExecStateEPNS_8RegisterEj
+__ZN3JSC14InstanceOfNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZN3JSC17BytecodeGenerator14emitInstanceOfEPNS_10RegisterIDES2_S2_S2_
+__ZN3JSC3JIT18emit_op_instanceofEPNS_11InstructionE
+__ZN3JSC3JIT22emitSlow_op_instanceofEPNS_11InstructionERPNS_13SlowCaseEntryE
+__ZN3JSC17BytecodeGenerator11emitPostDecEPNS_10RegisterIDES2_
+__ZN3JSC3JIT16emit_op_post_decEPNS_11InstructionE
+__ZN3JSC3JIT20emitSlow_op_post_decEPNS_11InstructionERPNS_13SlowCaseEntryE
+_cti_op_less
+__ZN3JSC13PrefixDotNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+_cti_op_call_NotJSFunction
+__ZN3JSC17StringConstructor11getCallDataERNS_8CallDataE
+__ZN3JSCL21callStringConstructorEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZNK3JSC8JSString8toNumberEPNS_9ExecStateE
+__ZNK3JSC7UString8toDoubleEv
+__ZN3JSC18BooleanConstructor11getCallDataERNS_8CallDataE
+__ZN3JSCL22callBooleanConstructorEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSC7JSArray19getOwnPropertyNamesEPNS_9ExecStateERNS_17PropertyNameArrayENS_15EnumerationModeE
+__ZN3JSC9ExecState10arrayTableEPS0_
+__ZN3JSC17DeleteResolveNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZN3JSCL18arrayProtoFuncSortEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSC7JSArray4sortEPNS_9ExecStateENS_7JSValueENS_8CallTypeERKNS_8CallDataE
+__ZN3WTF6VectorIN3JSC26AVLTreeNodeForArrayCompareELm0EE14expandCapacityEm
+__ZN3JSC11Interpreter20prepareForRepeatCallEPNS_18FunctionExecutableEPNS_9ExecStateEPNS_10JSFunctionEiPNS_14ScopeChainNodeEPNS_
+__ZN3WTF7AVLTreeIN3JSC32AVLTreeAbstractorForArrayCompareELj44ENS_18AVLTreeDefaultBSetILj44EEEE6insertEi
+__ZN3JSC11Interpreter7executeERNS_16CallFrameClosureEPNS_7JSValueE
+__ZN3WTF7AVLTreeIN3JSC32AVLTreeAbstractorForArrayCompareELj44ENS_18AVLTreeDefaultBSetILj44EEEE7balanceEi
+__ZN3JSC11Interpreter13endRepeatCallERNS_16CallFrameClosureE
+__ZN3JSCL16mathProtoFuncExpEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSCL17mathProtoFuncATanEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZL17makeLeftShiftNodePN3JSC12JSGlobalDataEPNS_14ExpressionNodeES3_b
+__ZN3JSC3JIT14emit_op_lshiftEPNS_11InstructionE
+__ZN3JSC3JIT14emit_op_bitandEPNS_11InstructionE
+__ZN3JSC3JIT14emit_op_rshiftEPNS_11InstructionE
+__ZN3JSC3JIT18emitSlow_op_lshiftEPNS_11InstructionERPNS_13SlowCaseEntryE
+__ZN3JSC3JIT18emitSlow_op_bitandEPNS_11InstructionERPNS_13SlowCaseEntryE
+__ZN3JSC3JIT18emitSlow_op_rshiftEPNS_11InstructionERPNS_13SlowCaseEntryE
+__ZN3JSC32jsSpliceSubstringsWithSeparatorsEPNS_9ExecStateEPNS_8JSStringERKNS_7UStringEPKNS_11StringRangeEiPS5_i
+__ZN3JSCL26stringProtoFuncLastIndexOfEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZNK3JSC7JSValue20toIntegerPreserveNaNEPNS_9ExecStateE
+__ZNK3JSC7UString5rfindERKS0_j
+__ZN3WTF6VectorIiLm0EE15reserveCapacityEm
+__ZN3WTF6VectorINS_6RefPtrIN3JSC5LabelEEELm8EE15reserveCapacityEm
+__ZN3WTF6VectorISt4pairIiiELm8EE14expandCapacityEm
+__ZN3JSC11DoWhileNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZN3JSC3JIT19emit_op_switch_charEPNS_11InstructionE
+_cti_op_switch_char
+__ZN3JSCL21stringProtoFuncSearchEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3WTF10RefCountedIN3JSC6RegExpEE5derefEv
+__ZN3JSC14JSGlobalObjectD2Ev
+__ZN3JSC12RegisterFile17clearGlobalObjectEPNS_14JSGlobalObjectE
+__ZN3JSC17FunctionPrototypeD1Ev
+__ZN3JSC15ObjectPrototypeD1Ev
+__ZN3JSC14ArrayPrototypeD1Ev
+__ZN3JSC15StringPrototypeD1Ev
+__ZN3JSC16BooleanPrototypeD1Ev
+__ZN3JSC15NumberPrototypeD1Ev
+__ZN3JSC13DatePrototypeD1Ev
+__ZN3JSC15RegExpPrototypeD1Ev
+__ZN3JSC14ErrorPrototypeD1Ev
+__ZN3JSC20NativeErrorPrototypeD1Ev
+__ZN3JSC17ObjectConstructorD1Ev
+__ZN3JSC19FunctionConstructorD1Ev
+__ZN3JSC16ArrayConstructorD1Ev
+__ZN3JSC17StringConstructorD1Ev
+__ZN3JSC18BooleanConstructorD1Ev
+__ZN3JSC17NumberConstructorD1Ev
+__ZN3JSC15DateConstructorD1Ev
+__ZN3JSC17RegExpConstructorD1Ev
+__ZN3JSC16ErrorConstructorD1Ev
+__ZN3JSC22NativeErrorConstructorD1Ev
+__ZN3JSC10MathObjectD1Ev
+__ZN3JSC10JSONObjectD1Ev
+__ZN3JSC18GlobalEvalFunctionD1Ev
+__ZN3JSC19JSStaticScopeObjectD1Ev
+__ZN3JSC19JSStaticScopeObjectD2Ev
+__ZN3WTF6VectorIPvLm0EE14expandCapacityEmPKS1_
+__ZN3WTF6VectorIPvLm0EE15reserveCapacityEm
+__ZN3JSC16JSCallbackObjectINS_8JSObjectEED1Ev
+__ZL25clearReferenceToPrototypeP13OpaqueJSValue
+_JSObjectGetPrivate
+__ZNK3JSC16JSCallbackObjectINS_8JSObjectEE9classInfoEv
+__ZN3JSC28globalFuncEncodeURIComponentEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSCL6encodeEPNS_9ExecStateERKNS_7ArgListEPKc
+__ZN3WTF6VectorItLm64EE9tryAppendItEEbPKT_m
+__ZN3WTF6VectorItLm64EE18tryReserveCapacityEm
+__ZN3JSC28globalFuncDecodeURIComponentEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSCL6decodeEPNS_9ExecStateERKNS_7ArgListEPKcb
+__ZN3WTF7Unicode18UTF8SequenceLengthEc
+__ZN3WTF7Unicode18decodeUTF8SequenceEPKc
+__ZN3JSC18EmptyStatementNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZN3JSCltERKNS_7UStringES2_
+__ZN3WTF6VectorItLm0EE14expandCapacityEmPKt
+__ZN3WTF6VectorItLm0EE15reserveCapacityEm
+__ZN3JSC18RegExpMatchesArray3putEPNS_9ExecStateEjNS_7JSValueE
+__ZN3JSC18RegExpMatchesArray14deletePropertyEPNS_9ExecStateEj
+__ZN3JSC18RegExpMatchesArray3putEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueERNS_15PutPropertySlotE
+__ZN3JSC14EvalExecutableD0Ev
+__ZN3JSC13EvalCodeBlockD0Ev
+__ZN3JSC3JIT30emit_op_resolve_global_dynamicEPNS_11InstructionE
+__ZN3JSC3JIT34emitSlow_op_resolve_global_dynamicEPNS_11InstructionERPNS_13SlowCaseEntryE
+__ZN3JSC19FunctionConstructor16getConstructDataERNS_13ConstructDataE
+__ZN3JSCL32constructWithFunctionConstructorEPNS_9ExecStateEPNS_8JSObjectERKNS_7ArgListE
+__ZN3JSC17constructFunctionEPNS_9ExecStateERKNS_7ArgListE
+__ZN3JSC3JIT18emit_op_jmp_scopesEPNS_11InstructionE
+__ZN3JSC8WithNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZN3JSC17BytecodeGenerator13emitPushScopeEPNS_10RegisterIDE
+__ZN3JSC3JIT18emit_op_push_scopeEPNS_11InstructionE
+_cti_op_push_scope
+_cti_op_jmp_scopes
+__ZN3WTF6VectorIN3JSC14ExecutablePool10AllocationELm2EE14expandCapacityEm
+__ZN3JSCL26stringProtoFuncToUpperCaseEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSCL21arrayProtoFuncIndexOfEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSCL16mathProtoFuncCosEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSCL17mathProtoFuncASinEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+_cti_op_loop_if_lesseq
+__ZN3JSC7JSArray4sortEPNS_9ExecStateE
+__ZN3JSC7JSArray17compactForSortingEv
+__ZL18makeRightShiftNodePN3JSC12JSGlobalDataEPNS_14ExpressionNodeES3_b
+__ZN3JSC3JIT13emit_op_bitorEPNS_11InstructionE
+__ZN3JSC3JIT17emitSlow_op_bitorEPNS_11InstructionERPNS_13SlowCaseEntryE
+__ZN3WTF6VectorIN3JSC11StringRangeELm16EE14expandCapacityEm
+__ZN3WTF6VectorIN3JSC7UStringELm16EE14expandCapacityEmPKS2_
+__ZN3WTF6VectorIN3JSC7UStringELm16EE15reserveCapacityEm
+__ZNK3JSC8JSString8toObjectEPNS_9ExecStateE
+__ZN3JSC12StringObject14deletePropertyEPNS_9ExecStateERKNS_10IdentifierE
+_cti_op_post_dec
+__ZN3JSC3JIT14emit_op_bitxorEPNS_11InstructionE
+__ZN3JSC3JIT18emitSlow_op_bitxorEPNS_11InstructionERPNS_13SlowCaseEntryE
+_cti_op_bitand
+_cti_op_bitor
+__ZN7WebCore10StringImpl18simplifyWhiteSpaceEv
+_cti_op_is_object
+__ZN3JSC14jsIsObjectTypeENS_7JSValueE
+__ZN3JSC17PrototypeFunction11getCallDataERNS_8CallDataE
+__ZN3JSC14globalFuncEvalEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSCL19isNonASCIIIdentPartEi
+__ZN3JSC11Interpreter7executeEPNS_14EvalExecutableEPNS_9ExecStateEPNS_8JSObjectEPNS_14ScopeChainNodeEPNS_7JSValueE
+_cti_op_mod
+__ZN7WebCore6String6appendEc
+__ZN7WebCore6String6appendEPKtj
+__ZN3JSC16globalFuncEscapeEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZNK7WebCore6String8foldCaseEv
+__ZN7WebCore10StringImpl8foldCaseEv
+__ZN3JSC10JSFunction15argumentsGetterEPNS_9ExecStateENS_7JSValueERKNS_10IdentifierE
+__ZNK3JSC11Interpreter17retrieveArgumentsEPNS_9ExecStateEPNS_10JSFunctionE
+__ZN3WTF6VectorIPN3JSC14ExpressionNodeELm16EE14expandCapacityEm
+__ZN3WTF6VectorINS_6RefPtrIN3JSC10RegisterIDEEELm16EE15reserveCapacityEm
+__ZN3WTF6VectorIN7WebCore6StringELm0EE14expandCapacityEm
+__ZN3JSC8JSObject14deletePropertyEPNS_9ExecStateEj
+__ZN3JSC18globalFuncUnescapeEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3WTF6VectorItLm64EE14expandCapacityEm
+__ZN3JSC3JIT16emit_op_jeq_nullEPNS_11InstructionE
+__ZN3WTF7CStringC1EPKc
+__ZN3WTFeqERKNS_7CStringES2_
+__ZN7WebCore17equalIgnoringCaseEPKtPKcj
+__ZNK7WebCore6String6toUIntEPb
+__ZN7WebCore10StringImpl6toUIntEPb
+__ZN7WebCore16charactersToUIntEPKtmPb
+__ZN7WebCore10StringImpl11reverseFindEti
+__ZN3WTF23waitForThreadCompletionEjPPv
+__ZN3WTF14FastMallocZone10statisticsEP14_malloc_zone_tP19malloc_statistics_t
+__ZNK7WebCore6String18simplifyWhiteSpaceEv
+__ZN7WebCore10StringImpl23defaultWritingDirectionEv
+__ZN3JSCL20dateProtoFuncSetTimeEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSCL21dateProtoFuncGetMonthEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZNK3JSC12DateInstance26calculateGregorianDateTimeEPNS_9ExecStateE
+__ZN3JSC21msToGregorianDateTimeEPNS_9ExecStateEdbRNS_17GregorianDateTimeE
+__ZN3WTFL18calculateDSTOffsetEdd
+__ZN3JSCL20dateProtoFuncGetDateEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZNK3JSC7JSValue8inheritsEPKNS_9ClassInfoE
+__ZN3JSCL20dateProtoFuncGetYearEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSCL21dateProtoFuncGetHoursEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSCL23dateProtoFuncGetMinutesEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSC3JIT17emit_op_jneq_nullEPNS_11InstructionE
+__ZN3JSCL20dateProtoFuncSetYearEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZNK3JSC7JSValue7toInt32EPNS_9ExecStateERb
+__ZN3JSC21gregorianDateTimeToMSEPNS_9ExecStateERKNS_17GregorianDateTimeEdb
+__ZN3WTF18dateToDaysFrom1970Eiii
+__ZN3JSCL21dateProtoFuncSetMonthEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSCL23setNewValueFromDateArgsEPNS_9ExecStateENS_7JSValueERKNS_7ArgListEib
+__ZN3JSCL20dateProtoFuncSetDateEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSCL24dateProtoFuncToGMTStringEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZNK3JSC12DateInstance29calculateGregorianDateTimeUTCEPNS_9ExecStateE
+__ZN3JSC20formatDateUTCVariantERKNS_17GregorianDateTimeERA100_c
+__ZN3JSC13formatTimeUTCERKNS_17GregorianDateTimeERA100_c
+__ZN3JSC13tryMakeStringIPcPKcS1_EEN3WTF10PassRefPtrIN7WebCore10StringImplEEET_T0_T1_
+__ZN3JSC9parseDateEPNS_9ExecStateERKNS_7UStringE
+__ZN3JSC37parseDateFromNullTerminatedCharactersEPNS_9ExecStateEPKc
+__ZN3JSC16ArrayConstructor16getConstructDataERNS_13ConstructDataE
+__ZN3JSCL29constructWithArrayConstructorEPNS_9ExecStateEPNS_8JSObjectERKNS_7ArgListE
+__ZN3JSCL27constructArrayWithSizeQuirkEPNS_9ExecStateERKNS_7ArgListE
+__ZN3JSC7JSArrayC1EN3WTF17NonNullPassRefPtrINS_9StructureEEEj
+__ZN3JSC17StringConstructor16getConstructDataERNS_13ConstructDataE
+__ZN3JSCL30constructWithStringConstructorEPNS_9ExecStateEPNS_8JSObjectERKNS_7ArgListE
+__ZN3JSC12StringObjectC1EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_9StructureEEERKNS_7UStringE
+__ZN3JSC12StringObjectC2EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_9StructureEEERKNS_7UStringE
+_cti_op_pre_inc
+__ZN3JSCL23dateProtoFuncGetSecondsEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN7WebCore6String6removeEji
+__ZN3JSC23MacroAssemblerX86Common12branchTest32ENS0_9ConditionENS_22AbstractMacroAssemblerINS_12X86AssemblerEE7AddressENS4_5Imm
+__ZN3JSC23MacroAssemblerX86Common8branch32ENS0_9ConditionENS_22AbstractMacroAssemblerINS_12X86AssemblerEE7AddressENS4_5Imm32E
+__ZN3JSC12X86Assembler23X86InstructionFormatter9twoByteOpENS0_15TwoByteOpcodeIDEiNS_12X86Registers10RegisterIDEi
+__ZNK3JSC7UStringixEj
+__ZN3JSC3JIT19emit_op_to_jsnumberEPNS_11InstructionE
+__ZN3JSC3JIT23emitSlow_op_to_jsnumberEPNS_11InstructionERPNS_13SlowCaseEntryE
+_cti_op_to_jsnumber
+__ZN3JSCL30dateProtoFuncGetTimezoneOffsetEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSC5Error6createEPNS_9ExecStateENS_9ErrorTypeERKNS_7UStringEilS6_
+__ZN3JSC22NativeErrorConstructor16getConstructDataERNS_13ConstructDataE
+__ZN3JSC9constructEPNS_9ExecStateENS_7JSValueENS_13ConstructTypeERKNS_13ConstructDataERKNS_7ArgListE
+__ZN3JSCL35constructWithNativeErrorConstructorEPNS_9ExecStateEPNS_8JSObjectERKNS_7ArgListE
+__ZN3JSC22NativeErrorConstructor9constructEPNS_9ExecStateERKNS_7ArgListE
+__ZN3JSC13ErrorInstanceC1EN3WTF17NonNullPassRefPtrINS_9StructureEEE
+__ZN3JSC8JSObject17putWithAttributesEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueEj
+__ZNK3JSC8JSObject13exceptionTypeEv
+__ZN3JSCL22errorProtoFuncToStringEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSC13tryMakeStringINS_7UStringEPKcS1_EEN3WTF10PassRefPtrIN7WebCore10StringImplEEET_T0_T1_
+__ZN3JSC13ErrorInstanceD1Ev
+__ZN3JSC4Heap9freeBlockEm
+__ZN3JSC4Heap12freeBlockPtrEPNS_14CollectorBlockE
+__ZN3JSC28createUndefinedVariableErrorEPNS_9ExecStateERKNS_10IdentifierEjPNS_9CodeBlockE
+__ZN3JSC9CodeBlock32expressionRangeForBytecodeOffsetEPNS_9ExecStateEjRiS3_S3_
+__ZN3JSC10makeStringIPKcNS_7UStringEEES3_T_T0_
+__ZN3JSC13tryMakeStringIPKcNS_7UStringEEEN3WTF10PassRefPtrIN7WebCore10StringImplEEET_T0_
+__ZN3JSCL23returnToThrowTrampolineEPNS_12JSGlobalDataENS_16ReturnAddressPtrERS2_
+_ctiVMThrowTrampoline
+_cti_vm_throw
+__ZNK3JSC8JSObject22isNotAnObjectErrorStubEv
+__ZNK3JSC7UString5asciiEv
+__ZN3JSC6JSLock12DropAllLocksC1ENS_14JSLockBehaviorE
+__ZN3JSCL17createJSLockCountEv
+__ZN3JSC6JSLock12DropAllLocksD1Ev
+__ZNK7WebCore6String5upperEv
+__ZN3JSC4Yarr23RegexPatternConstructor31atomParentheticalAssertionBeginEb
+__ZN3JSC4Yarr14RegexGenerator30generateParentheticalAssertionERNS1_19TermGenerationStateE
+__ZNK3JSC8JSObject8toNumberEPNS_9ExecStateE
+__ZN3WTF6VectorIPN3JSC4Yarr18PatternDisjunctionELm4EE14expandCapacityEmPKS4_
+__ZN3JSCL18regExpObjectSourceEPNS_9ExecStateENS_7JSValueERKNS_10IdentifierE
+__ZN3JSC17RegExpConstructor11getCallDataERNS_8CallDataE
+__ZN3JSCL21callRegExpConstructorEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSC23objectProtoFuncToStringEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZNK3JSC8JSObject9classNameEv
+__ZN3JSC13tryMakeStringIPKcNS_7UStringES2_EEN3WTF10PassRefPtrIN7WebCore10StringImplEEET_T0_T1_
+__ZN3JSC16JSVariableObject14deletePropertyEPNS_9ExecStateERKNS_10IdentifierE
+__ZN3JSC9Structure27despecifyDictionaryFunctionERKNS_10IdentifierE
+__ZN3JSC36constructBooleanFromImmediateBooleanEPNS_9ExecStateENS_7JSValueE
+__ZN3JSC13BooleanObjectC1EN3WTF17NonNullPassRefPtrINS_9StructureEEE
+__ZN3JSC17ObjectConstructor16getConstructDataERNS_13ConstructDataE
+__ZN3JSCL30constructWithObjectConstructorEPNS_9ExecStateEPNS_8JSObjectERKNS_7ArgListE
+__ZNK3JSC9ArrayNode13isSimpleArrayEv
+__ZN3JSC7JSArray14deletePropertyEPNS_9ExecStateERKNS_10IdentifierE
+__ZN3JSCL27compareByStringPairForQSortEPKvS1_
+__ZN3JSC7compareERKNS_7UStringES2_
+__ZN3JSCL24dateProtoFuncToUTCStringEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSC17NumberConstructor16getConstructDataERNS_13ConstructDataE
+__ZN3JSCL30constructWithNumberConstructorEPNS_9ExecStateEPNS_8JSObjectERKNS_7ArgListE
+__ZN3JSC12NumberObjectC1EN3WTF17NonNullPassRefPtrINS_9StructureEEE
+__ZN3JSCL20isNonASCIIIdentStartEi
+__ZN3JSC9Arguments3putEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueERNS_15PutPropertySlotE
+__ZN3JSC14MacroAssembler4peekENS_12X86Registers10RegisterIDEi
+__ZN3JSC4Yarr14RegexGenerator12atEndOfInputEv
+__ZN3JSC14MacroAssembler8branch32ENS_23MacroAssemblerX86Common9ConditionENS_12X86Registers10RegisterIDENS_22AbstractMacroAssemb
+__ZN3JSC22AbstractMacroAssemblerINS_12X86AssemblerEE8JumpList6linkToENS2_5LabelEPS2_
+__ZN3JSC14MacroAssembler4pokeENS_12X86Registers10RegisterIDEi
+__ZN3JSCL28substituteBackreferencesSlowERKNS_7UStringES2_PKiPNS_6RegExpEj
+__ZN3WTF6VectorItLm0EE6appendItEEvPKT_m
+_cti_op_to_primitive
+__ZN3JSC15constructNumberEPNS_9ExecStateENS_7JSValueE
+__ZNK3JSC12NumberObject9classInfoEv
+__Z12jsRegExpFreeP8JSRegExp
+__ZN3JSC13BooleanObjectD1Ev
+__ZN3JSCL18stringFromCharCodeEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSC10makeStringIPKcNS_7UStringES2_EES3_T_T0_T1_
+__ZN3JSCL19dateProtoFuncGetDayEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSC14EvalExecutable20reparseExceptionInfoEPNS_12JSGlobalDataEPNS_14ScopeChainNodeEPNS_9CodeBlockE
+__ZN3JSCL22objectProtoFuncValueOfEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSC8JSObject18getPrimitiveNumberEPNS_9ExecStateERdRNS_7JSValueE
+__ZN3JSCL24dateProtoFuncGetFullYearEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSC12RegExpObject3putEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueERNS_15PutPropertySlotE
+__ZN3JSCL24setRegExpObjectLastIndexEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueE
+__Z15jsc_pcre_xclassiPKh
+__ZN3JSCL28regExpConstructorLeftContextEPNS_9ExecStateENS_7JSValueERKNS_10IdentifierE
+__ZNK3JSC17RegExpConstructor14getLeftContextEPNS_9ExecStateE
+_cti_to_object
+__ZNK3JSC7JSValue16toObjectSlowCaseEPNS_9ExecStateE
+_cti_op_sub
+__ZN3JSC17NumberConstructor11getCallDataERNS_8CallDataE
+__ZN3JSCL21callNumberConstructorEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+_cti_op_bitxor
+_cti_op_is_function
+__ZN3JSC16jsIsFunctionTypeENS_7JSValueE
+__ZN3JSC12NumberObjectD1Ev
+__ZN3WTF6VectorIN3JSC22AbstractMacroAssemblerINS1_12X86AssemblerEE4JumpELm16EE14expandCapacityEm
+__ZN3JSC8JSString18getPrimitiveNumberEPNS_9ExecStateERdRNS_7JSValueE
+__ZN7WebCore6String26fromUTF8WithLatin1FallbackEPKcm
+__ZN7WebCore6String8fromUTF8EPKcm
+__ZN3WTF10fastStrDupEPKc
+__ZN3JSC10throwErrorEPNS_9ExecStateENS_9ErrorTypeE
+__ZN3WTF6VectorIN3JSC15StringJumpTableELm0EE14expandCapacityEm
+__ZN3WTF9HashTableINS_6RefPtrIN7WebCore10StringImplEEESt4pairIS4_N3JSC14OffsetLocationEENS_18PairFirstExtractorIS8_EENS2_10Stri
+__ZN3JSC3JIT21emit_op_switch_stringEPNS_11InstructionE
+__ZN3JSC13LiteralParser5Lexer9lexNumberERNS1_18LiteralParserTokenE
+__ZN3WTF6VectorIPNS_14StringImplBaseELm32EE14expandCapacityEm
+__ZN3JSC4Yarr17nonwordcharCreateEv
+__ZN3JSC3JIT15emit_op_eq_nullEPNS_11InstructionE
+_cti_op_switch_string
+__ZN3JSC12X86Assembler23X86InstructionFormatter15emitRexIfNeededEiii
+__ZN3JSC12X86Assembler23X86InstructionFormatter11memoryModRMEiNS_12X86Registers10RegisterIDES3_ii
+__ZN3JSC4Yarr6ParserINS0_23RegexPatternConstructorEE28CharacterClassParserDelegate25atomBuiltInCharacterClassENS0_23BuiltInChar
+__ZN3JSC4Yarr15nonspacesCreateEv
+__ZN3JSCL25functionProtoFuncToStringEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZNK3JSC21UStringSourceProvider8getRangeEii
+__ZNK3JSC7UString6substrEjj
+__ZN3JSC10makeStringINS_7UStringEPKcS1_EES1_T_T0_T1_
+__ZNK3JSC18FunctionExecutable11paramStringEv
+__ZN3WTF6VectorItLm64EE6appendItEEvPKT_m
+__ZN3JSC13tryMakeStringIPKcNS_7UStringES2_S3_S2_S3_EEN3WTF10PassRefPtrIN7WebCore10StringImplEEET_T0_T1_T2_T3_T4_
+__ZN3JSC17RegExpConstructor3putEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueERNS_15PutPropertySlotE
+__ZN3JSCL21arrayProtoFuncForEachEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSC10JSFunction14deletePropertyEPNS_9ExecStateERKNS_10IdentifierE
+__ZN3JSCL22arrayProtoFuncToStringEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSC16ErrorConstructor16getConstructDataERNS_13ConstructDataE
+__ZN3JSCL29constructWithErrorConstructorEPNS_9ExecStateEPNS_8JSObjectERKNS_7ArgListE
+__ZN3JSC14constructErrorEPNS_9ExecStateERKNS_7ArgListE
+_cti_op_instanceof
+__ZN3JSC6RegExp6createEPNS_12JSGlobalDataERKNS_7UStringE
+__ZN3WTF9HashTableIPN7WebCore10StringImplES3_NS_17IdentityExtractorIS3_EENS_7PtrHashIS3_EENS_10HashTraitsIS3_EES9_E4findIS3_NS_
+_cti_op_get_by_id_string_fail
+__ZN3JSCL20stringProtoFuncSliceEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSC14MacroAssembler4jumpENS_22AbstractMacroAssemblerINS_12X86AssemblerEE5LabelE
+__ZN3JSCL23regExpProtoFuncToStringEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSCL18regExpObjectGlobalEPNS_9ExecStateENS_7JSValueERKNS_10IdentifierE
+__ZN3JSCL22regExpObjectIgnoreCaseEPNS_9ExecStateENS_7JSValueERKNS_10IdentifierE
+__ZN3JSCL21regExpObjectMultilineEPNS_9ExecStateENS_7JSValueERKNS_10IdentifierE
+__ZN3JSC13tryMakeStringIPKcNS_7UStringEPcEEN3WTF10PassRefPtrIN7WebCore10StringImplEEET_T0_T1_
+__ZN3JSC12JSActivation14deletePropertyEPNS_9ExecStateERKNS_10IdentifierE
+__ZN3WTFL10timerFiredEP16__CFRunLoopTimerPv
+__ZN7WebCore22charactersToUIntStrictEPKtmPbi
+__ZN3WTF9HashTableIjSt4pairIjN3JSC7JSValueEENS_18PairFirstExtractorIS4_EENS_7IntHashIjEENS_14PairHashTraitsINS_10HashTraitsIjEE
+__ZN3JSCL23dateProtoFuncSetMinutesEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSCL23setNewValueFromTimeArgsEPNS_9ExecStateENS_7JSValueERKNS_7ArgListEib
+__ZN3JSCL23dateProtoFuncSetSecondsEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSCL28dateProtoFuncSetMilliSecondsEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSCL9dateParseEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSCL21dateProtoFuncToStringEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSC10formatDateERKNS_17GregorianDateTimeERA100_c
+__ZN3JSC10formatTimeERKNS_17GregorianDateTimeERA100_c
+__ZN3JSC19globalFuncEncodeURIEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSC13UnaryPlusNode14stripUnaryPlusEv
+__ZN3JSCL20arrayProtoFuncFilterEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSCL27objectProtoFuncLookupGetterEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSC8JSObject12lookupGetterEPNS_9ExecStateERKNS_10IdentifierE
+__ZNK3JSC6JSCell14isGetterSetterEv
+__ZN3JSCL27objectProtoFuncDefineSetterEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSC8JSObject12defineSetterEPNS_9ExecStateERKNS_10IdentifierEPS0_j
+__ZN3JSCL27objectProtoFuncDefineGetterEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSC8JSObject12defineGetterEPNS_9ExecStateERKNS_10IdentifierEPS0_j
+__ZNK3JSC12GetterSetter14isGetterSetterEv
+__ZN3JSC8JSObject15unwrappedObjectEv
+__ZN3JSC10JSFunction12callerGetterEPNS_9ExecStateENS_7JSValueERKNS_10IdentifierE
+__ZNK3JSC11Interpreter14retrieveCallerEPNS_9ExecStateEPNS_16InternalFunctionE
+__ZN3JSC16toUInt32SlowCaseEdRb
+__ZN3JSC8JSObject22fillGetterPropertySlotERNS_12PropertySlotEPNS_7JSValueE
+__ZNK3JSC12PropertySlot14functionGetterEPNS_9ExecStateE
+_cti_op_get_by_id_getter_stub
+__ZN3JSC12GetterSetter12markChildrenERNS_9MarkStackE
+__ZN3JSCL17mathProtoFuncACosEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3WTF13tryFastCallocEmm
+__ZN3JSC3JIT20emit_op_resolve_skipEPNS_11InstructionE
+_cti_op_resolve_skip
+__ZN3JSC3JIT15emit_op_urshiftEPNS_11InstructionE
+__ZN3JSC3JIT19emitSlow_op_urshiftEPNS_11InstructionERPNS_13SlowCaseEntryE
+__ZN3JSCL25stringProtoFuncCharCodeAtEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3WTF6VectorIcLm0EE14expandCapacityEm
+__ZN3JSC15AssignErrorNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZN3JSC23ThrowableExpressionData14emitThrowErrorERNS_17BytecodeGeneratorENS_9ErrorTypeEPKc
+__ZN3JSC17BytecodeGenerator12emitNewErrorEPNS_10RegisterIDENS_9ErrorTypeENS_7JSValueE
+__ZN3JSC3JIT17emit_op_new_errorEPNS_11InstructionE
+__ZN3JSCL27objectProtoFuncLookupSetterEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSC8JSObject12lookupSetterEPNS_9ExecStateERKNS_10IdentifierE
+__ZN3JSC26createNotAnObjectErrorStubEPNS_9ExecStateEb
+__ZN3JSC13JSNotAnObject18getOwnPropertySlotEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE
+__ZNK3JSC22JSNotAnObjectErrorStub22isNotAnObjectErrorStubEv
+__ZN3JSC22createNotAnObjectErrorEPNS_9ExecStateEPNS_22JSNotAnObjectErrorStubEjPNS_9CodeBlockE
+__ZN3JSC9CodeBlock37getByIdExceptionInfoForBytecodeOffsetEPNS_9ExecStateEjRNS_8OpcodeIDE
+__ZN3JSCL18createErrorMessageEPNS_9ExecStateEPNS_9CodeBlockEiiiNS_7JSValueENS_7UStringE
+__ZN3JSC10makeStringIPKcNS_7UStringES2_S3_S2_S3_S2_EES3_T_T0_T1_T2_T3_T4_T5_
+__ZN3JSC13tryMakeStringIPKcNS_7UStringES2_S3_S2_S3_S2_EEN3WTF10PassRefPtrIN7WebCore10StringImplEEET_T0_T1_T2_T3_T4_T5_
+__ZN3JSC22JSNotAnObjectErrorStubD1Ev
+__ZN3JSC13JSNotAnObjectD1Ev
+__ZN3JSC12GetterSetterD1Ev
+__ZN3JSC20FixedVMPoolAllocator17coalesceFreeSpaceEv
+__ZN3WTF6VectorIPN3JSC13FreeListEntryELm0EE15reserveCapacityEm
+__ZN3JSCL35reverseSortFreeListEntriesByPointerEPKvS1_
+__ZN3JSCL33reverseSortCommonSizedAllocationsEPKvS1_
+__ZN7WebCore20equalIgnoringNullityEPNS_10StringImplES1_
+__ZN3JSC19globalFuncDecodeURIEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSC16ErrorConstructor11getCallDataERNS_8CallDataE
+__ZN3JSCL20callErrorConstructorEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSCL22functionProtoFuncApplyEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSC9Arguments11fillArgListEPNS_9ExecStateERNS_20MarkedArgumentBufferE
+__ZN3JSCL21functionProtoFuncCallEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSC10JSONObject18getOwnPropertySlotEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE
+_cti_op_lshift
+__ZN3JSCL29regExpConstructorRightContextEPNS_9ExecStateENS_7JSValueERKNS_10IdentifierE
+__ZNK3JSC17RegExpConstructor15getRightContextEPNS_9ExecStateE
+__ZN3JSC20MarkedArgumentBuffer10slowAppendENS_7JSValueE
+__ZN3WTF9HashTableIPN3JSC20MarkedArgumentBufferES3_NS_17IdentityExtractorIS3_EENS_7PtrHashIS3_EENS_10HashTraitsIS3_EES9_E6expan
+__ZN3WTF6VectorIN3JSC8RegisterELm8EE15reserveCapacityEm
+__ZN3WTF9HashTableIPN3JSC20MarkedArgumentBufferES3_NS_17IdentityExtractorIS3_EENS_7PtrHashIS3_EENS_10HashTraitsIS3_EES9_E4findI
+__ZN3JSCL26stringFromCharCodeSlowCaseEPNS_9ExecStateERKNS_7ArgListE
+__ZN3JSC4Yarr12RegexPattern21newlineCharacterClassEv
+__ZN3JSC10JSFunction12lengthGetterEPNS_9ExecStateENS_7JSValueERKNS_10IdentifierE
+__ZN3JSC18globalFuncIsFiniteEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSC16ArrayConstructor11getCallDataERNS_8CallDataE
+__ZN3JSCL20callArrayConstructorEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSCL19stringProtoFuncTrimEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSC15isStrWhiteSpaceEt
+__ZN3JSC6JSCell9getObjectEv
+_ctiOpThrowNotCaught
+__ZN3JSCL22numberProtoFuncValueOfEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSC12NumberObject11getJSNumberEv
+__ZN7WebCore10StringImpl6secureEt
+__ZN3JSC23createNotAFunctionErrorEPNS_9ExecStateENS_7JSValueEjPNS_9CodeBlockE
+_cti_op_rshift
+__ZN3JSC13JSNotAnObject18getOwnPropertySlotEPNS_9ExecStateEjRNS_12PropertySlotE
+__ZN3WTF6VectorIN3JSC22AbstractMacroAssemblerINS1_12X86AssemblerEE4JumpELm16EEC2ERKS6_
+__ZN3JSCL21arrayProtoFuncReverseEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3WTF21CrossThreadRefCountedINS_16OwnFastMallocPtrIKtEEE5derefEv
+_cti_op_post_inc
+__ZN3JSCL21regExpObjectLastIndexEPNS_9ExecStateENS_7JSValueERKNS_10IdentifierE
+__ZN3JSC3JIT14emit_op_bitnotEPNS_11InstructionE
+__ZN3JSC3JIT18emitSlow_op_bitnotEPNS_11InstructionERPNS_13SlowCaseEntryE
+_cti_op_bitnot
+__ZNK3JSC10JSONObject9classInfoEv
+_JSGlobalContextCreate
+_JSGlobalContextCreateInGroup
+__ZN3JSC12JSGlobalData18createContextGroupENS_15ThreadStackTypeE
+__ZN3JSC21createIdentifierTableEv
+__ZN3JSC4Heap29makeUsableFromMultipleThreadsEv
+__ZN3JSC6JSLock6unlockENS_14JSLockBehaviorE
+_JSValueMakeFromJSONString
+_JSValueIsNull
+_JSValueIsUndefined
+_JSValueIsBoolean
+_JSValueIsNumber
+_JSValueIsString
+__ZN3JSC14JSGlobalObject18getOwnPropertySlotEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE
+_JSValueIsInstanceOfConstructor
+__ZN3JSC8JSObject11hasInstanceEPNS_9ExecStateENS_7JSValueES3_
+_JSValueToNumber
+_JSObjectGetPropertyAtIndex
+_JSValueToStringCopy
+__ZN14OpaqueJSString6createERKN3JSC7UStringE
+_JSStringCopyCFString
+__ZN3JSC4Heap7destroyEv
+__ZN3JSC4Heap10freeBlocksEv
+__ZN3JSC14JSGlobalObjectD1Ev
+__ZN3JSC14JSGlobalObject25destroyJSGlobalObjectDataEPv
+__ZN3JSC12JSGlobalDataD1Ev
+__ZN3JSC12JSGlobalDataD2Ev
+__ZN3JSC12RegisterFileD1Ev
+__ZNK3JSC9HashTable11deleteTableEv
+__ZN3JSC5LexerD1Ev
+__ZN3WTF20deleteAllPairSecondsIP24OpaqueJSClassContextDataKNS_7HashMapIP13OpaqueJSClassS2_NS_7PtrHashIS5_EENS_10HashTraitsIS5_E
+__ZN3JSC17CommonIdentifiersD2Ev
+__ZN3JSC21deleteIdentifierTableEPNS_15IdentifierTableE
+__ZN3JSC15IdentifierTableD2Ev
+__ZN3JSC4HeapD1Ev
+__ZN3JSC9JITThunksD1Ev
+__ZN3JSC16NativeExecutableD0Ev
+__ZN3JSC12SmallStringsD1Ev
+__ZN3JSC14JSGlobalObject17putWithAttributesEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueEj
+__ZN3JSC17ObjectConstructor11getCallDataERNS_8CallDataE
+__ZN3JSCL21callObjectConstructorEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSC9Arguments14deletePropertyEPNS_9ExecStateEj
+__ZN3JSCL18JSONProtoFuncParseEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSC7JSArray11fillArgListEPNS_9ExecStateERNS_20MarkedArgumentBufferE
+__ZN3JSCL17arrayProtoFuncMapEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSC12StringObjectC1EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_9StructureEEE
+__ZN3JSC23MacroAssemblerX86Common9urshift32ENS_12X86Registers10RegisterIDES2_
+_cti_op_urshift
+__ZN3JSC15ObjectPrototype3putEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueERNS_15PutPropertySlotE
+__ZN3JSCL21stringProtoFuncConcatEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSCL24regExpConstructorDollar2EPNS_9ExecStateENS_7JSValueERKNS_10IdentifierE
+__ZN3JSCL24regExpConstructorDollar3EPNS_9ExecStateENS_7JSValueERKNS_10IdentifierE
+__ZN3JSCL24regExpConstructorDollar4EPNS_9ExecStateENS_7JSValueERKNS_10IdentifierE
+__ZN3JSC20MarkedArgumentBuffer9markListsERNS_9MarkStackERN3WTF7HashSetIPS0_NS3_7PtrHashIS5_EENS3_10HashTraitsIS5_EEEE
+__ZN3JSCL22numberProtoFuncToFixedEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSCL16integerPartNoExpEd
+__ZN3JSC10makeStringINS_7UStringES1_PKcS1_EES1_T_T0_T1_T2_
+__ZN3JSC13tryMakeStringINS_7UStringES1_PKcS1_EEN3WTF10PassRefPtrIN7WebCore10StringImplEEET_T0_T1_T2_
+__ZN3JSCL26numberProtoFuncToPrecisionEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSCL12charSequenceEci
+__ZN3JSC13tryMakeStringINS_7UStringEPKcS1_S1_EEN3WTF10PassRefPtrIN7WebCore10StringImplEEET_T0_T1_T2_
+__ZN3JSCL24booleanProtoFuncToStringEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZNK3JSC12JSActivation12toThisObjectEPNS_9ExecStateE
+_cti_op_div
+__ZN3JSC17BytecodeGenerator21emitComplexJumpScopesEPNS_5LabelEPNS_18ControlFlowContextES4_
+__ZN7WebCore10StringImpl7replaceEjjPS0_
+__ZN3JSC12RegExpObject11getCallDataERNS_8CallDataE
+__ZN3JSC12StringObject19getOwnPropertyNamesEPNS_9ExecStateERNS_17PropertyNameArrayENS_15EnumerationModeE
+__ZN3JSC9ExecState11stringTableEPS0_
+__ZNK3JSC7JSValue16synthesizeObjectEPNS_9ExecStateE
+__ZN3JSC13JSNotAnObject3putEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueERNS_15PutPropertySlotE
+__ZN3JSCL35objectProtoFuncPropertyIsEnumerableEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZNK3JSC8JSObject20propertyIsEnumerableEPNS_9ExecStateERKNS_10IdentifierE
+__ZN3JSC7JSArray24getOwnPropertyDescriptorEPNS_9ExecStateERKNS_10IdentifierERNS_18PropertyDescriptorE
+__ZN3JSC18PropertyDescriptor13setDescriptorENS_7JSValueEj
+__ZNK3JSC18PropertyDescriptor10enumerableEv
+__ZN3JSCL22JSONProtoFuncStringifyEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSC11StringifierC2EPNS_9ExecStateENS_7JSValueES3_
+__ZN3JSC11Stringifier9stringifyENS_7JSValueE
+__ZN3JSC11Stringifier22appendStringifiedValueERNS_13StringBuilderENS_7JSValueEPNS_8JSObjectERKNS_27PropertyNameForFunctionCallE
+__ZNK3JSC6JSCell9getStringEPNS_9ExecStateERNS_7UStringE
+__ZN3JSC11Stringifier6Holder18appendNextPropertyERS0_RNS_13StringBuilderE
+__ZN3JSC11Stringifier18appendQuotedStringERNS_13StringBuilderERKNS_7UStringE
+__ZN3JSC11StringifierD2Ev
+__ZN3JSC5Lexer19copyCodeWithoutBOMsEv
+__ZN3JSCL21dateProtoFuncSetHoursEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSC17FunctionPrototype11getCallDataERNS_8CallDataE
+__ZN3JSCL28dateProtoFuncGetMilliSecondsEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSC10makeStringINS_7UStringES1_EES1_T_T0_
+__ZN3JSC13tryMakeStringINS_7UStringES1_EEN3WTF10PassRefPtrIN7WebCore10StringImplEEET_T0_
+__ZN3JSC23MacroAssemblerX86Common8branch16ENS0_9ConditionENS_22AbstractMacroAssemblerINS_12X86AssemblerEE9BaseIndexENS4_5Imm32E
+__Z22jsc_pcre_ucp_othercasej
+__ZN3JSC8JSString18getOwnPropertySlotEPNS_9ExecStateEjRNS_12PropertySlotE
+__ZN3JSCL24dateProtoFuncSetUTCHoursEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSCL26dateProtoFuncSetUTCMinutesEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSCL26dateProtoFuncSetUTCSecondsEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSCL23dateProtoFuncGetUTCDateEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSCL23dateProtoFuncSetUTCDateEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSCL24dateProtoFuncGetUTCHoursEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSCL26dateProtoFuncGetUTCMinutesEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSCL26dateProtoFuncGetUTCSecondsEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSCL24dateProtoFuncSetFullYearEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3WTF6VectorIiLm32EE15reserveCapacityEm
+__ZN3JSCL22regExpProtoFuncCompileEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZNK3JSC27PropertyNameForFunctionCall5valueEPNS_9ExecStateE
+_cti_op_new_error
+__ZN7WebCore6String6numberEj
+__ZN3JSCL27dateProtoFuncGetUTCFullYearEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSCL24dateProtoFuncGetUTCMonthEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSCL31dateProtoFuncToLocaleDateStringEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSCL16formatLocaleDateEPNS_9ExecStateEPNS_12DateInstanceEdNS_20LocaleDateTimeFormatERKNS_7ArgListE
+__ZN3JSC10throwErrorEPNS_9ExecStateENS_9ErrorTypeEPKc
+__ZN3JSCL23throwStackOverflowErrorEPNS_9ExecStateEPNS_12JSGlobalDataENS_16ReturnAddressPtrERS4_
+__ZN3JSC24createStackOverflowErrorEPNS_9ExecStateE
+__ZN3JSC12RegisterFile21releaseExcessCapacityEv
+__ZN3JSC12StringObject18getOwnPropertySlotEPNS_9ExecStateEjRNS_12PropertySlotE
+__ZN3JSC19FunctionConstructor11getCallDataERNS_8CallDataE
+__ZN7WebCore6String8fromUTF8EPKc
+__ZN3JSCL27dateProtoFuncToLocaleStringEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSC18BooleanConstructor16getConstructDataERNS_13ConstructDataE
+__ZN3JSCL31constructWithBooleanConstructorEPNS_9ExecStateEPNS_8JSObjectERKNS_7ArgListE
+__ZN3JSC16constructBooleanEPNS_9ExecStateERKNS_7ArgListE
+__ZN3JSC7JSArray11sortNumericEPNS_9ExecStateENS_7JSValueENS_8CallTypeERKNS_8CallDataE
+__ZN3JSCL22compareNumbersForQSortEPKvS1_
+__ZN3WTF6VectorIjLm16EE15reserveCapacityEm
+__ZN3JSC8JSString16getIndexSlowCaseEPNS_9ExecStateEj
+__ZN3JSCL25numberConstructorNaNValueEPNS_9ExecStateENS_7JSValueERKNS_10IdentifierE
+__ZN3JSC6JSCell3putEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueERNS_15PutPropertySlotE
+__ZN3JSC4Yarr15nondigitsCreateEv
+__ZN3JSCL7dateUTCEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZNK3JSC7ArgList2atEm
+__ZN3JSCL16mathProtoFuncTanEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZNK3JSC8JSObject16isVariableObjectEv
+__ZN7WebCore6String6insertERKS0_j
+__ZN7WebCore6String6insertEPKtjj
+__ZN7WebCore10StringImpl37createStrippingNullCharactersSlowCaseEPKtj
+__ZN3JSCL31dateProtoFuncToLocaleTimeStringEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3WTF7CString11mutableDataEv
+__ZN3WTF7CString18copyBufferIfNeededEv
+__ZN3JSCL18arrayProtoFuncSomeEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSC21DebuggerStatementNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZN3JSCL31dateProtoFuncGetUTCMillisecondsEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3WTF15ThreadConditionD1Ev
+__ZN3JSC18RegExpMatchesArray19getOwnPropertyNamesEPNS_9ExecStateERNS_17PropertyNameArrayENS_15EnumerationModeE
+__ZN3WTF6VectorIPNS0_IN3JSC10IdentifierELm64EEELm32EE14expandCapacityEm
+__ZN3JSC15DateConstructor11getCallDataERNS_8CallDataE
+__ZN3JSCL8callDateEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSCL22dateProtoFuncGetUTCDayEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSCL25arrayProtoFuncLastIndexOfEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSCL19arrayProtoFuncEveryEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSCL23callFunctionConstructorEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSCL19stringProtoFuncLinkEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSCL25dateProtoFuncToDateStringEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSC10throwErrorEPNS_9ExecStateEPNS_8JSObjectE
+__ZN3JSCL27dateProtoFuncSetUTCFullYearEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSCL24dateProtoFuncSetUTCMonthEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSCL31dateProtoFuncSetUTCMillisecondsEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN7WebCore6String6numberEx
+__ZNK3JSC17NumberConstructor9classInfoEv
+__ZNK3JSC17RegExpConstructor9classInfoEv
+__ZN3WTF9HashTableINS_6RefPtrIN7WebCore10StringImplEEESt4pairIS4_P19StaticFunctionEntryENS_18PairFirstExtractorIS8_EENS2_10Stri
+__ZN3WTF9HashTableINS_6RefPtrIN7WebCore10StringImplEEESt4pairIS4_P16StaticValueEntryENS_18PairFirstExtractorIS8_EENS2_10StringH
+__ZN3JSC16JSCallbackObjectINS_8JSObjectEE18getOwnPropertySlotEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE
+__ZN3JSC16JSCallbackObjectINS_8JSObjectEE20staticFunctionGetterEPNS_9ExecStateENS_7JSValueERKNS_10IdentifierE
+__ZN3JSC18JSCallbackFunctionC1EPNS_9ExecStateEPFPK13OpaqueJSValuePK15OpaqueJSContextPS3_S9_mPKS5_PS5_ERKNS_10IdentifierE
+__ZN3JSC18JSCallbackFunction11getCallDataERNS_8CallDataE
+__ZN3JSC18JSCallbackFunction4callEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSC6JSLock12DropAllLocksC1EPNS_9ExecStateE
+_JSValueMakeUndefined
+__ZN3JSC16JSCallbackObjectINS_8JSObjectEE17staticValueGetterEPNS_9ExecStateENS_7JSValueERKNS_10IdentifierE
+_JSValueMakeString
+__ZN3JSC18JSCallbackFunctionD1Ev
+_JSValueMakeBoolean
+_JSStringCreateWithCharacters
+_JSValueMakeNumber
+__ZN3JSC4Heap6isBusyEv
+__ZN7WebCore10StringImpl7replaceEtPS0_
+__ZNK3JSC8JSObject14isGlobalObjectEv
+__ZNK7WebCore6String5splitEtbRN3WTF6VectorIS0_Lm0EEE
+__ZN7WebCore6String6appendEt
+__ZNK3JSC7UString8toUInt32EPb
+__ZN3WTF9ByteArray6createEm
+__ZN3JSC11JSByteArrayC1EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_9StructureEEEPNS3_9ByteArrayEPKNS_9ClassInfoE
+__ZN3JSC11JSByteArrayC2EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_9StructureEEEPNS3_9ByteArrayEPKNS_9ClassInfoE
+__ZN3JSC11JSByteArray18getOwnPropertySlotEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE
+__ZN3JSC11JSByteArray3putEPNS_9ExecStateEjNS_7JSValueE
+__ZN3JSC11JSByteArray3putEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueERNS_15PutPropertySlotE
+__ZN3JSC11JSByteArray18getOwnPropertySlotEPNS_9ExecStateEjRNS_12PropertySlotE
+_cti_op_get_by_val_byte_array
+_cti_op_put_by_val_byte_array
+_JSStringGetUTF8CString
+__ZN3JSC16JSVariableObject19getOwnPropertyNamesEPNS_9ExecStateERNS_17PropertyNameArrayENS_15EnumerationModeE
+__ZNK3JSC22NativeErrorConstructor9classInfoEv
+__ZNK3JSC16JSCallbackObjectINS_8JSObjectEE9classNameEv
+__ZN3JSC6JSCell16getConstructDataERNS_13ConstructDataE
+__ZN3JSC26createNotAConstructorErrorEPNS_9ExecStateENS_7JSValueEjPNS_9CodeBlockE
+__ZNK3JSC4Heap11objectCountEv
+__ZN3JSC14JSGlobalObject12defineGetterEPNS_9ExecStateERKNS_10IdentifierEPNS_8JSObjectEj
+__ZN3JSC14JSGlobalObject12defineSetterEPNS_9ExecStateERKNS_10IdentifierEPNS_8JSObjectEj
+__ZN3JSC9Structure22getterSetterTransitionEPS0_
+__ZN3JSCL28objectProtoFuncIsPrototypeOfEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSC16JSCallbackObjectINS_8JSObjectEE11getCallDataERNS_8CallDataE
+__ZN3JSCL23arrayConstructorIsArrayEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSCL21objectConstructorKeysEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSC12DateInstanceC1EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_9StructureEEEd
+__ZN3JSC12DateInstanceC2EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_9StructureEEEd
+__ZN3JSCL24dateProtoFuncToISOStringEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSC15createTypeErrorEPNS_9ExecStateEPKc
+__ZNK3JSC11JSByteArray9classInfoEv
+__ZN3JSC11JSByteArray19getOwnPropertyNamesEPNS_9ExecStateERNS_17PropertyNameArrayENS_15EnumerationModeE
+__ZN3JSC22NativeErrorConstructor11getCallDataERNS_8CallDataE
+__ZN3JSCL36objectConstructorGetOwnPropertyNamesEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSCL41objectConstructorGetOwnPropertyDescriptorEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSC16JSVariableObject14symbolTableGetERKNS_10IdentifierERNS_18PropertyDescriptorE
+__ZN3JSC8JSObject24getOwnPropertyDescriptorEPNS_9ExecStateERKNS_10IdentifierERNS_18PropertyDescriptorE
+__ZNK3JSC18PropertyDescriptor20isAccessorDescriptorEv
+__ZNK3JSC18PropertyDescriptor8writableEv
+__ZNK3JSC18PropertyDescriptor12configurableEv
+__ZN3JSC12JSGlobalData6createENS_15ThreadStackTypeE
+__ZN3JSC12JSGlobalData10ClientDataD2Ev
+__ZN3WTF14ThreadSpecificINS_13WTFThreadDataEE7destroyEPv
+__ZN3WTF13WTFThreadDataD1Ev
+__ZN7WebCore17AtomicStringTable7destroyEPS0_
+__ZN3JSC15IdentifierTableD1Ev
+__ZN3WTF9dayInYearEdi
+__ZN3WTF18monthFromDayInYearEib
+__ZN3WTF23dayInMonthFromDayInYearEib
+__ZN3JSC6Walker4walkENS_7JSValueE
+__ZN3WTF9HashTableIPN7WebCore10StringImplES3_NS_17IdentityExtractorIS3_EENS_7PtrHashIS3_EENS_10HashTraitsIS3_EES9_EC2ERKSA_
+__ZN3WTF6VectorIPN3JSC7JSArrayELm16EE14expandCapacityEm
+__ZN3WTF6VectorIjLm16EE14expandCapacityEm
+__ZN3WTF6VectorIN3JSC11WalkerStateELm16EE14expandCapacityEm
+__ZL30makeGetterOrSetterPropertyNodePN3JSC12JSGlobalDataERKNS_10IdentifierES4_PNS_13ParameterNodeEPNS_16FunctionBodyNodeERKNS_1
+__ZN3JSC17BytecodeGenerator13emitPutGetterEPNS_10RegisterIDERKNS_10IdentifierES2_
+__ZN3JSC3JIT18emit_op_put_getterEPNS_11InstructionE
+_cti_op_put_getter
+__ZN3JSCL23booleanProtoFuncValueOfEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSCL19dateProtoFuncToJSONEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSC9ExecState9dateTableEPS0_
+__ZN3JSC10Identifier4fromEPNS_9ExecStateEd
+__ZN3JSC13StringBuilder6appendEt
+__ZN3JSC17BytecodeGenerator13emitPutSetterEPNS_10RegisterIDERKNS_10IdentifierES2_
+__ZN3JSC3JIT18emit_op_put_setterEPNS_11InstructionE
+_cti_op_put_setter
+__ZN3JSCL23objectConstructorCreateEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSCL16definePropertiesEPNS_9ExecStateEPNS_8JSObjectES3_
+__ZN3JSCL20toPropertyDescriptorEPNS_9ExecStateENS_7JSValueERNS_18PropertyDescriptorE
+__ZN3JSC18PropertyDescriptor13setEnumerableEb
+__ZN3WTF6VectorIN3JSC18PropertyDescriptorELm0EE14expandCapacityEm
+__ZNK3JSC18PropertyDescriptor16isDataDescriptorEv
+__ZN3JSC8JSObject17defineOwnPropertyEPNS_9ExecStateERKNS_10IdentifierERNS_18PropertyDescriptorEb
+__ZN3JSCL13putDescriptorEPNS_9ExecStateEPNS_8JSObjectERKNS_10IdentifierERNS_18PropertyDescriptorEjNS_7JSValueE
+__ZNK3JSC18PropertyDescriptor19isGenericDescriptorEv
+__ZN3JSCL31objectConstructorGetPrototypeOfEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSC18PropertyDescriptor9setGetterENS_7JSValueE
+__ZNK3JSC18PropertyDescriptor6getterEv
+__ZNK3JSC18PropertyDescriptor6setterEv
+__ZN3JSC18PropertyDescriptor15setConfigurableEb
+__ZN3JSC18PropertyDescriptor11setWritableEb
+__ZN3JSC18PropertyDescriptor9setSetterENS_7JSValueE
+__ZN3JSCL33objectConstructorDefinePropertiesEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZNK3JSC18PropertyDescriptor7equalToEPNS_9ExecStateERKS0_
+__ZNK3JSC18PropertyDescriptor15attributesEqualERKS0_
+__ZNK3JSC18PropertyDescriptor22attributesWithOverrideERKS0_
+__ZN3JSCL31objectConstructorDefinePropertyEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSC9ExecState11regExpTableEPS0_
+__ZN3JSC9Arguments19getOwnPropertyNamesEPNS_9ExecStateERNS_17PropertyNameArrayENS_15EnumerationModeE
+__ZN3JSC9ExecState11numberTableEPS0_
+__ZN3JSC9ExecState22regExpConstructorTableEPS0_
+__ZNK3JSC15RegExpPrototype9classInfoEv
+__ZNK3JSC10MathObject9classInfoEv
+__ZN3JSC9ExecState9mathTableEPS0_
+__ZN3JSC9ExecState9jsonTableEPS0_
+__ZN3JSCL20arrayProtoFuncReduceEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSCL25arrayProtoFuncReduceRightEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSCL28arrayProtoFuncToLocaleStringEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSC19JSStaticScopeObject3putEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueERNS_15PutPropertySlotE
+__ZN3JSCL25dateProtoFuncToTimeStringEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSC7JSValueC1EPNS_9ExecStateEd
+__ZN3JSC15DeleteValueNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZN3JSC16PostfixErrorNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZN3JSC23ThrowableExpressionData14emitThrowErrorERNS_17BytecodeGeneratorENS_9ErrorTypeEPKcRKNS_7UStringE
+__ZN3JSC10makeStringINS_7UStringES1_S1_EES1_T_T0_T1_
+__ZN3JSC13tryMakeStringINS_7UStringES1_S1_EEN3WTF10PassRefPtrIN7WebCore10StringImplEEET_T0_T1_
+__ZN3JSC15PrefixErrorNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10RegisterIDE
+__ZN3JSC23createInvalidParamErrorEPNS_9ExecStateEPKcNS_7JSValueEjPNS_9CodeBlockE
+__ZN3JSC10makeStringIPKcS2_S2_EENS_7UStringET_T0_T1_
+__ZN3JSC13tryMakeStringIPKcS2_S2_EEN3WTF10PassRefPtrIN7WebCore10StringImplEEET_T0_T1_
+__ZNK3JSC15DotAccessorNode17isDotAccessorNodeEv
+__ZNK3JSC14ExpressionNode17isDotAccessorNodeEv
+__ZN3JSC13JSNotAnObject3putEPNS_9ExecStateEjNS_7JSValueE
+__ZN3JSC14ArrayPrototype24getOwnPropertyDescriptorEPNS_9ExecStateERKNS_10IdentifierERNS_18PropertyDescriptorE
+__ZN3JSC13DatePrototype24getOwnPropertyDescriptorEPNS_9ExecStateERKNS_10IdentifierERNS_18PropertyDescriptorE
+__ZN3JSC15StringPrototype24getOwnPropertyDescriptorEPNS_9ExecStateERKNS_10IdentifierERNS_18PropertyDescriptorE
+__ZN3JSC12StringObject24getOwnPropertyDescriptorEPNS_9ExecStateERKNS_10IdentifierERNS_18PropertyDescriptorE
+__ZN3JSC8JSString27getStringPropertyDescriptorEPNS_9ExecStateERKNS_10IdentifierERNS_18PropertyDescriptorE
+__ZN3JSC17NumberConstructor24getOwnPropertyDescriptorEPNS_9ExecStateERKNS_10IdentifierERNS_18PropertyDescriptorE
+__ZN3JSC17RegExpConstructor24getOwnPropertyDescriptorEPNS_9ExecStateERKNS_10IdentifierERNS_18PropertyDescriptorE
+__ZN3JSCL22regExpConstructorInputEPNS_9ExecStateENS_7JSValueERKNS_10IdentifierE
+__ZN3JSC12RegExpObject24getOwnPropertyDescriptorEPNS_9ExecStateERKNS_10IdentifierERNS_18PropertyDescriptorE
+__ZN3JSC10MathObject24getOwnPropertyDescriptorEPNS_9ExecStateERKNS_10IdentifierERNS_18PropertyDescriptorE
+__ZN3JSC18RegExpMatchesArray24getOwnPropertyDescriptorEPNS_9ExecStateERKNS_10IdentifierERNS_18PropertyDescriptorE
+__ZN3JSC10JSFunction24getOwnPropertyDescriptorEPNS_9ExecStateERKNS_10IdentifierERNS_18PropertyDescriptorE
+__ZN3JSC11JSByteArray24getOwnPropertyDescriptorEPNS_9ExecStateERKNS_10IdentifierERNS_18PropertyDescriptorE
+__ZNK3JSC16JSCallbackObjectINS_8JSObjectEE8toStringEPNS_9ExecStateE
+__ZN3JSC10throwErrorEPNS_9ExecStateENS_9ErrorTypeERKNS_7UStringEilS5_
+__ZN3JSC17BytecodeGenerator35emitThrowExpressionTooDeepExceptionEv
+__ZN3JSCL25numberConstructorMinValueEPNS_9ExecStateENS_7JSValueERKNS_10IdentifierE
+__ZN3JSCL18mathProtoFuncATan2EPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSCL28numberProtoFuncToExponentialEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSC16parseIntOverflowEPKcii
+__ZN3JSCL29objectProtoFuncToLocaleStringEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSCL24regExpConstructorDollar5EPNS_9ExecStateENS_7JSValueERKNS_10IdentifierE
+__ZN3JSCL24regExpConstructorDollar6EPNS_9ExecStateENS_7JSValueERKNS_10IdentifierE
+__ZN3JSCL24regExpConstructorDollar7EPNS_9ExecStateENS_7JSValueERKNS_10IdentifierE
+__ZN3JSCL24regExpConstructorDollar8EPNS_9ExecStateENS_7JSValueERKNS_10IdentifierE
+__ZN3JSCL24regExpConstructorDollar9EPNS_9ExecStateENS_7JSValueERKNS_10IdentifierE
+__ZN3JSCL25setRegExpConstructorInputEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueE
+__ZN3JSCL26regExpConstructorLastMatchEPNS_9ExecStateENS_7JSValueERKNS_10IdentifierE
+__ZN3JSCL26regExpConstructorLastParenEPNS_9ExecStateENS_7JSValueERKNS_10IdentifierE
+__ZNK3JSC17RegExpConstructor12getLastParenEPNS_9ExecStateE
+__ZN3JSCL26regExpConstructorMultilineEPNS_9ExecStateENS_7JSValueERKNS_10IdentifierE
+__ZN3JSCL29setRegExpConstructorMultilineEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueE
+__ZNK3JSC17RegExpConstructor5inputEv
+__ZN3JSC10makeStringIPKcS2_EENS_7UStringET_T0_
+__ZN3JSC13tryMakeStringIPKcS2_EEN3WTF10PassRefPtrIN7WebCore10StringImplEEET_T0_
+__ZN3JSC10throwErrorEPNS_9ExecStateENS_9ErrorTypeERKNS_7UStringE
+__ZNK3JSC19JSStaticScopeObject12toThisObjectEPNS_9ExecStateE
+__ZN3JSCL23stringProtoFuncTrimLeftEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSCL24stringProtoFuncTrimRightEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSC12JSActivation18getArgumentsGetterEv
+__ZN3JSC12JSActivation15argumentsGetterEPNS_9ExecStateENS_7JSValueERKNS_10IdentifierE
+__ZN3JSCL28stringProtoFuncLocaleCompareEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3WTF8Collator11userDefaultEv
+__ZNK3WTF8Collator7collateEPKtmS2_m
+__ZNK3WTF8Collator14createCollatorEv
+__ZN3WTF8CollatorD1Ev
+__ZN3WTF8Collator15releaseCollatorEv
+__ZN3JSC9Arguments14deletePropertyEPNS_9ExecStateERKNS_10IdentifierE
+__ZN3JSCL26callNativeErrorConstructorEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSCL21callFunctionPrototypeEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3JSC6JSCell11getJSNumberEv
+__ZN3JSCL16callRegExpObjectEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
+__ZN3WTF6VectorIN3JSC20FunctionRegisterInfoELm0EE14expandCapacityEm
+__ZN3JSC3JIT25emit_op_profile_will_callEPNS_11InstructionE
+__ZN3JSC3JIT24emit_op_profile_did_callEPNS_11InstructionE
+__ZN3JSC8Profiler8profilerEv
+__ZN3JSC8Profiler14startProfilingEPNS_9ExecStateERKNS_7UStringE
+__ZN3JSC16ProfileGenerator6createERKNS_7UStringEPNS_9ExecStateEj
+__ZN3JSC16ProfileGeneratorC2ERKNS_7UStringEPNS_9ExecStateEj
+__ZN3JSC7Profile6createERKNS_7UStringEj
+__ZN3JSC7ProfileC2ERKNS_7UStringEj
+__ZN3JSC11ProfileNodeC1ERKNS_14CallIdentifierEPS0_S4_
+__ZN3JSC16ProfileGenerator24addParentForConsoleStartEPNS_9ExecStateE
+__ZN3JSC8Profiler20createCallIdentifierEPNS_9ExecStateENS_7JSValueERKNS_7UStringEi
+__ZN3JSC16InternalFunction21calculatedDisplayNameEPNS_9ExecStateE
+__ZN3JSC16InternalFunction11displayNameEPNS_9ExecStateE
+__ZN3JSC11ProfileNode10insertNodeEN3WTF10PassRefPtrIS0_EE
+__ZN3WTF6VectorINS_6RefPtrIN3JSC11ProfileNodeEEELm0EE14expandCapacityEm
+__ZN3WTF6VectorINS_6RefPtrIN3JSC16ProfileGeneratorEEELm0EE15reserveCapacityEm
+_cti_op_profile_did_call
+__ZN3JSC8Profiler10didExecuteEPNS_9ExecStateENS_7JSValueE
+__ZN3JSC16ProfileGenerator10didExecuteERKNS_14CallIdentifierE
+__ZN3JSC11ProfileNode10didExecuteEv
+_cti_op_profile_will_call
+__ZN3JSC8Profiler11willExecuteEPNS_9ExecStateENS_7JSValueE
+__ZN3JSC16ProfileGenerator11willExecuteERKNS_14CallIdentifierE
+__ZN3JSC11ProfileNode11willExecuteERKNS_14CallIdentifierE
+__ZN3JSC8Profiler13stopProfilingEPNS_9ExecStateERKNS_7UStringE
+__ZN3JSC16ProfileGenerator13stopProfilingEv
+__ZN3JSC7Profile7forEachEMNS_11ProfileNodeEFvvE
+__ZNK3JSC11ProfileNode25traverseNextNodePostOrderEv
+__ZN3JSC11ProfileNode13stopProfilingEv
+__ZN3JSC11ProfileNode11removeChildEPS0_
+__ZN3JSC11ProfileNode8addChildEN3WTF10PassRefPtrIS0_EE
+__ZN3JSC8Debugger23recompileAllJSFunctionsEPNS_12JSGlobalDataE
+__ZN3JSC4Heap16primaryHeapBeginEv
+__ZN3JSC4Heap14primaryHeapEndEv
+__ZNK3JSC18JSCallbackFunction9classInfoEv
+__ZN3WTF7HashSetIPN3JSC18FunctionExecutableENS_7PtrHashIS3_EENS_10HashTraitsIS3_EEE3addERKS3_
+__ZN3WTF9HashTableIPN3JSC18FunctionExecutableES3_NS_17IdentityExtractorIS3_EENS_7PtrHashIS3_EENS_10HashTraitsIS3_EES9_E6expandE
+__ZN3JSC18FunctionExecutable9recompileEPNS_9ExecStateE
+__ZN3JSC8Profiler11willExecuteEPNS_9ExecStateERKNS_7UStringEi
+__ZN3JSC8Profiler10didExecuteEPNS_9ExecStateERKNS_7UStringEi
+__ZNK3JSC16ProfileGenerator5titleEv
+__ZN3JSC9CodeBlock33functionRegisterForBytecodeOffsetEjRi
+__ZN3JSC7ProfileD0Ev
+__ZN3WTF10RefCountedIN3JSC11ProfileNodeEE5derefEv
+__ZN3JSC34createTerminatedExecutionExceptionEPNS_12JSGlobalDataE
+__ZNK3JSC24TerminatedExecutionError13exceptionTypeEv
+__ZN3JSC24TerminatedExecutionErrorD1Ev
+__ZN3WTF8CollatorC1EPKc
+__ZN3WTF8Collator18setOrderLowerFirstEb
+_JSValueIsEqual
+__ZN3JSC7JSValue13equalSlowCaseEPNS_9ExecStateES0_S0_
+__ZNK3JSC14JSGlobalObject17supportsProfilingEv
+__ZNK7WebCore6String12toUIntStrictEPbi
+__ZN7WebCore10StringImpl12toUIntStrictEPbi
+__ZN3WTF12randomNumberEv
+__ZNK7WebCore6String8toUInt64EPb
+__ZN7WebCore10StringImpl8toUInt64EPb
+__ZN7WebCore18charactersToUInt64EPKtmPb
+_JSStringGetMaximumUTF8CStringSize
+__ZN3JSC16JSCallbackObjectINS_8JSObjectEE3putEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueERNS_15PutPropertySlotE
+__ZN7WebCore6String6numberEm
+__ZN3JSC4Heap17globalObjectCountEv
+__ZN3JSC4Heap20protectedObjectCountEv
+__ZN3JSC4Heap25protectedObjectTypeCountsEv
+__ZN3WTF9HashTableIPKcSt4pairIS2_jENS_18PairFirstExtractorIS4_EENS_7PtrHashIS2_EENS_14PairHashTraitsINS_10HashTraitsIS2_EENSA_I
+__ZNK3JSC6JSCell17isAPIValueWrapperEv
+__ZNK3JSC6JSCell22isPropertyNameIteratorEv
+__ZN3JSC4Heap16objectTypeCountsEv
+__ZNK3JSC22JSPropertyNameIterator22isPropertyNameIteratorEv
+__ZN3WTF20fastMallocStatisticsEv
+__ZNK3JSC4Heap10statisticsEv
+__ZN3WTF27releaseFastMallocFreeMemoryEv
+_JSStringIsEqualToUTF8CString
+__ZN3JSC16JSCallbackObjectINS_8JSObjectEE14callbackGetterEPNS_9ExecStateENS_7JSValueERKNS_10IdentifierE
+_JSObjectSetPrivate
+__ZN3JSC8Debugger6attachEPNS_14JSGlobalObjectE
+__ZN3WTF9HashTableIPN3JSC14JSGlobalObjectES3_NS_17IdentityExtractorIS3_EENS_7PtrHashIS3_EENS_10HashTraitsIS3_EES9_E6rehashEi
+__ZN3WTF9HashTableIPN3JSC14SourceProviderESt4pairIS3_PNS1_9ExecStateEENS_18PairFirstExtractorIS7_EENS_7PtrHashIS3_EENS_14PairHa
+__ZN3JSC7UString4fromEl
+__ZN3JSC3JIT13emit_op_debugEPNS_11InstructionE
+_cti_op_debug
+__ZN3JSC11Interpreter5debugEPNS_9ExecStateENS_11DebugHookIDEii
+__ZNK3JSC17DebuggerCallFrame4typeEv
+__ZNK3JSC17DebuggerCallFrame22calculatedFunctionNameEv
+__ZNK3JSC12JSActivation18isActivationObjectEv
+__ZNK3JSC17DebuggerCallFrame10thisObjectEv
+__ZN3WTF28setMainThreadCallbacksPausedEb
+__ZNK3JSC17DebuggerCallFrame8evaluateERKNS_7UStringERNS_7JSValueE
+__ZN3JSC8Debugger6detachEPNS_14JSGlobalObjectE
+_JSValueIsObjectOfClass
diff --git a/Source/JavaScriptCore/JavaScriptCore.pri b/Source/JavaScriptCore/JavaScriptCore.pri
new file mode 100644
index 0000000..222f664
--- /dev/null
+++ b/Source/JavaScriptCore/JavaScriptCore.pri
@@ -0,0 +1,111 @@
+# JavaScriptCore - Qt4 build info
+
+include(../../common.pri)
+
+VPATH += $$PWD
+
+# Use a config-specific target to prevent parallel builds file clashes on Mac
+mac: CONFIG(debug, debug|release): JAVASCRIPTCORE_TARGET = jscored
+else: JAVASCRIPTCORE_TARGET = jscore
+
+# Output in JavaScriptCore/<config>
+CONFIG(debug, debug|release) : JAVASCRIPTCORE_DESTDIR = debug
+else: JAVASCRIPTCORE_DESTDIR = release
+
+CONFIG(standalone_package) {
+ isEmpty(JSC_GENERATED_SOURCES_DIR):JSC_GENERATED_SOURCES_DIR = $$PWD/generated
+} else {
+ isEmpty(JSC_GENERATED_SOURCES_DIR):JSC_GENERATED_SOURCES_DIR = generated
+}
+
+CONFIG(standalone_package): DEFINES *= NDEBUG
+
+JAVASCRIPTCORE_INCLUDEPATH = \
+ $$PWD \
+ $$PWD/.. \
+ $$PWD/../.. \ # FIXME: Remove this include once we finish moving the source to Source
+ $$PWD/assembler \
+ $$PWD/bytecode \
+ $$PWD/bytecompiler \
+ $$PWD/debugger \
+ $$PWD/interpreter \
+ $$PWD/jit \
+ $$PWD/parser \
+ $$PWD/pcre \
+ $$PWD/profiler \
+ $$PWD/runtime \
+ $$PWD/wtf \
+ $$PWD/wtf/gobject \
+ $$PWD/wtf/symbian \
+ $$PWD/wtf/unicode \
+ $$PWD/yarr \
+ $$PWD/API \
+ $$PWD/ForwardingHeaders \
+ $$JSC_GENERATED_SOURCES_DIR
+
+symbian {
+ PREPEND_INCLUDEPATH = $$JAVASCRIPTCORE_INCLUDEPATH $$PREPEND_INCLUDEPATH
+} else {
+ INCLUDEPATH = $$JAVASCRIPTCORE_INCLUDEPATH $$INCLUDEPATH
+}
+
+symbian: {
+ LIBS += -lhal
+ # For hal.h
+ INCLUDEPATH *= $$MW_LAYER_SYSTEMINCLUDE
+}
+
+win32-*: DEFINES += _HAS_TR1=0
+
+DEFINES += BUILDING_JavaScriptCore BUILDING_WTF
+
+# CONFIG += text_breaking_with_icu
+
+contains (CONFIG, text_breaking_with_icu) {
+ DEFINES += WTF_USE_QT_ICU_TEXT_BREAKING=1
+}
+
+wince* {
+ INCLUDEPATH += $$QT_SOURCE_TREE/src/3rdparty/ce-compat
+ INCLUDEPATH += $$PWD/../JavaScriptCore/os-win32
+}
+
+
+defineTest(addJavaScriptCoreLib) {
+ # Argument is the relative path to JavaScriptCore.pro's qmake output
+ pathToJavaScriptCoreOutput = $$ARGS/$$JAVASCRIPTCORE_DESTDIR
+
+ win32-msvc*|wince* {
+ LIBS += -L$$pathToJavaScriptCoreOutput
+ LIBS += -l$$JAVASCRIPTCORE_TARGET
+ POST_TARGETDEPS += $${pathToJavaScriptCoreOutput}$${QMAKE_DIR_SEP}$${JAVASCRIPTCORE_TARGET}.lib
+ } else:symbian {
+ LIBS += -l$${JAVASCRIPTCORE_TARGET}.lib
+ # The default symbian build system does not use library paths at all. However when building with
+ # qmake's symbian makespec that uses Makefiles
+ QMAKE_LIBDIR += $$pathToJavaScriptCoreOutput
+ POST_TARGETDEPS += $${pathToJavaScriptCoreOutput}$${QMAKE_DIR_SEP}$${JAVASCRIPTCORE_TARGET}.lib
+ } else {
+ # Make sure jscore will be early in the list of libraries to workaround a bug in MinGW
+ # that can't resolve symbols from QtCore if libjscore comes after.
+ QMAKE_LIBDIR = $$pathToJavaScriptCoreOutput $$QMAKE_LIBDIR
+ LIBS += -l$$JAVASCRIPTCORE_TARGET
+ POST_TARGETDEPS += $${pathToJavaScriptCoreOutput}$${QMAKE_DIR_SEP}lib$${JAVASCRIPTCORE_TARGET}.a
+ }
+
+ win32-* {
+ LIBS += -lwinmm
+ }
+
+ # The following line is to prevent qmake from adding jscore to libQtWebKit's prl dependencies.
+ # The compromise we have to accept by disabling explicitlib is to drop support to link QtWebKit and QtScript
+ # statically in applications (which isn't used often because, among other things, of licensing obstacles).
+ CONFIG -= explicitlib
+
+ export(QMAKE_LIBDIR)
+ export(LIBS)
+ export(POST_TARGETDEPS)
+ export(CONFIG)
+
+ return(true)
+}
diff --git a/Source/JavaScriptCore/JavaScriptCore.pro b/Source/JavaScriptCore/JavaScriptCore.pro
new file mode 100644
index 0000000..86b1b9a
--- /dev/null
+++ b/Source/JavaScriptCore/JavaScriptCore.pro
@@ -0,0 +1,226 @@
+# JavaScriptCore - qmake build info
+CONFIG += building-libs
+include($$PWD/../../WebKit.pri)
+include(JavaScriptCore.pri)
+
+TEMPLATE = lib
+CONFIG += staticlib
+# Don't use JavaScriptCore as the target name. qmake would create a JavaScriptCore.vcproj for msvc
+# which already exists as a directory
+TARGET = $$JAVASCRIPTCORE_TARGET
+DESTDIR = $$JAVASCRIPTCORE_DESTDIR
+QT += core
+QT -= gui
+
+CONFIG += depend_includepath
+
+contains(QT_CONFIG, embedded):CONFIG += embedded
+
+CONFIG(QTDIR_build) {
+ # Make sure we compile both debug and release on mac when inside Qt.
+ # This line was extracted from qbase.pri instead of including the whole file
+ win32|mac:!macx-xcode:CONFIG += debug_and_release
+} else {
+ !CONFIG(release, debug|release) {
+ OBJECTS_DIR = obj/debug
+ } else { # Release
+ OBJECTS_DIR = obj/release
+ }
+ # Make sure that build_all follows the build_all config in WebCore
+ mac:contains(QT_CONFIG, qt_framework):!CONFIG(webkit_no_framework):!build_pass:CONFIG += build_all
+}
+
+# WebCore adds these config only when in a standalone build.
+# qbase.pri takes care of that when in a QTDIR_build
+# Here we add the config for both cases since we don't include qbase.pri
+contains(QT_CONFIG, reduce_exports):CONFIG += hide_symbols
+unix:contains(QT_CONFIG, reduce_relocations):CONFIG += bsymbolic_functions
+
+CONFIG(QTDIR_build) {
+ # Remove the following 2 lines if you want debug information in JavaScriptCore
+ CONFIG -= separate_debug_info
+ CONFIG += no_debug_info
+}
+
+# Pick up 3rdparty libraries from INCLUDE/LIB just like with MSVC
+win32-g++* {
+ TMPPATH = $$quote($$(INCLUDE))
+ QMAKE_INCDIR_POST += $$split(TMPPATH,";")
+ TMPPATH = $$quote($$(LIB))
+ QMAKE_LIBDIR_POST += $$split(TMPPATH,";")
+}
+
+*-g++*:QMAKE_CXXFLAGS_RELEASE -= -O2
+*-g++*:QMAKE_CXXFLAGS_RELEASE += -O3
+
+# Rules when JIT enabled (not disabled)
+!contains(DEFINES, ENABLE_JIT=0) {
+ linux*-g++*:greaterThan(QT_GCC_MAJOR_VERSION,3):greaterThan(QT_GCC_MINOR_VERSION,0) {
+ QMAKE_CXXFLAGS += -fno-stack-protector
+ QMAKE_CFLAGS += -fno-stack-protector
+ }
+}
+
+wince* {
+ SOURCES += $$QT_SOURCE_TREE/src/3rdparty/ce-compat/ce_time.c
+}
+
+include(pcre/pcre.pri)
+include(wtf/wtf.pri)
+
+INSTALLDEPS += all
+
+SOURCES += \
+ API/JSBase.cpp \
+ API/JSCallbackConstructor.cpp \
+ API/JSCallbackFunction.cpp \
+ API/JSCallbackObject.cpp \
+ API/JSClassRef.cpp \
+ API/JSContextRef.cpp \
+ API/JSObjectRef.cpp \
+ API/JSStringRef.cpp \
+ API/JSValueRef.cpp \
+ API/OpaqueJSString.cpp \
+ assembler/ARMAssembler.cpp \
+ assembler/ARMv7Assembler.cpp \
+ assembler/MacroAssemblerARM.cpp \
+ bytecode/CodeBlock.cpp \
+ bytecode/JumpTable.cpp \
+ bytecode/Opcode.cpp \
+ bytecode/SamplingTool.cpp \
+ bytecode/StructureStubInfo.cpp \
+ bytecompiler/BytecodeGenerator.cpp \
+ bytecompiler/NodesCodegen.cpp \
+ debugger/DebuggerActivation.cpp \
+ debugger/DebuggerCallFrame.cpp \
+ debugger/Debugger.cpp \
+ interpreter/CallFrame.cpp \
+ interpreter/Interpreter.cpp \
+ interpreter/RegisterFile.cpp \
+ jit/ExecutableAllocatorFixedVMPool.cpp \
+ jit/ExecutableAllocator.cpp \
+ jit/JITArithmetic.cpp \
+ jit/JITArithmetic32_64.cpp \
+ jit/JITCall.cpp \
+ jit/JITCall32_64.cpp \
+ jit/JIT.cpp \
+ jit/JITOpcodes.cpp \
+ jit/JITOpcodes32_64.cpp \
+ jit/JITPropertyAccess.cpp \
+ jit/JITPropertyAccess32_64.cpp \
+ jit/JITStubs.cpp \
+ jit/ThunkGenerators.cpp \
+ parser/JSParser.cpp \
+ parser/Lexer.cpp \
+ parser/Nodes.cpp \
+ parser/ParserArena.cpp \
+ parser/Parser.cpp \
+ profiler/Profile.cpp \
+ profiler/ProfileGenerator.cpp \
+ profiler/ProfileNode.cpp \
+ profiler/Profiler.cpp \
+ runtime/ArgList.cpp \
+ runtime/Arguments.cpp \
+ runtime/ArrayConstructor.cpp \
+ runtime/ArrayPrototype.cpp \
+ runtime/BooleanConstructor.cpp \
+ runtime/BooleanObject.cpp \
+ runtime/BooleanPrototype.cpp \
+ runtime/CallData.cpp \
+ runtime/Collector.cpp \
+ runtime/CommonIdentifiers.cpp \
+ runtime/Completion.cpp \
+ runtime/ConstructData.cpp \
+ runtime/DateConstructor.cpp \
+ runtime/DateConversion.cpp \
+ runtime/DateInstance.cpp \
+ runtime/DatePrototype.cpp \
+ runtime/ErrorConstructor.cpp \
+ runtime/Error.cpp \
+ runtime/ErrorInstance.cpp \
+ runtime/ErrorPrototype.cpp \
+ runtime/ExceptionHelpers.cpp \
+ runtime/Executable.cpp \
+ runtime/FunctionConstructor.cpp \
+ runtime/FunctionPrototype.cpp \
+ runtime/GCActivityCallback.cpp \
+ runtime/GCHandle.cpp \
+ runtime/GetterSetter.cpp \
+ runtime/GlobalEvalFunction.cpp \
+ runtime/Identifier.cpp \
+ runtime/InitializeThreading.cpp \
+ runtime/InternalFunction.cpp \
+ runtime/JSActivation.cpp \
+ runtime/JSAPIValueWrapper.cpp \
+ runtime/JSArray.cpp \
+ runtime/JSByteArray.cpp \
+ runtime/JSCell.cpp \
+ runtime/JSFunction.cpp \
+ runtime/JSGlobalData.cpp \
+ runtime/JSGlobalObject.cpp \
+ runtime/JSGlobalObjectFunctions.cpp \
+ runtime/JSImmediate.cpp \
+ runtime/JSLock.cpp \
+ runtime/JSNotAnObject.cpp \
+ runtime/JSNumberCell.cpp \
+ runtime/JSObject.cpp \
+ runtime/JSObjectWithGlobalObject.cpp \
+ runtime/JSONObject.cpp \
+ runtime/JSPropertyNameIterator.cpp \
+ runtime/JSStaticScopeObject.cpp \
+ runtime/JSString.cpp \
+ runtime/JSValue.cpp \
+ runtime/JSVariableObject.cpp \
+ runtime/JSWrapperObject.cpp \
+ runtime/LiteralParser.cpp \
+ runtime/Lookup.cpp \
+ runtime/MarkStackPosix.cpp \
+ runtime/MarkStackSymbian.cpp \
+ runtime/MarkStackWin.cpp \
+ runtime/MarkStack.cpp \
+ runtime/MathObject.cpp \
+ runtime/NativeErrorConstructor.cpp \
+ runtime/NativeErrorPrototype.cpp \
+ runtime/NumberConstructor.cpp \
+ runtime/NumberObject.cpp \
+ runtime/NumberPrototype.cpp \
+ runtime/ObjectConstructor.cpp \
+ runtime/ObjectPrototype.cpp \
+ runtime/Operations.cpp \
+ runtime/PropertyDescriptor.cpp \
+ runtime/PropertyNameArray.cpp \
+ runtime/PropertySlot.cpp \
+ runtime/PrototypeFunction.cpp \
+ runtime/RegExpConstructor.cpp \
+ runtime/RegExp.cpp \
+ runtime/RegExpObject.cpp \
+ runtime/RegExpPrototype.cpp \
+ runtime/RegExpCache.cpp \
+ runtime/RopeImpl.cpp \
+ runtime/ScopeChain.cpp \
+ runtime/SmallStrings.cpp \
+ runtime/StrictEvalActivation.cpp \
+ runtime/StringConstructor.cpp \
+ runtime/StringObject.cpp \
+ runtime/StringPrototype.cpp \
+ runtime/StructureChain.cpp \
+ runtime/Structure.cpp \
+ runtime/TimeoutChecker.cpp \
+ runtime/UString.cpp \
+ yarr/RegexPattern.cpp \
+ yarr/RegexInterpreter.cpp \
+ yarr/RegexJIT.cpp
+
+# Generated files, simply list them for JavaScriptCore
+
+symbian: {
+ symbian-abld|symbian-sbsv2 {
+ MMP_RULES += ALWAYS_BUILD_AS_ARM
+ } else {
+ QMAKE_CFLAGS -= --thumb
+ QMAKE_CXXFLAGS -= --thumb
+ }
+ QMAKE_CXXFLAGS.ARMCC += -OTime -O3
+}
+# Disable C++0x mode in JSC for those who enabled it in their Qt's mkspec
+*-g++*:QMAKE_CXXFLAGS -= -std=c++0x -std=gnu++0x
diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore.make b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore.make
new file mode 100644
index 0000000..1f83397
--- /dev/null
+++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore.make
@@ -0,0 +1,38 @@
+!IF !defined(BUILDSTYLE)
+BUILDSTYLE=Release
+!ELSEIF "$(BUILDSTYLE)"=="DEBUG"
+BUILDSTYLE=Debug_All
+!ENDIF
+
+install:
+ set PRODUCTION=1
+ set WebKitLibrariesDir=$(SRCROOT)\AppleInternal
+ set WebKitOutputDir=$(OBJROOT)
+ set ConfigurationBuildDir=$(OBJROOT)\$(BUILDSTYLE)
+ set WebKitVSPropsRedirectionDir=$(SRCROOT)\AppleInternal\tools\vsprops\OpenSource\1\2\3\
+!IF "$(BUILDSTYLE)"=="Release"
+ BUILDSTYLE=Release_PGO
+ devenv "JavaScriptCoreSubmit.sln" /rebuild $(BUILDSTYLE)
+ set PATH=$(SYSTEMDRIVE)\cygwin\bin;$(PATH)
+ xcopy "$(SRCROOT)\AppleInternal\tests\SunSpider\*" "$(ConfigurationBuildDir)\tests\SunSpider" /e/v/i/h/y
+ cd "$(ConfigurationBuildDir)\tests\SunSpider"
+ perl sunspider --shell ../../bin/jsc.exe --runs 3
+ del "$(ConfigurationBuildDir)\bin\JavaScriptCore.dll"
+ cd "$(SRCROOT)\JavaScriptCore.vcproj"
+ devenv "JavaScriptCoreSubmit.sln" /build Release_PGO_Optimize
+!ELSE
+ devenv "JavaScriptCoreSubmit.sln" /rebuild $(BUILDSTYLE)
+!ENDIF
+ -xcopy "$(ConfigurationBuildDir)\bin\JavaScriptCore.dll" "$(DSTROOT)\AppleInternal\bin\" /e/v/i/h/y
+ -xcopy "$(ConfigurationBuildDir)\bin\JavaScriptCore_debug.dll" "$(DSTROOT)\AppleInternal\bin\" /e/v/i/h/y
+ -xcopy "$(ConfigurationBuildDir)\bin\JavaScriptCore.pdb" "$(DSTROOT)\AppleInternal\bin\" /e/v/i/h/y
+ -xcopy "$(ConfigurationBuildDir)\bin\JavaScriptCore_debug.pdb" "$(DSTROOT)\AppleInternal\bin\" /e/v/i/h/y
+ -xcopy "$(ConfigurationBuildDir)\bin\jsc.exe" "$(DSTROOT)\AppleInternal\bin\" /e/v/i/h/y
+ -xcopy "$(ConfigurationBuildDir)\bin\jsc_debug.exe" "$(DSTROOT)\AppleInternal\bin\" /e/v/i/h/y
+ -xcopy "$(ConfigurationBuildDir)\bin\jsc.pdb" "$(DSTROOT)\AppleInternal\bin\" /e/v/i/h/y
+ -xcopy "$(ConfigurationBuildDir)\bin\jsc_debug.pdb" "$(DSTROOT)\AppleInternal\bin\" /e/v/i/h/y
+ xcopy "$(ConfigurationBuildDir)\include\*" "$(DSTROOT)\AppleInternal\include\" /e/v/i/h/y
+ xcopy "$(ConfigurationBuildDir)\lib\*" "$(DSTROOT)\AppleInternal\lib\" /e/v/i/h/y
+ xcopy "$(ConfigurationBuildDir)\bin\JavaScriptCore.resources\*" "$(DSTROOT)\AppleInternal\bin\JavaScriptCore.resources" /e/v/i/h/y
+ -mkdir "$(DSTROOT)\AppleInternal\Sources\JavaScriptCore"
+ xcopy "$(ConfigurationBuildDir)\obj\JavaScriptCore\DerivedSources\*" "$(DSTROOT)\AppleInternal\Sources\JavaScriptCore" /e/v/i/h/y
diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore.resources/Info.plist b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore.resources/Info.plist
new file mode 100644
index 0000000..7de8638
--- /dev/null
+++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore.resources/Info.plist
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleExecutable</key>
+ <string>JavaScriptCore</string>
+ <key>CFBundleGetInfoString</key>
+ <string>530, Copyright 2003-2010 Apple Inc.</string>
+ <key>CFBundleIdentifier</key>
+ <string>com.apple.JavaScriptCore</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>JavaScriptCore</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>530</string>
+ <key>CFBundleVersion</key>
+ <string>530</string>
+</dict>
+</plist>
diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore.sln b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore.sln
new file mode 100644
index 0000000..a4832ed
--- /dev/null
+++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore.sln
@@ -0,0 +1,95 @@
+
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual Studio 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "JavaScriptCore", "JavaScriptCore\JavaScriptCore.vcproj", "{011D10F1-B656-4A1B-A0C3-3842F02122C5}"
+ ProjectSection(ProjectDependencies) = postProject
+ {4FF5BA11-59EC-4C24-8F52-F235C2E7D43A} = {4FF5BA11-59EC-4C24-8F52-F235C2E7D43A}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "jsc", "jsc\jsc.vcproj", "{C59E5129-B453-49B7-A52B-1E104715F76E}"
+ ProjectSection(ProjectDependencies) = postProject
+ {AA8A5A85-592B-4357-BC60-E0E91E026AF6} = {AA8A5A85-592B-4357-BC60-E0E91E026AF6}
+ {011D10F1-B656-4A1B-A0C3-3842F02122C5} = {011D10F1-B656-4A1B-A0C3-3842F02122C5}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WTF", "WTF\WTF.vcproj", "{AA8A5A85-592B-4357-BC60-E0E91E026AF6}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FindSafari", "..\..\..\Tools\FindSafari\FindSafari.vcproj", "{DA31DA52-6675-48D4-89E0-333A7144397C}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "JavaScriptCoreGenerated", "JavaScriptCore\JavaScriptCoreGenerated.vcproj", "{4FF5BA11-59EC-4C24-8F52-F235C2E7D43A}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug_All|Win32 = Debug_All|Win32
+ Debug|Win32 = Debug|Win32
+ Release_LTCG|Win32 = Release_LTCG|Win32
+ Release_PGO_Optimize|Win32 = Release_PGO_Optimize|Win32
+ Release_PGO|Win32 = Release_PGO|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {011D10F1-B656-4A1B-A0C3-3842F02122C5}.Debug_All|Win32.ActiveCfg = Debug_All|Win32
+ {011D10F1-B656-4A1B-A0C3-3842F02122C5}.Debug_All|Win32.Build.0 = Debug_All|Win32
+ {011D10F1-B656-4A1B-A0C3-3842F02122C5}.Debug|Win32.ActiveCfg = Debug|Win32
+ {011D10F1-B656-4A1B-A0C3-3842F02122C5}.Debug|Win32.Build.0 = Debug|Win32
+ {011D10F1-B656-4A1B-A0C3-3842F02122C5}.Release_LTCG|Win32.ActiveCfg = Release_LTCG|Win32
+ {011D10F1-B656-4A1B-A0C3-3842F02122C5}.Release_LTCG|Win32.Build.0 = Release_LTCG|Win32
+ {011D10F1-B656-4A1B-A0C3-3842F02122C5}.Release_PGO_Optimize|Win32.ActiveCfg = Release_PGO_Optimize|Win32
+ {011D10F1-B656-4A1B-A0C3-3842F02122C5}.Release_PGO_Optimize|Win32.Build.0 = Release_PGO_Optimize|Win32
+ {011D10F1-B656-4A1B-A0C3-3842F02122C5}.Release_PGO|Win32.ActiveCfg = Release_PGO|Win32
+ {011D10F1-B656-4A1B-A0C3-3842F02122C5}.Release_PGO|Win32.Build.0 = Release_PGO|Win32
+ {011D10F1-B656-4A1B-A0C3-3842F02122C5}.Release|Win32.ActiveCfg = Release|Win32
+ {011D10F1-B656-4A1B-A0C3-3842F02122C5}.Release|Win32.Build.0 = Release|Win32
+ {C59E5129-B453-49B7-A52B-1E104715F76E}.Debug_All|Win32.ActiveCfg = Debug_All|Win32
+ {C59E5129-B453-49B7-A52B-1E104715F76E}.Debug_All|Win32.Build.0 = Debug_All|Win32
+ {C59E5129-B453-49B7-A52B-1E104715F76E}.Debug|Win32.ActiveCfg = Debug|Win32
+ {C59E5129-B453-49B7-A52B-1E104715F76E}.Debug|Win32.Build.0 = Debug|Win32
+ {C59E5129-B453-49B7-A52B-1E104715F76E}.Release_LTCG|Win32.ActiveCfg = Release_LTCG|Win32
+ {C59E5129-B453-49B7-A52B-1E104715F76E}.Release_LTCG|Win32.Build.0 = Release_LTCG|Win32
+ {C59E5129-B453-49B7-A52B-1E104715F76E}.Release_PGO_Optimize|Win32.ActiveCfg = Release_PGO|Win32
+ {C59E5129-B453-49B7-A52B-1E104715F76E}.Release_PGO_Optimize|Win32.Build.0 = Release_PGO|Win32
+ {C59E5129-B453-49B7-A52B-1E104715F76E}.Release_PGO|Win32.ActiveCfg = Release_PGO|Win32
+ {C59E5129-B453-49B7-A52B-1E104715F76E}.Release_PGO|Win32.Build.0 = Release_PGO|Win32
+ {C59E5129-B453-49B7-A52B-1E104715F76E}.Release|Win32.ActiveCfg = Release|Win32
+ {C59E5129-B453-49B7-A52B-1E104715F76E}.Release|Win32.Build.0 = Release|Win32
+ {AA8A5A85-592B-4357-BC60-E0E91E026AF6}.Debug_All|Win32.ActiveCfg = Debug_All|Win32
+ {AA8A5A85-592B-4357-BC60-E0E91E026AF6}.Debug_All|Win32.Build.0 = Debug_All|Win32
+ {AA8A5A85-592B-4357-BC60-E0E91E026AF6}.Debug|Win32.ActiveCfg = Debug|Win32
+ {AA8A5A85-592B-4357-BC60-E0E91E026AF6}.Debug|Win32.Build.0 = Debug|Win32
+ {AA8A5A85-592B-4357-BC60-E0E91E026AF6}.Release_LTCG|Win32.ActiveCfg = Release_LTCG|Win32
+ {AA8A5A85-592B-4357-BC60-E0E91E026AF6}.Release_LTCG|Win32.Build.0 = Release_LTCG|Win32
+ {AA8A5A85-592B-4357-BC60-E0E91E026AF6}.Release_PGO_Optimize|Win32.ActiveCfg = Release_PGO|Win32
+ {AA8A5A85-592B-4357-BC60-E0E91E026AF6}.Release_PGO_Optimize|Win32.Build.0 = Release_PGO|Win32
+ {AA8A5A85-592B-4357-BC60-E0E91E026AF6}.Release_PGO|Win32.ActiveCfg = Release_PGO|Win32
+ {AA8A5A85-592B-4357-BC60-E0E91E026AF6}.Release_PGO|Win32.Build.0 = Release_PGO|Win32
+ {AA8A5A85-592B-4357-BC60-E0E91E026AF6}.Release|Win32.ActiveCfg = Release|Win32
+ {AA8A5A85-592B-4357-BC60-E0E91E026AF6}.Release|Win32.Build.0 = Release|Win32
+ {DA31DA52-6675-48D4-89E0-333A7144397C}.Debug_All|Win32.ActiveCfg = Debug_All|Win32
+ {DA31DA52-6675-48D4-89E0-333A7144397C}.Debug_All|Win32.Build.0 = Debug_All|Win32
+ {DA31DA52-6675-48D4-89E0-333A7144397C}.Debug|Win32.ActiveCfg = Debug|Win32
+ {DA31DA52-6675-48D4-89E0-333A7144397C}.Debug|Win32.Build.0 = Debug|Win32
+ {DA31DA52-6675-48D4-89E0-333A7144397C}.Release_LTCG|Win32.ActiveCfg = Release_LTCG|Win32
+ {DA31DA52-6675-48D4-89E0-333A7144397C}.Release_LTCG|Win32.Build.0 = Release_LTCG|Win32
+ {DA31DA52-6675-48D4-89E0-333A7144397C}.Release_PGO_Optimize|Win32.ActiveCfg = Release_PGO|Win32
+ {DA31DA52-6675-48D4-89E0-333A7144397C}.Release_PGO_Optimize|Win32.Build.0 = Release_PGO|Win32
+ {DA31DA52-6675-48D4-89E0-333A7144397C}.Release_PGO|Win32.ActiveCfg = Release_PGO|Win32
+ {DA31DA52-6675-48D4-89E0-333A7144397C}.Release_PGO|Win32.Build.0 = Release_PGO|Win32
+ {DA31DA52-6675-48D4-89E0-333A7144397C}.Release|Win32.ActiveCfg = Release|Win32
+ {DA31DA52-6675-48D4-89E0-333A7144397C}.Release|Win32.Build.0 = Release|Win32
+ {4FF5BA11-59EC-4C24-8F52-F235C2E7D43A}.Debug_All|Win32.ActiveCfg = Debug_All|Win32
+ {4FF5BA11-59EC-4C24-8F52-F235C2E7D43A}.Debug_All|Win32.Build.0 = Debug_All|Win32
+ {4FF5BA11-59EC-4C24-8F52-F235C2E7D43A}.Debug|Win32.ActiveCfg = Debug|Win32
+ {4FF5BA11-59EC-4C24-8F52-F235C2E7D43A}.Debug|Win32.Build.0 = Debug|Win32
+ {4FF5BA11-59EC-4C24-8F52-F235C2E7D43A}.Release_LTCG|Win32.ActiveCfg = Release_LTCG|Win32
+ {4FF5BA11-59EC-4C24-8F52-F235C2E7D43A}.Release_LTCG|Win32.Build.0 = Release_LTCG|Win32
+ {4FF5BA11-59EC-4C24-8F52-F235C2E7D43A}.Release_PGO_Optimize|Win32.ActiveCfg = Release_PGO|Win32
+ {4FF5BA11-59EC-4C24-8F52-F235C2E7D43A}.Release_PGO_Optimize|Win32.Build.0 = Release_PGO|Win32
+ {4FF5BA11-59EC-4C24-8F52-F235C2E7D43A}.Release_PGO|Win32.ActiveCfg = Release_PGO|Win32
+ {4FF5BA11-59EC-4C24-8F52-F235C2E7D43A}.Release_PGO|Win32.Build.0 = Release_PGO|Win32
+ {4FF5BA11-59EC-4C24-8F52-F235C2E7D43A}.Release|Win32.ActiveCfg = Release|Win32
+ {4FF5BA11-59EC-4C24-8F52-F235C2E7D43A}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def
new file mode 100644
index 0000000..4ddad24
--- /dev/null
+++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def
@@ -0,0 +1,361 @@
+EXPORTS
+
+ ??0CString@WTF@@QAE@PBD@Z
+ ??0CString@WTF@@QAE@PBDI@Z
+ ??0Collator@WTF@@QAE@PBD@Z
+ ??0DateInstance@JSC@@QAE@PAVExecState@1@N@Z
+ ??0DateInstance@JSC@@QAE@PAVExecState@1@V?$NonNullPassRefPtr@VStructure@JSC@@@WTF@@N@Z
+ ??0DefaultGCActivityCallback@JSC@@QAE@PAVHeap@1@@Z
+ ??0DropAllLocks@JSLock@JSC@@QAE@W4JSLockBehavior@2@@Z
+ ??0DynamicGlobalObjectScope@JSC@@QAE@PAVExecState@1@PAVJSGlobalObject@1@@Z
+ ??0InternalFunction@JSC@@IAE@PAVJSGlobalData@1@PAVJSGlobalObject@1@V?$NonNullPassRefPtr@VStructure@JSC@@@WTF@@ABVIdentifier@1@@Z
+ ??0JSArray@JSC@@QAE@V?$NonNullPassRefPtr@VStructure@JSC@@@WTF@@@Z
+ ??0JSArray@JSC@@QAE@V?$NonNullPassRefPtr@VStructure@JSC@@@WTF@@ABVArgList@1@@Z
+ ??0JSByteArray@JSC@@QAE@PAVExecState@1@V?$NonNullPassRefPtr@VStructure@JSC@@@WTF@@PAVByteArray@4@PBUClassInfo@1@@Z
+ ??0JSFunction@JSC@@QAE@PAVExecState@1@PAVJSGlobalObject@1@V?$NonNullPassRefPtr@VStructure@JSC@@@WTF@@HABVIdentifier@1@P6I_J0@Z@Z
+ ??0JSObjectWithGlobalObject@JSC@@IAE@PAVJSGlobalObject@1@V?$NonNullPassRefPtr@VStructure@JSC@@@WTF@@@Z
+ ??0MD5@WTF@@QAE@XZ
+ ??0Mutex@WTF@@QAE@XZ
+ ??0PrototypeFunction@JSC@@QAE@PAVExecState@1@PAVJSGlobalObject@1@V?$NonNullPassRefPtr@VStructure@JSC@@@WTF@@HABVIdentifier@1@P6I_J0@Z@Z
+ ??0RefCountedLeakCounter@WTF@@QAE@PBD@Z
+ ??0RegExpObject@JSC@@QAE@PAVJSGlobalObject@1@V?$NonNullPassRefPtr@VStructure@JSC@@@WTF@@V?$NonNullPassRefPtr@VRegExp@JSC@@@4@@Z
+ ??0StringObject@JSC@@QAE@PAVExecState@1@V?$NonNullPassRefPtr@VStructure@JSC@@@WTF@@ABVUString@1@@Z
+ ??0Structure@JSC@@AAE@VJSValue@1@ABVTypeInfo@1@I@Z
+ ??0ThreadCondition@WTF@@QAE@XZ
+ ??0UString@JSC@@QAE@PBD@Z
+ ??0UString@JSC@@QAE@PBDI@Z
+ ??0UString@JSC@@QAE@PB_WI@Z
+ ??0WTFThreadData@WTF@@QAE@XZ
+ ??1ClientData@JSGlobalData@JSC@@UAE@XZ
+ ??1Collator@WTF@@QAE@XZ
+ ??1Debugger@JSC@@UAE@XZ
+ ??1DropAllLocks@JSLock@JSC@@QAE@XZ
+ ??1JSGlobalData@JSC@@QAE@XZ
+ ??1JSGlobalObject@JSC@@UAE@XZ
+ ??1Mutex@WTF@@QAE@XZ
+ ??1RefCountedLeakCounter@WTF@@QAE@XZ
+ ??1RegExp@JSC@@QAE@XZ
+ ??1Structure@JSC@@QAE@XZ
+ ??1ThreadCondition@WTF@@QAE@XZ
+ ??1WTFThreadData@WTF@@QAE@XZ
+ ??2JSGlobalObject@JSC@@SAPAXIPAVJSGlobalData@1@@Z
+ ??8JSC@@YA_NABVUString@0@0@Z
+ ??8WTF@@YA_NABVCString@0@0@Z
+ ?NaN@JSC@@3NB
+ ?add@Identifier@JSC@@SA?AV?$PassRefPtr@VStringImpl@WTF@@@WTF@@PAVExecState@2@PBD@Z
+ ?add@PropertyNameArray@JSC@@QAEXPAVStringImpl@WTF@@@Z
+ ?addBytes@MD5@WTF@@QAEXPBEI@Z
+ ?addPropertyTransition@Structure@JSC@@SA?AV?$PassRefPtr@VStructure@JSC@@@WTF@@PAV12@ABVIdentifier@2@IPAVJSCell@2@AAI@Z
+ ?addPropertyTransitionToExistingStructure@Structure@JSC@@SA?AV?$PassRefPtr@VStructure@JSC@@@WTF@@PAV12@ABVIdentifier@2@IPAVJSCell@2@AAI@Z
+ ?addPropertyWithoutTransition@Structure@JSC@@QAEIABVIdentifier@2@IPAVJSCell@2@@Z
+ ?addSlowCase@Identifier@JSC@@CA?AV?$PassRefPtr@VStringImpl@WTF@@@WTF@@PAVExecState@2@PAVStringImpl@4@@Z
+ ?addWeakGCHandle@Heap@JSC@@QAEPAVWeakGCHandle@2@PAVJSCell@2@@Z
+ ?allocate@Heap@JSC@@QAEPAXI@Z
+ ?allocatePropertyStorage@JSObject@JSC@@QAEXII@Z
+ ?allocateStack@MarkStack@JSC@@CAPAXI@Z
+ ?append@StringBuilder@WTF@@QAEXPBDI@Z
+ ?append@StringBuilder@WTF@@QAEXPB_WI@Z
+ ?ascii@UString@JSC@@QBE?AVCString@WTF@@XZ
+ ?attach@Debugger@JSC@@QAEXPAVJSGlobalObject@2@@Z
+ ?broadcast@ThreadCondition@WTF@@QAEXXZ
+ ?bufferLengthForStringDecimal@DecimalNumber@WTF@@QBEIXZ
+ ?calculateDSTOffset@WTF@@YANNN@Z
+ ?calculateStringHashFromUTF8@Unicode@WTF@@YAIPBD0AAI@Z
+ ?calculateUTCOffset@WTF@@YAHXZ
+ ?calculatedFunctionName@DebuggerCallFrame@JSC@@QBE?AVUString@2@XZ
+ ?call@JSC@@YA?AVJSValue@1@PAVExecState@1@V21@W4CallType@1@ABTCallData@1@1ABVArgList@1@@Z
+ ?callOnMainThread@WTF@@YAXP6AXPAX@Z0@Z
+ ?callOnMainThreadAndWait@WTF@@YAXP6AXPAX@Z0@Z
+ ?cancelCallOnMainThread@WTF@@YAXP6AXPAX@Z0@Z
+ ?changePrototypeTransition@Structure@JSC@@SA?AV?$PassRefPtr@VStructure@JSC@@@WTF@@PAV12@VJSValue@2@@Z
+ ?checkCurrentIdentifierTable@Identifier@JSC@@CAXPAVExecState@2@@Z
+ ?checkCurrentIdentifierTable@Identifier@JSC@@CAXPAVJSGlobalData@2@@Z
+ ?checkSyntax@JSC@@YA?AVCompletion@1@PAVExecState@1@ABVSourceCode@1@@Z
+ ?checksum@MD5@WTF@@QAEXAAV?$Vector@E$0BA@@2@@Z
+ ?classInfo@InternalFunction@JSC@@UBEPBUClassInfo@2@XZ
+ ?classInfo@JSCell@JSC@@UBEPBUClassInfo@2@XZ
+ ?className@JSObject@JSC@@UBE?AVUString@2@XZ
+ ?collate@Collator@WTF@@QBE?AW4Result@12@PB_WI0I@Z
+ ?collectAllGarbage@Heap@JSC@@QAEXXZ
+ ?configurable@PropertyDescriptor@JSC@@QBE_NXZ
+ ?construct@JSC@@YAPAVJSObject@1@PAVExecState@1@VJSValue@1@W4ConstructType@1@ABTConstructData@1@ABVArgList@1@@Z
+ ?constructArray@JSC@@YAPAVJSArray@1@PAVExecState@1@ABVArgList@1@@Z
+ ?constructEmptyArray@JSC@@YAPAVJSArray@1@PAVExecState@1@@Z
+ ?constructEmptyObject@JSC@@YAPAVJSObject@1@PAVExecState@1@@Z
+ ?constructFunction@JSC@@YAPAVJSObject@1@PAVExecState@1@ABVArgList@1@ABVIdentifier@1@ABVUString@1@H@Z
+ ?convertUTF16ToUTF8@Unicode@WTF@@YA?AW4ConversionResult@12@PAPB_WPB_WPAPADPAD_N@Z
+ ?convertUTF8ToUTF16@Unicode@WTF@@YA?AW4ConversionResult@12@PAPBDPBDPAPA_WPA_W_N@Z
+ ?create@ByteArray@WTF@@SA?AV?$PassRefPtr@VByteArray@WTF@@@2@I@Z
+ ?create@JSGlobalData@JSC@@SA?AV?$PassRefPtr@VJSGlobalData@JSC@@@WTF@@W4ThreadStackType@2@@Z
+ ?create@OpaqueJSString@@SA?AV?$PassRefPtr@UOpaqueJSString@@@WTF@@ABVUString@JSC@@@Z
+ ?create@RegExp@JSC@@SA?AV?$PassRefPtr@VRegExp@JSC@@@WTF@@PAVJSGlobalData@2@ABVUString@2@1@Z
+ ?createEmptyString@SmallStrings@JSC@@AAEXPAVJSGlobalData@2@@Z
+ ?createError@JSC@@YAPAVJSObject@1@PAVExecState@1@ABVUString@1@@Z
+ ?createInheritorID@JSObject@JSC@@AAEPAVStructure@2@XZ
+ ?createInterruptedExecutionException@JSC@@YAPAVJSObject@1@PAVJSGlobalData@1@@Z
+ ?createLeaked@JSGlobalData@JSC@@SA?AV?$PassRefPtr@VJSGlobalData@JSC@@@WTF@@W4ThreadStackType@2@@Z
+ ?createReferenceError@JSC@@YAPAVJSObject@1@PAVExecState@1@ABVUString@1@@Z
+ ?createSingleCharacterString@SmallStrings@JSC@@AAEXPAVJSGlobalData@2@E@Z
+ ?createStackOverflowError@JSC@@YAPAVJSObject@1@PAVExecState@1@@Z
+ ?createStructure@JSByteArray@JSC@@SA?AV?$PassRefPtr@VStructure@JSC@@@WTF@@VJSValue@2@@Z
+ ?createSyntaxError@JSC@@YAPAVJSObject@1@PAVExecState@1@ABVUString@1@@Z
+ ?createTable@HashTable@JSC@@ABEXPAVJSGlobalData@2@@Z
+ ?createThread@WTF@@YAIP6APAXPAX@Z0@Z
+ ?createThread@WTF@@YAIP6APAXPAX@Z0PBD@Z
+ ?createTypeError@JSC@@YAPAVJSObject@1@PAVExecState@1@ABVUString@1@@Z
+ ?currentThread@WTF@@YAIXZ
+ ?currentTime@WTF@@YANXZ
+ ?data@CString@WTF@@QBEPBDXZ
+ ?dateToDaysFrom1970@WTF@@YANHHH@Z
+ ?dayInMonthFromDayInYear@WTF@@YAHH_N@Z
+ ?dayInYear@WTF@@YAHNH@Z
+ ?decrement@RefCountedLeakCounter@WTF@@QAEXXZ
+ ?defaultAttributes@PropertyDescriptor@JSC@@0IA
+ ?defaultValue@JSObject@JSC@@UBE?AVJSValue@2@PAVExecState@2@W4PreferredPrimitiveType@2@@Z
+ ?defineGetter@JSGlobalObject@JSC@@UAEXPAVExecState@2@ABVIdentifier@2@PAVJSObject@2@I@Z
+ ?defineGetter@JSObject@JSC@@UAEXPAVExecState@2@ABVIdentifier@2@PAV12@I@Z
+ ?defineOwnProperty@JSObject@JSC@@UAE_NPAVExecState@2@ABVIdentifier@2@AAVPropertyDescriptor@2@_N@Z
+ ?defineSetter@JSGlobalObject@JSC@@UAEXPAVExecState@2@ABVIdentifier@2@PAVJSObject@2@I@Z
+ ?defineSetter@JSObject@JSC@@UAEXPAVExecState@2@ABVIdentifier@2@PAV12@I@Z
+ ?deleteOwnedPtr@WTF@@YAXPAUHBITMAP__@@@Z
+ ?deleteOwnedPtr@WTF@@YAXPAUHBRUSH__@@@Z
+ ?deleteOwnedPtr@WTF@@YAXPAUHDC__@@@Z
+ ?deleteOwnedPtr@WTF@@YAXPAUHFONT__@@@Z
+ ?deleteOwnedPtr@WTF@@YAXPAUHRGN__@@@Z
+ ?deleteProperty@JSCell@JSC@@UAE_NPAVExecState@2@ABVIdentifier@2@@Z
+ ?deleteProperty@JSCell@JSC@@UAE_NPAVExecState@2@I@Z
+ ?deleteProperty@JSObject@JSC@@UAE_NPAVExecState@2@ABVIdentifier@2@@Z
+ ?deleteProperty@JSObject@JSC@@UAE_NPAVExecState@2@I@Z
+ ?deleteProperty@JSVariableObject@JSC@@UAE_NPAVExecState@2@ABVIdentifier@2@@Z
+ ?deleteProperty@StringObject@JSC@@UAE_NPAVExecState@2@ABVIdentifier@2@@Z
+ ?deleteTable@HashTable@JSC@@QBEXXZ
+ ?despecifyDictionaryFunction@Structure@JSC@@QAEXABVIdentifier@2@@Z
+ ?despecifyFunctionTransition@Structure@JSC@@SA?AV?$PassRefPtr@VStructure@JSC@@@WTF@@PAV12@ABVIdentifier@2@@Z
+ ?destroy@Heap@JSC@@QAEXXZ
+ ?destroyJSGlobalObjectData@JSGlobalObject@JSC@@CAXPAX@Z
+ ?detach@Debugger@JSC@@UAEXPAVJSGlobalObject@2@@Z
+ ?detachThread@WTF@@YAXI@Z
+ ?didTimeOut@TimeoutChecker@JSC@@QAE_NPAVExecState@2@@Z
+ ?dtoa@WTF@@YAXQADNAA_NAAHAAI@Z
+ ?dumpSampleData@JSGlobalData@JSC@@QAEXPAVExecState@2@@Z
+ ?empty@StringImpl@WTF@@SAPAV12@XZ
+ ?enumerable@PropertyDescriptor@JSC@@QBE_NXZ
+ ?equal@Identifier@JSC@@SA_NPBVStringImpl@WTF@@PBD@Z
+ ?equalUTF16WithUTF8@Unicode@WTF@@YA_NPB_W0PBD1@Z
+ ?evaluate@DebuggerCallFrame@JSC@@QBE?AVJSValue@2@ABVUString@2@AAV32@@Z
+ ?evaluate@JSC@@YA?AVCompletion@1@PAVExecState@1@AAVScopeChain@1@ABVSourceCode@1@VJSValue@1@@Z
+ ?exclude@Profile@JSC@@QAEXPBVProfileNode@2@@Z
+ ?fastCalloc@WTF@@YAPAXII@Z
+ ?fastFree@WTF@@YAXPAX@Z
+ ?fastMalloc@WTF@@YAPAXI@Z
+ ?fastMallocSize@WTF@@YAIPBX@Z
+ ?fastRealloc@WTF@@YAPAXPAXI@Z
+ ?fastStrDup@WTF@@YAPADPBD@Z
+ ?fastZeroedMalloc@WTF@@YAPAXI@Z
+ ?fillGetterPropertySlot@JSObject@JSC@@QAEXAAVPropertySlot@2@PAVJSValue@2@@Z
+ ?focus@Profile@JSC@@QAEXPBVProfileNode@2@@Z
+ ?free@WeakGCHandlePool@JSC@@QAEXPAVWeakGCHandle@2@@Z
+ ?from@Identifier@JSC@@SA?AV12@PAVExecState@2@H@Z
+ ?from@Identifier@JSC@@SA?AV12@PAVExecState@2@I@Z
+ ?functionGetter@PropertySlot@JSC@@ABE?AVJSValue@2@PAVExecState@2@@Z
+ ?functionName@DebuggerCallFrame@JSC@@QBEPBVUString@2@XZ
+ ?get@Structure@JSC@@QAEIPBVStringImpl@WTF@@AAIAAPAVJSCell@2@@Z
+ ?getCallData@JSCell@JSC@@UAE?AW4CallType@2@AATCallData@2@@Z
+ ?getConstructData@JSCell@JSC@@UAE?AW4ConstructType@2@AATConstructData@2@@Z
+ ?getJSNumber@JSCell@JSC@@UAE?AVJSValue@2@XZ
+ ?getObject@JSCell@JSC@@QAEPAVJSObject@2@XZ
+ ?getOwnPropertyDescriptor@JSObject@JSC@@UAE_NPAVExecState@2@ABVIdentifier@2@AAVPropertyDescriptor@2@@Z
+ ?getOwnPropertyDescriptor@JSString@JSC@@EAE_NPAVExecState@2@ABVIdentifier@2@AAVPropertyDescriptor@2@@Z
+ ?getOwnPropertyDescriptor@StringObject@JSC@@UAE_NPAVExecState@2@ABVIdentifier@2@AAVPropertyDescriptor@2@@Z
+ ?getOwnPropertyNames@JSObject@JSC@@UAEXPAVExecState@2@AAVPropertyNameArray@2@W4EnumerationMode@2@@Z
+ ?getOwnPropertyNames@JSVariableObject@JSC@@UAEXPAVExecState@2@AAVPropertyNameArray@2@W4EnumerationMode@2@@Z
+ ?getOwnPropertyNames@StringObject@JSC@@UAEXPAVExecState@2@AAVPropertyNameArray@2@W4EnumerationMode@2@@Z
+ ?getOwnPropertySlot@JSArray@JSC@@UAE_NPAVExecState@2@IAAVPropertySlot@2@@Z
+ ?getOwnPropertySlot@JSCell@JSC@@EAE_NPAVExecState@2@ABVIdentifier@2@AAVPropertySlot@2@@Z
+ ?getOwnPropertySlot@JSCell@JSC@@EAE_NPAVExecState@2@IAAVPropertySlot@2@@Z
+ ?getOwnPropertySlot@JSObject@JSC@@UAE_NPAVExecState@2@IAAVPropertySlot@2@@Z
+ ?getOwnPropertySlot@JSString@JSC@@EAE_NPAVExecState@2@ABVIdentifier@2@AAVPropertySlot@2@@Z
+ ?getOwnPropertySlot@JSString@JSC@@EAE_NPAVExecState@2@IAAVPropertySlot@2@@Z
+ ?getOwnPropertySlot@StringObject@JSC@@UAE_NPAVExecState@2@ABVIdentifier@2@AAVPropertySlot@2@@Z
+ ?getOwnPropertySlot@StringObject@JSC@@UAE_NPAVExecState@2@IAAVPropertySlot@2@@Z
+ ?getPrimitiveNumber@JSCell@JSC@@UAE_NPAVExecState@2@AANAAVJSValue@2@@Z
+ ?getPrimitiveNumber@JSObject@JSC@@UAE_NPAVExecState@2@AANAAVJSValue@2@@Z
+ ?getPrimitiveNumber@JSString@JSC@@EAE_NPAVExecState@2@AANAAVJSValue@2@@Z
+ ?getPropertyDescriptor@JSObject@JSC@@QAE_NPAVExecState@2@ABVIdentifier@2@AAVPropertyDescriptor@2@@Z
+ ?getPropertyNames@JSObject@JSC@@UAEXPAVExecState@2@AAVPropertyNameArray@2@W4EnumerationMode@2@@Z
+ ?getSlice@ArgList@JSC@@QBEXHAAV12@@Z
+ ?getString@JSCell@JSC@@QBE?AVUString@2@PAVExecState@2@@Z
+ ?getString@JSCell@JSC@@QBE_NPAVExecState@2@AAVUString@2@@Z
+ ?getUInt32@JSCell@JSC@@UBE_NAAI@Z
+ ?getter@PropertyDescriptor@JSC@@QBE?AVJSValue@2@XZ
+ ?globalExec@JSGlobalObject@JSC@@UAEPAVExecState@2@XZ
+ ?globalObject@JSObjectWithGlobalObject@JSC@@QBEPAVJSGlobalObject@2@XZ
+ ?globalObjectCount@Heap@JSC@@QAEIXZ
+ ?hasInstance@JSObject@JSC@@UAE_NPAVExecState@2@VJSValue@2@1@Z
+ ?hasProperty@JSObject@JSC@@QBE_NPAVExecState@2@ABVIdentifier@2@@Z
+ ?hasProperty@JSObject@JSC@@QBE_NPAVExecState@2@I@Z
+ ?hasTransition@Structure@JSC@@QAE_NPAVStringImpl@WTF@@I@Z
+ ?heap@Heap@JSC@@SAPAV12@VJSValue@2@@Z
+ ?increment@RefCountedLeakCounter@WTF@@QAEXXZ
+ ?init@AtomicString@WTF@@SAXXZ
+ ?init@JSGlobalObject@JSC@@AAEXPAVJSObject@2@@Z
+ ?initializeMainThread@WTF@@YAXXZ
+ ?initializeThreading@JSC@@YAXXZ
+ ?initializeThreading@WTF@@YAXXZ
+ ?isAccessorDescriptor@PropertyDescriptor@JSC@@QBE_NXZ
+ ?isBusy@Heap@JSC@@QAE_NXZ
+ ?isDataDescriptor@PropertyDescriptor@JSC@@QBE_NXZ
+ ?isDynamicScope@JSGlobalObject@JSC@@UBE_NAA_N@Z
+ ?isGetterSetter@JSCell@JSC@@UBE_NXZ
+ ?isHostFunctionNonInline@JSFunction@JSC@@ABE_NXZ
+ ?isMainThread@WTF@@YA_NXZ
+ ?isValidCallee@JSValue@JSC@@QAE_NXZ
+ ?isVariableObject@JSVariableObject@JSC@@UBE_NXZ
+ ?jsNumberCell@JSC@@YA?AVJSValue@1@PAVExecState@1@N@Z
+ ?jsOwnedString@JSC@@YAPAVJSString@1@PAVJSGlobalData@1@ABVUString@1@@Z
+ ?jsRegExpCompile@@YAPAUJSRegExp@@PB_WHW4JSRegExpIgnoreCaseOption@@W4JSRegExpMultilineOption@@PAIPAPBD@Z
+ ?jsRegExpExecute@@YAHPBUJSRegExp@@PB_WHHPAHH@Z
+ ?jsRegExpFree@@YAXPAUJSRegExp@@@Z
+ ?jsString@JSC@@YAPAVJSString@1@PAVJSGlobalData@1@ABVUString@1@@Z
+ ?length@CString@WTF@@QBEIXZ
+ ?lock@JSLock@JSC@@SAXW4JSLockBehavior@2@@Z
+ ?lock@Mutex@WTF@@QAEXXZ
+ ?lockAtomicallyInitializedStaticMutex@WTF@@YAXXZ
+ ?lookupGetter@JSObject@JSC@@UAE?AVJSValue@2@PAVExecState@2@ABVIdentifier@2@@Z
+ ?lookupSetter@JSObject@JSC@@UAE?AVJSValue@2@PAVExecState@2@ABVIdentifier@2@@Z
+ ?markChildren@JSGlobalObject@JSC@@UAEXAAVMarkStack@2@@Z
+ ?markChildren@JSObject@JSC@@UAEXAAVMarkStack@2@@Z
+ ?markChildren@JSWrapperObject@JSC@@EAEXAAVMarkStack@2@@Z
+ ?materializePropertyMap@Structure@JSC@@AAEXXZ
+ ?monthFromDayInYear@WTF@@YAHH_N@Z
+ ?msToYear@WTF@@YAHN@Z
+ ?name@InternalFunction@JSC@@QAEABVUString@2@PAVExecState@2@@Z
+ ?name@JSFunction@JSC@@QAEABVUString@2@PAVExecState@2@@Z
+ ?newUninitialized@CString@WTF@@SA?AV12@IAAPAD@Z
+ ?nonInlineNaN@JSC@@YANXZ
+ ?nullptr@@3Vnullptr_t@std@@A
+ ?number@UString@JSC@@SA?AV12@H@Z
+ ?number@UString@JSC@@SA?AV12@I@Z
+ ?number@UString@JSC@@SA?AV12@N@Z
+ ?numberToString@WTF@@YAINQA_W@Z
+ ?objectCount@Heap@JSC@@QBEIXZ
+ ?objectProtoFuncToString@JSC@@YI_JPAVExecState@1@@Z
+ ?parseDateFromNullTerminatedCharacters@WTF@@YANPBD@Z
+ ?pool@WeakGCHandle@JSC@@QAEPAVWeakGCHandlePool@2@XZ
+ ?profiler@Profiler@JSC@@SAPAV12@XZ
+ ?protect@Heap@JSC@@QAEXVJSValue@2@@Z
+ ?protectedGlobalObjectCount@Heap@JSC@@QAEIXZ
+ ?protectedObjectCount@Heap@JSC@@QAEIXZ
+ ?protectedObjectTypeCounts@Heap@JSC@@QAEPAV?$HashCountedSet@PBDU?$PtrHash@PBD@WTF@@U?$HashTraits@PBD@2@@WTF@@XZ
+ ?put@JSCell@JSC@@UAEXPAVExecState@2@ABVIdentifier@2@VJSValue@2@AAVPutPropertySlot@2@@Z
+ ?put@JSCell@JSC@@UAEXPAVExecState@2@IVJSValue@2@@Z
+ ?put@JSGlobalObject@JSC@@UAEXPAVExecState@2@ABVIdentifier@2@VJSValue@2@AAVPutPropertySlot@2@@Z
+ ?put@JSObject@JSC@@UAEXPAVExecState@2@ABVIdentifier@2@VJSValue@2@AAVPutPropertySlot@2@@Z
+ ?put@JSObject@JSC@@UAEXPAVExecState@2@IVJSValue@2@@Z
+ ?put@StringObject@JSC@@UAEXPAVExecState@2@ABVIdentifier@2@VJSValue@2@AAVPutPropertySlot@2@@Z
+ ?putDirectFunction@JSObject@JSC@@QAEXPAVExecState@2@PAVInternalFunction@2@I@Z
+ ?putDirectFunction@JSObject@JSC@@QAEXPAVExecState@2@PAVJSFunction@2@I@Z
+ ?putWithAttributes@JSGlobalObject@JSC@@UAEXPAVExecState@2@ABVIdentifier@2@VJSValue@2@I@Z
+ ?putWithAttributes@JSObject@JSC@@UAEXPAVExecState@2@ABVIdentifier@2@VJSValue@2@I@Z
+ ?putWithAttributes@JSObject@JSC@@UAEXPAVExecState@2@ABVIdentifier@2@VJSValue@2@I_NAAVPutPropertySlot@2@@Z
+ ?putWithAttributes@JSObject@JSC@@UAEXPAVExecState@2@IVJSValue@2@I@Z
+ ?putWithAttributes@JSObject@JSC@@UAEXPAVJSGlobalData@2@ABVIdentifier@2@VJSValue@2@I@Z
+ ?putWithAttributes@JSObject@JSC@@UAEXPAVJSGlobalData@2@ABVIdentifier@2@VJSValue@2@I_NAAVPutPropertySlot@2@@Z
+ ?putWithAttributes@JSObject@JSC@@UAEXPAVJSGlobalData@2@IVJSValue@2@I@Z
+ ?randomNumber@WTF@@YANXZ
+ ?recompileAllJSFunctions@Debugger@JSC@@QAEXPAVJSGlobalData@2@@Z
+ ?recordExtraCost@Heap@JSC@@AAEXI@Z
+ ?reifyString@StringBuilder@WTF@@AAEXXZ
+ ?releaseDecommitted@OSAllocator@WTF@@SAXPAXI@Z
+ ?releaseStack@MarkStack@JSC@@CAXPAXI@Z
+ ?reserveAndCommit@OSAllocator@WTF@@SAPAXIW4Usage@12@_N1@Z
+ ?reset@ParserArena@JSC@@QAEXXZ
+ ?reset@TimeoutChecker@JSC@@QAEXXZ
+ ?resetDateCache@JSGlobalData@JSC@@QAEXXZ
+ ?resize@StringBuilder@WTF@@QAEXI@Z
+ ?resolveRope@JSString@JSC@@ABEXPAVExecState@2@@Z
+ ?restoreAll@Profile@JSC@@QAEXXZ
+ ?retrieveCaller@Interpreter@JSC@@QBE?AVJSValue@2@PAVExecState@2@PAVJSFunction@2@@Z
+ ?retrieveLastCaller@Interpreter@JSC@@QBEXPAVExecState@2@AAH1AAVUString@2@AAVJSValue@2@@Z
+ ?setAccessorDescriptor@PropertyDescriptor@JSC@@QAEXVJSValue@2@0I@Z
+ ?setConfigurable@PropertyDescriptor@JSC@@QAEX_N@Z
+ ?setDescriptor@PropertyDescriptor@JSC@@QAEXVJSValue@2@I@Z
+ ?setDumpsGeneratedCode@BytecodeGenerator@JSC@@SAX_N@Z
+ ?setEnumerable@PropertyDescriptor@JSC@@QAEX_N@Z
+ ?setGetter@PropertyDescriptor@JSC@@QAEXVJSValue@2@@Z
+ ?setLength@JSArray@JSC@@QAEXI@Z
+ ?setLoc@StatementNode@JSC@@QAEXHH@Z
+ ?setMainThreadCallbacksPaused@WTF@@YAX_N@Z
+ ?setOrderLowerFirst@Collator@WTF@@QAEX_N@Z
+ ?setSetter@PropertyDescriptor@JSC@@QAEXVJSValue@2@@Z
+ ?setUndefined@PropertyDescriptor@JSC@@QAEXXZ
+ ?setUpStaticFunctionSlot@JSC@@YAXPAVExecState@1@PBVHashEntry@1@PAVJSObject@1@ABVIdentifier@1@AAVPropertySlot@1@@Z
+ ?setWritable@PropertyDescriptor@JSC@@QAEX_N@Z
+ ?setter@PropertyDescriptor@JSC@@QBE?AVJSValue@2@XZ
+ ?shrinkToFit@StringBuilder@WTF@@QAEXXZ
+ ?signal@ThreadCondition@WTF@@QAEXXZ
+ ?size@Heap@JSC@@QBEIXZ
+ ?slowAppend@MarkedArgumentBuffer@JSC@@AAEXVJSValue@2@@Z
+ ?startIgnoringLeaks@Structure@JSC@@SAXXZ
+ ?startProfiling@Profiler@JSC@@QAEXPAVExecState@2@ABVUString@2@@Z
+ ?startSampling@JSGlobalData@JSC@@QAEXXZ
+ ?stopIgnoringLeaks@Structure@JSC@@SAXXZ
+ ?stopProfiling@Profiler@JSC@@QAE?AV?$PassRefPtr@VProfile@JSC@@@WTF@@PAVExecState@2@ABVUString@2@@Z
+ ?stopSampling@JSGlobalData@JSC@@QAEXXZ
+ ?strtod@WTF@@YANPBDPAPAD@Z
+ ?substringSharingImpl@UString@JSC@@QBE?AV12@II@Z
+ ?symbolTableGet@JSVariableObject@JSC@@IAE_NABVIdentifier@2@AAVPropertyDescriptor@2@@Z
+ ?synthesizePrototype@JSValue@JSC@@ABEPAVJSObject@2@PAVExecState@2@@Z
+ ?thisObject@DebuggerCallFrame@JSC@@QBEPAVJSObject@2@XZ
+ ?throwError@JSC@@YA?AVJSValue@1@PAVExecState@1@V21@@Z
+ ?throwError@JSC@@YAPAVJSObject@1@PAVExecState@1@PAV21@@Z
+ ?throwSyntaxError@JSC@@YAPAVJSObject@1@PAVExecState@1@@Z
+ ?throwTypeError@JSC@@YAPAVJSObject@1@PAVExecState@1@@Z
+ ?timedWait@ThreadCondition@WTF@@QAE_NAAVMutex@2@N@Z
+ ?tlsKeyCount@WTF@@YAAAJXZ
+ ?tlsKeys@WTF@@YAPAKXZ
+ ?toBoolean@JSCell@JSC@@UBE_NPAVExecState@2@@Z
+ ?toBoolean@JSObject@JSC@@UBE_NPAVExecState@2@@Z
+ ?toBoolean@JSString@JSC@@EBE_NPAVExecState@2@@Z
+ ?toInt32@JSC@@YAHN@Z
+ ?toInteger@JSValue@JSC@@QBENPAVExecState@2@@Z
+ ?toNumber@JSCell@JSC@@UBENPAVExecState@2@@Z
+ ?toNumber@JSObject@JSC@@UBENPAVExecState@2@@Z
+ ?toNumber@JSString@JSC@@EBENPAVExecState@2@@Z
+ ?toObject@JSCell@JSC@@UBEPAVJSObject@2@PAVExecState@2@@Z
+ ?toObject@JSObject@JSC@@UBEPAV12@PAVExecState@2@@Z
+ ?toObject@JSString@JSC@@EBEPAVJSObject@2@PAVExecState@2@@Z
+ ?toObjectSlowCase@JSValue@JSC@@ABEPAVJSObject@2@PAVExecState@2@@Z
+ ?toPrimitive@JSCell@JSC@@UBE?AVJSValue@2@PAVExecState@2@W4PreferredPrimitiveType@2@@Z
+ ?toPrimitive@JSString@JSC@@EBE?AVJSValue@2@PAVExecState@2@W4PreferredPrimitiveType@2@@Z
+ ?toStrictThisObject@JSObject@JSC@@UBE?AVJSValue@2@PAVExecState@2@@Z
+ ?toString@JSCell@JSC@@UBE?AVUString@2@PAVExecState@2@@Z
+ ?toString@JSObject@JSC@@UBE?AVUString@2@PAVExecState@2@@Z
+ ?toString@JSString@JSC@@EBE?AVUString@2@PAVExecState@2@@Z
+ ?toStringDecimal@DecimalNumber@WTF@@QBEIPA_WI@Z
+ ?toThisObject@JSCell@JSC@@UBEPAVJSObject@2@PAVExecState@2@@Z
+ ?toThisObject@JSObject@JSC@@UBEPAV12@PAVExecState@2@@Z
+ ?toThisObject@JSString@JSC@@EBEPAVJSObject@2@PAVExecState@2@@Z
+ ?toThisObjectSlowCase@JSValue@JSC@@ABEPAVJSObject@2@PAVExecState@2@@Z
+ ?toUInt32@Identifier@JSC@@SAIABVUString@2@AA_N@Z
+ ?tryFastCalloc@WTF@@YA?AUTryMallocReturnValue@1@II@Z
+ ?tryFastMalloc@WTF@@YA?AUTryMallocReturnValue@1@I@Z
+ ?tryFastRealloc@WTF@@YA?AUTryMallocReturnValue@1@PAXI@Z
+ ?tryLock@Mutex@WTF@@QAE_NXZ
+ ?type@DebuggerCallFrame@JSC@@QBE?AW4Type@12@XZ
+ ?unlock@JSLock@JSC@@SAXW4JSLockBehavior@2@@Z
+ ?unlock@Mutex@WTF@@QAEXXZ
+ ?unlockAtomicallyInitializedStaticMutex@WTF@@YAXXZ
+ ?unprotect@Heap@JSC@@QAE_NVJSValue@2@@Z
+ ?unwrappedObject@JSObject@JSC@@UAEPAV12@XZ
+ ?utf8@UString@JSC@@QBE?AVCString@WTF@@_N@Z
+ ?wait@ThreadCondition@WTF@@QAEXAAVMutex@2@@Z
+ ?waitForThreadCompletion@WTF@@YAHIPAPAX@Z
+ ?writable@PropertyDescriptor@JSC@@QBE_NXZ
+ ?yield@WTF@@YAXXZ
+ WTFLog
+ WTFLogVerbose
+ WTFReportArgumentAssertionFailure
+ WTFReportAssertionFailure
+ WTFReportAssertionFailureWithMessage
+ WTFReportError
diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.rc b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.rc
new file mode 100644
index 0000000..e09e26e
--- /dev/null
+++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.rc
@@ -0,0 +1,47 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "autoversion.h"
+#include "winresrc.h"
+
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION __VERSION_MAJOR__,__VERSION_MINOR__,__VERSION_TINY__,__VERSION_BUILD__
+ PRODUCTVERSION __VERSION_MAJOR__,__VERSION_MINOR__,__VERSION_TINY__,__VERSION_BUILD__
+ FILEFLAGSMASK 0x17L
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "FileDescription", "JavaScriptCore Dynamic Link Library"
+ VALUE "FileVersion", __VERSION_TEXT__
+ VALUE "CompanyName", "Apple Inc."
+ VALUE "InternalName", "JavaScriptCore"
+ VALUE "LegalCopyright", "Copyright Apple Inc. 2003-" __COPYRIGHT_YEAR_END_TEXT__
+ VALUE "OriginalFilename", "JavaScriptCore.dll"
+ VALUE "ProductName", " JavaScriptCore"
+ VALUE "ProductVersion", __VERSION_TEXT__
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj
new file mode 100644
index 0000000..7284362
--- /dev/null
+++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj
@@ -0,0 +1,1968 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="JavaScriptCore"
+ ProjectGUID="{011D10F1-B656-4A1B-A0C3-3842F02122C5}"
+ RootNamespace="JavaScriptCore"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefines.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops;.\JavaScriptCoreCommon.vsprops;.\JavaScriptCoreCF.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefines.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops;.\JavaScriptCoreCommon.vsprops;.\JavaScriptCoreCF.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release_PGO|Win32"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefines.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops;.\JavaScriptCoreCommon.vsprops;.\JavaScriptCoreCF.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug_Cairo_CFLite|Win32"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefinesCairo.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\debug_wincairo.vsprops;.\JavaScriptCoreCommon.vsprops;.\JavaScriptCoreCFLite.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release_Cairo_CFLite|Win32"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefinesCairo.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\WinCairo.vsprops;.\JavaScriptCoreCommon.vsprops;.\JavaScriptCoreCFLite.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug_All|Win32"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefines.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops;.\JavaScriptCoreCommon.vsprops;.\JavaScriptCoreCF.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\debug_all.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release_LTCG|Win32"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefines.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops;.\JavaScriptCoreCommon.vsprops;.\JavaScriptCoreCF.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release_PGO_Optimize|Win32"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefines.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops;.\JavaScriptCoreCommon.vsprops;.\JavaScriptCoreCF.vsprops;.\JavaScriptCorePGOOptimize.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="4"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="runtime"
+ >
+ <File
+ RelativePath="..\..\runtime\ArgList.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\ArgList.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\Arguments.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\Arguments.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\ArrayConstructor.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\ArrayConstructor.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\ArrayPrototype.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\ArrayPrototype.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\BatchedTransitionOptimizer.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\BooleanConstructor.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\BooleanConstructor.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\BooleanObject.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\BooleanObject.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\BooleanPrototype.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\BooleanPrototype.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\CallData.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\CallData.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\ClassInfo.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\Collector.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\Collector.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\CollectorHeapIntrospector.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\CommonIdentifiers.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\CommonIdentifiers.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\Completion.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\Completion.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\ConstructData.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\ConstructData.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\DateConstructor.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\DateConstructor.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\DateConversion.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\DateConversion.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\DateInstance.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\DateInstance.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\DateInstanceCache.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\DateMath.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\DateMath.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\DatePrototype.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\DatePrototype.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\Error.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\Error.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\ErrorConstructor.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\ErrorConstructor.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\ErrorInstance.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\ErrorInstance.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\ErrorPrototype.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\ErrorPrototype.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\ExceptionHelpers.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\interpreter\ExceptionHelpers.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\Executable.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\Executable.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\FunctionConstructor.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\FunctionConstructor.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\FunctionPrototype.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\FunctionPrototype.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\GCActivityCallback.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\GCActivityCallback.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\GCHandle.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\GCHandle.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\GetterSetter.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\GetterSetter.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\GlobalEvalFunction.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\GlobalEvalFunction.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\Identifier.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\Identifier.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\InitializeThreading.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\InitializeThreading.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\InternalFunction.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\InternalFunction.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\JSActivation.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\JSActivation.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\JSArray.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\JSArray.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\JSByteArray.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\JSByteArray.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\JSCell.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\JSCell.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\JSFunction.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\JSFunction.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\JSGlobalData.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\JSGlobalData.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\JSGlobalObject.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\JSGlobalObject.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\JSGlobalObjectFunctions.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\JSGlobalObjectFunctions.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\JSImmediate.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\JSImmediate.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\JSLock.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\JSLock.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\JSNotAnObject.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\JSNotAnObject.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\JSNumberCell.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\JSNumberCell.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\JSObject.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\JSObject.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\JSObjectWithGlobalObject.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\JSObjectWithGlobalObject.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\JSONObject.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\JSONObject.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\JSPropertyNameIterator.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\JSPropertyNameIterator.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\JSStaticScopeObject.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\JSStaticScopeObject.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\JSString.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\JSString.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\JSType.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\JSTypeInfo.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\JSValue.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\JSValue.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\JSVariableObject.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\JSVariableObject.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\JSWrapperObject.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\JSWrapperObject.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\JSZombie.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\JSZombie.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\LiteralParser.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\LiteralParser.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\Lookup.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\Lookup.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\MarkStack.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\MarkStack.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\MarkStackWin.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\MathObject.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\MathObject.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\NativeErrorConstructor.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\NativeErrorConstructor.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\NativeErrorPrototype.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\NativeErrorPrototype.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\NativeFunctionWrapper.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\NumberConstructor.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\NumberConstructor.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\NumberObject.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\NumberObject.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\NumberPrototype.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\NumberPrototype.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\NumericStrings.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\ObjectConstructor.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\ObjectConstructor.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\ObjectPrototype.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\ObjectPrototype.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\Operations.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\Operations.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\PropertyDescriptor.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\PropertyDescriptor.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\PropertyMapHashTable.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\PropertyNameArray.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\PropertyNameArray.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\PropertySlot.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\PropertySlot.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\Protect.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\PrototypeFunction.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\PrototypeFunction.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\RegExp.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\RegExp.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\RegExpCache.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\RegExpCache.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\RegExpConstructor.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\RegExpConstructor.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\RegExpKey.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\RegExpMatchesArray.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\RegExpObject.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\RegExpObject.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\RegExpPrototype.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\RegExpPrototype.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\RopeImpl.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\RopeImpl.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\ScopeChain.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\ScopeChain.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\ScopeChainMark.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\SmallStrings.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\SmallStrings.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\StrictEvalActivation.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\StrictEvalActivation.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\StringConstructor.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\StringConstructor.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\StringObject.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\StringObject.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\StringObjectThatMasqueradesAsUndefined.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\StringPrototype.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\StringPrototype.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\Structure.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\Structure.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\StructureChain.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\StructureChain.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\StructureTransitionTable.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\SymbolTable.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\Terminator.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\TimeoutChecker.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\TimeoutChecker.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\UString.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\UString.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\UStringBuilder.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\UStringConcatenate.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\UStringImpl.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\WeakGCMap.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\WeakGCPtr.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\WeakRandom.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="pcre"
+ >
+ <File
+ RelativePath="..\..\pcre\pcre.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\pcre\pcre_compile.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\pcre\pcre_exec.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\pcre\pcre_internal.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\pcre\pcre_tables.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\pcre\pcre_ucp_searchfuncs.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\pcre\pcre_xclass.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\pcre\ucpinternal.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="API"
+ >
+ <File
+ RelativePath="..\..\API\APICast.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\API\JavaScript.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\API\JavaScriptCore.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\JSAPIValueWrapper.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\runtime\JSAPIValueWrapper.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\API\JSBase.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\API\JSBase.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\API\JSBasePrivate.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\API\JSCallbackConstructor.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\API\JSCallbackConstructor.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\API\JSCallbackFunction.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\API\JSCallbackFunction.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\API\JSCallbackObject.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\API\JSCallbackObject.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\API\JSCallbackObjectFunctions.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\API\JSClassRef.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\API\JSClassRef.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\API\JSContextRef.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\API\JSContextRef.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\API\JSContextRefPrivate.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\API\JSObjectRef.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\API\JSObjectRef.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\API\JSRetainPtr.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\API\JSStringRef.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\API\JSStringRef.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\API\JSStringRefBSTR.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\API\JSStringRefBSTR.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\API\JSStringRefCF.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\API\JSStringRefCF.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\API\JSValueRef.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\API\JSValueRef.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\API\JSWeakObjectMapRefInternal.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\API\JSWeakObjectMapRefPrivate.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\API\JSWeakObjectMapRefPrivate.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\API\OpaqueJSString.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\API\OpaqueJSString.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\API\WebKitAvailability.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="profiler"
+ >
+ <File
+ RelativePath="..\..\profiler\CallIdentifier.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\profiler\Profile.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\profiler\Profile.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\profiler\ProfileGenerator.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\profiler\ProfileGenerator.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\profiler\ProfileNode.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\profiler\ProfileNode.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\profiler\Profiler.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\profiler\Profiler.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="bytecode"
+ >
+ <File
+ RelativePath="..\..\bytecode\CodeBlock.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\bytecode\CodeBlock.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\bytecode\EvalCodeCache.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\bytecode\Instruction.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\bytecode\JumpTable.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\bytecode\JumpTable.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\bytecode\Opcode.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\bytecode\Opcode.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\bytecode\SamplingTool.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\bytecode\SamplingTool.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\bytecode\StructureStubInfo.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\bytecode\StructureStubInfo.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="debugger"
+ >
+ <File
+ RelativePath="..\..\debugger\Debugger.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\debugger\Debugger.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\debugger\DebuggerActivation.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\debugger\DebuggerActivation.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\debugger\DebuggerCallFrame.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\debugger\DebuggerCallFrame.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="assembler"
+ >
+ <File
+ RelativePath="..\..\assembler\AbstractMacroAssembler.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\assembler\AssemblerBuffer.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\assembler\CodeLocation.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\assembler\LinkBuffer.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\assembler\MacroAssembler.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\assembler\MacroAssemblerX86.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\assembler\MacroAssemblerX86Common.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\assembler\RepatchBuffer.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\assembler\X86Assembler.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="yarr"
+ >
+ <File
+ RelativePath="..\..\yarr\RegexInterpreter.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\yarr\RegexInterpreter.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\yarr\RegexJIT.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\yarr\RegexJIT.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\yarr\RegexParser.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\yarr\RegexPattern.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\yarr\RegexPattern.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="jit"
+ >
+ <File
+ RelativePath="..\..\jit\ExecutableAllocator.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\jit\ExecutableAllocator.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\jit\JIT.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\jit\JIT.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\jit\JITArithmetic.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\jit\JITArithmetic32_64.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\jit\JITCall.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\jit\JITCall32_64.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\jit\JITCode.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\jit\JITInlineMethods.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\jit\JITOpcodes.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\jit\JITOpcodes32_64.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\jit\JITPropertyAccess.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\jit\JITPropertyAccess32_64.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\jit\JITStubCall.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\jit\JITStubs.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\jit\JITStubs.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\jit\JSInterfaceJIT.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\jit\SpecializedThunkJIT.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\jit\ThunkGenerators.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\jit\ThunkGenerators.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resources"
+ >
+ <File
+ RelativePath=".\JavaScriptCore.rc"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="interpreter"
+ >
+ <File
+ RelativePath="..\..\interpreter\CachedCall.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\interpreter\CallFrame.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\interpreter\CallFrame.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\interpreter\CallFrameClosure.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\interpreter\Interpreter.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\interpreter\Interpreter.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\interpreter\Register.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\interpreter\RegisterFile.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\interpreter\RegisterFile.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="bytecompiler"
+ >
+ <File
+ RelativePath="..\..\bytecompiler\BytecodeGenerator.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\bytecompiler\BytecodeGenerator.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\bytecompiler\Label.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\bytecompiler\LabelScope.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\bytecompiler\NodesCodegen.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\bytecompiler\RegisterID.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="parser"
+ >
+ <File
+ RelativePath="..\..\parser\ASTBuilder.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\parser\JSParser.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\parser\JSParser.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\parser\Lexer.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\parser\Lexer.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\parser\NodeConstructors.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\parser\NodeInfo.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\parser\Nodes.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\parser\Nodes.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\parser\Parser.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\parser\Parser.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\parser\ParserArena.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\parser\ParserArena.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\parser\ResultType.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\parser\SourceCode.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\parser\SourceProvider.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\parser\SyntaxChecker.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Derived Sources"
+ >
+ <File
+ RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\ArrayPrototype.lut.h"
+ >
+ </File>
+ <File
+ RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\DatePrototype.lut.h"
+ >
+ </File>
+ <File
+ RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\lexer.lut.h"
+ >
+ </File>
+ <File
+ RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\MathObject.lut.h"
+ >
+ </File>
+ <File
+ RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\NumberConstructor.lut.h"
+ >
+ </File>
+ <File
+ RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\RegExpConstructor.lut.h"
+ >
+ </File>
+ <File
+ RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\RegExpObject.lut.h"
+ >
+ </File>
+ <File
+ RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\StringPrototype.lut.h"
+ >
+ </File>
+ </Filter>
+ <File
+ RelativePath="..\..\config.h"
+ >
+ </File>
+ <File
+ RelativePath=".\JavaScriptCore.def"
+ >
+ </File>
+ <File
+ RelativePath=".\JavaScriptCore_debug.def"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCF.vsprops b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCF.vsprops
new file mode 100644
index 0000000..61e10b4
--- /dev/null
+++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCF.vsprops
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioPropertySheet
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="JavaScriptCoreCF"
+ >
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="CoreFoundation$(LibraryConfigSuffix).lib"
+ />
+</VisualStudioPropertySheet>
diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCFLite.vsprops b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCFLite.vsprops
new file mode 100644
index 0000000..1e7aed7
--- /dev/null
+++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCFLite.vsprops
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioPropertySheet
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="JavaScriptCoreCFLite"
+ >
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="CFLite$(WebKitConfigSuffix).lib"
+ />
+</VisualStudioPropertySheet>
diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops
new file mode 100644
index 0000000..2a85beb
--- /dev/null
+++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioPropertySheet
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="JavaScriptCoreCommon"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="&quot;$(ConfigurationBuildDir)\obj\JavaScriptCore\DerivedSources\&quot;;../../;../../API/;../../pcre/;../../parser/;../../bytecompiler/;../../jit/;../../runtime/;../../bytecode/;../../interpreter/;../../wtf/;../../profiler;../../assembler/;../../debugger/;&quot;$(WebKitLibrariesDir)\include&quot;;&quot;$(WebKitLibrariesDir)\include\private&quot;;&quot;$(ConfigurationBuildDir)\include&quot;;&quot;$(ConfigurationBuildDir)\include\JavaScriptCore&quot;;&quot;$(ConfigurationBuildDir)\include\private&quot;;&quot;$(WebKitLibrariesDir)\include\pthreads&quot;"
+ PreprocessorDefinitions="__STD_C"
+ ForcedIncludeFiles="ICUVersion.h"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="gdi32.lib oleaut32.lib winmm.lib libicuin$(LibraryConfigSuffix).lib libicuuc$(LibraryConfigSuffix).lib pthreadVC2$(LibraryConfigSuffix).lib WTF$(WebKitConfigSuffix).lib"
+ OutputFile="$(OutDir)\$(ProjectName)$(WebKitDLLConfigSuffix).dll"
+ AdditionalLibraryDirectories="&quot;$(IntDir)\lib&quot;"
+ ModuleDefinitionFile="JavaScriptCore.def"
+ />
+</VisualStudioPropertySheet>
diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make
new file mode 100644
index 0000000..65e3215
--- /dev/null
+++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make
@@ -0,0 +1,58 @@
+all:
+ touch "$(CONFIGURATIONBUILDDIR)\buildfailed"
+ bash build-generated-files.sh "$(CONFIGURATIONBUILDDIR)" "$(WEBKITLIBRARIESDIR)"
+ -bash -c "python react-to-vsprops-changes.py"
+ -mkdir 2>NUL "$(CONFIGURATIONBUILDDIR)\include\JavaScriptCore"
+ xcopy /y /d "..\..\API\APICast.h" "$(CONFIGURATIONBUILDDIR)\include\JavaScriptCore"
+ xcopy /y /d "..\..\API\JavaScript.h" "$(CONFIGURATIONBUILDDIR)\include\JavaScriptCore"
+ xcopy /y /d "..\..\API\JSBase.h" "$(CONFIGURATIONBUILDDIR)\include\JavaScriptCore"
+ xcopy /y /d "..\..\API\JSContextRef.h" "$(CONFIGURATIONBUILDDIR)\include\JavaScriptCore"
+ xcopy /y /d "..\..\API\JSContextRefPrivate.h" "$(CONFIGURATIONBUILDDIR)\include\JavaScriptCore"
+ xcopy /y /d "..\..\API\JSObjectRef.h" "$(CONFIGURATIONBUILDDIR)\include\JavaScriptCore"
+ xcopy /y /d "..\..\API\JSObjectRefPrivate.h" "$(CONFIGURATIONBUILDDIR)\include\JavaScriptCore"
+ xcopy /y /d "..\..\API\JSStringRef.h" "$(CONFIGURATIONBUILDDIR)\include\JavaScriptCore"
+ xcopy /y /d "..\..\API\JSStringRefCF.h" "$(CONFIGURATIONBUILDDIR)\include\JavaScriptCore"
+ xcopy /y /d "..\..\API\JSStringRefBSTR.h" "$(CONFIGURATIONBUILDDIR)\include\JavaScriptCore"
+ xcopy /y /d "..\..\API\JSValueRef.h" "$(CONFIGURATIONBUILDDIR)\include\JavaScriptCore"
+ xcopy /y /d "..\..\API\JavaScriptCore.h" "$(CONFIGURATIONBUILDDIR)\include\JavaScriptCore"
+ xcopy /y /d "..\..\API\JSRetainPtr.h" "$(CONFIGURATIONBUILDDIR)\include\JavaScriptCore"
+ xcopy /y /d "..\..\API\JSWeakObjectMapRefInternal.h" "$(CONFIGURATIONBUILDDIR)\include\JavaScriptCore"
+ xcopy /y /d "..\..\API\JSWeakObjectMapRefPrivate.h" "$(CONFIGURATIONBUILDDIR)\include\JavaScriptCore"
+ xcopy /y /d "..\..\API\JSRetainPtr.h" "$(CONFIGURATIONBUILDDIR)\include\JavaScriptCore"
+ xcopy /y /d "..\..\API\OpaqueJSString.h" "$(CONFIGURATIONBUILDDIR)\include\JavaScriptCore"
+ xcopy /y /d "..\..\API\WebKitAvailability.h" "$(CONFIGURATIONBUILDDIR)\include\JavaScriptCore"
+
+ -mkdir 2>NUL "$(CONFIGURATIONBUILDDIR)\include\private\JavaScriptCore"
+
+ xcopy /y /d "..\..\wtf\*.h" "$(CONFIGURATIONBUILDDIR)\include\private\JavaScriptCore"
+ xcopy /y /d "..\..\wtf\text\*.h" "$(CONFIGURATIONBUILDDIR)\include\private\JavaScriptCore"
+ xcopy /y /d "..\..\wtf\unicode\*.h" "$(CONFIGURATIONBUILDDIR)\include\private\JavaScriptCore"
+ xcopy /y /d "..\..\wtf\unicode\icu\*.h" "$(CONFIGURATIONBUILDDIR)\include\private\JavaScriptCore"
+ xcopy /y /d "..\..\parser\*.h" "$(CONFIGURATIONBUILDDIR)\include\private\JavaScriptCore"
+ xcopy /y /d "..\..\runtime\*.h" "$(CONFIGURATIONBUILDDIR)\include\private\JavaScriptCore"
+ xcopy /y /d "..\..\bytecode\*.h" "$(CONFIGURATIONBUILDDIR)\include\private\JavaScriptCore"
+ xcopy /y /d "..\..\interpreter\*.h" "$(CONFIGURATIONBUILDDIR)\include\private\JavaScriptCore"
+ xcopy /y /d "..\..\assembler\*.h" "$(CONFIGURATIONBUILDDIR)\include\private\JavaScriptCore"
+ xcopy /y /d "..\..\jit\*.h" "$(CONFIGURATIONBUILDDIR)\include\private\JavaScriptCore"
+ xcopy /y /d "..\..\debugger\*.h" "$(CONFIGURATIONBUILDDIR)\include\private\JavaScriptCore"
+ xcopy /y /d "..\..\profiler\*.h" "$(CONFIGURATIONBUILDDIR)\include\private\JavaScriptCore"
+ xcopy /y /d "..\..\create_hash_table" "$(CONFIGURATIONBUILDDIR)\include\private\JavaScriptCore"
+ xcopy /y /d "..\..\pcre\pcre.h" "$(CONFIGURATIONBUILDDIR)\include\private\JavaScriptCore"
+ xcopy /y /d "..\..\wtf\text\AtomicString.cpp" "$(CONFIGURATIONBUILDDIR)\include\private\JavaScriptCore"
+ xcopy /y /d "..\..\wtf\text\StringBuilder.cpp" "$(CONFIGURATIONBUILDDIR)\include\private\JavaScriptCore"
+ xcopy /y /d "..\..\wtf\text\StringImpl.cpp" "$(CONFIGURATIONBUILDDIR)\include\private\JavaScriptCore"
+ xcopy /y /d "..\..\wtf\text\WTFString.cpp" "$(CONFIGURATIONBUILDDIR)\include\private\JavaScriptCore"
+
+
+ -mkdir 2>NUL "$(CONFIGURATIONBUILDDIR)\bin\JavaScriptCore.resources"
+ xcopy /y /d "..\JavaScriptCore.resources\*" "$(CONFIGURATIONBUILDDIR)\bin\JavaScriptCore.resources"
+
+ -del "$(CONFIGURATIONBUILDDIR)\include\private\JavaScriptCore\stdbool.h" "$(CONFIGURATIONBUILDDIR)\include\private\JavaScriptCore\stdint.h"
+ -del "$(CONFIGURATIONBUILDDIR)\buildfailed"
+
+clean:
+ -del "$(CONFIGURATIONBUILDDIR)\buildfailed"
+ -del /s /q "$(CONFIGURATIONBUILDDIR)\include\JavaScriptCore\JavaScriptCore"
+ -del /s /q "$(CONFIGURATIONBUILDDIR)\obj\JavaScriptCore\DerivedSources"
+ -del /s /q "$(CONFIGURATIONBUILDDIR)\include\private\JavaScriptCore"
+ -del /s /q "$(CONFIGURATIONBUILDDIR)\bin\JavaScriptCore.resources"
diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.vcproj b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.vcproj
new file mode 100644
index 0000000..b8383c4
--- /dev/null
+++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.vcproj
@@ -0,0 +1,100 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="JavaScriptCoreGenerated"
+ ProjectGUID="{4FF5BA11-59EC-4C24-8F52-F235C2E7D43A}"
+ RootNamespace="JavaScriptCoreGenerated"
+ Keyword="MakeFileProj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ ConfigurationType="0"
+ InheritedPropertySheets=".\JavaScriptCoreGeneratedCommon.vsprops"
+ >
+ <Tool
+ Name="VCNMakeTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug_All|Win32"
+ ConfigurationType="0"
+ InheritedPropertySheets=".\JavaScriptCoreGeneratedCommon.vsprops"
+ >
+ <Tool
+ Name="VCNMakeTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ ConfigurationType="0"
+ InheritedPropertySheets=".\JavaScriptCoreGeneratedCommon.vsprops"
+ >
+ <Tool
+ Name="VCNMakeTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release_LTCG|Win32"
+ ConfigurationType="0"
+ InheritedPropertySheets=".\JavaScriptCoreGeneratedCommon.vsprops"
+ >
+ <Tool
+ Name="VCNMakeTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release_Cairo_CFLite|Win32"
+ ConfigurationType="0"
+ InheritedPropertySheets=".\JavaScriptCoreGeneratedCommon.vsprops"
+ >
+ <Tool
+ Name="VCNMakeTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug_Cairo_CFLite|Win32"
+ ConfigurationType="0"
+ InheritedPropertySheets=".\JavaScriptCoreGeneratedCommon.vsprops"
+ >
+ <Tool
+ Name="VCNMakeTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release_PGO|Win32"
+ ConfigurationType="0"
+ InheritedPropertySheets=".\JavaScriptCoreGeneratedCommon.vsprops"
+ >
+ <Tool
+ Name="VCNMakeTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\build-generated-files.sh"
+ >
+ </File>
+ <File
+ RelativePath=".\JavaScriptCoreGenerated.make"
+ >
+ </File>
+ <File
+ RelativePath=".\react-to-vsprops-changes.py"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGeneratedCommon.vsprops b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGeneratedCommon.vsprops
new file mode 100644
index 0000000..248eb59
--- /dev/null
+++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGeneratedCommon.vsprops
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioPropertySheet
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="JavaScriptCoreGeneratedCommon"
+ OutputDirectory="$(ConfigurationBuildDir)\lib"
+ InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops"
+ >
+ <Tool
+ Name="VCNMakeTool"
+ BuildCommandLine="%SystemDrive%\cygwin\bin\which.exe bash&#x0D;&#x0A;if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%&#x0D;&#x0A;cmd /c&#x0D;&#x0A;&#x0D;&#x0A;set CONFIGURATIONBUILDDIR=$(WebKitOutputDir)\$(ConfigurationName)&#x0D;&#x0A;nmake /nologo -f JavaScriptCoreGenerated.make"
+ ReBuildCommandLine="%SystemDrive%\cygwin\bin\which.exe bash&#x0D;&#x0A;if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%&#x0D;&#x0A;cmd /c&#x0D;&#x0A;&#x0D;&#x0A;set CONFIGURATIONBUILDDIR=$(WebKitOutputDir)\$(ConfigurationName)&#x0D;&#x0A;nmake /nologo -f JavaScriptCoreGenerated.make clean&#x0D;&#x0A;nmake -f JavaScriptCoreGenerated.make"
+ CleanCommandLine="%SystemDrive%\cygwin\bin\which.exe bash&#x0D;&#x0A;if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%&#x0D;&#x0A;cmd /c&#x0D;&#x0A;&#x0D;&#x0A;set CONFIGURATIONBUILDDIR=$(WebKitOutputDir)\$(ConfigurationName)&#x0D;&#x0A;nmake /nologo -f JavaScriptCoreGenerated.make clean"
+ />
+</VisualStudioPropertySheet>
diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCorePGOOptimize.vsprops b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCorePGOOptimize.vsprops
new file mode 100644
index 0000000..48173b0
--- /dev/null
+++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCorePGOOptimize.vsprops
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioPropertySheet
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="JavaScriptCorePGOOptimize"
+ >
+ <Tool
+ Name="VCLinkerTool"
+ ImportLibrary="$(WebKitOutputDir)\Release_PGO\lib\$(TargetName).lib"
+ />
+ <UserMacro
+ Name="ConfigurationBuildDir"
+ Value="$(WebKitOutputDir)\Release_PGO"
+ />
+</VisualStudioPropertySheet>
diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCorePostBuild.cmd b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCorePostBuild.cmd
new file mode 100644
index 0000000..26707ca
--- /dev/null
+++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCorePostBuild.cmd
@@ -0,0 +1 @@
+if exist "%CONFIGURATIONBUILDDIR%\buildfailed" del "%CONFIGURATIONBUILDDIR%\buildfailed"
diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCorePreBuild.cmd b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCorePreBuild.cmd
new file mode 100644
index 0000000..42fbb71
--- /dev/null
+++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCorePreBuild.cmd
@@ -0,0 +1,8 @@
+%SystemDrive%\cygwin\bin\which.exe bash
+if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
+cmd /c
+if exist "%CONFIGURATIONBUILDDIR%\buildfailed" grep XX%PROJECTNAME%XX "%CONFIGURATIONBUILDDIR%\buildfailed"
+if errorlevel 1 exit 1
+echo XX%PROJECTNAME%XX > "%CONFIGURATIONBUILDDIR%\buildfailed"
+
+bash "%WEBKITLIBRARIESDIR%\tools\scripts\auto-version.sh" "%INTDIR%"
diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCorePreLink.cmd b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCorePreLink.cmd
new file mode 100644
index 0000000..3ff5069
--- /dev/null
+++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCorePreLink.cmd
@@ -0,0 +1,9 @@
+mkdir 2>NUL "%IntDir%\lib"
+
+if exist "%WebKitLibrariesDir%\lib\icuuc%LibraryConfigSuffix%.lib" copy /y "%WebKitLibrariesDir%\lib\icuuc%LibraryConfigSuffix%.lib" "%IntDir%\lib\libicuuc%LibraryConfigSuffix%.lib"
+if exist "%WebKitLibrariesDir%\lib\icuin%LibraryConfigSuffix%.lib" copy /y "%WebKitLibrariesDir%\lib\icuin%LibraryConfigSuffix%.lib" "%IntDir%\lib\libicuin%LibraryConfigSuffix%.lib"
+
+if exist "%WebKitLibrariesDir%\lib\libicuuc%LibraryConfigSuffix%.lib" copy /y "%WebKitLibrariesDir%\lib\libicuuc%LibraryConfigSuffix%.lib" "%IntDir%\lib"
+if exist "%WebKitLibrariesDir%\lib\libicuin%LibraryConfigSuffix%.lib" copy /y "%WebKitLibrariesDir%\lib\libicuin%LibraryConfigSuffix%.lib" "%IntDir%\lib"
+
+cmd /c
diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/build-generated-files.sh b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/build-generated-files.sh
new file mode 100755
index 0000000..3998c65
--- /dev/null
+++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/build-generated-files.sh
@@ -0,0 +1,47 @@
+#!/usr/bin/bash
+
+# Determine whether we have the versioned ICU 4.0 or the unversioned ICU 4.4
+UNVERSIONED_ICU_LIB_PATH=$(cygpath -u "${WEBKITLIBRARIESDIR}/lib/libicuuc.lib")
+ICUVERSION_H_PATH=$(cygpath -u "${CONFIGURATIONBUILDDIR}/include/private/ICUVersion.h")
+if test \( ! -f "${ICUVERSION_H_PATH}" \) -o \( -f "${UNVERSIONED_ICU_LIB_PATH}" -a \( "${UNVERSIONED_ICU_LIB_PATH}" -nt "${ICUVERSION_H_PATH}" \) \)
+then
+ mkdir -p "$(dirname "${ICUVERSION_H_PATH}")"
+ test ! -f "${UNVERSIONED_ICU_LIB_PATH}"
+ echo "#define U_DISABLE_RENAMING $?" > "${ICUVERSION_H_PATH}"
+fi
+
+NUMCPUS=`../../../../Tools/Scripts/num-cpus`
+
+XSRCROOT="`pwd`/../.."
+XSRCROOT=`realpath "$XSRCROOT"`
+# Do a little dance to get the path into 8.3 form to make it safe for gnu make
+# http://bugzilla.opendarwin.org/show_bug.cgi?id=8173
+XSRCROOT=`cygpath -m -s "$XSRCROOT"`
+XSRCROOT=`cygpath -u "$XSRCROOT"`
+export XSRCROOT
+export SOURCE_ROOT=$XSRCROOT
+
+XDSTROOT="$1"
+export XDSTROOT
+# Do a little dance to get the path into 8.3 form to make it safe for gnu make
+# http://bugzilla.opendarwin.org/show_bug.cgi?id=8173
+XDSTROOT=`cygpath -m -s "$XDSTROOT"`
+XDSTROOT=`cygpath -u "$XDSTROOT"`
+export XDSTROOT
+
+SDKROOT="$2"
+export SDKROOT
+# Do a little dance to get the path into 8.3 form to make it safe for gnu make
+# http://bugzilla.opendarwin.org/show_bug.cgi?id=8173
+SDKROOT=`cygpath -m -s "$SDKROOT"`
+SDKROOT=`cygpath -u "$SDKROOT"`
+export SDKROOT
+
+export BUILT_PRODUCTS_DIR="$XDSTROOT/obj/JavaScriptCore"
+
+mkdir -p "${BUILT_PRODUCTS_DIR}/DerivedSources/docs"
+cd "${BUILT_PRODUCTS_DIR}/DerivedSources"
+
+export JavaScriptCore="${XSRCROOT}"
+export DFTABLES_EXTENSION=".exe"
+make -f "$JavaScriptCore/DerivedSources.make" -j ${NUMCPUS} || exit 1
diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/react-to-vsprops-changes.py b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/react-to-vsprops-changes.py
new file mode 100644
index 0000000..ab1df83
--- /dev/null
+++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/react-to-vsprops-changes.py
@@ -0,0 +1,37 @@
+#!/usr/bin/env python
+
+import glob
+import os
+import re
+import sys
+
+
+def main():
+ # It's fragile to rely on the location of this script to find the top-level
+ # source directory.
+ top_level_directory = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))))
+
+ vsprops_directory = os.path.join(top_level_directory, 'WebKitLibraries', 'win', 'tools', 'vsprops')
+ vsprops_files = glob.glob(os.path.join(vsprops_directory, '*.vsprops'))
+ assert len(vsprops_files), "Couldn't find any .vsprops files in %s" % vsprops_directory
+ newest_vsprops_time = max(map(os.path.getmtime, vsprops_files))
+
+ # Delete any manifest-related files because Visual Studio isn't smart
+ # enough to figure out that it might need to rebuild them.
+ obj_directory = os.path.join(os.environ['CONFIGURATIONBUILDDIR'], 'obj')
+ for manifest_file in glob.iglob(os.path.join(obj_directory, '*', '*', '*.manifest*')):
+ manifest_time = os.path.getmtime(manifest_file)
+ if manifest_time < newest_vsprops_time:
+ print 'Deleting %s' % manifest_file
+ os.remove(manifest_file)
+
+ # Touch wtf/Platform.h so all files will be recompiled. This is necessary
+ # to pick up changes to preprocessor macros (e.g., ENABLE_*).
+ wtf_platform_h = os.path.join(top_level_directory, 'Source', 'JavaScriptCore', 'wtf', 'Platform.h')
+ if os.path.getmtime(wtf_platform_h) < newest_vsprops_time:
+ print 'Touching wtf/Platform.h'
+ os.utime(wtf_platform_h, None)
+
+
+if __name__ == '__main__':
+ sys.exit(main())
diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCoreSubmit.sln b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCoreSubmit.sln
new file mode 100644
index 0000000..1109c33
--- /dev/null
+++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCoreSubmit.sln
@@ -0,0 +1,83 @@
+
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual Studio 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "JavaScriptCore", "JavaScriptCore\JavaScriptCore.vcproj", "{011D10F1-B656-4A1B-A0C3-3842F02122C5}"
+ ProjectSection(ProjectDependencies) = postProject
+ {AA8A5A85-592B-4357-BC60-E0E91E026AF6} = {AA8A5A85-592B-4357-BC60-E0E91E026AF6}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WTF", "WTF\WTF.vcproj", "{AA8A5A85-592B-4357-BC60-E0E91E026AF6}"
+ ProjectSection(ProjectDependencies) = postProject
+ {4FF5BA11-59EC-4C24-8F52-F235C2E7D43A} = {4FF5BA11-59EC-4C24-8F52-F235C2E7D43A}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "JavaScriptCoreGenerated", "JavaScriptCore\JavaScriptCoreGenerated.vcproj", "{4FF5BA11-59EC-4C24-8F52-F235C2E7D43A}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "jsc", "jsc\jsc.vcproj", "{C59E5129-B453-49B7-A52B-1E104715F76E}"
+ ProjectSection(ProjectDependencies) = postProject
+ {011D10F1-B656-4A1B-A0C3-3842F02122C5} = {011D10F1-B656-4A1B-A0C3-3842F02122C5}
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug_All|Win32 = Debug_All|Win32
+ Debug|Win32 = Debug|Win32
+ Release_LTCG|Win32 = Release_LTCG|Win32
+ Release_PGO_Optimize|Win32 = Release_PGO_Optimize|Win32
+ Release_PGO|Win32 = Release_PGO|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {011D10F1-B656-4A1B-A0C3-3842F02122C5}.Debug_All|Win32.ActiveCfg = Debug_All|Win32
+ {011D10F1-B656-4A1B-A0C3-3842F02122C5}.Debug_All|Win32.Build.0 = Debug_All|Win32
+ {011D10F1-B656-4A1B-A0C3-3842F02122C5}.Debug|Win32.ActiveCfg = Debug|Win32
+ {011D10F1-B656-4A1B-A0C3-3842F02122C5}.Debug|Win32.Build.0 = Debug|Win32
+ {011D10F1-B656-4A1B-A0C3-3842F02122C5}.Release_LTCG|Win32.ActiveCfg = Release_LTCG|Win32
+ {011D10F1-B656-4A1B-A0C3-3842F02122C5}.Release_LTCG|Win32.Build.0 = Release_LTCG|Win32
+ {011D10F1-B656-4A1B-A0C3-3842F02122C5}.Release_PGO_Optimize|Win32.ActiveCfg = Release_PGO_Optimize|Win32
+ {011D10F1-B656-4A1B-A0C3-3842F02122C5}.Release_PGO_Optimize|Win32.Build.0 = Release_PGO_Optimize|Win32
+ {011D10F1-B656-4A1B-A0C3-3842F02122C5}.Release_PGO|Win32.ActiveCfg = Release_PGO|Win32
+ {011D10F1-B656-4A1B-A0C3-3842F02122C5}.Release_PGO|Win32.Build.0 = Release_PGO|Win32
+ {011D10F1-B656-4A1B-A0C3-3842F02122C5}.Release|Win32.ActiveCfg = Release|Win32
+ {011D10F1-B656-4A1B-A0C3-3842F02122C5}.Release|Win32.Build.0 = Release|Win32
+ {AA8A5A85-592B-4357-BC60-E0E91E026AF6}.Debug_All|Win32.ActiveCfg = Debug_All|Win32
+ {AA8A5A85-592B-4357-BC60-E0E91E026AF6}.Debug_All|Win32.Build.0 = Debug_All|Win32
+ {AA8A5A85-592B-4357-BC60-E0E91E026AF6}.Debug|Win32.ActiveCfg = Debug|Win32
+ {AA8A5A85-592B-4357-BC60-E0E91E026AF6}.Debug|Win32.Build.0 = Debug|Win32
+ {AA8A5A85-592B-4357-BC60-E0E91E026AF6}.Release_LTCG|Win32.ActiveCfg = Release_LTCG|Win32
+ {AA8A5A85-592B-4357-BC60-E0E91E026AF6}.Release_LTCG|Win32.Build.0 = Release_LTCG|Win32
+ {AA8A5A85-592B-4357-BC60-E0E91E026AF6}.Release_PGO_Optimize|Win32.ActiveCfg = Release_PGO|Win32
+ {AA8A5A85-592B-4357-BC60-E0E91E026AF6}.Release_PGO_Optimize|Win32.Build.0 = Release_PGO|Win32
+ {AA8A5A85-592B-4357-BC60-E0E91E026AF6}.Release_PGO|Win32.ActiveCfg = Release_PGO|Win32
+ {AA8A5A85-592B-4357-BC60-E0E91E026AF6}.Release_PGO|Win32.Build.0 = Release_PGO|Win32
+ {AA8A5A85-592B-4357-BC60-E0E91E026AF6}.Release|Win32.ActiveCfg = Release|Win32
+ {AA8A5A85-592B-4357-BC60-E0E91E026AF6}.Release|Win32.Build.0 = Release|Win32
+ {4FF5BA11-59EC-4C24-8F52-F235C2E7D43A}.Debug_All|Win32.ActiveCfg = Debug_All|Win32
+ {4FF5BA11-59EC-4C24-8F52-F235C2E7D43A}.Debug_All|Win32.Build.0 = Debug_All|Win32
+ {4FF5BA11-59EC-4C24-8F52-F235C2E7D43A}.Debug|Win32.ActiveCfg = Debug|Win32
+ {4FF5BA11-59EC-4C24-8F52-F235C2E7D43A}.Debug|Win32.Build.0 = Debug|Win32
+ {4FF5BA11-59EC-4C24-8F52-F235C2E7D43A}.Release_LTCG|Win32.ActiveCfg = Release_LTCG|Win32
+ {4FF5BA11-59EC-4C24-8F52-F235C2E7D43A}.Release_LTCG|Win32.Build.0 = Release_LTCG|Win32
+ {4FF5BA11-59EC-4C24-8F52-F235C2E7D43A}.Release_PGO_Optimize|Win32.ActiveCfg = Release_PGO|Win32
+ {4FF5BA11-59EC-4C24-8F52-F235C2E7D43A}.Release_PGO_Optimize|Win32.Build.0 = Release_PGO|Win32
+ {4FF5BA11-59EC-4C24-8F52-F235C2E7D43A}.Release_PGO|Win32.ActiveCfg = Release_PGO|Win32
+ {4FF5BA11-59EC-4C24-8F52-F235C2E7D43A}.Release_PGO|Win32.Build.0 = Release_PGO|Win32
+ {4FF5BA11-59EC-4C24-8F52-F235C2E7D43A}.Release|Win32.ActiveCfg = Release|Win32
+ {4FF5BA11-59EC-4C24-8F52-F235C2E7D43A}.Release|Win32.Build.0 = Release|Win32
+ {C59E5129-B453-49B7-A52B-1E104715F76E}.Debug_All|Win32.ActiveCfg = Debug_All|Win32
+ {C59E5129-B453-49B7-A52B-1E104715F76E}.Debug_All|Win32.Build.0 = Debug_All|Win32
+ {C59E5129-B453-49B7-A52B-1E104715F76E}.Debug|Win32.ActiveCfg = Debug|Win32
+ {C59E5129-B453-49B7-A52B-1E104715F76E}.Debug|Win32.Build.0 = Debug|Win32
+ {C59E5129-B453-49B7-A52B-1E104715F76E}.Release_LTCG|Win32.ActiveCfg = Release_LTCG|Win32
+ {C59E5129-B453-49B7-A52B-1E104715F76E}.Release_LTCG|Win32.Build.0 = Release_LTCG|Win32
+ {C59E5129-B453-49B7-A52B-1E104715F76E}.Release_PGO_Optimize|Win32.ActiveCfg = Release_PGO|Win32
+ {C59E5129-B453-49B7-A52B-1E104715F76E}.Release_PGO_Optimize|Win32.Build.0 = Release_PGO|Win32
+ {C59E5129-B453-49B7-A52B-1E104715F76E}.Release_PGO|Win32.ActiveCfg = Release_PGO|Win32
+ {C59E5129-B453-49B7-A52B-1E104715F76E}.Release_PGO|Win32.Build.0 = Release_PGO|Win32
+ {C59E5129-B453-49B7-A52B-1E104715F76E}.Release|Win32.ActiveCfg = Release|Win32
+ {C59E5129-B453-49B7-A52B-1E104715F76E}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTF.vcproj b/Source/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTF.vcproj
new file mode 100644
index 0000000..457392d
--- /dev/null
+++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTF.vcproj
@@ -0,0 +1,978 @@
+<?xml version="1.0" encoding="windows-1251"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="WTF"
+ ProjectGUID="{AA8A5A85-592B-4357-BC60-E0E91E026AF6}"
+ RootNamespace="WTF"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefines.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops;.\WTFCommon.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefines.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops;.\WTFCommon.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug_All|Win32"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefines.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops;.\WTFCommon.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\debug_all.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release_LTCG|Win32"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefines.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops;.\WTFCommon.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release_Cairo_CFLite|Win32"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefinesCairo.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\WinCairo.vsprops;.\WTFCommon.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug_Cairo_CFLite|Win32"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefinesCairo.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\debug_wincairo.vsprops;.\WTFCommon.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release_PGO|Win32"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefines.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops;.\WTFCommon.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="win"
+ >
+ <File
+ RelativePath="..\..\wtf\win\MainThreadWin.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\win\OwnPtrWin.cpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="unicode"
+ >
+ <File
+ RelativePath="..\..\wtf\unicode\Collator.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\unicode\Unicode.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\unicode\UnicodeMacrosFromICU.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\unicode\UTF8.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\unicode\UTF8.h"
+ >
+ </File>
+ <Filter
+ Name="icu"
+ >
+ <File
+ RelativePath="..\..\wtf\unicode\icu\CollatorICU.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\unicode\icu\UnicodeIcu.h"
+ >
+ </File>
+ </Filter>
+ </Filter>
+ <Filter
+ Name="text"
+ >
+ <File
+ RelativePath="..\..\wtf\text\AtomicString.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\text\AtomicString.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\text\AtomicStringHash.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\text\AtomicStringImpl.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\text\CString.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\text\CString.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\text\StringBuffer.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\text\StringBuilder.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\text\StringBuilder.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\text\StringConcatenate.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\text\StringHash.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\text\StringImpl.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\text\StringImpl.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\text\StringImplBase.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\text\StringStatics.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\text\WTFString.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\text\WTFString.h"
+ >
+ </File>
+ </Filter>
+ <File
+ RelativePath="..\..\wtf\AlwaysInline.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\ASCIICType.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\Assertions.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\Assertions.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\Atomics.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\AVLTree.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\Bitmap.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\BumpPointerAllocator.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\ByteArray.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\ByteArray.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\Complex.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\CrossThreadRefCounted.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\CurrentTime.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\CurrentTime.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\DecimalNumber.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\DecimalNumber.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\Decoder.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\Deque.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\DisallowCType.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\dtoa.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\dtoa.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\Encoder.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\FastAllocBase.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\FastMalloc.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ DisableSpecificWarnings="4702"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release_LTCG|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ DisableSpecificWarnings="4702"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release_Cairo_CFLite|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ DisableSpecificWarnings="4702"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release_PGO|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ DisableSpecificWarnings="4702"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\wtf\FastMalloc.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\FixedArray.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\Forward.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\GetPtr.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\HashCountedSet.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\HashFunctions.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\HashIterators.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\HashMap.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\HashSet.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\HashTable.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\HashTable.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\HashTraits.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\ListHashSet.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\ListRefPtr.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\Locker.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\MainThread.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\MainThread.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\MallocZoneSupport.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\MathExtras.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\MD5.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\MD5.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\MessageQueue.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\Noncopyable.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\NonCopyingSort.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\NotFound.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\NullPtr.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\NullPtr.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\OSAllocatorWin.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\OwnArrayPtr.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\OwnArrayPtrCommon.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\OwnFastMallocPtr.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\OwnPtr.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\OwnPtrCommon.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\PageAllocation.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\PageAllocationAligned.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\PageAllocationAligned.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\PageBlock.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\PageBlock.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\PageReservation.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\PassOwnArrayPtr.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\PassOwnPtr.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\PassRefPtr.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\Platform.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\PossiblyNull.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\RandomNumber.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\RandomNumber.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\RandomNumberSeed.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\RefCounted.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\RefCountedLeakCounter.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\RefCountedLeakCounter.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\RefPtr.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\RefPtrHashMap.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\RetainPtr.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\SegmentedVector.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\SizeLimits.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\StackBounds.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\StackBounds.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\StaticConstructors.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\StdLibExtras.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\StringExtras.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\StringExtras.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\StringHasher.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\TCPackedCache.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\TCPageMap.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\TCSpinLock.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\TCSystemAlloc.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\TCSystemAlloc.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\Threading.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\Threading.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\ThreadingNone.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\ThreadingPrimitives.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\ThreadingWin.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\ThreadSafeShared.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\ThreadSpecific.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\ThreadSpecificWin.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\TypeTraits.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\TypeTraits.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\UnusedParam.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\ValueCheck.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\Vector.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\Vector3.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\VectorTraits.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\VMTags.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\WTFThreadData.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\WTFThreadData.h"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTFCommon.vsprops b/Source/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTFCommon.vsprops
new file mode 100644
index 0000000..b74b939
--- /dev/null
+++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTFCommon.vsprops
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioPropertySheet
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="WTFCommon"
+ OutputDirectory="$(ConfigurationBuildDir)\lib"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="&quot;$(ConfigurationBuildDir)\obj\JavaScriptCore\DerivedSources\&quot;;../../;&quot;../../os-win32/&quot;;../../pcre/;../../parser/;../../wtf/;../../wtf/unicode/;&quot;$(ConfigurationBuildDir)\include\private&quot;;&quot;$(WebKitLibrariesDir)\include&quot;;../../../icu/include;../../bindings;../../bindings/c;../../bindings/jni;&quot;$(ConfigurationBuildDir)\include\JavaScriptCore&quot;;&quot;$(WebKitLibrariesDir)\include\pthreads&quot;"
+ PreprocessorDefinitions="__STD_C"
+ ForcedIncludeFiles="ICUVersion.h"
+ ProgramDataBaseFileName="$(OutDir)\$(TargetName).vc80.pdb"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ AdditionalDependencies="user32.lib"
+ OutputFile="$(OutDir)\$(ProjectName)$(WebKitConfigSuffix).lib"
+ />
+</VisualStudioPropertySheet>
diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTFPostBuild.cmd b/Source/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTFPostBuild.cmd
new file mode 100644
index 0000000..26707ca
--- /dev/null
+++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTFPostBuild.cmd
@@ -0,0 +1 @@
+if exist "%CONFIGURATIONBUILDDIR%\buildfailed" del "%CONFIGURATIONBUILDDIR%\buildfailed"
diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTFPreBuild.cmd b/Source/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTFPreBuild.cmd
new file mode 100644
index 0000000..a770776
--- /dev/null
+++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTFPreBuild.cmd
@@ -0,0 +1,6 @@
+%SystemDrive%\cygwin\bin\which.exe bash
+if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
+cmd /c
+if exist "%CONFIGURATIONBUILDDIR%\buildfailed" grep XX%PROJECTNAME%XX "%CONFIGURATIONBUILDDIR%\buildfailed"
+if errorlevel 1 exit 1
+echo XX%PROJECTNAME%XX > "%CONFIGURATIONBUILDDIR%\buildfailed"
diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/jsc/jsc.vcproj b/Source/JavaScriptCore/JavaScriptCore.vcproj/jsc/jsc.vcproj
new file mode 100644
index 0000000..ebcfd8e
--- /dev/null
+++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/jsc/jsc.vcproj
@@ -0,0 +1,473 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="jsc"
+ ProjectGUID="{C59E5129-B453-49B7-A52B-1E104715F76E}"
+ RootNamespace="jsc"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops;.\jscCommon.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops;.\jscCommon.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug_Cairo_CFLite|Win32"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\debug_wincairo.vsprops;.\jscCommon.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug_All|Win32"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops;.\jscCommon.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\debug_all.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release_LTCG|Win32"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops;.\jscCommon.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release_Cairo_CFLite|Win32"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\WinCairo.vsprops;.\jscCommon.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release_PGO|Win32"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops;.\jscCommon.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath="$(ConfigurationBuildDir)\include\private\JavaScriptCore\AtomicString.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\jsc.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(ConfigurationBuildDir)\include\private\JavaScriptCore\StringBuilder.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(ConfigurationBuildDir)\include\private\JavaScriptCore\StringImpl.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(ConfigurationBuildDir)\include\private\JavaScriptCore\WTFString.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/jsc/jscCommon.vsprops b/Source/JavaScriptCore/JavaScriptCore.vcproj/jsc/jscCommon.vsprops
new file mode 100644
index 0000000..d1c3638
--- /dev/null
+++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/jsc/jscCommon.vsprops
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioPropertySheet
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="jscCommon"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="&quot;$(ConfigurationBuildDir)\include&quot;;&quot;$(ConfigurationBuildDir)\include\private&quot;;&quot;$(ConfigurationBuildDir)\obj\JavaScriptCore\DerivedSources\&quot;;../../;&quot;../../os-win32/&quot;;../../pcre/;../../assembler/;../../API/;../../parser/;../../runtime/;../../VM/;../../bytecode/;../../interpreter/;../../wtf/;../../debugger/;../../bytecompiler/;../../profiler;../../jit/;&quot;$(WebKitLibrariesDir)\include\pthreads&quot;;&quot;$(WebKitLibrariesDir)\include&quot;"
+ PreprocessorDefinitions="__STD_C"
+ ForcedIncludeFiles="ICUVersion.h"
+ ForcedUsingFiles=""
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="JavaScriptCore$(WebKitDLLConfigSuffix).lib libicuin$(LibraryConfigSuffix).lib libicuuc$(LibraryConfigSuffix).lib winmm.lib pthreadVC2$(LibraryConfigSuffix).lib user32.lib"
+ AdditionalLibraryDirectories="&quot;$(IntDir)\lib&quot;"
+ SubSystem="1"
+ />
+</VisualStudioPropertySheet>
diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/jsc/jscPostBuild.cmd b/Source/JavaScriptCore/JavaScriptCore.vcproj/jsc/jscPostBuild.cmd
new file mode 100644
index 0000000..4dafacb
--- /dev/null
+++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/jsc/jscPostBuild.cmd
@@ -0,0 +1,25 @@
+if exist "%CONFIGURATIONBUILDDIR%\buildfailed" del "%CONFIGURATIONBUILDDIR%\buildfailed"
+
+mkdir 2>NUL "%CONFIGURATIONBUILDDIR%\bin"
+if exist "%WEBKITLIBRARIESDIR%\bin\icudt46.dll" xcopy /y /d "%WEBKITLIBRARIESDIR%\bin\icudt46.dll" "%CONFIGURATIONBUILDDIR%\bin"
+if exist "%WEBKITLIBRARIESDIR%\bin\icudt46%LIBRARYCONFIGSUFFIX%.dll" xcopy /y /d "%WEBKITLIBRARIESDIR%\bin\icudt46%LIBRARYCONFIGSUFFIX%.dll" "%CONFIGURATIONBUILDDIR%\bin"
+if exist "%WEBKITLIBRARIESDIR%\bin\icudt44.dll" xcopy /y /d "%WEBKITLIBRARIESDIR%\bin\icudt44.dll" "%CONFIGURATIONBUILDDIR%\bin"
+if exist "%WEBKITLIBRARIESDIR%\bin\icudt44%LIBRARYCONFIGSUFFIX%.dll" xcopy /y /d "%WEBKITLIBRARIESDIR%\bin\icudt44%LIBRARYCONFIGSUFFIX%.dll" "%CONFIGURATIONBUILDDIR%\bin"
+if exist "%WEBKITLIBRARIESDIR%\bin\libicuin%LIBRARYCONFIGSUFFIX%.dll" xcopy /y /d "%WEBKITLIBRARIESDIR%\bin\libicuin%LIBRARYCONFIGSUFFIX%.dll" "%CONFIGURATIONBUILDDIR%\bin"
+if exist "%WEBKITLIBRARIESDIR%\bin\libicuuc%LIBRARYCONFIGSUFFIX%.dll" xcopy /y /d "%WEBKITLIBRARIESDIR%\bin\libicuuc%LIBRARYCONFIGSUFFIX%.dll" "%CONFIGURATIONBUILDDIR%\bin"
+if exist "%WEBKITLIBRARIESDIR%\bin\icudt40.dll" xcopy /y /d "%WEBKITLIBRARIESDIR%\bin\icudt40.dll" "%CONFIGURATIONBUILDDIR%\bin"
+if exist "%WEBKITLIBRARIESDIR%\bin\icudt40%LIBRARYCONFIGSUFFIX%.dll" xcopy /y /d "%WEBKITLIBRARIESDIR%\bin\icudt40%LIBRARYCONFIGSUFFIX%.dll" "%CONFIGURATIONBUILDDIR%\bin"
+if exist "%WEBKITLIBRARIESDIR%\bin\icuin40%LIBRARYCONFIGSUFFIX%.dll" xcopy /y /d "%WEBKITLIBRARIESDIR%\bin\icuin40%LIBRARYCONFIGSUFFIX%.dll" "%CONFIGURATIONBUILDDIR%\bin"
+if exist "%WEBKITLIBRARIESDIR%\bin\icuuc40%LIBRARYCONFIGSUFFIX%.dll" xcopy /y /d "%WEBKITLIBRARIESDIR%\bin\icuuc40%LIBRARYCONFIGSUFFIX%.dll" "%CONFIGURATIONBUILDDIR%\bin"
+if exist "%WEBKITLIBRARIESDIR%\bin\icudt42.dll" xcopy /y /d "%WEBKITLIBRARIESDIR%\bin\icudt42.dll" "%CONFIGURATIONBUILDDIR%\bin"
+if exist "%WEBKITLIBRARIESDIR%\bin\icudt42%LIBRARYCONFIGSUFFIX%.dll" xcopy /y /d "%WEBKITLIBRARIESDIR%\bin\icudt42%LIBRARYCONFIGSUFFIX%.dll" "%CONFIGURATIONBUILDDIR%\bin"
+if exist "%WEBKITLIBRARIESDIR%\bin\icuin42%LIBRARYCONFIGSUFFIX%.dll" xcopy /y /d "%WEBKITLIBRARIESDIR%\bin\icuin42%LIBRARYCONFIGSUFFIX%.dll" "%CONFIGURATIONBUILDDIR%\bin"
+if exist "%WEBKITLIBRARIESDIR%\bin\icuuc42%LIBRARYCONFIGSUFFIX%.dll" xcopy /y /d "%WEBKITLIBRARIESDIR%\bin\icuuc42%LIBRARYCONFIGSUFFIX%.dll" "%CONFIGURATIONBUILDDIR%\bin"
+if exist "%WEBKITLIBRARIESDIR%\bin\CoreFoundation%LIBRARYCONFIGSUFFIX%.dll" xcopy /y /d "%WEBKITLIBRARIESDIR%\bin\CoreFoundation%LIBRARYCONFIGSUFFIX%.dll" "%CONFIGURATIONBUILDDIR%\bin"
+if exist "%WEBKITLIBRARIESDIR%\bin\CoreFoundation.resources" xcopy /y /d /e /i "%WEBKITLIBRARIESDIR%\bin\CoreFoundation.resources" "%CONFIGURATIONBUILDDIR%\bin\CoreFoundation.resources"
+if exist "%WEBKITLIBRARIESDIR%\bin\pthreadVC2%LIBRARYCONFIGSUFFIX%.dll" xcopy /y /d "%WEBKITLIBRARIESDIR%\bin\pthreadVC2%LIBRARYCONFIGSUFFIX%.dll" "%CONFIGURATIONBUILDDIR%\bin"
+if exist "%WEBKITLIBRARIESDIR%\bin\objc%LIBRARYCONFIGSUFFIX%.dll" xcopy /y /d "%WEBKITLIBRARIESDIR%\bin\objc%LIBRARYCONFIGSUFFIX%.dll" "%CONFIGURATIONBUILDDIR%\bin"
+if exist "%WEBKITLIBRARIESDIR%\bin\ASL%LIBRARYCONFIGSUFFIX%.dll" xcopy /y /d "%WEBKITLIBRARIESDIR%\bin\ASL%LIBRARYCONFIGSUFFIX%.dll" "%CONFIGURATIONBUILDDIR%\bin"
+if exist "%WEBKITLIBRARIESDIR%\bin\libdispatch%LIBRARYCONFIGSUFFIX%.dll" xcopy /y /d "%WEBKITLIBRARIESDIR%\bin\libdispatch%LIBRARYCONFIGSUFFIX%.dll" "%CONFIGURATIONBUILDDIR%\bin"
+
+cmd /c
diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/jsc/jscPreBuild.cmd b/Source/JavaScriptCore/JavaScriptCore.vcproj/jsc/jscPreBuild.cmd
new file mode 100644
index 0000000..a770776
--- /dev/null
+++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/jsc/jscPreBuild.cmd
@@ -0,0 +1,6 @@
+%SystemDrive%\cygwin\bin\which.exe bash
+if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
+cmd /c
+if exist "%CONFIGURATIONBUILDDIR%\buildfailed" grep XX%PROJECTNAME%XX "%CONFIGURATIONBUILDDIR%\buildfailed"
+if errorlevel 1 exit 1
+echo XX%PROJECTNAME%XX > "%CONFIGURATIONBUILDDIR%\buildfailed"
diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/jsc/jscPreLink.cmd b/Source/JavaScriptCore/JavaScriptCore.vcproj/jsc/jscPreLink.cmd
new file mode 100644
index 0000000..8523026
--- /dev/null
+++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/jsc/jscPreLink.cmd
@@ -0,0 +1,9 @@
+mkdir 2>NUL "%INTDIR%\lib"
+
+if exist "%WEBKITLIBRARIESDIR%\lib\icuuc%LIBRARYCONFIGSUFFIX%.lib" copy /y "%WEBKITLIBRARIESDIR%\lib\icuuc%LIBRARYCONFIGSUFFIX%.lib" "%INTDIR%\lib\libicuuc%LIBRARYCONFIGSUFFIX%.lib"
+if exist "%WEBKITLIBRARIESDIR%\lib\icuin%LIBRARYCONFIGSUFFIX%.lib" copy /y "%WEBKITLIBRARIESDIR%\lib\icuin%LIBRARYCONFIGSUFFIX%.lib" "%INTDIR%\lib\libicuin%LIBRARYCONFIGSUFFIX%.lib"
+
+if exist "%WEBKITLIBRARIESDIR%\lib\libicuuc%LIBRARYCONFIGSUFFIX%.lib" copy /y "%WEBKITLIBRARIESDIR%\lib\libicuuc%LIBRARYCONFIGSUFFIX%.lib" "%INTDIR%\lib"
+if exist "%WEBKITLIBRARIESDIR%\lib\libicuin%LIBRARYCONFIGSUFFIX%.lib" copy /y "%WEBKITLIBRARIESDIR%\lib\libicuin%LIBRARYCONFIGSUFFIX%.lib" "%INTDIR%\lib"
+
+cmd /c
diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/testapi/testapi.vcproj b/Source/JavaScriptCore/JavaScriptCore.vcproj/testapi/testapi.vcproj
new file mode 100644
index 0000000..5b18032
--- /dev/null
+++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/testapi/testapi.vcproj
@@ -0,0 +1,448 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="testapi"
+ ProjectGUID="{1AFD081F-1AC7-4A97-8EFA-6DF97761A3A2}"
+ RootNamespace="testapi"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops;.\testapiCommon.vsprops;..\JavaScriptCore\JavaScriptCoreCF.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops;.\testapiCommon.vsprops;..\JavaScriptCore\JavaScriptCoreCF.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug_Cairo_CFLite|Win32"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\debug_wincairo.vsprops;.\testapiCommon.vsprops;..\JavaScriptCore\JavaScriptCoreCFLite.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release_Cairo_CFLite|Win32"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\WinCairo.vsprops;.\testapiCommon.vsprops;..\JavaScriptCore\JavaScriptCoreCFLite.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug_All|Win32"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops;.\testapiCommon.vsprops;..\JavaScriptCore\JavaScriptCoreCF.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\debug_all.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release_LTCG|Win32"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops;.\testapiCommon.vsprops;..\JavaScriptCore\JavaScriptCoreCF.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath="..\..\API\tests\testapi.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ CompileAs="2"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ CompileAs="2"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug_Cairo_CFLite|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ CompileAs="2"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release_Cairo_CFLite|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ CompileAs="2"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug_All|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ CompileAs="2"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release_LTCG|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ CompileAs="2"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\API\tests\testapi.js"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/testapi/testapiCommon.vsprops b/Source/JavaScriptCore/JavaScriptCore.vcproj/testapi/testapiCommon.vsprops
new file mode 100644
index 0000000..83c9007
--- /dev/null
+++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/testapi/testapiCommon.vsprops
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioPropertySheet
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="testapiCommon"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="&quot;$(ProjectDir)\..\..\API&quot;;&quot;$(ConfigurationBuildDir)\include\WebCore\ForwardingHeaders&quot;;&quot;$(ConfigurationBuildDir)\include\JavaScriptCore&quot;;&quot;$(ConfigurationBuildDir)\include\private\JavaScriptCore&quot;;&quot;$(ConfigurationBuildDir)\include&quot;;&quot;$(ConfigurationBuildDir)\include\private&quot;;&quot;$(WebKitLibrariesDir)\include&quot;;&quot;$(WebKitLibrariesDir)\include\private&quot;"
+ WarningLevel="4"
+ Detect64BitPortabilityProblems="true"
+ ForcedIncludeFiles="ICUVersion.h"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="JavaScriptCore$(WebKitDLLConfigSuffix).lib WTF$(WebKitConfigSuffix).lib pthreadVC2$(LibraryConfigSuffix).lib libicuin$(LibraryConfigSuffix).lib libicuuc$(LibraryConfigSuffix).lib"
+ AdditionalLibraryDirectories="&quot;$(IntDir)\lib&quot;"
+ SubSystem="1"
+ />
+</VisualStudioPropertySheet>
diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/testapi/testapiPostBuild.cmd b/Source/JavaScriptCore/JavaScriptCore.vcproj/testapi/testapiPostBuild.cmd
new file mode 100644
index 0000000..0820433
--- /dev/null
+++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/testapi/testapiPostBuild.cmd
@@ -0,0 +1,3 @@
+if exist "%CONFIGURATIONBUILDDIR%\buildfailed" del "%CONFIGURATIONBUILDDIR%\buildfailed"
+
+xcopy /y /d "%PROJECTDIR%\..\..\API\tests\testapi.js" "%OUTDIR%"
diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/testapi/testapiPreBuild.cmd b/Source/JavaScriptCore/JavaScriptCore.vcproj/testapi/testapiPreBuild.cmd
new file mode 100644
index 0000000..a770776
--- /dev/null
+++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/testapi/testapiPreBuild.cmd
@@ -0,0 +1,6 @@
+%SystemDrive%\cygwin\bin\which.exe bash
+if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
+cmd /c
+if exist "%CONFIGURATIONBUILDDIR%\buildfailed" grep XX%PROJECTNAME%XX "%CONFIGURATIONBUILDDIR%\buildfailed"
+if errorlevel 1 exit 1
+echo XX%PROJECTNAME%XX > "%CONFIGURATIONBUILDDIR%\buildfailed"
diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/testapi/testapiPreLink.cmd b/Source/JavaScriptCore/JavaScriptCore.vcproj/testapi/testapiPreLink.cmd
new file mode 100644
index 0000000..8523026
--- /dev/null
+++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/testapi/testapiPreLink.cmd
@@ -0,0 +1,9 @@
+mkdir 2>NUL "%INTDIR%\lib"
+
+if exist "%WEBKITLIBRARIESDIR%\lib\icuuc%LIBRARYCONFIGSUFFIX%.lib" copy /y "%WEBKITLIBRARIESDIR%\lib\icuuc%LIBRARYCONFIGSUFFIX%.lib" "%INTDIR%\lib\libicuuc%LIBRARYCONFIGSUFFIX%.lib"
+if exist "%WEBKITLIBRARIESDIR%\lib\icuin%LIBRARYCONFIGSUFFIX%.lib" copy /y "%WEBKITLIBRARIESDIR%\lib\icuin%LIBRARYCONFIGSUFFIX%.lib" "%INTDIR%\lib\libicuin%LIBRARYCONFIGSUFFIX%.lib"
+
+if exist "%WEBKITLIBRARIESDIR%\lib\libicuuc%LIBRARYCONFIGSUFFIX%.lib" copy /y "%WEBKITLIBRARIESDIR%\lib\libicuuc%LIBRARYCONFIGSUFFIX%.lib" "%INTDIR%\lib"
+if exist "%WEBKITLIBRARIESDIR%\lib\libicuin%LIBRARYCONFIGSUFFIX%.lib" copy /y "%WEBKITLIBRARIESDIR%\lib\libicuin%LIBRARYCONFIGSUFFIX%.lib" "%INTDIR%\lib"
+
+cmd /c
diff --git a/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj b/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
new file mode 100644
index 0000000..414f8b1
--- /dev/null
+++ b/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
@@ -0,0 +1,3197 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 42;
+ objects = {
+
+/* Begin PBXAggregateTarget section */
+ 65FB3F6609D11E9100F49DEB /* Derived Sources */ = {
+ isa = PBXAggregateTarget;
+ buildConfigurationList = 65FB3F7709D11EBD00F49DEB /* Build configuration list for PBXAggregateTarget "Derived Sources" */;
+ buildPhases = (
+ 65FB3F6509D11E9100F49DEB /* Generate Derived Sources */,
+ 5D35DEE10C7C140B008648B2 /* Generate DTrace header */,
+ );
+ name = "Derived Sources";
+ productName = "Derived Sources";
+ };
+ 932F5BE30822A1C700736975 /* All */ = {
+ isa = PBXAggregateTarget;
+ buildConfigurationList = 149C276C08902AFE008A9EFC /* Build configuration list for PBXAggregateTarget "All" */;
+ buildPhases = (
+ );
+ dependencies = (
+ 932F5BE70822A1C700736975 /* PBXTargetDependency */,
+ 141214BF0A49190E00480255 /* PBXTargetDependency */,
+ 932F5BE90822A1C700736975 /* PBXTargetDependency */,
+ 14BD59C70A3E8FA400BAF59C /* PBXTargetDependency */,
+ );
+ name = All;
+ productName = All;
+ };
+/* End PBXAggregateTarget section */
+
+/* Begin PBXBuildFile section */
+ 06D358B30DAADAA4003B174E /* MainThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 06D358A20DAAD9C4003B174E /* MainThread.cpp */; };
+ 06D358B40DAADAAA003B174E /* MainThreadMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 06D358A10DAAD9C4003B174E /* MainThreadMac.mm */; };
+ 081469491264378500DFF935 /* StringBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = 081469481264375E00DFF935 /* StringBuilder.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 088FA5BB0EF76D4300578E6F /* RandomNumber.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 088FA5B90EF76D4300578E6F /* RandomNumber.cpp */; };
+ 088FA5BC0EF76D4300578E6F /* RandomNumber.h in Headers */ = {isa = PBXBuildFile; fileRef = 088FA5BA0EF76D4300578E6F /* RandomNumber.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 08CABBA61265AB3900B206CE /* StringConcatenate.h in Headers */ = {isa = PBXBuildFile; fileRef = 0896C29E1265AB0900B1CDD3 /* StringConcatenate.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 08DDA5C11264631700751732 /* UStringBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = 08DDA5BB12645F1D00751732 /* UStringBuilder.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 08E279E90EF83B10007DB523 /* RandomNumberSeed.h in Headers */ = {isa = PBXBuildFile; fileRef = 08E279E80EF83B10007DB523 /* RandomNumberSeed.h */; };
+ 0B330C270F38C62300692DE3 /* TypeTraits.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0B330C260F38C62300692DE3 /* TypeTraits.cpp */; };
+ 0B4D7E630F319AC800AD7E58 /* TypeTraits.h in Headers */ = {isa = PBXBuildFile; fileRef = 0B4D7E620F319AC800AD7E58 /* TypeTraits.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 0BDFFAE00FC6192900D69EF4 /* CrossThreadRefCounted.h in Headers */ = {isa = PBXBuildFile; fileRef = 0BDFFAD40FC6171000D69EF4 /* CrossThreadRefCounted.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 0BDFFAE10FC6193100D69EF4 /* OwnFastMallocPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = 0BDFFAD10FC616EC00D69EF4 /* OwnFastMallocPtr.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 0BF28A2911A33DC300638F84 /* SizeLimits.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0BF28A2811A33DC300638F84 /* SizeLimits.cpp */; };
+ 0F29479C126E698C00B3ABF5 /* DecimalNumber.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F29479B126E698C00B3ABF5 /* DecimalNumber.cpp */; };
+ 1400067712A6F7830064D123 /* OSAllocator.h in Headers */ = {isa = PBXBuildFile; fileRef = 1400067612A6F7830064D123 /* OSAllocator.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 1400069312A6F9E10064D123 /* OSAllocatorPosix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1400069212A6F9E10064D123 /* OSAllocatorPosix.cpp */; };
+ 14035DB110DBFB2A00FFFFE7 /* WeakGCPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = 14035DB010DBFB2A00FFFFE7 /* WeakGCPtr.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 140566C4107EC255005DBC8D /* JSAPIValueWrapper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC0894D50FAFBA2D00001865 /* JSAPIValueWrapper.cpp */; };
+ 140566D1107EC267005DBC8D /* JSStaticScopeObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7E42C190E3938830065A544 /* JSStaticScopeObject.cpp */; };
+ 140566D6107EC271005DBC8D /* JSFunction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F692A85E0255597D01FF60F7 /* JSFunction.cpp */; };
+ 140B7D1D0DC69AF7009C42B8 /* JSActivation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14DA818F0D99FD2000B0A4FB /* JSActivation.cpp */; };
+ 140D17D70E8AD4A9000CD17D /* JSBasePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 140D17D60E8AD4A9000CD17D /* JSBasePrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 141211310A48794D00480255 /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 932F5BD90822A1C700736975 /* JavaScriptCore.framework */; };
+ 141211340A48795800480255 /* minidom.c in Sources */ = {isa = PBXBuildFile; fileRef = 141211020A48780900480255 /* minidom.c */; };
+ 1420BE7B10AA6DDB00F455D2 /* WeakRandom.h in Headers */ = {isa = PBXBuildFile; fileRef = 1420BE7A10AA6DDB00F455D2 /* WeakRandom.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 1421359B0A677F4F00A8195E /* JSBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1421359A0A677F4F00A8195E /* JSBase.cpp */; };
+ 14280823107EC02C0013E7B2 /* Debugger.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F692A8580255597D01FF60F7 /* Debugger.cpp */; };
+ 1428082D107EC0570013E7B2 /* CallData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCA62DFE0E2826230004F30D /* CallData.cpp */; };
+ 1428082E107EC0570013E7B2 /* ConstructData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCA62DFF0E2826310004F30D /* ConstructData.cpp */; };
+ 1428083A107EC0750013E7B2 /* RegisterFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1429D85B0ED218E900B89619 /* RegisterFile.cpp */; };
+ 14280841107EC0930013E7B2 /* RegExp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F692A87D0255597D01FF60F7 /* RegExp.cpp */; };
+ 14280842107EC0930013E7B2 /* RegExpConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCD202BD0E1706A7002C7E82 /* RegExpConstructor.cpp */; };
+ 14280843107EC0930013E7B2 /* RegExpObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F692A87B0255597D01FF60F7 /* RegExpObject.cpp */; };
+ 14280844107EC0930013E7B2 /* RegExpPrototype.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCD202BF0E1706A7002C7E82 /* RegExpPrototype.cpp */; };
+ 14280850107EC0D70013E7B2 /* Operations.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F692A8770255597D01FF60F7 /* Operations.cpp */; };
+ 14280855107EC0E70013E7B2 /* GetterSetter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC02E9B80E184545000F9297 /* GetterSetter.cpp */; };
+ 1428085D107EC0F80013E7B2 /* JSNumberCell.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC02E9B90E184580000F9297 /* JSNumberCell.cpp */; };
+ 14280863107EC11A0013E7B2 /* BooleanConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC7952320E15EB5600A898AB /* BooleanConstructor.cpp */; };
+ 14280864107EC11A0013E7B2 /* BooleanObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F692A8500255597D01FF60F7 /* BooleanObject.cpp */; };
+ 14280865107EC11A0013E7B2 /* BooleanPrototype.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC7952340E15EB5600A898AB /* BooleanPrototype.cpp */; };
+ 14280870107EC1340013E7B2 /* JSWrapperObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65C7A1710A8EAACB00FA37EA /* JSWrapperObject.cpp */; };
+ 14280875107EC13E0013E7B2 /* JSLock.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65EA4C99092AF9E20093D800 /* JSLock.cpp */; };
+ 1429D77C0ED20D7300B89619 /* Interpreter.h in Headers */ = {isa = PBXBuildFile; fileRef = 1429D77B0ED20D7300B89619 /* Interpreter.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 1429D7D40ED2128200B89619 /* Interpreter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1429D7D30ED2128200B89619 /* Interpreter.cpp */; settings = {COMPILER_FLAGS = "-fno-var-tracking"; }; };
+ 1429D8780ED21ACD00B89619 /* ExceptionHelpers.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1429D8770ED21ACD00B89619 /* ExceptionHelpers.cpp */; };
+ 1429D8850ED21C3D00B89619 /* SamplingTool.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1429D8830ED21C3D00B89619 /* SamplingTool.cpp */; };
+ 1429D8860ED21C3D00B89619 /* SamplingTool.h in Headers */ = {isa = PBXBuildFile; fileRef = 1429D8840ED21C3D00B89619 /* SamplingTool.h */; };
+ 1429D8DD0ED2205B00B89619 /* CallFrame.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1429D8DB0ED2205B00B89619 /* CallFrame.cpp */; };
+ 1429D8DE0ED2205B00B89619 /* CallFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 1429D8DC0ED2205B00B89619 /* CallFrame.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 1429D92F0ED22D7000B89619 /* JIT.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1429D92D0ED22D7000B89619 /* JIT.cpp */; };
+ 1429D9300ED22D7000B89619 /* JIT.h in Headers */ = {isa = PBXBuildFile; fileRef = 1429D92E0ED22D7000B89619 /* JIT.h */; };
+ 142D3939103E4560007DCB52 /* NumericStrings.h in Headers */ = {isa = PBXBuildFile; fileRef = 142D3938103E4560007DCB52 /* NumericStrings.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 143A97E60A4A06E200456B66 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6560A4CF04B3B3E7008AE952 /* CoreFoundation.framework */; };
+ 1440057F0A5335640005F061 /* JSNode.c in Sources */ = {isa = PBXBuildFile; fileRef = 1440F6420A4F8B6A0005F061 /* JSNode.c */; };
+ 144005CB0A5338D10005F061 /* JSNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 1440F6410A4F8B6A0005F061 /* JSNode.h */; };
+ 144005CC0A5338F80005F061 /* Node.h in Headers */ = {isa = PBXBuildFile; fileRef = 1440051F0A531D3B0005F061 /* Node.h */; };
+ 1440063F0A53598A0005F061 /* Node.c in Sources */ = {isa = PBXBuildFile; fileRef = 144005200A531D3B0005F061 /* Node.c */; };
+ 1440074A0A536CC20005F061 /* NodeList.h in Headers */ = {isa = PBXBuildFile; fileRef = 144007480A536CC20005F061 /* NodeList.h */; };
+ 1440074B0A536CC20005F061 /* NodeList.c in Sources */ = {isa = PBXBuildFile; fileRef = 144007490A536CC20005F061 /* NodeList.c */; };
+ 144007570A5370D20005F061 /* JSNodeList.h in Headers */ = {isa = PBXBuildFile; fileRef = 144007550A5370D20005F061 /* JSNodeList.h */; };
+ 144007580A5370D20005F061 /* JSNodeList.c in Sources */ = {isa = PBXBuildFile; fileRef = 144007560A5370D20005F061 /* JSNodeList.c */; };
+ 1440F6100A4F85670005F061 /* testapi.c in Sources */ = {isa = PBXBuildFile; fileRef = 14BD5A2D0A3E91F600BAF59C /* testapi.c */; };
+ 1440F8920A508B100005F061 /* JSCallbackFunction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1440F8900A508B100005F061 /* JSCallbackFunction.cpp */; };
+ 1440F8AF0A508D200005F061 /* JSCallbackConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1440F8AD0A508D200005F061 /* JSCallbackConstructor.cpp */; };
+ 1440FCE40A51E46B0005F061 /* JSClassRef.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1440FCE20A51E46B0005F061 /* JSClassRef.cpp */; };
+ 14469DD7107EC79E00650446 /* dtoa.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 651F6412039D5B5F0078395C /* dtoa.cpp */; };
+ 14469DDE107EC7E700650446 /* Lookup.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F692A8680255597D01FF60F7 /* Lookup.cpp */; };
+ 14469DDF107EC7E700650446 /* MathObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F692A86A0255597D01FF60F7 /* MathObject.cpp */; };
+ 14469DE0107EC7E700650446 /* NativeErrorConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC02E9080E1839DB000F9297 /* NativeErrorConstructor.cpp */; };
+ 14469DE1107EC7E700650446 /* NativeErrorPrototype.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC02E90A0E1839DB000F9297 /* NativeErrorPrototype.cpp */; };
+ 14469DE2107EC7E700650446 /* NumberConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC2680C20E16D4E900A06E92 /* NumberConstructor.cpp */; };
+ 14469DE3107EC7E700650446 /* NumberObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F692A8700255597D01FF60F7 /* NumberObject.cpp */; };
+ 14469DE4107EC7E700650446 /* NumberPrototype.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC2680C40E16D4E900A06E92 /* NumberPrototype.cpp */; };
+ 14469DE5107EC7E700650446 /* ObjectConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC2680C60E16D4E900A06E92 /* ObjectConstructor.cpp */; };
+ 14469DE6107EC7E700650446 /* ObjectPrototype.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC2680C80E16D4E900A06E92 /* ObjectPrototype.cpp */; };
+ 14469DE7107EC7E700650446 /* PropertyNameArray.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65400C0F0A69BAF200509887 /* PropertyNameArray.cpp */; };
+ 14469DE8107EC7E700650446 /* PropertySlot.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65621E6B089E859700760F35 /* PropertySlot.cpp */; };
+ 14469DE9107EC7E700650446 /* PrototypeFunction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC257DF10E1F53740016B6C9 /* PrototypeFunction.cpp */; };
+ 14469DEA107EC7E700650446 /* ScopeChain.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9374D3A8038D9D74008635CE /* ScopeChain.cpp */; };
+ 14469DEB107EC7E700650446 /* StringConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC18C3C00E16EE3300B34460 /* StringConstructor.cpp */; };
+ 14469DEC107EC7E700650446 /* StringObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC18C3C20E16EE3300B34460 /* StringObject.cpp */; };
+ 14469DED107EC7E700650446 /* StringPrototype.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC18C3C50E16EE3300B34460 /* StringPrototype.cpp */; };
+ 14469DEE107EC7E700650446 /* UString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F692A8850255597D01FF60F7 /* UString.cpp */; };
+ 146AAB380B66A94400E55F16 /* JSStringRefCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 146AAB370B66A94400E55F16 /* JSStringRefCF.cpp */; };
+ 146FE51211A710430087AE66 /* JITCall32_64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 146FE51111A710430087AE66 /* JITCall32_64.cpp */; };
+ 147B83AC0E6DB8C9004775A4 /* BatchedTransitionOptimizer.h in Headers */ = {isa = PBXBuildFile; fileRef = 147B83AA0E6DB8C9004775A4 /* BatchedTransitionOptimizer.h */; };
+ 147B84630E6DE6B1004775A4 /* PutPropertySlot.h in Headers */ = {isa = PBXBuildFile; fileRef = 147B84620E6DE6B1004775A4 /* PutPropertySlot.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 147F39BD107EC37600427A48 /* ArgList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCF605110E203EF800B9A64D /* ArgList.cpp */; };
+ 147F39BE107EC37600427A48 /* Arguments.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC257DE50E1F51C50016B6C9 /* Arguments.cpp */; };
+ 147F39BF107EC37600427A48 /* ArrayConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC7952060E15E8A800A898AB /* ArrayConstructor.cpp */; };
+ 147F39C0107EC37600427A48 /* ArrayPrototype.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F692A84D0255597D01FF60F7 /* ArrayPrototype.cpp */; };
+ 147F39C1107EC37600427A48 /* CommonIdentifiers.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65EA73620BAE35D1001BB560 /* CommonIdentifiers.cpp */; };
+ 147F39C2107EC37600427A48 /* Completion.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 969A09220ED1E09C00F1F681 /* Completion.cpp */; };
+ 147F39C3107EC37600427A48 /* DateConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCD203450E17135E002C7E82 /* DateConstructor.cpp */; };
+ 147F39C4107EC37600427A48 /* DateConversion.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D21202280AD4310C00ED79B6 /* DateConversion.cpp */; };
+ 147F39C5107EC37600427A48 /* DateInstance.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC1166000E1997B1008066DD /* DateInstance.cpp */; };
+ 147F39C6107EC37600427A48 /* DatePrototype.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCD203470E17135E002C7E82 /* DatePrototype.cpp */; };
+ 147F39C7107EC37600427A48 /* Error.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC337BEA0E1B00CB0076918A /* Error.cpp */; };
+ 147F39C8107EC37600427A48 /* ErrorConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC02E9040E1839DB000F9297 /* ErrorConstructor.cpp */; };
+ 147F39C9107EC37600427A48 /* ErrorInstance.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC02E98A0E183E38000F9297 /* ErrorInstance.cpp */; };
+ 147F39CA107EC37600427A48 /* ErrorPrototype.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC02E9060E1839DB000F9297 /* ErrorPrototype.cpp */; };
+ 147F39CB107EC37600427A48 /* FunctionConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC2680C00E16D4E900A06E92 /* FunctionConstructor.cpp */; };
+ 147F39CC107EC37600427A48 /* FunctionPrototype.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F692A85C0255597D01FF60F7 /* FunctionPrototype.cpp */; };
+ 147F39CD107EC37600427A48 /* GlobalEvalFunction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC257DED0E1F52ED0016B6C9 /* GlobalEvalFunction.cpp */; };
+ 147F39CE107EC37600427A48 /* Identifier.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 933A349D038AE80F008635CE /* Identifier.cpp */; };
+ 147F39CF107EC37600427A48 /* InternalFunction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC9BB95B0E19680600DF8855 /* InternalFunction.cpp */; };
+ 147F39D0107EC37600427A48 /* JSArray.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93ADFCE60CCBD7AC00D30B08 /* JSArray.cpp */; };
+ 147F39D1107EC37600427A48 /* JSCell.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC7F8FBA0E19D1EF008632C0 /* JSCell.cpp */; };
+ 147F39D2107EC37600427A48 /* JSGlobalObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14DE0D680D02431400AACCA2 /* JSGlobalObject.cpp */; };
+ 147F39D3107EC37600427A48 /* JSImmediate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14760863099C633800437128 /* JSImmediate.cpp */; };
+ 147F39D4107EC37600427A48 /* JSObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC22A3980E16E14800AF21C8 /* JSObject.cpp */; };
+ 147F39D5107EC37600427A48 /* JSString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC02E9B60E1842FA000F9297 /* JSString.cpp */; };
+ 147F39D6107EC37600427A48 /* JSValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F692A8870255597D01FF60F7 /* JSValue.cpp */; };
+ 147F39D7107EC37600427A48 /* JSVariableObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC22A39A0E16E14800AF21C8 /* JSVariableObject.cpp */; };
+ 1482B74E0A43032800517CFC /* JSStringRef.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1482B74C0A43032800517CFC /* JSStringRef.cpp */; };
+ 1482B7E40A43076000517CFC /* JSObjectRef.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1482B7E20A43076000517CFC /* JSObjectRef.cpp */; };
+ 148CD1D8108CF902008163C6 /* JSContextRefPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 148CD1D7108CF902008163C6 /* JSContextRefPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 148F21AA107EC53A0042EC2C /* BytecodeGenerator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 969A07200ED1CE3300F1F681 /* BytecodeGenerator.cpp */; };
+ 148F21B0107EC5410042EC2C /* Lexer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F692A8650255597D01FF60F7 /* Lexer.cpp */; };
+ 148F21B7107EC5470042EC2C /* Nodes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F692A86D0255597D01FF60F7 /* Nodes.cpp */; };
+ 148F21BC107EC54D0042EC2C /* Parser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93F0B3A909BB4DC00068FCE3 /* Parser.cpp */; };
+ 149559EE0DDCDDF700648087 /* DebuggerCallFrame.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 149559ED0DDCDDF700648087 /* DebuggerCallFrame.cpp */; };
+ 14A1563210966365006FA260 /* DateInstanceCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 14A1563010966365006FA260 /* DateInstanceCache.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 14A23D750F4E1ABB0023CDAD /* JITStubs.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14A23D6C0F4E19CE0023CDAD /* JITStubs.cpp */; };
+ 14A42E3F0F4F60EE00599099 /* TimeoutChecker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14A42E3D0F4F60EE00599099 /* TimeoutChecker.cpp */; };
+ 14A42E400F4F60EE00599099 /* TimeoutChecker.h in Headers */ = {isa = PBXBuildFile; fileRef = 14A42E3E0F4F60EE00599099 /* TimeoutChecker.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 14ABDF600A437FEF00ECCA01 /* JSCallbackObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14ABDF5E0A437FEF00ECCA01 /* JSCallbackObject.cpp */; };
+ 14B3EF0512BC24DD00D29EFF /* PageBlock.h in Headers */ = {isa = PBXBuildFile; fileRef = 14B3EF0312BC24DD00D29EFF /* PageBlock.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 14B3EF0612BC24DD00D29EFF /* PageBlock.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14B3EF0412BC24DD00D29EFF /* PageBlock.cpp */; };
+ 14B8EC720A5652090062BE54 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6560A4CF04B3B3E7008AE952 /* CoreFoundation.framework */; };
+ 14BD59C50A3E8F9F00BAF59C /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 932F5BD90822A1C700736975 /* JavaScriptCore.framework */; };
+ 14BD5A300A3E91F600BAF59C /* JSContextRef.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14BD5A290A3E91F600BAF59C /* JSContextRef.cpp */; };
+ 14BD5A320A3E91F600BAF59C /* JSValueRef.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14BD5A2B0A3E91F600BAF59C /* JSValueRef.cpp */; };
+ 14BFCE6910CDB1FC00364CCE /* WeakGCMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 14BFCE6810CDB1FC00364CCE /* WeakGCMap.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 14C5242B0F5355E900BA3D04 /* JITStubs.h in Headers */ = {isa = PBXBuildFile; fileRef = 14A6581A0F4E36F4000150FD /* JITStubs.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 14E9D17B107EC469004DDA21 /* JSGlobalObjectFunctions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC756FC60E2031B200DE7D12 /* JSGlobalObjectFunctions.cpp */; };
+ 14F3488F0E95EF8A003648BC /* CollectorHeapIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = 14F3488E0E95EF8A003648BC /* CollectorHeapIterator.h */; settings = {ATTRIBUTES = (); }; };
+ 14F8BA3E107EC886009892DC /* FastMalloc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65E217B908E7EECC0023E5F6 /* FastMalloc.cpp */; };
+ 14F8BA43107EC88C009892DC /* TCSystemAlloc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6541BD7008E80A17002CBEE7 /* TCSystemAlloc.cpp */; };
+ 14F8BA4F107EC899009892DC /* Collector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F692A8520255597D01FF60F7 /* Collector.cpp */; };
+ 14FFF98C12BFFF7500795BB8 /* PageAllocationAligned.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14FFF98A12BFFF7500795BB8 /* PageAllocationAligned.cpp */; };
+ 14FFF98D12BFFF7500795BB8 /* PageAllocationAligned.h in Headers */ = {isa = PBXBuildFile; fileRef = 14FFF98B12BFFF7500795BB8 /* PageAllocationAligned.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 180B9B080F16D94F009BDBC5 /* CurrentTime.h in Headers */ = {isa = PBXBuildFile; fileRef = 180B9AF00F16C569009BDBC5 /* CurrentTime.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 180B9BFE0F16E94D009BDBC5 /* CurrentTime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 180B9AEF0F16C569009BDBC5 /* CurrentTime.cpp */; };
+ 18BAB55310DAE054000D945B /* ThreadIdentifierDataPthreads.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18BAB52710DADFCD000D945B /* ThreadIdentifierDataPthreads.cpp */; };
+ 18BAB55410DAE066000D945B /* ThreadIdentifierDataPthreads.h in Headers */ = {isa = PBXBuildFile; fileRef = 18BAB52810DADFCD000D945B /* ThreadIdentifierDataPthreads.h */; };
+ 1C61516C0EBAC7A00031376F /* ProfilerServer.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1C61516A0EBAC7A00031376F /* ProfilerServer.mm */; settings = {COMPILER_FLAGS = "-fno-strict-aliasing"; }; };
+ 1C61516D0EBAC7A00031376F /* ProfilerServer.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C61516B0EBAC7A00031376F /* ProfilerServer.h */; };
+ 41359CF30FDD89AD00206180 /* DateConversion.h in Headers */ = {isa = PBXBuildFile; fileRef = D21202290AD4310C00ED79B6 /* DateConversion.h */; };
+ 41359CF60FDD89CB00206180 /* DateMath.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41359CF40FDD89CB00206180 /* DateMath.cpp */; };
+ 41359CF70FDD89CB00206180 /* DateMath.h in Headers */ = {isa = PBXBuildFile; fileRef = 41359CF50FDD89CB00206180 /* DateMath.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 4409D8470FAF80A200523B87 /* OwnPtrCommon.h in Headers */ = {isa = PBXBuildFile; fileRef = 440B7AED0FAF7FCB0073323E /* OwnPtrCommon.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 44DD48530FAEA85000D6B4EB /* PassOwnPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = 44DD48520FAEA85000D6B4EB /* PassOwnPtr.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 511FC4C9117EE28700425272 /* MD5.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 511FC4C7117EE23D00425272 /* MD5.cpp */; };
+ 511FC4CB117EE2A800425272 /* MD5.h in Headers */ = {isa = PBXBuildFile; fileRef = 511FC4CA117EE2A800425272 /* MD5.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 5135FAF212D26ACE003C083B /* Decoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 5135FAD512D26856003C083B /* Decoder.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 5135FAF312D26AD1003C083B /* Encoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 5135FAD612D26856003C083B /* Encoder.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 5D53726F0E1C54880021E549 /* Tracing.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D53726E0E1C54880021E549 /* Tracing.h */; };
+ 5D5D8AB60E0D0A7200F9C692 /* jsc in Copy Into Framework */ = {isa = PBXBuildFile; fileRef = 932F5BE10822A1C700736975 /* jsc */; };
+ 5D5D8AD10E0D0EBE00F9C692 /* libedit.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 5D5D8AD00E0D0EBE00F9C692 /* libedit.dylib */; };
+ 5D63E9AD10F2BD6E00FC8AE9 /* StringHasher.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D63E9AC10F2BD6E00FC8AE9 /* StringHasher.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 5D6A566B0F05995500266145 /* Threading.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5D6A566A0F05995500266145 /* Threading.cpp */; };
+ 5DE6E5B30E1728EC00180407 /* create_hash_table in Headers */ = {isa = PBXBuildFile; fileRef = F692A8540255597D01FF60F7 /* create_hash_table */; settings = {ATTRIBUTES = (); }; };
+ 6507D29E0E871E5E00D7D896 /* JSTypeInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 6507D2970E871E4A00D7D896 /* JSTypeInfo.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 655EB29B10CE2581001A990E /* NodesCodegen.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 655EB29A10CE2581001A990E /* NodesCodegen.cpp */; };
+ 65DFC93308EA173A00F7300B /* HashTable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65DFC92D08EA173A00F7300B /* HashTable.cpp */; };
+ 65E1A3DF122B894500B26097 /* NonCopyingSort.h in Headers */ = {isa = PBXBuildFile; fileRef = 65E1A2F4122B880D00B26097 /* NonCopyingSort.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 65FDE49C0BDD1D4A00E80111 /* Assertions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65E217B808E7EECC0023E5F6 /* Assertions.cpp */; settings = {COMPILER_FLAGS = "-Wno-missing-format-attribute"; }; };
+ 7E4EE7090EBB7963005934AA /* StructureChain.h in Headers */ = {isa = PBXBuildFile; fileRef = 7E4EE7080EBB7963005934AA /* StructureChain.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 7E4EE70F0EBB7A5B005934AA /* StructureChain.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7E4EE70E0EBB7A5B005934AA /* StructureChain.cpp */; };
+ 7EFF00640EC05A9A00AA7C93 /* NodeInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 7EFF00630EC05A9A00AA7C93 /* NodeInfo.h */; };
+ 840480131021A1D9008E7F01 /* JSAPIValueWrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = BC0894D60FAFBA2D00001865 /* JSAPIValueWrapper.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 860161E30F3A83C100F84710 /* AbstractMacroAssembler.h in Headers */ = {isa = PBXBuildFile; fileRef = 860161DF0F3A83C100F84710 /* AbstractMacroAssembler.h */; };
+ 860161E40F3A83C100F84710 /* MacroAssemblerX86.h in Headers */ = {isa = PBXBuildFile; fileRef = 860161E00F3A83C100F84710 /* MacroAssemblerX86.h */; };
+ 860161E50F3A83C100F84710 /* MacroAssemblerX86_64.h in Headers */ = {isa = PBXBuildFile; fileRef = 860161E10F3A83C100F84710 /* MacroAssemblerX86_64.h */; };
+ 860161E60F3A83C100F84710 /* MacroAssemblerX86Common.h in Headers */ = {isa = PBXBuildFile; fileRef = 860161E20F3A83C100F84710 /* MacroAssemblerX86Common.h */; };
+ 8626BECF11928E3900782FAB /* StringStatics.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8626BECE11928E3900782FAB /* StringStatics.cpp */; };
+ 8627E5EC11F1281900A313B5 /* PageAllocation.h in Headers */ = {isa = PBXBuildFile; fileRef = 8627E5EA11F1281900A313B5 /* PageAllocation.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 862AF4B612239C7B0024E5B8 /* DecimalNumber.h in Headers */ = {isa = PBXBuildFile; fileRef = 862AF4B512239C7B0024E5B8 /* DecimalNumber.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 863B23E00FC6118900703AA4 /* MacroAssemblerCodeRef.h in Headers */ = {isa = PBXBuildFile; fileRef = 863B23DF0FC60E6200703AA4 /* MacroAssemblerCodeRef.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 86438FC41265503E00E0DFCA /* StringBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86438FC31265503E00E0DFCA /* StringBuilder.cpp */; };
+ 86565742115BE3DA00291F40 /* CString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86565740115BE3DA00291F40 /* CString.cpp */; };
+ 86565743115BE3DA00291F40 /* CString.h in Headers */ = {isa = PBXBuildFile; fileRef = 86565741115BE3DA00291F40 /* CString.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 865F408810E7D56300947361 /* APIShims.h in Headers */ = {isa = PBXBuildFile; fileRef = 865F408710E7D56300947361 /* APIShims.h */; };
+ 86676D5211FED9BC004B6863 /* BumpPointerAllocator.h in Headers */ = {isa = PBXBuildFile; fileRef = 86676D4D11FED55D004B6863 /* BumpPointerAllocator.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 868BFA08117CEFD100B908B1 /* AtomicString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 868BFA00117CEFD100B908B1 /* AtomicString.cpp */; };
+ 868BFA09117CEFD100B908B1 /* AtomicString.h in Headers */ = {isa = PBXBuildFile; fileRef = 868BFA01117CEFD100B908B1 /* AtomicString.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 868BFA0A117CEFD100B908B1 /* AtomicStringImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = 868BFA02117CEFD100B908B1 /* AtomicStringImpl.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 868BFA0D117CEFD100B908B1 /* StringHash.h in Headers */ = {isa = PBXBuildFile; fileRef = 868BFA05117CEFD100B908B1 /* StringHash.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 868BFA0E117CEFD100B908B1 /* StringImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 868BFA06117CEFD100B908B1 /* StringImpl.cpp */; };
+ 868BFA0F117CEFD100B908B1 /* StringImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = 868BFA07117CEFD100B908B1 /* StringImpl.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 868BFA17117CF19900B908B1 /* WTFString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 868BFA15117CF19900B908B1 /* WTFString.cpp */; };
+ 868BFA18117CF19900B908B1 /* WTFString.h in Headers */ = {isa = PBXBuildFile; fileRef = 868BFA16117CF19900B908B1 /* WTFString.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 868BFA60117D048200B908B1 /* StaticConstructors.h in Headers */ = {isa = PBXBuildFile; fileRef = 868BFA5F117D048200B908B1 /* StaticConstructors.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 868D81A212C428CE0093DC84 /* RegexPattern.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 868D81A112C428CE0093DC84 /* RegexPattern.cpp */; };
+ 8690231512092D5C00630AF9 /* PageReservation.h in Headers */ = {isa = PBXBuildFile; fileRef = 8690231412092D5C00630AF9 /* PageReservation.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 869D04AF1193B54D00803475 /* CachedTranscendentalFunction.h in Headers */ = {isa = PBXBuildFile; fileRef = 869D04AE1193B54D00803475 /* CachedTranscendentalFunction.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 869EBCB70E8C6D4A008722CC /* ResultType.h in Headers */ = {isa = PBXBuildFile; fileRef = 869EBCB60E8C6D4A008722CC /* ResultType.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 86A90ED00EE7D51F00AB350D /* JITArithmetic.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86A90ECF0EE7D51F00AB350D /* JITArithmetic.cpp */; };
+ 86ADD1450FDDEA980006EEC2 /* ARMv7Assembler.h in Headers */ = {isa = PBXBuildFile; fileRef = 86ADD1430FDDEA980006EEC2 /* ARMv7Assembler.h */; };
+ 86ADD1460FDDEA980006EEC2 /* MacroAssemblerARMv7.h in Headers */ = {isa = PBXBuildFile; fileRef = 86ADD1440FDDEA980006EEC2 /* MacroAssemblerARMv7.h */; };
+ 86B99AB8117E391E00DF5A90 /* RopeImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86B99AB6117E391E00DF5A90 /* RopeImpl.cpp */; };
+ 86B99AB9117E391E00DF5A90 /* RopeImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = 86B99AB7117E391E00DF5A90 /* RopeImpl.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 86B99AE3117E578100DF5A90 /* StringBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 86B99AE1117E578100DF5A90 /* StringBuffer.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 86B99AE4117E578100DF5A90 /* StringImplBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 86B99AE2117E578100DF5A90 /* StringImplBase.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 86C36EEA0EE1289D00B3DF59 /* MacroAssembler.h in Headers */ = {isa = PBXBuildFile; fileRef = 86C36EE90EE1289D00B3DF59 /* MacroAssembler.h */; };
+ 86C568E011A213EE0007F7F0 /* MacroAssemblerARM.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86C568DD11A213EE0007F7F0 /* MacroAssemblerARM.cpp */; };
+ 86C568E111A213EE0007F7F0 /* MacroAssemblerMIPS.h in Headers */ = {isa = PBXBuildFile; fileRef = 86C568DE11A213EE0007F7F0 /* MacroAssemblerMIPS.h */; };
+ 86C568E211A213EE0007F7F0 /* MIPSAssembler.h in Headers */ = {isa = PBXBuildFile; fileRef = 86C568DF11A213EE0007F7F0 /* MIPSAssembler.h */; };
+ 86CA032E1038E8440028A609 /* Executable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86CA032D1038E8440028A609 /* Executable.cpp */; };
+ 86CAFEE31035DDE60028A609 /* Executable.h in Headers */ = {isa = PBXBuildFile; fileRef = 86CAFEE21035DDE60028A609 /* Executable.h */; settings = {ATTRIBUTES = (); }; };
+ 86CC85A10EE79A4700288682 /* JITInlineMethods.h in Headers */ = {isa = PBXBuildFile; fileRef = 86CC85A00EE79A4700288682 /* JITInlineMethods.h */; };
+ 86CC85A30EE79B7400288682 /* JITCall.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86CC85A20EE79B7400288682 /* JITCall.cpp */; };
+ 86CC85C40EE7A89400288682 /* JITPropertyAccess.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86CC85C30EE7A89400288682 /* JITPropertyAccess.cpp */; };
+ 86CCEFDE0F413F8900FD7F9E /* JITCode.h in Headers */ = {isa = PBXBuildFile; fileRef = 86CCEFDD0F413F8900FD7F9E /* JITCode.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 86D08D5311793613006E5ED0 /* WTFThreadData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86D08D5111793613006E5ED0 /* WTFThreadData.cpp */; };
+ 86D08D5411793613006E5ED0 /* WTFThreadData.h in Headers */ = {isa = PBXBuildFile; fileRef = 86D08D5211793613006E5ED0 /* WTFThreadData.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 86D3B2C310156BDE002865E7 /* ARMAssembler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86D3B2BF10156BDE002865E7 /* ARMAssembler.cpp */; };
+ 86D3B2C410156BDE002865E7 /* ARMAssembler.h in Headers */ = {isa = PBXBuildFile; fileRef = 86D3B2C010156BDE002865E7 /* ARMAssembler.h */; };
+ 86D3B2C510156BDE002865E7 /* AssemblerBufferWithConstantPool.h in Headers */ = {isa = PBXBuildFile; fileRef = 86D3B2C110156BDE002865E7 /* AssemblerBufferWithConstantPool.h */; };
+ 86D3B2C610156BDE002865E7 /* MacroAssemblerARM.h in Headers */ = {isa = PBXBuildFile; fileRef = 86D3B2C210156BDE002865E7 /* MacroAssemblerARM.h */; };
+ 86D3B3C310159D7F002865E7 /* LinkBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 86D3B3C110159D7F002865E7 /* LinkBuffer.h */; };
+ 86D3B3C410159D7F002865E7 /* RepatchBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 86D3B3C210159D7F002865E7 /* RepatchBuffer.h */; };
+ 86D87DAE12BCA7D1008E73A1 /* StackBounds.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86D87DA512BC4B14008E73A1 /* StackBounds.cpp */; };
+ 86D87DDB12BCAF94008E73A1 /* StackBounds.h in Headers */ = {isa = PBXBuildFile; fileRef = 86D87DA612BC4B14008E73A1 /* StackBounds.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 86DB64640F95C6FC00D7D921 /* ExecutableAllocatorFixedVMPool.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86DB64630F95C6FC00D7D921 /* ExecutableAllocatorFixedVMPool.cpp */; };
+ 86E116B10FE75AC800B512BC /* CodeLocation.h in Headers */ = {isa = PBXBuildFile; fileRef = 86E116B00FE75AC800B512BC /* CodeLocation.h */; };
+ 86E85539111B9968001AF51E /* JSStringBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = 86E85538111B9968001AF51E /* JSStringBuilder.h */; };
+ 86EAC4970F93E8D1008EC948 /* RegexInterpreter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86EAC48F0F93E8D1008EC948 /* RegexInterpreter.cpp */; };
+ 86EAC4980F93E8D1008EC948 /* RegexInterpreter.h in Headers */ = {isa = PBXBuildFile; fileRef = 86EAC4900F93E8D1008EC948 /* RegexInterpreter.h */; };
+ 86EAC4990F93E8D1008EC948 /* RegexJIT.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86EAC4910F93E8D1008EC948 /* RegexJIT.cpp */; };
+ 86EAC49A0F93E8D1008EC948 /* RegexJIT.h in Headers */ = {isa = PBXBuildFile; fileRef = 86EAC4920F93E8D1008EC948 /* RegexJIT.h */; };
+ 86EAC49B0F93E8D1008EC948 /* RegexParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 86EAC4930F93E8D1008EC948 /* RegexParser.h */; };
+ 86EAC49C0F93E8D1008EC948 /* RegexPattern.h in Headers */ = {isa = PBXBuildFile; fileRef = 86EAC4940F93E8D1008EC948 /* RegexPattern.h */; };
+ 86F38859121130CA007A7CE3 /* AtomicStringHash.h in Headers */ = {isa = PBXBuildFile; fileRef = 86F38858121130CA007A7CE3 /* AtomicStringHash.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 90213E3D123A40C200D422F3 /* MemoryStatistics.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 90213E3B123A40C200D422F3 /* MemoryStatistics.cpp */; };
+ 90213E3E123A40C200D422F3 /* MemoryStatistics.h in Headers */ = {isa = PBXBuildFile; fileRef = 90213E3C123A40C200D422F3 /* MemoryStatistics.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 905B02AE0E28640F006DF882 /* RefCountedLeakCounter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 905B02AD0E28640F006DF882 /* RefCountedLeakCounter.cpp */; };
+ 90D3469C0E285280009492EE /* RefCountedLeakCounter.h in Headers */ = {isa = PBXBuildFile; fileRef = 90D3469B0E285280009492EE /* RefCountedLeakCounter.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 93052C340FB792190048FDC3 /* ParserArena.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93052C320FB792190048FDC3 /* ParserArena.cpp */; };
+ 93052C350FB792190048FDC3 /* ParserArena.h in Headers */ = {isa = PBXBuildFile; fileRef = 93052C330FB792190048FDC3 /* ParserArena.h */; settings = {ATTRIBUTES = (); }; };
+ 930754C108B0F68000AB3056 /* pcre_compile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 930754BF08B0F68000AB3056 /* pcre_compile.cpp */; };
+ 930754D008B0F74600AB3056 /* pcre_tables.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 930754CE08B0F74500AB3056 /* pcre_tables.cpp */; };
+ 930754EB08B0F78500AB3056 /* pcre_exec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 930754E908B0F78500AB3056 /* pcre_exec.cpp */; settings = {COMPILER_FLAGS = "-fno-move-loop-invariants"; }; };
+ 932F5BD30822A1C700736975 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6560A4CF04B3B3E7008AE952 /* CoreFoundation.framework */; };
+ 932F5BD50822A1C700736975 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 51F0EB6105C86C6B00E6DF1B /* Foundation.framework */; };
+ 932F5BD60822A1C700736975 /* libobjc.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 51F0EC0705C86C9A00E6DF1B /* libobjc.dylib */; };
+ 932F5BD70822A1C700736975 /* libicucore.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9322A00306C341D3009067BB /* libicucore.dylib */; };
+ 932F5BDD0822A1C700736975 /* jsc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 45E12D8806A49B0F00E9DF84 /* jsc.cpp */; };
+ 932F5BEA0822A1C700736975 /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 932F5BD90822A1C700736975 /* JavaScriptCore.framework */; };
+ 933040040E6A749400786E6A /* SmallStrings.h in Headers */ = {isa = PBXBuildFile; fileRef = 93303FEA0E6A72C000786E6A /* SmallStrings.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 9330402C0E6A764000786E6A /* SmallStrings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93303FE80E6A72B500786E6A /* SmallStrings.cpp */; };
+ 933F5CDC1269229B0049191E /* NullPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = 933F5CDB126922690049191E /* NullPtr.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 937013480CA97E0E00FA14D3 /* pcre_ucp_searchfuncs.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 937013470CA97E0E00FA14D3 /* pcre_ucp_searchfuncs.cpp */; settings = {COMPILER_FLAGS = "-Wno-sign-compare"; }; };
+ 93854A9A12C93D3B00DAAF77 /* NullPtr.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93854A9912C93D3B00DAAF77 /* NullPtr.cpp */; };
+ 93E26BD408B1514100F85226 /* pcre_xclass.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93E26BD308B1514100F85226 /* pcre_xclass.cpp */; };
+ 9534AAFB0E5B7A9600B8A45B /* JSProfilerPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 952C63AC0E4777D600C13936 /* JSProfilerPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 95742F650DD11F5A000917FB /* Profile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95742F630DD11F5A000917FB /* Profile.cpp */; };
+ 95AB83420DA4322500BC83F3 /* Profiler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95AB832E0DA42CAD00BC83F3 /* Profiler.cpp */; };
+ 95AB83560DA43C3000BC83F3 /* ProfileNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95AB83540DA43B4400BC83F3 /* ProfileNode.cpp */; };
+ 95CD45760E1C4FDD0085358E /* ProfileGenerator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95CD45740E1C4FDD0085358E /* ProfileGenerator.cpp */; };
+ 95CD45770E1C4FDD0085358E /* ProfileGenerator.h in Headers */ = {isa = PBXBuildFile; fileRef = 95CD45750E1C4FDD0085358E /* ProfileGenerator.h */; settings = {ATTRIBUTES = (); }; };
+ 95E3BC050E1AE68200B2D1C1 /* CallIdentifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 95E3BC040E1AE68200B2D1C1 /* CallIdentifier.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 95F6E6950E5B5F970091E860 /* JSProfilerPrivate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95988BA90E477BEC00D28D4D /* JSProfilerPrivate.cpp */; };
+ 960097A60EBABB58007A7297 /* LabelScope.h in Headers */ = {isa = PBXBuildFile; fileRef = 960097A50EBABB58007A7297 /* LabelScope.h */; };
+ 960626960FB8EC02009798AB /* JITStubCall.h in Headers */ = {isa = PBXBuildFile; fileRef = 960626950FB8EC02009798AB /* JITStubCall.h */; };
+ 9688CB150ED12B4E001D649F /* AssemblerBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 9688CB130ED12B4E001D649F /* AssemblerBuffer.h */; };
+ 9688CB160ED12B4E001D649F /* X86Assembler.h in Headers */ = {isa = PBXBuildFile; fileRef = 9688CB140ED12B4E001D649F /* X86Assembler.h */; };
+ 969A07230ED1CE3300F1F681 /* BytecodeGenerator.h in Headers */ = {isa = PBXBuildFile; fileRef = 969A07210ED1CE3300F1F681 /* BytecodeGenerator.h */; };
+ 969A072A0ED1CE6900F1F681 /* Label.h in Headers */ = {isa = PBXBuildFile; fileRef = 969A07270ED1CE6900F1F681 /* Label.h */; };
+ 969A072B0ED1CE6900F1F681 /* RegisterID.h in Headers */ = {isa = PBXBuildFile; fileRef = 969A07280ED1CE6900F1F681 /* RegisterID.h */; };
+ 969A072C0ED1CE6900F1F681 /* SegmentedVector.h in Headers */ = {isa = PBXBuildFile; fileRef = 969A07290ED1CE6900F1F681 /* SegmentedVector.h */; };
+ 969A07960ED1D3AE00F1F681 /* CodeBlock.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 969A07900ED1D3AE00F1F681 /* CodeBlock.cpp */; };
+ 969A07970ED1D3AE00F1F681 /* CodeBlock.h in Headers */ = {isa = PBXBuildFile; fileRef = 969A07910ED1D3AE00F1F681 /* CodeBlock.h */; settings = {ATTRIBUTES = (); }; };
+ 969A07980ED1D3AE00F1F681 /* EvalCodeCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 969A07920ED1D3AE00F1F681 /* EvalCodeCache.h */; };
+ 969A07990ED1D3AE00F1F681 /* Instruction.h in Headers */ = {isa = PBXBuildFile; fileRef = 969A07930ED1D3AE00F1F681 /* Instruction.h */; };
+ 969A079A0ED1D3AE00F1F681 /* Opcode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 969A07940ED1D3AE00F1F681 /* Opcode.cpp */; };
+ 969A079B0ED1D3AE00F1F681 /* Opcode.h in Headers */ = {isa = PBXBuildFile; fileRef = 969A07950ED1D3AE00F1F681 /* Opcode.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 96DD73790F9DA3100027FBCC /* VMTags.h in Headers */ = {isa = PBXBuildFile; fileRef = 96DD73780F9DA3100027FBCC /* VMTags.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 9714AF46122F28850092D9F5 /* URLSegments.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9714AF35122F27E70092D9F5 /* URLSegments.cpp */; };
+ 9714AF4B122F289A0092D9F5 /* RawURLBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 9714AF31122F27E70092D9F5 /* RawURLBuffer.h */; };
+ 9714AF4C122F289A0092D9F5 /* URLBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 9714AF32122F27E70092D9F5 /* URLBuffer.h */; };
+ 9714AF4D122F289A0092D9F5 /* URLComponent.h in Headers */ = {isa = PBXBuildFile; fileRef = 9714AF33122F27E70092D9F5 /* URLComponent.h */; };
+ 9714AF4E122F289A0092D9F5 /* URLParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 9714AF34122F27E70092D9F5 /* URLParser.h */; };
+ 9714AF4F122F289A0092D9F5 /* URLSegments.h in Headers */ = {isa = PBXBuildFile; fileRef = 9714AF36122F27E70092D9F5 /* URLSegments.h */; };
+ 9714AF5E122F32070092D9F5 /* ParsedURL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9714AF57122F31F50092D9F5 /* ParsedURL.cpp */; };
+ 9714AF5F122F32070092D9F5 /* ParsedURL.h in Headers */ = {isa = PBXBuildFile; fileRef = 9714AF58122F31F50092D9F5 /* ParsedURL.h */; };
+ 9714AF60122F32070092D9F5 /* URLString.h in Headers */ = {isa = PBXBuildFile; fileRef = 9714AF59122F31F50092D9F5 /* URLString.h */; };
+ 971EDEA61169E0D3005E4262 /* Terminator.h in Headers */ = {isa = PBXBuildFile; fileRef = 97F6903A1169DF7F00A6BB46 /* Terminator.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 972A485F12661E0800F4514F /* URLCharacterTypes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 972A485D12661E0800F4514F /* URLCharacterTypes.cpp */; };
+ 972A48771266256F00F4514F /* URLEscape.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 972A48741266256F00F4514F /* URLEscape.cpp */; };
+ A1712B3B11C7B212007A5315 /* RegExpCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A1712B3A11C7B212007A5315 /* RegExpCache.cpp */; };
+ A1712B3F11C7B228007A5315 /* RegExpCache.h in Headers */ = {isa = PBXBuildFile; fileRef = A1712B3E11C7B228007A5315 /* RegExpCache.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ A1712B4111C7B235007A5315 /* RegExpKey.h in Headers */ = {isa = PBXBuildFile; fileRef = A1712B4011C7B235007A5315 /* RegExpKey.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ A71236E51195F33C00BD2174 /* JITOpcodes32_64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A71236E41195F33C00BD2174 /* JITOpcodes32_64.cpp */; };
+ A72700900DAC6BBC00E548D7 /* JSNotAnObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A72700780DAC605600E548D7 /* JSNotAnObject.cpp */; };
+ A72701B90DADE94900E548D7 /* ExceptionHelpers.h in Headers */ = {isa = PBXBuildFile; fileRef = A72701B30DADE94900E548D7 /* ExceptionHelpers.h */; };
+ A727FF6B0DA3092200E548D7 /* JSPropertyNameIterator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A727FF660DA3053B00E548D7 /* JSPropertyNameIterator.cpp */; };
+ A7280A2811557E3000D56957 /* JSObjectRefPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = A79EDB0811531CD60019E912 /* JSObjectRefPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ A730B6121250068F009D25B1 /* StrictEvalActivation.h in Headers */ = {isa = PBXBuildFile; fileRef = A730B6101250068F009D25B1 /* StrictEvalActivation.h */; };
+ A730B6131250068F009D25B1 /* StrictEvalActivation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A730B6111250068F009D25B1 /* StrictEvalActivation.cpp */; };
+ A7386554118697B400540279 /* SpecializedThunkJIT.h in Headers */ = {isa = PBXBuildFile; fileRef = A7386551118697B400540279 /* SpecializedThunkJIT.h */; };
+ A7386555118697B400540279 /* ThunkGenerators.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7386552118697B400540279 /* ThunkGenerators.cpp */; };
+ A7386556118697B400540279 /* ThunkGenerators.h in Headers */ = {isa = PBXBuildFile; fileRef = A7386553118697B400540279 /* ThunkGenerators.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ A7482B9311671147003B0712 /* JSWeakObjectMapRefPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = A7482B791166CDEA003B0712 /* JSWeakObjectMapRefPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ A7482B9411671147003B0712 /* JSWeakObjectMapRefPrivate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7482B7A1166CDEA003B0712 /* JSWeakObjectMapRefPrivate.cpp */; };
+ A7482E93116A7CAD003B0712 /* JSWeakObjectMapRefInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = A7482E37116A697B003B0712 /* JSWeakObjectMapRefInternal.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ A74B3499102A5F8E0032AB98 /* MarkStack.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A74B3498102A5F8E0032AB98 /* MarkStack.cpp */; };
+ A74DE1D0120B875600D40D5B /* ARMv7Assembler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A74DE1CB120B86D600D40D5B /* ARMv7Assembler.cpp */; };
+ A75706DE118A2BCF0057F88F /* JITArithmetic32_64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A75706DD118A2BCF0057F88F /* JITArithmetic32_64.cpp */; };
+ A766B44F0EE8DCD1009518CA /* ExecutableAllocator.h in Headers */ = {isa = PBXBuildFile; fileRef = A7B48DB50EE74CFC00DCBDB6 /* ExecutableAllocator.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ A76C51761182748D00715B05 /* JSInterfaceJIT.h in Headers */ = {isa = PBXBuildFile; fileRef = A76C51741182748D00715B05 /* JSInterfaceJIT.h */; };
+ A76EE6590FAE59D5003F069A /* NativeFunctionWrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = A76EE6580FAE59D5003F069A /* NativeFunctionWrapper.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ A7795590101A74D500114E55 /* MarkStack.h in Headers */ = {isa = PBXBuildFile; fileRef = A779558F101A74D500114E55 /* MarkStack.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ A783A0D111A36DCA00563D20 /* JSObjectWithGlobalObject.h in Headers */ = {isa = PBXBuildFile; fileRef = A783A0D011A36DCA00563D20 /* JSObjectWithGlobalObject.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ A783A2AB11A5BE8400563D20 /* JSObjectWithGlobalObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A783A2AA11A5BE8400563D20 /* JSObjectWithGlobalObject.cpp */; };
+ A784A26111D16622005776AC /* ASTBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = A7A7EE7411B98B8D0065A14F /* ASTBuilder.h */; };
+ A784A26211D16622005776AC /* JSParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7A7EE7511B98B8D0065A14F /* JSParser.cpp */; };
+ A784A26311D16622005776AC /* JSParser.h in Headers */ = {isa = PBXBuildFile; fileRef = A7A7EE7611B98B8D0065A14F /* JSParser.h */; };
+ A784A26411D16622005776AC /* SyntaxChecker.h in Headers */ = {isa = PBXBuildFile; fileRef = A7A7EE7711B98B8D0065A14F /* SyntaxChecker.h */; };
+ A791EF280F11E07900AE1F68 /* JSByteArray.h in Headers */ = {isa = PBXBuildFile; fileRef = A791EF260F11E07900AE1F68 /* JSByteArray.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ A791EF290F11E07900AE1F68 /* JSByteArray.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A791EF270F11E07900AE1F68 /* JSByteArray.cpp */; };
+ A7A1F7AC0F252B3C00E184E2 /* ByteArray.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7A1F7AA0F252B3C00E184E2 /* ByteArray.cpp */; };
+ A7A1F7AD0F252B3C00E184E2 /* ByteArray.h in Headers */ = {isa = PBXBuildFile; fileRef = A7A1F7AB0F252B3C00E184E2 /* ByteArray.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ A7B48F490EE8936F00DCBDB6 /* ExecutableAllocator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7B48DB60EE74CFC00DCBDB6 /* ExecutableAllocator.cpp */; };
+ A7C1E8E4112E72EF00A37F98 /* JITPropertyAccess32_64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7C1E8C8112E701C00A37F98 /* JITPropertyAccess32_64.cpp */; };
+ A7C530E4102A3813005BC741 /* MarkStackPosix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7C530E3102A3813005BC741 /* MarkStackPosix.cpp */; };
+ A7D649AA1015224E009B2E1B /* PossiblyNull.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D649A91015224E009B2E1B /* PossiblyNull.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ A7E2EA6B0FB460CF00601F06 /* LiteralParser.h in Headers */ = {isa = PBXBuildFile; fileRef = A7E2EA690FB460CF00601F06 /* LiteralParser.h */; };
+ A7E2EA6C0FB460CF00601F06 /* LiteralParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7E2EA6A0FB460CF00601F06 /* LiteralParser.cpp */; };
+ A7F19ECE11DD490900931E70 /* FixedArray.h in Headers */ = {isa = PBXBuildFile; fileRef = A7F19ECD11DD490900931E70 /* FixedArray.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ A7F9935F0FD7325100A0B2D0 /* JSONObject.h in Headers */ = {isa = PBXBuildFile; fileRef = A7F9935D0FD7325100A0B2D0 /* JSONObject.h */; };
+ A7F993600FD7325100A0B2D0 /* JSONObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7F9935E0FD7325100A0B2D0 /* JSONObject.cpp */; };
+ A7FB60A4103F7DC20017A286 /* PropertyDescriptor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7FB60A3103F7DC20017A286 /* PropertyDescriptor.cpp */; };
+ A7FB61001040C38B0017A286 /* PropertyDescriptor.h in Headers */ = {isa = PBXBuildFile; fileRef = A7FB604B103F5EAB0017A286 /* PropertyDescriptor.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC01D4F111A8F1FF00A54B2A /* JSZombie.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC01D4EF11A8F1FF00A54B2A /* JSZombie.cpp */; };
+ BC01D4F211A8F1FF00A54B2A /* JSZombie.h in Headers */ = {isa = PBXBuildFile; fileRef = BC01D4F011A8F1FF00A54B2A /* JSZombie.h */; };
+ BC02E90D0E1839DB000F9297 /* ErrorConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = BC02E9050E1839DB000F9297 /* ErrorConstructor.h */; };
+ BC02E90F0E1839DB000F9297 /* ErrorPrototype.h in Headers */ = {isa = PBXBuildFile; fileRef = BC02E9070E1839DB000F9297 /* ErrorPrototype.h */; };
+ BC02E9110E1839DB000F9297 /* NativeErrorConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = BC02E9090E1839DB000F9297 /* NativeErrorConstructor.h */; };
+ BC02E9130E1839DB000F9297 /* NativeErrorPrototype.h in Headers */ = {isa = PBXBuildFile; fileRef = BC02E90B0E1839DB000F9297 /* NativeErrorPrototype.h */; };
+ BC02E98D0E183E38000F9297 /* ErrorInstance.h in Headers */ = {isa = PBXBuildFile; fileRef = BC02E98B0E183E38000F9297 /* ErrorInstance.h */; };
+ BC1166020E1997B4008066DD /* DateInstance.h in Headers */ = {isa = PBXBuildFile; fileRef = BC1166010E1997B1008066DD /* DateInstance.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC11667B0E199C05008066DD /* InternalFunction.h in Headers */ = {isa = PBXBuildFile; fileRef = BC11667A0E199C05008066DD /* InternalFunction.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC1167DA0E19BCC9008066DD /* JSCell.h in Headers */ = {isa = PBXBuildFile; fileRef = BC1167D80E19BCC9008066DD /* JSCell.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C3E40E16F5CD00B34460 /* AlwaysInline.h in Headers */ = {isa = PBXBuildFile; fileRef = 93AA4F770957251F0084B3A7 /* AlwaysInline.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C3E50E16F5CD00B34460 /* APICast.h in Headers */ = {isa = PBXBuildFile; fileRef = 1482B78A0A4305AB00517CFC /* APICast.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C3E60E16F5CD00B34460 /* ArrayConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = BC7952070E15E8A800A898AB /* ArrayConstructor.h */; };
+ BC18C3E70E16F5CD00B34460 /* ArrayPrototype.h in Headers */ = {isa = PBXBuildFile; fileRef = F692A84E0255597D01FF60F7 /* ArrayPrototype.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C3E90E16F5CD00B34460 /* ASCIICType.h in Headers */ = {isa = PBXBuildFile; fileRef = 938C4F690CA06BC700D9310A /* ASCIICType.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C3EA0E16F5CD00B34460 /* Assertions.h in Headers */ = {isa = PBXBuildFile; fileRef = 65E217B708E7EECC0023E5F6 /* Assertions.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C3EB0E16F5CD00B34460 /* AVLTree.h in Headers */ = {isa = PBXBuildFile; fileRef = E1A596370DE3E1C300C17E37 /* AVLTree.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C3EC0E16F5CD00B34460 /* BooleanObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 704FD35305697E6D003DBED9 /* BooleanObject.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C3ED0E16F5CD00B34460 /* CallData.h in Headers */ = {isa = PBXBuildFile; fileRef = 145C507F0D9DF63B0088F6B9 /* CallData.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C3F00E16F5CD00B34460 /* Collator.h in Headers */ = {isa = PBXBuildFile; fileRef = E1A862AA0D7EBB7D001EC6AA /* Collator.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C3F10E16F5CD00B34460 /* Collector.h in Headers */ = {isa = PBXBuildFile; fileRef = F692A8530255597D01FF60F7 /* Collector.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C3F30E16F5CD00B34460 /* CommonIdentifiers.h in Headers */ = {isa = PBXBuildFile; fileRef = 65EA73630BAE35D1001BB560 /* CommonIdentifiers.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C3F40E16F5CD00B34460 /* Completion.h in Headers */ = {isa = PBXBuildFile; fileRef = F5BB2BC5030F772101FCFE1D /* Completion.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C3F50E16F5CD00B34460 /* config.h in Headers */ = {isa = PBXBuildFile; fileRef = F68EBB8C0255D4C601FF60F7 /* config.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C3F60E16F5CD00B34460 /* ConstructData.h in Headers */ = {isa = PBXBuildFile; fileRef = BC8F3CCF0DAF17BA00577A80 /* ConstructData.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C3FA0E16F5CD00B34460 /* Debugger.h in Headers */ = {isa = PBXBuildFile; fileRef = F692A8590255597D01FF60F7 /* Debugger.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C3FB0E16F5CD00B34460 /* DebuggerCallFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 1480DB9B0DDC227F003CFDF2 /* DebuggerCallFrame.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C3FC0E16F5CD00B34460 /* Deque.h in Headers */ = {isa = PBXBuildFile; fileRef = 5186111D0CC824830081412B /* Deque.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C3FD0E16F5CD00B34460 /* DisallowCType.h in Headers */ = {isa = PBXBuildFile; fileRef = 938C4F6B0CA06BCE00D9310A /* DisallowCType.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C3FE0E16F5CD00B34460 /* dtoa.h in Headers */ = {isa = PBXBuildFile; fileRef = 651F6413039D5B5F0078395C /* dtoa.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C4000E16F5CD00B34460 /* ExceptionHelpers.h in Headers */ = {isa = PBXBuildFile; fileRef = A72701B30DADE94900E548D7 /* ExceptionHelpers.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C4020E16F5CD00B34460 /* FastMalloc.h in Headers */ = {isa = PBXBuildFile; fileRef = 65E217BA08E7EECC0023E5F6 /* FastMalloc.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C4030E16F5CD00B34460 /* Forward.h in Headers */ = {isa = PBXBuildFile; fileRef = 935AF46909E9D9DB00ACD1D8 /* Forward.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C4040E16F5CD00B34460 /* FunctionConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = BC2680C10E16D4E900A06E92 /* FunctionConstructor.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C4050E16F5CD00B34460 /* FunctionPrototype.h in Headers */ = {isa = PBXBuildFile; fileRef = F692A85D0255597D01FF60F7 /* FunctionPrototype.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C4060E16F5CD00B34460 /* GetPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = 93B6A0DE0AA64DA40076DE27 /* GetPtr.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C4080E16F5CD00B34460 /* HashCountedSet.h in Headers */ = {isa = PBXBuildFile; fileRef = 657EEBBF094E445E008C9C7B /* HashCountedSet.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C4090E16F5CD00B34460 /* HashFunctions.h in Headers */ = {isa = PBXBuildFile; fileRef = 65DFC92A08EA173A00F7300B /* HashFunctions.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C40A0E16F5CD00B34460 /* HashIterators.h in Headers */ = {isa = PBXBuildFile; fileRef = 652246A40C8D7A0E007BDAF7 /* HashIterators.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C40B0E16F5CD00B34460 /* HashMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 65DFC92B08EA173A00F7300B /* HashMap.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C40C0E16F5CD00B34460 /* HashSet.h in Headers */ = {isa = PBXBuildFile; fileRef = 65DFC92C08EA173A00F7300B /* HashSet.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C40D0E16F5CD00B34460 /* HashTable.h in Headers */ = {isa = PBXBuildFile; fileRef = 65DFC92E08EA173A00F7300B /* HashTable.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C40E0E16F5CD00B34460 /* HashTraits.h in Headers */ = {isa = PBXBuildFile; fileRef = 65DFC92F08EA173A00F7300B /* HashTraits.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C40F0E16F5CD00B34460 /* Identifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 933A349A038AE7C6008635CE /* Identifier.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C4100E16F5CD00B34460 /* InitializeThreading.h in Headers */ = {isa = PBXBuildFile; fileRef = E178633F0D9BEC0000D74E75 /* InitializeThreading.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C4130E16F5CD00B34460 /* JavaScript.h in Headers */ = {isa = PBXBuildFile; fileRef = 1CAA8B4A0D32C39A0041BCFF /* JavaScript.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ BC18C4140E16F5CD00B34460 /* JavaScriptCore.h in Headers */ = {isa = PBXBuildFile; fileRef = 1CAA8B4B0D32C39A0041BCFF /* JavaScriptCore.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ BC18C4150E16F5CD00B34460 /* JavaScriptCorePrefix.h in Headers */ = {isa = PBXBuildFile; fileRef = F5C290E60284F98E018635CA /* JavaScriptCorePrefix.h */; };
+ BC18C4160E16F5CD00B34460 /* JSActivation.h in Headers */ = {isa = PBXBuildFile; fileRef = 14DA818E0D99FD2000B0A4FB /* JSActivation.h */; settings = {ATTRIBUTES = (); }; };
+ BC18C4170E16F5CD00B34460 /* JSArray.h in Headers */ = {isa = PBXBuildFile; fileRef = 938772E5038BFE19008635CE /* JSArray.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C4180E16F5CD00B34460 /* JSBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 142711380A460BBB0080EEEA /* JSBase.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ BC18C4190E16F5CD00B34460 /* JSCallbackConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = 1440F8AC0A508D200005F061 /* JSCallbackConstructor.h */; };
+ BC18C41A0E16F5CD00B34460 /* JSCallbackFunction.h in Headers */ = {isa = PBXBuildFile; fileRef = 1440F88F0A508B100005F061 /* JSCallbackFunction.h */; };
+ BC18C41B0E16F5CD00B34460 /* JSCallbackObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 14ABDF5D0A437FEF00ECCA01 /* JSCallbackObject.h */; };
+ BC18C41C0E16F5CD00B34460 /* JSCallbackObjectFunctions.h in Headers */ = {isa = PBXBuildFile; fileRef = A8E894310CD0602400367179 /* JSCallbackObjectFunctions.h */; };
+ BC18C41D0E16F5CD00B34460 /* JSClassRef.h in Headers */ = {isa = PBXBuildFile; fileRef = 1440FCE10A51E46B0005F061 /* JSClassRef.h */; };
+ BC18C41E0E16F5CD00B34460 /* JSContextRef.h in Headers */ = {isa = PBXBuildFile; fileRef = 14BD5A2A0A3E91F600BAF59C /* JSContextRef.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ BC18C41F0E16F5CD00B34460 /* JSFunction.h in Headers */ = {isa = PBXBuildFile; fileRef = F692A85F0255597D01FF60F7 /* JSFunction.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C4200E16F5CD00B34460 /* JSGlobalData.h in Headers */ = {isa = PBXBuildFile; fileRef = E18E3A560DF9278C00D90B34 /* JSGlobalData.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C4210E16F5CD00B34460 /* JSGlobalObject.h in Headers */ = {isa = PBXBuildFile; fileRef = A8E894330CD0603F00367179 /* JSGlobalObject.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C4220E16F5CD00B34460 /* JSImmediate.h in Headers */ = {isa = PBXBuildFile; fileRef = 1483B589099BC1950016E4F0 /* JSImmediate.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C4230E16F5CD00B34460 /* JSLock.h in Headers */ = {isa = PBXBuildFile; fileRef = 65EA4C9A092AF9E20093D800 /* JSLock.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C4240E16F5CD00B34460 /* JSObject.h in Headers */ = {isa = PBXBuildFile; fileRef = BC22A3990E16E14800AF21C8 /* JSObject.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C4250E16F5CD00B34460 /* JSObjectRef.h in Headers */ = {isa = PBXBuildFile; fileRef = 1482B7E10A43076000517CFC /* JSObjectRef.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ BC18C4260E16F5CD00B34460 /* JSRetainPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = 95C18D3E0C90E7EF00E72F73 /* JSRetainPtr.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C4270E16F5CD00B34460 /* JSString.h in Headers */ = {isa = PBXBuildFile; fileRef = F692A8620255597D01FF60F7 /* JSString.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C4280E16F5CD00B34460 /* JSStringRef.h in Headers */ = {isa = PBXBuildFile; fileRef = 1482B74B0A43032800517CFC /* JSStringRef.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ BC18C4290E16F5CD00B34460 /* JSStringRefCF.h in Headers */ = {isa = PBXBuildFile; fileRef = 146AAB2A0B66A84900E55F16 /* JSStringRefCF.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ BC18C42A0E16F5CD00B34460 /* JSType.h in Headers */ = {isa = PBXBuildFile; fileRef = 14ABB454099C2A0F00E2A24F /* JSType.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C42B0E16F5CD00B34460 /* JSValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 14ABB36E099C076400E2A24F /* JSValue.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C42C0E16F5CD00B34460 /* JSValueRef.h in Headers */ = {isa = PBXBuildFile; fileRef = 1482B6EA0A4300B300517CFC /* JSValueRef.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ BC18C42D0E16F5CD00B34460 /* JSVariableObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 14F252560D08DD8D004ECFFF /* JSVariableObject.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C42E0E16F5CD00B34460 /* JSWrapperObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 65C7A1720A8EAACB00FA37EA /* JSWrapperObject.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C4310E16F5CD00B34460 /* Lexer.h in Headers */ = {isa = PBXBuildFile; fileRef = F692A8660255597D01FF60F7 /* Lexer.h */; };
+ BC18C4340E16F5CD00B34460 /* ListHashSet.h in Headers */ = {isa = PBXBuildFile; fileRef = 657EB7450B708F540063461B /* ListHashSet.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C4350E16F5CD00B34460 /* ListRefPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = 148A1626095D16BB00666D0D /* ListRefPtr.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C4360E16F5CD00B34460 /* Locker.h in Headers */ = {isa = PBXBuildFile; fileRef = E1EE79270D6C964500FEA3BA /* Locker.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C4370E16F5CD00B34460 /* Lookup.h in Headers */ = {isa = PBXBuildFile; fileRef = F692A8690255597D01FF60F7 /* Lookup.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C4390E16F5CD00B34460 /* MainThread.h in Headers */ = {isa = PBXBuildFile; fileRef = 06D358A30DAAD9C4003B174E /* MainThread.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C43A0E16F5CD00B34460 /* MallocZoneSupport.h in Headers */ = {isa = PBXBuildFile; fileRef = 5DBD18AF0C5401A700C15EAE /* MallocZoneSupport.h */; settings = {ATTRIBUTES = (); }; };
+ BC18C43B0E16F5CD00B34460 /* MathExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = BCF6553B0A2048DE0038A194 /* MathExtras.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C43C0E16F5CD00B34460 /* MathObject.h in Headers */ = {isa = PBXBuildFile; fileRef = F692A86B0255597D01FF60F7 /* MathObject.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C43E0E16F5CD00B34460 /* MessageQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = E1EE798B0D6CA53D00FEA3BA /* MessageQueue.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C43F0E16F5CD00B34460 /* Nodes.h in Headers */ = {isa = PBXBuildFile; fileRef = F692A86E0255597D01FF60F7 /* Nodes.h */; settings = {ATTRIBUTES = (); }; };
+ BC18C4400E16F5CD00B34460 /* Noncopyable.h in Headers */ = {isa = PBXBuildFile; fileRef = 9303F5690991190000AD71B8 /* Noncopyable.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C4410E16F5CD00B34460 /* NumberConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = BC2680C30E16D4E900A06E92 /* NumberConstructor.h */; };
+ BC18C4420E16F5CD00B34460 /* NumberConstructor.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = BC2680E60E16D52300A06E92 /* NumberConstructor.lut.h */; };
+ BC18C4430E16F5CD00B34460 /* NumberObject.h in Headers */ = {isa = PBXBuildFile; fileRef = F692A8710255597D01FF60F7 /* NumberObject.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C4440E16F5CD00B34460 /* NumberPrototype.h in Headers */ = {isa = PBXBuildFile; fileRef = BC2680C50E16D4E900A06E92 /* NumberPrototype.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C4450E16F5CD00B34460 /* ObjectConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = BC2680C70E16D4E900A06E92 /* ObjectConstructor.h */; };
+ BC18C4460E16F5CD00B34460 /* ObjectPrototype.h in Headers */ = {isa = PBXBuildFile; fileRef = BC2680C90E16D4E900A06E92 /* ObjectPrototype.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C4480E16F5CD00B34460 /* Operations.h in Headers */ = {isa = PBXBuildFile; fileRef = F692A8780255597D01FF60F7 /* Operations.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C4490E16F5CD00B34460 /* OwnArrayPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = 9303F5A409911A5800AD71B8 /* OwnArrayPtr.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C44A0E16F5CD00B34460 /* OwnPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = 9303F567099118FA00AD71B8 /* OwnPtr.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C44B0E16F5CD00B34460 /* Parser.h in Headers */ = {isa = PBXBuildFile; fileRef = 93F0B3AA09BB4DC00068FCE3 /* Parser.h */; settings = {ATTRIBUTES = (); }; };
+ BC18C44C0E16F5CD00B34460 /* PassRefPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = 6580F795094070560082C219 /* PassRefPtr.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C44D0E16F5CD00B34460 /* pcre.h in Headers */ = {isa = PBXBuildFile; fileRef = 6541720F039E08B90058BFEB /* pcre.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C44E0E16F5CD00B34460 /* pcre_internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 93E26BE508B1517100F85226 /* pcre_internal.h */; };
+ BC18C44F0E16F5CD00B34460 /* Platform.h in Headers */ = {isa = PBXBuildFile; fileRef = 65D6D87E09B5A32E0002E4D7 /* Platform.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C4500E16F5CD00B34460 /* Profile.h in Headers */ = {isa = PBXBuildFile; fileRef = 95742F640DD11F5A000917FB /* Profile.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C4510E16F5CD00B34460 /* ProfileNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 95AB83550DA43B4400BC83F3 /* ProfileNode.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C4520E16F5CD00B34460 /* Profiler.h in Headers */ = {isa = PBXBuildFile; fileRef = 95AB832F0DA42CAD00BC83F3 /* Profiler.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C4540E16F5CD00B34460 /* PropertyNameArray.h in Headers */ = {isa = PBXBuildFile; fileRef = 65400C100A69BAF200509887 /* PropertyNameArray.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C4550E16F5CD00B34460 /* PropertySlot.h in Headers */ = {isa = PBXBuildFile; fileRef = 65621E6C089E859700760F35 /* PropertySlot.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C4560E16F5CD00B34460 /* Protect.h in Headers */ = {isa = PBXBuildFile; fileRef = 65C02FBB0637462A003E7EE6 /* Protect.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C4570E16F5CD00B34460 /* RefCounted.h in Headers */ = {isa = PBXBuildFile; fileRef = 1419D32C0CEA7CDE00FF507A /* RefCounted.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C4580E16F5CD00B34460 /* RefPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = 65C647B3093EF8D60022C380 /* RefPtr.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C4590E16F5CD00B34460 /* RefPtrHashMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 148A1ECD0D10C23B0069A47C /* RefPtrHashMap.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C45A0E16F5CD00B34460 /* RegExp.h in Headers */ = {isa = PBXBuildFile; fileRef = F692A87E0255597D01FF60F7 /* RegExp.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C45B0E16F5CD00B34460 /* RegExpObject.h in Headers */ = {isa = PBXBuildFile; fileRef = F692A87C0255597D01FF60F7 /* RegExpObject.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C45D0E16F5CD00B34460 /* Register.h in Headers */ = {isa = PBXBuildFile; fileRef = 149B24FF0D8AF6D1009CB8C7 /* Register.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C45E0E16F5CD00B34460 /* RegisterFile.h in Headers */ = {isa = PBXBuildFile; fileRef = 14D792640DAA03FB001A9F05 /* RegisterFile.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C4600E16F5CD00B34460 /* RetainPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = 51F648D60BB4E2CA0033D760 /* RetainPtr.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C4610E16F5CD00B34460 /* ScopeChain.h in Headers */ = {isa = PBXBuildFile; fileRef = 9374D3A7038D9D74008635CE /* ScopeChain.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C4630E16F5CD00B34460 /* SourceProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 65E866ED0DD59AFA00A2B2A1 /* SourceProvider.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C4640E16F5CD00B34460 /* SourceCode.h in Headers */ = {isa = PBXBuildFile; fileRef = 65E866EE0DD59AFA00A2B2A1 /* SourceCode.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C4660E16F5CD00B34460 /* StringConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = BC18C3C10E16EE3300B34460 /* StringConstructor.h */; };
+ BC18C4670E16F5CD00B34460 /* StringExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = E11D51750B2E798D0056C188 /* StringExtras.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C4680E16F5CD00B34460 /* StringObject.h in Headers */ = {isa = PBXBuildFile; fileRef = BC18C3C30E16EE3300B34460 /* StringObject.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C4690E16F5CD00B34460 /* StringObjectThatMasqueradesAsUndefined.h in Headers */ = {isa = PBXBuildFile; fileRef = BC18C3C40E16EE3300B34460 /* StringObjectThatMasqueradesAsUndefined.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C46A0E16F5CD00B34460 /* StringPrototype.h in Headers */ = {isa = PBXBuildFile; fileRef = BC18C3C60E16EE3300B34460 /* StringPrototype.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C46B0E16F5CD00B34460 /* SymbolTable.h in Headers */ = {isa = PBXBuildFile; fileRef = 14A396A60CD2933100B5B4FF /* SymbolTable.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C46C0E16F5CD00B34460 /* TCPackedCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 5DA479650CFBCF56009328A0 /* TCPackedCache.h */; };
+ BC18C46D0E16F5CD00B34460 /* TCPageMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 6541BD6E08E80A17002CBEE7 /* TCPageMap.h */; };
+ BC18C46E0E16F5CD00B34460 /* TCSpinLock.h in Headers */ = {isa = PBXBuildFile; fileRef = 6541BD6F08E80A17002CBEE7 /* TCSpinLock.h */; };
+ BC18C46F0E16F5CD00B34460 /* TCSystemAlloc.h in Headers */ = {isa = PBXBuildFile; fileRef = 6541BD7108E80A17002CBEE7 /* TCSystemAlloc.h */; };
+ BC18C4700E16F5CD00B34460 /* Threading.h in Headers */ = {isa = PBXBuildFile; fileRef = E1EE79220D6C95CD00FEA3BA /* Threading.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C4710E16F5CD00B34460 /* ThreadSpecific.h in Headers */ = {isa = PBXBuildFile; fileRef = E1B7C8BD0DA3A3360074B0DC /* ThreadSpecific.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C4720E16F5CD00B34460 /* ucpinternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 93E26BFC08B151D400F85226 /* ucpinternal.h */; };
+ BC18C4730E16F5CD00B34460 /* Unicode.h in Headers */ = {isa = PBXBuildFile; fileRef = E195679409E7CF1200B89D13 /* Unicode.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C4740E16F5CD00B34460 /* UnicodeIcu.h in Headers */ = {isa = PBXBuildFile; fileRef = E195678F09E7CF1200B89D13 /* UnicodeIcu.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C4750E16F5CD00B34460 /* UnusedParam.h in Headers */ = {isa = PBXBuildFile; fileRef = 935AF46B09E9D9DB00ACD1D8 /* UnusedParam.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C4760E16F5CD00B34460 /* UString.h in Headers */ = {isa = PBXBuildFile; fileRef = F692A8860255597D01FF60F7 /* UString.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C4770E16F5CD00B34460 /* UTF8.h in Headers */ = {isa = PBXBuildFile; fileRef = E1EF79A90CE97BA60088D500 /* UTF8.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C4780E16F5CD00B34460 /* Vector.h in Headers */ = {isa = PBXBuildFile; fileRef = 6592C316098B7DE10003D4F6 /* Vector.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C4790E16F5CD00B34460 /* VectorTraits.h in Headers */ = {isa = PBXBuildFile; fileRef = 6592C317098B7DE10003D4F6 /* VectorTraits.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC18C47A0E16F5CD00B34460 /* WebKitAvailability.h in Headers */ = {isa = PBXBuildFile; fileRef = 5DE3D0F40DD8DDFB00468714 /* WebKitAvailability.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ BC18C5240E16FC8A00B34460 /* ArrayPrototype.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = BC18C5230E16FC8A00B34460 /* ArrayPrototype.lut.h */; };
+ BC18C5260E16FCA700B34460 /* StringPrototype.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = BC18C5250E16FCA700B34460 /* StringPrototype.lut.h */; };
+ BC18C52A0E16FCC200B34460 /* MathObject.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = BC18C5290E16FCC200B34460 /* MathObject.lut.h */; };
+ BC18C52C0E16FCD200B34460 /* RegExpObject.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = BC18C52B0E16FCD200B34460 /* RegExpObject.lut.h */; };
+ BC18C52E0E16FCE100B34460 /* Lexer.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = BC18C52D0E16FCE100B34460 /* Lexer.lut.h */; };
+ BC257DE80E1F51C50016B6C9 /* Arguments.h in Headers */ = {isa = PBXBuildFile; fileRef = BC257DE60E1F51C50016B6C9 /* Arguments.h */; };
+ BC257DF00E1F52ED0016B6C9 /* GlobalEvalFunction.h in Headers */ = {isa = PBXBuildFile; fileRef = BC257DEE0E1F52ED0016B6C9 /* GlobalEvalFunction.h */; };
+ BC257DF40E1F53740016B6C9 /* PrototypeFunction.h in Headers */ = {isa = PBXBuildFile; fileRef = BC257DF20E1F53740016B6C9 /* PrototypeFunction.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC3046070E1F497F003232CF /* Error.h in Headers */ = {isa = PBXBuildFile; fileRef = BC3046060E1F497F003232CF /* Error.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC3135640F302FA3003DFD3A /* DebuggerActivation.h in Headers */ = {isa = PBXBuildFile; fileRef = BC3135620F302FA3003DFD3A /* DebuggerActivation.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC3135650F302FA3003DFD3A /* DebuggerActivation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC3135630F302FA3003DFD3A /* DebuggerActivation.cpp */; };
+ BC5F7BBE11823B590052C02C /* Atomics.h in Headers */ = {isa = PBXBuildFile; fileRef = BC5F7BBB11823B590052C02C /* Atomics.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC5F7BBF11823B590052C02C /* ThreadingPrimitives.h in Headers */ = {isa = PBXBuildFile; fileRef = BC5F7BBC11823B590052C02C /* ThreadingPrimitives.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC5F7BC011823B590052C02C /* ThreadSafeShared.h in Headers */ = {isa = PBXBuildFile; fileRef = BC5F7BBD11823B590052C02C /* ThreadSafeShared.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC6AAAE50E1F426500AD87D8 /* ClassInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = BC6AAAE40E1F426500AD87D8 /* ClassInfo.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC756FC90E2031B200DE7D12 /* JSGlobalObjectFunctions.h in Headers */ = {isa = PBXBuildFile; fileRef = BC756FC70E2031B200DE7D12 /* JSGlobalObjectFunctions.h */; };
+ BC7F8FB90E19D1C3008632C0 /* JSNumberCell.h in Headers */ = {isa = PBXBuildFile; fileRef = BC7F8FB80E19D1C3008632C0 /* JSNumberCell.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC87CDB910712AD4000614CF /* JSONObject.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = BC87CDB810712ACA000614CF /* JSONObject.lut.h */; };
+ BC9041480EB9250900FE26FA /* StructureTransitionTable.h in Headers */ = {isa = PBXBuildFile; fileRef = BC9041470EB9250900FE26FA /* StructureTransitionTable.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BC95437D0EBA70FD0072B6D3 /* PropertyMapHashTable.h in Headers */ = {isa = PBXBuildFile; fileRef = BC95437C0EBA70FD0072B6D3 /* PropertyMapHashTable.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BCCF0D080EF0AAB900413C8F /* StructureStubInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = BCCF0D070EF0AAB900413C8F /* StructureStubInfo.h */; };
+ BCCF0D0C0EF0B8A500413C8F /* StructureStubInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCCF0D0B0EF0B8A500413C8F /* StructureStubInfo.cpp */; };
+ BCD202C20E1706A7002C7E82 /* RegExpConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = BCD202BE0E1706A7002C7E82 /* RegExpConstructor.h */; };
+ BCD202C40E1706A7002C7E82 /* RegExpPrototype.h in Headers */ = {isa = PBXBuildFile; fileRef = BCD202C00E1706A7002C7E82 /* RegExpPrototype.h */; };
+ BCD202D60E170708002C7E82 /* RegExpConstructor.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = BCD202D50E170708002C7E82 /* RegExpConstructor.lut.h */; };
+ BCD2034A0E17135E002C7E82 /* DateConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = BCD203460E17135E002C7E82 /* DateConstructor.h */; };
+ BCD2034C0E17135E002C7E82 /* DatePrototype.h in Headers */ = {isa = PBXBuildFile; fileRef = BCD203480E17135E002C7E82 /* DatePrototype.h */; };
+ BCD203E80E1718F4002C7E82 /* DatePrototype.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = BCD203E70E1718F4002C7E82 /* DatePrototype.lut.h */; };
+ BCDD51EB0FB8DF74004A8BDC /* JITOpcodes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCDD51E90FB8DF74004A8BDC /* JITOpcodes.cpp */; };
+ BCDE3AB80E6C82F5001453A7 /* Structure.h in Headers */ = {isa = PBXBuildFile; fileRef = BCDE3AB10E6C82CF001453A7 /* Structure.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BCDE3B430E6C832D001453A7 /* Structure.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCDE3AB00E6C82CF001453A7 /* Structure.cpp */; };
+ BCF605140E203EF800B9A64D /* ArgList.h in Headers */ = {isa = PBXBuildFile; fileRef = BCF605120E203EF800B9A64D /* ArgList.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BCFBE696122560E800309E9D /* PassOwnArrayPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = BCFBE695122560E800309E9D /* PassOwnArrayPtr.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BCFBE698122561D200309E9D /* OwnArrayPtrCommon.h in Headers */ = {isa = PBXBuildFile; fileRef = BCFBE697122561D200309E9D /* OwnArrayPtrCommon.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ BCFD8C920EEB2EE700283848 /* JumpTable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCFD8C900EEB2EE700283848 /* JumpTable.cpp */; };
+ BCFD8C930EEB2EE700283848 /* JumpTable.h in Headers */ = {isa = PBXBuildFile; fileRef = BCFD8C910EEB2EE700283848 /* JumpTable.h */; };
+ C0A272630E50A06300E96E15 /* NotFound.h in Headers */ = {isa = PBXBuildFile; fileRef = C0A2723F0E509F1E00E96E15 /* NotFound.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ DD377CBC12072C18006A2517 /* Bitmap.h in Headers */ = {isa = PBXBuildFile; fileRef = DD377CBB12072C18006A2517 /* Bitmap.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ DDE82AD31209D955005C1756 /* GCHandle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DDE82AD11209D955005C1756 /* GCHandle.cpp */; };
+ DDE82AD41209D955005C1756 /* GCHandle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DDE82AD11209D955005C1756 /* GCHandle.cpp */; };
+ DDE82AD51209D955005C1756 /* GCHandle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DDE82AD11209D955005C1756 /* GCHandle.cpp */; };
+ DDE82AD61209D955005C1756 /* GCHandle.h in Headers */ = {isa = PBXBuildFile; fileRef = DDE82AD21209D955005C1756 /* GCHandle.h */; };
+ DDE82AD71209D955005C1756 /* GCHandle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DDE82AD11209D955005C1756 /* GCHandle.cpp */; };
+ DDE82AD81209D955005C1756 /* GCHandle.h in Headers */ = {isa = PBXBuildFile; fileRef = DDE82AD21209D955005C1756 /* GCHandle.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ DDF7ABD411F60ED200108E36 /* GCActivityCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = DDF7ABD211F60ED200108E36 /* GCActivityCallback.h */; };
+ DDF7ABD511F60ED200108E36 /* GCActivityCallbackCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DDF7ABD311F60ED200108E36 /* GCActivityCallbackCF.cpp */; };
+ E124A8F70E555775003091F1 /* OpaqueJSString.h in Headers */ = {isa = PBXBuildFile; fileRef = E124A8F50E555775003091F1 /* OpaqueJSString.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ E124A8F80E555775003091F1 /* OpaqueJSString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E124A8F60E555775003091F1 /* OpaqueJSString.cpp */; };
+ E178636D0D9BEEC300D74E75 /* InitializeThreading.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E178636C0D9BEEC300D74E75 /* InitializeThreading.cpp */; };
+ E17FF771112131D200076A19 /* ValueCheck.h in Headers */ = {isa = PBXBuildFile; fileRef = E17FF770112131D200076A19 /* ValueCheck.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ E18E3A590DF9278C00D90B34 /* JSGlobalData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E18E3A570DF9278C00D90B34 /* JSGlobalData.cpp */; };
+ E1A862A90D7EBB76001EC6AA /* CollatorICU.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1A862A80D7EBB76001EC6AA /* CollatorICU.cpp */; settings = {COMPILER_FLAGS = "-fno-strict-aliasing"; }; };
+ E1A862D60D7F2B5C001EC6AA /* CollatorDefault.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1A862D50D7F2B5C001EC6AA /* CollatorDefault.cpp */; };
+ E1EE793D0D6C9B9200FEA3BA /* ThreadingPthreads.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1EE793C0D6C9B9200FEA3BA /* ThreadingPthreads.cpp */; };
+ E1EF79AA0CE97BA60088D500 /* UTF8.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1EF79A80CE97BA60088D500 /* UTF8.cpp */; };
+ E48E0F2D0F82151700A8CA37 /* FastAllocBase.h in Headers */ = {isa = PBXBuildFile; fileRef = E48E0F2C0F82151700A8CA37 /* FastAllocBase.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ F3BD31ED126735770065467F /* TextPosition.h in Headers */ = {isa = PBXBuildFile; fileRef = F3BD31D0126730180065467F /* TextPosition.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ FDA15C1E12B0305C003A583A /* Complex.h in Headers */ = {isa = PBXBuildFile; fileRef = FDA15C1612B03028003A583A /* Complex.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ FE1B447A0ECCD73B004F4DD1 /* StdLibExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = FE1B44790ECCD73B004F4DD1 /* StdLibExtras.h */; settings = {ATTRIBUTES = (Private, ); }; };
+/* End PBXBuildFile section */
+
+/* Begin PBXContainerItemProxy section */
+ 141211350A48796100480255 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 932F5B3E0822A1C700736975;
+ remoteInfo = JavaScriptCore;
+ };
+ 141214BE0A49190E00480255 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 1412111F0A48793C00480255;
+ remoteInfo = minidom;
+ };
+ 14270B070A451DA10080EEEA /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 932F5B3E0822A1C700736975;
+ remoteInfo = JavaScriptCore;
+ };
+ 14270B0B0A451DA40080EEEA /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 932F5B3E0822A1C700736975;
+ remoteInfo = JavaScriptCore;
+ };
+ 14BD59C60A3E8FA400BAF59C /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 14BD59BE0A3E8F9000BAF59C;
+ remoteInfo = testapi;
+ };
+ 65FB3F7D09D11EF300F49DEB /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 65FB3F6609D11E9100F49DEB;
+ remoteInfo = "Generate Derived Sources";
+ };
+ 932F5BE60822A1C700736975 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 932F5B3E0822A1C700736975;
+ remoteInfo = "JavaScriptCore (Upgraded)";
+ };
+ 932F5BE80822A1C700736975 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 932F5BDA0822A1C700736975;
+ remoteInfo = "jsc (Upgraded)";
+ };
+/* End PBXContainerItemProxy section */
+
+/* Begin PBXCopyFilesBuildPhase section */
+ 5D5D8ABA0E0D0A7300F9C692 /* Copy Into Framework */ = {
+ isa = PBXCopyFilesBuildPhase;
+ buildActionMask = 2147483647;
+ dstPath = JavaScriptCore.framework/Resources;
+ dstSubfolderSpec = 16;
+ files = (
+ 5D5D8AB60E0D0A7200F9C692 /* jsc in Copy Into Framework */,
+ );
+ name = "Copy Into Framework";
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXCopyFilesBuildPhase section */
+
+/* Begin PBXFileReference section */
+ 06D358A10DAAD9C4003B174E /* MainThreadMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MainThreadMac.mm; sourceTree = "<group>"; };
+ 06D358A20DAAD9C4003B174E /* MainThread.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MainThread.cpp; sourceTree = "<group>"; };
+ 06D358A30DAAD9C4003B174E /* MainThread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MainThread.h; sourceTree = "<group>"; };
+ 081469481264375E00DFF935 /* StringBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StringBuilder.h; path = text/StringBuilder.h; sourceTree = "<group>"; };
+ 088FA5B90EF76D4300578E6F /* RandomNumber.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RandomNumber.cpp; sourceTree = "<group>"; };
+ 088FA5BA0EF76D4300578E6F /* RandomNumber.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RandomNumber.h; sourceTree = "<group>"; };
+ 0896C29B1265AAF600B1CDD3 /* UStringConcatenate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UStringConcatenate.h; sourceTree = "<group>"; };
+ 0896C29E1265AB0900B1CDD3 /* StringConcatenate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StringConcatenate.h; path = text/StringConcatenate.h; sourceTree = "<group>"; };
+ 08DDA5BB12645F1D00751732 /* UStringBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UStringBuilder.h; sourceTree = "<group>"; };
+ 08E279E80EF83B10007DB523 /* RandomNumberSeed.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RandomNumberSeed.h; sourceTree = "<group>"; };
+ 0B330C260F38C62300692DE3 /* TypeTraits.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TypeTraits.cpp; sourceTree = "<group>"; };
+ 0B4D7E620F319AC800AD7E58 /* TypeTraits.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TypeTraits.h; sourceTree = "<group>"; };
+ 0BDFFAD10FC616EC00D69EF4 /* OwnFastMallocPtr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OwnFastMallocPtr.h; sourceTree = "<group>"; };
+ 0BDFFAD40FC6171000D69EF4 /* CrossThreadRefCounted.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CrossThreadRefCounted.h; sourceTree = "<group>"; };
+ 0BF28A2811A33DC300638F84 /* SizeLimits.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SizeLimits.cpp; sourceTree = "<group>"; };
+ 0F29479B126E698C00B3ABF5 /* DecimalNumber.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DecimalNumber.cpp; sourceTree = "<group>"; };
+ 1400067612A6F7830064D123 /* OSAllocator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OSAllocator.h; sourceTree = "<group>"; };
+ 1400069212A6F9E10064D123 /* OSAllocatorPosix.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OSAllocatorPosix.cpp; sourceTree = "<group>"; };
+ 14035DB010DBFB2A00FFFFE7 /* WeakGCPtr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WeakGCPtr.h; sourceTree = "<group>"; };
+ 140D17D60E8AD4A9000CD17D /* JSBasePrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSBasePrivate.h; sourceTree = "<group>"; };
+ 141211020A48780900480255 /* minidom.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = minidom.c; path = tests/minidom.c; sourceTree = "<group>"; };
+ 1412110D0A48788700480255 /* minidom.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = minidom.js; path = tests/minidom.js; sourceTree = "<group>"; };
+ 141211200A48793C00480255 /* minidom */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = minidom; sourceTree = BUILT_PRODUCTS_DIR; };
+ 1419D32C0CEA7CDE00FF507A /* RefCounted.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RefCounted.h; sourceTree = "<group>"; };
+ 1420BE7A10AA6DDB00F455D2 /* WeakRandom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WeakRandom.h; sourceTree = "<group>"; };
+ 1421359A0A677F4F00A8195E /* JSBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSBase.cpp; sourceTree = "<group>"; };
+ 142711380A460BBB0080EEEA /* JSBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSBase.h; sourceTree = "<group>"; };
+ 1429D77B0ED20D7300B89619 /* Interpreter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Interpreter.h; sourceTree = "<group>"; };
+ 1429D7D30ED2128200B89619 /* Interpreter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Interpreter.cpp; sourceTree = "<group>"; };
+ 1429D85B0ED218E900B89619 /* RegisterFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RegisterFile.cpp; sourceTree = "<group>"; };
+ 1429D8770ED21ACD00B89619 /* ExceptionHelpers.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ExceptionHelpers.cpp; sourceTree = "<group>"; };
+ 1429D8830ED21C3D00B89619 /* SamplingTool.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SamplingTool.cpp; sourceTree = "<group>"; };
+ 1429D8840ED21C3D00B89619 /* SamplingTool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SamplingTool.h; sourceTree = "<group>"; };
+ 1429D8DB0ED2205B00B89619 /* CallFrame.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CallFrame.cpp; sourceTree = "<group>"; };
+ 1429D8DC0ED2205B00B89619 /* CallFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CallFrame.h; sourceTree = "<group>"; };
+ 1429D92D0ED22D7000B89619 /* JIT.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JIT.cpp; sourceTree = "<group>"; };
+ 1429D92E0ED22D7000B89619 /* JIT.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JIT.h; sourceTree = "<group>"; };
+ 142D3938103E4560007DCB52 /* NumericStrings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NumericStrings.h; sourceTree = "<group>"; };
+ 1440051F0A531D3B0005F061 /* Node.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Node.h; path = tests/Node.h; sourceTree = "<group>"; };
+ 144005200A531D3B0005F061 /* Node.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = Node.c; path = tests/Node.c; sourceTree = "<group>"; };
+ 144007480A536CC20005F061 /* NodeList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NodeList.h; path = tests/NodeList.h; sourceTree = "<group>"; };
+ 144007490A536CC20005F061 /* NodeList.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = NodeList.c; path = tests/NodeList.c; sourceTree = "<group>"; };
+ 144007550A5370D20005F061 /* JSNodeList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSNodeList.h; path = tests/JSNodeList.h; sourceTree = "<group>"; };
+ 144007560A5370D20005F061 /* JSNodeList.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = JSNodeList.c; path = tests/JSNodeList.c; sourceTree = "<group>"; };
+ 1440F6410A4F8B6A0005F061 /* JSNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSNode.h; path = tests/JSNode.h; sourceTree = "<group>"; };
+ 1440F6420A4F8B6A0005F061 /* JSNode.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = JSNode.c; path = tests/JSNode.c; sourceTree = "<group>"; };
+ 1440F88F0A508B100005F061 /* JSCallbackFunction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCallbackFunction.h; sourceTree = "<group>"; };
+ 1440F8900A508B100005F061 /* JSCallbackFunction.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCallbackFunction.cpp; sourceTree = "<group>"; };
+ 1440F8AC0A508D200005F061 /* JSCallbackConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCallbackConstructor.h; sourceTree = "<group>"; };
+ 1440F8AD0A508D200005F061 /* JSCallbackConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCallbackConstructor.cpp; sourceTree = "<group>"; };
+ 1440FCE10A51E46B0005F061 /* JSClassRef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSClassRef.h; sourceTree = "<group>"; };
+ 1440FCE20A51E46B0005F061 /* JSClassRef.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSClassRef.cpp; sourceTree = "<group>"; };
+ 145C507F0D9DF63B0088F6B9 /* CallData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CallData.h; sourceTree = "<group>"; };
+ 146AAB2A0B66A84900E55F16 /* JSStringRefCF.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSStringRefCF.h; sourceTree = "<group>"; };
+ 146AAB370B66A94400E55F16 /* JSStringRefCF.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSStringRefCF.cpp; sourceTree = "<group>"; };
+ 146FE51111A710430087AE66 /* JITCall32_64.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JITCall32_64.cpp; sourceTree = "<group>"; };
+ 14760863099C633800437128 /* JSImmediate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSImmediate.cpp; sourceTree = "<group>"; };
+ 147B83AA0E6DB8C9004775A4 /* BatchedTransitionOptimizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BatchedTransitionOptimizer.h; sourceTree = "<group>"; };
+ 147B84620E6DE6B1004775A4 /* PutPropertySlot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PutPropertySlot.h; sourceTree = "<group>"; };
+ 1480DB9B0DDC227F003CFDF2 /* DebuggerCallFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DebuggerCallFrame.h; sourceTree = "<group>"; };
+ 1482B6EA0A4300B300517CFC /* JSValueRef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSValueRef.h; sourceTree = "<group>"; };
+ 1482B74B0A43032800517CFC /* JSStringRef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSStringRef.h; sourceTree = "<group>"; };
+ 1482B74C0A43032800517CFC /* JSStringRef.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSStringRef.cpp; sourceTree = "<group>"; };
+ 1482B78A0A4305AB00517CFC /* APICast.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APICast.h; sourceTree = "<group>"; };
+ 1482B7E10A43076000517CFC /* JSObjectRef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSObjectRef.h; sourceTree = "<group>"; };
+ 1482B7E20A43076000517CFC /* JSObjectRef.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSObjectRef.cpp; sourceTree = "<group>"; };
+ 1483B589099BC1950016E4F0 /* JSImmediate.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSImmediate.h; sourceTree = "<group>"; };
+ 148A1626095D16BB00666D0D /* ListRefPtr.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ListRefPtr.h; sourceTree = "<group>"; };
+ 148A1ECD0D10C23B0069A47C /* RefPtrHashMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RefPtrHashMap.h; sourceTree = "<group>"; };
+ 148CD1D7108CF902008163C6 /* JSContextRefPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSContextRefPrivate.h; sourceTree = "<group>"; };
+ 149559ED0DDCDDF700648087 /* DebuggerCallFrame.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DebuggerCallFrame.cpp; sourceTree = "<group>"; };
+ 149B24FF0D8AF6D1009CB8C7 /* Register.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Register.h; sourceTree = "<group>"; };
+ 14A1563010966365006FA260 /* DateInstanceCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DateInstanceCache.h; sourceTree = "<group>"; };
+ 14A23D6C0F4E19CE0023CDAD /* JITStubs.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JITStubs.cpp; sourceTree = "<group>"; };
+ 14A396A60CD2933100B5B4FF /* SymbolTable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SymbolTable.h; sourceTree = "<group>"; };
+ 14A42E3D0F4F60EE00599099 /* TimeoutChecker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TimeoutChecker.cpp; sourceTree = "<group>"; };
+ 14A42E3E0F4F60EE00599099 /* TimeoutChecker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TimeoutChecker.h; sourceTree = "<group>"; };
+ 14A6581A0F4E36F4000150FD /* JITStubs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JITStubs.h; sourceTree = "<group>"; };
+ 14ABB36E099C076400E2A24F /* JSValue.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSValue.h; sourceTree = "<group>"; };
+ 14ABB454099C2A0F00E2A24F /* JSType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSType.h; sourceTree = "<group>"; };
+ 14ABDF5D0A437FEF00ECCA01 /* JSCallbackObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCallbackObject.h; sourceTree = "<group>"; };
+ 14ABDF5E0A437FEF00ECCA01 /* JSCallbackObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCallbackObject.cpp; sourceTree = "<group>"; };
+ 14B3EF0312BC24DD00D29EFF /* PageBlock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageBlock.h; sourceTree = "<group>"; };
+ 14B3EF0412BC24DD00D29EFF /* PageBlock.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PageBlock.cpp; sourceTree = "<group>"; };
+ 14B8ECA60A5653980062BE54 /* JavaScriptCore.exp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.exports; path = JavaScriptCore.exp; sourceTree = "<group>"; tabWidth = 4; usesTabs = 0; };
+ 14BD59BF0A3E8F9000BAF59C /* testapi */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testapi; sourceTree = BUILT_PRODUCTS_DIR; };
+ 14BD5A290A3E91F600BAF59C /* JSContextRef.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSContextRef.cpp; sourceTree = "<group>"; };
+ 14BD5A2A0A3E91F600BAF59C /* JSContextRef.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSContextRef.h; sourceTree = "<group>"; };
+ 14BD5A2B0A3E91F600BAF59C /* JSValueRef.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSValueRef.cpp; sourceTree = "<group>"; };
+ 14BD5A2D0A3E91F600BAF59C /* testapi.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = testapi.c; path = API/tests/testapi.c; sourceTree = "<group>"; };
+ 14BFCE6810CDB1FC00364CCE /* WeakGCMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WeakGCMap.h; sourceTree = "<group>"; };
+ 14D792640DAA03FB001A9F05 /* RegisterFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RegisterFile.h; sourceTree = "<group>"; };
+ 14D857740A4696C80032146C /* testapi.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = testapi.js; path = API/tests/testapi.js; sourceTree = "<group>"; };
+ 14DA818E0D99FD2000B0A4FB /* JSActivation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSActivation.h; sourceTree = "<group>"; };
+ 14DA818F0D99FD2000B0A4FB /* JSActivation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSActivation.cpp; sourceTree = "<group>"; };
+ 14DE0D680D02431400AACCA2 /* JSGlobalObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSGlobalObject.cpp; sourceTree = "<group>"; };
+ 14F252560D08DD8D004ECFFF /* JSVariableObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSVariableObject.h; sourceTree = "<group>"; };
+ 14F3488E0E95EF8A003648BC /* CollectorHeapIterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CollectorHeapIterator.h; sourceTree = "<group>"; };
+ 14FFF98A12BFFF7500795BB8 /* PageAllocationAligned.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PageAllocationAligned.cpp; sourceTree = "<group>"; };
+ 14FFF98B12BFFF7500795BB8 /* PageAllocationAligned.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageAllocationAligned.h; sourceTree = "<group>"; };
+ 180B9AEF0F16C569009BDBC5 /* CurrentTime.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CurrentTime.cpp; sourceTree = "<group>"; };
+ 180B9AF00F16C569009BDBC5 /* CurrentTime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CurrentTime.h; sourceTree = "<group>"; };
+ 18BAB52710DADFCD000D945B /* ThreadIdentifierDataPthreads.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ThreadIdentifierDataPthreads.cpp; sourceTree = "<group>"; };
+ 18BAB52810DADFCD000D945B /* ThreadIdentifierDataPthreads.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ThreadIdentifierDataPthreads.h; sourceTree = "<group>"; };
+ 1C61516A0EBAC7A00031376F /* ProfilerServer.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = ProfilerServer.mm; path = profiler/ProfilerServer.mm; sourceTree = "<group>"; };
+ 1C61516B0EBAC7A00031376F /* ProfilerServer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ProfilerServer.h; path = profiler/ProfilerServer.h; sourceTree = "<group>"; };
+ 1C9051420BA9E8A70081E9D0 /* Version.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Version.xcconfig; sourceTree = "<group>"; };
+ 1C9051430BA9E8A70081E9D0 /* JavaScriptCore.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = JavaScriptCore.xcconfig; sourceTree = "<group>"; };
+ 1C9051440BA9E8A70081E9D0 /* DebugRelease.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = DebugRelease.xcconfig; sourceTree = "<group>"; };
+ 1C9051450BA9E8A70081E9D0 /* Base.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Base.xcconfig; sourceTree = "<group>"; };
+ 1CAA8B4A0D32C39A0041BCFF /* JavaScript.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JavaScript.h; sourceTree = "<group>"; };
+ 1CAA8B4B0D32C39A0041BCFF /* JavaScriptCore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JavaScriptCore.h; sourceTree = "<group>"; };
+ 41359CF40FDD89CB00206180 /* DateMath.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DateMath.cpp; sourceTree = "<group>"; };
+ 41359CF50FDD89CB00206180 /* DateMath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DateMath.h; sourceTree = "<group>"; };
+ 440B7AED0FAF7FCB0073323E /* OwnPtrCommon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OwnPtrCommon.h; sourceTree = "<group>"; };
+ 449097EE0F8F81B50076A327 /* FeatureDefines.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = FeatureDefines.xcconfig; sourceTree = "<group>"; };
+ 44DD48520FAEA85000D6B4EB /* PassOwnPtr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PassOwnPtr.h; sourceTree = "<group>"; };
+ 45E12D8806A49B0F00E9DF84 /* jsc.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = jsc.cpp; sourceTree = "<group>"; tabWidth = 4; };
+ 511FC4C7117EE23D00425272 /* MD5.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MD5.cpp; sourceTree = "<group>"; };
+ 511FC4CA117EE2A800425272 /* MD5.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MD5.h; sourceTree = "<group>"; };
+ 5135FAD512D26856003C083B /* Decoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Decoder.h; sourceTree = "<group>"; };
+ 5135FAD612D26856003C083B /* Encoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Encoder.h; sourceTree = "<group>"; };
+ 5186111D0CC824830081412B /* Deque.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Deque.h; sourceTree = "<group>"; };
+ 51F0EB6105C86C6B00E6DF1B /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
+ 51F0EC0705C86C9A00E6DF1B /* libobjc.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libobjc.dylib; path = /usr/lib/libobjc.dylib; sourceTree = "<absolute>"; };
+ 51F648D60BB4E2CA0033D760 /* RetainPtr.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = RetainPtr.h; sourceTree = "<group>"; };
+ 5D53726D0E1C546B0021E549 /* Tracing.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Tracing.d; sourceTree = "<group>"; };
+ 5D53726E0E1C54880021E549 /* Tracing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Tracing.h; sourceTree = "<group>"; };
+ 5D53727D0E1C55EC0021E549 /* TracingDtrace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TracingDtrace.h; sourceTree = "<group>"; };
+ 5D5D8AD00E0D0EBE00F9C692 /* libedit.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libedit.dylib; path = /usr/lib/libedit.dylib; sourceTree = "<absolute>"; };
+ 5D63E9AC10F2BD6E00FC8AE9 /* StringHasher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StringHasher.h; sourceTree = "<group>"; };
+ 5D6A566A0F05995500266145 /* Threading.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Threading.cpp; sourceTree = "<group>"; };
+ 5DA479650CFBCF56009328A0 /* TCPackedCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TCPackedCache.h; sourceTree = "<group>"; };
+ 5DBD18AF0C5401A700C15EAE /* MallocZoneSupport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MallocZoneSupport.h; sourceTree = "<group>"; };
+ 5DE3D0F40DD8DDFB00468714 /* WebKitAvailability.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKitAvailability.h; sourceTree = "<group>"; };
+ 6507D2970E871E4A00D7D896 /* JSTypeInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSTypeInfo.h; sourceTree = "<group>"; };
+ 651F6412039D5B5F0078395C /* dtoa.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = dtoa.cpp; sourceTree = "<group>"; tabWidth = 8; };
+ 651F6413039D5B5F0078395C /* dtoa.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = dtoa.h; sourceTree = "<group>"; tabWidth = 8; };
+ 652246A40C8D7A0E007BDAF7 /* HashIterators.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HashIterators.h; sourceTree = "<group>"; };
+ 65400C0F0A69BAF200509887 /* PropertyNameArray.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = PropertyNameArray.cpp; sourceTree = "<group>"; };
+ 65400C100A69BAF200509887 /* PropertyNameArray.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = PropertyNameArray.h; sourceTree = "<group>"; };
+ 6541720F039E08B90058BFEB /* pcre.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = pcre.h; sourceTree = "<group>"; tabWidth = 8; };
+ 6541BD6E08E80A17002CBEE7 /* TCPageMap.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = TCPageMap.h; sourceTree = "<group>"; tabWidth = 8; };
+ 6541BD6F08E80A17002CBEE7 /* TCSpinLock.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = TCSpinLock.h; sourceTree = "<group>"; tabWidth = 8; };
+ 6541BD7008E80A17002CBEE7 /* TCSystemAlloc.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TCSystemAlloc.cpp; sourceTree = "<group>"; tabWidth = 8; };
+ 6541BD7108E80A17002CBEE7 /* TCSystemAlloc.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = TCSystemAlloc.h; sourceTree = "<group>"; tabWidth = 8; };
+ 655EB29A10CE2581001A990E /* NodesCodegen.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NodesCodegen.cpp; sourceTree = "<group>"; };
+ 6560A4CF04B3B3E7008AE952 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = /System/Library/Frameworks/CoreFoundation.framework; sourceTree = "<absolute>"; };
+ 65621E6B089E859700760F35 /* PropertySlot.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PropertySlot.cpp; sourceTree = "<group>"; tabWidth = 8; };
+ 65621E6C089E859700760F35 /* PropertySlot.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = PropertySlot.h; sourceTree = "<group>"; tabWidth = 8; };
+ 657EB7450B708F540063461B /* ListHashSet.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ListHashSet.h; sourceTree = "<group>"; };
+ 657EEBBF094E445E008C9C7B /* HashCountedSet.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = HashCountedSet.h; sourceTree = "<group>"; tabWidth = 8; };
+ 6580F795094070560082C219 /* PassRefPtr.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = PassRefPtr.h; sourceTree = "<group>"; tabWidth = 8; };
+ 6592C316098B7DE10003D4F6 /* Vector.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Vector.h; sourceTree = "<group>"; };
+ 6592C317098B7DE10003D4F6 /* VectorTraits.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = VectorTraits.h; sourceTree = "<group>"; };
+ 65B174BE09D1000200820339 /* chartables.c */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.c; fileEncoding = 30; path = chartables.c; sourceTree = "<group>"; };
+ 65C02FBB0637462A003E7EE6 /* Protect.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = Protect.h; sourceTree = "<group>"; tabWidth = 8; };
+ 65C647B3093EF8D60022C380 /* RefPtr.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = RefPtr.h; sourceTree = "<group>"; tabWidth = 8; };
+ 65C7A1710A8EAACB00FA37EA /* JSWrapperObject.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSWrapperObject.cpp; sourceTree = "<group>"; };
+ 65C7A1720A8EAACB00FA37EA /* JSWrapperObject.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSWrapperObject.h; sourceTree = "<group>"; };
+ 65D6D87E09B5A32E0002E4D7 /* Platform.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Platform.h; sourceTree = "<group>"; };
+ 65DFC92A08EA173A00F7300B /* HashFunctions.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = HashFunctions.h; sourceTree = "<group>"; tabWidth = 8; };
+ 65DFC92B08EA173A00F7300B /* HashMap.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = HashMap.h; sourceTree = "<group>"; tabWidth = 8; };
+ 65DFC92C08EA173A00F7300B /* HashSet.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = HashSet.h; sourceTree = "<group>"; tabWidth = 8; };
+ 65DFC92D08EA173A00F7300B /* HashTable.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HashTable.cpp; sourceTree = "<group>"; tabWidth = 8; };
+ 65DFC92E08EA173A00F7300B /* HashTable.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = HashTable.h; sourceTree = "<group>"; tabWidth = 8; };
+ 65DFC92F08EA173A00F7300B /* HashTraits.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = HashTraits.h; sourceTree = "<group>"; tabWidth = 8; };
+ 65E1A2F4122B880D00B26097 /* NonCopyingSort.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NonCopyingSort.h; sourceTree = "<group>"; };
+ 65E217B708E7EECC0023E5F6 /* Assertions.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = Assertions.h; sourceTree = "<group>"; tabWidth = 8; };
+ 65E217B808E7EECC0023E5F6 /* Assertions.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Assertions.cpp; sourceTree = "<group>"; tabWidth = 8; };
+ 65E217B908E7EECC0023E5F6 /* FastMalloc.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FastMalloc.cpp; sourceTree = "<group>"; tabWidth = 8; };
+ 65E217BA08E7EECC0023E5F6 /* FastMalloc.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = FastMalloc.h; sourceTree = "<group>"; tabWidth = 8; };
+ 65E866ED0DD59AFA00A2B2A1 /* SourceProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SourceProvider.h; sourceTree = "<group>"; };
+ 65E866EE0DD59AFA00A2B2A1 /* SourceCode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SourceCode.h; sourceTree = "<group>"; };
+ 65EA4C99092AF9E20093D800 /* JSLock.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSLock.cpp; sourceTree = "<group>"; tabWidth = 8; };
+ 65EA4C9A092AF9E20093D800 /* JSLock.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = JSLock.h; sourceTree = "<group>"; tabWidth = 8; };
+ 65EA73620BAE35D1001BB560 /* CommonIdentifiers.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CommonIdentifiers.cpp; sourceTree = "<group>"; };
+ 65EA73630BAE35D1001BB560 /* CommonIdentifiers.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CommonIdentifiers.h; sourceTree = "<group>"; };
+ 704FD35305697E6D003DBED9 /* BooleanObject.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = BooleanObject.h; sourceTree = "<group>"; tabWidth = 8; };
+ 7E2C6C980D31C6B6002D44E2 /* ScopeChainMark.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScopeChainMark.h; sourceTree = "<group>"; };
+ 7E4EE7080EBB7963005934AA /* StructureChain.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StructureChain.h; sourceTree = "<group>"; };
+ 7E4EE70E0EBB7A5B005934AA /* StructureChain.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StructureChain.cpp; sourceTree = "<group>"; };
+ 7EFF00630EC05A9A00AA7C93 /* NodeInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NodeInfo.h; sourceTree = "<group>"; };
+ 860161DF0F3A83C100F84710 /* AbstractMacroAssembler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AbstractMacroAssembler.h; sourceTree = "<group>"; };
+ 860161E00F3A83C100F84710 /* MacroAssemblerX86.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MacroAssemblerX86.h; sourceTree = "<group>"; };
+ 860161E10F3A83C100F84710 /* MacroAssemblerX86_64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MacroAssemblerX86_64.h; sourceTree = "<group>"; };
+ 860161E20F3A83C100F84710 /* MacroAssemblerX86Common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MacroAssemblerX86Common.h; sourceTree = "<group>"; };
+ 8626BECE11928E3900782FAB /* StringStatics.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StringStatics.cpp; path = text/StringStatics.cpp; sourceTree = "<group>"; };
+ 8627E5EA11F1281900A313B5 /* PageAllocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageAllocation.h; sourceTree = "<group>"; };
+ 862AF4B512239C7B0024E5B8 /* DecimalNumber.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DecimalNumber.h; sourceTree = "<group>"; };
+ 863B23DF0FC60E6200703AA4 /* MacroAssemblerCodeRef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MacroAssemblerCodeRef.h; sourceTree = "<group>"; };
+ 86438FC31265503E00E0DFCA /* StringBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StringBuilder.cpp; path = text/StringBuilder.cpp; sourceTree = "<group>"; };
+ 86565740115BE3DA00291F40 /* CString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CString.cpp; path = text/CString.cpp; sourceTree = "<group>"; };
+ 86565741115BE3DA00291F40 /* CString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CString.h; path = text/CString.h; sourceTree = "<group>"; };
+ 865F408710E7D56300947361 /* APIShims.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIShims.h; sourceTree = "<group>"; };
+ 86676D4D11FED55D004B6863 /* BumpPointerAllocator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BumpPointerAllocator.h; sourceTree = "<group>"; };
+ 867FC35F11B763950025105E /* JavaScriptCore.JSVALUE32_64only.exp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.exports; path = JavaScriptCore.JSVALUE32_64only.exp; sourceTree = "<group>"; };
+ 867FC36011B763950025105E /* JavaScriptCore.JSVALUE32only.exp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.exports; path = JavaScriptCore.JSVALUE32only.exp; sourceTree = "<group>"; };
+ 867FC36111B763950025105E /* JavaScriptCore.JSVALUE64only.exp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.exports; path = JavaScriptCore.JSVALUE64only.exp; sourceTree = "<group>"; };
+ 868BFA00117CEFD100B908B1 /* AtomicString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AtomicString.cpp; path = text/AtomicString.cpp; sourceTree = "<group>"; };
+ 868BFA01117CEFD100B908B1 /* AtomicString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AtomicString.h; path = text/AtomicString.h; sourceTree = "<group>"; };
+ 868BFA02117CEFD100B908B1 /* AtomicStringImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AtomicStringImpl.h; path = text/AtomicStringImpl.h; sourceTree = "<group>"; };
+ 868BFA05117CEFD100B908B1 /* StringHash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StringHash.h; path = text/StringHash.h; sourceTree = "<group>"; };
+ 868BFA06117CEFD100B908B1 /* StringImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StringImpl.cpp; path = text/StringImpl.cpp; sourceTree = "<group>"; };
+ 868BFA07117CEFD100B908B1 /* StringImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StringImpl.h; path = text/StringImpl.h; sourceTree = "<group>"; };
+ 868BFA15117CF19900B908B1 /* WTFString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WTFString.cpp; path = text/WTFString.cpp; sourceTree = "<group>"; };
+ 868BFA16117CF19900B908B1 /* WTFString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WTFString.h; path = text/WTFString.h; sourceTree = "<group>"; };
+ 868BFA5F117D048200B908B1 /* StaticConstructors.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StaticConstructors.h; sourceTree = "<group>"; };
+ 868D81A112C428CE0093DC84 /* RegexPattern.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RegexPattern.cpp; path = yarr/RegexPattern.cpp; sourceTree = "<group>"; };
+ 8690231412092D5C00630AF9 /* PageReservation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageReservation.h; sourceTree = "<group>"; };
+ 869D04AE1193B54D00803475 /* CachedTranscendentalFunction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CachedTranscendentalFunction.h; sourceTree = "<group>"; };
+ 869EBCB60E8C6D4A008722CC /* ResultType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResultType.h; sourceTree = "<group>"; };
+ 86A90ECF0EE7D51F00AB350D /* JITArithmetic.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JITArithmetic.cpp; sourceTree = "<group>"; };
+ 86ADD1430FDDEA980006EEC2 /* ARMv7Assembler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARMv7Assembler.h; sourceTree = "<group>"; };
+ 86ADD1440FDDEA980006EEC2 /* MacroAssemblerARMv7.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MacroAssemblerARMv7.h; sourceTree = "<group>"; };
+ 86B99AB6117E391E00DF5A90 /* RopeImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RopeImpl.cpp; sourceTree = "<group>"; };
+ 86B99AB7117E391E00DF5A90 /* RopeImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RopeImpl.h; sourceTree = "<group>"; };
+ 86B99AE1117E578100DF5A90 /* StringBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StringBuffer.h; path = text/StringBuffer.h; sourceTree = "<group>"; };
+ 86B99AE2117E578100DF5A90 /* StringImplBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StringImplBase.h; path = text/StringImplBase.h; sourceTree = "<group>"; };
+ 86C36EE90EE1289D00B3DF59 /* MacroAssembler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MacroAssembler.h; sourceTree = "<group>"; };
+ 86C568DD11A213EE0007F7F0 /* MacroAssemblerARM.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MacroAssemblerARM.cpp; sourceTree = "<group>"; };
+ 86C568DE11A213EE0007F7F0 /* MacroAssemblerMIPS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MacroAssemblerMIPS.h; sourceTree = "<group>"; };
+ 86C568DF11A213EE0007F7F0 /* MIPSAssembler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MIPSAssembler.h; sourceTree = "<group>"; };
+ 86CA032D1038E8440028A609 /* Executable.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Executable.cpp; sourceTree = "<group>"; };
+ 86CAFEE21035DDE60028A609 /* Executable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Executable.h; sourceTree = "<group>"; };
+ 86CC85A00EE79A4700288682 /* JITInlineMethods.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JITInlineMethods.h; sourceTree = "<group>"; };
+ 86CC85A20EE79B7400288682 /* JITCall.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JITCall.cpp; sourceTree = "<group>"; };
+ 86CC85C30EE7A89400288682 /* JITPropertyAccess.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JITPropertyAccess.cpp; sourceTree = "<group>"; };
+ 86CCEFDD0F413F8900FD7F9E /* JITCode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JITCode.h; sourceTree = "<group>"; };
+ 86D08D5111793613006E5ED0 /* WTFThreadData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WTFThreadData.cpp; sourceTree = "<group>"; };
+ 86D08D5211793613006E5ED0 /* WTFThreadData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WTFThreadData.h; sourceTree = "<group>"; };
+ 86D3B2BF10156BDE002865E7 /* ARMAssembler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ARMAssembler.cpp; sourceTree = "<group>"; };
+ 86D3B2C010156BDE002865E7 /* ARMAssembler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARMAssembler.h; sourceTree = "<group>"; };
+ 86D3B2C110156BDE002865E7 /* AssemblerBufferWithConstantPool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AssemblerBufferWithConstantPool.h; sourceTree = "<group>"; };
+ 86D3B2C210156BDE002865E7 /* MacroAssemblerARM.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MacroAssemblerARM.h; sourceTree = "<group>"; };
+ 86D3B3C110159D7F002865E7 /* LinkBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LinkBuffer.h; sourceTree = "<group>"; };
+ 86D3B3C210159D7F002865E7 /* RepatchBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RepatchBuffer.h; sourceTree = "<group>"; };
+ 86D87DA512BC4B14008E73A1 /* StackBounds.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StackBounds.cpp; sourceTree = "<group>"; };
+ 86D87DA612BC4B14008E73A1 /* StackBounds.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StackBounds.h; sourceTree = "<group>"; };
+ 86DB64630F95C6FC00D7D921 /* ExecutableAllocatorFixedVMPool.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ExecutableAllocatorFixedVMPool.cpp; sourceTree = "<group>"; };
+ 86E116B00FE75AC800B512BC /* CodeLocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CodeLocation.h; sourceTree = "<group>"; };
+ 86E85538111B9968001AF51E /* JSStringBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSStringBuilder.h; sourceTree = "<group>"; };
+ 86EAC48F0F93E8D1008EC948 /* RegexInterpreter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RegexInterpreter.cpp; path = yarr/RegexInterpreter.cpp; sourceTree = "<group>"; };
+ 86EAC4900F93E8D1008EC948 /* RegexInterpreter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RegexInterpreter.h; path = yarr/RegexInterpreter.h; sourceTree = "<group>"; };
+ 86EAC4910F93E8D1008EC948 /* RegexJIT.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RegexJIT.cpp; path = yarr/RegexJIT.cpp; sourceTree = "<group>"; };
+ 86EAC4920F93E8D1008EC948 /* RegexJIT.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RegexJIT.h; path = yarr/RegexJIT.h; sourceTree = "<group>"; };
+ 86EAC4930F93E8D1008EC948 /* RegexParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RegexParser.h; path = yarr/RegexParser.h; sourceTree = "<group>"; };
+ 86EAC4940F93E8D1008EC948 /* RegexPattern.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RegexPattern.h; path = yarr/RegexPattern.h; sourceTree = "<group>"; };
+ 86F38858121130CA007A7CE3 /* AtomicStringHash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AtomicStringHash.h; path = text/AtomicStringHash.h; sourceTree = "<group>"; };
+ 90213E3B123A40C200D422F3 /* MemoryStatistics.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MemoryStatistics.cpp; sourceTree = "<group>"; };
+ 90213E3C123A40C200D422F3 /* MemoryStatistics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MemoryStatistics.h; sourceTree = "<group>"; };
+ 905B02AD0E28640F006DF882 /* RefCountedLeakCounter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RefCountedLeakCounter.cpp; sourceTree = "<group>"; };
+ 90D3469B0E285280009492EE /* RefCountedLeakCounter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RefCountedLeakCounter.h; sourceTree = "<group>"; };
+ 9303F567099118FA00AD71B8 /* OwnPtr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OwnPtr.h; sourceTree = "<group>"; };
+ 9303F5690991190000AD71B8 /* Noncopyable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Noncopyable.h; sourceTree = "<group>"; };
+ 9303F5A409911A5800AD71B8 /* OwnArrayPtr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OwnArrayPtr.h; sourceTree = "<group>"; };
+ 93052C320FB792190048FDC3 /* ParserArena.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ParserArena.cpp; sourceTree = "<group>"; };
+ 93052C330FB792190048FDC3 /* ParserArena.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ParserArena.h; sourceTree = "<group>"; };
+ 930754BF08B0F68000AB3056 /* pcre_compile.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = pcre_compile.cpp; sourceTree = "<group>"; tabWidth = 8; };
+ 930754CE08B0F74500AB3056 /* pcre_tables.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = pcre_tables.cpp; sourceTree = "<group>"; tabWidth = 8; };
+ 930754E908B0F78500AB3056 /* pcre_exec.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = pcre_exec.cpp; sourceTree = "<group>"; tabWidth = 8; };
+ 930DAD030FB1EB1A0082D205 /* NodeConstructors.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NodeConstructors.h; sourceTree = "<group>"; };
+ 9322A00306C341D3009067BB /* libicucore.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libicucore.dylib; path = /usr/lib/libicucore.dylib; sourceTree = "<absolute>"; };
+ 932F5BD80822A1C700736975 /* Info.plist */ = {isa = PBXFileReference; indentWidth = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; tabWidth = 8; usesTabs = 1; };
+ 932F5BD90822A1C700736975 /* JavaScriptCore.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = JavaScriptCore.framework; sourceTree = BUILT_PRODUCTS_DIR; };
+ 932F5BE10822A1C700736975 /* jsc */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jsc; sourceTree = BUILT_PRODUCTS_DIR; };
+ 93303FE80E6A72B500786E6A /* SmallStrings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SmallStrings.cpp; sourceTree = "<group>"; };
+ 93303FEA0E6A72C000786E6A /* SmallStrings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SmallStrings.h; sourceTree = "<group>"; };
+ 933A349A038AE7C6008635CE /* Identifier.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = Identifier.h; sourceTree = "<group>"; tabWidth = 8; };
+ 933A349D038AE80F008635CE /* Identifier.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Identifier.cpp; sourceTree = "<group>"; tabWidth = 8; };
+ 933F5CDB126922690049191E /* NullPtr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NullPtr.h; sourceTree = "<group>"; };
+ 935AF46909E9D9DB00ACD1D8 /* Forward.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Forward.h; sourceTree = "<group>"; };
+ 935AF46B09E9D9DB00ACD1D8 /* UnusedParam.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UnusedParam.h; sourceTree = "<group>"; };
+ 937013470CA97E0E00FA14D3 /* pcre_ucp_searchfuncs.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = pcre_ucp_searchfuncs.cpp; sourceTree = "<group>"; };
+ 9374D3A7038D9D74008635CE /* ScopeChain.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = ScopeChain.h; sourceTree = "<group>"; tabWidth = 8; };
+ 9374D3A8038D9D74008635CE /* ScopeChain.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScopeChain.cpp; sourceTree = "<group>"; tabWidth = 8; };
+ 937B63CC09E766D200A671DD /* DerivedSources.make */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; path = DerivedSources.make; sourceTree = "<group>"; usesTabs = 1; };
+ 93854A9912C93D3B00DAAF77 /* NullPtr.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = NullPtr.cpp; path = ./wtf/NullPtr.cpp; sourceTree = SOURCE_ROOT; };
+ 938772E5038BFE19008635CE /* JSArray.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = JSArray.h; sourceTree = "<group>"; tabWidth = 8; };
+ 938C4F690CA06BC700D9310A /* ASCIICType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASCIICType.h; sourceTree = "<group>"; };
+ 938C4F6B0CA06BCE00D9310A /* DisallowCType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DisallowCType.h; sourceTree = "<group>"; };
+ 93AA4F770957251F0084B3A7 /* AlwaysInline.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = AlwaysInline.h; sourceTree = "<group>"; tabWidth = 8; };
+ 93ADFCE60CCBD7AC00D30B08 /* JSArray.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSArray.cpp; sourceTree = "<group>"; };
+ 93B6A0DE0AA64DA40076DE27 /* GetPtr.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = GetPtr.h; sourceTree = "<group>"; };
+ 93CEDDFB0EA91EE600258EBE /* RegExpMatchesArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RegExpMatchesArray.h; sourceTree = "<group>"; };
+ 93E26BD308B1514100F85226 /* pcre_xclass.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = pcre_xclass.cpp; sourceTree = "<group>"; tabWidth = 8; };
+ 93E26BE508B1517100F85226 /* pcre_internal.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = pcre_internal.h; sourceTree = "<group>"; tabWidth = 8; };
+ 93E26BFC08B151D400F85226 /* ucpinternal.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = ucpinternal.h; sourceTree = "<group>"; tabWidth = 8; };
+ 93F0B3A909BB4DC00068FCE3 /* Parser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Parser.cpp; sourceTree = "<group>"; };
+ 93F0B3AA09BB4DC00068FCE3 /* Parser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Parser.h; sourceTree = "<group>"; };
+ 93F1981A08245AAE001E9ABC /* Keywords.table */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = text; path = Keywords.table; sourceTree = "<group>"; tabWidth = 8; };
+ 952C63AC0E4777D600C13936 /* JSProfilerPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSProfilerPrivate.h; sourceTree = "<group>"; };
+ 95742F630DD11F5A000917FB /* Profile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Profile.cpp; path = profiler/Profile.cpp; sourceTree = "<group>"; };
+ 95742F640DD11F5A000917FB /* Profile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Profile.h; path = profiler/Profile.h; sourceTree = "<group>"; };
+ 95988BA90E477BEC00D28D4D /* JSProfilerPrivate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSProfilerPrivate.cpp; sourceTree = "<group>"; };
+ 95AB832E0DA42CAD00BC83F3 /* Profiler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Profiler.cpp; path = profiler/Profiler.cpp; sourceTree = "<group>"; };
+ 95AB832F0DA42CAD00BC83F3 /* Profiler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Profiler.h; path = profiler/Profiler.h; sourceTree = "<group>"; };
+ 95AB83540DA43B4400BC83F3 /* ProfileNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ProfileNode.cpp; path = profiler/ProfileNode.cpp; sourceTree = "<group>"; };
+ 95AB83550DA43B4400BC83F3 /* ProfileNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ProfileNode.h; path = profiler/ProfileNode.h; sourceTree = "<group>"; };
+ 95C18D3E0C90E7EF00E72F73 /* JSRetainPtr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSRetainPtr.h; sourceTree = "<group>"; };
+ 95CD45740E1C4FDD0085358E /* ProfileGenerator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ProfileGenerator.cpp; path = profiler/ProfileGenerator.cpp; sourceTree = "<group>"; };
+ 95CD45750E1C4FDD0085358E /* ProfileGenerator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ProfileGenerator.h; path = profiler/ProfileGenerator.h; sourceTree = "<group>"; };
+ 95E3BC040E1AE68200B2D1C1 /* CallIdentifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CallIdentifier.h; path = profiler/CallIdentifier.h; sourceTree = "<group>"; };
+ 960097A50EBABB58007A7297 /* LabelScope.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LabelScope.h; sourceTree = "<group>"; };
+ 960626950FB8EC02009798AB /* JITStubCall.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JITStubCall.h; sourceTree = "<group>"; };
+ 9688CB130ED12B4E001D649F /* AssemblerBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AssemblerBuffer.h; sourceTree = "<group>"; };
+ 9688CB140ED12B4E001D649F /* X86Assembler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = X86Assembler.h; sourceTree = "<group>"; };
+ 969A07200ED1CE3300F1F681 /* BytecodeGenerator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BytecodeGenerator.cpp; sourceTree = "<group>"; };
+ 969A07210ED1CE3300F1F681 /* BytecodeGenerator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BytecodeGenerator.h; sourceTree = "<group>"; };
+ 969A07270ED1CE6900F1F681 /* Label.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Label.h; sourceTree = "<group>"; };
+ 969A07280ED1CE6900F1F681 /* RegisterID.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RegisterID.h; sourceTree = "<group>"; };
+ 969A07290ED1CE6900F1F681 /* SegmentedVector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SegmentedVector.h; sourceTree = "<group>"; };
+ 969A07900ED1D3AE00F1F681 /* CodeBlock.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CodeBlock.cpp; sourceTree = "<group>"; };
+ 969A07910ED1D3AE00F1F681 /* CodeBlock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CodeBlock.h; sourceTree = "<group>"; };
+ 969A07920ED1D3AE00F1F681 /* EvalCodeCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EvalCodeCache.h; sourceTree = "<group>"; };
+ 969A07930ED1D3AE00F1F681 /* Instruction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Instruction.h; sourceTree = "<group>"; };
+ 969A07940ED1D3AE00F1F681 /* Opcode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Opcode.cpp; sourceTree = "<group>"; };
+ 969A07950ED1D3AE00F1F681 /* Opcode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Opcode.h; sourceTree = "<group>"; };
+ 969A09220ED1E09C00F1F681 /* Completion.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Completion.cpp; sourceTree = "<group>"; };
+ 96DD73780F9DA3100027FBCC /* VMTags.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VMTags.h; sourceTree = "<group>"; };
+ 9714AF31122F27E70092D9F5 /* RawURLBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RawURLBuffer.h; path = url/src/RawURLBuffer.h; sourceTree = "<group>"; };
+ 9714AF32122F27E70092D9F5 /* URLBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = URLBuffer.h; path = url/src/URLBuffer.h; sourceTree = "<group>"; };
+ 9714AF33122F27E70092D9F5 /* URLComponent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = URLComponent.h; path = url/src/URLComponent.h; sourceTree = "<group>"; };
+ 9714AF34122F27E70092D9F5 /* URLParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = URLParser.h; path = url/src/URLParser.h; sourceTree = "<group>"; };
+ 9714AF35122F27E70092D9F5 /* URLSegments.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = URLSegments.cpp; path = url/src/URLSegments.cpp; sourceTree = "<group>"; };
+ 9714AF36122F27E70092D9F5 /* URLSegments.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = URLSegments.h; path = url/src/URLSegments.h; sourceTree = "<group>"; };
+ 9714AF57122F31F50092D9F5 /* ParsedURL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ParsedURL.cpp; path = url/api/ParsedURL.cpp; sourceTree = "<group>"; };
+ 9714AF58122F31F50092D9F5 /* ParsedURL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ParsedURL.h; path = url/api/ParsedURL.h; sourceTree = "<group>"; };
+ 9714AF59122F31F50092D9F5 /* URLString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = URLString.h; path = url/api/URLString.h; sourceTree = "<group>"; };
+ 972A485D12661E0800F4514F /* URLCharacterTypes.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = URLCharacterTypes.cpp; path = url/src/URLCharacterTypes.cpp; sourceTree = "<group>"; };
+ 972A485E12661E0800F4514F /* URLCharacterTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = URLCharacterTypes.h; path = url/src/URLCharacterTypes.h; sourceTree = "<group>"; };
+ 972A48741266256F00F4514F /* URLEscape.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = URLEscape.cpp; path = url/src/URLEscape.cpp; sourceTree = "<group>"; };
+ 972A48751266256F00F4514F /* URLEscape.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = URLEscape.h; path = url/src/URLEscape.h; sourceTree = "<group>"; };
+ 972A48761266256F00F4514F /* URLQueryCanonicalizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = URLQueryCanonicalizer.h; path = url/src/URLQueryCanonicalizer.h; sourceTree = "<group>"; };
+ 97F6903A1169DF7F00A6BB46 /* Terminator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Terminator.h; sourceTree = "<group>"; };
+ A1712B3A11C7B212007A5315 /* RegExpCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RegExpCache.cpp; sourceTree = "<group>"; };
+ A1712B3E11C7B228007A5315 /* RegExpCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RegExpCache.h; sourceTree = "<group>"; };
+ A1712B4011C7B235007A5315 /* RegExpKey.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RegExpKey.h; sourceTree = "<group>"; };
+ A71236E41195F33C00BD2174 /* JITOpcodes32_64.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JITOpcodes32_64.cpp; sourceTree = "<group>"; };
+ A718F61A11754A21002465A7 /* RegExpJitTables.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RegExpJitTables.h; sourceTree = "<group>"; };
+ A718F8211178EB4B002465A7 /* create_regex_tables */ = {isa = PBXFileReference; explicitFileType = text.script.python; fileEncoding = 4; path = create_regex_tables; sourceTree = "<group>"; };
+ A72700770DAC605600E548D7 /* JSNotAnObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSNotAnObject.h; sourceTree = "<group>"; };
+ A72700780DAC605600E548D7 /* JSNotAnObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSNotAnObject.cpp; sourceTree = "<group>"; };
+ A72701B30DADE94900E548D7 /* ExceptionHelpers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExceptionHelpers.h; sourceTree = "<group>"; };
+ A727FF650DA3053B00E548D7 /* JSPropertyNameIterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSPropertyNameIterator.h; sourceTree = "<group>"; };
+ A727FF660DA3053B00E548D7 /* JSPropertyNameIterator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSPropertyNameIterator.cpp; sourceTree = "<group>"; };
+ A730B6101250068F009D25B1 /* StrictEvalActivation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StrictEvalActivation.h; sourceTree = "<group>"; };
+ A730B6111250068F009D25B1 /* StrictEvalActivation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StrictEvalActivation.cpp; sourceTree = "<group>"; };
+ A7386551118697B400540279 /* SpecializedThunkJIT.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SpecializedThunkJIT.h; sourceTree = "<group>"; };
+ A7386552118697B400540279 /* ThunkGenerators.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ThunkGenerators.cpp; sourceTree = "<group>"; };
+ A7386553118697B400540279 /* ThunkGenerators.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ThunkGenerators.h; sourceTree = "<group>"; };
+ A7482B791166CDEA003B0712 /* JSWeakObjectMapRefPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWeakObjectMapRefPrivate.h; sourceTree = "<group>"; };
+ A7482B7A1166CDEA003B0712 /* JSWeakObjectMapRefPrivate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWeakObjectMapRefPrivate.cpp; sourceTree = "<group>"; };
+ A7482E37116A697B003B0712 /* JSWeakObjectMapRefInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWeakObjectMapRefInternal.h; sourceTree = "<group>"; };
+ A74B3498102A5F8E0032AB98 /* MarkStack.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MarkStack.cpp; sourceTree = "<group>"; };
+ A74DE1CB120B86D600D40D5B /* ARMv7Assembler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ARMv7Assembler.cpp; sourceTree = "<group>"; };
+ A75706DD118A2BCF0057F88F /* JITArithmetic32_64.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JITArithmetic32_64.cpp; sourceTree = "<group>"; };
+ A76C51741182748D00715B05 /* JSInterfaceJIT.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSInterfaceJIT.h; sourceTree = "<group>"; };
+ A76EE6580FAE59D5003F069A /* NativeFunctionWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NativeFunctionWrapper.h; sourceTree = "<group>"; };
+ A779558F101A74D500114E55 /* MarkStack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MarkStack.h; sourceTree = "<group>"; };
+ A783A0D011A36DCA00563D20 /* JSObjectWithGlobalObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSObjectWithGlobalObject.h; sourceTree = "<group>"; };
+ A783A2AA11A5BE8400563D20 /* JSObjectWithGlobalObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSObjectWithGlobalObject.cpp; sourceTree = "<group>"; };
+ A791EF260F11E07900AE1F68 /* JSByteArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSByteArray.h; sourceTree = "<group>"; };
+ A791EF270F11E07900AE1F68 /* JSByteArray.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSByteArray.cpp; sourceTree = "<group>"; };
+ A79EDB0811531CD60019E912 /* JSObjectRefPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSObjectRefPrivate.h; sourceTree = "<group>"; };
+ A7A1F7AA0F252B3C00E184E2 /* ByteArray.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ByteArray.cpp; sourceTree = "<group>"; };
+ A7A1F7AB0F252B3C00E184E2 /* ByteArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ByteArray.h; sourceTree = "<group>"; };
+ A7A7EE7411B98B8D0065A14F /* ASTBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASTBuilder.h; sourceTree = "<group>"; };
+ A7A7EE7511B98B8D0065A14F /* JSParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSParser.cpp; sourceTree = "<group>"; };
+ A7A7EE7611B98B8D0065A14F /* JSParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSParser.h; sourceTree = "<group>"; };
+ A7A7EE7711B98B8D0065A14F /* SyntaxChecker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SyntaxChecker.h; sourceTree = "<group>"; };
+ A7B48DB50EE74CFC00DCBDB6 /* ExecutableAllocator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExecutableAllocator.h; sourceTree = "<group>"; };
+ A7B48DB60EE74CFC00DCBDB6 /* ExecutableAllocator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ExecutableAllocator.cpp; sourceTree = "<group>"; };
+ A7C1E8C8112E701C00A37F98 /* JITPropertyAccess32_64.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JITPropertyAccess32_64.cpp; sourceTree = "<group>"; };
+ A7C530E3102A3813005BC741 /* MarkStackPosix.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MarkStackPosix.cpp; sourceTree = "<group>"; };
+ A7D649A91015224E009B2E1B /* PossiblyNull.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PossiblyNull.h; sourceTree = "<group>"; };
+ A7E2EA690FB460CF00601F06 /* LiteralParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LiteralParser.h; sourceTree = "<group>"; };
+ A7E2EA6A0FB460CF00601F06 /* LiteralParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LiteralParser.cpp; sourceTree = "<group>"; };
+ A7E42C180E3938830065A544 /* JSStaticScopeObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSStaticScopeObject.h; sourceTree = "<group>"; };
+ A7E42C190E3938830065A544 /* JSStaticScopeObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSStaticScopeObject.cpp; sourceTree = "<group>"; };
+ A7F19ECD11DD490900931E70 /* FixedArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FixedArray.h; sourceTree = "<group>"; };
+ A7F8690E0F9584A100558697 /* CachedCall.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CachedCall.h; sourceTree = "<group>"; };
+ A7F869EC0F95C2EC00558697 /* CallFrameClosure.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CallFrameClosure.h; sourceTree = "<group>"; };
+ A7F9935D0FD7325100A0B2D0 /* JSONObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSONObject.h; sourceTree = "<group>"; };
+ A7F9935E0FD7325100A0B2D0 /* JSONObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSONObject.cpp; sourceTree = "<group>"; };
+ A7FB604B103F5EAB0017A286 /* PropertyDescriptor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PropertyDescriptor.h; sourceTree = "<group>"; };
+ A7FB60A3103F7DC20017A286 /* PropertyDescriptor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PropertyDescriptor.cpp; sourceTree = "<group>"; };
+ A8E894310CD0602400367179 /* JSCallbackObjectFunctions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCallbackObjectFunctions.h; sourceTree = "<group>"; };
+ A8E894330CD0603F00367179 /* JSGlobalObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSGlobalObject.h; sourceTree = "<group>"; };
+ BC01D4EF11A8F1FF00A54B2A /* JSZombie.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSZombie.cpp; sourceTree = "<group>"; };
+ BC01D4F011A8F1FF00A54B2A /* JSZombie.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSZombie.h; sourceTree = "<group>"; };
+ BC02E9040E1839DB000F9297 /* ErrorConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ErrorConstructor.cpp; sourceTree = "<group>"; };
+ BC02E9050E1839DB000F9297 /* ErrorConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ErrorConstructor.h; sourceTree = "<group>"; };
+ BC02E9060E1839DB000F9297 /* ErrorPrototype.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ErrorPrototype.cpp; sourceTree = "<group>"; };
+ BC02E9070E1839DB000F9297 /* ErrorPrototype.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ErrorPrototype.h; sourceTree = "<group>"; };
+ BC02E9080E1839DB000F9297 /* NativeErrorConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NativeErrorConstructor.cpp; sourceTree = "<group>"; };
+ BC02E9090E1839DB000F9297 /* NativeErrorConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NativeErrorConstructor.h; sourceTree = "<group>"; };
+ BC02E90A0E1839DB000F9297 /* NativeErrorPrototype.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NativeErrorPrototype.cpp; sourceTree = "<group>"; };
+ BC02E90B0E1839DB000F9297 /* NativeErrorPrototype.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NativeErrorPrototype.h; sourceTree = "<group>"; };
+ BC02E98A0E183E38000F9297 /* ErrorInstance.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ErrorInstance.cpp; sourceTree = "<group>"; };
+ BC02E98B0E183E38000F9297 /* ErrorInstance.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ErrorInstance.h; sourceTree = "<group>"; };
+ BC02E9B60E1842FA000F9297 /* JSString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSString.cpp; sourceTree = "<group>"; };
+ BC02E9B80E184545000F9297 /* GetterSetter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GetterSetter.cpp; sourceTree = "<group>"; };
+ BC02E9B90E184580000F9297 /* JSNumberCell.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSNumberCell.cpp; sourceTree = "<group>"; };
+ BC0894D50FAFBA2D00001865 /* JSAPIValueWrapper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSAPIValueWrapper.cpp; path = ../runtime/JSAPIValueWrapper.cpp; sourceTree = "<group>"; };
+ BC0894D60FAFBA2D00001865 /* JSAPIValueWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSAPIValueWrapper.h; path = ../runtime/JSAPIValueWrapper.h; sourceTree = "<group>"; };
+ BC1166000E1997B1008066DD /* DateInstance.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DateInstance.cpp; sourceTree = "<group>"; };
+ BC1166010E1997B1008066DD /* DateInstance.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DateInstance.h; sourceTree = "<group>"; };
+ BC11667A0E199C05008066DD /* InternalFunction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InternalFunction.h; sourceTree = "<group>"; };
+ BC1167D80E19BCC9008066DD /* JSCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCell.h; sourceTree = "<group>"; };
+ BC18C3C00E16EE3300B34460 /* StringConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StringConstructor.cpp; sourceTree = "<group>"; };
+ BC18C3C10E16EE3300B34460 /* StringConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StringConstructor.h; sourceTree = "<group>"; };
+ BC18C3C20E16EE3300B34460 /* StringObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StringObject.cpp; sourceTree = "<group>"; };
+ BC18C3C30E16EE3300B34460 /* StringObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StringObject.h; sourceTree = "<group>"; };
+ BC18C3C40E16EE3300B34460 /* StringObjectThatMasqueradesAsUndefined.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StringObjectThatMasqueradesAsUndefined.h; sourceTree = "<group>"; };
+ BC18C3C50E16EE3300B34460 /* StringPrototype.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StringPrototype.cpp; sourceTree = "<group>"; };
+ BC18C3C60E16EE3300B34460 /* StringPrototype.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StringPrototype.h; sourceTree = "<group>"; };
+ BC18C5230E16FC8A00B34460 /* ArrayPrototype.lut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ArrayPrototype.lut.h; sourceTree = "<group>"; };
+ BC18C5250E16FCA700B34460 /* StringPrototype.lut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StringPrototype.lut.h; sourceTree = "<group>"; };
+ BC18C5290E16FCC200B34460 /* MathObject.lut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MathObject.lut.h; sourceTree = "<group>"; };
+ BC18C52B0E16FCD200B34460 /* RegExpObject.lut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RegExpObject.lut.h; sourceTree = "<group>"; };
+ BC18C52D0E16FCE100B34460 /* Lexer.lut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Lexer.lut.h; sourceTree = "<group>"; };
+ BC22A3980E16E14800AF21C8 /* JSObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSObject.cpp; sourceTree = "<group>"; };
+ BC22A3990E16E14800AF21C8 /* JSObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSObject.h; sourceTree = "<group>"; };
+ BC22A39A0E16E14800AF21C8 /* JSVariableObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSVariableObject.cpp; sourceTree = "<group>"; };
+ BC257DE50E1F51C50016B6C9 /* Arguments.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Arguments.cpp; sourceTree = "<group>"; };
+ BC257DE60E1F51C50016B6C9 /* Arguments.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Arguments.h; sourceTree = "<group>"; };
+ BC257DED0E1F52ED0016B6C9 /* GlobalEvalFunction.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GlobalEvalFunction.cpp; sourceTree = "<group>"; };
+ BC257DEE0E1F52ED0016B6C9 /* GlobalEvalFunction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GlobalEvalFunction.h; sourceTree = "<group>"; };
+ BC257DF10E1F53740016B6C9 /* PrototypeFunction.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PrototypeFunction.cpp; sourceTree = "<group>"; };
+ BC257DF20E1F53740016B6C9 /* PrototypeFunction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PrototypeFunction.h; sourceTree = "<group>"; };
+ BC2680C00E16D4E900A06E92 /* FunctionConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FunctionConstructor.cpp; sourceTree = "<group>"; };
+ BC2680C10E16D4E900A06E92 /* FunctionConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FunctionConstructor.h; sourceTree = "<group>"; };
+ BC2680C20E16D4E900A06E92 /* NumberConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NumberConstructor.cpp; sourceTree = "<group>"; };
+ BC2680C30E16D4E900A06E92 /* NumberConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NumberConstructor.h; sourceTree = "<group>"; };
+ BC2680C40E16D4E900A06E92 /* NumberPrototype.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NumberPrototype.cpp; sourceTree = "<group>"; };
+ BC2680C50E16D4E900A06E92 /* NumberPrototype.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NumberPrototype.h; sourceTree = "<group>"; };
+ BC2680C60E16D4E900A06E92 /* ObjectConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ObjectConstructor.cpp; sourceTree = "<group>"; };
+ BC2680C70E16D4E900A06E92 /* ObjectConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ObjectConstructor.h; sourceTree = "<group>"; };
+ BC2680C80E16D4E900A06E92 /* ObjectPrototype.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ObjectPrototype.cpp; sourceTree = "<group>"; };
+ BC2680C90E16D4E900A06E92 /* ObjectPrototype.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ObjectPrototype.h; sourceTree = "<group>"; };
+ BC2680E60E16D52300A06E92 /* NumberConstructor.lut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NumberConstructor.lut.h; sourceTree = "<group>"; };
+ BC3046060E1F497F003232CF /* Error.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Error.h; sourceTree = "<group>"; };
+ BC3135620F302FA3003DFD3A /* DebuggerActivation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DebuggerActivation.h; sourceTree = "<group>"; };
+ BC3135630F302FA3003DFD3A /* DebuggerActivation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DebuggerActivation.cpp; sourceTree = "<group>"; };
+ BC337BDE0E1AF0B80076918A /* GetterSetter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GetterSetter.h; sourceTree = "<group>"; };
+ BC337BEA0E1B00CB0076918A /* Error.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Error.cpp; sourceTree = "<group>"; };
+ BC5F7BBB11823B590052C02C /* Atomics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Atomics.h; sourceTree = "<group>"; };
+ BC5F7BBC11823B590052C02C /* ThreadingPrimitives.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ThreadingPrimitives.h; sourceTree = "<group>"; };
+ BC5F7BBD11823B590052C02C /* ThreadSafeShared.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ThreadSafeShared.h; sourceTree = "<group>"; };
+ BC6AAAE40E1F426500AD87D8 /* ClassInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ClassInfo.h; sourceTree = "<group>"; };
+ BC756FC60E2031B200DE7D12 /* JSGlobalObjectFunctions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSGlobalObjectFunctions.cpp; sourceTree = "<group>"; };
+ BC756FC70E2031B200DE7D12 /* JSGlobalObjectFunctions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSGlobalObjectFunctions.h; sourceTree = "<group>"; };
+ BC7952060E15E8A800A898AB /* ArrayConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ArrayConstructor.cpp; sourceTree = "<group>"; };
+ BC7952070E15E8A800A898AB /* ArrayConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ArrayConstructor.h; sourceTree = "<group>"; };
+ BC7952320E15EB5600A898AB /* BooleanConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BooleanConstructor.cpp; sourceTree = "<group>"; };
+ BC7952330E15EB5600A898AB /* BooleanConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BooleanConstructor.h; sourceTree = "<group>"; };
+ BC7952340E15EB5600A898AB /* BooleanPrototype.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BooleanPrototype.cpp; sourceTree = "<group>"; };
+ BC7952350E15EB5600A898AB /* BooleanPrototype.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BooleanPrototype.h; sourceTree = "<group>"; };
+ BC7F8FB80E19D1C3008632C0 /* JSNumberCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSNumberCell.h; sourceTree = "<group>"; };
+ BC7F8FBA0E19D1EF008632C0 /* JSCell.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCell.cpp; sourceTree = "<group>"; };
+ BC87CDB810712ACA000614CF /* JSONObject.lut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSONObject.lut.h; sourceTree = "<group>"; };
+ BC8F3CCF0DAF17BA00577A80 /* ConstructData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ConstructData.h; sourceTree = "<group>"; };
+ BC9041470EB9250900FE26FA /* StructureTransitionTable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StructureTransitionTable.h; sourceTree = "<group>"; };
+ BC95437C0EBA70FD0072B6D3 /* PropertyMapHashTable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PropertyMapHashTable.h; sourceTree = "<group>"; };
+ BC9BB95B0E19680600DF8855 /* InternalFunction.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InternalFunction.cpp; sourceTree = "<group>"; };
+ BCA62DFE0E2826230004F30D /* CallData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CallData.cpp; sourceTree = "<group>"; };
+ BCA62DFF0E2826310004F30D /* ConstructData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ConstructData.cpp; sourceTree = "<group>"; };
+ BCCF0D070EF0AAB900413C8F /* StructureStubInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StructureStubInfo.h; sourceTree = "<group>"; };
+ BCCF0D0B0EF0B8A500413C8F /* StructureStubInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StructureStubInfo.cpp; sourceTree = "<group>"; };
+ BCD202BD0E1706A7002C7E82 /* RegExpConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RegExpConstructor.cpp; sourceTree = "<group>"; };
+ BCD202BE0E1706A7002C7E82 /* RegExpConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RegExpConstructor.h; sourceTree = "<group>"; };
+ BCD202BF0E1706A7002C7E82 /* RegExpPrototype.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RegExpPrototype.cpp; sourceTree = "<group>"; };
+ BCD202C00E1706A7002C7E82 /* RegExpPrototype.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RegExpPrototype.h; sourceTree = "<group>"; };
+ BCD202D50E170708002C7E82 /* RegExpConstructor.lut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RegExpConstructor.lut.h; sourceTree = "<group>"; };
+ BCD203450E17135E002C7E82 /* DateConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DateConstructor.cpp; sourceTree = "<group>"; };
+ BCD203460E17135E002C7E82 /* DateConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DateConstructor.h; sourceTree = "<group>"; };
+ BCD203470E17135E002C7E82 /* DatePrototype.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DatePrototype.cpp; sourceTree = "<group>"; };
+ BCD203480E17135E002C7E82 /* DatePrototype.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DatePrototype.h; sourceTree = "<group>"; };
+ BCD203E70E1718F4002C7E82 /* DatePrototype.lut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DatePrototype.lut.h; sourceTree = "<group>"; };
+ BCDD51E90FB8DF74004A8BDC /* JITOpcodes.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JITOpcodes.cpp; sourceTree = "<group>"; };
+ BCDE3AB00E6C82CF001453A7 /* Structure.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Structure.cpp; sourceTree = "<group>"; };
+ BCDE3AB10E6C82CF001453A7 /* Structure.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Structure.h; sourceTree = "<group>"; };
+ BCF605110E203EF800B9A64D /* ArgList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ArgList.cpp; sourceTree = "<group>"; };
+ BCF605120E203EF800B9A64D /* ArgList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ArgList.h; sourceTree = "<group>"; };
+ BCF6553B0A2048DE0038A194 /* MathExtras.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MathExtras.h; sourceTree = "<group>"; };
+ BCFBE695122560E800309E9D /* PassOwnArrayPtr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PassOwnArrayPtr.h; sourceTree = "<group>"; };
+ BCFBE697122561D200309E9D /* OwnArrayPtrCommon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OwnArrayPtrCommon.h; sourceTree = "<group>"; };
+ BCFD8C900EEB2EE700283848 /* JumpTable.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JumpTable.cpp; sourceTree = "<group>"; };
+ BCFD8C910EEB2EE700283848 /* JumpTable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JumpTable.h; sourceTree = "<group>"; };
+ C0A2723F0E509F1E00E96E15 /* NotFound.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NotFound.h; sourceTree = "<group>"; };
+ D21202280AD4310C00ED79B6 /* DateConversion.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = DateConversion.cpp; sourceTree = "<group>"; };
+ D21202290AD4310C00ED79B6 /* DateConversion.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DateConversion.h; sourceTree = "<group>"; };
+ DD377CBB12072C18006A2517 /* Bitmap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Bitmap.h; sourceTree = "<group>"; };
+ DDE82AD11209D955005C1756 /* GCHandle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GCHandle.cpp; sourceTree = "<group>"; };
+ DDE82AD21209D955005C1756 /* GCHandle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GCHandle.h; sourceTree = "<group>"; };
+ DDF7ABD211F60ED200108E36 /* GCActivityCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GCActivityCallback.h; sourceTree = "<group>"; };
+ DDF7ABD311F60ED200108E36 /* GCActivityCallbackCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GCActivityCallbackCF.cpp; sourceTree = "<group>"; };
+ E11D51750B2E798D0056C188 /* StringExtras.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StringExtras.h; sourceTree = "<group>"; };
+ E124A8F50E555775003091F1 /* OpaqueJSString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OpaqueJSString.h; sourceTree = "<group>"; };
+ E124A8F60E555775003091F1 /* OpaqueJSString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OpaqueJSString.cpp; sourceTree = "<group>"; };
+ E178633F0D9BEC0000D74E75 /* InitializeThreading.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InitializeThreading.h; sourceTree = "<group>"; };
+ E178636C0D9BEEC300D74E75 /* InitializeThreading.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InitializeThreading.cpp; sourceTree = "<group>"; };
+ E17FF770112131D200076A19 /* ValueCheck.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ValueCheck.h; sourceTree = "<group>"; };
+ E18E3A560DF9278C00D90B34 /* JSGlobalData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSGlobalData.h; sourceTree = "<group>"; };
+ E18E3A570DF9278C00D90B34 /* JSGlobalData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSGlobalData.cpp; sourceTree = "<group>"; };
+ E195678F09E7CF1200B89D13 /* UnicodeIcu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UnicodeIcu.h; sourceTree = "<group>"; };
+ E195679409E7CF1200B89D13 /* Unicode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Unicode.h; sourceTree = "<group>"; };
+ E1A596370DE3E1C300C17E37 /* AVLTree.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AVLTree.h; sourceTree = "<group>"; };
+ E1A862A80D7EBB76001EC6AA /* CollatorICU.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CollatorICU.cpp; sourceTree = "<group>"; };
+ E1A862AA0D7EBB7D001EC6AA /* Collator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Collator.h; sourceTree = "<group>"; };
+ E1A862D50D7F2B5C001EC6AA /* CollatorDefault.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CollatorDefault.cpp; sourceTree = "<group>"; };
+ E1B7C8BD0DA3A3360074B0DC /* ThreadSpecific.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ThreadSpecific.h; sourceTree = "<group>"; };
+ E1EE79220D6C95CD00FEA3BA /* Threading.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Threading.h; sourceTree = "<group>"; };
+ E1EE79270D6C964500FEA3BA /* Locker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Locker.h; sourceTree = "<group>"; };
+ E1EE793C0D6C9B9200FEA3BA /* ThreadingPthreads.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ThreadingPthreads.cpp; sourceTree = "<group>"; };
+ E1EE798B0D6CA53D00FEA3BA /* MessageQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MessageQueue.h; sourceTree = "<group>"; };
+ E1EF79A80CE97BA60088D500 /* UTF8.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UTF8.cpp; sourceTree = "<group>"; };
+ E1EF79A90CE97BA60088D500 /* UTF8.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UTF8.h; sourceTree = "<group>"; };
+ E48E0F2C0F82151700A8CA37 /* FastAllocBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FastAllocBase.h; sourceTree = "<group>"; };
+ F3BD31D0126730180065467F /* TextPosition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TextPosition.h; path = text/TextPosition.h; sourceTree = "<group>"; };
+ F5BB2BC5030F772101FCFE1D /* Completion.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = Completion.h; sourceTree = "<group>"; tabWidth = 8; };
+ F5C290E60284F98E018635CA /* JavaScriptCorePrefix.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = JavaScriptCorePrefix.h; sourceTree = "<group>"; tabWidth = 8; };
+ F68EBB8C0255D4C601FF60F7 /* config.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = config.h; sourceTree = "<group>"; tabWidth = 8; };
+ F692A84D0255597D01FF60F7 /* ArrayPrototype.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ArrayPrototype.cpp; sourceTree = "<group>"; tabWidth = 8; };
+ F692A84E0255597D01FF60F7 /* ArrayPrototype.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = ArrayPrototype.h; sourceTree = "<group>"; tabWidth = 8; };
+ F692A8500255597D01FF60F7 /* BooleanObject.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BooleanObject.cpp; sourceTree = "<group>"; tabWidth = 8; };
+ F692A8520255597D01FF60F7 /* Collector.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Collector.cpp; sourceTree = "<group>"; tabWidth = 8; };
+ F692A8530255597D01FF60F7 /* Collector.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = Collector.h; sourceTree = "<group>"; tabWidth = 8; };
+ F692A8540255597D01FF60F7 /* create_hash_table */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = text.script.perl; path = create_hash_table; sourceTree = "<group>"; tabWidth = 8; };
+ F692A8580255597D01FF60F7 /* Debugger.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Debugger.cpp; sourceTree = "<group>"; tabWidth = 8; };
+ F692A8590255597D01FF60F7 /* Debugger.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = Debugger.h; sourceTree = "<group>"; tabWidth = 8; };
+ F692A85C0255597D01FF60F7 /* FunctionPrototype.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FunctionPrototype.cpp; sourceTree = "<group>"; tabWidth = 8; };
+ F692A85D0255597D01FF60F7 /* FunctionPrototype.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = FunctionPrototype.h; sourceTree = "<group>"; tabWidth = 8; };
+ F692A85E0255597D01FF60F7 /* JSFunction.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSFunction.cpp; sourceTree = "<group>"; tabWidth = 8; };
+ F692A85F0255597D01FF60F7 /* JSFunction.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = JSFunction.h; sourceTree = "<group>"; tabWidth = 8; };
+ F692A8620255597D01FF60F7 /* JSString.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = JSString.h; sourceTree = "<group>"; tabWidth = 8; };
+ F692A8650255597D01FF60F7 /* Lexer.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Lexer.cpp; sourceTree = "<group>"; tabWidth = 8; };
+ F692A8660255597D01FF60F7 /* Lexer.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = Lexer.h; sourceTree = "<group>"; tabWidth = 8; };
+ F692A8680255597D01FF60F7 /* Lookup.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Lookup.cpp; sourceTree = "<group>"; tabWidth = 8; };
+ F692A8690255597D01FF60F7 /* Lookup.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = Lookup.h; sourceTree = "<group>"; tabWidth = 8; };
+ F692A86A0255597D01FF60F7 /* MathObject.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MathObject.cpp; sourceTree = "<group>"; tabWidth = 8; };
+ F692A86B0255597D01FF60F7 /* MathObject.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = MathObject.h; sourceTree = "<group>"; tabWidth = 8; };
+ F692A86D0255597D01FF60F7 /* Nodes.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Nodes.cpp; sourceTree = "<group>"; tabWidth = 8; };
+ F692A86E0255597D01FF60F7 /* Nodes.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = Nodes.h; sourceTree = "<group>"; tabWidth = 8; };
+ F692A8700255597D01FF60F7 /* NumberObject.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NumberObject.cpp; sourceTree = "<group>"; tabWidth = 8; };
+ F692A8710255597D01FF60F7 /* NumberObject.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = NumberObject.h; sourceTree = "<group>"; tabWidth = 8; };
+ F692A8770255597D01FF60F7 /* Operations.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Operations.cpp; sourceTree = "<group>"; tabWidth = 8; };
+ F692A8780255597D01FF60F7 /* Operations.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = Operations.h; sourceTree = "<group>"; tabWidth = 8; };
+ F692A87B0255597D01FF60F7 /* RegExpObject.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RegExpObject.cpp; sourceTree = "<group>"; tabWidth = 8; };
+ F692A87C0255597D01FF60F7 /* RegExpObject.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = RegExpObject.h; sourceTree = "<group>"; tabWidth = 8; };
+ F692A87D0255597D01FF60F7 /* RegExp.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RegExp.cpp; sourceTree = "<group>"; tabWidth = 8; };
+ F692A87E0255597D01FF60F7 /* RegExp.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = RegExp.h; sourceTree = "<group>"; tabWidth = 8; };
+ F692A8850255597D01FF60F7 /* UString.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UString.cpp; sourceTree = "<group>"; tabWidth = 8; };
+ F692A8860255597D01FF60F7 /* UString.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = UString.h; sourceTree = "<group>"; tabWidth = 8; };
+ F692A8870255597D01FF60F7 /* JSValue.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSValue.cpp; sourceTree = "<group>"; tabWidth = 8; };
+ FDA15C1612B03028003A583A /* Complex.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Complex.h; sourceTree = "<group>"; };
+ FE1B44790ECCD73B004F4DD1 /* StdLibExtras.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StdLibExtras.h; sourceTree = "<group>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 1412111E0A48793C00480255 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 14B8EC720A5652090062BE54 /* CoreFoundation.framework in Frameworks */,
+ 141211310A48794D00480255 /* JavaScriptCore.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 14BD59BD0A3E8F9000BAF59C /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 143A97E60A4A06E200456B66 /* CoreFoundation.framework in Frameworks */,
+ 14BD59C50A3E8F9F00BAF59C /* JavaScriptCore.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 932F5BD20822A1C700736975 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 932F5BD30822A1C700736975 /* CoreFoundation.framework in Frameworks */,
+ 932F5BD50822A1C700736975 /* Foundation.framework in Frameworks */,
+ 932F5BD70822A1C700736975 /* libicucore.dylib in Frameworks */,
+ 932F5BD60822A1C700736975 /* libobjc.dylib in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 932F5BDE0822A1C700736975 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 932F5BEA0822A1C700736975 /* JavaScriptCore.framework in Frameworks */,
+ 5D5D8AD10E0D0EBE00F9C692 /* libedit.dylib in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 034768DFFF38A50411DB9C8B /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 932F5BD90822A1C700736975 /* JavaScriptCore.framework */,
+ 932F5BE10822A1C700736975 /* jsc */,
+ 141211200A48793C00480255 /* minidom */,
+ 14BD59BF0A3E8F9000BAF59C /* testapi */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ tabWidth = 4;
+ usesTabs = 0;
+ };
+ 06D358A00DAAD9C4003B174E /* mac */ = {
+ isa = PBXGroup;
+ children = (
+ 06D358A10DAAD9C4003B174E /* MainThreadMac.mm */,
+ );
+ path = mac;
+ sourceTree = "<group>";
+ };
+ 0867D691FE84028FC02AAC07 /* JavaScriptCore */ = {
+ isa = PBXGroup;
+ children = (
+ A718F8211178EB4B002465A7 /* create_regex_tables */,
+ 937B63CC09E766D200A671DD /* DerivedSources.make */,
+ F692A8540255597D01FF60F7 /* create_hash_table */,
+ 14B8ECA60A5653980062BE54 /* JavaScriptCore.exp */,
+ 867FC36011B763950025105E /* JavaScriptCore.JSVALUE32only.exp */,
+ 867FC35F11B763950025105E /* JavaScriptCore.JSVALUE32_64only.exp */,
+ 867FC36111B763950025105E /* JavaScriptCore.JSVALUE64only.exp */,
+ F5C290E60284F98E018635CA /* JavaScriptCorePrefix.h */,
+ 45E12D8806A49B0F00E9DF84 /* jsc.cpp */,
+ F68EBB8C0255D4C601FF60F7 /* config.h */,
+ 1432EBD70A34CAD400717B9F /* API */,
+ 9688CB120ED12B4E001D649F /* assembler */,
+ 969A078F0ED1D3AE00F1F681 /* bytecode */,
+ 7E39D81D0EC38EFA003AF11A /* bytecompiler */,
+ 1480DB9A0DDC2231003CFDF2 /* debugger */,
+ 1429D77A0ED20D7300B89619 /* interpreter */,
+ 1429D92C0ED22D7000B89619 /* jit */,
+ 7E39D8370EC3A388003AF11A /* parser */,
+ 65417203039E01F90058BFEB /* pcre */,
+ 95AB831A0DA42C6900BC83F3 /* profiler */,
+ 7EF6E0BB0EB7A1EC0079AFAF /* runtime */,
+ 141211000A48772600480255 /* tests */,
+ 65162EF108E6A21C007556CD /* wtf */,
+ 86EAC48C0F93E8B9008EC948 /* yarr */,
+ 1C90513E0BA9E8830081E9D0 /* Configurations */,
+ 650FDF8D09D0FCA700769E54 /* Derived Sources */,
+ 0867D69AFE84028FC02AAC07 /* Frameworks */,
+ 034768DFFF38A50411DB9C8B /* Products */,
+ 932FC3C20824BB70005B3C75 /* Resources */,
+ );
+ name = JavaScriptCore;
+ sourceTree = "<group>";
+ };
+ 0867D69AFE84028FC02AAC07 /* Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ 6560A4CF04B3B3E7008AE952 /* CoreFoundation.framework */,
+ 51F0EB6105C86C6B00E6DF1B /* Foundation.framework */,
+ 5D5D8AD00E0D0EBE00F9C692 /* libedit.dylib */,
+ 9322A00306C341D3009067BB /* libicucore.dylib */,
+ 51F0EC0705C86C9A00E6DF1B /* libobjc.dylib */,
+ );
+ name = Frameworks;
+ sourceTree = "<group>";
+ tabWidth = 4;
+ usesTabs = 0;
+ };
+ 141211000A48772600480255 /* tests */ = {
+ isa = PBXGroup;
+ children = (
+ 144005170A531CB50005F061 /* minidom */,
+ 14BD5A2D0A3E91F600BAF59C /* testapi.c */,
+ 14D857740A4696C80032146C /* testapi.js */,
+ );
+ name = tests;
+ sourceTree = "<group>";
+ tabWidth = 4;
+ usesTabs = 0;
+ };
+ 1429D77A0ED20D7300B89619 /* interpreter */ = {
+ isa = PBXGroup;
+ children = (
+ A7F8690E0F9584A100558697 /* CachedCall.h */,
+ 1429D8DB0ED2205B00B89619 /* CallFrame.cpp */,
+ 1429D8DC0ED2205B00B89619 /* CallFrame.h */,
+ A7F869EC0F95C2EC00558697 /* CallFrameClosure.h */,
+ 1429D7D30ED2128200B89619 /* Interpreter.cpp */,
+ 1429D77B0ED20D7300B89619 /* Interpreter.h */,
+ 149B24FF0D8AF6D1009CB8C7 /* Register.h */,
+ 1429D85B0ED218E900B89619 /* RegisterFile.cpp */,
+ 14D792640DAA03FB001A9F05 /* RegisterFile.h */,
+ );
+ path = interpreter;
+ sourceTree = "<group>";
+ };
+ 1429D92C0ED22D7000B89619 /* jit */ = {
+ isa = PBXGroup;
+ children = (
+ A7B48DB60EE74CFC00DCBDB6 /* ExecutableAllocator.cpp */,
+ A7B48DB50EE74CFC00DCBDB6 /* ExecutableAllocator.h */,
+ 86DB64630F95C6FC00D7D921 /* ExecutableAllocatorFixedVMPool.cpp */,
+ 1429D92D0ED22D7000B89619 /* JIT.cpp */,
+ 1429D92E0ED22D7000B89619 /* JIT.h */,
+ 86A90ECF0EE7D51F00AB350D /* JITArithmetic.cpp */,
+ A75706DD118A2BCF0057F88F /* JITArithmetic32_64.cpp */,
+ 86CC85A20EE79B7400288682 /* JITCall.cpp */,
+ 146FE51111A710430087AE66 /* JITCall32_64.cpp */,
+ 86CCEFDD0F413F8900FD7F9E /* JITCode.h */,
+ 86CC85A00EE79A4700288682 /* JITInlineMethods.h */,
+ BCDD51E90FB8DF74004A8BDC /* JITOpcodes.cpp */,
+ A71236E41195F33C00BD2174 /* JITOpcodes32_64.cpp */,
+ 86CC85C30EE7A89400288682 /* JITPropertyAccess.cpp */,
+ A7C1E8C8112E701C00A37F98 /* JITPropertyAccess32_64.cpp */,
+ 960626950FB8EC02009798AB /* JITStubCall.h */,
+ 14A23D6C0F4E19CE0023CDAD /* JITStubs.cpp */,
+ 14A6581A0F4E36F4000150FD /* JITStubs.h */,
+ A76C51741182748D00715B05 /* JSInterfaceJIT.h */,
+ A7386551118697B400540279 /* SpecializedThunkJIT.h */,
+ A7386552118697B400540279 /* ThunkGenerators.cpp */,
+ A7386553118697B400540279 /* ThunkGenerators.h */,
+ );
+ path = jit;
+ sourceTree = "<group>";
+ };
+ 1432EBD70A34CAD400717B9F /* API */ = {
+ isa = PBXGroup;
+ children = (
+ 1482B78A0A4305AB00517CFC /* APICast.h */,
+ 865F408710E7D56300947361 /* APIShims.h */,
+ 1CAA8B4A0D32C39A0041BCFF /* JavaScript.h */,
+ 1CAA8B4B0D32C39A0041BCFF /* JavaScriptCore.h */,
+ BC0894D50FAFBA2D00001865 /* JSAPIValueWrapper.cpp */,
+ BC0894D60FAFBA2D00001865 /* JSAPIValueWrapper.h */,
+ 1421359A0A677F4F00A8195E /* JSBase.cpp */,
+ 142711380A460BBB0080EEEA /* JSBase.h */,
+ 140D17D60E8AD4A9000CD17D /* JSBasePrivate.h */,
+ 1440F8AD0A508D200005F061 /* JSCallbackConstructor.cpp */,
+ 1440F8AC0A508D200005F061 /* JSCallbackConstructor.h */,
+ 1440F8900A508B100005F061 /* JSCallbackFunction.cpp */,
+ 1440F88F0A508B100005F061 /* JSCallbackFunction.h */,
+ 14ABDF5E0A437FEF00ECCA01 /* JSCallbackObject.cpp */,
+ 14ABDF5D0A437FEF00ECCA01 /* JSCallbackObject.h */,
+ A8E894310CD0602400367179 /* JSCallbackObjectFunctions.h */,
+ 1440FCE20A51E46B0005F061 /* JSClassRef.cpp */,
+ 1440FCE10A51E46B0005F061 /* JSClassRef.h */,
+ 14BD5A290A3E91F600BAF59C /* JSContextRef.cpp */,
+ 14BD5A2A0A3E91F600BAF59C /* JSContextRef.h */,
+ 148CD1D7108CF902008163C6 /* JSContextRefPrivate.h */,
+ 1482B7E20A43076000517CFC /* JSObjectRef.cpp */,
+ 1482B7E10A43076000517CFC /* JSObjectRef.h */,
+ A79EDB0811531CD60019E912 /* JSObjectRefPrivate.h */,
+ 95988BA90E477BEC00D28D4D /* JSProfilerPrivate.cpp */,
+ 952C63AC0E4777D600C13936 /* JSProfilerPrivate.h */,
+ 95C18D3E0C90E7EF00E72F73 /* JSRetainPtr.h */,
+ 1482B74C0A43032800517CFC /* JSStringRef.cpp */,
+ 1482B74B0A43032800517CFC /* JSStringRef.h */,
+ 146AAB370B66A94400E55F16 /* JSStringRefCF.cpp */,
+ 146AAB2A0B66A84900E55F16 /* JSStringRefCF.h */,
+ 14BD5A2B0A3E91F600BAF59C /* JSValueRef.cpp */,
+ 1482B6EA0A4300B300517CFC /* JSValueRef.h */,
+ A7482E37116A697B003B0712 /* JSWeakObjectMapRefInternal.h */,
+ A7482B7A1166CDEA003B0712 /* JSWeakObjectMapRefPrivate.cpp */,
+ A7482B791166CDEA003B0712 /* JSWeakObjectMapRefPrivate.h */,
+ E124A8F60E555775003091F1 /* OpaqueJSString.cpp */,
+ E124A8F50E555775003091F1 /* OpaqueJSString.h */,
+ 5DE3D0F40DD8DDFB00468714 /* WebKitAvailability.h */,
+ );
+ path = API;
+ sourceTree = "<group>";
+ tabWidth = 4;
+ usesTabs = 0;
+ };
+ 144005170A531CB50005F061 /* minidom */ = {
+ isa = PBXGroup;
+ children = (
+ 1440F6420A4F8B6A0005F061 /* JSNode.c */,
+ 1440F6410A4F8B6A0005F061 /* JSNode.h */,
+ 144007560A5370D20005F061 /* JSNodeList.c */,
+ 144007550A5370D20005F061 /* JSNodeList.h */,
+ 141211020A48780900480255 /* minidom.c */,
+ 1412110D0A48788700480255 /* minidom.js */,
+ 144005200A531D3B0005F061 /* Node.c */,
+ 1440051F0A531D3B0005F061 /* Node.h */,
+ 144007490A536CC20005F061 /* NodeList.c */,
+ 144007480A536CC20005F061 /* NodeList.h */,
+ );
+ name = minidom;
+ path = API;
+ sourceTree = "<group>";
+ };
+ 1480DB9A0DDC2231003CFDF2 /* debugger */ = {
+ isa = PBXGroup;
+ children = (
+ F692A8580255597D01FF60F7 /* Debugger.cpp */,
+ F692A8590255597D01FF60F7 /* Debugger.h */,
+ BC3135630F302FA3003DFD3A /* DebuggerActivation.cpp */,
+ BC3135620F302FA3003DFD3A /* DebuggerActivation.h */,
+ 149559ED0DDCDDF700648087 /* DebuggerCallFrame.cpp */,
+ 1480DB9B0DDC227F003CFDF2 /* DebuggerCallFrame.h */,
+ );
+ path = debugger;
+ sourceTree = "<group>";
+ };
+ 1C90513E0BA9E8830081E9D0 /* Configurations */ = {
+ isa = PBXGroup;
+ children = (
+ 1C9051450BA9E8A70081E9D0 /* Base.xcconfig */,
+ 1C9051440BA9E8A70081E9D0 /* DebugRelease.xcconfig */,
+ 449097EE0F8F81B50076A327 /* FeatureDefines.xcconfig */,
+ 1C9051430BA9E8A70081E9D0 /* JavaScriptCore.xcconfig */,
+ 1C9051420BA9E8A70081E9D0 /* Version.xcconfig */,
+ );
+ path = Configurations;
+ sourceTree = "<group>";
+ tabWidth = 4;
+ usesTabs = 0;
+ };
+ 650FDF8D09D0FCA700769E54 /* Derived Sources */ = {
+ isa = PBXGroup;
+ children = (
+ BC18C5230E16FC8A00B34460 /* ArrayPrototype.lut.h */,
+ 65B174BE09D1000200820339 /* chartables.c */,
+ BCD203E70E1718F4002C7E82 /* DatePrototype.lut.h */,
+ BC87CDB810712ACA000614CF /* JSONObject.lut.h */,
+ BC18C52D0E16FCE100B34460 /* Lexer.lut.h */,
+ BC18C5290E16FCC200B34460 /* MathObject.lut.h */,
+ BC2680E60E16D52300A06E92 /* NumberConstructor.lut.h */,
+ BCD202D50E170708002C7E82 /* RegExpConstructor.lut.h */,
+ A718F61A11754A21002465A7 /* RegExpJitTables.h */,
+ BC18C52B0E16FCD200B34460 /* RegExpObject.lut.h */,
+ BC18C5250E16FCA700B34460 /* StringPrototype.lut.h */,
+ 5D53727D0E1C55EC0021E549 /* TracingDtrace.h */,
+ );
+ name = "Derived Sources";
+ path = DerivedSources/JavaScriptCore;
+ sourceTree = BUILT_PRODUCTS_DIR;
+ tabWidth = 4;
+ usesTabs = 0;
+ };
+ 65162EF108E6A21C007556CD /* wtf */ = {
+ isa = PBXGroup;
+ children = (
+ 5135FAD512D26856003C083B /* Decoder.h */,
+ 5135FAD612D26856003C083B /* Encoder.h */,
+ 93AA4F770957251F0084B3A7 /* AlwaysInline.h */,
+ 938C4F690CA06BC700D9310A /* ASCIICType.h */,
+ 65E217B808E7EECC0023E5F6 /* Assertions.cpp */,
+ 65E217B708E7EECC0023E5F6 /* Assertions.h */,
+ BC5F7BBB11823B590052C02C /* Atomics.h */,
+ E1A596370DE3E1C300C17E37 /* AVLTree.h */,
+ DD377CBB12072C18006A2517 /* Bitmap.h */,
+ 86676D4D11FED55D004B6863 /* BumpPointerAllocator.h */,
+ A7A1F7AA0F252B3C00E184E2 /* ByteArray.cpp */,
+ A7A1F7AB0F252B3C00E184E2 /* ByteArray.h */,
+ FDA15C1612B03028003A583A /* Complex.h */,
+ 0BDFFAD40FC6171000D69EF4 /* CrossThreadRefCounted.h */,
+ 180B9AEF0F16C569009BDBC5 /* CurrentTime.cpp */,
+ 180B9AF00F16C569009BDBC5 /* CurrentTime.h */,
+ 41359CF40FDD89CB00206180 /* DateMath.cpp */,
+ 41359CF50FDD89CB00206180 /* DateMath.h */,
+ 0F29479B126E698C00B3ABF5 /* DecimalNumber.cpp */,
+ 862AF4B512239C7B0024E5B8 /* DecimalNumber.h */,
+ 5186111D0CC824830081412B /* Deque.h */,
+ 938C4F6B0CA06BCE00D9310A /* DisallowCType.h */,
+ 651F6412039D5B5F0078395C /* dtoa.cpp */,
+ 651F6413039D5B5F0078395C /* dtoa.h */,
+ E48E0F2C0F82151700A8CA37 /* FastAllocBase.h */,
+ 65E217B908E7EECC0023E5F6 /* FastMalloc.cpp */,
+ 65E217BA08E7EECC0023E5F6 /* FastMalloc.h */,
+ A7F19ECD11DD490900931E70 /* FixedArray.h */,
+ 935AF46909E9D9DB00ACD1D8 /* Forward.h */,
+ 93B6A0DE0AA64DA40076DE27 /* GetPtr.h */,
+ 657EEBBF094E445E008C9C7B /* HashCountedSet.h */,
+ 65DFC92A08EA173A00F7300B /* HashFunctions.h */,
+ 652246A40C8D7A0E007BDAF7 /* HashIterators.h */,
+ 65DFC92B08EA173A00F7300B /* HashMap.h */,
+ 65DFC92C08EA173A00F7300B /* HashSet.h */,
+ 65DFC92D08EA173A00F7300B /* HashTable.cpp */,
+ 65DFC92E08EA173A00F7300B /* HashTable.h */,
+ 65DFC92F08EA173A00F7300B /* HashTraits.h */,
+ 657EB7450B708F540063461B /* ListHashSet.h */,
+ 148A1626095D16BB00666D0D /* ListRefPtr.h */,
+ E1EE79270D6C964500FEA3BA /* Locker.h */,
+ 06D358A00DAAD9C4003B174E /* mac */,
+ 06D358A20DAAD9C4003B174E /* MainThread.cpp */,
+ 06D358A30DAAD9C4003B174E /* MainThread.h */,
+ 5DBD18AF0C5401A700C15EAE /* MallocZoneSupport.h */,
+ BCF6553B0A2048DE0038A194 /* MathExtras.h */,
+ 511FC4C7117EE23D00425272 /* MD5.cpp */,
+ 511FC4CA117EE2A800425272 /* MD5.h */,
+ E1EE798B0D6CA53D00FEA3BA /* MessageQueue.h */,
+ 9303F5690991190000AD71B8 /* Noncopyable.h */,
+ 65E1A2F4122B880D00B26097 /* NonCopyingSort.h */,
+ C0A2723F0E509F1E00E96E15 /* NotFound.h */,
+ 93854A9912C93D3B00DAAF77 /* NullPtr.cpp */,
+ 933F5CDB126922690049191E /* NullPtr.h */,
+ 1400067612A6F7830064D123 /* OSAllocator.h */,
+ 1400069212A6F9E10064D123 /* OSAllocatorPosix.cpp */,
+ 9303F5A409911A5800AD71B8 /* OwnArrayPtr.h */,
+ BCFBE697122561D200309E9D /* OwnArrayPtrCommon.h */,
+ 0BDFFAD10FC616EC00D69EF4 /* OwnFastMallocPtr.h */,
+ 9303F567099118FA00AD71B8 /* OwnPtr.h */,
+ 440B7AED0FAF7FCB0073323E /* OwnPtrCommon.h */,
+ 8627E5EA11F1281900A313B5 /* PageAllocation.h */,
+ 14FFF98A12BFFF7500795BB8 /* PageAllocationAligned.cpp */,
+ 14FFF98B12BFFF7500795BB8 /* PageAllocationAligned.h */,
+ 14B3EF0412BC24DD00D29EFF /* PageBlock.cpp */,
+ 14B3EF0312BC24DD00D29EFF /* PageBlock.h */,
+ 8690231412092D5C00630AF9 /* PageReservation.h */,
+ BCFBE695122560E800309E9D /* PassOwnArrayPtr.h */,
+ 44DD48520FAEA85000D6B4EB /* PassOwnPtr.h */,
+ 6580F795094070560082C219 /* PassRefPtr.h */,
+ 65D6D87E09B5A32E0002E4D7 /* Platform.h */,
+ A7D649A91015224E009B2E1B /* PossiblyNull.h */,
+ 088FA5B90EF76D4300578E6F /* RandomNumber.cpp */,
+ 088FA5BA0EF76D4300578E6F /* RandomNumber.h */,
+ 08E279E80EF83B10007DB523 /* RandomNumberSeed.h */,
+ 1419D32C0CEA7CDE00FF507A /* RefCounted.h */,
+ 905B02AD0E28640F006DF882 /* RefCountedLeakCounter.cpp */,
+ 90D3469B0E285280009492EE /* RefCountedLeakCounter.h */,
+ 65C647B3093EF8D60022C380 /* RefPtr.h */,
+ 148A1ECD0D10C23B0069A47C /* RefPtrHashMap.h */,
+ 51F648D60BB4E2CA0033D760 /* RetainPtr.h */,
+ 969A07290ED1CE6900F1F681 /* SegmentedVector.h */,
+ 0BF28A2811A33DC300638F84 /* SizeLimits.cpp */,
+ 86D87DA512BC4B14008E73A1 /* StackBounds.cpp */,
+ 86D87DA612BC4B14008E73A1 /* StackBounds.h */,
+ 868BFA5F117D048200B908B1 /* StaticConstructors.h */,
+ FE1B44790ECCD73B004F4DD1 /* StdLibExtras.h */,
+ E11D51750B2E798D0056C188 /* StringExtras.h */,
+ 5D63E9AC10F2BD6E00FC8AE9 /* StringHasher.h */,
+ 5DA479650CFBCF56009328A0 /* TCPackedCache.h */,
+ 6541BD6E08E80A17002CBEE7 /* TCPageMap.h */,
+ 6541BD6F08E80A17002CBEE7 /* TCSpinLock.h */,
+ 6541BD7008E80A17002CBEE7 /* TCSystemAlloc.cpp */,
+ 6541BD7108E80A17002CBEE7 /* TCSystemAlloc.h */,
+ 8656573E115BE35200291F40 /* text */,
+ 18BAB52710DADFCD000D945B /* ThreadIdentifierDataPthreads.cpp */,
+ 18BAB52810DADFCD000D945B /* ThreadIdentifierDataPthreads.h */,
+ 5D6A566A0F05995500266145 /* Threading.cpp */,
+ E1EE79220D6C95CD00FEA3BA /* Threading.h */,
+ BC5F7BBC11823B590052C02C /* ThreadingPrimitives.h */,
+ E1EE793C0D6C9B9200FEA3BA /* ThreadingPthreads.cpp */,
+ BC5F7BBD11823B590052C02C /* ThreadSafeShared.h */,
+ E1B7C8BD0DA3A3360074B0DC /* ThreadSpecific.h */,
+ 0B330C260F38C62300692DE3 /* TypeTraits.cpp */,
+ 0B4D7E620F319AC800AD7E58 /* TypeTraits.h */,
+ E195678D09E7CF1200B89D13 /* unicode */,
+ 935AF46B09E9D9DB00ACD1D8 /* UnusedParam.h */,
+ 9714AF2F122F27C60092D9F5 /* url */,
+ E17FF770112131D200076A19 /* ValueCheck.h */,
+ 6592C316098B7DE10003D4F6 /* Vector.h */,
+ 6592C317098B7DE10003D4F6 /* VectorTraits.h */,
+ 96DD73780F9DA3100027FBCC /* VMTags.h */,
+ 86D08D5111793613006E5ED0 /* WTFThreadData.cpp */,
+ 86D08D5211793613006E5ED0 /* WTFThreadData.h */,
+ );
+ path = wtf;
+ sourceTree = "<group>";
+ tabWidth = 4;
+ usesTabs = 0;
+ };
+ 65417203039E01F90058BFEB /* pcre */ = {
+ isa = PBXGroup;
+ children = (
+ 6541720F039E08B90058BFEB /* pcre.h */,
+ 930754BF08B0F68000AB3056 /* pcre_compile.cpp */,
+ 930754E908B0F78500AB3056 /* pcre_exec.cpp */,
+ 93E26BE508B1517100F85226 /* pcre_internal.h */,
+ 930754CE08B0F74500AB3056 /* pcre_tables.cpp */,
+ 937013470CA97E0E00FA14D3 /* pcre_ucp_searchfuncs.cpp */,
+ 93E26BD308B1514100F85226 /* pcre_xclass.cpp */,
+ 93E26BFC08B151D400F85226 /* ucpinternal.h */,
+ );
+ path = pcre;
+ sourceTree = "<group>";
+ tabWidth = 4;
+ usesTabs = 0;
+ };
+ 7E39D81D0EC38EFA003AF11A /* bytecompiler */ = {
+ isa = PBXGroup;
+ children = (
+ 969A07200ED1CE3300F1F681 /* BytecodeGenerator.cpp */,
+ 969A07210ED1CE3300F1F681 /* BytecodeGenerator.h */,
+ 969A07270ED1CE6900F1F681 /* Label.h */,
+ 960097A50EBABB58007A7297 /* LabelScope.h */,
+ 655EB29A10CE2581001A990E /* NodesCodegen.cpp */,
+ 969A07280ED1CE6900F1F681 /* RegisterID.h */,
+ );
+ path = bytecompiler;
+ sourceTree = "<group>";
+ };
+ 7E39D8370EC3A388003AF11A /* parser */ = {
+ isa = PBXGroup;
+ children = (
+ A7A7EE7411B98B8D0065A14F /* ASTBuilder.h */,
+ A7A7EE7511B98B8D0065A14F /* JSParser.cpp */,
+ A7A7EE7611B98B8D0065A14F /* JSParser.h */,
+ 93F1981A08245AAE001E9ABC /* Keywords.table */,
+ F692A8650255597D01FF60F7 /* Lexer.cpp */,
+ F692A8660255597D01FF60F7 /* Lexer.h */,
+ 930DAD030FB1EB1A0082D205 /* NodeConstructors.h */,
+ 7EFF00630EC05A9A00AA7C93 /* NodeInfo.h */,
+ F692A86D0255597D01FF60F7 /* Nodes.cpp */,
+ F692A86E0255597D01FF60F7 /* Nodes.h */,
+ 93F0B3A909BB4DC00068FCE3 /* Parser.cpp */,
+ 93F0B3AA09BB4DC00068FCE3 /* Parser.h */,
+ 93052C320FB792190048FDC3 /* ParserArena.cpp */,
+ 93052C330FB792190048FDC3 /* ParserArena.h */,
+ 869EBCB60E8C6D4A008722CC /* ResultType.h */,
+ 65E866EE0DD59AFA00A2B2A1 /* SourceCode.h */,
+ 65E866ED0DD59AFA00A2B2A1 /* SourceProvider.h */,
+ A7A7EE7711B98B8D0065A14F /* SyntaxChecker.h */,
+ );
+ path = parser;
+ sourceTree = "<group>";
+ };
+ 7EF6E0BB0EB7A1EC0079AFAF /* runtime */ = {
+ isa = PBXGroup;
+ children = (
+ DDF7ABD211F60ED200108E36 /* GCActivityCallback.h */,
+ DDF7ABD311F60ED200108E36 /* GCActivityCallbackCF.cpp */,
+ BCF605110E203EF800B9A64D /* ArgList.cpp */,
+ BCF605120E203EF800B9A64D /* ArgList.h */,
+ BC257DE50E1F51C50016B6C9 /* Arguments.cpp */,
+ BC257DE60E1F51C50016B6C9 /* Arguments.h */,
+ BC7952060E15E8A800A898AB /* ArrayConstructor.cpp */,
+ BC7952070E15E8A800A898AB /* ArrayConstructor.h */,
+ F692A84D0255597D01FF60F7 /* ArrayPrototype.cpp */,
+ F692A84E0255597D01FF60F7 /* ArrayPrototype.h */,
+ 147B83AA0E6DB8C9004775A4 /* BatchedTransitionOptimizer.h */,
+ BC7952320E15EB5600A898AB /* BooleanConstructor.cpp */,
+ BC7952330E15EB5600A898AB /* BooleanConstructor.h */,
+ F692A8500255597D01FF60F7 /* BooleanObject.cpp */,
+ 704FD35305697E6D003DBED9 /* BooleanObject.h */,
+ BC7952340E15EB5600A898AB /* BooleanPrototype.cpp */,
+ BC7952350E15EB5600A898AB /* BooleanPrototype.h */,
+ 869D04AE1193B54D00803475 /* CachedTranscendentalFunction.h */,
+ BCA62DFE0E2826230004F30D /* CallData.cpp */,
+ 145C507F0D9DF63B0088F6B9 /* CallData.h */,
+ BC6AAAE40E1F426500AD87D8 /* ClassInfo.h */,
+ F692A8520255597D01FF60F7 /* Collector.cpp */,
+ F692A8530255597D01FF60F7 /* Collector.h */,
+ 14F3488E0E95EF8A003648BC /* CollectorHeapIterator.h */,
+ 65EA73620BAE35D1001BB560 /* CommonIdentifiers.cpp */,
+ 65EA73630BAE35D1001BB560 /* CommonIdentifiers.h */,
+ 969A09220ED1E09C00F1F681 /* Completion.cpp */,
+ F5BB2BC5030F772101FCFE1D /* Completion.h */,
+ BCA62DFF0E2826310004F30D /* ConstructData.cpp */,
+ BC8F3CCF0DAF17BA00577A80 /* ConstructData.h */,
+ BCD203450E17135E002C7E82 /* DateConstructor.cpp */,
+ BCD203460E17135E002C7E82 /* DateConstructor.h */,
+ D21202280AD4310C00ED79B6 /* DateConversion.cpp */,
+ D21202290AD4310C00ED79B6 /* DateConversion.h */,
+ BC1166000E1997B1008066DD /* DateInstance.cpp */,
+ BC1166010E1997B1008066DD /* DateInstance.h */,
+ 14A1563010966365006FA260 /* DateInstanceCache.h */,
+ BCD203470E17135E002C7E82 /* DatePrototype.cpp */,
+ BCD203480E17135E002C7E82 /* DatePrototype.h */,
+ BC337BEA0E1B00CB0076918A /* Error.cpp */,
+ BC3046060E1F497F003232CF /* Error.h */,
+ BC02E9040E1839DB000F9297 /* ErrorConstructor.cpp */,
+ BC02E9050E1839DB000F9297 /* ErrorConstructor.h */,
+ BC02E98A0E183E38000F9297 /* ErrorInstance.cpp */,
+ BC02E98B0E183E38000F9297 /* ErrorInstance.h */,
+ BC02E9060E1839DB000F9297 /* ErrorPrototype.cpp */,
+ BC02E9070E1839DB000F9297 /* ErrorPrototype.h */,
+ 1429D8770ED21ACD00B89619 /* ExceptionHelpers.cpp */,
+ A72701B30DADE94900E548D7 /* ExceptionHelpers.h */,
+ 86CA032D1038E8440028A609 /* Executable.cpp */,
+ 86CAFEE21035DDE60028A609 /* Executable.h */,
+ BC2680C00E16D4E900A06E92 /* FunctionConstructor.cpp */,
+ BC2680C10E16D4E900A06E92 /* FunctionConstructor.h */,
+ F692A85C0255597D01FF60F7 /* FunctionPrototype.cpp */,
+ F692A85D0255597D01FF60F7 /* FunctionPrototype.h */,
+ DDE82AD11209D955005C1756 /* GCHandle.cpp */,
+ DDE82AD21209D955005C1756 /* GCHandle.h */,
+ BC02E9B80E184545000F9297 /* GetterSetter.cpp */,
+ BC337BDE0E1AF0B80076918A /* GetterSetter.h */,
+ BC257DED0E1F52ED0016B6C9 /* GlobalEvalFunction.cpp */,
+ BC257DEE0E1F52ED0016B6C9 /* GlobalEvalFunction.h */,
+ 933A349D038AE80F008635CE /* Identifier.cpp */,
+ 933A349A038AE7C6008635CE /* Identifier.h */,
+ E178636C0D9BEEC300D74E75 /* InitializeThreading.cpp */,
+ E178633F0D9BEC0000D74E75 /* InitializeThreading.h */,
+ BC9BB95B0E19680600DF8855 /* InternalFunction.cpp */,
+ BC11667A0E199C05008066DD /* InternalFunction.h */,
+ 14DA818F0D99FD2000B0A4FB /* JSActivation.cpp */,
+ 14DA818E0D99FD2000B0A4FB /* JSActivation.h */,
+ 93ADFCE60CCBD7AC00D30B08 /* JSArray.cpp */,
+ 938772E5038BFE19008635CE /* JSArray.h */,
+ A791EF270F11E07900AE1F68 /* JSByteArray.cpp */,
+ A791EF260F11E07900AE1F68 /* JSByteArray.h */,
+ BC7F8FBA0E19D1EF008632C0 /* JSCell.cpp */,
+ BC1167D80E19BCC9008066DD /* JSCell.h */,
+ F692A85E0255597D01FF60F7 /* JSFunction.cpp */,
+ F692A85F0255597D01FF60F7 /* JSFunction.h */,
+ E18E3A570DF9278C00D90B34 /* JSGlobalData.cpp */,
+ E18E3A560DF9278C00D90B34 /* JSGlobalData.h */,
+ 14DE0D680D02431400AACCA2 /* JSGlobalObject.cpp */,
+ A8E894330CD0603F00367179 /* JSGlobalObject.h */,
+ BC756FC60E2031B200DE7D12 /* JSGlobalObjectFunctions.cpp */,
+ BC756FC70E2031B200DE7D12 /* JSGlobalObjectFunctions.h */,
+ 14760863099C633800437128 /* JSImmediate.cpp */,
+ 1483B589099BC1950016E4F0 /* JSImmediate.h */,
+ 65EA4C99092AF9E20093D800 /* JSLock.cpp */,
+ 65EA4C9A092AF9E20093D800 /* JSLock.h */,
+ A72700780DAC605600E548D7 /* JSNotAnObject.cpp */,
+ A72700770DAC605600E548D7 /* JSNotAnObject.h */,
+ BC02E9B90E184580000F9297 /* JSNumberCell.cpp */,
+ BC7F8FB80E19D1C3008632C0 /* JSNumberCell.h */,
+ BC22A3980E16E14800AF21C8 /* JSObject.cpp */,
+ BC22A3990E16E14800AF21C8 /* JSObject.h */,
+ A783A2AA11A5BE8400563D20 /* JSObjectWithGlobalObject.cpp */,
+ A783A0D011A36DCA00563D20 /* JSObjectWithGlobalObject.h */,
+ A7F9935E0FD7325100A0B2D0 /* JSONObject.cpp */,
+ A7F9935D0FD7325100A0B2D0 /* JSONObject.h */,
+ A727FF660DA3053B00E548D7 /* JSPropertyNameIterator.cpp */,
+ A727FF650DA3053B00E548D7 /* JSPropertyNameIterator.h */,
+ A7E42C190E3938830065A544 /* JSStaticScopeObject.cpp */,
+ A7E42C180E3938830065A544 /* JSStaticScopeObject.h */,
+ BC02E9B60E1842FA000F9297 /* JSString.cpp */,
+ F692A8620255597D01FF60F7 /* JSString.h */,
+ 86E85538111B9968001AF51E /* JSStringBuilder.h */,
+ 14ABB454099C2A0F00E2A24F /* JSType.h */,
+ 6507D2970E871E4A00D7D896 /* JSTypeInfo.h */,
+ F692A8870255597D01FF60F7 /* JSValue.cpp */,
+ 14ABB36E099C076400E2A24F /* JSValue.h */,
+ BC22A39A0E16E14800AF21C8 /* JSVariableObject.cpp */,
+ 14F252560D08DD8D004ECFFF /* JSVariableObject.h */,
+ 65C7A1710A8EAACB00FA37EA /* JSWrapperObject.cpp */,
+ 65C7A1720A8EAACB00FA37EA /* JSWrapperObject.h */,
+ BC01D4EF11A8F1FF00A54B2A /* JSZombie.cpp */,
+ BC01D4F011A8F1FF00A54B2A /* JSZombie.h */,
+ A7E2EA6A0FB460CF00601F06 /* LiteralParser.cpp */,
+ A7E2EA690FB460CF00601F06 /* LiteralParser.h */,
+ F692A8680255597D01FF60F7 /* Lookup.cpp */,
+ F692A8690255597D01FF60F7 /* Lookup.h */,
+ A74B3498102A5F8E0032AB98 /* MarkStack.cpp */,
+ A779558F101A74D500114E55 /* MarkStack.h */,
+ A7C530E3102A3813005BC741 /* MarkStackPosix.cpp */,
+ F692A86A0255597D01FF60F7 /* MathObject.cpp */,
+ F692A86B0255597D01FF60F7 /* MathObject.h */,
+ 90213E3B123A40C200D422F3 /* MemoryStatistics.cpp */,
+ 90213E3C123A40C200D422F3 /* MemoryStatistics.h */,
+ BC02E9080E1839DB000F9297 /* NativeErrorConstructor.cpp */,
+ BC02E9090E1839DB000F9297 /* NativeErrorConstructor.h */,
+ BC02E90A0E1839DB000F9297 /* NativeErrorPrototype.cpp */,
+ BC02E90B0E1839DB000F9297 /* NativeErrorPrototype.h */,
+ A76EE6580FAE59D5003F069A /* NativeFunctionWrapper.h */,
+ BC2680C20E16D4E900A06E92 /* NumberConstructor.cpp */,
+ BC2680C30E16D4E900A06E92 /* NumberConstructor.h */,
+ F692A8700255597D01FF60F7 /* NumberObject.cpp */,
+ F692A8710255597D01FF60F7 /* NumberObject.h */,
+ BC2680C40E16D4E900A06E92 /* NumberPrototype.cpp */,
+ BC2680C50E16D4E900A06E92 /* NumberPrototype.h */,
+ 142D3938103E4560007DCB52 /* NumericStrings.h */,
+ BC2680C60E16D4E900A06E92 /* ObjectConstructor.cpp */,
+ BC2680C70E16D4E900A06E92 /* ObjectConstructor.h */,
+ BC2680C80E16D4E900A06E92 /* ObjectPrototype.cpp */,
+ BC2680C90E16D4E900A06E92 /* ObjectPrototype.h */,
+ F692A8770255597D01FF60F7 /* Operations.cpp */,
+ F692A8780255597D01FF60F7 /* Operations.h */,
+ A7FB60A3103F7DC20017A286 /* PropertyDescriptor.cpp */,
+ A7FB604B103F5EAB0017A286 /* PropertyDescriptor.h */,
+ BC95437C0EBA70FD0072B6D3 /* PropertyMapHashTable.h */,
+ 65400C0F0A69BAF200509887 /* PropertyNameArray.cpp */,
+ 65400C100A69BAF200509887 /* PropertyNameArray.h */,
+ 65621E6B089E859700760F35 /* PropertySlot.cpp */,
+ 65621E6C089E859700760F35 /* PropertySlot.h */,
+ 65C02FBB0637462A003E7EE6 /* Protect.h */,
+ BC257DF10E1F53740016B6C9 /* PrototypeFunction.cpp */,
+ BC257DF20E1F53740016B6C9 /* PrototypeFunction.h */,
+ 147B84620E6DE6B1004775A4 /* PutPropertySlot.h */,
+ F692A87D0255597D01FF60F7 /* RegExp.cpp */,
+ F692A87E0255597D01FF60F7 /* RegExp.h */,
+ A1712B3A11C7B212007A5315 /* RegExpCache.cpp */,
+ A1712B3E11C7B228007A5315 /* RegExpCache.h */,
+ BCD202BD0E1706A7002C7E82 /* RegExpConstructor.cpp */,
+ BCD202BE0E1706A7002C7E82 /* RegExpConstructor.h */,
+ A1712B4011C7B235007A5315 /* RegExpKey.h */,
+ 93CEDDFB0EA91EE600258EBE /* RegExpMatchesArray.h */,
+ F692A87B0255597D01FF60F7 /* RegExpObject.cpp */,
+ F692A87C0255597D01FF60F7 /* RegExpObject.h */,
+ BCD202BF0E1706A7002C7E82 /* RegExpPrototype.cpp */,
+ BCD202C00E1706A7002C7E82 /* RegExpPrototype.h */,
+ 86B99AB6117E391E00DF5A90 /* RopeImpl.cpp */,
+ 86B99AB7117E391E00DF5A90 /* RopeImpl.h */,
+ 9374D3A8038D9D74008635CE /* ScopeChain.cpp */,
+ 9374D3A7038D9D74008635CE /* ScopeChain.h */,
+ 7E2C6C980D31C6B6002D44E2 /* ScopeChainMark.h */,
+ 93303FE80E6A72B500786E6A /* SmallStrings.cpp */,
+ 93303FEA0E6A72C000786E6A /* SmallStrings.h */,
+ BC18C3C00E16EE3300B34460 /* StringConstructor.cpp */,
+ BC18C3C10E16EE3300B34460 /* StringConstructor.h */,
+ BC18C3C20E16EE3300B34460 /* StringObject.cpp */,
+ BC18C3C30E16EE3300B34460 /* StringObject.h */,
+ BC18C3C40E16EE3300B34460 /* StringObjectThatMasqueradesAsUndefined.h */,
+ BC18C3C50E16EE3300B34460 /* StringPrototype.cpp */,
+ BC18C3C60E16EE3300B34460 /* StringPrototype.h */,
+ BCDE3AB00E6C82CF001453A7 /* Structure.cpp */,
+ BCDE3AB10E6C82CF001453A7 /* Structure.h */,
+ 7E4EE70E0EBB7A5B005934AA /* StructureChain.cpp */,
+ 7E4EE7080EBB7963005934AA /* StructureChain.h */,
+ BC9041470EB9250900FE26FA /* StructureTransitionTable.h */,
+ 14A396A60CD2933100B5B4FF /* SymbolTable.h */,
+ 97F6903A1169DF7F00A6BB46 /* Terminator.h */,
+ 14A42E3D0F4F60EE00599099 /* TimeoutChecker.cpp */,
+ 14A42E3E0F4F60EE00599099 /* TimeoutChecker.h */,
+ 5D53726D0E1C546B0021E549 /* Tracing.d */,
+ 5D53726E0E1C54880021E549 /* Tracing.h */,
+ F692A8850255597D01FF60F7 /* UString.cpp */,
+ F692A8860255597D01FF60F7 /* UString.h */,
+ 08DDA5BB12645F1D00751732 /* UStringBuilder.h */,
+ 0896C29B1265AAF600B1CDD3 /* UStringConcatenate.h */,
+ 14BFCE6810CDB1FC00364CCE /* WeakGCMap.h */,
+ 14035DB010DBFB2A00FFFFE7 /* WeakGCPtr.h */,
+ 1420BE7A10AA6DDB00F455D2 /* WeakRandom.h */,
+ A730B6101250068F009D25B1 /* StrictEvalActivation.h */,
+ A730B6111250068F009D25B1 /* StrictEvalActivation.cpp */,
+ );
+ path = runtime;
+ sourceTree = "<group>";
+ };
+ 8656573E115BE35200291F40 /* text */ = {
+ isa = PBXGroup;
+ children = (
+ 868BFA00117CEFD100B908B1 /* AtomicString.cpp */,
+ 868BFA01117CEFD100B908B1 /* AtomicString.h */,
+ 86F38858121130CA007A7CE3 /* AtomicStringHash.h */,
+ 868BFA02117CEFD100B908B1 /* AtomicStringImpl.h */,
+ 86565740115BE3DA00291F40 /* CString.cpp */,
+ 86565741115BE3DA00291F40 /* CString.h */,
+ 86B99AE1117E578100DF5A90 /* StringBuffer.h */,
+ 86438FC31265503E00E0DFCA /* StringBuilder.cpp */,
+ 081469481264375E00DFF935 /* StringBuilder.h */,
+ 0896C29E1265AB0900B1CDD3 /* StringConcatenate.h */,
+ 868BFA05117CEFD100B908B1 /* StringHash.h */,
+ 868BFA06117CEFD100B908B1 /* StringImpl.cpp */,
+ 868BFA07117CEFD100B908B1 /* StringImpl.h */,
+ 86B99AE2117E578100DF5A90 /* StringImplBase.h */,
+ 8626BECE11928E3900782FAB /* StringStatics.cpp */,
+ F3BD31D0126730180065467F /* TextPosition.h */,
+ 868BFA15117CF19900B908B1 /* WTFString.cpp */,
+ 868BFA16117CF19900B908B1 /* WTFString.h */,
+ );
+ name = text;
+ sourceTree = "<group>";
+ };
+ 86EAC48C0F93E8B9008EC948 /* yarr */ = {
+ isa = PBXGroup;
+ children = (
+ 86EAC48F0F93E8D1008EC948 /* RegexInterpreter.cpp */,
+ 86EAC4900F93E8D1008EC948 /* RegexInterpreter.h */,
+ 86EAC4910F93E8D1008EC948 /* RegexJIT.cpp */,
+ 86EAC4920F93E8D1008EC948 /* RegexJIT.h */,
+ 86EAC4930F93E8D1008EC948 /* RegexParser.h */,
+ 86EAC4940F93E8D1008EC948 /* RegexPattern.h */,
+ 868D81A112C428CE0093DC84 /* RegexPattern.cpp */,
+ );
+ name = yarr;
+ sourceTree = "<group>";
+ };
+ 932FC3C20824BB70005B3C75 /* Resources */ = {
+ isa = PBXGroup;
+ children = (
+ 932F5BD80822A1C700736975 /* Info.plist */,
+ );
+ name = Resources;
+ sourceTree = "<group>";
+ tabWidth = 4;
+ usesTabs = 0;
+ };
+ 95AB831A0DA42C6900BC83F3 /* profiler */ = {
+ isa = PBXGroup;
+ children = (
+ 95E3BC040E1AE68200B2D1C1 /* CallIdentifier.h */,
+ 95742F630DD11F5A000917FB /* Profile.cpp */,
+ 95742F640DD11F5A000917FB /* Profile.h */,
+ 95CD45740E1C4FDD0085358E /* ProfileGenerator.cpp */,
+ 95CD45750E1C4FDD0085358E /* ProfileGenerator.h */,
+ 95AB83540DA43B4400BC83F3 /* ProfileNode.cpp */,
+ 95AB83550DA43B4400BC83F3 /* ProfileNode.h */,
+ 95AB832E0DA42CAD00BC83F3 /* Profiler.cpp */,
+ 95AB832F0DA42CAD00BC83F3 /* Profiler.h */,
+ 1C61516B0EBAC7A00031376F /* ProfilerServer.h */,
+ 1C61516A0EBAC7A00031376F /* ProfilerServer.mm */,
+ );
+ name = profiler;
+ sourceTree = "<group>";
+ usesTabs = 0;
+ };
+ 9688CB120ED12B4E001D649F /* assembler */ = {
+ isa = PBXGroup;
+ children = (
+ 860161DF0F3A83C100F84710 /* AbstractMacroAssembler.h */,
+ 86D3B2BF10156BDE002865E7 /* ARMAssembler.cpp */,
+ 86D3B2C010156BDE002865E7 /* ARMAssembler.h */,
+ 86ADD1430FDDEA980006EEC2 /* ARMv7Assembler.h */,
+ A74DE1CB120B86D600D40D5B /* ARMv7Assembler.cpp */,
+ 9688CB130ED12B4E001D649F /* AssemblerBuffer.h */,
+ 86D3B2C110156BDE002865E7 /* AssemblerBufferWithConstantPool.h */,
+ 86E116B00FE75AC800B512BC /* CodeLocation.h */,
+ 86D3B3C110159D7F002865E7 /* LinkBuffer.h */,
+ 86C36EE90EE1289D00B3DF59 /* MacroAssembler.h */,
+ 86C568DD11A213EE0007F7F0 /* MacroAssemblerARM.cpp */,
+ 86D3B2C210156BDE002865E7 /* MacroAssemblerARM.h */,
+ 86ADD1440FDDEA980006EEC2 /* MacroAssemblerARMv7.h */,
+ 863B23DF0FC60E6200703AA4 /* MacroAssemblerCodeRef.h */,
+ 86C568DE11A213EE0007F7F0 /* MacroAssemblerMIPS.h */,
+ 860161E00F3A83C100F84710 /* MacroAssemblerX86.h */,
+ 860161E10F3A83C100F84710 /* MacroAssemblerX86_64.h */,
+ 860161E20F3A83C100F84710 /* MacroAssemblerX86Common.h */,
+ 86C568DF11A213EE0007F7F0 /* MIPSAssembler.h */,
+ 86D3B3C210159D7F002865E7 /* RepatchBuffer.h */,
+ 9688CB140ED12B4E001D649F /* X86Assembler.h */,
+ );
+ path = assembler;
+ sourceTree = "<group>";
+ };
+ 969A078F0ED1D3AE00F1F681 /* bytecode */ = {
+ isa = PBXGroup;
+ children = (
+ 969A07900ED1D3AE00F1F681 /* CodeBlock.cpp */,
+ 969A07910ED1D3AE00F1F681 /* CodeBlock.h */,
+ 969A07920ED1D3AE00F1F681 /* EvalCodeCache.h */,
+ 969A07930ED1D3AE00F1F681 /* Instruction.h */,
+ BCFD8C900EEB2EE700283848 /* JumpTable.cpp */,
+ BCFD8C910EEB2EE700283848 /* JumpTable.h */,
+ 969A07940ED1D3AE00F1F681 /* Opcode.cpp */,
+ 969A07950ED1D3AE00F1F681 /* Opcode.h */,
+ 1429D8830ED21C3D00B89619 /* SamplingTool.cpp */,
+ 1429D8840ED21C3D00B89619 /* SamplingTool.h */,
+ BCCF0D0B0EF0B8A500413C8F /* StructureStubInfo.cpp */,
+ BCCF0D070EF0AAB900413C8F /* StructureStubInfo.h */,
+ );
+ path = bytecode;
+ sourceTree = "<group>";
+ };
+ 9714AF2F122F27C60092D9F5 /* url */ = {
+ isa = PBXGroup;
+ children = (
+ 9714AF56122F31DD0092D9F5 /* api */,
+ 9714AF30122F27D20092D9F5 /* src */,
+ );
+ name = url;
+ sourceTree = "<group>";
+ };
+ 9714AF30122F27D20092D9F5 /* src */ = {
+ isa = PBXGroup;
+ children = (
+ 9714AF31122F27E70092D9F5 /* RawURLBuffer.h */,
+ 9714AF32122F27E70092D9F5 /* URLBuffer.h */,
+ 972A485D12661E0800F4514F /* URLCharacterTypes.cpp */,
+ 972A485E12661E0800F4514F /* URLCharacterTypes.h */,
+ 9714AF33122F27E70092D9F5 /* URLComponent.h */,
+ 972A48741266256F00F4514F /* URLEscape.cpp */,
+ 972A48751266256F00F4514F /* URLEscape.h */,
+ 9714AF34122F27E70092D9F5 /* URLParser.h */,
+ 972A48761266256F00F4514F /* URLQueryCanonicalizer.h */,
+ 9714AF35122F27E70092D9F5 /* URLSegments.cpp */,
+ 9714AF36122F27E70092D9F5 /* URLSegments.h */,
+ );
+ name = src;
+ sourceTree = "<group>";
+ };
+ 9714AF56122F31DD0092D9F5 /* api */ = {
+ isa = PBXGroup;
+ children = (
+ 9714AF57122F31F50092D9F5 /* ParsedURL.cpp */,
+ 9714AF58122F31F50092D9F5 /* ParsedURL.h */,
+ 9714AF59122F31F50092D9F5 /* URLString.h */,
+ );
+ name = api;
+ sourceTree = "<group>";
+ };
+ E195678D09E7CF1200B89D13 /* unicode */ = {
+ isa = PBXGroup;
+ children = (
+ E195678E09E7CF1200B89D13 /* icu */,
+ E1A862AA0D7EBB7D001EC6AA /* Collator.h */,
+ E1A862D50D7F2B5C001EC6AA /* CollatorDefault.cpp */,
+ E195679409E7CF1200B89D13 /* Unicode.h */,
+ E1EF79A80CE97BA60088D500 /* UTF8.cpp */,
+ E1EF79A90CE97BA60088D500 /* UTF8.h */,
+ );
+ path = unicode;
+ sourceTree = "<group>";
+ };
+ E195678E09E7CF1200B89D13 /* icu */ = {
+ isa = PBXGroup;
+ children = (
+ E1A862A80D7EBB76001EC6AA /* CollatorICU.cpp */,
+ E195678F09E7CF1200B89D13 /* UnicodeIcu.h */,
+ );
+ path = icu;
+ sourceTree = "<group>";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXHeadersBuildPhase section */
+ 144005C70A5338C60005F061 /* Headers */ = {
+ isa = PBXHeadersBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ A72701B90DADE94900E548D7 /* ExceptionHelpers.h in Headers */,
+ 144005CB0A5338D10005F061 /* JSNode.h in Headers */,
+ 144007570A5370D20005F061 /* JSNodeList.h in Headers */,
+ 144005CC0A5338F80005F061 /* Node.h in Headers */,
+ 1440074A0A536CC20005F061 /* NodeList.h in Headers */,
+ DDE82AD61209D955005C1756 /* GCHandle.h in Headers */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 932F5B3F0822A1C700736975 /* Headers */ = {
+ isa = PBXHeadersBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 860161E30F3A83C100F84710 /* AbstractMacroAssembler.h in Headers */,
+ BC18C3E40E16F5CD00B34460 /* AlwaysInline.h in Headers */,
+ BC18C3E50E16F5CD00B34460 /* APICast.h in Headers */,
+ 865F408810E7D56300947361 /* APIShims.h in Headers */,
+ BCF605140E203EF800B9A64D /* ArgList.h in Headers */,
+ BC257DE80E1F51C50016B6C9 /* Arguments.h in Headers */,
+ 86D3B2C410156BDE002865E7 /* ARMAssembler.h in Headers */,
+ 86ADD1450FDDEA980006EEC2 /* ARMv7Assembler.h in Headers */,
+ BC18C3E60E16F5CD00B34460 /* ArrayConstructor.h in Headers */,
+ BC18C3E70E16F5CD00B34460 /* ArrayPrototype.h in Headers */,
+ BC18C5240E16FC8A00B34460 /* ArrayPrototype.lut.h in Headers */,
+ BC18C3E90E16F5CD00B34460 /* ASCIICType.h in Headers */,
+ 9688CB150ED12B4E001D649F /* AssemblerBuffer.h in Headers */,
+ 86D3B2C510156BDE002865E7 /* AssemblerBufferWithConstantPool.h in Headers */,
+ BC18C3EA0E16F5CD00B34460 /* Assertions.h in Headers */,
+ A784A26111D16622005776AC /* ASTBuilder.h in Headers */,
+ BC5F7BBE11823B590052C02C /* Atomics.h in Headers */,
+ 868BFA09117CEFD100B908B1 /* AtomicString.h in Headers */,
+ 868BFA0A117CEFD100B908B1 /* AtomicStringImpl.h in Headers */,
+ BC18C3EB0E16F5CD00B34460 /* AVLTree.h in Headers */,
+ 147B83AC0E6DB8C9004775A4 /* BatchedTransitionOptimizer.h in Headers */,
+ DD377CBC12072C18006A2517 /* Bitmap.h in Headers */,
+ BC18C3EC0E16F5CD00B34460 /* BooleanObject.h in Headers */,
+ 86676D5211FED9BC004B6863 /* BumpPointerAllocator.h in Headers */,
+ A7A1F7AD0F252B3C00E184E2 /* ByteArray.h in Headers */,
+ 969A07230ED1CE3300F1F681 /* BytecodeGenerator.h in Headers */,
+ FDA15C1E12B0305C003A583A /* Complex.h in Headers */,
+ 869D04AF1193B54D00803475 /* CachedTranscendentalFunction.h in Headers */,
+ BC18C3ED0E16F5CD00B34460 /* CallData.h in Headers */,
+ 1429D8DE0ED2205B00B89619 /* CallFrame.h in Headers */,
+ 95E3BC050E1AE68200B2D1C1 /* CallIdentifier.h in Headers */,
+ BC6AAAE50E1F426500AD87D8 /* ClassInfo.h in Headers */,
+ 969A07970ED1D3AE00F1F681 /* CodeBlock.h in Headers */,
+ 86E116B10FE75AC800B512BC /* CodeLocation.h in Headers */,
+ BC18C3F00E16F5CD00B34460 /* Collator.h in Headers */,
+ BC18C3F10E16F5CD00B34460 /* Collector.h in Headers */,
+ 14F3488F0E95EF8A003648BC /* CollectorHeapIterator.h in Headers */,
+ BC18C3F30E16F5CD00B34460 /* CommonIdentifiers.h in Headers */,
+ BC18C3F40E16F5CD00B34460 /* Completion.h in Headers */,
+ BC18C3F50E16F5CD00B34460 /* config.h in Headers */,
+ BC18C3F60E16F5CD00B34460 /* ConstructData.h in Headers */,
+ 5DE6E5B30E1728EC00180407 /* create_hash_table in Headers */,
+ 0BDFFAE00FC6192900D69EF4 /* CrossThreadRefCounted.h in Headers */,
+ 86565743115BE3DA00291F40 /* CString.h in Headers */,
+ 180B9B080F16D94F009BDBC5 /* CurrentTime.h in Headers */,
+ BCD2034A0E17135E002C7E82 /* DateConstructor.h in Headers */,
+ 41359CF30FDD89AD00206180 /* DateConversion.h in Headers */,
+ BC1166020E1997B4008066DD /* DateInstance.h in Headers */,
+ 14A1563210966365006FA260 /* DateInstanceCache.h in Headers */,
+ 41359CF70FDD89CB00206180 /* DateMath.h in Headers */,
+ BCD2034C0E17135E002C7E82 /* DatePrototype.h in Headers */,
+ BCD203E80E1718F4002C7E82 /* DatePrototype.lut.h in Headers */,
+ BC18C3FA0E16F5CD00B34460 /* Debugger.h in Headers */,
+ BC3135640F302FA3003DFD3A /* DebuggerActivation.h in Headers */,
+ BC18C3FB0E16F5CD00B34460 /* DebuggerCallFrame.h in Headers */,
+ BC18C3FC0E16F5CD00B34460 /* Deque.h in Headers */,
+ BC18C3FD0E16F5CD00B34460 /* DisallowCType.h in Headers */,
+ BC18C3FE0E16F5CD00B34460 /* dtoa.h in Headers */,
+ BC3046070E1F497F003232CF /* Error.h in Headers */,
+ BC02E90D0E1839DB000F9297 /* ErrorConstructor.h in Headers */,
+ BC02E98D0E183E38000F9297 /* ErrorInstance.h in Headers */,
+ BC02E90F0E1839DB000F9297 /* ErrorPrototype.h in Headers */,
+ 969A07980ED1D3AE00F1F681 /* EvalCodeCache.h in Headers */,
+ BC18C4000E16F5CD00B34460 /* ExceptionHelpers.h in Headers */,
+ 86CAFEE31035DDE60028A609 /* Executable.h in Headers */,
+ A766B44F0EE8DCD1009518CA /* ExecutableAllocator.h in Headers */,
+ E48E0F2D0F82151700A8CA37 /* FastAllocBase.h in Headers */,
+ BC18C4020E16F5CD00B34460 /* FastMalloc.h in Headers */,
+ A7F19ECE11DD490900931E70 /* FixedArray.h in Headers */,
+ BC18C4030E16F5CD00B34460 /* Forward.h in Headers */,
+ BC18C4040E16F5CD00B34460 /* FunctionConstructor.h in Headers */,
+ BC18C4050E16F5CD00B34460 /* FunctionPrototype.h in Headers */,
+ BC18C4060E16F5CD00B34460 /* GetPtr.h in Headers */,
+ BC257DF00E1F52ED0016B6C9 /* GlobalEvalFunction.h in Headers */,
+ BC18C4080E16F5CD00B34460 /* HashCountedSet.h in Headers */,
+ BC18C4090E16F5CD00B34460 /* HashFunctions.h in Headers */,
+ BC18C40A0E16F5CD00B34460 /* HashIterators.h in Headers */,
+ BC18C40B0E16F5CD00B34460 /* HashMap.h in Headers */,
+ BC18C40C0E16F5CD00B34460 /* HashSet.h in Headers */,
+ BC18C40D0E16F5CD00B34460 /* HashTable.h in Headers */,
+ BC18C40E0E16F5CD00B34460 /* HashTraits.h in Headers */,
+ BC18C40F0E16F5CD00B34460 /* Identifier.h in Headers */,
+ BC18C4100E16F5CD00B34460 /* InitializeThreading.h in Headers */,
+ 969A07990ED1D3AE00F1F681 /* Instruction.h in Headers */,
+ BC11667B0E199C05008066DD /* InternalFunction.h in Headers */,
+ 1429D77C0ED20D7300B89619 /* Interpreter.h in Headers */,
+ BC18C4130E16F5CD00B34460 /* JavaScript.h in Headers */,
+ BC18C4140E16F5CD00B34460 /* JavaScriptCore.h in Headers */,
+ BC18C4150E16F5CD00B34460 /* JavaScriptCorePrefix.h in Headers */,
+ 1429D9300ED22D7000B89619 /* JIT.h in Headers */,
+ 86CCEFDE0F413F8900FD7F9E /* JITCode.h in Headers */,
+ 86CC85A10EE79A4700288682 /* JITInlineMethods.h in Headers */,
+ 960626960FB8EC02009798AB /* JITStubCall.h in Headers */,
+ 14C5242B0F5355E900BA3D04 /* JITStubs.h in Headers */,
+ BC18C4160E16F5CD00B34460 /* JSActivation.h in Headers */,
+ 840480131021A1D9008E7F01 /* JSAPIValueWrapper.h in Headers */,
+ BC18C4170E16F5CD00B34460 /* JSArray.h in Headers */,
+ BC18C4180E16F5CD00B34460 /* JSBase.h in Headers */,
+ 140D17D70E8AD4A9000CD17D /* JSBasePrivate.h in Headers */,
+ A791EF280F11E07900AE1F68 /* JSByteArray.h in Headers */,
+ BC18C4190E16F5CD00B34460 /* JSCallbackConstructor.h in Headers */,
+ BC18C41A0E16F5CD00B34460 /* JSCallbackFunction.h in Headers */,
+ BC18C41B0E16F5CD00B34460 /* JSCallbackObject.h in Headers */,
+ BC18C41C0E16F5CD00B34460 /* JSCallbackObjectFunctions.h in Headers */,
+ BC1167DA0E19BCC9008066DD /* JSCell.h in Headers */,
+ BC18C41D0E16F5CD00B34460 /* JSClassRef.h in Headers */,
+ BC18C41E0E16F5CD00B34460 /* JSContextRef.h in Headers */,
+ 148CD1D8108CF902008163C6 /* JSContextRefPrivate.h in Headers */,
+ BC18C41F0E16F5CD00B34460 /* JSFunction.h in Headers */,
+ BC18C4200E16F5CD00B34460 /* JSGlobalData.h in Headers */,
+ BC18C4210E16F5CD00B34460 /* JSGlobalObject.h in Headers */,
+ BC756FC90E2031B200DE7D12 /* JSGlobalObjectFunctions.h in Headers */,
+ BC18C4220E16F5CD00B34460 /* JSImmediate.h in Headers */,
+ A76C51761182748D00715B05 /* JSInterfaceJIT.h in Headers */,
+ BC18C4230E16F5CD00B34460 /* JSLock.h in Headers */,
+ BC7F8FB90E19D1C3008632C0 /* JSNumberCell.h in Headers */,
+ BC18C4240E16F5CD00B34460 /* JSObject.h in Headers */,
+ BC18C4250E16F5CD00B34460 /* JSObjectRef.h in Headers */,
+ A7280A2811557E3000D56957 /* JSObjectRefPrivate.h in Headers */,
+ A783A0D111A36DCA00563D20 /* JSObjectWithGlobalObject.h in Headers */,
+ A7F9935F0FD7325100A0B2D0 /* JSONObject.h in Headers */,
+ BC87CDB910712AD4000614CF /* JSONObject.lut.h in Headers */,
+ A784A26311D16622005776AC /* JSParser.h in Headers */,
+ 9534AAFB0E5B7A9600B8A45B /* JSProfilerPrivate.h in Headers */,
+ BC18C4260E16F5CD00B34460 /* JSRetainPtr.h in Headers */,
+ BC18C4270E16F5CD00B34460 /* JSString.h in Headers */,
+ 86E85539111B9968001AF51E /* JSStringBuilder.h in Headers */,
+ BC18C4280E16F5CD00B34460 /* JSStringRef.h in Headers */,
+ BC18C4290E16F5CD00B34460 /* JSStringRefCF.h in Headers */,
+ BC18C42A0E16F5CD00B34460 /* JSType.h in Headers */,
+ 6507D29E0E871E5E00D7D896 /* JSTypeInfo.h in Headers */,
+ BC18C42B0E16F5CD00B34460 /* JSValue.h in Headers */,
+ BC18C42C0E16F5CD00B34460 /* JSValueRef.h in Headers */,
+ BC18C42D0E16F5CD00B34460 /* JSVariableObject.h in Headers */,
+ A7482E93116A7CAD003B0712 /* JSWeakObjectMapRefInternal.h in Headers */,
+ A7482B9311671147003B0712 /* JSWeakObjectMapRefPrivate.h in Headers */,
+ BC18C42E0E16F5CD00B34460 /* JSWrapperObject.h in Headers */,
+ BC01D4F211A8F1FF00A54B2A /* JSZombie.h in Headers */,
+ BCFD8C930EEB2EE700283848 /* JumpTable.h in Headers */,
+ 969A072A0ED1CE6900F1F681 /* Label.h in Headers */,
+ 960097A60EBABB58007A7297 /* LabelScope.h in Headers */,
+ BC18C4310E16F5CD00B34460 /* Lexer.h in Headers */,
+ BC18C52E0E16FCE100B34460 /* Lexer.lut.h in Headers */,
+ 86D3B3C310159D7F002865E7 /* LinkBuffer.h in Headers */,
+ BC18C4340E16F5CD00B34460 /* ListHashSet.h in Headers */,
+ BC18C4350E16F5CD00B34460 /* ListRefPtr.h in Headers */,
+ A7E2EA6B0FB460CF00601F06 /* LiteralParser.h in Headers */,
+ BC18C4360E16F5CD00B34460 /* Locker.h in Headers */,
+ BC18C4370E16F5CD00B34460 /* Lookup.h in Headers */,
+ 86C36EEA0EE1289D00B3DF59 /* MacroAssembler.h in Headers */,
+ 86D3B2C610156BDE002865E7 /* MacroAssemblerARM.h in Headers */,
+ 86ADD1460FDDEA980006EEC2 /* MacroAssemblerARMv7.h in Headers */,
+ 863B23E00FC6118900703AA4 /* MacroAssemblerCodeRef.h in Headers */,
+ 86C568E111A213EE0007F7F0 /* MacroAssemblerMIPS.h in Headers */,
+ 860161E40F3A83C100F84710 /* MacroAssemblerX86.h in Headers */,
+ 860161E50F3A83C100F84710 /* MacroAssemblerX86_64.h in Headers */,
+ 860161E60F3A83C100F84710 /* MacroAssemblerX86Common.h in Headers */,
+ BC18C4390E16F5CD00B34460 /* MainThread.h in Headers */,
+ BC18C43A0E16F5CD00B34460 /* MallocZoneSupport.h in Headers */,
+ A7795590101A74D500114E55 /* MarkStack.h in Headers */,
+ BC18C43B0E16F5CD00B34460 /* MathExtras.h in Headers */,
+ BC18C43C0E16F5CD00B34460 /* MathObject.h in Headers */,
+ BC18C52A0E16FCC200B34460 /* MathObject.lut.h in Headers */,
+ 511FC4CB117EE2A800425272 /* MD5.h in Headers */,
+ BC18C43E0E16F5CD00B34460 /* MessageQueue.h in Headers */,
+ 86C568E211A213EE0007F7F0 /* MIPSAssembler.h in Headers */,
+ BC02E9110E1839DB000F9297 /* NativeErrorConstructor.h in Headers */,
+ BC02E9130E1839DB000F9297 /* NativeErrorPrototype.h in Headers */,
+ A76EE6590FAE59D5003F069A /* NativeFunctionWrapper.h in Headers */,
+ 7EFF00640EC05A9A00AA7C93 /* NodeInfo.h in Headers */,
+ BC18C43F0E16F5CD00B34460 /* Nodes.h in Headers */,
+ 65E1A3DF122B894500B26097 /* NonCopyingSort.h in Headers */,
+ BC18C4400E16F5CD00B34460 /* Noncopyable.h in Headers */,
+ C0A272630E50A06300E96E15 /* NotFound.h in Headers */,
+ BC18C4410E16F5CD00B34460 /* NumberConstructor.h in Headers */,
+ BC18C4420E16F5CD00B34460 /* NumberConstructor.lut.h in Headers */,
+ BC18C4430E16F5CD00B34460 /* NumberObject.h in Headers */,
+ BC18C4440E16F5CD00B34460 /* NumberPrototype.h in Headers */,
+ 142D3939103E4560007DCB52 /* NumericStrings.h in Headers */,
+ BC18C4450E16F5CD00B34460 /* ObjectConstructor.h in Headers */,
+ BC18C4460E16F5CD00B34460 /* ObjectPrototype.h in Headers */,
+ E124A8F70E555775003091F1 /* OpaqueJSString.h in Headers */,
+ 969A079B0ED1D3AE00F1F681 /* Opcode.h in Headers */,
+ BC18C4480E16F5CD00B34460 /* Operations.h in Headers */,
+ BC18C4490E16F5CD00B34460 /* OwnArrayPtr.h in Headers */,
+ 0BDFFAE10FC6193100D69EF4 /* OwnFastMallocPtr.h in Headers */,
+ BC18C44A0E16F5CD00B34460 /* OwnPtr.h in Headers */,
+ 4409D8470FAF80A200523B87 /* OwnPtrCommon.h in Headers */,
+ 8627E5EC11F1281900A313B5 /* PageAllocation.h in Headers */,
+ 8690231512092D5C00630AF9 /* PageReservation.h in Headers */,
+ BC18C44B0E16F5CD00B34460 /* Parser.h in Headers */,
+ 93052C350FB792190048FDC3 /* ParserArena.h in Headers */,
+ 44DD48530FAEA85000D6B4EB /* PassOwnPtr.h in Headers */,
+ BC18C44C0E16F5CD00B34460 /* PassRefPtr.h in Headers */,
+ BC18C44D0E16F5CD00B34460 /* pcre.h in Headers */,
+ BC18C44E0E16F5CD00B34460 /* pcre_internal.h in Headers */,
+ BC18C44F0E16F5CD00B34460 /* Platform.h in Headers */,
+ A7D649AA1015224E009B2E1B /* PossiblyNull.h in Headers */,
+ BC18C4500E16F5CD00B34460 /* Profile.h in Headers */,
+ 95CD45770E1C4FDD0085358E /* ProfileGenerator.h in Headers */,
+ BC18C4510E16F5CD00B34460 /* ProfileNode.h in Headers */,
+ BC18C4520E16F5CD00B34460 /* Profiler.h in Headers */,
+ 1C61516D0EBAC7A00031376F /* ProfilerServer.h in Headers */,
+ A7FB61001040C38B0017A286 /* PropertyDescriptor.h in Headers */,
+ BC95437D0EBA70FD0072B6D3 /* PropertyMapHashTable.h in Headers */,
+ BC18C4540E16F5CD00B34460 /* PropertyNameArray.h in Headers */,
+ BC18C4550E16F5CD00B34460 /* PropertySlot.h in Headers */,
+ BC18C4560E16F5CD00B34460 /* Protect.h in Headers */,
+ BC257DF40E1F53740016B6C9 /* PrototypeFunction.h in Headers */,
+ 147B84630E6DE6B1004775A4 /* PutPropertySlot.h in Headers */,
+ 088FA5BC0EF76D4300578E6F /* RandomNumber.h in Headers */,
+ 08E279E90EF83B10007DB523 /* RandomNumberSeed.h in Headers */,
+ BC18C4570E16F5CD00B34460 /* RefCounted.h in Headers */,
+ 90D3469C0E285280009492EE /* RefCountedLeakCounter.h in Headers */,
+ BC18C4580E16F5CD00B34460 /* RefPtr.h in Headers */,
+ BC18C4590E16F5CD00B34460 /* RefPtrHashMap.h in Headers */,
+ 86EAC4980F93E8D1008EC948 /* RegexInterpreter.h in Headers */,
+ 86EAC49A0F93E8D1008EC948 /* RegexJIT.h in Headers */,
+ BC18C45A0E16F5CD00B34460 /* RegExp.h in Headers */,
+ 86EAC49B0F93E8D1008EC948 /* RegexParser.h in Headers */,
+ 86EAC49C0F93E8D1008EC948 /* RegexPattern.h in Headers */,
+ A1712B3F11C7B228007A5315 /* RegExpCache.h in Headers */,
+ BCD202C20E1706A7002C7E82 /* RegExpConstructor.h in Headers */,
+ BCD202D60E170708002C7E82 /* RegExpConstructor.lut.h in Headers */,
+ A1712B4111C7B235007A5315 /* RegExpKey.h in Headers */,
+ BC18C45B0E16F5CD00B34460 /* RegExpObject.h in Headers */,
+ BC18C52C0E16FCD200B34460 /* RegExpObject.lut.h in Headers */,
+ BCD202C40E1706A7002C7E82 /* RegExpPrototype.h in Headers */,
+ BC18C45D0E16F5CD00B34460 /* Register.h in Headers */,
+ BC18C45E0E16F5CD00B34460 /* RegisterFile.h in Headers */,
+ 969A072B0ED1CE6900F1F681 /* RegisterID.h in Headers */,
+ 86D3B3C410159D7F002865E7 /* RepatchBuffer.h in Headers */,
+ 869EBCB70E8C6D4A008722CC /* ResultType.h in Headers */,
+ BC18C4600E16F5CD00B34460 /* RetainPtr.h in Headers */,
+ 86B99AB9117E391E00DF5A90 /* RopeImpl.h in Headers */,
+ 1429D8860ED21C3D00B89619 /* SamplingTool.h in Headers */,
+ BC18C4610E16F5CD00B34460 /* ScopeChain.h in Headers */,
+ 969A072C0ED1CE6900F1F681 /* SegmentedVector.h in Headers */,
+ 933040040E6A749400786E6A /* SmallStrings.h in Headers */,
+ BC18C4640E16F5CD00B34460 /* SourceCode.h in Headers */,
+ BC18C4630E16F5CD00B34460 /* SourceProvider.h in Headers */,
+ A7386554118697B400540279 /* SpecializedThunkJIT.h in Headers */,
+ 86D87DDB12BCAF94008E73A1 /* StackBounds.h in Headers */,
+ 868BFA60117D048200B908B1 /* StaticConstructors.h in Headers */,
+ FE1B447A0ECCD73B004F4DD1 /* StdLibExtras.h in Headers */,
+ 86B99AE3117E578100DF5A90 /* StringBuffer.h in Headers */,
+ 081469491264378500DFF935 /* StringBuilder.h in Headers */,
+ 08CABBA61265AB3900B206CE /* StringConcatenate.h in Headers */,
+ BC18C4660E16F5CD00B34460 /* StringConstructor.h in Headers */,
+ BC18C4670E16F5CD00B34460 /* StringExtras.h in Headers */,
+ 868BFA0D117CEFD100B908B1 /* StringHash.h in Headers */,
+ 5D63E9AD10F2BD6E00FC8AE9 /* StringHasher.h in Headers */,
+ 868BFA0F117CEFD100B908B1 /* StringImpl.h in Headers */,
+ 86B99AE4117E578100DF5A90 /* StringImplBase.h in Headers */,
+ BC18C4680E16F5CD00B34460 /* StringObject.h in Headers */,
+ BC18C4690E16F5CD00B34460 /* StringObjectThatMasqueradesAsUndefined.h in Headers */,
+ BC18C46A0E16F5CD00B34460 /* StringPrototype.h in Headers */,
+ BC18C5260E16FCA700B34460 /* StringPrototype.lut.h in Headers */,
+ BCDE3AB80E6C82F5001453A7 /* Structure.h in Headers */,
+ 7E4EE7090EBB7963005934AA /* StructureChain.h in Headers */,
+ BCCF0D080EF0AAB900413C8F /* StructureStubInfo.h in Headers */,
+ BC9041480EB9250900FE26FA /* StructureTransitionTable.h in Headers */,
+ BC18C46B0E16F5CD00B34460 /* SymbolTable.h in Headers */,
+ A784A26411D16622005776AC /* SyntaxChecker.h in Headers */,
+ BC18C46C0E16F5CD00B34460 /* TCPackedCache.h in Headers */,
+ BC18C46D0E16F5CD00B34460 /* TCPageMap.h in Headers */,
+ BC18C46E0E16F5CD00B34460 /* TCSpinLock.h in Headers */,
+ BC18C46F0E16F5CD00B34460 /* TCSystemAlloc.h in Headers */,
+ 971EDEA61169E0D3005E4262 /* Terminator.h in Headers */,
+ 18BAB55410DAE066000D945B /* ThreadIdentifierDataPthreads.h in Headers */,
+ BC18C4700E16F5CD00B34460 /* Threading.h in Headers */,
+ BC5F7BBF11823B590052C02C /* ThreadingPrimitives.h in Headers */,
+ BC5F7BC011823B590052C02C /* ThreadSafeShared.h in Headers */,
+ BC18C4710E16F5CD00B34460 /* ThreadSpecific.h in Headers */,
+ A7386556118697B400540279 /* ThunkGenerators.h in Headers */,
+ 14A42E400F4F60EE00599099 /* TimeoutChecker.h in Headers */,
+ 5D53726F0E1C54880021E549 /* Tracing.h in Headers */,
+ 0B4D7E630F319AC800AD7E58 /* TypeTraits.h in Headers */,
+ BC18C4720E16F5CD00B34460 /* ucpinternal.h in Headers */,
+ BC18C4730E16F5CD00B34460 /* Unicode.h in Headers */,
+ BC18C4740E16F5CD00B34460 /* UnicodeIcu.h in Headers */,
+ BC18C4750E16F5CD00B34460 /* UnusedParam.h in Headers */,
+ BC18C4760E16F5CD00B34460 /* UString.h in Headers */,
+ 08DDA5C11264631700751732 /* UStringBuilder.h in Headers */,
+ BC18C4770E16F5CD00B34460 /* UTF8.h in Headers */,
+ E17FF771112131D200076A19 /* ValueCheck.h in Headers */,
+ BC18C4780E16F5CD00B34460 /* Vector.h in Headers */,
+ BC18C4790E16F5CD00B34460 /* VectorTraits.h in Headers */,
+ 96DD73790F9DA3100027FBCC /* VMTags.h in Headers */,
+ 14BFCE6910CDB1FC00364CCE /* WeakGCMap.h in Headers */,
+ 14035DB110DBFB2A00FFFFE7 /* WeakGCPtr.h in Headers */,
+ 1420BE7B10AA6DDB00F455D2 /* WeakRandom.h in Headers */,
+ BC18C47A0E16F5CD00B34460 /* WebKitAvailability.h in Headers */,
+ 868BFA18117CF19900B908B1 /* WTFString.h in Headers */,
+ 86D08D5411793613006E5ED0 /* WTFThreadData.h in Headers */,
+ 9688CB160ED12B4E001D649F /* X86Assembler.h in Headers */,
+ DDF7ABD411F60ED200108E36 /* GCActivityCallback.h in Headers */,
+ DDE82AD81209D955005C1756 /* GCHandle.h in Headers */,
+ 86F38859121130CA007A7CE3 /* AtomicStringHash.h in Headers */,
+ 862AF4B612239C7B0024E5B8 /* DecimalNumber.h in Headers */,
+ BCFBE696122560E800309E9D /* PassOwnArrayPtr.h in Headers */,
+ BCFBE698122561D200309E9D /* OwnArrayPtrCommon.h in Headers */,
+ 9714AF4B122F289A0092D9F5 /* RawURLBuffer.h in Headers */,
+ 9714AF4C122F289A0092D9F5 /* URLBuffer.h in Headers */,
+ 9714AF4D122F289A0092D9F5 /* URLComponent.h in Headers */,
+ 9714AF4E122F289A0092D9F5 /* URLParser.h in Headers */,
+ 9714AF4F122F289A0092D9F5 /* URLSegments.h in Headers */,
+ 9714AF5F122F32070092D9F5 /* ParsedURL.h in Headers */,
+ 9714AF60122F32070092D9F5 /* URLString.h in Headers */,
+ 90213E3E123A40C200D422F3 /* MemoryStatistics.h in Headers */,
+ A730B6121250068F009D25B1 /* StrictEvalActivation.h in Headers */,
+ 933F5CDC1269229B0049191E /* NullPtr.h in Headers */,
+ F3BD31ED126735770065467F /* TextPosition.h in Headers */,
+ 1400067712A6F7830064D123 /* OSAllocator.h in Headers */,
+ 14B3EF0512BC24DD00D29EFF /* PageBlock.h in Headers */,
+ 14FFF98D12BFFF7500795BB8 /* PageAllocationAligned.h in Headers */,
+ 5135FAF212D26ACE003C083B /* Decoder.h in Headers */,
+ 5135FAF312D26AD1003C083B /* Encoder.h in Headers */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXHeadersBuildPhase section */
+
+/* Begin PBXNativeTarget section */
+ 1412111F0A48793C00480255 /* minidom */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 141211390A48798400480255 /* Build configuration list for PBXNativeTarget "minidom" */;
+ buildPhases = (
+ 1412111D0A48793C00480255 /* Sources */,
+ 1440025E0A52563F0005F061 /* ShellScript */,
+ 1412111E0A48793C00480255 /* Frameworks */,
+ 144005C70A5338C60005F061 /* Headers */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ 141211360A48796100480255 /* PBXTargetDependency */,
+ );
+ name = minidom;
+ productName = minidom;
+ productReference = 141211200A48793C00480255 /* minidom */;
+ productType = "com.apple.product-type.tool";
+ };
+ 14BD59BE0A3E8F9000BAF59C /* testapi */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 14BD59D60A3E8FC900BAF59C /* Build configuration list for PBXNativeTarget "testapi" */;
+ buildPhases = (
+ 14BD59BC0A3E8F9000BAF59C /* Sources */,
+ 14D857B50A469C100032146C /* ShellScript */,
+ 14BD59BD0A3E8F9000BAF59C /* Frameworks */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ 14270B080A451DA10080EEEA /* PBXTargetDependency */,
+ );
+ name = testapi;
+ productName = testapi;
+ productReference = 14BD59BF0A3E8F9000BAF59C /* testapi */;
+ productType = "com.apple.product-type.tool";
+ };
+ 932F5B3E0822A1C700736975 /* JavaScriptCore */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 149C275D08902AFE008A9EFC /* Build configuration list for PBXNativeTarget "JavaScriptCore" */;
+ buildPhases = (
+ 5D2F7CF90C6875BB00B5B72B /* Update Info.plist with version information */,
+ 932F5B3F0822A1C700736975 /* Headers */,
+ 932F5B910822A1C700736975 /* Sources */,
+ 932F5BD20822A1C700736975 /* Frameworks */,
+ 9319586B09D9F91A00A56FD4 /* Check For Global Initializers */,
+ 933457200EBFDC3F00B80894 /* Check For Exit Time Destructors */,
+ 5D29D8BE0E9860B400C3D2D0 /* Check For Weak VTables and Externals */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ 65FB3F7E09D11EF300F49DEB /* PBXTargetDependency */,
+ );
+ name = JavaScriptCore;
+ productInstallPath = "${SYSTEM_LIBRARY_DIR}/Frameworks/WebKit.framework/Versions/A/Frameworks";
+ productName = JavaScriptCore;
+ productReference = 932F5BD90822A1C700736975 /* JavaScriptCore.framework */;
+ productType = "com.apple.product-type.framework";
+ };
+ 932F5BDA0822A1C700736975 /* jsc */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 149C276708902AFE008A9EFC /* Build configuration list for PBXNativeTarget "jsc" */;
+ buildPhases = (
+ 932F5BDC0822A1C700736975 /* Sources */,
+ 932F5BDE0822A1C700736975 /* Frameworks */,
+ 5D5D8ABA0E0D0A7300F9C692 /* Copy Into Framework */,
+ 5D5D8ABF0E0D0B0300F9C692 /* Fix Framework Reference */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ 14270B0C0A451DA40080EEEA /* PBXTargetDependency */,
+ );
+ name = jsc;
+ productInstallPath = /usr/local/bin;
+ productName = jsc;
+ productReference = 932F5BE10822A1C700736975 /* jsc */;
+ productType = "com.apple.product-type.tool";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 0867D690FE84028FC02AAC07 /* Project object */ = {
+ isa = PBXProject;
+ buildConfigurationList = 149C277108902AFE008A9EFC /* Build configuration list for PBXProject "JavaScriptCore" */;
+ compatibilityVersion = "Xcode 2.4";
+ developmentRegion = English;
+ hasScannedForEncodings = 1;
+ knownRegions = (
+ English,
+ Japanese,
+ French,
+ German,
+ );
+ mainGroup = 0867D691FE84028FC02AAC07 /* JavaScriptCore */;
+ productRefGroup = 034768DFFF38A50411DB9C8B /* Products */;
+ projectDirPath = "";
+ projectRoot = "";
+ targets = (
+ 932F5BE30822A1C700736975 /* All */,
+ 932F5B3E0822A1C700736975 /* JavaScriptCore */,
+ 65FB3F6609D11E9100F49DEB /* Derived Sources */,
+ 1412111F0A48793C00480255 /* minidom */,
+ 14BD59BE0A3E8F9000BAF59C /* testapi */,
+ 932F5BDA0822A1C700736975 /* jsc */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXShellScriptBuildPhase section */
+ 1440025E0A52563F0005F061 /* ShellScript */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ );
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "cp \"${SRCROOT}/API/tests/minidom.js\" \"${BUILT_PRODUCTS_DIR}\"";
+ };
+ 14D857B50A469C100032146C /* ShellScript */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ );
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "cp \"${SRCROOT}/API/tests/testapi.js\" \"${BUILT_PRODUCTS_DIR}\"";
+ };
+ 5D29D8BE0E9860B400C3D2D0 /* Check For Weak VTables and Externals */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ "$(TARGET_BUILD_DIR)/$(EXECUTABLE_PATH)",
+ );
+ name = "Check For Weak VTables and Externals";
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "if [ -f ../Tools/Scripts/check-for-weak-vtables-and-externals ]; then\n ../Tools/Scripts/check-for-weak-vtables-and-externals || exit $?\nfi";
+ };
+ 5D2F7CF90C6875BB00B5B72B /* Update Info.plist with version information */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ "$(SRCROOT)/Configurations/Version.xcconfig",
+ );
+ name = "Update Info.plist with version information";
+ outputPaths = (
+ "$(SRCROOT)/Info.plist",
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "# Touch Info.plist to let Xcode know it needs to copy it into the built product\nif [[ \"${CONFIGURATION}\" != \"Production\" ]]; then\n touch \"$SRCROOT/Info.plist\";\nfi;\n";
+ };
+ 5D35DEE10C7C140B008648B2 /* Generate DTrace header */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ "$(SRCROOT)/runtime/Tracing.d",
+ );
+ name = "Generate DTrace header";
+ outputPaths = (
+ "$(BUILT_PRODUCTS_DIR)/DerivedSources/JavaScriptCore/TracingDtrace.h",
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "TRACING_D=\"$SRCROOT/runtime/Tracing.d\";\nTRACING_H=\"$BUILT_PRODUCTS_DIR/DerivedSources/JavaScriptCore/TracingDtrace.h\";\n\nif [[ \"$HAVE_DTRACE\" = \"1\" && \"$TRACING_D\" -nt \"$TRACING_H\" ]];\nthen\n\tdtrace -h -o \"$TRACING_H\" -s \"$TRACING_D\";\nfi;\n";
+ };
+ 5D5D8ABF0E0D0B0300F9C692 /* Fix Framework Reference */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ "$(BUILT_PRODUCTS_DIR)/JavaScriptCore.framework/Resources/jsc",
+ );
+ name = "Fix Framework Reference";
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "# Update the copied jsc binary to refer to JavaScriptcore.framework relative to its location\ninstall_name_tool -change \"${BUILT_PRODUCTS_DIR}/JavaScriptCore.framework/Versions/A/JavaScriptCore\" \"@loader_path/../JavaScriptCore\" \"${BUILT_PRODUCTS_DIR}/JavaScriptCore.framework/Resources/jsc\"\n";
+ };
+ 65FB3F6509D11E9100F49DEB /* Generate Derived Sources */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ );
+ name = "Generate Derived Sources";
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "mkdir -p \"${BUILT_PRODUCTS_DIR}/DerivedSources/JavaScriptCore/docs\"\ncd \"${BUILT_PRODUCTS_DIR}/DerivedSources/JavaScriptCore\"\n\n/bin/ln -sfh \"${SRCROOT}\" JavaScriptCore\nexport JavaScriptCore=\"JavaScriptCore\"\nexport BUILT_PRODUCTS_DIR=\"../..\"\n\nmake -f \"JavaScriptCore/DerivedSources.make\" -j `/usr/sbin/sysctl -n hw.ncpu`\n";
+ };
+ 9319586B09D9F91A00A56FD4 /* Check For Global Initializers */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ "$(TARGET_BUILD_DIR)/$(EXECUTABLE_PATH)",
+ );
+ name = "Check For Global Initializers";
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "if [ -f ../Tools/Scripts/check-for-global-initializers ]; then\n ../Tools/Scripts/check-for-global-initializers || exit $?\nfi";
+ };
+ 933457200EBFDC3F00B80894 /* Check For Exit Time Destructors */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ "$(TARGET_BUILD_DIR)/$(EXECUTABLE_PATH)",
+ );
+ name = "Check For Exit Time Destructors";
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "if [ -f ../Tools/Scripts/check-for-exit-time-destructors ]; then\n ../Tools/Scripts/check-for-exit-time-destructors || exit $?\nfi";
+ };
+/* End PBXShellScriptBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 1412111D0A48793C00480255 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 1440057F0A5335640005F061 /* JSNode.c in Sources */,
+ 144007580A5370D20005F061 /* JSNodeList.c in Sources */,
+ 141211340A48795800480255 /* minidom.c in Sources */,
+ 1440063F0A53598A0005F061 /* Node.c in Sources */,
+ 1440074B0A536CC20005F061 /* NodeList.c in Sources */,
+ DDE82AD51209D955005C1756 /* GCHandle.cpp in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 14BD59BC0A3E8F9000BAF59C /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 1440F6100A4F85670005F061 /* testapi.c in Sources */,
+ DDE82AD41209D955005C1756 /* GCHandle.cpp in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 932F5B910822A1C700736975 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 147F39BD107EC37600427A48 /* ArgList.cpp in Sources */,
+ 147F39BE107EC37600427A48 /* Arguments.cpp in Sources */,
+ 86D3B2C310156BDE002865E7 /* ARMAssembler.cpp in Sources */,
+ A74DE1D0120B875600D40D5B /* ARMv7Assembler.cpp in Sources */,
+ 147F39BF107EC37600427A48 /* ArrayConstructor.cpp in Sources */,
+ 147F39C0107EC37600427A48 /* ArrayPrototype.cpp in Sources */,
+ 65FDE49C0BDD1D4A00E80111 /* Assertions.cpp in Sources */,
+ 868BFA08117CEFD100B908B1 /* AtomicString.cpp in Sources */,
+ 14280863107EC11A0013E7B2 /* BooleanConstructor.cpp in Sources */,
+ 14280864107EC11A0013E7B2 /* BooleanObject.cpp in Sources */,
+ 14280865107EC11A0013E7B2 /* BooleanPrototype.cpp in Sources */,
+ A7A1F7AC0F252B3C00E184E2 /* ByteArray.cpp in Sources */,
+ 148F21AA107EC53A0042EC2C /* BytecodeGenerator.cpp in Sources */,
+ 1428082D107EC0570013E7B2 /* CallData.cpp in Sources */,
+ 1429D8DD0ED2205B00B89619 /* CallFrame.cpp in Sources */,
+ 969A07960ED1D3AE00F1F681 /* CodeBlock.cpp in Sources */,
+ E1A862D60D7F2B5C001EC6AA /* CollatorDefault.cpp in Sources */,
+ E1A862A90D7EBB76001EC6AA /* CollatorICU.cpp in Sources */,
+ 14F8BA4F107EC899009892DC /* Collector.cpp in Sources */,
+ 147F39C1107EC37600427A48 /* CommonIdentifiers.cpp in Sources */,
+ 147F39C2107EC37600427A48 /* Completion.cpp in Sources */,
+ 1428082E107EC0570013E7B2 /* ConstructData.cpp in Sources */,
+ 86565742115BE3DA00291F40 /* CString.cpp in Sources */,
+ 180B9BFE0F16E94D009BDBC5 /* CurrentTime.cpp in Sources */,
+ 147F39C3107EC37600427A48 /* DateConstructor.cpp in Sources */,
+ 147F39C4107EC37600427A48 /* DateConversion.cpp in Sources */,
+ 147F39C5107EC37600427A48 /* DateInstance.cpp in Sources */,
+ 41359CF60FDD89CB00206180 /* DateMath.cpp in Sources */,
+ 147F39C6107EC37600427A48 /* DatePrototype.cpp in Sources */,
+ 14280823107EC02C0013E7B2 /* Debugger.cpp in Sources */,
+ BC3135650F302FA3003DFD3A /* DebuggerActivation.cpp in Sources */,
+ 149559EE0DDCDDF700648087 /* DebuggerCallFrame.cpp in Sources */,
+ 0F29479C126E698C00B3ABF5 /* DecimalNumber.cpp in Sources */,
+ 14469DD7107EC79E00650446 /* dtoa.cpp in Sources */,
+ 147F39C7107EC37600427A48 /* Error.cpp in Sources */,
+ 147F39C8107EC37600427A48 /* ErrorConstructor.cpp in Sources */,
+ 147F39C9107EC37600427A48 /* ErrorInstance.cpp in Sources */,
+ 147F39CA107EC37600427A48 /* ErrorPrototype.cpp in Sources */,
+ 1429D8780ED21ACD00B89619 /* ExceptionHelpers.cpp in Sources */,
+ 86CA032E1038E8440028A609 /* Executable.cpp in Sources */,
+ A7B48F490EE8936F00DCBDB6 /* ExecutableAllocator.cpp in Sources */,
+ 86DB64640F95C6FC00D7D921 /* ExecutableAllocatorFixedVMPool.cpp in Sources */,
+ 14F8BA3E107EC886009892DC /* FastMalloc.cpp in Sources */,
+ 147F39CB107EC37600427A48 /* FunctionConstructor.cpp in Sources */,
+ 147F39CC107EC37600427A48 /* FunctionPrototype.cpp in Sources */,
+ DDF7ABD511F60ED200108E36 /* GCActivityCallbackCF.cpp in Sources */,
+ DDE82AD71209D955005C1756 /* GCHandle.cpp in Sources */,
+ 14280855107EC0E70013E7B2 /* GetterSetter.cpp in Sources */,
+ 147F39CD107EC37600427A48 /* GlobalEvalFunction.cpp in Sources */,
+ 65DFC93308EA173A00F7300B /* HashTable.cpp in Sources */,
+ 147F39CE107EC37600427A48 /* Identifier.cpp in Sources */,
+ E178636D0D9BEEC300D74E75 /* InitializeThreading.cpp in Sources */,
+ 147F39CF107EC37600427A48 /* InternalFunction.cpp in Sources */,
+ 1429D7D40ED2128200B89619 /* Interpreter.cpp in Sources */,
+ 1429D92F0ED22D7000B89619 /* JIT.cpp in Sources */,
+ 86A90ED00EE7D51F00AB350D /* JITArithmetic.cpp in Sources */,
+ A75706DE118A2BCF0057F88F /* JITArithmetic32_64.cpp in Sources */,
+ 86CC85A30EE79B7400288682 /* JITCall.cpp in Sources */,
+ 146FE51211A710430087AE66 /* JITCall32_64.cpp in Sources */,
+ BCDD51EB0FB8DF74004A8BDC /* JITOpcodes.cpp in Sources */,
+ A71236E51195F33C00BD2174 /* JITOpcodes32_64.cpp in Sources */,
+ 86CC85C40EE7A89400288682 /* JITPropertyAccess.cpp in Sources */,
+ A7C1E8E4112E72EF00A37F98 /* JITPropertyAccess32_64.cpp in Sources */,
+ 14A23D750F4E1ABB0023CDAD /* JITStubs.cpp in Sources */,
+ 140B7D1D0DC69AF7009C42B8 /* JSActivation.cpp in Sources */,
+ 140566C4107EC255005DBC8D /* JSAPIValueWrapper.cpp in Sources */,
+ 147F39D0107EC37600427A48 /* JSArray.cpp in Sources */,
+ 1421359B0A677F4F00A8195E /* JSBase.cpp in Sources */,
+ A791EF290F11E07900AE1F68 /* JSByteArray.cpp in Sources */,
+ 1440F8AF0A508D200005F061 /* JSCallbackConstructor.cpp in Sources */,
+ 1440F8920A508B100005F061 /* JSCallbackFunction.cpp in Sources */,
+ 14ABDF600A437FEF00ECCA01 /* JSCallbackObject.cpp in Sources */,
+ 147F39D1107EC37600427A48 /* JSCell.cpp in Sources */,
+ 1440FCE40A51E46B0005F061 /* JSClassRef.cpp in Sources */,
+ 14BD5A300A3E91F600BAF59C /* JSContextRef.cpp in Sources */,
+ 140566D6107EC271005DBC8D /* JSFunction.cpp in Sources */,
+ E18E3A590DF9278C00D90B34 /* JSGlobalData.cpp in Sources */,
+ 147F39D2107EC37600427A48 /* JSGlobalObject.cpp in Sources */,
+ 14E9D17B107EC469004DDA21 /* JSGlobalObjectFunctions.cpp in Sources */,
+ 147F39D3107EC37600427A48 /* JSImmediate.cpp in Sources */,
+ 14280875107EC13E0013E7B2 /* JSLock.cpp in Sources */,
+ A72700900DAC6BBC00E548D7 /* JSNotAnObject.cpp in Sources */,
+ 1428085D107EC0F80013E7B2 /* JSNumberCell.cpp in Sources */,
+ 147F39D4107EC37600427A48 /* JSObject.cpp in Sources */,
+ 1482B7E40A43076000517CFC /* JSObjectRef.cpp in Sources */,
+ A783A2AB11A5BE8400563D20 /* JSObjectWithGlobalObject.cpp in Sources */,
+ A7F993600FD7325100A0B2D0 /* JSONObject.cpp in Sources */,
+ A784A26211D16622005776AC /* JSParser.cpp in Sources */,
+ 95F6E6950E5B5F970091E860 /* JSProfilerPrivate.cpp in Sources */,
+ A727FF6B0DA3092200E548D7 /* JSPropertyNameIterator.cpp in Sources */,
+ 140566D1107EC267005DBC8D /* JSStaticScopeObject.cpp in Sources */,
+ 147F39D5107EC37600427A48 /* JSString.cpp in Sources */,
+ 1482B74E0A43032800517CFC /* JSStringRef.cpp in Sources */,
+ 146AAB380B66A94400E55F16 /* JSStringRefCF.cpp in Sources */,
+ 147F39D6107EC37600427A48 /* JSValue.cpp in Sources */,
+ 14BD5A320A3E91F600BAF59C /* JSValueRef.cpp in Sources */,
+ 147F39D7107EC37600427A48 /* JSVariableObject.cpp in Sources */,
+ A7482B9411671147003B0712 /* JSWeakObjectMapRefPrivate.cpp in Sources */,
+ 14280870107EC1340013E7B2 /* JSWrapperObject.cpp in Sources */,
+ BC01D4F111A8F1FF00A54B2A /* JSZombie.cpp in Sources */,
+ BCFD8C920EEB2EE700283848 /* JumpTable.cpp in Sources */,
+ 148F21B0107EC5410042EC2C /* Lexer.cpp in Sources */,
+ A7E2EA6C0FB460CF00601F06 /* LiteralParser.cpp in Sources */,
+ 14469DDE107EC7E700650446 /* Lookup.cpp in Sources */,
+ 86C568E011A213EE0007F7F0 /* MacroAssemblerARM.cpp in Sources */,
+ 06D358B30DAADAA4003B174E /* MainThread.cpp in Sources */,
+ 06D358B40DAADAAA003B174E /* MainThreadMac.mm in Sources */,
+ A74B3499102A5F8E0032AB98 /* MarkStack.cpp in Sources */,
+ A7C530E4102A3813005BC741 /* MarkStackPosix.cpp in Sources */,
+ 14469DDF107EC7E700650446 /* MathObject.cpp in Sources */,
+ 511FC4C9117EE28700425272 /* MD5.cpp in Sources */,
+ 90213E3D123A40C200D422F3 /* MemoryStatistics.cpp in Sources */,
+ 14469DE0107EC7E700650446 /* NativeErrorConstructor.cpp in Sources */,
+ 14469DE1107EC7E700650446 /* NativeErrorPrototype.cpp in Sources */,
+ 148F21B7107EC5470042EC2C /* Nodes.cpp in Sources */,
+ 655EB29B10CE2581001A990E /* NodesCodegen.cpp in Sources */,
+ 14469DE2107EC7E700650446 /* NumberConstructor.cpp in Sources */,
+ 14469DE3107EC7E700650446 /* NumberObject.cpp in Sources */,
+ 14469DE4107EC7E700650446 /* NumberPrototype.cpp in Sources */,
+ 14469DE5107EC7E700650446 /* ObjectConstructor.cpp in Sources */,
+ 14469DE6107EC7E700650446 /* ObjectPrototype.cpp in Sources */,
+ E124A8F80E555775003091F1 /* OpaqueJSString.cpp in Sources */,
+ 969A079A0ED1D3AE00F1F681 /* Opcode.cpp in Sources */,
+ 14280850107EC0D70013E7B2 /* Operations.cpp in Sources */,
+ 1400069312A6F9E10064D123 /* OSAllocatorPosix.cpp in Sources */,
+ 14FFF98C12BFFF7500795BB8 /* PageAllocationAligned.cpp in Sources */,
+ 14B3EF0612BC24DD00D29EFF /* PageBlock.cpp in Sources */,
+ 9714AF5E122F32070092D9F5 /* ParsedURL.cpp in Sources */,
+ 148F21BC107EC54D0042EC2C /* Parser.cpp in Sources */,
+ 93052C340FB792190048FDC3 /* ParserArena.cpp in Sources */,
+ 930754C108B0F68000AB3056 /* pcre_compile.cpp in Sources */,
+ 930754EB08B0F78500AB3056 /* pcre_exec.cpp in Sources */,
+ 930754D008B0F74600AB3056 /* pcre_tables.cpp in Sources */,
+ 937013480CA97E0E00FA14D3 /* pcre_ucp_searchfuncs.cpp in Sources */,
+ 93E26BD408B1514100F85226 /* pcre_xclass.cpp in Sources */,
+ 95742F650DD11F5A000917FB /* Profile.cpp in Sources */,
+ 95CD45760E1C4FDD0085358E /* ProfileGenerator.cpp in Sources */,
+ 95AB83560DA43C3000BC83F3 /* ProfileNode.cpp in Sources */,
+ 95AB83420DA4322500BC83F3 /* Profiler.cpp in Sources */,
+ 1C61516C0EBAC7A00031376F /* ProfilerServer.mm in Sources */,
+ A7FB60A4103F7DC20017A286 /* PropertyDescriptor.cpp in Sources */,
+ 14469DE7107EC7E700650446 /* PropertyNameArray.cpp in Sources */,
+ 14469DE8107EC7E700650446 /* PropertySlot.cpp in Sources */,
+ 14469DE9107EC7E700650446 /* PrototypeFunction.cpp in Sources */,
+ 088FA5BB0EF76D4300578E6F /* RandomNumber.cpp in Sources */,
+ 905B02AE0E28640F006DF882 /* RefCountedLeakCounter.cpp in Sources */,
+ 86EAC4970F93E8D1008EC948 /* RegexInterpreter.cpp in Sources */,
+ 86EAC4990F93E8D1008EC948 /* RegexJIT.cpp in Sources */,
+ 14280841107EC0930013E7B2 /* RegExp.cpp in Sources */,
+ A1712B3B11C7B212007A5315 /* RegExpCache.cpp in Sources */,
+ 14280842107EC0930013E7B2 /* RegExpConstructor.cpp in Sources */,
+ 14280843107EC0930013E7B2 /* RegExpObject.cpp in Sources */,
+ 868D81A212C428CE0093DC84 /* RegexPattern.cpp in Sources */,
+ 14280844107EC0930013E7B2 /* RegExpPrototype.cpp in Sources */,
+ 1428083A107EC0750013E7B2 /* RegisterFile.cpp in Sources */,
+ 86B99AB8117E391E00DF5A90 /* RopeImpl.cpp in Sources */,
+ 1429D8850ED21C3D00B89619 /* SamplingTool.cpp in Sources */,
+ 14469DEA107EC7E700650446 /* ScopeChain.cpp in Sources */,
+ 0BF28A2911A33DC300638F84 /* SizeLimits.cpp in Sources */,
+ 9330402C0E6A764000786E6A /* SmallStrings.cpp in Sources */,
+ A730B6131250068F009D25B1 /* StrictEvalActivation.cpp in Sources */,
+ 86438FC41265503E00E0DFCA /* StringBuilder.cpp in Sources */,
+ 86D87DAE12BCA7D1008E73A1 /* StackBounds.cpp in Sources */,
+ 14469DEB107EC7E700650446 /* StringConstructor.cpp in Sources */,
+ 868BFA0E117CEFD100B908B1 /* StringImpl.cpp in Sources */,
+ 14469DEC107EC7E700650446 /* StringObject.cpp in Sources */,
+ 14469DED107EC7E700650446 /* StringPrototype.cpp in Sources */,
+ 8626BECF11928E3900782FAB /* StringStatics.cpp in Sources */,
+ BCDE3B430E6C832D001453A7 /* Structure.cpp in Sources */,
+ 7E4EE70F0EBB7A5B005934AA /* StructureChain.cpp in Sources */,
+ BCCF0D0C0EF0B8A500413C8F /* StructureStubInfo.cpp in Sources */,
+ 14F8BA43107EC88C009892DC /* TCSystemAlloc.cpp in Sources */,
+ 18BAB55310DAE054000D945B /* ThreadIdentifierDataPthreads.cpp in Sources */,
+ 5D6A566B0F05995500266145 /* Threading.cpp in Sources */,
+ E1EE793D0D6C9B9200FEA3BA /* ThreadingPthreads.cpp in Sources */,
+ A7386555118697B400540279 /* ThunkGenerators.cpp in Sources */,
+ 14A42E3F0F4F60EE00599099 /* TimeoutChecker.cpp in Sources */,
+ 0B330C270F38C62300692DE3 /* TypeTraits.cpp in Sources */,
+ 9714AF46122F28850092D9F5 /* URLSegments.cpp in Sources */,
+ 14469DEE107EC7E700650446 /* UString.cpp in Sources */,
+ E1EF79AA0CE97BA60088D500 /* UTF8.cpp in Sources */,
+ 868BFA17117CF19900B908B1 /* WTFString.cpp in Sources */,
+ 86D08D5311793613006E5ED0 /* WTFThreadData.cpp in Sources */,
+ 93854A9A12C93D3B00DAAF77 /* NullPtr.cpp in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 932F5BDC0822A1C700736975 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 932F5BDD0822A1C700736975 /* jsc.cpp in Sources */,
+ DDE82AD31209D955005C1756 /* GCHandle.cpp in Sources */,
+ 972A485F12661E0800F4514F /* URLCharacterTypes.cpp in Sources */,
+ 972A48771266256F00F4514F /* URLEscape.cpp in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXTargetDependency section */
+ 141211360A48796100480255 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 932F5B3E0822A1C700736975 /* JavaScriptCore */;
+ targetProxy = 141211350A48796100480255 /* PBXContainerItemProxy */;
+ };
+ 141214BF0A49190E00480255 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 1412111F0A48793C00480255 /* minidom */;
+ targetProxy = 141214BE0A49190E00480255 /* PBXContainerItemProxy */;
+ };
+ 14270B080A451DA10080EEEA /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 932F5B3E0822A1C700736975 /* JavaScriptCore */;
+ targetProxy = 14270B070A451DA10080EEEA /* PBXContainerItemProxy */;
+ };
+ 14270B0C0A451DA40080EEEA /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 932F5B3E0822A1C700736975 /* JavaScriptCore */;
+ targetProxy = 14270B0B0A451DA40080EEEA /* PBXContainerItemProxy */;
+ };
+ 14BD59C70A3E8FA400BAF59C /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 14BD59BE0A3E8F9000BAF59C /* testapi */;
+ targetProxy = 14BD59C60A3E8FA400BAF59C /* PBXContainerItemProxy */;
+ };
+ 65FB3F7E09D11EF300F49DEB /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 65FB3F6609D11E9100F49DEB /* Derived Sources */;
+ targetProxy = 65FB3F7D09D11EF300F49DEB /* PBXContainerItemProxy */;
+ };
+ 932F5BE70822A1C700736975 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 932F5B3E0822A1C700736975 /* JavaScriptCore */;
+ targetProxy = 932F5BE60822A1C700736975 /* PBXContainerItemProxy */;
+ };
+ 932F5BE90822A1C700736975 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 932F5BDA0822A1C700736975 /* jsc */;
+ targetProxy = 932F5BE80822A1C700736975 /* PBXContainerItemProxy */;
+ };
+/* End PBXTargetDependency section */
+
+/* Begin XCBuildConfiguration section */
+ 1412113A0A48798400480255 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = minidom;
+ };
+ name = Debug;
+ };
+ 1412113B0A48798400480255 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = minidom;
+ };
+ name = Release;
+ };
+ 1412113C0A48798400480255 /* Production */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = minidom;
+ };
+ name = Production;
+ };
+ 149C275E08902AFE008A9EFC /* Debug */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 1C9051430BA9E8A70081E9D0 /* JavaScriptCore.xcconfig */;
+ buildSettings = {
+ INSTALL_PATH = "$(BUILT_PRODUCTS_DIR)";
+ };
+ name = Debug;
+ };
+ 149C275F08902AFE008A9EFC /* Release */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 1C9051430BA9E8A70081E9D0 /* JavaScriptCore.xcconfig */;
+ buildSettings = {
+ INSTALL_PATH = "$(BUILT_PRODUCTS_DIR)";
+ };
+ name = Release;
+ };
+ 149C276108902AFE008A9EFC /* Production */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 1C9051430BA9E8A70081E9D0 /* JavaScriptCore.xcconfig */;
+ buildSettings = {
+ BUILD_VARIANTS = normal;
+ };
+ name = Production;
+ };
+ 149C276808902AFE008A9EFC /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = jsc;
+ };
+ name = Debug;
+ };
+ 149C276908902AFE008A9EFC /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = jsc;
+ };
+ name = Release;
+ };
+ 149C276B08902AFE008A9EFC /* Production */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = jsc;
+ };
+ name = Production;
+ };
+ 149C276D08902AFE008A9EFC /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = All;
+ };
+ name = Debug;
+ };
+ 149C276E08902AFE008A9EFC /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = All;
+ };
+ name = Release;
+ };
+ 149C277008902AFE008A9EFC /* Production */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = All;
+ };
+ name = Production;
+ };
+ 149C277208902AFE008A9EFC /* Debug */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 1C9051440BA9E8A70081E9D0 /* DebugRelease.xcconfig */;
+ buildSettings = {
+ DEAD_CODE_STRIPPING = "$(DEAD_CODE_STRIPPING_debug)";
+ DEBUG_DEFINES = "$(DEBUG_DEFINES_debug)";
+ GCC_OPTIMIZATION_LEVEL = "$(GCC_OPTIMIZATION_LEVEL_debug)";
+ STRIP_INSTALLED_PRODUCT = "$(STRIP_INSTALLED_PRODUCT_debug)";
+ };
+ name = Debug;
+ };
+ 149C277308902AFE008A9EFC /* Release */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 1C9051440BA9E8A70081E9D0 /* DebugRelease.xcconfig */;
+ buildSettings = {
+ STRIP_INSTALLED_PRODUCT = NO;
+ };
+ name = Release;
+ };
+ 149C277508902AFE008A9EFC /* Production */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 1C9051450BA9E8A70081E9D0 /* Base.xcconfig */;
+ buildSettings = {
+ };
+ name = Production;
+ };
+ 14BD59D70A3E8FC900BAF59C /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = testapi;
+ };
+ name = Debug;
+ };
+ 14BD59D80A3E8FC900BAF59C /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = testapi;
+ };
+ name = Release;
+ };
+ 14BD59D90A3E8FC900BAF59C /* Production */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = testapi;
+ };
+ name = Production;
+ };
+ 65FB3F7809D11EBD00F49DEB /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = "Generate Derived Sources";
+ };
+ name = Debug;
+ };
+ 65FB3F7909D11EBD00F49DEB /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = "Generate Derived Sources";
+ };
+ name = Release;
+ };
+ 65FB3F7A09D11EBD00F49DEB /* Production */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = "Generate Derived Sources";
+ };
+ name = Production;
+ };
+ A761483D0E6402F700E357FA /* Profiling */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 1C9051440BA9E8A70081E9D0 /* DebugRelease.xcconfig */;
+ buildSettings = {
+ STRIP_INSTALLED_PRODUCT = NO;
+ };
+ name = Profiling;
+ };
+ A761483E0E6402F700E357FA /* Profiling */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = All;
+ };
+ name = Profiling;
+ };
+ A761483F0E6402F700E357FA /* Profiling */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 1C9051430BA9E8A70081E9D0 /* JavaScriptCore.xcconfig */;
+ buildSettings = {
+ INSTALL_PATH = "$(BUILT_PRODUCTS_DIR)";
+ };
+ name = Profiling;
+ };
+ A76148400E6402F700E357FA /* Profiling */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = "Generate Derived Sources";
+ };
+ name = Profiling;
+ };
+ A76148410E6402F700E357FA /* Profiling */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = minidom;
+ };
+ name = Profiling;
+ };
+ A76148420E6402F700E357FA /* Profiling */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = testapi;
+ };
+ name = Profiling;
+ };
+ A76148430E6402F700E357FA /* Profiling */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = jsc;
+ };
+ name = Profiling;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ 141211390A48798400480255 /* Build configuration list for PBXNativeTarget "minidom" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 1412113A0A48798400480255 /* Debug */,
+ 1412113B0A48798400480255 /* Release */,
+ A76148410E6402F700E357FA /* Profiling */,
+ 1412113C0A48798400480255 /* Production */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Production;
+ };
+ 149C275D08902AFE008A9EFC /* Build configuration list for PBXNativeTarget "JavaScriptCore" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 149C275E08902AFE008A9EFC /* Debug */,
+ 149C275F08902AFE008A9EFC /* Release */,
+ A761483F0E6402F700E357FA /* Profiling */,
+ 149C276108902AFE008A9EFC /* Production */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Production;
+ };
+ 149C276708902AFE008A9EFC /* Build configuration list for PBXNativeTarget "jsc" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 149C276808902AFE008A9EFC /* Debug */,
+ 149C276908902AFE008A9EFC /* Release */,
+ A76148430E6402F700E357FA /* Profiling */,
+ 149C276B08902AFE008A9EFC /* Production */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Production;
+ };
+ 149C276C08902AFE008A9EFC /* Build configuration list for PBXAggregateTarget "All" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 149C276D08902AFE008A9EFC /* Debug */,
+ 149C276E08902AFE008A9EFC /* Release */,
+ A761483E0E6402F700E357FA /* Profiling */,
+ 149C277008902AFE008A9EFC /* Production */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Production;
+ };
+ 149C277108902AFE008A9EFC /* Build configuration list for PBXProject "JavaScriptCore" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 149C277208902AFE008A9EFC /* Debug */,
+ 149C277308902AFE008A9EFC /* Release */,
+ A761483D0E6402F700E357FA /* Profiling */,
+ 149C277508902AFE008A9EFC /* Production */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Production;
+ };
+ 14BD59D60A3E8FC900BAF59C /* Build configuration list for PBXNativeTarget "testapi" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 14BD59D70A3E8FC900BAF59C /* Debug */,
+ 14BD59D80A3E8FC900BAF59C /* Release */,
+ A76148420E6402F700E357FA /* Profiling */,
+ 14BD59D90A3E8FC900BAF59C /* Production */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Production;
+ };
+ 65FB3F7709D11EBD00F49DEB /* Build configuration list for PBXAggregateTarget "Derived Sources" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 65FB3F7809D11EBD00F49DEB /* Debug */,
+ 65FB3F7909D11EBD00F49DEB /* Release */,
+ A76148400E6402F700E357FA /* Profiling */,
+ 65FB3F7A09D11EBD00F49DEB /* Production */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Production;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 0867D690FE84028FC02AAC07 /* Project object */;
+}
diff --git a/Source/JavaScriptCore/JavaScriptCorePrefix.h b/Source/JavaScriptCore/JavaScriptCorePrefix.h
new file mode 100644
index 0000000..21d6204
--- /dev/null
+++ b/Source/JavaScriptCore/JavaScriptCorePrefix.h
@@ -0,0 +1,36 @@
+#ifdef __cplusplus
+#define NULL __null
+#else
+#define NULL ((void *)0)
+#endif
+
+#include <ctype.h>
+#include <float.h>
+#include <locale.h>
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <strings.h>
+#include <time.h>
+#include <sys/param.h>
+#include <sys/time.h>
+#include <sys/timeb.h>
+#include <sys/types.h>
+
+#ifdef __cplusplus
+
+#include <list>
+#include <typeinfo>
+
+#endif
+
+#ifdef __cplusplus
+#define new ("if you use new/delete make sure to include config.h at the top of the file"())
+#define delete ("if you use new/delete make sure to include config.h at the top of the file"())
+#endif
+
+/* Work around bug with C++ library that screws up Objective-C++ when exception support is disabled. */
+#undef try
+#undef catch
+
diff --git a/Source/JavaScriptCore/Makefile b/Source/JavaScriptCore/Makefile
new file mode 100644
index 0000000..b9e2a72
--- /dev/null
+++ b/Source/JavaScriptCore/Makefile
@@ -0,0 +1,2 @@
+OTHER_OPTIONS = -target All
+include ../Makefile.shared
diff --git a/Source/JavaScriptCore/THANKS b/Source/JavaScriptCore/THANKS
new file mode 100644
index 0000000..b9a9649
--- /dev/null
+++ b/Source/JavaScriptCore/THANKS
@@ -0,0 +1,8 @@
+
+I would like to thank the following people for their help:
+
+Richard Moore <rich@kde.org> - for filling the Math object with some life
+Daegeun Lee <realking@mizi.com> - for pointing out some bugs and providing
+ much code for the String and Date object.
+Marco Pinelli <pinmc@libero.it> - for his patches
+Christian Kirsch <ck@held.mind.de> - for his contribution to the Date object
diff --git a/Source/JavaScriptCore/assembler/ARMAssembler.cpp b/Source/JavaScriptCore/assembler/ARMAssembler.cpp
new file mode 100644
index 0000000..86a1c14
--- /dev/null
+++ b/Source/JavaScriptCore/assembler/ARMAssembler.cpp
@@ -0,0 +1,378 @@
+/*
+ * Copyright (C) 2009 University of Szeged
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY UNIVERSITY OF SZEGED ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL UNIVERSITY OF SZEGED OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if ENABLE(ASSEMBLER) && CPU(ARM_TRADITIONAL)
+
+#include "ARMAssembler.h"
+
+namespace JSC {
+
+// Patching helpers
+
+void ARMAssembler::patchConstantPoolLoad(void* loadAddr, void* constPoolAddr)
+{
+ ARMWord *ldr = reinterpret_cast<ARMWord*>(loadAddr);
+ ARMWord diff = reinterpret_cast<ARMWord*>(constPoolAddr) - ldr;
+ ARMWord index = (*ldr & 0xfff) >> 1;
+
+ ASSERT(diff >= 1);
+ if (diff >= 2 || index > 0) {
+ diff = (diff + index - 2) * sizeof(ARMWord);
+ ASSERT(diff <= 0xfff);
+ *ldr = (*ldr & ~0xfff) | diff;
+ } else
+ *ldr = (*ldr & ~(0xfff | ARMAssembler::DT_UP)) | sizeof(ARMWord);
+}
+
+// Handle immediates
+
+ARMWord ARMAssembler::getOp2(ARMWord imm)
+{
+ int rol;
+
+ if (imm <= 0xff)
+ return OP2_IMM | imm;
+
+ if ((imm & 0xff000000) == 0) {
+ imm <<= 8;
+ rol = 8;
+ }
+ else {
+ imm = (imm << 24) | (imm >> 8);
+ rol = 0;
+ }
+
+ if ((imm & 0xff000000) == 0) {
+ imm <<= 8;
+ rol += 4;
+ }
+
+ if ((imm & 0xf0000000) == 0) {
+ imm <<= 4;
+ rol += 2;
+ }
+
+ if ((imm & 0xc0000000) == 0) {
+ imm <<= 2;
+ rol += 1;
+ }
+
+ if ((imm & 0x00ffffff) == 0)
+ return OP2_IMM | (imm >> 24) | (rol << 8);
+
+ return INVALID_IMM;
+}
+
+int ARMAssembler::genInt(int reg, ARMWord imm, bool positive)
+{
+ // Step1: Search a non-immediate part
+ ARMWord mask;
+ ARMWord imm1;
+ ARMWord imm2;
+ int rol;
+
+ mask = 0xff000000;
+ rol = 8;
+ while(1) {
+ if ((imm & mask) == 0) {
+ imm = (imm << rol) | (imm >> (32 - rol));
+ rol = 4 + (rol >> 1);
+ break;
+ }
+ rol += 2;
+ mask >>= 2;
+ if (mask & 0x3) {
+ // rol 8
+ imm = (imm << 8) | (imm >> 24);
+ mask = 0xff00;
+ rol = 24;
+ while (1) {
+ if ((imm & mask) == 0) {
+ imm = (imm << rol) | (imm >> (32 - rol));
+ rol = (rol >> 1) - 8;
+ break;
+ }
+ rol += 2;
+ mask >>= 2;
+ if (mask & 0x3)
+ return 0;
+ }
+ break;
+ }
+ }
+
+ ASSERT((imm & 0xff) == 0);
+
+ if ((imm & 0xff000000) == 0) {
+ imm1 = OP2_IMM | ((imm >> 16) & 0xff) | (((rol + 4) & 0xf) << 8);
+ imm2 = OP2_IMM | ((imm >> 8) & 0xff) | (((rol + 8) & 0xf) << 8);
+ } else if (imm & 0xc0000000) {
+ imm1 = OP2_IMM | ((imm >> 24) & 0xff) | ((rol & 0xf) << 8);
+ imm <<= 8;
+ rol += 4;
+
+ if ((imm & 0xff000000) == 0) {
+ imm <<= 8;
+ rol += 4;
+ }
+
+ if ((imm & 0xf0000000) == 0) {
+ imm <<= 4;
+ rol += 2;
+ }
+
+ if ((imm & 0xc0000000) == 0) {
+ imm <<= 2;
+ rol += 1;
+ }
+
+ if ((imm & 0x00ffffff) == 0)
+ imm2 = OP2_IMM | (imm >> 24) | ((rol & 0xf) << 8);
+ else
+ return 0;
+ } else {
+ if ((imm & 0xf0000000) == 0) {
+ imm <<= 4;
+ rol += 2;
+ }
+
+ if ((imm & 0xc0000000) == 0) {
+ imm <<= 2;
+ rol += 1;
+ }
+
+ imm1 = OP2_IMM | ((imm >> 24) & 0xff) | ((rol & 0xf) << 8);
+ imm <<= 8;
+ rol += 4;
+
+ if ((imm & 0xf0000000) == 0) {
+ imm <<= 4;
+ rol += 2;
+ }
+
+ if ((imm & 0xc0000000) == 0) {
+ imm <<= 2;
+ rol += 1;
+ }
+
+ if ((imm & 0x00ffffff) == 0)
+ imm2 = OP2_IMM | (imm >> 24) | ((rol & 0xf) << 8);
+ else
+ return 0;
+ }
+
+ if (positive) {
+ mov_r(reg, imm1);
+ orr_r(reg, reg, imm2);
+ } else {
+ mvn_r(reg, imm1);
+ bic_r(reg, reg, imm2);
+ }
+
+ return 1;
+}
+
+ARMWord ARMAssembler::getImm(ARMWord imm, int tmpReg, bool invert)
+{
+ ARMWord tmp;
+
+ // Do it by 1 instruction
+ tmp = getOp2(imm);
+ if (tmp != INVALID_IMM)
+ return tmp;
+
+ tmp = getOp2(~imm);
+ if (tmp != INVALID_IMM) {
+ if (invert)
+ return tmp | OP2_INV_IMM;
+ mvn_r(tmpReg, tmp);
+ return tmpReg;
+ }
+
+ return encodeComplexImm(imm, tmpReg);
+}
+
+void ARMAssembler::moveImm(ARMWord imm, int dest)
+{
+ ARMWord tmp;
+
+ // Do it by 1 instruction
+ tmp = getOp2(imm);
+ if (tmp != INVALID_IMM) {
+ mov_r(dest, tmp);
+ return;
+ }
+
+ tmp = getOp2(~imm);
+ if (tmp != INVALID_IMM) {
+ mvn_r(dest, tmp);
+ return;
+ }
+
+ encodeComplexImm(imm, dest);
+}
+
+ARMWord ARMAssembler::encodeComplexImm(ARMWord imm, int dest)
+{
+#if WTF_ARM_ARCH_AT_LEAST(7)
+ ARMWord tmp = getImm16Op2(imm);
+ if (tmp != INVALID_IMM) {
+ movw_r(dest, tmp);
+ return dest;
+ }
+ movw_r(dest, getImm16Op2(imm & 0xffff));
+ movt_r(dest, getImm16Op2(imm >> 16));
+ return dest;
+#else
+ // Do it by 2 instruction
+ if (genInt(dest, imm, true))
+ return dest;
+ if (genInt(dest, ~imm, false))
+ return dest;
+
+ ldr_imm(dest, imm);
+ return dest;
+#endif
+}
+
+// Memory load/store helpers
+
+void ARMAssembler::dataTransfer32(bool isLoad, RegisterID srcDst, RegisterID base, int32_t offset, bool bytes)
+{
+ ARMWord transferFlag = bytes ? DT_BYTE : 0;
+ if (offset >= 0) {
+ if (offset <= 0xfff)
+ dtr_u(isLoad, srcDst, base, offset | transferFlag);
+ else if (offset <= 0xfffff) {
+ add_r(ARMRegisters::S0, base, OP2_IMM | (offset >> 12) | (10 << 8));
+ dtr_u(isLoad, srcDst, ARMRegisters::S0, (offset & 0xfff) | transferFlag);
+ } else {
+ moveImm(offset, ARMRegisters::S0);
+ dtr_ur(isLoad, srcDst, base, ARMRegisters::S0 | transferFlag);
+ }
+ } else {
+ offset = -offset;
+ if (offset <= 0xfff)
+ dtr_d(isLoad, srcDst, base, offset | transferFlag);
+ else if (offset <= 0xfffff) {
+ sub_r(ARMRegisters::S0, base, OP2_IMM | (offset >> 12) | (10 << 8));
+ dtr_d(isLoad, srcDst, ARMRegisters::S0, (offset & 0xfff) | transferFlag);
+ } else {
+ moveImm(offset, ARMRegisters::S0);
+ dtr_dr(isLoad, srcDst, base, ARMRegisters::S0 | transferFlag);
+ }
+ }
+}
+
+void ARMAssembler::baseIndexTransfer32(bool isLoad, RegisterID srcDst, RegisterID base, RegisterID index, int scale, int32_t offset)
+{
+ ARMWord op2;
+
+ ASSERT(scale >= 0 && scale <= 3);
+ op2 = lsl(index, scale);
+
+ if (offset >= 0 && offset <= 0xfff) {
+ add_r(ARMRegisters::S0, base, op2);
+ dtr_u(isLoad, srcDst, ARMRegisters::S0, offset);
+ return;
+ }
+ if (offset <= 0 && offset >= -0xfff) {
+ add_r(ARMRegisters::S0, base, op2);
+ dtr_d(isLoad, srcDst, ARMRegisters::S0, -offset);
+ return;
+ }
+
+ ldr_un_imm(ARMRegisters::S0, offset);
+ add_r(ARMRegisters::S0, ARMRegisters::S0, op2);
+ dtr_ur(isLoad, srcDst, base, ARMRegisters::S0);
+}
+
+void ARMAssembler::doubleTransfer(bool isLoad, FPRegisterID srcDst, RegisterID base, int32_t offset)
+{
+ if (offset & 0x3) {
+ if (offset <= 0x3ff && offset >= 0) {
+ fdtr_u(isLoad, srcDst, base, offset >> 2);
+ return;
+ }
+ if (offset <= 0x3ffff && offset >= 0) {
+ add_r(ARMRegisters::S0, base, OP2_IMM | (offset >> 10) | (11 << 8));
+ fdtr_u(isLoad, srcDst, ARMRegisters::S0, (offset >> 2) & 0xff);
+ return;
+ }
+ offset = -offset;
+
+ if (offset <= 0x3ff && offset >= 0) {
+ fdtr_d(isLoad, srcDst, base, offset >> 2);
+ return;
+ }
+ if (offset <= 0x3ffff && offset >= 0) {
+ sub_r(ARMRegisters::S0, base, OP2_IMM | (offset >> 10) | (11 << 8));
+ fdtr_d(isLoad, srcDst, ARMRegisters::S0, (offset >> 2) & 0xff);
+ return;
+ }
+ offset = -offset;
+ }
+
+ ldr_un_imm(ARMRegisters::S0, offset);
+ add_r(ARMRegisters::S0, ARMRegisters::S0, base);
+ fdtr_u(isLoad, srcDst, ARMRegisters::S0, 0);
+}
+
+void* ARMAssembler::executableCopy(ExecutablePool* allocator)
+{
+ // 64-bit alignment is required for next constant pool and JIT code as well
+ m_buffer.flushWithoutBarrier(true);
+ if (m_buffer.uncheckedSize() & 0x7)
+ bkpt(0);
+
+ char* data = reinterpret_cast<char*>(m_buffer.executableCopy(allocator));
+
+ for (Jumps::Iterator iter = m_jumps.begin(); iter != m_jumps.end(); ++iter) {
+ // The last bit is set if the constant must be placed on constant pool.
+ int pos = (*iter) & (~0x1);
+ ARMWord* ldrAddr = reinterpret_cast_ptr<ARMWord*>(data + pos);
+ ARMWord* addr = getLdrImmAddress(ldrAddr);
+ if (*addr != InvalidBranchTarget) {
+ if (!(*iter & 1)) {
+ int diff = reinterpret_cast_ptr<ARMWord*>(data + *addr) - (ldrAddr + DefaultPrefetching);
+
+ if ((diff <= BOFFSET_MAX && diff >= BOFFSET_MIN)) {
+ *ldrAddr = B | getConditionalField(*ldrAddr) | (diff & BRANCH_MASK);
+ continue;
+ }
+ }
+ *addr = reinterpret_cast<ARMWord>(data + *addr);
+ }
+ }
+
+ return data;
+}
+
+} // namespace JSC
+
+#endif // ENABLE(ASSEMBLER) && CPU(ARM_TRADITIONAL)
diff --git a/Source/JavaScriptCore/assembler/ARMAssembler.h b/Source/JavaScriptCore/assembler/ARMAssembler.h
new file mode 100644
index 0000000..77ec60f
--- /dev/null
+++ b/Source/JavaScriptCore/assembler/ARMAssembler.h
@@ -0,0 +1,948 @@
+/*
+ * Copyright (C) 2009, 2010 University of Szeged
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY UNIVERSITY OF SZEGED ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL UNIVERSITY OF SZEGED OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ARMAssembler_h
+#define ARMAssembler_h
+
+#if ENABLE(ASSEMBLER) && CPU(ARM_TRADITIONAL)
+
+#include "AssemblerBufferWithConstantPool.h"
+#include <wtf/Assertions.h>
+namespace JSC {
+
+ typedef uint32_t ARMWord;
+
+ namespace ARMRegisters {
+ typedef enum {
+ r0 = 0,
+ r1,
+ r2,
+ r3, S0 = r3,
+ r4,
+ r5,
+ r6,
+ r7,
+ r8, S1 = r8,
+ r9,
+ r10,
+ r11,
+ r12,
+ r13, sp = r13,
+ r14, lr = r14,
+ r15, pc = r15
+ } RegisterID;
+
+ typedef enum {
+ d0,
+ d1,
+ d2,
+ d3, SD0 = d3,
+ d4,
+ d5,
+ d6,
+ d7,
+ d8,
+ d9,
+ d10,
+ d11,
+ d12,
+ d13,
+ d14,
+ d15,
+ d16,
+ d17,
+ d18,
+ d19,
+ d20,
+ d21,
+ d22,
+ d23,
+ d24,
+ d25,
+ d26,
+ d27,
+ d28,
+ d29,
+ d30,
+ d31
+ } FPRegisterID;
+
+ } // namespace ARMRegisters
+
+ class ARMAssembler {
+ public:
+ typedef ARMRegisters::RegisterID RegisterID;
+ typedef ARMRegisters::FPRegisterID FPRegisterID;
+ typedef AssemblerBufferWithConstantPool<2048, 4, 4, ARMAssembler> ARMBuffer;
+ typedef SegmentedVector<int, 64> Jumps;
+
+ ARMAssembler() { }
+
+ // ARM conditional constants
+ typedef enum {
+ EQ = 0x00000000, // Zero
+ NE = 0x10000000, // Non-zero
+ CS = 0x20000000,
+ CC = 0x30000000,
+ MI = 0x40000000,
+ PL = 0x50000000,
+ VS = 0x60000000,
+ VC = 0x70000000,
+ HI = 0x80000000,
+ LS = 0x90000000,
+ GE = 0xa0000000,
+ LT = 0xb0000000,
+ GT = 0xc0000000,
+ LE = 0xd0000000,
+ AL = 0xe0000000
+ } Condition;
+
+ // ARM instruction constants
+ enum {
+ AND = (0x0 << 21),
+ EOR = (0x1 << 21),
+ SUB = (0x2 << 21),
+ RSB = (0x3 << 21),
+ ADD = (0x4 << 21),
+ ADC = (0x5 << 21),
+ SBC = (0x6 << 21),
+ RSC = (0x7 << 21),
+ TST = (0x8 << 21),
+ TEQ = (0x9 << 21),
+ CMP = (0xa << 21),
+ CMN = (0xb << 21),
+ ORR = (0xc << 21),
+ MOV = (0xd << 21),
+ BIC = (0xe << 21),
+ MVN = (0xf << 21),
+ MUL = 0x00000090,
+ MULL = 0x00c00090,
+ VADD_F64 = 0x0e300b00,
+ VDIV_F64 = 0x0e800b00,
+ VSUB_F64 = 0x0e300b40,
+ VMUL_F64 = 0x0e200b00,
+ VCMP_F64 = 0x0eb40b40,
+ VSQRT_F64 = 0x0eb10bc0,
+ DTR = 0x05000000,
+ LDRH = 0x00100090,
+ STRH = 0x00000090,
+ STMDB = 0x09200000,
+ LDMIA = 0x08b00000,
+ FDTR = 0x0d000b00,
+ B = 0x0a000000,
+ BL = 0x0b000000,
+#if WTF_ARM_ARCH_AT_LEAST(5) || defined(__ARM_ARCH_4T__)
+ BX = 0x012fff10,
+#endif
+ VMOV_VFP = 0x0e000a10,
+ VMOV_ARM = 0x0e100a10,
+ VCVT_F64_S32 = 0x0eb80bc0,
+ VCVT_S32_F64 = 0x0ebd0b40,
+ VCVTR_S32_F64 = 0x0ebd0bc0,
+ VMRS_APSR = 0x0ef1fa10,
+#if WTF_ARM_ARCH_AT_LEAST(5)
+ CLZ = 0x016f0f10,
+ BKPT = 0xe1200070,
+ BLX = 0x012fff30,
+#endif
+#if WTF_ARM_ARCH_AT_LEAST(7)
+ MOVW = 0x03000000,
+ MOVT = 0x03400000,
+#endif
+ };
+
+ enum {
+ OP2_IMM = (1 << 25),
+ OP2_IMMh = (1 << 22),
+ OP2_INV_IMM = (1 << 26),
+ SET_CC = (1 << 20),
+ OP2_OFSREG = (1 << 25),
+ DT_UP = (1 << 23),
+ DT_BYTE = (1 << 22),
+ DT_WB = (1 << 21),
+ // This flag is inlcuded in LDR and STR
+ DT_PRE = (1 << 24),
+ HDT_UH = (1 << 5),
+ DT_LOAD = (1 << 20),
+ };
+
+ // Masks of ARM instructions
+ enum {
+ BRANCH_MASK = 0x00ffffff,
+ NONARM = 0xf0000000,
+ SDT_MASK = 0x0c000000,
+ SDT_OFFSET_MASK = 0xfff,
+ };
+
+ enum {
+ BOFFSET_MIN = -0x00800000,
+ BOFFSET_MAX = 0x007fffff,
+ SDT = 0x04000000,
+ };
+
+ enum {
+ padForAlign8 = 0x00,
+ padForAlign16 = 0x0000,
+ padForAlign32 = 0xe12fff7f // 'bkpt 0xffff' instruction.
+ };
+
+ static const ARMWord INVALID_IMM = 0xf0000000;
+ static const ARMWord InvalidBranchTarget = 0xffffffff;
+ static const int DefaultPrefetching = 2;
+
+ class JmpSrc {
+ friend class ARMAssembler;
+ public:
+ JmpSrc()
+ : m_offset(-1)
+ {
+ }
+
+ private:
+ JmpSrc(int offset)
+ : m_offset(offset)
+ {
+ }
+
+ int m_offset;
+ };
+
+ class JmpDst {
+ friend class ARMAssembler;
+ public:
+ JmpDst()
+ : m_offset(-1)
+ , m_used(false)
+ {
+ }
+
+ bool isUsed() const { return m_used; }
+ bool isSet() const { return (m_offset != -1); }
+ void used() { m_used = true; }
+ private:
+ JmpDst(int offset)
+ : m_offset(offset)
+ , m_used(false)
+ {
+ ASSERT(m_offset == offset);
+ }
+
+ int m_offset : 31;
+ int m_used : 1;
+ };
+
+ // Instruction formating
+
+ void emitInst(ARMWord op, int rd, int rn, ARMWord op2)
+ {
+ ASSERT(((op2 & ~OP2_IMM) <= 0xfff) || (((op2 & ~OP2_IMMh) <= 0xfff)));
+ m_buffer.putInt(op | RN(rn) | RD(rd) | op2);
+ }
+
+ void emitDoublePrecisionInst(ARMWord op, int dd, int dn, int dm)
+ {
+ ASSERT((dd >= 0 && dd <= 31) && (dn >= 0 && dn <= 31) && (dm >= 0 && dm <= 31));
+ m_buffer.putInt(op | ((dd & 0xf) << 12) | ((dd & 0x10) << (22 - 4))
+ | ((dn & 0xf) << 16) | ((dn & 0x10) << (7 - 4))
+ | (dm & 0xf) | ((dm & 0x10) << (5 - 4)));
+ }
+
+ void emitSinglePrecisionInst(ARMWord op, int sd, int sn, int sm)
+ {
+ ASSERT((sd >= 0 && sd <= 31) && (sn >= 0 && sn <= 31) && (sm >= 0 && sm <= 31));
+ m_buffer.putInt(op | ((sd >> 1) << 12) | ((sd & 0x1) << 22)
+ | ((sn >> 1) << 16) | ((sn & 0x1) << 7)
+ | (sm >> 1) | ((sm & 0x1) << 5));
+ }
+
+ void and_r(int rd, int rn, ARMWord op2, Condition cc = AL)
+ {
+ emitInst(static_cast<ARMWord>(cc) | AND, rd, rn, op2);
+ }
+
+ void ands_r(int rd, int rn, ARMWord op2, Condition cc = AL)
+ {
+ emitInst(static_cast<ARMWord>(cc) | AND | SET_CC, rd, rn, op2);
+ }
+
+ void eor_r(int rd, int rn, ARMWord op2, Condition cc = AL)
+ {
+ emitInst(static_cast<ARMWord>(cc) | EOR, rd, rn, op2);
+ }
+
+ void eors_r(int rd, int rn, ARMWord op2, Condition cc = AL)
+ {
+ emitInst(static_cast<ARMWord>(cc) | EOR | SET_CC, rd, rn, op2);
+ }
+
+ void sub_r(int rd, int rn, ARMWord op2, Condition cc = AL)
+ {
+ emitInst(static_cast<ARMWord>(cc) | SUB, rd, rn, op2);
+ }
+
+ void subs_r(int rd, int rn, ARMWord op2, Condition cc = AL)
+ {
+ emitInst(static_cast<ARMWord>(cc) | SUB | SET_CC, rd, rn, op2);
+ }
+
+ void rsb_r(int rd, int rn, ARMWord op2, Condition cc = AL)
+ {
+ emitInst(static_cast<ARMWord>(cc) | RSB, rd, rn, op2);
+ }
+
+ void rsbs_r(int rd, int rn, ARMWord op2, Condition cc = AL)
+ {
+ emitInst(static_cast<ARMWord>(cc) | RSB | SET_CC, rd, rn, op2);
+ }
+
+ void add_r(int rd, int rn, ARMWord op2, Condition cc = AL)
+ {
+ emitInst(static_cast<ARMWord>(cc) | ADD, rd, rn, op2);
+ }
+
+ void adds_r(int rd, int rn, ARMWord op2, Condition cc = AL)
+ {
+ emitInst(static_cast<ARMWord>(cc) | ADD | SET_CC, rd, rn, op2);
+ }
+
+ void adc_r(int rd, int rn, ARMWord op2, Condition cc = AL)
+ {
+ emitInst(static_cast<ARMWord>(cc) | ADC, rd, rn, op2);
+ }
+
+ void adcs_r(int rd, int rn, ARMWord op2, Condition cc = AL)
+ {
+ emitInst(static_cast<ARMWord>(cc) | ADC | SET_CC, rd, rn, op2);
+ }
+
+ void sbc_r(int rd, int rn, ARMWord op2, Condition cc = AL)
+ {
+ emitInst(static_cast<ARMWord>(cc) | SBC, rd, rn, op2);
+ }
+
+ void sbcs_r(int rd, int rn, ARMWord op2, Condition cc = AL)
+ {
+ emitInst(static_cast<ARMWord>(cc) | SBC | SET_CC, rd, rn, op2);
+ }
+
+ void rsc_r(int rd, int rn, ARMWord op2, Condition cc = AL)
+ {
+ emitInst(static_cast<ARMWord>(cc) | RSC, rd, rn, op2);
+ }
+
+ void rscs_r(int rd, int rn, ARMWord op2, Condition cc = AL)
+ {
+ emitInst(static_cast<ARMWord>(cc) | RSC | SET_CC, rd, rn, op2);
+ }
+
+ void tst_r(int rn, ARMWord op2, Condition cc = AL)
+ {
+ emitInst(static_cast<ARMWord>(cc) | TST | SET_CC, 0, rn, op2);
+ }
+
+ void teq_r(int rn, ARMWord op2, Condition cc = AL)
+ {
+ emitInst(static_cast<ARMWord>(cc) | TEQ | SET_CC, 0, rn, op2);
+ }
+
+ void cmp_r(int rn, ARMWord op2, Condition cc = AL)
+ {
+ emitInst(static_cast<ARMWord>(cc) | CMP | SET_CC, 0, rn, op2);
+ }
+
+ void cmn_r(int rn, ARMWord op2, Condition cc = AL)
+ {
+ emitInst(static_cast<ARMWord>(cc) | CMN | SET_CC, 0, rn, op2);
+ }
+
+ void orr_r(int rd, int rn, ARMWord op2, Condition cc = AL)
+ {
+ emitInst(static_cast<ARMWord>(cc) | ORR, rd, rn, op2);
+ }
+
+ void orrs_r(int rd, int rn, ARMWord op2, Condition cc = AL)
+ {
+ emitInst(static_cast<ARMWord>(cc) | ORR | SET_CC, rd, rn, op2);
+ }
+
+ void mov_r(int rd, ARMWord op2, Condition cc = AL)
+ {
+ emitInst(static_cast<ARMWord>(cc) | MOV, rd, ARMRegisters::r0, op2);
+ }
+
+#if WTF_ARM_ARCH_AT_LEAST(7)
+ void movw_r(int rd, ARMWord op2, Condition cc = AL)
+ {
+ ASSERT((op2 | 0xf0fff) == 0xf0fff);
+ m_buffer.putInt(static_cast<ARMWord>(cc) | MOVW | RD(rd) | op2);
+ }
+
+ void movt_r(int rd, ARMWord op2, Condition cc = AL)
+ {
+ ASSERT((op2 | 0xf0fff) == 0xf0fff);
+ m_buffer.putInt(static_cast<ARMWord>(cc) | MOVT | RD(rd) | op2);
+ }
+#endif
+
+ void movs_r(int rd, ARMWord op2, Condition cc = AL)
+ {
+ emitInst(static_cast<ARMWord>(cc) | MOV | SET_CC, rd, ARMRegisters::r0, op2);
+ }
+
+ void bic_r(int rd, int rn, ARMWord op2, Condition cc = AL)
+ {
+ emitInst(static_cast<ARMWord>(cc) | BIC, rd, rn, op2);
+ }
+
+ void bics_r(int rd, int rn, ARMWord op2, Condition cc = AL)
+ {
+ emitInst(static_cast<ARMWord>(cc) | BIC | SET_CC, rd, rn, op2);
+ }
+
+ void mvn_r(int rd, ARMWord op2, Condition cc = AL)
+ {
+ emitInst(static_cast<ARMWord>(cc) | MVN, rd, ARMRegisters::r0, op2);
+ }
+
+ void mvns_r(int rd, ARMWord op2, Condition cc = AL)
+ {
+ emitInst(static_cast<ARMWord>(cc) | MVN | SET_CC, rd, ARMRegisters::r0, op2);
+ }
+
+ void mul_r(int rd, int rn, int rm, Condition cc = AL)
+ {
+ m_buffer.putInt(static_cast<ARMWord>(cc) | MUL | RN(rd) | RS(rn) | RM(rm));
+ }
+
+ void muls_r(int rd, int rn, int rm, Condition cc = AL)
+ {
+ m_buffer.putInt(static_cast<ARMWord>(cc) | MUL | SET_CC | RN(rd) | RS(rn) | RM(rm));
+ }
+
+ void mull_r(int rdhi, int rdlo, int rn, int rm, Condition cc = AL)
+ {
+ m_buffer.putInt(static_cast<ARMWord>(cc) | MULL | RN(rdhi) | RD(rdlo) | RS(rn) | RM(rm));
+ }
+
+ void vadd_f64_r(int dd, int dn, int dm, Condition cc = AL)
+ {
+ emitDoublePrecisionInst(static_cast<ARMWord>(cc) | VADD_F64, dd, dn, dm);
+ }
+
+ void vdiv_f64_r(int dd, int dn, int dm, Condition cc = AL)
+ {
+ emitDoublePrecisionInst(static_cast<ARMWord>(cc) | VDIV_F64, dd, dn, dm);
+ }
+
+ void vsub_f64_r(int dd, int dn, int dm, Condition cc = AL)
+ {
+ emitDoublePrecisionInst(static_cast<ARMWord>(cc) | VSUB_F64, dd, dn, dm);
+ }
+
+ void vmul_f64_r(int dd, int dn, int dm, Condition cc = AL)
+ {
+ emitDoublePrecisionInst(static_cast<ARMWord>(cc) | VMUL_F64, dd, dn, dm);
+ }
+
+ void vcmp_f64_r(int dd, int dm, Condition cc = AL)
+ {
+ emitDoublePrecisionInst(static_cast<ARMWord>(cc) | VCMP_F64, dd, 0, dm);
+ }
+
+ void vsqrt_f64_r(int dd, int dm, Condition cc = AL)
+ {
+ emitDoublePrecisionInst(static_cast<ARMWord>(cc) | VSQRT_F64, dd, 0, dm);
+ }
+
+ void ldr_imm(int rd, ARMWord imm, Condition cc = AL)
+ {
+ m_buffer.putIntWithConstantInt(static_cast<ARMWord>(cc) | DTR | DT_LOAD | DT_UP | RN(ARMRegisters::pc) | RD(rd), imm, true);
+ }
+
+ void ldr_un_imm(int rd, ARMWord imm, Condition cc = AL)
+ {
+ m_buffer.putIntWithConstantInt(static_cast<ARMWord>(cc) | DTR | DT_LOAD | DT_UP | RN(ARMRegisters::pc) | RD(rd), imm);
+ }
+
+ void dtr_u(bool isLoad, int rd, int rb, ARMWord op2, Condition cc = AL)
+ {
+ emitInst(static_cast<ARMWord>(cc) | DTR | (isLoad ? DT_LOAD : 0) | DT_UP, rd, rb, op2);
+ }
+
+ void dtr_ur(bool isLoad, int rd, int rb, int rm, Condition cc = AL)
+ {
+ emitInst(static_cast<ARMWord>(cc) | DTR | (isLoad ? DT_LOAD : 0) | DT_UP | OP2_OFSREG, rd, rb, rm);
+ }
+
+ void dtr_d(bool isLoad, int rd, int rb, ARMWord op2, Condition cc = AL)
+ {
+ emitInst(static_cast<ARMWord>(cc) | DTR | (isLoad ? DT_LOAD : 0), rd, rb, op2);
+ }
+
+ void dtr_dr(bool isLoad, int rd, int rb, int rm, Condition cc = AL)
+ {
+ emitInst(static_cast<ARMWord>(cc) | DTR | (isLoad ? DT_LOAD : 0) | OP2_OFSREG, rd, rb, rm);
+ }
+
+ void ldrh_r(int rd, int rn, int rm, Condition cc = AL)
+ {
+ emitInst(static_cast<ARMWord>(cc) | LDRH | HDT_UH | DT_UP | DT_PRE, rd, rn, rm);
+ }
+
+ void ldrh_d(int rd, int rb, ARMWord op2, Condition cc = AL)
+ {
+ emitInst(static_cast<ARMWord>(cc) | LDRH | HDT_UH | DT_PRE, rd, rb, op2);
+ }
+
+ void ldrh_u(int rd, int rb, ARMWord op2, Condition cc = AL)
+ {
+ emitInst(static_cast<ARMWord>(cc) | LDRH | HDT_UH | DT_UP | DT_PRE, rd, rb, op2);
+ }
+
+ void strh_r(int rn, int rm, int rd, Condition cc = AL)
+ {
+ emitInst(static_cast<ARMWord>(cc) | STRH | HDT_UH | DT_UP | DT_PRE, rd, rn, rm);
+ }
+
+ void fdtr_u(bool isLoad, int rd, int rb, ARMWord op2, Condition cc = AL)
+ {
+ ASSERT(op2 <= 0xff);
+ emitInst(static_cast<ARMWord>(cc) | FDTR | DT_UP | (isLoad ? DT_LOAD : 0), rd, rb, op2);
+ }
+
+ void fdtr_d(bool isLoad, int rd, int rb, ARMWord op2, Condition cc = AL)
+ {
+ ASSERT(op2 <= 0xff);
+ emitInst(static_cast<ARMWord>(cc) | FDTR | (isLoad ? DT_LOAD : 0), rd, rb, op2);
+ }
+
+ void push_r(int reg, Condition cc = AL)
+ {
+ ASSERT(ARMWord(reg) <= 0xf);
+ m_buffer.putInt(cc | DTR | DT_WB | RN(ARMRegisters::sp) | RD(reg) | 0x4);
+ }
+
+ void pop_r(int reg, Condition cc = AL)
+ {
+ ASSERT(ARMWord(reg) <= 0xf);
+ m_buffer.putInt(cc | (DTR ^ DT_PRE) | DT_LOAD | DT_UP | RN(ARMRegisters::sp) | RD(reg) | 0x4);
+ }
+
+ inline void poke_r(int reg, Condition cc = AL)
+ {
+ dtr_d(false, ARMRegisters::sp, 0, reg, cc);
+ }
+
+ inline void peek_r(int reg, Condition cc = AL)
+ {
+ dtr_u(true, reg, ARMRegisters::sp, 0, cc);
+ }
+
+ void vmov_vfp_r(int sn, int rt, Condition cc = AL)
+ {
+ ASSERT(rt <= 15);
+ emitSinglePrecisionInst(static_cast<ARMWord>(cc) | VMOV_VFP, rt << 1, sn, 0);
+ }
+
+ void vmov_arm_r(int rt, int sn, Condition cc = AL)
+ {
+ ASSERT(rt <= 15);
+ emitSinglePrecisionInst(static_cast<ARMWord>(cc) | VMOV_ARM, rt << 1, sn, 0);
+ }
+
+ void vcvt_f64_s32_r(int dd, int sm, Condition cc = AL)
+ {
+ ASSERT(!(sm & 0x1)); // sm must be divisible by 2
+ emitDoublePrecisionInst(static_cast<ARMWord>(cc) | VCVT_F64_S32, dd, 0, (sm >> 1));
+ }
+
+ void vcvt_s32_f64_r(int sd, int dm, Condition cc = AL)
+ {
+ ASSERT(!(sd & 0x1)); // sd must be divisible by 2
+ emitDoublePrecisionInst(static_cast<ARMWord>(cc) | VCVT_S32_F64, (sd >> 1), 0, dm);
+ }
+
+ void vcvtr_s32_f64_r(int sd, int dm, Condition cc = AL)
+ {
+ ASSERT(!(sd & 0x1)); // sd must be divisible by 2
+ emitDoublePrecisionInst(static_cast<ARMWord>(cc) | VCVTR_S32_F64, (sd >> 1), 0, dm);
+ }
+
+ void vmrs_apsr(Condition cc = AL)
+ {
+ m_buffer.putInt(static_cast<ARMWord>(cc) | VMRS_APSR);
+ }
+
+#if WTF_ARM_ARCH_AT_LEAST(5)
+ void clz_r(int rd, int rm, Condition cc = AL)
+ {
+ m_buffer.putInt(static_cast<ARMWord>(cc) | CLZ | RD(rd) | RM(rm));
+ }
+#endif
+
+ void bkpt(ARMWord value)
+ {
+#if WTF_ARM_ARCH_AT_LEAST(5)
+ m_buffer.putInt(BKPT | ((value & 0xff0) << 4) | (value & 0xf));
+#else
+ // Cannot access to Zero memory address
+ dtr_dr(true, ARMRegisters::S0, ARMRegisters::S0, ARMRegisters::S0);
+#endif
+ }
+
+ void bx(int rm, Condition cc = AL)
+ {
+#if WTF_ARM_ARCH_AT_LEAST(5) || defined(__ARM_ARCH_4T__)
+ emitInst(static_cast<ARMWord>(cc) | BX, 0, 0, RM(rm));
+#else
+ mov_r(ARMRegisters::pc, RM(rm), cc);
+#endif
+ }
+
+ JmpSrc blx(int rm, Condition cc = AL)
+ {
+#if WTF_ARM_ARCH_AT_LEAST(5)
+ emitInst(static_cast<ARMWord>(cc) | BLX, 0, 0, RM(rm));
+#else
+ ASSERT(rm != 14);
+ ensureSpace(2 * sizeof(ARMWord), 0);
+ mov_r(ARMRegisters::lr, ARMRegisters::pc, cc);
+ bx(rm, cc);
+#endif
+ return JmpSrc(m_buffer.uncheckedSize());
+ }
+
+ static ARMWord lsl(int reg, ARMWord value)
+ {
+ ASSERT(reg <= ARMRegisters::pc);
+ ASSERT(value <= 0x1f);
+ return reg | (value << 7) | 0x00;
+ }
+
+ static ARMWord lsr(int reg, ARMWord value)
+ {
+ ASSERT(reg <= ARMRegisters::pc);
+ ASSERT(value <= 0x1f);
+ return reg | (value << 7) | 0x20;
+ }
+
+ static ARMWord asr(int reg, ARMWord value)
+ {
+ ASSERT(reg <= ARMRegisters::pc);
+ ASSERT(value <= 0x1f);
+ return reg | (value << 7) | 0x40;
+ }
+
+ static ARMWord lsl_r(int reg, int shiftReg)
+ {
+ ASSERT(reg <= ARMRegisters::pc);
+ ASSERT(shiftReg <= ARMRegisters::pc);
+ return reg | (shiftReg << 8) | 0x10;
+ }
+
+ static ARMWord lsr_r(int reg, int shiftReg)
+ {
+ ASSERT(reg <= ARMRegisters::pc);
+ ASSERT(shiftReg <= ARMRegisters::pc);
+ return reg | (shiftReg << 8) | 0x30;
+ }
+
+ static ARMWord asr_r(int reg, int shiftReg)
+ {
+ ASSERT(reg <= ARMRegisters::pc);
+ ASSERT(shiftReg <= ARMRegisters::pc);
+ return reg | (shiftReg << 8) | 0x50;
+ }
+
+ // General helpers
+
+ int size()
+ {
+ return m_buffer.size();
+ }
+
+ void ensureSpace(int insnSpace, int constSpace)
+ {
+ m_buffer.ensureSpace(insnSpace, constSpace);
+ }
+
+ int sizeOfConstantPool()
+ {
+ return m_buffer.sizeOfConstantPool();
+ }
+
+ JmpDst label()
+ {
+ return JmpDst(m_buffer.size());
+ }
+
+ JmpDst align(int alignment)
+ {
+ while (!m_buffer.isAligned(alignment))
+ mov_r(ARMRegisters::r0, ARMRegisters::r0);
+
+ return label();
+ }
+
+ JmpSrc loadBranchTarget(int rd, Condition cc = AL, int useConstantPool = 0)
+ {
+ ensureSpace(sizeof(ARMWord), sizeof(ARMWord));
+ m_jumps.append(m_buffer.uncheckedSize() | (useConstantPool & 0x1));
+ ldr_un_imm(rd, InvalidBranchTarget, cc);
+ return JmpSrc(m_buffer.uncheckedSize());
+ }
+
+ JmpSrc jmp(Condition cc = AL, int useConstantPool = 0)
+ {
+ return loadBranchTarget(ARMRegisters::pc, cc, useConstantPool);
+ }
+
+ void* executableCopy(ExecutablePool* allocator);
+
+ // Patching helpers
+
+ static ARMWord* getLdrImmAddress(ARMWord* insn)
+ {
+#if WTF_ARM_ARCH_AT_LEAST(5)
+ // Check for call
+ if ((*insn & 0x0f7f0000) != 0x051f0000) {
+ // Must be BLX
+ ASSERT((*insn & 0x012fff30) == 0x012fff30);
+ insn--;
+ }
+#endif
+ // Must be an ldr ..., [pc +/- imm]
+ ASSERT((*insn & 0x0f7f0000) == 0x051f0000);
+
+ ARMWord addr = reinterpret_cast<ARMWord>(insn) + DefaultPrefetching * sizeof(ARMWord);
+ if (*insn & DT_UP)
+ return reinterpret_cast<ARMWord*>(addr + (*insn & SDT_OFFSET_MASK));
+ return reinterpret_cast<ARMWord*>(addr - (*insn & SDT_OFFSET_MASK));
+ }
+
+ static ARMWord* getLdrImmAddressOnPool(ARMWord* insn, uint32_t* constPool)
+ {
+ // Must be an ldr ..., [pc +/- imm]
+ ASSERT((*insn & 0x0f7f0000) == 0x051f0000);
+
+ if (*insn & 0x1)
+ return reinterpret_cast<ARMWord*>(constPool + ((*insn & SDT_OFFSET_MASK) >> 1));
+ return getLdrImmAddress(insn);
+ }
+
+ static void patchPointerInternal(intptr_t from, void* to)
+ {
+ ARMWord* insn = reinterpret_cast<ARMWord*>(from);
+ ARMWord* addr = getLdrImmAddress(insn);
+ *addr = reinterpret_cast<ARMWord>(to);
+ }
+
+ static ARMWord patchConstantPoolLoad(ARMWord load, ARMWord value)
+ {
+ value = (value << 1) + 1;
+ ASSERT(!(value & ~0xfff));
+ return (load & ~0xfff) | value;
+ }
+
+ static void patchConstantPoolLoad(void* loadAddr, void* constPoolAddr);
+
+ // Patch pointers
+
+ static void linkPointer(void* code, JmpDst from, void* to)
+ {
+ patchPointerInternal(reinterpret_cast<intptr_t>(code) + from.m_offset, to);
+ }
+
+ static void repatchInt32(void* from, int32_t to)
+ {
+ patchPointerInternal(reinterpret_cast<intptr_t>(from), reinterpret_cast<void*>(to));
+ }
+
+ static void repatchPointer(void* from, void* to)
+ {
+ patchPointerInternal(reinterpret_cast<intptr_t>(from), to);
+ }
+
+ static void repatchLoadPtrToLEA(void* from)
+ {
+ // On arm, this is a patch from LDR to ADD. It is restricted conversion,
+ // from special case to special case, altough enough for its purpose
+ ARMWord* insn = reinterpret_cast<ARMWord*>(from);
+ ASSERT((*insn & 0x0ff00f00) == 0x05900000);
+
+ *insn = (*insn & 0xf00ff0ff) | 0x02800000;
+ ExecutableAllocator::cacheFlush(insn, sizeof(ARMWord));
+ }
+
+ // Linkers
+ static intptr_t getAbsoluteJumpAddress(void* base, int offset = 0)
+ {
+ return reinterpret_cast<intptr_t>(base) + offset - sizeof(ARMWord);
+ }
+
+ void linkJump(JmpSrc from, JmpDst to)
+ {
+ ARMWord* insn = reinterpret_cast<ARMWord*>(getAbsoluteJumpAddress(m_buffer.data(), from.m_offset));
+ ARMWord* addr = getLdrImmAddressOnPool(insn, m_buffer.poolAddress());
+ *addr = static_cast<ARMWord>(to.m_offset);
+ }
+
+ static void linkJump(void* code, JmpSrc from, void* to)
+ {
+ patchPointerInternal(getAbsoluteJumpAddress(code, from.m_offset), to);
+ }
+
+ static void relinkJump(void* from, void* to)
+ {
+ patchPointerInternal(getAbsoluteJumpAddress(from), to);
+ }
+
+ static void linkCall(void* code, JmpSrc from, void* to)
+ {
+ patchPointerInternal(getAbsoluteJumpAddress(code, from.m_offset), to);
+ }
+
+ static void relinkCall(void* from, void* to)
+ {
+ patchPointerInternal(getAbsoluteJumpAddress(from), to);
+ }
+
+ // Address operations
+
+ static void* getRelocatedAddress(void* code, JmpSrc jump)
+ {
+ return reinterpret_cast<void*>(reinterpret_cast<char*>(code) + jump.m_offset);
+ }
+
+ static void* getRelocatedAddress(void* code, JmpDst label)
+ {
+ return reinterpret_cast<void*>(reinterpret_cast<char*>(code) + label.m_offset);
+ }
+
+ // Address differences
+
+ static int getDifferenceBetweenLabels(JmpDst from, JmpSrc to)
+ {
+ return to.m_offset - from.m_offset;
+ }
+
+ static int getDifferenceBetweenLabels(JmpDst from, JmpDst to)
+ {
+ return to.m_offset - from.m_offset;
+ }
+
+ static unsigned getCallReturnOffset(JmpSrc call)
+ {
+ return call.m_offset;
+ }
+
+ // Handle immediates
+
+ static ARMWord getOp2Byte(ARMWord imm)
+ {
+ ASSERT(imm <= 0xff);
+ return OP2_IMMh | (imm & 0x0f) | ((imm & 0xf0) << 4) ;
+ }
+
+ static ARMWord getOp2(ARMWord imm);
+
+#if WTF_ARM_ARCH_AT_LEAST(7)
+ static ARMWord getImm16Op2(ARMWord imm)
+ {
+ if (imm <= 0xffff)
+ return (imm & 0xf000) << 4 | (imm & 0xfff);
+ return INVALID_IMM;
+ }
+#endif
+ ARMWord getImm(ARMWord imm, int tmpReg, bool invert = false);
+ void moveImm(ARMWord imm, int dest);
+ ARMWord encodeComplexImm(ARMWord imm, int dest);
+
+ ARMWord getOffsetForHalfwordDataTransfer(ARMWord imm, int tmpReg)
+ {
+ // Encode immediate data in the instruction if it is possible
+ if (imm <= 0xff)
+ return getOp2Byte(imm);
+ // Otherwise, store the data in a temporary register
+ return encodeComplexImm(imm, tmpReg);
+ }
+
+ // Memory load/store helpers
+
+ void dataTransfer32(bool isLoad, RegisterID srcDst, RegisterID base, int32_t offset, bool bytes = false);
+ void baseIndexTransfer32(bool isLoad, RegisterID srcDst, RegisterID base, RegisterID index, int scale, int32_t offset);
+ void doubleTransfer(bool isLoad, FPRegisterID srcDst, RegisterID base, int32_t offset);
+
+ // Constant pool hnadlers
+
+ static ARMWord placeConstantPoolBarrier(int offset)
+ {
+ offset = (offset - sizeof(ARMWord)) >> 2;
+ ASSERT((offset <= BOFFSET_MAX && offset >= BOFFSET_MIN));
+ return AL | B | (offset & BRANCH_MASK);
+ }
+
+ private:
+ ARMWord RM(int reg)
+ {
+ ASSERT(reg <= ARMRegisters::pc);
+ return reg;
+ }
+
+ ARMWord RS(int reg)
+ {
+ ASSERT(reg <= ARMRegisters::pc);
+ return reg << 8;
+ }
+
+ ARMWord RD(int reg)
+ {
+ ASSERT(reg <= ARMRegisters::pc);
+ return reg << 12;
+ }
+
+ ARMWord RN(int reg)
+ {
+ ASSERT(reg <= ARMRegisters::pc);
+ return reg << 16;
+ }
+
+ static ARMWord getConditionalField(ARMWord i)
+ {
+ return i & 0xf0000000;
+ }
+
+ int genInt(int reg, ARMWord imm, bool positive);
+
+ ARMBuffer m_buffer;
+ Jumps m_jumps;
+ };
+
+} // namespace JSC
+
+#endif // ENABLE(ASSEMBLER) && CPU(ARM_TRADITIONAL)
+
+#endif // ARMAssembler_h
diff --git a/Source/JavaScriptCore/assembler/ARMv7Assembler.cpp b/Source/JavaScriptCore/assembler/ARMv7Assembler.cpp
new file mode 100644
index 0000000..7aa1f10
--- /dev/null
+++ b/Source/JavaScriptCore/assembler/ARMv7Assembler.cpp
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if ENABLE(ASSEMBLER) && CPU(ARM_THUMB2)
+
+#include "ARMv7Assembler.h"
+
+namespace JSC {
+
+const int ARMv7Assembler::JumpSizes[] = { 0xffffffff, sizeof(uint16_t), sizeof(uint16_t),
+ 2 * sizeof(uint16_t), 2 * sizeof(uint16_t), 3 * sizeof(uint16_t), 5 * sizeof(uint16_t), 6 * sizeof(uint16_t) };
+const int ARMv7Assembler::JumpPaddingSizes[] = { 0, 5 * sizeof(uint16_t), 6 * sizeof(uint16_t),
+ 5 * sizeof(uint16_t), 6 * sizeof(uint16_t) };
+
+}
+
+#endif
diff --git a/Source/JavaScriptCore/assembler/ARMv7Assembler.h b/Source/JavaScriptCore/assembler/ARMv7Assembler.h
new file mode 100644
index 0000000..f584883
--- /dev/null
+++ b/Source/JavaScriptCore/assembler/ARMv7Assembler.h
@@ -0,0 +1,2358 @@
+/*
+ * Copyright (C) 2009, 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010 University of Szeged
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ARMAssembler_h
+#define ARMAssembler_h
+
+#if ENABLE(ASSEMBLER) && CPU(ARM_THUMB2)
+
+#include "AssemblerBuffer.h"
+#include <wtf/Assertions.h>
+#include <wtf/Vector.h>
+#include <stdint.h>
+
+namespace JSC {
+
+namespace ARMRegisters {
+ typedef enum {
+ r0,
+ r1,
+ r2,
+ r3,
+ r4,
+ r5,
+ r6,
+ r7, wr = r7, // thumb work register
+ r8,
+ r9, sb = r9, // static base
+ r10, sl = r10, // stack limit
+ r11, fp = r11, // frame pointer
+ r12, ip = r12,
+ r13, sp = r13,
+ r14, lr = r14,
+ r15, pc = r15,
+ } RegisterID;
+
+ typedef enum {
+ s0,
+ s1,
+ s2,
+ s3,
+ s4,
+ s5,
+ s6,
+ s7,
+ s8,
+ s9,
+ s10,
+ s11,
+ s12,
+ s13,
+ s14,
+ s15,
+ s16,
+ s17,
+ s18,
+ s19,
+ s20,
+ s21,
+ s22,
+ s23,
+ s24,
+ s25,
+ s26,
+ s27,
+ s28,
+ s29,
+ s30,
+ s31,
+ } FPSingleRegisterID;
+
+ typedef enum {
+ d0,
+ d1,
+ d2,
+ d3,
+ d4,
+ d5,
+ d6,
+ d7,
+ d8,
+ d9,
+ d10,
+ d11,
+ d12,
+ d13,
+ d14,
+ d15,
+ d16,
+ d17,
+ d18,
+ d19,
+ d20,
+ d21,
+ d22,
+ d23,
+ d24,
+ d25,
+ d26,
+ d27,
+ d28,
+ d29,
+ d30,
+ d31,
+ } FPDoubleRegisterID;
+
+ typedef enum {
+ q0,
+ q1,
+ q2,
+ q3,
+ q4,
+ q5,
+ q6,
+ q7,
+ q8,
+ q9,
+ q10,
+ q11,
+ q12,
+ q13,
+ q14,
+ q15,
+ q16,
+ q17,
+ q18,
+ q19,
+ q20,
+ q21,
+ q22,
+ q23,
+ q24,
+ q25,
+ q26,
+ q27,
+ q28,
+ q29,
+ q30,
+ q31,
+ } FPQuadRegisterID;
+
+ inline FPSingleRegisterID asSingle(FPDoubleRegisterID reg)
+ {
+ ASSERT(reg < d16);
+ return (FPSingleRegisterID)(reg << 1);
+ }
+
+ inline FPDoubleRegisterID asDouble(FPSingleRegisterID reg)
+ {
+ ASSERT(!(reg & 1));
+ return (FPDoubleRegisterID)(reg >> 1);
+ }
+}
+
+class ARMv7Assembler;
+class ARMThumbImmediate {
+ friend class ARMv7Assembler;
+
+ typedef uint8_t ThumbImmediateType;
+ static const ThumbImmediateType TypeInvalid = 0;
+ static const ThumbImmediateType TypeEncoded = 1;
+ static const ThumbImmediateType TypeUInt16 = 2;
+
+ typedef union {
+ int16_t asInt;
+ struct {
+ unsigned imm8 : 8;
+ unsigned imm3 : 3;
+ unsigned i : 1;
+ unsigned imm4 : 4;
+ };
+ // If this is an encoded immediate, then it may describe a shift, or a pattern.
+ struct {
+ unsigned shiftValue7 : 7;
+ unsigned shiftAmount : 5;
+ };
+ struct {
+ unsigned immediate : 8;
+ unsigned pattern : 4;
+ };
+ } ThumbImmediateValue;
+
+ // byte0 contains least significant bit; not using an array to make client code endian agnostic.
+ typedef union {
+ int32_t asInt;
+ struct {
+ uint8_t byte0;
+ uint8_t byte1;
+ uint8_t byte2;
+ uint8_t byte3;
+ };
+ } PatternBytes;
+
+ ALWAYS_INLINE static void countLeadingZerosPartial(uint32_t& value, int32_t& zeros, const int N)
+ {
+ if (value & ~((1 << N) - 1)) /* check for any of the top N bits (of 2N bits) are set */
+ value >>= N; /* if any were set, lose the bottom N */
+ else /* if none of the top N bits are set, */
+ zeros += N; /* then we have identified N leading zeros */
+ }
+
+ static int32_t countLeadingZeros(uint32_t value)
+ {
+ if (!value)
+ return 32;
+
+ int32_t zeros = 0;
+ countLeadingZerosPartial(value, zeros, 16);
+ countLeadingZerosPartial(value, zeros, 8);
+ countLeadingZerosPartial(value, zeros, 4);
+ countLeadingZerosPartial(value, zeros, 2);
+ countLeadingZerosPartial(value, zeros, 1);
+ return zeros;
+ }
+
+ ARMThumbImmediate()
+ : m_type(TypeInvalid)
+ {
+ m_value.asInt = 0;
+ }
+
+ ARMThumbImmediate(ThumbImmediateType type, ThumbImmediateValue value)
+ : m_type(type)
+ , m_value(value)
+ {
+ }
+
+ ARMThumbImmediate(ThumbImmediateType type, uint16_t value)
+ : m_type(TypeUInt16)
+ {
+ // Make sure this constructor is only reached with type TypeUInt16;
+ // this extra parameter makes the code a little clearer by making it
+ // explicit at call sites which type is being constructed
+ ASSERT_UNUSED(type, type == TypeUInt16);
+
+ m_value.asInt = value;
+ }
+
+public:
+ static ARMThumbImmediate makeEncodedImm(uint32_t value)
+ {
+ ThumbImmediateValue encoding;
+ encoding.asInt = 0;
+
+ // okay, these are easy.
+ if (value < 256) {
+ encoding.immediate = value;
+ encoding.pattern = 0;
+ return ARMThumbImmediate(TypeEncoded, encoding);
+ }
+
+ int32_t leadingZeros = countLeadingZeros(value);
+ // if there were 24 or more leading zeros, then we'd have hit the (value < 256) case.
+ ASSERT(leadingZeros < 24);
+
+ // Given a number with bit fields Z:B:C, where count(Z)+count(B)+count(C) == 32,
+ // Z are the bits known zero, B is the 8-bit immediate, C are the bits to check for
+ // zero. count(B) == 8, so the count of bits to be checked is 24 - count(Z).
+ int32_t rightShiftAmount = 24 - leadingZeros;
+ if (value == ((value >> rightShiftAmount) << rightShiftAmount)) {
+ // Shift the value down to the low byte position. The assign to
+ // shiftValue7 drops the implicit top bit.
+ encoding.shiftValue7 = value >> rightShiftAmount;
+ // The endoded shift amount is the magnitude of a right rotate.
+ encoding.shiftAmount = 8 + leadingZeros;
+ return ARMThumbImmediate(TypeEncoded, encoding);
+ }
+
+ PatternBytes bytes;
+ bytes.asInt = value;
+
+ if ((bytes.byte0 == bytes.byte1) && (bytes.byte0 == bytes.byte2) && (bytes.byte0 == bytes.byte3)) {
+ encoding.immediate = bytes.byte0;
+ encoding.pattern = 3;
+ return ARMThumbImmediate(TypeEncoded, encoding);
+ }
+
+ if ((bytes.byte0 == bytes.byte2) && !(bytes.byte1 | bytes.byte3)) {
+ encoding.immediate = bytes.byte0;
+ encoding.pattern = 1;
+ return ARMThumbImmediate(TypeEncoded, encoding);
+ }
+
+ if ((bytes.byte1 == bytes.byte3) && !(bytes.byte0 | bytes.byte2)) {
+ encoding.immediate = bytes.byte1;
+ encoding.pattern = 2;
+ return ARMThumbImmediate(TypeEncoded, encoding);
+ }
+
+ return ARMThumbImmediate();
+ }
+
+ static ARMThumbImmediate makeUInt12(int32_t value)
+ {
+ return (!(value & 0xfffff000))
+ ? ARMThumbImmediate(TypeUInt16, (uint16_t)value)
+ : ARMThumbImmediate();
+ }
+
+ static ARMThumbImmediate makeUInt12OrEncodedImm(int32_t value)
+ {
+ // If this is not a 12-bit unsigned it, try making an encoded immediate.
+ return (!(value & 0xfffff000))
+ ? ARMThumbImmediate(TypeUInt16, (uint16_t)value)
+ : makeEncodedImm(value);
+ }
+
+ // The 'make' methods, above, return a !isValid() value if the argument
+ // cannot be represented as the requested type. This methods is called
+ // 'get' since the argument can always be represented.
+ static ARMThumbImmediate makeUInt16(uint16_t value)
+ {
+ return ARMThumbImmediate(TypeUInt16, value);
+ }
+
+ bool isValid()
+ {
+ return m_type != TypeInvalid;
+ }
+
+ // These methods rely on the format of encoded byte values.
+ bool isUInt3() { return !(m_value.asInt & 0xfff8); }
+ bool isUInt4() { return !(m_value.asInt & 0xfff0); }
+ bool isUInt5() { return !(m_value.asInt & 0xffe0); }
+ bool isUInt6() { return !(m_value.asInt & 0xffc0); }
+ bool isUInt7() { return !(m_value.asInt & 0xff80); }
+ bool isUInt8() { return !(m_value.asInt & 0xff00); }
+ bool isUInt9() { return (m_type == TypeUInt16) && !(m_value.asInt & 0xfe00); }
+ bool isUInt10() { return (m_type == TypeUInt16) && !(m_value.asInt & 0xfc00); }
+ bool isUInt12() { return (m_type == TypeUInt16) && !(m_value.asInt & 0xf000); }
+ bool isUInt16() { return m_type == TypeUInt16; }
+ uint8_t getUInt3() { ASSERT(isUInt3()); return m_value.asInt; }
+ uint8_t getUInt4() { ASSERT(isUInt4()); return m_value.asInt; }
+ uint8_t getUInt5() { ASSERT(isUInt5()); return m_value.asInt; }
+ uint8_t getUInt6() { ASSERT(isUInt6()); return m_value.asInt; }
+ uint8_t getUInt7() { ASSERT(isUInt7()); return m_value.asInt; }
+ uint8_t getUInt8() { ASSERT(isUInt8()); return m_value.asInt; }
+ uint8_t getUInt9() { ASSERT(isUInt9()); return m_value.asInt; }
+ uint8_t getUInt10() { ASSERT(isUInt10()); return m_value.asInt; }
+ uint16_t getUInt12() { ASSERT(isUInt12()); return m_value.asInt; }
+ uint16_t getUInt16() { ASSERT(isUInt16()); return m_value.asInt; }
+
+ bool isEncodedImm() { return m_type == TypeEncoded; }
+
+private:
+ ThumbImmediateType m_type;
+ ThumbImmediateValue m_value;
+};
+
+class VFPImmediate {
+public:
+ VFPImmediate(double d)
+ : m_value(-1)
+ {
+ union {
+ uint64_t i;
+ double d;
+ } u;
+
+ u.d = d;
+
+ int sign = static_cast<int>(u.i >> 63);
+ int exponent = static_cast<int>(u.i >> 52) & 0x7ff;
+ uint64_t mantissa = u.i & 0x000fffffffffffffull;
+
+ if ((exponent >= 0x3fc) && (exponent <= 0x403) && !(mantissa & 0x0000ffffffffffffull))
+ m_value = (sign << 7) | ((exponent & 7) << 4) | (int)(mantissa >> 48);
+ }
+
+ bool isValid()
+ {
+ return m_value != -1;
+ }
+
+ uint8_t value()
+ {
+ return (uint8_t)m_value;
+ }
+
+private:
+ int m_value;
+};
+
+typedef enum {
+ SRType_LSL,
+ SRType_LSR,
+ SRType_ASR,
+ SRType_ROR,
+
+ SRType_RRX = SRType_ROR
+} ARMShiftType;
+
+class ARMv7Assembler;
+class ShiftTypeAndAmount {
+ friend class ARMv7Assembler;
+
+public:
+ ShiftTypeAndAmount()
+ {
+ m_u.type = (ARMShiftType)0;
+ m_u.amount = 0;
+ }
+
+ ShiftTypeAndAmount(ARMShiftType type, unsigned amount)
+ {
+ m_u.type = type;
+ m_u.amount = amount & 31;
+ }
+
+ unsigned lo4() { return m_u.lo4; }
+ unsigned hi4() { return m_u.hi4; }
+
+private:
+ union {
+ struct {
+ unsigned lo4 : 4;
+ unsigned hi4 : 4;
+ };
+ struct {
+ unsigned type : 2;
+ unsigned amount : 6;
+ };
+ } m_u;
+};
+
+class ARMv7Assembler {
+public:
+ ~ARMv7Assembler()
+ {
+ ASSERT(m_jumpsToLink.isEmpty());
+ }
+
+ typedef ARMRegisters::RegisterID RegisterID;
+ typedef ARMRegisters::FPSingleRegisterID FPSingleRegisterID;
+ typedef ARMRegisters::FPDoubleRegisterID FPDoubleRegisterID;
+ typedef ARMRegisters::FPQuadRegisterID FPQuadRegisterID;
+
+ // (HS, LO, HI, LS) -> (AE, B, A, BE)
+ // (VS, VC) -> (O, NO)
+ typedef enum {
+ ConditionEQ,
+ ConditionNE,
+ ConditionHS, ConditionCS = ConditionHS,
+ ConditionLO, ConditionCC = ConditionLO,
+ ConditionMI,
+ ConditionPL,
+ ConditionVS,
+ ConditionVC,
+ ConditionHI,
+ ConditionLS,
+ ConditionGE,
+ ConditionLT,
+ ConditionGT,
+ ConditionLE,
+ ConditionAL,
+ ConditionInvalid
+ } Condition;
+
+ enum JumpType { JumpFixed, JumpNoCondition, JumpCondition, JumpNoConditionFixedSize, JumpConditionFixedSize, JumpTypeCount };
+ enum JumpLinkType { LinkInvalid, LinkJumpT1, LinkJumpT2, LinkJumpT3,
+ LinkJumpT4, LinkConditionalJumpT4, LinkBX, LinkConditionalBX, JumpLinkTypeCount };
+ static const int JumpSizes[JumpLinkTypeCount];
+ static const int JumpPaddingSizes[JumpTypeCount];
+ class LinkRecord {
+ public:
+ LinkRecord(intptr_t from, intptr_t to, JumpType type, Condition condition)
+ : m_from(from)
+ , m_to(to)
+ , m_type(type)
+ , m_linkType(LinkInvalid)
+ , m_condition(condition)
+ {
+ }
+ intptr_t from() const { return m_from; }
+ void setFrom(intptr_t from) { m_from = from; }
+ intptr_t to() const { return m_to; }
+ JumpType type() const { return m_type; }
+ JumpLinkType linkType() const { return m_linkType; }
+ void setLinkType(JumpLinkType linkType) { ASSERT(m_linkType == LinkInvalid); m_linkType = linkType; }
+ Condition condition() const { return m_condition; }
+ private:
+ intptr_t m_from : 31;
+ intptr_t m_to : 31;
+ JumpType m_type : 3;
+ JumpLinkType m_linkType : 4;
+ Condition m_condition : 16;
+ };
+
+ class JmpSrc {
+ friend class ARMv7Assembler;
+ friend class ARMInstructionFormatter;
+ friend class LinkBuffer;
+ public:
+ JmpSrc()
+ : m_offset(-1)
+ {
+ }
+
+ private:
+ JmpSrc(int offset, JumpType type)
+ : m_offset(offset)
+ , m_condition(ConditionInvalid)
+ , m_type(type)
+ {
+ ASSERT(m_type == JumpFixed || m_type == JumpNoCondition || m_type == JumpNoConditionFixedSize);
+ }
+
+ JmpSrc(int offset, JumpType type, Condition condition)
+ : m_offset(offset)
+ , m_condition(condition)
+ , m_type(type)
+ {
+ ASSERT(m_type == JumpFixed || m_type == JumpCondition || m_type == JumpConditionFixedSize);
+ }
+
+ int m_offset;
+ Condition m_condition : 16;
+ JumpType m_type : 16;
+
+ };
+
+ class JmpDst {
+ friend class ARMv7Assembler;
+ friend class ARMInstructionFormatter;
+ friend class LinkBuffer;
+ public:
+ JmpDst()
+ : m_offset(-1)
+ , m_used(false)
+ {
+ }
+
+ bool isUsed() const { return m_used; }
+ bool isSet() const { return (m_offset != -1); }
+ void used() { m_used = true; }
+ private:
+ JmpDst(int offset)
+ : m_offset(offset)
+ , m_used(false)
+ {
+ ASSERT(m_offset == offset);
+ }
+
+ int m_offset : 31;
+ int m_used : 1;
+ };
+
+private:
+
+ // ARMv7, Appx-A.6.3
+ bool BadReg(RegisterID reg)
+ {
+ return (reg == ARMRegisters::sp) || (reg == ARMRegisters::pc);
+ }
+
+ uint32_t singleRegisterMask(FPSingleRegisterID rdNum, int highBitsShift, int lowBitShift)
+ {
+ uint32_t rdMask = (rdNum >> 1) << highBitsShift;
+ if (rdNum & 1)
+ rdMask |= 1 << lowBitShift;
+ return rdMask;
+ }
+
+ uint32_t doubleRegisterMask(FPDoubleRegisterID rdNum, int highBitShift, int lowBitsShift)
+ {
+ uint32_t rdMask = (rdNum & 0xf) << lowBitsShift;
+ if (rdNum & 16)
+ rdMask |= 1 << highBitShift;
+ return rdMask;
+ }
+
+ typedef enum {
+ OP_ADD_reg_T1 = 0x1800,
+ OP_SUB_reg_T1 = 0x1A00,
+ OP_ADD_imm_T1 = 0x1C00,
+ OP_SUB_imm_T1 = 0x1E00,
+ OP_MOV_imm_T1 = 0x2000,
+ OP_CMP_imm_T1 = 0x2800,
+ OP_ADD_imm_T2 = 0x3000,
+ OP_SUB_imm_T2 = 0x3800,
+ OP_AND_reg_T1 = 0x4000,
+ OP_EOR_reg_T1 = 0x4040,
+ OP_TST_reg_T1 = 0x4200,
+ OP_RSB_imm_T1 = 0x4240,
+ OP_CMP_reg_T1 = 0x4280,
+ OP_ORR_reg_T1 = 0x4300,
+ OP_MVN_reg_T1 = 0x43C0,
+ OP_ADD_reg_T2 = 0x4400,
+ OP_MOV_reg_T1 = 0x4600,
+ OP_BLX = 0x4700,
+ OP_BX = 0x4700,
+ OP_STR_reg_T1 = 0x5000,
+ OP_LDR_reg_T1 = 0x5800,
+ OP_LDRH_reg_T1 = 0x5A00,
+ OP_LDRB_reg_T1 = 0x5C00,
+ OP_STR_imm_T1 = 0x6000,
+ OP_LDR_imm_T1 = 0x6800,
+ OP_LDRB_imm_T1 = 0x7800,
+ OP_LDRH_imm_T1 = 0x8800,
+ OP_STR_imm_T2 = 0x9000,
+ OP_LDR_imm_T2 = 0x9800,
+ OP_ADD_SP_imm_T1 = 0xA800,
+ OP_ADD_SP_imm_T2 = 0xB000,
+ OP_SUB_SP_imm_T1 = 0xB080,
+ OP_BKPT = 0xBE00,
+ OP_IT = 0xBF00,
+ OP_NOP_T1 = 0xBF00,
+ } OpcodeID;
+
+ typedef enum {
+ OP_B_T1 = 0xD000,
+ OP_B_T2 = 0xE000,
+ OP_AND_reg_T2 = 0xEA00,
+ OP_TST_reg_T2 = 0xEA10,
+ OP_ORR_reg_T2 = 0xEA40,
+ OP_ORR_S_reg_T2 = 0xEA50,
+ OP_ASR_imm_T1 = 0xEA4F,
+ OP_LSL_imm_T1 = 0xEA4F,
+ OP_LSR_imm_T1 = 0xEA4F,
+ OP_ROR_imm_T1 = 0xEA4F,
+ OP_MVN_reg_T2 = 0xEA6F,
+ OP_EOR_reg_T2 = 0xEA80,
+ OP_ADD_reg_T3 = 0xEB00,
+ OP_ADD_S_reg_T3 = 0xEB10,
+ OP_SUB_reg_T2 = 0xEBA0,
+ OP_SUB_S_reg_T2 = 0xEBB0,
+ OP_CMP_reg_T2 = 0xEBB0,
+ OP_VSTR = 0xED00,
+ OP_VLDR = 0xED10,
+ OP_VMOV_StoC = 0xEE00,
+ OP_VMOV_CtoS = 0xEE10,
+ OP_VMUL_T2 = 0xEE20,
+ OP_VADD_T2 = 0xEE30,
+ OP_VSUB_T2 = 0xEE30,
+ OP_VDIV = 0xEE80,
+ OP_VCMP = 0xEEB0,
+ OP_VCVT_FPIVFP = 0xEEB0,
+ OP_VMOV_IMM_T2 = 0xEEB0,
+ OP_VMRS = 0xEEB0,
+ OP_B_T3a = 0xF000,
+ OP_B_T4a = 0xF000,
+ OP_AND_imm_T1 = 0xF000,
+ OP_TST_imm = 0xF010,
+ OP_ORR_imm_T1 = 0xF040,
+ OP_MOV_imm_T2 = 0xF040,
+ OP_MVN_imm = 0xF060,
+ OP_EOR_imm_T1 = 0xF080,
+ OP_ADD_imm_T3 = 0xF100,
+ OP_ADD_S_imm_T3 = 0xF110,
+ OP_CMN_imm = 0xF110,
+ OP_SUB_imm_T3 = 0xF1A0,
+ OP_SUB_S_imm_T3 = 0xF1B0,
+ OP_CMP_imm_T2 = 0xF1B0,
+ OP_RSB_imm_T2 = 0xF1C0,
+ OP_ADD_imm_T4 = 0xF200,
+ OP_MOV_imm_T3 = 0xF240,
+ OP_SUB_imm_T4 = 0xF2A0,
+ OP_MOVT = 0xF2C0,
+ OP_NOP_T2a = 0xF3AF,
+ OP_LDRB_imm_T3 = 0xF810,
+ OP_LDRB_reg_T2 = 0xF810,
+ OP_LDRH_reg_T2 = 0xF830,
+ OP_LDRH_imm_T3 = 0xF830,
+ OP_STR_imm_T4 = 0xF840,
+ OP_STR_reg_T2 = 0xF840,
+ OP_LDR_imm_T4 = 0xF850,
+ OP_LDR_reg_T2 = 0xF850,
+ OP_LDRB_imm_T2 = 0xF890,
+ OP_LDRH_imm_T2 = 0xF8B0,
+ OP_STR_imm_T3 = 0xF8C0,
+ OP_LDR_imm_T3 = 0xF8D0,
+ OP_LSL_reg_T2 = 0xFA00,
+ OP_LSR_reg_T2 = 0xFA20,
+ OP_ASR_reg_T2 = 0xFA40,
+ OP_ROR_reg_T2 = 0xFA60,
+ OP_CLZ = 0xFAB0,
+ OP_SMULL_T1 = 0xFB80,
+ } OpcodeID1;
+
+ typedef enum {
+ OP_VADD_T2b = 0x0A00,
+ OP_VDIVb = 0x0A00,
+ OP_VLDRb = 0x0A00,
+ OP_VMOV_IMM_T2b = 0x0A00,
+ OP_VMUL_T2b = 0x0A00,
+ OP_VSTRb = 0x0A00,
+ OP_VMOV_CtoSb = 0x0A10,
+ OP_VMOV_StoCb = 0x0A10,
+ OP_VMRSb = 0x0A10,
+ OP_VCMPb = 0x0A40,
+ OP_VCVT_FPIVFPb = 0x0A40,
+ OP_VSUB_T2b = 0x0A40,
+ OP_NOP_T2b = 0x8000,
+ OP_B_T3b = 0x8000,
+ OP_B_T4b = 0x9000,
+ } OpcodeID2;
+
+ struct FourFours {
+ FourFours(unsigned f3, unsigned f2, unsigned f1, unsigned f0)
+ {
+ m_u.f0 = f0;
+ m_u.f1 = f1;
+ m_u.f2 = f2;
+ m_u.f3 = f3;
+ }
+
+ union {
+ unsigned value;
+ struct {
+ unsigned f0 : 4;
+ unsigned f1 : 4;
+ unsigned f2 : 4;
+ unsigned f3 : 4;
+ };
+ } m_u;
+ };
+
+ class ARMInstructionFormatter;
+
+ // false means else!
+ bool ifThenElseConditionBit(Condition condition, bool isIf)
+ {
+ return isIf ? (condition & 1) : !(condition & 1);
+ }
+ uint8_t ifThenElse(Condition condition, bool inst2if, bool inst3if, bool inst4if)
+ {
+ int mask = (ifThenElseConditionBit(condition, inst2if) << 3)
+ | (ifThenElseConditionBit(condition, inst3if) << 2)
+ | (ifThenElseConditionBit(condition, inst4if) << 1)
+ | 1;
+ ASSERT((condition != ConditionAL) || !(mask & (mask - 1)));
+ return (condition << 4) | mask;
+ }
+ uint8_t ifThenElse(Condition condition, bool inst2if, bool inst3if)
+ {
+ int mask = (ifThenElseConditionBit(condition, inst2if) << 3)
+ | (ifThenElseConditionBit(condition, inst3if) << 2)
+ | 2;
+ ASSERT((condition != ConditionAL) || !(mask & (mask - 1)));
+ return (condition << 4) | mask;
+ }
+ uint8_t ifThenElse(Condition condition, bool inst2if)
+ {
+ int mask = (ifThenElseConditionBit(condition, inst2if) << 3)
+ | 4;
+ ASSERT((condition != ConditionAL) || !(mask & (mask - 1)));
+ return (condition << 4) | mask;
+ }
+
+ uint8_t ifThenElse(Condition condition)
+ {
+ int mask = 8;
+ return (condition << 4) | mask;
+ }
+
+public:
+
+ void add(RegisterID rd, RegisterID rn, ARMThumbImmediate imm)
+ {
+ // Rd can only be SP if Rn is also SP.
+ ASSERT((rd != ARMRegisters::sp) || (rn == ARMRegisters::sp));
+ ASSERT(rd != ARMRegisters::pc);
+ ASSERT(rn != ARMRegisters::pc);
+ ASSERT(imm.isValid());
+
+ if (rn == ARMRegisters::sp) {
+ if (!(rd & 8) && imm.isUInt10()) {
+ m_formatter.oneWordOp5Reg3Imm8(OP_ADD_SP_imm_T1, rd, imm.getUInt10() >> 2);
+ return;
+ } else if ((rd == ARMRegisters::sp) && imm.isUInt9()) {
+ m_formatter.oneWordOp9Imm7(OP_ADD_SP_imm_T2, imm.getUInt9() >> 2);
+ return;
+ }
+ } else if (!((rd | rn) & 8)) {
+ if (imm.isUInt3()) {
+ m_formatter.oneWordOp7Reg3Reg3Reg3(OP_ADD_imm_T1, (RegisterID)imm.getUInt3(), rn, rd);
+ return;
+ } else if ((rd == rn) && imm.isUInt8()) {
+ m_formatter.oneWordOp5Reg3Imm8(OP_ADD_imm_T2, rd, imm.getUInt8());
+ return;
+ }
+ }
+
+ if (imm.isEncodedImm())
+ m_formatter.twoWordOp5i6Imm4Reg4EncodedImm(OP_ADD_imm_T3, rn, rd, imm);
+ else {
+ ASSERT(imm.isUInt12());
+ m_formatter.twoWordOp5i6Imm4Reg4EncodedImm(OP_ADD_imm_T4, rn, rd, imm);
+ }
+ }
+
+ void add(RegisterID rd, RegisterID rn, RegisterID rm, ShiftTypeAndAmount shift)
+ {
+ ASSERT((rd != ARMRegisters::sp) || (rn == ARMRegisters::sp));
+ ASSERT(rd != ARMRegisters::pc);
+ ASSERT(rn != ARMRegisters::pc);
+ ASSERT(!BadReg(rm));
+ m_formatter.twoWordOp12Reg4FourFours(OP_ADD_reg_T3, rn, FourFours(shift.hi4(), rd, shift.lo4(), rm));
+ }
+
+ // NOTE: In an IT block, add doesn't modify the flags register.
+ void add(RegisterID rd, RegisterID rn, RegisterID rm)
+ {
+ if (rd == rn)
+ m_formatter.oneWordOp8RegReg143(OP_ADD_reg_T2, rm, rd);
+ else if (rd == rm)
+ m_formatter.oneWordOp8RegReg143(OP_ADD_reg_T2, rn, rd);
+ else if (!((rd | rn | rm) & 8))
+ m_formatter.oneWordOp7Reg3Reg3Reg3(OP_ADD_reg_T1, rm, rn, rd);
+ else
+ add(rd, rn, rm, ShiftTypeAndAmount());
+ }
+
+ // Not allowed in an IT (if then) block.
+ void add_S(RegisterID rd, RegisterID rn, ARMThumbImmediate imm)
+ {
+ // Rd can only be SP if Rn is also SP.
+ ASSERT((rd != ARMRegisters::sp) || (rn == ARMRegisters::sp));
+ ASSERT(rd != ARMRegisters::pc);
+ ASSERT(rn != ARMRegisters::pc);
+ ASSERT(imm.isEncodedImm());
+
+ if (!((rd | rn) & 8)) {
+ if (imm.isUInt3()) {
+ m_formatter.oneWordOp7Reg3Reg3Reg3(OP_ADD_imm_T1, (RegisterID)imm.getUInt3(), rn, rd);
+ return;
+ } else if ((rd == rn) && imm.isUInt8()) {
+ m_formatter.oneWordOp5Reg3Imm8(OP_ADD_imm_T2, rd, imm.getUInt8());
+ return;
+ }
+ }
+
+ m_formatter.twoWordOp5i6Imm4Reg4EncodedImm(OP_ADD_S_imm_T3, rn, rd, imm);
+ }
+
+ // Not allowed in an IT (if then) block?
+ void add_S(RegisterID rd, RegisterID rn, RegisterID rm, ShiftTypeAndAmount shift)
+ {
+ ASSERT((rd != ARMRegisters::sp) || (rn == ARMRegisters::sp));
+ ASSERT(rd != ARMRegisters::pc);
+ ASSERT(rn != ARMRegisters::pc);
+ ASSERT(!BadReg(rm));
+ m_formatter.twoWordOp12Reg4FourFours(OP_ADD_S_reg_T3, rn, FourFours(shift.hi4(), rd, shift.lo4(), rm));
+ }
+
+ // Not allowed in an IT (if then) block.
+ void add_S(RegisterID rd, RegisterID rn, RegisterID rm)
+ {
+ if (!((rd | rn | rm) & 8))
+ m_formatter.oneWordOp7Reg3Reg3Reg3(OP_ADD_reg_T1, rm, rn, rd);
+ else
+ add_S(rd, rn, rm, ShiftTypeAndAmount());
+ }
+
+ void ARM_and(RegisterID rd, RegisterID rn, ARMThumbImmediate imm)
+ {
+ ASSERT(!BadReg(rd));
+ ASSERT(!BadReg(rn));
+ ASSERT(imm.isEncodedImm());
+ m_formatter.twoWordOp5i6Imm4Reg4EncodedImm(OP_AND_imm_T1, rn, rd, imm);
+ }
+
+ void ARM_and(RegisterID rd, RegisterID rn, RegisterID rm, ShiftTypeAndAmount shift)
+ {
+ ASSERT(!BadReg(rd));
+ ASSERT(!BadReg(rn));
+ ASSERT(!BadReg(rm));
+ m_formatter.twoWordOp12Reg4FourFours(OP_AND_reg_T2, rn, FourFours(shift.hi4(), rd, shift.lo4(), rm));
+ }
+
+ void ARM_and(RegisterID rd, RegisterID rn, RegisterID rm)
+ {
+ if ((rd == rn) && !((rd | rm) & 8))
+ m_formatter.oneWordOp10Reg3Reg3(OP_AND_reg_T1, rm, rd);
+ else if ((rd == rm) && !((rd | rn) & 8))
+ m_formatter.oneWordOp10Reg3Reg3(OP_AND_reg_T1, rn, rd);
+ else
+ ARM_and(rd, rn, rm, ShiftTypeAndAmount());
+ }
+
+ void asr(RegisterID rd, RegisterID rm, int32_t shiftAmount)
+ {
+ ASSERT(!BadReg(rd));
+ ASSERT(!BadReg(rm));
+ ShiftTypeAndAmount shift(SRType_ASR, shiftAmount);
+ m_formatter.twoWordOp16FourFours(OP_ASR_imm_T1, FourFours(shift.hi4(), rd, shift.lo4(), rm));
+ }
+
+ void asr(RegisterID rd, RegisterID rn, RegisterID rm)
+ {
+ ASSERT(!BadReg(rd));
+ ASSERT(!BadReg(rn));
+ ASSERT(!BadReg(rm));
+ m_formatter.twoWordOp12Reg4FourFours(OP_ASR_reg_T2, rn, FourFours(0xf, rd, 0, rm));
+ }
+
+ // Only allowed in IT (if then) block if last instruction.
+ JmpSrc b(JumpType type)
+ {
+ m_formatter.twoWordOp16Op16(OP_B_T4a, OP_B_T4b);
+ return JmpSrc(m_formatter.size(), type);
+ }
+
+ // Only allowed in IT (if then) block if last instruction.
+ JmpSrc blx(RegisterID rm, JumpType type)
+ {
+ ASSERT(rm != ARMRegisters::pc);
+ m_formatter.oneWordOp8RegReg143(OP_BLX, rm, (RegisterID)8);
+ return JmpSrc(m_formatter.size(), type);
+ }
+
+ // Only allowed in IT (if then) block if last instruction.
+ JmpSrc bx(RegisterID rm, JumpType type, Condition condition)
+ {
+ m_formatter.oneWordOp8RegReg143(OP_BX, rm, (RegisterID)0);
+ return JmpSrc(m_formatter.size(), type, condition);
+ }
+
+ JmpSrc bx(RegisterID rm, JumpType type)
+ {
+ m_formatter.oneWordOp8RegReg143(OP_BX, rm, (RegisterID)0);
+ return JmpSrc(m_formatter.size(), type);
+ }
+
+ void bkpt(uint8_t imm=0)
+ {
+ m_formatter.oneWordOp8Imm8(OP_BKPT, imm);
+ }
+
+ void clz(RegisterID rd, RegisterID rm)
+ {
+ ASSERT(!BadReg(rd));
+ ASSERT(!BadReg(rm));
+ m_formatter.twoWordOp12Reg4FourFours(OP_CLZ, rm, FourFours(0xf, rd, 8, rm));
+ }
+
+ void cmn(RegisterID rn, ARMThumbImmediate imm)
+ {
+ ASSERT(rn != ARMRegisters::pc);
+ ASSERT(imm.isEncodedImm());
+
+ m_formatter.twoWordOp5i6Imm4Reg4EncodedImm(OP_CMN_imm, rn, (RegisterID)0xf, imm);
+ }
+
+ void cmp(RegisterID rn, ARMThumbImmediate imm)
+ {
+ ASSERT(rn != ARMRegisters::pc);
+ ASSERT(imm.isEncodedImm());
+
+ if (!(rn & 8) && imm.isUInt8())
+ m_formatter.oneWordOp5Reg3Imm8(OP_CMP_imm_T1, rn, imm.getUInt8());
+ else
+ m_formatter.twoWordOp5i6Imm4Reg4EncodedImm(OP_CMP_imm_T2, rn, (RegisterID)0xf, imm);
+ }
+
+ void cmp(RegisterID rn, RegisterID rm, ShiftTypeAndAmount shift)
+ {
+ ASSERT(rn != ARMRegisters::pc);
+ ASSERT(!BadReg(rm));
+ m_formatter.twoWordOp12Reg4FourFours(OP_CMP_reg_T2, rn, FourFours(shift.hi4(), 0xf, shift.lo4(), rm));
+ }
+
+ void cmp(RegisterID rn, RegisterID rm)
+ {
+ if ((rn | rm) & 8)
+ cmp(rn, rm, ShiftTypeAndAmount());
+ else
+ m_formatter.oneWordOp10Reg3Reg3(OP_CMP_reg_T1, rm, rn);
+ }
+
+ // xor is not spelled with an 'e'. :-(
+ void eor(RegisterID rd, RegisterID rn, ARMThumbImmediate imm)
+ {
+ ASSERT(!BadReg(rd));
+ ASSERT(!BadReg(rn));
+ ASSERT(imm.isEncodedImm());
+ m_formatter.twoWordOp5i6Imm4Reg4EncodedImm(OP_EOR_imm_T1, rn, rd, imm);
+ }
+
+ // xor is not spelled with an 'e'. :-(
+ void eor(RegisterID rd, RegisterID rn, RegisterID rm, ShiftTypeAndAmount shift)
+ {
+ ASSERT(!BadReg(rd));
+ ASSERT(!BadReg(rn));
+ ASSERT(!BadReg(rm));
+ m_formatter.twoWordOp12Reg4FourFours(OP_EOR_reg_T2, rn, FourFours(shift.hi4(), rd, shift.lo4(), rm));
+ }
+
+ // xor is not spelled with an 'e'. :-(
+ void eor(RegisterID rd, RegisterID rn, RegisterID rm)
+ {
+ if ((rd == rn) && !((rd | rm) & 8))
+ m_formatter.oneWordOp10Reg3Reg3(OP_EOR_reg_T1, rm, rd);
+ else if ((rd == rm) && !((rd | rn) & 8))
+ m_formatter.oneWordOp10Reg3Reg3(OP_EOR_reg_T1, rn, rd);
+ else
+ eor(rd, rn, rm, ShiftTypeAndAmount());
+ }
+
+ void it(Condition cond)
+ {
+ m_formatter.oneWordOp8Imm8(OP_IT, ifThenElse(cond));
+ }
+
+ void it(Condition cond, bool inst2if)
+ {
+ m_formatter.oneWordOp8Imm8(OP_IT, ifThenElse(cond, inst2if));
+ }
+
+ void it(Condition cond, bool inst2if, bool inst3if)
+ {
+ m_formatter.oneWordOp8Imm8(OP_IT, ifThenElse(cond, inst2if, inst3if));
+ }
+
+ void it(Condition cond, bool inst2if, bool inst3if, bool inst4if)
+ {
+ m_formatter.oneWordOp8Imm8(OP_IT, ifThenElse(cond, inst2if, inst3if, inst4if));
+ }
+
+ // rt == ARMRegisters::pc only allowed if last instruction in IT (if then) block.
+ void ldr(RegisterID rt, RegisterID rn, ARMThumbImmediate imm)
+ {
+ ASSERT(rn != ARMRegisters::pc); // LDR (literal)
+ ASSERT(imm.isUInt12());
+
+ if (!((rt | rn) & 8) && imm.isUInt7())
+ m_formatter.oneWordOp5Imm5Reg3Reg3(OP_LDR_imm_T1, imm.getUInt7() >> 2, rn, rt);
+ else if ((rn == ARMRegisters::sp) && !(rt & 8) && imm.isUInt10())
+ m_formatter.oneWordOp5Reg3Imm8(OP_LDR_imm_T2, rt, imm.getUInt10() >> 2);
+ else
+ m_formatter.twoWordOp12Reg4Reg4Imm12(OP_LDR_imm_T3, rn, rt, imm.getUInt12());
+ }
+
+ // If index is set, this is a regular offset or a pre-indexed load;
+ // if index is not set then is is a post-index load.
+ //
+ // If wback is set rn is updated - this is a pre or post index load,
+ // if wback is not set this is a regular offset memory access.
+ //
+ // (-255 <= offset <= 255)
+ // _reg = REG[rn]
+ // _tmp = _reg + offset
+ // MEM[index ? _tmp : _reg] = REG[rt]
+ // if (wback) REG[rn] = _tmp
+ void ldr(RegisterID rt, RegisterID rn, int offset, bool index, bool wback)
+ {
+ ASSERT(rt != ARMRegisters::pc);
+ ASSERT(rn != ARMRegisters::pc);
+ ASSERT(index || wback);
+ ASSERT(!wback | (rt != rn));
+
+ bool add = true;
+ if (offset < 0) {
+ add = false;
+ offset = -offset;
+ }
+ ASSERT((offset & ~0xff) == 0);
+
+ offset |= (wback << 8);
+ offset |= (add << 9);
+ offset |= (index << 10);
+ offset |= (1 << 11);
+
+ m_formatter.twoWordOp12Reg4Reg4Imm12(OP_LDR_imm_T4, rn, rt, offset);
+ }
+
+ // rt == ARMRegisters::pc only allowed if last instruction in IT (if then) block.
+ void ldr(RegisterID rt, RegisterID rn, RegisterID rm, unsigned shift=0)
+ {
+ ASSERT(rn != ARMRegisters::pc); // LDR (literal)
+ ASSERT(!BadReg(rm));
+ ASSERT(shift <= 3);
+
+ if (!shift && !((rt | rn | rm) & 8))
+ m_formatter.oneWordOp7Reg3Reg3Reg3(OP_LDR_reg_T1, rm, rn, rt);
+ else
+ m_formatter.twoWordOp12Reg4FourFours(OP_LDR_reg_T2, rn, FourFours(rt, 0, shift, rm));
+ }
+
+ // rt == ARMRegisters::pc only allowed if last instruction in IT (if then) block.
+ void ldrh(RegisterID rt, RegisterID rn, ARMThumbImmediate imm)
+ {
+ ASSERT(rn != ARMRegisters::pc); // LDR (literal)
+ ASSERT(imm.isUInt12());
+
+ if (!((rt | rn) & 8) && imm.isUInt6())
+ m_formatter.oneWordOp5Imm5Reg3Reg3(OP_LDRH_imm_T1, imm.getUInt6() >> 2, rn, rt);
+ else
+ m_formatter.twoWordOp12Reg4Reg4Imm12(OP_LDRH_imm_T2, rn, rt, imm.getUInt12());
+ }
+
+ // If index is set, this is a regular offset or a pre-indexed load;
+ // if index is not set then is is a post-index load.
+ //
+ // If wback is set rn is updated - this is a pre or post index load,
+ // if wback is not set this is a regular offset memory access.
+ //
+ // (-255 <= offset <= 255)
+ // _reg = REG[rn]
+ // _tmp = _reg + offset
+ // MEM[index ? _tmp : _reg] = REG[rt]
+ // if (wback) REG[rn] = _tmp
+ void ldrh(RegisterID rt, RegisterID rn, int offset, bool index, bool wback)
+ {
+ ASSERT(rt != ARMRegisters::pc);
+ ASSERT(rn != ARMRegisters::pc);
+ ASSERT(index || wback);
+ ASSERT(!wback | (rt != rn));
+
+ bool add = true;
+ if (offset < 0) {
+ add = false;
+ offset = -offset;
+ }
+ ASSERT((offset & ~0xff) == 0);
+
+ offset |= (wback << 8);
+ offset |= (add << 9);
+ offset |= (index << 10);
+ offset |= (1 << 11);
+
+ m_formatter.twoWordOp12Reg4Reg4Imm12(OP_LDRH_imm_T3, rn, rt, offset);
+ }
+
+ void ldrh(RegisterID rt, RegisterID rn, RegisterID rm, unsigned shift=0)
+ {
+ ASSERT(!BadReg(rt)); // Memory hint
+ ASSERT(rn != ARMRegisters::pc); // LDRH (literal)
+ ASSERT(!BadReg(rm));
+ ASSERT(shift <= 3);
+
+ if (!shift && !((rt | rn | rm) & 8))
+ m_formatter.oneWordOp7Reg3Reg3Reg3(OP_LDRH_reg_T1, rm, rn, rt);
+ else
+ m_formatter.twoWordOp12Reg4FourFours(OP_LDRH_reg_T2, rn, FourFours(rt, 0, shift, rm));
+ }
+
+ void ldrb(RegisterID rt, RegisterID rn, ARMThumbImmediate imm)
+ {
+ ASSERT(rn != ARMRegisters::pc); // LDR (literal)
+ ASSERT(imm.isUInt12());
+
+ if (!((rt | rn) & 8) && imm.isUInt5())
+ m_formatter.oneWordOp5Imm5Reg3Reg3(OP_LDRB_imm_T1, imm.getUInt5(), rn, rt);
+ else
+ m_formatter.twoWordOp12Reg4Reg4Imm12(OP_LDRB_imm_T2, rn, rt, imm.getUInt12());
+ }
+
+ void ldrb(RegisterID rt, RegisterID rn, int offset, bool index, bool wback)
+ {
+ ASSERT(rt != ARMRegisters::pc);
+ ASSERT(rn != ARMRegisters::pc);
+ ASSERT(index || wback);
+ ASSERT(!wback | (rt != rn));
+
+ bool add = true;
+ if (offset < 0) {
+ add = false;
+ offset = -offset;
+ }
+
+ ASSERT(!(offset & ~0xff));
+
+ offset |= (wback << 8);
+ offset |= (add << 9);
+ offset |= (index << 10);
+ offset |= (1 << 11);
+
+ m_formatter.twoWordOp12Reg4Reg4Imm12(OP_LDRB_imm_T3, rn, rt, offset);
+ }
+
+ void ldrb(RegisterID rt, RegisterID rn, RegisterID rm, unsigned shift = 0)
+ {
+ ASSERT(rn != ARMRegisters::pc); // LDR (literal)
+ ASSERT(!BadReg(rm));
+ ASSERT(shift <= 3);
+
+ if (!shift && !((rt | rn | rm) & 8))
+ m_formatter.oneWordOp7Reg3Reg3Reg3(OP_LDRB_reg_T1, rm, rn, rt);
+ else
+ m_formatter.twoWordOp12Reg4FourFours(OP_LDRB_reg_T2, rn, FourFours(rt, 0, shift, rm));
+ }
+
+ void lsl(RegisterID rd, RegisterID rm, int32_t shiftAmount)
+ {
+ ASSERT(!BadReg(rd));
+ ASSERT(!BadReg(rm));
+ ShiftTypeAndAmount shift(SRType_LSL, shiftAmount);
+ m_formatter.twoWordOp16FourFours(OP_LSL_imm_T1, FourFours(shift.hi4(), rd, shift.lo4(), rm));
+ }
+
+ void lsl(RegisterID rd, RegisterID rn, RegisterID rm)
+ {
+ ASSERT(!BadReg(rd));
+ ASSERT(!BadReg(rn));
+ ASSERT(!BadReg(rm));
+ m_formatter.twoWordOp12Reg4FourFours(OP_LSL_reg_T2, rn, FourFours(0xf, rd, 0, rm));
+ }
+
+ void lsr(RegisterID rd, RegisterID rm, int32_t shiftAmount)
+ {
+ ASSERT(!BadReg(rd));
+ ASSERT(!BadReg(rm));
+ ShiftTypeAndAmount shift(SRType_LSR, shiftAmount);
+ m_formatter.twoWordOp16FourFours(OP_LSR_imm_T1, FourFours(shift.hi4(), rd, shift.lo4(), rm));
+ }
+
+ void lsr(RegisterID rd, RegisterID rn, RegisterID rm)
+ {
+ ASSERT(!BadReg(rd));
+ ASSERT(!BadReg(rn));
+ ASSERT(!BadReg(rm));
+ m_formatter.twoWordOp12Reg4FourFours(OP_LSR_reg_T2, rn, FourFours(0xf, rd, 0, rm));
+ }
+
+ void movT3(RegisterID rd, ARMThumbImmediate imm)
+ {
+ ASSERT(imm.isValid());
+ ASSERT(!imm.isEncodedImm());
+ ASSERT(!BadReg(rd));
+
+ m_formatter.twoWordOp5i6Imm4Reg4EncodedImm(OP_MOV_imm_T3, imm.m_value.imm4, rd, imm);
+ }
+
+ void mov(RegisterID rd, ARMThumbImmediate imm)
+ {
+ ASSERT(imm.isValid());
+ ASSERT(!BadReg(rd));
+
+ if ((rd < 8) && imm.isUInt8())
+ m_formatter.oneWordOp5Reg3Imm8(OP_MOV_imm_T1, rd, imm.getUInt8());
+ else if (imm.isEncodedImm())
+ m_formatter.twoWordOp5i6Imm4Reg4EncodedImm(OP_MOV_imm_T2, 0xf, rd, imm);
+ else
+ movT3(rd, imm);
+ }
+
+ void mov(RegisterID rd, RegisterID rm)
+ {
+ m_formatter.oneWordOp8RegReg143(OP_MOV_reg_T1, rm, rd);
+ }
+
+ void movt(RegisterID rd, ARMThumbImmediate imm)
+ {
+ ASSERT(imm.isUInt16());
+ ASSERT(!BadReg(rd));
+ m_formatter.twoWordOp5i6Imm4Reg4EncodedImm(OP_MOVT, imm.m_value.imm4, rd, imm);
+ }
+
+ void mvn(RegisterID rd, ARMThumbImmediate imm)
+ {
+ ASSERT(imm.isEncodedImm());
+ ASSERT(!BadReg(rd));
+
+ m_formatter.twoWordOp5i6Imm4Reg4EncodedImm(OP_MVN_imm, 0xf, rd, imm);
+ }
+
+ void mvn(RegisterID rd, RegisterID rm, ShiftTypeAndAmount shift)
+ {
+ ASSERT(!BadReg(rd));
+ ASSERT(!BadReg(rm));
+ m_formatter.twoWordOp16FourFours(OP_MVN_reg_T2, FourFours(shift.hi4(), rd, shift.lo4(), rm));
+ }
+
+ void mvn(RegisterID rd, RegisterID rm)
+ {
+ if (!((rd | rm) & 8))
+ m_formatter.oneWordOp10Reg3Reg3(OP_MVN_reg_T1, rm, rd);
+ else
+ mvn(rd, rm, ShiftTypeAndAmount());
+ }
+
+ void neg(RegisterID rd, RegisterID rm)
+ {
+ ARMThumbImmediate zero = ARMThumbImmediate::makeUInt12(0);
+ sub(rd, zero, rm);
+ }
+
+ void orr(RegisterID rd, RegisterID rn, ARMThumbImmediate imm)
+ {
+ ASSERT(!BadReg(rd));
+ ASSERT(!BadReg(rn));
+ ASSERT(imm.isEncodedImm());
+ m_formatter.twoWordOp5i6Imm4Reg4EncodedImm(OP_ORR_imm_T1, rn, rd, imm);
+ }
+
+ void orr(RegisterID rd, RegisterID rn, RegisterID rm, ShiftTypeAndAmount shift)
+ {
+ ASSERT(!BadReg(rd));
+ ASSERT(!BadReg(rn));
+ ASSERT(!BadReg(rm));
+ m_formatter.twoWordOp12Reg4FourFours(OP_ORR_reg_T2, rn, FourFours(shift.hi4(), rd, shift.lo4(), rm));
+ }
+
+ void orr(RegisterID rd, RegisterID rn, RegisterID rm)
+ {
+ if ((rd == rn) && !((rd | rm) & 8))
+ m_formatter.oneWordOp10Reg3Reg3(OP_ORR_reg_T1, rm, rd);
+ else if ((rd == rm) && !((rd | rn) & 8))
+ m_formatter.oneWordOp10Reg3Reg3(OP_ORR_reg_T1, rn, rd);
+ else
+ orr(rd, rn, rm, ShiftTypeAndAmount());
+ }
+
+ void orr_S(RegisterID rd, RegisterID rn, RegisterID rm, ShiftTypeAndAmount shift)
+ {
+ ASSERT(!BadReg(rd));
+ ASSERT(!BadReg(rn));
+ ASSERT(!BadReg(rm));
+ m_formatter.twoWordOp12Reg4FourFours(OP_ORR_S_reg_T2, rn, FourFours(shift.hi4(), rd, shift.lo4(), rm));
+ }
+
+ void orr_S(RegisterID rd, RegisterID rn, RegisterID rm)
+ {
+ if ((rd == rn) && !((rd | rm) & 8))
+ m_formatter.oneWordOp10Reg3Reg3(OP_ORR_reg_T1, rm, rd);
+ else if ((rd == rm) && !((rd | rn) & 8))
+ m_formatter.oneWordOp10Reg3Reg3(OP_ORR_reg_T1, rn, rd);
+ else
+ orr_S(rd, rn, rm, ShiftTypeAndAmount());
+ }
+
+ void ror(RegisterID rd, RegisterID rm, int32_t shiftAmount)
+ {
+ ASSERT(!BadReg(rd));
+ ASSERT(!BadReg(rm));
+ ShiftTypeAndAmount shift(SRType_ROR, shiftAmount);
+ m_formatter.twoWordOp16FourFours(OP_ROR_imm_T1, FourFours(shift.hi4(), rd, shift.lo4(), rm));
+ }
+
+ void ror(RegisterID rd, RegisterID rn, RegisterID rm)
+ {
+ ASSERT(!BadReg(rd));
+ ASSERT(!BadReg(rn));
+ ASSERT(!BadReg(rm));
+ m_formatter.twoWordOp12Reg4FourFours(OP_ROR_reg_T2, rn, FourFours(0xf, rd, 0, rm));
+ }
+
+ void smull(RegisterID rdLo, RegisterID rdHi, RegisterID rn, RegisterID rm)
+ {
+ ASSERT(!BadReg(rdLo));
+ ASSERT(!BadReg(rdHi));
+ ASSERT(!BadReg(rn));
+ ASSERT(!BadReg(rm));
+ ASSERT(rdLo != rdHi);
+ m_formatter.twoWordOp12Reg4FourFours(OP_SMULL_T1, rn, FourFours(rdLo, rdHi, 0, rm));
+ }
+
+ // rt == ARMRegisters::pc only allowed if last instruction in IT (if then) block.
+ void str(RegisterID rt, RegisterID rn, ARMThumbImmediate imm)
+ {
+ ASSERT(rt != ARMRegisters::pc);
+ ASSERT(rn != ARMRegisters::pc);
+ ASSERT(imm.isUInt12());
+
+ if (!((rt | rn) & 8) && imm.isUInt7())
+ m_formatter.oneWordOp5Imm5Reg3Reg3(OP_STR_imm_T1, imm.getUInt7() >> 2, rn, rt);
+ else if ((rn == ARMRegisters::sp) && !(rt & 8) && imm.isUInt10())
+ m_formatter.oneWordOp5Reg3Imm8(OP_STR_imm_T2, rt, imm.getUInt10() >> 2);
+ else
+ m_formatter.twoWordOp12Reg4Reg4Imm12(OP_STR_imm_T3, rn, rt, imm.getUInt12());
+ }
+
+ // If index is set, this is a regular offset or a pre-indexed store;
+ // if index is not set then is is a post-index store.
+ //
+ // If wback is set rn is updated - this is a pre or post index store,
+ // if wback is not set this is a regular offset memory access.
+ //
+ // (-255 <= offset <= 255)
+ // _reg = REG[rn]
+ // _tmp = _reg + offset
+ // MEM[index ? _tmp : _reg] = REG[rt]
+ // if (wback) REG[rn] = _tmp
+ void str(RegisterID rt, RegisterID rn, int offset, bool index, bool wback)
+ {
+ ASSERT(rt != ARMRegisters::pc);
+ ASSERT(rn != ARMRegisters::pc);
+ ASSERT(index || wback);
+ ASSERT(!wback | (rt != rn));
+
+ bool add = true;
+ if (offset < 0) {
+ add = false;
+ offset = -offset;
+ }
+ ASSERT((offset & ~0xff) == 0);
+
+ offset |= (wback << 8);
+ offset |= (add << 9);
+ offset |= (index << 10);
+ offset |= (1 << 11);
+
+ m_formatter.twoWordOp12Reg4Reg4Imm12(OP_STR_imm_T4, rn, rt, offset);
+ }
+
+ // rt == ARMRegisters::pc only allowed if last instruction in IT (if then) block.
+ void str(RegisterID rt, RegisterID rn, RegisterID rm, unsigned shift=0)
+ {
+ ASSERT(rn != ARMRegisters::pc);
+ ASSERT(!BadReg(rm));
+ ASSERT(shift <= 3);
+
+ if (!shift && !((rt | rn | rm) & 8))
+ m_formatter.oneWordOp7Reg3Reg3Reg3(OP_STR_reg_T1, rm, rn, rt);
+ else
+ m_formatter.twoWordOp12Reg4FourFours(OP_STR_reg_T2, rn, FourFours(rt, 0, shift, rm));
+ }
+
+ void sub(RegisterID rd, RegisterID rn, ARMThumbImmediate imm)
+ {
+ // Rd can only be SP if Rn is also SP.
+ ASSERT((rd != ARMRegisters::sp) || (rn == ARMRegisters::sp));
+ ASSERT(rd != ARMRegisters::pc);
+ ASSERT(rn != ARMRegisters::pc);
+ ASSERT(imm.isValid());
+
+ if ((rn == ARMRegisters::sp) && (rd == ARMRegisters::sp) && imm.isUInt9()) {
+ m_formatter.oneWordOp9Imm7(OP_SUB_SP_imm_T1, imm.getUInt9() >> 2);
+ return;
+ } else if (!((rd | rn) & 8)) {
+ if (imm.isUInt3()) {
+ m_formatter.oneWordOp7Reg3Reg3Reg3(OP_SUB_imm_T1, (RegisterID)imm.getUInt3(), rn, rd);
+ return;
+ } else if ((rd == rn) && imm.isUInt8()) {
+ m_formatter.oneWordOp5Reg3Imm8(OP_SUB_imm_T2, rd, imm.getUInt8());
+ return;
+ }
+ }
+
+ if (imm.isEncodedImm())
+ m_formatter.twoWordOp5i6Imm4Reg4EncodedImm(OP_SUB_imm_T3, rn, rd, imm);
+ else {
+ ASSERT(imm.isUInt12());
+ m_formatter.twoWordOp5i6Imm4Reg4EncodedImm(OP_SUB_imm_T4, rn, rd, imm);
+ }
+ }
+
+ void sub(RegisterID rd, ARMThumbImmediate imm, RegisterID rn)
+ {
+ ASSERT(rd != ARMRegisters::pc);
+ ASSERT(rn != ARMRegisters::pc);
+ ASSERT(imm.isValid());
+ ASSERT(imm.isUInt12());
+
+ if (!((rd | rn) & 8) && !imm.getUInt12())
+ m_formatter.oneWordOp10Reg3Reg3(OP_RSB_imm_T1, rn, rd);
+ else
+ m_formatter.twoWordOp5i6Imm4Reg4EncodedImm(OP_RSB_imm_T2, rn, rd, imm);
+ }
+
+ void sub(RegisterID rd, RegisterID rn, RegisterID rm, ShiftTypeAndAmount shift)
+ {
+ ASSERT((rd != ARMRegisters::sp) || (rn == ARMRegisters::sp));
+ ASSERT(rd != ARMRegisters::pc);
+ ASSERT(rn != ARMRegisters::pc);
+ ASSERT(!BadReg(rm));
+ m_formatter.twoWordOp12Reg4FourFours(OP_SUB_reg_T2, rn, FourFours(shift.hi4(), rd, shift.lo4(), rm));
+ }
+
+ // NOTE: In an IT block, add doesn't modify the flags register.
+ void sub(RegisterID rd, RegisterID rn, RegisterID rm)
+ {
+ if (!((rd | rn | rm) & 8))
+ m_formatter.oneWordOp7Reg3Reg3Reg3(OP_SUB_reg_T1, rm, rn, rd);
+ else
+ sub(rd, rn, rm, ShiftTypeAndAmount());
+ }
+
+ // Not allowed in an IT (if then) block.
+ void sub_S(RegisterID rd, RegisterID rn, ARMThumbImmediate imm)
+ {
+ // Rd can only be SP if Rn is also SP.
+ ASSERT((rd != ARMRegisters::sp) || (rn == ARMRegisters::sp));
+ ASSERT(rd != ARMRegisters::pc);
+ ASSERT(rn != ARMRegisters::pc);
+ ASSERT(imm.isValid());
+
+ if ((rn == ARMRegisters::sp) && (rd == ARMRegisters::sp) && imm.isUInt9()) {
+ m_formatter.oneWordOp9Imm7(OP_SUB_SP_imm_T1, imm.getUInt9() >> 2);
+ return;
+ } else if (!((rd | rn) & 8)) {
+ if (imm.isUInt3()) {
+ m_formatter.oneWordOp7Reg3Reg3Reg3(OP_SUB_imm_T1, (RegisterID)imm.getUInt3(), rn, rd);
+ return;
+ } else if ((rd == rn) && imm.isUInt8()) {
+ m_formatter.oneWordOp5Reg3Imm8(OP_SUB_imm_T2, rd, imm.getUInt8());
+ return;
+ }
+ }
+
+ m_formatter.twoWordOp5i6Imm4Reg4EncodedImm(OP_SUB_S_imm_T3, rn, rd, imm);
+ }
+
+ // Not allowed in an IT (if then) block?
+ void sub_S(RegisterID rd, RegisterID rn, RegisterID rm, ShiftTypeAndAmount shift)
+ {
+ ASSERT((rd != ARMRegisters::sp) || (rn == ARMRegisters::sp));
+ ASSERT(rd != ARMRegisters::pc);
+ ASSERT(rn != ARMRegisters::pc);
+ ASSERT(!BadReg(rm));
+ m_formatter.twoWordOp12Reg4FourFours(OP_SUB_S_reg_T2, rn, FourFours(shift.hi4(), rd, shift.lo4(), rm));
+ }
+
+ // Not allowed in an IT (if then) block.
+ void sub_S(RegisterID rd, RegisterID rn, RegisterID rm)
+ {
+ if (!((rd | rn | rm) & 8))
+ m_formatter.oneWordOp7Reg3Reg3Reg3(OP_SUB_reg_T1, rm, rn, rd);
+ else
+ sub_S(rd, rn, rm, ShiftTypeAndAmount());
+ }
+
+ void tst(RegisterID rn, ARMThumbImmediate imm)
+ {
+ ASSERT(!BadReg(rn));
+ ASSERT(imm.isEncodedImm());
+
+ m_formatter.twoWordOp5i6Imm4Reg4EncodedImm(OP_TST_imm, rn, (RegisterID)0xf, imm);
+ }
+
+ void tst(RegisterID rn, RegisterID rm, ShiftTypeAndAmount shift)
+ {
+ ASSERT(!BadReg(rn));
+ ASSERT(!BadReg(rm));
+ m_formatter.twoWordOp12Reg4FourFours(OP_TST_reg_T2, rn, FourFours(shift.hi4(), 0xf, shift.lo4(), rm));
+ }
+
+ void tst(RegisterID rn, RegisterID rm)
+ {
+ if ((rn | rm) & 8)
+ tst(rn, rm, ShiftTypeAndAmount());
+ else
+ m_formatter.oneWordOp10Reg3Reg3(OP_TST_reg_T1, rm, rn);
+ }
+
+ void vadd_F64(FPDoubleRegisterID rd, FPDoubleRegisterID rn, FPDoubleRegisterID rm)
+ {
+ m_formatter.vfpOp(OP_VADD_T2, OP_VADD_T2b, true, rn, rd, rm);
+ }
+
+ void vcmp_F64(FPDoubleRegisterID rd, FPDoubleRegisterID rm)
+ {
+ m_formatter.vfpOp(OP_VCMP, OP_VCMPb, true, VFPOperand(4), rd, rm);
+ }
+
+ void vcmpz_F64(FPDoubleRegisterID rd)
+ {
+ m_formatter.vfpOp(OP_VCMP, OP_VCMPb, true, VFPOperand(5), rd, VFPOperand(0));
+ }
+
+ void vcvt_F64_S32(FPDoubleRegisterID rd, FPSingleRegisterID rm)
+ {
+ // boolean values are 64bit (toInt, unsigned, roundZero)
+ m_formatter.vfpOp(OP_VCVT_FPIVFP, OP_VCVT_FPIVFPb, true, vcvtOp(false, false, false), rd, rm);
+ }
+
+ void vcvtr_S32_F64(FPSingleRegisterID rd, FPDoubleRegisterID rm)
+ {
+ // boolean values are 64bit (toInt, unsigned, roundZero)
+ m_formatter.vfpOp(OP_VCVT_FPIVFP, OP_VCVT_FPIVFPb, true, vcvtOp(true, false, true), rd, rm);
+ }
+
+ void vdiv_F64(FPDoubleRegisterID rd, FPDoubleRegisterID rn, FPDoubleRegisterID rm)
+ {
+ m_formatter.vfpOp(OP_VDIV, OP_VDIVb, true, rn, rd, rm);
+ }
+
+ void vldr(FPDoubleRegisterID rd, RegisterID rn, int32_t imm)
+ {
+ m_formatter.vfpMemOp(OP_VLDR, OP_VLDRb, true, rn, rd, imm);
+ }
+
+ void vmov(RegisterID rd, FPSingleRegisterID rn)
+ {
+ ASSERT(!BadReg(rd));
+ m_formatter.vfpOp(OP_VMOV_CtoS, OP_VMOV_CtoSb, false, rn, rd, VFPOperand(0));
+ }
+
+ void vmov(FPSingleRegisterID rd, RegisterID rn)
+ {
+ ASSERT(!BadReg(rn));
+ m_formatter.vfpOp(OP_VMOV_StoC, OP_VMOV_StoCb, false, rd, rn, VFPOperand(0));
+ }
+
+ void vmrs(RegisterID reg = ARMRegisters::pc)
+ {
+ ASSERT(reg != ARMRegisters::sp);
+ m_formatter.vfpOp(OP_VMRS, OP_VMRSb, false, VFPOperand(1), VFPOperand(0x10 | reg), VFPOperand(0));
+ }
+
+ void vmul_F64(FPDoubleRegisterID rd, FPDoubleRegisterID rn, FPDoubleRegisterID rm)
+ {
+ m_formatter.vfpOp(OP_VMUL_T2, OP_VMUL_T2b, true, rn, rd, rm);
+ }
+
+ void vstr(FPDoubleRegisterID rd, RegisterID rn, int32_t imm)
+ {
+ m_formatter.vfpMemOp(OP_VSTR, OP_VSTRb, true, rn, rd, imm);
+ }
+
+ void vsub_F64(FPDoubleRegisterID rd, FPDoubleRegisterID rn, FPDoubleRegisterID rm)
+ {
+ m_formatter.vfpOp(OP_VSUB_T2, OP_VSUB_T2b, true, rn, rd, rm);
+ }
+
+ JmpDst label()
+ {
+ return JmpDst(m_formatter.size());
+ }
+
+ JmpDst align(int alignment)
+ {
+ while (!m_formatter.isAligned(alignment))
+ bkpt();
+
+ return label();
+ }
+
+ static void* getRelocatedAddress(void* code, JmpSrc jump)
+ {
+ ASSERT(jump.m_offset != -1);
+
+ return reinterpret_cast<void*>(reinterpret_cast<ptrdiff_t>(code) + jump.m_offset);
+ }
+
+ static void* getRelocatedAddress(void* code, JmpDst destination)
+ {
+ ASSERT(destination.m_offset != -1);
+
+ return reinterpret_cast<void*>(reinterpret_cast<ptrdiff_t>(code) + destination.m_offset);
+ }
+
+ static int getDifferenceBetweenLabels(JmpDst src, JmpDst dst)
+ {
+ return dst.m_offset - src.m_offset;
+ }
+
+ static int getDifferenceBetweenLabels(JmpDst src, JmpSrc dst)
+ {
+ return dst.m_offset - src.m_offset;
+ }
+
+ static int getDifferenceBetweenLabels(JmpSrc src, JmpDst dst)
+ {
+ return dst.m_offset - src.m_offset;
+ }
+
+ int executableOffsetFor(int location)
+ {
+ if (!location)
+ return 0;
+ return static_cast<int32_t*>(m_formatter.data())[location / sizeof(int32_t) - 1];
+ }
+
+ int jumpSizeDelta(JumpType jumpType, JumpLinkType jumpLinkType) { return JumpPaddingSizes[jumpType] - JumpSizes[jumpLinkType]; }
+
+ // Assembler admin methods:
+
+ size_t size() const
+ {
+ return m_formatter.size();
+ }
+
+ static bool linkRecordSourceComparator(const LinkRecord& a, const LinkRecord& b)
+ {
+ return a.from() < b.from();
+ }
+
+ bool canCompact(JumpType jumpType)
+ {
+ // The following cannot be compacted:
+ // JumpFixed: represents custom jump sequence
+ // JumpNoConditionFixedSize: represents unconditional jump that must remain a fixed size
+ // JumpConditionFixedSize: represents conditional jump that must remain a fixed size
+ return (jumpType == JumpNoCondition) || (jumpType == JumpCondition);
+ }
+
+ JumpLinkType computeJumpType(JumpType jumpType, const uint8_t* from, const uint8_t* to)
+ {
+ if (jumpType == JumpFixed)
+ return LinkInvalid;
+
+ // for patchable jump we must leave space for the longest code sequence
+ if (jumpType == JumpNoConditionFixedSize)
+ return LinkBX;
+ if (jumpType == JumpConditionFixedSize)
+ return LinkConditionalBX;
+
+ const int paddingSize = JumpPaddingSizes[jumpType];
+ bool mayTriggerErrata = false;
+
+ if (jumpType == JumpCondition) {
+ // 2-byte conditional T1
+ const uint16_t* jumpT1Location = reinterpret_cast<const uint16_t*>(from - (paddingSize - JumpSizes[LinkJumpT1]));
+ if (canBeJumpT1(jumpT1Location, to))
+ return LinkJumpT1;
+ // 4-byte conditional T3
+ const uint16_t* jumpT3Location = reinterpret_cast<const uint16_t*>(from - (paddingSize - JumpSizes[LinkJumpT3]));
+ if (canBeJumpT3(jumpT3Location, to, mayTriggerErrata)) {
+ if (!mayTriggerErrata)
+ return LinkJumpT3;
+ }
+ // 4-byte conditional T4 with IT
+ const uint16_t* conditionalJumpT4Location =
+ reinterpret_cast<const uint16_t*>(from - (paddingSize - JumpSizes[LinkConditionalJumpT4]));
+ if (canBeJumpT4(conditionalJumpT4Location, to, mayTriggerErrata)) {
+ if (!mayTriggerErrata)
+ return LinkConditionalJumpT4;
+ }
+ } else {
+ // 2-byte unconditional T2
+ const uint16_t* jumpT2Location = reinterpret_cast<const uint16_t*>(from - (paddingSize - JumpSizes[LinkJumpT2]));
+ if (canBeJumpT2(jumpT2Location, to))
+ return LinkJumpT2;
+ // 4-byte unconditional T4
+ const uint16_t* jumpT4Location = reinterpret_cast<const uint16_t*>(from - (paddingSize - JumpSizes[LinkJumpT4]));
+ if (canBeJumpT4(jumpT4Location, to, mayTriggerErrata)) {
+ if (!mayTriggerErrata)
+ return LinkJumpT4;
+ }
+ // use long jump sequence
+ return LinkBX;
+ }
+
+ ASSERT(jumpType == JumpCondition);
+ return LinkConditionalBX;
+ }
+
+ JumpLinkType computeJumpType(LinkRecord& record, const uint8_t* from, const uint8_t* to)
+ {
+ JumpLinkType linkType = computeJumpType(record.type(), from, to);
+ record.setLinkType(linkType);
+ return linkType;
+ }
+
+ void recordLinkOffsets(int32_t regionStart, int32_t regionEnd, int32_t offset)
+ {
+ int32_t ptr = regionStart / sizeof(int32_t);
+ const int32_t end = regionEnd / sizeof(int32_t);
+ int32_t* offsets = static_cast<int32_t*>(m_formatter.data());
+ while (ptr < end)
+ offsets[ptr++] = offset;
+ }
+
+ Vector<LinkRecord>& jumpsToLink()
+ {
+ std::sort(m_jumpsToLink.begin(), m_jumpsToLink.end(), linkRecordSourceComparator);
+ return m_jumpsToLink;
+ }
+
+ void link(LinkRecord& record, uint8_t* from, uint8_t* to)
+ {
+ switch (record.linkType()) {
+ case LinkJumpT1:
+ linkJumpT1(record.condition(), reinterpret_cast<uint16_t*>(from), to);
+ break;
+ case LinkJumpT2:
+ linkJumpT2(reinterpret_cast<uint16_t*>(from), to);
+ break;
+ case LinkJumpT3:
+ linkJumpT3(record.condition(), reinterpret_cast<uint16_t*>(from), to);
+ break;
+ case LinkJumpT4:
+ linkJumpT4(reinterpret_cast<uint16_t*>(from), to);
+ break;
+ case LinkConditionalJumpT4:
+ linkConditionalJumpT4(record.condition(), reinterpret_cast<uint16_t*>(from), to);
+ break;
+ case LinkConditionalBX:
+ linkConditionalBX(record.condition(), reinterpret_cast<uint16_t*>(from), to);
+ break;
+ case LinkBX:
+ linkBX(reinterpret_cast<uint16_t*>(from), to);
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ break;
+ }
+ }
+
+ void* unlinkedCode() { return m_formatter.data(); }
+
+ static unsigned getCallReturnOffset(JmpSrc call)
+ {
+ ASSERT(call.m_offset >= 0);
+ return call.m_offset;
+ }
+
+ // Linking & patching:
+ //
+ // 'link' and 'patch' methods are for use on unprotected code - such as the code
+ // within the AssemblerBuffer, and code being patched by the patch buffer. Once
+ // code has been finalized it is (platform support permitting) within a non-
+ // writable region of memory; to modify the code in an execute-only execuable
+ // pool the 'repatch' and 'relink' methods should be used.
+
+ void linkJump(JmpSrc from, JmpDst to)
+ {
+ ASSERT(to.m_offset != -1);
+ ASSERT(from.m_offset != -1);
+ m_jumpsToLink.append(LinkRecord(from.m_offset, to.m_offset, from.m_type, from.m_condition));
+ }
+
+ static void linkJump(void* code, JmpSrc from, void* to)
+ {
+ ASSERT(from.m_offset != -1);
+
+ uint16_t* location = reinterpret_cast<uint16_t*>(reinterpret_cast<intptr_t>(code) + from.m_offset);
+ linkJumpAbsolute(location, to);
+ }
+
+ // bah, this mathod should really be static, since it is used by the LinkBuffer.
+ // return a bool saying whether the link was successful?
+ static void linkCall(void* code, JmpSrc from, void* to)
+ {
+ ASSERT(!(reinterpret_cast<intptr_t>(code) & 1));
+ ASSERT(from.m_offset != -1);
+ ASSERT(reinterpret_cast<intptr_t>(to) & 1);
+
+ setPointer(reinterpret_cast<uint16_t*>(reinterpret_cast<intptr_t>(code) + from.m_offset) - 1, to);
+ }
+
+ static void linkPointer(void* code, JmpDst where, void* value)
+ {
+ setPointer(reinterpret_cast<char*>(code) + where.m_offset, value);
+ }
+
+ static void relinkJump(void* from, void* to)
+ {
+ ASSERT(!(reinterpret_cast<intptr_t>(from) & 1));
+ ASSERT(!(reinterpret_cast<intptr_t>(to) & 1));
+
+ linkJumpAbsolute(reinterpret_cast<uint16_t*>(from), to);
+
+ ExecutableAllocator::cacheFlush(reinterpret_cast<uint16_t*>(from) - 5, 5 * sizeof(uint16_t));
+ }
+
+ static void relinkCall(void* from, void* to)
+ {
+ ASSERT(!(reinterpret_cast<intptr_t>(from) & 1));
+ ASSERT(reinterpret_cast<intptr_t>(to) & 1);
+
+ setPointer(reinterpret_cast<uint16_t*>(from) - 1, to);
+ }
+
+ static void repatchInt32(void* where, int32_t value)
+ {
+ ASSERT(!(reinterpret_cast<intptr_t>(where) & 1));
+
+ setInt32(where, value);
+ }
+
+ static void repatchPointer(void* where, void* value)
+ {
+ ASSERT(!(reinterpret_cast<intptr_t>(where) & 1));
+
+ setPointer(where, value);
+ }
+
+ static void repatchLoadPtrToLEA(void* where)
+ {
+ ASSERT(!(reinterpret_cast<intptr_t>(where) & 1));
+ uint16_t* loadOp = reinterpret_cast<uint16_t*>(where) + 4;
+
+ ASSERT((loadOp[0] & 0xfff0) == OP_LDR_reg_T2);
+ ASSERT((loadOp[1] & 0x0ff0) == 0);
+ int rn = loadOp[0] & 0xf;
+ int rt = loadOp[1] >> 12;
+ int rm = loadOp[1] & 0xf;
+
+ loadOp[0] = OP_ADD_reg_T3 | rn;
+ loadOp[1] = rt << 8 | rm;
+ ExecutableAllocator::cacheFlush(loadOp, sizeof(uint32_t));
+ }
+
+private:
+ // VFP operations commonly take one or more 5-bit operands, typically representing a
+ // floating point register number. This will commonly be encoded in the instruction
+ // in two parts, with one single bit field, and one 4-bit field. In the case of
+ // double precision operands the high bit of the register number will be encoded
+ // separately, and for single precision operands the high bit of the register number
+ // will be encoded individually.
+ // VFPOperand encapsulates a 5-bit VFP operand, with bits 0..3 containing the 4-bit
+ // field to be encoded together in the instruction (the low 4-bits of a double
+ // register number, or the high 4-bits of a single register number), and bit 4
+ // contains the bit value to be encoded individually.
+ struct VFPOperand {
+ explicit VFPOperand(uint32_t value)
+ : m_value(value)
+ {
+ ASSERT(!(m_value & ~0x1f));
+ }
+
+ VFPOperand(FPDoubleRegisterID reg)
+ : m_value(reg)
+ {
+ }
+
+ VFPOperand(RegisterID reg)
+ : m_value(reg)
+ {
+ }
+
+ VFPOperand(FPSingleRegisterID reg)
+ : m_value(((reg & 1) << 4) | (reg >> 1)) // rotate the lowest bit of 'reg' to the top.
+ {
+ }
+
+ uint32_t bits1()
+ {
+ return m_value >> 4;
+ }
+
+ uint32_t bits4()
+ {
+ return m_value & 0xf;
+ }
+
+ uint32_t m_value;
+ };
+
+ VFPOperand vcvtOp(bool toInteger, bool isUnsigned, bool isRoundZero)
+ {
+ // Cannot specify rounding when converting to float.
+ ASSERT(toInteger || !isRoundZero);
+
+ uint32_t op = 0x8;
+ if (toInteger) {
+ // opc2 indicates both toInteger & isUnsigned.
+ op |= isUnsigned ? 0x4 : 0x5;
+ // 'op' field in instruction is isRoundZero
+ if (isRoundZero)
+ op |= 0x10;
+ } else {
+ // 'op' field in instruction is isUnsigned
+ if (!isUnsigned)
+ op |= 0x10;
+ }
+ return VFPOperand(op);
+ }
+
+ static void setInt32(void* code, uint32_t value)
+ {
+ uint16_t* location = reinterpret_cast<uint16_t*>(code);
+ ASSERT(isMOV_imm_T3(location - 4) && isMOVT(location - 2));
+
+ ARMThumbImmediate lo16 = ARMThumbImmediate::makeUInt16(static_cast<uint16_t>(value));
+ ARMThumbImmediate hi16 = ARMThumbImmediate::makeUInt16(static_cast<uint16_t>(value >> 16));
+ location[-4] = twoWordOp5i6Imm4Reg4EncodedImmFirst(OP_MOV_imm_T3, lo16);
+ location[-3] = twoWordOp5i6Imm4Reg4EncodedImmSecond((location[-3] >> 8) & 0xf, lo16);
+ location[-2] = twoWordOp5i6Imm4Reg4EncodedImmFirst(OP_MOVT, hi16);
+ location[-1] = twoWordOp5i6Imm4Reg4EncodedImmSecond((location[-1] >> 8) & 0xf, hi16);
+
+ ExecutableAllocator::cacheFlush(location - 4, 4 * sizeof(uint16_t));
+ }
+
+ static void setPointer(void* code, void* value)
+ {
+ setInt32(code, reinterpret_cast<uint32_t>(value));
+ }
+
+ static bool isB(void* address)
+ {
+ uint16_t* instruction = static_cast<uint16_t*>(address);
+ return ((instruction[0] & 0xf800) == OP_B_T4a) && ((instruction[1] & 0xd000) == OP_B_T4b);
+ }
+
+ static bool isBX(void* address)
+ {
+ uint16_t* instruction = static_cast<uint16_t*>(address);
+ return (instruction[0] & 0xff87) == OP_BX;
+ }
+
+ static bool isMOV_imm_T3(void* address)
+ {
+ uint16_t* instruction = static_cast<uint16_t*>(address);
+ return ((instruction[0] & 0xFBF0) == OP_MOV_imm_T3) && ((instruction[1] & 0x8000) == 0);
+ }
+
+ static bool isMOVT(void* address)
+ {
+ uint16_t* instruction = static_cast<uint16_t*>(address);
+ return ((instruction[0] & 0xFBF0) == OP_MOVT) && ((instruction[1] & 0x8000) == 0);
+ }
+
+ static bool isNOP_T1(void* address)
+ {
+ uint16_t* instruction = static_cast<uint16_t*>(address);
+ return instruction[0] == OP_NOP_T1;
+ }
+
+ static bool isNOP_T2(void* address)
+ {
+ uint16_t* instruction = static_cast<uint16_t*>(address);
+ return (instruction[0] == OP_NOP_T2a) && (instruction[1] == OP_NOP_T2b);
+ }
+
+ static bool canBeJumpT1(const uint16_t* instruction, const void* target)
+ {
+ ASSERT(!(reinterpret_cast<intptr_t>(instruction) & 1));
+ ASSERT(!(reinterpret_cast<intptr_t>(target) & 1));
+
+ intptr_t relative = reinterpret_cast<intptr_t>(target) - (reinterpret_cast<intptr_t>(instruction));
+ // It does not appear to be documented in the ARM ARM (big surprise), but
+ // for OP_B_T1 the branch displacement encoded in the instruction is 2
+ // less than the actual displacement.
+ relative -= 2;
+ return ((relative << 23) >> 23) == relative;
+ }
+
+ static bool canBeJumpT2(const uint16_t* instruction, const void* target)
+ {
+ ASSERT(!(reinterpret_cast<intptr_t>(instruction) & 1));
+ ASSERT(!(reinterpret_cast<intptr_t>(target) & 1));
+
+ intptr_t relative = reinterpret_cast<intptr_t>(target) - (reinterpret_cast<intptr_t>(instruction));
+ // It does not appear to be documented in the ARM ARM (big surprise), but
+ // for OP_B_T2 the branch displacement encoded in the instruction is 2
+ // less than the actual displacement.
+ relative -= 2;
+ return ((relative << 20) >> 20) == relative;
+ }
+
+ static bool canBeJumpT3(const uint16_t* instruction, const void* target, bool& mayTriggerErrata)
+ {
+ ASSERT(!(reinterpret_cast<intptr_t>(instruction) & 1));
+ ASSERT(!(reinterpret_cast<intptr_t>(target) & 1));
+
+ intptr_t relative = reinterpret_cast<intptr_t>(target) - (reinterpret_cast<intptr_t>(instruction));
+ // From Cortex-A8 errata:
+ // If the 32-bit Thumb-2 branch instruction spans two 4KiB regions and
+ // the target of the branch falls within the first region it is
+ // possible for the processor to incorrectly determine the branch
+ // instruction, and it is also possible in some cases for the processor
+ // to enter a deadlock state.
+ // The instruction is spanning two pages if it ends at an address ending 0x002
+ bool spansTwo4K = ((reinterpret_cast<intptr_t>(instruction) & 0xfff) == 0x002);
+ mayTriggerErrata = spansTwo4K;
+ // The target is in the first page if the jump branch back by [3..0x1002] bytes
+ bool targetInFirstPage = (relative >= -0x1002) && (relative < -2);
+ bool wouldTriggerA8Errata = spansTwo4K && targetInFirstPage;
+ return ((relative << 11) >> 11) == relative && !wouldTriggerA8Errata;
+ }
+
+ static bool canBeJumpT4(const uint16_t* instruction, const void* target, bool& mayTriggerErrata)
+ {
+ ASSERT(!(reinterpret_cast<intptr_t>(instruction) & 1));
+ ASSERT(!(reinterpret_cast<intptr_t>(target) & 1));
+
+ intptr_t relative = reinterpret_cast<intptr_t>(target) - (reinterpret_cast<intptr_t>(instruction));
+ // From Cortex-A8 errata:
+ // If the 32-bit Thumb-2 branch instruction spans two 4KiB regions and
+ // the target of the branch falls within the first region it is
+ // possible for the processor to incorrectly determine the branch
+ // instruction, and it is also possible in some cases for the processor
+ // to enter a deadlock state.
+ // The instruction is spanning two pages if it ends at an address ending 0x002
+ bool spansTwo4K = ((reinterpret_cast<intptr_t>(instruction) & 0xfff) == 0x002);
+ mayTriggerErrata = spansTwo4K;
+ // The target is in the first page if the jump branch back by [3..0x1002] bytes
+ bool targetInFirstPage = (relative >= -0x1002) && (relative < -2);
+ bool wouldTriggerA8Errata = spansTwo4K && targetInFirstPage;
+ return ((relative << 7) >> 7) == relative && !wouldTriggerA8Errata;
+ }
+
+ void linkJumpT1(Condition cond, uint16_t* instruction, void* target)
+ {
+ // FIMXE: this should be up in the MacroAssembler layer. :-(
+ ASSERT(!(reinterpret_cast<intptr_t>(instruction) & 1));
+ ASSERT(!(reinterpret_cast<intptr_t>(target) & 1));
+ ASSERT(canBeJumpT1(instruction, target));
+
+ intptr_t relative = reinterpret_cast<intptr_t>(target) - (reinterpret_cast<intptr_t>(instruction));
+ // It does not appear to be documented in the ARM ARM (big surprise), but
+ // for OP_B_T1 the branch displacement encoded in the instruction is 2
+ // less than the actual displacement.
+ relative -= 2;
+
+ // All branch offsets should be an even distance.
+ ASSERT(!(relative & 1));
+ instruction[-1] = OP_B_T1 | ((cond & 0xf) << 8) | ((relative & 0x1fe) >> 1);
+ }
+
+ static void linkJumpT2(uint16_t* instruction, void* target)
+ {
+ // FIMXE: this should be up in the MacroAssembler layer. :-(
+ ASSERT(!(reinterpret_cast<intptr_t>(instruction) & 1));
+ ASSERT(!(reinterpret_cast<intptr_t>(target) & 1));
+ ASSERT(canBeJumpT2(instruction, target));
+
+ intptr_t relative = reinterpret_cast<intptr_t>(target) - (reinterpret_cast<intptr_t>(instruction));
+ // It does not appear to be documented in the ARM ARM (big surprise), but
+ // for OP_B_T2 the branch displacement encoded in the instruction is 2
+ // less than the actual displacement.
+ relative -= 2;
+
+ // All branch offsets should be an even distance.
+ ASSERT(!(relative & 1));
+ instruction[-1] = OP_B_T2 | ((relative & 0xffe) >> 1);
+ }
+
+ void linkJumpT3(Condition cond, uint16_t* instruction, void* target)
+ {
+ // FIMXE: this should be up in the MacroAssembler layer. :-(
+ ASSERT(!(reinterpret_cast<intptr_t>(instruction) & 1));
+ ASSERT(!(reinterpret_cast<intptr_t>(target) & 1));
+ bool scratch;
+ UNUSED_PARAM(scratch);
+ ASSERT(canBeJumpT3(instruction, target, scratch));
+
+ intptr_t relative = reinterpret_cast<intptr_t>(target) - (reinterpret_cast<intptr_t>(instruction));
+
+ // All branch offsets should be an even distance.
+ ASSERT(!(relative & 1));
+ instruction[-2] = OP_B_T3a | ((relative & 0x100000) >> 10) | ((cond & 0xf) << 6) | ((relative & 0x3f000) >> 12);
+ instruction[-1] = OP_B_T3b | ((relative & 0x80000) >> 8) | ((relative & 0x40000) >> 5) | ((relative & 0xffe) >> 1);
+ }
+
+ static void linkJumpT4(uint16_t* instruction, void* target)
+ {
+ // FIMXE: this should be up in the MacroAssembler layer. :-(
+ ASSERT(!(reinterpret_cast<intptr_t>(instruction) & 1));
+ ASSERT(!(reinterpret_cast<intptr_t>(target) & 1));
+ bool scratch;
+ UNUSED_PARAM(scratch);
+ ASSERT(canBeJumpT4(instruction, target, scratch));
+
+ intptr_t relative = reinterpret_cast<intptr_t>(target) - (reinterpret_cast<intptr_t>(instruction));
+ // ARM encoding for the top two bits below the sign bit is 'peculiar'.
+ if (relative >= 0)
+ relative ^= 0xC00000;
+
+ // All branch offsets should be an even distance.
+ ASSERT(!(relative & 1));
+ instruction[-2] = OP_B_T4a | ((relative & 0x1000000) >> 14) | ((relative & 0x3ff000) >> 12);
+ instruction[-1] = OP_B_T4b | ((relative & 0x800000) >> 10) | ((relative & 0x400000) >> 11) | ((relative & 0xffe) >> 1);
+ }
+
+ void linkConditionalJumpT4(Condition cond, uint16_t* instruction, void* target)
+ {
+ // FIMXE: this should be up in the MacroAssembler layer. :-(
+ ASSERT(!(reinterpret_cast<intptr_t>(instruction) & 1));
+ ASSERT(!(reinterpret_cast<intptr_t>(target) & 1));
+
+ instruction[-3] = ifThenElse(cond) | OP_IT;
+ linkJumpT4(instruction, target);
+ }
+
+ static void linkBX(uint16_t* instruction, void* target)
+ {
+ // FIMXE: this should be up in the MacroAssembler layer. :-(
+ ASSERT(!(reinterpret_cast<intptr_t>(instruction) & 1));
+ ASSERT(!(reinterpret_cast<intptr_t>(target) & 1));
+
+ const uint16_t JUMP_TEMPORARY_REGISTER = ARMRegisters::ip;
+ ARMThumbImmediate lo16 = ARMThumbImmediate::makeUInt16(static_cast<uint16_t>(reinterpret_cast<uint32_t>(target) + 1));
+ ARMThumbImmediate hi16 = ARMThumbImmediate::makeUInt16(static_cast<uint16_t>(reinterpret_cast<uint32_t>(target) >> 16));
+ instruction[-5] = twoWordOp5i6Imm4Reg4EncodedImmFirst(OP_MOV_imm_T3, lo16);
+ instruction[-4] = twoWordOp5i6Imm4Reg4EncodedImmSecond(JUMP_TEMPORARY_REGISTER, lo16);
+ instruction[-3] = twoWordOp5i6Imm4Reg4EncodedImmFirst(OP_MOVT, hi16);
+ instruction[-2] = twoWordOp5i6Imm4Reg4EncodedImmSecond(JUMP_TEMPORARY_REGISTER, hi16);
+ instruction[-1] = OP_BX | (JUMP_TEMPORARY_REGISTER << 3);
+ }
+
+ void linkConditionalBX(Condition cond, uint16_t* instruction, void* target)
+ {
+ // FIMXE: this should be up in the MacroAssembler layer. :-(
+ ASSERT(!(reinterpret_cast<intptr_t>(instruction) & 1));
+ ASSERT(!(reinterpret_cast<intptr_t>(target) & 1));
+
+ linkBX(instruction, target);
+ instruction[-6] = ifThenElse(cond, true, true) | OP_IT;
+ }
+
+ static void linkJumpAbsolute(uint16_t* instruction, void* target)
+ {
+ // FIMXE: this should be up in the MacroAssembler layer. :-(
+ ASSERT(!(reinterpret_cast<intptr_t>(instruction) & 1));
+ ASSERT(!(reinterpret_cast<intptr_t>(target) & 1));
+
+ ASSERT((isMOV_imm_T3(instruction - 5) && isMOVT(instruction - 3) && isBX(instruction - 1))
+ || (isNOP_T1(instruction - 5) && isNOP_T2(instruction - 4) && isB(instruction - 2)));
+
+ bool scratch;
+ if (canBeJumpT4(instruction, target, scratch)) {
+ // There may be a better way to fix this, but right now put the NOPs first, since in the
+ // case of an conditional branch this will be coming after an ITTT predicating *three*
+ // instructions! Looking backwards to modify the ITTT to an IT is not easy, due to
+ // variable wdith encoding - the previous instruction might *look* like an ITTT but
+ // actually be the second half of a 2-word op.
+ instruction[-5] = OP_NOP_T1;
+ instruction[-4] = OP_NOP_T2a;
+ instruction[-3] = OP_NOP_T2b;
+ linkJumpT4(instruction, target);
+ } else {
+ const uint16_t JUMP_TEMPORARY_REGISTER = ARMRegisters::ip;
+ ARMThumbImmediate lo16 = ARMThumbImmediate::makeUInt16(static_cast<uint16_t>(reinterpret_cast<uint32_t>(target) + 1));
+ ARMThumbImmediate hi16 = ARMThumbImmediate::makeUInt16(static_cast<uint16_t>(reinterpret_cast<uint32_t>(target) >> 16));
+ instruction[-5] = twoWordOp5i6Imm4Reg4EncodedImmFirst(OP_MOV_imm_T3, lo16);
+ instruction[-4] = twoWordOp5i6Imm4Reg4EncodedImmSecond(JUMP_TEMPORARY_REGISTER, lo16);
+ instruction[-3] = twoWordOp5i6Imm4Reg4EncodedImmFirst(OP_MOVT, hi16);
+ instruction[-2] = twoWordOp5i6Imm4Reg4EncodedImmSecond(JUMP_TEMPORARY_REGISTER, hi16);
+ instruction[-1] = OP_BX | (JUMP_TEMPORARY_REGISTER << 3);
+ }
+ }
+
+ static uint16_t twoWordOp5i6Imm4Reg4EncodedImmFirst(uint16_t op, ARMThumbImmediate imm)
+ {
+ return op | (imm.m_value.i << 10) | imm.m_value.imm4;
+ }
+
+ static uint16_t twoWordOp5i6Imm4Reg4EncodedImmSecond(uint16_t rd, ARMThumbImmediate imm)
+ {
+ return (imm.m_value.imm3 << 12) | (rd << 8) | imm.m_value.imm8;
+ }
+
+ class ARMInstructionFormatter {
+ public:
+ void oneWordOp5Reg3Imm8(OpcodeID op, RegisterID rd, uint8_t imm)
+ {
+ m_buffer.putShort(op | (rd << 8) | imm);
+ }
+
+ void oneWordOp5Imm5Reg3Reg3(OpcodeID op, uint8_t imm, RegisterID reg1, RegisterID reg2)
+ {
+ m_buffer.putShort(op | (imm << 6) | (reg1 << 3) | reg2);
+ }
+
+ void oneWordOp7Reg3Reg3Reg3(OpcodeID op, RegisterID reg1, RegisterID reg2, RegisterID reg3)
+ {
+ m_buffer.putShort(op | (reg1 << 6) | (reg2 << 3) | reg3);
+ }
+
+ void oneWordOp8Imm8(OpcodeID op, uint8_t imm)
+ {
+ m_buffer.putShort(op | imm);
+ }
+
+ void oneWordOp8RegReg143(OpcodeID op, RegisterID reg1, RegisterID reg2)
+ {
+ m_buffer.putShort(op | ((reg2 & 8) << 4) | (reg1 << 3) | (reg2 & 7));
+ }
+ void oneWordOp9Imm7(OpcodeID op, uint8_t imm)
+ {
+ m_buffer.putShort(op | imm);
+ }
+
+ void oneWordOp10Reg3Reg3(OpcodeID op, RegisterID reg1, RegisterID reg2)
+ {
+ m_buffer.putShort(op | (reg1 << 3) | reg2);
+ }
+
+ void twoWordOp12Reg4FourFours(OpcodeID1 op, RegisterID reg, FourFours ff)
+ {
+ m_buffer.putShort(op | reg);
+ m_buffer.putShort(ff.m_u.value);
+ }
+
+ void twoWordOp16FourFours(OpcodeID1 op, FourFours ff)
+ {
+ m_buffer.putShort(op);
+ m_buffer.putShort(ff.m_u.value);
+ }
+
+ void twoWordOp16Op16(OpcodeID1 op1, OpcodeID2 op2)
+ {
+ m_buffer.putShort(op1);
+ m_buffer.putShort(op2);
+ }
+
+ void twoWordOp5i6Imm4Reg4EncodedImm(OpcodeID1 op, int imm4, RegisterID rd, ARMThumbImmediate imm)
+ {
+ ARMThumbImmediate newImm = imm;
+ newImm.m_value.imm4 = imm4;
+
+ m_buffer.putShort(ARMv7Assembler::twoWordOp5i6Imm4Reg4EncodedImmFirst(op, newImm));
+ m_buffer.putShort(ARMv7Assembler::twoWordOp5i6Imm4Reg4EncodedImmSecond(rd, newImm));
+ }
+
+ void twoWordOp12Reg4Reg4Imm12(OpcodeID1 op, RegisterID reg1, RegisterID reg2, uint16_t imm)
+ {
+ m_buffer.putShort(op | reg1);
+ m_buffer.putShort((reg2 << 12) | imm);
+ }
+
+ // Formats up instructions of the pattern:
+ // 111111111B11aaaa:bbbb222SA2C2cccc
+ // Where 1s in the pattern come from op1, 2s in the pattern come from op2, S is the provided size bit.
+ // Operands provide 5 bit values of the form Aaaaa, Bbbbb, Ccccc.
+ void vfpOp(OpcodeID1 op1, OpcodeID2 op2, bool size, VFPOperand a, VFPOperand b, VFPOperand c)
+ {
+ ASSERT(!(op1 & 0x004f));
+ ASSERT(!(op2 & 0xf1af));
+ m_buffer.putShort(op1 | b.bits1() << 6 | a.bits4());
+ m_buffer.putShort(op2 | b.bits4() << 12 | size << 8 | a.bits1() << 7 | c.bits1() << 5 | c.bits4());
+ }
+
+ // Arm vfp addresses can be offset by a 9-bit ones-comp immediate, left shifted by 2.
+ // (i.e. +/-(0..255) 32-bit words)
+ void vfpMemOp(OpcodeID1 op1, OpcodeID2 op2, bool size, RegisterID rn, VFPOperand rd, int32_t imm)
+ {
+ bool up = true;
+ if (imm < 0) {
+ imm = -imm;
+ up = false;
+ }
+
+ uint32_t offset = imm;
+ ASSERT(!(offset & ~0x3fc));
+ offset >>= 2;
+
+ m_buffer.putShort(op1 | (up << 7) | rd.bits1() << 6 | rn);
+ m_buffer.putShort(op2 | rd.bits4() << 12 | size << 8 | offset);
+ }
+
+ // Administrative methods:
+
+ size_t size() const { return m_buffer.size(); }
+ bool isAligned(int alignment) const { return m_buffer.isAligned(alignment); }
+ void* data() const { return m_buffer.data(); }
+ void* executableCopy(ExecutablePool* allocator) { return m_buffer.executableCopy(allocator); }
+
+ private:
+ AssemblerBuffer m_buffer;
+ } m_formatter;
+
+ Vector<LinkRecord> m_jumpsToLink;
+ Vector<int32_t> m_offsets;
+};
+
+} // namespace JSC
+
+#endif // ENABLE(ASSEMBLER) && CPU(ARM_THUMB2)
+
+#endif // ARMAssembler_h
diff --git a/Source/JavaScriptCore/assembler/AbstractMacroAssembler.h b/Source/JavaScriptCore/assembler/AbstractMacroAssembler.h
new file mode 100644
index 0000000..07bd702
--- /dev/null
+++ b/Source/JavaScriptCore/assembler/AbstractMacroAssembler.h
@@ -0,0 +1,549 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef AbstractMacroAssembler_h
+#define AbstractMacroAssembler_h
+
+#include "CodeLocation.h"
+#include "MacroAssemblerCodeRef.h"
+#include <wtf/Noncopyable.h>
+#include <wtf/UnusedParam.h>
+
+#if ENABLE(ASSEMBLER)
+
+namespace JSC {
+
+class LinkBuffer;
+class RepatchBuffer;
+
+template <class AssemblerType>
+class AbstractMacroAssembler {
+public:
+ typedef AssemblerType AssemblerType_T;
+
+ typedef MacroAssemblerCodePtr CodePtr;
+ typedef MacroAssemblerCodeRef CodeRef;
+
+ class Jump;
+
+ typedef typename AssemblerType::RegisterID RegisterID;
+ typedef typename AssemblerType::JmpSrc JmpSrc;
+ typedef typename AssemblerType::JmpDst JmpDst;
+
+
+ // Section 1: MacroAssembler operand types
+ //
+ // The following types are used as operands to MacroAssembler operations,
+ // describing immediate and memory operands to the instructions to be planted.
+
+
+ enum Scale {
+ TimesOne,
+ TimesTwo,
+ TimesFour,
+ TimesEight,
+ };
+
+ // Address:
+ //
+ // Describes a simple base-offset address.
+ struct Address {
+ explicit Address(RegisterID base, int32_t offset = 0)
+ : base(base)
+ , offset(offset)
+ {
+ }
+
+ RegisterID base;
+ int32_t offset;
+ };
+
+ struct ExtendedAddress {
+ explicit ExtendedAddress(RegisterID base, intptr_t offset = 0)
+ : base(base)
+ , offset(offset)
+ {
+ }
+
+ RegisterID base;
+ intptr_t offset;
+ };
+
+ // ImplicitAddress:
+ //
+ // This class is used for explicit 'load' and 'store' operations
+ // (as opposed to situations in which a memory operand is provided
+ // to a generic operation, such as an integer arithmetic instruction).
+ //
+ // In the case of a load (or store) operation we want to permit
+ // addresses to be implicitly constructed, e.g. the two calls:
+ //
+ // load32(Address(addrReg), destReg);
+ // load32(addrReg, destReg);
+ //
+ // Are equivalent, and the explicit wrapping of the Address in the former
+ // is unnecessary.
+ struct ImplicitAddress {
+ ImplicitAddress(RegisterID base)
+ : base(base)
+ , offset(0)
+ {
+ }
+
+ ImplicitAddress(Address address)
+ : base(address.base)
+ , offset(address.offset)
+ {
+ }
+
+ RegisterID base;
+ int32_t offset;
+ };
+
+ // BaseIndex:
+ //
+ // Describes a complex addressing mode.
+ struct BaseIndex {
+ BaseIndex(RegisterID base, RegisterID index, Scale scale, int32_t offset = 0)
+ : base(base)
+ , index(index)
+ , scale(scale)
+ , offset(offset)
+ {
+ }
+
+ RegisterID base;
+ RegisterID index;
+ Scale scale;
+ int32_t offset;
+ };
+
+ // AbsoluteAddress:
+ //
+ // Describes an memory operand given by a pointer. For regular load & store
+ // operations an unwrapped void* will be used, rather than using this.
+ struct AbsoluteAddress {
+ explicit AbsoluteAddress(void* ptr)
+ : m_ptr(ptr)
+ {
+ }
+
+ void* m_ptr;
+ };
+
+ // ImmPtr:
+ //
+ // A pointer sized immediate operand to an instruction - this is wrapped
+ // in a class requiring explicit construction in order to differentiate
+ // from pointers used as absolute addresses to memory operations
+ struct ImmPtr {
+ explicit ImmPtr(const void* value)
+ : m_value(value)
+ {
+ }
+
+ intptr_t asIntptr()
+ {
+ return reinterpret_cast<intptr_t>(m_value);
+ }
+
+ const void* m_value;
+ };
+
+ // Imm32:
+ //
+ // A 32bit immediate operand to an instruction - this is wrapped in a
+ // class requiring explicit construction in order to prevent RegisterIDs
+ // (which are implemented as an enum) from accidentally being passed as
+ // immediate values.
+ struct Imm32 {
+ explicit Imm32(int32_t value)
+ : m_value(value)
+#if CPU(ARM) || CPU(MIPS)
+ , m_isPointer(false)
+#endif
+ {
+ }
+
+#if !CPU(X86_64)
+ explicit Imm32(ImmPtr ptr)
+ : m_value(ptr.asIntptr())
+#if CPU(ARM) || CPU(MIPS)
+ , m_isPointer(true)
+#endif
+ {
+ }
+#endif
+
+ int32_t m_value;
+#if CPU(ARM) || CPU(MIPS)
+ // We rely on being able to regenerate code to recover exception handling
+ // information. Since ARMv7 supports 16-bit immediates there is a danger
+ // that if pointer values change the layout of the generated code will change.
+ // To avoid this problem, always generate pointers (and thus Imm32s constructed
+ // from ImmPtrs) with a code sequence that is able to represent any pointer
+ // value - don't use a more compact form in these cases.
+ // Same for MIPS.
+ bool m_isPointer;
+#endif
+ };
+
+
+ // Section 2: MacroAssembler code buffer handles
+ //
+ // The following types are used to reference items in the code buffer
+ // during JIT code generation. For example, the type Jump is used to
+ // track the location of a jump instruction so that it may later be
+ // linked to a label marking its destination.
+
+
+ // Label:
+ //
+ // A Label records a point in the generated instruction stream, typically such that
+ // it may be used as a destination for a jump.
+ class Label {
+ template<class TemplateAssemblerType>
+ friend class AbstractMacroAssembler;
+ friend class Jump;
+ friend class MacroAssemblerCodeRef;
+ friend class LinkBuffer;
+
+ public:
+ Label()
+ {
+ }
+
+ Label(AbstractMacroAssembler<AssemblerType>* masm)
+ : m_label(masm->m_assembler.label())
+ {
+ }
+
+ bool isUsed() const { return m_label.isUsed(); }
+ bool isSet() const { return m_label.isSet(); }
+ void used() { m_label.used(); }
+ private:
+ JmpDst m_label;
+ };
+
+ // DataLabelPtr:
+ //
+ // A DataLabelPtr is used to refer to a location in the code containing a pointer to be
+ // patched after the code has been generated.
+ class DataLabelPtr {
+ template<class TemplateAssemblerType>
+ friend class AbstractMacroAssembler;
+ friend class LinkBuffer;
+ public:
+ DataLabelPtr()
+ {
+ }
+
+ DataLabelPtr(AbstractMacroAssembler<AssemblerType>* masm)
+ : m_label(masm->m_assembler.label())
+ {
+ }
+
+ bool isSet() const { return m_label.isSet(); }
+
+ private:
+ JmpDst m_label;
+ };
+
+ // DataLabel32:
+ //
+ // A DataLabelPtr is used to refer to a location in the code containing a pointer to be
+ // patched after the code has been generated.
+ class DataLabel32 {
+ template<class TemplateAssemblerType>
+ friend class AbstractMacroAssembler;
+ friend class LinkBuffer;
+ public:
+ DataLabel32()
+ {
+ }
+
+ DataLabel32(AbstractMacroAssembler<AssemblerType>* masm)
+ : m_label(masm->m_assembler.label())
+ {
+ }
+
+ private:
+ JmpDst m_label;
+ };
+
+ // Call:
+ //
+ // A Call object is a reference to a call instruction that has been planted
+ // into the code buffer - it is typically used to link the call, setting the
+ // relative offset such that when executed it will call to the desired
+ // destination.
+ class Call {
+ template<class TemplateAssemblerType>
+ friend class AbstractMacroAssembler;
+
+ public:
+ enum Flags {
+ None = 0x0,
+ Linkable = 0x1,
+ Near = 0x2,
+ LinkableNear = 0x3,
+ };
+
+ Call()
+ : m_flags(None)
+ {
+ }
+
+ Call(JmpSrc jmp, Flags flags)
+ : m_jmp(jmp)
+ , m_flags(flags)
+ {
+ }
+
+ bool isFlagSet(Flags flag)
+ {
+ return m_flags & flag;
+ }
+
+ static Call fromTailJump(Jump jump)
+ {
+ return Call(jump.m_jmp, Linkable);
+ }
+
+ JmpSrc m_jmp;
+ private:
+ Flags m_flags;
+ };
+
+ // Jump:
+ //
+ // A jump object is a reference to a jump instruction that has been planted
+ // into the code buffer - it is typically used to link the jump, setting the
+ // relative offset such that when executed it will jump to the desired
+ // destination.
+ class Jump {
+ template<class TemplateAssemblerType>
+ friend class AbstractMacroAssembler;
+ friend class Call;
+ friend class LinkBuffer;
+ public:
+ Jump()
+ {
+ }
+
+ Jump(JmpSrc jmp)
+ : m_jmp(jmp)
+ {
+ }
+
+ void link(AbstractMacroAssembler<AssemblerType>* masm)
+ {
+ masm->m_assembler.linkJump(m_jmp, masm->m_assembler.label());
+ }
+
+ void linkTo(Label label, AbstractMacroAssembler<AssemblerType>* masm)
+ {
+ masm->m_assembler.linkJump(m_jmp, label.m_label);
+ }
+
+ private:
+ JmpSrc m_jmp;
+ };
+
+ // JumpList:
+ //
+ // A JumpList is a set of Jump objects.
+ // All jumps in the set will be linked to the same destination.
+ class JumpList {
+ friend class LinkBuffer;
+
+ public:
+ typedef Vector<Jump, 16> JumpVector;
+
+ void link(AbstractMacroAssembler<AssemblerType>* masm)
+ {
+ size_t size = m_jumps.size();
+ for (size_t i = 0; i < size; ++i)
+ m_jumps[i].link(masm);
+ m_jumps.clear();
+ }
+
+ void linkTo(Label label, AbstractMacroAssembler<AssemblerType>* masm)
+ {
+ size_t size = m_jumps.size();
+ for (size_t i = 0; i < size; ++i)
+ m_jumps[i].linkTo(label, masm);
+ m_jumps.clear();
+ }
+
+ void append(Jump jump)
+ {
+ m_jumps.append(jump);
+ }
+
+ void append(JumpList& other)
+ {
+ m_jumps.append(other.m_jumps.begin(), other.m_jumps.size());
+ }
+
+ bool empty()
+ {
+ return !m_jumps.size();
+ }
+
+ void clear()
+ {
+ m_jumps.clear();
+ }
+
+ const JumpVector& jumps() { return m_jumps; }
+
+ private:
+ JumpVector m_jumps;
+ };
+
+
+ // Section 3: Misc admin methods
+ size_t size()
+ {
+ return m_assembler.size();
+ }
+
+ Label label()
+ {
+ return Label(this);
+ }
+
+ Label align()
+ {
+ m_assembler.align(16);
+ return Label(this);
+ }
+
+ ptrdiff_t differenceBetween(Label from, Jump to)
+ {
+ return AssemblerType::getDifferenceBetweenLabels(from.m_label, to.m_jmp);
+ }
+
+ ptrdiff_t differenceBetween(Label from, Call to)
+ {
+ return AssemblerType::getDifferenceBetweenLabels(from.m_label, to.m_jmp);
+ }
+
+ ptrdiff_t differenceBetween(Label from, Label to)
+ {
+ return AssemblerType::getDifferenceBetweenLabels(from.m_label, to.m_label);
+ }
+
+ ptrdiff_t differenceBetween(Label from, DataLabelPtr to)
+ {
+ return AssemblerType::getDifferenceBetweenLabels(from.m_label, to.m_label);
+ }
+
+ ptrdiff_t differenceBetween(Label from, DataLabel32 to)
+ {
+ return AssemblerType::getDifferenceBetweenLabels(from.m_label, to.m_label);
+ }
+
+ ptrdiff_t differenceBetween(DataLabelPtr from, Jump to)
+ {
+ return AssemblerType::getDifferenceBetweenLabels(from.m_label, to.m_jmp);
+ }
+
+ ptrdiff_t differenceBetween(DataLabelPtr from, DataLabelPtr to)
+ {
+ return AssemblerType::getDifferenceBetweenLabels(from.m_label, to.m_label);
+ }
+
+ ptrdiff_t differenceBetween(DataLabelPtr from, Call to)
+ {
+ return AssemblerType::getDifferenceBetweenLabels(from.m_label, to.m_jmp);
+ }
+
+ void beginUninterruptedSequence() { }
+ void endUninterruptedSequence() { }
+
+protected:
+ AssemblerType m_assembler;
+
+ friend class LinkBuffer;
+ friend class RepatchBuffer;
+
+ static void linkJump(void* code, Jump jump, CodeLocationLabel target)
+ {
+ AssemblerType::linkJump(code, jump.m_jmp, target.dataLocation());
+ }
+
+ static void linkPointer(void* code, typename AssemblerType::JmpDst label, void* value)
+ {
+ AssemblerType::linkPointer(code, label, value);
+ }
+
+ static void* getLinkerAddress(void* code, typename AssemblerType::JmpSrc label)
+ {
+ return AssemblerType::getRelocatedAddress(code, label);
+ }
+
+ static void* getLinkerAddress(void* code, typename AssemblerType::JmpDst label)
+ {
+ return AssemblerType::getRelocatedAddress(code, label);
+ }
+
+ static unsigned getLinkerCallReturnOffset(Call call)
+ {
+ return AssemblerType::getCallReturnOffset(call.m_jmp);
+ }
+
+ static void repatchJump(CodeLocationJump jump, CodeLocationLabel destination)
+ {
+ AssemblerType::relinkJump(jump.dataLocation(), destination.dataLocation());
+ }
+
+ static void repatchNearCall(CodeLocationNearCall nearCall, CodeLocationLabel destination)
+ {
+ AssemblerType::relinkCall(nearCall.dataLocation(), destination.executableAddress());
+ }
+
+ static void repatchInt32(CodeLocationDataLabel32 dataLabel32, int32_t value)
+ {
+ AssemblerType::repatchInt32(dataLabel32.dataLocation(), value);
+ }
+
+ static void repatchPointer(CodeLocationDataLabelPtr dataLabelPtr, void* value)
+ {
+ AssemblerType::repatchPointer(dataLabelPtr.dataLocation(), value);
+ }
+
+ static void repatchLoadPtrToLEA(CodeLocationInstruction instruction)
+ {
+ AssemblerType::repatchLoadPtrToLEA(instruction.dataLocation());
+ }
+};
+
+} // namespace JSC
+
+#endif // ENABLE(ASSEMBLER)
+
+#endif // AbstractMacroAssembler_h
diff --git a/Source/JavaScriptCore/assembler/AssemblerBuffer.h b/Source/JavaScriptCore/assembler/AssemblerBuffer.h
new file mode 100644
index 0000000..0454a99
--- /dev/null
+++ b/Source/JavaScriptCore/assembler/AssemblerBuffer.h
@@ -0,0 +1,173 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef AssemblerBuffer_h
+#define AssemblerBuffer_h
+
+#if ENABLE(ASSEMBLER)
+
+#include "stdint.h"
+#include <string.h>
+#include <jit/ExecutableAllocator.h>
+#include <wtf/Assertions.h>
+#include <wtf/FastMalloc.h>
+#include <wtf/StdLibExtras.h>
+
+namespace JSC {
+
+ class AssemblerBuffer {
+ static const int inlineCapacity = 128 - sizeof(char*) - 2 * sizeof(int);
+ public:
+ AssemblerBuffer()
+ : m_buffer(m_inlineBuffer)
+ , m_capacity(inlineCapacity)
+ , m_size(0)
+ {
+ COMPILE_ASSERT(sizeof(AssemblerBuffer) == 128, AssemblerBuffer_should_be_128_bytes);
+ }
+
+ ~AssemblerBuffer()
+ {
+ if (m_buffer != m_inlineBuffer)
+ fastFree(m_buffer);
+ }
+
+ void ensureSpace(int space)
+ {
+ if (m_size > m_capacity - space)
+ grow();
+ }
+
+ bool isAligned(int alignment) const
+ {
+ return !(m_size & (alignment - 1));
+ }
+
+ void putByteUnchecked(int value)
+ {
+ ASSERT(!(m_size > m_capacity - 4));
+ m_buffer[m_size] = value;
+ m_size++;
+ }
+
+ void putByte(int value)
+ {
+ if (m_size > m_capacity - 4)
+ grow();
+ putByteUnchecked(value);
+ }
+
+ void putShortUnchecked(int value)
+ {
+ ASSERT(!(m_size > m_capacity - 4));
+ *reinterpret_cast_ptr<short*>(&m_buffer[m_size]) = value;
+ m_size += 2;
+ }
+
+ void putShort(int value)
+ {
+ if (m_size > m_capacity - 4)
+ grow();
+ putShortUnchecked(value);
+ }
+
+ void putIntUnchecked(int value)
+ {
+ ASSERT(!(m_size > m_capacity - 4));
+ *reinterpret_cast_ptr<int*>(&m_buffer[m_size]) = value;
+ m_size += 4;
+ }
+
+ void putInt64Unchecked(int64_t value)
+ {
+ ASSERT(!(m_size > m_capacity - 8));
+ *reinterpret_cast_ptr<int64_t*>(&m_buffer[m_size]) = value;
+ m_size += 8;
+ }
+
+ void putInt(int value)
+ {
+ if (m_size > m_capacity - 4)
+ grow();
+ putIntUnchecked(value);
+ }
+
+ void* data() const
+ {
+ return m_buffer;
+ }
+
+ int size() const
+ {
+ return m_size;
+ }
+
+ void* executableCopy(ExecutablePool* allocator)
+ {
+ if (!m_size)
+ return 0;
+
+ void* result = allocator->alloc(m_size);
+
+ if (!result)
+ return 0;
+
+ ExecutableAllocator::makeWritable(result, m_size);
+
+ return memcpy(result, m_buffer, m_size);
+ }
+
+ protected:
+ void append(const char* data, int size)
+ {
+ if (m_size > m_capacity - size)
+ grow(size);
+
+ memcpy(m_buffer + m_size, data, size);
+ m_size += size;
+ }
+
+ void grow(int extraCapacity = 0)
+ {
+ m_capacity += m_capacity / 2 + extraCapacity;
+
+ if (m_buffer == m_inlineBuffer) {
+ char* newBuffer = static_cast<char*>(fastMalloc(m_capacity));
+ m_buffer = static_cast<char*>(memcpy(newBuffer, m_buffer, m_size));
+ } else
+ m_buffer = static_cast<char*>(fastRealloc(m_buffer, m_capacity));
+ }
+
+ char m_inlineBuffer[inlineCapacity];
+ char* m_buffer;
+ int m_capacity;
+ int m_size;
+ };
+
+} // namespace JSC
+
+#endif // ENABLE(ASSEMBLER)
+
+#endif // AssemblerBuffer_h
diff --git a/Source/JavaScriptCore/assembler/AssemblerBufferWithConstantPool.h b/Source/JavaScriptCore/assembler/AssemblerBufferWithConstantPool.h
new file mode 100644
index 0000000..599be14
--- /dev/null
+++ b/Source/JavaScriptCore/assembler/AssemblerBufferWithConstantPool.h
@@ -0,0 +1,317 @@
+/*
+ * Copyright (C) 2009 University of Szeged
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY UNIVERSITY OF SZEGED ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL UNIVERSITY OF SZEGED OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef AssemblerBufferWithConstantPool_h
+#define AssemblerBufferWithConstantPool_h
+
+#if ENABLE(ASSEMBLER)
+
+#include "AssemblerBuffer.h"
+#include <wtf/SegmentedVector.h>
+
+#define ASSEMBLER_HAS_CONSTANT_POOL 1
+
+namespace JSC {
+
+/*
+ On a constant pool 4 or 8 bytes data can be stored. The values can be
+ constants or addresses. The addresses should be 32 or 64 bits. The constants
+ should be double-precisions float or integer numbers which are hard to be
+ encoded as few machine instructions.
+
+ TODO: The pool is desinged to handle both 32 and 64 bits values, but
+ currently only the 4 bytes constants are implemented and tested.
+
+ The AssemblerBuffer can contain multiple constant pools. Each pool is inserted
+ into the instruction stream - protected by a jump instruction from the
+ execution flow.
+
+ The flush mechanism is called when no space remain to insert the next instruction
+ into the pool. Three values are used to determine when the constant pool itself
+ have to be inserted into the instruction stream (Assembler Buffer):
+
+ - maxPoolSize: size of the constant pool in bytes, this value cannot be
+ larger than the maximum offset of a PC relative memory load
+
+ - barrierSize: size of jump instruction in bytes which protects the
+ constant pool from execution
+
+ - maxInstructionSize: maximum length of a machine instruction in bytes
+
+ There are some callbacks which solve the target architecture specific
+ address handling:
+
+ - TYPE patchConstantPoolLoad(TYPE load, int value):
+ patch the 'load' instruction with the index of the constant in the
+ constant pool and return the patched instruction.
+
+ - void patchConstantPoolLoad(void* loadAddr, void* constPoolAddr):
+ patch the a PC relative load instruction at 'loadAddr' address with the
+ final relative offset. The offset can be computed with help of
+ 'constPoolAddr' (the address of the constant pool) and index of the
+ constant (which is stored previously in the load instruction itself).
+
+ - TYPE placeConstantPoolBarrier(int size):
+ return with a constant pool barrier instruction which jumps over the
+ constant pool.
+
+ The 'put*WithConstant*' functions should be used to place a data into the
+ constant pool.
+*/
+
+template <int maxPoolSize, int barrierSize, int maxInstructionSize, class AssemblerType>
+class AssemblerBufferWithConstantPool: public AssemblerBuffer {
+ typedef SegmentedVector<uint32_t, 512> LoadOffsets;
+public:
+ enum {
+ UniqueConst,
+ ReusableConst,
+ UnusedEntry,
+ };
+
+ AssemblerBufferWithConstantPool()
+ : AssemblerBuffer()
+ , m_numConsts(0)
+ , m_maxDistance(maxPoolSize)
+ , m_lastConstDelta(0)
+ {
+ m_pool = static_cast<uint32_t*>(fastMalloc(maxPoolSize));
+ m_mask = static_cast<char*>(fastMalloc(maxPoolSize / sizeof(uint32_t)));
+ }
+
+ ~AssemblerBufferWithConstantPool()
+ {
+ fastFree(m_mask);
+ fastFree(m_pool);
+ }
+
+ void ensureSpace(int space)
+ {
+ flushIfNoSpaceFor(space);
+ AssemblerBuffer::ensureSpace(space);
+ }
+
+ void ensureSpace(int insnSpace, int constSpace)
+ {
+ flushIfNoSpaceFor(insnSpace, constSpace);
+ AssemblerBuffer::ensureSpace(insnSpace);
+ }
+
+ bool isAligned(int alignment)
+ {
+ flushIfNoSpaceFor(alignment);
+ return AssemblerBuffer::isAligned(alignment);
+ }
+
+ void putByteUnchecked(int value)
+ {
+ AssemblerBuffer::putByteUnchecked(value);
+ correctDeltas(1);
+ }
+
+ void putByte(int value)
+ {
+ flushIfNoSpaceFor(1);
+ AssemblerBuffer::putByte(value);
+ correctDeltas(1);
+ }
+
+ void putShortUnchecked(int value)
+ {
+ AssemblerBuffer::putShortUnchecked(value);
+ correctDeltas(2);
+ }
+
+ void putShort(int value)
+ {
+ flushIfNoSpaceFor(2);
+ AssemblerBuffer::putShort(value);
+ correctDeltas(2);
+ }
+
+ void putIntUnchecked(int value)
+ {
+ AssemblerBuffer::putIntUnchecked(value);
+ correctDeltas(4);
+ }
+
+ void putInt(int value)
+ {
+ flushIfNoSpaceFor(4);
+ AssemblerBuffer::putInt(value);
+ correctDeltas(4);
+ }
+
+ void putInt64Unchecked(int64_t value)
+ {
+ AssemblerBuffer::putInt64Unchecked(value);
+ correctDeltas(8);
+ }
+
+ int size()
+ {
+ flushIfNoSpaceFor(maxInstructionSize, sizeof(uint64_t));
+ return AssemblerBuffer::size();
+ }
+
+ int uncheckedSize()
+ {
+ return AssemblerBuffer::size();
+ }
+
+ void* executableCopy(ExecutablePool* allocator)
+ {
+ flushConstantPool(false);
+ return AssemblerBuffer::executableCopy(allocator);
+ }
+
+ void putIntWithConstantInt(uint32_t insn, uint32_t constant, bool isReusable = false)
+ {
+ if (!m_numConsts)
+ m_maxDistance = maxPoolSize;
+ flushIfNoSpaceFor(4, 4);
+
+ m_loadOffsets.append(AssemblerBuffer::size());
+ if (isReusable)
+ for (int i = 0; i < m_numConsts; ++i) {
+ if (m_mask[i] == ReusableConst && m_pool[i] == constant) {
+ AssemblerBuffer::putInt(AssemblerType::patchConstantPoolLoad(insn, i));
+ correctDeltas(4);
+ return;
+ }
+ }
+
+ m_pool[m_numConsts] = constant;
+ m_mask[m_numConsts] = static_cast<char>(isReusable ? ReusableConst : UniqueConst);
+
+ AssemblerBuffer::putInt(AssemblerType::patchConstantPoolLoad(insn, m_numConsts));
+ ++m_numConsts;
+
+ correctDeltas(4, 4);
+ }
+
+ // This flushing mechanism can be called after any unconditional jumps.
+ void flushWithoutBarrier(bool isForced = false)
+ {
+ // Flush if constant pool is more than 60% full to avoid overuse of this function.
+ if (isForced || 5 * m_numConsts > 3 * maxPoolSize / sizeof(uint32_t))
+ flushConstantPool(false);
+ }
+
+ uint32_t* poolAddress()
+ {
+ return m_pool;
+ }
+
+ int sizeOfConstantPool()
+ {
+ return m_numConsts;
+ }
+
+private:
+ void correctDeltas(int insnSize)
+ {
+ m_maxDistance -= insnSize;
+ m_lastConstDelta -= insnSize;
+ if (m_lastConstDelta < 0)
+ m_lastConstDelta = 0;
+ }
+
+ void correctDeltas(int insnSize, int constSize)
+ {
+ correctDeltas(insnSize);
+
+ m_maxDistance -= m_lastConstDelta;
+ m_lastConstDelta = constSize;
+ }
+
+ void flushConstantPool(bool useBarrier = true)
+ {
+ if (m_numConsts == 0)
+ return;
+ int alignPool = (AssemblerBuffer::size() + (useBarrier ? barrierSize : 0)) & (sizeof(uint64_t) - 1);
+
+ if (alignPool)
+ alignPool = sizeof(uint64_t) - alignPool;
+
+ // Callback to protect the constant pool from execution
+ if (useBarrier)
+ AssemblerBuffer::putInt(AssemblerType::placeConstantPoolBarrier(m_numConsts * sizeof(uint32_t) + alignPool));
+
+ if (alignPool) {
+ if (alignPool & 1)
+ AssemblerBuffer::putByte(AssemblerType::padForAlign8);
+ if (alignPool & 2)
+ AssemblerBuffer::putShort(AssemblerType::padForAlign16);
+ if (alignPool & 4)
+ AssemblerBuffer::putInt(AssemblerType::padForAlign32);
+ }
+
+ int constPoolOffset = AssemblerBuffer::size();
+ append(reinterpret_cast<char*>(m_pool), m_numConsts * sizeof(uint32_t));
+
+ // Patch each PC relative load
+ for (LoadOffsets::Iterator iter = m_loadOffsets.begin(); iter != m_loadOffsets.end(); ++iter) {
+ void* loadAddr = reinterpret_cast<void*>(m_buffer + *iter);
+ AssemblerType::patchConstantPoolLoad(loadAddr, reinterpret_cast<void*>(m_buffer + constPoolOffset));
+ }
+
+ m_loadOffsets.clear();
+ m_numConsts = 0;
+ }
+
+ void flushIfNoSpaceFor(int nextInsnSize)
+ {
+ if (m_numConsts == 0)
+ return;
+ int lastConstDelta = m_lastConstDelta > nextInsnSize ? m_lastConstDelta - nextInsnSize : 0;
+ if ((m_maxDistance < nextInsnSize + lastConstDelta + barrierSize + (int)sizeof(uint32_t)))
+ flushConstantPool();
+ }
+
+ void flushIfNoSpaceFor(int nextInsnSize, int nextConstSize)
+ {
+ if (m_numConsts == 0)
+ return;
+ if ((m_maxDistance < nextInsnSize + m_lastConstDelta + nextConstSize + barrierSize + (int)sizeof(uint32_t)) ||
+ (m_numConsts * sizeof(uint32_t) + nextConstSize >= maxPoolSize))
+ flushConstantPool();
+ }
+
+ uint32_t* m_pool;
+ char* m_mask;
+ LoadOffsets m_loadOffsets;
+
+ int m_numConsts;
+ int m_maxDistance;
+ int m_lastConstDelta;
+};
+
+} // namespace JSC
+
+#endif // ENABLE(ASSEMBLER)
+
+#endif // AssemblerBufferWithConstantPool_h
diff --git a/Source/JavaScriptCore/assembler/CodeLocation.h b/Source/JavaScriptCore/assembler/CodeLocation.h
new file mode 100644
index 0000000..e29029b
--- /dev/null
+++ b/Source/JavaScriptCore/assembler/CodeLocation.h
@@ -0,0 +1,184 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CodeLocation_h
+#define CodeLocation_h
+
+#include "MacroAssemblerCodeRef.h"
+
+#if ENABLE(ASSEMBLER)
+
+namespace JSC {
+
+class CodeLocationInstruction;
+class CodeLocationLabel;
+class CodeLocationJump;
+class CodeLocationCall;
+class CodeLocationNearCall;
+class CodeLocationDataLabel32;
+class CodeLocationDataLabelPtr;
+
+// The CodeLocation* types are all pretty much do-nothing wrappers around
+// CodePtr (or MacroAssemblerCodePtr, to give it its full name). These
+// classes only exist to provide type-safety when linking and patching code.
+//
+// The one new piece of functionallity introduced by these classes is the
+// ability to create (or put another way, to re-discover) another CodeLocation
+// at an offset from one you already know. When patching code to optimize it
+// we often want to patch a number of instructions that are short, fixed
+// offsets apart. To reduce memory overhead we will only retain a pointer to
+// one of the instructions, and we will use the *AtOffset methods provided by
+// CodeLocationCommon to find the other points in the code to modify.
+class CodeLocationCommon : public MacroAssemblerCodePtr {
+public:
+ CodeLocationInstruction instructionAtOffset(int offset);
+ CodeLocationLabel labelAtOffset(int offset);
+ CodeLocationJump jumpAtOffset(int offset);
+ CodeLocationCall callAtOffset(int offset);
+ CodeLocationNearCall nearCallAtOffset(int offset);
+ CodeLocationDataLabelPtr dataLabelPtrAtOffset(int offset);
+ CodeLocationDataLabel32 dataLabel32AtOffset(int offset);
+
+protected:
+ CodeLocationCommon()
+ {
+ }
+
+ CodeLocationCommon(MacroAssemblerCodePtr location)
+ : MacroAssemblerCodePtr(location)
+ {
+ }
+};
+
+class CodeLocationInstruction : public CodeLocationCommon {
+public:
+ CodeLocationInstruction() {}
+ explicit CodeLocationInstruction(MacroAssemblerCodePtr location)
+ : CodeLocationCommon(location) {}
+ explicit CodeLocationInstruction(void* location)
+ : CodeLocationCommon(MacroAssemblerCodePtr(location)) {}
+};
+
+class CodeLocationLabel : public CodeLocationCommon {
+public:
+ CodeLocationLabel() {}
+ explicit CodeLocationLabel(MacroAssemblerCodePtr location)
+ : CodeLocationCommon(location) {}
+ explicit CodeLocationLabel(void* location)
+ : CodeLocationCommon(MacroAssemblerCodePtr(location)) {}
+};
+
+class CodeLocationJump : public CodeLocationCommon {
+public:
+ CodeLocationJump() {}
+ explicit CodeLocationJump(MacroAssemblerCodePtr location)
+ : CodeLocationCommon(location) {}
+ explicit CodeLocationJump(void* location)
+ : CodeLocationCommon(MacroAssemblerCodePtr(location)) {}
+};
+
+class CodeLocationCall : public CodeLocationCommon {
+public:
+ CodeLocationCall() {}
+ explicit CodeLocationCall(MacroAssemblerCodePtr location)
+ : CodeLocationCommon(location) {}
+ explicit CodeLocationCall(void* location)
+ : CodeLocationCommon(MacroAssemblerCodePtr(location)) {}
+};
+
+class CodeLocationNearCall : public CodeLocationCommon {
+public:
+ CodeLocationNearCall() {}
+ explicit CodeLocationNearCall(MacroAssemblerCodePtr location)
+ : CodeLocationCommon(location) {}
+ explicit CodeLocationNearCall(void* location)
+ : CodeLocationCommon(MacroAssemblerCodePtr(location)) {}
+};
+
+class CodeLocationDataLabel32 : public CodeLocationCommon {
+public:
+ CodeLocationDataLabel32() {}
+ explicit CodeLocationDataLabel32(MacroAssemblerCodePtr location)
+ : CodeLocationCommon(location) {}
+ explicit CodeLocationDataLabel32(void* location)
+ : CodeLocationCommon(MacroAssemblerCodePtr(location)) {}
+};
+
+class CodeLocationDataLabelPtr : public CodeLocationCommon {
+public:
+ CodeLocationDataLabelPtr() {}
+ explicit CodeLocationDataLabelPtr(MacroAssemblerCodePtr location)
+ : CodeLocationCommon(location) {}
+ explicit CodeLocationDataLabelPtr(void* location)
+ : CodeLocationCommon(MacroAssemblerCodePtr(location)) {}
+};
+
+inline CodeLocationInstruction CodeLocationCommon::instructionAtOffset(int offset)
+{
+ ASSERT_VALID_CODE_OFFSET(offset);
+ return CodeLocationInstruction(reinterpret_cast<char*>(dataLocation()) + offset);
+}
+
+inline CodeLocationLabel CodeLocationCommon::labelAtOffset(int offset)
+{
+ ASSERT_VALID_CODE_OFFSET(offset);
+ return CodeLocationLabel(reinterpret_cast<char*>(dataLocation()) + offset);
+}
+
+inline CodeLocationJump CodeLocationCommon::jumpAtOffset(int offset)
+{
+ ASSERT_VALID_CODE_OFFSET(offset);
+ return CodeLocationJump(reinterpret_cast<char*>(dataLocation()) + offset);
+}
+
+inline CodeLocationCall CodeLocationCommon::callAtOffset(int offset)
+{
+ ASSERT_VALID_CODE_OFFSET(offset);
+ return CodeLocationCall(reinterpret_cast<char*>(dataLocation()) + offset);
+}
+
+inline CodeLocationNearCall CodeLocationCommon::nearCallAtOffset(int offset)
+{
+ ASSERT_VALID_CODE_OFFSET(offset);
+ return CodeLocationNearCall(reinterpret_cast<char*>(dataLocation()) + offset);
+}
+
+inline CodeLocationDataLabelPtr CodeLocationCommon::dataLabelPtrAtOffset(int offset)
+{
+ ASSERT_VALID_CODE_OFFSET(offset);
+ return CodeLocationDataLabelPtr(reinterpret_cast<char*>(dataLocation()) + offset);
+}
+
+inline CodeLocationDataLabel32 CodeLocationCommon::dataLabel32AtOffset(int offset)
+{
+ ASSERT_VALID_CODE_OFFSET(offset);
+ return CodeLocationDataLabel32(reinterpret_cast<char*>(dataLocation()) + offset);
+}
+
+} // namespace JSC
+
+#endif // ENABLE(ASSEMBLER)
+
+#endif // CodeLocation_h
diff --git a/Source/JavaScriptCore/assembler/LinkBuffer.h b/Source/JavaScriptCore/assembler/LinkBuffer.h
new file mode 100644
index 0000000..e38b9d4
--- /dev/null
+++ b/Source/JavaScriptCore/assembler/LinkBuffer.h
@@ -0,0 +1,350 @@
+/*
+ * Copyright (C) 2009, 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef LinkBuffer_h
+#define LinkBuffer_h
+
+#if ENABLE(ASSEMBLER)
+
+#define DUMP_LINK_STATISTICS 0
+#define DUMP_CODE 0
+
+#include <MacroAssembler.h>
+#include <wtf/Noncopyable.h>
+
+namespace JSC {
+
+// LinkBuffer:
+//
+// This class assists in linking code generated by the macro assembler, once code generation
+// has been completed, and the code has been copied to is final location in memory. At this
+// time pointers to labels within the code may be resolved, and relative offsets to external
+// addresses may be fixed.
+//
+// Specifically:
+// * Jump objects may be linked to external targets,
+// * The address of Jump objects may taken, such that it can later be relinked.
+// * The return address of a Call may be acquired.
+// * The address of a Label pointing into the code may be resolved.
+// * The value referenced by a DataLabel may be set.
+//
+class LinkBuffer : public Noncopyable {
+ typedef MacroAssemblerCodeRef CodeRef;
+ typedef MacroAssemblerCodePtr CodePtr;
+ typedef MacroAssembler::Label Label;
+ typedef MacroAssembler::Jump Jump;
+ typedef MacroAssembler::JumpList JumpList;
+ typedef MacroAssembler::Call Call;
+ typedef MacroAssembler::DataLabel32 DataLabel32;
+ typedef MacroAssembler::DataLabelPtr DataLabelPtr;
+ typedef MacroAssembler::JmpDst JmpDst;
+#if ENABLE(BRANCH_COMPACTION)
+ typedef MacroAssembler::LinkRecord LinkRecord;
+ typedef MacroAssembler::JumpLinkType JumpLinkType;
+#endif
+
+public:
+ // Note: Initialization sequence is significant, since executablePool is a PassRefPtr.
+ // First, executablePool is copied into m_executablePool, then the initialization of
+ // m_code uses m_executablePool, *not* executablePool, since this is no longer valid.
+ // The linkOffset parameter should only be non-null when recompiling for exception info
+ LinkBuffer(MacroAssembler* masm, PassRefPtr<ExecutablePool> executablePool, void* linkOffset)
+ : m_executablePool(executablePool)
+ , m_size(0)
+ , m_code(0)
+ , m_assembler(masm)
+#ifndef NDEBUG
+ , m_completed(false)
+#endif
+ {
+ linkCode(linkOffset);
+ }
+
+ ~LinkBuffer()
+ {
+ ASSERT(m_completed);
+ }
+
+ // These methods are used to link or set values at code generation time.
+
+ void link(Call call, FunctionPtr function)
+ {
+ ASSERT(call.isFlagSet(Call::Linkable));
+ call.m_jmp = applyOffset(call.m_jmp);
+ MacroAssembler::linkCall(code(), call, function);
+ }
+
+ void link(Jump jump, CodeLocationLabel label)
+ {
+ jump.m_jmp = applyOffset(jump.m_jmp);
+ MacroAssembler::linkJump(code(), jump, label);
+ }
+
+ void link(JumpList list, CodeLocationLabel label)
+ {
+ for (unsigned i = 0; i < list.m_jumps.size(); ++i)
+ link(list.m_jumps[i], label);
+ }
+
+ void patch(DataLabelPtr label, void* value)
+ {
+ JmpDst target = applyOffset(label.m_label);
+ MacroAssembler::linkPointer(code(), target, value);
+ }
+
+ void patch(DataLabelPtr label, CodeLocationLabel value)
+ {
+ JmpDst target = applyOffset(label.m_label);
+ MacroAssembler::linkPointer(code(), target, value.executableAddress());
+ }
+
+ // These methods are used to obtain handles to allow the code to be relinked / repatched later.
+
+ CodeLocationCall locationOf(Call call)
+ {
+ ASSERT(call.isFlagSet(Call::Linkable));
+ ASSERT(!call.isFlagSet(Call::Near));
+ return CodeLocationCall(MacroAssembler::getLinkerAddress(code(), applyOffset(call.m_jmp)));
+ }
+
+ CodeLocationNearCall locationOfNearCall(Call call)
+ {
+ ASSERT(call.isFlagSet(Call::Linkable));
+ ASSERT(call.isFlagSet(Call::Near));
+ return CodeLocationNearCall(MacroAssembler::getLinkerAddress(code(), applyOffset(call.m_jmp)));
+ }
+
+ CodeLocationLabel locationOf(Label label)
+ {
+ return CodeLocationLabel(MacroAssembler::getLinkerAddress(code(), applyOffset(label.m_label)));
+ }
+
+ CodeLocationDataLabelPtr locationOf(DataLabelPtr label)
+ {
+ return CodeLocationDataLabelPtr(MacroAssembler::getLinkerAddress(code(), applyOffset(label.m_label)));
+ }
+
+ CodeLocationDataLabel32 locationOf(DataLabel32 label)
+ {
+ return CodeLocationDataLabel32(MacroAssembler::getLinkerAddress(code(), applyOffset(label.m_label)));
+ }
+
+ // This method obtains the return address of the call, given as an offset from
+ // the start of the code.
+ unsigned returnAddressOffset(Call call)
+ {
+ call.m_jmp = applyOffset(call.m_jmp);
+ return MacroAssembler::getLinkerCallReturnOffset(call);
+ }
+
+ // Upon completion of all patching either 'finalizeCode()' or 'finalizeCodeAddendum()' should be called
+ // once to complete generation of the code. 'finalizeCode()' is suited to situations
+ // where the executable pool must also be retained, the lighter-weight 'finalizeCodeAddendum()' is
+ // suited to adding to an existing allocation.
+ CodeRef finalizeCode()
+ {
+ performFinalization();
+
+ return CodeRef(m_code, m_executablePool, m_size);
+ }
+
+ CodeLocationLabel finalizeCodeAddendum()
+ {
+ performFinalization();
+
+ return CodeLocationLabel(code());
+ }
+
+ CodePtr trampolineAt(Label label)
+ {
+ return CodePtr(MacroAssembler::AssemblerType_T::getRelocatedAddress(code(), applyOffset(label.m_label)));
+ }
+
+private:
+ template <typename T> T applyOffset(T src)
+ {
+#if ENABLE(BRANCH_COMPACTION)
+ src.m_offset -= m_assembler->executableOffsetFor(src.m_offset);
+#endif
+ return src;
+ }
+
+ // Keep this private! - the underlying code should only be obtained externally via
+ // finalizeCode() or finalizeCodeAddendum().
+ void* code()
+ {
+ return m_code;
+ }
+
+ void linkCode(void* linkOffset)
+ {
+ UNUSED_PARAM(linkOffset);
+ ASSERT(!m_code);
+#if !ENABLE(BRANCH_COMPACTION)
+ m_code = m_assembler->m_assembler.executableCopy(m_executablePool.get());
+ m_size = m_assembler->size();
+#else
+ size_t initialSize = m_assembler->size();
+ m_code = (uint8_t*)m_executablePool->alloc(initialSize);
+ if (!m_code)
+ return;
+ ExecutableAllocator::makeWritable(m_code, m_assembler->size());
+ uint8_t* inData = (uint8_t*)m_assembler->unlinkedCode();
+ uint8_t* outData = reinterpret_cast<uint8_t*>(m_code);
+ const uint8_t* linkBase = linkOffset ? reinterpret_cast<uint8_t*>(linkOffset) : outData;
+ int readPtr = 0;
+ int writePtr = 0;
+ Vector<LinkRecord>& jumpsToLink = m_assembler->jumpsToLink();
+ unsigned jumpCount = jumpsToLink.size();
+ for (unsigned i = 0; i < jumpCount; ++i) {
+ int offset = readPtr - writePtr;
+ ASSERT(!(offset & 1));
+
+ // Copy the instructions from the last jump to the current one.
+ size_t regionSize = jumpsToLink[i].from() - readPtr;
+ memcpy(outData + writePtr, inData + readPtr, regionSize);
+ m_assembler->recordLinkOffsets(readPtr, jumpsToLink[i].from(), offset);
+ readPtr += regionSize;
+ writePtr += regionSize;
+
+ // Calculate absolute address of the jump target, in the case of backwards
+ // branches we need to be precise, forward branches we are pessimistic
+ const uint8_t* target;
+ if (jumpsToLink[i].to() >= jumpsToLink[i].from())
+ target = linkBase + jumpsToLink[i].to() - offset; // Compensate for what we have collapsed so far
+ else
+ target = linkBase + jumpsToLink[i].to() - m_assembler->executableOffsetFor(jumpsToLink[i].to());
+
+ JumpLinkType jumpLinkType = m_assembler->computeJumpType(jumpsToLink[i], linkBase + writePtr, target);
+ // Compact branch if we can...
+ if (m_assembler->canCompact(jumpsToLink[i].type())) {
+ // Step back in the write stream
+ int32_t delta = m_assembler->jumpSizeDelta(jumpsToLink[i].type(), jumpLinkType);
+ if (delta) {
+ writePtr -= delta;
+ m_assembler->recordLinkOffsets(jumpsToLink[i].from() - delta, readPtr, readPtr - writePtr);
+ }
+ }
+ jumpsToLink[i].setFrom(writePtr);
+ }
+ // Copy everything after the last jump
+ memcpy(outData + writePtr, inData + readPtr, m_assembler->size() - readPtr);
+ m_assembler->recordLinkOffsets(readPtr, m_assembler->size(), readPtr - writePtr);
+
+ // Actually link everything (don't link if we've be given a linkoffset as it's a
+ // waste of time: linkOffset is used for recompiling to get exception info)
+ if (!linkOffset) {
+ for (unsigned i = 0; i < jumpCount; ++i) {
+ uint8_t* location = outData + jumpsToLink[i].from();
+ uint8_t* target = outData + jumpsToLink[i].to() - m_assembler->executableOffsetFor(jumpsToLink[i].to());
+ m_assembler->link(jumpsToLink[i], location, target);
+ }
+ }
+
+ jumpsToLink.clear();
+ m_size = writePtr + m_assembler->size() - readPtr;
+ m_executablePool->tryShrink(m_code, initialSize, m_size);
+
+#if DUMP_LINK_STATISTICS
+ dumpLinkStatistics(m_code, initialSize, m_size);
+#endif
+#if DUMP_CODE
+ dumpCode(m_code, m_size);
+#endif
+#endif
+ }
+
+ void performFinalization()
+ {
+#ifndef NDEBUG
+ ASSERT(!m_completed);
+ m_completed = true;
+#endif
+
+ ExecutableAllocator::makeExecutable(code(), m_size);
+ ExecutableAllocator::cacheFlush(code(), m_size);
+ }
+
+#if DUMP_LINK_STATISTICS
+ static void dumpLinkStatistics(void* code, size_t initialSize, size_t finalSize)
+ {
+ static unsigned linkCount = 0;
+ static unsigned totalInitialSize = 0;
+ static unsigned totalFinalSize = 0;
+ linkCount++;
+ totalInitialSize += initialSize;
+ totalFinalSize += finalSize;
+ printf("link %p: orig %u, compact %u (delta %u, %.2f%%)\n",
+ code, static_cast<unsigned>(initialSize), static_cast<unsigned>(finalSize),
+ static_cast<unsigned>(initialSize - finalSize),
+ 100.0 * (initialSize - finalSize) / initialSize);
+ printf("\ttotal %u: orig %u, compact %u (delta %u, %.2f%%)\n",
+ linkCount, totalInitialSize, totalFinalSize, totalInitialSize - totalFinalSize,
+ 100.0 * (totalInitialSize - totalFinalSize) / totalInitialSize);
+ }
+#endif
+
+#if DUMP_CODE
+ static void dumpCode(void* code, size_t size)
+ {
+#if CPU(ARM_THUMB2)
+ // Dump the generated code in an asm file format that can be assembled and then disassembled
+ // for debugging purposes. For example, save this output as jit.s:
+ // gcc -arch armv7 -c jit.s
+ // otool -tv jit.o
+ static unsigned codeCount = 0;
+ unsigned short* tcode = static_cast<unsigned short*>(code);
+ size_t tsize = size / sizeof(short);
+ char nameBuf[128];
+ snprintf(nameBuf, sizeof(nameBuf), "_jsc_jit%u", codeCount++);
+ printf("\t.syntax unified\n"
+ "\t.section\t__TEXT,__text,regular,pure_instructions\n"
+ "\t.globl\t%s\n"
+ "\t.align 2\n"
+ "\t.code 16\n"
+ "\t.thumb_func\t%s\n"
+ "# %p\n"
+ "%s:\n", nameBuf, nameBuf, code, nameBuf);
+
+ for (unsigned i = 0; i < tsize; i++)
+ printf("\t.short\t0x%x\n", tcode[i]);
+#endif
+ }
+#endif
+
+ RefPtr<ExecutablePool> m_executablePool;
+ size_t m_size;
+ void* m_code;
+ MacroAssembler* m_assembler;
+#ifndef NDEBUG
+ bool m_completed;
+#endif
+};
+
+} // namespace JSC
+
+#endif // ENABLE(ASSEMBLER)
+
+#endif // LinkBuffer_h
diff --git a/Source/JavaScriptCore/assembler/MIPSAssembler.h b/Source/JavaScriptCore/assembler/MIPSAssembler.h
new file mode 100644
index 0000000..f7bea6c
--- /dev/null
+++ b/Source/JavaScriptCore/assembler/MIPSAssembler.h
@@ -0,0 +1,984 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2009 University of Szeged
+ * All rights reserved.
+ * Copyright (C) 2010 MIPS Technologies, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY MIPS TECHNOLOGIES, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MIPS TECHNOLOGIES, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef MIPSAssembler_h
+#define MIPSAssembler_h
+
+#if ENABLE(ASSEMBLER) && CPU(MIPS)
+
+#include "AssemblerBuffer.h"
+#include <wtf/Assertions.h>
+#include <wtf/SegmentedVector.h>
+
+namespace JSC {
+
+typedef uint32_t MIPSWord;
+
+namespace MIPSRegisters {
+typedef enum {
+ r0 = 0,
+ r1,
+ r2,
+ r3,
+ r4,
+ r5,
+ r6,
+ r7,
+ r8,
+ r9,
+ r10,
+ r11,
+ r12,
+ r13,
+ r14,
+ r15,
+ r16,
+ r17,
+ r18,
+ r19,
+ r20,
+ r21,
+ r22,
+ r23,
+ r24,
+ r25,
+ r26,
+ r27,
+ r28,
+ r29,
+ r30,
+ r31,
+ zero = r0,
+ at = r1,
+ v0 = r2,
+ v1 = r3,
+ a0 = r4,
+ a1 = r5,
+ a2 = r6,
+ a3 = r7,
+ t0 = r8,
+ t1 = r9,
+ t2 = r10,
+ t3 = r11,
+ t4 = r12,
+ t5 = r13,
+ t6 = r14,
+ t7 = r15,
+ s0 = r16,
+ s1 = r17,
+ s2 = r18,
+ s3 = r19,
+ s4 = r20,
+ s5 = r21,
+ s6 = r22,
+ s7 = r23,
+ t8 = r24,
+ t9 = r25,
+ k0 = r26,
+ k1 = r27,
+ gp = r28,
+ sp = r29,
+ fp = r30,
+ ra = r31
+} RegisterID;
+
+typedef enum {
+ f0,
+ f1,
+ f2,
+ f3,
+ f4,
+ f5,
+ f6,
+ f7,
+ f8,
+ f9,
+ f10,
+ f11,
+ f12,
+ f13,
+ f14,
+ f15,
+ f16,
+ f17,
+ f18,
+ f19,
+ f20,
+ f21,
+ f22,
+ f23,
+ f24,
+ f25,
+ f26,
+ f27,
+ f28,
+ f29,
+ f30,
+ f31
+} FPRegisterID;
+
+} // namespace MIPSRegisters
+
+class MIPSAssembler {
+public:
+ typedef MIPSRegisters::RegisterID RegisterID;
+ typedef MIPSRegisters::FPRegisterID FPRegisterID;
+ typedef SegmentedVector<int, 64> Jumps;
+
+ MIPSAssembler()
+ {
+ }
+
+ // MIPS instruction opcode field position
+ enum {
+ OP_SH_RD = 11,
+ OP_SH_RT = 16,
+ OP_SH_RS = 21,
+ OP_SH_SHAMT = 6,
+ OP_SH_CODE = 16,
+ OP_SH_FD = 6,
+ OP_SH_FS = 11,
+ OP_SH_FT = 16
+ };
+
+ class JmpSrc {
+ friend class MIPSAssembler;
+ public:
+ JmpSrc()
+ : m_offset(-1)
+ {
+ }
+
+ private:
+ JmpSrc(int offset)
+ : m_offset(offset)
+ {
+ }
+
+ int m_offset;
+ };
+
+ class JmpDst {
+ friend class MIPSAssembler;
+ public:
+ JmpDst()
+ : m_offset(-1)
+ , m_used(false)
+ {
+ }
+
+ bool isUsed() const { return m_used; }
+ bool isSet() const { return (m_offset != -1); }
+ void used() { m_used = true; }
+ private:
+ JmpDst(int offset)
+ : m_offset(offset)
+ , m_used(false)
+ {
+ ASSERT(m_offset == offset);
+ }
+
+ int m_offset : 31;
+ int m_used : 1;
+ };
+
+ void emitInst(MIPSWord op)
+ {
+ void* oldBase = m_buffer.data();
+
+ m_buffer.putInt(op);
+
+ void* newBase = m_buffer.data();
+ if (oldBase != newBase)
+ relocateJumps(oldBase, newBase);
+ }
+
+ void nop()
+ {
+ emitInst(0x00000000);
+ }
+
+ /* Need to insert one load data delay nop for mips1. */
+ void loadDelayNop()
+ {
+#if WTF_MIPS_ISA(1)
+ nop();
+#endif
+ }
+
+ /* Need to insert one coprocessor access delay nop for mips1. */
+ void copDelayNop()
+ {
+#if WTF_MIPS_ISA(1)
+ nop();
+#endif
+ }
+
+ void move(RegisterID rd, RegisterID rs)
+ {
+ /* addu */
+ emitInst(0x00000021 | (rd << OP_SH_RD) | (rs << OP_SH_RS));
+ }
+
+ /* Set an immediate value to a register. This may generate 1 or 2
+ instructions. */
+ void li(RegisterID dest, int imm)
+ {
+ if (imm >= -32768 && imm <= 32767)
+ addiu(dest, MIPSRegisters::zero, imm);
+ else if (imm >= 0 && imm < 65536)
+ ori(dest, MIPSRegisters::zero, imm);
+ else {
+ lui(dest, imm >> 16);
+ if (imm & 0xffff)
+ ori(dest, dest, imm);
+ }
+ }
+
+ void lui(RegisterID rt, int imm)
+ {
+ emitInst(0x3c000000 | (rt << OP_SH_RT) | (imm & 0xffff));
+ }
+
+ void addiu(RegisterID rt, RegisterID rs, int imm)
+ {
+ emitInst(0x24000000 | (rt << OP_SH_RT) | (rs << OP_SH_RS)
+ | (imm & 0xffff));
+ }
+
+ void addu(RegisterID rd, RegisterID rs, RegisterID rt)
+ {
+ emitInst(0x00000021 | (rd << OP_SH_RD) | (rs << OP_SH_RS)
+ | (rt << OP_SH_RT));
+ }
+
+ void subu(RegisterID rd, RegisterID rs, RegisterID rt)
+ {
+ emitInst(0x00000023 | (rd << OP_SH_RD) | (rs << OP_SH_RS)
+ | (rt << OP_SH_RT));
+ }
+
+ void mult(RegisterID rs, RegisterID rt)
+ {
+ emitInst(0x00000018 | (rs << OP_SH_RS) | (rt << OP_SH_RT));
+ }
+
+ void div(RegisterID rs, RegisterID rt)
+ {
+ emitInst(0x0000001a | (rs << OP_SH_RS) | (rt << OP_SH_RT));
+ }
+
+ void mfhi(RegisterID rd)
+ {
+ emitInst(0x00000010 | (rd << OP_SH_RD));
+ }
+
+ void mflo(RegisterID rd)
+ {
+ emitInst(0x00000012 | (rd << OP_SH_RD));
+ }
+
+ void mul(RegisterID rd, RegisterID rs, RegisterID rt)
+ {
+#if WTF_MIPS_ISA_AT_LEAST(32)
+ emitInst(0x70000002 | (rd << OP_SH_RD) | (rs << OP_SH_RS)
+ | (rt << OP_SH_RT));
+#else
+ mult(rs, rt);
+ mflo(rd);
+#endif
+ }
+
+ void andInsn(RegisterID rd, RegisterID rs, RegisterID rt)
+ {
+ emitInst(0x00000024 | (rd << OP_SH_RD) | (rs << OP_SH_RS)
+ | (rt << OP_SH_RT));
+ }
+
+ void andi(RegisterID rt, RegisterID rs, int imm)
+ {
+ emitInst(0x30000000 | (rt << OP_SH_RT) | (rs << OP_SH_RS)
+ | (imm & 0xffff));
+ }
+
+ void nor(RegisterID rd, RegisterID rs, RegisterID rt)
+ {
+ emitInst(0x00000027 | (rd << OP_SH_RD) | (rs << OP_SH_RS)
+ | (rt << OP_SH_RT));
+ }
+
+ void orInsn(RegisterID rd, RegisterID rs, RegisterID rt)
+ {
+ emitInst(0x00000025 | (rd << OP_SH_RD) | (rs << OP_SH_RS)
+ | (rt << OP_SH_RT));
+ }
+
+ void ori(RegisterID rt, RegisterID rs, int imm)
+ {
+ emitInst(0x34000000 | (rt << OP_SH_RT) | (rs << OP_SH_RS)
+ | (imm & 0xffff));
+ }
+
+ void xorInsn(RegisterID rd, RegisterID rs, RegisterID rt)
+ {
+ emitInst(0x00000026 | (rd << OP_SH_RD) | (rs << OP_SH_RS)
+ | (rt << OP_SH_RT));
+ }
+
+ void xori(RegisterID rt, RegisterID rs, int imm)
+ {
+ emitInst(0x38000000 | (rt << OP_SH_RT) | (rs << OP_SH_RS)
+ | (imm & 0xffff));
+ }
+
+ void slt(RegisterID rd, RegisterID rs, RegisterID rt)
+ {
+ emitInst(0x0000002a | (rd << OP_SH_RD) | (rs << OP_SH_RS)
+ | (rt << OP_SH_RT));
+ }
+
+ void sltu(RegisterID rd, RegisterID rs, RegisterID rt)
+ {
+ emitInst(0x0000002b | (rd << OP_SH_RD) | (rs << OP_SH_RS)
+ | (rt << OP_SH_RT));
+ }
+
+ void sltiu(RegisterID rt, RegisterID rs, int imm)
+ {
+ emitInst(0x2c000000 | (rt << OP_SH_RT) | (rs << OP_SH_RS)
+ | (imm & 0xffff));
+ }
+
+ void sll(RegisterID rd, RegisterID rt, int shamt)
+ {
+ emitInst(0x00000000 | (rd << OP_SH_RD) | (rt << OP_SH_RT)
+ | ((shamt & 0x1f) << OP_SH_SHAMT));
+ }
+
+ void sllv(RegisterID rd, RegisterID rt, int rs)
+ {
+ emitInst(0x00000004 | (rd << OP_SH_RD) | (rt << OP_SH_RT)
+ | (rs << OP_SH_RS));
+ }
+
+ void sra(RegisterID rd, RegisterID rt, int shamt)
+ {
+ emitInst(0x00000003 | (rd << OP_SH_RD) | (rt << OP_SH_RT)
+ | ((shamt & 0x1f) << OP_SH_SHAMT));
+ }
+
+ void srav(RegisterID rd, RegisterID rt, RegisterID rs)
+ {
+ emitInst(0x00000007 | (rd << OP_SH_RD) | (rt << OP_SH_RT)
+ | (rs << OP_SH_RS));
+ }
+
+ void srl(RegisterID rd, RegisterID rt, int shamt)
+ {
+ emitInst(0x00000002 | (rd << OP_SH_RD) | (rt << OP_SH_RT)
+ | ((shamt & 0x1f) << OP_SH_SHAMT));
+ }
+
+ void srlv(RegisterID rd, RegisterID rt, RegisterID rs)
+ {
+ emitInst(0x00000006 | (rd << OP_SH_RD) | (rt << OP_SH_RT)
+ | (rs << OP_SH_RS));
+ }
+
+ void lbu(RegisterID rt, RegisterID rs, int offset)
+ {
+ emitInst(0x90000000 | (rt << OP_SH_RT) | (rs << OP_SH_RS)
+ | (offset & 0xffff));
+ loadDelayNop();
+ }
+
+ void lw(RegisterID rt, RegisterID rs, int offset)
+ {
+ emitInst(0x8c000000 | (rt << OP_SH_RT) | (rs << OP_SH_RS)
+ | (offset & 0xffff));
+ loadDelayNop();
+ }
+
+ void lwl(RegisterID rt, RegisterID rs, int offset)
+ {
+ emitInst(0x88000000 | (rt << OP_SH_RT) | (rs << OP_SH_RS)
+ | (offset & 0xffff));
+ loadDelayNop();
+ }
+
+ void lwr(RegisterID rt, RegisterID rs, int offset)
+ {
+ emitInst(0x98000000 | (rt << OP_SH_RT) | (rs << OP_SH_RS)
+ | (offset & 0xffff));
+ loadDelayNop();
+ }
+
+ void lhu(RegisterID rt, RegisterID rs, int offset)
+ {
+ emitInst(0x94000000 | (rt << OP_SH_RT) | (rs << OP_SH_RS)
+ | (offset & 0xffff));
+ loadDelayNop();
+ }
+
+ void sw(RegisterID rt, RegisterID rs, int offset)
+ {
+ emitInst(0xac000000 | (rt << OP_SH_RT) | (rs << OP_SH_RS)
+ | (offset & 0xffff));
+ }
+
+ void jr(RegisterID rs)
+ {
+ emitInst(0x00000008 | (rs << OP_SH_RS));
+ }
+
+ void jalr(RegisterID rs)
+ {
+ emitInst(0x0000f809 | (rs << OP_SH_RS));
+ }
+
+ void jal()
+ {
+ emitInst(0x0c000000);
+ }
+
+ void bkpt()
+ {
+ int value = 512; /* BRK_BUG */
+ emitInst(0x0000000d | ((value & 0x3ff) << OP_SH_CODE));
+ }
+
+ void bgez(RegisterID rs, int imm)
+ {
+ emitInst(0x04010000 | (rs << OP_SH_RS) | (imm & 0xffff));
+ }
+
+ void bltz(RegisterID rs, int imm)
+ {
+ emitInst(0x04000000 | (rs << OP_SH_RS) | (imm & 0xffff));
+ }
+
+ void beq(RegisterID rs, RegisterID rt, int imm)
+ {
+ emitInst(0x10000000 | (rs << OP_SH_RS) | (rt << OP_SH_RT) | (imm & 0xffff));
+ }
+
+ void bne(RegisterID rs, RegisterID rt, int imm)
+ {
+ emitInst(0x14000000 | (rs << OP_SH_RS) | (rt << OP_SH_RT) | (imm & 0xffff));
+ }
+
+ void bc1t()
+ {
+ emitInst(0x45010000);
+ }
+
+ void bc1f()
+ {
+ emitInst(0x45000000);
+ }
+
+ JmpSrc newJmpSrc()
+ {
+ return JmpSrc(m_buffer.size());
+ }
+
+ void appendJump()
+ {
+ m_jumps.append(m_buffer.size());
+ }
+
+ void addd(FPRegisterID fd, FPRegisterID fs, FPRegisterID ft)
+ {
+ emitInst(0x46200000 | (fd << OP_SH_FD) | (fs << OP_SH_FS)
+ | (ft << OP_SH_FT));
+ }
+
+ void subd(FPRegisterID fd, FPRegisterID fs, FPRegisterID ft)
+ {
+ emitInst(0x46200001 | (fd << OP_SH_FD) | (fs << OP_SH_FS)
+ | (ft << OP_SH_FT));
+ }
+
+ void muld(FPRegisterID fd, FPRegisterID fs, FPRegisterID ft)
+ {
+ emitInst(0x46200002 | (fd << OP_SH_FD) | (fs << OP_SH_FS)
+ | (ft << OP_SH_FT));
+ }
+
+ void divd(FPRegisterID fd, FPRegisterID fs, FPRegisterID ft)
+ {
+ emitInst(0x46200003 | (fd << OP_SH_FD) | (fs << OP_SH_FS)
+ | (ft << OP_SH_FT));
+ }
+
+ void lwc1(FPRegisterID ft, RegisterID rs, int offset)
+ {
+ emitInst(0xc4000000 | (ft << OP_SH_FT) | (rs << OP_SH_RS)
+ | (offset & 0xffff));
+ copDelayNop();
+ }
+
+ void ldc1(FPRegisterID ft, RegisterID rs, int offset)
+ {
+ emitInst(0xd4000000 | (ft << OP_SH_FT) | (rs << OP_SH_RS)
+ | (offset & 0xffff));
+ }
+
+ void swc1(FPRegisterID ft, RegisterID rs, int offset)
+ {
+ emitInst(0xe4000000 | (ft << OP_SH_FT) | (rs << OP_SH_RS)
+ | (offset & 0xffff));
+ }
+
+ void sdc1(FPRegisterID ft, RegisterID rs, int offset)
+ {
+ emitInst(0xf4000000 | (ft << OP_SH_FT) | (rs << OP_SH_RS)
+ | (offset & 0xffff));
+ }
+
+ void mtc1(RegisterID rt, FPRegisterID fs)
+ {
+ emitInst(0x44800000 | (fs << OP_SH_FS) | (rt << OP_SH_RT));
+ copDelayNop();
+ }
+
+ void mthc1(RegisterID rt, FPRegisterID fs)
+ {
+ emitInst(0x44e00000 | (fs << OP_SH_FS) | (rt << OP_SH_RT));
+ copDelayNop();
+ }
+
+ void mfc1(RegisterID rt, FPRegisterID fs)
+ {
+ emitInst(0x44000000 | (fs << OP_SH_FS) | (rt << OP_SH_RT));
+ copDelayNop();
+ }
+
+ void sqrtd(FPRegisterID fd, FPRegisterID fs)
+ {
+ emitInst(0x46200004 | (fd << OP_SH_FD) | (fs << OP_SH_FS));
+ }
+
+ void truncwd(FPRegisterID fd, FPRegisterID fs)
+ {
+ emitInst(0x4620000d | (fd << OP_SH_FD) | (fs << OP_SH_FS));
+ }
+
+ void cvtdw(FPRegisterID fd, FPRegisterID fs)
+ {
+ emitInst(0x46800021 | (fd << OP_SH_FD) | (fs << OP_SH_FS));
+ }
+
+ void cvtwd(FPRegisterID fd, FPRegisterID fs)
+ {
+ emitInst(0x46200024 | (fd << OP_SH_FD) | (fs << OP_SH_FS));
+ }
+
+ void ceqd(FPRegisterID fs, FPRegisterID ft)
+ {
+ emitInst(0x46200032 | (fs << OP_SH_FS) | (ft << OP_SH_FT));
+ copDelayNop();
+ }
+
+ void cngtd(FPRegisterID fs, FPRegisterID ft)
+ {
+ emitInst(0x4620003f | (fs << OP_SH_FS) | (ft << OP_SH_FT));
+ copDelayNop();
+ }
+
+ void cnged(FPRegisterID fs, FPRegisterID ft)
+ {
+ emitInst(0x4620003d | (fs << OP_SH_FS) | (ft << OP_SH_FT));
+ copDelayNop();
+ }
+
+ void cltd(FPRegisterID fs, FPRegisterID ft)
+ {
+ emitInst(0x4620003c | (fs << OP_SH_FS) | (ft << OP_SH_FT));
+ copDelayNop();
+ }
+
+ void cled(FPRegisterID fs, FPRegisterID ft)
+ {
+ emitInst(0x4620003e | (fs << OP_SH_FS) | (ft << OP_SH_FT));
+ copDelayNop();
+ }
+
+ void cueqd(FPRegisterID fs, FPRegisterID ft)
+ {
+ emitInst(0x46200033 | (fs << OP_SH_FS) | (ft << OP_SH_FT));
+ copDelayNop();
+ }
+
+ void coled(FPRegisterID fs, FPRegisterID ft)
+ {
+ emitInst(0x46200036 | (fs << OP_SH_FS) | (ft << OP_SH_FT));
+ copDelayNop();
+ }
+
+ void coltd(FPRegisterID fs, FPRegisterID ft)
+ {
+ emitInst(0x46200034 | (fs << OP_SH_FS) | (ft << OP_SH_FT));
+ copDelayNop();
+ }
+
+ void culed(FPRegisterID fs, FPRegisterID ft)
+ {
+ emitInst(0x46200037 | (fs << OP_SH_FS) | (ft << OP_SH_FT));
+ copDelayNop();
+ }
+
+ void cultd(FPRegisterID fs, FPRegisterID ft)
+ {
+ emitInst(0x46200035 | (fs << OP_SH_FS) | (ft << OP_SH_FT));
+ copDelayNop();
+ }
+
+ // General helpers
+
+ JmpDst label()
+ {
+ return JmpDst(m_buffer.size());
+ }
+
+ JmpDst align(int alignment)
+ {
+ while (!m_buffer.isAligned(alignment))
+ bkpt();
+
+ return label();
+ }
+
+ static void* getRelocatedAddress(void* code, JmpSrc jump)
+ {
+ ASSERT(jump.m_offset != -1);
+ void* b = reinterpret_cast<void*>((reinterpret_cast<intptr_t>(code)) + jump.m_offset);
+ return b;
+ }
+
+ static void* getRelocatedAddress(void* code, JmpDst label)
+ {
+ void* b = reinterpret_cast<void*>((reinterpret_cast<intptr_t>(code)) + label.m_offset);
+ return b;
+ }
+
+ static int getDifferenceBetweenLabels(JmpDst from, JmpDst to)
+ {
+ return to.m_offset - from.m_offset;
+ }
+
+ static int getDifferenceBetweenLabels(JmpDst from, JmpSrc to)
+ {
+ return to.m_offset - from.m_offset;
+ }
+
+ static int getDifferenceBetweenLabels(JmpSrc from, JmpDst to)
+ {
+ return to.m_offset - from.m_offset;
+ }
+
+ // Assembler admin methods:
+
+ size_t size() const
+ {
+ return m_buffer.size();
+ }
+
+ void* executableCopy(ExecutablePool* allocator)
+ {
+ void *result = m_buffer.executableCopy(allocator);
+ if (!result)
+ return 0;
+
+ relocateJumps(m_buffer.data(), result);
+ return result;
+ }
+
+ static unsigned getCallReturnOffset(JmpSrc call)
+ {
+ // The return address is after a call and a delay slot instruction
+ return call.m_offset;
+ }
+
+ // Linking & patching:
+ //
+ // 'link' and 'patch' methods are for use on unprotected code - such as the code
+ // within the AssemblerBuffer, and code being patched by the patch buffer. Once
+ // code has been finalized it is (platform support permitting) within a non-
+ // writable region of memory; to modify the code in an execute-only execuable
+ // pool the 'repatch' and 'relink' methods should be used.
+
+ void linkJump(JmpSrc from, JmpDst to)
+ {
+ ASSERT(to.m_offset != -1);
+ ASSERT(from.m_offset != -1);
+ MIPSWord* insn = reinterpret_cast<MIPSWord*>(reinterpret_cast<intptr_t>(m_buffer.data()) + from.m_offset);
+ MIPSWord* toPos = reinterpret_cast<MIPSWord*>(reinterpret_cast<intptr_t>(m_buffer.data()) + to.m_offset);
+
+ ASSERT(!(*(insn - 1)) && !(*(insn - 2)) && !(*(insn - 3)) && !(*(insn - 5)));
+ insn = insn - 6;
+ linkWithOffset(insn, toPos);
+ }
+
+ static void linkJump(void* code, JmpSrc from, void* to)
+ {
+ ASSERT(from.m_offset != -1);
+ MIPSWord* insn = reinterpret_cast<MIPSWord*>(reinterpret_cast<intptr_t>(code) + from.m_offset);
+
+ ASSERT(!(*(insn - 1)) && !(*(insn - 2)) && !(*(insn - 3)) && !(*(insn - 5)));
+ insn = insn - 6;
+ linkWithOffset(insn, to);
+ }
+
+ static void linkCall(void* code, JmpSrc from, void* to)
+ {
+ MIPSWord* insn = reinterpret_cast<MIPSWord*>(reinterpret_cast<intptr_t>(code) + from.m_offset);
+ linkCallInternal(insn, to);
+ }
+
+ static void linkPointer(void* code, JmpDst from, void* to)
+ {
+ MIPSWord* insn = reinterpret_cast<MIPSWord*>(reinterpret_cast<intptr_t>(code) + from.m_offset);
+ ASSERT((*insn & 0xffe00000) == 0x3c000000); // lui
+ *insn = (*insn & 0xffff0000) | ((reinterpret_cast<intptr_t>(to) >> 16) & 0xffff);
+ insn++;
+ ASSERT((*insn & 0xfc000000) == 0x34000000); // ori
+ *insn = (*insn & 0xffff0000) | (reinterpret_cast<intptr_t>(to) & 0xffff);
+ }
+
+ static void relinkJump(void* from, void* to)
+ {
+ MIPSWord* insn = reinterpret_cast<MIPSWord*>(from);
+
+ ASSERT(!(*(insn - 1)) && !(*(insn - 5)));
+ insn = insn - 6;
+ int flushSize = linkWithOffset(insn, to);
+
+ ExecutableAllocator::cacheFlush(insn, flushSize);
+ }
+
+ static void relinkCall(void* from, void* to)
+ {
+ void* start;
+ int size = linkCallInternal(from, to);
+ if (size == sizeof(MIPSWord))
+ start = reinterpret_cast<void*>(reinterpret_cast<intptr_t>(from) - 2 * sizeof(MIPSWord));
+ else
+ start = reinterpret_cast<void*>(reinterpret_cast<intptr_t>(from) - 4 * sizeof(MIPSWord));
+
+ ExecutableAllocator::cacheFlush(start, size);
+ }
+
+ static void repatchInt32(void* from, int32_t to)
+ {
+ MIPSWord* insn = reinterpret_cast<MIPSWord*>(from);
+ ASSERT((*insn & 0xffe00000) == 0x3c000000); // lui
+ *insn = (*insn & 0xffff0000) | ((to >> 16) & 0xffff);
+ insn++;
+ ASSERT((*insn & 0xfc000000) == 0x34000000); // ori
+ *insn = (*insn & 0xffff0000) | (to & 0xffff);
+ insn--;
+ ExecutableAllocator::cacheFlush(insn, 2 * sizeof(MIPSWord));
+ }
+
+ static void repatchPointer(void* from, void* to)
+ {
+ repatchInt32(from, reinterpret_cast<int32_t>(to));
+ }
+
+ static void repatchLoadPtrToLEA(void* from)
+ {
+ MIPSWord* insn = reinterpret_cast<MIPSWord*>(from);
+ insn = insn + 3;
+ ASSERT((*insn & 0xfc000000) == 0x8c000000); // lw
+ /* lw -> addiu */
+ *insn = 0x24000000 | (*insn & 0x03ffffff);
+
+ ExecutableAllocator::cacheFlush(insn, sizeof(MIPSWord));
+ }
+
+private:
+
+ /* Update each jump in the buffer of newBase. */
+ void relocateJumps(void* oldBase, void* newBase)
+ {
+ // Check each jump
+ for (Jumps::Iterator iter = m_jumps.begin(); iter != m_jumps.end(); ++iter) {
+ int pos = *iter;
+ MIPSWord* insn = reinterpret_cast<MIPSWord*>(reinterpret_cast<intptr_t>(newBase) + pos);
+ insn = insn + 2;
+ // Need to make sure we have 5 valid instructions after pos
+ if ((unsigned int)pos >= m_buffer.size() - 5 * sizeof(MIPSWord))
+ continue;
+
+ if ((*insn & 0xfc000000) == 0x08000000) { // j
+ int offset = *insn & 0x03ffffff;
+ int oldInsnAddress = (int)insn - (int)newBase + (int)oldBase;
+ int topFourBits = (oldInsnAddress + 4) >> 28;
+ int oldTargetAddress = (topFourBits << 28) | (offset << 2);
+ int newTargetAddress = oldTargetAddress - (int)oldBase + (int)newBase;
+ int newInsnAddress = (int)insn;
+ if (((newInsnAddress + 4) >> 28) == (newTargetAddress >> 28))
+ *insn = 0x08000000 | ((newTargetAddress >> 2) & 0x3ffffff);
+ else {
+ /* lui */
+ *insn = 0x3c000000 | (MIPSRegisters::t9 << OP_SH_RT) | ((newTargetAddress >> 16) & 0xffff);
+ /* ori */
+ *(insn + 1) = 0x34000000 | (MIPSRegisters::t9 << OP_SH_RT) | (MIPSRegisters::t9 << OP_SH_RS) | (newTargetAddress & 0xffff);
+ /* jr */
+ *(insn + 2) = 0x00000008 | (MIPSRegisters::t9 << OP_SH_RS);
+ }
+ } else if ((*insn & 0xffe00000) == 0x3c000000) { // lui
+ int high = (*insn & 0xffff) << 16;
+ int low = *(insn + 1) & 0xffff;
+ int oldTargetAddress = high | low;
+ int newTargetAddress = oldTargetAddress - (int)oldBase + (int)newBase;
+ /* lui */
+ *insn = 0x3c000000 | (MIPSRegisters::t9 << OP_SH_RT) | ((newTargetAddress >> 16) & 0xffff);
+ /* ori */
+ *(insn + 1) = 0x34000000 | (MIPSRegisters::t9 << OP_SH_RT) | (MIPSRegisters::t9 << OP_SH_RS) | (newTargetAddress & 0xffff);
+ }
+ }
+ }
+
+ static int linkWithOffset(MIPSWord* insn, void* to)
+ {
+ ASSERT((*insn & 0xfc000000) == 0x10000000 // beq
+ || (*insn & 0xfc000000) == 0x14000000 // bne
+ || (*insn & 0xffff0000) == 0x45010000 // bc1t
+ || (*insn & 0xffff0000) == 0x45000000); // bc1f
+ intptr_t diff = (reinterpret_cast<intptr_t>(to)
+ - reinterpret_cast<intptr_t>(insn) - 4) >> 2;
+
+ if (diff < -32768 || diff > 32767 || *(insn + 2) != 0x10000003) {
+ /*
+ Convert the sequence:
+ beq $2, $3, target
+ nop
+ b 1f
+ nop
+ nop
+ nop
+ 1:
+
+ to the new sequence if possible:
+ bne $2, $3, 1f
+ nop
+ j target
+ nop
+ nop
+ nop
+ 1:
+
+ OR to the new sequence:
+ bne $2, $3, 1f
+ nop
+ lui $25, target >> 16
+ ori $25, $25, target & 0xffff
+ jr $25
+ nop
+ 1:
+
+ Note: beq/bne/bc1t/bc1f are converted to bne/beq/bc1f/bc1t.
+ */
+
+ if (*(insn + 2) == 0x10000003) {
+ if ((*insn & 0xfc000000) == 0x10000000) // beq
+ *insn = (*insn & 0x03ff0000) | 0x14000005; // bne
+ else if ((*insn & 0xfc000000) == 0x14000000) // bne
+ *insn = (*insn & 0x03ff0000) | 0x10000005; // beq
+ else if ((*insn & 0xffff0000) == 0x45010000) // bc1t
+ *insn = 0x45000005; // bc1f
+ else if ((*insn & 0xffff0000) == 0x45000000) // bc1f
+ *insn = 0x45010005; // bc1t
+ else
+ ASSERT(0);
+ }
+
+ insn = insn + 2;
+ if ((reinterpret_cast<intptr_t>(insn) + 4) >> 28
+ == reinterpret_cast<intptr_t>(to) >> 28) {
+ *insn = 0x08000000 | ((reinterpret_cast<intptr_t>(to) >> 2) & 0x3ffffff);
+ *(insn + 1) = 0;
+ return 4 * sizeof(MIPSWord);
+ }
+
+ intptr_t newTargetAddress = reinterpret_cast<intptr_t>(to);
+ /* lui */
+ *insn = 0x3c000000 | (MIPSRegisters::t9 << OP_SH_RT) | ((newTargetAddress >> 16) & 0xffff);
+ /* ori */
+ *(insn + 1) = 0x34000000 | (MIPSRegisters::t9 << OP_SH_RT) | (MIPSRegisters::t9 << OP_SH_RS) | (newTargetAddress & 0xffff);
+ /* jr */
+ *(insn + 2) = 0x00000008 | (MIPSRegisters::t9 << OP_SH_RS);
+ return 5 * sizeof(MIPSWord);
+ }
+
+ *insn = (*insn & 0xffff0000) | (diff & 0xffff);
+ return sizeof(MIPSWord);
+ }
+
+ static int linkCallInternal(void* from, void* to)
+ {
+ MIPSWord* insn = reinterpret_cast<MIPSWord*>(from);
+ insn = insn - 4;
+
+ if ((*(insn + 2) & 0xfc000000) == 0x0c000000) { // jal
+ if ((reinterpret_cast<intptr_t>(from) - 4) >> 28
+ == reinterpret_cast<intptr_t>(to) >> 28) {
+ *(insn + 2) = 0x0c000000 | ((reinterpret_cast<intptr_t>(to) >> 2) & 0x3ffffff);
+ return sizeof(MIPSWord);
+ }
+
+ /* lui $25, (to >> 16) & 0xffff */
+ *insn = 0x3c000000 | (MIPSRegisters::t9 << OP_SH_RT) | ((reinterpret_cast<intptr_t>(to) >> 16) & 0xffff);
+ /* ori $25, $25, to & 0xffff */
+ *(insn + 1) = 0x34000000 | (MIPSRegisters::t9 << OP_SH_RT) | (MIPSRegisters::t9 << OP_SH_RS) | (reinterpret_cast<intptr_t>(to) & 0xffff);
+ /* jalr $25 */
+ *(insn + 2) = 0x0000f809 | (MIPSRegisters::t9 << OP_SH_RS);
+ return 3 * sizeof(MIPSWord);
+ }
+
+ ASSERT((*insn & 0xffe00000) == 0x3c000000); // lui
+ ASSERT((*(insn + 1) & 0xfc000000) == 0x34000000); // ori
+
+ /* lui */
+ *insn = (*insn & 0xffff0000) | ((reinterpret_cast<intptr_t>(to) >> 16) & 0xffff);
+ /* ori */
+ *(insn + 1) = (*(insn + 1) & 0xffff0000) | (reinterpret_cast<intptr_t>(to) & 0xffff);
+ return 2 * sizeof(MIPSWord);
+ }
+
+ AssemblerBuffer m_buffer;
+ Jumps m_jumps;
+};
+
+} // namespace JSC
+
+#endif // ENABLE(ASSEMBLER) && CPU(MIPS)
+
+#endif // MIPSAssembler_h
diff --git a/Source/JavaScriptCore/assembler/MacroAssembler.h b/Source/JavaScriptCore/assembler/MacroAssembler.h
new file mode 100644
index 0000000..fa165de
--- /dev/null
+++ b/Source/JavaScriptCore/assembler/MacroAssembler.h
@@ -0,0 +1,347 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef MacroAssembler_h
+#define MacroAssembler_h
+
+#if ENABLE(ASSEMBLER)
+
+#if CPU(ARM_THUMB2)
+#include "MacroAssemblerARMv7.h"
+namespace JSC { typedef MacroAssemblerARMv7 MacroAssemblerBase; };
+
+#elif CPU(ARM_TRADITIONAL)
+#include "MacroAssemblerARM.h"
+namespace JSC { typedef MacroAssemblerARM MacroAssemblerBase; };
+
+#elif CPU(MIPS)
+#include "MacroAssemblerMIPS.h"
+namespace JSC {
+typedef MacroAssemblerMIPS MacroAssemblerBase;
+};
+
+#elif CPU(X86)
+#include "MacroAssemblerX86.h"
+namespace JSC { typedef MacroAssemblerX86 MacroAssemblerBase; };
+
+#elif CPU(X86_64)
+#include "MacroAssemblerX86_64.h"
+namespace JSC { typedef MacroAssemblerX86_64 MacroAssemblerBase; };
+
+#else
+#error "The MacroAssembler is not supported on this platform."
+#endif
+
+
+namespace JSC {
+
+class MacroAssembler : public MacroAssemblerBase {
+public:
+
+ using MacroAssemblerBase::pop;
+ using MacroAssemblerBase::jump;
+ using MacroAssemblerBase::branch32;
+ using MacroAssemblerBase::branch16;
+#if CPU(X86_64)
+ using MacroAssemblerBase::branchPtr;
+ using MacroAssemblerBase::branchTestPtr;
+#endif
+
+
+ // Platform agnostic onvenience functions,
+ // described in terms of other macro assembly methods.
+ void pop()
+ {
+ addPtr(Imm32(sizeof(void*)), stackPointerRegister);
+ }
+
+ void peek(RegisterID dest, int index = 0)
+ {
+ loadPtr(Address(stackPointerRegister, (index * sizeof(void*))), dest);
+ }
+
+ void poke(RegisterID src, int index = 0)
+ {
+ storePtr(src, Address(stackPointerRegister, (index * sizeof(void*))));
+ }
+
+ void poke(Imm32 value, int index = 0)
+ {
+ store32(value, Address(stackPointerRegister, (index * sizeof(void*))));
+ }
+
+ void poke(ImmPtr imm, int index = 0)
+ {
+ storePtr(imm, Address(stackPointerRegister, (index * sizeof(void*))));
+ }
+
+
+ // Backwards banches, these are currently all implemented using existing forwards branch mechanisms.
+ void branchPtr(Condition cond, RegisterID op1, ImmPtr imm, Label target)
+ {
+ branchPtr(cond, op1, imm).linkTo(target, this);
+ }
+
+ void branch32(Condition cond, RegisterID op1, RegisterID op2, Label target)
+ {
+ branch32(cond, op1, op2).linkTo(target, this);
+ }
+
+ void branch32(Condition cond, RegisterID op1, Imm32 imm, Label target)
+ {
+ branch32(cond, op1, imm).linkTo(target, this);
+ }
+
+ void branch32(Condition cond, RegisterID left, Address right, Label target)
+ {
+ branch32(cond, left, right).linkTo(target, this);
+ }
+
+ void branch16(Condition cond, BaseIndex left, RegisterID right, Label target)
+ {
+ branch16(cond, left, right).linkTo(target, this);
+ }
+
+ void branchTestPtr(Condition cond, RegisterID reg, Label target)
+ {
+ branchTestPtr(cond, reg).linkTo(target, this);
+ }
+
+ void jump(Label target)
+ {
+ jump().linkTo(target, this);
+ }
+
+
+ // Ptr methods
+ // On 32-bit platforms (i.e. x86), these methods directly map onto their 32-bit equivalents.
+ // FIXME: should this use a test for 32-bitness instead of this specific exception?
+#if !CPU(X86_64)
+ void addPtr(RegisterID src, RegisterID dest)
+ {
+ add32(src, dest);
+ }
+
+ void addPtr(Imm32 imm, RegisterID srcDest)
+ {
+ add32(imm, srcDest);
+ }
+
+ void addPtr(ImmPtr imm, RegisterID dest)
+ {
+ add32(Imm32(imm), dest);
+ }
+
+ void addPtr(Imm32 imm, RegisterID src, RegisterID dest)
+ {
+ add32(imm, src, dest);
+ }
+
+ void andPtr(RegisterID src, RegisterID dest)
+ {
+ and32(src, dest);
+ }
+
+ void andPtr(Imm32 imm, RegisterID srcDest)
+ {
+ and32(imm, srcDest);
+ }
+
+ void orPtr(RegisterID src, RegisterID dest)
+ {
+ or32(src, dest);
+ }
+
+ void orPtr(ImmPtr imm, RegisterID dest)
+ {
+ or32(Imm32(imm), dest);
+ }
+
+ void orPtr(Imm32 imm, RegisterID dest)
+ {
+ or32(imm, dest);
+ }
+
+ void subPtr(RegisterID src, RegisterID dest)
+ {
+ sub32(src, dest);
+ }
+
+ void subPtr(Imm32 imm, RegisterID dest)
+ {
+ sub32(imm, dest);
+ }
+
+ void subPtr(ImmPtr imm, RegisterID dest)
+ {
+ sub32(Imm32(imm), dest);
+ }
+
+ void xorPtr(RegisterID src, RegisterID dest)
+ {
+ xor32(src, dest);
+ }
+
+ void xorPtr(Imm32 imm, RegisterID srcDest)
+ {
+ xor32(imm, srcDest);
+ }
+
+
+ void loadPtr(ImplicitAddress address, RegisterID dest)
+ {
+ load32(address, dest);
+ }
+
+ void loadPtr(BaseIndex address, RegisterID dest)
+ {
+ load32(address, dest);
+ }
+
+ void loadPtr(void* address, RegisterID dest)
+ {
+ load32(address, dest);
+ }
+
+ DataLabel32 loadPtrWithAddressOffsetPatch(Address address, RegisterID dest)
+ {
+ return load32WithAddressOffsetPatch(address, dest);
+ }
+
+ void setPtr(Condition cond, RegisterID left, Imm32 right, RegisterID dest)
+ {
+ set32Compare32(cond, left, right, dest);
+ }
+
+ void storePtr(RegisterID src, ImplicitAddress address)
+ {
+ store32(src, address);
+ }
+
+ void storePtr(RegisterID src, BaseIndex address)
+ {
+ store32(src, address);
+ }
+
+ void storePtr(RegisterID src, void* address)
+ {
+ store32(src, address);
+ }
+
+ void storePtr(ImmPtr imm, ImplicitAddress address)
+ {
+ store32(Imm32(imm), address);
+ }
+
+ void storePtr(ImmPtr imm, void* address)
+ {
+ store32(Imm32(imm), address);
+ }
+
+ DataLabel32 storePtrWithAddressOffsetPatch(RegisterID src, Address address)
+ {
+ return store32WithAddressOffsetPatch(src, address);
+ }
+
+
+ Jump branchPtr(Condition cond, RegisterID left, RegisterID right)
+ {
+ return branch32(cond, left, right);
+ }
+
+ Jump branchPtr(Condition cond, RegisterID left, ImmPtr right)
+ {
+ return branch32(cond, left, Imm32(right));
+ }
+
+ Jump branchPtr(Condition cond, RegisterID left, Address right)
+ {
+ return branch32(cond, left, right);
+ }
+
+ Jump branchPtr(Condition cond, Address left, RegisterID right)
+ {
+ return branch32(cond, left, right);
+ }
+
+ Jump branchPtr(Condition cond, AbsoluteAddress left, RegisterID right)
+ {
+ return branch32(cond, left, right);
+ }
+
+ Jump branchPtr(Condition cond, Address left, ImmPtr right)
+ {
+ return branch32(cond, left, Imm32(right));
+ }
+
+ Jump branchPtr(Condition cond, AbsoluteAddress left, ImmPtr right)
+ {
+ return branch32(cond, left, Imm32(right));
+ }
+
+ Jump branchTestPtr(Condition cond, RegisterID reg, RegisterID mask)
+ {
+ return branchTest32(cond, reg, mask);
+ }
+
+ Jump branchTestPtr(Condition cond, RegisterID reg, Imm32 mask = Imm32(-1))
+ {
+ return branchTest32(cond, reg, mask);
+ }
+
+ Jump branchTestPtr(Condition cond, Address address, Imm32 mask = Imm32(-1))
+ {
+ return branchTest32(cond, address, mask);
+ }
+
+ Jump branchTestPtr(Condition cond, BaseIndex address, Imm32 mask = Imm32(-1))
+ {
+ return branchTest32(cond, address, mask);
+ }
+
+
+ Jump branchAddPtr(Condition cond, RegisterID src, RegisterID dest)
+ {
+ return branchAdd32(cond, src, dest);
+ }
+
+ Jump branchSubPtr(Condition cond, Imm32 imm, RegisterID dest)
+ {
+ return branchSub32(cond, imm, dest);
+ }
+ using MacroAssemblerBase::branchTest8;
+ Jump branchTest8(Condition cond, ExtendedAddress address, Imm32 mask = Imm32(-1))
+ {
+ return MacroAssemblerBase::branchTest8(cond, Address(address.base, address.offset), mask);
+ }
+#endif
+
+};
+
+} // namespace JSC
+
+#endif // ENABLE(ASSEMBLER)
+
+#endif // MacroAssembler_h
diff --git a/Source/JavaScriptCore/assembler/MacroAssemblerARM.cpp b/Source/JavaScriptCore/assembler/MacroAssemblerARM.cpp
new file mode 100644
index 0000000..2db5df1
--- /dev/null
+++ b/Source/JavaScriptCore/assembler/MacroAssemblerARM.cpp
@@ -0,0 +1,99 @@
+/*
+ * Copyright (C) 2009 University of Szeged
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY UNIVERSITY OF SZEGED ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL UNIVERSITY OF SZEGED OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if ENABLE(ASSEMBLER) && CPU(ARM_TRADITIONAL)
+
+#include "MacroAssemblerARM.h"
+
+#if OS(LINUX)
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <elf.h>
+#include <asm/hwcap.h>
+#endif
+
+namespace JSC {
+
+static bool isVFPPresent()
+{
+#if OS(LINUX)
+ int fd = open("/proc/self/auxv", O_RDONLY);
+ if (fd > 0) {
+ Elf32_auxv_t aux;
+ while (read(fd, &aux, sizeof(Elf32_auxv_t))) {
+ if (aux.a_type == AT_HWCAP) {
+ close(fd);
+ return aux.a_un.a_val & HWCAP_VFP;
+ }
+ }
+ close(fd);
+ }
+#endif
+
+#if (COMPILER(RVCT) && defined(__TARGET_FPU_VFP)) || (COMPILER(GCC) && defined(__VFP_FP__))
+ return true;
+#else
+ return false;
+#endif
+}
+
+const bool MacroAssemblerARM::s_isVFPPresent = isVFPPresent();
+
+#if CPU(ARMV5_OR_LOWER)
+/* On ARMv5 and below, natural alignment is required. */
+void MacroAssemblerARM::load32WithUnalignedHalfWords(BaseIndex address, RegisterID dest)
+{
+ ARMWord op2;
+
+ ASSERT(address.scale >= 0 && address.scale <= 3);
+ op2 = m_assembler.lsl(address.index, static_cast<int>(address.scale));
+
+ if (address.offset >= 0 && address.offset + 0x2 <= 0xff) {
+ m_assembler.add_r(ARMRegisters::S0, address.base, op2);
+ m_assembler.ldrh_u(dest, ARMRegisters::S0, ARMAssembler::getOp2Byte(address.offset));
+ m_assembler.ldrh_u(ARMRegisters::S0, ARMRegisters::S0, ARMAssembler::getOp2Byte(address.offset + 0x2));
+ } else if (address.offset < 0 && address.offset >= -0xff) {
+ m_assembler.add_r(ARMRegisters::S0, address.base, op2);
+ m_assembler.ldrh_d(dest, ARMRegisters::S0, ARMAssembler::getOp2Byte(-address.offset));
+ m_assembler.ldrh_d(ARMRegisters::S0, ARMRegisters::S0, ARMAssembler::getOp2Byte(-address.offset - 0x2));
+ } else {
+ m_assembler.ldr_un_imm(ARMRegisters::S0, address.offset);
+ m_assembler.add_r(ARMRegisters::S0, ARMRegisters::S0, op2);
+ m_assembler.ldrh_r(dest, address.base, ARMRegisters::S0);
+ m_assembler.add_r(ARMRegisters::S0, ARMRegisters::S0, ARMAssembler::OP2_IMM | 0x2);
+ m_assembler.ldrh_r(ARMRegisters::S0, address.base, ARMRegisters::S0);
+ }
+ m_assembler.orr_r(dest, dest, m_assembler.lsl(ARMRegisters::S0, 16));
+}
+#endif
+
+}
+
+#endif // ENABLE(ASSEMBLER) && CPU(ARM_TRADITIONAL)
diff --git a/Source/JavaScriptCore/assembler/MacroAssemblerARM.h b/Source/JavaScriptCore/assembler/MacroAssemblerARM.h
new file mode 100644
index 0000000..aa85c88
--- /dev/null
+++ b/Source/JavaScriptCore/assembler/MacroAssemblerARM.h
@@ -0,0 +1,1044 @@
+/*
+ * Copyright (C) 2008 Apple Inc.
+ * Copyright (C) 2009, 2010 University of Szeged
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef MacroAssemblerARM_h
+#define MacroAssemblerARM_h
+
+#if ENABLE(ASSEMBLER) && CPU(ARM_TRADITIONAL)
+
+#include "ARMAssembler.h"
+#include "AbstractMacroAssembler.h"
+
+namespace JSC {
+
+class MacroAssemblerARM : public AbstractMacroAssembler<ARMAssembler> {
+ static const int DoubleConditionMask = 0x0f;
+ static const int DoubleConditionBitSpecial = 0x10;
+ COMPILE_ASSERT(!(DoubleConditionBitSpecial & DoubleConditionMask), DoubleConditionBitSpecial_should_not_interfere_with_ARMAssembler_Condition_codes);
+public:
+ typedef ARMRegisters::FPRegisterID FPRegisterID;
+
+ enum Condition {
+ Equal = ARMAssembler::EQ,
+ NotEqual = ARMAssembler::NE,
+ Above = ARMAssembler::HI,
+ AboveOrEqual = ARMAssembler::CS,
+ Below = ARMAssembler::CC,
+ BelowOrEqual = ARMAssembler::LS,
+ GreaterThan = ARMAssembler::GT,
+ GreaterThanOrEqual = ARMAssembler::GE,
+ LessThan = ARMAssembler::LT,
+ LessThanOrEqual = ARMAssembler::LE,
+ Overflow = ARMAssembler::VS,
+ Signed = ARMAssembler::MI,
+ Zero = ARMAssembler::EQ,
+ NonZero = ARMAssembler::NE
+ };
+
+ enum DoubleCondition {
+ // These conditions will only evaluate to true if the comparison is ordered - i.e. neither operand is NaN.
+ DoubleEqual = ARMAssembler::EQ,
+ DoubleNotEqual = ARMAssembler::NE | DoubleConditionBitSpecial,
+ DoubleGreaterThan = ARMAssembler::GT,
+ DoubleGreaterThanOrEqual = ARMAssembler::GE,
+ DoubleLessThan = ARMAssembler::CC,
+ DoubleLessThanOrEqual = ARMAssembler::LS,
+ // If either operand is NaN, these conditions always evaluate to true.
+ DoubleEqualOrUnordered = ARMAssembler::EQ | DoubleConditionBitSpecial,
+ DoubleNotEqualOrUnordered = ARMAssembler::NE,
+ DoubleGreaterThanOrUnordered = ARMAssembler::HI,
+ DoubleGreaterThanOrEqualOrUnordered = ARMAssembler::CS,
+ DoubleLessThanOrUnordered = ARMAssembler::LT,
+ DoubleLessThanOrEqualOrUnordered = ARMAssembler::LE,
+ };
+
+ static const RegisterID stackPointerRegister = ARMRegisters::sp;
+ static const RegisterID linkRegister = ARMRegisters::lr;
+
+ static const Scale ScalePtr = TimesFour;
+
+ void add32(RegisterID src, RegisterID dest)
+ {
+ m_assembler.adds_r(dest, dest, src);
+ }
+
+ void add32(Imm32 imm, Address address)
+ {
+ load32(address, ARMRegisters::S1);
+ add32(imm, ARMRegisters::S1);
+ store32(ARMRegisters::S1, address);
+ }
+
+ void add32(Imm32 imm, RegisterID dest)
+ {
+ m_assembler.adds_r(dest, dest, m_assembler.getImm(imm.m_value, ARMRegisters::S0));
+ }
+
+ void add32(Address src, RegisterID dest)
+ {
+ load32(src, ARMRegisters::S1);
+ add32(ARMRegisters::S1, dest);
+ }
+
+ void and32(RegisterID src, RegisterID dest)
+ {
+ m_assembler.ands_r(dest, dest, src);
+ }
+
+ void and32(Imm32 imm, RegisterID dest)
+ {
+ ARMWord w = m_assembler.getImm(imm.m_value, ARMRegisters::S0, true);
+ if (w & ARMAssembler::OP2_INV_IMM)
+ m_assembler.bics_r(dest, dest, w & ~ARMAssembler::OP2_INV_IMM);
+ else
+ m_assembler.ands_r(dest, dest, w);
+ }
+
+ void lshift32(RegisterID shift_amount, RegisterID dest)
+ {
+ ARMWord w = ARMAssembler::getOp2(0x1f);
+ ASSERT(w != ARMAssembler::INVALID_IMM);
+ m_assembler.and_r(ARMRegisters::S0, shift_amount, w);
+
+ m_assembler.movs_r(dest, m_assembler.lsl_r(dest, ARMRegisters::S0));
+ }
+
+ void lshift32(Imm32 imm, RegisterID dest)
+ {
+ m_assembler.movs_r(dest, m_assembler.lsl(dest, imm.m_value & 0x1f));
+ }
+
+ void mul32(RegisterID src, RegisterID dest)
+ {
+ if (src == dest) {
+ move(src, ARMRegisters::S0);
+ src = ARMRegisters::S0;
+ }
+ m_assembler.muls_r(dest, dest, src);
+ }
+
+ void mul32(Imm32 imm, RegisterID src, RegisterID dest)
+ {
+ move(imm, ARMRegisters::S0);
+ m_assembler.muls_r(dest, src, ARMRegisters::S0);
+ }
+
+ void neg32(RegisterID srcDest)
+ {
+ m_assembler.rsbs_r(srcDest, srcDest, ARMAssembler::getOp2(0));
+ }
+
+ void not32(RegisterID dest)
+ {
+ m_assembler.mvns_r(dest, dest);
+ }
+
+ void or32(RegisterID src, RegisterID dest)
+ {
+ m_assembler.orrs_r(dest, dest, src);
+ }
+
+ void or32(Imm32 imm, RegisterID dest)
+ {
+ m_assembler.orrs_r(dest, dest, m_assembler.getImm(imm.m_value, ARMRegisters::S0));
+ }
+
+ void rshift32(RegisterID shift_amount, RegisterID dest)
+ {
+ ARMWord w = ARMAssembler::getOp2(0x1f);
+ ASSERT(w != ARMAssembler::INVALID_IMM);
+ m_assembler.and_r(ARMRegisters::S0, shift_amount, w);
+
+ m_assembler.movs_r(dest, m_assembler.asr_r(dest, ARMRegisters::S0));
+ }
+
+ void rshift32(Imm32 imm, RegisterID dest)
+ {
+ m_assembler.movs_r(dest, m_assembler.asr(dest, imm.m_value & 0x1f));
+ }
+
+ void urshift32(RegisterID shift_amount, RegisterID dest)
+ {
+ ARMWord w = ARMAssembler::getOp2(0x1f);
+ ASSERT(w != ARMAssembler::INVALID_IMM);
+ m_assembler.and_r(ARMRegisters::S0, shift_amount, w);
+
+ m_assembler.movs_r(dest, m_assembler.lsr_r(dest, ARMRegisters::S0));
+ }
+
+ void urshift32(Imm32 imm, RegisterID dest)
+ {
+ m_assembler.movs_r(dest, m_assembler.lsr(dest, imm.m_value & 0x1f));
+ }
+
+ void sub32(RegisterID src, RegisterID dest)
+ {
+ m_assembler.subs_r(dest, dest, src);
+ }
+
+ void sub32(Imm32 imm, RegisterID dest)
+ {
+ m_assembler.subs_r(dest, dest, m_assembler.getImm(imm.m_value, ARMRegisters::S0));
+ }
+
+ void sub32(Imm32 imm, Address address)
+ {
+ load32(address, ARMRegisters::S1);
+ sub32(imm, ARMRegisters::S1);
+ store32(ARMRegisters::S1, address);
+ }
+
+ void sub32(Address src, RegisterID dest)
+ {
+ load32(src, ARMRegisters::S1);
+ sub32(ARMRegisters::S1, dest);
+ }
+
+ void xor32(RegisterID src, RegisterID dest)
+ {
+ m_assembler.eors_r(dest, dest, src);
+ }
+
+ void xor32(Imm32 imm, RegisterID dest)
+ {
+ m_assembler.eors_r(dest, dest, m_assembler.getImm(imm.m_value, ARMRegisters::S0));
+ }
+
+ void countLeadingZeros32(RegisterID src, RegisterID dest)
+ {
+#if WTF_ARM_ARCH_AT_LEAST(5)
+ m_assembler.clz_r(dest, src);
+#else
+ UNUSED_PARAM(src);
+ UNUSED_PARAM(dest);
+ ASSERT_NOT_REACHED();
+#endif
+ }
+
+ void load8(ImplicitAddress address, RegisterID dest)
+ {
+ m_assembler.dataTransfer32(true, dest, address.base, address.offset, true);
+ }
+
+ void load32(ImplicitAddress address, RegisterID dest)
+ {
+ m_assembler.dataTransfer32(true, dest, address.base, address.offset);
+ }
+
+ void load32(BaseIndex address, RegisterID dest)
+ {
+ m_assembler.baseIndexTransfer32(true, dest, address.base, address.index, static_cast<int>(address.scale), address.offset);
+ }
+
+#if CPU(ARMV5_OR_LOWER)
+ void load32WithUnalignedHalfWords(BaseIndex address, RegisterID dest);
+#else
+ void load32WithUnalignedHalfWords(BaseIndex address, RegisterID dest)
+ {
+ load32(address, dest);
+ }
+#endif
+
+ DataLabel32 load32WithAddressOffsetPatch(Address address, RegisterID dest)
+ {
+ DataLabel32 dataLabel(this);
+ m_assembler.ldr_un_imm(ARMRegisters::S0, 0);
+ m_assembler.dtr_ur(true, dest, address.base, ARMRegisters::S0);
+ return dataLabel;
+ }
+
+ Label loadPtrWithPatchToLEA(Address address, RegisterID dest)
+ {
+ Label label(this);
+ load32(address, dest);
+ return label;
+ }
+
+ void load16(BaseIndex address, RegisterID dest)
+ {
+ m_assembler.add_r(ARMRegisters::S1, address.base, m_assembler.lsl(address.index, address.scale));
+ load16(Address(ARMRegisters::S1, address.offset), dest);
+ }
+
+ void load16(ImplicitAddress address, RegisterID dest)
+ {
+ if (address.offset >= 0)
+ m_assembler.ldrh_u(dest, address.base, m_assembler.getOffsetForHalfwordDataTransfer(address.offset, ARMRegisters::S0));
+ else
+ m_assembler.ldrh_d(dest, address.base, m_assembler.getOffsetForHalfwordDataTransfer(-address.offset, ARMRegisters::S0));
+ }
+
+ DataLabel32 store32WithAddressOffsetPatch(RegisterID src, Address address)
+ {
+ DataLabel32 dataLabel(this);
+ m_assembler.ldr_un_imm(ARMRegisters::S0, 0);
+ m_assembler.dtr_ur(false, src, address.base, ARMRegisters::S0);
+ return dataLabel;
+ }
+
+ void store32(RegisterID src, ImplicitAddress address)
+ {
+ m_assembler.dataTransfer32(false, src, address.base, address.offset);
+ }
+
+ void store32(RegisterID src, BaseIndex address)
+ {
+ m_assembler.baseIndexTransfer32(false, src, address.base, address.index, static_cast<int>(address.scale), address.offset);
+ }
+
+ void store32(Imm32 imm, ImplicitAddress address)
+ {
+ if (imm.m_isPointer)
+ m_assembler.ldr_un_imm(ARMRegisters::S1, imm.m_value);
+ else
+ move(imm, ARMRegisters::S1);
+ store32(ARMRegisters::S1, address);
+ }
+
+ void store32(RegisterID src, void* address)
+ {
+ m_assembler.ldr_un_imm(ARMRegisters::S0, reinterpret_cast<ARMWord>(address));
+ m_assembler.dtr_u(false, src, ARMRegisters::S0, 0);
+ }
+
+ void store32(Imm32 imm, void* address)
+ {
+ m_assembler.ldr_un_imm(ARMRegisters::S0, reinterpret_cast<ARMWord>(address));
+ if (imm.m_isPointer)
+ m_assembler.ldr_un_imm(ARMRegisters::S1, imm.m_value);
+ else
+ m_assembler.moveImm(imm.m_value, ARMRegisters::S1);
+ m_assembler.dtr_u(false, ARMRegisters::S1, ARMRegisters::S0, 0);
+ }
+
+ void pop(RegisterID dest)
+ {
+ m_assembler.pop_r(dest);
+ }
+
+ void push(RegisterID src)
+ {
+ m_assembler.push_r(src);
+ }
+
+ void push(Address address)
+ {
+ load32(address, ARMRegisters::S1);
+ push(ARMRegisters::S1);
+ }
+
+ void push(Imm32 imm)
+ {
+ move(imm, ARMRegisters::S0);
+ push(ARMRegisters::S0);
+ }
+
+ void move(Imm32 imm, RegisterID dest)
+ {
+ if (imm.m_isPointer)
+ m_assembler.ldr_un_imm(dest, imm.m_value);
+ else
+ m_assembler.moveImm(imm.m_value, dest);
+ }
+
+ void move(RegisterID src, RegisterID dest)
+ {
+ m_assembler.mov_r(dest, src);
+ }
+
+ void move(ImmPtr imm, RegisterID dest)
+ {
+ move(Imm32(imm), dest);
+ }
+
+ void swap(RegisterID reg1, RegisterID reg2)
+ {
+ m_assembler.mov_r(ARMRegisters::S0, reg1);
+ m_assembler.mov_r(reg1, reg2);
+ m_assembler.mov_r(reg2, ARMRegisters::S0);
+ }
+
+ void signExtend32ToPtr(RegisterID src, RegisterID dest)
+ {
+ if (src != dest)
+ move(src, dest);
+ }
+
+ void zeroExtend32ToPtr(RegisterID src, RegisterID dest)
+ {
+ if (src != dest)
+ move(src, dest);
+ }
+
+ Jump branch8(Condition cond, Address left, Imm32 right)
+ {
+ load8(left, ARMRegisters::S1);
+ return branch32(cond, ARMRegisters::S1, right);
+ }
+
+ Jump branch32(Condition cond, RegisterID left, RegisterID right, int useConstantPool = 0)
+ {
+ m_assembler.cmp_r(left, right);
+ return Jump(m_assembler.jmp(ARMCondition(cond), useConstantPool));
+ }
+
+ Jump branch32(Condition cond, RegisterID left, Imm32 right, int useConstantPool = 0)
+ {
+ if (right.m_isPointer) {
+ m_assembler.ldr_un_imm(ARMRegisters::S0, right.m_value);
+ m_assembler.cmp_r(left, ARMRegisters::S0);
+ } else {
+ ARMWord tmp = m_assembler.getOp2(-right.m_value);
+ if (tmp != ARMAssembler::INVALID_IMM)
+ m_assembler.cmn_r(left, tmp);
+ else
+ m_assembler.cmp_r(left, m_assembler.getImm(right.m_value, ARMRegisters::S0));
+ }
+ return Jump(m_assembler.jmp(ARMCondition(cond), useConstantPool));
+ }
+
+ Jump branch32(Condition cond, RegisterID left, Address right)
+ {
+ load32(right, ARMRegisters::S1);
+ return branch32(cond, left, ARMRegisters::S1);
+ }
+
+ Jump branch32(Condition cond, Address left, RegisterID right)
+ {
+ load32(left, ARMRegisters::S1);
+ return branch32(cond, ARMRegisters::S1, right);
+ }
+
+ Jump branch32(Condition cond, Address left, Imm32 right)
+ {
+ load32(left, ARMRegisters::S1);
+ return branch32(cond, ARMRegisters::S1, right);
+ }
+
+ Jump branch32(Condition cond, BaseIndex left, Imm32 right)
+ {
+ load32(left, ARMRegisters::S1);
+ return branch32(cond, ARMRegisters::S1, right);
+ }
+
+ Jump branch32WithUnalignedHalfWords(Condition cond, BaseIndex left, Imm32 right)
+ {
+ load32WithUnalignedHalfWords(left, ARMRegisters::S1);
+ return branch32(cond, ARMRegisters::S1, right);
+ }
+
+ Jump branch16(Condition cond, BaseIndex left, RegisterID right)
+ {
+ UNUSED_PARAM(cond);
+ UNUSED_PARAM(left);
+ UNUSED_PARAM(right);
+ ASSERT_NOT_REACHED();
+ return jump();
+ }
+
+ Jump branch16(Condition cond, BaseIndex left, Imm32 right)
+ {
+ load16(left, ARMRegisters::S0);
+ move(right, ARMRegisters::S1);
+ m_assembler.cmp_r(ARMRegisters::S0, ARMRegisters::S1);
+ return m_assembler.jmp(ARMCondition(cond));
+ }
+
+ Jump branchTest8(Condition cond, Address address, Imm32 mask = Imm32(-1))
+ {
+ load8(address, ARMRegisters::S1);
+ return branchTest32(cond, ARMRegisters::S1, mask);
+ }
+
+ Jump branchTest32(Condition cond, RegisterID reg, RegisterID mask)
+ {
+ ASSERT((cond == Zero) || (cond == NonZero));
+ m_assembler.tst_r(reg, mask);
+ return Jump(m_assembler.jmp(ARMCondition(cond)));
+ }
+
+ Jump branchTest32(Condition cond, RegisterID reg, Imm32 mask = Imm32(-1))
+ {
+ ASSERT((cond == Zero) || (cond == NonZero));
+ ARMWord w = m_assembler.getImm(mask.m_value, ARMRegisters::S0, true);
+ if (w & ARMAssembler::OP2_INV_IMM)
+ m_assembler.bics_r(ARMRegisters::S0, reg, w & ~ARMAssembler::OP2_INV_IMM);
+ else
+ m_assembler.tst_r(reg, w);
+ return Jump(m_assembler.jmp(ARMCondition(cond)));
+ }
+
+ Jump branchTest32(Condition cond, Address address, Imm32 mask = Imm32(-1))
+ {
+ load32(address, ARMRegisters::S1);
+ return branchTest32(cond, ARMRegisters::S1, mask);
+ }
+
+ Jump branchTest32(Condition cond, BaseIndex address, Imm32 mask = Imm32(-1))
+ {
+ load32(address, ARMRegisters::S1);
+ return branchTest32(cond, ARMRegisters::S1, mask);
+ }
+
+ Jump jump()
+ {
+ return Jump(m_assembler.jmp());
+ }
+
+ void jump(RegisterID target)
+ {
+ m_assembler.bx(target);
+ }
+
+ void jump(Address address)
+ {
+ load32(address, ARMRegisters::pc);
+ }
+
+ Jump branchAdd32(Condition cond, RegisterID src, RegisterID dest)
+ {
+ ASSERT((cond == Overflow) || (cond == Signed) || (cond == Zero) || (cond == NonZero));
+ add32(src, dest);
+ return Jump(m_assembler.jmp(ARMCondition(cond)));
+ }
+
+ Jump branchAdd32(Condition cond, Imm32 imm, RegisterID dest)
+ {
+ ASSERT((cond == Overflow) || (cond == Signed) || (cond == Zero) || (cond == NonZero));
+ add32(imm, dest);
+ return Jump(m_assembler.jmp(ARMCondition(cond)));
+ }
+
+ void mull32(RegisterID src1, RegisterID src2, RegisterID dest)
+ {
+ if (src1 == dest) {
+ move(src1, ARMRegisters::S0);
+ src1 = ARMRegisters::S0;
+ }
+ m_assembler.mull_r(ARMRegisters::S1, dest, src2, src1);
+ m_assembler.cmp_r(ARMRegisters::S1, m_assembler.asr(dest, 31));
+ }
+
+ Jump branchMul32(Condition cond, RegisterID src, RegisterID dest)
+ {
+ ASSERT((cond == Overflow) || (cond == Signed) || (cond == Zero) || (cond == NonZero));
+ if (cond == Overflow) {
+ mull32(src, dest, dest);
+ cond = NonZero;
+ }
+ else
+ mul32(src, dest);
+ return Jump(m_assembler.jmp(ARMCondition(cond)));
+ }
+
+ Jump branchMul32(Condition cond, Imm32 imm, RegisterID src, RegisterID dest)
+ {
+ ASSERT((cond == Overflow) || (cond == Signed) || (cond == Zero) || (cond == NonZero));
+ if (cond == Overflow) {
+ move(imm, ARMRegisters::S0);
+ mull32(ARMRegisters::S0, src, dest);
+ cond = NonZero;
+ }
+ else
+ mul32(imm, src, dest);
+ return Jump(m_assembler.jmp(ARMCondition(cond)));
+ }
+
+ Jump branchSub32(Condition cond, RegisterID src, RegisterID dest)
+ {
+ ASSERT((cond == Overflow) || (cond == Signed) || (cond == Zero) || (cond == NonZero));
+ sub32(src, dest);
+ return Jump(m_assembler.jmp(ARMCondition(cond)));
+ }
+
+ Jump branchSub32(Condition cond, Imm32 imm, RegisterID dest)
+ {
+ ASSERT((cond == Overflow) || (cond == Signed) || (cond == Zero) || (cond == NonZero));
+ sub32(imm, dest);
+ return Jump(m_assembler.jmp(ARMCondition(cond)));
+ }
+
+ Jump branchNeg32(Condition cond, RegisterID srcDest)
+ {
+ ASSERT((cond == Overflow) || (cond == Signed) || (cond == Zero) || (cond == NonZero));
+ neg32(srcDest);
+ return Jump(m_assembler.jmp(ARMCondition(cond)));
+ }
+
+ Jump branchOr32(Condition cond, RegisterID src, RegisterID dest)
+ {
+ ASSERT((cond == Signed) || (cond == Zero) || (cond == NonZero));
+ or32(src, dest);
+ return Jump(m_assembler.jmp(ARMCondition(cond)));
+ }
+
+ void breakpoint()
+ {
+ m_assembler.bkpt(0);
+ }
+
+ Call nearCall()
+ {
+#if WTF_ARM_ARCH_AT_LEAST(5)
+ ensureSpace(2 * sizeof(ARMWord), sizeof(ARMWord));
+ m_assembler.loadBranchTarget(ARMRegisters::S1, ARMAssembler::AL, true);
+ return Call(m_assembler.blx(ARMRegisters::S1), Call::LinkableNear);
+#else
+ prepareCall();
+ return Call(m_assembler.jmp(ARMAssembler::AL, true), Call::LinkableNear);
+#endif
+ }
+
+ Call call(RegisterID target)
+ {
+ return Call(m_assembler.blx(target), Call::None);
+ }
+
+ void call(Address address)
+ {
+ call32(address.base, address.offset);
+ }
+
+ void ret()
+ {
+ m_assembler.bx(linkRegister);
+ }
+
+ void set32Compare32(Condition cond, RegisterID left, RegisterID right, RegisterID dest)
+ {
+ m_assembler.cmp_r(left, right);
+ m_assembler.mov_r(dest, ARMAssembler::getOp2(0));
+ m_assembler.mov_r(dest, ARMAssembler::getOp2(1), ARMCondition(cond));
+ }
+
+ void set32Compare32(Condition cond, RegisterID left, Imm32 right, RegisterID dest)
+ {
+ m_assembler.cmp_r(left, m_assembler.getImm(right.m_value, ARMRegisters::S0));
+ m_assembler.mov_r(dest, ARMAssembler::getOp2(0));
+ m_assembler.mov_r(dest, ARMAssembler::getOp2(1), ARMCondition(cond));
+ }
+
+ void set8Compare32(Condition cond, RegisterID left, RegisterID right, RegisterID dest)
+ {
+ // ARM doesn't have byte registers
+ set32Compare32(cond, left, right, dest);
+ }
+
+ void set8Compare32(Condition cond, Address left, RegisterID right, RegisterID dest)
+ {
+ // ARM doesn't have byte registers
+ load32(left, ARMRegisters::S1);
+ set32Compare32(cond, ARMRegisters::S1, right, dest);
+ }
+
+ void set8Compare32(Condition cond, RegisterID left, Imm32 right, RegisterID dest)
+ {
+ // ARM doesn't have byte registers
+ set32Compare32(cond, left, right, dest);
+ }
+
+ void set32Test32(Condition cond, Address address, Imm32 mask, RegisterID dest)
+ {
+ load32(address, ARMRegisters::S1);
+ if (mask.m_value == -1)
+ m_assembler.cmp_r(0, ARMRegisters::S1);
+ else
+ m_assembler.tst_r(ARMRegisters::S1, m_assembler.getImm(mask.m_value, ARMRegisters::S0));
+ m_assembler.mov_r(dest, ARMAssembler::getOp2(0));
+ m_assembler.mov_r(dest, ARMAssembler::getOp2(1), ARMCondition(cond));
+ }
+
+ void set32Test8(Condition cond, Address address, Imm32 mask, RegisterID dest)
+ {
+ // ARM doesn't have byte registers
+ set32Test32(cond, address, mask, dest);
+ }
+
+ void add32(Imm32 imm, RegisterID src, RegisterID dest)
+ {
+ m_assembler.add_r(dest, src, m_assembler.getImm(imm.m_value, ARMRegisters::S0));
+ }
+
+ void add32(Imm32 imm, AbsoluteAddress address)
+ {
+ m_assembler.ldr_un_imm(ARMRegisters::S1, reinterpret_cast<ARMWord>(address.m_ptr));
+ m_assembler.dtr_u(true, ARMRegisters::S1, ARMRegisters::S1, 0);
+ add32(imm, ARMRegisters::S1);
+ m_assembler.ldr_un_imm(ARMRegisters::S0, reinterpret_cast<ARMWord>(address.m_ptr));
+ m_assembler.dtr_u(false, ARMRegisters::S1, ARMRegisters::S0, 0);
+ }
+
+ void sub32(Imm32 imm, AbsoluteAddress address)
+ {
+ m_assembler.ldr_un_imm(ARMRegisters::S1, reinterpret_cast<ARMWord>(address.m_ptr));
+ m_assembler.dtr_u(true, ARMRegisters::S1, ARMRegisters::S1, 0);
+ sub32(imm, ARMRegisters::S1);
+ m_assembler.ldr_un_imm(ARMRegisters::S0, reinterpret_cast<ARMWord>(address.m_ptr));
+ m_assembler.dtr_u(false, ARMRegisters::S1, ARMRegisters::S0, 0);
+ }
+
+ void load32(void* address, RegisterID dest)
+ {
+ m_assembler.ldr_un_imm(ARMRegisters::S0, reinterpret_cast<ARMWord>(address));
+ m_assembler.dtr_u(true, dest, ARMRegisters::S0, 0);
+ }
+
+ Jump branch32(Condition cond, AbsoluteAddress left, RegisterID right)
+ {
+ load32(left.m_ptr, ARMRegisters::S1);
+ return branch32(cond, ARMRegisters::S1, right);
+ }
+
+ Jump branch32(Condition cond, AbsoluteAddress left, Imm32 right)
+ {
+ load32(left.m_ptr, ARMRegisters::S1);
+ return branch32(cond, ARMRegisters::S1, right);
+ }
+
+ void relativeTableJump(RegisterID index, int scale)
+ {
+ ASSERT(scale >= 0 && scale <= 31);
+ m_assembler.add_r(ARMRegisters::pc, ARMRegisters::pc, m_assembler.lsl(index, scale));
+
+ // NOP the default prefetching
+ m_assembler.mov_r(ARMRegisters::r0, ARMRegisters::r0);
+ }
+
+ Call call()
+ {
+#if WTF_ARM_ARCH_AT_LEAST(5)
+ ensureSpace(2 * sizeof(ARMWord), sizeof(ARMWord));
+ m_assembler.loadBranchTarget(ARMRegisters::S1, ARMAssembler::AL, true);
+ return Call(m_assembler.blx(ARMRegisters::S1), Call::Linkable);
+#else
+ prepareCall();
+ return Call(m_assembler.jmp(ARMAssembler::AL, true), Call::Linkable);
+#endif
+ }
+
+ Call tailRecursiveCall()
+ {
+ return Call::fromTailJump(jump());
+ }
+
+ Call makeTailRecursiveCall(Jump oldJump)
+ {
+ return Call::fromTailJump(oldJump);
+ }
+
+ DataLabelPtr moveWithPatch(ImmPtr initialValue, RegisterID dest)
+ {
+ DataLabelPtr dataLabel(this);
+ m_assembler.ldr_un_imm(dest, reinterpret_cast<ARMWord>(initialValue.m_value));
+ return dataLabel;
+ }
+
+ Jump branchPtrWithPatch(Condition cond, RegisterID left, DataLabelPtr& dataLabel, ImmPtr initialRightValue = ImmPtr(0))
+ {
+ dataLabel = moveWithPatch(initialRightValue, ARMRegisters::S1);
+ Jump jump = branch32(cond, left, ARMRegisters::S1, true);
+ return jump;
+ }
+
+ Jump branchPtrWithPatch(Condition cond, Address left, DataLabelPtr& dataLabel, ImmPtr initialRightValue = ImmPtr(0))
+ {
+ load32(left, ARMRegisters::S1);
+ dataLabel = moveWithPatch(initialRightValue, ARMRegisters::S0);
+ Jump jump = branch32(cond, ARMRegisters::S0, ARMRegisters::S1, true);
+ return jump;
+ }
+
+ DataLabelPtr storePtrWithPatch(ImmPtr initialValue, ImplicitAddress address)
+ {
+ DataLabelPtr dataLabel = moveWithPatch(initialValue, ARMRegisters::S1);
+ store32(ARMRegisters::S1, address);
+ return dataLabel;
+ }
+
+ DataLabelPtr storePtrWithPatch(ImplicitAddress address)
+ {
+ return storePtrWithPatch(ImmPtr(0), address);
+ }
+
+ // Floating point operators
+ bool supportsFloatingPoint() const
+ {
+ return s_isVFPPresent;
+ }
+
+ bool supportsFloatingPointTruncate() const
+ {
+ return s_isVFPPresent;
+ }
+
+ bool supportsFloatingPointSqrt() const
+ {
+ return s_isVFPPresent;
+ }
+
+ void loadDouble(ImplicitAddress address, FPRegisterID dest)
+ {
+ m_assembler.doubleTransfer(true, dest, address.base, address.offset);
+ }
+
+ void loadDouble(const void* address, FPRegisterID dest)
+ {
+ m_assembler.ldr_un_imm(ARMRegisters::S0, (ARMWord)address);
+ m_assembler.fdtr_u(true, dest, ARMRegisters::S0, 0);
+ }
+
+ void storeDouble(FPRegisterID src, ImplicitAddress address)
+ {
+ m_assembler.doubleTransfer(false, src, address.base, address.offset);
+ }
+
+ void addDouble(FPRegisterID src, FPRegisterID dest)
+ {
+ m_assembler.vadd_f64_r(dest, dest, src);
+ }
+
+ void addDouble(Address src, FPRegisterID dest)
+ {
+ loadDouble(src, ARMRegisters::SD0);
+ addDouble(ARMRegisters::SD0, dest);
+ }
+
+ void divDouble(FPRegisterID src, FPRegisterID dest)
+ {
+ m_assembler.vdiv_f64_r(dest, dest, src);
+ }
+
+ void divDouble(Address src, FPRegisterID dest)
+ {
+ ASSERT_NOT_REACHED(); // Untested
+ loadDouble(src, ARMRegisters::SD0);
+ divDouble(ARMRegisters::SD0, dest);
+ }
+
+ void subDouble(FPRegisterID src, FPRegisterID dest)
+ {
+ m_assembler.vsub_f64_r(dest, dest, src);
+ }
+
+ void subDouble(Address src, FPRegisterID dest)
+ {
+ loadDouble(src, ARMRegisters::SD0);
+ subDouble(ARMRegisters::SD0, dest);
+ }
+
+ void mulDouble(FPRegisterID src, FPRegisterID dest)
+ {
+ m_assembler.vmul_f64_r(dest, dest, src);
+ }
+
+ void mulDouble(Address src, FPRegisterID dest)
+ {
+ loadDouble(src, ARMRegisters::SD0);
+ mulDouble(ARMRegisters::SD0, dest);
+ }
+
+ void sqrtDouble(FPRegisterID src, FPRegisterID dest)
+ {
+ m_assembler.vsqrt_f64_r(dest, src);
+ }
+
+ void convertInt32ToDouble(RegisterID src, FPRegisterID dest)
+ {
+ m_assembler.vmov_vfp_r(dest << 1, src);
+ m_assembler.vcvt_f64_s32_r(dest, dest << 1);
+ }
+
+ void convertInt32ToDouble(Address src, FPRegisterID dest)
+ {
+ ASSERT_NOT_REACHED(); // Untested
+ // flds does not worth the effort here
+ load32(src, ARMRegisters::S1);
+ convertInt32ToDouble(ARMRegisters::S1, dest);
+ }
+
+ void convertInt32ToDouble(AbsoluteAddress src, FPRegisterID dest)
+ {
+ ASSERT_NOT_REACHED(); // Untested
+ // flds does not worth the effort here
+ m_assembler.ldr_un_imm(ARMRegisters::S1, (ARMWord)src.m_ptr);
+ m_assembler.dtr_u(true, ARMRegisters::S1, ARMRegisters::S1, 0);
+ convertInt32ToDouble(ARMRegisters::S1, dest);
+ }
+
+ Jump branchDouble(DoubleCondition cond, FPRegisterID left, FPRegisterID right)
+ {
+ m_assembler.vcmp_f64_r(left, right);
+ m_assembler.vmrs_apsr();
+ if (cond & DoubleConditionBitSpecial)
+ m_assembler.cmp_r(ARMRegisters::S0, ARMRegisters::S0, ARMAssembler::VS);
+ return Jump(m_assembler.jmp(static_cast<ARMAssembler::Condition>(cond & ~DoubleConditionMask)));
+ }
+
+ // Truncates 'src' to an integer, and places the resulting 'dest'.
+ // If the result is not representable as a 32 bit value, branch.
+ // May also branch for some values that are representable in 32 bits
+ // (specifically, in this case, INT_MIN and INT_MAX).
+ Jump branchTruncateDoubleToInt32(FPRegisterID src, RegisterID dest)
+ {
+ m_assembler.vcvtr_s32_f64_r(ARMRegisters::SD0 << 1, src);
+ // If VCVTR.S32.F64 can't fit the result into a 32-bit
+ // integer, it saturates at INT_MAX or INT_MIN. Testing this is
+ // probably quicker than testing FPSCR for exception.
+ m_assembler.vmov_arm_r(dest, ARMRegisters::SD0 << 1);
+ m_assembler.sub_r(ARMRegisters::S0, dest, ARMAssembler::getOp2(0x80000000));
+ m_assembler.cmn_r(ARMRegisters::S0, ARMAssembler::getOp2(1), ARMCondition(NotEqual));
+ return Jump(m_assembler.jmp(ARMCondition(Equal)));
+ }
+
+ // Convert 'src' to an integer, and places the resulting 'dest'.
+ // If the result is not representable as a 32 bit value, branch.
+ // May also branch for some values that are representable in 32 bits
+ // (specifically, in this case, 0).
+ void branchConvertDoubleToInt32(FPRegisterID src, RegisterID dest, JumpList& failureCases, FPRegisterID fpTemp)
+ {
+ m_assembler.vcvt_s32_f64_r(ARMRegisters::SD0 << 1, src);
+ m_assembler.vmov_arm_r(dest, ARMRegisters::SD0 << 1);
+
+ // Convert the integer result back to float & compare to the original value - if not equal or unordered (NaN) then jump.
+ m_assembler.vcvt_f64_s32_r(ARMRegisters::SD0, ARMRegisters::SD0 << 1);
+ failureCases.append(branchDouble(DoubleNotEqualOrUnordered, src, ARMRegisters::SD0));
+
+ // If the result is zero, it might have been -0.0, and 0.0 equals to -0.0
+ failureCases.append(branchTest32(Zero, dest));
+ }
+
+ Jump branchDoubleNonZero(FPRegisterID reg, FPRegisterID scratch)
+ {
+ m_assembler.mov_r(ARMRegisters::S0, ARMAssembler::getOp2(0));
+ convertInt32ToDouble(ARMRegisters::S0, scratch);
+ return branchDouble(DoubleNotEqual, reg, scratch);
+ }
+
+ Jump branchDoubleZeroOrNaN(FPRegisterID reg, FPRegisterID scratch)
+ {
+ m_assembler.mov_r(ARMRegisters::S0, ARMAssembler::getOp2(0));
+ convertInt32ToDouble(ARMRegisters::S0, scratch);
+ return branchDouble(DoubleEqualOrUnordered, reg, scratch);
+ }
+
+protected:
+ ARMAssembler::Condition ARMCondition(Condition cond)
+ {
+ return static_cast<ARMAssembler::Condition>(cond);
+ }
+
+ void ensureSpace(int insnSpace, int constSpace)
+ {
+ m_assembler.ensureSpace(insnSpace, constSpace);
+ }
+
+ int sizeOfConstantPool()
+ {
+ return m_assembler.sizeOfConstantPool();
+ }
+
+ void prepareCall()
+ {
+#if WTF_ARM_ARCH_VERSION < 5
+ ensureSpace(2 * sizeof(ARMWord), sizeof(ARMWord));
+
+ m_assembler.mov_r(linkRegister, ARMRegisters::pc);
+#endif
+ }
+
+ void call32(RegisterID base, int32_t offset)
+ {
+#if WTF_ARM_ARCH_AT_LEAST(5)
+ int targetReg = ARMRegisters::S1;
+#else
+ int targetReg = ARMRegisters::pc;
+#endif
+ int tmpReg = ARMRegisters::S1;
+
+ if (base == ARMRegisters::sp)
+ offset += 4;
+
+ if (offset >= 0) {
+ if (offset <= 0xfff) {
+ prepareCall();
+ m_assembler.dtr_u(true, targetReg, base, offset);
+ } else if (offset <= 0xfffff) {
+ m_assembler.add_r(tmpReg, base, ARMAssembler::OP2_IMM | (offset >> 12) | (10 << 8));
+ prepareCall();
+ m_assembler.dtr_u(true, targetReg, tmpReg, offset & 0xfff);
+ } else {
+ m_assembler.moveImm(offset, tmpReg);
+ prepareCall();
+ m_assembler.dtr_ur(true, targetReg, base, tmpReg);
+ }
+ } else {
+ offset = -offset;
+ if (offset <= 0xfff) {
+ prepareCall();
+ m_assembler.dtr_d(true, targetReg, base, offset);
+ } else if (offset <= 0xfffff) {
+ m_assembler.sub_r(tmpReg, base, ARMAssembler::OP2_IMM | (offset >> 12) | (10 << 8));
+ prepareCall();
+ m_assembler.dtr_d(true, targetReg, tmpReg, offset & 0xfff);
+ } else {
+ m_assembler.moveImm(offset, tmpReg);
+ prepareCall();
+ m_assembler.dtr_dr(true, targetReg, base, tmpReg);
+ }
+ }
+#if WTF_ARM_ARCH_AT_LEAST(5)
+ m_assembler.blx(targetReg);
+#endif
+ }
+
+private:
+ friend class LinkBuffer;
+ friend class RepatchBuffer;
+
+ static void linkCall(void* code, Call call, FunctionPtr function)
+ {
+ ARMAssembler::linkCall(code, call.m_jmp, function.value());
+ }
+
+ static void repatchCall(CodeLocationCall call, CodeLocationLabel destination)
+ {
+ ARMAssembler::relinkCall(call.dataLocation(), destination.executableAddress());
+ }
+
+ static void repatchCall(CodeLocationCall call, FunctionPtr destination)
+ {
+ ARMAssembler::relinkCall(call.dataLocation(), destination.executableAddress());
+ }
+
+ static const bool s_isVFPPresent;
+};
+
+}
+
+#endif // ENABLE(ASSEMBLER) && CPU(ARM_TRADITIONAL)
+
+#endif // MacroAssemblerARM_h
diff --git a/Source/JavaScriptCore/assembler/MacroAssemblerARMv7.h b/Source/JavaScriptCore/assembler/MacroAssemblerARMv7.h
new file mode 100644
index 0000000..a3c1301
--- /dev/null
+++ b/Source/JavaScriptCore/assembler/MacroAssemblerARMv7.h
@@ -0,0 +1,1374 @@
+/*
+ * Copyright (C) 2009, 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010 University of Szeged
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef MacroAssemblerARMv7_h
+#define MacroAssemblerARMv7_h
+
+#if ENABLE(ASSEMBLER)
+
+#include "ARMv7Assembler.h"
+#include "AbstractMacroAssembler.h"
+
+namespace JSC {
+
+class MacroAssemblerARMv7 : public AbstractMacroAssembler<ARMv7Assembler> {
+ // FIXME: switch dataTempRegister & addressTempRegister, or possibly use r7?
+ // - dTR is likely used more than aTR, and we'll get better instruction
+ // encoding if it's in the low 8 registers.
+ static const RegisterID dataTempRegister = ARMRegisters::ip;
+ static const RegisterID addressTempRegister = ARMRegisters::r3;
+
+ static const ARMRegisters::FPDoubleRegisterID fpTempRegister = ARMRegisters::d7;
+ inline ARMRegisters::FPSingleRegisterID fpTempRegisterAsSingle() { return ARMRegisters::asSingle(fpTempRegister); }
+
+public:
+ typedef ARMv7Assembler::LinkRecord LinkRecord;
+ typedef ARMv7Assembler::JumpType JumpType;
+ typedef ARMv7Assembler::JumpLinkType JumpLinkType;
+
+ MacroAssemblerARMv7()
+ : m_inUninterruptedSequence(false)
+ {
+ }
+
+ void beginUninterruptedSequence() { m_inUninterruptedSequence = true; }
+ void endUninterruptedSequence() { m_inUninterruptedSequence = false; }
+ Vector<LinkRecord>& jumpsToLink() { return m_assembler.jumpsToLink(); }
+ void* unlinkedCode() { return m_assembler.unlinkedCode(); }
+ bool canCompact(JumpType jumpType) { return m_assembler.canCompact(jumpType); }
+ JumpLinkType computeJumpType(JumpType jumpType, const uint8_t* from, const uint8_t* to) { return m_assembler.computeJumpType(jumpType, from, to); }
+ JumpLinkType computeJumpType(LinkRecord& record, const uint8_t* from, const uint8_t* to) { return m_assembler.computeJumpType(record, from, to); }
+ void recordLinkOffsets(int32_t regionStart, int32_t regionEnd, int32_t offset) {return m_assembler.recordLinkOffsets(regionStart, regionEnd, offset); }
+ int jumpSizeDelta(JumpType jumpType, JumpLinkType jumpLinkType) { return m_assembler.jumpSizeDelta(jumpType, jumpLinkType); }
+ void link(LinkRecord& record, uint8_t* from, uint8_t* to) { return m_assembler.link(record, from, to); }
+
+ struct ArmAddress {
+ enum AddressType {
+ HasOffset,
+ HasIndex,
+ } type;
+ RegisterID base;
+ union {
+ int32_t offset;
+ struct {
+ RegisterID index;
+ Scale scale;
+ };
+ } u;
+
+ explicit ArmAddress(RegisterID base, int32_t offset = 0)
+ : type(HasOffset)
+ , base(base)
+ {
+ u.offset = offset;
+ }
+
+ explicit ArmAddress(RegisterID base, RegisterID index, Scale scale = TimesOne)
+ : type(HasIndex)
+ , base(base)
+ {
+ u.index = index;
+ u.scale = scale;
+ }
+ };
+
+public:
+ typedef ARMRegisters::FPDoubleRegisterID FPRegisterID;
+
+ static const Scale ScalePtr = TimesFour;
+
+ enum Condition {
+ Equal = ARMv7Assembler::ConditionEQ,
+ NotEqual = ARMv7Assembler::ConditionNE,
+ Above = ARMv7Assembler::ConditionHI,
+ AboveOrEqual = ARMv7Assembler::ConditionHS,
+ Below = ARMv7Assembler::ConditionLO,
+ BelowOrEqual = ARMv7Assembler::ConditionLS,
+ GreaterThan = ARMv7Assembler::ConditionGT,
+ GreaterThanOrEqual = ARMv7Assembler::ConditionGE,
+ LessThan = ARMv7Assembler::ConditionLT,
+ LessThanOrEqual = ARMv7Assembler::ConditionLE,
+ Overflow = ARMv7Assembler::ConditionVS,
+ Signed = ARMv7Assembler::ConditionMI,
+ Zero = ARMv7Assembler::ConditionEQ,
+ NonZero = ARMv7Assembler::ConditionNE
+ };
+ enum DoubleCondition {
+ // These conditions will only evaluate to true if the comparison is ordered - i.e. neither operand is NaN.
+ DoubleEqual = ARMv7Assembler::ConditionEQ,
+ DoubleNotEqual = ARMv7Assembler::ConditionVC, // Not the right flag! check for this & handle differently.
+ DoubleGreaterThan = ARMv7Assembler::ConditionGT,
+ DoubleGreaterThanOrEqual = ARMv7Assembler::ConditionGE,
+ DoubleLessThan = ARMv7Assembler::ConditionLO,
+ DoubleLessThanOrEqual = ARMv7Assembler::ConditionLS,
+ // If either operand is NaN, these conditions always evaluate to true.
+ DoubleEqualOrUnordered = ARMv7Assembler::ConditionVS, // Not the right flag! check for this & handle differently.
+ DoubleNotEqualOrUnordered = ARMv7Assembler::ConditionNE,
+ DoubleGreaterThanOrUnordered = ARMv7Assembler::ConditionHI,
+ DoubleGreaterThanOrEqualOrUnordered = ARMv7Assembler::ConditionHS,
+ DoubleLessThanOrUnordered = ARMv7Assembler::ConditionLT,
+ DoubleLessThanOrEqualOrUnordered = ARMv7Assembler::ConditionLE,
+ };
+
+ static const RegisterID stackPointerRegister = ARMRegisters::sp;
+ static const RegisterID linkRegister = ARMRegisters::lr;
+
+ // Integer arithmetic operations:
+ //
+ // Operations are typically two operand - operation(source, srcDst)
+ // For many operations the source may be an Imm32, the srcDst operand
+ // may often be a memory location (explictly described using an Address
+ // object).
+
+ void add32(RegisterID src, RegisterID dest)
+ {
+ m_assembler.add(dest, dest, src);
+ }
+
+ void add32(Imm32 imm, RegisterID dest)
+ {
+ add32(imm, dest, dest);
+ }
+
+ void add32(Imm32 imm, RegisterID src, RegisterID dest)
+ {
+ ARMThumbImmediate armImm = ARMThumbImmediate::makeUInt12OrEncodedImm(imm.m_value);
+ if (armImm.isValid())
+ m_assembler.add(dest, src, armImm);
+ else {
+ move(imm, dataTempRegister);
+ m_assembler.add(dest, src, dataTempRegister);
+ }
+ }
+
+ void add32(Imm32 imm, Address address)
+ {
+ load32(address, dataTempRegister);
+
+ ARMThumbImmediate armImm = ARMThumbImmediate::makeUInt12OrEncodedImm(imm.m_value);
+ if (armImm.isValid())
+ m_assembler.add(dataTempRegister, dataTempRegister, armImm);
+ else {
+ // Hrrrm, since dataTempRegister holds the data loaded,
+ // use addressTempRegister to hold the immediate.
+ move(imm, addressTempRegister);
+ m_assembler.add(dataTempRegister, dataTempRegister, addressTempRegister);
+ }
+
+ store32(dataTempRegister, address);
+ }
+
+ void add32(Address src, RegisterID dest)
+ {
+ load32(src, dataTempRegister);
+ add32(dataTempRegister, dest);
+ }
+
+ void add32(Imm32 imm, AbsoluteAddress address)
+ {
+ load32(address.m_ptr, dataTempRegister);
+
+ ARMThumbImmediate armImm = ARMThumbImmediate::makeUInt12OrEncodedImm(imm.m_value);
+ if (armImm.isValid())
+ m_assembler.add(dataTempRegister, dataTempRegister, armImm);
+ else {
+ // Hrrrm, since dataTempRegister holds the data loaded,
+ // use addressTempRegister to hold the immediate.
+ move(imm, addressTempRegister);
+ m_assembler.add(dataTempRegister, dataTempRegister, addressTempRegister);
+ }
+
+ store32(dataTempRegister, address.m_ptr);
+ }
+
+ void and32(RegisterID src, RegisterID dest)
+ {
+ m_assembler.ARM_and(dest, dest, src);
+ }
+
+ void and32(Imm32 imm, RegisterID dest)
+ {
+ ARMThumbImmediate armImm = ARMThumbImmediate::makeEncodedImm(imm.m_value);
+ if (armImm.isValid())
+ m_assembler.ARM_and(dest, dest, armImm);
+ else {
+ move(imm, dataTempRegister);
+ m_assembler.ARM_and(dest, dest, dataTempRegister);
+ }
+ }
+
+ void countLeadingZeros32(RegisterID src, RegisterID dest)
+ {
+ m_assembler.clz(dest, src);
+ }
+
+ void lshift32(RegisterID shift_amount, RegisterID dest)
+ {
+ // Clamp the shift to the range 0..31
+ ARMThumbImmediate armImm = ARMThumbImmediate::makeEncodedImm(0x1f);
+ ASSERT(armImm.isValid());
+ m_assembler.ARM_and(dataTempRegister, shift_amount, armImm);
+
+ m_assembler.lsl(dest, dest, dataTempRegister);
+ }
+
+ void lshift32(Imm32 imm, RegisterID dest)
+ {
+ m_assembler.lsl(dest, dest, imm.m_value & 0x1f);
+ }
+
+ void mul32(RegisterID src, RegisterID dest)
+ {
+ m_assembler.smull(dest, dataTempRegister, dest, src);
+ }
+
+ void mul32(Imm32 imm, RegisterID src, RegisterID dest)
+ {
+ move(imm, dataTempRegister);
+ m_assembler.smull(dest, dataTempRegister, src, dataTempRegister);
+ }
+
+ void neg32(RegisterID srcDest)
+ {
+ m_assembler.neg(srcDest, srcDest);
+ }
+
+ void not32(RegisterID srcDest)
+ {
+ m_assembler.mvn(srcDest, srcDest);
+ }
+
+ void or32(RegisterID src, RegisterID dest)
+ {
+ m_assembler.orr(dest, dest, src);
+ }
+
+ void or32(Imm32 imm, RegisterID dest)
+ {
+ ARMThumbImmediate armImm = ARMThumbImmediate::makeEncodedImm(imm.m_value);
+ if (armImm.isValid())
+ m_assembler.orr(dest, dest, armImm);
+ else {
+ move(imm, dataTempRegister);
+ m_assembler.orr(dest, dest, dataTempRegister);
+ }
+ }
+
+ void rshift32(RegisterID shift_amount, RegisterID dest)
+ {
+ // Clamp the shift to the range 0..31
+ ARMThumbImmediate armImm = ARMThumbImmediate::makeEncodedImm(0x1f);
+ ASSERT(armImm.isValid());
+ m_assembler.ARM_and(dataTempRegister, shift_amount, armImm);
+
+ m_assembler.asr(dest, dest, dataTempRegister);
+ }
+
+ void rshift32(Imm32 imm, RegisterID dest)
+ {
+ m_assembler.asr(dest, dest, imm.m_value & 0x1f);
+ }
+
+ void urshift32(RegisterID shift_amount, RegisterID dest)
+ {
+ // Clamp the shift to the range 0..31
+ ARMThumbImmediate armImm = ARMThumbImmediate::makeEncodedImm(0x1f);
+ ASSERT(armImm.isValid());
+ m_assembler.ARM_and(dataTempRegister, shift_amount, armImm);
+
+ m_assembler.lsr(dest, dest, dataTempRegister);
+ }
+
+ void urshift32(Imm32 imm, RegisterID dest)
+ {
+ m_assembler.lsr(dest, dest, imm.m_value & 0x1f);
+ }
+
+ void sub32(RegisterID src, RegisterID dest)
+ {
+ m_assembler.sub(dest, dest, src);
+ }
+
+ void sub32(Imm32 imm, RegisterID dest)
+ {
+ ARMThumbImmediate armImm = ARMThumbImmediate::makeUInt12OrEncodedImm(imm.m_value);
+ if (armImm.isValid())
+ m_assembler.sub(dest, dest, armImm);
+ else {
+ move(imm, dataTempRegister);
+ m_assembler.sub(dest, dest, dataTempRegister);
+ }
+ }
+
+ void sub32(Imm32 imm, Address address)
+ {
+ load32(address, dataTempRegister);
+
+ ARMThumbImmediate armImm = ARMThumbImmediate::makeUInt12OrEncodedImm(imm.m_value);
+ if (armImm.isValid())
+ m_assembler.sub(dataTempRegister, dataTempRegister, armImm);
+ else {
+ // Hrrrm, since dataTempRegister holds the data loaded,
+ // use addressTempRegister to hold the immediate.
+ move(imm, addressTempRegister);
+ m_assembler.sub(dataTempRegister, dataTempRegister, addressTempRegister);
+ }
+
+ store32(dataTempRegister, address);
+ }
+
+ void sub32(Address src, RegisterID dest)
+ {
+ load32(src, dataTempRegister);
+ sub32(dataTempRegister, dest);
+ }
+
+ void sub32(Imm32 imm, AbsoluteAddress address)
+ {
+ load32(address.m_ptr, dataTempRegister);
+
+ ARMThumbImmediate armImm = ARMThumbImmediate::makeUInt12OrEncodedImm(imm.m_value);
+ if (armImm.isValid())
+ m_assembler.sub(dataTempRegister, dataTempRegister, armImm);
+ else {
+ // Hrrrm, since dataTempRegister holds the data loaded,
+ // use addressTempRegister to hold the immediate.
+ move(imm, addressTempRegister);
+ m_assembler.sub(dataTempRegister, dataTempRegister, addressTempRegister);
+ }
+
+ store32(dataTempRegister, address.m_ptr);
+ }
+
+ void xor32(RegisterID src, RegisterID dest)
+ {
+ m_assembler.eor(dest, dest, src);
+ }
+
+ void xor32(Imm32 imm, RegisterID dest)
+ {
+ ARMThumbImmediate armImm = ARMThumbImmediate::makeEncodedImm(imm.m_value);
+ if (armImm.isValid())
+ m_assembler.eor(dest, dest, armImm);
+ else {
+ move(imm, dataTempRegister);
+ m_assembler.eor(dest, dest, dataTempRegister);
+ }
+ }
+
+
+ // Memory access operations:
+ //
+ // Loads are of the form load(address, destination) and stores of the form
+ // store(source, address). The source for a store may be an Imm32. Address
+ // operand objects to loads and store will be implicitly constructed if a
+ // register is passed.
+
+private:
+ void load32(ArmAddress address, RegisterID dest)
+ {
+ if (address.type == ArmAddress::HasIndex)
+ m_assembler.ldr(dest, address.base, address.u.index, address.u.scale);
+ else if (address.u.offset >= 0) {
+ ARMThumbImmediate armImm = ARMThumbImmediate::makeUInt12(address.u.offset);
+ ASSERT(armImm.isValid());
+ m_assembler.ldr(dest, address.base, armImm);
+ } else {
+ ASSERT(address.u.offset >= -255);
+ m_assembler.ldr(dest, address.base, address.u.offset, true, false);
+ }
+ }
+
+ void load16(ArmAddress address, RegisterID dest)
+ {
+ if (address.type == ArmAddress::HasIndex)
+ m_assembler.ldrh(dest, address.base, address.u.index, address.u.scale);
+ else if (address.u.offset >= 0) {
+ ARMThumbImmediate armImm = ARMThumbImmediate::makeUInt12(address.u.offset);
+ ASSERT(armImm.isValid());
+ m_assembler.ldrh(dest, address.base, armImm);
+ } else {
+ ASSERT(address.u.offset >= -255);
+ m_assembler.ldrh(dest, address.base, address.u.offset, true, false);
+ }
+ }
+
+ void load8(ArmAddress address, RegisterID dest)
+ {
+ if (address.type == ArmAddress::HasIndex)
+ m_assembler.ldrb(dest, address.base, address.u.index, address.u.scale);
+ else if (address.u.offset >= 0) {
+ ARMThumbImmediate armImm = ARMThumbImmediate::makeUInt12(address.u.offset);
+ ASSERT(armImm.isValid());
+ m_assembler.ldrb(dest, address.base, armImm);
+ } else {
+ ASSERT(address.u.offset >= -255);
+ m_assembler.ldrb(dest, address.base, address.u.offset, true, false);
+ }
+ }
+
+ void store32(RegisterID src, ArmAddress address)
+ {
+ if (address.type == ArmAddress::HasIndex)
+ m_assembler.str(src, address.base, address.u.index, address.u.scale);
+ else if (address.u.offset >= 0) {
+ ARMThumbImmediate armImm = ARMThumbImmediate::makeUInt12(address.u.offset);
+ ASSERT(armImm.isValid());
+ m_assembler.str(src, address.base, armImm);
+ } else {
+ ASSERT(address.u.offset >= -255);
+ m_assembler.str(src, address.base, address.u.offset, true, false);
+ }
+ }
+
+public:
+ void load32(ImplicitAddress address, RegisterID dest)
+ {
+ load32(setupArmAddress(address), dest);
+ }
+
+ void load32(BaseIndex address, RegisterID dest)
+ {
+ load32(setupArmAddress(address), dest);
+ }
+
+ void load32WithUnalignedHalfWords(BaseIndex address, RegisterID dest)
+ {
+ load32(setupArmAddress(address), dest);
+ }
+
+ void load32(void* address, RegisterID dest)
+ {
+ move(ImmPtr(address), addressTempRegister);
+ m_assembler.ldr(dest, addressTempRegister, ARMThumbImmediate::makeUInt16(0));
+ }
+
+ void load8(ImplicitAddress address, RegisterID dest)
+ {
+ load8(setupArmAddress(address), dest);
+ }
+
+ DataLabel32 load32WithAddressOffsetPatch(Address address, RegisterID dest)
+ {
+ DataLabel32 label = moveWithPatch(Imm32(address.offset), dataTempRegister);
+ load32(ArmAddress(address.base, dataTempRegister), dest);
+ return label;
+ }
+
+ Label loadPtrWithPatchToLEA(Address address, RegisterID dest)
+ {
+ Label label(this);
+ moveFixedWidthEncoding(Imm32(address.offset), dataTempRegister);
+ load32(ArmAddress(address.base, dataTempRegister), dest);
+ return label;
+ }
+
+ void load16(BaseIndex address, RegisterID dest)
+ {
+ m_assembler.ldrh(dest, makeBaseIndexBase(address), address.index, address.scale);
+ }
+
+ void load16(ImplicitAddress address, RegisterID dest)
+ {
+ ARMThumbImmediate armImm = ARMThumbImmediate::makeUInt12(address.offset);
+ if (armImm.isValid())
+ m_assembler.ldrh(dest, address.base, armImm);
+ else {
+ move(Imm32(address.offset), dataTempRegister);
+ m_assembler.ldrh(dest, address.base, dataTempRegister);
+ }
+ }
+
+ DataLabel32 store32WithAddressOffsetPatch(RegisterID src, Address address)
+ {
+ DataLabel32 label = moveWithPatch(Imm32(address.offset), dataTempRegister);
+ store32(src, ArmAddress(address.base, dataTempRegister));
+ return label;
+ }
+
+ void store32(RegisterID src, ImplicitAddress address)
+ {
+ store32(src, setupArmAddress(address));
+ }
+
+ void store32(RegisterID src, BaseIndex address)
+ {
+ store32(src, setupArmAddress(address));
+ }
+
+ void store32(Imm32 imm, ImplicitAddress address)
+ {
+ move(imm, dataTempRegister);
+ store32(dataTempRegister, setupArmAddress(address));
+ }
+
+ void store32(RegisterID src, void* address)
+ {
+ move(ImmPtr(address), addressTempRegister);
+ m_assembler.str(src, addressTempRegister, ARMThumbImmediate::makeUInt16(0));
+ }
+
+ void store32(Imm32 imm, void* address)
+ {
+ move(imm, dataTempRegister);
+ store32(dataTempRegister, address);
+ }
+
+
+ // Floating-point operations:
+
+ bool supportsFloatingPoint() const { return true; }
+ // On x86(_64) the MacroAssembler provides an interface to truncate a double to an integer.
+ // If a value is not representable as an integer, and possibly for some values that are,
+ // (on x86 INT_MIN, since this is indistinguishable from results for out-of-range/NaN input)
+ // a branch will be taken. It is not clear whether this interface will be well suited to
+ // other platforms. On ARMv7 the hardware truncation operation produces multiple possible
+ // failure values (saturates to INT_MIN & INT_MAX, NaN reulsts in a value of 0). This is a
+ // temporary solution while we work out what this interface should be. Either we need to
+ // decide to make this interface work on all platforms, rework the interface to make it more
+ // generic, or decide that the MacroAssembler cannot practically be used to abstracted these
+ // operations, and make clients go directly to the m_assembler to plant truncation instructions.
+ // In short, FIXME:.
+ bool supportsFloatingPointTruncate() const { return false; }
+
+ bool supportsFloatingPointSqrt() const
+ {
+ return false;
+ }
+
+ void loadDouble(ImplicitAddress address, FPRegisterID dest)
+ {
+ RegisterID base = address.base;
+ int32_t offset = address.offset;
+
+ // Arm vfp addresses can be offset by a 9-bit ones-comp immediate, left shifted by 2.
+ if ((offset & 3) || (offset > (255 * 4)) || (offset < -(255 * 4))) {
+ add32(Imm32(offset), base, addressTempRegister);
+ base = addressTempRegister;
+ offset = 0;
+ }
+
+ m_assembler.vldr(dest, base, offset);
+ }
+
+ void loadDouble(const void* address, FPRegisterID dest)
+ {
+ move(ImmPtr(address), addressTempRegister);
+ m_assembler.vldr(dest, addressTempRegister, 0);
+ }
+
+ void storeDouble(FPRegisterID src, ImplicitAddress address)
+ {
+ RegisterID base = address.base;
+ int32_t offset = address.offset;
+
+ // Arm vfp addresses can be offset by a 9-bit ones-comp immediate, left shifted by 2.
+ if ((offset & 3) || (offset > (255 * 4)) || (offset < -(255 * 4))) {
+ add32(Imm32(offset), base, addressTempRegister);
+ base = addressTempRegister;
+ offset = 0;
+ }
+
+ m_assembler.vstr(src, base, offset);
+ }
+
+ void addDouble(FPRegisterID src, FPRegisterID dest)
+ {
+ m_assembler.vadd_F64(dest, dest, src);
+ }
+
+ void addDouble(Address src, FPRegisterID dest)
+ {
+ loadDouble(src, fpTempRegister);
+ addDouble(fpTempRegister, dest);
+ }
+
+ void divDouble(FPRegisterID src, FPRegisterID dest)
+ {
+ m_assembler.vdiv_F64(dest, dest, src);
+ }
+
+ void subDouble(FPRegisterID src, FPRegisterID dest)
+ {
+ m_assembler.vsub_F64(dest, dest, src);
+ }
+
+ void subDouble(Address src, FPRegisterID dest)
+ {
+ loadDouble(src, fpTempRegister);
+ subDouble(fpTempRegister, dest);
+ }
+
+ void mulDouble(FPRegisterID src, FPRegisterID dest)
+ {
+ m_assembler.vmul_F64(dest, dest, src);
+ }
+
+ void mulDouble(Address src, FPRegisterID dest)
+ {
+ loadDouble(src, fpTempRegister);
+ mulDouble(fpTempRegister, dest);
+ }
+
+ void sqrtDouble(FPRegisterID, FPRegisterID)
+ {
+ ASSERT_NOT_REACHED();
+ }
+
+ void convertInt32ToDouble(RegisterID src, FPRegisterID dest)
+ {
+ m_assembler.vmov(fpTempRegisterAsSingle(), src);
+ m_assembler.vcvt_F64_S32(dest, fpTempRegisterAsSingle());
+ }
+
+ void convertInt32ToDouble(Address address, FPRegisterID dest)
+ {
+ // Fixme: load directly into the fpr!
+ load32(address, dataTempRegister);
+ m_assembler.vmov(fpTempRegisterAsSingle(), dataTempRegister);
+ m_assembler.vcvt_F64_S32(dest, fpTempRegisterAsSingle());
+ }
+
+ void convertInt32ToDouble(AbsoluteAddress address, FPRegisterID dest)
+ {
+ // Fixme: load directly into the fpr!
+ load32(address.m_ptr, dataTempRegister);
+ m_assembler.vmov(fpTempRegisterAsSingle(), dataTempRegister);
+ m_assembler.vcvt_F64_S32(dest, fpTempRegisterAsSingle());
+ }
+
+ Jump branchDouble(DoubleCondition cond, FPRegisterID left, FPRegisterID right)
+ {
+ m_assembler.vcmp_F64(left, right);
+ m_assembler.vmrs();
+
+ if (cond == DoubleNotEqual) {
+ // ConditionNE jumps if NotEqual *or* unordered - force the unordered cases not to jump.
+ Jump unordered = makeBranch(ARMv7Assembler::ConditionVS);
+ Jump result = makeBranch(ARMv7Assembler::ConditionNE);
+ unordered.link(this);
+ return result;
+ }
+ if (cond == DoubleEqualOrUnordered) {
+ Jump unordered = makeBranch(ARMv7Assembler::ConditionVS);
+ Jump notEqual = makeBranch(ARMv7Assembler::ConditionNE);
+ unordered.link(this);
+ // We get here if either unordered or equal.
+ Jump result = makeJump();
+ notEqual.link(this);
+ return result;
+ }
+ return makeBranch(cond);
+ }
+
+ Jump branchTruncateDoubleToInt32(FPRegisterID, RegisterID)
+ {
+ ASSERT_NOT_REACHED();
+ return jump();
+ }
+
+ // Convert 'src' to an integer, and places the resulting 'dest'.
+ // If the result is not representable as a 32 bit value, branch.
+ // May also branch for some values that are representable in 32 bits
+ // (specifically, in this case, 0).
+ void branchConvertDoubleToInt32(FPRegisterID src, RegisterID dest, JumpList& failureCases, FPRegisterID)
+ {
+ m_assembler.vcvtr_S32_F64(fpTempRegisterAsSingle(), src);
+ m_assembler.vmov(dest, fpTempRegisterAsSingle());
+
+ // Convert the integer result back to float & compare to the original value - if not equal or unordered (NaN) then jump.
+ m_assembler.vcvt_F64_S32(fpTempRegister, fpTempRegisterAsSingle());
+ failureCases.append(branchDouble(DoubleNotEqualOrUnordered, src, fpTempRegister));
+
+ // If the result is zero, it might have been -0.0, and the double comparison won't catch this!
+ failureCases.append(branchTest32(Zero, dest));
+ }
+
+ Jump branchDoubleNonZero(FPRegisterID reg, FPRegisterID)
+ {
+ m_assembler.vcmpz_F64(reg);
+ m_assembler.vmrs();
+ Jump unordered = makeBranch(ARMv7Assembler::ConditionVS);
+ Jump result = makeBranch(ARMv7Assembler::ConditionNE);
+ unordered.link(this);
+ return result;
+ }
+
+ Jump branchDoubleZeroOrNaN(FPRegisterID reg, FPRegisterID)
+ {
+ m_assembler.vcmpz_F64(reg);
+ m_assembler.vmrs();
+ Jump unordered = makeBranch(ARMv7Assembler::ConditionVS);
+ Jump notEqual = makeBranch(ARMv7Assembler::ConditionNE);
+ unordered.link(this);
+ // We get here if either unordered or equal.
+ Jump result = makeJump();
+ notEqual.link(this);
+ return result;
+ }
+
+ // Stack manipulation operations:
+ //
+ // The ABI is assumed to provide a stack abstraction to memory,
+ // containing machine word sized units of data. Push and pop
+ // operations add and remove a single register sized unit of data
+ // to or from the stack. Peek and poke operations read or write
+ // values on the stack, without moving the current stack position.
+
+ void pop(RegisterID dest)
+ {
+ // store postindexed with writeback
+ m_assembler.ldr(dest, ARMRegisters::sp, sizeof(void*), false, true);
+ }
+
+ void push(RegisterID src)
+ {
+ // store preindexed with writeback
+ m_assembler.str(src, ARMRegisters::sp, -sizeof(void*), true, true);
+ }
+
+ void push(Address address)
+ {
+ load32(address, dataTempRegister);
+ push(dataTempRegister);
+ }
+
+ void push(Imm32 imm)
+ {
+ move(imm, dataTempRegister);
+ push(dataTempRegister);
+ }
+
+ // Register move operations:
+ //
+ // Move values in registers.
+
+ void move(Imm32 imm, RegisterID dest)
+ {
+ uint32_t value = imm.m_value;
+
+ if (imm.m_isPointer)
+ moveFixedWidthEncoding(imm, dest);
+ else {
+ ARMThumbImmediate armImm = ARMThumbImmediate::makeEncodedImm(value);
+
+ if (armImm.isValid())
+ m_assembler.mov(dest, armImm);
+ else if ((armImm = ARMThumbImmediate::makeEncodedImm(~value)).isValid())
+ m_assembler.mvn(dest, armImm);
+ else {
+ m_assembler.mov(dest, ARMThumbImmediate::makeUInt16(value));
+ if (value & 0xffff0000)
+ m_assembler.movt(dest, ARMThumbImmediate::makeUInt16(value >> 16));
+ }
+ }
+ }
+
+ void move(RegisterID src, RegisterID dest)
+ {
+ m_assembler.mov(dest, src);
+ }
+
+ void move(ImmPtr imm, RegisterID dest)
+ {
+ move(Imm32(imm), dest);
+ }
+
+ void swap(RegisterID reg1, RegisterID reg2)
+ {
+ move(reg1, dataTempRegister);
+ move(reg2, reg1);
+ move(dataTempRegister, reg2);
+ }
+
+ void signExtend32ToPtr(RegisterID src, RegisterID dest)
+ {
+ if (src != dest)
+ move(src, dest);
+ }
+
+ void zeroExtend32ToPtr(RegisterID src, RegisterID dest)
+ {
+ if (src != dest)
+ move(src, dest);
+ }
+
+
+ // Forwards / external control flow operations:
+ //
+ // This set of jump and conditional branch operations return a Jump
+ // object which may linked at a later point, allow forwards jump,
+ // or jumps that will require external linkage (after the code has been
+ // relocated).
+ //
+ // For branches, signed <, >, <= and >= are denoted as l, g, le, and ge
+ // respecitvely, for unsigned comparisons the names b, a, be, and ae are
+ // used (representing the names 'below' and 'above').
+ //
+ // Operands to the comparision are provided in the expected order, e.g.
+ // jle32(reg1, Imm32(5)) will branch if the value held in reg1, when
+ // treated as a signed 32bit value, is less than or equal to 5.
+ //
+ // jz and jnz test whether the first operand is equal to zero, and take
+ // an optional second operand of a mask under which to perform the test.
+private:
+
+ // Should we be using TEQ for equal/not-equal?
+ void compare32(RegisterID left, Imm32 right)
+ {
+ int32_t imm = right.m_value;
+ if (!imm)
+ m_assembler.tst(left, left);
+ else {
+ ARMThumbImmediate armImm = ARMThumbImmediate::makeEncodedImm(imm);
+ if (armImm.isValid())
+ m_assembler.cmp(left, armImm);
+ else if ((armImm = ARMThumbImmediate::makeEncodedImm(-imm)).isValid())
+ m_assembler.cmn(left, armImm);
+ else {
+ move(Imm32(imm), dataTempRegister);
+ m_assembler.cmp(left, dataTempRegister);
+ }
+ }
+ }
+
+ void test32(RegisterID reg, Imm32 mask)
+ {
+ int32_t imm = mask.m_value;
+
+ if (imm == -1)
+ m_assembler.tst(reg, reg);
+ else {
+ ARMThumbImmediate armImm = ARMThumbImmediate::makeEncodedImm(imm);
+ if (armImm.isValid())
+ m_assembler.tst(reg, armImm);
+ else {
+ move(mask, dataTempRegister);
+ m_assembler.tst(reg, dataTempRegister);
+ }
+ }
+ }
+
+public:
+ Jump branch32(Condition cond, RegisterID left, RegisterID right)
+ {
+ m_assembler.cmp(left, right);
+ return Jump(makeBranch(cond));
+ }
+
+ Jump branch32(Condition cond, RegisterID left, Imm32 right)
+ {
+ compare32(left, right);
+ return Jump(makeBranch(cond));
+ }
+
+ Jump branch32(Condition cond, RegisterID left, Address right)
+ {
+ load32(right, dataTempRegister);
+ return branch32(cond, left, dataTempRegister);
+ }
+
+ Jump branch32(Condition cond, Address left, RegisterID right)
+ {
+ load32(left, dataTempRegister);
+ return branch32(cond, dataTempRegister, right);
+ }
+
+ Jump branch32(Condition cond, Address left, Imm32 right)
+ {
+ // use addressTempRegister incase the branch32 we call uses dataTempRegister. :-/
+ load32(left, addressTempRegister);
+ return branch32(cond, addressTempRegister, right);
+ }
+
+ Jump branch32(Condition cond, BaseIndex left, Imm32 right)
+ {
+ // use addressTempRegister incase the branch32 we call uses dataTempRegister. :-/
+ load32(left, addressTempRegister);
+ return branch32(cond, addressTempRegister, right);
+ }
+
+ Jump branch32WithUnalignedHalfWords(Condition cond, BaseIndex left, Imm32 right)
+ {
+ // use addressTempRegister incase the branch32 we call uses dataTempRegister. :-/
+ load32WithUnalignedHalfWords(left, addressTempRegister);
+ return branch32(cond, addressTempRegister, right);
+ }
+
+ Jump branch32(Condition cond, AbsoluteAddress left, RegisterID right)
+ {
+ load32(left.m_ptr, dataTempRegister);
+ return branch32(cond, dataTempRegister, right);
+ }
+
+ Jump branch32(Condition cond, AbsoluteAddress left, Imm32 right)
+ {
+ // use addressTempRegister incase the branch32 we call uses dataTempRegister. :-/
+ load32(left.m_ptr, addressTempRegister);
+ return branch32(cond, addressTempRegister, right);
+ }
+
+ Jump branch16(Condition cond, BaseIndex left, RegisterID right)
+ {
+ load16(left, dataTempRegister);
+ m_assembler.lsl(addressTempRegister, right, 16);
+ m_assembler.lsl(dataTempRegister, dataTempRegister, 16);
+ return branch32(cond, dataTempRegister, addressTempRegister);
+ }
+
+ Jump branch16(Condition cond, BaseIndex left, Imm32 right)
+ {
+ // use addressTempRegister incase the branch32 we call uses dataTempRegister. :-/
+ load16(left, addressTempRegister);
+ m_assembler.lsl(addressTempRegister, addressTempRegister, 16);
+ return branch32(cond, addressTempRegister, Imm32(right.m_value << 16));
+ }
+
+ Jump branch8(Condition cond, RegisterID left, Imm32 right)
+ {
+ compare32(left, right);
+ return Jump(makeBranch(cond));
+ }
+
+ Jump branch8(Condition cond, Address left, Imm32 right)
+ {
+ // use addressTempRegister incase the branch8 we call uses dataTempRegister. :-/
+ load8(left, addressTempRegister);
+ return branch8(cond, addressTempRegister, right);
+ }
+
+ Jump branchTest32(Condition cond, RegisterID reg, RegisterID mask)
+ {
+ ASSERT((cond == Zero) || (cond == NonZero));
+ m_assembler.tst(reg, mask);
+ return Jump(makeBranch(cond));
+ }
+
+ Jump branchTest32(Condition cond, RegisterID reg, Imm32 mask = Imm32(-1))
+ {
+ ASSERT((cond == Zero) || (cond == NonZero));
+ test32(reg, mask);
+ return Jump(makeBranch(cond));
+ }
+
+ Jump branchTest32(Condition cond, Address address, Imm32 mask = Imm32(-1))
+ {
+ ASSERT((cond == Zero) || (cond == NonZero));
+ // use addressTempRegister incase the branchTest32 we call uses dataTempRegister. :-/
+ load32(address, addressTempRegister);
+ return branchTest32(cond, addressTempRegister, mask);
+ }
+
+ Jump branchTest32(Condition cond, BaseIndex address, Imm32 mask = Imm32(-1))
+ {
+ ASSERT((cond == Zero) || (cond == NonZero));
+ // use addressTempRegister incase the branchTest32 we call uses dataTempRegister. :-/
+ load32(address, addressTempRegister);
+ return branchTest32(cond, addressTempRegister, mask);
+ }
+
+ Jump branchTest8(Condition cond, RegisterID reg, Imm32 mask = Imm32(-1))
+ {
+ ASSERT((cond == Zero) || (cond == NonZero));
+ test32(reg, mask);
+ return Jump(makeBranch(cond));
+ }
+
+ Jump branchTest8(Condition cond, Address address, Imm32 mask = Imm32(-1))
+ {
+ ASSERT((cond == Zero) || (cond == NonZero));
+ // use addressTempRegister incase the branchTest8 we call uses dataTempRegister. :-/
+ load8(address, addressTempRegister);
+ return branchTest8(cond, addressTempRegister, mask);
+ }
+
+ Jump jump()
+ {
+ return Jump(makeJump());
+ }
+
+ void jump(RegisterID target)
+ {
+ m_assembler.bx(target, ARMv7Assembler::JumpFixed);
+ }
+
+ // Address is a memory location containing the address to jump to
+ void jump(Address address)
+ {
+ load32(address, dataTempRegister);
+ m_assembler.bx(dataTempRegister, ARMv7Assembler::JumpFixed);
+ }
+
+
+ // Arithmetic control flow operations:
+ //
+ // This set of conditional branch operations branch based
+ // on the result of an arithmetic operation. The operation
+ // is performed as normal, storing the result.
+ //
+ // * jz operations branch if the result is zero.
+ // * jo operations branch if the (signed) arithmetic
+ // operation caused an overflow to occur.
+
+ Jump branchAdd32(Condition cond, RegisterID src, RegisterID dest)
+ {
+ ASSERT((cond == Overflow) || (cond == Signed) || (cond == Zero) || (cond == NonZero));
+ m_assembler.add_S(dest, dest, src);
+ return Jump(makeBranch(cond));
+ }
+
+ Jump branchAdd32(Condition cond, Imm32 imm, RegisterID dest)
+ {
+ ASSERT((cond == Overflow) || (cond == Signed) || (cond == Zero) || (cond == NonZero));
+ ARMThumbImmediate armImm = ARMThumbImmediate::makeEncodedImm(imm.m_value);
+ if (armImm.isValid())
+ m_assembler.add_S(dest, dest, armImm);
+ else {
+ move(imm, dataTempRegister);
+ m_assembler.add_S(dest, dest, dataTempRegister);
+ }
+ return Jump(makeBranch(cond));
+ }
+
+ Jump branchMul32(Condition cond, RegisterID src, RegisterID dest)
+ {
+ ASSERT_UNUSED(cond, cond == Overflow);
+ m_assembler.smull(dest, dataTempRegister, dest, src);
+ m_assembler.asr(addressTempRegister, dest, 31);
+ return branch32(NotEqual, addressTempRegister, dataTempRegister);
+ }
+
+ Jump branchMul32(Condition cond, Imm32 imm, RegisterID src, RegisterID dest)
+ {
+ ASSERT_UNUSED(cond, cond == Overflow);
+ move(imm, dataTempRegister);
+ m_assembler.smull(dest, dataTempRegister, src, dataTempRegister);
+ m_assembler.asr(addressTempRegister, dest, 31);
+ return branch32(NotEqual, addressTempRegister, dataTempRegister);
+ }
+
+ Jump branchOr32(Condition cond, RegisterID src, RegisterID dest)
+ {
+ ASSERT((cond == Signed) || (cond == Zero) || (cond == NonZero));
+ m_assembler.orr_S(dest, dest, src);
+ return Jump(makeBranch(cond));
+ }
+
+ Jump branchSub32(Condition cond, RegisterID src, RegisterID dest)
+ {
+ ASSERT((cond == Overflow) || (cond == Signed) || (cond == Zero) || (cond == NonZero));
+ m_assembler.sub_S(dest, dest, src);
+ return Jump(makeBranch(cond));
+ }
+
+ Jump branchSub32(Condition cond, Imm32 imm, RegisterID dest)
+ {
+ ASSERT((cond == Overflow) || (cond == Signed) || (cond == Zero) || (cond == NonZero));
+ ARMThumbImmediate armImm = ARMThumbImmediate::makeEncodedImm(imm.m_value);
+ if (armImm.isValid())
+ m_assembler.sub_S(dest, dest, armImm);
+ else {
+ move(imm, dataTempRegister);
+ m_assembler.sub_S(dest, dest, dataTempRegister);
+ }
+ return Jump(makeBranch(cond));
+ }
+
+ void relativeTableJump(RegisterID index, int scale)
+ {
+ ASSERT(scale >= 0 && scale <= 31);
+
+ // dataTempRegister will point after the jump if index register contains zero
+ move(ARMRegisters::pc, dataTempRegister);
+ m_assembler.add(dataTempRegister, dataTempRegister, ARMThumbImmediate::makeEncodedImm(9));
+
+ ShiftTypeAndAmount shift(SRType_LSL, scale);
+ m_assembler.add(dataTempRegister, dataTempRegister, index, shift);
+ jump(dataTempRegister);
+ }
+
+ // Miscellaneous operations:
+
+ void breakpoint()
+ {
+ m_assembler.bkpt(0);
+ }
+
+ Call nearCall()
+ {
+ moveFixedWidthEncoding(Imm32(0), dataTempRegister);
+ return Call(m_assembler.blx(dataTempRegister, ARMv7Assembler::JumpFixed), Call::LinkableNear);
+ }
+
+ Call call()
+ {
+ moveFixedWidthEncoding(Imm32(0), dataTempRegister);
+ return Call(m_assembler.blx(dataTempRegister, ARMv7Assembler::JumpFixed), Call::Linkable);
+ }
+
+ Call call(RegisterID target)
+ {
+ return Call(m_assembler.blx(target, ARMv7Assembler::JumpFixed), Call::None);
+ }
+
+ Call call(Address address)
+ {
+ load32(address, dataTempRegister);
+ return Call(m_assembler.blx(dataTempRegister, ARMv7Assembler::JumpFixed), Call::None);
+ }
+
+ void ret()
+ {
+ m_assembler.bx(linkRegister, ARMv7Assembler::JumpFixed);
+ }
+
+ void set32Compare32(Condition cond, RegisterID left, RegisterID right, RegisterID dest)
+ {
+ m_assembler.cmp(left, right);
+ m_assembler.it(armV7Condition(cond), false);
+ m_assembler.mov(dest, ARMThumbImmediate::makeUInt16(1));
+ m_assembler.mov(dest, ARMThumbImmediate::makeUInt16(0));
+ }
+
+ void set32Compare32(Condition cond, Address left, RegisterID right, RegisterID dest)
+ {
+ load32(left, dataTempRegister);
+ set32Compare32(cond, dataTempRegister, right, dest);
+ }
+
+ void set32Compare32(Condition cond, RegisterID left, Imm32 right, RegisterID dest)
+ {
+ compare32(left, right);
+ m_assembler.it(armV7Condition(cond), false);
+ m_assembler.mov(dest, ARMThumbImmediate::makeUInt16(1));
+ m_assembler.mov(dest, ARMThumbImmediate::makeUInt16(0));
+ }
+
+ void set8Compare32(Condition cond, RegisterID left, RegisterID right, RegisterID dest)
+ {
+ set32Compare32(cond, left, right, dest);
+ }
+
+ void set8Compare32(Condition cond, Address left, RegisterID right, RegisterID dest)
+ {
+ set32Compare32(cond, left, right, dest);
+ }
+
+ void set8Compare32(Condition cond, RegisterID left, Imm32 right, RegisterID dest)
+ {
+ set32Compare32(cond, left, right, dest);
+ }
+
+ // FIXME:
+ // The mask should be optional... paerhaps the argument order should be
+ // dest-src, operations always have a dest? ... possibly not true, considering
+ // asm ops like test, or pseudo ops like pop().
+ void set32Test32(Condition cond, Address address, Imm32 mask, RegisterID dest)
+ {
+ load32(address, dataTempRegister);
+ test32(dataTempRegister, mask);
+ m_assembler.it(armV7Condition(cond), false);
+ m_assembler.mov(dest, ARMThumbImmediate::makeUInt16(1));
+ m_assembler.mov(dest, ARMThumbImmediate::makeUInt16(0));
+ }
+
+ void set32Test8(Condition cond, Address address, Imm32 mask, RegisterID dest)
+ {
+ load8(address, dataTempRegister);
+ test32(dataTempRegister, mask);
+ m_assembler.it(armV7Condition(cond), false);
+ m_assembler.mov(dest, ARMThumbImmediate::makeUInt16(1));
+ m_assembler.mov(dest, ARMThumbImmediate::makeUInt16(0));
+ }
+
+ DataLabel32 moveWithPatch(Imm32 imm, RegisterID dst)
+ {
+ moveFixedWidthEncoding(imm, dst);
+ return DataLabel32(this);
+ }
+
+ DataLabelPtr moveWithPatch(ImmPtr imm, RegisterID dst)
+ {
+ moveFixedWidthEncoding(Imm32(imm), dst);
+ return DataLabelPtr(this);
+ }
+
+ Jump branchPtrWithPatch(Condition cond, RegisterID left, DataLabelPtr& dataLabel, ImmPtr initialRightValue = ImmPtr(0))
+ {
+ dataLabel = moveWithPatch(initialRightValue, dataTempRegister);
+ return branch32(cond, left, dataTempRegister);
+ }
+
+ Jump branchPtrWithPatch(Condition cond, Address left, DataLabelPtr& dataLabel, ImmPtr initialRightValue = ImmPtr(0))
+ {
+ load32(left, addressTempRegister);
+ dataLabel = moveWithPatch(initialRightValue, dataTempRegister);
+ return branch32(cond, addressTempRegister, dataTempRegister);
+ }
+
+ DataLabelPtr storePtrWithPatch(ImmPtr initialValue, ImplicitAddress address)
+ {
+ DataLabelPtr label = moveWithPatch(initialValue, dataTempRegister);
+ store32(dataTempRegister, address);
+ return label;
+ }
+ DataLabelPtr storePtrWithPatch(ImplicitAddress address) { return storePtrWithPatch(ImmPtr(0), address); }
+
+
+ Call tailRecursiveCall()
+ {
+ // Like a normal call, but don't link.
+ moveFixedWidthEncoding(Imm32(0), dataTempRegister);
+ return Call(m_assembler.bx(dataTempRegister, ARMv7Assembler::JumpFixed), Call::Linkable);
+ }
+
+ Call makeTailRecursiveCall(Jump oldJump)
+ {
+ oldJump.link(this);
+ return tailRecursiveCall();
+ }
+
+
+ int executableOffsetFor(int location)
+ {
+ return m_assembler.executableOffsetFor(location);
+ }
+
+protected:
+ bool inUninterruptedSequence()
+ {
+ return m_inUninterruptedSequence;
+ }
+
+ ARMv7Assembler::JmpSrc makeJump()
+ {
+ moveFixedWidthEncoding(Imm32(0), dataTempRegister);
+ return m_assembler.bx(dataTempRegister, inUninterruptedSequence() ? ARMv7Assembler::JumpNoConditionFixedSize : ARMv7Assembler::JumpNoCondition);
+ }
+
+ ARMv7Assembler::JmpSrc makeBranch(ARMv7Assembler::Condition cond)
+ {
+ m_assembler.it(cond, true, true);
+ moveFixedWidthEncoding(Imm32(0), dataTempRegister);
+ return m_assembler.bx(dataTempRegister, inUninterruptedSequence() ? ARMv7Assembler::JumpConditionFixedSize : ARMv7Assembler::JumpCondition, cond);
+ }
+ ARMv7Assembler::JmpSrc makeBranch(Condition cond) { return makeBranch(armV7Condition(cond)); }
+ ARMv7Assembler::JmpSrc makeBranch(DoubleCondition cond) { return makeBranch(armV7Condition(cond)); }
+
+ ArmAddress setupArmAddress(BaseIndex address)
+ {
+ if (address.offset) {
+ ARMThumbImmediate imm = ARMThumbImmediate::makeUInt12OrEncodedImm(address.offset);
+ if (imm.isValid())
+ m_assembler.add(addressTempRegister, address.base, imm);
+ else {
+ move(Imm32(address.offset), addressTempRegister);
+ m_assembler.add(addressTempRegister, addressTempRegister, address.base);
+ }
+
+ return ArmAddress(addressTempRegister, address.index, address.scale);
+ } else
+ return ArmAddress(address.base, address.index, address.scale);
+ }
+
+ ArmAddress setupArmAddress(Address address)
+ {
+ if ((address.offset >= -0xff) && (address.offset <= 0xfff))
+ return ArmAddress(address.base, address.offset);
+
+ move(Imm32(address.offset), addressTempRegister);
+ return ArmAddress(address.base, addressTempRegister);
+ }
+
+ ArmAddress setupArmAddress(ImplicitAddress address)
+ {
+ if ((address.offset >= -0xff) && (address.offset <= 0xfff))
+ return ArmAddress(address.base, address.offset);
+
+ move(Imm32(address.offset), addressTempRegister);
+ return ArmAddress(address.base, addressTempRegister);
+ }
+
+ RegisterID makeBaseIndexBase(BaseIndex address)
+ {
+ if (!address.offset)
+ return address.base;
+
+ ARMThumbImmediate imm = ARMThumbImmediate::makeUInt12OrEncodedImm(address.offset);
+ if (imm.isValid())
+ m_assembler.add(addressTempRegister, address.base, imm);
+ else {
+ move(Imm32(address.offset), addressTempRegister);
+ m_assembler.add(addressTempRegister, addressTempRegister, address.base);
+ }
+
+ return addressTempRegister;
+ }
+
+ void moveFixedWidthEncoding(Imm32 imm, RegisterID dst)
+ {
+ uint32_t value = imm.m_value;
+ m_assembler.movT3(dst, ARMThumbImmediate::makeUInt16(value & 0xffff));
+ m_assembler.movt(dst, ARMThumbImmediate::makeUInt16(value >> 16));
+ }
+
+ ARMv7Assembler::Condition armV7Condition(Condition cond)
+ {
+ return static_cast<ARMv7Assembler::Condition>(cond);
+ }
+
+ ARMv7Assembler::Condition armV7Condition(DoubleCondition cond)
+ {
+ return static_cast<ARMv7Assembler::Condition>(cond);
+ }
+
+private:
+ friend class LinkBuffer;
+ friend class RepatchBuffer;
+
+ static void linkCall(void* code, Call call, FunctionPtr function)
+ {
+ ARMv7Assembler::linkCall(code, call.m_jmp, function.value());
+ }
+
+ static void repatchCall(CodeLocationCall call, CodeLocationLabel destination)
+ {
+ ARMv7Assembler::relinkCall(call.dataLocation(), destination.executableAddress());
+ }
+
+ static void repatchCall(CodeLocationCall call, FunctionPtr destination)
+ {
+ ARMv7Assembler::relinkCall(call.dataLocation(), destination.executableAddress());
+ }
+
+ bool m_inUninterruptedSequence;
+};
+
+} // namespace JSC
+
+#endif // ENABLE(ASSEMBLER)
+
+#endif // MacroAssemblerARMv7_h
diff --git a/Source/JavaScriptCore/assembler/MacroAssemblerCodeRef.h b/Source/JavaScriptCore/assembler/MacroAssemblerCodeRef.h
new file mode 100644
index 0000000..543b0fa
--- /dev/null
+++ b/Source/JavaScriptCore/assembler/MacroAssemblerCodeRef.h
@@ -0,0 +1,192 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef MacroAssemblerCodeRef_h
+#define MacroAssemblerCodeRef_h
+
+#include "ExecutableAllocator.h"
+#include "PassRefPtr.h"
+#include "RefPtr.h"
+#include "UnusedParam.h"
+
+#if ENABLE(ASSEMBLER)
+
+// ASSERT_VALID_CODE_POINTER checks that ptr is a non-null pointer, and that it is a valid
+// instruction address on the platform (for example, check any alignment requirements).
+#if CPU(ARM_THUMB2)
+// ARM/thumb instructions must be 16-bit aligned, but all code pointers to be loaded
+// into the processor are decorated with the bottom bit set, indicating that this is
+// thumb code (as oposed to 32-bit traditional ARM). The first test checks for both
+// decorated and undectorated null, and the second test ensures that the pointer is
+// decorated.
+#define ASSERT_VALID_CODE_POINTER(ptr) \
+ ASSERT(reinterpret_cast<intptr_t>(ptr) & ~1); \
+ ASSERT(reinterpret_cast<intptr_t>(ptr) & 1)
+#define ASSERT_VALID_CODE_OFFSET(offset) \
+ ASSERT(!(offset & 1)) // Must be multiple of 2.
+#else
+#define ASSERT_VALID_CODE_POINTER(ptr) \
+ ASSERT(ptr)
+#define ASSERT_VALID_CODE_OFFSET(offset) // Anything goes!
+#endif
+
+namespace JSC {
+
+// FunctionPtr:
+//
+// FunctionPtr should be used to wrap pointers to C/C++ functions in JSC
+// (particularly, the stub functions).
+class FunctionPtr {
+public:
+ FunctionPtr()
+ : m_value(0)
+ {
+ }
+
+ template<typename FunctionType>
+ explicit FunctionPtr(FunctionType* value)
+#if COMPILER(RVCT)
+ // RVTC compiler needs C-style cast as it fails with the following error
+ // Error: #694: reinterpret_cast cannot cast away const or other type qualifiers
+ : m_value((void*)(value))
+#else
+ : m_value(reinterpret_cast<void*>(value))
+#endif
+ {
+ ASSERT_VALID_CODE_POINTER(m_value);
+ }
+
+ void* value() const { return m_value; }
+ void* executableAddress() const { return m_value; }
+
+
+private:
+ void* m_value;
+};
+
+// ReturnAddressPtr:
+//
+// ReturnAddressPtr should be used to wrap return addresses generated by processor
+// 'call' instructions exectued in JIT code. We use return addresses to look up
+// exception and optimization information, and to repatch the call instruction
+// that is the source of the return address.
+class ReturnAddressPtr {
+public:
+ ReturnAddressPtr()
+ : m_value(0)
+ {
+ }
+
+ explicit ReturnAddressPtr(void* value)
+ : m_value(value)
+ {
+ ASSERT_VALID_CODE_POINTER(m_value);
+ }
+
+ explicit ReturnAddressPtr(FunctionPtr function)
+ : m_value(function.value())
+ {
+ ASSERT_VALID_CODE_POINTER(m_value);
+ }
+
+ void* value() const { return m_value; }
+
+private:
+ void* m_value;
+};
+
+// MacroAssemblerCodePtr:
+//
+// MacroAssemblerCodePtr should be used to wrap pointers to JIT generated code.
+class MacroAssemblerCodePtr {
+public:
+ MacroAssemblerCodePtr()
+ : m_value(0)
+ {
+ }
+
+ explicit MacroAssemblerCodePtr(void* value)
+#if CPU(ARM_THUMB2)
+ // Decorate the pointer as a thumb code pointer.
+ : m_value(reinterpret_cast<char*>(value) + 1)
+#else
+ : m_value(value)
+#endif
+ {
+ ASSERT_VALID_CODE_POINTER(m_value);
+ }
+
+ explicit MacroAssemblerCodePtr(ReturnAddressPtr ra)
+ : m_value(ra.value())
+ {
+ ASSERT_VALID_CODE_POINTER(m_value);
+ }
+
+ void* executableAddress() const { return m_value; }
+#if CPU(ARM_THUMB2)
+ // To use this pointer as a data address remove the decoration.
+ void* dataLocation() const { ASSERT_VALID_CODE_POINTER(m_value); return reinterpret_cast<char*>(m_value) - 1; }
+#else
+ void* dataLocation() const { ASSERT_VALID_CODE_POINTER(m_value); return m_value; }
+#endif
+
+ bool operator!()
+ {
+ return !m_value;
+ }
+
+private:
+ void* m_value;
+};
+
+// MacroAssemblerCodeRef:
+//
+// A reference to a section of JIT generated code. A CodeRef consists of a
+// pointer to the code, and a ref pointer to the pool from within which it
+// was allocated.
+class MacroAssemblerCodeRef {
+public:
+ MacroAssemblerCodeRef()
+ : m_size(0)
+ {
+ }
+
+ MacroAssemblerCodeRef(void* code, PassRefPtr<ExecutablePool> executablePool, size_t size)
+ : m_code(code)
+ , m_executablePool(executablePool)
+ , m_size(size)
+ {
+ }
+
+ MacroAssemblerCodePtr m_code;
+ RefPtr<ExecutablePool> m_executablePool;
+ size_t m_size;
+};
+
+} // namespace JSC
+
+#endif // ENABLE(ASSEMBLER)
+
+#endif // MacroAssemblerCodeRef_h
diff --git a/Source/JavaScriptCore/assembler/MacroAssemblerMIPS.h b/Source/JavaScriptCore/assembler/MacroAssemblerMIPS.h
new file mode 100644
index 0000000..fcfbcda
--- /dev/null
+++ b/Source/JavaScriptCore/assembler/MacroAssemblerMIPS.h
@@ -0,0 +1,1873 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2010 MIPS Technologies, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY MIPS TECHNOLOGIES, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MIPS TECHNOLOGIES, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef MacroAssemblerMIPS_h
+#define MacroAssemblerMIPS_h
+
+#if ENABLE(ASSEMBLER) && CPU(MIPS)
+
+#include "AbstractMacroAssembler.h"
+#include "MIPSAssembler.h"
+
+namespace JSC {
+
+class MacroAssemblerMIPS : public AbstractMacroAssembler<MIPSAssembler> {
+public:
+ typedef MIPSRegisters::FPRegisterID FPRegisterID;
+
+ MacroAssemblerMIPS()
+ : m_fixedWidth(false)
+ {
+ }
+
+ static const Scale ScalePtr = TimesFour;
+
+ // For storing immediate number
+ static const RegisterID immTempRegister = MIPSRegisters::t0;
+ // For storing data loaded from the memory
+ static const RegisterID dataTempRegister = MIPSRegisters::t1;
+ // For storing address base
+ static const RegisterID addrTempRegister = MIPSRegisters::t2;
+ // For storing compare result
+ static const RegisterID cmpTempRegister = MIPSRegisters::t3;
+
+ // FP temp register
+ static const FPRegisterID fpTempRegister = MIPSRegisters::f16;
+
+ enum Condition {
+ Equal,
+ NotEqual,
+ Above,
+ AboveOrEqual,
+ Below,
+ BelowOrEqual,
+ GreaterThan,
+ GreaterThanOrEqual,
+ LessThan,
+ LessThanOrEqual,
+ Overflow,
+ Signed,
+ Zero,
+ NonZero
+ };
+
+ enum DoubleCondition {
+ DoubleEqual,
+ DoubleNotEqual,
+ DoubleGreaterThan,
+ DoubleGreaterThanOrEqual,
+ DoubleLessThan,
+ DoubleLessThanOrEqual,
+ DoubleEqualOrUnordered,
+ DoubleNotEqualOrUnordered,
+ DoubleGreaterThanOrUnordered,
+ DoubleGreaterThanOrEqualOrUnordered,
+ DoubleLessThanOrUnordered,
+ DoubleLessThanOrEqualOrUnordered
+ };
+
+ static const RegisterID stackPointerRegister = MIPSRegisters::sp;
+ static const RegisterID returnAddressRegister = MIPSRegisters::ra;
+
+ // Integer arithmetic operations:
+ //
+ // Operations are typically two operand - operation(source, srcDst)
+ // For many operations the source may be an Imm32, the srcDst operand
+ // may often be a memory location (explictly described using an Address
+ // object).
+
+ void add32(RegisterID src, RegisterID dest)
+ {
+ m_assembler.addu(dest, dest, src);
+ }
+
+ void add32(Imm32 imm, RegisterID dest)
+ {
+ add32(imm, dest, dest);
+ }
+
+ void add32(Imm32 imm, RegisterID src, RegisterID dest)
+ {
+ if (!imm.m_isPointer && imm.m_value >= -32768 && imm.m_value <= 32767
+ && !m_fixedWidth) {
+ /*
+ addiu dest, src, imm
+ */
+ m_assembler.addiu(dest, src, imm.m_value);
+ } else {
+ /*
+ li immTemp, imm
+ addu dest, src, immTemp
+ */
+ move(imm, immTempRegister);
+ m_assembler.addu(dest, src, immTempRegister);
+ }
+ }
+
+ void add32(Imm32 imm, Address address)
+ {
+ if (address.offset >= -32768 && address.offset <= 32767
+ && !m_fixedWidth) {
+ /*
+ lw dataTemp, offset(base)
+ li immTemp, imm
+ addu dataTemp, dataTemp, immTemp
+ sw dataTemp, offset(base)
+ */
+ m_assembler.lw(dataTempRegister, address.base, address.offset);
+ if (!imm.m_isPointer
+ && imm.m_value >= -32768 && imm.m_value <= 32767
+ && !m_fixedWidth)
+ m_assembler.addiu(dataTempRegister, dataTempRegister,
+ imm.m_value);
+ else {
+ move(imm, immTempRegister);
+ m_assembler.addu(dataTempRegister, dataTempRegister,
+ immTempRegister);
+ }
+ m_assembler.sw(dataTempRegister, address.base, address.offset);
+ } else {
+ /*
+ lui addrTemp, (offset + 0x8000) >> 16
+ addu addrTemp, addrTemp, base
+ lw dataTemp, (offset & 0xffff)(addrTemp)
+ li immtemp, imm
+ addu dataTemp, dataTemp, immTemp
+ sw dataTemp, (offset & 0xffff)(addrTemp)
+ */
+ m_assembler.lui(addrTempRegister, (address.offset + 0x8000) >> 16);
+ m_assembler.addu(addrTempRegister, addrTempRegister, address.base);
+ m_assembler.lw(dataTempRegister, addrTempRegister, address.offset);
+
+ if (imm.m_value >= -32768 && imm.m_value <= 32767 && !m_fixedWidth)
+ m_assembler.addiu(dataTempRegister, dataTempRegister,
+ imm.m_value);
+ else {
+ move(imm, immTempRegister);
+ m_assembler.addu(dataTempRegister, dataTempRegister,
+ immTempRegister);
+ }
+ m_assembler.sw(dataTempRegister, addrTempRegister, address.offset);
+ }
+ }
+
+ void add32(Address src, RegisterID dest)
+ {
+ load32(src, dataTempRegister);
+ add32(dataTempRegister, dest);
+ }
+
+ void add32(RegisterID src, Address dest)
+ {
+ if (dest.offset >= -32768 && dest.offset <= 32767 && !m_fixedWidth) {
+ /*
+ lw dataTemp, offset(base)
+ addu dataTemp, dataTemp, src
+ sw dataTemp, offset(base)
+ */
+ m_assembler.lw(dataTempRegister, dest.base, dest.offset);
+ m_assembler.addu(dataTempRegister, dataTempRegister, src);
+ m_assembler.sw(dataTempRegister, dest.base, dest.offset);
+ } else {
+ /*
+ lui addrTemp, (offset + 0x8000) >> 16
+ addu addrTemp, addrTemp, base
+ lw dataTemp, (offset & 0xffff)(addrTemp)
+ addu dataTemp, dataTemp, src
+ sw dataTemp, (offset & 0xffff)(addrTemp)
+ */
+ m_assembler.lui(addrTempRegister, (dest.offset + 0x8000) >> 16);
+ m_assembler.addu(addrTempRegister, addrTempRegister, dest.base);
+ m_assembler.lw(dataTempRegister, addrTempRegister, dest.offset);
+ m_assembler.addu(dataTempRegister, dataTempRegister, src);
+ m_assembler.sw(dataTempRegister, addrTempRegister, dest.offset);
+ }
+ }
+
+ void add32(Imm32 imm, AbsoluteAddress address)
+ {
+ /*
+ li addrTemp, address
+ li immTemp, imm
+ lw dataTemp, 0(addrTemp)
+ addu dataTemp, dataTemp, immTemp
+ sw dataTemp, 0(addrTemp)
+ */
+ move(ImmPtr(address.m_ptr), addrTempRegister);
+ m_assembler.lw(dataTempRegister, addrTempRegister, 0);
+ if (!imm.m_isPointer && imm.m_value >= -32768 && imm.m_value <= 32767
+ && !m_fixedWidth)
+ m_assembler.addiu(dataTempRegister, dataTempRegister, imm.m_value);
+ else {
+ move(imm, immTempRegister);
+ m_assembler.addu(dataTempRegister, dataTempRegister, immTempRegister);
+ }
+ m_assembler.sw(dataTempRegister, addrTempRegister, 0);
+ }
+
+ void and32(RegisterID src, RegisterID dest)
+ {
+ m_assembler.andInsn(dest, dest, src);
+ }
+
+ void and32(Imm32 imm, RegisterID dest)
+ {
+ if (!imm.m_isPointer && !imm.m_value && !m_fixedWidth)
+ move(MIPSRegisters::zero, dest);
+ else if (!imm.m_isPointer && imm.m_value > 0 && imm.m_value < 65535
+ && !m_fixedWidth)
+ m_assembler.andi(dest, dest, imm.m_value);
+ else {
+ /*
+ li immTemp, imm
+ and dest, dest, immTemp
+ */
+ move(imm, immTempRegister);
+ m_assembler.andInsn(dest, dest, immTempRegister);
+ }
+ }
+
+ void lshift32(Imm32 imm, RegisterID dest)
+ {
+ m_assembler.sll(dest, dest, imm.m_value);
+ }
+
+ void lshift32(RegisterID shiftAmount, RegisterID dest)
+ {
+ m_assembler.sllv(dest, dest, shiftAmount);
+ }
+
+ void mul32(RegisterID src, RegisterID dest)
+ {
+ m_assembler.mul(dest, dest, src);
+ }
+
+ void mul32(Imm32 imm, RegisterID src, RegisterID dest)
+ {
+ if (!imm.m_isPointer && !imm.m_value && !m_fixedWidth)
+ move(MIPSRegisters::zero, dest);
+ else if (!imm.m_isPointer && imm.m_value == 1 && !m_fixedWidth)
+ move(src, dest);
+ else {
+ /*
+ li dataTemp, imm
+ mul dest, src, dataTemp
+ */
+ move(imm, dataTempRegister);
+ m_assembler.mul(dest, src, dataTempRegister);
+ }
+ }
+
+ void neg32(RegisterID srcDest)
+ {
+ m_assembler.subu(srcDest, MIPSRegisters::zero, srcDest);
+ }
+
+ void not32(RegisterID srcDest)
+ {
+ m_assembler.nor(srcDest, srcDest, MIPSRegisters::zero);
+ }
+
+ void or32(RegisterID src, RegisterID dest)
+ {
+ m_assembler.orInsn(dest, dest, src);
+ }
+
+ void or32(Imm32 imm, RegisterID dest)
+ {
+ if (!imm.m_isPointer && !imm.m_value && !m_fixedWidth)
+ return;
+
+ if (!imm.m_isPointer && imm.m_value > 0 && imm.m_value < 65535
+ && !m_fixedWidth) {
+ m_assembler.ori(dest, dest, imm.m_value);
+ return;
+ }
+
+ /*
+ li dataTemp, imm
+ or dest, dest, dataTemp
+ */
+ move(imm, dataTempRegister);
+ m_assembler.orInsn(dest, dest, dataTempRegister);
+ }
+
+ void rshift32(RegisterID shiftAmount, RegisterID dest)
+ {
+ m_assembler.srav(dest, dest, shiftAmount);
+ }
+
+ void rshift32(Imm32 imm, RegisterID dest)
+ {
+ m_assembler.sra(dest, dest, imm.m_value);
+ }
+
+ void urshift32(RegisterID shiftAmount, RegisterID dest)
+ {
+ m_assembler.srlv(dest, dest, shiftAmount);
+ }
+
+ void urshift32(Imm32 imm, RegisterID dest)
+ {
+ m_assembler.srl(dest, dest, imm.m_value);
+ }
+
+ void sub32(RegisterID src, RegisterID dest)
+ {
+ m_assembler.subu(dest, dest, src);
+ }
+
+ void sub32(Imm32 imm, RegisterID dest)
+ {
+ if (!imm.m_isPointer && imm.m_value >= -32767 && imm.m_value <= 32768
+ && !m_fixedWidth) {
+ /*
+ addiu dest, src, imm
+ */
+ m_assembler.addiu(dest, dest, -imm.m_value);
+ } else {
+ /*
+ li immTemp, imm
+ subu dest, src, immTemp
+ */
+ move(imm, immTempRegister);
+ m_assembler.subu(dest, dest, immTempRegister);
+ }
+ }
+
+ void sub32(Imm32 imm, Address address)
+ {
+ if (address.offset >= -32768 && address.offset <= 32767
+ && !m_fixedWidth) {
+ /*
+ lw dataTemp, offset(base)
+ li immTemp, imm
+ subu dataTemp, dataTemp, immTemp
+ sw dataTemp, offset(base)
+ */
+ m_assembler.lw(dataTempRegister, address.base, address.offset);
+ if (!imm.m_isPointer
+ && imm.m_value >= -32767 && imm.m_value <= 32768
+ && !m_fixedWidth)
+ m_assembler.addiu(dataTempRegister, dataTempRegister,
+ -imm.m_value);
+ else {
+ move(imm, immTempRegister);
+ m_assembler.subu(dataTempRegister, dataTempRegister,
+ immTempRegister);
+ }
+ m_assembler.sw(dataTempRegister, address.base, address.offset);
+ } else {
+ /*
+ lui addrTemp, (offset + 0x8000) >> 16
+ addu addrTemp, addrTemp, base
+ lw dataTemp, (offset & 0xffff)(addrTemp)
+ li immtemp, imm
+ subu dataTemp, dataTemp, immTemp
+ sw dataTemp, (offset & 0xffff)(addrTemp)
+ */
+ m_assembler.lui(addrTempRegister, (address.offset + 0x8000) >> 16);
+ m_assembler.addu(addrTempRegister, addrTempRegister, address.base);
+ m_assembler.lw(dataTempRegister, addrTempRegister, address.offset);
+
+ if (!imm.m_isPointer
+ && imm.m_value >= -32767 && imm.m_value <= 32768
+ && !m_fixedWidth)
+ m_assembler.addiu(dataTempRegister, dataTempRegister,
+ -imm.m_value);
+ else {
+ move(imm, immTempRegister);
+ m_assembler.subu(dataTempRegister, dataTempRegister,
+ immTempRegister);
+ }
+ m_assembler.sw(dataTempRegister, addrTempRegister, address.offset);
+ }
+ }
+
+ void sub32(Address src, RegisterID dest)
+ {
+ load32(src, dataTempRegister);
+ sub32(dataTempRegister, dest);
+ }
+
+ void sub32(Imm32 imm, AbsoluteAddress address)
+ {
+ /*
+ li addrTemp, address
+ li immTemp, imm
+ lw dataTemp, 0(addrTemp)
+ subu dataTemp, dataTemp, immTemp
+ sw dataTemp, 0(addrTemp)
+ */
+ move(ImmPtr(address.m_ptr), addrTempRegister);
+ m_assembler.lw(dataTempRegister, addrTempRegister, 0);
+
+ if (!imm.m_isPointer && imm.m_value >= -32767 && imm.m_value <= 32768
+ && !m_fixedWidth) {
+ m_assembler.addiu(dataTempRegister, dataTempRegister,
+ -imm.m_value);
+ } else {
+ move(imm, immTempRegister);
+ m_assembler.subu(dataTempRegister, dataTempRegister, immTempRegister);
+ }
+ m_assembler.sw(dataTempRegister, addrTempRegister, 0);
+ }
+
+ void xor32(RegisterID src, RegisterID dest)
+ {
+ m_assembler.xorInsn(dest, dest, src);
+ }
+
+ void xor32(Imm32 imm, RegisterID dest)
+ {
+ /*
+ li immTemp, imm
+ xor dest, dest, immTemp
+ */
+ move(imm, immTempRegister);
+ m_assembler.xorInsn(dest, dest, immTempRegister);
+ }
+
+ void sqrtDouble(FPRegisterID src, FPRegisterID dst)
+ {
+ m_assembler.sqrtd(dst, src);
+ }
+
+ // Memory access operations:
+ //
+ // Loads are of the form load(address, destination) and stores of the form
+ // store(source, address). The source for a store may be an Imm32. Address
+ // operand objects to loads and store will be implicitly constructed if a
+ // register is passed.
+
+ /* Need to use zero-extened load byte for load8. */
+ void load8(ImplicitAddress address, RegisterID dest)
+ {
+ if (address.offset >= -32768 && address.offset <= 32767
+ && !m_fixedWidth)
+ m_assembler.lbu(dest, address.base, address.offset);
+ else {
+ /*
+ lui addrTemp, (offset + 0x8000) >> 16
+ addu addrTemp, addrTemp, base
+ lbu dest, (offset & 0xffff)(addrTemp)
+ */
+ m_assembler.lui(addrTempRegister, (address.offset + 0x8000) >> 16);
+ m_assembler.addu(addrTempRegister, addrTempRegister, address.base);
+ m_assembler.lbu(dest, addrTempRegister, address.offset);
+ }
+ }
+
+ void load32(ImplicitAddress address, RegisterID dest)
+ {
+ if (address.offset >= -32768 && address.offset <= 32767
+ && !m_fixedWidth)
+ m_assembler.lw(dest, address.base, address.offset);
+ else {
+ /*
+ lui addrTemp, (offset + 0x8000) >> 16
+ addu addrTemp, addrTemp, base
+ lw dest, (offset & 0xffff)(addrTemp)
+ */
+ m_assembler.lui(addrTempRegister, (address.offset + 0x8000) >> 16);
+ m_assembler.addu(addrTempRegister, addrTempRegister, address.base);
+ m_assembler.lw(dest, addrTempRegister, address.offset);
+ }
+ }
+
+ void load32(BaseIndex address, RegisterID dest)
+ {
+ if (address.offset >= -32768 && address.offset <= 32767
+ && !m_fixedWidth) {
+ /*
+ sll addrTemp, address.index, address.scale
+ addu addrTemp, addrTemp, address.base
+ lw dest, address.offset(addrTemp)
+ */
+ m_assembler.sll(addrTempRegister, address.index, address.scale);
+ m_assembler.addu(addrTempRegister, addrTempRegister, address.base);
+ m_assembler.lw(dest, addrTempRegister, address.offset);
+ } else {
+ /*
+ sll addrTemp, address.index, address.scale
+ addu addrTemp, addrTemp, address.base
+ lui immTemp, (address.offset + 0x8000) >> 16
+ addu addrTemp, addrTemp, immTemp
+ lw dest, (address.offset & 0xffff)(at)
+ */
+ m_assembler.sll(addrTempRegister, address.index, address.scale);
+ m_assembler.addu(addrTempRegister, addrTempRegister, address.base);
+ m_assembler.lui(immTempRegister, (address.offset + 0x8000) >> 16);
+ m_assembler.addu(addrTempRegister, addrTempRegister,
+ immTempRegister);
+ m_assembler.lw(dest, addrTempRegister, address.offset);
+ }
+ }
+
+ void load32WithUnalignedHalfWords(BaseIndex address, RegisterID dest)
+ {
+ if (address.offset >= -32768 && address.offset <= 32764
+ && !m_fixedWidth) {
+ /*
+ sll addrTemp, address.index, address.scale
+ addu addrTemp, addrTemp, address.base
+ (Big-Endian)
+ lwl dest, address.offset(addrTemp)
+ lwr dest, address.offset+3(addrTemp)
+ (Little-Endian)
+ lwl dest, address.offset+3(addrTemp)
+ lwr dest, address.offset(addrTemp)
+ */
+ m_assembler.sll(addrTempRegister, address.index, address.scale);
+ m_assembler.addu(addrTempRegister, addrTempRegister, address.base);
+#if CPU(BIG_ENDIAN)
+ m_assembler.lwl(dest, addrTempRegister, address.offset);
+ m_assembler.lwr(dest, addrTempRegister, address.offset + 3);
+#else
+ m_assembler.lwl(dest, addrTempRegister, address.offset + 3);
+ m_assembler.lwr(dest, addrTempRegister, address.offset);
+
+#endif
+ } else {
+ /*
+ sll addrTemp, address.index, address.scale
+ addu addrTemp, addrTemp, address.base
+ lui immTemp, address.offset >> 16
+ ori immTemp, immTemp, address.offset & 0xffff
+ addu addrTemp, addrTemp, immTemp
+ (Big-Endian)
+ lw dest, 0(at)
+ lw dest, 3(at)
+ (Little-Endian)
+ lw dest, 3(at)
+ lw dest, 0(at)
+ */
+ m_assembler.sll(addrTempRegister, address.index, address.scale);
+ m_assembler.addu(addrTempRegister, addrTempRegister, address.base);
+ m_assembler.lui(immTempRegister, address.offset >> 16);
+ m_assembler.ori(immTempRegister, immTempRegister, address.offset);
+ m_assembler.addu(addrTempRegister, addrTempRegister,
+ immTempRegister);
+#if CPU(BIG_ENDIAN)
+ m_assembler.lwl(dest, addrTempRegister, 0);
+ m_assembler.lwr(dest, addrTempRegister, 3);
+#else
+ m_assembler.lwl(dest, addrTempRegister, 3);
+ m_assembler.lwr(dest, addrTempRegister, 0);
+#endif
+ }
+ }
+
+ void load32(void* address, RegisterID dest)
+ {
+ /*
+ li addrTemp, address
+ lw dest, 0(addrTemp)
+ */
+ move(ImmPtr(address), addrTempRegister);
+ m_assembler.lw(dest, addrTempRegister, 0);
+ }
+
+ DataLabel32 load32WithAddressOffsetPatch(Address address, RegisterID dest)
+ {
+ m_fixedWidth = true;
+ /*
+ lui addrTemp, address.offset >> 16
+ ori addrTemp, addrTemp, address.offset & 0xffff
+ addu addrTemp, addrTemp, address.base
+ lw dest, 0(addrTemp)
+ */
+ DataLabel32 dataLabel(this);
+ move(Imm32(address.offset), addrTempRegister);
+ m_assembler.addu(addrTempRegister, addrTempRegister, address.base);
+ m_assembler.lw(dest, addrTempRegister, 0);
+ m_fixedWidth = false;
+ return dataLabel;
+ }
+
+ Label loadPtrWithPatchToLEA(Address address, RegisterID dest)
+ {
+ m_fixedWidth = true;
+ /*
+ lui addrTemp, address.offset >> 16
+ ori addrTemp, addrTemp, address.offset & 0xffff
+ addu addrTemp, addrTemp, address.base
+ lw dest, 0(addrTemp)
+ */
+ Label label(this);
+ move(Imm32(address.offset), addrTempRegister);
+ m_assembler.addu(addrTempRegister, addrTempRegister, address.base);
+ m_assembler.lw(dest, addrTempRegister, 0);
+ m_fixedWidth = false;
+ return label;
+ }
+
+ /* Need to use zero-extened load half-word for load16. */
+ void load16(ImplicitAddress address, RegisterID dest)
+ {
+ if (address.offset >= -32768 && address.offset <= 32767
+ && !m_fixedWidth)
+ m_assembler.lhu(dest, address.base, address.offset);
+ else {
+ /*
+ lui addrTemp, (offset + 0x8000) >> 16
+ addu addrTemp, addrTemp, base
+ lhu dest, (offset & 0xffff)(addrTemp)
+ */
+ m_assembler.lui(addrTempRegister, (address.offset + 0x8000) >> 16);
+ m_assembler.addu(addrTempRegister, addrTempRegister, address.base);
+ m_assembler.lhu(dest, addrTempRegister, address.offset);
+ }
+ }
+
+ /* Need to use zero-extened load half-word for load16. */
+ void load16(BaseIndex address, RegisterID dest)
+ {
+ if (address.offset >= -32768 && address.offset <= 32767
+ && !m_fixedWidth) {
+ /*
+ sll addrTemp, address.index, address.scale
+ addu addrTemp, addrTemp, address.base
+ lhu dest, address.offset(addrTemp)
+ */
+ m_assembler.sll(addrTempRegister, address.index, address.scale);
+ m_assembler.addu(addrTempRegister, addrTempRegister, address.base);
+ m_assembler.lhu(dest, addrTempRegister, address.offset);
+ } else {
+ /*
+ sll addrTemp, address.index, address.scale
+ addu addrTemp, addrTemp, address.base
+ lui immTemp, (address.offset + 0x8000) >> 16
+ addu addrTemp, addrTemp, immTemp
+ lhu dest, (address.offset & 0xffff)(addrTemp)
+ */
+ m_assembler.sll(addrTempRegister, address.index, address.scale);
+ m_assembler.addu(addrTempRegister, addrTempRegister, address.base);
+ m_assembler.lui(immTempRegister, (address.offset + 0x8000) >> 16);
+ m_assembler.addu(addrTempRegister, addrTempRegister,
+ immTempRegister);
+ m_assembler.lhu(dest, addrTempRegister, address.offset);
+ }
+ }
+
+ DataLabel32 store32WithAddressOffsetPatch(RegisterID src, Address address)
+ {
+ m_fixedWidth = true;
+ /*
+ lui addrTemp, address.offset >> 16
+ ori addrTemp, addrTemp, address.offset & 0xffff
+ addu addrTemp, addrTemp, address.base
+ sw src, 0(addrTemp)
+ */
+ DataLabel32 dataLabel(this);
+ move(Imm32(address.offset), addrTempRegister);
+ m_assembler.addu(addrTempRegister, addrTempRegister, address.base);
+ m_assembler.sw(src, addrTempRegister, 0);
+ m_fixedWidth = false;
+ return dataLabel;
+ }
+
+ void store32(RegisterID src, ImplicitAddress address)
+ {
+ if (address.offset >= -32768 && address.offset <= 32767
+ && !m_fixedWidth)
+ m_assembler.sw(src, address.base, address.offset);
+ else {
+ /*
+ lui addrTemp, (offset + 0x8000) >> 16
+ addu addrTemp, addrTemp, base
+ sw src, (offset & 0xffff)(addrTemp)
+ */
+ m_assembler.lui(addrTempRegister, (address.offset + 0x8000) >> 16);
+ m_assembler.addu(addrTempRegister, addrTempRegister, address.base);
+ m_assembler.sw(src, addrTempRegister, address.offset);
+ }
+ }
+
+ void store32(RegisterID src, BaseIndex address)
+ {
+ if (address.offset >= -32768 && address.offset <= 32767
+ && !m_fixedWidth) {
+ /*
+ sll addrTemp, address.index, address.scale
+ addu addrTemp, addrTemp, address.base
+ sw src, address.offset(addrTemp)
+ */
+ m_assembler.sll(addrTempRegister, address.index, address.scale);
+ m_assembler.addu(addrTempRegister, addrTempRegister, address.base);
+ m_assembler.sw(src, addrTempRegister, address.offset);
+ } else {
+ /*
+ sll addrTemp, address.index, address.scale
+ addu addrTemp, addrTemp, address.base
+ lui immTemp, (address.offset + 0x8000) >> 16
+ addu addrTemp, addrTemp, immTemp
+ sw src, (address.offset & 0xffff)(at)
+ */
+ m_assembler.sll(addrTempRegister, address.index, address.scale);
+ m_assembler.addu(addrTempRegister, addrTempRegister, address.base);
+ m_assembler.lui(immTempRegister, (address.offset + 0x8000) >> 16);
+ m_assembler.addu(addrTempRegister, addrTempRegister,
+ immTempRegister);
+ m_assembler.sw(src, addrTempRegister, address.offset);
+ }
+ }
+
+ void store32(Imm32 imm, ImplicitAddress address)
+ {
+ if (address.offset >= -32768 && address.offset <= 32767
+ && !m_fixedWidth) {
+ if (!imm.m_isPointer && !imm.m_value)
+ m_assembler.sw(MIPSRegisters::zero, address.base,
+ address.offset);
+ else {
+ move(imm, immTempRegister);
+ m_assembler.sw(immTempRegister, address.base, address.offset);
+ }
+ } else {
+ /*
+ lui addrTemp, (offset + 0x8000) >> 16
+ addu addrTemp, addrTemp, base
+ sw immTemp, (offset & 0xffff)(addrTemp)
+ */
+ m_assembler.lui(addrTempRegister, (address.offset + 0x8000) >> 16);
+ m_assembler.addu(addrTempRegister, addrTempRegister, address.base);
+ if (!imm.m_isPointer && !imm.m_value && !m_fixedWidth)
+ m_assembler.sw(MIPSRegisters::zero, addrTempRegister,
+ address.offset);
+ else {
+ move(imm, immTempRegister);
+ m_assembler.sw(immTempRegister, addrTempRegister,
+ address.offset);
+ }
+ }
+ }
+
+ void store32(RegisterID src, void* address)
+ {
+ /*
+ li addrTemp, address
+ sw src, 0(addrTemp)
+ */
+ move(ImmPtr(address), addrTempRegister);
+ m_assembler.sw(src, addrTempRegister, 0);
+ }
+
+ void store32(Imm32 imm, void* address)
+ {
+ /*
+ li immTemp, imm
+ li addrTemp, address
+ sw src, 0(addrTemp)
+ */
+ if (!imm.m_isPointer && !imm.m_value && !m_fixedWidth) {
+ move(ImmPtr(address), addrTempRegister);
+ m_assembler.sw(MIPSRegisters::zero, addrTempRegister, 0);
+ } else {
+ move(imm, immTempRegister);
+ move(ImmPtr(address), addrTempRegister);
+ m_assembler.sw(immTempRegister, addrTempRegister, 0);
+ }
+ }
+
+ // Floating-point operations:
+
+ bool supportsFloatingPoint() const
+ {
+#if WTF_MIPS_DOUBLE_FLOAT
+ return true;
+#else
+ return false;
+#endif
+ }
+
+ bool supportsFloatingPointTruncate() const
+ {
+#if WTF_MIPS_DOUBLE_FLOAT && WTF_MIPS_ISA_AT_LEAST(2)
+ return true;
+#else
+ return false;
+#endif
+ }
+
+ bool supportsFloatingPointSqrt() const
+ {
+#if WTF_MIPS_DOUBLE_FLOAT && WTF_MIPS_ISA_AT_LEAST(2)
+ return true;
+#else
+ return false;
+#endif
+ }
+
+ // Stack manipulation operations:
+ //
+ // The ABI is assumed to provide a stack abstraction to memory,
+ // containing machine word sized units of data. Push and pop
+ // operations add and remove a single register sized unit of data
+ // to or from the stack. Peek and poke operations read or write
+ // values on the stack, without moving the current stack position.
+
+ void pop(RegisterID dest)
+ {
+ m_assembler.lw(dest, MIPSRegisters::sp, 0);
+ m_assembler.addiu(MIPSRegisters::sp, MIPSRegisters::sp, 4);
+ }
+
+ void push(RegisterID src)
+ {
+ m_assembler.addiu(MIPSRegisters::sp, MIPSRegisters::sp, -4);
+ m_assembler.sw(src, MIPSRegisters::sp, 0);
+ }
+
+ void push(Address address)
+ {
+ load32(address, dataTempRegister);
+ push(dataTempRegister);
+ }
+
+ void push(Imm32 imm)
+ {
+ move(imm, immTempRegister);
+ push(immTempRegister);
+ }
+
+ // Register move operations:
+ //
+ // Move values in registers.
+
+ void move(Imm32 imm, RegisterID dest)
+ {
+ if (!imm.m_isPointer && !imm.m_value && !m_fixedWidth)
+ move(MIPSRegisters::zero, dest);
+ else if (imm.m_isPointer || m_fixedWidth) {
+ m_assembler.lui(dest, imm.m_value >> 16);
+ m_assembler.ori(dest, dest, imm.m_value);
+ } else
+ m_assembler.li(dest, imm.m_value);
+ }
+
+ void move(RegisterID src, RegisterID dest)
+ {
+ if (src != dest || m_fixedWidth)
+ m_assembler.move(dest, src);
+ }
+
+ void move(ImmPtr imm, RegisterID dest)
+ {
+ move(Imm32(imm), dest);
+ }
+
+ void swap(RegisterID reg1, RegisterID reg2)
+ {
+ move(reg1, immTempRegister);
+ move(reg2, reg1);
+ move(immTempRegister, reg2);
+ }
+
+ void signExtend32ToPtr(RegisterID src, RegisterID dest)
+ {
+ if (src != dest || m_fixedWidth)
+ move(src, dest);
+ }
+
+ void zeroExtend32ToPtr(RegisterID src, RegisterID dest)
+ {
+ if (src != dest || m_fixedWidth)
+ move(src, dest);
+ }
+
+ // Forwards / external control flow operations:
+ //
+ // This set of jump and conditional branch operations return a Jump
+ // object which may linked at a later point, allow forwards jump,
+ // or jumps that will require external linkage (after the code has been
+ // relocated).
+ //
+ // For branches, signed <, >, <= and >= are denoted as l, g, le, and ge
+ // respecitvely, for unsigned comparisons the names b, a, be, and ae are
+ // used (representing the names 'below' and 'above').
+ //
+ // Operands to the comparision are provided in the expected order, e.g.
+ // jle32(reg1, Imm32(5)) will branch if the value held in reg1, when
+ // treated as a signed 32bit value, is less than or equal to 5.
+ //
+ // jz and jnz test whether the first operand is equal to zero, and take
+ // an optional second operand of a mask under which to perform the test.
+
+ Jump branch8(Condition cond, Address left, Imm32 right)
+ {
+ // Make sure the immediate value is unsigned 8 bits.
+ ASSERT(!(right.m_value & 0xFFFFFF00));
+ load8(left, dataTempRegister);
+ move(right, immTempRegister);
+ return branch32(cond, dataTempRegister, immTempRegister);
+ }
+
+ Jump branch32(Condition cond, RegisterID left, RegisterID right)
+ {
+ if (cond == Equal || cond == Zero)
+ return branchEqual(left, right);
+ if (cond == NotEqual || cond == NonZero)
+ return branchNotEqual(left, right);
+ if (cond == Above) {
+ m_assembler.sltu(cmpTempRegister, right, left);
+ return branchNotEqual(cmpTempRegister, MIPSRegisters::zero);
+ }
+ if (cond == AboveOrEqual) {
+ m_assembler.sltu(cmpTempRegister, left, right);
+ return branchEqual(cmpTempRegister, MIPSRegisters::zero);
+ }
+ if (cond == Below) {
+ m_assembler.sltu(cmpTempRegister, left, right);
+ return branchNotEqual(cmpTempRegister, MIPSRegisters::zero);
+ }
+ if (cond == BelowOrEqual) {
+ m_assembler.sltu(cmpTempRegister, right, left);
+ return branchEqual(cmpTempRegister, MIPSRegisters::zero);
+ }
+ if (cond == GreaterThan) {
+ m_assembler.slt(cmpTempRegister, right, left);
+ return branchNotEqual(cmpTempRegister, MIPSRegisters::zero);
+ }
+ if (cond == GreaterThanOrEqual) {
+ m_assembler.slt(cmpTempRegister, left, right);
+ return branchEqual(cmpTempRegister, MIPSRegisters::zero);
+ }
+ if (cond == LessThan) {
+ m_assembler.slt(cmpTempRegister, left, right);
+ return branchNotEqual(cmpTempRegister, MIPSRegisters::zero);
+ }
+ if (cond == LessThanOrEqual) {
+ m_assembler.slt(cmpTempRegister, right, left);
+ return branchEqual(cmpTempRegister, MIPSRegisters::zero);
+ }
+ if (cond == Overflow) {
+ /*
+ xor cmpTemp, left, right
+ bgez No_overflow, cmpTemp # same sign bit -> no overflow
+ nop
+ subu cmpTemp, left, right
+ xor cmpTemp, cmpTemp, left
+ bgez No_overflow, cmpTemp # same sign bit -> no overflow
+ nop
+ b Overflow
+ nop
+ nop
+ nop
+ nop
+ nop
+ No_overflow:
+ */
+ m_assembler.xorInsn(cmpTempRegister, left, right);
+ m_assembler.bgez(cmpTempRegister, 11);
+ m_assembler.nop();
+ m_assembler.subu(cmpTempRegister, left, right);
+ m_assembler.xorInsn(cmpTempRegister, cmpTempRegister, left);
+ m_assembler.bgez(cmpTempRegister, 7);
+ m_assembler.nop();
+ return jump();
+ }
+ if (cond == Signed) {
+ m_assembler.subu(cmpTempRegister, left, right);
+ // Check if the result is negative.
+ m_assembler.slt(cmpTempRegister, cmpTempRegister,
+ MIPSRegisters::zero);
+ return branchNotEqual(cmpTempRegister, MIPSRegisters::zero);
+ }
+ ASSERT(0);
+
+ return Jump();
+ }
+
+ Jump branch32(Condition cond, RegisterID left, Imm32 right)
+ {
+ move(right, immTempRegister);
+ return branch32(cond, left, immTempRegister);
+ }
+
+ Jump branch32(Condition cond, RegisterID left, Address right)
+ {
+ load32(right, dataTempRegister);
+ return branch32(cond, left, dataTempRegister);
+ }
+
+ Jump branch32(Condition cond, Address left, RegisterID right)
+ {
+ load32(left, dataTempRegister);
+ return branch32(cond, dataTempRegister, right);
+ }
+
+ Jump branch32(Condition cond, Address left, Imm32 right)
+ {
+ load32(left, dataTempRegister);
+ move(right, immTempRegister);
+ return branch32(cond, dataTempRegister, immTempRegister);
+ }
+
+ Jump branch32(Condition cond, BaseIndex left, Imm32 right)
+ {
+ load32(left, dataTempRegister);
+ // Be careful that the previous load32() uses immTempRegister.
+ // So, we need to put move() after load32().
+ move(right, immTempRegister);
+ return branch32(cond, dataTempRegister, immTempRegister);
+ }
+
+ Jump branch32WithUnalignedHalfWords(Condition cond, BaseIndex left, Imm32 right)
+ {
+ load32WithUnalignedHalfWords(left, dataTempRegister);
+ // Be careful that the previous load32WithUnalignedHalfWords()
+ // uses immTempRegister.
+ // So, we need to put move() after load32WithUnalignedHalfWords().
+ move(right, immTempRegister);
+ return branch32(cond, dataTempRegister, immTempRegister);
+ }
+
+ Jump branch32(Condition cond, AbsoluteAddress left, RegisterID right)
+ {
+ load32(left.m_ptr, dataTempRegister);
+ return branch32(cond, dataTempRegister, right);
+ }
+
+ Jump branch32(Condition cond, AbsoluteAddress left, Imm32 right)
+ {
+ load32(left.m_ptr, dataTempRegister);
+ move(right, immTempRegister);
+ return branch32(cond, dataTempRegister, immTempRegister);
+ }
+
+ Jump branch16(Condition cond, BaseIndex left, RegisterID right)
+ {
+ load16(left, dataTempRegister);
+ return branch32(cond, dataTempRegister, right);
+ }
+
+ Jump branch16(Condition cond, BaseIndex left, Imm32 right)
+ {
+ ASSERT(!(right.m_value & 0xFFFF0000));
+ load16(left, dataTempRegister);
+ // Be careful that the previous load16() uses immTempRegister.
+ // So, we need to put move() after load16().
+ move(right, immTempRegister);
+ return branch32(cond, dataTempRegister, immTempRegister);
+ }
+
+ Jump branchTest32(Condition cond, RegisterID reg, RegisterID mask)
+ {
+ ASSERT((cond == Zero) || (cond == NonZero));
+ m_assembler.andInsn(cmpTempRegister, reg, mask);
+ if (cond == Zero)
+ return branchEqual(cmpTempRegister, MIPSRegisters::zero);
+ return branchNotEqual(cmpTempRegister, MIPSRegisters::zero);
+ }
+
+ Jump branchTest32(Condition cond, RegisterID reg, Imm32 mask = Imm32(-1))
+ {
+ ASSERT((cond == Zero) || (cond == NonZero));
+ if (mask.m_value == -1 && !m_fixedWidth) {
+ if (cond == Zero)
+ return branchEqual(reg, MIPSRegisters::zero);
+ return branchNotEqual(reg, MIPSRegisters::zero);
+ }
+ move(mask, immTempRegister);
+ return branchTest32(cond, reg, immTempRegister);
+ }
+
+ Jump branchTest32(Condition cond, Address address, Imm32 mask = Imm32(-1))
+ {
+ load32(address, dataTempRegister);
+ return branchTest32(cond, dataTempRegister, mask);
+ }
+
+ Jump branchTest32(Condition cond, BaseIndex address, Imm32 mask = Imm32(-1))
+ {
+ load32(address, dataTempRegister);
+ return branchTest32(cond, dataTempRegister, mask);
+ }
+
+ Jump branchTest8(Condition cond, Address address, Imm32 mask = Imm32(-1))
+ {
+ load8(address, dataTempRegister);
+ return branchTest32(cond, dataTempRegister, mask);
+ }
+
+ Jump jump()
+ {
+ return branchEqual(MIPSRegisters::zero, MIPSRegisters::zero);
+ }
+
+ void jump(RegisterID target)
+ {
+ m_assembler.jr(target);
+ m_assembler.nop();
+ }
+
+ void jump(Address address)
+ {
+ m_fixedWidth = true;
+ load32(address, MIPSRegisters::t9);
+ m_assembler.jr(MIPSRegisters::t9);
+ m_assembler.nop();
+ m_fixedWidth = false;
+ }
+
+ // Arithmetic control flow operations:
+ //
+ // This set of conditional branch operations branch based
+ // on the result of an arithmetic operation. The operation
+ // is performed as normal, storing the result.
+ //
+ // * jz operations branch if the result is zero.
+ // * jo operations branch if the (signed) arithmetic
+ // operation caused an overflow to occur.
+
+ Jump branchAdd32(Condition cond, RegisterID src, RegisterID dest)
+ {
+ ASSERT((cond == Overflow) || (cond == Signed) || (cond == Zero) || (cond == NonZero));
+ if (cond == Overflow) {
+ /*
+ move dest, dataTemp
+ xor cmpTemp, dataTemp, src
+ bltz cmpTemp, No_overflow # diff sign bit -> no overflow
+ addu dest, dataTemp, src
+ xor cmpTemp, dest, dataTemp
+ bgez cmpTemp, No_overflow # same sign big -> no overflow
+ nop
+ b Overflow
+ nop
+ nop
+ nop
+ nop
+ nop
+ No_overflow:
+ */
+ move(dest, dataTempRegister);
+ m_assembler.xorInsn(cmpTempRegister, dataTempRegister, src);
+ m_assembler.bltz(cmpTempRegister, 10);
+ m_assembler.addu(dest, dataTempRegister, src);
+ m_assembler.xorInsn(cmpTempRegister, dest, dataTempRegister);
+ m_assembler.bgez(cmpTempRegister, 7);
+ m_assembler.nop();
+ return jump();
+ }
+ if (cond == Signed) {
+ add32(src, dest);
+ // Check if dest is negative.
+ m_assembler.slt(cmpTempRegister, dest, MIPSRegisters::zero);
+ return branchNotEqual(cmpTempRegister, MIPSRegisters::zero);
+ }
+ if (cond == Zero) {
+ add32(src, dest);
+ return branchEqual(dest, MIPSRegisters::zero);
+ }
+ if (cond == NonZero) {
+ add32(src, dest);
+ return branchNotEqual(dest, MIPSRegisters::zero);
+ }
+ ASSERT(0);
+ return Jump();
+ }
+
+ Jump branchAdd32(Condition cond, Imm32 imm, RegisterID dest)
+ {
+ move(imm, immTempRegister);
+ return branchAdd32(cond, immTempRegister, dest);
+ }
+
+ Jump branchMul32(Condition cond, RegisterID src, RegisterID dest)
+ {
+ ASSERT((cond == Overflow) || (cond == Signed) || (cond == Zero) || (cond == NonZero));
+ if (cond == Overflow) {
+ /*
+ mult src, dest
+ mfhi dataTemp
+ mflo dest
+ sra addrTemp, dest, 31
+ beq dataTemp, addrTemp, No_overflow # all sign bits (bit 63 to bit 31) are the same -> no overflow
+ nop
+ b Overflow
+ nop
+ nop
+ nop
+ nop
+ nop
+ No_overflow:
+ */
+ m_assembler.mult(src, dest);
+ m_assembler.mfhi(dataTempRegister);
+ m_assembler.mflo(dest);
+ m_assembler.sra(addrTempRegister, dest, 31);
+ m_assembler.beq(dataTempRegister, addrTempRegister, 7);
+ m_assembler.nop();
+ return jump();
+ }
+ if (cond == Signed) {
+ mul32(src, dest);
+ // Check if dest is negative.
+ m_assembler.slt(cmpTempRegister, dest, MIPSRegisters::zero);
+ return branchNotEqual(cmpTempRegister, MIPSRegisters::zero);
+ }
+ if (cond == Zero) {
+ mul32(src, dest);
+ return branchEqual(dest, MIPSRegisters::zero);
+ }
+ if (cond == NonZero) {
+ mul32(src, dest);
+ return branchNotEqual(dest, MIPSRegisters::zero);
+ }
+ ASSERT(0);
+ return Jump();
+ }
+
+ Jump branchMul32(Condition cond, Imm32 imm, RegisterID src, RegisterID dest)
+ {
+ move(imm, immTempRegister);
+ move(src, dest);
+ return branchMul32(cond, immTempRegister, dest);
+ }
+
+ Jump branchSub32(Condition cond, RegisterID src, RegisterID dest)
+ {
+ ASSERT((cond == Overflow) || (cond == Signed) || (cond == Zero) || (cond == NonZero));
+ if (cond == Overflow) {
+ /*
+ move dest, dataTemp
+ xor cmpTemp, dataTemp, src
+ bgez cmpTemp, No_overflow # same sign bit -> no overflow
+ subu dest, dataTemp, src
+ xor cmpTemp, dest, dataTemp
+ bgez cmpTemp, No_overflow # same sign bit -> no overflow
+ nop
+ b Overflow
+ nop
+ nop
+ nop
+ nop
+ nop
+ No_overflow:
+ */
+ move(dest, dataTempRegister);
+ m_assembler.xorInsn(cmpTempRegister, dataTempRegister, src);
+ m_assembler.bgez(cmpTempRegister, 10);
+ m_assembler.subu(dest, dataTempRegister, src);
+ m_assembler.xorInsn(cmpTempRegister, dest, dataTempRegister);
+ m_assembler.bgez(cmpTempRegister, 7);
+ m_assembler.nop();
+ return jump();
+ }
+ if (cond == Signed) {
+ sub32(src, dest);
+ // Check if dest is negative.
+ m_assembler.slt(cmpTempRegister, dest, MIPSRegisters::zero);
+ return branchNotEqual(cmpTempRegister, MIPSRegisters::zero);
+ }
+ if (cond == Zero) {
+ sub32(src, dest);
+ return branchEqual(dest, MIPSRegisters::zero);
+ }
+ if (cond == NonZero) {
+ sub32(src, dest);
+ return branchNotEqual(dest, MIPSRegisters::zero);
+ }
+ ASSERT(0);
+ return Jump();
+ }
+
+ Jump branchSub32(Condition cond, Imm32 imm, RegisterID dest)
+ {
+ move(imm, immTempRegister);
+ return branchSub32(cond, immTempRegister, dest);
+ }
+
+ Jump branchOr32(Condition cond, RegisterID src, RegisterID dest)
+ {
+ ASSERT((cond == Signed) || (cond == Zero) || (cond == NonZero));
+ if (cond == Signed) {
+ or32(src, dest);
+ // Check if dest is negative.
+ m_assembler.slt(cmpTempRegister, dest, MIPSRegisters::zero);
+ return branchNotEqual(cmpTempRegister, MIPSRegisters::zero);
+ }
+ if (cond == Zero) {
+ or32(src, dest);
+ return branchEqual(dest, MIPSRegisters::zero);
+ }
+ if (cond == NonZero) {
+ or32(src, dest);
+ return branchNotEqual(dest, MIPSRegisters::zero);
+ }
+ ASSERT(0);
+ return Jump();
+ }
+
+ // Miscellaneous operations:
+
+ void breakpoint()
+ {
+ m_assembler.bkpt();
+ }
+
+ Call nearCall()
+ {
+ /* We need two words for relaxation. */
+ m_assembler.nop();
+ m_assembler.nop();
+ m_assembler.jal();
+ m_assembler.nop();
+ return Call(m_assembler.newJmpSrc(), Call::LinkableNear);
+ }
+
+ Call call()
+ {
+ m_assembler.lui(MIPSRegisters::t9, 0);
+ m_assembler.ori(MIPSRegisters::t9, MIPSRegisters::t9, 0);
+ m_assembler.jalr(MIPSRegisters::t9);
+ m_assembler.nop();
+ return Call(m_assembler.newJmpSrc(), Call::Linkable);
+ }
+
+ Call call(RegisterID target)
+ {
+ m_assembler.jalr(target);
+ m_assembler.nop();
+ return Call(m_assembler.newJmpSrc(), Call::None);
+ }
+
+ Call call(Address address)
+ {
+ m_fixedWidth = true;
+ load32(address, MIPSRegisters::t9);
+ m_assembler.jalr(MIPSRegisters::t9);
+ m_assembler.nop();
+ m_fixedWidth = false;
+ return Call(m_assembler.newJmpSrc(), Call::None);
+ }
+
+ void ret()
+ {
+ m_assembler.jr(MIPSRegisters::ra);
+ m_assembler.nop();
+ }
+
+ void set8Compare32(Condition cond, RegisterID left, RegisterID right, RegisterID dest)
+ {
+ set32Compare32(cond, left, right, dest);
+ }
+
+ void set8Compare32(Condition cond, RegisterID left, Imm32 right, RegisterID dest)
+ {
+ move(right, immTempRegister);
+ set32Compare32(cond, left, immTempRegister, dest);
+ }
+
+ void set32Compare32(Condition cond, RegisterID left, RegisterID right, RegisterID dest)
+ {
+ if (cond == Equal || cond == Zero) {
+ m_assembler.xorInsn(dest, left, right);
+ m_assembler.sltiu(dest, dest, 1);
+ } else if (cond == NotEqual || cond == NonZero) {
+ m_assembler.xorInsn(dest, left, right);
+ m_assembler.sltu(dest, MIPSRegisters::zero, dest);
+ } else if (cond == Above)
+ m_assembler.sltu(dest, right, left);
+ else if (cond == AboveOrEqual) {
+ m_assembler.sltu(dest, left, right);
+ m_assembler.xori(dest, dest, 1);
+ } else if (cond == Below)
+ m_assembler.sltu(dest, left, right);
+ else if (cond == BelowOrEqual) {
+ m_assembler.sltu(dest, right, left);
+ m_assembler.xori(dest, dest, 1);
+ } else if (cond == GreaterThan)
+ m_assembler.slt(dest, right, left);
+ else if (cond == GreaterThanOrEqual) {
+ m_assembler.slt(dest, left, right);
+ m_assembler.xori(dest, dest, 1);
+ } else if (cond == LessThan)
+ m_assembler.slt(dest, left, right);
+ else if (cond == LessThanOrEqual) {
+ m_assembler.slt(dest, right, left);
+ m_assembler.xori(dest, dest, 1);
+ } else if (cond == Overflow) {
+ /*
+ xor cmpTemp, left, right
+ bgez Done, cmpTemp # same sign bit -> no overflow
+ move dest, 0
+ subu cmpTemp, left, right
+ xor cmpTemp, cmpTemp, left # diff sign bit -> overflow
+ slt dest, cmpTemp, 0
+ Done:
+ */
+ m_assembler.xorInsn(cmpTempRegister, left, right);
+ m_assembler.bgez(cmpTempRegister, 4);
+ m_assembler.move(dest, MIPSRegisters::zero);
+ m_assembler.subu(cmpTempRegister, left, right);
+ m_assembler.xorInsn(cmpTempRegister, cmpTempRegister, left);
+ m_assembler.slt(dest, cmpTempRegister, MIPSRegisters::zero);
+ } else if (cond == Signed) {
+ m_assembler.subu(dest, left, right);
+ // Check if the result is negative.
+ m_assembler.slt(dest, dest, MIPSRegisters::zero);
+ }
+ }
+
+ void set32Compare32(Condition cond, RegisterID left, Imm32 right, RegisterID dest)
+ {
+ move(right, immTempRegister);
+ set32Compare32(cond, left, immTempRegister, dest);
+ }
+
+ void set32Test8(Condition cond, Address address, Imm32 mask, RegisterID dest)
+ {
+ ASSERT((cond == Zero) || (cond == NonZero));
+ load8(address, dataTempRegister);
+ if (mask.m_value == -1 && !m_fixedWidth) {
+ if (cond == Zero)
+ m_assembler.sltiu(dest, dataTempRegister, 1);
+ else
+ m_assembler.sltu(dest, MIPSRegisters::zero, dataTempRegister);
+ } else {
+ move(mask, immTempRegister);
+ m_assembler.andInsn(cmpTempRegister, dataTempRegister,
+ immTempRegister);
+ if (cond == Zero)
+ m_assembler.sltiu(dest, cmpTempRegister, 1);
+ else
+ m_assembler.sltu(dest, MIPSRegisters::zero, cmpTempRegister);
+ }
+ }
+
+ void set32Test32(Condition cond, Address address, Imm32 mask, RegisterID dest)
+ {
+ ASSERT((cond == Zero) || (cond == NonZero));
+ load32(address, dataTempRegister);
+ if (mask.m_value == -1 && !m_fixedWidth) {
+ if (cond == Zero)
+ m_assembler.sltiu(dest, dataTempRegister, 1);
+ else
+ m_assembler.sltu(dest, MIPSRegisters::zero, dataTempRegister);
+ } else {
+ move(mask, immTempRegister);
+ m_assembler.andInsn(cmpTempRegister, dataTempRegister,
+ immTempRegister);
+ if (cond == Zero)
+ m_assembler.sltiu(dest, cmpTempRegister, 1);
+ else
+ m_assembler.sltu(dest, MIPSRegisters::zero, cmpTempRegister);
+ }
+ }
+
+ DataLabel32 moveWithPatch(Imm32 imm, RegisterID dest)
+ {
+ m_fixedWidth = true;
+ DataLabel32 label(this);
+ move(imm, dest);
+ m_fixedWidth = false;
+ return label;
+ }
+
+ DataLabelPtr moveWithPatch(ImmPtr initialValue, RegisterID dest)
+ {
+ m_fixedWidth = true;
+ DataLabelPtr label(this);
+ move(initialValue, dest);
+ m_fixedWidth = false;
+ return label;
+ }
+
+ Jump branchPtrWithPatch(Condition cond, RegisterID left, DataLabelPtr& dataLabel, ImmPtr initialRightValue = ImmPtr(0))
+ {
+ m_fixedWidth = true;
+ dataLabel = moveWithPatch(initialRightValue, immTempRegister);
+ Jump temp = branch32(cond, left, immTempRegister);
+ m_fixedWidth = false;
+ return temp;
+ }
+
+ Jump branchPtrWithPatch(Condition cond, Address left, DataLabelPtr& dataLabel, ImmPtr initialRightValue = ImmPtr(0))
+ {
+ m_fixedWidth = true;
+ load32(left, dataTempRegister);
+ dataLabel = moveWithPatch(initialRightValue, immTempRegister);
+ Jump temp = branch32(cond, dataTempRegister, immTempRegister);
+ m_fixedWidth = false;
+ return temp;
+ }
+
+ DataLabelPtr storePtrWithPatch(ImmPtr initialValue, ImplicitAddress address)
+ {
+ m_fixedWidth = true;
+ DataLabelPtr dataLabel = moveWithPatch(initialValue, dataTempRegister);
+ store32(dataTempRegister, address);
+ m_fixedWidth = false;
+ return dataLabel;
+ }
+
+ DataLabelPtr storePtrWithPatch(ImplicitAddress address)
+ {
+ return storePtrWithPatch(ImmPtr(0), address);
+ }
+
+ Call tailRecursiveCall()
+ {
+ // Like a normal call, but don't update the returned address register
+ m_fixedWidth = true;
+ move(Imm32(0), MIPSRegisters::t9);
+ m_assembler.jr(MIPSRegisters::t9);
+ m_assembler.nop();
+ m_fixedWidth = false;
+ return Call(m_assembler.newJmpSrc(), Call::Linkable);
+ }
+
+ Call makeTailRecursiveCall(Jump oldJump)
+ {
+ oldJump.link(this);
+ return tailRecursiveCall();
+ }
+
+ void loadDouble(ImplicitAddress address, FPRegisterID dest)
+ {
+#if WTF_MIPS_ISA(1)
+ /*
+ li addrTemp, address.offset
+ addu addrTemp, addrTemp, base
+ lwc1 dest, 0(addrTemp)
+ lwc1 dest+1, 4(addrTemp)
+ */
+ move(Imm32(address.offset), addrTempRegister);
+ m_assembler.addu(addrTempRegister, addrTempRegister, address.base);
+ m_assembler.lwc1(dest, addrTempRegister, 0);
+ m_assembler.lwc1(FPRegisterID(dest + 1), addrTempRegister, 4);
+#else
+ if (address.offset >= -32768 && address.offset <= 32767
+ && !m_fixedWidth) {
+ m_assembler.ldc1(dest, address.base, address.offset);
+ } else {
+ /*
+ lui addrTemp, (offset + 0x8000) >> 16
+ addu addrTemp, addrTemp, base
+ ldc1 dest, (offset & 0xffff)(addrTemp)
+ */
+ m_assembler.lui(addrTempRegister, (address.offset + 0x8000) >> 16);
+ m_assembler.addu(addrTempRegister, addrTempRegister, address.base);
+ m_assembler.ldc1(dest, addrTempRegister, address.offset);
+ }
+#endif
+ }
+
+ void loadDouble(const void* address, FPRegisterID dest)
+ {
+#if WTF_MIPS_ISA(1)
+ /*
+ li addrTemp, address
+ lwc1 dest, 0(addrTemp)
+ lwc1 dest+1, 4(addrTemp)
+ */
+ move(ImmPtr(address), addrTempRegister);
+ m_assembler.lwc1(dest, addrTempRegister, 0);
+ m_assembler.lwc1(FPRegisterID(dest + 1), addrTempRegister, 4);
+#else
+ /*
+ li addrTemp, address
+ ldc1 dest, 0(addrTemp)
+ */
+ move(ImmPtr(address), addrTempRegister);
+ m_assembler.ldc1(dest, addrTempRegister, 0);
+#endif
+ }
+
+
+ void storeDouble(FPRegisterID src, ImplicitAddress address)
+ {
+#if WTF_MIPS_ISA(1)
+ /*
+ li addrTemp, address.offset
+ addu addrTemp, addrTemp, base
+ swc1 dest, 0(addrTemp)
+ swc1 dest+1, 4(addrTemp)
+ */
+ move(Imm32(address.offset), addrTempRegister);
+ m_assembler.addu(addrTempRegister, addrTempRegister, address.base);
+ m_assembler.swc1(src, addrTempRegister, 0);
+ m_assembler.swc1(FPRegisterID(src + 1), addrTempRegister, 4);
+#else
+ if (address.offset >= -32768 && address.offset <= 32767
+ && !m_fixedWidth)
+ m_assembler.sdc1(src, address.base, address.offset);
+ else {
+ /*
+ lui addrTemp, (offset + 0x8000) >> 16
+ addu addrTemp, addrTemp, base
+ sdc1 src, (offset & 0xffff)(addrTemp)
+ */
+ m_assembler.lui(addrTempRegister, (address.offset + 0x8000) >> 16);
+ m_assembler.addu(addrTempRegister, addrTempRegister, address.base);
+ m_assembler.sdc1(src, addrTempRegister, address.offset);
+ }
+#endif
+ }
+
+ void addDouble(FPRegisterID src, FPRegisterID dest)
+ {
+ m_assembler.addd(dest, dest, src);
+ }
+
+ void addDouble(Address src, FPRegisterID dest)
+ {
+ loadDouble(src, fpTempRegister);
+ m_assembler.addd(dest, dest, fpTempRegister);
+ }
+
+ void subDouble(FPRegisterID src, FPRegisterID dest)
+ {
+ m_assembler.subd(dest, dest, src);
+ }
+
+ void subDouble(Address src, FPRegisterID dest)
+ {
+ loadDouble(src, fpTempRegister);
+ m_assembler.subd(dest, dest, fpTempRegister);
+ }
+
+ void mulDouble(FPRegisterID src, FPRegisterID dest)
+ {
+ m_assembler.muld(dest, dest, src);
+ }
+
+ void mulDouble(Address src, FPRegisterID dest)
+ {
+ loadDouble(src, fpTempRegister);
+ m_assembler.muld(dest, dest, fpTempRegister);
+ }
+
+ void divDouble(FPRegisterID src, FPRegisterID dest)
+ {
+ m_assembler.divd(dest, dest, src);
+ }
+
+ void convertInt32ToDouble(RegisterID src, FPRegisterID dest)
+ {
+ m_assembler.mtc1(src, fpTempRegister);
+ m_assembler.cvtdw(dest, fpTempRegister);
+ }
+
+ void convertInt32ToDouble(Address src, FPRegisterID dest)
+ {
+ load32(src, dataTempRegister);
+ m_assembler.mtc1(dataTempRegister, fpTempRegister);
+ m_assembler.cvtdw(dest, fpTempRegister);
+ }
+
+ void convertInt32ToDouble(AbsoluteAddress src, FPRegisterID dest)
+ {
+ load32(src.m_ptr, dataTempRegister);
+ m_assembler.mtc1(dataTempRegister, fpTempRegister);
+ m_assembler.cvtdw(dest, fpTempRegister);
+ }
+
+ void insertRelaxationWords()
+ {
+ /* We need four words for relaxation. */
+ m_assembler.beq(MIPSRegisters::zero, MIPSRegisters::zero, 3); // Jump over nops;
+ m_assembler.nop();
+ m_assembler.nop();
+ m_assembler.nop();
+ }
+
+ Jump branchTrue()
+ {
+ m_assembler.appendJump();
+ m_assembler.bc1t();
+ m_assembler.nop();
+ insertRelaxationWords();
+ return Jump(m_assembler.newJmpSrc());
+ }
+
+ Jump branchFalse()
+ {
+ m_assembler.appendJump();
+ m_assembler.bc1f();
+ m_assembler.nop();
+ insertRelaxationWords();
+ return Jump(m_assembler.newJmpSrc());
+ }
+
+ Jump branchEqual(RegisterID rs, RegisterID rt)
+ {
+ m_assembler.appendJump();
+ m_assembler.beq(rs, rt, 0);
+ m_assembler.nop();
+ insertRelaxationWords();
+ return Jump(m_assembler.newJmpSrc());
+ }
+
+ Jump branchNotEqual(RegisterID rs, RegisterID rt)
+ {
+ m_assembler.appendJump();
+ m_assembler.bne(rs, rt, 0);
+ m_assembler.nop();
+ insertRelaxationWords();
+ return Jump(m_assembler.newJmpSrc());
+ }
+
+ Jump branchDouble(DoubleCondition cond, FPRegisterID left, FPRegisterID right)
+ {
+ if (cond == DoubleEqual) {
+ m_assembler.ceqd(left, right);
+ return branchTrue();
+ }
+ if (cond == DoubleNotEqual) {
+ m_assembler.cueqd(left, right);
+ return branchFalse(); // false
+ }
+ if (cond == DoubleGreaterThan) {
+ m_assembler.cngtd(left, right);
+ return branchFalse(); // false
+ }
+ if (cond == DoubleGreaterThanOrEqual) {
+ m_assembler.cnged(left, right);
+ return branchFalse(); // false
+ }
+ if (cond == DoubleLessThan) {
+ m_assembler.cltd(left, right);
+ return branchTrue();
+ }
+ if (cond == DoubleLessThanOrEqual) {
+ m_assembler.cled(left, right);
+ return branchTrue();
+ }
+ if (cond == DoubleEqualOrUnordered) {
+ m_assembler.cueqd(left, right);
+ return branchTrue();
+ }
+ if (cond == DoubleNotEqualOrUnordered) {
+ m_assembler.ceqd(left, right);
+ return branchFalse(); // false
+ }
+ if (cond == DoubleGreaterThanOrUnordered) {
+ m_assembler.coled(left, right);
+ return branchFalse(); // false
+ }
+ if (cond == DoubleGreaterThanOrEqualOrUnordered) {
+ m_assembler.coltd(left, right);
+ return branchFalse(); // false
+ }
+ if (cond == DoubleLessThanOrUnordered) {
+ m_assembler.cultd(left, right);
+ return branchTrue();
+ }
+ if (cond == DoubleLessThanOrEqualOrUnordered) {
+ m_assembler.culed(left, right);
+ return branchTrue();
+ }
+ ASSERT(0);
+
+ return Jump();
+ }
+
+ // Truncates 'src' to an integer, and places the resulting 'dest'.
+ // If the result is not representable as a 32 bit value, branch.
+ // May also branch for some values that are representable in 32 bits
+ // (specifically, in this case, INT_MAX 0x7fffffff).
+ Jump branchTruncateDoubleToInt32(FPRegisterID src, RegisterID dest)
+ {
+ m_assembler.truncwd(fpTempRegister, src);
+ m_assembler.mfc1(dest, fpTempRegister);
+ return branch32(Equal, dest, Imm32(0x7fffffff));
+ }
+
+ // Convert 'src' to an integer, and places the resulting 'dest'.
+ // If the result is not representable as a 32 bit value, branch.
+ // May also branch for some values that are representable in 32 bits
+ // (specifically, in this case, 0).
+ void branchConvertDoubleToInt32(FPRegisterID src, RegisterID dest, JumpList& failureCases, FPRegisterID fpTemp)
+ {
+ m_assembler.cvtwd(fpTempRegister, src);
+ m_assembler.mfc1(dest, fpTempRegister);
+
+ // If the result is zero, it might have been -0.0, and the double comparison won't catch this!
+ failureCases.append(branch32(Equal, dest, MIPSRegisters::zero));
+
+ // Convert the integer result back to float & compare to the original value - if not equal or unordered (NaN) then jump.
+ convertInt32ToDouble(dest, fpTemp);
+ failureCases.append(branchDouble(DoubleNotEqualOrUnordered, fpTemp, src));
+ }
+
+ Jump branchDoubleNonZero(FPRegisterID reg, FPRegisterID scratch)
+ {
+#if WTF_MIPS_ISA_REV(2) && WTF_MIPS_FP64
+ m_assembler.mtc1(MIPSRegisters::zero, scratch);
+ m_assembler.mthc1(MIPSRegisters::zero, scratch);
+#else
+ m_assembler.mtc1(MIPSRegisters::zero, scratch);
+ m_assembler.mtc1(MIPSRegisters::zero, FPRegisterID(scratch + 1));
+#endif
+ return branchDouble(DoubleNotEqual, reg, scratch);
+ }
+
+ Jump branchDoubleZeroOrNaN(FPRegisterID reg, FPRegisterID scratch)
+ {
+#if WTF_MIPS_ISA_REV(2) && WTF_MIPS_FP64
+ m_assembler.mtc1(MIPSRegisters::zero, scratch);
+ m_assembler.mthc1(MIPSRegisters::zero, scratch);
+#else
+ m_assembler.mtc1(MIPSRegisters::zero, scratch);
+ m_assembler.mtc1(MIPSRegisters::zero, FPRegisterID(scratch + 1));
+#endif
+ return branchDouble(DoubleEqualOrUnordered, reg, scratch);
+ }
+
+
+private:
+ // If m_fixedWidth is true, we will generate a fixed number of instructions.
+ // Otherwise, we can emit any number of instructions.
+ bool m_fixedWidth;
+
+ friend class LinkBuffer;
+ friend class RepatchBuffer;
+
+ static void linkCall(void* code, Call call, FunctionPtr function)
+ {
+ MIPSAssembler::linkCall(code, call.m_jmp, function.value());
+ }
+
+ static void repatchCall(CodeLocationCall call, CodeLocationLabel destination)
+ {
+ MIPSAssembler::relinkCall(call.dataLocation(), destination.executableAddress());
+ }
+
+ static void repatchCall(CodeLocationCall call, FunctionPtr destination)
+ {
+ MIPSAssembler::relinkCall(call.dataLocation(), destination.executableAddress());
+ }
+
+};
+
+}
+
+#endif // ENABLE(ASSEMBLER) && CPU(MIPS)
+
+#endif // MacroAssemblerMIPS_h
diff --git a/Source/JavaScriptCore/assembler/MacroAssemblerX86.h b/Source/JavaScriptCore/assembler/MacroAssemblerX86.h
new file mode 100644
index 0000000..0918996
--- /dev/null
+++ b/Source/JavaScriptCore/assembler/MacroAssemblerX86.h
@@ -0,0 +1,203 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef MacroAssemblerX86_h
+#define MacroAssemblerX86_h
+
+#if ENABLE(ASSEMBLER) && CPU(X86)
+
+#include "MacroAssemblerX86Common.h"
+
+namespace JSC {
+
+class MacroAssemblerX86 : public MacroAssemblerX86Common {
+public:
+ MacroAssemblerX86()
+ : m_isSSE2Present(isSSE2Present())
+ {
+ }
+
+ static const Scale ScalePtr = TimesFour;
+
+ using MacroAssemblerX86Common::add32;
+ using MacroAssemblerX86Common::and32;
+ using MacroAssemblerX86Common::sub32;
+ using MacroAssemblerX86Common::or32;
+ using MacroAssemblerX86Common::load32;
+ using MacroAssemblerX86Common::store32;
+ using MacroAssemblerX86Common::branch32;
+ using MacroAssemblerX86Common::call;
+ using MacroAssemblerX86Common::loadDouble;
+ using MacroAssemblerX86Common::convertInt32ToDouble;
+
+ void add32(Imm32 imm, RegisterID src, RegisterID dest)
+ {
+ m_assembler.leal_mr(imm.m_value, src, dest);
+ }
+
+ void add32(Imm32 imm, AbsoluteAddress address)
+ {
+ m_assembler.addl_im(imm.m_value, address.m_ptr);
+ }
+
+ void addWithCarry32(Imm32 imm, AbsoluteAddress address)
+ {
+ m_assembler.adcl_im(imm.m_value, address.m_ptr);
+ }
+
+ void and32(Imm32 imm, AbsoluteAddress address)
+ {
+ m_assembler.andl_im(imm.m_value, address.m_ptr);
+ }
+
+ void or32(Imm32 imm, AbsoluteAddress address)
+ {
+ m_assembler.orl_im(imm.m_value, address.m_ptr);
+ }
+
+ void sub32(Imm32 imm, AbsoluteAddress address)
+ {
+ m_assembler.subl_im(imm.m_value, address.m_ptr);
+ }
+
+ void load32(void* address, RegisterID dest)
+ {
+ m_assembler.movl_mr(address, dest);
+ }
+
+ void loadDouble(const void* address, FPRegisterID dest)
+ {
+ ASSERT(isSSE2Present());
+ m_assembler.movsd_mr(address, dest);
+ }
+
+ void convertInt32ToDouble(AbsoluteAddress src, FPRegisterID dest)
+ {
+ m_assembler.cvtsi2sd_mr(src.m_ptr, dest);
+ }
+
+ void store32(Imm32 imm, void* address)
+ {
+ m_assembler.movl_i32m(imm.m_value, address);
+ }
+
+ void store32(RegisterID src, void* address)
+ {
+ m_assembler.movl_rm(src, address);
+ }
+
+ Jump branch32(Condition cond, AbsoluteAddress left, RegisterID right)
+ {
+ m_assembler.cmpl_rm(right, left.m_ptr);
+ return Jump(m_assembler.jCC(x86Condition(cond)));
+ }
+
+ Jump branch32(Condition cond, AbsoluteAddress left, Imm32 right)
+ {
+ m_assembler.cmpl_im(right.m_value, left.m_ptr);
+ return Jump(m_assembler.jCC(x86Condition(cond)));
+ }
+
+ Call call()
+ {
+ return Call(m_assembler.call(), Call::Linkable);
+ }
+
+ Call tailRecursiveCall()
+ {
+ return Call::fromTailJump(jump());
+ }
+
+ Call makeTailRecursiveCall(Jump oldJump)
+ {
+ return Call::fromTailJump(oldJump);
+ }
+
+
+ DataLabelPtr moveWithPatch(ImmPtr initialValue, RegisterID dest)
+ {
+ m_assembler.movl_i32r(initialValue.asIntptr(), dest);
+ return DataLabelPtr(this);
+ }
+
+ Jump branchPtrWithPatch(Condition cond, RegisterID left, DataLabelPtr& dataLabel, ImmPtr initialRightValue = ImmPtr(0))
+ {
+ m_assembler.cmpl_ir_force32(initialRightValue.asIntptr(), left);
+ dataLabel = DataLabelPtr(this);
+ return Jump(m_assembler.jCC(x86Condition(cond)));
+ }
+
+ Jump branchPtrWithPatch(Condition cond, Address left, DataLabelPtr& dataLabel, ImmPtr initialRightValue = ImmPtr(0))
+ {
+ m_assembler.cmpl_im_force32(initialRightValue.asIntptr(), left.offset, left.base);
+ dataLabel = DataLabelPtr(this);
+ return Jump(m_assembler.jCC(x86Condition(cond)));
+ }
+
+ DataLabelPtr storePtrWithPatch(ImmPtr initialValue, ImplicitAddress address)
+ {
+ m_assembler.movl_i32m(initialValue.asIntptr(), address.offset, address.base);
+ return DataLabelPtr(this);
+ }
+
+ Label loadPtrWithPatchToLEA(Address address, RegisterID dest)
+ {
+ Label label(this);
+ load32(address, dest);
+ return label;
+ }
+
+ bool supportsFloatingPoint() const { return m_isSSE2Present; }
+ // See comment on MacroAssemblerARMv7::supportsFloatingPointTruncate()
+ bool supportsFloatingPointTruncate() const { return m_isSSE2Present; }
+ bool supportsFloatingPointSqrt() const { return m_isSSE2Present; }
+
+private:
+ const bool m_isSSE2Present;
+
+ friend class LinkBuffer;
+ friend class RepatchBuffer;
+
+ static void linkCall(void* code, Call call, FunctionPtr function)
+ {
+ X86Assembler::linkCall(code, call.m_jmp, function.value());
+ }
+
+ static void repatchCall(CodeLocationCall call, CodeLocationLabel destination)
+ {
+ X86Assembler::relinkCall(call.dataLocation(), destination.executableAddress());
+ }
+
+ static void repatchCall(CodeLocationCall call, FunctionPtr destination)
+ {
+ X86Assembler::relinkCall(call.dataLocation(), destination.executableAddress());
+ }
+};
+
+} // namespace JSC
+
+#endif // ENABLE(ASSEMBLER)
+
+#endif // MacroAssemblerX86_h
diff --git a/Source/JavaScriptCore/assembler/MacroAssemblerX86Common.h b/Source/JavaScriptCore/assembler/MacroAssemblerX86Common.h
new file mode 100644
index 0000000..a02074c
--- /dev/null
+++ b/Source/JavaScriptCore/assembler/MacroAssemblerX86Common.h
@@ -0,0 +1,1092 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef MacroAssemblerX86Common_h
+#define MacroAssemblerX86Common_h
+
+#if ENABLE(ASSEMBLER)
+
+#include "X86Assembler.h"
+#include "AbstractMacroAssembler.h"
+
+namespace JSC {
+
+class MacroAssemblerX86Common : public AbstractMacroAssembler<X86Assembler> {
+ static const int DoubleConditionBitInvert = 0x10;
+ static const int DoubleConditionBitSpecial = 0x20;
+ static const int DoubleConditionBits = DoubleConditionBitInvert | DoubleConditionBitSpecial;
+
+public:
+ typedef X86Assembler::FPRegisterID FPRegisterID;
+
+ enum Condition {
+ Equal = X86Assembler::ConditionE,
+ NotEqual = X86Assembler::ConditionNE,
+ Above = X86Assembler::ConditionA,
+ AboveOrEqual = X86Assembler::ConditionAE,
+ Below = X86Assembler::ConditionB,
+ BelowOrEqual = X86Assembler::ConditionBE,
+ GreaterThan = X86Assembler::ConditionG,
+ GreaterThanOrEqual = X86Assembler::ConditionGE,
+ LessThan = X86Assembler::ConditionL,
+ LessThanOrEqual = X86Assembler::ConditionLE,
+ Overflow = X86Assembler::ConditionO,
+ Signed = X86Assembler::ConditionS,
+ Zero = X86Assembler::ConditionE,
+ NonZero = X86Assembler::ConditionNE
+ };
+
+ enum DoubleCondition {
+ // These conditions will only evaluate to true if the comparison is ordered - i.e. neither operand is NaN.
+ DoubleEqual = X86Assembler::ConditionE | DoubleConditionBitSpecial,
+ DoubleNotEqual = X86Assembler::ConditionNE,
+ DoubleGreaterThan = X86Assembler::ConditionA,
+ DoubleGreaterThanOrEqual = X86Assembler::ConditionAE,
+ DoubleLessThan = X86Assembler::ConditionA | DoubleConditionBitInvert,
+ DoubleLessThanOrEqual = X86Assembler::ConditionAE | DoubleConditionBitInvert,
+ // If either operand is NaN, these conditions always evaluate to true.
+ DoubleEqualOrUnordered = X86Assembler::ConditionE,
+ DoubleNotEqualOrUnordered = X86Assembler::ConditionNE | DoubleConditionBitSpecial,
+ DoubleGreaterThanOrUnordered = X86Assembler::ConditionB | DoubleConditionBitInvert,
+ DoubleGreaterThanOrEqualOrUnordered = X86Assembler::ConditionBE | DoubleConditionBitInvert,
+ DoubleLessThanOrUnordered = X86Assembler::ConditionB,
+ DoubleLessThanOrEqualOrUnordered = X86Assembler::ConditionBE,
+ };
+ COMPILE_ASSERT(
+ !((X86Assembler::ConditionE | X86Assembler::ConditionNE | X86Assembler::ConditionA | X86Assembler::ConditionAE | X86Assembler::ConditionB | X86Assembler::ConditionBE) & DoubleConditionBits),
+ DoubleConditionBits_should_not_interfere_with_X86Assembler_Condition_codes);
+
+ static const RegisterID stackPointerRegister = X86Registers::esp;
+
+ // Integer arithmetic operations:
+ //
+ // Operations are typically two operand - operation(source, srcDst)
+ // For many operations the source may be an Imm32, the srcDst operand
+ // may often be a memory location (explictly described using an Address
+ // object).
+
+ void add32(RegisterID src, RegisterID dest)
+ {
+ m_assembler.addl_rr(src, dest);
+ }
+
+ void add32(Imm32 imm, Address address)
+ {
+ m_assembler.addl_im(imm.m_value, address.offset, address.base);
+ }
+
+ void add32(Imm32 imm, RegisterID dest)
+ {
+ m_assembler.addl_ir(imm.m_value, dest);
+ }
+
+ void add32(Address src, RegisterID dest)
+ {
+ m_assembler.addl_mr(src.offset, src.base, dest);
+ }
+
+ void add32(RegisterID src, Address dest)
+ {
+ m_assembler.addl_rm(src, dest.offset, dest.base);
+ }
+
+ void and32(RegisterID src, RegisterID dest)
+ {
+ m_assembler.andl_rr(src, dest);
+ }
+
+ void and32(Imm32 imm, RegisterID dest)
+ {
+ m_assembler.andl_ir(imm.m_value, dest);
+ }
+
+ void and32(RegisterID src, Address dest)
+ {
+ m_assembler.andl_rm(src, dest.offset, dest.base);
+ }
+
+ void and32(Address src, RegisterID dest)
+ {
+ m_assembler.andl_mr(src.offset, src.base, dest);
+ }
+
+ void and32(Imm32 imm, Address address)
+ {
+ m_assembler.andl_im(imm.m_value, address.offset, address.base);
+ }
+
+ void lshift32(Imm32 imm, RegisterID dest)
+ {
+ m_assembler.shll_i8r(imm.m_value, dest);
+ }
+
+ void lshift32(RegisterID shift_amount, RegisterID dest)
+ {
+ // On x86 we can only shift by ecx; if asked to shift by another register we'll
+ // need rejig the shift amount into ecx first, and restore the registers afterwards.
+ if (shift_amount != X86Registers::ecx) {
+ swap(shift_amount, X86Registers::ecx);
+
+ // E.g. transform "shll %eax, %eax" -> "xchgl %eax, %ecx; shll %ecx, %ecx; xchgl %eax, %ecx"
+ if (dest == shift_amount)
+ m_assembler.shll_CLr(X86Registers::ecx);
+ // E.g. transform "shll %eax, %ecx" -> "xchgl %eax, %ecx; shll %ecx, %eax; xchgl %eax, %ecx"
+ else if (dest == X86Registers::ecx)
+ m_assembler.shll_CLr(shift_amount);
+ // E.g. transform "shll %eax, %ebx" -> "xchgl %eax, %ecx; shll %ecx, %ebx; xchgl %eax, %ecx"
+ else
+ m_assembler.shll_CLr(dest);
+
+ swap(shift_amount, X86Registers::ecx);
+ } else
+ m_assembler.shll_CLr(dest);
+ }
+
+ void mul32(RegisterID src, RegisterID dest)
+ {
+ m_assembler.imull_rr(src, dest);
+ }
+
+ void mul32(Address src, RegisterID dest)
+ {
+ m_assembler.imull_mr(src.offset, src.base, dest);
+ }
+
+ void mul32(Imm32 imm, RegisterID src, RegisterID dest)
+ {
+ m_assembler.imull_i32r(src, imm.m_value, dest);
+ }
+
+ void neg32(RegisterID srcDest)
+ {
+ m_assembler.negl_r(srcDest);
+ }
+
+ void neg32(Address srcDest)
+ {
+ m_assembler.negl_m(srcDest.offset, srcDest.base);
+ }
+
+ void not32(RegisterID srcDest)
+ {
+ m_assembler.notl_r(srcDest);
+ }
+
+ void not32(Address srcDest)
+ {
+ m_assembler.notl_m(srcDest.offset, srcDest.base);
+ }
+
+ void or32(RegisterID src, RegisterID dest)
+ {
+ m_assembler.orl_rr(src, dest);
+ }
+
+ void or32(Imm32 imm, RegisterID dest)
+ {
+ m_assembler.orl_ir(imm.m_value, dest);
+ }
+
+ void or32(RegisterID src, Address dest)
+ {
+ m_assembler.orl_rm(src, dest.offset, dest.base);
+ }
+
+ void or32(Address src, RegisterID dest)
+ {
+ m_assembler.orl_mr(src.offset, src.base, dest);
+ }
+
+ void or32(Imm32 imm, Address address)
+ {
+ m_assembler.orl_im(imm.m_value, address.offset, address.base);
+ }
+
+ void rshift32(RegisterID shift_amount, RegisterID dest)
+ {
+ // On x86 we can only shift by ecx; if asked to shift by another register we'll
+ // need rejig the shift amount into ecx first, and restore the registers afterwards.
+ if (shift_amount != X86Registers::ecx) {
+ swap(shift_amount, X86Registers::ecx);
+
+ // E.g. transform "shll %eax, %eax" -> "xchgl %eax, %ecx; shll %ecx, %ecx; xchgl %eax, %ecx"
+ if (dest == shift_amount)
+ m_assembler.sarl_CLr(X86Registers::ecx);
+ // E.g. transform "shll %eax, %ecx" -> "xchgl %eax, %ecx; shll %ecx, %eax; xchgl %eax, %ecx"
+ else if (dest == X86Registers::ecx)
+ m_assembler.sarl_CLr(shift_amount);
+ // E.g. transform "shll %eax, %ebx" -> "xchgl %eax, %ecx; shll %ecx, %ebx; xchgl %eax, %ecx"
+ else
+ m_assembler.sarl_CLr(dest);
+
+ swap(shift_amount, X86Registers::ecx);
+ } else
+ m_assembler.sarl_CLr(dest);
+ }
+
+ void rshift32(Imm32 imm, RegisterID dest)
+ {
+ m_assembler.sarl_i8r(imm.m_value, dest);
+ }
+
+ void urshift32(RegisterID shift_amount, RegisterID dest)
+ {
+ // On x86 we can only shift by ecx; if asked to shift by another register we'll
+ // need rejig the shift amount into ecx first, and restore the registers afterwards.
+ if (shift_amount != X86Registers::ecx) {
+ swap(shift_amount, X86Registers::ecx);
+
+ // E.g. transform "shrl %eax, %eax" -> "xchgl %eax, %ecx; shrl %ecx, %ecx; xchgl %eax, %ecx"
+ if (dest == shift_amount)
+ m_assembler.shrl_CLr(X86Registers::ecx);
+ // E.g. transform "shrl %eax, %ecx" -> "xchgl %eax, %ecx; shrl %ecx, %eax; xchgl %eax, %ecx"
+ else if (dest == X86Registers::ecx)
+ m_assembler.shrl_CLr(shift_amount);
+ // E.g. transform "shrl %eax, %ebx" -> "xchgl %eax, %ecx; shrl %ecx, %ebx; xchgl %eax, %ecx"
+ else
+ m_assembler.shrl_CLr(dest);
+
+ swap(shift_amount, X86Registers::ecx);
+ } else
+ m_assembler.shrl_CLr(dest);
+ }
+
+ void urshift32(Imm32 imm, RegisterID dest)
+ {
+ m_assembler.shrl_i8r(imm.m_value, dest);
+ }
+
+ void sub32(RegisterID src, RegisterID dest)
+ {
+ m_assembler.subl_rr(src, dest);
+ }
+
+ void sub32(Imm32 imm, RegisterID dest)
+ {
+ m_assembler.subl_ir(imm.m_value, dest);
+ }
+
+ void sub32(Imm32 imm, Address address)
+ {
+ m_assembler.subl_im(imm.m_value, address.offset, address.base);
+ }
+
+ void sub32(Address src, RegisterID dest)
+ {
+ m_assembler.subl_mr(src.offset, src.base, dest);
+ }
+
+ void sub32(RegisterID src, Address dest)
+ {
+ m_assembler.subl_rm(src, dest.offset, dest.base);
+ }
+
+
+ void xor32(RegisterID src, RegisterID dest)
+ {
+ m_assembler.xorl_rr(src, dest);
+ }
+
+ void xor32(Imm32 imm, Address dest)
+ {
+ m_assembler.xorl_im(imm.m_value, dest.offset, dest.base);
+ }
+
+ void xor32(Imm32 imm, RegisterID dest)
+ {
+ m_assembler.xorl_ir(imm.m_value, dest);
+ }
+
+ void xor32(RegisterID src, Address dest)
+ {
+ m_assembler.xorl_rm(src, dest.offset, dest.base);
+ }
+
+ void xor32(Address src, RegisterID dest)
+ {
+ m_assembler.xorl_mr(src.offset, src.base, dest);
+ }
+
+ void sqrtDouble(FPRegisterID src, FPRegisterID dst)
+ {
+ m_assembler.sqrtsd_rr(src, dst);
+ }
+
+ // Memory access operations:
+ //
+ // Loads are of the form load(address, destination) and stores of the form
+ // store(source, address). The source for a store may be an Imm32. Address
+ // operand objects to loads and store will be implicitly constructed if a
+ // register is passed.
+
+ void load32(ImplicitAddress address, RegisterID dest)
+ {
+ m_assembler.movl_mr(address.offset, address.base, dest);
+ }
+
+ void load32(BaseIndex address, RegisterID dest)
+ {
+ m_assembler.movl_mr(address.offset, address.base, address.index, address.scale, dest);
+ }
+
+ void load32WithUnalignedHalfWords(BaseIndex address, RegisterID dest)
+ {
+ load32(address, dest);
+ }
+
+ DataLabel32 load32WithAddressOffsetPatch(Address address, RegisterID dest)
+ {
+ m_assembler.movl_mr_disp32(address.offset, address.base, dest);
+ return DataLabel32(this);
+ }
+
+ void load16(BaseIndex address, RegisterID dest)
+ {
+ m_assembler.movzwl_mr(address.offset, address.base, address.index, address.scale, dest);
+ }
+
+ void load16(Address address, RegisterID dest)
+ {
+ m_assembler.movzwl_mr(address.offset, address.base, dest);
+ }
+
+ DataLabel32 store32WithAddressOffsetPatch(RegisterID src, Address address)
+ {
+ m_assembler.movl_rm_disp32(src, address.offset, address.base);
+ return DataLabel32(this);
+ }
+
+ void store32(RegisterID src, ImplicitAddress address)
+ {
+ m_assembler.movl_rm(src, address.offset, address.base);
+ }
+
+ void store32(RegisterID src, BaseIndex address)
+ {
+ m_assembler.movl_rm(src, address.offset, address.base, address.index, address.scale);
+ }
+
+ void store32(Imm32 imm, ImplicitAddress address)
+ {
+ m_assembler.movl_i32m(imm.m_value, address.offset, address.base);
+ }
+
+
+ // Floating-point operation:
+ //
+ // Presently only supports SSE, not x87 floating point.
+
+ void loadDouble(ImplicitAddress address, FPRegisterID dest)
+ {
+ ASSERT(isSSE2Present());
+ m_assembler.movsd_mr(address.offset, address.base, dest);
+ }
+
+ void storeDouble(FPRegisterID src, ImplicitAddress address)
+ {
+ ASSERT(isSSE2Present());
+ m_assembler.movsd_rm(src, address.offset, address.base);
+ }
+
+ void addDouble(FPRegisterID src, FPRegisterID dest)
+ {
+ ASSERT(isSSE2Present());
+ m_assembler.addsd_rr(src, dest);
+ }
+
+ void addDouble(Address src, FPRegisterID dest)
+ {
+ ASSERT(isSSE2Present());
+ m_assembler.addsd_mr(src.offset, src.base, dest);
+ }
+
+ void divDouble(FPRegisterID src, FPRegisterID dest)
+ {
+ ASSERT(isSSE2Present());
+ m_assembler.divsd_rr(src, dest);
+ }
+
+ void divDouble(Address src, FPRegisterID dest)
+ {
+ ASSERT(isSSE2Present());
+ m_assembler.divsd_mr(src.offset, src.base, dest);
+ }
+
+ void subDouble(FPRegisterID src, FPRegisterID dest)
+ {
+ ASSERT(isSSE2Present());
+ m_assembler.subsd_rr(src, dest);
+ }
+
+ void subDouble(Address src, FPRegisterID dest)
+ {
+ ASSERT(isSSE2Present());
+ m_assembler.subsd_mr(src.offset, src.base, dest);
+ }
+
+ void mulDouble(FPRegisterID src, FPRegisterID dest)
+ {
+ ASSERT(isSSE2Present());
+ m_assembler.mulsd_rr(src, dest);
+ }
+
+ void mulDouble(Address src, FPRegisterID dest)
+ {
+ ASSERT(isSSE2Present());
+ m_assembler.mulsd_mr(src.offset, src.base, dest);
+ }
+
+ void convertInt32ToDouble(RegisterID src, FPRegisterID dest)
+ {
+ ASSERT(isSSE2Present());
+ m_assembler.cvtsi2sd_rr(src, dest);
+ }
+
+ void convertInt32ToDouble(Address src, FPRegisterID dest)
+ {
+ ASSERT(isSSE2Present());
+ m_assembler.cvtsi2sd_mr(src.offset, src.base, dest);
+ }
+
+ Jump branchDouble(DoubleCondition cond, FPRegisterID left, FPRegisterID right)
+ {
+ ASSERT(isSSE2Present());
+
+ if (cond & DoubleConditionBitInvert)
+ m_assembler.ucomisd_rr(left, right);
+ else
+ m_assembler.ucomisd_rr(right, left);
+
+ if (cond == DoubleEqual) {
+ Jump isUnordered(m_assembler.jp());
+ Jump result = Jump(m_assembler.je());
+ isUnordered.link(this);
+ return result;
+ } else if (cond == DoubleNotEqualOrUnordered) {
+ Jump isUnordered(m_assembler.jp());
+ Jump isEqual(m_assembler.je());
+ isUnordered.link(this);
+ Jump result = jump();
+ isEqual.link(this);
+ return result;
+ }
+
+ ASSERT(!(cond & DoubleConditionBitSpecial));
+ return Jump(m_assembler.jCC(static_cast<X86Assembler::Condition>(cond & ~DoubleConditionBits)));
+ }
+
+ // Truncates 'src' to an integer, and places the resulting 'dest'.
+ // If the result is not representable as a 32 bit value, branch.
+ // May also branch for some values that are representable in 32 bits
+ // (specifically, in this case, INT_MIN).
+ Jump branchTruncateDoubleToInt32(FPRegisterID src, RegisterID dest)
+ {
+ ASSERT(isSSE2Present());
+ m_assembler.cvttsd2si_rr(src, dest);
+ return branch32(Equal, dest, Imm32(0x80000000));
+ }
+
+ // Convert 'src' to an integer, and places the resulting 'dest'.
+ // If the result is not representable as a 32 bit value, branch.
+ // May also branch for some values that are representable in 32 bits
+ // (specifically, in this case, 0).
+ void branchConvertDoubleToInt32(FPRegisterID src, RegisterID dest, JumpList& failureCases, FPRegisterID fpTemp)
+ {
+ ASSERT(isSSE2Present());
+ m_assembler.cvttsd2si_rr(src, dest);
+
+ // If the result is zero, it might have been -0.0, and the double comparison won't catch this!
+ failureCases.append(branchTest32(Zero, dest));
+
+ // Convert the integer result back to float & compare to the original value - if not equal or unordered (NaN) then jump.
+ convertInt32ToDouble(dest, fpTemp);
+ m_assembler.ucomisd_rr(fpTemp, src);
+ failureCases.append(m_assembler.jp());
+ failureCases.append(m_assembler.jne());
+ }
+
+ Jump branchDoubleNonZero(FPRegisterID reg, FPRegisterID scratch)
+ {
+ ASSERT(isSSE2Present());
+ m_assembler.xorpd_rr(scratch, scratch);
+ return branchDouble(DoubleNotEqual, reg, scratch);
+ }
+
+ Jump branchDoubleZeroOrNaN(FPRegisterID reg, FPRegisterID scratch)
+ {
+ ASSERT(isSSE2Present());
+ m_assembler.xorpd_rr(scratch, scratch);
+ return branchDouble(DoubleEqualOrUnordered, reg, scratch);
+ }
+
+ // Stack manipulation operations:
+ //
+ // The ABI is assumed to provide a stack abstraction to memory,
+ // containing machine word sized units of data. Push and pop
+ // operations add and remove a single register sized unit of data
+ // to or from the stack. Peek and poke operations read or write
+ // values on the stack, without moving the current stack position.
+
+ void pop(RegisterID dest)
+ {
+ m_assembler.pop_r(dest);
+ }
+
+ void push(RegisterID src)
+ {
+ m_assembler.push_r(src);
+ }
+
+ void push(Address address)
+ {
+ m_assembler.push_m(address.offset, address.base);
+ }
+
+ void push(Imm32 imm)
+ {
+ m_assembler.push_i32(imm.m_value);
+ }
+
+
+ // Register move operations:
+ //
+ // Move values in registers.
+
+ void move(Imm32 imm, RegisterID dest)
+ {
+ // Note: on 64-bit the Imm32 value is zero extended into the register, it
+ // may be useful to have a separate version that sign extends the value?
+ if (!imm.m_value)
+ m_assembler.xorl_rr(dest, dest);
+ else
+ m_assembler.movl_i32r(imm.m_value, dest);
+ }
+
+#if CPU(X86_64)
+ void move(RegisterID src, RegisterID dest)
+ {
+ // Note: on 64-bit this is is a full register move; perhaps it would be
+ // useful to have separate move32 & movePtr, with move32 zero extending?
+ if (src != dest)
+ m_assembler.movq_rr(src, dest);
+ }
+
+ void move(ImmPtr imm, RegisterID dest)
+ {
+ m_assembler.movq_i64r(imm.asIntptr(), dest);
+ }
+
+ void swap(RegisterID reg1, RegisterID reg2)
+ {
+ if (reg1 != reg2)
+ m_assembler.xchgq_rr(reg1, reg2);
+ }
+
+ void signExtend32ToPtr(RegisterID src, RegisterID dest)
+ {
+ m_assembler.movsxd_rr(src, dest);
+ }
+
+ void zeroExtend32ToPtr(RegisterID src, RegisterID dest)
+ {
+ m_assembler.movl_rr(src, dest);
+ }
+#else
+ void move(RegisterID src, RegisterID dest)
+ {
+ if (src != dest)
+ m_assembler.movl_rr(src, dest);
+ }
+
+ void move(ImmPtr imm, RegisterID dest)
+ {
+ m_assembler.movl_i32r(imm.asIntptr(), dest);
+ }
+
+ void swap(RegisterID reg1, RegisterID reg2)
+ {
+ if (reg1 != reg2)
+ m_assembler.xchgl_rr(reg1, reg2);
+ }
+
+ void signExtend32ToPtr(RegisterID src, RegisterID dest)
+ {
+ move(src, dest);
+ }
+
+ void zeroExtend32ToPtr(RegisterID src, RegisterID dest)
+ {
+ move(src, dest);
+ }
+#endif
+
+
+ // Forwards / external control flow operations:
+ //
+ // This set of jump and conditional branch operations return a Jump
+ // object which may linked at a later point, allow forwards jump,
+ // or jumps that will require external linkage (after the code has been
+ // relocated).
+ //
+ // For branches, signed <, >, <= and >= are denoted as l, g, le, and ge
+ // respecitvely, for unsigned comparisons the names b, a, be, and ae are
+ // used (representing the names 'below' and 'above').
+ //
+ // Operands to the comparision are provided in the expected order, e.g.
+ // jle32(reg1, Imm32(5)) will branch if the value held in reg1, when
+ // treated as a signed 32bit value, is less than or equal to 5.
+ //
+ // jz and jnz test whether the first operand is equal to zero, and take
+ // an optional second operand of a mask under which to perform the test.
+
+public:
+ Jump branch8(Condition cond, Address left, Imm32 right)
+ {
+ m_assembler.cmpb_im(right.m_value, left.offset, left.base);
+ return Jump(m_assembler.jCC(x86Condition(cond)));
+ }
+
+ Jump branch32(Condition cond, RegisterID left, RegisterID right)
+ {
+ m_assembler.cmpl_rr(right, left);
+ return Jump(m_assembler.jCC(x86Condition(cond)));
+ }
+
+ Jump branch32(Condition cond, RegisterID left, Imm32 right)
+ {
+ if (((cond == Equal) || (cond == NotEqual)) && !right.m_value)
+ m_assembler.testl_rr(left, left);
+ else
+ m_assembler.cmpl_ir(right.m_value, left);
+ return Jump(m_assembler.jCC(x86Condition(cond)));
+ }
+
+ Jump branch32(Condition cond, RegisterID left, Address right)
+ {
+ m_assembler.cmpl_mr(right.offset, right.base, left);
+ return Jump(m_assembler.jCC(x86Condition(cond)));
+ }
+
+ Jump branch32(Condition cond, Address left, RegisterID right)
+ {
+ m_assembler.cmpl_rm(right, left.offset, left.base);
+ return Jump(m_assembler.jCC(x86Condition(cond)));
+ }
+
+ Jump branch32(Condition cond, Address left, Imm32 right)
+ {
+ m_assembler.cmpl_im(right.m_value, left.offset, left.base);
+ return Jump(m_assembler.jCC(x86Condition(cond)));
+ }
+
+ Jump branch32(Condition cond, BaseIndex left, Imm32 right)
+ {
+ m_assembler.cmpl_im(right.m_value, left.offset, left.base, left.index, left.scale);
+ return Jump(m_assembler.jCC(x86Condition(cond)));
+ }
+
+ Jump branch32WithUnalignedHalfWords(Condition cond, BaseIndex left, Imm32 right)
+ {
+ return branch32(cond, left, right);
+ }
+
+ Jump branch16(Condition cond, BaseIndex left, RegisterID right)
+ {
+ m_assembler.cmpw_rm(right, left.offset, left.base, left.index, left.scale);
+ return Jump(m_assembler.jCC(x86Condition(cond)));
+ }
+
+ Jump branch16(Condition cond, BaseIndex left, Imm32 right)
+ {
+ ASSERT(!(right.m_value & 0xFFFF0000));
+
+ m_assembler.cmpw_im(right.m_value, left.offset, left.base, left.index, left.scale);
+ return Jump(m_assembler.jCC(x86Condition(cond)));
+ }
+
+ Jump branchTest32(Condition cond, RegisterID reg, RegisterID mask)
+ {
+ ASSERT((cond == Zero) || (cond == NonZero));
+ m_assembler.testl_rr(reg, mask);
+ return Jump(m_assembler.jCC(x86Condition(cond)));
+ }
+
+ Jump branchTest32(Condition cond, RegisterID reg, Imm32 mask = Imm32(-1))
+ {
+ ASSERT((cond == Zero) || (cond == NonZero));
+ // if we are only interested in the low seven bits, this can be tested with a testb
+ if (mask.m_value == -1)
+ m_assembler.testl_rr(reg, reg);
+ else if ((mask.m_value & ~0x7f) == 0)
+ m_assembler.testb_i8r(mask.m_value, reg);
+ else
+ m_assembler.testl_i32r(mask.m_value, reg);
+ return Jump(m_assembler.jCC(x86Condition(cond)));
+ }
+
+ Jump branchTest32(Condition cond, Address address, Imm32 mask = Imm32(-1))
+ {
+ ASSERT((cond == Zero) || (cond == NonZero));
+ if (mask.m_value == -1)
+ m_assembler.cmpl_im(0, address.offset, address.base);
+ else
+ m_assembler.testl_i32m(mask.m_value, address.offset, address.base);
+ return Jump(m_assembler.jCC(x86Condition(cond)));
+ }
+
+ Jump branchTest32(Condition cond, BaseIndex address, Imm32 mask = Imm32(-1))
+ {
+ ASSERT((cond == Zero) || (cond == NonZero));
+ if (mask.m_value == -1)
+ m_assembler.cmpl_im(0, address.offset, address.base, address.index, address.scale);
+ else
+ m_assembler.testl_i32m(mask.m_value, address.offset, address.base, address.index, address.scale);
+ return Jump(m_assembler.jCC(x86Condition(cond)));
+ }
+
+ Jump branchTest8(Condition cond, Address address, Imm32 mask = Imm32(-1))
+ {
+ ASSERT((cond == Zero) || (cond == NonZero));
+ if (mask.m_value == -1)
+ m_assembler.cmpb_im(0, address.offset, address.base);
+ else
+ m_assembler.testb_im(mask.m_value, address.offset, address.base);
+ return Jump(m_assembler.jCC(x86Condition(cond)));
+ }
+
+ Jump branchTest8(Condition cond, BaseIndex address, Imm32 mask = Imm32(-1))
+ {
+ ASSERT((cond == Zero) || (cond == NonZero));
+ if (mask.m_value == -1)
+ m_assembler.cmpb_im(0, address.offset, address.base, address.index, address.scale);
+ else
+ m_assembler.testb_im(mask.m_value, address.offset, address.base, address.index, address.scale);
+ return Jump(m_assembler.jCC(x86Condition(cond)));
+ }
+
+ Jump jump()
+ {
+ return Jump(m_assembler.jmp());
+ }
+
+ void jump(RegisterID target)
+ {
+ m_assembler.jmp_r(target);
+ }
+
+ // Address is a memory location containing the address to jump to
+ void jump(Address address)
+ {
+ m_assembler.jmp_m(address.offset, address.base);
+ }
+
+
+ // Arithmetic control flow operations:
+ //
+ // This set of conditional branch operations branch based
+ // on the result of an arithmetic operation. The operation
+ // is performed as normal, storing the result.
+ //
+ // * jz operations branch if the result is zero.
+ // * jo operations branch if the (signed) arithmetic
+ // operation caused an overflow to occur.
+
+ Jump branchAdd32(Condition cond, RegisterID src, RegisterID dest)
+ {
+ ASSERT((cond == Overflow) || (cond == Signed) || (cond == Zero) || (cond == NonZero));
+ add32(src, dest);
+ return Jump(m_assembler.jCC(x86Condition(cond)));
+ }
+
+ Jump branchAdd32(Condition cond, Imm32 imm, RegisterID dest)
+ {
+ ASSERT((cond == Overflow) || (cond == Signed) || (cond == Zero) || (cond == NonZero));
+ add32(imm, dest);
+ return Jump(m_assembler.jCC(x86Condition(cond)));
+ }
+
+ Jump branchAdd32(Condition cond, Imm32 src, Address dest)
+ {
+ ASSERT((cond == Overflow) || (cond == Zero) || (cond == NonZero));
+ add32(src, dest);
+ return Jump(m_assembler.jCC(x86Condition(cond)));
+ }
+
+ Jump branchAdd32(Condition cond, RegisterID src, Address dest)
+ {
+ ASSERT((cond == Overflow) || (cond == Zero) || (cond == NonZero));
+ add32(src, dest);
+ return Jump(m_assembler.jCC(x86Condition(cond)));
+ }
+
+ Jump branchAdd32(Condition cond, Address src, RegisterID dest)
+ {
+ ASSERT((cond == Overflow) || (cond == Zero) || (cond == NonZero));
+ add32(src, dest);
+ return Jump(m_assembler.jCC(x86Condition(cond)));
+ }
+
+ Jump branchMul32(Condition cond, RegisterID src, RegisterID dest)
+ {
+ ASSERT(cond == Overflow);
+ mul32(src, dest);
+ return Jump(m_assembler.jCC(x86Condition(cond)));
+ }
+
+ Jump branchMul32(Condition cond, Address src, RegisterID dest)
+ {
+ ASSERT((cond == Overflow) || (cond == Zero) || (cond == NonZero));
+ mul32(src, dest);
+ return Jump(m_assembler.jCC(x86Condition(cond)));
+ }
+
+ Jump branchMul32(Condition cond, Imm32 imm, RegisterID src, RegisterID dest)
+ {
+ ASSERT(cond == Overflow);
+ mul32(imm, src, dest);
+ return Jump(m_assembler.jCC(x86Condition(cond)));
+ }
+
+ Jump branchSub32(Condition cond, RegisterID src, RegisterID dest)
+ {
+ ASSERT((cond == Overflow) || (cond == Signed) || (cond == Zero) || (cond == NonZero));
+ sub32(src, dest);
+ return Jump(m_assembler.jCC(x86Condition(cond)));
+ }
+
+ Jump branchSub32(Condition cond, Imm32 imm, RegisterID dest)
+ {
+ ASSERT((cond == Overflow) || (cond == Signed) || (cond == Zero) || (cond == NonZero));
+ sub32(imm, dest);
+ return Jump(m_assembler.jCC(x86Condition(cond)));
+ }
+
+ Jump branchSub32(Condition cond, Imm32 imm, Address dest)
+ {
+ ASSERT((cond == Overflow) || (cond == Zero) || (cond == NonZero));
+ sub32(imm, dest);
+ return Jump(m_assembler.jCC(x86Condition(cond)));
+ }
+
+ Jump branchSub32(Condition cond, RegisterID src, Address dest)
+ {
+ ASSERT((cond == Overflow) || (cond == Zero) || (cond == NonZero));
+ sub32(src, dest);
+ return Jump(m_assembler.jCC(x86Condition(cond)));
+ }
+
+ Jump branchSub32(Condition cond, Address src, RegisterID dest)
+ {
+ ASSERT((cond == Overflow) || (cond == Zero) || (cond == NonZero));
+ sub32(src, dest);
+ return Jump(m_assembler.jCC(x86Condition(cond)));
+ }
+
+ Jump branchNeg32(Condition cond, RegisterID srcDest)
+ {
+ ASSERT((cond == Overflow) || (cond == Zero) || (cond == NonZero));
+ neg32(srcDest);
+ return Jump(m_assembler.jCC(x86Condition(cond)));
+ }
+
+ Jump branchOr32(Condition cond, RegisterID src, RegisterID dest)
+ {
+ ASSERT((cond == Signed) || (cond == Zero) || (cond == NonZero));
+ or32(src, dest);
+ return Jump(m_assembler.jCC(x86Condition(cond)));
+ }
+
+
+ // Miscellaneous operations:
+
+ void breakpoint()
+ {
+ m_assembler.int3();
+ }
+
+ Call nearCall()
+ {
+ return Call(m_assembler.call(), Call::LinkableNear);
+ }
+
+ Call call(RegisterID target)
+ {
+ return Call(m_assembler.call(target), Call::None);
+ }
+
+ void call(Address address)
+ {
+ m_assembler.call_m(address.offset, address.base);
+ }
+
+ void ret()
+ {
+ m_assembler.ret();
+ }
+
+ void set8Compare32(Condition cond, RegisterID left, RegisterID right, RegisterID dest)
+ {
+ m_assembler.cmpl_rr(right, left);
+ m_assembler.setCC_r(x86Condition(cond), dest);
+ }
+
+ void set8Compare32(Condition cond, Address left, RegisterID right, RegisterID dest)
+ {
+ m_assembler.cmpl_mr(left.offset, left.base, right);
+ m_assembler.setCC_r(x86Condition(cond), dest);
+ }
+
+ void set8Compare32(Condition cond, RegisterID left, Imm32 right, RegisterID dest)
+ {
+ if (((cond == Equal) || (cond == NotEqual)) && !right.m_value)
+ m_assembler.testl_rr(left, left);
+ else
+ m_assembler.cmpl_ir(right.m_value, left);
+ m_assembler.setCC_r(x86Condition(cond), dest);
+ }
+
+ void set32Compare32(Condition cond, RegisterID left, RegisterID right, RegisterID dest)
+ {
+ m_assembler.cmpl_rr(right, left);
+ m_assembler.setCC_r(x86Condition(cond), dest);
+ m_assembler.movzbl_rr(dest, dest);
+ }
+
+ void set32Compare32(Condition cond, RegisterID left, Imm32 right, RegisterID dest)
+ {
+ if (((cond == Equal) || (cond == NotEqual)) && !right.m_value)
+ m_assembler.testl_rr(left, left);
+ else
+ m_assembler.cmpl_ir(right.m_value, left);
+ m_assembler.setCC_r(x86Condition(cond), dest);
+ m_assembler.movzbl_rr(dest, dest);
+ }
+
+ // FIXME:
+ // The mask should be optional... paerhaps the argument order should be
+ // dest-src, operations always have a dest? ... possibly not true, considering
+ // asm ops like test, or pseudo ops like pop().
+
+ void set32Test8(Condition cond, Address address, Imm32 mask, RegisterID dest)
+ {
+ if (mask.m_value == -1)
+ m_assembler.cmpb_im(0, address.offset, address.base);
+ else
+ m_assembler.testb_im(mask.m_value, address.offset, address.base);
+ m_assembler.setCC_r(x86Condition(cond), dest);
+ m_assembler.movzbl_rr(dest, dest);
+ }
+
+ void set32Test32(Condition cond, Address address, Imm32 mask, RegisterID dest)
+ {
+ if (mask.m_value == -1)
+ m_assembler.cmpl_im(0, address.offset, address.base);
+ else
+ m_assembler.testl_i32m(mask.m_value, address.offset, address.base);
+ m_assembler.setCC_r(x86Condition(cond), dest);
+ m_assembler.movzbl_rr(dest, dest);
+ }
+
+protected:
+ X86Assembler::Condition x86Condition(Condition cond)
+ {
+ return static_cast<X86Assembler::Condition>(cond);
+ }
+
+private:
+ // Only MacroAssemblerX86 should be using the following method; SSE2 is always available on
+ // x86_64, and clients & subclasses of MacroAssembler should be using 'supportsFloatingPoint()'.
+ friend class MacroAssemblerX86;
+
+#if CPU(X86)
+#if OS(MAC_OS_X)
+
+ // All X86 Macs are guaranteed to support at least SSE2,
+ static bool isSSE2Present()
+ {
+ return true;
+ }
+
+#else // OS(MAC_OS_X)
+
+ enum SSE2CheckState {
+ NotCheckedSSE2,
+ HasSSE2,
+ NoSSE2
+ };
+
+ static bool isSSE2Present()
+ {
+ if (s_sse2CheckState == NotCheckedSSE2) {
+ // Default the flags value to zero; if the compiler is
+ // not MSVC or GCC we will read this as SSE2 not present.
+ int flags = 0;
+#if COMPILER(MSVC)
+ _asm {
+ mov eax, 1 // cpuid function 1 gives us the standard feature set
+ cpuid;
+ mov flags, edx;
+ }
+#elif COMPILER(GCC)
+ asm (
+ "movl $0x1, %%eax;"
+ "pushl %%ebx;"
+ "cpuid;"
+ "popl %%ebx;"
+ "movl %%edx, %0;"
+ : "=g" (flags)
+ :
+ : "%eax", "%ecx", "%edx"
+ );
+#endif
+ static const int SSE2FeatureBit = 1 << 26;
+ s_sse2CheckState = (flags & SSE2FeatureBit) ? HasSSE2 : NoSSE2;
+ }
+ // Only check once.
+ ASSERT(s_sse2CheckState != NotCheckedSSE2);
+
+ return s_sse2CheckState == HasSSE2;
+ }
+
+ static SSE2CheckState s_sse2CheckState;
+
+#endif // OS(MAC_OS_X)
+#elif !defined(NDEBUG) // CPU(X86)
+
+ // On x86-64 we should never be checking for SSE2 in a non-debug build,
+ // but non debug add this method to keep the asserts above happy.
+ static bool isSSE2Present()
+ {
+ return true;
+ }
+
+#endif
+};
+
+} // namespace JSC
+
+#endif // ENABLE(ASSEMBLER)
+
+#endif // MacroAssemblerX86Common_h
diff --git a/Source/JavaScriptCore/assembler/MacroAssemblerX86_64.h b/Source/JavaScriptCore/assembler/MacroAssemblerX86_64.h
new file mode 100644
index 0000000..168c93f
--- /dev/null
+++ b/Source/JavaScriptCore/assembler/MacroAssemblerX86_64.h
@@ -0,0 +1,460 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef MacroAssemblerX86_64_h
+#define MacroAssemblerX86_64_h
+
+#if ENABLE(ASSEMBLER) && CPU(X86_64)
+
+#include "MacroAssemblerX86Common.h"
+
+#define REPTACH_OFFSET_CALL_R11 3
+
+namespace JSC {
+
+class MacroAssemblerX86_64 : public MacroAssemblerX86Common {
+protected:
+ static const X86Registers::RegisterID scratchRegister = X86Registers::r11;
+
+public:
+ static const Scale ScalePtr = TimesEight;
+
+ using MacroAssemblerX86Common::add32;
+ using MacroAssemblerX86Common::and32;
+ using MacroAssemblerX86Common::or32;
+ using MacroAssemblerX86Common::sub32;
+ using MacroAssemblerX86Common::load32;
+ using MacroAssemblerX86Common::store32;
+ using MacroAssemblerX86Common::call;
+ using MacroAssemblerX86Common::loadDouble;
+ using MacroAssemblerX86Common::convertInt32ToDouble;
+
+ void add32(Imm32 imm, AbsoluteAddress address)
+ {
+ move(ImmPtr(address.m_ptr), scratchRegister);
+ add32(imm, Address(scratchRegister));
+ }
+
+ void and32(Imm32 imm, AbsoluteAddress address)
+ {
+ move(ImmPtr(address.m_ptr), scratchRegister);
+ and32(imm, Address(scratchRegister));
+ }
+
+ void or32(Imm32 imm, AbsoluteAddress address)
+ {
+ move(ImmPtr(address.m_ptr), scratchRegister);
+ or32(imm, Address(scratchRegister));
+ }
+
+ void sub32(Imm32 imm, AbsoluteAddress address)
+ {
+ move(ImmPtr(address.m_ptr), scratchRegister);
+ sub32(imm, Address(scratchRegister));
+ }
+
+ void load32(void* address, RegisterID dest)
+ {
+ if (dest == X86Registers::eax)
+ m_assembler.movl_mEAX(address);
+ else {
+ move(X86Registers::eax, dest);
+ m_assembler.movl_mEAX(address);
+ swap(X86Registers::eax, dest);
+ }
+ }
+
+ void loadDouble(const void* address, FPRegisterID dest)
+ {
+ move(ImmPtr(address), scratchRegister);
+ loadDouble(scratchRegister, dest);
+ }
+
+ void convertInt32ToDouble(AbsoluteAddress src, FPRegisterID dest)
+ {
+ move(Imm32(*static_cast<int32_t*>(src.m_ptr)), scratchRegister);
+ m_assembler.cvtsi2sd_rr(scratchRegister, dest);
+ }
+
+ void store32(Imm32 imm, void* address)
+ {
+ move(X86Registers::eax, scratchRegister);
+ move(imm, X86Registers::eax);
+ m_assembler.movl_EAXm(address);
+ move(scratchRegister, X86Registers::eax);
+ }
+
+ Call call()
+ {
+ DataLabelPtr label = moveWithPatch(ImmPtr(0), scratchRegister);
+ Call result = Call(m_assembler.call(scratchRegister), Call::Linkable);
+ ASSERT(differenceBetween(label, result) == REPTACH_OFFSET_CALL_R11);
+ return result;
+ }
+
+ Call tailRecursiveCall()
+ {
+ DataLabelPtr label = moveWithPatch(ImmPtr(0), scratchRegister);
+ Jump newJump = Jump(m_assembler.jmp_r(scratchRegister));
+ ASSERT(differenceBetween(label, newJump) == REPTACH_OFFSET_CALL_R11);
+ return Call::fromTailJump(newJump);
+ }
+
+ Call makeTailRecursiveCall(Jump oldJump)
+ {
+ oldJump.link(this);
+ DataLabelPtr label = moveWithPatch(ImmPtr(0), scratchRegister);
+ Jump newJump = Jump(m_assembler.jmp_r(scratchRegister));
+ ASSERT(differenceBetween(label, newJump) == REPTACH_OFFSET_CALL_R11);
+ return Call::fromTailJump(newJump);
+ }
+
+
+ void addPtr(RegisterID src, RegisterID dest)
+ {
+ m_assembler.addq_rr(src, dest);
+ }
+
+ void addPtr(Imm32 imm, RegisterID srcDest)
+ {
+ m_assembler.addq_ir(imm.m_value, srcDest);
+ }
+
+ void addPtr(ImmPtr imm, RegisterID dest)
+ {
+ move(imm, scratchRegister);
+ m_assembler.addq_rr(scratchRegister, dest);
+ }
+
+ void addPtr(Imm32 imm, RegisterID src, RegisterID dest)
+ {
+ m_assembler.leaq_mr(imm.m_value, src, dest);
+ }
+
+ void addPtr(Imm32 imm, Address address)
+ {
+ m_assembler.addq_im(imm.m_value, address.offset, address.base);
+ }
+
+ void addPtr(Imm32 imm, AbsoluteAddress address)
+ {
+ move(ImmPtr(address.m_ptr), scratchRegister);
+ addPtr(imm, Address(scratchRegister));
+ }
+
+ void andPtr(RegisterID src, RegisterID dest)
+ {
+ m_assembler.andq_rr(src, dest);
+ }
+
+ void andPtr(Imm32 imm, RegisterID srcDest)
+ {
+ m_assembler.andq_ir(imm.m_value, srcDest);
+ }
+
+ void orPtr(RegisterID src, RegisterID dest)
+ {
+ m_assembler.orq_rr(src, dest);
+ }
+
+ void orPtr(ImmPtr imm, RegisterID dest)
+ {
+ move(imm, scratchRegister);
+ m_assembler.orq_rr(scratchRegister, dest);
+ }
+
+ void orPtr(Imm32 imm, RegisterID dest)
+ {
+ m_assembler.orq_ir(imm.m_value, dest);
+ }
+
+ void subPtr(RegisterID src, RegisterID dest)
+ {
+ m_assembler.subq_rr(src, dest);
+ }
+
+ void subPtr(Imm32 imm, RegisterID dest)
+ {
+ m_assembler.subq_ir(imm.m_value, dest);
+ }
+
+ void subPtr(ImmPtr imm, RegisterID dest)
+ {
+ move(imm, scratchRegister);
+ m_assembler.subq_rr(scratchRegister, dest);
+ }
+
+ void xorPtr(RegisterID src, RegisterID dest)
+ {
+ m_assembler.xorq_rr(src, dest);
+ }
+
+ void xorPtr(Imm32 imm, RegisterID srcDest)
+ {
+ m_assembler.xorq_ir(imm.m_value, srcDest);
+ }
+
+
+ void loadPtr(ImplicitAddress address, RegisterID dest)
+ {
+ m_assembler.movq_mr(address.offset, address.base, dest);
+ }
+
+ void loadPtr(BaseIndex address, RegisterID dest)
+ {
+ m_assembler.movq_mr(address.offset, address.base, address.index, address.scale, dest);
+ }
+
+ void loadPtr(void* address, RegisterID dest)
+ {
+ if (dest == X86Registers::eax)
+ m_assembler.movq_mEAX(address);
+ else {
+ move(X86Registers::eax, dest);
+ m_assembler.movq_mEAX(address);
+ swap(X86Registers::eax, dest);
+ }
+ }
+
+ DataLabel32 loadPtrWithAddressOffsetPatch(Address address, RegisterID dest)
+ {
+ m_assembler.movq_mr_disp32(address.offset, address.base, dest);
+ return DataLabel32(this);
+ }
+
+ void storePtr(RegisterID src, ImplicitAddress address)
+ {
+ m_assembler.movq_rm(src, address.offset, address.base);
+ }
+
+ void storePtr(RegisterID src, BaseIndex address)
+ {
+ m_assembler.movq_rm(src, address.offset, address.base, address.index, address.scale);
+ }
+
+ void storePtr(RegisterID src, void* address)
+ {
+ if (src == X86Registers::eax)
+ m_assembler.movq_EAXm(address);
+ else {
+ swap(X86Registers::eax, src);
+ m_assembler.movq_EAXm(address);
+ swap(X86Registers::eax, src);
+ }
+ }
+
+ void storePtr(ImmPtr imm, ImplicitAddress address)
+ {
+ move(imm, scratchRegister);
+ storePtr(scratchRegister, address);
+ }
+
+ DataLabel32 storePtrWithAddressOffsetPatch(RegisterID src, Address address)
+ {
+ m_assembler.movq_rm_disp32(src, address.offset, address.base);
+ return DataLabel32(this);
+ }
+
+ void movePtrToDouble(RegisterID src, FPRegisterID dest)
+ {
+ m_assembler.movq_rr(src, dest);
+ }
+
+ void moveDoubleToPtr(FPRegisterID src, RegisterID dest)
+ {
+ m_assembler.movq_rr(src, dest);
+ }
+
+ void setPtr(Condition cond, RegisterID left, Imm32 right, RegisterID dest)
+ {
+ if (((cond == Equal) || (cond == NotEqual)) && !right.m_value)
+ m_assembler.testq_rr(left, left);
+ else
+ m_assembler.cmpq_ir(right.m_value, left);
+ m_assembler.setCC_r(x86Condition(cond), dest);
+ m_assembler.movzbl_rr(dest, dest);
+ }
+
+ Jump branchPtr(Condition cond, RegisterID left, RegisterID right)
+ {
+ m_assembler.cmpq_rr(right, left);
+ return Jump(m_assembler.jCC(x86Condition(cond)));
+ }
+
+ Jump branchPtr(Condition cond, RegisterID left, ImmPtr right)
+ {
+ move(right, scratchRegister);
+ return branchPtr(cond, left, scratchRegister);
+ }
+
+ Jump branchPtr(Condition cond, RegisterID left, Address right)
+ {
+ m_assembler.cmpq_mr(right.offset, right.base, left);
+ return Jump(m_assembler.jCC(x86Condition(cond)));
+ }
+
+ Jump branchPtr(Condition cond, AbsoluteAddress left, RegisterID right)
+ {
+ move(ImmPtr(left.m_ptr), scratchRegister);
+ return branchPtr(cond, Address(scratchRegister), right);
+ }
+
+ Jump branchPtr(Condition cond, Address left, RegisterID right)
+ {
+ m_assembler.cmpq_rm(right, left.offset, left.base);
+ return Jump(m_assembler.jCC(x86Condition(cond)));
+ }
+
+ Jump branchPtr(Condition cond, Address left, ImmPtr right)
+ {
+ move(right, scratchRegister);
+ return branchPtr(cond, left, scratchRegister);
+ }
+
+ Jump branchTestPtr(Condition cond, RegisterID reg, RegisterID mask)
+ {
+ m_assembler.testq_rr(reg, mask);
+ return Jump(m_assembler.jCC(x86Condition(cond)));
+ }
+
+ Jump branchTestPtr(Condition cond, RegisterID reg, Imm32 mask = Imm32(-1))
+ {
+ // if we are only interested in the low seven bits, this can be tested with a testb
+ if (mask.m_value == -1)
+ m_assembler.testq_rr(reg, reg);
+ else if ((mask.m_value & ~0x7f) == 0)
+ m_assembler.testb_i8r(mask.m_value, reg);
+ else
+ m_assembler.testq_i32r(mask.m_value, reg);
+ return Jump(m_assembler.jCC(x86Condition(cond)));
+ }
+
+ Jump branchTestPtr(Condition cond, Address address, Imm32 mask = Imm32(-1))
+ {
+ if (mask.m_value == -1)
+ m_assembler.cmpq_im(0, address.offset, address.base);
+ else
+ m_assembler.testq_i32m(mask.m_value, address.offset, address.base);
+ return Jump(m_assembler.jCC(x86Condition(cond)));
+ }
+
+ Jump branchTestPtr(Condition cond, BaseIndex address, Imm32 mask = Imm32(-1))
+ {
+ if (mask.m_value == -1)
+ m_assembler.cmpq_im(0, address.offset, address.base, address.index, address.scale);
+ else
+ m_assembler.testq_i32m(mask.m_value, address.offset, address.base, address.index, address.scale);
+ return Jump(m_assembler.jCC(x86Condition(cond)));
+ }
+
+
+ Jump branchAddPtr(Condition cond, RegisterID src, RegisterID dest)
+ {
+ ASSERT((cond == Overflow) || (cond == Zero) || (cond == NonZero));
+ addPtr(src, dest);
+ return Jump(m_assembler.jCC(x86Condition(cond)));
+ }
+
+ Jump branchSubPtr(Condition cond, Imm32 imm, RegisterID dest)
+ {
+ ASSERT((cond == Overflow) || (cond == Zero) || (cond == NonZero));
+ subPtr(imm, dest);
+ return Jump(m_assembler.jCC(x86Condition(cond)));
+ }
+
+ DataLabelPtr moveWithPatch(ImmPtr initialValue, RegisterID dest)
+ {
+ m_assembler.movq_i64r(initialValue.asIntptr(), dest);
+ return DataLabelPtr(this);
+ }
+
+ Jump branchPtrWithPatch(Condition cond, RegisterID left, DataLabelPtr& dataLabel, ImmPtr initialRightValue = ImmPtr(0))
+ {
+ dataLabel = moveWithPatch(initialRightValue, scratchRegister);
+ return branchPtr(cond, left, scratchRegister);
+ }
+
+ Jump branchPtrWithPatch(Condition cond, Address left, DataLabelPtr& dataLabel, ImmPtr initialRightValue = ImmPtr(0))
+ {
+ dataLabel = moveWithPatch(initialRightValue, scratchRegister);
+ return branchPtr(cond, left, scratchRegister);
+ }
+
+ DataLabelPtr storePtrWithPatch(ImmPtr initialValue, ImplicitAddress address)
+ {
+ DataLabelPtr label = moveWithPatch(initialValue, scratchRegister);
+ storePtr(scratchRegister, address);
+ return label;
+ }
+
+ using MacroAssemblerX86Common::branchTest8;
+ Jump branchTest8(Condition cond, ExtendedAddress address, Imm32 mask = Imm32(-1))
+ {
+ ImmPtr addr(reinterpret_cast<void*>(address.offset));
+ MacroAssemblerX86Common::move(addr, scratchRegister);
+ return MacroAssemblerX86Common::branchTest8(cond, BaseIndex(scratchRegister, address.base, TimesOne), mask);
+ }
+
+ Label loadPtrWithPatchToLEA(Address address, RegisterID dest)
+ {
+ Label label(this);
+ loadPtr(address, dest);
+ return label;
+ }
+
+ bool supportsFloatingPoint() const { return true; }
+ // See comment on MacroAssemblerARMv7::supportsFloatingPointTruncate()
+ bool supportsFloatingPointTruncate() const { return true; }
+ bool supportsFloatingPointSqrt() const { return true; }
+
+private:
+ friend class LinkBuffer;
+ friend class RepatchBuffer;
+
+ static void linkCall(void* code, Call call, FunctionPtr function)
+ {
+ if (!call.isFlagSet(Call::Near))
+ X86Assembler::linkPointer(code, X86Assembler::labelFor(call.m_jmp, -REPTACH_OFFSET_CALL_R11), function.value());
+ else
+ X86Assembler::linkCall(code, call.m_jmp, function.value());
+ }
+
+ static void repatchCall(CodeLocationCall call, CodeLocationLabel destination)
+ {
+ X86Assembler::repatchPointer(call.dataLabelPtrAtOffset(-REPTACH_OFFSET_CALL_R11).dataLocation(), destination.executableAddress());
+ }
+
+ static void repatchCall(CodeLocationCall call, FunctionPtr destination)
+ {
+ X86Assembler::repatchPointer(call.dataLabelPtrAtOffset(-REPTACH_OFFSET_CALL_R11).dataLocation(), destination.executableAddress());
+ }
+
+};
+
+} // namespace JSC
+
+#endif // ENABLE(ASSEMBLER)
+
+#endif // MacroAssemblerX86_64_h
diff --git a/Source/JavaScriptCore/assembler/RepatchBuffer.h b/Source/JavaScriptCore/assembler/RepatchBuffer.h
new file mode 100644
index 0000000..72cf6b2
--- /dev/null
+++ b/Source/JavaScriptCore/assembler/RepatchBuffer.h
@@ -0,0 +1,134 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef RepatchBuffer_h
+#define RepatchBuffer_h
+
+#if ENABLE(ASSEMBLER)
+
+#include <MacroAssembler.h>
+#include <wtf/Noncopyable.h>
+
+namespace JSC {
+
+// RepatchBuffer:
+//
+// This class is used to modify code after code generation has been completed,
+// and after the code has potentially already been executed. This mechanism is
+// used to apply optimizations to the code.
+//
+class RepatchBuffer {
+ typedef MacroAssemblerCodePtr CodePtr;
+
+public:
+ RepatchBuffer(CodeBlock* codeBlock)
+ {
+ JITCode& code = codeBlock->getJITCode();
+ m_start = code.start();
+ m_size = code.size();
+
+ ExecutableAllocator::makeWritable(m_start, m_size);
+ }
+
+ ~RepatchBuffer()
+ {
+ ExecutableAllocator::makeExecutable(m_start, m_size);
+ }
+
+ void relink(CodeLocationJump jump, CodeLocationLabel destination)
+ {
+ MacroAssembler::repatchJump(jump, destination);
+ }
+
+ void relink(CodeLocationCall call, CodeLocationLabel destination)
+ {
+ MacroAssembler::repatchCall(call, destination);
+ }
+
+ void relink(CodeLocationCall call, FunctionPtr destination)
+ {
+ MacroAssembler::repatchCall(call, destination);
+ }
+
+ void relink(CodeLocationNearCall nearCall, CodePtr destination)
+ {
+ MacroAssembler::repatchNearCall(nearCall, CodeLocationLabel(destination));
+ }
+
+ void relink(CodeLocationNearCall nearCall, CodeLocationLabel destination)
+ {
+ MacroAssembler::repatchNearCall(nearCall, destination);
+ }
+
+ void repatch(CodeLocationDataLabel32 dataLabel32, int32_t value)
+ {
+ MacroAssembler::repatchInt32(dataLabel32, value);
+ }
+
+ void repatch(CodeLocationDataLabelPtr dataLabelPtr, void* value)
+ {
+ MacroAssembler::repatchPointer(dataLabelPtr, value);
+ }
+
+ void repatchLoadPtrToLEA(CodeLocationInstruction instruction)
+ {
+ MacroAssembler::repatchLoadPtrToLEA(instruction);
+ }
+
+ void relinkCallerToTrampoline(ReturnAddressPtr returnAddress, CodeLocationLabel label)
+ {
+ relink(CodeLocationCall(CodePtr(returnAddress)), label);
+ }
+
+ void relinkCallerToTrampoline(ReturnAddressPtr returnAddress, CodePtr newCalleeFunction)
+ {
+ relinkCallerToTrampoline(returnAddress, CodeLocationLabel(newCalleeFunction));
+ }
+
+ void relinkCallerToFunction(ReturnAddressPtr returnAddress, FunctionPtr function)
+ {
+ relink(CodeLocationCall(CodePtr(returnAddress)), function);
+ }
+
+ void relinkNearCallerToTrampoline(ReturnAddressPtr returnAddress, CodeLocationLabel label)
+ {
+ relink(CodeLocationNearCall(CodePtr(returnAddress)), label);
+ }
+
+ void relinkNearCallerToTrampoline(ReturnAddressPtr returnAddress, CodePtr newCalleeFunction)
+ {
+ relinkNearCallerToTrampoline(returnAddress, CodeLocationLabel(newCalleeFunction));
+ }
+
+private:
+ void* m_start;
+ size_t m_size;
+};
+
+} // namespace JSC
+
+#endif // ENABLE(ASSEMBLER)
+
+#endif // RepatchBuffer_h
diff --git a/Source/JavaScriptCore/assembler/X86Assembler.h b/Source/JavaScriptCore/assembler/X86Assembler.h
new file mode 100644
index 0000000..b352ad4
--- /dev/null
+++ b/Source/JavaScriptCore/assembler/X86Assembler.h
@@ -0,0 +1,2100 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef X86Assembler_h
+#define X86Assembler_h
+
+#if ENABLE(ASSEMBLER) && (CPU(X86) || CPU(X86_64))
+
+#include "AssemblerBuffer.h"
+#include <stdint.h>
+#include <wtf/Assertions.h>
+#include <wtf/Vector.h>
+
+namespace JSC {
+
+inline bool CAN_SIGN_EXTEND_8_32(int32_t value) { return value == (int32_t)(signed char)value; }
+
+namespace X86Registers {
+ typedef enum {
+ eax,
+ ecx,
+ edx,
+ ebx,
+ esp,
+ ebp,
+ esi,
+ edi,
+
+#if CPU(X86_64)
+ r8,
+ r9,
+ r10,
+ r11,
+ r12,
+ r13,
+ r14,
+ r15,
+#endif
+ } RegisterID;
+
+ typedef enum {
+ xmm0,
+ xmm1,
+ xmm2,
+ xmm3,
+ xmm4,
+ xmm5,
+ xmm6,
+ xmm7,
+ } XMMRegisterID;
+}
+
+class X86Assembler {
+public:
+ typedef X86Registers::RegisterID RegisterID;
+ typedef X86Registers::XMMRegisterID XMMRegisterID;
+ typedef XMMRegisterID FPRegisterID;
+
+ typedef enum {
+ ConditionO,
+ ConditionNO,
+ ConditionB,
+ ConditionAE,
+ ConditionE,
+ ConditionNE,
+ ConditionBE,
+ ConditionA,
+ ConditionS,
+ ConditionNS,
+ ConditionP,
+ ConditionNP,
+ ConditionL,
+ ConditionGE,
+ ConditionLE,
+ ConditionG,
+
+ ConditionC = ConditionB,
+ ConditionNC = ConditionAE,
+ } Condition;
+
+private:
+ typedef enum {
+ OP_ADD_EvGv = 0x01,
+ OP_ADD_GvEv = 0x03,
+ OP_OR_EvGv = 0x09,
+ OP_OR_GvEv = 0x0B,
+ OP_2BYTE_ESCAPE = 0x0F,
+ OP_AND_EvGv = 0x21,
+ OP_AND_GvEv = 0x23,
+ OP_SUB_EvGv = 0x29,
+ OP_SUB_GvEv = 0x2B,
+ PRE_PREDICT_BRANCH_NOT_TAKEN = 0x2E,
+ OP_XOR_EvGv = 0x31,
+ OP_XOR_GvEv = 0x33,
+ OP_CMP_EvGv = 0x39,
+ OP_CMP_GvEv = 0x3B,
+#if CPU(X86_64)
+ PRE_REX = 0x40,
+#endif
+ OP_PUSH_EAX = 0x50,
+ OP_POP_EAX = 0x58,
+#if CPU(X86_64)
+ OP_MOVSXD_GvEv = 0x63,
+#endif
+ PRE_OPERAND_SIZE = 0x66,
+ PRE_SSE_66 = 0x66,
+ OP_PUSH_Iz = 0x68,
+ OP_IMUL_GvEvIz = 0x69,
+ OP_GROUP1_EbIb = 0x80,
+ OP_GROUP1_EvIz = 0x81,
+ OP_GROUP1_EvIb = 0x83,
+ OP_TEST_EvGv = 0x85,
+ OP_XCHG_EvGv = 0x87,
+ OP_MOV_EvGv = 0x89,
+ OP_MOV_GvEv = 0x8B,
+ OP_LEA = 0x8D,
+ OP_GROUP1A_Ev = 0x8F,
+ OP_CDQ = 0x99,
+ OP_MOV_EAXOv = 0xA1,
+ OP_MOV_OvEAX = 0xA3,
+ OP_MOV_EAXIv = 0xB8,
+ OP_GROUP2_EvIb = 0xC1,
+ OP_RET = 0xC3,
+ OP_GROUP11_EvIz = 0xC7,
+ OP_INT3 = 0xCC,
+ OP_GROUP2_Ev1 = 0xD1,
+ OP_GROUP2_EvCL = 0xD3,
+ OP_CALL_rel32 = 0xE8,
+ OP_JMP_rel32 = 0xE9,
+ PRE_SSE_F2 = 0xF2,
+ OP_HLT = 0xF4,
+ OP_GROUP3_EbIb = 0xF6,
+ OP_GROUP3_Ev = 0xF7,
+ OP_GROUP3_EvIz = 0xF7, // OP_GROUP3_Ev has an immediate, when instruction is a test.
+ OP_GROUP5_Ev = 0xFF,
+ } OneByteOpcodeID;
+
+ typedef enum {
+ OP2_MOVSD_VsdWsd = 0x10,
+ OP2_MOVSD_WsdVsd = 0x11,
+ OP2_CVTSI2SD_VsdEd = 0x2A,
+ OP2_CVTTSD2SI_GdWsd = 0x2C,
+ OP2_UCOMISD_VsdWsd = 0x2E,
+ OP2_ADDSD_VsdWsd = 0x58,
+ OP2_MULSD_VsdWsd = 0x59,
+ OP2_SUBSD_VsdWsd = 0x5C,
+ OP2_DIVSD_VsdWsd = 0x5E,
+ OP2_SQRTSD_VsdWsd = 0x51,
+ OP2_XORPD_VpdWpd = 0x57,
+ OP2_MOVD_VdEd = 0x6E,
+ OP2_MOVD_EdVd = 0x7E,
+ OP2_JCC_rel32 = 0x80,
+ OP_SETCC = 0x90,
+ OP2_IMUL_GvEv = 0xAF,
+ OP2_MOVZX_GvEb = 0xB6,
+ OP2_MOVZX_GvEw = 0xB7,
+ OP2_PEXTRW_GdUdIb = 0xC5,
+ } TwoByteOpcodeID;
+
+ TwoByteOpcodeID jccRel32(Condition cond)
+ {
+ return (TwoByteOpcodeID)(OP2_JCC_rel32 + cond);
+ }
+
+ TwoByteOpcodeID setccOpcode(Condition cond)
+ {
+ return (TwoByteOpcodeID)(OP_SETCC + cond);
+ }
+
+ typedef enum {
+ GROUP1_OP_ADD = 0,
+ GROUP1_OP_OR = 1,
+ GROUP1_OP_ADC = 2,
+ GROUP1_OP_AND = 4,
+ GROUP1_OP_SUB = 5,
+ GROUP1_OP_XOR = 6,
+ GROUP1_OP_CMP = 7,
+
+ GROUP1A_OP_POP = 0,
+
+ GROUP2_OP_SHL = 4,
+ GROUP2_OP_SHR = 5,
+ GROUP2_OP_SAR = 7,
+
+ GROUP3_OP_TEST = 0,
+ GROUP3_OP_NOT = 2,
+ GROUP3_OP_NEG = 3,
+ GROUP3_OP_IDIV = 7,
+
+ GROUP5_OP_CALLN = 2,
+ GROUP5_OP_JMPN = 4,
+ GROUP5_OP_PUSH = 6,
+
+ GROUP11_MOV = 0,
+ } GroupOpcodeID;
+
+ class X86InstructionFormatter;
+public:
+
+ class JmpSrc {
+ friend class X86Assembler;
+ friend class X86InstructionFormatter;
+ public:
+ JmpSrc()
+ : m_offset(-1)
+ {
+ }
+
+ private:
+ JmpSrc(int offset)
+ : m_offset(offset)
+ {
+ }
+
+ int m_offset;
+ };
+
+ class JmpDst {
+ friend class X86Assembler;
+ friend class X86InstructionFormatter;
+ public:
+ JmpDst()
+ : m_offset(-1)
+ , m_used(false)
+ {
+ }
+
+ bool isUsed() const { return m_used; }
+ bool isSet() const { return (m_offset != -1); }
+ void used() { m_used = true; }
+ private:
+ JmpDst(int offset)
+ : m_offset(offset)
+ , m_used(false)
+ {
+ ASSERT(m_offset == offset);
+ }
+
+ int m_offset : 31;
+ bool m_used : 1;
+ };
+
+ X86Assembler()
+ {
+ }
+
+ size_t size() const { return m_formatter.size(); }
+
+ // Stack operations:
+
+ void push_r(RegisterID reg)
+ {
+ m_formatter.oneByteOp(OP_PUSH_EAX, reg);
+ }
+
+ void pop_r(RegisterID reg)
+ {
+ m_formatter.oneByteOp(OP_POP_EAX, reg);
+ }
+
+ void push_i32(int imm)
+ {
+ m_formatter.oneByteOp(OP_PUSH_Iz);
+ m_formatter.immediate32(imm);
+ }
+
+ void push_m(int offset, RegisterID base)
+ {
+ m_formatter.oneByteOp(OP_GROUP5_Ev, GROUP5_OP_PUSH, base, offset);
+ }
+
+ void pop_m(int offset, RegisterID base)
+ {
+ m_formatter.oneByteOp(OP_GROUP1A_Ev, GROUP1A_OP_POP, base, offset);
+ }
+
+ // Arithmetic operations:
+
+#if !CPU(X86_64)
+ void adcl_im(int imm, void* addr)
+ {
+ if (CAN_SIGN_EXTEND_8_32(imm)) {
+ m_formatter.oneByteOp(OP_GROUP1_EvIb, GROUP1_OP_ADC, addr);
+ m_formatter.immediate8(imm);
+ } else {
+ m_formatter.oneByteOp(OP_GROUP1_EvIz, GROUP1_OP_ADC, addr);
+ m_formatter.immediate32(imm);
+ }
+ }
+#endif
+
+ void addl_rr(RegisterID src, RegisterID dst)
+ {
+ m_formatter.oneByteOp(OP_ADD_EvGv, src, dst);
+ }
+
+ void addl_mr(int offset, RegisterID base, RegisterID dst)
+ {
+ m_formatter.oneByteOp(OP_ADD_GvEv, dst, base, offset);
+ }
+
+ void addl_rm(RegisterID src, int offset, RegisterID base)
+ {
+ m_formatter.oneByteOp(OP_ADD_EvGv, src, base, offset);
+ }
+
+ void addl_ir(int imm, RegisterID dst)
+ {
+ if (CAN_SIGN_EXTEND_8_32(imm)) {
+ m_formatter.oneByteOp(OP_GROUP1_EvIb, GROUP1_OP_ADD, dst);
+ m_formatter.immediate8(imm);
+ } else {
+ m_formatter.oneByteOp(OP_GROUP1_EvIz, GROUP1_OP_ADD, dst);
+ m_formatter.immediate32(imm);
+ }
+ }
+
+ void addl_im(int imm, int offset, RegisterID base)
+ {
+ if (CAN_SIGN_EXTEND_8_32(imm)) {
+ m_formatter.oneByteOp(OP_GROUP1_EvIb, GROUP1_OP_ADD, base, offset);
+ m_formatter.immediate8(imm);
+ } else {
+ m_formatter.oneByteOp(OP_GROUP1_EvIz, GROUP1_OP_ADD, base, offset);
+ m_formatter.immediate32(imm);
+ }
+ }
+
+#if CPU(X86_64)
+ void addq_rr(RegisterID src, RegisterID dst)
+ {
+ m_formatter.oneByteOp64(OP_ADD_EvGv, src, dst);
+ }
+
+ void addq_ir(int imm, RegisterID dst)
+ {
+ if (CAN_SIGN_EXTEND_8_32(imm)) {
+ m_formatter.oneByteOp64(OP_GROUP1_EvIb, GROUP1_OP_ADD, dst);
+ m_formatter.immediate8(imm);
+ } else {
+ m_formatter.oneByteOp64(OP_GROUP1_EvIz, GROUP1_OP_ADD, dst);
+ m_formatter.immediate32(imm);
+ }
+ }
+
+ void addq_im(int imm, int offset, RegisterID base)
+ {
+ if (CAN_SIGN_EXTEND_8_32(imm)) {
+ m_formatter.oneByteOp64(OP_GROUP1_EvIb, GROUP1_OP_ADD, base, offset);
+ m_formatter.immediate8(imm);
+ } else {
+ m_formatter.oneByteOp64(OP_GROUP1_EvIz, GROUP1_OP_ADD, base, offset);
+ m_formatter.immediate32(imm);
+ }
+ }
+#else
+ void addl_im(int imm, void* addr)
+ {
+ if (CAN_SIGN_EXTEND_8_32(imm)) {
+ m_formatter.oneByteOp(OP_GROUP1_EvIb, GROUP1_OP_ADD, addr);
+ m_formatter.immediate8(imm);
+ } else {
+ m_formatter.oneByteOp(OP_GROUP1_EvIz, GROUP1_OP_ADD, addr);
+ m_formatter.immediate32(imm);
+ }
+ }
+#endif
+
+ void andl_rr(RegisterID src, RegisterID dst)
+ {
+ m_formatter.oneByteOp(OP_AND_EvGv, src, dst);
+ }
+
+ void andl_mr(int offset, RegisterID base, RegisterID dst)
+ {
+ m_formatter.oneByteOp(OP_AND_GvEv, dst, base, offset);
+ }
+
+ void andl_rm(RegisterID src, int offset, RegisterID base)
+ {
+ m_formatter.oneByteOp(OP_AND_EvGv, src, base, offset);
+ }
+
+ void andl_ir(int imm, RegisterID dst)
+ {
+ if (CAN_SIGN_EXTEND_8_32(imm)) {
+ m_formatter.oneByteOp(OP_GROUP1_EvIb, GROUP1_OP_AND, dst);
+ m_formatter.immediate8(imm);
+ } else {
+ m_formatter.oneByteOp(OP_GROUP1_EvIz, GROUP1_OP_AND, dst);
+ m_formatter.immediate32(imm);
+ }
+ }
+
+ void andl_im(int imm, int offset, RegisterID base)
+ {
+ if (CAN_SIGN_EXTEND_8_32(imm)) {
+ m_formatter.oneByteOp(OP_GROUP1_EvIb, GROUP1_OP_AND, base, offset);
+ m_formatter.immediate8(imm);
+ } else {
+ m_formatter.oneByteOp(OP_GROUP1_EvIz, GROUP1_OP_AND, base, offset);
+ m_formatter.immediate32(imm);
+ }
+ }
+
+#if CPU(X86_64)
+ void andq_rr(RegisterID src, RegisterID dst)
+ {
+ m_formatter.oneByteOp64(OP_AND_EvGv, src, dst);
+ }
+
+ void andq_ir(int imm, RegisterID dst)
+ {
+ if (CAN_SIGN_EXTEND_8_32(imm)) {
+ m_formatter.oneByteOp64(OP_GROUP1_EvIb, GROUP1_OP_AND, dst);
+ m_formatter.immediate8(imm);
+ } else {
+ m_formatter.oneByteOp64(OP_GROUP1_EvIz, GROUP1_OP_AND, dst);
+ m_formatter.immediate32(imm);
+ }
+ }
+#else
+ void andl_im(int imm, void* addr)
+ {
+ if (CAN_SIGN_EXTEND_8_32(imm)) {
+ m_formatter.oneByteOp(OP_GROUP1_EvIb, GROUP1_OP_AND, addr);
+ m_formatter.immediate8(imm);
+ } else {
+ m_formatter.oneByteOp(OP_GROUP1_EvIz, GROUP1_OP_AND, addr);
+ m_formatter.immediate32(imm);
+ }
+ }
+#endif
+
+ void negl_r(RegisterID dst)
+ {
+ m_formatter.oneByteOp(OP_GROUP3_Ev, GROUP3_OP_NEG, dst);
+ }
+
+ void negl_m(int offset, RegisterID base)
+ {
+ m_formatter.oneByteOp(OP_GROUP3_Ev, GROUP3_OP_NEG, base, offset);
+ }
+
+ void notl_r(RegisterID dst)
+ {
+ m_formatter.oneByteOp(OP_GROUP3_Ev, GROUP3_OP_NOT, dst);
+ }
+
+ void notl_m(int offset, RegisterID base)
+ {
+ m_formatter.oneByteOp(OP_GROUP3_Ev, GROUP3_OP_NOT, base, offset);
+ }
+
+ void orl_rr(RegisterID src, RegisterID dst)
+ {
+ m_formatter.oneByteOp(OP_OR_EvGv, src, dst);
+ }
+
+ void orl_mr(int offset, RegisterID base, RegisterID dst)
+ {
+ m_formatter.oneByteOp(OP_OR_GvEv, dst, base, offset);
+ }
+
+ void orl_rm(RegisterID src, int offset, RegisterID base)
+ {
+ m_formatter.oneByteOp(OP_OR_EvGv, src, base, offset);
+ }
+
+ void orl_ir(int imm, RegisterID dst)
+ {
+ if (CAN_SIGN_EXTEND_8_32(imm)) {
+ m_formatter.oneByteOp(OP_GROUP1_EvIb, GROUP1_OP_OR, dst);
+ m_formatter.immediate8(imm);
+ } else {
+ m_formatter.oneByteOp(OP_GROUP1_EvIz, GROUP1_OP_OR, dst);
+ m_formatter.immediate32(imm);
+ }
+ }
+
+ void orl_im(int imm, int offset, RegisterID base)
+ {
+ if (CAN_SIGN_EXTEND_8_32(imm)) {
+ m_formatter.oneByteOp(OP_GROUP1_EvIb, GROUP1_OP_OR, base, offset);
+ m_formatter.immediate8(imm);
+ } else {
+ m_formatter.oneByteOp(OP_GROUP1_EvIz, GROUP1_OP_OR, base, offset);
+ m_formatter.immediate32(imm);
+ }
+ }
+
+#if CPU(X86_64)
+ void orq_rr(RegisterID src, RegisterID dst)
+ {
+ m_formatter.oneByteOp64(OP_OR_EvGv, src, dst);
+ }
+
+ void orq_ir(int imm, RegisterID dst)
+ {
+ if (CAN_SIGN_EXTEND_8_32(imm)) {
+ m_formatter.oneByteOp64(OP_GROUP1_EvIb, GROUP1_OP_OR, dst);
+ m_formatter.immediate8(imm);
+ } else {
+ m_formatter.oneByteOp64(OP_GROUP1_EvIz, GROUP1_OP_OR, dst);
+ m_formatter.immediate32(imm);
+ }
+ }
+#else
+ void orl_im(int imm, void* addr)
+ {
+ if (CAN_SIGN_EXTEND_8_32(imm)) {
+ m_formatter.oneByteOp(OP_GROUP1_EvIb, GROUP1_OP_OR, addr);
+ m_formatter.immediate8(imm);
+ } else {
+ m_formatter.oneByteOp(OP_GROUP1_EvIz, GROUP1_OP_OR, addr);
+ m_formatter.immediate32(imm);
+ }
+ }
+#endif
+
+ void subl_rr(RegisterID src, RegisterID dst)
+ {
+ m_formatter.oneByteOp(OP_SUB_EvGv, src, dst);
+ }
+
+ void subl_mr(int offset, RegisterID base, RegisterID dst)
+ {
+ m_formatter.oneByteOp(OP_SUB_GvEv, dst, base, offset);
+ }
+
+ void subl_rm(RegisterID src, int offset, RegisterID base)
+ {
+ m_formatter.oneByteOp(OP_SUB_EvGv, src, base, offset);
+ }
+
+ void subl_ir(int imm, RegisterID dst)
+ {
+ if (CAN_SIGN_EXTEND_8_32(imm)) {
+ m_formatter.oneByteOp(OP_GROUP1_EvIb, GROUP1_OP_SUB, dst);
+ m_formatter.immediate8(imm);
+ } else {
+ m_formatter.oneByteOp(OP_GROUP1_EvIz, GROUP1_OP_SUB, dst);
+ m_formatter.immediate32(imm);
+ }
+ }
+
+ void subl_im(int imm, int offset, RegisterID base)
+ {
+ if (CAN_SIGN_EXTEND_8_32(imm)) {
+ m_formatter.oneByteOp(OP_GROUP1_EvIb, GROUP1_OP_SUB, base, offset);
+ m_formatter.immediate8(imm);
+ } else {
+ m_formatter.oneByteOp(OP_GROUP1_EvIz, GROUP1_OP_SUB, base, offset);
+ m_formatter.immediate32(imm);
+ }
+ }
+
+#if CPU(X86_64)
+ void subq_rr(RegisterID src, RegisterID dst)
+ {
+ m_formatter.oneByteOp64(OP_SUB_EvGv, src, dst);
+ }
+
+ void subq_ir(int imm, RegisterID dst)
+ {
+ if (CAN_SIGN_EXTEND_8_32(imm)) {
+ m_formatter.oneByteOp64(OP_GROUP1_EvIb, GROUP1_OP_SUB, dst);
+ m_formatter.immediate8(imm);
+ } else {
+ m_formatter.oneByteOp64(OP_GROUP1_EvIz, GROUP1_OP_SUB, dst);
+ m_formatter.immediate32(imm);
+ }
+ }
+#else
+ void subl_im(int imm, void* addr)
+ {
+ if (CAN_SIGN_EXTEND_8_32(imm)) {
+ m_formatter.oneByteOp(OP_GROUP1_EvIb, GROUP1_OP_SUB, addr);
+ m_formatter.immediate8(imm);
+ } else {
+ m_formatter.oneByteOp(OP_GROUP1_EvIz, GROUP1_OP_SUB, addr);
+ m_formatter.immediate32(imm);
+ }
+ }
+#endif
+
+ void xorl_rr(RegisterID src, RegisterID dst)
+ {
+ m_formatter.oneByteOp(OP_XOR_EvGv, src, dst);
+ }
+
+ void xorl_mr(int offset, RegisterID base, RegisterID dst)
+ {
+ m_formatter.oneByteOp(OP_XOR_GvEv, dst, base, offset);
+ }
+
+ void xorl_rm(RegisterID src, int offset, RegisterID base)
+ {
+ m_formatter.oneByteOp(OP_XOR_EvGv, src, base, offset);
+ }
+
+ void xorl_im(int imm, int offset, RegisterID base)
+ {
+ if (CAN_SIGN_EXTEND_8_32(imm)) {
+ m_formatter.oneByteOp(OP_GROUP1_EvIb, GROUP1_OP_XOR, base, offset);
+ m_formatter.immediate8(imm);
+ } else {
+ m_formatter.oneByteOp(OP_GROUP1_EvIz, GROUP1_OP_XOR, base, offset);
+ m_formatter.immediate32(imm);
+ }
+ }
+
+ void xorl_ir(int imm, RegisterID dst)
+ {
+ if (CAN_SIGN_EXTEND_8_32(imm)) {
+ m_formatter.oneByteOp(OP_GROUP1_EvIb, GROUP1_OP_XOR, dst);
+ m_formatter.immediate8(imm);
+ } else {
+ m_formatter.oneByteOp(OP_GROUP1_EvIz, GROUP1_OP_XOR, dst);
+ m_formatter.immediate32(imm);
+ }
+ }
+
+#if CPU(X86_64)
+ void xorq_rr(RegisterID src, RegisterID dst)
+ {
+ m_formatter.oneByteOp64(OP_XOR_EvGv, src, dst);
+ }
+
+ void xorq_ir(int imm, RegisterID dst)
+ {
+ if (CAN_SIGN_EXTEND_8_32(imm)) {
+ m_formatter.oneByteOp64(OP_GROUP1_EvIb, GROUP1_OP_XOR, dst);
+ m_formatter.immediate8(imm);
+ } else {
+ m_formatter.oneByteOp64(OP_GROUP1_EvIz, GROUP1_OP_XOR, dst);
+ m_formatter.immediate32(imm);
+ }
+ }
+#endif
+
+ void sarl_i8r(int imm, RegisterID dst)
+ {
+ if (imm == 1)
+ m_formatter.oneByteOp(OP_GROUP2_Ev1, GROUP2_OP_SAR, dst);
+ else {
+ m_formatter.oneByteOp(OP_GROUP2_EvIb, GROUP2_OP_SAR, dst);
+ m_formatter.immediate8(imm);
+ }
+ }
+
+ void sarl_CLr(RegisterID dst)
+ {
+ m_formatter.oneByteOp(OP_GROUP2_EvCL, GROUP2_OP_SAR, dst);
+ }
+
+ void shrl_i8r(int imm, RegisterID dst)
+ {
+ if (imm == 1)
+ m_formatter.oneByteOp(OP_GROUP2_Ev1, GROUP2_OP_SHR, dst);
+ else {
+ m_formatter.oneByteOp(OP_GROUP2_EvIb, GROUP2_OP_SHR, dst);
+ m_formatter.immediate8(imm);
+ }
+ }
+
+ void shrl_CLr(RegisterID dst)
+ {
+ m_formatter.oneByteOp(OP_GROUP2_EvCL, GROUP2_OP_SHR, dst);
+ }
+
+ void shll_i8r(int imm, RegisterID dst)
+ {
+ if (imm == 1)
+ m_formatter.oneByteOp(OP_GROUP2_Ev1, GROUP2_OP_SHL, dst);
+ else {
+ m_formatter.oneByteOp(OP_GROUP2_EvIb, GROUP2_OP_SHL, dst);
+ m_formatter.immediate8(imm);
+ }
+ }
+
+ void shll_CLr(RegisterID dst)
+ {
+ m_formatter.oneByteOp(OP_GROUP2_EvCL, GROUP2_OP_SHL, dst);
+ }
+
+#if CPU(X86_64)
+ void sarq_CLr(RegisterID dst)
+ {
+ m_formatter.oneByteOp64(OP_GROUP2_EvCL, GROUP2_OP_SAR, dst);
+ }
+
+ void sarq_i8r(int imm, RegisterID dst)
+ {
+ if (imm == 1)
+ m_formatter.oneByteOp64(OP_GROUP2_Ev1, GROUP2_OP_SAR, dst);
+ else {
+ m_formatter.oneByteOp64(OP_GROUP2_EvIb, GROUP2_OP_SAR, dst);
+ m_formatter.immediate8(imm);
+ }
+ }
+#endif
+
+ void imull_rr(RegisterID src, RegisterID dst)
+ {
+ m_formatter.twoByteOp(OP2_IMUL_GvEv, dst, src);
+ }
+
+ void imull_mr(int offset, RegisterID base, RegisterID dst)
+ {
+ m_formatter.twoByteOp(OP2_IMUL_GvEv, dst, base, offset);
+ }
+
+ void imull_i32r(RegisterID src, int32_t value, RegisterID dst)
+ {
+ m_formatter.oneByteOp(OP_IMUL_GvEvIz, dst, src);
+ m_formatter.immediate32(value);
+ }
+
+ void idivl_r(RegisterID dst)
+ {
+ m_formatter.oneByteOp(OP_GROUP3_Ev, GROUP3_OP_IDIV, dst);
+ }
+
+ // Comparisons:
+
+ void cmpl_rr(RegisterID src, RegisterID dst)
+ {
+ m_formatter.oneByteOp(OP_CMP_EvGv, src, dst);
+ }
+
+ void cmpl_rm(RegisterID src, int offset, RegisterID base)
+ {
+ m_formatter.oneByteOp(OP_CMP_EvGv, src, base, offset);
+ }
+
+ void cmpl_mr(int offset, RegisterID base, RegisterID src)
+ {
+ m_formatter.oneByteOp(OP_CMP_GvEv, src, base, offset);
+ }
+
+ void cmpl_ir(int imm, RegisterID dst)
+ {
+ if (CAN_SIGN_EXTEND_8_32(imm)) {
+ m_formatter.oneByteOp(OP_GROUP1_EvIb, GROUP1_OP_CMP, dst);
+ m_formatter.immediate8(imm);
+ } else {
+ m_formatter.oneByteOp(OP_GROUP1_EvIz, GROUP1_OP_CMP, dst);
+ m_formatter.immediate32(imm);
+ }
+ }
+
+ void cmpl_ir_force32(int imm, RegisterID dst)
+ {
+ m_formatter.oneByteOp(OP_GROUP1_EvIz, GROUP1_OP_CMP, dst);
+ m_formatter.immediate32(imm);
+ }
+
+ void cmpl_im(int imm, int offset, RegisterID base)
+ {
+ if (CAN_SIGN_EXTEND_8_32(imm)) {
+ m_formatter.oneByteOp(OP_GROUP1_EvIb, GROUP1_OP_CMP, base, offset);
+ m_formatter.immediate8(imm);
+ } else {
+ m_formatter.oneByteOp(OP_GROUP1_EvIz, GROUP1_OP_CMP, base, offset);
+ m_formatter.immediate32(imm);
+ }
+ }
+
+ void cmpb_im(int imm, int offset, RegisterID base)
+ {
+ m_formatter.oneByteOp(OP_GROUP1_EbIb, GROUP1_OP_CMP, base, offset);
+ m_formatter.immediate8(imm);
+ }
+
+ void cmpb_im(int imm, int offset, RegisterID base, RegisterID index, int scale)
+ {
+ m_formatter.oneByteOp(OP_GROUP1_EbIb, GROUP1_OP_CMP, base, index, scale, offset);
+ m_formatter.immediate8(imm);
+ }
+
+ void cmpl_im(int imm, int offset, RegisterID base, RegisterID index, int scale)
+ {
+ if (CAN_SIGN_EXTEND_8_32(imm)) {
+ m_formatter.oneByteOp(OP_GROUP1_EvIb, GROUP1_OP_CMP, base, index, scale, offset);
+ m_formatter.immediate8(imm);
+ } else {
+ m_formatter.oneByteOp(OP_GROUP1_EvIz, GROUP1_OP_CMP, base, index, scale, offset);
+ m_formatter.immediate32(imm);
+ }
+ }
+
+ void cmpl_im_force32(int imm, int offset, RegisterID base)
+ {
+ m_formatter.oneByteOp(OP_GROUP1_EvIz, GROUP1_OP_CMP, base, offset);
+ m_formatter.immediate32(imm);
+ }
+
+#if CPU(X86_64)
+ void cmpq_rr(RegisterID src, RegisterID dst)
+ {
+ m_formatter.oneByteOp64(OP_CMP_EvGv, src, dst);
+ }
+
+ void cmpq_rm(RegisterID src, int offset, RegisterID base)
+ {
+ m_formatter.oneByteOp64(OP_CMP_EvGv, src, base, offset);
+ }
+
+ void cmpq_mr(int offset, RegisterID base, RegisterID src)
+ {
+ m_formatter.oneByteOp64(OP_CMP_GvEv, src, base, offset);
+ }
+
+ void cmpq_ir(int imm, RegisterID dst)
+ {
+ if (CAN_SIGN_EXTEND_8_32(imm)) {
+ m_formatter.oneByteOp64(OP_GROUP1_EvIb, GROUP1_OP_CMP, dst);
+ m_formatter.immediate8(imm);
+ } else {
+ m_formatter.oneByteOp64(OP_GROUP1_EvIz, GROUP1_OP_CMP, dst);
+ m_formatter.immediate32(imm);
+ }
+ }
+
+ void cmpq_im(int imm, int offset, RegisterID base)
+ {
+ if (CAN_SIGN_EXTEND_8_32(imm)) {
+ m_formatter.oneByteOp64(OP_GROUP1_EvIb, GROUP1_OP_CMP, base, offset);
+ m_formatter.immediate8(imm);
+ } else {
+ m_formatter.oneByteOp64(OP_GROUP1_EvIz, GROUP1_OP_CMP, base, offset);
+ m_formatter.immediate32(imm);
+ }
+ }
+
+ void cmpq_im(int imm, int offset, RegisterID base, RegisterID index, int scale)
+ {
+ if (CAN_SIGN_EXTEND_8_32(imm)) {
+ m_formatter.oneByteOp64(OP_GROUP1_EvIb, GROUP1_OP_CMP, base, index, scale, offset);
+ m_formatter.immediate8(imm);
+ } else {
+ m_formatter.oneByteOp64(OP_GROUP1_EvIz, GROUP1_OP_CMP, base, index, scale, offset);
+ m_formatter.immediate32(imm);
+ }
+ }
+#else
+ void cmpl_rm(RegisterID reg, void* addr)
+ {
+ m_formatter.oneByteOp(OP_CMP_EvGv, reg, addr);
+ }
+
+ void cmpl_im(int imm, void* addr)
+ {
+ if (CAN_SIGN_EXTEND_8_32(imm)) {
+ m_formatter.oneByteOp(OP_GROUP1_EvIb, GROUP1_OP_CMP, addr);
+ m_formatter.immediate8(imm);
+ } else {
+ m_formatter.oneByteOp(OP_GROUP1_EvIz, GROUP1_OP_CMP, addr);
+ m_formatter.immediate32(imm);
+ }
+ }
+#endif
+
+ void cmpw_rm(RegisterID src, int offset, RegisterID base, RegisterID index, int scale)
+ {
+ m_formatter.prefix(PRE_OPERAND_SIZE);
+ m_formatter.oneByteOp(OP_CMP_EvGv, src, base, index, scale, offset);
+ }
+
+ void cmpw_im(int imm, int offset, RegisterID base, RegisterID index, int scale)
+ {
+ if (CAN_SIGN_EXTEND_8_32(imm)) {
+ m_formatter.prefix(PRE_OPERAND_SIZE);
+ m_formatter.oneByteOp(OP_GROUP1_EvIb, GROUP1_OP_CMP, base, index, scale, offset);
+ m_formatter.immediate8(imm);
+ } else {
+ m_formatter.prefix(PRE_OPERAND_SIZE);
+ m_formatter.oneByteOp(OP_GROUP1_EvIz, GROUP1_OP_CMP, base, index, scale, offset);
+ m_formatter.immediate16(imm);
+ }
+ }
+
+ void testl_rr(RegisterID src, RegisterID dst)
+ {
+ m_formatter.oneByteOp(OP_TEST_EvGv, src, dst);
+ }
+
+ void testl_i32r(int imm, RegisterID dst)
+ {
+ m_formatter.oneByteOp(OP_GROUP3_EvIz, GROUP3_OP_TEST, dst);
+ m_formatter.immediate32(imm);
+ }
+
+ void testl_i32m(int imm, int offset, RegisterID base)
+ {
+ m_formatter.oneByteOp(OP_GROUP3_EvIz, GROUP3_OP_TEST, base, offset);
+ m_formatter.immediate32(imm);
+ }
+
+ void testb_im(int imm, int offset, RegisterID base)
+ {
+ m_formatter.oneByteOp(OP_GROUP3_EbIb, GROUP3_OP_TEST, base, offset);
+ m_formatter.immediate8(imm);
+ }
+
+ void testb_im(int imm, int offset, RegisterID base, RegisterID index, int scale)
+ {
+ m_formatter.oneByteOp(OP_GROUP3_EbIb, GROUP3_OP_TEST, base, index, scale, offset);
+ m_formatter.immediate8(imm);
+ }
+
+ void testl_i32m(int imm, int offset, RegisterID base, RegisterID index, int scale)
+ {
+ m_formatter.oneByteOp(OP_GROUP3_EvIz, GROUP3_OP_TEST, base, index, scale, offset);
+ m_formatter.immediate32(imm);
+ }
+
+#if CPU(X86_64)
+ void testq_rr(RegisterID src, RegisterID dst)
+ {
+ m_formatter.oneByteOp64(OP_TEST_EvGv, src, dst);
+ }
+
+ void testq_i32r(int imm, RegisterID dst)
+ {
+ m_formatter.oneByteOp64(OP_GROUP3_EvIz, GROUP3_OP_TEST, dst);
+ m_formatter.immediate32(imm);
+ }
+
+ void testq_i32m(int imm, int offset, RegisterID base)
+ {
+ m_formatter.oneByteOp64(OP_GROUP3_EvIz, GROUP3_OP_TEST, base, offset);
+ m_formatter.immediate32(imm);
+ }
+
+ void testq_i32m(int imm, int offset, RegisterID base, RegisterID index, int scale)
+ {
+ m_formatter.oneByteOp64(OP_GROUP3_EvIz, GROUP3_OP_TEST, base, index, scale, offset);
+ m_formatter.immediate32(imm);
+ }
+#endif
+
+ void testw_rr(RegisterID src, RegisterID dst)
+ {
+ m_formatter.prefix(PRE_OPERAND_SIZE);
+ m_formatter.oneByteOp(OP_TEST_EvGv, src, dst);
+ }
+
+ void testb_i8r(int imm, RegisterID dst)
+ {
+ m_formatter.oneByteOp8(OP_GROUP3_EbIb, GROUP3_OP_TEST, dst);
+ m_formatter.immediate8(imm);
+ }
+
+ void setCC_r(Condition cond, RegisterID dst)
+ {
+ m_formatter.twoByteOp8(setccOpcode(cond), (GroupOpcodeID)0, dst);
+ }
+
+ void sete_r(RegisterID dst)
+ {
+ m_formatter.twoByteOp8(setccOpcode(ConditionE), (GroupOpcodeID)0, dst);
+ }
+
+ void setz_r(RegisterID dst)
+ {
+ sete_r(dst);
+ }
+
+ void setne_r(RegisterID dst)
+ {
+ m_formatter.twoByteOp8(setccOpcode(ConditionNE), (GroupOpcodeID)0, dst);
+ }
+
+ void setnz_r(RegisterID dst)
+ {
+ setne_r(dst);
+ }
+
+ // Various move ops:
+
+ void cdq()
+ {
+ m_formatter.oneByteOp(OP_CDQ);
+ }
+
+ void xchgl_rr(RegisterID src, RegisterID dst)
+ {
+ m_formatter.oneByteOp(OP_XCHG_EvGv, src, dst);
+ }
+
+#if CPU(X86_64)
+ void xchgq_rr(RegisterID src, RegisterID dst)
+ {
+ m_formatter.oneByteOp64(OP_XCHG_EvGv, src, dst);
+ }
+#endif
+
+ void movl_rr(RegisterID src, RegisterID dst)
+ {
+ m_formatter.oneByteOp(OP_MOV_EvGv, src, dst);
+ }
+
+ void movl_rm(RegisterID src, int offset, RegisterID base)
+ {
+ m_formatter.oneByteOp(OP_MOV_EvGv, src, base, offset);
+ }
+
+ void movl_rm_disp32(RegisterID src, int offset, RegisterID base)
+ {
+ m_formatter.oneByteOp_disp32(OP_MOV_EvGv, src, base, offset);
+ }
+
+ void movl_rm(RegisterID src, int offset, RegisterID base, RegisterID index, int scale)
+ {
+ m_formatter.oneByteOp(OP_MOV_EvGv, src, base, index, scale, offset);
+ }
+
+ void movl_mEAX(void* addr)
+ {
+ m_formatter.oneByteOp(OP_MOV_EAXOv);
+#if CPU(X86_64)
+ m_formatter.immediate64(reinterpret_cast<int64_t>(addr));
+#else
+ m_formatter.immediate32(reinterpret_cast<int>(addr));
+#endif
+ }
+
+ void movl_mr(int offset, RegisterID base, RegisterID dst)
+ {
+ m_formatter.oneByteOp(OP_MOV_GvEv, dst, base, offset);
+ }
+
+ void movl_mr_disp32(int offset, RegisterID base, RegisterID dst)
+ {
+ m_formatter.oneByteOp_disp32(OP_MOV_GvEv, dst, base, offset);
+ }
+
+ void movl_mr(int offset, RegisterID base, RegisterID index, int scale, RegisterID dst)
+ {
+ m_formatter.oneByteOp(OP_MOV_GvEv, dst, base, index, scale, offset);
+ }
+
+ void movl_i32r(int imm, RegisterID dst)
+ {
+ m_formatter.oneByteOp(OP_MOV_EAXIv, dst);
+ m_formatter.immediate32(imm);
+ }
+
+ void movl_i32m(int imm, int offset, RegisterID base)
+ {
+ m_formatter.oneByteOp(OP_GROUP11_EvIz, GROUP11_MOV, base, offset);
+ m_formatter.immediate32(imm);
+ }
+
+ void movl_EAXm(void* addr)
+ {
+ m_formatter.oneByteOp(OP_MOV_OvEAX);
+#if CPU(X86_64)
+ m_formatter.immediate64(reinterpret_cast<int64_t>(addr));
+#else
+ m_formatter.immediate32(reinterpret_cast<int>(addr));
+#endif
+ }
+
+#if CPU(X86_64)
+ void movq_rr(RegisterID src, RegisterID dst)
+ {
+ m_formatter.oneByteOp64(OP_MOV_EvGv, src, dst);
+ }
+
+ void movq_rm(RegisterID src, int offset, RegisterID base)
+ {
+ m_formatter.oneByteOp64(OP_MOV_EvGv, src, base, offset);
+ }
+
+ void movq_rm_disp32(RegisterID src, int offset, RegisterID base)
+ {
+ m_formatter.oneByteOp64_disp32(OP_MOV_EvGv, src, base, offset);
+ }
+
+ void movq_rm(RegisterID src, int offset, RegisterID base, RegisterID index, int scale)
+ {
+ m_formatter.oneByteOp64(OP_MOV_EvGv, src, base, index, scale, offset);
+ }
+
+ void movq_mEAX(void* addr)
+ {
+ m_formatter.oneByteOp64(OP_MOV_EAXOv);
+ m_formatter.immediate64(reinterpret_cast<int64_t>(addr));
+ }
+
+ void movq_EAXm(void* addr)
+ {
+ m_formatter.oneByteOp64(OP_MOV_OvEAX);
+ m_formatter.immediate64(reinterpret_cast<int64_t>(addr));
+ }
+
+ void movq_mr(int offset, RegisterID base, RegisterID dst)
+ {
+ m_formatter.oneByteOp64(OP_MOV_GvEv, dst, base, offset);
+ }
+
+ void movq_mr_disp32(int offset, RegisterID base, RegisterID dst)
+ {
+ m_formatter.oneByteOp64_disp32(OP_MOV_GvEv, dst, base, offset);
+ }
+
+ void movq_mr(int offset, RegisterID base, RegisterID index, int scale, RegisterID dst)
+ {
+ m_formatter.oneByteOp64(OP_MOV_GvEv, dst, base, index, scale, offset);
+ }
+
+ void movq_i32m(int imm, int offset, RegisterID base)
+ {
+ m_formatter.oneByteOp64(OP_GROUP11_EvIz, GROUP11_MOV, base, offset);
+ m_formatter.immediate32(imm);
+ }
+
+ void movq_i64r(int64_t imm, RegisterID dst)
+ {
+ m_formatter.oneByteOp64(OP_MOV_EAXIv, dst);
+ m_formatter.immediate64(imm);
+ }
+
+ void movsxd_rr(RegisterID src, RegisterID dst)
+ {
+ m_formatter.oneByteOp64(OP_MOVSXD_GvEv, dst, src);
+ }
+
+
+#else
+ void movl_rm(RegisterID src, void* addr)
+ {
+ if (src == X86Registers::eax)
+ movl_EAXm(addr);
+ else
+ m_formatter.oneByteOp(OP_MOV_EvGv, src, addr);
+ }
+
+ void movl_mr(void* addr, RegisterID dst)
+ {
+ if (dst == X86Registers::eax)
+ movl_mEAX(addr);
+ else
+ m_formatter.oneByteOp(OP_MOV_GvEv, dst, addr);
+ }
+
+ void movl_i32m(int imm, void* addr)
+ {
+ m_formatter.oneByteOp(OP_GROUP11_EvIz, GROUP11_MOV, addr);
+ m_formatter.immediate32(imm);
+ }
+#endif
+
+ void movzwl_mr(int offset, RegisterID base, RegisterID dst)
+ {
+ m_formatter.twoByteOp(OP2_MOVZX_GvEw, dst, base, offset);
+ }
+
+ void movzwl_mr(int offset, RegisterID base, RegisterID index, int scale, RegisterID dst)
+ {
+ m_formatter.twoByteOp(OP2_MOVZX_GvEw, dst, base, index, scale, offset);
+ }
+
+ void movzbl_rr(RegisterID src, RegisterID dst)
+ {
+ // In 64-bit, this may cause an unnecessary REX to be planted (if the dst register
+ // is in the range ESP-EDI, and the src would not have required a REX). Unneeded
+ // REX prefixes are defined to be silently ignored by the processor.
+ m_formatter.twoByteOp8(OP2_MOVZX_GvEb, dst, src);
+ }
+
+ void leal_mr(int offset, RegisterID base, RegisterID dst)
+ {
+ m_formatter.oneByteOp(OP_LEA, dst, base, offset);
+ }
+#if CPU(X86_64)
+ void leaq_mr(int offset, RegisterID base, RegisterID dst)
+ {
+ m_formatter.oneByteOp64(OP_LEA, dst, base, offset);
+ }
+#endif
+
+ // Flow control:
+
+ JmpSrc call()
+ {
+ m_formatter.oneByteOp(OP_CALL_rel32);
+ return m_formatter.immediateRel32();
+ }
+
+ JmpSrc call(RegisterID dst)
+ {
+ m_formatter.oneByteOp(OP_GROUP5_Ev, GROUP5_OP_CALLN, dst);
+ return JmpSrc(m_formatter.size());
+ }
+
+ void call_m(int offset, RegisterID base)
+ {
+ m_formatter.oneByteOp(OP_GROUP5_Ev, GROUP5_OP_CALLN, base, offset);
+ }
+
+ JmpSrc jmp()
+ {
+ m_formatter.oneByteOp(OP_JMP_rel32);
+ return m_formatter.immediateRel32();
+ }
+
+ // Return a JmpSrc so we have a label to the jump, so we can use this
+ // To make a tail recursive call on x86-64. The MacroAssembler
+ // really shouldn't wrap this as a Jump, since it can't be linked. :-/
+ JmpSrc jmp_r(RegisterID dst)
+ {
+ m_formatter.oneByteOp(OP_GROUP5_Ev, GROUP5_OP_JMPN, dst);
+ return JmpSrc(m_formatter.size());
+ }
+
+ void jmp_m(int offset, RegisterID base)
+ {
+ m_formatter.oneByteOp(OP_GROUP5_Ev, GROUP5_OP_JMPN, base, offset);
+ }
+
+ JmpSrc jne()
+ {
+ m_formatter.twoByteOp(jccRel32(ConditionNE));
+ return m_formatter.immediateRel32();
+ }
+
+ JmpSrc jnz()
+ {
+ return jne();
+ }
+
+ JmpSrc je()
+ {
+ m_formatter.twoByteOp(jccRel32(ConditionE));
+ return m_formatter.immediateRel32();
+ }
+
+ JmpSrc jz()
+ {
+ return je();
+ }
+
+ JmpSrc jl()
+ {
+ m_formatter.twoByteOp(jccRel32(ConditionL));
+ return m_formatter.immediateRel32();
+ }
+
+ JmpSrc jb()
+ {
+ m_formatter.twoByteOp(jccRel32(ConditionB));
+ return m_formatter.immediateRel32();
+ }
+
+ JmpSrc jle()
+ {
+ m_formatter.twoByteOp(jccRel32(ConditionLE));
+ return m_formatter.immediateRel32();
+ }
+
+ JmpSrc jbe()
+ {
+ m_formatter.twoByteOp(jccRel32(ConditionBE));
+ return m_formatter.immediateRel32();
+ }
+
+ JmpSrc jge()
+ {
+ m_formatter.twoByteOp(jccRel32(ConditionGE));
+ return m_formatter.immediateRel32();
+ }
+
+ JmpSrc jg()
+ {
+ m_formatter.twoByteOp(jccRel32(ConditionG));
+ return m_formatter.immediateRel32();
+ }
+
+ JmpSrc ja()
+ {
+ m_formatter.twoByteOp(jccRel32(ConditionA));
+ return m_formatter.immediateRel32();
+ }
+
+ JmpSrc jae()
+ {
+ m_formatter.twoByteOp(jccRel32(ConditionAE));
+ return m_formatter.immediateRel32();
+ }
+
+ JmpSrc jo()
+ {
+ m_formatter.twoByteOp(jccRel32(ConditionO));
+ return m_formatter.immediateRel32();
+ }
+
+ JmpSrc jp()
+ {
+ m_formatter.twoByteOp(jccRel32(ConditionP));
+ return m_formatter.immediateRel32();
+ }
+
+ JmpSrc js()
+ {
+ m_formatter.twoByteOp(jccRel32(ConditionS));
+ return m_formatter.immediateRel32();
+ }
+
+ JmpSrc jCC(Condition cond)
+ {
+ m_formatter.twoByteOp(jccRel32(cond));
+ return m_formatter.immediateRel32();
+ }
+
+ // SSE operations:
+
+ void addsd_rr(XMMRegisterID src, XMMRegisterID dst)
+ {
+ m_formatter.prefix(PRE_SSE_F2);
+ m_formatter.twoByteOp(OP2_ADDSD_VsdWsd, (RegisterID)dst, (RegisterID)src);
+ }
+
+ void addsd_mr(int offset, RegisterID base, XMMRegisterID dst)
+ {
+ m_formatter.prefix(PRE_SSE_F2);
+ m_formatter.twoByteOp(OP2_ADDSD_VsdWsd, (RegisterID)dst, base, offset);
+ }
+
+ void cvtsi2sd_rr(RegisterID src, XMMRegisterID dst)
+ {
+ m_formatter.prefix(PRE_SSE_F2);
+ m_formatter.twoByteOp(OP2_CVTSI2SD_VsdEd, (RegisterID)dst, src);
+ }
+
+ void cvtsi2sd_mr(int offset, RegisterID base, XMMRegisterID dst)
+ {
+ m_formatter.prefix(PRE_SSE_F2);
+ m_formatter.twoByteOp(OP2_CVTSI2SD_VsdEd, (RegisterID)dst, base, offset);
+ }
+
+#if !CPU(X86_64)
+ void cvtsi2sd_mr(void* address, XMMRegisterID dst)
+ {
+ m_formatter.prefix(PRE_SSE_F2);
+ m_formatter.twoByteOp(OP2_CVTSI2SD_VsdEd, (RegisterID)dst, address);
+ }
+#endif
+
+ void cvttsd2si_rr(XMMRegisterID src, RegisterID dst)
+ {
+ m_formatter.prefix(PRE_SSE_F2);
+ m_formatter.twoByteOp(OP2_CVTTSD2SI_GdWsd, dst, (RegisterID)src);
+ }
+
+ void movd_rr(XMMRegisterID src, RegisterID dst)
+ {
+ m_formatter.prefix(PRE_SSE_66);
+ m_formatter.twoByteOp(OP2_MOVD_EdVd, (RegisterID)src, dst);
+ }
+
+#if CPU(X86_64)
+ void movq_rr(XMMRegisterID src, RegisterID dst)
+ {
+ m_formatter.prefix(PRE_SSE_66);
+ m_formatter.twoByteOp64(OP2_MOVD_EdVd, (RegisterID)src, dst);
+ }
+
+ void movq_rr(RegisterID src, XMMRegisterID dst)
+ {
+ m_formatter.prefix(PRE_SSE_66);
+ m_formatter.twoByteOp64(OP2_MOVD_VdEd, (RegisterID)dst, src);
+ }
+#endif
+
+ void movsd_rm(XMMRegisterID src, int offset, RegisterID base)
+ {
+ m_formatter.prefix(PRE_SSE_F2);
+ m_formatter.twoByteOp(OP2_MOVSD_WsdVsd, (RegisterID)src, base, offset);
+ }
+
+ void movsd_mr(int offset, RegisterID base, XMMRegisterID dst)
+ {
+ m_formatter.prefix(PRE_SSE_F2);
+ m_formatter.twoByteOp(OP2_MOVSD_VsdWsd, (RegisterID)dst, base, offset);
+ }
+
+#if !CPU(X86_64)
+ void movsd_mr(const void* address, XMMRegisterID dst)
+ {
+ m_formatter.prefix(PRE_SSE_F2);
+ m_formatter.twoByteOp(OP2_MOVSD_VsdWsd, (RegisterID)dst, address);
+ }
+#endif
+
+ void mulsd_rr(XMMRegisterID src, XMMRegisterID dst)
+ {
+ m_formatter.prefix(PRE_SSE_F2);
+ m_formatter.twoByteOp(OP2_MULSD_VsdWsd, (RegisterID)dst, (RegisterID)src);
+ }
+
+ void mulsd_mr(int offset, RegisterID base, XMMRegisterID dst)
+ {
+ m_formatter.prefix(PRE_SSE_F2);
+ m_formatter.twoByteOp(OP2_MULSD_VsdWsd, (RegisterID)dst, base, offset);
+ }
+
+ void pextrw_irr(int whichWord, XMMRegisterID src, RegisterID dst)
+ {
+ m_formatter.prefix(PRE_SSE_66);
+ m_formatter.twoByteOp(OP2_PEXTRW_GdUdIb, (RegisterID)dst, (RegisterID)src);
+ m_formatter.immediate8(whichWord);
+ }
+
+ void subsd_rr(XMMRegisterID src, XMMRegisterID dst)
+ {
+ m_formatter.prefix(PRE_SSE_F2);
+ m_formatter.twoByteOp(OP2_SUBSD_VsdWsd, (RegisterID)dst, (RegisterID)src);
+ }
+
+ void subsd_mr(int offset, RegisterID base, XMMRegisterID dst)
+ {
+ m_formatter.prefix(PRE_SSE_F2);
+ m_formatter.twoByteOp(OP2_SUBSD_VsdWsd, (RegisterID)dst, base, offset);
+ }
+
+ void ucomisd_rr(XMMRegisterID src, XMMRegisterID dst)
+ {
+ m_formatter.prefix(PRE_SSE_66);
+ m_formatter.twoByteOp(OP2_UCOMISD_VsdWsd, (RegisterID)dst, (RegisterID)src);
+ }
+
+ void ucomisd_mr(int offset, RegisterID base, XMMRegisterID dst)
+ {
+ m_formatter.prefix(PRE_SSE_66);
+ m_formatter.twoByteOp(OP2_UCOMISD_VsdWsd, (RegisterID)dst, base, offset);
+ }
+
+ void divsd_rr(XMMRegisterID src, XMMRegisterID dst)
+ {
+ m_formatter.prefix(PRE_SSE_F2);
+ m_formatter.twoByteOp(OP2_DIVSD_VsdWsd, (RegisterID)dst, (RegisterID)src);
+ }
+
+ void divsd_mr(int offset, RegisterID base, XMMRegisterID dst)
+ {
+ m_formatter.prefix(PRE_SSE_F2);
+ m_formatter.twoByteOp(OP2_DIVSD_VsdWsd, (RegisterID)dst, base, offset);
+ }
+
+ void xorpd_rr(XMMRegisterID src, XMMRegisterID dst)
+ {
+ m_formatter.prefix(PRE_SSE_66);
+ m_formatter.twoByteOp(OP2_XORPD_VpdWpd, (RegisterID)dst, (RegisterID)src);
+ }
+
+ void sqrtsd_rr(XMMRegisterID src, XMMRegisterID dst)
+ {
+ m_formatter.prefix(PRE_SSE_F2);
+ m_formatter.twoByteOp(OP2_SQRTSD_VsdWsd, (RegisterID)dst, (RegisterID)src);
+ }
+
+ // Misc instructions:
+
+ void int3()
+ {
+ m_formatter.oneByteOp(OP_INT3);
+ }
+
+ void ret()
+ {
+ m_formatter.oneByteOp(OP_RET);
+ }
+
+ void predictNotTaken()
+ {
+ m_formatter.prefix(PRE_PREDICT_BRANCH_NOT_TAKEN);
+ }
+
+ // Assembler admin methods:
+
+ JmpDst label()
+ {
+ return JmpDst(m_formatter.size());
+ }
+
+ static JmpDst labelFor(JmpSrc jump, intptr_t offset = 0)
+ {
+ return JmpDst(jump.m_offset + offset);
+ }
+
+ JmpDst align(int alignment)
+ {
+ while (!m_formatter.isAligned(alignment))
+ m_formatter.oneByteOp(OP_HLT);
+
+ return label();
+ }
+
+ // Linking & patching:
+ //
+ // 'link' and 'patch' methods are for use on unprotected code - such as the code
+ // within the AssemblerBuffer, and code being patched by the patch buffer. Once
+ // code has been finalized it is (platform support permitting) within a non-
+ // writable region of memory; to modify the code in an execute-only execuable
+ // pool the 'repatch' and 'relink' methods should be used.
+
+ void linkJump(JmpSrc from, JmpDst to)
+ {
+ ASSERT(from.m_offset != -1);
+ ASSERT(to.m_offset != -1);
+
+ char* code = reinterpret_cast<char*>(m_formatter.data());
+ setRel32(code + from.m_offset, code + to.m_offset);
+ }
+
+ static void linkJump(void* code, JmpSrc from, void* to)
+ {
+ ASSERT(from.m_offset != -1);
+
+ setRel32(reinterpret_cast<char*>(code) + from.m_offset, to);
+ }
+
+ static void linkCall(void* code, JmpSrc from, void* to)
+ {
+ ASSERT(from.m_offset != -1);
+
+ setRel32(reinterpret_cast<char*>(code) + from.m_offset, to);
+ }
+
+ static void linkPointer(void* code, JmpDst where, void* value)
+ {
+ ASSERT(where.m_offset != -1);
+
+ setPointer(reinterpret_cast<char*>(code) + where.m_offset, value);
+ }
+
+ static void relinkJump(void* from, void* to)
+ {
+ setRel32(from, to);
+ }
+
+ static void relinkCall(void* from, void* to)
+ {
+ setRel32(from, to);
+ }
+
+ static void repatchInt32(void* where, int32_t value)
+ {
+ setInt32(where, value);
+ }
+
+ static void repatchPointer(void* where, void* value)
+ {
+ setPointer(where, value);
+ }
+
+ static void repatchLoadPtrToLEA(void* where)
+ {
+#if CPU(X86_64)
+ // On x86-64 pointer memory accesses require a 64-bit operand, and as such a REX prefix.
+ // Skip over the prefix byte.
+ where = reinterpret_cast<char*>(where) + 1;
+#endif
+ *reinterpret_cast<unsigned char*>(where) = static_cast<unsigned char>(OP_LEA);
+ }
+
+ static unsigned getCallReturnOffset(JmpSrc call)
+ {
+ ASSERT(call.m_offset >= 0);
+ return call.m_offset;
+ }
+
+ static void* getRelocatedAddress(void* code, JmpSrc jump)
+ {
+ ASSERT(jump.m_offset != -1);
+
+ return reinterpret_cast<void*>(reinterpret_cast<ptrdiff_t>(code) + jump.m_offset);
+ }
+
+ static void* getRelocatedAddress(void* code, JmpDst destination)
+ {
+ ASSERT(destination.m_offset != -1);
+
+ return reinterpret_cast<void*>(reinterpret_cast<ptrdiff_t>(code) + destination.m_offset);
+ }
+
+ static int getDifferenceBetweenLabels(JmpDst src, JmpDst dst)
+ {
+ return dst.m_offset - src.m_offset;
+ }
+
+ static int getDifferenceBetweenLabels(JmpDst src, JmpSrc dst)
+ {
+ return dst.m_offset - src.m_offset;
+ }
+
+ static int getDifferenceBetweenLabels(JmpSrc src, JmpDst dst)
+ {
+ return dst.m_offset - src.m_offset;
+ }
+
+ void* executableCopy(ExecutablePool* allocator)
+ {
+ void* copy = m_formatter.executableCopy(allocator);
+ ASSERT(copy);
+ return copy;
+ }
+
+private:
+
+ static void setPointer(void* where, void* value)
+ {
+ reinterpret_cast<void**>(where)[-1] = value;
+ }
+
+ static void setInt32(void* where, int32_t value)
+ {
+ reinterpret_cast<int32_t*>(where)[-1] = value;
+ }
+
+ static void setRel32(void* from, void* to)
+ {
+ intptr_t offset = reinterpret_cast<intptr_t>(to) - reinterpret_cast<intptr_t>(from);
+ ASSERT(offset == static_cast<int32_t>(offset));
+
+ setInt32(from, offset);
+ }
+
+ class X86InstructionFormatter {
+
+ static const int maxInstructionSize = 16;
+
+ public:
+
+ // Legacy prefix bytes:
+ //
+ // These are emmitted prior to the instruction.
+
+ void prefix(OneByteOpcodeID pre)
+ {
+ m_buffer.putByte(pre);
+ }
+
+ // Word-sized operands / no operand instruction formatters.
+ //
+ // In addition to the opcode, the following operand permutations are supported:
+ // * None - instruction takes no operands.
+ // * One register - the low three bits of the RegisterID are added into the opcode.
+ // * Two registers - encode a register form ModRm (for all ModRm formats, the reg field is passed first, and a GroupOpcodeID may be passed in its place).
+ // * Three argument ModRM - a register, and a register and an offset describing a memory operand.
+ // * Five argument ModRM - a register, and a base register, an index, scale, and offset describing a memory operand.
+ //
+ // For 32-bit x86 targets, the address operand may also be provided as a void*.
+ // On 64-bit targets REX prefixes will be planted as necessary, where high numbered registers are used.
+ //
+ // The twoByteOp methods plant two-byte Intel instructions sequences (first opcode byte 0x0F).
+
+ void oneByteOp(OneByteOpcodeID opcode)
+ {
+ m_buffer.ensureSpace(maxInstructionSize);
+ m_buffer.putByteUnchecked(opcode);
+ }
+
+ void oneByteOp(OneByteOpcodeID opcode, RegisterID reg)
+ {
+ m_buffer.ensureSpace(maxInstructionSize);
+ emitRexIfNeeded(0, 0, reg);
+ m_buffer.putByteUnchecked(opcode + (reg & 7));
+ }
+
+ void oneByteOp(OneByteOpcodeID opcode, int reg, RegisterID rm)
+ {
+ m_buffer.ensureSpace(maxInstructionSize);
+ emitRexIfNeeded(reg, 0, rm);
+ m_buffer.putByteUnchecked(opcode);
+ registerModRM(reg, rm);
+ }
+
+ void oneByteOp(OneByteOpcodeID opcode, int reg, RegisterID base, int offset)
+ {
+ m_buffer.ensureSpace(maxInstructionSize);
+ emitRexIfNeeded(reg, 0, base);
+ m_buffer.putByteUnchecked(opcode);
+ memoryModRM(reg, base, offset);
+ }
+
+ void oneByteOp_disp32(OneByteOpcodeID opcode, int reg, RegisterID base, int offset)
+ {
+ m_buffer.ensureSpace(maxInstructionSize);
+ emitRexIfNeeded(reg, 0, base);
+ m_buffer.putByteUnchecked(opcode);
+ memoryModRM_disp32(reg, base, offset);
+ }
+
+ void oneByteOp(OneByteOpcodeID opcode, int reg, RegisterID base, RegisterID index, int scale, int offset)
+ {
+ m_buffer.ensureSpace(maxInstructionSize);
+ emitRexIfNeeded(reg, index, base);
+ m_buffer.putByteUnchecked(opcode);
+ memoryModRM(reg, base, index, scale, offset);
+ }
+
+#if !CPU(X86_64)
+ void oneByteOp(OneByteOpcodeID opcode, int reg, void* address)
+ {
+ m_buffer.ensureSpace(maxInstructionSize);
+ m_buffer.putByteUnchecked(opcode);
+ memoryModRM(reg, address);
+ }
+#endif
+
+ void twoByteOp(TwoByteOpcodeID opcode)
+ {
+ m_buffer.ensureSpace(maxInstructionSize);
+ m_buffer.putByteUnchecked(OP_2BYTE_ESCAPE);
+ m_buffer.putByteUnchecked(opcode);
+ }
+
+ void twoByteOp(TwoByteOpcodeID opcode, int reg, RegisterID rm)
+ {
+ m_buffer.ensureSpace(maxInstructionSize);
+ emitRexIfNeeded(reg, 0, rm);
+ m_buffer.putByteUnchecked(OP_2BYTE_ESCAPE);
+ m_buffer.putByteUnchecked(opcode);
+ registerModRM(reg, rm);
+ }
+
+ void twoByteOp(TwoByteOpcodeID opcode, int reg, RegisterID base, int offset)
+ {
+ m_buffer.ensureSpace(maxInstructionSize);
+ emitRexIfNeeded(reg, 0, base);
+ m_buffer.putByteUnchecked(OP_2BYTE_ESCAPE);
+ m_buffer.putByteUnchecked(opcode);
+ memoryModRM(reg, base, offset);
+ }
+
+ void twoByteOp(TwoByteOpcodeID opcode, int reg, RegisterID base, RegisterID index, int scale, int offset)
+ {
+ m_buffer.ensureSpace(maxInstructionSize);
+ emitRexIfNeeded(reg, index, base);
+ m_buffer.putByteUnchecked(OP_2BYTE_ESCAPE);
+ m_buffer.putByteUnchecked(opcode);
+ memoryModRM(reg, base, index, scale, offset);
+ }
+
+#if !CPU(X86_64)
+ void twoByteOp(TwoByteOpcodeID opcode, int reg, const void* address)
+ {
+ m_buffer.ensureSpace(maxInstructionSize);
+ m_buffer.putByteUnchecked(OP_2BYTE_ESCAPE);
+ m_buffer.putByteUnchecked(opcode);
+ memoryModRM(reg, address);
+ }
+#endif
+
+#if CPU(X86_64)
+ // Quad-word-sized operands:
+ //
+ // Used to format 64-bit operantions, planting a REX.w prefix.
+ // When planting d64 or f64 instructions, not requiring a REX.w prefix,
+ // the normal (non-'64'-postfixed) formatters should be used.
+
+ void oneByteOp64(OneByteOpcodeID opcode)
+ {
+ m_buffer.ensureSpace(maxInstructionSize);
+ emitRexW(0, 0, 0);
+ m_buffer.putByteUnchecked(opcode);
+ }
+
+ void oneByteOp64(OneByteOpcodeID opcode, RegisterID reg)
+ {
+ m_buffer.ensureSpace(maxInstructionSize);
+ emitRexW(0, 0, reg);
+ m_buffer.putByteUnchecked(opcode + (reg & 7));
+ }
+
+ void oneByteOp64(OneByteOpcodeID opcode, int reg, RegisterID rm)
+ {
+ m_buffer.ensureSpace(maxInstructionSize);
+ emitRexW(reg, 0, rm);
+ m_buffer.putByteUnchecked(opcode);
+ registerModRM(reg, rm);
+ }
+
+ void oneByteOp64(OneByteOpcodeID opcode, int reg, RegisterID base, int offset)
+ {
+ m_buffer.ensureSpace(maxInstructionSize);
+ emitRexW(reg, 0, base);
+ m_buffer.putByteUnchecked(opcode);
+ memoryModRM(reg, base, offset);
+ }
+
+ void oneByteOp64_disp32(OneByteOpcodeID opcode, int reg, RegisterID base, int offset)
+ {
+ m_buffer.ensureSpace(maxInstructionSize);
+ emitRexW(reg, 0, base);
+ m_buffer.putByteUnchecked(opcode);
+ memoryModRM_disp32(reg, base, offset);
+ }
+
+ void oneByteOp64(OneByteOpcodeID opcode, int reg, RegisterID base, RegisterID index, int scale, int offset)
+ {
+ m_buffer.ensureSpace(maxInstructionSize);
+ emitRexW(reg, index, base);
+ m_buffer.putByteUnchecked(opcode);
+ memoryModRM(reg, base, index, scale, offset);
+ }
+
+ void twoByteOp64(TwoByteOpcodeID opcode, int reg, RegisterID rm)
+ {
+ m_buffer.ensureSpace(maxInstructionSize);
+ emitRexW(reg, 0, rm);
+ m_buffer.putByteUnchecked(OP_2BYTE_ESCAPE);
+ m_buffer.putByteUnchecked(opcode);
+ registerModRM(reg, rm);
+ }
+#endif
+
+ // Byte-operands:
+ //
+ // These methods format byte operations. Byte operations differ from the normal
+ // formatters in the circumstances under which they will decide to emit REX prefixes.
+ // These should be used where any register operand signifies a byte register.
+ //
+ // The disctinction is due to the handling of register numbers in the range 4..7 on
+ // x86-64. These register numbers may either represent the second byte of the first
+ // four registers (ah..bh) or the first byte of the second four registers (spl..dil).
+ //
+ // Since ah..bh cannot be used in all permutations of operands (specifically cannot
+ // be accessed where a REX prefix is present), these are likely best treated as
+ // deprecated. In order to ensure the correct registers spl..dil are selected a
+ // REX prefix will be emitted for any byte register operand in the range 4..15.
+ //
+ // These formatters may be used in instructions where a mix of operand sizes, in which
+ // case an unnecessary REX will be emitted, for example:
+ // movzbl %al, %edi
+ // In this case a REX will be planted since edi is 7 (and were this a byte operand
+ // a REX would be required to specify dil instead of bh). Unneeded REX prefixes will
+ // be silently ignored by the processor.
+ //
+ // Address operands should still be checked using regRequiresRex(), while byteRegRequiresRex()
+ // is provided to check byte register operands.
+
+ void oneByteOp8(OneByteOpcodeID opcode, GroupOpcodeID groupOp, RegisterID rm)
+ {
+ m_buffer.ensureSpace(maxInstructionSize);
+ emitRexIf(byteRegRequiresRex(rm), 0, 0, rm);
+ m_buffer.putByteUnchecked(opcode);
+ registerModRM(groupOp, rm);
+ }
+
+ void twoByteOp8(TwoByteOpcodeID opcode, RegisterID reg, RegisterID rm)
+ {
+ m_buffer.ensureSpace(maxInstructionSize);
+ emitRexIf(byteRegRequiresRex(reg)|byteRegRequiresRex(rm), reg, 0, rm);
+ m_buffer.putByteUnchecked(OP_2BYTE_ESCAPE);
+ m_buffer.putByteUnchecked(opcode);
+ registerModRM(reg, rm);
+ }
+
+ void twoByteOp8(TwoByteOpcodeID opcode, GroupOpcodeID groupOp, RegisterID rm)
+ {
+ m_buffer.ensureSpace(maxInstructionSize);
+ emitRexIf(byteRegRequiresRex(rm), 0, 0, rm);
+ m_buffer.putByteUnchecked(OP_2BYTE_ESCAPE);
+ m_buffer.putByteUnchecked(opcode);
+ registerModRM(groupOp, rm);
+ }
+
+ // Immediates:
+ //
+ // An immedaite should be appended where appropriate after an op has been emitted.
+ // The writes are unchecked since the opcode formatters above will have ensured space.
+
+ void immediate8(int imm)
+ {
+ m_buffer.putByteUnchecked(imm);
+ }
+
+ void immediate16(int imm)
+ {
+ m_buffer.putShortUnchecked(imm);
+ }
+
+ void immediate32(int imm)
+ {
+ m_buffer.putIntUnchecked(imm);
+ }
+
+ void immediate64(int64_t imm)
+ {
+ m_buffer.putInt64Unchecked(imm);
+ }
+
+ JmpSrc immediateRel32()
+ {
+ m_buffer.putIntUnchecked(0);
+ return JmpSrc(m_buffer.size());
+ }
+
+ // Administrative methods:
+
+ size_t size() const { return m_buffer.size(); }
+ bool isAligned(int alignment) const { return m_buffer.isAligned(alignment); }
+ void* data() const { return m_buffer.data(); }
+ void* executableCopy(ExecutablePool* allocator) { return m_buffer.executableCopy(allocator); }
+
+ private:
+
+ // Internals; ModRm and REX formatters.
+
+ static const RegisterID noBase = X86Registers::ebp;
+ static const RegisterID hasSib = X86Registers::esp;
+ static const RegisterID noIndex = X86Registers::esp;
+#if CPU(X86_64)
+ static const RegisterID noBase2 = X86Registers::r13;
+ static const RegisterID hasSib2 = X86Registers::r12;
+
+ // Registers r8 & above require a REX prefixe.
+ inline bool regRequiresRex(int reg)
+ {
+ return (reg >= X86Registers::r8);
+ }
+
+ // Byte operand register spl & above require a REX prefix (to prevent the 'H' registers be accessed).
+ inline bool byteRegRequiresRex(int reg)
+ {
+ return (reg >= X86Registers::esp);
+ }
+
+ // Format a REX prefix byte.
+ inline void emitRex(bool w, int r, int x, int b)
+ {
+ m_buffer.putByteUnchecked(PRE_REX | ((int)w << 3) | ((r>>3)<<2) | ((x>>3)<<1) | (b>>3));
+ }
+
+ // Used to plant a REX byte with REX.w set (for 64-bit operations).
+ inline void emitRexW(int r, int x, int b)
+ {
+ emitRex(true, r, x, b);
+ }
+
+ // Used for operations with byte operands - use byteRegRequiresRex() to check register operands,
+ // regRequiresRex() to check other registers (i.e. address base & index).
+ inline void emitRexIf(bool condition, int r, int x, int b)
+ {
+ if (condition) emitRex(false, r, x, b);
+ }
+
+ // Used for word sized operations, will plant a REX prefix if necessary (if any register is r8 or above).
+ inline void emitRexIfNeeded(int r, int x, int b)
+ {
+ emitRexIf(regRequiresRex(r) || regRequiresRex(x) || regRequiresRex(b), r, x, b);
+ }
+#else
+ // No REX prefix bytes on 32-bit x86.
+ inline bool regRequiresRex(int) { return false; }
+ inline bool byteRegRequiresRex(int) { return false; }
+ inline void emitRexIf(bool, int, int, int) {}
+ inline void emitRexIfNeeded(int, int, int) {}
+#endif
+
+ enum ModRmMode {
+ ModRmMemoryNoDisp,
+ ModRmMemoryDisp8,
+ ModRmMemoryDisp32,
+ ModRmRegister,
+ };
+
+ void putModRm(ModRmMode mode, int reg, RegisterID rm)
+ {
+ m_buffer.putByteUnchecked((mode << 6) | ((reg & 7) << 3) | (rm & 7));
+ }
+
+ void putModRmSib(ModRmMode mode, int reg, RegisterID base, RegisterID index, int scale)
+ {
+ ASSERT(mode != ModRmRegister);
+
+ putModRm(mode, reg, hasSib);
+ m_buffer.putByteUnchecked((scale << 6) | ((index & 7) << 3) | (base & 7));
+ }
+
+ void registerModRM(int reg, RegisterID rm)
+ {
+ putModRm(ModRmRegister, reg, rm);
+ }
+
+ void memoryModRM(int reg, RegisterID base, int offset)
+ {
+ // A base of esp or r12 would be interpreted as a sib, so force a sib with no index & put the base in there.
+#if CPU(X86_64)
+ if ((base == hasSib) || (base == hasSib2)) {
+#else
+ if (base == hasSib) {
+#endif
+ if (!offset) // No need to check if the base is noBase, since we know it is hasSib!
+ putModRmSib(ModRmMemoryNoDisp, reg, base, noIndex, 0);
+ else if (CAN_SIGN_EXTEND_8_32(offset)) {
+ putModRmSib(ModRmMemoryDisp8, reg, base, noIndex, 0);
+ m_buffer.putByteUnchecked(offset);
+ } else {
+ putModRmSib(ModRmMemoryDisp32, reg, base, noIndex, 0);
+ m_buffer.putIntUnchecked(offset);
+ }
+ } else {
+#if CPU(X86_64)
+ if (!offset && (base != noBase) && (base != noBase2))
+#else
+ if (!offset && (base != noBase))
+#endif
+ putModRm(ModRmMemoryNoDisp, reg, base);
+ else if (CAN_SIGN_EXTEND_8_32(offset)) {
+ putModRm(ModRmMemoryDisp8, reg, base);
+ m_buffer.putByteUnchecked(offset);
+ } else {
+ putModRm(ModRmMemoryDisp32, reg, base);
+ m_buffer.putIntUnchecked(offset);
+ }
+ }
+ }
+
+ void memoryModRM_disp32(int reg, RegisterID base, int offset)
+ {
+ // A base of esp or r12 would be interpreted as a sib, so force a sib with no index & put the base in there.
+#if CPU(X86_64)
+ if ((base == hasSib) || (base == hasSib2)) {
+#else
+ if (base == hasSib) {
+#endif
+ putModRmSib(ModRmMemoryDisp32, reg, base, noIndex, 0);
+ m_buffer.putIntUnchecked(offset);
+ } else {
+ putModRm(ModRmMemoryDisp32, reg, base);
+ m_buffer.putIntUnchecked(offset);
+ }
+ }
+
+ void memoryModRM(int reg, RegisterID base, RegisterID index, int scale, int offset)
+ {
+ ASSERT(index != noIndex);
+
+#if CPU(X86_64)
+ if (!offset && (base != noBase) && (base != noBase2))
+#else
+ if (!offset && (base != noBase))
+#endif
+ putModRmSib(ModRmMemoryNoDisp, reg, base, index, scale);
+ else if (CAN_SIGN_EXTEND_8_32(offset)) {
+ putModRmSib(ModRmMemoryDisp8, reg, base, index, scale);
+ m_buffer.putByteUnchecked(offset);
+ } else {
+ putModRmSib(ModRmMemoryDisp32, reg, base, index, scale);
+ m_buffer.putIntUnchecked(offset);
+ }
+ }
+
+#if !CPU(X86_64)
+ void memoryModRM(int reg, const void* address)
+ {
+ // noBase + ModRmMemoryNoDisp means noBase + ModRmMemoryDisp32!
+ putModRm(ModRmMemoryNoDisp, reg, noBase);
+ m_buffer.putIntUnchecked(reinterpret_cast<int32_t>(address));
+ }
+#endif
+
+ AssemblerBuffer m_buffer;
+ } m_formatter;
+};
+
+} // namespace JSC
+
+#endif // ENABLE(ASSEMBLER) && CPU(X86)
+
+#endif // X86Assembler_h
diff --git a/Source/JavaScriptCore/bytecode/CodeBlock.cpp b/Source/JavaScriptCore/bytecode/CodeBlock.cpp
new file mode 100644
index 0000000..cbae990
--- /dev/null
+++ b/Source/JavaScriptCore/bytecode/CodeBlock.cpp
@@ -0,0 +1,1708 @@
+/*
+ * Copyright (C) 2008, 2009, 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2008 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "CodeBlock.h"
+
+#include "BytecodeGenerator.h"
+#include "Debugger.h"
+#include "Interpreter.h"
+#include "JIT.h"
+#include "JSActivation.h"
+#include "JSFunction.h"
+#include "JSStaticScopeObject.h"
+#include "JSValue.h"
+#include "UStringConcatenate.h"
+#include <stdio.h>
+#include <wtf/StringExtras.h>
+
+#define DUMP_CODE_BLOCK_STATISTICS 0
+
+namespace JSC {
+
+#if !defined(NDEBUG) || ENABLE(OPCODE_SAMPLING)
+
+static UString escapeQuotes(const UString& str)
+{
+ UString result = str;
+ size_t pos = 0;
+ while ((pos = result.find('\"', pos)) != notFound) {
+ result = makeUString(result.substringSharingImpl(0, pos), "\"\\\"\"", result.substringSharingImpl(pos + 1));
+ pos += 4;
+ }
+ return result;
+}
+
+static UString valueToSourceString(ExecState* exec, JSValue val)
+{
+ if (!val)
+ return "0";
+
+ if (val.isString())
+ return makeUString("\"", escapeQuotes(val.toString(exec)), "\"");
+
+ return val.toString(exec);
+}
+
+static CString constantName(ExecState* exec, int k, JSValue value)
+{
+ return makeUString(valueToSourceString(exec, value), "(@k", UString::number(k - FirstConstantRegisterIndex), ")").utf8();
+}
+
+static CString idName(int id0, const Identifier& ident)
+{
+ return makeUString(ident.ustring(), "(@id", UString::number(id0), ")").utf8();
+}
+
+CString CodeBlock::registerName(ExecState* exec, int r) const
+{
+ if (r == missingThisObjectMarker())
+ return "<null>";
+
+ if (isConstantRegisterIndex(r))
+ return constantName(exec, r, getConstant(r));
+
+ return makeUString("r", UString::number(r)).utf8();
+}
+
+static UString regexpToSourceString(RegExp* regExp)
+{
+ char postfix[5] = { '/', 0, 0, 0, 0 };
+ int index = 1;
+ if (regExp->global())
+ postfix[index++] = 'g';
+ if (regExp->ignoreCase())
+ postfix[index++] = 'i';
+ if (regExp->multiline())
+ postfix[index] = 'm';
+
+ return makeUString("/", regExp->pattern(), postfix);
+}
+
+static CString regexpName(int re, RegExp* regexp)
+{
+ return makeUString(regexpToSourceString(regexp), "(@re", UString::number(re), ")").utf8();
+}
+
+static UString pointerToSourceString(void* p)
+{
+ char buffer[2 + 2 * sizeof(void*) + 1]; // 0x [two characters per byte] \0
+ snprintf(buffer, sizeof(buffer), "%p", p);
+ return buffer;
+}
+
+NEVER_INLINE static const char* debugHookName(int debugHookID)
+{
+ switch (static_cast<DebugHookID>(debugHookID)) {
+ case DidEnterCallFrame:
+ return "didEnterCallFrame";
+ case WillLeaveCallFrame:
+ return "willLeaveCallFrame";
+ case WillExecuteStatement:
+ return "willExecuteStatement";
+ case WillExecuteProgram:
+ return "willExecuteProgram";
+ case DidExecuteProgram:
+ return "didExecuteProgram";
+ case DidReachBreakpoint:
+ return "didReachBreakpoint";
+ }
+
+ ASSERT_NOT_REACHED();
+ return "";
+}
+
+void CodeBlock::printUnaryOp(ExecState* exec, int location, Vector<Instruction>::const_iterator& it, const char* op) const
+{
+ int r0 = (++it)->u.operand;
+ int r1 = (++it)->u.operand;
+
+ printf("[%4d] %s\t\t %s, %s\n", location, op, registerName(exec, r0).data(), registerName(exec, r1).data());
+}
+
+void CodeBlock::printBinaryOp(ExecState* exec, int location, Vector<Instruction>::const_iterator& it, const char* op) const
+{
+ int r0 = (++it)->u.operand;
+ int r1 = (++it)->u.operand;
+ int r2 = (++it)->u.operand;
+ printf("[%4d] %s\t\t %s, %s, %s\n", location, op, registerName(exec, r0).data(), registerName(exec, r1).data(), registerName(exec, r2).data());
+}
+
+void CodeBlock::printConditionalJump(ExecState* exec, const Vector<Instruction>::const_iterator&, Vector<Instruction>::const_iterator& it, int location, const char* op) const
+{
+ int r0 = (++it)->u.operand;
+ int offset = (++it)->u.operand;
+ printf("[%4d] %s\t\t %s, %d(->%d)\n", location, op, registerName(exec, r0).data(), offset, location + offset);
+}
+
+void CodeBlock::printGetByIdOp(ExecState* exec, int location, Vector<Instruction>::const_iterator& it, const char* op) const
+{
+ int r0 = (++it)->u.operand;
+ int r1 = (++it)->u.operand;
+ int id0 = (++it)->u.operand;
+ printf("[%4d] %s\t %s, %s, %s\n", location, op, registerName(exec, r0).data(), registerName(exec, r1).data(), idName(id0, m_identifiers[id0]).data());
+ it += 4;
+}
+
+void CodeBlock::printPutByIdOp(ExecState* exec, int location, Vector<Instruction>::const_iterator& it, const char* op) const
+{
+ int r0 = (++it)->u.operand;
+ int id0 = (++it)->u.operand;
+ int r1 = (++it)->u.operand;
+ printf("[%4d] %s\t %s, %s, %s\n", location, op, registerName(exec, r0).data(), idName(id0, m_identifiers[id0]).data(), registerName(exec, r1).data());
+ it += 5;
+}
+
+#if ENABLE(JIT)
+static bool isGlobalResolve(OpcodeID opcodeID)
+{
+ return opcodeID == op_resolve_global || opcodeID == op_resolve_global_dynamic;
+}
+
+static bool isPropertyAccess(OpcodeID opcodeID)
+{
+ switch (opcodeID) {
+ case op_get_by_id_self:
+ case op_get_by_id_proto:
+ case op_get_by_id_chain:
+ case op_get_by_id_self_list:
+ case op_get_by_id_proto_list:
+ case op_put_by_id_transition:
+ case op_put_by_id_replace:
+ case op_get_by_id:
+ case op_put_by_id:
+ case op_get_by_id_generic:
+ case op_put_by_id_generic:
+ case op_get_array_length:
+ case op_get_string_length:
+ return true;
+ default:
+ return false;
+ }
+}
+
+static unsigned instructionOffsetForNth(ExecState* exec, const Vector<Instruction>& instructions, int nth, bool (*predicate)(OpcodeID))
+{
+ size_t i = 0;
+ while (i < instructions.size()) {
+ OpcodeID currentOpcode = exec->interpreter()->getOpcodeID(instructions[i].u.opcode);
+ if (predicate(currentOpcode)) {
+ if (!--nth)
+ return i;
+ }
+ i += opcodeLengths[currentOpcode];
+ }
+
+ ASSERT_NOT_REACHED();
+ return 0;
+}
+
+static void printGlobalResolveInfo(const GlobalResolveInfo& resolveInfo, unsigned instructionOffset)
+{
+ printf(" [%4d] %s: %s\n", instructionOffset, "resolve_global", pointerToSourceString(resolveInfo.structure).utf8().data());
+}
+
+static void printStructureStubInfo(const StructureStubInfo& stubInfo, unsigned instructionOffset)
+{
+ switch (stubInfo.accessType) {
+ case access_get_by_id_self:
+ printf(" [%4d] %s: %s\n", instructionOffset, "get_by_id_self", pointerToSourceString(stubInfo.u.getByIdSelf.baseObjectStructure).utf8().data());
+ return;
+ case access_get_by_id_proto:
+ printf(" [%4d] %s: %s, %s\n", instructionOffset, "get_by_id_proto", pointerToSourceString(stubInfo.u.getByIdProto.baseObjectStructure).utf8().data(), pointerToSourceString(stubInfo.u.getByIdProto.prototypeStructure).utf8().data());
+ return;
+ case access_get_by_id_chain:
+ printf(" [%4d] %s: %s, %s\n", instructionOffset, "get_by_id_chain", pointerToSourceString(stubInfo.u.getByIdChain.baseObjectStructure).utf8().data(), pointerToSourceString(stubInfo.u.getByIdChain.chain).utf8().data());
+ return;
+ case access_get_by_id_self_list:
+ printf(" [%4d] %s: %s (%d)\n", instructionOffset, "op_get_by_id_self_list", pointerToSourceString(stubInfo.u.getByIdSelfList.structureList).utf8().data(), stubInfo.u.getByIdSelfList.listSize);
+ return;
+ case access_get_by_id_proto_list:
+ printf(" [%4d] %s: %s (%d)\n", instructionOffset, "op_get_by_id_proto_list", pointerToSourceString(stubInfo.u.getByIdProtoList.structureList).utf8().data(), stubInfo.u.getByIdProtoList.listSize);
+ return;
+ case access_put_by_id_transition:
+ printf(" [%4d] %s: %s, %s, %s\n", instructionOffset, "put_by_id_transition", pointerToSourceString(stubInfo.u.putByIdTransition.previousStructure).utf8().data(), pointerToSourceString(stubInfo.u.putByIdTransition.structure).utf8().data(), pointerToSourceString(stubInfo.u.putByIdTransition.chain).utf8().data());
+ return;
+ case access_put_by_id_replace:
+ printf(" [%4d] %s: %s\n", instructionOffset, "put_by_id_replace", pointerToSourceString(stubInfo.u.putByIdReplace.baseObjectStructure).utf8().data());
+ return;
+ case access_get_by_id:
+ printf(" [%4d] %s\n", instructionOffset, "get_by_id");
+ return;
+ case access_put_by_id:
+ printf(" [%4d] %s\n", instructionOffset, "put_by_id");
+ return;
+ case access_get_by_id_generic:
+ printf(" [%4d] %s\n", instructionOffset, "op_get_by_id_generic");
+ return;
+ case access_put_by_id_generic:
+ printf(" [%4d] %s\n", instructionOffset, "op_put_by_id_generic");
+ return;
+ case access_get_array_length:
+ printf(" [%4d] %s\n", instructionOffset, "op_get_array_length");
+ return;
+ case access_get_string_length:
+ printf(" [%4d] %s\n", instructionOffset, "op_get_string_length");
+ return;
+ default:
+ ASSERT_NOT_REACHED();
+ }
+}
+#endif
+
+void CodeBlock::printStructure(const char* name, const Instruction* vPC, int operand) const
+{
+ unsigned instructionOffset = vPC - m_instructions.begin();
+ printf(" [%4d] %s: %s\n", instructionOffset, name, pointerToSourceString(vPC[operand].u.structure).utf8().data());
+}
+
+void CodeBlock::printStructures(const Instruction* vPC) const
+{
+ Interpreter* interpreter = m_globalData->interpreter;
+ unsigned instructionOffset = vPC - m_instructions.begin();
+
+ if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id)) {
+ printStructure("get_by_id", vPC, 4);
+ return;
+ }
+ if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_self)) {
+ printStructure("get_by_id_self", vPC, 4);
+ return;
+ }
+ if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_proto)) {
+ printf(" [%4d] %s: %s, %s\n", instructionOffset, "get_by_id_proto", pointerToSourceString(vPC[4].u.structure).utf8().data(), pointerToSourceString(vPC[5].u.structure).utf8().data());
+ return;
+ }
+ if (vPC[0].u.opcode == interpreter->getOpcode(op_put_by_id_transition)) {
+ printf(" [%4d] %s: %s, %s, %s\n", instructionOffset, "put_by_id_transition", pointerToSourceString(vPC[4].u.structure).utf8().data(), pointerToSourceString(vPC[5].u.structure).utf8().data(), pointerToSourceString(vPC[6].u.structureChain).utf8().data());
+ return;
+ }
+ if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_chain)) {
+ printf(" [%4d] %s: %s, %s\n", instructionOffset, "get_by_id_chain", pointerToSourceString(vPC[4].u.structure).utf8().data(), pointerToSourceString(vPC[5].u.structureChain).utf8().data());
+ return;
+ }
+ if (vPC[0].u.opcode == interpreter->getOpcode(op_put_by_id)) {
+ printStructure("put_by_id", vPC, 4);
+ return;
+ }
+ if (vPC[0].u.opcode == interpreter->getOpcode(op_put_by_id_replace)) {
+ printStructure("put_by_id_replace", vPC, 4);
+ return;
+ }
+ if (vPC[0].u.opcode == interpreter->getOpcode(op_resolve_global)) {
+ printStructure("resolve_global", vPC, 4);
+ return;
+ }
+ if (vPC[0].u.opcode == interpreter->getOpcode(op_resolve_global_dynamic)) {
+ printStructure("resolve_global_dynamic", vPC, 4);
+ return;
+ }
+
+ // These m_instructions doesn't ref Structures.
+ ASSERT(vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_generic) || vPC[0].u.opcode == interpreter->getOpcode(op_put_by_id_generic) || vPC[0].u.opcode == interpreter->getOpcode(op_call) || vPC[0].u.opcode == interpreter->getOpcode(op_call_eval) || vPC[0].u.opcode == interpreter->getOpcode(op_construct));
+}
+
+void CodeBlock::dump(ExecState* exec) const
+{
+ if (m_instructions.isEmpty()) {
+ printf("No instructions available.\n");
+ return;
+ }
+
+ size_t instructionCount = 0;
+
+ for (size_t i = 0; i < m_instructions.size(); i += opcodeLengths[exec->interpreter()->getOpcodeID(m_instructions[i].u.opcode)])
+ ++instructionCount;
+
+ printf("%lu m_instructions; %lu bytes at %p; %d parameter(s); %d callee register(s)\n\n",
+ static_cast<unsigned long>(instructionCount),
+ static_cast<unsigned long>(m_instructions.size() * sizeof(Instruction)),
+ this, m_numParameters, m_numCalleeRegisters);
+
+ Vector<Instruction>::const_iterator begin = m_instructions.begin();
+ Vector<Instruction>::const_iterator end = m_instructions.end();
+ for (Vector<Instruction>::const_iterator it = begin; it != end; ++it)
+ dump(exec, begin, it);
+
+ if (!m_identifiers.isEmpty()) {
+ printf("\nIdentifiers:\n");
+ size_t i = 0;
+ do {
+ printf(" id%u = %s\n", static_cast<unsigned>(i), m_identifiers[i].ustring().utf8().data());
+ ++i;
+ } while (i != m_identifiers.size());
+ }
+
+ if (!m_constantRegisters.isEmpty()) {
+ printf("\nConstants:\n");
+ unsigned registerIndex = m_numVars;
+ size_t i = 0;
+ do {
+ printf(" k%u = %s\n", registerIndex, valueToSourceString(exec, m_constantRegisters[i].jsValue()).utf8().data());
+ ++i;
+ ++registerIndex;
+ } while (i < m_constantRegisters.size());
+ }
+
+ if (m_rareData && !m_rareData->m_regexps.isEmpty()) {
+ printf("\nm_regexps:\n");
+ size_t i = 0;
+ do {
+ printf(" re%u = %s\n", static_cast<unsigned>(i), regexpToSourceString(m_rareData->m_regexps[i].get()).utf8().data());
+ ++i;
+ } while (i < m_rareData->m_regexps.size());
+ }
+
+#if ENABLE(JIT)
+ if (!m_globalResolveInfos.isEmpty() || !m_structureStubInfos.isEmpty())
+ printf("\nStructures:\n");
+
+ if (!m_globalResolveInfos.isEmpty()) {
+ size_t i = 0;
+ do {
+ printGlobalResolveInfo(m_globalResolveInfos[i], instructionOffsetForNth(exec, m_instructions, i + 1, isGlobalResolve));
+ ++i;
+ } while (i < m_globalResolveInfos.size());
+ }
+ if (!m_structureStubInfos.isEmpty()) {
+ size_t i = 0;
+ do {
+ printStructureStubInfo(m_structureStubInfos[i], instructionOffsetForNth(exec, m_instructions, i + 1, isPropertyAccess));
+ ++i;
+ } while (i < m_structureStubInfos.size());
+ }
+#else
+ if (!m_globalResolveInstructions.isEmpty() || !m_propertyAccessInstructions.isEmpty())
+ printf("\nStructures:\n");
+
+ if (!m_globalResolveInstructions.isEmpty()) {
+ size_t i = 0;
+ do {
+ printStructures(&m_instructions[m_globalResolveInstructions[i]]);
+ ++i;
+ } while (i < m_globalResolveInstructions.size());
+ }
+ if (!m_propertyAccessInstructions.isEmpty()) {
+ size_t i = 0;
+ do {
+ printStructures(&m_instructions[m_propertyAccessInstructions[i]]);
+ ++i;
+ } while (i < m_propertyAccessInstructions.size());
+ }
+#endif
+
+ if (m_rareData && !m_rareData->m_exceptionHandlers.isEmpty()) {
+ printf("\nException Handlers:\n");
+ unsigned i = 0;
+ do {
+ printf("\t %d: { start: [%4d] end: [%4d] target: [%4d] }\n", i + 1, m_rareData->m_exceptionHandlers[i].start, m_rareData->m_exceptionHandlers[i].end, m_rareData->m_exceptionHandlers[i].target);
+ ++i;
+ } while (i < m_rareData->m_exceptionHandlers.size());
+ }
+
+ if (m_rareData && !m_rareData->m_immediateSwitchJumpTables.isEmpty()) {
+ printf("Immediate Switch Jump Tables:\n");
+ unsigned i = 0;
+ do {
+ printf(" %1d = {\n", i);
+ int entry = 0;
+ Vector<int32_t>::const_iterator end = m_rareData->m_immediateSwitchJumpTables[i].branchOffsets.end();
+ for (Vector<int32_t>::const_iterator iter = m_rareData->m_immediateSwitchJumpTables[i].branchOffsets.begin(); iter != end; ++iter, ++entry) {
+ if (!*iter)
+ continue;
+ printf("\t\t%4d => %04d\n", entry + m_rareData->m_immediateSwitchJumpTables[i].min, *iter);
+ }
+ printf(" }\n");
+ ++i;
+ } while (i < m_rareData->m_immediateSwitchJumpTables.size());
+ }
+
+ if (m_rareData && !m_rareData->m_characterSwitchJumpTables.isEmpty()) {
+ printf("\nCharacter Switch Jump Tables:\n");
+ unsigned i = 0;
+ do {
+ printf(" %1d = {\n", i);
+ int entry = 0;
+ Vector<int32_t>::const_iterator end = m_rareData->m_characterSwitchJumpTables[i].branchOffsets.end();
+ for (Vector<int32_t>::const_iterator iter = m_rareData->m_characterSwitchJumpTables[i].branchOffsets.begin(); iter != end; ++iter, ++entry) {
+ if (!*iter)
+ continue;
+ ASSERT(!((i + m_rareData->m_characterSwitchJumpTables[i].min) & ~0xFFFF));
+ UChar ch = static_cast<UChar>(entry + m_rareData->m_characterSwitchJumpTables[i].min);
+ printf("\t\t\"%s\" => %04d\n", UString(&ch, 1).utf8().data(), *iter);
+ }
+ printf(" }\n");
+ ++i;
+ } while (i < m_rareData->m_characterSwitchJumpTables.size());
+ }
+
+ if (m_rareData && !m_rareData->m_stringSwitchJumpTables.isEmpty()) {
+ printf("\nString Switch Jump Tables:\n");
+ unsigned i = 0;
+ do {
+ printf(" %1d = {\n", i);
+ StringJumpTable::StringOffsetTable::const_iterator end = m_rareData->m_stringSwitchJumpTables[i].offsetTable.end();
+ for (StringJumpTable::StringOffsetTable::const_iterator iter = m_rareData->m_stringSwitchJumpTables[i].offsetTable.begin(); iter != end; ++iter)
+ printf("\t\t\"%s\" => %04d\n", UString(iter->first).utf8().data(), iter->second.branchOffset);
+ printf(" }\n");
+ ++i;
+ } while (i < m_rareData->m_stringSwitchJumpTables.size());
+ }
+
+ printf("\n");
+}
+
+void CodeBlock::dump(ExecState* exec, const Vector<Instruction>::const_iterator& begin, Vector<Instruction>::const_iterator& it) const
+{
+ int location = it - begin;
+ switch (exec->interpreter()->getOpcodeID(it->u.opcode)) {
+ case op_enter: {
+ printf("[%4d] enter\n", location);
+ break;
+ }
+ case op_create_activation: {
+ int r0 = (++it)->u.operand;
+ printf("[%4d] create_activation %s\n", location, registerName(exec, r0).data());
+ break;
+ }
+ case op_create_arguments: {
+ int r0 = (++it)->u.operand;
+ printf("[%4d] create_arguments\t %s\n", location, registerName(exec, r0).data());
+ break;
+ }
+ case op_init_lazy_reg: {
+ int r0 = (++it)->u.operand;
+ printf("[%4d] init_lazy_reg\t %s\n", location, registerName(exec, r0).data());
+ break;
+ }
+ case op_get_callee: {
+ int r0 = (++it)->u.operand;
+ printf("[%4d] op_get_callee %s\n", location, registerName(exec, r0).data());
+ break;
+ }
+ case op_create_this: {
+ int r0 = (++it)->u.operand;
+ int r1 = (++it)->u.operand;
+ printf("[%4d] create_this %s %s\n", location, registerName(exec, r0).data(), registerName(exec, r1).data());
+ break;
+ }
+ case op_convert_this: {
+ int r0 = (++it)->u.operand;
+ printf("[%4d] convert_this %s\n", location, registerName(exec, r0).data());
+ break;
+ }
+ case op_convert_this_strict: {
+ int r0 = (++it)->u.operand;
+ printf("[%4d] convert_this_strict %s\n", location, registerName(exec, r0).data());
+ break;
+ }
+ case op_new_object: {
+ int r0 = (++it)->u.operand;
+ printf("[%4d] new_object\t %s\n", location, registerName(exec, r0).data());
+ break;
+ }
+ case op_new_array: {
+ int dst = (++it)->u.operand;
+ int argv = (++it)->u.operand;
+ int argc = (++it)->u.operand;
+ printf("[%4d] new_array\t %s, %s, %d\n", location, registerName(exec, dst).data(), registerName(exec, argv).data(), argc);
+ break;
+ }
+ case op_new_regexp: {
+ int r0 = (++it)->u.operand;
+ int re0 = (++it)->u.operand;
+ printf("[%4d] new_regexp\t %s, %s\n", location, registerName(exec, r0).data(), regexpName(re0, regexp(re0)).data());
+ break;
+ }
+ case op_mov: {
+ int r0 = (++it)->u.operand;
+ int r1 = (++it)->u.operand;
+ printf("[%4d] mov\t\t %s, %s\n", location, registerName(exec, r0).data(), registerName(exec, r1).data());
+ break;
+ }
+ case op_not: {
+ printUnaryOp(exec, location, it, "not");
+ break;
+ }
+ case op_eq: {
+ printBinaryOp(exec, location, it, "eq");
+ break;
+ }
+ case op_eq_null: {
+ printUnaryOp(exec, location, it, "eq_null");
+ break;
+ }
+ case op_neq: {
+ printBinaryOp(exec, location, it, "neq");
+ break;
+ }
+ case op_neq_null: {
+ printUnaryOp(exec, location, it, "neq_null");
+ break;
+ }
+ case op_stricteq: {
+ printBinaryOp(exec, location, it, "stricteq");
+ break;
+ }
+ case op_nstricteq: {
+ printBinaryOp(exec, location, it, "nstricteq");
+ break;
+ }
+ case op_less: {
+ printBinaryOp(exec, location, it, "less");
+ break;
+ }
+ case op_lesseq: {
+ printBinaryOp(exec, location, it, "lesseq");
+ break;
+ }
+ case op_pre_inc: {
+ int r0 = (++it)->u.operand;
+ printf("[%4d] pre_inc\t\t %s\n", location, registerName(exec, r0).data());
+ break;
+ }
+ case op_pre_dec: {
+ int r0 = (++it)->u.operand;
+ printf("[%4d] pre_dec\t\t %s\n", location, registerName(exec, r0).data());
+ break;
+ }
+ case op_post_inc: {
+ printUnaryOp(exec, location, it, "post_inc");
+ break;
+ }
+ case op_post_dec: {
+ printUnaryOp(exec, location, it, "post_dec");
+ break;
+ }
+ case op_to_jsnumber: {
+ printUnaryOp(exec, location, it, "to_jsnumber");
+ break;
+ }
+ case op_negate: {
+ printUnaryOp(exec, location, it, "negate");
+ break;
+ }
+ case op_add: {
+ printBinaryOp(exec, location, it, "add");
+ ++it;
+ break;
+ }
+ case op_mul: {
+ printBinaryOp(exec, location, it, "mul");
+ ++it;
+ break;
+ }
+ case op_div: {
+ printBinaryOp(exec, location, it, "div");
+ ++it;
+ break;
+ }
+ case op_mod: {
+ printBinaryOp(exec, location, it, "mod");
+ break;
+ }
+ case op_sub: {
+ printBinaryOp(exec, location, it, "sub");
+ ++it;
+ break;
+ }
+ case op_lshift: {
+ printBinaryOp(exec, location, it, "lshift");
+ break;
+ }
+ case op_rshift: {
+ printBinaryOp(exec, location, it, "rshift");
+ break;
+ }
+ case op_urshift: {
+ printBinaryOp(exec, location, it, "urshift");
+ break;
+ }
+ case op_bitand: {
+ printBinaryOp(exec, location, it, "bitand");
+ ++it;
+ break;
+ }
+ case op_bitxor: {
+ printBinaryOp(exec, location, it, "bitxor");
+ ++it;
+ break;
+ }
+ case op_bitor: {
+ printBinaryOp(exec, location, it, "bitor");
+ ++it;
+ break;
+ }
+ case op_bitnot: {
+ printUnaryOp(exec, location, it, "bitnot");
+ break;
+ }
+ case op_check_has_instance: {
+ int base = (++it)->u.operand;
+ printf("[%4d] check_has_instance\t\t %s\n", location, registerName(exec, base).data());
+ break;
+ }
+ case op_instanceof: {
+ int r0 = (++it)->u.operand;
+ int r1 = (++it)->u.operand;
+ int r2 = (++it)->u.operand;
+ int r3 = (++it)->u.operand;
+ printf("[%4d] instanceof\t\t %s, %s, %s, %s\n", location, registerName(exec, r0).data(), registerName(exec, r1).data(), registerName(exec, r2).data(), registerName(exec, r3).data());
+ break;
+ }
+ case op_typeof: {
+ printUnaryOp(exec, location, it, "typeof");
+ break;
+ }
+ case op_is_undefined: {
+ printUnaryOp(exec, location, it, "is_undefined");
+ break;
+ }
+ case op_is_boolean: {
+ printUnaryOp(exec, location, it, "is_boolean");
+ break;
+ }
+ case op_is_number: {
+ printUnaryOp(exec, location, it, "is_number");
+ break;
+ }
+ case op_is_string: {
+ printUnaryOp(exec, location, it, "is_string");
+ break;
+ }
+ case op_is_object: {
+ printUnaryOp(exec, location, it, "is_object");
+ break;
+ }
+ case op_is_function: {
+ printUnaryOp(exec, location, it, "is_function");
+ break;
+ }
+ case op_in: {
+ printBinaryOp(exec, location, it, "in");
+ break;
+ }
+ case op_resolve: {
+ int r0 = (++it)->u.operand;
+ int id0 = (++it)->u.operand;
+ printf("[%4d] resolve\t\t %s, %s\n", location, registerName(exec, r0).data(), idName(id0, m_identifiers[id0]).data());
+ break;
+ }
+ case op_resolve_skip: {
+ int r0 = (++it)->u.operand;
+ int id0 = (++it)->u.operand;
+ int skipLevels = (++it)->u.operand;
+ printf("[%4d] resolve_skip\t %s, %s, %d\n", location, registerName(exec, r0).data(), idName(id0, m_identifiers[id0]).data(), skipLevels);
+ break;
+ }
+ case op_resolve_global: {
+ int r0 = (++it)->u.operand;
+ int id0 = (++it)->u.operand;
+ printf("[%4d] resolve_global\t %s, %s\n", location, registerName(exec, r0).data(), idName(id0, m_identifiers[id0]).data());
+ it += 2;
+ break;
+ }
+ case op_resolve_global_dynamic: {
+ int r0 = (++it)->u.operand;
+ int id0 = (++it)->u.operand;
+ JSValue scope = JSValue((++it)->u.jsCell);
+ ++it;
+ int depth = (++it)->u.operand;
+ printf("[%4d] resolve_global_dynamic\t %s, %s, %s, %d\n", location, registerName(exec, r0).data(), valueToSourceString(exec, scope).utf8().data(), idName(id0, m_identifiers[id0]).data(), depth);
+ break;
+ }
+ case op_get_scoped_var: {
+ int r0 = (++it)->u.operand;
+ int index = (++it)->u.operand;
+ int skipLevels = (++it)->u.operand;
+ printf("[%4d] get_scoped_var\t %s, %d, %d\n", location, registerName(exec, r0).data(), index, skipLevels);
+ break;
+ }
+ case op_put_scoped_var: {
+ int index = (++it)->u.operand;
+ int skipLevels = (++it)->u.operand;
+ int r0 = (++it)->u.operand;
+ printf("[%4d] put_scoped_var\t %d, %d, %s\n", location, index, skipLevels, registerName(exec, r0).data());
+ break;
+ }
+ case op_get_global_var: {
+ int r0 = (++it)->u.operand;
+ int index = (++it)->u.operand;
+ printf("[%4d] get_global_var\t %s, %d\n", location, registerName(exec, r0).data(), index);
+ break;
+ }
+ case op_put_global_var: {
+ int index = (++it)->u.operand;
+ int r0 = (++it)->u.operand;
+ printf("[%4d] put_global_var\t %d, %s\n", location, index, registerName(exec, r0).data());
+ break;
+ }
+ case op_resolve_base: {
+ int r0 = (++it)->u.operand;
+ int id0 = (++it)->u.operand;
+ int isStrict = (++it)->u.operand;
+ printf("[%4d] resolve_base%s\t %s, %s\n", location, isStrict ? "_strict" : "", registerName(exec, r0).data(), idName(id0, m_identifiers[id0]).data());
+ break;
+ }
+ case op_ensure_property_exists: {
+ int r0 = (++it)->u.operand;
+ int id0 = (++it)->u.operand;
+ printf("[%4d] ensure_property_exists\t %s, %s\n", location, registerName(exec, r0).data(), idName(id0, m_identifiers[id0]).data());
+ break;
+ }
+ case op_resolve_with_base: {
+ int r0 = (++it)->u.operand;
+ int r1 = (++it)->u.operand;
+ int id0 = (++it)->u.operand;
+ printf("[%4d] resolve_with_base %s, %s, %s\n", location, registerName(exec, r0).data(), registerName(exec, r1).data(), idName(id0, m_identifiers[id0]).data());
+ break;
+ }
+ case op_get_by_id: {
+ printGetByIdOp(exec, location, it, "get_by_id");
+ break;
+ }
+ case op_get_by_id_self: {
+ printGetByIdOp(exec, location, it, "get_by_id_self");
+ break;
+ }
+ case op_get_by_id_self_list: {
+ printGetByIdOp(exec, location, it, "get_by_id_self_list");
+ break;
+ }
+ case op_get_by_id_proto: {
+ printGetByIdOp(exec, location, it, "get_by_id_proto");
+ break;
+ }
+ case op_get_by_id_proto_list: {
+ printGetByIdOp(exec, location, it, "op_get_by_id_proto_list");
+ break;
+ }
+ case op_get_by_id_chain: {
+ printGetByIdOp(exec, location, it, "get_by_id_chain");
+ break;
+ }
+ case op_get_by_id_getter_self: {
+ printGetByIdOp(exec, location, it, "get_by_id_getter_self");
+ break;
+ }
+ case op_get_by_id_getter_self_list: {
+ printGetByIdOp(exec, location, it, "get_by_id_getter_self_list");
+ break;
+ }
+ case op_get_by_id_getter_proto: {
+ printGetByIdOp(exec, location, it, "get_by_id_getter_proto");
+ break;
+ }
+ case op_get_by_id_getter_proto_list: {
+ printGetByIdOp(exec, location, it, "get_by_id_getter_proto_list");
+ break;
+ }
+ case op_get_by_id_getter_chain: {
+ printGetByIdOp(exec, location, it, "get_by_id_getter_chain");
+ break;
+ }
+ case op_get_by_id_custom_self: {
+ printGetByIdOp(exec, location, it, "get_by_id_custom_self");
+ break;
+ }
+ case op_get_by_id_custom_self_list: {
+ printGetByIdOp(exec, location, it, "get_by_id_custom_self_list");
+ break;
+ }
+ case op_get_by_id_custom_proto: {
+ printGetByIdOp(exec, location, it, "get_by_id_custom_proto");
+ break;
+ }
+ case op_get_by_id_custom_proto_list: {
+ printGetByIdOp(exec, location, it, "get_by_id_custom_proto_list");
+ break;
+ }
+ case op_get_by_id_custom_chain: {
+ printGetByIdOp(exec, location, it, "get_by_id_custom_chain");
+ break;
+ }
+ case op_get_by_id_generic: {
+ printGetByIdOp(exec, location, it, "get_by_id_generic");
+ break;
+ }
+ case op_get_array_length: {
+ printGetByIdOp(exec, location, it, "get_array_length");
+ break;
+ }
+ case op_get_string_length: {
+ printGetByIdOp(exec, location, it, "get_string_length");
+ break;
+ }
+ case op_get_arguments_length: {
+ printUnaryOp(exec, location, it, "get_arguments_length");
+ it++;
+ break;
+ }
+ case op_put_by_id: {
+ printPutByIdOp(exec, location, it, "put_by_id");
+ break;
+ }
+ case op_put_by_id_replace: {
+ printPutByIdOp(exec, location, it, "put_by_id_replace");
+ break;
+ }
+ case op_put_by_id_transition: {
+ printPutByIdOp(exec, location, it, "put_by_id_transition");
+ break;
+ }
+ case op_put_by_id_generic: {
+ printPutByIdOp(exec, location, it, "put_by_id_generic");
+ break;
+ }
+ case op_put_getter: {
+ int r0 = (++it)->u.operand;
+ int id0 = (++it)->u.operand;
+ int r1 = (++it)->u.operand;
+ printf("[%4d] put_getter\t %s, %s, %s\n", location, registerName(exec, r0).data(), idName(id0, m_identifiers[id0]).data(), registerName(exec, r1).data());
+ break;
+ }
+ case op_put_setter: {
+ int r0 = (++it)->u.operand;
+ int id0 = (++it)->u.operand;
+ int r1 = (++it)->u.operand;
+ printf("[%4d] put_setter\t %s, %s, %s\n", location, registerName(exec, r0).data(), idName(id0, m_identifiers[id0]).data(), registerName(exec, r1).data());
+ break;
+ }
+ case op_method_check: {
+ printf("[%4d] method_check\n", location);
+ break;
+ }
+ case op_del_by_id: {
+ int r0 = (++it)->u.operand;
+ int r1 = (++it)->u.operand;
+ int id0 = (++it)->u.operand;
+ printf("[%4d] del_by_id\t %s, %s, %s\n", location, registerName(exec, r0).data(), registerName(exec, r1).data(), idName(id0, m_identifiers[id0]).data());
+ break;
+ }
+ case op_get_by_val: {
+ int r0 = (++it)->u.operand;
+ int r1 = (++it)->u.operand;
+ int r2 = (++it)->u.operand;
+ printf("[%4d] get_by_val\t %s, %s, %s\n", location, registerName(exec, r0).data(), registerName(exec, r1).data(), registerName(exec, r2).data());
+ break;
+ }
+ case op_get_argument_by_val: {
+ int r0 = (++it)->u.operand;
+ int r1 = (++it)->u.operand;
+ int r2 = (++it)->u.operand;
+ printf("[%4d] get_argument_by_val\t %s, %s, %s\n", location, registerName(exec, r0).data(), registerName(exec, r1).data(), registerName(exec, r2).data());
+ break;
+ }
+ case op_get_by_pname: {
+ int r0 = (++it)->u.operand;
+ int r1 = (++it)->u.operand;
+ int r2 = (++it)->u.operand;
+ int r3 = (++it)->u.operand;
+ int r4 = (++it)->u.operand;
+ int r5 = (++it)->u.operand;
+ printf("[%4d] get_by_pname\t %s, %s, %s, %s, %s, %s\n", location, registerName(exec, r0).data(), registerName(exec, r1).data(), registerName(exec, r2).data(), registerName(exec, r3).data(), registerName(exec, r4).data(), registerName(exec, r5).data());
+ break;
+ }
+ case op_put_by_val: {
+ int r0 = (++it)->u.operand;
+ int r1 = (++it)->u.operand;
+ int r2 = (++it)->u.operand;
+ printf("[%4d] put_by_val\t %s, %s, %s\n", location, registerName(exec, r0).data(), registerName(exec, r1).data(), registerName(exec, r2).data());
+ break;
+ }
+ case op_del_by_val: {
+ int r0 = (++it)->u.operand;
+ int r1 = (++it)->u.operand;
+ int r2 = (++it)->u.operand;
+ printf("[%4d] del_by_val\t %s, %s, %s\n", location, registerName(exec, r0).data(), registerName(exec, r1).data(), registerName(exec, r2).data());
+ break;
+ }
+ case op_put_by_index: {
+ int r0 = (++it)->u.operand;
+ unsigned n0 = (++it)->u.operand;
+ int r1 = (++it)->u.operand;
+ printf("[%4d] put_by_index\t %s, %u, %s\n", location, registerName(exec, r0).data(), n0, registerName(exec, r1).data());
+ break;
+ }
+ case op_jmp: {
+ int offset = (++it)->u.operand;
+ printf("[%4d] jmp\t\t %d(->%d)\n", location, offset, location + offset);
+ break;
+ }
+ case op_loop: {
+ int offset = (++it)->u.operand;
+ printf("[%4d] loop\t\t %d(->%d)\n", location, offset, location + offset);
+ break;
+ }
+ case op_jtrue: {
+ printConditionalJump(exec, begin, it, location, "jtrue");
+ break;
+ }
+ case op_loop_if_true: {
+ printConditionalJump(exec, begin, it, location, "loop_if_true");
+ break;
+ }
+ case op_loop_if_false: {
+ printConditionalJump(exec, begin, it, location, "loop_if_false");
+ break;
+ }
+ case op_jfalse: {
+ printConditionalJump(exec, begin, it, location, "jfalse");
+ break;
+ }
+ case op_jeq_null: {
+ printConditionalJump(exec, begin, it, location, "jeq_null");
+ break;
+ }
+ case op_jneq_null: {
+ printConditionalJump(exec, begin, it, location, "jneq_null");
+ break;
+ }
+ case op_jneq_ptr: {
+ int r0 = (++it)->u.operand;
+ int r1 = (++it)->u.operand;
+ int offset = (++it)->u.operand;
+ printf("[%4d] jneq_ptr\t\t %s, %s, %d(->%d)\n", location, registerName(exec, r0).data(), registerName(exec, r1).data(), offset, location + offset);
+ break;
+ }
+ case op_jnless: {
+ int r0 = (++it)->u.operand;
+ int r1 = (++it)->u.operand;
+ int offset = (++it)->u.operand;
+ printf("[%4d] jnless\t\t %s, %s, %d(->%d)\n", location, registerName(exec, r0).data(), registerName(exec, r1).data(), offset, location + offset);
+ break;
+ }
+ case op_jnlesseq: {
+ int r0 = (++it)->u.operand;
+ int r1 = (++it)->u.operand;
+ int offset = (++it)->u.operand;
+ printf("[%4d] jnlesseq\t\t %s, %s, %d(->%d)\n", location, registerName(exec, r0).data(), registerName(exec, r1).data(), offset, location + offset);
+ break;
+ }
+ case op_loop_if_less: {
+ int r0 = (++it)->u.operand;
+ int r1 = (++it)->u.operand;
+ int offset = (++it)->u.operand;
+ printf("[%4d] loop_if_less\t %s, %s, %d(->%d)\n", location, registerName(exec, r0).data(), registerName(exec, r1).data(), offset, location + offset);
+ break;
+ }
+ case op_jless: {
+ int r0 = (++it)->u.operand;
+ int r1 = (++it)->u.operand;
+ int offset = (++it)->u.operand;
+ printf("[%4d] jless\t\t %s, %s, %d(->%d)\n", location, registerName(exec, r0).data(), registerName(exec, r1).data(), offset, location + offset);
+ break;
+ }
+ case op_jlesseq: {
+ int r0 = (++it)->u.operand;
+ int r1 = (++it)->u.operand;
+ int offset = (++it)->u.operand;
+ printf("[%4d] jlesseq\t\t %s, %s, %d(->%d)\n", location, registerName(exec, r0).data(), registerName(exec, r1).data(), offset, location + offset);
+ break;
+ }
+ case op_loop_if_lesseq: {
+ int r0 = (++it)->u.operand;
+ int r1 = (++it)->u.operand;
+ int offset = (++it)->u.operand;
+ printf("[%4d] loop_if_lesseq\t %s, %s, %d(->%d)\n", location, registerName(exec, r0).data(), registerName(exec, r1).data(), offset, location + offset);
+ break;
+ }
+ case op_switch_imm: {
+ int tableIndex = (++it)->u.operand;
+ int defaultTarget = (++it)->u.operand;
+ int scrutineeRegister = (++it)->u.operand;
+ printf("[%4d] switch_imm\t %d, %d(->%d), %s\n", location, tableIndex, defaultTarget, location + defaultTarget, registerName(exec, scrutineeRegister).data());
+ break;
+ }
+ case op_switch_char: {
+ int tableIndex = (++it)->u.operand;
+ int defaultTarget = (++it)->u.operand;
+ int scrutineeRegister = (++it)->u.operand;
+ printf("[%4d] switch_char\t %d, %d(->%d), %s\n", location, tableIndex, defaultTarget, location + defaultTarget, registerName(exec, scrutineeRegister).data());
+ break;
+ }
+ case op_switch_string: {
+ int tableIndex = (++it)->u.operand;
+ int defaultTarget = (++it)->u.operand;
+ int scrutineeRegister = (++it)->u.operand;
+ printf("[%4d] switch_string\t %d, %d(->%d), %s\n", location, tableIndex, defaultTarget, location + defaultTarget, registerName(exec, scrutineeRegister).data());
+ break;
+ }
+ case op_new_func: {
+ int r0 = (++it)->u.operand;
+ int f0 = (++it)->u.operand;
+ int shouldCheck = (++it)->u.operand;
+ printf("[%4d] new_func\t\t %s, f%d, %s\n", location, registerName(exec, r0).data(), f0, shouldCheck ? "<Checked>" : "<Unchecked>");
+ break;
+ }
+ case op_new_func_exp: {
+ int r0 = (++it)->u.operand;
+ int f0 = (++it)->u.operand;
+ printf("[%4d] new_func_exp\t %s, f%d\n", location, registerName(exec, r0).data(), f0);
+ break;
+ }
+ case op_call: {
+ int func = (++it)->u.operand;
+ int argCount = (++it)->u.operand;
+ int registerOffset = (++it)->u.operand;
+ printf("[%4d] call\t\t %s, %d, %d\n", location, registerName(exec, func).data(), argCount, registerOffset);
+ break;
+ }
+ case op_call_eval: {
+ int func = (++it)->u.operand;
+ int argCount = (++it)->u.operand;
+ int registerOffset = (++it)->u.operand;
+ printf("[%4d] call_eval\t %s, %d, %d\n", location, registerName(exec, func).data(), argCount, registerOffset);
+ break;
+ }
+ case op_call_varargs: {
+ int func = (++it)->u.operand;
+ int argCount = (++it)->u.operand;
+ int registerOffset = (++it)->u.operand;
+ printf("[%4d] call_varargs\t %s, %s, %d\n", location, registerName(exec, func).data(), registerName(exec, argCount).data(), registerOffset);
+ break;
+ }
+ case op_load_varargs: {
+ printUnaryOp(exec, location, it, "load_varargs");
+ break;
+ }
+ case op_tear_off_activation: {
+ int r0 = (++it)->u.operand;
+ int r1 = (++it)->u.operand;
+ printf("[%4d] tear_off_activation\t %s, %s\n", location, registerName(exec, r0).data(), registerName(exec, r1).data());
+ break;
+ }
+ case op_tear_off_arguments: {
+ int r0 = (++it)->u.operand;
+ printf("[%4d] tear_off_arguments\t %s\n", location, registerName(exec, r0).data());
+ break;
+ }
+ case op_ret: {
+ int r0 = (++it)->u.operand;
+ printf("[%4d] ret\t\t %s\n", location, registerName(exec, r0).data());
+ break;
+ }
+ case op_call_put_result: {
+ int r0 = (++it)->u.operand;
+ printf("[%4d] op_call_put_result\t\t %s\n", location, registerName(exec, r0).data());
+ break;
+ }
+ case op_ret_object_or_this: {
+ int r0 = (++it)->u.operand;
+ int r1 = (++it)->u.operand;
+ printf("[%4d] constructor_ret\t\t %s %s\n", location, registerName(exec, r0).data(), registerName(exec, r1).data());
+ break;
+ }
+ case op_construct: {
+ int func = (++it)->u.operand;
+ int argCount = (++it)->u.operand;
+ int registerOffset = (++it)->u.operand;
+ printf("[%4d] construct\t %s, %d, %d\n", location, registerName(exec, func).data(), argCount, registerOffset);
+ break;
+ }
+ case op_strcat: {
+ int r0 = (++it)->u.operand;
+ int r1 = (++it)->u.operand;
+ int count = (++it)->u.operand;
+ printf("[%4d] strcat\t\t %s, %s, %d\n", location, registerName(exec, r0).data(), registerName(exec, r1).data(), count);
+ break;
+ }
+ case op_to_primitive: {
+ int r0 = (++it)->u.operand;
+ int r1 = (++it)->u.operand;
+ printf("[%4d] to_primitive\t %s, %s\n", location, registerName(exec, r0).data(), registerName(exec, r1).data());
+ break;
+ }
+ case op_get_pnames: {
+ int r0 = it[1].u.operand;
+ int r1 = it[2].u.operand;
+ int r2 = it[3].u.operand;
+ int r3 = it[4].u.operand;
+ int offset = it[5].u.operand;
+ printf("[%4d] get_pnames\t %s, %s, %s, %s, %d(->%d)\n", location, registerName(exec, r0).data(), registerName(exec, r1).data(), registerName(exec, r2).data(), registerName(exec, r3).data(), offset, location + offset);
+ it += OPCODE_LENGTH(op_get_pnames) - 1;
+ break;
+ }
+ case op_next_pname: {
+ int dest = it[1].u.operand;
+ int base = it[2].u.operand;
+ int i = it[3].u.operand;
+ int size = it[4].u.operand;
+ int iter = it[5].u.operand;
+ int offset = it[6].u.operand;
+ printf("[%4d] next_pname\t %s, %s, %s, %s, %s, %d(->%d)\n", location, registerName(exec, dest).data(), registerName(exec, base).data(), registerName(exec, i).data(), registerName(exec, size).data(), registerName(exec, iter).data(), offset, location + offset);
+ it += OPCODE_LENGTH(op_next_pname) - 1;
+ break;
+ }
+ case op_push_scope: {
+ int r0 = (++it)->u.operand;
+ printf("[%4d] push_scope\t %s\n", location, registerName(exec, r0).data());
+ break;
+ }
+ case op_pop_scope: {
+ printf("[%4d] pop_scope\n", location);
+ break;
+ }
+ case op_push_new_scope: {
+ int r0 = (++it)->u.operand;
+ int id0 = (++it)->u.operand;
+ int r1 = (++it)->u.operand;
+ printf("[%4d] push_new_scope \t%s, %s, %s\n", location, registerName(exec, r0).data(), idName(id0, m_identifiers[id0]).data(), registerName(exec, r1).data());
+ break;
+ }
+ case op_jmp_scopes: {
+ int scopeDelta = (++it)->u.operand;
+ int offset = (++it)->u.operand;
+ printf("[%4d] jmp_scopes\t^%d, %d(->%d)\n", location, scopeDelta, offset, location + offset);
+ break;
+ }
+ case op_catch: {
+ int r0 = (++it)->u.operand;
+ printf("[%4d] catch\t\t %s\n", location, registerName(exec, r0).data());
+ break;
+ }
+ case op_throw: {
+ int r0 = (++it)->u.operand;
+ printf("[%4d] throw\t\t %s\n", location, registerName(exec, r0).data());
+ break;
+ }
+ case op_throw_reference_error: {
+ int k0 = (++it)->u.operand;
+ printf("[%4d] throw_reference_error\t %s\n", location, constantName(exec, k0, getConstant(k0)).data());
+ break;
+ }
+ case op_throw_syntax_error: {
+ int k0 = (++it)->u.operand;
+ printf("[%4d] throw_syntax_error\t %s\n", location, constantName(exec, k0, getConstant(k0)).data());
+ break;
+ }
+ case op_jsr: {
+ int retAddrDst = (++it)->u.operand;
+ int offset = (++it)->u.operand;
+ printf("[%4d] jsr\t\t %s, %d(->%d)\n", location, registerName(exec, retAddrDst).data(), offset, location + offset);
+ break;
+ }
+ case op_sret: {
+ int retAddrSrc = (++it)->u.operand;
+ printf("[%4d] sret\t\t %s\n", location, registerName(exec, retAddrSrc).data());
+ break;
+ }
+ case op_debug: {
+ int debugHookID = (++it)->u.operand;
+ int firstLine = (++it)->u.operand;
+ int lastLine = (++it)->u.operand;
+ printf("[%4d] debug\t\t %s, %d, %d\n", location, debugHookName(debugHookID), firstLine, lastLine);
+ break;
+ }
+ case op_profile_will_call: {
+ int function = (++it)->u.operand;
+ printf("[%4d] profile_will_call %s\n", location, registerName(exec, function).data());
+ break;
+ }
+ case op_profile_did_call: {
+ int function = (++it)->u.operand;
+ printf("[%4d] profile_did_call\t %s\n", location, registerName(exec, function).data());
+ break;
+ }
+ case op_end: {
+ int r0 = (++it)->u.operand;
+ printf("[%4d] end\t\t %s\n", location, registerName(exec, r0).data());
+ break;
+ }
+ }
+}
+
+#endif // !defined(NDEBUG) || ENABLE(OPCODE_SAMPLING)
+
+#if DUMP_CODE_BLOCK_STATISTICS
+static HashSet<CodeBlock*> liveCodeBlockSet;
+#endif
+
+#define FOR_EACH_MEMBER_VECTOR(macro) \
+ macro(instructions) \
+ macro(globalResolveInfos) \
+ macro(structureStubInfos) \
+ macro(callLinkInfos) \
+ macro(linkedCallerList) \
+ macro(identifiers) \
+ macro(functionExpressions) \
+ macro(constantRegisters)
+
+#define FOR_EACH_MEMBER_VECTOR_RARE_DATA(macro) \
+ macro(regexps) \
+ macro(functions) \
+ macro(exceptionHandlers) \
+ macro(immediateSwitchJumpTables) \
+ macro(characterSwitchJumpTables) \
+ macro(stringSwitchJumpTables) \
+ macro(evalCodeCache) \
+ macro(expressionInfo) \
+ macro(lineInfo) \
+ macro(callReturnIndexVector)
+
+template<typename T>
+static size_t sizeInBytes(const Vector<T>& vector)
+{
+ return vector.capacity() * sizeof(T);
+}
+
+void CodeBlock::dumpStatistics()
+{
+#if DUMP_CODE_BLOCK_STATISTICS
+ #define DEFINE_VARS(name) size_t name##IsNotEmpty = 0; size_t name##TotalSize = 0;
+ FOR_EACH_MEMBER_VECTOR(DEFINE_VARS)
+ FOR_EACH_MEMBER_VECTOR_RARE_DATA(DEFINE_VARS)
+ #undef DEFINE_VARS
+
+ // Non-vector data members
+ size_t evalCodeCacheIsNotEmpty = 0;
+
+ size_t symbolTableIsNotEmpty = 0;
+ size_t symbolTableTotalSize = 0;
+
+ size_t hasRareData = 0;
+
+ size_t isFunctionCode = 0;
+ size_t isGlobalCode = 0;
+ size_t isEvalCode = 0;
+
+ HashSet<CodeBlock*>::const_iterator end = liveCodeBlockSet.end();
+ for (HashSet<CodeBlock*>::const_iterator it = liveCodeBlockSet.begin(); it != end; ++it) {
+ CodeBlock* codeBlock = *it;
+
+ #define GET_STATS(name) if (!codeBlock->m_##name.isEmpty()) { name##IsNotEmpty++; name##TotalSize += sizeInBytes(codeBlock->m_##name); }
+ FOR_EACH_MEMBER_VECTOR(GET_STATS)
+ #undef GET_STATS
+
+ if (!codeBlock->m_symbolTable.isEmpty()) {
+ symbolTableIsNotEmpty++;
+ symbolTableTotalSize += (codeBlock->m_symbolTable.capacity() * (sizeof(SymbolTable::KeyType) + sizeof(SymbolTable::MappedType)));
+ }
+
+ if (codeBlock->m_rareData) {
+ hasRareData++;
+ #define GET_STATS(name) if (!codeBlock->m_rareData->m_##name.isEmpty()) { name##IsNotEmpty++; name##TotalSize += sizeInBytes(codeBlock->m_rareData->m_##name); }
+ FOR_EACH_MEMBER_VECTOR_RARE_DATA(GET_STATS)
+ #undef GET_STATS
+
+ if (!codeBlock->m_rareData->m_evalCodeCache.isEmpty())
+ evalCodeCacheIsNotEmpty++;
+ }
+
+ switch (codeBlock->codeType()) {
+ case FunctionCode:
+ ++isFunctionCode;
+ break;
+ case GlobalCode:
+ ++isGlobalCode;
+ break;
+ case EvalCode:
+ ++isEvalCode;
+ break;
+ }
+ }
+
+ size_t totalSize = 0;
+
+ #define GET_TOTAL_SIZE(name) totalSize += name##TotalSize;
+ FOR_EACH_MEMBER_VECTOR(GET_TOTAL_SIZE)
+ FOR_EACH_MEMBER_VECTOR_RARE_DATA(GET_TOTAL_SIZE)
+ #undef GET_TOTAL_SIZE
+
+ totalSize += symbolTableTotalSize;
+ totalSize += (liveCodeBlockSet.size() * sizeof(CodeBlock));
+
+ printf("Number of live CodeBlocks: %d\n", liveCodeBlockSet.size());
+ printf("Size of a single CodeBlock [sizeof(CodeBlock)]: %zu\n", sizeof(CodeBlock));
+ printf("Size of all CodeBlocks: %zu\n", totalSize);
+ printf("Average size of a CodeBlock: %zu\n", totalSize / liveCodeBlockSet.size());
+
+ printf("Number of FunctionCode CodeBlocks: %zu (%.3f%%)\n", isFunctionCode, static_cast<double>(isFunctionCode) * 100.0 / liveCodeBlockSet.size());
+ printf("Number of GlobalCode CodeBlocks: %zu (%.3f%%)\n", isGlobalCode, static_cast<double>(isGlobalCode) * 100.0 / liveCodeBlockSet.size());
+ printf("Number of EvalCode CodeBlocks: %zu (%.3f%%)\n", isEvalCode, static_cast<double>(isEvalCode) * 100.0 / liveCodeBlockSet.size());
+
+ printf("Number of CodeBlocks with rare data: %zu (%.3f%%)\n", hasRareData, static_cast<double>(hasRareData) * 100.0 / liveCodeBlockSet.size());
+
+ #define PRINT_STATS(name) printf("Number of CodeBlocks with " #name ": %zu\n", name##IsNotEmpty); printf("Size of all " #name ": %zu\n", name##TotalSize);
+ FOR_EACH_MEMBER_VECTOR(PRINT_STATS)
+ FOR_EACH_MEMBER_VECTOR_RARE_DATA(PRINT_STATS)
+ #undef PRINT_STATS
+
+ printf("Number of CodeBlocks with evalCodeCache: %zu\n", evalCodeCacheIsNotEmpty);
+ printf("Number of CodeBlocks with symbolTable: %zu\n", symbolTableIsNotEmpty);
+
+ printf("Size of all symbolTables: %zu\n", symbolTableTotalSize);
+
+#else
+ printf("Dumping CodeBlock statistics is not enabled.\n");
+#endif
+}
+
+CodeBlock::CodeBlock(ScriptExecutable* ownerExecutable, CodeType codeType, JSGlobalObject *globalObject, PassRefPtr<SourceProvider> sourceProvider, unsigned sourceOffset, SymbolTable* symTab, bool isConstructor)
+ : m_globalObject(globalObject)
+ , m_numCalleeRegisters(0)
+ , m_numVars(0)
+ , m_numParameters(0)
+ , m_isConstructor(isConstructor)
+ , m_ownerExecutable(ownerExecutable)
+ , m_globalData(0)
+#ifndef NDEBUG
+ , m_instructionCount(0)
+#endif
+ , m_argumentsRegister(-1)
+ , m_needsFullScopeChain(ownerExecutable->needsActivation())
+ , m_usesEval(ownerExecutable->usesEval())
+ , m_isNumericCompareFunction(false)
+ , m_isStrictMode(ownerExecutable->isStrictMode())
+ , m_codeType(codeType)
+ , m_source(sourceProvider)
+ , m_sourceOffset(sourceOffset)
+ , m_symbolTable(symTab)
+{
+ ASSERT(m_source);
+
+#if DUMP_CODE_BLOCK_STATISTICS
+ liveCodeBlockSet.add(this);
+#endif
+}
+
+CodeBlock::~CodeBlock()
+{
+#if ENABLE(INTERPRETER)
+ for (size_t size = m_globalResolveInstructions.size(), i = 0; i < size; ++i)
+ derefStructures(&m_instructions[m_globalResolveInstructions[i]]);
+
+ for (size_t size = m_propertyAccessInstructions.size(), i = 0; i < size; ++i)
+ derefStructures(&m_instructions[m_propertyAccessInstructions[i]]);
+#endif
+#if ENABLE(JIT)
+ for (size_t size = m_globalResolveInfos.size(), i = 0; i < size; ++i) {
+ if (m_globalResolveInfos[i].structure)
+ m_globalResolveInfos[i].structure->deref();
+ }
+
+ for (size_t size = m_structureStubInfos.size(), i = 0; i < size; ++i)
+ m_structureStubInfos[i].deref();
+
+ for (size_t size = m_callLinkInfos.size(), i = 0; i < size; ++i) {
+ CallLinkInfo* callLinkInfo = &m_callLinkInfos[i];
+ if (callLinkInfo->isLinked())
+ callLinkInfo->callee->removeCaller(callLinkInfo);
+ }
+
+ for (size_t size = m_methodCallLinkInfos.size(), i = 0; i < size; ++i) {
+ if (Structure* structure = m_methodCallLinkInfos[i].cachedStructure) {
+ structure->deref();
+ // Both members must be filled at the same time
+ ASSERT(!!m_methodCallLinkInfos[i].cachedPrototypeStructure);
+ m_methodCallLinkInfos[i].cachedPrototypeStructure->deref();
+ }
+ }
+
+#if ENABLE(JIT_OPTIMIZE_CALL)
+ unlinkCallers();
+#endif
+
+#endif // ENABLE(JIT)
+
+#if DUMP_CODE_BLOCK_STATISTICS
+ liveCodeBlockSet.remove(this);
+#endif
+}
+
+#if ENABLE(JIT_OPTIMIZE_CALL)
+void CodeBlock::unlinkCallers()
+{
+ size_t size = m_linkedCallerList.size();
+ for (size_t i = 0; i < size; ++i) {
+ CallLinkInfo* currentCaller = m_linkedCallerList[i];
+ JIT::unlinkCallOrConstruct(currentCaller);
+ currentCaller->setUnlinked();
+ }
+ m_linkedCallerList.clear();
+}
+#endif
+
+void CodeBlock::derefStructures(Instruction* vPC) const
+{
+ Interpreter* interpreter = m_globalData->interpreter;
+
+ if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_self) || vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_getter_self) || vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_custom_self)) {
+ vPC[4].u.structure->deref();
+ return;
+ }
+ if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_proto) || vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_getter_proto) || vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_custom_proto)) {
+ vPC[4].u.structure->deref();
+ vPC[5].u.structure->deref();
+ return;
+ }
+ if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_chain) || vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_getter_chain) || vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_custom_chain)) {
+ vPC[4].u.structure->deref();
+ vPC[5].u.structureChain->deref();
+ return;
+ }
+ if (vPC[0].u.opcode == interpreter->getOpcode(op_put_by_id_transition)) {
+ vPC[4].u.structure->deref();
+ vPC[5].u.structure->deref();
+ vPC[6].u.structureChain->deref();
+ return;
+ }
+ if (vPC[0].u.opcode == interpreter->getOpcode(op_put_by_id_replace)) {
+ vPC[4].u.structure->deref();
+ return;
+ }
+ if (vPC[0].u.opcode == interpreter->getOpcode(op_resolve_global) || vPC[0].u.opcode == interpreter->getOpcode(op_resolve_global_dynamic)) {
+ if (vPC[3].u.structure)
+ vPC[3].u.structure->deref();
+ return;
+ }
+ if ((vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_proto_list))
+ || (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_self_list))
+ || (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_getter_proto_list))
+ || (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_getter_self_list))
+ || (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_custom_proto_list))
+ || (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_custom_self_list))) {
+ PolymorphicAccessStructureList* polymorphicStructures = vPC[4].u.polymorphicStructures;
+ polymorphicStructures->derefStructures(vPC[5].u.operand);
+ delete polymorphicStructures;
+ return;
+ }
+
+ // These instructions don't ref their Structures.
+ ASSERT(vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id) || vPC[0].u.opcode == interpreter->getOpcode(op_put_by_id) || vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_generic) || vPC[0].u.opcode == interpreter->getOpcode(op_put_by_id_generic) || vPC[0].u.opcode == interpreter->getOpcode(op_get_array_length) || vPC[0].u.opcode == interpreter->getOpcode(op_get_string_length));
+}
+
+void CodeBlock::refStructures(Instruction* vPC) const
+{
+ Interpreter* interpreter = m_globalData->interpreter;
+
+ if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_self) || vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_getter_self) || vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_custom_self)) {
+ vPC[4].u.structure->ref();
+ return;
+ }
+ if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_proto) || vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_getter_proto) || vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_custom_proto)) {
+ vPC[4].u.structure->ref();
+ vPC[5].u.structure->ref();
+ return;
+ }
+ if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_chain) || vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_getter_chain) || vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_custom_chain)) {
+ vPC[4].u.structure->ref();
+ vPC[5].u.structureChain->ref();
+ return;
+ }
+ if (vPC[0].u.opcode == interpreter->getOpcode(op_put_by_id_transition)) {
+ vPC[4].u.structure->ref();
+ vPC[5].u.structure->ref();
+ vPC[6].u.structureChain->ref();
+ return;
+ }
+ if (vPC[0].u.opcode == interpreter->getOpcode(op_put_by_id_replace)) {
+ vPC[4].u.structure->ref();
+ return;
+ }
+
+ // These instructions don't ref their Structures.
+ ASSERT(vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id) || vPC[0].u.opcode == interpreter->getOpcode(op_put_by_id) || vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_generic) || vPC[0].u.opcode == interpreter->getOpcode(op_put_by_id_generic));
+}
+
+void CodeBlock::markAggregate(MarkStack& markStack)
+{
+ for (size_t i = 0; i < m_constantRegisters.size(); ++i)
+ markStack.append(m_constantRegisters[i].jsValue());
+ for (size_t i = 0; i < m_functionExprs.size(); ++i)
+ m_functionExprs[i]->markAggregate(markStack);
+ for (size_t i = 0; i < m_functionDecls.size(); ++i)
+ m_functionDecls[i]->markAggregate(markStack);
+ markStack.append(m_globalObject);
+}
+
+HandlerInfo* CodeBlock::handlerForBytecodeOffset(unsigned bytecodeOffset)
+{
+ ASSERT(bytecodeOffset < m_instructionCount);
+
+ if (!m_rareData)
+ return 0;
+
+ Vector<HandlerInfo>& exceptionHandlers = m_rareData->m_exceptionHandlers;
+ for (size_t i = 0; i < exceptionHandlers.size(); ++i) {
+ // Handlers are ordered innermost first, so the first handler we encounter
+ // that contains the source address is the correct handler to use.
+ if (exceptionHandlers[i].start <= bytecodeOffset && exceptionHandlers[i].end >= bytecodeOffset)
+ return &exceptionHandlers[i];
+ }
+
+ return 0;
+}
+
+int CodeBlock::lineNumberForBytecodeOffset(unsigned bytecodeOffset)
+{
+ ASSERT(bytecodeOffset < m_instructionCount);
+
+ if (!m_rareData)
+ return m_ownerExecutable->source().firstLine();
+
+ Vector<LineInfo>& lineInfo = m_rareData->m_lineInfo;
+
+ int low = 0;
+ int high = lineInfo.size();
+ while (low < high) {
+ int mid = low + (high - low) / 2;
+ if (lineInfo[mid].instructionOffset <= bytecodeOffset)
+ low = mid + 1;
+ else
+ high = mid;
+ }
+
+ if (!low)
+ return m_ownerExecutable->source().firstLine();
+ return lineInfo[low - 1].lineNumber;
+}
+
+void CodeBlock::expressionRangeForBytecodeOffset(unsigned bytecodeOffset, int& divot, int& startOffset, int& endOffset)
+{
+ ASSERT(bytecodeOffset < m_instructionCount);
+
+ if (!m_rareData) {
+ startOffset = 0;
+ endOffset = 0;
+ divot = 0;
+ return;
+ }
+
+ Vector<ExpressionRangeInfo>& expressionInfo = m_rareData->m_expressionInfo;
+
+ int low = 0;
+ int high = expressionInfo.size();
+ while (low < high) {
+ int mid = low + (high - low) / 2;
+ if (expressionInfo[mid].instructionOffset <= bytecodeOffset)
+ low = mid + 1;
+ else
+ high = mid;
+ }
+
+ ASSERT(low);
+ if (!low) {
+ startOffset = 0;
+ endOffset = 0;
+ divot = 0;
+ return;
+ }
+
+ startOffset = expressionInfo[low - 1].startOffset;
+ endOffset = expressionInfo[low - 1].endOffset;
+ divot = expressionInfo[low - 1].divotPoint + m_sourceOffset;
+ return;
+}
+
+#if ENABLE(INTERPRETER)
+bool CodeBlock::hasGlobalResolveInstructionAtBytecodeOffset(unsigned bytecodeOffset)
+{
+ if (m_globalResolveInstructions.isEmpty())
+ return false;
+
+ int low = 0;
+ int high = m_globalResolveInstructions.size();
+ while (low < high) {
+ int mid = low + (high - low) / 2;
+ if (m_globalResolveInstructions[mid] <= bytecodeOffset)
+ low = mid + 1;
+ else
+ high = mid;
+ }
+
+ if (!low || m_globalResolveInstructions[low - 1] != bytecodeOffset)
+ return false;
+ return true;
+}
+#endif
+#if ENABLE(JIT)
+bool CodeBlock::hasGlobalResolveInfoAtBytecodeOffset(unsigned bytecodeOffset)
+{
+ if (m_globalResolveInfos.isEmpty())
+ return false;
+
+ int low = 0;
+ int high = m_globalResolveInfos.size();
+ while (low < high) {
+ int mid = low + (high - low) / 2;
+ if (m_globalResolveInfos[mid].bytecodeOffset <= bytecodeOffset)
+ low = mid + 1;
+ else
+ high = mid;
+ }
+
+ if (!low || m_globalResolveInfos[low - 1].bytecodeOffset != bytecodeOffset)
+ return false;
+ return true;
+}
+#endif
+
+void CodeBlock::shrinkToFit()
+{
+ m_instructions.shrinkToFit();
+
+#if ENABLE(INTERPRETER)
+ m_propertyAccessInstructions.shrinkToFit();
+ m_globalResolveInstructions.shrinkToFit();
+#endif
+#if ENABLE(JIT)
+ m_structureStubInfos.shrinkToFit();
+ m_globalResolveInfos.shrinkToFit();
+ m_callLinkInfos.shrinkToFit();
+ m_linkedCallerList.shrinkToFit();
+#endif
+
+ m_identifiers.shrinkToFit();
+ m_functionDecls.shrinkToFit();
+ m_functionExprs.shrinkToFit();
+ m_constantRegisters.shrinkToFit();
+
+ if (m_rareData) {
+ m_rareData->m_exceptionHandlers.shrinkToFit();
+ m_rareData->m_regexps.shrinkToFit();
+ m_rareData->m_immediateSwitchJumpTables.shrinkToFit();
+ m_rareData->m_characterSwitchJumpTables.shrinkToFit();
+ m_rareData->m_stringSwitchJumpTables.shrinkToFit();
+ m_rareData->m_expressionInfo.shrinkToFit();
+ m_rareData->m_lineInfo.shrinkToFit();
+ }
+}
+
+void CodeBlock::createActivation(CallFrame* callFrame)
+{
+ ASSERT(codeType() == FunctionCode);
+ ASSERT(needsFullScopeChain());
+ ASSERT(!callFrame->uncheckedR(activationRegister()).jsValue());
+ JSActivation* activation = new (callFrame) JSActivation(callFrame, static_cast<FunctionExecutable*>(ownerExecutable()));
+ callFrame->uncheckedR(activationRegister()) = JSValue(activation);
+ callFrame->setScopeChain(callFrame->scopeChain()->copy()->push(activation));
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/bytecode/CodeBlock.h b/Source/JavaScriptCore/bytecode/CodeBlock.h
new file mode 100644
index 0000000..7eca72a
--- /dev/null
+++ b/Source/JavaScriptCore/bytecode/CodeBlock.h
@@ -0,0 +1,691 @@
+/*
+ * Copyright (C) 2008, 2009, 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2008 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CodeBlock_h
+#define CodeBlock_h
+
+#include "EvalCodeCache.h"
+#include "Instruction.h"
+#include "JITCode.h"
+#include "JSGlobalObject.h"
+#include "JumpTable.h"
+#include "Nodes.h"
+#include "RegExp.h"
+#include "UString.h"
+#include <wtf/FastAllocBase.h>
+#include <wtf/PassOwnPtr.h>
+#include <wtf/RefPtr.h>
+#include <wtf/Vector.h>
+
+#if ENABLE(JIT)
+#include "StructureStubInfo.h"
+#endif
+
+// Register numbers used in bytecode operations have different meaning according to their ranges:
+// 0x80000000-0xFFFFFFFF Negative indices from the CallFrame pointer are entries in the call frame, see RegisterFile.h.
+// 0x00000000-0x3FFFFFFF Forwards indices from the CallFrame pointer are local vars and temporaries with the function's callframe.
+// 0x40000000-0x7FFFFFFF Positive indices from 0x40000000 specify entries in the constant pool on the CodeBlock.
+static const int FirstConstantRegisterIndex = 0x40000000;
+
+namespace JSC {
+
+ enum HasSeenShouldRepatch {
+ hasSeenShouldRepatch
+ };
+
+ class ExecState;
+
+ enum CodeType { GlobalCode, EvalCode, FunctionCode };
+
+ inline int unmodifiedArgumentsRegister(int argumentsRegister) { return argumentsRegister - 1; }
+
+ static ALWAYS_INLINE int missingThisObjectMarker() { return std::numeric_limits<int>::max(); }
+
+ struct HandlerInfo {
+ uint32_t start;
+ uint32_t end;
+ uint32_t target;
+ uint32_t scopeDepth;
+#if ENABLE(JIT)
+ CodeLocationLabel nativeCode;
+#endif
+ };
+
+ struct ExpressionRangeInfo {
+ enum {
+ MaxOffset = (1 << 7) - 1,
+ MaxDivot = (1 << 25) - 1
+ };
+ uint32_t instructionOffset : 25;
+ uint32_t divotPoint : 25;
+ uint32_t startOffset : 7;
+ uint32_t endOffset : 7;
+ };
+
+ struct LineInfo {
+ uint32_t instructionOffset;
+ int32_t lineNumber;
+ };
+
+#if ENABLE(JIT)
+ struct CallLinkInfo {
+ CallLinkInfo()
+ : callee(0)
+ , position(0)
+ , hasSeenShouldRepatch(0)
+ {
+ }
+
+ CodeLocationNearCall callReturnLocation;
+ CodeLocationDataLabelPtr hotPathBegin;
+ CodeLocationNearCall hotPathOther;
+ CodeBlock* ownerCodeBlock;
+ CodeBlock* callee;
+ unsigned position : 31;
+ unsigned hasSeenShouldRepatch : 1;
+
+ void setUnlinked() { callee = 0; }
+ bool isLinked() { return callee; }
+
+ bool seenOnce()
+ {
+ return hasSeenShouldRepatch;
+ }
+
+ void setSeen()
+ {
+ hasSeenShouldRepatch = true;
+ }
+ };
+
+ struct MethodCallLinkInfo {
+ MethodCallLinkInfo()
+ : cachedStructure(0)
+ , cachedPrototypeStructure(0)
+ {
+ }
+
+ bool seenOnce()
+ {
+ ASSERT(!cachedStructure);
+ return cachedPrototypeStructure;
+ }
+
+ void setSeen()
+ {
+ ASSERT(!cachedStructure && !cachedPrototypeStructure);
+ // We use the values of cachedStructure & cachedPrototypeStructure to indicate the
+ // current state.
+ // - In the initial state, both are null.
+ // - Once this transition has been taken once, cachedStructure is
+ // null and cachedPrototypeStructure is set to a nun-null value.
+ // - Once the call is linked both structures are set to non-null values.
+ cachedPrototypeStructure = (Structure*)1;
+ }
+
+ CodeLocationCall callReturnLocation;
+ CodeLocationDataLabelPtr structureLabel;
+ Structure* cachedStructure;
+ Structure* cachedPrototypeStructure;
+ };
+
+ struct GlobalResolveInfo {
+ GlobalResolveInfo(unsigned bytecodeOffset)
+ : structure(0)
+ , offset(0)
+ , bytecodeOffset(bytecodeOffset)
+ {
+ }
+
+ Structure* structure;
+ unsigned offset;
+ unsigned bytecodeOffset;
+ };
+
+ // This structure is used to map from a call return location
+ // (given as an offset in bytes into the JIT code) back to
+ // the bytecode index of the corresponding bytecode operation.
+ // This is then used to look up the corresponding handler.
+ struct CallReturnOffsetToBytecodeOffset {
+ CallReturnOffsetToBytecodeOffset(unsigned callReturnOffset, unsigned bytecodeOffset)
+ : callReturnOffset(callReturnOffset)
+ , bytecodeOffset(bytecodeOffset)
+ {
+ }
+
+ unsigned callReturnOffset;
+ unsigned bytecodeOffset;
+ };
+
+ // valueAtPosition helpers for the binaryChop algorithm below.
+
+ inline void* getStructureStubInfoReturnLocation(StructureStubInfo* structureStubInfo)
+ {
+ return structureStubInfo->callReturnLocation.executableAddress();
+ }
+
+ inline void* getCallLinkInfoReturnLocation(CallLinkInfo* callLinkInfo)
+ {
+ return callLinkInfo->callReturnLocation.executableAddress();
+ }
+
+ inline void* getMethodCallLinkInfoReturnLocation(MethodCallLinkInfo* methodCallLinkInfo)
+ {
+ return methodCallLinkInfo->callReturnLocation.executableAddress();
+ }
+
+ inline unsigned getCallReturnOffset(CallReturnOffsetToBytecodeOffset* pc)
+ {
+ return pc->callReturnOffset;
+ }
+
+ // Binary chop algorithm, calls valueAtPosition on pre-sorted elements in array,
+ // compares result with key (KeyTypes should be comparable with '--', '<', '>').
+ // Optimized for cases where the array contains the key, checked by assertions.
+ template<typename ArrayType, typename KeyType, KeyType(*valueAtPosition)(ArrayType*)>
+ inline ArrayType* binaryChop(ArrayType* array, size_t size, KeyType key)
+ {
+ // The array must contain at least one element (pre-condition, array does conatin key).
+ // If the array only contains one element, no need to do the comparison.
+ while (size > 1) {
+ // Pick an element to check, half way through the array, and read the value.
+ int pos = (size - 1) >> 1;
+ KeyType val = valueAtPosition(&array[pos]);
+
+ // If the key matches, success!
+ if (val == key)
+ return &array[pos];
+ // The item we are looking for is smaller than the item being check; reduce the value of 'size',
+ // chopping off the right hand half of the array.
+ else if (key < val)
+ size = pos;
+ // Discard all values in the left hand half of the array, up to and including the item at pos.
+ else {
+ size -= (pos + 1);
+ array += (pos + 1);
+ }
+
+ // 'size' should never reach zero.
+ ASSERT(size);
+ }
+
+ // If we reach this point we've chopped down to one element, no need to check it matches
+ ASSERT(size == 1);
+ ASSERT(key == valueAtPosition(&array[0]));
+ return &array[0];
+ }
+#endif
+
+ class CodeBlock : public FastAllocBase {
+ friend class JIT;
+ protected:
+ CodeBlock(ScriptExecutable* ownerExecutable, CodeType, JSGlobalObject*, PassRefPtr<SourceProvider>, unsigned sourceOffset, SymbolTable* symbolTable, bool isConstructor);
+
+ JSGlobalObject* m_globalObject;
+
+ public:
+ virtual ~CodeBlock();
+
+ void markAggregate(MarkStack&);
+ void refStructures(Instruction* vPC) const;
+ void derefStructures(Instruction* vPC) const;
+#if ENABLE(JIT_OPTIMIZE_CALL)
+ void unlinkCallers();
+#endif
+
+ static void dumpStatistics();
+
+#if !defined(NDEBUG) || ENABLE_OPCODE_SAMPLING
+ void dump(ExecState*) const;
+ void printStructures(const Instruction*) const;
+ void printStructure(const char* name, const Instruction*, int operand) const;
+#endif
+
+ bool isStrictMode() const { return m_isStrictMode; }
+
+ inline bool isKnownNotImmediate(int index)
+ {
+ if (index == m_thisRegister && !m_isStrictMode)
+ return true;
+
+ if (isConstantRegisterIndex(index))
+ return getConstant(index).isCell();
+
+ return false;
+ }
+
+ ALWAYS_INLINE bool isTemporaryRegisterIndex(int index)
+ {
+ return index >= m_numVars;
+ }
+
+ HandlerInfo* handlerForBytecodeOffset(unsigned bytecodeOffset);
+ int lineNumberForBytecodeOffset(unsigned bytecodeOffset);
+ void expressionRangeForBytecodeOffset(unsigned bytecodeOffset, int& divot, int& startOffset, int& endOffset);
+
+#if ENABLE(JIT)
+ void addCaller(CallLinkInfo* caller)
+ {
+ caller->callee = this;
+ caller->position = m_linkedCallerList.size();
+ m_linkedCallerList.append(caller);
+ }
+
+ void removeCaller(CallLinkInfo* caller)
+ {
+ unsigned pos = caller->position;
+ unsigned lastPos = m_linkedCallerList.size() - 1;
+
+ if (pos != lastPos) {
+ m_linkedCallerList[pos] = m_linkedCallerList[lastPos];
+ m_linkedCallerList[pos]->position = pos;
+ }
+ m_linkedCallerList.shrink(lastPos);
+ }
+
+ StructureStubInfo& getStubInfo(ReturnAddressPtr returnAddress)
+ {
+ return *(binaryChop<StructureStubInfo, void*, getStructureStubInfoReturnLocation>(m_structureStubInfos.begin(), m_structureStubInfos.size(), returnAddress.value()));
+ }
+
+ CallLinkInfo& getCallLinkInfo(ReturnAddressPtr returnAddress)
+ {
+ return *(binaryChop<CallLinkInfo, void*, getCallLinkInfoReturnLocation>(m_callLinkInfos.begin(), m_callLinkInfos.size(), returnAddress.value()));
+ }
+
+ MethodCallLinkInfo& getMethodCallLinkInfo(ReturnAddressPtr returnAddress)
+ {
+ return *(binaryChop<MethodCallLinkInfo, void*, getMethodCallLinkInfoReturnLocation>(m_methodCallLinkInfos.begin(), m_methodCallLinkInfos.size(), returnAddress.value()));
+ }
+
+ unsigned bytecodeOffset(ReturnAddressPtr returnAddress)
+ {
+ if (!m_rareData)
+ return 1;
+ Vector<CallReturnOffsetToBytecodeOffset>& callIndices = m_rareData->m_callReturnIndexVector;
+ if (!callIndices.size())
+ return 1;
+ return binaryChop<CallReturnOffsetToBytecodeOffset, unsigned, getCallReturnOffset>(callIndices.begin(), callIndices.size(), getJITCode().offsetOf(returnAddress.value()))->bytecodeOffset;
+ }
+#endif
+#if ENABLE(INTERPRETER)
+ unsigned bytecodeOffset(Instruction* returnAddress)
+ {
+ return static_cast<Instruction*>(returnAddress) - instructions().begin();
+ }
+#endif
+
+ void setIsNumericCompareFunction(bool isNumericCompareFunction) { m_isNumericCompareFunction = isNumericCompareFunction; }
+ bool isNumericCompareFunction() { return m_isNumericCompareFunction; }
+
+ Vector<Instruction>& instructions() { return m_instructions; }
+ void discardBytecode() { m_instructions.clear(); }
+
+#ifndef NDEBUG
+ unsigned instructionCount() { return m_instructionCount; }
+ void setInstructionCount(unsigned instructionCount) { m_instructionCount = instructionCount; }
+#endif
+
+#if ENABLE(JIT)
+ JITCode& getJITCode() { return m_isConstructor ? ownerExecutable()->generatedJITCodeForConstruct() : ownerExecutable()->generatedJITCodeForCall(); }
+ ExecutablePool* executablePool() { return getJITCode().getExecutablePool(); }
+#endif
+
+ ScriptExecutable* ownerExecutable() const { return m_ownerExecutable; }
+
+ void setGlobalData(JSGlobalData* globalData) { m_globalData = globalData; }
+
+ void setThisRegister(int thisRegister) { m_thisRegister = thisRegister; }
+ int thisRegister() const { return m_thisRegister; }
+
+ void setNeedsFullScopeChain(bool needsFullScopeChain) { m_needsFullScopeChain = needsFullScopeChain; }
+ bool needsFullScopeChain() const { return m_needsFullScopeChain; }
+ void setUsesEval(bool usesEval) { m_usesEval = usesEval; }
+ bool usesEval() const { return m_usesEval; }
+
+ void setArgumentsRegister(int argumentsRegister)
+ {
+ ASSERT(argumentsRegister != -1);
+ m_argumentsRegister = argumentsRegister;
+ ASSERT(usesArguments());
+ }
+ int argumentsRegister()
+ {
+ ASSERT(usesArguments());
+ return m_argumentsRegister;
+ }
+ void setActivationRegister(int activationRegister)
+ {
+ m_activationRegister = activationRegister;
+ }
+ int activationRegister()
+ {
+ ASSERT(needsFullScopeChain());
+ return m_activationRegister;
+ }
+ bool usesArguments() const { return m_argumentsRegister != -1; }
+
+ CodeType codeType() const { return m_codeType; }
+
+ SourceProvider* source() const { return m_source.get(); }
+ unsigned sourceOffset() const { return m_sourceOffset; }
+
+ size_t numberOfJumpTargets() const { return m_jumpTargets.size(); }
+ void addJumpTarget(unsigned jumpTarget) { m_jumpTargets.append(jumpTarget); }
+ unsigned jumpTarget(int index) const { return m_jumpTargets[index]; }
+ unsigned lastJumpTarget() const { return m_jumpTargets.last(); }
+
+ void createActivation(CallFrame*);
+
+#if ENABLE(INTERPRETER)
+ void addPropertyAccessInstruction(unsigned propertyAccessInstruction) { m_propertyAccessInstructions.append(propertyAccessInstruction); }
+ void addGlobalResolveInstruction(unsigned globalResolveInstruction) { m_globalResolveInstructions.append(globalResolveInstruction); }
+ bool hasGlobalResolveInstructionAtBytecodeOffset(unsigned bytecodeOffset);
+#endif
+#if ENABLE(JIT)
+ size_t numberOfStructureStubInfos() const { return m_structureStubInfos.size(); }
+ void addStructureStubInfo(const StructureStubInfo& stubInfo) { m_structureStubInfos.append(stubInfo); }
+ StructureStubInfo& structureStubInfo(int index) { return m_structureStubInfos[index]; }
+
+ void addGlobalResolveInfo(unsigned globalResolveInstruction) { m_globalResolveInfos.append(GlobalResolveInfo(globalResolveInstruction)); }
+ GlobalResolveInfo& globalResolveInfo(int index) { return m_globalResolveInfos[index]; }
+ bool hasGlobalResolveInfoAtBytecodeOffset(unsigned bytecodeOffset);
+
+ size_t numberOfCallLinkInfos() const { return m_callLinkInfos.size(); }
+ void addCallLinkInfo() { m_callLinkInfos.append(CallLinkInfo()); }
+ CallLinkInfo& callLinkInfo(int index) { return m_callLinkInfos[index]; }
+
+ void addMethodCallLinkInfos(unsigned n) { m_methodCallLinkInfos.grow(n); }
+ MethodCallLinkInfo& methodCallLinkInfo(int index) { return m_methodCallLinkInfos[index]; }
+#endif
+
+ // Exception handling support
+
+ size_t numberOfExceptionHandlers() const { return m_rareData ? m_rareData->m_exceptionHandlers.size() : 0; }
+ void addExceptionHandler(const HandlerInfo& hanler) { createRareDataIfNecessary(); return m_rareData->m_exceptionHandlers.append(hanler); }
+ HandlerInfo& exceptionHandler(int index) { ASSERT(m_rareData); return m_rareData->m_exceptionHandlers[index]; }
+
+ void addExpressionInfo(const ExpressionRangeInfo& expressionInfo)
+ {
+ createRareDataIfNecessary();
+ m_rareData->m_expressionInfo.append(expressionInfo);
+ }
+
+ void addLineInfo(unsigned bytecodeOffset, int lineNo)
+ {
+ createRareDataIfNecessary();
+ Vector<LineInfo>& lineInfo = m_rareData->m_lineInfo;
+ if (!lineInfo.size() || lineInfo.last().lineNumber != lineNo) {
+ LineInfo info = { bytecodeOffset, lineNo };
+ lineInfo.append(info);
+ }
+ }
+
+ bool hasExpressionInfo() { return m_rareData && m_rareData->m_expressionInfo.size(); }
+ bool hasLineInfo() { return m_rareData && m_rareData->m_lineInfo.size(); }
+ bool needsCallReturnIndices()
+ {
+ return m_rareData &&
+ (m_rareData->m_expressionInfo.size() || m_rareData->m_lineInfo.size() || m_rareData->m_exceptionHandlers.size());
+ }
+
+#if ENABLE(JIT)
+ Vector<CallReturnOffsetToBytecodeOffset>& callReturnIndexVector()
+ {
+ createRareDataIfNecessary();
+ return m_rareData->m_callReturnIndexVector;
+ }
+#endif
+
+ // Constant Pool
+
+ size_t numberOfIdentifiers() const { return m_identifiers.size(); }
+ void addIdentifier(const Identifier& i) { return m_identifiers.append(i); }
+ Identifier& identifier(int index) { return m_identifiers[index]; }
+
+ size_t numberOfConstantRegisters() const { return m_constantRegisters.size(); }
+ void addConstantRegister(const Register& r) { return m_constantRegisters.append(r); }
+ Register& constantRegister(int index) { return m_constantRegisters[index - FirstConstantRegisterIndex]; }
+ ALWAYS_INLINE bool isConstantRegisterIndex(int index) const { return index >= FirstConstantRegisterIndex; }
+ ALWAYS_INLINE JSValue getConstant(int index) const { return m_constantRegisters[index - FirstConstantRegisterIndex].jsValue(); }
+
+ unsigned addFunctionDecl(NonNullPassRefPtr<FunctionExecutable> n) { unsigned size = m_functionDecls.size(); m_functionDecls.append(n); return size; }
+ FunctionExecutable* functionDecl(int index) { return m_functionDecls[index].get(); }
+ int numberOfFunctionDecls() { return m_functionDecls.size(); }
+ unsigned addFunctionExpr(NonNullPassRefPtr<FunctionExecutable> n) { unsigned size = m_functionExprs.size(); m_functionExprs.append(n); return size; }
+ FunctionExecutable* functionExpr(int index) { return m_functionExprs[index].get(); }
+
+ unsigned addRegExp(RegExp* r) { createRareDataIfNecessary(); unsigned size = m_rareData->m_regexps.size(); m_rareData->m_regexps.append(r); return size; }
+ RegExp* regexp(int index) const { ASSERT(m_rareData); return m_rareData->m_regexps[index].get(); }
+
+ JSGlobalObject* globalObject() { return m_globalObject; }
+
+ // Jump Tables
+
+ size_t numberOfImmediateSwitchJumpTables() const { return m_rareData ? m_rareData->m_immediateSwitchJumpTables.size() : 0; }
+ SimpleJumpTable& addImmediateSwitchJumpTable() { createRareDataIfNecessary(); m_rareData->m_immediateSwitchJumpTables.append(SimpleJumpTable()); return m_rareData->m_immediateSwitchJumpTables.last(); }
+ SimpleJumpTable& immediateSwitchJumpTable(int tableIndex) { ASSERT(m_rareData); return m_rareData->m_immediateSwitchJumpTables[tableIndex]; }
+
+ size_t numberOfCharacterSwitchJumpTables() const { return m_rareData ? m_rareData->m_characterSwitchJumpTables.size() : 0; }
+ SimpleJumpTable& addCharacterSwitchJumpTable() { createRareDataIfNecessary(); m_rareData->m_characterSwitchJumpTables.append(SimpleJumpTable()); return m_rareData->m_characterSwitchJumpTables.last(); }
+ SimpleJumpTable& characterSwitchJumpTable(int tableIndex) { ASSERT(m_rareData); return m_rareData->m_characterSwitchJumpTables[tableIndex]; }
+
+ size_t numberOfStringSwitchJumpTables() const { return m_rareData ? m_rareData->m_stringSwitchJumpTables.size() : 0; }
+ StringJumpTable& addStringSwitchJumpTable() { createRareDataIfNecessary(); m_rareData->m_stringSwitchJumpTables.append(StringJumpTable()); return m_rareData->m_stringSwitchJumpTables.last(); }
+ StringJumpTable& stringSwitchJumpTable(int tableIndex) { ASSERT(m_rareData); return m_rareData->m_stringSwitchJumpTables[tableIndex]; }
+
+
+ SymbolTable* symbolTable() { return m_symbolTable; }
+ SharedSymbolTable* sharedSymbolTable() { ASSERT(m_codeType == FunctionCode); return static_cast<SharedSymbolTable*>(m_symbolTable); }
+
+ EvalCodeCache& evalCodeCache() { createRareDataIfNecessary(); return m_rareData->m_evalCodeCache; }
+
+ void shrinkToFit();
+
+ // FIXME: Make these remaining members private.
+
+ int m_numCalleeRegisters;
+ int m_numVars;
+ int m_numCapturedVars;
+ int m_numParameters;
+ bool m_isConstructor;
+
+ private:
+#if !defined(NDEBUG) || ENABLE(OPCODE_SAMPLING)
+ void dump(ExecState*, const Vector<Instruction>::const_iterator& begin, Vector<Instruction>::const_iterator&) const;
+
+ CString registerName(ExecState*, int r) const;
+ void printUnaryOp(ExecState*, int location, Vector<Instruction>::const_iterator&, const char* op) const;
+ void printBinaryOp(ExecState*, int location, Vector<Instruction>::const_iterator&, const char* op) const;
+ void printConditionalJump(ExecState*, const Vector<Instruction>::const_iterator&, Vector<Instruction>::const_iterator&, int location, const char* op) const;
+ void printGetByIdOp(ExecState*, int location, Vector<Instruction>::const_iterator&, const char* op) const;
+ void printPutByIdOp(ExecState*, int location, Vector<Instruction>::const_iterator&, const char* op) const;
+#endif
+
+ void createRareDataIfNecessary()
+ {
+ if (!m_rareData)
+ m_rareData = adoptPtr(new RareData);
+ }
+
+ ScriptExecutable* m_ownerExecutable;
+ JSGlobalData* m_globalData;
+
+ Vector<Instruction> m_instructions;
+#ifndef NDEBUG
+ unsigned m_instructionCount;
+#endif
+
+ int m_thisRegister;
+ int m_argumentsRegister;
+ int m_activationRegister;
+
+ bool m_needsFullScopeChain;
+ bool m_usesEval;
+ bool m_isNumericCompareFunction;
+ bool m_isStrictMode;
+
+ CodeType m_codeType;
+
+ RefPtr<SourceProvider> m_source;
+ unsigned m_sourceOffset;
+
+#if ENABLE(INTERPRETER)
+ Vector<unsigned> m_propertyAccessInstructions;
+ Vector<unsigned> m_globalResolveInstructions;
+#endif
+#if ENABLE(JIT)
+ Vector<StructureStubInfo> m_structureStubInfos;
+ Vector<GlobalResolveInfo> m_globalResolveInfos;
+ Vector<CallLinkInfo> m_callLinkInfos;
+ Vector<MethodCallLinkInfo> m_methodCallLinkInfos;
+ Vector<CallLinkInfo*> m_linkedCallerList;
+#endif
+
+ Vector<unsigned> m_jumpTargets;
+
+ // Constant Pool
+ Vector<Identifier> m_identifiers;
+ Vector<Register> m_constantRegisters;
+ Vector<RefPtr<FunctionExecutable> > m_functionDecls;
+ Vector<RefPtr<FunctionExecutable> > m_functionExprs;
+
+ SymbolTable* m_symbolTable;
+
+ struct RareData : FastAllocBase {
+ Vector<HandlerInfo> m_exceptionHandlers;
+
+ // Rare Constants
+ Vector<RefPtr<RegExp> > m_regexps;
+
+ // Jump Tables
+ Vector<SimpleJumpTable> m_immediateSwitchJumpTables;
+ Vector<SimpleJumpTable> m_characterSwitchJumpTables;
+ Vector<StringJumpTable> m_stringSwitchJumpTables;
+
+ EvalCodeCache m_evalCodeCache;
+
+ // Expression info - present if debugging.
+ Vector<ExpressionRangeInfo> m_expressionInfo;
+ // Line info - present if profiling or debugging.
+ Vector<LineInfo> m_lineInfo;
+#if ENABLE(JIT)
+ Vector<CallReturnOffsetToBytecodeOffset> m_callReturnIndexVector;
+#endif
+ };
+ OwnPtr<RareData> m_rareData;
+ };
+
+ // Program code is not marked by any function, so we make the global object
+ // responsible for marking it.
+
+ class GlobalCodeBlock : public CodeBlock {
+ public:
+ GlobalCodeBlock(ScriptExecutable* ownerExecutable, CodeType codeType, JSGlobalObject* globalObject, PassRefPtr<SourceProvider> sourceProvider, unsigned sourceOffset)
+ : CodeBlock(ownerExecutable, codeType, globalObject, sourceProvider, sourceOffset, &m_unsharedSymbolTable, false)
+ {
+ m_globalObject->codeBlocks().add(this);
+ }
+
+ ~GlobalCodeBlock()
+ {
+ if (m_globalObject)
+ m_globalObject->codeBlocks().remove(this);
+ }
+
+ void clearGlobalObject() { m_globalObject = 0; }
+
+ private:
+ SymbolTable m_unsharedSymbolTable;
+ };
+
+ class ProgramCodeBlock : public GlobalCodeBlock {
+ public:
+ ProgramCodeBlock(ProgramExecutable* ownerExecutable, CodeType codeType, JSGlobalObject* globalObject, PassRefPtr<SourceProvider> sourceProvider)
+ : GlobalCodeBlock(ownerExecutable, codeType, globalObject, sourceProvider, 0)
+ {
+ }
+ };
+
+ class EvalCodeBlock : public GlobalCodeBlock {
+ public:
+ EvalCodeBlock(EvalExecutable* ownerExecutable, JSGlobalObject* globalObject, PassRefPtr<SourceProvider> sourceProvider, int baseScopeDepth)
+ : GlobalCodeBlock(ownerExecutable, EvalCode, globalObject, sourceProvider, 0)
+ , m_baseScopeDepth(baseScopeDepth)
+ {
+ }
+
+ int baseScopeDepth() const { return m_baseScopeDepth; }
+
+ const Identifier& variable(unsigned index) { return m_variables[index]; }
+ unsigned numVariables() { return m_variables.size(); }
+ void adoptVariables(Vector<Identifier>& variables)
+ {
+ ASSERT(m_variables.isEmpty());
+ m_variables.swap(variables);
+ }
+
+ private:
+ int m_baseScopeDepth;
+ Vector<Identifier> m_variables;
+ };
+
+ class FunctionCodeBlock : public CodeBlock {
+ public:
+ // Rather than using the usual RefCounted::create idiom for SharedSymbolTable we just use new
+ // as we need to initialise the CodeBlock before we could initialise any RefPtr to hold the shared
+ // symbol table, so we just pass as a raw pointer with a ref count of 1. We then manually deref
+ // in the destructor.
+ FunctionCodeBlock(FunctionExecutable* ownerExecutable, CodeType codeType, JSGlobalObject* globalObject, PassRefPtr<SourceProvider> sourceProvider, unsigned sourceOffset, bool isConstructor)
+ : CodeBlock(ownerExecutable, codeType, globalObject, sourceProvider, sourceOffset, SharedSymbolTable::create().leakRef(), isConstructor)
+ {
+ }
+ ~FunctionCodeBlock()
+ {
+ sharedSymbolTable()->deref();
+ }
+ };
+
+ inline Register& ExecState::r(int index)
+ {
+ CodeBlock* codeBlock = this->codeBlock();
+ if (codeBlock->isConstantRegisterIndex(index))
+ return codeBlock->constantRegister(index);
+ return this[index];
+ }
+
+ inline Register& ExecState::uncheckedR(int index)
+ {
+ ASSERT(index < FirstConstantRegisterIndex);
+ return this[index];
+ }
+
+} // namespace JSC
+
+#endif // CodeBlock_h
diff --git a/Source/JavaScriptCore/bytecode/EvalCodeCache.h b/Source/JavaScriptCore/bytecode/EvalCodeCache.h
new file mode 100644
index 0000000..edd575f
--- /dev/null
+++ b/Source/JavaScriptCore/bytecode/EvalCodeCache.h
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef EvalCodeCache_h
+#define EvalCodeCache_h
+
+#include "Executable.h"
+#include "JSGlobalObject.h"
+#include "Nodes.h"
+#include "Parser.h"
+#include "SourceCode.h"
+#include "UString.h"
+#include <wtf/HashMap.h>
+#include <wtf/RefPtr.h>
+#include <wtf/text/StringHash.h>
+
+namespace JSC {
+
+ class EvalCodeCache {
+ public:
+ PassRefPtr<EvalExecutable> get(ExecState* exec, bool inStrictContext, const UString& evalSource, ScopeChainNode* scopeChain, JSValue& exceptionValue)
+ {
+ RefPtr<EvalExecutable> evalExecutable;
+
+ if (!inStrictContext && evalSource.length() < maxCacheableSourceLength && (*scopeChain->begin())->isVariableObject())
+ evalExecutable = m_cacheMap.get(evalSource.impl());
+
+ if (!evalExecutable) {
+ evalExecutable = EvalExecutable::create(exec, makeSource(evalSource), inStrictContext);
+ exceptionValue = evalExecutable->compile(exec, scopeChain);
+ if (exceptionValue)
+ return 0;
+
+ if (!inStrictContext && evalSource.length() < maxCacheableSourceLength && (*scopeChain->begin())->isVariableObject() && m_cacheMap.size() < maxCacheEntries)
+ m_cacheMap.set(evalSource.impl(), evalExecutable);
+ }
+
+ return evalExecutable.release();
+ }
+
+ bool isEmpty() const { return m_cacheMap.isEmpty(); }
+
+ private:
+ static const unsigned maxCacheableSourceLength = 256;
+ static const int maxCacheEntries = 64;
+
+ typedef HashMap<RefPtr<StringImpl>, RefPtr<EvalExecutable> > EvalCacheMap;
+ EvalCacheMap m_cacheMap;
+ };
+
+} // namespace JSC
+
+#endif // EvalCodeCache_h
diff --git a/Source/JavaScriptCore/bytecode/Instruction.h b/Source/JavaScriptCore/bytecode/Instruction.h
new file mode 100644
index 0000000..c6468a5
--- /dev/null
+++ b/Source/JavaScriptCore/bytecode/Instruction.h
@@ -0,0 +1,169 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef Instruction_h
+#define Instruction_h
+
+#include "MacroAssembler.h"
+#include "Opcode.h"
+#include "PropertySlot.h"
+#include "Structure.h"
+#include <wtf/VectorTraits.h>
+
+#define POLYMORPHIC_LIST_CACHE_SIZE 8
+
+namespace JSC {
+
+ // *Sigh*, If the JIT is enabled we need to track the stubRountine (of type CodeLocationLabel),
+ // If the JIT is not in use we don't actually need the variable (that said, if the JIT is not in use we don't
+ // curently actually use PolymorphicAccessStructureLists, which we should). Anyway, this seems like the best
+ // solution for now - will need to something smarter if/when we actually want mixed-mode operation.
+#if ENABLE(JIT)
+ typedef CodeLocationLabel PolymorphicAccessStructureListStubRoutineType;
+#else
+ typedef void* PolymorphicAccessStructureListStubRoutineType;
+#endif
+
+ class JSCell;
+ class Structure;
+ class StructureChain;
+
+ // Structure used by op_get_by_id_self_list and op_get_by_id_proto_list instruction to hold data off the main opcode stream.
+ struct PolymorphicAccessStructureList : FastAllocBase {
+ struct PolymorphicStubInfo {
+ bool isChain;
+ PolymorphicAccessStructureListStubRoutineType stubRoutine;
+ Structure* base;
+ union {
+ Structure* proto;
+ StructureChain* chain;
+ } u;
+
+ void set(PolymorphicAccessStructureListStubRoutineType _stubRoutine, Structure* _base)
+ {
+ stubRoutine = _stubRoutine;
+ base = _base;
+ u.proto = 0;
+ isChain = false;
+ }
+
+ void set(PolymorphicAccessStructureListStubRoutineType _stubRoutine, Structure* _base, Structure* _proto)
+ {
+ stubRoutine = _stubRoutine;
+ base = _base;
+ u.proto = _proto;
+ isChain = false;
+ }
+
+ void set(PolymorphicAccessStructureListStubRoutineType _stubRoutine, Structure* _base, StructureChain* _chain)
+ {
+ stubRoutine = _stubRoutine;
+ base = _base;
+ u.chain = _chain;
+ isChain = true;
+ }
+ } list[POLYMORPHIC_LIST_CACHE_SIZE];
+
+ PolymorphicAccessStructureList(PolymorphicAccessStructureListStubRoutineType stubRoutine, Structure* firstBase)
+ {
+ list[0].set(stubRoutine, firstBase);
+ }
+
+ PolymorphicAccessStructureList(PolymorphicAccessStructureListStubRoutineType stubRoutine, Structure* firstBase, Structure* firstProto)
+ {
+ list[0].set(stubRoutine, firstBase, firstProto);
+ }
+
+ PolymorphicAccessStructureList(PolymorphicAccessStructureListStubRoutineType stubRoutine, Structure* firstBase, StructureChain* firstChain)
+ {
+ list[0].set(stubRoutine, firstBase, firstChain);
+ }
+
+ void derefStructures(int count)
+ {
+ for (int i = 0; i < count; ++i) {
+ PolymorphicStubInfo& info = list[i];
+
+ ASSERT(info.base);
+ info.base->deref();
+
+ if (info.u.proto) {
+ if (info.isChain)
+ info.u.chain->deref();
+ else
+ info.u.proto->deref();
+ }
+ }
+ }
+ };
+
+ struct Instruction {
+ Instruction(Opcode opcode)
+ {
+#if !ENABLE(COMPUTED_GOTO_INTERPRETER)
+ // We have to initialize one of the pointer members to ensure that
+ // the entire struct is initialized, when opcode is not a pointer.
+ u.jsCell = 0;
+#endif
+ u.opcode = opcode;
+ }
+
+ Instruction(int operand)
+ {
+ // We have to initialize one of the pointer members to ensure that
+ // the entire struct is initialized in 64-bit.
+ u.jsCell = 0;
+ u.operand = operand;
+ }
+
+ Instruction(Structure* structure) { u.structure = structure; }
+ Instruction(StructureChain* structureChain) { u.structureChain = structureChain; }
+ Instruction(JSCell* jsCell) { u.jsCell = jsCell; }
+ Instruction(PolymorphicAccessStructureList* polymorphicStructures) { u.polymorphicStructures = polymorphicStructures; }
+ Instruction(PropertySlot::GetValueFunc getterFunc) { u.getterFunc = getterFunc; }
+
+ union {
+ Opcode opcode;
+ int operand;
+ Structure* structure;
+ StructureChain* structureChain;
+ JSCell* jsCell;
+ PolymorphicAccessStructureList* polymorphicStructures;
+ PropertySlot::GetValueFunc getterFunc;
+ } u;
+ };
+
+} // namespace JSC
+
+namespace WTF {
+
+ template<> struct VectorTraits<JSC::Instruction> : VectorTraitsBase<true, JSC::Instruction> { };
+
+} // namespace WTF
+
+#endif // Instruction_h
diff --git a/Source/JavaScriptCore/bytecode/JumpTable.cpp b/Source/JavaScriptCore/bytecode/JumpTable.cpp
new file mode 100644
index 0000000..ef7098b
--- /dev/null
+++ b/Source/JavaScriptCore/bytecode/JumpTable.cpp
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2008 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JumpTable.h"
+
+#include <wtf/text/StringHash.h>
+
+namespace JSC {
+
+int32_t SimpleJumpTable::offsetForValue(int32_t value, int32_t defaultOffset)
+{
+ if (value >= min && static_cast<uint32_t>(value - min) < branchOffsets.size()) {
+ int32_t offset = branchOffsets[value - min];
+ if (offset)
+ return offset;
+ }
+ return defaultOffset;
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/bytecode/JumpTable.h b/Source/JavaScriptCore/bytecode/JumpTable.h
new file mode 100644
index 0000000..5bbe047
--- /dev/null
+++ b/Source/JavaScriptCore/bytecode/JumpTable.h
@@ -0,0 +1,103 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2008 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef JumpTable_h
+#define JumpTable_h
+
+#include "MacroAssembler.h"
+#include "UString.h"
+#include <wtf/HashMap.h>
+#include <wtf/Vector.h>
+
+namespace JSC {
+
+ struct OffsetLocation {
+ int32_t branchOffset;
+#if ENABLE(JIT)
+ CodeLocationLabel ctiOffset;
+#endif
+ };
+
+ struct StringJumpTable {
+ typedef HashMap<RefPtr<StringImpl>, OffsetLocation> StringOffsetTable;
+ StringOffsetTable offsetTable;
+#if ENABLE(JIT)
+ CodeLocationLabel ctiDefault; // FIXME: it should not be necessary to store this.
+#endif
+
+ inline int32_t offsetForValue(StringImpl* value, int32_t defaultOffset)
+ {
+ StringOffsetTable::const_iterator end = offsetTable.end();
+ StringOffsetTable::const_iterator loc = offsetTable.find(value);
+ if (loc == end)
+ return defaultOffset;
+ return loc->second.branchOffset;
+ }
+
+#if ENABLE(JIT)
+ inline CodeLocationLabel ctiForValue(StringImpl* value)
+ {
+ StringOffsetTable::const_iterator end = offsetTable.end();
+ StringOffsetTable::const_iterator loc = offsetTable.find(value);
+ if (loc == end)
+ return ctiDefault;
+ return loc->second.ctiOffset;
+ }
+#endif
+ };
+
+ struct SimpleJumpTable {
+ // FIXME: The two Vectors can be combind into one Vector<OffsetLocation>
+ Vector<int32_t> branchOffsets;
+ int32_t min;
+#if ENABLE(JIT)
+ Vector<CodeLocationLabel> ctiOffsets;
+ CodeLocationLabel ctiDefault;
+#endif
+
+ int32_t offsetForValue(int32_t value, int32_t defaultOffset);
+ void add(int32_t key, int32_t offset)
+ {
+ if (!branchOffsets[key])
+ branchOffsets[key] = offset;
+ }
+
+#if ENABLE(JIT)
+ inline CodeLocationLabel ctiForValue(int32_t value)
+ {
+ if (value >= min && static_cast<uint32_t>(value - min) < ctiOffsets.size())
+ return ctiOffsets[value - min];
+ return ctiDefault;
+ }
+#endif
+ };
+
+} // namespace JSC
+
+#endif // JumpTable_h
diff --git a/Source/JavaScriptCore/bytecode/Opcode.cpp b/Source/JavaScriptCore/bytecode/Opcode.cpp
new file mode 100644
index 0000000..0bb714b
--- /dev/null
+++ b/Source/JavaScriptCore/bytecode/Opcode.cpp
@@ -0,0 +1,191 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2008 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "Opcode.h"
+
+#if ENABLE(OPCODE_STATS)
+#include <stdio.h>
+#include <wtf/FixedArray.h>
+#endif
+
+using namespace std;
+
+namespace JSC {
+
+#if ENABLE(OPCODE_SAMPLING) || ENABLE(CODEBLOCK_SAMPLING) || ENABLE(OPCODE_STATS)
+
+const char* const opcodeNames[] = {
+#define OPCODE_NAME_ENTRY(opcode, size) #opcode,
+ FOR_EACH_OPCODE_ID(OPCODE_NAME_ENTRY)
+#undef OPCODE_NAME_ENTRY
+};
+
+#endif
+
+#if ENABLE(OPCODE_STATS)
+
+long long OpcodeStats::opcodeCounts[numOpcodeIDs];
+long long OpcodeStats::opcodePairCounts[numOpcodeIDs][numOpcodeIDs];
+int OpcodeStats::lastOpcode = -1;
+
+static OpcodeStats logger;
+
+OpcodeStats::OpcodeStats()
+{
+ for (int i = 0; i < numOpcodeIDs; ++i)
+ opcodeCounts[i] = 0;
+
+ for (int i = 0; i < numOpcodeIDs; ++i)
+ for (int j = 0; j < numOpcodeIDs; ++j)
+ opcodePairCounts[i][j] = 0;
+}
+
+static int compareOpcodeIndices(const void* left, const void* right)
+{
+ long long leftValue = OpcodeStats::opcodeCounts[*(int*) left];
+ long long rightValue = OpcodeStats::opcodeCounts[*(int*) right];
+
+ if (leftValue < rightValue)
+ return 1;
+ else if (leftValue > rightValue)
+ return -1;
+ else
+ return 0;
+}
+
+static int compareOpcodePairIndices(const void* left, const void* right)
+{
+ pair<int, int> leftPair = *(pair<int, int>*) left;
+ long long leftValue = OpcodeStats::opcodePairCounts[leftPair.first][leftPair.second];
+ pair<int, int> rightPair = *(pair<int, int>*) right;
+ long long rightValue = OpcodeStats::opcodePairCounts[rightPair.first][rightPair.second];
+
+ if (leftValue < rightValue)
+ return 1;
+ else if (leftValue > rightValue)
+ return -1;
+ else
+ return 0;
+}
+
+OpcodeStats::~OpcodeStats()
+{
+ long long totalInstructions = 0;
+ for (int i = 0; i < numOpcodeIDs; ++i)
+ totalInstructions += opcodeCounts[i];
+
+ long long totalInstructionPairs = 0;
+ for (int i = 0; i < numOpcodeIDs; ++i)
+ for (int j = 0; j < numOpcodeIDs; ++j)
+ totalInstructionPairs += opcodePairCounts[i][j];
+
+ FixedArray<int, numOpcodeIDs> sortedIndices;
+ for (int i = 0; i < numOpcodeIDs; ++i)
+ sortedIndices[i] = i;
+ qsort(sortedIndices.data(), numOpcodeIDs, sizeof(int), compareOpcodeIndices);
+
+ pair<int, int> sortedPairIndices[numOpcodeIDs * numOpcodeIDs];
+ pair<int, int>* currentPairIndex = sortedPairIndices;
+ for (int i = 0; i < numOpcodeIDs; ++i)
+ for (int j = 0; j < numOpcodeIDs; ++j)
+ *(currentPairIndex++) = make_pair(i, j);
+ qsort(sortedPairIndices, numOpcodeIDs * numOpcodeIDs, sizeof(pair<int, int>), compareOpcodePairIndices);
+
+ printf("\nExecuted opcode statistics\n");
+
+ printf("Total instructions executed: %lld\n\n", totalInstructions);
+
+ printf("All opcodes by frequency:\n\n");
+
+ for (int i = 0; i < numOpcodeIDs; ++i) {
+ int index = sortedIndices[i];
+ printf("%s:%s %lld - %.2f%%\n", opcodeNames[index], padOpcodeName((OpcodeID)index, 28), opcodeCounts[index], ((double) opcodeCounts[index]) / ((double) totalInstructions) * 100.0);
+ }
+
+ printf("\n");
+ printf("2-opcode sequences by frequency: %lld\n\n", totalInstructions);
+
+ for (int i = 0; i < numOpcodeIDs * numOpcodeIDs; ++i) {
+ pair<int, int> indexPair = sortedPairIndices[i];
+ long long count = opcodePairCounts[indexPair.first][indexPair.second];
+
+ if (!count)
+ break;
+
+ printf("%s%s %s:%s %lld %.2f%%\n", opcodeNames[indexPair.first], padOpcodeName((OpcodeID)indexPair.first, 28), opcodeNames[indexPair.second], padOpcodeName((OpcodeID)indexPair.second, 28), count, ((double) count) / ((double) totalInstructionPairs) * 100.0);
+ }
+
+ printf("\n");
+ printf("Most common opcodes and sequences:\n");
+
+ for (int i = 0; i < numOpcodeIDs; ++i) {
+ int index = sortedIndices[i];
+ long long opcodeCount = opcodeCounts[index];
+ double opcodeProportion = ((double) opcodeCount) / ((double) totalInstructions);
+ if (opcodeProportion < 0.0001)
+ break;
+ printf("\n%s:%s %lld - %.2f%%\n", opcodeNames[index], padOpcodeName((OpcodeID)index, 28), opcodeCount, opcodeProportion * 100.0);
+
+ for (int j = 0; j < numOpcodeIDs * numOpcodeIDs; ++j) {
+ pair<int, int> indexPair = sortedPairIndices[j];
+ long long pairCount = opcodePairCounts[indexPair.first][indexPair.second];
+ double pairProportion = ((double) pairCount) / ((double) totalInstructionPairs);
+
+ if (!pairCount || pairProportion < 0.0001 || pairProportion < opcodeProportion / 100)
+ break;
+
+ if (indexPair.first != index && indexPair.second != index)
+ continue;
+
+ printf(" %s%s %s:%s %lld - %.2f%%\n", opcodeNames[indexPair.first], padOpcodeName((OpcodeID)indexPair.first, 28), opcodeNames[indexPair.second], padOpcodeName((OpcodeID)indexPair.second, 28), pairCount, pairProportion * 100.0);
+ }
+
+ }
+ printf("\n");
+}
+
+void OpcodeStats::recordInstruction(int opcode)
+{
+ opcodeCounts[opcode]++;
+
+ if (lastOpcode != -1)
+ opcodePairCounts[lastOpcode][opcode]++;
+
+ lastOpcode = opcode;
+}
+
+void OpcodeStats::resetLastInstruction()
+{
+ lastOpcode = -1;
+}
+
+#endif
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/bytecode/Opcode.h b/Source/JavaScriptCore/bytecode/Opcode.h
new file mode 100644
index 0000000..6c1c6b2
--- /dev/null
+++ b/Source/JavaScriptCore/bytecode/Opcode.h
@@ -0,0 +1,276 @@
+/*
+ * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2008 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef Opcode_h
+#define Opcode_h
+
+#include <algorithm>
+#include <string.h>
+
+#include <wtf/Assertions.h>
+
+namespace JSC {
+
+ #define FOR_EACH_OPCODE_ID(macro) \
+ macro(op_enter, 1) \
+ macro(op_create_activation, 2) \
+ macro(op_init_lazy_reg, 2) \
+ macro(op_create_arguments, 2) \
+ macro(op_create_this, 3) \
+ macro(op_get_callee, 2) \
+ macro(op_convert_this, 2) \
+ macro(op_convert_this_strict, 2) \
+ \
+ macro(op_new_object, 2) \
+ macro(op_new_array, 4) \
+ macro(op_new_regexp, 3) \
+ macro(op_mov, 3) \
+ \
+ macro(op_not, 3) \
+ macro(op_eq, 4) \
+ macro(op_eq_null, 3) \
+ macro(op_neq, 4) \
+ macro(op_neq_null, 3) \
+ macro(op_stricteq, 4) \
+ macro(op_nstricteq, 4) \
+ macro(op_less, 4) \
+ macro(op_lesseq, 4) \
+ \
+ macro(op_pre_inc, 2) \
+ macro(op_pre_dec, 2) \
+ macro(op_post_inc, 3) \
+ macro(op_post_dec, 3) \
+ macro(op_to_jsnumber, 3) \
+ macro(op_negate, 3) \
+ macro(op_add, 5) \
+ macro(op_mul, 5) \
+ macro(op_div, 5) \
+ macro(op_mod, 4) \
+ macro(op_sub, 5) \
+ \
+ macro(op_lshift, 4) \
+ macro(op_rshift, 4) \
+ macro(op_urshift, 4) \
+ macro(op_bitand, 5) \
+ macro(op_bitxor, 5) \
+ macro(op_bitor, 5) \
+ macro(op_bitnot, 3) \
+ \
+ macro(op_check_has_instance, 2) \
+ macro(op_instanceof, 5) \
+ macro(op_typeof, 3) \
+ macro(op_is_undefined, 3) \
+ macro(op_is_boolean, 3) \
+ macro(op_is_number, 3) \
+ macro(op_is_string, 3) \
+ macro(op_is_object, 3) \
+ macro(op_is_function, 3) \
+ macro(op_in, 4) \
+ \
+ macro(op_resolve, 3) \
+ macro(op_resolve_skip, 4) \
+ macro(op_resolve_global, 5) \
+ macro(op_resolve_global_dynamic, 6) \
+ macro(op_get_scoped_var, 4) \
+ macro(op_put_scoped_var, 4) \
+ macro(op_get_global_var, 3) \
+ macro(op_put_global_var, 3) \
+ macro(op_resolve_base, 4) \
+ macro(op_ensure_property_exists, 3) \
+ macro(op_resolve_with_base, 4) \
+ macro(op_get_by_id, 8) \
+ macro(op_get_by_id_self, 8) \
+ macro(op_get_by_id_self_list, 8) \
+ macro(op_get_by_id_proto, 8) \
+ macro(op_get_by_id_proto_list, 8) \
+ macro(op_get_by_id_chain, 8) \
+ macro(op_get_by_id_getter_self, 8) \
+ macro(op_get_by_id_getter_self_list, 8) \
+ macro(op_get_by_id_getter_proto, 8) \
+ macro(op_get_by_id_getter_proto_list, 8) \
+ macro(op_get_by_id_getter_chain, 8) \
+ macro(op_get_by_id_custom_self, 8) \
+ macro(op_get_by_id_custom_self_list, 8) \
+ macro(op_get_by_id_custom_proto, 8) \
+ macro(op_get_by_id_custom_proto_list, 8) \
+ macro(op_get_by_id_custom_chain, 8) \
+ macro(op_get_by_id_generic, 8) \
+ macro(op_get_array_length, 8) \
+ macro(op_get_string_length, 8) \
+ macro(op_get_arguments_length, 4) \
+ macro(op_put_by_id, 9) \
+ macro(op_put_by_id_transition, 9) \
+ macro(op_put_by_id_replace, 9) \
+ macro(op_put_by_id_generic, 9) \
+ macro(op_del_by_id, 4) \
+ macro(op_get_by_val, 4) \
+ macro(op_get_argument_by_val, 4) \
+ macro(op_get_by_pname, 7) \
+ macro(op_put_by_val, 4) \
+ macro(op_del_by_val, 4) \
+ macro(op_put_by_index, 4) \
+ macro(op_put_getter, 4) \
+ macro(op_put_setter, 4) \
+ \
+ macro(op_jmp, 2) \
+ macro(op_jtrue, 3) \
+ macro(op_jfalse, 3) \
+ macro(op_jeq_null, 3) \
+ macro(op_jneq_null, 3) \
+ macro(op_jneq_ptr, 4) \
+ macro(op_jnless, 4) \
+ macro(op_jnlesseq, 4) \
+ macro(op_jless, 4) \
+ macro(op_jlesseq, 4) \
+ macro(op_jmp_scopes, 3) \
+ macro(op_loop, 2) \
+ macro(op_loop_if_true, 3) \
+ macro(op_loop_if_false, 3) \
+ macro(op_loop_if_less, 4) \
+ macro(op_loop_if_lesseq, 4) \
+ macro(op_switch_imm, 4) \
+ macro(op_switch_char, 4) \
+ macro(op_switch_string, 4) \
+ \
+ macro(op_new_func, 4) \
+ macro(op_new_func_exp, 3) \
+ macro(op_call, 4) \
+ macro(op_call_eval, 4) \
+ macro(op_call_varargs, 4) \
+ macro(op_load_varargs, 4) \
+ macro(op_tear_off_activation, 3) \
+ macro(op_tear_off_arguments, 2) \
+ macro(op_ret, 2) \
+ macro(op_call_put_result, 2) \
+ macro(op_ret_object_or_this, 3) \
+ macro(op_method_check, 1) \
+ \
+ macro(op_construct, 4) \
+ macro(op_strcat, 4) \
+ macro(op_to_primitive, 3) \
+ \
+ macro(op_get_pnames, 6) \
+ macro(op_next_pname, 7) \
+ \
+ macro(op_push_scope, 2) \
+ macro(op_pop_scope, 1) \
+ macro(op_push_new_scope, 4) \
+ \
+ macro(op_catch, 2) \
+ macro(op_throw, 2) \
+ macro(op_throw_reference_error, 2) \
+ macro(op_throw_syntax_error, 2) \
+ \
+ macro(op_jsr, 3) \
+ macro(op_sret, 2) \
+ \
+ macro(op_debug, 4) \
+ macro(op_profile_will_call, 2) \
+ macro(op_profile_did_call, 2) \
+ \
+ macro(op_end, 2) // end must be the last opcode in the list
+
+ #define OPCODE_ID_ENUM(opcode, length) opcode,
+ typedef enum { FOR_EACH_OPCODE_ID(OPCODE_ID_ENUM) } OpcodeID;
+ #undef OPCODE_ID_ENUM
+
+ const int numOpcodeIDs = op_end + 1;
+
+ #define OPCODE_ID_LENGTHS(id, length) const int id##_length = length;
+ FOR_EACH_OPCODE_ID(OPCODE_ID_LENGTHS);
+ #undef OPCODE_ID_LENGTHS
+
+ #define OPCODE_LENGTH(opcode) opcode##_length
+
+ #define OPCODE_ID_LENGTH_MAP(opcode, length) length,
+ const int opcodeLengths[numOpcodeIDs] = { FOR_EACH_OPCODE_ID(OPCODE_ID_LENGTH_MAP) };
+ #undef OPCODE_ID_LENGTH_MAP
+
+ #define VERIFY_OPCODE_ID(id, size) COMPILE_ASSERT(id <= op_end, ASSERT_THAT_JS_OPCODE_IDS_ARE_VALID);
+ FOR_EACH_OPCODE_ID(VERIFY_OPCODE_ID);
+ #undef VERIFY_OPCODE_ID
+
+#if ENABLE(COMPUTED_GOTO_INTERPRETER)
+#if COMPILER(RVCT) || COMPILER(INTEL)
+ typedef void* Opcode;
+#else
+ typedef const void* Opcode;
+#endif
+#else
+ typedef OpcodeID Opcode;
+#endif
+
+#if ENABLE(OPCODE_SAMPLING) || ENABLE(CODEBLOCK_SAMPLING) || ENABLE(OPCODE_STATS)
+
+#define PADDING_STRING " "
+#define PADDING_STRING_LENGTH static_cast<unsigned>(strlen(PADDING_STRING))
+
+ extern const char* const opcodeNames[];
+
+ inline const char* padOpcodeName(OpcodeID op, unsigned width)
+ {
+ unsigned pad = width - strlen(opcodeNames[op]);
+ pad = std::min(pad, PADDING_STRING_LENGTH);
+ return PADDING_STRING + PADDING_STRING_LENGTH - pad;
+ }
+
+#undef PADDING_STRING_LENGTH
+#undef PADDING_STRING
+
+#endif
+
+#if ENABLE(OPCODE_STATS)
+
+ struct OpcodeStats {
+ OpcodeStats();
+ ~OpcodeStats();
+ static long long opcodeCounts[numOpcodeIDs];
+ static long long opcodePairCounts[numOpcodeIDs][numOpcodeIDs];
+ static int lastOpcode;
+
+ static void recordInstruction(int opcode);
+ static void resetLastInstruction();
+ };
+
+#endif
+
+ inline size_t opcodeLength(OpcodeID opcode)
+ {
+ switch (opcode) {
+#define OPCODE_ID_LENGTHS(id, length) case id: return OPCODE_LENGTH(id);
+ FOR_EACH_OPCODE_ID(OPCODE_ID_LENGTHS)
+#undef OPCODE_ID_LENGTHS
+ }
+ ASSERT_NOT_REACHED();
+ return 0;
+ }
+
+} // namespace JSC
+
+#endif // Opcode_h
diff --git a/Source/JavaScriptCore/bytecode/SamplingTool.cpp b/Source/JavaScriptCore/bytecode/SamplingTool.cpp
new file mode 100644
index 0000000..f47e698
--- /dev/null
+++ b/Source/JavaScriptCore/bytecode/SamplingTool.cpp
@@ -0,0 +1,406 @@
+/*
+ * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "SamplingTool.h"
+
+#include "CodeBlock.h"
+#include "Interpreter.h"
+#include "Opcode.h"
+
+#if !OS(WINDOWS)
+#include <unistd.h>
+#endif
+
+namespace JSC {
+
+#if ENABLE(SAMPLING_FLAGS)
+
+void SamplingFlags::sample()
+{
+ uint32_t mask = static_cast<uint32_t>(1 << 31);
+ unsigned index;
+
+ for (index = 0; index < 32; ++index) {
+ if (mask & s_flags)
+ break;
+ mask >>= 1;
+ }
+
+ s_flagCounts[32 - index]++;
+}
+
+void SamplingFlags::start()
+{
+ for (unsigned i = 0; i <= 32; ++i)
+ s_flagCounts[i] = 0;
+}
+void SamplingFlags::stop()
+{
+ uint64_t total = 0;
+ for (unsigned i = 0; i <= 32; ++i)
+ total += s_flagCounts[i];
+
+ if (total) {
+ printf("\nSamplingFlags: sample counts with flags set: (%lld total)\n", total);
+ for (unsigned i = 0; i <= 32; ++i) {
+ if (s_flagCounts[i])
+ printf(" [ %02d ] : %lld\t\t(%03.2f%%)\n", i, s_flagCounts[i], (100.0 * s_flagCounts[i]) / total);
+ }
+ printf("\n");
+ } else
+ printf("\nSamplingFlags: no samples.\n\n");
+}
+uint64_t SamplingFlags::s_flagCounts[33];
+
+#else
+void SamplingFlags::start() {}
+void SamplingFlags::stop() {}
+#endif
+
+/*
+ Start with flag 16 set.
+ By doing this the monitoring of lower valued flags will be masked out
+ until flag 16 is explictly cleared.
+*/
+uint32_t SamplingFlags::s_flags = 1 << 15;
+
+
+#if OS(WINDOWS)
+
+static void sleepForMicroseconds(unsigned us)
+{
+ unsigned ms = us / 1000;
+ if (us && !ms)
+ ms = 1;
+ Sleep(ms);
+}
+
+#else
+
+static void sleepForMicroseconds(unsigned us)
+{
+ usleep(us);
+}
+
+#endif
+
+static inline unsigned hertz2us(unsigned hertz)
+{
+ return 1000000 / hertz;
+}
+
+
+SamplingTool* SamplingTool::s_samplingTool = 0;
+
+
+bool SamplingThread::s_running = false;
+unsigned SamplingThread::s_hertz = 10000;
+ThreadIdentifier SamplingThread::s_samplingThread;
+
+void* SamplingThread::threadStartFunc(void*)
+{
+ while (s_running) {
+ sleepForMicroseconds(hertz2us(s_hertz));
+
+#if ENABLE(SAMPLING_FLAGS)
+ SamplingFlags::sample();
+#endif
+#if ENABLE(OPCODE_SAMPLING)
+ SamplingTool::sample();
+#endif
+ }
+
+ return 0;
+}
+
+
+void SamplingThread::start(unsigned hertz)
+{
+ ASSERT(!s_running);
+ s_running = true;
+ s_hertz = hertz;
+
+ s_samplingThread = createThread(threadStartFunc, 0, "JavaScriptCore::Sampler");
+}
+
+void SamplingThread::stop()
+{
+ ASSERT(s_running);
+ s_running = false;
+ waitForThreadCompletion(s_samplingThread, 0);
+}
+
+
+void ScriptSampleRecord::sample(CodeBlock* codeBlock, Instruction* vPC)
+{
+ if (!m_samples) {
+ m_size = codeBlock->instructions().size();
+ m_samples = static_cast<int*>(calloc(m_size, sizeof(int)));
+ m_codeBlock = codeBlock;
+ }
+
+ ++m_sampleCount;
+
+ unsigned offest = vPC - codeBlock->instructions().begin();
+ // Since we don't read and write codeBlock and vPC atomically, this check
+ // can fail if we sample mid op_call / op_ret.
+ if (offest < m_size) {
+ m_samples[offest]++;
+ m_opcodeSampleCount++;
+ }
+}
+
+void SamplingTool::doRun()
+{
+ Sample sample(m_sample, m_codeBlock);
+ ++m_sampleCount;
+
+ if (sample.isNull())
+ return;
+
+ if (!sample.inHostFunction()) {
+ unsigned opcodeID = m_interpreter->getOpcodeID(sample.vPC()[0].u.opcode);
+
+ ++m_opcodeSampleCount;
+ ++m_opcodeSamples[opcodeID];
+
+ if (sample.inCTIFunction())
+ m_opcodeSamplesInCTIFunctions[opcodeID]++;
+ }
+
+#if ENABLE(CODEBLOCK_SAMPLING)
+ if (CodeBlock* codeBlock = sample.codeBlock()) {
+ MutexLocker locker(m_scriptSampleMapMutex);
+ ScriptSampleRecord* record = m_scopeSampleMap->get(codeBlock->ownerExecutable());
+ ASSERT(record);
+ record->sample(codeBlock, sample.vPC());
+ }
+#endif
+}
+
+void SamplingTool::sample()
+{
+ s_samplingTool->doRun();
+}
+
+void SamplingTool::notifyOfScope(ScriptExecutable* script)
+{
+#if ENABLE(CODEBLOCK_SAMPLING)
+ MutexLocker locker(m_scriptSampleMapMutex);
+ m_scopeSampleMap->set(script, new ScriptSampleRecord(script));
+#else
+ UNUSED_PARAM(script);
+#endif
+}
+
+void SamplingTool::setup()
+{
+ s_samplingTool = this;
+}
+
+#if ENABLE(OPCODE_SAMPLING)
+
+struct OpcodeSampleInfo {
+ OpcodeID opcode;
+ long long count;
+ long long countInCTIFunctions;
+};
+
+struct LineCountInfo {
+ unsigned line;
+ unsigned count;
+};
+
+static int compareOpcodeIndicesSampling(const void* left, const void* right)
+{
+ const OpcodeSampleInfo* leftSampleInfo = reinterpret_cast<const OpcodeSampleInfo*>(left);
+ const OpcodeSampleInfo* rightSampleInfo = reinterpret_cast<const OpcodeSampleInfo*>(right);
+
+ return (leftSampleInfo->count < rightSampleInfo->count) ? 1 : (leftSampleInfo->count > rightSampleInfo->count) ? -1 : 0;
+}
+
+#if ENABLE(CODEBLOCK_SAMPLING)
+static int compareLineCountInfoSampling(const void* left, const void* right)
+{
+ const LineCountInfo* leftLineCount = reinterpret_cast<const LineCountInfo*>(left);
+ const LineCountInfo* rightLineCount = reinterpret_cast<const LineCountInfo*>(right);
+
+ return (leftLineCount->line > rightLineCount->line) ? 1 : (leftLineCount->line < rightLineCount->line) ? -1 : 0;
+}
+
+static int compareScriptSampleRecords(const void* left, const void* right)
+{
+ const ScriptSampleRecord* const leftValue = *static_cast<const ScriptSampleRecord* const *>(left);
+ const ScriptSampleRecord* const rightValue = *static_cast<const ScriptSampleRecord* const *>(right);
+
+ return (leftValue->m_sampleCount < rightValue->m_sampleCount) ? 1 : (leftValue->m_sampleCount > rightValue->m_sampleCount) ? -1 : 0;
+}
+#endif
+
+void SamplingTool::dump(ExecState* exec)
+{
+ // Tidies up SunSpider output by removing short scripts - such a small number of samples would likely not be useful anyhow.
+ if (m_sampleCount < 10)
+ return;
+
+ // (1) Build and sort 'opcodeSampleInfo' array.
+
+ OpcodeSampleInfo opcodeSampleInfo[numOpcodeIDs];
+ for (int i = 0; i < numOpcodeIDs; ++i) {
+ opcodeSampleInfo[i].opcode = static_cast<OpcodeID>(i);
+ opcodeSampleInfo[i].count = m_opcodeSamples[i];
+ opcodeSampleInfo[i].countInCTIFunctions = m_opcodeSamplesInCTIFunctions[i];
+ }
+
+ qsort(opcodeSampleInfo, numOpcodeIDs, sizeof(OpcodeSampleInfo), compareOpcodeIndicesSampling);
+
+ // (2) Print Opcode sampling results.
+
+ printf("\nBytecode samples [*]\n");
+ printf(" sample %% of %% of | cti cti %%\n");
+ printf("opcode count VM total | count of self\n");
+ printf("------------------------------------------------------- | ----------------\n");
+
+ for (int i = 0; i < numOpcodeIDs; ++i) {
+ long long count = opcodeSampleInfo[i].count;
+ if (!count)
+ continue;
+
+ OpcodeID opcodeID = opcodeSampleInfo[i].opcode;
+
+ const char* opcodeName = opcodeNames[opcodeID];
+ const char* opcodePadding = padOpcodeName(opcodeID, 28);
+ double percentOfVM = (static_cast<double>(count) * 100) / m_opcodeSampleCount;
+ double percentOfTotal = (static_cast<double>(count) * 100) / m_sampleCount;
+ long long countInCTIFunctions = opcodeSampleInfo[i].countInCTIFunctions;
+ double percentInCTIFunctions = (static_cast<double>(countInCTIFunctions) * 100) / count;
+ fprintf(stdout, "%s:%s%-6lld %.3f%%\t%.3f%%\t | %-6lld %.3f%%\n", opcodeName, opcodePadding, count, percentOfVM, percentOfTotal, countInCTIFunctions, percentInCTIFunctions);
+ }
+
+ printf("\n[*] Samples inside host code are not charged to any Bytecode.\n\n");
+ printf("\tSamples inside VM:\t\t%lld / %lld (%.3f%%)\n", m_opcodeSampleCount, m_sampleCount, (static_cast<double>(m_opcodeSampleCount) * 100) / m_sampleCount);
+ printf("\tSamples inside host code:\t%lld / %lld (%.3f%%)\n\n", m_sampleCount - m_opcodeSampleCount, m_sampleCount, (static_cast<double>(m_sampleCount - m_opcodeSampleCount) * 100) / m_sampleCount);
+ printf("\tsample count:\tsamples inside this opcode\n");
+ printf("\t%% of VM:\tsample count / all opcode samples\n");
+ printf("\t%% of total:\tsample count / all samples\n");
+ printf("\t--------------\n");
+ printf("\tcti count:\tsamples inside a CTI function called by this opcode\n");
+ printf("\tcti %% of self:\tcti count / sample count\n");
+
+#if ENABLE(CODEBLOCK_SAMPLING)
+
+ // (3) Build and sort 'codeBlockSamples' array.
+
+ int scopeCount = m_scopeSampleMap->size();
+ Vector<ScriptSampleRecord*> codeBlockSamples(scopeCount);
+ ScriptSampleRecordMap::iterator iter = m_scopeSampleMap->begin();
+ for (int i = 0; i < scopeCount; ++i, ++iter)
+ codeBlockSamples[i] = iter->second;
+
+ qsort(codeBlockSamples.begin(), scopeCount, sizeof(ScriptSampleRecord*), compareScriptSampleRecords);
+
+ // (4) Print data from 'codeBlockSamples' array.
+
+ printf("\nCodeBlock samples\n\n");
+
+ for (int i = 0; i < scopeCount; ++i) {
+ ScriptSampleRecord* record = codeBlockSamples[i];
+ CodeBlock* codeBlock = record->m_codeBlock;
+
+ double blockPercent = (record->m_sampleCount * 100.0) / m_sampleCount;
+
+ if (blockPercent >= 1) {
+ //Instruction* code = codeBlock->instructions().begin();
+ printf("#%d: %s:%d: %d / %lld (%.3f%%)\n", i + 1, record->m_executable->sourceURL().utf8().data(), codeBlock->lineNumberForBytecodeOffset(0), record->m_sampleCount, m_sampleCount, blockPercent);
+ if (i < 10) {
+ HashMap<unsigned,unsigned> lineCounts;
+ codeBlock->dump(exec);
+
+ printf(" Opcode and line number samples [*]\n\n");
+ for (unsigned op = 0; op < record->m_size; ++op) {
+ int count = record->m_samples[op];
+ if (count) {
+ printf(" [% 4d] has sample count: % 4d\n", op, count);
+ unsigned line = codeBlock->lineNumberForBytecodeOffset(op);
+ lineCounts.set(line, (lineCounts.contains(line) ? lineCounts.get(line) : 0) + count);
+ }
+ }
+ printf("\n");
+
+ int linesCount = lineCounts.size();
+ Vector<LineCountInfo> lineCountInfo(linesCount);
+ int lineno = 0;
+ for (HashMap<unsigned,unsigned>::iterator iter = lineCounts.begin(); iter != lineCounts.end(); ++iter, ++lineno) {
+ lineCountInfo[lineno].line = iter->first;
+ lineCountInfo[lineno].count = iter->second;
+ }
+
+ qsort(lineCountInfo.begin(), linesCount, sizeof(LineCountInfo), compareLineCountInfoSampling);
+
+ for (lineno = 0; lineno < linesCount; ++lineno) {
+ printf(" Line #%d has sample count %d.\n", lineCountInfo[lineno].line, lineCountInfo[lineno].count);
+ }
+ printf("\n");
+ printf(" [*] Samples inside host code are charged to the calling Bytecode.\n");
+ printf(" Samples on a call / return boundary are not charged to a specific opcode or line.\n\n");
+ printf(" Samples on a call / return boundary: %d / %d (%.3f%%)\n\n", record->m_sampleCount - record->m_opcodeSampleCount, record->m_sampleCount, (static_cast<double>(record->m_sampleCount - record->m_opcodeSampleCount) * 100) / record->m_sampleCount);
+ }
+ }
+ }
+#else
+ UNUSED_PARAM(exec);
+#endif
+}
+
+#else
+
+void SamplingTool::dump(ExecState*)
+{
+}
+
+#endif
+
+void AbstractSamplingCounter::dump()
+{
+#if ENABLE(SAMPLING_COUNTERS)
+ if (s_abstractSamplingCounterChain != &s_abstractSamplingCounterChainEnd) {
+ printf("\nSampling Counter Values:\n");
+ for (AbstractSamplingCounter* currCounter = s_abstractSamplingCounterChain; (currCounter != &s_abstractSamplingCounterChainEnd); currCounter = currCounter->m_next)
+ printf("\t%s\t: %lld\n", currCounter->m_name, currCounter->m_counter);
+ printf("\n\n");
+ }
+ s_completed = true;
+#endif
+}
+
+AbstractSamplingCounter AbstractSamplingCounter::s_abstractSamplingCounterChainEnd;
+AbstractSamplingCounter* AbstractSamplingCounter::s_abstractSamplingCounterChain = &s_abstractSamplingCounterChainEnd;
+bool AbstractSamplingCounter::s_completed = false;
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/bytecode/SamplingTool.h b/Source/JavaScriptCore/bytecode/SamplingTool.h
new file mode 100644
index 0000000..8e3ed9e
--- /dev/null
+++ b/Source/JavaScriptCore/bytecode/SamplingTool.h
@@ -0,0 +1,414 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SamplingTool_h
+#define SamplingTool_h
+
+#include <wtf/Assertions.h>
+#include <wtf/HashMap.h>
+#include <wtf/Threading.h>
+
+#include "Nodes.h"
+#include "Opcode.h"
+
+namespace JSC {
+
+ class ScriptExecutable;
+
+ class SamplingFlags {
+ friend class JIT;
+ public:
+ static void start();
+ static void stop();
+
+#if ENABLE(SAMPLING_FLAGS)
+ static void setFlag(unsigned flag)
+ {
+ ASSERT(flag >= 1);
+ ASSERT(flag <= 32);
+ s_flags |= 1u << (flag - 1);
+ }
+
+ static void clearFlag(unsigned flag)
+ {
+ ASSERT(flag >= 1);
+ ASSERT(flag <= 32);
+ s_flags &= ~(1u << (flag - 1));
+ }
+
+ static void sample();
+
+ class ScopedFlag {
+ public:
+ ScopedFlag(int flag)
+ : m_flag(flag)
+ {
+ setFlag(flag);
+ }
+
+ ~ScopedFlag()
+ {
+ clearFlag(m_flag);
+ }
+
+ private:
+ int m_flag;
+ };
+
+#endif
+ private:
+ static uint32_t s_flags;
+#if ENABLE(SAMPLING_FLAGS)
+ static uint64_t s_flagCounts[33];
+#endif
+ };
+
+ class CodeBlock;
+ class ExecState;
+ class Interpreter;
+ class ScopeNode;
+ struct Instruction;
+
+ struct ScriptSampleRecord {
+ ScriptSampleRecord(ScriptExecutable* executable)
+ : m_executable(executable)
+ , m_codeBlock(0)
+ , m_sampleCount(0)
+ , m_opcodeSampleCount(0)
+ , m_samples(0)
+ , m_size(0)
+ {
+ }
+
+ ~ScriptSampleRecord()
+ {
+ if (m_samples)
+ free(m_samples);
+ }
+
+ void sample(CodeBlock*, Instruction*);
+
+ RefPtr<ScriptExecutable> m_executable;
+ CodeBlock* m_codeBlock;
+ int m_sampleCount;
+ int m_opcodeSampleCount;
+ int* m_samples;
+ unsigned m_size;
+ };
+
+ typedef WTF::HashMap<ScriptExecutable*, ScriptSampleRecord*> ScriptSampleRecordMap;
+
+ class SamplingThread {
+ public:
+ // Sampling thread state.
+ static bool s_running;
+ static unsigned s_hertz;
+ static ThreadIdentifier s_samplingThread;
+
+ static void start(unsigned hertz=10000);
+ static void stop();
+
+ static void* threadStartFunc(void*);
+ };
+
+ class SamplingTool {
+ public:
+ friend struct CallRecord;
+ friend class HostCallRecord;
+
+#if ENABLE(OPCODE_SAMPLING)
+ class CallRecord : public Noncopyable {
+ public:
+ CallRecord(SamplingTool* samplingTool)
+ : m_samplingTool(samplingTool)
+ , m_savedSample(samplingTool->m_sample)
+ , m_savedCodeBlock(samplingTool->m_codeBlock)
+ {
+ }
+
+ ~CallRecord()
+ {
+ m_samplingTool->m_sample = m_savedSample;
+ m_samplingTool->m_codeBlock = m_savedCodeBlock;
+ }
+
+ private:
+ SamplingTool* m_samplingTool;
+ intptr_t m_savedSample;
+ CodeBlock* m_savedCodeBlock;
+ };
+
+ class HostCallRecord : public CallRecord {
+ public:
+ HostCallRecord(SamplingTool* samplingTool)
+ : CallRecord(samplingTool)
+ {
+ samplingTool->m_sample |= 0x1;
+ }
+ };
+#else
+ class CallRecord : public Noncopyable {
+ public:
+ CallRecord(SamplingTool*)
+ {
+ }
+ };
+
+ class HostCallRecord : public CallRecord {
+ public:
+ HostCallRecord(SamplingTool* samplingTool)
+ : CallRecord(samplingTool)
+ {
+ }
+ };
+#endif
+
+ SamplingTool(Interpreter* interpreter)
+ : m_interpreter(interpreter)
+ , m_codeBlock(0)
+ , m_sample(0)
+ , m_sampleCount(0)
+ , m_opcodeSampleCount(0)
+#if ENABLE(CODEBLOCK_SAMPLING)
+ , m_scopeSampleMap(new ScriptSampleRecordMap())
+#endif
+ {
+ memset(m_opcodeSamples, 0, sizeof(m_opcodeSamples));
+ memset(m_opcodeSamplesInCTIFunctions, 0, sizeof(m_opcodeSamplesInCTIFunctions));
+ }
+
+ ~SamplingTool()
+ {
+#if ENABLE(CODEBLOCK_SAMPLING)
+ deleteAllValues(*m_scopeSampleMap);
+#endif
+ }
+
+ void setup();
+ void dump(ExecState*);
+
+ void notifyOfScope(ScriptExecutable* scope);
+
+ void sample(CodeBlock* codeBlock, Instruction* vPC)
+ {
+ ASSERT(!(reinterpret_cast<intptr_t>(vPC) & 0x3));
+ m_codeBlock = codeBlock;
+ m_sample = reinterpret_cast<intptr_t>(vPC);
+ }
+
+ CodeBlock** codeBlockSlot() { return &m_codeBlock; }
+ intptr_t* sampleSlot() { return &m_sample; }
+
+ void* encodeSample(Instruction* vPC, bool inCTIFunction = false, bool inHostFunction = false)
+ {
+ ASSERT(!(reinterpret_cast<intptr_t>(vPC) & 0x3));
+ return reinterpret_cast<void*>(reinterpret_cast<intptr_t>(vPC) | (static_cast<intptr_t>(inCTIFunction) << 1) | static_cast<intptr_t>(inHostFunction));
+ }
+
+ static void sample();
+
+ private:
+ class Sample {
+ public:
+ Sample(volatile intptr_t sample, CodeBlock* volatile codeBlock)
+ : m_sample(sample)
+ , m_codeBlock(codeBlock)
+ {
+ }
+
+ bool isNull() { return !m_sample; }
+ CodeBlock* codeBlock() { return m_codeBlock; }
+ Instruction* vPC() { return reinterpret_cast<Instruction*>(m_sample & ~0x3); }
+ bool inHostFunction() { return m_sample & 0x1; }
+ bool inCTIFunction() { return m_sample & 0x2; }
+
+ private:
+ intptr_t m_sample;
+ CodeBlock* m_codeBlock;
+ };
+
+ void doRun();
+ static SamplingTool* s_samplingTool;
+
+ Interpreter* m_interpreter;
+
+ // State tracked by the main thread, used by the sampling thread.
+ CodeBlock* m_codeBlock;
+ intptr_t m_sample;
+
+ // Gathered sample data.
+ long long m_sampleCount;
+ long long m_opcodeSampleCount;
+ unsigned m_opcodeSamples[numOpcodeIDs];
+ unsigned m_opcodeSamplesInCTIFunctions[numOpcodeIDs];
+
+#if ENABLE(CODEBLOCK_SAMPLING)
+ Mutex m_scriptSampleMapMutex;
+ OwnPtr<ScriptSampleRecordMap> m_scopeSampleMap;
+#endif
+ };
+
+ // AbstractSamplingCounter:
+ //
+ // Implements a named set of counters, printed on exit if ENABLE(SAMPLING_COUNTERS).
+ // See subclasses below, SamplingCounter, GlobalSamplingCounter and DeletableSamplingCounter.
+ class AbstractSamplingCounter {
+ friend class JIT;
+ friend class DeletableSamplingCounter;
+ public:
+ void count(uint32_t count = 1)
+ {
+ m_counter += count;
+ }
+
+ static void dump();
+
+ protected:
+ // Effectively the contructor, however called lazily in the case of GlobalSamplingCounter.
+ void init(const char* name)
+ {
+ m_counter = 0;
+ m_name = name;
+
+ // Set m_next to point to the head of the chain, and inform whatever is
+ // currently at the head that this node will now hold the pointer to it.
+ m_next = s_abstractSamplingCounterChain;
+ s_abstractSamplingCounterChain->m_referer = &m_next;
+ // Add this node to the head of the list.
+ s_abstractSamplingCounterChain = this;
+ m_referer = &s_abstractSamplingCounterChain;
+ }
+
+ int64_t m_counter;
+ const char* m_name;
+ AbstractSamplingCounter* m_next;
+ // This is a pointer to the pointer to this node in the chain; used to
+ // allow fast linked list deletion.
+ AbstractSamplingCounter** m_referer;
+ // Null object used to detect end of static chain.
+ static AbstractSamplingCounter s_abstractSamplingCounterChainEnd;
+ static AbstractSamplingCounter* s_abstractSamplingCounterChain;
+ static bool s_completed;
+ };
+
+#if ENABLE(SAMPLING_COUNTERS)
+ // SamplingCounter:
+ //
+ // This class is suitable and (hopefully!) convenient for cases where a counter is
+ // required within the scope of a single function. It can be instantiated as a
+ // static variable since it contains a constructor but not a destructor (static
+ // variables in WebKit cannot have destructors).
+ //
+ // For example:
+ //
+ // void someFunction()
+ // {
+ // static SamplingCounter countMe("This is my counter. There are many like it, but this one is mine.");
+ // countMe.count();
+ // // ...
+ // }
+ //
+ class SamplingCounter : public AbstractSamplingCounter {
+ public:
+ SamplingCounter(const char* name) { init(name); }
+ };
+
+ // GlobalSamplingCounter:
+ //
+ // This class is suitable for use where a counter is to be declared globally,
+ // since it contains neither a constructor nor destructor. Instead, ensure
+ // that 'name()' is called to provide the counter with a name (and also to
+ // allow it to be printed out on exit).
+ //
+ // GlobalSamplingCounter globalCounter;
+ //
+ // void firstFunction()
+ // {
+ // // Put this within a function that is definitely called!
+ // // (Or alternatively alongside all calls to 'count()').
+ // globalCounter.name("I Name You Destroyer.");
+ // globalCounter.count();
+ // // ...
+ // }
+ //
+ // void secondFunction()
+ // {
+ // globalCounter.count();
+ // // ...
+ // }
+ //
+ class GlobalSamplingCounter : public AbstractSamplingCounter {
+ public:
+ void name(const char* name)
+ {
+ // Global objects should be mapped in zero filled memory, so this should
+ // be a safe (albeit not necessarily threadsafe) check for 'first call'.
+ if (!m_next)
+ init(name);
+ }
+ };
+
+ // DeletableSamplingCounter:
+ //
+ // The above classes (SamplingCounter, GlobalSamplingCounter), are intended for
+ // use within a global or static scope, and as such cannot have a destructor.
+ // This means there is no convenient way for them to remove themselves from the
+ // static list of counters, and should an instance of either class be freed
+ // before 'dump()' has walked over the list it will potentially walk over an
+ // invalid pointer.
+ //
+ // This class is intended for use where the counter may possibly be deleted before
+ // the program exits. Should this occur, the counter will print it's value to
+ // stderr, and remove itself from the static list. Example:
+ //
+ // DeletableSamplingCounter* counter = new DeletableSamplingCounter("The Counter With No Name");
+ // counter->count();
+ // delete counter;
+ //
+ class DeletableSamplingCounter : public AbstractSamplingCounter {
+ public:
+ DeletableSamplingCounter(const char* name) { init(name); }
+
+ ~DeletableSamplingCounter()
+ {
+ if (!s_completed)
+ fprintf(stderr, "DeletableSamplingCounter \"%s\" deleted early (with count %lld)\n", m_name, m_counter);
+ // Our m_referer pointer should know where the pointer to this node is,
+ // and m_next should know that this node is the previous node in the list.
+ ASSERT(*m_referer == this);
+ ASSERT(m_next->m_referer == &m_next);
+ // Remove this node from the list, and inform m_next that we have done so.
+ m_next->m_referer = m_referer;
+ *m_referer = m_next;
+ }
+ };
+#endif
+
+} // namespace JSC
+
+#endif // SamplingTool_h
diff --git a/Source/JavaScriptCore/bytecode/StructureStubInfo.cpp b/Source/JavaScriptCore/bytecode/StructureStubInfo.cpp
new file mode 100644
index 0000000..018d832
--- /dev/null
+++ b/Source/JavaScriptCore/bytecode/StructureStubInfo.cpp
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "StructureStubInfo.h"
+
+namespace JSC {
+
+#if ENABLE(JIT)
+void StructureStubInfo::deref()
+{
+ switch (accessType) {
+ case access_get_by_id_self:
+ u.getByIdSelf.baseObjectStructure->deref();
+ return;
+ case access_get_by_id_proto:
+ u.getByIdProto.baseObjectStructure->deref();
+ u.getByIdProto.prototypeStructure->deref();
+ return;
+ case access_get_by_id_chain:
+ u.getByIdChain.baseObjectStructure->deref();
+ u.getByIdChain.chain->deref();
+ return;
+ case access_get_by_id_self_list: {
+ PolymorphicAccessStructureList* polymorphicStructures = u.getByIdSelfList.structureList;
+ polymorphicStructures->derefStructures(u.getByIdSelfList.listSize);
+ delete polymorphicStructures;
+ return;
+ }
+ case access_get_by_id_proto_list: {
+ PolymorphicAccessStructureList* polymorphicStructures = u.getByIdProtoList.structureList;
+ polymorphicStructures->derefStructures(u.getByIdProtoList.listSize);
+ delete polymorphicStructures;
+ return;
+ }
+ case access_put_by_id_transition:
+ u.putByIdTransition.previousStructure->deref();
+ u.putByIdTransition.structure->deref();
+ u.putByIdTransition.chain->deref();
+ return;
+ case access_put_by_id_replace:
+ u.putByIdReplace.baseObjectStructure->deref();
+ return;
+ case access_get_by_id:
+ case access_put_by_id:
+ case access_get_by_id_generic:
+ case access_put_by_id_generic:
+ case access_get_array_length:
+ case access_get_string_length:
+ // These instructions don't ref their Structures.
+ return;
+ default:
+ ASSERT_NOT_REACHED();
+ }
+}
+#endif
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/bytecode/StructureStubInfo.h b/Source/JavaScriptCore/bytecode/StructureStubInfo.h
new file mode 100644
index 0000000..8e2c489
--- /dev/null
+++ b/Source/JavaScriptCore/bytecode/StructureStubInfo.h
@@ -0,0 +1,185 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef StructureStubInfo_h
+#define StructureStubInfo_h
+
+#if ENABLE(JIT)
+
+#include "Instruction.h"
+#include "MacroAssembler.h"
+#include "Opcode.h"
+#include "Structure.h"
+
+namespace JSC {
+
+ enum AccessType {
+ access_get_by_id_self,
+ access_get_by_id_proto,
+ access_get_by_id_chain,
+ access_get_by_id_self_list,
+ access_get_by_id_proto_list,
+ access_put_by_id_transition,
+ access_put_by_id_replace,
+ access_get_by_id,
+ access_put_by_id,
+ access_get_by_id_generic,
+ access_put_by_id_generic,
+ access_get_array_length,
+ access_get_string_length,
+ };
+
+ struct StructureStubInfo {
+ StructureStubInfo(AccessType accessType)
+ : accessType(accessType)
+ , seen(false)
+ {
+ }
+
+ void initGetByIdSelf(Structure* baseObjectStructure)
+ {
+ accessType = access_get_by_id_self;
+
+ u.getByIdSelf.baseObjectStructure = baseObjectStructure;
+ baseObjectStructure->ref();
+ }
+
+ void initGetByIdProto(Structure* baseObjectStructure, Structure* prototypeStructure)
+ {
+ accessType = access_get_by_id_proto;
+
+ u.getByIdProto.baseObjectStructure = baseObjectStructure;
+ baseObjectStructure->ref();
+
+ u.getByIdProto.prototypeStructure = prototypeStructure;
+ prototypeStructure->ref();
+ }
+
+ void initGetByIdChain(Structure* baseObjectStructure, StructureChain* chain)
+ {
+ accessType = access_get_by_id_chain;
+
+ u.getByIdChain.baseObjectStructure = baseObjectStructure;
+ baseObjectStructure->ref();
+
+ u.getByIdChain.chain = chain;
+ chain->ref();
+ }
+
+ void initGetByIdSelfList(PolymorphicAccessStructureList* structureList, int listSize)
+ {
+ accessType = access_get_by_id_self_list;
+
+ u.getByIdProtoList.structureList = structureList;
+ u.getByIdProtoList.listSize = listSize;
+ }
+
+ void initGetByIdProtoList(PolymorphicAccessStructureList* structureList, int listSize)
+ {
+ accessType = access_get_by_id_proto_list;
+
+ u.getByIdProtoList.structureList = structureList;
+ u.getByIdProtoList.listSize = listSize;
+ }
+
+ // PutById*
+
+ void initPutByIdTransition(Structure* previousStructure, Structure* structure, StructureChain* chain)
+ {
+ accessType = access_put_by_id_transition;
+
+ u.putByIdTransition.previousStructure = previousStructure;
+ previousStructure->ref();
+
+ u.putByIdTransition.structure = structure;
+ structure->ref();
+
+ u.putByIdTransition.chain = chain;
+ chain->ref();
+ }
+
+ void initPutByIdReplace(Structure* baseObjectStructure)
+ {
+ accessType = access_put_by_id_replace;
+
+ u.putByIdReplace.baseObjectStructure = baseObjectStructure;
+ baseObjectStructure->ref();
+ }
+
+ void deref();
+
+ bool seenOnce()
+ {
+ return seen;
+ }
+
+ void setSeen()
+ {
+ seen = true;
+ }
+
+ int accessType : 31;
+ int seen : 1;
+
+ union {
+ struct {
+ Structure* baseObjectStructure;
+ } getByIdSelf;
+ struct {
+ Structure* baseObjectStructure;
+ Structure* prototypeStructure;
+ } getByIdProto;
+ struct {
+ Structure* baseObjectStructure;
+ StructureChain* chain;
+ } getByIdChain;
+ struct {
+ PolymorphicAccessStructureList* structureList;
+ int listSize;
+ } getByIdSelfList;
+ struct {
+ PolymorphicAccessStructureList* structureList;
+ int listSize;
+ } getByIdProtoList;
+ struct {
+ Structure* previousStructure;
+ Structure* structure;
+ StructureChain* chain;
+ } putByIdTransition;
+ struct {
+ Structure* baseObjectStructure;
+ } putByIdReplace;
+ } u;
+
+ CodeLocationLabel stubRoutine;
+ CodeLocationCall callReturnLocation;
+ CodeLocationLabel hotPathBegin;
+ };
+
+} // namespace JSC
+
+#endif
+
+#endif // StructureStubInfo_h
diff --git a/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp b/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
new file mode 100644
index 0000000..3a99957
--- /dev/null
+++ b/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
@@ -0,0 +1,2233 @@
+/*
+ * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2008 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "BytecodeGenerator.h"
+
+#include "BatchedTransitionOptimizer.h"
+#include "PrototypeFunction.h"
+#include "JSFunction.h"
+#include "Interpreter.h"
+#include "UString.h"
+
+using namespace std;
+
+namespace JSC {
+
+/*
+ The layout of a register frame looks like this:
+
+ For
+
+ function f(x, y) {
+ var v1;
+ function g() { }
+ var v2;
+ return (x) * (y);
+ }
+
+ assuming (x) and (y) generated temporaries t1 and t2, you would have
+
+ ------------------------------------
+ | x | y | g | v2 | v1 | t1 | t2 | <-- value held
+ ------------------------------------
+ | -5 | -4 | -3 | -2 | -1 | +0 | +1 | <-- register index
+ ------------------------------------
+ | params->|<-locals | temps->
+
+ Because temporary registers are allocated in a stack-like fashion, we
+ can reclaim them with a simple popping algorithm. The same goes for labels.
+ (We never reclaim parameter or local registers, because parameters and
+ locals are DontDelete.)
+
+ The register layout before a function call looks like this:
+
+ For
+
+ function f(x, y)
+ {
+ }
+
+ f(1);
+
+ > <------------------------------
+ < > reserved: call frame | 1 | <-- value held
+ > >snip< <------------------------------
+ < > +0 | +1 | +2 | +3 | +4 | +5 | <-- register index
+ > <------------------------------
+ | params->|<-locals | temps->
+
+ The call instruction fills in the "call frame" registers. It also pads
+ missing arguments at the end of the call:
+
+ > <-----------------------------------
+ < > reserved: call frame | 1 | ? | <-- value held ("?" stands for "undefined")
+ > >snip< <-----------------------------------
+ < > +0 | +1 | +2 | +3 | +4 | +5 | +6 | <-- register index
+ > <-----------------------------------
+ | params->|<-locals | temps->
+
+ After filling in missing arguments, the call instruction sets up the new
+ stack frame to overlap the end of the old stack frame:
+
+ |----------------------------------> <
+ | reserved: call frame | 1 | ? < > <-- value held ("?" stands for "undefined")
+ |----------------------------------> >snip< <
+ | -7 | -6 | -5 | -4 | -3 | -2 | -1 < > <-- register index
+ |----------------------------------> <
+ | | params->|<-locals | temps->
+
+ That way, arguments are "copied" into the callee's stack frame for free.
+
+ If the caller supplies too many arguments, this trick doesn't work. The
+ extra arguments protrude into space reserved for locals and temporaries.
+ In that case, the call instruction makes a real copy of the call frame header,
+ along with just the arguments expected by the callee, leaving the original
+ call frame header and arguments behind. (The call instruction can't just discard
+ extra arguments, because the "arguments" object may access them later.)
+ This copying strategy ensures that all named values will be at the indices
+ expected by the callee.
+*/
+
+#ifndef NDEBUG
+static bool s_dumpsGeneratedCode = false;
+#endif
+
+void BytecodeGenerator::setDumpsGeneratedCode(bool dumpsGeneratedCode)
+{
+#ifndef NDEBUG
+ s_dumpsGeneratedCode = dumpsGeneratedCode;
+#else
+ UNUSED_PARAM(dumpsGeneratedCode);
+#endif
+}
+
+bool BytecodeGenerator::dumpsGeneratedCode()
+{
+#ifndef NDEBUG
+ return s_dumpsGeneratedCode;
+#else
+ return false;
+#endif
+}
+
+void BytecodeGenerator::generate()
+{
+ m_codeBlock->setThisRegister(m_thisRegister.index());
+
+ m_scopeNode->emitBytecode(*this);
+
+#ifndef NDEBUG
+ m_codeBlock->setInstructionCount(m_codeBlock->instructions().size());
+
+ if (s_dumpsGeneratedCode)
+ m_codeBlock->dump(m_scopeChain->globalObject()->globalExec());
+#endif
+
+ if ((m_codeType == FunctionCode && !m_codeBlock->needsFullScopeChain() && !m_codeBlock->usesArguments()) || m_codeType == EvalCode)
+ symbolTable().clear();
+
+ m_codeBlock->shrinkToFit();
+}
+
+bool BytecodeGenerator::addVar(const Identifier& ident, bool isConstant, RegisterID*& r0)
+{
+ int index = m_calleeRegisters.size();
+ SymbolTableEntry newEntry(index, isConstant ? ReadOnly : 0);
+ pair<SymbolTable::iterator, bool> result = symbolTable().add(ident.impl(), newEntry);
+
+ if (!result.second) {
+ r0 = &registerFor(result.first->second.getIndex());
+ return false;
+ }
+
+ r0 = addVar();
+ return true;
+}
+
+bool BytecodeGenerator::addGlobalVar(const Identifier& ident, bool isConstant, RegisterID*& r0)
+{
+ int index = m_nextGlobalIndex;
+ SymbolTableEntry newEntry(index, isConstant ? ReadOnly : 0);
+ pair<SymbolTable::iterator, bool> result = symbolTable().add(ident.impl(), newEntry);
+
+ if (!result.second)
+ index = result.first->second.getIndex();
+ else {
+ --m_nextGlobalIndex;
+ m_globals.append(index + m_globalVarStorageOffset);
+ }
+
+ r0 = &registerFor(index);
+ return result.second;
+}
+
+void BytecodeGenerator::preserveLastVar()
+{
+ if ((m_firstConstantIndex = m_calleeRegisters.size()) != 0)
+ m_lastVar = &m_calleeRegisters.last();
+}
+
+BytecodeGenerator::BytecodeGenerator(ProgramNode* programNode, const ScopeChain& scopeChain, SymbolTable* symbolTable, ProgramCodeBlock* codeBlock)
+ : m_shouldEmitDebugHooks(scopeChain.globalObject()->debugger())
+ , m_shouldEmitProfileHooks(scopeChain.globalObject()->supportsProfiling())
+ , m_shouldEmitRichSourceInfo(scopeChain.globalObject()->supportsRichSourceInfo())
+ , m_scopeChain(&scopeChain)
+ , m_symbolTable(symbolTable)
+ , m_scopeNode(programNode)
+ , m_codeBlock(codeBlock)
+ , m_thisRegister(RegisterFile::ProgramCodeThisRegister)
+ , m_finallyDepth(0)
+ , m_dynamicScopeDepth(0)
+ , m_baseScopeDepth(0)
+ , m_codeType(GlobalCode)
+ , m_nextGlobalIndex(-1)
+ , m_nextConstantOffset(0)
+ , m_globalConstantIndex(0)
+ , m_hasCreatedActivation(true)
+ , m_firstLazyFunction(0)
+ , m_lastLazyFunction(0)
+ , m_globalData(&scopeChain.globalObject()->globalData())
+ , m_lastOpcodeID(op_end)
+#ifndef NDEBUG
+ , m_lastOpcodePosition(0)
+#endif
+ , m_stack(m_globalData->stack())
+ , m_usesExceptions(false)
+ , m_regeneratingForExceptionInfo(false)
+ , m_codeBlockBeingRegeneratedFrom(0)
+{
+ if (m_shouldEmitDebugHooks)
+ m_codeBlock->setNeedsFullScopeChain(true);
+
+ emitOpcode(op_enter);
+ codeBlock->setGlobalData(m_globalData);
+
+ // FIXME: Move code that modifies the global object to Interpreter::execute.
+
+ m_codeBlock->m_numParameters = 1; // Allocate space for "this"
+
+ JSGlobalObject* globalObject = scopeChain.globalObject();
+ ExecState* exec = globalObject->globalExec();
+ RegisterFile* registerFile = &exec->globalData().interpreter->registerFile();
+
+ // Shift register indexes in generated code to elide registers allocated by intermediate stack frames.
+ m_globalVarStorageOffset = -RegisterFile::CallFrameHeaderSize - m_codeBlock->m_numParameters - registerFile->size();
+
+ // Add previously defined symbols to bookkeeping.
+ m_globals.grow(symbolTable->size());
+ SymbolTable::iterator end = symbolTable->end();
+ for (SymbolTable::iterator it = symbolTable->begin(); it != end; ++it)
+ registerFor(it->second.getIndex()).setIndex(it->second.getIndex() + m_globalVarStorageOffset);
+
+ BatchedTransitionOptimizer optimizer(globalObject);
+
+ const VarStack& varStack = programNode->varStack();
+ const FunctionStack& functionStack = programNode->functionStack();
+ bool canOptimizeNewGlobals = symbolTable->size() + functionStack.size() + varStack.size() < registerFile->maxGlobals();
+ if (canOptimizeNewGlobals) {
+ // Shift new symbols so they get stored prior to existing symbols.
+ m_nextGlobalIndex -= symbolTable->size();
+
+ for (size_t i = 0; i < functionStack.size(); ++i) {
+ FunctionBodyNode* function = functionStack[i];
+ globalObject->removeDirect(function->ident()); // Make sure our new function is not shadowed by an old property.
+ emitNewFunction(addGlobalVar(function->ident(), false), function);
+ }
+
+ Vector<RegisterID*, 32> newVars;
+ for (size_t i = 0; i < varStack.size(); ++i)
+ if (!globalObject->hasProperty(exec, *varStack[i].first))
+ newVars.append(addGlobalVar(*varStack[i].first, varStack[i].second & DeclarationStacks::IsConstant));
+
+ preserveLastVar();
+
+ for (size_t i = 0; i < newVars.size(); ++i)
+ emitLoad(newVars[i], jsUndefined());
+ } else {
+ for (size_t i = 0; i < functionStack.size(); ++i) {
+ FunctionBodyNode* function = functionStack[i];
+ globalObject->putWithAttributes(exec, function->ident(), new (exec) JSFunction(exec, makeFunction(exec, function), scopeChain.node()), DontDelete);
+ }
+ for (size_t i = 0; i < varStack.size(); ++i) {
+ if (globalObject->hasProperty(exec, *varStack[i].first))
+ continue;
+ int attributes = DontDelete;
+ if (varStack[i].second & DeclarationStacks::IsConstant)
+ attributes |= ReadOnly;
+ globalObject->putWithAttributes(exec, *varStack[i].first, jsUndefined(), attributes);
+ }
+
+ preserveLastVar();
+ }
+ codeBlock->m_numCapturedVars = codeBlock->m_numVars;
+}
+
+BytecodeGenerator::BytecodeGenerator(FunctionBodyNode* functionBody, const ScopeChain& scopeChain, SymbolTable* symbolTable, CodeBlock* codeBlock)
+ : m_shouldEmitDebugHooks(scopeChain.globalObject()->debugger())
+ , m_shouldEmitProfileHooks(scopeChain.globalObject()->supportsProfiling())
+ , m_shouldEmitRichSourceInfo(scopeChain.globalObject()->supportsRichSourceInfo())
+ , m_scopeChain(&scopeChain)
+ , m_symbolTable(symbolTable)
+ , m_scopeNode(functionBody)
+ , m_codeBlock(codeBlock)
+ , m_activationRegister(0)
+ , m_finallyDepth(0)
+ , m_dynamicScopeDepth(0)
+ , m_baseScopeDepth(0)
+ , m_codeType(FunctionCode)
+ , m_nextConstantOffset(0)
+ , m_globalConstantIndex(0)
+ , m_hasCreatedActivation(false)
+ , m_firstLazyFunction(0)
+ , m_lastLazyFunction(0)
+ , m_globalData(&scopeChain.globalObject()->globalData())
+ , m_lastOpcodeID(op_end)
+#ifndef NDEBUG
+ , m_lastOpcodePosition(0)
+#endif
+ , m_stack(m_globalData->stack())
+ , m_usesExceptions(false)
+ , m_regeneratingForExceptionInfo(false)
+ , m_codeBlockBeingRegeneratedFrom(0)
+{
+ if (m_shouldEmitDebugHooks)
+ m_codeBlock->setNeedsFullScopeChain(true);
+
+ codeBlock->setGlobalData(m_globalData);
+
+ emitOpcode(op_enter);
+ if (m_codeBlock->needsFullScopeChain()) {
+ m_activationRegister = addVar();
+ emitInitLazyRegister(m_activationRegister);
+ m_codeBlock->setActivationRegister(m_activationRegister->index());
+ }
+
+ // Both op_tear_off_activation and op_tear_off_arguments tear off the 'arguments'
+ // object, if created.
+ if (m_codeBlock->needsFullScopeChain() || functionBody->usesArguments()) {
+ RegisterID* unmodifiedArgumentsRegister = addVar(); // Anonymous, so it can't be modified by user code.
+ RegisterID* argumentsRegister = addVar(propertyNames().arguments, false); // Can be changed by assigning to 'arguments'.
+
+ // We can save a little space by hard-coding the knowledge that the two
+ // 'arguments' values are stored in consecutive registers, and storing
+ // only the index of the assignable one.
+ codeBlock->setArgumentsRegister(argumentsRegister->index());
+ ASSERT_UNUSED(unmodifiedArgumentsRegister, unmodifiedArgumentsRegister->index() == JSC::unmodifiedArgumentsRegister(codeBlock->argumentsRegister()));
+
+ emitInitLazyRegister(argumentsRegister);
+ emitInitLazyRegister(unmodifiedArgumentsRegister);
+
+ if (m_codeBlock->isStrictMode()) {
+ emitOpcode(op_create_arguments);
+ instructions().append(argumentsRegister->index());
+ }
+
+ // The debugger currently retrieves the arguments object from an activation rather than pulling
+ // it from a call frame. In the long-term it should stop doing that (<rdar://problem/6911886>),
+ // but for now we force eager creation of the arguments object when debugging.
+ if (m_shouldEmitDebugHooks) {
+ emitOpcode(op_create_arguments);
+ instructions().append(argumentsRegister->index());
+ }
+ }
+
+ const DeclarationStacks::FunctionStack& functionStack = functionBody->functionStack();
+ const DeclarationStacks::VarStack& varStack = functionBody->varStack();
+
+ // Captured variables and functions go first so that activations don't have
+ // to step over the non-captured locals to mark them.
+ m_hasCreatedActivation = false;
+ if (functionBody->hasCapturedVariables()) {
+ for (size_t i = 0; i < functionStack.size(); ++i) {
+ FunctionBodyNode* function = functionStack[i];
+ const Identifier& ident = function->ident();
+ if (functionBody->captures(ident)) {
+ if (!m_hasCreatedActivation) {
+ m_hasCreatedActivation = true;
+ emitOpcode(op_create_activation);
+ instructions().append(m_activationRegister->index());
+ }
+ m_functions.add(ident.impl());
+ emitNewFunction(addVar(ident, false), function);
+ }
+ }
+ for (size_t i = 0; i < varStack.size(); ++i) {
+ const Identifier& ident = *varStack[i].first;
+ if (functionBody->captures(ident))
+ addVar(ident, varStack[i].second & DeclarationStacks::IsConstant);
+ }
+ }
+ bool canLazilyCreateFunctions = !functionBody->needsActivationForMoreThanVariables() && !m_shouldEmitDebugHooks;
+ if (!canLazilyCreateFunctions && !m_hasCreatedActivation) {
+ m_hasCreatedActivation = true;
+ emitOpcode(op_create_activation);
+ instructions().append(m_activationRegister->index());
+ }
+
+ codeBlock->m_numCapturedVars = codeBlock->m_numVars;
+ m_firstLazyFunction = codeBlock->m_numVars;
+ for (size_t i = 0; i < functionStack.size(); ++i) {
+ FunctionBodyNode* function = functionStack[i];
+ const Identifier& ident = function->ident();
+ if (!functionBody->captures(ident)) {
+ m_functions.add(ident.impl());
+ RefPtr<RegisterID> reg = addVar(ident, false);
+ // Don't lazily create functions that override the name 'arguments'
+ // as this would complicate lazy instantiation of actual arguments.
+ if (!canLazilyCreateFunctions || ident == propertyNames().arguments)
+ emitNewFunction(reg.get(), function);
+ else {
+ emitInitLazyRegister(reg.get());
+ m_lazyFunctions.set(reg->index(), function);
+ }
+ }
+ }
+ m_lastLazyFunction = canLazilyCreateFunctions ? codeBlock->m_numVars : m_firstLazyFunction;
+ for (size_t i = 0; i < varStack.size(); ++i) {
+ const Identifier& ident = *varStack[i].first;
+ if (!functionBody->captures(ident))
+ addVar(ident, varStack[i].second & DeclarationStacks::IsConstant);
+ }
+
+ if (m_shouldEmitDebugHooks)
+ codeBlock->m_numCapturedVars = codeBlock->m_numVars;
+
+ FunctionParameters& parameters = *functionBody->parameters();
+ size_t parameterCount = parameters.size();
+ int nextParameterIndex = -RegisterFile::CallFrameHeaderSize - parameterCount - 1;
+ m_parameters.grow(1 + parameterCount); // reserve space for "this"
+
+ // Add "this" as a parameter
+ m_thisRegister.setIndex(nextParameterIndex);
+ ++m_codeBlock->m_numParameters;
+
+ for (size_t i = 0; i < parameterCount; ++i)
+ addParameter(parameters[i], ++nextParameterIndex);
+
+ preserveLastVar();
+
+ if (isConstructor()) {
+ RefPtr<RegisterID> func = newTemporary();
+ RefPtr<RegisterID> funcProto = newTemporary();
+
+ emitOpcode(op_get_callee);
+ instructions().append(func->index());
+ // Load prototype.
+ emitGetById(funcProto.get(), func.get(), globalData()->propertyNames->prototype);
+
+ emitOpcode(op_create_this);
+ instructions().append(m_thisRegister.index());
+ instructions().append(funcProto->index());
+ } else if (functionBody->usesThis() || m_shouldEmitDebugHooks) {
+ if (codeBlock->isStrictMode())
+ emitOpcode(op_convert_this_strict);
+ else
+ emitOpcode(op_convert_this);
+ instructions().append(m_thisRegister.index());
+ }
+}
+
+BytecodeGenerator::BytecodeGenerator(EvalNode* evalNode, const ScopeChain& scopeChain, SymbolTable* symbolTable, EvalCodeBlock* codeBlock)
+ : m_shouldEmitDebugHooks(scopeChain.globalObject()->debugger())
+ , m_shouldEmitProfileHooks(scopeChain.globalObject()->supportsProfiling())
+ , m_shouldEmitRichSourceInfo(scopeChain.globalObject()->supportsRichSourceInfo())
+ , m_scopeChain(&scopeChain)
+ , m_symbolTable(symbolTable)
+ , m_scopeNode(evalNode)
+ , m_codeBlock(codeBlock)
+ , m_thisRegister(RegisterFile::ProgramCodeThisRegister)
+ , m_finallyDepth(0)
+ , m_dynamicScopeDepth(0)
+ , m_baseScopeDepth(codeBlock->baseScopeDepth())
+ , m_codeType(EvalCode)
+ , m_nextConstantOffset(0)
+ , m_globalConstantIndex(0)
+ , m_hasCreatedActivation(true)
+ , m_firstLazyFunction(0)
+ , m_lastLazyFunction(0)
+ , m_globalData(&scopeChain.globalObject()->globalData())
+ , m_lastOpcodeID(op_end)
+#ifndef NDEBUG
+ , m_lastOpcodePosition(0)
+#endif
+ , m_stack(m_globalData->stack())
+ , m_usesExceptions(false)
+ , m_regeneratingForExceptionInfo(false)
+ , m_codeBlockBeingRegeneratedFrom(0)
+{
+ if (m_shouldEmitDebugHooks || m_baseScopeDepth)
+ m_codeBlock->setNeedsFullScopeChain(true);
+
+ emitOpcode(op_enter);
+ codeBlock->setGlobalData(m_globalData);
+ m_codeBlock->m_numParameters = 1; // Allocate space for "this"
+
+ const DeclarationStacks::FunctionStack& functionStack = evalNode->functionStack();
+ for (size_t i = 0; i < functionStack.size(); ++i)
+ m_codeBlock->addFunctionDecl(makeFunction(m_globalData, functionStack[i]));
+
+ const DeclarationStacks::VarStack& varStack = evalNode->varStack();
+ unsigned numVariables = varStack.size();
+ Vector<Identifier> variables;
+ variables.reserveCapacity(numVariables);
+ for (size_t i = 0; i < numVariables; ++i)
+ variables.append(*varStack[i].first);
+ codeBlock->adoptVariables(variables);
+ codeBlock->m_numCapturedVars = codeBlock->m_numVars;
+ preserveLastVar();
+}
+
+RegisterID* BytecodeGenerator::emitInitLazyRegister(RegisterID* reg)
+{
+ emitOpcode(op_init_lazy_reg);
+ instructions().append(reg->index());
+ return reg;
+}
+
+void BytecodeGenerator::addParameter(const Identifier& ident, int parameterIndex)
+{
+ // Parameters overwrite var declarations, but not function declarations.
+ StringImpl* rep = ident.impl();
+ if (!m_functions.contains(rep)) {
+ symbolTable().set(rep, parameterIndex);
+ RegisterID& parameter = registerFor(parameterIndex);
+ parameter.setIndex(parameterIndex);
+ }
+
+ // To maintain the calling convention, we have to allocate unique space for
+ // each parameter, even if the parameter doesn't make it into the symbol table.
+ ++m_codeBlock->m_numParameters;
+}
+
+RegisterID* BytecodeGenerator::registerFor(const Identifier& ident)
+{
+ if (ident == propertyNames().thisIdentifier)
+ return &m_thisRegister;
+
+ if (!shouldOptimizeLocals())
+ return 0;
+
+ SymbolTableEntry entry = symbolTable().get(ident.impl());
+ if (entry.isNull())
+ return 0;
+
+ if (ident == propertyNames().arguments)
+ createArgumentsIfNecessary();
+
+ return createLazyRegisterIfNecessary(&registerFor(entry.getIndex()));
+}
+
+bool BytecodeGenerator::willResolveToArguments(const Identifier& ident)
+{
+ if (ident != propertyNames().arguments)
+ return false;
+
+ if (!shouldOptimizeLocals())
+ return false;
+
+ SymbolTableEntry entry = symbolTable().get(ident.impl());
+ if (entry.isNull())
+ return false;
+
+ if (m_codeBlock->usesArguments() && m_codeType == FunctionCode)
+ return true;
+
+ return false;
+}
+
+RegisterID* BytecodeGenerator::uncheckedRegisterForArguments()
+{
+ ASSERT(willResolveToArguments(propertyNames().arguments));
+
+ SymbolTableEntry entry = symbolTable().get(propertyNames().arguments.impl());
+ ASSERT(!entry.isNull());
+ return &registerFor(entry.getIndex());
+}
+
+RegisterID* BytecodeGenerator::createLazyRegisterIfNecessary(RegisterID* reg)
+{
+ if (m_lastLazyFunction <= reg->index() || reg->index() < m_firstLazyFunction)
+ return reg;
+ emitLazyNewFunction(reg, m_lazyFunctions.get(reg->index()));
+ return reg;
+}
+
+RegisterID* BytecodeGenerator::constRegisterFor(const Identifier& ident)
+{
+ if (m_codeType == EvalCode)
+ return 0;
+
+ SymbolTableEntry entry = symbolTable().get(ident.impl());
+ if (entry.isNull())
+ return 0;
+
+ return createLazyRegisterIfNecessary(&registerFor(entry.getIndex()));
+}
+
+bool BytecodeGenerator::isLocal(const Identifier& ident)
+{
+ if (ident == propertyNames().thisIdentifier)
+ return true;
+
+ return shouldOptimizeLocals() && symbolTable().contains(ident.impl());
+}
+
+bool BytecodeGenerator::isLocalConstant(const Identifier& ident)
+{
+ return symbolTable().get(ident.impl()).isReadOnly();
+}
+
+RegisterID* BytecodeGenerator::newRegister()
+{
+ m_calleeRegisters.append(m_calleeRegisters.size());
+ m_codeBlock->m_numCalleeRegisters = max<int>(m_codeBlock->m_numCalleeRegisters, m_calleeRegisters.size());
+ return &m_calleeRegisters.last();
+}
+
+RegisterID* BytecodeGenerator::newTemporary()
+{
+ // Reclaim free register IDs.
+ while (m_calleeRegisters.size() && !m_calleeRegisters.last().refCount())
+ m_calleeRegisters.removeLast();
+
+ RegisterID* result = newRegister();
+ result->setTemporary();
+ return result;
+}
+
+RegisterID* BytecodeGenerator::highestUsedRegister()
+{
+ size_t count = m_codeBlock->m_numCalleeRegisters;
+ while (m_calleeRegisters.size() < count)
+ newRegister();
+ return &m_calleeRegisters.last();
+}
+
+PassRefPtr<LabelScope> BytecodeGenerator::newLabelScope(LabelScope::Type type, const Identifier* name)
+{
+ // Reclaim free label scopes.
+ while (m_labelScopes.size() && !m_labelScopes.last().refCount())
+ m_labelScopes.removeLast();
+
+ // Allocate new label scope.
+ LabelScope scope(type, name, scopeDepth(), newLabel(), type == LabelScope::Loop ? newLabel() : PassRefPtr<Label>()); // Only loops have continue targets.
+ m_labelScopes.append(scope);
+ return &m_labelScopes.last();
+}
+
+PassRefPtr<Label> BytecodeGenerator::newLabel()
+{
+ // Reclaim free label IDs.
+ while (m_labels.size() && !m_labels.last().refCount())
+ m_labels.removeLast();
+
+ // Allocate new label ID.
+ m_labels.append(m_codeBlock);
+ return &m_labels.last();
+}
+
+PassRefPtr<Label> BytecodeGenerator::emitLabel(Label* l0)
+{
+ unsigned newLabelIndex = instructions().size();
+ l0->setLocation(newLabelIndex);
+
+ if (m_codeBlock->numberOfJumpTargets()) {
+ unsigned lastLabelIndex = m_codeBlock->lastJumpTarget();
+ ASSERT(lastLabelIndex <= newLabelIndex);
+ if (newLabelIndex == lastLabelIndex) {
+ // Peephole optimizations have already been disabled by emitting the last label
+ return l0;
+ }
+ }
+
+ m_codeBlock->addJumpTarget(newLabelIndex);
+
+ // This disables peephole optimizations when an instruction is a jump target
+ m_lastOpcodeID = op_end;
+ return l0;
+}
+
+void BytecodeGenerator::emitOpcode(OpcodeID opcodeID)
+{
+#ifndef NDEBUG
+ size_t opcodePosition = instructions().size();
+ ASSERT(opcodePosition - m_lastOpcodePosition == opcodeLength(m_lastOpcodeID) || m_lastOpcodeID == op_end);
+ m_lastOpcodePosition = opcodePosition;
+#endif
+ instructions().append(globalData()->interpreter->getOpcode(opcodeID));
+ m_lastOpcodeID = opcodeID;
+}
+
+void BytecodeGenerator::retrieveLastBinaryOp(int& dstIndex, int& src1Index, int& src2Index)
+{
+ ASSERT(instructions().size() >= 4);
+ size_t size = instructions().size();
+ dstIndex = instructions().at(size - 3).u.operand;
+ src1Index = instructions().at(size - 2).u.operand;
+ src2Index = instructions().at(size - 1).u.operand;
+}
+
+void BytecodeGenerator::retrieveLastUnaryOp(int& dstIndex, int& srcIndex)
+{
+ ASSERT(instructions().size() >= 3);
+ size_t size = instructions().size();
+ dstIndex = instructions().at(size - 2).u.operand;
+ srcIndex = instructions().at(size - 1).u.operand;
+}
+
+void ALWAYS_INLINE BytecodeGenerator::rewindBinaryOp()
+{
+ ASSERT(instructions().size() >= 4);
+ instructions().shrink(instructions().size() - 4);
+ m_lastOpcodeID = op_end;
+}
+
+void ALWAYS_INLINE BytecodeGenerator::rewindUnaryOp()
+{
+ ASSERT(instructions().size() >= 3);
+ instructions().shrink(instructions().size() - 3);
+ m_lastOpcodeID = op_end;
+}
+
+PassRefPtr<Label> BytecodeGenerator::emitJump(Label* target)
+{
+ size_t begin = instructions().size();
+ emitOpcode(target->isForward() ? op_jmp : op_loop);
+ instructions().append(target->bind(begin, instructions().size()));
+ return target;
+}
+
+PassRefPtr<Label> BytecodeGenerator::emitJumpIfTrue(RegisterID* cond, Label* target)
+{
+ if (m_lastOpcodeID == op_less) {
+ int dstIndex;
+ int src1Index;
+ int src2Index;
+
+ retrieveLastBinaryOp(dstIndex, src1Index, src2Index);
+
+ if (cond->index() == dstIndex && cond->isTemporary() && !cond->refCount()) {
+ rewindBinaryOp();
+
+ size_t begin = instructions().size();
+ emitOpcode(target->isForward() ? op_jless : op_loop_if_less);
+ instructions().append(src1Index);
+ instructions().append(src2Index);
+ instructions().append(target->bind(begin, instructions().size()));
+ return target;
+ }
+ } else if (m_lastOpcodeID == op_lesseq) {
+ int dstIndex;
+ int src1Index;
+ int src2Index;
+
+ retrieveLastBinaryOp(dstIndex, src1Index, src2Index);
+
+ if (cond->index() == dstIndex && cond->isTemporary() && !cond->refCount()) {
+ rewindBinaryOp();
+
+ size_t begin = instructions().size();
+ emitOpcode(target->isForward() ? op_jlesseq : op_loop_if_lesseq);
+ instructions().append(src1Index);
+ instructions().append(src2Index);
+ instructions().append(target->bind(begin, instructions().size()));
+ return target;
+ }
+ } else if (m_lastOpcodeID == op_eq_null && target->isForward()) {
+ int dstIndex;
+ int srcIndex;
+
+ retrieveLastUnaryOp(dstIndex, srcIndex);
+
+ if (cond->index() == dstIndex && cond->isTemporary() && !cond->refCount()) {
+ rewindUnaryOp();
+
+ size_t begin = instructions().size();
+ emitOpcode(op_jeq_null);
+ instructions().append(srcIndex);
+ instructions().append(target->bind(begin, instructions().size()));
+ return target;
+ }
+ } else if (m_lastOpcodeID == op_neq_null && target->isForward()) {
+ int dstIndex;
+ int srcIndex;
+
+ retrieveLastUnaryOp(dstIndex, srcIndex);
+
+ if (cond->index() == dstIndex && cond->isTemporary() && !cond->refCount()) {
+ rewindUnaryOp();
+
+ size_t begin = instructions().size();
+ emitOpcode(op_jneq_null);
+ instructions().append(srcIndex);
+ instructions().append(target->bind(begin, instructions().size()));
+ return target;
+ }
+ }
+
+ size_t begin = instructions().size();
+
+ emitOpcode(target->isForward() ? op_jtrue : op_loop_if_true);
+ instructions().append(cond->index());
+ instructions().append(target->bind(begin, instructions().size()));
+ return target;
+}
+
+PassRefPtr<Label> BytecodeGenerator::emitJumpIfFalse(RegisterID* cond, Label* target)
+{
+ if (m_lastOpcodeID == op_less && target->isForward()) {
+ int dstIndex;
+ int src1Index;
+ int src2Index;
+
+ retrieveLastBinaryOp(dstIndex, src1Index, src2Index);
+
+ if (cond->index() == dstIndex && cond->isTemporary() && !cond->refCount()) {
+ rewindBinaryOp();
+
+ size_t begin = instructions().size();
+ emitOpcode(op_jnless);
+ instructions().append(src1Index);
+ instructions().append(src2Index);
+ instructions().append(target->bind(begin, instructions().size()));
+ return target;
+ }
+ } else if (m_lastOpcodeID == op_lesseq && target->isForward()) {
+ int dstIndex;
+ int src1Index;
+ int src2Index;
+
+ retrieveLastBinaryOp(dstIndex, src1Index, src2Index);
+
+ if (cond->index() == dstIndex && cond->isTemporary() && !cond->refCount()) {
+ rewindBinaryOp();
+
+ size_t begin = instructions().size();
+ emitOpcode(op_jnlesseq);
+ instructions().append(src1Index);
+ instructions().append(src2Index);
+ instructions().append(target->bind(begin, instructions().size()));
+ return target;
+ }
+ } else if (m_lastOpcodeID == op_not) {
+ int dstIndex;
+ int srcIndex;
+
+ retrieveLastUnaryOp(dstIndex, srcIndex);
+
+ if (cond->index() == dstIndex && cond->isTemporary() && !cond->refCount()) {
+ rewindUnaryOp();
+
+ size_t begin = instructions().size();
+ emitOpcode(target->isForward() ? op_jtrue : op_loop_if_true);
+ instructions().append(srcIndex);
+ instructions().append(target->bind(begin, instructions().size()));
+ return target;
+ }
+ } else if (m_lastOpcodeID == op_eq_null && target->isForward()) {
+ int dstIndex;
+ int srcIndex;
+
+ retrieveLastUnaryOp(dstIndex, srcIndex);
+
+ if (cond->index() == dstIndex && cond->isTemporary() && !cond->refCount()) {
+ rewindUnaryOp();
+
+ size_t begin = instructions().size();
+ emitOpcode(op_jneq_null);
+ instructions().append(srcIndex);
+ instructions().append(target->bind(begin, instructions().size()));
+ return target;
+ }
+ } else if (m_lastOpcodeID == op_neq_null && target->isForward()) {
+ int dstIndex;
+ int srcIndex;
+
+ retrieveLastUnaryOp(dstIndex, srcIndex);
+
+ if (cond->index() == dstIndex && cond->isTemporary() && !cond->refCount()) {
+ rewindUnaryOp();
+
+ size_t begin = instructions().size();
+ emitOpcode(op_jeq_null);
+ instructions().append(srcIndex);
+ instructions().append(target->bind(begin, instructions().size()));
+ return target;
+ }
+ }
+
+ size_t begin = instructions().size();
+ emitOpcode(target->isForward() ? op_jfalse : op_loop_if_false);
+ instructions().append(cond->index());
+ instructions().append(target->bind(begin, instructions().size()));
+ return target;
+}
+
+PassRefPtr<Label> BytecodeGenerator::emitJumpIfNotFunctionCall(RegisterID* cond, Label* target)
+{
+ size_t begin = instructions().size();
+
+ emitOpcode(op_jneq_ptr);
+ instructions().append(cond->index());
+ instructions().append(m_scopeChain->globalObject()->d()->callFunction);
+ instructions().append(target->bind(begin, instructions().size()));
+ return target;
+}
+
+PassRefPtr<Label> BytecodeGenerator::emitJumpIfNotFunctionApply(RegisterID* cond, Label* target)
+{
+ size_t begin = instructions().size();
+
+ emitOpcode(op_jneq_ptr);
+ instructions().append(cond->index());
+ instructions().append(m_scopeChain->globalObject()->d()->applyFunction);
+ instructions().append(target->bind(begin, instructions().size()));
+ return target;
+}
+
+unsigned BytecodeGenerator::addConstant(const Identifier& ident)
+{
+ StringImpl* rep = ident.impl();
+ pair<IdentifierMap::iterator, bool> result = m_identifierMap.add(rep, m_codeBlock->numberOfIdentifiers());
+ if (result.second) // new entry
+ m_codeBlock->addIdentifier(Identifier(m_globalData, rep));
+
+ return result.first->second;
+}
+
+RegisterID* BytecodeGenerator::addConstantValue(JSValue v)
+{
+ int index = m_nextConstantOffset;
+
+ pair<JSValueMap::iterator, bool> result = m_jsValueMap.add(JSValue::encode(v), m_nextConstantOffset);
+ if (result.second) {
+ m_constantPoolRegisters.append(FirstConstantRegisterIndex + m_nextConstantOffset);
+ ++m_nextConstantOffset;
+ m_codeBlock->addConstantRegister(JSValue(v));
+ } else
+ index = result.first->second;
+
+ return &m_constantPoolRegisters[index];
+}
+
+unsigned BytecodeGenerator::addRegExp(RegExp* r)
+{
+ return m_codeBlock->addRegExp(r);
+}
+
+RegisterID* BytecodeGenerator::emitMove(RegisterID* dst, RegisterID* src)
+{
+ emitOpcode(op_mov);
+ instructions().append(dst->index());
+ instructions().append(src->index());
+ return dst;
+}
+
+RegisterID* BytecodeGenerator::emitUnaryOp(OpcodeID opcodeID, RegisterID* dst, RegisterID* src)
+{
+ emitOpcode(opcodeID);
+ instructions().append(dst->index());
+ instructions().append(src->index());
+ return dst;
+}
+
+RegisterID* BytecodeGenerator::emitPreInc(RegisterID* srcDst)
+{
+ emitOpcode(op_pre_inc);
+ instructions().append(srcDst->index());
+ return srcDst;
+}
+
+RegisterID* BytecodeGenerator::emitPreDec(RegisterID* srcDst)
+{
+ emitOpcode(op_pre_dec);
+ instructions().append(srcDst->index());
+ return srcDst;
+}
+
+RegisterID* BytecodeGenerator::emitPostInc(RegisterID* dst, RegisterID* srcDst)
+{
+ emitOpcode(op_post_inc);
+ instructions().append(dst->index());
+ instructions().append(srcDst->index());
+ return dst;
+}
+
+RegisterID* BytecodeGenerator::emitPostDec(RegisterID* dst, RegisterID* srcDst)
+{
+ emitOpcode(op_post_dec);
+ instructions().append(dst->index());
+ instructions().append(srcDst->index());
+ return dst;
+}
+
+RegisterID* BytecodeGenerator::emitBinaryOp(OpcodeID opcodeID, RegisterID* dst, RegisterID* src1, RegisterID* src2, OperandTypes types)
+{
+ emitOpcode(opcodeID);
+ instructions().append(dst->index());
+ instructions().append(src1->index());
+ instructions().append(src2->index());
+
+ if (opcodeID == op_bitor || opcodeID == op_bitand || opcodeID == op_bitxor ||
+ opcodeID == op_add || opcodeID == op_mul || opcodeID == op_sub || opcodeID == op_div)
+ instructions().append(types.toInt());
+
+ return dst;
+}
+
+RegisterID* BytecodeGenerator::emitEqualityOp(OpcodeID opcodeID, RegisterID* dst, RegisterID* src1, RegisterID* src2)
+{
+ if (m_lastOpcodeID == op_typeof) {
+ int dstIndex;
+ int srcIndex;
+
+ retrieveLastUnaryOp(dstIndex, srcIndex);
+
+ if (src1->index() == dstIndex
+ && src1->isTemporary()
+ && m_codeBlock->isConstantRegisterIndex(src2->index())
+ && m_codeBlock->constantRegister(src2->index()).jsValue().isString()) {
+ const UString& value = asString(m_codeBlock->constantRegister(src2->index()).jsValue())->tryGetValue();
+ if (value == "undefined") {
+ rewindUnaryOp();
+ emitOpcode(op_is_undefined);
+ instructions().append(dst->index());
+ instructions().append(srcIndex);
+ return dst;
+ }
+ if (value == "boolean") {
+ rewindUnaryOp();
+ emitOpcode(op_is_boolean);
+ instructions().append(dst->index());
+ instructions().append(srcIndex);
+ return dst;
+ }
+ if (value == "number") {
+ rewindUnaryOp();
+ emitOpcode(op_is_number);
+ instructions().append(dst->index());
+ instructions().append(srcIndex);
+ return dst;
+ }
+ if (value == "string") {
+ rewindUnaryOp();
+ emitOpcode(op_is_string);
+ instructions().append(dst->index());
+ instructions().append(srcIndex);
+ return dst;
+ }
+ if (value == "object") {
+ rewindUnaryOp();
+ emitOpcode(op_is_object);
+ instructions().append(dst->index());
+ instructions().append(srcIndex);
+ return dst;
+ }
+ if (value == "function") {
+ rewindUnaryOp();
+ emitOpcode(op_is_function);
+ instructions().append(dst->index());
+ instructions().append(srcIndex);
+ return dst;
+ }
+ }
+ }
+
+ emitOpcode(opcodeID);
+ instructions().append(dst->index());
+ instructions().append(src1->index());
+ instructions().append(src2->index());
+ return dst;
+}
+
+RegisterID* BytecodeGenerator::emitLoad(RegisterID* dst, bool b)
+{
+ return emitLoad(dst, jsBoolean(b));
+}
+
+RegisterID* BytecodeGenerator::emitLoad(RegisterID* dst, double number)
+{
+ // FIXME: Our hash tables won't hold infinity, so we make a new JSNumberCell each time.
+ // Later we can do the extra work to handle that like the other cases.
+ if (number == HashTraits<double>::emptyValue() || HashTraits<double>::isDeletedValue(number))
+ return emitLoad(dst, jsNumber(number));
+ JSValue& valueInMap = m_numberMap.add(number, JSValue()).first->second;
+ if (!valueInMap)
+ valueInMap = jsNumber(number);
+ return emitLoad(dst, valueInMap);
+}
+
+RegisterID* BytecodeGenerator::emitLoad(RegisterID* dst, const Identifier& identifier)
+{
+ JSString*& stringInMap = m_stringMap.add(identifier.impl(), 0).first->second;
+ if (!stringInMap)
+ stringInMap = jsOwnedString(globalData(), identifier.ustring());
+ return emitLoad(dst, JSValue(stringInMap));
+}
+
+RegisterID* BytecodeGenerator::emitLoad(RegisterID* dst, JSValue v)
+{
+ RegisterID* constantID = addConstantValue(v);
+ if (dst)
+ return emitMove(dst, constantID);
+ return constantID;
+}
+
+bool BytecodeGenerator::findScopedProperty(const Identifier& property, int& index, size_t& stackDepth, bool forWriting, bool& requiresDynamicChecks, JSObject*& globalObject)
+{
+ // Cases where we cannot statically optimize the lookup.
+ if (property == propertyNames().arguments || !canOptimizeNonLocals()) {
+ stackDepth = 0;
+ index = missingSymbolMarker();
+
+ if (shouldOptimizeLocals() && m_codeType == GlobalCode) {
+ ScopeChainIterator iter = m_scopeChain->begin();
+ globalObject = *iter;
+ ASSERT((++iter) == m_scopeChain->end());
+ }
+ return false;
+ }
+
+ size_t depth = 0;
+ requiresDynamicChecks = false;
+ ScopeChainIterator iter = m_scopeChain->begin();
+ ScopeChainIterator end = m_scopeChain->end();
+ for (; iter != end; ++iter, ++depth) {
+ JSObject* currentScope = *iter;
+ if (!currentScope->isVariableObject())
+ break;
+ JSVariableObject* currentVariableObject = static_cast<JSVariableObject*>(currentScope);
+ SymbolTableEntry entry = currentVariableObject->symbolTable().get(property.impl());
+
+ // Found the property
+ if (!entry.isNull()) {
+ if (entry.isReadOnly() && forWriting) {
+ stackDepth = 0;
+ index = missingSymbolMarker();
+ if (++iter == end)
+ globalObject = currentVariableObject;
+ return false;
+ }
+ stackDepth = depth + m_codeBlock->needsFullScopeChain();
+ index = entry.getIndex();
+ if (++iter == end)
+ globalObject = currentVariableObject;
+ return true;
+ }
+ bool scopeRequiresDynamicChecks = false;
+ if (currentVariableObject->isDynamicScope(scopeRequiresDynamicChecks))
+ break;
+ requiresDynamicChecks |= scopeRequiresDynamicChecks;
+ }
+ // Can't locate the property but we're able to avoid a few lookups.
+ stackDepth = depth + m_codeBlock->needsFullScopeChain();
+ index = missingSymbolMarker();
+ JSObject* scope = *iter;
+ if (++iter == end)
+ globalObject = scope;
+ return true;
+}
+
+void BytecodeGenerator::emitCheckHasInstance(RegisterID* base)
+{
+ emitOpcode(op_check_has_instance);
+ instructions().append(base->index());
+}
+
+RegisterID* BytecodeGenerator::emitInstanceOf(RegisterID* dst, RegisterID* value, RegisterID* base, RegisterID* basePrototype)
+{
+ emitOpcode(op_instanceof);
+ instructions().append(dst->index());
+ instructions().append(value->index());
+ instructions().append(base->index());
+ instructions().append(basePrototype->index());
+ return dst;
+}
+
+RegisterID* BytecodeGenerator::emitResolve(RegisterID* dst, const Identifier& property)
+{
+ size_t depth = 0;
+ int index = 0;
+ JSObject* globalObject = 0;
+ bool requiresDynamicChecks = false;
+ if (!findScopedProperty(property, index, depth, false, requiresDynamicChecks, globalObject) && !globalObject) {
+ // We can't optimise at all :-(
+ emitOpcode(op_resolve);
+ instructions().append(dst->index());
+ instructions().append(addConstant(property));
+ return dst;
+ }
+
+ if (globalObject) {
+ bool forceGlobalResolve = false;
+ if (m_regeneratingForExceptionInfo) {
+#if ENABLE(JIT)
+ forceGlobalResolve = m_codeBlockBeingRegeneratedFrom->hasGlobalResolveInfoAtBytecodeOffset(instructions().size());
+#else
+ forceGlobalResolve = m_codeBlockBeingRegeneratedFrom->hasGlobalResolveInstructionAtBytecodeOffset(instructions().size());
+#endif
+ }
+
+ if (index != missingSymbolMarker() && !forceGlobalResolve && !requiresDynamicChecks) {
+ // Directly index the property lookup across multiple scopes.
+ return emitGetScopedVar(dst, depth, index, globalObject);
+ }
+
+#if ENABLE(JIT)
+ m_codeBlock->addGlobalResolveInfo(instructions().size());
+#else
+ m_codeBlock->addGlobalResolveInstruction(instructions().size());
+#endif
+ emitOpcode(requiresDynamicChecks ? op_resolve_global_dynamic : op_resolve_global);
+ instructions().append(dst->index());
+ instructions().append(addConstant(property));
+ instructions().append(0);
+ instructions().append(0);
+ if (requiresDynamicChecks)
+ instructions().append(depth);
+ return dst;
+ }
+
+ if (requiresDynamicChecks) {
+ // If we get here we have eval nested inside a |with| just give up
+ emitOpcode(op_resolve);
+ instructions().append(dst->index());
+ instructions().append(addConstant(property));
+ return dst;
+ }
+
+ if (index != missingSymbolMarker()) {
+ // Directly index the property lookup across multiple scopes.
+ return emitGetScopedVar(dst, depth, index, globalObject);
+ }
+
+ // In this case we are at least able to drop a few scope chains from the
+ // lookup chain, although we still need to hash from then on.
+ emitOpcode(op_resolve_skip);
+ instructions().append(dst->index());
+ instructions().append(addConstant(property));
+ instructions().append(depth);
+ return dst;
+}
+
+RegisterID* BytecodeGenerator::emitGetScopedVar(RegisterID* dst, size_t depth, int index, JSValue globalObject)
+{
+ if (globalObject) {
+ emitOpcode(op_get_global_var);
+ instructions().append(dst->index());
+ instructions().append(index);
+ return dst;
+ }
+
+ emitOpcode(op_get_scoped_var);
+ instructions().append(dst->index());
+ instructions().append(index);
+ instructions().append(depth);
+ return dst;
+}
+
+RegisterID* BytecodeGenerator::emitPutScopedVar(size_t depth, int index, RegisterID* value, JSValue globalObject)
+{
+ if (globalObject) {
+ emitOpcode(op_put_global_var);
+ instructions().append(index);
+ instructions().append(value->index());
+ return value;
+ }
+ emitOpcode(op_put_scoped_var);
+ instructions().append(index);
+ instructions().append(depth);
+ instructions().append(value->index());
+ return value;
+}
+
+RegisterID* BytecodeGenerator::emitResolveBase(RegisterID* dst, const Identifier& property)
+{
+ size_t depth = 0;
+ int index = 0;
+ JSObject* globalObject = 0;
+ bool requiresDynamicChecks = false;
+ findScopedProperty(property, index, depth, false, requiresDynamicChecks, globalObject);
+ if (!globalObject || requiresDynamicChecks) {
+ // We can't optimise at all :-(
+ emitOpcode(op_resolve_base);
+ instructions().append(dst->index());
+ instructions().append(addConstant(property));
+ instructions().append(false);
+ return dst;
+ }
+
+ // Global object is the base
+ return emitLoad(dst, JSValue(globalObject));
+}
+
+RegisterID* BytecodeGenerator::emitResolveBaseForPut(RegisterID* dst, const Identifier& property)
+{
+ if (!m_codeBlock->isStrictMode())
+ return emitResolveBase(dst, property);
+ size_t depth = 0;
+ int index = 0;
+ JSObject* globalObject = 0;
+ bool requiresDynamicChecks = false;
+ findScopedProperty(property, index, depth, false, requiresDynamicChecks, globalObject);
+ if (!globalObject || requiresDynamicChecks) {
+ // We can't optimise at all :-(
+ emitOpcode(op_resolve_base);
+ instructions().append(dst->index());
+ instructions().append(addConstant(property));
+ instructions().append(true);
+ return dst;
+ }
+
+ // Global object is the base
+ RefPtr<RegisterID> result = emitLoad(dst, JSValue(globalObject));
+ emitOpcode(op_ensure_property_exists);
+ instructions().append(dst->index());
+ instructions().append(addConstant(property));
+ return result.get();
+}
+
+RegisterID* BytecodeGenerator::emitResolveWithBase(RegisterID* baseDst, RegisterID* propDst, const Identifier& property)
+{
+ size_t depth = 0;
+ int index = 0;
+ JSObject* globalObject = 0;
+ bool requiresDynamicChecks = false;
+ if (!findScopedProperty(property, index, depth, false, requiresDynamicChecks, globalObject) || !globalObject || requiresDynamicChecks) {
+ // We can't optimise at all :-(
+ emitOpcode(op_resolve_with_base);
+ instructions().append(baseDst->index());
+ instructions().append(propDst->index());
+ instructions().append(addConstant(property));
+ return baseDst;
+ }
+
+ bool forceGlobalResolve = false;
+ if (m_regeneratingForExceptionInfo) {
+#if ENABLE(JIT)
+ forceGlobalResolve = m_codeBlockBeingRegeneratedFrom->hasGlobalResolveInfoAtBytecodeOffset(instructions().size());
+#else
+ forceGlobalResolve = m_codeBlockBeingRegeneratedFrom->hasGlobalResolveInstructionAtBytecodeOffset(instructions().size());
+#endif
+ }
+
+ // Global object is the base
+ emitLoad(baseDst, JSValue(globalObject));
+
+ if (index != missingSymbolMarker() && !forceGlobalResolve) {
+ // Directly index the property lookup across multiple scopes.
+ emitGetScopedVar(propDst, depth, index, globalObject);
+ return baseDst;
+ }
+
+#if ENABLE(JIT)
+ m_codeBlock->addGlobalResolveInfo(instructions().size());
+#else
+ m_codeBlock->addGlobalResolveInstruction(instructions().size());
+#endif
+ emitOpcode(requiresDynamicChecks ? op_resolve_global_dynamic : op_resolve_global);
+ instructions().append(propDst->index());
+ instructions().append(addConstant(property));
+ instructions().append(0);
+ instructions().append(0);
+ if (requiresDynamicChecks)
+ instructions().append(depth);
+ return baseDst;
+}
+
+void BytecodeGenerator::emitMethodCheck()
+{
+ emitOpcode(op_method_check);
+}
+
+RegisterID* BytecodeGenerator::emitGetById(RegisterID* dst, RegisterID* base, const Identifier& property)
+{
+#if ENABLE(JIT)
+ m_codeBlock->addStructureStubInfo(StructureStubInfo(access_get_by_id));
+#else
+ m_codeBlock->addPropertyAccessInstruction(instructions().size());
+#endif
+
+ emitOpcode(op_get_by_id);
+ instructions().append(dst->index());
+ instructions().append(base->index());
+ instructions().append(addConstant(property));
+ instructions().append(0);
+ instructions().append(0);
+ instructions().append(0);
+ instructions().append(0);
+ return dst;
+}
+
+RegisterID* BytecodeGenerator::emitGetArgumentsLength(RegisterID* dst, RegisterID* base)
+{
+ emitOpcode(op_get_arguments_length);
+ instructions().append(dst->index());
+ ASSERT(base->index() == m_codeBlock->argumentsRegister());
+ instructions().append(base->index());
+ instructions().append(addConstant(propertyNames().length));
+ return dst;
+}
+
+RegisterID* BytecodeGenerator::emitPutById(RegisterID* base, const Identifier& property, RegisterID* value)
+{
+#if ENABLE(JIT)
+ m_codeBlock->addStructureStubInfo(StructureStubInfo(access_put_by_id));
+#else
+ m_codeBlock->addPropertyAccessInstruction(instructions().size());
+#endif
+
+ emitOpcode(op_put_by_id);
+ instructions().append(base->index());
+ instructions().append(addConstant(property));
+ instructions().append(value->index());
+ instructions().append(0);
+ instructions().append(0);
+ instructions().append(0);
+ instructions().append(0);
+ instructions().append(0);
+ return value;
+}
+
+RegisterID* BytecodeGenerator::emitDirectPutById(RegisterID* base, const Identifier& property, RegisterID* value)
+{
+#if ENABLE(JIT)
+ m_codeBlock->addStructureStubInfo(StructureStubInfo(access_put_by_id));
+#else
+ m_codeBlock->addPropertyAccessInstruction(instructions().size());
+#endif
+
+ emitOpcode(op_put_by_id);
+ instructions().append(base->index());
+ instructions().append(addConstant(property));
+ instructions().append(value->index());
+ instructions().append(0);
+ instructions().append(0);
+ instructions().append(0);
+ instructions().append(0);
+ instructions().append(property != m_globalData->propertyNames->underscoreProto);
+ return value;
+}
+
+RegisterID* BytecodeGenerator::emitPutGetter(RegisterID* base, const Identifier& property, RegisterID* value)
+{
+ emitOpcode(op_put_getter);
+ instructions().append(base->index());
+ instructions().append(addConstant(property));
+ instructions().append(value->index());
+ return value;
+}
+
+RegisterID* BytecodeGenerator::emitPutSetter(RegisterID* base, const Identifier& property, RegisterID* value)
+{
+ emitOpcode(op_put_setter);
+ instructions().append(base->index());
+ instructions().append(addConstant(property));
+ instructions().append(value->index());
+ return value;
+}
+
+RegisterID* BytecodeGenerator::emitDeleteById(RegisterID* dst, RegisterID* base, const Identifier& property)
+{
+ emitOpcode(op_del_by_id);
+ instructions().append(dst->index());
+ instructions().append(base->index());
+ instructions().append(addConstant(property));
+ return dst;
+}
+
+RegisterID* BytecodeGenerator::emitGetArgumentByVal(RegisterID* dst, RegisterID* base, RegisterID* property)
+{
+ emitOpcode(op_get_argument_by_val);
+ instructions().append(dst->index());
+ ASSERT(base->index() == m_codeBlock->argumentsRegister());
+ instructions().append(base->index());
+ instructions().append(property->index());
+ return dst;
+}
+
+RegisterID* BytecodeGenerator::emitGetByVal(RegisterID* dst, RegisterID* base, RegisterID* property)
+{
+ for (size_t i = m_forInContextStack.size(); i > 0; i--) {
+ ForInContext& context = m_forInContextStack[i - 1];
+ if (context.propertyRegister == property) {
+ emitOpcode(op_get_by_pname);
+ instructions().append(dst->index());
+ instructions().append(base->index());
+ instructions().append(property->index());
+ instructions().append(context.expectedSubscriptRegister->index());
+ instructions().append(context.iterRegister->index());
+ instructions().append(context.indexRegister->index());
+ return dst;
+ }
+ }
+ emitOpcode(op_get_by_val);
+ instructions().append(dst->index());
+ instructions().append(base->index());
+ instructions().append(property->index());
+ return dst;
+}
+
+RegisterID* BytecodeGenerator::emitPutByVal(RegisterID* base, RegisterID* property, RegisterID* value)
+{
+ emitOpcode(op_put_by_val);
+ instructions().append(base->index());
+ instructions().append(property->index());
+ instructions().append(value->index());
+ return value;
+}
+
+RegisterID* BytecodeGenerator::emitDeleteByVal(RegisterID* dst, RegisterID* base, RegisterID* property)
+{
+ emitOpcode(op_del_by_val);
+ instructions().append(dst->index());
+ instructions().append(base->index());
+ instructions().append(property->index());
+ return dst;
+}
+
+RegisterID* BytecodeGenerator::emitPutByIndex(RegisterID* base, unsigned index, RegisterID* value)
+{
+ emitOpcode(op_put_by_index);
+ instructions().append(base->index());
+ instructions().append(index);
+ instructions().append(value->index());
+ return value;
+}
+
+RegisterID* BytecodeGenerator::emitNewObject(RegisterID* dst)
+{
+ emitOpcode(op_new_object);
+ instructions().append(dst->index());
+ return dst;
+}
+
+RegisterID* BytecodeGenerator::emitNewArray(RegisterID* dst, ElementNode* elements)
+{
+ Vector<RefPtr<RegisterID>, 16> argv;
+ for (ElementNode* n = elements; n; n = n->next()) {
+ if (n->elision())
+ break;
+ argv.append(newTemporary());
+ // op_new_array requires the initial values to be a sequential range of registers
+ ASSERT(argv.size() == 1 || argv[argv.size() - 1]->index() == argv[argv.size() - 2]->index() + 1);
+ emitNode(argv.last().get(), n->value());
+ }
+ emitOpcode(op_new_array);
+ instructions().append(dst->index());
+ instructions().append(argv.size() ? argv[0]->index() : 0); // argv
+ instructions().append(argv.size()); // argc
+ return dst;
+}
+
+RegisterID* BytecodeGenerator::emitNewFunction(RegisterID* dst, FunctionBodyNode* function)
+{
+ return emitNewFunctionInternal(dst, m_codeBlock->addFunctionDecl(makeFunction(m_globalData, function)), false);
+}
+
+RegisterID* BytecodeGenerator::emitLazyNewFunction(RegisterID* dst, FunctionBodyNode* function)
+{
+ std::pair<FunctionOffsetMap::iterator, bool> ptr = m_functionOffsets.add(function, 0);
+ if (ptr.second)
+ ptr.first->second = m_codeBlock->addFunctionDecl(makeFunction(m_globalData, function));
+ return emitNewFunctionInternal(dst, ptr.first->second, true);
+}
+
+RegisterID* BytecodeGenerator::emitNewFunctionInternal(RegisterID* dst, unsigned index, bool doNullCheck)
+{
+ createActivationIfNecessary();
+ emitOpcode(op_new_func);
+ instructions().append(dst->index());
+ instructions().append(index);
+ instructions().append(doNullCheck);
+ return dst;
+}
+
+RegisterID* BytecodeGenerator::emitNewRegExp(RegisterID* dst, RegExp* regExp)
+{
+ emitOpcode(op_new_regexp);
+ instructions().append(dst->index());
+ instructions().append(addRegExp(regExp));
+ return dst;
+}
+
+RegisterID* BytecodeGenerator::emitNewFunctionExpression(RegisterID* r0, FuncExprNode* n)
+{
+ FunctionBodyNode* function = n->body();
+ unsigned index = m_codeBlock->addFunctionExpr(makeFunction(m_globalData, function));
+
+ createActivationIfNecessary();
+ emitOpcode(op_new_func_exp);
+ instructions().append(r0->index());
+ instructions().append(index);
+ return r0;
+}
+
+RegisterID* BytecodeGenerator::emitCall(RegisterID* dst, RegisterID* func, CallArguments& callArguments, unsigned divot, unsigned startOffset, unsigned endOffset)
+{
+ return emitCall(op_call, dst, func, callArguments, divot, startOffset, endOffset);
+}
+
+void BytecodeGenerator::createArgumentsIfNecessary()
+{
+ if (m_codeType != FunctionCode)
+ return;
+
+ if (!m_codeBlock->usesArguments())
+ return;
+
+ // If we're in strict mode we tear off the arguments on function
+ // entry, so there's no need to check if we need to create them
+ // now
+ if (m_codeBlock->isStrictMode())
+ return;
+
+ emitOpcode(op_create_arguments);
+ instructions().append(m_codeBlock->argumentsRegister());
+}
+
+void BytecodeGenerator::createActivationIfNecessary()
+{
+ if (m_hasCreatedActivation)
+ return;
+ if (!m_codeBlock->needsFullScopeChain())
+ return;
+ emitOpcode(op_create_activation);
+ instructions().append(m_activationRegister->index());
+}
+
+RegisterID* BytecodeGenerator::emitCallEval(RegisterID* dst, RegisterID* func, CallArguments& callArguments, unsigned divot, unsigned startOffset, unsigned endOffset)
+{
+ return emitCall(op_call_eval, dst, func, callArguments, divot, startOffset, endOffset);
+}
+
+RegisterID* BytecodeGenerator::emitCall(OpcodeID opcodeID, RegisterID* dst, RegisterID* func, CallArguments& callArguments, unsigned divot, unsigned startOffset, unsigned endOffset)
+{
+ ASSERT(opcodeID == op_call || opcodeID == op_call_eval);
+ ASSERT(func->refCount());
+
+ if (m_shouldEmitProfileHooks)
+ emitMove(callArguments.profileHookRegister(), func);
+
+ // Generate code for arguments.
+ unsigned argumentIndex = 0;
+ for (ArgumentListNode* n = callArguments.argumentsNode()->m_listNode; n; n = n->m_next)
+ emitNode(callArguments.argumentRegister(argumentIndex++), n);
+
+ // Reserve space for call frame.
+ Vector<RefPtr<RegisterID>, RegisterFile::CallFrameHeaderSize> callFrame;
+ for (int i = 0; i < RegisterFile::CallFrameHeaderSize; ++i)
+ callFrame.append(newTemporary());
+
+ if (m_shouldEmitProfileHooks) {
+ emitOpcode(op_profile_will_call);
+ instructions().append(callArguments.profileHookRegister()->index());
+ }
+
+ emitExpressionInfo(divot, startOffset, endOffset);
+
+#if ENABLE(JIT)
+ m_codeBlock->addCallLinkInfo();
+#endif
+
+ // Emit call.
+ emitOpcode(opcodeID);
+ instructions().append(func->index()); // func
+ instructions().append(callArguments.count()); // argCount
+ instructions().append(callArguments.callFrame()); // registerOffset
+ if (dst != ignoredResult()) {
+ emitOpcode(op_call_put_result);
+ instructions().append(dst->index()); // dst
+ }
+
+ if (m_shouldEmitProfileHooks) {
+ emitOpcode(op_profile_did_call);
+ instructions().append(callArguments.profileHookRegister()->index());
+ }
+
+ return dst;
+}
+
+RegisterID* BytecodeGenerator::emitLoadVarargs(RegisterID* argCountDst, RegisterID* thisRegister, RegisterID* arguments)
+{
+ ASSERT(argCountDst->index() < arguments->index());
+ emitOpcode(op_load_varargs);
+ instructions().append(argCountDst->index());
+ instructions().append(arguments->index());
+ instructions().append(thisRegister->index() + RegisterFile::CallFrameHeaderSize); // initial registerOffset
+ return argCountDst;
+}
+
+RegisterID* BytecodeGenerator::emitCallVarargs(RegisterID* dst, RegisterID* func, RegisterID* thisRegister, RegisterID* argCountRegister, unsigned divot, unsigned startOffset, unsigned endOffset)
+{
+ ASSERT(func->refCount());
+ ASSERT(thisRegister->refCount());
+ ASSERT(dst != func);
+ if (m_shouldEmitProfileHooks) {
+ emitOpcode(op_profile_will_call);
+ instructions().append(func->index());
+ }
+
+ emitExpressionInfo(divot, startOffset, endOffset);
+
+ // Emit call.
+ emitOpcode(op_call_varargs);
+ instructions().append(func->index()); // func
+ instructions().append(argCountRegister->index()); // arg count
+ instructions().append(thisRegister->index() + RegisterFile::CallFrameHeaderSize); // initial registerOffset
+ if (dst != ignoredResult()) {
+ emitOpcode(op_call_put_result);
+ instructions().append(dst->index()); // dst
+ }
+ if (m_shouldEmitProfileHooks) {
+ emitOpcode(op_profile_did_call);
+ instructions().append(func->index());
+ }
+ return dst;
+}
+
+RegisterID* BytecodeGenerator::emitReturn(RegisterID* src)
+{
+ if (m_codeBlock->needsFullScopeChain()) {
+ emitOpcode(op_tear_off_activation);
+ instructions().append(m_activationRegister->index());
+ instructions().append(m_codeBlock->argumentsRegister());
+ } else if (m_codeBlock->usesArguments() && m_codeBlock->m_numParameters > 1
+ && !m_codeBlock->isStrictMode()) { // If there are no named parameters, there's nothing to tear off, since extra / unnamed parameters get copied to the arguments object at construct time.
+ emitOpcode(op_tear_off_arguments);
+ instructions().append(m_codeBlock->argumentsRegister());
+ }
+
+ // Constructors use op_ret_object_or_this to check the result is an
+ // object, unless we can trivially determine the check is not
+ // necessary (currently, if the return value is 'this').
+ if (isConstructor() && (src->index() != m_thisRegister.index())) {
+ emitOpcode(op_ret_object_or_this);
+ instructions().append(src->index());
+ instructions().append(m_thisRegister.index());
+ return src;
+ }
+ return emitUnaryNoDstOp(op_ret, src);
+}
+
+RegisterID* BytecodeGenerator::emitUnaryNoDstOp(OpcodeID opcodeID, RegisterID* src)
+{
+ emitOpcode(opcodeID);
+ instructions().append(src->index());
+ return src;
+}
+
+RegisterID* BytecodeGenerator::emitConstruct(RegisterID* dst, RegisterID* func, CallArguments& callArguments, unsigned divot, unsigned startOffset, unsigned endOffset)
+{
+ ASSERT(func->refCount());
+
+ if (m_shouldEmitProfileHooks)
+ emitMove(callArguments.profileHookRegister(), func);
+
+ // Generate code for arguments.
+ unsigned argumentIndex = 0;
+ if (ArgumentsNode* argumentsNode = callArguments.argumentsNode()) {
+ for (ArgumentListNode* n = argumentsNode->m_listNode; n; n = n->m_next)
+ emitNode(callArguments.argumentRegister(argumentIndex++), n);
+ }
+
+ if (m_shouldEmitProfileHooks) {
+ emitOpcode(op_profile_will_call);
+ instructions().append(callArguments.profileHookRegister()->index());
+ }
+
+ // Reserve space for call frame.
+ Vector<RefPtr<RegisterID>, RegisterFile::CallFrameHeaderSize> callFrame;
+ for (int i = 0; i < RegisterFile::CallFrameHeaderSize; ++i)
+ callFrame.append(newTemporary());
+
+ emitExpressionInfo(divot, startOffset, endOffset);
+
+#if ENABLE(JIT)
+ m_codeBlock->addCallLinkInfo();
+#endif
+
+ emitOpcode(op_construct);
+ instructions().append(func->index()); // func
+ instructions().append(callArguments.count()); // argCount
+ instructions().append(callArguments.callFrame()); // registerOffset
+ if (dst != ignoredResult()) {
+ emitOpcode(op_call_put_result);
+ instructions().append(dst->index()); // dst
+ }
+
+ if (m_shouldEmitProfileHooks) {
+ emitOpcode(op_profile_did_call);
+ instructions().append(callArguments.profileHookRegister()->index());
+ }
+
+ return dst;
+}
+
+RegisterID* BytecodeGenerator::emitStrcat(RegisterID* dst, RegisterID* src, int count)
+{
+ emitOpcode(op_strcat);
+ instructions().append(dst->index());
+ instructions().append(src->index());
+ instructions().append(count);
+
+ return dst;
+}
+
+void BytecodeGenerator::emitToPrimitive(RegisterID* dst, RegisterID* src)
+{
+ emitOpcode(op_to_primitive);
+ instructions().append(dst->index());
+ instructions().append(src->index());
+}
+
+RegisterID* BytecodeGenerator::emitPushScope(RegisterID* scope)
+{
+ ASSERT(scope->isTemporary());
+ ControlFlowContext context;
+ context.isFinallyBlock = false;
+ m_scopeContextStack.append(context);
+ m_dynamicScopeDepth++;
+
+ return emitUnaryNoDstOp(op_push_scope, scope);
+}
+
+void BytecodeGenerator::emitPopScope()
+{
+ ASSERT(m_scopeContextStack.size());
+ ASSERT(!m_scopeContextStack.last().isFinallyBlock);
+
+ emitOpcode(op_pop_scope);
+
+ m_scopeContextStack.removeLast();
+ m_dynamicScopeDepth--;
+}
+
+void BytecodeGenerator::emitDebugHook(DebugHookID debugHookID, int firstLine, int lastLine)
+{
+#if ENABLE(DEBUG_WITH_BREAKPOINT)
+ if (debugHookID != DidReachBreakpoint)
+ return;
+#else
+ if (!m_shouldEmitDebugHooks)
+ return;
+#endif
+ emitOpcode(op_debug);
+ instructions().append(debugHookID);
+ instructions().append(firstLine);
+ instructions().append(lastLine);
+}
+
+void BytecodeGenerator::pushFinallyContext(Label* target, RegisterID* retAddrDst)
+{
+ ControlFlowContext scope;
+ scope.isFinallyBlock = true;
+ FinallyContext context = { target, retAddrDst };
+ scope.finallyContext = context;
+ m_scopeContextStack.append(scope);
+ m_finallyDepth++;
+}
+
+void BytecodeGenerator::popFinallyContext()
+{
+ ASSERT(m_scopeContextStack.size());
+ ASSERT(m_scopeContextStack.last().isFinallyBlock);
+ ASSERT(m_finallyDepth > 0);
+ m_scopeContextStack.removeLast();
+ m_finallyDepth--;
+}
+
+LabelScope* BytecodeGenerator::breakTarget(const Identifier& name)
+{
+ // Reclaim free label scopes.
+ //
+ // The condition was previously coded as 'm_labelScopes.size() && !m_labelScopes.last().refCount()',
+ // however sometimes this appears to lead to GCC going a little haywire and entering the loop with
+ // size 0, leading to segfaulty badness. We are yet to identify a valid cause within our code to
+ // cause the GCC codegen to misbehave in this fashion, and as such the following refactoring of the
+ // loop condition is a workaround.
+ while (m_labelScopes.size()) {
+ if (m_labelScopes.last().refCount())
+ break;
+ m_labelScopes.removeLast();
+ }
+
+ if (!m_labelScopes.size())
+ return 0;
+
+ // We special-case the following, which is a syntax error in Firefox:
+ // label:
+ // break;
+ if (name.isEmpty()) {
+ for (int i = m_labelScopes.size() - 1; i >= 0; --i) {
+ LabelScope* scope = &m_labelScopes[i];
+ if (scope->type() != LabelScope::NamedLabel) {
+ ASSERT(scope->breakTarget());
+ return scope;
+ }
+ }
+ return 0;
+ }
+
+ for (int i = m_labelScopes.size() - 1; i >= 0; --i) {
+ LabelScope* scope = &m_labelScopes[i];
+ if (scope->name() && *scope->name() == name) {
+ ASSERT(scope->breakTarget());
+ return scope;
+ }
+ }
+ return 0;
+}
+
+LabelScope* BytecodeGenerator::continueTarget(const Identifier& name)
+{
+ // Reclaim free label scopes.
+ while (m_labelScopes.size() && !m_labelScopes.last().refCount())
+ m_labelScopes.removeLast();
+
+ if (!m_labelScopes.size())
+ return 0;
+
+ if (name.isEmpty()) {
+ for (int i = m_labelScopes.size() - 1; i >= 0; --i) {
+ LabelScope* scope = &m_labelScopes[i];
+ if (scope->type() == LabelScope::Loop) {
+ ASSERT(scope->continueTarget());
+ return scope;
+ }
+ }
+ return 0;
+ }
+
+ // Continue to the loop nested nearest to the label scope that matches
+ // 'name'.
+ LabelScope* result = 0;
+ for (int i = m_labelScopes.size() - 1; i >= 0; --i) {
+ LabelScope* scope = &m_labelScopes[i];
+ if (scope->type() == LabelScope::Loop) {
+ ASSERT(scope->continueTarget());
+ result = scope;
+ }
+ if (scope->name() && *scope->name() == name)
+ return result; // may be 0
+ }
+ return 0;
+}
+
+PassRefPtr<Label> BytecodeGenerator::emitComplexJumpScopes(Label* target, ControlFlowContext* topScope, ControlFlowContext* bottomScope)
+{
+ while (topScope > bottomScope) {
+ // First we count the number of dynamic scopes we need to remove to get
+ // to a finally block.
+ int nNormalScopes = 0;
+ while (topScope > bottomScope) {
+ if (topScope->isFinallyBlock)
+ break;
+ ++nNormalScopes;
+ --topScope;
+ }
+
+ if (nNormalScopes) {
+ size_t begin = instructions().size();
+
+ // We need to remove a number of dynamic scopes to get to the next
+ // finally block
+ emitOpcode(op_jmp_scopes);
+ instructions().append(nNormalScopes);
+
+ // If topScope == bottomScope then there isn't actually a finally block
+ // left to emit, so make the jmp_scopes jump directly to the target label
+ if (topScope == bottomScope) {
+ instructions().append(target->bind(begin, instructions().size()));
+ return target;
+ }
+
+ // Otherwise we just use jmp_scopes to pop a group of scopes and go
+ // to the next instruction
+ RefPtr<Label> nextInsn = newLabel();
+ instructions().append(nextInsn->bind(begin, instructions().size()));
+ emitLabel(nextInsn.get());
+ }
+
+ while (topScope > bottomScope && topScope->isFinallyBlock) {
+ emitJumpSubroutine(topScope->finallyContext.retAddrDst, topScope->finallyContext.finallyAddr);
+ --topScope;
+ }
+ }
+ return emitJump(target);
+}
+
+PassRefPtr<Label> BytecodeGenerator::emitJumpScopes(Label* target, int targetScopeDepth)
+{
+ ASSERT(scopeDepth() - targetScopeDepth >= 0);
+ ASSERT(target->isForward());
+
+ size_t scopeDelta = scopeDepth() - targetScopeDepth;
+ ASSERT(scopeDelta <= m_scopeContextStack.size());
+ if (!scopeDelta)
+ return emitJump(target);
+
+ if (m_finallyDepth)
+ return emitComplexJumpScopes(target, &m_scopeContextStack.last(), &m_scopeContextStack.last() - scopeDelta);
+
+ size_t begin = instructions().size();
+
+ emitOpcode(op_jmp_scopes);
+ instructions().append(scopeDelta);
+ instructions().append(target->bind(begin, instructions().size()));
+ return target;
+}
+
+RegisterID* BytecodeGenerator::emitGetPropertyNames(RegisterID* dst, RegisterID* base, RegisterID* i, RegisterID* size, Label* breakTarget)
+{
+ size_t begin = instructions().size();
+
+ emitOpcode(op_get_pnames);
+ instructions().append(dst->index());
+ instructions().append(base->index());
+ instructions().append(i->index());
+ instructions().append(size->index());
+ instructions().append(breakTarget->bind(begin, instructions().size()));
+ return dst;
+}
+
+RegisterID* BytecodeGenerator::emitNextPropertyName(RegisterID* dst, RegisterID* base, RegisterID* i, RegisterID* size, RegisterID* iter, Label* target)
+{
+ size_t begin = instructions().size();
+
+ emitOpcode(op_next_pname);
+ instructions().append(dst->index());
+ instructions().append(base->index());
+ instructions().append(i->index());
+ instructions().append(size->index());
+ instructions().append(iter->index());
+ instructions().append(target->bind(begin, instructions().size()));
+ return dst;
+}
+
+RegisterID* BytecodeGenerator::emitCatch(RegisterID* targetRegister, Label* start, Label* end)
+{
+ m_usesExceptions = true;
+#if ENABLE(JIT)
+ HandlerInfo info = { start->bind(0, 0), end->bind(0, 0), instructions().size(), m_dynamicScopeDepth + m_baseScopeDepth, CodeLocationLabel() };
+#else
+ HandlerInfo info = { start->bind(0, 0), end->bind(0, 0), instructions().size(), m_dynamicScopeDepth + m_baseScopeDepth };
+#endif
+
+ m_codeBlock->addExceptionHandler(info);
+ emitOpcode(op_catch);
+ instructions().append(targetRegister->index());
+ return targetRegister;
+}
+
+void BytecodeGenerator::emitThrowReferenceError(const UString& message)
+{
+ emitOpcode(op_throw_reference_error);
+ instructions().append(addConstantValue(jsString(globalData(), message))->index());
+}
+
+void BytecodeGenerator::emitThrowSyntaxError(const UString& message)
+{
+ emitOpcode(op_throw_syntax_error);
+ instructions().append(addConstantValue(jsString(globalData(), message))->index());
+}
+
+PassRefPtr<Label> BytecodeGenerator::emitJumpSubroutine(RegisterID* retAddrDst, Label* finally)
+{
+ size_t begin = instructions().size();
+
+ emitOpcode(op_jsr);
+ instructions().append(retAddrDst->index());
+ instructions().append(finally->bind(begin, instructions().size()));
+ emitLabel(newLabel().get()); // Record the fact that the next instruction is implicitly labeled, because op_sret will return to it.
+ return finally;
+}
+
+void BytecodeGenerator::emitSubroutineReturn(RegisterID* retAddrSrc)
+{
+ emitOpcode(op_sret);
+ instructions().append(retAddrSrc->index());
+}
+
+void BytecodeGenerator::emitPushNewScope(RegisterID* dst, const Identifier& property, RegisterID* value)
+{
+ ControlFlowContext context;
+ context.isFinallyBlock = false;
+ m_scopeContextStack.append(context);
+ m_dynamicScopeDepth++;
+
+ emitOpcode(op_push_new_scope);
+ instructions().append(dst->index());
+ instructions().append(addConstant(property));
+ instructions().append(value->index());
+}
+
+void BytecodeGenerator::beginSwitch(RegisterID* scrutineeRegister, SwitchInfo::SwitchType type)
+{
+ SwitchInfo info = { instructions().size(), type };
+ switch (type) {
+ case SwitchInfo::SwitchImmediate:
+ emitOpcode(op_switch_imm);
+ break;
+ case SwitchInfo::SwitchCharacter:
+ emitOpcode(op_switch_char);
+ break;
+ case SwitchInfo::SwitchString:
+ emitOpcode(op_switch_string);
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ }
+
+ instructions().append(0); // place holder for table index
+ instructions().append(0); // place holder for default target
+ instructions().append(scrutineeRegister->index());
+ m_switchContextStack.append(info);
+}
+
+static int32_t keyForImmediateSwitch(ExpressionNode* node, int32_t min, int32_t max)
+{
+ UNUSED_PARAM(max);
+ ASSERT(node->isNumber());
+ double value = static_cast<NumberNode*>(node)->value();
+ int32_t key = static_cast<int32_t>(value);
+ ASSERT(key == value);
+ ASSERT(key >= min);
+ ASSERT(key <= max);
+ return key - min;
+}
+
+static void prepareJumpTableForImmediateSwitch(SimpleJumpTable& jumpTable, int32_t switchAddress, uint32_t clauseCount, RefPtr<Label>* labels, ExpressionNode** nodes, int32_t min, int32_t max)
+{
+ jumpTable.min = min;
+ jumpTable.branchOffsets.resize(max - min + 1);
+ jumpTable.branchOffsets.fill(0);
+ for (uint32_t i = 0; i < clauseCount; ++i) {
+ // We're emitting this after the clause labels should have been fixed, so
+ // the labels should not be "forward" references
+ ASSERT(!labels[i]->isForward());
+ jumpTable.add(keyForImmediateSwitch(nodes[i], min, max), labels[i]->bind(switchAddress, switchAddress + 3));
+ }
+}
+
+static int32_t keyForCharacterSwitch(ExpressionNode* node, int32_t min, int32_t max)
+{
+ UNUSED_PARAM(max);
+ ASSERT(node->isString());
+ StringImpl* clause = static_cast<StringNode*>(node)->value().impl();
+ ASSERT(clause->length() == 1);
+
+ int32_t key = clause->characters()[0];
+ ASSERT(key >= min);
+ ASSERT(key <= max);
+ return key - min;
+}
+
+static void prepareJumpTableForCharacterSwitch(SimpleJumpTable& jumpTable, int32_t switchAddress, uint32_t clauseCount, RefPtr<Label>* labels, ExpressionNode** nodes, int32_t min, int32_t max)
+{
+ jumpTable.min = min;
+ jumpTable.branchOffsets.resize(max - min + 1);
+ jumpTable.branchOffsets.fill(0);
+ for (uint32_t i = 0; i < clauseCount; ++i) {
+ // We're emitting this after the clause labels should have been fixed, so
+ // the labels should not be "forward" references
+ ASSERT(!labels[i]->isForward());
+ jumpTable.add(keyForCharacterSwitch(nodes[i], min, max), labels[i]->bind(switchAddress, switchAddress + 3));
+ }
+}
+
+static void prepareJumpTableForStringSwitch(StringJumpTable& jumpTable, int32_t switchAddress, uint32_t clauseCount, RefPtr<Label>* labels, ExpressionNode** nodes)
+{
+ for (uint32_t i = 0; i < clauseCount; ++i) {
+ // We're emitting this after the clause labels should have been fixed, so
+ // the labels should not be "forward" references
+ ASSERT(!labels[i]->isForward());
+
+ ASSERT(nodes[i]->isString());
+ StringImpl* clause = static_cast<StringNode*>(nodes[i])->value().impl();
+ OffsetLocation location;
+ location.branchOffset = labels[i]->bind(switchAddress, switchAddress + 3);
+ jumpTable.offsetTable.add(clause, location);
+ }
+}
+
+void BytecodeGenerator::endSwitch(uint32_t clauseCount, RefPtr<Label>* labels, ExpressionNode** nodes, Label* defaultLabel, int32_t min, int32_t max)
+{
+ SwitchInfo switchInfo = m_switchContextStack.last();
+ m_switchContextStack.removeLast();
+ if (switchInfo.switchType == SwitchInfo::SwitchImmediate) {
+ instructions()[switchInfo.bytecodeOffset + 1] = m_codeBlock->numberOfImmediateSwitchJumpTables();
+ instructions()[switchInfo.bytecodeOffset + 2] = defaultLabel->bind(switchInfo.bytecodeOffset, switchInfo.bytecodeOffset + 3);
+
+ SimpleJumpTable& jumpTable = m_codeBlock->addImmediateSwitchJumpTable();
+ prepareJumpTableForImmediateSwitch(jumpTable, switchInfo.bytecodeOffset, clauseCount, labels, nodes, min, max);
+ } else if (switchInfo.switchType == SwitchInfo::SwitchCharacter) {
+ instructions()[switchInfo.bytecodeOffset + 1] = m_codeBlock->numberOfCharacterSwitchJumpTables();
+ instructions()[switchInfo.bytecodeOffset + 2] = defaultLabel->bind(switchInfo.bytecodeOffset, switchInfo.bytecodeOffset + 3);
+
+ SimpleJumpTable& jumpTable = m_codeBlock->addCharacterSwitchJumpTable();
+ prepareJumpTableForCharacterSwitch(jumpTable, switchInfo.bytecodeOffset, clauseCount, labels, nodes, min, max);
+ } else {
+ ASSERT(switchInfo.switchType == SwitchInfo::SwitchString);
+ instructions()[switchInfo.bytecodeOffset + 1] = m_codeBlock->numberOfStringSwitchJumpTables();
+ instructions()[switchInfo.bytecodeOffset + 2] = defaultLabel->bind(switchInfo.bytecodeOffset, switchInfo.bytecodeOffset + 3);
+
+ StringJumpTable& jumpTable = m_codeBlock->addStringSwitchJumpTable();
+ prepareJumpTableForStringSwitch(jumpTable, switchInfo.bytecodeOffset, clauseCount, labels, nodes);
+ }
+}
+
+RegisterID* BytecodeGenerator::emitThrowExpressionTooDeepException()
+{
+ // It would be nice to do an even better job of identifying exactly where the expression is.
+ // And we could make the caller pass the node pointer in, if there was some way of getting
+ // that from an arbitrary node. However, calling emitExpressionInfo without any useful data
+ // is still good enough to get us an accurate line number.
+ emitExpressionInfo(0, 0, 0);
+ emitThrowSyntaxError("Expression too deep");
+ return newTemporary();
+}
+
+void BytecodeGenerator::setIsNumericCompareFunction(bool isNumericCompareFunction)
+{
+ m_codeBlock->setIsNumericCompareFunction(isNumericCompareFunction);
+}
+
+int BytecodeGenerator::argumentNumberFor(const Identifier& ident)
+{
+ int parameterCount = m_parameters.size(); // includes 'this'
+ RegisterID* registerID = registerFor(ident);
+ if (!registerID)
+ return 0;
+ int index = registerID->index() + RegisterFile::CallFrameHeaderSize + parameterCount;
+ return (index > 0 && index < parameterCount) ? index : 0;
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h b/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h
new file mode 100644
index 0000000..37756fa
--- /dev/null
+++ b/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h
@@ -0,0 +1,588 @@
+/*
+ * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2008 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef BytecodeGenerator_h
+#define BytecodeGenerator_h
+
+#include "CodeBlock.h"
+#include "HashTraits.h"
+#include "Instruction.h"
+#include "Label.h"
+#include "LabelScope.h"
+#include "Interpreter.h"
+#include "RegisterID.h"
+#include "SymbolTable.h"
+#include "Debugger.h"
+#include "Nodes.h"
+#include <wtf/FastAllocBase.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/SegmentedVector.h>
+#include <wtf/Vector.h>
+
+namespace JSC {
+
+ class Identifier;
+ class ScopeChain;
+ class ScopeNode;
+
+ class CallArguments {
+ public:
+ CallArguments(BytecodeGenerator& generator, ArgumentsNode* argumentsNode);
+
+ RegisterID* thisRegister() { return m_argv[0].get(); }
+ RegisterID* argumentRegister(unsigned i) { return m_argv[i + 1].get(); }
+ unsigned callFrame() { return thisRegister()->index() + count() + RegisterFile::CallFrameHeaderSize; }
+ unsigned count() { return m_argv.size(); }
+ RegisterID* profileHookRegister() { return m_profileHookRegister.get(); }
+ ArgumentsNode* argumentsNode() { return m_argumentsNode; }
+
+ private:
+ RefPtr<RegisterID> m_profileHookRegister;
+ ArgumentsNode* m_argumentsNode;
+ Vector<RefPtr<RegisterID>, 16> m_argv;
+ };
+
+ struct FinallyContext {
+ Label* finallyAddr;
+ RegisterID* retAddrDst;
+ };
+
+ struct ControlFlowContext {
+ bool isFinallyBlock;
+ FinallyContext finallyContext;
+ };
+
+ struct ForInContext {
+ RefPtr<RegisterID> expectedSubscriptRegister;
+ RefPtr<RegisterID> iterRegister;
+ RefPtr<RegisterID> indexRegister;
+ RefPtr<RegisterID> propertyRegister;
+ };
+
+ class BytecodeGenerator : public FastAllocBase {
+ public:
+ typedef DeclarationStacks::VarStack VarStack;
+ typedef DeclarationStacks::FunctionStack FunctionStack;
+
+ static void setDumpsGeneratedCode(bool dumpsGeneratedCode);
+ static bool dumpsGeneratedCode();
+
+ BytecodeGenerator(ProgramNode*, const ScopeChain&, SymbolTable*, ProgramCodeBlock*);
+ BytecodeGenerator(FunctionBodyNode*, const ScopeChain&, SymbolTable*, CodeBlock*);
+ BytecodeGenerator(EvalNode*, const ScopeChain&, SymbolTable*, EvalCodeBlock*);
+
+ JSGlobalData* globalData() const { return m_globalData; }
+ const CommonIdentifiers& propertyNames() const { return *m_globalData->propertyNames; }
+
+ bool isConstructor() { return m_codeBlock->m_isConstructor; }
+
+ void generate();
+
+ // Returns the register corresponding to a local variable, or 0 if no
+ // such register exists. Registers returned by registerFor do not
+ // require explicit reference counting.
+ RegisterID* registerFor(const Identifier&);
+
+ // Returns the agument number if this is an argument, or 0 if not.
+ int argumentNumberFor(const Identifier&);
+
+ void setIsNumericCompareFunction(bool isNumericCompareFunction);
+
+ bool willResolveToArguments(const Identifier&);
+ RegisterID* uncheckedRegisterForArguments();
+
+ // Behaves as registerFor does, but ignores dynamic scope as
+ // dynamic scope should not interfere with const initialisation
+ RegisterID* constRegisterFor(const Identifier&);
+
+ // Searches the scope chain in an attempt to statically locate the requested
+ // property. Returns false if for any reason the property cannot be safely
+ // optimised at all. Otherwise it will return the index and depth of the
+ // VariableObject that defines the property. If the property cannot be found
+ // statically, depth will contain the depth of the scope chain where dynamic
+ // lookup must begin.
+ bool findScopedProperty(const Identifier&, int& index, size_t& depth, bool forWriting, bool& includesDynamicScopes, JSObject*& globalObject);
+
+ // Returns the register storing "this"
+ RegisterID* thisRegister() { return &m_thisRegister; }
+
+ bool isLocal(const Identifier&);
+ bool isLocalConstant(const Identifier&);
+
+ // Returns the next available temporary register. Registers returned by
+ // newTemporary require a modified form of reference counting: any
+ // register with a refcount of 0 is considered "available", meaning that
+ // the next instruction may overwrite it.
+ RegisterID* newTemporary();
+
+ RegisterID* highestUsedRegister();
+
+ // The same as newTemporary(), but this function returns "suggestion" if
+ // "suggestion" is a temporary. This function is helpful in situations
+ // where you've put "suggestion" in a RefPtr, but you'd like to allow
+ // the next instruction to overwrite it anyway.
+ RegisterID* newTemporaryOr(RegisterID* suggestion) { return suggestion->isTemporary() ? suggestion : newTemporary(); }
+
+ // Functions for handling of dst register
+
+ RegisterID* ignoredResult() { return &m_ignoredResultRegister; }
+
+ // Returns a place to write intermediate values of an operation
+ // which reuses dst if it is safe to do so.
+ RegisterID* tempDestination(RegisterID* dst)
+ {
+ return (dst && dst != ignoredResult() && dst->isTemporary()) ? dst : newTemporary();
+ }
+
+ // Returns the place to write the final output of an operation.
+ RegisterID* finalDestination(RegisterID* originalDst, RegisterID* tempDst = 0)
+ {
+ if (originalDst && originalDst != ignoredResult())
+ return originalDst;
+ ASSERT(tempDst != ignoredResult());
+ if (tempDst && tempDst->isTemporary())
+ return tempDst;
+ return newTemporary();
+ }
+
+ // Returns the place to write the final output of an operation.
+ RegisterID* finalDestinationOrIgnored(RegisterID* originalDst, RegisterID* tempDst = 0)
+ {
+ if (originalDst)
+ return originalDst;
+ ASSERT(tempDst != ignoredResult());
+ if (tempDst && tempDst->isTemporary())
+ return tempDst;
+ return newTemporary();
+ }
+
+ RegisterID* destinationForAssignResult(RegisterID* dst)
+ {
+ if (dst && dst != ignoredResult() && m_codeBlock->needsFullScopeChain())
+ return dst->isTemporary() ? dst : newTemporary();
+ return 0;
+ }
+
+ // Moves src to dst if dst is not null and is different from src, otherwise just returns src.
+ RegisterID* moveToDestinationIfNeeded(RegisterID* dst, RegisterID* src)
+ {
+ return dst == ignoredResult() ? 0 : (dst && dst != src) ? emitMove(dst, src) : src;
+ }
+
+ PassRefPtr<LabelScope> newLabelScope(LabelScope::Type, const Identifier* = 0);
+ PassRefPtr<Label> newLabel();
+
+ // The emitNode functions are just syntactic sugar for calling
+ // Node::emitCode. These functions accept a 0 for the register,
+ // meaning that the node should allocate a register, or ignoredResult(),
+ // meaning that the node need not put the result in a register.
+ // Other emit functions do not accept 0 or ignoredResult().
+ RegisterID* emitNode(RegisterID* dst, Node* n)
+ {
+ // Node::emitCode assumes that dst, if provided, is either a local or a referenced temporary.
+ ASSERT(!dst || dst == ignoredResult() || !dst->isTemporary() || dst->refCount());
+ addLineInfo(n->lineNo());
+ return m_stack.recursionCheck()
+ ? n->emitBytecode(*this, dst)
+ : emitThrowExpressionTooDeepException();
+ }
+
+ RegisterID* emitNode(Node* n)
+ {
+ return emitNode(0, n);
+ }
+
+ void emitNodeInConditionContext(ExpressionNode* n, Label* trueTarget, Label* falseTarget, bool fallThroughMeansTrue)
+ {
+ addLineInfo(n->lineNo());
+ if (m_stack.recursionCheck())
+ n->emitBytecodeInConditionContext(*this, trueTarget, falseTarget, fallThroughMeansTrue);
+ else
+ emitThrowExpressionTooDeepException();
+ }
+
+ void emitExpressionInfo(unsigned divot, unsigned startOffset, unsigned endOffset)
+ {
+ if (!m_shouldEmitRichSourceInfo)
+ return;
+
+ divot -= m_codeBlock->sourceOffset();
+ if (divot > ExpressionRangeInfo::MaxDivot) {
+ // Overflow has occurred, we can only give line number info for errors for this region
+ divot = 0;
+ startOffset = 0;
+ endOffset = 0;
+ } else if (startOffset > ExpressionRangeInfo::MaxOffset) {
+ // If the start offset is out of bounds we clear both offsets
+ // so we only get the divot marker. Error message will have to be reduced
+ // to line and column number.
+ startOffset = 0;
+ endOffset = 0;
+ } else if (endOffset > ExpressionRangeInfo::MaxOffset) {
+ // The end offset is only used for additional context, and is much more likely
+ // to overflow (eg. function call arguments) so we are willing to drop it without
+ // dropping the rest of the range.
+ endOffset = 0;
+ }
+
+ ExpressionRangeInfo info;
+ info.instructionOffset = instructions().size();
+ info.divotPoint = divot;
+ info.startOffset = startOffset;
+ info.endOffset = endOffset;
+ m_codeBlock->addExpressionInfo(info);
+ }
+
+ ALWAYS_INLINE bool leftHandSideNeedsCopy(bool rightHasAssignments, bool rightIsPure)
+ {
+ return (m_codeType != FunctionCode || m_codeBlock->needsFullScopeChain() || rightHasAssignments) && !rightIsPure;
+ }
+
+ ALWAYS_INLINE PassRefPtr<RegisterID> emitNodeForLeftHandSide(ExpressionNode* n, bool rightHasAssignments, bool rightIsPure)
+ {
+ if (leftHandSideNeedsCopy(rightHasAssignments, rightIsPure)) {
+ PassRefPtr<RegisterID> dst = newTemporary();
+ emitNode(dst.get(), n);
+ return dst;
+ }
+
+ return PassRefPtr<RegisterID>(emitNode(n));
+ }
+
+ RegisterID* emitLoad(RegisterID* dst, bool);
+ RegisterID* emitLoad(RegisterID* dst, double);
+ RegisterID* emitLoad(RegisterID* dst, const Identifier&);
+ RegisterID* emitLoad(RegisterID* dst, JSValue);
+
+ RegisterID* emitUnaryOp(OpcodeID, RegisterID* dst, RegisterID* src);
+ RegisterID* emitBinaryOp(OpcodeID, RegisterID* dst, RegisterID* src1, RegisterID* src2, OperandTypes);
+ RegisterID* emitEqualityOp(OpcodeID, RegisterID* dst, RegisterID* src1, RegisterID* src2);
+ RegisterID* emitUnaryNoDstOp(OpcodeID, RegisterID* src);
+
+ RegisterID* emitNewObject(RegisterID* dst);
+ RegisterID* emitNewArray(RegisterID* dst, ElementNode*); // stops at first elision
+
+ RegisterID* emitNewFunction(RegisterID* dst, FunctionBodyNode* body);
+ RegisterID* emitLazyNewFunction(RegisterID* dst, FunctionBodyNode* body);
+ RegisterID* emitNewFunctionInternal(RegisterID* dst, unsigned index, bool shouldNullCheck);
+ RegisterID* emitNewFunctionExpression(RegisterID* dst, FuncExprNode* func);
+ RegisterID* emitNewRegExp(RegisterID* dst, RegExp* regExp);
+
+ RegisterID* emitMove(RegisterID* dst, RegisterID* src);
+
+ RegisterID* emitToJSNumber(RegisterID* dst, RegisterID* src) { return emitUnaryOp(op_to_jsnumber, dst, src); }
+ RegisterID* emitPreInc(RegisterID* srcDst);
+ RegisterID* emitPreDec(RegisterID* srcDst);
+ RegisterID* emitPostInc(RegisterID* dst, RegisterID* srcDst);
+ RegisterID* emitPostDec(RegisterID* dst, RegisterID* srcDst);
+
+ void emitCheckHasInstance(RegisterID* base);
+ RegisterID* emitInstanceOf(RegisterID* dst, RegisterID* value, RegisterID* base, RegisterID* basePrototype);
+ RegisterID* emitTypeOf(RegisterID* dst, RegisterID* src) { return emitUnaryOp(op_typeof, dst, src); }
+ RegisterID* emitIn(RegisterID* dst, RegisterID* property, RegisterID* base) { return emitBinaryOp(op_in, dst, property, base, OperandTypes()); }
+
+ RegisterID* emitResolve(RegisterID* dst, const Identifier& property);
+ RegisterID* emitGetScopedVar(RegisterID* dst, size_t skip, int index, JSValue globalObject);
+ RegisterID* emitPutScopedVar(size_t skip, int index, RegisterID* value, JSValue globalObject);
+
+ RegisterID* emitResolveBase(RegisterID* dst, const Identifier& property);
+ RegisterID* emitResolveBaseForPut(RegisterID* dst, const Identifier& property);
+ RegisterID* emitResolveWithBase(RegisterID* baseDst, RegisterID* propDst, const Identifier& property);
+
+ void emitMethodCheck();
+
+ RegisterID* emitGetById(RegisterID* dst, RegisterID* base, const Identifier& property);
+ RegisterID* emitGetArgumentsLength(RegisterID* dst, RegisterID* base);
+ RegisterID* emitPutById(RegisterID* base, const Identifier& property, RegisterID* value);
+ RegisterID* emitDirectPutById(RegisterID* base, const Identifier& property, RegisterID* value);
+ RegisterID* emitDeleteById(RegisterID* dst, RegisterID* base, const Identifier&);
+ RegisterID* emitGetByVal(RegisterID* dst, RegisterID* base, RegisterID* property);
+ RegisterID* emitGetArgumentByVal(RegisterID* dst, RegisterID* base, RegisterID* property);
+ RegisterID* emitPutByVal(RegisterID* base, RegisterID* property, RegisterID* value);
+ RegisterID* emitDeleteByVal(RegisterID* dst, RegisterID* base, RegisterID* property);
+ RegisterID* emitPutByIndex(RegisterID* base, unsigned index, RegisterID* value);
+ RegisterID* emitPutGetter(RegisterID* base, const Identifier& property, RegisterID* value);
+ RegisterID* emitPutSetter(RegisterID* base, const Identifier& property, RegisterID* value);
+
+ RegisterID* emitCall(RegisterID* dst, RegisterID* func, CallArguments&, unsigned divot, unsigned startOffset, unsigned endOffset);
+ RegisterID* emitCallEval(RegisterID* dst, RegisterID* func, CallArguments&, unsigned divot, unsigned startOffset, unsigned endOffset);
+ RegisterID* emitCallVarargs(RegisterID* dst, RegisterID* func, RegisterID* thisRegister, RegisterID* argCount, unsigned divot, unsigned startOffset, unsigned endOffset);
+ RegisterID* emitLoadVarargs(RegisterID* argCountDst, RegisterID* thisRegister, RegisterID* args);
+
+ RegisterID* emitReturn(RegisterID* src);
+ RegisterID* emitEnd(RegisterID* src) { return emitUnaryNoDstOp(op_end, src); }
+
+ RegisterID* emitConstruct(RegisterID* dst, RegisterID* func, CallArguments&, unsigned divot, unsigned startOffset, unsigned endOffset);
+ RegisterID* emitStrcat(RegisterID* dst, RegisterID* src, int count);
+ void emitToPrimitive(RegisterID* dst, RegisterID* src);
+
+ PassRefPtr<Label> emitLabel(Label*);
+ PassRefPtr<Label> emitJump(Label* target);
+ PassRefPtr<Label> emitJumpIfTrue(RegisterID* cond, Label* target);
+ PassRefPtr<Label> emitJumpIfFalse(RegisterID* cond, Label* target);
+ PassRefPtr<Label> emitJumpIfNotFunctionCall(RegisterID* cond, Label* target);
+ PassRefPtr<Label> emitJumpIfNotFunctionApply(RegisterID* cond, Label* target);
+ PassRefPtr<Label> emitJumpScopes(Label* target, int targetScopeDepth);
+
+ PassRefPtr<Label> emitJumpSubroutine(RegisterID* retAddrDst, Label*);
+ void emitSubroutineReturn(RegisterID* retAddrSrc);
+
+ RegisterID* emitGetPropertyNames(RegisterID* dst, RegisterID* base, RegisterID* i, RegisterID* size, Label* breakTarget);
+ RegisterID* emitNextPropertyName(RegisterID* dst, RegisterID* base, RegisterID* i, RegisterID* size, RegisterID* iter, Label* target);
+
+ RegisterID* emitCatch(RegisterID*, Label* start, Label* end);
+ void emitThrow(RegisterID* exc)
+ {
+ m_usesExceptions = true;
+ emitUnaryNoDstOp(op_throw, exc);
+ }
+
+ void emitThrowReferenceError(const UString& message);
+ void emitThrowSyntaxError(const UString& message);
+
+ void emitPushNewScope(RegisterID* dst, const Identifier& property, RegisterID* value);
+
+ RegisterID* emitPushScope(RegisterID* scope);
+ void emitPopScope();
+
+ void emitDebugHook(DebugHookID, int firstLine, int lastLine);
+
+ int scopeDepth() { return m_dynamicScopeDepth + m_finallyDepth; }
+ bool hasFinaliser() { return m_finallyDepth != 0; }
+
+ void pushFinallyContext(Label* target, RegisterID* returnAddrDst);
+ void popFinallyContext();
+
+ void pushOptimisedForIn(RegisterID* expectedBase, RegisterID* iter, RegisterID* index, RegisterID* propertyRegister)
+ {
+ ForInContext context = { expectedBase, iter, index, propertyRegister };
+ m_forInContextStack.append(context);
+ }
+
+ void popOptimisedForIn()
+ {
+ m_forInContextStack.removeLast();
+ }
+
+ LabelScope* breakTarget(const Identifier&);
+ LabelScope* continueTarget(const Identifier&);
+
+ void beginSwitch(RegisterID*, SwitchInfo::SwitchType);
+ void endSwitch(uint32_t clauseCount, RefPtr<Label>*, ExpressionNode**, Label* defaultLabel, int32_t min, int32_t range);
+
+ CodeType codeType() const { return m_codeType; }
+
+ void setRegeneratingForExceptionInfo(CodeBlock* originalCodeBlock)
+ {
+ m_regeneratingForExceptionInfo = true;
+ m_codeBlockBeingRegeneratedFrom = originalCodeBlock;
+ }
+
+ bool shouldEmitProfileHooks() { return m_shouldEmitProfileHooks; }
+
+ bool isStrictMode() const { return m_codeBlock->isStrictMode(); }
+
+ private:
+ void emitOpcode(OpcodeID);
+ void retrieveLastBinaryOp(int& dstIndex, int& src1Index, int& src2Index);
+ void retrieveLastUnaryOp(int& dstIndex, int& srcIndex);
+ ALWAYS_INLINE void rewindBinaryOp();
+ ALWAYS_INLINE void rewindUnaryOp();
+
+ PassRefPtr<Label> emitComplexJumpScopes(Label* target, ControlFlowContext* topScope, ControlFlowContext* bottomScope);
+
+ typedef HashMap<EncodedJSValue, unsigned, EncodedJSValueHash, EncodedJSValueHashTraits> JSValueMap;
+
+ struct IdentifierMapIndexHashTraits {
+ typedef int TraitType;
+ typedef IdentifierMapIndexHashTraits StorageTraits;
+ static int emptyValue() { return std::numeric_limits<int>::max(); }
+ static const bool emptyValueIsZero = false;
+ static const bool needsDestruction = false;
+ static const bool needsRef = false;
+ };
+
+ typedef HashMap<RefPtr<StringImpl>, int, IdentifierRepHash, HashTraits<RefPtr<StringImpl> >, IdentifierMapIndexHashTraits> IdentifierMap;
+ typedef HashMap<double, JSValue> NumberMap;
+ typedef HashMap<StringImpl*, JSString*, IdentifierRepHash> IdentifierStringMap;
+
+ RegisterID* emitCall(OpcodeID, RegisterID* dst, RegisterID* func, CallArguments&, unsigned divot, unsigned startOffset, unsigned endOffset);
+
+ RegisterID* newRegister();
+
+ // Adds a var slot and maps it to the name ident in symbolTable().
+ RegisterID* addVar(const Identifier& ident, bool isConstant)
+ {
+ RegisterID* local;
+ addVar(ident, isConstant, local);
+ return local;
+ }
+
+ // Ditto. Returns true if a new RegisterID was added, false if a pre-existing RegisterID was re-used.
+ bool addVar(const Identifier&, bool isConstant, RegisterID*&);
+
+ // Adds an anonymous var slot. To give this slot a name, add it to symbolTable().
+ RegisterID* addVar()
+ {
+ ++m_codeBlock->m_numVars;
+ return newRegister();
+ }
+
+ // Returns the RegisterID corresponding to ident.
+ RegisterID* addGlobalVar(const Identifier& ident, bool isConstant)
+ {
+ RegisterID* local;
+ addGlobalVar(ident, isConstant, local);
+ return local;
+ }
+ // Returns true if a new RegisterID was added, false if a pre-existing RegisterID was re-used.
+ bool addGlobalVar(const Identifier&, bool isConstant, RegisterID*&);
+
+ void addParameter(const Identifier&, int parameterIndex);
+
+ void preserveLastVar();
+
+ RegisterID& registerFor(int index)
+ {
+ if (index >= 0)
+ return m_calleeRegisters[index];
+
+ if (m_parameters.size()) {
+ ASSERT(!m_globals.size());
+ return m_parameters[index + m_parameters.size() + RegisterFile::CallFrameHeaderSize];
+ }
+
+ return m_globals[-index - 1];
+ }
+
+ unsigned addConstant(const Identifier&);
+ RegisterID* addConstantValue(JSValue);
+ unsigned addRegExp(RegExp*);
+
+ PassRefPtr<FunctionExecutable> makeFunction(ExecState* exec, FunctionBodyNode* body)
+ {
+ return FunctionExecutable::create(exec, body->ident(), body->source(), body->usesArguments(), body->parameters(), body->isStrictMode(), body->lineNo(), body->lastLine());
+ }
+
+ PassRefPtr<FunctionExecutable> makeFunction(JSGlobalData* globalData, FunctionBodyNode* body)
+ {
+ return FunctionExecutable::create(globalData, body->ident(), body->source(), body->usesArguments(), body->parameters(), body->isStrictMode(), body->lineNo(), body->lastLine());
+ }
+
+ void addLineInfo(unsigned lineNo)
+ {
+#if !ENABLE(OPCODE_SAMPLING)
+ if (m_shouldEmitRichSourceInfo)
+#endif
+ m_codeBlock->addLineInfo(instructions().size(), lineNo);
+ }
+
+ RegisterID* emitInitLazyRegister(RegisterID*);
+
+ Vector<Instruction>& instructions() { return m_codeBlock->instructions(); }
+ SymbolTable& symbolTable() { return *m_symbolTable; }
+
+ bool shouldOptimizeLocals() { return (m_codeType != EvalCode) && !m_dynamicScopeDepth; }
+ bool canOptimizeNonLocals() { return (m_codeType == FunctionCode) && !m_dynamicScopeDepth && !m_codeBlock->usesEval(); }
+
+ RegisterID* emitThrowExpressionTooDeepException();
+
+ void createArgumentsIfNecessary();
+ void createActivationIfNecessary();
+ RegisterID* createLazyRegisterIfNecessary(RegisterID*);
+
+ bool m_shouldEmitDebugHooks;
+ bool m_shouldEmitProfileHooks;
+ bool m_shouldEmitRichSourceInfo;
+
+ const ScopeChain* m_scopeChain;
+ SymbolTable* m_symbolTable;
+
+ ScopeNode* m_scopeNode;
+ CodeBlock* m_codeBlock;
+
+ // Some of these objects keep pointers to one another. They are arranged
+ // to ensure a sane destruction order that avoids references to freed memory.
+ HashSet<RefPtr<StringImpl>, IdentifierRepHash> m_functions;
+ RegisterID m_ignoredResultRegister;
+ RegisterID m_thisRegister;
+ RegisterID* m_activationRegister;
+ SegmentedVector<RegisterID, 32> m_constantPoolRegisters;
+ SegmentedVector<RegisterID, 32> m_calleeRegisters;
+ SegmentedVector<RegisterID, 32> m_parameters;
+ SegmentedVector<RegisterID, 32> m_globals;
+ SegmentedVector<Label, 32> m_labels;
+ SegmentedVector<LabelScope, 8> m_labelScopes;
+ RefPtr<RegisterID> m_lastVar;
+ int m_finallyDepth;
+ int m_dynamicScopeDepth;
+ int m_baseScopeDepth;
+ CodeType m_codeType;
+
+ Vector<ControlFlowContext> m_scopeContextStack;
+ Vector<SwitchInfo> m_switchContextStack;
+ Vector<ForInContext> m_forInContextStack;
+
+ int m_nextGlobalIndex;
+ int m_firstConstantIndex;
+ int m_nextConstantOffset;
+ unsigned m_globalConstantIndex;
+
+ int m_globalVarStorageOffset;
+
+ bool m_hasCreatedActivation;
+ int m_firstLazyFunction;
+ int m_lastLazyFunction;
+ HashMap<unsigned int, FunctionBodyNode*, WTF::IntHash<unsigned int>, WTF::UnsignedWithZeroKeyHashTraits<unsigned int> > m_lazyFunctions;
+ typedef HashMap<FunctionBodyNode*, unsigned> FunctionOffsetMap;
+ FunctionOffsetMap m_functionOffsets;
+
+ // Constant pool
+ IdentifierMap m_identifierMap;
+ JSValueMap m_jsValueMap;
+ NumberMap m_numberMap;
+ IdentifierStringMap m_stringMap;
+
+ JSGlobalData* m_globalData;
+
+ OpcodeID m_lastOpcodeID;
+#ifndef NDEBUG
+ size_t m_lastOpcodePosition;
+#endif
+
+ StackBounds m_stack;
+
+ bool m_usesExceptions;
+ bool m_regeneratingForExceptionInfo;
+ CodeBlock* m_codeBlockBeingRegeneratedFrom;
+ };
+
+}
+
+#endif // BytecodeGenerator_h
diff --git a/Source/JavaScriptCore/bytecompiler/Label.h b/Source/JavaScriptCore/bytecompiler/Label.h
new file mode 100644
index 0000000..8cab1db
--- /dev/null
+++ b/Source/JavaScriptCore/bytecompiler/Label.h
@@ -0,0 +1,90 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef Label_h
+#define Label_h
+
+#include "CodeBlock.h"
+#include "Instruction.h"
+#include <wtf/Assertions.h>
+#include <wtf/Vector.h>
+#include <limits.h>
+
+namespace JSC {
+
+ class Label {
+ public:
+ explicit Label(CodeBlock* codeBlock)
+ : m_refCount(0)
+ , m_location(invalidLocation)
+ , m_codeBlock(codeBlock)
+ {
+ }
+
+ void setLocation(unsigned location)
+ {
+ m_location = location;
+
+ unsigned size = m_unresolvedJumps.size();
+ for (unsigned i = 0; i < size; ++i)
+ m_codeBlock->instructions()[m_unresolvedJumps[i].second].u.operand = m_location - m_unresolvedJumps[i].first;
+ }
+
+ int bind(int opcode, int offset) const
+ {
+ if (m_location == invalidLocation) {
+ m_unresolvedJumps.append(std::make_pair(opcode, offset));
+ return 0;
+ }
+ return m_location - opcode;
+ }
+
+ void ref() { ++m_refCount; }
+ void deref()
+ {
+ --m_refCount;
+ ASSERT(m_refCount >= 0);
+ }
+ int refCount() const { return m_refCount; }
+
+ bool isForward() const { return m_location == invalidLocation; }
+
+ private:
+ typedef Vector<std::pair<int, int>, 8> JumpVector;
+
+ static const unsigned invalidLocation = UINT_MAX;
+
+ int m_refCount;
+ unsigned m_location;
+ CodeBlock* m_codeBlock;
+ mutable JumpVector m_unresolvedJumps;
+ };
+
+} // namespace JSC
+
+#endif // Label_h
diff --git a/Source/JavaScriptCore/bytecompiler/LabelScope.h b/Source/JavaScriptCore/bytecompiler/LabelScope.h
new file mode 100644
index 0000000..cc21fff
--- /dev/null
+++ b/Source/JavaScriptCore/bytecompiler/LabelScope.h
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef LabelScope_h
+#define LabelScope_h
+
+#include <wtf/PassRefPtr.h>
+#include "Label.h"
+
+namespace JSC {
+
+ class Identifier;
+
+ class LabelScope {
+ public:
+ enum Type { Loop, Switch, NamedLabel };
+
+ LabelScope(Type type, const Identifier* name, int scopeDepth, PassRefPtr<Label> breakTarget, PassRefPtr<Label> continueTarget)
+ : m_refCount(0)
+ , m_type(type)
+ , m_name(name)
+ , m_scopeDepth(scopeDepth)
+ , m_breakTarget(breakTarget)
+ , m_continueTarget(continueTarget)
+ {
+ }
+
+ void ref() { ++m_refCount; }
+ void deref()
+ {
+ --m_refCount;
+ ASSERT(m_refCount >= 0);
+ }
+ int refCount() const { return m_refCount; }
+
+ Label* breakTarget() const { return m_breakTarget.get(); }
+ Label* continueTarget() const { return m_continueTarget.get(); }
+
+ Type type() const { return m_type; }
+ const Identifier* name() const { return m_name; }
+ int scopeDepth() const { return m_scopeDepth; }
+
+ private:
+ int m_refCount;
+ Type m_type;
+ const Identifier* m_name;
+ int m_scopeDepth;
+ RefPtr<Label> m_breakTarget;
+ RefPtr<Label> m_continueTarget;
+ };
+
+} // namespace JSC
+
+#endif // LabelScope_h
diff --git a/Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp b/Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp
new file mode 100644
index 0000000..a850c96
--- /dev/null
+++ b/Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp
@@ -0,0 +1,2076 @@
+/*
+* Copyright (C) 1999-2002 Harri Porten (porten@kde.org)
+* Copyright (C) 2001 Peter Kelly (pmk@post.com)
+* Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+* Copyright (C) 2007 Cameron Zwarich (cwzwarich@uwaterloo.ca)
+* Copyright (C) 2007 Maks Orlovich
+* Copyright (C) 2007 Eric Seidel <eric@webkit.org>
+*
+* This library is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Library General Public
+* License as published by the Free Software Foundation; either
+* version 2 of the License, or (at your option) any later version.
+*
+* This library is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Library General Public License for more details.
+*
+* You should have received a copy of the GNU Library General Public License
+* along with this library; see the file COPYING.LIB. If not, write to
+* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+* Boston, MA 02110-1301, USA.
+*
+*/
+
+#include "config.h"
+#include "Nodes.h"
+#include "NodeConstructors.h"
+
+#include "BytecodeGenerator.h"
+#include "CallFrame.h"
+#include "Debugger.h"
+#include "JIT.h"
+#include "JSFunction.h"
+#include "JSGlobalObject.h"
+#include "JSStaticScopeObject.h"
+#include "LabelScope.h"
+#include "Lexer.h"
+#include "Operations.h"
+#include "Parser.h"
+#include "PropertyNameArray.h"
+#include "RegExpCache.h"
+#include "RegExpObject.h"
+#include "SamplingTool.h"
+#include "UStringConcatenate.h"
+#include <wtf/Assertions.h>
+#include <wtf/RefCountedLeakCounter.h>
+#include <wtf/Threading.h>
+
+using namespace WTF;
+
+namespace JSC {
+
+/*
+ Details of the emitBytecode function.
+
+ Return value: The register holding the production's value.
+ dst: An optional parameter specifying the most efficient destination at
+ which to store the production's value. The callee must honor dst.
+
+ The dst argument provides for a crude form of copy propagation. For example,
+
+ x = 1
+
+ becomes
+
+ load r[x], 1
+
+ instead of
+
+ load r0, 1
+ mov r[x], r0
+
+ because the assignment node, "x =", passes r[x] as dst to the number node, "1".
+*/
+
+// ------------------------------ ThrowableExpressionData --------------------------------
+
+RegisterID* ThrowableExpressionData::emitThrowReferenceError(BytecodeGenerator& generator, const UString& message)
+{
+ generator.emitExpressionInfo(divot(), startOffset(), endOffset());
+ generator.emitThrowReferenceError(message);
+ return generator.newTemporary();
+}
+
+RegisterID* ThrowableExpressionData::emitThrowSyntaxError(BytecodeGenerator& generator, const UString& message)
+{
+ generator.emitExpressionInfo(divot(), startOffset(), endOffset());
+ generator.emitThrowSyntaxError(message);
+ return generator.newTemporary();
+}
+
+// ------------------------------ NullNode -------------------------------------
+
+RegisterID* NullNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ if (dst == generator.ignoredResult())
+ return 0;
+ return generator.emitLoad(dst, jsNull());
+}
+
+// ------------------------------ BooleanNode ----------------------------------
+
+RegisterID* BooleanNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ if (dst == generator.ignoredResult())
+ return 0;
+ return generator.emitLoad(dst, m_value);
+}
+
+// ------------------------------ NumberNode -----------------------------------
+
+RegisterID* NumberNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ if (dst == generator.ignoredResult())
+ return 0;
+ return generator.emitLoad(dst, m_value);
+}
+
+// ------------------------------ StringNode -----------------------------------
+
+RegisterID* StringNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ if (dst == generator.ignoredResult())
+ return 0;
+ return generator.emitLoad(dst, m_value);
+}
+
+// ------------------------------ RegExpNode -----------------------------------
+
+RegisterID* RegExpNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ RefPtr<RegExp> regExp = generator.globalData()->regExpCache()->lookupOrCreate(m_pattern.ustring(), m_flags.ustring());
+ if (!regExp->isValid())
+ return emitThrowSyntaxError(generator, makeUString("Invalid regular expression: ", regExp->errorMessage()));
+ if (dst == generator.ignoredResult())
+ return 0;
+ return generator.emitNewRegExp(generator.finalDestination(dst), regExp.get());
+}
+
+// ------------------------------ ThisNode -------------------------------------
+
+RegisterID* ThisNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ if (dst == generator.ignoredResult())
+ return 0;
+ return generator.moveToDestinationIfNeeded(dst, generator.thisRegister());
+}
+
+// ------------------------------ ResolveNode ----------------------------------
+
+bool ResolveNode::isPure(BytecodeGenerator& generator) const
+{
+ return generator.isLocal(m_ident);
+}
+
+RegisterID* ResolveNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ if (RegisterID* local = generator.registerFor(m_ident)) {
+ if (dst == generator.ignoredResult())
+ return 0;
+ return generator.moveToDestinationIfNeeded(dst, local);
+ }
+
+ generator.emitExpressionInfo(m_startOffset + m_ident.length(), m_ident.length(), 0);
+ return generator.emitResolve(generator.finalDestination(dst), m_ident);
+}
+
+// ------------------------------ ArrayNode ------------------------------------
+
+RegisterID* ArrayNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ // FIXME: Should we put all of this code into emitNewArray?
+
+ unsigned length = 0;
+ ElementNode* firstPutElement;
+ for (firstPutElement = m_element; firstPutElement; firstPutElement = firstPutElement->next()) {
+ if (firstPutElement->elision())
+ break;
+ ++length;
+ }
+
+ if (!firstPutElement && !m_elision)
+ return generator.emitNewArray(generator.finalDestination(dst), m_element);
+
+ RefPtr<RegisterID> array = generator.emitNewArray(generator.tempDestination(dst), m_element);
+
+ for (ElementNode* n = firstPutElement; n; n = n->next()) {
+ RegisterID* value = generator.emitNode(n->value());
+ length += n->elision();
+ generator.emitPutByIndex(array.get(), length++, value);
+ }
+
+ if (m_elision) {
+ RegisterID* value = generator.emitLoad(0, jsNumber(m_elision + length));
+ generator.emitPutById(array.get(), generator.propertyNames().length, value);
+ }
+
+ return generator.moveToDestinationIfNeeded(dst, array.get());
+}
+
+bool ArrayNode::isSimpleArray() const
+{
+ if (m_elision || m_optional)
+ return false;
+ for (ElementNode* ptr = m_element; ptr; ptr = ptr->next()) {
+ if (ptr->elision())
+ return false;
+ }
+ return true;
+}
+
+ArgumentListNode* ArrayNode::toArgumentList(JSGlobalData* globalData) const
+{
+ ASSERT(!m_elision && !m_optional);
+ ElementNode* ptr = m_element;
+ if (!ptr)
+ return 0;
+ ArgumentListNode* head = new (globalData) ArgumentListNode(globalData, ptr->value());
+ ArgumentListNode* tail = head;
+ ptr = ptr->next();
+ for (; ptr; ptr = ptr->next()) {
+ ASSERT(!ptr->elision());
+ tail = new (globalData) ArgumentListNode(globalData, tail, ptr->value());
+ }
+ return head;
+}
+
+// ------------------------------ ObjectLiteralNode ----------------------------
+
+RegisterID* ObjectLiteralNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ if (!m_list) {
+ if (dst == generator.ignoredResult())
+ return 0;
+ return generator.emitNewObject(generator.finalDestination(dst));
+ }
+ return generator.emitNode(dst, m_list);
+}
+
+// ------------------------------ PropertyListNode -----------------------------
+
+RegisterID* PropertyListNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ RefPtr<RegisterID> newObj = generator.tempDestination(dst);
+
+ generator.emitNewObject(newObj.get());
+
+ for (PropertyListNode* p = this; p; p = p->m_next) {
+ RegisterID* value = generator.emitNode(p->m_node->m_assign);
+
+ switch (p->m_node->m_type) {
+ case PropertyNode::Constant: {
+ generator.emitDirectPutById(newObj.get(), p->m_node->name(), value);
+ break;
+ }
+ case PropertyNode::Getter: {
+ generator.emitPutGetter(newObj.get(), p->m_node->name(), value);
+ break;
+ }
+ case PropertyNode::Setter: {
+ generator.emitPutSetter(newObj.get(), p->m_node->name(), value);
+ break;
+ }
+ default:
+ ASSERT_NOT_REACHED();
+ }
+ }
+
+ return generator.moveToDestinationIfNeeded(dst, newObj.get());
+}
+
+// ------------------------------ BracketAccessorNode --------------------------------
+
+RegisterID* BracketAccessorNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ if (m_base->isResolveNode() && generator.willResolveToArguments(static_cast<ResolveNode*>(m_base)->identifier())) {
+ RegisterID* property = generator.emitNode(m_subscript);
+ generator.emitExpressionInfo(divot(), startOffset(), endOffset());
+ return generator.emitGetArgumentByVal(generator.finalDestination(dst), generator.uncheckedRegisterForArguments(), property);
+ }
+
+ RefPtr<RegisterID> base = generator.emitNodeForLeftHandSide(m_base, m_subscriptHasAssignments, m_subscript->isPure(generator));
+ RegisterID* property = generator.emitNode(m_subscript);
+ generator.emitExpressionInfo(divot(), startOffset(), endOffset());
+ return generator.emitGetByVal(generator.finalDestination(dst), base.get(), property);
+}
+
+// ------------------------------ DotAccessorNode --------------------------------
+
+RegisterID* DotAccessorNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ if (m_ident == generator.propertyNames().length) {
+ if (!m_base->isResolveNode())
+ goto nonArgumentsPath;
+ ResolveNode* resolveNode = static_cast<ResolveNode*>(m_base);
+ if (!generator.willResolveToArguments(resolveNode->identifier()))
+ goto nonArgumentsPath;
+ generator.emitExpressionInfo(divot(), startOffset(), endOffset());
+ return generator.emitGetArgumentsLength(generator.finalDestination(dst), generator.uncheckedRegisterForArguments());
+ }
+
+nonArgumentsPath:
+ RegisterID* base = generator.emitNode(m_base);
+ generator.emitExpressionInfo(divot(), startOffset(), endOffset());
+ return generator.emitGetById(generator.finalDestination(dst), base, m_ident);
+}
+
+// ------------------------------ ArgumentListNode -----------------------------
+
+RegisterID* ArgumentListNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ ASSERT(m_expr);
+ return generator.emitNode(dst, m_expr);
+}
+
+// ------------------------------ NewExprNode ----------------------------------
+
+RegisterID* NewExprNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ RefPtr<RegisterID> func = generator.emitNode(m_expr);
+ CallArguments callArguments(generator, m_args);
+ return generator.emitConstruct(generator.finalDestinationOrIgnored(dst), func.get(), callArguments, divot(), startOffset(), endOffset());
+}
+
+CallArguments::CallArguments(BytecodeGenerator& generator, ArgumentsNode* argumentsNode)
+ : m_argumentsNode(argumentsNode)
+{
+ if (generator.shouldEmitProfileHooks())
+ m_profileHookRegister = generator.newTemporary();
+ m_argv.append(generator.newTemporary());
+ if (argumentsNode) {
+ for (ArgumentListNode* n = argumentsNode->m_listNode; n; n = n->m_next) {
+ m_argv.append(generator.newTemporary());
+ // op_call requires the arguments to be a sequential range of registers
+ ASSERT(m_argv[m_argv.size() - 1]->index() == m_argv[m_argv.size() - 2]->index() + 1);
+ }
+ }
+}
+
+// ------------------------------ EvalFunctionCallNode ----------------------------------
+
+RegisterID* EvalFunctionCallNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ RefPtr<RegisterID> func = generator.tempDestination(dst);
+ CallArguments callArguments(generator, m_args);
+ generator.emitExpressionInfo(divot() - startOffset() + 4, 4, 0);
+ generator.emitResolveWithBase(callArguments.thisRegister(), func.get(), generator.propertyNames().eval);
+ return generator.emitCallEval(generator.finalDestination(dst, func.get()), func.get(), callArguments, divot(), startOffset(), endOffset());
+}
+
+// ------------------------------ FunctionCallValueNode ----------------------------------
+
+RegisterID* FunctionCallValueNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ RefPtr<RegisterID> func = generator.emitNode(m_expr);
+ CallArguments callArguments(generator, m_args);
+ generator.emitLoad(callArguments.thisRegister(), jsUndefined());
+ return generator.emitCall(generator.finalDestinationOrIgnored(dst, func.get()), func.get(), callArguments, divot(), startOffset(), endOffset());
+}
+
+// ------------------------------ FunctionCallResolveNode ----------------------------------
+
+RegisterID* FunctionCallResolveNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ if (RefPtr<RegisterID> local = generator.registerFor(m_ident)) {
+ CallArguments callArguments(generator, m_args);
+ generator.emitLoad(callArguments.thisRegister(), jsUndefined());
+ return generator.emitCall(generator.finalDestinationOrIgnored(dst, callArguments.thisRegister()), local.get(), callArguments, divot(), startOffset(), endOffset());
+ }
+
+ int index = 0;
+ size_t depth = 0;
+ JSObject* globalObject = 0;
+ bool requiresDynamicChecks = false;
+ if (generator.findScopedProperty(m_ident, index, depth, false, requiresDynamicChecks, globalObject) && index != missingSymbolMarker() && !requiresDynamicChecks) {
+ RefPtr<RegisterID> func = generator.emitGetScopedVar(generator.newTemporary(), depth, index, globalObject);
+ CallArguments callArguments(generator, m_args);
+ generator.emitLoad(callArguments.thisRegister(), jsUndefined());
+ return generator.emitCall(generator.finalDestinationOrIgnored(dst, func.get()), func.get(), callArguments, divot(), startOffset(), endOffset());
+ }
+
+ RefPtr<RegisterID> func = generator.newTemporary();
+ CallArguments callArguments(generator, m_args);
+ int identifierStart = divot() - startOffset();
+ generator.emitExpressionInfo(identifierStart + m_ident.length(), m_ident.length(), 0);
+ generator.emitResolveWithBase(callArguments.thisRegister(), func.get(), m_ident);
+ return generator.emitCall(generator.finalDestinationOrIgnored(dst, func.get()), func.get(), callArguments, divot(), startOffset(), endOffset());
+}
+
+// ------------------------------ FunctionCallBracketNode ----------------------------------
+
+RegisterID* FunctionCallBracketNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ RefPtr<RegisterID> base = generator.emitNode(m_base);
+ RegisterID* property = generator.emitNode(m_subscript);
+ generator.emitExpressionInfo(divot() - m_subexpressionDivotOffset, startOffset() - m_subexpressionDivotOffset, m_subexpressionEndOffset);
+ RefPtr<RegisterID> function = generator.emitGetByVal(generator.tempDestination(dst), base.get(), property);
+ CallArguments callArguments(generator, m_args);
+ generator.emitMove(callArguments.thisRegister(), base.get());
+ return generator.emitCall(generator.finalDestinationOrIgnored(dst, function.get()), function.get(), callArguments, divot(), startOffset(), endOffset());
+}
+
+// ------------------------------ FunctionCallDotNode ----------------------------------
+
+RegisterID* FunctionCallDotNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ RefPtr<RegisterID> function = generator.tempDestination(dst);
+ CallArguments callArguments(generator, m_args);
+ generator.emitNode(callArguments.thisRegister(), m_base);
+ generator.emitExpressionInfo(divot() - m_subexpressionDivotOffset, startOffset() - m_subexpressionDivotOffset, m_subexpressionEndOffset);
+ generator.emitMethodCheck();
+ generator.emitGetById(function.get(), callArguments.thisRegister(), m_ident);
+ return generator.emitCall(generator.finalDestinationOrIgnored(dst, function.get()), function.get(), callArguments, divot(), startOffset(), endOffset());
+}
+
+RegisterID* CallFunctionCallDotNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ RefPtr<Label> realCall = generator.newLabel();
+ RefPtr<Label> end = generator.newLabel();
+ RefPtr<RegisterID> base = generator.emitNode(m_base);
+ generator.emitExpressionInfo(divot() - m_subexpressionDivotOffset, startOffset() - m_subexpressionDivotOffset, m_subexpressionEndOffset);
+ RefPtr<RegisterID> function = generator.emitGetById(generator.tempDestination(dst), base.get(), m_ident);
+ RefPtr<RegisterID> finalDestinationOrIgnored = generator.finalDestinationOrIgnored(dst, function.get());
+ generator.emitJumpIfNotFunctionCall(function.get(), realCall.get());
+ {
+ if (m_args->m_listNode && m_args->m_listNode->m_expr) {
+ ArgumentListNode* oldList = m_args->m_listNode;
+ m_args->m_listNode = m_args->m_listNode->m_next;
+
+ RefPtr<RegisterID> realFunction = generator.emitMove(generator.tempDestination(dst), base.get());
+ CallArguments callArguments(generator, m_args);
+ generator.emitNode(callArguments.thisRegister(), oldList->m_expr);
+ generator.emitCall(finalDestinationOrIgnored.get(), realFunction.get(), callArguments, divot(), startOffset(), endOffset());
+ generator.emitJump(end.get());
+
+ m_args->m_listNode = oldList;
+
+ } else {
+ RefPtr<RegisterID> realFunction = generator.emitMove(generator.tempDestination(dst), base.get());
+ CallArguments callArguments(generator, m_args);
+ generator.emitLoad(callArguments.thisRegister(), jsUndefined());
+ generator.emitCall(finalDestinationOrIgnored.get(), realFunction.get(), callArguments, divot(), startOffset(), endOffset());
+ generator.emitJump(end.get());
+ }
+ }
+ generator.emitLabel(realCall.get());
+ {
+ CallArguments callArguments(generator, m_args);
+ generator.emitMove(callArguments.thisRegister(), base.get());
+ generator.emitCall(finalDestinationOrIgnored.get(), function.get(), callArguments, divot(), startOffset(), endOffset());
+ }
+ generator.emitLabel(end.get());
+ return finalDestinationOrIgnored.get();
+}
+
+static bool areTrivialApplyArguments(ArgumentsNode* args)
+{
+ return !args->m_listNode || !args->m_listNode->m_expr || !args->m_listNode->m_next
+ || (!args->m_listNode->m_next->m_next && args->m_listNode->m_next->m_expr->isSimpleArray());
+}
+
+RegisterID* ApplyFunctionCallDotNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ // A few simple cases can be trivially handled as ordinary function calls.
+ // function.apply(), function.apply(arg) -> identical to function.call
+ // function.apply(thisArg, [arg0, arg1, ...]) -> can be trivially coerced into function.call(thisArg, arg0, arg1, ...) and saves object allocation
+ bool mayBeCall = areTrivialApplyArguments(m_args);
+
+ RefPtr<Label> realCall = generator.newLabel();
+ RefPtr<Label> end = generator.newLabel();
+ RefPtr<RegisterID> base = generator.emitNode(m_base);
+ generator.emitExpressionInfo(divot() - m_subexpressionDivotOffset, startOffset() - m_subexpressionDivotOffset, m_subexpressionEndOffset);
+ RefPtr<RegisterID> function = generator.emitGetById(generator.tempDestination(dst), base.get(), m_ident);
+ RefPtr<RegisterID> finalDestinationOrIgnored = generator.finalDestinationOrIgnored(dst, function.get());
+ generator.emitJumpIfNotFunctionApply(function.get(), realCall.get());
+ {
+ if (mayBeCall) {
+ if (m_args->m_listNode && m_args->m_listNode->m_expr) {
+ ArgumentListNode* oldList = m_args->m_listNode;
+ if (m_args->m_listNode->m_next) {
+ ASSERT(m_args->m_listNode->m_next->m_expr->isSimpleArray());
+ ASSERT(!m_args->m_listNode->m_next->m_next);
+ m_args->m_listNode = static_cast<ArrayNode*>(m_args->m_listNode->m_next->m_expr)->toArgumentList(generator.globalData());
+ RefPtr<RegisterID> realFunction = generator.emitMove(generator.tempDestination(dst), base.get());
+ CallArguments callArguments(generator, m_args);
+ generator.emitNode(callArguments.thisRegister(), oldList->m_expr);
+ generator.emitCall(finalDestinationOrIgnored.get(), realFunction.get(), callArguments, divot(), startOffset(), endOffset());
+ } else {
+ m_args->m_listNode = m_args->m_listNode->m_next;
+ RefPtr<RegisterID> realFunction = generator.emitMove(generator.tempDestination(dst), base.get());
+ CallArguments callArguments(generator, m_args);
+ generator.emitNode(callArguments.thisRegister(), oldList->m_expr);
+ generator.emitCall(finalDestinationOrIgnored.get(), realFunction.get(), callArguments, divot(), startOffset(), endOffset());
+ }
+ m_args->m_listNode = oldList;
+ } else {
+ RefPtr<RegisterID> realFunction = generator.emitMove(generator.tempDestination(dst), base.get());
+ CallArguments callArguments(generator, m_args);
+ generator.emitLoad(callArguments.thisRegister(), jsUndefined());
+ generator.emitCall(finalDestinationOrIgnored.get(), realFunction.get(), callArguments, divot(), startOffset(), endOffset());
+ }
+ } else {
+ ASSERT(m_args->m_listNode && m_args->m_listNode->m_next);
+ RefPtr<RegisterID> realFunction = generator.emitMove(generator.newTemporary(), base.get());
+ RefPtr<RegisterID> argsCountRegister = generator.newTemporary();
+ RefPtr<RegisterID> thisRegister = generator.newTemporary();
+ RefPtr<RegisterID> argsRegister = generator.newTemporary();
+ generator.emitNode(thisRegister.get(), m_args->m_listNode->m_expr);
+ ArgumentListNode* args = m_args->m_listNode->m_next;
+ bool isArgumentsApply = false;
+ if (args->m_expr->isResolveNode()) {
+ ResolveNode* resolveNode = static_cast<ResolveNode*>(args->m_expr);
+ isArgumentsApply = generator.willResolveToArguments(resolveNode->identifier());
+ if (isArgumentsApply)
+ generator.emitMove(argsRegister.get(), generator.uncheckedRegisterForArguments());
+ }
+ if (!isArgumentsApply)
+ generator.emitNode(argsRegister.get(), args->m_expr);
+ while ((args = args->m_next))
+ generator.emitNode(args->m_expr);
+
+ generator.emitLoadVarargs(argsCountRegister.get(), thisRegister.get(), argsRegister.get());
+ generator.emitCallVarargs(finalDestinationOrIgnored.get(), realFunction.get(), thisRegister.get(), argsCountRegister.get(), divot(), startOffset(), endOffset());
+ }
+ generator.emitJump(end.get());
+ }
+ generator.emitLabel(realCall.get());
+ {
+ CallArguments callArguments(generator, m_args);
+ generator.emitMove(callArguments.thisRegister(), base.get());
+ generator.emitCall(finalDestinationOrIgnored.get(), function.get(), callArguments, divot(), startOffset(), endOffset());
+ }
+ generator.emitLabel(end.get());
+ return finalDestinationOrIgnored.get();
+}
+
+// ------------------------------ PostfixResolveNode ----------------------------------
+
+static RegisterID* emitPreIncOrDec(BytecodeGenerator& generator, RegisterID* srcDst, Operator oper)
+{
+ return (oper == OpPlusPlus) ? generator.emitPreInc(srcDst) : generator.emitPreDec(srcDst);
+}
+
+static RegisterID* emitPostIncOrDec(BytecodeGenerator& generator, RegisterID* dst, RegisterID* srcDst, Operator oper)
+{
+ if (srcDst == dst)
+ return generator.emitToJSNumber(dst, srcDst);
+ return (oper == OpPlusPlus) ? generator.emitPostInc(dst, srcDst) : generator.emitPostDec(dst, srcDst);
+}
+
+RegisterID* PostfixResolveNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ if (RegisterID* local = generator.registerFor(m_ident)) {
+ if (generator.isLocalConstant(m_ident)) {
+ if (dst == generator.ignoredResult())
+ return 0;
+ return generator.emitToJSNumber(generator.finalDestination(dst), local);
+ }
+
+ if (dst == generator.ignoredResult())
+ return emitPreIncOrDec(generator, local, m_operator);
+ return emitPostIncOrDec(generator, generator.finalDestination(dst), local, m_operator);
+ }
+
+ int index = 0;
+ size_t depth = 0;
+ JSObject* globalObject = 0;
+ bool requiresDynamicChecks = false;
+ if (generator.findScopedProperty(m_ident, index, depth, true, requiresDynamicChecks, globalObject) && index != missingSymbolMarker() && !requiresDynamicChecks) {
+ RefPtr<RegisterID> value = generator.emitGetScopedVar(generator.newTemporary(), depth, index, globalObject);
+ RegisterID* oldValue;
+ if (dst == generator.ignoredResult()) {
+ oldValue = 0;
+ emitPreIncOrDec(generator, value.get(), m_operator);
+ } else {
+ oldValue = emitPostIncOrDec(generator, generator.finalDestination(dst), value.get(), m_operator);
+ }
+ generator.emitPutScopedVar(depth, index, value.get(), globalObject);
+ return oldValue;
+ }
+
+ generator.emitExpressionInfo(divot(), startOffset(), endOffset());
+ RefPtr<RegisterID> value = generator.newTemporary();
+ RefPtr<RegisterID> base = generator.emitResolveWithBase(generator.newTemporary(), value.get(), m_ident);
+ RegisterID* oldValue;
+ if (dst == generator.ignoredResult()) {
+ oldValue = 0;
+ emitPreIncOrDec(generator, value.get(), m_operator);
+ } else {
+ oldValue = emitPostIncOrDec(generator, generator.finalDestination(dst), value.get(), m_operator);
+ }
+ generator.emitPutById(base.get(), m_ident, value.get());
+ return oldValue;
+}
+
+// ------------------------------ PostfixBracketNode ----------------------------------
+
+RegisterID* PostfixBracketNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ RefPtr<RegisterID> base = generator.emitNode(m_base);
+ RefPtr<RegisterID> property = generator.emitNode(m_subscript);
+
+ generator.emitExpressionInfo(divot() - m_subexpressionDivotOffset, startOffset() - m_subexpressionDivotOffset, m_subexpressionEndOffset);
+ RefPtr<RegisterID> value = generator.emitGetByVal(generator.newTemporary(), base.get(), property.get());
+ RegisterID* oldValue;
+ if (dst == generator.ignoredResult()) {
+ oldValue = 0;
+ if (m_operator == OpPlusPlus)
+ generator.emitPreInc(value.get());
+ else
+ generator.emitPreDec(value.get());
+ } else {
+ oldValue = (m_operator == OpPlusPlus) ? generator.emitPostInc(generator.finalDestination(dst), value.get()) : generator.emitPostDec(generator.finalDestination(dst), value.get());
+ }
+ generator.emitExpressionInfo(divot(), startOffset(), endOffset());
+ generator.emitPutByVal(base.get(), property.get(), value.get());
+ return oldValue;
+}
+
+// ------------------------------ PostfixDotNode ----------------------------------
+
+RegisterID* PostfixDotNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ RefPtr<RegisterID> base = generator.emitNode(m_base);
+
+ generator.emitExpressionInfo(divot() - m_subexpressionDivotOffset, startOffset() - m_subexpressionDivotOffset, m_subexpressionEndOffset);
+ RefPtr<RegisterID> value = generator.emitGetById(generator.newTemporary(), base.get(), m_ident);
+ RegisterID* oldValue;
+ if (dst == generator.ignoredResult()) {
+ oldValue = 0;
+ if (m_operator == OpPlusPlus)
+ generator.emitPreInc(value.get());
+ else
+ generator.emitPreDec(value.get());
+ } else {
+ oldValue = (m_operator == OpPlusPlus) ? generator.emitPostInc(generator.finalDestination(dst), value.get()) : generator.emitPostDec(generator.finalDestination(dst), value.get());
+ }
+ generator.emitExpressionInfo(divot(), startOffset(), endOffset());
+ generator.emitPutById(base.get(), m_ident, value.get());
+ return oldValue;
+}
+
+// ------------------------------ PostfixErrorNode -----------------------------------
+
+RegisterID* PostfixErrorNode::emitBytecode(BytecodeGenerator& generator, RegisterID*)
+{
+ return emitThrowReferenceError(generator, m_operator == OpPlusPlus
+ ? "Postfix ++ operator applied to value that is not a reference."
+ : "Postfix -- operator applied to value that is not a reference.");
+}
+
+// ------------------------------ DeleteResolveNode -----------------------------------
+
+RegisterID* DeleteResolveNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ if (generator.registerFor(m_ident))
+ return generator.emitLoad(generator.finalDestination(dst), false);
+
+ generator.emitExpressionInfo(divot(), startOffset(), endOffset());
+ RegisterID* base = generator.emitResolveBase(generator.tempDestination(dst), m_ident);
+ return generator.emitDeleteById(generator.finalDestination(dst, base), base, m_ident);
+}
+
+// ------------------------------ DeleteBracketNode -----------------------------------
+
+RegisterID* DeleteBracketNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ RefPtr<RegisterID> r0 = generator.emitNode(m_base);
+ RegisterID* r1 = generator.emitNode(m_subscript);
+
+ generator.emitExpressionInfo(divot(), startOffset(), endOffset());
+ return generator.emitDeleteByVal(generator.finalDestination(dst), r0.get(), r1);
+}
+
+// ------------------------------ DeleteDotNode -----------------------------------
+
+RegisterID* DeleteDotNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ RegisterID* r0 = generator.emitNode(m_base);
+
+ generator.emitExpressionInfo(divot(), startOffset(), endOffset());
+ return generator.emitDeleteById(generator.finalDestination(dst), r0, m_ident);
+}
+
+// ------------------------------ DeleteValueNode -----------------------------------
+
+RegisterID* DeleteValueNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ generator.emitNode(generator.ignoredResult(), m_expr);
+
+ // delete on a non-location expression ignores the value and returns true
+ return generator.emitLoad(generator.finalDestination(dst), true);
+}
+
+// ------------------------------ VoidNode -------------------------------------
+
+RegisterID* VoidNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ if (dst == generator.ignoredResult()) {
+ generator.emitNode(generator.ignoredResult(), m_expr);
+ return 0;
+ }
+ RefPtr<RegisterID> r0 = generator.emitNode(m_expr);
+ return generator.emitLoad(dst, jsUndefined());
+}
+
+// ------------------------------ TypeOfValueNode -----------------------------------
+
+RegisterID* TypeOfResolveNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ if (RegisterID* local = generator.registerFor(m_ident)) {
+ if (dst == generator.ignoredResult())
+ return 0;
+ return generator.emitTypeOf(generator.finalDestination(dst), local);
+ }
+
+ RefPtr<RegisterID> scratch = generator.emitResolveBase(generator.tempDestination(dst), m_ident);
+ generator.emitGetById(scratch.get(), scratch.get(), m_ident);
+ if (dst == generator.ignoredResult())
+ return 0;
+ return generator.emitTypeOf(generator.finalDestination(dst, scratch.get()), scratch.get());
+}
+
+// ------------------------------ TypeOfValueNode -----------------------------------
+
+RegisterID* TypeOfValueNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ if (dst == generator.ignoredResult()) {
+ generator.emitNode(generator.ignoredResult(), m_expr);
+ return 0;
+ }
+ RefPtr<RegisterID> src = generator.emitNode(m_expr);
+ return generator.emitTypeOf(generator.finalDestination(dst), src.get());
+}
+
+// ------------------------------ PrefixResolveNode ----------------------------------
+
+RegisterID* PrefixResolveNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ if (RegisterID* local = generator.registerFor(m_ident)) {
+ if (generator.isLocalConstant(m_ident)) {
+ if (dst == generator.ignoredResult())
+ return 0;
+ RefPtr<RegisterID> r0 = generator.emitLoad(generator.finalDestination(dst), (m_operator == OpPlusPlus) ? 1.0 : -1.0);
+ return generator.emitBinaryOp(op_add, r0.get(), local, r0.get(), OperandTypes());
+ }
+
+ emitPreIncOrDec(generator, local, m_operator);
+ return generator.moveToDestinationIfNeeded(dst, local);
+ }
+
+ int index = 0;
+ size_t depth = 0;
+ JSObject* globalObject = 0;
+ bool requiresDynamicChecks = false;
+ if (generator.findScopedProperty(m_ident, index, depth, false, requiresDynamicChecks, globalObject) && index != missingSymbolMarker() && !requiresDynamicChecks) {
+ RefPtr<RegisterID> propDst = generator.emitGetScopedVar(generator.tempDestination(dst), depth, index, globalObject);
+ emitPreIncOrDec(generator, propDst.get(), m_operator);
+ generator.emitPutScopedVar(depth, index, propDst.get(), globalObject);
+ return generator.moveToDestinationIfNeeded(dst, propDst.get());
+ }
+
+ generator.emitExpressionInfo(divot(), startOffset(), endOffset());
+ RefPtr<RegisterID> propDst = generator.tempDestination(dst);
+ RefPtr<RegisterID> base = generator.emitResolveWithBase(generator.newTemporary(), propDst.get(), m_ident);
+ emitPreIncOrDec(generator, propDst.get(), m_operator);
+ generator.emitPutById(base.get(), m_ident, propDst.get());
+ return generator.moveToDestinationIfNeeded(dst, propDst.get());
+}
+
+// ------------------------------ PrefixBracketNode ----------------------------------
+
+RegisterID* PrefixBracketNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ RefPtr<RegisterID> base = generator.emitNode(m_base);
+ RefPtr<RegisterID> property = generator.emitNode(m_subscript);
+ RefPtr<RegisterID> propDst = generator.tempDestination(dst);
+
+ generator.emitExpressionInfo(divot() + m_subexpressionDivotOffset, m_subexpressionStartOffset, endOffset() - m_subexpressionDivotOffset);
+ RegisterID* value = generator.emitGetByVal(propDst.get(), base.get(), property.get());
+ if (m_operator == OpPlusPlus)
+ generator.emitPreInc(value);
+ else
+ generator.emitPreDec(value);
+ generator.emitExpressionInfo(divot(), startOffset(), endOffset());
+ generator.emitPutByVal(base.get(), property.get(), value);
+ return generator.moveToDestinationIfNeeded(dst, propDst.get());
+}
+
+// ------------------------------ PrefixDotNode ----------------------------------
+
+RegisterID* PrefixDotNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ RefPtr<RegisterID> base = generator.emitNode(m_base);
+ RefPtr<RegisterID> propDst = generator.tempDestination(dst);
+
+ generator.emitExpressionInfo(divot() + m_subexpressionDivotOffset, m_subexpressionStartOffset, endOffset() - m_subexpressionDivotOffset);
+ RegisterID* value = generator.emitGetById(propDst.get(), base.get(), m_ident);
+ if (m_operator == OpPlusPlus)
+ generator.emitPreInc(value);
+ else
+ generator.emitPreDec(value);
+ generator.emitExpressionInfo(divot(), startOffset(), endOffset());
+ generator.emitPutById(base.get(), m_ident, value);
+ return generator.moveToDestinationIfNeeded(dst, propDst.get());
+}
+
+// ------------------------------ PrefixErrorNode -----------------------------------
+
+RegisterID* PrefixErrorNode::emitBytecode(BytecodeGenerator& generator, RegisterID*)
+{
+ return emitThrowReferenceError(generator, m_operator == OpPlusPlus
+ ? "Prefix ++ operator applied to value that is not a reference."
+ : "Prefix -- operator applied to value that is not a reference.");
+}
+
+// ------------------------------ Unary Operation Nodes -----------------------------------
+
+RegisterID* UnaryOpNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ RegisterID* src = generator.emitNode(m_expr);
+ return generator.emitUnaryOp(opcodeID(), generator.finalDestination(dst), src);
+}
+
+
+// ------------------------------ LogicalNotNode -----------------------------------
+
+void LogicalNotNode::emitBytecodeInConditionContext(BytecodeGenerator& generator, Label* trueTarget, Label* falseTarget, bool fallThroughMeansTrue)
+{
+ ASSERT(expr()->hasConditionContextCodegen());
+
+ // reverse the true and false targets
+ generator.emitNodeInConditionContext(expr(), falseTarget, trueTarget, !fallThroughMeansTrue);
+}
+
+
+// ------------------------------ Binary Operation Nodes -----------------------------------
+
+// BinaryOpNode::emitStrcat:
+//
+// This node generates an op_strcat operation. This opcode can handle concatenation of three or
+// more values, where we can determine a set of separate op_add operations would be operating on
+// string values.
+//
+// This function expects to be operating on a graph of AST nodes looking something like this:
+//
+// (a)... (b)
+// \ /
+// (+) (c)
+// \ /
+// [d] ((+))
+// \ /
+// [+=]
+//
+// The assignment operation is optional, if it exists the register holding the value on the
+// lefthand side of the assignment should be passing as the optional 'lhs' argument.
+//
+// The method should be called on the node at the root of the tree of regular binary add
+// operations (marked in the diagram with a double set of parentheses). This node must
+// be performing a string concatenation (determined by statically detecting that at least
+// one child must be a string).
+//
+// Since the minimum number of values being concatenated together is expected to be 3, if
+// a lhs to a concatenating assignment is not provided then the root add should have at
+// least one left child that is also an add that can be determined to be operating on strings.
+//
+RegisterID* BinaryOpNode::emitStrcat(BytecodeGenerator& generator, RegisterID* dst, RegisterID* lhs, ReadModifyResolveNode* emitExpressionInfoForMe)
+{
+ ASSERT(isAdd());
+ ASSERT(resultDescriptor().definitelyIsString());
+
+ // Create a list of expressions for all the adds in the tree of nodes we can convert into
+ // a string concatenation. The rightmost node (c) is added first. The rightmost node is
+ // added first, and the leftmost child is never added, so the vector produced for the
+ // example above will be [ c, b ].
+ Vector<ExpressionNode*, 16> reverseExpressionList;
+ reverseExpressionList.append(m_expr2);
+
+ // Examine the left child of the add. So long as this is a string add, add its right-child
+ // to the list, and keep processing along the left fork.
+ ExpressionNode* leftMostAddChild = m_expr1;
+ while (leftMostAddChild->isAdd() && leftMostAddChild->resultDescriptor().definitelyIsString()) {
+ reverseExpressionList.append(static_cast<AddNode*>(leftMostAddChild)->m_expr2);
+ leftMostAddChild = static_cast<AddNode*>(leftMostAddChild)->m_expr1;
+ }
+
+ Vector<RefPtr<RegisterID>, 16> temporaryRegisters;
+
+ // If there is an assignment, allocate a temporary to hold the lhs after conversion.
+ // We could possibly avoid this (the lhs is converted last anyway, we could let the
+ // op_strcat node handle its conversion if required).
+ if (lhs)
+ temporaryRegisters.append(generator.newTemporary());
+
+ // Emit code for the leftmost node ((a) in the example).
+ temporaryRegisters.append(generator.newTemporary());
+ RegisterID* leftMostAddChildTempRegister = temporaryRegisters.last().get();
+ generator.emitNode(leftMostAddChildTempRegister, leftMostAddChild);
+
+ // Note on ordering of conversions:
+ //
+ // We maintain the same ordering of conversions as we would see if the concatenations
+ // was performed as a sequence of adds (otherwise this optimization could change
+ // behaviour should an object have been provided a valueOf or toString method).
+ //
+ // Considering the above example, the sequnce of execution is:
+ // * evaluate operand (a)
+ // * evaluate operand (b)
+ // * convert (a) to primitive <- (this would be triggered by the first add)
+ // * convert (b) to primitive <- (ditto)
+ // * evaluate operand (c)
+ // * convert (c) to primitive <- (this would be triggered by the second add)
+ // And optionally, if there is an assignment:
+ // * convert (d) to primitive <- (this would be triggered by the assigning addition)
+ //
+ // As such we do not plant an op to convert the leftmost child now. Instead, use
+ // 'leftMostAddChildTempRegister' as a flag to trigger generation of the conversion
+ // once the second node has been generated. However, if the leftmost child is an
+ // immediate we can trivially determine that no conversion will be required.
+ // If this is the case
+ if (leftMostAddChild->isString())
+ leftMostAddChildTempRegister = 0;
+
+ while (reverseExpressionList.size()) {
+ ExpressionNode* node = reverseExpressionList.last();
+ reverseExpressionList.removeLast();
+
+ // Emit the code for the current node.
+ temporaryRegisters.append(generator.newTemporary());
+ generator.emitNode(temporaryRegisters.last().get(), node);
+
+ // On the first iteration of this loop, when we first reach this point we have just
+ // generated the second node, which means it is time to convert the leftmost operand.
+ if (leftMostAddChildTempRegister) {
+ generator.emitToPrimitive(leftMostAddChildTempRegister, leftMostAddChildTempRegister);
+ leftMostAddChildTempRegister = 0; // Only do this once.
+ }
+ // Plant a conversion for this node, if necessary.
+ if (!node->isString())
+ generator.emitToPrimitive(temporaryRegisters.last().get(), temporaryRegisters.last().get());
+ }
+ ASSERT(temporaryRegisters.size() >= 3);
+
+ // Certain read-modify nodes require expression info to be emitted *after* m_right has been generated.
+ // If this is required the node is passed as 'emitExpressionInfoForMe'; do so now.
+ if (emitExpressionInfoForMe)
+ generator.emitExpressionInfo(emitExpressionInfoForMe->divot(), emitExpressionInfoForMe->startOffset(), emitExpressionInfoForMe->endOffset());
+
+ // If there is an assignment convert the lhs now. This will also copy lhs to
+ // the temporary register we allocated for it.
+ if (lhs)
+ generator.emitToPrimitive(temporaryRegisters[0].get(), lhs);
+
+ return generator.emitStrcat(generator.finalDestination(dst, temporaryRegisters[0].get()), temporaryRegisters[0].get(), temporaryRegisters.size());
+}
+
+RegisterID* BinaryOpNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ OpcodeID opcodeID = this->opcodeID();
+
+ if (opcodeID == op_add && m_expr1->isAdd() && m_expr1->resultDescriptor().definitelyIsString())
+ return emitStrcat(generator, dst);
+
+ if (opcodeID == op_neq) {
+ if (m_expr1->isNull() || m_expr2->isNull()) {
+ RefPtr<RegisterID> src = generator.tempDestination(dst);
+ generator.emitNode(src.get(), m_expr1->isNull() ? m_expr2 : m_expr1);
+ return generator.emitUnaryOp(op_neq_null, generator.finalDestination(dst, src.get()), src.get());
+ }
+ }
+
+ RefPtr<RegisterID> src1 = generator.emitNodeForLeftHandSide(m_expr1, m_rightHasAssignments, m_expr2->isPure(generator));
+ RegisterID* src2 = generator.emitNode(m_expr2);
+ return generator.emitBinaryOp(opcodeID, generator.finalDestination(dst, src1.get()), src1.get(), src2, OperandTypes(m_expr1->resultDescriptor(), m_expr2->resultDescriptor()));
+}
+
+RegisterID* EqualNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ if (m_expr1->isNull() || m_expr2->isNull()) {
+ RefPtr<RegisterID> src = generator.tempDestination(dst);
+ generator.emitNode(src.get(), m_expr1->isNull() ? m_expr2 : m_expr1);
+ return generator.emitUnaryOp(op_eq_null, generator.finalDestination(dst, src.get()), src.get());
+ }
+
+ RefPtr<RegisterID> src1 = generator.emitNodeForLeftHandSide(m_expr1, m_rightHasAssignments, m_expr2->isPure(generator));
+ RegisterID* src2 = generator.emitNode(m_expr2);
+ return generator.emitEqualityOp(op_eq, generator.finalDestination(dst, src1.get()), src1.get(), src2);
+}
+
+RegisterID* StrictEqualNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ RefPtr<RegisterID> src1 = generator.emitNodeForLeftHandSide(m_expr1, m_rightHasAssignments, m_expr2->isPure(generator));
+ RegisterID* src2 = generator.emitNode(m_expr2);
+ return generator.emitEqualityOp(op_stricteq, generator.finalDestination(dst, src1.get()), src1.get(), src2);
+}
+
+RegisterID* ReverseBinaryOpNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ RefPtr<RegisterID> src1 = generator.emitNodeForLeftHandSide(m_expr1, m_rightHasAssignments, m_expr2->isPure(generator));
+ RegisterID* src2 = generator.emitNode(m_expr2);
+ return generator.emitBinaryOp(opcodeID(), generator.finalDestination(dst, src1.get()), src2, src1.get(), OperandTypes(m_expr2->resultDescriptor(), m_expr1->resultDescriptor()));
+}
+
+RegisterID* ThrowableBinaryOpNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ RefPtr<RegisterID> src1 = generator.emitNodeForLeftHandSide(m_expr1, m_rightHasAssignments, m_expr2->isPure(generator));
+ RegisterID* src2 = generator.emitNode(m_expr2);
+ generator.emitExpressionInfo(divot(), startOffset(), endOffset());
+ return generator.emitBinaryOp(opcodeID(), generator.finalDestination(dst, src1.get()), src1.get(), src2, OperandTypes(m_expr1->resultDescriptor(), m_expr2->resultDescriptor()));
+}
+
+RegisterID* InstanceOfNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ RefPtr<RegisterID> src1 = generator.emitNodeForLeftHandSide(m_expr1, m_rightHasAssignments, m_expr2->isPure(generator));
+ RefPtr<RegisterID> src2 = generator.emitNode(m_expr2);
+
+ generator.emitExpressionInfo(divot(), startOffset(), endOffset());
+ generator.emitCheckHasInstance(src2.get());
+
+ generator.emitExpressionInfo(divot(), startOffset(), endOffset());
+ RegisterID* src2Prototype = generator.emitGetById(generator.newTemporary(), src2.get(), generator.globalData()->propertyNames->prototype);
+
+ generator.emitExpressionInfo(divot(), startOffset(), endOffset());
+ return generator.emitInstanceOf(generator.finalDestination(dst, src1.get()), src1.get(), src2.get(), src2Prototype);
+}
+
+// ------------------------------ LogicalOpNode ----------------------------
+
+RegisterID* LogicalOpNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ RefPtr<RegisterID> temp = generator.tempDestination(dst);
+ RefPtr<Label> target = generator.newLabel();
+
+ generator.emitNode(temp.get(), m_expr1);
+ if (m_operator == OpLogicalAnd)
+ generator.emitJumpIfFalse(temp.get(), target.get());
+ else
+ generator.emitJumpIfTrue(temp.get(), target.get());
+ generator.emitNode(temp.get(), m_expr2);
+ generator.emitLabel(target.get());
+
+ return generator.moveToDestinationIfNeeded(dst, temp.get());
+}
+
+void LogicalOpNode::emitBytecodeInConditionContext(BytecodeGenerator& generator, Label* trueTarget, Label* falseTarget, bool fallThroughMeansTrue)
+{
+ if (m_expr1->hasConditionContextCodegen()) {
+ RefPtr<Label> afterExpr1 = generator.newLabel();
+ if (m_operator == OpLogicalAnd)
+ generator.emitNodeInConditionContext(m_expr1, afterExpr1.get(), falseTarget, true);
+ else
+ generator.emitNodeInConditionContext(m_expr1, trueTarget, afterExpr1.get(), false);
+ generator.emitLabel(afterExpr1.get());
+ } else {
+ RegisterID* temp = generator.emitNode(m_expr1);
+ if (m_operator == OpLogicalAnd)
+ generator.emitJumpIfFalse(temp, falseTarget);
+ else
+ generator.emitJumpIfTrue(temp, trueTarget);
+ }
+
+ if (m_expr2->hasConditionContextCodegen())
+ generator.emitNodeInConditionContext(m_expr2, trueTarget, falseTarget, fallThroughMeansTrue);
+ else {
+ RegisterID* temp = generator.emitNode(m_expr2);
+ if (fallThroughMeansTrue)
+ generator.emitJumpIfFalse(temp, falseTarget);
+ else
+ generator.emitJumpIfTrue(temp, trueTarget);
+ }
+}
+
+// ------------------------------ ConditionalNode ------------------------------
+
+RegisterID* ConditionalNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ RefPtr<RegisterID> newDst = generator.finalDestination(dst);
+ RefPtr<Label> beforeElse = generator.newLabel();
+ RefPtr<Label> afterElse = generator.newLabel();
+
+ if (m_logical->hasConditionContextCodegen()) {
+ RefPtr<Label> beforeThen = generator.newLabel();
+ generator.emitNodeInConditionContext(m_logical, beforeThen.get(), beforeElse.get(), true);
+ generator.emitLabel(beforeThen.get());
+ } else {
+ RegisterID* cond = generator.emitNode(m_logical);
+ generator.emitJumpIfFalse(cond, beforeElse.get());
+ }
+
+ generator.emitNode(newDst.get(), m_expr1);
+ generator.emitJump(afterElse.get());
+
+ generator.emitLabel(beforeElse.get());
+ generator.emitNode(newDst.get(), m_expr2);
+
+ generator.emitLabel(afterElse.get());
+
+ return newDst.get();
+}
+
+// ------------------------------ ReadModifyResolveNode -----------------------------------
+
+// FIXME: should this be moved to be a method on BytecodeGenerator?
+static ALWAYS_INLINE RegisterID* emitReadModifyAssignment(BytecodeGenerator& generator, RegisterID* dst, RegisterID* src1, ExpressionNode* m_right, Operator oper, OperandTypes types, ReadModifyResolveNode* emitExpressionInfoForMe = 0)
+{
+ OpcodeID opcodeID;
+ switch (oper) {
+ case OpMultEq:
+ opcodeID = op_mul;
+ break;
+ case OpDivEq:
+ opcodeID = op_div;
+ break;
+ case OpPlusEq:
+ if (m_right->isAdd() && m_right->resultDescriptor().definitelyIsString())
+ return static_cast<AddNode*>(m_right)->emitStrcat(generator, dst, src1, emitExpressionInfoForMe);
+ opcodeID = op_add;
+ break;
+ case OpMinusEq:
+ opcodeID = op_sub;
+ break;
+ case OpLShift:
+ opcodeID = op_lshift;
+ break;
+ case OpRShift:
+ opcodeID = op_rshift;
+ break;
+ case OpURShift:
+ opcodeID = op_urshift;
+ break;
+ case OpAndEq:
+ opcodeID = op_bitand;
+ break;
+ case OpXOrEq:
+ opcodeID = op_bitxor;
+ break;
+ case OpOrEq:
+ opcodeID = op_bitor;
+ break;
+ case OpModEq:
+ opcodeID = op_mod;
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ return dst;
+ }
+
+ RegisterID* src2 = generator.emitNode(m_right);
+
+ // Certain read-modify nodes require expression info to be emitted *after* m_right has been generated.
+ // If this is required the node is passed as 'emitExpressionInfoForMe'; do so now.
+ if (emitExpressionInfoForMe)
+ generator.emitExpressionInfo(emitExpressionInfoForMe->divot(), emitExpressionInfoForMe->startOffset(), emitExpressionInfoForMe->endOffset());
+
+ return generator.emitBinaryOp(opcodeID, dst, src1, src2, types);
+}
+
+RegisterID* ReadModifyResolveNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ if (RegisterID* local = generator.registerFor(m_ident)) {
+ if (generator.isLocalConstant(m_ident)) {
+ return emitReadModifyAssignment(generator, generator.finalDestination(dst), local, m_right, m_operator, OperandTypes(ResultType::unknownType(), m_right->resultDescriptor()));
+ }
+
+ if (generator.leftHandSideNeedsCopy(m_rightHasAssignments, m_right->isPure(generator))) {
+ RefPtr<RegisterID> result = generator.newTemporary();
+ generator.emitMove(result.get(), local);
+ emitReadModifyAssignment(generator, result.get(), result.get(), m_right, m_operator, OperandTypes(ResultType::unknownType(), m_right->resultDescriptor()));
+ generator.emitMove(local, result.get());
+ return generator.moveToDestinationIfNeeded(dst, result.get());
+ }
+
+ RegisterID* result = emitReadModifyAssignment(generator, local, local, m_right, m_operator, OperandTypes(ResultType::unknownType(), m_right->resultDescriptor()));
+ return generator.moveToDestinationIfNeeded(dst, result);
+ }
+
+ int index = 0;
+ size_t depth = 0;
+ JSObject* globalObject = 0;
+ bool requiresDynamicChecks = false;
+ if (generator.findScopedProperty(m_ident, index, depth, true, requiresDynamicChecks, globalObject) && index != missingSymbolMarker() && !requiresDynamicChecks) {
+ RefPtr<RegisterID> src1 = generator.emitGetScopedVar(generator.tempDestination(dst), depth, index, globalObject);
+ RegisterID* result = emitReadModifyAssignment(generator, generator.finalDestination(dst, src1.get()), src1.get(), m_right, m_operator, OperandTypes(ResultType::unknownType(), m_right->resultDescriptor()));
+ generator.emitPutScopedVar(depth, index, result, globalObject);
+ return result;
+ }
+
+ RefPtr<RegisterID> src1 = generator.tempDestination(dst);
+ generator.emitExpressionInfo(divot() - startOffset() + m_ident.length(), m_ident.length(), 0);
+ RefPtr<RegisterID> base = generator.emitResolveWithBase(generator.newTemporary(), src1.get(), m_ident);
+ RegisterID* result = emitReadModifyAssignment(generator, generator.finalDestination(dst, src1.get()), src1.get(), m_right, m_operator, OperandTypes(ResultType::unknownType(), m_right->resultDescriptor()), this);
+ return generator.emitPutById(base.get(), m_ident, result);
+}
+
+// ------------------------------ AssignResolveNode -----------------------------------
+
+RegisterID* AssignResolveNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ if (RegisterID* local = generator.registerFor(m_ident)) {
+ if (generator.isLocalConstant(m_ident))
+ return generator.emitNode(dst, m_right);
+
+ RegisterID* result = generator.emitNode(local, m_right);
+ return generator.moveToDestinationIfNeeded(dst, result);
+ }
+
+ int index = 0;
+ size_t depth = 0;
+ JSObject* globalObject = 0;
+ bool requiresDynamicChecks = false;
+ if (generator.findScopedProperty(m_ident, index, depth, true, requiresDynamicChecks, globalObject) && index != missingSymbolMarker() && !requiresDynamicChecks) {
+ if (dst == generator.ignoredResult())
+ dst = 0;
+ RegisterID* value = generator.emitNode(dst, m_right);
+ generator.emitPutScopedVar(depth, index, value, globalObject);
+ return value;
+ }
+
+ RefPtr<RegisterID> base = generator.emitResolveBaseForPut(generator.newTemporary(), m_ident);
+ if (dst == generator.ignoredResult())
+ dst = 0;
+ RegisterID* value = generator.emitNode(dst, m_right);
+ generator.emitExpressionInfo(divot(), startOffset(), endOffset());
+ return generator.emitPutById(base.get(), m_ident, value);
+}
+
+// ------------------------------ AssignDotNode -----------------------------------
+
+RegisterID* AssignDotNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ RefPtr<RegisterID> base = generator.emitNodeForLeftHandSide(m_base, m_rightHasAssignments, m_right->isPure(generator));
+ RefPtr<RegisterID> value = generator.destinationForAssignResult(dst);
+ RegisterID* result = generator.emitNode(value.get(), m_right);
+ generator.emitExpressionInfo(divot(), startOffset(), endOffset());
+ generator.emitPutById(base.get(), m_ident, result);
+ return generator.moveToDestinationIfNeeded(dst, result);
+}
+
+// ------------------------------ ReadModifyDotNode -----------------------------------
+
+RegisterID* ReadModifyDotNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ RefPtr<RegisterID> base = generator.emitNodeForLeftHandSide(m_base, m_rightHasAssignments, m_right->isPure(generator));
+
+ generator.emitExpressionInfo(divot() - m_subexpressionDivotOffset, startOffset() - m_subexpressionDivotOffset, m_subexpressionEndOffset);
+ RefPtr<RegisterID> value = generator.emitGetById(generator.tempDestination(dst), base.get(), m_ident);
+ RegisterID* updatedValue = emitReadModifyAssignment(generator, generator.finalDestination(dst, value.get()), value.get(), m_right, m_operator, OperandTypes(ResultType::unknownType(), m_right->resultDescriptor()));
+
+ generator.emitExpressionInfo(divot(), startOffset(), endOffset());
+ return generator.emitPutById(base.get(), m_ident, updatedValue);
+}
+
+// ------------------------------ AssignErrorNode -----------------------------------
+
+RegisterID* AssignErrorNode::emitBytecode(BytecodeGenerator& generator, RegisterID*)
+{
+ return emitThrowReferenceError(generator, "Left side of assignment is not a reference.");
+}
+
+// ------------------------------ AssignBracketNode -----------------------------------
+
+RegisterID* AssignBracketNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ RefPtr<RegisterID> base = generator.emitNodeForLeftHandSide(m_base, m_subscriptHasAssignments || m_rightHasAssignments, m_subscript->isPure(generator) && m_right->isPure(generator));
+ RefPtr<RegisterID> property = generator.emitNodeForLeftHandSide(m_subscript, m_rightHasAssignments, m_right->isPure(generator));
+ RefPtr<RegisterID> value = generator.destinationForAssignResult(dst);
+ RegisterID* result = generator.emitNode(value.get(), m_right);
+
+ generator.emitExpressionInfo(divot(), startOffset(), endOffset());
+ generator.emitPutByVal(base.get(), property.get(), result);
+ return generator.moveToDestinationIfNeeded(dst, result);
+}
+
+// ------------------------------ ReadModifyBracketNode -----------------------------------
+
+RegisterID* ReadModifyBracketNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ RefPtr<RegisterID> base = generator.emitNodeForLeftHandSide(m_base, m_subscriptHasAssignments || m_rightHasAssignments, m_subscript->isPure(generator) && m_right->isPure(generator));
+ RefPtr<RegisterID> property = generator.emitNodeForLeftHandSide(m_subscript, m_rightHasAssignments, m_right->isPure(generator));
+
+ generator.emitExpressionInfo(divot() - m_subexpressionDivotOffset, startOffset() - m_subexpressionDivotOffset, m_subexpressionEndOffset);
+ RefPtr<RegisterID> value = generator.emitGetByVal(generator.tempDestination(dst), base.get(), property.get());
+ RegisterID* updatedValue = emitReadModifyAssignment(generator, generator.finalDestination(dst, value.get()), value.get(), m_right, m_operator, OperandTypes(ResultType::unknownType(), m_right->resultDescriptor()));
+
+ generator.emitExpressionInfo(divot(), startOffset(), endOffset());
+ generator.emitPutByVal(base.get(), property.get(), updatedValue);
+
+ return updatedValue;
+}
+
+// ------------------------------ CommaNode ------------------------------------
+
+RegisterID* CommaNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ ASSERT(m_expressions.size() > 1);
+ for (size_t i = 0; i < m_expressions.size() - 1; i++)
+ generator.emitNode(generator.ignoredResult(), m_expressions[i]);
+ return generator.emitNode(dst, m_expressions.last());
+}
+
+// ------------------------------ ConstDeclNode ------------------------------------
+
+RegisterID* ConstDeclNode::emitCodeSingle(BytecodeGenerator& generator)
+{
+ if (RegisterID* local = generator.constRegisterFor(m_ident)) {
+ if (!m_init)
+ return local;
+
+ return generator.emitNode(local, m_init);
+ }
+
+ if (generator.codeType() != EvalCode) {
+ if (m_init)
+ return generator.emitNode(m_init);
+ else
+ return generator.emitResolve(generator.newTemporary(), m_ident);
+ }
+ // FIXME: While this code should only be hit in eval code, it will potentially
+ // assign to the wrong base if m_ident exists in an intervening dynamic scope.
+ RefPtr<RegisterID> base = generator.emitResolveBase(generator.newTemporary(), m_ident);
+ RegisterID* value = m_init ? generator.emitNode(m_init) : generator.emitLoad(0, jsUndefined());
+ return generator.emitPutById(base.get(), m_ident, value);
+}
+
+RegisterID* ConstDeclNode::emitBytecode(BytecodeGenerator& generator, RegisterID*)
+{
+ RegisterID* result = 0;
+ for (ConstDeclNode* n = this; n; n = n->m_next)
+ result = n->emitCodeSingle(generator);
+
+ return result;
+}
+
+// ------------------------------ ConstStatementNode -----------------------------
+
+RegisterID* ConstStatementNode::emitBytecode(BytecodeGenerator& generator, RegisterID*)
+{
+ generator.emitDebugHook(WillExecuteStatement, firstLine(), lastLine());
+ return generator.emitNode(m_next);
+}
+
+// ------------------------------ SourceElements -------------------------------
+
+
+inline StatementNode* SourceElements::lastStatement() const
+{
+ size_t size = m_statements.size();
+ return size ? m_statements[size - 1] : 0;
+}
+
+inline void SourceElements::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ size_t size = m_statements.size();
+ for (size_t i = 0; i < size; ++i)
+ generator.emitNode(dst, m_statements[i]);
+}
+
+// ------------------------------ BlockNode ------------------------------------
+
+inline StatementNode* BlockNode::lastStatement() const
+{
+ return m_statements ? m_statements->lastStatement() : 0;
+}
+
+inline StatementNode* BlockNode::singleStatement() const
+{
+ return m_statements ? m_statements->singleStatement() : 0;
+}
+
+RegisterID* BlockNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ if (m_statements)
+ m_statements->emitBytecode(generator, dst);
+ return 0;
+}
+
+// ------------------------------ EmptyStatementNode ---------------------------
+
+RegisterID* EmptyStatementNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ generator.emitDebugHook(WillExecuteStatement, firstLine(), lastLine());
+ return dst;
+}
+
+// ------------------------------ DebuggerStatementNode ---------------------------
+
+RegisterID* DebuggerStatementNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ generator.emitDebugHook(DidReachBreakpoint, firstLine(), lastLine());
+ return dst;
+}
+
+// ------------------------------ ExprStatementNode ----------------------------
+
+RegisterID* ExprStatementNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ ASSERT(m_expr);
+ generator.emitDebugHook(WillExecuteStatement, firstLine(), lastLine());
+ return generator.emitNode(dst, m_expr);
+}
+
+// ------------------------------ VarStatementNode ----------------------------
+
+RegisterID* VarStatementNode::emitBytecode(BytecodeGenerator& generator, RegisterID*)
+{
+ ASSERT(m_expr);
+ generator.emitDebugHook(WillExecuteStatement, firstLine(), lastLine());
+ return generator.emitNode(m_expr);
+}
+
+// ------------------------------ IfNode ---------------------------------------
+
+RegisterID* IfNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ generator.emitDebugHook(WillExecuteStatement, firstLine(), lastLine());
+
+ RefPtr<Label> afterThen = generator.newLabel();
+
+ if (m_condition->hasConditionContextCodegen()) {
+ RefPtr<Label> beforeThen = generator.newLabel();
+ generator.emitNodeInConditionContext(m_condition, beforeThen.get(), afterThen.get(), true);
+ generator.emitLabel(beforeThen.get());
+ } else {
+ RegisterID* cond = generator.emitNode(m_condition);
+ generator.emitJumpIfFalse(cond, afterThen.get());
+ }
+
+ generator.emitNode(dst, m_ifBlock);
+ generator.emitLabel(afterThen.get());
+
+ // FIXME: This should return the last statement executed so that it can be returned as a Completion.
+ return 0;
+}
+
+// ------------------------------ IfElseNode ---------------------------------------
+
+RegisterID* IfElseNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ generator.emitDebugHook(WillExecuteStatement, firstLine(), lastLine());
+
+ RefPtr<Label> beforeElse = generator.newLabel();
+ RefPtr<Label> afterElse = generator.newLabel();
+
+ if (m_condition->hasConditionContextCodegen()) {
+ RefPtr<Label> beforeThen = generator.newLabel();
+ generator.emitNodeInConditionContext(m_condition, beforeThen.get(), beforeElse.get(), true);
+ generator.emitLabel(beforeThen.get());
+ } else {
+ RegisterID* cond = generator.emitNode(m_condition);
+ generator.emitJumpIfFalse(cond, beforeElse.get());
+ }
+
+ generator.emitNode(dst, m_ifBlock);
+ generator.emitJump(afterElse.get());
+
+ generator.emitLabel(beforeElse.get());
+
+ generator.emitNode(dst, m_elseBlock);
+
+ generator.emitLabel(afterElse.get());
+
+ // FIXME: This should return the last statement executed so that it can be returned as a Completion.
+ return 0;
+}
+
+// ------------------------------ DoWhileNode ----------------------------------
+
+RegisterID* DoWhileNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ RefPtr<LabelScope> scope = generator.newLabelScope(LabelScope::Loop);
+
+ RefPtr<Label> topOfLoop = generator.newLabel();
+ generator.emitLabel(topOfLoop.get());
+
+ generator.emitDebugHook(WillExecuteStatement, firstLine(), lastLine());
+
+ RefPtr<RegisterID> result = generator.emitNode(dst, m_statement);
+
+ generator.emitLabel(scope->continueTarget());
+ generator.emitDebugHook(WillExecuteStatement, m_expr->lineNo(), m_expr->lineNo());
+ if (m_expr->hasConditionContextCodegen())
+ generator.emitNodeInConditionContext(m_expr, topOfLoop.get(), scope->breakTarget(), false);
+ else {
+ RegisterID* cond = generator.emitNode(m_expr);
+ generator.emitJumpIfTrue(cond, topOfLoop.get());
+ }
+
+ generator.emitLabel(scope->breakTarget());
+ return result.get();
+}
+
+// ------------------------------ WhileNode ------------------------------------
+
+RegisterID* WhileNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ RefPtr<LabelScope> scope = generator.newLabelScope(LabelScope::Loop);
+
+ generator.emitJump(scope->continueTarget());
+
+ RefPtr<Label> topOfLoop = generator.newLabel();
+ generator.emitLabel(topOfLoop.get());
+
+ generator.emitNode(dst, m_statement);
+
+ generator.emitLabel(scope->continueTarget());
+ generator.emitDebugHook(WillExecuteStatement, m_expr->lineNo(), m_expr->lineNo());
+
+ if (m_expr->hasConditionContextCodegen())
+ generator.emitNodeInConditionContext(m_expr, topOfLoop.get(), scope->breakTarget(), false);
+ else {
+ RegisterID* cond = generator.emitNode(m_expr);
+ generator.emitJumpIfTrue(cond, topOfLoop.get());
+ }
+
+ generator.emitLabel(scope->breakTarget());
+
+ // FIXME: This should return the last statement executed so that it can be returned as a Completion
+ return 0;
+}
+
+// ------------------------------ ForNode --------------------------------------
+
+RegisterID* ForNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ RefPtr<LabelScope> scope = generator.newLabelScope(LabelScope::Loop);
+
+ generator.emitDebugHook(WillExecuteStatement, firstLine(), lastLine());
+
+ if (m_expr1)
+ generator.emitNode(generator.ignoredResult(), m_expr1);
+
+ RefPtr<Label> condition = generator.newLabel();
+ generator.emitJump(condition.get());
+
+ RefPtr<Label> topOfLoop = generator.newLabel();
+ generator.emitLabel(topOfLoop.get());
+
+ RefPtr<RegisterID> result = generator.emitNode(dst, m_statement);
+
+ generator.emitLabel(scope->continueTarget());
+ generator.emitDebugHook(WillExecuteStatement, firstLine(), lastLine());
+ if (m_expr3)
+ generator.emitNode(generator.ignoredResult(), m_expr3);
+
+ generator.emitLabel(condition.get());
+ if (m_expr2) {
+ if (m_expr2->hasConditionContextCodegen())
+ generator.emitNodeInConditionContext(m_expr2, topOfLoop.get(), scope->breakTarget(), false);
+ else {
+ RegisterID* cond = generator.emitNode(m_expr2);
+ generator.emitJumpIfTrue(cond, topOfLoop.get());
+ }
+ } else
+ generator.emitJump(topOfLoop.get());
+
+ generator.emitLabel(scope->breakTarget());
+ return result.get();
+}
+
+// ------------------------------ ForInNode ------------------------------------
+
+RegisterID* ForInNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ RefPtr<LabelScope> scope = generator.newLabelScope(LabelScope::Loop);
+
+ if (!m_lexpr->isLocation())
+ return emitThrowReferenceError(generator, "Left side of for-in statement is not a reference.");
+
+ generator.emitDebugHook(WillExecuteStatement, firstLine(), lastLine());
+
+ if (m_init)
+ generator.emitNode(generator.ignoredResult(), m_init);
+
+ RefPtr<RegisterID> base = generator.newTemporary();
+ generator.emitNode(base.get(), m_expr);
+ RefPtr<RegisterID> i = generator.newTemporary();
+ RefPtr<RegisterID> size = generator.newTemporary();
+ RefPtr<RegisterID> expectedSubscript;
+ RefPtr<RegisterID> iter = generator.emitGetPropertyNames(generator.newTemporary(), base.get(), i.get(), size.get(), scope->breakTarget());
+ generator.emitJump(scope->continueTarget());
+
+ RefPtr<Label> loopStart = generator.newLabel();
+ generator.emitLabel(loopStart.get());
+
+ RegisterID* propertyName;
+ bool optimizedForinAccess = false;
+ if (m_lexpr->isResolveNode()) {
+ const Identifier& ident = static_cast<ResolveNode*>(m_lexpr)->identifier();
+ propertyName = generator.registerFor(ident);
+ if (!propertyName) {
+ propertyName = generator.newTemporary();
+ RefPtr<RegisterID> protect = propertyName;
+ RegisterID* base = generator.emitResolveBaseForPut(generator.newTemporary(), ident);
+
+ generator.emitExpressionInfo(divot(), startOffset(), endOffset());
+ generator.emitPutById(base, ident, propertyName);
+ } else {
+ expectedSubscript = generator.emitMove(generator.newTemporary(), propertyName);
+ generator.pushOptimisedForIn(expectedSubscript.get(), iter.get(), i.get(), propertyName);
+ optimizedForinAccess = true;
+ }
+ } else if (m_lexpr->isDotAccessorNode()) {
+ DotAccessorNode* assignNode = static_cast<DotAccessorNode*>(m_lexpr);
+ const Identifier& ident = assignNode->identifier();
+ propertyName = generator.newTemporary();
+ RefPtr<RegisterID> protect = propertyName;
+ RegisterID* base = generator.emitNode(assignNode->base());
+
+ generator.emitExpressionInfo(assignNode->divot(), assignNode->startOffset(), assignNode->endOffset());
+ generator.emitPutById(base, ident, propertyName);
+ } else {
+ ASSERT(m_lexpr->isBracketAccessorNode());
+ BracketAccessorNode* assignNode = static_cast<BracketAccessorNode*>(m_lexpr);
+ propertyName = generator.newTemporary();
+ RefPtr<RegisterID> protect = propertyName;
+ RefPtr<RegisterID> base = generator.emitNode(assignNode->base());
+ RegisterID* subscript = generator.emitNode(assignNode->subscript());
+
+ generator.emitExpressionInfo(assignNode->divot(), assignNode->startOffset(), assignNode->endOffset());
+ generator.emitPutByVal(base.get(), subscript, propertyName);
+ }
+
+ generator.emitNode(dst, m_statement);
+
+ if (optimizedForinAccess)
+ generator.popOptimisedForIn();
+
+ generator.emitLabel(scope->continueTarget());
+ generator.emitNextPropertyName(propertyName, base.get(), i.get(), size.get(), iter.get(), loopStart.get());
+ generator.emitDebugHook(WillExecuteStatement, firstLine(), lastLine());
+ generator.emitLabel(scope->breakTarget());
+ return dst;
+}
+
+// ------------------------------ ContinueNode ---------------------------------
+
+// ECMA 12.7
+RegisterID* ContinueNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ generator.emitDebugHook(WillExecuteStatement, firstLine(), lastLine());
+
+ LabelScope* scope = generator.continueTarget(m_ident);
+
+ if (!scope) {
+ if (m_ident.isEmpty())
+ return emitThrowSyntaxError(generator, "Invalid continue statement.");
+ return emitThrowSyntaxError(generator, makeUString("Undefined label: '", m_ident.ustring(), "'."));
+ }
+
+ generator.emitJumpScopes(scope->continueTarget(), scope->scopeDepth());
+ return dst;
+}
+
+// ------------------------------ BreakNode ------------------------------------
+
+// ECMA 12.8
+RegisterID* BreakNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ generator.emitDebugHook(WillExecuteStatement, firstLine(), lastLine());
+
+ LabelScope* scope = generator.breakTarget(m_ident);
+
+ if (!scope) {
+ if (m_ident.isEmpty())
+ return emitThrowSyntaxError(generator, "Invalid break statement.");
+ return emitThrowSyntaxError(generator, makeUString("Undefined label: '", m_ident.ustring(), "'."));
+ }
+
+ generator.emitJumpScopes(scope->breakTarget(), scope->scopeDepth());
+ return dst;
+}
+
+// ------------------------------ ReturnNode -----------------------------------
+
+RegisterID* ReturnNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ generator.emitDebugHook(WillExecuteStatement, firstLine(), lastLine());
+ if (generator.codeType() != FunctionCode)
+ return emitThrowSyntaxError(generator, "Invalid return statement.");
+
+ if (dst == generator.ignoredResult())
+ dst = 0;
+ RegisterID* r0 = m_value ? generator.emitNode(dst, m_value) : generator.emitLoad(dst, jsUndefined());
+ RefPtr<RegisterID> returnRegister;
+ if (generator.scopeDepth()) {
+ RefPtr<Label> l0 = generator.newLabel();
+ if (generator.hasFinaliser() && !r0->isTemporary()) {
+ returnRegister = generator.emitMove(generator.newTemporary(), r0);
+ r0 = returnRegister.get();
+ }
+ generator.emitJumpScopes(l0.get(), 0);
+ generator.emitLabel(l0.get());
+ }
+ generator.emitDebugHook(WillLeaveCallFrame, firstLine(), lastLine());
+ return generator.emitReturn(r0);
+}
+
+// ------------------------------ WithNode -------------------------------------
+
+RegisterID* WithNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ generator.emitDebugHook(WillExecuteStatement, firstLine(), lastLine());
+
+ RefPtr<RegisterID> scope = generator.newTemporary();
+ generator.emitNode(scope.get(), m_expr); // scope must be protected until popped
+ generator.emitExpressionInfo(m_divot, m_expressionLength, 0);
+ generator.emitPushScope(scope.get());
+ RegisterID* result = generator.emitNode(dst, m_statement);
+ generator.emitPopScope();
+ return result;
+}
+
+// ------------------------------ CaseClauseNode --------------------------------
+
+inline void CaseClauseNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ if (m_statements)
+ m_statements->emitBytecode(generator, dst);
+}
+
+// ------------------------------ CaseBlockNode --------------------------------
+
+enum SwitchKind {
+ SwitchUnset = 0,
+ SwitchNumber = 1,
+ SwitchString = 2,
+ SwitchNeither = 3
+};
+
+static void processClauseList(ClauseListNode* list, Vector<ExpressionNode*, 8>& literalVector, SwitchKind& typeForTable, bool& singleCharacterSwitch, int32_t& min_num, int32_t& max_num)
+{
+ for (; list; list = list->getNext()) {
+ ExpressionNode* clauseExpression = list->getClause()->expr();
+ literalVector.append(clauseExpression);
+ if (clauseExpression->isNumber()) {
+ double value = static_cast<NumberNode*>(clauseExpression)->value();
+ int32_t intVal = static_cast<int32_t>(value);
+ if ((typeForTable & ~SwitchNumber) || (intVal != value)) {
+ typeForTable = SwitchNeither;
+ break;
+ }
+ if (intVal < min_num)
+ min_num = intVal;
+ if (intVal > max_num)
+ max_num = intVal;
+ typeForTable = SwitchNumber;
+ continue;
+ }
+ if (clauseExpression->isString()) {
+ if (typeForTable & ~SwitchString) {
+ typeForTable = SwitchNeither;
+ break;
+ }
+ const UString& value = static_cast<StringNode*>(clauseExpression)->value().ustring();
+ if (singleCharacterSwitch &= value.length() == 1) {
+ int32_t intVal = value.impl()->characters()[0];
+ if (intVal < min_num)
+ min_num = intVal;
+ if (intVal > max_num)
+ max_num = intVal;
+ }
+ typeForTable = SwitchString;
+ continue;
+ }
+ typeForTable = SwitchNeither;
+ break;
+ }
+}
+
+SwitchInfo::SwitchType CaseBlockNode::tryOptimizedSwitch(Vector<ExpressionNode*, 8>& literalVector, int32_t& min_num, int32_t& max_num)
+{
+ SwitchKind typeForTable = SwitchUnset;
+ bool singleCharacterSwitch = true;
+
+ processClauseList(m_list1, literalVector, typeForTable, singleCharacterSwitch, min_num, max_num);
+ processClauseList(m_list2, literalVector, typeForTable, singleCharacterSwitch, min_num, max_num);
+
+ if (typeForTable == SwitchUnset || typeForTable == SwitchNeither)
+ return SwitchInfo::SwitchNone;
+
+ if (typeForTable == SwitchNumber) {
+ int32_t range = max_num - min_num;
+ if (min_num <= max_num && range <= 1000 && (range / literalVector.size()) < 10)
+ return SwitchInfo::SwitchImmediate;
+ return SwitchInfo::SwitchNone;
+ }
+
+ ASSERT(typeForTable == SwitchString);
+
+ if (singleCharacterSwitch) {
+ int32_t range = max_num - min_num;
+ if (min_num <= max_num && range <= 1000 && (range / literalVector.size()) < 10)
+ return SwitchInfo::SwitchCharacter;
+ }
+
+ return SwitchInfo::SwitchString;
+}
+
+RegisterID* CaseBlockNode::emitBytecodeForBlock(BytecodeGenerator& generator, RegisterID* switchExpression, RegisterID* dst)
+{
+ RefPtr<Label> defaultLabel;
+ Vector<RefPtr<Label>, 8> labelVector;
+ Vector<ExpressionNode*, 8> literalVector;
+ int32_t min_num = std::numeric_limits<int32_t>::max();
+ int32_t max_num = std::numeric_limits<int32_t>::min();
+ SwitchInfo::SwitchType switchType = tryOptimizedSwitch(literalVector, min_num, max_num);
+
+ if (switchType != SwitchInfo::SwitchNone) {
+ // Prepare the various labels
+ for (uint32_t i = 0; i < literalVector.size(); i++)
+ labelVector.append(generator.newLabel());
+ defaultLabel = generator.newLabel();
+ generator.beginSwitch(switchExpression, switchType);
+ } else {
+ // Setup jumps
+ for (ClauseListNode* list = m_list1; list; list = list->getNext()) {
+ RefPtr<RegisterID> clauseVal = generator.newTemporary();
+ generator.emitNode(clauseVal.get(), list->getClause()->expr());
+ generator.emitBinaryOp(op_stricteq, clauseVal.get(), clauseVal.get(), switchExpression, OperandTypes());
+ labelVector.append(generator.newLabel());
+ generator.emitJumpIfTrue(clauseVal.get(), labelVector[labelVector.size() - 1].get());
+ }
+
+ for (ClauseListNode* list = m_list2; list; list = list->getNext()) {
+ RefPtr<RegisterID> clauseVal = generator.newTemporary();
+ generator.emitNode(clauseVal.get(), list->getClause()->expr());
+ generator.emitBinaryOp(op_stricteq, clauseVal.get(), clauseVal.get(), switchExpression, OperandTypes());
+ labelVector.append(generator.newLabel());
+ generator.emitJumpIfTrue(clauseVal.get(), labelVector[labelVector.size() - 1].get());
+ }
+ defaultLabel = generator.newLabel();
+ generator.emitJump(defaultLabel.get());
+ }
+
+ RegisterID* result = 0;
+
+ size_t i = 0;
+ for (ClauseListNode* list = m_list1; list; list = list->getNext()) {
+ generator.emitLabel(labelVector[i++].get());
+ list->getClause()->emitBytecode(generator, dst);
+ }
+
+ if (m_defaultClause) {
+ generator.emitLabel(defaultLabel.get());
+ m_defaultClause->emitBytecode(generator, dst);
+ }
+
+ for (ClauseListNode* list = m_list2; list; list = list->getNext()) {
+ generator.emitLabel(labelVector[i++].get());
+ list->getClause()->emitBytecode(generator, dst);
+ }
+ if (!m_defaultClause)
+ generator.emitLabel(defaultLabel.get());
+
+ ASSERT(i == labelVector.size());
+ if (switchType != SwitchInfo::SwitchNone) {
+ ASSERT(labelVector.size() == literalVector.size());
+ generator.endSwitch(labelVector.size(), labelVector.data(), literalVector.data(), defaultLabel.get(), min_num, max_num);
+ }
+ return result;
+}
+
+// ------------------------------ SwitchNode -----------------------------------
+
+RegisterID* SwitchNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ generator.emitDebugHook(WillExecuteStatement, firstLine(), lastLine());
+
+ RefPtr<LabelScope> scope = generator.newLabelScope(LabelScope::Switch);
+
+ RefPtr<RegisterID> r0 = generator.emitNode(m_expr);
+ RegisterID* r1 = m_block->emitBytecodeForBlock(generator, r0.get(), dst);
+
+ generator.emitLabel(scope->breakTarget());
+ return r1;
+}
+
+// ------------------------------ LabelNode ------------------------------------
+
+RegisterID* LabelNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ generator.emitDebugHook(WillExecuteStatement, firstLine(), lastLine());
+
+ if (generator.breakTarget(m_name))
+ return emitThrowSyntaxError(generator, makeUString("Duplicate label: ", m_name.ustring(), "."));
+
+ RefPtr<LabelScope> scope = generator.newLabelScope(LabelScope::NamedLabel, &m_name);
+ RegisterID* r0 = generator.emitNode(dst, m_statement);
+
+ generator.emitLabel(scope->breakTarget());
+ return r0;
+}
+
+// ------------------------------ ThrowNode ------------------------------------
+
+RegisterID* ThrowNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ generator.emitDebugHook(WillExecuteStatement, firstLine(), lastLine());
+
+ if (dst == generator.ignoredResult())
+ dst = 0;
+ RefPtr<RegisterID> expr = generator.emitNode(m_expr);
+ generator.emitExpressionInfo(divot(), startOffset(), endOffset());
+ generator.emitThrow(expr.get());
+ return 0;
+}
+
+// ------------------------------ TryNode --------------------------------------
+
+RegisterID* TryNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ // NOTE: The catch and finally blocks must be labeled explicitly, so the
+ // optimizer knows they may be jumped to from anywhere.
+
+ generator.emitDebugHook(WillExecuteStatement, firstLine(), lastLine());
+
+ RefPtr<Label> tryStartLabel = generator.newLabel();
+ RefPtr<Label> finallyStart;
+ RefPtr<RegisterID> finallyReturnAddr;
+ if (m_finallyBlock) {
+ finallyStart = generator.newLabel();
+ finallyReturnAddr = generator.newTemporary();
+ generator.pushFinallyContext(finallyStart.get(), finallyReturnAddr.get());
+ }
+
+ generator.emitLabel(tryStartLabel.get());
+ generator.emitNode(dst, m_tryBlock);
+
+ if (m_catchBlock) {
+ RefPtr<Label> catchEndLabel = generator.newLabel();
+
+ // Normal path: jump over the catch block.
+ generator.emitJump(catchEndLabel.get());
+
+ // Uncaught exception path: the catch block.
+ RefPtr<Label> here = generator.emitLabel(generator.newLabel().get());
+ RefPtr<RegisterID> exceptionRegister = generator.emitCatch(generator.newTemporary(), tryStartLabel.get(), here.get());
+ if (m_catchHasEval) {
+ RefPtr<RegisterID> dynamicScopeObject = generator.emitNewObject(generator.newTemporary());
+ generator.emitPutById(dynamicScopeObject.get(), m_exceptionIdent, exceptionRegister.get());
+ generator.emitMove(exceptionRegister.get(), dynamicScopeObject.get());
+ generator.emitPushScope(exceptionRegister.get());
+ } else
+ generator.emitPushNewScope(exceptionRegister.get(), m_exceptionIdent, exceptionRegister.get());
+ generator.emitNode(dst, m_catchBlock);
+ generator.emitPopScope();
+ generator.emitLabel(catchEndLabel.get());
+ }
+
+ if (m_finallyBlock) {
+ generator.popFinallyContext();
+ // there may be important registers live at the time we jump
+ // to a finally block (such as for a return or throw) so we
+ // ref the highest register ever used as a conservative
+ // approach to not clobbering anything important
+ RefPtr<RegisterID> highestUsedRegister = generator.highestUsedRegister();
+ RefPtr<Label> finallyEndLabel = generator.newLabel();
+
+ // Normal path: invoke the finally block, then jump over it.
+ generator.emitJumpSubroutine(finallyReturnAddr.get(), finallyStart.get());
+ generator.emitJump(finallyEndLabel.get());
+
+ // Uncaught exception path: invoke the finally block, then re-throw the exception.
+ RefPtr<Label> here = generator.emitLabel(generator.newLabel().get());
+ RefPtr<RegisterID> tempExceptionRegister = generator.emitCatch(generator.newTemporary(), tryStartLabel.get(), here.get());
+ generator.emitJumpSubroutine(finallyReturnAddr.get(), finallyStart.get());
+ generator.emitThrow(tempExceptionRegister.get());
+
+ // The finally block.
+ generator.emitLabel(finallyStart.get());
+ generator.emitNode(dst, m_finallyBlock);
+ generator.emitSubroutineReturn(finallyReturnAddr.get());
+
+ generator.emitLabel(finallyEndLabel.get());
+ }
+
+ return dst;
+}
+
+// ------------------------------ ScopeNode -----------------------------
+
+inline void ScopeNode::emitStatementsBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ if (m_data->m_statements)
+ m_data->m_statements->emitBytecode(generator, dst);
+}
+
+// ------------------------------ ProgramNode -----------------------------
+
+RegisterID* ProgramNode::emitBytecode(BytecodeGenerator& generator, RegisterID*)
+{
+ generator.emitDebugHook(WillExecuteProgram, firstLine(), lastLine());
+
+ RefPtr<RegisterID> dstRegister = generator.newTemporary();
+ generator.emitLoad(dstRegister.get(), jsUndefined());
+ emitStatementsBytecode(generator, dstRegister.get());
+
+ generator.emitDebugHook(DidExecuteProgram, firstLine(), lastLine());
+ generator.emitEnd(dstRegister.get());
+ return 0;
+}
+
+// ------------------------------ EvalNode -----------------------------
+
+RegisterID* EvalNode::emitBytecode(BytecodeGenerator& generator, RegisterID*)
+{
+ generator.emitDebugHook(WillExecuteProgram, firstLine(), lastLine());
+
+ RefPtr<RegisterID> dstRegister = generator.newTemporary();
+ generator.emitLoad(dstRegister.get(), jsUndefined());
+ emitStatementsBytecode(generator, dstRegister.get());
+
+ generator.emitDebugHook(DidExecuteProgram, firstLine(), lastLine());
+ generator.emitEnd(dstRegister.get());
+ return 0;
+}
+
+// ------------------------------ FunctionBodyNode -----------------------------
+
+RegisterID* FunctionBodyNode::emitBytecode(BytecodeGenerator& generator, RegisterID*)
+{
+ generator.emitDebugHook(DidEnterCallFrame, firstLine(), lastLine());
+ emitStatementsBytecode(generator, generator.ignoredResult());
+
+ StatementNode* singleStatement = this->singleStatement();
+ ReturnNode* returnNode = 0;
+
+ // Check for a return statement at the end of a function composed of a single block.
+ if (singleStatement && singleStatement->isBlock()) {
+ StatementNode* lastStatementInBlock = static_cast<BlockNode*>(singleStatement)->lastStatement();
+ if (lastStatementInBlock && lastStatementInBlock->isReturnNode())
+ returnNode = static_cast<ReturnNode*>(lastStatementInBlock);
+ }
+
+ // If there is no return we must automatically insert one.
+ if (!returnNode) {
+ RegisterID* r0 = generator.isConstructor() ? generator.thisRegister() : generator.emitLoad(0, jsUndefined());
+ generator.emitDebugHook(WillLeaveCallFrame, firstLine(), lastLine());
+ generator.emitReturn(r0);
+ return 0;
+ }
+
+ // If there is a return statment, and it is the only statement in the function, check if this is a numeric compare.
+ if (static_cast<BlockNode*>(singleStatement)->singleStatement()) {
+ ExpressionNode* returnValueExpression = returnNode->value();
+ if (returnValueExpression && returnValueExpression->isSubtract()) {
+ ExpressionNode* lhsExpression = static_cast<SubNode*>(returnValueExpression)->lhs();
+ ExpressionNode* rhsExpression = static_cast<SubNode*>(returnValueExpression)->rhs();
+ if (lhsExpression->isResolveNode() && rhsExpression->isResolveNode()) {
+ generator.setIsNumericCompareFunction(generator.argumentNumberFor(static_cast<ResolveNode*>(lhsExpression)->identifier()) == 1
+ && generator.argumentNumberFor(static_cast<ResolveNode*>(rhsExpression)->identifier()) == 2);
+ }
+ }
+ }
+
+ return 0;
+}
+
+// ------------------------------ FuncDeclNode ---------------------------------
+
+RegisterID* FuncDeclNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ if (dst == generator.ignoredResult())
+ dst = 0;
+ return dst;
+}
+
+// ------------------------------ FuncExprNode ---------------------------------
+
+RegisterID* FuncExprNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
+{
+ return generator.emitNewFunctionExpression(generator.finalDestination(dst), this);
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/bytecompiler/RegisterID.h b/Source/JavaScriptCore/bytecompiler/RegisterID.h
new file mode 100644
index 0000000..3532ad8
--- /dev/null
+++ b/Source/JavaScriptCore/bytecompiler/RegisterID.h
@@ -0,0 +1,121 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef RegisterID_h
+#define RegisterID_h
+
+#include <wtf/Assertions.h>
+#include <wtf/Noncopyable.h>
+#include <wtf/VectorTraits.h>
+
+namespace JSC {
+
+ class RegisterID : public Noncopyable {
+ public:
+ RegisterID()
+ : m_refCount(0)
+ , m_isTemporary(false)
+#ifndef NDEBUG
+ , m_didSetIndex(false)
+#endif
+ {
+ }
+
+ explicit RegisterID(int index)
+ : m_refCount(0)
+ , m_index(index)
+ , m_isTemporary(false)
+#ifndef NDEBUG
+ , m_didSetIndex(true)
+#endif
+ {
+ }
+
+ void setIndex(int index)
+ {
+ ASSERT(!m_refCount);
+#ifndef NDEBUG
+ m_didSetIndex = true;
+#endif
+ m_index = index;
+ }
+
+ void setTemporary()
+ {
+ m_isTemporary = true;
+ }
+
+ int index() const
+ {
+ ASSERT(m_didSetIndex);
+ return m_index;
+ }
+
+ bool isTemporary()
+ {
+ return m_isTemporary;
+ }
+
+ void ref()
+ {
+ ++m_refCount;
+ }
+
+ void deref()
+ {
+ --m_refCount;
+ ASSERT(m_refCount >= 0);
+ }
+
+ int refCount() const
+ {
+ return m_refCount;
+ }
+
+ private:
+
+ int m_refCount;
+ int m_index;
+ bool m_isTemporary;
+#ifndef NDEBUG
+ bool m_didSetIndex;
+#endif
+ };
+
+} // namespace JSC
+
+namespace WTF {
+
+ template<> struct VectorTraits<JSC::RegisterID> : VectorTraitsBase<true, JSC::RegisterID> {
+ static const bool needsInitialization = true;
+ static const bool canInitializeWithMemset = true; // Default initialization just sets everything to 0 or false, so this is safe.
+ };
+
+} // namespace WTF
+
+#endif // RegisterID_h
diff --git a/Source/JavaScriptCore/config.h b/Source/JavaScriptCore/config.h
new file mode 100644
index 0000000..a2b6285
--- /dev/null
+++ b/Source/JavaScriptCore/config.h
@@ -0,0 +1,99 @@
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
+#ifdef BUILDING_WITH_CMAKE
+#include "cmakeconfig.h"
+#else
+#include "autotoolsconfig.h"
+#endif
+#endif
+
+#include <wtf/Platform.h>
+
+#if !PLATFORM(CHROMIUM) && OS(WINDOWS) && !defined(BUILDING_WX__) && !COMPILER(GCC)
+#if defined(BUILDING_JavaScriptCore) || defined(BUILDING_WTF)
+#define JS_EXPORTDATA __declspec(dllexport)
+#else
+#define JS_EXPORTDATA __declspec(dllimport)
+#endif
+#define JS_EXPORTCLASS JS_EXPORTDATA
+#else
+#define JS_EXPORTDATA
+#define JS_EXPORTCLASS
+#endif
+
+#if OS(WINDOWS)
+
+// If we don't define these, they get defined in windef.h.
+// We want to use std::min and std::max
+#define max max
+#define min min
+
+#if !COMPILER(MSVC7_OR_LOWER) && !OS(WINCE)
+// We need to define this before the first #include of stdlib.h or it won't contain rand_s.
+#ifndef _CRT_RAND_S
+#define _CRT_RAND_S
+#endif
+#endif
+
+#endif
+
+#if OS(FREEBSD) || OS(OPENBSD)
+#define HAVE_PTHREAD_NP_H 1
+#endif
+
+/* FIXME: if all platforms have these, do they really need #defines? */
+#define HAVE_STDINT_H 1
+
+#define WTF_CHANGES 1
+
+#ifdef __cplusplus
+#undef new
+#undef delete
+#include <wtf/FastMalloc.h>
+#endif
+
+// this breaks compilation of <QFontDatabase>, at least, so turn it off for now
+// Also generates errors on wx on Windows, because these functions
+// are used from wx headers.
+#if !PLATFORM(QT) && !PLATFORM(WX)
+#include <wtf/DisallowCType.h>
+#endif
+
+#if COMPILER(MSVC)
+#define SKIP_STATIC_CONSTRUCTORS_ON_MSVC 1
+#else
+#define SKIP_STATIC_CONSTRUCTORS_ON_GCC 1
+#endif
+
+#if PLATFORM(CHROMIUM)
+#if !defined(WTF_USE_V8)
+#define WTF_USE_V8 1
+#endif
+#endif /* PLATFORM(CHROMIUM) */
+
+#if !defined(WTF_USE_V8)
+#define WTF_USE_V8 0
+#endif /* !defined(WTF_USE_V8) */
+
+/* Using V8 implies not using JSC and vice versa */
+#define WTF_USE_JSC !WTF_USE_V8
diff --git a/Source/JavaScriptCore/create_hash_table b/Source/JavaScriptCore/create_hash_table
new file mode 100755
index 0000000..6078f97
--- /dev/null
+++ b/Source/JavaScriptCore/create_hash_table
@@ -0,0 +1,296 @@
+#! /usr/bin/perl -w
+#
+# Static Hashtable Generator
+#
+# (c) 2000-2002 by Harri Porten <porten@kde.org> and
+# David Faure <faure@kde.org>
+# Modified (c) 2004 by Nikolas Zimmermann <wildfox@kde.org>
+# Copyright (C) 2007, 2008, 2009 Apple Inc. All rights reserved.
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+use strict;
+
+my $file = $ARGV[0];
+shift;
+my $includelookup = 0;
+
+# Use -i as second argument to make it include "Lookup.h"
+$includelookup = 1 if (defined($ARGV[0]) && $ARGV[0] eq "-i");
+
+# Use -n as second argument to make it use the third argument as namespace parameter ie. -n KDOM
+my $useNameSpace = $ARGV[1] if (defined($ARGV[0]) && $ARGV[0] eq "-n");
+
+print STDERR "Creating hashtable for $file\n";
+open(IN, $file) or die "No such file $file";
+
+my @keys = ();
+my @attrs = ();
+my @values = ();
+my @hashes = ();
+
+my $inside = 0;
+my $name;
+my $pefectHashSize;
+my $compactSize;
+my $compactHashSizeMask;
+my $banner = 0;
+sub calcPerfectHashSize();
+sub calcCompactHashSize();
+sub output();
+sub jsc_ucfirst($);
+sub hashValue($);
+
+while (<IN>) {
+ chomp;
+ s/^\s+//;
+ next if /^\#|^$/; # Comment or blank line. Do nothing.
+ if (/^\@begin/ && !$inside) {
+ if (/^\@begin\s*([:_\w]+)\s*\d*\s*$/) {
+ $inside = 1;
+ $name = $1;
+ } else {
+ print STDERR "WARNING: \@begin without table name, skipping $_\n";
+ }
+ } elsif (/^\@end\s*$/ && $inside) {
+ calcPerfectHashSize();
+ calcCompactHashSize();
+ output();
+
+ @keys = ();
+ @attrs = ();
+ @values = ();
+ @hashes = ();
+
+ $inside = 0;
+ } elsif (/^(\S+)\s*(\S+)\s*([\w\|]*)\s*(\w*)\s*$/ && $inside) {
+ my $key = $1;
+ my $val = $2;
+ my $att = $3;
+ my $param = $4;
+
+ push(@keys, $key);
+ push(@attrs, length($att) > 0 ? $att : "0");
+
+ if ($att =~ m/Function/) {
+ push(@values, { "type" => "Function", "function" => $val, "params" => (length($param) ? $param : "") });
+ #printf STDERR "WARNING: Number of arguments missing for $key/$val\n" if (length($param) == 0);
+ } elsif (length($att)) {
+ my $get = $val;
+ my $put = !($att =~ m/ReadOnly/) ? "set" . jsc_ucfirst($val) : "0";
+ push(@values, { "type" => "Property", "get" => $get, "put" => $put });
+ } else {
+ push(@values, { "type" => "Lexer", "value" => $val });
+ }
+ push(@hashes, hashValue($key));
+ } elsif ($inside) {
+ die "invalid data {" . $_ . "}";
+ }
+}
+
+die "missing closing \@end" if ($inside);
+
+sub jsc_ucfirst($)
+{
+ my ($value) = @_;
+
+ if ($value =~ /js/) {
+ $value =~ s/js/JS/;
+ return $value;
+ }
+
+ return ucfirst($value);
+}
+
+
+sub ceilingToPowerOf2
+{
+ my ($pefectHashSize) = @_;
+
+ my $powerOf2 = 1;
+ while ($pefectHashSize > $powerOf2) {
+ $powerOf2 <<= 1;
+ }
+
+ return $powerOf2;
+}
+
+sub calcPerfectHashSize()
+{
+tableSizeLoop:
+ for ($pefectHashSize = ceilingToPowerOf2(scalar @keys); ; $pefectHashSize += $pefectHashSize) {
+ my @table = ();
+ foreach my $key (@keys) {
+ my $h = hashValue($key) % $pefectHashSize;
+ next tableSizeLoop if $table[$h];
+ $table[$h] = 1;
+ }
+ last;
+ }
+}
+
+sub leftShift($$) {
+ my ($value, $distance) = @_;
+ return (($value << $distance) & 0xFFFFFFFF);
+}
+
+sub calcCompactHashSize()
+{
+ my @table = ();
+ my @links = ();
+ my $compactHashSize = ceilingToPowerOf2(2 * @keys);
+ $compactHashSizeMask = $compactHashSize - 1;
+ $compactSize = $compactHashSize;
+ my $collisions = 0;
+ my $maxdepth = 0;
+ my $i = 0;
+ foreach my $key (@keys) {
+ my $depth = 0;
+ my $h = hashValue($key) % $compactHashSize;
+ while (defined($table[$h])) {
+ if (defined($links[$h])) {
+ $h = $links[$h];
+ $depth++;
+ } else {
+ $collisions++;
+ $links[$h] = $compactSize;
+ $h = $compactSize;
+ $compactSize++;
+ }
+ }
+ $table[$h] = $i;
+ $i++;
+ $maxdepth = $depth if ( $depth > $maxdepth);
+ }
+}
+
+# Paul Hsieh's SuperFastHash
+# http://www.azillionmonkeys.com/qed/hash.html
+# Ported from UString..
+sub hashValue($) {
+ my @chars = split(/ */, $_[0]);
+
+ # This hash is designed to work on 16-bit chunks at a time. But since the normal case
+ # (above) is to hash UTF-16 characters, we just treat the 8-bit chars as if they
+ # were 16-bit chunks, which should give matching results
+
+ my $EXP2_32 = 4294967296;
+
+ my $hash = 0x9e3779b9;
+ my $l = scalar @chars; #I wish this was in Ruby --- Maks
+ my $rem = $l & 1;
+ $l = $l >> 1;
+
+ my $s = 0;
+
+ # Main loop
+ for (; $l > 0; $l--) {
+ $hash += ord($chars[$s]);
+ my $tmp = leftShift(ord($chars[$s+1]), 11) ^ $hash;
+ $hash = (leftShift($hash, 16)% $EXP2_32) ^ $tmp;
+ $s += 2;
+ $hash += $hash >> 11;
+ $hash %= $EXP2_32;
+ }
+
+ # Handle end case
+ if ($rem !=0) {
+ $hash += ord($chars[$s]);
+ $hash ^= (leftShift($hash, 11)% $EXP2_32);
+ $hash += $hash >> 17;
+ }
+
+ # Force "avalanching" of final 127 bits
+ $hash ^= leftShift($hash, 3);
+ $hash += ($hash >> 5);
+ $hash = ($hash% $EXP2_32);
+ $hash ^= (leftShift($hash, 2)% $EXP2_32);
+ $hash += ($hash >> 15);
+ $hash = $hash% $EXP2_32;
+ $hash ^= (leftShift($hash, 10)% $EXP2_32);
+
+ # this avoids ever returning a hash code of 0, since that is used to
+ # signal "hash not computed yet", using a value that is likely to be
+ # effectively the same as 0 when the low bits are masked
+ $hash = 0x80000000 if ($hash == 0);
+
+ return $hash;
+}
+
+sub output() {
+ if (!$banner) {
+ $banner = 1;
+ print "// Automatically generated from $file using $0. DO NOT EDIT!\n";
+ }
+
+ my $nameEntries = "${name}Values";
+ $nameEntries =~ s/:/_/g;
+
+ print "\n#include \"Lookup.h\"\n" if ($includelookup);
+ if ($useNameSpace) {
+ print "\nnamespace ${useNameSpace} {\n";
+ print "\nusing namespace JSC;\n";
+ } else {
+ print "\nnamespace JSC {\n";
+ }
+ my $count = scalar @keys + 1;
+ print "#if ENABLE(JIT)\n";
+ print "#define THUNK_GENERATOR(generator) , generator\n";
+ print "#else\n";
+ print "#define THUNK_GENERATOR(generator)\n";
+ print "#endif\n";
+ print "\nstatic const struct HashTableValue ${nameEntries}\[$count\] = {\n";
+ my $i = 0;
+ foreach my $key (@keys) {
+ my $firstValue = "";
+ my $secondValue = "";
+ my $castStr = "";
+
+ if ($values[$i]{"type"} eq "Function") {
+ $castStr = "static_cast<NativeFunction>";
+ $firstValue = $values[$i]{"function"};
+ $secondValue = $values[$i]{"params"};
+ } elsif ($values[$i]{"type"} eq "Property") {
+ $castStr = "static_cast<PropertySlot::GetValueFunc>";
+ $firstValue = $values[$i]{"get"};
+ $secondValue = $values[$i]{"put"};
+ } elsif ($values[$i]{"type"} eq "Lexer") {
+ $firstValue = $values[$i]{"value"};
+ $secondValue = "0";
+ }
+ my $thunkGenerator = "0";
+ if ($key eq "charCodeAt") {
+ $thunkGenerator = "charCodeAtThunkGenerator";
+ }
+ if ($key eq "charAt") {
+ $thunkGenerator = "charAtThunkGenerator";
+ }
+ if ($key eq "sqrt") {
+ $thunkGenerator = "sqrtThunkGenerator";
+ }
+ if ($key eq "pow") {
+ $thunkGenerator = "powThunkGenerator";
+ }
+ print " { \"$key\", $attrs[$i], (intptr_t)" . $castStr . "($firstValue), (intptr_t)$secondValue THUNK_GENERATOR($thunkGenerator) },\n";
+ $i++;
+ }
+ print " { 0, 0, 0, 0 THUNK_GENERATOR(0) }\n";
+ print "};\n\n";
+ print "#undef THUNK_GENERATOR\n";
+ print "extern JSC_CONST_HASHTABLE HashTable $name =\n";
+ print " \{ $compactSize, $compactHashSizeMask, $nameEntries, 0 \};\n";
+ print "} // namespace\n";
+}
diff --git a/Source/JavaScriptCore/create_jit_stubs b/Source/JavaScriptCore/create_jit_stubs
new file mode 100644
index 0000000..4950bfc
--- /dev/null
+++ b/Source/JavaScriptCore/create_jit_stubs
@@ -0,0 +1,85 @@
+#! /usr/bin/perl -w
+#
+# Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
+# Copyright (C) 2010 Patrick Gansterer <paroga@paroga.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Library General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Library General Public License for more details.
+#
+# You should have received a copy of the GNU Library General Public License
+# along with this library; see the file COPYING.LIB. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+
+use strict;
+use File::Basename;
+use Getopt::Long;
+
+my $usage = basename($0) . " --prefix prefix [--offset offset] file";
+
+my $rtype_template = quotemeta("#rtype#");
+my $offset_template = quotemeta(" THUNK_RETURN_ADDRESS_OFFSET");
+my $op_template = quotemeta("#op#");
+
+my $prefix;
+my $offset_is_set = 0;
+my $offset = 32;
+my $file;
+
+my $getOptionsResult = GetOptions(
+ 'prefix=s' => \$prefix,
+ 'offset=i' => sub { $offset_is_set = 1; $offset = $_[1]; }
+);
+
+$file = $ARGV[0];
+
+die "$usage\n" unless ($prefix and $file);
+
+my $stub_template = "";
+my $output_end = "";
+my $stub = "";
+
+my $rtype = "";
+my $op = "";
+
+print STDERR "Creating JIT stubs for $file \n";
+open(IN, $file) or die "No such file $file";
+
+while ( $_ = <IN> ) {
+ if ( /^$prefix\_BEGIN\((.*)\)/ ) {
+ $stub = $1;
+ if ($offset_is_set) {
+ $stub =~ s/$offset_template/$offset/g;
+ }
+ print $stub . "\n";
+ }
+ if ( /^$prefix\((.*)\)/ ) {
+ $stub_template .= $1 . "\n";
+ }
+ if ( /^$prefix\_END\((.*)\)/ ) {
+ $output_end .= $1 . "\n";
+ }
+ if ( /^DEFINE_STUB_FUNCTION\((.*), (.*)\)/ ) {
+ $stub = $stub_template;
+ $rtype = quotemeta($1);
+ $op = quotemeta($2);
+ if ($offset_is_set) {
+ $stub =~ s/$offset_template/$offset/g;
+ }
+ $stub =~ s/$rtype_template/$rtype/g;
+ $stub =~ s/$op_template/$op/g;
+ $stub =~ s/\\\*/\*/g;
+ print $stub;
+ }
+}
+
+print $output_end;
+
+close(IN);
diff --git a/Source/JavaScriptCore/create_regex_tables b/Source/JavaScriptCore/create_regex_tables
new file mode 100644
index 0000000..d1cc1c2
--- /dev/null
+++ b/Source/JavaScriptCore/create_regex_tables
@@ -0,0 +1,112 @@
+# Copyright (C) 2010 Apple Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+types = {
+ "wordchar": { "UseTable" : True, "data": ['_', ('0','9'), ('A', 'Z'), ('a','z')]},
+ "nonwordchar": { "UseTable" : True, "Inverse": "wordchar", "data": ['`', (0, ord('0') - 1), (ord('9') + 1, ord('A') - 1), (ord('Z') + 1, ord('_') - 1), (ord('z') + 1, 0xffff)]},
+ "newline": { "UseTable" : False, "data": ['\n', '\r', 0x2028, 0x2029]},
+ "spaces": { "UseTable" : True, "data": [' ', ('\t', '\r'), 0xa0, 0x1680, 0x180e, 0x2028, 0x2029, 0x202f, 0x205f, 0x3000, (0x2000, 0x200a), 0xfeff]},
+ "nonspaces": { "UseTable" : True, "Inverse": "spaces", "data": [(0, ord('\t') - 1), (ord('\r') + 1, ord(' ') - 1), (ord(' ') + 1, 0x009f), (0x00a1, 0x167f), (0x1681, 0x180d), (0x180f, 0x1fff), (0x200b, 0x2027), (0x202a, 0x202e), (0x2030, 0x205e), (0x2060, 0x2fff), (0x3001, 0xfefe), (0xff00, 0xffff)]},
+ "digits": { "UseTable" : False, "data": [('0', '9')]},
+ "nondigits": { "UseTable" : False, "Inverse": "digits", "data": [(0, ord('0') - 1), (ord('9') + 1, 0xffff)] }
+}
+entriesPerLine = 50
+arrays = "";
+functions = "";
+
+for name, classes in types.items():
+ ranges = [];
+ size = 0;
+ for _class in classes["data"]:
+ if type(_class) == str:
+ ranges.append((ord(_class), ord(_class)))
+ elif type(_class) == int:
+ ranges.append((_class, _class))
+ else:
+ (min, max) = _class;
+ if type(min) == str:
+ min = ord(min)
+ if type(max) == str:
+ max = ord(max)
+ if max > 0x7f and min <= 0x7f:
+ ranges.append((min, 0x7f))
+ min = 0x80
+ ranges.append((min,max))
+ ranges.sort();
+
+ if classes["UseTable"] and (not "Inverse" in classes):
+ array = ("static const char _%sData[65536] = {\n" % name);
+ i = 0
+ for (min,max) in ranges:
+ while i < min:
+ i = i + 1
+ array += ('0,')
+ if (i % entriesPerLine == 0) and (i != 0):
+ array += ('\n')
+ while i <= max:
+ i = i + 1
+ if (i == 65536):
+ array += ("1")
+ else:
+ array += ('1,')
+ if (i % entriesPerLine == 0) and (i != 0):
+ array += ('\n')
+ while i < 0xffff:
+ array += ("0,")
+ i = i + 1;
+ if (i % entriesPerLine == 0) and (i != 0):
+ array += ('\n')
+ if i == 0xffff:
+ array += ("0")
+ array += ("\n};\n\n");
+ arrays += array
+
+ # Generate createFunction:
+ function = "";
+ function += ("CharacterClass* %sCreate()\n" % name)
+ function += ("{\n")
+ if classes["UseTable"]:
+ if "Inverse" in classes:
+ function += (" CharacterClass* characterClass = new CharacterClass(CharacterClassTable::create(_%sData, true));\n" % (classes["Inverse"]))
+ else:
+ function += (" CharacterClass* characterClass = new CharacterClass(CharacterClassTable::create(_%sData, false));\n" % (name))
+ else:
+ function += (" CharacterClass* characterClass = new CharacterClass(0);\n")
+ for (min, max) in ranges:
+ if (min == max):
+ if (min > 127):
+ function += (" characterClass->m_matchesUnicode.append(0x%04x);\n" % min)
+ else:
+ function += (" characterClass->m_matches.append(0x%02x);\n" % min)
+ continue
+ if (min > 127) or (max > 127):
+ function += (" characterClass->m_rangesUnicode.append(CharacterRange(0x%04x, 0x%04x));\n" % (min, max))
+ else:
+ function += (" characterClass->m_ranges.append(CharacterRange(0x%02x, 0x%02x));\n" % (min, max))
+ function += (" return characterClass;\n")
+ function += ("}\n\n")
+ functions += function
+
+print(arrays)
+print(functions)
+
diff --git a/Source/JavaScriptCore/debugger/Debugger.cpp b/Source/JavaScriptCore/debugger/Debugger.cpp
new file mode 100644
index 0000000..6b24c5a
--- /dev/null
+++ b/Source/JavaScriptCore/debugger/Debugger.cpp
@@ -0,0 +1,119 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
+ * Copyright (C) 2001 Peter Kelly (pmk@post.com)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#include "config.h"
+#include "Debugger.h"
+
+#include "CollectorHeapIterator.h"
+#include "Error.h"
+#include "Interpreter.h"
+#include "JSFunction.h"
+#include "JSGlobalObject.h"
+#include "Parser.h"
+#include "Protect.h"
+
+namespace JSC {
+
+Debugger::~Debugger()
+{
+ HashSet<JSGlobalObject*>::iterator end = m_globalObjects.end();
+ for (HashSet<JSGlobalObject*>::iterator it = m_globalObjects.begin(); it != end; ++it)
+ (*it)->setDebugger(0);
+}
+
+void Debugger::attach(JSGlobalObject* globalObject)
+{
+ ASSERT(!globalObject->debugger());
+ globalObject->setDebugger(this);
+ m_globalObjects.add(globalObject);
+}
+
+void Debugger::detach(JSGlobalObject* globalObject)
+{
+ ASSERT(m_globalObjects.contains(globalObject));
+ m_globalObjects.remove(globalObject);
+ globalObject->setDebugger(0);
+}
+
+void Debugger::recompileAllJSFunctions(JSGlobalData* globalData)
+{
+ // If JavaScript is running, it's not safe to recompile, since we'll end
+ // up throwing away code that is live on the stack.
+ ASSERT(!globalData->dynamicGlobalObject);
+ if (globalData->dynamicGlobalObject)
+ return;
+
+ typedef HashSet<FunctionExecutable*> FunctionExecutableSet;
+ typedef HashMap<SourceProvider*, ExecState*> SourceProviderMap;
+
+ FunctionExecutableSet functionExecutables;
+ SourceProviderMap sourceProviders;
+
+ LiveObjectIterator it = globalData->heap.primaryHeapBegin();
+ LiveObjectIterator heapEnd = globalData->heap.primaryHeapEnd();
+ for ( ; it != heapEnd; ++it) {
+ if (!(*it)->inherits(&JSFunction::info))
+ continue;
+
+ JSFunction* function = asFunction(*it);
+ if (function->executable()->isHostFunction())
+ continue;
+
+ FunctionExecutable* executable = function->jsExecutable();
+
+ // Check if the function is already in the set - if so,
+ // we've already retranslated it, nothing to do here.
+ if (!functionExecutables.add(executable).second)
+ continue;
+
+ ExecState* exec = function->scope().globalObject()->JSGlobalObject::globalExec();
+ executable->discardCode();
+ if (function->scope().globalObject()->debugger() == this)
+ sourceProviders.add(executable->source().provider(), exec);
+ }
+
+ // Call sourceParsed() after reparsing all functions because it will execute
+ // JavaScript in the inspector.
+ SourceProviderMap::const_iterator end = sourceProviders.end();
+ for (SourceProviderMap::const_iterator iter = sourceProviders.begin(); iter != end; ++iter)
+ sourceParsed(iter->second, SourceCode(iter->first), -1, UString());
+}
+
+JSValue evaluateInGlobalCallFrame(const UString& script, JSValue& exception, JSGlobalObject* globalObject)
+{
+ CallFrame* globalCallFrame = globalObject->globalExec();
+
+ RefPtr<EvalExecutable> eval = EvalExecutable::create(globalCallFrame, makeSource(script), false);
+ JSObject* error = eval->compile(globalCallFrame, globalCallFrame->scopeChain());
+ if (error)
+ return error;
+
+ JSGlobalData& globalData = globalObject->globalData();
+ JSValue result = globalData.interpreter->execute(eval.get(), globalCallFrame, globalObject, globalCallFrame->scopeChain());
+ if (globalData.exception) {
+ exception = globalData.exception;
+ globalData.exception = JSValue();
+ }
+ ASSERT(result);
+ return result;
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/debugger/Debugger.h b/Source/JavaScriptCore/debugger/Debugger.h
new file mode 100644
index 0000000..3b9bec4
--- /dev/null
+++ b/Source/JavaScriptCore/debugger/Debugger.h
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
+ * Copyright (C) 2001 Peter Kelly (pmk@post.com)
+ * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifndef Debugger_h
+#define Debugger_h
+
+#include <wtf/HashSet.h>
+
+namespace JSC {
+
+ class DebuggerCallFrame;
+ class ExecState;
+ class JSGlobalData;
+ class JSGlobalObject;
+ class JSValue;
+ class SourceCode;
+ class UString;
+
+ class Debugger {
+ public:
+ virtual ~Debugger();
+
+ void attach(JSGlobalObject*);
+ virtual void detach(JSGlobalObject*);
+
+ virtual void sourceParsed(ExecState*, const SourceCode&, int errorLineNumber, const UString& errorMessage) = 0;
+ virtual void exception(const DebuggerCallFrame&, intptr_t sourceID, int lineNumber, bool hasHandler) = 0;
+ virtual void atStatement(const DebuggerCallFrame&, intptr_t sourceID, int lineNumber) = 0;
+ virtual void callEvent(const DebuggerCallFrame&, intptr_t sourceID, int lineNumber) = 0;
+ virtual void returnEvent(const DebuggerCallFrame&, intptr_t sourceID, int lineNumber) = 0;
+
+ virtual void willExecuteProgram(const DebuggerCallFrame&, intptr_t sourceID, int lineNumber) = 0;
+ virtual void didExecuteProgram(const DebuggerCallFrame&, intptr_t sourceID, int lineNumber) = 0;
+ virtual void didReachBreakpoint(const DebuggerCallFrame&, intptr_t sourceID, int lineNumber) = 0;
+
+ void recompileAllJSFunctions(JSGlobalData*);
+
+ private:
+ HashSet<JSGlobalObject*> m_globalObjects;
+ };
+
+ // This function exists only for backwards compatibility with existing WebScriptDebugger clients.
+ JSValue evaluateInGlobalCallFrame(const UString&, JSValue& exception, JSGlobalObject*);
+
+} // namespace JSC
+
+#endif // Debugger_h
diff --git a/Source/JavaScriptCore/debugger/DebuggerActivation.cpp b/Source/JavaScriptCore/debugger/DebuggerActivation.cpp
new file mode 100644
index 0000000..0444d23
--- /dev/null
+++ b/Source/JavaScriptCore/debugger/DebuggerActivation.cpp
@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "DebuggerActivation.h"
+
+#include "JSActivation.h"
+
+namespace JSC {
+
+DebuggerActivation::DebuggerActivation(JSObject* activation)
+ : JSObject(DebuggerActivation::createStructure(jsNull()))
+{
+ ASSERT(activation);
+ ASSERT(activation->isActivationObject());
+ m_activation = static_cast<JSActivation*>(activation);
+}
+
+void DebuggerActivation::markChildren(MarkStack& markStack)
+{
+ JSObject::markChildren(markStack);
+
+ if (m_activation)
+ markStack.append(m_activation);
+}
+
+UString DebuggerActivation::className() const
+{
+ return m_activation->className();
+}
+
+bool DebuggerActivation::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
+{
+ return m_activation->getOwnPropertySlot(exec, propertyName, slot);
+}
+
+void DebuggerActivation::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
+{
+ m_activation->put(exec, propertyName, value, slot);
+}
+
+void DebuggerActivation::putWithAttributes(ExecState* exec, const Identifier& propertyName, JSValue value, unsigned attributes)
+{
+ m_activation->putWithAttributes(exec, propertyName, value, attributes);
+}
+
+bool DebuggerActivation::deleteProperty(ExecState* exec, const Identifier& propertyName)
+{
+ return m_activation->deleteProperty(exec, propertyName);
+}
+
+void DebuggerActivation::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
+{
+ m_activation->getPropertyNames(exec, propertyNames, mode);
+}
+
+bool DebuggerActivation::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
+{
+ return m_activation->getOwnPropertyDescriptor(exec, propertyName, descriptor);
+}
+
+void DebuggerActivation::defineGetter(ExecState* exec, const Identifier& propertyName, JSObject* getterFunction, unsigned attributes)
+{
+ m_activation->defineGetter(exec, propertyName, getterFunction, attributes);
+}
+
+void DebuggerActivation::defineSetter(ExecState* exec, const Identifier& propertyName, JSObject* setterFunction, unsigned attributes)
+{
+ m_activation->defineSetter(exec, propertyName, setterFunction, attributes);
+}
+
+JSValue DebuggerActivation::lookupGetter(ExecState* exec, const Identifier& propertyName)
+{
+ return m_activation->lookupGetter(exec, propertyName);
+}
+
+JSValue DebuggerActivation::lookupSetter(ExecState* exec, const Identifier& propertyName)
+{
+ return m_activation->lookupSetter(exec, propertyName);
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/debugger/DebuggerActivation.h b/Source/JavaScriptCore/debugger/DebuggerActivation.h
new file mode 100644
index 0000000..3927017
--- /dev/null
+++ b/Source/JavaScriptCore/debugger/DebuggerActivation.h
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DebuggerActivation_h
+#define DebuggerActivation_h
+
+#include "JSObject.h"
+
+namespace JSC {
+
+ class JSActivation;
+
+ class DebuggerActivation : public JSObject {
+ public:
+ DebuggerActivation(JSObject*);
+
+ virtual void markChildren(MarkStack&);
+ virtual UString className() const;
+ virtual bool getOwnPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&);
+ virtual void put(ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&);
+ virtual void putWithAttributes(ExecState*, const Identifier& propertyName, JSValue, unsigned attributes);
+ virtual bool deleteProperty(ExecState*, const Identifier& propertyName);
+ virtual void getOwnPropertyNames(ExecState*, PropertyNameArray&, EnumerationMode mode = ExcludeDontEnumProperties);
+ virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
+ virtual void defineGetter(ExecState*, const Identifier& propertyName, JSObject* getterFunction, unsigned attributes);
+ virtual void defineSetter(ExecState*, const Identifier& propertyName, JSObject* setterFunction, unsigned attributes);
+ virtual JSValue lookupGetter(ExecState*, const Identifier& propertyName);
+ virtual JSValue lookupSetter(ExecState*, const Identifier& propertyName);
+
+ static PassRefPtr<Structure> createStructure(JSValue prototype)
+ {
+ return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount);
+ }
+
+ protected:
+ static const unsigned StructureFlags = OverridesGetOwnPropertySlot | OverridesMarkChildren | JSObject::StructureFlags;
+
+ private:
+ JSActivation* m_activation;
+ };
+
+} // namespace JSC
+
+#endif // DebuggerActivation_h
diff --git a/Source/JavaScriptCore/debugger/DebuggerCallFrame.cpp b/Source/JavaScriptCore/debugger/DebuggerCallFrame.cpp
new file mode 100644
index 0000000..ed673cb
--- /dev/null
+++ b/Source/JavaScriptCore/debugger/DebuggerCallFrame.cpp
@@ -0,0 +1,106 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "DebuggerCallFrame.h"
+
+#include "JSFunction.h"
+#include "CodeBlock.h"
+#include "Interpreter.h"
+#include "Parser.h"
+
+namespace JSC {
+
+const UString* DebuggerCallFrame::functionName() const
+{
+ if (!m_callFrame->codeBlock())
+ return 0;
+
+ if (!m_callFrame->callee())
+ return 0;
+
+ JSObject* function = m_callFrame->callee();
+ if (!function || !function->inherits(&JSFunction::info))
+ return 0;
+ return &asFunction(function)->name(m_callFrame);
+}
+
+UString DebuggerCallFrame::calculatedFunctionName() const
+{
+ if (!m_callFrame->codeBlock())
+ return UString();
+
+ JSObject* function = m_callFrame->callee();
+ if (!function || !function->inherits(&JSFunction::info))
+ return UString();
+
+ return asFunction(function)->calculatedDisplayName(m_callFrame);
+}
+
+DebuggerCallFrame::Type DebuggerCallFrame::type() const
+{
+ if (m_callFrame->callee())
+ return FunctionType;
+
+ return ProgramType;
+}
+
+JSObject* DebuggerCallFrame::thisObject() const
+{
+ CodeBlock* codeBlock = m_callFrame->codeBlock();
+ if (!codeBlock)
+ return 0;
+
+ JSValue thisValue = m_callFrame->uncheckedR(codeBlock->thisRegister()).jsValue();
+ if (!thisValue.isObject())
+ return 0;
+
+ return asObject(thisValue);
+}
+
+JSValue DebuggerCallFrame::evaluate(const UString& script, JSValue& exception) const
+{
+ if (!m_callFrame->codeBlock())
+ return JSValue();
+
+ RefPtr<EvalExecutable> eval = EvalExecutable::create(m_callFrame, makeSource(script), m_callFrame->codeBlock()->isStrictMode());
+ JSObject* error = eval->compile(m_callFrame, m_callFrame->scopeChain());
+ if (error)
+ return error;
+
+ JSGlobalData& globalData = m_callFrame->globalData();
+ JSValue result = globalData.interpreter->execute(eval.get(), m_callFrame, thisObject(), m_callFrame->scopeChain());
+ if (globalData.exception) {
+ exception = globalData.exception;
+ globalData.exception = JSValue();
+ }
+ ASSERT(result);
+ return result;
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/debugger/DebuggerCallFrame.h b/Source/JavaScriptCore/debugger/DebuggerCallFrame.h
new file mode 100644
index 0000000..9d377ef
--- /dev/null
+++ b/Source/JavaScriptCore/debugger/DebuggerCallFrame.h
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DebuggerCallFrame_h
+#define DebuggerCallFrame_h
+
+#include "CallFrame.h"
+
+namespace JSC {
+
+ class DebuggerCallFrame {
+ public:
+ enum Type { ProgramType, FunctionType };
+
+ DebuggerCallFrame(CallFrame* callFrame)
+ : m_callFrame(callFrame)
+ {
+ }
+
+ DebuggerCallFrame(CallFrame* callFrame, JSValue exception)
+ : m_callFrame(callFrame)
+ , m_exception(exception)
+ {
+ }
+
+ JSGlobalObject* dynamicGlobalObject() const { return m_callFrame->dynamicGlobalObject(); }
+ const ScopeChainNode* scopeChain() const { return m_callFrame->scopeChain(); }
+ const UString* functionName() const;
+ UString calculatedFunctionName() const;
+ Type type() const;
+ JSObject* thisObject() const;
+ JSValue evaluate(const UString&, JSValue& exception) const;
+ JSValue exception() const { return m_exception; }
+
+ private:
+ CallFrame* m_callFrame;
+ JSValue m_exception;
+ };
+
+} // namespace JSC
+
+#endif // DebuggerCallFrame_h
diff --git a/Source/JavaScriptCore/docs/make-bytecode-docs.pl b/Source/JavaScriptCore/docs/make-bytecode-docs.pl
new file mode 100755
index 0000000..5a95195
--- /dev/null
+++ b/Source/JavaScriptCore/docs/make-bytecode-docs.pl
@@ -0,0 +1,43 @@
+#!/usr/bin/perl -w
+
+use strict;
+
+open MACHINE, "<" . $ARGV[0];
+open OUTPUT, ">" . $ARGV[1];
+
+my @undocumented = ();
+
+print OUTPUT "<!-- Generated from Interpreter.cpp by make-bytecode-docs.pl. -->\n";
+print OUTPUT "<style>p code \{ font-size: 14px; \}</style>\n";
+
+while (<MACHINE>) {
+ if (/^ *DEFINE_OPCODE/) {
+ chomp;
+ s/^ *DEFINE_OPCODE\(op_//;
+ s/\).*$//;
+ my $opcode = $_;
+ $_ = <MACHINE>;
+ chomp;
+ if (m|/\* |) {
+ my $format = $_;
+ $format =~ s|.* /\* ||;
+ my $doc = "";
+ while (<MACHINE>) {
+ if (m|\*/|) {
+ last;
+ }
+ $doc .= $_ . " ";
+ }
+
+ print OUTPUT "<h2><code>${opcode}</code></h2>\n<p><b>Format: </b><code>\n${format}\n</code></p>\n<p>\n${doc}\n</p>\n";
+ } else {
+ push @undocumented, $opcode;
+ }
+ }
+}
+
+close OUTPUT;
+
+for my $undoc (@undocumented) {
+ print "UNDOCUMENTED: ${undoc}\n";
+}
diff --git a/Source/JavaScriptCore/headers.pri b/Source/JavaScriptCore/headers.pri
new file mode 100644
index 0000000..3fb886b
--- /dev/null
+++ b/Source/JavaScriptCore/headers.pri
@@ -0,0 +1,9 @@
+JS_API_HEADERS += \
+ JSBase.h \
+ JSContextRef.h \
+ JSObjectRef.h \
+ JSStringRef.h \
+ JSStringRefCF.h \
+ JSStringRefBSTR.h \
+ JSValueRef.h \
+ JavaScriptCore.h
diff --git a/Source/JavaScriptCore/icu/LICENSE b/Source/JavaScriptCore/icu/LICENSE
new file mode 100644
index 0000000..385d130
--- /dev/null
+++ b/Source/JavaScriptCore/icu/LICENSE
@@ -0,0 +1,25 @@
+COPYRIGHT AND PERMISSION NOTICE
+
+Copyright (c) 1995-2006 International Business Machines Corporation and others
+
+All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this
+software and associated documentation files (the "Software"), to deal in the Software
+without restriction, including without limitation the rights to use, copy, modify,
+merge, publish, distribute, and/or sell copies of the Software, and to permit persons
+to whom the Software is furnished to do so, provided that the above copyright notice(s)
+and this permission notice appear in all copies of the Software and that both the above
+copyright notice(s) and this permission notice appear in supporting documentation.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
+INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER
+OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR
+CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+Except as contained in this notice, the name of a copyright holder shall not be used in
+advertising or otherwise to promote the sale, use or other dealings in this Software
+without prior written authorization of the copyright holder.
diff --git a/Source/JavaScriptCore/icu/README b/Source/JavaScriptCore/icu/README
new file mode 100644
index 0000000..389e2e8
--- /dev/null
+++ b/Source/JavaScriptCore/icu/README
@@ -0,0 +1,4 @@
+The headers in this directory are for compiling on Mac OS X 10.4.
+The Mac OS X 10.4 release includes the ICU binary, but not ICU headers.
+For other platforms, installed ICU headers should be used rather than these.
+They are specific to Mac OS X 10.4.
diff --git a/Source/JavaScriptCore/icu/unicode/parseerr.h b/Source/JavaScriptCore/icu/unicode/parseerr.h
new file mode 100644
index 0000000..d1ba394
--- /dev/null
+++ b/Source/JavaScriptCore/icu/unicode/parseerr.h
@@ -0,0 +1,88 @@
+/*
+**********************************************************************
+* Copyright (C) 1999-2004, International Business Machines
+* Corporation and others. All Rights Reserved.
+**********************************************************************
+* Date Name Description
+* 03/14/00 aliu Creation.
+* 06/27/00 aliu Change from C++ class to C struct
+**********************************************************************
+*/
+#ifndef PARSEERR_H
+#define PARSEERR_H
+
+#include "unicode/utypes.h"
+
+
+/**
+ * The capacity of the context strings in UParseError.
+ * @stable ICU 2.0
+ */
+enum { U_PARSE_CONTEXT_LEN = 16 };
+
+/**
+ * A UParseError struct is used to returned detailed information about
+ * parsing errors. It is used by ICU parsing engines that parse long
+ * rules, patterns, or programs, where the text being parsed is long
+ * enough that more information than a UErrorCode is needed to
+ * localize the error.
+ *
+ * <p>The line, offset, and context fields are optional; parsing
+ * engines may choose not to use to use them.
+ *
+ * <p>The preContext and postContext strings include some part of the
+ * context surrounding the error. If the source text is "let for=7"
+ * and "for" is the error (e.g., because it is a reserved word), then
+ * some examples of what a parser might produce are the following:
+ *
+ * <pre>
+ * preContext postContext
+ * "" "" The parser does not support context
+ * "let " "=7" Pre- and post-context only
+ * "let " "for=7" Pre- and post-context and error text
+ * "" "for" Error text only
+ * </pre>
+ *
+ * <p>Examples of engines which use UParseError (or may use it in the
+ * future) are Transliterator, RuleBasedBreakIterator, and
+ * RegexPattern.
+ *
+ * @stable ICU 2.0
+ */
+typedef struct UParseError {
+
+ /**
+ * The line on which the error occured. If the parser uses this
+ * field, it sets it to the line number of the source text line on
+ * which the error appears, which will be be a value >= 1. If the
+ * parse does not support line numbers, the value will be <= 0.
+ * @stable ICU 2.0
+ */
+ int32_t line;
+
+ /**
+ * The character offset to the error. If the line field is >= 1,
+ * then this is the offset from the start of the line. Otherwise,
+ * this is the offset from the start of the text. If the parser
+ * does not support this field, it will have a value < 0.
+ * @stable ICU 2.0
+ */
+ int32_t offset;
+
+ /**
+ * Textual context before the error. Null-terminated. The empty
+ * string if not supported by parser.
+ * @stable ICU 2.0
+ */
+ UChar preContext[U_PARSE_CONTEXT_LEN];
+
+ /**
+ * The error itself and/or textual context after the error.
+ * Null-terminated. The empty string if not supported by parser.
+ * @stable ICU 2.0
+ */
+ UChar postContext[U_PARSE_CONTEXT_LEN];
+
+} UParseError;
+
+#endif
diff --git a/Source/JavaScriptCore/icu/unicode/platform.h b/Source/JavaScriptCore/icu/unicode/platform.h
new file mode 100644
index 0000000..9595a26
--- /dev/null
+++ b/Source/JavaScriptCore/icu/unicode/platform.h
@@ -0,0 +1,267 @@
+/*
+******************************************************************************
+*
+* Copyright (C) 1997-2004, International Business Machines
+* Corporation and others. All Rights Reserved.
+*
+******************************************************************************
+*
+* FILE NAME : platform.h
+*
+* Date Name Description
+* 05/13/98 nos Creation (content moved here from ptypes.h).
+* 03/02/99 stephen Added AS400 support.
+* 03/30/99 stephen Added Linux support.
+* 04/13/99 stephen Reworked for autoconf.
+******************************************************************************
+*/
+
+/* Define the platform we're on. */
+#ifndef U_DARWIN
+#define U_DARWIN
+#endif
+
+/* Define whether inttypes.h is available */
+#ifndef U_HAVE_INTTYPES_H
+#define U_HAVE_INTTYPES_H 1
+#endif
+
+/*
+ * Define what support for C++ streams is available.
+ * If U_IOSTREAM_SOURCE is set to 199711, then <iostream> is available
+ * (1997711 is the date the ISO/IEC C++ FDIS was published), and then
+ * one should qualify streams using the std namespace in ICU header
+ * files.
+ * If U_IOSTREAM_SOURCE is set to 198506, then <iostream.h> is
+ * available instead (198506 is the date when Stroustrup published
+ * "An Extensible I/O Facility for C++" at the summer USENIX conference).
+ * If U_IOSTREAM_SOURCE is 0, then C++ streams are not available and
+ * support for them will be silently suppressed in ICU.
+ *
+ */
+
+#ifndef U_IOSTREAM_SOURCE
+#define U_IOSTREAM_SOURCE 199711
+#endif
+
+/* Determines whether specific types are available */
+#ifndef U_HAVE_INT8_T
+#define U_HAVE_INT8_T 1
+#endif
+
+#ifndef U_HAVE_UINT8_T
+#define U_HAVE_UINT8_T 0
+#endif
+
+#ifndef U_HAVE_INT16_T
+#define U_HAVE_INT16_T 1
+#endif
+
+#ifndef U_HAVE_UINT16_T
+#define U_HAVE_UINT16_T 0
+#endif
+
+#ifndef U_HAVE_INT32_T
+#define U_HAVE_INT32_T 1
+#endif
+
+#ifndef U_HAVE_UINT32_T
+#define U_HAVE_UINT32_T 0
+#endif
+
+#ifndef U_HAVE_INT64_T
+#define U_HAVE_INT64_T 1
+#endif
+
+#ifndef U_HAVE_UINT64_T
+#define U_HAVE_UINT64_T 0
+#endif
+
+/*===========================================================================*/
+/* Generic data types */
+/*===========================================================================*/
+
+#include <sys/types.h>
+
+/* If your platform does not have the <inttypes.h> header, you may
+ need to edit the typedefs below. */
+#if U_HAVE_INTTYPES_H
+
+/* autoconf 2.13 sometimes can't properly find the data types in <inttypes.h> */
+/* os/390 needs <inttypes.h>, but it doesn't have int8_t, and it sometimes */
+/* doesn't have uint8_t depending on the OS version. */
+/* So we have this work around. */
+#ifdef OS390
+/* The features header is needed to get (u)int64_t sometimes. */
+#include <features.h>
+#if ! U_HAVE_INT8_T
+typedef signed char int8_t;
+#endif
+#if !defined(__uint8_t)
+#define __uint8_t 1
+typedef unsigned char uint8_t;
+#endif
+#endif /* OS390 */
+
+#include <inttypes.h>
+
+#else /* U_HAVE_INTTYPES_H */
+
+#if ! U_HAVE_INT8_T
+typedef signed char int8_t;
+#endif
+
+#if ! U_HAVE_UINT8_T
+typedef unsigned char uint8_t;
+#endif
+
+#if ! U_HAVE_INT16_T
+typedef signed short int16_t;
+#endif
+
+#if ! U_HAVE_UINT16_T
+typedef unsigned short uint16_t;
+#endif
+
+#if ! U_HAVE_INT32_T
+typedef signed int int32_t;
+#endif
+
+#if ! U_HAVE_UINT32_T
+typedef unsigned int uint32_t;
+#endif
+
+#if ! U_HAVE_INT64_T
+ typedef signed long long int64_t;
+/* else we may not have a 64-bit type */
+#endif
+
+#if ! U_HAVE_UINT64_T
+ typedef unsigned long long uint64_t;
+/* else we may not have a 64-bit type */
+#endif
+
+#endif
+
+/*===========================================================================*/
+/* Compiler and environment features */
+/*===========================================================================*/
+
+/* Define whether namespace is supported */
+#ifndef U_HAVE_NAMESPACE
+#define U_HAVE_NAMESPACE 1
+#endif
+
+/* Determines the endianness of the platform
+ It's done this way in case multiple architectures are being built at once.
+ For example, Darwin supports fat binaries, which can be both PPC and x86 based. */
+#if defined(BYTE_ORDER) && defined(BIG_ENDIAN)
+#define U_IS_BIG_ENDIAN (BYTE_ORDER == BIG_ENDIAN)
+#else
+#define U_IS_BIG_ENDIAN 1
+#endif
+
+/* 1 or 0 to enable or disable threads. If undefined, default is: enable threads. */
+#define ICU_USE_THREADS 1
+
+#ifndef U_DEBUG
+#define U_DEBUG 0
+#endif
+
+#ifndef U_RELEASE
+#define U_RELEASE 1
+#endif
+
+/* Determine whether to disable renaming or not. This overrides the
+ setting in umachine.h which is for all platforms. */
+#ifndef U_DISABLE_RENAMING
+#define U_DISABLE_RENAMING 1
+#endif
+
+/* Determine whether to override new and delete. */
+#ifndef U_OVERRIDE_CXX_ALLOCATION
+#define U_OVERRIDE_CXX_ALLOCATION 1
+#endif
+/* Determine whether to override placement new and delete for STL. */
+#ifndef U_HAVE_PLACEMENT_NEW
+#define U_HAVE_PLACEMENT_NEW 1
+#endif
+
+/* Determine whether to enable tracing. */
+#ifndef U_ENABLE_TRACING
+#define U_ENABLE_TRACING 1
+#endif
+
+/* Define the library suffix in a C syntax. */
+#define U_HAVE_LIB_SUFFIX 0
+#define U_LIB_SUFFIX_C_NAME
+#define U_LIB_SUFFIX_C_NAME_STRING ""
+
+/*===========================================================================*/
+/* Character data types */
+/*===========================================================================*/
+
+#if defined(OS390) || defined(OS400)
+# define U_CHARSET_FAMILY 1
+#endif
+
+/*===========================================================================*/
+/* Information about wchar support */
+/*===========================================================================*/
+
+#define U_HAVE_WCHAR_H 1
+#define U_SIZEOF_WCHAR_T 4
+
+#define U_HAVE_WCSCPY 1
+
+/*===========================================================================*/
+/* Information about POSIX support */
+/*===========================================================================*/
+
+#define U_HAVE_NL_LANGINFO 1
+#define U_HAVE_NL_LANGINFO_CODESET 1
+#define U_NL_LANGINFO_CODESET CODESET
+
+#if 1
+#define U_TZSET tzset
+#endif
+#if 0
+#define U_TIMEZONE
+#endif
+#if 1
+#define U_TZNAME tzname
+#endif
+
+#define U_HAVE_MMAP 1
+#define U_HAVE_POPEN 1
+
+/*===========================================================================*/
+/* Symbol import-export control */
+/*===========================================================================*/
+
+#define U_EXPORT
+/* U_CALLCONV is releated to U_EXPORT2 */
+#define U_EXPORT2
+
+/* cygwin needs to export/import data */
+#ifdef U_CYGWIN
+#define U_IMPORT __declspec(dllimport)
+#else
+#define U_IMPORT
+#endif
+
+/*===========================================================================*/
+/* Code alignment and C function inlining */
+/*===========================================================================*/
+
+#ifndef U_INLINE
+#define U_INLINE inline
+#endif
+
+#define U_ALIGN_CODE(n)
+
+/*===========================================================================*/
+/* Programs used by ICU code */
+/*===========================================================================*/
+
+#define U_MAKE "/usr/bin/gnumake"
diff --git a/Source/JavaScriptCore/icu/unicode/putil.h b/Source/JavaScriptCore/icu/unicode/putil.h
new file mode 100644
index 0000000..685df53
--- /dev/null
+++ b/Source/JavaScriptCore/icu/unicode/putil.h
@@ -0,0 +1,180 @@
+/*
+******************************************************************************
+*
+* Copyright (C) 1997-2004, International Business Machines
+* Corporation and others. All Rights Reserved.
+*
+******************************************************************************
+*
+* FILE NAME : putil.h
+*
+* Date Name Description
+* 05/14/98 nos Creation (content moved here from utypes.h).
+* 06/17/99 erm Added IEEE_754
+* 07/22/98 stephen Added IEEEremainder, max, min, trunc
+* 08/13/98 stephen Added isNegativeInfinity, isPositiveInfinity
+* 08/24/98 stephen Added longBitsFromDouble
+* 03/02/99 stephen Removed openFile(). Added AS400 support.
+* 04/15/99 stephen Converted to C
+* 11/15/99 helena Integrated S/390 changes for IEEE support.
+* 01/11/00 helena Added u_getVersion.
+******************************************************************************
+*/
+
+#ifndef PUTIL_H
+#define PUTIL_H
+
+#include "unicode/utypes.h"
+
+/* Define this to 1 if your platform supports IEEE 754 floating point,
+ to 0 if it does not. */
+#ifndef IEEE_754
+# define IEEE_754 1
+#endif
+
+/*==========================================================================*/
+/* Platform utilities */
+/*==========================================================================*/
+
+/**
+ * Platform utilities isolates the platform dependencies of the
+ * libarary. For each platform which this code is ported to, these
+ * functions may have to be re-implemented.
+ */
+
+/**
+ * Return the ICU data directory.
+ * The data directory is where common format ICU data files (.dat files)
+ * are loaded from. Note that normal use of the built-in ICU
+ * facilities does not require loading of an external data file;
+ * unless you are adding custom data to ICU, the data directory
+ * does not need to be set.
+ *
+ * The data directory is determined as follows:
+ * If u_setDataDirectory() has been called, that is it, otherwise
+ * if the ICU_DATA environment variable is set, use that, otherwise
+ * If a data directory was specifed at ICU build time
+ * (#define ICU_DATA_DIR "path"), use that,
+ * otherwise no data directory is available.
+ *
+ * @return the data directory, or an empty string ("") if no data directory has
+ * been specified.
+ *
+ * @stable ICU 2.0
+ */
+U_STABLE const char* U_EXPORT2 u_getDataDirectory(void);
+
+/**
+ * Set the ICU data directory.
+ * The data directory is where common format ICU data files (.dat files)
+ * are loaded from. Note that normal use of the built-in ICU
+ * facilities does not require loading of an external data file;
+ * unless you are adding custom data to ICU, the data directory
+ * does not need to be set.
+ *
+ * This function should be called at most once in a process, before the
+ * first ICU operation (e.g., u_init()) that will require the loading of an
+ * ICU data file.
+ * This function is not thread-safe. Use it before calling ICU APIs from
+ * multiple threads.
+ *
+ * @param directory The directory to be set.
+ *
+ * @see u_init
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2 u_setDataDirectory(const char *directory);
+
+/**
+ * Please use ucnv_getDefaultName() instead.
+ * Return the default codepage for this platform and locale.
+ * This function can call setlocale() on Unix platforms. Please read the
+ * platform documentation on setlocale() before calling this function.
+ * @return the default codepage for this platform
+ * @internal
+ */
+U_INTERNAL const char* U_EXPORT2 uprv_getDefaultCodepage(void);
+
+/**
+ * Please use uloc_getDefault() instead.
+ * Return the default locale ID string by querying ths system, or
+ * zero if one cannot be found.
+ * This function can call setlocale() on Unix platforms. Please read the
+ * platform documentation on setlocale() before calling this function.
+ * @return the default locale ID string
+ * @internal
+ */
+U_INTERNAL const char* U_EXPORT2 uprv_getDefaultLocaleID(void);
+
+/**
+ * Filesystem file and path separator characters.
+ * Example: '/' and ':' on Unix, '\\' and ';' on Windows.
+ * @stable ICU 2.0
+ */
+#ifdef XP_MAC
+# define U_FILE_SEP_CHAR ':'
+# define U_FILE_ALT_SEP_CHAR ':'
+# define U_PATH_SEP_CHAR ';'
+# define U_FILE_SEP_STRING ":"
+# define U_FILE_ALT_SEP_STRING ":"
+# define U_PATH_SEP_STRING ";"
+#elif defined(WIN32) || defined(OS2)
+# define U_FILE_SEP_CHAR '\\'
+# define U_FILE_ALT_SEP_CHAR '/'
+# define U_PATH_SEP_CHAR ';'
+# define U_FILE_SEP_STRING "\\"
+# define U_FILE_ALT_SEP_STRING "/"
+# define U_PATH_SEP_STRING ";"
+#else
+# define U_FILE_SEP_CHAR '/'
+# define U_FILE_ALT_SEP_CHAR '/'
+# define U_PATH_SEP_CHAR ':'
+# define U_FILE_SEP_STRING "/"
+# define U_FILE_ALT_SEP_STRING "/"
+# define U_PATH_SEP_STRING ":"
+#endif
+
+/**
+ * Convert char characters to UChar characters.
+ * This utility function is useful only for "invariant characters"
+ * that are encoded in the platform default encoding.
+ * They are a small, constant subset of the encoding and include
+ * just the latin letters, digits, and some punctuation.
+ * For details, see U_CHARSET_FAMILY.
+ *
+ * @param cs Input string, points to <code>length</code>
+ * character bytes from a subset of the platform encoding.
+ * @param us Output string, points to memory for <code>length</code>
+ * Unicode characters.
+ * @param length The number of characters to convert; this may
+ * include the terminating <code>NUL</code>.
+ *
+ * @see U_CHARSET_FAMILY
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+u_charsToUChars(const char *cs, UChar *us, int32_t length);
+
+/**
+ * Convert UChar characters to char characters.
+ * This utility function is useful only for "invariant characters"
+ * that can be encoded in the platform default encoding.
+ * They are a small, constant subset of the encoding and include
+ * just the latin letters, digits, and some punctuation.
+ * For details, see U_CHARSET_FAMILY.
+ *
+ * @param us Input string, points to <code>length</code>
+ * Unicode characters that can be encoded with the
+ * codepage-invariant subset of the platform encoding.
+ * @param cs Output string, points to memory for <code>length</code>
+ * character bytes.
+ * @param length The number of characters to convert; this may
+ * include the terminating <code>NUL</code>.
+ *
+ * @see U_CHARSET_FAMILY
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+u_UCharsToChars(const UChar *us, char *cs, int32_t length);
+
+#endif
diff --git a/Source/JavaScriptCore/icu/unicode/uchar.h b/Source/JavaScriptCore/icu/unicode/uchar.h
new file mode 100644
index 0000000..7fd490c
--- /dev/null
+++ b/Source/JavaScriptCore/icu/unicode/uchar.h
@@ -0,0 +1,2798 @@
+/*
+**********************************************************************
+* Copyright (C) 1997-2004, International Business Machines
+* Corporation and others. All Rights Reserved.
+**********************************************************************
+*
+* File UCHAR.H
+*
+* Modification History:
+*
+* Date Name Description
+* 04/02/97 aliu Creation.
+* 03/29/99 helena Updated for C APIs.
+* 4/15/99 Madhu Updated for C Implementation and Javadoc
+* 5/20/99 Madhu Added the function u_getVersion()
+* 8/19/1999 srl Upgraded scripts to Unicode 3.0
+* 8/27/1999 schererm UCharDirection constants: U_...
+* 11/11/1999 weiv added u_isalnum(), cleaned comments
+* 01/11/2000 helena Renamed u_getVersion to u_getUnicodeVersion().
+******************************************************************************
+*/
+
+#ifndef UCHAR_H
+#define UCHAR_H
+
+#include "unicode/utypes.h"
+
+U_CDECL_BEGIN
+
+/*==========================================================================*/
+/* Unicode version number */
+/*==========================================================================*/
+/**
+ * Unicode version number, default for the current ICU version.
+ * The actual Unicode Character Database (UCD) data is stored in uprops.dat
+ * and may be generated from UCD files from a different Unicode version.
+ * Call u_getUnicodeVersion to get the actual Unicode version of the data.
+ *
+ * @see u_getUnicodeVersion
+ * @stable ICU 2.0
+ */
+#define U_UNICODE_VERSION "4.0.1"
+
+/**
+ * \file
+ * \brief C API: Unicode Properties
+ *
+ * This C API provides low-level access to the Unicode Character Database.
+ * In addition to raw property values, some convenience functions calculate
+ * derived properties, for example for Java-style programming.
+ *
+ * Unicode assigns each code point (not just assigned character) values for
+ * many properties.
+ * Most of them are simple boolean flags, or constants from a small enumerated list.
+ * For some properties, values are strings or other relatively more complex types.
+ *
+ * For more information see
+ * "About the Unicode Character Database" (http://www.unicode.org/ucd/)
+ * and the ICU User Guide chapter on Properties (http://oss.software.ibm.com/icu/userguide/properties.html).
+ *
+ * Many functions are designed to match java.lang.Character functions.
+ * See the individual function documentation,
+ * and see the JDK 1.4.1 java.lang.Character documentation
+ * at http://java.sun.com/j2se/1.4.1/docs/api/java/lang/Character.html
+ *
+ * There are also functions that provide easy migration from C/POSIX functions
+ * like isblank(). Their use is generally discouraged because the C/POSIX
+ * standards do not define their semantics beyond the ASCII range, which means
+ * that different implementations exhibit very different behavior.
+ * Instead, Unicode properties should be used directly.
+ *
+ * There are also only a few, broad C/POSIX character classes, and they tend
+ * to be used for conflicting purposes. For example, the "isalpha()" class
+ * is sometimes used to determine word boundaries, while a more sophisticated
+ * approach would at least distinguish initial letters from continuation
+ * characters (the latter including combining marks).
+ * (In ICU, BreakIterator is the most sophisticated API for word boundaries.)
+ * Another example: There is no "istitle()" class for titlecase characters.
+ *
+ * A summary of the behavior of some C/POSIX character classification implementations
+ * for Unicode is available at http://oss.software.ibm.com/cvs/icu/~checkout~/icuhtml/design/posix_classes.html
+ *
+ * <strong>Important</strong>:
+ * The behavior of the ICU C/POSIX-style character classification
+ * functions is subject to change according to discussion of the above summary.
+ *
+ * Note: There are several ICU whitespace functions.
+ * Comparison:
+ * - u_isUWhiteSpace=UCHAR_WHITE_SPACE: Unicode White_Space property;
+ * most of general categories "Z" (separators) + most whitespace ISO controls
+ * (including no-break spaces, but excluding IS1..IS4 and ZWSP)
+ * - u_isWhitespace: Java isWhitespace; Z + whitespace ISO controls but excluding no-break spaces
+ * - u_isJavaSpaceChar: Java isSpaceChar; just Z (including no-break spaces)
+ * - u_isspace: Z + whitespace ISO controls (including no-break spaces)
+ * - u_isblank: "horizontal spaces" = TAB + Zs - ZWSP
+ */
+
+/**
+ * Constants.
+ */
+
+/** The lowest Unicode code point value. Code points are non-negative. @stable ICU 2.0 */
+#define UCHAR_MIN_VALUE 0
+
+/**
+ * The highest Unicode code point value (scalar value) according to
+ * The Unicode Standard. This is a 21-bit value (20.1 bits, rounded up).
+ * For a single character, UChar32 is a simple type that can hold any code point value.
+ *
+ * @see UChar32
+ * @stable ICU 2.0
+ */
+#define UCHAR_MAX_VALUE 0x10ffff
+
+/**
+ * Get a single-bit bit set (a flag) from a bit number 0..31.
+ * @stable ICU 2.1
+ */
+#define U_MASK(x) ((uint32_t)1<<(x))
+
+/*
+ * !! Note: Several comments in this file are machine-read by the
+ * genpname tool. These comments describe the correspondence between
+ * icu enum constants and UCD entities. Do not delete them. Update
+ * these comments as needed.
+ *
+ * Any comment of the form "/ *[name]* /" (spaces added) is such
+ * a comment.
+ *
+ * The U_JG_* and U_GC_*_MASK constants are matched by their symbolic
+ * name, which must match PropertyValueAliases.txt.
+ */
+
+/**
+ * Selection constants for Unicode properties.
+ * These constants are used in functions like u_hasBinaryProperty to select
+ * one of the Unicode properties.
+ *
+ * The properties APIs are intended to reflect Unicode properties as defined
+ * in the Unicode Character Database (UCD) and Unicode Technical Reports (UTR).
+ * For details about the properties see http://www.unicode.org/ucd/ .
+ * For names of Unicode properties see the UCD file PropertyAliases.txt.
+ *
+ * Important: If ICU is built with UCD files from Unicode versions below, e.g., 3.2,
+ * then properties marked with "new in Unicode 3.2" are not or not fully available.
+ * Check u_getUnicodeVersion to be sure.
+ *
+ * @see u_hasBinaryProperty
+ * @see u_getIntPropertyValue
+ * @see u_getUnicodeVersion
+ * @stable ICU 2.1
+ */
+typedef enum UProperty {
+ /* See note !!. Comments of the form "Binary property Dash",
+ "Enumerated property Script", "Double property Numeric_Value",
+ and "String property Age" are read by genpname. */
+
+ /* Note: Place UCHAR_ALPHABETIC before UCHAR_BINARY_START so that
+ debuggers display UCHAR_ALPHABETIC as the symbolic name for 0,
+ rather than UCHAR_BINARY_START. Likewise for other *_START
+ identifiers. */
+
+ /** Binary property Alphabetic. Same as u_isUAlphabetic, different from u_isalpha.
+ Lu+Ll+Lt+Lm+Lo+Nl+Other_Alphabetic @stable ICU 2.1 */
+ UCHAR_ALPHABETIC=0,
+ /** First constant for binary Unicode properties. @stable ICU 2.1 */
+ UCHAR_BINARY_START=UCHAR_ALPHABETIC,
+ /** Binary property ASCII_Hex_Digit. 0-9 A-F a-f @stable ICU 2.1 */
+ UCHAR_ASCII_HEX_DIGIT,
+ /** Binary property Bidi_Control.
+ Format controls which have specific functions
+ in the Bidi Algorithm. @stable ICU 2.1 */
+ UCHAR_BIDI_CONTROL,
+ /** Binary property Bidi_Mirrored.
+ Characters that may change display in RTL text.
+ Same as u_isMirrored.
+ See Bidi Algorithm, UTR 9. @stable ICU 2.1 */
+ UCHAR_BIDI_MIRRORED,
+ /** Binary property Dash. Variations of dashes. @stable ICU 2.1 */
+ UCHAR_DASH,
+ /** Binary property Default_Ignorable_Code_Point (new in Unicode 3.2).
+ Ignorable in most processing.
+ <2060..206F, FFF0..FFFB, E0000..E0FFF>+Other_Default_Ignorable_Code_Point+(Cf+Cc+Cs-White_Space) @stable ICU 2.1 */
+ UCHAR_DEFAULT_IGNORABLE_CODE_POINT,
+ /** Binary property Deprecated (new in Unicode 3.2).
+ The usage of deprecated characters is strongly discouraged. @stable ICU 2.1 */
+ UCHAR_DEPRECATED,
+ /** Binary property Diacritic. Characters that linguistically modify
+ the meaning of another character to which they apply. @stable ICU 2.1 */
+ UCHAR_DIACRITIC,
+ /** Binary property Extender.
+ Extend the value or shape of a preceding alphabetic character,
+ e.g., length and iteration marks. @stable ICU 2.1 */
+ UCHAR_EXTENDER,
+ /** Binary property Full_Composition_Exclusion.
+ CompositionExclusions.txt+Singleton Decompositions+
+ Non-Starter Decompositions. @stable ICU 2.1 */
+ UCHAR_FULL_COMPOSITION_EXCLUSION,
+ /** Binary property Grapheme_Base (new in Unicode 3.2).
+ For programmatic determination of grapheme cluster boundaries.
+ [0..10FFFF]-Cc-Cf-Cs-Co-Cn-Zl-Zp-Grapheme_Link-Grapheme_Extend-CGJ @stable ICU 2.1 */
+ UCHAR_GRAPHEME_BASE,
+ /** Binary property Grapheme_Extend (new in Unicode 3.2).
+ For programmatic determination of grapheme cluster boundaries.
+ Me+Mn+Mc+Other_Grapheme_Extend-Grapheme_Link-CGJ @stable ICU 2.1 */
+ UCHAR_GRAPHEME_EXTEND,
+ /** Binary property Grapheme_Link (new in Unicode 3.2).
+ For programmatic determination of grapheme cluster boundaries. @stable ICU 2.1 */
+ UCHAR_GRAPHEME_LINK,
+ /** Binary property Hex_Digit.
+ Characters commonly used for hexadecimal numbers. @stable ICU 2.1 */
+ UCHAR_HEX_DIGIT,
+ /** Binary property Hyphen. Dashes used to mark connections
+ between pieces of words, plus the Katakana middle dot. @stable ICU 2.1 */
+ UCHAR_HYPHEN,
+ /** Binary property ID_Continue.
+ Characters that can continue an identifier.
+ DerivedCoreProperties.txt also says "NOTE: Cf characters should be filtered out."
+ ID_Start+Mn+Mc+Nd+Pc @stable ICU 2.1 */
+ UCHAR_ID_CONTINUE,
+ /** Binary property ID_Start.
+ Characters that can start an identifier.
+ Lu+Ll+Lt+Lm+Lo+Nl @stable ICU 2.1 */
+ UCHAR_ID_START,
+ /** Binary property Ideographic.
+ CJKV ideographs. @stable ICU 2.1 */
+ UCHAR_IDEOGRAPHIC,
+ /** Binary property IDS_Binary_Operator (new in Unicode 3.2).
+ For programmatic determination of
+ Ideographic Description Sequences. @stable ICU 2.1 */
+ UCHAR_IDS_BINARY_OPERATOR,
+ /** Binary property IDS_Trinary_Operator (new in Unicode 3.2).
+ For programmatic determination of
+ Ideographic Description Sequences. @stable ICU 2.1 */
+ UCHAR_IDS_TRINARY_OPERATOR,
+ /** Binary property Join_Control.
+ Format controls for cursive joining and ligation. @stable ICU 2.1 */
+ UCHAR_JOIN_CONTROL,
+ /** Binary property Logical_Order_Exception (new in Unicode 3.2).
+ Characters that do not use logical order and
+ require special handling in most processing. @stable ICU 2.1 */
+ UCHAR_LOGICAL_ORDER_EXCEPTION,
+ /** Binary property Lowercase. Same as u_isULowercase, different from u_islower.
+ Ll+Other_Lowercase @stable ICU 2.1 */
+ UCHAR_LOWERCASE,
+ /** Binary property Math. Sm+Other_Math @stable ICU 2.1 */
+ UCHAR_MATH,
+ /** Binary property Noncharacter_Code_Point.
+ Code points that are explicitly defined as illegal
+ for the encoding of characters. @stable ICU 2.1 */
+ UCHAR_NONCHARACTER_CODE_POINT,
+ /** Binary property Quotation_Mark. @stable ICU 2.1 */
+ UCHAR_QUOTATION_MARK,
+ /** Binary property Radical (new in Unicode 3.2).
+ For programmatic determination of
+ Ideographic Description Sequences. @stable ICU 2.1 */
+ UCHAR_RADICAL,
+ /** Binary property Soft_Dotted (new in Unicode 3.2).
+ Characters with a "soft dot", like i or j.
+ An accent placed on these characters causes
+ the dot to disappear. @stable ICU 2.1 */
+ UCHAR_SOFT_DOTTED,
+ /** Binary property Terminal_Punctuation.
+ Punctuation characters that generally mark
+ the end of textual units. @stable ICU 2.1 */
+ UCHAR_TERMINAL_PUNCTUATION,
+ /** Binary property Unified_Ideograph (new in Unicode 3.2).
+ For programmatic determination of
+ Ideographic Description Sequences. @stable ICU 2.1 */
+ UCHAR_UNIFIED_IDEOGRAPH,
+ /** Binary property Uppercase. Same as u_isUUppercase, different from u_isupper.
+ Lu+Other_Uppercase @stable ICU 2.1 */
+ UCHAR_UPPERCASE,
+ /** Binary property White_Space.
+ Same as u_isUWhiteSpace, different from u_isspace and u_isWhitespace.
+ Space characters+TAB+CR+LF-ZWSP-ZWNBSP @stable ICU 2.1 */
+ UCHAR_WHITE_SPACE,
+ /** Binary property XID_Continue.
+ ID_Continue modified to allow closure under
+ normalization forms NFKC and NFKD. @stable ICU 2.1 */
+ UCHAR_XID_CONTINUE,
+ /** Binary property XID_Start. ID_Start modified to allow
+ closure under normalization forms NFKC and NFKD. @stable ICU 2.1 */
+ UCHAR_XID_START,
+ /** Binary property Case_Sensitive. Either the source of a case
+ mapping or _in_ the target of a case mapping. Not the same as
+ the general category Cased_Letter. @stable ICU 2.6 */
+ UCHAR_CASE_SENSITIVE,
+ /** Binary property STerm (new in Unicode 4.0.1).
+ Sentence Terminal. Used in UAX #29: Text Boundaries
+ (http://www.unicode.org/reports/tr29/)
+ @draft ICU 3.0 */
+ UCHAR_S_TERM,
+ /** Binary property Variation_Selector (new in Unicode 4.0.1).
+ Indicates all those characters that qualify as Variation Selectors.
+ For details on the behavior of these characters,
+ see StandardizedVariants.html and 15.6 Variation Selectors.
+ @draft ICU 3.0 */
+ UCHAR_VARIATION_SELECTOR,
+ /** Binary property NFD_Inert.
+ ICU-specific property for characters that are inert under NFD,
+ i.e., they do not interact with adjacent characters.
+ Used for example in normalizing transforms in incremental mode
+ to find the boundary of safely normalizable text despite possible
+ text additions.
+
+ There is one such property per normalization form.
+ These properties are computed as follows - an inert character is:
+ a) unassigned, or ALL of the following:
+ b) of combining class 0.
+ c) not decomposed by this normalization form.
+ AND if NFC or NFKC,
+ d) can never compose with a previous character.
+ e) can never compose with a following character.
+ f) can never change if another character is added.
+ Example: a-breve might satisfy all but f, but if you
+ add an ogonek it changes to a-ogonek + breve
+
+ See also com.ibm.text.UCD.NFSkippable in the ICU4J repository,
+ and icu/source/common/unormimp.h .
+ @draft ICU 3.0 */
+ UCHAR_NFD_INERT,
+ /** Binary property NFKD_Inert.
+ ICU-specific property for characters that are inert under NFKD,
+ i.e., they do not interact with adjacent characters.
+ Used for example in normalizing transforms in incremental mode
+ to find the boundary of safely normalizable text despite possible
+ text additions.
+ @see UCHAR_NFD_INERT
+ @draft ICU 3.0 */
+ UCHAR_NFKD_INERT,
+ /** Binary property NFC_Inert.
+ ICU-specific property for characters that are inert under NFC,
+ i.e., they do not interact with adjacent characters.
+ Used for example in normalizing transforms in incremental mode
+ to find the boundary of safely normalizable text despite possible
+ text additions.
+ @see UCHAR_NFD_INERT
+ @draft ICU 3.0 */
+ UCHAR_NFC_INERT,
+ /** Binary property NFKC_Inert.
+ ICU-specific property for characters that are inert under NFKC,
+ i.e., they do not interact with adjacent characters.
+ Used for example in normalizing transforms in incremental mode
+ to find the boundary of safely normalizable text despite possible
+ text additions.
+ @see UCHAR_NFD_INERT
+ @draft ICU 3.0 */
+ UCHAR_NFKC_INERT,
+ /** Binary Property Segment_Starter.
+ ICU-specific property for characters that are starters in terms of
+ Unicode normalization and combining character sequences.
+ They have ccc=0 and do not occur in non-initial position of the
+ canonical decomposition of any character
+ (like " in NFD(a-umlaut) and a Jamo T in an NFD(Hangul LVT)).
+ ICU uses this property for segmenting a string for generating a set of
+ canonically equivalent strings, e.g. for canonical closure while
+ processing collation tailoring rules.
+ @draft ICU 3.0 */
+ UCHAR_SEGMENT_STARTER,
+ /** One more than the last constant for binary Unicode properties. @stable ICU 2.1 */
+ UCHAR_BINARY_LIMIT,
+
+ /** Enumerated property Bidi_Class.
+ Same as u_charDirection, returns UCharDirection values. @stable ICU 2.2 */
+ UCHAR_BIDI_CLASS=0x1000,
+ /** First constant for enumerated/integer Unicode properties. @stable ICU 2.2 */
+ UCHAR_INT_START=UCHAR_BIDI_CLASS,
+ /** Enumerated property Block.
+ Same as ublock_getCode, returns UBlockCode values. @stable ICU 2.2 */
+ UCHAR_BLOCK,
+ /** Enumerated property Canonical_Combining_Class.
+ Same as u_getCombiningClass, returns 8-bit numeric values. @stable ICU 2.2 */
+ UCHAR_CANONICAL_COMBINING_CLASS,
+ /** Enumerated property Decomposition_Type.
+ Returns UDecompositionType values. @stable ICU 2.2 */
+ UCHAR_DECOMPOSITION_TYPE,
+ /** Enumerated property East_Asian_Width.
+ See http://www.unicode.org/reports/tr11/
+ Returns UEastAsianWidth values. @stable ICU 2.2 */
+ UCHAR_EAST_ASIAN_WIDTH,
+ /** Enumerated property General_Category.
+ Same as u_charType, returns UCharCategory values. @stable ICU 2.2 */
+ UCHAR_GENERAL_CATEGORY,
+ /** Enumerated property Joining_Group.
+ Returns UJoiningGroup values. @stable ICU 2.2 */
+ UCHAR_JOINING_GROUP,
+ /** Enumerated property Joining_Type.
+ Returns UJoiningType values. @stable ICU 2.2 */
+ UCHAR_JOINING_TYPE,
+ /** Enumerated property Line_Break.
+ Returns ULineBreak values. @stable ICU 2.2 */
+ UCHAR_LINE_BREAK,
+ /** Enumerated property Numeric_Type.
+ Returns UNumericType values. @stable ICU 2.2 */
+ UCHAR_NUMERIC_TYPE,
+ /** Enumerated property Script.
+ Same as uscript_getScript, returns UScriptCode values. @stable ICU 2.2 */
+ UCHAR_SCRIPT,
+ /** Enumerated property Hangul_Syllable_Type, new in Unicode 4.
+ Returns UHangulSyllableType values. @stable ICU 2.6 */
+ UCHAR_HANGUL_SYLLABLE_TYPE,
+ /** Enumerated property NFD_Quick_Check.
+ Returns UNormalizationCheckResult values. @draft ICU 3.0 */
+ UCHAR_NFD_QUICK_CHECK,
+ /** Enumerated property NFKD_Quick_Check.
+ Returns UNormalizationCheckResult values. @draft ICU 3.0 */
+ UCHAR_NFKD_QUICK_CHECK,
+ /** Enumerated property NFC_Quick_Check.
+ Returns UNormalizationCheckResult values. @draft ICU 3.0 */
+ UCHAR_NFC_QUICK_CHECK,
+ /** Enumerated property NFKC_Quick_Check.
+ Returns UNormalizationCheckResult values. @draft ICU 3.0 */
+ UCHAR_NFKC_QUICK_CHECK,
+ /** Enumerated property Lead_Canonical_Combining_Class.
+ ICU-specific property for the ccc of the first code point
+ of the decomposition, or lccc(c)=ccc(NFD(c)[0]).
+ Useful for checking for canonically ordered text;
+ see UNORM_FCD and http://www.unicode.org/notes/tn5/#FCD .
+ Returns 8-bit numeric values like UCHAR_CANONICAL_COMBINING_CLASS. @draft ICU 3.0 */
+ UCHAR_LEAD_CANONICAL_COMBINING_CLASS,
+ /** Enumerated property Trail_Canonical_Combining_Class.
+ ICU-specific property for the ccc of the last code point
+ of the decomposition, or tccc(c)=ccc(NFD(c)[last]).
+ Useful for checking for canonically ordered text;
+ see UNORM_FCD and http://www.unicode.org/notes/tn5/#FCD .
+ Returns 8-bit numeric values like UCHAR_CANONICAL_COMBINING_CLASS. @draft ICU 3.0 */
+ UCHAR_TRAIL_CANONICAL_COMBINING_CLASS,
+ /** One more than the last constant for enumerated/integer Unicode properties. @stable ICU 2.2 */
+ UCHAR_INT_LIMIT,
+
+ /** Bitmask property General_Category_Mask.
+ This is the General_Category property returned as a bit mask.
+ When used in u_getIntPropertyValue(c), same as U_MASK(u_charType(c)),
+ returns bit masks for UCharCategory values where exactly one bit is set.
+ When used with u_getPropertyValueName() and u_getPropertyValueEnum(),
+ a multi-bit mask is used for sets of categories like "Letters".
+ Mask values should be cast to uint32_t.
+ @stable ICU 2.4 */
+ UCHAR_GENERAL_CATEGORY_MASK=0x2000,
+ /** First constant for bit-mask Unicode properties. @stable ICU 2.4 */
+ UCHAR_MASK_START=UCHAR_GENERAL_CATEGORY_MASK,
+ /** One more than the last constant for bit-mask Unicode properties. @stable ICU 2.4 */
+ UCHAR_MASK_LIMIT,
+
+ /** Double property Numeric_Value.
+ Corresponds to u_getNumericValue. @stable ICU 2.4 */
+ UCHAR_NUMERIC_VALUE=0x3000,
+ /** First constant for double Unicode properties. @stable ICU 2.4 */
+ UCHAR_DOUBLE_START=UCHAR_NUMERIC_VALUE,
+ /** One more than the last constant for double Unicode properties. @stable ICU 2.4 */
+ UCHAR_DOUBLE_LIMIT,
+
+ /** String property Age.
+ Corresponds to u_charAge. @stable ICU 2.4 */
+ UCHAR_AGE=0x4000,
+ /** First constant for string Unicode properties. @stable ICU 2.4 */
+ UCHAR_STRING_START=UCHAR_AGE,
+ /** String property Bidi_Mirroring_Glyph.
+ Corresponds to u_charMirror. @stable ICU 2.4 */
+ UCHAR_BIDI_MIRRORING_GLYPH,
+ /** String property Case_Folding.
+ Corresponds to u_strFoldCase in ustring.h. @stable ICU 2.4 */
+ UCHAR_CASE_FOLDING,
+ /** String property ISO_Comment.
+ Corresponds to u_getISOComment. @stable ICU 2.4 */
+ UCHAR_ISO_COMMENT,
+ /** String property Lowercase_Mapping.
+ Corresponds to u_strToLower in ustring.h. @stable ICU 2.4 */
+ UCHAR_LOWERCASE_MAPPING,
+ /** String property Name.
+ Corresponds to u_charName. @stable ICU 2.4 */
+ UCHAR_NAME,
+ /** String property Simple_Case_Folding.
+ Corresponds to u_foldCase. @stable ICU 2.4 */
+ UCHAR_SIMPLE_CASE_FOLDING,
+ /** String property Simple_Lowercase_Mapping.
+ Corresponds to u_tolower. @stable ICU 2.4 */
+ UCHAR_SIMPLE_LOWERCASE_MAPPING,
+ /** String property Simple_Titlecase_Mapping.
+ Corresponds to u_totitle. @stable ICU 2.4 */
+ UCHAR_SIMPLE_TITLECASE_MAPPING,
+ /** String property Simple_Uppercase_Mapping.
+ Corresponds to u_toupper. @stable ICU 2.4 */
+ UCHAR_SIMPLE_UPPERCASE_MAPPING,
+ /** String property Titlecase_Mapping.
+ Corresponds to u_strToTitle in ustring.h. @stable ICU 2.4 */
+ UCHAR_TITLECASE_MAPPING,
+ /** String property Unicode_1_Name.
+ Corresponds to u_charName. @stable ICU 2.4 */
+ UCHAR_UNICODE_1_NAME,
+ /** String property Uppercase_Mapping.
+ Corresponds to u_strToUpper in ustring.h. @stable ICU 2.4 */
+ UCHAR_UPPERCASE_MAPPING,
+ /** One more than the last constant for string Unicode properties. @stable ICU 2.4 */
+ UCHAR_STRING_LIMIT,
+
+ /** Represents a nonexistent or invalid property or property value. @stable ICU 2.4 */
+ UCHAR_INVALID_CODE = -1
+} UProperty;
+
+/**
+ * Data for enumerated Unicode general category types.
+ * See http://www.unicode.org/Public/UNIDATA/UnicodeData.html .
+ * @stable ICU 2.0
+ */
+typedef enum UCharCategory
+{
+ /** See note !!. Comments of the form "Cn" are read by genpname. */
+
+ /** Non-category for unassigned and non-character code points. @stable ICU 2.0 */
+ U_UNASSIGNED = 0,
+ /** Cn "Other, Not Assigned (no characters in [UnicodeData.txt] have this property)" (same as U_UNASSIGNED!) @stable ICU 2.0 */
+ U_GENERAL_OTHER_TYPES = 0,
+ /** Lu @stable ICU 2.0 */
+ U_UPPERCASE_LETTER = 1,
+ /** Ll @stable ICU 2.0 */
+ U_LOWERCASE_LETTER = 2,
+ /** Lt @stable ICU 2.0 */
+ U_TITLECASE_LETTER = 3,
+ /** Lm @stable ICU 2.0 */
+ U_MODIFIER_LETTER = 4,
+ /** Lo @stable ICU 2.0 */
+ U_OTHER_LETTER = 5,
+ /** Mn @stable ICU 2.0 */
+ U_NON_SPACING_MARK = 6,
+ /** Me @stable ICU 2.0 */
+ U_ENCLOSING_MARK = 7,
+ /** Mc @stable ICU 2.0 */
+ U_COMBINING_SPACING_MARK = 8,
+ /** Nd @stable ICU 2.0 */
+ U_DECIMAL_DIGIT_NUMBER = 9,
+ /** Nl @stable ICU 2.0 */
+ U_LETTER_NUMBER = 10,
+ /** No @stable ICU 2.0 */
+ U_OTHER_NUMBER = 11,
+ /** Zs @stable ICU 2.0 */
+ U_SPACE_SEPARATOR = 12,
+ /** Zl @stable ICU 2.0 */
+ U_LINE_SEPARATOR = 13,
+ /** Zp @stable ICU 2.0 */
+ U_PARAGRAPH_SEPARATOR = 14,
+ /** Cc @stable ICU 2.0 */
+ U_CONTROL_CHAR = 15,
+ /** Cf @stable ICU 2.0 */
+ U_FORMAT_CHAR = 16,
+ /** Co @stable ICU 2.0 */
+ U_PRIVATE_USE_CHAR = 17,
+ /** Cs @stable ICU 2.0 */
+ U_SURROGATE = 18,
+ /** Pd @stable ICU 2.0 */
+ U_DASH_PUNCTUATION = 19,
+ /** Ps @stable ICU 2.0 */
+ U_START_PUNCTUATION = 20,
+ /** Pe @stable ICU 2.0 */
+ U_END_PUNCTUATION = 21,
+ /** Pc @stable ICU 2.0 */
+ U_CONNECTOR_PUNCTUATION = 22,
+ /** Po @stable ICU 2.0 */
+ U_OTHER_PUNCTUATION = 23,
+ /** Sm @stable ICU 2.0 */
+ U_MATH_SYMBOL = 24,
+ /** Sc @stable ICU 2.0 */
+ U_CURRENCY_SYMBOL = 25,
+ /** Sk @stable ICU 2.0 */
+ U_MODIFIER_SYMBOL = 26,
+ /** So @stable ICU 2.0 */
+ U_OTHER_SYMBOL = 27,
+ /** Pi @stable ICU 2.0 */
+ U_INITIAL_PUNCTUATION = 28,
+ /** Pf @stable ICU 2.0 */
+ U_FINAL_PUNCTUATION = 29,
+ /** One higher than the last enum UCharCategory constant. @stable ICU 2.0 */
+ U_CHAR_CATEGORY_COUNT
+} UCharCategory;
+
+/**
+ * U_GC_XX_MASK constants are bit flags corresponding to Unicode
+ * general category values.
+ * For each category, the nth bit is set if the numeric value of the
+ * corresponding UCharCategory constant is n.
+ *
+ * There are also some U_GC_Y_MASK constants for groups of general categories
+ * like L for all letter categories.
+ *
+ * @see u_charType
+ * @see U_GET_GC_MASK
+ * @see UCharCategory
+ * @stable ICU 2.1
+ */
+#define U_GC_CN_MASK U_MASK(U_GENERAL_OTHER_TYPES)
+
+/** Mask constant for a UCharCategory. @stable ICU 2.1 */
+#define U_GC_LU_MASK U_MASK(U_UPPERCASE_LETTER)
+/** Mask constant for a UCharCategory. @stable ICU 2.1 */
+#define U_GC_LL_MASK U_MASK(U_LOWERCASE_LETTER)
+/** Mask constant for a UCharCategory. @stable ICU 2.1 */
+#define U_GC_LT_MASK U_MASK(U_TITLECASE_LETTER)
+/** Mask constant for a UCharCategory. @stable ICU 2.1 */
+#define U_GC_LM_MASK U_MASK(U_MODIFIER_LETTER)
+/** Mask constant for a UCharCategory. @stable ICU 2.1 */
+#define U_GC_LO_MASK U_MASK(U_OTHER_LETTER)
+
+/** Mask constant for a UCharCategory. @stable ICU 2.1 */
+#define U_GC_MN_MASK U_MASK(U_NON_SPACING_MARK)
+/** Mask constant for a UCharCategory. @stable ICU 2.1 */
+#define U_GC_ME_MASK U_MASK(U_ENCLOSING_MARK)
+/** Mask constant for a UCharCategory. @stable ICU 2.1 */
+#define U_GC_MC_MASK U_MASK(U_COMBINING_SPACING_MARK)
+
+/** Mask constant for a UCharCategory. @stable ICU 2.1 */
+#define U_GC_ND_MASK U_MASK(U_DECIMAL_DIGIT_NUMBER)
+/** Mask constant for a UCharCategory. @stable ICU 2.1 */
+#define U_GC_NL_MASK U_MASK(U_LETTER_NUMBER)
+/** Mask constant for a UCharCategory. @stable ICU 2.1 */
+#define U_GC_NO_MASK U_MASK(U_OTHER_NUMBER)
+
+/** Mask constant for a UCharCategory. @stable ICU 2.1 */
+#define U_GC_ZS_MASK U_MASK(U_SPACE_SEPARATOR)
+/** Mask constant for a UCharCategory. @stable ICU 2.1 */
+#define U_GC_ZL_MASK U_MASK(U_LINE_SEPARATOR)
+/** Mask constant for a UCharCategory. @stable ICU 2.1 */
+#define U_GC_ZP_MASK U_MASK(U_PARAGRAPH_SEPARATOR)
+
+/** Mask constant for a UCharCategory. @stable ICU 2.1 */
+#define U_GC_CC_MASK U_MASK(U_CONTROL_CHAR)
+/** Mask constant for a UCharCategory. @stable ICU 2.1 */
+#define U_GC_CF_MASK U_MASK(U_FORMAT_CHAR)
+/** Mask constant for a UCharCategory. @stable ICU 2.1 */
+#define U_GC_CO_MASK U_MASK(U_PRIVATE_USE_CHAR)
+/** Mask constant for a UCharCategory. @stable ICU 2.1 */
+#define U_GC_CS_MASK U_MASK(U_SURROGATE)
+
+/** Mask constant for a UCharCategory. @stable ICU 2.1 */
+#define U_GC_PD_MASK U_MASK(U_DASH_PUNCTUATION)
+/** Mask constant for a UCharCategory. @stable ICU 2.1 */
+#define U_GC_PS_MASK U_MASK(U_START_PUNCTUATION)
+/** Mask constant for a UCharCategory. @stable ICU 2.1 */
+#define U_GC_PE_MASK U_MASK(U_END_PUNCTUATION)
+/** Mask constant for a UCharCategory. @stable ICU 2.1 */
+#define U_GC_PC_MASK U_MASK(U_CONNECTOR_PUNCTUATION)
+/** Mask constant for a UCharCategory. @stable ICU 2.1 */
+#define U_GC_PO_MASK U_MASK(U_OTHER_PUNCTUATION)
+
+/** Mask constant for a UCharCategory. @stable ICU 2.1 */
+#define U_GC_SM_MASK U_MASK(U_MATH_SYMBOL)
+/** Mask constant for a UCharCategory. @stable ICU 2.1 */
+#define U_GC_SC_MASK U_MASK(U_CURRENCY_SYMBOL)
+/** Mask constant for a UCharCategory. @stable ICU 2.1 */
+#define U_GC_SK_MASK U_MASK(U_MODIFIER_SYMBOL)
+/** Mask constant for a UCharCategory. @stable ICU 2.1 */
+#define U_GC_SO_MASK U_MASK(U_OTHER_SYMBOL)
+
+/** Mask constant for a UCharCategory. @stable ICU 2.1 */
+#define U_GC_PI_MASK U_MASK(U_INITIAL_PUNCTUATION)
+/** Mask constant for a UCharCategory. @stable ICU 2.1 */
+#define U_GC_PF_MASK U_MASK(U_FINAL_PUNCTUATION)
+
+
+/** Mask constant for multiple UCharCategory bits (L Letters). @stable ICU 2.1 */
+#define U_GC_L_MASK \
+ (U_GC_LU_MASK|U_GC_LL_MASK|U_GC_LT_MASK|U_GC_LM_MASK|U_GC_LO_MASK)
+
+/** Mask constant for multiple UCharCategory bits (LC Cased Letters). @stable ICU 2.1 */
+#define U_GC_LC_MASK \
+ (U_GC_LU_MASK|U_GC_LL_MASK|U_GC_LT_MASK)
+
+/** Mask constant for multiple UCharCategory bits (M Marks). @stable ICU 2.1 */
+#define U_GC_M_MASK (U_GC_MN_MASK|U_GC_ME_MASK|U_GC_MC_MASK)
+
+/** Mask constant for multiple UCharCategory bits (N Numbers). @stable ICU 2.1 */
+#define U_GC_N_MASK (U_GC_ND_MASK|U_GC_NL_MASK|U_GC_NO_MASK)
+
+/** Mask constant for multiple UCharCategory bits (Z Separators). @stable ICU 2.1 */
+#define U_GC_Z_MASK (U_GC_ZS_MASK|U_GC_ZL_MASK|U_GC_ZP_MASK)
+
+/** Mask constant for multiple UCharCategory bits (C Others). @stable ICU 2.1 */
+#define U_GC_C_MASK \
+ (U_GC_CN_MASK|U_GC_CC_MASK|U_GC_CF_MASK|U_GC_CO_MASK|U_GC_CS_MASK)
+
+/** Mask constant for multiple UCharCategory bits (P Punctuation). @stable ICU 2.1 */
+#define U_GC_P_MASK \
+ (U_GC_PD_MASK|U_GC_PS_MASK|U_GC_PE_MASK|U_GC_PC_MASK|U_GC_PO_MASK| \
+ U_GC_PI_MASK|U_GC_PF_MASK)
+
+/** Mask constant for multiple UCharCategory bits (S Symbols). @stable ICU 2.1 */
+#define U_GC_S_MASK (U_GC_SM_MASK|U_GC_SC_MASK|U_GC_SK_MASK|U_GC_SO_MASK)
+
+/**
+ * This specifies the language directional property of a character set.
+ * @stable ICU 2.0
+ */
+typedef enum UCharDirection {
+ /** See note !!. Comments of the form "EN" are read by genpname. */
+
+ /** L @stable ICU 2.0 */
+ U_LEFT_TO_RIGHT = 0,
+ /** R @stable ICU 2.0 */
+ U_RIGHT_TO_LEFT = 1,
+ /** EN @stable ICU 2.0 */
+ U_EUROPEAN_NUMBER = 2,
+ /** ES @stable ICU 2.0 */
+ U_EUROPEAN_NUMBER_SEPARATOR = 3,
+ /** ET @stable ICU 2.0 */
+ U_EUROPEAN_NUMBER_TERMINATOR = 4,
+ /** AN @stable ICU 2.0 */
+ U_ARABIC_NUMBER = 5,
+ /** CS @stable ICU 2.0 */
+ U_COMMON_NUMBER_SEPARATOR = 6,
+ /** B @stable ICU 2.0 */
+ U_BLOCK_SEPARATOR = 7,
+ /** S @stable ICU 2.0 */
+ U_SEGMENT_SEPARATOR = 8,
+ /** WS @stable ICU 2.0 */
+ U_WHITE_SPACE_NEUTRAL = 9,
+ /** ON @stable ICU 2.0 */
+ U_OTHER_NEUTRAL = 10,
+ /** LRE @stable ICU 2.0 */
+ U_LEFT_TO_RIGHT_EMBEDDING = 11,
+ /** LRO @stable ICU 2.0 */
+ U_LEFT_TO_RIGHT_OVERRIDE = 12,
+ /** AL @stable ICU 2.0 */
+ U_RIGHT_TO_LEFT_ARABIC = 13,
+ /** RLE @stable ICU 2.0 */
+ U_RIGHT_TO_LEFT_EMBEDDING = 14,
+ /** RLO @stable ICU 2.0 */
+ U_RIGHT_TO_LEFT_OVERRIDE = 15,
+ /** PDF @stable ICU 2.0 */
+ U_POP_DIRECTIONAL_FORMAT = 16,
+ /** NSM @stable ICU 2.0 */
+ U_DIR_NON_SPACING_MARK = 17,
+ /** BN @stable ICU 2.0 */
+ U_BOUNDARY_NEUTRAL = 18,
+ /** @stable ICU 2.0 */
+ U_CHAR_DIRECTION_COUNT
+} UCharDirection;
+
+/**
+ * Constants for Unicode blocks, see the Unicode Data file Blocks.txt
+ * @stable ICU 2.0
+ */
+enum UBlockCode {
+
+ /** New No_Block value in Unicode 4. @stable ICU 2.6 */
+ UBLOCK_NO_BLOCK = 0, /*[none]*/ /* Special range indicating No_Block */
+
+ /** @stable ICU 2.0 */
+ UBLOCK_BASIC_LATIN = 1, /*[0000]*/ /*See note !!*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_LATIN_1_SUPPLEMENT=2, /*[0080]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_LATIN_EXTENDED_A =3, /*[0100]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_LATIN_EXTENDED_B =4, /*[0180]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_IPA_EXTENSIONS =5, /*[0250]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_SPACING_MODIFIER_LETTERS =6, /*[02B0]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_COMBINING_DIACRITICAL_MARKS =7, /*[0300]*/
+
+ /**
+ * Unicode 3.2 renames this block to "Greek and Coptic".
+ * @stable ICU 2.0
+ */
+ UBLOCK_GREEK =8, /*[0370]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_CYRILLIC =9, /*[0400]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_ARMENIAN =10, /*[0530]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_HEBREW =11, /*[0590]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_ARABIC =12, /*[0600]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_SYRIAC =13, /*[0700]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_THAANA =14, /*[0780]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_DEVANAGARI =15, /*[0900]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_BENGALI =16, /*[0980]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_GURMUKHI =17, /*[0A00]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_GUJARATI =18, /*[0A80]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_ORIYA =19, /*[0B00]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_TAMIL =20, /*[0B80]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_TELUGU =21, /*[0C00]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_KANNADA =22, /*[0C80]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_MALAYALAM =23, /*[0D00]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_SINHALA =24, /*[0D80]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_THAI =25, /*[0E00]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_LAO =26, /*[0E80]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_TIBETAN =27, /*[0F00]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_MYANMAR =28, /*[1000]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_GEORGIAN =29, /*[10A0]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_HANGUL_JAMO =30, /*[1100]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_ETHIOPIC =31, /*[1200]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_CHEROKEE =32, /*[13A0]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS =33, /*[1400]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_OGHAM =34, /*[1680]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_RUNIC =35, /*[16A0]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_KHMER =36, /*[1780]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_MONGOLIAN =37, /*[1800]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_LATIN_EXTENDED_ADDITIONAL =38, /*[1E00]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_GREEK_EXTENDED =39, /*[1F00]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_GENERAL_PUNCTUATION =40, /*[2000]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_SUPERSCRIPTS_AND_SUBSCRIPTS =41, /*[2070]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_CURRENCY_SYMBOLS =42, /*[20A0]*/
+
+ /**
+ * Unicode 3.2 renames this block to "Combining Diacritical Marks for Symbols".
+ * @stable ICU 2.0
+ */
+ UBLOCK_COMBINING_MARKS_FOR_SYMBOLS =43, /*[20D0]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_LETTERLIKE_SYMBOLS =44, /*[2100]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_NUMBER_FORMS =45, /*[2150]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_ARROWS =46, /*[2190]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_MATHEMATICAL_OPERATORS =47, /*[2200]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_MISCELLANEOUS_TECHNICAL =48, /*[2300]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_CONTROL_PICTURES =49, /*[2400]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_OPTICAL_CHARACTER_RECOGNITION =50, /*[2440]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_ENCLOSED_ALPHANUMERICS =51, /*[2460]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_BOX_DRAWING =52, /*[2500]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_BLOCK_ELEMENTS =53, /*[2580]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_GEOMETRIC_SHAPES =54, /*[25A0]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_MISCELLANEOUS_SYMBOLS =55, /*[2600]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_DINGBATS =56, /*[2700]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_BRAILLE_PATTERNS =57, /*[2800]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_CJK_RADICALS_SUPPLEMENT =58, /*[2E80]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_KANGXI_RADICALS =59, /*[2F00]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_IDEOGRAPHIC_DESCRIPTION_CHARACTERS =60, /*[2FF0]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_CJK_SYMBOLS_AND_PUNCTUATION =61, /*[3000]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_HIRAGANA =62, /*[3040]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_KATAKANA =63, /*[30A0]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_BOPOMOFO =64, /*[3100]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_HANGUL_COMPATIBILITY_JAMO =65, /*[3130]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_KANBUN =66, /*[3190]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_BOPOMOFO_EXTENDED =67, /*[31A0]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_ENCLOSED_CJK_LETTERS_AND_MONTHS =68, /*[3200]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_CJK_COMPATIBILITY =69, /*[3300]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A =70, /*[3400]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_CJK_UNIFIED_IDEOGRAPHS =71, /*[4E00]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_YI_SYLLABLES =72, /*[A000]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_YI_RADICALS =73, /*[A490]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_HANGUL_SYLLABLES =74, /*[AC00]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_HIGH_SURROGATES =75, /*[D800]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_HIGH_PRIVATE_USE_SURROGATES =76, /*[DB80]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_LOW_SURROGATES =77, /*[DC00]*/
+
+ /**
+ * Same as UBLOCK_PRIVATE_USE_AREA.
+ * Until Unicode 3.1.1, the corresponding block name was "Private Use",
+ * and multiple code point ranges had this block.
+ * Unicode 3.2 renames the block for the BMP PUA to "Private Use Area" and
+ * adds separate blocks for the supplementary PUAs.
+ *
+ * @stable ICU 2.0
+ */
+ UBLOCK_PRIVATE_USE = 78,
+ /**
+ * Same as UBLOCK_PRIVATE_USE.
+ * Until Unicode 3.1.1, the corresponding block name was "Private Use",
+ * and multiple code point ranges had this block.
+ * Unicode 3.2 renames the block for the BMP PUA to "Private Use Area" and
+ * adds separate blocks for the supplementary PUAs.
+ *
+ * @stable ICU 2.0
+ */
+ UBLOCK_PRIVATE_USE_AREA =UBLOCK_PRIVATE_USE, /*[E000]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_CJK_COMPATIBILITY_IDEOGRAPHS =79, /*[F900]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_ALPHABETIC_PRESENTATION_FORMS =80, /*[FB00]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_ARABIC_PRESENTATION_FORMS_A =81, /*[FB50]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_COMBINING_HALF_MARKS =82, /*[FE20]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_CJK_COMPATIBILITY_FORMS =83, /*[FE30]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_SMALL_FORM_VARIANTS =84, /*[FE50]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_ARABIC_PRESENTATION_FORMS_B =85, /*[FE70]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_SPECIALS =86, /*[FFF0]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_HALFWIDTH_AND_FULLWIDTH_FORMS =87, /*[FF00]*/
+
+ /* New blocks in Unicode 3.1 */
+
+ /** @stable ICU 2.0 */
+ UBLOCK_OLD_ITALIC = 88 , /*[10300]*/
+ /** @stable ICU 2.0 */
+ UBLOCK_GOTHIC = 89 , /*[10330]*/
+ /** @stable ICU 2.0 */
+ UBLOCK_DESERET = 90 , /*[10400]*/
+ /** @stable ICU 2.0 */
+ UBLOCK_BYZANTINE_MUSICAL_SYMBOLS = 91 , /*[1D000]*/
+ /** @stable ICU 2.0 */
+ UBLOCK_MUSICAL_SYMBOLS = 92 , /*[1D100]*/
+ /** @stable ICU 2.0 */
+ UBLOCK_MATHEMATICAL_ALPHANUMERIC_SYMBOLS = 93 , /*[1D400]*/
+ /** @stable ICU 2.0 */
+ UBLOCK_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_B = 94 , /*[20000]*/
+ /** @stable ICU 2.0 */
+ UBLOCK_CJK_COMPATIBILITY_IDEOGRAPHS_SUPPLEMENT = 95 , /*[2F800]*/
+ /** @stable ICU 2.0 */
+ UBLOCK_TAGS = 96, /*[E0000]*/
+
+ /* New blocks in Unicode 3.2 */
+
+ /**
+ * Unicode 4.0.1 renames the "Cyrillic Supplementary" block to "Cyrillic Supplement".
+ * @stable ICU 2.2
+ */
+ UBLOCK_CYRILLIC_SUPPLEMENTARY = 97,
+ /** @draft ICU 3.0 */
+ UBLOCK_CYRILLIC_SUPPLEMENT = UBLOCK_CYRILLIC_SUPPLEMENTARY, /*[0500]*/
+ /** @stable ICU 2.2 */
+ UBLOCK_TAGALOG = 98, /*[1700]*/
+ /** @stable ICU 2.2 */
+ UBLOCK_HANUNOO = 99, /*[1720]*/
+ /** @stable ICU 2.2 */
+ UBLOCK_BUHID = 100, /*[1740]*/
+ /** @stable ICU 2.2 */
+ UBLOCK_TAGBANWA = 101, /*[1760]*/
+ /** @stable ICU 2.2 */
+ UBLOCK_MISCELLANEOUS_MATHEMATICAL_SYMBOLS_A = 102, /*[27C0]*/
+ /** @stable ICU 2.2 */
+ UBLOCK_SUPPLEMENTAL_ARROWS_A = 103, /*[27F0]*/
+ /** @stable ICU 2.2 */
+ UBLOCK_SUPPLEMENTAL_ARROWS_B = 104, /*[2900]*/
+ /** @stable ICU 2.2 */
+ UBLOCK_MISCELLANEOUS_MATHEMATICAL_SYMBOLS_B = 105, /*[2980]*/
+ /** @stable ICU 2.2 */
+ UBLOCK_SUPPLEMENTAL_MATHEMATICAL_OPERATORS = 106, /*[2A00]*/
+ /** @stable ICU 2.2 */
+ UBLOCK_KATAKANA_PHONETIC_EXTENSIONS = 107, /*[31F0]*/
+ /** @stable ICU 2.2 */
+ UBLOCK_VARIATION_SELECTORS = 108, /*[FE00]*/
+ /** @stable ICU 2.2 */
+ UBLOCK_SUPPLEMENTARY_PRIVATE_USE_AREA_A = 109, /*[F0000]*/
+ /** @stable ICU 2.2 */
+ UBLOCK_SUPPLEMENTARY_PRIVATE_USE_AREA_B = 110, /*[100000]*/
+
+ /* New blocks in Unicode 4 */
+
+ /** @stable ICU 2.6 */
+ UBLOCK_LIMBU = 111, /*[1900]*/
+ /** @stable ICU 2.6 */
+ UBLOCK_TAI_LE = 112, /*[1950]*/
+ /** @stable ICU 2.6 */
+ UBLOCK_KHMER_SYMBOLS = 113, /*[19E0]*/
+ /** @stable ICU 2.6 */
+ UBLOCK_PHONETIC_EXTENSIONS = 114, /*[1D00]*/
+ /** @stable ICU 2.6 */
+ UBLOCK_MISCELLANEOUS_SYMBOLS_AND_ARROWS = 115, /*[2B00]*/
+ /** @stable ICU 2.6 */
+ UBLOCK_YIJING_HEXAGRAM_SYMBOLS = 116, /*[4DC0]*/
+ /** @stable ICU 2.6 */
+ UBLOCK_LINEAR_B_SYLLABARY = 117, /*[10000]*/
+ /** @stable ICU 2.6 */
+ UBLOCK_LINEAR_B_IDEOGRAMS = 118, /*[10080]*/
+ /** @stable ICU 2.6 */
+ UBLOCK_AEGEAN_NUMBERS = 119, /*[10100]*/
+ /** @stable ICU 2.6 */
+ UBLOCK_UGARITIC = 120, /*[10380]*/
+ /** @stable ICU 2.6 */
+ UBLOCK_SHAVIAN = 121, /*[10450]*/
+ /** @stable ICU 2.6 */
+ UBLOCK_OSMANYA = 122, /*[10480]*/
+ /** @stable ICU 2.6 */
+ UBLOCK_CYPRIOT_SYLLABARY = 123, /*[10800]*/
+ /** @stable ICU 2.6 */
+ UBLOCK_TAI_XUAN_JING_SYMBOLS = 124, /*[1D300]*/
+ /** @stable ICU 2.6 */
+ UBLOCK_VARIATION_SELECTORS_SUPPLEMENT = 125, /*[E0100]*/
+
+ /** @stable ICU 2.0 */
+ UBLOCK_COUNT,
+
+ /** @stable ICU 2.0 */
+ UBLOCK_INVALID_CODE=-1
+};
+
+/** @stable ICU 2.0 */
+typedef enum UBlockCode UBlockCode;
+
+/**
+ * East Asian Width constants.
+ *
+ * @see UCHAR_EAST_ASIAN_WIDTH
+ * @see u_getIntPropertyValue
+ * @stable ICU 2.2
+ */
+typedef enum UEastAsianWidth {
+ U_EA_NEUTRAL, /*[N]*/ /*See note !!*/
+ U_EA_AMBIGUOUS, /*[A]*/
+ U_EA_HALFWIDTH, /*[H]*/
+ U_EA_FULLWIDTH, /*[F]*/
+ U_EA_NARROW, /*[Na]*/
+ U_EA_WIDE, /*[W]*/
+ U_EA_COUNT
+} UEastAsianWidth;
+/*
+ * Implementation note:
+ * Keep UEastAsianWidth constant values in sync with names list in genprops/props2.c.
+ */
+
+/**
+ * Selector constants for u_charName().
+ * u_charName() returns the "modern" name of a
+ * Unicode character; or the name that was defined in
+ * Unicode version 1.0, before the Unicode standard merged
+ * with ISO-10646; or an "extended" name that gives each
+ * Unicode code point a unique name.
+ *
+ * @see u_charName
+ * @stable ICU 2.0
+ */
+typedef enum UCharNameChoice {
+ U_UNICODE_CHAR_NAME,
+ U_UNICODE_10_CHAR_NAME,
+ U_EXTENDED_CHAR_NAME,
+ U_CHAR_NAME_CHOICE_COUNT
+} UCharNameChoice;
+
+/**
+ * Selector constants for u_getPropertyName() and
+ * u_getPropertyValueName(). These selectors are used to choose which
+ * name is returned for a given property or value. All properties and
+ * values have a long name. Most have a short name, but some do not.
+ * Unicode allows for additional names, beyond the long and short
+ * name, which would be indicated by U_LONG_PROPERTY_NAME + i, where
+ * i=1, 2,...
+ *
+ * @see u_getPropertyName()
+ * @see u_getPropertyValueName()
+ * @stable ICU 2.4
+ */
+typedef enum UPropertyNameChoice {
+ U_SHORT_PROPERTY_NAME,
+ U_LONG_PROPERTY_NAME,
+ U_PROPERTY_NAME_CHOICE_COUNT
+} UPropertyNameChoice;
+
+/**
+ * Decomposition Type constants.
+ *
+ * @see UCHAR_DECOMPOSITION_TYPE
+ * @stable ICU 2.2
+ */
+typedef enum UDecompositionType {
+ U_DT_NONE, /*[none]*/ /*See note !!*/
+ U_DT_CANONICAL, /*[can]*/
+ U_DT_COMPAT, /*[com]*/
+ U_DT_CIRCLE, /*[enc]*/
+ U_DT_FINAL, /*[fin]*/
+ U_DT_FONT, /*[font]*/
+ U_DT_FRACTION, /*[fra]*/
+ U_DT_INITIAL, /*[init]*/
+ U_DT_ISOLATED, /*[iso]*/
+ U_DT_MEDIAL, /*[med]*/
+ U_DT_NARROW, /*[nar]*/
+ U_DT_NOBREAK, /*[nb]*/
+ U_DT_SMALL, /*[sml]*/
+ U_DT_SQUARE, /*[sqr]*/
+ U_DT_SUB, /*[sub]*/
+ U_DT_SUPER, /*[sup]*/
+ U_DT_VERTICAL, /*[vert]*/
+ U_DT_WIDE, /*[wide]*/
+ U_DT_COUNT /* 18 */
+} UDecompositionType;
+
+/**
+ * Joining Type constants.
+ *
+ * @see UCHAR_JOINING_TYPE
+ * @stable ICU 2.2
+ */
+typedef enum UJoiningType {
+ U_JT_NON_JOINING, /*[U]*/ /*See note !!*/
+ U_JT_JOIN_CAUSING, /*[C]*/
+ U_JT_DUAL_JOINING, /*[D]*/
+ U_JT_LEFT_JOINING, /*[L]*/
+ U_JT_RIGHT_JOINING, /*[R]*/
+ U_JT_TRANSPARENT, /*[T]*/
+ U_JT_COUNT /* 6 */
+} UJoiningType;
+
+/**
+ * Joining Group constants.
+ *
+ * @see UCHAR_JOINING_GROUP
+ * @stable ICU 2.2
+ */
+typedef enum UJoiningGroup {
+ U_JG_NO_JOINING_GROUP,
+ U_JG_AIN,
+ U_JG_ALAPH,
+ U_JG_ALEF,
+ U_JG_BEH,
+ U_JG_BETH,
+ U_JG_DAL,
+ U_JG_DALATH_RISH,
+ U_JG_E,
+ U_JG_FEH,
+ U_JG_FINAL_SEMKATH,
+ U_JG_GAF,
+ U_JG_GAMAL,
+ U_JG_HAH,
+ U_JG_HAMZA_ON_HEH_GOAL,
+ U_JG_HE,
+ U_JG_HEH,
+ U_JG_HEH_GOAL,
+ U_JG_HETH,
+ U_JG_KAF,
+ U_JG_KAPH,
+ U_JG_KNOTTED_HEH,
+ U_JG_LAM,
+ U_JG_LAMADH,
+ U_JG_MEEM,
+ U_JG_MIM,
+ U_JG_NOON,
+ U_JG_NUN,
+ U_JG_PE,
+ U_JG_QAF,
+ U_JG_QAPH,
+ U_JG_REH,
+ U_JG_REVERSED_PE,
+ U_JG_SAD,
+ U_JG_SADHE,
+ U_JG_SEEN,
+ U_JG_SEMKATH,
+ U_JG_SHIN,
+ U_JG_SWASH_KAF,
+ U_JG_SYRIAC_WAW,
+ U_JG_TAH,
+ U_JG_TAW,
+ U_JG_TEH_MARBUTA,
+ U_JG_TETH,
+ U_JG_WAW,
+ U_JG_YEH,
+ U_JG_YEH_BARREE,
+ U_JG_YEH_WITH_TAIL,
+ U_JG_YUDH,
+ U_JG_YUDH_HE,
+ U_JG_ZAIN,
+ U_JG_FE, /**< @stable ICU 2.6 */
+ U_JG_KHAPH, /**< @stable ICU 2.6 */
+ U_JG_ZHAIN, /**< @stable ICU 2.6 */
+ U_JG_COUNT
+} UJoiningGroup;
+
+/**
+ * Line Break constants.
+ *
+ * @see UCHAR_LINE_BREAK
+ * @stable ICU 2.2
+ */
+typedef enum ULineBreak {
+ U_LB_UNKNOWN, /*[XX]*/ /*See note !!*/
+ U_LB_AMBIGUOUS, /*[AI]*/
+ U_LB_ALPHABETIC, /*[AL]*/
+ U_LB_BREAK_BOTH, /*[B2]*/
+ U_LB_BREAK_AFTER, /*[BA]*/
+ U_LB_BREAK_BEFORE, /*[BB]*/
+ U_LB_MANDATORY_BREAK, /*[BK]*/
+ U_LB_CONTINGENT_BREAK, /*[CB]*/
+ U_LB_CLOSE_PUNCTUATION, /*[CL]*/
+ U_LB_COMBINING_MARK, /*[CM]*/
+ U_LB_CARRIAGE_RETURN, /*[CR]*/
+ U_LB_EXCLAMATION, /*[EX]*/
+ U_LB_GLUE, /*[GL]*/
+ U_LB_HYPHEN, /*[HY]*/
+ U_LB_IDEOGRAPHIC, /*[ID]*/
+ U_LB_INSEPERABLE,
+ /** Renamed from the misspelled "inseperable" in Unicode 4.0.1/ICU 3.0 @draft ICU 3.0 */
+ U_LB_INSEPARABLE=U_LB_INSEPERABLE,/*[IN]*/
+ U_LB_INFIX_NUMERIC, /*[IS]*/
+ U_LB_LINE_FEED, /*[LF]*/
+ U_LB_NONSTARTER, /*[NS]*/
+ U_LB_NUMERIC, /*[NU]*/
+ U_LB_OPEN_PUNCTUATION, /*[OP]*/
+ U_LB_POSTFIX_NUMERIC, /*[PO]*/
+ U_LB_PREFIX_NUMERIC, /*[PR]*/
+ U_LB_QUOTATION, /*[QU]*/
+ U_LB_COMPLEX_CONTEXT, /*[SA]*/
+ U_LB_SURROGATE, /*[SG]*/
+ U_LB_SPACE, /*[SP]*/
+ U_LB_BREAK_SYMBOLS, /*[SY]*/
+ U_LB_ZWSPACE, /*[ZW]*/
+ U_LB_NEXT_LINE, /*[NL]*/ /* from here on: new in Unicode 4/ICU 2.6 */
+ U_LB_WORD_JOINER, /*[WJ]*/
+ U_LB_COUNT
+} ULineBreak;
+
+/**
+ * Numeric Type constants.
+ *
+ * @see UCHAR_NUMERIC_TYPE
+ * @stable ICU 2.2
+ */
+typedef enum UNumericType {
+ U_NT_NONE, /*[None]*/ /*See note !!*/
+ U_NT_DECIMAL, /*[de]*/
+ U_NT_DIGIT, /*[di]*/
+ U_NT_NUMERIC, /*[nu]*/
+ U_NT_COUNT
+} UNumericType;
+
+/**
+ * Hangul Syllable Type constants.
+ *
+ * @see UCHAR_HANGUL_SYLLABLE_TYPE
+ * @stable ICU 2.6
+ */
+typedef enum UHangulSyllableType {
+ U_HST_NOT_APPLICABLE, /*[NA]*/ /*See note !!*/
+ U_HST_LEADING_JAMO, /*[L]*/
+ U_HST_VOWEL_JAMO, /*[V]*/
+ U_HST_TRAILING_JAMO, /*[T]*/
+ U_HST_LV_SYLLABLE, /*[LV]*/
+ U_HST_LVT_SYLLABLE, /*[LVT]*/
+ U_HST_COUNT
+} UHangulSyllableType;
+
+/**
+ * Check a binary Unicode property for a code point.
+ *
+ * Unicode, especially in version 3.2, defines many more properties than the
+ * original set in UnicodeData.txt.
+ *
+ * The properties APIs are intended to reflect Unicode properties as defined
+ * in the Unicode Character Database (UCD) and Unicode Technical Reports (UTR).
+ * For details about the properties see http://www.unicode.org/ucd/ .
+ * For names of Unicode properties see the UCD file PropertyAliases.txt.
+ *
+ * Important: If ICU is built with UCD files from Unicode versions below 3.2,
+ * then properties marked with "new in Unicode 3.2" are not or not fully available.
+ *
+ * @param c Code point to test.
+ * @param which UProperty selector constant, identifies which binary property to check.
+ * Must be UCHAR_BINARY_START<=which<UCHAR_BINARY_LIMIT.
+ * @return TRUE or FALSE according to the binary Unicode property value for c.
+ * Also FALSE if 'which' is out of bounds or if the Unicode version
+ * does not have data for the property at all, or not for this code point.
+ *
+ * @see UProperty
+ * @see u_getIntPropertyValue
+ * @see u_getUnicodeVersion
+ * @stable ICU 2.1
+ */
+U_STABLE UBool U_EXPORT2
+u_hasBinaryProperty(UChar32 c, UProperty which);
+
+/**
+ * Check if a code point has the Alphabetic Unicode property.
+ * Same as u_hasBinaryProperty(c, UCHAR_ALPHABETIC).
+ * This is different from u_isalpha!
+ * @param c Code point to test
+ * @return true if the code point has the Alphabetic Unicode property, false otherwise
+ *
+ * @see UCHAR_ALPHABETIC
+ * @see u_isalpha
+ * @see u_hasBinaryProperty
+ * @stable ICU 2.1
+ */
+U_STABLE UBool U_EXPORT2
+u_isUAlphabetic(UChar32 c);
+
+/**
+ * Check if a code point has the Lowercase Unicode property.
+ * Same as u_hasBinaryProperty(c, UCHAR_LOWERCASE).
+ * This is different from u_islower!
+ * @param c Code point to test
+ * @return true if the code point has the Lowercase Unicode property, false otherwise
+ *
+ * @see UCHAR_LOWERCASE
+ * @see u_islower
+ * @see u_hasBinaryProperty
+ * @stable ICU 2.1
+ */
+U_STABLE UBool U_EXPORT2
+u_isULowercase(UChar32 c);
+
+/**
+ * Check if a code point has the Uppercase Unicode property.
+ * Same as u_hasBinaryProperty(c, UCHAR_UPPERCASE).
+ * This is different from u_isupper!
+ * @param c Code point to test
+ * @return true if the code point has the Uppercase Unicode property, false otherwise
+ *
+ * @see UCHAR_UPPERCASE
+ * @see u_isupper
+ * @see u_hasBinaryProperty
+ * @stable ICU 2.1
+ */
+U_STABLE UBool U_EXPORT2
+u_isUUppercase(UChar32 c);
+
+/**
+ * Check if a code point has the White_Space Unicode property.
+ * Same as u_hasBinaryProperty(c, UCHAR_WHITE_SPACE).
+ * This is different from both u_isspace and u_isWhitespace!
+ *
+ * Note: There are several ICU whitespace functions; please see the uchar.h
+ * file documentation for a detailed comparison.
+ *
+ * @param c Code point to test
+ * @return true if the code point has the White_Space Unicode property, false otherwise.
+ *
+ * @see UCHAR_WHITE_SPACE
+ * @see u_isWhitespace
+ * @see u_isspace
+ * @see u_isJavaSpaceChar
+ * @see u_hasBinaryProperty
+ * @stable ICU 2.1
+ */
+U_STABLE UBool U_EXPORT2
+u_isUWhiteSpace(UChar32 c);
+
+/**
+ * Get the property value for an enumerated or integer Unicode property for a code point.
+ * Also returns binary and mask property values.
+ *
+ * Unicode, especially in version 3.2, defines many more properties than the
+ * original set in UnicodeData.txt.
+ *
+ * The properties APIs are intended to reflect Unicode properties as defined
+ * in the Unicode Character Database (UCD) and Unicode Technical Reports (UTR).
+ * For details about the properties see http://www.unicode.org/ .
+ * For names of Unicode properties see the UCD file PropertyAliases.txt.
+ *
+ * Sample usage:
+ * UEastAsianWidth ea=(UEastAsianWidth)u_getIntPropertyValue(c, UCHAR_EAST_ASIAN_WIDTH);
+ * UBool b=(UBool)u_getIntPropertyValue(c, UCHAR_IDEOGRAPHIC);
+ *
+ * @param c Code point to test.
+ * @param which UProperty selector constant, identifies which property to check.
+ * Must be UCHAR_BINARY_START<=which<UCHAR_BINARY_LIMIT
+ * or UCHAR_INT_START<=which<UCHAR_INT_LIMIT
+ * or UCHAR_MASK_START<=which<UCHAR_MASK_LIMIT.
+ * @return Numeric value that is directly the property value or,
+ * for enumerated properties, corresponds to the numeric value of the enumerated
+ * constant of the respective property value enumeration type
+ * (cast to enum type if necessary).
+ * Returns 0 or 1 (for FALSE/TRUE) for binary Unicode properties.
+ * Returns a bit-mask for mask properties.
+ * Returns 0 if 'which' is out of bounds or if the Unicode version
+ * does not have data for the property at all, or not for this code point.
+ *
+ * @see UProperty
+ * @see u_hasBinaryProperty
+ * @see u_getIntPropertyMinValue
+ * @see u_getIntPropertyMaxValue
+ * @see u_getUnicodeVersion
+ * @stable ICU 2.2
+ */
+U_STABLE int32_t U_EXPORT2
+u_getIntPropertyValue(UChar32 c, UProperty which);
+
+/**
+ * Get the minimum value for an enumerated/integer/binary Unicode property.
+ * Can be used together with u_getIntPropertyMaxValue
+ * to allocate arrays of UnicodeSet or similar.
+ *
+ * @param which UProperty selector constant, identifies which binary property to check.
+ * Must be UCHAR_BINARY_START<=which<UCHAR_BINARY_LIMIT
+ * or UCHAR_INT_START<=which<UCHAR_INT_LIMIT.
+ * @return Minimum value returned by u_getIntPropertyValue for a Unicode property.
+ * 0 if the property selector is out of range.
+ *
+ * @see UProperty
+ * @see u_hasBinaryProperty
+ * @see u_getUnicodeVersion
+ * @see u_getIntPropertyMaxValue
+ * @see u_getIntPropertyValue
+ * @stable ICU 2.2
+ */
+U_STABLE int32_t U_EXPORT2
+u_getIntPropertyMinValue(UProperty which);
+
+/**
+ * Get the maximum value for an enumerated/integer/binary Unicode property.
+ * Can be used together with u_getIntPropertyMinValue
+ * to allocate arrays of UnicodeSet or similar.
+ *
+ * Examples for min/max values (for Unicode 3.2):
+ *
+ * - UCHAR_BIDI_CLASS: 0/18 (U_LEFT_TO_RIGHT/U_BOUNDARY_NEUTRAL)
+ * - UCHAR_SCRIPT: 0/45 (USCRIPT_COMMON/USCRIPT_TAGBANWA)
+ * - UCHAR_IDEOGRAPHIC: 0/1 (FALSE/TRUE)
+ *
+ * For undefined UProperty constant values, min/max values will be 0/-1.
+ *
+ * @param which UProperty selector constant, identifies which binary property to check.
+ * Must be UCHAR_BINARY_START<=which<UCHAR_BINARY_LIMIT
+ * or UCHAR_INT_START<=which<UCHAR_INT_LIMIT.
+ * @return Maximum value returned by u_getIntPropertyValue for a Unicode property.
+ * <=0 if the property selector is out of range.
+ *
+ * @see UProperty
+ * @see u_hasBinaryProperty
+ * @see u_getUnicodeVersion
+ * @see u_getIntPropertyMaxValue
+ * @see u_getIntPropertyValue
+ * @stable ICU 2.2
+ */
+U_STABLE int32_t U_EXPORT2
+u_getIntPropertyMaxValue(UProperty which);
+
+/**
+ * Get the numeric value for a Unicode code point as defined in the
+ * Unicode Character Database.
+ *
+ * A "double" return type is necessary because
+ * some numeric values are fractions, negative, or too large for int32_t.
+ *
+ * For characters without any numeric values in the Unicode Character Database,
+ * this function will return U_NO_NUMERIC_VALUE.
+ *
+ * Similar to java.lang.Character.getNumericValue(), but u_getNumericValue()
+ * also supports negative values, large values, and fractions,
+ * while Java's getNumericValue() returns values 10..35 for ASCII letters.
+ *
+ * @param c Code point to get the numeric value for.
+ * @return Numeric value of c, or U_NO_NUMERIC_VALUE if none is defined.
+ *
+ * @see U_NO_NUMERIC_VALUE
+ * @stable ICU 2.2
+ */
+U_STABLE double U_EXPORT2
+u_getNumericValue(UChar32 c);
+
+/**
+ * Special value that is returned by u_getNumericValue when
+ * no numeric value is defined for a code point.
+ *
+ * @see u_getNumericValue
+ * @stable ICU 2.2
+ */
+#define U_NO_NUMERIC_VALUE ((double)-123456789.)
+
+/**
+ * Determines whether the specified code point has the general category "Ll"
+ * (lowercase letter).
+ *
+ * Same as java.lang.Character.isLowerCase().
+ *
+ * This misses some characters that are also lowercase but
+ * have a different general category value.
+ * In order to include those, use UCHAR_LOWERCASE.
+ *
+ * In addition to being equivalent to a Java function, this also serves
+ * as a C/POSIX migration function.
+ * See the comments about C/POSIX character classification functions in the
+ * documentation at the top of this header file.
+ *
+ * @param c the code point to be tested
+ * @return TRUE if the code point is an Ll lowercase letter
+ *
+ * @see UCHAR_LOWERCASE
+ * @see u_isupper
+ * @see u_istitle
+ * @see u_islower
+ * @stable ICU 2.0
+ */
+U_STABLE UBool U_EXPORT2
+u_islower(UChar32 c);
+
+/**
+ * Determines whether the specified code point has the general category "Lu"
+ * (uppercase letter).
+ *
+ * Same as java.lang.Character.isUpperCase().
+ *
+ * This misses some characters that are also uppercase but
+ * have a different general category value.
+ * In order to include those, use UCHAR_UPPERCASE.
+ *
+ * In addition to being equivalent to a Java function, this also serves
+ * as a C/POSIX migration function.
+ * See the comments about C/POSIX character classification functions in the
+ * documentation at the top of this header file.
+ *
+ * @param c the code point to be tested
+ * @return TRUE if the code point is an Lu uppercase letter
+ *
+ * @see UCHAR_UPPERCASE
+ * @see u_islower
+ * @see u_istitle
+ * @see u_tolower
+ * @stable ICU 2.0
+ */
+U_STABLE UBool U_EXPORT2
+u_isupper(UChar32 c);
+
+/**
+ * Determines whether the specified code point is a titlecase letter.
+ * True for general category "Lt" (titlecase letter).
+ *
+ * Same as java.lang.Character.isTitleCase().
+ *
+ * @param c the code point to be tested
+ * @return TRUE if the code point is an Lt titlecase letter
+ *
+ * @see u_isupper
+ * @see u_islower
+ * @see u_totitle
+ * @stable ICU 2.0
+ */
+U_STABLE UBool U_EXPORT2
+u_istitle(UChar32 c);
+
+/**
+ * Determines whether the specified code point is a digit character according to Java.
+ * True for characters with general category "Nd" (decimal digit numbers).
+ * Beginning with Unicode 4, this is the same as
+ * testing for the Numeric_Type of Decimal.
+ *
+ * Same as java.lang.Character.isDigit().
+ *
+ * In addition to being equivalent to a Java function, this also serves
+ * as a C/POSIX migration function.
+ * See the comments about C/POSIX character classification functions in the
+ * documentation at the top of this header file.
+ *
+ * @param c the code point to be tested
+ * @return TRUE if the code point is a digit character according to Character.isDigit()
+ *
+ * @stable ICU 2.0
+ */
+U_STABLE UBool U_EXPORT2
+u_isdigit(UChar32 c);
+
+/**
+ * Determines whether the specified code point is a letter character.
+ * True for general categories "L" (letters).
+ *
+ * Same as java.lang.Character.isLetter().
+ *
+ * In addition to being equivalent to a Java function, this also serves
+ * as a C/POSIX migration function.
+ * See the comments about C/POSIX character classification functions in the
+ * documentation at the top of this header file.
+ *
+ * @param c the code point to be tested
+ * @return TRUE if the code point is a letter character
+ *
+ * @see u_isdigit
+ * @see u_isalnum
+ * @stable ICU 2.0
+ */
+U_STABLE UBool U_EXPORT2
+u_isalpha(UChar32 c);
+
+/**
+ * Determines whether the specified code point is an alphanumeric character
+ * (letter or digit) according to Java.
+ * True for characters with general categories
+ * "L" (letters) and "Nd" (decimal digit numbers).
+ *
+ * Same as java.lang.Character.isLetterOrDigit().
+ *
+ * In addition to being equivalent to a Java function, this also serves
+ * as a C/POSIX migration function.
+ * See the comments about C/POSIX character classification functions in the
+ * documentation at the top of this header file.
+ *
+ * @param c the code point to be tested
+ * @return TRUE if the code point is an alphanumeric character according to Character.isLetterOrDigit()
+ *
+ * @stable ICU 2.0
+ */
+U_STABLE UBool U_EXPORT2
+u_isalnum(UChar32 c);
+
+/**
+ * Determines whether the specified code point is a hexadecimal digit.
+ * This is equivalent to u_digit(c, 16)>=0.
+ * True for characters with general category "Nd" (decimal digit numbers)
+ * as well as Latin letters a-f and A-F in both ASCII and Fullwidth ASCII.
+ * (That is, for letters with code points
+ * 0041..0046, 0061..0066, FF21..FF26, FF41..FF46.)
+ *
+ * In order to narrow the definition of hexadecimal digits to only ASCII
+ * characters, use (c<=0x7f && u_isxdigit(c)).
+ *
+ * This is a C/POSIX migration function.
+ * See the comments about C/POSIX character classification functions in the
+ * documentation at the top of this header file.
+ *
+ * @param c the code point to be tested
+ * @return TRUE if the code point is a hexadecimal digit
+ *
+ * @stable ICU 2.6
+ */
+U_STABLE UBool U_EXPORT2
+u_isxdigit(UChar32 c);
+
+/**
+ * Determines whether the specified code point is a punctuation character.
+ * True for characters with general categories "P" (punctuation).
+ *
+ * This is a C/POSIX migration function.
+ * See the comments about C/POSIX character classification functions in the
+ * documentation at the top of this header file.
+ *
+ * @param c the code point to be tested
+ * @return TRUE if the code point is a punctuation character
+ *
+ * @stable ICU 2.6
+ */
+U_STABLE UBool U_EXPORT2
+u_ispunct(UChar32 c);
+
+/**
+ * Determines whether the specified code point is a "graphic" character
+ * (printable, excluding spaces).
+ * TRUE for all characters except those with general categories
+ * "Cc" (control codes), "Cf" (format controls), "Cs" (surrogates),
+ * "Cn" (unassigned), and "Z" (separators).
+ *
+ * This is a C/POSIX migration function.
+ * See the comments about C/POSIX character classification functions in the
+ * documentation at the top of this header file.
+ *
+ * @param c the code point to be tested
+ * @return TRUE if the code point is a "graphic" character
+ *
+ * @stable ICU 2.6
+ */
+U_STABLE UBool U_EXPORT2
+u_isgraph(UChar32 c);
+
+/**
+ * Determines whether the specified code point is a "blank" or "horizontal space",
+ * a character that visibly separates words on a line.
+ * The following are equivalent definitions:
+ *
+ * TRUE for Unicode White_Space characters except for "vertical space controls"
+ * where "vertical space controls" are the following characters:
+ * U+000A (LF) U+000B (VT) U+000C (FF) U+000D (CR) U+0085 (NEL) U+2028 (LS) U+2029 (PS)
+ *
+ * same as
+ *
+ * TRUE for U+0009 (TAB) and characters with general category "Zs" (space separators)
+ * except Zero Width Space (ZWSP, U+200B).
+ *
+ * Note: There are several ICU whitespace functions; please see the uchar.h
+ * file documentation for a detailed comparison.
+ *
+ * This is a C/POSIX migration function.
+ * See the comments about C/POSIX character classification functions in the
+ * documentation at the top of this header file.
+ *
+ * @param c the code point to be tested
+ * @return TRUE if the code point is a "blank"
+ *
+ * @stable ICU 2.6
+ */
+U_STABLE UBool U_EXPORT2
+u_isblank(UChar32 c);
+
+/**
+ * Determines whether the specified code point is "defined",
+ * which usually means that it is assigned a character.
+ * True for general categories other than "Cn" (other, not assigned),
+ * i.e., true for all code points mentioned in UnicodeData.txt.
+ *
+ * Note that non-character code points (e.g., U+FDD0) are not "defined"
+ * (they are Cn), but surrogate code points are "defined" (Cs).
+ *
+ * Same as java.lang.Character.isDefined().
+ *
+ * @param c the code point to be tested
+ * @return TRUE if the code point is assigned a character
+ *
+ * @see u_isdigit
+ * @see u_isalpha
+ * @see u_isalnum
+ * @see u_isupper
+ * @see u_islower
+ * @see u_istitle
+ * @stable ICU 2.0
+ */
+U_STABLE UBool U_EXPORT2
+u_isdefined(UChar32 c);
+
+/**
+ * Determines if the specified character is a space character or not.
+ *
+ * Note: There are several ICU whitespace functions; please see the uchar.h
+ * file documentation for a detailed comparison.
+ *
+ * This is a C/POSIX migration function.
+ * See the comments about C/POSIX character classification functions in the
+ * documentation at the top of this header file.
+ *
+ * @param c the character to be tested
+ * @return true if the character is a space character; false otherwise.
+ *
+ * @see u_isJavaSpaceChar
+ * @see u_isWhitespace
+ * @see u_isUWhiteSpace
+ * @stable ICU 2.0
+ */
+U_STABLE UBool U_EXPORT2
+u_isspace(UChar32 c);
+
+/**
+ * Determine if the specified code point is a space character according to Java.
+ * True for characters with general categories "Z" (separators),
+ * which does not include control codes (e.g., TAB or Line Feed).
+ *
+ * Same as java.lang.Character.isSpaceChar().
+ *
+ * Note: There are several ICU whitespace functions; please see the uchar.h
+ * file documentation for a detailed comparison.
+ *
+ * @param c the code point to be tested
+ * @return TRUE if the code point is a space character according to Character.isSpaceChar()
+ *
+ * @see u_isspace
+ * @see u_isWhitespace
+ * @see u_isUWhiteSpace
+ * @stable ICU 2.6
+ */
+U_STABLE UBool U_EXPORT2
+u_isJavaSpaceChar(UChar32 c);
+
+/**
+ * Determines if the specified code point is a whitespace character according to Java/ICU.
+ * A character is considered to be a Java whitespace character if and only
+ * if it satisfies one of the following criteria:
+ *
+ * - It is a Unicode separator (categories "Z"), but is not
+ * a no-break space (U+00A0 NBSP or U+2007 Figure Space or U+202F Narrow NBSP).
+ * - It is U+0009 HORIZONTAL TABULATION.
+ * - It is U+000A LINE FEED.
+ * - It is U+000B VERTICAL TABULATION.
+ * - It is U+000C FORM FEED.
+ * - It is U+000D CARRIAGE RETURN.
+ * - It is U+001C FILE SEPARATOR.
+ * - It is U+001D GROUP SEPARATOR.
+ * - It is U+001E RECORD SEPARATOR.
+ * - It is U+001F UNIT SEPARATOR.
+ * - It is U+0085 NEXT LINE.
+ *
+ * Same as java.lang.Character.isWhitespace() except that Java omits U+0085.
+ *
+ * Note: There are several ICU whitespace functions; please see the uchar.h
+ * file documentation for a detailed comparison.
+ *
+ * @param c the code point to be tested
+ * @return TRUE if the code point is a whitespace character according to Java/ICU
+ *
+ * @see u_isspace
+ * @see u_isJavaSpaceChar
+ * @see u_isUWhiteSpace
+ * @stable ICU 2.0
+ */
+U_STABLE UBool U_EXPORT2
+u_isWhitespace(UChar32 c);
+
+/**
+ * Determines whether the specified code point is a control character
+ * (as defined by this function).
+ * A control character is one of the following:
+ * - ISO 8-bit control character (U+0000..U+001f and U+007f..U+009f)
+ * - U_CONTROL_CHAR (Cc)
+ * - U_FORMAT_CHAR (Cf)
+ * - U_LINE_SEPARATOR (Zl)
+ * - U_PARAGRAPH_SEPARATOR (Zp)
+ *
+ * This is a C/POSIX migration function.
+ * See the comments about C/POSIX character classification functions in the
+ * documentation at the top of this header file.
+ *
+ * @param c the code point to be tested
+ * @return TRUE if the code point is a control character
+ *
+ * @see UCHAR_DEFAULT_IGNORABLE_CODE_POINT
+ * @see u_isprint
+ * @stable ICU 2.0
+ */
+U_STABLE UBool U_EXPORT2
+u_iscntrl(UChar32 c);
+
+/**
+ * Determines whether the specified code point is an ISO control code.
+ * True for U+0000..U+001f and U+007f..U+009f (general category "Cc").
+ *
+ * Same as java.lang.Character.isISOControl().
+ *
+ * @param c the code point to be tested
+ * @return TRUE if the code point is an ISO control code
+ *
+ * @see u_iscntrl
+ * @stable ICU 2.6
+ */
+U_STABLE UBool U_EXPORT2
+u_isISOControl(UChar32 c);
+
+/**
+ * Determines whether the specified code point is a printable character.
+ * True for general categories <em>other</em> than "C" (controls).
+ *
+ * This is a C/POSIX migration function.
+ * See the comments about C/POSIX character classification functions in the
+ * documentation at the top of this header file.
+ *
+ * @param c the code point to be tested
+ * @return TRUE if the code point is a printable character
+ *
+ * @see UCHAR_DEFAULT_IGNORABLE_CODE_POINT
+ * @see u_iscntrl
+ * @stable ICU 2.0
+ */
+U_STABLE UBool U_EXPORT2
+u_isprint(UChar32 c);
+
+/**
+ * Determines whether the specified code point is a base character.
+ * True for general categories "L" (letters), "N" (numbers),
+ * "Mc" (spacing combining marks), and "Me" (enclosing marks).
+ *
+ * Note that this is different from the Unicode definition in
+ * chapter 3.5, conformance clause D13,
+ * which defines base characters to be all characters (not Cn)
+ * that do not graphically combine with preceding characters (M)
+ * and that are neither control (Cc) or format (Cf) characters.
+ *
+ * @param c the code point to be tested
+ * @return TRUE if the code point is a base character according to this function
+ *
+ * @see u_isalpha
+ * @see u_isdigit
+ * @stable ICU 2.0
+ */
+U_STABLE UBool U_EXPORT2
+u_isbase(UChar32 c);
+
+/**
+ * Returns the bidirectional category value for the code point,
+ * which is used in the Unicode bidirectional algorithm
+ * (UAX #9 http://www.unicode.org/reports/tr9/).
+ * Note that some <em>unassigned</em> code points have bidi values
+ * of R or AL because they are in blocks that are reserved
+ * for Right-To-Left scripts.
+ *
+ * Same as java.lang.Character.getDirectionality()
+ *
+ * @param c the code point to be tested
+ * @return the bidirectional category (UCharDirection) value
+ *
+ * @see UCharDirection
+ * @stable ICU 2.0
+ */
+U_STABLE UCharDirection U_EXPORT2
+u_charDirection(UChar32 c);
+
+/**
+ * Determines whether the code point has the Bidi_Mirrored property.
+ * This property is set for characters that are commonly used in
+ * Right-To-Left contexts and need to be displayed with a "mirrored"
+ * glyph.
+ *
+ * Same as java.lang.Character.isMirrored().
+ * Same as UCHAR_BIDI_MIRRORED
+ *
+ * @param c the code point to be tested
+ * @return TRUE if the character has the Bidi_Mirrored property
+ *
+ * @see UCHAR_BIDI_MIRRORED
+ * @stable ICU 2.0
+ */
+U_STABLE UBool U_EXPORT2
+u_isMirrored(UChar32 c);
+
+/**
+ * Maps the specified character to a "mirror-image" character.
+ * For characters with the Bidi_Mirrored property, implementations
+ * sometimes need a "poor man's" mapping to another Unicode
+ * character (code point) such that the default glyph may serve
+ * as the mirror-image of the default glyph of the specified
+ * character. This is useful for text conversion to and from
+ * codepages with visual order, and for displays without glyph
+ * selecetion capabilities.
+ *
+ * @param c the code point to be mapped
+ * @return another Unicode code point that may serve as a mirror-image
+ * substitute, or c itself if there is no such mapping or c
+ * does not have the Bidi_Mirrored property
+ *
+ * @see UCHAR_BIDI_MIRRORED
+ * @see u_isMirrored
+ * @stable ICU 2.0
+ */
+U_STABLE UChar32 U_EXPORT2
+u_charMirror(UChar32 c);
+
+/**
+ * Returns the general category value for the code point.
+ *
+ * Same as java.lang.Character.getType().
+ *
+ * @param c the code point to be tested
+ * @return the general category (UCharCategory) value
+ *
+ * @see UCharCategory
+ * @stable ICU 2.0
+ */
+U_STABLE int8_t U_EXPORT2
+u_charType(UChar32 c);
+
+/**
+ * Get a single-bit bit set for the general category of a character.
+ * This bit set can be compared bitwise with U_GC_SM_MASK, U_GC_L_MASK, etc.
+ * Same as U_MASK(u_charType(c)).
+ *
+ * @param c the code point to be tested
+ * @return a single-bit mask corresponding to the general category (UCharCategory) value
+ *
+ * @see u_charType
+ * @see UCharCategory
+ * @see U_GC_CN_MASK
+ * @stable ICU 2.1
+ */
+#define U_GET_GC_MASK(c) U_MASK(u_charType(c))
+
+/**
+ * Callback from u_enumCharTypes(), is called for each contiguous range
+ * of code points c (where start<=c<limit)
+ * with the same Unicode general category ("character type").
+ *
+ * The callback function can stop the enumeration by returning FALSE.
+ *
+ * @param context an opaque pointer, as passed into utrie_enum()
+ * @param start the first code point in a contiguous range with value
+ * @param limit one past the last code point in a contiguous range with value
+ * @param type the general category for all code points in [start..limit[
+ * @return FALSE to stop the enumeration
+ *
+ * @stable ICU 2.1
+ * @see UCharCategory
+ * @see u_enumCharTypes
+ */
+typedef UBool U_CALLCONV
+UCharEnumTypeRange(const void *context, UChar32 start, UChar32 limit, UCharCategory type);
+
+/**
+ * Enumerate efficiently all code points with their Unicode general categories.
+ *
+ * This is useful for building data structures (e.g., UnicodeSet's),
+ * for enumerating all assigned code points (type!=U_UNASSIGNED), etc.
+ *
+ * For each contiguous range of code points with a given general category ("character type"),
+ * the UCharEnumTypeRange function is called.
+ * Adjacent ranges have different types.
+ * The Unicode Standard guarantees that the numeric value of the type is 0..31.
+ *
+ * @param enumRange a pointer to a function that is called for each contiguous range
+ * of code points with the same general category
+ * @param context an opaque pointer that is passed on to the callback function
+ *
+ * @stable ICU 2.1
+ * @see UCharCategory
+ * @see UCharEnumTypeRange
+ */
+U_STABLE void U_EXPORT2
+u_enumCharTypes(UCharEnumTypeRange *enumRange, const void *context);
+
+#if !UCONFIG_NO_NORMALIZATION
+
+/**
+ * Returns the combining class of the code point as specified in UnicodeData.txt.
+ *
+ * @param c the code point of the character
+ * @return the combining class of the character
+ * @stable ICU 2.0
+ */
+U_STABLE uint8_t U_EXPORT2
+u_getCombiningClass(UChar32 c);
+
+#endif
+
+/**
+ * Returns the decimal digit value of a decimal digit character.
+ * Such characters have the general category "Nd" (decimal digit numbers)
+ * and a Numeric_Type of Decimal.
+ *
+ * Unlike ICU releases before 2.6, no digit values are returned for any
+ * Han characters because Han number characters are often used with a special
+ * Chinese-style number format (with characters for powers of 10 in between)
+ * instead of in decimal-positional notation.
+ * Unicode 4 explicitly assigns Han number characters the Numeric_Type
+ * Numeric instead of Decimal.
+ * See Jitterbug 1483 for more details.
+ *
+ * Use u_getIntPropertyValue(c, UCHAR_NUMERIC_TYPE) and u_getNumericValue()
+ * for complete numeric Unicode properties.
+ *
+ * @param c the code point for which to get the decimal digit value
+ * @return the decimal digit value of c,
+ * or -1 if c is not a decimal digit character
+ *
+ * @see u_getNumericValue
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+u_charDigitValue(UChar32 c);
+
+/**
+ * Returns the Unicode allocation block that contains the character.
+ *
+ * @param c the code point to be tested
+ * @return the block value (UBlockCode) for c
+ *
+ * @see UBlockCode
+ * @stable ICU 2.0
+ */
+U_STABLE UBlockCode U_EXPORT2
+ublock_getCode(UChar32 c);
+
+/**
+ * Retrieve the name of a Unicode character.
+ * Depending on <code>nameChoice</code>, the character name written
+ * into the buffer is the "modern" name or the name that was defined
+ * in Unicode version 1.0.
+ * The name contains only "invariant" characters
+ * like A-Z, 0-9, space, and '-'.
+ * Unicode 1.0 names are only retrieved if they are different from the modern
+ * names and if the data file contains the data for them. gennames may or may
+ * not be called with a command line option to include 1.0 names in unames.dat.
+ *
+ * @param code The character (code point) for which to get the name.
+ * It must be <code>0<=code<=0x10ffff</code>.
+ * @param nameChoice Selector for which name to get.
+ * @param buffer Destination address for copying the name.
+ * The name will always be zero-terminated.
+ * If there is no name, then the buffer will be set to the empty string.
+ * @param bufferLength <code>==sizeof(buffer)</code>
+ * @param pErrorCode Pointer to a UErrorCode variable;
+ * check for <code>U_SUCCESS()</code> after <code>u_charName()</code>
+ * returns.
+ * @return The length of the name, or 0 if there is no name for this character.
+ * If the bufferLength is less than or equal to the length, then the buffer
+ * contains the truncated name and the returned length indicates the full
+ * length of the name.
+ * The length does not include the zero-termination.
+ *
+ * @see UCharNameChoice
+ * @see u_charFromName
+ * @see u_enumCharNames
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+u_charName(UChar32 code, UCharNameChoice nameChoice,
+ char *buffer, int32_t bufferLength,
+ UErrorCode *pErrorCode);
+
+/**
+ * Get the ISO 10646 comment for a character.
+ * The ISO 10646 comment is an informative field in the Unicode Character
+ * Database (UnicodeData.txt field 11) and is from the ISO 10646 names list.
+ *
+ * @param c The character (code point) for which to get the ISO comment.
+ * It must be <code>0<=c<=0x10ffff</code>.
+ * @param dest Destination address for copying the comment.
+ * The comment will be zero-terminated if possible.
+ * If there is no comment, then the buffer will be set to the empty string.
+ * @param destCapacity <code>==sizeof(dest)</code>
+ * @param pErrorCode Pointer to a UErrorCode variable;
+ * check for <code>U_SUCCESS()</code> after <code>u_getISOComment()</code>
+ * returns.
+ * @return The length of the comment, or 0 if there is no comment for this character.
+ * If the destCapacity is less than or equal to the length, then the buffer
+ * contains the truncated name and the returned length indicates the full
+ * length of the name.
+ * The length does not include the zero-termination.
+ *
+ * @stable ICU 2.2
+ */
+U_STABLE int32_t U_EXPORT2
+u_getISOComment(UChar32 c,
+ char *dest, int32_t destCapacity,
+ UErrorCode *pErrorCode);
+
+/**
+ * Find a Unicode character by its name and return its code point value.
+ * The name is matched exactly and completely.
+ * If the name does not correspond to a code point, <i>pErrorCode</i>
+ * is set to <code>U_INVALID_CHAR_FOUND</code>.
+ * A Unicode 1.0 name is matched only if it differs from the modern name.
+ * Unicode names are all uppercase. Extended names are lowercase followed
+ * by an uppercase hexadecimal number, and within angle brackets.
+ *
+ * @param nameChoice Selector for which name to match.
+ * @param name The name to match.
+ * @param pErrorCode Pointer to a UErrorCode variable
+ * @return The Unicode value of the code point with the given name,
+ * or an undefined value if there is no such code point.
+ *
+ * @see UCharNameChoice
+ * @see u_charName
+ * @see u_enumCharNames
+ * @stable ICU 1.7
+ */
+U_STABLE UChar32 U_EXPORT2
+u_charFromName(UCharNameChoice nameChoice,
+ const char *name,
+ UErrorCode *pErrorCode);
+
+/**
+ * Type of a callback function for u_enumCharNames() that gets called
+ * for each Unicode character with the code point value and
+ * the character name.
+ * If such a function returns FALSE, then the enumeration is stopped.
+ *
+ * @param context The context pointer that was passed to u_enumCharNames().
+ * @param code The Unicode code point for the character with this name.
+ * @param nameChoice Selector for which kind of names is enumerated.
+ * @param name The character's name, zero-terminated.
+ * @param length The length of the name.
+ * @return TRUE if the enumeration should continue, FALSE to stop it.
+ *
+ * @see UCharNameChoice
+ * @see u_enumCharNames
+ * @stable ICU 1.7
+ */
+typedef UBool UEnumCharNamesFn(void *context,
+ UChar32 code,
+ UCharNameChoice nameChoice,
+ const char *name,
+ int32_t length);
+
+/**
+ * Enumerate all assigned Unicode characters between the start and limit
+ * code points (start inclusive, limit exclusive) and call a function
+ * for each, passing the code point value and the character name.
+ * For Unicode 1.0 names, only those are enumerated that differ from the
+ * modern names.
+ *
+ * @param start The first code point in the enumeration range.
+ * @param limit One more than the last code point in the enumeration range
+ * (the first one after the range).
+ * @param fn The function that is to be called for each character name.
+ * @param context An arbitrary pointer that is passed to the function.
+ * @param nameChoice Selector for which kind of names to enumerate.
+ * @param pErrorCode Pointer to a UErrorCode variable
+ *
+ * @see UCharNameChoice
+ * @see UEnumCharNamesFn
+ * @see u_charName
+ * @see u_charFromName
+ * @stable ICU 1.7
+ */
+U_STABLE void U_EXPORT2
+u_enumCharNames(UChar32 start, UChar32 limit,
+ UEnumCharNamesFn *fn,
+ void *context,
+ UCharNameChoice nameChoice,
+ UErrorCode *pErrorCode);
+
+/**
+ * Return the Unicode name for a given property, as given in the
+ * Unicode database file PropertyAliases.txt.
+ *
+ * In addition, this function maps the property
+ * UCHAR_GENERAL_CATEGORY_MASK to the synthetic names "gcm" /
+ * "General_Category_Mask". These names are not in
+ * PropertyAliases.txt.
+ *
+ * @param property UProperty selector other than UCHAR_INVALID_CODE.
+ * If out of range, NULL is returned.
+ *
+ * @param nameChoice selector for which name to get. If out of range,
+ * NULL is returned. All properties have a long name. Most
+ * have a short name, but some do not. Unicode allows for
+ * additional names; if present these will be returned by
+ * U_LONG_PROPERTY_NAME + i, where i=1, 2,...
+ *
+ * @return a pointer to the name, or NULL if either the
+ * property or the nameChoice is out of range. If a given
+ * nameChoice returns NULL, then all larger values of
+ * nameChoice will return NULL, with one exception: if NULL is
+ * returned for U_SHORT_PROPERTY_NAME, then
+ * U_LONG_PROPERTY_NAME (and higher) may still return a
+ * non-NULL value. The returned pointer is valid until
+ * u_cleanup() is called.
+ *
+ * @see UProperty
+ * @see UPropertyNameChoice
+ * @stable ICU 2.4
+ */
+U_STABLE const char* U_EXPORT2
+u_getPropertyName(UProperty property,
+ UPropertyNameChoice nameChoice);
+
+/**
+ * Return the UProperty enum for a given property name, as specified
+ * in the Unicode database file PropertyAliases.txt. Short, long, and
+ * any other variants are recognized.
+ *
+ * In addition, this function maps the synthetic names "gcm" /
+ * "General_Category_Mask" to the property
+ * UCHAR_GENERAL_CATEGORY_MASK. These names are not in
+ * PropertyAliases.txt.
+ *
+ * @param alias the property name to be matched. The name is compared
+ * using "loose matching" as described in PropertyAliases.txt.
+ *
+ * @return a UProperty enum, or UCHAR_INVALID_CODE if the given name
+ * does not match any property.
+ *
+ * @see UProperty
+ * @stable ICU 2.4
+ */
+U_STABLE UProperty U_EXPORT2
+u_getPropertyEnum(const char* alias);
+
+/**
+ * Return the Unicode name for a given property value, as given in the
+ * Unicode database file PropertyValueAliases.txt.
+ *
+ * Note: Some of the names in PropertyValueAliases.txt can only be
+ * retrieved using UCHAR_GENERAL_CATEGORY_MASK, not
+ * UCHAR_GENERAL_CATEGORY. These include: "C" / "Other", "L" /
+ * "Letter", "LC" / "Cased_Letter", "M" / "Mark", "N" / "Number", "P"
+ * / "Punctuation", "S" / "Symbol", and "Z" / "Separator".
+ *
+ * @param property UProperty selector constant.
+ * Must be UCHAR_BINARY_START<=which<UCHAR_BINARY_LIMIT
+ * or UCHAR_INT_START<=which<UCHAR_INT_LIMIT
+ * or UCHAR_MASK_START<=which<UCHAR_MASK_LIMIT.
+ * If out of range, NULL is returned.
+ *
+ * @param value selector for a value for the given property. If out
+ * of range, NULL is returned. In general, valid values range
+ * from 0 up to some maximum. There are a few exceptions:
+ * (1.) UCHAR_BLOCK values begin at the non-zero value
+ * UBLOCK_BASIC_LATIN. (2.) UCHAR_CANONICAL_COMBINING_CLASS
+ * values are not contiguous and range from 0..240. (3.)
+ * UCHAR_GENERAL_CATEGORY_MASK values are not values of
+ * UCharCategory, but rather mask values produced by
+ * U_GET_GC_MASK(). This allows grouped categories such as
+ * [:L:] to be represented. Mask values range
+ * non-contiguously from 1..U_GC_P_MASK.
+ *
+ * @param nameChoice selector for which name to get. If out of range,
+ * NULL is returned. All values have a long name. Most have
+ * a short name, but some do not. Unicode allows for
+ * additional names; if present these will be returned by
+ * U_LONG_PROPERTY_NAME + i, where i=1, 2,...
+
+ * @return a pointer to the name, or NULL if either the
+ * property or the nameChoice is out of range. If a given
+ * nameChoice returns NULL, then all larger values of
+ * nameChoice will return NULL, with one exception: if NULL is
+ * returned for U_SHORT_PROPERTY_NAME, then
+ * U_LONG_PROPERTY_NAME (and higher) may still return a
+ * non-NULL value. The returned pointer is valid until
+ * u_cleanup() is called.
+ *
+ * @see UProperty
+ * @see UPropertyNameChoice
+ * @stable ICU 2.4
+ */
+U_STABLE const char* U_EXPORT2
+u_getPropertyValueName(UProperty property,
+ int32_t value,
+ UPropertyNameChoice nameChoice);
+
+/**
+ * Return the property value integer for a given value name, as
+ * specified in the Unicode database file PropertyValueAliases.txt.
+ * Short, long, and any other variants are recognized.
+ *
+ * Note: Some of the names in PropertyValueAliases.txt will only be
+ * recognized with UCHAR_GENERAL_CATEGORY_MASK, not
+ * UCHAR_GENERAL_CATEGORY. These include: "C" / "Other", "L" /
+ * "Letter", "LC" / "Cased_Letter", "M" / "Mark", "N" / "Number", "P"
+ * / "Punctuation", "S" / "Symbol", and "Z" / "Separator".
+ *
+ * @param property UProperty selector constant.
+ * Must be UCHAR_BINARY_START<=which<UCHAR_BINARY_LIMIT
+ * or UCHAR_INT_START<=which<UCHAR_INT_LIMIT
+ * or UCHAR_MASK_START<=which<UCHAR_MASK_LIMIT.
+ * If out of range, UCHAR_INVALID_CODE is returned.
+ *
+ * @param alias the value name to be matched. The name is compared
+ * using "loose matching" as described in
+ * PropertyValueAliases.txt.
+ *
+ * @return a value integer or UCHAR_INVALID_CODE if the given name
+ * does not match any value of the given property, or if the
+ * property is invalid. Note: U CHAR_GENERAL_CATEGORY values
+ * are not values of UCharCategory, but rather mask values
+ * produced by U_GET_GC_MASK(). This allows grouped
+ * categories such as [:L:] to be represented.
+ *
+ * @see UProperty
+ * @stable ICU 2.4
+ */
+U_STABLE int32_t U_EXPORT2
+u_getPropertyValueEnum(UProperty property,
+ const char* alias);
+
+/**
+ * Determines if the specified character is permissible as the
+ * first character in an identifier according to Unicode
+ * (The Unicode Standard, Version 3.0, chapter 5.16 Identifiers).
+ * True for characters with general categories "L" (letters) and "Nl" (letter numbers).
+ *
+ * Same as java.lang.Character.isUnicodeIdentifierStart().
+ * Same as UCHAR_ID_START
+ *
+ * @param c the code point to be tested
+ * @return TRUE if the code point may start an identifier
+ *
+ * @see UCHAR_ID_START
+ * @see u_isalpha
+ * @see u_isIDPart
+ * @stable ICU 2.0
+ */
+U_STABLE UBool U_EXPORT2
+u_isIDStart(UChar32 c);
+
+/**
+ * Determines if the specified character is permissible
+ * in an identifier according to Java.
+ * True for characters with general categories "L" (letters),
+ * "Nl" (letter numbers), "Nd" (decimal digits),
+ * "Mc" and "Mn" (combining marks), "Pc" (connecting punctuation), and
+ * u_isIDIgnorable(c).
+ *
+ * Same as java.lang.Character.isUnicodeIdentifierPart().
+ * Almost the same as Unicode's ID_Continue (UCHAR_ID_CONTINUE)
+ * except that Unicode recommends to ignore Cf which is less than
+ * u_isIDIgnorable(c).
+ *
+ * @param c the code point to be tested
+ * @return TRUE if the code point may occur in an identifier according to Java
+ *
+ * @see UCHAR_ID_CONTINUE
+ * @see u_isIDStart
+ * @see u_isIDIgnorable
+ * @stable ICU 2.0
+ */
+U_STABLE UBool U_EXPORT2
+u_isIDPart(UChar32 c);
+
+/**
+ * Determines if the specified character should be regarded
+ * as an ignorable character in an identifier,
+ * according to Java.
+ * True for characters with general category "Cf" (format controls) as well as
+ * non-whitespace ISO controls
+ * (U+0000..U+0008, U+000E..U+001B, U+007F..U+0084, U+0086..U+009F).
+ *
+ * Same as java.lang.Character.isIdentifierIgnorable()
+ * except that Java also returns TRUE for U+0085 Next Line
+ * (it omits U+0085 from whitespace ISO controls).
+ *
+ * Note that Unicode just recommends to ignore Cf (format controls).
+ *
+ * @param c the code point to be tested
+ * @return TRUE if the code point is ignorable in identifiers according to Java
+ *
+ * @see UCHAR_DEFAULT_IGNORABLE_CODE_POINT
+ * @see u_isIDStart
+ * @see u_isIDPart
+ * @stable ICU 2.0
+ */
+U_STABLE UBool U_EXPORT2
+u_isIDIgnorable(UChar32 c);
+
+/**
+ * Determines if the specified character is permissible as the
+ * first character in a Java identifier.
+ * In addition to u_isIDStart(c), true for characters with
+ * general categories "Sc" (currency symbols) and "Pc" (connecting punctuation).
+ *
+ * Same as java.lang.Character.isJavaIdentifierStart().
+ *
+ * @param c the code point to be tested
+ * @return TRUE if the code point may start a Java identifier
+ *
+ * @see u_isJavaIDPart
+ * @see u_isalpha
+ * @see u_isIDStart
+ * @stable ICU 2.0
+ */
+U_STABLE UBool U_EXPORT2
+u_isJavaIDStart(UChar32 c);
+
+/**
+ * Determines if the specified character is permissible
+ * in a Java identifier.
+ * In addition to u_isIDPart(c), true for characters with
+ * general category "Sc" (currency symbols).
+ *
+ * Same as java.lang.Character.isJavaIdentifierPart().
+ *
+ * @param c the code point to be tested
+ * @return TRUE if the code point may occur in a Java identifier
+ *
+ * @see u_isIDIgnorable
+ * @see u_isJavaIDStart
+ * @see u_isalpha
+ * @see u_isdigit
+ * @see u_isIDPart
+ * @stable ICU 2.0
+ */
+U_STABLE UBool U_EXPORT2
+u_isJavaIDPart(UChar32 c);
+
+/**
+ * The given character is mapped to its lowercase equivalent according to
+ * UnicodeData.txt; if the character has no lowercase equivalent, the character
+ * itself is returned.
+ *
+ * Same as java.lang.Character.toLowerCase().
+ *
+ * This function only returns the simple, single-code point case mapping.
+ * Full case mappings may result in zero, one or more code points and depend
+ * on context or language etc.
+ * Full case mappings are applied by the string case mapping functions,
+ * see ustring.h and the UnicodeString class.
+ *
+ * @param c the code point to be mapped
+ * @return the Simple_Lowercase_Mapping of the code point, if any;
+ * otherwise the code point itself.
+ * @stable ICU 2.0
+ */
+U_STABLE UChar32 U_EXPORT2
+u_tolower(UChar32 c);
+
+/**
+ * The given character is mapped to its uppercase equivalent according to UnicodeData.txt;
+ * if the character has no uppercase equivalent, the character itself is
+ * returned.
+ *
+ * Same as java.lang.Character.toUpperCase().
+ *
+ * This function only returns the simple, single-code point case mapping.
+ * Full case mappings may result in zero, one or more code points and depend
+ * on context or language etc.
+ * Full case mappings are applied by the string case mapping functions,
+ * see ustring.h and the UnicodeString class.
+ *
+ * @param c the code point to be mapped
+ * @return the Simple_Uppercase_Mapping of the code point, if any;
+ * otherwise the code point itself.
+ * @stable ICU 2.0
+ */
+U_STABLE UChar32 U_EXPORT2
+u_toupper(UChar32 c);
+
+/**
+ * The given character is mapped to its titlecase equivalent
+ * according to UnicodeData.txt;
+ * if none is defined, the character itself is returned.
+ *
+ * Same as java.lang.Character.toTitleCase().
+ *
+ * This function only returns the simple, single-code point case mapping.
+ * Full case mappings may result in zero, one or more code points and depend
+ * on context or language etc.
+ * Full case mappings are applied by the string case mapping functions,
+ * see ustring.h and the UnicodeString class.
+ *
+ * @param c the code point to be mapped
+ * @return the Simple_Titlecase_Mapping of the code point, if any;
+ * otherwise the code point itself.
+ * @stable ICU 2.0
+ */
+U_STABLE UChar32 U_EXPORT2
+u_totitle(UChar32 c);
+
+/** Option value for case folding: use default mappings defined in CaseFolding.txt. @stable ICU 2.0 */
+#define U_FOLD_CASE_DEFAULT 0
+
+/**
+ * Option value for case folding:
+ *
+ * Use the modified set of mappings provided in CaseFolding.txt to handle dotted I
+ * and dotless i appropriately for Turkic languages (tr, az).
+ *
+ * Before Unicode 3.2, CaseFolding.txt contains mappings marked with 'I' that
+ * are to be included for default mappings and
+ * excluded for the Turkic-specific mappings.
+ *
+ * Unicode 3.2 CaseFolding.txt instead contains mappings marked with 'T' that
+ * are to be excluded for default mappings and
+ * included for the Turkic-specific mappings.
+ *
+ * @stable ICU 2.0
+ */
+#define U_FOLD_CASE_EXCLUDE_SPECIAL_I 1
+
+/**
+ * The given character is mapped to its case folding equivalent according to
+ * UnicodeData.txt and CaseFolding.txt;
+ * if the character has no case folding equivalent, the character
+ * itself is returned.
+ *
+ * This function only returns the simple, single-code point case mapping.
+ * Full case mappings may result in zero, one or more code points and depend
+ * on context or language etc.
+ * Full case mappings are applied by the string case mapping functions,
+ * see ustring.h and the UnicodeString class.
+ *
+ * @param c the code point to be mapped
+ * @param options Either U_FOLD_CASE_DEFAULT or U_FOLD_CASE_EXCLUDE_SPECIAL_I
+ * @return the Simple_Case_Folding of the code point, if any;
+ * otherwise the code point itself.
+ * @stable ICU 2.0
+ */
+U_STABLE UChar32 U_EXPORT2
+u_foldCase(UChar32 c, uint32_t options);
+
+/**
+ * Returns the decimal digit value of the code point in the
+ * specified radix.
+ *
+ * If the radix is not in the range <code>2<=radix<=36</code> or if the
+ * value of <code>c</code> is not a valid digit in the specified
+ * radix, <code>-1</code> is returned. A character is a valid digit
+ * if at least one of the following is true:
+ * <ul>
+ * <li>The character has a decimal digit value.
+ * Such characters have the general category "Nd" (decimal digit numbers)
+ * and a Numeric_Type of Decimal.
+ * In this case the value is the character's decimal digit value.</li>
+ * <li>The character is one of the uppercase Latin letters
+ * <code>'A'</code> through <code>'Z'</code>.
+ * In this case the value is <code>c-'A'+10</code>.</li>
+ * <li>The character is one of the lowercase Latin letters
+ * <code>'a'</code> through <code>'z'</code>.
+ * In this case the value is <code>ch-'a'+10</code>.</li>
+ * <li>Latin letters from both the ASCII range (0061..007A, 0041..005A)
+ * as well as from the Fullwidth ASCII range (FF41..FF5A, FF21..FF3A)
+ * are recognized.</li>
+ * </ul>
+ *
+ * Same as java.lang.Character.digit().
+ *
+ * @param ch the code point to be tested.
+ * @param radix the radix.
+ * @return the numeric value represented by the character in the
+ * specified radix,
+ * or -1 if there is no value or if the value exceeds the radix.
+ *
+ * @see UCHAR_NUMERIC_TYPE
+ * @see u_forDigit
+ * @see u_charDigitValue
+ * @see u_isdigit
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+u_digit(UChar32 ch, int8_t radix);
+
+/**
+ * Determines the character representation for a specific digit in
+ * the specified radix. If the value of <code>radix</code> is not a
+ * valid radix, or the value of <code>digit</code> is not a valid
+ * digit in the specified radix, the null character
+ * (<code>U+0000</code>) is returned.
+ * <p>
+ * The <code>radix</code> argument is valid if it is greater than or
+ * equal to 2 and less than or equal to 36.
+ * The <code>digit</code> argument is valid if
+ * <code>0 <= digit < radix</code>.
+ * <p>
+ * If the digit is less than 10, then
+ * <code>'0' + digit</code> is returned. Otherwise, the value
+ * <code>'a' + digit - 10</code> is returned.
+ *
+ * Same as java.lang.Character.forDigit().
+ *
+ * @param digit the number to convert to a character.
+ * @param radix the radix.
+ * @return the <code>char</code> representation of the specified digit
+ * in the specified radix.
+ *
+ * @see u_digit
+ * @see u_charDigitValue
+ * @see u_isdigit
+ * @stable ICU 2.0
+ */
+U_STABLE UChar32 U_EXPORT2
+u_forDigit(int32_t digit, int8_t radix);
+
+/**
+ * Get the "age" of the code point.
+ * The "age" is the Unicode version when the code point was first
+ * designated (as a non-character or for Private Use)
+ * or assigned a character.
+ * This can be useful to avoid emitting code points to receiving
+ * processes that do not accept newer characters.
+ * The data is from the UCD file DerivedAge.txt.
+ *
+ * @param c The code point.
+ * @param versionArray The Unicode version number array, to be filled in.
+ *
+ * @stable ICU 2.1
+ */
+U_STABLE void U_EXPORT2
+u_charAge(UChar32 c, UVersionInfo versionArray);
+
+/**
+ * Gets the Unicode version information.
+ * The version array is filled in with the version information
+ * for the Unicode standard that is currently used by ICU.
+ * For example, Unicode version 3.1.1 is represented as an array with
+ * the values { 3, 1, 1, 0 }.
+ *
+ * @param versionArray an output array that will be filled in with
+ * the Unicode version number
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+u_getUnicodeVersion(UVersionInfo versionArray);
+
+/**
+ * Get the FC_NFKC_Closure property string for a character.
+ * See Unicode Standard Annex #15 for details, search for "FC_NFKC_Closure"
+ * or for "FNC": http://www.unicode.org/reports/tr15/
+ *
+ * @param c The character (code point) for which to get the FC_NFKC_Closure string.
+ * It must be <code>0<=c<=0x10ffff</code>.
+ * @param dest Destination address for copying the string.
+ * The string will be zero-terminated if possible.
+ * If there is no FC_NFKC_Closure string,
+ * then the buffer will be set to the empty string.
+ * @param destCapacity <code>==sizeof(dest)</code>
+ * @param pErrorCode Pointer to a UErrorCode variable.
+ * @return The length of the string, or 0 if there is no FC_NFKC_Closure string for this character.
+ * If the destCapacity is less than or equal to the length, then the buffer
+ * contains the truncated name and the returned length indicates the full
+ * length of the name.
+ * The length does not include the zero-termination.
+ *
+ * @stable ICU 2.2
+ */
+U_STABLE int32_t U_EXPORT2
+u_getFC_NFKC_Closure(UChar32 c, UChar *dest, int32_t destCapacity, UErrorCode *pErrorCode);
+
+U_CDECL_END
+
+#endif /*_UCHAR*/
+/*eof*/
diff --git a/Source/JavaScriptCore/icu/unicode/ucnv.h b/Source/JavaScriptCore/icu/unicode/ucnv.h
new file mode 100644
index 0000000..a042f7a
--- /dev/null
+++ b/Source/JavaScriptCore/icu/unicode/ucnv.h
@@ -0,0 +1,1817 @@
+/*
+**********************************************************************
+* Copyright (C) 1999-2004, International Business Machines
+* Corporation and others. All Rights Reserved.
+**********************************************************************
+ * ucnv.h:
+ * External APIs for the ICU's codeset conversion library
+ * Bertrand A. Damiba
+ *
+ * Modification History:
+ *
+ * Date Name Description
+ * 04/04/99 helena Fixed internal header inclusion.
+ * 05/11/00 helena Added setFallback and usesFallback APIs.
+ * 06/29/2000 helena Major rewrite of the callback APIs.
+ * 12/07/2000 srl Update of documentation
+ */
+
+/**
+ * \file
+ * \brief C API: Character conversion
+ *
+ * <h2>Character Conversion C API</h2>
+ *
+ * <p>This API is used to convert codepage or character encoded data to and
+ * from UTF-16. You can open a converter with {@link ucnv_open() }. With that
+ * converter, you can get its properties, set options, convert your data and
+ * close the converter.</p>
+ *
+ * <p>Since many software programs recogize different converter names for
+ * different types of converters, there are other functions in this API to
+ * iterate over the converter aliases. The functions {@link ucnv_getAvailableName() },
+ * {@link ucnv_getAlias() } and {@link ucnv_getStandardName() } are some of the
+ * more frequently used alias functions to get this information.</p>
+ *
+ * <p>When a converter encounters an illegal, irregular, invalid or unmappable character
+ * its default behavior is to use a substitution character to replace the
+ * bad byte sequence. This behavior can be changed by using {@link ucnv_getFromUCallBack() }
+ * or {@link ucnv_getToUCallBack() } on the converter. The header ucnv_err.h defines
+ * many other callback actions that can be used instead of a character substitution.</p>
+ *
+ * <p>More information about this API can be found in our
+ * <a href="http://oss.software.ibm.com/icu/userguide/conversion.html">User's
+ * Guide</a>.</p>
+ */
+
+#ifndef UCNV_H
+#define UCNV_H
+
+#include "unicode/ucnv_err.h"
+#include "unicode/uenum.h"
+
+#ifndef __USET_H__
+
+/**
+ * USet is the C API type for Unicode sets.
+ * It is forward-declared here to avoid including the header file if related
+ * conversion APIs are not used.
+ * See unicode/uset.h
+ *
+ * @see ucnv_getUnicodeSet
+ * @stable ICU 2.6
+ */
+struct USet;
+/** @stable ICU 2.6 */
+typedef struct USet USet;
+
+#endif
+
+#if !UCONFIG_NO_CONVERSION
+
+U_CDECL_BEGIN
+
+/** Maximum length of a converter name including the terminating NULL @stable ICU 2.0 */
+#define UCNV_MAX_CONVERTER_NAME_LENGTH 60
+/** Maximum length of a converter name including path and terminating NULL @stable ICU 2.0 */
+#define UCNV_MAX_FULL_FILE_NAME_LENGTH (600+UCNV_MAX_CONVERTER_NAME_LENGTH)
+
+/** Shift in for EBDCDIC_STATEFUL and iso2022 states @stable ICU 2.0 */
+#define UCNV_SI 0x0F
+/** Shift out for EBDCDIC_STATEFUL and iso2022 states @stable ICU 2.0 */
+#define UCNV_SO 0x0E
+
+/**
+ * Enum for specifying basic types of converters
+ * @see ucnv_getType
+ * @stable ICU 2.0
+ */
+typedef enum {
+ UCNV_UNSUPPORTED_CONVERTER = -1,
+ UCNV_SBCS = 0,
+ UCNV_DBCS = 1,
+ UCNV_MBCS = 2,
+ UCNV_LATIN_1 = 3,
+ UCNV_UTF8 = 4,
+ UCNV_UTF16_BigEndian = 5,
+ UCNV_UTF16_LittleEndian = 6,
+ UCNV_UTF32_BigEndian = 7,
+ UCNV_UTF32_LittleEndian = 8,
+ UCNV_EBCDIC_STATEFUL = 9,
+ UCNV_ISO_2022 = 10,
+
+ UCNV_LMBCS_1 = 11,
+ UCNV_LMBCS_2,
+ UCNV_LMBCS_3,
+ UCNV_LMBCS_4,
+ UCNV_LMBCS_5,
+ UCNV_LMBCS_6,
+ UCNV_LMBCS_8,
+ UCNV_LMBCS_11,
+ UCNV_LMBCS_16,
+ UCNV_LMBCS_17,
+ UCNV_LMBCS_18,
+ UCNV_LMBCS_19,
+ UCNV_LMBCS_LAST = UCNV_LMBCS_19,
+ UCNV_HZ,
+ UCNV_SCSU,
+ UCNV_ISCII,
+ UCNV_US_ASCII,
+ UCNV_UTF7,
+ UCNV_BOCU1,
+ UCNV_UTF16,
+ UCNV_UTF32,
+ UCNV_CESU8,
+ UCNV_IMAP_MAILBOX,
+
+ /* Number of converter types for which we have conversion routines. */
+ UCNV_NUMBER_OF_SUPPORTED_CONVERTER_TYPES
+
+} UConverterType;
+
+/**
+ * Enum for specifying which platform a converter ID refers to.
+ * The use of platform/CCSID is not recommended. See ucnv_openCCSID().
+ *
+ * @see ucnv_getPlatform
+ * @see ucnv_openCCSID
+ * @see ucnv_getCCSID
+ * @stable ICU 2.0
+ */
+typedef enum {
+ UCNV_UNKNOWN = -1,
+ UCNV_IBM = 0
+} UConverterPlatform;
+
+/**
+ * Function pointer for error callback in the codepage to unicode direction.
+ * Called when an error has occured in conversion to unicode, or on open/close of the callback (see reason).
+ * @param context Pointer to the callback's private data
+ * @param args Information about the conversion in progress
+ * @param codeUnits Points to 'length' bytes of the concerned codepage sequence
+ * @param length Size (in bytes) of the concerned codepage sequence
+ * @param reason Defines the reason the callback was invoked
+ * @see ucnv_setToUCallBack
+ * @see UConverterToUnicodeArgs
+ * @stable ICU 2.0
+ */
+typedef void (U_EXPORT2 *UConverterToUCallback) (
+ const void* context,
+ UConverterToUnicodeArgs *args,
+ const char *codeUnits,
+ int32_t length,
+ UConverterCallbackReason reason,
+ UErrorCode *);
+
+/**
+ * Function pointer for error callback in the unicode to codepage direction.
+ * Called when an error has occured in conversion from unicode, or on open/close of the callback (see reason).
+ * @param context Pointer to the callback's private data
+ * @param args Information about the conversion in progress
+ * @param codeUnits Points to 'length' UChars of the concerned Unicode sequence
+ * @param length Size (in bytes) of the concerned codepage sequence
+ * @param codePoint Single UChar32 (UTF-32) containing the concerend Unicode codepoint.
+ * @param reason Defines the reason the callback was invoked
+ * @see ucnv_setFromUCallBack
+ * @stable ICU 2.0
+ */
+typedef void (U_EXPORT2 *UConverterFromUCallback) (
+ const void* context,
+ UConverterFromUnicodeArgs *args,
+ const UChar* codeUnits,
+ int32_t length,
+ UChar32 codePoint,
+ UConverterCallbackReason reason,
+ UErrorCode *);
+
+U_CDECL_END
+
+/**
+ * Character that separates converter names from options and options from each other.
+ * @see ucnv_open
+ * @stable ICU 2.0
+ */
+#define UCNV_OPTION_SEP_CHAR ','
+
+/**
+ * String version of UCNV_OPTION_SEP_CHAR.
+ * @see ucnv_open
+ * @stable ICU 2.0
+ */
+#define UCNV_OPTION_SEP_STRING ","
+
+/**
+ * Character that separates a converter option from its value.
+ * @see ucnv_open
+ * @stable ICU 2.0
+ */
+#define UCNV_VALUE_SEP_CHAR '='
+
+/**
+ * String version of UCNV_VALUE_SEP_CHAR.
+ * @see ucnv_open
+ * @stable ICU 2.0
+ */
+#define UCNV_VALUE_SEP_STRING "="
+
+/**
+ * Converter option for specifying a locale.
+ * For example, ucnv_open("SCSU,locale=ja", &errorCode);
+ * See convrtrs.txt.
+ *
+ * @see ucnv_open
+ * @stable ICU 2.0
+ */
+#define UCNV_LOCALE_OPTION_STRING ",locale="
+
+/**
+ * Converter option for specifying a version selector (0..9) for some converters.
+ * For example, ucnv_open("UTF-7,version=1", &errorCode);
+ * See convrtrs.txt.
+ *
+ * @see ucnv_open
+ * @stable ICU 2.4
+ */
+#define UCNV_VERSION_OPTION_STRING ",version="
+
+/**
+ * Converter option for EBCDIC SBCS or mixed-SBCS/DBCS (stateful) codepages.
+ * Swaps Unicode mappings for EBCDIC LF and NL codes, as used on
+ * S/390 (z/OS) Unix System Services (Open Edition).
+ * For example, ucnv_open("ibm-1047,swaplfnl", &errorCode);
+ * See convrtrs.txt.
+ *
+ * @see ucnv_open
+ * @stable ICU 2.4
+ */
+#define UCNV_SWAP_LFNL_OPTION_STRING ",swaplfnl"
+
+/**
+ * Do a fuzzy compare of a two converter/alias names. The comparison
+ * is case-insensitive. It also ignores the characters '-', '_', and
+ * ' ' (dash, underscore, and space). Thus the strings "UTF-8",
+ * "utf_8", and "Utf 8" are exactly equivalent.
+ *
+ * @param name1 a converter name or alias, zero-terminated
+ * @param name2 a converter name or alias, zero-terminated
+ * @return 0 if the names match, or a negative value if the name1
+ * lexically precedes name2, or a positive value if the name1
+ * lexically follows name2.
+ * @stable ICU 2.0
+ */
+U_STABLE int U_EXPORT2
+ucnv_compareNames(const char *name1, const char *name2);
+
+
+/**
+ * Creates a UConverter object with the names specified as a C string.
+ * The actual name will be resolved with the alias file
+ * using a case-insensitive string comparison that ignores
+ * the delimiters '-', '_', and ' ' (dash, underscore, and space).
+ * E.g., the names "UTF8", "utf-8", and "Utf 8" are all equivalent.
+ * If <code>NULL</code> is passed for the converter name, it will create one with the
+ * getDefaultName return value.
+ *
+ * <p>A converter name for ICU 1.5 and above may contain options
+ * like a locale specification to control the specific behavior of
+ * the newly instantiated converter.
+ * The meaning of the options depends on the particular converter.
+ * If an option is not defined for or recognized by a given converter, then it is ignored.</p>
+ *
+ * <p>Options are appended to the converter name string, with a
+ * <code>UCNV_OPTION_SEP_CHAR</code> between the name and the first option and
+ * also between adjacent options.</p>
+ *
+ * <p>If the alias is ambiguous, then the preferred converter is used
+ * and the status is set to U_AMBIGUOUS_ALIAS_WARNING.</p>
+ *
+ * <p>The conversion behavior and names can vary between platforms. ICU may
+ * convert some characters differently from other platforms. Details on this topic
+ * are in the <a href="http://oss.software.ibm.com/icu/userguide/conversion.html">User's
+ * Guide</a>.</p>
+ *
+ * @param converterName Name of the uconv table, may have options appended
+ * @param err outgoing error status <TT>U_MEMORY_ALLOCATION_ERROR, U_FILE_ACCESS_ERROR</TT>
+ * @return the created Unicode converter object, or <TT>NULL</TT> if an error occured
+ * @see ucnv_openU
+ * @see ucnv_openCCSID
+ * @see ucnv_close
+ * @stable ICU 2.0
+ */
+U_STABLE UConverter* U_EXPORT2
+ucnv_open(const char *converterName, UErrorCode *err);
+
+
+/**
+ * Creates a Unicode converter with the names specified as unicode string.
+ * The name should be limited to the ASCII-7 alphanumerics range.
+ * The actual name will be resolved with the alias file
+ * using a case-insensitive string comparison that ignores
+ * the delimiters '-', '_', and ' ' (dash, underscore, and space).
+ * E.g., the names "UTF8", "utf-8", and "Utf 8" are all equivalent.
+ * If <TT>NULL</TT> is passed for the converter name, it will create
+ * one with the ucnv_getDefaultName() return value.
+ * If the alias is ambiguous, then the preferred converter is used
+ * and the status is set to U_AMBIGUOUS_ALIAS_WARNING.
+ * @param name : name of the uconv table in a zero terminated
+ * Unicode string
+ * @param err outgoing error status <TT>U_MEMORY_ALLOCATION_ERROR,
+ * U_FILE_ACCESS_ERROR</TT>
+ * @return the created Unicode converter object, or <TT>NULL</TT> if an
+ * error occured
+ * @see ucnv_open
+ * @see ucnv_openCCSID
+ * @see ucnv_close
+ * @see ucnv_getDefaultName
+ * @stable ICU 2.0
+ */
+U_STABLE UConverter* U_EXPORT2
+ucnv_openU(const UChar *name,
+ UErrorCode *err);
+
+/**
+ * Creates a UConverter object from a CCSID number and platform pair.
+ * Note that the usefulness of this function is limited to platforms with numeric
+ * encoding IDs. Only IBM and Microsoft platforms use numeric (16-bit) identifiers for
+ * encodings.
+ *
+ * In addition, IBM CCSIDs and Unicode conversion tables are not 1:1 related.
+ * For many IBM CCSIDs there are multiple (up to six) Unicode conversion tables, and
+ * for some Unicode conversion tables there are multiple CCSIDs.
+ * Some "alternate" Unicode conversion tables are provided by the
+ * IBM CDRA conversion table registry.
+ * The most prominent example of a systematic modification of conversion tables that is
+ * not provided in the form of conversion table files in the repository is
+ * that S/390 Unix System Services swaps the codes for Line Feed and New Line in all
+ * EBCDIC codepages, which requires such a swap in the Unicode conversion tables as well.
+ *
+ * Only IBM default conversion tables are accessible with ucnv_openCCSID().
+ * ucnv_getCCSID() will return the same CCSID for all conversion tables that are associated
+ * with that CCSID.
+ *
+ * Currently, the only "platform" supported in the ICU converter API is UCNV_IBM.
+ *
+ * In summary, the use of CCSIDs and the associated API functions is not recommended.
+ *
+ * In order to open a converter with the default IBM CDRA Unicode conversion table,
+ * you can use this function or use the prefix "ibm-":
+ * \code
+ * char name[20];
+ * sprintf(name, "ibm-%hu", ccsid);
+ * cnv=ucnv_open(name, &errorCode);
+ * \endcode
+ *
+ * In order to open a converter with the IBM S/390 Unix System Services variant
+ * of a Unicode/EBCDIC conversion table,
+ * you can use the prefix "ibm-" together with the option string UCNV_SWAP_LFNL_OPTION_STRING:
+ * \code
+ * char name[20];
+ * sprintf(name, "ibm-%hu" UCNV_SWAP_LFNL_OPTION_STRING, ccsid);
+ * cnv=ucnv_open(name, &errorCode);
+ * \endcode
+ *
+ * In order to open a converter from a Microsoft codepage number, use the prefix "cp":
+ * \code
+ * char name[20];
+ * sprintf(name, "cp%hu", codepageID);
+ * cnv=ucnv_open(name, &errorCode);
+ * \endcode
+ *
+ * If the alias is ambiguous, then the preferred converter is used
+ * and the status is set to U_AMBIGUOUS_ALIAS_WARNING.
+ *
+ * @param codepage codepage number to create
+ * @param platform the platform in which the codepage number exists
+ * @param err error status <TT>U_MEMORY_ALLOCATION_ERROR, U_FILE_ACCESS_ERROR</TT>
+ * @return the created Unicode converter object, or <TT>NULL</TT> if an error
+ * occured.
+ * @see ucnv_open
+ * @see ucnv_openU
+ * @see ucnv_close
+ * @see ucnv_getCCSID
+ * @see ucnv_getPlatform
+ * @see UConverterPlatform
+ * @stable ICU 2.0
+ */
+U_STABLE UConverter* U_EXPORT2
+ucnv_openCCSID(int32_t codepage,
+ UConverterPlatform platform,
+ UErrorCode * err);
+
+/**
+ * <p>Creates a UConverter object specified from a packageName and a converterName.</p>
+ *
+ * <p>The packageName and converterName must point to an ICU udata object, as defined by
+ * <code> udata_open( packageName, "cnv", converterName, err) </code> or equivalent.
+ * Typically, packageName will refer to a (.dat) file, or to a package registered with
+ * udata_setAppData().</p>
+ *
+ * <p>The name will NOT be looked up in the alias mechanism, nor will the converter be
+ * stored in the converter cache or the alias table. The only way to open further converters
+ * is call this function multiple times, or use the ucnv_safeClone() function to clone a
+ * 'master' converter.</p>
+ *
+ * <p>A future version of ICU may add alias table lookups and/or caching
+ * to this function.</p>
+ *
+ * <p>Example Use:
+ * <code>cnv = ucnv_openPackage("myapp", "myconverter", &err);</code>
+ * </p>
+ *
+ * @param packageName name of the package (equivalent to 'path' in udata_open() call)
+ * @param converterName name of the data item to be used, without suffix.
+ * @param err outgoing error status <TT>U_MEMORY_ALLOCATION_ERROR, U_FILE_ACCESS_ERROR</TT>
+ * @return the created Unicode converter object, or <TT>NULL</TT> if an error occured
+ * @see udata_open
+ * @see ucnv_open
+ * @see ucnv_safeClone
+ * @see ucnv_close
+ * @stable ICU 2.2
+ */
+U_STABLE UConverter* U_EXPORT2
+ucnv_openPackage(const char *packageName, const char *converterName, UErrorCode *err);
+
+/**
+ * Thread safe cloning operation
+ * @param cnv converter to be cloned
+ * @param stackBuffer user allocated space for the new clone. If NULL new memory will be allocated.
+ * If buffer is not large enough, new memory will be allocated.
+ * Clients can use the U_CNV_SAFECLONE_BUFFERSIZE. This will probably be enough to avoid memory allocations.
+ * @param pBufferSize pointer to size of allocated space.
+ * If *pBufferSize == 0, a sufficient size for use in cloning will
+ * be returned ('pre-flighting')
+ * If *pBufferSize is not enough for a stack-based safe clone,
+ * new memory will be allocated.
+ * @param status to indicate whether the operation went on smoothly or there were errors
+ * An informational status value, U_SAFECLONE_ALLOCATED_ERROR, is used if any allocations were necessary.
+ * @return pointer to the new clone
+ * @stable ICU 2.0
+ */
+U_STABLE UConverter * U_EXPORT2
+ucnv_safeClone(const UConverter *cnv,
+ void *stackBuffer,
+ int32_t *pBufferSize,
+ UErrorCode *status);
+
+/**
+ * \def U_CNV_SAFECLONE_BUFFERSIZE
+ * Definition of a buffer size that is designed to be large enough for
+ * converters to be cloned with ucnv_safeClone().
+ * @stable ICU 2.0
+ */
+#define U_CNV_SAFECLONE_BUFFERSIZE 1024
+
+/**
+ * Deletes the unicode converter and releases resources associated
+ * with just this instance.
+ * Does not free up shared converter tables.
+ *
+ * @param converter the converter object to be deleted
+ * @see ucnv_open
+ * @see ucnv_openU
+ * @see ucnv_openCCSID
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+ucnv_close(UConverter * converter);
+
+/**
+ * Fills in the output parameter, subChars, with the substitution characters
+ * as multiple bytes.
+ *
+ * @param converter the Unicode converter
+ * @param subChars the subsitution characters
+ * @param len on input the capacity of subChars, on output the number
+ * of bytes copied to it
+ * @param err the outgoing error status code.
+ * If the substitution character array is too small, an
+ * <TT>U_INDEX_OUTOFBOUNDS_ERROR</TT> will be returned.
+ * @see ucnv_setSubstChars
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+ucnv_getSubstChars(const UConverter *converter,
+ char *subChars,
+ int8_t *len,
+ UErrorCode *err);
+
+/**
+ * Sets the substitution chars when converting from unicode to a codepage. The
+ * substitution is specified as a string of 1-4 bytes, and may contain
+ * <TT>NULL</TT> byte.
+ * @param converter the Unicode converter
+ * @param subChars the substitution character byte sequence we want set
+ * @param len the number of bytes in subChars
+ * @param err the error status code. <TT>U_INDEX_OUTOFBOUNDS_ERROR </TT> if
+ * len is bigger than the maximum number of bytes allowed in subchars
+ * @see ucnv_getSubstChars
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+ucnv_setSubstChars(UConverter *converter,
+ const char *subChars,
+ int8_t len,
+ UErrorCode *err);
+
+/**
+ * Fills in the output parameter, errBytes, with the error characters from the
+ * last failing conversion.
+ *
+ * @param converter the Unicode converter
+ * @param errBytes the codepage bytes which were in error
+ * @param len on input the capacity of errBytes, on output the number of
+ * bytes which were copied to it
+ * @param err the error status code.
+ * If the substitution character array is too small, an
+ * <TT>U_INDEX_OUTOFBOUNDS_ERROR</TT> will be returned.
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+ucnv_getInvalidChars(const UConverter *converter,
+ char *errBytes,
+ int8_t *len,
+ UErrorCode *err);
+
+/**
+ * Fills in the output parameter, errChars, with the error characters from the
+ * last failing conversion.
+ *
+ * @param converter the Unicode converter
+ * @param errUChars the UChars which were in error
+ * @param len on input the capacity of errUChars, on output the number of
+ * UChars which were copied to it
+ * @param err the error status code.
+ * If the substitution character array is too small, an
+ * <TT>U_INDEX_OUTOFBOUNDS_ERROR</TT> will be returned.
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+ucnv_getInvalidUChars(const UConverter *converter,
+ UChar *errUChars,
+ int8_t *len,
+ UErrorCode *err);
+
+/**
+ * Resets the state of a converter to the default state. This is used
+ * in the case of an error, to restart a conversion from a known default state.
+ * It will also empty the internal output buffers.
+ * @param converter the Unicode converter
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+ucnv_reset(UConverter *converter);
+
+/**
+ * Resets the to-Unicode part of a converter state to the default state.
+ * This is used in the case of an error to restart a conversion to
+ * Unicode to a known default state. It will also empty the internal
+ * output buffers used for the conversion to Unicode codepoints.
+ * @param converter the Unicode converter
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+ucnv_resetToUnicode(UConverter *converter);
+
+/**
+ * Resets the from-Unicode part of a converter state to the default state.
+ * This is used in the case of an error to restart a conversion from
+ * Unicode to a known default state. It will also empty the internal output
+ * buffers used for the conversion from Unicode codepoints.
+ * @param converter the Unicode converter
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+ucnv_resetFromUnicode(UConverter *converter);
+
+/**
+ * Returns the maximum number of bytes that are output per UChar in conversion
+ * from Unicode using this converter.
+ * The returned number can be used with UCNV_GET_MAX_BYTES_FOR_STRING
+ * to calculate the size of a target buffer for conversion from Unicode.
+ *
+ * Note: Before ICU 2.8, this function did not return reliable numbers for
+ * some stateful converters (EBCDIC_STATEFUL, ISO-2022) and LMBCS.
+ *
+ * This number may not be the same as the maximum number of bytes per
+ * "conversion unit". In other words, it may not be the intuitively expected
+ * number of bytes per character that would be published for a charset,
+ * and may not fulfill any other purpose than the allocation of an output
+ * buffer of guaranteed sufficient size for a given input length and converter.
+ *
+ * Examples for special cases that are taken into account:
+ * - Supplementary code points may convert to more bytes than BMP code points.
+ * This function returns bytes per UChar (UTF-16 code unit), not per
+ * Unicode code point, for efficient buffer allocation.
+ * - State-shifting output (SI/SO, escapes, etc.) from stateful converters.
+ * - When m input UChars are converted to n output bytes, then the maximum m/n
+ * is taken into account.
+ *
+ * The number returned here does not take into account
+ * (see UCNV_GET_MAX_BYTES_FOR_STRING):
+ * - callbacks which output more than one charset character sequence per call,
+ * like escape callbacks
+ * - initial and final non-character bytes that are output by some converters
+ * (automatic BOMs, initial escape sequence, final SI, etc.)
+ *
+ * Examples for returned values:
+ * - SBCS charsets: 1
+ * - Shift-JIS: 2
+ * - UTF-16: 2 (2 per BMP, 4 per surrogate _pair_, BOM not counted)
+ * - UTF-8: 3 (3 per BMP, 4 per surrogate _pair_)
+ * - EBCDIC_STATEFUL (EBCDIC mixed SBCS/DBCS): 3 (SO + DBCS)
+ * - ISO-2022: 3 (always outputs UTF-8)
+ * - ISO-2022-JP: 6 (4-byte escape sequences + DBCS)
+ * - ISO-2022-CN: 8 (4-byte designator sequences + 2-byte SS2/SS3 + DBCS)
+ *
+ * @param converter The Unicode converter.
+ * @return The maximum number of bytes per UChar that are output by ucnv_fromUnicode(),
+ * to be used together with UCNV_GET_MAX_BYTES_FOR_STRING for buffer allocation.
+ *
+ * @see UCNV_GET_MAX_BYTES_FOR_STRING
+ * @see ucnv_getMinCharSize
+ * @stable ICU 2.0
+ */
+U_STABLE int8_t U_EXPORT2
+ucnv_getMaxCharSize(const UConverter *converter);
+
+#ifndef U_HIDE_DRAFT_API
+
+/**
+ * Calculates the size of a buffer for conversion from Unicode to a charset.
+ * The calculated size is guaranteed to be sufficient for this conversion.
+ *
+ * It takes into account initial and final non-character bytes that are output
+ * by some converters.
+ * It does not take into account callbacks which output more than one charset
+ * character sequence per call, like escape callbacks.
+ * The default (substitution) callback only outputs one charset character sequence.
+ *
+ * @param length Number of UChars to be converted.
+ * @param maxCharSize Return value from ucnv_getMaxCharSize() for the converter
+ * that will be used.
+ * @return Size of a buffer that will be large enough to hold the output bytes of
+ * converting length UChars with the converter that returned the maxCharSize.
+ *
+ * @see ucnv_getMaxCharSize
+ * @draft ICU 2.8
+ */
+#define UCNV_GET_MAX_BYTES_FOR_STRING(length, maxCharSize) \
+ (((int32_t)(length)+10)*(int32_t)(maxCharSize))
+
+#endif /*U_HIDE_DRAFT_API*/
+
+/**
+ * Returns the minimum byte length for characters in this codepage.
+ * This is usually either 1 or 2.
+ * @param converter the Unicode converter
+ * @return the minimum number of bytes allowed by this particular converter
+ * @see ucnv_getMaxCharSize
+ * @stable ICU 2.0
+ */
+U_STABLE int8_t U_EXPORT2
+ucnv_getMinCharSize(const UConverter *converter);
+
+/**
+ * Returns the display name of the converter passed in based on the Locale
+ * passed in. If the locale contains no display name, the internal ASCII
+ * name will be filled in.
+ *
+ * @param converter the Unicode converter.
+ * @param displayLocale is the specific Locale we want to localised for
+ * @param displayName user provided buffer to be filled in
+ * @param displayNameCapacity size of displayName Buffer
+ * @param err error status code
+ * @return displayNameLength number of UChar needed in displayName
+ * @see ucnv_getName
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+ucnv_getDisplayName(const UConverter *converter,
+ const char *displayLocale,
+ UChar *displayName,
+ int32_t displayNameCapacity,
+ UErrorCode *err);
+
+/**
+ * Gets the internal, canonical name of the converter (zero-terminated).
+ * The lifetime of the returned string will be that of the converter
+ * passed to this function.
+ * @param converter the Unicode converter
+ * @param err UErrorCode status
+ * @return the internal name of the converter
+ * @see ucnv_getDisplayName
+ * @stable ICU 2.0
+ */
+U_STABLE const char * U_EXPORT2
+ucnv_getName(const UConverter *converter, UErrorCode *err);
+
+/**
+ * Gets a codepage number associated with the converter. This is not guaranteed
+ * to be the one used to create the converter. Some converters do not represent
+ * platform registered codepages and return zero for the codepage number.
+ * The error code fill-in parameter indicates if the codepage number
+ * is available.
+ * Does not check if the converter is <TT>NULL</TT> or if converter's data
+ * table is <TT>NULL</TT>.
+ *
+ * Important: The use of CCSIDs is not recommended because it is limited
+ * to only two platforms in principle and only one (UCNV_IBM) in the current
+ * ICU converter API.
+ * Also, CCSIDs are insufficient to identify IBM Unicode conversion tables precisely.
+ * For more details see ucnv_openCCSID().
+ *
+ * @param converter the Unicode converter
+ * @param err the error status code.
+ * @return If any error occurrs, -1 will be returned otherwise, the codepage number
+ * will be returned
+ * @see ucnv_openCCSID
+ * @see ucnv_getPlatform
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+ucnv_getCCSID(const UConverter *converter,
+ UErrorCode *err);
+
+/**
+ * Gets a codepage platform associated with the converter. Currently,
+ * only <TT>UCNV_IBM</TT> will be returned.
+ * Does not test if the converter is <TT>NULL</TT> or if converter's data
+ * table is <TT>NULL</TT>.
+ * @param converter the Unicode converter
+ * @param err the error status code.
+ * @return The codepage platform
+ * @stable ICU 2.0
+ */
+U_STABLE UConverterPlatform U_EXPORT2
+ucnv_getPlatform(const UConverter *converter,
+ UErrorCode *err);
+
+/**
+ * Gets the type of the converter
+ * e.g. SBCS, MBCS, DBCS, UTF8, UTF16_BE, UTF16_LE, ISO_2022,
+ * EBCDIC_STATEFUL, LATIN_1
+ * @param converter a valid, opened converter
+ * @return the type of the converter
+ * @stable ICU 2.0
+ */
+U_STABLE UConverterType U_EXPORT2
+ucnv_getType(const UConverter * converter);
+
+/**
+ * Gets the "starter" (lead) bytes for converters of type MBCS.
+ * Will fill in an <TT>U_ILLEGAL_ARGUMENT_ERROR</TT> if converter passed in
+ * is not MBCS. Fills in an array of type UBool, with the value of the byte
+ * as offset to the array. For example, if (starters[0x20] == TRUE) at return,
+ * it means that the byte 0x20 is a starter byte in this converter.
+ * Context pointers are always owned by the caller.
+ *
+ * @param converter a valid, opened converter of type MBCS
+ * @param starters an array of size 256 to be filled in
+ * @param err error status, <TT>U_ILLEGAL_ARGUMENT_ERROR</TT> if the
+ * converter is not a type which can return starters.
+ * @see ucnv_getType
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+ucnv_getStarters(const UConverter* converter,
+ UBool starters[256],
+ UErrorCode* err);
+
+
+/**
+ * Selectors for Unicode sets that can be returned by ucnv_getUnicodeSet().
+ * @see ucnv_getUnicodeSet
+ * @stable ICU 2.6
+ */
+typedef enum UConverterUnicodeSet {
+ /** Select the set of roundtrippable Unicode code points. @stable ICU 2.6 */
+ UCNV_ROUNDTRIP_SET,
+ /** Number of UConverterUnicodeSet selectors. @stable ICU 2.6 */
+ UCNV_SET_COUNT
+} UConverterUnicodeSet;
+
+
+/**
+ * Returns the set of Unicode code points that can be converted by an ICU converter.
+ *
+ * The current implementation returns only one kind of set (UCNV_ROUNDTRIP_SET):
+ * The set of all Unicode code points that can be roundtrip-converted
+ * (converted without any data loss) with the converter.
+ * This set will not include code points that have fallback mappings
+ * or are only the result of reverse fallback mappings.
+ * See UTR #22 "Character Mapping Markup Language"
+ * at http://www.unicode.org/reports/tr22/
+ *
+ * This is useful for example for
+ * - checking that a string or document can be roundtrip-converted with a converter,
+ * without/before actually performing the conversion
+ * - testing if a converter can be used for text for typical text for a certain locale,
+ * by comparing its roundtrip set with the set of ExemplarCharacters from
+ * ICU's locale data or other sources
+ *
+ * In the future, there may be more UConverterUnicodeSet choices to select
+ * sets with different properties.
+ *
+ * @param cnv The converter for which a set is requested.
+ * @param setFillIn A valid USet *. It will be cleared by this function before
+ * the converter's specific set is filled into the USet.
+ * @param whichSet A UConverterUnicodeSet selector;
+ * currently UCNV_ROUNDTRIP_SET is the only supported value.
+ * @param pErrorCode ICU error code in/out parameter.
+ * Must fulfill U_SUCCESS before the function call.
+ *
+ * @see UConverterUnicodeSet
+ * @see uset_open
+ * @see uset_close
+ * @stable ICU 2.6
+ */
+U_STABLE void U_EXPORT2
+ucnv_getUnicodeSet(const UConverter *cnv,
+ USet *setFillIn,
+ UConverterUnicodeSet whichSet,
+ UErrorCode *pErrorCode);
+
+/**
+ * Gets the current calback function used by the converter when an illegal
+ * or invalid codepage sequence is found.
+ * Context pointers are always owned by the caller.
+ *
+ * @param converter the unicode converter
+ * @param action fillin: returns the callback function pointer
+ * @param context fillin: returns the callback's private void* context
+ * @see ucnv_setToUCallBack
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+ucnv_getToUCallBack (const UConverter * converter,
+ UConverterToUCallback *action,
+ const void **context);
+
+/**
+ * Gets the current callback function used by the converter when illegal
+ * or invalid Unicode sequence is found.
+ * Context pointers are always owned by the caller.
+ *
+ * @param converter the unicode converter
+ * @param action fillin: returns the callback function pointer
+ * @param context fillin: returns the callback's private void* context
+ * @see ucnv_setFromUCallBack
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+ucnv_getFromUCallBack (const UConverter * converter,
+ UConverterFromUCallback *action,
+ const void **context);
+
+/**
+ * Changes the callback function used by the converter when
+ * an illegal or invalid sequence is found.
+ * Context pointers are always owned by the caller.
+ * Predefined actions and contexts can be found in the ucnv_err.h header.
+ *
+ * @param converter the unicode converter
+ * @param newAction the new callback function
+ * @param newContext the new toUnicode callback context pointer. This can be NULL.
+ * @param oldAction fillin: returns the old callback function pointer. This can be NULL.
+ * @param oldContext fillin: returns the old callback's private void* context. This can be NULL.
+ * @param err The error code status
+ * @see ucnv_getToUCallBack
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+ucnv_setToUCallBack (UConverter * converter,
+ UConverterToUCallback newAction,
+ const void* newContext,
+ UConverterToUCallback *oldAction,
+ const void** oldContext,
+ UErrorCode * err);
+
+/**
+ * Changes the current callback function used by the converter when
+ * an illegal or invalid sequence is found.
+ * Context pointers are always owned by the caller.
+ * Predefined actions and contexts can be found in the ucnv_err.h header.
+ *
+ * @param converter the unicode converter
+ * @param newAction the new callback function
+ * @param newContext the new fromUnicode callback context pointer. This can be NULL.
+ * @param oldAction fillin: returns the old callback function pointer. This can be NULL.
+ * @param oldContext fillin: returns the old callback's private void* context. This can be NULL.
+ * @param err The error code status
+ * @see ucnv_getFromUCallBack
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+ucnv_setFromUCallBack (UConverter * converter,
+ UConverterFromUCallback newAction,
+ const void *newContext,
+ UConverterFromUCallback *oldAction,
+ const void **oldContext,
+ UErrorCode * err);
+
+/**
+ * Converts an array of unicode characters to an array of codepage
+ * characters. This function is optimized for converting a continuous
+ * stream of data in buffer-sized chunks, where the entire source and
+ * target does not fit in available buffers.
+ *
+ * The source pointer is an in/out parameter. It starts out pointing where the
+ * conversion is to begin, and ends up pointing after the last UChar consumed.
+ *
+ * Target similarly starts out pointer at the first available byte in the output
+ * buffer, and ends up pointing after the last byte written to the output.
+ *
+ * The converter always attempts to consume the entire source buffer, unless
+ * (1.) the target buffer is full, or (2.) a failing error is returned from the
+ * current callback function. When a successful error status has been
+ * returned, it means that all of the source buffer has been
+ * consumed. At that point, the caller should reset the source and
+ * sourceLimit pointers to point to the next chunk.
+ *
+ * At the end of the stream (flush==TRUE), the input is completely consumed
+ * when *source==sourceLimit and no error code is set.
+ * The converter object is then automatically reset by this function.
+ * (This means that a converter need not be reset explicitly between data
+ * streams if it finishes the previous stream without errors.)
+ *
+ * This is a <I>stateful</I> conversion. Additionally, even when all source data has
+ * been consumed, some data may be in the converters' internal state.
+ * Call this function repeatedly, updating the target pointers with
+ * the next empty chunk of target in case of a
+ * <TT>U_BUFFER_OVERFLOW_ERROR</TT>, and updating the source pointers
+ * with the next chunk of source when a successful error status is
+ * returned, until there are no more chunks of source data.
+ * @param converter the Unicode converter
+ * @param target I/O parameter. Input : Points to the beginning of the buffer to copy
+ * codepage characters to. Output : points to after the last codepage character copied
+ * to <TT>target</TT>.
+ * @param targetLimit the pointer just after last of the <TT>target</TT> buffer
+ * @param source I/O parameter, pointer to pointer to the source Unicode character buffer.
+ * @param sourceLimit the pointer just after the last of the source buffer
+ * @param offsets if NULL is passed, nothing will happen to it, otherwise it needs to have the same number
+ * of allocated cells as <TT>target</TT>. Will fill in offsets from target to source pointer
+ * e.g: <TT>offsets[3]</TT> is equal to 6, it means that the <TT>target[3]</TT> was a result of transcoding <TT>source[6]</TT>
+ * For output data carried across calls, and other data without a specific source character
+ * (such as from escape sequences or callbacks) -1 will be placed for offsets.
+ * @param flush set to <TT>TRUE</TT> if the current source buffer is the last available
+ * chunk of the source, <TT>FALSE</TT> otherwise. Note that if a failing status is returned,
+ * this function may have to be called multiple times with flush set to <TT>TRUE</TT> until
+ * the source buffer is consumed.
+ * @param err the error status. <TT>U_ILLEGAL_ARGUMENT_ERROR</TT> will be set if the
+ * converter is <TT>NULL</TT>.
+ * <code>U_BUFFER_OVERFLOW_ERROR</code> will be set if the target is full and there is
+ * still data to be written to the target.
+ * @see ucnv_fromUChars
+ * @see ucnv_convert
+ * @see ucnv_getMinCharSize
+ * @see ucnv_setToUCallBack
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+ucnv_fromUnicode (UConverter * converter,
+ char **target,
+ const char *targetLimit,
+ const UChar ** source,
+ const UChar * sourceLimit,
+ int32_t* offsets,
+ UBool flush,
+ UErrorCode * err);
+
+/**
+ * Converts a buffer of codepage bytes into an array of unicode UChars
+ * characters. This function is optimized for converting a continuous
+ * stream of data in buffer-sized chunks, where the entire source and
+ * target does not fit in available buffers.
+ *
+ * The source pointer is an in/out parameter. It starts out pointing where the
+ * conversion is to begin, and ends up pointing after the last byte of source consumed.
+ *
+ * Target similarly starts out pointer at the first available UChar in the output
+ * buffer, and ends up pointing after the last UChar written to the output.
+ * It does NOT necessarily keep UChar sequences together.
+ *
+ * The converter always attempts to consume the entire source buffer, unless
+ * (1.) the target buffer is full, or (2.) a failing error is returned from the
+ * current callback function. When a successful error status has been
+ * returned, it means that all of the source buffer has been
+ * consumed. At that point, the caller should reset the source and
+ * sourceLimit pointers to point to the next chunk.
+ *
+ * At the end of the stream (flush==TRUE), the input is completely consumed
+ * when *source==sourceLimit and no error code is set
+ * The converter object is then automatically reset by this function.
+ * (This means that a converter need not be reset explicitly between data
+ * streams if it finishes the previous stream without errors.)
+ *
+ * This is a <I>stateful</I> conversion. Additionally, even when all source data has
+ * been consumed, some data may be in the converters' internal state.
+ * Call this function repeatedly, updating the target pointers with
+ * the next empty chunk of target in case of a
+ * <TT>U_BUFFER_OVERFLOW_ERROR</TT>, and updating the source pointers
+ * with the next chunk of source when a successful error status is
+ * returned, until there are no more chunks of source data.
+ * @param converter the Unicode converter
+ * @param target I/O parameter. Input : Points to the beginning of the buffer to copy
+ * UChars into. Output : points to after the last UChar copied.
+ * @param targetLimit the pointer just after the end of the <TT>target</TT> buffer
+ * @param source I/O parameter, pointer to pointer to the source codepage buffer.
+ * @param sourceLimit the pointer to the byte after the end of the source buffer
+ * @param offsets if NULL is passed, nothing will happen to it, otherwise it needs to have the same number
+ * of allocated cells as <TT>target</TT>. Will fill in offsets from target to source pointer
+ * e.g: <TT>offsets[3]</TT> is equal to 6, it means that the <TT>target[3]</TT> was a result of transcoding <TT>source[6]</TT>
+ * For output data carried across calls, and other data without a specific source character
+ * (such as from escape sequences or callbacks) -1 will be placed for offsets.
+ * @param flush set to <TT>TRUE</TT> if the current source buffer is the last available
+ * chunk of the source, <TT>FALSE</TT> otherwise. Note that if a failing status is returned,
+ * this function may have to be called multiple times with flush set to <TT>TRUE</TT> until
+ * the source buffer is consumed.
+ * @param err the error status. <TT>U_ILLEGAL_ARGUMENT_ERROR</TT> will be set if the
+ * converter is <TT>NULL</TT>.
+ * <code>U_BUFFER_OVERFLOW_ERROR</code> will be set if the target is full and there is
+ * still data to be written to the target.
+ * @see ucnv_fromUChars
+ * @see ucnv_convert
+ * @see ucnv_getMinCharSize
+ * @see ucnv_setFromUCallBack
+ * @see ucnv_getNextUChar
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+ucnv_toUnicode(UConverter *converter,
+ UChar **target,
+ const UChar *targetLimit,
+ const char **source,
+ const char *sourceLimit,
+ int32_t *offsets,
+ UBool flush,
+ UErrorCode *err);
+
+/**
+ * Convert the Unicode string into a codepage string using an existing UConverter.
+ * The output string is NUL-terminated if possible.
+ *
+ * This function is a more convenient but less powerful version of ucnv_fromUnicode().
+ * It is only useful for whole strings, not for streaming conversion.
+ *
+ * The maximum output buffer capacity required (barring output from callbacks) will be
+ * UCNV_GET_MAX_BYTES_FOR_STRING(srcLength, ucnv_getMaxCharSize(cnv)).
+ *
+ * @param cnv the converter object to be used (ucnv_resetFromUnicode() will be called)
+ * @param src the input Unicode string
+ * @param srcLength the input string length, or -1 if NUL-terminated
+ * @param dest destination string buffer, can be NULL if destCapacity==0
+ * @param destCapacity the number of chars available at dest
+ * @param pErrorCode normal ICU error code;
+ * common error codes that may be set by this function include
+ * U_BUFFER_OVERFLOW_ERROR, U_STRING_NOT_TERMINATED_WARNING,
+ * U_ILLEGAL_ARGUMENT_ERROR, and conversion errors
+ * @return the length of the output string, not counting the terminating NUL;
+ * if the length is greater than destCapacity, then the string will not fit
+ * and a buffer of the indicated length would need to be passed in
+ * @see ucnv_fromUnicode
+ * @see ucnv_convert
+ * @see UCNV_GET_MAX_BYTES_FOR_STRING
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+ucnv_fromUChars(UConverter *cnv,
+ char *dest, int32_t destCapacity,
+ const UChar *src, int32_t srcLength,
+ UErrorCode *pErrorCode);
+
+/**
+ * Convert the codepage string into a Unicode string using an existing UConverter.
+ * The output string is NUL-terminated if possible.
+ *
+ * This function is a more convenient but less powerful version of ucnv_toUnicode().
+ * It is only useful for whole strings, not for streaming conversion.
+ *
+ * The maximum output buffer capacity required (barring output from callbacks) will be
+ * 2*srcLength (each char may be converted into a surrogate pair).
+ *
+ * @param cnv the converter object to be used (ucnv_resetToUnicode() will be called)
+ * @param src the input codepage string
+ * @param srcLength the input string length, or -1 if NUL-terminated
+ * @param dest destination string buffer, can be NULL if destCapacity==0
+ * @param destCapacity the number of UChars available at dest
+ * @param pErrorCode normal ICU error code;
+ * common error codes that may be set by this function include
+ * U_BUFFER_OVERFLOW_ERROR, U_STRING_NOT_TERMINATED_WARNING,
+ * U_ILLEGAL_ARGUMENT_ERROR, and conversion errors
+ * @return the length of the output string, not counting the terminating NUL;
+ * if the length is greater than destCapacity, then the string will not fit
+ * and a buffer of the indicated length would need to be passed in
+ * @see ucnv_toUnicode
+ * @see ucnv_convert
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+ucnv_toUChars(UConverter *cnv,
+ UChar *dest, int32_t destCapacity,
+ const char *src, int32_t srcLength,
+ UErrorCode *pErrorCode);
+
+/**
+ * Convert a codepage buffer into Unicode one character at a time.
+ * The input is completely consumed when the U_INDEX_OUTOFBOUNDS_ERROR is set.
+ *
+ * Advantage compared to ucnv_toUnicode() or ucnv_toUChars():
+ * - Faster for small amounts of data, for most converters, e.g.,
+ * US-ASCII, ISO-8859-1, UTF-8/16/32, and most "normal" charsets.
+ * (For complex converters, e.g., SCSU, UTF-7 and ISO 2022 variants,
+ * it uses ucnv_toUnicode() internally.)
+ * - Convenient.
+ *
+ * Limitations compared to ucnv_toUnicode():
+ * - Always assumes flush=TRUE.
+ * This makes ucnv_getNextUChar() unsuitable for "streaming" conversion,
+ * that is, for where the input is supplied in multiple buffers,
+ * because ucnv_getNextUChar() will assume the end of the input at the end
+ * of the first buffer.
+ * - Does not provide offset output.
+ *
+ * It is possible to "mix" ucnv_getNextUChar() and ucnv_toUnicode() because
+ * ucnv_getNextUChar() uses the current state of the converter
+ * (unlike ucnv_toUChars() which always resets first).
+ * However, if ucnv_getNextUChar() is called after ucnv_toUnicode()
+ * stopped in the middle of a character sequence (with flush=FALSE),
+ * then ucnv_getNextUChar() will always use the slower ucnv_toUnicode()
+ * internally until the next character boundary.
+ * (This is new in ICU 2.6. In earlier releases, ucnv_getNextUChar() had to
+ * start at a character boundary.)
+ *
+ * Instead of using ucnv_getNextUChar(), it is recommended
+ * to convert using ucnv_toUnicode() or ucnv_toUChars()
+ * and then iterate over the text using U16_NEXT() or a UCharIterator (uiter.h)
+ * or a C++ CharacterIterator or similar.
+ * This allows streaming conversion and offset output, for example.
+ *
+ * <p>Handling of surrogate pairs and supplementary-plane code points:<br>
+ * There are two different kinds of codepages that provide mappings for surrogate characters:
+ * <ul>
+ * <li>Codepages like UTF-8, UTF-32, and GB 18030 provide direct representations for Unicode
+ * code points U+10000-U+10ffff as well as for single surrogates U+d800-U+dfff.
+ * Each valid sequence will result in exactly one returned code point.
+ * If a sequence results in a single surrogate, then that will be returned
+ * by itself, even if a neighboring sequence encodes the matching surrogate.</li>
+ * <li>Codepages like SCSU and LMBCS (and UTF-16) provide direct representations only for BMP code points
+ * including surrogates. Code points in supplementary planes are represented with
+ * two sequences, each encoding a surrogate.
+ * For these codepages, matching pairs of surrogates will be combined into single
+ * code points for returning from this function.
+ * (Note that SCSU is actually a mix of these codepage types.)</li>
+ * </ul></p>
+ *
+ * @param converter an open UConverter
+ * @param source the address of a pointer to the codepage buffer, will be
+ * updated to point after the bytes consumed in the conversion call.
+ * @param sourceLimit points to the end of the input buffer
+ * @param err fills in error status (see ucnv_toUnicode)
+ * <code>U_INDEX_OUTOFBOUNDS_ERROR</code> will be set if the input
+ * is empty or does not convert to any output (e.g.: pure state-change
+ * codes SI/SO, escape sequences for ISO 2022,
+ * or if the callback did not output anything, ...).
+ * This function will not set a <code>U_BUFFER_OVERFLOW_ERROR</code> because
+ * the "buffer" is the return code. However, there might be subsequent output
+ * stored in the converter object
+ * that will be returned in following calls to this function.
+ * @return a UChar32 resulting from the partial conversion of source
+ * @see ucnv_toUnicode
+ * @see ucnv_toUChars
+ * @see ucnv_convert
+ * @stable ICU 2.0
+ */
+U_STABLE UChar32 U_EXPORT2
+ucnv_getNextUChar(UConverter * converter,
+ const char **source,
+ const char * sourceLimit,
+ UErrorCode * err);
+
+/**
+ * Convert from one external charset to another using two existing UConverters.
+ * Internally, two conversions - ucnv_toUnicode() and ucnv_fromUnicode() -
+ * are used, "pivoting" through 16-bit Unicode.
+ *
+ * There is a similar function, ucnv_convert(),
+ * which has the following limitations:
+ * - it takes charset names, not converter objects, so that
+ * - two converters are opened for each call
+ * - only single-string conversion is possible, not streaming operation
+ * - it does not provide enough information to find out,
+ * in case of failure, whether the toUnicode or
+ * the fromUnicode conversion failed
+ *
+ * By contrast, ucnv_convertEx()
+ * - takes UConverter parameters instead of charset names
+ * - fully exposes the pivot buffer for complete error handling
+ *
+ * ucnv_convertEx() also provides further convenience:
+ * - an option to reset the converters at the beginning
+ * (if reset==TRUE, see parameters;
+ * also sets *pivotTarget=*pivotSource=pivotStart)
+ * - allow NUL-terminated input
+ * (only a single NUL byte, will not work for charsets with multi-byte NULs)
+ * (if sourceLimit==NULL, see parameters)
+ * - terminate with a NUL on output
+ * (only a single NUL byte, not useful for charsets with multi-byte NULs),
+ * or set U_STRING_NOT_TERMINATED_WARNING if the output exactly fills
+ * the target buffer
+ * - the pivot buffer can be provided internally;
+ * in this case, the caller will not be able to get details about where an
+ * error occurred
+ * (if pivotStart==NULL, see below)
+ *
+ * The function returns when one of the following is true:
+ * - the entire source text has been converted successfully to the target buffer
+ * - a target buffer overflow occurred (U_BUFFER_OVERFLOW_ERROR)
+ * - a conversion error occurred
+ * (other U_FAILURE(), see description of pErrorCode)
+ *
+ * Limitation compared to the direct use of
+ * ucnv_fromUnicode() and ucnv_toUnicode():
+ * ucnv_convertEx() does not provide offset information.
+ *
+ * Limitation compared to ucnv_fromUChars() and ucnv_toUChars():
+ * ucnv_convertEx() does not support preflighting directly.
+ *
+ * Sample code for converting a single string from
+ * one external charset to UTF-8, ignoring the location of errors:
+ *
+ * \code
+ * int32_t
+ * myToUTF8(UConverter *cnv,
+ * const char *s, int32_t length,
+ * char *u8, int32_t capacity,
+ * UErrorCode *pErrorCode) {
+ * UConverter *utf8Cnv;
+ * char *target;
+ *
+ * if(U_FAILURE(*pErrorCode)) {
+ * return 0;
+ * }
+ *
+ * utf8Cnv=myGetCachedUTF8Converter(pErrorCode);
+ * if(U_FAILURE(*pErrorCode)) {
+ * return 0;
+ * }
+ *
+ * target=u8;
+ * ucnv_convertEx(cnv, utf8Cnv,
+ * &target, u8+capacity,
+ * &s, length>=0 ? s+length : NULL,
+ * NULL, NULL, NULL, NULL,
+ * TRUE, TRUE,
+ * pErrorCode);
+ *
+ * myReleaseCachedUTF8Converter(utf8Cnv);
+ *
+ * // return the output string length, but without preflighting
+ * return (int32_t)(target-u8);
+ * }
+ * \endcode
+ *
+ * @param targetCnv Output converter, used to convert from the UTF-16 pivot
+ * to the target using ucnv_fromUnicode().
+ * @param sourceCnv Input converter, used to convert from the source to
+ * the UTF-16 pivot using ucnv_toUnicode().
+ * @param target I/O parameter, same as for ucnv_fromUChars().
+ * Input: *target points to the beginning of the target buffer.
+ * Output: *target points to the first unit after the last char written.
+ * @param targetLimit Pointer to the first unit after the target buffer.
+ * @param source I/O parameter, same as for ucnv_toUChars().
+ * Input: *source points to the beginning of the source buffer.
+ * Output: *source points to the first unit after the last char read.
+ * @param sourceLimit Pointer to the first unit after the source buffer.
+ * @param pivotStart Pointer to the UTF-16 pivot buffer. If pivotStart==NULL,
+ * then an internal buffer is used and the other pivot
+ * arguments are ignored and can be NULL as well.
+ * @param pivotSource I/O parameter, same as source in ucnv_fromUChars() for
+ * conversion from the pivot buffer to the target buffer.
+ * @param pivotTarget I/O parameter, same as target in ucnv_toUChars() for
+ * conversion from the source buffer to the pivot buffer.
+ * It must be pivotStart<=*pivotSource<=*pivotTarget<=pivotLimit
+ * and pivotStart<pivotLimit (unless pivotStart==NULL).
+ * @param pivotLimit Pointer to the first unit after the pivot buffer.
+ * @param reset If TRUE, then ucnv_resetToUnicode(sourceCnv) and
+ * ucnv_resetFromUnicode(targetCnv) are called, and the
+ * pivot pointers are reset (*pivotTarget=*pivotSource=pivotStart).
+ * @param flush If true, indicates the end of the input.
+ * Passed directly to ucnv_toUnicode(), and carried over to
+ * ucnv_fromUnicode() when the source is empty as well.
+ * @param pErrorCode ICU error code in/out parameter.
+ * Must fulfill U_SUCCESS before the function call.
+ * U_BUFFER_OVERFLOW_ERROR always refers to the target buffer
+ * because overflows into the pivot buffer are handled internally.
+ * Other conversion errors are from the source-to-pivot
+ * conversion if *pivotSource==pivotStart, otherwise from
+ * the pivot-to-target conversion.
+ *
+ * @see ucnv_convert
+ * @see ucnv_fromAlgorithmic
+ * @see ucnv_toAlgorithmic
+ * @see ucnv_fromUnicode
+ * @see ucnv_toUnicode
+ * @see ucnv_fromUChars
+ * @see ucnv_toUChars
+ * @stable ICU 2.6
+ */
+U_STABLE void U_EXPORT2
+ucnv_convertEx(UConverter *targetCnv, UConverter *sourceCnv,
+ char **target, const char *targetLimit,
+ const char **source, const char *sourceLimit,
+ UChar *pivotStart, UChar **pivotSource,
+ UChar **pivotTarget, const UChar *pivotLimit,
+ UBool reset, UBool flush,
+ UErrorCode *pErrorCode);
+
+/**
+ * Convert from one external charset to another.
+ * Internally, two converters are opened according to the name arguments,
+ * then the text is converted to and from the 16-bit Unicode "pivot"
+ * using ucnv_convertEx(), then the converters are closed again.
+ *
+ * This is a convenience function, not an efficient way to convert a lot of text:
+ * ucnv_convert()
+ * - takes charset names, not converter objects, so that
+ * - two converters are opened for each call
+ * - only single-string conversion is possible, not streaming operation
+ * - does not provide enough information to find out,
+ * in case of failure, whether the toUnicode or
+ * the fromUnicode conversion failed
+ * - allows NUL-terminated input
+ * (only a single NUL byte, will not work for charsets with multi-byte NULs)
+ * (if sourceLength==-1, see parameters)
+ * - terminate with a NUL on output
+ * (only a single NUL byte, not useful for charsets with multi-byte NULs),
+ * or set U_STRING_NOT_TERMINATED_WARNING if the output exactly fills
+ * the target buffer
+ * - a pivot buffer is provided internally
+ *
+ * The function returns when one of the following is true:
+ * - the entire source text has been converted successfully to the target buffer
+ * and either the target buffer is terminated with a single NUL byte
+ * or the error code is set to U_STRING_NOT_TERMINATED_WARNING
+ * - a target buffer overflow occurred (U_BUFFER_OVERFLOW_ERROR)
+ * and the full output string length is returned ("preflighting")
+ * - a conversion error occurred
+ * (other U_FAILURE(), see description of pErrorCode)
+ *
+ * @param toConverterName The name of the converter that is used to convert
+ * from the UTF-16 pivot buffer to the target.
+ * @param fromConverterName The name of the converter that is used to convert
+ * from the source to the UTF-16 pivot buffer.
+ * @param target Pointer to the output buffer.
+ * @param targetCapacity Capacity of the target, in bytes.
+ * @param source Pointer to the input buffer.
+ * @param sourceLength Length of the input text, in bytes, or -1 for NUL-terminated input.
+ * @param pErrorCode ICU error code in/out parameter.
+ * Must fulfill U_SUCCESS before the function call.
+ * @return Length of the complete output text in bytes, even if it exceeds the targetCapacity
+ * and a U_BUFFER_OVERFLOW_ERROR is set.
+ *
+ * @see ucnv_convertEx
+ * @see ucnv_fromAlgorithmic
+ * @see ucnv_toAlgorithmic
+ * @see ucnv_fromUnicode
+ * @see ucnv_toUnicode
+ * @see ucnv_fromUChars
+ * @see ucnv_toUChars
+ * @see ucnv_getNextUChar
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+ucnv_convert(const char *toConverterName,
+ const char *fromConverterName,
+ char *target,
+ int32_t targetCapacity,
+ const char *source,
+ int32_t sourceLength,
+ UErrorCode *pErrorCode);
+
+/**
+ * Convert from one external charset to another.
+ * Internally, the text is converted to and from the 16-bit Unicode "pivot"
+ * using ucnv_convertEx(). ucnv_toAlgorithmic() works exactly like ucnv_convert()
+ * except that the two converters need not be looked up and opened completely.
+ *
+ * The source-to-pivot conversion uses the cnv converter parameter.
+ * The pivot-to-target conversion uses a purely algorithmic converter
+ * according to the specified type, e.g., UCNV_UTF8 for a UTF-8 converter.
+ *
+ * Internally, the algorithmic converter is opened and closed for each
+ * function call, which is more efficient than using the public ucnv_open()
+ * but somewhat less efficient than only resetting an existing converter
+ * and using ucnv_convertEx().
+ *
+ * This function is more convenient than ucnv_convertEx() for single-string
+ * conversions, especially when "preflighting" is desired (returning the length
+ * of the complete output even if it does not fit into the target buffer;
+ * see the User Guide Strings chapter). See ucnv_convert() for details.
+ *
+ * @param algorithmicType UConverterType constant identifying the desired target
+ * charset as a purely algorithmic converter.
+ * Those are converters for Unicode charsets like
+ * UTF-8, BOCU-1, SCSU, UTF-7, IMAP-mailbox-name, etc.,
+ * as well as US-ASCII and ISO-8859-1.
+ * @param cnv The converter that is used to convert
+ * from the source to the UTF-16 pivot buffer.
+ * @param target Pointer to the output buffer.
+ * @param targetCapacity Capacity of the target, in bytes.
+ * @param source Pointer to the input buffer.
+ * @param sourceLength Length of the input text, in bytes
+ * @param pErrorCode ICU error code in/out parameter.
+ * Must fulfill U_SUCCESS before the function call.
+ * @return Length of the complete output text in bytes, even if it exceeds the targetCapacity
+ * and a U_BUFFER_OVERFLOW_ERROR is set.
+ *
+ * @see ucnv_fromAlgorithmic
+ * @see ucnv_convert
+ * @see ucnv_convertEx
+ * @see ucnv_fromUnicode
+ * @see ucnv_toUnicode
+ * @see ucnv_fromUChars
+ * @see ucnv_toUChars
+ * @stable ICU 2.6
+ */
+U_STABLE int32_t U_EXPORT2
+ucnv_toAlgorithmic(UConverterType algorithmicType,
+ UConverter *cnv,
+ char *target, int32_t targetCapacity,
+ const char *source, int32_t sourceLength,
+ UErrorCode *pErrorCode);
+
+/**
+ * Convert from one external charset to another.
+ * Internally, the text is converted to and from the 16-bit Unicode "pivot"
+ * using ucnv_convertEx(). ucnv_fromAlgorithmic() works exactly like ucnv_convert()
+ * except that the two converters need not be looked up and opened completely.
+ *
+ * The source-to-pivot conversion uses a purely algorithmic converter
+ * according to the specified type, e.g., UCNV_UTF8 for a UTF-8 converter.
+ * The pivot-to-target conversion uses the cnv converter parameter.
+ *
+ * Internally, the algorithmic converter is opened and closed for each
+ * function call, which is more efficient than using the public ucnv_open()
+ * but somewhat less efficient than only resetting an existing converter
+ * and using ucnv_convertEx().
+ *
+ * This function is more convenient than ucnv_convertEx() for single-string
+ * conversions, especially when "preflighting" is desired (returning the length
+ * of the complete output even if it does not fit into the target buffer;
+ * see the User Guide Strings chapter). See ucnv_convert() for details.
+ *
+ * @param cnv The converter that is used to convert
+ * from the UTF-16 pivot buffer to the target.
+ * @param algorithmicType UConverterType constant identifying the desired source
+ * charset as a purely algorithmic converter.
+ * Those are converters for Unicode charsets like
+ * UTF-8, BOCU-1, SCSU, UTF-7, IMAP-mailbox-name, etc.,
+ * as well as US-ASCII and ISO-8859-1.
+ * @param target Pointer to the output buffer.
+ * @param targetCapacity Capacity of the target, in bytes.
+ * @param source Pointer to the input buffer.
+ * @param sourceLength Length of the input text, in bytes
+ * @param pErrorCode ICU error code in/out parameter.
+ * Must fulfill U_SUCCESS before the function call.
+ * @return Length of the complete output text in bytes, even if it exceeds the targetCapacity
+ * and a U_BUFFER_OVERFLOW_ERROR is set.
+ *
+ * @see ucnv_fromAlgorithmic
+ * @see ucnv_convert
+ * @see ucnv_convertEx
+ * @see ucnv_fromUnicode
+ * @see ucnv_toUnicode
+ * @see ucnv_fromUChars
+ * @see ucnv_toUChars
+ * @stable ICU 2.6
+ */
+U_STABLE int32_t U_EXPORT2
+ucnv_fromAlgorithmic(UConverter *cnv,
+ UConverterType algorithmicType,
+ char *target, int32_t targetCapacity,
+ const char *source, int32_t sourceLength,
+ UErrorCode *pErrorCode);
+
+/**
+ * Frees up memory occupied by unused, cached converter shared data.
+ *
+ * @return the number of cached converters successfully deleted
+ * @see ucnv_close
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+ucnv_flushCache(void);
+
+/**
+ * Returns the number of available converters, as per the alias file.
+ *
+ * @return the number of available converters
+ * @see ucnv_getAvailableName
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+ucnv_countAvailable(void);
+
+/**
+ * Gets the canonical converter name of the specified converter from a list of
+ * all available converters contaied in the alias file. All converters
+ * in this list can be opened.
+ *
+ * @param n the index to a converter available on the system (in the range <TT>[0..ucnv_countAvaiable()]</TT>)
+ * @return a pointer a string (library owned), or <TT>NULL</TT> if the index is out of bounds.
+ * @see ucnv_countAvailable
+ * @stable ICU 2.0
+ */
+U_STABLE const char* U_EXPORT2
+ucnv_getAvailableName(int32_t n);
+
+/**
+ * Returns a UEnumeration to enumerate all of the canonical converter
+ * names, as per the alias file, regardless of the ability to open each
+ * converter.
+ *
+ * @return A UEnumeration object for getting all the recognized canonical
+ * converter names.
+ * @see ucnv_getAvailableName
+ * @see uenum_close
+ * @see uenum_next
+ * @stable ICU 2.4
+ */
+U_STABLE UEnumeration * U_EXPORT2
+ucnv_openAllNames(UErrorCode *pErrorCode);
+
+/**
+ * Gives the number of aliases for a given converter or alias name.
+ * If the alias is ambiguous, then the preferred converter is used
+ * and the status is set to U_AMBIGUOUS_ALIAS_WARNING.
+ * This method only enumerates the listed entries in the alias file.
+ * @param alias alias name
+ * @param pErrorCode error status
+ * @return number of names on alias list for given alias
+ * @stable ICU 2.0
+ */
+U_STABLE uint16_t U_EXPORT2
+ucnv_countAliases(const char *alias, UErrorCode *pErrorCode);
+
+/**
+ * Gives the name of the alias at given index of alias list.
+ * This method only enumerates the listed entries in the alias file.
+ * If the alias is ambiguous, then the preferred converter is used
+ * and the status is set to U_AMBIGUOUS_ALIAS_WARNING.
+ * @param alias alias name
+ * @param n index in alias list
+ * @param pErrorCode result of operation
+ * @return returns the name of the alias at given index
+ * @see ucnv_countAliases
+ * @stable ICU 2.0
+ */
+U_STABLE const char * U_EXPORT2
+ucnv_getAlias(const char *alias, uint16_t n, UErrorCode *pErrorCode);
+
+/**
+ * Fill-up the list of alias names for the given alias.
+ * This method only enumerates the listed entries in the alias file.
+ * If the alias is ambiguous, then the preferred converter is used
+ * and the status is set to U_AMBIGUOUS_ALIAS_WARNING.
+ * @param alias alias name
+ * @param aliases fill-in list, aliases is a pointer to an array of
+ * <code>ucnv_countAliases()</code> string-pointers
+ * (<code>const char *</code>) that will be filled in.
+ * The strings themselves are owned by the library.
+ * @param pErrorCode result of operation
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+ucnv_getAliases(const char *alias, const char **aliases, UErrorCode *pErrorCode);
+
+/**
+ * Return a new UEnumeration object for enumerating all the
+ * alias names for a given converter that are recognized by a standard.
+ * This method only enumerates the listed entries in the alias file.
+ * The convrtrs.txt file can be modified to change the results of
+ * this function.
+ * The first result in this list is the same result given by
+ * <code>ucnv_getStandardName</code>, which is the default alias for
+ * the specified standard name. The returned object must be closed with
+ * <code>uenum_close</code> when you are done with the object.
+ *
+ * @param convName original converter name
+ * @param standard name of the standard governing the names; MIME and IANA
+ * are such standards
+ * @param pErrorCode The error code
+ * @return A UEnumeration object for getting all aliases that are recognized
+ * by a standard. If any of the parameters are invalid, NULL
+ * is returned.
+ * @see ucnv_getStandardName
+ * @see uenum_close
+ * @see uenum_next
+ * @stable ICU 2.2
+ */
+U_STABLE UEnumeration * U_EXPORT2
+ucnv_openStandardNames(const char *convName,
+ const char *standard,
+ UErrorCode *pErrorCode);
+
+/**
+ * Gives the number of standards associated to converter names.
+ * @return number of standards
+ * @stable ICU 2.0
+ */
+U_STABLE uint16_t U_EXPORT2
+ucnv_countStandards(void);
+
+/**
+ * Gives the name of the standard at given index of standard list.
+ * @param n index in standard list
+ * @param pErrorCode result of operation
+ * @return returns the name of the standard at given index. Owned by the library.
+ * @stable ICU 2.0
+ */
+U_STABLE const char * U_EXPORT2
+ucnv_getStandard(uint16_t n, UErrorCode *pErrorCode);
+
+/**
+ * Returns a standard name for a given converter name.
+ * <p>
+ * Example alias table:<br>
+ * conv alias1 { STANDARD1 } alias2 { STANDARD1* }
+ * <p>
+ * Result of ucnv_getStandardName("conv", "STANDARD1") from example
+ * alias table:<br>
+ * <b>"alias2"</b>
+ *
+ * @param name original converter name
+ * @param standard name of the standard governing the names; MIME and IANA
+ * are such standards
+ * @param pErrorCode result of operation
+ * @return returns the standard converter name;
+ * if a standard converter name cannot be determined,
+ * then <code>NULL</code> is returned. Owned by the library.
+ * @stable ICU 2.0
+ */
+U_STABLE const char * U_EXPORT2
+ucnv_getStandardName(const char *name, const char *standard, UErrorCode *pErrorCode);
+
+/**
+ * This function will return the internal canonical converter name of the
+ * tagged alias. This is the opposite of ucnv_openStandardNames, which
+ * returns the tagged alias given the canonical name.
+ * <p>
+ * Example alias table:<br>
+ * conv alias1 { STANDARD1 } alias2 { STANDARD1* }
+ * <p>
+ * Result of ucnv_getStandardName("alias1", "STANDARD1") from example
+ * alias table:<br>
+ * <b>"conv"</b>
+ *
+ * @return returns the canonical converter name;
+ * if a standard or alias name cannot be determined,
+ * then <code>NULL</code> is returned. The returned string is
+ * owned by the library.
+ * @see ucnv_getStandardName
+ * @stable ICU 2.4
+ */
+U_STABLE const char * U_EXPORT2
+ucnv_getCanonicalName(const char *alias, const char *standard, UErrorCode *pErrorCode);
+
+/**
+ * returns the current default converter name.
+ *
+ * @return returns the current default converter name;
+ * if a default converter name cannot be determined,
+ * then <code>NULL</code> is returned.
+ * Storage owned by the library
+ * @see ucnv_setDefaultName
+ * @stable ICU 2.0
+ */
+U_STABLE const char * U_EXPORT2
+ucnv_getDefaultName(void);
+
+/**
+ * sets the current default converter name. Caller must own the storage for 'name'
+ * and preserve it indefinitely.
+ * @param name the converter name to be the default (must exist).
+ * @see ucnv_getDefaultName
+ * @system SYSTEM API
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+ucnv_setDefaultName(const char *name);
+
+/**
+ * Fixes the backslash character mismapping. For example, in SJIS, the backslash
+ * character in the ASCII portion is also used to represent the yen currency sign.
+ * When mapping from Unicode character 0x005C, it's unclear whether to map the
+ * character back to yen or backslash in SJIS. This function will take the input
+ * buffer and replace all the yen sign characters with backslash. This is necessary
+ * when the user tries to open a file with the input buffer on Windows.
+ * This function will test the converter to see whether such mapping is
+ * required. You can sometimes avoid using this function by using the correct version
+ * of Shift-JIS.
+ *
+ * @param cnv The converter representing the target codepage.
+ * @param source the input buffer to be fixed
+ * @param sourceLen the length of the input buffer
+ * @see ucnv_isAmbiguous
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+ucnv_fixFileSeparator(const UConverter *cnv, UChar *source, int32_t sourceLen);
+
+/**
+ * Determines if the converter contains ambiguous mappings of the same
+ * character or not.
+ * @param cnv the converter to be tested
+ * @return TRUE if the converter contains ambiguous mapping of the same
+ * character, FALSE otherwise.
+ * @stable ICU 2.0
+ */
+U_STABLE UBool U_EXPORT2
+ucnv_isAmbiguous(const UConverter *cnv);
+
+/**
+ * Sets the converter to use fallback mapping or not.
+ * @param cnv The converter to set the fallback mapping usage on.
+ * @param usesFallback TRUE if the user wants the converter to take advantage of the fallback
+ * mapping, FALSE otherwise.
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+ucnv_setFallback(UConverter *cnv, UBool usesFallback);
+
+/**
+ * Determines if the converter uses fallback mappings or not.
+ * @param cnv The converter to be tested
+ * @return TRUE if the converter uses fallback, FALSE otherwise.
+ * @stable ICU 2.0
+ */
+U_STABLE UBool U_EXPORT2
+ucnv_usesFallback(const UConverter *cnv);
+
+/**
+ * Detects Unicode signature byte sequences at the start of the byte stream
+ * and returns the charset name of the indicated Unicode charset.
+ * NULL is returned when no Unicode signature is recognized.
+ * The number of bytes in the signature is output as well.
+ *
+ * The caller can ucnv_open() a converter using the charset name.
+ * The first code unit (UChar) from the start of the stream will be U+FEFF
+ * (the Unicode BOM/signature character) and can usually be ignored.
+ *
+ * For most Unicode charsets it is also possible to ignore the indicated
+ * number of initial stream bytes and start converting after them.
+ * However, there are stateful Unicode charsets (UTF-7 and BOCU-1) for which
+ * this will not work. Therefore, it is best to ignore the first output UChar
+ * instead of the input signature bytes.
+ * <p>
+ * Usage:
+ * @code
+ * UErrorCode err = U_ZERO_ERROR;
+ * char input[] = { '\xEF','\xBB', '\xBF','\x41','\x42','\x43' };
+ * int32_t signatureLength = 0;
+ * char *encoding = ucnv_detectUnicodeSignatures(input,sizeof(input),&signatureLength,&err);
+ * UConverter *conv = NULL;
+ * UChar output[100];
+ * UChar *target = output, *out;
+ * char *source = input;
+ * if(encoding!=NULL && U_SUCCESS(err)){
+ * // should signature be discarded ?
+ * conv = ucnv_open(encoding, &err);
+ * // do the conversion
+ * ucnv_toUnicode(conv,
+ * target, output + sizeof(output)/U_SIZEOF_UCHAR,
+ * source, input + sizeof(input),
+ * NULL, TRUE, &err);
+ * out = output;
+ * if (discardSignature){
+ * ++out; // ignore initial U+FEFF
+ * }
+ * while(out != target) {
+ * printf("%04x ", *out++);
+ * }
+ * puts("");
+ * }
+ *
+ * @endcode
+ *
+ * @param source The source string in which the signature should be detected.
+ * @param sourceLength Length of the input string, or -1 if terminated with a NUL byte.
+ * @param signatureLength A pointer to int32_t to receive the number of bytes that make up the signature
+ * of the detected UTF. 0 if not detected.
+ * Can be a NULL pointer.
+ * @param pErrorCode A pointer to receive information about any errors that may occur during detection.
+ * Must be a valid pointer to an error code value, which must not indicate a failure
+ * before the function call.
+ * @return The name of the encoding detected. NULL if encoding is not detected.
+ * @stable ICU 2.4
+ */
+U_STABLE const char* U_EXPORT2
+ucnv_detectUnicodeSignature(const char* source,
+ int32_t sourceLength,
+ int32_t *signatureLength,
+ UErrorCode *pErrorCode);
+
+#endif
+
+#endif
+/*_UCNV*/
diff --git a/Source/JavaScriptCore/icu/unicode/ucnv_err.h b/Source/JavaScriptCore/icu/unicode/ucnv_err.h
new file mode 100644
index 0000000..2a6104c
--- /dev/null
+++ b/Source/JavaScriptCore/icu/unicode/ucnv_err.h
@@ -0,0 +1,456 @@
+/*
+**********************************************************************
+* Copyright (C) 1999-2004, International Business Machines
+* Corporation and others. All Rights Reserved.
+**********************************************************************
+ *
+ *
+ * ucnv_err.h:
+ */
+
+/**
+ * \file
+ * \brief C UConverter predefined error callbacks
+ *
+ * <h2>Error Behaviour Functions</h2>
+ * Defines some error behaviour functions called by ucnv_{from,to}Unicode
+ * These are provided as part of ICU and many are stable, but they
+ * can also be considered only as an example of what can be done with
+ * callbacks. You may of course write your own.
+ *
+ * If you want to write your own, you may also find the functions from
+ * ucnv_cb.h useful when writing your own callbacks.
+ *
+ * These functions, although public, should NEVER be called directly.
+ * They should be used as parameters to the ucnv_setFromUCallback
+ * and ucnv_setToUCallback functions, to set the behaviour of a converter
+ * when it encounters ILLEGAL/UNMAPPED/INVALID sequences.
+ *
+ * usage example: 'STOP' doesn't need any context, but newContext
+ * could be set to something other than 'NULL' if needed. The available
+ * contexts in this header can modify the default behavior of the callback.
+ *
+ * \code
+ * UErrorCode err = U_ZERO_ERROR;
+ * UConverter *myConverter = ucnv_open("ibm-949", &err);
+ * const void *oldContext;
+ * UConverterFromUCallback oldAction;
+ *
+ *
+ * if (U_SUCCESS(err))
+ * {
+ * ucnv_setFromUCallBack(myConverter,
+ * UCNV_FROM_U_CALLBACK_STOP,
+ * NULL,
+ * &oldAction,
+ * &oldContext,
+ * &status);
+ * }
+ * \endcode
+ *
+ * The code above tells "myConverter" to stop when it encounters an
+ * ILLEGAL/TRUNCATED/INVALID sequences when it is used to convert from
+ * Unicode -> Codepage. The behavior from Codepage to Unicode is not changed,
+ * and ucnv_setToUCallBack would need to be called in order to change
+ * that behavior too.
+ *
+ * Here is an example with a context:
+ *
+ * \code
+ * UErrorCode err = U_ZERO_ERROR;
+ * UConverter *myConverter = ucnv_open("ibm-949", &err);
+ * const void *oldContext;
+ * UConverterFromUCallback oldAction;
+ *
+ *
+ * if (U_SUCCESS(err))
+ * {
+ * ucnv_setToUCallBack(myConverter,
+ * UCNV_TO_U_CALLBACK_SUBSTITUTE,
+ * UCNV_SUB_STOP_ON_ILLEGAL,
+ * &oldAction,
+ * &oldContext,
+ * &status);
+ * }
+ * \endcode
+ *
+ * The code above tells "myConverter" to stop when it encounters an
+ * ILLEGAL/TRUNCATED/INVALID sequences when it is used to convert from
+ * Codepage -> Unicode. Any unmapped and legal characters will be
+ * substituted to be the default substitution character.
+ */
+
+#ifndef UCNV_ERR_H
+#define UCNV_ERR_H
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_CONVERSION
+
+/** Forward declaring the UConverter structure. @stable ICU 2.0 */
+struct UConverter;
+
+/** @stable ICU 2.0 */
+typedef struct UConverter UConverter;
+
+/**
+ * FROM_U, TO_U context options for sub callback
+ * @stable ICU 2.0
+ */
+#define UCNV_SUB_STOP_ON_ILLEGAL "i"
+
+/**
+ * FROM_U, TO_U context options for skip callback
+ * @stable ICU 2.0
+ */
+#define UCNV_SKIP_STOP_ON_ILLEGAL "i"
+
+/**
+ * FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to ICU (%UXXXX)
+ * @stable ICU 2.0
+ */
+#define UCNV_ESCAPE_ICU NULL
+/**
+ * FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to JAVA (\\uXXXX)
+ * @stable ICU 2.0
+ */
+#define UCNV_ESCAPE_JAVA "J"
+/**
+ * FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to C (\\uXXXX \\UXXXXXXXX)
+ * TO_U_CALLBACK_ESCAPE option to escape the character value accoding to C (\\xXXXX)
+ * @stable ICU 2.0
+ */
+#define UCNV_ESCAPE_C "C"
+/**
+ * FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to XML Decimal escape (&amp;#DDDD;)
+ * TO_U_CALLBACK_ESCAPE context option to escape the character value accoding to XML Decimal escape (&amp;#DDDD;)
+ * @stable ICU 2.0
+ */
+#define UCNV_ESCAPE_XML_DEC "D"
+/**
+ * FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to XML Hex escape (&amp;#xXXXX;)
+ * TO_U_CALLBACK_ESCAPE context option to escape the character value accoding to XML Hex escape (&amp;#xXXXX;)
+ * @stable ICU 2.0
+ */
+#define UCNV_ESCAPE_XML_HEX "X"
+/**
+ * FROM_U_CALLBACK_ESCAPE context option to escape teh code unit according to Unicode (U+XXXXX)
+ * @stable ICU 2.0
+ */
+#define UCNV_ESCAPE_UNICODE "U"
+
+/**
+ * The process condition code to be used with the callbacks.
+ * Codes which are greater than UCNV_IRREGULAR should be
+ * passed on to any chained callbacks.
+ * @stable ICU 2.0
+ */
+typedef enum {
+ UCNV_UNASSIGNED = 0, /**< The code point is unassigned.
+ The error code U_INVALID_CHAR_FOUND will be set. */
+ UCNV_ILLEGAL = 1, /**< The code point is illegal. For example,
+ \\x81\\x2E is illegal in SJIS because \\x2E
+ is not a valid trail byte for the \\x81
+ lead byte.
+ Also, starting with Unicode 3.0.1, non-shortest byte sequences
+ in UTF-8 (like \\xC1\\xA1 instead of \\x61 for U+0061)
+ are also illegal, not just irregular.
+ The error code U_ILLEGAL_CHAR_FOUND will be set. */
+ UCNV_IRREGULAR = 2, /**< The codepoint is not a regular sequence in
+ the encoding. For example, \\xED\\xA0\\x80..\\xED\\xBF\\xBF
+ are irregular UTF-8 byte sequences for single surrogate
+ code points.
+ The error code U_INVALID_CHAR_FOUND will be set. */
+ UCNV_RESET = 3, /**< The callback is called with this reason when a
+ 'reset' has occured. Callback should reset all
+ state. */
+ UCNV_CLOSE = 4, /**< Called when the converter is closed. The
+ callback should release any allocated memory.*/
+ UCNV_CLONE = 5 /**< Called when ucnv_safeClone() is called on the
+ converter. the pointer available as the
+ 'context' is an alias to the original converters'
+ context pointer. If the context must be owned
+ by the new converter, the callback must clone
+ the data and call ucnv_setFromUCallback
+ (or setToUCallback) with the correct pointer.
+ @stable ICU 2.2
+ */
+} UConverterCallbackReason;
+
+
+/**
+ * The structure for the fromUnicode callback function parameter.
+ * @stable ICU 2.0
+ */
+typedef struct {
+ uint16_t size; /**< The size of this struct. @stable ICU 2.0 */
+ UBool flush; /**< The internal state of converter will be reset and data flushed if set to TRUE. @stable ICU 2.0 */
+ UConverter *converter; /**< Pointer to the converter that is opened and to which this struct is passed as an argument. @stable ICU 2.0 */
+ const UChar *source; /**< Pointer to the source source buffer. @stable ICU 2.0 */
+ const UChar *sourceLimit; /**< Pointer to the limit (end + 1) of source buffer. @stable ICU 2.0 */
+ char *target; /**< Pointer to the target buffer. @stable ICU 2.0 */
+ const char *targetLimit; /**< Pointer to the limit (end + 1) of target buffer. @stable ICU 2.0 */
+ int32_t *offsets; /**< Pointer to the buffer that recieves the offsets. *offset = blah ; offset++;. @stable ICU 2.0 */
+} UConverterFromUnicodeArgs;
+
+
+/**
+ * The structure for the toUnicode callback function parameter.
+ * @stable ICU 2.0
+ */
+typedef struct {
+ uint16_t size; /**< The size of this struct @stable ICU 2.0 */
+ UBool flush; /**< The internal state of converter will be reset and data flushed if set to TRUE. @stable ICU 2.0 */
+ UConverter *converter; /**< Pointer to the converter that is opened and to which this struct is passed as an argument. @stable ICU 2.0 */
+ const char *source; /**< Pointer to the source source buffer. @stable ICU 2.0 */
+ const char *sourceLimit; /**< Pointer to the limit (end + 1) of source buffer. @stable ICU 2.0 */
+ UChar *target; /**< Pointer to the target buffer. @stable ICU 2.0 */
+ const UChar *targetLimit; /**< Pointer to the limit (end + 1) of target buffer. @stable ICU 2.0 */
+ int32_t *offsets; /**< Pointer to the buffer that recieves the offsets. *offset = blah ; offset++;. @stable ICU 2.0 */
+} UConverterToUnicodeArgs;
+
+
+/**
+ * DO NOT CALL THIS FUNCTION DIRECTLY!
+ * This From Unicode callback STOPS at the ILLEGAL_SEQUENCE,
+ * returning the error code back to the caller immediately.
+ *
+ * @param context Pointer to the callback's private data
+ * @param fromUArgs Information about the conversion in progress
+ * @param codeUnits Points to 'length' UChars of the concerned Unicode sequence
+ * @param length Size (in bytes) of the concerned codepage sequence
+ * @param codePoint Single UChar32 (UTF-32) containing the concerend Unicode codepoint.
+ * @param reason Defines the reason the callback was invoked
+ * @param err This should always be set to a failure status prior to calling.
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2 UCNV_FROM_U_CALLBACK_STOP (
+ const void *context,
+ UConverterFromUnicodeArgs *fromUArgs,
+ const UChar* codeUnits,
+ int32_t length,
+ UChar32 codePoint,
+ UConverterCallbackReason reason,
+ UErrorCode * err);
+
+
+
+/**
+ * DO NOT CALL THIS FUNCTION DIRECTLY!
+ * This To Unicode callback STOPS at the ILLEGAL_SEQUENCE,
+ * returning the error code back to the caller immediately.
+ *
+ * @param context Pointer to the callback's private data
+ * @param toUArgs Information about the conversion in progress
+ * @param codeUnits Points to 'length' bytes of the concerned codepage sequence
+ * @param length Size (in bytes) of the concerned codepage sequence
+ * @param reason Defines the reason the callback was invoked
+ * @param err This should always be set to a failure status prior to calling.
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2 UCNV_TO_U_CALLBACK_STOP (
+ const void *context,
+ UConverterToUnicodeArgs *toUArgs,
+ const char* codeUnits,
+ int32_t length,
+ UConverterCallbackReason reason,
+ UErrorCode * err);
+
+/**
+ * DO NOT CALL THIS FUNCTION DIRECTLY!
+ * This From Unicode callback skips any ILLEGAL_SEQUENCE, or
+ * skips only UNASSINGED_SEQUENCE depending on the context parameter
+ * simply ignoring those characters.
+ *
+ * @param context The function currently recognizes the callback options:
+ * UCNV_SKIP_STOP_ON_ILLEGAL: STOPS at the ILLEGAL_SEQUENCE,
+ * returning the error code back to the caller immediately.
+ * NULL: Skips any ILLEGAL_SEQUENCE
+ * @param fromUArgs Information about the conversion in progress
+ * @param codeUnits Points to 'length' UChars of the concerned Unicode sequence
+ * @param length Size (in bytes) of the concerned codepage sequence
+ * @param codePoint Single UChar32 (UTF-32) containing the concerend Unicode codepoint.
+ * @param reason Defines the reason the callback was invoked
+ * @param err Return value will be set to success if the callback was handled,
+ * otherwise this value will be set to a failure status.
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2 UCNV_FROM_U_CALLBACK_SKIP (
+ const void *context,
+ UConverterFromUnicodeArgs *fromUArgs,
+ const UChar* codeUnits,
+ int32_t length,
+ UChar32 codePoint,
+ UConverterCallbackReason reason,
+ UErrorCode * err);
+
+/**
+ * DO NOT CALL THIS FUNCTION DIRECTLY!
+ * This From Unicode callback will Substitute the ILLEGAL SEQUENCE, or
+ * UNASSIGNED_SEQUENCE depending on context parameter, with the
+ * current substitution string for the converter. This is the default
+ * callback.
+ *
+ * @param context The function currently recognizes the callback options:
+ * UCNV_SUB_STOP_ON_ILLEGAL: STOPS at the ILLEGAL_SEQUENCE,
+ * returning the error code back to the caller immediately.
+ * NULL: Substitutes any ILLEGAL_SEQUENCE
+ * @param fromUArgs Information about the conversion in progress
+ * @param codeUnits Points to 'length' UChars of the concerned Unicode sequence
+ * @param length Size (in bytes) of the concerned codepage sequence
+ * @param codePoint Single UChar32 (UTF-32) containing the concerend Unicode codepoint.
+ * @param reason Defines the reason the callback was invoked
+ * @param err Return value will be set to success if the callback was handled,
+ * otherwise this value will be set to a failure status.
+ * @see ucnv_setSubstChars
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2 UCNV_FROM_U_CALLBACK_SUBSTITUTE (
+ const void *context,
+ UConverterFromUnicodeArgs *fromUArgs,
+ const UChar* codeUnits,
+ int32_t length,
+ UChar32 codePoint,
+ UConverterCallbackReason reason,
+ UErrorCode * err);
+
+/**
+ * DO NOT CALL THIS FUNCTION DIRECTLY!
+ * This From Unicode callback will Substitute the ILLEGAL SEQUENCE with the
+ * hexadecimal representation of the illegal codepoints
+ *
+ * @param context The function currently recognizes the callback options:
+ * <ul>
+ * <li>UCNV_ESCAPE_ICU: Substitues the ILLEGAL SEQUENCE with the hexadecimal
+ * representation in the format %UXXXX, e.g. "%uFFFE%u00AC%uC8FE").
+ * In the Event the converter doesn't support the characters {%,U}[A-F][0-9],
+ * it will substitute the illegal sequence with the substitution characters.
+ * Note that codeUnit(32bit int eg: unit of a surrogate pair) is represented as
+ * %UD84D%UDC56</li>
+ * <li>UCNV_ESCAPE_JAVA: Substitues the ILLEGAL SEQUENCE with the hexadecimal
+ * representation in the format \\uXXXX, e.g. "\\uFFFE\\u00AC\\uC8FE").
+ * In the Event the converter doesn't support the characters {\,u}[A-F][0-9],
+ * it will substitute the illegal sequence with the substitution characters.
+ * Note that codeUnit(32bit int eg: unit of a surrogate pair) is represented as
+ * \\uD84D\\uDC56</li>
+ * <li>UCNV_ESCAPE_C: Substitues the ILLEGAL SEQUENCE with the hexadecimal
+ * representation in the format \\uXXXX, e.g. "\\uFFFE\\u00AC\\uC8FE").
+ * In the Event the converter doesn't support the characters {\,u,U}[A-F][0-9],
+ * it will substitute the illegal sequence with the substitution characters.
+ * Note that codeUnit(32bit int eg: unit of a surrogate pair) is represented as
+ * \\U00023456</li>
+ * <li>UCNV_ESCAPE_XML_DEC: Substitues the ILLEGAL SEQUENCE with the decimal
+ * representation in the format &amp;#DDDDDDDD;, e.g. "&amp;#65534;&amp;#172;&amp;#51454;").
+ * In the Event the converter doesn't support the characters {&amp;,#}[0-9],
+ * it will substitute the illegal sequence with the substitution characters.
+ * Note that codeUnit(32bit int eg: unit of a surrogate pair) is represented as
+ * &amp;#144470; and Zero padding is ignored.</li>
+ * <li>UCNV_ESCAPE_XML_HEX:Substitues the ILLEGAL SEQUENCE with the decimal
+ * representation in the format &#xXXXX, e.g. "&amp;#xFFFE;&amp;#x00AC;&amp;#xC8FE;").
+ * In the Event the converter doesn't support the characters {&,#,x}[0-9],
+ * it will substitute the illegal sequence with the substitution characters.
+ * Note that codeUnit(32bit int eg: unit of a surrogate pair) is represented as
+ * &amp;#x23456;</li>
+ * </ul>
+ * @param fromUArgs Information about the conversion in progress
+ * @param codeUnits Points to 'length' UChars of the concerned Unicode sequence
+ * @param length Size (in bytes) of the concerned codepage sequence
+ * @param codePoint Single UChar32 (UTF-32) containing the concerend Unicode codepoint.
+ * @param reason Defines the reason the callback was invoked
+ * @param err Return value will be set to success if the callback was handled,
+ * otherwise this value will be set to a failure status.
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2 UCNV_FROM_U_CALLBACK_ESCAPE (
+ const void *context,
+ UConverterFromUnicodeArgs *fromUArgs,
+ const UChar* codeUnits,
+ int32_t length,
+ UChar32 codePoint,
+ UConverterCallbackReason reason,
+ UErrorCode * err);
+
+
+/**
+ * DO NOT CALL THIS FUNCTION DIRECTLY!
+ * This To Unicode callback skips any ILLEGAL_SEQUENCE, or
+ * skips only UNASSINGED_SEQUENCE depending on the context parameter
+ * simply ignoring those characters.
+ *
+ * @param context The function currently recognizes the callback options:
+ * UCNV_SKIP_STOP_ON_ILLEGAL: STOPS at the ILLEGAL_SEQUENCE,
+ * returning the error code back to the caller immediately.
+ * NULL: Skips any ILLEGAL_SEQUENCE
+ * @param toUArgs Information about the conversion in progress
+ * @param codeUnits Points to 'length' bytes of the concerned codepage sequence
+ * @param length Size (in bytes) of the concerned codepage sequence
+ * @param reason Defines the reason the callback was invoked
+ * @param err Return value will be set to success if the callback was handled,
+ * otherwise this value will be set to a failure status.
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2 UCNV_TO_U_CALLBACK_SKIP (
+ const void *context,
+ UConverterToUnicodeArgs *toUArgs,
+ const char* codeUnits,
+ int32_t length,
+ UConverterCallbackReason reason,
+ UErrorCode * err);
+
+/**
+ * DO NOT CALL THIS FUNCTION DIRECTLY!
+ * This To Unicode callback will Substitute the ILLEGAL SEQUENCE,or
+ * UNASSIGNED_SEQUENCE depending on context parameter, with the
+ * Unicode substitution character, U+FFFD.
+ *
+ * @param context The function currently recognizes the callback options:
+ * UCNV_SUB_STOP_ON_ILLEGAL: STOPS at the ILLEGAL_SEQUENCE,
+ * returning the error code back to the caller immediately.
+ * NULL: Substitutes any ILLEGAL_SEQUENCE
+ * @param toUArgs Information about the conversion in progress
+ * @param codeUnits Points to 'length' bytes of the concerned codepage sequence
+ * @param length Size (in bytes) of the concerned codepage sequence
+ * @param reason Defines the reason the callback was invoked
+ * @param err Return value will be set to success if the callback was handled,
+ * otherwise this value will be set to a failure status.
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2 UCNV_TO_U_CALLBACK_SUBSTITUTE (
+ const void *context,
+ UConverterToUnicodeArgs *toUArgs,
+ const char* codeUnits,
+ int32_t length,
+ UConverterCallbackReason reason,
+ UErrorCode * err);
+
+/**
+ * DO NOT CALL THIS FUNCTION DIRECTLY!
+ * This To Unicode callback will Substitute the ILLEGAL SEQUENCE with the
+ * hexadecimal representation of the illegal bytes
+ * (in the format %XNN, e.g. "%XFF%X0A%XC8%X03").
+ *
+ * @param context This function currently recognizes the callback options:
+ * UCNV_ESCAPE_ICU, UCNV_ESCAPE_JAVA, UCNV_ESCAPE_C, UCNV_ESCAPE_XML_DEC,
+ * UCNV_ESCAPE_XML_HEX and UCNV_ESCAPE_UNICODE.
+ * @param toUArgs Information about the conversion in progress
+ * @param codeUnits Points to 'length' bytes of the concerned codepage sequence
+ * @param length Size (in bytes) of the concerned codepage sequence
+ * @param reason Defines the reason the callback was invoked
+ * @param err Return value will be set to success if the callback was handled,
+ * otherwise this value will be set to a failure status.
+ * @stable ICU 2.0
+ */
+
+U_STABLE void U_EXPORT2 UCNV_TO_U_CALLBACK_ESCAPE (
+ const void *context,
+ UConverterToUnicodeArgs *toUArgs,
+ const char* codeUnits,
+ int32_t length,
+ UConverterCallbackReason reason,
+ UErrorCode * err);
+
+#endif
+
+#endif
+
+/*UCNV_ERR_H*/
diff --git a/Source/JavaScriptCore/icu/unicode/ucol.h b/Source/JavaScriptCore/icu/unicode/ucol.h
new file mode 100644
index 0000000..cbfb1c3
--- /dev/null
+++ b/Source/JavaScriptCore/icu/unicode/ucol.h
@@ -0,0 +1,1219 @@
+/*
+*******************************************************************************
+* Copyright (c) 1996-2005, International Business Machines Corporation and others.
+* All Rights Reserved.
+*******************************************************************************
+*/
+
+#ifndef UCOL_H
+#define UCOL_H
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_COLLATION
+
+#include "unicode/unorm.h"
+#include "unicode/parseerr.h"
+#include "unicode/uloc.h"
+#include "unicode/uset.h"
+
+/**
+ * \file
+ * \brief C API: Collator
+ *
+ * <h2> Collator C API </h2>
+ *
+ * The C API for Collator performs locale-sensitive
+ * string comparison. You use this service to build
+ * searching and sorting routines for natural language text.
+ * <em>Important: </em>The ICU collation service has been reimplemented
+ * in order to achieve better performance and UCA compliance.
+ * For details, see the
+ * <a href="http://icu.sourceforge.net/cvs/icu/~checkout~/icuhtml/design/collation/ICU_collation_design.htm">
+ * collation design document</a>.
+ * <p>
+ * For more information about the collation service see
+ * <a href="http://icu.sourceforge.net/icu/userguide/Collate_Intro.html">the users guide</a>.
+ * <p>
+ * Collation service provides correct sorting orders for most locales supported in ICU.
+ * If specific data for a locale is not available, the orders eventually falls back
+ * to the <a href="http://www.unicode.org/unicode/reports/tr10/">UCA sort order</a>.
+ * <p>
+ * Sort ordering may be customized by providing your own set of rules. For more on
+ * this subject see the
+ * <a href="http://icu.sourceforge.net/icu/userguide/Collate_Customization.html">
+ * Collation customization</a> section of the users guide.
+ * <p>
+ * @see UCollationResult
+ * @see UNormalizationMode
+ * @see UCollationStrength
+ * @see UCollationElements
+ */
+
+/** A collation element iterator.
+* For usage in C programs.
+*/
+struct collIterate;
+/** structure representing collation element iterator instance
+ * @stable ICU 2.0
+ */
+typedef struct collIterate collIterate;
+
+/** A collator.
+* For usage in C programs.
+*/
+struct UCollator;
+/** structure representing a collator object instance
+ * @stable ICU 2.0
+ */
+typedef struct UCollator UCollator;
+
+
+/**
+ * UCOL_LESS is returned if source string is compared to be less than target
+ * string in the u_strcoll() method.
+ * UCOL_EQUAL is returned if source string is compared to be equal to target
+ * string in the u_strcoll() method.
+ * UCOL_GREATER is returned if source string is compared to be greater than
+ * target string in the u_strcoll() method.
+ * @see u_strcoll()
+ * <p>
+ * Possible values for a comparison result
+ * @stable ICU 2.0
+ */
+typedef enum {
+ /** string a == string b */
+ UCOL_EQUAL = 0,
+ /** string a > string b */
+ UCOL_GREATER = 1,
+ /** string a < string b */
+ UCOL_LESS = -1
+} UCollationResult ;
+
+
+/** Enum containing attribute values for controling collation behavior.
+ * Here are all the allowable values. Not every attribute can take every value. The only
+ * universal value is UCOL_DEFAULT, which resets the attribute value to the predefined
+ * value for that locale
+ * @stable ICU 2.0
+ */
+typedef enum {
+ /** accepted by most attributes */
+ UCOL_DEFAULT = -1,
+
+ /** Primary collation strength */
+ UCOL_PRIMARY = 0,
+ /** Secondary collation strength */
+ UCOL_SECONDARY = 1,
+ /** Tertiary collation strength */
+ UCOL_TERTIARY = 2,
+ /** Default collation strength */
+ UCOL_DEFAULT_STRENGTH = UCOL_TERTIARY,
+ UCOL_CE_STRENGTH_LIMIT,
+ /** Quaternary collation strength */
+ UCOL_QUATERNARY=3,
+ /** Identical collation strength */
+ UCOL_IDENTICAL=15,
+ UCOL_STRENGTH_LIMIT,
+
+ /** Turn the feature off - works for UCOL_FRENCH_COLLATION,
+ UCOL_CASE_LEVEL, UCOL_HIRAGANA_QUATERNARY_MODE
+ & UCOL_DECOMPOSITION_MODE*/
+ UCOL_OFF = 16,
+ /** Turn the feature on - works for UCOL_FRENCH_COLLATION,
+ UCOL_CASE_LEVEL, UCOL_HIRAGANA_QUATERNARY_MODE
+ & UCOL_DECOMPOSITION_MODE*/
+ UCOL_ON = 17,
+
+ /** Valid for UCOL_ALTERNATE_HANDLING. Alternate handling will be shifted */
+ UCOL_SHIFTED = 20,
+ /** Valid for UCOL_ALTERNATE_HANDLING. Alternate handling will be non ignorable */
+ UCOL_NON_IGNORABLE = 21,
+
+ /** Valid for UCOL_CASE_FIRST -
+ lower case sorts before upper case */
+ UCOL_LOWER_FIRST = 24,
+ /** upper case sorts before lower case */
+ UCOL_UPPER_FIRST = 25,
+
+ UCOL_ATTRIBUTE_VALUE_COUNT
+
+} UColAttributeValue;
+
+/**
+ * Base letter represents a primary difference. Set comparison
+ * level to UCOL_PRIMARY to ignore secondary and tertiary differences.
+ * Use this to set the strength of a Collator object.
+ * Example of primary difference, "abc" &lt; "abd"
+ *
+ * Diacritical differences on the same base letter represent a secondary
+ * difference. Set comparison level to UCOL_SECONDARY to ignore tertiary
+ * differences. Use this to set the strength of a Collator object.
+ * Example of secondary difference, "ä" >> "a".
+ *
+ * Uppercase and lowercase versions of the same character represents a
+ * tertiary difference. Set comparison level to UCOL_TERTIARY to include
+ * all comparison differences. Use this to set the strength of a Collator
+ * object.
+ * Example of tertiary difference, "abc" &lt;&lt;&lt; "ABC".
+ *
+ * Two characters are considered "identical" when they have the same
+ * unicode spellings. UCOL_IDENTICAL.
+ * For example, "ä" == "ä".
+ *
+ * UCollationStrength is also used to determine the strength of sort keys
+ * generated from UCollator objects
+ * These values can be now found in the UColAttributeValue enum.
+ * @stable ICU 2.0
+ **/
+typedef UColAttributeValue UCollationStrength;
+
+/** Attributes that collation service understands. All the attributes can take UCOL_DEFAULT
+ * value, as well as the values specific to each one.
+ * @stable ICU 2.0
+ */
+typedef enum {
+ /** Attribute for direction of secondary weights - used in French.\
+ * Acceptable values are UCOL_ON, which results in secondary weights
+ * being considered backwards and UCOL_OFF which treats secondary
+ * weights in the order they appear.*/
+ UCOL_FRENCH_COLLATION,
+ /** Attribute for handling variable elements.\
+ * Acceptable values are UCOL_NON_IGNORABLE (default)
+ * which treats all the codepoints with non-ignorable
+ * primary weights in the same way,
+ * and UCOL_SHIFTED which causes codepoints with primary
+ * weights that are equal or below the variable top value
+ * to be ignored on primary level and moved to the quaternary
+ * level.*/
+ UCOL_ALTERNATE_HANDLING,
+ /** Controls the ordering of upper and lower case letters.\
+ * Acceptable values are UCOL_OFF (default), which orders
+ * upper and lower case letters in accordance to their tertiary
+ * weights, UCOL_UPPER_FIRST which forces upper case letters to
+ * sort before lower case letters, and UCOL_LOWER_FIRST which does
+ * the opposite. */
+ UCOL_CASE_FIRST,
+ /** Controls whether an extra case level (positioned before the third
+ * level) is generated or not.\ Acceptable values are UCOL_OFF (default),
+ * when case level is not generated, and UCOL_ON which causes the case
+ * level to be generated.\ Contents of the case level are affected by
+ * the value of UCOL_CASE_FIRST attribute.\ A simple way to ignore
+ * accent differences in a string is to set the strength to UCOL_PRIMARY
+ * and enable case level. */
+ UCOL_CASE_LEVEL,
+ /** Controls whether the normalization check and necessary normalizations
+ * are performed.\ When set to UCOL_OFF (default) no normalization check
+ * is performed.\ The correctness of the result is guaranteed only if the
+ * input data is in so-called FCD form (see users manual for more info).\
+ * When set to UCOL_ON, an incremental check is performed to see whether the input data
+ * is in the FCD form.\ If the data is not in the FCD form, incremental
+ * NFD normalization is performed. */
+ UCOL_NORMALIZATION_MODE,
+ /** An alias for UCOL_NORMALIZATION_MODE attribute */
+ UCOL_DECOMPOSITION_MODE = UCOL_NORMALIZATION_MODE,
+ /** The strength attribute.\ Can be either UCOL_PRIMARY, UCOL_SECONDARY,
+ * UCOL_TERTIARY, UCOL_QUATERNARY or UCOL_IDENTICAL.\ The usual strength
+ * for most locales (except Japanese) is tertiary.\ Quaternary strength
+ * is useful when combined with shifted setting for alternate handling
+ * attribute and for JIS x 4061 collation, when it is used to distinguish
+ * between Katakana and Hiragana (this is achieved by setting the
+ * UCOL_HIRAGANA_QUATERNARY mode to on.\ Otherwise, quaternary level
+ * is affected only by the number of non ignorable code points in
+ * the string.\ Identical strength is rarely useful, as it amounts
+ * to codepoints of the NFD form of the string. */
+ UCOL_STRENGTH,
+ /** when turned on, this attribute
+ * positions Hiragana before all
+ * non-ignorables on quaternary level
+ * This is a sneaky way to produce JIS
+ * sort order */
+ UCOL_HIRAGANA_QUATERNARY_MODE,
+ /** when turned on, this attribute
+ * generates a collation key
+ * for the numeric value of substrings
+ * of digits. This is a way to get '100'
+ * to sort AFTER '2'.*/
+ UCOL_NUMERIC_COLLATION,
+ UCOL_ATTRIBUTE_COUNT
+} UColAttribute;
+
+/** Options for retrieving the rule string
+ * @stable ICU 2.0
+ */
+typedef enum {
+ /** Retrieve tailoring only */
+ UCOL_TAILORING_ONLY,
+ /** Retrieve UCA rules and tailoring */
+ UCOL_FULL_RULES
+} UColRuleOption ;
+
+/**
+ * Open a UCollator for comparing strings.
+ * The UCollator pointer is used in all the calls to the Collation
+ * service. After finished, collator must be disposed of by calling
+ * {@link #ucol_close }.
+ * @param loc The locale containing the required collation rules.
+ * Special values for locales can be passed in -
+ * if NULL is passed for the locale, the default locale
+ * collation rules will be used. If empty string ("") or
+ * "root" are passed, UCA rules will be used.
+ * @param status A pointer to an UErrorCode to receive any errors
+ * @return A pointer to a UCollator, or 0 if an error occurred.
+ * @see ucol_openRules
+ * @see ucol_safeClone
+ * @see ucol_close
+ * @stable ICU 2.0
+ */
+U_STABLE UCollator* U_EXPORT2
+ucol_open(const char *loc, UErrorCode *status);
+
+/**
+ * Produce an UCollator instance according to the rules supplied.
+ * The rules are used to change the default ordering, defined in the
+ * UCA in a process called tailoring. The resulting UCollator pointer
+ * can be used in the same way as the one obtained by {@link #ucol_strcoll }.
+ * @param rules A string describing the collation rules. For the syntax
+ * of the rules please see users guide.
+ * @param rulesLength The length of rules, or -1 if null-terminated.
+ * @param normalizationMode The normalization mode: One of
+ * UCOL_OFF (expect the text to not need normalization),
+ * UCOL_ON (normalize), or
+ * UCOL_DEFAULT (set the mode according to the rules)
+ * @param strength The default collation strength; one of UCOL_PRIMARY, UCOL_SECONDARY,
+ * UCOL_TERTIARY, UCOL_IDENTICAL,UCOL_DEFAULT_STRENGTH - can be also set in the rules.
+ * @param parseError A pointer to UParseError to recieve information about errors
+ * occurred during parsing. This argument can currently be set
+ * to NULL, but at users own risk. Please provide a real structure.
+ * @param status A pointer to an UErrorCode to receive any errors
+ * @return A pointer to a UCollator.\ It is not guaranteed that NULL be returned in case
+ * of error - please use status argument to check for errors.
+ * @see ucol_open
+ * @see ucol_safeClone
+ * @see ucol_close
+ * @stable ICU 2.0
+ */
+U_STABLE UCollator* U_EXPORT2
+ucol_openRules( const UChar *rules,
+ int32_t rulesLength,
+ UColAttributeValue normalizationMode,
+ UCollationStrength strength,
+ UParseError *parseError,
+ UErrorCode *status);
+
+/**
+ * Open a collator defined by a short form string.
+ * The structure and the syntax of the string is defined in the "Naming collators"
+ * section of the users guide:
+ * http://icu.sourceforge.net/icu/userguide/Collate_Concepts.html#Naming_Collators
+ * Attributes are overriden by the subsequent attributes. So, for "S2_S3", final
+ * strength will be 3. 3066bis locale overrides individual locale parts.
+ * The call to this function is equivalent to a call to ucol_open, followed by a
+ * series of calls to ucol_setAttribute and ucol_setVariableTop.
+ * @param definition A short string containing a locale and a set of attributes.
+ * Attributes not explicitly mentioned are left at the default
+ * state for a locale.
+ * @param parseError if not NULL, structure that will get filled with error's pre
+ * and post context in case of error.
+ * @param forceDefaults if FALSE, the settings that are the same as the collator
+ * default settings will not be applied (for example, setting
+ * French secondary on a French collator would not be executed).
+ * If TRUE, all the settings will be applied regardless of the
+ * collator default value. If the definition
+ * strings are to be cached, should be set to FALSE.
+ * @param status Error code. Apart from regular error conditions connected to
+ * instantiating collators (like out of memory or similar), this
+ * API will return an error if an invalid attribute or attribute/value
+ * combination is specified.
+ * @return A pointer to a UCollator or 0 if an error occured (including an
+ * invalid attribute).
+ * @see ucol_open
+ * @see ucol_setAttribute
+ * @see ucol_setVariableTop
+ * @see ucol_getShortDefinitionString
+ * @see ucol_normalizeShortDefinitionString
+ * @draft ICU 3.0
+ *
+ */
+U_CAPI UCollator* U_EXPORT2
+ucol_openFromShortString( const char *definition,
+ UBool forceDefaults,
+ UParseError *parseError,
+ UErrorCode *status);
+
+/**
+ * Get a set containing the contractions defined by the collator. The set includes
+ * both the UCA contractions and the contractions defined by the collator. This set
+ * will contain only strings. If a tailoring explicitly suppresses contractions from
+ * the UCA (like Russian), removed contractions will not be in the resulting set.
+ * @param coll collator
+ * @param conts the set to hold the result. It gets emptied before
+ * contractions are added.
+ * @param status to hold the error code
+ * @return the size of the contraction set
+ *
+ * @draft ICU 3.0
+ */
+U_CAPI int32_t U_EXPORT2
+ucol_getContractions( const UCollator *coll,
+ USet *conts,
+ UErrorCode *status);
+
+
+/**
+ * Close a UCollator.
+ * Once closed, a UCollator should not be used.\ Every open collator should
+ * be closed.\ Otherwise, a memory leak will result.
+ * @param coll The UCollator to close.
+ * @see ucol_open
+ * @see ucol_openRules
+ * @see ucol_safeClone
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+ucol_close(UCollator *coll);
+
+/**
+ * Compare two strings.
+ * The strings will be compared using the options already specified.
+ * @param coll The UCollator containing the comparison rules.
+ * @param source The source string.
+ * @param sourceLength The length of source, or -1 if null-terminated.
+ * @param target The target string.
+ * @param targetLength The length of target, or -1 if null-terminated.
+ * @return The result of comparing the strings; one of UCOL_EQUAL,
+ * UCOL_GREATER, UCOL_LESS
+ * @see ucol_greater
+ * @see ucol_greaterOrEqual
+ * @see ucol_equal
+ * @stable ICU 2.0
+ */
+U_STABLE UCollationResult U_EXPORT2
+ucol_strcoll( const UCollator *coll,
+ const UChar *source,
+ int32_t sourceLength,
+ const UChar *target,
+ int32_t targetLength);
+
+/**
+ * Determine if one string is greater than another.
+ * This function is equivalent to {@link #ucol_strcoll } == UCOL_GREATER
+ * @param coll The UCollator containing the comparison rules.
+ * @param source The source string.
+ * @param sourceLength The length of source, or -1 if null-terminated.
+ * @param target The target string.
+ * @param targetLength The length of target, or -1 if null-terminated.
+ * @return TRUE if source is greater than target, FALSE otherwise.
+ * @see ucol_strcoll
+ * @see ucol_greaterOrEqual
+ * @see ucol_equal
+ * @stable ICU 2.0
+ */
+U_STABLE UBool U_EXPORT2
+ucol_greater(const UCollator *coll,
+ const UChar *source, int32_t sourceLength,
+ const UChar *target, int32_t targetLength);
+
+/**
+ * Determine if one string is greater than or equal to another.
+ * This function is equivalent to {@link #ucol_strcoll } != UCOL_LESS
+ * @param coll The UCollator containing the comparison rules.
+ * @param source The source string.
+ * @param sourceLength The length of source, or -1 if null-terminated.
+ * @param target The target string.
+ * @param targetLength The length of target, or -1 if null-terminated.
+ * @return TRUE if source is greater than or equal to target, FALSE otherwise.
+ * @see ucol_strcoll
+ * @see ucol_greater
+ * @see ucol_equal
+ * @stable ICU 2.0
+ */
+U_STABLE UBool U_EXPORT2
+ucol_greaterOrEqual(const UCollator *coll,
+ const UChar *source, int32_t sourceLength,
+ const UChar *target, int32_t targetLength);
+
+/**
+ * Compare two strings for equality.
+ * This function is equivalent to {@link #ucol_strcoll } == UCOL_EQUAL
+ * @param coll The UCollator containing the comparison rules.
+ * @param source The source string.
+ * @param sourceLength The length of source, or -1 if null-terminated.
+ * @param target The target string.
+ * @param targetLength The length of target, or -1 if null-terminated.
+ * @return TRUE if source is equal to target, FALSE otherwise
+ * @see ucol_strcoll
+ * @see ucol_greater
+ * @see ucol_greaterOrEqual
+ * @stable ICU 2.0
+ */
+U_STABLE UBool U_EXPORT2
+ucol_equal(const UCollator *coll,
+ const UChar *source, int32_t sourceLength,
+ const UChar *target, int32_t targetLength);
+
+/**
+ * Compare two UTF-8 encoded trings.
+ * The strings will be compared using the options already specified.
+ * @param coll The UCollator containing the comparison rules.
+ * @param sIter The source string iterator.
+ * @param tIter The target string iterator.
+ * @return The result of comparing the strings; one of UCOL_EQUAL,
+ * UCOL_GREATER, UCOL_LESS
+ * @param status A pointer to an UErrorCode to receive any errors
+ * @see ucol_strcoll
+ * @stable ICU 2.6
+ */
+U_STABLE UCollationResult U_EXPORT2
+ucol_strcollIter( const UCollator *coll,
+ UCharIterator *sIter,
+ UCharIterator *tIter,
+ UErrorCode *status);
+
+/**
+ * Get the collation strength used in a UCollator.
+ * The strength influences how strings are compared.
+ * @param coll The UCollator to query.
+ * @return The collation strength; one of UCOL_PRIMARY, UCOL_SECONDARY,
+ * UCOL_TERTIARY, UCOL_QUATERNARY, UCOL_IDENTICAL
+ * @see ucol_setStrength
+ * @stable ICU 2.0
+ */
+U_STABLE UCollationStrength U_EXPORT2
+ucol_getStrength(const UCollator *coll);
+
+/**
+ * Set the collation strength used in a UCollator.
+ * The strength influences how strings are compared.
+ * @param coll The UCollator to set.
+ * @param strength The desired collation strength; one of UCOL_PRIMARY,
+ * UCOL_SECONDARY, UCOL_TERTIARY, UCOL_QUATERNARY, UCOL_IDENTICAL, UCOL_DEFAULT
+ * @see ucol_getStrength
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+ucol_setStrength(UCollator *coll,
+ UCollationStrength strength);
+
+/**
+ * Get the display name for a UCollator.
+ * The display name is suitable for presentation to a user.
+ * @param objLoc The locale of the collator in question.
+ * @param dispLoc The locale for display.
+ * @param result A pointer to a buffer to receive the attribute.
+ * @param resultLength The maximum size of result.
+ * @param status A pointer to an UErrorCode to receive any errors
+ * @return The total buffer size needed; if greater than resultLength,
+ * the output was truncated.
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+ucol_getDisplayName( const char *objLoc,
+ const char *dispLoc,
+ UChar *result,
+ int32_t resultLength,
+ UErrorCode *status);
+
+/**
+ * Get a locale for which collation rules are available.
+ * A UCollator in a locale returned by this function will perform the correct
+ * collation for the locale.
+ * @param index The index of the desired locale.
+ * @return A locale for which collation rules are available, or 0 if none.
+ * @see ucol_countAvailable
+ * @stable ICU 2.0
+ */
+U_STABLE const char* U_EXPORT2
+ucol_getAvailable(int32_t index);
+
+/**
+ * Determine how many locales have collation rules available.
+ * This function is most useful as determining the loop ending condition for
+ * calls to {@link #ucol_getAvailable }.
+ * @return The number of locales for which collation rules are available.
+ * @see ucol_getAvailable
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+ucol_countAvailable(void);
+
+#if !UCONFIG_NO_SERVICE
+/**
+ * Create a string enumerator of all locales for which a valid
+ * collator may be opened.
+ * @param status input-output error code
+ * @return a string enumeration over locale strings. The caller is
+ * responsible for closing the result.
+ * @draft ICU 3.0
+ */
+U_DRAFT UEnumeration* U_EXPORT2
+ucol_openAvailableLocales(UErrorCode *status);
+#endif
+
+/**
+ * Create a string enumerator of all possible keywords that are relevant to
+ * collation. At this point, the only recognized keyword for this
+ * service is "collation".
+ * @param status input-output error code
+ * @return a string enumeration over locale strings. The caller is
+ * responsible for closing the result.
+ * @draft ICU 3.0
+ */
+U_DRAFT UEnumeration* U_EXPORT2
+ucol_getKeywords(UErrorCode *status);
+
+/**
+ * Given a keyword, create a string enumeration of all values
+ * for that keyword that are currently in use.
+ * @param keyword a particular keyword as enumerated by
+ * ucol_getKeywords. If any other keyword is passed in, *status is set
+ * to U_ILLEGAL_ARGUMENT_ERROR.
+ * @param status input-output error code
+ * @return a string enumeration over collation keyword values, or NULL
+ * upon error. The caller is responsible for closing the result.
+ * @draft ICU 3.0
+ */
+U_DRAFT UEnumeration* U_EXPORT2
+ucol_getKeywordValues(const char *keyword, UErrorCode *status);
+
+/**
+ * Return the functionally equivalent locale for the given
+ * requested locale, with respect to given keyword, for the
+ * collation service. If two locales return the same result, then
+ * collators instantiated for these locales will behave
+ * equivalently. The converse is not always true; two collators
+ * may in fact be equivalent, but return different results, due to
+ * internal details. The return result has no other meaning than
+ * that stated above, and implies nothing as to the relationship
+ * between the two locales. This is intended for use by
+ * applications who wish to cache collators, or otherwise reuse
+ * collators when possible. The functional equivalent may change
+ * over time. For more information, please see the <a
+ * href="http://icu.sourceforge.net/icu/userguide/locale.html#services">
+ * Locales and Services</a> section of the ICU User Guide.
+ * @param result fillin for the functionally equivalent locale
+ * @param resultCapacity capacity of the fillin buffer
+ * @param keyword a particular keyword as enumerated by
+ * ucol_getKeywords.
+ * @param locale the requested locale
+ * @param isAvailable if non-NULL, pointer to a fillin parameter that
+ * indicates whether the requested locale was 'available' to the
+ * collation service. A locale is defined as 'available' if it
+ * physically exists within the collation locale data.
+ * @param status pointer to input-output error code
+ * @return the actual buffer size needed for the locale. If greater
+ * than resultCapacity, the returned full name will be truncated and
+ * an error code will be returned.
+ * @draft ICU 3.0
+ */
+U_DRAFT int32_t U_EXPORT2
+ucol_getFunctionalEquivalent(char* result, int32_t resultCapacity,
+ const char* keyword, const char* locale,
+ UBool* isAvailable, UErrorCode* status);
+
+/**
+ * Get the collation rules from a UCollator.
+ * The rules will follow the rule syntax.
+ * @param coll The UCollator to query.
+ * @param length
+ * @return The collation rules.
+ * @stable ICU 2.0
+ */
+U_STABLE const UChar* U_EXPORT2
+ucol_getRules( const UCollator *coll,
+ int32_t *length);
+
+/** Get the short definition string for a collator. This API harvests the collator's
+ * locale and the attribute set and produces a string that can be used for opening
+ * a collator with the same properties using the ucol_openFromShortString API.
+ * This string will be normalized.
+ * The structure and the syntax of the string is defined in the "Naming collators"
+ * section of the users guide:
+ * http://icu.sourceforge.net/icu/userguide/Collate_Concepts.html#Naming_Collators
+ * This API supports preflighting.
+ * @param coll a collator
+ * @param locale a locale that will appear as a collators locale in the resulting
+ * short string definition. If NULL, the locale will be harvested
+ * from the collator.
+ * @param buffer space to hold the resulting string
+ * @param capacity capacity of the buffer
+ * @param status for returning errors. All the preflighting errors are featured
+ * @return length of the resulting string
+ * @see ucol_openFromShortString
+ * @see ucol_normalizeShortDefinitionString
+ * @draft ICU 3.0
+ */
+U_CAPI int32_t U_EXPORT2
+ucol_getShortDefinitionString(const UCollator *coll,
+ const char *locale,
+ char *buffer,
+ int32_t capacity,
+ UErrorCode *status);
+
+/** Verifies and normalizes short definition string.
+ * Normalized short definition string has all the option sorted by the argument name,
+ * so that equivalent definition strings are the same.
+ * This API supports preflighting.
+ * @param source definition string
+ * @param destination space to hold the resulting string
+ * @param capacity capacity of the buffer
+ * @param parseError if not NULL, structure that will get filled with error's pre
+ * and post context in case of error.
+ * @param status Error code. This API will return an error if an invalid attribute
+ * or attribute/value combination is specified. All the preflighting
+ * errors are also featured
+ * @return length of the resulting normalized string.
+ *
+ * @see ucol_openFromShortString
+ * @see ucol_getShortDefinitionString
+ *
+ * @draft ICU 3.0
+ */
+
+U_CAPI int32_t U_EXPORT2
+ucol_normalizeShortDefinitionString(const char *source,
+ char *destination,
+ int32_t capacity,
+ UParseError *parseError,
+ UErrorCode *status);
+
+
+/**
+ * Get a sort key for a string from a UCollator.
+ * Sort keys may be compared using <TT>strcmp</TT>.
+ * @param coll The UCollator containing the collation rules.
+ * @param source The string to transform.
+ * @param sourceLength The length of source, or -1 if null-terminated.
+ * @param result A pointer to a buffer to receive the attribute.
+ * @param resultLength The maximum size of result.
+ * @return The size needed to fully store the sort key..
+ * @see ucol_keyHashCode
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+ucol_getSortKey(const UCollator *coll,
+ const UChar *source,
+ int32_t sourceLength,
+ uint8_t *result,
+ int32_t resultLength);
+
+
+/** Gets the next count bytes of a sort key. Caller needs
+ * to preserve state array between calls and to provide
+ * the same type of UCharIterator set with the same string.
+ * The destination buffer provided must be big enough to store
+ * the number of requested bytes. Generated sortkey is not
+ * compatible with sortkeys generated using ucol_getSortKey
+ * API, since we don't do any compression. If uncompressed
+ * sortkeys are required, this API can be used.
+ * @param coll The UCollator containing the collation rules.
+ * @param iter UCharIterator containing the string we need
+ * the sort key to be calculated for.
+ * @param state Opaque state of sortkey iteration.
+ * @param dest Buffer to hold the resulting sortkey part
+ * @param count number of sort key bytes required.
+ * @param status error code indicator.
+ * @return the actual number of bytes of a sortkey. It can be
+ * smaller than count if we have reached the end of
+ * the sort key.
+ * @stable ICU 2.6
+ */
+U_STABLE int32_t U_EXPORT2
+ucol_nextSortKeyPart(const UCollator *coll,
+ UCharIterator *iter,
+ uint32_t state[2],
+ uint8_t *dest, int32_t count,
+ UErrorCode *status);
+
+/** enum that is taken by ucol_getBound API
+ * See below for explanation
+ * do not change the values assigned to the
+ * members of this enum. Underlying code
+ * depends on them having these numbers
+ * @stable ICU 2.0
+ */
+typedef enum {
+ /** lower bound */
+ UCOL_BOUND_LOWER = 0,
+ /** upper bound that will match strings of exact size */
+ UCOL_BOUND_UPPER = 1,
+ /** upper bound that will match all the strings that have the same initial substring as the given string */
+ UCOL_BOUND_UPPER_LONG = 2,
+ UCOL_BOUND_VALUE_COUNT
+} UColBoundMode;
+
+/**
+ * Produce a bound for a given sortkey and a number of levels.
+ * Return value is always the number of bytes needed, regardless of
+ * whether the result buffer was big enough or even valid.<br>
+ * Resulting bounds can be used to produce a range of strings that are
+ * between upper and lower bounds. For example, if bounds are produced
+ * for a sortkey of string "smith", strings between upper and lower
+ * bounds with one level would include "Smith", "SMITH", "sMiTh".<br>
+ * There are two upper bounds that can be produced. If UCOL_BOUND_UPPER
+ * is produced, strings matched would be as above. However, if bound
+ * produced using UCOL_BOUND_UPPER_LONG is used, the above example will
+ * also match "Smithsonian" and similar.<br>
+ * For more on usage, see example in cintltst/capitst.c in procedure
+ * TestBounds.
+ * Sort keys may be compared using <TT>strcmp</TT>.
+ * @param source The source sortkey.
+ * @param sourceLength The length of source, or -1 if null-terminated.
+ * (If an unmodified sortkey is passed, it is always null
+ * terminated).
+ * @param boundType Type of bound required. It can be UCOL_BOUND_LOWER, which
+ * produces a lower inclusive bound, UCOL_BOUND_UPPER, that
+ * produces upper bound that matches strings of the same length
+ * or UCOL_BOUND_UPPER_LONG that matches strings that have the
+ * same starting substring as the source string.
+ * @param noOfLevels Number of levels required in the resulting bound (for most
+ * uses, the recommended value is 1). See users guide for
+ * explanation on number of levels a sortkey can have.
+ * @param result A pointer to a buffer to receive the resulting sortkey.
+ * @param resultLength The maximum size of result.
+ * @param status Used for returning error code if something went wrong. If the
+ * number of levels requested is higher than the number of levels
+ * in the source key, a warning (U_SORT_KEY_TOO_SHORT_WARNING) is
+ * issued.
+ * @return The size needed to fully store the bound.
+ * @see ucol_keyHashCode
+ * @stable ICU 2.1
+ */
+U_STABLE int32_t U_EXPORT2
+ucol_getBound(const uint8_t *source,
+ int32_t sourceLength,
+ UColBoundMode boundType,
+ uint32_t noOfLevels,
+ uint8_t *result,
+ int32_t resultLength,
+ UErrorCode *status);
+
+/**
+ * Gets the version information for a Collator. Version is currently
+ * an opaque 32-bit number which depends, among other things, on major
+ * versions of the collator tailoring and UCA.
+ * @param coll The UCollator to query.
+ * @param info the version # information, the result will be filled in
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+ucol_getVersion(const UCollator* coll, UVersionInfo info);
+
+/**
+ * Gets the UCA version information for a Collator. Version is the
+ * UCA version number (3.1.1, 4.0).
+ * @param coll The UCollator to query.
+ * @param info the version # information, the result will be filled in
+ * @draft ICU 2.8
+ */
+U_DRAFT void U_EXPORT2
+ucol_getUCAVersion(const UCollator* coll, UVersionInfo info);
+
+/**
+ * Merge two sort keys. The levels are merged with their corresponding counterparts
+ * (primaries with primaries, secondaries with secondaries etc.). Between the values
+ * from the same level a separator is inserted.
+ * example (uncompressed):
+ * 191B1D 01 050505 01 910505 00 and 1F2123 01 050505 01 910505 00
+ * will be merged as
+ * 191B1D 02 1F212301 050505 02 050505 01 910505 02 910505 00
+ * This allows for concatenating of first and last names for sorting, among other things.
+ * If the destination buffer is not big enough, the results are undefined.
+ * If any of source lengths are zero or any of source pointers are NULL/undefined,
+ * result is of size zero.
+ * @param src1 pointer to the first sortkey
+ * @param src1Length length of the first sortkey
+ * @param src2 pointer to the second sortkey
+ * @param src2Length length of the second sortkey
+ * @param dest buffer to hold the result
+ * @param destCapacity size of the buffer for the result
+ * @return size of the result. If the buffer is big enough size is always
+ * src1Length+src2Length-1
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+ucol_mergeSortkeys(const uint8_t *src1, int32_t src1Length,
+ const uint8_t *src2, int32_t src2Length,
+ uint8_t *dest, int32_t destCapacity);
+
+/**
+ * Universal attribute setter
+ * @param coll collator which attributes are to be changed
+ * @param attr attribute type
+ * @param value attribute value
+ * @param status to indicate whether the operation went on smoothly or there were errors
+ * @see UColAttribute
+ * @see UColAttributeValue
+ * @see ucol_getAttribute
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+ucol_setAttribute(UCollator *coll, UColAttribute attr, UColAttributeValue value, UErrorCode *status);
+
+/**
+ * Universal attribute getter
+ * @param coll collator which attributes are to be changed
+ * @param attr attribute type
+ * @return attribute value
+ * @param status to indicate whether the operation went on smoothly or there were errors
+ * @see UColAttribute
+ * @see UColAttributeValue
+ * @see ucol_setAttribute
+ * @stable ICU 2.0
+ */
+U_STABLE UColAttributeValue U_EXPORT2
+ucol_getAttribute(const UCollator *coll, UColAttribute attr, UErrorCode *status);
+
+/** Variable top
+ * is a two byte primary value which causes all the codepoints with primary values that
+ * are less or equal than the variable top to be shifted when alternate handling is set
+ * to UCOL_SHIFTED.
+ * Sets the variable top to a collation element value of a string supplied.
+ * @param coll collator which variable top needs to be changed
+ * @param varTop one or more (if contraction) UChars to which the variable top should be set
+ * @param len length of variable top string. If -1 it is considered to be zero terminated.
+ * @param status error code. If error code is set, the return value is undefined.
+ * Errors set by this function are: <br>
+ * U_CE_NOT_FOUND_ERROR if more than one character was passed and there is no such
+ * a contraction<br>
+ * U_PRIMARY_TOO_LONG_ERROR if the primary for the variable top has more than two bytes
+ * @return a 32 bit value containing the value of the variable top in upper 16 bits.
+ * Lower 16 bits are undefined
+ * @see ucol_getVariableTop
+ * @see ucol_restoreVariableTop
+ * @stable ICU 2.0
+ */
+U_STABLE uint32_t U_EXPORT2
+ucol_setVariableTop(UCollator *coll,
+ const UChar *varTop, int32_t len,
+ UErrorCode *status);
+
+/**
+ * Gets the variable top value of a Collator.
+ * Lower 16 bits are undefined and should be ignored.
+ * @param coll collator which variable top needs to be retrieved
+ * @param status error code (not changed by function). If error code is set,
+ * the return value is undefined.
+ * @return the variable top value of a Collator.
+ * @see ucol_setVariableTop
+ * @see ucol_restoreVariableTop
+ * @stable ICU 2.0
+ */
+U_STABLE uint32_t U_EXPORT2 ucol_getVariableTop(const UCollator *coll, UErrorCode *status);
+
+/**
+ * Sets the variable top to a collation element value supplied. Variable top is
+ * set to the upper 16 bits.
+ * Lower 16 bits are ignored.
+ * @param coll collator which variable top needs to be changed
+ * @param varTop CE value, as returned by ucol_setVariableTop or ucol)getVariableTop
+ * @param status error code (not changed by function)
+ * @see ucol_getVariableTop
+ * @see ucol_setVariableTop
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+ucol_restoreVariableTop(UCollator *coll, const uint32_t varTop, UErrorCode *status);
+
+/**
+ * Thread safe cloning operation. The result is a clone of a given collator.
+ * @param coll collator to be cloned
+ * @param stackBuffer user allocated space for the new clone.
+ * If NULL new memory will be allocated.
+ * If buffer is not large enough, new memory will be allocated.
+ * Clients can use the U_COL_SAFECLONE_BUFFERSIZE.
+ * This will probably be enough to avoid memory allocations.
+ * @param pBufferSize pointer to size of allocated space.
+ * If *pBufferSize == 0, a sufficient size for use in cloning will
+ * be returned ('pre-flighting')
+ * If *pBufferSize is not enough for a stack-based safe clone,
+ * new memory will be allocated.
+ * @param status to indicate whether the operation went on smoothly or there were errors
+ * An informational status value, U_SAFECLONE_ALLOCATED_ERROR, is used if any
+ * allocations were necessary.
+ * @return pointer to the new clone
+ * @see ucol_open
+ * @see ucol_openRules
+ * @see ucol_close
+ * @stable ICU 2.0
+ */
+U_STABLE UCollator* U_EXPORT2
+ucol_safeClone(const UCollator *coll,
+ void *stackBuffer,
+ int32_t *pBufferSize,
+ UErrorCode *status);
+
+/** default memory size for the new clone. It needs to be this large for os/400 large pointers
+ * @stable ICU 2.0
+ */
+#define U_COL_SAFECLONE_BUFFERSIZE 512
+
+/**
+ * Returns current rules. Delta defines whether full rules are returned or just the tailoring.
+ * Returns number of UChars needed to store rules. If buffer is NULL or bufferLen is not enough
+ * to store rules, will store up to available space.
+ * @param coll collator to get the rules from
+ * @param delta one of UCOL_TAILORING_ONLY, UCOL_FULL_RULES.
+ * @param buffer buffer to store the result in. If NULL, you'll get no rules.
+ * @param bufferLen lenght of buffer to store rules in. If less then needed you'll get only the part that fits in.
+ * @return current rules
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+ucol_getRulesEx(const UCollator *coll, UColRuleOption delta, UChar *buffer, int32_t bufferLen);
+
+/**
+ * gets the locale name of the collator. If the collator
+ * is instantiated from the rules, then this function returns
+ * NULL.
+ * @param coll The UCollator for which the locale is needed
+ * @param type You can choose between requested, valid and actual
+ * locale. For description see the definition of
+ * ULocDataLocaleType in uloc.h
+ * @param status error code of the operation
+ * @return real locale name from which the collation data comes.
+ * If the collator was instantiated from rules, returns
+ * NULL.
+ * @deprecated ICU 2.8 Use ucol_getLocaleByType instead
+ */
+U_DEPRECATED const char * U_EXPORT2
+ucol_getLocale(const UCollator *coll, ULocDataLocaleType type, UErrorCode *status);
+
+
+/**
+ * gets the locale name of the collator. If the collator
+ * is instantiated from the rules, then this function returns
+ * NULL.
+ * @param coll The UCollator for which the locale is needed
+ * @param type You can choose between requested, valid and actual
+ * locale. For description see the definition of
+ * ULocDataLocaleType in uloc.h
+ * @param status error code of the operation
+ * @return real locale name from which the collation data comes.
+ * If the collator was instantiated from rules, returns
+ * NULL.
+ * @draft ICU 2.8 likely to change in ICU 3.0, based on feedback
+ */
+U_DRAFT const char * U_EXPORT2
+ucol_getLocaleByType(const UCollator *coll, ULocDataLocaleType type, UErrorCode *status);
+
+/**
+ * Get an Unicode set that contains all the characters and sequences tailored in
+ * this collator. The result must be disposed of by using uset_close.
+ * @param coll The UCollator for which we want to get tailored chars
+ * @param status error code of the operation
+ * @return a pointer to newly created USet. Must be be disposed by using uset_close
+ * @see ucol_openRules
+ * @see uset_close
+ * @stable ICU 2.4
+ */
+U_STABLE USet * U_EXPORT2
+ucol_getTailoredSet(const UCollator *coll, UErrorCode *status);
+
+/**
+ * Returned by ucol_collatorToIdentifier to signify that collator is
+ * not encodable as an identifier.
+ * @internal ICU 3.0
+ */
+#define UCOL_SIT_COLLATOR_NOT_ENCODABLE 0x80000000
+
+/**
+ * Get a 31-bit identifier given a collator.
+ * @param coll UCollator
+ * @param locale a locale that will appear as a collators locale in the resulting
+ * short string definition. If NULL, the locale will be harvested
+ * from the collator.
+ * @param status holds error messages
+ * @return 31-bit identifier. MSB is used if the collator cannot be encoded. In that
+ * case UCOL_SIT_COLLATOR_NOT_ENCODABLE is returned
+ * @see ucol_openFromIdentifier
+ * @see ucol_identifierToShortString
+ * @internal ICU 3.0
+ */
+U_INTERNAL uint32_t U_EXPORT2
+ucol_collatorToIdentifier(const UCollator *coll,
+ const char *locale,
+ UErrorCode *status);
+
+/**
+ * Open a collator given a 31-bit identifier
+ * @param identifier 31-bit identifier, encoded by calling ucol_collatorToIdentifier
+ * @param forceDefaults if FALSE, the settings that are the same as the collator
+ * default settings will not be applied (for example, setting
+ * French secondary on a French collator would not be executed).
+ * If TRUE, all the settings will be applied regardless of the
+ * collator default value. If the definition
+ * strings that can be produced from a collator instantiated by
+ * calling this API are to be cached, should be set to FALSE.
+ * @param status for returning errors
+ * @return UCollator object
+ * @see ucol_collatorToIdentifier
+ * @see ucol_identifierToShortString
+ * @internal ICU 3.0
+ */
+U_INTERNAL UCollator* U_EXPORT2
+ucol_openFromIdentifier(uint32_t identifier,
+ UBool forceDefaults,
+ UErrorCode *status);
+
+
+/**
+ * Calculate the short definition string given an identifier. Supports preflighting.
+ * @param identifier 31-bit identifier, encoded by calling ucol_collatorToIdentifier
+ * @param buffer buffer to store the result
+ * @param capacity buffer capacity
+ * @param forceDefaults whether the settings that are the same as the default setting
+ * should be forced anyway. Setting this argument to FALSE reduces
+ * the number of different configurations, but decreases performace
+ * as a collator has to be instantiated.
+ * @param status for returning errors
+ * @return length of the short definition string
+ * @see ucol_collatorToIdentifier
+ * @see ucol_openFromIdentifier
+ * @see ucol_shortStringToIdentifier
+ * @internal ICU 3.0
+ */
+U_INTERNAL int32_t U_EXPORT2
+ucol_identifierToShortString(uint32_t identifier,
+ char *buffer,
+ int32_t capacity,
+ UBool forceDefaults,
+ UErrorCode *status);
+
+/**
+ * Calculate the identifier given a short definition string. Supports preflighting.
+ * @param definition short string definition
+ * @param forceDefaults whether the settings that are the same as the default setting
+ * should be forced anyway. Setting this argument to FALSE reduces
+ * the number of different configurations, but decreases performace
+ * as a collator has to be instantiated.
+ * @param status for returning errors
+ * @return identifier
+ * @see ucol_collatorToIdentifier
+ * @see ucol_openFromIdentifier
+ * @see ucol_identifierToShortString
+ * @internal ICU 3.0
+ */
+U_INTERNAL uint32_t U_EXPORT2
+ucol_shortStringToIdentifier(const char *definition,
+ UBool forceDefaults,
+ UErrorCode *status);
+
+
+
+/**
+ * Universal attribute getter that returns UCOL_DEFAULT if the value is default
+ * @param coll collator which attributes are to be changed
+ * @param attr attribute type
+ * @return attribute value or UCOL_DEFAULT if the value is default
+ * @param status to indicate whether the operation went on smoothly or there were errors
+ * @see UColAttribute
+ * @see UColAttributeValue
+ * @see ucol_setAttribute
+ * @internal ICU 3.0
+ */
+U_INTERNAL UColAttributeValue U_EXPORT2
+ucol_getAttributeOrDefault(const UCollator *coll, UColAttribute attr, UErrorCode *status);
+
+/** Check whether two collators are equal. Collators are considered equal if they
+ * will sort strings the same. This means that both the current attributes and the
+ * rules must be equivalent. Currently used for RuleBasedCollator::operator==.
+ * @param source first collator
+ * @param target second collator
+ * @return TRUE or FALSE
+ * @internal ICU 3.0
+ */
+U_INTERNAL UBool U_EXPORT2
+ucol_equals(const UCollator *source, const UCollator *target);
+
+/** Calculates the set of unsafe code points, given a collator.
+ * A character is unsafe if you could append any character and cause the ordering to alter significantly.
+ * Collation sorts in normalized order, so anything that rearranges in normalization can cause this.
+ * Thus if you have a character like a_umlaut, and you add a lower_dot to it,
+ * then it normalizes to a_lower_dot + umlaut, and sorts differently.
+ * @param coll Collator
+ * @param unsafe a fill-in set to receive the unsafe points
+ * @param status for catching errors
+ * @return number of elements in the set
+ * @internal ICU 3.0
+ */
+U_INTERNAL int32_t U_EXPORT2
+ucol_getUnsafeSet( const UCollator *coll,
+ USet *unsafe,
+ UErrorCode *status);
+
+/** Reset UCA's static pointers. You don't want to use this, unless your static memory can go away.
+ * @internal ICU 3.2.1
+ */
+U_INTERNAL void U_EXPORT2
+ucol_forgetUCA(void);
+
+/** Touches all resources needed for instantiating a collator from a short string definition,
+ * thus filling up the cache.
+ * @param definition A short string containing a locale and a set of attributes.
+ * Attributes not explicitly mentioned are left at the default
+ * state for a locale.
+ * @param parseError if not NULL, structure that will get filled with error's pre
+ * and post context in case of error.
+ * @param forceDefaults if FALSE, the settings that are the same as the collator
+ * default settings will not be applied (for example, setting
+ * French secondary on a French collator would not be executed).
+ * If TRUE, all the settings will be applied regardless of the
+ * collator default value. If the definition
+ * strings are to be cached, should be set to FALSE.
+ * @param status Error code. Apart from regular error conditions connected to
+ * instantiating collators (like out of memory or similar), this
+ * API will return an error if an invalid attribute or attribute/value
+ * combination is specified.
+ * @see ucol_openFromShortString
+ * @internal ICU 3.2.1
+ */
+U_INTERNAL void U_EXPORT2
+ucol_prepareShortStringOpen( const char *definition,
+ UBool forceDefaults,
+ UParseError *parseError,
+ UErrorCode *status);
+
+/** Creates a binary image of a collator. This binary image can be stored and
+ * later used to instantiate a collator using ucol_openBinary.
+ * This API supports preflighting.
+ * @param coll Collator
+ * @param buffer a fill-in buffer to receive the binary image
+ * @param capacity capacity of the destination buffer
+ * @param status for catching errors
+ * @return size of the image
+ * @see ucol_openBinary
+ * @draft ICU 3.2
+ */
+U_DRAFT int32_t U_EXPORT2
+ucol_cloneBinary(const UCollator *coll,
+ uint8_t *buffer, int32_t capacity,
+ UErrorCode *status);
+
+/** Opens a collator from a collator binary image created using
+ * ucol_cloneBinary. Binary image used in instantiation of the
+ * collator remains owned by the user and should stay around for
+ * the lifetime of the collator. The API also takes a base collator
+ * which usualy should be UCA.
+ * @param bin binary image owned by the user and required through the
+ * lifetime of the collator
+ * @param length size of the image. If negative, the API will try to
+ * figure out the length of the image
+ * @param base fallback collator, usually UCA. Base is required to be
+ * present through the lifetime of the collator. Currently
+ * it cannot be NULL.
+ * @param status for catching errors
+ * @return newly created collator
+ * @see ucol_cloneBinary
+ * @draft ICU 3.2
+ */
+U_DRAFT UCollator* U_EXPORT2
+ucol_openBinary(const uint8_t *bin, int32_t length,
+ const UCollator *base,
+ UErrorCode *status);
+
+
+#endif /* #if !UCONFIG_NO_COLLATION */
+
+#endif
+
diff --git a/Source/JavaScriptCore/icu/unicode/uconfig.h b/Source/JavaScriptCore/icu/unicode/uconfig.h
new file mode 100644
index 0000000..997cf68
--- /dev/null
+++ b/Source/JavaScriptCore/icu/unicode/uconfig.h
@@ -0,0 +1,186 @@
+/*
+**********************************************************************
+* Copyright (C) 2002-2004, International Business Machines
+* Corporation and others. All Rights Reserved.
+**********************************************************************
+* file name: uconfig.h
+* encoding: US-ASCII
+* tab size: 8 (not used)
+* indentation:4
+*
+* created on: 2002sep19
+* created by: Markus W. Scherer
+*/
+
+#ifndef __UCONFIG_H__
+#define __UCONFIG_H__
+
+/*!
+ * \file
+ * \brief Switches for excluding parts of ICU library code modules.
+ *
+ * Allows to build partial, smaller libraries for special purposes.
+ * By default, all modules are built.
+ * The switches are fairly coarse, controlling large modules.
+ * Basic services cannot be turned off.
+ *
+ * @stable ICU 2.4
+ */
+
+/**
+ * \def UCONFIG_ONLY_COLLATION
+ * This switch turns off modules that are not needed for collation.
+ *
+ * It does not turn off legacy conversion because that is necessary
+ * for ICU to work on EBCDIC platforms (for the default converter).
+ * If you want "only collation" and do not build for EBCDIC,
+ * then you can #define UCONFIG_NO_LEGACY_CONVERSION 1 as well.
+ *
+ * @stable ICU 2.4
+ */
+#ifndef UCONFIG_ONLY_COLLATION
+# define UCONFIG_ONLY_COLLATION 0
+#endif
+
+#if UCONFIG_ONLY_COLLATION
+ /* common library */
+# define UCONFIG_NO_BREAK_ITERATION 1
+# define UCONFIG_NO_IDNA 1
+
+ /* i18n library */
+# if UCONFIG_NO_COLLATION
+# error Contradictory collation switches in uconfig.h.
+# endif
+# define UCONFIG_NO_FORMATTING 1
+# define UCONFIG_NO_TRANSLITERATION 1
+# define UCONFIG_NO_REGULAR_EXPRESSIONS 1
+#endif
+
+/* common library switches -------------------------------------------------- */
+
+/**
+ * \def UCONFIG_NO_CONVERSION
+ * ICU will not completely build with this switch turned on.
+ * This switch turns off all converters.
+ *
+ * @draft ICU 3.2
+ */
+#ifndef UCONFIG_NO_CONVERSION
+# define UCONFIG_NO_CONVERSION 0
+#endif
+
+#if UCONFIG_NO_CONVERSION
+# define UCONFIG_NO_LEGACY_CONVERSION 1
+#endif
+
+/**
+ * \def UCONFIG_NO_LEGACY_CONVERSION
+ * This switch turns off all converters except for
+ * - Unicode charsets (UTF-7/8/16/32, CESU-8, SCSU, BOCU-1)
+ * - US-ASCII
+ * - ISO-8859-1
+ *
+ * Turning off legacy conversion is not possible on EBCDIC platforms
+ * because they need ibm-37 or ibm-1047 default converters.
+ *
+ * @stable ICU 2.4
+ */
+#ifndef UCONFIG_NO_LEGACY_CONVERSION
+# define UCONFIG_NO_LEGACY_CONVERSION 0
+#endif
+
+/**
+ * \def UCONFIG_NO_NORMALIZATION
+ * This switch turns off normalization.
+ * It implies turning off several other services as well, for example
+ * collation and IDNA.
+ *
+ * @stable ICU 2.6
+ */
+#ifndef UCONFIG_NO_NORMALIZATION
+# define UCONFIG_NO_NORMALIZATION 0
+#elif UCONFIG_NO_NORMALIZATION
+ /* common library */
+# define UCONFIG_NO_IDNA 1
+
+ /* i18n library */
+# if UCONFIG_ONLY_COLLATION
+# error Contradictory collation switches in uconfig.h.
+# endif
+# define UCONFIG_NO_COLLATION 1
+# define UCONFIG_NO_TRANSLITERATION 1
+#endif
+
+/**
+ * \def UCONFIG_NO_BREAK_ITERATION
+ * This switch turns off break iteration.
+ *
+ * @stable ICU 2.4
+ */
+#ifndef UCONFIG_NO_BREAK_ITERATION
+# define UCONFIG_NO_BREAK_ITERATION 0
+#endif
+
+/**
+ * \def UCONFIG_NO_IDNA
+ * This switch turns off IDNA.
+ *
+ * @stable ICU 2.6
+ */
+#ifndef UCONFIG_NO_IDNA
+# define UCONFIG_NO_IDNA 0
+#endif
+
+/* i18n library switches ---------------------------------------------------- */
+
+/**
+ * \def UCONFIG_NO_COLLATION
+ * This switch turns off collation and collation-based string search.
+ *
+ * @stable ICU 2.4
+ */
+#ifndef UCONFIG_NO_COLLATION
+# define UCONFIG_NO_COLLATION 0
+#endif
+
+/**
+ * \def UCONFIG_NO_FORMATTING
+ * This switch turns off formatting and calendar/timezone services.
+ *
+ * @stable ICU 2.4
+ */
+#ifndef UCONFIG_NO_FORMATTING
+# define UCONFIG_NO_FORMATTING 0
+#endif
+
+/**
+ * \def UCONFIG_NO_TRANSLITERATION
+ * This switch turns off transliteration.
+ *
+ * @stable ICU 2.4
+ */
+#ifndef UCONFIG_NO_TRANSLITERATION
+# define UCONFIG_NO_TRANSLITERATION 0
+#endif
+
+/**
+ * \def UCONFIG_NO_REGULAR_EXPRESSIONS
+ * This switch turns off regular expressions.
+ *
+ * @stable ICU 2.4
+ */
+#ifndef UCONFIG_NO_REGULAR_EXPRESSIONS
+# define UCONFIG_NO_REGULAR_EXPRESSIONS 0
+#endif
+
+/**
+ * \def UCONFIG_NO_SERVICE
+ * This switch turns off service registration.
+ *
+ * @draft ICU 3.2
+ */
+#ifndef UCONFIG_NO_SERVICE
+# define UCONFIG_NO_SERVICE 0
+#endif
+
+#endif
diff --git a/Source/JavaScriptCore/icu/unicode/uenum.h b/Source/JavaScriptCore/icu/unicode/uenum.h
new file mode 100644
index 0000000..63690f8
--- /dev/null
+++ b/Source/JavaScriptCore/icu/unicode/uenum.h
@@ -0,0 +1,129 @@
+/*
+*******************************************************************************
+*
+* Copyright (C) 2002-2004, International Business Machines
+* Corporation and others. All Rights Reserved.
+*
+*******************************************************************************
+* file name: uenum.h
+* encoding: US-ASCII
+* tab size: 8 (not used)
+* indentation:2
+*
+* created on: 2002jul08
+* created by: Vladimir Weinstein
+*/
+
+#ifndef __UENUM_H
+#define __UENUM_H
+
+#include "unicode/utypes.h"
+
+/**
+ * An enumeration object.
+ * For usage in C programs.
+ * @stable ICU 2.2
+ */
+struct UEnumeration;
+/** structure representing an enumeration object instance @stable ICU 2.2 */
+typedef struct UEnumeration UEnumeration;
+
+/**
+ * Disposes of resources in use by the iterator. If en is NULL,
+ * does nothing. After this call, any char* or UChar* pointer
+ * returned by uenum_unext() or uenum_next() is invalid.
+ * @param en UEnumeration structure pointer
+ * @stable ICU 2.2
+ */
+U_STABLE void U_EXPORT2
+uenum_close(UEnumeration* en);
+
+/**
+ * Returns the number of elements that the iterator traverses. If
+ * the iterator is out-of-sync with its service, status is set to
+ * U_ENUM_OUT_OF_SYNC_ERROR.
+ * This is a convenience function. It can end up being very
+ * expensive as all the items might have to be pre-fetched (depending
+ * on the type of data being traversed). Use with caution and only
+ * when necessary.
+ * @param en UEnumeration structure pointer
+ * @param status error code, can be U_ENUM_OUT_OF_SYNC_ERROR if the
+ * iterator is out of sync.
+ * @return number of elements in the iterator
+ * @stable ICU 2.2
+ */
+U_STABLE int32_t U_EXPORT2
+uenum_count(UEnumeration* en, UErrorCode* status);
+
+/**
+ * Returns the next element in the iterator's list. If there are
+ * no more elements, returns NULL. If the iterator is out-of-sync
+ * with its service, status is set to U_ENUM_OUT_OF_SYNC_ERROR and
+ * NULL is returned. If the native service string is a char* string,
+ * it is converted to UChar* with the invariant converter.
+ * The result is terminated by (UChar)0.
+ * @param en the iterator object
+ * @param resultLength pointer to receive the length of the result
+ * (not including the terminating \\0).
+ * If the pointer is NULL it is ignored.
+ * @param status the error code, set to U_ENUM_OUT_OF_SYNC_ERROR if
+ * the iterator is out of sync with its service.
+ * @return a pointer to the string. The string will be
+ * zero-terminated. The return pointer is owned by this iterator
+ * and must not be deleted by the caller. The pointer is valid
+ * until the next call to any uenum_... method, including
+ * uenum_next() or uenum_unext(). When all strings have been
+ * traversed, returns NULL.
+ * @stable ICU 2.2
+ */
+U_STABLE const UChar* U_EXPORT2
+uenum_unext(UEnumeration* en,
+ int32_t* resultLength,
+ UErrorCode* status);
+
+/**
+ * Returns the next element in the iterator's list. If there are
+ * no more elements, returns NULL. If the iterator is out-of-sync
+ * with its service, status is set to U_ENUM_OUT_OF_SYNC_ERROR and
+ * NULL is returned. If the native service string is a UChar*
+ * string, it is converted to char* with the invariant converter.
+ * The result is terminated by (char)0. If the conversion fails
+ * (because a character cannot be converted) then status is set to
+ * U_INVARIANT_CONVERSION_ERROR and the return value is undefined
+ * (but non-NULL).
+ * @param en the iterator object
+ * @param resultLength pointer to receive the length of the result
+ * (not including the terminating \\0).
+ * If the pointer is NULL it is ignored.
+ * @param status the error code, set to U_ENUM_OUT_OF_SYNC_ERROR if
+ * the iterator is out of sync with its service. Set to
+ * U_INVARIANT_CONVERSION_ERROR if the underlying native string is
+ * UChar* and conversion to char* with the invariant converter
+ * fails. This error pertains only to current string, so iteration
+ * might be able to continue successfully.
+ * @return a pointer to the string. The string will be
+ * zero-terminated. The return pointer is owned by this iterator
+ * and must not be deleted by the caller. The pointer is valid
+ * until the next call to any uenum_... method, including
+ * uenum_next() or uenum_unext(). When all strings have been
+ * traversed, returns NULL.
+ * @stable ICU 2.2
+ */
+U_STABLE const char* U_EXPORT2
+uenum_next(UEnumeration* en,
+ int32_t* resultLength,
+ UErrorCode* status);
+
+/**
+ * Resets the iterator to the current list of service IDs. This
+ * re-establishes sync with the service and rewinds the iterator
+ * to start at the first element.
+ * @param en the iterator object
+ * @param status the error code, set to U_ENUM_OUT_OF_SYNC_ERROR if
+ * the iterator is out of sync with its service.
+ * @stable ICU 2.2
+ */
+U_STABLE void U_EXPORT2
+uenum_reset(UEnumeration* en, UErrorCode* status);
+
+#endif
diff --git a/Source/JavaScriptCore/icu/unicode/uiter.h b/Source/JavaScriptCore/icu/unicode/uiter.h
new file mode 100644
index 0000000..963df5c
--- /dev/null
+++ b/Source/JavaScriptCore/icu/unicode/uiter.h
@@ -0,0 +1,707 @@
+/*
+*******************************************************************************
+*
+* Copyright (C) 2002-2004, International Business Machines
+* Corporation and others. All Rights Reserved.
+*
+*******************************************************************************
+* file name: uiter.h
+* encoding: US-ASCII
+* tab size: 8 (not used)
+* indentation:4
+*
+* created on: 2002jan18
+* created by: Markus W. Scherer
+*/
+
+#ifndef __UITER_H__
+#define __UITER_H__
+
+/**
+ * \file
+ * \brief C API: Unicode Character Iteration
+ *
+ * @see UCharIterator
+ */
+
+#include "unicode/utypes.h"
+
+#ifdef XP_CPLUSPLUS
+ U_NAMESPACE_BEGIN
+
+ class CharacterIterator;
+ class Replaceable;
+
+ U_NAMESPACE_END
+#endif
+
+U_CDECL_BEGIN
+
+struct UCharIterator;
+typedef struct UCharIterator UCharIterator; /**< C typedef for struct UCharIterator. @stable ICU 2.1 */
+
+/**
+ * Origin constants for UCharIterator.getIndex() and UCharIterator.move().
+ * @see UCharIteratorMove
+ * @see UCharIterator
+ * @stable ICU 2.1
+ */
+typedef enum UCharIteratorOrigin {
+ UITER_START, UITER_CURRENT, UITER_LIMIT, UITER_ZERO, UITER_LENGTH
+} UCharIteratorOrigin;
+
+/** Constants for UCharIterator. @stable ICU 2.6 */
+enum {
+ /**
+ * Constant value that may be returned by UCharIteratorMove
+ * indicating that the final UTF-16 index is not known, but that the move succeeded.
+ * This can occur when moving relative to limit or length, or
+ * when moving relative to the current index after a setState()
+ * when the current UTF-16 index is not known.
+ *
+ * It would be very inefficient to have to count from the beginning of the text
+ * just to get the current/limit/length index after moving relative to it.
+ * The actual index can be determined with getIndex(UITER_CURRENT)
+ * which will count the UChars if necessary.
+ *
+ * @stable ICU 2.6
+ */
+ UITER_UNKNOWN_INDEX=-2
+};
+
+
+/**
+ * Constant for UCharIterator getState() indicating an error or
+ * an unknown state.
+ * Returned by uiter_getState()/UCharIteratorGetState
+ * when an error occurs.
+ * Also, some UCharIterator implementations may not be able to return
+ * a valid state for each position. This will be clearly documented
+ * for each such iterator (none of the public ones here).
+ *
+ * @stable ICU 2.6
+ */
+#define UITER_NO_STATE ((uint32_t)0xffffffff)
+
+/**
+ * Function type declaration for UCharIterator.getIndex().
+ *
+ * Gets the current position, or the start or limit of the
+ * iteration range.
+ *
+ * This function may perform slowly for UITER_CURRENT after setState() was called,
+ * or for UITER_LENGTH, because an iterator implementation may have to count
+ * UChars if the underlying storage is not UTF-16.
+ *
+ * @param iter the UCharIterator structure ("this pointer")
+ * @param origin get the 0, start, limit, length, or current index
+ * @return the requested index, or U_SENTINEL in an error condition
+ *
+ * @see UCharIteratorOrigin
+ * @see UCharIterator
+ * @stable ICU 2.1
+ */
+typedef int32_t U_CALLCONV
+UCharIteratorGetIndex(UCharIterator *iter, UCharIteratorOrigin origin);
+
+/**
+ * Function type declaration for UCharIterator.move().
+ *
+ * Use iter->move(iter, index, UITER_ZERO) like CharacterIterator::setIndex(index).
+ *
+ * Moves the current position relative to the start or limit of the
+ * iteration range, or relative to the current position itself.
+ * The movement is expressed in numbers of code units forward
+ * or backward by specifying a positive or negative delta.
+ * Out of bounds movement will be pinned to the start or limit.
+ *
+ * This function may perform slowly for moving relative to UITER_LENGTH
+ * because an iterator implementation may have to count the rest of the
+ * UChars if the native storage is not UTF-16.
+ *
+ * When moving relative to the limit or length, or
+ * relative to the current position after setState() was called,
+ * move() may return UITER_UNKNOWN_INDEX (-2) to avoid an inefficient
+ * determination of the actual UTF-16 index.
+ * The actual index can be determined with getIndex(UITER_CURRENT)
+ * which will count the UChars if necessary.
+ * See UITER_UNKNOWN_INDEX for details.
+ *
+ * @param iter the UCharIterator structure ("this pointer")
+ * @param delta can be positive, zero, or negative
+ * @param origin move relative to the 0, start, limit, length, or current index
+ * @return the new index, or U_SENTINEL on an error condition,
+ * or UITER_UNKNOWN_INDEX when the index is not known.
+ *
+ * @see UCharIteratorOrigin
+ * @see UCharIterator
+ * @see UITER_UNKNOWN_INDEX
+ * @stable ICU 2.1
+ */
+typedef int32_t U_CALLCONV
+UCharIteratorMove(UCharIterator *iter, int32_t delta, UCharIteratorOrigin origin);
+
+/**
+ * Function type declaration for UCharIterator.hasNext().
+ *
+ * Check if current() and next() can still
+ * return another code unit.
+ *
+ * @param iter the UCharIterator structure ("this pointer")
+ * @return boolean value for whether current() and next() can still return another code unit
+ *
+ * @see UCharIterator
+ * @stable ICU 2.1
+ */
+typedef UBool U_CALLCONV
+UCharIteratorHasNext(UCharIterator *iter);
+
+/**
+ * Function type declaration for UCharIterator.hasPrevious().
+ *
+ * Check if previous() can still return another code unit.
+ *
+ * @param iter the UCharIterator structure ("this pointer")
+ * @return boolean value for whether previous() can still return another code unit
+ *
+ * @see UCharIterator
+ * @stable ICU 2.1
+ */
+typedef UBool U_CALLCONV
+UCharIteratorHasPrevious(UCharIterator *iter);
+
+/**
+ * Function type declaration for UCharIterator.current().
+ *
+ * Return the code unit at the current position,
+ * or U_SENTINEL if there is none (index is at the limit).
+ *
+ * @param iter the UCharIterator structure ("this pointer")
+ * @return the current code unit
+ *
+ * @see UCharIterator
+ * @stable ICU 2.1
+ */
+typedef UChar32 U_CALLCONV
+UCharIteratorCurrent(UCharIterator *iter);
+
+/**
+ * Function type declaration for UCharIterator.next().
+ *
+ * Return the code unit at the current index and increment
+ * the index (post-increment, like s[i++]),
+ * or return U_SENTINEL if there is none (index is at the limit).
+ *
+ * @param iter the UCharIterator structure ("this pointer")
+ * @return the current code unit (and post-increment the current index)
+ *
+ * @see UCharIterator
+ * @stable ICU 2.1
+ */
+typedef UChar32 U_CALLCONV
+UCharIteratorNext(UCharIterator *iter);
+
+/**
+ * Function type declaration for UCharIterator.previous().
+ *
+ * Decrement the index and return the code unit from there
+ * (pre-decrement, like s[--i]),
+ * or return U_SENTINEL if there is none (index is at the start).
+ *
+ * @param iter the UCharIterator structure ("this pointer")
+ * @return the previous code unit (after pre-decrementing the current index)
+ *
+ * @see UCharIterator
+ * @stable ICU 2.1
+ */
+typedef UChar32 U_CALLCONV
+UCharIteratorPrevious(UCharIterator *iter);
+
+/**
+ * Function type declaration for UCharIterator.reservedFn().
+ * Reserved for future use.
+ *
+ * @param iter the UCharIterator structure ("this pointer")
+ * @param something some integer argument
+ * @return some integer
+ *
+ * @see UCharIterator
+ * @stable ICU 2.1
+ */
+typedef int32_t U_CALLCONV
+UCharIteratorReserved(UCharIterator *iter, int32_t something);
+
+/**
+ * Function type declaration for UCharIterator.getState().
+ *
+ * Get the "state" of the iterator in the form of a single 32-bit word.
+ * It is recommended that the state value be calculated to be as small as
+ * is feasible. For strings with limited lengths, fewer than 32 bits may
+ * be sufficient.
+ *
+ * This is used together with setState()/UCharIteratorSetState
+ * to save and restore the iterator position more efficiently than with
+ * getIndex()/move().
+ *
+ * The iterator state is defined as a uint32_t value because it is designed
+ * for use in ucol_nextSortKeyPart() which provides 32 bits to store the state
+ * of the character iterator.
+ *
+ * With some UCharIterator implementations (e.g., UTF-8),
+ * getting and setting the UTF-16 index with existing functions
+ * (getIndex(UITER_CURRENT) followed by move(pos, UITER_ZERO)) is possible but
+ * relatively slow because the iterator has to "walk" from a known index
+ * to the requested one.
+ * This takes more time the farther it needs to go.
+ *
+ * An opaque state value allows an iterator implementation to provide
+ * an internal index (UTF-8: the source byte array index) for
+ * fast, constant-time restoration.
+ *
+ * After calling setState(), a getIndex(UITER_CURRENT) may be slow because
+ * the UTF-16 index may not be restored as well, but the iterator can deliver
+ * the correct text contents and move relative to the current position
+ * without performance degradation.
+ *
+ * Some UCharIterator implementations may not be able to return
+ * a valid state for each position, in which case they return UITER_NO_STATE instead.
+ * This will be clearly documented for each such iterator (none of the public ones here).
+ *
+ * @param iter the UCharIterator structure ("this pointer")
+ * @return the state word
+ *
+ * @see UCharIterator
+ * @see UCharIteratorSetState
+ * @see UITER_NO_STATE
+ * @stable ICU 2.6
+ */
+typedef uint32_t U_CALLCONV
+UCharIteratorGetState(const UCharIterator *iter);
+
+/**
+ * Function type declaration for UCharIterator.setState().
+ *
+ * Restore the "state" of the iterator using a state word from a getState() call.
+ * The iterator object need not be the same one as for which getState() was called,
+ * but it must be of the same type (set up using the same uiter_setXYZ function)
+ * and it must iterate over the same string
+ * (binary identical regardless of memory address).
+ * For more about the state word see UCharIteratorGetState.
+ *
+ * After calling setState(), a getIndex(UITER_CURRENT) may be slow because
+ * the UTF-16 index may not be restored as well, but the iterator can deliver
+ * the correct text contents and move relative to the current position
+ * without performance degradation.
+ *
+ * @param iter the UCharIterator structure ("this pointer")
+ * @param state the state word from a getState() call
+ * on a same-type, same-string iterator
+ * @param pErrorCode Must be a valid pointer to an error code value,
+ * which must not indicate a failure before the function call.
+ *
+ * @see UCharIterator
+ * @see UCharIteratorGetState
+ * @stable ICU 2.6
+ */
+typedef void U_CALLCONV
+UCharIteratorSetState(UCharIterator *iter, uint32_t state, UErrorCode *pErrorCode);
+
+
+/**
+ * C API for code unit iteration.
+ * This can be used as a C wrapper around
+ * CharacterIterator, Replaceable, or implemented using simple strings, etc.
+ *
+ * There are two roles for using UCharIterator:
+ *
+ * A "provider" sets the necessary function pointers and controls the "protected"
+ * fields of the UCharIterator structure. A "provider" passes a UCharIterator
+ * into C APIs that need a UCharIterator as an abstract, flexible string interface.
+ *
+ * Implementations of such C APIs are "callers" of UCharIterator functions;
+ * they only use the "public" function pointers and never access the "protected"
+ * fields directly.
+ *
+ * The current() and next() functions only check the current index against the
+ * limit, and previous() only checks the current index against the start,
+ * to see if the iterator already reached the end of the iteration range.
+ *
+ * The assumption - in all iterators - is that the index is moved via the API,
+ * which means it won't go out of bounds, or the index is modified by
+ * user code that knows enough about the iterator implementation to set valid
+ * index values.
+ *
+ * UCharIterator functions return code unit values 0..0xffff,
+ * or U_SENTINEL if the iteration bounds are reached.
+ *
+ * @stable ICU 2.1
+ */
+struct UCharIterator {
+ /**
+ * (protected) Pointer to string or wrapped object or similar.
+ * Not used by caller.
+ * @stable ICU 2.1
+ */
+ const void *context;
+
+ /**
+ * (protected) Length of string or similar.
+ * Not used by caller.
+ * @stable ICU 2.1
+ */
+ int32_t length;
+
+ /**
+ * (protected) Start index or similar.
+ * Not used by caller.
+ * @stable ICU 2.1
+ */
+ int32_t start;
+
+ /**
+ * (protected) Current index or similar.
+ * Not used by caller.
+ * @stable ICU 2.1
+ */
+ int32_t index;
+
+ /**
+ * (protected) Limit index or similar.
+ * Not used by caller.
+ * @stable ICU 2.1
+ */
+ int32_t limit;
+
+ /**
+ * (protected) Used by UTF-8 iterators and possibly others.
+ * @stable ICU 2.1
+ */
+ int32_t reservedField;
+
+ /**
+ * (public) Returns the current position or the
+ * start or limit index of the iteration range.
+ *
+ * @see UCharIteratorGetIndex
+ * @stable ICU 2.1
+ */
+ UCharIteratorGetIndex *getIndex;
+
+ /**
+ * (public) Moves the current position relative to the start or limit of the
+ * iteration range, or relative to the current position itself.
+ * The movement is expressed in numbers of code units forward
+ * or backward by specifying a positive or negative delta.
+ *
+ * @see UCharIteratorMove
+ * @stable ICU 2.1
+ */
+ UCharIteratorMove *move;
+
+ /**
+ * (public) Check if current() and next() can still
+ * return another code unit.
+ *
+ * @see UCharIteratorHasNext
+ * @stable ICU 2.1
+ */
+ UCharIteratorHasNext *hasNext;
+
+ /**
+ * (public) Check if previous() can still return another code unit.
+ *
+ * @see UCharIteratorHasPrevious
+ * @stable ICU 2.1
+ */
+ UCharIteratorHasPrevious *hasPrevious;
+
+ /**
+ * (public) Return the code unit at the current position,
+ * or U_SENTINEL if there is none (index is at the limit).
+ *
+ * @see UCharIteratorCurrent
+ * @stable ICU 2.1
+ */
+ UCharIteratorCurrent *current;
+
+ /**
+ * (public) Return the code unit at the current index and increment
+ * the index (post-increment, like s[i++]),
+ * or return U_SENTINEL if there is none (index is at the limit).
+ *
+ * @see UCharIteratorNext
+ * @stable ICU 2.1
+ */
+ UCharIteratorNext *next;
+
+ /**
+ * (public) Decrement the index and return the code unit from there
+ * (pre-decrement, like s[--i]),
+ * or return U_SENTINEL if there is none (index is at the start).
+ *
+ * @see UCharIteratorPrevious
+ * @stable ICU 2.1
+ */
+ UCharIteratorPrevious *previous;
+
+ /**
+ * (public) Reserved for future use. Currently NULL.
+ *
+ * @see UCharIteratorReserved
+ * @stable ICU 2.1
+ */
+ UCharIteratorReserved *reservedFn;
+
+ /**
+ * (public) Return the state of the iterator, to be restored later with setState().
+ * This function pointer is NULL if the iterator does not implement it.
+ *
+ * @see UCharIteratorGet
+ * @stable ICU 2.6
+ */
+ UCharIteratorGetState *getState;
+
+ /**
+ * (public) Restore the iterator state from the state word from a call
+ * to getState().
+ * This function pointer is NULL if the iterator does not implement it.
+ *
+ * @see UCharIteratorSet
+ * @stable ICU 2.6
+ */
+ UCharIteratorSetState *setState;
+};
+
+/**
+ * Helper function for UCharIterator to get the code point
+ * at the current index.
+ *
+ * Return the code point that includes the code unit at the current position,
+ * or U_SENTINEL if there is none (index is at the limit).
+ * If the current code unit is a lead or trail surrogate,
+ * then the following or preceding surrogate is used to form
+ * the code point value.
+ *
+ * @param iter the UCharIterator structure ("this pointer")
+ * @return the current code point
+ *
+ * @see UCharIterator
+ * @see U16_GET
+ * @see UnicodeString::char32At()
+ * @stable ICU 2.1
+ */
+U_STABLE UChar32 U_EXPORT2
+uiter_current32(UCharIterator *iter);
+
+/**
+ * Helper function for UCharIterator to get the next code point.
+ *
+ * Return the code point at the current index and increment
+ * the index (post-increment, like s[i++]),
+ * or return U_SENTINEL if there is none (index is at the limit).
+ *
+ * @param iter the UCharIterator structure ("this pointer")
+ * @return the current code point (and post-increment the current index)
+ *
+ * @see UCharIterator
+ * @see U16_NEXT
+ * @stable ICU 2.1
+ */
+U_STABLE UChar32 U_EXPORT2
+uiter_next32(UCharIterator *iter);
+
+/**
+ * Helper function for UCharIterator to get the previous code point.
+ *
+ * Decrement the index and return the code point from there
+ * (pre-decrement, like s[--i]),
+ * or return U_SENTINEL if there is none (index is at the start).
+ *
+ * @param iter the UCharIterator structure ("this pointer")
+ * @return the previous code point (after pre-decrementing the current index)
+ *
+ * @see UCharIterator
+ * @see U16_PREV
+ * @stable ICU 2.1
+ */
+U_STABLE UChar32 U_EXPORT2
+uiter_previous32(UCharIterator *iter);
+
+/**
+ * Get the "state" of the iterator in the form of a single 32-bit word.
+ * This is a convenience function that calls iter->getState(iter)
+ * if iter->getState is not NULL;
+ * if it is NULL or any other error occurs, then UITER_NO_STATE is returned.
+ *
+ * Some UCharIterator implementations may not be able to return
+ * a valid state for each position, in which case they return UITER_NO_STATE instead.
+ * This will be clearly documented for each such iterator (none of the public ones here).
+ *
+ * @param iter the UCharIterator structure ("this pointer")
+ * @return the state word
+ *
+ * @see UCharIterator
+ * @see UCharIteratorGetState
+ * @see UITER_NO_STATE
+ * @stable ICU 2.6
+ */
+U_STABLE uint32_t U_EXPORT2
+uiter_getState(const UCharIterator *iter);
+
+/**
+ * Restore the "state" of the iterator using a state word from a getState() call.
+ * This is a convenience function that calls iter->setState(iter, state, pErrorCode)
+ * if iter->setState is not NULL; if it is NULL, then U_UNSUPPORTED_ERROR is set.
+ *
+ * @param iter the UCharIterator structure ("this pointer")
+ * @param state the state word from a getState() call
+ * on a same-type, same-string iterator
+ * @param pErrorCode Must be a valid pointer to an error code value,
+ * which must not indicate a failure before the function call.
+ *
+ * @see UCharIterator
+ * @see UCharIteratorSetState
+ * @stable ICU 2.6
+ */
+U_STABLE void U_EXPORT2
+uiter_setState(UCharIterator *iter, uint32_t state, UErrorCode *pErrorCode);
+
+/**
+ * Set up a UCharIterator to iterate over a string.
+ *
+ * Sets the UCharIterator function pointers for iteration over the string s
+ * with iteration boundaries start=index=0 and length=limit=string length.
+ * The "provider" may set the start, index, and limit values at any time
+ * within the range 0..length.
+ * The length field will be ignored.
+ *
+ * The string pointer s is set into UCharIterator.context without copying
+ * or reallocating the string contents.
+ *
+ * getState() simply returns the current index.
+ * move() will always return the final index.
+ *
+ * @param iter UCharIterator structure to be set for iteration
+ * @param s String to iterate over
+ * @param length Length of s, or -1 if NUL-terminated
+ *
+ * @see UCharIterator
+ * @stable ICU 2.1
+ */
+U_STABLE void U_EXPORT2
+uiter_setString(UCharIterator *iter, const UChar *s, int32_t length);
+
+/**
+ * Set up a UCharIterator to iterate over a UTF-16BE string
+ * (byte vector with a big-endian pair of bytes per UChar).
+ *
+ * Everything works just like with a normal UChar iterator (uiter_setString),
+ * except that UChars are assembled from byte pairs,
+ * and that the length argument here indicates an even number of bytes.
+ *
+ * getState() simply returns the current index.
+ * move() will always return the final index.
+ *
+ * @param iter UCharIterator structure to be set for iteration
+ * @param s UTF-16BE string to iterate over
+ * @param length Length of s as an even number of bytes, or -1 if NUL-terminated
+ * (NUL means pair of 0 bytes at even index from s)
+ *
+ * @see UCharIterator
+ * @see uiter_setString
+ * @stable ICU 2.6
+ */
+U_STABLE void U_EXPORT2
+uiter_setUTF16BE(UCharIterator *iter, const char *s, int32_t length);
+
+/**
+ * Set up a UCharIterator to iterate over a UTF-8 string.
+ *
+ * Sets the UCharIterator function pointers for iteration over the UTF-8 string s
+ * with UTF-8 iteration boundaries 0 and length.
+ * The implementation counts the UTF-16 index on the fly and
+ * lazily evaluates the UTF-16 length of the text.
+ *
+ * The start field is used as the UTF-8 offset, the limit field as the UTF-8 length.
+ * When the reservedField is not 0, then it contains a supplementary code point
+ * and the UTF-16 index is between the two corresponding surrogates.
+ * At that point, the UTF-8 index is behind that code point.
+ *
+ * The UTF-8 string pointer s is set into UCharIterator.context without copying
+ * or reallocating the string contents.
+ *
+ * getState() returns a state value consisting of
+ * - the current UTF-8 source byte index (bits 31..1)
+ * - a flag (bit 0) that indicates whether the UChar position is in the middle
+ * of a surrogate pair
+ * (from a 4-byte UTF-8 sequence for the corresponding supplementary code point)
+ *
+ * getState() cannot also encode the UTF-16 index in the state value.
+ * move(relative to limit or length), or
+ * move(relative to current) after setState(), may return UITER_UNKNOWN_INDEX.
+ *
+ * @param iter UCharIterator structure to be set for iteration
+ * @param s UTF-8 string to iterate over
+ * @param length Length of s in bytes, or -1 if NUL-terminated
+ *
+ * @see UCharIterator
+ * @stable ICU 2.6
+ */
+U_STABLE void U_EXPORT2
+uiter_setUTF8(UCharIterator *iter, const char *s, int32_t length);
+
+#ifdef XP_CPLUSPLUS
+
+/**
+ * Set up a UCharIterator to wrap around a C++ CharacterIterator.
+ *
+ * Sets the UCharIterator function pointers for iteration using the
+ * CharacterIterator charIter.
+ *
+ * The CharacterIterator pointer charIter is set into UCharIterator.context
+ * without copying or cloning the CharacterIterator object.
+ * The other "protected" UCharIterator fields are set to 0 and will be ignored.
+ * The iteration index and boundaries are controlled by the CharacterIterator.
+ *
+ * getState() simply returns the current index.
+ * move() will always return the final index.
+ *
+ * @param iter UCharIterator structure to be set for iteration
+ * @param charIter CharacterIterator to wrap
+ *
+ * @see UCharIterator
+ * @stable ICU 2.1
+ */
+U_STABLE void U_EXPORT2
+uiter_setCharacterIterator(UCharIterator *iter, CharacterIterator *charIter);
+
+/**
+ * Set up a UCharIterator to iterate over a C++ Replaceable.
+ *
+ * Sets the UCharIterator function pointers for iteration over the
+ * Replaceable rep with iteration boundaries start=index=0 and
+ * length=limit=rep->length().
+ * The "provider" may set the start, index, and limit values at any time
+ * within the range 0..length=rep->length().
+ * The length field will be ignored.
+ *
+ * The Replaceable pointer rep is set into UCharIterator.context without copying
+ * or cloning/reallocating the Replaceable object.
+ *
+ * getState() simply returns the current index.
+ * move() will always return the final index.
+ *
+ * @param iter UCharIterator structure to be set for iteration
+ * @param rep Replaceable to iterate over
+ *
+ * @see UCharIterator
+ * @stable ICU 2.1
+ */
+U_STABLE void U_EXPORT2
+uiter_setReplaceable(UCharIterator *iter, const Replaceable *rep);
+
+#endif
+
+U_CDECL_END
+
+#endif
diff --git a/Source/JavaScriptCore/icu/unicode/uloc.h b/Source/JavaScriptCore/icu/unicode/uloc.h
new file mode 100644
index 0000000..f584ec1
--- /dev/null
+++ b/Source/JavaScriptCore/icu/unicode/uloc.h
@@ -0,0 +1,917 @@
+/*
+**********************************************************************
+* Copyright (C) 1997-2004, International Business Machines
+* Corporation and others. All Rights Reserved.
+**********************************************************************
+*
+* File ULOC.H
+*
+* Modification History:
+*
+* Date Name Description
+* 04/01/97 aliu Creation.
+* 08/22/98 stephen JDK 1.2 sync.
+* 12/08/98 rtg New C API for Locale
+* 03/30/99 damiba overhaul
+* 03/31/99 helena Javadoc for uloc functions.
+* 04/15/99 Madhu Updated Javadoc
+********************************************************************************
+*/
+
+#ifndef ULOC_H
+#define ULOC_H
+
+#include "unicode/utypes.h"
+#include "unicode/uenum.h"
+
+/**
+ * \file
+ * \brief C API: Locale
+ *
+ * <h2> ULoc C API for Locale </h2>
+ * A <code>Locale</code> represents a specific geographical, political,
+ * or cultural region. An operation that requires a <code>Locale</code> to perform
+ * its task is called <em>locale-sensitive</em> and uses the <code>Locale</code>
+ * to tailor information for the user. For example, displaying a number
+ * is a locale-sensitive operation--the number should be formatted
+ * according to the customs/conventions of the user's native country,
+ * region, or culture. In the C APIs, a locales is simply a const char string.
+ *
+ * <P>
+ * You create a <code>Locale</code> with one of the three options listed below.
+ * Each of the component is separated by '_' in the locale string.
+ * \htmlonly<blockquote>\endhtmlonly
+ * <pre>
+ * \code
+ * newLanguage
+ *
+ * newLanguage + newCountry
+ *
+ * newLanguage + newCountry + newVariant
+ * \endcode
+ * </pre>
+ * \htmlonly</blockquote>\endhtmlonly
+ * The first option is a valid <STRONG>ISO
+ * Language Code.</STRONG> These codes are the lower-case two-letter
+ * codes as defined by ISO-639.
+ * You can find a full list of these codes at a number of sites, such as:
+ * <BR><a href ="http://www.ics.uci.edu/pub/ietf/http/related/iso639.txt">
+ * http://www.ics.uci.edu/pub/ietf/http/related/iso639.txt</a>
+ *
+ * <P>
+ * The second option includes an additonal <STRONG>ISO Country
+ * Code.</STRONG> These codes are the upper-case two-letter codes
+ * as defined by ISO-3166.
+ * You can find a full list of these codes at a number of sites, such as:
+ * <BR><a href="http://www.chemie.fu-berlin.de/diverse/doc/ISO_3166.html">
+ * http://www.chemie.fu-berlin.de/diverse/doc/ISO_3166.html</a>
+ *
+ * <P>
+ * The third option requires another additonal information--the
+ * <STRONG>Variant.</STRONG>
+ * The Variant codes are vendor and browser-specific.
+ * For example, use WIN for Windows, MAC for Macintosh, and POSIX for POSIX.
+ * Where there are two variants, separate them with an underscore, and
+ * put the most important one first. For
+ * example, a Traditional Spanish collation might be referenced, with
+ * "ES", "ES", "Traditional_WIN".
+ *
+ * <P>
+ * Because a <code>Locale</code> is just an identifier for a region,
+ * no validity check is performed when you specify a <code>Locale</code>.
+ * If you want to see whether particular resources are available for the
+ * <code>Locale</code> you asked for, you must query those resources. For
+ * example, ask the <code>UNumberFormat</code> for the locales it supports
+ * using its <code>getAvailable</code> method.
+ * <BR><STRONG>Note:</STRONG> When you ask for a resource for a particular
+ * locale, you get back the best available match, not necessarily
+ * precisely what you asked for. For more information, look at
+ * <code>UResourceBundle</code>.
+ *
+ * <P>
+ * The <code>Locale</code> provides a number of convenient constants
+ * that you can use to specify the commonly used
+ * locales. For example, the following refers to a locale
+ * for the United States:
+ * \htmlonly<blockquote>\endhtmlonly
+ * <pre>
+ * \code
+ * ULOC_US
+ * \endcode
+ * </pre>
+ * \htmlonly</blockquote>\endhtmlonly
+ *
+ * <P>
+ * Once you've specified a locale you can query it for information about
+ * itself. Use <code>uloc_getCountry</code> to get the ISO Country Code and
+ * <code>uloc_getLanguage</code> to get the ISO Language Code. You can
+ * use <code>uloc_getDisplayCountry</code> to get the
+ * name of the country suitable for displaying to the user. Similarly,
+ * you can use <code>uloc_getDisplayLanguage</code> to get the name of
+ * the language suitable for displaying to the user. Interestingly,
+ * the <code>uloc_getDisplayXXX</code> methods are themselves locale-sensitive
+ * and have two versions: one that uses the default locale and one
+ * that takes a locale as an argument and displays the name or country in
+ * a language appropriate to that locale.
+ *
+ * <P>
+ * The ICU provides a number of services that perform locale-sensitive
+ * operations. For example, the <code>unum_xxx</code> functions format
+ * numbers, currency, or percentages in a locale-sensitive manner.
+ * </P>
+ * \htmlonly<blockquote>\endhtmlonly
+ * <pre>
+ * \code
+ * UErrorCode success = U_ZERO_ERROR;
+ * UNumberFormat *nf;
+ * const char* myLocale = "fr_FR";
+ *
+ * nf = unum_open( UNUM_DEFAULT, NULL, success );
+ * unum_close(nf);
+ * nf = unum_open( UNUM_CURRENCY, NULL, success );
+ * unum_close(nf);
+ * nf = unum_open( UNUM_PERCENT, NULL, success );
+ * unum_close(nf);
+ * \endcode
+ * </pre>
+ * \htmlonly</blockquote>\endhtmlonly
+ * Each of these methods has two variants; one with an explicit locale
+ * and one without; the latter using the default locale.
+ * \htmlonly<blockquote>\endhtmlonly
+ * <pre>
+ * \code
+ *
+ * nf = unum_open( UNUM_DEFAULT, myLocale, success );
+ * unum_close(nf);
+ * nf = unum_open( UNUM_CURRENCY, myLocale, success );
+ * unum_close(nf);
+ * nf = unum_open( UNUM_PERCENT, myLocale, success );
+ * unum_close(nf);
+ * \endcode
+ * </pre>
+ * \htmlonly</blockquote>\endhtmlonly
+ * A <code>Locale</code> is the mechanism for identifying the kind of services
+ * (<code>UNumberFormat</code>) that you would like to get. The locale is
+ * <STRONG>just</STRONG> a mechanism for identifying these services.
+ *
+ * <P>
+ * Each international serivce that performs locale-sensitive operations
+ * allows you
+ * to get all the available objects of that type. You can sift
+ * through these objects by language, country, or variant,
+ * and use the display names to present a menu to the user.
+ * For example, you can create a menu of all the collation objects
+ * suitable for a given language. Such classes implement these
+ * three class methods:
+ * \htmlonly<blockquote>\endhtmlonly
+ * <pre>
+ * \code
+ * const char* uloc_getAvailable(int32_t index);
+ * int32_t uloc_countAvailable();
+ * int32_t
+ * uloc_getDisplayName(const char* localeID,
+ * const char* inLocaleID,
+ * UChar* result,
+ * int32_t maxResultSize,
+ * UErrorCode* err);
+ *
+ * \endcode
+ * </pre>
+ * \htmlonly</blockquote>\endhtmlonly
+ * <P>
+ * Concerning POSIX/RFC1766 Locale IDs,
+ * the getLanguage/getCountry/getVariant/getName functions do understand
+ * the POSIX type form of language_COUNTRY.ENCODING\@VARIANT
+ * and if there is not an ICU-stype variant, uloc_getVariant() for example
+ * will return the one listed after the \@at sign. As well, the hyphen
+ * "-" is recognized as a country/variant separator similarly to RFC1766.
+ * So for example, "en-us" will be interpreted as en_US.
+ * As a result, uloc_getName() is far from a no-op, and will have the
+ * effect of converting POSIX/RFC1766 IDs into ICU form, although it does
+ * NOT map any of the actual codes (i.e. russian->ru) in any way.
+ * Applications should call uloc_getName() at the point where a locale ID
+ * is coming from an external source (user entry, OS, web browser)
+ * and pass the resulting string to other ICU functions. For example,
+ * don't use de-de\@EURO as an argument to resourcebundle.
+ *
+ * @see UResourceBundle
+ */
+
+/** Useful constant for this language. @stable ICU 2.0 */
+#define ULOC_CHINESE "zh"
+/** Useful constant for this language. @stable ICU 2.0 */
+#define ULOC_ENGLISH "en"
+/** Useful constant for this language. @stable ICU 2.0 */
+#define ULOC_FRENCH "fr"
+/** Useful constant for this language. @stable ICU 2.0 */
+#define ULOC_GERMAN "de"
+/** Useful constant for this language. @stable ICU 2.0 */
+#define ULOC_ITALIAN "it"
+/** Useful constant for this language. @stable ICU 2.0 */
+#define ULOC_JAPANESE "ja"
+/** Useful constant for this language. @stable ICU 2.0 */
+#define ULOC_KOREAN "ko"
+/** Useful constant for this language. @stable ICU 2.0 */
+#define ULOC_SIMPLIFIED_CHINESE "zh_CN"
+/** Useful constant for this language. @stable ICU 2.0 */
+#define ULOC_TRADITIONAL_CHINESE "zh_TW"
+
+/** Useful constant for this country/region. @stable ICU 2.0 */
+#define ULOC_CANADA "en_CA"
+/** Useful constant for this country/region. @stable ICU 2.0 */
+#define ULOC_CANADA_FRENCH "fr_CA"
+/** Useful constant for this country/region. @stable ICU 2.0 */
+#define ULOC_CHINA "zh_CN"
+/** Useful constant for this country/region. @stable ICU 2.0 */
+#define ULOC_PRC "zh_CN"
+/** Useful constant for this country/region. @stable ICU 2.0 */
+#define ULOC_FRANCE "fr_FR"
+/** Useful constant for this country/region. @stable ICU 2.0 */
+#define ULOC_GERMANY "de_DE"
+/** Useful constant for this country/region. @stable ICU 2.0 */
+#define ULOC_ITALY "it_IT"
+/** Useful constant for this country/region. @stable ICU 2.0 */
+#define ULOC_JAPAN "ja_JP"
+/** Useful constant for this country/region. @stable ICU 2.0 */
+#define ULOC_KOREA "ko_KR"
+/** Useful constant for this country/region. @stable ICU 2.0 */
+#define ULOC_TAIWAN "zh_TW"
+/** Useful constant for this country/region. @stable ICU 2.0 */
+#define ULOC_UK "en_GB"
+/** Useful constant for this country/region. @stable ICU 2.0 */
+#define ULOC_US "en_US"
+
+/**
+ * Useful constant for the maximum size of the language part of a locale ID.
+ * (including the terminating NULL).
+ * @stable ICU 2.0
+ */
+#define ULOC_LANG_CAPACITY 12
+
+/**
+ * Useful constant for the maximum size of the country part of a locale ID
+ * (including the terminating NULL).
+ * @stable ICU 2.0
+ */
+#define ULOC_COUNTRY_CAPACITY 4
+/**
+ * Useful constant for the maximum size of the whole locale ID
+ * (including the terminating NULL).
+ * @stable ICU 2.0
+ */
+#define ULOC_FULLNAME_CAPACITY 56
+
+
+#ifndef U_HIDE_DRAFT_API
+
+/**
+ * Useful constant for the maximum size of the script part of a locale ID
+ * (including the terminating NULL).
+ * @draft ICU 2.8
+ */
+#define ULOC_SCRIPT_CAPACITY 6
+
+/**
+ * Useful constant for the maximum size of keywords in a locale
+ * @draft ICU 2.8
+ */
+#define ULOC_KEYWORDS_CAPACITY 50
+
+/**
+ * Useful constant for the maximum size of keywords in a locale
+ * @draft ICU 2.8
+ */
+#define ULOC_KEYWORD_AND_VALUES_CAPACITY 100
+
+/**
+ * Character separating keywords from the locale string
+ * different for EBCDIC - TODO
+ * @draft ICU 2.8
+ */
+#define ULOC_KEYWORD_SEPARATOR '@'
+/**
+ * Character for assigning value to a keyword
+ * @draft ICU 2.8
+ */
+#define ULOC_KEYWORD_ASSIGN '='
+/**
+ * Character separating keywords
+ * @draft ICU 2.8
+ */
+#define ULOC_KEYWORD_ITEM_SEPARATOR ';'
+
+#endif /*U_HIDE_DRAFT_API*/
+
+/**
+ * Constants for *_getLocale()
+ * Allow user to select whether she wants information on
+ * requested, valid or actual locale.
+ * For example, a collator for "en_US_CALIFORNIA" was
+ * requested. In the current state of ICU (2.0),
+ * the requested locale is "en_US_CALIFORNIA",
+ * the valid locale is "en_US" (most specific locale supported by ICU)
+ * and the actual locale is "root" (the collation data comes unmodified
+ * from the UCA)
+ * The locale is considered supported by ICU if there is a core ICU bundle
+ * for that locale (although it may be empty).
+ * @stable ICU 2.1
+ */
+typedef enum {
+ /** This is locale the data actually comes from
+ * @stable ICU 2.1
+ */
+ ULOC_ACTUAL_LOCALE = 0,
+ /** This is the most specific locale supported by ICU
+ * @stable ICU 2.1
+ */
+ ULOC_VALID_LOCALE = 1,
+
+#ifndef U_HIDE_DEPRECATED_API
+ /** This is the requested locale
+ * @deprecated ICU 2.8
+ */
+ ULOC_REQUESTED_LOCALE = 2,
+#endif /* U_HIDE_DEPRECATED_API */
+
+ ULOC_DATA_LOCALE_TYPE_LIMIT
+} ULocDataLocaleType ;
+
+
+/**
+ * Gets ICU's default locale.
+ * The returned string is a snapshot in time, and will remain valid
+ * and unchanged even when uloc_setDefault() is called.
+ * The returned storage is owned by ICU, and must not be altered or deleted
+ * by the caller.
+ *
+ * @return the ICU default locale
+ * @system
+ * @stable ICU 2.0
+ */
+U_STABLE const char* U_EXPORT2
+uloc_getDefault(void);
+
+/**
+ * Sets ICU's default locale.
+ * By default (without calling this function), ICU's default locale will be based
+ * on information obtained from the underlying system environment.
+ * <p>
+ * Changes to ICU's default locale do not propagate back to the
+ * system environment.
+ * <p>
+ * Changes to ICU's default locale to not affect any ICU services that
+ * may already be open based on the previous default locale value.
+ *
+ * @param localeID the new ICU default locale. A value of NULL will try to get
+ * the system's default locale.
+ * @param status the error information if the setting of default locale fails
+ * @system
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+uloc_setDefault(const char* localeID,
+ UErrorCode* status);
+
+/**
+ * Gets the language code for the specified locale.
+ *
+ * @param localeID the locale to get the ISO language code with
+ * @param language the language code for localeID
+ * @param languageCapacity the size of the language buffer to store the
+ * language code with
+ * @param err error information if retrieving the language code failed
+ * @return the actual buffer size needed for the language code. If it's greater
+ * than languageCapacity, the returned language code will be truncated.
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+uloc_getLanguage(const char* localeID,
+ char* language,
+ int32_t languageCapacity,
+ UErrorCode* err);
+
+/**
+ * Gets the script code for the specified locale.
+ *
+ * @param localeID the locale to get the ISO language code with
+ * @param script the language code for localeID
+ * @param scriptCapacity the size of the language buffer to store the
+ * language code with
+ * @param err error information if retrieving the language code failed
+ * @return the actual buffer size needed for the language code. If it's greater
+ * than scriptCapacity, the returned language code will be truncated.
+ * @draft ICU 2.8
+ */
+U_DRAFT int32_t U_EXPORT2
+uloc_getScript(const char* localeID,
+ char* script,
+ int32_t scriptCapacity,
+ UErrorCode* err);
+
+/**
+ * Gets the country code for the specified locale.
+ *
+ * @param localeID the locale to get the country code with
+ * @param country the country code for localeID
+ * @param countryCapacity the size of the country buffer to store the
+ * country code with
+ * @param err error information if retrieving the country code failed
+ * @return the actual buffer size needed for the country code. If it's greater
+ * than countryCapacity, the returned country code will be truncated.
+ * @stable ICU 2.0
+ */
+U_DRAFT int32_t U_EXPORT2
+uloc_getCountry(const char* localeID,
+ char* country,
+ int32_t countryCapacity,
+ UErrorCode* err);
+
+/**
+ * Gets the variant code for the specified locale.
+ *
+ * @param localeID the locale to get the variant code with
+ * @param variant the variant code for localeID
+ * @param variantCapacity the size of the variant buffer to store the
+ * variant code with
+ * @param err error information if retrieving the variant code failed
+ * @return the actual buffer size needed for the variant code. If it's greater
+ * than variantCapacity, the returned variant code will be truncated.
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+uloc_getVariant(const char* localeID,
+ char* variant,
+ int32_t variantCapacity,
+ UErrorCode* err);
+
+
+/**
+ * Gets the full name for the specified locale.
+ * Note: This has the effect of 'canonicalizing' the ICU locale ID to
+ * a certain extent. Upper and lower case are set as needed.
+ * It does NOT map aliased names in any way.
+ * See the top of this header file.
+ * This API supports preflighting.
+ *
+ * @param localeID the locale to get the full name with
+ * @param name fill in buffer for the name without keywords.
+ * @param nameCapacity capacity of the fill in buffer.
+ * @param err error information if retrieving the full name failed
+ * @return the actual buffer size needed for the full name. If it's greater
+ * than nameCapacity, the returned full name will be truncated.
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+uloc_getName(const char* localeID,
+ char* name,
+ int32_t nameCapacity,
+ UErrorCode* err);
+
+/**
+ * Gets the full name for the specified locale.
+ * Note: This has the effect of 'canonicalizing' the string to
+ * a certain extent. Upper and lower case are set as needed,
+ * and if the components were in 'POSIX' format they are changed to
+ * ICU format. It does NOT map aliased names in any way.
+ * See the top of this header file.
+ *
+ * @param localeID the locale to get the full name with
+ * @param name the full name for localeID
+ * @param nameCapacity the size of the name buffer to store the
+ * full name with
+ * @param err error information if retrieving the full name failed
+ * @return the actual buffer size needed for the full name. If it's greater
+ * than nameCapacity, the returned full name will be truncated.
+ * @draft ICU 2.8
+ */
+U_DRAFT int32_t U_EXPORT2
+uloc_canonicalize(const char* localeID,
+ char* name,
+ int32_t nameCapacity,
+ UErrorCode* err);
+
+/**
+ * Gets the ISO language code for the specified locale.
+ *
+ * @param localeID the locale to get the ISO language code with
+ * @return language the ISO language code for localeID
+ * @stable ICU 2.0
+ */
+U_STABLE const char* U_EXPORT2
+uloc_getISO3Language(const char* localeID);
+
+
+/**
+ * Gets the ISO country code for the specified locale.
+ *
+ * @param localeID the locale to get the ISO country code with
+ * @return country the ISO country code for localeID
+ * @stable ICU 2.0
+ */
+U_STABLE const char* U_EXPORT2
+uloc_getISO3Country(const char* localeID);
+
+/**
+ * Gets the Win32 LCID value for the specified locale.
+ * If the ICU locale is not recognized by Windows, 0 will be returned.
+ *
+ * @param localeID the locale to get the Win32 LCID value with
+ * @return country the Win32 LCID for localeID
+ * @stable ICU 2.0
+ */
+U_STABLE uint32_t U_EXPORT2
+uloc_getLCID(const char* localeID);
+
+/**
+ * Gets the language name suitable for display for the specified locale.
+ *
+ * @param locale the locale to get the ISO language code with
+ * @param displayLocale Specifies the locale to be used to display the name. In other words,
+ * if the locale's language code is "en", passing Locale::getFrench() for
+ * inLocale would result in "Anglais", while passing Locale::getGerman()
+ * for inLocale would result in "Englisch".
+ * @param language the displayable language code for localeID
+ * @param languageCapacity the size of the language buffer to store the
+ * displayable language code with
+ * @param status error information if retrieving the displayable language code failed
+ * @return the actual buffer size needed for the displayable language code. If it's greater
+ * than languageCapacity, the returned language code will be truncated.
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+uloc_getDisplayLanguage(const char* locale,
+ const char* displayLocale,
+ UChar* language,
+ int32_t languageCapacity,
+ UErrorCode* status);
+
+/**
+ * Gets the script name suitable for display for the specified locale.
+ *
+ * @param locale the locale to get the displayable script code with. NULL may be used to specify the default.
+ * @param displayLocale Specifies the locale to be used to display the name. In other words,
+ * if the locale's language code is "en", passing Locale::getFrench() for
+ * inLocale would result in "", while passing Locale::getGerman()
+ * for inLocale would result in "". NULL may be used to specify the default.
+ * @param script the displayable country code for localeID
+ * @param scriptCapacity the size of the script buffer to store the
+ * displayable script code with
+ * @param status error information if retrieving the displayable script code failed
+ * @return the actual buffer size needed for the displayable script code. If it's greater
+ * than scriptCapacity, the returned displayable script code will be truncated.
+ * @draft ICU 2.8
+ */
+U_DRAFT int32_t U_EXPORT2
+uloc_getDisplayScript(const char* locale,
+ const char* displayLocale,
+ UChar* script,
+ int32_t scriptCapacity,
+ UErrorCode* status);
+
+/**
+ * Gets the country name suitable for display for the specified locale.
+ *
+ * @param locale the locale to get the displayable country code with. NULL may be used to specify the default.
+ * @param displayLocale Specifies the locale to be used to display the name. In other words,
+ * if the locale's language code is "en", passing Locale::getFrench() for
+ * inLocale would result in "Anglais", while passing Locale::getGerman()
+ * for inLocale would result in "Englisch". NULL may be used to specify the default.
+ * @param country the displayable country code for localeID
+ * @param countryCapacity the size of the country buffer to store the
+ * displayable country code with
+ * @param status error information if retrieving the displayable country code failed
+ * @return the actual buffer size needed for the displayable country code. If it's greater
+ * than countryCapacity, the returned displayable country code will be truncated.
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+uloc_getDisplayCountry(const char* locale,
+ const char* displayLocale,
+ UChar* country,
+ int32_t countryCapacity,
+ UErrorCode* status);
+
+
+/**
+ * Gets the variant name suitable for display for the specified locale.
+ *
+ * @param locale the locale to get the displayable variant code with. NULL may be used to specify the default.
+ * @param displayLocale Specifies the locale to be used to display the name. In other words,
+ * if the locale's language code is "en", passing Locale::getFrench() for
+ * inLocale would result in "Anglais", while passing Locale::getGerman()
+ * for inLocale would result in "Englisch". NULL may be used to specify the default.
+ * @param variant the displayable variant code for localeID
+ * @param variantCapacity the size of the variant buffer to store the
+ * displayable variant code with
+ * @param status error information if retrieving the displayable variant code failed
+ * @return the actual buffer size needed for the displayable variant code. If it's greater
+ * than variantCapacity, the returned displayable variant code will be truncated.
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+uloc_getDisplayVariant(const char* locale,
+ const char* displayLocale,
+ UChar* variant,
+ int32_t variantCapacity,
+ UErrorCode* status);
+
+/**
+ * Gets the keyword name suitable for display for the specified locale.
+ * E.g: for the locale string de_DE\@collation=PHONEBOOK, this API gets the display
+ * string for the keyword collation.
+ * Usage:
+ * <code>
+ * UErrorCode status = U_ZERO_ERROR;
+ * const char* keyword =NULL;
+ * int32_t keywordLen = 0;
+ * int32_t keywordCount = 0;
+ * UChar displayKeyword[256];
+ * int32_t displayKeywordLen = 0;
+ * UEnumeration* keywordEnum = uloc_openKeywords("de_DE@collation=PHONEBOOK;calendar=TRADITIONAL", &status);
+ * for(keywordCount = uenum_count(keywordEnum, &status); keywordCount > 0 ; keywordCount--){
+ * if(U_FAILURE(status)){
+ * ...something went wrong so handle the error...
+ * break;
+ * }
+ * // the uenum_next returns NUL terminated string
+ * keyword = uenum_next(keywordEnum, &keywordLen, &status);
+ * displayKeywordLen = uloc_getDisplayKeyword(keyword, "en_US", displayKeyword, 256);
+ * ... do something interesting .....
+ * }
+ * uenum_close(keywordEnum);
+ * </code>
+ * @param keyword The keyword whose display string needs to be returned.
+ * @param displayLocale Specifies the locale to be used to display the name. In other words,
+ * if the locale's language code is "en", passing Locale::getFrench() for
+ * inLocale would result in "Anglais", while passing Locale::getGerman()
+ * for inLocale would result in "Englisch". NULL may be used to specify the default.
+ * @param dest the buffer to which the displayable keyword should be written.
+ * @param destCapacity The size of the buffer (number of UChars). If it is 0, then
+ * dest may be NULL and the function will only return the length of the
+ * result without writing any of the result string (pre-flighting).
+ * @param status error information if retrieving the displayable string failed.
+ * Should not be NULL and should not indicate failure on entry.
+ * @return the actual buffer size needed for the displayable variant code.
+ * @see #uloc_openKeywords
+ * @draft ICU 2.8
+ */
+U_DRAFT int32_t U_EXPORT2
+uloc_getDisplayKeyword(const char* keyword,
+ const char* displayLocale,
+ UChar* dest,
+ int32_t destCapacity,
+ UErrorCode* status);
+/**
+ * Gets the value of the keyword suitable for display for the specified locale.
+ * E.g: for the locale string de_DE\@collation=PHONEBOOK, this API gets the display
+ * string for PHONEBOOK, in the display locale, when "collation" is specified as the keyword.
+ *
+ * @param locale The locale to get the displayable variant code with. NULL may be used to specify the default.
+ * @param keyword The keyword for whose value should be used.
+ * @param displayLocale Specifies the locale to be used to display the name. In other words,
+ * if the locale's language code is "en", passing Locale::getFrench() for
+ * inLocale would result in "Anglais", while passing Locale::getGerman()
+ * for inLocale would result in "Englisch". NULL may be used to specify the default.
+ * @param dest the buffer to which the displayable keyword should be written.
+ * @param destCapacity The size of the buffer (number of UChars). If it is 0, then
+ * dest may be NULL and the function will only return the length of the
+ * result without writing any of the result string (pre-flighting).
+ * @param status error information if retrieving the displayable string failed.
+ * Should not be NULL and must not indicate failure on entry.
+ * @return the actual buffer size needed for the displayable variant code.
+ * @draft ICU 2.8
+ */
+U_DRAFT int32_t U_EXPORT2
+uloc_getDisplayKeywordValue( const char* locale,
+ const char* keyword,
+ const char* displayLocale,
+ UChar* dest,
+ int32_t destCapacity,
+ UErrorCode* status);
+/**
+ * Gets the full name suitable for display for the specified locale.
+ *
+ * @param localeID the locale to get the displayable name with. NULL may be used to specify the default.
+ * @param inLocaleID Specifies the locale to be used to display the name. In other words,
+ * if the locale's language code is "en", passing Locale::getFrench() for
+ * inLocale would result in "Anglais", while passing Locale::getGerman()
+ * for inLocale would result in "Englisch". NULL may be used to specify the default.
+ * @param result the displayable name for localeID
+ * @param maxResultSize the size of the name buffer to store the
+ * displayable full name with
+ * @param err error information if retrieving the displayable name failed
+ * @return the actual buffer size needed for the displayable name. If it's greater
+ * than maxResultSize, the returned displayable name will be truncated.
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+uloc_getDisplayName(const char* localeID,
+ const char* inLocaleID,
+ UChar* result,
+ int32_t maxResultSize,
+ UErrorCode* err);
+
+
+/**
+ * Gets the specified locale from a list of all available locales.
+ * The return value is a pointer to an item of
+ * a locale name array. Both this array and the pointers
+ * it contains are owned by ICU and should not be deleted or written through
+ * by the caller. The locale name is terminated by a null pointer.
+ * @param n the specific locale name index of the available locale list
+ * @return a specified locale name of all available locales
+ * @stable ICU 2.0
+ */
+U_STABLE const char* U_EXPORT2
+uloc_getAvailable(int32_t n);
+
+/**
+ * Gets the size of the all available locale list.
+ *
+ * @return the size of the locale list
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2 uloc_countAvailable(void);
+
+/**
+ *
+ * Gets a list of all available language codes defined in ISO 639. This is a pointer
+ * to an array of pointers to arrays of char. All of these pointers are owned
+ * by ICU-- do not delete them, and do not write through them. The array is
+ * terminated with a null pointer.
+ * @return a list of all available language codes
+ * @stable ICU 2.0
+ */
+U_STABLE const char* const* U_EXPORT2
+uloc_getISOLanguages(void);
+
+/**
+ *
+ * Gets a list of all available 2-letter country codes defined in ISO 639. This is a
+ * pointer to an array of pointers to arrays of char. All of these pointers are
+ * owned by ICU-- do not delete them, and do not write through them. The array is
+ * terminated with a null pointer.
+ * @return a list of all available country codes
+ * @stable ICU 2.0
+ */
+U_STABLE const char* const* U_EXPORT2
+uloc_getISOCountries(void);
+
+/**
+ * Truncate the locale ID string to get the parent locale ID.
+ * Copies the part of the string before the last underscore.
+ * The parent locale ID will be an empty string if there is no
+ * underscore, or if there is only one underscore at localeID[0].
+ *
+ * @param localeID Input locale ID string.
+ * @param parent Output string buffer for the parent locale ID.
+ * @param parentCapacity Size of the output buffer.
+ * @param err A UErrorCode value.
+ * @return The length of the parent locale ID.
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+uloc_getParent(const char* localeID,
+ char* parent,
+ int32_t parentCapacity,
+ UErrorCode* err);
+
+
+
+
+/**
+ * Gets the full name for the specified locale.
+ * Note: This has the effect of 'canonicalizing' the string to
+ * a certain extent. Upper and lower case are set as needed,
+ * and if the components were in 'POSIX' format they are changed to
+ * ICU format. It does NOT map aliased names in any way.
+ * See the top of this header file.
+ * This API strips off the keyword part, so "de_DE\@collation=phonebook"
+ * will become "de_DE".
+ * This API supports preflighting.
+ *
+ * @param localeID the locale to get the full name with
+ * @param name fill in buffer for the name without keywords.
+ * @param nameCapacity capacity of the fill in buffer.
+ * @param err error information if retrieving the full name failed
+ * @return the actual buffer size needed for the full name. If it's greater
+ * than nameCapacity, the returned full name will be truncated.
+ * @draft ICU 2.8
+ */
+U_DRAFT int32_t U_EXPORT2
+uloc_getBaseName(const char* localeID,
+ char* name,
+ int32_t nameCapacity,
+ UErrorCode* err);
+
+/**
+ * Gets an enumeration of keywords for the specified locale. Enumeration
+ * must get disposed of by the client using uenum_close function.
+ *
+ * @param localeID the locale to get the variant code with
+ * @param status error information if retrieving the keywords failed
+ * @return enumeration of keywords or NULL if there are no keywords.
+ * @draft ICU 2.8
+ */
+U_DRAFT UEnumeration* U_EXPORT2
+uloc_openKeywords(const char* localeID,
+ UErrorCode* status);
+
+/**
+ * Get the value for a keyword. Locale name does not need to be normalized.
+ *
+ * @param localeID locale name containing the keyword ("de_DE@currency=EURO;collation=PHONEBOOK")
+ * @param keywordName name of the keyword for which we want the value. Case insensitive.
+ * @param buffer receiving buffer
+ * @param bufferCapacity capacity of receiving buffer
+ * @param status containing error code - buffer not big enough.
+ * @return the length of keyword value
+ * @draft ICU 2.8
+ */
+U_DRAFT int32_t U_EXPORT2
+uloc_getKeywordValue(const char* localeID,
+ const char* keywordName,
+ char* buffer, int32_t bufferCapacity,
+ UErrorCode* status);
+
+
+/**
+ * Set the value of the specified keyword.
+ * NOTE: Unlike almost every other ICU function which takes a
+ * buffer, this function will NOT truncate the output text. If a
+ * BUFFER_OVERFLOW_ERROR is received, it means that the original
+ * buffer is untouched. This is done to prevent incorrect or possibly
+ * even malformed locales from being generated and used.
+ *
+ * @param keywordName name of the keyword to be set. Case insensitive.
+ * @param keywordValue value of the keyword to be set. If 0-length or
+ * NULL, will result in the keyword being removed. No error is given if
+ * that keyword does not exist.
+ * @param buffer input buffer containing locale to be modified.
+ * @param bufferCapacity capacity of receiving buffer
+ * @param status containing error code - buffer not big enough.
+ * @return the length needed for the buffer
+ * @see uloc_getKeywordValue
+ * @draft ICU 3.2
+ */
+U_DRAFT int32_t U_EXPORT2
+uloc_setKeywordValue(const char* keywordName,
+ const char* keywordValue,
+ char* buffer, int32_t bufferCapacity,
+ UErrorCode* status);
+
+/**
+ * enums for the 'outResult' parameter return value
+ * @see uloc_acceptLanguageFromHTTP
+ * @see uloc_acceptLanguage
+ * @draft ICU 3.2
+ */
+typedef enum {
+ ULOC_ACCEPT_FAILED = 0, /* No exact match was found. */
+ ULOC_ACCEPT_VALID = 1, /* An exact match was found. */
+ ULOC_ACCEPT_FALLBACK = 2 /* A fallback was found, for example,
+ Accept list contained 'ja_JP'
+ which matched available locale 'ja'. */
+} UAcceptResult;
+
+
+/**
+ * @param httpAcceptLanguage - "Accept-Language:" header as per HTTP.
+ * @param result - buffer to accept the result locale
+ * @param resultAvailable the size of the result buffer.
+ * @param availableLocales - list of available locales to match
+ * @param status Error status, may be BUFFER_OVERFLOW_ERROR
+ * @return length needed for the locale.
+ * @draft ICU 3.2
+ */
+U_DRAFT int32_t U_EXPORT2
+uloc_acceptLanguageFromHTTP(char *result, int32_t resultAvailable,
+ UAcceptResult *outResult,
+ const char *httpAcceptLanguage,
+ UEnumeration* availableLocales,
+ UErrorCode *status);
+
+/**
+ * @param acceptList -list of acceptable languages
+ * @param acceptListCount - count of acceptList items
+ * @param result - buffer to accept the result locale
+ * @param resultAvailable the size of the result buffer.
+ * @param availableLocales - list of available locales to match
+ * @param status Error status, may be BUFFER_OVERFLOW_ERROR
+ * @return length needed for the locale.
+ * @draft ICU 3.2
+ */
+U_DRAFT int32_t U_EXPORT2
+uloc_acceptLanguage(char *result, int32_t resultAvailable,
+ UAcceptResult *outResult, const char **acceptList,
+ int32_t acceptListCount,
+ UEnumeration* availableLocales,
+ UErrorCode *status);
+
+/*eof*/
+
+
+#endif /*_ULOC*/
+
+
+
diff --git a/Source/JavaScriptCore/icu/unicode/umachine.h b/Source/JavaScriptCore/icu/unicode/umachine.h
new file mode 100644
index 0000000..d841f53
--- /dev/null
+++ b/Source/JavaScriptCore/icu/unicode/umachine.h
@@ -0,0 +1,371 @@
+/*
+******************************************************************************
+*
+* Copyright (C) 1999-2004, International Business Machines
+* Corporation and others. All Rights Reserved.
+*
+******************************************************************************
+* file name: umachine.h
+* encoding: US-ASCII
+* tab size: 8 (not used)
+* indentation:4
+*
+* created on: 1999sep13
+* created by: Markus W. Scherer
+*
+* This file defines basic types and constants for utf.h to be
+* platform-independent. umachine.h and utf.h are included into
+* utypes.h to provide all the general definitions for ICU.
+* All of these definitions used to be in utypes.h before
+* the UTF-handling macros made this unmaintainable.
+*/
+
+#ifndef __UMACHINE_H__
+#define __UMACHINE_H__
+
+
+/**
+ * \file
+ * \brief Basic types and constants for UTF
+ *
+ * <h2> Basic types and constants for UTF </h2>
+ * This file defines basic types and constants for utf.h to be
+ * platform-independent. umachine.h and utf.h are included into
+ * utypes.h to provide all the general definitions for ICU.
+ * All of these definitions used to be in utypes.h before
+ * the UTF-handling macros made this unmaintainable.
+ *
+ */
+/*==========================================================================*/
+/* Include platform-dependent definitions */
+/* which are contained in the platform-specific file platform.h */
+/*==========================================================================*/
+
+#if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
+# include "unicode/pwin32.h"
+#else
+# include "unicode/platform.h"
+#endif
+
+/*
+ * ANSI C headers:
+ * stddef.h defines wchar_t
+ */
+#include <stddef.h>
+
+/*==========================================================================*/
+/* XP_CPLUSPLUS is a cross-platform symbol which should be defined when */
+/* using C++. It should not be defined when compiling under C. */
+/*==========================================================================*/
+
+#ifdef __cplusplus
+# ifndef XP_CPLUSPLUS
+# define XP_CPLUSPLUS
+# endif
+#else
+# undef XP_CPLUSPLUS
+#endif
+
+/*==========================================================================*/
+/* For C wrappers, we use the symbol U_STABLE. */
+/* This works properly if the includer is C or C++. */
+/* Functions are declared U_STABLE return-type U_EXPORT2 function-name()... */
+/*==========================================================================*/
+
+/**
+ * \def U_CFUNC
+ * This is used in a declaration of a library private ICU C function.
+ * @stable ICU 2.4
+ */
+
+/**
+ * \def U_CDECL_BEGIN
+ * This is used to begin a declaration of a library private ICU C API.
+ * @stable ICU 2.4
+ */
+
+/**
+ * \def U_CDECL_END
+ * This is used to end a declaration of a library private ICU C API
+ * @stable ICU 2.4
+ */
+
+#ifdef XP_CPLUSPLUS
+# define U_CFUNC extern "C"
+# define U_CDECL_BEGIN extern "C" {
+# define U_CDECL_END }
+#else
+# define U_CFUNC extern
+# define U_CDECL_BEGIN
+# define U_CDECL_END
+#endif
+
+/**
+ * \def U_NAMESPACE_BEGIN
+ * This is used to begin a declaration of a public ICU C++ API.
+ * If the compiler doesn't support namespaces, this does nothing.
+ * @stable ICU 2.4
+ */
+
+/**
+ * \def U_NAMESPACE_END
+ * This is used to end a declaration of a public ICU C++ API
+ * If the compiler doesn't support namespaces, this does nothing.
+ * @stable ICU 2.4
+ */
+
+/**
+ * \def U_NAMESPACE_USE
+ * This is used to specify that the rest of the code uses the
+ * public ICU C++ API namespace.
+ * If the compiler doesn't support namespaces, this does nothing.
+ * @stable ICU 2.4
+ */
+
+/**
+ * \def U_NAMESPACE_QUALIFIER
+ * This is used to qualify that a function or class is part of
+ * the public ICU C++ API namespace.
+ * If the compiler doesn't support namespaces, this does nothing.
+ * @stable ICU 2.4
+ */
+
+/* Define namespace symbols if the compiler supports it. */
+#if U_HAVE_NAMESPACE
+# define U_NAMESPACE_BEGIN namespace U_ICU_NAMESPACE {
+# define U_NAMESPACE_END }
+# define U_NAMESPACE_USE using namespace U_ICU_NAMESPACE;
+# define U_NAMESPACE_QUALIFIER U_ICU_NAMESPACE::
+#else
+# define U_NAMESPACE_BEGIN
+# define U_NAMESPACE_END
+# define U_NAMESPACE_USE
+# define U_NAMESPACE_QUALIFIER
+#endif
+
+/** This is used to declare a function as a public ICU C API @stable ICU 2.0*/
+#define U_CAPI U_CFUNC U_EXPORT
+#define U_STABLE U_CAPI
+#define U_DRAFT U_CAPI
+#define U_DEPRECATED U_CAPI
+#define U_OBSOLETE U_CAPI
+#define U_INTERNAL U_CAPI
+
+/*==========================================================================*/
+/* limits for int32_t etc., like in POSIX inttypes.h */
+/*==========================================================================*/
+
+#ifndef INT8_MIN
+/** The smallest value an 8 bit signed integer can hold @stable ICU 2.0 */
+# define INT8_MIN ((int8_t)(-128))
+#endif
+#ifndef INT16_MIN
+/** The smallest value a 16 bit signed integer can hold @stable ICU 2.0 */
+# define INT16_MIN ((int16_t)(-32767-1))
+#endif
+#ifndef INT32_MIN
+/** The smallest value a 32 bit signed integer can hold @stable ICU 2.0 */
+# define INT32_MIN ((int32_t)(-2147483647-1))
+#endif
+
+#ifndef INT8_MAX
+/** The largest value an 8 bit signed integer can hold @stable ICU 2.0 */
+# define INT8_MAX ((int8_t)(127))
+#endif
+#ifndef INT16_MAX
+/** The largest value a 16 bit signed integer can hold @stable ICU 2.0 */
+# define INT16_MAX ((int16_t)(32767))
+#endif
+#ifndef INT32_MAX
+/** The largest value a 32 bit signed integer can hold @stable ICU 2.0 */
+# define INT32_MAX ((int32_t)(2147483647))
+#endif
+
+#ifndef UINT8_MAX
+/** The largest value an 8 bit unsigned integer can hold @stable ICU 2.0 */
+# define UINT8_MAX ((uint8_t)(255U))
+#endif
+#ifndef UINT16_MAX
+/** The largest value a 16 bit unsigned integer can hold @stable ICU 2.0 */
+# define UINT16_MAX ((uint16_t)(65535U))
+#endif
+#ifndef UINT32_MAX
+/** The largest value a 32 bit unsigned integer can hold @stable ICU 2.0 */
+# define UINT32_MAX ((uint32_t)(4294967295U))
+#endif
+
+#if defined(U_INT64_T_UNAVAILABLE)
+# error int64_t is required for decimal format and rule-based number format.
+#else
+# ifndef INT64_C
+/**
+ * Provides a platform independent way to specify a signed 64-bit integer constant.
+ * note: may be wrong for some 64 bit platforms - ensure your compiler provides INT64_C
+ * @draft ICU 2.8
+ */
+# define INT64_C(c) c ## LL
+# endif
+# ifndef UINT64_C
+/**
+ * Provides a platform independent way to specify an unsigned 64-bit integer constant.
+ * note: may be wrong for some 64 bit platforms - ensure your compiler provides UINT64_C
+ * @draft ICU 2.8
+ */
+# define UINT64_C(c) c ## ULL
+# endif
+# ifndef U_INT64_MIN
+/** The smallest value a 64 bit signed integer can hold @stable ICU 2.8 */
+# define U_INT64_MIN ((int64_t)(INT64_C(-9223372036854775807)-1))
+# endif
+# ifndef U_INT64_MAX
+/** The largest value a 64 bit signed integer can hold @stable ICU 2.8 */
+# define U_INT64_MAX ((int64_t)(INT64_C(9223372036854775807)))
+# endif
+# ifndef U_UINT64_MAX
+/** The largest value a 64 bit unsigned integer can hold @stable ICU 2.8 */
+# define U_UINT64_MAX ((uint64_t)(UINT64_C(18446744073709551615)))
+# endif
+#endif
+
+/*==========================================================================*/
+/* Boolean data type */
+/*==========================================================================*/
+
+/** The ICU boolean type @stable ICU 2.0 */
+typedef int8_t UBool;
+
+#ifndef TRUE
+/** The TRUE value of a UBool @stable ICU 2.0 */
+# define TRUE 1
+#endif
+#ifndef FALSE
+/** The FALSE value of a UBool @stable ICU 2.0 */
+# define FALSE 0
+#endif
+
+
+/*==========================================================================*/
+/* Unicode data types */
+/*==========================================================================*/
+
+/* wchar_t-related definitions -------------------------------------------- */
+
+/**
+ * \def U_HAVE_WCHAR_H
+ * Indicates whether <wchar.h> is available (1) or not (0). Set to 1 by default.
+ *
+ * @stable ICU 2.0
+ */
+#ifndef U_HAVE_WCHAR_H
+# define U_HAVE_WCHAR_H 1
+#endif
+
+/**
+ * \def U_SIZEOF_WCHAR_T
+ * U_SIZEOF_WCHAR_T==sizeof(wchar_t) (0 means it is not defined or autoconf could not set it)
+ *
+ * @stable ICU 2.0
+ */
+#if U_SIZEOF_WCHAR_T==0
+# undef U_SIZEOF_WCHAR_T
+# define U_SIZEOF_WCHAR_T 4
+#endif
+
+/*
+ * \def U_WCHAR_IS_UTF16
+ * Defined if wchar_t uses UTF-16.
+ *
+ * @stable ICU 2.0
+ */
+/*
+ * \def U_WCHAR_IS_UTF32
+ * Defined if wchar_t uses UTF-32.
+ *
+ * @stable ICU 2.0
+ */
+#if !defined(U_WCHAR_IS_UTF16) && !defined(U_WCHAR_IS_UTF32)
+# ifdef __STDC_ISO_10646__
+# if (U_SIZEOF_WCHAR_T==2)
+# define U_WCHAR_IS_UTF16
+# elif (U_SIZEOF_WCHAR_T==4)
+# define U_WCHAR_IS_UTF32
+# endif
+# elif defined __UCS2__
+# if (__OS390__ || __OS400__) && (U_SIZEOF_WCHAR_T==2)
+# define U_WCHAR_IS_UTF16
+# endif
+# elif defined __UCS4__
+# if (U_SIZEOF_WCHAR_T==4)
+# define U_WCHAR_IS_UTF32
+# endif
+# elif defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
+# define U_WCHAR_IS_UTF16
+# endif
+#endif
+
+/* UChar and UChar32 definitions -------------------------------------------- */
+
+/** Number of bytes in a UChar. @stable ICU 2.0 */
+#define U_SIZEOF_UCHAR 2
+
+/**
+ * \var UChar
+ * Define UChar to be wchar_t if that is 16 bits wide; always assumed to be unsigned.
+ * If wchar_t is not 16 bits wide, then define UChar to be uint16_t.
+ * This makes the definition of UChar platform-dependent
+ * but allows direct string type compatibility with platforms with
+ * 16-bit wchar_t types.
+ *
+ * @stable ICU 2.0
+ */
+
+/* Define UChar to be compatible with wchar_t if possible. */
+#if U_SIZEOF_WCHAR_T==2
+ typedef wchar_t UChar;
+#else
+ typedef uint16_t UChar;
+#endif
+
+/**
+ * Define UChar32 as a type for single Unicode code points.
+ * UChar32 is a signed 32-bit integer (same as int32_t).
+ *
+ * The Unicode code point range is 0..0x10ffff.
+ * All other values (negative or >=0x110000) are illegal as Unicode code points.
+ * They may be used as sentinel values to indicate "done", "error"
+ * or similar non-code point conditions.
+ *
+ * Before ICU 2.4 (Jitterbug 2146), UChar32 was defined
+ * to be wchar_t if that is 32 bits wide (wchar_t may be signed or unsigned)
+ * or else to be uint32_t.
+ * That is, the definition of UChar32 was platform-dependent.
+ *
+ * @see U_SENTINEL
+ * @stable ICU 2.4
+ */
+typedef int32_t UChar32;
+
+/*==========================================================================*/
+/* U_INLINE and U_ALIGN_CODE Set default values if these are not already */
+/* defined. Definitions normally are in */
+/* platform.h or the corresponding file for */
+/* the OS in use. */
+/*==========================================================================*/
+
+/**
+ * \def U_ALIGN_CODE
+ * This is used to align code fragments to a specific byte boundary.
+ * This is useful for getting consistent performance test results.
+ * @internal
+ */
+#ifndef U_ALIGN_CODE
+# define U_ALIGN_CODE(n)
+#endif
+
+#ifndef U_INLINE
+# define U_INLINE
+#endif
+
+#include "unicode/urename.h"
+
+#endif
diff --git a/Source/JavaScriptCore/icu/unicode/unorm.h b/Source/JavaScriptCore/icu/unicode/unorm.h
new file mode 100644
index 0000000..8bdbee7
--- /dev/null
+++ b/Source/JavaScriptCore/icu/unicode/unorm.h
@@ -0,0 +1,575 @@
+/*
+*******************************************************************************
+* Copyright (c) 1996-2004, International Business Machines Corporation
+* and others. All Rights Reserved.
+*******************************************************************************
+* File unorm.h
+*
+* Created by: Vladimir Weinstein 12052000
+*
+* Modification history :
+*
+* Date Name Description
+* 02/01/01 synwee Added normalization quickcheck enum and method.
+*/
+#ifndef UNORM_H
+#define UNORM_H
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_NORMALIZATION
+
+#include "unicode/uiter.h"
+
+/**
+ * \file
+ * \brief C API: Unicode Normalization
+ *
+ * <h2>Unicode normalization API</h2>
+ *
+ * <code>unorm_normalize</code> transforms Unicode text into an equivalent composed or
+ * decomposed form, allowing for easier sorting and searching of text.
+ * <code>unorm_normalize</code> supports the standard normalization forms described in
+ * <a href="http://www.unicode.org/unicode/reports/tr15/" target="unicode">
+ * Unicode Standard Annex #15 &#8212; Unicode Normalization Forms</a>.
+ *
+ * Characters with accents or other adornments can be encoded in
+ * several different ways in Unicode. For example, take the character A-acute.
+ * In Unicode, this can be encoded as a single character (the
+ * "composed" form):
+ *
+ * \code
+ * 00C1 LATIN CAPITAL LETTER A WITH ACUTE
+ * \endcode
+ *
+ * or as two separate characters (the "decomposed" form):
+ *
+ * \code
+ * 0041 LATIN CAPITAL LETTER A
+ * 0301 COMBINING ACUTE ACCENT
+ * \endcode
+ *
+ * To a user of your program, however, both of these sequences should be
+ * treated as the same "user-level" character "A with acute accent". When you are searching or
+ * comparing text, you must ensure that these two sequences are treated
+ * equivalently. In addition, you must handle characters with more than one
+ * accent. Sometimes the order of a character's combining accents is
+ * significant, while in other cases accent sequences in different orders are
+ * really equivalent.
+ *
+ * Similarly, the string "ffi" can be encoded as three separate letters:
+ *
+ * \code
+ * 0066 LATIN SMALL LETTER F
+ * 0066 LATIN SMALL LETTER F
+ * 0069 LATIN SMALL LETTER I
+ * \endcode
+ *
+ * or as the single character
+ *
+ * \code
+ * FB03 LATIN SMALL LIGATURE FFI
+ * \endcode
+ *
+ * The ffi ligature is not a distinct semantic character, and strictly speaking
+ * it shouldn't be in Unicode at all, but it was included for compatibility
+ * with existing character sets that already provided it. The Unicode standard
+ * identifies such characters by giving them "compatibility" decompositions
+ * into the corresponding semantic characters. When sorting and searching, you
+ * will often want to use these mappings.
+ *
+ * <code>unorm_normalize</code> helps solve these problems by transforming text into the
+ * canonical composed and decomposed forms as shown in the first example above.
+ * In addition, you can have it perform compatibility decompositions so that
+ * you can treat compatibility characters the same as their equivalents.
+ * Finally, <code>unorm_normalize</code> rearranges accents into the proper canonical
+ * order, so that you do not have to worry about accent rearrangement on your
+ * own.
+ *
+ * Form FCD, "Fast C or D", is also designed for collation.
+ * It allows to work on strings that are not necessarily normalized
+ * with an algorithm (like in collation) that works under "canonical closure", i.e., it treats precomposed
+ * characters and their decomposed equivalents the same.
+ *
+ * It is not a normalization form because it does not provide for uniqueness of representation. Multiple strings
+ * may be canonically equivalent (their NFDs are identical) and may all conform to FCD without being identical
+ * themselves.
+ *
+ * The form is defined such that the "raw decomposition", the recursive canonical decomposition of each character,
+ * results in a string that is canonically ordered. This means that precomposed characters are allowed for as long
+ * as their decompositions do not need canonical reordering.
+ *
+ * Its advantage for a process like collation is that all NFD and most NFC texts - and many unnormalized texts -
+ * already conform to FCD and do not need to be normalized (NFD) for such a process. The FCD quick check will
+ * return UNORM_YES for most strings in practice.
+ *
+ * unorm_normalize(UNORM_FCD) may be implemented with UNORM_NFD.
+ *
+ * For more details on FCD see the collation design document:
+ * http://oss.software.ibm.com/cvs/icu/~checkout~/icuhtml/design/collation/ICU_collation_design.htm
+ *
+ * ICU collation performs either NFD or FCD normalization automatically if normalization
+ * is turned on for the collator object.
+ * Beyond collation and string search, normalized strings may be useful for string equivalence comparisons,
+ * transliteration/transcription, unique representations, etc.
+ *
+ * The W3C generally recommends to exchange texts in NFC.
+ * Note also that most legacy character encodings use only precomposed forms and often do not
+ * encode any combining marks by themselves. For conversion to such character encodings the
+ * Unicode text needs to be normalized to NFC.
+ * For more usage examples, see the Unicode Standard Annex.
+ */
+
+/**
+ * Constants for normalization modes.
+ * @stable ICU 2.0
+ */
+typedef enum {
+ /** No decomposition/composition. @stable ICU 2.0 */
+ UNORM_NONE = 1,
+ /** Canonical decomposition. @stable ICU 2.0 */
+ UNORM_NFD = 2,
+ /** Compatibility decomposition. @stable ICU 2.0 */
+ UNORM_NFKD = 3,
+ /** Canonical decomposition followed by canonical composition. @stable ICU 2.0 */
+ UNORM_NFC = 4,
+ /** Default normalization. @stable ICU 2.0 */
+ UNORM_DEFAULT = UNORM_NFC,
+ /** Compatibility decomposition followed by canonical composition. @stable ICU 2.0 */
+ UNORM_NFKC =5,
+ /** "Fast C or D" form. @stable ICU 2.0 */
+ UNORM_FCD = 6,
+
+ /** One more than the highest normalization mode constant. @stable ICU 2.0 */
+ UNORM_MODE_COUNT
+} UNormalizationMode;
+
+/**
+ * Constants for options flags for normalization.
+ * Use 0 for default options,
+ * including normalization according to the Unicode version
+ * that is currently supported by ICU (see u_getUnicodeVersion).
+ * @stable ICU 2.6
+ */
+enum {
+ /**
+ * Options bit set value to select Unicode 3.2 normalization
+ * (except NormalizationCorrections).
+ * At most one Unicode version can be selected at a time.
+ * @stable ICU 2.6
+ */
+ UNORM_UNICODE_3_2=0x20
+};
+
+/**
+ * Lowest-order bit number of unorm_compare() options bits corresponding to
+ * normalization options bits.
+ *
+ * The options parameter for unorm_compare() uses most bits for
+ * itself and for various comparison and folding flags.
+ * The most significant bits, however, are shifted down and passed on
+ * to the normalization implementation.
+ * (That is, from unorm_compare(..., options, ...),
+ * options>>UNORM_COMPARE_NORM_OPTIONS_SHIFT will be passed on to the
+ * internal normalization functions.)
+ *
+ * @see unorm_compare
+ * @stable ICU 2.6
+ */
+#define UNORM_COMPARE_NORM_OPTIONS_SHIFT 20
+
+/**
+ * Normalize a string.
+ * The string will be normalized according the specified normalization mode
+ * and options.
+ *
+ * @param source The string to normalize.
+ * @param sourceLength The length of source, or -1 if NUL-terminated.
+ * @param mode The normalization mode; one of UNORM_NONE,
+ * UNORM_NFD, UNORM_NFC, UNORM_NFKC, UNORM_NFKD, UNORM_DEFAULT.
+ * @param options The normalization options, ORed together (0 for no options).
+ * @param result A pointer to a buffer to receive the result string.
+ * The result string is NUL-terminated if possible.
+ * @param resultLength The maximum size of result.
+ * @param status A pointer to a UErrorCode to receive any errors.
+ * @return The total buffer size needed; if greater than resultLength,
+ * the output was truncated, and the error code is set to U_BUFFER_OVERFLOW_ERROR.
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+unorm_normalize(const UChar *source, int32_t sourceLength,
+ UNormalizationMode mode, int32_t options,
+ UChar *result, int32_t resultLength,
+ UErrorCode *status);
+#endif
+/**
+ * Result values for unorm_quickCheck().
+ * For details see Unicode Technical Report 15.
+ * @stable ICU 2.0
+ */
+typedef enum UNormalizationCheckResult {
+ /**
+ * Indicates that string is not in the normalized format
+ */
+ UNORM_NO,
+ /**
+ * Indicates that string is in the normalized format
+ */
+ UNORM_YES,
+ /**
+ * Indicates that string cannot be determined if it is in the normalized
+ * format without further thorough checks.
+ */
+ UNORM_MAYBE
+} UNormalizationCheckResult;
+#if !UCONFIG_NO_NORMALIZATION
+/**
+ * Performing quick check on a string, to quickly determine if the string is
+ * in a particular normalization format.
+ * Three types of result can be returned UNORM_YES, UNORM_NO or
+ * UNORM_MAYBE. Result UNORM_YES indicates that the argument
+ * string is in the desired normalized format, UNORM_NO determines that
+ * argument string is not in the desired normalized format. A
+ * UNORM_MAYBE result indicates that a more thorough check is required,
+ * the user may have to put the string in its normalized form and compare the
+ * results.
+ *
+ * @param source string for determining if it is in a normalized format
+ * @param sourcelength length of source to test, or -1 if NUL-terminated
+ * @param mode which normalization form to test for
+ * @param status a pointer to a UErrorCode to receive any errors
+ * @return UNORM_YES, UNORM_NO or UNORM_MAYBE
+ *
+ * @see unorm_isNormalized
+ * @stable ICU 2.0
+ */
+U_STABLE UNormalizationCheckResult U_EXPORT2
+unorm_quickCheck(const UChar *source, int32_t sourcelength,
+ UNormalizationMode mode,
+ UErrorCode *status);
+
+/**
+ * Performing quick check on a string; same as unorm_quickCheck but
+ * takes an extra options parameter like most normalization functions.
+ *
+ * @param src String that is to be tested if it is in a normalization format.
+ * @param srcLength Length of source to test, or -1 if NUL-terminated.
+ * @param mode Which normalization form to test for.
+ * @param options The normalization options, ORed together (0 for no options).
+ * @param pErrorCode ICU error code in/out parameter.
+ * Must fulfill U_SUCCESS before the function call.
+ * @return UNORM_YES, UNORM_NO or UNORM_MAYBE
+ *
+ * @see unorm_quickCheck
+ * @see unorm_isNormalized
+ * @stable ICU 2.6
+ */
+U_STABLE UNormalizationCheckResult U_EXPORT2
+unorm_quickCheckWithOptions(const UChar *src, int32_t srcLength,
+ UNormalizationMode mode, int32_t options,
+ UErrorCode *pErrorCode);
+
+/**
+ * Test if a string is in a given normalization form.
+ * This is semantically equivalent to source.equals(normalize(source, mode)) .
+ *
+ * Unlike unorm_quickCheck(), this function returns a definitive result,
+ * never a "maybe".
+ * For NFD, NFKD, and FCD, both functions work exactly the same.
+ * For NFC and NFKC where quickCheck may return "maybe", this function will
+ * perform further tests to arrive at a TRUE/FALSE result.
+ *
+ * @param src String that is to be tested if it is in a normalization format.
+ * @param srcLength Length of source to test, or -1 if NUL-terminated.
+ * @param mode Which normalization form to test for.
+ * @param pErrorCode ICU error code in/out parameter.
+ * Must fulfill U_SUCCESS before the function call.
+ * @return Boolean value indicating whether the source string is in the
+ * "mode" normalization form.
+ *
+ * @see unorm_quickCheck
+ * @stable ICU 2.2
+ */
+U_STABLE UBool U_EXPORT2
+unorm_isNormalized(const UChar *src, int32_t srcLength,
+ UNormalizationMode mode,
+ UErrorCode *pErrorCode);
+
+/**
+ * Test if a string is in a given normalization form; same as unorm_isNormalized but
+ * takes an extra options parameter like most normalization functions.
+ *
+ * @param src String that is to be tested if it is in a normalization format.
+ * @param srcLength Length of source to test, or -1 if NUL-terminated.
+ * @param mode Which normalization form to test for.
+ * @param options The normalization options, ORed together (0 for no options).
+ * @param pErrorCode ICU error code in/out parameter.
+ * Must fulfill U_SUCCESS before the function call.
+ * @return Boolean value indicating whether the source string is in the
+ * "mode/options" normalization form.
+ *
+ * @see unorm_quickCheck
+ * @see unorm_isNormalized
+ * @stable ICU 2.6
+ */
+U_STABLE UBool U_EXPORT2
+unorm_isNormalizedWithOptions(const UChar *src, int32_t srcLength,
+ UNormalizationMode mode, int32_t options,
+ UErrorCode *pErrorCode);
+
+/**
+ * Iterative normalization forward.
+ * This function (together with unorm_previous) is somewhat
+ * similar to the C++ Normalizer class (see its non-static functions).
+ *
+ * Iterative normalization is useful when only a small portion of a longer
+ * string/text needs to be processed.
+ *
+ * For example, the likelihood may be high that processing the first 10% of some
+ * text will be sufficient to find certain data.
+ * Another example: When one wants to concatenate two normalized strings and get a
+ * normalized result, it is much more efficient to normalize just a small part of
+ * the result around the concatenation place instead of re-normalizing everything.
+ *
+ * The input text is an instance of the C character iteration API UCharIterator.
+ * It may wrap around a simple string, a CharacterIterator, a Replaceable, or any
+ * other kind of text object.
+ *
+ * If a buffer overflow occurs, then the caller needs to reset the iterator to the
+ * old index and call the function again with a larger buffer - if the caller cares
+ * for the actual output.
+ * Regardless of the output buffer, the iterator will always be moved to the next
+ * normalization boundary.
+ *
+ * This function (like unorm_previous) serves two purposes:
+ *
+ * 1) To find the next boundary so that the normalization of the part of the text
+ * from the current position to that boundary does not affect and is not affected
+ * by the part of the text beyond that boundary.
+ *
+ * 2) To normalize the text up to the boundary.
+ *
+ * The second step is optional, per the doNormalize parameter.
+ * It is omitted for operations like string concatenation, where the two adjacent
+ * string ends need to be normalized together.
+ * In such a case, the output buffer will just contain a copy of the text up to the
+ * boundary.
+ *
+ * pNeededToNormalize is an output-only parameter. Its output value is only defined
+ * if normalization was requested (doNormalize) and successful (especially, no
+ * buffer overflow).
+ * It is useful for operations like a normalizing transliterator, where one would
+ * not want to replace a piece of text if it is not modified.
+ *
+ * If doNormalize==TRUE and pNeededToNormalize!=NULL then *pNeeded... is set TRUE
+ * if the normalization was necessary.
+ *
+ * If doNormalize==FALSE then *pNeededToNormalize will be set to FALSE.
+ *
+ * If the buffer overflows, then *pNeededToNormalize will be undefined;
+ * essentially, whenever U_FAILURE is true (like in buffer overflows), this result
+ * will be undefined.
+ *
+ * @param src The input text in the form of a C character iterator.
+ * @param dest The output buffer; can be NULL if destCapacity==0 for pure preflighting.
+ * @param destCapacity The number of UChars that fit into dest.
+ * @param mode The normalization mode.
+ * @param options The normalization options, ORed together (0 for no options).
+ * @param doNormalize Indicates if the source text up to the next boundary
+ * is to be normalized (TRUE) or just copied (FALSE).
+ * @param pNeededToNormalize Output flag indicating if the normalization resulted in
+ * different text from the input.
+ * Not defined if an error occurs including buffer overflow.
+ * Always FALSE if !doNormalize.
+ * @param pErrorCode ICU error code in/out parameter.
+ * Must fulfill U_SUCCESS before the function call.
+ * @return Length of output (number of UChars) when successful or buffer overflow.
+ *
+ * @see unorm_previous
+ * @see unorm_normalize
+ *
+ * @stable ICU 2.1
+ */
+U_STABLE int32_t U_EXPORT2
+unorm_next(UCharIterator *src,
+ UChar *dest, int32_t destCapacity,
+ UNormalizationMode mode, int32_t options,
+ UBool doNormalize, UBool *pNeededToNormalize,
+ UErrorCode *pErrorCode);
+
+/**
+ * Iterative normalization backward.
+ * This function (together with unorm_next) is somewhat
+ * similar to the C++ Normalizer class (see its non-static functions).
+ * For all details see unorm_next.
+ *
+ * @param src The input text in the form of a C character iterator.
+ * @param dest The output buffer; can be NULL if destCapacity==0 for pure preflighting.
+ * @param destCapacity The number of UChars that fit into dest.
+ * @param mode The normalization mode.
+ * @param options The normalization options, ORed together (0 for no options).
+ * @param doNormalize Indicates if the source text up to the next boundary
+ * is to be normalized (TRUE) or just copied (FALSE).
+ * @param pNeededToNormalize Output flag indicating if the normalization resulted in
+ * different text from the input.
+ * Not defined if an error occurs including buffer overflow.
+ * Always FALSE if !doNormalize.
+ * @param pErrorCode ICU error code in/out parameter.
+ * Must fulfill U_SUCCESS before the function call.
+ * @return Length of output (number of UChars) when successful or buffer overflow.
+ *
+ * @see unorm_next
+ * @see unorm_normalize
+ *
+ * @stable ICU 2.1
+ */
+U_STABLE int32_t U_EXPORT2
+unorm_previous(UCharIterator *src,
+ UChar *dest, int32_t destCapacity,
+ UNormalizationMode mode, int32_t options,
+ UBool doNormalize, UBool *pNeededToNormalize,
+ UErrorCode *pErrorCode);
+
+/**
+ * Concatenate normalized strings, making sure that the result is normalized as well.
+ *
+ * If both the left and the right strings are in
+ * the normalization form according to "mode/options",
+ * then the result will be
+ *
+ * \code
+ * dest=normalize(left+right, mode, options)
+ * \endcode
+ *
+ * With the input strings already being normalized,
+ * this function will use unorm_next() and unorm_previous()
+ * to find the adjacent end pieces of the input strings.
+ * Only the concatenation of these end pieces will be normalized and
+ * then concatenated with the remaining parts of the input strings.
+ *
+ * It is allowed to have dest==left to avoid copying the entire left string.
+ *
+ * @param left Left source string, may be same as dest.
+ * @param leftLength Length of left source string, or -1 if NUL-terminated.
+ * @param right Right source string.
+ * @param rightLength Length of right source string, or -1 if NUL-terminated.
+ * @param dest The output buffer; can be NULL if destCapacity==0 for pure preflighting.
+ * @param destCapacity The number of UChars that fit into dest.
+ * @param mode The normalization mode.
+ * @param options The normalization options, ORed together (0 for no options).
+ * @param pErrorCode ICU error code in/out parameter.
+ * Must fulfill U_SUCCESS before the function call.
+ * @return Length of output (number of UChars) when successful or buffer overflow.
+ *
+ * @see unorm_normalize
+ * @see unorm_next
+ * @see unorm_previous
+ *
+ * @stable ICU 2.1
+ */
+U_STABLE int32_t U_EXPORT2
+unorm_concatenate(const UChar *left, int32_t leftLength,
+ const UChar *right, int32_t rightLength,
+ UChar *dest, int32_t destCapacity,
+ UNormalizationMode mode, int32_t options,
+ UErrorCode *pErrorCode);
+
+/**
+ * Option bit for unorm_compare:
+ * Both input strings are assumed to fulfill FCD conditions.
+ * @stable ICU 2.2
+ */
+#define UNORM_INPUT_IS_FCD 0x20000
+
+/**
+ * Option bit for unorm_compare:
+ * Perform case-insensitive comparison.
+ * @stable ICU 2.2
+ */
+#define U_COMPARE_IGNORE_CASE 0x10000
+
+#ifndef U_COMPARE_CODE_POINT_ORDER
+/* see also unistr.h and ustring.h */
+/**
+ * Option bit for u_strCaseCompare, u_strcasecmp, unorm_compare, etc:
+ * Compare strings in code point order instead of code unit order.
+ * @stable ICU 2.2
+ */
+#define U_COMPARE_CODE_POINT_ORDER 0x8000
+#endif
+
+/**
+ * Compare two strings for canonical equivalence.
+ * Further options include case-insensitive comparison and
+ * code point order (as opposed to code unit order).
+ *
+ * Canonical equivalence between two strings is defined as their normalized
+ * forms (NFD or NFC) being identical.
+ * This function compares strings incrementally instead of normalizing
+ * (and optionally case-folding) both strings entirely,
+ * improving performance significantly.
+ *
+ * Bulk normalization is only necessary if the strings do not fulfill the FCD
+ * conditions. Only in this case, and only if the strings are relatively long,
+ * is memory allocated temporarily.
+ * For FCD strings and short non-FCD strings there is no memory allocation.
+ *
+ * Semantically, this is equivalent to
+ * strcmp[CodePointOrder](NFD(foldCase(NFD(s1))), NFD(foldCase(NFD(s2))))
+ * where code point order and foldCase are all optional.
+ *
+ * UAX 21 2.5 Caseless Matching specifies that for a canonical caseless match
+ * the case folding must be performed first, then the normalization.
+ *
+ * @param s1 First source string.
+ * @param length1 Length of first source string, or -1 if NUL-terminated.
+ *
+ * @param s2 Second source string.
+ * @param length2 Length of second source string, or -1 if NUL-terminated.
+ *
+ * @param options A bit set of options:
+ * - U_FOLD_CASE_DEFAULT or 0 is used for default options:
+ * Case-sensitive comparison in code unit order, and the input strings
+ * are quick-checked for FCD.
+ *
+ * - UNORM_INPUT_IS_FCD
+ * Set if the caller knows that both s1 and s2 fulfill the FCD conditions.
+ * If not set, the function will quickCheck for FCD
+ * and normalize if necessary.
+ *
+ * - U_COMPARE_CODE_POINT_ORDER
+ * Set to choose code point order instead of code unit order
+ * (see u_strCompare for details).
+ *
+ * - U_COMPARE_IGNORE_CASE
+ * Set to compare strings case-insensitively using case folding,
+ * instead of case-sensitively.
+ * If set, then the following case folding options are used.
+ *
+ * - Options as used with case-insensitive comparisons, currently:
+ *
+ * - U_FOLD_CASE_EXCLUDE_SPECIAL_I
+ * (see u_strCaseCompare for details)
+ *
+ * - regular normalization options shifted left by UNORM_COMPARE_NORM_OPTIONS_SHIFT
+ *
+ * @param pErrorCode ICU error code in/out parameter.
+ * Must fulfill U_SUCCESS before the function call.
+ * @return <0 or 0 or >0 as usual for string comparisons
+ *
+ * @see unorm_normalize
+ * @see UNORM_FCD
+ * @see u_strCompare
+ * @see u_strCaseCompare
+ *
+ * @stable ICU 2.2
+ */
+U_STABLE int32_t U_EXPORT2
+unorm_compare(const UChar *s1, int32_t length1,
+ const UChar *s2, int32_t length2,
+ uint32_t options,
+ UErrorCode *pErrorCode);
+
+#endif /* #if !UCONFIG_NO_NORMALIZATION */
+
+#endif
diff --git a/Source/JavaScriptCore/icu/unicode/urename.h b/Source/JavaScriptCore/icu/unicode/urename.h
new file mode 100644
index 0000000..5562592
--- /dev/null
+++ b/Source/JavaScriptCore/icu/unicode/urename.h
@@ -0,0 +1,1468 @@
+/*
+*******************************************************************************
+* Copyright (C) 2002-2004, International Business Machines
+* Corporation and others. All Rights Reserved.
+*******************************************************************************
+*
+* file name: urename.h
+* encoding: US-ASCII
+* tab size: 8 (not used)
+* indentation:4
+*
+* Created by: Perl script written by Vladimir Weinstein
+*
+* Contains data for renaming ICU exports.
+* Gets included by umachine.h
+*
+* THIS FILE IS MACHINE-GENERATED, DON'T PLAY WITH IT IF YOU DON'T KNOW WHAT
+* YOU ARE DOING, OTHERWISE VERY BAD THINGS WILL HAPPEN!
+*/
+
+#ifndef URENAME_H
+#define URENAME_H
+
+/* Uncomment the following line to disable renaming on platforms
+ that do not use Autoconf. */
+/* #define U_DISABLE_RENAMING 1 */
+
+#if !U_DISABLE_RENAMING
+
+/* C exports renaming data */
+
+#define T_CString_int64ToString T_CString_int64ToString_3_2
+#define T_CString_integerToString T_CString_integerToString_3_2
+#define T_CString_stricmp T_CString_stricmp_3_2
+#define T_CString_stringToInteger T_CString_stringToInteger_3_2
+#define T_CString_strnicmp T_CString_strnicmp_3_2
+#define T_CString_toLowerCase T_CString_toLowerCase_3_2
+#define T_CString_toUpperCase T_CString_toUpperCase_3_2
+#define T_FileStream_close T_FileStream_close_3_2
+#define T_FileStream_eof T_FileStream_eof_3_2
+#define T_FileStream_error T_FileStream_error_3_2
+#define T_FileStream_file_exists T_FileStream_file_exists_3_2
+#define T_FileStream_getc T_FileStream_getc_3_2
+#define T_FileStream_open T_FileStream_open_3_2
+#define T_FileStream_peek T_FileStream_peek_3_2
+#define T_FileStream_putc T_FileStream_putc_3_2
+#define T_FileStream_read T_FileStream_read_3_2
+#define T_FileStream_readLine T_FileStream_readLine_3_2
+#define T_FileStream_remove T_FileStream_remove_3_2
+#define T_FileStream_rewind T_FileStream_rewind_3_2
+#define T_FileStream_size T_FileStream_size_3_2
+#define T_FileStream_stderr T_FileStream_stderr_3_2
+#define T_FileStream_stdin T_FileStream_stdin_3_2
+#define T_FileStream_stdout T_FileStream_stdout_3_2
+#define T_FileStream_ungetc T_FileStream_ungetc_3_2
+#define T_FileStream_write T_FileStream_write_3_2
+#define T_FileStream_writeLine T_FileStream_writeLine_3_2
+#define UCNV_FROM_U_CALLBACK_ESCAPE UCNV_FROM_U_CALLBACK_ESCAPE_3_2
+#define UCNV_FROM_U_CALLBACK_SKIP UCNV_FROM_U_CALLBACK_SKIP_3_2
+#define UCNV_FROM_U_CALLBACK_STOP UCNV_FROM_U_CALLBACK_STOP_3_2
+#define UCNV_FROM_U_CALLBACK_SUBSTITUTE UCNV_FROM_U_CALLBACK_SUBSTITUTE_3_2
+#define UCNV_TO_U_CALLBACK_ESCAPE UCNV_TO_U_CALLBACK_ESCAPE_3_2
+#define UCNV_TO_U_CALLBACK_SKIP UCNV_TO_U_CALLBACK_SKIP_3_2
+#define UCNV_TO_U_CALLBACK_STOP UCNV_TO_U_CALLBACK_STOP_3_2
+#define UCNV_TO_U_CALLBACK_SUBSTITUTE UCNV_TO_U_CALLBACK_SUBSTITUTE_3_2
+#define UDataMemory_createNewInstance UDataMemory_createNewInstance_3_2
+#define UDataMemory_init UDataMemory_init_3_2
+#define UDataMemory_isLoaded UDataMemory_isLoaded_3_2
+#define UDataMemory_normalizeDataPointer UDataMemory_normalizeDataPointer_3_2
+#define UDataMemory_setData UDataMemory_setData_3_2
+#define UDatamemory_assign UDatamemory_assign_3_2
+#define _ASCIIData _ASCIIData_3_2
+#define _Bocu1Data _Bocu1Data_3_2
+#define _CESU8Data _CESU8Data_3_2
+#define _HZData _HZData_3_2
+#define _IMAPData _IMAPData_3_2
+#define _ISCIIData _ISCIIData_3_2
+#define _ISO2022Data _ISO2022Data_3_2
+#define _LMBCSData1 _LMBCSData1_3_2
+#define _LMBCSData11 _LMBCSData11_3_2
+#define _LMBCSData16 _LMBCSData16_3_2
+#define _LMBCSData17 _LMBCSData17_3_2
+#define _LMBCSData18 _LMBCSData18_3_2
+#define _LMBCSData19 _LMBCSData19_3_2
+#define _LMBCSData2 _LMBCSData2_3_2
+#define _LMBCSData3 _LMBCSData3_3_2
+#define _LMBCSData4 _LMBCSData4_3_2
+#define _LMBCSData5 _LMBCSData5_3_2
+#define _LMBCSData6 _LMBCSData6_3_2
+#define _LMBCSData8 _LMBCSData8_3_2
+#define _Latin1Data _Latin1Data_3_2
+#define _MBCSData _MBCSData_3_2
+#define _SCSUData _SCSUData_3_2
+#define _UTF16BEData _UTF16BEData_3_2
+#define _UTF16Data _UTF16Data_3_2
+#define _UTF16LEData _UTF16LEData_3_2
+#define _UTF32BEData _UTF32BEData_3_2
+#define _UTF32Data _UTF32Data_3_2
+#define _UTF32LEData _UTF32LEData_3_2
+#define _UTF7Data _UTF7Data_3_2
+#define _UTF8Data _UTF8Data_3_2
+#define cmemory_cleanup cmemory_cleanup_3_2
+#define cmemory_inUse cmemory_inUse_3_2
+#define locale_getKeywords locale_getKeywords_3_2
+#define locale_get_default locale_get_default_3_2
+#define locale_set_default locale_set_default_3_2
+#define res_countArrayItems res_countArrayItems_3_2
+#define res_findResource res_findResource_3_2
+#define res_getAlias res_getAlias_3_2
+#define res_getArrayItem res_getArrayItem_3_2
+#define res_getBinary res_getBinary_3_2
+#define res_getIntVector res_getIntVector_3_2
+#define res_getResource res_getResource_3_2
+#define res_getString res_getString_3_2
+#define res_getTableItemByIndex res_getTableItemByIndex_3_2
+#define res_getTableItemByKey res_getTableItemByKey_3_2
+#define res_load res_load_3_2
+#define res_unload res_unload_3_2
+#define transliterator_cleanup transliterator_cleanup_3_2
+#define u_UCharsToChars u_UCharsToChars_3_2
+#define u_austrcpy u_austrcpy_3_2
+#define u_austrncpy u_austrncpy_3_2
+#define u_catclose u_catclose_3_2
+#define u_catgets u_catgets_3_2
+#define u_catopen u_catopen_3_2
+#define u_charAge u_charAge_3_2
+#define u_charDigitValue u_charDigitValue_3_2
+#define u_charDirection u_charDirection_3_2
+#define u_charFromName u_charFromName_3_2
+#define u_charMirror u_charMirror_3_2
+#define u_charName u_charName_3_2
+#define u_charType u_charType_3_2
+#define u_charsToUChars u_charsToUChars_3_2
+#define u_cleanup u_cleanup_3_2
+#define u_countChar32 u_countChar32_3_2
+#define u_digit u_digit_3_2
+#define u_enumCharNames u_enumCharNames_3_2
+#define u_enumCharTypes u_enumCharTypes_3_2
+#define u_errorName u_errorName_3_2
+#define u_fclose u_fclose_3_2
+#define u_feof u_feof_3_2
+#define u_fflush u_fflush_3_2
+#define u_fgetConverter u_fgetConverter_3_2
+#define u_fgetc u_fgetc_3_2
+#define u_fgetcodepage u_fgetcodepage_3_2
+#define u_fgetcx u_fgetcx_3_2
+#define u_fgetfile u_fgetfile_3_2
+#define u_fgetlocale u_fgetlocale_3_2
+#define u_fgets u_fgets_3_2
+#define u_file_read u_file_read_3_2
+#define u_file_write u_file_write_3_2
+#define u_file_write_flush u_file_write_flush_3_2
+#define u_finit u_finit_3_2
+#define u_foldCase u_foldCase_3_2
+#define u_fopen u_fopen_3_2
+#define u_forDigit u_forDigit_3_2
+#define u_formatMessage u_formatMessage_3_2
+#define u_formatMessageWithError u_formatMessageWithError_3_2
+#define u_fprintf u_fprintf_3_2
+#define u_fprintf_u u_fprintf_u_3_2
+#define u_fputc u_fputc_3_2
+#define u_fputs u_fputs_3_2
+#define u_frewind u_frewind_3_2
+#define u_fscanf u_fscanf_3_2
+#define u_fscanf_u u_fscanf_u_3_2
+#define u_fsetcodepage u_fsetcodepage_3_2
+#define u_fsetlocale u_fsetlocale_3_2
+#define u_fsettransliterator u_fsettransliterator_3_2
+#define u_fstropen u_fstropen_3_2
+#define u_fungetc u_fungetc_3_2
+#define u_getCombiningClass u_getCombiningClass_3_2
+#define u_getDataDirectory u_getDataDirectory_3_2
+#define u_getDefaultConverter u_getDefaultConverter_3_2
+#define u_getFC_NFKC_Closure u_getFC_NFKC_Closure_3_2
+#define u_getISOComment u_getISOComment_3_2
+#define u_getIntPropertyMaxValue u_getIntPropertyMaxValue_3_2
+#define u_getIntPropertyMinValue u_getIntPropertyMinValue_3_2
+#define u_getIntPropertyValue u_getIntPropertyValue_3_2
+#define u_getNumericValue u_getNumericValue_3_2
+#define u_getPropertyEnum u_getPropertyEnum_3_2
+#define u_getPropertyName u_getPropertyName_3_2
+#define u_getPropertyValueEnum u_getPropertyValueEnum_3_2
+#define u_getPropertyValueName u_getPropertyValueName_3_2
+#define u_getUnicodeProperties u_getUnicodeProperties_3_2
+#define u_getUnicodeVersion u_getUnicodeVersion_3_2
+#define u_getVersion u_getVersion_3_2
+#define u_growBufferFromStatic u_growBufferFromStatic_3_2
+#define u_hasBinaryProperty u_hasBinaryProperty_3_2
+#define u_init u_init_3_2
+#define u_isIDIgnorable u_isIDIgnorable_3_2
+#define u_isIDPart u_isIDPart_3_2
+#define u_isIDStart u_isIDStart_3_2
+#define u_isISOControl u_isISOControl_3_2
+#define u_isJavaIDPart u_isJavaIDPart_3_2
+#define u_isJavaIDStart u_isJavaIDStart_3_2
+#define u_isJavaSpaceChar u_isJavaSpaceChar_3_2
+#define u_isMirrored u_isMirrored_3_2
+#define u_isUAlphabetic u_isUAlphabetic_3_2
+#define u_isULowercase u_isULowercase_3_2
+#define u_isUUppercase u_isUUppercase_3_2
+#define u_isUWhiteSpace u_isUWhiteSpace_3_2
+#define u_isWhitespace u_isWhitespace_3_2
+#define u_isalnum u_isalnum_3_2
+#define u_isalpha u_isalpha_3_2
+#define u_isbase u_isbase_3_2
+#define u_isblank u_isblank_3_2
+#define u_iscntrl u_iscntrl_3_2
+#define u_isdefined u_isdefined_3_2
+#define u_isdigit u_isdigit_3_2
+#define u_isgraph u_isgraph_3_2
+#define u_islower u_islower_3_2
+#define u_isprint u_isprint_3_2
+#define u_ispunct u_ispunct_3_2
+#define u_isspace u_isspace_3_2
+#define u_istitle u_istitle_3_2
+#define u_isupper u_isupper_3_2
+#define u_isxdigit u_isxdigit_3_2
+#define u_lengthOfIdenticalLevelRun u_lengthOfIdenticalLevelRun_3_2
+#define u_locbund_close u_locbund_close_3_2
+#define u_locbund_getNumberFormat u_locbund_getNumberFormat_3_2
+#define u_locbund_init u_locbund_init_3_2
+#define u_memcasecmp u_memcasecmp_3_2
+#define u_memchr u_memchr_3_2
+#define u_memchr32 u_memchr32_3_2
+#define u_memcmp u_memcmp_3_2
+#define u_memcmpCodePointOrder u_memcmpCodePointOrder_3_2
+#define u_memcpy u_memcpy_3_2
+#define u_memmove u_memmove_3_2
+#define u_memrchr u_memrchr_3_2
+#define u_memrchr32 u_memrchr32_3_2
+#define u_memset u_memset_3_2
+#define u_parseMessage u_parseMessage_3_2
+#define u_parseMessageWithError u_parseMessageWithError_3_2
+#define u_printf_parse u_printf_parse_3_2
+#define u_releaseDefaultConverter u_releaseDefaultConverter_3_2
+#define u_scanf_parse u_scanf_parse_3_2
+#define u_setAtomicIncDecFunctions u_setAtomicIncDecFunctions_3_2
+#define u_setDataDirectory u_setDataDirectory_3_2
+#define u_setMemoryFunctions u_setMemoryFunctions_3_2
+#define u_setMutexFunctions u_setMutexFunctions_3_2
+#define u_shapeArabic u_shapeArabic_3_2
+#define u_snprintf u_snprintf_3_2
+#define u_snprintf_u u_snprintf_u_3_2
+#define u_sprintf u_sprintf_3_2
+#define u_sprintf_u u_sprintf_u_3_2
+#define u_sscanf u_sscanf_3_2
+#define u_sscanf_u u_sscanf_u_3_2
+#define u_strCaseCompare u_strCaseCompare_3_2
+#define u_strCompare u_strCompare_3_2
+#define u_strCompareIter u_strCompareIter_3_2
+#define u_strFindFirst u_strFindFirst_3_2
+#define u_strFindLast u_strFindLast_3_2
+#define u_strFoldCase u_strFoldCase_3_2
+#define u_strFromPunycode u_strFromPunycode_3_2
+#define u_strFromUTF32 u_strFromUTF32_3_2
+#define u_strFromUTF8 u_strFromUTF8_3_2
+#define u_strFromWCS u_strFromWCS_3_2
+#define u_strHasMoreChar32Than u_strHasMoreChar32Than_3_2
+#define u_strToLower u_strToLower_3_2
+#define u_strToPunycode u_strToPunycode_3_2
+#define u_strToTitle u_strToTitle_3_2
+#define u_strToUTF32 u_strToUTF32_3_2
+#define u_strToUTF8 u_strToUTF8_3_2
+#define u_strToUpper u_strToUpper_3_2
+#define u_strToWCS u_strToWCS_3_2
+#define u_strcasecmp u_strcasecmp_3_2
+#define u_strcat u_strcat_3_2
+#define u_strchr u_strchr_3_2
+#define u_strchr32 u_strchr32_3_2
+#define u_strcmp u_strcmp_3_2
+#define u_strcmpCodePointOrder u_strcmpCodePointOrder_3_2
+#define u_strcmpFold u_strcmpFold_3_2
+#define u_strcpy u_strcpy_3_2
+#define u_strcspn u_strcspn_3_2
+#define u_strlen u_strlen_3_2
+#define u_strncasecmp u_strncasecmp_3_2
+#define u_strncat u_strncat_3_2
+#define u_strncmp u_strncmp_3_2
+#define u_strncmpCodePointOrder u_strncmpCodePointOrder_3_2
+#define u_strncpy u_strncpy_3_2
+#define u_strpbrk u_strpbrk_3_2
+#define u_strrchr u_strrchr_3_2
+#define u_strrchr32 u_strrchr32_3_2
+#define u_strrstr u_strrstr_3_2
+#define u_strspn u_strspn_3_2
+#define u_strstr u_strstr_3_2
+#define u_strtok_r u_strtok_r_3_2
+#define u_terminateChars u_terminateChars_3_2
+#define u_terminateUChar32s u_terminateUChar32s_3_2
+#define u_terminateUChars u_terminateUChars_3_2
+#define u_terminateWChars u_terminateWChars_3_2
+#define u_tolower u_tolower_3_2
+#define u_totitle u_totitle_3_2
+#define u_toupper u_toupper_3_2
+#define u_uastrcpy u_uastrcpy_3_2
+#define u_uastrncpy u_uastrncpy_3_2
+#define u_unescape u_unescape_3_2
+#define u_unescapeAt u_unescapeAt_3_2
+#define u_versionFromString u_versionFromString_3_2
+#define u_versionToString u_versionToString_3_2
+#define u_vformatMessage u_vformatMessage_3_2
+#define u_vformatMessageWithError u_vformatMessageWithError_3_2
+#define u_vfprintf u_vfprintf_3_2
+#define u_vfprintf_u u_vfprintf_u_3_2
+#define u_vfscanf u_vfscanf_3_2
+#define u_vfscanf_u u_vfscanf_u_3_2
+#define u_vparseMessage u_vparseMessage_3_2
+#define u_vparseMessageWithError u_vparseMessageWithError_3_2
+#define u_vsnprintf u_vsnprintf_3_2
+#define u_vsnprintf_u u_vsnprintf_u_3_2
+#define u_vsprintf u_vsprintf_3_2
+#define u_vsprintf_u u_vsprintf_u_3_2
+#define u_vsscanf u_vsscanf_3_2
+#define u_vsscanf_u u_vsscanf_u_3_2
+#define u_writeDiff u_writeDiff_3_2
+#define u_writeIdenticalLevelRun u_writeIdenticalLevelRun_3_2
+#define u_writeIdenticalLevelRunTwoChars u_writeIdenticalLevelRunTwoChars_3_2
+#define ubidi_close ubidi_close_3_2
+#define ubidi_countRuns ubidi_countRuns_3_2
+#define ubidi_getDirection ubidi_getDirection_3_2
+#define ubidi_getLength ubidi_getLength_3_2
+#define ubidi_getLevelAt ubidi_getLevelAt_3_2
+#define ubidi_getLevels ubidi_getLevels_3_2
+#define ubidi_getLogicalIndex ubidi_getLogicalIndex_3_2
+#define ubidi_getLogicalMap ubidi_getLogicalMap_3_2
+#define ubidi_getLogicalRun ubidi_getLogicalRun_3_2
+#define ubidi_getMemory ubidi_getMemory_3_2
+#define ubidi_getParaLevel ubidi_getParaLevel_3_2
+#define ubidi_getRuns ubidi_getRuns_3_2
+#define ubidi_getText ubidi_getText_3_2
+#define ubidi_getVisualIndex ubidi_getVisualIndex_3_2
+#define ubidi_getVisualMap ubidi_getVisualMap_3_2
+#define ubidi_getVisualRun ubidi_getVisualRun_3_2
+#define ubidi_invertMap ubidi_invertMap_3_2
+#define ubidi_isInverse ubidi_isInverse_3_2
+#define ubidi_open ubidi_open_3_2
+#define ubidi_openSized ubidi_openSized_3_2
+#define ubidi_reorderLogical ubidi_reorderLogical_3_2
+#define ubidi_reorderVisual ubidi_reorderVisual_3_2
+#define ubidi_setInverse ubidi_setInverse_3_2
+#define ubidi_setLine ubidi_setLine_3_2
+#define ubidi_setPara ubidi_setPara_3_2
+#define ubidi_writeReordered ubidi_writeReordered_3_2
+#define ubidi_writeReverse ubidi_writeReverse_3_2
+#define ublock_getCode ublock_getCode_3_2
+#define ubrk_close ubrk_close_3_2
+#define ubrk_countAvailable ubrk_countAvailable_3_2
+#define ubrk_current ubrk_current_3_2
+#define ubrk_first ubrk_first_3_2
+#define ubrk_following ubrk_following_3_2
+#define ubrk_getAvailable ubrk_getAvailable_3_2
+#define ubrk_getLocaleByType ubrk_getLocaleByType_3_2
+#define ubrk_getRuleStatus ubrk_getRuleStatus_3_2
+#define ubrk_getRuleStatusVec ubrk_getRuleStatusVec_3_2
+#define ubrk_isBoundary ubrk_isBoundary_3_2
+#define ubrk_last ubrk_last_3_2
+#define ubrk_next ubrk_next_3_2
+#define ubrk_open ubrk_open_3_2
+#define ubrk_openRules ubrk_openRules_3_2
+#define ubrk_preceding ubrk_preceding_3_2
+#define ubrk_previous ubrk_previous_3_2
+#define ubrk_safeClone ubrk_safeClone_3_2
+#define ubrk_setText ubrk_setText_3_2
+#define ubrk_swap ubrk_swap_3_2
+#define ucal_add ucal_add_3_2
+#define ucal_clear ucal_clear_3_2
+#define ucal_clearField ucal_clearField_3_2
+#define ucal_close ucal_close_3_2
+#define ucal_countAvailable ucal_countAvailable_3_2
+#define ucal_equivalentTo ucal_equivalentTo_3_2
+#define ucal_get ucal_get_3_2
+#define ucal_getAttribute ucal_getAttribute_3_2
+#define ucal_getAvailable ucal_getAvailable_3_2
+#define ucal_getDSTSavings ucal_getDSTSavings_3_2
+#define ucal_getDefaultTimeZone ucal_getDefaultTimeZone_3_2
+#define ucal_getLimit ucal_getLimit_3_2
+#define ucal_getLocaleByType ucal_getLocaleByType_3_2
+#define ucal_getMillis ucal_getMillis_3_2
+#define ucal_getNow ucal_getNow_3_2
+#define ucal_getTimeZoneDisplayName ucal_getTimeZoneDisplayName_3_2
+#define ucal_inDaylightTime ucal_inDaylightTime_3_2
+#define ucal_isSet ucal_isSet_3_2
+#define ucal_open ucal_open_3_2
+#define ucal_openCountryTimeZones ucal_openCountryTimeZones_3_2
+#define ucal_openTimeZones ucal_openTimeZones_3_2
+#define ucal_roll ucal_roll_3_2
+#define ucal_set ucal_set_3_2
+#define ucal_setAttribute ucal_setAttribute_3_2
+#define ucal_setDate ucal_setDate_3_2
+#define ucal_setDateTime ucal_setDateTime_3_2
+#define ucal_setDefaultTimeZone ucal_setDefaultTimeZone_3_2
+#define ucal_setMillis ucal_setMillis_3_2
+#define ucal_setTimeZone ucal_setTimeZone_3_2
+#define ucase_addPropertyStarts ucase_addPropertyStarts_3_2
+#define ucase_close ucase_close_3_2
+#define ucase_fold ucase_fold_3_2
+#define ucase_getSingleton ucase_getSingleton_3_2
+#define ucase_getType ucase_getType_3_2
+#define ucase_getTypeOrIgnorable ucase_getTypeOrIgnorable_3_2
+#define ucase_isCaseSensitive ucase_isCaseSensitive_3_2
+#define ucase_isSoftDotted ucase_isSoftDotted_3_2
+#define ucase_open ucase_open_3_2
+#define ucase_openBinary ucase_openBinary_3_2
+#define ucase_swap ucase_swap_3_2
+#define ucase_toFullFolding ucase_toFullFolding_3_2
+#define ucase_toFullLower ucase_toFullLower_3_2
+#define ucase_toFullTitle ucase_toFullTitle_3_2
+#define ucase_toFullUpper ucase_toFullUpper_3_2
+#define ucase_tolower ucase_tolower_3_2
+#define ucase_totitle ucase_totitle_3_2
+#define ucase_toupper ucase_toupper_3_2
+#define uchar_addPropertyStarts uchar_addPropertyStarts_3_2
+#define uchar_getHST uchar_getHST_3_2
+#define uchar_swapNames uchar_swapNames_3_2
+#define ucln_common_lib_cleanup ucln_common_lib_cleanup_3_2
+#define ucln_common_registerCleanup ucln_common_registerCleanup_3_2
+#define ucln_i18n_registerCleanup ucln_i18n_registerCleanup_3_2
+#define ucln_registerCleanup ucln_registerCleanup_3_2
+#define ucmp8_close ucmp8_close_3_2
+#define ucmp8_compact ucmp8_compact_3_2
+#define ucmp8_expand ucmp8_expand_3_2
+#define ucmp8_flattenMem ucmp8_flattenMem_3_2
+#define ucmp8_getArray ucmp8_getArray_3_2
+#define ucmp8_getCount ucmp8_getCount_3_2
+#define ucmp8_getIndex ucmp8_getIndex_3_2
+#define ucmp8_getkBlockCount ucmp8_getkBlockCount_3_2
+#define ucmp8_getkUnicodeCount ucmp8_getkUnicodeCount_3_2
+#define ucmp8_init ucmp8_init_3_2
+#define ucmp8_initAdopt ucmp8_initAdopt_3_2
+#define ucmp8_initAlias ucmp8_initAlias_3_2
+#define ucmp8_initBogus ucmp8_initBogus_3_2
+#define ucmp8_initFromData ucmp8_initFromData_3_2
+#define ucmp8_isBogus ucmp8_isBogus_3_2
+#define ucmp8_open ucmp8_open_3_2
+#define ucmp8_openAdopt ucmp8_openAdopt_3_2
+#define ucmp8_openAlias ucmp8_openAlias_3_2
+#define ucmp8_set ucmp8_set_3_2
+#define ucmp8_setRange ucmp8_setRange_3_2
+#define ucnv_MBCSFromUChar32 ucnv_MBCSFromUChar32_3_2
+#define ucnv_MBCSFromUnicodeWithOffsets ucnv_MBCSFromUnicodeWithOffsets_3_2
+#define ucnv_MBCSGetType ucnv_MBCSGetType_3_2
+#define ucnv_MBCSGetUnicodeSetForBytes ucnv_MBCSGetUnicodeSetForBytes_3_2
+#define ucnv_MBCSGetUnicodeSetForUnicode ucnv_MBCSGetUnicodeSetForUnicode_3_2
+#define ucnv_MBCSIsLeadByte ucnv_MBCSIsLeadByte_3_2
+#define ucnv_MBCSSimpleGetNextUChar ucnv_MBCSSimpleGetNextUChar_3_2
+#define ucnv_MBCSToUnicodeWithOffsets ucnv_MBCSToUnicodeWithOffsets_3_2
+#define ucnv_cbFromUWriteBytes ucnv_cbFromUWriteBytes_3_2
+#define ucnv_cbFromUWriteSub ucnv_cbFromUWriteSub_3_2
+#define ucnv_cbFromUWriteUChars ucnv_cbFromUWriteUChars_3_2
+#define ucnv_cbToUWriteSub ucnv_cbToUWriteSub_3_2
+#define ucnv_cbToUWriteUChars ucnv_cbToUWriteUChars_3_2
+#define ucnv_close ucnv_close_3_2
+#define ucnv_compareNames ucnv_compareNames_3_2
+#define ucnv_convert ucnv_convert_3_2
+#define ucnv_convertEx ucnv_convertEx_3_2
+#define ucnv_copyPlatformString ucnv_copyPlatformString_3_2
+#define ucnv_countAliases ucnv_countAliases_3_2
+#define ucnv_countAvailable ucnv_countAvailable_3_2
+#define ucnv_countStandards ucnv_countStandards_3_2
+#define ucnv_createAlgorithmicConverter ucnv_createAlgorithmicConverter_3_2
+#define ucnv_createConverter ucnv_createConverter_3_2
+#define ucnv_createConverterFromPackage ucnv_createConverterFromPackage_3_2
+#define ucnv_createConverterFromSharedData ucnv_createConverterFromSharedData_3_2
+#define ucnv_detectUnicodeSignature ucnv_detectUnicodeSignature_3_2
+#define ucnv_extContinueMatchFromU ucnv_extContinueMatchFromU_3_2
+#define ucnv_extContinueMatchToU ucnv_extContinueMatchToU_3_2
+#define ucnv_extGetUnicodeSet ucnv_extGetUnicodeSet_3_2
+#define ucnv_extInitialMatchFromU ucnv_extInitialMatchFromU_3_2
+#define ucnv_extInitialMatchToU ucnv_extInitialMatchToU_3_2
+#define ucnv_extSimpleMatchFromU ucnv_extSimpleMatchFromU_3_2
+#define ucnv_extSimpleMatchToU ucnv_extSimpleMatchToU_3_2
+#define ucnv_fixFileSeparator ucnv_fixFileSeparator_3_2
+#define ucnv_flushCache ucnv_flushCache_3_2
+#define ucnv_fromAlgorithmic ucnv_fromAlgorithmic_3_2
+#define ucnv_fromUChars ucnv_fromUChars_3_2
+#define ucnv_fromUWriteBytes ucnv_fromUWriteBytes_3_2
+#define ucnv_fromUnicode ucnv_fromUnicode_3_2
+#define ucnv_fromUnicode_UTF8 ucnv_fromUnicode_UTF8_3_2
+#define ucnv_fromUnicode_UTF8_OFFSETS_LOGIC ucnv_fromUnicode_UTF8_OFFSETS_LOGIC_3_2
+#define ucnv_getAlias ucnv_getAlias_3_2
+#define ucnv_getAliases ucnv_getAliases_3_2
+#define ucnv_getAvailableName ucnv_getAvailableName_3_2
+#define ucnv_getCCSID ucnv_getCCSID_3_2
+#define ucnv_getCanonicalName ucnv_getCanonicalName_3_2
+#define ucnv_getCompleteUnicodeSet ucnv_getCompleteUnicodeSet_3_2
+#define ucnv_getDefaultName ucnv_getDefaultName_3_2
+#define ucnv_getDisplayName ucnv_getDisplayName_3_2
+#define ucnv_getFromUCallBack ucnv_getFromUCallBack_3_2
+#define ucnv_getInvalidChars ucnv_getInvalidChars_3_2
+#define ucnv_getInvalidUChars ucnv_getInvalidUChars_3_2
+#define ucnv_getMaxCharSize ucnv_getMaxCharSize_3_2
+#define ucnv_getMinCharSize ucnv_getMinCharSize_3_2
+#define ucnv_getName ucnv_getName_3_2
+#define ucnv_getNextUChar ucnv_getNextUChar_3_2
+#define ucnv_getNonSurrogateUnicodeSet ucnv_getNonSurrogateUnicodeSet_3_2
+#define ucnv_getPlatform ucnv_getPlatform_3_2
+#define ucnv_getStandard ucnv_getStandard_3_2
+#define ucnv_getStandardName ucnv_getStandardName_3_2
+#define ucnv_getStarters ucnv_getStarters_3_2
+#define ucnv_getSubstChars ucnv_getSubstChars_3_2
+#define ucnv_getToUCallBack ucnv_getToUCallBack_3_2
+#define ucnv_getType ucnv_getType_3_2
+#define ucnv_getUnicodeSet ucnv_getUnicodeSet_3_2
+#define ucnv_incrementRefCount ucnv_incrementRefCount_3_2
+#define ucnv_io_countAliases ucnv_io_countAliases_3_2
+#define ucnv_io_countAvailableAliases ucnv_io_countAvailableAliases_3_2
+#define ucnv_io_countAvailableConverters ucnv_io_countAvailableConverters_3_2
+#define ucnv_io_countStandards ucnv_io_countStandards_3_2
+#define ucnv_io_flushAvailableConverterCache ucnv_io_flushAvailableConverterCache_3_2
+#define ucnv_io_getAlias ucnv_io_getAlias_3_2
+#define ucnv_io_getAliases ucnv_io_getAliases_3_2
+#define ucnv_io_getAvailableConverter ucnv_io_getAvailableConverter_3_2
+#define ucnv_io_getConverterName ucnv_io_getConverterName_3_2
+#define ucnv_io_getDefaultConverterName ucnv_io_getDefaultConverterName_3_2
+#define ucnv_io_setDefaultConverterName ucnv_io_setDefaultConverterName_3_2
+#define ucnv_io_stripASCIIForCompare ucnv_io_stripASCIIForCompare_3_2
+#define ucnv_io_stripEBCDICForCompare ucnv_io_stripEBCDICForCompare_3_2
+#define ucnv_isAmbiguous ucnv_isAmbiguous_3_2
+#define ucnv_load ucnv_load_3_2
+#define ucnv_loadSharedData ucnv_loadSharedData_3_2
+#define ucnv_open ucnv_open_3_2
+#define ucnv_openAllNames ucnv_openAllNames_3_2
+#define ucnv_openCCSID ucnv_openCCSID_3_2
+#define ucnv_openPackage ucnv_openPackage_3_2
+#define ucnv_openStandardNames ucnv_openStandardNames_3_2
+#define ucnv_openU ucnv_openU_3_2
+#define ucnv_reset ucnv_reset_3_2
+#define ucnv_resetFromUnicode ucnv_resetFromUnicode_3_2
+#define ucnv_resetToUnicode ucnv_resetToUnicode_3_2
+#define ucnv_safeClone ucnv_safeClone_3_2
+#define ucnv_setDefaultName ucnv_setDefaultName_3_2
+#define ucnv_setFallback ucnv_setFallback_3_2
+#define ucnv_setFromUCallBack ucnv_setFromUCallBack_3_2
+#define ucnv_setSubstChars ucnv_setSubstChars_3_2
+#define ucnv_setToUCallBack ucnv_setToUCallBack_3_2
+#define ucnv_swap ucnv_swap_3_2
+#define ucnv_swapAliases ucnv_swapAliases_3_2
+#define ucnv_toAlgorithmic ucnv_toAlgorithmic_3_2
+#define ucnv_toUChars ucnv_toUChars_3_2
+#define ucnv_toUWriteCodePoint ucnv_toUWriteCodePoint_3_2
+#define ucnv_toUWriteUChars ucnv_toUWriteUChars_3_2
+#define ucnv_toUnicode ucnv_toUnicode_3_2
+#define ucnv_unload ucnv_unload_3_2
+#define ucnv_unloadSharedDataIfReady ucnv_unloadSharedDataIfReady_3_2
+#define ucnv_usesFallback ucnv_usesFallback_3_2
+#define ucol_allocWeights ucol_allocWeights_3_2
+#define ucol_assembleTailoringTable ucol_assembleTailoringTable_3_2
+#define ucol_calcSortKey ucol_calcSortKey_3_2
+#define ucol_calcSortKeySimpleTertiary ucol_calcSortKeySimpleTertiary_3_2
+#define ucol_cloneBinary ucol_cloneBinary_3_2
+#define ucol_cloneRuleData ucol_cloneRuleData_3_2
+#define ucol_close ucol_close_3_2
+#define ucol_closeElements ucol_closeElements_3_2
+#define ucol_collatorToIdentifier ucol_collatorToIdentifier_3_2
+#define ucol_countAvailable ucol_countAvailable_3_2
+#define ucol_createElements ucol_createElements_3_2
+#define ucol_doCE ucol_doCE_3_2
+#define ucol_equal ucol_equal_3_2
+#define ucol_equals ucol_equals_3_2
+#define ucol_getAttribute ucol_getAttribute_3_2
+#define ucol_getAttributeOrDefault ucol_getAttributeOrDefault_3_2
+#define ucol_getAvailable ucol_getAvailable_3_2
+#define ucol_getBound ucol_getBound_3_2
+#define ucol_getCEGenerator ucol_getCEGenerator_3_2
+#define ucol_getCEStrengthDifference ucol_getCEStrengthDifference_3_2
+#define ucol_getContractions ucol_getContractions_3_2
+#define ucol_getDisplayName ucol_getDisplayName_3_2
+#define ucol_getFirstCE ucol_getFirstCE_3_2
+#define ucol_getFunctionalEquivalent ucol_getFunctionalEquivalent_3_2
+#define ucol_getKeywordValues ucol_getKeywordValues_3_2
+#define ucol_getKeywords ucol_getKeywords_3_2
+#define ucol_getLocale ucol_getLocale_3_2
+#define ucol_getLocaleByType ucol_getLocaleByType_3_2
+#define ucol_getMaxExpansion ucol_getMaxExpansion_3_2
+#define ucol_getNextCE ucol_getNextCE_3_2
+#define ucol_getNextGenerated ucol_getNextGenerated_3_2
+#define ucol_getOffset ucol_getOffset_3_2
+#define ucol_getPrevCE ucol_getPrevCE_3_2
+#define ucol_getRules ucol_getRules_3_2
+#define ucol_getRulesEx ucol_getRulesEx_3_2
+#define ucol_getShortDefinitionString ucol_getShortDefinitionString_3_2
+#define ucol_getSimpleCEGenerator ucol_getSimpleCEGenerator_3_2
+#define ucol_getSortKey ucol_getSortKey_3_2
+#define ucol_getSortKeySize ucol_getSortKeySize_3_2
+#define ucol_getSortKeyWithAllocation ucol_getSortKeyWithAllocation_3_2
+#define ucol_getStrength ucol_getStrength_3_2
+#define ucol_getTailoredSet ucol_getTailoredSet_3_2
+#define ucol_getUCAVersion ucol_getUCAVersion_3_2
+#define ucol_getUnsafeSet ucol_getUnsafeSet_3_2
+#define ucol_getVariableTop ucol_getVariableTop_3_2
+#define ucol_getVersion ucol_getVersion_3_2
+#define ucol_greater ucol_greater_3_2
+#define ucol_greaterOrEqual ucol_greaterOrEqual_3_2
+#define ucol_identifierToShortString ucol_identifierToShortString_3_2
+#define ucol_initBuffers ucol_initBuffers_3_2
+#define ucol_initCollator ucol_initCollator_3_2
+#define ucol_initInverseUCA ucol_initInverseUCA_3_2
+#define ucol_initUCA ucol_initUCA_3_2
+#define ucol_inv_getGapPositions ucol_inv_getGapPositions_3_2
+#define ucol_inv_getNextCE ucol_inv_getNextCE_3_2
+#define ucol_inv_getPrevCE ucol_inv_getPrevCE_3_2
+#define ucol_isTailored ucol_isTailored_3_2
+#define ucol_keyHashCode ucol_keyHashCode_3_2
+#define ucol_mergeSortkeys ucol_mergeSortkeys_3_2
+#define ucol_next ucol_next_3_2
+#define ucol_nextSortKeyPart ucol_nextSortKeyPart_3_2
+#define ucol_nextWeight ucol_nextWeight_3_2
+#define ucol_normalizeShortDefinitionString ucol_normalizeShortDefinitionString_3_2
+#define ucol_open ucol_open_3_2
+#define ucol_openAvailableLocales ucol_openAvailableLocales_3_2
+#define ucol_openBinary ucol_openBinary_3_2
+#define ucol_openElements ucol_openElements_3_2
+#define ucol_openFromIdentifier ucol_openFromIdentifier_3_2
+#define ucol_openFromShortString ucol_openFromShortString_3_2
+#define ucol_openRules ucol_openRules_3_2
+#define ucol_open_internal ucol_open_internal_3_2
+#define ucol_previous ucol_previous_3_2
+#define ucol_primaryOrder ucol_primaryOrder_3_2
+#define ucol_prv_getSpecialCE ucol_prv_getSpecialCE_3_2
+#define ucol_prv_getSpecialPrevCE ucol_prv_getSpecialPrevCE_3_2
+#define ucol_reset ucol_reset_3_2
+#define ucol_restoreVariableTop ucol_restoreVariableTop_3_2
+#define ucol_safeClone ucol_safeClone_3_2
+#define ucol_secondaryOrder ucol_secondaryOrder_3_2
+#define ucol_setAttribute ucol_setAttribute_3_2
+#define ucol_setOffset ucol_setOffset_3_2
+#define ucol_setOptionsFromHeader ucol_setOptionsFromHeader_3_2
+#define ucol_setReqValidLocales ucol_setReqValidLocales_3_2
+#define ucol_setStrength ucol_setStrength_3_2
+#define ucol_setText ucol_setText_3_2
+#define ucol_setVariableTop ucol_setVariableTop_3_2
+#define ucol_shortStringToIdentifier ucol_shortStringToIdentifier_3_2
+#define ucol_sortKeyToString ucol_sortKeyToString_3_2
+#define ucol_strcoll ucol_strcoll_3_2
+#define ucol_strcollIter ucol_strcollIter_3_2
+#define ucol_swap ucol_swap_3_2
+#define ucol_swapBinary ucol_swapBinary_3_2
+#define ucol_swapInverseUCA ucol_swapInverseUCA_3_2
+#define ucol_tertiaryOrder ucol_tertiaryOrder_3_2
+#define ucol_tok_assembleTokenList ucol_tok_assembleTokenList_3_2
+#define ucol_tok_closeTokenList ucol_tok_closeTokenList_3_2
+#define ucol_tok_getNextArgument ucol_tok_getNextArgument_3_2
+#define ucol_tok_initTokenList ucol_tok_initTokenList_3_2
+#define ucol_tok_parseNextToken ucol_tok_parseNextToken_3_2
+#define ucol_updateInternalState ucol_updateInternalState_3_2
+#define ucurr_forLocale ucurr_forLocale_3_2
+#define ucurr_getDefaultFractionDigits ucurr_getDefaultFractionDigits_3_2
+#define ucurr_getName ucurr_getName_3_2
+#define ucurr_getRoundingIncrement ucurr_getRoundingIncrement_3_2
+#define ucurr_register ucurr_register_3_2
+#define ucurr_unregister ucurr_unregister_3_2
+#define udat_applyPattern udat_applyPattern_3_2
+#define udat_clone udat_clone_3_2
+#define udat_close udat_close_3_2
+#define udat_countAvailable udat_countAvailable_3_2
+#define udat_countSymbols udat_countSymbols_3_2
+#define udat_format udat_format_3_2
+#define udat_get2DigitYearStart udat_get2DigitYearStart_3_2
+#define udat_getAvailable udat_getAvailable_3_2
+#define udat_getCalendar udat_getCalendar_3_2
+#define udat_getLocaleByType udat_getLocaleByType_3_2
+#define udat_getNumberFormat udat_getNumberFormat_3_2
+#define udat_getSymbols udat_getSymbols_3_2
+#define udat_isLenient udat_isLenient_3_2
+#define udat_open udat_open_3_2
+#define udat_parse udat_parse_3_2
+#define udat_parseCalendar udat_parseCalendar_3_2
+#define udat_set2DigitYearStart udat_set2DigitYearStart_3_2
+#define udat_setCalendar udat_setCalendar_3_2
+#define udat_setLenient udat_setLenient_3_2
+#define udat_setNumberFormat udat_setNumberFormat_3_2
+#define udat_setSymbols udat_setSymbols_3_2
+#define udat_toPattern udat_toPattern_3_2
+#define udata_checkCommonData udata_checkCommonData_3_2
+#define udata_close udata_close_3_2
+#define udata_closeSwapper udata_closeSwapper_3_2
+#define udata_getHeaderSize udata_getHeaderSize_3_2
+#define udata_getInfo udata_getInfo_3_2
+#define udata_getInfoSize udata_getInfoSize_3_2
+#define udata_getLength udata_getLength_3_2
+#define udata_getMemory udata_getMemory_3_2
+#define udata_getRawMemory udata_getRawMemory_3_2
+#define udata_open udata_open_3_2
+#define udata_openChoice udata_openChoice_3_2
+#define udata_openSwapper udata_openSwapper_3_2
+#define udata_openSwapperForInputData udata_openSwapperForInputData_3_2
+#define udata_printError udata_printError_3_2
+#define udata_readInt16 udata_readInt16_3_2
+#define udata_readInt32 udata_readInt32_3_2
+#define udata_setAppData udata_setAppData_3_2
+#define udata_setCommonData udata_setCommonData_3_2
+#define udata_swapDataHeader udata_swapDataHeader_3_2
+#define udata_swapInvStringBlock udata_swapInvStringBlock_3_2
+#define uenum_close uenum_close_3_2
+#define uenum_count uenum_count_3_2
+#define uenum_next uenum_next_3_2
+#define uenum_nextDefault uenum_nextDefault_3_2
+#define uenum_openCharStringsEnumeration uenum_openCharStringsEnumeration_3_2
+#define uenum_openStringEnumeration uenum_openStringEnumeration_3_2
+#define uenum_reset uenum_reset_3_2
+#define uenum_unext uenum_unext_3_2
+#define uenum_unextDefault uenum_unextDefault_3_2
+#define ufile_close_translit ufile_close_translit_3_2
+#define ufile_fill_uchar_buffer ufile_fill_uchar_buffer_3_2
+#define ufile_flush_translit ufile_flush_translit_3_2
+#define ufile_getch ufile_getch_3_2
+#define ufile_getch32 ufile_getch32_3_2
+#define ufmt_64tou ufmt_64tou_3_2
+#define ufmt_defaultCPToUnicode ufmt_defaultCPToUnicode_3_2
+#define ufmt_digitvalue ufmt_digitvalue_3_2
+#define ufmt_isdigit ufmt_isdigit_3_2
+#define ufmt_ptou ufmt_ptou_3_2
+#define ufmt_uto64 ufmt_uto64_3_2
+#define ufmt_utop ufmt_utop_3_2
+#define uhash_close uhash_close_3_2
+#define uhash_compareCaselessUnicodeString uhash_compareCaselessUnicodeString_3_2
+#define uhash_compareChars uhash_compareChars_3_2
+#define uhash_compareIChars uhash_compareIChars_3_2
+#define uhash_compareLong uhash_compareLong_3_2
+#define uhash_compareUChars uhash_compareUChars_3_2
+#define uhash_compareUnicodeString uhash_compareUnicodeString_3_2
+#define uhash_count uhash_count_3_2
+#define uhash_deleteHashtable uhash_deleteHashtable_3_2
+#define uhash_deleteUVector uhash_deleteUVector_3_2
+#define uhash_deleteUnicodeString uhash_deleteUnicodeString_3_2
+#define uhash_find uhash_find_3_2
+#define uhash_freeBlock uhash_freeBlock_3_2
+#define uhash_get uhash_get_3_2
+#define uhash_geti uhash_geti_3_2
+#define uhash_hashCaselessUnicodeString uhash_hashCaselessUnicodeString_3_2
+#define uhash_hashChars uhash_hashChars_3_2
+#define uhash_hashIChars uhash_hashIChars_3_2
+#define uhash_hashLong uhash_hashLong_3_2
+#define uhash_hashUChars uhash_hashUChars_3_2
+#define uhash_hashUCharsN uhash_hashUCharsN_3_2
+#define uhash_hashUnicodeString uhash_hashUnicodeString_3_2
+#define uhash_iget uhash_iget_3_2
+#define uhash_igeti uhash_igeti_3_2
+#define uhash_iput uhash_iput_3_2
+#define uhash_iputi uhash_iputi_3_2
+#define uhash_iremove uhash_iremove_3_2
+#define uhash_iremovei uhash_iremovei_3_2
+#define uhash_nextElement uhash_nextElement_3_2
+#define uhash_open uhash_open_3_2
+#define uhash_openSize uhash_openSize_3_2
+#define uhash_put uhash_put_3_2
+#define uhash_puti uhash_puti_3_2
+#define uhash_remove uhash_remove_3_2
+#define uhash_removeAll uhash_removeAll_3_2
+#define uhash_removeElement uhash_removeElement_3_2
+#define uhash_removei uhash_removei_3_2
+#define uhash_setKeyComparator uhash_setKeyComparator_3_2
+#define uhash_setKeyDeleter uhash_setKeyDeleter_3_2
+#define uhash_setKeyHasher uhash_setKeyHasher_3_2
+#define uhash_setResizePolicy uhash_setResizePolicy_3_2
+#define uhash_setValueDeleter uhash_setValueDeleter_3_2
+#define uhash_toki uhash_toki_3_2
+#define uhash_tokp uhash_tokp_3_2
+#define uhst_addPropertyStarts uhst_addPropertyStarts_3_2
+#define uidna_IDNToASCII uidna_IDNToASCII_3_2
+#define uidna_IDNToUnicode uidna_IDNToUnicode_3_2
+#define uidna_compare uidna_compare_3_2
+#define uidna_toASCII uidna_toASCII_3_2
+#define uidna_toUnicode uidna_toUnicode_3_2
+#define uiter_current32 uiter_current32_3_2
+#define uiter_getState uiter_getState_3_2
+#define uiter_next32 uiter_next32_3_2
+#define uiter_previous32 uiter_previous32_3_2
+#define uiter_setCharacterIterator uiter_setCharacterIterator_3_2
+#define uiter_setReplaceable uiter_setReplaceable_3_2
+#define uiter_setState uiter_setState_3_2
+#define uiter_setString uiter_setString_3_2
+#define uiter_setUTF16BE uiter_setUTF16BE_3_2
+#define uiter_setUTF8 uiter_setUTF8_3_2
+#define uloc_acceptLanguage uloc_acceptLanguage_3_2
+#define uloc_acceptLanguageFromHTTP uloc_acceptLanguageFromHTTP_3_2
+#define uloc_canonicalize uloc_canonicalize_3_2
+#define uloc_countAvailable uloc_countAvailable_3_2
+#define uloc_getAvailable uloc_getAvailable_3_2
+#define uloc_getBaseName uloc_getBaseName_3_2
+#define uloc_getCountry uloc_getCountry_3_2
+#define uloc_getDefault uloc_getDefault_3_2
+#define uloc_getDisplayCountry uloc_getDisplayCountry_3_2
+#define uloc_getDisplayKeyword uloc_getDisplayKeyword_3_2
+#define uloc_getDisplayKeywordValue uloc_getDisplayKeywordValue_3_2
+#define uloc_getDisplayLanguage uloc_getDisplayLanguage_3_2
+#define uloc_getDisplayName uloc_getDisplayName_3_2
+#define uloc_getDisplayScript uloc_getDisplayScript_3_2
+#define uloc_getDisplayVariant uloc_getDisplayVariant_3_2
+#define uloc_getISO3Country uloc_getISO3Country_3_2
+#define uloc_getISO3Language uloc_getISO3Language_3_2
+#define uloc_getISOCountries uloc_getISOCountries_3_2
+#define uloc_getISOLanguages uloc_getISOLanguages_3_2
+#define uloc_getKeywordValue uloc_getKeywordValue_3_2
+#define uloc_getLCID uloc_getLCID_3_2
+#define uloc_getLanguage uloc_getLanguage_3_2
+#define uloc_getName uloc_getName_3_2
+#define uloc_getParent uloc_getParent_3_2
+#define uloc_getScript uloc_getScript_3_2
+#define uloc_getVariant uloc_getVariant_3_2
+#define uloc_openKeywordList uloc_openKeywordList_3_2
+#define uloc_openKeywords uloc_openKeywords_3_2
+#define uloc_setDefault uloc_setDefault_3_2
+#define uloc_setKeywordValue uloc_setKeywordValue_3_2
+#define ulocdata_getExemplarSet ulocdata_getExemplarSet_3_2
+#define ulocdata_getMeasurementSystem ulocdata_getMeasurementSystem_3_2
+#define ulocdata_getPaperSize ulocdata_getPaperSize_3_2
+#define umsg_applyPattern umsg_applyPattern_3_2
+#define umsg_clone umsg_clone_3_2
+#define umsg_close umsg_close_3_2
+#define umsg_format umsg_format_3_2
+#define umsg_getLocale umsg_getLocale_3_2
+#define umsg_getLocaleByType umsg_getLocaleByType_3_2
+#define umsg_open umsg_open_3_2
+#define umsg_parse umsg_parse_3_2
+#define umsg_setLocale umsg_setLocale_3_2
+#define umsg_toPattern umsg_toPattern_3_2
+#define umsg_vformat umsg_vformat_3_2
+#define umsg_vparse umsg_vparse_3_2
+#define umtx_atomic_dec umtx_atomic_dec_3_2
+#define umtx_atomic_inc umtx_atomic_inc_3_2
+#define umtx_cleanup umtx_cleanup_3_2
+#define umtx_destroy umtx_destroy_3_2
+#define umtx_init umtx_init_3_2
+#define umtx_lock umtx_lock_3_2
+#define umtx_unlock umtx_unlock_3_2
+#define unorm_addPropertyStarts unorm_addPropertyStarts_3_2
+#define unorm_closeIter unorm_closeIter_3_2
+#define unorm_compare unorm_compare_3_2
+#define unorm_compose unorm_compose_3_2
+#define unorm_concatenate unorm_concatenate_3_2
+#define unorm_decompose unorm_decompose_3_2
+#define unorm_getCanonStartSet unorm_getCanonStartSet_3_2
+#define unorm_getCanonicalDecomposition unorm_getCanonicalDecomposition_3_2
+#define unorm_getDecomposition unorm_getDecomposition_3_2
+#define unorm_getFCD16FromCodePoint unorm_getFCD16FromCodePoint_3_2
+#define unorm_getFCDTrie unorm_getFCDTrie_3_2
+#define unorm_getNX unorm_getNX_3_2
+#define unorm_getQuickCheck unorm_getQuickCheck_3_2
+#define unorm_getUnicodeVersion unorm_getUnicodeVersion_3_2
+#define unorm_haveData unorm_haveData_3_2
+#define unorm_internalIsFullCompositionExclusion unorm_internalIsFullCompositionExclusion_3_2
+#define unorm_internalNormalize unorm_internalNormalize_3_2
+#define unorm_internalNormalizeWithNX unorm_internalNormalizeWithNX_3_2
+#define unorm_internalQuickCheck unorm_internalQuickCheck_3_2
+#define unorm_isCanonSafeStart unorm_isCanonSafeStart_3_2
+#define unorm_isNFSkippable unorm_isNFSkippable_3_2
+#define unorm_isNormalized unorm_isNormalized_3_2
+#define unorm_isNormalizedWithOptions unorm_isNormalizedWithOptions_3_2
+#define unorm_next unorm_next_3_2
+#define unorm_normalize unorm_normalize_3_2
+#define unorm_openIter unorm_openIter_3_2
+#define unorm_previous unorm_previous_3_2
+#define unorm_quickCheck unorm_quickCheck_3_2
+#define unorm_quickCheckWithOptions unorm_quickCheckWithOptions_3_2
+#define unorm_setIter unorm_setIter_3_2
+#define unorm_swap unorm_swap_3_2
+#define unum_applyPattern unum_applyPattern_3_2
+#define unum_clone unum_clone_3_2
+#define unum_close unum_close_3_2
+#define unum_countAvailable unum_countAvailable_3_2
+#define unum_format unum_format_3_2
+#define unum_formatDouble unum_formatDouble_3_2
+#define unum_formatDoubleCurrency unum_formatDoubleCurrency_3_2
+#define unum_formatInt64 unum_formatInt64_3_2
+#define unum_getAttribute unum_getAttribute_3_2
+#define unum_getAvailable unum_getAvailable_3_2
+#define unum_getDoubleAttribute unum_getDoubleAttribute_3_2
+#define unum_getLocaleByType unum_getLocaleByType_3_2
+#define unum_getSymbol unum_getSymbol_3_2
+#define unum_getTextAttribute unum_getTextAttribute_3_2
+#define unum_open unum_open_3_2
+#define unum_parse unum_parse_3_2
+#define unum_parseDouble unum_parseDouble_3_2
+#define unum_parseDoubleCurrency unum_parseDoubleCurrency_3_2
+#define unum_parseInt64 unum_parseInt64_3_2
+#define unum_setAttribute unum_setAttribute_3_2
+#define unum_setDoubleAttribute unum_setDoubleAttribute_3_2
+#define unum_setSymbol unum_setSymbol_3_2
+#define unum_setTextAttribute unum_setTextAttribute_3_2
+#define unum_toPattern unum_toPattern_3_2
+#define upname_swap upname_swap_3_2
+#define uprops_getSource uprops_getSource_3_2
+#define uprops_swap uprops_swap_3_2
+#define uprv_asciiFromEbcdic uprv_asciiFromEbcdic_3_2
+#define uprv_asciitolower uprv_asciitolower_3_2
+#define uprv_ceil uprv_ceil_3_2
+#define uprv_cnttab_addContraction uprv_cnttab_addContraction_3_2
+#define uprv_cnttab_changeContraction uprv_cnttab_changeContraction_3_2
+#define uprv_cnttab_changeLastCE uprv_cnttab_changeLastCE_3_2
+#define uprv_cnttab_clone uprv_cnttab_clone_3_2
+#define uprv_cnttab_close uprv_cnttab_close_3_2
+#define uprv_cnttab_constructTable uprv_cnttab_constructTable_3_2
+#define uprv_cnttab_findCE uprv_cnttab_findCE_3_2
+#define uprv_cnttab_findCP uprv_cnttab_findCP_3_2
+#define uprv_cnttab_getCE uprv_cnttab_getCE_3_2
+#define uprv_cnttab_insertContraction uprv_cnttab_insertContraction_3_2
+#define uprv_cnttab_isTailored uprv_cnttab_isTailored_3_2
+#define uprv_cnttab_open uprv_cnttab_open_3_2
+#define uprv_cnttab_setContraction uprv_cnttab_setContraction_3_2
+#define uprv_compareASCIIPropertyNames uprv_compareASCIIPropertyNames_3_2
+#define uprv_compareEBCDICPropertyNames uprv_compareEBCDICPropertyNames_3_2
+#define uprv_compareInvAscii uprv_compareInvAscii_3_2
+#define uprv_compareInvEbcdic uprv_compareInvEbcdic_3_2
+#define uprv_convertToLCID uprv_convertToLCID_3_2
+#define uprv_convertToPosix uprv_convertToPosix_3_2
+#define uprv_copyAscii uprv_copyAscii_3_2
+#define uprv_copyEbcdic uprv_copyEbcdic_3_2
+#define uprv_dtostr uprv_dtostr_3_2
+#define uprv_ebcdicFromAscii uprv_ebcdicFromAscii_3_2
+#define uprv_ebcdictolower uprv_ebcdictolower_3_2
+#define uprv_fabs uprv_fabs_3_2
+#define uprv_floor uprv_floor_3_2
+#define uprv_fmax uprv_fmax_3_2
+#define uprv_fmin uprv_fmin_3_2
+#define uprv_fmod uprv_fmod_3_2
+#define uprv_free uprv_free_3_2
+#define uprv_getCharNameCharacters uprv_getCharNameCharacters_3_2
+#define uprv_getDefaultCodepage uprv_getDefaultCodepage_3_2
+#define uprv_getDefaultLocaleID uprv_getDefaultLocaleID_3_2
+#define uprv_getInfinity uprv_getInfinity_3_2
+#define uprv_getMaxCharNameLength uprv_getMaxCharNameLength_3_2
+#define uprv_getMaxValues uprv_getMaxValues_3_2
+#define uprv_getNaN uprv_getNaN_3_2
+#define uprv_getStaticCurrencyName uprv_getStaticCurrencyName_3_2
+#define uprv_getUTCtime uprv_getUTCtime_3_2
+#define uprv_haveProperties uprv_haveProperties_3_2
+#define uprv_init_collIterate uprv_init_collIterate_3_2
+#define uprv_int32Comparator uprv_int32Comparator_3_2
+#define uprv_isInfinite uprv_isInfinite_3_2
+#define uprv_isInvariantString uprv_isInvariantString_3_2
+#define uprv_isInvariantUString uprv_isInvariantUString_3_2
+#define uprv_isNaN uprv_isNaN_3_2
+#define uprv_isNegativeInfinity uprv_isNegativeInfinity_3_2
+#define uprv_isPositiveInfinity uprv_isPositiveInfinity_3_2
+#define uprv_isRuleWhiteSpace uprv_isRuleWhiteSpace_3_2
+#define uprv_itou uprv_itou_3_2
+#define uprv_loadPropsData uprv_loadPropsData_3_2
+#define uprv_log uprv_log_3_2
+#define uprv_log10 uprv_log10_3_2
+#define uprv_malloc uprv_malloc_3_2
+#define uprv_mapFile uprv_mapFile_3_2
+#define uprv_max uprv_max_3_2
+#define uprv_maxMantissa uprv_maxMantissa_3_2
+#define uprv_min uprv_min_3_2
+#define uprv_modf uprv_modf_3_2
+#define uprv_openRuleWhiteSpaceSet uprv_openRuleWhiteSpaceSet_3_2
+#define uprv_pathIsAbsolute uprv_pathIsAbsolute_3_2
+#define uprv_pow uprv_pow_3_2
+#define uprv_pow10 uprv_pow10_3_2
+#define uprv_realloc uprv_realloc_3_2
+#define uprv_round uprv_round_3_2
+#define uprv_sortArray uprv_sortArray_3_2
+#define uprv_strCompare uprv_strCompare_3_2
+#define uprv_strdup uprv_strdup_3_2
+#define uprv_strndup uprv_strndup_3_2
+#define uprv_syntaxError uprv_syntaxError_3_2
+#define uprv_timezone uprv_timezone_3_2
+#define uprv_toupper uprv_toupper_3_2
+#define uprv_trunc uprv_trunc_3_2
+#define uprv_tzname uprv_tzname_3_2
+#define uprv_tzset uprv_tzset_3_2
+#define uprv_uca_addAnElement uprv_uca_addAnElement_3_2
+#define uprv_uca_assembleTable uprv_uca_assembleTable_3_2
+#define uprv_uca_canonicalClosure uprv_uca_canonicalClosure_3_2
+#define uprv_uca_cloneTempTable uprv_uca_cloneTempTable_3_2
+#define uprv_uca_closeTempTable uprv_uca_closeTempTable_3_2
+#define uprv_uca_getCodePointFromRaw uprv_uca_getCodePointFromRaw_3_2
+#define uprv_uca_getImplicitFromRaw uprv_uca_getImplicitFromRaw_3_2
+#define uprv_uca_getImplicitPrimary uprv_uca_getImplicitPrimary_3_2
+#define uprv_uca_getRawFromCodePoint uprv_uca_getRawFromCodePoint_3_2
+#define uprv_uca_getRawFromImplicit uprv_uca_getRawFromImplicit_3_2
+#define uprv_uca_initImplicitConstants uprv_uca_initImplicitConstants_3_2
+#define uprv_uca_initTempTable uprv_uca_initTempTable_3_2
+#define uprv_uint16Comparator uprv_uint16Comparator_3_2
+#define uprv_uint32Comparator uprv_uint32Comparator_3_2
+#define uprv_unmapFile uprv_unmapFile_3_2
+#define uregex_appendReplacement uregex_appendReplacement_3_2
+#define uregex_appendTail uregex_appendTail_3_2
+#define uregex_clone uregex_clone_3_2
+#define uregex_close uregex_close_3_2
+#define uregex_end uregex_end_3_2
+#define uregex_find uregex_find_3_2
+#define uregex_findNext uregex_findNext_3_2
+#define uregex_flags uregex_flags_3_2
+#define uregex_getText uregex_getText_3_2
+#define uregex_group uregex_group_3_2
+#define uregex_groupCount uregex_groupCount_3_2
+#define uregex_lookingAt uregex_lookingAt_3_2
+#define uregex_matches uregex_matches_3_2
+#define uregex_open uregex_open_3_2
+#define uregex_openC uregex_openC_3_2
+#define uregex_pattern uregex_pattern_3_2
+#define uregex_replaceAll uregex_replaceAll_3_2
+#define uregex_replaceFirst uregex_replaceFirst_3_2
+#define uregex_reset uregex_reset_3_2
+#define uregex_setText uregex_setText_3_2
+#define uregex_split uregex_split_3_2
+#define uregex_start uregex_start_3_2
+#define ures_appendResPath ures_appendResPath_3_2
+#define ures_close ures_close_3_2
+#define ures_copyResb ures_copyResb_3_2
+#define ures_countArrayItems ures_countArrayItems_3_2
+#define ures_findResource ures_findResource_3_2
+#define ures_findSubResource ures_findSubResource_3_2
+#define ures_freeResPath ures_freeResPath_3_2
+#define ures_getBinary ures_getBinary_3_2
+#define ures_getByIndex ures_getByIndex_3_2
+#define ures_getByKey ures_getByKey_3_2
+#define ures_getByKeyWithFallback ures_getByKeyWithFallback_3_2
+#define ures_getFunctionalEquivalent ures_getFunctionalEquivalent_3_2
+#define ures_getInt ures_getInt_3_2
+#define ures_getIntVector ures_getIntVector_3_2
+#define ures_getKey ures_getKey_3_2
+#define ures_getKeywordValues ures_getKeywordValues_3_2
+#define ures_getLocale ures_getLocale_3_2
+#define ures_getLocaleByType ures_getLocaleByType_3_2
+#define ures_getName ures_getName_3_2
+#define ures_getNextResource ures_getNextResource_3_2
+#define ures_getNextString ures_getNextString_3_2
+#define ures_getPath ures_getPath_3_2
+#define ures_getSize ures_getSize_3_2
+#define ures_getString ures_getString_3_2
+#define ures_getStringByIndex ures_getStringByIndex_3_2
+#define ures_getStringByKey ures_getStringByKey_3_2
+#define ures_getType ures_getType_3_2
+#define ures_getUInt ures_getUInt_3_2
+#define ures_getVersion ures_getVersion_3_2
+#define ures_getVersionNumber ures_getVersionNumber_3_2
+#define ures_hasNext ures_hasNext_3_2
+#define ures_initStackObject ures_initStackObject_3_2
+#define ures_open ures_open_3_2
+#define ures_openAvailableLocales ures_openAvailableLocales_3_2
+#define ures_openDirect ures_openDirect_3_2
+#define ures_openFillIn ures_openFillIn_3_2
+#define ures_openU ures_openU_3_2
+#define ures_resetIterator ures_resetIterator_3_2
+#define ures_swap ures_swap_3_2
+#define uscript_closeRun uscript_closeRun_3_2
+#define uscript_getCode uscript_getCode_3_2
+#define uscript_getName uscript_getName_3_2
+#define uscript_getScript uscript_getScript_3_2
+#define uscript_getShortName uscript_getShortName_3_2
+#define uscript_nextRun uscript_nextRun_3_2
+#define uscript_openRun uscript_openRun_3_2
+#define uscript_resetRun uscript_resetRun_3_2
+#define uscript_setRunText uscript_setRunText_3_2
+#define usearch_close usearch_close_3_2
+#define usearch_first usearch_first_3_2
+#define usearch_following usearch_following_3_2
+#define usearch_getAttribute usearch_getAttribute_3_2
+#define usearch_getBreakIterator usearch_getBreakIterator_3_2
+#define usearch_getCollator usearch_getCollator_3_2
+#define usearch_getMatchedLength usearch_getMatchedLength_3_2
+#define usearch_getMatchedStart usearch_getMatchedStart_3_2
+#define usearch_getMatchedText usearch_getMatchedText_3_2
+#define usearch_getOffset usearch_getOffset_3_2
+#define usearch_getPattern usearch_getPattern_3_2
+#define usearch_getText usearch_getText_3_2
+#define usearch_handleNextCanonical usearch_handleNextCanonical_3_2
+#define usearch_handleNextExact usearch_handleNextExact_3_2
+#define usearch_handlePreviousCanonical usearch_handlePreviousCanonical_3_2
+#define usearch_handlePreviousExact usearch_handlePreviousExact_3_2
+#define usearch_last usearch_last_3_2
+#define usearch_next usearch_next_3_2
+#define usearch_open usearch_open_3_2
+#define usearch_openFromCollator usearch_openFromCollator_3_2
+#define usearch_preceding usearch_preceding_3_2
+#define usearch_previous usearch_previous_3_2
+#define usearch_reset usearch_reset_3_2
+#define usearch_setAttribute usearch_setAttribute_3_2
+#define usearch_setBreakIterator usearch_setBreakIterator_3_2
+#define usearch_setCollator usearch_setCollator_3_2
+#define usearch_setOffset usearch_setOffset_3_2
+#define usearch_setPattern usearch_setPattern_3_2
+#define usearch_setText usearch_setText_3_2
+#define userv_deleteStringPair userv_deleteStringPair_3_2
+#define uset_add uset_add_3_2
+#define uset_addAll uset_addAll_3_2
+#define uset_addRange uset_addRange_3_2
+#define uset_addString uset_addString_3_2
+#define uset_applyIntPropertyValue uset_applyIntPropertyValue_3_2
+#define uset_applyPattern uset_applyPattern_3_2
+#define uset_applyPropertyAlias uset_applyPropertyAlias_3_2
+#define uset_charAt uset_charAt_3_2
+#define uset_clear uset_clear_3_2
+#define uset_close uset_close_3_2
+#define uset_compact uset_compact_3_2
+#define uset_complement uset_complement_3_2
+#define uset_complementAll uset_complementAll_3_2
+#define uset_contains uset_contains_3_2
+#define uset_containsAll uset_containsAll_3_2
+#define uset_containsNone uset_containsNone_3_2
+#define uset_containsRange uset_containsRange_3_2
+#define uset_containsSome uset_containsSome_3_2
+#define uset_containsString uset_containsString_3_2
+#define uset_equals uset_equals_3_2
+#define uset_getItem uset_getItem_3_2
+#define uset_getItemCount uset_getItemCount_3_2
+#define uset_getSerializedRange uset_getSerializedRange_3_2
+#define uset_getSerializedRangeCount uset_getSerializedRangeCount_3_2
+#define uset_getSerializedSet uset_getSerializedSet_3_2
+#define uset_indexOf uset_indexOf_3_2
+#define uset_isEmpty uset_isEmpty_3_2
+#define uset_open uset_open_3_2
+#define uset_openPattern uset_openPattern_3_2
+#define uset_openPatternOptions uset_openPatternOptions_3_2
+#define uset_remove uset_remove_3_2
+#define uset_removeAll uset_removeAll_3_2
+#define uset_removeRange uset_removeRange_3_2
+#define uset_removeString uset_removeString_3_2
+#define uset_resemblesPattern uset_resemblesPattern_3_2
+#define uset_retain uset_retain_3_2
+#define uset_retainAll uset_retainAll_3_2
+#define uset_serialize uset_serialize_3_2
+#define uset_serializedContains uset_serializedContains_3_2
+#define uset_set uset_set_3_2
+#define uset_setSerializedToOne uset_setSerializedToOne_3_2
+#define uset_size uset_size_3_2
+#define uset_toPattern uset_toPattern_3_2
+#define usprep_close usprep_close_3_2
+#define usprep_open usprep_open_3_2
+#define usprep_prepare usprep_prepare_3_2
+#define usprep_swap usprep_swap_3_2
+#define ustr_foldCase ustr_foldCase_3_2
+#define ustr_toLower ustr_toLower_3_2
+#define ustr_toTitle ustr_toTitle_3_2
+#define ustr_toUpper ustr_toUpper_3_2
+#define utf8_appendCharSafeBody utf8_appendCharSafeBody_3_2
+#define utf8_back1SafeBody utf8_back1SafeBody_3_2
+#define utf8_countTrailBytes utf8_countTrailBytes_3_2
+#define utf8_nextCharSafeBody utf8_nextCharSafeBody_3_2
+#define utf8_prevCharSafeBody utf8_prevCharSafeBody_3_2
+#define utmscale_fromInt64 utmscale_fromInt64_3_2
+#define utmscale_getTimeScaleValue utmscale_getTimeScaleValue_3_2
+#define utmscale_toInt64 utmscale_toInt64_3_2
+#define utrace_cleanup utrace_cleanup_3_2
+#define utrace_data utrace_data_3_2
+#define utrace_entry utrace_entry_3_2
+#define utrace_exit utrace_exit_3_2
+#define utrace_format utrace_format_3_2
+#define utrace_functionName utrace_functionName_3_2
+#define utrace_getFunctions utrace_getFunctions_3_2
+#define utrace_getLevel utrace_getLevel_3_2
+#define utrace_level utrace_level_3_2
+#define utrace_setFunctions utrace_setFunctions_3_2
+#define utrace_setLevel utrace_setLevel_3_2
+#define utrace_vformat utrace_vformat_3_2
+#define utrans_clone utrans_clone_3_2
+#define utrans_close utrans_close_3_2
+#define utrans_countAvailableIDs utrans_countAvailableIDs_3_2
+#define utrans_getAvailableID utrans_getAvailableID_3_2
+#define utrans_getID utrans_getID_3_2
+#define utrans_getUnicodeID utrans_getUnicodeID_3_2
+#define utrans_open utrans_open_3_2
+#define utrans_openIDs utrans_openIDs_3_2
+#define utrans_openInverse utrans_openInverse_3_2
+#define utrans_openU utrans_openU_3_2
+#define utrans_register utrans_register_3_2
+#define utrans_rep_caseContextIterator utrans_rep_caseContextIterator_3_2
+#define utrans_setFilter utrans_setFilter_3_2
+#define utrans_trans utrans_trans_3_2
+#define utrans_transIncremental utrans_transIncremental_3_2
+#define utrans_transIncrementalUChars utrans_transIncrementalUChars_3_2
+#define utrans_transUChars utrans_transUChars_3_2
+#define utrans_unregister utrans_unregister_3_2
+#define utrans_unregisterID utrans_unregisterID_3_2
+#define utrie_clone utrie_clone_3_2
+#define utrie_close utrie_close_3_2
+#define utrie_enum utrie_enum_3_2
+#define utrie_get32 utrie_get32_3_2
+#define utrie_getData utrie_getData_3_2
+#define utrie_open utrie_open_3_2
+#define utrie_serialize utrie_serialize_3_2
+#define utrie_set32 utrie_set32_3_2
+#define utrie_setRange32 utrie_setRange32_3_2
+#define utrie_swap utrie_swap_3_2
+#define utrie_unserialize utrie_unserialize_3_2
+/* C++ class names renaming defines */
+
+#ifdef XP_CPLUSPLUS
+#if !U_HAVE_NAMESPACE
+
+#define AbsoluteValueSubstitution AbsoluteValueSubstitution_3_2
+#define AlternateSubstitutionSubtable AlternateSubstitutionSubtable_3_2
+#define AnchorTable AnchorTable_3_2
+#define AnyTransliterator AnyTransliterator_3_2
+#define ArabicOpenTypeLayoutEngine ArabicOpenTypeLayoutEngine_3_2
+#define ArabicShaping ArabicShaping_3_2
+#define BasicCalendarFactory BasicCalendarFactory_3_2
+#define BinarySearchLookupTable BinarySearchLookupTable_3_2
+#define BreakDictionary BreakDictionary_3_2
+#define BreakIterator BreakIterator_3_2
+#define BuddhistCalendar BuddhistCalendar_3_2
+#define CFactory CFactory_3_2
+#define Calendar Calendar_3_2
+#define CalendarAstronomer CalendarAstronomer_3_2
+#define CalendarCache CalendarCache_3_2
+#define CalendarData CalendarData_3_2
+#define CalendarService CalendarService_3_2
+#define CanonShaping CanonShaping_3_2
+#define CanonicalIterator CanonicalIterator_3_2
+#define CaseMapTransliterator CaseMapTransliterator_3_2
+#define ChainingContextualSubstitutionFormat1Subtable ChainingContextualSubstitutionFormat1Subtable_3_2
+#define ChainingContextualSubstitutionFormat2Subtable ChainingContextualSubstitutionFormat2Subtable_3_2
+#define ChainingContextualSubstitutionFormat3Subtable ChainingContextualSubstitutionFormat3Subtable_3_2
+#define ChainingContextualSubstitutionSubtable ChainingContextualSubstitutionSubtable_3_2
+#define CharSubstitutionFilter CharSubstitutionFilter_3_2
+#define CharacterIterator CharacterIterator_3_2
+#define ChoiceFormat ChoiceFormat_3_2
+#define ClassDefFormat1Table ClassDefFormat1Table_3_2
+#define ClassDefFormat2Table ClassDefFormat2Table_3_2
+#define ClassDefinitionTable ClassDefinitionTable_3_2
+#define CollationElementIterator CollationElementIterator_3_2
+#define CollationKey CollationKey_3_2
+#define Collator Collator_3_2
+#define CollatorFactory CollatorFactory_3_2
+#define CompoundTransliterator CompoundTransliterator_3_2
+#define ContextualGlyphSubstitutionProcessor ContextualGlyphSubstitutionProcessor_3_2
+#define ContextualSubstitutionBase ContextualSubstitutionBase_3_2
+#define ContextualSubstitutionFormat1Subtable ContextualSubstitutionFormat1Subtable_3_2
+#define ContextualSubstitutionFormat2Subtable ContextualSubstitutionFormat2Subtable_3_2
+#define ContextualSubstitutionFormat3Subtable ContextualSubstitutionFormat3Subtable_3_2
+#define ContextualSubstitutionSubtable ContextualSubstitutionSubtable_3_2
+#define CoverageFormat1Table CoverageFormat1Table_3_2
+#define CoverageFormat2Table CoverageFormat2Table_3_2
+#define CoverageTable CoverageTable_3_2
+#define CurrencyAmount CurrencyAmount_3_2
+#define CurrencyFormat CurrencyFormat_3_2
+#define CurrencyUnit CurrencyUnit_3_2
+#define CursiveAttachmentSubtable CursiveAttachmentSubtable_3_2
+#define DateFormat DateFormat_3_2
+#define DateFormatSymbols DateFormatSymbols_3_2
+#define DecimalFormat DecimalFormat_3_2
+#define DecimalFormatSymbols DecimalFormatSymbols_3_2
+#define DefaultCalendarFactory DefaultCalendarFactory_3_2
+#define DefaultCharMapper DefaultCharMapper_3_2
+#define DeviceTable DeviceTable_3_2
+#define DictionaryBasedBreakIterator DictionaryBasedBreakIterator_3_2
+#define DictionaryBasedBreakIteratorTables DictionaryBasedBreakIteratorTables_3_2
+#define DigitList DigitList_3_2
+#define Entry Entry_3_2
+#define EnumToOffset EnumToOffset_3_2
+#define EscapeTransliterator EscapeTransliterator_3_2
+#define EventListener EventListener_3_2
+#define ExtensionSubtable ExtensionSubtable_3_2
+#define FeatureListTable FeatureListTable_3_2
+#define FieldPosition FieldPosition_3_2
+#define FontRuns FontRuns_3_2
+#define Format Format_3_2
+#define Format1AnchorTable Format1AnchorTable_3_2
+#define Format2AnchorTable Format2AnchorTable_3_2
+#define Format3AnchorTable Format3AnchorTable_3_2
+#define Formattable Formattable_3_2
+#define ForwardCharacterIterator ForwardCharacterIterator_3_2
+#define FractionalPartSubstitution FractionalPartSubstitution_3_2
+#define FunctionReplacer FunctionReplacer_3_2
+#define GDEFMarkFilter GDEFMarkFilter_3_2
+#define GXLayoutEngine GXLayoutEngine_3_2
+#define GlyphDefinitionTableHeader GlyphDefinitionTableHeader_3_2
+#define GlyphIterator GlyphIterator_3_2
+#define GlyphLookupTableHeader GlyphLookupTableHeader_3_2
+#define GlyphPositioningLookupProcessor GlyphPositioningLookupProcessor_3_2
+#define GlyphPositioningTableHeader GlyphPositioningTableHeader_3_2
+#define GlyphSubstitutionLookupProcessor GlyphSubstitutionLookupProcessor_3_2
+#define GlyphSubstitutionTableHeader GlyphSubstitutionTableHeader_3_2
+#define Grego Grego_3_2
+#define GregorianCalendar GregorianCalendar_3_2
+#define HanOpenTypeLayoutEngine HanOpenTypeLayoutEngine_3_2
+#define HebrewCalendar HebrewCalendar_3_2
+#define ICUBreakIteratorFactory ICUBreakIteratorFactory_3_2
+#define ICUBreakIteratorService ICUBreakIteratorService_3_2
+#define ICUCollatorFactory ICUCollatorFactory_3_2
+#define ICUCollatorService ICUCollatorService_3_2
+#define ICULayoutEngine ICULayoutEngine_3_2
+#define ICULocaleService ICULocaleService_3_2
+#define ICUNotifier ICUNotifier_3_2
+#define ICUNumberFormatFactory ICUNumberFormatFactory_3_2
+#define ICUNumberFormatService ICUNumberFormatService_3_2
+#define ICUResourceBundleFactory ICUResourceBundleFactory_3_2
+#define ICUService ICUService_3_2
+#define ICUServiceFactory ICUServiceFactory_3_2
+#define ICUServiceKey ICUServiceKey_3_2
+#define ICU_Utility ICU_Utility_3_2
+#define IndicClassTable IndicClassTable_3_2
+#define IndicOpenTypeLayoutEngine IndicOpenTypeLayoutEngine_3_2
+#define IndicRearrangementProcessor IndicRearrangementProcessor_3_2
+#define IndicReordering IndicReordering_3_2
+#define IntegralPartSubstitution IntegralPartSubstitution_3_2
+#define IslamicCalendar IslamicCalendar_3_2
+#define JapaneseCalendar JapaneseCalendar_3_2
+#define KeywordEnumeration KeywordEnumeration_3_2
+#define LECharMapper LECharMapper_3_2
+#define LEFontInstance LEFontInstance_3_2
+#define LEGlyphFilter LEGlyphFilter_3_2
+#define LEGlyphStorage LEGlyphStorage_3_2
+#define LEInsertionCallback LEInsertionCallback_3_2
+#define LEInsertionList LEInsertionList_3_2
+#define LXUtilities LXUtilities_3_2
+#define LayoutEngine LayoutEngine_3_2
+#define LigatureSubstitutionProcessor LigatureSubstitutionProcessor_3_2
+#define LigatureSubstitutionSubtable LigatureSubstitutionSubtable_3_2
+#define LocDataParser LocDataParser_3_2
+#define Locale Locale_3_2
+#define LocaleBased LocaleBased_3_2
+#define LocaleKey LocaleKey_3_2
+#define LocaleKeyFactory LocaleKeyFactory_3_2
+#define LocaleRuns LocaleRuns_3_2
+#define LocaleUtility LocaleUtility_3_2
+#define LocalizationInfo LocalizationInfo_3_2
+#define LookupListTable LookupListTable_3_2
+#define LookupProcessor LookupProcessor_3_2
+#define LookupSubtable LookupSubtable_3_2
+#define LookupTable LookupTable_3_2
+#define LowercaseTransliterator LowercaseTransliterator_3_2
+#define MPreFixups MPreFixups_3_2
+#define MarkArray MarkArray_3_2
+#define MarkToBasePositioningSubtable MarkToBasePositioningSubtable_3_2
+#define MarkToLigaturePositioningSubtable MarkToLigaturePositioningSubtable_3_2
+#define MarkToMarkPositioningSubtable MarkToMarkPositioningSubtable_3_2
+#define Math Math_3_2
+#define Measure Measure_3_2
+#define MeasureFormat MeasureFormat_3_2
+#define MeasureUnit MeasureUnit_3_2
+#define MessageFormat MessageFormat_3_2
+#define MessageFormatAdapter MessageFormatAdapter_3_2
+#define ModulusSubstitution ModulusSubstitution_3_2
+#define MoonRiseSetCoordFunc MoonRiseSetCoordFunc_3_2
+#define MoonTimeAngleFunc MoonTimeAngleFunc_3_2
+#define MorphSubtableHeader MorphSubtableHeader_3_2
+#define MorphTableHeader MorphTableHeader_3_2
+#define MultipleSubstitutionSubtable MultipleSubstitutionSubtable_3_2
+#define MultiplierSubstitution MultiplierSubstitution_3_2
+#define NFFactory NFFactory_3_2
+#define NFRule NFRule_3_2
+#define NFRuleSet NFRuleSet_3_2
+#define NFSubstitution NFSubstitution_3_2
+#define NameToEnum NameToEnum_3_2
+#define NameUnicodeTransliterator NameUnicodeTransliterator_3_2
+#define NonContextualGlyphSubstitutionProcessor NonContextualGlyphSubstitutionProcessor_3_2
+#define NonContiguousEnumToOffset NonContiguousEnumToOffset_3_2
+#define NormalizationTransliterator NormalizationTransliterator_3_2
+#define Normalizer Normalizer_3_2
+#define NullSubstitution NullSubstitution_3_2
+#define NullTransliterator NullTransliterator_3_2
+#define NumberFormat NumberFormat_3_2
+#define NumberFormatFactory NumberFormatFactory_3_2
+#define NumeratorSubstitution NumeratorSubstitution_3_2
+#define OlsonTimeZone OlsonTimeZone_3_2
+#define OpenTypeLayoutEngine OpenTypeLayoutEngine_3_2
+#define OpenTypeUtilities OpenTypeUtilities_3_2
+#define PairPositioningFormat1Subtable PairPositioningFormat1Subtable_3_2
+#define PairPositioningFormat2Subtable PairPositioningFormat2Subtable_3_2
+#define PairPositioningSubtable PairPositioningSubtable_3_2
+#define ParagraphLayout ParagraphLayout_3_2
+#define ParseData ParseData_3_2
+#define ParsePosition ParsePosition_3_2
+#define PropertyAliases PropertyAliases_3_2
+#define Quantifier Quantifier_3_2
+#define RBBIDataWrapper RBBIDataWrapper_3_2
+#define RBBINode RBBINode_3_2
+#define RBBIRuleBuilder RBBIRuleBuilder_3_2
+#define RBBIRuleScanner RBBIRuleScanner_3_2
+#define RBBISetBuilder RBBISetBuilder_3_2
+#define RBBIStateDescriptor RBBIStateDescriptor_3_2
+#define RBBISymbolTable RBBISymbolTable_3_2
+#define RBBISymbolTableEntry RBBISymbolTableEntry_3_2
+#define RBBITableBuilder RBBITableBuilder_3_2
+#define RangeDescriptor RangeDescriptor_3_2
+#define RegexCompile RegexCompile_3_2
+#define RegexMatcher RegexMatcher_3_2
+#define RegexPattern RegexPattern_3_2
+#define RegexStaticSets RegexStaticSets_3_2
+#define RemoveTransliterator RemoveTransliterator_3_2
+#define Replaceable Replaceable_3_2
+#define ReplaceableGlue ReplaceableGlue_3_2
+#define ResourceBundle ResourceBundle_3_2
+#define RiseSetCoordFunc RiseSetCoordFunc_3_2
+#define RuleBasedBreakIterator RuleBasedBreakIterator_3_2
+#define RuleBasedCollator RuleBasedCollator_3_2
+#define RuleBasedNumberFormat RuleBasedNumberFormat_3_2
+#define RuleBasedTransliterator RuleBasedTransliterator_3_2
+#define RuleCharacterIterator RuleCharacterIterator_3_2
+#define RuleHalf RuleHalf_3_2
+#define RunArray RunArray_3_2
+#define SameValueSubstitution SameValueSubstitution_3_2
+#define ScriptListTable ScriptListTable_3_2
+#define ScriptRunIterator ScriptRunIterator_3_2
+#define ScriptTable ScriptTable_3_2
+#define SearchIterator SearchIterator_3_2
+#define SegmentArrayProcessor SegmentArrayProcessor_3_2
+#define SegmentSingleProcessor SegmentSingleProcessor_3_2
+#define ServiceEnumeration ServiceEnumeration_3_2
+#define ServiceListener ServiceListener_3_2
+#define SimpleArrayProcessor SimpleArrayProcessor_3_2
+#define SimpleDateFormat SimpleDateFormat_3_2
+#define SimpleFactory SimpleFactory_3_2
+#define SimpleLocaleKeyFactory SimpleLocaleKeyFactory_3_2
+#define SimpleNumberFormatFactory SimpleNumberFormatFactory_3_2
+#define SimpleTimeZone SimpleTimeZone_3_2
+#define SinglePositioningFormat1Subtable SinglePositioningFormat1Subtable_3_2
+#define SinglePositioningFormat2Subtable SinglePositioningFormat2Subtable_3_2
+#define SinglePositioningSubtable SinglePositioningSubtable_3_2
+#define SingleSubstitutionFormat1Subtable SingleSubstitutionFormat1Subtable_3_2
+#define SingleSubstitutionFormat2Subtable SingleSubstitutionFormat2Subtable_3_2
+#define SingleSubstitutionSubtable SingleSubstitutionSubtable_3_2
+#define SingleTableProcessor SingleTableProcessor_3_2
+#define Spec Spec_3_2
+#define StateTableProcessor StateTableProcessor_3_2
+#define StringCharacterIterator StringCharacterIterator_3_2
+#define StringEnumeration StringEnumeration_3_2
+#define StringLocalizationInfo StringLocalizationInfo_3_2
+#define StringMatcher StringMatcher_3_2
+#define StringPair StringPair_3_2
+#define StringReplacer StringReplacer_3_2
+#define StringSearch StringSearch_3_2
+#define StyleRuns StyleRuns_3_2
+#define SubstitutionLookup SubstitutionLookup_3_2
+#define SubtableProcessor SubtableProcessor_3_2
+#define SunTimeAngleFunc SunTimeAngleFunc_3_2
+#define SymbolTable SymbolTable_3_2
+#define TZEnumeration TZEnumeration_3_2
+#define ThaiLayoutEngine ThaiLayoutEngine_3_2
+#define ThaiShaping ThaiShaping_3_2
+#define TimeZone TimeZone_3_2
+#define TitlecaseTransliterator TitlecaseTransliterator_3_2
+#define TransliterationRule TransliterationRule_3_2
+#define TransliterationRuleData TransliterationRuleData_3_2
+#define TransliterationRuleSet TransliterationRuleSet_3_2
+#define Transliterator Transliterator_3_2
+#define TransliteratorAlias TransliteratorAlias_3_2
+#define TransliteratorIDParser TransliteratorIDParser_3_2
+#define TransliteratorParser TransliteratorParser_3_2
+#define TransliteratorRegistry TransliteratorRegistry_3_2
+#define TrimmedArrayProcessor TrimmedArrayProcessor_3_2
+#define UCharCharacterIterator UCharCharacterIterator_3_2
+#define UMemory UMemory_3_2
+#define UObject UObject_3_2
+#define UStack UStack_3_2
+#define UStringEnumeration UStringEnumeration_3_2
+#define UVector UVector_3_2
+#define UVector32 UVector32_3_2
+#define UnescapeTransliterator UnescapeTransliterator_3_2
+#define UnicodeArabicOpenTypeLayoutEngine UnicodeArabicOpenTypeLayoutEngine_3_2
+#define UnicodeFilter UnicodeFilter_3_2
+#define UnicodeFunctor UnicodeFunctor_3_2
+#define UnicodeMatcher UnicodeMatcher_3_2
+#define UnicodeNameTransliterator UnicodeNameTransliterator_3_2
+#define UnicodeReplacer UnicodeReplacer_3_2
+#define UnicodeSet UnicodeSet_3_2
+#define UnicodeSetIterator UnicodeSetIterator_3_2
+#define UnicodeString UnicodeString_3_2
+#define UppercaseTransliterator UppercaseTransliterator_3_2
+#define ValueRecord ValueRecord_3_2
+#define ValueRuns ValueRuns_3_2
+#define locale_set_default_internal locale_set_default_internal_3_2
+#define uprv_parseCurrency uprv_parseCurrency_3_2
+#define util64_fromDouble util64_fromDouble_3_2
+#define util64_pow util64_pow_3_2
+#define util64_tou util64_tou_3_2
+#define util64_utoi util64_utoi_3_2
+
+#endif
+#endif
+
+#endif
+
+#endif
diff --git a/Source/JavaScriptCore/icu/unicode/uset.h b/Source/JavaScriptCore/icu/unicode/uset.h
new file mode 100644
index 0000000..b82ceb8
--- /dev/null
+++ b/Source/JavaScriptCore/icu/unicode/uset.h
@@ -0,0 +1,745 @@
+/*
+*******************************************************************************
+*
+* Copyright (C) 2002-2004, International Business Machines
+* Corporation and others. All Rights Reserved.
+*
+*******************************************************************************
+* file name: uset.h
+* encoding: US-ASCII
+* tab size: 8 (not used)
+* indentation:4
+*
+* created on: 2002mar07
+* created by: Markus W. Scherer
+*
+* C version of UnicodeSet.
+*/
+
+
+/**
+ * \file
+ * \brief C API: Unicode Set
+ *
+ * <p>This is a C wrapper around the C++ UnicodeSet class.</p>
+ */
+
+#ifndef __USET_H__
+#define __USET_H__
+
+#include "unicode/utypes.h"
+#include "unicode/uchar.h"
+
+#ifndef UCNV_H
+struct USet;
+/**
+ * A UnicodeSet. Use the uset_* API to manipulate. Create with
+ * uset_open*, and destroy with uset_close.
+ * @stable ICU 2.4
+ */
+typedef struct USet USet;
+#endif
+
+/**
+ * Bitmask values to be passed to uset_openPatternOptions() or
+ * uset_applyPattern() taking an option parameter.
+ * @stable ICU 2.4
+ */
+enum {
+ /**
+ * Ignore white space within patterns unless quoted or escaped.
+ * @stable ICU 2.4
+ */
+ USET_IGNORE_SPACE = 1,
+
+ /**
+ * Enable case insensitive matching. E.g., "[ab]" with this flag
+ * will match 'a', 'A', 'b', and 'B'. "[^ab]" with this flag will
+ * match all except 'a', 'A', 'b', and 'B'. This performs a full
+ * closure over case mappings, e.g. U+017F for s.
+ * @stable ICU 2.4
+ */
+ USET_CASE_INSENSITIVE = 2,
+
+ /**
+ * Bitmask for UnicodeSet::closeOver() indicating letter case.
+ * This may be ORed together with other selectors.
+ * @internal
+ */
+ USET_CASE = 2,
+
+ /**
+ * Enable case insensitive matching. E.g., "[ab]" with this flag
+ * will match 'a', 'A', 'b', and 'B'. "[^ab]" with this flag will
+ * match all except 'a', 'A', 'b', and 'B'. This adds the lower-,
+ * title-, and uppercase mappings as well as the case folding
+ * of each existing element in the set.
+ * @draft ICU 3.2
+ */
+ USET_ADD_CASE_MAPPINGS = 4,
+
+ /**
+ * Enough for any single-code point set
+ * @internal
+ */
+ USET_SERIALIZED_STATIC_ARRAY_CAPACITY=8
+};
+
+/**
+ * A serialized form of a Unicode set. Limited manipulations are
+ * possible directly on a serialized set. See below.
+ * @stable ICU 2.4
+ */
+typedef struct USerializedSet {
+ /**
+ * The serialized Unicode Set.
+ * @stable ICU 2.4
+ */
+ const uint16_t *array;
+ /**
+ * The length of the array that contains BMP characters.
+ * @stable ICU 2.4
+ */
+ int32_t bmpLength;
+ /**
+ * The total length of the array.
+ * @stable ICU 2.4
+ */
+ int32_t length;
+ /**
+ * A small buffer for the array to reduce memory allocations.
+ * @stable ICU 2.4
+ */
+ uint16_t staticArray[USET_SERIALIZED_STATIC_ARRAY_CAPACITY];
+} USerializedSet;
+
+/*********************************************************************
+ * USet API
+ *********************************************************************/
+
+/**
+ * Creates a USet object that contains the range of characters
+ * start..end, inclusive.
+ * @param start first character of the range, inclusive
+ * @param end last character of the range, inclusive
+ * @return a newly created USet. The caller must call uset_close() on
+ * it when done.
+ * @stable ICU 2.4
+ */
+U_STABLE USet* U_EXPORT2
+uset_open(UChar32 start, UChar32 end);
+
+/**
+ * Creates a set from the given pattern. See the UnicodeSet class
+ * description for the syntax of the pattern language.
+ * @param pattern a string specifying what characters are in the set
+ * @param patternLength the length of the pattern, or -1 if null
+ * terminated
+ * @param ec the error code
+ * @stable ICU 2.4
+ */
+U_STABLE USet* U_EXPORT2
+uset_openPattern(const UChar* pattern, int32_t patternLength,
+ UErrorCode* ec);
+
+/**
+ * Creates a set from the given pattern. See the UnicodeSet class
+ * description for the syntax of the pattern language.
+ * @param pattern a string specifying what characters are in the set
+ * @param patternLength the length of the pattern, or -1 if null
+ * terminated
+ * @param options bitmask for options to apply to the pattern.
+ * Valid options are USET_IGNORE_SPACE and USET_CASE_INSENSITIVE.
+ * @param ec the error code
+ * @stable ICU 2.4
+ */
+U_STABLE USet* U_EXPORT2
+uset_openPatternOptions(const UChar* pattern, int32_t patternLength,
+ uint32_t options,
+ UErrorCode* ec);
+
+/**
+ * Disposes of the storage used by a USet object. This function should
+ * be called exactly once for objects returned by uset_open().
+ * @param set the object to dispose of
+ * @stable ICU 2.4
+ */
+U_STABLE void U_EXPORT2
+uset_close(USet* set);
+
+/**
+ * Causes the USet object to represent the range <code>start - end</code>.
+ * If <code>start > end</code> then this USet is set to an empty range.
+ * @param set the object to set to the given range
+ * @param start first character in the set, inclusive
+ * @param end last character in the set, inclusive
+ * @draft ICU 3.2
+ */
+U_DRAFT void U_EXPORT2
+uset_set(USet* set,
+ UChar32 start, UChar32 end);
+
+/**
+ * Modifies the set to represent the set specified by the given
+ * pattern. See the UnicodeSet class description for the syntax of
+ * the pattern language. See also the User Guide chapter about UnicodeSet.
+ * <em>Empties the set passed before applying the pattern.</em>
+ * @param set The set to which the pattern is to be applied.
+ * @param pattern A pointer to UChar string specifying what characters are in the set.
+ * The character at pattern[0] must be a '['.
+ * @param patternLength The length of the UChar string. -1 if NUL terminated.
+ * @param options A bitmask for options to apply to the pattern.
+ * Valid options are USET_IGNORE_SPACE and USET_CASE_INSENSITIVE.
+ * @param status Returns an error if the pattern cannot be parsed.
+ * @return Upon successful parse, the value is either
+ * the index of the character after the closing ']'
+ * of the parsed pattern.
+ * If the status code indicates failure, then the return value
+ * is the index of the error in the source.
+ *
+ * @draft ICU 2.8
+ */
+U_DRAFT int32_t U_EXPORT2
+uset_applyPattern(USet *set,
+ const UChar *pattern, int32_t patternLength,
+ uint32_t options,
+ UErrorCode *status);
+
+/**
+ * Modifies the set to contain those code points which have the given value
+ * for the given binary or enumerated property, as returned by
+ * u_getIntPropertyValue. Prior contents of this set are lost.
+ *
+ * @param set the object to contain the code points defined by the property
+ *
+ * @param prop a property in the range UCHAR_BIN_START..UCHAR_BIN_LIMIT-1
+ * or UCHAR_INT_START..UCHAR_INT_LIMIT-1
+ * or UCHAR_MASK_START..UCHAR_MASK_LIMIT-1.
+ *
+ * @param value a value in the range u_getIntPropertyMinValue(prop)..
+ * u_getIntPropertyMaxValue(prop), with one exception. If prop is
+ * UCHAR_GENERAL_CATEGORY_MASK, then value should not be a UCharCategory, but
+ * rather a mask value produced by U_GET_GC_MASK(). This allows grouped
+ * categories such as [:L:] to be represented.
+ *
+ * @param ec error code input/output parameter
+ *
+ * @draft ICU 3.2
+ */
+U_DRAFT void U_EXPORT2
+uset_applyIntPropertyValue(USet* set,
+ UProperty prop, int32_t value, UErrorCode* ec);
+
+/**
+ * Modifies the set to contain those code points which have the
+ * given value for the given property. Prior contents of this
+ * set are lost.
+ *
+ * @param set the object to contain the code points defined by the given
+ * property and value alias
+ *
+ * @param prop a string specifying a property alias, either short or long.
+ * The name is matched loosely. See PropertyAliases.txt for names and a
+ * description of loose matching. If the value string is empty, then this
+ * string is interpreted as either a General_Category value alias, a Script
+ * value alias, a binary property alias, or a special ID. Special IDs are
+ * matched loosely and correspond to the following sets:
+ *
+ * "ANY" = [\\u0000-\\U0010FFFF],
+ * "ASCII" = [\\u0000-\\u007F].
+ *
+ * @param propLength the length of the prop, or -1 if NULL
+ *
+ * @param value a string specifying a value alias, either short or long.
+ * The name is matched loosely. See PropertyValueAliases.txt for names
+ * and a description of loose matching. In addition to aliases listed,
+ * numeric values and canonical combining classes may be expressed
+ * numerically, e.g., ("nv", "0.5") or ("ccc", "220"). The value string
+ * may also be empty.
+ *
+ * @param valueLength the length of the value, or -1 if NULL
+ *
+ * @param ec error code input/output parameter
+ *
+ * @draft ICU 3.2
+ */
+U_DRAFT void U_EXPORT2
+uset_applyPropertyAlias(USet* set,
+ const UChar *prop, int32_t propLength,
+ const UChar *value, int32_t valueLength,
+ UErrorCode* ec);
+
+/**
+ * Return true if the given position, in the given pattern, appears
+ * to be the start of a UnicodeSet pattern.
+ *
+ * @param pattern a string specifying the pattern
+ * @param patternLength the length of the pattern, or -1 if NULL
+ * @param pos the given position
+ * @draft ICU 3.2
+ */
+U_DRAFT UBool U_EXPORT2
+uset_resemblesPattern(const UChar *pattern, int32_t patternLength,
+ int32_t pos);
+
+/**
+ * Returns a string representation of this set. If the result of
+ * calling this function is passed to a uset_openPattern(), it
+ * will produce another set that is equal to this one.
+ * @param set the set
+ * @param result the string to receive the rules, may be NULL
+ * @param resultCapacity the capacity of result, may be 0 if result is NULL
+ * @param escapeUnprintable if TRUE then convert unprintable
+ * character to their hex escape representations, \\uxxxx or
+ * \\Uxxxxxxxx. Unprintable characters are those other than
+ * U+000A, U+0020..U+007E.
+ * @param ec error code.
+ * @return length of string, possibly larger than resultCapacity
+ * @stable ICU 2.4
+ */
+U_STABLE int32_t U_EXPORT2
+uset_toPattern(const USet* set,
+ UChar* result, int32_t resultCapacity,
+ UBool escapeUnprintable,
+ UErrorCode* ec);
+
+/**
+ * Adds the given character to the given USet. After this call,
+ * uset_contains(set, c) will return TRUE.
+ * @param set the object to which to add the character
+ * @param c the character to add
+ * @stable ICU 2.4
+ */
+U_STABLE void U_EXPORT2
+uset_add(USet* set, UChar32 c);
+
+/**
+ * Adds all of the elements in the specified set to this set if
+ * they're not already present. This operation effectively
+ * modifies this set so that its value is the <i>union</i> of the two
+ * sets. The behavior of this operation is unspecified if the specified
+ * collection is modified while the operation is in progress.
+ *
+ * @param set the object to which to add the set
+ * @param additionalSet the source set whose elements are to be added to this set.
+ * @stable ICU 2.6
+ */
+U_STABLE void U_EXPORT2
+uset_addAll(USet* set, const USet *additionalSet);
+
+/**
+ * Adds the given range of characters to the given USet. After this call,
+ * uset_contains(set, start, end) will return TRUE.
+ * @param set the object to which to add the character
+ * @param start the first character of the range to add, inclusive
+ * @param end the last character of the range to add, inclusive
+ * @stable ICU 2.2
+ */
+U_STABLE void U_EXPORT2
+uset_addRange(USet* set, UChar32 start, UChar32 end);
+
+/**
+ * Adds the given string to the given USet. After this call,
+ * uset_containsString(set, str, strLen) will return TRUE.
+ * @param set the object to which to add the character
+ * @param str the string to add
+ * @param strLen the length of the string or -1 if null terminated.
+ * @stable ICU 2.4
+ */
+U_STABLE void U_EXPORT2
+uset_addString(USet* set, const UChar* str, int32_t strLen);
+
+/**
+ * Removes the given character from the given USet. After this call,
+ * uset_contains(set, c) will return FALSE.
+ * @param set the object from which to remove the character
+ * @param c the character to remove
+ * @stable ICU 2.4
+ */
+U_STABLE void U_EXPORT2
+uset_remove(USet* set, UChar32 c);
+
+/**
+ * Removes the given range of characters from the given USet. After this call,
+ * uset_contains(set, start, end) will return FALSE.
+ * @param set the object to which to add the character
+ * @param start the first character of the range to remove, inclusive
+ * @param end the last character of the range to remove, inclusive
+ * @stable ICU 2.2
+ */
+U_STABLE void U_EXPORT2
+uset_removeRange(USet* set, UChar32 start, UChar32 end);
+
+/**
+ * Removes the given string to the given USet. After this call,
+ * uset_containsString(set, str, strLen) will return FALSE.
+ * @param set the object to which to add the character
+ * @param str the string to remove
+ * @param strLen the length of the string or -1 if null terminated.
+ * @stable ICU 2.4
+ */
+U_STABLE void U_EXPORT2
+uset_removeString(USet* set, const UChar* str, int32_t strLen);
+
+/**
+ * Removes from this set all of its elements that are contained in the
+ * specified set. This operation effectively modifies this
+ * set so that its value is the <i>asymmetric set difference</i> of
+ * the two sets.
+ * @param set the object from which the elements are to be removed
+ * @param removeSet the object that defines which elements will be
+ * removed from this set
+ * @draft ICU 3.2
+ */
+U_DRAFT void U_EXPORT2
+uset_removeAll(USet* set, const USet* removeSet);
+
+/**
+ * Retain only the elements in this set that are contained in the
+ * specified range. If <code>start > end</code> then an empty range is
+ * retained, leaving the set empty. This is equivalent to
+ * a boolean logic AND, or a set INTERSECTION.
+ *
+ * @param set the object for which to retain only the specified range
+ * @param start first character, inclusive, of range to be retained
+ * to this set.
+ * @param end last character, inclusive, of range to be retained
+ * to this set.
+ * @draft ICU 3.2
+ */
+U_DRAFT void U_EXPORT2
+uset_retain(USet* set, UChar32 start, UChar32 end);
+
+/**
+ * Retains only the elements in this set that are contained in the
+ * specified set. In other words, removes from this set all of
+ * its elements that are not contained in the specified set. This
+ * operation effectively modifies this set so that its value is
+ * the <i>intersection</i> of the two sets.
+ *
+ * @param set the object on which to perform the retain
+ * @param retain set that defines which elements this set will retain
+ * @draft ICU 3.2
+ */
+U_DRAFT void U_EXPORT2
+uset_retainAll(USet* set, const USet* retain);
+
+/**
+ * Reallocate this objects internal structures to take up the least
+ * possible space, without changing this object's value.
+ *
+ * @param set the object on which to perfrom the compact
+ * @draft ICU 3.2
+ */
+U_DRAFT void U_EXPORT2
+uset_compact(USet* set);
+
+/**
+ * Inverts this set. This operation modifies this set so that
+ * its value is its complement. This operation does not affect
+ * the multicharacter strings, if any.
+ * @param set the set
+ * @stable ICU 2.4
+ */
+U_STABLE void U_EXPORT2
+uset_complement(USet* set);
+
+/**
+ * Complements in this set all elements contained in the specified
+ * set. Any character in the other set will be removed if it is
+ * in this set, or will be added if it is not in this set.
+ *
+ * @param set the set with which to complement
+ * @param complement set that defines which elements will be xor'ed
+ * from this set.
+ * @draft ICU 3.2
+ */
+U_DRAFT void U_EXPORT2
+uset_complementAll(USet* set, const USet* complement);
+
+/**
+ * Removes all of the elements from this set. This set will be
+ * empty after this call returns.
+ * @param set the set
+ * @stable ICU 2.4
+ */
+U_STABLE void U_EXPORT2
+uset_clear(USet* set);
+
+/**
+ * Returns TRUE if the given USet contains no characters and no
+ * strings.
+ * @param set the set
+ * @return true if set is empty
+ * @stable ICU 2.4
+ */
+U_STABLE UBool U_EXPORT2
+uset_isEmpty(const USet* set);
+
+/**
+ * Returns TRUE if the given USet contains the given character.
+ * @param set the set
+ * @param c The codepoint to check for within the set
+ * @return true if set contains c
+ * @stable ICU 2.4
+ */
+U_STABLE UBool U_EXPORT2
+uset_contains(const USet* set, UChar32 c);
+
+/**
+ * Returns TRUE if the given USet contains all characters c
+ * where start <= c && c <= end.
+ * @param set the set
+ * @param start the first character of the range to test, inclusive
+ * @param end the last character of the range to test, inclusive
+ * @return TRUE if set contains the range
+ * @stable ICU 2.2
+ */
+U_STABLE UBool U_EXPORT2
+uset_containsRange(const USet* set, UChar32 start, UChar32 end);
+
+/**
+ * Returns TRUE if the given USet contains the given string.
+ * @param set the set
+ * @param str the string
+ * @param strLen the length of the string or -1 if null terminated.
+ * @return true if set contains str
+ * @stable ICU 2.4
+ */
+U_STABLE UBool U_EXPORT2
+uset_containsString(const USet* set, const UChar* str, int32_t strLen);
+
+/**
+ * Returns the index of the given character within this set, where
+ * the set is ordered by ascending code point. If the character
+ * is not in this set, return -1. The inverse of this method is
+ * <code>charAt()</code>.
+ * @param set the set
+ * @param c the character to obtain the index for
+ * @return an index from 0..size()-1, or -1
+ * @draft ICU 3.2
+ */
+U_DRAFT int32_t U_EXPORT2
+uset_indexOf(const USet* set, UChar32 c);
+
+/**
+ * Returns the character at the given index within this set, where
+ * the set is ordered by ascending code point. If the index is
+ * out of range, return (UChar32)-1. The inverse of this method is
+ * <code>indexOf()</code>.
+ * @param set the set
+ * @param index an index from 0..size()-1 to obtain the char for
+ * @return the character at the given index, or (UChar32)-1.
+ * @draft ICU 3.2
+ */
+U_DRAFT UChar32 U_EXPORT2
+uset_charAt(const USet* set, int32_t index);
+
+/**
+ * Returns the number of characters and strings contained in the given
+ * USet.
+ * @param set the set
+ * @return a non-negative integer counting the characters and strings
+ * contained in set
+ * @stable ICU 2.4
+ */
+U_STABLE int32_t U_EXPORT2
+uset_size(const USet* set);
+
+/**
+ * Returns the number of items in this set. An item is either a range
+ * of characters or a single multicharacter string.
+ * @param set the set
+ * @return a non-negative integer counting the character ranges
+ * and/or strings contained in set
+ * @stable ICU 2.4
+ */
+U_STABLE int32_t U_EXPORT2
+uset_getItemCount(const USet* set);
+
+/**
+ * Returns an item of this set. An item is either a range of
+ * characters or a single multicharacter string.
+ * @param set the set
+ * @param itemIndex a non-negative integer in the range 0..
+ * uset_getItemCount(set)-1
+ * @param start pointer to variable to receive first character
+ * in range, inclusive
+ * @param end pointer to variable to receive last character in range,
+ * inclusive
+ * @param str buffer to receive the string, may be NULL
+ * @param strCapacity capacity of str, or 0 if str is NULL
+ * @param ec error code
+ * @return the length of the string (>= 2), or 0 if the item is a
+ * range, in which case it is the range *start..*end, or -1 if
+ * itemIndex is out of range
+ * @stable ICU 2.4
+ */
+U_STABLE int32_t U_EXPORT2
+uset_getItem(const USet* set, int32_t itemIndex,
+ UChar32* start, UChar32* end,
+ UChar* str, int32_t strCapacity,
+ UErrorCode* ec);
+
+/**
+ * Returns true if set1 contains all the characters and strings
+ * of set2. It answers the question, 'Is set1 a subset of set2?'
+ * @param set1 set to be checked for containment
+ * @param set2 set to be checked for containment
+ * @return true if the test condition is met
+ * @draft ICU 3.2
+ */
+U_DRAFT UBool U_EXPORT2
+uset_containsAll(const USet* set1, const USet* set2);
+
+/**
+ * Returns true if set1 contains none of the characters and strings
+ * of set2. It answers the question, 'Is set1 a disjoint set of set2?'
+ * @param set1 set to be checked for containment
+ * @param set2 set to be checked for containment
+ * @return true if the test condition is met
+ * @draft ICU 3.2
+ */
+U_DRAFT UBool U_EXPORT2
+uset_containsNone(const USet* set1, const USet* set2);
+
+/**
+ * Returns true if set1 contains some of the characters and strings
+ * of set2. It answers the question, 'Does set1 and set2 have an intersection?'
+ * @param set1 set to be checked for containment
+ * @param set2 set to be checked for containment
+ * @return true if the test condition is met
+ * @draft ICU 3.2
+ */
+U_DRAFT UBool U_EXPORT2
+uset_containsSome(const USet* set1, const USet* set2);
+
+/**
+ * Returns true if set1 contains all of the characters and strings
+ * of set2, and vis versa. It answers the question, 'Is set1 equal to set2?'
+ * @param set1 set to be checked for containment
+ * @param set2 set to be checked for containment
+ * @return true if the test condition is met
+ * @draft ICU 3.2
+ */
+U_DRAFT UBool U_EXPORT2
+uset_equals(const USet* set1, const USet* set2);
+
+/*********************************************************************
+ * Serialized set API
+ *********************************************************************/
+
+/**
+ * Serializes this set into an array of 16-bit integers. Serialization
+ * (currently) only records the characters in the set; multicharacter
+ * strings are ignored.
+ *
+ * The array
+ * has following format (each line is one 16-bit integer):
+ *
+ * length = (n+2*m) | (m!=0?0x8000:0)
+ * bmpLength = n; present if m!=0
+ * bmp[0]
+ * bmp[1]
+ * ...
+ * bmp[n-1]
+ * supp-high[0]
+ * supp-low[0]
+ * supp-high[1]
+ * supp-low[1]
+ * ...
+ * supp-high[m-1]
+ * supp-low[m-1]
+ *
+ * The array starts with a header. After the header are n bmp
+ * code points, then m supplementary code points. Either n or m
+ * or both may be zero. n+2*m is always <= 0x7FFF.
+ *
+ * If there are no supplementary characters (if m==0) then the
+ * header is one 16-bit integer, 'length', with value n.
+ *
+ * If there are supplementary characters (if m!=0) then the header
+ * is two 16-bit integers. The first, 'length', has value
+ * (n+2*m)|0x8000. The second, 'bmpLength', has value n.
+ *
+ * After the header the code points are stored in ascending order.
+ * Supplementary code points are stored as most significant 16
+ * bits followed by least significant 16 bits.
+ *
+ * @param set the set
+ * @param dest pointer to buffer of destCapacity 16-bit integers.
+ * May be NULL only if destCapacity is zero.
+ * @param destCapacity size of dest, or zero. Must not be negative.
+ * @param pErrorCode pointer to the error code. Will be set to
+ * U_INDEX_OUTOFBOUNDS_ERROR if n+2*m > 0x7FFF. Will be set to
+ * U_BUFFER_OVERFLOW_ERROR if n+2*m+(m!=0?2:1) > destCapacity.
+ * @return the total length of the serialized format, including
+ * the header, that is, n+2*m+(m!=0?2:1), or 0 on error other
+ * than U_BUFFER_OVERFLOW_ERROR.
+ * @stable ICU 2.4
+ */
+U_STABLE int32_t U_EXPORT2
+uset_serialize(const USet* set, uint16_t* dest, int32_t destCapacity, UErrorCode* pErrorCode);
+
+/**
+ * Given a serialized array, fill in the given serialized set object.
+ * @param fillSet pointer to result
+ * @param src pointer to start of array
+ * @param srcLength length of array
+ * @return true if the given array is valid, otherwise false
+ * @stable ICU 2.4
+ */
+U_STABLE UBool U_EXPORT2
+uset_getSerializedSet(USerializedSet* fillSet, const uint16_t* src, int32_t srcLength);
+
+/**
+ * Set the USerializedSet to contain the given character (and nothing
+ * else).
+ * @param fillSet pointer to result
+ * @param c The codepoint to set
+ * @stable ICU 2.4
+ */
+U_STABLE void U_EXPORT2
+uset_setSerializedToOne(USerializedSet* fillSet, UChar32 c);
+
+/**
+ * Returns TRUE if the given USerializedSet contains the given
+ * character.
+ * @param set the serialized set
+ * @param c The codepoint to check for within the set
+ * @return true if set contains c
+ * @stable ICU 2.4
+ */
+U_STABLE UBool U_EXPORT2
+uset_serializedContains(const USerializedSet* set, UChar32 c);
+
+/**
+ * Returns the number of disjoint ranges of characters contained in
+ * the given serialized set. Ignores any strings contained in the
+ * set.
+ * @param set the serialized set
+ * @return a non-negative integer counting the character ranges
+ * contained in set
+ * @stable ICU 2.4
+ */
+U_STABLE int32_t U_EXPORT2
+uset_getSerializedRangeCount(const USerializedSet* set);
+
+/**
+ * Returns a range of characters contained in the given serialized
+ * set.
+ * @param set the serialized set
+ * @param rangeIndex a non-negative integer in the range 0..
+ * uset_getSerializedRangeCount(set)-1
+ * @param pStart pointer to variable to receive first character
+ * in range, inclusive
+ * @param pEnd pointer to variable to receive last character in range,
+ * inclusive
+ * @return true if rangeIndex is valid, otherwise false
+ * @stable ICU 2.4
+ */
+U_STABLE UBool U_EXPORT2
+uset_getSerializedRange(const USerializedSet* set, int32_t rangeIndex,
+ UChar32* pStart, UChar32* pEnd);
+
+#endif
diff --git a/Source/JavaScriptCore/icu/unicode/ustring.h b/Source/JavaScriptCore/icu/unicode/ustring.h
new file mode 100644
index 0000000..6ebb6fb
--- /dev/null
+++ b/Source/JavaScriptCore/icu/unicode/ustring.h
@@ -0,0 +1,1320 @@
+/*
+**********************************************************************
+* Copyright (C) 1998-2004, International Business Machines
+* Corporation and others. All Rights Reserved.
+**********************************************************************
+*
+* File ustring.h
+*
+* Modification History:
+*
+* Date Name Description
+* 12/07/98 bertrand Creation.
+******************************************************************************
+*/
+
+#ifndef USTRING_H
+#define USTRING_H
+
+#include "unicode/utypes.h"
+#include "unicode/putil.h"
+#include "unicode/uiter.h"
+
+/** Simple declaration for u_strToTitle() to avoid including unicode/ubrk.h. @stable ICU 2.1*/
+#ifndef UBRK_TYPEDEF_UBREAK_ITERATOR
+# define UBRK_TYPEDEF_UBREAK_ITERATOR
+ typedef void UBreakIterator;
+#endif
+
+/**
+ * \file
+ * \brief C API: Unicode string handling functions
+ *
+ * These C API functions provide general Unicode string handling.
+ *
+ * Some functions are equivalent in name, signature, and behavior to the ANSI C <string.h>
+ * functions. (For example, they do not check for bad arguments like NULL string pointers.)
+ * In some cases, only the thread-safe variant of such a function is implemented here
+ * (see u_strtok_r()).
+ *
+ * Other functions provide more Unicode-specific functionality like locale-specific
+ * upper/lower-casing and string comparison in code point order.
+ *
+ * ICU uses 16-bit Unicode (UTF-16) in the form of arrays of UChar code units.
+ * UTF-16 encodes each Unicode code point with either one or two UChar code units.
+ * (This is the default form of Unicode, and a forward-compatible extension of the original,
+ * fixed-width form that was known as UCS-2. UTF-16 superseded UCS-2 with Unicode 2.0
+ * in 1996.)
+ *
+ * Some APIs accept a 32-bit UChar32 value for a single code point.
+ *
+ * ICU also handles 16-bit Unicode text with unpaired surrogates.
+ * Such text is not well-formed UTF-16.
+ * Code-point-related functions treat unpaired surrogates as surrogate code points,
+ * i.e., as separate units.
+ *
+ * Although UTF-16 is a variable-width encoding form (like some legacy multi-byte encodings),
+ * it is much more efficient even for random access because the code unit values
+ * for single-unit characters vs. lead units vs. trail units are completely disjoint.
+ * This means that it is easy to determine character (code point) boundaries from
+ * random offsets in the string.
+ *
+ * Unicode (UTF-16) string processing is optimized for the single-unit case.
+ * Although it is important to support supplementary characters
+ * (which use pairs of lead/trail code units called "surrogates"),
+ * their occurrence is rare. Almost all characters in modern use require only
+ * a single UChar code unit (i.e., their code point values are <=0xffff).
+ *
+ * For more details see the User Guide Strings chapter (http://oss.software.ibm.com/icu/userguide/strings.html).
+ * For a discussion of the handling of unpaired surrogates see also
+ * Jitterbug 2145 and its icu mailing list proposal on 2002-sep-18.
+ */
+
+/**
+ * Determine the length of an array of UChar.
+ *
+ * @param s The array of UChars, NULL (U+0000) terminated.
+ * @return The number of UChars in <code>chars</code>, minus the terminator.
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+u_strlen(const UChar *s);
+
+/**
+ * Count Unicode code points in the length UChar code units of the string.
+ * A code point may occupy either one or two UChar code units.
+ * Counting code points involves reading all code units.
+ *
+ * This functions is basically the inverse of the U16_FWD_N() macro (see utf.h).
+ *
+ * @param s The input string.
+ * @param length The number of UChar code units to be checked, or -1 to count all
+ * code points before the first NUL (U+0000).
+ * @return The number of code points in the specified code units.
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+u_countChar32(const UChar *s, int32_t length);
+
+/**
+ * Check if the string contains more Unicode code points than a certain number.
+ * This is more efficient than counting all code points in the entire string
+ * and comparing that number with a threshold.
+ * This function may not need to scan the string at all if the length is known
+ * (not -1 for NUL-termination) and falls within a certain range, and
+ * never needs to count more than 'number+1' code points.
+ * Logically equivalent to (u_countChar32(s, length)>number).
+ * A Unicode code point may occupy either one or two UChar code units.
+ *
+ * @param s The input string.
+ * @param length The length of the string, or -1 if it is NUL-terminated.
+ * @param number The number of code points in the string is compared against
+ * the 'number' parameter.
+ * @return Boolean value for whether the string contains more Unicode code points
+ * than 'number'. Same as (u_countChar32(s, length)>number).
+ * @stable ICU 2.4
+ */
+U_STABLE UBool U_EXPORT2
+u_strHasMoreChar32Than(const UChar *s, int32_t length, int32_t number);
+
+/**
+ * Concatenate two ustrings. Appends a copy of <code>src</code>,
+ * including the null terminator, to <code>dst</code>. The initial copied
+ * character from <code>src</code> overwrites the null terminator in <code>dst</code>.
+ *
+ * @param dst The destination string.
+ * @param src The source string.
+ * @return A pointer to <code>dst</code>.
+ * @stable ICU 2.0
+ */
+U_STABLE UChar* U_EXPORT2
+u_strcat(UChar *dst,
+ const UChar *src);
+
+/**
+ * Concatenate two ustrings.
+ * Appends at most <code>n</code> characters from <code>src</code> to <code>dst</code>.
+ * Adds a terminating NUL.
+ * If src is too long, then only <code>n-1</code> characters will be copied
+ * before the terminating NUL.
+ * If <code>n&lt;=0</code> then dst is not modified.
+ *
+ * @param dst The destination string.
+ * @param src The source string.
+ * @param n The maximum number of characters to compare.
+ * @return A pointer to <code>dst</code>.
+ * @stable ICU 2.0
+ */
+U_STABLE UChar* U_EXPORT2
+u_strncat(UChar *dst,
+ const UChar *src,
+ int32_t n);
+
+/**
+ * Find the first occurrence of a substring in a string.
+ * The substring is found at code point boundaries.
+ * That means that if the substring begins with
+ * a trail surrogate or ends with a lead surrogate,
+ * then it is found only if these surrogates stand alone in the text.
+ * Otherwise, the substring edge units would be matched against
+ * halves of surrogate pairs.
+ *
+ * @param s The string to search (NUL-terminated).
+ * @param substring The substring to find (NUL-terminated).
+ * @return A pointer to the first occurrence of <code>substring</code> in <code>s</code>,
+ * or <code>s</code> itself if the <code>substring</code> is empty,
+ * or <code>NULL</code> if <code>substring</code> is not in <code>s</code>.
+ * @stable ICU 2.0
+ *
+ * @see u_strrstr
+ * @see u_strFindFirst
+ * @see u_strFindLast
+ */
+U_STABLE UChar * U_EXPORT2
+u_strstr(const UChar *s, const UChar *substring);
+
+/**
+ * Find the first occurrence of a substring in a string.
+ * The substring is found at code point boundaries.
+ * That means that if the substring begins with
+ * a trail surrogate or ends with a lead surrogate,
+ * then it is found only if these surrogates stand alone in the text.
+ * Otherwise, the substring edge units would be matched against
+ * halves of surrogate pairs.
+ *
+ * @param s The string to search.
+ * @param length The length of s (number of UChars), or -1 if it is NUL-terminated.
+ * @param substring The substring to find (NUL-terminated).
+ * @param subLength The length of substring (number of UChars), or -1 if it is NUL-terminated.
+ * @return A pointer to the first occurrence of <code>substring</code> in <code>s</code>,
+ * or <code>s</code> itself if the <code>substring</code> is empty,
+ * or <code>NULL</code> if <code>substring</code> is not in <code>s</code>.
+ * @stable ICU 2.4
+ *
+ * @see u_strstr
+ * @see u_strFindLast
+ */
+U_STABLE UChar * U_EXPORT2
+u_strFindFirst(const UChar *s, int32_t length, const UChar *substring, int32_t subLength);
+
+/**
+ * Find the first occurrence of a BMP code point in a string.
+ * A surrogate code point is found only if its match in the text is not
+ * part of a surrogate pair.
+ * A NUL character is found at the string terminator.
+ *
+ * @param s The string to search (NUL-terminated).
+ * @param c The BMP code point to find.
+ * @return A pointer to the first occurrence of <code>c</code> in <code>s</code>
+ * or <code>NULL</code> if <code>c</code> is not in <code>s</code>.
+ * @stable ICU 2.0
+ *
+ * @see u_strchr32
+ * @see u_memchr
+ * @see u_strstr
+ * @see u_strFindFirst
+ */
+U_STABLE UChar * U_EXPORT2
+u_strchr(const UChar *s, UChar c);
+
+/**
+ * Find the first occurrence of a code point in a string.
+ * A surrogate code point is found only if its match in the text is not
+ * part of a surrogate pair.
+ * A NUL character is found at the string terminator.
+ *
+ * @param s The string to search (NUL-terminated).
+ * @param c The code point to find.
+ * @return A pointer to the first occurrence of <code>c</code> in <code>s</code>
+ * or <code>NULL</code> if <code>c</code> is not in <code>s</code>.
+ * @stable ICU 2.0
+ *
+ * @see u_strchr
+ * @see u_memchr32
+ * @see u_strstr
+ * @see u_strFindFirst
+ */
+U_STABLE UChar * U_EXPORT2
+u_strchr32(const UChar *s, UChar32 c);
+
+/**
+ * Find the last occurrence of a substring in a string.
+ * The substring is found at code point boundaries.
+ * That means that if the substring begins with
+ * a trail surrogate or ends with a lead surrogate,
+ * then it is found only if these surrogates stand alone in the text.
+ * Otherwise, the substring edge units would be matched against
+ * halves of surrogate pairs.
+ *
+ * @param s The string to search (NUL-terminated).
+ * @param substring The substring to find (NUL-terminated).
+ * @return A pointer to the last occurrence of <code>substring</code> in <code>s</code>,
+ * or <code>s</code> itself if the <code>substring</code> is empty,
+ * or <code>NULL</code> if <code>substring</code> is not in <code>s</code>.
+ * @stable ICU 2.4
+ *
+ * @see u_strstr
+ * @see u_strFindFirst
+ * @see u_strFindLast
+ */
+U_STABLE UChar * U_EXPORT2
+u_strrstr(const UChar *s, const UChar *substring);
+
+/**
+ * Find the last occurrence of a substring in a string.
+ * The substring is found at code point boundaries.
+ * That means that if the substring begins with
+ * a trail surrogate or ends with a lead surrogate,
+ * then it is found only if these surrogates stand alone in the text.
+ * Otherwise, the substring edge units would be matched against
+ * halves of surrogate pairs.
+ *
+ * @param s The string to search.
+ * @param length The length of s (number of UChars), or -1 if it is NUL-terminated.
+ * @param substring The substring to find (NUL-terminated).
+ * @param subLength The length of substring (number of UChars), or -1 if it is NUL-terminated.
+ * @return A pointer to the last occurrence of <code>substring</code> in <code>s</code>,
+ * or <code>s</code> itself if the <code>substring</code> is empty,
+ * or <code>NULL</code> if <code>substring</code> is not in <code>s</code>.
+ * @stable ICU 2.4
+ *
+ * @see u_strstr
+ * @see u_strFindLast
+ */
+U_STABLE UChar * U_EXPORT2
+u_strFindLast(const UChar *s, int32_t length, const UChar *substring, int32_t subLength);
+
+/**
+ * Find the last occurrence of a BMP code point in a string.
+ * A surrogate code point is found only if its match in the text is not
+ * part of a surrogate pair.
+ * A NUL character is found at the string terminator.
+ *
+ * @param s The string to search (NUL-terminated).
+ * @param c The BMP code point to find.
+ * @return A pointer to the last occurrence of <code>c</code> in <code>s</code>
+ * or <code>NULL</code> if <code>c</code> is not in <code>s</code>.
+ * @stable ICU 2.4
+ *
+ * @see u_strrchr32
+ * @see u_memrchr
+ * @see u_strrstr
+ * @see u_strFindLast
+ */
+U_STABLE UChar * U_EXPORT2
+u_strrchr(const UChar *s, UChar c);
+
+/**
+ * Find the last occurrence of a code point in a string.
+ * A surrogate code point is found only if its match in the text is not
+ * part of a surrogate pair.
+ * A NUL character is found at the string terminator.
+ *
+ * @param s The string to search (NUL-terminated).
+ * @param c The code point to find.
+ * @return A pointer to the last occurrence of <code>c</code> in <code>s</code>
+ * or <code>NULL</code> if <code>c</code> is not in <code>s</code>.
+ * @stable ICU 2.4
+ *
+ * @see u_strrchr
+ * @see u_memchr32
+ * @see u_strrstr
+ * @see u_strFindLast
+ */
+U_STABLE UChar * U_EXPORT2
+u_strrchr32(const UChar *s, UChar32 c);
+
+/**
+ * Locates the first occurrence in the string <code>string</code> of any of the characters
+ * in the string <code>matchSet</code>.
+ * Works just like C's strpbrk but with Unicode.
+ *
+ * @param string The string in which to search, NUL-terminated.
+ * @param matchSet A NUL-terminated string defining a set of code points
+ * for which to search in the text string.
+ * @return A pointer to the character in <code>string</code> that matches one of the
+ * characters in <code>matchSet</code>, or NULL if no such character is found.
+ * @stable ICU 2.0
+ */
+U_STABLE UChar * U_EXPORT2
+u_strpbrk(const UChar *string, const UChar *matchSet);
+
+/**
+ * Returns the number of consecutive characters in <code>string</code>,
+ * beginning with the first, that do not occur somewhere in <code>matchSet</code>.
+ * Works just like C's strcspn but with Unicode.
+ *
+ * @param string The string in which to search, NUL-terminated.
+ * @param matchSet A NUL-terminated string defining a set of code points
+ * for which to search in the text string.
+ * @return The number of initial characters in <code>string</code> that do not
+ * occur in <code>matchSet</code>.
+ * @see u_strspn
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+u_strcspn(const UChar *string, const UChar *matchSet);
+
+/**
+ * Returns the number of consecutive characters in <code>string</code>,
+ * beginning with the first, that occur somewhere in <code>matchSet</code>.
+ * Works just like C's strspn but with Unicode.
+ *
+ * @param string The string in which to search, NUL-terminated.
+ * @param matchSet A NUL-terminated string defining a set of code points
+ * for which to search in the text string.
+ * @return The number of initial characters in <code>string</code> that do
+ * occur in <code>matchSet</code>.
+ * @see u_strcspn
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+u_strspn(const UChar *string, const UChar *matchSet);
+
+/**
+ * The string tokenizer API allows an application to break a string into
+ * tokens. Unlike strtok(), the saveState (the current pointer within the
+ * original string) is maintained in saveState. In the first call, the
+ * argument src is a pointer to the string. In subsequent calls to
+ * return successive tokens of that string, src must be specified as
+ * NULL. The value saveState is set by this function to maintain the
+ * function's position within the string, and on each subsequent call
+ * you must give this argument the same variable. This function does
+ * handle surrogate pairs. This function is similar to the strtok_r()
+ * the POSIX Threads Extension (1003.1c-1995) version.
+ *
+ * @param src String containing token(s). This string will be modified.
+ * After the first call to u_strtok_r(), this argument must
+ * be NULL to get to the next token.
+ * @param delim Set of delimiter characters (Unicode code points).
+ * @param saveState The current pointer within the original string,
+ * which is set by this function. The saveState
+ * parameter should the address of a local variable of type
+ * UChar *. (i.e. defined "Uhar *myLocalSaveState" and use
+ * &myLocalSaveState for this parameter).
+ * @return A pointer to the next token found in src, or NULL
+ * when there are no more tokens.
+ * @stable ICU 2.0
+ */
+U_STABLE UChar * U_EXPORT2
+u_strtok_r(UChar *src,
+ const UChar *delim,
+ UChar **saveState);
+
+/**
+ * Compare two Unicode strings for bitwise equality (code unit order).
+ *
+ * @param s1 A string to compare.
+ * @param s2 A string to compare.
+ * @return 0 if <code>s1</code> and <code>s2</code> are bitwise equal; a negative
+ * value if <code>s1</code> is bitwise less than <code>s2,</code>; a positive
+ * value if <code>s1</code> is bitwise greater than <code>s2</code>.
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+u_strcmp(const UChar *s1,
+ const UChar *s2);
+
+/**
+ * Compare two Unicode strings in code point order.
+ * See u_strCompare for details.
+ *
+ * @param s1 A string to compare.
+ * @param s2 A string to compare.
+ * @return a negative/zero/positive integer corresponding to whether
+ * the first string is less than/equal to/greater than the second one
+ * in code point order
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+u_strcmpCodePointOrder(const UChar *s1, const UChar *s2);
+
+/**
+ * Compare two Unicode strings (binary order).
+ *
+ * The comparison can be done in code unit order or in code point order.
+ * They differ only in UTF-16 when
+ * comparing supplementary code points (U+10000..U+10ffff)
+ * to BMP code points near the end of the BMP (i.e., U+e000..U+ffff).
+ * In code unit order, high BMP code points sort after supplementary code points
+ * because they are stored as pairs of surrogates which are at U+d800..U+dfff.
+ *
+ * This functions works with strings of different explicitly specified lengths
+ * unlike the ANSI C-like u_strcmp() and u_memcmp() etc.
+ * NUL-terminated strings are possible with length arguments of -1.
+ *
+ * @param s1 First source string.
+ * @param length1 Length of first source string, or -1 if NUL-terminated.
+ *
+ * @param s2 Second source string.
+ * @param length2 Length of second source string, or -1 if NUL-terminated.
+ *
+ * @param codePointOrder Choose between code unit order (FALSE)
+ * and code point order (TRUE).
+ *
+ * @return <0 or 0 or >0 as usual for string comparisons
+ *
+ * @stable ICU 2.2
+ */
+U_STABLE int32_t U_EXPORT2
+u_strCompare(const UChar *s1, int32_t length1,
+ const UChar *s2, int32_t length2,
+ UBool codePointOrder);
+
+/**
+ * Compare two Unicode strings (binary order)
+ * as presented by UCharIterator objects.
+ * Works otherwise just like u_strCompare().
+ *
+ * Both iterators are reset to their start positions.
+ * When the function returns, it is undefined where the iterators
+ * have stopped.
+ *
+ * @param iter1 First source string iterator.
+ * @param iter2 Second source string iterator.
+ * @param codePointOrder Choose between code unit order (FALSE)
+ * and code point order (TRUE).
+ *
+ * @return <0 or 0 or >0 as usual for string comparisons
+ *
+ * @see u_strCompare
+ *
+ * @stable ICU 2.6
+ */
+U_STABLE int32_t U_EXPORT2
+u_strCompareIter(UCharIterator *iter1, UCharIterator *iter2, UBool codePointOrder);
+
+#ifndef U_COMPARE_CODE_POINT_ORDER
+/* see also unistr.h and unorm.h */
+/**
+ * Option bit for u_strCaseCompare, u_strcasecmp, unorm_compare, etc:
+ * Compare strings in code point order instead of code unit order.
+ * @stable ICU 2.2
+ */
+#define U_COMPARE_CODE_POINT_ORDER 0x8000
+#endif
+
+/**
+ * Compare two strings case-insensitively using full case folding.
+ * This is equivalent to
+ * u_strCompare(u_strFoldCase(s1, options),
+ * u_strFoldCase(s2, options),
+ * (options&U_COMPARE_CODE_POINT_ORDER)!=0).
+ *
+ * The comparison can be done in UTF-16 code unit order or in code point order.
+ * They differ only when comparing supplementary code points (U+10000..U+10ffff)
+ * to BMP code points near the end of the BMP (i.e., U+e000..U+ffff).
+ * In code unit order, high BMP code points sort after supplementary code points
+ * because they are stored as pairs of surrogates which are at U+d800..U+dfff.
+ *
+ * This functions works with strings of different explicitly specified lengths
+ * unlike the ANSI C-like u_strcmp() and u_memcmp() etc.
+ * NUL-terminated strings are possible with length arguments of -1.
+ *
+ * @param s1 First source string.
+ * @param length1 Length of first source string, or -1 if NUL-terminated.
+ *
+ * @param s2 Second source string.
+ * @param length2 Length of second source string, or -1 if NUL-terminated.
+ *
+ * @param options A bit set of options:
+ * - U_FOLD_CASE_DEFAULT or 0 is used for default options:
+ * Comparison in code unit order with default case folding.
+ *
+ * - U_COMPARE_CODE_POINT_ORDER
+ * Set to choose code point order instead of code unit order
+ * (see u_strCompare for details).
+ *
+ * - U_FOLD_CASE_EXCLUDE_SPECIAL_I
+ *
+ * @param pErrorCode Must be a valid pointer to an error code value,
+ * which must not indicate a failure before the function call.
+ *
+ * @return <0 or 0 or >0 as usual for string comparisons
+ *
+ * @stable ICU 2.2
+ */
+U_STABLE int32_t U_EXPORT2
+u_strCaseCompare(const UChar *s1, int32_t length1,
+ const UChar *s2, int32_t length2,
+ uint32_t options,
+ UErrorCode *pErrorCode);
+
+/**
+ * Compare two ustrings for bitwise equality.
+ * Compares at most <code>n</code> characters.
+ *
+ * @param ucs1 A string to compare.
+ * @param ucs2 A string to compare.
+ * @param n The maximum number of characters to compare.
+ * @return 0 if <code>s1</code> and <code>s2</code> are bitwise equal; a negative
+ * value if <code>s1</code> is bitwise less than <code>s2</code>; a positive
+ * value if <code>s1</code> is bitwise greater than <code>s2</code>.
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+u_strncmp(const UChar *ucs1,
+ const UChar *ucs2,
+ int32_t n);
+
+/**
+ * Compare two Unicode strings in code point order.
+ * This is different in UTF-16 from u_strncmp() if supplementary characters are present.
+ * For details, see u_strCompare().
+ *
+ * @param s1 A string to compare.
+ * @param s2 A string to compare.
+ * @param n The maximum number of characters to compare.
+ * @return a negative/zero/positive integer corresponding to whether
+ * the first string is less than/equal to/greater than the second one
+ * in code point order
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+u_strncmpCodePointOrder(const UChar *s1, const UChar *s2, int32_t n);
+
+/**
+ * Compare two strings case-insensitively using full case folding.
+ * This is equivalent to u_strcmp(u_strFoldCase(s1, options), u_strFoldCase(s2, options)).
+ *
+ * @param s1 A string to compare.
+ * @param s2 A string to compare.
+ * @param options A bit set of options:
+ * - U_FOLD_CASE_DEFAULT or 0 is used for default options:
+ * Comparison in code unit order with default case folding.
+ *
+ * - U_COMPARE_CODE_POINT_ORDER
+ * Set to choose code point order instead of code unit order
+ * (see u_strCompare for details).
+ *
+ * - U_FOLD_CASE_EXCLUDE_SPECIAL_I
+ *
+ * @return A negative, zero, or positive integer indicating the comparison result.
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+u_strcasecmp(const UChar *s1, const UChar *s2, uint32_t options);
+
+/**
+ * Compare two strings case-insensitively using full case folding.
+ * This is equivalent to u_strcmp(u_strFoldCase(s1, at most n, options),
+ * u_strFoldCase(s2, at most n, options)).
+ *
+ * @param s1 A string to compare.
+ * @param s2 A string to compare.
+ * @param n The maximum number of characters each string to case-fold and then compare.
+ * @param options A bit set of options:
+ * - U_FOLD_CASE_DEFAULT or 0 is used for default options:
+ * Comparison in code unit order with default case folding.
+ *
+ * - U_COMPARE_CODE_POINT_ORDER
+ * Set to choose code point order instead of code unit order
+ * (see u_strCompare for details).
+ *
+ * - U_FOLD_CASE_EXCLUDE_SPECIAL_I
+ *
+ * @return A negative, zero, or positive integer indicating the comparison result.
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+u_strncasecmp(const UChar *s1, const UChar *s2, int32_t n, uint32_t options);
+
+/**
+ * Compare two strings case-insensitively using full case folding.
+ * This is equivalent to u_strcmp(u_strFoldCase(s1, n, options),
+ * u_strFoldCase(s2, n, options)).
+ *
+ * @param s1 A string to compare.
+ * @param s2 A string to compare.
+ * @param length The number of characters in each string to case-fold and then compare.
+ * @param options A bit set of options:
+ * - U_FOLD_CASE_DEFAULT or 0 is used for default options:
+ * Comparison in code unit order with default case folding.
+ *
+ * - U_COMPARE_CODE_POINT_ORDER
+ * Set to choose code point order instead of code unit order
+ * (see u_strCompare for details).
+ *
+ * - U_FOLD_CASE_EXCLUDE_SPECIAL_I
+ *
+ * @return A negative, zero, or positive integer indicating the comparison result.
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+u_memcasecmp(const UChar *s1, const UChar *s2, int32_t length, uint32_t options);
+
+/**
+ * Copy a ustring. Adds a null terminator.
+ *
+ * @param dst The destination string.
+ * @param src The source string.
+ * @return A pointer to <code>dst</code>.
+ * @stable ICU 2.0
+ */
+U_STABLE UChar* U_EXPORT2
+u_strcpy(UChar *dst,
+ const UChar *src);
+
+/**
+ * Copy a ustring.
+ * Copies at most <code>n</code> characters. The result will be null terminated
+ * if the length of <code>src</code> is less than <code>n</code>.
+ *
+ * @param dst The destination string.
+ * @param src The source string.
+ * @param n The maximum number of characters to copy.
+ * @return A pointer to <code>dst</code>.
+ * @stable ICU 2.0
+ */
+U_STABLE UChar* U_EXPORT2
+u_strncpy(UChar *dst,
+ const UChar *src,
+ int32_t n);
+
+#if !UCONFIG_NO_CONVERSION
+
+/**
+ * Copy a byte string encoded in the default codepage to a ustring.
+ * Adds a null terminator.
+ * Performs a host byte to UChar conversion
+ *
+ * @param dst The destination string.
+ * @param src The source string.
+ * @return A pointer to <code>dst</code>.
+ * @stable ICU 2.0
+ */
+U_STABLE UChar* U_EXPORT2 u_uastrcpy(UChar *dst,
+ const char *src );
+
+/**
+ * Copy a byte string encoded in the default codepage to a ustring.
+ * Copies at most <code>n</code> characters. The result will be null terminated
+ * if the length of <code>src</code> is less than <code>n</code>.
+ * Performs a host byte to UChar conversion
+ *
+ * @param dst The destination string.
+ * @param src The source string.
+ * @param n The maximum number of characters to copy.
+ * @return A pointer to <code>dst</code>.
+ * @stable ICU 2.0
+ */
+U_STABLE UChar* U_EXPORT2 u_uastrncpy(UChar *dst,
+ const char *src,
+ int32_t n);
+
+/**
+ * Copy ustring to a byte string encoded in the default codepage.
+ * Adds a null terminator.
+ * Performs a UChar to host byte conversion
+ *
+ * @param dst The destination string.
+ * @param src The source string.
+ * @return A pointer to <code>dst</code>.
+ * @stable ICU 2.0
+ */
+U_STABLE char* U_EXPORT2 u_austrcpy(char *dst,
+ const UChar *src );
+
+/**
+ * Copy ustring to a byte string encoded in the default codepage.
+ * Copies at most <code>n</code> characters. The result will be null terminated
+ * if the length of <code>src</code> is less than <code>n</code>.
+ * Performs a UChar to host byte conversion
+ *
+ * @param dst The destination string.
+ * @param src The source string.
+ * @param n The maximum number of characters to copy.
+ * @return A pointer to <code>dst</code>.
+ * @stable ICU 2.0
+ */
+U_STABLE char* U_EXPORT2 u_austrncpy(char *dst,
+ const UChar *src,
+ int32_t n );
+
+#endif
+
+/**
+ * Synonym for memcpy(), but with UChars only.
+ * @param dest The destination string
+ * @param src The source string
+ * @param count The number of characters to copy
+ * @return A pointer to <code>dest</code>
+ * @stable ICU 2.0
+ */
+U_STABLE UChar* U_EXPORT2
+u_memcpy(UChar *dest, const UChar *src, int32_t count);
+
+/**
+ * Synonym for memmove(), but with UChars only.
+ * @param dest The destination string
+ * @param src The source string
+ * @param count The number of characters to move
+ * @return A pointer to <code>dest</code>
+ * @stable ICU 2.0
+ */
+U_STABLE UChar* U_EXPORT2
+u_memmove(UChar *dest, const UChar *src, int32_t count);
+
+/**
+ * Initialize <code>count</code> characters of <code>dest</code> to <code>c</code>.
+ *
+ * @param dest The destination string.
+ * @param c The character to initialize the string.
+ * @param count The maximum number of characters to set.
+ * @return A pointer to <code>dest</code>.
+ * @stable ICU 2.0
+ */
+U_STABLE UChar* U_EXPORT2
+u_memset(UChar *dest, UChar c, int32_t count);
+
+/**
+ * Compare the first <code>count</code> UChars of each buffer.
+ *
+ * @param buf1 The first string to compare.
+ * @param buf2 The second string to compare.
+ * @param count The maximum number of UChars to compare.
+ * @return When buf1 < buf2, a negative number is returned.
+ * When buf1 == buf2, 0 is returned.
+ * When buf1 > buf2, a positive number is returned.
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+u_memcmp(const UChar *buf1, const UChar *buf2, int32_t count);
+
+/**
+ * Compare two Unicode strings in code point order.
+ * This is different in UTF-16 from u_memcmp() if supplementary characters are present.
+ * For details, see u_strCompare().
+ *
+ * @param s1 A string to compare.
+ * @param s2 A string to compare.
+ * @param count The maximum number of characters to compare.
+ * @return a negative/zero/positive integer corresponding to whether
+ * the first string is less than/equal to/greater than the second one
+ * in code point order
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+u_memcmpCodePointOrder(const UChar *s1, const UChar *s2, int32_t count);
+
+/**
+ * Find the first occurrence of a BMP code point in a string.
+ * A surrogate code point is found only if its match in the text is not
+ * part of a surrogate pair.
+ * A NUL character is found at the string terminator.
+ *
+ * @param s The string to search (contains <code>count</code> UChars).
+ * @param c The BMP code point to find.
+ * @param count The length of the string.
+ * @return A pointer to the first occurrence of <code>c</code> in <code>s</code>
+ * or <code>NULL</code> if <code>c</code> is not in <code>s</code>.
+ * @stable ICU 2.0
+ *
+ * @see u_strchr
+ * @see u_memchr32
+ * @see u_strFindFirst
+ */
+U_STABLE UChar* U_EXPORT2
+u_memchr(const UChar *s, UChar c, int32_t count);
+
+/**
+ * Find the first occurrence of a code point in a string.
+ * A surrogate code point is found only if its match in the text is not
+ * part of a surrogate pair.
+ * A NUL character is found at the string terminator.
+ *
+ * @param s The string to search (contains <code>count</code> UChars).
+ * @param c The code point to find.
+ * @param count The length of the string.
+ * @return A pointer to the first occurrence of <code>c</code> in <code>s</code>
+ * or <code>NULL</code> if <code>c</code> is not in <code>s</code>.
+ * @stable ICU 2.0
+ *
+ * @see u_strchr32
+ * @see u_memchr
+ * @see u_strFindFirst
+ */
+U_STABLE UChar* U_EXPORT2
+u_memchr32(const UChar *s, UChar32 c, int32_t count);
+
+/**
+ * Find the last occurrence of a BMP code point in a string.
+ * A surrogate code point is found only if its match in the text is not
+ * part of a surrogate pair.
+ * A NUL character is found at the string terminator.
+ *
+ * @param s The string to search (contains <code>count</code> UChars).
+ * @param c The BMP code point to find.
+ * @param count The length of the string.
+ * @return A pointer to the last occurrence of <code>c</code> in <code>s</code>
+ * or <code>NULL</code> if <code>c</code> is not in <code>s</code>.
+ * @stable ICU 2.4
+ *
+ * @see u_strrchr
+ * @see u_memrchr32
+ * @see u_strFindLast
+ */
+U_STABLE UChar* U_EXPORT2
+u_memrchr(const UChar *s, UChar c, int32_t count);
+
+/**
+ * Find the last occurrence of a code point in a string.
+ * A surrogate code point is found only if its match in the text is not
+ * part of a surrogate pair.
+ * A NUL character is found at the string terminator.
+ *
+ * @param s The string to search (contains <code>count</code> UChars).
+ * @param c The code point to find.
+ * @param count The length of the string.
+ * @return A pointer to the last occurrence of <code>c</code> in <code>s</code>
+ * or <code>NULL</code> if <code>c</code> is not in <code>s</code>.
+ * @stable ICU 2.4
+ *
+ * @see u_strrchr32
+ * @see u_memrchr
+ * @see u_strFindLast
+ */
+U_STABLE UChar* U_EXPORT2
+u_memrchr32(const UChar *s, UChar32 c, int32_t count);
+
+/**
+ * Unicode String literals in C.
+ * We need one macro to declare a variable for the string
+ * and to statically preinitialize it if possible,
+ * and a second macro to dynamically intialize such a string variable if necessary.
+ *
+ * The macros are defined for maximum performance.
+ * They work only for strings that contain "invariant characters", i.e.,
+ * only latin letters, digits, and some punctuation.
+ * See utypes.h for details.
+ *
+ * A pair of macros for a single string must be used with the same
+ * parameters.
+ * The string parameter must be a C string literal.
+ * The length of the string, not including the terminating
+ * <code>NUL</code>, must be specified as a constant.
+ * The U_STRING_DECL macro should be invoked exactly once for one
+ * such string variable before it is used.
+ *
+ * Usage:
+ * <pre>
+ * &#32; U_STRING_DECL(ustringVar1, "Quick-Fox 2", 11);
+ * &#32; U_STRING_DECL(ustringVar2, "jumps 5%", 8);
+ * &#32; static UBool didInit=FALSE;
+ * &#32;
+ * &#32; int32_t function() {
+ * &#32; if(!didInit) {
+ * &#32; U_STRING_INIT(ustringVar1, "Quick-Fox 2", 11);
+ * &#32; U_STRING_INIT(ustringVar2, "jumps 5%", 8);
+ * &#32; didInit=TRUE;
+ * &#32; }
+ * &#32; return u_strcmp(ustringVar1, ustringVar2);
+ * &#32; }
+ * </pre>
+ * @stable ICU 2.0
+ */
+#if U_SIZEOF_WCHAR_T==U_SIZEOF_UCHAR && U_CHARSET_FAMILY==U_ASCII_FAMILY
+# define U_STRING_DECL(var, cs, length) static const wchar_t var[(length)+1]={ L ## cs }
+ /**@stable ICU 2.0 */
+# define U_STRING_INIT(var, cs, length)
+#elif U_SIZEOF_UCHAR==1 && U_CHARSET_FAMILY==U_ASCII_FAMILY
+# define U_STRING_DECL(var, cs, length) static const UChar var[(length)+1]={ (const UChar *)cs }
+ /**@stable ICU 2.0 */
+# define U_STRING_INIT(var, cs, length)
+#else
+# define U_STRING_DECL(var, cs, length) static UChar var[(length)+1]
+ /**@stable ICU 2.0 */
+# define U_STRING_INIT(var, cs, length) u_charsToUChars(cs, var, length+1)
+#endif
+
+/**
+ * Unescape a string of characters and write the resulting
+ * Unicode characters to the destination buffer. The following escape
+ * sequences are recognized:
+ *
+ * \\uhhhh 4 hex digits; h in [0-9A-Fa-f]
+ * \\Uhhhhhhhh 8 hex digits
+ * \\xhh 1-2 hex digits
+ * \\x{h...} 1-8 hex digits
+ * \\ooo 1-3 octal digits; o in [0-7]
+ * \\cX control-X; X is masked with 0x1F
+ *
+ * as well as the standard ANSI C escapes:
+ *
+ * \\a => U+0007, \\b => U+0008, \\t => U+0009, \\n => U+000A,
+ * \\v => U+000B, \\f => U+000C, \\r => U+000D, \\e => U+001B,
+ * \\" => U+0022, \\' => U+0027, \\? => U+003F, \\\\ => U+005C
+ *
+ * Anything else following a backslash is generically escaped. For
+ * example, "[a\\-z]" returns "[a-z]".
+ *
+ * If an escape sequence is ill-formed, this method returns an empty
+ * string. An example of an ill-formed sequence is "\\u" followed by
+ * fewer than 4 hex digits.
+ *
+ * The above characters are recognized in the compiler's codepage,
+ * that is, they are coded as 'u', '\\', etc. Characters that are
+ * not parts of escape sequences are converted using u_charsToUChars().
+ *
+ * This function is similar to UnicodeString::unescape() but not
+ * identical to it. The latter takes a source UnicodeString, so it
+ * does escape recognition but no conversion.
+ *
+ * @param src a zero-terminated string of invariant characters
+ * @param dest pointer to buffer to receive converted and unescaped
+ * text and, if there is room, a zero terminator. May be NULL for
+ * preflighting, in which case no UChars will be written, but the
+ * return value will still be valid. On error, an empty string is
+ * stored here (if possible).
+ * @param destCapacity the number of UChars that may be written at
+ * dest. Ignored if dest == NULL.
+ * @return the length of unescaped string.
+ * @see u_unescapeAt
+ * @see UnicodeString#unescape()
+ * @see UnicodeString#unescapeAt()
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+u_unescape(const char *src,
+ UChar *dest, int32_t destCapacity);
+
+U_CDECL_BEGIN
+/**
+ * Callback function for u_unescapeAt() that returns a character of
+ * the source text given an offset and a context pointer. The context
+ * pointer will be whatever is passed into u_unescapeAt().
+ *
+ * @param offset pointer to the offset that will be passed to u_unescapeAt().
+ * @param context an opaque pointer passed directly into u_unescapeAt()
+ * @return the character represented by the escape sequence at
+ * offset
+ * @see u_unescapeAt
+ * @stable ICU 2.0
+ */
+typedef UChar (U_CALLCONV *UNESCAPE_CHAR_AT)(int32_t offset, void *context);
+U_CDECL_END
+
+/**
+ * Unescape a single sequence. The character at offset-1 is assumed
+ * (without checking) to be a backslash. This method takes a callback
+ * pointer to a function that returns the UChar at a given offset. By
+ * varying this callback, ICU functions are able to unescape char*
+ * strings, UnicodeString objects, and UFILE pointers.
+ *
+ * If offset is out of range, or if the escape sequence is ill-formed,
+ * (UChar32)0xFFFFFFFF is returned. See documentation of u_unescape()
+ * for a list of recognized sequences.
+ *
+ * @param charAt callback function that returns a UChar of the source
+ * text given an offset and a context pointer.
+ * @param offset pointer to the offset that will be passed to charAt.
+ * The offset value will be updated upon return to point after the
+ * last parsed character of the escape sequence. On error the offset
+ * is unchanged.
+ * @param length the number of characters in the source text. The
+ * last character of the source text is considered to be at offset
+ * length-1.
+ * @param context an opaque pointer passed directly into charAt.
+ * @return the character represented by the escape sequence at
+ * offset, or (UChar32)0xFFFFFFFF on error.
+ * @see u_unescape()
+ * @see UnicodeString#unescape()
+ * @see UnicodeString#unescapeAt()
+ * @stable ICU 2.0
+ */
+U_STABLE UChar32 U_EXPORT2
+u_unescapeAt(UNESCAPE_CHAR_AT charAt,
+ int32_t *offset,
+ int32_t length,
+ void *context);
+
+/**
+ * Uppercase the characters in a string.
+ * Casing is locale-dependent and context-sensitive.
+ * The result may be longer or shorter than the original.
+ * The source string and the destination buffer are allowed to overlap.
+ *
+ * @param dest A buffer for the result string. The result will be zero-terminated if
+ * the buffer is large enough.
+ * @param destCapacity The size of the buffer (number of UChars). If it is 0, then
+ * dest may be NULL and the function will only return the length of the result
+ * without writing any of the result string.
+ * @param src The original string
+ * @param srcLength The length of the original string. If -1, then src must be zero-terminated.
+ * @param locale The locale to consider, or "" for the root locale or NULL for the default locale.
+ * @param pErrorCode Must be a valid pointer to an error code value,
+ * which must not indicate a failure before the function call.
+ * @return The length of the result string. It may be greater than destCapacity. In that case,
+ * only some of the result was written to the destination buffer.
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+u_strToUpper(UChar *dest, int32_t destCapacity,
+ const UChar *src, int32_t srcLength,
+ const char *locale,
+ UErrorCode *pErrorCode);
+
+/**
+ * Lowercase the characters in a string.
+ * Casing is locale-dependent and context-sensitive.
+ * The result may be longer or shorter than the original.
+ * The source string and the destination buffer are allowed to overlap.
+ *
+ * @param dest A buffer for the result string. The result will be zero-terminated if
+ * the buffer is large enough.
+ * @param destCapacity The size of the buffer (number of UChars). If it is 0, then
+ * dest may be NULL and the function will only return the length of the result
+ * without writing any of the result string.
+ * @param src The original string
+ * @param srcLength The length of the original string. If -1, then src must be zero-terminated.
+ * @param locale The locale to consider, or "" for the root locale or NULL for the default locale.
+ * @param pErrorCode Must be a valid pointer to an error code value,
+ * which must not indicate a failure before the function call.
+ * @return The length of the result string. It may be greater than destCapacity. In that case,
+ * only some of the result was written to the destination buffer.
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+u_strToLower(UChar *dest, int32_t destCapacity,
+ const UChar *src, int32_t srcLength,
+ const char *locale,
+ UErrorCode *pErrorCode);
+
+#if !UCONFIG_NO_BREAK_ITERATION
+
+/**
+ * Titlecase a string.
+ * Casing is locale-dependent and context-sensitive.
+ * Titlecasing uses a break iterator to find the first characters of words
+ * that are to be titlecased. It titlecases those characters and lowercases
+ * all others.
+ *
+ * The titlecase break iterator can be provided to customize for arbitrary
+ * styles, using rules and dictionaries beyond the standard iterators.
+ * It may be more efficient to always provide an iterator to avoid
+ * opening and closing one for each string.
+ * The standard titlecase iterator for the root locale implements the
+ * algorithm of Unicode TR 21.
+ *
+ * This function uses only the first() and next() methods of the
+ * provided break iterator.
+ *
+ * The result may be longer or shorter than the original.
+ * The source string and the destination buffer are allowed to overlap.
+ *
+ * @param dest A buffer for the result string. The result will be zero-terminated if
+ * the buffer is large enough.
+ * @param destCapacity The size of the buffer (number of UChars). If it is 0, then
+ * dest may be NULL and the function will only return the length of the result
+ * without writing any of the result string.
+ * @param src The original string
+ * @param srcLength The length of the original string. If -1, then src must be zero-terminated.
+ * @param titleIter A break iterator to find the first characters of words
+ * that are to be titlecased.
+ * If none is provided (NULL), then a standard titlecase
+ * break iterator is opened.
+ * @param locale The locale to consider, or "" for the root locale or NULL for the default locale.
+ * @param pErrorCode Must be a valid pointer to an error code value,
+ * which must not indicate a failure before the function call.
+ * @return The length of the result string. It may be greater than destCapacity. In that case,
+ * only some of the result was written to the destination buffer.
+ * @stable ICU 2.1
+ */
+U_STABLE int32_t U_EXPORT2
+u_strToTitle(UChar *dest, int32_t destCapacity,
+ const UChar *src, int32_t srcLength,
+ UBreakIterator *titleIter,
+ const char *locale,
+ UErrorCode *pErrorCode);
+
+#endif
+
+/**
+ * Case-fold the characters in a string.
+ * Case-folding is locale-independent and not context-sensitive,
+ * but there is an option for whether to include or exclude mappings for dotted I
+ * and dotless i that are marked with 'I' in CaseFolding.txt.
+ * The result may be longer or shorter than the original.
+ * The source string and the destination buffer are allowed to overlap.
+ *
+ * @param dest A buffer for the result string. The result will be zero-terminated if
+ * the buffer is large enough.
+ * @param destCapacity The size of the buffer (number of UChars). If it is 0, then
+ * dest may be NULL and the function will only return the length of the result
+ * without writing any of the result string.
+ * @param src The original string
+ * @param srcLength The length of the original string. If -1, then src must be zero-terminated.
+ * @param options Either U_FOLD_CASE_DEFAULT or U_FOLD_CASE_EXCLUDE_SPECIAL_I
+ * @param pErrorCode Must be a valid pointer to an error code value,
+ * which must not indicate a failure before the function call.
+ * @return The length of the result string. It may be greater than destCapacity. In that case,
+ * only some of the result was written to the destination buffer.
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+u_strFoldCase(UChar *dest, int32_t destCapacity,
+ const UChar *src, int32_t srcLength,
+ uint32_t options,
+ UErrorCode *pErrorCode);
+
+/**
+ * Converts a sequence of UChars to wchar_t units.
+ *
+ * @param dest A buffer for the result string. The result will be zero-terminated if
+ * the buffer is large enough.
+ * @param destCapacity The size of the buffer (number of wchar_t's). If it is 0, then
+ * dest may be NULL and the function will only return the length of the
+ * result without writing any of the result string (pre-flighting).
+ * @param pDestLength A pointer to receive the number of units written to the destination. If
+ * pDestLength!=NULL then *pDestLength is always set to the
+ * number of output units corresponding to the transformation of
+ * all the input units, even in case of a buffer overflow.
+ * @param src The original source string
+ * @param srcLength The length of the original string. If -1, then src must be zero-terminated.
+ * @param pErrorCode Must be a valid pointer to an error code value,
+ * which must not indicate a failure before the function call.
+ * @return The pointer to destination buffer.
+ * @stable ICU 2.0
+ */
+U_STABLE wchar_t* U_EXPORT2
+u_strToWCS(wchar_t *dest,
+ int32_t destCapacity,
+ int32_t *pDestLength,
+ const UChar *src,
+ int32_t srcLength,
+ UErrorCode *pErrorCode);
+/**
+ * Converts a sequence of wchar_t units to UChars
+ *
+ * @param dest A buffer for the result string. The result will be zero-terminated if
+ * the buffer is large enough.
+ * @param destCapacity The size of the buffer (number of UChars). If it is 0, then
+ * dest may be NULL and the function will only return the length of the
+ * result without writing any of the result string (pre-flighting).
+ * @param pDestLength A pointer to receive the number of units written to the destination. If
+ * pDestLength!=NULL then *pDestLength is always set to the
+ * number of output units corresponding to the transformation of
+ * all the input units, even in case of a buffer overflow.
+ * @param src The original source string
+ * @param srcLength The length of the original string. If -1, then src must be zero-terminated.
+ * @param pErrorCode Must be a valid pointer to an error code value,
+ * which must not indicate a failure before the function call.
+ * @return The pointer to destination buffer.
+ * @stable ICU 2.0
+ */
+U_STABLE UChar* U_EXPORT2
+u_strFromWCS(UChar *dest,
+ int32_t destCapacity,
+ int32_t *pDestLength,
+ const wchar_t *src,
+ int32_t srcLength,
+ UErrorCode *pErrorCode);
+/**
+ * Converts a sequence of UChars (UTF-16) to UTF-8 bytes
+ *
+ * @param dest A buffer for the result string. The result will be zero-terminated if
+ * the buffer is large enough.
+ * @param destCapacity The size of the buffer (number of chars). If it is 0, then
+ * dest may be NULL and the function will only return the length of the
+ * result without writing any of the result string (pre-flighting).
+ * @param pDestLength A pointer to receive the number of units written to the destination. If
+ * pDestLength!=NULL then *pDestLength is always set to the
+ * number of output units corresponding to the transformation of
+ * all the input units, even in case of a buffer overflow.
+ * @param src The original source string
+ * @param srcLength The length of the original string. If -1, then src must be zero-terminated.
+ * @param pErrorCode Must be a valid pointer to an error code value,
+ * which must not indicate a failure before the function call.
+ * @return The pointer to destination buffer.
+ * @stable ICU 2.0
+ */
+U_STABLE char* U_EXPORT2
+u_strToUTF8(char *dest,
+ int32_t destCapacity,
+ int32_t *pDestLength,
+ const UChar *src,
+ int32_t srcLength,
+ UErrorCode *pErrorCode);
+
+/**
+ * Converts a sequence of UTF-8 bytes to UChars (UTF-16).
+ *
+ * @param dest A buffer for the result string. The result will be zero-terminated if
+ * the buffer is large enough.
+ * @param destCapacity The size of the buffer (number of UChars). If it is 0, then
+ * dest may be NULL and the function will only return the length of the
+ * result without writing any of the result string (pre-flighting).
+ * @param pDestLength A pointer to receive the number of units written to the destination. If
+ * pDestLength!=NULL then *pDestLength is always set to the
+ * number of output units corresponding to the transformation of
+ * all the input units, even in case of a buffer overflow.
+ * @param src The original source string
+ * @param srcLength The length of the original string. If -1, then src must be zero-terminated.
+ * @param pErrorCode Must be a valid pointer to an error code value,
+ * which must not indicate a failure before the function call.
+ * @return The pointer to destination buffer.
+ * @stable ICU 2.0
+ */
+U_STABLE UChar* U_EXPORT2
+u_strFromUTF8(UChar *dest,
+ int32_t destCapacity,
+ int32_t *pDestLength,
+ const char *src,
+ int32_t srcLength,
+ UErrorCode *pErrorCode);
+
+/**
+ * Converts a sequence of UChars (UTF-16) to UTF32 units.
+ *
+ * @param dest A buffer for the result string. The result will be zero-terminated if
+ * the buffer is large enough.
+ * @param destCapacity The size of the buffer (number of UChar32s). If it is 0, then
+ * dest may be NULL and the function will only return the length of the
+ * result without writing any of the result string (pre-flighting).
+ * @param pDestLength A pointer to receive the number of units written to the destination. If
+ * pDestLength!=NULL then *pDestLength is always set to the
+ * number of output units corresponding to the transformation of
+ * all the input units, even in case of a buffer overflow.
+ * @param src The original source string
+ * @param srcLength The length of the original string. If -1, then src must be zero-terminated.
+ * @param pErrorCode Must be a valid pointer to an error code value,
+ * which must not indicate a failure before the function call.
+ * @return The pointer to destination buffer.
+ * @stable ICU 2.0
+ */
+U_STABLE UChar32* U_EXPORT2
+u_strToUTF32(UChar32 *dest,
+ int32_t destCapacity,
+ int32_t *pDestLength,
+ const UChar *src,
+ int32_t srcLength,
+ UErrorCode *pErrorCode);
+
+/**
+ * Converts a sequence of UTF32 units to UChars (UTF-16)
+ *
+ * @param dest A buffer for the result string. The result will be zero-terminated if
+ * the buffer is large enough.
+ * @param destCapacity The size of the buffer (number of UChars). If it is 0, then
+ * dest may be NULL and the function will only return the length of the
+ * result without writing any of the result string (pre-flighting).
+ * @param pDestLength A pointer to receive the number of units written to the destination. If
+ * pDestLength!=NULL then *pDestLength is always set to the
+ * number of output units corresponding to the transformation of
+ * all the input units, even in case of a buffer overflow.
+ * @param src The original source string
+ * @param srcLength The length of the original string. If -1, then src must be zero-terminated.
+ * @param pErrorCode Must be a valid pointer to an error code value,
+ * which must not indicate a failure before the function call.
+ * @return The pointer to destination buffer.
+ * @stable ICU 2.0
+ */
+U_STABLE UChar* U_EXPORT2
+u_strFromUTF32(UChar *dest,
+ int32_t destCapacity,
+ int32_t *pDestLength,
+ const UChar32 *src,
+ int32_t srcLength,
+ UErrorCode *pErrorCode);
+
+#endif
diff --git a/Source/JavaScriptCore/icu/unicode/utf.h b/Source/JavaScriptCore/icu/unicode/utf.h
new file mode 100644
index 0000000..201691d
--- /dev/null
+++ b/Source/JavaScriptCore/icu/unicode/utf.h
@@ -0,0 +1,221 @@
+/*
+*******************************************************************************
+*
+* Copyright (C) 1999-2004, International Business Machines
+* Corporation and others. All Rights Reserved.
+*
+*******************************************************************************
+* file name: utf.h
+* encoding: US-ASCII
+* tab size: 8 (not used)
+* indentation:4
+*
+* created on: 1999sep09
+* created by: Markus W. Scherer
+*/
+
+/**
+ * \file
+ * \brief C API: Code point macros
+ *
+ * This file defines macros for checking whether a code point is
+ * a surrogate or a non-character etc.
+ *
+ * The UChar and UChar32 data types for Unicode code units and code points
+ * are defined in umachines.h because they can be machine-dependent.
+ *
+ * utf.h is included by utypes.h and itself includes utf8.h and utf16.h after some
+ * common definitions. Those files define macros for efficiently getting code points
+ * in and out of UTF-8/16 strings.
+ * utf16.h macros have "U16_" prefixes.
+ * utf8.h defines similar macros with "U8_" prefixes for UTF-8 string handling.
+ *
+ * ICU processes 16-bit Unicode strings.
+ * Most of the time, such strings are well-formed UTF-16.
+ * Single, unpaired surrogates must be handled as well, and are treated in ICU
+ * like regular code points where possible.
+ * (Pairs of surrogate code points are indistinguishable from supplementary
+ * code points encoded as pairs of supplementary code units.)
+ *
+ * In fact, almost all Unicode code points in normal text (>99%)
+ * are on the BMP (<=U+ffff) and even <=U+d7ff.
+ * ICU functions handle supplementary code points (U+10000..U+10ffff)
+ * but are optimized for the much more frequently occurring BMP code points.
+ *
+ * utf.h defines UChar to be an unsigned 16-bit integer. If this matches wchar_t, then
+ * UChar is defined to be exactly wchar_t, otherwise uint16_t.
+ *
+ * UChar32 is defined to be a signed 32-bit integer (int32_t), large enough for a 21-bit
+ * Unicode code point (Unicode scalar value, 0..0x10ffff).
+ * Before ICU 2.4, the definition of UChar32 was similarly platform-dependent as
+ * the definition of UChar. For details see the documentation for UChar32 itself.
+ *
+ * utf.h also defines a small number of C macros for single Unicode code points.
+ * These are simple checks for surrogates and non-characters.
+ * For actual Unicode character properties see uchar.h.
+ *
+ * By default, string operations must be done with error checking in case
+ * a string is not well-formed UTF-16.
+ * The macros will detect if a surrogate code unit is unpaired
+ * (lead unit without trail unit or vice versa) and just return the unit itself
+ * as the code point.
+ * (It is an accidental property of Unicode and UTF-16 that all
+ * malformed sequences can be expressed unambiguously with a distinct subrange
+ * of Unicode code points.)
+ *
+ * When it is safe to assume that text is well-formed UTF-16
+ * (does not contain single, unpaired surrogates), then one can use
+ * U16_..._UNSAFE macros.
+ * These do not check for proper code unit sequences or truncated text and may
+ * yield wrong results or even cause a crash if they are used with "malformed"
+ * text.
+ * In practice, U16_..._UNSAFE macros will produce slightly less code but
+ * should not be faster because the processing is only different when a
+ * surrogate code unit is detected, which will be rare.
+ *
+ * Similarly for UTF-8, there are "safe" macros without a suffix,
+ * and U8_..._UNSAFE versions.
+ * The performance differences are much larger here because UTF-8 provides so
+ * many opportunities for malformed sequences.
+ * The unsafe UTF-8 macros are entirely implemented inside the macro definitions
+ * and are fast, while the safe UTF-8 macros call functions for all but the
+ * trivial (ASCII) cases.
+ *
+ * Unlike with UTF-16, malformed sequences cannot be expressed with distinct
+ * code point values (0..U+10ffff). They are indicated with negative values instead.
+ *
+ * For more information see the ICU User Guide Strings chapter
+ * (http://oss.software.ibm.com/icu/userguide/).
+ *
+ * <em>Usage:</em>
+ * ICU coding guidelines for if() statements should be followed when using these macros.
+ * Compound statements (curly braces {}) must be used for if-else-while...
+ * bodies and all macro statements should be terminated with semicolon.
+ *
+ * @stable ICU 2.4
+ */
+
+#ifndef __UTF_H__
+#define __UTF_H__
+
+#include "unicode/utypes.h"
+/* include the utfXX.h after the following definitions */
+
+/* single-code point definitions -------------------------------------------- */
+
+/**
+ * This value is intended for sentinel values for APIs that
+ * (take or) return single code points (UChar32).
+ * It is outside of the Unicode code point range 0..0x10ffff.
+ *
+ * For example, a "done" or "error" value in a new API
+ * could be indicated with U_SENTINEL.
+ *
+ * ICU APIs designed before ICU 2.4 usually define service-specific "done"
+ * values, mostly 0xffff.
+ * Those may need to be distinguished from
+ * actual U+ffff text contents by calling functions like
+ * CharacterIterator::hasNext() or UnicodeString::length().
+ *
+ * @return -1
+ * @see UChar32
+ * @stable ICU 2.4
+ */
+#define U_SENTINEL (-1)
+
+/**
+ * Is this code point a Unicode noncharacter?
+ * @param c 32-bit code point
+ * @return TRUE or FALSE
+ * @stable ICU 2.4
+ */
+#define U_IS_UNICODE_NONCHAR(c) \
+ ((c)>=0xfdd0 && \
+ ((uint32_t)(c)<=0xfdef || ((c)&0xfffe)==0xfffe) && \
+ (uint32_t)(c)<=0x10ffff)
+
+/**
+ * Is c a Unicode code point value (0..U+10ffff)
+ * that can be assigned a character?
+ *
+ * Code points that are not characters include:
+ * - single surrogate code points (U+d800..U+dfff, 2048 code points)
+ * - the last two code points on each plane (U+__fffe and U+__ffff, 34 code points)
+ * - U+fdd0..U+fdef (new with Unicode 3.1, 32 code points)
+ * - the highest Unicode code point value is U+10ffff
+ *
+ * This means that all code points below U+d800 are character code points,
+ * and that boundary is tested first for performance.
+ *
+ * @param c 32-bit code point
+ * @return TRUE or FALSE
+ * @stable ICU 2.4
+ */
+#define U_IS_UNICODE_CHAR(c) \
+ ((uint32_t)(c)<0xd800 || \
+ ((uint32_t)(c)>0xdfff && \
+ (uint32_t)(c)<=0x10ffff && \
+ !U_IS_UNICODE_NONCHAR(c)))
+
+#ifndef U_HIDE_DRAFT_API
+
+/**
+ * Is this code point a BMP code point (U+0000..U+ffff)?
+ * @param c 32-bit code point
+ * @return TRUE or FALSE
+ * @draft ICU 2.8
+ */
+#define U_IS_BMP(c) ((uint32_t)(c)<=0xffff)
+
+/**
+ * Is this code point a supplementary code point (U+10000..U+10ffff)?
+ * @param c 32-bit code point
+ * @return TRUE or FALSE
+ * @draft ICU 2.8
+ */
+#define U_IS_SUPPLEMENTARY(c) ((uint32_t)((c)-0x10000)<=0xfffff)
+
+#endif /*U_HIDE_DRAFT_API*/
+
+/**
+ * Is this code point a lead surrogate (U+d800..U+dbff)?
+ * @param c 32-bit code point
+ * @return TRUE or FALSE
+ * @stable ICU 2.4
+ */
+#define U_IS_LEAD(c) (((c)&0xfffffc00)==0xd800)
+
+/**
+ * Is this code point a trail surrogate (U+dc00..U+dfff)?
+ * @param c 32-bit code point
+ * @return TRUE or FALSE
+ * @stable ICU 2.4
+ */
+#define U_IS_TRAIL(c) (((c)&0xfffffc00)==0xdc00)
+
+/**
+ * Is this code point a surrogate (U+d800..U+dfff)?
+ * @param c 32-bit code point
+ * @return TRUE or FALSE
+ * @stable ICU 2.4
+ */
+#define U_IS_SURROGATE(c) (((c)&0xfffff800)==0xd800)
+
+/**
+ * Assuming c is a surrogate code point (U_IS_SURROGATE(c)),
+ * is it a lead surrogate?
+ * @param c 32-bit code point
+ * @return TRUE or FALSE
+ * @stable ICU 2.4
+ */
+#define U_IS_SURROGATE_LEAD(c) (((c)&0x400)==0)
+
+/* include the utfXX.h ------------------------------------------------------ */
+
+#include "unicode/utf8.h"
+#include "unicode/utf16.h"
+
+/* utf_old.h contains deprecated, pre-ICU 2.4 definitions */
+#include "unicode/utf_old.h"
+
+#endif
diff --git a/Source/JavaScriptCore/icu/unicode/utf16.h b/Source/JavaScriptCore/icu/unicode/utf16.h
new file mode 100644
index 0000000..7bf3872
--- /dev/null
+++ b/Source/JavaScriptCore/icu/unicode/utf16.h
@@ -0,0 +1,605 @@
+/*
+*******************************************************************************
+*
+* Copyright (C) 1999-2004, International Business Machines
+* Corporation and others. All Rights Reserved.
+*
+*******************************************************************************
+* file name: utf16.h
+* encoding: US-ASCII
+* tab size: 8 (not used)
+* indentation:4
+*
+* created on: 1999sep09
+* created by: Markus W. Scherer
+*/
+
+/**
+ * \file
+ * \brief C API: 16-bit Unicode handling macros
+ *
+ * This file defines macros to deal with 16-bit Unicode (UTF-16) code units and strings.
+ * utf16.h is included by utf.h after unicode/umachine.h
+ * and some common definitions.
+ *
+ * For more information see utf.h and the ICU User Guide Strings chapter
+ * (http://oss.software.ibm.com/icu/userguide/).
+ *
+ * <em>Usage:</em>
+ * ICU coding guidelines for if() statements should be followed when using these macros.
+ * Compound statements (curly braces {}) must be used for if-else-while...
+ * bodies and all macro statements should be terminated with semicolon.
+ */
+
+#ifndef __UTF16_H__
+#define __UTF16_H__
+
+/* utf.h must be included first. */
+#ifndef __UTF_H__
+# include "unicode/utf.h"
+#endif
+
+/* single-code point definitions -------------------------------------------- */
+
+/**
+ * Does this code unit alone encode a code point (BMP, not a surrogate)?
+ * @param c 16-bit code unit
+ * @return TRUE or FALSE
+ * @stable ICU 2.4
+ */
+#define U16_IS_SINGLE(c) !U_IS_SURROGATE(c)
+
+/**
+ * Is this code unit a lead surrogate (U+d800..U+dbff)?
+ * @param c 16-bit code unit
+ * @return TRUE or FALSE
+ * @stable ICU 2.4
+ */
+#define U16_IS_LEAD(c) (((c)&0xfffffc00)==0xd800)
+
+/**
+ * Is this code unit a trail surrogate (U+dc00..U+dfff)?
+ * @param c 16-bit code unit
+ * @return TRUE or FALSE
+ * @stable ICU 2.4
+ */
+#define U16_IS_TRAIL(c) (((c)&0xfffffc00)==0xdc00)
+
+/**
+ * Is this code unit a surrogate (U+d800..U+dfff)?
+ * @param c 16-bit code unit
+ * @return TRUE or FALSE
+ * @stable ICU 2.4
+ */
+#define U16_IS_SURROGATE(c) U_IS_SURROGATE(c)
+
+/**
+ * Assuming c is a surrogate code point (U16_IS_SURROGATE(c)),
+ * is it a lead surrogate?
+ * @param c 16-bit code unit
+ * @return TRUE or FALSE
+ * @stable ICU 2.4
+ */
+#define U16_IS_SURROGATE_LEAD(c) (((c)&0x400)==0)
+
+/**
+ * Helper constant for U16_GET_SUPPLEMENTARY.
+ * @internal
+ */
+#define U16_SURROGATE_OFFSET ((0xd800<<10UL)+0xdc00-0x10000)
+
+/**
+ * Get a supplementary code point value (U+10000..U+10ffff)
+ * from its lead and trail surrogates.
+ * The result is undefined if the input values are not
+ * lead and trail surrogates.
+ *
+ * @param lead lead surrogate (U+d800..U+dbff)
+ * @param trail trail surrogate (U+dc00..U+dfff)
+ * @return supplementary code point (U+10000..U+10ffff)
+ * @stable ICU 2.4
+ */
+#define U16_GET_SUPPLEMENTARY(lead, trail) \
+ (((UChar32)(lead)<<10UL)+(UChar32)(trail)-U16_SURROGATE_OFFSET)
+
+
+/**
+ * Get the lead surrogate (0xd800..0xdbff) for a
+ * supplementary code point (0x10000..0x10ffff).
+ * @param supplementary 32-bit code point (U+10000..U+10ffff)
+ * @return lead surrogate (U+d800..U+dbff) for supplementary
+ * @stable ICU 2.4
+ */
+#define U16_LEAD(supplementary) (UChar)(((supplementary)>>10)+0xd7c0)
+
+/**
+ * Get the trail surrogate (0xdc00..0xdfff) for a
+ * supplementary code point (0x10000..0x10ffff).
+ * @param supplementary 32-bit code point (U+10000..U+10ffff)
+ * @return trail surrogate (U+dc00..U+dfff) for supplementary
+ * @stable ICU 2.4
+ */
+#define U16_TRAIL(supplementary) (UChar)(((supplementary)&0x3ff)|0xdc00)
+
+/**
+ * How many 16-bit code units are used to encode this Unicode code point? (1 or 2)
+ * The result is not defined if c is not a Unicode code point (U+0000..U+10ffff).
+ * @param c 32-bit code point
+ * @return 1 or 2
+ * @stable ICU 2.4
+ */
+#define U16_LENGTH(c) ((uint32_t)(c)<=0xffff ? 1 : 2)
+
+/**
+ * The maximum number of 16-bit code units per Unicode code point (U+0000..U+10ffff).
+ * @return 2
+ * @stable ICU 2.4
+ */
+#define U16_MAX_LENGTH 2
+
+/**
+ * Get a code point from a string at a random-access offset,
+ * without changing the offset.
+ * "Unsafe" macro, assumes well-formed UTF-16.
+ *
+ * The offset may point to either the lead or trail surrogate unit
+ * for a supplementary code point, in which case the macro will read
+ * the adjacent matching surrogate as well.
+ * The result is undefined if the offset points to a single, unpaired surrogate.
+ * Iteration through a string is more efficient with U16_NEXT_UNSAFE or U16_NEXT.
+ *
+ * @param s const UChar * string
+ * @param i string offset
+ * @param c output UChar32 variable
+ * @see U16_GET
+ * @stable ICU 2.4
+ */
+#define U16_GET_UNSAFE(s, i, c) { \
+ (c)=(s)[i]; \
+ if(U16_IS_SURROGATE(c)) { \
+ if(U16_IS_SURROGATE_LEAD(c)) { \
+ (c)=U16_GET_SUPPLEMENTARY((c), (s)[(i)+1]); \
+ } else { \
+ (c)=U16_GET_SUPPLEMENTARY((s)[(i)-1], (c)); \
+ } \
+ } \
+}
+
+/**
+ * Get a code point from a string at a random-access offset,
+ * without changing the offset.
+ * "Safe" macro, handles unpaired surrogates and checks for string boundaries.
+ *
+ * The offset may point to either the lead or trail surrogate unit
+ * for a supplementary code point, in which case the macro will read
+ * the adjacent matching surrogate as well.
+ * If the offset points to a single, unpaired surrogate, then that itself
+ * will be returned as the code point.
+ * Iteration through a string is more efficient with U16_NEXT_UNSAFE or U16_NEXT.
+ *
+ * @param s const UChar * string
+ * @param start starting string offset (usually 0)
+ * @param i string offset, start<=i<length
+ * @param length string length
+ * @param c output UChar32 variable
+ * @see U16_GET_UNSAFE
+ * @stable ICU 2.4
+ */
+#define U16_GET(s, start, i, length, c) { \
+ (c)=(s)[i]; \
+ if(U16_IS_SURROGATE(c)) { \
+ uint16_t __c2; \
+ if(U16_IS_SURROGATE_LEAD(c)) { \
+ if((i)+1<(length) && U16_IS_TRAIL(__c2=(s)[(i)+1])) { \
+ (c)=U16_GET_SUPPLEMENTARY((c), __c2); \
+ } \
+ } else { \
+ if((i)-1>=(start) && U16_IS_LEAD(__c2=(s)[(i)-1])) { \
+ (c)=U16_GET_SUPPLEMENTARY(__c2, (c)); \
+ } \
+ } \
+ } \
+}
+
+/* definitions with forward iteration --------------------------------------- */
+
+/**
+ * Get a code point from a string at a code point boundary offset,
+ * and advance the offset to the next code point boundary.
+ * (Post-incrementing forward iteration.)
+ * "Unsafe" macro, assumes well-formed UTF-16.
+ *
+ * The offset may point to the lead surrogate unit
+ * for a supplementary code point, in which case the macro will read
+ * the following trail surrogate as well.
+ * If the offset points to a trail surrogate, then that itself
+ * will be returned as the code point.
+ * The result is undefined if the offset points to a single, unpaired lead surrogate.
+ *
+ * @param s const UChar * string
+ * @param i string offset
+ * @param c output UChar32 variable
+ * @see U16_NEXT
+ * @stable ICU 2.4
+ */
+#define U16_NEXT_UNSAFE(s, i, c) { \
+ (c)=(s)[(i)++]; \
+ if(U16_IS_LEAD(c)) { \
+ (c)=U16_GET_SUPPLEMENTARY((c), (s)[(i)++]); \
+ } \
+}
+
+/**
+ * Get a code point from a string at a code point boundary offset,
+ * and advance the offset to the next code point boundary.
+ * (Post-incrementing forward iteration.)
+ * "Safe" macro, handles unpaired surrogates and checks for string boundaries.
+ *
+ * The offset may point to the lead surrogate unit
+ * for a supplementary code point, in which case the macro will read
+ * the following trail surrogate as well.
+ * If the offset points to a trail surrogate or
+ * to a single, unpaired lead surrogate, then that itself
+ * will be returned as the code point.
+ *
+ * @param s const UChar * string
+ * @param i string offset, i<length
+ * @param length string length
+ * @param c output UChar32 variable
+ * @see U16_NEXT_UNSAFE
+ * @stable ICU 2.4
+ */
+#define U16_NEXT(s, i, length, c) { \
+ (c)=(s)[(i)++]; \
+ if(U16_IS_LEAD(c)) { \
+ uint16_t __c2; \
+ if((i)<(length) && U16_IS_TRAIL(__c2=(s)[(i)])) { \
+ ++(i); \
+ (c)=U16_GET_SUPPLEMENTARY((c), __c2); \
+ } \
+ } \
+}
+
+/**
+ * Append a code point to a string, overwriting 1 or 2 code units.
+ * The offset points to the current end of the string contents
+ * and is advanced (post-increment).
+ * "Unsafe" macro, assumes a valid code point and sufficient space in the string.
+ * Otherwise, the result is undefined.
+ *
+ * @param s const UChar * string buffer
+ * @param i string offset
+ * @param c code point to append
+ * @see U16_APPEND
+ * @stable ICU 2.4
+ */
+#define U16_APPEND_UNSAFE(s, i, c) { \
+ if((uint32_t)(c)<=0xffff) { \
+ (s)[(i)++]=(uint16_t)(c); \
+ } else { \
+ (s)[(i)++]=(uint16_t)(((c)>>10)+0xd7c0); \
+ (s)[(i)++]=(uint16_t)(((c)&0x3ff)|0xdc00); \
+ } \
+}
+
+/**
+ * Append a code point to a string, overwriting 1 or 2 code units.
+ * The offset points to the current end of the string contents
+ * and is advanced (post-increment).
+ * "Safe" macro, checks for a valid code point.
+ * If a surrogate pair is written, checks for sufficient space in the string.
+ * If the code point is not valid or a trail surrogate does not fit,
+ * then isError is set to TRUE.
+ *
+ * @param s const UChar * string buffer
+ * @param i string offset, i<length
+ * @param capacity size of the string buffer
+ * @param c code point to append
+ * @param isError output UBool set to TRUE if an error occurs, otherwise not modified
+ * @see U16_APPEND_UNSAFE
+ * @stable ICU 2.4
+ */
+#define U16_APPEND(s, i, capacity, c, isError) { \
+ if((uint32_t)(c)<=0xffff) { \
+ (s)[(i)++]=(uint16_t)(c); \
+ } else if((uint32_t)(c)<=0x10ffff && (i)+1<(capacity)) { \
+ (s)[(i)++]=(uint16_t)(((c)>>10)+0xd7c0); \
+ (s)[(i)++]=(uint16_t)(((c)&0x3ff)|0xdc00); \
+ } else /* c>0x10ffff or not enough space */ { \
+ (isError)=TRUE; \
+ } \
+}
+
+/**
+ * Advance the string offset from one code point boundary to the next.
+ * (Post-incrementing iteration.)
+ * "Unsafe" macro, assumes well-formed UTF-16.
+ *
+ * @param s const UChar * string
+ * @param i string offset
+ * @see U16_FWD_1
+ * @stable ICU 2.4
+ */
+#define U16_FWD_1_UNSAFE(s, i) { \
+ if(U16_IS_LEAD((s)[(i)++])) { \
+ ++(i); \
+ } \
+}
+
+/**
+ * Advance the string offset from one code point boundary to the next.
+ * (Post-incrementing iteration.)
+ * "Safe" macro, handles unpaired surrogates and checks for string boundaries.
+ *
+ * @param s const UChar * string
+ * @param i string offset, i<length
+ * @param length string length
+ * @see U16_FWD_1_UNSAFE
+ * @stable ICU 2.4
+ */
+#define U16_FWD_1(s, i, length) { \
+ if(U16_IS_LEAD((s)[(i)++]) && (i)<(length) && U16_IS_TRAIL((s)[i])) { \
+ ++(i); \
+ } \
+}
+
+/**
+ * Advance the string offset from one code point boundary to the n-th next one,
+ * i.e., move forward by n code points.
+ * (Post-incrementing iteration.)
+ * "Unsafe" macro, assumes well-formed UTF-16.
+ *
+ * @param s const UChar * string
+ * @param i string offset
+ * @param n number of code points to skip
+ * @see U16_FWD_N
+ * @stable ICU 2.4
+ */
+#define U16_FWD_N_UNSAFE(s, i, n) { \
+ int32_t __N=(n); \
+ while(__N>0) { \
+ U16_FWD_1_UNSAFE(s, i); \
+ --__N; \
+ } \
+}
+
+/**
+ * Advance the string offset from one code point boundary to the n-th next one,
+ * i.e., move forward by n code points.
+ * (Post-incrementing iteration.)
+ * "Safe" macro, handles unpaired surrogates and checks for string boundaries.
+ *
+ * @param s const UChar * string
+ * @param i string offset, i<length
+ * @param length string length
+ * @param n number of code points to skip
+ * @see U16_FWD_N_UNSAFE
+ * @stable ICU 2.4
+ */
+#define U16_FWD_N(s, i, length, n) { \
+ int32_t __N=(n); \
+ while(__N>0 && (i)<(length)) { \
+ U16_FWD_1(s, i, length); \
+ --__N; \
+ } \
+}
+
+/**
+ * Adjust a random-access offset to a code point boundary
+ * at the start of a code point.
+ * If the offset points to the trail surrogate of a surrogate pair,
+ * then the offset is decremented.
+ * Otherwise, it is not modified.
+ * "Unsafe" macro, assumes well-formed UTF-16.
+ *
+ * @param s const UChar * string
+ * @param i string offset
+ * @see U16_SET_CP_START
+ * @stable ICU 2.4
+ */
+#define U16_SET_CP_START_UNSAFE(s, i) { \
+ if(U16_IS_TRAIL((s)[i])) { \
+ --(i); \
+ } \
+}
+
+/**
+ * Adjust a random-access offset to a code point boundary
+ * at the start of a code point.
+ * If the offset points to the trail surrogate of a surrogate pair,
+ * then the offset is decremented.
+ * Otherwise, it is not modified.
+ * "Safe" macro, handles unpaired surrogates and checks for string boundaries.
+ *
+ * @param s const UChar * string
+ * @param start starting string offset (usually 0)
+ * @param i string offset, start<=i
+ * @see U16_SET_CP_START_UNSAFE
+ * @stable ICU 2.4
+ */
+#define U16_SET_CP_START(s, start, i) { \
+ if(U16_IS_TRAIL((s)[i]) && (i)>(start) && U16_IS_LEAD((s)[(i)-1])) { \
+ --(i); \
+ } \
+}
+
+/* definitions with backward iteration -------------------------------------- */
+
+/**
+ * Move the string offset from one code point boundary to the previous one
+ * and get the code point between them.
+ * (Pre-decrementing backward iteration.)
+ * "Unsafe" macro, assumes well-formed UTF-16.
+ *
+ * The input offset may be the same as the string length.
+ * If the offset is behind a trail surrogate unit
+ * for a supplementary code point, then the macro will read
+ * the preceding lead surrogate as well.
+ * If the offset is behind a lead surrogate, then that itself
+ * will be returned as the code point.
+ * The result is undefined if the offset is behind a single, unpaired trail surrogate.
+ *
+ * @param s const UChar * string
+ * @param i string offset
+ * @param c output UChar32 variable
+ * @see U16_PREV
+ * @stable ICU 2.4
+ */
+#define U16_PREV_UNSAFE(s, i, c) { \
+ (c)=(s)[--(i)]; \
+ if(U16_IS_TRAIL(c)) { \
+ (c)=U16_GET_SUPPLEMENTARY((s)[--(i)], (c)); \
+ } \
+}
+
+/**
+ * Move the string offset from one code point boundary to the previous one
+ * and get the code point between them.
+ * (Pre-decrementing backward iteration.)
+ * "Safe" macro, handles unpaired surrogates and checks for string boundaries.
+ *
+ * The input offset may be the same as the string length.
+ * If the offset is behind a trail surrogate unit
+ * for a supplementary code point, then the macro will read
+ * the preceding lead surrogate as well.
+ * If the offset is behind a lead surrogate or behind a single, unpaired
+ * trail surrogate, then that itself
+ * will be returned as the code point.
+ *
+ * @param s const UChar * string
+ * @param start starting string offset (usually 0)
+ * @param i string offset, start<=i
+ * @param c output UChar32 variable
+ * @see U16_PREV_UNSAFE
+ * @stable ICU 2.4
+ */
+#define U16_PREV(s, start, i, c) { \
+ (c)=(s)[--(i)]; \
+ if(U16_IS_TRAIL(c)) { \
+ uint16_t __c2; \
+ if((i)>(start) && U16_IS_LEAD(__c2=(s)[(i)-1])) { \
+ --(i); \
+ (c)=U16_GET_SUPPLEMENTARY(__c2, (c)); \
+ } \
+ } \
+}
+
+/**
+ * Move the string offset from one code point boundary to the previous one.
+ * (Pre-decrementing backward iteration.)
+ * The input offset may be the same as the string length.
+ * "Unsafe" macro, assumes well-formed UTF-16.
+ *
+ * @param s const UChar * string
+ * @param i string offset
+ * @see U16_BACK_1
+ * @stable ICU 2.4
+ */
+#define U16_BACK_1_UNSAFE(s, i) { \
+ if(U16_IS_TRAIL((s)[--(i)])) { \
+ --(i); \
+ } \
+}
+
+/**
+ * Move the string offset from one code point boundary to the previous one.
+ * (Pre-decrementing backward iteration.)
+ * The input offset may be the same as the string length.
+ * "Safe" macro, handles unpaired surrogates and checks for string boundaries.
+ *
+ * @param s const UChar * string
+ * @param start starting string offset (usually 0)
+ * @param i string offset, start<=i
+ * @see U16_BACK_1_UNSAFE
+ * @stable ICU 2.4
+ */
+#define U16_BACK_1(s, start, i) { \
+ if(U16_IS_TRAIL((s)[--(i)]) && (i)>(start) && U16_IS_LEAD((s)[(i)-1])) { \
+ --(i); \
+ } \
+}
+
+/**
+ * Move the string offset from one code point boundary to the n-th one before it,
+ * i.e., move backward by n code points.
+ * (Pre-decrementing backward iteration.)
+ * The input offset may be the same as the string length.
+ * "Unsafe" macro, assumes well-formed UTF-16.
+ *
+ * @param s const UChar * string
+ * @param i string offset
+ * @param n number of code points to skip
+ * @see U16_BACK_N
+ * @stable ICU 2.4
+ */
+#define U16_BACK_N_UNSAFE(s, i, n) { \
+ int32_t __N=(n); \
+ while(__N>0) { \
+ U16_BACK_1_UNSAFE(s, i); \
+ --__N; \
+ } \
+}
+
+/**
+ * Move the string offset from one code point boundary to the n-th one before it,
+ * i.e., move backward by n code points.
+ * (Pre-decrementing backward iteration.)
+ * The input offset may be the same as the string length.
+ * "Safe" macro, handles unpaired surrogates and checks for string boundaries.
+ *
+ * @param s const UChar * string
+ * @param start start of string
+ * @param i string offset, i<length
+ * @param n number of code points to skip
+ * @see U16_BACK_N_UNSAFE
+ * @stable ICU 2.4
+ */
+#define U16_BACK_N(s, start, i, n) { \
+ int32_t __N=(n); \
+ while(__N>0 && (i)>(start)) { \
+ U16_BACK_1(s, start, i); \
+ --__N; \
+ } \
+}
+
+/**
+ * Adjust a random-access offset to a code point boundary after a code point.
+ * If the offset is behind the lead surrogate of a surrogate pair,
+ * then the offset is incremented.
+ * Otherwise, it is not modified.
+ * The input offset may be the same as the string length.
+ * "Unsafe" macro, assumes well-formed UTF-16.
+ *
+ * @param s const UChar * string
+ * @param i string offset
+ * @see U16_SET_CP_LIMIT
+ * @stable ICU 2.4
+ */
+#define U16_SET_CP_LIMIT_UNSAFE(s, i) { \
+ if(U16_IS_LEAD((s)[(i)-1])) { \
+ ++(i); \
+ } \
+}
+
+/**
+ * Adjust a random-access offset to a code point boundary after a code point.
+ * If the offset is behind the lead surrogate of a surrogate pair,
+ * then the offset is incremented.
+ * Otherwise, it is not modified.
+ * The input offset may be the same as the string length.
+ * "Safe" macro, handles unpaired surrogates and checks for string boundaries.
+ *
+ * @param s const UChar * string
+ * @param start starting string offset (usually 0)
+ * @param i string offset, start<=i<=length
+ * @param length string length
+ * @see U16_SET_CP_LIMIT_UNSAFE
+ * @stable ICU 2.4
+ */
+#define U16_SET_CP_LIMIT(s, start, i, length) { \
+ if((start)<(i) && (i)<(length) && U16_IS_LEAD((s)[(i)-1]) && U16_IS_TRAIL((s)[i])) { \
+ ++(i); \
+ } \
+}
+
+#endif
diff --git a/Source/JavaScriptCore/icu/unicode/utf8.h b/Source/JavaScriptCore/icu/unicode/utf8.h
new file mode 100644
index 0000000..f83662b
--- /dev/null
+++ b/Source/JavaScriptCore/icu/unicode/utf8.h
@@ -0,0 +1,627 @@
+/*
+*******************************************************************************
+*
+* Copyright (C) 1999-2004, International Business Machines
+* Corporation and others. All Rights Reserved.
+*
+*******************************************************************************
+* file name: utf8.h
+* encoding: US-ASCII
+* tab size: 8 (not used)
+* indentation:4
+*
+* created on: 1999sep13
+* created by: Markus W. Scherer
+*/
+
+/**
+ * \file
+ * \brief C API: 8-bit Unicode handling macros
+ *
+ * This file defines macros to deal with 8-bit Unicode (UTF-8) code units (bytes) and strings.
+ * utf8.h is included by utf.h after unicode/umachine.h
+ * and some common definitions.
+ *
+ * For more information see utf.h and the ICU User Guide Strings chapter
+ * (http://oss.software.ibm.com/icu/userguide/).
+ *
+ * <em>Usage:</em>
+ * ICU coding guidelines for if() statements should be followed when using these macros.
+ * Compound statements (curly braces {}) must be used for if-else-while...
+ * bodies and all macro statements should be terminated with semicolon.
+ */
+
+#ifndef __UTF8_H__
+#define __UTF8_H__
+
+/* utf.h must be included first. */
+#ifndef __UTF_H__
+# include "unicode/utf.h"
+#endif
+
+/* internal definitions ----------------------------------------------------- */
+
+/**
+ * \var utf8_countTrailBytes
+ * Internal array with numbers of trail bytes for any given byte used in
+ * lead byte position.
+ * @internal
+ */
+#ifdef U_UTF8_IMPL
+U_INTERNAL const uint8_t
+#elif defined(U_STATIC_IMPLEMENTATION)
+U_CFUNC const uint8_t
+#else
+U_CFUNC U_IMPORT const uint8_t /* U_IMPORT2? */ /*U_IMPORT*/
+#endif
+utf8_countTrailBytes[256];
+
+/**
+ * Count the trail bytes for a UTF-8 lead byte.
+ * @internal
+ */
+#define U8_COUNT_TRAIL_BYTES(leadByte) (utf8_countTrailBytes[(uint8_t)leadByte])
+
+/**
+ * Mask a UTF-8 lead byte, leave only the lower bits that form part of the code point value.
+ * @internal
+ */
+#define U8_MASK_LEAD_BYTE(leadByte, countTrailBytes) ((leadByte)&=(1<<(6-(countTrailBytes)))-1)
+
+/**
+ * Function for handling "next code point" with error-checking.
+ * @internal
+ */
+U_INTERNAL UChar32 U_EXPORT2
+utf8_nextCharSafeBody(const uint8_t *s, int32_t *pi, int32_t length, UChar32 c, UBool strict);
+
+/**
+ * Function for handling "append code point" with error-checking.
+ * @internal
+ */
+U_INTERNAL int32_t U_EXPORT2
+utf8_appendCharSafeBody(uint8_t *s, int32_t i, int32_t length, UChar32 c, UBool *pIsError);
+
+/**
+ * Function for handling "previous code point" with error-checking.
+ * @internal
+ */
+U_INTERNAL UChar32 U_EXPORT2
+utf8_prevCharSafeBody(const uint8_t *s, int32_t start, int32_t *pi, UChar32 c, UBool strict);
+
+/**
+ * Function for handling "skip backward one code point" with error-checking.
+ * @internal
+ */
+U_INTERNAL int32_t U_EXPORT2
+utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i);
+
+/* single-code point definitions -------------------------------------------- */
+
+/**
+ * Does this code unit (byte) encode a code point by itself (US-ASCII 0..0x7f)?
+ * @param c 8-bit code unit (byte)
+ * @return TRUE or FALSE
+ * @stable ICU 2.4
+ */
+#define U8_IS_SINGLE(c) (((c)&0x80)==0)
+
+/**
+ * Is this code unit (byte) a UTF-8 lead byte?
+ * @param c 8-bit code unit (byte)
+ * @return TRUE or FALSE
+ * @stable ICU 2.4
+ */
+#define U8_IS_LEAD(c) ((uint8_t)((c)-0xc0)<0x3e)
+
+/**
+ * Is this code unit (byte) a UTF-8 trail byte?
+ * @param c 8-bit code unit (byte)
+ * @return TRUE or FALSE
+ * @stable ICU 2.4
+ */
+#define U8_IS_TRAIL(c) (((c)&0xc0)==0x80)
+
+/**
+ * How many code units (bytes) are used for the UTF-8 encoding
+ * of this Unicode code point?
+ * @param c 32-bit code point
+ * @return 1..4, or 0 if c is a surrogate or not a Unicode code point
+ * @stable ICU 2.4
+ */
+#define U8_LENGTH(c) \
+ ((uint32_t)(c)<=0x7f ? 1 : \
+ ((uint32_t)(c)<=0x7ff ? 2 : \
+ ((uint32_t)(c)<=0xd7ff ? 3 : \
+ ((uint32_t)(c)<=0xdfff || (uint32_t)(c)>0x10ffff ? 0 : \
+ ((uint32_t)(c)<=0xffff ? 3 : 4)\
+ ) \
+ ) \
+ ) \
+ )
+
+/**
+ * The maximum number of UTF-8 code units (bytes) per Unicode code point (U+0000..U+10ffff).
+ * @return 4
+ * @stable ICU 2.4
+ */
+#define U8_MAX_LENGTH 4
+
+/**
+ * Get a code point from a string at a random-access offset,
+ * without changing the offset.
+ * The offset may point to either the lead byte or one of the trail bytes
+ * for a code point, in which case the macro will read all of the bytes
+ * for the code point.
+ * The result is undefined if the offset points to an illegal UTF-8
+ * byte sequence.
+ * Iteration through a string is more efficient with U8_NEXT_UNSAFE or U8_NEXT.
+ *
+ * @param s const uint8_t * string
+ * @param i string offset
+ * @param c output UChar32 variable
+ * @see U8_GET
+ * @stable ICU 2.4
+ */
+#define U8_GET_UNSAFE(s, i, c) { \
+ int32_t _u8_get_unsafe_index=(int32_t)(i); \
+ U8_SET_CP_START_UNSAFE(s, _u8_get_unsafe_index); \
+ U8_NEXT_UNSAFE(s, _u8_get_unsafe_index, c); \
+}
+
+/**
+ * Get a code point from a string at a random-access offset,
+ * without changing the offset.
+ * The offset may point to either the lead byte or one of the trail bytes
+ * for a code point, in which case the macro will read all of the bytes
+ * for the code point.
+ * If the offset points to an illegal UTF-8 byte sequence, then
+ * c is set to a negative value.
+ * Iteration through a string is more efficient with U8_NEXT_UNSAFE or U8_NEXT.
+ *
+ * @param s const uint8_t * string
+ * @param start starting string offset
+ * @param i string offset, start<=i<length
+ * @param length string length
+ * @param c output UChar32 variable, set to <0 in case of an error
+ * @see U8_GET_UNSAFE
+ * @stable ICU 2.4
+ */
+#define U8_GET(s, start, i, length, c) { \
+ int32_t _u8_get_index=(int32_t)(i); \
+ U8_SET_CP_START(s, start, _u8_get_index); \
+ U8_NEXT(s, _u8_get_index, length, c); \
+}
+
+/* definitions with forward iteration --------------------------------------- */
+
+/**
+ * Get a code point from a string at a code point boundary offset,
+ * and advance the offset to the next code point boundary.
+ * (Post-incrementing forward iteration.)
+ * "Unsafe" macro, assumes well-formed UTF-8.
+ *
+ * The offset may point to the lead byte of a multi-byte sequence,
+ * in which case the macro will read the whole sequence.
+ * The result is undefined if the offset points to a trail byte
+ * or an illegal UTF-8 sequence.
+ *
+ * @param s const uint8_t * string
+ * @param i string offset
+ * @param c output UChar32 variable
+ * @see U8_NEXT
+ * @stable ICU 2.4
+ */
+#define U8_NEXT_UNSAFE(s, i, c) { \
+ (c)=(s)[(i)++]; \
+ if((uint8_t)((c)-0xc0)<0x35) { \
+ uint8_t __count=U8_COUNT_TRAIL_BYTES(c); \
+ U8_MASK_LEAD_BYTE(c, __count); \
+ switch(__count) { \
+ /* each following branch falls through to the next one */ \
+ case 3: \
+ (c)=((c)<<6)|((s)[(i)++]&0x3f); \
+ case 2: \
+ (c)=((c)<<6)|((s)[(i)++]&0x3f); \
+ case 1: \
+ (c)=((c)<<6)|((s)[(i)++]&0x3f); \
+ /* no other branches to optimize switch() */ \
+ break; \
+ } \
+ } \
+}
+
+/**
+ * Get a code point from a string at a code point boundary offset,
+ * and advance the offset to the next code point boundary.
+ * (Post-incrementing forward iteration.)
+ * "Safe" macro, checks for illegal sequences and for string boundaries.
+ *
+ * The offset may point to the lead byte of a multi-byte sequence,
+ * in which case the macro will read the whole sequence.
+ * If the offset points to a trail byte or an illegal UTF-8 sequence, then
+ * c is set to a negative value.
+ *
+ * @param s const uint8_t * string
+ * @param i string offset, i<length
+ * @param length string length
+ * @param c output UChar32 variable, set to <0 in case of an error
+ * @see U8_NEXT_UNSAFE
+ * @stable ICU 2.4
+ */
+#define U8_NEXT(s, i, length, c) { \
+ (c)=(s)[(i)++]; \
+ if(((uint8_t)(c))>=0x80) { \
+ if(U8_IS_LEAD(c)) { \
+ (c)=utf8_nextCharSafeBody((const uint8_t *)s, &(i), (int32_t)(length), c, -1); \
+ } else { \
+ (c)=U_SENTINEL; \
+ } \
+ } \
+}
+
+/**
+ * Append a code point to a string, overwriting 1 to 4 bytes.
+ * The offset points to the current end of the string contents
+ * and is advanced (post-increment).
+ * "Unsafe" macro, assumes a valid code point and sufficient space in the string.
+ * Otherwise, the result is undefined.
+ *
+ * @param s const uint8_t * string buffer
+ * @param i string offset
+ * @param c code point to append
+ * @see U8_APPEND
+ * @stable ICU 2.4
+ */
+#define U8_APPEND_UNSAFE(s, i, c) { \
+ if((uint32_t)(c)<=0x7f) { \
+ (s)[(i)++]=(uint8_t)(c); \
+ } else { \
+ if((uint32_t)(c)<=0x7ff) { \
+ (s)[(i)++]=(uint8_t)(((c)>>6)|0xc0); \
+ } else { \
+ if((uint32_t)(c)<=0xffff) { \
+ (s)[(i)++]=(uint8_t)(((c)>>12)|0xe0); \
+ } else { \
+ (s)[(i)++]=(uint8_t)(((c)>>18)|0xf0); \
+ (s)[(i)++]=(uint8_t)((((c)>>12)&0x3f)|0x80); \
+ } \
+ (s)[(i)++]=(uint8_t)((((c)>>6)&0x3f)|0x80); \
+ } \
+ (s)[(i)++]=(uint8_t)(((c)&0x3f)|0x80); \
+ } \
+}
+
+/**
+ * Append a code point to a string, overwriting 1 or 2 code units.
+ * The offset points to the current end of the string contents
+ * and is advanced (post-increment).
+ * "Safe" macro, checks for a valid code point.
+ * If a non-ASCII code point is written, checks for sufficient space in the string.
+ * If the code point is not valid or trail bytes do not fit,
+ * then isError is set to TRUE.
+ *
+ * @param s const uint8_t * string buffer
+ * @param i string offset, i<length
+ * @param length size of the string buffer
+ * @param c code point to append
+ * @param isError output UBool set to TRUE if an error occurs, otherwise not modified
+ * @see U8_APPEND_UNSAFE
+ * @stable ICU 2.4
+ */
+#define U8_APPEND(s, i, length, c, isError) { \
+ if((uint32_t)(c)<=0x7f) { \
+ (s)[(i)++]=(uint8_t)(c); \
+ } else { \
+ (i)=utf8_appendCharSafeBody(s, (int32_t)(i), (int32_t)(length), c, &(isError)); \
+ } \
+}
+
+/**
+ * Advance the string offset from one code point boundary to the next.
+ * (Post-incrementing iteration.)
+ * "Unsafe" macro, assumes well-formed UTF-8.
+ *
+ * @param s const uint8_t * string
+ * @param i string offset
+ * @see U8_FWD_1
+ * @stable ICU 2.4
+ */
+#define U8_FWD_1_UNSAFE(s, i) { \
+ (i)+=1+U8_COUNT_TRAIL_BYTES((s)[i]); \
+}
+
+/**
+ * Advance the string offset from one code point boundary to the next.
+ * (Post-incrementing iteration.)
+ * "Safe" macro, checks for illegal sequences and for string boundaries.
+ *
+ * @param s const uint8_t * string
+ * @param i string offset, i<length
+ * @param length string length
+ * @see U8_FWD_1_UNSAFE
+ * @stable ICU 2.4
+ */
+#define U8_FWD_1(s, i, length) { \
+ uint8_t __b=(s)[(i)++]; \
+ if(U8_IS_LEAD(__b)) { \
+ uint8_t __count=U8_COUNT_TRAIL_BYTES(__b); \
+ if((i)+__count>(length)) { \
+ __count=(uint8_t)((length)-(i)); \
+ } \
+ while(__count>0 && U8_IS_TRAIL((s)[i])) { \
+ ++(i); \
+ --__count; \
+ } \
+ } \
+}
+
+/**
+ * Advance the string offset from one code point boundary to the n-th next one,
+ * i.e., move forward by n code points.
+ * (Post-incrementing iteration.)
+ * "Unsafe" macro, assumes well-formed UTF-8.
+ *
+ * @param s const uint8_t * string
+ * @param i string offset
+ * @param n number of code points to skip
+ * @see U8_FWD_N
+ * @stable ICU 2.4
+ */
+#define U8_FWD_N_UNSAFE(s, i, n) { \
+ int32_t __N=(n); \
+ while(__N>0) { \
+ U8_FWD_1_UNSAFE(s, i); \
+ --__N; \
+ } \
+}
+
+/**
+ * Advance the string offset from one code point boundary to the n-th next one,
+ * i.e., move forward by n code points.
+ * (Post-incrementing iteration.)
+ * "Safe" macro, checks for illegal sequences and for string boundaries.
+ *
+ * @param s const uint8_t * string
+ * @param i string offset, i<length
+ * @param length string length
+ * @param n number of code points to skip
+ * @see U8_FWD_N_UNSAFE
+ * @stable ICU 2.4
+ */
+#define U8_FWD_N(s, i, length, n) { \
+ int32_t __N=(n); \
+ while(__N>0 && (i)<(length)) { \
+ U8_FWD_1(s, i, length); \
+ --__N; \
+ } \
+}
+
+/**
+ * Adjust a random-access offset to a code point boundary
+ * at the start of a code point.
+ * If the offset points to a UTF-8 trail byte,
+ * then the offset is moved backward to the corresponding lead byte.
+ * Otherwise, it is not modified.
+ * "Unsafe" macro, assumes well-formed UTF-8.
+ *
+ * @param s const uint8_t * string
+ * @param i string offset
+ * @see U8_SET_CP_START
+ * @stable ICU 2.4
+ */
+#define U8_SET_CP_START_UNSAFE(s, i) { \
+ while(U8_IS_TRAIL((s)[i])) { --(i); } \
+}
+
+/**
+ * Adjust a random-access offset to a code point boundary
+ * at the start of a code point.
+ * If the offset points to a UTF-8 trail byte,
+ * then the offset is moved backward to the corresponding lead byte.
+ * Otherwise, it is not modified.
+ * "Safe" macro, checks for illegal sequences and for string boundaries.
+ *
+ * @param s const uint8_t * string
+ * @param start starting string offset (usually 0)
+ * @param i string offset, start<=i
+ * @see U8_SET_CP_START_UNSAFE
+ * @stable ICU 2.4
+ */
+#define U8_SET_CP_START(s, start, i) { \
+ if(U8_IS_TRAIL((s)[(i)])) { \
+ (i)=utf8_back1SafeBody(s, start, (int32_t)(i)); \
+ } \
+}
+
+/* definitions with backward iteration -------------------------------------- */
+
+/**
+ * Move the string offset from one code point boundary to the previous one
+ * and get the code point between them.
+ * (Pre-decrementing backward iteration.)
+ * "Unsafe" macro, assumes well-formed UTF-8.
+ *
+ * The input offset may be the same as the string length.
+ * If the offset is behind a multi-byte sequence, then the macro will read
+ * the whole sequence.
+ * If the offset is behind a lead byte, then that itself
+ * will be returned as the code point.
+ * The result is undefined if the offset is behind an illegal UTF-8 sequence.
+ *
+ * @param s const uint8_t * string
+ * @param i string offset
+ * @param c output UChar32 variable
+ * @see U8_PREV
+ * @stable ICU 2.4
+ */
+#define U8_PREV_UNSAFE(s, i, c) { \
+ (c)=(s)[--(i)]; \
+ if(U8_IS_TRAIL(c)) { \
+ uint8_t __b, __count=1, __shift=6; \
+\
+ /* c is a trail byte */ \
+ (c)&=0x3f; \
+ for(;;) { \
+ __b=(s)[--(i)]; \
+ if(__b>=0xc0) { \
+ U8_MASK_LEAD_BYTE(__b, __count); \
+ (c)|=(UChar32)__b<<__shift; \
+ break; \
+ } else { \
+ (c)|=(UChar32)(__b&0x3f)<<__shift; \
+ ++__count; \
+ __shift+=6; \
+ } \
+ } \
+ } \
+}
+
+/**
+ * Move the string offset from one code point boundary to the previous one
+ * and get the code point between them.
+ * (Pre-decrementing backward iteration.)
+ * "Safe" macro, checks for illegal sequences and for string boundaries.
+ *
+ * The input offset may be the same as the string length.
+ * If the offset is behind a multi-byte sequence, then the macro will read
+ * the whole sequence.
+ * If the offset is behind a lead byte, then that itself
+ * will be returned as the code point.
+ * If the offset is behind an illegal UTF-8 sequence, then c is set to a negative value.
+ *
+ * @param s const uint8_t * string
+ * @param start starting string offset (usually 0)
+ * @param i string offset, start<=i
+ * @param c output UChar32 variable, set to <0 in case of an error
+ * @see U8_PREV_UNSAFE
+ * @stable ICU 2.4
+ */
+#define U8_PREV(s, start, i, c) { \
+ (c)=(s)[--(i)]; \
+ if((c)>=0x80) { \
+ if((c)<=0xbf) { \
+ (c)=utf8_prevCharSafeBody(s, start, &(i), c, -1); \
+ } else { \
+ (c)=U_SENTINEL; \
+ } \
+ } \
+}
+
+/**
+ * Move the string offset from one code point boundary to the previous one.
+ * (Pre-decrementing backward iteration.)
+ * The input offset may be the same as the string length.
+ * "Unsafe" macro, assumes well-formed UTF-8.
+ *
+ * @param s const uint8_t * string
+ * @param i string offset
+ * @see U8_BACK_1
+ * @stable ICU 2.4
+ */
+#define U8_BACK_1_UNSAFE(s, i) { \
+ while(U8_IS_TRAIL((s)[--(i)])) {} \
+}
+
+/**
+ * Move the string offset from one code point boundary to the previous one.
+ * (Pre-decrementing backward iteration.)
+ * The input offset may be the same as the string length.
+ * "Safe" macro, checks for illegal sequences and for string boundaries.
+ *
+ * @param s const uint8_t * string
+ * @param start starting string offset (usually 0)
+ * @param i string offset, start<=i
+ * @see U8_BACK_1_UNSAFE
+ * @stable ICU 2.4
+ */
+#define U8_BACK_1(s, start, i) { \
+ if(U8_IS_TRAIL((s)[--(i)])) { \
+ (i)=utf8_back1SafeBody(s, start, (int32_t)(i)); \
+ } \
+}
+
+/**
+ * Move the string offset from one code point boundary to the n-th one before it,
+ * i.e., move backward by n code points.
+ * (Pre-decrementing backward iteration.)
+ * The input offset may be the same as the string length.
+ * "Unsafe" macro, assumes well-formed UTF-8.
+ *
+ * @param s const uint8_t * string
+ * @param i string offset
+ * @param n number of code points to skip
+ * @see U8_BACK_N
+ * @stable ICU 2.4
+ */
+#define U8_BACK_N_UNSAFE(s, i, n) { \
+ int32_t __N=(n); \
+ while(__N>0) { \
+ U8_BACK_1_UNSAFE(s, i); \
+ --__N; \
+ } \
+}
+
+/**
+ * Move the string offset from one code point boundary to the n-th one before it,
+ * i.e., move backward by n code points.
+ * (Pre-decrementing backward iteration.)
+ * The input offset may be the same as the string length.
+ * "Safe" macro, checks for illegal sequences and for string boundaries.
+ *
+ * @param s const uint8_t * string
+ * @param start index of the start of the string
+ * @param i string offset, i<length
+ * @param n number of code points to skip
+ * @see U8_BACK_N_UNSAFE
+ * @stable ICU 2.4
+ */
+#define U8_BACK_N(s, start, i, n) { \
+ int32_t __N=(n); \
+ while(__N>0 && (i)>(start)) { \
+ U8_BACK_1(s, start, i); \
+ --__N; \
+ } \
+}
+
+/**
+ * Adjust a random-access offset to a code point boundary after a code point.
+ * If the offset is behind a partial multi-byte sequence,
+ * then the offset is incremented to behind the whole sequence.
+ * Otherwise, it is not modified.
+ * The input offset may be the same as the string length.
+ * "Unsafe" macro, assumes well-formed UTF-8.
+ *
+ * @param s const uint8_t * string
+ * @param i string offset
+ * @see U8_SET_CP_LIMIT
+ * @stable ICU 2.4
+ */
+#define U8_SET_CP_LIMIT_UNSAFE(s, i) { \
+ U8_BACK_1_UNSAFE(s, i); \
+ U8_FWD_1_UNSAFE(s, i); \
+}
+
+/**
+ * Adjust a random-access offset to a code point boundary after a code point.
+ * If the offset is behind a partial multi-byte sequence,
+ * then the offset is incremented to behind the whole sequence.
+ * Otherwise, it is not modified.
+ * The input offset may be the same as the string length.
+ * "Safe" macro, checks for illegal sequences and for string boundaries.
+ *
+ * @param s const uint8_t * string
+ * @param start starting string offset (usually 0)
+ * @param i string offset, start<=i<=length
+ * @param length string length
+ * @see U8_SET_CP_LIMIT_UNSAFE
+ * @stable ICU 2.4
+ */
+#define U8_SET_CP_LIMIT(s, start, i, length) { \
+ if((start)<(i) && (i)<(length)) { \
+ U8_BACK_1(s, start, i); \
+ U8_FWD_1(s, i, length); \
+ } \
+}
+
+#endif
diff --git a/Source/JavaScriptCore/icu/unicode/utf_old.h b/Source/JavaScriptCore/icu/unicode/utf_old.h
new file mode 100644
index 0000000..8504a03
--- /dev/null
+++ b/Source/JavaScriptCore/icu/unicode/utf_old.h
@@ -0,0 +1 @@
+/* This file is intentionally left blank. */
diff --git a/Source/JavaScriptCore/icu/unicode/utypes.h b/Source/JavaScriptCore/icu/unicode/utypes.h
new file mode 100644
index 0000000..e20cd79
--- /dev/null
+++ b/Source/JavaScriptCore/icu/unicode/utypes.h
@@ -0,0 +1,745 @@
+/*
+**********************************************************************
+* Copyright (C) 1996-2004, International Business Machines
+* Corporation and others. All Rights Reserved.
+**********************************************************************
+*
+* FILE NAME : UTYPES.H (formerly ptypes.h)
+*
+* Date Name Description
+* 12/11/96 helena Creation.
+* 02/27/97 aliu Added typedefs for UClassID, int8, int16, int32,
+* uint8, uint16, and uint32.
+* 04/01/97 aliu Added XP_CPLUSPLUS and modified to work under C as
+* well as C++.
+* Modified to use memcpy() for uprv_arrayCopy() fns.
+* 04/14/97 aliu Added TPlatformUtilities.
+* 05/07/97 aliu Added import/export specifiers (replacing the old
+* broken EXT_CLASS). Added version number for our
+* code. Cleaned up header.
+* 6/20/97 helena Java class name change.
+* 08/11/98 stephen UErrorCode changed from typedef to enum
+* 08/12/98 erm Changed T_ANALYTIC_PACKAGE_VERSION to 3
+* 08/14/98 stephen Added uprv_arrayCopy() for int8_t, int16_t, int32_t
+* 12/09/98 jfitz Added BUFFER_OVERFLOW_ERROR (bug 1100066)
+* 04/20/99 stephen Cleaned up & reworked for autoconf.
+* Renamed to utypes.h.
+* 05/05/99 stephen Changed to use <inttypes.h>
+* 12/07/99 helena Moved copyright notice string from ucnv_bld.h here.
+*******************************************************************************
+*/
+
+#ifndef UTYPES_H
+#define UTYPES_H
+
+
+#include "unicode/umachine.h"
+#include "unicode/utf.h"
+#include "unicode/uversion.h"
+#include "unicode/uconfig.h"
+
+#ifdef U_HIDE_DRAFT_API
+#include "unicode/udraft.h"
+#endif
+
+#ifdef U_HIDE_DEPRECATED_API
+#include "unicode/udeprctd.h"
+#endif
+
+#ifdef U_HIDE_DEPRECATED_API
+#include "unicode/uobslete.h"
+#endif
+
+
+/*!
+ * \file
+ * \brief Basic definitions for ICU, for both C and C++ APIs
+ *
+ * This file defines basic types, constants, and enumerations directly or
+ * indirectly by including other header files, especially utf.h for the
+ * basic character and string definitions and umachine.h for consistent
+ * integer and other types.
+ */
+
+/*===========================================================================*/
+/* char Character set family */
+/*===========================================================================*/
+
+/**
+ * U_CHARSET_FAMILY is equal to this value when the platform is an ASCII based platform.
+ * @stable ICU 2.0
+ */
+#define U_ASCII_FAMILY 0
+
+/**
+ * U_CHARSET_FAMILY is equal to this value when the platform is an EBCDIC based platform.
+ * @stable ICU 2.0
+ */
+#define U_EBCDIC_FAMILY 1
+
+/**
+ * \def U_CHARSET_FAMILY
+ *
+ * <p>These definitions allow to specify the encoding of text
+ * in the char data type as defined by the platform and the compiler.
+ * It is enough to determine the code point values of "invariant characters",
+ * which are the ones shared by all encodings that are in use
+ * on a given platform.</p>
+ *
+ * <p>Those "invariant characters" should be all the uppercase and lowercase
+ * latin letters, the digits, the space, and "basic punctuation".
+ * Also, '\\n', '\\r', '\\t' should be available.</p>
+ *
+ * <p>The list of "invariant characters" is:<br>
+ * \code
+ * A-Z a-z 0-9 SPACE " % &amp; ' ( ) * + , - . / : ; < = > ? _
+ * \endcode
+ * <br>
+ * (52 letters + 10 numbers + 20 punc/sym/space = 82 total)</p>
+ *
+ * <p>This matches the IBM Syntactic Character Set (CS 640).</p>
+ *
+ * <p>In other words, all the graphic characters in 7-bit ASCII should
+ * be safely accessible except the following:</p>
+ *
+ * \code
+ * '\' <backslash>
+ * '[' <left bracket>
+ * ']' <right bracket>
+ * '{' <left brace>
+ * '}' <right brace>
+ * '^' <circumflex>
+ * '~' <tilde>
+ * '!' <exclamation mark>
+ * '#' <number sign>
+ * '|' <vertical line>
+ * '$' <dollar sign>
+ * '@' <commercial at>
+ * '`' <grave accent>
+ * \endcode
+ * @stable ICU 2.0
+ */
+
+#ifndef U_CHARSET_FAMILY
+# define U_CHARSET_FAMILY 0
+#endif
+
+/*===========================================================================*/
+/* ICUDATA naming scheme */
+/*===========================================================================*/
+
+/**
+ * \def U_ICUDATA_TYPE_LETTER
+ *
+ * This is a platform-dependent string containing one letter:
+ * - b for big-endian, ASCII-family platforms
+ * - l for little-endian, ASCII-family platforms
+ * - e for big-endian, EBCDIC-family platforms
+ * This letter is part of the common data file name.
+ * @stable ICU 2.0
+ */
+
+/**
+ * \def U_ICUDATA_TYPE_LITLETTER
+ * The non-string form of U_ICUDATA_TYPE_LETTER
+ * @stable ICU 2.0
+ */
+#if U_CHARSET_FAMILY
+# if U_IS_BIG_ENDIAN
+ /* EBCDIC - should always be BE */
+# define U_ICUDATA_TYPE_LETTER "e"
+# define U_ICUDATA_TYPE_LITLETTER e
+# else
+# error "Don't know what to do with little endian EBCDIC!"
+# define U_ICUDATA_TYPE_LETTER "x"
+# define U_ICUDATA_TYPE_LITLETTER x
+# endif
+#else
+# if U_IS_BIG_ENDIAN
+ /* Big-endian ASCII */
+# define U_ICUDATA_TYPE_LETTER "b"
+# define U_ICUDATA_TYPE_LITLETTER b
+# else
+ /* Little-endian ASCII */
+# define U_ICUDATA_TYPE_LETTER "l"
+# define U_ICUDATA_TYPE_LITLETTER l
+# endif
+#endif
+
+/**
+ * A single string literal containing the icudata stub name. i.e. 'icudt18e' for
+ * ICU 1.8.x on EBCDIC, etc..
+ * @stable ICU 2.0
+ */
+#define U_ICUDATA_NAME "icudt" U_ICU_VERSION_SHORT U_ICUDATA_TYPE_LETTER
+
+
+/**
+ * U_ICU_ENTRY_POINT is the name of the DLL entry point to the ICU data library.
+ * Defined as a literal, not a string.
+ * Tricky Preprocessor use - ## operator replaces macro paramters with the literal string
+ * from the corresponding macro invocation, _before_ other macro substitutions.
+ * Need a nested #defines to get the actual version numbers rather than
+ * the literal text U_ICU_VERSION_MAJOR_NUM into the name.
+ * The net result will be something of the form
+ * #define U_ICU_ENTRY_POINT icudt19_dat
+ * @stable ICU 2.4
+ */
+#define U_ICUDATA_ENTRY_POINT U_DEF2_ICUDATA_ENTRY_POINT(U_ICU_VERSION_MAJOR_NUM, U_ICU_VERSION_MINOR_NUM)
+/**
+ * @internal
+ */
+#define U_DEF2_ICUDATA_ENTRY_POINT(major, minor) U_DEF_ICUDATA_ENTRY_POINT(major, minor)
+/**
+ * @internal
+ */
+#define U_DEF_ICUDATA_ENTRY_POINT(major, minor) icudt##major##minor##_dat
+
+/**
+ * \def U_CALLCONV
+ * Similar to U_CDECL_BEGIN/U_CDECL_END, this qualifier is necessary
+ * in callback function typedefs to make sure that the calling convention
+ * is compatible.
+ *
+ * This is only used for non-ICU-API functions.
+ * When a function is a public ICU API,
+ * you must use the U_CAPI and U_EXPORT2 qualifiers.
+ * @stable ICU 2.0
+ */
+#if defined(OS390) && (__COMPILER_VER__ < 0x41020000) && defined(XP_CPLUSPLUS)
+# define U_CALLCONV __cdecl
+#else
+# define U_CALLCONV U_EXPORT2
+#endif
+
+/**
+ * \def NULL
+ * Define NULL if necessary, to 0 for C++ and to ((void *)0) for C.
+ * @stable ICU 2.0
+ */
+#ifndef NULL
+#ifdef XP_CPLUSPLUS
+#define NULL 0
+#else
+#define NULL ((void *)0)
+#endif
+#endif
+
+/*===========================================================================*/
+/* Calendar/TimeZone data types */
+/*===========================================================================*/
+
+/**
+ * Date and Time data type.
+ * This is a primitive data type that holds the date and time
+ * as the number of milliseconds since 1970-jan-01, 00:00 UTC.
+ * UTC leap seconds are ignored.
+ * @stable ICU 2.0
+ */
+typedef double UDate;
+
+/** The number of milliseconds per second @stable ICU 2.0 */
+#define U_MILLIS_PER_SECOND (1000)
+/** The number of milliseconds per minute @stable ICU 2.0 */
+#define U_MILLIS_PER_MINUTE (60000)
+/** The number of milliseconds per hour @stable ICU 2.0 */
+#define U_MILLIS_PER_HOUR (3600000)
+/** The number of milliseconds per day @stable ICU 2.0 */
+#define U_MILLIS_PER_DAY (86400000)
+
+
+/*===========================================================================*/
+/* UClassID-based RTTI */
+/*===========================================================================*/
+
+/**
+ * UClassID is used to identify classes without using RTTI, since RTTI
+ * is not yet supported by all C++ compilers. Each class hierarchy which needs
+ * to implement polymorphic clone() or operator==() defines two methods,
+ * described in detail below. UClassID values can be compared using
+ * operator==(). Nothing else should be done with them.
+ *
+ * \par
+ * getDynamicClassID() is declared in the base class of the hierarchy as
+ * a pure virtual. Each concrete subclass implements it in the same way:
+ *
+ * \code
+ * class Base {
+ * public:
+ * virtual UClassID getDynamicClassID() const = 0;
+ * }
+ *
+ * class Derived {
+ * public:
+ * virtual UClassID getDynamicClassID() const
+ * { return Derived::getStaticClassID(); }
+ * }
+ * \endcode
+ *
+ * Each concrete class implements getStaticClassID() as well, which allows
+ * clients to test for a specific type.
+ *
+ * \code
+ * class Derived {
+ * public:
+ * static UClassID U_EXPORT2 getStaticClassID();
+ * private:
+ * static char fgClassID;
+ * }
+ *
+ * // In Derived.cpp:
+ * UClassID Derived::getStaticClassID()
+ * { return (UClassID)&Derived::fgClassID; }
+ * char Derived::fgClassID = 0; // Value is irrelevant
+ * \endcode
+ * @stable ICU 2.0
+ */
+typedef void* UClassID;
+
+/*===========================================================================*/
+/* Shared library/DLL import-export API control */
+/*===========================================================================*/
+
+/*
+ * Control of symbol import/export.
+ * ICU is separated into three libraries.
+ */
+
+/*
+ * \def U_COMBINED_IMPLEMENTATION
+ * Set to export library symbols from inside the ICU library
+ * when all of ICU is in a single library.
+ * This can be set as a compiler option while building ICU, and it
+ * needs to be the first one tested to override U_COMMON_API, U_I18N_API, etc.
+ * @stable ICU 2.0
+ */
+
+/**
+ * \def U_DATA_API
+ * Set to export library symbols from inside the stubdata library,
+ * and to import them from outside.
+ * @draft ICU 3.0
+ */
+
+/**
+ * \def U_COMMON_API
+ * Set to export library symbols from inside the common library,
+ * and to import them from outside.
+ * @stable ICU 2.0
+ */
+
+/**
+ * \def U_I18N_API
+ * Set to export library symbols from inside the i18n library,
+ * and to import them from outside.
+ * @stable ICU 2.0
+ */
+
+/**
+ * \def U_LAYOUT_API
+ * Set to export library symbols from inside the layout engine library,
+ * and to import them from outside.
+ * @stable ICU 2.0
+ */
+
+/**
+ * \def U_LAYOUTEX_API
+ * Set to export library symbols from inside the layout extensions library,
+ * and to import them from outside.
+ * @stable ICU 2.6
+ */
+
+/**
+ * \def U_IO_API
+ * Set to export library symbols from inside the ustdio library,
+ * and to import them from outside.
+ * @stable ICU 2.0
+ */
+
+#if defined(U_COMBINED_IMPLEMENTATION)
+#define U_DATA_API U_EXPORT
+#define U_COMMON_API U_EXPORT
+#define U_I18N_API U_EXPORT
+#define U_LAYOUT_API U_EXPORT
+#define U_LAYOUTEX_API U_EXPORT
+#define U_IO_API U_EXPORT
+#elif defined(U_STATIC_IMPLEMENTATION)
+#define U_DATA_API
+#define U_COMMON_API
+#define U_I18N_API
+#define U_LAYOUT_API
+#define U_LAYOUTEX_API
+#define U_IO_API
+#elif defined(U_COMMON_IMPLEMENTATION)
+#define U_DATA_API U_IMPORT
+#define U_COMMON_API U_EXPORT
+#define U_I18N_API U_IMPORT
+#define U_LAYOUT_API U_IMPORT
+#define U_LAYOUTEX_API U_IMPORT
+#define U_IO_API U_IMPORT
+#elif defined(U_I18N_IMPLEMENTATION)
+#define U_DATA_API U_IMPORT
+#define U_COMMON_API U_IMPORT
+#define U_I18N_API U_EXPORT
+#define U_LAYOUT_API U_IMPORT
+#define U_LAYOUTEX_API U_IMPORT
+#define U_IO_API U_IMPORT
+#elif defined(U_LAYOUT_IMPLEMENTATION)
+#define U_DATA_API U_IMPORT
+#define U_COMMON_API U_IMPORT
+#define U_I18N_API U_IMPORT
+#define U_LAYOUT_API U_EXPORT
+#define U_LAYOUTEX_API U_IMPORT
+#define U_IO_API U_IMPORT
+#elif defined(U_LAYOUTEX_IMPLEMENTATION)
+#define U_DATA_API U_IMPORT
+#define U_COMMON_API U_IMPORT
+#define U_I18N_API U_IMPORT
+#define U_LAYOUT_API U_IMPORT
+#define U_LAYOUTEX_API U_EXPORT
+#define U_IO_API U_IMPORT
+#elif defined(U_IO_IMPLEMENTATION)
+#define U_DATA_API U_IMPORT
+#define U_COMMON_API U_IMPORT
+#define U_I18N_API U_IMPORT
+#define U_LAYOUT_API U_IMPORT
+#define U_LAYOUTEX_API U_IMPORT
+#define U_IO_API U_EXPORT
+#else
+#define U_DATA_API U_IMPORT
+#define U_COMMON_API U_IMPORT
+#define U_I18N_API U_IMPORT
+#define U_LAYOUT_API U_IMPORT
+#define U_LAYOUTEX_API U_IMPORT
+#define U_IO_API U_IMPORT
+#endif
+
+/**
+ * \def U_STANDARD_CPP_NAMESPACE
+ * Control of C++ Namespace
+ * @stable ICU 2.0
+ */
+#ifdef __cplusplus
+#define U_STANDARD_CPP_NAMESPACE ::
+#else
+#define U_STANDARD_CPP_NAMESPACE
+#endif
+
+
+/*===========================================================================*/
+/* Global delete operator */
+/*===========================================================================*/
+
+/*
+ * The ICU4C library must not use the global new and delete operators.
+ * These operators here are defined to enable testing for this.
+ * See Jitterbug 2581 for details of why this is necessary.
+ *
+ * Verification that ICU4C's memory usage is correct, i.e.,
+ * that global new/delete are not used:
+ *
+ * a) Check for imports of global new/delete (see uobject.cpp for details)
+ * b) Verify that new is never imported.
+ * c) Verify that delete is only imported from object code for interface/mixin classes.
+ * d) Add global delete and delete[] only for the ICU4C library itself
+ * and define them in a way that crashes or otherwise easily shows a problem.
+ *
+ * The following implements d).
+ * The operator implementations crash; this is intentional and used for library debugging.
+ *
+ * Note: This is currently only done on Windows because
+ * some Linux/Unix compilers have problems with defining global new/delete.
+ * On Windows, WIN32 is defined, and it is _MSC_Ver>=1200 for MSVC 6.0 and higher.
+ */
+#if defined(XP_CPLUSPLUS) && defined(WIN32) && (_MSC_Ver>=1200) && (defined(U_COMMON_IMPLEMENTATION) || defined(U_I18N_IMPLEMENTATION) || defined(U_LAYOUT_IMPLEMENTATION) || defined(U_USTDIO_IMPLEMENTATION))
+
+/**
+ * Global operator new, defined only inside ICU4C, must not be used.
+ * Crashes intentionally.
+ * @internal
+ */
+inline void *
+operator new(size_t /*size*/) {
+ char *q=NULL;
+ *q=5; /* break it */
+ return q;
+}
+
+/**
+ * Global operator new[], defined only inside ICU4C, must not be used.
+ * Crashes intentionally.
+ * @internal
+ */
+inline void *
+operator new[](size_t /*size*/) {
+ char *q=NULL;
+ *q=5; /* break it */
+ return q;
+}
+
+/**
+ * Global operator delete, defined only inside ICU4C, must not be used.
+ * Crashes intentionally.
+ * @internal
+ */
+inline void
+operator delete(void * /*p*/) {
+ char *q=NULL;
+ *q=5; /* break it */
+}
+
+/**
+ * Global operator delete[], defined only inside ICU4C, must not be used.
+ * Crashes intentionally.
+ * @internal
+ */
+inline void
+operator delete[](void * /*p*/) {
+ char *q=NULL;
+ *q=5; /* break it */
+}
+
+#endif
+
+/*===========================================================================*/
+/* UErrorCode */
+/*===========================================================================*/
+
+/**
+ * Error code to replace exception handling, so that the code is compatible with all C++ compilers,
+ * and to use the same mechanism for C and C++.
+ *
+ * \par
+ * ICU functions that take a reference (C++) or a pointer (C) to a UErrorCode
+ * first test if(U_FAILURE(errorCode)) { return immediately; }
+ * so that in a chain of such functions the first one that sets an error code
+ * causes the following ones to not perform any operations.
+ *
+ * \par
+ * Error codes should be tested using U_FAILURE() and U_SUCCESS().
+ * @stable ICU 2.0
+ */
+typedef enum UErrorCode {
+ /* The ordering of U_ERROR_INFO_START Vs U_USING_FALLBACK_WARNING looks weird
+ * and is that way because VC++ debugger displays first encountered constant,
+ * which is not the what the code is used for
+ */
+
+ U_USING_FALLBACK_WARNING = -128, /**< A resource bundle lookup returned a fallback result (not an error) */
+
+ U_ERROR_WARNING_START = -128, /**< Start of information results (semantically successful) */
+
+ U_USING_DEFAULT_WARNING = -127, /**< A resource bundle lookup returned a result from the root locale (not an error) */
+
+ U_SAFECLONE_ALLOCATED_WARNING = -126, /**< A SafeClone operation required allocating memory (informational only) */
+
+ U_STATE_OLD_WARNING = -125, /**< ICU has to use compatibility layer to construct the service. Expect performance/memory usage degradation. Consider upgrading */
+
+ U_STRING_NOT_TERMINATED_WARNING = -124,/**< An output string could not be NUL-terminated because output length==destCapacity. */
+
+ U_SORT_KEY_TOO_SHORT_WARNING = -123, /**< Number of levels requested in getBound is higher than the number of levels in the sort key */
+
+ U_AMBIGUOUS_ALIAS_WARNING = -122, /**< This converter alias can go to different converter implementations */
+
+ U_DIFFERENT_UCA_VERSION = -121, /**< ucol_open encountered a mismatch between UCA version and collator image version, so the collator was constructed from rules. No impact to further function */
+
+ U_ERROR_WARNING_LIMIT, /**< This must always be the last warning value to indicate the limit for UErrorCode warnings (last warning code +1) */
+
+
+ U_ZERO_ERROR = 0, /**< No error, no warning. */
+
+ U_ILLEGAL_ARGUMENT_ERROR = 1, /**< Start of codes indicating failure */
+ U_MISSING_RESOURCE_ERROR = 2, /**< The requested resource cannot be found */
+ U_INVALID_FORMAT_ERROR = 3, /**< Data format is not what is expected */
+ U_FILE_ACCESS_ERROR = 4, /**< The requested file cannot be found */
+ U_INTERNAL_PROGRAM_ERROR = 5, /**< Indicates a bug in the library code */
+ U_MESSAGE_PARSE_ERROR = 6, /**< Unable to parse a message (message format) */
+ U_MEMORY_ALLOCATION_ERROR = 7, /**< Memory allocation error */
+ U_INDEX_OUTOFBOUNDS_ERROR = 8, /**< Trying to access the index that is out of bounds */
+ U_PARSE_ERROR = 9, /**< Equivalent to Java ParseException */
+ U_INVALID_CHAR_FOUND = 10, /**< Character conversion: Unmappable input sequence. In other APIs: Invalid character. */
+ U_TRUNCATED_CHAR_FOUND = 11, /**< Character conversion: Incomplete input sequence. */
+ U_ILLEGAL_CHAR_FOUND = 12, /**< Character conversion: Illegal input sequence/combination of input units.. */
+ U_INVALID_TABLE_FORMAT = 13, /**< Conversion table file found, but corrupted */
+ U_INVALID_TABLE_FILE = 14, /**< Conversion table file not found */
+ U_BUFFER_OVERFLOW_ERROR = 15, /**< A result would not fit in the supplied buffer */
+ U_UNSUPPORTED_ERROR = 16, /**< Requested operation not supported in current context */
+ U_RESOURCE_TYPE_MISMATCH = 17, /**< an operation is requested over a resource that does not support it */
+ U_ILLEGAL_ESCAPE_SEQUENCE = 18, /**< ISO-2022 illlegal escape sequence */
+ U_UNSUPPORTED_ESCAPE_SEQUENCE = 19, /**< ISO-2022 unsupported escape sequence */
+ U_NO_SPACE_AVAILABLE = 20, /**< No space available for in-buffer expansion for Arabic shaping */
+ U_CE_NOT_FOUND_ERROR = 21, /**< Currently used only while setting variable top, but can be used generally */
+ U_PRIMARY_TOO_LONG_ERROR = 22, /**< User tried to set variable top to a primary that is longer than two bytes */
+ U_STATE_TOO_OLD_ERROR = 23, /**< ICU cannot construct a service from this state, as it is no longer supported */
+ U_TOO_MANY_ALIASES_ERROR = 24, /**< There are too many aliases in the path to the requested resource.
+ It is very possible that a circular alias definition has occured */
+ U_ENUM_OUT_OF_SYNC_ERROR = 25, /**< UEnumeration out of sync with underlying collection */
+ U_INVARIANT_CONVERSION_ERROR = 26, /**< Unable to convert a UChar* string to char* with the invariant converter. */
+ U_INVALID_STATE_ERROR = 27, /**< Requested operation can not be completed with ICU in its current state */
+ U_COLLATOR_VERSION_MISMATCH = 28, /**< Collator version is not compatible with the base version */
+ U_USELESS_COLLATOR_ERROR = 29, /**< Collator is options only and no base is specified */
+
+ U_STANDARD_ERROR_LIMIT, /**< This must always be the last value to indicate the limit for standard errors */
+ /*
+ * the error code range 0x10000 0x10100 are reserved for Transliterator
+ */
+ U_BAD_VARIABLE_DEFINITION=0x10000,/**< Missing '$' or duplicate variable name */
+ U_PARSE_ERROR_START = 0x10000, /**< Start of Transliterator errors */
+ U_MALFORMED_RULE, /**< Elements of a rule are misplaced */
+ U_MALFORMED_SET, /**< A UnicodeSet pattern is invalid*/
+ U_MALFORMED_SYMBOL_REFERENCE, /**< UNUSED as of ICU 2.4 */
+ U_MALFORMED_UNICODE_ESCAPE, /**< A Unicode escape pattern is invalid*/
+ U_MALFORMED_VARIABLE_DEFINITION, /**< A variable definition is invalid */
+ U_MALFORMED_VARIABLE_REFERENCE, /**< A variable reference is invalid */
+ U_MISMATCHED_SEGMENT_DELIMITERS, /**< UNUSED as of ICU 2.4 */
+ U_MISPLACED_ANCHOR_START, /**< A start anchor appears at an illegal position */
+ U_MISPLACED_CURSOR_OFFSET, /**< A cursor offset occurs at an illegal position */
+ U_MISPLACED_QUANTIFIER, /**< A quantifier appears after a segment close delimiter */
+ U_MISSING_OPERATOR, /**< A rule contains no operator */
+ U_MISSING_SEGMENT_CLOSE, /**< UNUSED as of ICU 2.4 */
+ U_MULTIPLE_ANTE_CONTEXTS, /**< More than one ante context */
+ U_MULTIPLE_CURSORS, /**< More than one cursor */
+ U_MULTIPLE_POST_CONTEXTS, /**< More than one post context */
+ U_TRAILING_BACKSLASH, /**< A dangling backslash */
+ U_UNDEFINED_SEGMENT_REFERENCE, /**< A segment reference does not correspond to a defined segment */
+ U_UNDEFINED_VARIABLE, /**< A variable reference does not correspond to a defined variable */
+ U_UNQUOTED_SPECIAL, /**< A special character was not quoted or escaped */
+ U_UNTERMINATED_QUOTE, /**< A closing single quote is missing */
+ U_RULE_MASK_ERROR, /**< A rule is hidden by an earlier more general rule */
+ U_MISPLACED_COMPOUND_FILTER, /**< A compound filter is in an invalid location */
+ U_MULTIPLE_COMPOUND_FILTERS, /**< More than one compound filter */
+ U_INVALID_RBT_SYNTAX, /**< A "::id" rule was passed to the RuleBasedTransliterator parser */
+ U_INVALID_PROPERTY_PATTERN, /**< UNUSED as of ICU 2.4 */
+ U_MALFORMED_PRAGMA, /**< A 'use' pragma is invlalid */
+ U_UNCLOSED_SEGMENT, /**< A closing ')' is missing */
+ U_ILLEGAL_CHAR_IN_SEGMENT, /**< UNUSED as of ICU 2.4 */
+ U_VARIABLE_RANGE_EXHAUSTED, /**< Too many stand-ins generated for the given variable range */
+ U_VARIABLE_RANGE_OVERLAP, /**< The variable range overlaps characters used in rules */
+ U_ILLEGAL_CHARACTER, /**< A special character is outside its allowed context */
+ U_INTERNAL_TRANSLITERATOR_ERROR, /**< Internal transliterator system error */
+ U_INVALID_ID, /**< A "::id" rule specifies an unknown transliterator */
+ U_INVALID_FUNCTION, /**< A "&fn()" rule specifies an unknown transliterator */
+ U_PARSE_ERROR_LIMIT, /**< The limit for Transliterator errors */
+
+ /*
+ * the error code range 0x10100 0x10200 are reserved for formatting API parsing error
+ */
+ U_UNEXPECTED_TOKEN=0x10100, /**< Syntax error in format pattern */
+ U_FMT_PARSE_ERROR_START=0x10100, /**< Start of format library errors */
+ U_MULTIPLE_DECIMAL_SEPARATORS, /**< More than one decimal separator in number pattern */
+ U_MULTIPLE_DECIMAL_SEPERATORS = U_MULTIPLE_DECIMAL_SEPARATORS, /**< Typo: kept for backward compatibility. Use U_MULTIPLE_DECIMAL_SEPARATORS */
+ U_MULTIPLE_EXPONENTIAL_SYMBOLS, /**< More than one exponent symbol in number pattern */
+ U_MALFORMED_EXPONENTIAL_PATTERN, /**< Grouping symbol in exponent pattern */
+ U_MULTIPLE_PERCENT_SYMBOLS, /**< More than one percent symbol in number pattern */
+ U_MULTIPLE_PERMILL_SYMBOLS, /**< More than one permill symbol in number pattern */
+ U_MULTIPLE_PAD_SPECIFIERS, /**< More than one pad symbol in number pattern */
+ U_PATTERN_SYNTAX_ERROR, /**< Syntax error in format pattern */
+ U_ILLEGAL_PAD_POSITION, /**< Pad symbol misplaced in number pattern */
+ U_UNMATCHED_BRACES, /**< Braces do not match in message pattern */
+ U_UNSUPPORTED_PROPERTY, /**< UNUSED as of ICU 2.4 */
+ U_UNSUPPORTED_ATTRIBUTE, /**< UNUSED as of ICU 2.4 */
+ U_FMT_PARSE_ERROR_LIMIT, /**< The limit for format library errors */
+
+ /*
+ * the error code range 0x10200 0x102ff are reserved for Break Iterator related error
+ */
+ U_BRK_ERROR_START=0x10200, /**< Start of codes indicating Break Iterator failures */
+ U_BRK_INTERNAL_ERROR, /**< An internal error (bug) was detected. */
+ U_BRK_HEX_DIGITS_EXPECTED, /**< Hex digits expected as part of a escaped char in a rule. */
+ U_BRK_SEMICOLON_EXPECTED, /**< Missing ';' at the end of a RBBI rule. */
+ U_BRK_RULE_SYNTAX, /**< Syntax error in RBBI rule. */
+ U_BRK_UNCLOSED_SET, /**< UnicodeSet witing an RBBI rule missing a closing ']'. */
+ U_BRK_ASSIGN_ERROR, /**< Syntax error in RBBI rule assignment statement. */
+ U_BRK_VARIABLE_REDFINITION, /**< RBBI rule $Variable redefined. */
+ U_BRK_MISMATCHED_PAREN, /**< Mis-matched parentheses in an RBBI rule. */
+ U_BRK_NEW_LINE_IN_QUOTED_STRING, /**< Missing closing quote in an RBBI rule. */
+ U_BRK_UNDEFINED_VARIABLE, /**< Use of an undefined $Variable in an RBBI rule. */
+ U_BRK_INIT_ERROR, /**< Initialization failure. Probable missing ICU Data. */
+ U_BRK_RULE_EMPTY_SET, /**< Rule contains an empty Unicode Set. */
+ U_BRK_UNRECOGNIZED_OPTION, /**< !!option in RBBI rules not recognized. */
+ U_BRK_MALFORMED_RULE_TAG, /**< The {nnn} tag on a rule is mal formed */
+ U_BRK_ERROR_LIMIT, /**< This must always be the last value to indicate the limit for Break Iterator failures */
+
+ /*
+ * The error codes in the range 0x10300-0x103ff are reserved for regular expression related errrs
+ */
+ U_REGEX_ERROR_START=0x10300, /**< Start of codes indicating Regexp failures */
+ U_REGEX_INTERNAL_ERROR, /**< An internal error (bug) was detected. */
+ U_REGEX_RULE_SYNTAX, /**< Syntax error in regexp pattern. */
+ U_REGEX_INVALID_STATE, /**< RegexMatcher in invalid state for requested operation */
+ U_REGEX_BAD_ESCAPE_SEQUENCE, /**< Unrecognized backslash escape sequence in pattern */
+ U_REGEX_PROPERTY_SYNTAX, /**< Incorrect Unicode property */
+ U_REGEX_UNIMPLEMENTED, /**< Use of regexp feature that is not yet implemented. */
+ U_REGEX_MISMATCHED_PAREN, /**< Incorrectly nested parentheses in regexp pattern. */
+ U_REGEX_NUMBER_TOO_BIG, /**< Decimal number is too large. */
+ U_REGEX_BAD_INTERVAL, /**< Error in {min,max} interval */
+ U_REGEX_MAX_LT_MIN, /**< In {min,max}, max is less than min. */
+ U_REGEX_INVALID_BACK_REF, /**< Back-reference to a non-existent capture group. */
+ U_REGEX_INVALID_FLAG, /**< Invalid value for match mode flags. */
+ U_REGEX_LOOK_BEHIND_LIMIT, /**< Look-Behind pattern matches must have a bounded maximum length. */
+ U_REGEX_SET_CONTAINS_STRING, /**< Regexps cannot have UnicodeSets containing strings.*/
+ U_REGEX_ERROR_LIMIT, /**< This must always be the last value to indicate the limit for regexp errors */
+
+ /*
+ * The error code in the range 0x10400-0x104ff are reserved for IDNA related error codes
+ */
+ U_IDNA_ERROR_START=0x10400,
+ U_IDNA_PROHIBITED_ERROR,
+ U_IDNA_UNASSIGNED_ERROR,
+ U_IDNA_CHECK_BIDI_ERROR,
+ U_IDNA_STD3_ASCII_RULES_ERROR,
+ U_IDNA_ACE_PREFIX_ERROR,
+ U_IDNA_VERIFICATION_ERROR,
+ U_IDNA_LABEL_TOO_LONG_ERROR,
+ U_IDNA_ERROR_LIMIT,
+ /*
+ * Aliases for StringPrep
+ */
+ U_STRINGPREP_PROHIBITED_ERROR = U_IDNA_PROHIBITED_ERROR,
+ U_STRINGPREP_UNASSIGNED_ERROR = U_IDNA_UNASSIGNED_ERROR,
+ U_STRINGPREP_CHECK_BIDI_ERROR = U_IDNA_CHECK_BIDI_ERROR,
+
+
+ U_ERROR_LIMIT=U_IDNA_ERROR_LIMIT /**< This must always be the last value to indicate the limit for UErrorCode (last error code +1) */
+} UErrorCode;
+
+/* Use the following to determine if an UErrorCode represents */
+/* operational success or failure. */
+
+#ifdef XP_CPLUSPLUS
+ /**
+ * Does the error code indicate success?
+ * @stable ICU 2.0
+ */
+ static
+ inline UBool U_SUCCESS(UErrorCode code) { return (UBool)(code<=U_ZERO_ERROR); }
+ /**
+ * Does the error code indicate a failure?
+ * @stable ICU 2.0
+ */
+ static
+ inline UBool U_FAILURE(UErrorCode code) { return (UBool)(code>U_ZERO_ERROR); }
+#else
+ /**
+ * Does the error code indicate success?
+ * @stable ICU 2.0
+ */
+# define U_SUCCESS(x) ((x)<=U_ZERO_ERROR)
+ /**
+ * Does the error code indicate a failure?
+ * @stable ICU 2.0
+ */
+# define U_FAILURE(x) ((x)>U_ZERO_ERROR)
+#endif
+
+/**
+ * Return a string for a UErrorCode value.
+ * The string will be the same as the name of the error code constant
+ * in the UErrorCode enum above.
+ * @stable ICU 2.0
+ */
+U_STABLE const char * U_EXPORT2
+u_errorName(UErrorCode code);
+
+
+#endif /* _UTYPES */
diff --git a/Source/JavaScriptCore/icu/unicode/uversion.h b/Source/JavaScriptCore/icu/unicode/uversion.h
new file mode 100644
index 0000000..f9a7755
--- /dev/null
+++ b/Source/JavaScriptCore/icu/unicode/uversion.h
@@ -0,0 +1,216 @@
+/*
+*******************************************************************************
+* Copyright (C) 2000-2004, International Business Machines
+* Corporation and others. All Rights Reserved.
+*******************************************************************************
+*
+* file name: uversion.h
+* encoding: US-ASCII
+* tab size: 8 (not used)
+* indentation:4
+*
+* Created by: Vladimir Weinstein
+*
+* Contains all the important version numbers for ICU.
+* Gets included by utypes.h and Windows .rc files
+*/
+
+/*===========================================================================*/
+/* Main ICU version information */
+/*===========================================================================*/
+
+#ifndef UVERSION_H
+#define UVERSION_H
+
+/** IMPORTANT: When updating version, the following things need to be done: */
+/** source/common/unicode/uversion.h - this file: update major, minor, */
+/** patchlevel, suffix, version, short version constants, namespace, */
+/** and copyright */
+/** source/common/common.dsp - update 'Output file name' on the link tab so */
+/** that it contains the new major/minor combination */
+/** source/i18n/i18n.dsp - same as for the common.dsp */
+/** source/layout/layout.dsp - same as for the common.dsp */
+/** source/stubdata/stubdata.dsp - same as for the common.dsp */
+/** source/extra/ustdio/ustdio.dsp - same as for the common.dsp */
+/** source/data/makedata.mak - change U_ICUDATA_NAME so that it contains */
+/** the new major/minor combination */
+/** source/tools/genren/genren.pl - use this script according to the README */
+/** in that folder */
+
+#include "unicode/umachine.h"
+
+/** The standard copyright notice that gets compiled into each library.
+ * This value will change in the subsequent releases of ICU
+ * @stable ICU 2.4
+ */
+#define U_COPYRIGHT_STRING \
+ " Copyright (C) 2004, International Business Machines Corporation and others. All Rights Reserved. "
+
+/** Maximum length of the copyright string.
+ * @stable ICU 2.4
+ */
+#define U_COPYRIGHT_STRING_LENGTH 128
+
+/** The current ICU major version as an integer.
+ * This value will change in the subsequent releases of ICU
+ * @stable ICU 2.4
+ */
+#define U_ICU_VERSION_MAJOR_NUM 3
+
+/** The current ICU minor version as an integer.
+ * This value will change in the subsequent releases of ICU
+ * @stable ICU 2.6
+ */
+#define U_ICU_VERSION_MINOR_NUM 2
+
+/** The current ICU patchlevel version as an integer.
+ * This value will change in the subsequent releases of ICU
+ * @stable ICU 2.4
+ */
+#define U_ICU_VERSION_PATCHLEVEL_NUM 0
+
+/** Glued version suffix for renamers
+ * This value will change in the subsequent releases of ICU
+ * @stable ICU 2.6
+ */
+#define U_ICU_VERSION_SUFFIX _3_2
+
+/** The current ICU library version as a dotted-decimal string. The patchlevel
+ * only appears in this string if it non-zero.
+ * This value will change in the subsequent releases of ICU
+ * @stable ICU 2.4
+ */
+#define U_ICU_VERSION "3.2"
+
+/** The current ICU library major/minor version as a string without dots, for library name suffixes.
+ * This value will change in the subsequent releases of ICU
+ * @stable ICU 2.6
+ */
+#define U_ICU_VERSION_SHORT "32"
+
+/** An ICU version consists of up to 4 numbers from 0..255.
+ * @stable ICU 2.4
+ */
+#define U_MAX_VERSION_LENGTH 4
+
+/** In a string, ICU version fields are delimited by dots.
+ * @stable ICU 2.4
+ */
+#define U_VERSION_DELIMITER '.'
+
+/** The maximum length of an ICU version string.
+ * @stable ICU 2.4
+ */
+#define U_MAX_VERSION_STRING_LENGTH 20
+
+/** The binary form of a version on ICU APIs is an array of 4 uint8_t.
+ * @stable ICU 2.4
+ */
+typedef uint8_t UVersionInfo[U_MAX_VERSION_LENGTH];
+
+#if U_HAVE_NAMESPACE && defined(XP_CPLUSPLUS)
+#if U_DISABLE_RENAMING
+#define U_ICU_NAMESPACE icu
+namespace U_ICU_NAMESPACE { }
+#else
+#define U_ICU_NAMESPACE icu_3_2
+namespace U_ICU_NAMESPACE { }
+namespace icu = U_ICU_NAMESPACE;
+#endif
+U_NAMESPACE_USE
+#endif
+
+
+/*===========================================================================*/
+/* General version helper functions. Definitions in putil.c */
+/*===========================================================================*/
+
+/**
+ * Parse a string with dotted-decimal version information and
+ * fill in a UVersionInfo structure with the result.
+ * Definition of this function lives in putil.c
+ *
+ * @param versionArray The destination structure for the version information.
+ * @param versionString A string with dotted-decimal version information,
+ * with up to four non-negative number fields with
+ * values of up to 255 each.
+ * @stable ICU 2.4
+ */
+U_STABLE void U_EXPORT2
+u_versionFromString(UVersionInfo versionArray, const char *versionString);
+
+/**
+ * Write a string with dotted-decimal version information according
+ * to the input UVersionInfo.
+ * Definition of this function lives in putil.c
+ *
+ * @param versionArray The version information to be written as a string.
+ * @param versionString A string buffer that will be filled in with
+ * a string corresponding to the numeric version
+ * information in versionArray.
+ * The buffer size must be at least U_MAX_VERSION_STRING_LENGTH.
+ * @stable ICU 2.4
+ */
+U_STABLE void U_EXPORT2
+u_versionToString(UVersionInfo versionArray, char *versionString);
+
+/**
+ * Gets the ICU release version. The version array stores the version information
+ * for ICU. For example, release "1.3.31.2" is then represented as 0x01031F02.
+ * Definition of this function lives in putil.c
+ *
+ * @param versionArray the version # information, the result will be filled in
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+u_getVersion(UVersionInfo versionArray);
+
+
+/*===========================================================================
+ * ICU collation framework version information
+ * Version info that can be obtained from a collator is affected by these
+ * numbers in a secret and magic way. Please use collator version as whole
+ *===========================================================================
+ */
+
+/** Collation runtime version (sort key generator, strcoll).
+ * If the version is different, sortkeys for the same string could be different
+ * version 2 was in ICU 1.8.1. changed is: compression intervals, French secondary
+ * compression, generating quad level always when strength is quad or more
+ * version 4 - ICU 2.2 - tracking UCA changes, ignore completely ignorables
+ * in contractions, ignore primary ignorables after shifted
+ * version 5 - ICU 2.8 - changed implicit generation code
+ * This value may change in the subsequent releases of ICU
+ * @stable ICU 2.4
+ */
+#define UCOL_RUNTIME_VERSION 5
+
+/** Builder code version. When this is different, same tailoring might result
+ * in assigning different collation elements to code points
+ * version 2 was in ICU 1.8.1. added support for prefixes, tweaked canonical
+ * closure. However, the tailorings should probably get same CEs assigned
+ * version 5 - ICU 2.2 - fixed some bugs, renamed some indirect values.
+ * version 6 - ICU 2.8 - fixed bug in builder that allowed 0xFF in primary values
+ * Backward compatible with the old rules.
+ * This value may change in the subsequent releases of ICU
+ * @stable ICU 2.4
+ */
+#define UCOL_BUILDER_VERSION 6
+
+/** *** Removed *** Instead we use the data we read from FractionalUCA.txt
+ * This is the version of FractionalUCA.txt tailoring rules
+ * Version 1 was in ICU 1.8.1. Version two contains canonical closure for
+ * supplementary code points
+ * Version 4 in ICU 2.2, following UCA=3.1.1d6, UCD=3.2.0
+ * This value may change in the subsequent releases of ICU
+ * @stable ICU 2.4
+ */
+/*#define UCOL_FRACTIONAL_UCA_VERSION 4*/
+
+/** This is the version of the tailorings
+ * This value may change in the subsequent releases of ICU
+ * @stable ICU 2.4
+ */
+#define UCOL_TAILORINGS_VERSION 1
+
+#endif
diff --git a/Source/JavaScriptCore/interpreter/CachedCall.h b/Source/JavaScriptCore/interpreter/CachedCall.h
new file mode 100644
index 0000000..dfbe658
--- /dev/null
+++ b/Source/JavaScriptCore/interpreter/CachedCall.h
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CachedCall_h
+#define CachedCall_h
+
+#include "CallFrameClosure.h"
+#include "JSFunction.h"
+#include "JSGlobalObject.h"
+#include "Interpreter.h"
+
+namespace JSC {
+ class CachedCall : public Noncopyable {
+ public:
+ CachedCall(CallFrame* callFrame, JSFunction* function, int argCount)
+ : m_valid(false)
+ , m_interpreter(callFrame->interpreter())
+ , m_globalObjectScope(callFrame, function->scope().globalObject())
+ {
+ ASSERT(!function->isHostFunction());
+ m_closure = m_interpreter->prepareForRepeatCall(function->jsExecutable(), callFrame, function, argCount, function->scope().node());
+ m_valid = !callFrame->hadException();
+ }
+
+ JSValue call()
+ {
+ ASSERT(m_valid);
+ return m_interpreter->execute(m_closure);
+ }
+ void setThis(JSValue v) { m_closure.setArgument(0, v); }
+ void setArgument(int n, JSValue v) { m_closure.setArgument(n + 1, v); }
+
+ CallFrame* newCallFrame(ExecState* exec)
+ {
+ CallFrame* callFrame = m_closure.newCallFrame;
+ callFrame->setScopeChain(exec->scopeChain());
+ return callFrame;
+ }
+
+ ~CachedCall()
+ {
+ if (m_valid)
+ m_interpreter->endRepeatCall(m_closure);
+ }
+
+ private:
+ bool m_valid;
+ Interpreter* m_interpreter;
+ DynamicGlobalObjectScope m_globalObjectScope;
+ CallFrameClosure m_closure;
+ };
+}
+
+#endif
diff --git a/Source/JavaScriptCore/interpreter/CallFrame.cpp b/Source/JavaScriptCore/interpreter/CallFrame.cpp
new file mode 100644
index 0000000..5819875
--- /dev/null
+++ b/Source/JavaScriptCore/interpreter/CallFrame.cpp
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "CallFrame.h"
+
+#include "CodeBlock.h"
+#include "Interpreter.h"
+
+namespace JSC {
+
+#ifndef NDEBUG
+void CallFrame::dumpCaller()
+{
+ int signedLineNumber;
+ intptr_t sourceID;
+ UString urlString;
+ JSValue function;
+
+ interpreter()->retrieveLastCaller(this, signedLineNumber, sourceID, urlString, function);
+ printf("Callpoint => %s:%d\n", urlString.utf8().data(), signedLineNumber);
+}
+
+RegisterFile* CallFrame::registerFile()
+{
+ return &interpreter()->registerFile();
+}
+
+#endif
+
+}
diff --git a/Source/JavaScriptCore/interpreter/CallFrame.h b/Source/JavaScriptCore/interpreter/CallFrame.h
new file mode 100644
index 0000000..2797ef3
--- /dev/null
+++ b/Source/JavaScriptCore/interpreter/CallFrame.h
@@ -0,0 +1,167 @@
+/*
+ * Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
+ * Copyright (C) 2001 Peter Kelly (pmk@post.com)
+ * Copyright (C) 2003, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef CallFrame_h
+#define CallFrame_h
+
+#include "JSGlobalData.h"
+#include "MacroAssemblerCodeRef.h"
+#include "RegisterFile.h"
+#include "ScopeChain.h"
+
+namespace JSC {
+
+ class Arguments;
+ class JSActivation;
+ class Interpreter;
+
+ // Represents the current state of script execution.
+ // Passed as the first argument to most functions.
+ class ExecState : private Register {
+ public:
+ JSObject* callee() const { return this[RegisterFile::Callee].function(); }
+ CodeBlock* codeBlock() const { return this[RegisterFile::CodeBlock].Register::codeBlock(); }
+ ScopeChainNode* scopeChain() const
+ {
+ ASSERT(this[RegisterFile::ScopeChain].Register::scopeChain());
+ return this[RegisterFile::ScopeChain].Register::scopeChain();
+ }
+
+ // Global object in which execution began.
+ JSGlobalObject* dynamicGlobalObject();
+
+ // Global object in which the currently executing code was defined.
+ // Differs from dynamicGlobalObject() during function calls across web browser frames.
+ JSGlobalObject* lexicalGlobalObject() const
+ {
+ return scopeChain()->globalObject;
+ }
+
+ // Differs from lexicalGlobalObject because this will have DOM window shell rather than
+ // the actual DOM window, which can't be "this" for security reasons.
+ JSObject* globalThisValue() const
+ {
+ return scopeChain()->globalThis;
+ }
+
+ JSGlobalData& globalData() const
+ {
+ ASSERT(scopeChain()->globalData);
+ return *scopeChain()->globalData;
+ }
+
+ // Convenience functions for access to global data.
+ // It takes a few memory references to get from a call frame to the global data
+ // pointer, so these are inefficient, and should be used sparingly in new code.
+ // But they're used in many places in legacy code, so they're not going away any time soon.
+
+ void clearException() { globalData().exception = JSValue(); }
+ JSValue exception() const { return globalData().exception; }
+ bool hadException() const { return globalData().exception; }
+
+ const CommonIdentifiers& propertyNames() const { return *globalData().propertyNames; }
+ const MarkedArgumentBuffer& emptyList() const { return *globalData().emptyList; }
+ Interpreter* interpreter() { return globalData().interpreter; }
+ Heap* heap() { return &globalData().heap; }
+#ifndef NDEBUG
+ void dumpCaller();
+#endif
+ static const HashTable* arrayTable(CallFrame* callFrame) { return callFrame->globalData().arrayTable; }
+ static const HashTable* dateTable(CallFrame* callFrame) { return callFrame->globalData().dateTable; }
+ static const HashTable* jsonTable(CallFrame* callFrame) { return callFrame->globalData().jsonTable; }
+ static const HashTable* mathTable(CallFrame* callFrame) { return callFrame->globalData().mathTable; }
+ static const HashTable* numberTable(CallFrame* callFrame) { return callFrame->globalData().numberTable; }
+ static const HashTable* regExpTable(CallFrame* callFrame) { return callFrame->globalData().regExpTable; }
+ static const HashTable* regExpConstructorTable(CallFrame* callFrame) { return callFrame->globalData().regExpConstructorTable; }
+ static const HashTable* stringTable(CallFrame* callFrame) { return callFrame->globalData().stringTable; }
+
+ static CallFrame* create(Register* callFrameBase) { return static_cast<CallFrame*>(callFrameBase); }
+ Register* registers() { return this; }
+
+ CallFrame& operator=(const Register& r) { *static_cast<Register*>(this) = r; return *this; }
+
+ CallFrame* callerFrame() const { return this[RegisterFile::CallerFrame].callFrame(); }
+#if ENABLE(JIT)
+ ReturnAddressPtr returnPC() const { return ReturnAddressPtr(this[RegisterFile::ReturnPC].vPC()); }
+#endif
+#if ENABLE(INTERPRETER)
+ Instruction* returnVPC() const { return this[RegisterFile::ReturnPC].vPC(); }
+#endif
+
+ void setCallerFrame(CallFrame* callerFrame) { static_cast<Register*>(this)[RegisterFile::CallerFrame] = callerFrame; }
+ void setScopeChain(ScopeChainNode* scopeChain) { static_cast<Register*>(this)[RegisterFile::ScopeChain] = scopeChain; }
+
+ ALWAYS_INLINE void init(CodeBlock* codeBlock, Instruction* vPC, ScopeChainNode* scopeChain,
+ CallFrame* callerFrame, int argc, JSObject* callee)
+ {
+ ASSERT(callerFrame); // Use noCaller() rather than 0 for the outer host call frame caller.
+ ASSERT(callerFrame == noCaller() || callerFrame->removeHostCallFrameFlag()->registerFile()->end() >= this);
+
+ setCodeBlock(codeBlock);
+ setScopeChain(scopeChain);
+ setCallerFrame(callerFrame);
+ setReturnPC(vPC); // This is either an Instruction* or a pointer into JIT generated code stored as an Instruction*.
+ setArgumentCountIncludingThis(argc); // original argument count (for the sake of the "arguments" object)
+ setCallee(callee);
+ }
+
+ // Read a register from the codeframe (or constant from the CodeBlock).
+ inline Register& r(int);
+ // Read a register for a non-constant
+ inline Register& uncheckedR(int);
+
+ // Access to arguments.
+ int hostThisRegister() { return -RegisterFile::CallFrameHeaderSize - argumentCountIncludingThis(); }
+ JSValue hostThisValue() { return this[hostThisRegister()].jsValue(); }
+ size_t argumentCount() const { return argumentCountIncludingThis() - 1; }
+ size_t argumentCountIncludingThis() const { return this[RegisterFile::ArgumentCount].i(); }
+ JSValue argument(int argumentNumber)
+ {
+ int argumentIndex = -RegisterFile::CallFrameHeaderSize - this[RegisterFile::ArgumentCount].i() + argumentNumber + 1;
+ if (argumentIndex >= -RegisterFile::CallFrameHeaderSize)
+ return jsUndefined();
+ return this[argumentIndex].jsValue();
+ }
+
+ static CallFrame* noCaller() { return reinterpret_cast<CallFrame*>(HostCallFrameFlag); }
+
+ bool hasHostCallFrameFlag() const { return reinterpret_cast<intptr_t>(this) & HostCallFrameFlag; }
+ CallFrame* addHostCallFrameFlag() const { return reinterpret_cast<CallFrame*>(reinterpret_cast<intptr_t>(this) | HostCallFrameFlag); }
+ CallFrame* removeHostCallFrameFlag() { return reinterpret_cast<CallFrame*>(reinterpret_cast<intptr_t>(this) & ~HostCallFrameFlag); }
+
+ void setArgumentCountIncludingThis(int count) { static_cast<Register*>(this)[RegisterFile::ArgumentCount] = Register::withInt(count); }
+ void setCallee(JSObject* callee) { static_cast<Register*>(this)[RegisterFile::Callee] = Register::withCallee(callee); }
+ void setCodeBlock(CodeBlock* codeBlock) { static_cast<Register*>(this)[RegisterFile::CodeBlock] = codeBlock; }
+ void setReturnPC(void* value) { static_cast<Register*>(this)[RegisterFile::ReturnPC] = (Instruction*)value; }
+
+ private:
+ static const intptr_t HostCallFrameFlag = 1;
+#ifndef NDEBUG
+ RegisterFile* registerFile();
+#endif
+ ExecState();
+ ~ExecState();
+ };
+
+} // namespace JSC
+
+#endif // CallFrame_h
diff --git a/Source/JavaScriptCore/interpreter/CallFrameClosure.h b/Source/JavaScriptCore/interpreter/CallFrameClosure.h
new file mode 100644
index 0000000..b4b7efd
--- /dev/null
+++ b/Source/JavaScriptCore/interpreter/CallFrameClosure.h
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CallFrameClosure_h
+#define CallFrameClosure_h
+
+namespace JSC {
+
+struct CallFrameClosure {
+ CallFrame* oldCallFrame;
+ CallFrame* newCallFrame;
+ JSFunction* function;
+ FunctionExecutable* functionExecutable;
+ JSGlobalData* globalData;
+ Register* oldEnd;
+ ScopeChainNode* scopeChain;
+ int expectedParams;
+ int providedParams;
+
+ void setArgument(int arg, JSValue value)
+ {
+ if (arg < expectedParams)
+ newCallFrame[arg - RegisterFile::CallFrameHeaderSize - expectedParams] = value;
+ else
+ newCallFrame[arg - RegisterFile::CallFrameHeaderSize - expectedParams - providedParams] = value;
+ }
+
+ void resetCallFrame()
+ {
+ newCallFrame->setScopeChain(scopeChain);
+ for (int i = providedParams; i < expectedParams; ++i)
+ newCallFrame[i - RegisterFile::CallFrameHeaderSize - expectedParams] = jsUndefined();
+ }
+};
+
+}
+
+#endif
diff --git a/Source/JavaScriptCore/interpreter/Interpreter.cpp b/Source/JavaScriptCore/interpreter/Interpreter.cpp
new file mode 100644
index 0000000..57c068a
--- /dev/null
+++ b/Source/JavaScriptCore/interpreter/Interpreter.cpp
@@ -0,0 +1,4921 @@
+/*
+ * Copyright (C) 2008, 2009, 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2008 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "Interpreter.h"
+
+#include "Arguments.h"
+#include "BatchedTransitionOptimizer.h"
+#include "CallFrame.h"
+#include "CallFrameClosure.h"
+#include "CodeBlock.h"
+#include "Collector.h"
+#include "Debugger.h"
+#include "DebuggerCallFrame.h"
+#include "ErrorInstance.h"
+#include "EvalCodeCache.h"
+#include "ExceptionHelpers.h"
+#include "GetterSetter.h"
+#include "GlobalEvalFunction.h"
+#include "JSActivation.h"
+#include "JSArray.h"
+#include "JSByteArray.h"
+#include "JSFunction.h"
+#include "JSNotAnObject.h"
+#include "JSPropertyNameIterator.h"
+#include "LiteralParser.h"
+#include "JSStaticScopeObject.h"
+#include "JSString.h"
+#include "ObjectPrototype.h"
+#include "Operations.h"
+#include "Parser.h"
+#include "Profiler.h"
+#include "RegExpObject.h"
+#include "RegExpPrototype.h"
+#include "Register.h"
+#include "SamplingTool.h"
+#include "StrictEvalActivation.h"
+#include "UStringConcatenate.h"
+#include <limits.h>
+#include <stdio.h>
+#include <wtf/Threading.h>
+
+#if ENABLE(JIT)
+#include "JIT.h"
+#endif
+
+#define WTF_USE_GCC_COMPUTED_GOTO_WORKAROUND (ENABLE(COMPUTED_GOTO_INTERPRETER) && !defined(__llvm__))
+
+using namespace std;
+
+namespace JSC {
+
+// Returns the depth of the scope chain within a given call frame.
+static int depth(CodeBlock* codeBlock, ScopeChain& sc)
+{
+ if (!codeBlock->needsFullScopeChain())
+ return 0;
+ return sc.localDepth();
+}
+
+#if ENABLE(INTERPRETER)
+static NEVER_INLINE JSValue concatenateStrings(ExecState* exec, Register* strings, unsigned count)
+{
+ return jsString(exec, strings, count);
+}
+
+NEVER_INLINE bool Interpreter::resolve(CallFrame* callFrame, Instruction* vPC, JSValue& exceptionValue)
+{
+ int dst = vPC[1].u.operand;
+ int property = vPC[2].u.operand;
+
+ ScopeChainNode* scopeChain = callFrame->scopeChain();
+ ScopeChainIterator iter = scopeChain->begin();
+ ScopeChainIterator end = scopeChain->end();
+ ASSERT(iter != end);
+
+ CodeBlock* codeBlock = callFrame->codeBlock();
+ Identifier& ident = codeBlock->identifier(property);
+ do {
+ JSObject* o = *iter;
+ PropertySlot slot(o);
+ if (o->getPropertySlot(callFrame, ident, slot)) {
+ JSValue result = slot.getValue(callFrame, ident);
+ exceptionValue = callFrame->globalData().exception;
+ if (exceptionValue)
+ return false;
+ callFrame->uncheckedR(dst) = JSValue(result);
+ return true;
+ }
+ } while (++iter != end);
+ exceptionValue = createUndefinedVariableError(callFrame, ident);
+ return false;
+}
+
+NEVER_INLINE bool Interpreter::resolveSkip(CallFrame* callFrame, Instruction* vPC, JSValue& exceptionValue)
+{
+ CodeBlock* codeBlock = callFrame->codeBlock();
+
+ int dst = vPC[1].u.operand;
+ int property = vPC[2].u.operand;
+ int skip = vPC[3].u.operand;
+
+ ScopeChainNode* scopeChain = callFrame->scopeChain();
+ ScopeChainIterator iter = scopeChain->begin();
+ ScopeChainIterator end = scopeChain->end();
+ ASSERT(iter != end);
+ bool checkTopLevel = codeBlock->codeType() == FunctionCode && codeBlock->needsFullScopeChain();
+ ASSERT(skip || !checkTopLevel);
+ if (checkTopLevel && skip--) {
+ if (callFrame->uncheckedR(codeBlock->activationRegister()).jsValue())
+ ++iter;
+ }
+ while (skip--) {
+ ++iter;
+ ASSERT(iter != end);
+ }
+ Identifier& ident = codeBlock->identifier(property);
+ do {
+ JSObject* o = *iter;
+ PropertySlot slot(o);
+ if (o->getPropertySlot(callFrame, ident, slot)) {
+ JSValue result = slot.getValue(callFrame, ident);
+ exceptionValue = callFrame->globalData().exception;
+ if (exceptionValue)
+ return false;
+ ASSERT(result);
+ callFrame->uncheckedR(dst) = JSValue(result);
+ return true;
+ }
+ } while (++iter != end);
+ exceptionValue = createUndefinedVariableError(callFrame, ident);
+ return false;
+}
+
+NEVER_INLINE bool Interpreter::resolveGlobal(CallFrame* callFrame, Instruction* vPC, JSValue& exceptionValue)
+{
+ int dst = vPC[1].u.operand;
+ CodeBlock* codeBlock = callFrame->codeBlock();
+ JSGlobalObject* globalObject = codeBlock->globalObject();
+ ASSERT(globalObject->isGlobalObject());
+ int property = vPC[2].u.operand;
+ Structure* structure = vPC[3].u.structure;
+ int offset = vPC[4].u.operand;
+
+ if (structure == globalObject->structure()) {
+ callFrame->uncheckedR(dst) = JSValue(globalObject->getDirectOffset(offset));
+ return true;
+ }
+
+ Identifier& ident = codeBlock->identifier(property);
+ PropertySlot slot(globalObject);
+ if (globalObject->getPropertySlot(callFrame, ident, slot)) {
+ JSValue result = slot.getValue(callFrame, ident);
+ if (slot.isCacheableValue() && !globalObject->structure()->isUncacheableDictionary() && slot.slotBase() == globalObject) {
+ if (vPC[3].u.structure)
+ vPC[3].u.structure->deref();
+ globalObject->structure()->ref();
+ vPC[3] = globalObject->structure();
+ vPC[4] = slot.cachedOffset();
+ callFrame->uncheckedR(dst) = JSValue(result);
+ return true;
+ }
+
+ exceptionValue = callFrame->globalData().exception;
+ if (exceptionValue)
+ return false;
+ callFrame->uncheckedR(dst) = JSValue(result);
+ return true;
+ }
+
+ exceptionValue = createUndefinedVariableError(callFrame, ident);
+ return false;
+}
+
+NEVER_INLINE bool Interpreter::resolveGlobalDynamic(CallFrame* callFrame, Instruction* vPC, JSValue& exceptionValue)
+{
+ int dst = vPC[1].u.operand;
+ CodeBlock* codeBlock = callFrame->codeBlock();
+ JSGlobalObject* globalObject = codeBlock->globalObject();
+ ASSERT(globalObject->isGlobalObject());
+ int property = vPC[2].u.operand;
+ Structure* structure = vPC[3].u.structure;
+ int offset = vPC[4].u.operand;
+ int skip = vPC[5].u.operand;
+
+ ScopeChainNode* scopeChain = callFrame->scopeChain();
+ ScopeChainIterator iter = scopeChain->begin();
+ ScopeChainIterator end = scopeChain->end();
+ ASSERT(iter != end);
+ bool checkTopLevel = codeBlock->codeType() == FunctionCode && codeBlock->needsFullScopeChain();
+ ASSERT(skip || !checkTopLevel);
+ if (checkTopLevel && skip--) {
+ if (callFrame->uncheckedR(codeBlock->activationRegister()).jsValue())
+ ++iter;
+ }
+ while (skip--) {
+ JSObject* o = *iter;
+ if (o->hasCustomProperties()) {
+ Identifier& ident = codeBlock->identifier(property);
+ do {
+ PropertySlot slot(o);
+ if (o->getPropertySlot(callFrame, ident, slot)) {
+ JSValue result = slot.getValue(callFrame, ident);
+ exceptionValue = callFrame->globalData().exception;
+ if (exceptionValue)
+ return false;
+ ASSERT(result);
+ callFrame->uncheckedR(dst) = JSValue(result);
+ return true;
+ }
+ if (iter == end)
+ break;
+ o = *iter;
+ ++iter;
+ } while (true);
+ exceptionValue = createUndefinedVariableError(callFrame, ident);
+ return false;
+ }
+ ++iter;
+ }
+
+ if (structure == globalObject->structure()) {
+ callFrame->uncheckedR(dst) = JSValue(globalObject->getDirectOffset(offset));
+ ASSERT(callFrame->uncheckedR(dst).jsValue());
+ return true;
+ }
+
+ Identifier& ident = codeBlock->identifier(property);
+ PropertySlot slot(globalObject);
+ if (globalObject->getPropertySlot(callFrame, ident, slot)) {
+ JSValue result = slot.getValue(callFrame, ident);
+ if (slot.isCacheableValue() && !globalObject->structure()->isUncacheableDictionary() && slot.slotBase() == globalObject) {
+ if (vPC[3].u.structure)
+ vPC[3].u.structure->deref();
+ globalObject->structure()->ref();
+ vPC[3] = globalObject->structure();
+ vPC[4] = slot.cachedOffset();
+ ASSERT(result);
+ callFrame->uncheckedR(dst) = JSValue(result);
+ return true;
+ }
+
+ exceptionValue = callFrame->globalData().exception;
+ if (exceptionValue)
+ return false;
+ ASSERT(result);
+ callFrame->uncheckedR(dst) = JSValue(result);
+ return true;
+ }
+
+ exceptionValue = createUndefinedVariableError(callFrame, ident);
+ return false;
+}
+
+NEVER_INLINE void Interpreter::resolveBase(CallFrame* callFrame, Instruction* vPC)
+{
+ int dst = vPC[1].u.operand;
+ int property = vPC[2].u.operand;
+ bool isStrictPut = vPC[3].u.operand;
+ Identifier ident = callFrame->codeBlock()->identifier(property);
+ JSValue result = JSC::resolveBase(callFrame, ident, callFrame->scopeChain(), isStrictPut);
+ if (result) {
+ callFrame->uncheckedR(dst) = result;
+ ASSERT(callFrame->uncheckedR(dst).jsValue());
+ } else
+ callFrame->globalData().exception = createErrorForInvalidGlobalAssignment(callFrame, ident.ustring());
+}
+
+NEVER_INLINE bool Interpreter::resolveBaseAndProperty(CallFrame* callFrame, Instruction* vPC, JSValue& exceptionValue)
+{
+ int baseDst = vPC[1].u.operand;
+ int propDst = vPC[2].u.operand;
+ int property = vPC[3].u.operand;
+
+ ScopeChainNode* scopeChain = callFrame->scopeChain();
+ ScopeChainIterator iter = scopeChain->begin();
+ ScopeChainIterator end = scopeChain->end();
+
+ // FIXME: add scopeDepthIsZero optimization
+
+ ASSERT(iter != end);
+
+ CodeBlock* codeBlock = callFrame->codeBlock();
+ Identifier& ident = codeBlock->identifier(property);
+ JSObject* base;
+ do {
+ base = *iter;
+ PropertySlot slot(base);
+ if (base->getPropertySlot(callFrame, ident, slot)) {
+ JSValue result = slot.getValue(callFrame, ident);
+ exceptionValue = callFrame->globalData().exception;
+ if (exceptionValue)
+ return false;
+ callFrame->uncheckedR(propDst) = JSValue(result);
+ callFrame->uncheckedR(baseDst) = JSValue(base);
+ return true;
+ }
+ ++iter;
+ } while (iter != end);
+
+ exceptionValue = createUndefinedVariableError(callFrame, ident);
+ return false;
+}
+
+#endif // ENABLE(INTERPRETER)
+
+ALWAYS_INLINE CallFrame* Interpreter::slideRegisterWindowForCall(CodeBlock* newCodeBlock, RegisterFile* registerFile, CallFrame* callFrame, size_t registerOffset, int argc)
+{
+ Register* r = callFrame->registers();
+ Register* newEnd = r + registerOffset + newCodeBlock->m_numCalleeRegisters;
+
+ if (LIKELY(argc == newCodeBlock->m_numParameters)) { // correct number of arguments
+ if (UNLIKELY(!registerFile->grow(newEnd)))
+ return 0;
+ r += registerOffset;
+ } else if (argc < newCodeBlock->m_numParameters) { // too few arguments -- fill in the blanks
+ size_t omittedArgCount = newCodeBlock->m_numParameters - argc;
+ registerOffset += omittedArgCount;
+ newEnd += omittedArgCount;
+ if (!registerFile->grow(newEnd))
+ return 0;
+ r += registerOffset;
+
+ Register* argv = r - RegisterFile::CallFrameHeaderSize - omittedArgCount;
+ for (size_t i = 0; i < omittedArgCount; ++i)
+ argv[i] = jsUndefined();
+ } else { // too many arguments -- copy expected arguments, leaving the extra arguments behind
+ size_t numParameters = newCodeBlock->m_numParameters;
+ registerOffset += numParameters;
+ newEnd += numParameters;
+
+ if (!registerFile->grow(newEnd))
+ return 0;
+ r += registerOffset;
+
+ Register* argv = r - RegisterFile::CallFrameHeaderSize - numParameters - argc;
+ for (size_t i = 0; i < numParameters; ++i)
+ argv[i + argc] = argv[i];
+ }
+
+ return CallFrame::create(r);
+}
+
+#if ENABLE(INTERPRETER)
+static NEVER_INLINE bool isInvalidParamForIn(CallFrame* callFrame, JSValue value, JSValue& exceptionData)
+{
+ if (value.isObject())
+ return false;
+ exceptionData = createInvalidParamError(callFrame, "in" , value);
+ return true;
+}
+
+static NEVER_INLINE bool isInvalidParamForInstanceOf(CallFrame* callFrame, JSValue value, JSValue& exceptionData)
+{
+ if (value.isObject() && asObject(value)->structure()->typeInfo().implementsHasInstance())
+ return false;
+ exceptionData = createInvalidParamError(callFrame, "instanceof" , value);
+ return true;
+}
+#endif
+
+NEVER_INLINE JSValue Interpreter::callEval(CallFrame* callFrame, RegisterFile* registerFile, Register* argv, int argc, int registerOffset)
+{
+ if (argc < 2)
+ return jsUndefined();
+
+ JSValue program = argv[1].jsValue();
+
+ if (!program.isString())
+ return program;
+
+ UString programSource = asString(program)->value(callFrame);
+ if (callFrame->hadException())
+ return JSValue();
+
+ CodeBlock* codeBlock = callFrame->codeBlock();
+ if (!codeBlock->isStrictMode()) {
+ // FIXME: We can use the preparser in strict mode, we just need additional logic
+ // to prevent duplicates.
+ LiteralParser preparser(callFrame, programSource, LiteralParser::NonStrictJSON);
+ if (JSValue parsedObject = preparser.tryLiteralParse())
+ return parsedObject;
+ }
+
+ ScopeChainNode* scopeChain = callFrame->scopeChain();
+ JSValue exceptionValue;
+ RefPtr<EvalExecutable> eval = codeBlock->evalCodeCache().get(callFrame, codeBlock->isStrictMode(), programSource, scopeChain, exceptionValue);
+
+ ASSERT(!eval == exceptionValue);
+ if (UNLIKELY(!eval))
+ return throwError(callFrame, exceptionValue);
+
+ return callFrame->globalData().interpreter->execute(eval.get(), callFrame, callFrame->uncheckedR(codeBlock->thisRegister()).jsValue().toThisObject(callFrame), callFrame->registers() - registerFile->start() + registerOffset, scopeChain);
+}
+
+Interpreter::Interpreter()
+ : m_sampleEntryDepth(0)
+ , m_reentryDepth(0)
+{
+#if ENABLE(COMPUTED_GOTO_INTERPRETER)
+ privateExecute(InitializeAndReturn, 0, 0);
+
+ for (int i = 0; i < numOpcodeIDs; ++i)
+ m_opcodeIDTable.add(m_opcodeTable[i], static_cast<OpcodeID>(i));
+#endif // ENABLE(COMPUTED_GOTO_INTERPRETER)
+
+#if ENABLE(OPCODE_SAMPLING)
+ enableSampler();
+#endif
+}
+
+#ifndef NDEBUG
+
+void Interpreter::dumpCallFrame(CallFrame* callFrame)
+{
+ callFrame->codeBlock()->dump(callFrame);
+ dumpRegisters(callFrame);
+}
+
+void Interpreter::dumpRegisters(CallFrame* callFrame)
+{
+ printf("Register frame: \n\n");
+ printf("-----------------------------------------------------------------------------\n");
+ printf(" use | address | value \n");
+ printf("-----------------------------------------------------------------------------\n");
+
+ CodeBlock* codeBlock = callFrame->codeBlock();
+ RegisterFile* registerFile = &callFrame->scopeChain()->globalObject->globalData().interpreter->registerFile();
+ const Register* it;
+ const Register* end;
+ JSValue v;
+
+ if (codeBlock->codeType() == GlobalCode) {
+ it = registerFile->lastGlobal();
+ end = it + registerFile->numGlobals();
+ while (it != end) {
+ v = (*it).jsValue();
+#if USE(JSVALUE32_64)
+ printf("[global var] | %10p | %-16s 0x%llx \n", it, v.description(), JSValue::encode(v));
+#else
+ printf("[global var] | %10p | %-16s %p \n", it, v.description(), JSValue::encode(v));
+#endif
+ ++it;
+ }
+ printf("-----------------------------------------------------------------------------\n");
+ }
+
+ it = callFrame->registers() - RegisterFile::CallFrameHeaderSize - codeBlock->m_numParameters;
+ v = (*it).jsValue();
+#if USE(JSVALUE32_64)
+ printf("[this] | %10p | %-16s 0x%llx \n", it, v.description(), JSValue::encode(v)); ++it;
+#else
+ printf("[this] | %10p | %-16s %p \n", it, v.description(), JSValue::encode(v)); ++it;
+#endif
+ end = it + max(codeBlock->m_numParameters - 1, 0); // - 1 to skip "this"
+ if (it != end) {
+ do {
+ v = (*it).jsValue();
+#if USE(JSVALUE32_64)
+ printf("[param] | %10p | %-16s 0x%llx \n", it, v.description(), JSValue::encode(v));
+#else
+ printf("[param] | %10p | %-16s %p \n", it, v.description(), JSValue::encode(v));
+#endif
+ ++it;
+ } while (it != end);
+ }
+ printf("-----------------------------------------------------------------------------\n");
+ printf("[CodeBlock] | %10p | %p \n", it, (*it).codeBlock()); ++it;
+ printf("[ScopeChain] | %10p | %p \n", it, (*it).scopeChain()); ++it;
+ printf("[CallerRegisters] | %10p | %d \n", it, (*it).i()); ++it;
+ printf("[ReturnPC] | %10p | %p \n", it, (*it).vPC()); ++it;
+ printf("[ArgumentCount] | %10p | %d \n", it, (*it).i()); ++it;
+ printf("[Callee] | %10p | %p \n", it, (*it).function()); ++it;
+ printf("-----------------------------------------------------------------------------\n");
+
+ int registerCount = 0;
+
+ end = it + codeBlock->m_numVars;
+ if (it != end) {
+ do {
+ v = (*it).jsValue();
+#if USE(JSVALUE32_64)
+ printf("[r%2d] | %10p | %-16s 0x%llx \n", registerCount, it, v.description(), JSValue::encode(v));
+#else
+ printf("[r%2d] | %10p | %-16s %p \n", registerCount, it, v.description(), JSValue::encode(v));
+#endif
+ ++it;
+ ++registerCount;
+ } while (it != end);
+ }
+ printf("-----------------------------------------------------------------------------\n");
+
+ end = it + codeBlock->m_numCalleeRegisters - codeBlock->m_numVars;
+ if (it != end) {
+ do {
+ v = (*it).jsValue();
+#if USE(JSVALUE32_64)
+ printf("[r%2d] | %10p | %-16s 0x%llx \n", registerCount, it, v.description(), JSValue::encode(v));
+#else
+ printf("[r%2d] | %10p | %-16s %p \n", registerCount, it, v.description(), JSValue::encode(v));
+#endif
+ ++it;
+ ++registerCount;
+ } while (it != end);
+ }
+ printf("-----------------------------------------------------------------------------\n");
+}
+
+#endif
+
+bool Interpreter::isOpcode(Opcode opcode)
+{
+#if ENABLE(COMPUTED_GOTO_INTERPRETER)
+ return opcode != HashTraits<Opcode>::emptyValue()
+ && !HashTraits<Opcode>::isDeletedValue(opcode)
+ && m_opcodeIDTable.contains(opcode);
+#else
+ return opcode >= 0 && opcode <= op_end;
+#endif
+}
+
+NEVER_INLINE bool Interpreter::unwindCallFrame(CallFrame*& callFrame, JSValue exceptionValue, unsigned& bytecodeOffset, CodeBlock*& codeBlock)
+{
+ CodeBlock* oldCodeBlock = codeBlock;
+ ScopeChainNode* scopeChain = callFrame->scopeChain();
+
+ if (Debugger* debugger = callFrame->dynamicGlobalObject()->debugger()) {
+ DebuggerCallFrame debuggerCallFrame(callFrame, exceptionValue);
+ if (callFrame->callee())
+ debugger->returnEvent(debuggerCallFrame, codeBlock->ownerExecutable()->sourceID(), codeBlock->ownerExecutable()->lastLine());
+ else
+ debugger->didExecuteProgram(debuggerCallFrame, codeBlock->ownerExecutable()->sourceID(), codeBlock->ownerExecutable()->lastLine());
+ }
+
+ // If this call frame created an activation or an 'arguments' object, tear it off.
+ if (oldCodeBlock->codeType() == FunctionCode && oldCodeBlock->needsFullScopeChain()) {
+ if (!callFrame->uncheckedR(oldCodeBlock->activationRegister()).jsValue()) {
+ oldCodeBlock->createActivation(callFrame);
+ scopeChain = callFrame->scopeChain();
+ }
+ while (!scopeChain->object->inherits(&JSActivation::info))
+ scopeChain = scopeChain->pop();
+ JSActivation* activation = asActivation(scopeChain->object);
+ activation->copyRegisters();
+ if (JSValue arguments = callFrame->uncheckedR(unmodifiedArgumentsRegister(oldCodeBlock->argumentsRegister())).jsValue()) {
+ if (!oldCodeBlock->isStrictMode())
+ asArguments(arguments)->setActivation(activation);
+ }
+ } else if (oldCodeBlock->usesArguments() && !oldCodeBlock->isStrictMode()) {
+ if (JSValue arguments = callFrame->uncheckedR(unmodifiedArgumentsRegister(oldCodeBlock->argumentsRegister())).jsValue())
+ asArguments(arguments)->copyRegisters();
+ }
+
+ if (oldCodeBlock->needsFullScopeChain())
+ scopeChain->deref();
+
+ CallFrame* callerFrame = callFrame->callerFrame();
+ if (callerFrame->hasHostCallFrameFlag())
+ return false;
+
+ codeBlock = callerFrame->codeBlock();
+#if ENABLE(JIT) && ENABLE(INTERPRETER)
+ if (callerFrame->globalData().canUseJIT())
+ bytecodeOffset = codeBlock->bytecodeOffset(callFrame->returnPC());
+ else
+ bytecodeOffset = codeBlock->bytecodeOffset(callFrame->returnVPC());
+#elif ENABLE(JIT)
+ bytecodeOffset = codeBlock->bytecodeOffset(callFrame->returnPC());
+#else
+ bytecodeOffset = codeBlock->bytecodeOffset(callFrame->returnVPC());
+#endif
+
+ callFrame = callerFrame;
+ return true;
+}
+
+static void appendSourceToError(CallFrame* callFrame, ErrorInstance* exception, unsigned bytecodeOffset)
+{
+ exception->clearAppendSourceToMessage();
+
+ if (!callFrame->codeBlock()->hasExpressionInfo())
+ return;
+
+ int startOffset = 0;
+ int endOffset = 0;
+ int divotPoint = 0;
+
+ CodeBlock* codeBlock = callFrame->codeBlock();
+ codeBlock->expressionRangeForBytecodeOffset(bytecodeOffset, divotPoint, startOffset, endOffset);
+
+ int expressionStart = divotPoint - startOffset;
+ int expressionStop = divotPoint + endOffset;
+
+ if (!expressionStop || expressionStart > codeBlock->source()->length())
+ return;
+
+ JSGlobalData* globalData = &callFrame->globalData();
+ JSValue jsMessage = exception->getDirect(globalData->propertyNames->message);
+ if (!jsMessage || !jsMessage.isString())
+ return;
+
+ UString message = asString(jsMessage)->value(callFrame);
+
+ if (expressionStart < expressionStop)
+ message = makeUString(message, " (evaluating '", codeBlock->source()->getRange(expressionStart, expressionStop), "')");
+ else {
+ // No range information, so give a few characters of context
+ const UChar* data = codeBlock->source()->data();
+ int dataLength = codeBlock->source()->length();
+ int start = expressionStart;
+ int stop = expressionStart;
+ // Get up to 20 characters of context to the left and right of the divot, clamping to the line.
+ // then strip whitespace.
+ while (start > 0 && (expressionStart - start < 20) && data[start - 1] != '\n')
+ start--;
+ while (start < (expressionStart - 1) && isStrWhiteSpace(data[start]))
+ start++;
+ while (stop < dataLength && (stop - expressionStart < 20) && data[stop] != '\n')
+ stop++;
+ while (stop > expressionStart && isStrWhiteSpace(data[stop]))
+ stop--;
+ message = makeUString(message, " (near '...", codeBlock->source()->getRange(start, stop), "...')");
+ }
+
+ exception->putDirect(globalData->propertyNames->message, jsString(globalData, message));
+}
+
+NEVER_INLINE HandlerInfo* Interpreter::throwException(CallFrame*& callFrame, JSValue& exceptionValue, unsigned bytecodeOffset)
+{
+ CodeBlock* codeBlock = callFrame->codeBlock();
+ bool isInterrupt = false;
+
+ // Set up the exception object
+ if (exceptionValue.isObject()) {
+ JSObject* exception = asObject(exceptionValue);
+
+ if (exception->isErrorInstance() && static_cast<ErrorInstance*>(exception)->appendSourceToMessage())
+ appendSourceToError(callFrame, static_cast<ErrorInstance*>(exception), bytecodeOffset);
+
+ // Using hasExpressionInfo to imply we are interested in rich exception info.
+ if (codeBlock->hasExpressionInfo() && !hasErrorInfo(callFrame, exception)) {
+ ASSERT(codeBlock->hasLineInfo());
+
+ // FIXME: should only really be adding these properties to VM generated exceptions,
+ // but the inspector currently requires these for all thrown objects.
+ addErrorInfo(callFrame, exception, codeBlock->lineNumberForBytecodeOffset(bytecodeOffset), codeBlock->ownerExecutable()->source());
+ }
+
+ ComplType exceptionType = exception->exceptionType();
+ isInterrupt = exceptionType == Interrupted || exceptionType == Terminated;
+ }
+
+ if (Debugger* debugger = callFrame->dynamicGlobalObject()->debugger()) {
+ DebuggerCallFrame debuggerCallFrame(callFrame, exceptionValue);
+ bool hasHandler = codeBlock->handlerForBytecodeOffset(bytecodeOffset);
+ debugger->exception(debuggerCallFrame, codeBlock->ownerExecutable()->sourceID(), codeBlock->lineNumberForBytecodeOffset(bytecodeOffset), hasHandler);
+ }
+
+ // Calculate an exception handler vPC, unwinding call frames as necessary.
+ HandlerInfo* handler = 0;
+ while (isInterrupt || !(handler = codeBlock->handlerForBytecodeOffset(bytecodeOffset))) {
+ if (!unwindCallFrame(callFrame, exceptionValue, bytecodeOffset, codeBlock)) {
+ if (Profiler* profiler = *Profiler::enabledProfilerReference())
+ profiler->exceptionUnwind(callFrame);
+ return 0;
+ }
+ }
+
+ if (Profiler* profiler = *Profiler::enabledProfilerReference())
+ profiler->exceptionUnwind(callFrame);
+
+ // Shrink the JS stack, in case stack overflow made it huge.
+ Register* highWaterMark = 0;
+ for (CallFrame* callerFrame = callFrame; callerFrame; callerFrame = callerFrame->callerFrame()->removeHostCallFrameFlag()) {
+ CodeBlock* codeBlock = callerFrame->codeBlock();
+ if (!codeBlock)
+ continue;
+ Register* callerHighWaterMark = callerFrame->registers() + codeBlock->m_numCalleeRegisters;
+ highWaterMark = max(highWaterMark, callerHighWaterMark);
+ }
+ m_registerFile.shrink(highWaterMark);
+
+ // Unwind the scope chain within the exception handler's call frame.
+ ScopeChainNode* scopeChain = callFrame->scopeChain();
+ ScopeChain sc(scopeChain);
+ int scopeDelta = 0;
+ if (!codeBlock->needsFullScopeChain() || codeBlock->codeType() != FunctionCode
+ || callFrame->uncheckedR(codeBlock->activationRegister()).jsValue())
+ scopeDelta = depth(codeBlock, sc) - handler->scopeDepth;
+ ASSERT(scopeDelta >= 0);
+ while (scopeDelta--)
+ scopeChain = scopeChain->pop();
+ callFrame->setScopeChain(scopeChain);
+
+ return handler;
+}
+
+static inline JSValue checkedReturn(JSValue returnValue)
+{
+ ASSERT(returnValue);
+ return returnValue;
+}
+
+static inline JSObject* checkedReturn(JSObject* returnValue)
+{
+ ASSERT(returnValue);
+ return returnValue;
+}
+
+JSValue Interpreter::execute(ProgramExecutable* program, CallFrame* callFrame, ScopeChainNode* scopeChain, JSObject* thisObj)
+{
+ ASSERT(!scopeChain->globalData->exception);
+
+ if (m_reentryDepth >= MaxSmallThreadReentryDepth && m_reentryDepth >= callFrame->globalData().maxReentryDepth)
+ return checkedReturn(throwStackOverflowError(callFrame));
+
+ JSObject* error = program->compile(callFrame, scopeChain);
+ if (error)
+ return checkedReturn(throwError(callFrame, error));
+ CodeBlock* codeBlock = &program->generatedBytecode();
+
+ Register* oldEnd = m_registerFile.end();
+ Register* newEnd = oldEnd + codeBlock->m_numParameters + RegisterFile::CallFrameHeaderSize + codeBlock->m_numCalleeRegisters;
+ if (!m_registerFile.grow(newEnd))
+ return checkedReturn(throwStackOverflowError(callFrame));
+
+ JSGlobalObject* lastGlobalObject = m_registerFile.globalObject();
+ JSGlobalObject* globalObject = callFrame->dynamicGlobalObject();
+ globalObject->copyGlobalsTo(m_registerFile);
+
+ CallFrame* newCallFrame = CallFrame::create(oldEnd + codeBlock->m_numParameters + RegisterFile::CallFrameHeaderSize);
+ ASSERT(codeBlock->m_numParameters == 1); // 1 parameter for 'this'.
+ newCallFrame->init(codeBlock, 0, scopeChain, CallFrame::noCaller(), codeBlock->m_numParameters, 0);
+ newCallFrame->uncheckedR(newCallFrame->hostThisRegister()) = JSValue(thisObj);
+
+ if (codeBlock->needsFullScopeChain())
+ scopeChain->ref();
+
+ DynamicGlobalObjectScope globalObjectScope(callFrame, scopeChain->globalObject);
+
+ Profiler** profiler = Profiler::enabledProfilerReference();
+ if (*profiler)
+ (*profiler)->willExecute(callFrame, program->sourceURL(), program->lineNo());
+
+ JSValue result;
+ {
+ SamplingTool::CallRecord callRecord(m_sampler.get());
+
+ m_reentryDepth++;
+#if ENABLE(JIT)
+ if (callFrame->globalData().canUseJIT())
+ result = program->generatedJITCode().execute(&m_registerFile, newCallFrame, scopeChain->globalData);
+ else
+#endif
+ result = privateExecute(Normal, &m_registerFile, newCallFrame);
+
+ m_reentryDepth--;
+ }
+
+ if (*profiler)
+ (*profiler)->didExecute(callFrame, program->sourceURL(), program->lineNo());
+
+ if (m_reentryDepth && lastGlobalObject && globalObject != lastGlobalObject)
+ lastGlobalObject->copyGlobalsTo(m_registerFile);
+
+ m_registerFile.shrink(oldEnd);
+
+ return checkedReturn(result);
+}
+
+JSValue Interpreter::executeCall(CallFrame* callFrame, JSObject* function, CallType callType, const CallData& callData, JSValue thisValue, const ArgList& args)
+{
+ ASSERT(!callFrame->hadException());
+
+ if (m_reentryDepth >= MaxSmallThreadReentryDepth && m_reentryDepth >= callFrame->globalData().maxReentryDepth)
+ return checkedReturn(throwStackOverflowError(callFrame));
+
+ Register* oldEnd = m_registerFile.end();
+ int argCount = 1 + args.size(); // implicit "this" parameter
+ size_t registerOffset = argCount + RegisterFile::CallFrameHeaderSize;
+
+ if (!m_registerFile.grow(oldEnd + registerOffset))
+ return checkedReturn(throwStackOverflowError(callFrame));
+
+ CallFrame* newCallFrame = CallFrame::create(oldEnd);
+ size_t dst = 0;
+ newCallFrame->uncheckedR(0) = thisValue;
+ ArgList::const_iterator end = args.end();
+ for (ArgList::const_iterator it = args.begin(); it != end; ++it)
+ newCallFrame->uncheckedR(++dst) = *it;
+
+ if (callType == CallTypeJS) {
+ ScopeChainNode* callDataScopeChain = callData.js.scopeChain;
+
+ JSObject* compileError = callData.js.functionExecutable->compileForCall(callFrame, callDataScopeChain);
+ if (UNLIKELY(!!compileError)) {
+ m_registerFile.shrink(oldEnd);
+ return checkedReturn(throwError(callFrame, compileError));
+ }
+
+ CodeBlock* newCodeBlock = &callData.js.functionExecutable->generatedBytecodeForCall();
+ newCallFrame = slideRegisterWindowForCall(newCodeBlock, &m_registerFile, newCallFrame, registerOffset, argCount);
+ if (UNLIKELY(!newCallFrame)) {
+ m_registerFile.shrink(oldEnd);
+ return checkedReturn(throwStackOverflowError(callFrame));
+ }
+
+ newCallFrame->init(newCodeBlock, 0, callDataScopeChain, callFrame->addHostCallFrameFlag(), argCount, function);
+
+ DynamicGlobalObjectScope globalObjectScope(newCallFrame, callDataScopeChain->globalObject);
+
+ Profiler** profiler = Profiler::enabledProfilerReference();
+ if (*profiler)
+ (*profiler)->willExecute(callFrame, function);
+
+ JSValue result;
+ {
+ SamplingTool::CallRecord callRecord(m_sampler.get());
+
+ m_reentryDepth++;
+#if ENABLE(JIT)
+ if (callFrame->globalData().canUseJIT())
+ result = callData.js.functionExecutable->generatedJITCodeForCall().execute(&m_registerFile, newCallFrame, callDataScopeChain->globalData);
+ else
+#endif
+ result = privateExecute(Normal, &m_registerFile, newCallFrame);
+ m_reentryDepth--;
+ }
+
+ if (*profiler)
+ (*profiler)->didExecute(callFrame, function);
+
+ m_registerFile.shrink(oldEnd);
+ return checkedReturn(result);
+ }
+
+ ASSERT(callType == CallTypeHost);
+ ScopeChainNode* scopeChain = callFrame->scopeChain();
+ newCallFrame = CallFrame::create(newCallFrame->registers() + registerOffset);
+ newCallFrame->init(0, 0, scopeChain, callFrame->addHostCallFrameFlag(), argCount, function);
+
+ DynamicGlobalObjectScope globalObjectScope(newCallFrame, scopeChain->globalObject);
+
+ Profiler** profiler = Profiler::enabledProfilerReference();
+ if (*profiler)
+ (*profiler)->willExecute(callFrame, function);
+
+ JSValue result;
+ {
+ SamplingTool::HostCallRecord callRecord(m_sampler.get());
+ result = JSValue::decode(callData.native.function(newCallFrame));
+ }
+
+ if (*profiler)
+ (*profiler)->didExecute(callFrame, function);
+
+ m_registerFile.shrink(oldEnd);
+ return checkedReturn(result);
+}
+
+JSObject* Interpreter::executeConstruct(CallFrame* callFrame, JSObject* constructor, ConstructType constructType, const ConstructData& constructData, const ArgList& args)
+{
+ ASSERT(!callFrame->hadException());
+
+ if (m_reentryDepth >= MaxSmallThreadReentryDepth && m_reentryDepth >= callFrame->globalData().maxReentryDepth)
+ return checkedReturn(throwStackOverflowError(callFrame));
+
+ Register* oldEnd = m_registerFile.end();
+ int argCount = 1 + args.size(); // implicit "this" parameter
+ size_t registerOffset = argCount + RegisterFile::CallFrameHeaderSize;
+
+ if (!m_registerFile.grow(oldEnd + registerOffset))
+ return checkedReturn(throwStackOverflowError(callFrame));
+
+ CallFrame* newCallFrame = CallFrame::create(oldEnd);
+ size_t dst = 0;
+ ArgList::const_iterator end = args.end();
+ for (ArgList::const_iterator it = args.begin(); it != end; ++it)
+ newCallFrame->uncheckedR(++dst) = *it;
+
+ if (constructType == ConstructTypeJS) {
+ ScopeChainNode* constructDataScopeChain = constructData.js.scopeChain;
+
+ JSObject* compileError = constructData.js.functionExecutable->compileForConstruct(callFrame, constructDataScopeChain);
+ if (UNLIKELY(!!compileError)) {
+ m_registerFile.shrink(oldEnd);
+ return checkedReturn(throwError(callFrame, compileError));
+ }
+
+ CodeBlock* newCodeBlock = &constructData.js.functionExecutable->generatedBytecodeForConstruct();
+ newCallFrame = slideRegisterWindowForCall(newCodeBlock, &m_registerFile, newCallFrame, registerOffset, argCount);
+ if (UNLIKELY(!newCallFrame)) {
+ m_registerFile.shrink(oldEnd);
+ return checkedReturn(throwStackOverflowError(callFrame));
+ }
+
+ newCallFrame->init(newCodeBlock, 0, constructDataScopeChain, callFrame->addHostCallFrameFlag(), argCount, constructor);
+
+ DynamicGlobalObjectScope globalObjectScope(newCallFrame, constructDataScopeChain->globalObject);
+
+ Profiler** profiler = Profiler::enabledProfilerReference();
+ if (*profiler)
+ (*profiler)->willExecute(callFrame, constructor);
+
+ JSValue result;
+ {
+ SamplingTool::CallRecord callRecord(m_sampler.get());
+
+ m_reentryDepth++;
+#if ENABLE(JIT)
+ if (callFrame->globalData().canUseJIT())
+ result = constructData.js.functionExecutable->generatedJITCodeForConstruct().execute(&m_registerFile, newCallFrame, constructDataScopeChain->globalData);
+ else
+#endif
+ result = privateExecute(Normal, &m_registerFile, newCallFrame);
+ m_reentryDepth--;
+ }
+
+ if (*profiler)
+ (*profiler)->didExecute(callFrame, constructor);
+
+ m_registerFile.shrink(oldEnd);
+ if (callFrame->hadException())
+ return 0;
+ ASSERT(result.isObject());
+ return checkedReturn(asObject(result));
+ }
+
+ ASSERT(constructType == ConstructTypeHost);
+ ScopeChainNode* scopeChain = callFrame->scopeChain();
+ newCallFrame = CallFrame::create(newCallFrame->registers() + registerOffset);
+ newCallFrame->init(0, 0, scopeChain, callFrame->addHostCallFrameFlag(), argCount, constructor);
+
+ DynamicGlobalObjectScope globalObjectScope(newCallFrame, scopeChain->globalObject);
+
+ Profiler** profiler = Profiler::enabledProfilerReference();
+ if (*profiler)
+ (*profiler)->willExecute(callFrame, constructor);
+
+ JSValue result;
+ {
+ SamplingTool::HostCallRecord callRecord(m_sampler.get());
+ result = JSValue::decode(constructData.native.function(newCallFrame));
+ }
+
+ if (*profiler)
+ (*profiler)->didExecute(callFrame, constructor);
+
+ m_registerFile.shrink(oldEnd);
+ if (callFrame->hadException())
+ return 0;
+ ASSERT(result.isObject());
+ return checkedReturn(asObject(result));
+}
+
+CallFrameClosure Interpreter::prepareForRepeatCall(FunctionExecutable* FunctionExecutable, CallFrame* callFrame, JSFunction* function, int argCount, ScopeChainNode* scopeChain)
+{
+ ASSERT(!scopeChain->globalData->exception);
+
+ if (m_reentryDepth >= MaxSmallThreadReentryDepth) {
+ if (m_reentryDepth >= callFrame->globalData().maxReentryDepth) {
+ throwStackOverflowError(callFrame);
+ return CallFrameClosure();
+ }
+ }
+
+ Register* oldEnd = m_registerFile.end();
+ int argc = 1 + argCount; // implicit "this" parameter
+
+ if (!m_registerFile.grow(oldEnd + argc)) {
+ throwStackOverflowError(callFrame);
+ return CallFrameClosure();
+ }
+
+ CallFrame* newCallFrame = CallFrame::create(oldEnd);
+ size_t dst = 0;
+ for (int i = 0; i < argc; ++i)
+ newCallFrame->uncheckedR(++dst) = jsUndefined();
+
+ JSObject* error = FunctionExecutable->compileForCall(callFrame, scopeChain);
+ if (error) {
+ throwError(callFrame, error);
+ m_registerFile.shrink(oldEnd);
+ return CallFrameClosure();
+ }
+ CodeBlock* codeBlock = &FunctionExecutable->generatedBytecodeForCall();
+
+ newCallFrame = slideRegisterWindowForCall(codeBlock, &m_registerFile, newCallFrame, argc + RegisterFile::CallFrameHeaderSize, argc);
+ if (UNLIKELY(!newCallFrame)) {
+ throwStackOverflowError(callFrame);
+ m_registerFile.shrink(oldEnd);
+ return CallFrameClosure();
+ }
+ newCallFrame->init(codeBlock, 0, scopeChain, callFrame->addHostCallFrameFlag(), argc, function);
+ CallFrameClosure result = { callFrame, newCallFrame, function, FunctionExecutable, scopeChain->globalData, oldEnd, scopeChain, codeBlock->m_numParameters, argc };
+ return result;
+}
+
+JSValue Interpreter::execute(CallFrameClosure& closure)
+{
+ closure.resetCallFrame();
+ Profiler** profiler = Profiler::enabledProfilerReference();
+ if (*profiler)
+ (*profiler)->willExecute(closure.oldCallFrame, closure.function);
+
+ JSValue result;
+ {
+ SamplingTool::CallRecord callRecord(m_sampler.get());
+
+ m_reentryDepth++;
+#if ENABLE(JIT)
+#if ENABLE(INTERPRETER)
+ if (closure.newCallFrame->globalData().canUseJIT())
+#endif
+ result = closure.functionExecutable->generatedJITCodeForCall().execute(&m_registerFile, closure.newCallFrame, closure.globalData);
+#if ENABLE(INTERPRETER)
+ else
+#endif
+#endif
+#if ENABLE(INTERPRETER)
+ result = privateExecute(Normal, &m_registerFile, closure.newCallFrame);
+#endif
+ m_reentryDepth--;
+ }
+
+ if (*profiler)
+ (*profiler)->didExecute(closure.oldCallFrame, closure.function);
+ return checkedReturn(result);
+}
+
+void Interpreter::endRepeatCall(CallFrameClosure& closure)
+{
+ m_registerFile.shrink(closure.oldEnd);
+}
+
+JSValue Interpreter::execute(EvalExecutable* eval, CallFrame* callFrame, JSObject* thisObj, ScopeChainNode* scopeChain)
+{
+ JSObject* compileError = eval->compile(callFrame, scopeChain);
+ if (UNLIKELY(!!compileError))
+ return checkedReturn(throwError(callFrame, compileError));
+ return execute(eval, callFrame, thisObj, m_registerFile.size() + eval->generatedBytecode().m_numParameters + RegisterFile::CallFrameHeaderSize, scopeChain);
+}
+
+JSValue Interpreter::execute(EvalExecutable* eval, CallFrame* callFrame, JSObject* thisObj, int globalRegisterOffset, ScopeChainNode* scopeChain)
+{
+ ASSERT(!scopeChain->globalData->exception);
+
+ if (m_reentryDepth >= MaxSmallThreadReentryDepth && m_reentryDepth >= callFrame->globalData().maxReentryDepth)
+ return checkedReturn(throwStackOverflowError(callFrame));
+
+ DynamicGlobalObjectScope globalObjectScope(callFrame, scopeChain->globalObject);
+
+ JSObject* compileError = eval->compile(callFrame, scopeChain);
+ if (UNLIKELY(!!compileError))
+ return checkedReturn(throwError(callFrame, compileError));
+ EvalCodeBlock* codeBlock = &eval->generatedBytecode();
+
+ JSObject* variableObject;
+ for (ScopeChainNode* node = scopeChain; ; node = node->next) {
+ ASSERT(node);
+ if (node->object->isVariableObject()) {
+ variableObject = static_cast<JSVariableObject*>(node->object);
+ break;
+ }
+ }
+
+ unsigned numVariables = codeBlock->numVariables();
+ int numFunctions = codeBlock->numberOfFunctionDecls();
+ bool pushedScope = false;
+ if (numVariables || numFunctions) {
+ if (codeBlock->isStrictMode()) {
+ variableObject = new (callFrame) StrictEvalActivation(callFrame);
+ scopeChain = scopeChain->push(variableObject);
+ pushedScope = true;
+ }
+ // Scope for BatchedTransitionOptimizer
+ BatchedTransitionOptimizer optimizer(variableObject);
+
+ for (unsigned i = 0; i < numVariables; ++i) {
+ const Identifier& ident = codeBlock->variable(i);
+ if (!variableObject->hasProperty(callFrame, ident)) {
+ PutPropertySlot slot;
+ variableObject->put(callFrame, ident, jsUndefined(), slot);
+ }
+ }
+
+ for (int i = 0; i < numFunctions; ++i) {
+ FunctionExecutable* function = codeBlock->functionDecl(i);
+ PutPropertySlot slot;
+ variableObject->put(callFrame, function->name(), function->make(callFrame, scopeChain), slot);
+ }
+ }
+
+ Register* oldEnd = m_registerFile.end();
+ Register* newEnd = m_registerFile.start() + globalRegisterOffset + codeBlock->m_numCalleeRegisters;
+ if (!m_registerFile.grow(newEnd)) {
+ if (pushedScope)
+ scopeChain->pop();
+ return checkedReturn(throwStackOverflowError(callFrame));
+ }
+
+ CallFrame* newCallFrame = CallFrame::create(m_registerFile.start() + globalRegisterOffset);
+
+ ASSERT(codeBlock->m_numParameters == 1); // 1 parameter for 'this'.
+ newCallFrame->init(codeBlock, 0, scopeChain, callFrame->addHostCallFrameFlag(), codeBlock->m_numParameters, 0);
+ newCallFrame->uncheckedR(newCallFrame->hostThisRegister()) = JSValue(thisObj);
+
+ if (codeBlock->needsFullScopeChain())
+ scopeChain->ref();
+
+ Profiler** profiler = Profiler::enabledProfilerReference();
+ if (*profiler)
+ (*profiler)->willExecute(callFrame, eval->sourceURL(), eval->lineNo());
+
+ JSValue result;
+ {
+ SamplingTool::CallRecord callRecord(m_sampler.get());
+
+ m_reentryDepth++;
+
+#if ENABLE(JIT)
+#if ENABLE(INTERPRETER)
+ if (callFrame->globalData().canUseJIT())
+#endif
+ result = eval->generatedJITCode().execute(&m_registerFile, newCallFrame, scopeChain->globalData);
+#if ENABLE(INTERPRETER)
+ else
+#endif
+#endif
+#if ENABLE(INTERPRETER)
+ result = privateExecute(Normal, &m_registerFile, newCallFrame);
+#endif
+ m_reentryDepth--;
+ }
+
+ if (*profiler)
+ (*profiler)->didExecute(callFrame, eval->sourceURL(), eval->lineNo());
+
+ m_registerFile.shrink(oldEnd);
+ if (pushedScope)
+ scopeChain->pop();
+ return checkedReturn(result);
+}
+
+NEVER_INLINE void Interpreter::debug(CallFrame* callFrame, DebugHookID debugHookID, int firstLine, int lastLine)
+{
+ Debugger* debugger = callFrame->dynamicGlobalObject()->debugger();
+ if (!debugger)
+ return;
+
+ switch (debugHookID) {
+ case DidEnterCallFrame:
+ debugger->callEvent(callFrame, callFrame->codeBlock()->ownerExecutable()->sourceID(), firstLine);
+ return;
+ case WillLeaveCallFrame:
+ debugger->returnEvent(callFrame, callFrame->codeBlock()->ownerExecutable()->sourceID(), lastLine);
+ return;
+ case WillExecuteStatement:
+ debugger->atStatement(callFrame, callFrame->codeBlock()->ownerExecutable()->sourceID(), firstLine);
+ return;
+ case WillExecuteProgram:
+ debugger->willExecuteProgram(callFrame, callFrame->codeBlock()->ownerExecutable()->sourceID(), firstLine);
+ return;
+ case DidExecuteProgram:
+ debugger->didExecuteProgram(callFrame, callFrame->codeBlock()->ownerExecutable()->sourceID(), lastLine);
+ return;
+ case DidReachBreakpoint:
+ debugger->didReachBreakpoint(callFrame, callFrame->codeBlock()->ownerExecutable()->sourceID(), lastLine);
+ return;
+ }
+}
+
+#if ENABLE(INTERPRETER)
+NEVER_INLINE ScopeChainNode* Interpreter::createExceptionScope(CallFrame* callFrame, const Instruction* vPC)
+{
+ int dst = vPC[1].u.operand;
+ CodeBlock* codeBlock = callFrame->codeBlock();
+ Identifier& property = codeBlock->identifier(vPC[2].u.operand);
+ JSValue value = callFrame->r(vPC[3].u.operand).jsValue();
+ JSObject* scope = new (callFrame) JSStaticScopeObject(callFrame, property, value, DontDelete);
+ callFrame->uncheckedR(dst) = JSValue(scope);
+
+ return callFrame->scopeChain()->push(scope);
+}
+
+NEVER_INLINE void Interpreter::tryCachePutByID(CallFrame* callFrame, CodeBlock* codeBlock, Instruction* vPC, JSValue baseValue, const PutPropertySlot& slot)
+{
+ // Recursive invocation may already have specialized this instruction.
+ if (vPC[0].u.opcode != getOpcode(op_put_by_id))
+ return;
+
+ if (!baseValue.isCell())
+ return;
+
+ // Uncacheable: give up.
+ if (!slot.isCacheable()) {
+ vPC[0] = getOpcode(op_put_by_id_generic);
+ return;
+ }
+
+ JSCell* baseCell = baseValue.asCell();
+ Structure* structure = baseCell->structure();
+
+ if (structure->isUncacheableDictionary()) {
+ vPC[0] = getOpcode(op_put_by_id_generic);
+ return;
+ }
+
+ // Cache miss: record Structure to compare against next time.
+ Structure* lastStructure = vPC[4].u.structure;
+ if (structure != lastStructure) {
+ // First miss: record Structure to compare against next time.
+ if (!lastStructure) {
+ vPC[4] = structure;
+ return;
+ }
+
+ // Second miss: give up.
+ vPC[0] = getOpcode(op_put_by_id_generic);
+ return;
+ }
+
+ // Cache hit: Specialize instruction and ref Structures.
+
+ // If baseCell != slot.base(), then baseCell must be a proxy for another object.
+ if (baseCell != slot.base()) {
+ vPC[0] = getOpcode(op_put_by_id_generic);
+ return;
+ }
+
+ // Structure transition, cache transition info
+ if (slot.type() == PutPropertySlot::NewProperty) {
+ if (structure->isDictionary()) {
+ vPC[0] = getOpcode(op_put_by_id_generic);
+ return;
+ }
+
+ // put_by_id_transition checks the prototype chain for setters.
+ normalizePrototypeChain(callFrame, baseCell);
+
+ vPC[0] = getOpcode(op_put_by_id_transition);
+ vPC[4] = structure->previousID();
+ vPC[5] = structure;
+ vPC[6] = structure->prototypeChain(callFrame);
+ vPC[7] = slot.cachedOffset();
+ codeBlock->refStructures(vPC);
+ return;
+ }
+
+ vPC[0] = getOpcode(op_put_by_id_replace);
+ vPC[5] = slot.cachedOffset();
+ codeBlock->refStructures(vPC);
+}
+
+NEVER_INLINE void Interpreter::uncachePutByID(CodeBlock* codeBlock, Instruction* vPC)
+{
+ codeBlock->derefStructures(vPC);
+ vPC[0] = getOpcode(op_put_by_id);
+ vPC[4] = 0;
+}
+
+NEVER_INLINE void Interpreter::tryCacheGetByID(CallFrame* callFrame, CodeBlock* codeBlock, Instruction* vPC, JSValue baseValue, const Identifier& propertyName, const PropertySlot& slot)
+{
+ // Recursive invocation may already have specialized this instruction.
+ if (vPC[0].u.opcode != getOpcode(op_get_by_id))
+ return;
+
+ // FIXME: Cache property access for immediates.
+ if (!baseValue.isCell()) {
+ vPC[0] = getOpcode(op_get_by_id_generic);
+ return;
+ }
+
+ JSGlobalData* globalData = &callFrame->globalData();
+ if (isJSArray(globalData, baseValue) && propertyName == callFrame->propertyNames().length) {
+ vPC[0] = getOpcode(op_get_array_length);
+ return;
+ }
+
+ if (isJSString(globalData, baseValue) && propertyName == callFrame->propertyNames().length) {
+ vPC[0] = getOpcode(op_get_string_length);
+ return;
+ }
+
+ // Uncacheable: give up.
+ if (!slot.isCacheable()) {
+ vPC[0] = getOpcode(op_get_by_id_generic);
+ return;
+ }
+
+ Structure* structure = baseValue.asCell()->structure();
+
+ if (structure->isUncacheableDictionary()) {
+ vPC[0] = getOpcode(op_get_by_id_generic);
+ return;
+ }
+
+ // Cache miss
+ Structure* lastStructure = vPC[4].u.structure;
+ if (structure != lastStructure) {
+ // First miss: record Structure to compare against next time.
+ if (!lastStructure) {
+ vPC[4] = structure;
+ return;
+ }
+
+ // Second miss: give up.
+ vPC[0] = getOpcode(op_get_by_id_generic);
+ return;
+ }
+
+ // Cache hit: Specialize instruction and ref Structures.
+
+ if (slot.slotBase() == baseValue) {
+ switch (slot.cachedPropertyType()) {
+ case PropertySlot::Getter:
+ vPC[0] = getOpcode(op_get_by_id_getter_self);
+ vPC[5] = slot.cachedOffset();
+ break;
+ case PropertySlot::Custom:
+ vPC[0] = getOpcode(op_get_by_id_custom_self);
+ vPC[5] = slot.customGetter();
+ break;
+ default:
+ vPC[0] = getOpcode(op_get_by_id_self);
+ vPC[5] = slot.cachedOffset();
+ break;
+ }
+
+ codeBlock->refStructures(vPC);
+ return;
+ }
+
+ if (structure->isDictionary()) {
+ vPC[0] = getOpcode(op_get_by_id_generic);
+ return;
+ }
+
+ if (slot.slotBase() == structure->prototypeForLookup(callFrame)) {
+ ASSERT(slot.slotBase().isObject());
+
+ JSObject* baseObject = asObject(slot.slotBase());
+ size_t offset = slot.cachedOffset();
+
+ // Since we're accessing a prototype in a loop, it's a good bet that it
+ // should not be treated as a dictionary.
+ if (baseObject->structure()->isDictionary()) {
+ baseObject->flattenDictionaryObject();
+ offset = baseObject->structure()->get(propertyName);
+ }
+
+ ASSERT(!baseObject->structure()->isUncacheableDictionary());
+
+ switch (slot.cachedPropertyType()) {
+ case PropertySlot::Getter:
+ vPC[0] = getOpcode(op_get_by_id_getter_proto);
+ vPC[6] = offset;
+ break;
+ case PropertySlot::Custom:
+ vPC[0] = getOpcode(op_get_by_id_custom_proto);
+ vPC[6] = slot.customGetter();
+ break;
+ default:
+ vPC[0] = getOpcode(op_get_by_id_proto);
+ vPC[6] = offset;
+ break;
+ }
+ vPC[5] = baseObject->structure();
+
+ codeBlock->refStructures(vPC);
+ return;
+ }
+
+ size_t offset = slot.cachedOffset();
+ size_t count = normalizePrototypeChain(callFrame, baseValue, slot.slotBase(), propertyName, offset);
+ if (!count) {
+ vPC[0] = getOpcode(op_get_by_id_generic);
+ return;
+ }
+
+
+ switch (slot.cachedPropertyType()) {
+ case PropertySlot::Getter:
+ vPC[0] = getOpcode(op_get_by_id_getter_chain);
+ vPC[7] = offset;
+ break;
+ case PropertySlot::Custom:
+ vPC[0] = getOpcode(op_get_by_id_custom_chain);
+ vPC[7] = slot.customGetter();
+ break;
+ default:
+ vPC[0] = getOpcode(op_get_by_id_chain);
+ vPC[7] = offset;
+ break;
+ }
+ vPC[4] = structure;
+ vPC[5] = structure->prototypeChain(callFrame);
+ vPC[6] = count;
+ codeBlock->refStructures(vPC);
+}
+
+NEVER_INLINE void Interpreter::uncacheGetByID(CodeBlock* codeBlock, Instruction* vPC)
+{
+ codeBlock->derefStructures(vPC);
+ vPC[0] = getOpcode(op_get_by_id);
+ vPC[4] = 0;
+}
+
+#endif // ENABLE(INTERPRETER)
+
+JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFile, CallFrame* callFrame)
+{
+ // One-time initialization of our address tables. We have to put this code
+ // here because our labels are only in scope inside this function.
+ if (UNLIKELY(flag == InitializeAndReturn)) {
+ #if ENABLE(COMPUTED_GOTO_INTERPRETER)
+ #define LIST_OPCODE_LABEL(id, length) &&id,
+ static Opcode labels[] = { FOR_EACH_OPCODE_ID(LIST_OPCODE_LABEL) };
+ for (size_t i = 0; i < WTF_ARRAY_LENGTH(labels); ++i)
+ m_opcodeTable[i] = labels[i];
+ #undef LIST_OPCODE_LABEL
+ #endif // ENABLE(COMPUTED_GOTO_INTERPRETER)
+ return JSValue();
+ }
+
+#if ENABLE(JIT)
+#if ENABLE(INTERPRETER)
+ // Mixing Interpreter + JIT is not supported.
+ if (callFrame->globalData().canUseJIT())
+#endif
+ ASSERT_NOT_REACHED();
+#endif
+
+#if !ENABLE(INTERPRETER)
+ UNUSED_PARAM(registerFile);
+ UNUSED_PARAM(callFrame);
+ return JSValue();
+#else
+
+ JSGlobalData* globalData = &callFrame->globalData();
+ JSValue exceptionValue;
+ HandlerInfo* handler = 0;
+
+ CodeBlock* codeBlock = callFrame->codeBlock();
+ Instruction* vPC = codeBlock->instructions().begin();
+ Profiler** enabledProfilerReference = Profiler::enabledProfilerReference();
+ unsigned tickCount = globalData->timeoutChecker.ticksUntilNextCheck();
+ JSValue functionReturnValue;
+
+#define CHECK_FOR_EXCEPTION() \
+ do { \
+ if (UNLIKELY(globalData->exception != JSValue())) { \
+ exceptionValue = globalData->exception; \
+ goto vm_throw; \
+ } \
+ } while (0)
+
+#if ENABLE(OPCODE_STATS)
+ OpcodeStats::resetLastInstruction();
+#endif
+
+#define CHECK_FOR_TIMEOUT() \
+ if (!--tickCount) { \
+ if (globalData->terminator.shouldTerminate() || globalData->timeoutChecker.didTimeOut(callFrame)) { \
+ exceptionValue = jsNull(); \
+ goto vm_throw; \
+ } \
+ tickCount = globalData->timeoutChecker.ticksUntilNextCheck(); \
+ }
+
+#if ENABLE(OPCODE_SAMPLING)
+ #define SAMPLE(codeBlock, vPC) m_sampler->sample(codeBlock, vPC)
+#else
+ #define SAMPLE(codeBlock, vPC)
+#endif
+
+#if ENABLE(COMPUTED_GOTO_INTERPRETER)
+ #define NEXT_INSTRUCTION() SAMPLE(codeBlock, vPC); goto *vPC->u.opcode
+#if ENABLE(OPCODE_STATS)
+ #define DEFINE_OPCODE(opcode) opcode: OpcodeStats::recordInstruction(opcode);
+#else
+ #define DEFINE_OPCODE(opcode) opcode:
+#endif
+ NEXT_INSTRUCTION();
+#else
+ #define NEXT_INSTRUCTION() SAMPLE(codeBlock, vPC); goto interpreterLoopStart
+#if ENABLE(OPCODE_STATS)
+ #define DEFINE_OPCODE(opcode) case opcode: OpcodeStats::recordInstruction(opcode);
+#else
+ #define DEFINE_OPCODE(opcode) case opcode:
+#endif
+ while (1) { // iterator loop begins
+ interpreterLoopStart:;
+ switch (vPC->u.opcode)
+#endif
+ {
+ DEFINE_OPCODE(op_new_object) {
+ /* new_object dst(r)
+
+ Constructs a new empty Object instance using the original
+ constructor, and puts the result in register dst.
+ */
+ int dst = vPC[1].u.operand;
+ callFrame->uncheckedR(dst) = JSValue(constructEmptyObject(callFrame));
+
+ vPC += OPCODE_LENGTH(op_new_object);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_new_array) {
+ /* new_array dst(r) firstArg(r) argCount(n)
+
+ Constructs a new Array instance using the original
+ constructor, and puts the result in register dst.
+ The array will contain argCount elements with values
+ taken from registers starting at register firstArg.
+ */
+ int dst = vPC[1].u.operand;
+ int firstArg = vPC[2].u.operand;
+ int argCount = vPC[3].u.operand;
+ ArgList args(callFrame->registers() + firstArg, argCount);
+ callFrame->uncheckedR(dst) = JSValue(constructArray(callFrame, args));
+
+ vPC += OPCODE_LENGTH(op_new_array);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_new_regexp) {
+ /* new_regexp dst(r) regExp(re)
+
+ Constructs a new RegExp instance using the original
+ constructor from regexp regExp, and puts the result in
+ register dst.
+ */
+ int dst = vPC[1].u.operand;
+ int regExp = vPC[2].u.operand;
+ callFrame->uncheckedR(dst) = JSValue(new (globalData) RegExpObject(callFrame->lexicalGlobalObject(), callFrame->scopeChain()->globalObject->regExpStructure(), codeBlock->regexp(regExp)));
+
+ vPC += OPCODE_LENGTH(op_new_regexp);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_mov) {
+ /* mov dst(r) src(r)
+
+ Copies register src to register dst.
+ */
+ int dst = vPC[1].u.operand;
+ int src = vPC[2].u.operand;
+
+ callFrame->uncheckedR(dst) = callFrame->r(src);
+
+ vPC += OPCODE_LENGTH(op_mov);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_eq) {
+ /* eq dst(r) src1(r) src2(r)
+
+ Checks whether register src1 and register src2 are equal,
+ as with the ECMAScript '==' operator, and puts the result
+ as a boolean in register dst.
+ */
+ int dst = vPC[1].u.operand;
+ JSValue src1 = callFrame->r(vPC[2].u.operand).jsValue();
+ JSValue src2 = callFrame->r(vPC[3].u.operand).jsValue();
+ if (src1.isInt32() && src2.isInt32())
+ callFrame->uncheckedR(dst) = jsBoolean(src1.asInt32() == src2.asInt32());
+ else {
+ JSValue result = jsBoolean(JSValue::equalSlowCase(callFrame, src1, src2));
+ CHECK_FOR_EXCEPTION();
+ callFrame->uncheckedR(dst) = result;
+ }
+
+ vPC += OPCODE_LENGTH(op_eq);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_eq_null) {
+ /* eq_null dst(r) src(r)
+
+ Checks whether register src is null, as with the ECMAScript '!='
+ operator, and puts the result as a boolean in register dst.
+ */
+ int dst = vPC[1].u.operand;
+ JSValue src = callFrame->r(vPC[2].u.operand).jsValue();
+
+ if (src.isUndefinedOrNull()) {
+ callFrame->uncheckedR(dst) = jsBoolean(true);
+ vPC += OPCODE_LENGTH(op_eq_null);
+ NEXT_INSTRUCTION();
+ }
+
+ callFrame->uncheckedR(dst) = jsBoolean(src.isCell() && src.asCell()->structure()->typeInfo().masqueradesAsUndefined());
+ vPC += OPCODE_LENGTH(op_eq_null);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_neq) {
+ /* neq dst(r) src1(r) src2(r)
+
+ Checks whether register src1 and register src2 are not
+ equal, as with the ECMAScript '!=' operator, and puts the
+ result as a boolean in register dst.
+ */
+ int dst = vPC[1].u.operand;
+ JSValue src1 = callFrame->r(vPC[2].u.operand).jsValue();
+ JSValue src2 = callFrame->r(vPC[3].u.operand).jsValue();
+ if (src1.isInt32() && src2.isInt32())
+ callFrame->uncheckedR(dst) = jsBoolean(src1.asInt32() != src2.asInt32());
+ else {
+ JSValue result = jsBoolean(!JSValue::equalSlowCase(callFrame, src1, src2));
+ CHECK_FOR_EXCEPTION();
+ callFrame->uncheckedR(dst) = result;
+ }
+
+ vPC += OPCODE_LENGTH(op_neq);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_neq_null) {
+ /* neq_null dst(r) src(r)
+
+ Checks whether register src is not null, as with the ECMAScript '!='
+ operator, and puts the result as a boolean in register dst.
+ */
+ int dst = vPC[1].u.operand;
+ JSValue src = callFrame->r(vPC[2].u.operand).jsValue();
+
+ if (src.isUndefinedOrNull()) {
+ callFrame->uncheckedR(dst) = jsBoolean(false);
+ vPC += OPCODE_LENGTH(op_neq_null);
+ NEXT_INSTRUCTION();
+ }
+
+ callFrame->uncheckedR(dst) = jsBoolean(!src.isCell() || !src.asCell()->structure()->typeInfo().masqueradesAsUndefined());
+ vPC += OPCODE_LENGTH(op_neq_null);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_stricteq) {
+ /* stricteq dst(r) src1(r) src2(r)
+
+ Checks whether register src1 and register src2 are strictly
+ equal, as with the ECMAScript '===' operator, and puts the
+ result as a boolean in register dst.
+ */
+ int dst = vPC[1].u.operand;
+ JSValue src1 = callFrame->r(vPC[2].u.operand).jsValue();
+ JSValue src2 = callFrame->r(vPC[3].u.operand).jsValue();
+ bool result = JSValue::strictEqual(callFrame, src1, src2);
+ CHECK_FOR_EXCEPTION();
+ callFrame->uncheckedR(dst) = jsBoolean(result);
+
+ vPC += OPCODE_LENGTH(op_stricteq);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_nstricteq) {
+ /* nstricteq dst(r) src1(r) src2(r)
+
+ Checks whether register src1 and register src2 are not
+ strictly equal, as with the ECMAScript '!==' operator, and
+ puts the result as a boolean in register dst.
+ */
+ int dst = vPC[1].u.operand;
+ JSValue src1 = callFrame->r(vPC[2].u.operand).jsValue();
+ JSValue src2 = callFrame->r(vPC[3].u.operand).jsValue();
+ bool result = !JSValue::strictEqual(callFrame, src1, src2);
+ CHECK_FOR_EXCEPTION();
+ callFrame->uncheckedR(dst) = jsBoolean(result);
+
+ vPC += OPCODE_LENGTH(op_nstricteq);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_less) {
+ /* less dst(r) src1(r) src2(r)
+
+ Checks whether register src1 is less than register src2, as
+ with the ECMAScript '<' operator, and puts the result as
+ a boolean in register dst.
+ */
+ int dst = vPC[1].u.operand;
+ JSValue src1 = callFrame->r(vPC[2].u.operand).jsValue();
+ JSValue src2 = callFrame->r(vPC[3].u.operand).jsValue();
+ JSValue result = jsBoolean(jsLess(callFrame, src1, src2));
+ CHECK_FOR_EXCEPTION();
+ callFrame->uncheckedR(dst) = result;
+
+ vPC += OPCODE_LENGTH(op_less);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_lesseq) {
+ /* lesseq dst(r) src1(r) src2(r)
+
+ Checks whether register src1 is less than or equal to
+ register src2, as with the ECMAScript '<=' operator, and
+ puts the result as a boolean in register dst.
+ */
+ int dst = vPC[1].u.operand;
+ JSValue src1 = callFrame->r(vPC[2].u.operand).jsValue();
+ JSValue src2 = callFrame->r(vPC[3].u.operand).jsValue();
+ JSValue result = jsBoolean(jsLessEq(callFrame, src1, src2));
+ CHECK_FOR_EXCEPTION();
+ callFrame->uncheckedR(dst) = result;
+
+ vPC += OPCODE_LENGTH(op_lesseq);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_pre_inc) {
+ /* pre_inc srcDst(r)
+
+ Converts register srcDst to number, adds one, and puts the result
+ back in register srcDst.
+ */
+ int srcDst = vPC[1].u.operand;
+ JSValue v = callFrame->r(srcDst).jsValue();
+ if (v.isInt32() && v.asInt32() < INT_MAX)
+ callFrame->uncheckedR(srcDst) = jsNumber(v.asInt32() + 1);
+ else {
+ JSValue result = jsNumber(v.toNumber(callFrame) + 1);
+ CHECK_FOR_EXCEPTION();
+ callFrame->uncheckedR(srcDst) = result;
+ }
+
+ vPC += OPCODE_LENGTH(op_pre_inc);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_pre_dec) {
+ /* pre_dec srcDst(r)
+
+ Converts register srcDst to number, subtracts one, and puts the result
+ back in register srcDst.
+ */
+ int srcDst = vPC[1].u.operand;
+ JSValue v = callFrame->r(srcDst).jsValue();
+ if (v.isInt32() && v.asInt32() > INT_MIN)
+ callFrame->uncheckedR(srcDst) = jsNumber(v.asInt32() - 1);
+ else {
+ JSValue result = jsNumber(v.toNumber(callFrame) - 1);
+ CHECK_FOR_EXCEPTION();
+ callFrame->uncheckedR(srcDst) = result;
+ }
+
+ vPC += OPCODE_LENGTH(op_pre_dec);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_post_inc) {
+ /* post_inc dst(r) srcDst(r)
+
+ Converts register srcDst to number. The number itself is
+ written to register dst, and the number plus one is written
+ back to register srcDst.
+ */
+ int dst = vPC[1].u.operand;
+ int srcDst = vPC[2].u.operand;
+ JSValue v = callFrame->r(srcDst).jsValue();
+ if (v.isInt32() && v.asInt32() < INT_MAX) {
+ callFrame->uncheckedR(srcDst) = jsNumber(v.asInt32() + 1);
+ callFrame->uncheckedR(dst) = v;
+ } else {
+ JSValue number = callFrame->r(srcDst).jsValue().toJSNumber(callFrame);
+ CHECK_FOR_EXCEPTION();
+ callFrame->uncheckedR(srcDst) = jsNumber(number.uncheckedGetNumber() + 1);
+ callFrame->uncheckedR(dst) = number;
+ }
+
+ vPC += OPCODE_LENGTH(op_post_inc);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_post_dec) {
+ /* post_dec dst(r) srcDst(r)
+
+ Converts register srcDst to number. The number itself is
+ written to register dst, and the number minus one is written
+ back to register srcDst.
+ */
+ int dst = vPC[1].u.operand;
+ int srcDst = vPC[2].u.operand;
+ JSValue v = callFrame->r(srcDst).jsValue();
+ if (v.isInt32() && v.asInt32() > INT_MIN) {
+ callFrame->uncheckedR(srcDst) = jsNumber(v.asInt32() - 1);
+ callFrame->uncheckedR(dst) = v;
+ } else {
+ JSValue number = callFrame->r(srcDst).jsValue().toJSNumber(callFrame);
+ CHECK_FOR_EXCEPTION();
+ callFrame->uncheckedR(srcDst) = jsNumber(number.uncheckedGetNumber() - 1);
+ callFrame->uncheckedR(dst) = number;
+ }
+
+ vPC += OPCODE_LENGTH(op_post_dec);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_to_jsnumber) {
+ /* to_jsnumber dst(r) src(r)
+
+ Converts register src to number, and puts the result
+ in register dst.
+ */
+ int dst = vPC[1].u.operand;
+ int src = vPC[2].u.operand;
+
+ JSValue srcVal = callFrame->r(src).jsValue();
+
+ if (LIKELY(srcVal.isNumber()))
+ callFrame->uncheckedR(dst) = callFrame->r(src);
+ else {
+ JSValue result = srcVal.toJSNumber(callFrame);
+ CHECK_FOR_EXCEPTION();
+ callFrame->uncheckedR(dst) = result;
+ }
+
+ vPC += OPCODE_LENGTH(op_to_jsnumber);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_negate) {
+ /* negate dst(r) src(r)
+
+ Converts register src to number, negates it, and puts the
+ result in register dst.
+ */
+ int dst = vPC[1].u.operand;
+ JSValue src = callFrame->r(vPC[2].u.operand).jsValue();
+ if (src.isInt32() && (src.asInt32() & 0x7fffffff)) // non-zero and no overflow
+ callFrame->uncheckedR(dst) = jsNumber(-src.asInt32());
+ else {
+ JSValue result = jsNumber(-src.toNumber(callFrame));
+ CHECK_FOR_EXCEPTION();
+ callFrame->uncheckedR(dst) = result;
+ }
+
+ vPC += OPCODE_LENGTH(op_negate);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_add) {
+ /* add dst(r) src1(r) src2(r)
+
+ Adds register src1 and register src2, and puts the result
+ in register dst. (JS add may be string concatenation or
+ numeric add, depending on the types of the operands.)
+ */
+ int dst = vPC[1].u.operand;
+ JSValue src1 = callFrame->r(vPC[2].u.operand).jsValue();
+ JSValue src2 = callFrame->r(vPC[3].u.operand).jsValue();
+ if (src1.isInt32() && src2.isInt32() && !(src1.asInt32() | (src2.asInt32() & 0xc0000000))) // no overflow
+ callFrame->uncheckedR(dst) = jsNumber(src1.asInt32() + src2.asInt32());
+ else {
+ JSValue result = jsAdd(callFrame, src1, src2);
+ CHECK_FOR_EXCEPTION();
+ callFrame->uncheckedR(dst) = result;
+ }
+ vPC += OPCODE_LENGTH(op_add);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_mul) {
+ /* mul dst(r) src1(r) src2(r)
+
+ Multiplies register src1 and register src2 (converted to
+ numbers), and puts the product in register dst.
+ */
+ int dst = vPC[1].u.operand;
+ JSValue src1 = callFrame->r(vPC[2].u.operand).jsValue();
+ JSValue src2 = callFrame->r(vPC[3].u.operand).jsValue();
+ if (src1.isInt32() && src2.isInt32() && !(src1.asInt32() | src2.asInt32() >> 15)) // no overflow
+ callFrame->uncheckedR(dst) = jsNumber(src1.asInt32() * src2.asInt32());
+ else {
+ JSValue result = jsNumber(src1.toNumber(callFrame) * src2.toNumber(callFrame));
+ CHECK_FOR_EXCEPTION();
+ callFrame->uncheckedR(dst) = result;
+ }
+
+ vPC += OPCODE_LENGTH(op_mul);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_div) {
+ /* div dst(r) dividend(r) divisor(r)
+
+ Divides register dividend (converted to number) by the
+ register divisor (converted to number), and puts the
+ quotient in register dst.
+ */
+ int dst = vPC[1].u.operand;
+ JSValue dividend = callFrame->r(vPC[2].u.operand).jsValue();
+ JSValue divisor = callFrame->r(vPC[3].u.operand).jsValue();
+
+ JSValue result = jsNumber(dividend.toNumber(callFrame) / divisor.toNumber(callFrame));
+ CHECK_FOR_EXCEPTION();
+ callFrame->uncheckedR(dst) = result;
+
+ vPC += OPCODE_LENGTH(op_div);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_mod) {
+ /* mod dst(r) dividend(r) divisor(r)
+
+ Divides register dividend (converted to number) by
+ register divisor (converted to number), and puts the
+ remainder in register dst.
+ */
+ int dst = vPC[1].u.operand;
+ JSValue dividend = callFrame->r(vPC[2].u.operand).jsValue();
+ JSValue divisor = callFrame->r(vPC[3].u.operand).jsValue();
+
+ if (dividend.isInt32() && divisor.isInt32() && divisor.asInt32() != 0) {
+ JSValue result = jsNumber(dividend.asInt32() % divisor.asInt32());
+ ASSERT(result);
+ callFrame->uncheckedR(dst) = result;
+ vPC += OPCODE_LENGTH(op_mod);
+ NEXT_INSTRUCTION();
+ }
+
+ // Conversion to double must happen outside the call to fmod since the
+ // order of argument evaluation is not guaranteed.
+ double d1 = dividend.toNumber(callFrame);
+ double d2 = divisor.toNumber(callFrame);
+ JSValue result = jsNumber(fmod(d1, d2));
+ CHECK_FOR_EXCEPTION();
+ callFrame->uncheckedR(dst) = result;
+ vPC += OPCODE_LENGTH(op_mod);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_sub) {
+ /* sub dst(r) src1(r) src2(r)
+
+ Subtracts register src2 (converted to number) from register
+ src1 (converted to number), and puts the difference in
+ register dst.
+ */
+ int dst = vPC[1].u.operand;
+ JSValue src1 = callFrame->r(vPC[2].u.operand).jsValue();
+ JSValue src2 = callFrame->r(vPC[3].u.operand).jsValue();
+ if (src1.isInt32() && src2.isInt32() && !(src1.asInt32() | (src2.asInt32() & 0xc0000000))) // no overflow
+ callFrame->uncheckedR(dst) = jsNumber(src1.asInt32() - src2.asInt32());
+ else {
+ JSValue result = jsNumber(src1.toNumber(callFrame) - src2.toNumber(callFrame));
+ CHECK_FOR_EXCEPTION();
+ callFrame->uncheckedR(dst) = result;
+ }
+ vPC += OPCODE_LENGTH(op_sub);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_lshift) {
+ /* lshift dst(r) val(r) shift(r)
+
+ Performs left shift of register val (converted to int32) by
+ register shift (converted to uint32), and puts the result
+ in register dst.
+ */
+ int dst = vPC[1].u.operand;
+ JSValue val = callFrame->r(vPC[2].u.operand).jsValue();
+ JSValue shift = callFrame->r(vPC[3].u.operand).jsValue();
+
+ if (val.isInt32() && shift.isInt32())
+ callFrame->uncheckedR(dst) = jsNumber(val.asInt32() << (shift.asInt32() & 0x1f));
+ else {
+ JSValue result = jsNumber((val.toInt32(callFrame)) << (shift.toUInt32(callFrame) & 0x1f));
+ CHECK_FOR_EXCEPTION();
+ callFrame->uncheckedR(dst) = result;
+ }
+
+ vPC += OPCODE_LENGTH(op_lshift);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_rshift) {
+ /* rshift dst(r) val(r) shift(r)
+
+ Performs arithmetic right shift of register val (converted
+ to int32) by register shift (converted to
+ uint32), and puts the result in register dst.
+ */
+ int dst = vPC[1].u.operand;
+ JSValue val = callFrame->r(vPC[2].u.operand).jsValue();
+ JSValue shift = callFrame->r(vPC[3].u.operand).jsValue();
+
+ if (val.isInt32() && shift.isInt32())
+ callFrame->uncheckedR(dst) = jsNumber(val.asInt32() >> (shift.asInt32() & 0x1f));
+ else {
+ JSValue result = jsNumber((val.toInt32(callFrame)) >> (shift.toUInt32(callFrame) & 0x1f));
+ CHECK_FOR_EXCEPTION();
+ callFrame->uncheckedR(dst) = result;
+ }
+
+ vPC += OPCODE_LENGTH(op_rshift);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_urshift) {
+ /* rshift dst(r) val(r) shift(r)
+
+ Performs logical right shift of register val (converted
+ to uint32) by register shift (converted to
+ uint32), and puts the result in register dst.
+ */
+ int dst = vPC[1].u.operand;
+ JSValue val = callFrame->r(vPC[2].u.operand).jsValue();
+ JSValue shift = callFrame->r(vPC[3].u.operand).jsValue();
+ if (val.isUInt32() && shift.isInt32())
+ callFrame->uncheckedR(dst) = jsNumber(val.asInt32() >> (shift.asInt32() & 0x1f));
+ else {
+ JSValue result = jsNumber((val.toUInt32(callFrame)) >> (shift.toUInt32(callFrame) & 0x1f));
+ CHECK_FOR_EXCEPTION();
+ callFrame->uncheckedR(dst) = result;
+ }
+
+ vPC += OPCODE_LENGTH(op_urshift);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_bitand) {
+ /* bitand dst(r) src1(r) src2(r)
+
+ Computes bitwise AND of register src1 (converted to int32)
+ and register src2 (converted to int32), and puts the result
+ in register dst.
+ */
+ int dst = vPC[1].u.operand;
+ JSValue src1 = callFrame->r(vPC[2].u.operand).jsValue();
+ JSValue src2 = callFrame->r(vPC[3].u.operand).jsValue();
+ if (src1.isInt32() && src2.isInt32())
+ callFrame->uncheckedR(dst) = jsNumber(src1.asInt32() & src2.asInt32());
+ else {
+ JSValue result = jsNumber(src1.toInt32(callFrame) & src2.toInt32(callFrame));
+ CHECK_FOR_EXCEPTION();
+ callFrame->uncheckedR(dst) = result;
+ }
+
+ vPC += OPCODE_LENGTH(op_bitand);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_bitxor) {
+ /* bitxor dst(r) src1(r) src2(r)
+
+ Computes bitwise XOR of register src1 (converted to int32)
+ and register src2 (converted to int32), and puts the result
+ in register dst.
+ */
+ int dst = vPC[1].u.operand;
+ JSValue src1 = callFrame->r(vPC[2].u.operand).jsValue();
+ JSValue src2 = callFrame->r(vPC[3].u.operand).jsValue();
+ if (src1.isInt32() && src2.isInt32())
+ callFrame->uncheckedR(dst) = jsNumber(src1.asInt32() ^ src2.asInt32());
+ else {
+ JSValue result = jsNumber(src1.toInt32(callFrame) ^ src2.toInt32(callFrame));
+ CHECK_FOR_EXCEPTION();
+ callFrame->uncheckedR(dst) = result;
+ }
+
+ vPC += OPCODE_LENGTH(op_bitxor);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_bitor) {
+ /* bitor dst(r) src1(r) src2(r)
+
+ Computes bitwise OR of register src1 (converted to int32)
+ and register src2 (converted to int32), and puts the
+ result in register dst.
+ */
+ int dst = vPC[1].u.operand;
+ JSValue src1 = callFrame->r(vPC[2].u.operand).jsValue();
+ JSValue src2 = callFrame->r(vPC[3].u.operand).jsValue();
+ if (src1.isInt32() && src2.isInt32())
+ callFrame->uncheckedR(dst) = jsNumber(src1.asInt32() | src2.asInt32());
+ else {
+ JSValue result = jsNumber(src1.toInt32(callFrame) | src2.toInt32(callFrame));
+ CHECK_FOR_EXCEPTION();
+ callFrame->uncheckedR(dst) = result;
+ }
+
+ vPC += OPCODE_LENGTH(op_bitor);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_bitnot) {
+ /* bitnot dst(r) src(r)
+
+ Computes bitwise NOT of register src1 (converted to int32),
+ and puts the result in register dst.
+ */
+ int dst = vPC[1].u.operand;
+ JSValue src = callFrame->r(vPC[2].u.operand).jsValue();
+ if (src.isInt32())
+ callFrame->uncheckedR(dst) = jsNumber(~src.asInt32());
+ else {
+ JSValue result = jsNumber(~src.toInt32(callFrame));
+ CHECK_FOR_EXCEPTION();
+ callFrame->uncheckedR(dst) = result;
+ }
+ vPC += OPCODE_LENGTH(op_bitnot);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_not) {
+ /* not dst(r) src(r)
+
+ Computes logical NOT of register src (converted to
+ boolean), and puts the result in register dst.
+ */
+ int dst = vPC[1].u.operand;
+ int src = vPC[2].u.operand;
+ JSValue result = jsBoolean(!callFrame->r(src).jsValue().toBoolean(callFrame));
+ CHECK_FOR_EXCEPTION();
+ callFrame->uncheckedR(dst) = result;
+
+ vPC += OPCODE_LENGTH(op_not);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_check_has_instance) {
+ /* check_has_instance constructor(r)
+
+ Check 'constructor' is an object with the internal property
+ [HasInstance] (i.e. is a function ... *shakes head sadly at
+ JSC API*). Raises an exception if register constructor is not
+ an valid parameter for instanceof.
+ */
+ int base = vPC[1].u.operand;
+ JSValue baseVal = callFrame->r(base).jsValue();
+
+ if (isInvalidParamForInstanceOf(callFrame, baseVal, exceptionValue))
+ goto vm_throw;
+
+ vPC += OPCODE_LENGTH(op_check_has_instance);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_instanceof) {
+ /* instanceof dst(r) value(r) constructor(r) constructorProto(r)
+
+ Tests whether register value is an instance of register
+ constructor, and puts the boolean result in register
+ dst. Register constructorProto must contain the "prototype"
+ property (not the actual prototype) of the object in
+ register constructor. This lookup is separated so that
+ polymorphic inline caching can apply.
+
+ Raises an exception if register constructor is not an
+ object.
+ */
+ int dst = vPC[1].u.operand;
+ int value = vPC[2].u.operand;
+ int base = vPC[3].u.operand;
+ int baseProto = vPC[4].u.operand;
+
+ JSValue baseVal = callFrame->r(base).jsValue();
+
+ ASSERT(!isInvalidParamForInstanceOf(callFrame, baseVal, exceptionValue));
+
+ bool result = asObject(baseVal)->hasInstance(callFrame, callFrame->r(value).jsValue(), callFrame->r(baseProto).jsValue());
+ CHECK_FOR_EXCEPTION();
+ callFrame->uncheckedR(dst) = jsBoolean(result);
+
+ vPC += OPCODE_LENGTH(op_instanceof);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_typeof) {
+ /* typeof dst(r) src(r)
+
+ Determines the type string for src according to ECMAScript
+ rules, and puts the result in register dst.
+ */
+ int dst = vPC[1].u.operand;
+ int src = vPC[2].u.operand;
+ callFrame->uncheckedR(dst) = JSValue(jsTypeStringForValue(callFrame, callFrame->r(src).jsValue()));
+
+ vPC += OPCODE_LENGTH(op_typeof);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_is_undefined) {
+ /* is_undefined dst(r) src(r)
+
+ Determines whether the type string for src according to
+ the ECMAScript rules is "undefined", and puts the result
+ in register dst.
+ */
+ int dst = vPC[1].u.operand;
+ int src = vPC[2].u.operand;
+ JSValue v = callFrame->r(src).jsValue();
+ callFrame->uncheckedR(dst) = jsBoolean(v.isCell() ? v.asCell()->structure()->typeInfo().masqueradesAsUndefined() : v.isUndefined());
+
+ vPC += OPCODE_LENGTH(op_is_undefined);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_is_boolean) {
+ /* is_boolean dst(r) src(r)
+
+ Determines whether the type string for src according to
+ the ECMAScript rules is "boolean", and puts the result
+ in register dst.
+ */
+ int dst = vPC[1].u.operand;
+ int src = vPC[2].u.operand;
+ callFrame->uncheckedR(dst) = jsBoolean(callFrame->r(src).jsValue().isBoolean());
+
+ vPC += OPCODE_LENGTH(op_is_boolean);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_is_number) {
+ /* is_number dst(r) src(r)
+
+ Determines whether the type string for src according to
+ the ECMAScript rules is "number", and puts the result
+ in register dst.
+ */
+ int dst = vPC[1].u.operand;
+ int src = vPC[2].u.operand;
+ callFrame->uncheckedR(dst) = jsBoolean(callFrame->r(src).jsValue().isNumber());
+
+ vPC += OPCODE_LENGTH(op_is_number);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_is_string) {
+ /* is_string dst(r) src(r)
+
+ Determines whether the type string for src according to
+ the ECMAScript rules is "string", and puts the result
+ in register dst.
+ */
+ int dst = vPC[1].u.operand;
+ int src = vPC[2].u.operand;
+ callFrame->uncheckedR(dst) = jsBoolean(callFrame->r(src).jsValue().isString());
+
+ vPC += OPCODE_LENGTH(op_is_string);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_is_object) {
+ /* is_object dst(r) src(r)
+
+ Determines whether the type string for src according to
+ the ECMAScript rules is "object", and puts the result
+ in register dst.
+ */
+ int dst = vPC[1].u.operand;
+ int src = vPC[2].u.operand;
+ callFrame->uncheckedR(dst) = jsBoolean(jsIsObjectType(callFrame->r(src).jsValue()));
+
+ vPC += OPCODE_LENGTH(op_is_object);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_is_function) {
+ /* is_function dst(r) src(r)
+
+ Determines whether the type string for src according to
+ the ECMAScript rules is "function", and puts the result
+ in register dst.
+ */
+ int dst = vPC[1].u.operand;
+ int src = vPC[2].u.operand;
+ callFrame->uncheckedR(dst) = jsBoolean(jsIsFunctionType(callFrame->r(src).jsValue()));
+
+ vPC += OPCODE_LENGTH(op_is_function);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_in) {
+ /* in dst(r) property(r) base(r)
+
+ Tests whether register base has a property named register
+ property, and puts the boolean result in register dst.
+
+ Raises an exception if register constructor is not an
+ object.
+ */
+ int dst = vPC[1].u.operand;
+ int property = vPC[2].u.operand;
+ int base = vPC[3].u.operand;
+
+ JSValue baseVal = callFrame->r(base).jsValue();
+ if (isInvalidParamForIn(callFrame, baseVal, exceptionValue))
+ goto vm_throw;
+
+ JSObject* baseObj = asObject(baseVal);
+
+ JSValue propName = callFrame->r(property).jsValue();
+
+ uint32_t i;
+ if (propName.getUInt32(i))
+ callFrame->uncheckedR(dst) = jsBoolean(baseObj->hasProperty(callFrame, i));
+ else {
+ Identifier property(callFrame, propName.toString(callFrame));
+ CHECK_FOR_EXCEPTION();
+ callFrame->uncheckedR(dst) = jsBoolean(baseObj->hasProperty(callFrame, property));
+ }
+
+ vPC += OPCODE_LENGTH(op_in);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_resolve) {
+ /* resolve dst(r) property(id)
+
+ Looks up the property named by identifier property in the
+ scope chain, and writes the resulting value to register
+ dst. If the property is not found, raises an exception.
+ */
+ if (UNLIKELY(!resolve(callFrame, vPC, exceptionValue)))
+ goto vm_throw;
+
+ vPC += OPCODE_LENGTH(op_resolve);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_resolve_skip) {
+ /* resolve_skip dst(r) property(id) skip(n)
+
+ Looks up the property named by identifier property in the
+ scope chain skipping the top 'skip' levels, and writes the resulting
+ value to register dst. If the property is not found, raises an exception.
+ */
+ if (UNLIKELY(!resolveSkip(callFrame, vPC, exceptionValue)))
+ goto vm_throw;
+
+ vPC += OPCODE_LENGTH(op_resolve_skip);
+
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_resolve_global) {
+ /* resolve_skip dst(r) globalObject(c) property(id) structure(sID) offset(n)
+
+ Performs a dynamic property lookup for the given property, on the provided
+ global object. If structure matches the Structure of the global then perform
+ a fast lookup using the case offset, otherwise fall back to a full resolve and
+ cache the new structure and offset
+ */
+ if (UNLIKELY(!resolveGlobal(callFrame, vPC, exceptionValue)))
+ goto vm_throw;
+
+ vPC += OPCODE_LENGTH(op_resolve_global);
+
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_resolve_global_dynamic) {
+ /* resolve_skip dst(r) globalObject(c) property(id) structure(sID) offset(n), depth(n)
+
+ Performs a dynamic property lookup for the given property, on the provided
+ global object. If structure matches the Structure of the global then perform
+ a fast lookup using the case offset, otherwise fall back to a full resolve and
+ cache the new structure and offset.
+
+ This walks through n levels of the scope chain to verify that none of those levels
+ in the scope chain include dynamically added properties.
+ */
+ if (UNLIKELY(!resolveGlobalDynamic(callFrame, vPC, exceptionValue)))
+ goto vm_throw;
+
+ vPC += OPCODE_LENGTH(op_resolve_global_dynamic);
+
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_get_global_var) {
+ /* get_global_var dst(r) globalObject(c) index(n)
+
+ Gets the global var at global slot index and places it in register dst.
+ */
+ int dst = vPC[1].u.operand;
+ JSGlobalObject* scope = codeBlock->globalObject();
+ ASSERT(scope->isGlobalObject());
+ int index = vPC[2].u.operand;
+
+ callFrame->uncheckedR(dst) = scope->registerAt(index);
+ vPC += OPCODE_LENGTH(op_get_global_var);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_put_global_var) {
+ /* put_global_var globalObject(c) index(n) value(r)
+
+ Puts value into global slot index.
+ */
+ JSGlobalObject* scope = codeBlock->globalObject();
+ ASSERT(scope->isGlobalObject());
+ int index = vPC[1].u.operand;
+ int value = vPC[2].u.operand;
+
+ scope->registerAt(index) = JSValue(callFrame->r(value).jsValue());
+ vPC += OPCODE_LENGTH(op_put_global_var);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_get_scoped_var) {
+ /* get_scoped_var dst(r) index(n) skip(n)
+
+ Loads the contents of the index-th local from the scope skip nodes from
+ the top of the scope chain, and places it in register dst.
+ */
+ int dst = vPC[1].u.operand;
+ int index = vPC[2].u.operand;
+ int skip = vPC[3].u.operand;
+
+ ScopeChainNode* scopeChain = callFrame->scopeChain();
+ ScopeChainIterator iter = scopeChain->begin();
+ ScopeChainIterator end = scopeChain->end();
+ ASSERT(iter != end);
+ ASSERT(codeBlock == callFrame->codeBlock());
+ bool checkTopLevel = codeBlock->codeType() == FunctionCode && codeBlock->needsFullScopeChain();
+ ASSERT(skip || !checkTopLevel);
+ if (checkTopLevel && skip--) {
+ if (callFrame->r(codeBlock->activationRegister()).jsValue())
+ ++iter;
+ }
+ while (skip--) {
+ ++iter;
+ ASSERT(iter != end);
+ }
+ ASSERT((*iter)->isVariableObject());
+ JSVariableObject* scope = static_cast<JSVariableObject*>(*iter);
+ callFrame->uncheckedR(dst) = scope->registerAt(index);
+ ASSERT(callFrame->r(dst).jsValue());
+ vPC += OPCODE_LENGTH(op_get_scoped_var);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_put_scoped_var) {
+ /* put_scoped_var index(n) skip(n) value(r)
+
+ */
+ int index = vPC[1].u.operand;
+ int skip = vPC[2].u.operand;
+ int value = vPC[3].u.operand;
+
+ ScopeChainNode* scopeChain = callFrame->scopeChain();
+ ScopeChainIterator iter = scopeChain->begin();
+ ScopeChainIterator end = scopeChain->end();
+ ASSERT(codeBlock == callFrame->codeBlock());
+ ASSERT(iter != end);
+ bool checkTopLevel = codeBlock->codeType() == FunctionCode && codeBlock->needsFullScopeChain();
+ ASSERT(skip || !checkTopLevel);
+ if (checkTopLevel && skip--) {
+ if (callFrame->r(codeBlock->activationRegister()).jsValue())
+ ++iter;
+ }
+ while (skip--) {
+ ++iter;
+ ASSERT(iter != end);
+ }
+
+ ASSERT((*iter)->isVariableObject());
+ JSVariableObject* scope = static_cast<JSVariableObject*>(*iter);
+ ASSERT(callFrame->r(value).jsValue());
+ scope->registerAt(index) = JSValue(callFrame->r(value).jsValue());
+ vPC += OPCODE_LENGTH(op_put_scoped_var);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_resolve_base) {
+ /* resolve_base dst(r) property(id)
+
+ Searches the scope chain for an object containing
+ identifier property, and if one is found, writes it to
+ register dst. If none is found, the outermost scope (which
+ will be the global object) is stored in register dst.
+ */
+ resolveBase(callFrame, vPC);
+
+ vPC += OPCODE_LENGTH(op_resolve_base);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_ensure_property_exists) {
+ /* ensure_property_exists base(r) property(id)
+
+ Throws an exception if property does not exist on base
+ */
+ int base = vPC[1].u.operand;
+ int property = vPC[2].u.operand;
+ Identifier& ident = codeBlock->identifier(property);
+
+ JSValue baseVal = callFrame->r(base).jsValue();
+ JSObject* baseObject = asObject(baseVal);
+ PropertySlot slot(baseVal);
+ if (!baseObject->getPropertySlot(callFrame, ident, slot)) {
+ exceptionValue = createErrorForInvalidGlobalAssignment(callFrame, ident.ustring());
+ goto vm_throw;
+ }
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_resolve_with_base) {
+ /* resolve_with_base baseDst(r) propDst(r) property(id)
+
+ Searches the scope chain for an object containing
+ identifier property, and if one is found, writes it to
+ register srcDst, and the retrieved property value to register
+ propDst. If the property is not found, raises an exception.
+
+ This is more efficient than doing resolve_base followed by
+ resolve, or resolve_base followed by get_by_id, as it
+ avoids duplicate hash lookups.
+ */
+ if (UNLIKELY(!resolveBaseAndProperty(callFrame, vPC, exceptionValue)))
+ goto vm_throw;
+
+ vPC += OPCODE_LENGTH(op_resolve_with_base);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_get_by_id) {
+ /* get_by_id dst(r) base(r) property(id) structure(sID) nop(n) nop(n) nop(n)
+
+ Generic property access: Gets the property named by identifier
+ property from the value base, and puts the result in register dst.
+ */
+ int dst = vPC[1].u.operand;
+ int base = vPC[2].u.operand;
+ int property = vPC[3].u.operand;
+
+ Identifier& ident = codeBlock->identifier(property);
+ JSValue baseValue = callFrame->r(base).jsValue();
+ PropertySlot slot(baseValue);
+ JSValue result = baseValue.get(callFrame, ident, slot);
+ CHECK_FOR_EXCEPTION();
+
+ tryCacheGetByID(callFrame, codeBlock, vPC, baseValue, ident, slot);
+
+ callFrame->uncheckedR(dst) = result;
+ vPC += OPCODE_LENGTH(op_get_by_id);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_get_by_id_self) {
+ /* op_get_by_id_self dst(r) base(r) property(id) structure(sID) offset(n) nop(n) nop(n)
+
+ Cached property access: Attempts to get a cached property from the
+ value base. If the cache misses, op_get_by_id_self reverts to
+ op_get_by_id.
+ */
+ int base = vPC[2].u.operand;
+ JSValue baseValue = callFrame->r(base).jsValue();
+
+ if (LIKELY(baseValue.isCell())) {
+ JSCell* baseCell = baseValue.asCell();
+ Structure* structure = vPC[4].u.structure;
+
+ if (LIKELY(baseCell->structure() == structure)) {
+ ASSERT(baseCell->isObject());
+ JSObject* baseObject = asObject(baseCell);
+ int dst = vPC[1].u.operand;
+ int offset = vPC[5].u.operand;
+
+ ASSERT(baseObject->get(callFrame, codeBlock->identifier(vPC[3].u.operand)) == baseObject->getDirectOffset(offset));
+ callFrame->uncheckedR(dst) = JSValue(baseObject->getDirectOffset(offset));
+
+ vPC += OPCODE_LENGTH(op_get_by_id_self);
+ NEXT_INSTRUCTION();
+ }
+ }
+
+ uncacheGetByID(codeBlock, vPC);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_get_by_id_proto) {
+ /* op_get_by_id_proto dst(r) base(r) property(id) structure(sID) prototypeStructure(sID) offset(n) nop(n)
+
+ Cached property access: Attempts to get a cached property from the
+ value base's prototype. If the cache misses, op_get_by_id_proto
+ reverts to op_get_by_id.
+ */
+ int base = vPC[2].u.operand;
+ JSValue baseValue = callFrame->r(base).jsValue();
+
+ if (LIKELY(baseValue.isCell())) {
+ JSCell* baseCell = baseValue.asCell();
+ Structure* structure = vPC[4].u.structure;
+
+ if (LIKELY(baseCell->structure() == structure)) {
+ ASSERT(structure->prototypeForLookup(callFrame).isObject());
+ JSObject* protoObject = asObject(structure->prototypeForLookup(callFrame));
+ Structure* prototypeStructure = vPC[5].u.structure;
+
+ if (LIKELY(protoObject->structure() == prototypeStructure)) {
+ int dst = vPC[1].u.operand;
+ int offset = vPC[6].u.operand;
+
+ ASSERT(protoObject->get(callFrame, codeBlock->identifier(vPC[3].u.operand)) == protoObject->getDirectOffset(offset));
+ ASSERT(baseValue.get(callFrame, codeBlock->identifier(vPC[3].u.operand)) == protoObject->getDirectOffset(offset));
+ callFrame->uncheckedR(dst) = JSValue(protoObject->getDirectOffset(offset));
+
+ vPC += OPCODE_LENGTH(op_get_by_id_proto);
+ NEXT_INSTRUCTION();
+ }
+ }
+ }
+
+ uncacheGetByID(codeBlock, vPC);
+ NEXT_INSTRUCTION();
+ }
+#if USE(GCC_COMPUTED_GOTO_WORKAROUND)
+ goto *(&&skip_id_getter_proto);
+#endif
+ DEFINE_OPCODE(op_get_by_id_getter_proto) {
+ /* op_get_by_id_getter_proto dst(r) base(r) property(id) structure(sID) prototypeStructure(sID) offset(n) nop(n)
+
+ Cached property access: Attempts to get a cached getter property from the
+ value base's prototype. If the cache misses, op_get_by_id_getter_proto
+ reverts to op_get_by_id.
+ */
+ int base = vPC[2].u.operand;
+ JSValue baseValue = callFrame->r(base).jsValue();
+
+ if (LIKELY(baseValue.isCell())) {
+ JSCell* baseCell = baseValue.asCell();
+ Structure* structure = vPC[4].u.structure;
+
+ if (LIKELY(baseCell->structure() == structure)) {
+ ASSERT(structure->prototypeForLookup(callFrame).isObject());
+ JSObject* protoObject = asObject(structure->prototypeForLookup(callFrame));
+ Structure* prototypeStructure = vPC[5].u.structure;
+
+ if (LIKELY(protoObject->structure() == prototypeStructure)) {
+ int dst = vPC[1].u.operand;
+ int offset = vPC[6].u.operand;
+ if (GetterSetter* getterSetter = asGetterSetter(protoObject->getDirectOffset(offset).asCell())) {
+ JSObject* getter = getterSetter->getter();
+ CallData callData;
+ CallType callType = getter->getCallData(callData);
+ JSValue result = call(callFrame, getter, callType, callData, asObject(baseCell), ArgList());
+ CHECK_FOR_EXCEPTION();
+ callFrame->uncheckedR(dst) = result;
+ } else
+ callFrame->uncheckedR(dst) = jsUndefined();
+ vPC += OPCODE_LENGTH(op_get_by_id_getter_proto);
+ NEXT_INSTRUCTION();
+ }
+ }
+ }
+ uncacheGetByID(codeBlock, vPC);
+ NEXT_INSTRUCTION();
+ }
+#if USE(GCC_COMPUTED_GOTO_WORKAROUND)
+ skip_id_getter_proto:
+#endif
+#if USE(GCC_COMPUTED_GOTO_WORKAROUND)
+ goto *(&&skip_id_custom_proto);
+#endif
+ DEFINE_OPCODE(op_get_by_id_custom_proto) {
+ /* op_get_by_id_custom_proto dst(r) base(r) property(id) structure(sID) prototypeStructure(sID) offset(n) nop(n)
+
+ Cached property access: Attempts to use a cached named property getter
+ from the value base's prototype. If the cache misses, op_get_by_id_custom_proto
+ reverts to op_get_by_id.
+ */
+ int base = vPC[2].u.operand;
+ JSValue baseValue = callFrame->r(base).jsValue();
+
+ if (LIKELY(baseValue.isCell())) {
+ JSCell* baseCell = baseValue.asCell();
+ Structure* structure = vPC[4].u.structure;
+
+ if (LIKELY(baseCell->structure() == structure)) {
+ ASSERT(structure->prototypeForLookup(callFrame).isObject());
+ JSObject* protoObject = asObject(structure->prototypeForLookup(callFrame));
+ Structure* prototypeStructure = vPC[5].u.structure;
+
+ if (LIKELY(protoObject->structure() == prototypeStructure)) {
+ int dst = vPC[1].u.operand;
+ int property = vPC[3].u.operand;
+ Identifier& ident = codeBlock->identifier(property);
+
+ PropertySlot::GetValueFunc getter = vPC[6].u.getterFunc;
+ JSValue result = getter(callFrame, protoObject, ident);
+ CHECK_FOR_EXCEPTION();
+ callFrame->uncheckedR(dst) = result;
+ vPC += OPCODE_LENGTH(op_get_by_id_custom_proto);
+ NEXT_INSTRUCTION();
+ }
+ }
+ }
+ uncacheGetByID(codeBlock, vPC);
+ NEXT_INSTRUCTION();
+ }
+#if USE(GCC_COMPUTED_GOTO_WORKAROUND)
+ skip_id_custom_proto:
+#endif
+ DEFINE_OPCODE(op_get_by_id_self_list) {
+ // Polymorphic self access caching currently only supported when JITting.
+ ASSERT_NOT_REACHED();
+ // This case of the switch must not be empty, else (op_get_by_id_self_list == op_get_by_id_chain)!
+ vPC += OPCODE_LENGTH(op_get_by_id_self_list);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_get_by_id_proto_list) {
+ // Polymorphic prototype access caching currently only supported when JITting.
+ ASSERT_NOT_REACHED();
+ // This case of the switch must not be empty, else (op_get_by_id_proto_list == op_get_by_id_chain)!
+ vPC += OPCODE_LENGTH(op_get_by_id_proto_list);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_get_by_id_getter_self_list) {
+ // Polymorphic self access caching currently only supported when JITting.
+ ASSERT_NOT_REACHED();
+ // This case of the switch must not be empty, else (op_get_by_id_self_list == op_get_by_id_chain)!
+ vPC += OPCODE_LENGTH(op_get_by_id_self_list);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_get_by_id_getter_proto_list) {
+ // Polymorphic prototype access caching currently only supported when JITting.
+ ASSERT_NOT_REACHED();
+ // This case of the switch must not be empty, else (op_get_by_id_proto_list == op_get_by_id_chain)!
+ vPC += OPCODE_LENGTH(op_get_by_id_proto_list);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_get_by_id_custom_self_list) {
+ // Polymorphic self access caching currently only supported when JITting.
+ ASSERT_NOT_REACHED();
+ // This case of the switch must not be empty, else (op_get_by_id_self_list == op_get_by_id_chain)!
+ vPC += OPCODE_LENGTH(op_get_by_id_custom_self_list);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_get_by_id_custom_proto_list) {
+ // Polymorphic prototype access caching currently only supported when JITting.
+ ASSERT_NOT_REACHED();
+ // This case of the switch must not be empty, else (op_get_by_id_proto_list == op_get_by_id_chain)!
+ vPC += OPCODE_LENGTH(op_get_by_id_proto_list);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_get_by_id_chain) {
+ /* op_get_by_id_chain dst(r) base(r) property(id) structure(sID) structureChain(chain) count(n) offset(n)
+
+ Cached property access: Attempts to get a cached property from the
+ value base's prototype chain. If the cache misses, op_get_by_id_chain
+ reverts to op_get_by_id.
+ */
+ int base = vPC[2].u.operand;
+ JSValue baseValue = callFrame->r(base).jsValue();
+
+ if (LIKELY(baseValue.isCell())) {
+ JSCell* baseCell = baseValue.asCell();
+ Structure* structure = vPC[4].u.structure;
+
+ if (LIKELY(baseCell->structure() == structure)) {
+ RefPtr<Structure>* it = vPC[5].u.structureChain->head();
+ size_t count = vPC[6].u.operand;
+ RefPtr<Structure>* end = it + count;
+
+ while (true) {
+ JSObject* baseObject = asObject(baseCell->structure()->prototypeForLookup(callFrame));
+
+ if (UNLIKELY(baseObject->structure() != (*it).get()))
+ break;
+
+ if (++it == end) {
+ int dst = vPC[1].u.operand;
+ int offset = vPC[7].u.operand;
+
+ ASSERT(baseObject->get(callFrame, codeBlock->identifier(vPC[3].u.operand)) == baseObject->getDirectOffset(offset));
+ ASSERT(baseValue.get(callFrame, codeBlock->identifier(vPC[3].u.operand)) == baseObject->getDirectOffset(offset));
+ callFrame->uncheckedR(dst) = JSValue(baseObject->getDirectOffset(offset));
+
+ vPC += OPCODE_LENGTH(op_get_by_id_chain);
+ NEXT_INSTRUCTION();
+ }
+
+ // Update baseCell, so that next time around the loop we'll pick up the prototype's prototype.
+ baseCell = baseObject;
+ }
+ }
+ }
+
+ uncacheGetByID(codeBlock, vPC);
+ NEXT_INSTRUCTION();
+ }
+#if USE(GCC_COMPUTED_GOTO_WORKAROUND)
+ goto *(&&skip_id_getter_self);
+#endif
+ DEFINE_OPCODE(op_get_by_id_getter_self) {
+ /* op_get_by_id_self dst(r) base(r) property(id) structure(sID) offset(n) nop(n) nop(n)
+
+ Cached property access: Attempts to get a cached property from the
+ value base. If the cache misses, op_get_by_id_getter_self reverts to
+ op_get_by_id.
+ */
+ int base = vPC[2].u.operand;
+ JSValue baseValue = callFrame->r(base).jsValue();
+
+ if (LIKELY(baseValue.isCell())) {
+ JSCell* baseCell = baseValue.asCell();
+ Structure* structure = vPC[4].u.structure;
+
+ if (LIKELY(baseCell->structure() == structure)) {
+ ASSERT(baseCell->isObject());
+ JSObject* baseObject = asObject(baseCell);
+ int dst = vPC[1].u.operand;
+ int offset = vPC[5].u.operand;
+
+ if (GetterSetter* getterSetter = asGetterSetter(baseObject->getDirectOffset(offset).asCell())) {
+ JSObject* getter = getterSetter->getter();
+ CallData callData;
+ CallType callType = getter->getCallData(callData);
+ JSValue result = call(callFrame, getter, callType, callData, baseObject, ArgList());
+ CHECK_FOR_EXCEPTION();
+ callFrame->uncheckedR(dst) = result;
+ } else
+ callFrame->uncheckedR(dst) = jsUndefined();
+
+ vPC += OPCODE_LENGTH(op_get_by_id_getter_self);
+ NEXT_INSTRUCTION();
+ }
+ }
+ uncacheGetByID(codeBlock, vPC);
+ NEXT_INSTRUCTION();
+ }
+#if USE(GCC_COMPUTED_GOTO_WORKAROUND)
+ skip_id_getter_self:
+#endif
+#if USE(GCC_COMPUTED_GOTO_WORKAROUND)
+ goto *(&&skip_id_custom_self);
+#endif
+ DEFINE_OPCODE(op_get_by_id_custom_self) {
+ /* op_get_by_id_custom_self dst(r) base(r) property(id) structure(sID) offset(n) nop(n) nop(n)
+
+ Cached property access: Attempts to use a cached named property getter
+ from the value base. If the cache misses, op_get_by_id_custom_self reverts to
+ op_get_by_id.
+ */
+ int base = vPC[2].u.operand;
+ JSValue baseValue = callFrame->r(base).jsValue();
+
+ if (LIKELY(baseValue.isCell())) {
+ JSCell* baseCell = baseValue.asCell();
+ Structure* structure = vPC[4].u.structure;
+
+ if (LIKELY(baseCell->structure() == structure)) {
+ ASSERT(baseCell->isObject());
+ int dst = vPC[1].u.operand;
+ int property = vPC[3].u.operand;
+ Identifier& ident = codeBlock->identifier(property);
+
+ PropertySlot::GetValueFunc getter = vPC[5].u.getterFunc;
+ JSValue result = getter(callFrame, baseValue, ident);
+ CHECK_FOR_EXCEPTION();
+ callFrame->uncheckedR(dst) = result;
+ vPC += OPCODE_LENGTH(op_get_by_id_custom_self);
+ NEXT_INSTRUCTION();
+ }
+ }
+ uncacheGetByID(codeBlock, vPC);
+ NEXT_INSTRUCTION();
+ }
+#if USE(GCC_COMPUTED_GOTO_WORKAROUND)
+skip_id_custom_self:
+#endif
+ DEFINE_OPCODE(op_get_by_id_generic) {
+ /* op_get_by_id_generic dst(r) base(r) property(id) nop(sID) nop(n) nop(n) nop(n)
+
+ Generic property access: Gets the property named by identifier
+ property from the value base, and puts the result in register dst.
+ */
+ int dst = vPC[1].u.operand;
+ int base = vPC[2].u.operand;
+ int property = vPC[3].u.operand;
+
+ Identifier& ident = codeBlock->identifier(property);
+ JSValue baseValue = callFrame->r(base).jsValue();
+ PropertySlot slot(baseValue);
+ JSValue result = baseValue.get(callFrame, ident, slot);
+ CHECK_FOR_EXCEPTION();
+
+ callFrame->uncheckedR(dst) = result;
+ vPC += OPCODE_LENGTH(op_get_by_id_generic);
+ NEXT_INSTRUCTION();
+ }
+#if USE(GCC_COMPUTED_GOTO_WORKAROUND)
+ goto *(&&skip_id_getter_chain);
+#endif
+ DEFINE_OPCODE(op_get_by_id_getter_chain) {
+ /* op_get_by_id_getter_chain dst(r) base(r) property(id) structure(sID) structureChain(chain) count(n) offset(n)
+
+ Cached property access: Attempts to get a cached property from the
+ value base's prototype chain. If the cache misses, op_get_by_id_getter_chain
+ reverts to op_get_by_id.
+ */
+ int base = vPC[2].u.operand;
+ JSValue baseValue = callFrame->r(base).jsValue();
+
+ if (LIKELY(baseValue.isCell())) {
+ JSCell* baseCell = baseValue.asCell();
+ Structure* structure = vPC[4].u.structure;
+
+ if (LIKELY(baseCell->structure() == structure)) {
+ RefPtr<Structure>* it = vPC[5].u.structureChain->head();
+ size_t count = vPC[6].u.operand;
+ RefPtr<Structure>* end = it + count;
+
+ while (true) {
+ JSObject* baseObject = asObject(baseCell->structure()->prototypeForLookup(callFrame));
+
+ if (UNLIKELY(baseObject->structure() != (*it).get()))
+ break;
+
+ if (++it == end) {
+ int dst = vPC[1].u.operand;
+ int offset = vPC[7].u.operand;
+ if (GetterSetter* getterSetter = asGetterSetter(baseObject->getDirectOffset(offset).asCell())) {
+ JSObject* getter = getterSetter->getter();
+ CallData callData;
+ CallType callType = getter->getCallData(callData);
+ JSValue result = call(callFrame, getter, callType, callData, baseValue, ArgList());
+ CHECK_FOR_EXCEPTION();
+ callFrame->uncheckedR(dst) = result;
+ } else
+ callFrame->uncheckedR(dst) = jsUndefined();
+ vPC += OPCODE_LENGTH(op_get_by_id_getter_chain);
+ NEXT_INSTRUCTION();
+ }
+
+ // Update baseCell, so that next time around the loop we'll pick up the prototype's prototype.
+ baseCell = baseObject;
+ }
+ }
+ }
+ uncacheGetByID(codeBlock, vPC);
+ NEXT_INSTRUCTION();
+ }
+#if USE(GCC_COMPUTED_GOTO_WORKAROUND)
+ skip_id_getter_chain:
+#endif
+#if USE(GCC_COMPUTED_GOTO_WORKAROUND)
+ goto *(&&skip_id_custom_chain);
+#endif
+ DEFINE_OPCODE(op_get_by_id_custom_chain) {
+ /* op_get_by_id_custom_chain dst(r) base(r) property(id) structure(sID) structureChain(chain) count(n) offset(n)
+
+ Cached property access: Attempts to use a cached named property getter on the
+ value base's prototype chain. If the cache misses, op_get_by_id_custom_chain
+ reverts to op_get_by_id.
+ */
+ int base = vPC[2].u.operand;
+ JSValue baseValue = callFrame->r(base).jsValue();
+
+ if (LIKELY(baseValue.isCell())) {
+ JSCell* baseCell = baseValue.asCell();
+ Structure* structure = vPC[4].u.structure;
+
+ if (LIKELY(baseCell->structure() == structure)) {
+ RefPtr<Structure>* it = vPC[5].u.structureChain->head();
+ size_t count = vPC[6].u.operand;
+ RefPtr<Structure>* end = it + count;
+
+ while (true) {
+ JSObject* baseObject = asObject(baseCell->structure()->prototypeForLookup(callFrame));
+
+ if (UNLIKELY(baseObject->structure() != (*it).get()))
+ break;
+
+ if (++it == end) {
+ int dst = vPC[1].u.operand;
+ int property = vPC[3].u.operand;
+ Identifier& ident = codeBlock->identifier(property);
+
+ PropertySlot::GetValueFunc getter = vPC[7].u.getterFunc;
+ JSValue result = getter(callFrame, baseObject, ident);
+ CHECK_FOR_EXCEPTION();
+ callFrame->uncheckedR(dst) = result;
+ vPC += OPCODE_LENGTH(op_get_by_id_custom_chain);
+ NEXT_INSTRUCTION();
+ }
+
+ // Update baseCell, so that next time around the loop we'll pick up the prototype's prototype.
+ baseCell = baseObject;
+ }
+ }
+ }
+ uncacheGetByID(codeBlock, vPC);
+ NEXT_INSTRUCTION();
+ }
+#if USE(GCC_COMPUTED_GOTO_WORKAROUND)
+ skip_id_custom_chain:
+#endif
+ DEFINE_OPCODE(op_get_array_length) {
+ /* op_get_array_length dst(r) base(r) property(id) nop(sID) nop(n) nop(n) nop(n)
+
+ Cached property access: Gets the length of the array in register base,
+ and puts the result in register dst. If register base does not hold
+ an array, op_get_array_length reverts to op_get_by_id.
+ */
+
+ int base = vPC[2].u.operand;
+ JSValue baseValue = callFrame->r(base).jsValue();
+ if (LIKELY(isJSArray(globalData, baseValue))) {
+ int dst = vPC[1].u.operand;
+ callFrame->uncheckedR(dst) = jsNumber(asArray(baseValue)->length());
+ vPC += OPCODE_LENGTH(op_get_array_length);
+ NEXT_INSTRUCTION();
+ }
+
+ uncacheGetByID(codeBlock, vPC);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_get_string_length) {
+ /* op_get_string_length dst(r) base(r) property(id) nop(sID) nop(n) nop(n) nop(n)
+
+ Cached property access: Gets the length of the string in register base,
+ and puts the result in register dst. If register base does not hold
+ a string, op_get_string_length reverts to op_get_by_id.
+ */
+
+ int base = vPC[2].u.operand;
+ JSValue baseValue = callFrame->r(base).jsValue();
+ if (LIKELY(isJSString(globalData, baseValue))) {
+ int dst = vPC[1].u.operand;
+ callFrame->uncheckedR(dst) = jsNumber(asString(baseValue)->length());
+ vPC += OPCODE_LENGTH(op_get_string_length);
+ NEXT_INSTRUCTION();
+ }
+
+ uncacheGetByID(codeBlock, vPC);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_put_by_id) {
+ /* put_by_id base(r) property(id) value(r) nop(n) nop(n) nop(n) nop(n) direct(b)
+
+ Generic property access: Sets the property named by identifier
+ property, belonging to register base, to register value.
+
+ Unlike many opcodes, this one does not write any output to
+ the register file.
+
+ The "direct" flag should only be set this put_by_id is to initialize
+ an object literal.
+ */
+
+ int base = vPC[1].u.operand;
+ int property = vPC[2].u.operand;
+ int value = vPC[3].u.operand;
+ int direct = vPC[8].u.operand;
+
+ JSValue baseValue = callFrame->r(base).jsValue();
+ Identifier& ident = codeBlock->identifier(property);
+ PutPropertySlot slot(codeBlock->isStrictMode());
+ if (direct) {
+ baseValue.putDirect(callFrame, ident, callFrame->r(value).jsValue(), slot);
+ ASSERT(slot.base() == baseValue);
+ } else
+ baseValue.put(callFrame, ident, callFrame->r(value).jsValue(), slot);
+ CHECK_FOR_EXCEPTION();
+
+ tryCachePutByID(callFrame, codeBlock, vPC, baseValue, slot);
+
+ vPC += OPCODE_LENGTH(op_put_by_id);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_put_by_id_transition) {
+ /* op_put_by_id_transition base(r) property(id) value(r) oldStructure(sID) newStructure(sID) structureChain(chain) offset(n) direct(b)
+
+ Cached property access: Attempts to set a new property with a cached transition
+ property named by identifier property, belonging to register base,
+ to register value. If the cache misses, op_put_by_id_transition
+ reverts to op_put_by_id_generic.
+
+ Unlike many opcodes, this one does not write any output to
+ the register file.
+ */
+ int base = vPC[1].u.operand;
+ JSValue baseValue = callFrame->r(base).jsValue();
+
+ if (LIKELY(baseValue.isCell())) {
+ JSCell* baseCell = baseValue.asCell();
+ Structure* oldStructure = vPC[4].u.structure;
+ Structure* newStructure = vPC[5].u.structure;
+
+ if (LIKELY(baseCell->structure() == oldStructure)) {
+ ASSERT(baseCell->isObject());
+ JSObject* baseObject = asObject(baseCell);
+ int direct = vPC[8].u.operand;
+
+ if (!direct) {
+ RefPtr<Structure>* it = vPC[6].u.structureChain->head();
+
+ JSValue proto = baseObject->structure()->prototypeForLookup(callFrame);
+ while (!proto.isNull()) {
+ if (UNLIKELY(asObject(proto)->structure() != (*it).get())) {
+ uncachePutByID(codeBlock, vPC);
+ NEXT_INSTRUCTION();
+ }
+ ++it;
+ proto = asObject(proto)->structure()->prototypeForLookup(callFrame);
+ }
+ }
+ baseObject->transitionTo(newStructure);
+
+ int value = vPC[3].u.operand;
+ unsigned offset = vPC[7].u.operand;
+ ASSERT(baseObject->offsetForLocation(baseObject->getDirectLocation(codeBlock->identifier(vPC[2].u.operand))) == offset);
+ baseObject->putDirectOffset(offset, callFrame->r(value).jsValue());
+
+ vPC += OPCODE_LENGTH(op_put_by_id_transition);
+ NEXT_INSTRUCTION();
+ }
+ }
+
+ uncachePutByID(codeBlock, vPC);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_put_by_id_replace) {
+ /* op_put_by_id_replace base(r) property(id) value(r) structure(sID) offset(n) nop(n) nop(n) direct(b)
+
+ Cached property access: Attempts to set a pre-existing, cached
+ property named by identifier property, belonging to register base,
+ to register value. If the cache misses, op_put_by_id_replace
+ reverts to op_put_by_id.
+
+ Unlike many opcodes, this one does not write any output to
+ the register file.
+ */
+ int base = vPC[1].u.operand;
+ JSValue baseValue = callFrame->r(base).jsValue();
+
+ if (LIKELY(baseValue.isCell())) {
+ JSCell* baseCell = baseValue.asCell();
+ Structure* structure = vPC[4].u.structure;
+
+ if (LIKELY(baseCell->structure() == structure)) {
+ ASSERT(baseCell->isObject());
+ JSObject* baseObject = asObject(baseCell);
+ int value = vPC[3].u.operand;
+ unsigned offset = vPC[5].u.operand;
+
+ ASSERT(baseObject->offsetForLocation(baseObject->getDirectLocation(codeBlock->identifier(vPC[2].u.operand))) == offset);
+ baseObject->putDirectOffset(offset, callFrame->r(value).jsValue());
+
+ vPC += OPCODE_LENGTH(op_put_by_id_replace);
+ NEXT_INSTRUCTION();
+ }
+ }
+
+ uncachePutByID(codeBlock, vPC);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_put_by_id_generic) {
+ /* op_put_by_id_generic base(r) property(id) value(r) nop(n) nop(n) nop(n) nop(n) direct(b)
+
+ Generic property access: Sets the property named by identifier
+ property, belonging to register base, to register value.
+
+ Unlike many opcodes, this one does not write any output to
+ the register file.
+ */
+ int base = vPC[1].u.operand;
+ int property = vPC[2].u.operand;
+ int value = vPC[3].u.operand;
+ int direct = vPC[8].u.operand;
+
+ JSValue baseValue = callFrame->r(base).jsValue();
+ Identifier& ident = codeBlock->identifier(property);
+ PutPropertySlot slot(codeBlock->isStrictMode());
+ if (direct) {
+ baseValue.putDirect(callFrame, ident, callFrame->r(value).jsValue(), slot);
+ ASSERT(slot.base() == baseValue);
+ } else
+ baseValue.put(callFrame, ident, callFrame->r(value).jsValue(), slot);
+ CHECK_FOR_EXCEPTION();
+
+ vPC += OPCODE_LENGTH(op_put_by_id_generic);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_del_by_id) {
+ /* del_by_id dst(r) base(r) property(id)
+
+ Converts register base to Object, deletes the property
+ named by identifier property from the object, and writes a
+ boolean indicating success (if true) or failure (if false)
+ to register dst.
+ */
+ int dst = vPC[1].u.operand;
+ int base = vPC[2].u.operand;
+ int property = vPC[3].u.operand;
+
+ JSObject* baseObj = callFrame->r(base).jsValue().toObject(callFrame);
+ Identifier& ident = codeBlock->identifier(property);
+ bool result = baseObj->deleteProperty(callFrame, ident);
+ if (!result && codeBlock->isStrictMode()) {
+ exceptionValue = createTypeError(callFrame, "Unable to delete property.");
+ goto vm_throw;
+ }
+ CHECK_FOR_EXCEPTION();
+ callFrame->uncheckedR(dst) = jsBoolean(result);
+ vPC += OPCODE_LENGTH(op_del_by_id);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_get_by_pname) {
+ int dst = vPC[1].u.operand;
+ int base = vPC[2].u.operand;
+ int property = vPC[3].u.operand;
+ int expected = vPC[4].u.operand;
+ int iter = vPC[5].u.operand;
+ int i = vPC[6].u.operand;
+
+ JSValue baseValue = callFrame->r(base).jsValue();
+ JSPropertyNameIterator* it = callFrame->r(iter).propertyNameIterator();
+ JSValue subscript = callFrame->r(property).jsValue();
+ JSValue expectedSubscript = callFrame->r(expected).jsValue();
+ int index = callFrame->r(i).i() - 1;
+ JSValue result;
+ int offset = 0;
+ if (subscript == expectedSubscript && baseValue.isCell() && (baseValue.asCell()->structure() == it->cachedStructure()) && it->getOffset(index, offset)) {
+ callFrame->uncheckedR(dst) = JSValue(asObject(baseValue)->getDirectOffset(offset));
+ vPC += OPCODE_LENGTH(op_get_by_pname);
+ NEXT_INSTRUCTION();
+ }
+ {
+ Identifier propertyName(callFrame, subscript.toString(callFrame));
+ result = baseValue.get(callFrame, propertyName);
+ }
+ CHECK_FOR_EXCEPTION();
+ callFrame->uncheckedR(dst) = result;
+ vPC += OPCODE_LENGTH(op_get_by_pname);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_get_arguments_length) {
+ int dst = vPC[1].u.operand;
+ int argumentsRegister = vPC[2].u.operand;
+ int property = vPC[3].u.operand;
+ JSValue arguments = callFrame->r(argumentsRegister).jsValue();
+ if (arguments) {
+ Identifier& ident = codeBlock->identifier(property);
+ PropertySlot slot(arguments);
+ JSValue result = arguments.get(callFrame, ident, slot);
+ CHECK_FOR_EXCEPTION();
+ callFrame->uncheckedR(dst) = result;
+ } else
+ callFrame->uncheckedR(dst) = jsNumber(callFrame->argumentCount());
+
+ vPC += OPCODE_LENGTH(op_get_arguments_length);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_get_argument_by_val) {
+ int dst = vPC[1].u.operand;
+ int argumentsRegister = vPC[2].u.operand;
+ int property = vPC[3].u.operand;
+ JSValue arguments = callFrame->r(argumentsRegister).jsValue();
+ JSValue subscript = callFrame->r(property).jsValue();
+ if (!arguments && subscript.isUInt32() && subscript.asUInt32() < callFrame->argumentCount()) {
+ unsigned arg = subscript.asUInt32() + 1;
+ unsigned numParameters = callFrame->codeBlock()->m_numParameters;
+ if (arg < numParameters)
+ callFrame->uncheckedR(dst) = callFrame->r(arg - RegisterFile::CallFrameHeaderSize - numParameters);
+ else
+ callFrame->uncheckedR(dst) = callFrame->r(arg - RegisterFile::CallFrameHeaderSize - numParameters - callFrame->argumentCount() - 1);
+ vPC += OPCODE_LENGTH(op_get_argument_by_val);
+ NEXT_INSTRUCTION();
+ }
+ if (!arguments) {
+ Arguments* arguments = new (globalData) Arguments(callFrame);
+ callFrame->uncheckedR(argumentsRegister) = JSValue(arguments);
+ callFrame->uncheckedR(unmodifiedArgumentsRegister(argumentsRegister)) = JSValue(arguments);
+ }
+ // fallthrough
+ }
+ DEFINE_OPCODE(op_get_by_val) {
+ /* get_by_val dst(r) base(r) property(r)
+
+ Converts register base to Object, gets the property named
+ by register property from the object, and puts the result
+ in register dst. property is nominally converted to string
+ but numbers are treated more efficiently.
+ */
+ int dst = vPC[1].u.operand;
+ int base = vPC[2].u.operand;
+ int property = vPC[3].u.operand;
+
+ JSValue baseValue = callFrame->r(base).jsValue();
+ JSValue subscript = callFrame->r(property).jsValue();
+
+ JSValue result;
+
+ if (LIKELY(subscript.isUInt32())) {
+ uint32_t i = subscript.asUInt32();
+ if (isJSArray(globalData, baseValue)) {
+ JSArray* jsArray = asArray(baseValue);
+ if (jsArray->canGetIndex(i))
+ result = jsArray->getIndex(i);
+ else
+ result = jsArray->JSArray::get(callFrame, i);
+ } else if (isJSString(globalData, baseValue) && asString(baseValue)->canGetIndex(i))
+ result = asString(baseValue)->getIndex(callFrame, i);
+ else if (isJSByteArray(globalData, baseValue) && asByteArray(baseValue)->canAccessIndex(i))
+ result = asByteArray(baseValue)->getIndex(callFrame, i);
+ else
+ result = baseValue.get(callFrame, i);
+ } else {
+ Identifier property(callFrame, subscript.toString(callFrame));
+ result = baseValue.get(callFrame, property);
+ }
+
+ CHECK_FOR_EXCEPTION();
+ callFrame->uncheckedR(dst) = result;
+ vPC += OPCODE_LENGTH(op_get_by_val);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_put_by_val) {
+ /* put_by_val base(r) property(r) value(r)
+
+ Sets register value on register base as the property named
+ by register property. Base is converted to object
+ first. register property is nominally converted to string
+ but numbers are treated more efficiently.
+
+ Unlike many opcodes, this one does not write any output to
+ the register file.
+ */
+ int base = vPC[1].u.operand;
+ int property = vPC[2].u.operand;
+ int value = vPC[3].u.operand;
+
+ JSValue baseValue = callFrame->r(base).jsValue();
+ JSValue subscript = callFrame->r(property).jsValue();
+
+ if (LIKELY(subscript.isUInt32())) {
+ uint32_t i = subscript.asUInt32();
+ if (isJSArray(globalData, baseValue)) {
+ JSArray* jsArray = asArray(baseValue);
+ if (jsArray->canSetIndex(i))
+ jsArray->setIndex(i, callFrame->r(value).jsValue());
+ else
+ jsArray->JSArray::put(callFrame, i, callFrame->r(value).jsValue());
+ } else if (isJSByteArray(globalData, baseValue) && asByteArray(baseValue)->canAccessIndex(i)) {
+ JSByteArray* jsByteArray = asByteArray(baseValue);
+ double dValue = 0;
+ JSValue jsValue = callFrame->r(value).jsValue();
+ if (jsValue.isInt32())
+ jsByteArray->setIndex(i, jsValue.asInt32());
+ else if (jsValue.getNumber(dValue))
+ jsByteArray->setIndex(i, dValue);
+ else
+ baseValue.put(callFrame, i, jsValue);
+ } else
+ baseValue.put(callFrame, i, callFrame->r(value).jsValue());
+ } else {
+ Identifier property(callFrame, subscript.toString(callFrame));
+ if (!globalData->exception) { // Don't put to an object if toString threw an exception.
+ PutPropertySlot slot(codeBlock->isStrictMode());
+ baseValue.put(callFrame, property, callFrame->r(value).jsValue(), slot);
+ }
+ }
+
+ CHECK_FOR_EXCEPTION();
+ vPC += OPCODE_LENGTH(op_put_by_val);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_del_by_val) {
+ /* del_by_val dst(r) base(r) property(r)
+
+ Converts register base to Object, deletes the property
+ named by register property from the object, and writes a
+ boolean indicating success (if true) or failure (if false)
+ to register dst.
+ */
+ int dst = vPC[1].u.operand;
+ int base = vPC[2].u.operand;
+ int property = vPC[3].u.operand;
+
+ JSObject* baseObj = callFrame->r(base).jsValue().toObject(callFrame); // may throw
+
+ JSValue subscript = callFrame->r(property).jsValue();
+ bool result;
+ uint32_t i;
+ if (subscript.getUInt32(i))
+ result = baseObj->deleteProperty(callFrame, i);
+ else {
+ CHECK_FOR_EXCEPTION();
+ Identifier property(callFrame, subscript.toString(callFrame));
+ CHECK_FOR_EXCEPTION();
+ result = baseObj->deleteProperty(callFrame, property);
+ }
+ if (!result && codeBlock->isStrictMode()) {
+ exceptionValue = createTypeError(callFrame, "Unable to delete property.");
+ goto vm_throw;
+ }
+ CHECK_FOR_EXCEPTION();
+ callFrame->uncheckedR(dst) = jsBoolean(result);
+ vPC += OPCODE_LENGTH(op_del_by_val);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_put_by_index) {
+ /* put_by_index base(r) property(n) value(r)
+
+ Sets register value on register base as the property named
+ by the immediate number property. Base is converted to
+ object first.
+
+ Unlike many opcodes, this one does not write any output to
+ the register file.
+
+ This opcode is mainly used to initialize array literals.
+ */
+ int base = vPC[1].u.operand;
+ unsigned property = vPC[2].u.operand;
+ int value = vPC[3].u.operand;
+
+ callFrame->r(base).jsValue().put(callFrame, property, callFrame->r(value).jsValue());
+
+ vPC += OPCODE_LENGTH(op_put_by_index);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_loop) {
+ /* loop target(offset)
+
+ Jumps unconditionally to offset target from the current
+ instruction.
+
+ Additionally this loop instruction may terminate JS execution is
+ the JS timeout is reached.
+ */
+#if ENABLE(OPCODE_STATS)
+ OpcodeStats::resetLastInstruction();
+#endif
+ int target = vPC[1].u.operand;
+ CHECK_FOR_TIMEOUT();
+ vPC += target;
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_jmp) {
+ /* jmp target(offset)
+
+ Jumps unconditionally to offset target from the current
+ instruction.
+ */
+#if ENABLE(OPCODE_STATS)
+ OpcodeStats::resetLastInstruction();
+#endif
+ int target = vPC[1].u.operand;
+
+ vPC += target;
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_loop_if_true) {
+ /* loop_if_true cond(r) target(offset)
+
+ Jumps to offset target from the current instruction, if and
+ only if register cond converts to boolean as true.
+
+ Additionally this loop instruction may terminate JS execution is
+ the JS timeout is reached.
+ */
+ int cond = vPC[1].u.operand;
+ int target = vPC[2].u.operand;
+ if (callFrame->r(cond).jsValue().toBoolean(callFrame)) {
+ vPC += target;
+ CHECK_FOR_TIMEOUT();
+ NEXT_INSTRUCTION();
+ }
+
+ vPC += OPCODE_LENGTH(op_loop_if_true);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_loop_if_false) {
+ /* loop_if_true cond(r) target(offset)
+
+ Jumps to offset target from the current instruction, if and
+ only if register cond converts to boolean as false.
+
+ Additionally this loop instruction may terminate JS execution is
+ the JS timeout is reached.
+ */
+ int cond = vPC[1].u.operand;
+ int target = vPC[2].u.operand;
+ if (!callFrame->r(cond).jsValue().toBoolean(callFrame)) {
+ vPC += target;
+ CHECK_FOR_TIMEOUT();
+ NEXT_INSTRUCTION();
+ }
+
+ vPC += OPCODE_LENGTH(op_loop_if_true);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_jtrue) {
+ /* jtrue cond(r) target(offset)
+
+ Jumps to offset target from the current instruction, if and
+ only if register cond converts to boolean as true.
+ */
+ int cond = vPC[1].u.operand;
+ int target = vPC[2].u.operand;
+ if (callFrame->r(cond).jsValue().toBoolean(callFrame)) {
+ vPC += target;
+ NEXT_INSTRUCTION();
+ }
+
+ vPC += OPCODE_LENGTH(op_jtrue);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_jfalse) {
+ /* jfalse cond(r) target(offset)
+
+ Jumps to offset target from the current instruction, if and
+ only if register cond converts to boolean as false.
+ */
+ int cond = vPC[1].u.operand;
+ int target = vPC[2].u.operand;
+ if (!callFrame->r(cond).jsValue().toBoolean(callFrame)) {
+ vPC += target;
+ NEXT_INSTRUCTION();
+ }
+
+ vPC += OPCODE_LENGTH(op_jfalse);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_jeq_null) {
+ /* jeq_null src(r) target(offset)
+
+ Jumps to offset target from the current instruction, if and
+ only if register src is null.
+ */
+ int src = vPC[1].u.operand;
+ int target = vPC[2].u.operand;
+ JSValue srcValue = callFrame->r(src).jsValue();
+
+ if (srcValue.isUndefinedOrNull() || (srcValue.isCell() && srcValue.asCell()->structure()->typeInfo().masqueradesAsUndefined())) {
+ vPC += target;
+ NEXT_INSTRUCTION();
+ }
+
+ vPC += OPCODE_LENGTH(op_jeq_null);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_jneq_null) {
+ /* jneq_null src(r) target(offset)
+
+ Jumps to offset target from the current instruction, if and
+ only if register src is not null.
+ */
+ int src = vPC[1].u.operand;
+ int target = vPC[2].u.operand;
+ JSValue srcValue = callFrame->r(src).jsValue();
+
+ if (!srcValue.isUndefinedOrNull() && (!srcValue.isCell() || !srcValue.asCell()->structure()->typeInfo().masqueradesAsUndefined())) {
+ vPC += target;
+ NEXT_INSTRUCTION();
+ }
+
+ vPC += OPCODE_LENGTH(op_jneq_null);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_jneq_ptr) {
+ /* jneq_ptr src(r) ptr(jsCell) target(offset)
+
+ Jumps to offset target from the current instruction, if the value r is equal
+ to ptr, using pointer equality.
+ */
+ int src = vPC[1].u.operand;
+ JSValue ptr = JSValue(vPC[2].u.jsCell);
+ int target = vPC[3].u.operand;
+ JSValue srcValue = callFrame->r(src).jsValue();
+ if (srcValue != ptr) {
+ vPC += target;
+ NEXT_INSTRUCTION();
+ }
+
+ vPC += OPCODE_LENGTH(op_jneq_ptr);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_loop_if_less) {
+ /* loop_if_less src1(r) src2(r) target(offset)
+
+ Checks whether register src1 is less than register src2, as
+ with the ECMAScript '<' operator, and then jumps to offset
+ target from the current instruction, if and only if the
+ result of the comparison is true.
+
+ Additionally this loop instruction may terminate JS execution is
+ the JS timeout is reached.
+ */
+ JSValue src1 = callFrame->r(vPC[1].u.operand).jsValue();
+ JSValue src2 = callFrame->r(vPC[2].u.operand).jsValue();
+ int target = vPC[3].u.operand;
+
+ bool result = jsLess(callFrame, src1, src2);
+ CHECK_FOR_EXCEPTION();
+
+ if (result) {
+ vPC += target;
+ CHECK_FOR_TIMEOUT();
+ NEXT_INSTRUCTION();
+ }
+
+ vPC += OPCODE_LENGTH(op_loop_if_less);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_loop_if_lesseq) {
+ /* loop_if_lesseq src1(r) src2(r) target(offset)
+
+ Checks whether register src1 is less than or equal to register
+ src2, as with the ECMAScript '<=' operator, and then jumps to
+ offset target from the current instruction, if and only if the
+ result of the comparison is true.
+
+ Additionally this loop instruction may terminate JS execution is
+ the JS timeout is reached.
+ */
+ JSValue src1 = callFrame->r(vPC[1].u.operand).jsValue();
+ JSValue src2 = callFrame->r(vPC[2].u.operand).jsValue();
+ int target = vPC[3].u.operand;
+
+ bool result = jsLessEq(callFrame, src1, src2);
+ CHECK_FOR_EXCEPTION();
+
+ if (result) {
+ vPC += target;
+ CHECK_FOR_TIMEOUT();
+ NEXT_INSTRUCTION();
+ }
+
+ vPC += OPCODE_LENGTH(op_loop_if_lesseq);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_jnless) {
+ /* jnless src1(r) src2(r) target(offset)
+
+ Checks whether register src1 is less than register src2, as
+ with the ECMAScript '<' operator, and then jumps to offset
+ target from the current instruction, if and only if the
+ result of the comparison is false.
+ */
+ JSValue src1 = callFrame->r(vPC[1].u.operand).jsValue();
+ JSValue src2 = callFrame->r(vPC[2].u.operand).jsValue();
+ int target = vPC[3].u.operand;
+
+ bool result = jsLess(callFrame, src1, src2);
+ CHECK_FOR_EXCEPTION();
+
+ if (!result) {
+ vPC += target;
+ NEXT_INSTRUCTION();
+ }
+
+ vPC += OPCODE_LENGTH(op_jnless);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_jless) {
+ /* jless src1(r) src2(r) target(offset)
+
+ Checks whether register src1 is less than register src2, as
+ with the ECMAScript '<' operator, and then jumps to offset
+ target from the current instruction, if and only if the
+ result of the comparison is true.
+ */
+ JSValue src1 = callFrame->r(vPC[1].u.operand).jsValue();
+ JSValue src2 = callFrame->r(vPC[2].u.operand).jsValue();
+ int target = vPC[3].u.operand;
+
+ bool result = jsLess(callFrame, src1, src2);
+ CHECK_FOR_EXCEPTION();
+
+ if (result) {
+ vPC += target;
+ NEXT_INSTRUCTION();
+ }
+
+ vPC += OPCODE_LENGTH(op_jless);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_jnlesseq) {
+ /* jnlesseq src1(r) src2(r) target(offset)
+
+ Checks whether register src1 is less than or equal to
+ register src2, as with the ECMAScript '<=' operator,
+ and then jumps to offset target from the current instruction,
+ if and only if theresult of the comparison is false.
+ */
+ JSValue src1 = callFrame->r(vPC[1].u.operand).jsValue();
+ JSValue src2 = callFrame->r(vPC[2].u.operand).jsValue();
+ int target = vPC[3].u.operand;
+
+ bool result = jsLessEq(callFrame, src1, src2);
+ CHECK_FOR_EXCEPTION();
+
+ if (!result) {
+ vPC += target;
+ NEXT_INSTRUCTION();
+ }
+
+ vPC += OPCODE_LENGTH(op_jnlesseq);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_jlesseq) {
+ /* jlesseq src1(r) src2(r) target(offset)
+
+ Checks whether register src1 is less than or equal to
+ register src2, as with the ECMAScript '<=' operator,
+ and then jumps to offset target from the current instruction,
+ if and only if the result of the comparison is true.
+ */
+ JSValue src1 = callFrame->r(vPC[1].u.operand).jsValue();
+ JSValue src2 = callFrame->r(vPC[2].u.operand).jsValue();
+ int target = vPC[3].u.operand;
+
+ bool result = jsLessEq(callFrame, src1, src2);
+ CHECK_FOR_EXCEPTION();
+
+ if (result) {
+ vPC += target;
+ NEXT_INSTRUCTION();
+ }
+
+ vPC += OPCODE_LENGTH(op_jlesseq);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_switch_imm) {
+ /* switch_imm tableIndex(n) defaultOffset(offset) scrutinee(r)
+
+ Performs a range checked switch on the scrutinee value, using
+ the tableIndex-th immediate switch jump table. If the scrutinee value
+ is an immediate number in the range covered by the referenced jump
+ table, and the value at jumpTable[scrutinee value] is non-zero, then
+ that value is used as the jump offset, otherwise defaultOffset is used.
+ */
+ int tableIndex = vPC[1].u.operand;
+ int defaultOffset = vPC[2].u.operand;
+ JSValue scrutinee = callFrame->r(vPC[3].u.operand).jsValue();
+ if (scrutinee.isInt32())
+ vPC += codeBlock->immediateSwitchJumpTable(tableIndex).offsetForValue(scrutinee.asInt32(), defaultOffset);
+ else {
+ double value;
+ int32_t intValue;
+ if (scrutinee.getNumber(value) && ((intValue = static_cast<int32_t>(value)) == value))
+ vPC += codeBlock->immediateSwitchJumpTable(tableIndex).offsetForValue(intValue, defaultOffset);
+ else
+ vPC += defaultOffset;
+ }
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_switch_char) {
+ /* switch_char tableIndex(n) defaultOffset(offset) scrutinee(r)
+
+ Performs a range checked switch on the scrutinee value, using
+ the tableIndex-th character switch jump table. If the scrutinee value
+ is a single character string in the range covered by the referenced jump
+ table, and the value at jumpTable[scrutinee value] is non-zero, then
+ that value is used as the jump offset, otherwise defaultOffset is used.
+ */
+ int tableIndex = vPC[1].u.operand;
+ int defaultOffset = vPC[2].u.operand;
+ JSValue scrutinee = callFrame->r(vPC[3].u.operand).jsValue();
+ if (!scrutinee.isString())
+ vPC += defaultOffset;
+ else {
+ StringImpl* value = asString(scrutinee)->value(callFrame).impl();
+ if (value->length() != 1)
+ vPC += defaultOffset;
+ else
+ vPC += codeBlock->characterSwitchJumpTable(tableIndex).offsetForValue(value->characters()[0], defaultOffset);
+ }
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_switch_string) {
+ /* switch_string tableIndex(n) defaultOffset(offset) scrutinee(r)
+
+ Performs a sparse hashmap based switch on the value in the scrutinee
+ register, using the tableIndex-th string switch jump table. If the
+ scrutinee value is a string that exists as a key in the referenced
+ jump table, then the value associated with the string is used as the
+ jump offset, otherwise defaultOffset is used.
+ */
+ int tableIndex = vPC[1].u.operand;
+ int defaultOffset = vPC[2].u.operand;
+ JSValue scrutinee = callFrame->r(vPC[3].u.operand).jsValue();
+ if (!scrutinee.isString())
+ vPC += defaultOffset;
+ else
+ vPC += codeBlock->stringSwitchJumpTable(tableIndex).offsetForValue(asString(scrutinee)->value(callFrame).impl(), defaultOffset);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_new_func) {
+ /* new_func dst(r) func(f)
+
+ Constructs a new Function instance from function func and
+ the current scope chain using the original Function
+ constructor, using the rules for function declarations, and
+ puts the result in register dst.
+ */
+ int dst = vPC[1].u.operand;
+ int func = vPC[2].u.operand;
+ int shouldCheck = vPC[3].u.operand;
+ ASSERT(codeBlock->codeType() != FunctionCode || !codeBlock->needsFullScopeChain() || callFrame->r(codeBlock->activationRegister()).jsValue());
+ if (!shouldCheck || !callFrame->r(dst).jsValue())
+ callFrame->uncheckedR(dst) = JSValue(codeBlock->functionDecl(func)->make(callFrame, callFrame->scopeChain()));
+
+ vPC += OPCODE_LENGTH(op_new_func);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_new_func_exp) {
+ /* new_func_exp dst(r) func(f)
+
+ Constructs a new Function instance from function func and
+ the current scope chain using the original Function
+ constructor, using the rules for function expressions, and
+ puts the result in register dst.
+ */
+ int dst = vPC[1].u.operand;
+ int funcIndex = vPC[2].u.operand;
+
+ ASSERT(codeBlock->codeType() != FunctionCode || !codeBlock->needsFullScopeChain() || callFrame->r(codeBlock->activationRegister()).jsValue());
+ FunctionExecutable* function = codeBlock->functionExpr(funcIndex);
+ JSFunction* func = function->make(callFrame, callFrame->scopeChain());
+
+ /*
+ The Identifier in a FunctionExpression can be referenced from inside
+ the FunctionExpression's FunctionBody to allow the function to call
+ itself recursively. However, unlike in a FunctionDeclaration, the
+ Identifier in a FunctionExpression cannot be referenced from and
+ does not affect the scope enclosing the FunctionExpression.
+ */
+ if (!function->name().isNull()) {
+ JSStaticScopeObject* functionScopeObject = new (callFrame) JSStaticScopeObject(callFrame, function->name(), func, ReadOnly | DontDelete);
+ func->scope().push(functionScopeObject);
+ }
+
+ callFrame->uncheckedR(dst) = JSValue(func);
+
+ vPC += OPCODE_LENGTH(op_new_func_exp);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_call_eval) {
+ /* call_eval func(r) argCount(n) registerOffset(n)
+
+ Call a function named "eval" with no explicit "this" value
+ (which may therefore be the eval operator). If register
+ thisVal is the global object, and register func contains
+ that global object's original global eval function, then
+ perform the eval operator in local scope (interpreting
+ the argument registers as for the "call"
+ opcode). Otherwise, act exactly as the "call" opcode would.
+ */
+
+ int func = vPC[1].u.operand;
+ int argCount = vPC[2].u.operand;
+ int registerOffset = vPC[3].u.operand;
+
+ ASSERT(codeBlock->codeType() != FunctionCode || !codeBlock->needsFullScopeChain() || callFrame->r(codeBlock->activationRegister()).jsValue());
+ JSValue funcVal = callFrame->r(func).jsValue();
+
+ Register* newCallFrame = callFrame->registers() + registerOffset;
+ Register* argv = newCallFrame - RegisterFile::CallFrameHeaderSize - argCount;
+ JSValue thisValue = argv[0].jsValue();
+ JSGlobalObject* globalObject = callFrame->scopeChain()->globalObject;
+
+ if (thisValue == globalObject && funcVal == globalObject->evalFunction()) {
+ JSValue result = callEval(callFrame, registerFile, argv, argCount, registerOffset);
+ if ((exceptionValue = globalData->exception))
+ goto vm_throw;
+ functionReturnValue = result;
+
+ vPC += OPCODE_LENGTH(op_call_eval);
+ NEXT_INSTRUCTION();
+ }
+
+ // We didn't find the blessed version of eval, so process this
+ // instruction as a normal function call.
+ // fall through to op_call
+ }
+ DEFINE_OPCODE(op_call) {
+ /* call func(r) argCount(n) registerOffset(n)
+
+ Perform a function call.
+
+ registerOffset is the distance the callFrame pointer should move
+ before the VM initializes the new call frame's header.
+
+ dst is where op_ret should store its result.
+ */
+
+ int func = vPC[1].u.operand;
+ int argCount = vPC[2].u.operand;
+ int registerOffset = vPC[3].u.operand;
+
+ JSValue v = callFrame->r(func).jsValue();
+
+ CallData callData;
+ CallType callType = getCallData(v, callData);
+
+ if (callType == CallTypeJS) {
+ ScopeChainNode* callDataScopeChain = callData.js.scopeChain;
+
+ JSObject* error = callData.js.functionExecutable->compileForCall(callFrame, callDataScopeChain);
+ if (UNLIKELY(!!error)) {
+ exceptionValue = error;
+ goto vm_throw;
+ }
+
+ CallFrame* previousCallFrame = callFrame;
+ CodeBlock* newCodeBlock = &callData.js.functionExecutable->generatedBytecodeForCall();
+ callFrame = slideRegisterWindowForCall(newCodeBlock, registerFile, callFrame, registerOffset, argCount);
+ if (UNLIKELY(!callFrame)) {
+ callFrame = previousCallFrame;
+ exceptionValue = createStackOverflowError(callFrame);
+ goto vm_throw;
+ }
+
+ callFrame->init(newCodeBlock, vPC + OPCODE_LENGTH(op_call), callDataScopeChain, previousCallFrame, argCount, asFunction(v));
+ codeBlock = newCodeBlock;
+ ASSERT(codeBlock == callFrame->codeBlock());
+ vPC = newCodeBlock->instructions().begin();
+
+#if ENABLE(OPCODE_STATS)
+ OpcodeStats::resetLastInstruction();
+#endif
+
+ NEXT_INSTRUCTION();
+ }
+
+ if (callType == CallTypeHost) {
+ ScopeChainNode* scopeChain = callFrame->scopeChain();
+ CallFrame* newCallFrame = CallFrame::create(callFrame->registers() + registerOffset);
+ if (!registerFile->grow(newCallFrame->registers())) {
+ exceptionValue = createStackOverflowError(callFrame);
+ goto vm_throw;
+ }
+
+ newCallFrame->init(0, vPC + OPCODE_LENGTH(op_call), scopeChain, callFrame, argCount, asObject(v));
+
+ JSValue returnValue;
+ {
+ SamplingTool::HostCallRecord callRecord(m_sampler.get());
+ returnValue = JSValue::decode(callData.native.function(newCallFrame));
+ }
+ CHECK_FOR_EXCEPTION();
+
+ functionReturnValue = returnValue;
+
+ vPC += OPCODE_LENGTH(op_call);
+ NEXT_INSTRUCTION();
+ }
+
+ ASSERT(callType == CallTypeNone);
+
+ exceptionValue = createNotAFunctionError(callFrame, v);
+ goto vm_throw;
+ }
+ DEFINE_OPCODE(op_load_varargs) {
+ int argCountDst = vPC[1].u.operand;
+ int argsOffset = vPC[2].u.operand;
+
+ JSValue arguments = callFrame->r(argsOffset).jsValue();
+ uint32_t argCount = 0;
+ if (!arguments) {
+ argCount = (uint32_t)(callFrame->argumentCount());
+ argCount = min<uint32_t>(argCount, Arguments::MaxArguments);
+ int32_t sizeDelta = argsOffset + argCount + RegisterFile::CallFrameHeaderSize;
+ Register* newEnd = callFrame->registers() + sizeDelta;
+ if (!registerFile->grow(newEnd) || ((newEnd - callFrame->registers()) != sizeDelta)) {
+ exceptionValue = createStackOverflowError(callFrame);
+ goto vm_throw;
+ }
+ ASSERT(!asFunction(callFrame->callee())->isHostFunction());
+ int32_t expectedParams = asFunction(callFrame->callee())->jsExecutable()->parameterCount();
+ int32_t inplaceArgs = min(static_cast<int32_t>(argCount), expectedParams);
+ int32_t i = 0;
+ Register* argStore = callFrame->registers() + argsOffset;
+
+ // First step is to copy the "expected" parameters from their normal location relative to the callframe
+ for (; i < inplaceArgs; i++)
+ argStore[i] = callFrame->registers()[i - RegisterFile::CallFrameHeaderSize - expectedParams];
+ // Then we copy any additional arguments that may be further up the stack ('-1' to account for 'this')
+ for (; i < static_cast<int32_t>(argCount); i++)
+ argStore[i] = callFrame->registers()[i - RegisterFile::CallFrameHeaderSize - expectedParams - static_cast<int32_t>(argCount) - 1];
+ } else if (!arguments.isUndefinedOrNull()) {
+ if (!arguments.isObject()) {
+ exceptionValue = createInvalidParamError(callFrame, "Function.prototype.apply", arguments);
+ goto vm_throw;
+ }
+ if (asObject(arguments)->classInfo() == &Arguments::info) {
+ Arguments* args = asArguments(arguments);
+ argCount = args->numProvidedArguments(callFrame);
+ argCount = min<uint32_t>(argCount, Arguments::MaxArguments);
+ int32_t sizeDelta = argsOffset + argCount + RegisterFile::CallFrameHeaderSize;
+ Register* newEnd = callFrame->registers() + sizeDelta;
+ if (!registerFile->grow(newEnd) || ((newEnd - callFrame->registers()) != sizeDelta)) {
+ exceptionValue = createStackOverflowError(callFrame);
+ goto vm_throw;
+ }
+ args->copyToRegisters(callFrame, callFrame->registers() + argsOffset, argCount);
+ } else if (isJSArray(&callFrame->globalData(), arguments)) {
+ JSArray* array = asArray(arguments);
+ argCount = array->length();
+ argCount = min<uint32_t>(argCount, Arguments::MaxArguments);
+ int32_t sizeDelta = argsOffset + argCount + RegisterFile::CallFrameHeaderSize;
+ Register* newEnd = callFrame->registers() + sizeDelta;
+ if (!registerFile->grow(newEnd) || ((newEnd - callFrame->registers()) != sizeDelta)) {
+ exceptionValue = createStackOverflowError(callFrame);
+ goto vm_throw;
+ }
+ array->copyToRegisters(callFrame, callFrame->registers() + argsOffset, argCount);
+ } else if (asObject(arguments)->inherits(&JSArray::info)) {
+ JSObject* argObject = asObject(arguments);
+ argCount = argObject->get(callFrame, callFrame->propertyNames().length).toUInt32(callFrame);
+ argCount = min<uint32_t>(argCount, Arguments::MaxArguments);
+ int32_t sizeDelta = argsOffset + argCount + RegisterFile::CallFrameHeaderSize;
+ Register* newEnd = callFrame->registers() + sizeDelta;
+ if (!registerFile->grow(newEnd) || ((newEnd - callFrame->registers()) != sizeDelta)) {
+ exceptionValue = createStackOverflowError(callFrame);
+ goto vm_throw;
+ }
+ Register* argsBuffer = callFrame->registers() + argsOffset;
+ for (uint32_t i = 0; i < argCount; ++i) {
+ argsBuffer[i] = asObject(arguments)->get(callFrame, i);
+ CHECK_FOR_EXCEPTION();
+ }
+ } else {
+ exceptionValue = createInvalidParamError(callFrame, "Function.prototype.apply", arguments);
+ goto vm_throw;
+ }
+ }
+ CHECK_FOR_EXCEPTION();
+ callFrame->uncheckedR(argCountDst) = Register::withInt(argCount + 1);
+ vPC += OPCODE_LENGTH(op_load_varargs);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_call_varargs) {
+ /* call_varargs func(r) argCountReg(r) baseRegisterOffset(n)
+
+ Perform a function call with a dynamic set of arguments.
+
+ registerOffset is the distance the callFrame pointer should move
+ before the VM initializes the new call frame's header, excluding
+ space for arguments.
+
+ dst is where op_ret should store its result.
+ */
+
+ int func = vPC[1].u.operand;
+ int argCountReg = vPC[2].u.operand;
+ int registerOffset = vPC[3].u.operand;
+
+ JSValue v = callFrame->r(func).jsValue();
+ int argCount = callFrame->r(argCountReg).i();
+ registerOffset += argCount;
+ CallData callData;
+ CallType callType = getCallData(v, callData);
+
+ if (callType == CallTypeJS) {
+ ScopeChainNode* callDataScopeChain = callData.js.scopeChain;
+
+ JSObject* error = callData.js.functionExecutable->compileForCall(callFrame, callDataScopeChain);
+ if (UNLIKELY(!!error)) {
+ exceptionValue = error;
+ goto vm_throw;
+ }
+
+ CallFrame* previousCallFrame = callFrame;
+ CodeBlock* newCodeBlock = &callData.js.functionExecutable->generatedBytecodeForCall();
+ callFrame = slideRegisterWindowForCall(newCodeBlock, registerFile, callFrame, registerOffset, argCount);
+ if (UNLIKELY(!callFrame)) {
+ callFrame = previousCallFrame;
+ exceptionValue = createStackOverflowError(callFrame);
+ goto vm_throw;
+ }
+
+ callFrame->init(newCodeBlock, vPC + OPCODE_LENGTH(op_call_varargs), callDataScopeChain, previousCallFrame, argCount, asFunction(v));
+ codeBlock = newCodeBlock;
+ ASSERT(codeBlock == callFrame->codeBlock());
+ vPC = newCodeBlock->instructions().begin();
+
+#if ENABLE(OPCODE_STATS)
+ OpcodeStats::resetLastInstruction();
+#endif
+
+ NEXT_INSTRUCTION();
+ }
+
+ if (callType == CallTypeHost) {
+ ScopeChainNode* scopeChain = callFrame->scopeChain();
+ CallFrame* newCallFrame = CallFrame::create(callFrame->registers() + registerOffset);
+ if (!registerFile->grow(newCallFrame->registers())) {
+ exceptionValue = createStackOverflowError(callFrame);
+ goto vm_throw;
+ }
+ newCallFrame->init(0, vPC + OPCODE_LENGTH(op_call_varargs), scopeChain, callFrame, argCount, asObject(v));
+
+ JSValue returnValue;
+ {
+ SamplingTool::HostCallRecord callRecord(m_sampler.get());
+ returnValue = JSValue::decode(callData.native.function(newCallFrame));
+ }
+ CHECK_FOR_EXCEPTION();
+
+ functionReturnValue = returnValue;
+
+ vPC += OPCODE_LENGTH(op_call_varargs);
+ NEXT_INSTRUCTION();
+ }
+
+ ASSERT(callType == CallTypeNone);
+
+ exceptionValue = createNotAFunctionError(callFrame, v);
+ goto vm_throw;
+ }
+ DEFINE_OPCODE(op_tear_off_activation) {
+ /* tear_off_activation activation(r) arguments(r)
+
+ Copy locals and named parameters from the register file to the heap.
+ Point the bindings in 'activation' and 'arguments' to this new backing
+ store. (Note that 'arguments' may not have been created. If created,
+ 'arguments' already holds a copy of any extra / unnamed parameters.)
+
+ This opcode appears before op_ret in functions that require full scope chains.
+ */
+
+ int activation = vPC[1].u.operand;
+ int arguments = vPC[2].u.operand;
+ ASSERT(codeBlock->needsFullScopeChain());
+ JSValue activationValue = callFrame->r(activation).jsValue();
+ if (activationValue) {
+ asActivation(activationValue)->copyRegisters();
+
+ if (JSValue argumentsValue = callFrame->r(unmodifiedArgumentsRegister(arguments)).jsValue()) {
+ if (!codeBlock->isStrictMode())
+ asArguments(argumentsValue)->setActivation(asActivation(activationValue));
+ }
+ } else if (JSValue argumentsValue = callFrame->r(unmodifiedArgumentsRegister(arguments)).jsValue()) {
+ if (!codeBlock->isStrictMode())
+ asArguments(argumentsValue)->copyRegisters();
+ }
+
+ vPC += OPCODE_LENGTH(op_tear_off_activation);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_tear_off_arguments) {
+ /* tear_off_arguments arguments(r)
+
+ Copy named parameters from the register file to the heap. Point the
+ bindings in 'arguments' to this new backing store. (Note that
+ 'arguments' may not have been created. If created, 'arguments' already
+ holds a copy of any extra / unnamed parameters.)
+
+ This opcode appears before op_ret in functions that don't require full
+ scope chains, but do use 'arguments'.
+ */
+
+ int src1 = vPC[1].u.operand;
+ ASSERT(!codeBlock->needsFullScopeChain() && codeBlock->ownerExecutable()->usesArguments());
+
+ if (JSValue arguments = callFrame->r(unmodifiedArgumentsRegister(src1)).jsValue())
+ asArguments(arguments)->copyRegisters();
+
+ vPC += OPCODE_LENGTH(op_tear_off_arguments);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_ret) {
+ /* ret result(r)
+
+ Return register result as the return value of the current
+ function call, writing it into functionReturnValue.
+ In addition, unwind one call frame and restore the scope
+ chain, code block instruction pointer and register base
+ to those of the calling function.
+ */
+
+ int result = vPC[1].u.operand;
+
+ if (callFrame->codeBlock()->needsFullScopeChain() && callFrame->r(codeBlock->activationRegister()).jsValue())
+ callFrame->scopeChain()->deref();
+
+ JSValue returnValue = callFrame->r(result).jsValue();
+
+ vPC = callFrame->returnVPC();
+ callFrame = callFrame->callerFrame();
+
+ if (callFrame->hasHostCallFrameFlag())
+ return returnValue;
+
+ functionReturnValue = returnValue;
+ codeBlock = callFrame->codeBlock();
+ ASSERT(codeBlock == callFrame->codeBlock());
+
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_call_put_result) {
+ /* op_call_put_result result(r)
+
+ Move call result from functionReturnValue to caller's
+ expected return value register.
+ */
+
+ callFrame->uncheckedR(vPC[1].u.operand) = functionReturnValue;
+
+ vPC += OPCODE_LENGTH(op_call_put_result);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_ret_object_or_this) {
+ /* ret result(r)
+
+ Return register result as the return value of the current
+ function call, writing it into the caller's expected return
+ value register. In addition, unwind one call frame and
+ restore the scope chain, code block instruction pointer and
+ register base to those of the calling function.
+ */
+
+ int result = vPC[1].u.operand;
+
+ if (codeBlock->needsFullScopeChain() && callFrame->r(codeBlock->activationRegister()).jsValue())
+ callFrame->scopeChain()->deref();
+
+ JSValue returnValue = callFrame->r(result).jsValue();
+
+ if (UNLIKELY(!returnValue.isObject()))
+ returnValue = callFrame->r(vPC[2].u.operand).jsValue();
+
+ vPC = callFrame->returnVPC();
+ callFrame = callFrame->callerFrame();
+
+ if (callFrame->hasHostCallFrameFlag())
+ return returnValue;
+
+ functionReturnValue = returnValue;
+ codeBlock = callFrame->codeBlock();
+ ASSERT(codeBlock == callFrame->codeBlock());
+
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_enter) {
+ /* enter
+
+ Initializes local variables to undefined. If the code block requires
+ an activation, enter_with_activation is used instead.
+
+ This opcode appears only at the beginning of a code block.
+ */
+
+ size_t i = 0;
+ for (size_t count = codeBlock->m_numVars; i < count; ++i)
+ callFrame->uncheckedR(i) = jsUndefined();
+
+ vPC += OPCODE_LENGTH(op_enter);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_create_activation) {
+ /* create_activation dst(r)
+
+ If the activation object for this callframe has not yet been created,
+ this creates it and writes it back to dst.
+ */
+
+ int activationReg = vPC[1].u.operand;
+ if (!callFrame->r(activationReg).jsValue()) {
+ JSActivation* activation = new (globalData) JSActivation(callFrame, static_cast<FunctionExecutable*>(codeBlock->ownerExecutable()));
+ callFrame->r(activationReg) = JSValue(activation);
+ callFrame->setScopeChain(callFrame->scopeChain()->copy()->push(activation));
+ }
+ vPC += OPCODE_LENGTH(op_create_activation);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_get_callee) {
+ /* op_get_callee callee(r)
+
+ Move callee into a register.
+ */
+
+ callFrame->uncheckedR(vPC[1].u.operand) = JSValue(callFrame->callee());
+
+ vPC += OPCODE_LENGTH(op_get_callee);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_create_this) {
+ /* op_create_this this(r) proto(r)
+
+ Allocate an object as 'this', fr use in construction.
+
+ This opcode should only be used at the beginning of a code
+ block.
+ */
+
+ int thisRegister = vPC[1].u.operand;
+ int protoRegister = vPC[2].u.operand;
+
+ JSFunction* constructor = asFunction(callFrame->callee());
+#if !ASSERT_DISABLED
+ ConstructData constructData;
+ ASSERT(constructor->getConstructData(constructData) == ConstructTypeJS);
+#endif
+
+ Structure* structure;
+ JSValue proto = callFrame->r(protoRegister).jsValue();
+ if (proto.isObject())
+ structure = asObject(proto)->inheritorID();
+ else
+ structure = constructor->scope().node()->globalObject->emptyObjectStructure();
+ callFrame->uncheckedR(thisRegister) = JSValue(new (&callFrame->globalData()) JSObject(structure));
+
+ vPC += OPCODE_LENGTH(op_create_this);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_convert_this) {
+ /* convert_this this(r)
+
+ Takes the value in the 'this' register, converts it to a
+ value that is suitable for use as the 'this' value, and
+ stores it in the 'this' register. This opcode is emitted
+ to avoid doing the conversion in the caller unnecessarily.
+
+ This opcode should only be used at the beginning of a code
+ block.
+ */
+
+ int thisRegister = vPC[1].u.operand;
+ JSValue thisVal = callFrame->r(thisRegister).jsValue();
+ if (thisVal.needsThisConversion())
+ callFrame->uncheckedR(thisRegister) = JSValue(thisVal.toThisObject(callFrame));
+
+ vPC += OPCODE_LENGTH(op_convert_this);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_convert_this_strict) {
+ /* convert_this_strict this(r)
+
+ Takes the value in the 'this' register, and converts it to
+ its "this" form if (and only if) "this" is an object with a
+ custom this conversion
+
+ This opcode should only be used at the beginning of a code
+ block.
+ */
+
+ int thisRegister = vPC[1].u.operand;
+ JSValue thisVal = callFrame->r(thisRegister).jsValue();
+ if (thisVal.isObject() && thisVal.needsThisConversion())
+ callFrame->uncheckedR(thisRegister) = JSValue(thisVal.toStrictThisObject(callFrame));
+
+ vPC += OPCODE_LENGTH(op_convert_this_strict);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_init_lazy_reg) {
+ /* init_lazy_reg dst(r)
+
+ Initialises dst(r) to JSValue().
+
+ This opcode appears only at the beginning of a code block.
+ */
+ int dst = vPC[1].u.operand;
+
+ callFrame->uncheckedR(dst) = JSValue();
+ vPC += OPCODE_LENGTH(op_init_lazy_reg);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_create_arguments) {
+ /* create_arguments dst(r)
+
+ Creates the 'arguments' object and places it in both the
+ 'arguments' call frame slot and the local 'arguments'
+ register, if it has not already been initialised.
+ */
+
+ int dst = vPC[1].u.operand;
+
+ if (!callFrame->r(dst).jsValue()) {
+ Arguments* arguments = new (globalData) Arguments(callFrame);
+ callFrame->uncheckedR(dst) = JSValue(arguments);
+ callFrame->uncheckedR(unmodifiedArgumentsRegister(dst)) = JSValue(arguments);
+ }
+ vPC += OPCODE_LENGTH(op_create_arguments);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_construct) {
+ /* construct func(r) argCount(n) registerOffset(n) proto(r) thisRegister(r)
+
+ Invoke register "func" as a constructor. For JS
+ functions, the calling convention is exactly as for the
+ "call" opcode, except that the "this" value is a newly
+ created Object. For native constructors, no "this"
+ value is passed. In either case, the argCount and registerOffset
+ registers are interpreted as for the "call" opcode.
+
+ Register proto must contain the prototype property of
+ register func. This is to enable polymorphic inline
+ caching of this lookup.
+ */
+
+ int func = vPC[1].u.operand;
+ int argCount = vPC[2].u.operand;
+ int registerOffset = vPC[3].u.operand;
+
+ JSValue v = callFrame->r(func).jsValue();
+
+ ConstructData constructData;
+ ConstructType constructType = getConstructData(v, constructData);
+
+ if (constructType == ConstructTypeJS) {
+ ScopeChainNode* callDataScopeChain = constructData.js.scopeChain;
+
+ JSObject* error = constructData.js.functionExecutable->compileForConstruct(callFrame, callDataScopeChain);
+ if (UNLIKELY(!!error)) {
+ exceptionValue = error;
+ goto vm_throw;
+ }
+
+ CallFrame* previousCallFrame = callFrame;
+ CodeBlock* newCodeBlock = &constructData.js.functionExecutable->generatedBytecodeForConstruct();
+ callFrame = slideRegisterWindowForCall(newCodeBlock, registerFile, callFrame, registerOffset, argCount);
+ if (UNLIKELY(!callFrame)) {
+ callFrame = previousCallFrame;
+ exceptionValue = createStackOverflowError(callFrame);
+ goto vm_throw;
+ }
+
+ callFrame->init(newCodeBlock, vPC + OPCODE_LENGTH(op_construct), callDataScopeChain, previousCallFrame, argCount, asFunction(v));
+ codeBlock = newCodeBlock;
+ vPC = newCodeBlock->instructions().begin();
+#if ENABLE(OPCODE_STATS)
+ OpcodeStats::resetLastInstruction();
+#endif
+
+ NEXT_INSTRUCTION();
+ }
+
+ if (constructType == ConstructTypeHost) {
+ ScopeChainNode* scopeChain = callFrame->scopeChain();
+ CallFrame* newCallFrame = CallFrame::create(callFrame->registers() + registerOffset);
+ if (!registerFile->grow(newCallFrame->registers())) {
+ exceptionValue = createStackOverflowError(callFrame);
+ goto vm_throw;
+ }
+ newCallFrame->init(0, vPC + OPCODE_LENGTH(op_construct), scopeChain, callFrame, argCount, asObject(v));
+
+ JSValue returnValue;
+ {
+ SamplingTool::HostCallRecord callRecord(m_sampler.get());
+ returnValue = JSValue::decode(constructData.native.function(newCallFrame));
+ }
+ CHECK_FOR_EXCEPTION();
+ functionReturnValue = returnValue;
+
+ vPC += OPCODE_LENGTH(op_construct);
+ NEXT_INSTRUCTION();
+ }
+
+ ASSERT(constructType == ConstructTypeNone);
+
+ exceptionValue = createNotAConstructorError(callFrame, v);
+ goto vm_throw;
+ }
+ DEFINE_OPCODE(op_strcat) {
+ /* strcat dst(r) src(r) count(n)
+
+ Construct a new String instance using the original
+ constructor, and puts the result in register dst.
+ The string will be the result of concatenating count
+ strings with values taken from registers starting at
+ register src.
+ */
+ int dst = vPC[1].u.operand;
+ int src = vPC[2].u.operand;
+ int count = vPC[3].u.operand;
+
+ callFrame->uncheckedR(dst) = concatenateStrings(callFrame, &callFrame->registers()[src], count);
+ CHECK_FOR_EXCEPTION();
+ vPC += OPCODE_LENGTH(op_strcat);
+
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_to_primitive) {
+ int dst = vPC[1].u.operand;
+ int src = vPC[2].u.operand;
+
+ callFrame->uncheckedR(dst) = callFrame->r(src).jsValue().toPrimitive(callFrame);
+ vPC += OPCODE_LENGTH(op_to_primitive);
+
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_push_scope) {
+ /* push_scope scope(r)
+
+ Converts register scope to object, and pushes it onto the top
+ of the current scope chain. The contents of the register scope
+ are replaced by the result of toObject conversion of the scope.
+ */
+ int scope = vPC[1].u.operand;
+ JSValue v = callFrame->r(scope).jsValue();
+ JSObject* o = v.toObject(callFrame);
+ CHECK_FOR_EXCEPTION();
+
+ callFrame->uncheckedR(scope) = JSValue(o);
+ callFrame->setScopeChain(callFrame->scopeChain()->push(o));
+
+ vPC += OPCODE_LENGTH(op_push_scope);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_pop_scope) {
+ /* pop_scope
+
+ Removes the top item from the current scope chain.
+ */
+ callFrame->setScopeChain(callFrame->scopeChain()->pop());
+
+ vPC += OPCODE_LENGTH(op_pop_scope);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_get_pnames) {
+ /* get_pnames dst(r) base(r) i(n) size(n) breakTarget(offset)
+
+ Creates a property name list for register base and puts it
+ in register dst, initializing i and size for iteration. If
+ base is undefined or null, jumps to breakTarget.
+ */
+ int dst = vPC[1].u.operand;
+ int base = vPC[2].u.operand;
+ int i = vPC[3].u.operand;
+ int size = vPC[4].u.operand;
+ int breakTarget = vPC[5].u.operand;
+
+ JSValue v = callFrame->r(base).jsValue();
+ if (v.isUndefinedOrNull()) {
+ vPC += breakTarget;
+ NEXT_INSTRUCTION();
+ }
+
+ JSObject* o = v.toObject(callFrame);
+ Structure* structure = o->structure();
+ JSPropertyNameIterator* jsPropertyNameIterator = structure->enumerationCache();
+ if (!jsPropertyNameIterator || jsPropertyNameIterator->cachedPrototypeChain() != structure->prototypeChain(callFrame))
+ jsPropertyNameIterator = JSPropertyNameIterator::create(callFrame, o);
+
+ callFrame->uncheckedR(dst) = jsPropertyNameIterator;
+ callFrame->uncheckedR(base) = JSValue(o);
+ callFrame->uncheckedR(i) = Register::withInt(0);
+ callFrame->uncheckedR(size) = Register::withInt(jsPropertyNameIterator->size());
+ vPC += OPCODE_LENGTH(op_get_pnames);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_next_pname) {
+ /* next_pname dst(r) base(r) i(n) size(n) iter(r) target(offset)
+
+ Copies the next name from the property name list in
+ register iter to dst, then jumps to offset target. If there are no
+ names left, invalidates the iterator and continues to the next
+ instruction.
+ */
+ int dst = vPC[1].u.operand;
+ int base = vPC[2].u.operand;
+ int i = vPC[3].u.operand;
+ int size = vPC[4].u.operand;
+ int iter = vPC[5].u.operand;
+ int target = vPC[6].u.operand;
+
+ JSPropertyNameIterator* it = callFrame->r(iter).propertyNameIterator();
+ while (callFrame->r(i).i() != callFrame->r(size).i()) {
+ JSValue key = it->get(callFrame, asObject(callFrame->r(base).jsValue()), callFrame->r(i).i());
+ CHECK_FOR_EXCEPTION();
+ callFrame->uncheckedR(i) = Register::withInt(callFrame->r(i).i() + 1);
+ if (key) {
+ CHECK_FOR_TIMEOUT();
+ callFrame->uncheckedR(dst) = key;
+ vPC += target;
+ NEXT_INSTRUCTION();
+ }
+ }
+
+ vPC += OPCODE_LENGTH(op_next_pname);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_jmp_scopes) {
+ /* jmp_scopes count(n) target(offset)
+
+ Removes the a number of items from the current scope chain
+ specified by immediate number count, then jumps to offset
+ target.
+ */
+ int count = vPC[1].u.operand;
+ int target = vPC[2].u.operand;
+
+ ScopeChainNode* tmp = callFrame->scopeChain();
+ while (count--)
+ tmp = tmp->pop();
+ callFrame->setScopeChain(tmp);
+
+ vPC += target;
+ NEXT_INSTRUCTION();
+ }
+#if ENABLE(COMPUTED_GOTO_INTERPRETER)
+ // Appease GCC
+ goto *(&&skip_new_scope);
+#endif
+ DEFINE_OPCODE(op_push_new_scope) {
+ /* new_scope dst(r) property(id) value(r)
+
+ Constructs a new StaticScopeObject with property set to value. That scope
+ object is then pushed onto the ScopeChain. The scope object is then stored
+ in dst for GC.
+ */
+ callFrame->setScopeChain(createExceptionScope(callFrame, vPC));
+
+ vPC += OPCODE_LENGTH(op_push_new_scope);
+ NEXT_INSTRUCTION();
+ }
+#if ENABLE(COMPUTED_GOTO_INTERPRETER)
+ skip_new_scope:
+#endif
+ DEFINE_OPCODE(op_catch) {
+ /* catch ex(r)
+
+ Retrieves the VM's current exception and puts it in register
+ ex. This is only valid after an exception has been raised,
+ and usually forms the beginning of an exception handler.
+ */
+ ASSERT(exceptionValue);
+ ASSERT(!globalData->exception);
+ int ex = vPC[1].u.operand;
+ callFrame->uncheckedR(ex) = exceptionValue;
+ exceptionValue = JSValue();
+
+ vPC += OPCODE_LENGTH(op_catch);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_throw) {
+ /* throw ex(r)
+
+ Throws register ex as an exception. This involves three
+ steps: first, it is set as the current exception in the
+ VM's internal state, then the stack is unwound until an
+ exception handler or a native code boundary is found, and
+ then control resumes at the exception handler if any or
+ else the script returns control to the nearest native caller.
+ */
+
+ int ex = vPC[1].u.operand;
+ exceptionValue = callFrame->r(ex).jsValue();
+
+ handler = throwException(callFrame, exceptionValue, vPC - codeBlock->instructions().begin());
+ if (!handler)
+ return throwError(callFrame, exceptionValue);
+
+ codeBlock = callFrame->codeBlock();
+ vPC = codeBlock->instructions().begin() + handler->target;
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_throw_reference_error) {
+ /* op_throw_reference_error message(k)
+
+ Constructs a new reference Error instance using the
+ original constructor, using constant message as the
+ message string. The result is thrown.
+ */
+ UString message = callFrame->r(vPC[1].u.operand).jsValue().toString(callFrame);
+ exceptionValue = JSValue(createReferenceError(callFrame, message));
+ goto vm_throw;
+ }
+ DEFINE_OPCODE(op_throw_syntax_error) {
+ /* op_throw_syntax_error message(k)
+
+ Constructs a new syntax Error instance using the
+ original constructor, using constant message as the
+ message string. The result is thrown.
+ */
+ UString message = callFrame->r(vPC[1].u.operand).jsValue().toString(callFrame);
+ exceptionValue = JSValue(createSyntaxError(callFrame, message));
+ goto vm_throw;
+ }
+ DEFINE_OPCODE(op_end) {
+ /* end result(r)
+
+ Return register result as the value of a global or eval
+ program. Return control to the calling native code.
+ */
+
+ if (codeBlock->needsFullScopeChain()) {
+ ScopeChainNode* scopeChain = callFrame->scopeChain();
+ ASSERT(scopeChain->refCount > 1);
+ scopeChain->deref();
+ }
+ int result = vPC[1].u.operand;
+ return callFrame->r(result).jsValue();
+ }
+ DEFINE_OPCODE(op_put_getter) {
+ /* put_getter base(r) property(id) function(r)
+
+ Sets register function on register base as the getter named
+ by identifier property. Base and function are assumed to be
+ objects as this op should only be used for getters defined
+ in object literal form.
+
+ Unlike many opcodes, this one does not write any output to
+ the register file.
+ */
+ int base = vPC[1].u.operand;
+ int property = vPC[2].u.operand;
+ int function = vPC[3].u.operand;
+
+ ASSERT(callFrame->r(base).jsValue().isObject());
+ JSObject* baseObj = asObject(callFrame->r(base).jsValue());
+ Identifier& ident = codeBlock->identifier(property);
+ ASSERT(callFrame->r(function).jsValue().isObject());
+ baseObj->defineGetter(callFrame, ident, asObject(callFrame->r(function).jsValue()));
+
+ vPC += OPCODE_LENGTH(op_put_getter);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_put_setter) {
+ /* put_setter base(r) property(id) function(r)
+
+ Sets register function on register base as the setter named
+ by identifier property. Base and function are assumed to be
+ objects as this op should only be used for setters defined
+ in object literal form.
+
+ Unlike many opcodes, this one does not write any output to
+ the register file.
+ */
+ int base = vPC[1].u.operand;
+ int property = vPC[2].u.operand;
+ int function = vPC[3].u.operand;
+
+ ASSERT(callFrame->r(base).jsValue().isObject());
+ JSObject* baseObj = asObject(callFrame->r(base).jsValue());
+ Identifier& ident = codeBlock->identifier(property);
+ ASSERT(callFrame->r(function).jsValue().isObject());
+ baseObj->defineSetter(callFrame, ident, asObject(callFrame->r(function).jsValue()), 0);
+
+ vPC += OPCODE_LENGTH(op_put_setter);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_method_check) {
+ vPC++;
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_jsr) {
+ /* jsr retAddrDst(r) target(offset)
+
+ Places the address of the next instruction into the retAddrDst
+ register and jumps to offset target from the current instruction.
+ */
+ int retAddrDst = vPC[1].u.operand;
+ int target = vPC[2].u.operand;
+ callFrame->r(retAddrDst) = vPC + OPCODE_LENGTH(op_jsr);
+
+ vPC += target;
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_sret) {
+ /* sret retAddrSrc(r)
+
+ Jumps to the address stored in the retAddrSrc register. This
+ differs from op_jmp because the target address is stored in a
+ register, not as an immediate.
+ */
+ int retAddrSrc = vPC[1].u.operand;
+ vPC = callFrame->r(retAddrSrc).vPC();
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_debug) {
+ /* debug debugHookID(n) firstLine(n) lastLine(n)
+
+ Notifies the debugger of the current state of execution. This opcode
+ is only generated while the debugger is attached.
+ */
+ int debugHookID = vPC[1].u.operand;
+ int firstLine = vPC[2].u.operand;
+ int lastLine = vPC[3].u.operand;
+
+ debug(callFrame, static_cast<DebugHookID>(debugHookID), firstLine, lastLine);
+
+ vPC += OPCODE_LENGTH(op_debug);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_profile_will_call) {
+ /* op_profile_will_call function(r)
+
+ Notifies the profiler of the beginning of a function call. This opcode
+ is only generated if developer tools are enabled.
+ */
+ int function = vPC[1].u.operand;
+
+ if (*enabledProfilerReference)
+ (*enabledProfilerReference)->willExecute(callFrame, callFrame->r(function).jsValue());
+
+ vPC += OPCODE_LENGTH(op_profile_will_call);
+ NEXT_INSTRUCTION();
+ }
+ DEFINE_OPCODE(op_profile_did_call) {
+ /* op_profile_did_call function(r)
+
+ Notifies the profiler of the end of a function call. This opcode
+ is only generated if developer tools are enabled.
+ */
+ int function = vPC[1].u.operand;
+
+ if (*enabledProfilerReference)
+ (*enabledProfilerReference)->didExecute(callFrame, callFrame->r(function).jsValue());
+
+ vPC += OPCODE_LENGTH(op_profile_did_call);
+ NEXT_INSTRUCTION();
+ }
+ vm_throw: {
+ globalData->exception = JSValue();
+ if (!tickCount) {
+ // The exceptionValue is a lie! (GCC produces bad code for reasons I
+ // cannot fathom if we don't assign to the exceptionValue before branching)
+ exceptionValue = createInterruptedExecutionException(globalData);
+ }
+ handler = throwException(callFrame, exceptionValue, vPC - codeBlock->instructions().begin());
+ if (!handler)
+ return throwError(callFrame, exceptionValue);
+
+ codeBlock = callFrame->codeBlock();
+ vPC = codeBlock->instructions().begin() + handler->target;
+ NEXT_INSTRUCTION();
+ }
+ }
+#if !ENABLE(COMPUTED_GOTO_INTERPRETER)
+ } // iterator loop ends
+#endif
+ #undef NEXT_INSTRUCTION
+ #undef DEFINE_OPCODE
+ #undef CHECK_FOR_EXCEPTION
+ #undef CHECK_FOR_TIMEOUT
+#endif // ENABLE(INTERPRETER)
+}
+
+JSValue Interpreter::retrieveArguments(CallFrame* callFrame, JSFunction* function) const
+{
+ CallFrame* functionCallFrame = findFunctionCallFrame(callFrame, function);
+ if (!functionCallFrame)
+ return jsNull();
+
+ CodeBlock* codeBlock = functionCallFrame->codeBlock();
+ if (codeBlock->usesArguments()) {
+ ASSERT(codeBlock->codeType() == FunctionCode);
+ int argumentsRegister = codeBlock->argumentsRegister();
+ if (!functionCallFrame->r(argumentsRegister).jsValue()) {
+ JSValue arguments = JSValue(new (callFrame) Arguments(functionCallFrame));
+ functionCallFrame->r(argumentsRegister) = arguments;
+ functionCallFrame->r(unmodifiedArgumentsRegister(argumentsRegister)) = arguments;
+ }
+ return functionCallFrame->r(argumentsRegister).jsValue();
+ }
+
+ Arguments* arguments = new (functionCallFrame) Arguments(functionCallFrame);
+ arguments->copyRegisters();
+ return arguments;
+}
+
+JSValue Interpreter::retrieveCaller(CallFrame* callFrame, JSFunction* function) const
+{
+ CallFrame* functionCallFrame = findFunctionCallFrame(callFrame, function);
+ if (!functionCallFrame)
+ return jsNull();
+
+ CallFrame* callerFrame = functionCallFrame->callerFrame();
+ if (callerFrame->hasHostCallFrameFlag())
+ return jsNull();
+
+ JSValue caller = callerFrame->callee();
+ if (!caller)
+ return jsNull();
+
+ return caller;
+}
+
+void Interpreter::retrieveLastCaller(CallFrame* callFrame, int& lineNumber, intptr_t& sourceID, UString& sourceURL, JSValue& function) const
+{
+ function = JSValue();
+ lineNumber = -1;
+ sourceURL = UString();
+
+ CallFrame* callerFrame = callFrame->callerFrame();
+ if (callerFrame->hasHostCallFrameFlag())
+ return;
+
+ CodeBlock* callerCodeBlock = callerFrame->codeBlock();
+ if (!callerCodeBlock)
+ return;
+ unsigned bytecodeOffset = 0;
+#if ENABLE(INTERPRETER)
+ if (!callerFrame->globalData().canUseJIT())
+ bytecodeOffset = callerCodeBlock->bytecodeOffset(callFrame->returnVPC());
+#if ENABLE(JIT)
+ else
+ bytecodeOffset = callerCodeBlock->bytecodeOffset(callFrame->returnPC());
+#endif
+#else
+ bytecodeOffset = callerCodeBlock->bytecodeOffset(callFrame->returnPC());
+#endif
+ lineNumber = callerCodeBlock->lineNumberForBytecodeOffset(bytecodeOffset - 1);
+ sourceID = callerCodeBlock->ownerExecutable()->sourceID();
+ sourceURL = callerCodeBlock->ownerExecutable()->sourceURL();
+ function = callerFrame->callee();
+}
+
+CallFrame* Interpreter::findFunctionCallFrame(CallFrame* callFrame, JSFunction* function)
+{
+ for (CallFrame* candidate = callFrame; candidate; candidate = candidate->callerFrame()->removeHostCallFrameFlag()) {
+ if (candidate->callee() == function)
+ return candidate;
+ }
+ return 0;
+}
+
+void Interpreter::enableSampler()
+{
+#if ENABLE(OPCODE_SAMPLING)
+ if (!m_sampler) {
+ m_sampler.set(new SamplingTool(this));
+ m_sampler->setup();
+ }
+#endif
+}
+void Interpreter::dumpSampleData(ExecState* exec)
+{
+#if ENABLE(OPCODE_SAMPLING)
+ if (m_sampler)
+ m_sampler->dump(exec);
+#else
+ UNUSED_PARAM(exec);
+#endif
+}
+void Interpreter::startSampling()
+{
+#if ENABLE(SAMPLING_THREAD)
+ if (!m_sampleEntryDepth)
+ SamplingThread::start();
+
+ m_sampleEntryDepth++;
+#endif
+}
+void Interpreter::stopSampling()
+{
+#if ENABLE(SAMPLING_THREAD)
+ m_sampleEntryDepth--;
+ if (!m_sampleEntryDepth)
+ SamplingThread::stop();
+#endif
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/interpreter/Interpreter.h b/Source/JavaScriptCore/interpreter/Interpreter.h
new file mode 100644
index 0000000..47790cf
--- /dev/null
+++ b/Source/JavaScriptCore/interpreter/Interpreter.h
@@ -0,0 +1,170 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef Interpreter_h
+#define Interpreter_h
+
+#include "ArgList.h"
+#include "FastAllocBase.h"
+#include "JSCell.h"
+#include "JSValue.h"
+#include "JSObject.h"
+#include "Opcode.h"
+#include "RegisterFile.h"
+
+#include <wtf/HashMap.h>
+
+namespace JSC {
+
+ class CodeBlock;
+ class EvalExecutable;
+ class FunctionExecutable;
+ class JSFunction;
+ class JSGlobalObject;
+ class ProgramExecutable;
+ class Register;
+ class ScopeChainNode;
+ class SamplingTool;
+ struct CallFrameClosure;
+ struct HandlerInfo;
+ struct Instruction;
+
+ enum DebugHookID {
+ WillExecuteProgram,
+ DidExecuteProgram,
+ DidEnterCallFrame,
+ DidReachBreakpoint,
+ WillLeaveCallFrame,
+ WillExecuteStatement
+ };
+
+ enum { MaxLargeThreadReentryDepth = 256, MaxSmallThreadReentryDepth = 32 };
+
+ class Interpreter : public FastAllocBase {
+ friend class JIT;
+ friend class CachedCall;
+ public:
+ Interpreter();
+
+ RegisterFile& registerFile() { return m_registerFile; }
+
+ Opcode getOpcode(OpcodeID id)
+ {
+ #if ENABLE(COMPUTED_GOTO_INTERPRETER)
+ return m_opcodeTable[id];
+ #else
+ return id;
+ #endif
+ }
+
+ OpcodeID getOpcodeID(Opcode opcode)
+ {
+ #if ENABLE(COMPUTED_GOTO_INTERPRETER)
+ ASSERT(isOpcode(opcode));
+ return m_opcodeIDTable.get(opcode);
+ #else
+ return opcode;
+ #endif
+ }
+
+ bool isOpcode(Opcode);
+
+ JSValue execute(ProgramExecutable*, CallFrame*, ScopeChainNode*, JSObject* thisObj);
+ JSValue executeCall(CallFrame*, JSObject* function, CallType, const CallData&, JSValue thisValue, const ArgList&);
+ JSObject* executeConstruct(CallFrame*, JSObject* function, ConstructType, const ConstructData&, const ArgList&);
+ JSValue execute(EvalExecutable* evalNode, CallFrame* exec, JSObject* thisObj, ScopeChainNode* scopeChain);
+
+ JSValue retrieveArguments(CallFrame*, JSFunction*) const;
+ JSValue retrieveCaller(CallFrame*, JSFunction*) const;
+ void retrieveLastCaller(CallFrame*, int& lineNumber, intptr_t& sourceID, UString& sourceURL, JSValue& function) const;
+
+ void getArgumentsData(CallFrame*, JSFunction*&, ptrdiff_t& firstParameterIndex, Register*& argv, int& argc);
+
+ SamplingTool* sampler() { return m_sampler.get(); }
+
+ NEVER_INLINE JSValue callEval(CallFrame*, RegisterFile*, Register* argv, int argc, int registerOffset);
+ NEVER_INLINE HandlerInfo* throwException(CallFrame*&, JSValue&, unsigned bytecodeOffset);
+ NEVER_INLINE void debug(CallFrame*, DebugHookID, int firstLine, int lastLine);
+
+ void dumpSampleData(ExecState* exec);
+ void startSampling();
+ void stopSampling();
+ private:
+ enum ExecutionFlag { Normal, InitializeAndReturn };
+
+ CallFrameClosure prepareForRepeatCall(FunctionExecutable*, CallFrame*, JSFunction*, int argCount, ScopeChainNode*);
+ void endRepeatCall(CallFrameClosure&);
+ JSValue execute(CallFrameClosure&);
+
+ JSValue execute(EvalExecutable*, CallFrame*, JSObject* thisObject, int globalRegisterOffset, ScopeChainNode*);
+
+#if ENABLE(INTERPRETER)
+ NEVER_INLINE bool resolve(CallFrame*, Instruction*, JSValue& exceptionValue);
+ NEVER_INLINE bool resolveSkip(CallFrame*, Instruction*, JSValue& exceptionValue);
+ NEVER_INLINE bool resolveGlobal(CallFrame*, Instruction*, JSValue& exceptionValue);
+ NEVER_INLINE bool resolveGlobalDynamic(CallFrame*, Instruction*, JSValue& exceptionValue);
+ NEVER_INLINE void resolveBase(CallFrame*, Instruction* vPC);
+ NEVER_INLINE bool resolveBaseAndProperty(CallFrame*, Instruction*, JSValue& exceptionValue);
+ NEVER_INLINE ScopeChainNode* createExceptionScope(CallFrame*, const Instruction* vPC);
+
+ void tryCacheGetByID(CallFrame*, CodeBlock*, Instruction*, JSValue baseValue, const Identifier& propertyName, const PropertySlot&);
+ void uncacheGetByID(CodeBlock*, Instruction* vPC);
+ void tryCachePutByID(CallFrame*, CodeBlock*, Instruction*, JSValue baseValue, const PutPropertySlot&);
+ void uncachePutByID(CodeBlock*, Instruction* vPC);
+#endif // ENABLE(INTERPRETER)
+
+ NEVER_INLINE bool unwindCallFrame(CallFrame*&, JSValue, unsigned& bytecodeOffset, CodeBlock*&);
+
+ static ALWAYS_INLINE CallFrame* slideRegisterWindowForCall(CodeBlock*, RegisterFile*, CallFrame*, size_t registerOffset, int argc);
+
+ static CallFrame* findFunctionCallFrame(CallFrame*, JSFunction*);
+
+ JSValue privateExecute(ExecutionFlag, RegisterFile*, CallFrame*);
+
+ void dumpCallFrame(CallFrame*);
+ void dumpRegisters(CallFrame*);
+
+ bool isCallBytecode(Opcode opcode) { return opcode == getOpcode(op_call) || opcode == getOpcode(op_construct) || opcode == getOpcode(op_call_eval); }
+
+ void enableSampler();
+ int m_sampleEntryDepth;
+ OwnPtr<SamplingTool> m_sampler;
+
+ int m_reentryDepth;
+
+ RegisterFile m_registerFile;
+
+#if ENABLE(COMPUTED_GOTO_INTERPRETER)
+ Opcode m_opcodeTable[numOpcodeIDs]; // Maps OpcodeID => Opcode for compiling
+ HashMap<Opcode, OpcodeID> m_opcodeIDTable; // Maps Opcode => OpcodeID for decompiling
+#endif
+ };
+
+} // namespace JSC
+
+#endif // Interpreter_h
diff --git a/Source/JavaScriptCore/interpreter/Register.h b/Source/JavaScriptCore/interpreter/Register.h
new file mode 100644
index 0000000..38d1647
--- /dev/null
+++ b/Source/JavaScriptCore/interpreter/Register.h
@@ -0,0 +1,218 @@
+/*
+ * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef Register_h
+#define Register_h
+
+#include "JSValue.h"
+#include <wtf/Assertions.h>
+#include <wtf/FastAllocBase.h>
+#include <wtf/VectorTraits.h>
+
+namespace JSC {
+
+ class CodeBlock;
+ class ExecState;
+ class JSActivation;
+ class JSObject;
+ class JSPropertyNameIterator;
+ class ScopeChainNode;
+
+ struct Instruction;
+
+ typedef ExecState CallFrame;
+
+ class Register : public WTF::FastAllocBase {
+ public:
+ Register();
+
+ Register(const JSValue&);
+ Register& operator=(const JSValue&);
+ JSValue jsValue() const;
+
+ Register& operator=(JSActivation*);
+ Register& operator=(CallFrame*);
+ Register& operator=(CodeBlock*);
+ Register& operator=(JSPropertyNameIterator*);
+ Register& operator=(ScopeChainNode*);
+ Register& operator=(Instruction*);
+
+ int32_t i() const;
+ JSActivation* activation() const;
+ CallFrame* callFrame() const;
+ CodeBlock* codeBlock() const;
+ JSObject* function() const;
+ JSPropertyNameIterator* propertyNameIterator() const;
+ ScopeChainNode* scopeChain() const;
+ Instruction* vPC() const;
+
+ static Register withInt(int32_t i)
+ {
+ Register r;
+ r.u.i = i;
+ return r;
+ }
+
+ static Register withCallee(JSObject* callee)
+ {
+ Register r;
+ r.u.function = callee;
+ return r;
+ }
+
+ private:
+ union {
+ int32_t i;
+ EncodedJSValue value;
+
+ JSActivation* activation;
+ CallFrame* callFrame;
+ CodeBlock* codeBlock;
+ JSObject* function;
+ JSPropertyNameIterator* propertyNameIterator;
+ ScopeChainNode* scopeChain;
+ Instruction* vPC;
+ } u;
+ };
+
+ ALWAYS_INLINE Register::Register()
+ {
+#ifndef NDEBUG
+ *this = JSValue();
+#endif
+ }
+
+ ALWAYS_INLINE Register::Register(const JSValue& v)
+ {
+#if ENABLE(JSC_ZOMBIES)
+ ASSERT(!v.isZombie());
+#endif
+ u.value = JSValue::encode(v);
+ }
+
+ ALWAYS_INLINE Register& Register::operator=(const JSValue& v)
+ {
+#if ENABLE(JSC_ZOMBIES)
+ ASSERT(!v.isZombie());
+#endif
+ u.value = JSValue::encode(v);
+ return *this;
+ }
+
+ ALWAYS_INLINE JSValue Register::jsValue() const
+ {
+ return JSValue::decode(u.value);
+ }
+
+ // Interpreter functions
+
+ ALWAYS_INLINE Register& Register::operator=(JSActivation* activation)
+ {
+ u.activation = activation;
+ return *this;
+ }
+
+ ALWAYS_INLINE Register& Register::operator=(CallFrame* callFrame)
+ {
+ u.callFrame = callFrame;
+ return *this;
+ }
+
+ ALWAYS_INLINE Register& Register::operator=(CodeBlock* codeBlock)
+ {
+ u.codeBlock = codeBlock;
+ return *this;
+ }
+
+ ALWAYS_INLINE Register& Register::operator=(Instruction* vPC)
+ {
+ u.vPC = vPC;
+ return *this;
+ }
+
+ ALWAYS_INLINE Register& Register::operator=(ScopeChainNode* scopeChain)
+ {
+ u.scopeChain = scopeChain;
+ return *this;
+ }
+
+ ALWAYS_INLINE Register& Register::operator=(JSPropertyNameIterator* propertyNameIterator)
+ {
+ u.propertyNameIterator = propertyNameIterator;
+ return *this;
+ }
+
+ ALWAYS_INLINE int32_t Register::i() const
+ {
+ return u.i;
+ }
+
+ ALWAYS_INLINE JSActivation* Register::activation() const
+ {
+ return u.activation;
+ }
+
+ ALWAYS_INLINE CallFrame* Register::callFrame() const
+ {
+ return u.callFrame;
+ }
+
+ ALWAYS_INLINE CodeBlock* Register::codeBlock() const
+ {
+ return u.codeBlock;
+ }
+
+ ALWAYS_INLINE JSObject* Register::function() const
+ {
+ return u.function;
+ }
+
+ ALWAYS_INLINE JSPropertyNameIterator* Register::propertyNameIterator() const
+ {
+ return u.propertyNameIterator;
+ }
+
+ ALWAYS_INLINE ScopeChainNode* Register::scopeChain() const
+ {
+ return u.scopeChain;
+ }
+
+ ALWAYS_INLINE Instruction* Register::vPC() const
+ {
+ return u.vPC;
+ }
+
+} // namespace JSC
+
+namespace WTF {
+
+ template<> struct VectorTraits<JSC::Register> : VectorTraitsBase<true, JSC::Register> { };
+
+} // namespace WTF
+
+#endif // Register_h
diff --git a/Source/JavaScriptCore/interpreter/RegisterFile.cpp b/Source/JavaScriptCore/interpreter/RegisterFile.cpp
new file mode 100644
index 0000000..4c37676
--- /dev/null
+++ b/Source/JavaScriptCore/interpreter/RegisterFile.cpp
@@ -0,0 +1,93 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "RegisterFile.h"
+
+#include "JSGlobalObject.h"
+
+namespace JSC {
+
+static size_t committedBytesCount = 0;
+
+static Mutex& registerFileStatisticsMutex()
+{
+ DEFINE_STATIC_LOCAL(Mutex, staticMutex, ());
+ return staticMutex;
+}
+
+RegisterFile::~RegisterFile()
+{
+ void* base = m_reservation.base();
+ m_reservation.decommit(base, reinterpret_cast<intptr_t>(m_commitEnd) - reinterpret_cast<intptr_t>(base));
+ addToCommittedByteCount(-(reinterpret_cast<intptr_t>(m_commitEnd) - reinterpret_cast<intptr_t>(base)));
+ m_reservation.deallocate();
+}
+
+void RegisterFile::releaseExcessCapacity()
+{
+ m_reservation.decommit(m_start, reinterpret_cast<intptr_t>(m_commitEnd) - reinterpret_cast<intptr_t>(m_start));
+ addToCommittedByteCount(-(reinterpret_cast<intptr_t>(m_commitEnd) - reinterpret_cast<intptr_t>(m_start)));
+ m_commitEnd = m_start;
+ m_maxUsed = m_start;
+}
+
+void RegisterFile::setGlobalObject(JSGlobalObject* globalObject)
+{
+ m_globalObject = globalObject;
+}
+
+bool RegisterFile::clearGlobalObject(JSGlobalObject* globalObject)
+{
+ return m_globalObject.clear(globalObject);
+}
+
+JSGlobalObject* RegisterFile::globalObject()
+{
+ return m_globalObject.get();
+}
+
+void RegisterFile::initializeThreading()
+{
+ registerFileStatisticsMutex();
+}
+
+size_t RegisterFile::committedByteCount()
+{
+ MutexLocker locker(registerFileStatisticsMutex());
+ return committedBytesCount;
+}
+
+void RegisterFile::addToCommittedByteCount(long byteCount)
+{
+ MutexLocker locker(registerFileStatisticsMutex());
+ ASSERT(static_cast<long>(committedBytesCount) + byteCount > -1);
+ committedBytesCount += byteCount;
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/interpreter/RegisterFile.h b/Source/JavaScriptCore/interpreter/RegisterFile.h
new file mode 100644
index 0000000..51a5bdf
--- /dev/null
+++ b/Source/JavaScriptCore/interpreter/RegisterFile.h
@@ -0,0 +1,211 @@
+/*
+ * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef RegisterFile_h
+#define RegisterFile_h
+
+#include "Collector.h"
+#include "ExecutableAllocator.h"
+#include "Register.h"
+#include "WeakGCPtr.h"
+#include <stdio.h>
+#include <wtf/Noncopyable.h>
+#include <wtf/PageReservation.h>
+#include <wtf/VMTags.h>
+
+namespace JSC {
+
+/*
+ A register file is a stack of register frames. We represent a register
+ frame by its offset from "base", the logical first entry in the register
+ file. The bottom-most register frame's offset from base is 0.
+
+ In a program where function "a" calls function "b" (global code -> a -> b),
+ the register file might look like this:
+
+ | global frame | call frame | call frame | spare capacity |
+ -----------------------------------------------------------------------------------------------------
+ | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | | | | | | <-- index in buffer
+ -----------------------------------------------------------------------------------------------------
+ | -3 | -2 | -1 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | | | | | | <-- index relative to base
+ -----------------------------------------------------------------------------------------------------
+ | <-globals | temps-> | <-vars | temps-> | <-vars |
+ ^ ^ ^ ^
+ | | | |
+ buffer base (frame 0) frame 1 frame 2
+
+ Since all variables, including globals, are accessed by negative offsets
+ from their register frame pointers, to keep old global offsets correct, new
+ globals must appear at the beginning of the register file, shifting base
+ to the right.
+
+ If we added one global variable to the register file depicted above, it
+ would look like this:
+
+ | global frame |< >
+ -------------------------------> <
+ | 0 | 1 | 2 | 3 | 4 | 5 |< >snip< > <-- index in buffer
+ -------------------------------> <
+ | -4 | -3 | -2 | -1 | 0 | 1 |< > <-- index relative to base
+ -------------------------------> <
+ | <-globals | temps-> |
+ ^ ^
+ | |
+ buffer base (frame 0)
+
+ As you can see, global offsets relative to base have stayed constant,
+ but base itself has moved. To keep up with possible changes to base,
+ clients keep an indirect pointer, so their calculations update
+ automatically when base changes.
+
+ For client simplicity, the RegisterFile measures size and capacity from
+ "base", not "buffer".
+*/
+
+ class JSGlobalObject;
+
+ class RegisterFile : public Noncopyable {
+ friend class JIT;
+ public:
+ enum CallFrameHeaderEntry {
+ CallFrameHeaderSize = 6,
+
+ ArgumentCount = -6,
+ CallerFrame = -5,
+ Callee = -4,
+ ScopeChain = -3,
+ ReturnPC = -2, // This is either an Instruction* or a pointer into JIT generated code stored as an Instruction*.
+ CodeBlock = -1,
+ };
+
+ enum { ProgramCodeThisRegister = -CallFrameHeaderSize - 1 };
+
+ static const size_t defaultCapacity = 512 * 1024;
+ static const size_t defaultMaxGlobals = 8 * 1024;
+ static const size_t commitSize = 16 * 1024;
+ // Allow 8k of excess registers before we start trying to reap the registerfile
+ static const ptrdiff_t maxExcessCapacity = 8 * 1024;
+
+ RegisterFile(size_t capacity = defaultCapacity, size_t maxGlobals = defaultMaxGlobals);
+ ~RegisterFile();
+
+ Register* start() const { return m_start; }
+ Register* end() const { return m_end; }
+ size_t size() const { return m_end - m_start; }
+
+ void setGlobalObject(JSGlobalObject*);
+ bool clearGlobalObject(JSGlobalObject*);
+ JSGlobalObject* globalObject();
+
+ bool grow(Register* newEnd);
+ void shrink(Register* newEnd);
+
+ void setNumGlobals(size_t numGlobals) { m_numGlobals = numGlobals; }
+ int numGlobals() const { return m_numGlobals; }
+ size_t maxGlobals() const { return m_maxGlobals; }
+
+ Register* lastGlobal() const { return m_start - m_numGlobals; }
+
+ void markGlobals(MarkStack& markStack, Heap* heap) { heap->markConservatively(markStack, lastGlobal(), m_start); }
+ void markCallFrames(MarkStack& markStack, Heap* heap) { heap->markConservatively(markStack, m_start, m_end); }
+
+ static size_t committedByteCount();
+ static void initializeThreading();
+
+ private:
+ void releaseExcessCapacity();
+ void addToCommittedByteCount(long);
+ size_t m_numGlobals;
+ const size_t m_maxGlobals;
+ Register* m_start;
+ Register* m_end;
+ Register* m_max;
+ Register* m_maxUsed;
+ Register* m_commitEnd;
+ PageReservation m_reservation;
+
+ WeakGCPtr<JSGlobalObject> m_globalObject; // The global object whose vars are currently stored in the register file.
+ };
+
+ inline RegisterFile::RegisterFile(size_t capacity, size_t maxGlobals)
+ : m_numGlobals(0)
+ , m_maxGlobals(maxGlobals)
+ , m_start(0)
+ , m_end(0)
+ , m_max(0)
+ {
+ ASSERT(maxGlobals && isPageAligned(maxGlobals));
+ ASSERT(capacity && isPageAligned(capacity));
+
+ size_t bufferLength = (capacity + maxGlobals) * sizeof(Register);
+ m_reservation = PageReservation::reserve(roundUpAllocationSize(bufferLength, commitSize), OSAllocator::JSVMStackPages);
+ void* base = m_reservation.base();
+ size_t committedSize = roundUpAllocationSize(maxGlobals * sizeof(Register), commitSize);
+ m_reservation.commit(base, committedSize);
+ addToCommittedByteCount(static_cast<long>(committedSize));
+ m_commitEnd = reinterpret_cast_ptr<Register*>(reinterpret_cast<char*>(base) + committedSize);
+ m_start = static_cast<Register*>(base) + maxGlobals;
+ m_end = m_start;
+ m_maxUsed = m_end;
+ m_max = m_start + capacity;
+ }
+
+ inline void RegisterFile::shrink(Register* newEnd)
+ {
+ if (newEnd >= m_end)
+ return;
+ m_end = newEnd;
+ if (m_end == m_start && (m_maxUsed - m_start) > maxExcessCapacity)
+ releaseExcessCapacity();
+ }
+
+ inline bool RegisterFile::grow(Register* newEnd)
+ {
+ if (newEnd < m_end)
+ return true;
+
+ if (newEnd > m_max)
+ return false;
+
+ if (newEnd > m_commitEnd) {
+ size_t size = roundUpAllocationSize(reinterpret_cast<char*>(newEnd) - reinterpret_cast<char*>(m_commitEnd), commitSize);
+ m_reservation.commit(m_commitEnd, size);
+ addToCommittedByteCount(static_cast<long>(size));
+ m_commitEnd = reinterpret_cast_ptr<Register*>(reinterpret_cast<char*>(m_commitEnd) + size);
+ }
+
+ if (newEnd > m_maxUsed)
+ m_maxUsed = newEnd;
+
+ m_end = newEnd;
+ return true;
+ }
+
+} // namespace JSC
+
+#endif // RegisterFile_h
diff --git a/Source/JavaScriptCore/jit/ExecutableAllocator.cpp b/Source/JavaScriptCore/jit/ExecutableAllocator.cpp
new file mode 100644
index 0000000..4530b38
--- /dev/null
+++ b/Source/JavaScriptCore/jit/ExecutableAllocator.cpp
@@ -0,0 +1,128 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#include "ExecutableAllocator.h"
+
+#if ENABLE(ASSEMBLER)
+
+namespace JSC {
+
+size_t ExecutableAllocator::pageSize = 0;
+
+#if ENABLE(EXECUTABLE_ALLOCATOR_DEMAND)
+
+void ExecutableAllocator::intializePageSize()
+{
+#if CPU(ARMV5_OR_LOWER)
+ // The moving memory model (as used in ARMv5 and earlier platforms)
+ // on Symbian OS limits the number of chunks for each process to 16.
+ // To mitigate this limitation increase the pagesize to allocate
+ // fewer, larger chunks. Set the page size to 256 Kb to compensate
+ // for moving memory model limitation
+ ExecutableAllocator::pageSize = 256 * 1024;
+#else
+ ExecutableAllocator::pageSize = WTF::pageSize();
+#endif
+}
+
+ExecutablePool::Allocation ExecutablePool::systemAlloc(size_t size)
+{
+ PageAllocation allocation = PageAllocation::allocate(size, OSAllocator::JSJITCodePages, EXECUTABLE_POOL_WRITABLE, true);
+ if (!allocation)
+ CRASH();
+ return allocation;
+}
+
+void ExecutablePool::systemRelease(ExecutablePool::Allocation& allocation)
+{
+ allocation.deallocate();
+}
+
+bool ExecutableAllocator::isValid() const
+{
+ return true;
+}
+
+bool ExecutableAllocator::underMemoryPressure()
+{
+ return false;
+}
+
+size_t ExecutableAllocator::committedByteCount()
+{
+ return 0;
+}
+
+#endif
+
+#if ENABLE(ASSEMBLER_WX_EXCLUSIVE)
+
+#if OS(WINDOWS) || OS(SYMBIAN)
+#error "ASSEMBLER_WX_EXCLUSIVE not yet suported on this platform."
+#endif
+
+void ExecutableAllocator::reprotectRegion(void* start, size_t size, ProtectionSeting setting)
+{
+ if (!pageSize)
+ intializePageSize();
+
+ // Calculate the start of the page containing this region,
+ // and account for this extra memory within size.
+ intptr_t startPtr = reinterpret_cast<intptr_t>(start);
+ intptr_t pageStartPtr = startPtr & ~(pageSize - 1);
+ void* pageStart = reinterpret_cast<void*>(pageStartPtr);
+ size += (startPtr - pageStartPtr);
+
+ // Round size up
+ size += (pageSize - 1);
+ size &= ~(pageSize - 1);
+
+ mprotect(pageStart, size, (setting == Writable) ? PROTECTION_FLAGS_RW : PROTECTION_FLAGS_RX);
+}
+
+#endif
+
+#if CPU(ARM_TRADITIONAL) && OS(LINUX) && COMPILER(RVCT)
+
+__asm void ExecutableAllocator::cacheFlush(void* code, size_t size)
+{
+ ARM
+ push {r7}
+ add r1, r1, r0
+ mov r7, #0xf0000
+ add r7, r7, #0x2
+ mov r2, #0x0
+ svc #0x0
+ pop {r7}
+ bx lr
+}
+
+#endif
+
+}
+
+#endif // HAVE(ASSEMBLER)
diff --git a/Source/JavaScriptCore/jit/ExecutableAllocator.h b/Source/JavaScriptCore/jit/ExecutableAllocator.h
new file mode 100644
index 0000000..d45f294
--- /dev/null
+++ b/Source/JavaScriptCore/jit/ExecutableAllocator.h
@@ -0,0 +1,362 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ExecutableAllocator_h
+#define ExecutableAllocator_h
+#include <stddef.h> // for ptrdiff_t
+#include <limits>
+#include <wtf/Assertions.h>
+#include <wtf/PageAllocation.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/UnusedParam.h>
+#include <wtf/Vector.h>
+
+#if OS(IOS)
+#include <libkern/OSCacheControl.h>
+#include <sys/mman.h>
+#endif
+
+#if OS(SYMBIAN)
+#include <e32std.h>
+#endif
+
+#if CPU(MIPS) && OS(LINUX)
+#include <sys/cachectl.h>
+#endif
+
+#if OS(WINCE)
+// From pkfuncs.h (private header file from the Platform Builder)
+#define CACHE_SYNC_ALL 0x07F
+extern "C" __declspec(dllimport) void CacheRangeFlush(LPVOID pAddr, DWORD dwLength, DWORD dwFlags);
+#endif
+
+#if PLATFORM(BREWMP)
+#include <AEEIMemCache1.h>
+#include <AEEMemCache1.bid>
+#include <wtf/brew/RefPtrBrew.h>
+#endif
+
+#define JIT_ALLOCATOR_PAGE_SIZE (ExecutableAllocator::pageSize)
+#define JIT_ALLOCATOR_LARGE_ALLOC_SIZE (ExecutableAllocator::pageSize * 4)
+
+#if ENABLE(ASSEMBLER_WX_EXCLUSIVE)
+#define PROTECTION_FLAGS_RW (PROT_READ | PROT_WRITE)
+#define PROTECTION_FLAGS_RX (PROT_READ | PROT_EXEC)
+#define EXECUTABLE_POOL_WRITABLE false
+#else
+#define EXECUTABLE_POOL_WRITABLE true
+#endif
+
+namespace JSC {
+
+inline size_t roundUpAllocationSize(size_t request, size_t granularity)
+{
+ if ((std::numeric_limits<size_t>::max() - granularity) <= request)
+ CRASH(); // Allocation is too large
+
+ // Round up to next page boundary
+ size_t size = request + (granularity - 1);
+ size = size & ~(granularity - 1);
+ ASSERT(size >= request);
+ return size;
+}
+
+}
+
+#if ENABLE(JIT) && ENABLE(ASSEMBLER)
+
+namespace JSC {
+
+class ExecutablePool : public RefCounted<ExecutablePool> {
+public:
+#if ENABLE(EXECUTABLE_ALLOCATOR_DEMAND)
+ typedef PageAllocation Allocation;
+#else
+ class Allocation {
+ public:
+ Allocation(void* base, size_t size)
+ : m_base(base)
+ , m_size(size)
+ {
+ }
+ void* base() { return m_base; }
+ size_t size() { return m_size; }
+ bool operator!() const { return !m_base; }
+
+ private:
+ void* m_base;
+ size_t m_size;
+ };
+#endif
+ typedef Vector<Allocation, 2> AllocationList;
+
+ static PassRefPtr<ExecutablePool> create(size_t n)
+ {
+ return adoptRef(new ExecutablePool(n));
+ }
+
+ void* alloc(size_t n)
+ {
+ ASSERT(m_freePtr <= m_end);
+
+ // Round 'n' up to a multiple of word size; if all allocations are of
+ // word sized quantities, then all subsequent allocations will be aligned.
+ n = roundUpAllocationSize(n, sizeof(void*));
+
+ if (static_cast<ptrdiff_t>(n) < (m_end - m_freePtr)) {
+ void* result = m_freePtr;
+ m_freePtr += n;
+ return result;
+ }
+
+ // Insufficient space to allocate in the existing pool
+ // so we need allocate into a new pool
+ return poolAllocate(n);
+ }
+
+ void tryShrink(void* allocation, size_t oldSize, size_t newSize)
+ {
+ if (static_cast<char*>(allocation) + oldSize != m_freePtr)
+ return;
+ m_freePtr = static_cast<char*>(allocation) + roundUpAllocationSize(newSize, sizeof(void*));
+ }
+
+ ~ExecutablePool()
+ {
+ AllocationList::iterator end = m_pools.end();
+ for (AllocationList::iterator ptr = m_pools.begin(); ptr != end; ++ptr)
+ ExecutablePool::systemRelease(*ptr);
+ }
+
+ size_t available() const { return (m_pools.size() > 1) ? 0 : m_end - m_freePtr; }
+
+private:
+ static Allocation systemAlloc(size_t n);
+ static void systemRelease(Allocation& alloc);
+
+ ExecutablePool(size_t n);
+
+ void* poolAllocate(size_t n);
+
+ char* m_freePtr;
+ char* m_end;
+ AllocationList m_pools;
+};
+
+class ExecutableAllocator {
+ enum ProtectionSeting { Writable, Executable };
+
+public:
+ static size_t pageSize;
+ ExecutableAllocator()
+ {
+ if (!pageSize)
+ intializePageSize();
+ if (isValid())
+ m_smallAllocationPool = ExecutablePool::create(JIT_ALLOCATOR_LARGE_ALLOC_SIZE);
+#if !ENABLE(INTERPRETER)
+ else
+ CRASH();
+#endif
+ }
+
+ bool isValid() const;
+
+ static bool underMemoryPressure();
+
+ PassRefPtr<ExecutablePool> poolForSize(size_t n)
+ {
+ // Try to fit in the existing small allocator
+ ASSERT(m_smallAllocationPool);
+ if (n < m_smallAllocationPool->available())
+ return m_smallAllocationPool;
+
+ // If the request is large, we just provide a unshared allocator
+ if (n > JIT_ALLOCATOR_LARGE_ALLOC_SIZE)
+ return ExecutablePool::create(n);
+
+ // Create a new allocator
+ RefPtr<ExecutablePool> pool = ExecutablePool::create(JIT_ALLOCATOR_LARGE_ALLOC_SIZE);
+
+ // If the new allocator will result in more free space than in
+ // the current small allocator, then we will use it instead
+ if ((pool->available() - n) > m_smallAllocationPool->available())
+ m_smallAllocationPool = pool;
+ return pool.release();
+ }
+
+#if ENABLE(ASSEMBLER_WX_EXCLUSIVE)
+ static void makeWritable(void* start, size_t size)
+ {
+ reprotectRegion(start, size, Writable);
+ }
+
+ static void makeExecutable(void* start, size_t size)
+ {
+ reprotectRegion(start, size, Executable);
+ }
+#else
+ static void makeWritable(void*, size_t) {}
+ static void makeExecutable(void*, size_t) {}
+#endif
+
+
+#if CPU(X86) || CPU(X86_64)
+ static void cacheFlush(void*, size_t)
+ {
+ }
+#elif CPU(MIPS)
+ static void cacheFlush(void* code, size_t size)
+ {
+#if COMPILER(GCC) && GCC_VERSION_AT_LEAST(4,3,0)
+#if WTF_MIPS_ISA_REV(2) && !GCC_VERSION_AT_LEAST(4,4,3)
+ int lineSize;
+ asm("rdhwr %0, $1" : "=r" (lineSize));
+ //
+ // Modify "start" and "end" to avoid GCC 4.3.0-4.4.2 bug in
+ // mips_expand_synci_loop that may execute synci one more time.
+ // "start" points to the fisrt byte of the cache line.
+ // "end" points to the last byte of the line before the last cache line.
+ // Because size is always a multiple of 4, this is safe to set
+ // "end" to the last byte.
+ //
+ intptr_t start = reinterpret_cast<intptr_t>(code) & (-lineSize);
+ intptr_t end = ((reinterpret_cast<intptr_t>(code) + size - 1) & (-lineSize)) - 1;
+ __builtin___clear_cache(reinterpret_cast<char*>(start), reinterpret_cast<char*>(end));
+#else
+ intptr_t end = reinterpret_cast<intptr_t>(code) + size;
+ __builtin___clear_cache(reinterpret_cast<char*>(code), reinterpret_cast<char*>(end));
+#endif
+#else
+ _flush_cache(reinterpret_cast<char*>(code), size, BCACHE);
+#endif
+ }
+#elif CPU(ARM_THUMB2) && OS(IOS)
+ static void cacheFlush(void* code, size_t size)
+ {
+ sys_cache_control(kCacheFunctionPrepareForExecution, code, size);
+ }
+#elif CPU(ARM_THUMB2) && OS(LINUX)
+ static void cacheFlush(void* code, size_t size)
+ {
+ asm volatile (
+ "push {r7}\n"
+ "mov r0, %0\n"
+ "mov r1, %1\n"
+ "movw r7, #0x2\n"
+ "movt r7, #0xf\n"
+ "movs r2, #0x0\n"
+ "svc 0x0\n"
+ "pop {r7}\n"
+ :
+ : "r" (code), "r" (reinterpret_cast<char*>(code) + size)
+ : "r0", "r1", "r2");
+ }
+#elif OS(SYMBIAN)
+ static void cacheFlush(void* code, size_t size)
+ {
+ User::IMB_Range(code, static_cast<char*>(code) + size);
+ }
+#elif CPU(ARM_TRADITIONAL) && OS(LINUX) && COMPILER(RVCT)
+ static __asm void cacheFlush(void* code, size_t size);
+#elif CPU(ARM_TRADITIONAL) && OS(LINUX) && COMPILER(GCC)
+ static void cacheFlush(void* code, size_t size)
+ {
+ asm volatile (
+ "push {r7}\n"
+ "mov r0, %0\n"
+ "mov r1, %1\n"
+ "mov r7, #0xf0000\n"
+ "add r7, r7, #0x2\n"
+ "mov r2, #0x0\n"
+ "svc 0x0\n"
+ "pop {r7}\n"
+ :
+ : "r" (code), "r" (reinterpret_cast<char*>(code) + size)
+ : "r0", "r1", "r2");
+ }
+#elif OS(WINCE)
+ static void cacheFlush(void* code, size_t size)
+ {
+ CacheRangeFlush(code, size, CACHE_SYNC_ALL);
+ }
+#elif PLATFORM(BREWMP)
+ static void cacheFlush(void* code, size_t size)
+ {
+ RefPtr<IMemCache1> memCache = createRefPtrInstance<IMemCache1>(AEECLSID_MemCache1);
+ IMemCache1_ClearCache(memCache.get(), reinterpret_cast<uint32>(code), size, MEMSPACE_CACHE_FLUSH, MEMSPACE_DATACACHE);
+ IMemCache1_ClearCache(memCache.get(), reinterpret_cast<uint32>(code), size, MEMSPACE_CACHE_INVALIDATE, MEMSPACE_INSTCACHE);
+ }
+#else
+ #error "The cacheFlush support is missing on this platform."
+#endif
+ static size_t committedByteCount();
+
+private:
+
+#if ENABLE(ASSEMBLER_WX_EXCLUSIVE)
+ static void reprotectRegion(void*, size_t, ProtectionSeting);
+#endif
+
+ RefPtr<ExecutablePool> m_smallAllocationPool;
+ static void intializePageSize();
+};
+
+inline ExecutablePool::ExecutablePool(size_t n)
+{
+ size_t allocSize = roundUpAllocationSize(n, JIT_ALLOCATOR_PAGE_SIZE);
+ Allocation mem = systemAlloc(allocSize);
+ m_pools.append(mem);
+ m_freePtr = static_cast<char*>(mem.base());
+ if (!m_freePtr)
+ CRASH(); // Failed to allocate
+ m_end = m_freePtr + allocSize;
+}
+
+inline void* ExecutablePool::poolAllocate(size_t n)
+{
+ size_t allocSize = roundUpAllocationSize(n, JIT_ALLOCATOR_PAGE_SIZE);
+
+ Allocation result = systemAlloc(allocSize);
+ if (!result.base())
+ CRASH(); // Failed to allocate
+
+ ASSERT(m_end >= m_freePtr);
+ if ((allocSize - n) > static_cast<size_t>(m_end - m_freePtr)) {
+ // Replace allocation pool
+ m_freePtr = static_cast<char*>(result.base()) + n;
+ m_end = static_cast<char*>(result.base()) + allocSize;
+ }
+
+ m_pools.append(result);
+ return result.base();
+}
+
+}
+
+#endif // ENABLE(JIT) && ENABLE(ASSEMBLER)
+
+#endif // !defined(ExecutableAllocator)
diff --git a/Source/JavaScriptCore/jit/ExecutableAllocatorFixedVMPool.cpp b/Source/JavaScriptCore/jit/ExecutableAllocatorFixedVMPool.cpp
new file mode 100644
index 0000000..e280b2d
--- /dev/null
+++ b/Source/JavaScriptCore/jit/ExecutableAllocatorFixedVMPool.cpp
@@ -0,0 +1,470 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#include "ExecutableAllocator.h"
+
+#if ENABLE(EXECUTABLE_ALLOCATOR_FIXED)
+
+#include <errno.h>
+
+#include "TCSpinLock.h"
+#include <sys/mman.h>
+#include <unistd.h>
+#include <wtf/AVLTree.h>
+#include <wtf/PageReservation.h>
+#include <wtf/VMTags.h>
+
+#if CPU(X86_64)
+ // These limits suitable on 64-bit platforms (particularly x86-64, where we require all jumps to have a 2Gb max range).
+ #define VM_POOL_SIZE (2u * 1024u * 1024u * 1024u) // 2Gb
+ #define COALESCE_LIMIT (16u * 1024u * 1024u) // 16Mb
+#else
+ // These limits are hopefully sensible on embedded platforms.
+ #define VM_POOL_SIZE (32u * 1024u * 1024u) // 32Mb
+ #define COALESCE_LIMIT (4u * 1024u * 1024u) // 4Mb
+#endif
+
+using namespace WTF;
+
+namespace JSC {
+
+static size_t committedBytesCount = 0;
+static SpinLock spinlock = SPINLOCK_INITIALIZER;
+
+// FreeListEntry describes a free chunk of memory, stored in the freeList.
+struct FreeListEntry {
+ FreeListEntry(void* pointer, size_t size)
+ : pointer(pointer)
+ , size(size)
+ , nextEntry(0)
+ , less(0)
+ , greater(0)
+ , balanceFactor(0)
+ {
+ }
+
+ // All entries of the same size share a single entry
+ // in the AVLTree, and are linked together in a linked
+ // list, using nextEntry.
+ void* pointer;
+ size_t size;
+ FreeListEntry* nextEntry;
+
+ // These fields are used by AVLTree.
+ FreeListEntry* less;
+ FreeListEntry* greater;
+ int balanceFactor;
+};
+
+// Abstractor class for use in AVLTree.
+// Nodes in the AVLTree are of type FreeListEntry, keyed on
+// (and thus sorted by) their size.
+struct AVLTreeAbstractorForFreeList {
+ typedef FreeListEntry* handle;
+ typedef int32_t size;
+ typedef size_t key;
+
+ handle get_less(handle h) { return h->less; }
+ void set_less(handle h, handle lh) { h->less = lh; }
+ handle get_greater(handle h) { return h->greater; }
+ void set_greater(handle h, handle gh) { h->greater = gh; }
+ int get_balance_factor(handle h) { return h->balanceFactor; }
+ void set_balance_factor(handle h, int bf) { h->balanceFactor = bf; }
+
+ static handle null() { return 0; }
+
+ int compare_key_key(key va, key vb) { return va - vb; }
+ int compare_key_node(key k, handle h) { return compare_key_key(k, h->size); }
+ int compare_node_node(handle h1, handle h2) { return compare_key_key(h1->size, h2->size); }
+};
+
+// Used to reverse sort an array of FreeListEntry pointers.
+static int reverseSortFreeListEntriesByPointer(const void* leftPtr, const void* rightPtr)
+{
+ FreeListEntry* left = *(FreeListEntry**)leftPtr;
+ FreeListEntry* right = *(FreeListEntry**)rightPtr;
+
+ return (intptr_t)(right->pointer) - (intptr_t)(left->pointer);
+}
+
+// Used to reverse sort an array of pointers.
+static int reverseSortCommonSizedAllocations(const void* leftPtr, const void* rightPtr)
+{
+ void* left = *(void**)leftPtr;
+ void* right = *(void**)rightPtr;
+
+ return (intptr_t)right - (intptr_t)left;
+}
+
+class FixedVMPoolAllocator
+{
+ // The free list is stored in a sorted tree.
+ typedef AVLTree<AVLTreeAbstractorForFreeList, 40> SizeSortedFreeTree;
+
+ void release(void* position, size_t size)
+ {
+ m_allocation.decommit(position, size);
+ addToCommittedByteCount(-static_cast<long>(size));
+ }
+
+ void reuse(void* position, size_t size)
+ {
+ m_allocation.commit(position, size);
+ addToCommittedByteCount(static_cast<long>(size));
+ }
+
+ // All addition to the free list should go through this method, rather than
+ // calling insert directly, to avoid multiple entries being added with the
+ // same key. All nodes being added should be singletons, they should not
+ // already be a part of a chain.
+ void addToFreeList(FreeListEntry* entry)
+ {
+ ASSERT(!entry->nextEntry);
+
+ if (entry->size == m_commonSize) {
+ m_commonSizedAllocations.append(entry->pointer);
+ delete entry;
+ } else if (FreeListEntry* entryInFreeList = m_freeList.search(entry->size, m_freeList.EQUAL)) {
+ // m_freeList already contain an entry for this size - insert this node into the chain.
+ entry->nextEntry = entryInFreeList->nextEntry;
+ entryInFreeList->nextEntry = entry;
+ } else
+ m_freeList.insert(entry);
+ }
+
+ // We do not attempt to coalesce addition, which may lead to fragmentation;
+ // instead we periodically perform a sweep to try to coalesce neighboring
+ // entries in m_freeList. Presently this is triggered at the point 16MB
+ // of memory has been released.
+ void coalesceFreeSpace()
+ {
+ Vector<FreeListEntry*> freeListEntries;
+ SizeSortedFreeTree::Iterator iter;
+ iter.start_iter_least(m_freeList);
+
+ // Empty m_freeList into a Vector.
+ for (FreeListEntry* entry; (entry = *iter); ++iter) {
+ // Each entry in m_freeList might correspond to multiple
+ // free chunks of memory (of the same size). Walk the chain
+ // (this is likely of course only be one entry long!) adding
+ // each entry to the Vector (at reseting the next in chain
+ // pointer to separate each node out).
+ FreeListEntry* next;
+ do {
+ next = entry->nextEntry;
+ entry->nextEntry = 0;
+ freeListEntries.append(entry);
+ } while ((entry = next));
+ }
+ // All entries are now in the Vector; purge the tree.
+ m_freeList.purge();
+
+ // Reverse-sort the freeListEntries and m_commonSizedAllocations Vectors.
+ // We reverse-sort so that we can logically work forwards through memory,
+ // whilst popping items off the end of the Vectors using last() and removeLast().
+ qsort(freeListEntries.begin(), freeListEntries.size(), sizeof(FreeListEntry*), reverseSortFreeListEntriesByPointer);
+ qsort(m_commonSizedAllocations.begin(), m_commonSizedAllocations.size(), sizeof(void*), reverseSortCommonSizedAllocations);
+
+ // The entries from m_commonSizedAllocations that cannot be
+ // coalesced into larger chunks will be temporarily stored here.
+ Vector<void*> newCommonSizedAllocations;
+
+ // Keep processing so long as entries remain in either of the vectors.
+ while (freeListEntries.size() || m_commonSizedAllocations.size()) {
+ // We're going to try to find a FreeListEntry node that we can coalesce onto.
+ FreeListEntry* coalescionEntry = 0;
+
+ // Is the lowest addressed chunk of free memory of common-size, or is it in the free list?
+ if (m_commonSizedAllocations.size() && (!freeListEntries.size() || (m_commonSizedAllocations.last() < freeListEntries.last()->pointer))) {
+ // Pop an item from the m_commonSizedAllocations vector - this is the lowest
+ // addressed free chunk. Find out the begin and end addresses of the memory chunk.
+ void* begin = m_commonSizedAllocations.last();
+ void* end = (void*)((intptr_t)begin + m_commonSize);
+ m_commonSizedAllocations.removeLast();
+
+ // Try to find another free chunk abutting onto the end of the one we have already found.
+ if (freeListEntries.size() && (freeListEntries.last()->pointer == end)) {
+ // There is an existing FreeListEntry for the next chunk of memory!
+ // we can reuse this. Pop it off the end of m_freeList.
+ coalescionEntry = freeListEntries.last();
+ freeListEntries.removeLast();
+ // Update the existing node to include the common-sized chunk that we also found.
+ coalescionEntry->pointer = (void*)((intptr_t)coalescionEntry->pointer - m_commonSize);
+ coalescionEntry->size += m_commonSize;
+ } else if (m_commonSizedAllocations.size() && (m_commonSizedAllocations.last() == end)) {
+ // There is a second common-sized chunk that can be coalesced.
+ // Allocate a new node.
+ m_commonSizedAllocations.removeLast();
+ coalescionEntry = new FreeListEntry(begin, 2 * m_commonSize);
+ } else {
+ // Nope - this poor little guy is all on his own. :-(
+ // Add him into the newCommonSizedAllocations vector for now, we're
+ // going to end up adding him back into the m_commonSizedAllocations
+ // list when we're done.
+ newCommonSizedAllocations.append(begin);
+ continue;
+ }
+ } else {
+ ASSERT(freeListEntries.size());
+ ASSERT(!m_commonSizedAllocations.size() || (freeListEntries.last()->pointer < m_commonSizedAllocations.last()));
+ // The lowest addressed item is from m_freeList; pop it from the Vector.
+ coalescionEntry = freeListEntries.last();
+ freeListEntries.removeLast();
+ }
+
+ // Right, we have a FreeListEntry, we just need check if there is anything else
+ // to coalesce onto the end.
+ ASSERT(coalescionEntry);
+ while (true) {
+ // Calculate the end address of the chunk we have found so far.
+ void* end = (void*)((intptr_t)coalescionEntry->pointer - coalescionEntry->size);
+
+ // Is there another chunk adjacent to the one we already have?
+ if (freeListEntries.size() && (freeListEntries.last()->pointer == end)) {
+ // Yes - another FreeListEntry -pop it from the list.
+ FreeListEntry* coalescee = freeListEntries.last();
+ freeListEntries.removeLast();
+ // Add it's size onto our existing node.
+ coalescionEntry->size += coalescee->size;
+ delete coalescee;
+ } else if (m_commonSizedAllocations.size() && (m_commonSizedAllocations.last() == end)) {
+ // We can coalesce the next common-sized chunk.
+ m_commonSizedAllocations.removeLast();
+ coalescionEntry->size += m_commonSize;
+ } else
+ break; // Nope, nothing to be added - stop here.
+ }
+
+ // We've coalesced everything we can onto the current chunk.
+ // Add it back into m_freeList.
+ addToFreeList(coalescionEntry);
+ }
+
+ // All chunks of free memory larger than m_commonSize should be
+ // back in m_freeList by now. All that remains to be done is to
+ // copy the contents on the newCommonSizedAllocations back into
+ // the m_commonSizedAllocations Vector.
+ ASSERT(m_commonSizedAllocations.size() == 0);
+ m_commonSizedAllocations.append(newCommonSizedAllocations);
+ }
+
+public:
+
+ FixedVMPoolAllocator(size_t commonSize, size_t totalHeapSize)
+ : m_commonSize(commonSize)
+ , m_countFreedSinceLastCoalesce(0)
+ {
+ m_allocation = PageReservation::reserve(totalHeapSize, OSAllocator::JSJITCodePages, EXECUTABLE_POOL_WRITABLE, true);
+
+ if (!!m_allocation)
+ m_freeList.insert(new FreeListEntry(m_allocation.base(), m_allocation.size()));
+#if !ENABLE(INTERPRETER)
+ else
+ CRASH();
+#endif
+ }
+
+ ExecutablePool::Allocation alloc(size_t size)
+ {
+ return ExecutablePool::Allocation(allocInternal(size), size);
+ }
+
+ void free(ExecutablePool::Allocation allocation)
+ {
+ void* pointer = allocation.base();
+ size_t size = allocation.size();
+
+ ASSERT(!!m_allocation);
+ // Call release to report to the operating system that this
+ // memory is no longer in use, and need not be paged out.
+ ASSERT(isWithinVMPool(pointer, size));
+ release(pointer, size);
+
+ // Common-sized allocations are stored in the m_commonSizedAllocations
+ // vector; all other freed chunks are added to m_freeList.
+ if (size == m_commonSize)
+ m_commonSizedAllocations.append(pointer);
+ else
+ addToFreeList(new FreeListEntry(pointer, size));
+
+ // Do some housekeeping. Every time we reach a point that
+ // 16MB of allocations have been freed, sweep m_freeList
+ // coalescing any neighboring fragments.
+ m_countFreedSinceLastCoalesce += size;
+ if (m_countFreedSinceLastCoalesce >= COALESCE_LIMIT) {
+ m_countFreedSinceLastCoalesce = 0;
+ coalesceFreeSpace();
+ }
+ }
+
+ bool isValid() const { return !!m_allocation; }
+
+private:
+ void* allocInternal(size_t size)
+ {
+#if ENABLE(INTERPRETER)
+ if (!m_allocation)
+ return 0;
+#else
+ ASSERT(!!m_allocation);
+#endif
+ void* result;
+
+ // Freed allocations of the common size are not stored back into the main
+ // m_freeList, but are instead stored in a separate vector. If the request
+ // is for a common sized allocation, check this list.
+ if ((size == m_commonSize) && m_commonSizedAllocations.size()) {
+ result = m_commonSizedAllocations.last();
+ m_commonSizedAllocations.removeLast();
+ } else {
+ // Search m_freeList for a suitable sized chunk to allocate memory from.
+ FreeListEntry* entry = m_freeList.search(size, m_freeList.GREATER_EQUAL);
+
+ // This would be bad news.
+ if (!entry) {
+ // Errk! Lets take a last-ditch desperation attempt at defragmentation...
+ coalesceFreeSpace();
+ // Did that free up a large enough chunk?
+ entry = m_freeList.search(size, m_freeList.GREATER_EQUAL);
+ // No?... *BOOM!*
+ if (!entry)
+ CRASH();
+ }
+ ASSERT(entry->size != m_commonSize);
+
+ // Remove the entry from m_freeList. But! -
+ // Each entry in the tree may represent a chain of multiple chunks of the
+ // same size, and we only want to remove one on them. So, if this entry
+ // does have a chain, just remove the first-but-one item from the chain.
+ if (FreeListEntry* next = entry->nextEntry) {
+ // We're going to leave 'entry' in the tree; remove 'next' from its chain.
+ entry->nextEntry = next->nextEntry;
+ next->nextEntry = 0;
+ entry = next;
+ } else
+ m_freeList.remove(entry->size);
+
+ // Whoo!, we have a result!
+ ASSERT(entry->size >= size);
+ result = entry->pointer;
+
+ // If the allocation exactly fits the chunk we found in the,
+ // m_freeList then the FreeListEntry node is no longer needed.
+ if (entry->size == size)
+ delete entry;
+ else {
+ // There is memory left over, and it is not of the common size.
+ // We can reuse the existing FreeListEntry node to add this back
+ // into m_freeList.
+ entry->pointer = (void*)((intptr_t)entry->pointer + size);
+ entry->size -= size;
+ addToFreeList(entry);
+ }
+ }
+
+ // Call reuse to report to the operating system that this memory is in use.
+ ASSERT(isWithinVMPool(result, size));
+ reuse(result, size);
+ return result;
+ }
+
+#ifndef NDEBUG
+ bool isWithinVMPool(void* pointer, size_t size)
+ {
+ return pointer >= m_allocation.base() && (reinterpret_cast<char*>(pointer) + size <= reinterpret_cast<char*>(m_allocation.base()) + m_allocation.size());
+ }
+#endif
+
+ void addToCommittedByteCount(long byteCount)
+ {
+ ASSERT(spinlock.IsHeld());
+ ASSERT(static_cast<long>(committedBytesCount) + byteCount > -1);
+ committedBytesCount += byteCount;
+ }
+
+ // Freed space from the most common sized allocations will be held in this list, ...
+ const size_t m_commonSize;
+ Vector<void*> m_commonSizedAllocations;
+
+ // ... and all other freed allocations are held in m_freeList.
+ SizeSortedFreeTree m_freeList;
+
+ // This is used for housekeeping, to trigger defragmentation of the freed lists.
+ size_t m_countFreedSinceLastCoalesce;
+
+ PageReservation m_allocation;
+};
+
+size_t ExecutableAllocator::committedByteCount()
+{
+ SpinLockHolder lockHolder(&spinlock);
+ return committedBytesCount;
+}
+
+void ExecutableAllocator::intializePageSize()
+{
+ ExecutableAllocator::pageSize = getpagesize();
+}
+
+static FixedVMPoolAllocator* allocator = 0;
+static size_t allocatedCount = 0;
+
+bool ExecutableAllocator::isValid() const
+{
+ SpinLockHolder lock_holder(&spinlock);
+ if (!allocator)
+ allocator = new FixedVMPoolAllocator(JIT_ALLOCATOR_LARGE_ALLOC_SIZE, VM_POOL_SIZE);
+ return allocator->isValid();
+}
+
+bool ExecutableAllocator::underMemoryPressure()
+{
+ // Technically we should take the spin lock here, but we don't care if we get stale data.
+ // This is only really a heuristic anyway.
+ return allocatedCount > (VM_POOL_SIZE / 2);
+}
+
+ExecutablePool::Allocation ExecutablePool::systemAlloc(size_t size)
+{
+ SpinLockHolder lock_holder(&spinlock);
+ ASSERT(allocator);
+ allocatedCount += size;
+ return allocator->alloc(size);
+}
+
+void ExecutablePool::systemRelease(ExecutablePool::Allocation& allocation)
+{
+ SpinLockHolder lock_holder(&spinlock);
+ ASSERT(allocator);
+ allocatedCount -= allocation.size();
+ allocator->free(allocation);
+}
+
+}
+
+
+#endif // HAVE(ASSEMBLER)
diff --git a/Source/JavaScriptCore/jit/JIT.cpp b/Source/JavaScriptCore/jit/JIT.cpp
new file mode 100644
index 0000000..01401a7
--- /dev/null
+++ b/Source/JavaScriptCore/jit/JIT.cpp
@@ -0,0 +1,670 @@
+/*
+ * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if ENABLE(JIT)
+#include "JIT.h"
+
+// This probably does not belong here; adding here for now as a quick Windows build fix.
+#if ENABLE(ASSEMBLER) && CPU(X86) && !OS(MAC_OS_X)
+#include "MacroAssembler.h"
+JSC::MacroAssemblerX86Common::SSE2CheckState JSC::MacroAssemblerX86Common::s_sse2CheckState = NotCheckedSSE2;
+#endif
+
+#include "CodeBlock.h"
+#include "Interpreter.h"
+#include "JITInlineMethods.h"
+#include "JITStubCall.h"
+#include "JSArray.h"
+#include "JSFunction.h"
+#include "LinkBuffer.h"
+#include "RepatchBuffer.h"
+#include "ResultType.h"
+#include "SamplingTool.h"
+
+#ifndef NDEBUG
+#include <stdio.h>
+#endif
+
+using namespace std;
+
+namespace JSC {
+
+void ctiPatchNearCallByReturnAddress(CodeBlock* codeblock, ReturnAddressPtr returnAddress, MacroAssemblerCodePtr newCalleeFunction)
+{
+ RepatchBuffer repatchBuffer(codeblock);
+ repatchBuffer.relinkNearCallerToTrampoline(returnAddress, newCalleeFunction);
+}
+
+void ctiPatchCallByReturnAddress(CodeBlock* codeblock, ReturnAddressPtr returnAddress, MacroAssemblerCodePtr newCalleeFunction)
+{
+ RepatchBuffer repatchBuffer(codeblock);
+ repatchBuffer.relinkCallerToTrampoline(returnAddress, newCalleeFunction);
+}
+
+void ctiPatchCallByReturnAddress(CodeBlock* codeblock, ReturnAddressPtr returnAddress, FunctionPtr newCalleeFunction)
+{
+ RepatchBuffer repatchBuffer(codeblock);
+ repatchBuffer.relinkCallerToFunction(returnAddress, newCalleeFunction);
+}
+
+JIT::JIT(JSGlobalData* globalData, CodeBlock* codeBlock, void* linkerOffset)
+ : m_interpreter(globalData->interpreter)
+ , m_globalData(globalData)
+ , m_codeBlock(codeBlock)
+ , m_labels(codeBlock ? codeBlock->instructions().size() : 0)
+ , m_propertyAccessCompilationInfo(codeBlock ? codeBlock->numberOfStructureStubInfos() : 0)
+ , m_callStructureStubCompilationInfo(codeBlock ? codeBlock->numberOfCallLinkInfos() : 0)
+ , m_bytecodeOffset((unsigned)-1)
+#if USE(JSVALUE32_64)
+ , m_jumpTargetIndex(0)
+ , m_mappedBytecodeOffset((unsigned)-1)
+ , m_mappedVirtualRegisterIndex((unsigned)-1)
+ , m_mappedTag((RegisterID)-1)
+ , m_mappedPayload((RegisterID)-1)
+#else
+ , m_lastResultBytecodeRegister(std::numeric_limits<int>::max())
+ , m_jumpTargetsPosition(0)
+#endif
+ , m_linkerOffset(linkerOffset)
+{
+}
+
+#if USE(JSVALUE32_64)
+void JIT::emitTimeoutCheck()
+{
+ Jump skipTimeout = branchSub32(NonZero, Imm32(1), timeoutCheckRegister);
+ JITStubCall stubCall(this, cti_timeout_check);
+ stubCall.addArgument(regT1, regT0); // save last result registers.
+ stubCall.call(timeoutCheckRegister);
+ stubCall.getArgument(0, regT1, regT0); // reload last result registers.
+ skipTimeout.link(this);
+}
+#else
+void JIT::emitTimeoutCheck()
+{
+ Jump skipTimeout = branchSub32(NonZero, Imm32(1), timeoutCheckRegister);
+ JITStubCall(this, cti_timeout_check).call(timeoutCheckRegister);
+ skipTimeout.link(this);
+
+ killLastResultRegister();
+}
+#endif
+
+#define NEXT_OPCODE(name) \
+ m_bytecodeOffset += OPCODE_LENGTH(name); \
+ break;
+
+#if USE(JSVALUE32_64)
+#define DEFINE_BINARY_OP(name) \
+ case name: { \
+ JITStubCall stubCall(this, cti_##name); \
+ stubCall.addArgument(currentInstruction[2].u.operand); \
+ stubCall.addArgument(currentInstruction[3].u.operand); \
+ stubCall.call(currentInstruction[1].u.operand); \
+ NEXT_OPCODE(name); \
+ }
+
+#define DEFINE_UNARY_OP(name) \
+ case name: { \
+ JITStubCall stubCall(this, cti_##name); \
+ stubCall.addArgument(currentInstruction[2].u.operand); \
+ stubCall.call(currentInstruction[1].u.operand); \
+ NEXT_OPCODE(name); \
+ }
+
+#else // USE(JSVALUE32_64)
+
+#define DEFINE_BINARY_OP(name) \
+ case name: { \
+ JITStubCall stubCall(this, cti_##name); \
+ stubCall.addArgument(currentInstruction[2].u.operand, regT2); \
+ stubCall.addArgument(currentInstruction[3].u.operand, regT2); \
+ stubCall.call(currentInstruction[1].u.operand); \
+ NEXT_OPCODE(name); \
+ }
+
+#define DEFINE_UNARY_OP(name) \
+ case name: { \
+ JITStubCall stubCall(this, cti_##name); \
+ stubCall.addArgument(currentInstruction[2].u.operand, regT2); \
+ stubCall.call(currentInstruction[1].u.operand); \
+ NEXT_OPCODE(name); \
+ }
+#endif // USE(JSVALUE32_64)
+
+#define DEFINE_OP(name) \
+ case name: { \
+ emit_##name(currentInstruction); \
+ NEXT_OPCODE(name); \
+ }
+
+#define DEFINE_SLOWCASE_OP(name) \
+ case name: { \
+ emitSlow_##name(currentInstruction, iter); \
+ NEXT_OPCODE(name); \
+ }
+
+void JIT::privateCompileMainPass()
+{
+ Instruction* instructionsBegin = m_codeBlock->instructions().begin();
+ unsigned instructionCount = m_codeBlock->instructions().size();
+
+ m_propertyAccessInstructionIndex = 0;
+ m_globalResolveInfoIndex = 0;
+ m_callLinkInfoIndex = 0;
+
+ for (m_bytecodeOffset = 0; m_bytecodeOffset < instructionCount; ) {
+ Instruction* currentInstruction = instructionsBegin + m_bytecodeOffset;
+ ASSERT_WITH_MESSAGE(m_interpreter->isOpcode(currentInstruction->u.opcode), "privateCompileMainPass gone bad @ %d", m_bytecodeOffset);
+
+#if ENABLE(OPCODE_SAMPLING)
+ if (m_bytecodeOffset > 0) // Avoid the overhead of sampling op_enter twice.
+ sampleInstruction(currentInstruction);
+#endif
+
+#if USE(JSVALUE64)
+ if (m_labels[m_bytecodeOffset].isUsed())
+ killLastResultRegister();
+#endif
+
+ m_labels[m_bytecodeOffset] = label();
+
+ switch (m_interpreter->getOpcodeID(currentInstruction->u.opcode)) {
+ DEFINE_BINARY_OP(op_del_by_val)
+ DEFINE_BINARY_OP(op_in)
+ DEFINE_BINARY_OP(op_less)
+ DEFINE_BINARY_OP(op_lesseq)
+ DEFINE_UNARY_OP(op_is_boolean)
+ DEFINE_UNARY_OP(op_is_function)
+ DEFINE_UNARY_OP(op_is_number)
+ DEFINE_UNARY_OP(op_is_object)
+ DEFINE_UNARY_OP(op_is_string)
+ DEFINE_UNARY_OP(op_is_undefined)
+#if USE(JSVALUE64)
+ DEFINE_UNARY_OP(op_negate)
+#endif
+ DEFINE_UNARY_OP(op_typeof)
+
+ DEFINE_OP(op_add)
+ DEFINE_OP(op_bitand)
+ DEFINE_OP(op_bitnot)
+ DEFINE_OP(op_bitor)
+ DEFINE_OP(op_bitxor)
+ DEFINE_OP(op_call)
+ DEFINE_OP(op_call_eval)
+ DEFINE_OP(op_call_varargs)
+ DEFINE_OP(op_catch)
+ DEFINE_OP(op_construct)
+ DEFINE_OP(op_get_callee)
+ DEFINE_OP(op_create_this)
+ DEFINE_OP(op_convert_this)
+ DEFINE_OP(op_convert_this_strict)
+ DEFINE_OP(op_init_lazy_reg)
+ DEFINE_OP(op_create_arguments)
+ DEFINE_OP(op_debug)
+ DEFINE_OP(op_del_by_id)
+ DEFINE_OP(op_div)
+ DEFINE_OP(op_end)
+ DEFINE_OP(op_enter)
+ DEFINE_OP(op_create_activation)
+ DEFINE_OP(op_eq)
+ DEFINE_OP(op_eq_null)
+ DEFINE_OP(op_get_by_id)
+ DEFINE_OP(op_get_arguments_length)
+ DEFINE_OP(op_get_by_val)
+ DEFINE_OP(op_get_argument_by_val)
+ DEFINE_OP(op_get_by_pname)
+ DEFINE_OP(op_get_global_var)
+ DEFINE_OP(op_get_pnames)
+ DEFINE_OP(op_get_scoped_var)
+ DEFINE_OP(op_check_has_instance)
+ DEFINE_OP(op_instanceof)
+ DEFINE_OP(op_jeq_null)
+ DEFINE_OP(op_jfalse)
+ DEFINE_OP(op_jmp)
+ DEFINE_OP(op_jmp_scopes)
+ DEFINE_OP(op_jneq_null)
+ DEFINE_OP(op_jneq_ptr)
+ DEFINE_OP(op_jnless)
+ DEFINE_OP(op_jless)
+ DEFINE_OP(op_jlesseq)
+ DEFINE_OP(op_jnlesseq)
+ DEFINE_OP(op_jsr)
+ DEFINE_OP(op_jtrue)
+ DEFINE_OP(op_load_varargs)
+ DEFINE_OP(op_loop)
+ DEFINE_OP(op_loop_if_less)
+ DEFINE_OP(op_loop_if_lesseq)
+ DEFINE_OP(op_loop_if_true)
+ DEFINE_OP(op_loop_if_false)
+ DEFINE_OP(op_lshift)
+ DEFINE_OP(op_method_check)
+ DEFINE_OP(op_mod)
+ DEFINE_OP(op_mov)
+ DEFINE_OP(op_mul)
+#if USE(JSVALUE32_64)
+ DEFINE_OP(op_negate)
+#endif
+ DEFINE_OP(op_neq)
+ DEFINE_OP(op_neq_null)
+ DEFINE_OP(op_new_array)
+ DEFINE_OP(op_new_func)
+ DEFINE_OP(op_new_func_exp)
+ DEFINE_OP(op_new_object)
+ DEFINE_OP(op_new_regexp)
+ DEFINE_OP(op_next_pname)
+ DEFINE_OP(op_not)
+ DEFINE_OP(op_nstricteq)
+ DEFINE_OP(op_pop_scope)
+ DEFINE_OP(op_post_dec)
+ DEFINE_OP(op_post_inc)
+ DEFINE_OP(op_pre_dec)
+ DEFINE_OP(op_pre_inc)
+ DEFINE_OP(op_profile_did_call)
+ DEFINE_OP(op_profile_will_call)
+ DEFINE_OP(op_push_new_scope)
+ DEFINE_OP(op_push_scope)
+ DEFINE_OP(op_put_by_id)
+ DEFINE_OP(op_put_by_index)
+ DEFINE_OP(op_put_by_val)
+ DEFINE_OP(op_put_getter)
+ DEFINE_OP(op_put_global_var)
+ DEFINE_OP(op_put_scoped_var)
+ DEFINE_OP(op_put_setter)
+ DEFINE_OP(op_resolve)
+ DEFINE_OP(op_resolve_base)
+ DEFINE_OP(op_ensure_property_exists)
+ DEFINE_OP(op_resolve_global)
+ DEFINE_OP(op_resolve_global_dynamic)
+ DEFINE_OP(op_resolve_skip)
+ DEFINE_OP(op_resolve_with_base)
+ DEFINE_OP(op_ret)
+ DEFINE_OP(op_call_put_result)
+ DEFINE_OP(op_ret_object_or_this)
+ DEFINE_OP(op_rshift)
+ DEFINE_OP(op_urshift)
+ DEFINE_OP(op_sret)
+ DEFINE_OP(op_strcat)
+ DEFINE_OP(op_stricteq)
+ DEFINE_OP(op_sub)
+ DEFINE_OP(op_switch_char)
+ DEFINE_OP(op_switch_imm)
+ DEFINE_OP(op_switch_string)
+ DEFINE_OP(op_tear_off_activation)
+ DEFINE_OP(op_tear_off_arguments)
+ DEFINE_OP(op_throw)
+ DEFINE_OP(op_throw_reference_error)
+ DEFINE_OP(op_throw_syntax_error)
+ DEFINE_OP(op_to_jsnumber)
+ DEFINE_OP(op_to_primitive)
+
+ case op_get_array_length:
+ case op_get_by_id_chain:
+ case op_get_by_id_generic:
+ case op_get_by_id_proto:
+ case op_get_by_id_proto_list:
+ case op_get_by_id_self:
+ case op_get_by_id_self_list:
+ case op_get_by_id_getter_chain:
+ case op_get_by_id_getter_proto:
+ case op_get_by_id_getter_proto_list:
+ case op_get_by_id_getter_self:
+ case op_get_by_id_getter_self_list:
+ case op_get_by_id_custom_chain:
+ case op_get_by_id_custom_proto:
+ case op_get_by_id_custom_proto_list:
+ case op_get_by_id_custom_self:
+ case op_get_by_id_custom_self_list:
+ case op_get_string_length:
+ case op_put_by_id_generic:
+ case op_put_by_id_replace:
+ case op_put_by_id_transition:
+ ASSERT_NOT_REACHED();
+ }
+ }
+
+ ASSERT(m_propertyAccessInstructionIndex == m_codeBlock->numberOfStructureStubInfos());
+ ASSERT(m_callLinkInfoIndex == m_codeBlock->numberOfCallLinkInfos());
+
+#ifndef NDEBUG
+ // Reset this, in order to guard its use with ASSERTs.
+ m_bytecodeOffset = (unsigned)-1;
+#endif
+}
+
+
+void JIT::privateCompileLinkPass()
+{
+ unsigned jmpTableCount = m_jmpTable.size();
+ for (unsigned i = 0; i < jmpTableCount; ++i)
+ m_jmpTable[i].from.linkTo(m_labels[m_jmpTable[i].toBytecodeOffset], this);
+ m_jmpTable.clear();
+}
+
+void JIT::privateCompileSlowCases()
+{
+ Instruction* instructionsBegin = m_codeBlock->instructions().begin();
+
+ m_propertyAccessInstructionIndex = 0;
+ m_globalResolveInfoIndex = 0;
+ m_callLinkInfoIndex = 0;
+
+ for (Vector<SlowCaseEntry>::iterator iter = m_slowCases.begin(); iter != m_slowCases.end();) {
+#if USE(JSVALUE64)
+ killLastResultRegister();
+#endif
+
+ m_bytecodeOffset = iter->to;
+#ifndef NDEBUG
+ unsigned firstTo = m_bytecodeOffset;
+#endif
+ Instruction* currentInstruction = instructionsBegin + m_bytecodeOffset;
+
+ switch (m_interpreter->getOpcodeID(currentInstruction->u.opcode)) {
+ DEFINE_SLOWCASE_OP(op_add)
+ DEFINE_SLOWCASE_OP(op_bitand)
+ DEFINE_SLOWCASE_OP(op_bitnot)
+ DEFINE_SLOWCASE_OP(op_bitor)
+ DEFINE_SLOWCASE_OP(op_bitxor)
+ DEFINE_SLOWCASE_OP(op_call)
+ DEFINE_SLOWCASE_OP(op_call_eval)
+ DEFINE_SLOWCASE_OP(op_call_varargs)
+ DEFINE_SLOWCASE_OP(op_construct)
+ DEFINE_SLOWCASE_OP(op_convert_this)
+ DEFINE_SLOWCASE_OP(op_convert_this_strict)
+ DEFINE_SLOWCASE_OP(op_div)
+ DEFINE_SLOWCASE_OP(op_eq)
+ DEFINE_SLOWCASE_OP(op_get_by_id)
+ DEFINE_SLOWCASE_OP(op_get_arguments_length)
+ DEFINE_SLOWCASE_OP(op_get_by_val)
+ DEFINE_SLOWCASE_OP(op_get_argument_by_val)
+ DEFINE_SLOWCASE_OP(op_get_by_pname)
+ DEFINE_SLOWCASE_OP(op_check_has_instance)
+ DEFINE_SLOWCASE_OP(op_instanceof)
+ DEFINE_SLOWCASE_OP(op_jfalse)
+ DEFINE_SLOWCASE_OP(op_jnless)
+ DEFINE_SLOWCASE_OP(op_jless)
+ DEFINE_SLOWCASE_OP(op_jlesseq)
+ DEFINE_SLOWCASE_OP(op_jnlesseq)
+ DEFINE_SLOWCASE_OP(op_jtrue)
+ DEFINE_SLOWCASE_OP(op_load_varargs)
+ DEFINE_SLOWCASE_OP(op_loop_if_less)
+ DEFINE_SLOWCASE_OP(op_loop_if_lesseq)
+ DEFINE_SLOWCASE_OP(op_loop_if_true)
+ DEFINE_SLOWCASE_OP(op_loop_if_false)
+ DEFINE_SLOWCASE_OP(op_lshift)
+ DEFINE_SLOWCASE_OP(op_method_check)
+ DEFINE_SLOWCASE_OP(op_mod)
+ DEFINE_SLOWCASE_OP(op_mul)
+#if USE(JSVALUE32_64)
+ DEFINE_SLOWCASE_OP(op_negate)
+#endif
+ DEFINE_SLOWCASE_OP(op_neq)
+ DEFINE_SLOWCASE_OP(op_not)
+ DEFINE_SLOWCASE_OP(op_nstricteq)
+ DEFINE_SLOWCASE_OP(op_post_dec)
+ DEFINE_SLOWCASE_OP(op_post_inc)
+ DEFINE_SLOWCASE_OP(op_pre_dec)
+ DEFINE_SLOWCASE_OP(op_pre_inc)
+ DEFINE_SLOWCASE_OP(op_put_by_id)
+ DEFINE_SLOWCASE_OP(op_put_by_val)
+ DEFINE_SLOWCASE_OP(op_resolve_global)
+ DEFINE_SLOWCASE_OP(op_resolve_global_dynamic)
+ DEFINE_SLOWCASE_OP(op_rshift)
+ DEFINE_SLOWCASE_OP(op_urshift)
+ DEFINE_SLOWCASE_OP(op_stricteq)
+ DEFINE_SLOWCASE_OP(op_sub)
+ DEFINE_SLOWCASE_OP(op_to_jsnumber)
+ DEFINE_SLOWCASE_OP(op_to_primitive)
+ default:
+ ASSERT_NOT_REACHED();
+ }
+
+ ASSERT_WITH_MESSAGE(iter == m_slowCases.end() || firstTo != iter->to,"Not enough jumps linked in slow case codegen.");
+ ASSERT_WITH_MESSAGE(firstTo == (iter - 1)->to, "Too many jumps linked in slow case codegen.");
+
+ emitJumpSlowToHot(jump(), 0);
+ }
+
+#if ENABLE(JIT_OPTIMIZE_PROPERTY_ACCESS)
+ ASSERT(m_propertyAccessInstructionIndex == m_codeBlock->numberOfStructureStubInfos());
+#endif
+ ASSERT(m_callLinkInfoIndex == m_codeBlock->numberOfCallLinkInfos());
+
+#ifndef NDEBUG
+ // Reset this, in order to guard its use with ASSERTs.
+ m_bytecodeOffset = (unsigned)-1;
+#endif
+}
+
+JITCode JIT::privateCompile(CodePtr* functionEntryArityCheck)
+{
+ // Could use a pop_m, but would need to offset the following instruction if so.
+ preserveReturnAddressAfterCall(regT2);
+ emitPutToCallFrameHeader(regT2, RegisterFile::ReturnPC);
+
+ Label beginLabel(this);
+
+ sampleCodeBlock(m_codeBlock);
+#if ENABLE(OPCODE_SAMPLING)
+ sampleInstruction(m_codeBlock->instructions().begin());
+#endif
+
+ Jump registerFileCheck;
+ if (m_codeBlock->codeType() == FunctionCode) {
+ // In the case of a fast linked call, we do not set this up in the caller.
+ emitPutImmediateToCallFrameHeader(m_codeBlock, RegisterFile::CodeBlock);
+
+ addPtr(Imm32(m_codeBlock->m_numCalleeRegisters * sizeof(Register)), callFrameRegister, regT1);
+ registerFileCheck = branchPtr(Below, AbsoluteAddress(&m_globalData->interpreter->registerFile().m_end), regT1);
+ }
+
+ Label functionBody = label();
+
+ privateCompileMainPass();
+ privateCompileLinkPass();
+ privateCompileSlowCases();
+
+ Label arityCheck;
+ Call callArityCheck;
+ if (m_codeBlock->codeType() == FunctionCode) {
+ registerFileCheck.link(this);
+ m_bytecodeOffset = 0;
+ JITStubCall(this, cti_register_file_check).call();
+#ifndef NDEBUG
+ m_bytecodeOffset = (unsigned)-1; // Reset this, in order to guard its use with ASSERTs.
+#endif
+ jump(functionBody);
+
+ arityCheck = label();
+ preserveReturnAddressAfterCall(regT2);
+ emitPutToCallFrameHeader(regT2, RegisterFile::ReturnPC);
+ branch32(Equal, regT1, Imm32(m_codeBlock->m_numParameters)).linkTo(beginLabel, this);
+ restoreArgumentReference();
+ callArityCheck = call();
+ move(regT0, callFrameRegister);
+ jump(beginLabel);
+ }
+
+ ASSERT(m_jmpTable.isEmpty());
+
+ LinkBuffer patchBuffer(this, m_globalData->executableAllocator.poolForSize(m_assembler.size()), m_linkerOffset);
+
+ // Translate vPC offsets into addresses in JIT generated code, for switch tables.
+ for (unsigned i = 0; i < m_switches.size(); ++i) {
+ SwitchRecord record = m_switches[i];
+ unsigned bytecodeOffset = record.bytecodeOffset;
+
+ if (record.type != SwitchRecord::String) {
+ ASSERT(record.type == SwitchRecord::Immediate || record.type == SwitchRecord::Character);
+ ASSERT(record.jumpTable.simpleJumpTable->branchOffsets.size() == record.jumpTable.simpleJumpTable->ctiOffsets.size());
+
+ record.jumpTable.simpleJumpTable->ctiDefault = patchBuffer.locationOf(m_labels[bytecodeOffset + record.defaultOffset]);
+
+ for (unsigned j = 0; j < record.jumpTable.simpleJumpTable->branchOffsets.size(); ++j) {
+ unsigned offset = record.jumpTable.simpleJumpTable->branchOffsets[j];
+ record.jumpTable.simpleJumpTable->ctiOffsets[j] = offset ? patchBuffer.locationOf(m_labels[bytecodeOffset + offset]) : record.jumpTable.simpleJumpTable->ctiDefault;
+ }
+ } else {
+ ASSERT(record.type == SwitchRecord::String);
+
+ record.jumpTable.stringJumpTable->ctiDefault = patchBuffer.locationOf(m_labels[bytecodeOffset + record.defaultOffset]);
+
+ StringJumpTable::StringOffsetTable::iterator end = record.jumpTable.stringJumpTable->offsetTable.end();
+ for (StringJumpTable::StringOffsetTable::iterator it = record.jumpTable.stringJumpTable->offsetTable.begin(); it != end; ++it) {
+ unsigned offset = it->second.branchOffset;
+ it->second.ctiOffset = offset ? patchBuffer.locationOf(m_labels[bytecodeOffset + offset]) : record.jumpTable.stringJumpTable->ctiDefault;
+ }
+ }
+ }
+
+ for (size_t i = 0; i < m_codeBlock->numberOfExceptionHandlers(); ++i) {
+ HandlerInfo& handler = m_codeBlock->exceptionHandler(i);
+ handler.nativeCode = patchBuffer.locationOf(m_labels[handler.target]);
+ }
+
+ for (Vector<CallRecord>::iterator iter = m_calls.begin(); iter != m_calls.end(); ++iter) {
+ if (iter->to)
+ patchBuffer.link(iter->from, FunctionPtr(iter->to));
+ }
+
+ if (m_codeBlock->needsCallReturnIndices()) {
+ m_codeBlock->callReturnIndexVector().reserveCapacity(m_calls.size());
+ for (Vector<CallRecord>::iterator iter = m_calls.begin(); iter != m_calls.end(); ++iter)
+ m_codeBlock->callReturnIndexVector().append(CallReturnOffsetToBytecodeOffset(patchBuffer.returnAddressOffset(iter->from), iter->bytecodeOffset));
+ }
+
+ // Link absolute addresses for jsr
+ for (Vector<JSRInfo>::iterator iter = m_jsrSites.begin(); iter != m_jsrSites.end(); ++iter)
+ patchBuffer.patch(iter->storeLocation, patchBuffer.locationOf(iter->target).executableAddress());
+
+#if ENABLE(JIT_OPTIMIZE_PROPERTY_ACCESS)
+ for (unsigned i = 0; i < m_codeBlock->numberOfStructureStubInfos(); ++i) {
+ StructureStubInfo& info = m_codeBlock->structureStubInfo(i);
+ info.callReturnLocation = patchBuffer.locationOf(m_propertyAccessCompilationInfo[i].callReturnLocation);
+ info.hotPathBegin = patchBuffer.locationOf(m_propertyAccessCompilationInfo[i].hotPathBegin);
+ }
+#endif
+#if ENABLE(JIT_OPTIMIZE_CALL)
+ for (unsigned i = 0; i < m_codeBlock->numberOfCallLinkInfos(); ++i) {
+ CallLinkInfo& info = m_codeBlock->callLinkInfo(i);
+ info.ownerCodeBlock = m_codeBlock;
+ info.callReturnLocation = patchBuffer.locationOfNearCall(m_callStructureStubCompilationInfo[i].callReturnLocation);
+ info.hotPathBegin = patchBuffer.locationOf(m_callStructureStubCompilationInfo[i].hotPathBegin);
+ info.hotPathOther = patchBuffer.locationOfNearCall(m_callStructureStubCompilationInfo[i].hotPathOther);
+ }
+#endif
+ unsigned methodCallCount = m_methodCallCompilationInfo.size();
+ m_codeBlock->addMethodCallLinkInfos(methodCallCount);
+ for (unsigned i = 0; i < methodCallCount; ++i) {
+ MethodCallLinkInfo& info = m_codeBlock->methodCallLinkInfo(i);
+ info.structureLabel = patchBuffer.locationOf(m_methodCallCompilationInfo[i].structureToCompare);
+ info.callReturnLocation = m_codeBlock->structureStubInfo(m_methodCallCompilationInfo[i].propertyAccessIndex).callReturnLocation;
+ }
+
+ if (m_codeBlock->codeType() == FunctionCode && functionEntryArityCheck) {
+ patchBuffer.link(callArityCheck, FunctionPtr(m_codeBlock->m_isConstructor ? cti_op_construct_arityCheck : cti_op_call_arityCheck));
+ *functionEntryArityCheck = patchBuffer.locationOf(arityCheck);
+ }
+
+ return patchBuffer.finalizeCode();
+}
+
+#if USE(JSVALUE64)
+void JIT::emitGetVariableObjectRegister(RegisterID variableObject, int index, RegisterID dst)
+{
+ loadPtr(Address(variableObject, OBJECT_OFFSETOF(JSVariableObject, d)), dst);
+ loadPtr(Address(dst, OBJECT_OFFSETOF(JSVariableObject::JSVariableObjectData, registers)), dst);
+ loadPtr(Address(dst, index * sizeof(Register)), dst);
+}
+
+void JIT::emitPutVariableObjectRegister(RegisterID src, RegisterID variableObject, int index)
+{
+ loadPtr(Address(variableObject, OBJECT_OFFSETOF(JSVariableObject, d)), variableObject);
+ loadPtr(Address(variableObject, OBJECT_OFFSETOF(JSVariableObject::JSVariableObjectData, registers)), variableObject);
+ storePtr(src, Address(variableObject, index * sizeof(Register)));
+}
+#endif
+
+#if ENABLE(JIT_OPTIMIZE_CALL)
+void JIT::unlinkCallOrConstruct(CallLinkInfo* callLinkInfo)
+{
+ // When the JSFunction is deleted the pointer embedded in the instruction stream will no longer be valid
+ // (and, if a new JSFunction happened to be constructed at the same location, we could get a false positive
+ // match). Reset the check so it no longer matches.
+ RepatchBuffer repatchBuffer(callLinkInfo->ownerCodeBlock);
+#if USE(JSVALUE32_64)
+ repatchBuffer.repatch(callLinkInfo->hotPathBegin, 0);
+#else
+ repatchBuffer.repatch(callLinkInfo->hotPathBegin, JSValue::encode(JSValue()));
+#endif
+}
+
+void JIT::linkCall(JSFunction* callee, CodeBlock* callerCodeBlock, CodeBlock* calleeCodeBlock, JIT::CodePtr code, CallLinkInfo* callLinkInfo, int callerArgCount, JSGlobalData* globalData)
+{
+ RepatchBuffer repatchBuffer(callerCodeBlock);
+
+ // Currently we only link calls with the exact number of arguments.
+ // If this is a native call calleeCodeBlock is null so the number of parameters is unimportant
+ if (!calleeCodeBlock || (callerArgCount == calleeCodeBlock->m_numParameters)) {
+ ASSERT(!callLinkInfo->isLinked());
+
+ if (calleeCodeBlock)
+ calleeCodeBlock->addCaller(callLinkInfo);
+
+ repatchBuffer.repatch(callLinkInfo->hotPathBegin, callee);
+ repatchBuffer.relink(callLinkInfo->hotPathOther, code);
+ }
+
+ // patch the call so we do not continue to try to link.
+ repatchBuffer.relink(callLinkInfo->callReturnLocation, globalData->jitStubs->ctiVirtualCall());
+}
+
+void JIT::linkConstruct(JSFunction* callee, CodeBlock* callerCodeBlock, CodeBlock* calleeCodeBlock, JIT::CodePtr code, CallLinkInfo* callLinkInfo, int callerArgCount, JSGlobalData* globalData)
+{
+ RepatchBuffer repatchBuffer(callerCodeBlock);
+
+ // Currently we only link calls with the exact number of arguments.
+ // If this is a native call calleeCodeBlock is null so the number of parameters is unimportant
+ if (!calleeCodeBlock || (callerArgCount == calleeCodeBlock->m_numParameters)) {
+ ASSERT(!callLinkInfo->isLinked());
+
+ if (calleeCodeBlock)
+ calleeCodeBlock->addCaller(callLinkInfo);
+
+ repatchBuffer.repatch(callLinkInfo->hotPathBegin, callee);
+ repatchBuffer.relink(callLinkInfo->hotPathOther, code);
+ }
+
+ // patch the call so we do not continue to try to link.
+ repatchBuffer.relink(callLinkInfo->callReturnLocation, globalData->jitStubs->ctiVirtualConstruct());
+}
+#endif // ENABLE(JIT_OPTIMIZE_CALL)
+
+} // namespace JSC
+
+#endif // ENABLE(JIT)
diff --git a/Source/JavaScriptCore/jit/JIT.h b/Source/JavaScriptCore/jit/JIT.h
new file mode 100644
index 0000000..907a774
--- /dev/null
+++ b/Source/JavaScriptCore/jit/JIT.h
@@ -0,0 +1,1046 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef JIT_h
+#define JIT_h
+
+#if ENABLE(JIT)
+
+// We've run into some problems where changing the size of the class JIT leads to
+// performance fluctuations. Try forcing alignment in an attempt to stabalize this.
+#if COMPILER(GCC)
+#define JIT_CLASS_ALIGNMENT __attribute__ ((aligned (32)))
+#else
+#define JIT_CLASS_ALIGNMENT
+#endif
+
+#define ASSERT_JIT_OFFSET(actual, expected) ASSERT_WITH_MESSAGE(actual == expected, "JIT Offset \"%s\" should be %d, not %d.\n", #expected, static_cast<int>(actual), static_cast<int>(expected));
+
+#include "CodeBlock.h"
+#include "Interpreter.h"
+#include "JSInterfaceJIT.h"
+#include "Opcode.h"
+#include "Profiler.h"
+#include <bytecode/SamplingTool.h>
+
+namespace JSC {
+
+ class CodeBlock;
+ class JIT;
+ class JSPropertyNameIterator;
+ class Interpreter;
+ class Register;
+ class RegisterFile;
+ class ScopeChainNode;
+ class StructureChain;
+
+ struct CallLinkInfo;
+ struct Instruction;
+ struct OperandTypes;
+ struct PolymorphicAccessStructureList;
+ struct SimpleJumpTable;
+ struct StringJumpTable;
+ struct StructureStubInfo;
+
+ struct CallRecord {
+ MacroAssembler::Call from;
+ unsigned bytecodeOffset;
+ void* to;
+
+ CallRecord()
+ {
+ }
+
+ CallRecord(MacroAssembler::Call from, unsigned bytecodeOffset, void* to = 0)
+ : from(from)
+ , bytecodeOffset(bytecodeOffset)
+ , to(to)
+ {
+ }
+ };
+
+ struct JumpTable {
+ MacroAssembler::Jump from;
+ unsigned toBytecodeOffset;
+
+ JumpTable(MacroAssembler::Jump f, unsigned t)
+ : from(f)
+ , toBytecodeOffset(t)
+ {
+ }
+ };
+
+ struct SlowCaseEntry {
+ MacroAssembler::Jump from;
+ unsigned to;
+ unsigned hint;
+
+ SlowCaseEntry(MacroAssembler::Jump f, unsigned t, unsigned h = 0)
+ : from(f)
+ , to(t)
+ , hint(h)
+ {
+ }
+ };
+
+ struct SwitchRecord {
+ enum Type {
+ Immediate,
+ Character,
+ String
+ };
+
+ Type type;
+
+ union {
+ SimpleJumpTable* simpleJumpTable;
+ StringJumpTable* stringJumpTable;
+ } jumpTable;
+
+ unsigned bytecodeOffset;
+ unsigned defaultOffset;
+
+ SwitchRecord(SimpleJumpTable* jumpTable, unsigned bytecodeOffset, unsigned defaultOffset, Type type)
+ : type(type)
+ , bytecodeOffset(bytecodeOffset)
+ , defaultOffset(defaultOffset)
+ {
+ this->jumpTable.simpleJumpTable = jumpTable;
+ }
+
+ SwitchRecord(StringJumpTable* jumpTable, unsigned bytecodeOffset, unsigned defaultOffset)
+ : type(String)
+ , bytecodeOffset(bytecodeOffset)
+ , defaultOffset(defaultOffset)
+ {
+ this->jumpTable.stringJumpTable = jumpTable;
+ }
+ };
+
+ struct PropertyStubCompilationInfo {
+ MacroAssembler::Call callReturnLocation;
+ MacroAssembler::Label hotPathBegin;
+ };
+
+ struct StructureStubCompilationInfo {
+ MacroAssembler::DataLabelPtr hotPathBegin;
+ MacroAssembler::Call hotPathOther;
+ MacroAssembler::Call callReturnLocation;
+ };
+
+ struct MethodCallCompilationInfo {
+ MethodCallCompilationInfo(unsigned propertyAccessIndex)
+ : propertyAccessIndex(propertyAccessIndex)
+ {
+ }
+
+ MacroAssembler::DataLabelPtr structureToCompare;
+ unsigned propertyAccessIndex;
+ };
+
+ // Near calls can only be patched to other JIT code, regular calls can be patched to JIT code or relinked to stub functions.
+ void ctiPatchNearCallByReturnAddress(CodeBlock* codeblock, ReturnAddressPtr returnAddress, MacroAssemblerCodePtr newCalleeFunction);
+ void ctiPatchCallByReturnAddress(CodeBlock* codeblock, ReturnAddressPtr returnAddress, MacroAssemblerCodePtr newCalleeFunction);
+ void ctiPatchCallByReturnAddress(CodeBlock* codeblock, ReturnAddressPtr returnAddress, FunctionPtr newCalleeFunction);
+
+ class JIT : private JSInterfaceJIT {
+ friend class JITStubCall;
+
+ using MacroAssembler::Jump;
+ using MacroAssembler::JumpList;
+ using MacroAssembler::Label;
+
+ static const int patchGetByIdDefaultStructure = -1;
+ // Magic number - initial offset cannot be representable as a signed 8bit value, or the X86Assembler
+ // will compress the displacement, and we may not be able to fit a patched offset.
+ static const int patchGetByIdDefaultOffset = 256;
+
+ public:
+ static JITCode compile(JSGlobalData* globalData, CodeBlock* codeBlock, CodePtr* functionEntryArityCheck = 0, void* offsetBase = 0)
+ {
+ return JIT(globalData, codeBlock, offsetBase).privateCompile(functionEntryArityCheck);
+ }
+
+ static void compileGetByIdProto(JSGlobalData* globalData, CallFrame* callFrame, CodeBlock* codeBlock, StructureStubInfo* stubInfo, Structure* structure, Structure* prototypeStructure, const Identifier& ident, const PropertySlot& slot, size_t cachedOffset, ReturnAddressPtr returnAddress)
+ {
+ JIT jit(globalData, codeBlock);
+ jit.privateCompileGetByIdProto(stubInfo, structure, prototypeStructure, ident, slot, cachedOffset, returnAddress, callFrame);
+ }
+
+ static void compileGetByIdSelfList(JSGlobalData* globalData, CodeBlock* codeBlock, StructureStubInfo* stubInfo, PolymorphicAccessStructureList* polymorphicStructures, int currentIndex, Structure* structure, const Identifier& ident, const PropertySlot& slot, size_t cachedOffset)
+ {
+ JIT jit(globalData, codeBlock);
+ jit.privateCompileGetByIdSelfList(stubInfo, polymorphicStructures, currentIndex, structure, ident, slot, cachedOffset);
+ }
+ static void compileGetByIdProtoList(JSGlobalData* globalData, CallFrame* callFrame, CodeBlock* codeBlock, StructureStubInfo* stubInfo, PolymorphicAccessStructureList* prototypeStructureList, int currentIndex, Structure* structure, Structure* prototypeStructure, const Identifier& ident, const PropertySlot& slot, size_t cachedOffset)
+ {
+ JIT jit(globalData, codeBlock);
+ jit.privateCompileGetByIdProtoList(stubInfo, prototypeStructureList, currentIndex, structure, prototypeStructure, ident, slot, cachedOffset, callFrame);
+ }
+ static void compileGetByIdChainList(JSGlobalData* globalData, CallFrame* callFrame, CodeBlock* codeBlock, StructureStubInfo* stubInfo, PolymorphicAccessStructureList* prototypeStructureList, int currentIndex, Structure* structure, StructureChain* chain, size_t count, const Identifier& ident, const PropertySlot& slot, size_t cachedOffset)
+ {
+ JIT jit(globalData, codeBlock);
+ jit.privateCompileGetByIdChainList(stubInfo, prototypeStructureList, currentIndex, structure, chain, count, ident, slot, cachedOffset, callFrame);
+ }
+
+ static void compileGetByIdChain(JSGlobalData* globalData, CallFrame* callFrame, CodeBlock* codeBlock, StructureStubInfo* stubInfo, Structure* structure, StructureChain* chain, size_t count, const Identifier& ident, const PropertySlot& slot, size_t cachedOffset, ReturnAddressPtr returnAddress)
+ {
+ JIT jit(globalData, codeBlock);
+ jit.privateCompileGetByIdChain(stubInfo, structure, chain, count, ident, slot, cachedOffset, returnAddress, callFrame);
+ }
+
+ static void compilePutByIdTransition(JSGlobalData* globalData, CodeBlock* codeBlock, StructureStubInfo* stubInfo, Structure* oldStructure, Structure* newStructure, size_t cachedOffset, StructureChain* chain, ReturnAddressPtr returnAddress, bool direct)
+ {
+ JIT jit(globalData, codeBlock);
+ jit.privateCompilePutByIdTransition(stubInfo, oldStructure, newStructure, cachedOffset, chain, returnAddress, direct);
+ }
+
+ static void compileCTIMachineTrampolines(JSGlobalData* globalData, RefPtr<ExecutablePool>* executablePool, TrampolineStructure *trampolines)
+ {
+ if (!globalData->canUseJIT())
+ return;
+ JIT jit(globalData, 0, 0);
+ jit.privateCompileCTIMachineTrampolines(executablePool, globalData, trampolines);
+ }
+
+ static CodePtr compileCTINativeCall(JSGlobalData* globalData, PassRefPtr<ExecutablePool> executablePool, NativeFunction func)
+ {
+ if (!globalData->canUseJIT())
+ return CodePtr();
+ JIT jit(globalData, 0, 0);
+ return jit.privateCompileCTINativeCall(executablePool, globalData, func);
+ }
+
+ static void patchGetByIdSelf(CodeBlock* codeblock, StructureStubInfo*, Structure*, size_t cachedOffset, ReturnAddressPtr returnAddress);
+ static void patchPutByIdReplace(CodeBlock* codeblock, StructureStubInfo*, Structure*, size_t cachedOffset, ReturnAddressPtr returnAddress, bool direct);
+ static void patchMethodCallProto(CodeBlock* codeblock, MethodCallLinkInfo&, JSFunction*, Structure*, JSObject*, ReturnAddressPtr);
+
+ static void compilePatchGetArrayLength(JSGlobalData* globalData, CodeBlock* codeBlock, ReturnAddressPtr returnAddress)
+ {
+ JIT jit(globalData, codeBlock);
+ return jit.privateCompilePatchGetArrayLength(returnAddress);
+ }
+
+ static void linkCall(JSFunction* callee, CodeBlock* callerCodeBlock, CodeBlock* calleeCodeBlock, CodePtr, CallLinkInfo*, int callerArgCount, JSGlobalData*);
+ static void linkConstruct(JSFunction* callee, CodeBlock* callerCodeBlock, CodeBlock* calleeCodeBlock, CodePtr, CallLinkInfo*, int callerArgCount, JSGlobalData*);
+ static void unlinkCallOrConstruct(CallLinkInfo*);
+
+ private:
+ struct JSRInfo {
+ DataLabelPtr storeLocation;
+ Label target;
+
+ JSRInfo(DataLabelPtr storeLocation, Label targetLocation)
+ : storeLocation(storeLocation)
+ , target(targetLocation)
+ {
+ }
+ };
+
+ JIT(JSGlobalData*, CodeBlock* = 0, void* = 0);
+
+ void privateCompileMainPass();
+ void privateCompileLinkPass();
+ void privateCompileSlowCases();
+ JITCode privateCompile(CodePtr* functionEntryArityCheck);
+ void privateCompileGetByIdProto(StructureStubInfo*, Structure*, Structure* prototypeStructure, const Identifier&, const PropertySlot&, size_t cachedOffset, ReturnAddressPtr returnAddress, CallFrame* callFrame);
+ void privateCompileGetByIdSelfList(StructureStubInfo*, PolymorphicAccessStructureList*, int, Structure*, const Identifier&, const PropertySlot&, size_t cachedOffset);
+ void privateCompileGetByIdProtoList(StructureStubInfo*, PolymorphicAccessStructureList*, int, Structure*, Structure* prototypeStructure, const Identifier&, const PropertySlot&, size_t cachedOffset, CallFrame* callFrame);
+ void privateCompileGetByIdChainList(StructureStubInfo*, PolymorphicAccessStructureList*, int, Structure*, StructureChain* chain, size_t count, const Identifier&, const PropertySlot&, size_t cachedOffset, CallFrame* callFrame);
+ void privateCompileGetByIdChain(StructureStubInfo*, Structure*, StructureChain*, size_t count, const Identifier&, const PropertySlot&, size_t cachedOffset, ReturnAddressPtr returnAddress, CallFrame* callFrame);
+ void privateCompilePutByIdTransition(StructureStubInfo*, Structure*, Structure*, size_t cachedOffset, StructureChain*, ReturnAddressPtr returnAddress, bool direct);
+
+ void privateCompileCTIMachineTrampolines(RefPtr<ExecutablePool>* executablePool, JSGlobalData* data, TrampolineStructure *trampolines);
+ Label privateCompileCTINativeCall(JSGlobalData*, bool isConstruct = false);
+ CodePtr privateCompileCTINativeCall(PassRefPtr<ExecutablePool> executablePool, JSGlobalData* data, NativeFunction func);
+ void privateCompilePatchGetArrayLength(ReturnAddressPtr returnAddress);
+
+ void addSlowCase(Jump);
+ void addSlowCase(JumpList);
+ void addJump(Jump, int);
+ void emitJumpSlowToHot(Jump, int);
+
+ void compileOpCall(OpcodeID, Instruction* instruction, unsigned callLinkInfoIndex);
+ void compileOpCallVarargs(Instruction* instruction);
+ void compileOpCallInitializeCallFrame();
+ void compileOpCallSlowCase(Instruction* instruction, Vector<SlowCaseEntry>::iterator& iter, unsigned callLinkInfoIndex, OpcodeID opcodeID);
+ void compileOpCallVarargsSlowCase(Instruction* instruction, Vector<SlowCaseEntry>::iterator& iter);
+
+ enum CompileOpStrictEqType { OpStrictEq, OpNStrictEq };
+ void compileOpStrictEq(Instruction* instruction, CompileOpStrictEqType type);
+ bool isOperandConstantImmediateDouble(unsigned src);
+
+ void emitLoadDouble(unsigned index, FPRegisterID value);
+ void emitLoadInt32ToDouble(unsigned index, FPRegisterID value);
+
+ void testPrototype(JSValue, JumpList& failureCases);
+
+#if USE(JSVALUE32_64)
+ bool getOperandConstantImmediateInt(unsigned op1, unsigned op2, unsigned& op, int32_t& constant);
+
+ void emitLoadTag(unsigned index, RegisterID tag);
+ void emitLoadPayload(unsigned index, RegisterID payload);
+
+ void emitLoad(const JSValue& v, RegisterID tag, RegisterID payload);
+ void emitLoad(unsigned index, RegisterID tag, RegisterID payload, RegisterID base = callFrameRegister);
+ void emitLoad2(unsigned index1, RegisterID tag1, RegisterID payload1, unsigned index2, RegisterID tag2, RegisterID payload2);
+
+ void emitStore(unsigned index, RegisterID tag, RegisterID payload, RegisterID base = callFrameRegister);
+ void emitStore(unsigned index, const JSValue constant, RegisterID base = callFrameRegister);
+ void emitStoreInt32(unsigned index, RegisterID payload, bool indexIsInt32 = false);
+ void emitStoreInt32(unsigned index, Imm32 payload, bool indexIsInt32 = false);
+ void emitStoreCell(unsigned index, RegisterID payload, bool indexIsCell = false);
+ void emitStoreBool(unsigned index, RegisterID tag, bool indexIsBool = false);
+ void emitStoreDouble(unsigned index, FPRegisterID value);
+
+ bool isLabeled(unsigned bytecodeOffset);
+ void map(unsigned bytecodeOffset, unsigned virtualRegisterIndex, RegisterID tag, RegisterID payload);
+ void unmap(RegisterID);
+ void unmap();
+ bool isMapped(unsigned virtualRegisterIndex);
+ bool getMappedPayload(unsigned virtualRegisterIndex, RegisterID& payload);
+ bool getMappedTag(unsigned virtualRegisterIndex, RegisterID& tag);
+
+ void emitJumpSlowCaseIfNotJSCell(unsigned virtualRegisterIndex);
+ void emitJumpSlowCaseIfNotJSCell(unsigned virtualRegisterIndex, RegisterID tag);
+ void linkSlowCaseIfNotJSCell(Vector<SlowCaseEntry>::iterator&, unsigned virtualRegisterIndex);
+
+#if ENABLE(JIT_OPTIMIZE_PROPERTY_ACCESS)
+ void compileGetByIdHotPath();
+ void compileGetByIdSlowCase(int resultVReg, int baseVReg, Identifier* ident, Vector<SlowCaseEntry>::iterator& iter, bool isMethodCheck = false);
+#endif
+ void compileGetDirectOffset(RegisterID base, RegisterID resultTag, RegisterID resultPayload, Structure* structure, size_t cachedOffset);
+ void compileGetDirectOffset(JSObject* base, RegisterID temp, RegisterID resultTag, RegisterID resultPayload, size_t cachedOffset);
+ void compileGetDirectOffset(RegisterID base, RegisterID resultTag, RegisterID resultPayload, RegisterID structure, RegisterID offset);
+ void compilePutDirectOffset(RegisterID base, RegisterID valueTag, RegisterID valuePayload, Structure* structure, size_t cachedOffset);
+
+ // Arithmetic opcode helpers
+ void emitAdd32Constant(unsigned dst, unsigned op, int32_t constant, ResultType opType);
+ void emitSub32Constant(unsigned dst, unsigned op, int32_t constant, ResultType opType);
+ void emitBinaryDoubleOp(OpcodeID, unsigned dst, unsigned op1, unsigned op2, OperandTypes, JumpList& notInt32Op1, JumpList& notInt32Op2, bool op1IsInRegisters = true, bool op2IsInRegisters = true);
+
+#if CPU(X86)
+ // These architecture specific value are used to enable patching - see comment on op_put_by_id.
+ static const int patchOffsetPutByIdStructure = 7;
+ static const int patchOffsetPutByIdExternalLoad = 13;
+ static const int patchLengthPutByIdExternalLoad = 3;
+ static const int patchOffsetPutByIdPropertyMapOffset1 = 22;
+ static const int patchOffsetPutByIdPropertyMapOffset2 = 28;
+ // These architecture specific value are used to enable patching - see comment on op_get_by_id.
+ static const int patchOffsetGetByIdStructure = 7;
+ static const int patchOffsetGetByIdBranchToSlowCase = 13;
+ static const int patchOffsetGetByIdExternalLoad = 13;
+ static const int patchLengthGetByIdExternalLoad = 3;
+ static const int patchOffsetGetByIdPropertyMapOffset1 = 22;
+ static const int patchOffsetGetByIdPropertyMapOffset2 = 28;
+ static const int patchOffsetGetByIdPutResult = 28;
+#if ENABLE(OPCODE_SAMPLING)
+ static const int patchOffsetGetByIdSlowCaseCall = 37;
+#else
+ static const int patchOffsetGetByIdSlowCaseCall = 27;
+#endif
+ static const int patchOffsetOpCallCompareToJump = 6;
+
+ static const int patchOffsetMethodCheckProtoObj = 11;
+ static const int patchOffsetMethodCheckProtoStruct = 18;
+ static const int patchOffsetMethodCheckPutFunction = 29;
+#elif CPU(ARM_TRADITIONAL)
+ // These architecture specific value are used to enable patching - see comment on op_put_by_id.
+ static const int patchOffsetPutByIdStructure = 4;
+ static const int patchOffsetPutByIdExternalLoad = 16;
+ static const int patchLengthPutByIdExternalLoad = 4;
+ static const int patchOffsetPutByIdPropertyMapOffset1 = 20;
+ static const int patchOffsetPutByIdPropertyMapOffset2 = 28;
+ // These architecture specific value are used to enable patching - see comment on op_get_by_id.
+ static const int patchOffsetGetByIdStructure = 4;
+ static const int patchOffsetGetByIdBranchToSlowCase = 16;
+ static const int patchOffsetGetByIdExternalLoad = 16;
+ static const int patchLengthGetByIdExternalLoad = 4;
+ static const int patchOffsetGetByIdPropertyMapOffset1 = 20;
+ static const int patchOffsetGetByIdPropertyMapOffset2 = 28;
+ static const int patchOffsetGetByIdPutResult = 36;
+#if ENABLE(OPCODE_SAMPLING)
+ #error "OPCODE_SAMPLING is not yet supported"
+#else
+ static const int patchOffsetGetByIdSlowCaseCall = 32;
+#endif
+ static const int patchOffsetOpCallCompareToJump = 12;
+
+ static const int patchOffsetMethodCheckProtoObj = 12;
+ static const int patchOffsetMethodCheckProtoStruct = 20;
+ static const int patchOffsetMethodCheckPutFunction = 32;
+
+ // sequenceOpCall
+ static const int sequenceOpCallInstructionSpace = 12;
+ static const int sequenceOpCallConstantSpace = 2;
+ // sequenceMethodCheck
+ static const int sequenceMethodCheckInstructionSpace = 40;
+ static const int sequenceMethodCheckConstantSpace = 6;
+ // sequenceGetByIdHotPath
+ static const int sequenceGetByIdHotPathInstructionSpace = 36;
+ static const int sequenceGetByIdHotPathConstantSpace = 4;
+ // sequenceGetByIdSlowCase
+ static const int sequenceGetByIdSlowCaseInstructionSpace = 56;
+ static const int sequenceGetByIdSlowCaseConstantSpace = 2;
+ // sequencePutById
+ static const int sequencePutByIdInstructionSpace = 36;
+ static const int sequencePutByIdConstantSpace = 4;
+#elif CPU(ARM_THUMB2)
+ // These architecture specific value are used to enable patching - see comment on op_put_by_id.
+ static const int patchOffsetPutByIdStructure = 10;
+ static const int patchOffsetPutByIdExternalLoad = 26;
+ static const int patchLengthPutByIdExternalLoad = 12;
+ static const int patchOffsetPutByIdPropertyMapOffset1 = 46;
+ static const int patchOffsetPutByIdPropertyMapOffset2 = 58;
+ // These architecture specific value are used to enable patching - see comment on op_get_by_id.
+ static const int patchOffsetGetByIdStructure = 10;
+ static const int patchOffsetGetByIdBranchToSlowCase = 26;
+ static const int patchOffsetGetByIdExternalLoad = 26;
+ static const int patchLengthGetByIdExternalLoad = 12;
+ static const int patchOffsetGetByIdPropertyMapOffset1 = 46;
+ static const int patchOffsetGetByIdPropertyMapOffset2 = 58;
+ static const int patchOffsetGetByIdPutResult = 62;
+#if ENABLE(OPCODE_SAMPLING)
+ #error "OPCODE_SAMPLING is not yet supported"
+#else
+ static const int patchOffsetGetByIdSlowCaseCall = 30;
+#endif
+ static const int patchOffsetOpCallCompareToJump = 16;
+
+ static const int patchOffsetMethodCheckProtoObj = 24;
+ static const int patchOffsetMethodCheckProtoStruct = 34;
+ static const int patchOffsetMethodCheckPutFunction = 58;
+
+ // sequenceOpCall
+ static const int sequenceOpCallInstructionSpace = 12;
+ static const int sequenceOpCallConstantSpace = 2;
+ // sequenceMethodCheck
+ static const int sequenceMethodCheckInstructionSpace = 40;
+ static const int sequenceMethodCheckConstantSpace = 6;
+ // sequenceGetByIdHotPath
+ static const int sequenceGetByIdHotPathInstructionSpace = 36;
+ static const int sequenceGetByIdHotPathConstantSpace = 4;
+ // sequenceGetByIdSlowCase
+ static const int sequenceGetByIdSlowCaseInstructionSpace = 40;
+ static const int sequenceGetByIdSlowCaseConstantSpace = 2;
+ // sequencePutById
+ static const int sequencePutByIdInstructionSpace = 36;
+ static const int sequencePutByIdConstantSpace = 4;
+#elif CPU(MIPS)
+#if WTF_MIPS_ISA(1)
+ static const int patchOffsetPutByIdStructure = 16;
+ static const int patchOffsetPutByIdExternalLoad = 48;
+ static const int patchLengthPutByIdExternalLoad = 20;
+ static const int patchOffsetPutByIdPropertyMapOffset1 = 68;
+ static const int patchOffsetPutByIdPropertyMapOffset2 = 84;
+ static const int patchOffsetGetByIdStructure = 16;
+ static const int patchOffsetGetByIdBranchToSlowCase = 48;
+ static const int patchOffsetGetByIdExternalLoad = 48;
+ static const int patchLengthGetByIdExternalLoad = 20;
+ static const int patchOffsetGetByIdPropertyMapOffset1 = 68;
+ static const int patchOffsetGetByIdPropertyMapOffset2 = 88;
+ static const int patchOffsetGetByIdPutResult = 108;
+#if ENABLE(OPCODE_SAMPLING)
+ #error "OPCODE_SAMPLING is not yet supported"
+#else
+ static const int patchOffsetGetByIdSlowCaseCall = 44;
+#endif
+ static const int patchOffsetOpCallCompareToJump = 32;
+ static const int patchOffsetMethodCheckProtoObj = 32;
+ static const int patchOffsetMethodCheckProtoStruct = 56;
+ static const int patchOffsetMethodCheckPutFunction = 88;
+#else // WTF_MIPS_ISA(1)
+ static const int patchOffsetPutByIdStructure = 12;
+ static const int patchOffsetPutByIdExternalLoad = 44;
+ static const int patchLengthPutByIdExternalLoad = 16;
+ static const int patchOffsetPutByIdPropertyMapOffset1 = 60;
+ static const int patchOffsetPutByIdPropertyMapOffset2 = 76;
+ static const int patchOffsetGetByIdStructure = 12;
+ static const int patchOffsetGetByIdBranchToSlowCase = 44;
+ static const int patchOffsetGetByIdExternalLoad = 44;
+ static const int patchLengthGetByIdExternalLoad = 16;
+ static const int patchOffsetGetByIdPropertyMapOffset1 = 60;
+ static const int patchOffsetGetByIdPropertyMapOffset2 = 76;
+ static const int patchOffsetGetByIdPutResult = 92;
+#if ENABLE(OPCODE_SAMPLING)
+ #error "OPCODE_SAMPLING is not yet supported"
+#else
+ static const int patchOffsetGetByIdSlowCaseCall = 44;
+#endif
+ static const int patchOffsetOpCallCompareToJump = 32;
+ static const int patchOffsetMethodCheckProtoObj = 32;
+ static const int patchOffsetMethodCheckProtoStruct = 52;
+ static const int patchOffsetMethodCheckPutFunction = 84;
+#endif
+#else
+#error "JSVALUE32_64 not supported on this platform."
+#endif
+
+#else // USE(JSVALUE32_64)
+ void emitGetVirtualRegister(int src, RegisterID dst);
+ void emitGetVirtualRegisters(int src1, RegisterID dst1, int src2, RegisterID dst2);
+ void emitPutVirtualRegister(unsigned dst, RegisterID from = regT0);
+
+ int32_t getConstantOperandImmediateInt(unsigned src);
+
+ void emitGetVariableObjectRegister(RegisterID variableObject, int index, RegisterID dst);
+ void emitPutVariableObjectRegister(RegisterID src, RegisterID variableObject, int index);
+
+ void killLastResultRegister();
+
+ Jump emitJumpIfJSCell(RegisterID);
+ Jump emitJumpIfBothJSCells(RegisterID, RegisterID, RegisterID);
+ void emitJumpSlowCaseIfJSCell(RegisterID);
+ Jump emitJumpIfNotJSCell(RegisterID);
+ void emitJumpSlowCaseIfNotJSCell(RegisterID);
+ void emitJumpSlowCaseIfNotJSCell(RegisterID, int VReg);
+#if USE(JSVALUE32_64)
+ JIT::Jump emitJumpIfImmediateNumber(RegisterID reg)
+ {
+ return emitJumpIfImmediateInteger(reg);
+ }
+
+ JIT::Jump emitJumpIfNotImmediateNumber(RegisterID reg)
+ {
+ return emitJumpIfNotImmediateInteger(reg);
+ }
+#endif
+ JIT::Jump emitJumpIfImmediateInteger(RegisterID);
+ JIT::Jump emitJumpIfNotImmediateInteger(RegisterID);
+ JIT::Jump emitJumpIfNotImmediateIntegers(RegisterID, RegisterID, RegisterID);
+ void emitJumpSlowCaseIfNotImmediateInteger(RegisterID);
+ void emitJumpSlowCaseIfNotImmediateNumber(RegisterID);
+ void emitJumpSlowCaseIfNotImmediateIntegers(RegisterID, RegisterID, RegisterID);
+
+#if USE(JSVALUE32_64)
+ void emitFastArithDeTagImmediate(RegisterID);
+ Jump emitFastArithDeTagImmediateJumpIfZero(RegisterID);
+#endif
+ void emitFastArithReTagImmediate(RegisterID src, RegisterID dest);
+ void emitFastArithIntToImmNoCheck(RegisterID src, RegisterID dest);
+
+ void emitTagAsBoolImmediate(RegisterID reg);
+ void compileBinaryArithOp(OpcodeID, unsigned dst, unsigned src1, unsigned src2, OperandTypes opi);
+#if USE(JSVALUE64)
+ void compileBinaryArithOpSlowCase(OpcodeID, Vector<SlowCaseEntry>::iterator&, unsigned dst, unsigned src1, unsigned src2, OperandTypes, bool op1HasImmediateIntFastCase, bool op2HasImmediateIntFastCase);
+#else
+ void compileBinaryArithOpSlowCase(OpcodeID, Vector<SlowCaseEntry>::iterator&, unsigned dst, unsigned src1, unsigned src2, OperandTypes);
+#endif
+
+#if ENABLE(JIT_OPTIMIZE_PROPERTY_ACCESS)
+ void compileGetByIdHotPath(int resultVReg, int baseVReg, Identifier* ident, unsigned propertyAccessInstructionIndex);
+ void compileGetByIdSlowCase(int resultVReg, int baseVReg, Identifier* ident, Vector<SlowCaseEntry>::iterator& iter, bool isMethodCheck = false);
+#endif
+ void compileGetDirectOffset(RegisterID base, RegisterID result, Structure* structure, size_t cachedOffset);
+ void compileGetDirectOffset(JSObject* base, RegisterID temp, RegisterID result, size_t cachedOffset);
+ void compileGetDirectOffset(RegisterID base, RegisterID result, RegisterID structure, RegisterID offset, RegisterID scratch);
+ void compilePutDirectOffset(RegisterID base, RegisterID value, Structure* structure, size_t cachedOffset);
+
+#if CPU(X86_64)
+ // These architecture specific value are used to enable patching - see comment on op_put_by_id.
+ static const int patchOffsetPutByIdStructure = 10;
+ static const int patchOffsetPutByIdExternalLoad = 20;
+ static const int patchLengthPutByIdExternalLoad = 4;
+ static const int patchOffsetPutByIdPropertyMapOffset = 31;
+ // These architecture specific value are used to enable patching - see comment on op_get_by_id.
+ static const int patchOffsetGetByIdStructure = 10;
+ static const int patchOffsetGetByIdBranchToSlowCase = 20;
+ static const int patchOffsetGetByIdExternalLoad = 20;
+ static const int patchLengthGetByIdExternalLoad = 4;
+ static const int patchOffsetGetByIdPropertyMapOffset = 31;
+ static const int patchOffsetGetByIdPutResult = 31;
+#if ENABLE(OPCODE_SAMPLING)
+ static const int patchOffsetGetByIdSlowCaseCall = 64;
+#else
+ static const int patchOffsetGetByIdSlowCaseCall = 41;
+#endif
+ static const int patchOffsetOpCallCompareToJump = 9;
+
+ static const int patchOffsetMethodCheckProtoObj = 20;
+ static const int patchOffsetMethodCheckProtoStruct = 30;
+ static const int patchOffsetMethodCheckPutFunction = 50;
+#elif CPU(X86)
+ // These architecture specific value are used to enable patching - see comment on op_put_by_id.
+ static const int patchOffsetPutByIdStructure = 7;
+ static const int patchOffsetPutByIdExternalLoad = 13;
+ static const int patchLengthPutByIdExternalLoad = 3;
+ static const int patchOffsetPutByIdPropertyMapOffset = 22;
+ // These architecture specific value are used to enable patching - see comment on op_get_by_id.
+ static const int patchOffsetGetByIdStructure = 7;
+ static const int patchOffsetGetByIdBranchToSlowCase = 13;
+ static const int patchOffsetGetByIdExternalLoad = 13;
+ static const int patchLengthGetByIdExternalLoad = 3;
+ static const int patchOffsetGetByIdPropertyMapOffset = 22;
+ static const int patchOffsetGetByIdPutResult = 22;
+#if ENABLE(OPCODE_SAMPLING)
+ static const int patchOffsetGetByIdSlowCaseCall = 33;
+#else
+ static const int patchOffsetGetByIdSlowCaseCall = 23;
+#endif
+ static const int patchOffsetOpCallCompareToJump = 6;
+
+ static const int patchOffsetMethodCheckProtoObj = 11;
+ static const int patchOffsetMethodCheckProtoStruct = 18;
+ static const int patchOffsetMethodCheckPutFunction = 29;
+#elif CPU(ARM_THUMB2)
+ // These architecture specific value are used to enable patching - see comment on op_put_by_id.
+ static const int patchOffsetPutByIdStructure = 10;
+ static const int patchOffsetPutByIdExternalLoad = 26;
+ static const int patchLengthPutByIdExternalLoad = 12;
+ static const int patchOffsetPutByIdPropertyMapOffset = 46;
+ // These architecture specific value are used to enable patching - see comment on op_get_by_id.
+ static const int patchOffsetGetByIdStructure = 10;
+ static const int patchOffsetGetByIdBranchToSlowCase = 26;
+ static const int patchOffsetGetByIdExternalLoad = 26;
+ static const int patchLengthGetByIdExternalLoad = 12;
+ static const int patchOffsetGetByIdPropertyMapOffset = 46;
+ static const int patchOffsetGetByIdPutResult = 50;
+#if ENABLE(OPCODE_SAMPLING)
+ static const int patchOffsetGetByIdSlowCaseCall = 0; // FIMXE
+#else
+ static const int patchOffsetGetByIdSlowCaseCall = 28;
+#endif
+ static const int patchOffsetOpCallCompareToJump = 16;
+
+ static const int patchOffsetMethodCheckProtoObj = 24;
+ static const int patchOffsetMethodCheckProtoStruct = 34;
+ static const int patchOffsetMethodCheckPutFunction = 58;
+#elif CPU(ARM_TRADITIONAL)
+ // These architecture specific value are used to enable patching - see comment on op_put_by_id.
+ static const int patchOffsetPutByIdStructure = 4;
+ static const int patchOffsetPutByIdExternalLoad = 16;
+ static const int patchLengthPutByIdExternalLoad = 4;
+ static const int patchOffsetPutByIdPropertyMapOffset = 20;
+ // These architecture specific value are used to enable patching - see comment on op_get_by_id.
+ static const int patchOffsetGetByIdStructure = 4;
+ static const int patchOffsetGetByIdBranchToSlowCase = 16;
+ static const int patchOffsetGetByIdExternalLoad = 16;
+ static const int patchLengthGetByIdExternalLoad = 4;
+ static const int patchOffsetGetByIdPropertyMapOffset = 20;
+ static const int patchOffsetGetByIdPutResult = 28;
+#if ENABLE(OPCODE_SAMPLING)
+ #error "OPCODE_SAMPLING is not yet supported"
+#else
+ static const int patchOffsetGetByIdSlowCaseCall = 28;
+#endif
+ static const int patchOffsetOpCallCompareToJump = 12;
+
+ static const int patchOffsetMethodCheckProtoObj = 12;
+ static const int patchOffsetMethodCheckProtoStruct = 20;
+ static const int patchOffsetMethodCheckPutFunction = 32;
+
+ // sequenceOpCall
+ static const int sequenceOpCallInstructionSpace = 12;
+ static const int sequenceOpCallConstantSpace = 2;
+ // sequenceMethodCheck
+ static const int sequenceMethodCheckInstructionSpace = 40;
+ static const int sequenceMethodCheckConstantSpace = 6;
+ // sequenceGetByIdHotPath
+ static const int sequenceGetByIdHotPathInstructionSpace = 28;
+ static const int sequenceGetByIdHotPathConstantSpace = 3;
+ // sequenceGetByIdSlowCase
+ static const int sequenceGetByIdSlowCaseInstructionSpace = 32;
+ static const int sequenceGetByIdSlowCaseConstantSpace = 2;
+ // sequencePutById
+ static const int sequencePutByIdInstructionSpace = 28;
+ static const int sequencePutByIdConstantSpace = 3;
+#elif CPU(MIPS)
+#if WTF_MIPS_ISA(1)
+ static const int patchOffsetPutByIdStructure = 16;
+ static const int patchOffsetPutByIdExternalLoad = 48;
+ static const int patchLengthPutByIdExternalLoad = 20;
+ static const int patchOffsetPutByIdPropertyMapOffset = 68;
+ static const int patchOffsetGetByIdStructure = 16;
+ static const int patchOffsetGetByIdBranchToSlowCase = 48;
+ static const int patchOffsetGetByIdExternalLoad = 48;
+ static const int patchLengthGetByIdExternalLoad = 20;
+ static const int patchOffsetGetByIdPropertyMapOffset = 68;
+ static const int patchOffsetGetByIdPutResult = 88;
+#if ENABLE(OPCODE_SAMPLING)
+ #error "OPCODE_SAMPLING is not yet supported"
+#else
+ static const int patchOffsetGetByIdSlowCaseCall = 40;
+#endif
+ static const int patchOffsetOpCallCompareToJump = 32;
+ static const int patchOffsetMethodCheckProtoObj = 32;
+ static const int patchOffsetMethodCheckProtoStruct = 56;
+ static const int patchOffsetMethodCheckPutFunction = 88;
+#else // WTF_MIPS_ISA(1)
+ static const int patchOffsetPutByIdStructure = 12;
+ static const int patchOffsetPutByIdExternalLoad = 44;
+ static const int patchLengthPutByIdExternalLoad = 16;
+ static const int patchOffsetPutByIdPropertyMapOffset = 60;
+ static const int patchOffsetGetByIdStructure = 12;
+ static const int patchOffsetGetByIdBranchToSlowCase = 44;
+ static const int patchOffsetGetByIdExternalLoad = 44;
+ static const int patchLengthGetByIdExternalLoad = 16;
+ static const int patchOffsetGetByIdPropertyMapOffset = 60;
+ static const int patchOffsetGetByIdPutResult = 76;
+#if ENABLE(OPCODE_SAMPLING)
+ #error "OPCODE_SAMPLING is not yet supported"
+#else
+ static const int patchOffsetGetByIdSlowCaseCall = 40;
+#endif
+ static const int patchOffsetOpCallCompareToJump = 32;
+ static const int patchOffsetMethodCheckProtoObj = 32;
+ static const int patchOffsetMethodCheckProtoStruct = 52;
+ static const int patchOffsetMethodCheckPutFunction = 84;
+#endif
+#endif
+#endif // USE(JSVALUE32_64)
+
+#if (defined(ASSEMBLER_HAS_CONSTANT_POOL) && ASSEMBLER_HAS_CONSTANT_POOL)
+#define BEGIN_UNINTERRUPTED_SEQUENCE(name) do { beginUninterruptedSequence(name ## InstructionSpace, name ## ConstantSpace); } while (false)
+#define END_UNINTERRUPTED_SEQUENCE(name) do { endUninterruptedSequence(name ## InstructionSpace, name ## ConstantSpace); } while (false)
+
+ void beginUninterruptedSequence(int, int);
+ void endUninterruptedSequence(int, int);
+
+#else
+#define BEGIN_UNINTERRUPTED_SEQUENCE(name) do { beginUninterruptedSequence(); } while (false)
+#define END_UNINTERRUPTED_SEQUENCE(name) do { endUninterruptedSequence(); } while (false)
+#endif
+
+ void emit_op_add(Instruction*);
+ void emit_op_bitand(Instruction*);
+ void emit_op_bitnot(Instruction*);
+ void emit_op_bitor(Instruction*);
+ void emit_op_bitxor(Instruction*);
+ void emit_op_call(Instruction*);
+ void emit_op_call_eval(Instruction*);
+ void emit_op_call_varargs(Instruction*);
+ void emit_op_call_put_result(Instruction*);
+ void emit_op_catch(Instruction*);
+ void emit_op_construct(Instruction*);
+ void emit_op_get_callee(Instruction*);
+ void emit_op_create_this(Instruction*);
+ void emit_op_convert_this(Instruction*);
+ void emit_op_convert_this_strict(Instruction*);
+ void emit_op_create_arguments(Instruction*);
+ void emit_op_debug(Instruction*);
+ void emit_op_del_by_id(Instruction*);
+ void emit_op_div(Instruction*);
+ void emit_op_end(Instruction*);
+ void emit_op_enter(Instruction*);
+ void emit_op_create_activation(Instruction*);
+ void emit_op_eq(Instruction*);
+ void emit_op_eq_null(Instruction*);
+ void emit_op_get_by_id(Instruction*);
+ void emit_op_get_arguments_length(Instruction*);
+ void emit_op_get_by_val(Instruction*);
+ void emit_op_get_argument_by_val(Instruction*);
+ void emit_op_get_by_pname(Instruction*);
+ void emit_op_get_global_var(Instruction*);
+ void emit_op_get_scoped_var(Instruction*);
+ void emit_op_init_lazy_reg(Instruction*);
+ void emit_op_check_has_instance(Instruction*);
+ void emit_op_instanceof(Instruction*);
+ void emit_op_jeq_null(Instruction*);
+ void emit_op_jfalse(Instruction*);
+ void emit_op_jmp(Instruction*);
+ void emit_op_jmp_scopes(Instruction*);
+ void emit_op_jneq_null(Instruction*);
+ void emit_op_jneq_ptr(Instruction*);
+ void emit_op_jnless(Instruction*);
+ void emit_op_jless(Instruction*);
+ void emit_op_jlesseq(Instruction*, bool invert = false);
+ void emit_op_jnlesseq(Instruction*);
+ void emit_op_jsr(Instruction*);
+ void emit_op_jtrue(Instruction*);
+ void emit_op_load_varargs(Instruction*);
+ void emit_op_loop(Instruction*);
+ void emit_op_loop_if_less(Instruction*);
+ void emit_op_loop_if_lesseq(Instruction*);
+ void emit_op_loop_if_true(Instruction*);
+ void emit_op_loop_if_false(Instruction*);
+ void emit_op_lshift(Instruction*);
+ void emit_op_method_check(Instruction*);
+ void emit_op_mod(Instruction*);
+ void emit_op_mov(Instruction*);
+ void emit_op_mul(Instruction*);
+ void emit_op_negate(Instruction*);
+ void emit_op_neq(Instruction*);
+ void emit_op_neq_null(Instruction*);
+ void emit_op_new_array(Instruction*);
+ void emit_op_new_func(Instruction*);
+ void emit_op_new_func_exp(Instruction*);
+ void emit_op_new_object(Instruction*);
+ void emit_op_new_regexp(Instruction*);
+ void emit_op_get_pnames(Instruction*);
+ void emit_op_next_pname(Instruction*);
+ void emit_op_not(Instruction*);
+ void emit_op_nstricteq(Instruction*);
+ void emit_op_pop_scope(Instruction*);
+ void emit_op_post_dec(Instruction*);
+ void emit_op_post_inc(Instruction*);
+ void emit_op_pre_dec(Instruction*);
+ void emit_op_pre_inc(Instruction*);
+ void emit_op_profile_did_call(Instruction*);
+ void emit_op_profile_will_call(Instruction*);
+ void emit_op_push_new_scope(Instruction*);
+ void emit_op_push_scope(Instruction*);
+ void emit_op_put_by_id(Instruction*);
+ void emit_op_put_by_index(Instruction*);
+ void emit_op_put_by_val(Instruction*);
+ void emit_op_put_getter(Instruction*);
+ void emit_op_put_global_var(Instruction*);
+ void emit_op_put_scoped_var(Instruction*);
+ void emit_op_put_setter(Instruction*);
+ void emit_op_resolve(Instruction*);
+ void emit_op_resolve_base(Instruction*);
+ void emit_op_ensure_property_exists(Instruction*);
+ void emit_op_resolve_global(Instruction*, bool dynamic = false);
+ void emit_op_resolve_global_dynamic(Instruction*);
+ void emit_op_resolve_skip(Instruction*);
+ void emit_op_resolve_with_base(Instruction*);
+ void emit_op_ret(Instruction*);
+ void emit_op_ret_object_or_this(Instruction*);
+ void emit_op_rshift(Instruction*);
+ void emit_op_sret(Instruction*);
+ void emit_op_strcat(Instruction*);
+ void emit_op_stricteq(Instruction*);
+ void emit_op_sub(Instruction*);
+ void emit_op_switch_char(Instruction*);
+ void emit_op_switch_imm(Instruction*);
+ void emit_op_switch_string(Instruction*);
+ void emit_op_tear_off_activation(Instruction*);
+ void emit_op_tear_off_arguments(Instruction*);
+ void emit_op_throw(Instruction*);
+ void emit_op_throw_reference_error(Instruction*);
+ void emit_op_throw_syntax_error(Instruction*);
+ void emit_op_to_jsnumber(Instruction*);
+ void emit_op_to_primitive(Instruction*);
+ void emit_op_unexpected_load(Instruction*);
+ void emit_op_urshift(Instruction*);
+#if ENABLE(JIT_USE_SOFT_MODULO)
+ void softModulo();
+#endif
+
+ void emitSlow_op_add(Instruction*, Vector<SlowCaseEntry>::iterator&);
+ void emitSlow_op_bitand(Instruction*, Vector<SlowCaseEntry>::iterator&);
+ void emitSlow_op_bitnot(Instruction*, Vector<SlowCaseEntry>::iterator&);
+ void emitSlow_op_bitor(Instruction*, Vector<SlowCaseEntry>::iterator&);
+ void emitSlow_op_bitxor(Instruction*, Vector<SlowCaseEntry>::iterator&);
+ void emitSlow_op_call(Instruction*, Vector<SlowCaseEntry>::iterator&);
+ void emitSlow_op_call_eval(Instruction*, Vector<SlowCaseEntry>::iterator&);
+ void emitSlow_op_call_varargs(Instruction*, Vector<SlowCaseEntry>::iterator&);
+ void emitSlow_op_construct(Instruction*, Vector<SlowCaseEntry>::iterator&);
+ void emitSlow_op_convert_this(Instruction*, Vector<SlowCaseEntry>::iterator&);
+ void emitSlow_op_convert_this_strict(Instruction*, Vector<SlowCaseEntry>::iterator&);
+ void emitSlow_op_div(Instruction*, Vector<SlowCaseEntry>::iterator&);
+ void emitSlow_op_eq(Instruction*, Vector<SlowCaseEntry>::iterator&);
+ void emitSlow_op_get_by_id(Instruction*, Vector<SlowCaseEntry>::iterator&);
+ void emitSlow_op_get_arguments_length(Instruction*, Vector<SlowCaseEntry>::iterator&);
+ void emitSlow_op_get_by_val(Instruction*, Vector<SlowCaseEntry>::iterator&);
+ void emitSlow_op_get_argument_by_val(Instruction*, Vector<SlowCaseEntry>::iterator&);
+ void emitSlow_op_get_by_pname(Instruction*, Vector<SlowCaseEntry>::iterator&);
+ void emitSlow_op_check_has_instance(Instruction*, Vector<SlowCaseEntry>::iterator&);
+ void emitSlow_op_instanceof(Instruction*, Vector<SlowCaseEntry>::iterator&);
+ void emitSlow_op_jfalse(Instruction*, Vector<SlowCaseEntry>::iterator&);
+ void emitSlow_op_jnless(Instruction*, Vector<SlowCaseEntry>::iterator&);
+ void emitSlow_op_jless(Instruction*, Vector<SlowCaseEntry>::iterator&);
+ void emitSlow_op_jlesseq(Instruction*, Vector<SlowCaseEntry>::iterator&, bool invert = false);
+ void emitSlow_op_jnlesseq(Instruction*, Vector<SlowCaseEntry>::iterator&);
+ void emitSlow_op_jtrue(Instruction*, Vector<SlowCaseEntry>::iterator&);
+ void emitSlow_op_load_varargs(Instruction*, Vector<SlowCaseEntry>::iterator&);
+ void emitSlow_op_loop_if_less(Instruction*, Vector<SlowCaseEntry>::iterator&);
+ void emitSlow_op_loop_if_lesseq(Instruction*, Vector<SlowCaseEntry>::iterator&);
+ void emitSlow_op_loop_if_true(Instruction*, Vector<SlowCaseEntry>::iterator&);
+ void emitSlow_op_loop_if_false(Instruction*, Vector<SlowCaseEntry>::iterator&);
+ void emitSlow_op_lshift(Instruction*, Vector<SlowCaseEntry>::iterator&);
+ void emitSlow_op_method_check(Instruction*, Vector<SlowCaseEntry>::iterator&);
+ void emitSlow_op_mod(Instruction*, Vector<SlowCaseEntry>::iterator&);
+ void emitSlow_op_mul(Instruction*, Vector<SlowCaseEntry>::iterator&);
+ void emitSlow_op_negate(Instruction*, Vector<SlowCaseEntry>::iterator&);
+ void emitSlow_op_neq(Instruction*, Vector<SlowCaseEntry>::iterator&);
+ void emitSlow_op_not(Instruction*, Vector<SlowCaseEntry>::iterator&);
+ void emitSlow_op_nstricteq(Instruction*, Vector<SlowCaseEntry>::iterator&);
+ void emitSlow_op_post_dec(Instruction*, Vector<SlowCaseEntry>::iterator&);
+ void emitSlow_op_post_inc(Instruction*, Vector<SlowCaseEntry>::iterator&);
+ void emitSlow_op_pre_dec(Instruction*, Vector<SlowCaseEntry>::iterator&);
+ void emitSlow_op_pre_inc(Instruction*, Vector<SlowCaseEntry>::iterator&);
+ void emitSlow_op_put_by_id(Instruction*, Vector<SlowCaseEntry>::iterator&);
+ void emitSlow_op_put_by_val(Instruction*, Vector<SlowCaseEntry>::iterator&);
+ void emitSlow_op_resolve_global(Instruction*, Vector<SlowCaseEntry>::iterator&);
+ void emitSlow_op_resolve_global_dynamic(Instruction*, Vector<SlowCaseEntry>::iterator&);
+ void emitSlow_op_rshift(Instruction*, Vector<SlowCaseEntry>::iterator&);
+ void emitSlow_op_stricteq(Instruction*, Vector<SlowCaseEntry>::iterator&);
+ void emitSlow_op_sub(Instruction*, Vector<SlowCaseEntry>::iterator&);
+ void emitSlow_op_to_jsnumber(Instruction*, Vector<SlowCaseEntry>::iterator&);
+ void emitSlow_op_to_primitive(Instruction*, Vector<SlowCaseEntry>::iterator&);
+ void emitSlow_op_urshift(Instruction*, Vector<SlowCaseEntry>::iterator&);
+
+
+ void emitRightShift(Instruction*, bool isUnsigned);
+ void emitRightShiftSlowCase(Instruction*, Vector<SlowCaseEntry>::iterator&, bool isUnsigned);
+
+ /* This function is deprecated. */
+ void emitGetJITStubArg(unsigned argumentNumber, RegisterID dst);
+
+ void emitInitRegister(unsigned dst);
+
+ void emitPutToCallFrameHeader(RegisterID from, RegisterFile::CallFrameHeaderEntry entry);
+ void emitPutImmediateToCallFrameHeader(void* value, RegisterFile::CallFrameHeaderEntry entry);
+ void emitGetFromCallFrameHeaderPtr(RegisterFile::CallFrameHeaderEntry entry, RegisterID to, RegisterID from = callFrameRegister);
+ void emitGetFromCallFrameHeader32(RegisterFile::CallFrameHeaderEntry entry, RegisterID to, RegisterID from = callFrameRegister);
+
+ JSValue getConstantOperand(unsigned src);
+ bool isOperandConstantImmediateInt(unsigned src);
+ bool isOperandConstantImmediateChar(unsigned src);
+
+ Jump getSlowCase(Vector<SlowCaseEntry>::iterator& iter)
+ {
+ return iter++->from;
+ }
+ void linkSlowCase(Vector<SlowCaseEntry>::iterator& iter)
+ {
+ iter->from.link(this);
+ ++iter;
+ }
+ void linkSlowCaseIfNotJSCell(Vector<SlowCaseEntry>::iterator&, int vReg);
+
+ Jump checkStructure(RegisterID reg, Structure* structure);
+
+ void restoreArgumentReference();
+ void restoreArgumentReferenceForTrampoline();
+
+ Call emitNakedCall(CodePtr function = CodePtr());
+
+ void preserveReturnAddressAfterCall(RegisterID);
+ void restoreReturnAddressBeforeReturn(RegisterID);
+ void restoreReturnAddressBeforeReturn(Address);
+
+ // Loads the character value of a single character string into dst.
+ void emitLoadCharacterString(RegisterID src, RegisterID dst, JumpList& failures);
+
+ void emitTimeoutCheck();
+#ifndef NDEBUG
+ void printBytecodeOperandTypes(unsigned src1, unsigned src2);
+#endif
+
+#if ENABLE(SAMPLING_FLAGS)
+ void setSamplingFlag(int32_t);
+ void clearSamplingFlag(int32_t);
+#endif
+
+#if ENABLE(SAMPLING_COUNTERS)
+ void emitCount(AbstractSamplingCounter&, uint32_t = 1);
+#endif
+
+#if ENABLE(OPCODE_SAMPLING)
+ void sampleInstruction(Instruction*, bool = false);
+#endif
+
+#if ENABLE(CODEBLOCK_SAMPLING)
+ void sampleCodeBlock(CodeBlock*);
+#else
+ void sampleCodeBlock(CodeBlock*) {}
+#endif
+
+ Interpreter* m_interpreter;
+ JSGlobalData* m_globalData;
+ CodeBlock* m_codeBlock;
+
+ Vector<CallRecord> m_calls;
+ Vector<Label> m_labels;
+ Vector<PropertyStubCompilationInfo> m_propertyAccessCompilationInfo;
+ Vector<StructureStubCompilationInfo> m_callStructureStubCompilationInfo;
+ Vector<MethodCallCompilationInfo> m_methodCallCompilationInfo;
+ Vector<JumpTable> m_jmpTable;
+
+ unsigned m_bytecodeOffset;
+ Vector<JSRInfo> m_jsrSites;
+ Vector<SlowCaseEntry> m_slowCases;
+ Vector<SwitchRecord> m_switches;
+
+ unsigned m_propertyAccessInstructionIndex;
+ unsigned m_globalResolveInfoIndex;
+ unsigned m_callLinkInfoIndex;
+
+#if USE(JSVALUE32_64)
+ unsigned m_jumpTargetIndex;
+ unsigned m_mappedBytecodeOffset;
+ unsigned m_mappedVirtualRegisterIndex;
+ RegisterID m_mappedTag;
+ RegisterID m_mappedPayload;
+#else
+ int m_lastResultBytecodeRegister;
+ unsigned m_jumpTargetsPosition;
+#endif
+
+#ifndef NDEBUG
+#if defined(ASSEMBLER_HAS_CONSTANT_POOL) && ASSEMBLER_HAS_CONSTANT_POOL
+ Label m_uninterruptedInstructionSequenceBegin;
+ int m_uninterruptedConstantSequenceBegin;
+#endif
+#endif
+ void* m_linkerOffset;
+ static CodePtr stringGetByValStubGenerator(JSGlobalData* globalData, ExecutablePool* pool);
+ } JIT_CLASS_ALIGNMENT;
+
+ inline void JIT::emit_op_loop(Instruction* currentInstruction)
+ {
+ emitTimeoutCheck();
+ emit_op_jmp(currentInstruction);
+ }
+
+ inline void JIT::emit_op_loop_if_true(Instruction* currentInstruction)
+ {
+ emitTimeoutCheck();
+ emit_op_jtrue(currentInstruction);
+ }
+
+ inline void JIT::emitSlow_op_loop_if_true(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+ {
+ emitSlow_op_jtrue(currentInstruction, iter);
+ }
+
+ inline void JIT::emit_op_loop_if_false(Instruction* currentInstruction)
+ {
+ emitTimeoutCheck();
+ emit_op_jfalse(currentInstruction);
+ }
+
+ inline void JIT::emitSlow_op_loop_if_false(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+ {
+ emitSlow_op_jfalse(currentInstruction, iter);
+ }
+
+ inline void JIT::emit_op_loop_if_less(Instruction* currentInstruction)
+ {
+ emitTimeoutCheck();
+ emit_op_jless(currentInstruction);
+ }
+
+ inline void JIT::emitSlow_op_loop_if_less(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+ {
+ emitSlow_op_jless(currentInstruction, iter);
+ }
+
+} // namespace JSC
+
+#endif // ENABLE(JIT)
+
+#endif // JIT_h
diff --git a/Source/JavaScriptCore/jit/JITArithmetic.cpp b/Source/JavaScriptCore/jit/JITArithmetic.cpp
new file mode 100644
index 0000000..cd05f51
--- /dev/null
+++ b/Source/JavaScriptCore/jit/JITArithmetic.cpp
@@ -0,0 +1,1244 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if ENABLE(JIT)
+#if USE(JSVALUE64)
+#include "JIT.h"
+
+#include "CodeBlock.h"
+#include "JITInlineMethods.h"
+#include "JITStubCall.h"
+#include "JITStubs.h"
+#include "JSArray.h"
+#include "JSFunction.h"
+#include "Interpreter.h"
+#include "ResultType.h"
+#include "SamplingTool.h"
+
+#ifndef NDEBUG
+#include <stdio.h>
+#endif
+
+using namespace std;
+
+namespace JSC {
+
+void JIT::emit_op_lshift(Instruction* currentInstruction)
+{
+ unsigned result = currentInstruction[1].u.operand;
+ unsigned op1 = currentInstruction[2].u.operand;
+ unsigned op2 = currentInstruction[3].u.operand;
+
+ emitGetVirtualRegisters(op1, regT0, op2, regT2);
+ // FIXME: would we be better using 'emitJumpSlowCaseIfNotImmediateIntegers'? - we *probably* ought to be consistent.
+ emitJumpSlowCaseIfNotImmediateInteger(regT0);
+ emitJumpSlowCaseIfNotImmediateInteger(regT2);
+ emitFastArithImmToInt(regT0);
+ emitFastArithImmToInt(regT2);
+ lshift32(regT2, regT0);
+ emitFastArithReTagImmediate(regT0, regT0);
+ emitPutVirtualRegister(result);
+}
+
+void JIT::emitSlow_op_lshift(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ unsigned result = currentInstruction[1].u.operand;
+ unsigned op1 = currentInstruction[2].u.operand;
+ unsigned op2 = currentInstruction[3].u.operand;
+
+ UNUSED_PARAM(op1);
+ UNUSED_PARAM(op2);
+ linkSlowCase(iter);
+ linkSlowCase(iter);
+ JITStubCall stubCall(this, cti_op_lshift);
+ stubCall.addArgument(regT0);
+ stubCall.addArgument(regT2);
+ stubCall.call(result);
+}
+
+void JIT::emit_op_rshift(Instruction* currentInstruction)
+{
+ unsigned result = currentInstruction[1].u.operand;
+ unsigned op1 = currentInstruction[2].u.operand;
+ unsigned op2 = currentInstruction[3].u.operand;
+
+ if (isOperandConstantImmediateInt(op2)) {
+ // isOperandConstantImmediateInt(op2) => 1 SlowCase
+ emitGetVirtualRegister(op1, regT0);
+ emitJumpSlowCaseIfNotImmediateInteger(regT0);
+ // Mask with 0x1f as per ecma-262 11.7.2 step 7.
+ rshift32(Imm32(getConstantOperandImmediateInt(op2) & 0x1f), regT0);
+ } else {
+ emitGetVirtualRegisters(op1, regT0, op2, regT2);
+ if (supportsFloatingPointTruncate()) {
+ Jump lhsIsInt = emitJumpIfImmediateInteger(regT0);
+ // supportsFloatingPoint() && USE(JSVALUE64) => 3 SlowCases
+ addSlowCase(emitJumpIfNotImmediateNumber(regT0));
+ addPtr(tagTypeNumberRegister, regT0);
+ movePtrToDouble(regT0, fpRegT0);
+ addSlowCase(branchTruncateDoubleToInt32(fpRegT0, regT0));
+ lhsIsInt.link(this);
+ emitJumpSlowCaseIfNotImmediateInteger(regT2);
+ } else {
+ // !supportsFloatingPoint() => 2 SlowCases
+ emitJumpSlowCaseIfNotImmediateInteger(regT0);
+ emitJumpSlowCaseIfNotImmediateInteger(regT2);
+ }
+ emitFastArithImmToInt(regT2);
+ rshift32(regT2, regT0);
+ }
+ emitFastArithIntToImmNoCheck(regT0, regT0);
+ emitPutVirtualRegister(result);
+}
+
+void JIT::emitSlow_op_rshift(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ unsigned result = currentInstruction[1].u.operand;
+ unsigned op1 = currentInstruction[2].u.operand;
+ unsigned op2 = currentInstruction[3].u.operand;
+
+ JITStubCall stubCall(this, cti_op_rshift);
+
+ if (isOperandConstantImmediateInt(op2)) {
+ linkSlowCase(iter);
+ stubCall.addArgument(regT0);
+ stubCall.addArgument(op2, regT2);
+ } else {
+ if (supportsFloatingPointTruncate()) {
+ linkSlowCase(iter);
+ linkSlowCase(iter);
+ linkSlowCase(iter);
+ // We're reloading op1 to regT0 as we can no longer guarantee that
+ // we have not munged the operand. It may have already been shifted
+ // correctly, but it still will not have been tagged.
+ stubCall.addArgument(op1, regT0);
+ stubCall.addArgument(regT2);
+ } else {
+ linkSlowCase(iter);
+ linkSlowCase(iter);
+ stubCall.addArgument(regT0);
+ stubCall.addArgument(regT2);
+ }
+ }
+
+ stubCall.call(result);
+}
+
+void JIT::emit_op_urshift(Instruction* currentInstruction)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+ unsigned op1 = currentInstruction[2].u.operand;
+ unsigned op2 = currentInstruction[3].u.operand;
+
+ // Slow case of urshift makes assumptions about what registers hold the
+ // shift arguments, so any changes must be updated there as well.
+ if (isOperandConstantImmediateInt(op2)) {
+ emitGetVirtualRegister(op1, regT0);
+ emitJumpSlowCaseIfNotImmediateInteger(regT0);
+ emitFastArithImmToInt(regT0);
+ int shift = getConstantOperand(op2).asInt32();
+ if (shift)
+ urshift32(Imm32(shift & 0x1f), regT0);
+ // unsigned shift < 0 or shift = k*2^32 may result in (essentially)
+ // a toUint conversion, which can result in a value we can represent
+ // as an immediate int.
+ if (shift < 0 || !(shift & 31))
+ addSlowCase(branch32(LessThan, regT0, Imm32(0)));
+ emitFastArithReTagImmediate(regT0, regT0);
+ emitPutVirtualRegister(dst, regT0);
+ return;
+ }
+ emitGetVirtualRegisters(op1, regT0, op2, regT1);
+ if (!isOperandConstantImmediateInt(op1))
+ emitJumpSlowCaseIfNotImmediateInteger(regT0);
+ emitJumpSlowCaseIfNotImmediateInteger(regT1);
+ emitFastArithImmToInt(regT0);
+ emitFastArithImmToInt(regT1);
+ urshift32(regT1, regT0);
+ addSlowCase(branch32(LessThan, regT0, Imm32(0)));
+ emitFastArithReTagImmediate(regT0, regT0);
+ emitPutVirtualRegister(dst, regT0);
+}
+
+void JIT::emitSlow_op_urshift(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+ unsigned op1 = currentInstruction[2].u.operand;
+ unsigned op2 = currentInstruction[3].u.operand;
+ if (isOperandConstantImmediateInt(op2)) {
+ int shift = getConstantOperand(op2).asInt32();
+ // op1 = regT0
+ linkSlowCase(iter); // int32 check
+ if (supportsFloatingPointTruncate()) {
+ JumpList failures;
+ failures.append(emitJumpIfNotImmediateNumber(regT0)); // op1 is not a double
+ addPtr(tagTypeNumberRegister, regT0);
+ movePtrToDouble(regT0, fpRegT0);
+ failures.append(branchTruncateDoubleToInt32(fpRegT0, regT0));
+ if (shift)
+ urshift32(Imm32(shift & 0x1f), regT0);
+ if (shift < 0 || !(shift & 31))
+ failures.append(branch32(LessThan, regT0, Imm32(0)));
+ emitFastArithReTagImmediate(regT0, regT0);
+ emitPutVirtualRegister(dst, regT0);
+ emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_rshift));
+ failures.link(this);
+ }
+ if (shift < 0 || !(shift & 31))
+ linkSlowCase(iter); // failed to box in hot path
+ } else {
+ // op1 = regT0
+ // op2 = regT1
+ if (!isOperandConstantImmediateInt(op1)) {
+ linkSlowCase(iter); // int32 check -- op1 is not an int
+ if (supportsFloatingPointTruncate()) {
+ JumpList failures;
+ failures.append(emitJumpIfNotImmediateNumber(regT0)); // op1 is not a double
+ addPtr(tagTypeNumberRegister, regT0);
+ movePtrToDouble(regT0, fpRegT0);
+ failures.append(branchTruncateDoubleToInt32(fpRegT0, regT0));
+ failures.append(emitJumpIfNotImmediateInteger(regT1)); // op2 is not an int
+ emitFastArithImmToInt(regT1);
+ urshift32(regT1, regT0);
+ failures.append(branch32(LessThan, regT0, Imm32(0)));
+ emitFastArithReTagImmediate(regT0, regT0);
+ emitPutVirtualRegister(dst, regT0);
+ emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_rshift));
+ failures.link(this);
+ }
+ }
+
+ linkSlowCase(iter); // int32 check - op2 is not an int
+ linkSlowCase(iter); // Can't represent unsigned result as an immediate
+ }
+
+ JITStubCall stubCall(this, cti_op_urshift);
+ stubCall.addArgument(op1, regT0);
+ stubCall.addArgument(op2, regT1);
+ stubCall.call(dst);
+}
+
+void JIT::emit_op_jnless(Instruction* currentInstruction)
+{
+ unsigned op1 = currentInstruction[1].u.operand;
+ unsigned op2 = currentInstruction[2].u.operand;
+ unsigned target = currentInstruction[3].u.operand;
+
+ // We generate inline code for the following cases in the fast path:
+ // - int immediate to constant int immediate
+ // - constant int immediate to int immediate
+ // - int immediate to int immediate
+
+ if (isOperandConstantImmediateChar(op1)) {
+ emitGetVirtualRegister(op2, regT0);
+ addSlowCase(emitJumpIfNotJSCell(regT0));
+ JumpList failures;
+ emitLoadCharacterString(regT0, regT0, failures);
+ addSlowCase(failures);
+ addJump(branch32(LessThanOrEqual, regT0, Imm32(asString(getConstantOperand(op1))->tryGetValue()[0])), target);
+ return;
+ }
+ if (isOperandConstantImmediateChar(op2)) {
+ emitGetVirtualRegister(op1, regT0);
+ addSlowCase(emitJumpIfNotJSCell(regT0));
+ JumpList failures;
+ emitLoadCharacterString(regT0, regT0, failures);
+ addSlowCase(failures);
+ addJump(branch32(GreaterThanOrEqual, regT0, Imm32(asString(getConstantOperand(op2))->tryGetValue()[0])), target);
+ return;
+ }
+ if (isOperandConstantImmediateInt(op2)) {
+ emitGetVirtualRegister(op1, regT0);
+ emitJumpSlowCaseIfNotImmediateInteger(regT0);
+ int32_t op2imm = getConstantOperandImmediateInt(op2);
+ addJump(branch32(GreaterThanOrEqual, regT0, Imm32(op2imm)), target);
+ } else if (isOperandConstantImmediateInt(op1)) {
+ emitGetVirtualRegister(op2, regT1);
+ emitJumpSlowCaseIfNotImmediateInteger(regT1);
+ int32_t op1imm = getConstantOperandImmediateInt(op1);
+ addJump(branch32(LessThanOrEqual, regT1, Imm32(op1imm)), target);
+ } else {
+ emitGetVirtualRegisters(op1, regT0, op2, regT1);
+ emitJumpSlowCaseIfNotImmediateInteger(regT0);
+ emitJumpSlowCaseIfNotImmediateInteger(regT1);
+
+ addJump(branch32(GreaterThanOrEqual, regT0, regT1), target);
+ }
+}
+
+void JIT::emitSlow_op_jnless(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ unsigned op1 = currentInstruction[1].u.operand;
+ unsigned op2 = currentInstruction[2].u.operand;
+ unsigned target = currentInstruction[3].u.operand;
+
+ // We generate inline code for the following cases in the slow path:
+ // - floating-point number to constant int immediate
+ // - constant int immediate to floating-point number
+ // - floating-point number to floating-point number.
+ if (isOperandConstantImmediateChar(op1) || isOperandConstantImmediateChar(op2)) {
+ linkSlowCase(iter);
+ linkSlowCase(iter);
+ linkSlowCase(iter);
+ linkSlowCase(iter);
+ JITStubCall stubCall(this, cti_op_jless);
+ stubCall.addArgument(op1, regT0);
+ stubCall.addArgument(op2, regT1);
+ stubCall.call();
+ emitJumpSlowToHot(branchTest32(Zero, regT0), target);
+ return;
+ }
+
+ if (isOperandConstantImmediateInt(op2)) {
+ linkSlowCase(iter);
+
+ if (supportsFloatingPoint()) {
+ Jump fail1 = emitJumpIfNotImmediateNumber(regT0);
+ addPtr(tagTypeNumberRegister, regT0);
+ movePtrToDouble(regT0, fpRegT0);
+
+ int32_t op2imm = getConstantOperand(op2).asInt32();;
+
+ move(Imm32(op2imm), regT1);
+ convertInt32ToDouble(regT1, fpRegT1);
+
+ emitJumpSlowToHot(branchDouble(DoubleLessThanOrEqualOrUnordered, fpRegT1, fpRegT0), target);
+
+ emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_jnless));
+
+ fail1.link(this);
+ }
+
+ JITStubCall stubCall(this, cti_op_jless);
+ stubCall.addArgument(regT0);
+ stubCall.addArgument(op2, regT2);
+ stubCall.call();
+ emitJumpSlowToHot(branchTest32(Zero, regT0), target);
+
+ } else if (isOperandConstantImmediateInt(op1)) {
+ linkSlowCase(iter);
+
+ if (supportsFloatingPoint()) {
+ Jump fail1 = emitJumpIfNotImmediateNumber(regT1);
+ addPtr(tagTypeNumberRegister, regT1);
+ movePtrToDouble(regT1, fpRegT1);
+
+ int32_t op1imm = getConstantOperand(op1).asInt32();;
+
+ move(Imm32(op1imm), regT0);
+ convertInt32ToDouble(regT0, fpRegT0);
+
+ emitJumpSlowToHot(branchDouble(DoubleLessThanOrEqualOrUnordered, fpRegT1, fpRegT0), target);
+
+ emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_jnless));
+
+ fail1.link(this);
+ }
+
+ JITStubCall stubCall(this, cti_op_jless);
+ stubCall.addArgument(op1, regT2);
+ stubCall.addArgument(regT1);
+ stubCall.call();
+ emitJumpSlowToHot(branchTest32(Zero, regT0), target);
+
+ } else {
+ linkSlowCase(iter);
+
+ if (supportsFloatingPoint()) {
+ Jump fail1 = emitJumpIfNotImmediateNumber(regT0);
+ Jump fail2 = emitJumpIfNotImmediateNumber(regT1);
+ Jump fail3 = emitJumpIfImmediateInteger(regT1);
+ addPtr(tagTypeNumberRegister, regT0);
+ addPtr(tagTypeNumberRegister, regT1);
+ movePtrToDouble(regT0, fpRegT0);
+ movePtrToDouble(regT1, fpRegT1);
+
+ emitJumpSlowToHot(branchDouble(DoubleLessThanOrEqualOrUnordered, fpRegT1, fpRegT0), target);
+
+ emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_jnless));
+
+ fail1.link(this);
+ fail2.link(this);
+ fail3.link(this);
+ }
+
+ linkSlowCase(iter);
+ JITStubCall stubCall(this, cti_op_jless);
+ stubCall.addArgument(regT0);
+ stubCall.addArgument(regT1);
+ stubCall.call();
+ emitJumpSlowToHot(branchTest32(Zero, regT0), target);
+ }
+}
+
+void JIT::emit_op_jless(Instruction* currentInstruction)
+{
+ unsigned op1 = currentInstruction[1].u.operand;
+ unsigned op2 = currentInstruction[2].u.operand;
+ unsigned target = currentInstruction[3].u.operand;
+
+ // We generate inline code for the following cases in the fast path:
+ // - int immediate to constant int immediate
+ // - constant int immediate to int immediate
+ // - int immediate to int immediate
+
+ if (isOperandConstantImmediateChar(op1)) {
+ emitGetVirtualRegister(op2, regT0);
+ addSlowCase(emitJumpIfNotJSCell(regT0));
+ JumpList failures;
+ emitLoadCharacterString(regT0, regT0, failures);
+ addSlowCase(failures);
+ addJump(branch32(GreaterThan, regT0, Imm32(asString(getConstantOperand(op1))->tryGetValue()[0])), target);
+ return;
+ }
+ if (isOperandConstantImmediateChar(op2)) {
+ emitGetVirtualRegister(op1, regT0);
+ addSlowCase(emitJumpIfNotJSCell(regT0));
+ JumpList failures;
+ emitLoadCharacterString(regT0, regT0, failures);
+ addSlowCase(failures);
+ addJump(branch32(LessThan, regT0, Imm32(asString(getConstantOperand(op2))->tryGetValue()[0])), target);
+ return;
+ }
+ if (isOperandConstantImmediateInt(op2)) {
+ emitGetVirtualRegister(op1, regT0);
+ emitJumpSlowCaseIfNotImmediateInteger(regT0);
+ int32_t op2imm = getConstantOperandImmediateInt(op2);
+ addJump(branch32(LessThan, regT0, Imm32(op2imm)), target);
+ } else if (isOperandConstantImmediateInt(op1)) {
+ emitGetVirtualRegister(op2, regT1);
+ emitJumpSlowCaseIfNotImmediateInteger(regT1);
+ int32_t op1imm = getConstantOperandImmediateInt(op1);
+ addJump(branch32(GreaterThan, regT1, Imm32(op1imm)), target);
+ } else {
+ emitGetVirtualRegisters(op1, regT0, op2, regT1);
+ emitJumpSlowCaseIfNotImmediateInteger(regT0);
+ emitJumpSlowCaseIfNotImmediateInteger(regT1);
+
+ addJump(branch32(LessThan, regT0, regT1), target);
+ }
+}
+
+void JIT::emitSlow_op_jless(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ unsigned op1 = currentInstruction[1].u.operand;
+ unsigned op2 = currentInstruction[2].u.operand;
+ unsigned target = currentInstruction[3].u.operand;
+
+ // We generate inline code for the following cases in the slow path:
+ // - floating-point number to constant int immediate
+ // - constant int immediate to floating-point number
+ // - floating-point number to floating-point number.
+ if (isOperandConstantImmediateChar(op1) || isOperandConstantImmediateChar(op2)) {
+ linkSlowCase(iter);
+ linkSlowCase(iter);
+ linkSlowCase(iter);
+ linkSlowCase(iter);
+ JITStubCall stubCall(this, cti_op_jless);
+ stubCall.addArgument(op1, regT0);
+ stubCall.addArgument(op2, regT1);
+ stubCall.call();
+ emitJumpSlowToHot(branchTest32(NonZero, regT0), target);
+ return;
+ }
+
+ if (isOperandConstantImmediateInt(op2)) {
+ linkSlowCase(iter);
+
+ if (supportsFloatingPoint()) {
+ Jump fail1 = emitJumpIfNotImmediateNumber(regT0);
+ addPtr(tagTypeNumberRegister, regT0);
+ movePtrToDouble(regT0, fpRegT0);
+
+ int32_t op2imm = getConstantOperand(op2).asInt32();
+
+ move(Imm32(op2imm), regT1);
+ convertInt32ToDouble(regT1, fpRegT1);
+
+ emitJumpSlowToHot(branchDouble(DoubleLessThan, fpRegT0, fpRegT1), target);
+
+ emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_jnless));
+
+ fail1.link(this);
+ }
+
+ JITStubCall stubCall(this, cti_op_jless);
+ stubCall.addArgument(regT0);
+ stubCall.addArgument(op2, regT2);
+ stubCall.call();
+ emitJumpSlowToHot(branchTest32(NonZero, regT0), target);
+
+ } else if (isOperandConstantImmediateInt(op1)) {
+ linkSlowCase(iter);
+
+ if (supportsFloatingPoint()) {
+ Jump fail1 = emitJumpIfNotImmediateNumber(regT1);
+ addPtr(tagTypeNumberRegister, regT1);
+ movePtrToDouble(regT1, fpRegT1);
+
+ int32_t op1imm = getConstantOperand(op1).asInt32();
+
+ move(Imm32(op1imm), regT0);
+ convertInt32ToDouble(regT0, fpRegT0);
+
+ emitJumpSlowToHot(branchDouble(DoubleLessThan, fpRegT0, fpRegT1), target);
+
+ emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_jnless));
+
+ fail1.link(this);
+ }
+
+ JITStubCall stubCall(this, cti_op_jless);
+ stubCall.addArgument(op1, regT2);
+ stubCall.addArgument(regT1);
+ stubCall.call();
+ emitJumpSlowToHot(branchTest32(NonZero, regT0), target);
+
+ } else {
+ linkSlowCase(iter);
+
+ if (supportsFloatingPoint()) {
+ Jump fail1 = emitJumpIfNotImmediateNumber(regT0);
+ Jump fail2 = emitJumpIfNotImmediateNumber(regT1);
+ Jump fail3 = emitJumpIfImmediateInteger(regT1);
+ addPtr(tagTypeNumberRegister, regT0);
+ addPtr(tagTypeNumberRegister, regT1);
+ movePtrToDouble(regT0, fpRegT0);
+ movePtrToDouble(regT1, fpRegT1);
+
+ emitJumpSlowToHot(branchDouble(DoubleLessThan, fpRegT0, fpRegT1), target);
+
+ emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_jnless));
+
+ fail1.link(this);
+ fail2.link(this);
+ fail3.link(this);
+ }
+
+ linkSlowCase(iter);
+ JITStubCall stubCall(this, cti_op_jless);
+ stubCall.addArgument(regT0);
+ stubCall.addArgument(regT1);
+ stubCall.call();
+ emitJumpSlowToHot(branchTest32(NonZero, regT0), target);
+ }
+}
+
+void JIT::emit_op_jlesseq(Instruction* currentInstruction, bool invert)
+{
+ unsigned op1 = currentInstruction[1].u.operand;
+ unsigned op2 = currentInstruction[2].u.operand;
+ unsigned target = currentInstruction[3].u.operand;
+
+ // We generate inline code for the following cases in the fast path:
+ // - int immediate to constant int immediate
+ // - constant int immediate to int immediate
+ // - int immediate to int immediate
+
+ if (isOperandConstantImmediateChar(op1)) {
+ emitGetVirtualRegister(op2, regT0);
+ addSlowCase(emitJumpIfNotJSCell(regT0));
+ JumpList failures;
+ emitLoadCharacterString(regT0, regT0, failures);
+ addSlowCase(failures);
+ addJump(branch32(invert ? LessThan : GreaterThanOrEqual, regT0, Imm32(asString(getConstantOperand(op1))->tryGetValue()[0])), target);
+ return;
+ }
+ if (isOperandConstantImmediateChar(op2)) {
+ emitGetVirtualRegister(op1, regT0);
+ addSlowCase(emitJumpIfNotJSCell(regT0));
+ JumpList failures;
+ emitLoadCharacterString(regT0, regT0, failures);
+ addSlowCase(failures);
+ addJump(branch32(invert ? GreaterThan : LessThanOrEqual, regT0, Imm32(asString(getConstantOperand(op2))->tryGetValue()[0])), target);
+ return;
+ }
+ if (isOperandConstantImmediateInt(op2)) {
+ emitGetVirtualRegister(op1, regT0);
+ emitJumpSlowCaseIfNotImmediateInteger(regT0);
+ int32_t op2imm = getConstantOperandImmediateInt(op2);
+ addJump(branch32(invert ? GreaterThan : LessThanOrEqual, regT0, Imm32(op2imm)), target);
+ } else if (isOperandConstantImmediateInt(op1)) {
+ emitGetVirtualRegister(op2, regT1);
+ emitJumpSlowCaseIfNotImmediateInteger(regT1);
+ int32_t op1imm = getConstantOperandImmediateInt(op1);
+ addJump(branch32(invert ? LessThan : GreaterThanOrEqual, regT1, Imm32(op1imm)), target);
+ } else {
+ emitGetVirtualRegisters(op1, regT0, op2, regT1);
+ emitJumpSlowCaseIfNotImmediateInteger(regT0);
+ emitJumpSlowCaseIfNotImmediateInteger(regT1);
+
+ addJump(branch32(invert ? GreaterThan : LessThanOrEqual, regT0, regT1), target);
+ }
+}
+
+void JIT::emitSlow_op_jlesseq(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter, bool invert)
+{
+ unsigned op1 = currentInstruction[1].u.operand;
+ unsigned op2 = currentInstruction[2].u.operand;
+ unsigned target = currentInstruction[3].u.operand;
+
+ // We generate inline code for the following cases in the slow path:
+ // - floating-point number to constant int immediate
+ // - constant int immediate to floating-point number
+ // - floating-point number to floating-point number.
+
+ if (isOperandConstantImmediateChar(op1) || isOperandConstantImmediateChar(op2)) {
+ linkSlowCase(iter);
+ linkSlowCase(iter);
+ linkSlowCase(iter);
+ linkSlowCase(iter);
+ JITStubCall stubCall(this, cti_op_jlesseq);
+ stubCall.addArgument(op1, regT0);
+ stubCall.addArgument(op2, regT1);
+ stubCall.call();
+ emitJumpSlowToHot(branchTest32(invert ? Zero : NonZero, regT0), target);
+ return;
+ }
+
+ if (isOperandConstantImmediateInt(op2)) {
+ linkSlowCase(iter);
+
+ if (supportsFloatingPoint()) {
+ Jump fail1 = emitJumpIfNotImmediateNumber(regT0);
+ addPtr(tagTypeNumberRegister, regT0);
+ movePtrToDouble(regT0, fpRegT0);
+
+ int32_t op2imm = getConstantOperand(op2).asInt32();;
+
+ move(Imm32(op2imm), regT1);
+ convertInt32ToDouble(regT1, fpRegT1);
+
+ emitJumpSlowToHot(branchDouble(invert ? DoubleLessThanOrUnordered : DoubleGreaterThanOrEqual, fpRegT1, fpRegT0), target);
+
+ emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_jnlesseq));
+
+ fail1.link(this);
+ }
+
+ JITStubCall stubCall(this, cti_op_jlesseq);
+ stubCall.addArgument(regT0);
+ stubCall.addArgument(op2, regT2);
+ stubCall.call();
+ emitJumpSlowToHot(branchTest32(invert ? Zero : NonZero, regT0), target);
+
+ } else if (isOperandConstantImmediateInt(op1)) {
+ linkSlowCase(iter);
+
+ if (supportsFloatingPoint()) {
+ Jump fail1 = emitJumpIfNotImmediateNumber(regT1);
+ addPtr(tagTypeNumberRegister, regT1);
+ movePtrToDouble(regT1, fpRegT1);
+
+ int32_t op1imm = getConstantOperand(op1).asInt32();;
+
+ move(Imm32(op1imm), regT0);
+ convertInt32ToDouble(regT0, fpRegT0);
+
+ emitJumpSlowToHot(branchDouble(invert ? DoubleLessThanOrUnordered : DoubleGreaterThanOrEqual, fpRegT1, fpRegT0), target);
+
+ emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_jnlesseq));
+
+ fail1.link(this);
+ }
+
+ JITStubCall stubCall(this, cti_op_jlesseq);
+ stubCall.addArgument(op1, regT2);
+ stubCall.addArgument(regT1);
+ stubCall.call();
+ emitJumpSlowToHot(branchTest32(invert ? Zero : NonZero, regT0), target);
+
+ } else {
+ linkSlowCase(iter);
+
+ if (supportsFloatingPoint()) {
+ Jump fail1 = emitJumpIfNotImmediateNumber(regT0);
+ Jump fail2 = emitJumpIfNotImmediateNumber(regT1);
+ Jump fail3 = emitJumpIfImmediateInteger(regT1);
+ addPtr(tagTypeNumberRegister, regT0);
+ addPtr(tagTypeNumberRegister, regT1);
+ movePtrToDouble(regT0, fpRegT0);
+ movePtrToDouble(regT1, fpRegT1);
+
+ emitJumpSlowToHot(branchDouble(invert ? DoubleLessThanOrUnordered : DoubleGreaterThanOrEqual, fpRegT1, fpRegT0), target);
+
+ emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_jnlesseq));
+
+ fail1.link(this);
+ fail2.link(this);
+ fail3.link(this);
+ }
+
+ linkSlowCase(iter);
+ JITStubCall stubCall(this, cti_op_jlesseq);
+ stubCall.addArgument(regT0);
+ stubCall.addArgument(regT1);
+ stubCall.call();
+ emitJumpSlowToHot(branchTest32(invert ? Zero : NonZero, regT0), target);
+ }
+}
+
+void JIT::emit_op_jnlesseq(Instruction* currentInstruction)
+{
+ emit_op_jlesseq(currentInstruction, true);
+}
+
+void JIT::emitSlow_op_jnlesseq(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ emitSlow_op_jlesseq(currentInstruction, iter, true);
+}
+
+void JIT::emit_op_bitand(Instruction* currentInstruction)
+{
+ unsigned result = currentInstruction[1].u.operand;
+ unsigned op1 = currentInstruction[2].u.operand;
+ unsigned op2 = currentInstruction[3].u.operand;
+
+ if (isOperandConstantImmediateInt(op1)) {
+ emitGetVirtualRegister(op2, regT0);
+ emitJumpSlowCaseIfNotImmediateInteger(regT0);
+ int32_t imm = getConstantOperandImmediateInt(op1);
+ andPtr(Imm32(imm), regT0);
+ if (imm >= 0)
+ emitFastArithIntToImmNoCheck(regT0, regT0);
+ } else if (isOperandConstantImmediateInt(op2)) {
+ emitGetVirtualRegister(op1, regT0);
+ emitJumpSlowCaseIfNotImmediateInteger(regT0);
+ int32_t imm = getConstantOperandImmediateInt(op2);
+ andPtr(Imm32(imm), regT0);
+ if (imm >= 0)
+ emitFastArithIntToImmNoCheck(regT0, regT0);
+ } else {
+ emitGetVirtualRegisters(op1, regT0, op2, regT1);
+ andPtr(regT1, regT0);
+ emitJumpSlowCaseIfNotImmediateInteger(regT0);
+ }
+ emitPutVirtualRegister(result);
+}
+
+void JIT::emitSlow_op_bitand(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ unsigned result = currentInstruction[1].u.operand;
+ unsigned op1 = currentInstruction[2].u.operand;
+ unsigned op2 = currentInstruction[3].u.operand;
+
+ linkSlowCase(iter);
+ if (isOperandConstantImmediateInt(op1)) {
+ JITStubCall stubCall(this, cti_op_bitand);
+ stubCall.addArgument(op1, regT2);
+ stubCall.addArgument(regT0);
+ stubCall.call(result);
+ } else if (isOperandConstantImmediateInt(op2)) {
+ JITStubCall stubCall(this, cti_op_bitand);
+ stubCall.addArgument(regT0);
+ stubCall.addArgument(op2, regT2);
+ stubCall.call(result);
+ } else {
+ JITStubCall stubCall(this, cti_op_bitand);
+ stubCall.addArgument(op1, regT2);
+ stubCall.addArgument(regT1);
+ stubCall.call(result);
+ }
+}
+
+void JIT::emit_op_post_inc(Instruction* currentInstruction)
+{
+ unsigned result = currentInstruction[1].u.operand;
+ unsigned srcDst = currentInstruction[2].u.operand;
+
+ emitGetVirtualRegister(srcDst, regT0);
+ move(regT0, regT1);
+ emitJumpSlowCaseIfNotImmediateInteger(regT0);
+ addSlowCase(branchAdd32(Overflow, Imm32(1), regT1));
+ emitFastArithIntToImmNoCheck(regT1, regT1);
+ emitPutVirtualRegister(srcDst, regT1);
+ emitPutVirtualRegister(result);
+}
+
+void JIT::emitSlow_op_post_inc(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ unsigned result = currentInstruction[1].u.operand;
+ unsigned srcDst = currentInstruction[2].u.operand;
+
+ linkSlowCase(iter);
+ linkSlowCase(iter);
+ JITStubCall stubCall(this, cti_op_post_inc);
+ stubCall.addArgument(regT0);
+ stubCall.addArgument(Imm32(srcDst));
+ stubCall.call(result);
+}
+
+void JIT::emit_op_post_dec(Instruction* currentInstruction)
+{
+ unsigned result = currentInstruction[1].u.operand;
+ unsigned srcDst = currentInstruction[2].u.operand;
+
+ emitGetVirtualRegister(srcDst, regT0);
+ move(regT0, regT1);
+ emitJumpSlowCaseIfNotImmediateInteger(regT0);
+ addSlowCase(branchSub32(Zero, Imm32(1), regT1));
+ emitFastArithIntToImmNoCheck(regT1, regT1);
+ emitPutVirtualRegister(srcDst, regT1);
+ emitPutVirtualRegister(result);
+}
+
+void JIT::emitSlow_op_post_dec(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ unsigned result = currentInstruction[1].u.operand;
+ unsigned srcDst = currentInstruction[2].u.operand;
+
+ linkSlowCase(iter);
+ linkSlowCase(iter);
+ JITStubCall stubCall(this, cti_op_post_dec);
+ stubCall.addArgument(regT0);
+ stubCall.addArgument(Imm32(srcDst));
+ stubCall.call(result);
+}
+
+void JIT::emit_op_pre_inc(Instruction* currentInstruction)
+{
+ unsigned srcDst = currentInstruction[1].u.operand;
+
+ emitGetVirtualRegister(srcDst, regT0);
+ emitJumpSlowCaseIfNotImmediateInteger(regT0);
+ addSlowCase(branchAdd32(Overflow, Imm32(1), regT0));
+ emitFastArithIntToImmNoCheck(regT0, regT0);
+ emitPutVirtualRegister(srcDst);
+}
+
+void JIT::emitSlow_op_pre_inc(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ unsigned srcDst = currentInstruction[1].u.operand;
+
+ Jump notImm = getSlowCase(iter);
+ linkSlowCase(iter);
+ emitGetVirtualRegister(srcDst, regT0);
+ notImm.link(this);
+ JITStubCall stubCall(this, cti_op_pre_inc);
+ stubCall.addArgument(regT0);
+ stubCall.call(srcDst);
+}
+
+void JIT::emit_op_pre_dec(Instruction* currentInstruction)
+{
+ unsigned srcDst = currentInstruction[1].u.operand;
+
+ emitGetVirtualRegister(srcDst, regT0);
+ emitJumpSlowCaseIfNotImmediateInteger(regT0);
+ addSlowCase(branchSub32(Zero, Imm32(1), regT0));
+ emitFastArithIntToImmNoCheck(regT0, regT0);
+ emitPutVirtualRegister(srcDst);
+}
+
+void JIT::emitSlow_op_pre_dec(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ unsigned srcDst = currentInstruction[1].u.operand;
+
+ Jump notImm = getSlowCase(iter);
+ linkSlowCase(iter);
+ emitGetVirtualRegister(srcDst, regT0);
+ notImm.link(this);
+ JITStubCall stubCall(this, cti_op_pre_dec);
+ stubCall.addArgument(regT0);
+ stubCall.call(srcDst);
+}
+
+/* ------------------------------ BEGIN: OP_MOD ------------------------------ */
+
+#if CPU(X86) || CPU(X86_64) || CPU(MIPS)
+
+void JIT::emit_op_mod(Instruction* currentInstruction)
+{
+ unsigned result = currentInstruction[1].u.operand;
+ unsigned op1 = currentInstruction[2].u.operand;
+ unsigned op2 = currentInstruction[3].u.operand;
+
+#if CPU(X86) || CPU(X86_64)
+ // Make sure registers are correct for x86 IDIV instructions.
+ ASSERT(regT0 == X86Registers::eax);
+ ASSERT(regT1 == X86Registers::edx);
+ ASSERT(regT2 == X86Registers::ecx);
+#endif
+
+ emitGetVirtualRegisters(op1, regT0, op2, regT2);
+ emitJumpSlowCaseIfNotImmediateInteger(regT0);
+ emitJumpSlowCaseIfNotImmediateInteger(regT2);
+
+ addSlowCase(branchPtr(Equal, regT2, ImmPtr(JSValue::encode(jsNumber(0)))));
+ m_assembler.cdq();
+ m_assembler.idivl_r(regT2);
+ emitFastArithReTagImmediate(regT1, regT0);
+ emitPutVirtualRegister(result);
+}
+
+void JIT::emitSlow_op_mod(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ unsigned result = currentInstruction[1].u.operand;
+
+ linkSlowCase(iter);
+ linkSlowCase(iter);
+ linkSlowCase(iter);
+ JITStubCall stubCall(this, cti_op_mod);
+ stubCall.addArgument(regT0);
+ stubCall.addArgument(regT2);
+ stubCall.call(result);
+}
+
+#else // CPU(X86) || CPU(X86_64) || CPU(MIPS)
+
+void JIT::emit_op_mod(Instruction* currentInstruction)
+{
+ unsigned result = currentInstruction[1].u.operand;
+ unsigned op1 = currentInstruction[2].u.operand;
+ unsigned op2 = currentInstruction[3].u.operand;
+
+ JITStubCall stubCall(this, cti_op_mod);
+ stubCall.addArgument(op1, regT2);
+ stubCall.addArgument(op2, regT2);
+ stubCall.call(result);
+}
+
+void JIT::emitSlow_op_mod(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+#if ENABLE(JIT_USE_SOFT_MODULO)
+ unsigned result = currentInstruction[1].u.operand;
+ unsigned op1 = currentInstruction[2].u.operand;
+ unsigned op2 = currentInstruction[3].u.operand;
+ linkSlowCase(iter);
+ linkSlowCase(iter);
+ linkSlowCase(iter);
+ JITStubCall stubCall(this, cti_op_mod);
+ stubCall.addArgument(op1, regT2);
+ stubCall.addArgument(op2, regT2);
+ stubCall.call(result);
+#else
+ ASSERT_NOT_REACHED();
+#endif
+}
+
+#endif // CPU(X86) || CPU(X86_64)
+
+/* ------------------------------ END: OP_MOD ------------------------------ */
+
+/* ------------------------------ BEGIN: USE(JSVALUE64) (OP_ADD, OP_SUB, OP_MUL) ------------------------------ */
+
+void JIT::compileBinaryArithOp(OpcodeID opcodeID, unsigned, unsigned op1, unsigned op2, OperandTypes)
+{
+ emitGetVirtualRegisters(op1, regT0, op2, regT1);
+ emitJumpSlowCaseIfNotImmediateInteger(regT0);
+ emitJumpSlowCaseIfNotImmediateInteger(regT1);
+ if (opcodeID == op_add)
+ addSlowCase(branchAdd32(Overflow, regT1, regT0));
+ else if (opcodeID == op_sub)
+ addSlowCase(branchSub32(Overflow, regT1, regT0));
+ else {
+ ASSERT(opcodeID == op_mul);
+ addSlowCase(branchMul32(Overflow, regT1, regT0));
+ addSlowCase(branchTest32(Zero, regT0));
+ }
+ emitFastArithIntToImmNoCheck(regT0, regT0);
+}
+
+void JIT::compileBinaryArithOpSlowCase(OpcodeID opcodeID, Vector<SlowCaseEntry>::iterator& iter, unsigned result, unsigned op1, unsigned op2, OperandTypes types, bool op1HasImmediateIntFastCase, bool op2HasImmediateIntFastCase)
+{
+ // We assume that subtracting TagTypeNumber is equivalent to adding DoubleEncodeOffset.
+ COMPILE_ASSERT(((JSImmediate::TagTypeNumber + JSImmediate::DoubleEncodeOffset) == 0), TagTypeNumber_PLUS_DoubleEncodeOffset_EQUALS_0);
+
+ Jump notImm1;
+ Jump notImm2;
+ if (op1HasImmediateIntFastCase) {
+ notImm2 = getSlowCase(iter);
+ } else if (op2HasImmediateIntFastCase) {
+ notImm1 = getSlowCase(iter);
+ } else {
+ notImm1 = getSlowCase(iter);
+ notImm2 = getSlowCase(iter);
+ }
+
+ linkSlowCase(iter); // Integer overflow case - we could handle this in JIT code, but this is likely rare.
+ if (opcodeID == op_mul && !op1HasImmediateIntFastCase && !op2HasImmediateIntFastCase) // op_mul has an extra slow case to handle 0 * negative number.
+ linkSlowCase(iter);
+ emitGetVirtualRegister(op1, regT0);
+
+ Label stubFunctionCall(this);
+ JITStubCall stubCall(this, opcodeID == op_add ? cti_op_add : opcodeID == op_sub ? cti_op_sub : cti_op_mul);
+ if (op1HasImmediateIntFastCase || op2HasImmediateIntFastCase) {
+ emitGetVirtualRegister(op1, regT0);
+ emitGetVirtualRegister(op2, regT1);
+ }
+ stubCall.addArgument(regT0);
+ stubCall.addArgument(regT1);
+ stubCall.call(result);
+ Jump end = jump();
+
+ if (op1HasImmediateIntFastCase) {
+ notImm2.link(this);
+ if (!types.second().definitelyIsNumber())
+ emitJumpIfNotImmediateNumber(regT0).linkTo(stubFunctionCall, this);
+ emitGetVirtualRegister(op1, regT1);
+ convertInt32ToDouble(regT1, fpRegT1);
+ addPtr(tagTypeNumberRegister, regT0);
+ movePtrToDouble(regT0, fpRegT2);
+ } else if (op2HasImmediateIntFastCase) {
+ notImm1.link(this);
+ if (!types.first().definitelyIsNumber())
+ emitJumpIfNotImmediateNumber(regT0).linkTo(stubFunctionCall, this);
+ emitGetVirtualRegister(op2, regT1);
+ convertInt32ToDouble(regT1, fpRegT1);
+ addPtr(tagTypeNumberRegister, regT0);
+ movePtrToDouble(regT0, fpRegT2);
+ } else {
+ // if we get here, eax is not an int32, edx not yet checked.
+ notImm1.link(this);
+ if (!types.first().definitelyIsNumber())
+ emitJumpIfNotImmediateNumber(regT0).linkTo(stubFunctionCall, this);
+ if (!types.second().definitelyIsNumber())
+ emitJumpIfNotImmediateNumber(regT1).linkTo(stubFunctionCall, this);
+ addPtr(tagTypeNumberRegister, regT0);
+ movePtrToDouble(regT0, fpRegT1);
+ Jump op2isDouble = emitJumpIfNotImmediateInteger(regT1);
+ convertInt32ToDouble(regT1, fpRegT2);
+ Jump op2wasInteger = jump();
+
+ // if we get here, eax IS an int32, edx is not.
+ notImm2.link(this);
+ if (!types.second().definitelyIsNumber())
+ emitJumpIfNotImmediateNumber(regT1).linkTo(stubFunctionCall, this);
+ convertInt32ToDouble(regT0, fpRegT1);
+ op2isDouble.link(this);
+ addPtr(tagTypeNumberRegister, regT1);
+ movePtrToDouble(regT1, fpRegT2);
+ op2wasInteger.link(this);
+ }
+
+ if (opcodeID == op_add)
+ addDouble(fpRegT2, fpRegT1);
+ else if (opcodeID == op_sub)
+ subDouble(fpRegT2, fpRegT1);
+ else if (opcodeID == op_mul)
+ mulDouble(fpRegT2, fpRegT1);
+ else {
+ ASSERT(opcodeID == op_div);
+ divDouble(fpRegT2, fpRegT1);
+ }
+ moveDoubleToPtr(fpRegT1, regT0);
+ subPtr(tagTypeNumberRegister, regT0);
+ emitPutVirtualRegister(result, regT0);
+
+ end.link(this);
+}
+
+void JIT::emit_op_add(Instruction* currentInstruction)
+{
+ unsigned result = currentInstruction[1].u.operand;
+ unsigned op1 = currentInstruction[2].u.operand;
+ unsigned op2 = currentInstruction[3].u.operand;
+ OperandTypes types = OperandTypes::fromInt(currentInstruction[4].u.operand);
+
+ if (!types.first().mightBeNumber() || !types.second().mightBeNumber()) {
+ JITStubCall stubCall(this, cti_op_add);
+ stubCall.addArgument(op1, regT2);
+ stubCall.addArgument(op2, regT2);
+ stubCall.call(result);
+ return;
+ }
+
+ if (isOperandConstantImmediateInt(op1)) {
+ emitGetVirtualRegister(op2, regT0);
+ emitJumpSlowCaseIfNotImmediateInteger(regT0);
+ addSlowCase(branchAdd32(Overflow, Imm32(getConstantOperandImmediateInt(op1)), regT0));
+ emitFastArithIntToImmNoCheck(regT0, regT0);
+ } else if (isOperandConstantImmediateInt(op2)) {
+ emitGetVirtualRegister(op1, regT0);
+ emitJumpSlowCaseIfNotImmediateInteger(regT0);
+ addSlowCase(branchAdd32(Overflow, Imm32(getConstantOperandImmediateInt(op2)), regT0));
+ emitFastArithIntToImmNoCheck(regT0, regT0);
+ } else
+ compileBinaryArithOp(op_add, result, op1, op2, types);
+
+ emitPutVirtualRegister(result);
+}
+
+void JIT::emitSlow_op_add(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ unsigned result = currentInstruction[1].u.operand;
+ unsigned op1 = currentInstruction[2].u.operand;
+ unsigned op2 = currentInstruction[3].u.operand;
+ OperandTypes types = OperandTypes::fromInt(currentInstruction[4].u.operand);
+
+ if (!types.first().mightBeNumber() || !types.second().mightBeNumber())
+ return;
+
+ bool op1HasImmediateIntFastCase = isOperandConstantImmediateInt(op1);
+ bool op2HasImmediateIntFastCase = !op1HasImmediateIntFastCase && isOperandConstantImmediateInt(op2);
+ compileBinaryArithOpSlowCase(op_add, iter, result, op1, op2, OperandTypes::fromInt(currentInstruction[4].u.operand), op1HasImmediateIntFastCase, op2HasImmediateIntFastCase);
+}
+
+void JIT::emit_op_mul(Instruction* currentInstruction)
+{
+ unsigned result = currentInstruction[1].u.operand;
+ unsigned op1 = currentInstruction[2].u.operand;
+ unsigned op2 = currentInstruction[3].u.operand;
+ OperandTypes types = OperandTypes::fromInt(currentInstruction[4].u.operand);
+
+ // For now, only plant a fast int case if the constant operand is greater than zero.
+ int32_t value;
+ if (isOperandConstantImmediateInt(op1) && ((value = getConstantOperandImmediateInt(op1)) > 0)) {
+ emitGetVirtualRegister(op2, regT0);
+ emitJumpSlowCaseIfNotImmediateInteger(regT0);
+ addSlowCase(branchMul32(Overflow, Imm32(value), regT0, regT0));
+ emitFastArithReTagImmediate(regT0, regT0);
+ } else if (isOperandConstantImmediateInt(op2) && ((value = getConstantOperandImmediateInt(op2)) > 0)) {
+ emitGetVirtualRegister(op1, regT0);
+ emitJumpSlowCaseIfNotImmediateInteger(regT0);
+ addSlowCase(branchMul32(Overflow, Imm32(value), regT0, regT0));
+ emitFastArithReTagImmediate(regT0, regT0);
+ } else
+ compileBinaryArithOp(op_mul, result, op1, op2, types);
+
+ emitPutVirtualRegister(result);
+}
+
+void JIT::emitSlow_op_mul(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ unsigned result = currentInstruction[1].u.operand;
+ unsigned op1 = currentInstruction[2].u.operand;
+ unsigned op2 = currentInstruction[3].u.operand;
+ OperandTypes types = OperandTypes::fromInt(currentInstruction[4].u.operand);
+
+ bool op1HasImmediateIntFastCase = isOperandConstantImmediateInt(op1) && getConstantOperandImmediateInt(op1) > 0;
+ bool op2HasImmediateIntFastCase = !op1HasImmediateIntFastCase && isOperandConstantImmediateInt(op2) && getConstantOperandImmediateInt(op2) > 0;
+ compileBinaryArithOpSlowCase(op_mul, iter, result, op1, op2, OperandTypes::fromInt(currentInstruction[4].u.operand), op1HasImmediateIntFastCase, op2HasImmediateIntFastCase);
+}
+
+void JIT::emit_op_div(Instruction* currentInstruction)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+ unsigned op1 = currentInstruction[2].u.operand;
+ unsigned op2 = currentInstruction[3].u.operand;
+ OperandTypes types = OperandTypes::fromInt(currentInstruction[4].u.operand);
+
+ if (isOperandConstantImmediateDouble(op1)) {
+ emitGetVirtualRegister(op1, regT0);
+ addPtr(tagTypeNumberRegister, regT0);
+ movePtrToDouble(regT0, fpRegT0);
+ } else if (isOperandConstantImmediateInt(op1)) {
+ emitLoadInt32ToDouble(op1, fpRegT0);
+ } else {
+ emitGetVirtualRegister(op1, regT0);
+ if (!types.first().definitelyIsNumber())
+ emitJumpSlowCaseIfNotImmediateNumber(regT0);
+ Jump notInt = emitJumpIfNotImmediateInteger(regT0);
+ convertInt32ToDouble(regT0, fpRegT0);
+ Jump skipDoubleLoad = jump();
+ notInt.link(this);
+ addPtr(tagTypeNumberRegister, regT0);
+ movePtrToDouble(regT0, fpRegT0);
+ skipDoubleLoad.link(this);
+ }
+
+ if (isOperandConstantImmediateDouble(op2)) {
+ emitGetVirtualRegister(op2, regT1);
+ addPtr(tagTypeNumberRegister, regT1);
+ movePtrToDouble(regT1, fpRegT1);
+ } else if (isOperandConstantImmediateInt(op2)) {
+ emitLoadInt32ToDouble(op2, fpRegT1);
+ } else {
+ emitGetVirtualRegister(op2, regT1);
+ if (!types.second().definitelyIsNumber())
+ emitJumpSlowCaseIfNotImmediateNumber(regT1);
+ Jump notInt = emitJumpIfNotImmediateInteger(regT1);
+ convertInt32ToDouble(regT1, fpRegT1);
+ Jump skipDoubleLoad = jump();
+ notInt.link(this);
+ addPtr(tagTypeNumberRegister, regT1);
+ movePtrToDouble(regT1, fpRegT1);
+ skipDoubleLoad.link(this);
+ }
+ divDouble(fpRegT1, fpRegT0);
+
+ // Double result.
+ moveDoubleToPtr(fpRegT0, regT0);
+ subPtr(tagTypeNumberRegister, regT0);
+
+ emitPutVirtualRegister(dst, regT0);
+}
+
+void JIT::emitSlow_op_div(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ unsigned result = currentInstruction[1].u.operand;
+ unsigned op1 = currentInstruction[2].u.operand;
+ unsigned op2 = currentInstruction[3].u.operand;
+ OperandTypes types = OperandTypes::fromInt(currentInstruction[4].u.operand);
+ if (types.first().definitelyIsNumber() && types.second().definitelyIsNumber()) {
+#ifndef NDEBUG
+ breakpoint();
+#endif
+ return;
+ }
+ if (!isOperandConstantImmediateDouble(op1) && !isOperandConstantImmediateInt(op1)) {
+ if (!types.first().definitelyIsNumber())
+ linkSlowCase(iter);
+ }
+ if (!isOperandConstantImmediateDouble(op2) && !isOperandConstantImmediateInt(op2)) {
+ if (!types.second().definitelyIsNumber())
+ linkSlowCase(iter);
+ }
+ // There is an extra slow case for (op1 * -N) or (-N * op2), to check for 0 since this should produce a result of -0.
+ JITStubCall stubCall(this, cti_op_div);
+ stubCall.addArgument(op1, regT2);
+ stubCall.addArgument(op2, regT2);
+ stubCall.call(result);
+}
+
+void JIT::emit_op_sub(Instruction* currentInstruction)
+{
+ unsigned result = currentInstruction[1].u.operand;
+ unsigned op1 = currentInstruction[2].u.operand;
+ unsigned op2 = currentInstruction[3].u.operand;
+ OperandTypes types = OperandTypes::fromInt(currentInstruction[4].u.operand);
+
+ compileBinaryArithOp(op_sub, result, op1, op2, types);
+ emitPutVirtualRegister(result);
+}
+
+void JIT::emitSlow_op_sub(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ unsigned result = currentInstruction[1].u.operand;
+ unsigned op1 = currentInstruction[2].u.operand;
+ unsigned op2 = currentInstruction[3].u.operand;
+ OperandTypes types = OperandTypes::fromInt(currentInstruction[4].u.operand);
+
+ compileBinaryArithOpSlowCase(op_sub, iter, result, op1, op2, types, false, false);
+}
+
+/* ------------------------------ END: OP_ADD, OP_SUB, OP_MUL ------------------------------ */
+
+} // namespace JSC
+
+#endif // USE(JSVALUE64)
+#endif // ENABLE(JIT)
diff --git a/Source/JavaScriptCore/jit/JITArithmetic32_64.cpp b/Source/JavaScriptCore/jit/JITArithmetic32_64.cpp
new file mode 100644
index 0000000..e0b31f0
--- /dev/null
+++ b/Source/JavaScriptCore/jit/JITArithmetic32_64.cpp
@@ -0,0 +1,1424 @@
+/*
+* Copyright (C) 2008 Apple Inc. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions
+* are met:
+* 1. Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* 2. Redistributions in binary form must reproduce the above copyright
+* notice, this list of conditions and the following disclaimer in the
+* documentation and/or other materials provided with the distribution.
+*
+* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include "config.h"
+
+#if ENABLE(JIT)
+#if USE(JSVALUE32_64)
+#include "JIT.h"
+
+#include "CodeBlock.h"
+#include "JITInlineMethods.h"
+#include "JITStubCall.h"
+#include "JITStubs.h"
+#include "JSArray.h"
+#include "JSFunction.h"
+#include "Interpreter.h"
+#include "ResultType.h"
+#include "SamplingTool.h"
+
+#ifndef NDEBUG
+#include <stdio.h>
+#endif
+
+using namespace std;
+
+namespace JSC {
+
+void JIT::emit_op_negate(Instruction* currentInstruction)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+ unsigned src = currentInstruction[2].u.operand;
+
+ emitLoad(src, regT1, regT0);
+
+ Jump srcNotInt = branch32(NotEqual, regT1, Imm32(JSValue::Int32Tag));
+ addSlowCase(branchTest32(Zero, regT0, Imm32(0x7fffffff)));
+ neg32(regT0);
+ emitStoreInt32(dst, regT0, (dst == src));
+
+ Jump end = jump();
+
+ srcNotInt.link(this);
+ addSlowCase(branch32(Above, regT1, Imm32(JSValue::LowestTag)));
+
+ xor32(Imm32(1 << 31), regT1);
+ store32(regT1, tagFor(dst));
+ if (dst != src)
+ store32(regT0, payloadFor(dst));
+
+ end.link(this);
+}
+
+void JIT::emitSlow_op_negate(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+
+ linkSlowCase(iter); // 0x7fffffff check
+ linkSlowCase(iter); // double check
+
+ JITStubCall stubCall(this, cti_op_negate);
+ stubCall.addArgument(regT1, regT0);
+ stubCall.call(dst);
+}
+
+void JIT::emit_op_jnless(Instruction* currentInstruction)
+{
+ unsigned op1 = currentInstruction[1].u.operand;
+ unsigned op2 = currentInstruction[2].u.operand;
+ unsigned target = currentInstruction[3].u.operand;
+
+ JumpList notInt32Op1;
+ JumpList notInt32Op2;
+
+ // Character less.
+ if (isOperandConstantImmediateChar(op1)) {
+ emitLoad(op2, regT1, regT0);
+ addSlowCase(branch32(NotEqual, regT1, Imm32(JSValue::CellTag)));
+ JumpList failures;
+ emitLoadCharacterString(regT0, regT0, failures);
+ addSlowCase(failures);
+ addJump(branch32(LessThanOrEqual, regT0, Imm32(asString(getConstantOperand(op1))->tryGetValue()[0])), target);
+ return;
+ }
+ if (isOperandConstantImmediateChar(op2)) {
+ emitLoad(op1, regT1, regT0);
+ addSlowCase(branch32(NotEqual, regT1, Imm32(JSValue::CellTag)));
+ JumpList failures;
+ emitLoadCharacterString(regT0, regT0, failures);
+ addSlowCase(failures);
+ addJump(branch32(GreaterThanOrEqual, regT0, Imm32(asString(getConstantOperand(op2))->tryGetValue()[0])), target);
+ return;
+ }
+ if (isOperandConstantImmediateInt(op1)) {
+ // Int32 less.
+ emitLoad(op2, regT3, regT2);
+ notInt32Op2.append(branch32(NotEqual, regT3, Imm32(JSValue::Int32Tag)));
+ addJump(branch32(LessThanOrEqual, regT2, Imm32(getConstantOperand(op1).asInt32())), target);
+ } else if (isOperandConstantImmediateInt(op2)) {
+ emitLoad(op1, regT1, regT0);
+ notInt32Op1.append(branch32(NotEqual, regT1, Imm32(JSValue::Int32Tag)));
+ addJump(branch32(GreaterThanOrEqual, regT0, Imm32(getConstantOperand(op2).asInt32())), target);
+ } else {
+ emitLoad2(op1, regT1, regT0, op2, regT3, regT2);
+ notInt32Op1.append(branch32(NotEqual, regT1, Imm32(JSValue::Int32Tag)));
+ notInt32Op2.append(branch32(NotEqual, regT3, Imm32(JSValue::Int32Tag)));
+ addJump(branch32(GreaterThanOrEqual, regT0, regT2), target);
+ }
+
+ if (!supportsFloatingPoint()) {
+ addSlowCase(notInt32Op1);
+ addSlowCase(notInt32Op2);
+ return;
+ }
+ Jump end = jump();
+
+ // Double less.
+ emitBinaryDoubleOp(op_jnless, target, op1, op2, OperandTypes(), notInt32Op1, notInt32Op2, !isOperandConstantImmediateInt(op1), isOperandConstantImmediateInt(op1) || !isOperandConstantImmediateInt(op2));
+ end.link(this);
+}
+
+void JIT::emitSlow_op_jnless(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ unsigned op1 = currentInstruction[1].u.operand;
+ unsigned op2 = currentInstruction[2].u.operand;
+ unsigned target = currentInstruction[3].u.operand;
+
+ if (isOperandConstantImmediateChar(op1) || isOperandConstantImmediateChar(op2)) {
+ linkSlowCase(iter);
+ linkSlowCase(iter);
+ linkSlowCase(iter);
+ linkSlowCase(iter);
+ } else {
+ if (!supportsFloatingPoint()) {
+ if (!isOperandConstantImmediateInt(op1) && !isOperandConstantImmediateInt(op2))
+ linkSlowCase(iter); // int32 check
+ linkSlowCase(iter); // int32 check
+ } else {
+ if (!isOperandConstantImmediateInt(op1)) {
+ linkSlowCase(iter); // double check
+ linkSlowCase(iter); // int32 check
+ }
+ if (isOperandConstantImmediateInt(op1) || !isOperandConstantImmediateInt(op2))
+ linkSlowCase(iter); // double check
+ }
+ }
+
+ JITStubCall stubCall(this, cti_op_jless);
+ stubCall.addArgument(op1);
+ stubCall.addArgument(op2);
+ stubCall.call();
+ emitJumpSlowToHot(branchTest32(Zero, regT0), target);
+}
+
+void JIT::emit_op_jless(Instruction* currentInstruction)
+{
+ unsigned op1 = currentInstruction[1].u.operand;
+ unsigned op2 = currentInstruction[2].u.operand;
+ unsigned target = currentInstruction[3].u.operand;
+
+ JumpList notInt32Op1;
+ JumpList notInt32Op2;
+
+ // Character less.
+ if (isOperandConstantImmediateChar(op1)) {
+ emitLoad(op2, regT1, regT0);
+ addSlowCase(branch32(NotEqual, regT1, Imm32(JSValue::CellTag)));
+ JumpList failures;
+ emitLoadCharacterString(regT0, regT0, failures);
+ addSlowCase(failures);
+ addJump(branch32(GreaterThan, regT0, Imm32(asString(getConstantOperand(op1))->tryGetValue()[0])), target);
+ return;
+ }
+ if (isOperandConstantImmediateChar(op2)) {
+ emitLoad(op1, regT1, regT0);
+ addSlowCase(branch32(NotEqual, regT1, Imm32(JSValue::CellTag)));
+ JumpList failures;
+ emitLoadCharacterString(regT0, regT0, failures);
+ addSlowCase(failures);
+ addJump(branch32(LessThan, regT0, Imm32(asString(getConstantOperand(op2))->tryGetValue()[0])), target);
+ return;
+ }
+ if (isOperandConstantImmediateInt(op1)) {
+ emitLoad(op2, regT3, regT2);
+ notInt32Op2.append(branch32(NotEqual, regT3, Imm32(JSValue::Int32Tag)));
+ addJump(branch32(GreaterThan, regT2, Imm32(getConstantOperand(op1).asInt32())), target);
+ } else if (isOperandConstantImmediateInt(op2)) {
+ emitLoad(op1, regT1, regT0);
+ notInt32Op1.append(branch32(NotEqual, regT1, Imm32(JSValue::Int32Tag)));
+ addJump(branch32(LessThan, regT0, Imm32(getConstantOperand(op2).asInt32())), target);
+ } else {
+ emitLoad2(op1, regT1, regT0, op2, regT3, regT2);
+ notInt32Op1.append(branch32(NotEqual, regT1, Imm32(JSValue::Int32Tag)));
+ notInt32Op2.append(branch32(NotEqual, regT3, Imm32(JSValue::Int32Tag)));
+ addJump(branch32(LessThan, regT0, regT2), target);
+ }
+
+ if (!supportsFloatingPoint()) {
+ addSlowCase(notInt32Op1);
+ addSlowCase(notInt32Op2);
+ return;
+ }
+ Jump end = jump();
+
+ // Double less.
+ emitBinaryDoubleOp(op_jless, target, op1, op2, OperandTypes(), notInt32Op1, notInt32Op2, !isOperandConstantImmediateInt(op1), isOperandConstantImmediateInt(op1) || !isOperandConstantImmediateInt(op2));
+ end.link(this);
+}
+
+void JIT::emitSlow_op_jless(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ unsigned op1 = currentInstruction[1].u.operand;
+ unsigned op2 = currentInstruction[2].u.operand;
+ unsigned target = currentInstruction[3].u.operand;
+
+ if (isOperandConstantImmediateChar(op1) || isOperandConstantImmediateChar(op2)) {
+ linkSlowCase(iter);
+ linkSlowCase(iter);
+ linkSlowCase(iter);
+ linkSlowCase(iter);
+ } else {
+ if (!supportsFloatingPoint()) {
+ if (!isOperandConstantImmediateInt(op1) && !isOperandConstantImmediateInt(op2))
+ linkSlowCase(iter); // int32 check
+ linkSlowCase(iter); // int32 check
+ } else {
+ if (!isOperandConstantImmediateInt(op1)) {
+ linkSlowCase(iter); // double check
+ linkSlowCase(iter); // int32 check
+ }
+ if (isOperandConstantImmediateInt(op1) || !isOperandConstantImmediateInt(op2))
+ linkSlowCase(iter); // double check
+ }
+ }
+ JITStubCall stubCall(this, cti_op_jless);
+ stubCall.addArgument(op1);
+ stubCall.addArgument(op2);
+ stubCall.call();
+ emitJumpSlowToHot(branchTest32(NonZero, regT0), target);
+}
+
+void JIT::emit_op_jlesseq(Instruction* currentInstruction, bool invert)
+{
+ unsigned op1 = currentInstruction[1].u.operand;
+ unsigned op2 = currentInstruction[2].u.operand;
+ unsigned target = currentInstruction[3].u.operand;
+
+ JumpList notInt32Op1;
+ JumpList notInt32Op2;
+
+ // Character less.
+ if (isOperandConstantImmediateChar(op1)) {
+ emitLoad(op2, regT1, regT0);
+ addSlowCase(branch32(NotEqual, regT1, Imm32(JSValue::CellTag)));
+ JumpList failures;
+ emitLoadCharacterString(regT0, regT0, failures);
+ addSlowCase(failures);
+ addJump(branch32(invert ? LessThan : GreaterThanOrEqual, regT0, Imm32(asString(getConstantOperand(op1))->tryGetValue()[0])), target);
+ return;
+ }
+ if (isOperandConstantImmediateChar(op2)) {
+ emitLoad(op1, regT1, regT0);
+ addSlowCase(branch32(NotEqual, regT1, Imm32(JSValue::CellTag)));
+ JumpList failures;
+ emitLoadCharacterString(regT0, regT0, failures);
+ addSlowCase(failures);
+ addJump(branch32(invert ? GreaterThan : LessThanOrEqual, regT0, Imm32(asString(getConstantOperand(op2))->tryGetValue()[0])), target);
+ return;
+ }
+ if (isOperandConstantImmediateInt(op1)) {
+ emitLoad(op2, regT3, regT2);
+ notInt32Op2.append(branch32(NotEqual, regT3, Imm32(JSValue::Int32Tag)));
+ addJump(branch32(invert ? LessThan : GreaterThanOrEqual, regT2, Imm32(getConstantOperand(op1).asInt32())), target);
+ } else if (isOperandConstantImmediateInt(op2)) {
+ emitLoad(op1, regT1, regT0);
+ notInt32Op1.append(branch32(NotEqual, regT1, Imm32(JSValue::Int32Tag)));
+ addJump(branch32(invert ? GreaterThan : LessThanOrEqual, regT0, Imm32(getConstantOperand(op2).asInt32())), target);
+ } else {
+ emitLoad2(op1, regT1, regT0, op2, regT3, regT2);
+ notInt32Op1.append(branch32(NotEqual, regT1, Imm32(JSValue::Int32Tag)));
+ notInt32Op2.append(branch32(NotEqual, regT3, Imm32(JSValue::Int32Tag)));
+ addJump(branch32(invert ? GreaterThan : LessThanOrEqual, regT0, regT2), target);
+ }
+
+ if (!supportsFloatingPoint()) {
+ addSlowCase(notInt32Op1);
+ addSlowCase(notInt32Op2);
+ return;
+ }
+ Jump end = jump();
+
+ // Double less.
+ emitBinaryDoubleOp(invert ? op_jnlesseq : op_jlesseq, target, op1, op2, OperandTypes(), notInt32Op1, notInt32Op2, !isOperandConstantImmediateInt(op1), isOperandConstantImmediateInt(op1) || !isOperandConstantImmediateInt(op2));
+ end.link(this);
+}
+
+void JIT::emitSlow_op_jlesseq(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter, bool invert)
+{
+ unsigned op1 = currentInstruction[1].u.operand;
+ unsigned op2 = currentInstruction[2].u.operand;
+ unsigned target = currentInstruction[3].u.operand;
+
+ if (isOperandConstantImmediateChar(op1) || isOperandConstantImmediateChar(op2)) {
+ linkSlowCase(iter);
+ linkSlowCase(iter);
+ linkSlowCase(iter);
+ linkSlowCase(iter);
+ } else {
+ if (!supportsFloatingPoint()) {
+ if (!isOperandConstantImmediateInt(op1) && !isOperandConstantImmediateInt(op2))
+ linkSlowCase(iter); // int32 check
+ linkSlowCase(iter); // int32 check
+ } else {
+ if (!isOperandConstantImmediateInt(op1)) {
+ linkSlowCase(iter); // double check
+ linkSlowCase(iter); // int32 check
+ }
+ if (isOperandConstantImmediateInt(op1) || !isOperandConstantImmediateInt(op2))
+ linkSlowCase(iter); // double check
+ }
+ }
+
+ JITStubCall stubCall(this, cti_op_jlesseq);
+ stubCall.addArgument(op1);
+ stubCall.addArgument(op2);
+ stubCall.call();
+ emitJumpSlowToHot(branchTest32(invert ? Zero : NonZero, regT0), target);
+}
+
+void JIT::emit_op_jnlesseq(Instruction* currentInstruction)
+{
+ emit_op_jlesseq(currentInstruction, true);
+}
+
+void JIT::emitSlow_op_jnlesseq(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ emitSlow_op_jlesseq(currentInstruction, iter, true);
+}
+
+// LeftShift (<<)
+
+void JIT::emit_op_lshift(Instruction* currentInstruction)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+ unsigned op1 = currentInstruction[2].u.operand;
+ unsigned op2 = currentInstruction[3].u.operand;
+
+ if (isOperandConstantImmediateInt(op2)) {
+ emitLoad(op1, regT1, regT0);
+ addSlowCase(branch32(NotEqual, regT1, Imm32(JSValue::Int32Tag)));
+ lshift32(Imm32(getConstantOperand(op2).asInt32()), regT0);
+ emitStoreInt32(dst, regT0, dst == op1);
+ return;
+ }
+
+ emitLoad2(op1, regT1, regT0, op2, regT3, regT2);
+ if (!isOperandConstantImmediateInt(op1))
+ addSlowCase(branch32(NotEqual, regT1, Imm32(JSValue::Int32Tag)));
+ addSlowCase(branch32(NotEqual, regT3, Imm32(JSValue::Int32Tag)));
+ lshift32(regT2, regT0);
+ emitStoreInt32(dst, regT0, dst == op1 || dst == op2);
+}
+
+void JIT::emitSlow_op_lshift(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+ unsigned op1 = currentInstruction[2].u.operand;
+ unsigned op2 = currentInstruction[3].u.operand;
+
+ if (!isOperandConstantImmediateInt(op1) && !isOperandConstantImmediateInt(op2))
+ linkSlowCase(iter); // int32 check
+ linkSlowCase(iter); // int32 check
+
+ JITStubCall stubCall(this, cti_op_lshift);
+ stubCall.addArgument(op1);
+ stubCall.addArgument(op2);
+ stubCall.call(dst);
+}
+
+// RightShift (>>) and UnsignedRightShift (>>>) helper
+
+void JIT::emitRightShift(Instruction* currentInstruction, bool isUnsigned)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+ unsigned op1 = currentInstruction[2].u.operand;
+ unsigned op2 = currentInstruction[3].u.operand;
+
+ // Slow case of rshift makes assumptions about what registers hold the
+ // shift arguments, so any changes must be updated there as well.
+ if (isOperandConstantImmediateInt(op2)) {
+ emitLoad(op1, regT1, regT0);
+ addSlowCase(branch32(NotEqual, regT1, Imm32(JSValue::Int32Tag)));
+ int shift = getConstantOperand(op2).asInt32();
+ if (isUnsigned) {
+ if (shift)
+ urshift32(Imm32(shift & 0x1f), regT0);
+ // unsigned shift < 0 or shift = k*2^32 may result in (essentially)
+ // a toUint conversion, which can result in a value we can represent
+ // as an immediate int.
+ if (shift < 0 || !(shift & 31))
+ addSlowCase(branch32(LessThan, regT0, Imm32(0)));
+ } else if (shift) { // signed right shift by zero is simply toInt conversion
+ rshift32(Imm32(shift & 0x1f), regT0);
+ }
+ emitStoreInt32(dst, regT0, dst == op1);
+ return;
+ }
+
+ emitLoad2(op1, regT1, regT0, op2, regT3, regT2);
+ if (!isOperandConstantImmediateInt(op1))
+ addSlowCase(branch32(NotEqual, regT1, Imm32(JSValue::Int32Tag)));
+ addSlowCase(branch32(NotEqual, regT3, Imm32(JSValue::Int32Tag)));
+ if (isUnsigned) {
+ urshift32(regT2, regT0);
+ addSlowCase(branch32(LessThan, regT0, Imm32(0)));
+ } else
+ rshift32(regT2, regT0);
+ emitStoreInt32(dst, regT0, dst == op1 || dst == op2);
+}
+
+void JIT::emitRightShiftSlowCase(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter, bool isUnsigned)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+ unsigned op1 = currentInstruction[2].u.operand;
+ unsigned op2 = currentInstruction[3].u.operand;
+ if (isOperandConstantImmediateInt(op2)) {
+ int shift = getConstantOperand(op2).asInt32();
+ // op1 = regT1:regT0
+ linkSlowCase(iter); // int32 check
+ if (supportsFloatingPointTruncate()) {
+ JumpList failures;
+ failures.append(branch32(AboveOrEqual, regT1, Imm32(JSValue::LowestTag)));
+ emitLoadDouble(op1, fpRegT0);
+ failures.append(branchTruncateDoubleToInt32(fpRegT0, regT0));
+ if (isUnsigned) {
+ if (shift)
+ urshift32(Imm32(shift & 0x1f), regT0);
+ if (shift < 0 || !(shift & 31))
+ failures.append(branch32(LessThan, regT0, Imm32(0)));
+ } else if (shift)
+ rshift32(Imm32(shift & 0x1f), regT0);
+ emitStoreInt32(dst, regT0, false);
+ emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_rshift));
+ failures.link(this);
+ }
+ if (isUnsigned && (shift < 0 || !(shift & 31)))
+ linkSlowCase(iter); // failed to box in hot path
+ } else {
+ // op1 = regT1:regT0
+ // op2 = regT3:regT2
+ if (!isOperandConstantImmediateInt(op1)) {
+ linkSlowCase(iter); // int32 check -- op1 is not an int
+ if (supportsFloatingPointTruncate()) {
+ Jump notDouble = branch32(Above, regT1, Imm32(JSValue::LowestTag)); // op1 is not a double
+ emitLoadDouble(op1, fpRegT0);
+ Jump notInt = branch32(NotEqual, regT3, Imm32(JSValue::Int32Tag)); // op2 is not an int
+ Jump cantTruncate = branchTruncateDoubleToInt32(fpRegT0, regT0);
+ if (isUnsigned)
+ urshift32(regT2, regT0);
+ else
+ rshift32(regT2, regT0);
+ emitStoreInt32(dst, regT0, false);
+ emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_rshift));
+ notDouble.link(this);
+ notInt.link(this);
+ cantTruncate.link(this);
+ }
+ }
+
+ linkSlowCase(iter); // int32 check - op2 is not an int
+ if (isUnsigned)
+ linkSlowCase(iter); // Can't represent unsigned result as an immediate
+ }
+
+ JITStubCall stubCall(this, isUnsigned ? cti_op_urshift : cti_op_rshift);
+ stubCall.addArgument(op1);
+ stubCall.addArgument(op2);
+ stubCall.call(dst);
+}
+
+// RightShift (>>)
+
+void JIT::emit_op_rshift(Instruction* currentInstruction)
+{
+ emitRightShift(currentInstruction, false);
+}
+
+void JIT::emitSlow_op_rshift(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ emitRightShiftSlowCase(currentInstruction, iter, false);
+}
+
+// UnsignedRightShift (>>>)
+
+void JIT::emit_op_urshift(Instruction* currentInstruction)
+{
+ emitRightShift(currentInstruction, true);
+}
+
+void JIT::emitSlow_op_urshift(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ emitRightShiftSlowCase(currentInstruction, iter, true);
+}
+
+// BitAnd (&)
+
+void JIT::emit_op_bitand(Instruction* currentInstruction)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+ unsigned op1 = currentInstruction[2].u.operand;
+ unsigned op2 = currentInstruction[3].u.operand;
+
+ unsigned op;
+ int32_t constant;
+ if (getOperandConstantImmediateInt(op1, op2, op, constant)) {
+ emitLoad(op, regT1, regT0);
+ addSlowCase(branch32(NotEqual, regT1, Imm32(JSValue::Int32Tag)));
+ and32(Imm32(constant), regT0);
+ emitStoreInt32(dst, regT0, (op == dst));
+ return;
+ }
+
+ emitLoad2(op1, regT1, regT0, op2, regT3, regT2);
+ addSlowCase(branch32(NotEqual, regT1, Imm32(JSValue::Int32Tag)));
+ addSlowCase(branch32(NotEqual, regT3, Imm32(JSValue::Int32Tag)));
+ and32(regT2, regT0);
+ emitStoreInt32(dst, regT0, (op1 == dst || op2 == dst));
+}
+
+void JIT::emitSlow_op_bitand(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+ unsigned op1 = currentInstruction[2].u.operand;
+ unsigned op2 = currentInstruction[3].u.operand;
+
+ if (!isOperandConstantImmediateInt(op1) && !isOperandConstantImmediateInt(op2))
+ linkSlowCase(iter); // int32 check
+ linkSlowCase(iter); // int32 check
+
+ JITStubCall stubCall(this, cti_op_bitand);
+ stubCall.addArgument(op1);
+ stubCall.addArgument(op2);
+ stubCall.call(dst);
+}
+
+// BitOr (|)
+
+void JIT::emit_op_bitor(Instruction* currentInstruction)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+ unsigned op1 = currentInstruction[2].u.operand;
+ unsigned op2 = currentInstruction[3].u.operand;
+
+ unsigned op;
+ int32_t constant;
+ if (getOperandConstantImmediateInt(op1, op2, op, constant)) {
+ emitLoad(op, regT1, regT0);
+ addSlowCase(branch32(NotEqual, regT1, Imm32(JSValue::Int32Tag)));
+ or32(Imm32(constant), regT0);
+ emitStoreInt32(dst, regT0, (op == dst));
+ return;
+ }
+
+ emitLoad2(op1, regT1, regT0, op2, regT3, regT2);
+ addSlowCase(branch32(NotEqual, regT1, Imm32(JSValue::Int32Tag)));
+ addSlowCase(branch32(NotEqual, regT3, Imm32(JSValue::Int32Tag)));
+ or32(regT2, regT0);
+ emitStoreInt32(dst, regT0, (op1 == dst || op2 == dst));
+}
+
+void JIT::emitSlow_op_bitor(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+ unsigned op1 = currentInstruction[2].u.operand;
+ unsigned op2 = currentInstruction[3].u.operand;
+
+ if (!isOperandConstantImmediateInt(op1) && !isOperandConstantImmediateInt(op2))
+ linkSlowCase(iter); // int32 check
+ linkSlowCase(iter); // int32 check
+
+ JITStubCall stubCall(this, cti_op_bitor);
+ stubCall.addArgument(op1);
+ stubCall.addArgument(op2);
+ stubCall.call(dst);
+}
+
+// BitXor (^)
+
+void JIT::emit_op_bitxor(Instruction* currentInstruction)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+ unsigned op1 = currentInstruction[2].u.operand;
+ unsigned op2 = currentInstruction[3].u.operand;
+
+ unsigned op;
+ int32_t constant;
+ if (getOperandConstantImmediateInt(op1, op2, op, constant)) {
+ emitLoad(op, regT1, regT0);
+ addSlowCase(branch32(NotEqual, regT1, Imm32(JSValue::Int32Tag)));
+ xor32(Imm32(constant), regT0);
+ emitStoreInt32(dst, regT0, (op == dst));
+ return;
+ }
+
+ emitLoad2(op1, regT1, regT0, op2, regT3, regT2);
+ addSlowCase(branch32(NotEqual, regT1, Imm32(JSValue::Int32Tag)));
+ addSlowCase(branch32(NotEqual, regT3, Imm32(JSValue::Int32Tag)));
+ xor32(regT2, regT0);
+ emitStoreInt32(dst, regT0, (op1 == dst || op2 == dst));
+}
+
+void JIT::emitSlow_op_bitxor(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+ unsigned op1 = currentInstruction[2].u.operand;
+ unsigned op2 = currentInstruction[3].u.operand;
+
+ if (!isOperandConstantImmediateInt(op1) && !isOperandConstantImmediateInt(op2))
+ linkSlowCase(iter); // int32 check
+ linkSlowCase(iter); // int32 check
+
+ JITStubCall stubCall(this, cti_op_bitxor);
+ stubCall.addArgument(op1);
+ stubCall.addArgument(op2);
+ stubCall.call(dst);
+}
+
+// BitNot (~)
+
+void JIT::emit_op_bitnot(Instruction* currentInstruction)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+ unsigned src = currentInstruction[2].u.operand;
+
+ emitLoad(src, regT1, regT0);
+ addSlowCase(branch32(NotEqual, regT1, Imm32(JSValue::Int32Tag)));
+
+ not32(regT0);
+ emitStoreInt32(dst, regT0, (dst == src));
+}
+
+void JIT::emitSlow_op_bitnot(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+
+ linkSlowCase(iter); // int32 check
+
+ JITStubCall stubCall(this, cti_op_bitnot);
+ stubCall.addArgument(regT1, regT0);
+ stubCall.call(dst);
+}
+
+// PostInc (i++)
+
+void JIT::emit_op_post_inc(Instruction* currentInstruction)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+ unsigned srcDst = currentInstruction[2].u.operand;
+
+ emitLoad(srcDst, regT1, regT0);
+ addSlowCase(branch32(NotEqual, regT1, Imm32(JSValue::Int32Tag)));
+
+ if (dst == srcDst) // x = x++ is a noop for ints.
+ return;
+
+ emitStoreInt32(dst, regT0);
+
+ addSlowCase(branchAdd32(Overflow, Imm32(1), regT0));
+ emitStoreInt32(srcDst, regT0, true);
+}
+
+void JIT::emitSlow_op_post_inc(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+ unsigned srcDst = currentInstruction[2].u.operand;
+
+ linkSlowCase(iter); // int32 check
+ if (dst != srcDst)
+ linkSlowCase(iter); // overflow check
+
+ JITStubCall stubCall(this, cti_op_post_inc);
+ stubCall.addArgument(srcDst);
+ stubCall.addArgument(Imm32(srcDst));
+ stubCall.call(dst);
+}
+
+// PostDec (i--)
+
+void JIT::emit_op_post_dec(Instruction* currentInstruction)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+ unsigned srcDst = currentInstruction[2].u.operand;
+
+ emitLoad(srcDst, regT1, regT0);
+ addSlowCase(branch32(NotEqual, regT1, Imm32(JSValue::Int32Tag)));
+
+ if (dst == srcDst) // x = x-- is a noop for ints.
+ return;
+
+ emitStoreInt32(dst, regT0);
+
+ addSlowCase(branchSub32(Overflow, Imm32(1), regT0));
+ emitStoreInt32(srcDst, regT0, true);
+}
+
+void JIT::emitSlow_op_post_dec(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+ unsigned srcDst = currentInstruction[2].u.operand;
+
+ linkSlowCase(iter); // int32 check
+ if (dst != srcDst)
+ linkSlowCase(iter); // overflow check
+
+ JITStubCall stubCall(this, cti_op_post_dec);
+ stubCall.addArgument(srcDst);
+ stubCall.addArgument(Imm32(srcDst));
+ stubCall.call(dst);
+}
+
+// PreInc (++i)
+
+void JIT::emit_op_pre_inc(Instruction* currentInstruction)
+{
+ unsigned srcDst = currentInstruction[1].u.operand;
+
+ emitLoad(srcDst, regT1, regT0);
+
+ addSlowCase(branch32(NotEqual, regT1, Imm32(JSValue::Int32Tag)));
+ addSlowCase(branchAdd32(Overflow, Imm32(1), regT0));
+ emitStoreInt32(srcDst, regT0, true);
+}
+
+void JIT::emitSlow_op_pre_inc(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ unsigned srcDst = currentInstruction[1].u.operand;
+
+ linkSlowCase(iter); // int32 check
+ linkSlowCase(iter); // overflow check
+
+ JITStubCall stubCall(this, cti_op_pre_inc);
+ stubCall.addArgument(srcDst);
+ stubCall.call(srcDst);
+}
+
+// PreDec (--i)
+
+void JIT::emit_op_pre_dec(Instruction* currentInstruction)
+{
+ unsigned srcDst = currentInstruction[1].u.operand;
+
+ emitLoad(srcDst, regT1, regT0);
+
+ addSlowCase(branch32(NotEqual, regT1, Imm32(JSValue::Int32Tag)));
+ addSlowCase(branchSub32(Overflow, Imm32(1), regT0));
+ emitStoreInt32(srcDst, regT0, true);
+}
+
+void JIT::emitSlow_op_pre_dec(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ unsigned srcDst = currentInstruction[1].u.operand;
+
+ linkSlowCase(iter); // int32 check
+ linkSlowCase(iter); // overflow check
+
+ JITStubCall stubCall(this, cti_op_pre_dec);
+ stubCall.addArgument(srcDst);
+ stubCall.call(srcDst);
+}
+
+// Addition (+)
+
+void JIT::emit_op_add(Instruction* currentInstruction)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+ unsigned op1 = currentInstruction[2].u.operand;
+ unsigned op2 = currentInstruction[3].u.operand;
+ OperandTypes types = OperandTypes::fromInt(currentInstruction[4].u.operand);
+
+ if (!types.first().mightBeNumber() || !types.second().mightBeNumber()) {
+ JITStubCall stubCall(this, cti_op_add);
+ stubCall.addArgument(op1);
+ stubCall.addArgument(op2);
+ stubCall.call(dst);
+ return;
+ }
+
+ JumpList notInt32Op1;
+ JumpList notInt32Op2;
+
+ unsigned op;
+ int32_t constant;
+ if (getOperandConstantImmediateInt(op1, op2, op, constant)) {
+ emitAdd32Constant(dst, op, constant, op == op1 ? types.first() : types.second());
+ return;
+ }
+
+ emitLoad2(op1, regT1, regT0, op2, regT3, regT2);
+ notInt32Op1.append(branch32(NotEqual, regT1, Imm32(JSValue::Int32Tag)));
+ notInt32Op2.append(branch32(NotEqual, regT3, Imm32(JSValue::Int32Tag)));
+
+ // Int32 case.
+ addSlowCase(branchAdd32(Overflow, regT2, regT0));
+ emitStoreInt32(dst, regT0, (op1 == dst || op2 == dst));
+
+ if (!supportsFloatingPoint()) {
+ addSlowCase(notInt32Op1);
+ addSlowCase(notInt32Op2);
+ return;
+ }
+ Jump end = jump();
+
+ // Double case.
+ emitBinaryDoubleOp(op_add, dst, op1, op2, types, notInt32Op1, notInt32Op2);
+ end.link(this);
+}
+
+void JIT::emitAdd32Constant(unsigned dst, unsigned op, int32_t constant, ResultType opType)
+{
+ // Int32 case.
+ emitLoad(op, regT1, regT0);
+ Jump notInt32 = branch32(NotEqual, regT1, Imm32(JSValue::Int32Tag));
+ addSlowCase(branchAdd32(Overflow, Imm32(constant), regT0));
+ emitStoreInt32(dst, regT0, (op == dst));
+
+ // Double case.
+ if (!supportsFloatingPoint()) {
+ addSlowCase(notInt32);
+ return;
+ }
+ Jump end = jump();
+
+ notInt32.link(this);
+ if (!opType.definitelyIsNumber())
+ addSlowCase(branch32(Above, regT1, Imm32(JSValue::LowestTag)));
+ move(Imm32(constant), regT2);
+ convertInt32ToDouble(regT2, fpRegT0);
+ emitLoadDouble(op, fpRegT1);
+ addDouble(fpRegT1, fpRegT0);
+ emitStoreDouble(dst, fpRegT0);
+
+ end.link(this);
+}
+
+void JIT::emitSlow_op_add(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+ unsigned op1 = currentInstruction[2].u.operand;
+ unsigned op2 = currentInstruction[3].u.operand;
+ OperandTypes types = OperandTypes::fromInt(currentInstruction[4].u.operand);
+
+ if (!types.first().mightBeNumber() || !types.second().mightBeNumber())
+ return;
+
+ unsigned op;
+ int32_t constant;
+ if (getOperandConstantImmediateInt(op1, op2, op, constant)) {
+ linkSlowCase(iter); // overflow check
+
+ if (!supportsFloatingPoint())
+ linkSlowCase(iter); // non-sse case
+ else {
+ ResultType opType = op == op1 ? types.first() : types.second();
+ if (!opType.definitelyIsNumber())
+ linkSlowCase(iter); // double check
+ }
+ } else {
+ linkSlowCase(iter); // overflow check
+
+ if (!supportsFloatingPoint()) {
+ linkSlowCase(iter); // int32 check
+ linkSlowCase(iter); // int32 check
+ } else {
+ if (!types.first().definitelyIsNumber())
+ linkSlowCase(iter); // double check
+
+ if (!types.second().definitelyIsNumber()) {
+ linkSlowCase(iter); // int32 check
+ linkSlowCase(iter); // double check
+ }
+ }
+ }
+
+ JITStubCall stubCall(this, cti_op_add);
+ stubCall.addArgument(op1);
+ stubCall.addArgument(op2);
+ stubCall.call(dst);
+}
+
+// Subtraction (-)
+
+void JIT::emit_op_sub(Instruction* currentInstruction)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+ unsigned op1 = currentInstruction[2].u.operand;
+ unsigned op2 = currentInstruction[3].u.operand;
+ OperandTypes types = OperandTypes::fromInt(currentInstruction[4].u.operand);
+
+ JumpList notInt32Op1;
+ JumpList notInt32Op2;
+
+ if (isOperandConstantImmediateInt(op2)) {
+ emitSub32Constant(dst, op1, getConstantOperand(op2).asInt32(), types.first());
+ return;
+ }
+
+ emitLoad2(op1, regT1, regT0, op2, regT3, regT2);
+ notInt32Op1.append(branch32(NotEqual, regT1, Imm32(JSValue::Int32Tag)));
+ notInt32Op2.append(branch32(NotEqual, regT3, Imm32(JSValue::Int32Tag)));
+
+ // Int32 case.
+ addSlowCase(branchSub32(Overflow, regT2, regT0));
+ emitStoreInt32(dst, regT0, (op1 == dst || op2 == dst));
+
+ if (!supportsFloatingPoint()) {
+ addSlowCase(notInt32Op1);
+ addSlowCase(notInt32Op2);
+ return;
+ }
+ Jump end = jump();
+
+ // Double case.
+ emitBinaryDoubleOp(op_sub, dst, op1, op2, types, notInt32Op1, notInt32Op2);
+ end.link(this);
+}
+
+void JIT::emitSub32Constant(unsigned dst, unsigned op, int32_t constant, ResultType opType)
+{
+ // Int32 case.
+ emitLoad(op, regT1, regT0);
+ Jump notInt32 = branch32(NotEqual, regT1, Imm32(JSValue::Int32Tag));
+ addSlowCase(branchSub32(Overflow, Imm32(constant), regT0));
+ emitStoreInt32(dst, regT0, (op == dst));
+
+ // Double case.
+ if (!supportsFloatingPoint()) {
+ addSlowCase(notInt32);
+ return;
+ }
+ Jump end = jump();
+
+ notInt32.link(this);
+ if (!opType.definitelyIsNumber())
+ addSlowCase(branch32(Above, regT1, Imm32(JSValue::LowestTag)));
+ move(Imm32(constant), regT2);
+ convertInt32ToDouble(regT2, fpRegT0);
+ emitLoadDouble(op, fpRegT1);
+ subDouble(fpRegT0, fpRegT1);
+ emitStoreDouble(dst, fpRegT1);
+
+ end.link(this);
+}
+
+void JIT::emitSlow_op_sub(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+ unsigned op1 = currentInstruction[2].u.operand;
+ unsigned op2 = currentInstruction[3].u.operand;
+ OperandTypes types = OperandTypes::fromInt(currentInstruction[4].u.operand);
+
+ if (isOperandConstantImmediateInt(op2)) {
+ linkSlowCase(iter); // overflow check
+
+ if (!supportsFloatingPoint() || !types.first().definitelyIsNumber())
+ linkSlowCase(iter); // int32 or double check
+ } else {
+ linkSlowCase(iter); // overflow check
+
+ if (!supportsFloatingPoint()) {
+ linkSlowCase(iter); // int32 check
+ linkSlowCase(iter); // int32 check
+ } else {
+ if (!types.first().definitelyIsNumber())
+ linkSlowCase(iter); // double check
+
+ if (!types.second().definitelyIsNumber()) {
+ linkSlowCase(iter); // int32 check
+ linkSlowCase(iter); // double check
+ }
+ }
+ }
+
+ JITStubCall stubCall(this, cti_op_sub);
+ stubCall.addArgument(op1);
+ stubCall.addArgument(op2);
+ stubCall.call(dst);
+}
+
+void JIT::emitBinaryDoubleOp(OpcodeID opcodeID, unsigned dst, unsigned op1, unsigned op2, OperandTypes types, JumpList& notInt32Op1, JumpList& notInt32Op2, bool op1IsInRegisters, bool op2IsInRegisters)
+{
+ JumpList end;
+
+ if (!notInt32Op1.empty()) {
+ // Double case 1: Op1 is not int32; Op2 is unknown.
+ notInt32Op1.link(this);
+
+ ASSERT(op1IsInRegisters);
+
+ // Verify Op1 is double.
+ if (!types.first().definitelyIsNumber())
+ addSlowCase(branch32(Above, regT1, Imm32(JSValue::LowestTag)));
+
+ if (!op2IsInRegisters)
+ emitLoad(op2, regT3, regT2);
+
+ Jump doubleOp2 = branch32(Below, regT3, Imm32(JSValue::LowestTag));
+
+ if (!types.second().definitelyIsNumber())
+ addSlowCase(branch32(NotEqual, regT3, Imm32(JSValue::Int32Tag)));
+
+ convertInt32ToDouble(regT2, fpRegT0);
+ Jump doTheMath = jump();
+
+ // Load Op2 as double into double register.
+ doubleOp2.link(this);
+ emitLoadDouble(op2, fpRegT0);
+
+ // Do the math.
+ doTheMath.link(this);
+ switch (opcodeID) {
+ case op_mul:
+ emitLoadDouble(op1, fpRegT2);
+ mulDouble(fpRegT2, fpRegT0);
+ emitStoreDouble(dst, fpRegT0);
+ break;
+ case op_add:
+ emitLoadDouble(op1, fpRegT2);
+ addDouble(fpRegT2, fpRegT0);
+ emitStoreDouble(dst, fpRegT0);
+ break;
+ case op_sub:
+ emitLoadDouble(op1, fpRegT1);
+ subDouble(fpRegT0, fpRegT1);
+ emitStoreDouble(dst, fpRegT1);
+ break;
+ case op_div:
+ emitLoadDouble(op1, fpRegT1);
+ divDouble(fpRegT0, fpRegT1);
+ emitStoreDouble(dst, fpRegT1);
+ break;
+ case op_jnless:
+ emitLoadDouble(op1, fpRegT2);
+ addJump(branchDouble(DoubleLessThanOrEqualOrUnordered, fpRegT0, fpRegT2), dst);
+ break;
+ case op_jless:
+ emitLoadDouble(op1, fpRegT2);
+ addJump(branchDouble(DoubleLessThan, fpRegT2, fpRegT0), dst);
+ break;
+ case op_jlesseq:
+ emitLoadDouble(op1, fpRegT2);
+ addJump(branchDouble(DoubleLessThanOrEqual, fpRegT2, fpRegT0), dst);
+ break;
+ case op_jnlesseq:
+ emitLoadDouble(op1, fpRegT2);
+ addJump(branchDouble(DoubleLessThanOrUnordered, fpRegT0, fpRegT2), dst);
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ }
+
+ if (!notInt32Op2.empty())
+ end.append(jump());
+ }
+
+ if (!notInt32Op2.empty()) {
+ // Double case 2: Op1 is int32; Op2 is not int32.
+ notInt32Op2.link(this);
+
+ ASSERT(op2IsInRegisters);
+
+ if (!op1IsInRegisters)
+ emitLoadPayload(op1, regT0);
+
+ convertInt32ToDouble(regT0, fpRegT0);
+
+ // Verify op2 is double.
+ if (!types.second().definitelyIsNumber())
+ addSlowCase(branch32(Above, regT3, Imm32(JSValue::LowestTag)));
+
+ // Do the math.
+ switch (opcodeID) {
+ case op_mul:
+ emitLoadDouble(op2, fpRegT2);
+ mulDouble(fpRegT2, fpRegT0);
+ emitStoreDouble(dst, fpRegT0);
+ break;
+ case op_add:
+ emitLoadDouble(op2, fpRegT2);
+ addDouble(fpRegT2, fpRegT0);
+ emitStoreDouble(dst, fpRegT0);
+ break;
+ case op_sub:
+ emitLoadDouble(op2, fpRegT2);
+ subDouble(fpRegT2, fpRegT0);
+ emitStoreDouble(dst, fpRegT0);
+ break;
+ case op_div:
+ emitLoadDouble(op2, fpRegT2);
+ divDouble(fpRegT2, fpRegT0);
+ emitStoreDouble(dst, fpRegT0);
+ break;
+ case op_jnless:
+ emitLoadDouble(op2, fpRegT1);
+ addJump(branchDouble(DoubleLessThanOrEqualOrUnordered, fpRegT1, fpRegT0), dst);
+ break;
+ case op_jless:
+ emitLoadDouble(op2, fpRegT1);
+ addJump(branchDouble(DoubleLessThan, fpRegT0, fpRegT1), dst);
+ break;
+ case op_jnlesseq:
+ emitLoadDouble(op2, fpRegT1);
+ addJump(branchDouble(DoubleLessThanOrUnordered, fpRegT1, fpRegT0), dst);
+ break;
+ case op_jlesseq:
+ emitLoadDouble(op2, fpRegT1);
+ addJump(branchDouble(DoubleLessThanOrEqual, fpRegT0, fpRegT1), dst);
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ }
+ }
+
+ end.link(this);
+}
+
+// Multiplication (*)
+
+void JIT::emit_op_mul(Instruction* currentInstruction)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+ unsigned op1 = currentInstruction[2].u.operand;
+ unsigned op2 = currentInstruction[3].u.operand;
+ OperandTypes types = OperandTypes::fromInt(currentInstruction[4].u.operand);
+
+ JumpList notInt32Op1;
+ JumpList notInt32Op2;
+
+ emitLoad2(op1, regT1, regT0, op2, regT3, regT2);
+ notInt32Op1.append(branch32(NotEqual, regT1, Imm32(JSValue::Int32Tag)));
+ notInt32Op2.append(branch32(NotEqual, regT3, Imm32(JSValue::Int32Tag)));
+
+ // Int32 case.
+ move(regT0, regT3);
+ addSlowCase(branchMul32(Overflow, regT2, regT0));
+ addSlowCase(branchTest32(Zero, regT0));
+ emitStoreInt32(dst, regT0, (op1 == dst || op2 == dst));
+
+ if (!supportsFloatingPoint()) {
+ addSlowCase(notInt32Op1);
+ addSlowCase(notInt32Op2);
+ return;
+ }
+ Jump end = jump();
+
+ // Double case.
+ emitBinaryDoubleOp(op_mul, dst, op1, op2, types, notInt32Op1, notInt32Op2);
+ end.link(this);
+}
+
+void JIT::emitSlow_op_mul(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+ unsigned op1 = currentInstruction[2].u.operand;
+ unsigned op2 = currentInstruction[3].u.operand;
+ OperandTypes types = OperandTypes::fromInt(currentInstruction[4].u.operand);
+
+ Jump overflow = getSlowCase(iter); // overflow check
+ linkSlowCase(iter); // zero result check
+
+ Jump negZero = branchOr32(Signed, regT2, regT3);
+ emitStoreInt32(dst, Imm32(0), (op1 == dst || op2 == dst));
+
+ emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_mul));
+
+ negZero.link(this);
+ overflow.link(this);
+
+ if (!supportsFloatingPoint()) {
+ linkSlowCase(iter); // int32 check
+ linkSlowCase(iter); // int32 check
+ }
+
+ if (supportsFloatingPoint()) {
+ if (!types.first().definitelyIsNumber())
+ linkSlowCase(iter); // double check
+
+ if (!types.second().definitelyIsNumber()) {
+ linkSlowCase(iter); // int32 check
+ linkSlowCase(iter); // double check
+ }
+ }
+
+ Label jitStubCall(this);
+ JITStubCall stubCall(this, cti_op_mul);
+ stubCall.addArgument(op1);
+ stubCall.addArgument(op2);
+ stubCall.call(dst);
+}
+
+// Division (/)
+
+void JIT::emit_op_div(Instruction* currentInstruction)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+ unsigned op1 = currentInstruction[2].u.operand;
+ unsigned op2 = currentInstruction[3].u.operand;
+ OperandTypes types = OperandTypes::fromInt(currentInstruction[4].u.operand);
+
+ if (!supportsFloatingPoint()) {
+ addSlowCase(jump());
+ return;
+ }
+
+ // Int32 divide.
+ JumpList notInt32Op1;
+ JumpList notInt32Op2;
+
+ JumpList end;
+
+ emitLoad2(op1, regT1, regT0, op2, regT3, regT2);
+
+ notInt32Op1.append(branch32(NotEqual, regT1, Imm32(JSValue::Int32Tag)));
+ notInt32Op2.append(branch32(NotEqual, regT3, Imm32(JSValue::Int32Tag)));
+
+ convertInt32ToDouble(regT0, fpRegT0);
+ convertInt32ToDouble(regT2, fpRegT1);
+ divDouble(fpRegT1, fpRegT0);
+
+ JumpList doubleResult;
+ branchConvertDoubleToInt32(fpRegT0, regT0, doubleResult, fpRegT1);
+
+ // Int32 result.
+ emitStoreInt32(dst, regT0, (op1 == dst || op2 == dst));
+ end.append(jump());
+
+ // Double result.
+ doubleResult.link(this);
+ emitStoreDouble(dst, fpRegT0);
+ end.append(jump());
+
+ // Double divide.
+ emitBinaryDoubleOp(op_div, dst, op1, op2, types, notInt32Op1, notInt32Op2);
+ end.link(this);
+}
+
+void JIT::emitSlow_op_div(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+ unsigned op1 = currentInstruction[2].u.operand;
+ unsigned op2 = currentInstruction[3].u.operand;
+ OperandTypes types = OperandTypes::fromInt(currentInstruction[4].u.operand);
+
+ if (!supportsFloatingPoint())
+ linkSlowCase(iter);
+ else {
+ if (!types.first().definitelyIsNumber())
+ linkSlowCase(iter); // double check
+
+ if (!types.second().definitelyIsNumber()) {
+ linkSlowCase(iter); // int32 check
+ linkSlowCase(iter); // double check
+ }
+ }
+
+ JITStubCall stubCall(this, cti_op_div);
+ stubCall.addArgument(op1);
+ stubCall.addArgument(op2);
+ stubCall.call(dst);
+}
+
+// Mod (%)
+
+/* ------------------------------ BEGIN: OP_MOD ------------------------------ */
+
+#if CPU(X86) || CPU(X86_64) || CPU(MIPS)
+
+void JIT::emit_op_mod(Instruction* currentInstruction)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+ unsigned op1 = currentInstruction[2].u.operand;
+ unsigned op2 = currentInstruction[3].u.operand;
+
+#if CPU(X86) || CPU(X86_64)
+ // Make sure registers are correct for x86 IDIV instructions.
+ ASSERT(regT0 == X86Registers::eax);
+ ASSERT(regT1 == X86Registers::edx);
+ ASSERT(regT2 == X86Registers::ecx);
+ ASSERT(regT3 == X86Registers::ebx);
+#endif
+
+ if (isOperandConstantImmediateInt(op2) && getConstantOperand(op2).asInt32() != 0) {
+ emitLoad(op1, regT1, regT0);
+ move(Imm32(getConstantOperand(op2).asInt32()), regT2);
+ addSlowCase(branch32(NotEqual, regT1, Imm32(JSValue::Int32Tag)));
+ if (getConstantOperand(op2).asInt32() == -1)
+ addSlowCase(branch32(Equal, regT0, Imm32(0x80000000))); // -2147483648 / -1 => EXC_ARITHMETIC
+ } else {
+ emitLoad2(op1, regT1, regT0, op2, regT3, regT2);
+ addSlowCase(branch32(NotEqual, regT1, Imm32(JSValue::Int32Tag)));
+ addSlowCase(branch32(NotEqual, regT3, Imm32(JSValue::Int32Tag)));
+
+ addSlowCase(branch32(Equal, regT0, Imm32(0x80000000))); // -2147483648 / -1 => EXC_ARITHMETIC
+ addSlowCase(branch32(Equal, regT2, Imm32(0))); // divide by 0
+ }
+
+ move(regT0, regT3); // Save dividend payload, in case of 0.
+#if CPU(X86) || CPU(X86_64)
+ m_assembler.cdq();
+ m_assembler.idivl_r(regT2);
+#elif CPU(MIPS)
+ m_assembler.div(regT0, regT2);
+ m_assembler.mfhi(regT1);
+#endif
+
+ // If the remainder is zero and the dividend is negative, the result is -0.
+ Jump storeResult1 = branchTest32(NonZero, regT1);
+ Jump storeResult2 = branchTest32(Zero, regT3, Imm32(0x80000000)); // not negative
+ emitStore(dst, jsNumber(-0.0));
+ Jump end = jump();
+
+ storeResult1.link(this);
+ storeResult2.link(this);
+ emitStoreInt32(dst, regT1, (op1 == dst || op2 == dst));
+ end.link(this);
+}
+
+void JIT::emitSlow_op_mod(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+ unsigned op1 = currentInstruction[2].u.operand;
+ unsigned op2 = currentInstruction[3].u.operand;
+
+ if (isOperandConstantImmediateInt(op2) && getConstantOperand(op2).asInt32() != 0) {
+ linkSlowCase(iter); // int32 check
+ if (getConstantOperand(op2).asInt32() == -1)
+ linkSlowCase(iter); // 0x80000000 check
+ } else {
+ linkSlowCase(iter); // int32 check
+ linkSlowCase(iter); // int32 check
+ linkSlowCase(iter); // 0 check
+ linkSlowCase(iter); // 0x80000000 check
+ }
+
+ JITStubCall stubCall(this, cti_op_mod);
+ stubCall.addArgument(op1);
+ stubCall.addArgument(op2);
+ stubCall.call(dst);
+}
+
+#else // CPU(X86) || CPU(X86_64) || CPU(MIPS)
+
+void JIT::emit_op_mod(Instruction* currentInstruction)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+ unsigned op1 = currentInstruction[2].u.operand;
+ unsigned op2 = currentInstruction[3].u.operand;
+
+#if ENABLE(JIT_USE_SOFT_MODULO)
+ emitLoad2(op1, regT1, regT0, op2, regT3, regT2);
+ addSlowCase(branch32(NotEqual, regT1, Imm32(JSValue::Int32Tag)));
+ addSlowCase(branch32(NotEqual, regT3, Imm32(JSValue::Int32Tag)));
+
+ addSlowCase(branch32(Equal, regT2, Imm32(0)));
+
+ emitNakedCall(m_globalData->jitStubs->ctiSoftModulo());
+
+ emitStoreInt32(dst, regT0, (op1 == dst || op2 == dst));
+#else
+ JITStubCall stubCall(this, cti_op_mod);
+ stubCall.addArgument(op1);
+ stubCall.addArgument(op2);
+ stubCall.call(dst);
+#endif
+}
+
+void JIT::emitSlow_op_mod(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ UNUSED_PARAM(currentInstruction);
+ UNUSED_PARAM(iter);
+#if ENABLE(JIT_USE_SOFT_MODULO)
+ unsigned result = currentInstruction[1].u.operand;
+ unsigned op1 = currentInstruction[2].u.operand;
+ unsigned op2 = currentInstruction[3].u.operand;
+ linkSlowCase(iter);
+ linkSlowCase(iter);
+ linkSlowCase(iter);
+ JITStubCall stubCall(this, cti_op_mod);
+ stubCall.addArgument(op1);
+ stubCall.addArgument(op2);
+ stubCall.call(result);
+#else
+ ASSERT_NOT_REACHED();
+#endif
+}
+
+#endif // CPU(X86) || CPU(X86_64)
+
+/* ------------------------------ END: OP_MOD ------------------------------ */
+
+} // namespace JSC
+
+#endif // USE(JSVALUE32_64)
+#endif // ENABLE(JIT)
diff --git a/Source/JavaScriptCore/jit/JITCall.cpp b/Source/JavaScriptCore/jit/JITCall.cpp
new file mode 100644
index 0000000..fdd0d47
--- /dev/null
+++ b/Source/JavaScriptCore/jit/JITCall.cpp
@@ -0,0 +1,261 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if ENABLE(JIT)
+#if USE(JSVALUE64)
+#include "JIT.h"
+
+#include "CodeBlock.h"
+#include "JITInlineMethods.h"
+#include "JITStubCall.h"
+#include "JSArray.h"
+#include "JSFunction.h"
+#include "Interpreter.h"
+#include "ResultType.h"
+#include "SamplingTool.h"
+
+#ifndef NDEBUG
+#include <stdio.h>
+#endif
+
+using namespace std;
+
+namespace JSC {
+
+void JIT::compileOpCallInitializeCallFrame()
+{
+ store32(regT1, Address(callFrameRegister, RegisterFile::ArgumentCount * static_cast<int>(sizeof(Register))));
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_scopeChain) + OBJECT_OFFSETOF(ScopeChain, m_node)), regT3); // newScopeChain
+ storePtr(regT0, Address(callFrameRegister, RegisterFile::Callee * static_cast<int>(sizeof(Register))));
+ storePtr(regT3, Address(callFrameRegister, RegisterFile::ScopeChain * static_cast<int>(sizeof(Register))));
+}
+
+void JIT::emit_op_call_put_result(Instruction* instruction)
+{
+ int dst = instruction[1].u.operand;
+ emitPutVirtualRegister(dst);
+}
+
+void JIT::compileOpCallVarargs(Instruction* instruction)
+{
+ int callee = instruction[1].u.operand;
+ int argCountRegister = instruction[2].u.operand;
+ int registerOffset = instruction[3].u.operand;
+
+ emitGetVirtualRegister(argCountRegister, regT1);
+ emitGetVirtualRegister(callee, regT0);
+ addPtr(Imm32(registerOffset), regT1, regT2);
+
+ // Check for JSFunctions.
+ emitJumpSlowCaseIfNotJSCell(regT0);
+ addSlowCase(branchPtr(NotEqual, Address(regT0), ImmPtr(m_globalData->jsFunctionVPtr)));
+
+ // Speculatively roll the callframe, assuming argCount will match the arity.
+ mul32(Imm32(sizeof(Register)), regT2, regT2);
+ intptr_t offset = (intptr_t)sizeof(Register) * (intptr_t)RegisterFile::CallerFrame;
+ addPtr(Imm32((int32_t)offset), regT2, regT3);
+ addPtr(callFrameRegister, regT3);
+ storePtr(callFrameRegister, regT3);
+ addPtr(regT2, callFrameRegister);
+ emitNakedCall(m_globalData->jitStubs->ctiVirtualCall());
+
+ sampleCodeBlock(m_codeBlock);
+}
+
+void JIT::compileOpCallVarargsSlowCase(Instruction*, Vector<SlowCaseEntry>::iterator& iter)
+{
+ linkSlowCase(iter);
+ linkSlowCase(iter);
+
+ JITStubCall stubCall(this, cti_op_call_NotJSFunction);
+ stubCall.addArgument(regT0);
+ stubCall.addArgument(regT2);
+ stubCall.addArgument(regT1);
+ stubCall.call();
+
+ sampleCodeBlock(m_codeBlock);
+}
+
+#if !ENABLE(JIT_OPTIMIZE_CALL)
+
+/* ------------------------------ BEGIN: !ENABLE(JIT_OPTIMIZE_CALL) ------------------------------ */
+
+void JIT::compileOpCall(OpcodeID opcodeID, Instruction* instruction, unsigned)
+{
+ int callee = instruction[1].u.operand;
+ int argCount = instruction[2].u.operand;
+ int registerOffset = instruction[3].u.operand;
+
+ // Handle eval
+ Jump wasEval;
+ if (opcodeID == op_call_eval) {
+ JITStubCall stubCall(this, cti_op_call_eval);
+ stubCall.addArgument(callee, regT0);
+ stubCall.addArgument(JIT::Imm32(registerOffset));
+ stubCall.addArgument(JIT::Imm32(argCount));
+ stubCall.call();
+ wasEval = branchPtr(NotEqual, regT0, ImmPtr(JSValue::encode(JSValue())));
+ }
+
+ emitGetVirtualRegister(callee, regT0);
+
+ // Check for JSFunctions.
+ emitJumpSlowCaseIfNotJSCell(regT0);
+ addSlowCase(branchPtr(NotEqual, Address(regT0), ImmPtr(m_globalData->jsFunctionVPtr)));
+
+ // Speculatively roll the callframe, assuming argCount will match the arity.
+ storePtr(callFrameRegister, Address(callFrameRegister, (RegisterFile::CallerFrame + registerOffset) * static_cast<int>(sizeof(Register))));
+ addPtr(Imm32(registerOffset * static_cast<int>(sizeof(Register))), callFrameRegister);
+ move(Imm32(argCount), regT1);
+
+ emitNakedCall(opcodeID == op_construct ? m_globalData->jitStubs->ctiVirtualConstruct() : m_globalData->jitStubs->ctiVirtualCall());
+
+ if (opcodeID == op_call_eval)
+ wasEval.link(this);
+
+ sampleCodeBlock(m_codeBlock);
+}
+
+void JIT::compileOpCallSlowCase(Instruction* instruction, Vector<SlowCaseEntry>::iterator& iter, unsigned, OpcodeID opcodeID)
+{
+ int argCount = instruction[2].u.operand;
+ int registerOffset = instruction[3].u.operand;
+
+ linkSlowCase(iter);
+ linkSlowCase(iter);
+
+ JITStubCall stubCall(this, opcodeID == op_construct ? cti_op_construct_NotJSConstruct : cti_op_call_NotJSFunction);
+ stubCall.addArgument(regT0);
+ stubCall.addArgument(JIT::Imm32(registerOffset));
+ stubCall.addArgument(JIT::Imm32(argCount));
+ stubCall.call();
+
+ sampleCodeBlock(m_codeBlock);
+}
+
+#else // !ENABLE(JIT_OPTIMIZE_CALL)
+
+/* ------------------------------ BEGIN: ENABLE(JIT_OPTIMIZE_CALL) ------------------------------ */
+
+void JIT::compileOpCall(OpcodeID opcodeID, Instruction* instruction, unsigned callLinkInfoIndex)
+{
+ int callee = instruction[1].u.operand;
+ int argCount = instruction[2].u.operand;
+ int registerOffset = instruction[3].u.operand;
+
+ // Handle eval
+ Jump wasEval;
+ if (opcodeID == op_call_eval) {
+ JITStubCall stubCall(this, cti_op_call_eval);
+ stubCall.addArgument(callee, regT0);
+ stubCall.addArgument(JIT::Imm32(registerOffset));
+ stubCall.addArgument(JIT::Imm32(argCount));
+ stubCall.call();
+ wasEval = branchPtr(NotEqual, regT0, ImmPtr(JSValue::encode(JSValue())));
+ }
+
+ // This plants a check for a cached JSFunction value, so we can plant a fast link to the callee.
+ // This deliberately leaves the callee in ecx, used when setting up the stack frame below
+ emitGetVirtualRegister(callee, regT0);
+ DataLabelPtr addressOfLinkedFunctionCheck;
+
+ BEGIN_UNINTERRUPTED_SEQUENCE(sequenceOpCall);
+
+ Jump jumpToSlow = branchPtrWithPatch(NotEqual, regT0, addressOfLinkedFunctionCheck, ImmPtr(JSValue::encode(JSValue())));
+
+ END_UNINTERRUPTED_SEQUENCE(sequenceOpCall);
+
+ addSlowCase(jumpToSlow);
+ ASSERT_JIT_OFFSET(differenceBetween(addressOfLinkedFunctionCheck, jumpToSlow), patchOffsetOpCallCompareToJump);
+ m_callStructureStubCompilationInfo[callLinkInfoIndex].hotPathBegin = addressOfLinkedFunctionCheck;
+
+ // The following is the fast case, only used whan a callee can be linked.
+
+ // Fast version of stack frame initialization, directly relative to edi.
+ // Note that this omits to set up RegisterFile::CodeBlock, which is set in the callee
+
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_scopeChain) + OBJECT_OFFSETOF(ScopeChain, m_node)), regT1); // newScopeChain
+
+ store32(Imm32(argCount), Address(callFrameRegister, (registerOffset + RegisterFile::ArgumentCount) * static_cast<int>(sizeof(Register))));
+ storePtr(callFrameRegister, Address(callFrameRegister, (registerOffset + RegisterFile::CallerFrame) * static_cast<int>(sizeof(Register))));
+ storePtr(regT0, Address(callFrameRegister, (registerOffset + RegisterFile::Callee) * static_cast<int>(sizeof(Register))));
+ storePtr(regT1, Address(callFrameRegister, (registerOffset + RegisterFile::ScopeChain) * static_cast<int>(sizeof(Register))));
+ addPtr(Imm32(registerOffset * sizeof(Register)), callFrameRegister);
+
+ // Call to the callee
+ m_callStructureStubCompilationInfo[callLinkInfoIndex].hotPathOther = emitNakedCall();
+
+ if (opcodeID == op_call_eval)
+ wasEval.link(this);
+
+ sampleCodeBlock(m_codeBlock);
+}
+
+void JIT::compileOpCallSlowCase(Instruction* instruction, Vector<SlowCaseEntry>::iterator& iter, unsigned callLinkInfoIndex, OpcodeID opcodeID)
+{
+ int argCount = instruction[2].u.operand;
+ int registerOffset = instruction[3].u.operand;
+
+ linkSlowCase(iter);
+
+ // Fast check for JS function.
+ Jump callLinkFailNotObject = emitJumpIfNotJSCell(regT0);
+ Jump callLinkFailNotJSFunction = branchPtr(NotEqual, Address(regT0), ImmPtr(m_globalData->jsFunctionVPtr));
+
+ // Speculatively roll the callframe, assuming argCount will match the arity.
+ storePtr(callFrameRegister, Address(callFrameRegister, (RegisterFile::CallerFrame + registerOffset) * static_cast<int>(sizeof(Register))));
+ addPtr(Imm32(registerOffset * static_cast<int>(sizeof(Register))), callFrameRegister);
+ move(Imm32(argCount), regT1);
+
+ m_callStructureStubCompilationInfo[callLinkInfoIndex].callReturnLocation = emitNakedCall(opcodeID == op_construct ? m_globalData->jitStubs->ctiVirtualConstructLink() : m_globalData->jitStubs->ctiVirtualCallLink());
+
+ // Done! - return back to the hot path.
+ ASSERT(OPCODE_LENGTH(op_call) == OPCODE_LENGTH(op_call_eval));
+ ASSERT(OPCODE_LENGTH(op_call) == OPCODE_LENGTH(op_construct));
+ emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_call));
+
+ // This handles host functions
+ callLinkFailNotObject.link(this);
+ callLinkFailNotJSFunction.link(this);
+
+ JITStubCall stubCall(this, opcodeID == op_construct ? cti_op_construct_NotJSConstruct : cti_op_call_NotJSFunction);
+ stubCall.addArgument(regT0);
+ stubCall.addArgument(JIT::Imm32(registerOffset));
+ stubCall.addArgument(JIT::Imm32(argCount));
+ stubCall.call();
+
+ sampleCodeBlock(m_codeBlock);
+}
+
+/* ------------------------------ END: !ENABLE / ENABLE(JIT_OPTIMIZE_CALL) ------------------------------ */
+
+#endif // !ENABLE(JIT_OPTIMIZE_CALL)
+
+} // namespace JSC
+
+#endif // USE(JSVALUE64)
+#endif // ENABLE(JIT)
diff --git a/Source/JavaScriptCore/jit/JITCall32_64.cpp b/Source/JavaScriptCore/jit/JITCall32_64.cpp
new file mode 100644
index 0000000..daf5d2d
--- /dev/null
+++ b/Source/JavaScriptCore/jit/JITCall32_64.cpp
@@ -0,0 +1,356 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if ENABLE(JIT)
+#if USE(JSVALUE32_64)
+#include "JIT.h"
+
+#include "CodeBlock.h"
+#include "Interpreter.h"
+#include "JITInlineMethods.h"
+#include "JITStubCall.h"
+#include "JSArray.h"
+#include "JSFunction.h"
+#include "ResultType.h"
+#include "SamplingTool.h"
+
+#ifndef NDEBUG
+#include <stdio.h>
+#endif
+
+using namespace std;
+
+namespace JSC {
+
+void JIT::compileOpCallInitializeCallFrame()
+{
+ // regT0 holds callee, regT1 holds argCount
+ store32(regT1, Address(callFrameRegister, RegisterFile::ArgumentCount * static_cast<int>(sizeof(Register))));
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_scopeChain) + OBJECT_OFFSETOF(ScopeChain, m_node)), regT3); // scopeChain
+ storePtr(regT0, Address(callFrameRegister, RegisterFile::Callee * static_cast<int>(sizeof(Register)))); // callee
+ storePtr(regT3, Address(callFrameRegister, RegisterFile::ScopeChain * static_cast<int>(sizeof(Register)))); // scopeChain
+}
+
+void JIT::emit_op_call_put_result(Instruction* instruction)
+{
+ int dst = instruction[1].u.operand;
+ emitStore(dst, regT1, regT0);
+}
+
+void JIT::compileOpCallVarargs(Instruction* instruction)
+{
+ int callee = instruction[1].u.operand;
+ int argCountRegister = instruction[2].u.operand;
+ int registerOffset = instruction[3].u.operand;
+
+ emitLoad(callee, regT1, regT0);
+ emitLoadPayload(argCountRegister, regT2); // argCount
+ addPtr(Imm32(registerOffset), regT2, regT3); // registerOffset
+
+ emitJumpSlowCaseIfNotJSCell(callee, regT1);
+ addSlowCase(branchPtr(NotEqual, Address(regT0), ImmPtr(m_globalData->jsFunctionVPtr)));
+
+ // Speculatively roll the callframe, assuming argCount will match the arity.
+ mul32(Imm32(sizeof(Register)), regT3, regT3);
+ addPtr(callFrameRegister, regT3);
+ storePtr(callFrameRegister, Address(regT3, RegisterFile::CallerFrame * static_cast<int>(sizeof(Register))));
+ move(regT3, callFrameRegister);
+
+ move(regT2, regT1); // argCount
+
+ emitNakedCall(m_globalData->jitStubs->ctiVirtualCall());
+
+ sampleCodeBlock(m_codeBlock);
+}
+
+void JIT::compileOpCallVarargsSlowCase(Instruction* instruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ int callee = instruction[1].u.operand;
+
+ linkSlowCaseIfNotJSCell(iter, callee);
+ linkSlowCase(iter);
+
+ JITStubCall stubCall(this, cti_op_call_NotJSFunction);
+ stubCall.addArgument(regT1, regT0);
+ stubCall.addArgument(regT3);
+ stubCall.addArgument(regT2);
+ stubCall.call();
+
+ sampleCodeBlock(m_codeBlock);
+}
+
+void JIT::emit_op_ret(Instruction* currentInstruction)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+
+ // We could JIT generate the deref, only calling out to C when the refcount hits zero.
+ if (m_codeBlock->needsFullScopeChain()) {
+ Jump activationNotCreated = branch32(Equal, tagFor(m_codeBlock->activationRegister()), Imm32(JSValue::EmptyValueTag));
+ JITStubCall(this, cti_op_ret_scopeChain).call();
+ activationNotCreated.link(this);
+ }
+ emitLoad(dst, regT1, regT0);
+ emitGetFromCallFrameHeaderPtr(RegisterFile::ReturnPC, regT2);
+ emitGetFromCallFrameHeaderPtr(RegisterFile::CallerFrame, callFrameRegister);
+
+ restoreReturnAddressBeforeReturn(regT2);
+ ret();
+}
+
+void JIT::emit_op_ret_object_or_this(Instruction* currentInstruction)
+{
+ unsigned result = currentInstruction[1].u.operand;
+ unsigned thisReg = currentInstruction[2].u.operand;
+
+ // We could JIT generate the deref, only calling out to C when the refcount hits zero.
+ if (m_codeBlock->needsFullScopeChain()) {
+ Jump activationNotCreated = branch32(Equal, tagFor(m_codeBlock->activationRegister()), Imm32(JSValue::EmptyValueTag));
+ JITStubCall(this, cti_op_ret_scopeChain).call();
+ activationNotCreated.link(this);
+ }
+
+ emitLoad(result, regT1, regT0);
+ Jump notJSCell = branch32(NotEqual, regT1, Imm32(JSValue::CellTag));
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), regT2);
+ Jump notObject = branch8(NotEqual, Address(regT2, OBJECT_OFFSETOF(Structure, m_typeInfo) + OBJECT_OFFSETOF(TypeInfo, m_type)), Imm32(ObjectType));
+
+ emitGetFromCallFrameHeaderPtr(RegisterFile::ReturnPC, regT2);
+ emitGetFromCallFrameHeaderPtr(RegisterFile::CallerFrame, callFrameRegister);
+
+ restoreReturnAddressBeforeReturn(regT2);
+ ret();
+
+ notJSCell.link(this);
+ notObject.link(this);
+ emitLoad(thisReg, regT1, regT0);
+
+ emitGetFromCallFrameHeaderPtr(RegisterFile::ReturnPC, regT2);
+ emitGetFromCallFrameHeaderPtr(RegisterFile::CallerFrame, callFrameRegister);
+
+ restoreReturnAddressBeforeReturn(regT2);
+ ret();
+}
+
+void JIT::emitSlow_op_call(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ compileOpCallSlowCase(currentInstruction, iter, m_callLinkInfoIndex++, op_call);
+}
+
+void JIT::emitSlow_op_call_eval(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ compileOpCallSlowCase(currentInstruction, iter, m_callLinkInfoIndex++, op_call_eval);
+}
+
+void JIT::emitSlow_op_call_varargs(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ compileOpCallVarargsSlowCase(currentInstruction, iter);
+}
+
+void JIT::emitSlow_op_construct(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ compileOpCallSlowCase(currentInstruction, iter, m_callLinkInfoIndex++, op_construct);
+}
+
+void JIT::emit_op_call(Instruction* currentInstruction)
+{
+ compileOpCall(op_call, currentInstruction, m_callLinkInfoIndex++);
+}
+
+void JIT::emit_op_call_eval(Instruction* currentInstruction)
+{
+ compileOpCall(op_call_eval, currentInstruction, m_callLinkInfoIndex++);
+}
+
+void JIT::emit_op_call_varargs(Instruction* currentInstruction)
+{
+ compileOpCallVarargs(currentInstruction);
+}
+
+void JIT::emit_op_construct(Instruction* currentInstruction)
+{
+ compileOpCall(op_construct, currentInstruction, m_callLinkInfoIndex++);
+}
+
+#if !ENABLE(JIT_OPTIMIZE_CALL)
+
+/* ------------------------------ BEGIN: !ENABLE(JIT_OPTIMIZE_CALL) ------------------------------ */
+
+void JIT::compileOpCall(OpcodeID opcodeID, Instruction* instruction, unsigned)
+{
+ int callee = instruction[1].u.operand;
+ int argCount = instruction[2].u.operand;
+ int registerOffset = instruction[3].u.operand;
+
+ Jump wasEval;
+ if (opcodeID == op_call_eval) {
+ JITStubCall stubCall(this, cti_op_call_eval);
+ stubCall.addArgument(callee);
+ stubCall.addArgument(JIT::Imm32(registerOffset));
+ stubCall.addArgument(JIT::Imm32(argCount));
+ stubCall.call();
+ wasEval = branch32(NotEqual, regT1, Imm32(JSValue::EmptyValueTag));
+ }
+
+ emitLoad(callee, regT1, regT0);
+
+ emitJumpSlowCaseIfNotJSCell(callee, regT1);
+ addSlowCase(branchPtr(NotEqual, Address(regT0), ImmPtr(m_globalData->jsFunctionVPtr)));
+
+ // Speculatively roll the callframe, assuming argCount will match the arity.
+ storePtr(callFrameRegister, Address(callFrameRegister, (RegisterFile::CallerFrame + registerOffset) * static_cast<int>(sizeof(Register))));
+ addPtr(Imm32(registerOffset * static_cast<int>(sizeof(Register))), callFrameRegister);
+ move(Imm32(argCount), regT1);
+
+ emitNakedCall(opcodeID == op_construct ? m_globalData->jitStubs->ctiVirtualConstruct() : m_globalData->jitStubs->ctiVirtualCall());
+
+ if (opcodeID == op_call_eval)
+ wasEval.link(this);
+
+ sampleCodeBlock(m_codeBlock);
+}
+
+void JIT::compileOpCallSlowCase(Instruction* instruction, Vector<SlowCaseEntry>::iterator& iter, unsigned, OpcodeID opcodeID)
+{
+ int callee = instruction[1].u.operand;
+ int argCount = instruction[2].u.operand;
+ int registerOffset = instruction[3].u.operand;
+
+ linkSlowCaseIfNotJSCell(iter, callee);
+ linkSlowCase(iter);
+
+ JITStubCall stubCall(this, opcodeID == op_construct ? cti_op_construct_NotJSConstruct : cti_op_call_NotJSFunction);
+ stubCall.addArgument(callee);
+ stubCall.addArgument(JIT::Imm32(registerOffset));
+ stubCall.addArgument(JIT::Imm32(argCount));
+ stubCall.call();
+
+ sampleCodeBlock(m_codeBlock);
+}
+
+#else // !ENABLE(JIT_OPTIMIZE_CALL)
+
+/* ------------------------------ BEGIN: ENABLE(JIT_OPTIMIZE_CALL) ------------------------------ */
+
+void JIT::compileOpCall(OpcodeID opcodeID, Instruction* instruction, unsigned callLinkInfoIndex)
+{
+ int callee = instruction[1].u.operand;
+ int argCount = instruction[2].u.operand;
+ int registerOffset = instruction[3].u.operand;
+
+ Jump wasEval;
+ if (opcodeID == op_call_eval) {
+ JITStubCall stubCall(this, cti_op_call_eval);
+ stubCall.addArgument(callee);
+ stubCall.addArgument(JIT::Imm32(registerOffset));
+ stubCall.addArgument(JIT::Imm32(argCount));
+ stubCall.call();
+ wasEval = branch32(NotEqual, regT1, Imm32(JSValue::EmptyValueTag));
+ }
+
+ emitLoad(callee, regT1, regT0);
+
+ DataLabelPtr addressOfLinkedFunctionCheck;
+
+ BEGIN_UNINTERRUPTED_SEQUENCE(sequenceOpCall);
+
+ Jump jumpToSlow = branchPtrWithPatch(NotEqual, regT0, addressOfLinkedFunctionCheck, ImmPtr(0));
+
+ END_UNINTERRUPTED_SEQUENCE(sequenceOpCall);
+
+ addSlowCase(jumpToSlow);
+ ASSERT(differenceBetween(addressOfLinkedFunctionCheck, jumpToSlow) == patchOffsetOpCallCompareToJump);
+ m_callStructureStubCompilationInfo[callLinkInfoIndex].hotPathBegin = addressOfLinkedFunctionCheck;
+
+ addSlowCase(branch32(NotEqual, regT1, Imm32(JSValue::CellTag)));
+
+ // The following is the fast case, only used whan a callee can be linked.
+
+ // Fast version of stack frame initialization, directly relative to edi.
+ // Note that this omits to set up RegisterFile::CodeBlock, which is set in the callee
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_scopeChain) + OBJECT_OFFSETOF(ScopeChain, m_node)), regT2);
+
+ store32(Imm32(argCount), Address(callFrameRegister, (registerOffset + RegisterFile::ArgumentCount) * static_cast<int>(sizeof(Register))));
+ storePtr(callFrameRegister, Address(callFrameRegister, (registerOffset + RegisterFile::CallerFrame) * static_cast<int>(sizeof(Register))));
+ emitStore(registerOffset + RegisterFile::Callee, regT1, regT0);
+ storePtr(regT2, Address(callFrameRegister, (registerOffset + RegisterFile::ScopeChain) * static_cast<int>(sizeof(Register))));
+ addPtr(Imm32(registerOffset * sizeof(Register)), callFrameRegister);
+
+ // Call to the callee
+ m_callStructureStubCompilationInfo[callLinkInfoIndex].hotPathOther = emitNakedCall();
+
+ if (opcodeID == op_call_eval)
+ wasEval.link(this);
+
+ sampleCodeBlock(m_codeBlock);
+}
+
+void JIT::compileOpCallSlowCase(Instruction* instruction, Vector<SlowCaseEntry>::iterator& iter, unsigned callLinkInfoIndex, OpcodeID opcodeID)
+{
+ int callee = instruction[1].u.operand;
+ int argCount = instruction[2].u.operand;
+ int registerOffset = instruction[3].u.operand;
+
+ linkSlowCase(iter);
+ linkSlowCase(iter);
+
+ // Fast check for JS function.
+ Jump callLinkFailNotObject = branch32(NotEqual, regT1, Imm32(JSValue::CellTag));
+ Jump callLinkFailNotJSFunction = branchPtr(NotEqual, Address(regT0), ImmPtr(m_globalData->jsFunctionVPtr));
+
+ // Speculatively roll the callframe, assuming argCount will match the arity.
+ storePtr(callFrameRegister, Address(callFrameRegister, (RegisterFile::CallerFrame + registerOffset) * static_cast<int>(sizeof(Register))));
+ addPtr(Imm32(registerOffset * static_cast<int>(sizeof(Register))), callFrameRegister);
+ move(Imm32(argCount), regT1);
+
+ m_callStructureStubCompilationInfo[callLinkInfoIndex].callReturnLocation = emitNakedCall(opcodeID == op_construct ? m_globalData->jitStubs->ctiVirtualConstructLink() : m_globalData->jitStubs->ctiVirtualCallLink());
+
+ // Done! - return back to the hot path.
+ ASSERT(OPCODE_LENGTH(op_call) == OPCODE_LENGTH(op_call_eval));
+ ASSERT(OPCODE_LENGTH(op_call) == OPCODE_LENGTH(op_construct));
+ emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_call));
+
+ // This handles host functions
+ callLinkFailNotObject.link(this);
+ callLinkFailNotJSFunction.link(this);
+
+ JITStubCall stubCall(this, opcodeID == op_construct ? cti_op_construct_NotJSConstruct : cti_op_call_NotJSFunction);
+ stubCall.addArgument(callee);
+ stubCall.addArgument(JIT::Imm32(registerOffset));
+ stubCall.addArgument(JIT::Imm32(argCount));
+ stubCall.call();
+
+ sampleCodeBlock(m_codeBlock);
+}
+
+/* ------------------------------ END: !ENABLE / ENABLE(JIT_OPTIMIZE_CALL) ------------------------------ */
+
+#endif // !ENABLE(JIT_OPTIMIZE_CALL)
+
+} // namespace JSC
+
+#endif // USE(JSVALUE32_64)
+#endif // ENABLE(JIT)
diff --git a/Source/JavaScriptCore/jit/JITCode.h b/Source/JavaScriptCore/jit/JITCode.h
new file mode 100644
index 0000000..7346fd5
--- /dev/null
+++ b/Source/JavaScriptCore/jit/JITCode.h
@@ -0,0 +1,117 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef JITCode_h
+#define JITCode_h
+
+#if ENABLE(JIT)
+
+#include "CallFrame.h"
+#include "JSValue.h"
+#include "MacroAssemblerCodeRef.h"
+#include "Profiler.h"
+
+namespace JSC {
+
+ class JSGlobalData;
+ class RegisterFile;
+
+ class JITCode {
+ typedef MacroAssemblerCodeRef CodeRef;
+ typedef MacroAssemblerCodePtr CodePtr;
+ public:
+ JITCode()
+ {
+ }
+
+ JITCode(const CodeRef ref)
+ : m_ref(ref)
+ {
+ }
+
+ bool operator !() const
+ {
+ return !m_ref.m_code.executableAddress();
+ }
+
+ CodePtr addressForCall()
+ {
+ return m_ref.m_code;
+ }
+
+ // This function returns the offset in bytes of 'pointerIntoCode' into
+ // this block of code. The pointer provided must be a pointer into this
+ // block of code. It is ASSERTed that no codeblock >4gb in size.
+ unsigned offsetOf(void* pointerIntoCode)
+ {
+ intptr_t result = reinterpret_cast<intptr_t>(pointerIntoCode) - reinterpret_cast<intptr_t>(m_ref.m_code.executableAddress());
+ ASSERT(static_cast<intptr_t>(static_cast<unsigned>(result)) == result);
+ return static_cast<unsigned>(result);
+ }
+
+ // Execute the code!
+ inline JSValue execute(RegisterFile* registerFile, CallFrame* callFrame, JSGlobalData* globalData)
+ {
+ JSValue result = JSValue::decode(ctiTrampoline(m_ref.m_code.executableAddress(), registerFile, callFrame, 0, Profiler::enabledProfilerReference(), globalData));
+ return globalData->exception ? jsNull() : result;
+ }
+
+ void* start()
+ {
+ return m_ref.m_code.dataLocation();
+ }
+
+ size_t size()
+ {
+ ASSERT(m_ref.m_code.executableAddress());
+ return m_ref.m_size;
+ }
+
+ ExecutablePool* getExecutablePool()
+ {
+ return m_ref.m_executablePool.get();
+ }
+
+ // Host functions are a bit special; they have a m_code pointer but they
+ // do not individully ref the executable pool containing the trampoline.
+ static JITCode HostFunction(CodePtr code)
+ {
+ return JITCode(code.dataLocation(), 0, 0);
+ }
+
+ private:
+ JITCode(void* code, PassRefPtr<ExecutablePool> executablePool, size_t size)
+ : m_ref(code, executablePool, size)
+ {
+ }
+
+ CodeRef m_ref;
+ };
+
+};
+
+#endif
+
+#endif
diff --git a/Source/JavaScriptCore/jit/JITInlineMethods.h b/Source/JavaScriptCore/jit/JITInlineMethods.h
new file mode 100644
index 0000000..39ca4a5
--- /dev/null
+++ b/Source/JavaScriptCore/jit/JITInlineMethods.h
@@ -0,0 +1,809 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef JITInlineMethods_h
+#define JITInlineMethods_h
+
+
+#if ENABLE(JIT)
+
+namespace JSC {
+
+/* Deprecated: Please use JITStubCall instead. */
+
+ALWAYS_INLINE void JIT::emitGetJITStubArg(unsigned argumentNumber, RegisterID dst)
+{
+ unsigned argumentStackOffset = (argumentNumber * (sizeof(JSValue) / sizeof(void*))) + JITSTACKFRAME_ARGS_INDEX;
+ peek(dst, argumentStackOffset);
+}
+
+ALWAYS_INLINE bool JIT::isOperandConstantImmediateDouble(unsigned src)
+{
+ return m_codeBlock->isConstantRegisterIndex(src) && getConstantOperand(src).isDouble();
+}
+
+ALWAYS_INLINE JSValue JIT::getConstantOperand(unsigned src)
+{
+ ASSERT(m_codeBlock->isConstantRegisterIndex(src));
+ return m_codeBlock->getConstant(src);
+}
+
+ALWAYS_INLINE void JIT::emitPutToCallFrameHeader(RegisterID from, RegisterFile::CallFrameHeaderEntry entry)
+{
+ storePtr(from, Address(callFrameRegister, entry * sizeof(Register)));
+}
+
+ALWAYS_INLINE void JIT::emitPutImmediateToCallFrameHeader(void* value, RegisterFile::CallFrameHeaderEntry entry)
+{
+ storePtr(ImmPtr(value), Address(callFrameRegister, entry * sizeof(Register)));
+}
+
+ALWAYS_INLINE void JIT::emitGetFromCallFrameHeaderPtr(RegisterFile::CallFrameHeaderEntry entry, RegisterID to, RegisterID from)
+{
+ loadPtr(Address(from, entry * sizeof(Register)), to);
+#if USE(JSVALUE64)
+ killLastResultRegister();
+#endif
+}
+
+ALWAYS_INLINE void JIT::emitLoadCharacterString(RegisterID src, RegisterID dst, JumpList& failures)
+{
+ failures.append(branchPtr(NotEqual, Address(src), ImmPtr(m_globalData->jsStringVPtr)));
+ failures.append(branchTest32(NonZero, Address(src, OBJECT_OFFSETOF(JSString, m_fiberCount))));
+ failures.append(branch32(NotEqual, MacroAssembler::Address(src, ThunkHelpers::jsStringLengthOffset()), Imm32(1)));
+ loadPtr(MacroAssembler::Address(src, ThunkHelpers::jsStringValueOffset()), dst);
+ loadPtr(MacroAssembler::Address(dst, ThunkHelpers::stringImplDataOffset()), dst);
+ load16(MacroAssembler::Address(dst, 0), dst);
+}
+
+ALWAYS_INLINE void JIT::emitGetFromCallFrameHeader32(RegisterFile::CallFrameHeaderEntry entry, RegisterID to, RegisterID from)
+{
+ load32(Address(from, entry * sizeof(Register)), to);
+#if USE(JSVALUE64)
+ killLastResultRegister();
+#endif
+}
+
+ALWAYS_INLINE JIT::Call JIT::emitNakedCall(CodePtr function)
+{
+ ASSERT(m_bytecodeOffset != (unsigned)-1); // This method should only be called during hot/cold path generation, so that m_bytecodeOffset is set.
+
+ Call nakedCall = nearCall();
+ m_calls.append(CallRecord(nakedCall, m_bytecodeOffset, function.executableAddress()));
+ return nakedCall;
+}
+
+#if defined(ASSEMBLER_HAS_CONSTANT_POOL) && ASSEMBLER_HAS_CONSTANT_POOL
+
+ALWAYS_INLINE void JIT::beginUninterruptedSequence(int insnSpace, int constSpace)
+{
+ JSInterfaceJIT::beginUninterruptedSequence();
+#if CPU(ARM_TRADITIONAL)
+#ifndef NDEBUG
+ // Ensure the label after the sequence can also fit
+ insnSpace += sizeof(ARMWord);
+ constSpace += sizeof(uint64_t);
+#endif
+
+ ensureSpace(insnSpace, constSpace);
+
+#endif
+
+#if defined(ASSEMBLER_HAS_CONSTANT_POOL) && ASSEMBLER_HAS_CONSTANT_POOL
+#ifndef NDEBUG
+ m_uninterruptedInstructionSequenceBegin = label();
+ m_uninterruptedConstantSequenceBegin = sizeOfConstantPool();
+#endif
+#endif
+}
+
+ALWAYS_INLINE void JIT::endUninterruptedSequence(int insnSpace, int constSpace)
+{
+#if defined(ASSEMBLER_HAS_CONSTANT_POOL) && ASSEMBLER_HAS_CONSTANT_POOL
+ /* There are several cases when the uninterrupted sequence is larger than
+ * maximum required offset for pathing the same sequence. Eg.: if in a
+ * uninterrupted sequence the last macroassembler's instruction is a stub
+ * call, it emits store instruction(s) which should not be included in the
+ * calculation of length of uninterrupted sequence. So, the insnSpace and
+ * constSpace should be upper limit instead of hard limit.
+ */
+ ASSERT(differenceBetween(m_uninterruptedInstructionSequenceBegin, label()) <= insnSpace);
+ ASSERT(sizeOfConstantPool() - m_uninterruptedConstantSequenceBegin <= constSpace);
+#endif
+ JSInterfaceJIT::endUninterruptedSequence();
+}
+
+#endif
+
+#if CPU(ARM)
+
+ALWAYS_INLINE void JIT::preserveReturnAddressAfterCall(RegisterID reg)
+{
+ move(linkRegister, reg);
+}
+
+ALWAYS_INLINE void JIT::restoreReturnAddressBeforeReturn(RegisterID reg)
+{
+ move(reg, linkRegister);
+}
+
+ALWAYS_INLINE void JIT::restoreReturnAddressBeforeReturn(Address address)
+{
+ loadPtr(address, linkRegister);
+}
+
+#elif CPU(MIPS)
+
+ALWAYS_INLINE void JIT::preserveReturnAddressAfterCall(RegisterID reg)
+{
+ move(returnAddressRegister, reg);
+}
+
+ALWAYS_INLINE void JIT::restoreReturnAddressBeforeReturn(RegisterID reg)
+{
+ move(reg, returnAddressRegister);
+}
+
+ALWAYS_INLINE void JIT::restoreReturnAddressBeforeReturn(Address address)
+{
+ loadPtr(address, returnAddressRegister);
+}
+
+#else // CPU(X86) || CPU(X86_64)
+
+ALWAYS_INLINE void JIT::preserveReturnAddressAfterCall(RegisterID reg)
+{
+ pop(reg);
+}
+
+ALWAYS_INLINE void JIT::restoreReturnAddressBeforeReturn(RegisterID reg)
+{
+ push(reg);
+}
+
+ALWAYS_INLINE void JIT::restoreReturnAddressBeforeReturn(Address address)
+{
+ push(address);
+}
+
+#endif
+
+ALWAYS_INLINE void JIT::restoreArgumentReference()
+{
+ move(stackPointerRegister, firstArgumentRegister);
+ poke(callFrameRegister, OBJECT_OFFSETOF(struct JITStackFrame, callFrame) / sizeof(void*));
+}
+
+ALWAYS_INLINE void JIT::restoreArgumentReferenceForTrampoline()
+{
+#if CPU(X86)
+ // Within a trampoline the return address will be on the stack at this point.
+ addPtr(Imm32(sizeof(void*)), stackPointerRegister, firstArgumentRegister);
+#elif CPU(ARM)
+ move(stackPointerRegister, firstArgumentRegister);
+#endif
+ // In the trampoline on x86-64, the first argument register is not overwritten.
+}
+
+ALWAYS_INLINE JIT::Jump JIT::checkStructure(RegisterID reg, Structure* structure)
+{
+ return branchPtr(NotEqual, Address(reg, OBJECT_OFFSETOF(JSCell, m_structure)), ImmPtr(structure));
+}
+
+ALWAYS_INLINE void JIT::linkSlowCaseIfNotJSCell(Vector<SlowCaseEntry>::iterator& iter, int vReg)
+{
+ if (!m_codeBlock->isKnownNotImmediate(vReg))
+ linkSlowCase(iter);
+}
+
+ALWAYS_INLINE void JIT::addSlowCase(Jump jump)
+{
+ ASSERT(m_bytecodeOffset != (unsigned)-1); // This method should only be called during hot/cold path generation, so that m_bytecodeOffset is set.
+
+ m_slowCases.append(SlowCaseEntry(jump, m_bytecodeOffset));
+}
+
+ALWAYS_INLINE void JIT::addSlowCase(JumpList jumpList)
+{
+ ASSERT(m_bytecodeOffset != (unsigned)-1); // This method should only be called during hot/cold path generation, so that m_bytecodeOffset is set.
+
+ const JumpList::JumpVector& jumpVector = jumpList.jumps();
+ size_t size = jumpVector.size();
+ for (size_t i = 0; i < size; ++i)
+ m_slowCases.append(SlowCaseEntry(jumpVector[i], m_bytecodeOffset));
+}
+
+ALWAYS_INLINE void JIT::addJump(Jump jump, int relativeOffset)
+{
+ ASSERT(m_bytecodeOffset != (unsigned)-1); // This method should only be called during hot/cold path generation, so that m_bytecodeOffset is set.
+
+ m_jmpTable.append(JumpTable(jump, m_bytecodeOffset + relativeOffset));
+}
+
+ALWAYS_INLINE void JIT::emitJumpSlowToHot(Jump jump, int relativeOffset)
+{
+ ASSERT(m_bytecodeOffset != (unsigned)-1); // This method should only be called during hot/cold path generation, so that m_bytecodeOffset is set.
+
+ jump.linkTo(m_labels[m_bytecodeOffset + relativeOffset], this);
+}
+
+#if ENABLE(SAMPLING_FLAGS)
+ALWAYS_INLINE void JIT::setSamplingFlag(int32_t flag)
+{
+ ASSERT(flag >= 1);
+ ASSERT(flag <= 32);
+ or32(Imm32(1u << (flag - 1)), AbsoluteAddress(&SamplingFlags::s_flags));
+}
+
+ALWAYS_INLINE void JIT::clearSamplingFlag(int32_t flag)
+{
+ ASSERT(flag >= 1);
+ ASSERT(flag <= 32);
+ and32(Imm32(~(1u << (flag - 1))), AbsoluteAddress(&SamplingFlags::s_flags));
+}
+#endif
+
+#if ENABLE(SAMPLING_COUNTERS)
+ALWAYS_INLINE void JIT::emitCount(AbstractSamplingCounter& counter, uint32_t count)
+{
+#if CPU(X86_64) // Or any other 64-bit plattform.
+ addPtr(Imm32(count), AbsoluteAddress(&counter.m_counter));
+#elif CPU(X86) // Or any other little-endian 32-bit plattform.
+ intptr_t hiWord = reinterpret_cast<intptr_t>(&counter.m_counter) + sizeof(int32_t);
+ add32(Imm32(count), AbsoluteAddress(&counter.m_counter));
+ addWithCarry32(Imm32(0), AbsoluteAddress(reinterpret_cast<void*>(hiWord)));
+#else
+#error "SAMPLING_FLAGS not implemented on this platform."
+#endif
+}
+#endif
+
+#if ENABLE(OPCODE_SAMPLING)
+#if CPU(X86_64)
+ALWAYS_INLINE void JIT::sampleInstruction(Instruction* instruction, bool inHostFunction)
+{
+ move(ImmPtr(m_interpreter->sampler()->sampleSlot()), X86Registers::ecx);
+ storePtr(ImmPtr(m_interpreter->sampler()->encodeSample(instruction, inHostFunction)), X86Registers::ecx);
+}
+#else
+ALWAYS_INLINE void JIT::sampleInstruction(Instruction* instruction, bool inHostFunction)
+{
+ storePtr(ImmPtr(m_interpreter->sampler()->encodeSample(instruction, inHostFunction)), m_interpreter->sampler()->sampleSlot());
+}
+#endif
+#endif
+
+#if ENABLE(CODEBLOCK_SAMPLING)
+#if CPU(X86_64)
+ALWAYS_INLINE void JIT::sampleCodeBlock(CodeBlock* codeBlock)
+{
+ move(ImmPtr(m_interpreter->sampler()->codeBlockSlot()), X86Registers::ecx);
+ storePtr(ImmPtr(codeBlock), X86Registers::ecx);
+}
+#else
+ALWAYS_INLINE void JIT::sampleCodeBlock(CodeBlock* codeBlock)
+{
+ storePtr(ImmPtr(codeBlock), m_interpreter->sampler()->codeBlockSlot());
+}
+#endif
+#endif
+
+ALWAYS_INLINE bool JIT::isOperandConstantImmediateChar(unsigned src)
+{
+ return m_codeBlock->isConstantRegisterIndex(src) && getConstantOperand(src).isString() && asString(getConstantOperand(src).asCell())->length() == 1;
+}
+
+#if USE(JSVALUE32_64)
+
+inline void JIT::emitLoadTag(unsigned index, RegisterID tag)
+{
+ RegisterID mappedTag;
+ if (getMappedTag(index, mappedTag)) {
+ move(mappedTag, tag);
+ unmap(tag);
+ return;
+ }
+
+ if (m_codeBlock->isConstantRegisterIndex(index)) {
+ move(Imm32(getConstantOperand(index).tag()), tag);
+ unmap(tag);
+ return;
+ }
+
+ load32(tagFor(index), tag);
+ unmap(tag);
+}
+
+inline void JIT::emitLoadPayload(unsigned index, RegisterID payload)
+{
+ RegisterID mappedPayload;
+ if (getMappedPayload(index, mappedPayload)) {
+ move(mappedPayload, payload);
+ unmap(payload);
+ return;
+ }
+
+ if (m_codeBlock->isConstantRegisterIndex(index)) {
+ move(Imm32(getConstantOperand(index).payload()), payload);
+ unmap(payload);
+ return;
+ }
+
+ load32(payloadFor(index), payload);
+ unmap(payload);
+}
+
+inline void JIT::emitLoad(const JSValue& v, RegisterID tag, RegisterID payload)
+{
+ move(Imm32(v.payload()), payload);
+ move(Imm32(v.tag()), tag);
+}
+
+inline void JIT::emitLoad(unsigned index, RegisterID tag, RegisterID payload, RegisterID base)
+{
+ ASSERT(tag != payload);
+
+ if (base == callFrameRegister) {
+ ASSERT(payload != base);
+ emitLoadPayload(index, payload);
+ emitLoadTag(index, tag);
+ return;
+ }
+
+ if (payload == base) { // avoid stomping base
+ load32(tagFor(index, base), tag);
+ load32(payloadFor(index, base), payload);
+ return;
+ }
+
+ load32(payloadFor(index, base), payload);
+ load32(tagFor(index, base), tag);
+}
+
+inline void JIT::emitLoad2(unsigned index1, RegisterID tag1, RegisterID payload1, unsigned index2, RegisterID tag2, RegisterID payload2)
+{
+ if (isMapped(index1)) {
+ emitLoad(index1, tag1, payload1);
+ emitLoad(index2, tag2, payload2);
+ return;
+ }
+ emitLoad(index2, tag2, payload2);
+ emitLoad(index1, tag1, payload1);
+}
+
+inline void JIT::emitLoadDouble(unsigned index, FPRegisterID value)
+{
+ if (m_codeBlock->isConstantRegisterIndex(index)) {
+ Register& inConstantPool = m_codeBlock->constantRegister(index);
+ loadDouble(&inConstantPool, value);
+ } else
+ loadDouble(addressFor(index), value);
+}
+
+inline void JIT::emitLoadInt32ToDouble(unsigned index, FPRegisterID value)
+{
+ if (m_codeBlock->isConstantRegisterIndex(index)) {
+ Register& inConstantPool = m_codeBlock->constantRegister(index);
+ char* bytePointer = reinterpret_cast<char*>(&inConstantPool);
+ convertInt32ToDouble(AbsoluteAddress(bytePointer + OBJECT_OFFSETOF(JSValue, u.asBits.payload)), value);
+ } else
+ convertInt32ToDouble(payloadFor(index), value);
+}
+
+inline void JIT::emitStore(unsigned index, RegisterID tag, RegisterID payload, RegisterID base)
+{
+ store32(payload, payloadFor(index, base));
+ store32(tag, tagFor(index, base));
+}
+
+inline void JIT::emitStoreInt32(unsigned index, RegisterID payload, bool indexIsInt32)
+{
+ store32(payload, payloadFor(index, callFrameRegister));
+ if (!indexIsInt32)
+ store32(Imm32(JSValue::Int32Tag), tagFor(index, callFrameRegister));
+}
+
+inline void JIT::emitStoreInt32(unsigned index, Imm32 payload, bool indexIsInt32)
+{
+ store32(payload, payloadFor(index, callFrameRegister));
+ if (!indexIsInt32)
+ store32(Imm32(JSValue::Int32Tag), tagFor(index, callFrameRegister));
+}
+
+inline void JIT::emitStoreCell(unsigned index, RegisterID payload, bool indexIsCell)
+{
+ store32(payload, payloadFor(index, callFrameRegister));
+ if (!indexIsCell)
+ store32(Imm32(JSValue::CellTag), tagFor(index, callFrameRegister));
+}
+
+inline void JIT::emitStoreBool(unsigned index, RegisterID tag, bool indexIsBool)
+{
+ if (!indexIsBool)
+ store32(Imm32(0), payloadFor(index, callFrameRegister));
+ store32(tag, tagFor(index, callFrameRegister));
+}
+
+inline void JIT::emitStoreDouble(unsigned index, FPRegisterID value)
+{
+ storeDouble(value, addressFor(index));
+}
+
+inline void JIT::emitStore(unsigned index, const JSValue constant, RegisterID base)
+{
+ store32(Imm32(constant.payload()), payloadFor(index, base));
+ store32(Imm32(constant.tag()), tagFor(index, base));
+}
+
+ALWAYS_INLINE void JIT::emitInitRegister(unsigned dst)
+{
+ emitStore(dst, jsUndefined());
+}
+
+inline bool JIT::isLabeled(unsigned bytecodeOffset)
+{
+ for (size_t numberOfJumpTargets = m_codeBlock->numberOfJumpTargets(); m_jumpTargetIndex != numberOfJumpTargets; ++m_jumpTargetIndex) {
+ unsigned jumpTarget = m_codeBlock->jumpTarget(m_jumpTargetIndex);
+ if (jumpTarget == bytecodeOffset)
+ return true;
+ if (jumpTarget > bytecodeOffset)
+ return false;
+ }
+ return false;
+}
+
+inline void JIT::map(unsigned bytecodeOffset, unsigned virtualRegisterIndex, RegisterID tag, RegisterID payload)
+{
+ if (isLabeled(bytecodeOffset))
+ return;
+
+ m_mappedBytecodeOffset = bytecodeOffset;
+ m_mappedVirtualRegisterIndex = virtualRegisterIndex;
+ m_mappedTag = tag;
+ m_mappedPayload = payload;
+}
+
+inline void JIT::unmap(RegisterID registerID)
+{
+ if (m_mappedTag == registerID)
+ m_mappedTag = (RegisterID)-1;
+ else if (m_mappedPayload == registerID)
+ m_mappedPayload = (RegisterID)-1;
+}
+
+inline void JIT::unmap()
+{
+ m_mappedBytecodeOffset = (unsigned)-1;
+ m_mappedVirtualRegisterIndex = (unsigned)-1;
+ m_mappedTag = (RegisterID)-1;
+ m_mappedPayload = (RegisterID)-1;
+}
+
+inline bool JIT::isMapped(unsigned virtualRegisterIndex)
+{
+ if (m_mappedBytecodeOffset != m_bytecodeOffset)
+ return false;
+ if (m_mappedVirtualRegisterIndex != virtualRegisterIndex)
+ return false;
+ return true;
+}
+
+inline bool JIT::getMappedPayload(unsigned virtualRegisterIndex, RegisterID& payload)
+{
+ if (m_mappedBytecodeOffset != m_bytecodeOffset)
+ return false;
+ if (m_mappedVirtualRegisterIndex != virtualRegisterIndex)
+ return false;
+ if (m_mappedPayload == (RegisterID)-1)
+ return false;
+ payload = m_mappedPayload;
+ return true;
+}
+
+inline bool JIT::getMappedTag(unsigned virtualRegisterIndex, RegisterID& tag)
+{
+ if (m_mappedBytecodeOffset != m_bytecodeOffset)
+ return false;
+ if (m_mappedVirtualRegisterIndex != virtualRegisterIndex)
+ return false;
+ if (m_mappedTag == (RegisterID)-1)
+ return false;
+ tag = m_mappedTag;
+ return true;
+}
+
+inline void JIT::emitJumpSlowCaseIfNotJSCell(unsigned virtualRegisterIndex)
+{
+ if (!m_codeBlock->isKnownNotImmediate(virtualRegisterIndex)) {
+ if (m_codeBlock->isConstantRegisterIndex(virtualRegisterIndex))
+ addSlowCase(jump());
+ else
+ addSlowCase(emitJumpIfNotJSCell(virtualRegisterIndex));
+ }
+}
+
+inline void JIT::emitJumpSlowCaseIfNotJSCell(unsigned virtualRegisterIndex, RegisterID tag)
+{
+ if (!m_codeBlock->isKnownNotImmediate(virtualRegisterIndex)) {
+ if (m_codeBlock->isConstantRegisterIndex(virtualRegisterIndex))
+ addSlowCase(jump());
+ else
+ addSlowCase(branch32(NotEqual, tag, Imm32(JSValue::CellTag)));
+ }
+}
+
+inline void JIT::linkSlowCaseIfNotJSCell(Vector<SlowCaseEntry>::iterator& iter, unsigned virtualRegisterIndex)
+{
+ if (!m_codeBlock->isKnownNotImmediate(virtualRegisterIndex))
+ linkSlowCase(iter);
+}
+
+ALWAYS_INLINE bool JIT::isOperandConstantImmediateInt(unsigned src)
+{
+ return m_codeBlock->isConstantRegisterIndex(src) && getConstantOperand(src).isInt32();
+}
+
+ALWAYS_INLINE bool JIT::getOperandConstantImmediateInt(unsigned op1, unsigned op2, unsigned& op, int32_t& constant)
+{
+ if (isOperandConstantImmediateInt(op1)) {
+ constant = getConstantOperand(op1).asInt32();
+ op = op2;
+ return true;
+ }
+
+ if (isOperandConstantImmediateInt(op2)) {
+ constant = getConstantOperand(op2).asInt32();
+ op = op1;
+ return true;
+ }
+
+ return false;
+}
+
+#else // USE(JSVALUE32_64)
+
+ALWAYS_INLINE void JIT::killLastResultRegister()
+{
+ m_lastResultBytecodeRegister = std::numeric_limits<int>::max();
+}
+
+// get arg puts an arg from the SF register array into a h/w register
+ALWAYS_INLINE void JIT::emitGetVirtualRegister(int src, RegisterID dst)
+{
+ ASSERT(m_bytecodeOffset != (unsigned)-1); // This method should only be called during hot/cold path generation, so that m_bytecodeOffset is set.
+
+ // TODO: we want to reuse values that are already in registers if we can - add a register allocator!
+ if (m_codeBlock->isConstantRegisterIndex(src)) {
+ JSValue value = m_codeBlock->getConstant(src);
+ move(ImmPtr(JSValue::encode(value)), dst);
+ killLastResultRegister();
+ return;
+ }
+
+ if (src == m_lastResultBytecodeRegister && m_codeBlock->isTemporaryRegisterIndex(src)) {
+ bool atJumpTarget = false;
+ while (m_jumpTargetsPosition < m_codeBlock->numberOfJumpTargets() && m_codeBlock->jumpTarget(m_jumpTargetsPosition) <= m_bytecodeOffset) {
+ if (m_codeBlock->jumpTarget(m_jumpTargetsPosition) == m_bytecodeOffset)
+ atJumpTarget = true;
+ ++m_jumpTargetsPosition;
+ }
+
+ if (!atJumpTarget) {
+ // The argument we want is already stored in eax
+ if (dst != cachedResultRegister)
+ move(cachedResultRegister, dst);
+ killLastResultRegister();
+ return;
+ }
+ }
+
+ loadPtr(Address(callFrameRegister, src * sizeof(Register)), dst);
+ killLastResultRegister();
+}
+
+ALWAYS_INLINE void JIT::emitGetVirtualRegisters(int src1, RegisterID dst1, int src2, RegisterID dst2)
+{
+ if (src2 == m_lastResultBytecodeRegister) {
+ emitGetVirtualRegister(src2, dst2);
+ emitGetVirtualRegister(src1, dst1);
+ } else {
+ emitGetVirtualRegister(src1, dst1);
+ emitGetVirtualRegister(src2, dst2);
+ }
+}
+
+ALWAYS_INLINE int32_t JIT::getConstantOperandImmediateInt(unsigned src)
+{
+ return getConstantOperand(src).asInt32();
+}
+
+ALWAYS_INLINE bool JIT::isOperandConstantImmediateInt(unsigned src)
+{
+ return m_codeBlock->isConstantRegisterIndex(src) && getConstantOperand(src).isInt32();
+}
+
+ALWAYS_INLINE void JIT::emitPutVirtualRegister(unsigned dst, RegisterID from)
+{
+ storePtr(from, Address(callFrameRegister, dst * sizeof(Register)));
+ m_lastResultBytecodeRegister = (from == cachedResultRegister) ? static_cast<int>(dst) : std::numeric_limits<int>::max();
+}
+
+ALWAYS_INLINE void JIT::emitInitRegister(unsigned dst)
+{
+ storePtr(ImmPtr(JSValue::encode(jsUndefined())), Address(callFrameRegister, dst * sizeof(Register)));
+}
+
+ALWAYS_INLINE JIT::Jump JIT::emitJumpIfJSCell(RegisterID reg)
+{
+#if USE(JSVALUE64)
+ return branchTestPtr(Zero, reg, tagMaskRegister);
+#else
+ return branchTest32(Zero, reg, Imm32(JSImmediate::TagMask));
+#endif
+}
+
+ALWAYS_INLINE JIT::Jump JIT::emitJumpIfBothJSCells(RegisterID reg1, RegisterID reg2, RegisterID scratch)
+{
+ move(reg1, scratch);
+ orPtr(reg2, scratch);
+ return emitJumpIfJSCell(scratch);
+}
+
+ALWAYS_INLINE void JIT::emitJumpSlowCaseIfJSCell(RegisterID reg)
+{
+ addSlowCase(emitJumpIfJSCell(reg));
+}
+
+ALWAYS_INLINE JIT::Jump JIT::emitJumpIfNotJSCell(RegisterID reg)
+{
+#if USE(JSVALUE64)
+ return branchTestPtr(NonZero, reg, tagMaskRegister);
+#else
+ return branchTest32(NonZero, reg, Imm32(JSImmediate::TagMask));
+#endif
+}
+
+ALWAYS_INLINE void JIT::emitJumpSlowCaseIfNotJSCell(RegisterID reg)
+{
+ addSlowCase(emitJumpIfNotJSCell(reg));
+}
+
+ALWAYS_INLINE void JIT::emitJumpSlowCaseIfNotJSCell(RegisterID reg, int vReg)
+{
+ if (!m_codeBlock->isKnownNotImmediate(vReg))
+ emitJumpSlowCaseIfNotJSCell(reg);
+}
+
+#if USE(JSVALUE64)
+
+inline void JIT::emitLoadDouble(unsigned index, FPRegisterID value)
+{
+ if (m_codeBlock->isConstantRegisterIndex(index)) {
+ Register& inConstantPool = m_codeBlock->constantRegister(index);
+ loadDouble(&inConstantPool, value);
+ } else
+ loadDouble(addressFor(index), value);
+}
+
+inline void JIT::emitLoadInt32ToDouble(unsigned index, FPRegisterID value)
+{
+ if (m_codeBlock->isConstantRegisterIndex(index)) {
+ Register& inConstantPool = m_codeBlock->constantRegister(index);
+ convertInt32ToDouble(AbsoluteAddress(&inConstantPool), value);
+ } else
+ convertInt32ToDouble(addressFor(index), value);
+}
+#endif
+
+ALWAYS_INLINE JIT::Jump JIT::emitJumpIfImmediateInteger(RegisterID reg)
+{
+#if USE(JSVALUE64)
+ return branchPtr(AboveOrEqual, reg, tagTypeNumberRegister);
+#else
+ return branchTest32(NonZero, reg, Imm32(JSImmediate::TagTypeNumber));
+#endif
+}
+
+ALWAYS_INLINE JIT::Jump JIT::emitJumpIfNotImmediateInteger(RegisterID reg)
+{
+#if USE(JSVALUE64)
+ return branchPtr(Below, reg, tagTypeNumberRegister);
+#else
+ return branchTest32(Zero, reg, Imm32(JSImmediate::TagTypeNumber));
+#endif
+}
+
+ALWAYS_INLINE JIT::Jump JIT::emitJumpIfNotImmediateIntegers(RegisterID reg1, RegisterID reg2, RegisterID scratch)
+{
+ move(reg1, scratch);
+ andPtr(reg2, scratch);
+ return emitJumpIfNotImmediateInteger(scratch);
+}
+
+ALWAYS_INLINE void JIT::emitJumpSlowCaseIfNotImmediateInteger(RegisterID reg)
+{
+ addSlowCase(emitJumpIfNotImmediateInteger(reg));
+}
+
+ALWAYS_INLINE void JIT::emitJumpSlowCaseIfNotImmediateIntegers(RegisterID reg1, RegisterID reg2, RegisterID scratch)
+{
+ addSlowCase(emitJumpIfNotImmediateIntegers(reg1, reg2, scratch));
+}
+
+ALWAYS_INLINE void JIT::emitJumpSlowCaseIfNotImmediateNumber(RegisterID reg)
+{
+ addSlowCase(emitJumpIfNotImmediateNumber(reg));
+}
+
+#if USE(JSVALUE32_64)
+ALWAYS_INLINE void JIT::emitFastArithDeTagImmediate(RegisterID reg)
+{
+ subPtr(Imm32(JSImmediate::TagTypeNumber), reg);
+}
+
+ALWAYS_INLINE JIT::Jump JIT::emitFastArithDeTagImmediateJumpIfZero(RegisterID reg)
+{
+ return branchSubPtr(Zero, Imm32(JSImmediate::TagTypeNumber), reg);
+}
+#endif
+
+ALWAYS_INLINE void JIT::emitFastArithReTagImmediate(RegisterID src, RegisterID dest)
+{
+#if USE(JSVALUE64)
+ emitFastArithIntToImmNoCheck(src, dest);
+#else
+ if (src != dest)
+ move(src, dest);
+ addPtr(Imm32(JSImmediate::TagTypeNumber), dest);
+#endif
+}
+
+// operand is int32_t, must have been zero-extended if register is 64-bit.
+ALWAYS_INLINE void JIT::emitFastArithIntToImmNoCheck(RegisterID src, RegisterID dest)
+{
+#if USE(JSVALUE64)
+ if (src != dest)
+ move(src, dest);
+ orPtr(tagTypeNumberRegister, dest);
+#else
+ signExtend32ToPtr(src, dest);
+ addPtr(dest, dest);
+ emitFastArithReTagImmediate(dest, dest);
+#endif
+}
+
+ALWAYS_INLINE void JIT::emitTagAsBoolImmediate(RegisterID reg)
+{
+ lshift32(Imm32(JSImmediate::ExtendedPayloadShift), reg);
+ or32(Imm32(static_cast<int32_t>(JSImmediate::FullTagTypeBool)), reg);
+}
+
+#endif // USE(JSVALUE32_64)
+
+} // namespace JSC
+
+#endif // ENABLE(JIT)
+
+#endif
diff --git a/Source/JavaScriptCore/jit/JITOpcodes.cpp b/Source/JavaScriptCore/jit/JITOpcodes.cpp
new file mode 100644
index 0000000..972b879
--- /dev/null
+++ b/Source/JavaScriptCore/jit/JITOpcodes.cpp
@@ -0,0 +1,1775 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2010 Patrick Gansterer <paroga@paroga.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#if ENABLE(JIT)
+#include "JIT.h"
+
+#include "Arguments.h"
+#include "JITInlineMethods.h"
+#include "JITStubCall.h"
+#include "JSArray.h"
+#include "JSCell.h"
+#include "JSFunction.h"
+#include "JSPropertyNameIterator.h"
+#include "LinkBuffer.h"
+
+namespace JSC {
+
+#if USE(JSVALUE64)
+
+#define RECORD_JUMP_TARGET(targetOffset) \
+ do { m_labels[m_bytecodeOffset + (targetOffset)].used(); } while (false)
+
+void JIT::privateCompileCTIMachineTrampolines(RefPtr<ExecutablePool>* executablePool, JSGlobalData* globalData, TrampolineStructure *trampolines)
+{
+#if ENABLE(JIT_OPTIMIZE_PROPERTY_ACCESS)
+ // (2) The second function provides fast property access for string length
+ Label stringLengthBegin = align();
+
+ // Check eax is a string
+ Jump string_failureCases1 = emitJumpIfNotJSCell(regT0);
+ Jump string_failureCases2 = branchPtr(NotEqual, Address(regT0), ImmPtr(m_globalData->jsStringVPtr));
+
+ // Checks out okay! - get the length from the Ustring.
+ load32(Address(regT0, OBJECT_OFFSETOF(JSString, m_length)), regT0);
+
+ Jump string_failureCases3 = branch32(Above, regT0, Imm32(JSImmediate::maxImmediateInt));
+
+ // regT0 contains a 64 bit value (is positive, is zero extended) so we don't need sign extend here.
+ emitFastArithIntToImmNoCheck(regT0, regT0);
+
+ ret();
+#endif
+
+ // (3) Trampolines for the slow cases of op_call / op_call_eval / op_construct.
+ COMPILE_ASSERT(sizeof(CodeType) == 4, CodeTypeEnumMustBe32Bit);
+
+ // VirtualCallLink Trampoline
+ // regT0 holds callee, regT1 holds argCount. regT2 will hold the FunctionExecutable.
+ JumpList callLinkFailures;
+ Label virtualCallLinkBegin = align();
+ compileOpCallInitializeCallFrame();
+ preserveReturnAddressAfterCall(regT3);
+ emitPutToCallFrameHeader(regT3, RegisterFile::ReturnPC);
+ restoreArgumentReference();
+ Call callLazyLinkCall = call();
+ callLinkFailures.append(branchTestPtr(Zero, regT0));
+ restoreReturnAddressBeforeReturn(regT3);
+ emitGetFromCallFrameHeader32(RegisterFile::ArgumentCount, regT1);
+ jump(regT0);
+
+ // VirtualConstructLink Trampoline
+ // regT0 holds callee, regT1 holds argCount. regT2 will hold the FunctionExecutable.
+ Label virtualConstructLinkBegin = align();
+ compileOpCallInitializeCallFrame();
+ preserveReturnAddressAfterCall(regT3);
+ emitPutToCallFrameHeader(regT3, RegisterFile::ReturnPC);
+ restoreArgumentReference();
+ Call callLazyLinkConstruct = call();
+ callLinkFailures.append(branchTestPtr(Zero, regT0));
+ restoreReturnAddressBeforeReturn(regT3);
+ emitGetFromCallFrameHeader32(RegisterFile::ArgumentCount, regT1);
+ jump(regT0);
+
+ // VirtualCall Trampoline
+ // regT0 holds callee, regT1 holds argCount. regT2 will hold the FunctionExecutable.
+ Label virtualCallBegin = align();
+ compileOpCallInitializeCallFrame();
+
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_executable)), regT2);
+
+ Jump hasCodeBlock3 = branch32(GreaterThanOrEqual, Address(regT2, OBJECT_OFFSETOF(FunctionExecutable, m_numParametersForCall)), Imm32(0));
+ preserveReturnAddressAfterCall(regT3);
+ restoreArgumentReference();
+ Call callCompileCall = call();
+ callLinkFailures.append(branchTestPtr(Zero, regT0));
+ emitGetFromCallFrameHeader32(RegisterFile::ArgumentCount, regT1);
+ restoreReturnAddressBeforeReturn(regT3);
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_executable)), regT2);
+ hasCodeBlock3.link(this);
+
+ loadPtr(Address(regT2, OBJECT_OFFSETOF(FunctionExecutable, m_jitCodeForCallWithArityCheck)), regT0);
+ jump(regT0);
+
+ // VirtualConstruct Trampoline
+ // regT0 holds callee, regT1 holds argCount. regT2 will hold the FunctionExecutable.
+ Label virtualConstructBegin = align();
+ compileOpCallInitializeCallFrame();
+
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_executable)), regT2);
+
+ Jump hasCodeBlock4 = branch32(GreaterThanOrEqual, Address(regT2, OBJECT_OFFSETOF(FunctionExecutable, m_numParametersForConstruct)), Imm32(0));
+ preserveReturnAddressAfterCall(regT3);
+ restoreArgumentReference();
+ Call callCompileConstruct = call();
+ callLinkFailures.append(branchTestPtr(Zero, regT0));
+ emitGetFromCallFrameHeader32(RegisterFile::ArgumentCount, regT1);
+ restoreReturnAddressBeforeReturn(regT3);
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_executable)), regT2);
+ hasCodeBlock4.link(this);
+
+ loadPtr(Address(regT2, OBJECT_OFFSETOF(FunctionExecutable, m_jitCodeForConstructWithArityCheck)), regT0);
+ jump(regT0);
+
+ // If the parser fails we want to be able to be able to keep going,
+ // So we handle this as a parse failure.
+ callLinkFailures.link(this);
+ emitGetFromCallFrameHeaderPtr(RegisterFile::ReturnPC, regT1);
+ emitGetFromCallFrameHeaderPtr(RegisterFile::CallerFrame, callFrameRegister);
+ restoreReturnAddressBeforeReturn(regT1);
+ move(ImmPtr(&globalData->exceptionLocation), regT2);
+ storePtr(regT1, regT2);
+ poke(callFrameRegister, 1 + OBJECT_OFFSETOF(struct JITStackFrame, callFrame) / sizeof(void*));
+ poke(ImmPtr(FunctionPtr(ctiVMThrowTrampoline).value()));
+ ret();
+
+ // NativeCall Trampoline
+ Label nativeCallThunk = privateCompileCTINativeCall(globalData);
+ Label nativeConstructThunk = privateCompileCTINativeCall(globalData, true);
+
+#if ENABLE(JIT_OPTIMIZE_PROPERTY_ACCESS)
+ Call string_failureCases1Call = makeTailRecursiveCall(string_failureCases1);
+ Call string_failureCases2Call = makeTailRecursiveCall(string_failureCases2);
+ Call string_failureCases3Call = makeTailRecursiveCall(string_failureCases3);
+#endif
+
+ // All trampolines constructed! copy the code, link up calls, and set the pointers on the Machine object.
+ LinkBuffer patchBuffer(this, m_globalData->executableAllocator.poolForSize(m_assembler.size()), 0);
+
+#if ENABLE(JIT_OPTIMIZE_PROPERTY_ACCESS)
+ patchBuffer.link(string_failureCases1Call, FunctionPtr(cti_op_get_by_id_string_fail));
+ patchBuffer.link(string_failureCases2Call, FunctionPtr(cti_op_get_by_id_string_fail));
+ patchBuffer.link(string_failureCases3Call, FunctionPtr(cti_op_get_by_id_string_fail));
+#endif
+#if ENABLE(JIT_OPTIMIZE_CALL)
+ patchBuffer.link(callLazyLinkCall, FunctionPtr(cti_vm_lazyLinkCall));
+ patchBuffer.link(callLazyLinkConstruct, FunctionPtr(cti_vm_lazyLinkConstruct));
+#endif
+ patchBuffer.link(callCompileCall, FunctionPtr(cti_op_call_jitCompile));
+ patchBuffer.link(callCompileConstruct, FunctionPtr(cti_op_construct_jitCompile));
+
+ CodeRef finalCode = patchBuffer.finalizeCode();
+ *executablePool = finalCode.m_executablePool;
+
+ trampolines->ctiVirtualCallLink = patchBuffer.trampolineAt(virtualCallLinkBegin);
+ trampolines->ctiVirtualConstructLink = patchBuffer.trampolineAt(virtualConstructLinkBegin);
+ trampolines->ctiVirtualCall = patchBuffer.trampolineAt(virtualCallBegin);
+ trampolines->ctiVirtualConstruct = patchBuffer.trampolineAt(virtualConstructBegin);
+ trampolines->ctiNativeCall = patchBuffer.trampolineAt(nativeCallThunk);
+ trampolines->ctiNativeConstruct = patchBuffer.trampolineAt(nativeConstructThunk);
+#if ENABLE(JIT_OPTIMIZE_PROPERTY_ACCESS)
+ trampolines->ctiStringLengthTrampoline = patchBuffer.trampolineAt(stringLengthBegin);
+#endif
+}
+
+JIT::Label JIT::privateCompileCTINativeCall(JSGlobalData* globalData, bool isConstruct)
+{
+ int executableOffsetToFunction = isConstruct ? OBJECT_OFFSETOF(NativeExecutable, m_constructor) : OBJECT_OFFSETOF(NativeExecutable, m_function);
+
+ Label nativeCallThunk = align();
+
+ emitPutImmediateToCallFrameHeader(0, RegisterFile::CodeBlock);
+
+#if CPU(X86_64)
+ // Load caller frame's scope chain into this callframe so that whatever we call can
+ // get to its global data.
+ emitGetFromCallFrameHeaderPtr(RegisterFile::CallerFrame, regT0);
+ emitGetFromCallFrameHeaderPtr(RegisterFile::ScopeChain, regT1, regT0);
+ emitPutToCallFrameHeader(regT1, RegisterFile::ScopeChain);
+
+ peek(regT1);
+ emitPutToCallFrameHeader(regT1, RegisterFile::ReturnPC);
+
+ // Calling convention: f(edi, esi, edx, ecx, ...);
+ // Host function signature: f(ExecState*);
+ move(callFrameRegister, X86Registers::edi);
+
+ subPtr(Imm32(16 - sizeof(void*)), stackPointerRegister); // Align stack after call.
+
+ emitGetFromCallFrameHeaderPtr(RegisterFile::Callee, X86Registers::esi);
+ loadPtr(Address(X86Registers::esi, OBJECT_OFFSETOF(JSFunction, m_executable)), X86Registers::r9);
+ move(regT0, callFrameRegister); // Eagerly restore caller frame register to avoid loading from stack.
+ call(Address(X86Registers::r9, executableOffsetToFunction));
+
+ addPtr(Imm32(16 - sizeof(void*)), stackPointerRegister);
+
+#elif CPU(ARM)
+ // Load caller frame's scope chain into this callframe so that whatever we call can
+ // get to its global data.
+ emitGetFromCallFrameHeaderPtr(RegisterFile::CallerFrame, regT2);
+ emitGetFromCallFrameHeaderPtr(RegisterFile::ScopeChain, regT1, regT2);
+ emitPutToCallFrameHeader(regT1, RegisterFile::ScopeChain);
+
+ preserveReturnAddressAfterCall(regT3); // Callee preserved
+ emitPutToCallFrameHeader(regT3, RegisterFile::ReturnPC);
+
+ // Calling convention: f(r0 == regT0, r1 == regT1, ...);
+ // Host function signature: f(ExecState*);
+ move(callFrameRegister, ARMRegisters::r0);
+
+ emitGetFromCallFrameHeaderPtr(RegisterFile::Callee, ARMRegisters::r1);
+ move(regT2, callFrameRegister); // Eagerly restore caller frame register to avoid loading from stack.
+ loadPtr(Address(ARMRegisters::r1, OBJECT_OFFSETOF(JSFunction, m_executable)), regT2);
+ call(Address(regT2, executableOffsetToFunction));
+
+ restoreReturnAddressBeforeReturn(regT3);
+
+#elif CPU(MIPS)
+ // Load caller frame's scope chain into this callframe so that whatever we call can
+ // get to its global data.
+ emitGetFromCallFrameHeaderPtr(RegisterFile::CallerFrame, regT0);
+ emitGetFromCallFrameHeaderPtr(RegisterFile::ScopeChain, regT1, regT0);
+ emitPutToCallFrameHeader(regT1, RegisterFile::ScopeChain);
+
+ preserveReturnAddressAfterCall(regT3); // Callee preserved
+ emitPutToCallFrameHeader(regT3, RegisterFile::ReturnPC);
+
+ // Calling convention: f(a0, a1, a2, a3);
+ // Host function signature: f(ExecState*);
+
+ // Allocate stack space for 16 bytes (8-byte aligned)
+ // 16 bytes (unused) for 4 arguments
+ subPtr(Imm32(16), stackPointerRegister);
+
+ // Setup arg0
+ move(callFrameRegister, MIPSRegisters::a0);
+
+ // Call
+ emitGetFromCallFrameHeaderPtr(RegisterFile::Callee, MIPSRegisters::a2);
+ loadPtr(Address(MIPSRegisters::a2, OBJECT_OFFSETOF(JSFunction, m_executable)), regT2);
+ move(regT0, callFrameRegister); // Eagerly restore caller frame register to avoid loading from stack.
+ call(Address(regT2, executableOffsetToFunction));
+
+ // Restore stack space
+ addPtr(Imm32(16), stackPointerRegister);
+
+ restoreReturnAddressBeforeReturn(regT3);
+
+#elif ENABLE(JIT_OPTIMIZE_NATIVE_CALL)
+#error "JIT_OPTIMIZE_NATIVE_CALL not yet supported on this platform."
+#else
+ UNUSED_PARAM(executableOffsetToFunction);
+ breakpoint();
+#endif
+
+ // Check for an exception
+ loadPtr(&(globalData->exception), regT2);
+ Jump exceptionHandler = branchTestPtr(NonZero, regT2);
+
+ // Return.
+ ret();
+
+ // Handle an exception
+ exceptionHandler.link(this);
+
+ // Grab the return address.
+ preserveReturnAddressAfterCall(regT1);
+
+ move(ImmPtr(&globalData->exceptionLocation), regT2);
+ storePtr(regT1, regT2);
+ poke(callFrameRegister, OBJECT_OFFSETOF(struct JITStackFrame, callFrame) / sizeof(void*));
+
+ // Set the return address.
+ move(ImmPtr(FunctionPtr(ctiVMThrowTrampoline).value()), regT1);
+ restoreReturnAddressBeforeReturn(regT1);
+
+ ret();
+
+ return nativeCallThunk;
+}
+
+JIT::CodePtr JIT::privateCompileCTINativeCall(PassRefPtr<ExecutablePool>, JSGlobalData* globalData, NativeFunction)
+{
+ return globalData->jitStubs->ctiNativeCall();
+}
+
+void JIT::emit_op_mov(Instruction* currentInstruction)
+{
+ int dst = currentInstruction[1].u.operand;
+ int src = currentInstruction[2].u.operand;
+
+ if (m_codeBlock->isConstantRegisterIndex(src)) {
+ storePtr(ImmPtr(JSValue::encode(getConstantOperand(src))), Address(callFrameRegister, dst * sizeof(Register)));
+ if (dst == m_lastResultBytecodeRegister)
+ killLastResultRegister();
+ } else if ((src == m_lastResultBytecodeRegister) || (dst == m_lastResultBytecodeRegister)) {
+ // If either the src or dst is the cached register go though
+ // get/put registers to make sure we track this correctly.
+ emitGetVirtualRegister(src, regT0);
+ emitPutVirtualRegister(dst);
+ } else {
+ // Perform the copy via regT1; do not disturb any mapping in regT0.
+ loadPtr(Address(callFrameRegister, src * sizeof(Register)), regT1);
+ storePtr(regT1, Address(callFrameRegister, dst * sizeof(Register)));
+ }
+}
+
+void JIT::emit_op_end(Instruction* currentInstruction)
+{
+ if (m_codeBlock->needsFullScopeChain())
+ JITStubCall(this, cti_op_end).call();
+
+ ASSERT(returnValueRegister != callFrameRegister);
+ emitGetVirtualRegister(currentInstruction[1].u.operand, returnValueRegister);
+ restoreReturnAddressBeforeReturn(Address(callFrameRegister, RegisterFile::ReturnPC * static_cast<int>(sizeof(Register))));
+ ret();
+}
+
+void JIT::emit_op_jmp(Instruction* currentInstruction)
+{
+ unsigned target = currentInstruction[1].u.operand;
+ addJump(jump(), target);
+ RECORD_JUMP_TARGET(target);
+}
+
+void JIT::emit_op_loop_if_lesseq(Instruction* currentInstruction)
+{
+ emitTimeoutCheck();
+
+ unsigned op1 = currentInstruction[1].u.operand;
+ unsigned op2 = currentInstruction[2].u.operand;
+ unsigned target = currentInstruction[3].u.operand;
+ if (isOperandConstantImmediateInt(op2)) {
+ emitGetVirtualRegister(op1, regT0);
+ emitJumpSlowCaseIfNotImmediateInteger(regT0);
+ int32_t op2imm = getConstantOperandImmediateInt(op2);
+ addJump(branch32(LessThanOrEqual, regT0, Imm32(op2imm)), target);
+ } else {
+ emitGetVirtualRegisters(op1, regT0, op2, regT1);
+ emitJumpSlowCaseIfNotImmediateInteger(regT0);
+ emitJumpSlowCaseIfNotImmediateInteger(regT1);
+ addJump(branch32(LessThanOrEqual, regT0, regT1), target);
+ }
+}
+
+void JIT::emit_op_new_object(Instruction* currentInstruction)
+{
+ JITStubCall(this, cti_op_new_object).call(currentInstruction[1].u.operand);
+}
+
+void JIT::emit_op_check_has_instance(Instruction* currentInstruction)
+{
+ unsigned baseVal = currentInstruction[1].u.operand;
+
+ emitGetVirtualRegister(baseVal, regT0);
+
+ // Check that baseVal is a cell.
+ emitJumpSlowCaseIfNotJSCell(regT0, baseVal);
+
+ // Check that baseVal 'ImplementsHasInstance'.
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), regT0);
+ addSlowCase(branchTest8(Zero, Address(regT0, OBJECT_OFFSETOF(Structure, m_typeInfo.m_flags)), Imm32(ImplementsHasInstance)));
+}
+
+void JIT::emit_op_instanceof(Instruction* currentInstruction)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+ unsigned value = currentInstruction[2].u.operand;
+ unsigned baseVal = currentInstruction[3].u.operand;
+ unsigned proto = currentInstruction[4].u.operand;
+
+ // Load the operands (baseVal, proto, and value respectively) into registers.
+ // We use regT0 for baseVal since we will be done with this first, and we can then use it for the result.
+ emitGetVirtualRegister(value, regT2);
+ emitGetVirtualRegister(baseVal, regT0);
+ emitGetVirtualRegister(proto, regT1);
+
+ // Check that proto are cells. baseVal must be a cell - this is checked by op_check_has_instance.
+ emitJumpSlowCaseIfNotJSCell(regT2, value);
+ emitJumpSlowCaseIfNotJSCell(regT1, proto);
+
+ // Check that prototype is an object
+ loadPtr(Address(regT1, OBJECT_OFFSETOF(JSCell, m_structure)), regT3);
+ addSlowCase(branch8(NotEqual, Address(regT3, OBJECT_OFFSETOF(Structure, m_typeInfo.m_type)), Imm32(ObjectType)));
+
+ // Fixme: this check is only needed because the JSC API allows HasInstance to be overridden; we should deprecate this.
+ // Check that baseVal 'ImplementsDefaultHasInstance'.
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), regT0);
+ addSlowCase(branchTest8(Zero, Address(regT0, OBJECT_OFFSETOF(Structure, m_typeInfo.m_flags)), Imm32(ImplementsDefaultHasInstance)));
+
+ // Optimistically load the result true, and start looping.
+ // Initially, regT1 still contains proto and regT2 still contains value.
+ // As we loop regT2 will be updated with its prototype, recursively walking the prototype chain.
+ move(ImmPtr(JSValue::encode(jsBoolean(true))), regT0);
+ Label loop(this);
+
+ // Load the prototype of the object in regT2. If this is equal to regT1 - WIN!
+ // Otherwise, check if we've hit null - if we have then drop out of the loop, if not go again.
+ loadPtr(Address(regT2, OBJECT_OFFSETOF(JSCell, m_structure)), regT2);
+ loadPtr(Address(regT2, OBJECT_OFFSETOF(Structure, m_prototype)), regT2);
+ Jump isInstance = branchPtr(Equal, regT2, regT1);
+ emitJumpIfJSCell(regT2).linkTo(loop, this);
+
+ // We get here either by dropping out of the loop, or if value was not an Object. Result is false.
+ move(ImmPtr(JSValue::encode(jsBoolean(false))), regT0);
+
+ // isInstance jumps right down to here, to skip setting the result to false (it has already set true).
+ isInstance.link(this);
+ emitPutVirtualRegister(dst);
+}
+
+void JIT::emit_op_call(Instruction* currentInstruction)
+{
+ compileOpCall(op_call, currentInstruction, m_callLinkInfoIndex++);
+}
+
+void JIT::emit_op_call_eval(Instruction* currentInstruction)
+{
+ compileOpCall(op_call_eval, currentInstruction, m_callLinkInfoIndex++);
+}
+
+void JIT::emit_op_call_varargs(Instruction* currentInstruction)
+{
+ compileOpCallVarargs(currentInstruction);
+}
+
+void JIT::emit_op_construct(Instruction* currentInstruction)
+{
+ compileOpCall(op_construct, currentInstruction, m_callLinkInfoIndex++);
+}
+
+void JIT::emit_op_get_global_var(Instruction* currentInstruction)
+{
+ JSVariableObject* globalObject = m_codeBlock->globalObject();
+ move(ImmPtr(globalObject), regT0);
+ emitGetVariableObjectRegister(regT0, currentInstruction[2].u.operand, regT0);
+ emitPutVirtualRegister(currentInstruction[1].u.operand);
+}
+
+void JIT::emit_op_put_global_var(Instruction* currentInstruction)
+{
+ emitGetVirtualRegister(currentInstruction[2].u.operand, regT1);
+ JSVariableObject* globalObject = m_codeBlock->globalObject();
+ move(ImmPtr(globalObject), regT0);
+ emitPutVariableObjectRegister(regT1, regT0, currentInstruction[1].u.operand);
+}
+
+void JIT::emit_op_get_scoped_var(Instruction* currentInstruction)
+{
+ int skip = currentInstruction[3].u.operand;
+
+ emitGetFromCallFrameHeaderPtr(RegisterFile::ScopeChain, regT0);
+ bool checkTopLevel = m_codeBlock->codeType() == FunctionCode && m_codeBlock->needsFullScopeChain();
+ ASSERT(skip || !checkTopLevel);
+ if (checkTopLevel && skip--) {
+ Jump activationNotCreated;
+ if (checkTopLevel)
+ activationNotCreated = branchTestPtr(Zero, addressFor(m_codeBlock->activationRegister()));
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(ScopeChainNode, next)), regT0);
+ activationNotCreated.link(this);
+ }
+ while (skip--)
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(ScopeChainNode, next)), regT0);
+
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(ScopeChainNode, object)), regT0);
+ emitGetVariableObjectRegister(regT0, currentInstruction[2].u.operand, regT0);
+ emitPutVirtualRegister(currentInstruction[1].u.operand);
+}
+
+void JIT::emit_op_put_scoped_var(Instruction* currentInstruction)
+{
+ int skip = currentInstruction[2].u.operand;
+
+ emitGetFromCallFrameHeaderPtr(RegisterFile::ScopeChain, regT1);
+ emitGetVirtualRegister(currentInstruction[3].u.operand, regT0);
+ bool checkTopLevel = m_codeBlock->codeType() == FunctionCode && m_codeBlock->needsFullScopeChain();
+ ASSERT(skip || !checkTopLevel);
+ if (checkTopLevel && skip--) {
+ Jump activationNotCreated;
+ if (checkTopLevel)
+ activationNotCreated = branchTestPtr(Zero, addressFor(m_codeBlock->activationRegister()));
+ loadPtr(Address(regT1, OBJECT_OFFSETOF(ScopeChainNode, next)), regT1);
+ activationNotCreated.link(this);
+ }
+ while (skip--)
+ loadPtr(Address(regT1, OBJECT_OFFSETOF(ScopeChainNode, next)), regT1);
+
+ loadPtr(Address(regT1, OBJECT_OFFSETOF(ScopeChainNode, object)), regT1);
+ emitPutVariableObjectRegister(regT0, regT1, currentInstruction[1].u.operand);
+}
+
+void JIT::emit_op_tear_off_activation(Instruction* currentInstruction)
+{
+ unsigned activation = currentInstruction[1].u.operand;
+ unsigned arguments = currentInstruction[2].u.operand;
+ Jump activationCreated = branchTestPtr(NonZero, addressFor(activation));
+ Jump argumentsNotCreated = branchTestPtr(Zero, addressFor(arguments));
+ activationCreated.link(this);
+ JITStubCall stubCall(this, cti_op_tear_off_activation);
+ stubCall.addArgument(activation, regT2);
+ stubCall.addArgument(unmodifiedArgumentsRegister(arguments), regT2);
+ stubCall.call();
+ argumentsNotCreated.link(this);
+}
+
+void JIT::emit_op_tear_off_arguments(Instruction* currentInstruction)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+
+ Jump argsNotCreated = branchTestPtr(Zero, Address(callFrameRegister, sizeof(Register) * (unmodifiedArgumentsRegister(dst))));
+ JITStubCall stubCall(this, cti_op_tear_off_arguments);
+ stubCall.addArgument(unmodifiedArgumentsRegister(dst), regT2);
+ stubCall.call();
+ argsNotCreated.link(this);
+}
+
+void JIT::emit_op_ret(Instruction* currentInstruction)
+{
+ // We could JIT generate the deref, only calling out to C when the refcount hits zero.
+ if (m_codeBlock->needsFullScopeChain()) {
+ Jump activationNotCreated = branchTestPtr(Zero, addressFor(m_codeBlock->activationRegister()));
+ JITStubCall(this, cti_op_ret_scopeChain).call();
+ activationNotCreated.link(this);
+ }
+ ASSERT(callFrameRegister != regT1);
+ ASSERT(regT1 != returnValueRegister);
+ ASSERT(returnValueRegister != callFrameRegister);
+
+ // Return the result in %eax.
+ emitGetVirtualRegister(currentInstruction[1].u.operand, returnValueRegister);
+
+ // Grab the return address.
+ emitGetFromCallFrameHeaderPtr(RegisterFile::ReturnPC, regT1);
+
+ // Restore our caller's "r".
+ emitGetFromCallFrameHeaderPtr(RegisterFile::CallerFrame, callFrameRegister);
+
+ // Return.
+ restoreReturnAddressBeforeReturn(regT1);
+ ret();
+}
+
+void JIT::emit_op_ret_object_or_this(Instruction* currentInstruction)
+{
+ // We could JIT generate the deref, only calling out to C when the refcount hits zero.
+ if (m_codeBlock->needsFullScopeChain()) {
+ Jump activationNotCreated = branchTestPtr(Zero, addressFor(m_codeBlock->activationRegister()));
+ JITStubCall(this, cti_op_ret_scopeChain).call();
+ activationNotCreated.link(this);
+ }
+
+ ASSERT(callFrameRegister != regT1);
+ ASSERT(regT1 != returnValueRegister);
+ ASSERT(returnValueRegister != callFrameRegister);
+
+ // Return the result in %eax.
+ emitGetVirtualRegister(currentInstruction[1].u.operand, returnValueRegister);
+ Jump notJSCell = emitJumpIfNotJSCell(returnValueRegister);
+ loadPtr(Address(returnValueRegister, OBJECT_OFFSETOF(JSCell, m_structure)), regT2);
+ Jump notObject = branch8(NotEqual, Address(regT2, OBJECT_OFFSETOF(Structure, m_typeInfo) + OBJECT_OFFSETOF(TypeInfo, m_type)), Imm32(ObjectType));
+
+ // Grab the return address.
+ emitGetFromCallFrameHeaderPtr(RegisterFile::ReturnPC, regT1);
+
+ // Restore our caller's "r".
+ emitGetFromCallFrameHeaderPtr(RegisterFile::CallerFrame, callFrameRegister);
+
+ // Return.
+ restoreReturnAddressBeforeReturn(regT1);
+ ret();
+
+ // Return 'this' in %eax.
+ notJSCell.link(this);
+ notObject.link(this);
+ emitGetVirtualRegister(currentInstruction[2].u.operand, returnValueRegister);
+
+ // Grab the return address.
+ emitGetFromCallFrameHeaderPtr(RegisterFile::ReturnPC, regT1);
+
+ // Restore our caller's "r".
+ emitGetFromCallFrameHeaderPtr(RegisterFile::CallerFrame, callFrameRegister);
+
+ // Return.
+ restoreReturnAddressBeforeReturn(regT1);
+ ret();
+}
+
+void JIT::emit_op_new_array(Instruction* currentInstruction)
+{
+ JITStubCall stubCall(this, cti_op_new_array);
+ stubCall.addArgument(Imm32(currentInstruction[2].u.operand));
+ stubCall.addArgument(Imm32(currentInstruction[3].u.operand));
+ stubCall.call(currentInstruction[1].u.operand);
+}
+
+void JIT::emit_op_resolve(Instruction* currentInstruction)
+{
+ JITStubCall stubCall(this, cti_op_resolve);
+ stubCall.addArgument(ImmPtr(&m_codeBlock->identifier(currentInstruction[2].u.operand)));
+ stubCall.call(currentInstruction[1].u.operand);
+}
+
+void JIT::emit_op_to_primitive(Instruction* currentInstruction)
+{
+ int dst = currentInstruction[1].u.operand;
+ int src = currentInstruction[2].u.operand;
+
+ emitGetVirtualRegister(src, regT0);
+
+ Jump isImm = emitJumpIfNotJSCell(regT0);
+ addSlowCase(branchPtr(NotEqual, Address(regT0), ImmPtr(m_globalData->jsStringVPtr)));
+ isImm.link(this);
+
+ if (dst != src)
+ emitPutVirtualRegister(dst);
+
+}
+
+void JIT::emit_op_strcat(Instruction* currentInstruction)
+{
+ JITStubCall stubCall(this, cti_op_strcat);
+ stubCall.addArgument(Imm32(currentInstruction[2].u.operand));
+ stubCall.addArgument(Imm32(currentInstruction[3].u.operand));
+ stubCall.call(currentInstruction[1].u.operand);
+}
+
+void JIT::emit_op_resolve_base(Instruction* currentInstruction)
+{
+ JITStubCall stubCall(this, currentInstruction[3].u.operand ? cti_op_resolve_base_strict_put : cti_op_resolve_base);
+ stubCall.addArgument(ImmPtr(&m_codeBlock->identifier(currentInstruction[2].u.operand)));
+ stubCall.call(currentInstruction[1].u.operand);
+}
+
+void JIT::emit_op_ensure_property_exists(Instruction* currentInstruction)
+{
+ JITStubCall stubCall(this, cti_op_ensure_property_exists);
+ stubCall.addArgument(Imm32(currentInstruction[1].u.operand));
+ stubCall.addArgument(ImmPtr(&m_codeBlock->identifier(currentInstruction[2].u.operand)));
+ stubCall.call(currentInstruction[1].u.operand);
+}
+
+void JIT::emit_op_resolve_skip(Instruction* currentInstruction)
+{
+ JITStubCall stubCall(this, cti_op_resolve_skip);
+ stubCall.addArgument(ImmPtr(&m_codeBlock->identifier(currentInstruction[2].u.operand)));
+ stubCall.addArgument(Imm32(currentInstruction[3].u.operand));
+ stubCall.call(currentInstruction[1].u.operand);
+}
+
+void JIT::emit_op_resolve_global(Instruction* currentInstruction, bool)
+{
+ // Fast case
+ void* globalObject = m_codeBlock->globalObject();
+ unsigned currentIndex = m_globalResolveInfoIndex++;
+ void* structureAddress = &(m_codeBlock->globalResolveInfo(currentIndex).structure);
+ void* offsetAddr = &(m_codeBlock->globalResolveInfo(currentIndex).offset);
+
+ // Check Structure of global object
+ move(ImmPtr(globalObject), regT0);
+ loadPtr(structureAddress, regT1);
+ addSlowCase(branchPtr(NotEqual, regT1, Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)))); // Structures don't match
+
+ // Load cached property
+ // Assume that the global object always uses external storage.
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(JSGlobalObject, m_externalStorage)), regT0);
+ load32(offsetAddr, regT1);
+ loadPtr(BaseIndex(regT0, regT1, ScalePtr), regT0);
+ emitPutVirtualRegister(currentInstruction[1].u.operand);
+}
+
+void JIT::emitSlow_op_resolve_global(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+ Identifier* ident = &m_codeBlock->identifier(currentInstruction[2].u.operand);
+
+ unsigned currentIndex = m_globalResolveInfoIndex++;
+
+ linkSlowCase(iter);
+ JITStubCall stubCall(this, cti_op_resolve_global);
+ stubCall.addArgument(ImmPtr(ident));
+ stubCall.addArgument(Imm32(currentIndex));
+ stubCall.addArgument(regT0);
+ stubCall.call(dst);
+}
+
+void JIT::emit_op_not(Instruction* currentInstruction)
+{
+ emitGetVirtualRegister(currentInstruction[2].u.operand, regT0);
+ xorPtr(Imm32(static_cast<int32_t>(JSImmediate::FullTagTypeBool)), regT0);
+ addSlowCase(branchTestPtr(NonZero, regT0, Imm32(static_cast<int32_t>(~JSImmediate::ExtendedPayloadBitBoolValue))));
+ xorPtr(Imm32(static_cast<int32_t>(JSImmediate::FullTagTypeBool | JSImmediate::ExtendedPayloadBitBoolValue)), regT0);
+ emitPutVirtualRegister(currentInstruction[1].u.operand);
+}
+
+void JIT::emit_op_jfalse(Instruction* currentInstruction)
+{
+ unsigned target = currentInstruction[2].u.operand;
+ emitGetVirtualRegister(currentInstruction[1].u.operand, regT0);
+
+ addJump(branchPtr(Equal, regT0, ImmPtr(JSValue::encode(jsNumber(0)))), target);
+ Jump isNonZero = emitJumpIfImmediateInteger(regT0);
+
+ addJump(branchPtr(Equal, regT0, ImmPtr(JSValue::encode(jsBoolean(false)))), target);
+ addSlowCase(branchPtr(NotEqual, regT0, ImmPtr(JSValue::encode(jsBoolean(true)))));
+
+ isNonZero.link(this);
+ RECORD_JUMP_TARGET(target);
+}
+
+void JIT::emit_op_jeq_null(Instruction* currentInstruction)
+{
+ unsigned src = currentInstruction[1].u.operand;
+ unsigned target = currentInstruction[2].u.operand;
+
+ emitGetVirtualRegister(src, regT0);
+ Jump isImmediate = emitJumpIfNotJSCell(regT0);
+
+ // First, handle JSCell cases - check MasqueradesAsUndefined bit on the structure.
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), regT2);
+ addJump(branchTest8(NonZero, Address(regT2, OBJECT_OFFSETOF(Structure, m_typeInfo.m_flags)), Imm32(MasqueradesAsUndefined)), target);
+ Jump wasNotImmediate = jump();
+
+ // Now handle the immediate cases - undefined & null
+ isImmediate.link(this);
+ andPtr(Imm32(~JSImmediate::ExtendedTagBitUndefined), regT0);
+ addJump(branchPtr(Equal, regT0, ImmPtr(JSValue::encode(jsNull()))), target);
+
+ wasNotImmediate.link(this);
+ RECORD_JUMP_TARGET(target);
+};
+void JIT::emit_op_jneq_null(Instruction* currentInstruction)
+{
+ unsigned src = currentInstruction[1].u.operand;
+ unsigned target = currentInstruction[2].u.operand;
+
+ emitGetVirtualRegister(src, regT0);
+ Jump isImmediate = emitJumpIfNotJSCell(regT0);
+
+ // First, handle JSCell cases - check MasqueradesAsUndefined bit on the structure.
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), regT2);
+ addJump(branchTest8(Zero, Address(regT2, OBJECT_OFFSETOF(Structure, m_typeInfo.m_flags)), Imm32(MasqueradesAsUndefined)), target);
+ Jump wasNotImmediate = jump();
+
+ // Now handle the immediate cases - undefined & null
+ isImmediate.link(this);
+ andPtr(Imm32(~JSImmediate::ExtendedTagBitUndefined), regT0);
+ addJump(branchPtr(NotEqual, regT0, ImmPtr(JSValue::encode(jsNull()))), target);
+
+ wasNotImmediate.link(this);
+ RECORD_JUMP_TARGET(target);
+}
+
+void JIT::emit_op_jneq_ptr(Instruction* currentInstruction)
+{
+ unsigned src = currentInstruction[1].u.operand;
+ JSCell* ptr = currentInstruction[2].u.jsCell;
+ unsigned target = currentInstruction[3].u.operand;
+
+ emitGetVirtualRegister(src, regT0);
+ addJump(branchPtr(NotEqual, regT0, ImmPtr(JSValue::encode(JSValue(ptr)))), target);
+
+ RECORD_JUMP_TARGET(target);
+}
+
+void JIT::emit_op_jsr(Instruction* currentInstruction)
+{
+ int retAddrDst = currentInstruction[1].u.operand;
+ int target = currentInstruction[2].u.operand;
+ DataLabelPtr storeLocation = storePtrWithPatch(ImmPtr(0), Address(callFrameRegister, sizeof(Register) * retAddrDst));
+ addJump(jump(), target);
+ m_jsrSites.append(JSRInfo(storeLocation, label()));
+ killLastResultRegister();
+ RECORD_JUMP_TARGET(target);
+}
+
+void JIT::emit_op_sret(Instruction* currentInstruction)
+{
+ jump(Address(callFrameRegister, sizeof(Register) * currentInstruction[1].u.operand));
+ killLastResultRegister();
+}
+
+void JIT::emit_op_eq(Instruction* currentInstruction)
+{
+ emitGetVirtualRegisters(currentInstruction[2].u.operand, regT0, currentInstruction[3].u.operand, regT1);
+ emitJumpSlowCaseIfNotImmediateIntegers(regT0, regT1, regT2);
+ set32Compare32(Equal, regT1, regT0, regT0);
+ emitTagAsBoolImmediate(regT0);
+ emitPutVirtualRegister(currentInstruction[1].u.operand);
+}
+
+void JIT::emit_op_bitnot(Instruction* currentInstruction)
+{
+ emitGetVirtualRegister(currentInstruction[2].u.operand, regT0);
+ emitJumpSlowCaseIfNotImmediateInteger(regT0);
+ not32(regT0);
+ emitFastArithIntToImmNoCheck(regT0, regT0);
+ emitPutVirtualRegister(currentInstruction[1].u.operand);
+}
+
+void JIT::emit_op_resolve_with_base(Instruction* currentInstruction)
+{
+ JITStubCall stubCall(this, cti_op_resolve_with_base);
+ stubCall.addArgument(ImmPtr(&m_codeBlock->identifier(currentInstruction[3].u.operand)));
+ stubCall.addArgument(Imm32(currentInstruction[1].u.operand));
+ stubCall.call(currentInstruction[2].u.operand);
+}
+
+void JIT::emit_op_new_func_exp(Instruction* currentInstruction)
+{
+ JITStubCall stubCall(this, cti_op_new_func_exp);
+ stubCall.addArgument(ImmPtr(m_codeBlock->functionExpr(currentInstruction[2].u.operand)));
+ stubCall.call(currentInstruction[1].u.operand);
+}
+
+void JIT::emit_op_jtrue(Instruction* currentInstruction)
+{
+ unsigned target = currentInstruction[2].u.operand;
+ emitGetVirtualRegister(currentInstruction[1].u.operand, regT0);
+
+ Jump isZero = branchPtr(Equal, regT0, ImmPtr(JSValue::encode(jsNumber(0))));
+ addJump(emitJumpIfImmediateInteger(regT0), target);
+
+ addJump(branchPtr(Equal, regT0, ImmPtr(JSValue::encode(jsBoolean(true)))), target);
+ addSlowCase(branchPtr(NotEqual, regT0, ImmPtr(JSValue::encode(jsBoolean(false)))));
+
+ isZero.link(this);
+ RECORD_JUMP_TARGET(target);
+}
+
+void JIT::emit_op_neq(Instruction* currentInstruction)
+{
+ emitGetVirtualRegisters(currentInstruction[2].u.operand, regT0, currentInstruction[3].u.operand, regT1);
+ emitJumpSlowCaseIfNotImmediateIntegers(regT0, regT1, regT2);
+ set32Compare32(NotEqual, regT1, regT0, regT0);
+ emitTagAsBoolImmediate(regT0);
+
+ emitPutVirtualRegister(currentInstruction[1].u.operand);
+
+}
+
+void JIT::emit_op_bitxor(Instruction* currentInstruction)
+{
+ emitGetVirtualRegisters(currentInstruction[2].u.operand, regT0, currentInstruction[3].u.operand, regT1);
+ emitJumpSlowCaseIfNotImmediateIntegers(regT0, regT1, regT2);
+ xorPtr(regT1, regT0);
+ emitFastArithReTagImmediate(regT0, regT0);
+ emitPutVirtualRegister(currentInstruction[1].u.operand);
+}
+
+void JIT::emit_op_bitor(Instruction* currentInstruction)
+{
+ emitGetVirtualRegisters(currentInstruction[2].u.operand, regT0, currentInstruction[3].u.operand, regT1);
+ emitJumpSlowCaseIfNotImmediateIntegers(regT0, regT1, regT2);
+ orPtr(regT1, regT0);
+ emitPutVirtualRegister(currentInstruction[1].u.operand);
+}
+
+void JIT::emit_op_throw(Instruction* currentInstruction)
+{
+ JITStubCall stubCall(this, cti_op_throw);
+ stubCall.addArgument(currentInstruction[1].u.operand, regT2);
+ stubCall.call();
+ ASSERT(regT0 == returnValueRegister);
+#ifndef NDEBUG
+ // cti_op_throw always changes it's return address,
+ // this point in the code should never be reached.
+ breakpoint();
+#endif
+}
+
+void JIT::emit_op_get_pnames(Instruction* currentInstruction)
+{
+ int dst = currentInstruction[1].u.operand;
+ int base = currentInstruction[2].u.operand;
+ int i = currentInstruction[3].u.operand;
+ int size = currentInstruction[4].u.operand;
+ int breakTarget = currentInstruction[5].u.operand;
+
+ JumpList isNotObject;
+
+ emitGetVirtualRegister(base, regT0);
+ if (!m_codeBlock->isKnownNotImmediate(base))
+ isNotObject.append(emitJumpIfNotJSCell(regT0));
+ if (base != m_codeBlock->thisRegister() || m_codeBlock->isStrictMode()) {
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), regT2);
+ isNotObject.append(branch8(NotEqual, Address(regT2, OBJECT_OFFSETOF(Structure, m_typeInfo.m_type)), Imm32(ObjectType)));
+ }
+
+ // We could inline the case where you have a valid cache, but
+ // this call doesn't seem to be hot.
+ Label isObject(this);
+ JITStubCall getPnamesStubCall(this, cti_op_get_pnames);
+ getPnamesStubCall.addArgument(regT0);
+ getPnamesStubCall.call(dst);
+ load32(Address(regT0, OBJECT_OFFSETOF(JSPropertyNameIterator, m_jsStringsSize)), regT3);
+ store32(Imm32(0), addressFor(i));
+ store32(regT3, addressFor(size));
+ Jump end = jump();
+
+ isNotObject.link(this);
+ move(regT0, regT1);
+ and32(Imm32(~JSImmediate::ExtendedTagBitUndefined), regT1);
+ addJump(branch32(Equal, regT1, Imm32(JSImmediate::FullTagTypeNull)), breakTarget);
+
+ JITStubCall toObjectStubCall(this, cti_to_object);
+ toObjectStubCall.addArgument(regT0);
+ toObjectStubCall.call(base);
+ jump().linkTo(isObject, this);
+
+ end.link(this);
+}
+
+void JIT::emit_op_next_pname(Instruction* currentInstruction)
+{
+ int dst = currentInstruction[1].u.operand;
+ int base = currentInstruction[2].u.operand;
+ int i = currentInstruction[3].u.operand;
+ int size = currentInstruction[4].u.operand;
+ int it = currentInstruction[5].u.operand;
+ int target = currentInstruction[6].u.operand;
+
+ JumpList callHasProperty;
+
+ Label begin(this);
+ load32(addressFor(i), regT0);
+ Jump end = branch32(Equal, regT0, addressFor(size));
+
+ // Grab key @ i
+ loadPtr(addressFor(it), regT1);
+ loadPtr(Address(regT1, OBJECT_OFFSETOF(JSPropertyNameIterator, m_jsStrings)), regT2);
+
+ loadPtr(BaseIndex(regT2, regT0, TimesEight), regT2);
+
+ emitPutVirtualRegister(dst, regT2);
+
+ // Increment i
+ add32(Imm32(1), regT0);
+ store32(regT0, addressFor(i));
+
+ // Verify that i is valid:
+ emitGetVirtualRegister(base, regT0);
+
+ // Test base's structure
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), regT2);
+ callHasProperty.append(branchPtr(NotEqual, regT2, Address(Address(regT1, OBJECT_OFFSETOF(JSPropertyNameIterator, m_cachedStructure)))));
+
+ // Test base's prototype chain
+ loadPtr(Address(Address(regT1, OBJECT_OFFSETOF(JSPropertyNameIterator, m_cachedPrototypeChain))), regT3);
+ loadPtr(Address(regT3, OBJECT_OFFSETOF(StructureChain, m_vector)), regT3);
+ addJump(branchTestPtr(Zero, Address(regT3)), target);
+
+ Label checkPrototype(this);
+ loadPtr(Address(regT2, OBJECT_OFFSETOF(Structure, m_prototype)), regT2);
+ callHasProperty.append(emitJumpIfNotJSCell(regT2));
+ loadPtr(Address(regT2, OBJECT_OFFSETOF(JSCell, m_structure)), regT2);
+ callHasProperty.append(branchPtr(NotEqual, regT2, Address(regT3)));
+ addPtr(Imm32(sizeof(Structure*)), regT3);
+ branchTestPtr(NonZero, Address(regT3)).linkTo(checkPrototype, this);
+
+ // Continue loop.
+ addJump(jump(), target);
+
+ // Slow case: Ask the object if i is valid.
+ callHasProperty.link(this);
+ emitGetVirtualRegister(dst, regT1);
+ JITStubCall stubCall(this, cti_has_property);
+ stubCall.addArgument(regT0);
+ stubCall.addArgument(regT1);
+ stubCall.call();
+
+ // Test for valid key.
+ addJump(branchTest32(NonZero, regT0), target);
+ jump().linkTo(begin, this);
+
+ // End of loop.
+ end.link(this);
+}
+
+void JIT::emit_op_push_scope(Instruction* currentInstruction)
+{
+ JITStubCall stubCall(this, cti_op_push_scope);
+ stubCall.addArgument(currentInstruction[1].u.operand, regT2);
+ stubCall.call(currentInstruction[1].u.operand);
+}
+
+void JIT::emit_op_pop_scope(Instruction*)
+{
+ JITStubCall(this, cti_op_pop_scope).call();
+}
+
+void JIT::compileOpStrictEq(Instruction* currentInstruction, CompileOpStrictEqType type)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+ unsigned src1 = currentInstruction[2].u.operand;
+ unsigned src2 = currentInstruction[3].u.operand;
+
+ emitGetVirtualRegisters(src1, regT0, src2, regT1);
+
+ // Jump to a slow case if either operand is a number, or if both are JSCell*s.
+ move(regT0, regT2);
+ orPtr(regT1, regT2);
+ addSlowCase(emitJumpIfJSCell(regT2));
+ addSlowCase(emitJumpIfImmediateNumber(regT2));
+
+ if (type == OpStrictEq)
+ set32Compare32(Equal, regT1, regT0, regT0);
+ else
+ set32Compare32(NotEqual, regT1, regT0, regT0);
+ emitTagAsBoolImmediate(regT0);
+
+ emitPutVirtualRegister(dst);
+}
+
+void JIT::emit_op_stricteq(Instruction* currentInstruction)
+{
+ compileOpStrictEq(currentInstruction, OpStrictEq);
+}
+
+void JIT::emit_op_nstricteq(Instruction* currentInstruction)
+{
+ compileOpStrictEq(currentInstruction, OpNStrictEq);
+}
+
+void JIT::emit_op_to_jsnumber(Instruction* currentInstruction)
+{
+ int srcVReg = currentInstruction[2].u.operand;
+ emitGetVirtualRegister(srcVReg, regT0);
+
+ Jump wasImmediate = emitJumpIfImmediateInteger(regT0);
+
+ emitJumpSlowCaseIfNotJSCell(regT0, srcVReg);
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), regT2);
+ addSlowCase(branch8(NotEqual, Address(regT2, OBJECT_OFFSETOF(Structure, m_typeInfo.m_type)), Imm32(NumberType)));
+
+ wasImmediate.link(this);
+
+ emitPutVirtualRegister(currentInstruction[1].u.operand);
+}
+
+void JIT::emit_op_push_new_scope(Instruction* currentInstruction)
+{
+ JITStubCall stubCall(this, cti_op_push_new_scope);
+ stubCall.addArgument(ImmPtr(&m_codeBlock->identifier(currentInstruction[2].u.operand)));
+ stubCall.addArgument(currentInstruction[3].u.operand, regT2);
+ stubCall.call(currentInstruction[1].u.operand);
+}
+
+void JIT::emit_op_catch(Instruction* currentInstruction)
+{
+ killLastResultRegister(); // FIXME: Implicitly treat op_catch as a labeled statement, and remove this line of code.
+ move(regT0, callFrameRegister);
+ peek(regT3, OBJECT_OFFSETOF(struct JITStackFrame, globalData) / sizeof(void*));
+ loadPtr(Address(regT3, OBJECT_OFFSETOF(JSGlobalData, exception)), regT0);
+ storePtr(ImmPtr(JSValue::encode(JSValue())), Address(regT3, OBJECT_OFFSETOF(JSGlobalData, exception)));
+ emitPutVirtualRegister(currentInstruction[1].u.operand);
+}
+
+void JIT::emit_op_jmp_scopes(Instruction* currentInstruction)
+{
+ JITStubCall stubCall(this, cti_op_jmp_scopes);
+ stubCall.addArgument(Imm32(currentInstruction[1].u.operand));
+ stubCall.call();
+ addJump(jump(), currentInstruction[2].u.operand);
+ RECORD_JUMP_TARGET(currentInstruction[2].u.operand);
+}
+
+void JIT::emit_op_switch_imm(Instruction* currentInstruction)
+{
+ unsigned tableIndex = currentInstruction[1].u.operand;
+ unsigned defaultOffset = currentInstruction[2].u.operand;
+ unsigned scrutinee = currentInstruction[3].u.operand;
+
+ // create jump table for switch destinations, track this switch statement.
+ SimpleJumpTable* jumpTable = &m_codeBlock->immediateSwitchJumpTable(tableIndex);
+ m_switches.append(SwitchRecord(jumpTable, m_bytecodeOffset, defaultOffset, SwitchRecord::Immediate));
+ jumpTable->ctiOffsets.grow(jumpTable->branchOffsets.size());
+
+ JITStubCall stubCall(this, cti_op_switch_imm);
+ stubCall.addArgument(scrutinee, regT2);
+ stubCall.addArgument(Imm32(tableIndex));
+ stubCall.call();
+ jump(regT0);
+}
+
+void JIT::emit_op_switch_char(Instruction* currentInstruction)
+{
+ unsigned tableIndex = currentInstruction[1].u.operand;
+ unsigned defaultOffset = currentInstruction[2].u.operand;
+ unsigned scrutinee = currentInstruction[3].u.operand;
+
+ // create jump table for switch destinations, track this switch statement.
+ SimpleJumpTable* jumpTable = &m_codeBlock->characterSwitchJumpTable(tableIndex);
+ m_switches.append(SwitchRecord(jumpTable, m_bytecodeOffset, defaultOffset, SwitchRecord::Character));
+ jumpTable->ctiOffsets.grow(jumpTable->branchOffsets.size());
+
+ JITStubCall stubCall(this, cti_op_switch_char);
+ stubCall.addArgument(scrutinee, regT2);
+ stubCall.addArgument(Imm32(tableIndex));
+ stubCall.call();
+ jump(regT0);
+}
+
+void JIT::emit_op_switch_string(Instruction* currentInstruction)
+{
+ unsigned tableIndex = currentInstruction[1].u.operand;
+ unsigned defaultOffset = currentInstruction[2].u.operand;
+ unsigned scrutinee = currentInstruction[3].u.operand;
+
+ // create jump table for switch destinations, track this switch statement.
+ StringJumpTable* jumpTable = &m_codeBlock->stringSwitchJumpTable(tableIndex);
+ m_switches.append(SwitchRecord(jumpTable, m_bytecodeOffset, defaultOffset));
+
+ JITStubCall stubCall(this, cti_op_switch_string);
+ stubCall.addArgument(scrutinee, regT2);
+ stubCall.addArgument(Imm32(tableIndex));
+ stubCall.call();
+ jump(regT0);
+}
+
+void JIT::emit_op_throw_reference_error(Instruction* currentInstruction)
+{
+ JITStubCall stubCall(this, cti_op_throw_reference_error);
+ stubCall.addArgument(ImmPtr(JSValue::encode(m_codeBlock->getConstant(currentInstruction[1].u.operand))));
+ stubCall.call();
+}
+
+void JIT::emit_op_throw_syntax_error(Instruction* currentInstruction)
+{
+ JITStubCall stubCall(this, cti_op_throw_syntax_error);
+ stubCall.addArgument(ImmPtr(JSValue::encode(m_codeBlock->getConstant(currentInstruction[1].u.operand))));
+ stubCall.call();
+}
+
+void JIT::emit_op_debug(Instruction* currentInstruction)
+{
+#if ENABLE(DEBUG_WITH_BREAKPOINT)
+ UNUSED_PARAM(currentInstruction);
+ breakpoint();
+#else
+ JITStubCall stubCall(this, cti_op_debug);
+ stubCall.addArgument(Imm32(currentInstruction[1].u.operand));
+ stubCall.addArgument(Imm32(currentInstruction[2].u.operand));
+ stubCall.addArgument(Imm32(currentInstruction[3].u.operand));
+ stubCall.call();
+#endif
+}
+
+void JIT::emit_op_eq_null(Instruction* currentInstruction)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+ unsigned src1 = currentInstruction[2].u.operand;
+
+ emitGetVirtualRegister(src1, regT0);
+ Jump isImmediate = emitJumpIfNotJSCell(regT0);
+
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), regT2);
+ set32Test8(NonZero, Address(regT2, OBJECT_OFFSETOF(Structure, m_typeInfo.m_flags)), Imm32(MasqueradesAsUndefined), regT0);
+
+ Jump wasNotImmediate = jump();
+
+ isImmediate.link(this);
+
+ andPtr(Imm32(~JSImmediate::ExtendedTagBitUndefined), regT0);
+ setPtr(Equal, regT0, Imm32(JSImmediate::FullTagTypeNull), regT0);
+
+ wasNotImmediate.link(this);
+
+ emitTagAsBoolImmediate(regT0);
+ emitPutVirtualRegister(dst);
+
+}
+
+void JIT::emit_op_neq_null(Instruction* currentInstruction)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+ unsigned src1 = currentInstruction[2].u.operand;
+
+ emitGetVirtualRegister(src1, regT0);
+ Jump isImmediate = emitJumpIfNotJSCell(regT0);
+
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), regT2);
+ set32Test8(Zero, Address(regT2, OBJECT_OFFSETOF(Structure, m_typeInfo.m_flags)), Imm32(MasqueradesAsUndefined), regT0);
+
+ Jump wasNotImmediate = jump();
+
+ isImmediate.link(this);
+
+ andPtr(Imm32(~JSImmediate::ExtendedTagBitUndefined), regT0);
+ setPtr(NotEqual, regT0, Imm32(JSImmediate::FullTagTypeNull), regT0);
+
+ wasNotImmediate.link(this);
+
+ emitTagAsBoolImmediate(regT0);
+ emitPutVirtualRegister(dst);
+}
+
+void JIT::emit_op_enter(Instruction*)
+{
+ // Even though CTI doesn't use them, we initialize our constant
+ // registers to zap stale pointers, to avoid unnecessarily prolonging
+ // object lifetime and increasing GC pressure.
+ size_t count = m_codeBlock->m_numVars;
+ for (size_t j = 0; j < count; ++j)
+ emitInitRegister(j);
+
+}
+
+void JIT::emit_op_create_activation(Instruction* currentInstruction)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+
+ Jump activationCreated = branchTestPtr(NonZero, Address(callFrameRegister, sizeof(Register) * dst));
+ JITStubCall(this, cti_op_push_activation).call(currentInstruction[1].u.operand);
+ emitPutVirtualRegister(dst);
+ activationCreated.link(this);
+}
+
+void JIT::emit_op_create_arguments(Instruction* currentInstruction)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+
+ Jump argsCreated = branchTestPtr(NonZero, Address(callFrameRegister, sizeof(Register) * dst));
+ if (m_codeBlock->m_numParameters == 1)
+ JITStubCall(this, cti_op_create_arguments_no_params).call();
+ else
+ JITStubCall(this, cti_op_create_arguments).call();
+ emitPutVirtualRegister(dst);
+ emitPutVirtualRegister(unmodifiedArgumentsRegister(dst));
+ argsCreated.link(this);
+}
+
+void JIT::emit_op_init_lazy_reg(Instruction* currentInstruction)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+
+ storePtr(ImmPtr(0), Address(callFrameRegister, sizeof(Register) * dst));
+}
+
+void JIT::emit_op_convert_this(Instruction* currentInstruction)
+{
+ emitGetVirtualRegister(currentInstruction[1].u.operand, regT0);
+
+ emitJumpSlowCaseIfNotJSCell(regT0);
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), regT1);
+ addSlowCase(branchTest8(NonZero, Address(regT1, OBJECT_OFFSETOF(Structure, m_typeInfo.m_flags)), Imm32(NeedsThisConversion)));
+}
+
+void JIT::emit_op_convert_this_strict(Instruction* currentInstruction)
+{
+ emitGetVirtualRegister(currentInstruction[1].u.operand, regT0);
+ Jump notNull = branchTestPtr(NonZero, regT0);
+ move(ImmPtr(JSValue::encode(jsNull())), regT0);
+ emitPutVirtualRegister(currentInstruction[1].u.operand, regT0);
+ Jump setThis = jump();
+ notNull.link(this);
+ Jump isImmediate = emitJumpIfNotJSCell(regT0);
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), regT1);
+ Jump notAnObject = branch8(NotEqual, Address(regT1, OBJECT_OFFSETOF(Structure, m_typeInfo.m_type)), Imm32(ObjectType));
+ addSlowCase(branchTest8(NonZero, Address(regT1, OBJECT_OFFSETOF(Structure, m_typeInfo.m_flags)), Imm32(NeedsThisConversion)));
+ isImmediate.link(this);
+ notAnObject.link(this);
+ setThis.link(this);
+}
+
+void JIT::emit_op_get_callee(Instruction* currentInstruction)
+{
+ unsigned result = currentInstruction[1].u.operand;
+ emitGetFromCallFrameHeaderPtr(RegisterFile::Callee, regT0);
+ emitPutVirtualRegister(result);
+}
+
+void JIT::emit_op_create_this(Instruction* currentInstruction)
+{
+ JITStubCall stubCall(this, cti_op_create_this);
+ stubCall.addArgument(currentInstruction[2].u.operand, regT1);
+ stubCall.call(currentInstruction[1].u.operand);
+}
+
+void JIT::emit_op_profile_will_call(Instruction* currentInstruction)
+{
+ peek(regT1, OBJECT_OFFSETOF(JITStackFrame, enabledProfilerReference) / sizeof(void*));
+ Jump noProfiler = branchTestPtr(Zero, Address(regT1));
+
+ JITStubCall stubCall(this, cti_op_profile_will_call);
+ stubCall.addArgument(currentInstruction[1].u.operand, regT1);
+ stubCall.call();
+ noProfiler.link(this);
+
+}
+
+void JIT::emit_op_profile_did_call(Instruction* currentInstruction)
+{
+ peek(regT1, OBJECT_OFFSETOF(JITStackFrame, enabledProfilerReference) / sizeof(void*));
+ Jump noProfiler = branchTestPtr(Zero, Address(regT1));
+
+ JITStubCall stubCall(this, cti_op_profile_did_call);
+ stubCall.addArgument(currentInstruction[1].u.operand, regT1);
+ stubCall.call();
+ noProfiler.link(this);
+}
+
+
+// Slow cases
+
+void JIT::emitSlow_op_convert_this(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ linkSlowCase(iter);
+ linkSlowCase(iter);
+ JITStubCall stubCall(this, cti_op_convert_this);
+ stubCall.addArgument(regT0);
+ stubCall.call(currentInstruction[1].u.operand);
+}
+
+void JIT::emitSlow_op_convert_this_strict(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ linkSlowCase(iter);
+ JITStubCall stubCall(this, cti_op_convert_this_strict);
+ stubCall.addArgument(regT0);
+ stubCall.call(currentInstruction[1].u.operand);
+}
+
+void JIT::emitSlow_op_to_primitive(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ linkSlowCase(iter);
+
+ JITStubCall stubCall(this, cti_op_to_primitive);
+ stubCall.addArgument(regT0);
+ stubCall.call(currentInstruction[1].u.operand);
+}
+
+void JIT::emitSlow_op_loop_if_lesseq(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ unsigned op2 = currentInstruction[2].u.operand;
+ unsigned target = currentInstruction[3].u.operand;
+ if (isOperandConstantImmediateInt(op2)) {
+ linkSlowCase(iter);
+ JITStubCall stubCall(this, cti_op_loop_if_lesseq);
+ stubCall.addArgument(regT0);
+ stubCall.addArgument(currentInstruction[2].u.operand, regT2);
+ stubCall.call();
+ emitJumpSlowToHot(branchTest32(NonZero, regT0), target);
+ } else {
+ linkSlowCase(iter);
+ linkSlowCase(iter);
+ JITStubCall stubCall(this, cti_op_loop_if_lesseq);
+ stubCall.addArgument(regT0);
+ stubCall.addArgument(regT1);
+ stubCall.call();
+ emitJumpSlowToHot(branchTest32(NonZero, regT0), target);
+ }
+}
+
+void JIT::emitSlow_op_put_by_val(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ unsigned base = currentInstruction[1].u.operand;
+ unsigned property = currentInstruction[2].u.operand;
+ unsigned value = currentInstruction[3].u.operand;
+
+ linkSlowCase(iter); // property int32 check
+ linkSlowCaseIfNotJSCell(iter, base); // base cell check
+ linkSlowCase(iter); // base not array check
+ linkSlowCase(iter); // in vector check
+
+ JITStubCall stubPutByValCall(this, cti_op_put_by_val);
+ stubPutByValCall.addArgument(regT0);
+ stubPutByValCall.addArgument(property, regT2);
+ stubPutByValCall.addArgument(value, regT2);
+ stubPutByValCall.call();
+}
+
+void JIT::emitSlow_op_not(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ linkSlowCase(iter);
+ xorPtr(Imm32(static_cast<int32_t>(JSImmediate::FullTagTypeBool)), regT0);
+ JITStubCall stubCall(this, cti_op_not);
+ stubCall.addArgument(regT0);
+ stubCall.call(currentInstruction[1].u.operand);
+}
+
+void JIT::emitSlow_op_jfalse(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ linkSlowCase(iter);
+ JITStubCall stubCall(this, cti_op_jtrue);
+ stubCall.addArgument(regT0);
+ stubCall.call();
+ emitJumpSlowToHot(branchTest32(Zero, regT0), currentInstruction[2].u.operand); // inverted!
+}
+
+void JIT::emitSlow_op_bitnot(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ linkSlowCase(iter);
+ JITStubCall stubCall(this, cti_op_bitnot);
+ stubCall.addArgument(regT0);
+ stubCall.call(currentInstruction[1].u.operand);
+}
+
+void JIT::emitSlow_op_jtrue(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ linkSlowCase(iter);
+ JITStubCall stubCall(this, cti_op_jtrue);
+ stubCall.addArgument(regT0);
+ stubCall.call();
+ emitJumpSlowToHot(branchTest32(NonZero, regT0), currentInstruction[2].u.operand);
+}
+
+void JIT::emitSlow_op_bitxor(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ linkSlowCase(iter);
+ JITStubCall stubCall(this, cti_op_bitxor);
+ stubCall.addArgument(regT0);
+ stubCall.addArgument(regT1);
+ stubCall.call(currentInstruction[1].u.operand);
+}
+
+void JIT::emitSlow_op_bitor(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ linkSlowCase(iter);
+ JITStubCall stubCall(this, cti_op_bitor);
+ stubCall.addArgument(regT0);
+ stubCall.addArgument(regT1);
+ stubCall.call(currentInstruction[1].u.operand);
+}
+
+void JIT::emitSlow_op_eq(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ linkSlowCase(iter);
+ JITStubCall stubCall(this, cti_op_eq);
+ stubCall.addArgument(regT0);
+ stubCall.addArgument(regT1);
+ stubCall.call();
+ emitTagAsBoolImmediate(regT0);
+ emitPutVirtualRegister(currentInstruction[1].u.operand);
+}
+
+void JIT::emitSlow_op_neq(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ linkSlowCase(iter);
+ JITStubCall stubCall(this, cti_op_eq);
+ stubCall.addArgument(regT0);
+ stubCall.addArgument(regT1);
+ stubCall.call();
+ xor32(Imm32(0x1), regT0);
+ emitTagAsBoolImmediate(regT0);
+ emitPutVirtualRegister(currentInstruction[1].u.operand);
+}
+
+void JIT::emitSlow_op_stricteq(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ linkSlowCase(iter);
+ linkSlowCase(iter);
+ JITStubCall stubCall(this, cti_op_stricteq);
+ stubCall.addArgument(regT0);
+ stubCall.addArgument(regT1);
+ stubCall.call(currentInstruction[1].u.operand);
+}
+
+void JIT::emitSlow_op_nstricteq(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ linkSlowCase(iter);
+ linkSlowCase(iter);
+ JITStubCall stubCall(this, cti_op_nstricteq);
+ stubCall.addArgument(regT0);
+ stubCall.addArgument(regT1);
+ stubCall.call(currentInstruction[1].u.operand);
+}
+
+void JIT::emitSlow_op_check_has_instance(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ unsigned baseVal = currentInstruction[1].u.operand;
+
+ linkSlowCaseIfNotJSCell(iter, baseVal);
+ linkSlowCase(iter);
+ JITStubCall stubCall(this, cti_op_check_has_instance);
+ stubCall.addArgument(baseVal, regT2);
+ stubCall.call();
+}
+
+void JIT::emitSlow_op_instanceof(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+ unsigned value = currentInstruction[2].u.operand;
+ unsigned baseVal = currentInstruction[3].u.operand;
+ unsigned proto = currentInstruction[4].u.operand;
+
+ linkSlowCaseIfNotJSCell(iter, value);
+ linkSlowCaseIfNotJSCell(iter, proto);
+ linkSlowCase(iter);
+ linkSlowCase(iter);
+ JITStubCall stubCall(this, cti_op_instanceof);
+ stubCall.addArgument(value, regT2);
+ stubCall.addArgument(baseVal, regT2);
+ stubCall.addArgument(proto, regT2);
+ stubCall.call(dst);
+}
+
+void JIT::emitSlow_op_call(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ compileOpCallSlowCase(currentInstruction, iter, m_callLinkInfoIndex++, op_call);
+}
+
+void JIT::emitSlow_op_call_eval(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ compileOpCallSlowCase(currentInstruction, iter, m_callLinkInfoIndex++, op_call_eval);
+}
+
+void JIT::emitSlow_op_call_varargs(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ compileOpCallVarargsSlowCase(currentInstruction, iter);
+}
+
+void JIT::emitSlow_op_construct(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ compileOpCallSlowCase(currentInstruction, iter, m_callLinkInfoIndex++, op_construct);
+}
+
+void JIT::emitSlow_op_to_jsnumber(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ linkSlowCaseIfNotJSCell(iter, currentInstruction[2].u.operand);
+ linkSlowCase(iter);
+
+ JITStubCall stubCall(this, cti_op_to_jsnumber);
+ stubCall.addArgument(regT0);
+ stubCall.call(currentInstruction[1].u.operand);
+}
+
+void JIT::emit_op_get_arguments_length(Instruction* currentInstruction)
+{
+ int dst = currentInstruction[1].u.operand;
+ int argumentsRegister = currentInstruction[2].u.operand;
+ addSlowCase(branchTestPtr(NonZero, addressFor(argumentsRegister)));
+ emitGetFromCallFrameHeader32(RegisterFile::ArgumentCount, regT0);
+ sub32(Imm32(1), regT0);
+ emitFastArithReTagImmediate(regT0, regT0);
+ emitPutVirtualRegister(dst, regT0);
+}
+
+void JIT::emitSlow_op_get_arguments_length(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ linkSlowCase(iter);
+ unsigned dst = currentInstruction[1].u.operand;
+ unsigned base = currentInstruction[2].u.operand;
+ Identifier* ident = &(m_codeBlock->identifier(currentInstruction[3].u.operand));
+
+ emitGetVirtualRegister(base, regT0);
+ JITStubCall stubCall(this, cti_op_get_by_id_generic);
+ stubCall.addArgument(regT0);
+ stubCall.addArgument(ImmPtr(ident));
+ stubCall.call(dst);
+}
+
+void JIT::emit_op_get_argument_by_val(Instruction* currentInstruction)
+{
+ int dst = currentInstruction[1].u.operand;
+ int argumentsRegister = currentInstruction[2].u.operand;
+ int property = currentInstruction[3].u.operand;
+ addSlowCase(branchTestPtr(NonZero, addressFor(argumentsRegister)));
+ emitGetVirtualRegister(property, regT1);
+ addSlowCase(emitJumpIfNotImmediateInteger(regT1));
+ add32(Imm32(1), regT1);
+ // regT1 now contains the integer index of the argument we want, including this
+ emitGetFromCallFrameHeader32(RegisterFile::ArgumentCount, regT2);
+ addSlowCase(branch32(AboveOrEqual, regT1, regT2));
+
+ Jump skipOutofLineParams;
+ int numArgs = m_codeBlock->m_numParameters;
+ if (numArgs) {
+ Jump notInInPlaceArgs = branch32(AboveOrEqual, regT1, Imm32(numArgs));
+ addPtr(Imm32(static_cast<unsigned>(-(RegisterFile::CallFrameHeaderSize + numArgs) * sizeof(Register))), callFrameRegister, regT0);
+ loadPtr(BaseIndex(regT0, regT1, TimesEight, 0), regT0);
+ skipOutofLineParams = jump();
+ notInInPlaceArgs.link(this);
+ }
+
+ addPtr(Imm32(static_cast<unsigned>(-(RegisterFile::CallFrameHeaderSize + numArgs) * sizeof(Register))), callFrameRegister, regT0);
+ mul32(Imm32(sizeof(Register)), regT2, regT2);
+ subPtr(regT2, regT0);
+ loadPtr(BaseIndex(regT0, regT1, TimesEight, 0), regT0);
+ if (numArgs)
+ skipOutofLineParams.link(this);
+ emitPutVirtualRegister(dst, regT0);
+}
+
+void JIT::emitSlow_op_get_argument_by_val(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+ unsigned arguments = currentInstruction[2].u.operand;
+ unsigned property = currentInstruction[3].u.operand;
+
+ linkSlowCase(iter);
+ Jump skipArgumentsCreation = jump();
+
+ linkSlowCase(iter);
+ linkSlowCase(iter);
+ if (m_codeBlock->m_numParameters == 1)
+ JITStubCall(this, cti_op_create_arguments_no_params).call();
+ else
+ JITStubCall(this, cti_op_create_arguments).call();
+ emitPutVirtualRegister(arguments);
+ emitPutVirtualRegister(unmodifiedArgumentsRegister(arguments));
+
+ skipArgumentsCreation.link(this);
+ JITStubCall stubCall(this, cti_op_get_by_val);
+ stubCall.addArgument(arguments, regT2);
+ stubCall.addArgument(property, regT2);
+ stubCall.call(dst);
+}
+
+#endif // USE(JSVALUE64)
+
+void JIT::emit_op_resolve_global_dynamic(Instruction* currentInstruction)
+{
+ int skip = currentInstruction[5].u.operand;
+
+ emitGetFromCallFrameHeaderPtr(RegisterFile::ScopeChain, regT0);
+
+ bool checkTopLevel = m_codeBlock->codeType() == FunctionCode && m_codeBlock->needsFullScopeChain();
+ ASSERT(skip || !checkTopLevel);
+ if (checkTopLevel && skip--) {
+ Jump activationNotCreated;
+ if (checkTopLevel)
+ activationNotCreated = branchTestPtr(Zero, addressFor(m_codeBlock->activationRegister()));
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(ScopeChainNode, object)), regT1);
+ addSlowCase(checkStructure(regT1, m_globalData->activationStructure.get()));
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(ScopeChainNode, next)), regT0);
+ activationNotCreated.link(this);
+ }
+ while (skip--) {
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(ScopeChainNode, object)), regT1);
+ addSlowCase(checkStructure(regT1, m_globalData->activationStructure.get()));
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(ScopeChainNode, next)), regT0);
+ }
+ emit_op_resolve_global(currentInstruction, true);
+}
+
+void JIT::emitSlow_op_resolve_global_dynamic(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+ Identifier* ident = &m_codeBlock->identifier(currentInstruction[2].u.operand);
+ int skip = currentInstruction[5].u.operand;
+ while (skip--)
+ linkSlowCase(iter);
+ JITStubCall resolveStubCall(this, cti_op_resolve);
+ resolveStubCall.addArgument(ImmPtr(ident));
+ resolveStubCall.call(dst);
+ emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_resolve_global_dynamic));
+
+ unsigned currentIndex = m_globalResolveInfoIndex++;
+
+ linkSlowCase(iter); // We managed to skip all the nodes in the scope chain, but the cache missed.
+ JITStubCall stubCall(this, cti_op_resolve_global);
+ stubCall.addArgument(ImmPtr(ident));
+ stubCall.addArgument(Imm32(currentIndex));
+ stubCall.addArgument(regT0);
+ stubCall.call(dst);
+}
+
+void JIT::emit_op_new_regexp(Instruction* currentInstruction)
+{
+ JITStubCall stubCall(this, cti_op_new_regexp);
+ stubCall.addArgument(ImmPtr(m_codeBlock->regexp(currentInstruction[2].u.operand)));
+ stubCall.call(currentInstruction[1].u.operand);
+}
+
+void JIT::emit_op_load_varargs(Instruction* currentInstruction)
+{
+ int argCountDst = currentInstruction[1].u.operand;
+ int argsOffset = currentInstruction[2].u.operand;
+ int registerOffset = currentInstruction[3].u.operand;
+ ASSERT(argsOffset <= registerOffset);
+
+ int expectedParams = m_codeBlock->m_numParameters - 1;
+ // Don't do inline copying if we aren't guaranteed to have a single stream
+ // of arguments
+ if (expectedParams) {
+ JITStubCall stubCall(this, cti_op_load_varargs);
+ stubCall.addArgument(Imm32(argsOffset));
+ stubCall.call();
+ // Stores a naked int32 in the register file.
+ store32(returnValueRegister, Address(callFrameRegister, argCountDst * sizeof(Register)));
+ return;
+ }
+
+#if USE(JSVALUE32_64)
+ addSlowCase(branch32(NotEqual, tagFor(argsOffset), Imm32(JSValue::EmptyValueTag)));
+#else
+ addSlowCase(branchTestPtr(NonZero, addressFor(argsOffset)));
+#endif
+ // Load arg count into regT0
+ emitGetFromCallFrameHeader32(RegisterFile::ArgumentCount, regT0);
+ storePtr(regT0, addressFor(argCountDst));
+ Jump endBranch = branch32(Equal, regT0, Imm32(1));
+
+ mul32(Imm32(sizeof(Register)), regT0, regT3);
+ addPtr(Imm32(static_cast<unsigned>(sizeof(Register) - RegisterFile::CallFrameHeaderSize * sizeof(Register))), callFrameRegister, regT1);
+ subPtr(regT3, regT1); // regT1 is now the start of the out of line arguments
+ addPtr(Imm32(argsOffset * sizeof(Register)), callFrameRegister, regT2); // regT2 is the target buffer
+
+ // Bounds check the registerfile
+ addPtr(regT2, regT3);
+ addPtr(Imm32((registerOffset - argsOffset) * sizeof(Register)), regT3);
+ addSlowCase(branchPtr(Below, AbsoluteAddress(&m_globalData->interpreter->registerFile().m_end), regT3));
+
+ sub32(Imm32(1), regT0);
+ Label loopStart = label();
+ loadPtr(BaseIndex(regT1, regT0, TimesEight, static_cast<unsigned>(0 - 2 * sizeof(Register))), regT3);
+ storePtr(regT3, BaseIndex(regT2, regT0, TimesEight, static_cast<unsigned>(0 - sizeof(Register))));
+#if USE(JSVALUE32_64)
+ loadPtr(BaseIndex(regT1, regT0, TimesEight, static_cast<unsigned>(sizeof(void*) - 2 * sizeof(Register))), regT3);
+ storePtr(regT3, BaseIndex(regT2, regT0, TimesEight, static_cast<unsigned>(sizeof(void*) - sizeof(Register))));
+#endif
+ branchSubPtr(NonZero, Imm32(1), regT0).linkTo(loopStart, this);
+ endBranch.link(this);
+}
+
+void JIT::emitSlow_op_load_varargs(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ int argCountDst = currentInstruction[1].u.operand;
+ int argsOffset = currentInstruction[2].u.operand;
+ int expectedParams = m_codeBlock->m_numParameters - 1;
+ if (expectedParams)
+ return;
+
+ linkSlowCase(iter);
+ linkSlowCase(iter);
+ JITStubCall stubCall(this, cti_op_load_varargs);
+ stubCall.addArgument(Imm32(argsOffset));
+ stubCall.call();
+ // Stores a naked int32 in the register file.
+ store32(returnValueRegister, Address(callFrameRegister, argCountDst * sizeof(Register)));
+}
+
+void JIT::emit_op_new_func(Instruction* currentInstruction)
+{
+ Jump lazyJump;
+ int dst = currentInstruction[1].u.operand;
+ if (currentInstruction[3].u.operand) {
+#if USE(JSVALUE32_64)
+ lazyJump = branch32(NotEqual, tagFor(dst), Imm32(JSValue::EmptyValueTag));
+#else
+ lazyJump = branchTestPtr(NonZero, addressFor(dst));
+#endif
+ }
+ JITStubCall stubCall(this, cti_op_new_func);
+ stubCall.addArgument(ImmPtr(m_codeBlock->functionDecl(currentInstruction[2].u.operand)));
+ stubCall.call(currentInstruction[1].u.operand);
+ if (currentInstruction[3].u.operand)
+ lazyJump.link(this);
+}
+
+} // namespace JSC
+
+#endif // ENABLE(JIT)
diff --git a/Source/JavaScriptCore/jit/JITOpcodes32_64.cpp b/Source/JavaScriptCore/jit/JITOpcodes32_64.cpp
new file mode 100644
index 0000000..5a0aae5
--- /dev/null
+++ b/Source/JavaScriptCore/jit/JITOpcodes32_64.cpp
@@ -0,0 +1,1834 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2010 Patrick Gansterer <paroga@paroga.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if ENABLE(JIT)
+#if USE(JSVALUE32_64)
+#include "JIT.h"
+
+#include "JITInlineMethods.h"
+#include "JITStubCall.h"
+#include "JSArray.h"
+#include "JSCell.h"
+#include "JSFunction.h"
+#include "JSPropertyNameIterator.h"
+#include "LinkBuffer.h"
+
+namespace JSC {
+
+void JIT::privateCompileCTIMachineTrampolines(RefPtr<ExecutablePool>* executablePool, JSGlobalData* globalData, TrampolineStructure *trampolines)
+{
+#if ENABLE(JIT_USE_SOFT_MODULO)
+ Label softModBegin = align();
+ softModulo();
+#endif
+#if ENABLE(JIT_OPTIMIZE_PROPERTY_ACCESS)
+ // (1) This function provides fast property access for string length
+ Label stringLengthBegin = align();
+
+ // regT0 holds payload, regT1 holds tag
+
+ Jump string_failureCases1 = branch32(NotEqual, regT1, Imm32(JSValue::CellTag));
+ Jump string_failureCases2 = branchPtr(NotEqual, Address(regT0), ImmPtr(m_globalData->jsStringVPtr));
+
+ // Checks out okay! - get the length from the Ustring.
+ load32(Address(regT0, OBJECT_OFFSETOF(JSString, m_length)), regT2);
+
+ Jump string_failureCases3 = branch32(Above, regT2, Imm32(INT_MAX));
+ move(regT2, regT0);
+ move(Imm32(JSValue::Int32Tag), regT1);
+
+ ret();
+#endif
+
+ JumpList callLinkFailures;
+ // (2) Trampolines for the slow cases of op_call / op_call_eval / op_construct.
+#if ENABLE(JIT_OPTIMIZE_CALL)
+ // VirtualCallLink Trampoline
+ // regT0 holds callee, regT1 holds argCount. regT2 will hold the FunctionExecutable.
+ Label virtualCallLinkBegin = align();
+ compileOpCallInitializeCallFrame();
+ preserveReturnAddressAfterCall(regT3);
+ emitPutToCallFrameHeader(regT3, RegisterFile::ReturnPC);
+ restoreArgumentReference();
+ Call callLazyLinkCall = call();
+ callLinkFailures.append(branchTestPtr(Zero, regT0));
+ restoreReturnAddressBeforeReturn(regT3);
+ emitGetFromCallFrameHeader32(RegisterFile::ArgumentCount, regT1);
+ jump(regT0);
+
+ // VirtualConstructLink Trampoline
+ // regT0 holds callee, regT1 holds argCount. regT2 will hold the FunctionExecutable.
+ Label virtualConstructLinkBegin = align();
+ compileOpCallInitializeCallFrame();
+ preserveReturnAddressAfterCall(regT3);
+ emitPutToCallFrameHeader(regT3, RegisterFile::ReturnPC);
+ restoreArgumentReference();
+ Call callLazyLinkConstruct = call();
+ restoreReturnAddressBeforeReturn(regT3);
+ callLinkFailures.append(branchTestPtr(Zero, regT0));
+ emitGetFromCallFrameHeader32(RegisterFile::ArgumentCount, regT1);
+ jump(regT0);
+
+#endif // ENABLE(JIT_OPTIMIZE_CALL)
+
+ // VirtualCall Trampoline
+ // regT0 holds callee, regT1 holds argCount. regT2 will hold the FunctionExecutable.
+ Label virtualCallBegin = align();
+ compileOpCallInitializeCallFrame();
+
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_executable)), regT2);
+
+ Jump hasCodeBlock3 = branch32(GreaterThanOrEqual, Address(regT2, OBJECT_OFFSETOF(FunctionExecutable, m_numParametersForCall)), Imm32(0));
+ preserveReturnAddressAfterCall(regT3);
+ restoreArgumentReference();
+ Call callCompileCall = call();
+ callLinkFailures.append(branchTestPtr(Zero, regT0));
+ emitGetFromCallFrameHeader32(RegisterFile::ArgumentCount, regT1);
+ restoreReturnAddressBeforeReturn(regT3);
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_executable)), regT2);
+ hasCodeBlock3.link(this);
+
+ loadPtr(Address(regT2, OBJECT_OFFSETOF(FunctionExecutable, m_jitCodeForCallWithArityCheck)), regT0);
+ jump(regT0);
+
+ // VirtualConstruct Trampoline
+ // regT0 holds callee, regT1 holds argCount. regT2 will hold the FunctionExecutable.
+ Label virtualConstructBegin = align();
+ compileOpCallInitializeCallFrame();
+
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_executable)), regT2);
+
+ Jump hasCodeBlock4 = branch32(GreaterThanOrEqual, Address(regT2, OBJECT_OFFSETOF(FunctionExecutable, m_numParametersForConstruct)), Imm32(0));
+ preserveReturnAddressAfterCall(regT3);
+ restoreArgumentReference();
+ Call callCompileCconstruct = call();
+ callLinkFailures.append(branchTestPtr(Zero, regT0));
+ emitGetFromCallFrameHeader32(RegisterFile::ArgumentCount, regT1);
+ restoreReturnAddressBeforeReturn(regT3);
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_executable)), regT2);
+ hasCodeBlock4.link(this);
+
+ loadPtr(Address(regT2, OBJECT_OFFSETOF(FunctionExecutable, m_jitCodeForConstructWithArityCheck)), regT0);
+ jump(regT0);
+
+ // If the parser fails we want to be able to be able to keep going,
+ // So we handle this as a parse failure.
+ callLinkFailures.link(this);
+ emitGetFromCallFrameHeaderPtr(RegisterFile::ReturnPC, regT1);
+ emitGetFromCallFrameHeaderPtr(RegisterFile::CallerFrame, callFrameRegister);
+ restoreReturnAddressBeforeReturn(regT1);
+ move(ImmPtr(&globalData->exceptionLocation), regT2);
+ storePtr(regT1, regT2);
+ poke(callFrameRegister, 1 + OBJECT_OFFSETOF(struct JITStackFrame, callFrame) / sizeof(void*));
+ poke(ImmPtr(FunctionPtr(ctiVMThrowTrampoline).value()));
+ ret();
+
+ // NativeCall Trampoline
+ Label nativeCallThunk = privateCompileCTINativeCall(globalData);
+ Label nativeConstructThunk = privateCompileCTINativeCall(globalData, true);
+
+#if ENABLE(JIT_OPTIMIZE_PROPERTY_ACCESS)
+ Call string_failureCases1Call = makeTailRecursiveCall(string_failureCases1);
+ Call string_failureCases2Call = makeTailRecursiveCall(string_failureCases2);
+ Call string_failureCases3Call = makeTailRecursiveCall(string_failureCases3);
+#endif
+
+ // All trampolines constructed! copy the code, link up calls, and set the pointers on the Machine object.
+ LinkBuffer patchBuffer(this, m_globalData->executableAllocator.poolForSize(m_assembler.size()), 0);
+
+#if ENABLE(JIT_OPTIMIZE_PROPERTY_ACCESS)
+ patchBuffer.link(string_failureCases1Call, FunctionPtr(cti_op_get_by_id_string_fail));
+ patchBuffer.link(string_failureCases2Call, FunctionPtr(cti_op_get_by_id_string_fail));
+ patchBuffer.link(string_failureCases3Call, FunctionPtr(cti_op_get_by_id_string_fail));
+#endif
+#if ENABLE(JIT_OPTIMIZE_CALL)
+ patchBuffer.link(callLazyLinkCall, FunctionPtr(cti_vm_lazyLinkCall));
+ patchBuffer.link(callLazyLinkConstruct, FunctionPtr(cti_vm_lazyLinkConstruct));
+#endif
+ patchBuffer.link(callCompileCall, FunctionPtr(cti_op_call_jitCompile));
+ patchBuffer.link(callCompileCconstruct, FunctionPtr(cti_op_construct_jitCompile));
+
+ CodeRef finalCode = patchBuffer.finalizeCode();
+ *executablePool = finalCode.m_executablePool;
+
+ trampolines->ctiVirtualCall = patchBuffer.trampolineAt(virtualCallBegin);
+ trampolines->ctiVirtualConstruct = patchBuffer.trampolineAt(virtualConstructBegin);
+ trampolines->ctiNativeCall = patchBuffer.trampolineAt(nativeCallThunk);
+ trampolines->ctiNativeConstruct = patchBuffer.trampolineAt(nativeConstructThunk);
+#if ENABLE(JIT_OPTIMIZE_PROPERTY_ACCESS)
+ trampolines->ctiStringLengthTrampoline = patchBuffer.trampolineAt(stringLengthBegin);
+#endif
+#if ENABLE(JIT_OPTIMIZE_CALL)
+ trampolines->ctiVirtualCallLink = patchBuffer.trampolineAt(virtualCallLinkBegin);
+ trampolines->ctiVirtualConstructLink = patchBuffer.trampolineAt(virtualConstructLinkBegin);
+#endif
+#if ENABLE(JIT_USE_SOFT_MODULO)
+ trampolines->ctiSoftModulo = patchBuffer.trampolineAt(softModBegin);
+#endif
+}
+
+JIT::Label JIT::privateCompileCTINativeCall(JSGlobalData* globalData, bool isConstruct)
+{
+ int executableOffsetToFunction = isConstruct ? OBJECT_OFFSETOF(NativeExecutable, m_constructor) : OBJECT_OFFSETOF(NativeExecutable, m_function);
+
+ Label nativeCallThunk = align();
+
+ emitPutImmediateToCallFrameHeader(0, RegisterFile::CodeBlock);
+
+#if CPU(X86)
+ // Load caller frame's scope chain into this callframe so that whatever we call can
+ // get to its global data.
+ emitGetFromCallFrameHeaderPtr(RegisterFile::CallerFrame, regT0);
+ emitGetFromCallFrameHeaderPtr(RegisterFile::ScopeChain, regT1, regT0);
+ emitPutToCallFrameHeader(regT1, RegisterFile::ScopeChain);
+
+ peek(regT1);
+ emitPutToCallFrameHeader(regT1, RegisterFile::ReturnPC);
+
+ // Calling convention: f(ecx, edx, ...);
+ // Host function signature: f(ExecState*);
+ move(callFrameRegister, X86Registers::ecx);
+
+ subPtr(Imm32(16 - sizeof(void*)), stackPointerRegister); // Align stack after call.
+
+ // call the function
+ emitGetFromCallFrameHeaderPtr(RegisterFile::Callee, regT1);
+ loadPtr(Address(regT1, OBJECT_OFFSETOF(JSFunction, m_executable)), regT1);
+ move(regT0, callFrameRegister); // Eagerly restore caller frame register to avoid loading from stack.
+ call(Address(regT1, executableOffsetToFunction));
+
+ addPtr(Imm32(16 - sizeof(void*)), stackPointerRegister);
+
+#elif CPU(ARM)
+ // Load caller frame's scope chain into this callframe so that whatever we call can
+ // get to its global data.
+ emitGetFromCallFrameHeaderPtr(RegisterFile::CallerFrame, regT2);
+ emitGetFromCallFrameHeaderPtr(RegisterFile::ScopeChain, regT1, regT2);
+ emitPutToCallFrameHeader(regT1, RegisterFile::ScopeChain);
+
+ preserveReturnAddressAfterCall(regT3); // Callee preserved
+ emitPutToCallFrameHeader(regT3, RegisterFile::ReturnPC);
+
+ // Calling convention: f(r0 == regT0, r1 == regT1, ...);
+ // Host function signature: f(ExecState*);
+ move(callFrameRegister, ARMRegisters::r0);
+
+ // call the function
+ emitGetFromCallFrameHeaderPtr(RegisterFile::Callee, ARMRegisters::r1);
+ move(regT2, callFrameRegister); // Eagerly restore caller frame register to avoid loading from stack.
+ loadPtr(Address(ARMRegisters::r1, OBJECT_OFFSETOF(JSFunction, m_executable)), regT2);
+ call(Address(regT2, executableOffsetToFunction));
+
+ restoreReturnAddressBeforeReturn(regT3);
+
+#elif CPU(MIPS)
+ // Load caller frame's scope chain into this callframe so that whatever we call can
+ // get to its global data.
+ emitGetFromCallFrameHeaderPtr(RegisterFile::CallerFrame, regT0);
+ emitGetFromCallFrameHeaderPtr(RegisterFile::ScopeChain, regT1, regT0);
+ emitPutToCallFrameHeader(regT1, RegisterFile::ScopeChain);
+
+ preserveReturnAddressAfterCall(regT3); // Callee preserved
+ emitPutToCallFrameHeader(regT3, RegisterFile::ReturnPC);
+
+ // Calling convention: f(a0, a1, a2, a3);
+ // Host function signature: f(ExecState*);
+
+ // Allocate stack space for 16 bytes (8-byte aligned)
+ // 16 bytes (unused) for 4 arguments
+ subPtr(Imm32(16), stackPointerRegister);
+
+ // Setup arg0
+ move(callFrameRegister, MIPSRegisters::a0);
+
+ // Call
+ emitGetFromCallFrameHeaderPtr(RegisterFile::Callee, MIPSRegisters::a2);
+ loadPtr(Address(MIPSRegisters::a2, OBJECT_OFFSETOF(JSFunction, m_executable)), regT2);
+ move(regT0, callFrameRegister); // Eagerly restore caller frame register to avoid loading from stack.
+ call(Address(regT2, executableOffsetToFunction));
+
+ // Restore stack space
+ addPtr(Imm32(16), stackPointerRegister);
+
+ restoreReturnAddressBeforeReturn(regT3);
+
+#elif ENABLE(JIT_OPTIMIZE_NATIVE_CALL)
+#error "JIT_OPTIMIZE_NATIVE_CALL not yet supported on this platform."
+#else
+ UNUSED_PARAM(executableOffsetToFunction);
+ breakpoint();
+#endif // CPU(X86)
+
+ // Check for an exception
+ Jump sawException = branch32(NotEqual, AbsoluteAddress(reinterpret_cast<char*>(&globalData->exception) + OBJECT_OFFSETOF(JSValue, u.asBits.tag)), Imm32(JSValue::EmptyValueTag));
+
+ // Return.
+ ret();
+
+ // Handle an exception
+ sawException.link(this);
+
+ // Grab the return address.
+ preserveReturnAddressAfterCall(regT1);
+
+ move(ImmPtr(&globalData->exceptionLocation), regT2);
+ storePtr(regT1, regT2);
+ poke(callFrameRegister, OBJECT_OFFSETOF(struct JITStackFrame, callFrame) / sizeof(void*));
+
+ // Set the return address.
+ move(ImmPtr(FunctionPtr(ctiVMThrowTrampoline).value()), regT1);
+ restoreReturnAddressBeforeReturn(regT1);
+
+ ret();
+
+ return nativeCallThunk;
+}
+
+JIT::CodePtr JIT::privateCompileCTINativeCall(PassRefPtr<ExecutablePool> executablePool, JSGlobalData* globalData, NativeFunction func)
+{
+ Call nativeCall;
+ Label nativeCallThunk = align();
+
+ emitPutImmediateToCallFrameHeader(0, RegisterFile::CodeBlock);
+
+#if CPU(X86)
+ // Load caller frame's scope chain into this callframe so that whatever we call can
+ // get to its global data.
+ emitGetFromCallFrameHeaderPtr(RegisterFile::CallerFrame, regT0);
+ emitGetFromCallFrameHeaderPtr(RegisterFile::ScopeChain, regT1, regT0);
+ emitPutToCallFrameHeader(regT1, RegisterFile::ScopeChain);
+
+ peek(regT1);
+ emitPutToCallFrameHeader(regT1, RegisterFile::ReturnPC);
+
+ // Calling convention: f(ecx, edx, ...);
+ // Host function signature: f(ExecState*);
+ move(callFrameRegister, X86Registers::ecx);
+
+ subPtr(Imm32(16 - sizeof(void*)), stackPointerRegister); // Align stack after call.
+
+ move(regT0, callFrameRegister); // Eagerly restore caller frame register to avoid loading from stack.
+
+ // call the function
+ nativeCall = call();
+
+ addPtr(Imm32(16 - sizeof(void*)), stackPointerRegister);
+
+#elif CPU(ARM)
+ // Load caller frame's scope chain into this callframe so that whatever we call can
+ // get to its global data.
+ emitGetFromCallFrameHeaderPtr(RegisterFile::CallerFrame, regT2);
+ emitGetFromCallFrameHeaderPtr(RegisterFile::ScopeChain, regT1, regT2);
+ emitPutToCallFrameHeader(regT1, RegisterFile::ScopeChain);
+
+ preserveReturnAddressAfterCall(regT3); // Callee preserved
+ emitPutToCallFrameHeader(regT3, RegisterFile::ReturnPC);
+
+ // Calling convention: f(r0 == regT0, r1 == regT1, ...);
+ // Host function signature: f(ExecState*);
+ move(callFrameRegister, ARMRegisters::r0);
+
+ emitGetFromCallFrameHeaderPtr(RegisterFile::Callee, ARMRegisters::r1);
+ move(regT2, callFrameRegister); // Eagerly restore caller frame register to avoid loading from stack.
+ loadPtr(Address(ARMRegisters::r1, OBJECT_OFFSETOF(JSFunction, m_executable)), regT2);
+
+ // call the function
+ nativeCall = call();
+
+ restoreReturnAddressBeforeReturn(regT3);
+
+#elif CPU(MIPS)
+ // Load caller frame's scope chain into this callframe so that whatever we call can
+ // get to its global data.
+ emitGetFromCallFrameHeaderPtr(RegisterFile::CallerFrame, regT0);
+ emitGetFromCallFrameHeaderPtr(RegisterFile::ScopeChain, regT1, regT0);
+ emitPutToCallFrameHeader(regT1, RegisterFile::ScopeChain);
+
+ preserveReturnAddressAfterCall(regT3); // Callee preserved
+ emitPutToCallFrameHeader(regT3, RegisterFile::ReturnPC);
+
+ // Calling convention: f(a0, a1, a2, a3);
+ // Host function signature: f(ExecState*);
+
+ // Allocate stack space for 16 bytes (8-byte aligned)
+ // 16 bytes (unused) for 4 arguments
+ subPtr(Imm32(16), stackPointerRegister);
+
+ // Setup arg0
+ move(callFrameRegister, MIPSRegisters::a0);
+
+ // Call
+ emitGetFromCallFrameHeaderPtr(RegisterFile::Callee, MIPSRegisters::a2);
+ loadPtr(Address(MIPSRegisters::a2, OBJECT_OFFSETOF(JSFunction, m_executable)), regT2);
+ move(regT0, callFrameRegister); // Eagerly restore caller frame register to avoid loading from stack.
+
+ // call the function
+ nativeCall = call();
+
+ // Restore stack space
+ addPtr(Imm32(16), stackPointerRegister);
+
+ restoreReturnAddressBeforeReturn(regT3);
+
+#elif ENABLE(JIT_OPTIMIZE_NATIVE_CALL)
+#error "JIT_OPTIMIZE_NATIVE_CALL not yet supported on this platform."
+#else
+ breakpoint();
+#endif // CPU(X86)
+
+ // Check for an exception
+ Jump sawException = branch32(NotEqual, AbsoluteAddress(reinterpret_cast<char*>(&globalData->exception) + OBJECT_OFFSETOF(JSValue, u.asBits.tag)), Imm32(JSValue::EmptyValueTag));
+
+ // Return.
+ ret();
+
+ // Handle an exception
+ sawException.link(this);
+
+ // Grab the return address.
+ preserveReturnAddressAfterCall(regT1);
+
+ move(ImmPtr(&globalData->exceptionLocation), regT2);
+ storePtr(regT1, regT2);
+ poke(callFrameRegister, OBJECT_OFFSETOF(struct JITStackFrame, callFrame) / sizeof(void*));
+
+ // Set the return address.
+ move(ImmPtr(FunctionPtr(ctiVMThrowTrampoline).value()), regT1);
+ restoreReturnAddressBeforeReturn(regT1);
+
+ ret();
+
+ // All trampolines constructed! copy the code, link up calls, and set the pointers on the Machine object.
+ LinkBuffer patchBuffer(this, executablePool, 0);
+
+ patchBuffer.link(nativeCall, FunctionPtr(func));
+ patchBuffer.finalizeCode();
+
+ return patchBuffer.trampolineAt(nativeCallThunk);
+}
+
+void JIT::emit_op_mov(Instruction* currentInstruction)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+ unsigned src = currentInstruction[2].u.operand;
+
+ if (m_codeBlock->isConstantRegisterIndex(src))
+ emitStore(dst, getConstantOperand(src));
+ else {
+ emitLoad(src, regT1, regT0);
+ emitStore(dst, regT1, regT0);
+ map(m_bytecodeOffset + OPCODE_LENGTH(op_mov), dst, regT1, regT0);
+ }
+}
+
+void JIT::emit_op_end(Instruction* currentInstruction)
+{
+ if (m_codeBlock->needsFullScopeChain())
+ JITStubCall(this, cti_op_end).call();
+ ASSERT(returnValueRegister != callFrameRegister);
+ emitLoad(currentInstruction[1].u.operand, regT1, regT0);
+ restoreReturnAddressBeforeReturn(Address(callFrameRegister, RegisterFile::ReturnPC * static_cast<int>(sizeof(Register))));
+ ret();
+}
+
+void JIT::emit_op_jmp(Instruction* currentInstruction)
+{
+ unsigned target = currentInstruction[1].u.operand;
+ addJump(jump(), target);
+}
+
+void JIT::emit_op_loop_if_lesseq(Instruction* currentInstruction)
+{
+ unsigned op1 = currentInstruction[1].u.operand;
+ unsigned op2 = currentInstruction[2].u.operand;
+ unsigned target = currentInstruction[3].u.operand;
+
+ emitTimeoutCheck();
+
+ if (isOperandConstantImmediateInt(op1)) {
+ emitLoad(op2, regT1, regT0);
+ addSlowCase(branch32(NotEqual, regT1, Imm32(JSValue::Int32Tag)));
+ addJump(branch32(GreaterThanOrEqual, regT0, Imm32(getConstantOperand(op1).asInt32())), target);
+ return;
+ }
+
+ if (isOperandConstantImmediateInt(op2)) {
+ emitLoad(op1, regT1, regT0);
+ addSlowCase(branch32(NotEqual, regT1, Imm32(JSValue::Int32Tag)));
+ addJump(branch32(LessThanOrEqual, regT0, Imm32(getConstantOperand(op2).asInt32())), target);
+ return;
+ }
+
+ emitLoad2(op1, regT1, regT0, op2, regT3, regT2);
+ addSlowCase(branch32(NotEqual, regT1, Imm32(JSValue::Int32Tag)));
+ addSlowCase(branch32(NotEqual, regT3, Imm32(JSValue::Int32Tag)));
+ addJump(branch32(LessThanOrEqual, regT0, regT2), target);
+}
+
+void JIT::emitSlow_op_loop_if_lesseq(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ unsigned op1 = currentInstruction[1].u.operand;
+ unsigned op2 = currentInstruction[2].u.operand;
+ unsigned target = currentInstruction[3].u.operand;
+
+ if (!isOperandConstantImmediateInt(op1) && !isOperandConstantImmediateInt(op2))
+ linkSlowCase(iter); // int32 check
+ linkSlowCase(iter); // int32 check
+
+ JITStubCall stubCall(this, cti_op_loop_if_lesseq);
+ stubCall.addArgument(op1);
+ stubCall.addArgument(op2);
+ stubCall.call();
+ emitJumpSlowToHot(branchTest32(NonZero, regT0), target);
+}
+
+void JIT::emit_op_new_object(Instruction* currentInstruction)
+{
+ JITStubCall(this, cti_op_new_object).call(currentInstruction[1].u.operand);
+}
+
+void JIT::emit_op_check_has_instance(Instruction* currentInstruction)
+{
+ unsigned baseVal = currentInstruction[1].u.operand;
+
+ emitLoadPayload(baseVal, regT0);
+
+ // Check that baseVal is a cell.
+ emitJumpSlowCaseIfNotJSCell(baseVal);
+
+ // Check that baseVal 'ImplementsHasInstance'.
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), regT0);
+ addSlowCase(branchTest8(Zero, Address(regT0, OBJECT_OFFSETOF(Structure, m_typeInfo.m_flags)), Imm32(ImplementsHasInstance)));
+}
+
+void JIT::emit_op_instanceof(Instruction* currentInstruction)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+ unsigned value = currentInstruction[2].u.operand;
+ unsigned baseVal = currentInstruction[3].u.operand;
+ unsigned proto = currentInstruction[4].u.operand;
+
+ // Load the operands into registers.
+ // We use regT0 for baseVal since we will be done with this first, and we can then use it for the result.
+ emitLoadPayload(value, regT2);
+ emitLoadPayload(baseVal, regT0);
+ emitLoadPayload(proto, regT1);
+
+ // Check that proto are cells. baseVal must be a cell - this is checked by op_check_has_instance.
+ emitJumpSlowCaseIfNotJSCell(value);
+ emitJumpSlowCaseIfNotJSCell(proto);
+
+ // Check that prototype is an object
+ loadPtr(Address(regT1, OBJECT_OFFSETOF(JSCell, m_structure)), regT3);
+ addSlowCase(branch8(NotEqual, Address(regT3, OBJECT_OFFSETOF(Structure, m_typeInfo.m_type)), Imm32(ObjectType)));
+
+ // Fixme: this check is only needed because the JSC API allows HasInstance to be overridden; we should deprecate this.
+ // Check that baseVal 'ImplementsDefaultHasInstance'.
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), regT0);
+ addSlowCase(branchTest8(Zero, Address(regT0, OBJECT_OFFSETOF(Structure, m_typeInfo.m_flags)), Imm32(ImplementsDefaultHasInstance)));
+
+ // Optimistically load the result true, and start looping.
+ // Initially, regT1 still contains proto and regT2 still contains value.
+ // As we loop regT2 will be updated with its prototype, recursively walking the prototype chain.
+ move(Imm32(JSValue::TrueTag), regT0);
+ Label loop(this);
+
+ // Load the prototype of the cell in regT2. If this is equal to regT1 - WIN!
+ // Otherwise, check if we've hit null - if we have then drop out of the loop, if not go again.
+ loadPtr(Address(regT2, OBJECT_OFFSETOF(JSCell, m_structure)), regT2);
+ load32(Address(regT2, OBJECT_OFFSETOF(Structure, m_prototype) + OBJECT_OFFSETOF(JSValue, u.asBits.payload)), regT2);
+ Jump isInstance = branchPtr(Equal, regT2, regT1);
+ branchTest32(NonZero, regT2).linkTo(loop, this);
+
+ // We get here either by dropping out of the loop, or if value was not an Object. Result is false.
+ move(Imm32(JSValue::FalseTag), regT0);
+
+ // isInstance jumps right down to here, to skip setting the result to false (it has already set true).
+ isInstance.link(this);
+ emitStoreBool(dst, regT0);
+}
+
+void JIT::emitSlow_op_check_has_instance(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ unsigned baseVal = currentInstruction[1].u.operand;
+
+ linkSlowCaseIfNotJSCell(iter, baseVal);
+ linkSlowCase(iter);
+
+ JITStubCall stubCall(this, cti_op_check_has_instance);
+ stubCall.addArgument(baseVal);
+ stubCall.call();
+}
+
+void JIT::emitSlow_op_instanceof(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+ unsigned value = currentInstruction[2].u.operand;
+ unsigned baseVal = currentInstruction[3].u.operand;
+ unsigned proto = currentInstruction[4].u.operand;
+
+ linkSlowCaseIfNotJSCell(iter, value);
+ linkSlowCaseIfNotJSCell(iter, proto);
+ linkSlowCase(iter);
+ linkSlowCase(iter);
+
+ JITStubCall stubCall(this, cti_op_instanceof);
+ stubCall.addArgument(value);
+ stubCall.addArgument(baseVal);
+ stubCall.addArgument(proto);
+ stubCall.call(dst);
+}
+
+void JIT::emit_op_get_global_var(Instruction* currentInstruction)
+{
+ int dst = currentInstruction[1].u.operand;
+ JSGlobalObject* globalObject = m_codeBlock->globalObject();
+ ASSERT(globalObject->isGlobalObject());
+ int index = currentInstruction[2].u.operand;
+
+ loadPtr(&globalObject->d()->registers, regT2);
+
+ emitLoad(index, regT1, regT0, regT2);
+ emitStore(dst, regT1, regT0);
+ map(m_bytecodeOffset + OPCODE_LENGTH(op_get_global_var), dst, regT1, regT0);
+}
+
+void JIT::emit_op_put_global_var(Instruction* currentInstruction)
+{
+ JSGlobalObject* globalObject = m_codeBlock->globalObject();
+ ASSERT(globalObject->isGlobalObject());
+ int index = currentInstruction[1].u.operand;
+ int value = currentInstruction[2].u.operand;
+
+ emitLoad(value, regT1, regT0);
+
+ loadPtr(&globalObject->d()->registers, regT2);
+ emitStore(index, regT1, regT0, regT2);
+ map(m_bytecodeOffset + OPCODE_LENGTH(op_put_global_var), value, regT1, regT0);
+}
+
+void JIT::emit_op_get_scoped_var(Instruction* currentInstruction)
+{
+ int dst = currentInstruction[1].u.operand;
+ int index = currentInstruction[2].u.operand;
+ int skip = currentInstruction[3].u.operand;
+
+ emitGetFromCallFrameHeaderPtr(RegisterFile::ScopeChain, regT2);
+ bool checkTopLevel = m_codeBlock->codeType() == FunctionCode && m_codeBlock->needsFullScopeChain();
+ ASSERT(skip || !checkTopLevel);
+ if (checkTopLevel && skip--) {
+ Jump activationNotCreated;
+ if (checkTopLevel)
+ activationNotCreated = branch32(Equal, tagFor(m_codeBlock->activationRegister()), Imm32(JSValue::EmptyValueTag));
+ loadPtr(Address(regT2, OBJECT_OFFSETOF(ScopeChainNode, next)), regT2);
+ activationNotCreated.link(this);
+ }
+ while (skip--)
+ loadPtr(Address(regT2, OBJECT_OFFSETOF(ScopeChainNode, next)), regT2);
+
+ loadPtr(Address(regT2, OBJECT_OFFSETOF(ScopeChainNode, object)), regT2);
+ loadPtr(Address(regT2, OBJECT_OFFSETOF(JSVariableObject, d)), regT2);
+ loadPtr(Address(regT2, OBJECT_OFFSETOF(JSVariableObject::JSVariableObjectData, registers)), regT2);
+
+ emitLoad(index, regT1, regT0, regT2);
+ emitStore(dst, regT1, regT0);
+ map(m_bytecodeOffset + OPCODE_LENGTH(op_get_scoped_var), dst, regT1, regT0);
+}
+
+void JIT::emit_op_put_scoped_var(Instruction* currentInstruction)
+{
+ int index = currentInstruction[1].u.operand;
+ int skip = currentInstruction[2].u.operand;
+ int value = currentInstruction[3].u.operand;
+
+ emitLoad(value, regT1, regT0);
+
+ emitGetFromCallFrameHeaderPtr(RegisterFile::ScopeChain, regT2);
+ bool checkTopLevel = m_codeBlock->codeType() == FunctionCode && m_codeBlock->needsFullScopeChain();
+ ASSERT(skip || !checkTopLevel);
+ if (checkTopLevel && skip--) {
+ Jump activationNotCreated;
+ if (checkTopLevel)
+ activationNotCreated = branch32(Equal, tagFor(m_codeBlock->activationRegister()), Imm32(JSValue::EmptyValueTag));
+ loadPtr(Address(regT2, OBJECT_OFFSETOF(ScopeChainNode, next)), regT2);
+ activationNotCreated.link(this);
+ }
+ while (skip--)
+ loadPtr(Address(regT2, OBJECT_OFFSETOF(ScopeChainNode, next)), regT2);
+
+ loadPtr(Address(regT2, OBJECT_OFFSETOF(ScopeChainNode, object)), regT2);
+ loadPtr(Address(regT2, OBJECT_OFFSETOF(JSVariableObject, d)), regT2);
+ loadPtr(Address(regT2, OBJECT_OFFSETOF(JSVariableObject::JSVariableObjectData, registers)), regT2);
+
+ emitStore(index, regT1, regT0, regT2);
+ map(m_bytecodeOffset + OPCODE_LENGTH(op_put_scoped_var), value, regT1, regT0);
+}
+
+void JIT::emit_op_tear_off_activation(Instruction* currentInstruction)
+{
+ unsigned activation = currentInstruction[1].u.operand;
+ unsigned arguments = currentInstruction[2].u.operand;
+ Jump activationCreated = branch32(NotEqual, tagFor(activation), Imm32(JSValue::EmptyValueTag));
+ Jump argumentsNotCreated = branch32(Equal, tagFor(arguments), Imm32(JSValue::EmptyValueTag));
+ activationCreated.link(this);
+ JITStubCall stubCall(this, cti_op_tear_off_activation);
+ stubCall.addArgument(currentInstruction[1].u.operand);
+ stubCall.addArgument(unmodifiedArgumentsRegister(currentInstruction[2].u.operand));
+ stubCall.call();
+ argumentsNotCreated.link(this);
+}
+
+void JIT::emit_op_tear_off_arguments(Instruction* currentInstruction)
+{
+ int dst = currentInstruction[1].u.operand;
+
+ Jump argsNotCreated = branch32(Equal, tagFor(unmodifiedArgumentsRegister(dst)), Imm32(JSValue::EmptyValueTag));
+ JITStubCall stubCall(this, cti_op_tear_off_arguments);
+ stubCall.addArgument(unmodifiedArgumentsRegister(dst));
+ stubCall.call();
+ argsNotCreated.link(this);
+}
+
+void JIT::emit_op_new_array(Instruction* currentInstruction)
+{
+ JITStubCall stubCall(this, cti_op_new_array);
+ stubCall.addArgument(Imm32(currentInstruction[2].u.operand));
+ stubCall.addArgument(Imm32(currentInstruction[3].u.operand));
+ stubCall.call(currentInstruction[1].u.operand);
+}
+
+void JIT::emit_op_resolve(Instruction* currentInstruction)
+{
+ JITStubCall stubCall(this, cti_op_resolve);
+ stubCall.addArgument(ImmPtr(&m_codeBlock->identifier(currentInstruction[2].u.operand)));
+ stubCall.call(currentInstruction[1].u.operand);
+}
+
+void JIT::emit_op_to_primitive(Instruction* currentInstruction)
+{
+ int dst = currentInstruction[1].u.operand;
+ int src = currentInstruction[2].u.operand;
+
+ emitLoad(src, regT1, regT0);
+
+ Jump isImm = branch32(NotEqual, regT1, Imm32(JSValue::CellTag));
+ addSlowCase(branchPtr(NotEqual, Address(regT0), ImmPtr(m_globalData->jsStringVPtr)));
+ isImm.link(this);
+
+ if (dst != src)
+ emitStore(dst, regT1, regT0);
+ map(m_bytecodeOffset + OPCODE_LENGTH(op_to_primitive), dst, regT1, regT0);
+}
+
+void JIT::emitSlow_op_to_primitive(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ int dst = currentInstruction[1].u.operand;
+
+ linkSlowCase(iter);
+
+ JITStubCall stubCall(this, cti_op_to_primitive);
+ stubCall.addArgument(regT1, regT0);
+ stubCall.call(dst);
+}
+
+void JIT::emit_op_strcat(Instruction* currentInstruction)
+{
+ JITStubCall stubCall(this, cti_op_strcat);
+ stubCall.addArgument(Imm32(currentInstruction[2].u.operand));
+ stubCall.addArgument(Imm32(currentInstruction[3].u.operand));
+ stubCall.call(currentInstruction[1].u.operand);
+}
+
+void JIT::emit_op_resolve_base(Instruction* currentInstruction)
+{
+ JITStubCall stubCall(this, currentInstruction[3].u.operand ? cti_op_resolve_base_strict_put : cti_op_resolve_base);
+ stubCall.addArgument(ImmPtr(&m_codeBlock->identifier(currentInstruction[2].u.operand)));
+ stubCall.call(currentInstruction[1].u.operand);
+}
+
+void JIT::emit_op_ensure_property_exists(Instruction* currentInstruction)
+{
+ JITStubCall stubCall(this, cti_op_ensure_property_exists);
+ stubCall.addArgument(Imm32(currentInstruction[1].u.operand));
+ stubCall.addArgument(ImmPtr(&m_codeBlock->identifier(currentInstruction[2].u.operand)));
+ stubCall.call(currentInstruction[1].u.operand);
+}
+
+void JIT::emit_op_resolve_skip(Instruction* currentInstruction)
+{
+ JITStubCall stubCall(this, cti_op_resolve_skip);
+ stubCall.addArgument(ImmPtr(&m_codeBlock->identifier(currentInstruction[2].u.operand)));
+ stubCall.addArgument(Imm32(currentInstruction[3].u.operand));
+ stubCall.call(currentInstruction[1].u.operand);
+}
+
+void JIT::emit_op_resolve_global(Instruction* currentInstruction, bool dynamic)
+{
+ // FIXME: Optimize to use patching instead of so many memory accesses.
+
+ unsigned dst = currentInstruction[1].u.operand;
+ void* globalObject = m_codeBlock->globalObject();
+
+ unsigned currentIndex = m_globalResolveInfoIndex++;
+ void* structureAddress = &(m_codeBlock->globalResolveInfo(currentIndex).structure);
+ void* offsetAddr = &(m_codeBlock->globalResolveInfo(currentIndex).offset);
+
+ // Verify structure.
+ move(ImmPtr(globalObject), regT0);
+ loadPtr(structureAddress, regT1);
+ addSlowCase(branchPtr(NotEqual, regT1, Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure))));
+
+ // Load property.
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(JSGlobalObject, m_externalStorage)), regT2);
+ load32(offsetAddr, regT3);
+ load32(BaseIndex(regT2, regT3, TimesEight, OBJECT_OFFSETOF(JSValue, u.asBits.payload)), regT0); // payload
+ load32(BaseIndex(regT2, regT3, TimesEight, OBJECT_OFFSETOF(JSValue, u.asBits.tag)), regT1); // tag
+ emitStore(dst, regT1, regT0);
+ map(m_bytecodeOffset + dynamic ? OPCODE_LENGTH(op_resolve_global_dynamic) : OPCODE_LENGTH(op_resolve_global), dst, regT1, regT0);
+}
+
+void JIT::emitSlow_op_resolve_global(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+ Identifier* ident = &m_codeBlock->identifier(currentInstruction[2].u.operand);
+
+ unsigned currentIndex = m_globalResolveInfoIndex++;
+
+ linkSlowCase(iter);
+ JITStubCall stubCall(this, cti_op_resolve_global);
+ stubCall.addArgument(ImmPtr(ident));
+ stubCall.addArgument(Imm32(currentIndex));
+ stubCall.call(dst);
+}
+
+void JIT::emit_op_not(Instruction* currentInstruction)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+ unsigned src = currentInstruction[2].u.operand;
+
+ emitLoadTag(src, regT0);
+
+ xor32(Imm32(JSValue::FalseTag), regT0);
+ addSlowCase(branchTest32(NonZero, regT0, Imm32(~1)));
+ xor32(Imm32(JSValue::TrueTag), regT0);
+
+ emitStoreBool(dst, regT0, (dst == src));
+}
+
+void JIT::emitSlow_op_not(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+ unsigned src = currentInstruction[2].u.operand;
+
+ linkSlowCase(iter);
+
+ JITStubCall stubCall(this, cti_op_not);
+ stubCall.addArgument(src);
+ stubCall.call(dst);
+}
+
+void JIT::emit_op_jfalse(Instruction* currentInstruction)
+{
+ unsigned cond = currentInstruction[1].u.operand;
+ unsigned target = currentInstruction[2].u.operand;
+
+ emitLoad(cond, regT1, regT0);
+
+ Jump isTrue = branch32(Equal, regT1, Imm32(JSValue::TrueTag));
+ addJump(branch32(Equal, regT1, Imm32(JSValue::FalseTag)), target);
+
+ Jump isNotInteger = branch32(NotEqual, regT1, Imm32(JSValue::Int32Tag));
+ Jump isTrue2 = branch32(NotEqual, regT0, Imm32(0));
+ addJump(jump(), target);
+
+ if (supportsFloatingPoint()) {
+ isNotInteger.link(this);
+
+ addSlowCase(branch32(Above, regT1, Imm32(JSValue::LowestTag)));
+
+ emitLoadDouble(cond, fpRegT0);
+ addJump(branchDoubleZeroOrNaN(fpRegT0, fpRegT1), target);
+ } else
+ addSlowCase(isNotInteger);
+
+ isTrue.link(this);
+ isTrue2.link(this);
+}
+
+void JIT::emitSlow_op_jfalse(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ unsigned cond = currentInstruction[1].u.operand;
+ unsigned target = currentInstruction[2].u.operand;
+
+ linkSlowCase(iter);
+ JITStubCall stubCall(this, cti_op_jtrue);
+ stubCall.addArgument(cond);
+ stubCall.call();
+ emitJumpSlowToHot(branchTest32(Zero, regT0), target); // Inverted.
+}
+
+void JIT::emit_op_jtrue(Instruction* currentInstruction)
+{
+ unsigned cond = currentInstruction[1].u.operand;
+ unsigned target = currentInstruction[2].u.operand;
+
+ emitLoad(cond, regT1, regT0);
+
+ Jump isFalse = branch32(Equal, regT1, Imm32(JSValue::FalseTag));
+ addJump(branch32(Equal, regT1, Imm32(JSValue::TrueTag)), target);
+
+ Jump isNotInteger = branch32(NotEqual, regT1, Imm32(JSValue::Int32Tag));
+ Jump isFalse2 = branch32(Equal, regT0, Imm32(0));
+ addJump(jump(), target);
+
+ if (supportsFloatingPoint()) {
+ isNotInteger.link(this);
+
+ addSlowCase(branch32(Above, regT1, Imm32(JSValue::LowestTag)));
+
+ emitLoadDouble(cond, fpRegT0);
+ addJump(branchDoubleNonZero(fpRegT0, fpRegT1), target);
+ } else
+ addSlowCase(isNotInteger);
+
+ isFalse.link(this);
+ isFalse2.link(this);
+}
+
+void JIT::emitSlow_op_jtrue(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ unsigned cond = currentInstruction[1].u.operand;
+ unsigned target = currentInstruction[2].u.operand;
+
+ linkSlowCase(iter);
+ JITStubCall stubCall(this, cti_op_jtrue);
+ stubCall.addArgument(cond);
+ stubCall.call();
+ emitJumpSlowToHot(branchTest32(NonZero, regT0), target);
+}
+
+void JIT::emit_op_jeq_null(Instruction* currentInstruction)
+{
+ unsigned src = currentInstruction[1].u.operand;
+ unsigned target = currentInstruction[2].u.operand;
+
+ emitLoad(src, regT1, regT0);
+
+ Jump isImmediate = branch32(NotEqual, regT1, Imm32(JSValue::CellTag));
+
+ // First, handle JSCell cases - check MasqueradesAsUndefined bit on the structure.
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), regT2);
+ addJump(branchTest8(NonZero, Address(regT2, OBJECT_OFFSETOF(Structure, m_typeInfo.m_flags)), Imm32(MasqueradesAsUndefined)), target);
+
+ Jump wasNotImmediate = jump();
+
+ // Now handle the immediate cases - undefined & null
+ isImmediate.link(this);
+
+ ASSERT((JSValue::UndefinedTag + 1 == JSValue::NullTag) && !(JSValue::NullTag + 1));
+ addJump(branch32(AboveOrEqual, regT1, Imm32(JSValue::UndefinedTag)), target);
+
+ wasNotImmediate.link(this);
+}
+
+void JIT::emit_op_jneq_null(Instruction* currentInstruction)
+{
+ unsigned src = currentInstruction[1].u.operand;
+ unsigned target = currentInstruction[2].u.operand;
+
+ emitLoad(src, regT1, regT0);
+
+ Jump isImmediate = branch32(NotEqual, regT1, Imm32(JSValue::CellTag));
+
+ // First, handle JSCell cases - check MasqueradesAsUndefined bit on the structure.
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), regT2);
+ addJump(branchTest8(Zero, Address(regT2, OBJECT_OFFSETOF(Structure, m_typeInfo.m_flags)), Imm32(MasqueradesAsUndefined)), target);
+
+ Jump wasNotImmediate = jump();
+
+ // Now handle the immediate cases - undefined & null
+ isImmediate.link(this);
+
+ ASSERT((JSValue::UndefinedTag + 1 == JSValue::NullTag) && !(JSValue::NullTag + 1));
+ addJump(branch32(Below, regT1, Imm32(JSValue::UndefinedTag)), target);
+
+ wasNotImmediate.link(this);
+}
+
+void JIT::emit_op_jneq_ptr(Instruction* currentInstruction)
+{
+ unsigned src = currentInstruction[1].u.operand;
+ JSCell* ptr = currentInstruction[2].u.jsCell;
+ unsigned target = currentInstruction[3].u.operand;
+
+ emitLoad(src, regT1, regT0);
+ addJump(branch32(NotEqual, regT1, Imm32(JSValue::CellTag)), target);
+ addJump(branchPtr(NotEqual, regT0, ImmPtr(ptr)), target);
+}
+
+void JIT::emit_op_jsr(Instruction* currentInstruction)
+{
+ int retAddrDst = currentInstruction[1].u.operand;
+ int target = currentInstruction[2].u.operand;
+ DataLabelPtr storeLocation = storePtrWithPatch(ImmPtr(0), Address(callFrameRegister, sizeof(Register) * retAddrDst));
+ addJump(jump(), target);
+ m_jsrSites.append(JSRInfo(storeLocation, label()));
+}
+
+void JIT::emit_op_sret(Instruction* currentInstruction)
+{
+ jump(Address(callFrameRegister, sizeof(Register) * currentInstruction[1].u.operand));
+}
+
+void JIT::emit_op_eq(Instruction* currentInstruction)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+ unsigned src1 = currentInstruction[2].u.operand;
+ unsigned src2 = currentInstruction[3].u.operand;
+
+ emitLoad2(src1, regT1, regT0, src2, regT3, regT2);
+ addSlowCase(branch32(NotEqual, regT1, regT3));
+ addSlowCase(branch32(Equal, regT1, Imm32(JSValue::CellTag)));
+ addSlowCase(branch32(Below, regT1, Imm32(JSValue::LowestTag)));
+
+ set8Compare32(Equal, regT0, regT2, regT0);
+ or32(Imm32(JSValue::FalseTag), regT0);
+
+ emitStoreBool(dst, regT0);
+}
+
+void JIT::emitSlow_op_eq(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+ unsigned op1 = currentInstruction[2].u.operand;
+ unsigned op2 = currentInstruction[3].u.operand;
+
+ JumpList storeResult;
+ JumpList genericCase;
+
+ genericCase.append(getSlowCase(iter)); // tags not equal
+
+ linkSlowCase(iter); // tags equal and JSCell
+ genericCase.append(branchPtr(NotEqual, Address(regT0), ImmPtr(m_globalData->jsStringVPtr)));
+ genericCase.append(branchPtr(NotEqual, Address(regT2), ImmPtr(m_globalData->jsStringVPtr)));
+
+ // String case.
+ JITStubCall stubCallEqStrings(this, cti_op_eq_strings);
+ stubCallEqStrings.addArgument(regT0);
+ stubCallEqStrings.addArgument(regT2);
+ stubCallEqStrings.call();
+ storeResult.append(jump());
+
+ // Generic case.
+ genericCase.append(getSlowCase(iter)); // doubles
+ genericCase.link(this);
+ JITStubCall stubCallEq(this, cti_op_eq);
+ stubCallEq.addArgument(op1);
+ stubCallEq.addArgument(op2);
+ stubCallEq.call(regT0);
+
+ storeResult.link(this);
+ or32(Imm32(JSValue::FalseTag), regT0);
+ emitStoreBool(dst, regT0);
+}
+
+void JIT::emit_op_neq(Instruction* currentInstruction)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+ unsigned src1 = currentInstruction[2].u.operand;
+ unsigned src2 = currentInstruction[3].u.operand;
+
+ emitLoad2(src1, regT1, regT0, src2, regT3, regT2);
+ addSlowCase(branch32(NotEqual, regT1, regT3));
+ addSlowCase(branch32(Equal, regT1, Imm32(JSValue::CellTag)));
+ addSlowCase(branch32(Below, regT1, Imm32(JSValue::LowestTag)));
+
+ set8Compare32(NotEqual, regT0, regT2, regT0);
+ or32(Imm32(JSValue::FalseTag), regT0);
+
+ emitStoreBool(dst, regT0);
+}
+
+void JIT::emitSlow_op_neq(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+
+ JumpList storeResult;
+ JumpList genericCase;
+
+ genericCase.append(getSlowCase(iter)); // tags not equal
+
+ linkSlowCase(iter); // tags equal and JSCell
+ genericCase.append(branchPtr(NotEqual, Address(regT0), ImmPtr(m_globalData->jsStringVPtr)));
+ genericCase.append(branchPtr(NotEqual, Address(regT2), ImmPtr(m_globalData->jsStringVPtr)));
+
+ // String case.
+ JITStubCall stubCallEqStrings(this, cti_op_eq_strings);
+ stubCallEqStrings.addArgument(regT0);
+ stubCallEqStrings.addArgument(regT2);
+ stubCallEqStrings.call(regT0);
+ storeResult.append(jump());
+
+ // Generic case.
+ genericCase.append(getSlowCase(iter)); // doubles
+ genericCase.link(this);
+ JITStubCall stubCallEq(this, cti_op_eq);
+ stubCallEq.addArgument(regT1, regT0);
+ stubCallEq.addArgument(regT3, regT2);
+ stubCallEq.call(regT0);
+
+ storeResult.link(this);
+ xor32(Imm32(0x1), regT0);
+ or32(Imm32(JSValue::FalseTag), regT0);
+ emitStoreBool(dst, regT0);
+}
+
+void JIT::compileOpStrictEq(Instruction* currentInstruction, CompileOpStrictEqType type)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+ unsigned src1 = currentInstruction[2].u.operand;
+ unsigned src2 = currentInstruction[3].u.operand;
+
+ emitLoadTag(src1, regT0);
+ emitLoadTag(src2, regT1);
+
+ // Jump to a slow case if either operand is double, or if both operands are
+ // cells and/or Int32s.
+ move(regT0, regT2);
+ and32(regT1, regT2);
+ addSlowCase(branch32(Below, regT2, Imm32(JSValue::LowestTag)));
+ addSlowCase(branch32(AboveOrEqual, regT2, Imm32(JSValue::CellTag)));
+
+ if (type == OpStrictEq)
+ set8Compare32(Equal, regT0, regT1, regT0);
+ else
+ set8Compare32(NotEqual, regT0, regT1, regT0);
+
+ or32(Imm32(JSValue::FalseTag), regT0);
+
+ emitStoreBool(dst, regT0);
+}
+
+void JIT::emit_op_stricteq(Instruction* currentInstruction)
+{
+ compileOpStrictEq(currentInstruction, OpStrictEq);
+}
+
+void JIT::emitSlow_op_stricteq(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+ unsigned src1 = currentInstruction[2].u.operand;
+ unsigned src2 = currentInstruction[3].u.operand;
+
+ linkSlowCase(iter);
+ linkSlowCase(iter);
+
+ JITStubCall stubCall(this, cti_op_stricteq);
+ stubCall.addArgument(src1);
+ stubCall.addArgument(src2);
+ stubCall.call(dst);
+}
+
+void JIT::emit_op_nstricteq(Instruction* currentInstruction)
+{
+ compileOpStrictEq(currentInstruction, OpNStrictEq);
+}
+
+void JIT::emitSlow_op_nstricteq(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+ unsigned src1 = currentInstruction[2].u.operand;
+ unsigned src2 = currentInstruction[3].u.operand;
+
+ linkSlowCase(iter);
+ linkSlowCase(iter);
+
+ JITStubCall stubCall(this, cti_op_nstricteq);
+ stubCall.addArgument(src1);
+ stubCall.addArgument(src2);
+ stubCall.call(dst);
+}
+
+void JIT::emit_op_eq_null(Instruction* currentInstruction)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+ unsigned src = currentInstruction[2].u.operand;
+
+ emitLoad(src, regT1, regT0);
+ Jump isImmediate = branch32(NotEqual, regT1, Imm32(JSValue::CellTag));
+
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), regT1);
+ set32Test8(NonZero, Address(regT1, OBJECT_OFFSETOF(Structure, m_typeInfo.m_flags)), Imm32(MasqueradesAsUndefined), regT1);
+
+ Jump wasNotImmediate = jump();
+
+ isImmediate.link(this);
+
+ set8Compare32(Equal, regT1, Imm32(JSValue::NullTag), regT2);
+ set8Compare32(Equal, regT1, Imm32(JSValue::UndefinedTag), regT1);
+ or32(regT2, regT1);
+
+ wasNotImmediate.link(this);
+
+ or32(Imm32(JSValue::FalseTag), regT1);
+
+ emitStoreBool(dst, regT1);
+}
+
+void JIT::emit_op_neq_null(Instruction* currentInstruction)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+ unsigned src = currentInstruction[2].u.operand;
+
+ emitLoad(src, regT1, regT0);
+ Jump isImmediate = branch32(NotEqual, regT1, Imm32(JSValue::CellTag));
+
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), regT1);
+ set32Test8(Zero, Address(regT1, OBJECT_OFFSETOF(Structure, m_typeInfo.m_flags)), Imm32(MasqueradesAsUndefined), regT1);
+
+ Jump wasNotImmediate = jump();
+
+ isImmediate.link(this);
+
+ set8Compare32(NotEqual, regT1, Imm32(JSValue::NullTag), regT2);
+ set8Compare32(NotEqual, regT1, Imm32(JSValue::UndefinedTag), regT1);
+ and32(regT2, regT1);
+
+ wasNotImmediate.link(this);
+
+ or32(Imm32(JSValue::FalseTag), regT1);
+
+ emitStoreBool(dst, regT1);
+}
+
+void JIT::emit_op_resolve_with_base(Instruction* currentInstruction)
+{
+ JITStubCall stubCall(this, cti_op_resolve_with_base);
+ stubCall.addArgument(ImmPtr(&m_codeBlock->identifier(currentInstruction[3].u.operand)));
+ stubCall.addArgument(Imm32(currentInstruction[1].u.operand));
+ stubCall.call(currentInstruction[2].u.operand);
+}
+
+void JIT::emit_op_new_func_exp(Instruction* currentInstruction)
+{
+ JITStubCall stubCall(this, cti_op_new_func_exp);
+ stubCall.addArgument(ImmPtr(m_codeBlock->functionExpr(currentInstruction[2].u.operand)));
+ stubCall.call(currentInstruction[1].u.operand);
+}
+
+void JIT::emit_op_throw(Instruction* currentInstruction)
+{
+ unsigned exception = currentInstruction[1].u.operand;
+ JITStubCall stubCall(this, cti_op_throw);
+ stubCall.addArgument(exception);
+ stubCall.call();
+
+#ifndef NDEBUG
+ // cti_op_throw always changes it's return address,
+ // this point in the code should never be reached.
+ breakpoint();
+#endif
+}
+
+void JIT::emit_op_get_pnames(Instruction* currentInstruction)
+{
+ int dst = currentInstruction[1].u.operand;
+ int base = currentInstruction[2].u.operand;
+ int i = currentInstruction[3].u.operand;
+ int size = currentInstruction[4].u.operand;
+ int breakTarget = currentInstruction[5].u.operand;
+
+ JumpList isNotObject;
+
+ emitLoad(base, regT1, regT0);
+ if (!m_codeBlock->isKnownNotImmediate(base))
+ isNotObject.append(branch32(NotEqual, regT1, Imm32(JSValue::CellTag)));
+ if (base != m_codeBlock->thisRegister() || m_codeBlock->isStrictMode()) {
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), regT2);
+ isNotObject.append(branch8(NotEqual, Address(regT2, OBJECT_OFFSETOF(Structure, m_typeInfo.m_type)), Imm32(ObjectType)));
+ }
+
+ // We could inline the case where you have a valid cache, but
+ // this call doesn't seem to be hot.
+ Label isObject(this);
+ JITStubCall getPnamesStubCall(this, cti_op_get_pnames);
+ getPnamesStubCall.addArgument(regT0);
+ getPnamesStubCall.call(dst);
+ load32(Address(regT0, OBJECT_OFFSETOF(JSPropertyNameIterator, m_jsStringsSize)), regT3);
+ store32(Imm32(0), addressFor(i));
+ store32(regT3, addressFor(size));
+ Jump end = jump();
+
+ isNotObject.link(this);
+ addJump(branch32(Equal, regT1, Imm32(JSValue::NullTag)), breakTarget);
+ addJump(branch32(Equal, regT1, Imm32(JSValue::UndefinedTag)), breakTarget);
+ JITStubCall toObjectStubCall(this, cti_to_object);
+ toObjectStubCall.addArgument(regT1, regT0);
+ toObjectStubCall.call(base);
+ jump().linkTo(isObject, this);
+
+ end.link(this);
+}
+
+void JIT::emit_op_next_pname(Instruction* currentInstruction)
+{
+ int dst = currentInstruction[1].u.operand;
+ int base = currentInstruction[2].u.operand;
+ int i = currentInstruction[3].u.operand;
+ int size = currentInstruction[4].u.operand;
+ int it = currentInstruction[5].u.operand;
+ int target = currentInstruction[6].u.operand;
+
+ JumpList callHasProperty;
+
+ Label begin(this);
+ load32(addressFor(i), regT0);
+ Jump end = branch32(Equal, regT0, addressFor(size));
+
+ // Grab key @ i
+ loadPtr(addressFor(it), regT1);
+ loadPtr(Address(regT1, OBJECT_OFFSETOF(JSPropertyNameIterator, m_jsStrings)), regT2);
+ load32(BaseIndex(regT2, regT0, TimesEight), regT2);
+ store32(Imm32(JSValue::CellTag), tagFor(dst));
+ store32(regT2, payloadFor(dst));
+
+ // Increment i
+ add32(Imm32(1), regT0);
+ store32(regT0, addressFor(i));
+
+ // Verify that i is valid:
+ loadPtr(addressFor(base), regT0);
+
+ // Test base's structure
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), regT2);
+ callHasProperty.append(branchPtr(NotEqual, regT2, Address(Address(regT1, OBJECT_OFFSETOF(JSPropertyNameIterator, m_cachedStructure)))));
+
+ // Test base's prototype chain
+ loadPtr(Address(Address(regT1, OBJECT_OFFSETOF(JSPropertyNameIterator, m_cachedPrototypeChain))), regT3);
+ loadPtr(Address(regT3, OBJECT_OFFSETOF(StructureChain, m_vector)), regT3);
+ addJump(branchTestPtr(Zero, Address(regT3)), target);
+
+ Label checkPrototype(this);
+ callHasProperty.append(branch32(Equal, Address(regT2, OBJECT_OFFSETOF(Structure, m_prototype) + OBJECT_OFFSETOF(JSValue, u.asBits.tag)), Imm32(JSValue::NullTag)));
+ loadPtr(Address(regT2, OBJECT_OFFSETOF(Structure, m_prototype) + OBJECT_OFFSETOF(JSValue, u.asBits.payload)), regT2);
+ loadPtr(Address(regT2, OBJECT_OFFSETOF(JSCell, m_structure)), regT2);
+ callHasProperty.append(branchPtr(NotEqual, regT2, Address(regT3)));
+ addPtr(Imm32(sizeof(Structure*)), regT3);
+ branchTestPtr(NonZero, Address(regT3)).linkTo(checkPrototype, this);
+
+ // Continue loop.
+ addJump(jump(), target);
+
+ // Slow case: Ask the object if i is valid.
+ callHasProperty.link(this);
+ loadPtr(addressFor(dst), regT1);
+ JITStubCall stubCall(this, cti_has_property);
+ stubCall.addArgument(regT0);
+ stubCall.addArgument(regT1);
+ stubCall.call();
+
+ // Test for valid key.
+ addJump(branchTest32(NonZero, regT0), target);
+ jump().linkTo(begin, this);
+
+ // End of loop.
+ end.link(this);
+}
+
+void JIT::emit_op_push_scope(Instruction* currentInstruction)
+{
+ JITStubCall stubCall(this, cti_op_push_scope);
+ stubCall.addArgument(currentInstruction[1].u.operand);
+ stubCall.call(currentInstruction[1].u.operand);
+}
+
+void JIT::emit_op_pop_scope(Instruction*)
+{
+ JITStubCall(this, cti_op_pop_scope).call();
+}
+
+void JIT::emit_op_to_jsnumber(Instruction* currentInstruction)
+{
+ int dst = currentInstruction[1].u.operand;
+ int src = currentInstruction[2].u.operand;
+
+ emitLoad(src, regT1, regT0);
+
+ Jump isInt32 = branch32(Equal, regT1, Imm32(JSValue::Int32Tag));
+ addSlowCase(branch32(AboveOrEqual, regT1, Imm32(JSValue::EmptyValueTag)));
+ isInt32.link(this);
+
+ if (src != dst)
+ emitStore(dst, regT1, regT0);
+ map(m_bytecodeOffset + OPCODE_LENGTH(op_to_jsnumber), dst, regT1, regT0);
+}
+
+void JIT::emitSlow_op_to_jsnumber(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ int dst = currentInstruction[1].u.operand;
+
+ linkSlowCase(iter);
+
+ JITStubCall stubCall(this, cti_op_to_jsnumber);
+ stubCall.addArgument(regT1, regT0);
+ stubCall.call(dst);
+}
+
+void JIT::emit_op_push_new_scope(Instruction* currentInstruction)
+{
+ JITStubCall stubCall(this, cti_op_push_new_scope);
+ stubCall.addArgument(ImmPtr(&m_codeBlock->identifier(currentInstruction[2].u.operand)));
+ stubCall.addArgument(currentInstruction[3].u.operand);
+ stubCall.call(currentInstruction[1].u.operand);
+}
+
+void JIT::emit_op_catch(Instruction* currentInstruction)
+{
+ // cti_op_throw returns the callFrame for the handler.
+ move(regT0, callFrameRegister);
+
+ // Now store the exception returned by cti_op_throw.
+ loadPtr(Address(stackPointerRegister, OBJECT_OFFSETOF(struct JITStackFrame, globalData)), regT3);
+ load32(Address(regT3, OBJECT_OFFSETOF(JSGlobalData, exception) + OBJECT_OFFSETOF(JSValue, u.asBits.payload)), regT0);
+ load32(Address(regT3, OBJECT_OFFSETOF(JSGlobalData, exception) + OBJECT_OFFSETOF(JSValue, u.asBits.tag)), regT1);
+ store32(Imm32(JSValue().payload()), Address(regT3, OBJECT_OFFSETOF(JSGlobalData, exception) + OBJECT_OFFSETOF(JSValue, u.asBits.payload)));
+ store32(Imm32(JSValue().tag()), Address(regT3, OBJECT_OFFSETOF(JSGlobalData, exception) + OBJECT_OFFSETOF(JSValue, u.asBits.tag)));
+
+ unsigned exception = currentInstruction[1].u.operand;
+ emitStore(exception, regT1, regT0);
+ map(m_bytecodeOffset + OPCODE_LENGTH(op_catch), exception, regT1, regT0);
+}
+
+void JIT::emit_op_jmp_scopes(Instruction* currentInstruction)
+{
+ JITStubCall stubCall(this, cti_op_jmp_scopes);
+ stubCall.addArgument(Imm32(currentInstruction[1].u.operand));
+ stubCall.call();
+ addJump(jump(), currentInstruction[2].u.operand);
+}
+
+void JIT::emit_op_switch_imm(Instruction* currentInstruction)
+{
+ unsigned tableIndex = currentInstruction[1].u.operand;
+ unsigned defaultOffset = currentInstruction[2].u.operand;
+ unsigned scrutinee = currentInstruction[3].u.operand;
+
+ // create jump table for switch destinations, track this switch statement.
+ SimpleJumpTable* jumpTable = &m_codeBlock->immediateSwitchJumpTable(tableIndex);
+ m_switches.append(SwitchRecord(jumpTable, m_bytecodeOffset, defaultOffset, SwitchRecord::Immediate));
+ jumpTable->ctiOffsets.grow(jumpTable->branchOffsets.size());
+
+ JITStubCall stubCall(this, cti_op_switch_imm);
+ stubCall.addArgument(scrutinee);
+ stubCall.addArgument(Imm32(tableIndex));
+ stubCall.call();
+ jump(regT0);
+}
+
+void JIT::emit_op_switch_char(Instruction* currentInstruction)
+{
+ unsigned tableIndex = currentInstruction[1].u.operand;
+ unsigned defaultOffset = currentInstruction[2].u.operand;
+ unsigned scrutinee = currentInstruction[3].u.operand;
+
+ // create jump table for switch destinations, track this switch statement.
+ SimpleJumpTable* jumpTable = &m_codeBlock->characterSwitchJumpTable(tableIndex);
+ m_switches.append(SwitchRecord(jumpTable, m_bytecodeOffset, defaultOffset, SwitchRecord::Character));
+ jumpTable->ctiOffsets.grow(jumpTable->branchOffsets.size());
+
+ JITStubCall stubCall(this, cti_op_switch_char);
+ stubCall.addArgument(scrutinee);
+ stubCall.addArgument(Imm32(tableIndex));
+ stubCall.call();
+ jump(regT0);
+}
+
+void JIT::emit_op_switch_string(Instruction* currentInstruction)
+{
+ unsigned tableIndex = currentInstruction[1].u.operand;
+ unsigned defaultOffset = currentInstruction[2].u.operand;
+ unsigned scrutinee = currentInstruction[3].u.operand;
+
+ // create jump table for switch destinations, track this switch statement.
+ StringJumpTable* jumpTable = &m_codeBlock->stringSwitchJumpTable(tableIndex);
+ m_switches.append(SwitchRecord(jumpTable, m_bytecodeOffset, defaultOffset));
+
+ JITStubCall stubCall(this, cti_op_switch_string);
+ stubCall.addArgument(scrutinee);
+ stubCall.addArgument(Imm32(tableIndex));
+ stubCall.call();
+ jump(regT0);
+}
+
+void JIT::emit_op_throw_reference_error(Instruction* currentInstruction)
+{
+ unsigned message = currentInstruction[1].u.operand;
+
+ JITStubCall stubCall(this, cti_op_throw_reference_error);
+ stubCall.addArgument(m_codeBlock->getConstant(message));
+ stubCall.call();
+}
+
+void JIT::emit_op_throw_syntax_error(Instruction* currentInstruction)
+{
+ unsigned message = currentInstruction[1].u.operand;
+
+ JITStubCall stubCall(this, cti_op_throw_syntax_error);
+ stubCall.addArgument(m_codeBlock->getConstant(message));
+ stubCall.call();
+}
+
+void JIT::emit_op_debug(Instruction* currentInstruction)
+{
+#if ENABLE(DEBUG_WITH_BREAKPOINT)
+ UNUSED_PARAM(currentInstruction);
+ breakpoint();
+#else
+ JITStubCall stubCall(this, cti_op_debug);
+ stubCall.addArgument(Imm32(currentInstruction[1].u.operand));
+ stubCall.addArgument(Imm32(currentInstruction[2].u.operand));
+ stubCall.addArgument(Imm32(currentInstruction[3].u.operand));
+ stubCall.call();
+#endif
+}
+
+
+void JIT::emit_op_enter(Instruction*)
+{
+ // Even though JIT code doesn't use them, we initialize our constant
+ // registers to zap stale pointers, to avoid unnecessarily prolonging
+ // object lifetime and increasing GC pressure.
+ for (int i = 0; i < m_codeBlock->m_numVars; ++i)
+ emitStore(i, jsUndefined());
+}
+
+void JIT::emit_op_create_activation(Instruction* currentInstruction)
+{
+ unsigned activation = currentInstruction[1].u.operand;
+
+ Jump activationCreated = branch32(NotEqual, tagFor(activation), Imm32(JSValue::EmptyValueTag));
+ JITStubCall(this, cti_op_push_activation).call(activation);
+ activationCreated.link(this);
+}
+
+void JIT::emit_op_create_arguments(Instruction* currentInstruction)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+
+ Jump argsCreated = branch32(NotEqual, tagFor(dst), Imm32(JSValue::EmptyValueTag));
+
+ if (m_codeBlock->m_numParameters == 1)
+ JITStubCall(this, cti_op_create_arguments_no_params).call();
+ else
+ JITStubCall(this, cti_op_create_arguments).call();
+
+ emitStore(dst, regT1, regT0);
+ emitStore(unmodifiedArgumentsRegister(dst), regT1, regT0);
+
+ argsCreated.link(this);
+}
+
+void JIT::emit_op_init_lazy_reg(Instruction* currentInstruction)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+
+ emitStore(dst, JSValue());
+}
+
+void JIT::emit_op_get_callee(Instruction* currentInstruction)
+{
+ int dst = currentInstruction[1].u.operand;
+ emitGetFromCallFrameHeaderPtr(RegisterFile::Callee, regT0);
+ emitStoreCell(dst, regT0);
+}
+
+void JIT::emit_op_create_this(Instruction* currentInstruction)
+{
+ unsigned protoRegister = currentInstruction[2].u.operand;
+ emitLoad(protoRegister, regT1, regT0);
+ JITStubCall stubCall(this, cti_op_create_this);
+ stubCall.addArgument(regT1, regT0);
+ stubCall.call(currentInstruction[1].u.operand);
+}
+
+void JIT::emit_op_convert_this(Instruction* currentInstruction)
+{
+ unsigned thisRegister = currentInstruction[1].u.operand;
+
+ emitLoad(thisRegister, regT1, regT0);
+
+ addSlowCase(branch32(NotEqual, regT1, Imm32(JSValue::CellTag)));
+
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), regT2);
+ addSlowCase(branchTest8(NonZero, Address(regT2, OBJECT_OFFSETOF(Structure, m_typeInfo.m_flags)), Imm32(NeedsThisConversion)));
+
+ map(m_bytecodeOffset + OPCODE_LENGTH(op_convert_this), thisRegister, regT1, regT0);
+}
+
+void JIT::emit_op_convert_this_strict(Instruction* currentInstruction)
+{
+ unsigned thisRegister = currentInstruction[1].u.operand;
+
+ emitLoad(thisRegister, regT1, regT0);
+
+ Jump notNull = branch32(NotEqual, regT1, Imm32(JSValue::EmptyValueTag));
+ emitStore(thisRegister, jsNull());
+ Jump setThis = jump();
+ notNull.link(this);
+ Jump isImmediate = branch32(NotEqual, regT1, Imm32(JSValue::CellTag));
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), regT2);
+ Jump notAnObject = branch8(NotEqual, Address(regT2, OBJECT_OFFSETOF(Structure, m_typeInfo.m_type)), Imm32(ObjectType));
+ addSlowCase(branchTest8(NonZero, Address(regT2, OBJECT_OFFSETOF(Structure, m_typeInfo.m_flags)), Imm32(NeedsThisConversion)));
+ isImmediate.link(this);
+ notAnObject.link(this);
+ setThis.link(this);
+ map(m_bytecodeOffset + OPCODE_LENGTH(op_convert_this_strict), thisRegister, regT1, regT0);
+}
+
+void JIT::emitSlow_op_convert_this(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ unsigned thisRegister = currentInstruction[1].u.operand;
+
+ linkSlowCase(iter);
+ linkSlowCase(iter);
+
+ JITStubCall stubCall(this, cti_op_convert_this);
+ stubCall.addArgument(regT1, regT0);
+ stubCall.call(thisRegister);
+}
+
+void JIT::emitSlow_op_convert_this_strict(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ unsigned thisRegister = currentInstruction[1].u.operand;
+
+ linkSlowCase(iter);
+
+ JITStubCall stubCall(this, cti_op_convert_this_strict);
+ stubCall.addArgument(regT1, regT0);
+ stubCall.call(thisRegister);
+}
+
+void JIT::emit_op_profile_will_call(Instruction* currentInstruction)
+{
+ peek(regT2, OBJECT_OFFSETOF(JITStackFrame, enabledProfilerReference) / sizeof(void*));
+ Jump noProfiler = branchTestPtr(Zero, Address(regT2));
+
+ JITStubCall stubCall(this, cti_op_profile_will_call);
+ stubCall.addArgument(currentInstruction[1].u.operand);
+ stubCall.call();
+ noProfiler.link(this);
+}
+
+void JIT::emit_op_profile_did_call(Instruction* currentInstruction)
+{
+ peek(regT2, OBJECT_OFFSETOF(JITStackFrame, enabledProfilerReference) / sizeof(void*));
+ Jump noProfiler = branchTestPtr(Zero, Address(regT2));
+
+ JITStubCall stubCall(this, cti_op_profile_did_call);
+ stubCall.addArgument(currentInstruction[1].u.operand);
+ stubCall.call();
+ noProfiler.link(this);
+}
+
+void JIT::emit_op_get_arguments_length(Instruction* currentInstruction)
+{
+ int dst = currentInstruction[1].u.operand;
+ int argumentsRegister = currentInstruction[2].u.operand;
+ addSlowCase(branch32(NotEqual, tagFor(argumentsRegister), Imm32(JSValue::EmptyValueTag)));
+ emitGetFromCallFrameHeader32(RegisterFile::ArgumentCount, regT0);
+ sub32(Imm32(1), regT0);
+ emitStoreInt32(dst, regT0);
+}
+
+void JIT::emitSlow_op_get_arguments_length(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ linkSlowCase(iter);
+ int dst = currentInstruction[1].u.operand;
+ int base = currentInstruction[2].u.operand;
+ int ident = currentInstruction[3].u.operand;
+
+ JITStubCall stubCall(this, cti_op_get_by_id_generic);
+ stubCall.addArgument(base);
+ stubCall.addArgument(ImmPtr(&(m_codeBlock->identifier(ident))));
+ stubCall.call(dst);
+}
+
+void JIT::emit_op_get_argument_by_val(Instruction* currentInstruction)
+{
+ int dst = currentInstruction[1].u.operand;
+ int argumentsRegister = currentInstruction[2].u.operand;
+ int property = currentInstruction[3].u.operand;
+ addSlowCase(branch32(NotEqual, tagFor(argumentsRegister), Imm32(JSValue::EmptyValueTag)));
+ emitLoad(property, regT1, regT2);
+ addSlowCase(branch32(NotEqual, regT1, Imm32(JSValue::Int32Tag)));
+ add32(Imm32(1), regT2);
+ // regT2 now contains the integer index of the argument we want, including this
+ emitGetFromCallFrameHeader32(RegisterFile::ArgumentCount, regT3);
+ addSlowCase(branch32(AboveOrEqual, regT2, regT3));
+
+ Jump skipOutofLineParams;
+ int numArgs = m_codeBlock->m_numParameters;
+ if (numArgs) {
+ Jump notInInPlaceArgs = branch32(AboveOrEqual, regT2, Imm32(numArgs));
+ addPtr(Imm32(static_cast<unsigned>(-(RegisterFile::CallFrameHeaderSize + numArgs) * sizeof(Register))), callFrameRegister, regT1);
+ loadPtr(BaseIndex(regT1, regT2, TimesEight, OBJECT_OFFSETOF(JSValue, u.asBits.payload)), regT0);
+ loadPtr(BaseIndex(regT1, regT2, TimesEight, OBJECT_OFFSETOF(JSValue, u.asBits.tag)), regT1);
+ skipOutofLineParams = jump();
+ notInInPlaceArgs.link(this);
+ }
+
+ addPtr(Imm32(static_cast<unsigned>(-(RegisterFile::CallFrameHeaderSize + numArgs) * sizeof(Register))), callFrameRegister, regT1);
+ mul32(Imm32(sizeof(Register)), regT3, regT3);
+ subPtr(regT3, regT1);
+ loadPtr(BaseIndex(regT1, regT2, TimesEight, OBJECT_OFFSETOF(JSValue, u.asBits.payload)), regT0);
+ loadPtr(BaseIndex(regT1, regT2, TimesEight, OBJECT_OFFSETOF(JSValue, u.asBits.tag)), regT1);
+ if (numArgs)
+ skipOutofLineParams.link(this);
+ emitStore(dst, regT1, regT0);
+}
+
+void JIT::emitSlow_op_get_argument_by_val(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+ unsigned arguments = currentInstruction[2].u.operand;
+ unsigned property = currentInstruction[3].u.operand;
+
+ linkSlowCase(iter);
+ Jump skipArgumentsCreation = jump();
+
+ linkSlowCase(iter);
+ linkSlowCase(iter);
+ if (m_codeBlock->m_numParameters == 1)
+ JITStubCall(this, cti_op_create_arguments_no_params).call();
+ else
+ JITStubCall(this, cti_op_create_arguments).call();
+
+ emitStore(arguments, regT1, regT0);
+ emitStore(unmodifiedArgumentsRegister(arguments), regT1, regT0);
+
+ skipArgumentsCreation.link(this);
+ JITStubCall stubCall(this, cti_op_get_by_val);
+ stubCall.addArgument(arguments);
+ stubCall.addArgument(property);
+ stubCall.call(dst);
+}
+
+#if ENABLE(JIT_USE_SOFT_MODULO)
+void JIT::softModulo()
+{
+ push(regT1);
+ push(regT3);
+ move(regT2, regT3);
+ move(regT0, regT2);
+ move(Imm32(0), regT1);
+
+ // Check for negative result reminder
+ Jump positiveRegT3 = branch32(GreaterThanOrEqual, regT3, Imm32(0));
+ neg32(regT3);
+ xor32(Imm32(1), regT1);
+ positiveRegT3.link(this);
+
+ Jump positiveRegT2 = branch32(GreaterThanOrEqual, regT2, Imm32(0));
+ neg32(regT2);
+ xor32(Imm32(2), regT1);
+ positiveRegT2.link(this);
+
+ // Save the condition for negative reminder
+ push(regT1);
+
+ Jump exitBranch = branch32(LessThan, regT2, regT3);
+
+ // Power of two fast case
+ move(regT3, regT0);
+ sub32(Imm32(1), regT0);
+ Jump powerOfTwo = branchTest32(NotEqual, regT0, regT3);
+ and32(regT0, regT2);
+ powerOfTwo.link(this);
+
+ and32(regT3, regT0);
+
+ Jump exitBranch2 = branchTest32(Zero, regT0);
+
+ countLeadingZeros32(regT2, regT0);
+ countLeadingZeros32(regT3, regT1);
+ sub32(regT0, regT1);
+
+ Jump useFullTable = branch32(Equal, regT1, Imm32(31));
+
+ neg32(regT1);
+ add32(Imm32(31), regT1);
+
+ int elementSizeByShift = -1;
+#if CPU(ARM)
+ elementSizeByShift = 3;
+#else
+#error "JIT_OPTIMIZE_MOD not yet supported on this platform."
+#endif
+ relativeTableJump(regT1, elementSizeByShift);
+
+ useFullTable.link(this);
+ // Modulo table
+ for (int i = 31; i > 0; --i) {
+#if CPU(ARM_TRADITIONAL)
+ m_assembler.cmp_r(regT2, m_assembler.lsl(regT3, i));
+ m_assembler.sub_r(regT2, regT2, m_assembler.lsl(regT3, i), ARMAssembler::CS);
+#elif CPU(ARM_THUMB2)
+ ShiftTypeAndAmount shift(SRType_LSL, i);
+ m_assembler.sub_S(regT1, regT2, regT3, shift);
+ m_assembler.it(ARMv7Assembler::ConditionCS);
+ m_assembler.mov(regT2, regT1);
+#else
+#error "JIT_OPTIMIZE_MOD not yet supported on this platform."
+#endif
+ }
+
+ Jump lower = branch32(Below, regT2, regT3);
+ sub32(regT3, regT2);
+ lower.link(this);
+
+ exitBranch.link(this);
+ exitBranch2.link(this);
+
+ // Check for negative reminder
+ pop(regT1);
+ Jump positiveResult = branch32(Equal, regT1, Imm32(0));
+ neg32(regT2);
+ positiveResult.link(this);
+
+ move(regT2, regT0);
+
+ pop(regT3);
+ pop(regT1);
+ ret();
+}
+#endif // ENABLE(JIT_USE_SOFT_MODULO)
+
+} // namespace JSC
+
+#endif // USE(JSVALUE32_64)
+#endif // ENABLE(JIT)
diff --git a/Source/JavaScriptCore/jit/JITPropertyAccess.cpp b/Source/JavaScriptCore/jit/JITPropertyAccess.cpp
new file mode 100644
index 0000000..1b95eec
--- /dev/null
+++ b/Source/JavaScriptCore/jit/JITPropertyAccess.cpp
@@ -0,0 +1,1101 @@
+/*
+ * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if ENABLE(JIT)
+#if USE(JSVALUE64)
+#include "JIT.h"
+
+#include "CodeBlock.h"
+#include "GetterSetter.h"
+#include "JITInlineMethods.h"
+#include "JITStubCall.h"
+#include "JSArray.h"
+#include "JSFunction.h"
+#include "JSPropertyNameIterator.h"
+#include "Interpreter.h"
+#include "LinkBuffer.h"
+#include "RepatchBuffer.h"
+#include "ResultType.h"
+#include "SamplingTool.h"
+
+#ifndef NDEBUG
+#include <stdio.h>
+#endif
+
+using namespace std;
+
+namespace JSC {
+
+JIT::CodePtr JIT::stringGetByValStubGenerator(JSGlobalData* globalData, ExecutablePool* pool)
+{
+ JSInterfaceJIT jit;
+ JumpList failures;
+ failures.append(jit.branchPtr(NotEqual, Address(regT0), ImmPtr(globalData->jsStringVPtr)));
+ failures.append(jit.branchTest32(NonZero, Address(regT0, OBJECT_OFFSETOF(JSString, m_fiberCount))));
+
+ // Load string length to regT1, and start the process of loading the data pointer into regT0
+ jit.load32(Address(regT0, ThunkHelpers::jsStringLengthOffset()), regT2);
+ jit.loadPtr(Address(regT0, ThunkHelpers::jsStringValueOffset()), regT0);
+ jit.loadPtr(Address(regT0, ThunkHelpers::stringImplDataOffset()), regT0);
+
+ // Do an unsigned compare to simultaneously filter negative indices as well as indices that are too large
+ failures.append(jit.branch32(AboveOrEqual, regT1, regT2));
+
+ // Load the character
+ jit.load16(BaseIndex(regT0, regT1, TimesTwo, 0), regT0);
+
+ failures.append(jit.branch32(AboveOrEqual, regT0, Imm32(0x100)));
+ jit.move(ImmPtr(globalData->smallStrings.singleCharacterStrings()), regT1);
+ jit.loadPtr(BaseIndex(regT1, regT0, ScalePtr, 0), regT0);
+ jit.ret();
+
+ failures.link(&jit);
+ jit.move(Imm32(0), regT0);
+ jit.ret();
+
+ LinkBuffer patchBuffer(&jit, pool, 0);
+ return patchBuffer.finalizeCode().m_code;
+}
+
+void JIT::emit_op_get_by_val(Instruction* currentInstruction)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+ unsigned base = currentInstruction[2].u.operand;
+ unsigned property = currentInstruction[3].u.operand;
+
+ emitGetVirtualRegisters(base, regT0, property, regT1);
+ emitJumpSlowCaseIfNotImmediateInteger(regT1);
+
+ // This is technically incorrect - we're zero-extending an int32. On the hot path this doesn't matter.
+ // We check the value as if it was a uint32 against the m_vectorLength - which will always fail if
+ // number was signed since m_vectorLength is always less than intmax (since the total allocation
+ // size is always less than 4Gb). As such zero extending wil have been correct (and extending the value
+ // to 64-bits is necessary since it's used in the address calculation. We zero extend rather than sign
+ // extending since it makes it easier to re-tag the value in the slow case.
+ zeroExtend32ToPtr(regT1, regT1);
+
+ emitJumpSlowCaseIfNotJSCell(regT0, base);
+ addSlowCase(branchPtr(NotEqual, Address(regT0), ImmPtr(m_globalData->jsArrayVPtr)));
+
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(JSArray, m_storage)), regT2);
+ addSlowCase(branch32(AboveOrEqual, regT1, Address(regT0, OBJECT_OFFSETOF(JSArray, m_vectorLength))));
+
+ loadPtr(BaseIndex(regT2, regT1, ScalePtr, OBJECT_OFFSETOF(ArrayStorage, m_vector[0])), regT0);
+ addSlowCase(branchTestPtr(Zero, regT0));
+
+ emitPutVirtualRegister(dst);
+}
+
+void JIT::emitSlow_op_get_by_val(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+ unsigned base = currentInstruction[2].u.operand;
+ unsigned property = currentInstruction[3].u.operand;
+
+ linkSlowCase(iter); // property int32 check
+ linkSlowCaseIfNotJSCell(iter, base); // base cell check
+ Jump nonCell = jump();
+ linkSlowCase(iter); // base array check
+ Jump notString = branchPtr(NotEqual, Address(regT0), ImmPtr(m_globalData->jsStringVPtr));
+ emitNakedCall(m_globalData->getCTIStub(stringGetByValStubGenerator));
+ Jump failed = branchTestPtr(Zero, regT0);
+ emitPutVirtualRegister(dst, regT0);
+ emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_get_by_val));
+ failed.link(this);
+ notString.link(this);
+ nonCell.link(this);
+
+ linkSlowCase(iter); // vector length check
+ linkSlowCase(iter); // empty value
+
+ JITStubCall stubCall(this, cti_op_get_by_val);
+ stubCall.addArgument(base, regT2);
+ stubCall.addArgument(property, regT2);
+ stubCall.call(dst);
+}
+
+void JIT::compileGetDirectOffset(RegisterID base, RegisterID result, RegisterID structure, RegisterID offset, RegisterID scratch)
+{
+ ASSERT(sizeof(((Structure*)0)->m_propertyStorageCapacity) == sizeof(int32_t));
+ ASSERT(sizeof(JSObject::inlineStorageCapacity) == sizeof(int32_t));
+
+ Jump notUsingInlineStorage = branch32(NotEqual, Address(structure, OBJECT_OFFSETOF(Structure, m_propertyStorageCapacity)), Imm32(JSObject::inlineStorageCapacity));
+ loadPtr(BaseIndex(base, offset, ScalePtr, OBJECT_OFFSETOF(JSObject, m_inlineStorage)), result);
+ Jump finishedLoad = jump();
+ notUsingInlineStorage.link(this);
+ loadPtr(Address(base, OBJECT_OFFSETOF(JSObject, m_externalStorage)), scratch);
+ loadPtr(BaseIndex(scratch, offset, ScalePtr, 0), result);
+ finishedLoad.link(this);
+}
+
+void JIT::emit_op_get_by_pname(Instruction* currentInstruction)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+ unsigned base = currentInstruction[2].u.operand;
+ unsigned property = currentInstruction[3].u.operand;
+ unsigned expected = currentInstruction[4].u.operand;
+ unsigned iter = currentInstruction[5].u.operand;
+ unsigned i = currentInstruction[6].u.operand;
+
+ emitGetVirtualRegister(property, regT0);
+ addSlowCase(branchPtr(NotEqual, regT0, addressFor(expected)));
+ emitGetVirtualRegisters(base, regT0, iter, regT1);
+ emitJumpSlowCaseIfNotJSCell(regT0, base);
+
+ // Test base's structure
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), regT2);
+ addSlowCase(branchPtr(NotEqual, regT2, Address(regT1, OBJECT_OFFSETOF(JSPropertyNameIterator, m_cachedStructure))));
+ load32(addressFor(i), regT3);
+ sub32(Imm32(1), regT3);
+ addSlowCase(branch32(AboveOrEqual, regT3, Address(regT1, OBJECT_OFFSETOF(JSPropertyNameIterator, m_numCacheableSlots))));
+ compileGetDirectOffset(regT0, regT0, regT2, regT3, regT1);
+
+ emitPutVirtualRegister(dst, regT0);
+}
+
+void JIT::emitSlow_op_get_by_pname(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+ unsigned base = currentInstruction[2].u.operand;
+ unsigned property = currentInstruction[3].u.operand;
+
+ linkSlowCase(iter);
+ linkSlowCaseIfNotJSCell(iter, base);
+ linkSlowCase(iter);
+ linkSlowCase(iter);
+
+ JITStubCall stubCall(this, cti_op_get_by_val);
+ stubCall.addArgument(base, regT2);
+ stubCall.addArgument(property, regT2);
+ stubCall.call(dst);
+}
+
+void JIT::emit_op_put_by_val(Instruction* currentInstruction)
+{
+ unsigned base = currentInstruction[1].u.operand;
+ unsigned property = currentInstruction[2].u.operand;
+ unsigned value = currentInstruction[3].u.operand;
+
+ emitGetVirtualRegisters(base, regT0, property, regT1);
+ emitJumpSlowCaseIfNotImmediateInteger(regT1);
+ // See comment in op_get_by_val.
+ zeroExtend32ToPtr(regT1, regT1);
+ emitJumpSlowCaseIfNotJSCell(regT0, base);
+ addSlowCase(branchPtr(NotEqual, Address(regT0), ImmPtr(m_globalData->jsArrayVPtr)));
+ addSlowCase(branch32(AboveOrEqual, regT1, Address(regT0, OBJECT_OFFSETOF(JSArray, m_vectorLength))));
+
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(JSArray, m_storage)), regT2);
+ Jump empty = branchTestPtr(Zero, BaseIndex(regT2, regT1, ScalePtr, OBJECT_OFFSETOF(ArrayStorage, m_vector[0])));
+
+ Label storeResult(this);
+ emitGetVirtualRegister(value, regT0);
+ storePtr(regT0, BaseIndex(regT2, regT1, ScalePtr, OBJECT_OFFSETOF(ArrayStorage, m_vector[0])));
+ Jump end = jump();
+
+ empty.link(this);
+ add32(Imm32(1), Address(regT2, OBJECT_OFFSETOF(ArrayStorage, m_numValuesInVector)));
+ branch32(Below, regT1, Address(regT2, OBJECT_OFFSETOF(ArrayStorage, m_length))).linkTo(storeResult, this);
+
+ move(regT1, regT0);
+ add32(Imm32(1), regT0);
+ store32(regT0, Address(regT2, OBJECT_OFFSETOF(ArrayStorage, m_length)));
+ jump().linkTo(storeResult, this);
+
+ end.link(this);
+}
+
+void JIT::emit_op_put_by_index(Instruction* currentInstruction)
+{
+ JITStubCall stubCall(this, cti_op_put_by_index);
+ stubCall.addArgument(currentInstruction[1].u.operand, regT2);
+ stubCall.addArgument(Imm32(currentInstruction[2].u.operand));
+ stubCall.addArgument(currentInstruction[3].u.operand, regT2);
+ stubCall.call();
+}
+
+void JIT::emit_op_put_getter(Instruction* currentInstruction)
+{
+ JITStubCall stubCall(this, cti_op_put_getter);
+ stubCall.addArgument(currentInstruction[1].u.operand, regT2);
+ stubCall.addArgument(ImmPtr(&m_codeBlock->identifier(currentInstruction[2].u.operand)));
+ stubCall.addArgument(currentInstruction[3].u.operand, regT2);
+ stubCall.call();
+}
+
+void JIT::emit_op_put_setter(Instruction* currentInstruction)
+{
+ JITStubCall stubCall(this, cti_op_put_setter);
+ stubCall.addArgument(currentInstruction[1].u.operand, regT2);
+ stubCall.addArgument(ImmPtr(&m_codeBlock->identifier(currentInstruction[2].u.operand)));
+ stubCall.addArgument(currentInstruction[3].u.operand, regT2);
+ stubCall.call();
+}
+
+void JIT::emit_op_del_by_id(Instruction* currentInstruction)
+{
+ JITStubCall stubCall(this, cti_op_del_by_id);
+ stubCall.addArgument(currentInstruction[2].u.operand, regT2);
+ stubCall.addArgument(ImmPtr(&m_codeBlock->identifier(currentInstruction[3].u.operand)));
+ stubCall.call(currentInstruction[1].u.operand);
+}
+
+
+#if !ENABLE(JIT_OPTIMIZE_PROPERTY_ACCESS)
+
+/* ------------------------------ BEGIN: !ENABLE(JIT_OPTIMIZE_PROPERTY_ACCESS) ------------------------------ */
+
+// Treat these as nops - the call will be handed as a regular get_by_id/op_call pair.
+void JIT::emit_op_method_check(Instruction*) {}
+void JIT::emitSlow_op_method_check(Instruction*, Vector<SlowCaseEntry>::iterator&) { ASSERT_NOT_REACHED(); }
+#if ENABLE(JIT_OPTIMIZE_METHOD_CALLS)
+#error "JIT_OPTIMIZE_METHOD_CALLS requires JIT_OPTIMIZE_PROPERTY_ACCESS"
+#endif
+
+void JIT::emit_op_get_by_id(Instruction* currentInstruction)
+{
+ unsigned resultVReg = currentInstruction[1].u.operand;
+ unsigned baseVReg = currentInstruction[2].u.operand;
+ Identifier* ident = &(m_codeBlock->identifier(currentInstruction[3].u.operand));
+
+ emitGetVirtualRegister(baseVReg, regT0);
+ JITStubCall stubCall(this, cti_op_get_by_id_generic);
+ stubCall.addArgument(regT0);
+ stubCall.addArgument(ImmPtr(ident));
+ stubCall.call(resultVReg);
+
+ m_propertyAccessInstructionIndex++;
+}
+
+void JIT::emitSlow_op_get_by_id(Instruction*, Vector<SlowCaseEntry>::iterator&)
+{
+ ASSERT_NOT_REACHED();
+}
+
+void JIT::emit_op_put_by_id(Instruction* currentInstruction)
+{
+ unsigned baseVReg = currentInstruction[1].u.operand;
+ Identifier* ident = &(m_codeBlock->identifier(currentInstruction[2].u.operand));
+ unsigned valueVReg = currentInstruction[3].u.operand;
+ unsigned direct = currentInstruction[8].u.operand;
+
+ emitGetVirtualRegisters(baseVReg, regT0, valueVReg, regT1);
+
+ JITStubCall stubCall(this, direct ? cti_op_put_by_id_direct_generic, cti_op_put_by_id_generic);
+ stubCall.addArgument(regT0);
+ stubCall.addArgument(ImmPtr(ident));
+ stubCall.addArgument(regT1);
+ stubCall.call();
+
+ m_propertyAccessInstructionIndex++;
+}
+
+void JIT::emitSlow_op_put_by_id(Instruction*, Vector<SlowCaseEntry>::iterator&)
+{
+ ASSERT_NOT_REACHED();
+}
+
+#else // !ENABLE(JIT_OPTIMIZE_PROPERTY_ACCESS)
+
+/* ------------------------------ BEGIN: ENABLE(JIT_OPTIMIZE_PROPERTY_ACCESS) ------------------------------ */
+
+#if ENABLE(JIT_OPTIMIZE_METHOD_CALLS)
+
+void JIT::emit_op_method_check(Instruction* currentInstruction)
+{
+ // Assert that the following instruction is a get_by_id.
+ ASSERT(m_interpreter->getOpcodeID((currentInstruction + OPCODE_LENGTH(op_method_check))->u.opcode) == op_get_by_id);
+
+ currentInstruction += OPCODE_LENGTH(op_method_check);
+ unsigned resultVReg = currentInstruction[1].u.operand;
+ unsigned baseVReg = currentInstruction[2].u.operand;
+ Identifier* ident = &(m_codeBlock->identifier(currentInstruction[3].u.operand));
+
+ emitGetVirtualRegister(baseVReg, regT0);
+
+ // Do the method check - check the object & its prototype's structure inline (this is the common case).
+ m_methodCallCompilationInfo.append(MethodCallCompilationInfo(m_propertyAccessInstructionIndex));
+ MethodCallCompilationInfo& info = m_methodCallCompilationInfo.last();
+
+ Jump notCell = emitJumpIfNotJSCell(regT0);
+
+ BEGIN_UNINTERRUPTED_SEQUENCE(sequenceMethodCheck);
+
+ Jump structureCheck = branchPtrWithPatch(NotEqual, Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), info.structureToCompare, ImmPtr(reinterpret_cast<void*>(patchGetByIdDefaultStructure)));
+ DataLabelPtr protoStructureToCompare, protoObj = moveWithPatch(ImmPtr(0), regT1);
+ Jump protoStructureCheck = branchPtrWithPatch(NotEqual, Address(regT1, OBJECT_OFFSETOF(JSCell, m_structure)), protoStructureToCompare, ImmPtr(reinterpret_cast<void*>(patchGetByIdDefaultStructure)));
+
+ // This will be relinked to load the function without doing a load.
+ DataLabelPtr putFunction = moveWithPatch(ImmPtr(0), regT0);
+
+ END_UNINTERRUPTED_SEQUENCE(sequenceMethodCheck);
+
+ Jump match = jump();
+
+ ASSERT_JIT_OFFSET(differenceBetween(info.structureToCompare, protoObj), patchOffsetMethodCheckProtoObj);
+ ASSERT_JIT_OFFSET(differenceBetween(info.structureToCompare, protoStructureToCompare), patchOffsetMethodCheckProtoStruct);
+ ASSERT_JIT_OFFSET(differenceBetween(info.structureToCompare, putFunction), patchOffsetMethodCheckPutFunction);
+
+ // Link the failure cases here.
+ notCell.link(this);
+ structureCheck.link(this);
+ protoStructureCheck.link(this);
+
+ // Do a regular(ish) get_by_id (the slow case will be link to
+ // cti_op_get_by_id_method_check instead of cti_op_get_by_id.
+ compileGetByIdHotPath(resultVReg, baseVReg, ident, m_propertyAccessInstructionIndex++);
+
+ match.link(this);
+ emitPutVirtualRegister(resultVReg);
+
+ // We've already generated the following get_by_id, so make sure it's skipped over.
+ m_bytecodeOffset += OPCODE_LENGTH(op_get_by_id);
+}
+
+void JIT::emitSlow_op_method_check(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ currentInstruction += OPCODE_LENGTH(op_method_check);
+ unsigned resultVReg = currentInstruction[1].u.operand;
+ unsigned baseVReg = currentInstruction[2].u.operand;
+ Identifier* ident = &(m_codeBlock->identifier(currentInstruction[3].u.operand));
+
+ compileGetByIdSlowCase(resultVReg, baseVReg, ident, iter, true);
+
+ // We've already generated the following get_by_id, so make sure it's skipped over.
+ m_bytecodeOffset += OPCODE_LENGTH(op_get_by_id);
+}
+
+#else //!ENABLE(JIT_OPTIMIZE_METHOD_CALLS)
+
+// Treat these as nops - the call will be handed as a regular get_by_id/op_call pair.
+void JIT::emit_op_method_check(Instruction*) {}
+void JIT::emitSlow_op_method_check(Instruction*, Vector<SlowCaseEntry>::iterator&) { ASSERT_NOT_REACHED(); }
+
+#endif
+
+void JIT::emit_op_get_by_id(Instruction* currentInstruction)
+{
+ unsigned resultVReg = currentInstruction[1].u.operand;
+ unsigned baseVReg = currentInstruction[2].u.operand;
+ Identifier* ident = &(m_codeBlock->identifier(currentInstruction[3].u.operand));
+
+ emitGetVirtualRegister(baseVReg, regT0);
+ compileGetByIdHotPath(resultVReg, baseVReg, ident, m_propertyAccessInstructionIndex++);
+ emitPutVirtualRegister(resultVReg);
+}
+
+void JIT::compileGetByIdHotPath(int, int baseVReg, Identifier*, unsigned propertyAccessInstructionIndex)
+{
+ // As for put_by_id, get_by_id requires the offset of the Structure and the offset of the access to be patched.
+ // Additionally, for get_by_id we need patch the offset of the branch to the slow case (we patch this to jump
+ // to array-length / prototype access tranpolines, and finally we also the the property-map access offset as a label
+ // to jump back to if one of these trampolies finds a match.
+
+ emitJumpSlowCaseIfNotJSCell(regT0, baseVReg);
+
+ BEGIN_UNINTERRUPTED_SEQUENCE(sequenceGetByIdHotPath);
+
+ Label hotPathBegin(this);
+ m_propertyAccessCompilationInfo[propertyAccessInstructionIndex].hotPathBegin = hotPathBegin;
+
+ DataLabelPtr structureToCompare;
+ Jump structureCheck = branchPtrWithPatch(NotEqual, Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), structureToCompare, ImmPtr(reinterpret_cast<void*>(patchGetByIdDefaultStructure)));
+ addSlowCase(structureCheck);
+ ASSERT_JIT_OFFSET(differenceBetween(hotPathBegin, structureToCompare), patchOffsetGetByIdStructure);
+ ASSERT_JIT_OFFSET(differenceBetween(hotPathBegin, structureCheck), patchOffsetGetByIdBranchToSlowCase)
+
+ Label externalLoad = loadPtrWithPatchToLEA(Address(regT0, OBJECT_OFFSETOF(JSObject, m_externalStorage)), regT0);
+ Label externalLoadComplete(this);
+ ASSERT_JIT_OFFSET(differenceBetween(hotPathBegin, externalLoad), patchOffsetGetByIdExternalLoad);
+ ASSERT_JIT_OFFSET(differenceBetween(externalLoad, externalLoadComplete), patchLengthGetByIdExternalLoad);
+
+ DataLabel32 displacementLabel = loadPtrWithAddressOffsetPatch(Address(regT0, patchGetByIdDefaultOffset), regT0);
+ ASSERT_JIT_OFFSET(differenceBetween(hotPathBegin, displacementLabel), patchOffsetGetByIdPropertyMapOffset);
+
+ Label putResult(this);
+
+ END_UNINTERRUPTED_SEQUENCE(sequenceGetByIdHotPath);
+
+ ASSERT_JIT_OFFSET(differenceBetween(hotPathBegin, putResult), patchOffsetGetByIdPutResult);
+}
+
+void JIT::emitSlow_op_get_by_id(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ unsigned resultVReg = currentInstruction[1].u.operand;
+ unsigned baseVReg = currentInstruction[2].u.operand;
+ Identifier* ident = &(m_codeBlock->identifier(currentInstruction[3].u.operand));
+
+ compileGetByIdSlowCase(resultVReg, baseVReg, ident, iter, false);
+}
+
+void JIT::compileGetByIdSlowCase(int resultVReg, int baseVReg, Identifier* ident, Vector<SlowCaseEntry>::iterator& iter, bool isMethodCheck)
+{
+ // As for the hot path of get_by_id, above, we ensure that we can use an architecture specific offset
+ // so that we only need track one pointer into the slow case code - we track a pointer to the location
+ // of the call (which we can use to look up the patch information), but should a array-length or
+ // prototype access trampoline fail we want to bail out back to here. To do so we can subtract back
+ // the distance from the call to the head of the slow case.
+
+ linkSlowCaseIfNotJSCell(iter, baseVReg);
+ linkSlowCase(iter);
+
+ BEGIN_UNINTERRUPTED_SEQUENCE(sequenceGetByIdSlowCase);
+
+#ifndef NDEBUG
+ Label coldPathBegin(this);
+#endif
+ JITStubCall stubCall(this, isMethodCheck ? cti_op_get_by_id_method_check : cti_op_get_by_id);
+ stubCall.addArgument(regT0);
+ stubCall.addArgument(ImmPtr(ident));
+ Call call = stubCall.call(resultVReg);
+
+ END_UNINTERRUPTED_SEQUENCE(sequenceGetByIdSlowCase);
+
+ ASSERT_JIT_OFFSET(differenceBetween(coldPathBegin, call), patchOffsetGetByIdSlowCaseCall);
+
+ // Track the location of the call; this will be used to recover patch information.
+ m_propertyAccessCompilationInfo[m_propertyAccessInstructionIndex].callReturnLocation = call;
+ m_propertyAccessInstructionIndex++;
+}
+
+void JIT::emit_op_put_by_id(Instruction* currentInstruction)
+{
+ unsigned baseVReg = currentInstruction[1].u.operand;
+ unsigned valueVReg = currentInstruction[3].u.operand;
+
+ unsigned propertyAccessInstructionIndex = m_propertyAccessInstructionIndex++;
+
+ // In order to be able to patch both the Structure, and the object offset, we store one pointer,
+ // to just after the arguments have been loaded into registers 'hotPathBegin', and we generate code
+ // such that the Structure & offset are always at the same distance from this.
+
+ emitGetVirtualRegisters(baseVReg, regT0, valueVReg, regT1);
+
+ // Jump to a slow case if either the base object is an immediate, or if the Structure does not match.
+ emitJumpSlowCaseIfNotJSCell(regT0, baseVReg);
+
+ BEGIN_UNINTERRUPTED_SEQUENCE(sequencePutById);
+
+ Label hotPathBegin(this);
+ m_propertyAccessCompilationInfo[propertyAccessInstructionIndex].hotPathBegin = hotPathBegin;
+
+ // It is important that the following instruction plants a 32bit immediate, in order that it can be patched over.
+ DataLabelPtr structureToCompare;
+ addSlowCase(branchPtrWithPatch(NotEqual, Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), structureToCompare, ImmPtr(reinterpret_cast<void*>(patchGetByIdDefaultStructure))));
+ ASSERT_JIT_OFFSET(differenceBetween(hotPathBegin, structureToCompare), patchOffsetPutByIdStructure);
+
+ // Plant a load from a bogus ofset in the object's property map; we will patch this later, if it is to be used.
+ Label externalLoad = loadPtrWithPatchToLEA(Address(regT0, OBJECT_OFFSETOF(JSObject, m_externalStorage)), regT0);
+ Label externalLoadComplete(this);
+ ASSERT_JIT_OFFSET(differenceBetween(hotPathBegin, externalLoad), patchOffsetPutByIdExternalLoad);
+ ASSERT_JIT_OFFSET(differenceBetween(externalLoad, externalLoadComplete), patchLengthPutByIdExternalLoad);
+
+ DataLabel32 displacementLabel = storePtrWithAddressOffsetPatch(regT1, Address(regT0, patchGetByIdDefaultOffset));
+
+ END_UNINTERRUPTED_SEQUENCE(sequencePutById);
+
+ ASSERT_JIT_OFFSET(differenceBetween(hotPathBegin, displacementLabel), patchOffsetPutByIdPropertyMapOffset);
+}
+
+void JIT::emitSlow_op_put_by_id(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ unsigned baseVReg = currentInstruction[1].u.operand;
+ Identifier* ident = &(m_codeBlock->identifier(currentInstruction[2].u.operand));
+ unsigned direct = currentInstruction[8].u.operand;
+
+ unsigned propertyAccessInstructionIndex = m_propertyAccessInstructionIndex++;
+
+ linkSlowCaseIfNotJSCell(iter, baseVReg);
+ linkSlowCase(iter);
+
+ JITStubCall stubCall(this, direct ? cti_op_put_by_id_direct : cti_op_put_by_id);
+ stubCall.addArgument(regT0);
+ stubCall.addArgument(ImmPtr(ident));
+ stubCall.addArgument(regT1);
+ Call call = stubCall.call();
+
+ // Track the location of the call; this will be used to recover patch information.
+ m_propertyAccessCompilationInfo[propertyAccessInstructionIndex].callReturnLocation = call;
+}
+
+// Compile a store into an object's property storage. May overwrite the
+// value in objectReg.
+void JIT::compilePutDirectOffset(RegisterID base, RegisterID value, Structure* structure, size_t cachedOffset)
+{
+ int offset = cachedOffset * sizeof(JSValue);
+ if (structure->isUsingInlineStorage())
+ offset += OBJECT_OFFSETOF(JSObject, m_inlineStorage);
+ else
+ loadPtr(Address(base, OBJECT_OFFSETOF(JSObject, m_externalStorage)), base);
+ storePtr(value, Address(base, offset));
+}
+
+// Compile a load from an object's property storage. May overwrite base.
+void JIT::compileGetDirectOffset(RegisterID base, RegisterID result, Structure* structure, size_t cachedOffset)
+{
+ int offset = cachedOffset * sizeof(JSValue);
+ if (structure->isUsingInlineStorage())
+ offset += OBJECT_OFFSETOF(JSObject, m_inlineStorage);
+ else
+ loadPtr(Address(base, OBJECT_OFFSETOF(JSObject, m_externalStorage)), base);
+ loadPtr(Address(base, offset), result);
+}
+
+void JIT::compileGetDirectOffset(JSObject* base, RegisterID temp, RegisterID result, size_t cachedOffset)
+{
+ if (base->isUsingInlineStorage())
+ loadPtr(static_cast<void*>(&base->m_inlineStorage[cachedOffset]), result);
+ else {
+ PropertyStorage* protoPropertyStorage = &base->m_externalStorage;
+ loadPtr(static_cast<void*>(protoPropertyStorage), temp);
+ loadPtr(Address(temp, cachedOffset * sizeof(JSValue)), result);
+ }
+}
+
+void JIT::testPrototype(JSValue prototype, JumpList& failureCases)
+{
+ if (prototype.isNull())
+ return;
+
+ // We have a special case for X86_64 here because X86 instructions that take immediate values
+ // only take 32 bit immediate values, wheras the pointer constants we are using here are 64 bit
+ // values. In the non X86_64 case, the generated code is slightly more efficient because it uses
+ // two less instructions and doesn't require any scratch registers.
+#if CPU(X86_64)
+ move(ImmPtr(prototype.asCell()->structure()), regT3);
+ failureCases.append(branchPtr(NotEqual, AbsoluteAddress(&prototype.asCell()->m_structure), regT3));
+#else
+ failureCases.append(branchPtr(NotEqual, AbsoluteAddress(&prototype.asCell()->m_structure), ImmPtr(prototype.asCell()->structure())));
+#endif
+}
+
+void JIT::privateCompilePutByIdTransition(StructureStubInfo* stubInfo, Structure* oldStructure, Structure* newStructure, size_t cachedOffset, StructureChain* chain, ReturnAddressPtr returnAddress, bool direct)
+{
+ JumpList failureCases;
+ // Check eax is an object of the right Structure.
+ failureCases.append(emitJumpIfNotJSCell(regT0));
+ failureCases.append(branchPtr(NotEqual, Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), ImmPtr(oldStructure)));
+ testPrototype(oldStructure->storedPrototype(), failureCases);
+
+ // ecx = baseObject->m_structure
+ if (!direct) {
+ for (RefPtr<Structure>* it = chain->head(); *it; ++it)
+ testPrototype((*it)->storedPrototype(), failureCases);
+ }
+
+ Call callTarget;
+
+ // emit a call only if storage realloc is needed
+ bool willNeedStorageRealloc = oldStructure->propertyStorageCapacity() != newStructure->propertyStorageCapacity();
+ if (willNeedStorageRealloc) {
+ // This trampoline was called to like a JIT stub; before we can can call again we need to
+ // remove the return address from the stack, to prevent the stack from becoming misaligned.
+ preserveReturnAddressAfterCall(regT3);
+
+ JITStubCall stubCall(this, cti_op_put_by_id_transition_realloc);
+ stubCall.skipArgument(); // base
+ stubCall.skipArgument(); // ident
+ stubCall.skipArgument(); // value
+ stubCall.addArgument(Imm32(oldStructure->propertyStorageCapacity()));
+ stubCall.addArgument(Imm32(newStructure->propertyStorageCapacity()));
+ stubCall.call(regT0);
+ emitGetJITStubArg(2, regT1);
+
+ restoreReturnAddressBeforeReturn(regT3);
+ }
+
+ // Assumes m_refCount can be decremented easily, refcount decrement is safe as
+ // codeblock should ensure oldStructure->m_refCount > 0
+ sub32(Imm32(1), AbsoluteAddress(oldStructure->addressOfCount()));
+ add32(Imm32(1), AbsoluteAddress(newStructure->addressOfCount()));
+ storePtr(ImmPtr(newStructure), Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)));
+
+ // write the value
+ compilePutDirectOffset(regT0, regT1, newStructure, cachedOffset);
+
+ ret();
+
+ ASSERT(!failureCases.empty());
+ failureCases.link(this);
+ restoreArgumentReferenceForTrampoline();
+ Call failureCall = tailRecursiveCall();
+
+ LinkBuffer patchBuffer(this, m_codeBlock->executablePool(), 0);
+
+ patchBuffer.link(failureCall, FunctionPtr(direct ? cti_op_put_by_id_direct_fail : cti_op_put_by_id_fail));
+
+ if (willNeedStorageRealloc) {
+ ASSERT(m_calls.size() == 1);
+ patchBuffer.link(m_calls[0].from, FunctionPtr(cti_op_put_by_id_transition_realloc));
+ }
+
+ CodeLocationLabel entryLabel = patchBuffer.finalizeCodeAddendum();
+ stubInfo->stubRoutine = entryLabel;
+ RepatchBuffer repatchBuffer(m_codeBlock);
+ repatchBuffer.relinkCallerToTrampoline(returnAddress, entryLabel);
+}
+
+void JIT::patchGetByIdSelf(CodeBlock* codeBlock, StructureStubInfo* stubInfo, Structure* structure, size_t cachedOffset, ReturnAddressPtr returnAddress)
+{
+ RepatchBuffer repatchBuffer(codeBlock);
+
+ // We don't want to patch more than once - in future go to cti_op_get_by_id_generic.
+ // Should probably go to cti_op_get_by_id_fail, but that doesn't do anything interesting right now.
+ repatchBuffer.relinkCallerToFunction(returnAddress, FunctionPtr(cti_op_get_by_id_self_fail));
+
+ int offset = sizeof(JSValue) * cachedOffset;
+
+ // If we're patching to use inline storage, convert the initial load to a lea; this avoids the extra load
+ // and makes the subsequent load's offset automatically correct
+ if (structure->isUsingInlineStorage())
+ repatchBuffer.repatchLoadPtrToLEA(stubInfo->hotPathBegin.instructionAtOffset(patchOffsetGetByIdExternalLoad));
+
+ // Patch the offset into the propoerty map to load from, then patch the Structure to look for.
+ repatchBuffer.repatch(stubInfo->hotPathBegin.dataLabelPtrAtOffset(patchOffsetGetByIdStructure), structure);
+ repatchBuffer.repatch(stubInfo->hotPathBegin.dataLabel32AtOffset(patchOffsetGetByIdPropertyMapOffset), offset);
+}
+
+void JIT::patchMethodCallProto(CodeBlock* codeBlock, MethodCallLinkInfo& methodCallLinkInfo, JSFunction* callee, Structure* structure, JSObject* proto, ReturnAddressPtr returnAddress)
+{
+ RepatchBuffer repatchBuffer(codeBlock);
+
+ ASSERT(!methodCallLinkInfo.cachedStructure);
+ methodCallLinkInfo.cachedStructure = structure;
+ structure->ref();
+
+ Structure* prototypeStructure = proto->structure();
+ methodCallLinkInfo.cachedPrototypeStructure = prototypeStructure;
+ prototypeStructure->ref();
+
+ repatchBuffer.repatch(methodCallLinkInfo.structureLabel, structure);
+ repatchBuffer.repatch(methodCallLinkInfo.structureLabel.dataLabelPtrAtOffset(patchOffsetMethodCheckProtoObj), proto);
+ repatchBuffer.repatch(methodCallLinkInfo.structureLabel.dataLabelPtrAtOffset(patchOffsetMethodCheckProtoStruct), prototypeStructure);
+ repatchBuffer.repatch(methodCallLinkInfo.structureLabel.dataLabelPtrAtOffset(patchOffsetMethodCheckPutFunction), callee);
+
+ repatchBuffer.relinkCallerToFunction(returnAddress, FunctionPtr(cti_op_get_by_id));
+}
+
+void JIT::patchPutByIdReplace(CodeBlock* codeBlock, StructureStubInfo* stubInfo, Structure* structure, size_t cachedOffset, ReturnAddressPtr returnAddress, bool direct)
+{
+ RepatchBuffer repatchBuffer(codeBlock);
+
+ // We don't want to patch more than once - in future go to cti_op_put_by_id_generic.
+ // Should probably go to cti_op_put_by_id_fail, but that doesn't do anything interesting right now.
+ repatchBuffer.relinkCallerToFunction(returnAddress, FunctionPtr(direct ? cti_op_put_by_id_direct_generic : cti_op_put_by_id_generic));
+
+ int offset = sizeof(JSValue) * cachedOffset;
+
+ // If we're patching to use inline storage, convert the initial load to a lea; this avoids the extra load
+ // and makes the subsequent load's offset automatically correct
+ if (structure->isUsingInlineStorage())
+ repatchBuffer.repatchLoadPtrToLEA(stubInfo->hotPathBegin.instructionAtOffset(patchOffsetPutByIdExternalLoad));
+
+ // Patch the offset into the propoerty map to load from, then patch the Structure to look for.
+ repatchBuffer.repatch(stubInfo->hotPathBegin.dataLabelPtrAtOffset(patchOffsetPutByIdStructure), structure);
+ repatchBuffer.repatch(stubInfo->hotPathBegin.dataLabel32AtOffset(patchOffsetPutByIdPropertyMapOffset), offset);
+}
+
+void JIT::privateCompilePatchGetArrayLength(ReturnAddressPtr returnAddress)
+{
+ StructureStubInfo* stubInfo = &m_codeBlock->getStubInfo(returnAddress);
+
+ // Check eax is an array
+ Jump failureCases1 = branchPtr(NotEqual, Address(regT0), ImmPtr(m_globalData->jsArrayVPtr));
+
+ // Checks out okay! - get the length from the storage
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(JSArray, m_storage)), regT3);
+ load32(Address(regT3, OBJECT_OFFSETOF(ArrayStorage, m_length)), regT2);
+ Jump failureCases2 = branch32(Above, regT2, Imm32(JSImmediate::maxImmediateInt));
+
+ emitFastArithIntToImmNoCheck(regT2, regT0);
+ Jump success = jump();
+
+ LinkBuffer patchBuffer(this, m_codeBlock->executablePool(), 0);
+
+ // Use the patch information to link the failure cases back to the original slow case routine.
+ CodeLocationLabel slowCaseBegin = stubInfo->callReturnLocation.labelAtOffset(-patchOffsetGetByIdSlowCaseCall);
+ patchBuffer.link(failureCases1, slowCaseBegin);
+ patchBuffer.link(failureCases2, slowCaseBegin);
+
+ // On success return back to the hot patch code, at a point it will perform the store to dest for us.
+ patchBuffer.link(success, stubInfo->hotPathBegin.labelAtOffset(patchOffsetGetByIdPutResult));
+
+ // Track the stub we have created so that it will be deleted later.
+ CodeLocationLabel entryLabel = patchBuffer.finalizeCodeAddendum();
+ stubInfo->stubRoutine = entryLabel;
+
+ // Finally patch the jump to slow case back in the hot path to jump here instead.
+ CodeLocationJump jumpLocation = stubInfo->hotPathBegin.jumpAtOffset(patchOffsetGetByIdBranchToSlowCase);
+ RepatchBuffer repatchBuffer(m_codeBlock);
+ repatchBuffer.relink(jumpLocation, entryLabel);
+
+ // We don't want to patch more than once - in future go to cti_op_put_by_id_generic.
+ repatchBuffer.relinkCallerToFunction(returnAddress, FunctionPtr(cti_op_get_by_id_array_fail));
+}
+
+void JIT::privateCompileGetByIdProto(StructureStubInfo* stubInfo, Structure* structure, Structure* prototypeStructure, const Identifier& ident, const PropertySlot& slot, size_t cachedOffset, ReturnAddressPtr returnAddress, CallFrame* callFrame)
+{
+ // The prototype object definitely exists (if this stub exists the CodeBlock is referencing a Structure that is
+ // referencing the prototype object - let's speculatively load it's table nice and early!)
+ JSObject* protoObject = asObject(structure->prototypeForLookup(callFrame));
+
+ // Check eax is an object of the right Structure.
+ Jump failureCases1 = checkStructure(regT0, structure);
+
+ // Check the prototype object's Structure had not changed.
+ Structure** prototypeStructureAddress = &(protoObject->m_structure);
+#if CPU(X86_64)
+ move(ImmPtr(prototypeStructure), regT3);
+ Jump failureCases2 = branchPtr(NotEqual, AbsoluteAddress(prototypeStructureAddress), regT3);
+#else
+ Jump failureCases2 = branchPtr(NotEqual, AbsoluteAddress(prototypeStructureAddress), ImmPtr(prototypeStructure));
+#endif
+
+ bool needsStubLink = false;
+
+ // Checks out okay!
+ if (slot.cachedPropertyType() == PropertySlot::Getter) {
+ needsStubLink = true;
+ compileGetDirectOffset(protoObject, regT1, regT1, cachedOffset);
+ JITStubCall stubCall(this, cti_op_get_by_id_getter_stub);
+ stubCall.addArgument(regT1);
+ stubCall.addArgument(regT0);
+ stubCall.addArgument(ImmPtr(stubInfo->callReturnLocation.executableAddress()));
+ stubCall.call();
+ } else if (slot.cachedPropertyType() == PropertySlot::Custom) {
+ needsStubLink = true;
+ JITStubCall stubCall(this, cti_op_get_by_id_custom_stub);
+ stubCall.addArgument(ImmPtr(protoObject));
+ stubCall.addArgument(ImmPtr(FunctionPtr(slot.customGetter()).executableAddress()));
+ stubCall.addArgument(ImmPtr(const_cast<Identifier*>(&ident)));
+ stubCall.addArgument(ImmPtr(stubInfo->callReturnLocation.executableAddress()));
+ stubCall.call();
+ } else
+ compileGetDirectOffset(protoObject, regT1, regT0, cachedOffset);
+ Jump success = jump();
+ LinkBuffer patchBuffer(this, m_codeBlock->executablePool(), 0);
+
+ // Use the patch information to link the failure cases back to the original slow case routine.
+ CodeLocationLabel slowCaseBegin = stubInfo->callReturnLocation.labelAtOffset(-patchOffsetGetByIdSlowCaseCall);
+ patchBuffer.link(failureCases1, slowCaseBegin);
+ patchBuffer.link(failureCases2, slowCaseBegin);
+
+ // On success return back to the hot patch code, at a point it will perform the store to dest for us.
+ patchBuffer.link(success, stubInfo->hotPathBegin.labelAtOffset(patchOffsetGetByIdPutResult));
+
+ if (needsStubLink) {
+ for (Vector<CallRecord>::iterator iter = m_calls.begin(); iter != m_calls.end(); ++iter) {
+ if (iter->to)
+ patchBuffer.link(iter->from, FunctionPtr(iter->to));
+ }
+ }
+ // Track the stub we have created so that it will be deleted later.
+ CodeLocationLabel entryLabel = patchBuffer.finalizeCodeAddendum();
+ stubInfo->stubRoutine = entryLabel;
+
+ // Finally patch the jump to slow case back in the hot path to jump here instead.
+ CodeLocationJump jumpLocation = stubInfo->hotPathBegin.jumpAtOffset(patchOffsetGetByIdBranchToSlowCase);
+ RepatchBuffer repatchBuffer(m_codeBlock);
+ repatchBuffer.relink(jumpLocation, entryLabel);
+
+ // We don't want to patch more than once - in future go to cti_op_put_by_id_generic.
+ repatchBuffer.relinkCallerToFunction(returnAddress, FunctionPtr(cti_op_get_by_id_proto_list));
+}
+
+void JIT::privateCompileGetByIdSelfList(StructureStubInfo* stubInfo, PolymorphicAccessStructureList* polymorphicStructures, int currentIndex, Structure* structure, const Identifier& ident, const PropertySlot& slot, size_t cachedOffset)
+{
+ Jump failureCase = checkStructure(regT0, structure);
+ bool needsStubLink = false;
+ if (slot.cachedPropertyType() == PropertySlot::Getter) {
+ needsStubLink = true;
+ if (!structure->isUsingInlineStorage()) {
+ move(regT0, regT1);
+ compileGetDirectOffset(regT1, regT1, structure, cachedOffset);
+ } else
+ compileGetDirectOffset(regT0, regT1, structure, cachedOffset);
+ JITStubCall stubCall(this, cti_op_get_by_id_getter_stub);
+ stubCall.addArgument(regT1);
+ stubCall.addArgument(regT0);
+ stubCall.addArgument(ImmPtr(stubInfo->callReturnLocation.executableAddress()));
+ stubCall.call();
+ } else if (slot.cachedPropertyType() == PropertySlot::Custom) {
+ needsStubLink = true;
+ JITStubCall stubCall(this, cti_op_get_by_id_custom_stub);
+ stubCall.addArgument(regT0);
+ stubCall.addArgument(ImmPtr(FunctionPtr(slot.customGetter()).executableAddress()));
+ stubCall.addArgument(ImmPtr(const_cast<Identifier*>(&ident)));
+ stubCall.addArgument(ImmPtr(stubInfo->callReturnLocation.executableAddress()));
+ stubCall.call();
+ } else
+ compileGetDirectOffset(regT0, regT0, structure, cachedOffset);
+ Jump success = jump();
+
+ LinkBuffer patchBuffer(this, m_codeBlock->executablePool(), 0);
+
+ if (needsStubLink) {
+ for (Vector<CallRecord>::iterator iter = m_calls.begin(); iter != m_calls.end(); ++iter) {
+ if (iter->to)
+ patchBuffer.link(iter->from, FunctionPtr(iter->to));
+ }
+ }
+
+ // Use the patch information to link the failure cases back to the original slow case routine.
+ CodeLocationLabel lastProtoBegin = polymorphicStructures->list[currentIndex - 1].stubRoutine;
+ if (!lastProtoBegin)
+ lastProtoBegin = stubInfo->callReturnLocation.labelAtOffset(-patchOffsetGetByIdSlowCaseCall);
+
+ patchBuffer.link(failureCase, lastProtoBegin);
+
+ // On success return back to the hot patch code, at a point it will perform the store to dest for us.
+ patchBuffer.link(success, stubInfo->hotPathBegin.labelAtOffset(patchOffsetGetByIdPutResult));
+
+ CodeLocationLabel entryLabel = patchBuffer.finalizeCodeAddendum();
+
+ structure->ref();
+ polymorphicStructures->list[currentIndex].set(entryLabel, structure);
+
+ // Finally patch the jump to slow case back in the hot path to jump here instead.
+ CodeLocationJump jumpLocation = stubInfo->hotPathBegin.jumpAtOffset(patchOffsetGetByIdBranchToSlowCase);
+ RepatchBuffer repatchBuffer(m_codeBlock);
+ repatchBuffer.relink(jumpLocation, entryLabel);
+}
+
+void JIT::privateCompileGetByIdProtoList(StructureStubInfo* stubInfo, PolymorphicAccessStructureList* prototypeStructures, int currentIndex, Structure* structure, Structure* prototypeStructure, const Identifier& ident, const PropertySlot& slot, size_t cachedOffset, CallFrame* callFrame)
+{
+ // The prototype object definitely exists (if this stub exists the CodeBlock is referencing a Structure that is
+ // referencing the prototype object - let's speculatively load it's table nice and early!)
+ JSObject* protoObject = asObject(structure->prototypeForLookup(callFrame));
+
+ // Check eax is an object of the right Structure.
+ Jump failureCases1 = checkStructure(regT0, structure);
+
+ // Check the prototype object's Structure had not changed.
+ Structure** prototypeStructureAddress = &(protoObject->m_structure);
+#if CPU(X86_64)
+ move(ImmPtr(prototypeStructure), regT3);
+ Jump failureCases2 = branchPtr(NotEqual, AbsoluteAddress(prototypeStructureAddress), regT3);
+#else
+ Jump failureCases2 = branchPtr(NotEqual, AbsoluteAddress(prototypeStructureAddress), ImmPtr(prototypeStructure));
+#endif
+
+ // Checks out okay!
+ bool needsStubLink = false;
+ if (slot.cachedPropertyType() == PropertySlot::Getter) {
+ needsStubLink = true;
+ compileGetDirectOffset(protoObject, regT1, regT1, cachedOffset);
+ JITStubCall stubCall(this, cti_op_get_by_id_getter_stub);
+ stubCall.addArgument(regT1);
+ stubCall.addArgument(regT0);
+ stubCall.addArgument(ImmPtr(stubInfo->callReturnLocation.executableAddress()));
+ stubCall.call();
+ } else if (slot.cachedPropertyType() == PropertySlot::Custom) {
+ needsStubLink = true;
+ JITStubCall stubCall(this, cti_op_get_by_id_custom_stub);
+ stubCall.addArgument(ImmPtr(protoObject));
+ stubCall.addArgument(ImmPtr(FunctionPtr(slot.customGetter()).executableAddress()));
+ stubCall.addArgument(ImmPtr(const_cast<Identifier*>(&ident)));
+ stubCall.addArgument(ImmPtr(stubInfo->callReturnLocation.executableAddress()));
+ stubCall.call();
+ } else
+ compileGetDirectOffset(protoObject, regT1, regT0, cachedOffset);
+
+ Jump success = jump();
+
+ LinkBuffer patchBuffer(this, m_codeBlock->executablePool(), 0);
+
+ if (needsStubLink) {
+ for (Vector<CallRecord>::iterator iter = m_calls.begin(); iter != m_calls.end(); ++iter) {
+ if (iter->to)
+ patchBuffer.link(iter->from, FunctionPtr(iter->to));
+ }
+ }
+
+ // Use the patch information to link the failure cases back to the original slow case routine.
+ CodeLocationLabel lastProtoBegin = prototypeStructures->list[currentIndex - 1].stubRoutine;
+ patchBuffer.link(failureCases1, lastProtoBegin);
+ patchBuffer.link(failureCases2, lastProtoBegin);
+
+ // On success return back to the hot patch code, at a point it will perform the store to dest for us.
+ patchBuffer.link(success, stubInfo->hotPathBegin.labelAtOffset(patchOffsetGetByIdPutResult));
+
+ CodeLocationLabel entryLabel = patchBuffer.finalizeCodeAddendum();
+
+ structure->ref();
+ prototypeStructure->ref();
+ prototypeStructures->list[currentIndex].set(entryLabel, structure, prototypeStructure);
+
+ // Finally patch the jump to slow case back in the hot path to jump here instead.
+ CodeLocationJump jumpLocation = stubInfo->hotPathBegin.jumpAtOffset(patchOffsetGetByIdBranchToSlowCase);
+ RepatchBuffer repatchBuffer(m_codeBlock);
+ repatchBuffer.relink(jumpLocation, entryLabel);
+}
+
+void JIT::privateCompileGetByIdChainList(StructureStubInfo* stubInfo, PolymorphicAccessStructureList* prototypeStructures, int currentIndex, Structure* structure, StructureChain* chain, size_t count, const Identifier& ident, const PropertySlot& slot, size_t cachedOffset, CallFrame* callFrame)
+{
+ ASSERT(count);
+ JumpList bucketsOfFail;
+
+ // Check eax is an object of the right Structure.
+ Jump baseObjectCheck = checkStructure(regT0, structure);
+ bucketsOfFail.append(baseObjectCheck);
+
+ Structure* currStructure = structure;
+ RefPtr<Structure>* it = chain->head();
+ JSObject* protoObject = 0;
+ for (unsigned i = 0; i < count; ++i, ++it) {
+ protoObject = asObject(currStructure->prototypeForLookup(callFrame));
+ currStructure = it->get();
+ testPrototype(protoObject, bucketsOfFail);
+ }
+ ASSERT(protoObject);
+
+ bool needsStubLink = false;
+ if (slot.cachedPropertyType() == PropertySlot::Getter) {
+ needsStubLink = true;
+ compileGetDirectOffset(protoObject, regT1, regT1, cachedOffset);
+ JITStubCall stubCall(this, cti_op_get_by_id_getter_stub);
+ stubCall.addArgument(regT1);
+ stubCall.addArgument(regT0);
+ stubCall.addArgument(ImmPtr(stubInfo->callReturnLocation.executableAddress()));
+ stubCall.call();
+ } else if (slot.cachedPropertyType() == PropertySlot::Custom) {
+ needsStubLink = true;
+ JITStubCall stubCall(this, cti_op_get_by_id_custom_stub);
+ stubCall.addArgument(ImmPtr(protoObject));
+ stubCall.addArgument(ImmPtr(FunctionPtr(slot.customGetter()).executableAddress()));
+ stubCall.addArgument(ImmPtr(const_cast<Identifier*>(&ident)));
+ stubCall.addArgument(ImmPtr(stubInfo->callReturnLocation.executableAddress()));
+ stubCall.call();
+ } else
+ compileGetDirectOffset(protoObject, regT1, regT0, cachedOffset);
+ Jump success = jump();
+
+ LinkBuffer patchBuffer(this, m_codeBlock->executablePool(), 0);
+
+ if (needsStubLink) {
+ for (Vector<CallRecord>::iterator iter = m_calls.begin(); iter != m_calls.end(); ++iter) {
+ if (iter->to)
+ patchBuffer.link(iter->from, FunctionPtr(iter->to));
+ }
+ }
+
+ // Use the patch information to link the failure cases back to the original slow case routine.
+ CodeLocationLabel lastProtoBegin = prototypeStructures->list[currentIndex - 1].stubRoutine;
+
+ patchBuffer.link(bucketsOfFail, lastProtoBegin);
+
+ // On success return back to the hot patch code, at a point it will perform the store to dest for us.
+ patchBuffer.link(success, stubInfo->hotPathBegin.labelAtOffset(patchOffsetGetByIdPutResult));
+
+ CodeLocationLabel entryLabel = patchBuffer.finalizeCodeAddendum();
+
+ // Track the stub we have created so that it will be deleted later.
+ structure->ref();
+ chain->ref();
+ prototypeStructures->list[currentIndex].set(entryLabel, structure, chain);
+
+ // Finally patch the jump to slow case back in the hot path to jump here instead.
+ CodeLocationJump jumpLocation = stubInfo->hotPathBegin.jumpAtOffset(patchOffsetGetByIdBranchToSlowCase);
+ RepatchBuffer repatchBuffer(m_codeBlock);
+ repatchBuffer.relink(jumpLocation, entryLabel);
+}
+
+void JIT::privateCompileGetByIdChain(StructureStubInfo* stubInfo, Structure* structure, StructureChain* chain, size_t count, const Identifier& ident, const PropertySlot& slot, size_t cachedOffset, ReturnAddressPtr returnAddress, CallFrame* callFrame)
+{
+ ASSERT(count);
+
+ JumpList bucketsOfFail;
+
+ // Check eax is an object of the right Structure.
+ bucketsOfFail.append(checkStructure(regT0, structure));
+
+ Structure* currStructure = structure;
+ RefPtr<Structure>* it = chain->head();
+ JSObject* protoObject = 0;
+ for (unsigned i = 0; i < count; ++i, ++it) {
+ protoObject = asObject(currStructure->prototypeForLookup(callFrame));
+ currStructure = it->get();
+ testPrototype(protoObject, bucketsOfFail);
+ }
+ ASSERT(protoObject);
+
+ bool needsStubLink = false;
+ if (slot.cachedPropertyType() == PropertySlot::Getter) {
+ needsStubLink = true;
+ compileGetDirectOffset(protoObject, regT1, regT1, cachedOffset);
+ JITStubCall stubCall(this, cti_op_get_by_id_getter_stub);
+ stubCall.addArgument(regT1);
+ stubCall.addArgument(regT0);
+ stubCall.addArgument(ImmPtr(stubInfo->callReturnLocation.executableAddress()));
+ stubCall.call();
+ } else if (slot.cachedPropertyType() == PropertySlot::Custom) {
+ needsStubLink = true;
+ JITStubCall stubCall(this, cti_op_get_by_id_custom_stub);
+ stubCall.addArgument(ImmPtr(protoObject));
+ stubCall.addArgument(ImmPtr(FunctionPtr(slot.customGetter()).executableAddress()));
+ stubCall.addArgument(ImmPtr(const_cast<Identifier*>(&ident)));
+ stubCall.addArgument(ImmPtr(stubInfo->callReturnLocation.executableAddress()));
+ stubCall.call();
+ } else
+ compileGetDirectOffset(protoObject, regT1, regT0, cachedOffset);
+ Jump success = jump();
+
+ LinkBuffer patchBuffer(this, m_codeBlock->executablePool(), 0);
+
+ if (needsStubLink) {
+ for (Vector<CallRecord>::iterator iter = m_calls.begin(); iter != m_calls.end(); ++iter) {
+ if (iter->to)
+ patchBuffer.link(iter->from, FunctionPtr(iter->to));
+ }
+ }
+
+ // Use the patch information to link the failure cases back to the original slow case routine.
+ patchBuffer.link(bucketsOfFail, stubInfo->callReturnLocation.labelAtOffset(-patchOffsetGetByIdSlowCaseCall));
+
+ // On success return back to the hot patch code, at a point it will perform the store to dest for us.
+ patchBuffer.link(success, stubInfo->hotPathBegin.labelAtOffset(patchOffsetGetByIdPutResult));
+
+ // Track the stub we have created so that it will be deleted later.
+ CodeLocationLabel entryLabel = patchBuffer.finalizeCodeAddendum();
+ stubInfo->stubRoutine = entryLabel;
+
+ // Finally patch the jump to slow case back in the hot path to jump here instead.
+ CodeLocationJump jumpLocation = stubInfo->hotPathBegin.jumpAtOffset(patchOffsetGetByIdBranchToSlowCase);
+ RepatchBuffer repatchBuffer(m_codeBlock);
+ repatchBuffer.relink(jumpLocation, entryLabel);
+
+ // We don't want to patch more than once - in future go to cti_op_put_by_id_generic.
+ repatchBuffer.relinkCallerToFunction(returnAddress, FunctionPtr(cti_op_get_by_id_proto_list));
+}
+
+/* ------------------------------ END: !ENABLE / ENABLE(JIT_OPTIMIZE_PROPERTY_ACCESS) ------------------------------ */
+
+#endif // !ENABLE(JIT_OPTIMIZE_PROPERTY_ACCESS)
+
+} // namespace JSC
+
+#endif // USE(JSVALUE64)
+#endif // ENABLE(JIT)
diff --git a/Source/JavaScriptCore/jit/JITPropertyAccess32_64.cpp b/Source/JavaScriptCore/jit/JITPropertyAccess32_64.cpp
new file mode 100644
index 0000000..710a155
--- /dev/null
+++ b/Source/JavaScriptCore/jit/JITPropertyAccess32_64.cpp
@@ -0,0 +1,1186 @@
+/*
+ * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if ENABLE(JIT)
+#if USE(JSVALUE32_64)
+#include "JIT.h"
+
+#include "CodeBlock.h"
+#include "JITInlineMethods.h"
+#include "JITStubCall.h"
+#include "JSArray.h"
+#include "JSFunction.h"
+#include "JSPropertyNameIterator.h"
+#include "Interpreter.h"
+#include "LinkBuffer.h"
+#include "RepatchBuffer.h"
+#include "ResultType.h"
+#include "SamplingTool.h"
+
+#ifndef NDEBUG
+#include <stdio.h>
+#endif
+
+using namespace std;
+
+namespace JSC {
+
+void JIT::emit_op_put_by_index(Instruction* currentInstruction)
+{
+ unsigned base = currentInstruction[1].u.operand;
+ unsigned property = currentInstruction[2].u.operand;
+ unsigned value = currentInstruction[3].u.operand;
+
+ JITStubCall stubCall(this, cti_op_put_by_index);
+ stubCall.addArgument(base);
+ stubCall.addArgument(Imm32(property));
+ stubCall.addArgument(value);
+ stubCall.call();
+}
+
+void JIT::emit_op_put_getter(Instruction* currentInstruction)
+{
+ unsigned base = currentInstruction[1].u.operand;
+ unsigned property = currentInstruction[2].u.operand;
+ unsigned function = currentInstruction[3].u.operand;
+
+ JITStubCall stubCall(this, cti_op_put_getter);
+ stubCall.addArgument(base);
+ stubCall.addArgument(ImmPtr(&m_codeBlock->identifier(property)));
+ stubCall.addArgument(function);
+ stubCall.call();
+}
+
+void JIT::emit_op_put_setter(Instruction* currentInstruction)
+{
+ unsigned base = currentInstruction[1].u.operand;
+ unsigned property = currentInstruction[2].u.operand;
+ unsigned function = currentInstruction[3].u.operand;
+
+ JITStubCall stubCall(this, cti_op_put_setter);
+ stubCall.addArgument(base);
+ stubCall.addArgument(ImmPtr(&m_codeBlock->identifier(property)));
+ stubCall.addArgument(function);
+ stubCall.call();
+}
+
+void JIT::emit_op_del_by_id(Instruction* currentInstruction)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+ unsigned base = currentInstruction[2].u.operand;
+ unsigned property = currentInstruction[3].u.operand;
+
+ JITStubCall stubCall(this, cti_op_del_by_id);
+ stubCall.addArgument(base);
+ stubCall.addArgument(ImmPtr(&m_codeBlock->identifier(property)));
+ stubCall.call(dst);
+}
+
+
+#if !ENABLE(JIT_OPTIMIZE_PROPERTY_ACCESS)
+
+/* ------------------------------ BEGIN: !ENABLE(JIT_OPTIMIZE_PROPERTY_ACCESS) ------------------------------ */
+
+// Treat these as nops - the call will be handed as a regular get_by_id/op_call pair.
+void JIT::emit_op_method_check(Instruction*) {}
+void JIT::emitSlow_op_method_check(Instruction*, Vector<SlowCaseEntry>::iterator&) { ASSERT_NOT_REACHED(); }
+#if ENABLE(JIT_OPTIMIZE_METHOD_CALLS)
+#error "JIT_OPTIMIZE_METHOD_CALLS requires JIT_OPTIMIZE_PROPERTY_ACCESS"
+#endif
+
+void JIT::emit_op_get_by_val(Instruction* currentInstruction)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+ unsigned base = currentInstruction[2].u.operand;
+ unsigned property = currentInstruction[3].u.operand;
+
+ JITStubCall stubCall(this, cti_op_get_by_val);
+ stubCall.addArgument(base);
+ stubCall.addArgument(property);
+ stubCall.call(dst);
+}
+
+void JIT::emitSlow_op_get_by_val(Instruction*, Vector<SlowCaseEntry>::iterator&)
+{
+ ASSERT_NOT_REACHED();
+}
+
+void JIT::emit_op_put_by_val(Instruction* currentInstruction)
+{
+ unsigned base = currentInstruction[1].u.operand;
+ unsigned property = currentInstruction[2].u.operand;
+ unsigned value = currentInstruction[3].u.operand;
+
+ JITStubCall stubCall(this, cti_op_put_by_val);
+ stubCall.addArgument(base);
+ stubCall.addArgument(property);
+ stubCall.addArgument(value);
+ stubCall.call();
+}
+
+void JIT::emitSlow_op_put_by_val(Instruction*, Vector<SlowCaseEntry>::iterator&)
+{
+ ASSERT_NOT_REACHED();
+}
+
+void JIT::emit_op_get_by_id(Instruction* currentInstruction)
+{
+ int dst = currentInstruction[1].u.operand;
+ int base = currentInstruction[2].u.operand;
+ int ident = currentInstruction[3].u.operand;
+
+ JITStubCall stubCall(this, cti_op_get_by_id_generic);
+ stubCall.addArgument(base);
+ stubCall.addArgument(ImmPtr(&(m_codeBlock->identifier(ident))));
+ stubCall.call(dst);
+
+ m_propertyAccessInstructionIndex++;
+}
+
+void JIT::emitSlow_op_get_by_id(Instruction*, Vector<SlowCaseEntry>::iterator&)
+{
+ m_propertyAccessInstructionIndex++;
+ ASSERT_NOT_REACHED();
+}
+
+void JIT::emit_op_put_by_id(Instruction* currentInstruction)
+{
+ int base = currentInstruction[1].u.operand;
+ int ident = currentInstruction[2].u.operand;
+ int value = currentInstruction[3].u.operand;
+
+ JITStubCall stubCall(this, cti_op_put_by_id_generic);
+ stubCall.addArgument(base);
+ stubCall.addArgument(ImmPtr(&(m_codeBlock->identifier(ident))));
+ stubCall.addArgument(value);
+ stubCall.call();
+
+ m_propertyAccessInstructionIndex++;
+}
+
+void JIT::emitSlow_op_put_by_id(Instruction*, Vector<SlowCaseEntry>::iterator&)
+{
+ m_propertyAccessInstructionIndex++;
+ ASSERT_NOT_REACHED();
+}
+
+#else // !ENABLE(JIT_OPTIMIZE_PROPERTY_ACCESS)
+
+/* ------------------------------ BEGIN: ENABLE(JIT_OPTIMIZE_PROPERTY_ACCESS) ------------------------------ */
+
+#if ENABLE(JIT_OPTIMIZE_METHOD_CALLS)
+
+void JIT::emit_op_method_check(Instruction* currentInstruction)
+{
+ // Assert that the following instruction is a get_by_id.
+ ASSERT(m_interpreter->getOpcodeID((currentInstruction + OPCODE_LENGTH(op_method_check))->u.opcode) == op_get_by_id);
+
+ currentInstruction += OPCODE_LENGTH(op_method_check);
+
+ // Do the method check - check the object & its prototype's structure inline (this is the common case).
+ m_methodCallCompilationInfo.append(MethodCallCompilationInfo(m_propertyAccessInstructionIndex));
+ MethodCallCompilationInfo& info = m_methodCallCompilationInfo.last();
+
+ int dst = currentInstruction[1].u.operand;
+ int base = currentInstruction[2].u.operand;
+
+ emitLoad(base, regT1, regT0);
+ emitJumpSlowCaseIfNotJSCell(base, regT1);
+
+ BEGIN_UNINTERRUPTED_SEQUENCE(sequenceMethodCheck);
+
+ Jump structureCheck = branchPtrWithPatch(NotEqual, Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), info.structureToCompare, ImmPtr(reinterpret_cast<void*>(patchGetByIdDefaultStructure)));
+ DataLabelPtr protoStructureToCompare, protoObj = moveWithPatch(ImmPtr(0), regT2);
+ Jump protoStructureCheck = branchPtrWithPatch(NotEqual, Address(regT2, OBJECT_OFFSETOF(JSCell, m_structure)), protoStructureToCompare, ImmPtr(reinterpret_cast<void*>(patchGetByIdDefaultStructure)));
+
+ // This will be relinked to load the function without doing a load.
+ DataLabelPtr putFunction = moveWithPatch(ImmPtr(0), regT0);
+
+ END_UNINTERRUPTED_SEQUENCE(sequenceMethodCheck);
+
+ move(Imm32(JSValue::CellTag), regT1);
+ Jump match = jump();
+
+ ASSERT(differenceBetween(info.structureToCompare, protoObj) == patchOffsetMethodCheckProtoObj);
+ ASSERT(differenceBetween(info.structureToCompare, protoStructureToCompare) == patchOffsetMethodCheckProtoStruct);
+ ASSERT(differenceBetween(info.structureToCompare, putFunction) == patchOffsetMethodCheckPutFunction);
+
+ // Link the failure cases here.
+ structureCheck.link(this);
+ protoStructureCheck.link(this);
+
+ // Do a regular(ish) get_by_id (the slow case will be link to
+ // cti_op_get_by_id_method_check instead of cti_op_get_by_id.
+ compileGetByIdHotPath();
+
+ match.link(this);
+ emitStore(dst, regT1, regT0);
+ map(m_bytecodeOffset + OPCODE_LENGTH(op_method_check), dst, regT1, regT0);
+
+ // We've already generated the following get_by_id, so make sure it's skipped over.
+ m_bytecodeOffset += OPCODE_LENGTH(op_get_by_id);
+}
+
+void JIT::emitSlow_op_method_check(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ currentInstruction += OPCODE_LENGTH(op_method_check);
+
+ int dst = currentInstruction[1].u.operand;
+ int base = currentInstruction[2].u.operand;
+ int ident = currentInstruction[3].u.operand;
+
+ compileGetByIdSlowCase(dst, base, &(m_codeBlock->identifier(ident)), iter, true);
+
+ // We've already generated the following get_by_id, so make sure it's skipped over.
+ m_bytecodeOffset += OPCODE_LENGTH(op_get_by_id);
+}
+
+#else //!ENABLE(JIT_OPTIMIZE_METHOD_CALLS)
+
+// Treat these as nops - the call will be handed as a regular get_by_id/op_call pair.
+void JIT::emit_op_method_check(Instruction*) {}
+void JIT::emitSlow_op_method_check(Instruction*, Vector<SlowCaseEntry>::iterator&) { ASSERT_NOT_REACHED(); }
+
+#endif
+
+JIT::CodePtr JIT::stringGetByValStubGenerator(JSGlobalData* globalData, ExecutablePool* pool)
+{
+ JSInterfaceJIT jit;
+ JumpList failures;
+ failures.append(jit.branchPtr(NotEqual, Address(regT0), ImmPtr(globalData->jsStringVPtr)));
+ failures.append(jit.branchTest32(NonZero, Address(regT0, OBJECT_OFFSETOF(JSString, m_fiberCount))));
+
+ // Load string length to regT1, and start the process of loading the data pointer into regT0
+ jit.load32(Address(regT0, ThunkHelpers::jsStringLengthOffset()), regT1);
+ jit.loadPtr(Address(regT0, ThunkHelpers::jsStringValueOffset()), regT0);
+ jit.loadPtr(Address(regT0, ThunkHelpers::stringImplDataOffset()), regT0);
+
+ // Do an unsigned compare to simultaneously filter negative indices as well as indices that are too large
+ failures.append(jit.branch32(AboveOrEqual, regT2, regT1));
+
+ // Load the character
+ jit.load16(BaseIndex(regT0, regT2, TimesTwo, 0), regT0);
+
+ failures.append(jit.branch32(AboveOrEqual, regT0, Imm32(0x100)));
+ jit.move(ImmPtr(globalData->smallStrings.singleCharacterStrings()), regT1);
+ jit.loadPtr(BaseIndex(regT1, regT0, ScalePtr, 0), regT0);
+ jit.move(Imm32(JSValue::CellTag), regT1); // We null check regT0 on return so this is safe
+ jit.ret();
+
+ failures.link(&jit);
+ jit.move(Imm32(0), regT0);
+ jit.ret();
+
+ LinkBuffer patchBuffer(&jit, pool, 0);
+ return patchBuffer.finalizeCode().m_code;
+}
+
+void JIT::emit_op_get_by_val(Instruction* currentInstruction)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+ unsigned base = currentInstruction[2].u.operand;
+ unsigned property = currentInstruction[3].u.operand;
+
+ emitLoad2(base, regT1, regT0, property, regT3, regT2);
+
+ addSlowCase(branch32(NotEqual, regT3, Imm32(JSValue::Int32Tag)));
+ emitJumpSlowCaseIfNotJSCell(base, regT1);
+ addSlowCase(branchPtr(NotEqual, Address(regT0), ImmPtr(m_globalData->jsArrayVPtr)));
+
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(JSArray, m_storage)), regT3);
+ addSlowCase(branch32(AboveOrEqual, regT2, Address(regT0, OBJECT_OFFSETOF(JSArray, m_vectorLength))));
+
+ load32(BaseIndex(regT3, regT2, TimesEight, OBJECT_OFFSETOF(ArrayStorage, m_vector[0]) + OBJECT_OFFSETOF(JSValue, u.asBits.tag)), regT1); // tag
+ load32(BaseIndex(regT3, regT2, TimesEight, OBJECT_OFFSETOF(ArrayStorage, m_vector[0]) + OBJECT_OFFSETOF(JSValue, u.asBits.payload)), regT0); // payload
+ addSlowCase(branch32(Equal, regT1, Imm32(JSValue::EmptyValueTag)));
+
+ emitStore(dst, regT1, regT0);
+ map(m_bytecodeOffset + OPCODE_LENGTH(op_get_by_val), dst, regT1, regT0);
+}
+
+void JIT::emitSlow_op_get_by_val(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+ unsigned base = currentInstruction[2].u.operand;
+ unsigned property = currentInstruction[3].u.operand;
+
+ linkSlowCase(iter); // property int32 check
+ linkSlowCaseIfNotJSCell(iter, base); // base cell check
+
+ Jump nonCell = jump();
+ linkSlowCase(iter); // base array check
+ Jump notString = branchPtr(NotEqual, Address(regT0), ImmPtr(m_globalData->jsStringVPtr));
+ emitNakedCall(m_globalData->getCTIStub(stringGetByValStubGenerator));
+ Jump failed = branchTestPtr(Zero, regT0);
+ emitStore(dst, regT1, regT0);
+ emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_get_by_val));
+ failed.link(this);
+ notString.link(this);
+ nonCell.link(this);
+
+ linkSlowCase(iter); // vector length check
+ linkSlowCase(iter); // empty value
+
+ JITStubCall stubCall(this, cti_op_get_by_val);
+ stubCall.addArgument(base);
+ stubCall.addArgument(property);
+ stubCall.call(dst);
+}
+
+void JIT::emit_op_put_by_val(Instruction* currentInstruction)
+{
+ unsigned base = currentInstruction[1].u.operand;
+ unsigned property = currentInstruction[2].u.operand;
+ unsigned value = currentInstruction[3].u.operand;
+
+ emitLoad2(base, regT1, regT0, property, regT3, regT2);
+
+ addSlowCase(branch32(NotEqual, regT3, Imm32(JSValue::Int32Tag)));
+ emitJumpSlowCaseIfNotJSCell(base, regT1);
+ addSlowCase(branchPtr(NotEqual, Address(regT0), ImmPtr(m_globalData->jsArrayVPtr)));
+ addSlowCase(branch32(AboveOrEqual, regT2, Address(regT0, OBJECT_OFFSETOF(JSArray, m_vectorLength))));
+
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(JSArray, m_storage)), regT3);
+
+ Jump empty = branch32(Equal, BaseIndex(regT3, regT2, TimesEight, OBJECT_OFFSETOF(ArrayStorage, m_vector[0]) + OBJECT_OFFSETOF(JSValue, u.asBits.tag)), Imm32(JSValue::EmptyValueTag));
+
+ Label storeResult(this);
+ emitLoad(value, regT1, regT0);
+ store32(regT0, BaseIndex(regT3, regT2, TimesEight, OBJECT_OFFSETOF(ArrayStorage, m_vector[0]) + OBJECT_OFFSETOF(JSValue, u.asBits.payload))); // payload
+ store32(regT1, BaseIndex(regT3, regT2, TimesEight, OBJECT_OFFSETOF(ArrayStorage, m_vector[0]) + OBJECT_OFFSETOF(JSValue, u.asBits.tag))); // tag
+ Jump end = jump();
+
+ empty.link(this);
+ add32(Imm32(1), Address(regT3, OBJECT_OFFSETOF(ArrayStorage, m_numValuesInVector)));
+ branch32(Below, regT2, Address(regT3, OBJECT_OFFSETOF(ArrayStorage, m_length))).linkTo(storeResult, this);
+
+ add32(Imm32(1), regT2, regT0);
+ store32(regT0, Address(regT3, OBJECT_OFFSETOF(ArrayStorage, m_length)));
+ jump().linkTo(storeResult, this);
+
+ end.link(this);
+}
+
+void JIT::emitSlow_op_put_by_val(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ unsigned base = currentInstruction[1].u.operand;
+ unsigned property = currentInstruction[2].u.operand;
+ unsigned value = currentInstruction[3].u.operand;
+
+ linkSlowCase(iter); // property int32 check
+ linkSlowCaseIfNotJSCell(iter, base); // base cell check
+ linkSlowCase(iter); // base not array check
+ linkSlowCase(iter); // in vector check
+
+ JITStubCall stubPutByValCall(this, cti_op_put_by_val);
+ stubPutByValCall.addArgument(base);
+ stubPutByValCall.addArgument(property);
+ stubPutByValCall.addArgument(value);
+ stubPutByValCall.call();
+}
+
+void JIT::emit_op_get_by_id(Instruction* currentInstruction)
+{
+ int dst = currentInstruction[1].u.operand;
+ int base = currentInstruction[2].u.operand;
+
+ emitLoad(base, regT1, regT0);
+ emitJumpSlowCaseIfNotJSCell(base, regT1);
+ compileGetByIdHotPath();
+ emitStore(dst, regT1, regT0);
+ map(m_bytecodeOffset + OPCODE_LENGTH(op_get_by_id), dst, regT1, regT0);
+}
+
+void JIT::compileGetByIdHotPath()
+{
+ // As for put_by_id, get_by_id requires the offset of the Structure and the offset of the access to be patched.
+ // Additionally, for get_by_id we need patch the offset of the branch to the slow case (we patch this to jump
+ // to array-length / prototype access tranpolines, and finally we also the the property-map access offset as a label
+ // to jump back to if one of these trampolies finds a match.
+
+ BEGIN_UNINTERRUPTED_SEQUENCE(sequenceGetByIdHotPath);
+
+ Label hotPathBegin(this);
+ m_propertyAccessCompilationInfo[m_propertyAccessInstructionIndex].hotPathBegin = hotPathBegin;
+ m_propertyAccessInstructionIndex++;
+
+ DataLabelPtr structureToCompare;
+ Jump structureCheck = branchPtrWithPatch(NotEqual, Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), structureToCompare, ImmPtr(reinterpret_cast<void*>(patchGetByIdDefaultStructure)));
+ addSlowCase(structureCheck);
+ ASSERT(differenceBetween(hotPathBegin, structureToCompare) == patchOffsetGetByIdStructure);
+ ASSERT(differenceBetween(hotPathBegin, structureCheck) == patchOffsetGetByIdBranchToSlowCase);
+
+ Label externalLoad = loadPtrWithPatchToLEA(Address(regT0, OBJECT_OFFSETOF(JSObject, m_externalStorage)), regT2);
+ Label externalLoadComplete(this);
+ ASSERT(differenceBetween(hotPathBegin, externalLoad) == patchOffsetGetByIdExternalLoad);
+ ASSERT(differenceBetween(externalLoad, externalLoadComplete) == patchLengthGetByIdExternalLoad);
+
+ DataLabel32 displacementLabel1 = loadPtrWithAddressOffsetPatch(Address(regT2, patchGetByIdDefaultOffset), regT0); // payload
+ ASSERT(differenceBetween(hotPathBegin, displacementLabel1) == patchOffsetGetByIdPropertyMapOffset1);
+ DataLabel32 displacementLabel2 = loadPtrWithAddressOffsetPatch(Address(regT2, patchGetByIdDefaultOffset), regT1); // tag
+ ASSERT(differenceBetween(hotPathBegin, displacementLabel2) == patchOffsetGetByIdPropertyMapOffset2);
+
+ Label putResult(this);
+ ASSERT(differenceBetween(hotPathBegin, putResult) == patchOffsetGetByIdPutResult);
+
+ END_UNINTERRUPTED_SEQUENCE(sequenceGetByIdHotPath);
+}
+
+void JIT::emitSlow_op_get_by_id(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ int dst = currentInstruction[1].u.operand;
+ int base = currentInstruction[2].u.operand;
+ int ident = currentInstruction[3].u.operand;
+
+ compileGetByIdSlowCase(dst, base, &(m_codeBlock->identifier(ident)), iter);
+}
+
+void JIT::compileGetByIdSlowCase(int dst, int base, Identifier* ident, Vector<SlowCaseEntry>::iterator& iter, bool isMethodCheck)
+{
+ // As for the hot path of get_by_id, above, we ensure that we can use an architecture specific offset
+ // so that we only need track one pointer into the slow case code - we track a pointer to the location
+ // of the call (which we can use to look up the patch information), but should a array-length or
+ // prototype access trampoline fail we want to bail out back to here. To do so we can subtract back
+ // the distance from the call to the head of the slow case.
+ linkSlowCaseIfNotJSCell(iter, base);
+ linkSlowCase(iter);
+
+ BEGIN_UNINTERRUPTED_SEQUENCE(sequenceGetByIdSlowCase);
+
+#ifndef NDEBUG
+ Label coldPathBegin(this);
+#endif
+ JITStubCall stubCall(this, isMethodCheck ? cti_op_get_by_id_method_check : cti_op_get_by_id);
+ stubCall.addArgument(regT1, regT0);
+ stubCall.addArgument(ImmPtr(ident));
+ Call call = stubCall.call(dst);
+
+ END_UNINTERRUPTED_SEQUENCE(sequenceGetByIdSlowCase);
+
+ ASSERT(differenceBetween(coldPathBegin, call) == patchOffsetGetByIdSlowCaseCall);
+
+ // Track the location of the call; this will be used to recover patch information.
+ m_propertyAccessCompilationInfo[m_propertyAccessInstructionIndex].callReturnLocation = call;
+ m_propertyAccessInstructionIndex++;
+}
+
+void JIT::emit_op_put_by_id(Instruction* currentInstruction)
+{
+ // In order to be able to patch both the Structure, and the object offset, we store one pointer,
+ // to just after the arguments have been loaded into registers 'hotPathBegin', and we generate code
+ // such that the Structure & offset are always at the same distance from this.
+
+ int base = currentInstruction[1].u.operand;
+ int value = currentInstruction[3].u.operand;
+
+ emitLoad2(base, regT1, regT0, value, regT3, regT2);
+
+ emitJumpSlowCaseIfNotJSCell(base, regT1);
+
+ BEGIN_UNINTERRUPTED_SEQUENCE(sequencePutById);
+
+ Label hotPathBegin(this);
+ m_propertyAccessCompilationInfo[m_propertyAccessInstructionIndex].hotPathBegin = hotPathBegin;
+ m_propertyAccessInstructionIndex++;
+
+ // It is important that the following instruction plants a 32bit immediate, in order that it can be patched over.
+ DataLabelPtr structureToCompare;
+ addSlowCase(branchPtrWithPatch(NotEqual, Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), structureToCompare, ImmPtr(reinterpret_cast<void*>(patchGetByIdDefaultStructure))));
+ ASSERT(differenceBetween(hotPathBegin, structureToCompare) == patchOffsetPutByIdStructure);
+
+ // Plant a load from a bogus ofset in the object's property map; we will patch this later, if it is to be used.
+ Label externalLoad = loadPtrWithPatchToLEA(Address(regT0, OBJECT_OFFSETOF(JSObject, m_externalStorage)), regT0);
+ Label externalLoadComplete(this);
+ ASSERT(differenceBetween(hotPathBegin, externalLoad) == patchOffsetPutByIdExternalLoad);
+ ASSERT(differenceBetween(externalLoad, externalLoadComplete) == patchLengthPutByIdExternalLoad);
+
+ DataLabel32 displacementLabel1 = storePtrWithAddressOffsetPatch(regT2, Address(regT0, patchGetByIdDefaultOffset)); // payload
+ DataLabel32 displacementLabel2 = storePtrWithAddressOffsetPatch(regT3, Address(regT0, patchGetByIdDefaultOffset)); // tag
+
+ END_UNINTERRUPTED_SEQUENCE(sequencePutById);
+
+ ASSERT(differenceBetween(hotPathBegin, displacementLabel1) == patchOffsetPutByIdPropertyMapOffset1);
+ ASSERT(differenceBetween(hotPathBegin, displacementLabel2) == patchOffsetPutByIdPropertyMapOffset2);
+}
+
+void JIT::emitSlow_op_put_by_id(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ int base = currentInstruction[1].u.operand;
+ int ident = currentInstruction[2].u.operand;
+ int direct = currentInstruction[8].u.operand;
+
+ linkSlowCaseIfNotJSCell(iter, base);
+ linkSlowCase(iter);
+
+ JITStubCall stubCall(this, direct ? cti_op_put_by_id_direct : cti_op_put_by_id);
+ stubCall.addArgument(regT1, regT0);
+ stubCall.addArgument(ImmPtr(&(m_codeBlock->identifier(ident))));
+ stubCall.addArgument(regT3, regT2);
+ Call call = stubCall.call();
+
+ // Track the location of the call; this will be used to recover patch information.
+ m_propertyAccessCompilationInfo[m_propertyAccessInstructionIndex].callReturnLocation = call;
+ m_propertyAccessInstructionIndex++;
+}
+
+// Compile a store into an object's property storage. May overwrite base.
+void JIT::compilePutDirectOffset(RegisterID base, RegisterID valueTag, RegisterID valuePayload, Structure* structure, size_t cachedOffset)
+{
+ int offset = cachedOffset;
+ if (structure->isUsingInlineStorage())
+ offset += OBJECT_OFFSETOF(JSObject, m_inlineStorage) / sizeof(Register);
+ else
+ loadPtr(Address(base, OBJECT_OFFSETOF(JSObject, m_externalStorage)), base);
+ emitStore(offset, valueTag, valuePayload, base);
+}
+
+// Compile a load from an object's property storage. May overwrite base.
+void JIT::compileGetDirectOffset(RegisterID base, RegisterID resultTag, RegisterID resultPayload, Structure* structure, size_t cachedOffset)
+{
+ int offset = cachedOffset;
+ if (structure->isUsingInlineStorage())
+ offset += OBJECT_OFFSETOF(JSObject, m_inlineStorage) / sizeof(Register);
+ else
+ loadPtr(Address(base, OBJECT_OFFSETOF(JSObject, m_externalStorage)), base);
+ emitLoad(offset, resultTag, resultPayload, base);
+}
+
+void JIT::compileGetDirectOffset(JSObject* base, RegisterID temp, RegisterID resultTag, RegisterID resultPayload, size_t cachedOffset)
+{
+ if (base->isUsingInlineStorage()) {
+ load32(reinterpret_cast<char*>(&base->m_inlineStorage[cachedOffset]) + OBJECT_OFFSETOF(JSValue, u.asBits.payload), resultPayload);
+ load32(reinterpret_cast<char*>(&base->m_inlineStorage[cachedOffset]) + OBJECT_OFFSETOF(JSValue, u.asBits.tag), resultTag);
+ return;
+ }
+
+ size_t offset = cachedOffset * sizeof(JSValue);
+
+ PropertyStorage* protoPropertyStorage = &base->m_externalStorage;
+ loadPtr(static_cast<void*>(protoPropertyStorage), temp);
+ load32(Address(temp, offset + OBJECT_OFFSETOF(JSValue, u.asBits.payload)), resultPayload);
+ load32(Address(temp, offset + OBJECT_OFFSETOF(JSValue, u.asBits.tag)), resultTag);
+}
+
+void JIT::testPrototype(JSValue prototype, JumpList& failureCases)
+{
+ if (prototype.isNull())
+ return;
+
+ // We have a special case for X86_64 here because X86 instructions that take immediate values
+ // only take 32 bit immediate values, wheras the pointer constants we are using here are 64 bit
+ // values. In the non X86_64 case, the generated code is slightly more efficient because it uses
+ // two less instructions and doesn't require any scratch registers.
+#if CPU(X86_64)
+ move(ImmPtr(prototype.asCell()->structure()), regT3);
+ failureCases.append(branchPtr(NotEqual, AbsoluteAddress(&prototype.asCell()->m_structure), regT3));
+#else
+ failureCases.append(branchPtr(NotEqual, AbsoluteAddress(&prototype.asCell()->m_structure), ImmPtr(prototype.asCell()->structure())));
+#endif
+}
+
+void JIT::privateCompilePutByIdTransition(StructureStubInfo* stubInfo, Structure* oldStructure, Structure* newStructure, size_t cachedOffset, StructureChain* chain, ReturnAddressPtr returnAddress, bool direct)
+{
+ // It is assumed that regT0 contains the basePayload and regT1 contains the baseTag. The value can be found on the stack.
+
+ JumpList failureCases;
+ failureCases.append(branch32(NotEqual, regT1, Imm32(JSValue::CellTag)));
+ failureCases.append(branchPtr(NotEqual, Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), ImmPtr(oldStructure)));
+ testPrototype(oldStructure->storedPrototype(), failureCases);
+
+ if (!direct) {
+ // Verify that nothing in the prototype chain has a setter for this property.
+ for (RefPtr<Structure>* it = chain->head(); *it; ++it)
+ testPrototype((*it)->storedPrototype(), failureCases);
+ }
+
+ // Reallocate property storage if needed.
+ Call callTarget;
+ bool willNeedStorageRealloc = oldStructure->propertyStorageCapacity() != newStructure->propertyStorageCapacity();
+ if (willNeedStorageRealloc) {
+ // This trampoline was called to like a JIT stub; before we can can call again we need to
+ // remove the return address from the stack, to prevent the stack from becoming misaligned.
+ preserveReturnAddressAfterCall(regT3);
+
+ JITStubCall stubCall(this, cti_op_put_by_id_transition_realloc);
+ stubCall.skipArgument(); // base
+ stubCall.skipArgument(); // ident
+ stubCall.skipArgument(); // value
+ stubCall.addArgument(Imm32(oldStructure->propertyStorageCapacity()));
+ stubCall.addArgument(Imm32(newStructure->propertyStorageCapacity()));
+ stubCall.call(regT0);
+
+ restoreReturnAddressBeforeReturn(regT3);
+ }
+
+ sub32(Imm32(1), AbsoluteAddress(oldStructure->addressOfCount()));
+ add32(Imm32(1), AbsoluteAddress(newStructure->addressOfCount()));
+ storePtr(ImmPtr(newStructure), Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)));
+
+#if CPU(MIPS)
+ // For MIPS, we don't add sizeof(void*) to the stack offset.
+ load32(Address(stackPointerRegister, OBJECT_OFFSETOF(JITStackFrame, args[2]) + OBJECT_OFFSETOF(JSValue, u.asBits.payload)), regT3);
+ load32(Address(stackPointerRegister, OBJECT_OFFSETOF(JITStackFrame, args[2]) + OBJECT_OFFSETOF(JSValue, u.asBits.tag)), regT2);
+#else
+ load32(Address(stackPointerRegister, OBJECT_OFFSETOF(JITStackFrame, args[2]) + sizeof(void*) + OBJECT_OFFSETOF(JSValue, u.asBits.payload)), regT3);
+ load32(Address(stackPointerRegister, OBJECT_OFFSETOF(JITStackFrame, args[2]) + sizeof(void*) + OBJECT_OFFSETOF(JSValue, u.asBits.tag)), regT2);
+#endif
+
+ // Write the value
+ compilePutDirectOffset(regT0, regT2, regT3, newStructure, cachedOffset);
+
+ ret();
+
+ ASSERT(!failureCases.empty());
+ failureCases.link(this);
+ restoreArgumentReferenceForTrampoline();
+ Call failureCall = tailRecursiveCall();
+
+ LinkBuffer patchBuffer(this, m_codeBlock->executablePool(), 0);
+
+ patchBuffer.link(failureCall, FunctionPtr(direct ? cti_op_put_by_id_direct_fail : cti_op_put_by_id_fail));
+
+ if (willNeedStorageRealloc) {
+ ASSERT(m_calls.size() == 1);
+ patchBuffer.link(m_calls[0].from, FunctionPtr(cti_op_put_by_id_transition_realloc));
+ }
+
+ CodeLocationLabel entryLabel = patchBuffer.finalizeCodeAddendum();
+ stubInfo->stubRoutine = entryLabel;
+ RepatchBuffer repatchBuffer(m_codeBlock);
+ repatchBuffer.relinkCallerToTrampoline(returnAddress, entryLabel);
+}
+
+void JIT::patchGetByIdSelf(CodeBlock* codeBlock, StructureStubInfo* stubInfo, Structure* structure, size_t cachedOffset, ReturnAddressPtr returnAddress)
+{
+ RepatchBuffer repatchBuffer(codeBlock);
+
+ // We don't want to patch more than once - in future go to cti_op_get_by_id_generic.
+ // Should probably go to JITStubs::cti_op_get_by_id_fail, but that doesn't do anything interesting right now.
+ repatchBuffer.relinkCallerToFunction(returnAddress, FunctionPtr(cti_op_get_by_id_self_fail));
+
+ int offset = sizeof(JSValue) * cachedOffset;
+
+ // If we're patching to use inline storage, convert the initial load to a lea; this avoids the extra load
+ // and makes the subsequent load's offset automatically correct
+ if (structure->isUsingInlineStorage())
+ repatchBuffer.repatchLoadPtrToLEA(stubInfo->hotPathBegin.instructionAtOffset(patchOffsetGetByIdExternalLoad));
+
+ // Patch the offset into the propoerty map to load from, then patch the Structure to look for.
+ repatchBuffer.repatch(stubInfo->hotPathBegin.dataLabelPtrAtOffset(patchOffsetGetByIdStructure), structure);
+ repatchBuffer.repatch(stubInfo->hotPathBegin.dataLabel32AtOffset(patchOffsetGetByIdPropertyMapOffset1), offset + OBJECT_OFFSETOF(JSValue, u.asBits.payload)); // payload
+ repatchBuffer.repatch(stubInfo->hotPathBegin.dataLabel32AtOffset(patchOffsetGetByIdPropertyMapOffset2), offset + OBJECT_OFFSETOF(JSValue, u.asBits.tag)); // tag
+}
+
+void JIT::patchMethodCallProto(CodeBlock* codeBlock, MethodCallLinkInfo& methodCallLinkInfo, JSFunction* callee, Structure* structure, JSObject* proto, ReturnAddressPtr returnAddress)
+{
+ RepatchBuffer repatchBuffer(codeBlock);
+
+ ASSERT(!methodCallLinkInfo.cachedStructure);
+ methodCallLinkInfo.cachedStructure = structure;
+ structure->ref();
+
+ Structure* prototypeStructure = proto->structure();
+ methodCallLinkInfo.cachedPrototypeStructure = prototypeStructure;
+ prototypeStructure->ref();
+
+ repatchBuffer.repatch(methodCallLinkInfo.structureLabel, structure);
+ repatchBuffer.repatch(methodCallLinkInfo.structureLabel.dataLabelPtrAtOffset(patchOffsetMethodCheckProtoObj), proto);
+ repatchBuffer.repatch(methodCallLinkInfo.structureLabel.dataLabelPtrAtOffset(patchOffsetMethodCheckProtoStruct), prototypeStructure);
+ repatchBuffer.repatch(methodCallLinkInfo.structureLabel.dataLabelPtrAtOffset(patchOffsetMethodCheckPutFunction), callee);
+
+ repatchBuffer.relinkCallerToFunction(returnAddress, FunctionPtr(cti_op_get_by_id));
+}
+
+void JIT::patchPutByIdReplace(CodeBlock* codeBlock, StructureStubInfo* stubInfo, Structure* structure, size_t cachedOffset, ReturnAddressPtr returnAddress, bool direct)
+{
+ RepatchBuffer repatchBuffer(codeBlock);
+
+ // We don't want to patch more than once - in future go to cti_op_put_by_id_generic.
+ // Should probably go to cti_op_put_by_id_fail, but that doesn't do anything interesting right now.
+ repatchBuffer.relinkCallerToFunction(returnAddress, FunctionPtr(direct ? cti_op_put_by_id_direct_generic : cti_op_put_by_id_generic));
+
+ int offset = sizeof(JSValue) * cachedOffset;
+
+ // If we're patching to use inline storage, convert the initial load to a lea; this avoids the extra load
+ // and makes the subsequent load's offset automatically correct
+ if (structure->isUsingInlineStorage())
+ repatchBuffer.repatchLoadPtrToLEA(stubInfo->hotPathBegin.instructionAtOffset(patchOffsetPutByIdExternalLoad));
+
+ // Patch the offset into the propoerty map to load from, then patch the Structure to look for.
+ repatchBuffer.repatch(stubInfo->hotPathBegin.dataLabelPtrAtOffset(patchOffsetPutByIdStructure), structure);
+ repatchBuffer.repatch(stubInfo->hotPathBegin.dataLabel32AtOffset(patchOffsetPutByIdPropertyMapOffset1), offset + OBJECT_OFFSETOF(JSValue, u.asBits.payload)); // payload
+ repatchBuffer.repatch(stubInfo->hotPathBegin.dataLabel32AtOffset(patchOffsetPutByIdPropertyMapOffset2), offset + OBJECT_OFFSETOF(JSValue, u.asBits.tag)); // tag
+}
+
+void JIT::privateCompilePatchGetArrayLength(ReturnAddressPtr returnAddress)
+{
+ StructureStubInfo* stubInfo = &m_codeBlock->getStubInfo(returnAddress);
+
+ // regT0 holds a JSCell*
+
+ // Check for array
+ Jump failureCases1 = branchPtr(NotEqual, Address(regT0), ImmPtr(m_globalData->jsArrayVPtr));
+
+ // Checks out okay! - get the length from the storage
+ loadPtr(Address(regT0, OBJECT_OFFSETOF(JSArray, m_storage)), regT2);
+ load32(Address(regT2, OBJECT_OFFSETOF(ArrayStorage, m_length)), regT2);
+
+ Jump failureCases2 = branch32(Above, regT2, Imm32(INT_MAX));
+ move(regT2, regT0);
+ move(Imm32(JSValue::Int32Tag), regT1);
+ Jump success = jump();
+
+ LinkBuffer patchBuffer(this, m_codeBlock->executablePool(), 0);
+
+ // Use the patch information to link the failure cases back to the original slow case routine.
+ CodeLocationLabel slowCaseBegin = stubInfo->callReturnLocation.labelAtOffset(-patchOffsetGetByIdSlowCaseCall);
+ patchBuffer.link(failureCases1, slowCaseBegin);
+ patchBuffer.link(failureCases2, slowCaseBegin);
+
+ // On success return back to the hot patch code, at a point it will perform the store to dest for us.
+ patchBuffer.link(success, stubInfo->hotPathBegin.labelAtOffset(patchOffsetGetByIdPutResult));
+
+ // Track the stub we have created so that it will be deleted later.
+ CodeLocationLabel entryLabel = patchBuffer.finalizeCodeAddendum();
+ stubInfo->stubRoutine = entryLabel;
+
+ // Finally patch the jump to slow case back in the hot path to jump here instead.
+ CodeLocationJump jumpLocation = stubInfo->hotPathBegin.jumpAtOffset(patchOffsetGetByIdBranchToSlowCase);
+ RepatchBuffer repatchBuffer(m_codeBlock);
+ repatchBuffer.relink(jumpLocation, entryLabel);
+
+ // We don't want to patch more than once - in future go to cti_op_put_by_id_generic.
+ repatchBuffer.relinkCallerToFunction(returnAddress, FunctionPtr(cti_op_get_by_id_array_fail));
+}
+
+void JIT::privateCompileGetByIdProto(StructureStubInfo* stubInfo, Structure* structure, Structure* prototypeStructure, const Identifier& ident, const PropertySlot& slot, size_t cachedOffset, ReturnAddressPtr returnAddress, CallFrame* callFrame)
+{
+ // regT0 holds a JSCell*
+
+ // The prototype object definitely exists (if this stub exists the CodeBlock is referencing a Structure that is
+ // referencing the prototype object - let's speculatively load it's table nice and early!)
+ JSObject* protoObject = asObject(structure->prototypeForLookup(callFrame));
+
+ Jump failureCases1 = checkStructure(regT0, structure);
+
+ // Check the prototype object's Structure had not changed.
+ Structure** prototypeStructureAddress = &(protoObject->m_structure);
+#if CPU(X86_64)
+ move(ImmPtr(prototypeStructure), regT3);
+ Jump failureCases2 = branchPtr(NotEqual, AbsoluteAddress(prototypeStructureAddress), regT3);
+#else
+ Jump failureCases2 = branchPtr(NotEqual, AbsoluteAddress(prototypeStructureAddress), ImmPtr(prototypeStructure));
+#endif
+ bool needsStubLink = false;
+ // Checks out okay!
+ if (slot.cachedPropertyType() == PropertySlot::Getter) {
+ needsStubLink = true;
+ compileGetDirectOffset(protoObject, regT2, regT2, regT1, cachedOffset);
+ JITStubCall stubCall(this, cti_op_get_by_id_getter_stub);
+ stubCall.addArgument(regT1);
+ stubCall.addArgument(regT0);
+ stubCall.addArgument(ImmPtr(stubInfo->callReturnLocation.executableAddress()));
+ stubCall.call();
+ } else if (slot.cachedPropertyType() == PropertySlot::Custom) {
+ needsStubLink = true;
+ JITStubCall stubCall(this, cti_op_get_by_id_custom_stub);
+ stubCall.addArgument(ImmPtr(protoObject));
+ stubCall.addArgument(ImmPtr(FunctionPtr(slot.customGetter()).executableAddress()));
+ stubCall.addArgument(ImmPtr(const_cast<Identifier*>(&ident)));
+ stubCall.addArgument(ImmPtr(stubInfo->callReturnLocation.executableAddress()));
+ stubCall.call();
+ } else
+ compileGetDirectOffset(protoObject, regT2, regT1, regT0, cachedOffset);
+
+ Jump success = jump();
+
+ LinkBuffer patchBuffer(this, m_codeBlock->executablePool(), 0);
+
+ // Use the patch information to link the failure cases back to the original slow case routine.
+ CodeLocationLabel slowCaseBegin = stubInfo->callReturnLocation.labelAtOffset(-patchOffsetGetByIdSlowCaseCall);
+ patchBuffer.link(failureCases1, slowCaseBegin);
+ patchBuffer.link(failureCases2, slowCaseBegin);
+
+ // On success return back to the hot patch code, at a point it will perform the store to dest for us.
+ patchBuffer.link(success, stubInfo->hotPathBegin.labelAtOffset(patchOffsetGetByIdPutResult));
+
+ if (needsStubLink) {
+ for (Vector<CallRecord>::iterator iter = m_calls.begin(); iter != m_calls.end(); ++iter) {
+ if (iter->to)
+ patchBuffer.link(iter->from, FunctionPtr(iter->to));
+ }
+ }
+
+ // Track the stub we have created so that it will be deleted later.
+ CodeLocationLabel entryLabel = patchBuffer.finalizeCodeAddendum();
+ stubInfo->stubRoutine = entryLabel;
+
+ // Finally patch the jump to slow case back in the hot path to jump here instead.
+ CodeLocationJump jumpLocation = stubInfo->hotPathBegin.jumpAtOffset(patchOffsetGetByIdBranchToSlowCase);
+ RepatchBuffer repatchBuffer(m_codeBlock);
+ repatchBuffer.relink(jumpLocation, entryLabel);
+
+ // We don't want to patch more than once - in future go to cti_op_put_by_id_generic.
+ repatchBuffer.relinkCallerToFunction(returnAddress, FunctionPtr(cti_op_get_by_id_proto_list));
+}
+
+
+void JIT::privateCompileGetByIdSelfList(StructureStubInfo* stubInfo, PolymorphicAccessStructureList* polymorphicStructures, int currentIndex, Structure* structure, const Identifier& ident, const PropertySlot& slot, size_t cachedOffset)
+{
+ // regT0 holds a JSCell*
+ Jump failureCase = checkStructure(regT0, structure);
+ bool needsStubLink = false;
+ if (slot.cachedPropertyType() == PropertySlot::Getter) {
+ needsStubLink = true;
+ if (!structure->isUsingInlineStorage()) {
+ move(regT0, regT1);
+ compileGetDirectOffset(regT1, regT2, regT1, structure, cachedOffset);
+ } else
+ compileGetDirectOffset(regT0, regT2, regT1, structure, cachedOffset);
+ JITStubCall stubCall(this, cti_op_get_by_id_getter_stub);
+ stubCall.addArgument(regT1);
+ stubCall.addArgument(regT0);
+ stubCall.addArgument(ImmPtr(stubInfo->callReturnLocation.executableAddress()));
+ stubCall.call();
+ } else if (slot.cachedPropertyType() == PropertySlot::Custom) {
+ needsStubLink = true;
+ JITStubCall stubCall(this, cti_op_get_by_id_custom_stub);
+ stubCall.addArgument(regT0);
+ stubCall.addArgument(ImmPtr(FunctionPtr(slot.customGetter()).executableAddress()));
+ stubCall.addArgument(ImmPtr(const_cast<Identifier*>(&ident)));
+ stubCall.addArgument(ImmPtr(stubInfo->callReturnLocation.executableAddress()));
+ stubCall.call();
+ } else
+ compileGetDirectOffset(regT0, regT1, regT0, structure, cachedOffset);
+
+ Jump success = jump();
+
+ LinkBuffer patchBuffer(this, m_codeBlock->executablePool(), 0);
+ if (needsStubLink) {
+ for (Vector<CallRecord>::iterator iter = m_calls.begin(); iter != m_calls.end(); ++iter) {
+ if (iter->to)
+ patchBuffer.link(iter->from, FunctionPtr(iter->to));
+ }
+ }
+ // Use the patch information to link the failure cases back to the original slow case routine.
+ CodeLocationLabel lastProtoBegin = polymorphicStructures->list[currentIndex - 1].stubRoutine;
+ if (!lastProtoBegin)
+ lastProtoBegin = stubInfo->callReturnLocation.labelAtOffset(-patchOffsetGetByIdSlowCaseCall);
+
+ patchBuffer.link(failureCase, lastProtoBegin);
+
+ // On success return back to the hot patch code, at a point it will perform the store to dest for us.
+ patchBuffer.link(success, stubInfo->hotPathBegin.labelAtOffset(patchOffsetGetByIdPutResult));
+
+ CodeLocationLabel entryLabel = patchBuffer.finalizeCodeAddendum();
+
+ structure->ref();
+ polymorphicStructures->list[currentIndex].set(entryLabel, structure);
+
+ // Finally patch the jump to slow case back in the hot path to jump here instead.
+ CodeLocationJump jumpLocation = stubInfo->hotPathBegin.jumpAtOffset(patchOffsetGetByIdBranchToSlowCase);
+ RepatchBuffer repatchBuffer(m_codeBlock);
+ repatchBuffer.relink(jumpLocation, entryLabel);
+}
+
+void JIT::privateCompileGetByIdProtoList(StructureStubInfo* stubInfo, PolymorphicAccessStructureList* prototypeStructures, int currentIndex, Structure* structure, Structure* prototypeStructure, const Identifier& ident, const PropertySlot& slot, size_t cachedOffset, CallFrame* callFrame)
+{
+ // regT0 holds a JSCell*
+
+ // The prototype object definitely exists (if this stub exists the CodeBlock is referencing a Structure that is
+ // referencing the prototype object - let's speculatively load it's table nice and early!)
+ JSObject* protoObject = asObject(structure->prototypeForLookup(callFrame));
+
+ // Check eax is an object of the right Structure.
+ Jump failureCases1 = checkStructure(regT0, structure);
+
+ // Check the prototype object's Structure had not changed.
+ Structure** prototypeStructureAddress = &(protoObject->m_structure);
+#if CPU(X86_64)
+ move(ImmPtr(prototypeStructure), regT3);
+ Jump failureCases2 = branchPtr(NotEqual, AbsoluteAddress(prototypeStructureAddress), regT3);
+#else
+ Jump failureCases2 = branchPtr(NotEqual, AbsoluteAddress(prototypeStructureAddress), ImmPtr(prototypeStructure));
+#endif
+
+ bool needsStubLink = false;
+ if (slot.cachedPropertyType() == PropertySlot::Getter) {
+ needsStubLink = true;
+ compileGetDirectOffset(protoObject, regT2, regT2, regT1, cachedOffset);
+ JITStubCall stubCall(this, cti_op_get_by_id_getter_stub);
+ stubCall.addArgument(regT1);
+ stubCall.addArgument(regT0);
+ stubCall.addArgument(ImmPtr(stubInfo->callReturnLocation.executableAddress()));
+ stubCall.call();
+ } else if (slot.cachedPropertyType() == PropertySlot::Custom) {
+ needsStubLink = true;
+ JITStubCall stubCall(this, cti_op_get_by_id_custom_stub);
+ stubCall.addArgument(ImmPtr(protoObject));
+ stubCall.addArgument(ImmPtr(FunctionPtr(slot.customGetter()).executableAddress()));
+ stubCall.addArgument(ImmPtr(const_cast<Identifier*>(&ident)));
+ stubCall.addArgument(ImmPtr(stubInfo->callReturnLocation.executableAddress()));
+ stubCall.call();
+ } else
+ compileGetDirectOffset(protoObject, regT2, regT1, regT0, cachedOffset);
+
+ Jump success = jump();
+
+ LinkBuffer patchBuffer(this, m_codeBlock->executablePool(), 0);
+ if (needsStubLink) {
+ for (Vector<CallRecord>::iterator iter = m_calls.begin(); iter != m_calls.end(); ++iter) {
+ if (iter->to)
+ patchBuffer.link(iter->from, FunctionPtr(iter->to));
+ }
+ }
+ // Use the patch information to link the failure cases back to the original slow case routine.
+ CodeLocationLabel lastProtoBegin = prototypeStructures->list[currentIndex - 1].stubRoutine;
+ patchBuffer.link(failureCases1, lastProtoBegin);
+ patchBuffer.link(failureCases2, lastProtoBegin);
+
+ // On success return back to the hot patch code, at a point it will perform the store to dest for us.
+ patchBuffer.link(success, stubInfo->hotPathBegin.labelAtOffset(patchOffsetGetByIdPutResult));
+
+ CodeLocationLabel entryLabel = patchBuffer.finalizeCodeAddendum();
+
+ structure->ref();
+ prototypeStructure->ref();
+ prototypeStructures->list[currentIndex].set(entryLabel, structure, prototypeStructure);
+
+ // Finally patch the jump to slow case back in the hot path to jump here instead.
+ CodeLocationJump jumpLocation = stubInfo->hotPathBegin.jumpAtOffset(patchOffsetGetByIdBranchToSlowCase);
+ RepatchBuffer repatchBuffer(m_codeBlock);
+ repatchBuffer.relink(jumpLocation, entryLabel);
+}
+
+void JIT::privateCompileGetByIdChainList(StructureStubInfo* stubInfo, PolymorphicAccessStructureList* prototypeStructures, int currentIndex, Structure* structure, StructureChain* chain, size_t count, const Identifier& ident, const PropertySlot& slot, size_t cachedOffset, CallFrame* callFrame)
+{
+ // regT0 holds a JSCell*
+ ASSERT(count);
+
+ JumpList bucketsOfFail;
+
+ // Check eax is an object of the right Structure.
+ bucketsOfFail.append(checkStructure(regT0, structure));
+
+ Structure* currStructure = structure;
+ RefPtr<Structure>* it = chain->head();
+ JSObject* protoObject = 0;
+ for (unsigned i = 0; i < count; ++i, ++it) {
+ protoObject = asObject(currStructure->prototypeForLookup(callFrame));
+ currStructure = it->get();
+ testPrototype(protoObject, bucketsOfFail);
+ }
+ ASSERT(protoObject);
+
+ bool needsStubLink = false;
+ if (slot.cachedPropertyType() == PropertySlot::Getter) {
+ needsStubLink = true;
+ compileGetDirectOffset(protoObject, regT2, regT2, regT1, cachedOffset);
+ JITStubCall stubCall(this, cti_op_get_by_id_getter_stub);
+ stubCall.addArgument(regT1);
+ stubCall.addArgument(regT0);
+ stubCall.addArgument(ImmPtr(stubInfo->callReturnLocation.executableAddress()));
+ stubCall.call();
+ } else if (slot.cachedPropertyType() == PropertySlot::Custom) {
+ needsStubLink = true;
+ JITStubCall stubCall(this, cti_op_get_by_id_custom_stub);
+ stubCall.addArgument(ImmPtr(protoObject));
+ stubCall.addArgument(ImmPtr(FunctionPtr(slot.customGetter()).executableAddress()));
+ stubCall.addArgument(ImmPtr(const_cast<Identifier*>(&ident)));
+ stubCall.addArgument(ImmPtr(stubInfo->callReturnLocation.executableAddress()));
+ stubCall.call();
+ } else
+ compileGetDirectOffset(protoObject, regT2, regT1, regT0, cachedOffset);
+
+ Jump success = jump();
+
+ LinkBuffer patchBuffer(this, m_codeBlock->executablePool(), 0);
+ if (needsStubLink) {
+ for (Vector<CallRecord>::iterator iter = m_calls.begin(); iter != m_calls.end(); ++iter) {
+ if (iter->to)
+ patchBuffer.link(iter->from, FunctionPtr(iter->to));
+ }
+ }
+ // Use the patch information to link the failure cases back to the original slow case routine.
+ CodeLocationLabel lastProtoBegin = prototypeStructures->list[currentIndex - 1].stubRoutine;
+
+ patchBuffer.link(bucketsOfFail, lastProtoBegin);
+
+ // On success return back to the hot patch code, at a point it will perform the store to dest for us.
+ patchBuffer.link(success, stubInfo->hotPathBegin.labelAtOffset(patchOffsetGetByIdPutResult));
+
+ CodeLocationLabel entryLabel = patchBuffer.finalizeCodeAddendum();
+
+ // Track the stub we have created so that it will be deleted later.
+ structure->ref();
+ chain->ref();
+ prototypeStructures->list[currentIndex].set(entryLabel, structure, chain);
+
+ // Finally patch the jump to slow case back in the hot path to jump here instead.
+ CodeLocationJump jumpLocation = stubInfo->hotPathBegin.jumpAtOffset(patchOffsetGetByIdBranchToSlowCase);
+ RepatchBuffer repatchBuffer(m_codeBlock);
+ repatchBuffer.relink(jumpLocation, entryLabel);
+}
+
+void JIT::privateCompileGetByIdChain(StructureStubInfo* stubInfo, Structure* structure, StructureChain* chain, size_t count, const Identifier& ident, const PropertySlot& slot, size_t cachedOffset, ReturnAddressPtr returnAddress, CallFrame* callFrame)
+{
+ // regT0 holds a JSCell*
+ ASSERT(count);
+
+ JumpList bucketsOfFail;
+
+ // Check eax is an object of the right Structure.
+ bucketsOfFail.append(checkStructure(regT0, structure));
+
+ Structure* currStructure = structure;
+ RefPtr<Structure>* it = chain->head();
+ JSObject* protoObject = 0;
+ for (unsigned i = 0; i < count; ++i, ++it) {
+ protoObject = asObject(currStructure->prototypeForLookup(callFrame));
+ currStructure = it->get();
+ testPrototype(protoObject, bucketsOfFail);
+ }
+ ASSERT(protoObject);
+
+ bool needsStubLink = false;
+ if (slot.cachedPropertyType() == PropertySlot::Getter) {
+ needsStubLink = true;
+ compileGetDirectOffset(protoObject, regT2, regT2, regT1, cachedOffset);
+ JITStubCall stubCall(this, cti_op_get_by_id_getter_stub);
+ stubCall.addArgument(regT1);
+ stubCall.addArgument(regT0);
+ stubCall.addArgument(ImmPtr(stubInfo->callReturnLocation.executableAddress()));
+ stubCall.call();
+ } else if (slot.cachedPropertyType() == PropertySlot::Custom) {
+ needsStubLink = true;
+ JITStubCall stubCall(this, cti_op_get_by_id_custom_stub);
+ stubCall.addArgument(ImmPtr(protoObject));
+ stubCall.addArgument(ImmPtr(FunctionPtr(slot.customGetter()).executableAddress()));
+ stubCall.addArgument(ImmPtr(const_cast<Identifier*>(&ident)));
+ stubCall.addArgument(ImmPtr(stubInfo->callReturnLocation.executableAddress()));
+ stubCall.call();
+ } else
+ compileGetDirectOffset(protoObject, regT2, regT1, regT0, cachedOffset);
+ Jump success = jump();
+
+ LinkBuffer patchBuffer(this, m_codeBlock->executablePool(), 0);
+ if (needsStubLink) {
+ for (Vector<CallRecord>::iterator iter = m_calls.begin(); iter != m_calls.end(); ++iter) {
+ if (iter->to)
+ patchBuffer.link(iter->from, FunctionPtr(iter->to));
+ }
+ }
+ // Use the patch information to link the failure cases back to the original slow case routine.
+ patchBuffer.link(bucketsOfFail, stubInfo->callReturnLocation.labelAtOffset(-patchOffsetGetByIdSlowCaseCall));
+
+ // On success return back to the hot patch code, at a point it will perform the store to dest for us.
+ patchBuffer.link(success, stubInfo->hotPathBegin.labelAtOffset(patchOffsetGetByIdPutResult));
+
+ // Track the stub we have created so that it will be deleted later.
+ CodeLocationLabel entryLabel = patchBuffer.finalizeCodeAddendum();
+ stubInfo->stubRoutine = entryLabel;
+
+ // Finally patch the jump to slow case back in the hot path to jump here instead.
+ CodeLocationJump jumpLocation = stubInfo->hotPathBegin.jumpAtOffset(patchOffsetGetByIdBranchToSlowCase);
+ RepatchBuffer repatchBuffer(m_codeBlock);
+ repatchBuffer.relink(jumpLocation, entryLabel);
+
+ // We don't want to patch more than once - in future go to cti_op_put_by_id_generic.
+ repatchBuffer.relinkCallerToFunction(returnAddress, FunctionPtr(cti_op_get_by_id_proto_list));
+}
+
+/* ------------------------------ END: !ENABLE / ENABLE(JIT_OPTIMIZE_PROPERTY_ACCESS) ------------------------------ */
+
+#endif // !ENABLE(JIT_OPTIMIZE_PROPERTY_ACCESS)
+
+void JIT::compileGetDirectOffset(RegisterID base, RegisterID resultTag, RegisterID resultPayload, RegisterID structure, RegisterID offset)
+{
+ ASSERT(sizeof(((Structure*)0)->m_propertyStorageCapacity) == sizeof(int32_t));
+ ASSERT(sizeof(JSObject::inlineStorageCapacity) == sizeof(int32_t));
+ ASSERT(sizeof(JSValue) == 8);
+
+ Jump notUsingInlineStorage = branch32(NotEqual, Address(structure, OBJECT_OFFSETOF(Structure, m_propertyStorageCapacity)), Imm32(JSObject::inlineStorageCapacity));
+ loadPtr(BaseIndex(base, offset, TimesEight, OBJECT_OFFSETOF(JSObject, m_inlineStorage) + OBJECT_OFFSETOF(JSValue, u.asBits.payload)), resultPayload);
+ loadPtr(BaseIndex(base, offset, TimesEight, OBJECT_OFFSETOF(JSObject, m_inlineStorage) + OBJECT_OFFSETOF(JSValue, u.asBits.tag)), resultTag);
+ Jump finishedLoad = jump();
+ notUsingInlineStorage.link(this);
+ loadPtr(Address(base, OBJECT_OFFSETOF(JSObject, m_externalStorage)), base);
+ loadPtr(BaseIndex(base, offset, TimesEight, OBJECT_OFFSETOF(JSValue, u.asBits.payload)), resultPayload);
+ loadPtr(BaseIndex(base, offset, TimesEight, OBJECT_OFFSETOF(JSValue, u.asBits.tag)), resultTag);
+ finishedLoad.link(this);
+}
+
+void JIT::emit_op_get_by_pname(Instruction* currentInstruction)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+ unsigned base = currentInstruction[2].u.operand;
+ unsigned property = currentInstruction[3].u.operand;
+ unsigned expected = currentInstruction[4].u.operand;
+ unsigned iter = currentInstruction[5].u.operand;
+ unsigned i = currentInstruction[6].u.operand;
+
+ emitLoad2(property, regT1, regT0, base, regT3, regT2);
+ emitJumpSlowCaseIfNotJSCell(property, regT1);
+ addSlowCase(branchPtr(NotEqual, regT0, payloadFor(expected)));
+ // Property registers are now available as the property is known
+ emitJumpSlowCaseIfNotJSCell(base, regT3);
+ emitLoadPayload(iter, regT1);
+
+ // Test base's structure
+ loadPtr(Address(regT2, OBJECT_OFFSETOF(JSCell, m_structure)), regT0);
+ addSlowCase(branchPtr(NotEqual, regT0, Address(regT1, OBJECT_OFFSETOF(JSPropertyNameIterator, m_cachedStructure))));
+ load32(addressFor(i), regT3);
+ sub32(Imm32(1), regT3);
+ addSlowCase(branch32(AboveOrEqual, regT3, Address(regT1, OBJECT_OFFSETOF(JSPropertyNameIterator, m_numCacheableSlots))));
+ compileGetDirectOffset(regT2, regT1, regT0, regT0, regT3);
+
+ emitStore(dst, regT1, regT0);
+ map(m_bytecodeOffset + OPCODE_LENGTH(op_get_by_pname), dst, regT1, regT0);
+}
+
+void JIT::emitSlow_op_get_by_pname(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+ unsigned dst = currentInstruction[1].u.operand;
+ unsigned base = currentInstruction[2].u.operand;
+ unsigned property = currentInstruction[3].u.operand;
+
+ linkSlowCaseIfNotJSCell(iter, property);
+ linkSlowCase(iter);
+ linkSlowCaseIfNotJSCell(iter, base);
+ linkSlowCase(iter);
+ linkSlowCase(iter);
+
+ JITStubCall stubCall(this, cti_op_get_by_val);
+ stubCall.addArgument(base);
+ stubCall.addArgument(property);
+ stubCall.call(dst);
+}
+
+} // namespace JSC
+
+#endif // USE(JSVALUE32_64)
+#endif // ENABLE(JIT)
diff --git a/Source/JavaScriptCore/jit/JITStubCall.h b/Source/JavaScriptCore/jit/JITStubCall.h
new file mode 100644
index 0000000..4478d06
--- /dev/null
+++ b/Source/JavaScriptCore/jit/JITStubCall.h
@@ -0,0 +1,237 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef JITStubCall_h
+#define JITStubCall_h
+
+#include "MacroAssemblerCodeRef.h"
+
+#if ENABLE(JIT)
+
+namespace JSC {
+
+ class JITStubCall {
+ public:
+ JITStubCall(JIT* jit, JSObject* (JIT_STUB *stub)(STUB_ARGS_DECLARATION))
+ : m_jit(jit)
+ , m_stub(stub)
+ , m_returnType(Cell)
+ , m_stackIndex(JITSTACKFRAME_ARGS_INDEX)
+ {
+ }
+
+ JITStubCall(JIT* jit, JSPropertyNameIterator* (JIT_STUB *stub)(STUB_ARGS_DECLARATION))
+ : m_jit(jit)
+ , m_stub(stub)
+ , m_returnType(Cell)
+ , m_stackIndex(JITSTACKFRAME_ARGS_INDEX)
+ {
+ }
+
+ JITStubCall(JIT* jit, void* (JIT_STUB *stub)(STUB_ARGS_DECLARATION))
+ : m_jit(jit)
+ , m_stub(stub)
+ , m_returnType(VoidPtr)
+ , m_stackIndex(JITSTACKFRAME_ARGS_INDEX)
+ {
+ }
+
+ JITStubCall(JIT* jit, int (JIT_STUB *stub)(STUB_ARGS_DECLARATION))
+ : m_jit(jit)
+ , m_stub(stub)
+ , m_returnType(Int)
+ , m_stackIndex(JITSTACKFRAME_ARGS_INDEX)
+ {
+ }
+
+ JITStubCall(JIT* jit, bool (JIT_STUB *stub)(STUB_ARGS_DECLARATION))
+ : m_jit(jit)
+ , m_stub(stub)
+ , m_returnType(Int)
+ , m_stackIndex(JITSTACKFRAME_ARGS_INDEX)
+ {
+ }
+
+ JITStubCall(JIT* jit, void (JIT_STUB *stub)(STUB_ARGS_DECLARATION))
+ : m_jit(jit)
+ , m_stub(stub)
+ , m_returnType(Void)
+ , m_stackIndex(JITSTACKFRAME_ARGS_INDEX)
+ {
+ }
+
+#if USE(JSVALUE32_64)
+ JITStubCall(JIT* jit, EncodedJSValue (JIT_STUB *stub)(STUB_ARGS_DECLARATION))
+ : m_jit(jit)
+ , m_stub(stub)
+ , m_returnType(Value)
+ , m_stackIndex(JITSTACKFRAME_ARGS_INDEX)
+ {
+ }
+#endif
+
+ // Arguments are added first to last.
+
+ void skipArgument()
+ {
+ m_stackIndex += stackIndexStep;
+ }
+
+ void addArgument(JIT::Imm32 argument)
+ {
+ m_jit->poke(argument, m_stackIndex);
+ m_stackIndex += stackIndexStep;
+ }
+
+ void addArgument(JIT::ImmPtr argument)
+ {
+ m_jit->poke(argument, m_stackIndex);
+ m_stackIndex += stackIndexStep;
+ }
+
+ void addArgument(JIT::RegisterID argument)
+ {
+ m_jit->poke(argument, m_stackIndex);
+ m_stackIndex += stackIndexStep;
+ }
+
+#if USE(JSVALUE32_64)
+ void addArgument(const JSValue& value)
+ {
+ m_jit->poke(JIT::Imm32(value.payload()), m_stackIndex);
+ m_jit->poke(JIT::Imm32(value.tag()), m_stackIndex + 1);
+ m_stackIndex += stackIndexStep;
+ }
+#endif
+
+ void addArgument(JIT::RegisterID tag, JIT::RegisterID payload)
+ {
+ m_jit->poke(payload, m_stackIndex);
+ m_jit->poke(tag, m_stackIndex + 1);
+ m_stackIndex += stackIndexStep;
+ }
+
+#if USE(JSVALUE32_64)
+ void addArgument(unsigned srcVirtualRegister)
+ {
+ if (m_jit->m_codeBlock->isConstantRegisterIndex(srcVirtualRegister)) {
+ addArgument(m_jit->getConstantOperand(srcVirtualRegister));
+ return;
+ }
+
+ m_jit->emitLoad(srcVirtualRegister, JIT::regT1, JIT::regT0);
+ addArgument(JIT::regT1, JIT::regT0);
+ }
+
+ void getArgument(size_t argumentNumber, JIT::RegisterID tag, JIT::RegisterID payload)
+ {
+ size_t stackIndex = JITSTACKFRAME_ARGS_INDEX + (argumentNumber * stackIndexStep);
+ m_jit->peek(payload, stackIndex);
+ m_jit->peek(tag, stackIndex + 1);
+ }
+#else
+ void addArgument(unsigned src, JIT::RegisterID scratchRegister) // src is a virtual register.
+ {
+ if (m_jit->m_codeBlock->isConstantRegisterIndex(src))
+ addArgument(JIT::ImmPtr(JSValue::encode(m_jit->m_codeBlock->getConstant(src))));
+ else {
+ m_jit->loadPtr(JIT::Address(JIT::callFrameRegister, src * sizeof(Register)), scratchRegister);
+ addArgument(scratchRegister);
+ }
+ m_jit->killLastResultRegister();
+ }
+#endif
+
+ JIT::Call call()
+ {
+#if ENABLE(OPCODE_SAMPLING)
+ if (m_jit->m_bytecodeOffset != (unsigned)-1)
+ m_jit->sampleInstruction(m_jit->m_codeBlock->instructions().begin() + m_jit->m_bytecodeOffset, true);
+#endif
+
+ m_jit->restoreArgumentReference();
+ JIT::Call call = m_jit->call();
+ m_jit->m_calls.append(CallRecord(call, m_jit->m_bytecodeOffset, m_stub.value()));
+
+#if ENABLE(OPCODE_SAMPLING)
+ if (m_jit->m_bytecodeOffset != (unsigned)-1)
+ m_jit->sampleInstruction(m_jit->m_codeBlock->instructions().begin() + m_jit->m_bytecodeOffset, false);
+#endif
+
+#if USE(JSVALUE32_64)
+ m_jit->unmap();
+#else
+ m_jit->killLastResultRegister();
+#endif
+ return call;
+ }
+
+#if USE(JSVALUE32_64)
+ JIT::Call call(unsigned dst) // dst is a virtual register.
+ {
+ ASSERT(m_returnType == Value || m_returnType == Cell);
+ JIT::Call call = this->call();
+ if (m_returnType == Value)
+ m_jit->emitStore(dst, JIT::regT1, JIT::regT0);
+ else
+ m_jit->emitStoreCell(dst, JIT::returnValueRegister);
+ return call;
+ }
+#else
+ JIT::Call call(unsigned dst) // dst is a virtual register.
+ {
+ ASSERT(m_returnType == VoidPtr || m_returnType == Cell);
+ JIT::Call call = this->call();
+ m_jit->emitPutVirtualRegister(dst);
+ return call;
+ }
+#endif
+
+ JIT::Call call(JIT::RegisterID dst) // dst is a machine register.
+ {
+#if USE(JSVALUE32_64)
+ ASSERT(m_returnType == Value || m_returnType == VoidPtr || m_returnType == Int || m_returnType == Cell);
+#else
+ ASSERT(m_returnType == VoidPtr || m_returnType == Int || m_returnType == Cell);
+#endif
+ JIT::Call call = this->call();
+ if (dst != JIT::returnValueRegister)
+ m_jit->move(JIT::returnValueRegister, dst);
+ return call;
+ }
+
+ private:
+ static const size_t stackIndexStep = sizeof(EncodedJSValue) == 2 * sizeof(void*) ? 2 : 1;
+
+ JIT* m_jit;
+ FunctionPtr m_stub;
+ enum { Void, VoidPtr, Int, Value, Cell } m_returnType;
+ size_t m_stackIndex;
+ };
+}
+
+#endif // ENABLE(JIT)
+
+#endif // JITStubCall_h
diff --git a/Source/JavaScriptCore/jit/JITStubs.cpp b/Source/JavaScriptCore/jit/JITStubs.cpp
new file mode 100644
index 0000000..0959a6e
--- /dev/null
+++ b/Source/JavaScriptCore/jit/JITStubs.cpp
@@ -0,0 +1,3638 @@
+/*
+ * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2008 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if ENABLE(JIT)
+#include "JITStubs.h"
+
+#include "Arguments.h"
+#include "CallFrame.h"
+#include "CodeBlock.h"
+#include "Collector.h"
+#include "Debugger.h"
+#include "ExceptionHelpers.h"
+#include "GetterSetter.h"
+#include "GlobalEvalFunction.h"
+#include "JIT.h"
+#include "JSActivation.h"
+#include "JSArray.h"
+#include "JSByteArray.h"
+#include "JSFunction.h"
+#include "JSGlobalObjectFunctions.h"
+#include "JSNotAnObject.h"
+#include "JSPropertyNameIterator.h"
+#include "JSStaticScopeObject.h"
+#include "JSString.h"
+#include "ObjectPrototype.h"
+#include "Operations.h"
+#include "Parser.h"
+#include "Profiler.h"
+#include "RegExpObject.h"
+#include "RegExpPrototype.h"
+#include "Register.h"
+#include "SamplingTool.h"
+#include <wtf/StdLibExtras.h>
+#include <stdarg.h>
+#include <stdio.h>
+
+using namespace std;
+
+namespace JSC {
+
+#if OS(DARWIN) || OS(WINDOWS)
+#define SYMBOL_STRING(name) "_" #name
+#else
+#define SYMBOL_STRING(name) #name
+#endif
+
+#if OS(IOS)
+#define THUMB_FUNC_PARAM(name) SYMBOL_STRING(name)
+#else
+#define THUMB_FUNC_PARAM(name)
+#endif
+
+#if OS(LINUX) && CPU(X86_64)
+#define SYMBOL_STRING_RELOCATION(name) #name "@plt"
+#elif OS(DARWIN)
+#define SYMBOL_STRING_RELOCATION(name) "_" #name
+#elif CPU(X86) && COMPILER(MINGW)
+#define SYMBOL_STRING_RELOCATION(name) "@" #name "@4"
+#else
+#define SYMBOL_STRING_RELOCATION(name) #name
+#endif
+
+#if OS(DARWIN)
+ // Mach-O platform
+#define HIDE_SYMBOL(name) ".private_extern _" #name
+#elif OS(AIX)
+ // IBM's own file format
+#define HIDE_SYMBOL(name) ".lglobl " #name
+#elif OS(LINUX) \
+ || OS(FREEBSD) \
+ || OS(OPENBSD) \
+ || OS(SOLARIS) \
+ || (OS(HPUX) && CPU(IA64)) \
+ || OS(SYMBIAN) \
+ || OS(NETBSD)
+ // ELF platform
+#define HIDE_SYMBOL(name) ".hidden " #name
+#else
+#define HIDE_SYMBOL(name)
+#endif
+
+#if USE(JSVALUE32_64)
+
+#if COMPILER(GCC) && CPU(X86)
+
+// These ASSERTs remind you that, if you change the layout of JITStackFrame, you
+// need to change the assembly trampolines below to match.
+COMPILE_ASSERT(offsetof(struct JITStackFrame, code) % 16 == 0x0, JITStackFrame_maintains_16byte_stack_alignment);
+COMPILE_ASSERT(offsetof(struct JITStackFrame, savedEBX) == 0x3c, JITStackFrame_stub_argument_space_matches_ctiTrampoline);
+COMPILE_ASSERT(offsetof(struct JITStackFrame, callFrame) == 0x58, JITStackFrame_callFrame_offset_matches_ctiTrampoline);
+COMPILE_ASSERT(offsetof(struct JITStackFrame, code) == 0x50, JITStackFrame_code_offset_matches_ctiTrampoline);
+
+asm (
+".text\n"
+".globl " SYMBOL_STRING(ctiTrampoline) "\n"
+HIDE_SYMBOL(ctiTrampoline) "\n"
+SYMBOL_STRING(ctiTrampoline) ":" "\n"
+ "pushl %ebp" "\n"
+ "movl %esp, %ebp" "\n"
+ "pushl %esi" "\n"
+ "pushl %edi" "\n"
+ "pushl %ebx" "\n"
+ "subl $0x3c, %esp" "\n"
+ "movl $512, %esi" "\n"
+ "movl 0x58(%esp), %edi" "\n"
+ "call *0x50(%esp)" "\n"
+ "addl $0x3c, %esp" "\n"
+ "popl %ebx" "\n"
+ "popl %edi" "\n"
+ "popl %esi" "\n"
+ "popl %ebp" "\n"
+ "ret" "\n"
+);
+
+asm (
+".globl " SYMBOL_STRING(ctiVMThrowTrampoline) "\n"
+HIDE_SYMBOL(ctiVMThrowTrampoline) "\n"
+SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n"
+ "movl %esp, %ecx" "\n"
+ "call " SYMBOL_STRING_RELOCATION(cti_vm_throw) "\n"
+ "int3" "\n"
+);
+
+asm (
+".globl " SYMBOL_STRING(ctiOpThrowNotCaught) "\n"
+HIDE_SYMBOL(ctiOpThrowNotCaught) "\n"
+SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n"
+ "addl $0x3c, %esp" "\n"
+ "popl %ebx" "\n"
+ "popl %edi" "\n"
+ "popl %esi" "\n"
+ "popl %ebp" "\n"
+ "ret" "\n"
+);
+
+#elif COMPILER(GCC) && CPU(X86_64)
+
+// These ASSERTs remind you that, if you change the layout of JITStackFrame, you
+// need to change the assembly trampolines below to match.
+COMPILE_ASSERT(offsetof(struct JITStackFrame, code) % 32 == 0x0, JITStackFrame_maintains_32byte_stack_alignment);
+COMPILE_ASSERT(offsetof(struct JITStackFrame, savedRBX) == 0x48, JITStackFrame_stub_argument_space_matches_ctiTrampoline);
+COMPILE_ASSERT(offsetof(struct JITStackFrame, callFrame) == 0x90, JITStackFrame_callFrame_offset_matches_ctiTrampoline);
+COMPILE_ASSERT(offsetof(struct JITStackFrame, code) == 0x80, JITStackFrame_code_offset_matches_ctiTrampoline);
+
+asm (
+".globl " SYMBOL_STRING(ctiTrampoline) "\n"
+HIDE_SYMBOL(ctiTrampoline) "\n"
+SYMBOL_STRING(ctiTrampoline) ":" "\n"
+ "pushq %rbp" "\n"
+ "movq %rsp, %rbp" "\n"
+ "pushq %r12" "\n"
+ "pushq %r13" "\n"
+ "pushq %r14" "\n"
+ "pushq %r15" "\n"
+ "pushq %rbx" "\n"
+ "subq $0x48, %rsp" "\n"
+ "movq $512, %r12" "\n"
+ "movq $0xFFFF000000000000, %r14" "\n"
+ "movq $0xFFFF000000000002, %r15" "\n"
+ "movq 0x90(%rsp), %r13" "\n"
+ "call *0x80(%rsp)" "\n"
+ "addq $0x48, %rsp" "\n"
+ "popq %rbx" "\n"
+ "popq %r15" "\n"
+ "popq %r14" "\n"
+ "popq %r13" "\n"
+ "popq %r12" "\n"
+ "popq %rbp" "\n"
+ "ret" "\n"
+);
+
+asm (
+".globl " SYMBOL_STRING(ctiVMThrowTrampoline) "\n"
+HIDE_SYMBOL(ctiVMThrowTrampoline) "\n"
+SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n"
+ "movq %rsp, %rdi" "\n"
+ "call " SYMBOL_STRING_RELOCATION(cti_vm_throw) "\n"
+ "int3" "\n"
+);
+
+asm (
+".globl " SYMBOL_STRING(ctiOpThrowNotCaught) "\n"
+HIDE_SYMBOL(ctiOpThrowNotCaught) "\n"
+SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n"
+ "addq $0x48, %rsp" "\n"
+ "popq %rbx" "\n"
+ "popq %r15" "\n"
+ "popq %r14" "\n"
+ "popq %r13" "\n"
+ "popq %r12" "\n"
+ "popq %rbp" "\n"
+ "ret" "\n"
+);
+
+#elif COMPILER(GCC) && CPU(ARM_THUMB2)
+
+#define THUNK_RETURN_ADDRESS_OFFSET 0x38
+#define PRESERVED_RETURN_ADDRESS_OFFSET 0x3C
+#define PRESERVED_R4_OFFSET 0x40
+#define PRESERVED_R5_OFFSET 0x44
+#define PRESERVED_R6_OFFSET 0x48
+#define REGISTER_FILE_OFFSET 0x4C
+#define CALLFRAME_OFFSET 0x50
+#define EXCEPTION_OFFSET 0x54
+#define ENABLE_PROFILER_REFERENCE_OFFSET 0x58
+
+#elif (COMPILER(GCC) || COMPILER(RVCT)) && CPU(ARM_TRADITIONAL)
+
+#define THUNK_RETURN_ADDRESS_OFFSET 64
+#define PRESERVEDR4_OFFSET 68
+
+#elif COMPILER(MSVC) && CPU(X86)
+
+// These ASSERTs remind you that, if you change the layout of JITStackFrame, you
+// need to change the assembly trampolines below to match.
+COMPILE_ASSERT(offsetof(struct JITStackFrame, code) % 16 == 0x0, JITStackFrame_maintains_16byte_stack_alignment);
+COMPILE_ASSERT(offsetof(struct JITStackFrame, savedEBX) == 0x3c, JITStackFrame_stub_argument_space_matches_ctiTrampoline);
+COMPILE_ASSERT(offsetof(struct JITStackFrame, callFrame) == 0x58, JITStackFrame_callFrame_offset_matches_ctiTrampoline);
+COMPILE_ASSERT(offsetof(struct JITStackFrame, code) == 0x50, JITStackFrame_code_offset_matches_ctiTrampoline);
+
+extern "C" {
+
+ __declspec(naked) EncodedJSValue ctiTrampoline(void* code, RegisterFile*, CallFrame*, void* /*unused1*/, Profiler**, JSGlobalData*)
+ {
+ __asm {
+ push ebp;
+ mov ebp, esp;
+ push esi;
+ push edi;
+ push ebx;
+ sub esp, 0x3c;
+ mov esi, 512;
+ mov ecx, esp;
+ mov edi, [esp + 0x58];
+ call [esp + 0x50];
+ add esp, 0x3c;
+ pop ebx;
+ pop edi;
+ pop esi;
+ pop ebp;
+ ret;
+ }
+ }
+
+ __declspec(naked) void ctiVMThrowTrampoline()
+ {
+ __asm {
+ mov ecx, esp;
+ call cti_vm_throw;
+ add esp, 0x3c;
+ pop ebx;
+ pop edi;
+ pop esi;
+ pop ebp;
+ ret;
+ }
+ }
+
+ __declspec(naked) void ctiOpThrowNotCaught()
+ {
+ __asm {
+ add esp, 0x3c;
+ pop ebx;
+ pop edi;
+ pop esi;
+ pop ebp;
+ ret;
+ }
+ }
+}
+
+#elif COMPILER(MSVC) && CPU(ARM_TRADITIONAL)
+
+#define THUNK_RETURN_ADDRESS_OFFSET 64
+#define PRESERVEDR4_OFFSET 68
+// See DEFINE_STUB_FUNCTION for more information.
+
+#elif CPU(MIPS)
+
+#define PRESERVED_GP_OFFSET 60
+#define PRESERVED_S0_OFFSET 64
+#define PRESERVED_S1_OFFSET 68
+#define PRESERVED_S2_OFFSET 72
+#define PRESERVED_RETURN_ADDRESS_OFFSET 76
+#define THUNK_RETURN_ADDRESS_OFFSET 80
+#define REGISTER_FILE_OFFSET 84
+#define CALLFRAME_OFFSET 88
+#define EXCEPTION_OFFSET 92
+#define ENABLE_PROFILER_REFERENCE_OFFSET 96
+#define GLOBAL_DATA_OFFSET 100
+#define STACK_LENGTH 104
+
+#else
+ #error "JIT not supported on this platform."
+#endif
+
+#else // USE(JSVALUE32_64)
+
+#if COMPILER(GCC) && CPU(X86)
+
+// These ASSERTs remind you that, if you change the layout of JITStackFrame, you
+// need to change the assembly trampolines below to match.
+COMPILE_ASSERT(offsetof(struct JITStackFrame, callFrame) == 0x38, JITStackFrame_callFrame_offset_matches_ctiTrampoline);
+COMPILE_ASSERT(offsetof(struct JITStackFrame, code) == 0x30, JITStackFrame_code_offset_matches_ctiTrampoline);
+COMPILE_ASSERT(offsetof(struct JITStackFrame, savedEBX) == 0x1c, JITStackFrame_stub_argument_space_matches_ctiTrampoline);
+
+asm (
+".text\n"
+".globl " SYMBOL_STRING(ctiTrampoline) "\n"
+HIDE_SYMBOL(ctiTrampoline) "\n"
+SYMBOL_STRING(ctiTrampoline) ":" "\n"
+ "pushl %ebp" "\n"
+ "movl %esp, %ebp" "\n"
+ "pushl %esi" "\n"
+ "pushl %edi" "\n"
+ "pushl %ebx" "\n"
+ "subl $0x1c, %esp" "\n"
+ "movl $512, %esi" "\n"
+ "movl 0x38(%esp), %edi" "\n"
+ "call *0x30(%esp)" "\n"
+ "addl $0x1c, %esp" "\n"
+ "popl %ebx" "\n"
+ "popl %edi" "\n"
+ "popl %esi" "\n"
+ "popl %ebp" "\n"
+ "ret" "\n"
+);
+
+asm (
+".globl " SYMBOL_STRING(ctiVMThrowTrampoline) "\n"
+HIDE_SYMBOL(ctiVMThrowTrampoline) "\n"
+SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n"
+ "movl %esp, %ecx" "\n"
+ "call " SYMBOL_STRING_RELOCATION(cti_vm_throw) "\n"
+ "int3" "\n"
+);
+
+asm (
+".globl " SYMBOL_STRING(ctiOpThrowNotCaught) "\n"
+HIDE_SYMBOL(ctiOpThrowNotCaught) "\n"
+SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n"
+ "addl $0x1c, %esp" "\n"
+ "popl %ebx" "\n"
+ "popl %edi" "\n"
+ "popl %esi" "\n"
+ "popl %ebp" "\n"
+ "ret" "\n"
+);
+
+#elif COMPILER(GCC) && CPU(X86_64)
+
+// These ASSERTs remind you that, if you change the layout of JITStackFrame, you
+// need to change the assembly trampolines below to match.
+COMPILE_ASSERT(offsetof(struct JITStackFrame, callFrame) == 0x58, JITStackFrame_callFrame_offset_matches_ctiTrampoline);
+COMPILE_ASSERT(offsetof(struct JITStackFrame, code) == 0x48, JITStackFrame_code_offset_matches_ctiTrampoline);
+COMPILE_ASSERT(offsetof(struct JITStackFrame, savedRBX) == 0x78, JITStackFrame_stub_argument_space_matches_ctiTrampoline);
+
+asm (
+".text\n"
+".globl " SYMBOL_STRING(ctiTrampoline) "\n"
+HIDE_SYMBOL(ctiTrampoline) "\n"
+SYMBOL_STRING(ctiTrampoline) ":" "\n"
+ "pushq %rbp" "\n"
+ "movq %rsp, %rbp" "\n"
+ "pushq %r12" "\n"
+ "pushq %r13" "\n"
+ "pushq %r14" "\n"
+ "pushq %r15" "\n"
+ "pushq %rbx" "\n"
+ // Form the JIT stubs area
+ "pushq %r9" "\n"
+ "pushq %r8" "\n"
+ "pushq %rcx" "\n"
+ "pushq %rdx" "\n"
+ "pushq %rsi" "\n"
+ "pushq %rdi" "\n"
+ "subq $0x48, %rsp" "\n"
+ "movq $512, %r12" "\n"
+ "movq $0xFFFF000000000000, %r14" "\n"
+ "movq $0xFFFF000000000002, %r15" "\n"
+ "movq %rdx, %r13" "\n"
+ "call *%rdi" "\n"
+ "addq $0x78, %rsp" "\n"
+ "popq %rbx" "\n"
+ "popq %r15" "\n"
+ "popq %r14" "\n"
+ "popq %r13" "\n"
+ "popq %r12" "\n"
+ "popq %rbp" "\n"
+ "ret" "\n"
+);
+
+asm (
+".globl " SYMBOL_STRING(ctiVMThrowTrampoline) "\n"
+HIDE_SYMBOL(ctiVMThrowTrampoline) "\n"
+SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n"
+ "movq %rsp, %rdi" "\n"
+ "call " SYMBOL_STRING_RELOCATION(cti_vm_throw) "\n"
+ "int3" "\n"
+);
+
+asm (
+".globl " SYMBOL_STRING(ctiOpThrowNotCaught) "\n"
+HIDE_SYMBOL(ctiOpThrowNotCaught) "\n"
+SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n"
+ "addq $0x78, %rsp" "\n"
+ "popq %rbx" "\n"
+ "popq %r15" "\n"
+ "popq %r14" "\n"
+ "popq %r13" "\n"
+ "popq %r12" "\n"
+ "popq %rbp" "\n"
+ "ret" "\n"
+);
+
+#elif COMPILER(GCC) && CPU(ARM_THUMB2)
+
+#define THUNK_RETURN_ADDRESS_OFFSET 0x20
+#define PRESERVED_RETURN_ADDRESS_OFFSET 0x24
+#define PRESERVED_R4_OFFSET 0x28
+#define PRESERVED_R5_OFFSET 0x2C
+#define PRESERVED_R6_OFFSET 0x30
+#define REGISTER_FILE_OFFSET 0x34
+#define CALLFRAME_OFFSET 0x38
+#define EXCEPTION_OFFSET 0x3C
+#define ENABLE_PROFILER_REFERENCE_OFFSET 0x40
+
+#elif (COMPILER(GCC) || COMPILER(RVCT)) && CPU(ARM_TRADITIONAL)
+
+#define THUNK_RETURN_ADDRESS_OFFSET 32
+#define PRESERVEDR4_OFFSET 36
+
+#elif CPU(MIPS)
+
+#define PRESERVED_GP_OFFSET 28
+#define PRESERVED_S0_OFFSET 32
+#define PRESERVED_S1_OFFSET 36
+#define PRESERVED_S2_OFFSET 40
+#define PRESERVED_RETURN_ADDRESS_OFFSET 44
+#define THUNK_RETURN_ADDRESS_OFFSET 48
+#define REGISTER_FILE_OFFSET 52
+#define CALLFRAME_OFFSET 56
+#define EXCEPTION_OFFSET 60
+#define ENABLE_PROFILER_REFERENCE_OFFSET 64
+#define GLOBAL_DATA_OFFSET 68
+#define STACK_LENGTH 72
+
+#elif COMPILER(MSVC) && CPU(X86)
+
+// These ASSERTs remind you that, if you change the layout of JITStackFrame, you
+// need to change the assembly trampolines below to match.
+COMPILE_ASSERT(offsetof(struct JITStackFrame, callFrame) == 0x38, JITStackFrame_callFrame_offset_matches_ctiTrampoline);
+COMPILE_ASSERT(offsetof(struct JITStackFrame, code) == 0x30, JITStackFrame_code_offset_matches_ctiTrampoline);
+COMPILE_ASSERT(offsetof(struct JITStackFrame, savedEBX) == 0x1c, JITStackFrame_stub_argument_space_matches_ctiTrampoline);
+
+extern "C" {
+
+ __declspec(naked) EncodedJSValue ctiTrampoline(void* code, RegisterFile*, CallFrame*, void* /*unused1*/, Profiler**, JSGlobalData*)
+ {
+ __asm {
+ push ebp;
+ mov ebp, esp;
+ push esi;
+ push edi;
+ push ebx;
+ sub esp, 0x1c;
+ mov esi, 512;
+ mov ecx, esp;
+ mov edi, [esp + 0x38];
+ call [esp + 0x30];
+ add esp, 0x1c;
+ pop ebx;
+ pop edi;
+ pop esi;
+ pop ebp;
+ ret;
+ }
+ }
+
+ __declspec(naked) void ctiVMThrowTrampoline()
+ {
+ __asm {
+ mov ecx, esp;
+ call cti_vm_throw;
+ add esp, 0x1c;
+ pop ebx;
+ pop edi;
+ pop esi;
+ pop ebp;
+ ret;
+ }
+ }
+
+ __declspec(naked) void ctiOpThrowNotCaught()
+ {
+ __asm {
+ add esp, 0x1c;
+ pop ebx;
+ pop edi;
+ pop esi;
+ pop ebp;
+ ret;
+ }
+ }
+}
+
+#elif COMPILER(MSVC) && CPU(ARM_TRADITIONAL)
+
+#define THUNK_RETURN_ADDRESS_OFFSET 32
+#define PRESERVEDR4_OFFSET 36
+// See DEFINE_STUB_FUNCTION for more information.
+
+#else
+ #error "JIT not supported on this platform."
+#endif
+
+#endif // USE(JSVALUE32_64)
+
+#if CPU(MIPS)
+asm (
+".text" "\n"
+".align 2" "\n"
+".set noreorder" "\n"
+".set nomacro" "\n"
+".set nomips16" "\n"
+".globl " SYMBOL_STRING(ctiTrampoline) "\n"
+".ent " SYMBOL_STRING(ctiTrampoline) "\n"
+SYMBOL_STRING(ctiTrampoline) ":" "\n"
+ "addiu $29,$29,-" STRINGIZE_VALUE_OF(STACK_LENGTH) "\n"
+ "sw $31," STRINGIZE_VALUE_OF(PRESERVED_RETURN_ADDRESS_OFFSET) "($29)" "\n"
+ "sw $18," STRINGIZE_VALUE_OF(PRESERVED_S2_OFFSET) "($29)" "\n"
+ "sw $17," STRINGIZE_VALUE_OF(PRESERVED_S1_OFFSET) "($29)" "\n"
+ "sw $16," STRINGIZE_VALUE_OF(PRESERVED_S0_OFFSET) "($29)" "\n"
+#if WTF_MIPS_PIC
+ "sw $28," STRINGIZE_VALUE_OF(PRESERVED_GP_OFFSET) "($29)" "\n"
+#endif
+ "move $16,$6 # set callFrameRegister" "\n"
+ "li $17,512 # set timeoutCheckRegister" "\n"
+ "move $25,$4 # move executableAddress to t9" "\n"
+ "sw $5," STRINGIZE_VALUE_OF(REGISTER_FILE_OFFSET) "($29) # store registerFile to current stack" "\n"
+ "sw $6," STRINGIZE_VALUE_OF(CALLFRAME_OFFSET) "($29) # store callFrame to curent stack" "\n"
+ "sw $7," STRINGIZE_VALUE_OF(EXCEPTION_OFFSET) "($29) # store exception to current stack" "\n"
+ "lw $8," STRINGIZE_VALUE_OF(STACK_LENGTH + 16) "($29) # load enableProfilerReference from previous stack" "\n"
+ "lw $9," STRINGIZE_VALUE_OF(STACK_LENGTH + 20) "($29) # load globalData from previous stack" "\n"
+ "sw $8," STRINGIZE_VALUE_OF(ENABLE_PROFILER_REFERENCE_OFFSET) "($29) # store enableProfilerReference to current stack" "\n"
+ "jalr $25" "\n"
+ "sw $9," STRINGIZE_VALUE_OF(GLOBAL_DATA_OFFSET) "($29) # store globalData to current stack" "\n"
+ "lw $16," STRINGIZE_VALUE_OF(PRESERVED_S0_OFFSET) "($29)" "\n"
+ "lw $17," STRINGIZE_VALUE_OF(PRESERVED_S1_OFFSET) "($29)" "\n"
+ "lw $18," STRINGIZE_VALUE_OF(PRESERVED_S2_OFFSET) "($29)" "\n"
+ "lw $31," STRINGIZE_VALUE_OF(PRESERVED_RETURN_ADDRESS_OFFSET) "($29)" "\n"
+ "jr $31" "\n"
+ "addiu $29,$29," STRINGIZE_VALUE_OF(STACK_LENGTH) "\n"
+".set reorder" "\n"
+".set macro" "\n"
+".end " SYMBOL_STRING(ctiTrampoline) "\n"
+);
+
+asm (
+".text" "\n"
+".align 2" "\n"
+".set noreorder" "\n"
+".set nomacro" "\n"
+".set nomips16" "\n"
+".globl " SYMBOL_STRING(ctiVMThrowTrampoline) "\n"
+".ent " SYMBOL_STRING(ctiVMThrowTrampoline) "\n"
+SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n"
+#if WTF_MIPS_PIC
+ "lw $28," STRINGIZE_VALUE_OF(PRESERVED_GP_OFFSET) "($29)" "\n"
+".set macro" "\n"
+ "la $25," SYMBOL_STRING(cti_vm_throw) "\n"
+".set nomacro" "\n"
+ "bal " SYMBOL_STRING(cti_vm_throw) "\n"
+ "move $4,$29" "\n"
+#else
+ "jal " SYMBOL_STRING(cti_vm_throw) "\n"
+ "move $4,$29" "\n"
+#endif
+ "lw $16," STRINGIZE_VALUE_OF(PRESERVED_S0_OFFSET) "($29)" "\n"
+ "lw $17," STRINGIZE_VALUE_OF(PRESERVED_S1_OFFSET) "($29)" "\n"
+ "lw $18," STRINGIZE_VALUE_OF(PRESERVED_S2_OFFSET) "($29)" "\n"
+ "lw $31," STRINGIZE_VALUE_OF(PRESERVED_RETURN_ADDRESS_OFFSET) "($29)" "\n"
+ "jr $31" "\n"
+ "addiu $29,$29," STRINGIZE_VALUE_OF(STACK_LENGTH) "\n"
+".set reorder" "\n"
+".set macro" "\n"
+".end " SYMBOL_STRING(ctiVMThrowTrampoline) "\n"
+);
+
+asm (
+".text" "\n"
+".align 2" "\n"
+".set noreorder" "\n"
+".set nomacro" "\n"
+".set nomips16" "\n"
+".globl " SYMBOL_STRING(ctiOpThrowNotCaught) "\n"
+".ent " SYMBOL_STRING(ctiOpThrowNotCaught) "\n"
+SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n"
+ "lw $16," STRINGIZE_VALUE_OF(PRESERVED_S0_OFFSET) "($29)" "\n"
+ "lw $17," STRINGIZE_VALUE_OF(PRESERVED_S1_OFFSET) "($29)" "\n"
+ "lw $18," STRINGIZE_VALUE_OF(PRESERVED_S2_OFFSET) "($29)" "\n"
+ "lw $31," STRINGIZE_VALUE_OF(PRESERVED_RETURN_ADDRESS_OFFSET) "($29)" "\n"
+ "jr $31" "\n"
+ "addiu $29,$29," STRINGIZE_VALUE_OF(STACK_LENGTH) "\n"
+".set reorder" "\n"
+".set macro" "\n"
+".end " SYMBOL_STRING(ctiOpThrowNotCaught) "\n"
+);
+#endif
+
+#if COMPILER(GCC) && CPU(ARM_THUMB2)
+
+asm (
+".text" "\n"
+".align 2" "\n"
+".globl " SYMBOL_STRING(ctiTrampoline) "\n"
+HIDE_SYMBOL(ctiTrampoline) "\n"
+".thumb" "\n"
+".thumb_func " THUMB_FUNC_PARAM(ctiTrampoline) "\n"
+SYMBOL_STRING(ctiTrampoline) ":" "\n"
+ "sub sp, sp, #" STRINGIZE_VALUE_OF(ENABLE_PROFILER_REFERENCE_OFFSET) "\n"
+ "str lr, [sp, #" STRINGIZE_VALUE_OF(PRESERVED_RETURN_ADDRESS_OFFSET) "]" "\n"
+ "str r4, [sp, #" STRINGIZE_VALUE_OF(PRESERVED_R4_OFFSET) "]" "\n"
+ "str r5, [sp, #" STRINGIZE_VALUE_OF(PRESERVED_R5_OFFSET) "]" "\n"
+ "str r6, [sp, #" STRINGIZE_VALUE_OF(PRESERVED_R6_OFFSET) "]" "\n"
+ "str r1, [sp, #" STRINGIZE_VALUE_OF(REGISTER_FILE_OFFSET) "]" "\n"
+ "str r2, [sp, #" STRINGIZE_VALUE_OF(CALLFRAME_OFFSET) "]" "\n"
+ "str r3, [sp, #" STRINGIZE_VALUE_OF(EXCEPTION_OFFSET) "]" "\n"
+ "cpy r5, r2" "\n"
+ "mov r6, #512" "\n"
+ "blx r0" "\n"
+ "ldr r6, [sp, #" STRINGIZE_VALUE_OF(PRESERVED_R6_OFFSET) "]" "\n"
+ "ldr r5, [sp, #" STRINGIZE_VALUE_OF(PRESERVED_R5_OFFSET) "]" "\n"
+ "ldr r4, [sp, #" STRINGIZE_VALUE_OF(PRESERVED_R4_OFFSET) "]" "\n"
+ "ldr lr, [sp, #" STRINGIZE_VALUE_OF(PRESERVED_RETURN_ADDRESS_OFFSET) "]" "\n"
+ "add sp, sp, #" STRINGIZE_VALUE_OF(ENABLE_PROFILER_REFERENCE_OFFSET) "\n"
+ "bx lr" "\n"
+);
+
+asm (
+".text" "\n"
+".align 2" "\n"
+".globl " SYMBOL_STRING(ctiVMThrowTrampoline) "\n"
+HIDE_SYMBOL(ctiVMThrowTrampoline) "\n"
+".thumb" "\n"
+".thumb_func " THUMB_FUNC_PARAM(ctiVMThrowTrampoline) "\n"
+SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n"
+ "cpy r0, sp" "\n"
+ "bl " SYMBOL_STRING_RELOCATION(cti_vm_throw) "\n"
+ "ldr r6, [sp, #" STRINGIZE_VALUE_OF(PRESERVED_R6_OFFSET) "]" "\n"
+ "ldr r5, [sp, #" STRINGIZE_VALUE_OF(PRESERVED_R5_OFFSET) "]" "\n"
+ "ldr r4, [sp, #" STRINGIZE_VALUE_OF(PRESERVED_R4_OFFSET) "]" "\n"
+ "ldr lr, [sp, #" STRINGIZE_VALUE_OF(PRESERVED_RETURN_ADDRESS_OFFSET) "]" "\n"
+ "add sp, sp, #" STRINGIZE_VALUE_OF(ENABLE_PROFILER_REFERENCE_OFFSET) "\n"
+ "bx lr" "\n"
+);
+
+asm (
+".text" "\n"
+".align 2" "\n"
+".globl " SYMBOL_STRING(ctiOpThrowNotCaught) "\n"
+HIDE_SYMBOL(ctiOpThrowNotCaught) "\n"
+".thumb" "\n"
+".thumb_func " THUMB_FUNC_PARAM(ctiOpThrowNotCaught) "\n"
+SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n"
+ "ldr r6, [sp, #" STRINGIZE_VALUE_OF(PRESERVED_R6_OFFSET) "]" "\n"
+ "ldr r5, [sp, #" STRINGIZE_VALUE_OF(PRESERVED_R5_OFFSET) "]" "\n"
+ "ldr r4, [sp, #" STRINGIZE_VALUE_OF(PRESERVED_R4_OFFSET) "]" "\n"
+ "ldr lr, [sp, #" STRINGIZE_VALUE_OF(PRESERVED_RETURN_ADDRESS_OFFSET) "]" "\n"
+ "add sp, sp, #" STRINGIZE_VALUE_OF(ENABLE_PROFILER_REFERENCE_OFFSET) "\n"
+ "bx lr" "\n"
+);
+
+#elif COMPILER(GCC) && CPU(ARM_TRADITIONAL)
+
+asm (
+".globl " SYMBOL_STRING(ctiTrampoline) "\n"
+HIDE_SYMBOL(ctiTrampoline) "\n"
+SYMBOL_STRING(ctiTrampoline) ":" "\n"
+ "stmdb sp!, {r1-r3}" "\n"
+ "stmdb sp!, {r4-r8, lr}" "\n"
+ "sub sp, sp, #" STRINGIZE_VALUE_OF(PRESERVEDR4_OFFSET) "\n"
+ "mov r4, r2" "\n"
+ "mov r5, #512" "\n"
+ // r0 contains the code
+ "mov lr, pc" "\n"
+ "mov pc, r0" "\n"
+ "add sp, sp, #" STRINGIZE_VALUE_OF(PRESERVEDR4_OFFSET) "\n"
+ "ldmia sp!, {r4-r8, lr}" "\n"
+ "add sp, sp, #12" "\n"
+ "mov pc, lr" "\n"
+);
+
+asm (
+".globl " SYMBOL_STRING(ctiVMThrowTrampoline) "\n"
+HIDE_SYMBOL(ctiVMThrowTrampoline) "\n"
+SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n"
+ "mov r0, sp" "\n"
+ "bl " SYMBOL_STRING(cti_vm_throw) "\n"
+
+// Both has the same return sequence
+".globl " SYMBOL_STRING(ctiOpThrowNotCaught) "\n"
+HIDE_SYMBOL(ctiOpThrowNotCaught) "\n"
+SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n"
+ "add sp, sp, #" STRINGIZE_VALUE_OF(PRESERVEDR4_OFFSET) "\n"
+ "ldmia sp!, {r4-r8, lr}" "\n"
+ "add sp, sp, #12" "\n"
+ "mov pc, lr" "\n"
+);
+
+#elif COMPILER(RVCT) && CPU(ARM_TRADITIONAL)
+
+__asm EncodedJSValue ctiTrampoline(void*, RegisterFile*, CallFrame*, void* /*unused1*/, Profiler**, JSGlobalData*)
+{
+ ARM
+ stmdb sp!, {r1-r3}
+ stmdb sp!, {r4-r8, lr}
+ sub sp, sp, # PRESERVEDR4_OFFSET
+ mov r4, r2
+ mov r5, #512
+ mov lr, pc
+ bx r0
+ add sp, sp, # PRESERVEDR4_OFFSET
+ ldmia sp!, {r4-r8, lr}
+ add sp, sp, #12
+ bx lr
+}
+
+__asm void ctiVMThrowTrampoline()
+{
+ ARM
+ PRESERVE8
+ mov r0, sp
+ bl cti_vm_throw
+ add sp, sp, # PRESERVEDR4_OFFSET
+ ldmia sp!, {r4-r8, lr}
+ add sp, sp, #12
+ bx lr
+}
+
+__asm void ctiOpThrowNotCaught()
+{
+ ARM
+ add sp, sp, # PRESERVEDR4_OFFSET
+ ldmia sp!, {r4-r8, lr}
+ add sp, sp, #12
+ bx lr
+}
+#endif
+
+#if ENABLE(OPCODE_SAMPLING)
+ #define CTI_SAMPLER stackFrame.globalData->interpreter->sampler()
+#else
+ #define CTI_SAMPLER 0
+#endif
+
+JITThunks::JITThunks(JSGlobalData* globalData)
+{
+ if (!globalData->executableAllocator.isValid())
+ return;
+
+ JIT::compileCTIMachineTrampolines(globalData, &m_executablePool, &m_trampolineStructure);
+ ASSERT(m_executablePool);
+#if CPU(ARM_THUMB2)
+ // Unfortunate the arm compiler does not like the use of offsetof on JITStackFrame (since it contains non POD types),
+ // and the OBJECT_OFFSETOF macro does not appear constantish enough for it to be happy with its use in COMPILE_ASSERT
+ // macros.
+ ASSERT(OBJECT_OFFSETOF(struct JITStackFrame, preservedReturnAddress) == PRESERVED_RETURN_ADDRESS_OFFSET);
+ ASSERT(OBJECT_OFFSETOF(struct JITStackFrame, preservedR4) == PRESERVED_R4_OFFSET);
+ ASSERT(OBJECT_OFFSETOF(struct JITStackFrame, preservedR5) == PRESERVED_R5_OFFSET);
+ ASSERT(OBJECT_OFFSETOF(struct JITStackFrame, preservedR6) == PRESERVED_R6_OFFSET);
+
+ ASSERT(OBJECT_OFFSETOF(struct JITStackFrame, registerFile) == REGISTER_FILE_OFFSET);
+ ASSERT(OBJECT_OFFSETOF(struct JITStackFrame, callFrame) == CALLFRAME_OFFSET);
+ // The fifth argument is the first item already on the stack.
+ ASSERT(OBJECT_OFFSETOF(struct JITStackFrame, enabledProfilerReference) == ENABLE_PROFILER_REFERENCE_OFFSET);
+
+ ASSERT(OBJECT_OFFSETOF(struct JITStackFrame, thunkReturnAddress) == THUNK_RETURN_ADDRESS_OFFSET);
+
+#elif CPU(ARM_TRADITIONAL)
+
+ ASSERT(OBJECT_OFFSETOF(struct JITStackFrame, thunkReturnAddress) == THUNK_RETURN_ADDRESS_OFFSET);
+ ASSERT(OBJECT_OFFSETOF(struct JITStackFrame, preservedR4) == PRESERVEDR4_OFFSET);
+
+
+#elif CPU(MIPS)
+ ASSERT(OBJECT_OFFSETOF(struct JITStackFrame, preservedGP) == PRESERVED_GP_OFFSET);
+ ASSERT(OBJECT_OFFSETOF(struct JITStackFrame, preservedS0) == PRESERVED_S0_OFFSET);
+ ASSERT(OBJECT_OFFSETOF(struct JITStackFrame, preservedS1) == PRESERVED_S1_OFFSET);
+ ASSERT(OBJECT_OFFSETOF(struct JITStackFrame, preservedS2) == PRESERVED_S2_OFFSET);
+ ASSERT(OBJECT_OFFSETOF(struct JITStackFrame, preservedReturnAddress) == PRESERVED_RETURN_ADDRESS_OFFSET);
+ ASSERT(OBJECT_OFFSETOF(struct JITStackFrame, thunkReturnAddress) == THUNK_RETURN_ADDRESS_OFFSET);
+ ASSERT(OBJECT_OFFSETOF(struct JITStackFrame, registerFile) == REGISTER_FILE_OFFSET);
+ ASSERT(OBJECT_OFFSETOF(struct JITStackFrame, callFrame) == CALLFRAME_OFFSET);
+ ASSERT(OBJECT_OFFSETOF(struct JITStackFrame, exception) == EXCEPTION_OFFSET);
+ ASSERT(OBJECT_OFFSETOF(struct JITStackFrame, enabledProfilerReference) == ENABLE_PROFILER_REFERENCE_OFFSET);
+ ASSERT(OBJECT_OFFSETOF(struct JITStackFrame, globalData) == GLOBAL_DATA_OFFSET);
+
+#endif
+}
+
+JITThunks::~JITThunks()
+{
+}
+
+#if ENABLE(JIT_OPTIMIZE_PROPERTY_ACCESS)
+
+NEVER_INLINE void JITThunks::tryCachePutByID(CallFrame* callFrame, CodeBlock* codeBlock, ReturnAddressPtr returnAddress, JSValue baseValue, const PutPropertySlot& slot, StructureStubInfo* stubInfo, bool direct)
+{
+ // The interpreter checks for recursion here; I do not believe this can occur in CTI.
+
+ if (!baseValue.isCell())
+ return;
+
+ // Uncacheable: give up.
+ if (!slot.isCacheable()) {
+ ctiPatchCallByReturnAddress(codeBlock, returnAddress, FunctionPtr(direct ? cti_op_put_by_id_direct_generic : cti_op_put_by_id_generic));
+ return;
+ }
+
+ JSCell* baseCell = baseValue.asCell();
+ Structure* structure = baseCell->structure();
+
+ if (structure->isUncacheableDictionary()) {
+ ctiPatchCallByReturnAddress(codeBlock, returnAddress, FunctionPtr(direct ? cti_op_put_by_id_direct_generic : cti_op_put_by_id_generic));
+ return;
+ }
+
+ // If baseCell != base, then baseCell must be a proxy for another object.
+ if (baseCell != slot.base()) {
+ ctiPatchCallByReturnAddress(codeBlock, returnAddress, FunctionPtr(direct ? cti_op_put_by_id_direct_generic : cti_op_put_by_id_generic));
+ return;
+ }
+
+ // Cache hit: Specialize instruction and ref Structures.
+
+ // Structure transition, cache transition info
+ if (slot.type() == PutPropertySlot::NewProperty) {
+ if (structure->isDictionary()) {
+ ctiPatchCallByReturnAddress(codeBlock, returnAddress, FunctionPtr(direct ? cti_op_put_by_id_direct_generic : cti_op_put_by_id_generic));
+ return;
+ }
+
+ // put_by_id_transition checks the prototype chain for setters.
+ normalizePrototypeChain(callFrame, baseCell);
+
+ StructureChain* prototypeChain = structure->prototypeChain(callFrame);
+ stubInfo->initPutByIdTransition(structure->previousID(), structure, prototypeChain);
+ JIT::compilePutByIdTransition(callFrame->scopeChain()->globalData, codeBlock, stubInfo, structure->previousID(), structure, slot.cachedOffset(), prototypeChain, returnAddress, direct);
+ return;
+ }
+
+ stubInfo->initPutByIdReplace(structure);
+
+ JIT::patchPutByIdReplace(codeBlock, stubInfo, structure, slot.cachedOffset(), returnAddress, direct);
+}
+
+NEVER_INLINE void JITThunks::tryCacheGetByID(CallFrame* callFrame, CodeBlock* codeBlock, ReturnAddressPtr returnAddress, JSValue baseValue, const Identifier& propertyName, const PropertySlot& slot, StructureStubInfo* stubInfo)
+{
+ // FIXME: Write a test that proves we need to check for recursion here just
+ // like the interpreter does, then add a check for recursion.
+
+ // FIXME: Cache property access for immediates.
+ if (!baseValue.isCell()) {
+ ctiPatchCallByReturnAddress(codeBlock, returnAddress, FunctionPtr(cti_op_get_by_id_generic));
+ return;
+ }
+
+ JSGlobalData* globalData = &callFrame->globalData();
+
+ if (isJSArray(globalData, baseValue) && propertyName == callFrame->propertyNames().length) {
+ JIT::compilePatchGetArrayLength(callFrame->scopeChain()->globalData, codeBlock, returnAddress);
+ return;
+ }
+
+ if (isJSString(globalData, baseValue) && propertyName == callFrame->propertyNames().length) {
+ // The tradeoff of compiling an patched inline string length access routine does not seem
+ // to pay off, so we currently only do this for arrays.
+ ctiPatchCallByReturnAddress(codeBlock, returnAddress, globalData->jitStubs->ctiStringLengthTrampoline());
+ return;
+ }
+
+ // Uncacheable: give up.
+ if (!slot.isCacheable()) {
+ ctiPatchCallByReturnAddress(codeBlock, returnAddress, FunctionPtr(cti_op_get_by_id_generic));
+ return;
+ }
+
+ JSCell* baseCell = baseValue.asCell();
+ Structure* structure = baseCell->structure();
+
+ if (structure->isUncacheableDictionary()) {
+ ctiPatchCallByReturnAddress(codeBlock, returnAddress, FunctionPtr(cti_op_get_by_id_generic));
+ return;
+ }
+
+ // Cache hit: Specialize instruction and ref Structures.
+
+ if (slot.slotBase() == baseValue) {
+ // set this up, so derefStructures can do it's job.
+ stubInfo->initGetByIdSelf(structure);
+ if (slot.cachedPropertyType() != PropertySlot::Value)
+ ctiPatchCallByReturnAddress(codeBlock, returnAddress, FunctionPtr(cti_op_get_by_id_self_fail));
+ else
+ JIT::patchGetByIdSelf(codeBlock, stubInfo, structure, slot.cachedOffset(), returnAddress);
+ return;
+ }
+
+ if (structure->isDictionary()) {
+ ctiPatchCallByReturnAddress(codeBlock, returnAddress, FunctionPtr(cti_op_get_by_id_generic));
+ return;
+ }
+
+ if (slot.slotBase() == structure->prototypeForLookup(callFrame)) {
+ ASSERT(slot.slotBase().isObject());
+
+ JSObject* slotBaseObject = asObject(slot.slotBase());
+ size_t offset = slot.cachedOffset();
+
+ // Since we're accessing a prototype in a loop, it's a good bet that it
+ // should not be treated as a dictionary.
+ if (slotBaseObject->structure()->isDictionary()) {
+ slotBaseObject->flattenDictionaryObject();
+ offset = slotBaseObject->structure()->get(propertyName);
+ }
+
+ stubInfo->initGetByIdProto(structure, slotBaseObject->structure());
+
+ ASSERT(!structure->isDictionary());
+ ASSERT(!slotBaseObject->structure()->isDictionary());
+ JIT::compileGetByIdProto(callFrame->scopeChain()->globalData, callFrame, codeBlock, stubInfo, structure, slotBaseObject->structure(), propertyName, slot, offset, returnAddress);
+ return;
+ }
+
+ size_t offset = slot.cachedOffset();
+ size_t count = normalizePrototypeChain(callFrame, baseValue, slot.slotBase(), propertyName, offset);
+ if (!count) {
+ stubInfo->accessType = access_get_by_id_generic;
+ return;
+ }
+
+ StructureChain* prototypeChain = structure->prototypeChain(callFrame);
+ stubInfo->initGetByIdChain(structure, prototypeChain);
+ JIT::compileGetByIdChain(callFrame->scopeChain()->globalData, callFrame, codeBlock, stubInfo, structure, prototypeChain, count, propertyName, slot, offset, returnAddress);
+}
+
+#endif // ENABLE(JIT_OPTIMIZE_PROPERTY_ACCESS)
+
+#ifndef NDEBUG
+
+extern "C" {
+
+static void jscGeneratedNativeCode()
+{
+ // When executing a JIT stub function (which might do an allocation), we hack the return address
+ // to pretend to be executing this function, to keep stack logging tools from blowing out
+ // memory.
+}
+
+}
+
+struct StackHack {
+ ALWAYS_INLINE StackHack(JITStackFrame& stackFrame)
+ : stackFrame(stackFrame)
+ , savedReturnAddress(*stackFrame.returnAddressSlot())
+ {
+ *stackFrame.returnAddressSlot() = ReturnAddressPtr(FunctionPtr(jscGeneratedNativeCode));
+ }
+
+ ALWAYS_INLINE ~StackHack()
+ {
+ *stackFrame.returnAddressSlot() = savedReturnAddress;
+ }
+
+ JITStackFrame& stackFrame;
+ ReturnAddressPtr savedReturnAddress;
+};
+
+#define STUB_INIT_STACK_FRAME(stackFrame) JITStackFrame& stackFrame = *reinterpret_cast_ptr<JITStackFrame*>(STUB_ARGS); StackHack stackHack(stackFrame)
+#define STUB_SET_RETURN_ADDRESS(returnAddress) stackHack.savedReturnAddress = ReturnAddressPtr(returnAddress)
+#define STUB_RETURN_ADDRESS stackHack.savedReturnAddress
+
+#else
+
+#define STUB_INIT_STACK_FRAME(stackFrame) JITStackFrame& stackFrame = *reinterpret_cast_ptr<JITStackFrame*>(STUB_ARGS)
+#define STUB_SET_RETURN_ADDRESS(returnAddress) *stackFrame.returnAddressSlot() = ReturnAddressPtr(returnAddress)
+#define STUB_RETURN_ADDRESS *stackFrame.returnAddressSlot()
+
+#endif
+
+// The reason this is not inlined is to avoid having to do a PIC branch
+// to get the address of the ctiVMThrowTrampoline function. It's also
+// good to keep the code size down by leaving as much of the exception
+// handling code out of line as possible.
+static NEVER_INLINE void returnToThrowTrampoline(JSGlobalData* globalData, ReturnAddressPtr exceptionLocation, ReturnAddressPtr& returnAddressSlot)
+{
+ ASSERT(globalData->exception);
+ globalData->exceptionLocation = exceptionLocation;
+ returnAddressSlot = ReturnAddressPtr(FunctionPtr(ctiVMThrowTrampoline));
+}
+
+static NEVER_INLINE void throwStackOverflowError(CallFrame* callFrame, JSGlobalData* globalData, ReturnAddressPtr exceptionLocation, ReturnAddressPtr& returnAddressSlot)
+{
+ globalData->exception = createStackOverflowError(callFrame);
+ returnToThrowTrampoline(globalData, exceptionLocation, returnAddressSlot);
+}
+
+#define VM_THROW_EXCEPTION() \
+ do { \
+ VM_THROW_EXCEPTION_AT_END(); \
+ return 0; \
+ } while (0)
+#define VM_THROW_EXCEPTION_AT_END() \
+ do {\
+ returnToThrowTrampoline(stackFrame.globalData, STUB_RETURN_ADDRESS, STUB_RETURN_ADDRESS);\
+ } while (0)
+
+#define CHECK_FOR_EXCEPTION() \
+ do { \
+ if (UNLIKELY(stackFrame.globalData->exception)) \
+ VM_THROW_EXCEPTION(); \
+ } while (0)
+#define CHECK_FOR_EXCEPTION_AT_END() \
+ do { \
+ if (UNLIKELY(stackFrame.globalData->exception)) \
+ VM_THROW_EXCEPTION_AT_END(); \
+ } while (0)
+#define CHECK_FOR_EXCEPTION_VOID() \
+ do { \
+ if (UNLIKELY(stackFrame.globalData->exception)) { \
+ VM_THROW_EXCEPTION_AT_END(); \
+ return; \
+ } \
+ } while (0)
+
+struct ExceptionHandler {
+ void* catchRoutine;
+ CallFrame* callFrame;
+};
+static ExceptionHandler jitThrow(JSGlobalData* globalData, CallFrame* callFrame, JSValue exceptionValue, ReturnAddressPtr faultLocation)
+{
+ ASSERT(exceptionValue);
+
+ unsigned vPCIndex = callFrame->codeBlock()->bytecodeOffset(faultLocation);
+ globalData->exception = JSValue();
+ HandlerInfo* handler = globalData->interpreter->throwException(callFrame, exceptionValue, vPCIndex); // This may update callFrame & exceptionValue!
+ globalData->exception = exceptionValue;
+
+ void* catchRoutine = handler ? handler->nativeCode.executableAddress() : FunctionPtr(ctiOpThrowNotCaught).value();
+ ASSERT(catchRoutine);
+ ExceptionHandler exceptionHandler = { catchRoutine, callFrame };
+ return exceptionHandler;
+}
+
+#if CPU(ARM_THUMB2)
+
+#define DEFINE_STUB_FUNCTION(rtype, op) \
+ extern "C" { \
+ rtype JITStubThunked_##op(STUB_ARGS_DECLARATION); \
+ }; \
+ asm ( \
+ ".text" "\n" \
+ ".align 2" "\n" \
+ ".globl " SYMBOL_STRING(cti_##op) "\n" \
+ HIDE_SYMBOL(cti_##op) "\n" \
+ ".thumb" "\n" \
+ ".thumb_func " THUMB_FUNC_PARAM(cti_##op) "\n" \
+ SYMBOL_STRING(cti_##op) ":" "\n" \
+ "str lr, [sp, #" STRINGIZE_VALUE_OF(THUNK_RETURN_ADDRESS_OFFSET) "]" "\n" \
+ "bl " SYMBOL_STRING(JITStubThunked_##op) "\n" \
+ "ldr lr, [sp, #" STRINGIZE_VALUE_OF(THUNK_RETURN_ADDRESS_OFFSET) "]" "\n" \
+ "bx lr" "\n" \
+ ); \
+ rtype JITStubThunked_##op(STUB_ARGS_DECLARATION) \
+
+#elif CPU(MIPS)
+#if WTF_MIPS_PIC
+#define DEFINE_STUB_FUNCTION(rtype, op) \
+ extern "C" { \
+ rtype JITStubThunked_##op(STUB_ARGS_DECLARATION); \
+ }; \
+ asm ( \
+ ".text" "\n" \
+ ".align 2" "\n" \
+ ".set noreorder" "\n" \
+ ".set nomacro" "\n" \
+ ".set nomips16" "\n" \
+ ".globl " SYMBOL_STRING(cti_##op) "\n" \
+ ".ent " SYMBOL_STRING(cti_##op) "\n" \
+ SYMBOL_STRING(cti_##op) ":" "\n" \
+ "lw $28," STRINGIZE_VALUE_OF(PRESERVED_GP_OFFSET) "($29)" "\n" \
+ "sw $31," STRINGIZE_VALUE_OF(THUNK_RETURN_ADDRESS_OFFSET) "($29)" "\n" \
+ ".set macro" "\n" \
+ "la $25," SYMBOL_STRING(JITStubThunked_##op) "\n" \
+ ".set nomacro" "\n" \
+ "bal " SYMBOL_STRING(JITStubThunked_##op) "\n" \
+ "nop" "\n" \
+ "lw $31," STRINGIZE_VALUE_OF(THUNK_RETURN_ADDRESS_OFFSET) "($29)" "\n" \
+ "jr $31" "\n" \
+ "nop" "\n" \
+ ".set reorder" "\n" \
+ ".set macro" "\n" \
+ ".end " SYMBOL_STRING(cti_##op) "\n" \
+ ); \
+ rtype JITStubThunked_##op(STUB_ARGS_DECLARATION)
+
+#else // WTF_MIPS_PIC
+#define DEFINE_STUB_FUNCTION(rtype, op) \
+ extern "C" { \
+ rtype JITStubThunked_##op(STUB_ARGS_DECLARATION); \
+ }; \
+ asm ( \
+ ".text" "\n" \
+ ".align 2" "\n" \
+ ".set noreorder" "\n" \
+ ".set nomacro" "\n" \
+ ".set nomips16" "\n" \
+ ".globl " SYMBOL_STRING(cti_##op) "\n" \
+ ".ent " SYMBOL_STRING(cti_##op) "\n" \
+ SYMBOL_STRING(cti_##op) ":" "\n" \
+ "sw $31," STRINGIZE_VALUE_OF(THUNK_RETURN_ADDRESS_OFFSET) "($29)" "\n" \
+ "jal " SYMBOL_STRING(JITStubThunked_##op) "\n" \
+ "nop" "\n" \
+ "lw $31," STRINGIZE_VALUE_OF(THUNK_RETURN_ADDRESS_OFFSET) "($29)" "\n" \
+ "jr $31" "\n" \
+ "nop" "\n" \
+ ".set reorder" "\n" \
+ ".set macro" "\n" \
+ ".end " SYMBOL_STRING(cti_##op) "\n" \
+ ); \
+ rtype JITStubThunked_##op(STUB_ARGS_DECLARATION)
+
+#endif
+
+#elif CPU(ARM_TRADITIONAL) && COMPILER(GCC)
+
+#define DEFINE_STUB_FUNCTION(rtype, op) \
+ extern "C" { \
+ rtype JITStubThunked_##op(STUB_ARGS_DECLARATION); \
+ }; \
+ asm ( \
+ ".globl " SYMBOL_STRING(cti_##op) "\n" \
+ SYMBOL_STRING(cti_##op) ":" "\n" \
+ "str lr, [sp, #" STRINGIZE_VALUE_OF(THUNK_RETURN_ADDRESS_OFFSET) "]" "\n" \
+ "bl " SYMBOL_STRING(JITStubThunked_##op) "\n" \
+ "ldr lr, [sp, #" STRINGIZE_VALUE_OF(THUNK_RETURN_ADDRESS_OFFSET) "]" "\n" \
+ "mov pc, lr" "\n" \
+ ); \
+ rtype JITStubThunked_##op(STUB_ARGS_DECLARATION)
+
+#elif CPU(ARM_TRADITIONAL) && COMPILER(RVCT)
+
+#define DEFINE_STUB_FUNCTION(rtype, op) rtype JITStubThunked_##op(STUB_ARGS_DECLARATION)
+
+/* The following is a workaround for RVCT toolchain; precompiler macros are not expanded before the code is passed to the assembler */
+
+/* The following section is a template to generate code for GeneratedJITStubs_RVCT.h */
+/* The pattern "#xxx#" will be replaced with "xxx" */
+
+/*
+RVCT(extern "C" #rtype# JITStubThunked_#op#(STUB_ARGS_DECLARATION);)
+RVCT(__asm #rtype# cti_#op#(STUB_ARGS_DECLARATION))
+RVCT({)
+RVCT( ARM)
+RVCT( IMPORT JITStubThunked_#op#)
+RVCT( str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET])
+RVCT( bl JITStubThunked_#op#)
+RVCT( ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET])
+RVCT( bx lr)
+RVCT(})
+RVCT()
+*/
+
+/* Include the generated file */
+#include "GeneratedJITStubs_RVCT.h"
+
+#elif CPU(ARM_TRADITIONAL) && COMPILER(MSVC)
+
+#define DEFINE_STUB_FUNCTION(rtype, op) extern "C" rtype JITStubThunked_##op(STUB_ARGS_DECLARATION)
+
+/* The following is a workaround for MSVC toolchain; inline assembler is not supported */
+
+/* The following section is a template to generate code for GeneratedJITStubs_MSVC.asm */
+/* The pattern "#xxx#" will be replaced with "xxx" */
+
+/*
+MSVC_BEGIN( AREA Trampoline, CODE)
+MSVC_BEGIN()
+MSVC_BEGIN( EXPORT ctiTrampoline)
+MSVC_BEGIN( EXPORT ctiVMThrowTrampoline)
+MSVC_BEGIN( EXPORT ctiOpThrowNotCaught)
+MSVC_BEGIN()
+MSVC_BEGIN(ctiTrampoline PROC)
+MSVC_BEGIN( stmdb sp!, {r1-r3})
+MSVC_BEGIN( stmdb sp!, {r4-r8, lr})
+MSVC_BEGIN( sub sp, sp, # THUNK_RETURN_ADDRESS_OFFSET + 4)
+MSVC_BEGIN( mov r4, r2)
+MSVC_BEGIN( mov r5, #512)
+MSVC_BEGIN( ; r0 contains the code)
+MSVC_BEGIN( mov lr, pc)
+MSVC_BEGIN( bx r0)
+MSVC_BEGIN( add sp, sp, # THUNK_RETURN_ADDRESS_OFFSET + 4)
+MSVC_BEGIN( ldmia sp!, {r4-r8, lr})
+MSVC_BEGIN( add sp, sp, #12)
+MSVC_BEGIN( bx lr)
+MSVC_BEGIN(ctiTrampoline ENDP)
+MSVC_BEGIN()
+MSVC_BEGIN(ctiVMThrowTrampoline PROC)
+MSVC_BEGIN( mov r0, sp)
+MSVC_BEGIN( mov lr, pc)
+MSVC_BEGIN( bl cti_vm_throw)
+MSVC_BEGIN(ctiOpThrowNotCaught)
+MSVC_BEGIN( add sp, sp, # THUNK_RETURN_ADDRESS_OFFSET + 4)
+MSVC_BEGIN( ldmia sp!, {r4-r8, lr})
+MSVC_BEGIN( add sp, sp, #12)
+MSVC_BEGIN( bx lr)
+MSVC_BEGIN(ctiVMThrowTrampoline ENDP)
+MSVC_BEGIN()
+
+MSVC( EXPORT cti_#op#)
+MSVC( IMPORT JITStubThunked_#op#)
+MSVC(cti_#op# PROC)
+MSVC( str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET])
+MSVC( bl JITStubThunked_#op#)
+MSVC( ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET])
+MSVC( bx lr)
+MSVC(cti_#op# ENDP)
+MSVC()
+
+MSVC_END( END)
+*/
+
+#else
+#define DEFINE_STUB_FUNCTION(rtype, op) rtype JIT_STUB cti_##op(STUB_ARGS_DECLARATION)
+#endif
+
+DEFINE_STUB_FUNCTION(EncodedJSValue, op_create_this)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+ CallFrame* callFrame = stackFrame.callFrame;
+
+ JSFunction* constructor = asFunction(callFrame->callee());
+#if !ASSERT_DISABLED
+ ConstructData constructData;
+ ASSERT(constructor->getConstructData(constructData) == ConstructTypeJS);
+#endif
+
+ Structure* structure;
+ JSValue proto = stackFrame.args[0].jsValue();
+ if (proto.isObject())
+ structure = asObject(proto)->inheritorID();
+ else
+ structure = constructor->scope().node()->globalObject->emptyObjectStructure();
+ JSValue result = new (&callFrame->globalData()) JSObject(structure);
+
+ return JSValue::encode(result);
+}
+
+DEFINE_STUB_FUNCTION(EncodedJSValue, op_convert_this)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ JSValue v1 = stackFrame.args[0].jsValue();
+ CallFrame* callFrame = stackFrame.callFrame;
+
+ JSObject* result = v1.toThisObject(callFrame);
+ CHECK_FOR_EXCEPTION_AT_END();
+ return JSValue::encode(result);
+}
+
+DEFINE_STUB_FUNCTION(EncodedJSValue, op_convert_this_strict)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ JSValue v1 = stackFrame.args[0].jsValue();
+ CallFrame* callFrame = stackFrame.callFrame;
+ ASSERT(v1.asCell()->structure()->typeInfo().needsThisConversion());
+ JSValue result = v1.toStrictThisObject(callFrame);
+ CHECK_FOR_EXCEPTION_AT_END();
+ return JSValue::encode(result);
+}
+
+DEFINE_STUB_FUNCTION(void, op_end)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ ScopeChainNode* scopeChain = stackFrame.callFrame->scopeChain();
+ ASSERT(scopeChain->refCount > 1);
+ scopeChain->deref();
+}
+
+DEFINE_STUB_FUNCTION(EncodedJSValue, op_add)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ JSValue v1 = stackFrame.args[0].jsValue();
+ JSValue v2 = stackFrame.args[1].jsValue();
+ CallFrame* callFrame = stackFrame.callFrame;
+
+ if (v1.isString()) {
+ JSValue result = v2.isString()
+ ? jsString(callFrame, asString(v1), asString(v2))
+ : jsString(callFrame, asString(v1), v2.toPrimitiveString(callFrame));
+ CHECK_FOR_EXCEPTION_AT_END();
+ return JSValue::encode(result);
+ }
+
+ double left = 0.0, right;
+ if (v1.getNumber(left) && v2.getNumber(right))
+ return JSValue::encode(jsNumber(left + right));
+
+ // All other cases are pretty uncommon
+ JSValue result = jsAddSlowCase(callFrame, v1, v2);
+ CHECK_FOR_EXCEPTION_AT_END();
+ return JSValue::encode(result);
+}
+
+DEFINE_STUB_FUNCTION(EncodedJSValue, op_pre_inc)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ JSValue v = stackFrame.args[0].jsValue();
+
+ CallFrame* callFrame = stackFrame.callFrame;
+ JSValue result = jsNumber(v.toNumber(callFrame) + 1);
+ CHECK_FOR_EXCEPTION_AT_END();
+ return JSValue::encode(result);
+}
+
+DEFINE_STUB_FUNCTION(int, timeout_check)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ JSGlobalData* globalData = stackFrame.globalData;
+ TimeoutChecker& timeoutChecker = globalData->timeoutChecker;
+
+ if (globalData->terminator.shouldTerminate()) {
+ globalData->exception = createTerminatedExecutionException(globalData);
+ VM_THROW_EXCEPTION_AT_END();
+ } else if (timeoutChecker.didTimeOut(stackFrame.callFrame)) {
+ globalData->exception = createInterruptedExecutionException(globalData);
+ VM_THROW_EXCEPTION_AT_END();
+ }
+
+ return timeoutChecker.ticksUntilNextCheck();
+}
+
+DEFINE_STUB_FUNCTION(void*, register_file_check)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+ CallFrame* callFrame = stackFrame.callFrame;
+
+ if (UNLIKELY(!stackFrame.registerFile->grow(&callFrame->registers()[callFrame->codeBlock()->m_numCalleeRegisters]))) {
+ // Rewind to the previous call frame because op_call already optimistically
+ // moved the call frame forward.
+ CallFrame* oldCallFrame = callFrame->callerFrame();
+ ExceptionHandler handler = jitThrow(stackFrame.globalData, oldCallFrame, createStackOverflowError(oldCallFrame), ReturnAddressPtr(oldCallFrame->returnPC()));
+ STUB_SET_RETURN_ADDRESS(handler.catchRoutine);
+ callFrame = handler.callFrame;
+ }
+
+ return callFrame;
+}
+
+DEFINE_STUB_FUNCTION(int, op_loop_if_lesseq)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ JSValue src1 = stackFrame.args[0].jsValue();
+ JSValue src2 = stackFrame.args[1].jsValue();
+ CallFrame* callFrame = stackFrame.callFrame;
+
+ bool result = jsLessEq(callFrame, src1, src2);
+ CHECK_FOR_EXCEPTION_AT_END();
+ return result;
+}
+
+DEFINE_STUB_FUNCTION(JSObject*, op_new_object)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ return constructEmptyObject(stackFrame.callFrame);
+}
+
+DEFINE_STUB_FUNCTION(void, op_put_by_id_generic)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ PutPropertySlot slot(stackFrame.callFrame->codeBlock()->isStrictMode());
+ stackFrame.args[0].jsValue().put(stackFrame.callFrame, stackFrame.args[1].identifier(), stackFrame.args[2].jsValue(), slot);
+ CHECK_FOR_EXCEPTION_AT_END();
+}
+
+DEFINE_STUB_FUNCTION(void, op_put_by_id_direct_generic)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ PutPropertySlot slot(stackFrame.callFrame->codeBlock()->isStrictMode());
+ stackFrame.args[0].jsValue().putDirect(stackFrame.callFrame, stackFrame.args[1].identifier(), stackFrame.args[2].jsValue(), slot);
+ CHECK_FOR_EXCEPTION_AT_END();
+}
+
+DEFINE_STUB_FUNCTION(EncodedJSValue, op_get_by_id_generic)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ CallFrame* callFrame = stackFrame.callFrame;
+ Identifier& ident = stackFrame.args[1].identifier();
+
+ JSValue baseValue = stackFrame.args[0].jsValue();
+ PropertySlot slot(baseValue);
+ JSValue result = baseValue.get(callFrame, ident, slot);
+
+ CHECK_FOR_EXCEPTION_AT_END();
+ return JSValue::encode(result);
+}
+
+#if ENABLE(JIT_OPTIMIZE_PROPERTY_ACCESS)
+
+DEFINE_STUB_FUNCTION(void, op_put_by_id)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+ CallFrame* callFrame = stackFrame.callFrame;
+ Identifier& ident = stackFrame.args[1].identifier();
+
+ PutPropertySlot slot(callFrame->codeBlock()->isStrictMode());
+ stackFrame.args[0].jsValue().put(callFrame, ident, stackFrame.args[2].jsValue(), slot);
+
+ CodeBlock* codeBlock = stackFrame.callFrame->codeBlock();
+ StructureStubInfo* stubInfo = &codeBlock->getStubInfo(STUB_RETURN_ADDRESS);
+ if (!stubInfo->seenOnce())
+ stubInfo->setSeen();
+ else
+ JITThunks::tryCachePutByID(callFrame, codeBlock, STUB_RETURN_ADDRESS, stackFrame.args[0].jsValue(), slot, stubInfo, false);
+
+ CHECK_FOR_EXCEPTION_AT_END();
+}
+
+DEFINE_STUB_FUNCTION(void, op_put_by_id_direct)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+ CallFrame* callFrame = stackFrame.callFrame;
+ Identifier& ident = stackFrame.args[1].identifier();
+
+ PutPropertySlot slot(callFrame->codeBlock()->isStrictMode());
+ stackFrame.args[0].jsValue().putDirect(callFrame, ident, stackFrame.args[2].jsValue(), slot);
+
+ CodeBlock* codeBlock = stackFrame.callFrame->codeBlock();
+ StructureStubInfo* stubInfo = &codeBlock->getStubInfo(STUB_RETURN_ADDRESS);
+ if (!stubInfo->seenOnce())
+ stubInfo->setSeen();
+ else
+ JITThunks::tryCachePutByID(callFrame, codeBlock, STUB_RETURN_ADDRESS, stackFrame.args[0].jsValue(), slot, stubInfo, true);
+
+ CHECK_FOR_EXCEPTION_AT_END();
+}
+
+DEFINE_STUB_FUNCTION(void, op_put_by_id_fail)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ CallFrame* callFrame = stackFrame.callFrame;
+ Identifier& ident = stackFrame.args[1].identifier();
+
+ PutPropertySlot slot(callFrame->codeBlock()->isStrictMode());
+ stackFrame.args[0].jsValue().put(callFrame, ident, stackFrame.args[2].jsValue(), slot);
+
+ CHECK_FOR_EXCEPTION_AT_END();
+}
+
+DEFINE_STUB_FUNCTION(void, op_put_by_id_direct_fail)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ CallFrame* callFrame = stackFrame.callFrame;
+ Identifier& ident = stackFrame.args[1].identifier();
+
+ PutPropertySlot slot(callFrame->codeBlock()->isStrictMode());
+ stackFrame.args[0].jsValue().putDirect(callFrame, ident, stackFrame.args[2].jsValue(), slot);
+
+ CHECK_FOR_EXCEPTION_AT_END();
+}
+
+DEFINE_STUB_FUNCTION(JSObject*, op_put_by_id_transition_realloc)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ JSValue baseValue = stackFrame.args[0].jsValue();
+ int32_t oldSize = stackFrame.args[3].int32();
+ int32_t newSize = stackFrame.args[4].int32();
+
+ ASSERT(baseValue.isObject());
+ JSObject* base = asObject(baseValue);
+ base->allocatePropertyStorage(oldSize, newSize);
+
+ return base;
+}
+
+DEFINE_STUB_FUNCTION(EncodedJSValue, op_get_by_id_method_check)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ CallFrame* callFrame = stackFrame.callFrame;
+ Identifier& ident = stackFrame.args[1].identifier();
+
+ JSValue baseValue = stackFrame.args[0].jsValue();
+ PropertySlot slot(baseValue);
+ JSValue result = baseValue.get(callFrame, ident, slot);
+ CHECK_FOR_EXCEPTION();
+
+ CodeBlock* codeBlock = stackFrame.callFrame->codeBlock();
+ MethodCallLinkInfo& methodCallLinkInfo = codeBlock->getMethodCallLinkInfo(STUB_RETURN_ADDRESS);
+
+ if (!methodCallLinkInfo.seenOnce()) {
+ methodCallLinkInfo.setSeen();
+ return JSValue::encode(result);
+ }
+
+ // If we successfully got something, then the base from which it is being accessed must
+ // be an object. (Assertion to ensure asObject() call below is safe, which comes after
+ // an isCacheable() chceck.
+ ASSERT(!slot.isCacheableValue() || slot.slotBase().isObject());
+
+ // Check that:
+ // * We're dealing with a JSCell,
+ // * the property is cachable,
+ // * it's not a dictionary
+ // * there is a function cached.
+ Structure* structure;
+ JSCell* specific;
+ JSObject* slotBaseObject;
+ if (baseValue.isCell()
+ && slot.isCacheableValue()
+ && !(structure = baseValue.asCell()->structure())->isUncacheableDictionary()
+ && (slotBaseObject = asObject(slot.slotBase()))->getPropertySpecificValue(callFrame, ident, specific)
+ && specific
+ ) {
+
+ JSFunction* callee = (JSFunction*)specific;
+
+ // Since we're accessing a prototype in a loop, it's a good bet that it
+ // should not be treated as a dictionary.
+ if (slotBaseObject->structure()->isDictionary())
+ slotBaseObject->flattenDictionaryObject();
+
+ // The result fetched should always be the callee!
+ ASSERT(result == JSValue(callee));
+
+ // Check to see if the function is on the object's prototype. Patch up the code to optimize.
+ if (slot.slotBase() == structure->prototypeForLookup(callFrame)) {
+ JIT::patchMethodCallProto(codeBlock, methodCallLinkInfo, callee, structure, slotBaseObject, STUB_RETURN_ADDRESS);
+ return JSValue::encode(result);
+ }
+
+ // Check to see if the function is on the object itself.
+ // Since we generate the method-check to check both the structure and a prototype-structure (since this
+ // is the common case) we have a problem - we need to patch the prototype structure check to do something
+ // useful. We could try to nop it out altogether, but that's a little messy, so lets do something simpler
+ // for now. For now it performs a check on a special object on the global object only used for this
+ // purpose. The object is in no way exposed, and as such the check will always pass.
+ if (slot.slotBase() == baseValue) {
+ JIT::patchMethodCallProto(codeBlock, methodCallLinkInfo, callee, structure, callFrame->scopeChain()->globalObject->methodCallDummy(), STUB_RETURN_ADDRESS);
+ return JSValue::encode(result);
+ }
+ }
+
+ // Revert the get_by_id op back to being a regular get_by_id - allow it to cache like normal, if it needs to.
+ ctiPatchCallByReturnAddress(codeBlock, STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_id));
+ return JSValue::encode(result);
+}
+
+DEFINE_STUB_FUNCTION(EncodedJSValue, op_get_by_id)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+ CallFrame* callFrame = stackFrame.callFrame;
+ Identifier& ident = stackFrame.args[1].identifier();
+
+ JSValue baseValue = stackFrame.args[0].jsValue();
+ PropertySlot slot(baseValue);
+ JSValue result = baseValue.get(callFrame, ident, slot);
+
+ CodeBlock* codeBlock = stackFrame.callFrame->codeBlock();
+ StructureStubInfo* stubInfo = &codeBlock->getStubInfo(STUB_RETURN_ADDRESS);
+ if (!stubInfo->seenOnce())
+ stubInfo->setSeen();
+ else
+ JITThunks::tryCacheGetByID(callFrame, codeBlock, STUB_RETURN_ADDRESS, baseValue, ident, slot, stubInfo);
+
+ CHECK_FOR_EXCEPTION_AT_END();
+ return JSValue::encode(result);
+}
+
+DEFINE_STUB_FUNCTION(EncodedJSValue, op_get_by_id_self_fail)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ CallFrame* callFrame = stackFrame.callFrame;
+ Identifier& ident = stackFrame.args[1].identifier();
+
+ JSValue baseValue = stackFrame.args[0].jsValue();
+ PropertySlot slot(baseValue);
+ JSValue result = baseValue.get(callFrame, ident, slot);
+
+ CHECK_FOR_EXCEPTION();
+
+ if (baseValue.isCell()
+ && slot.isCacheable()
+ && !baseValue.asCell()->structure()->isUncacheableDictionary()
+ && slot.slotBase() == baseValue) {
+
+ CodeBlock* codeBlock = callFrame->codeBlock();
+ StructureStubInfo* stubInfo = &codeBlock->getStubInfo(STUB_RETURN_ADDRESS);
+
+ ASSERT(slot.slotBase().isObject());
+
+ PolymorphicAccessStructureList* polymorphicStructureList;
+ int listIndex = 1;
+
+ if (stubInfo->accessType == access_get_by_id_self) {
+ ASSERT(!stubInfo->stubRoutine);
+ polymorphicStructureList = new PolymorphicAccessStructureList(CodeLocationLabel(), stubInfo->u.getByIdSelf.baseObjectStructure);
+ stubInfo->initGetByIdSelfList(polymorphicStructureList, 1);
+ } else {
+ polymorphicStructureList = stubInfo->u.getByIdSelfList.structureList;
+ listIndex = stubInfo->u.getByIdSelfList.listSize;
+ }
+ if (listIndex < POLYMORPHIC_LIST_CACHE_SIZE) {
+ stubInfo->u.getByIdSelfList.listSize++;
+ JIT::compileGetByIdSelfList(callFrame->scopeChain()->globalData, codeBlock, stubInfo, polymorphicStructureList, listIndex, baseValue.asCell()->structure(), ident, slot, slot.cachedOffset());
+
+ if (listIndex == (POLYMORPHIC_LIST_CACHE_SIZE - 1))
+ ctiPatchCallByReturnAddress(codeBlock, STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_id_generic));
+ }
+ } else
+ ctiPatchCallByReturnAddress(callFrame->codeBlock(), STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_id_generic));
+ return JSValue::encode(result);
+}
+
+static PolymorphicAccessStructureList* getPolymorphicAccessStructureListSlot(StructureStubInfo* stubInfo, int& listIndex)
+{
+ PolymorphicAccessStructureList* prototypeStructureList = 0;
+ listIndex = 1;
+
+ switch (stubInfo->accessType) {
+ case access_get_by_id_proto:
+ prototypeStructureList = new PolymorphicAccessStructureList(stubInfo->stubRoutine, stubInfo->u.getByIdProto.baseObjectStructure, stubInfo->u.getByIdProto.prototypeStructure);
+ stubInfo->stubRoutine = CodeLocationLabel();
+ stubInfo->initGetByIdProtoList(prototypeStructureList, 2);
+ break;
+ case access_get_by_id_chain:
+ prototypeStructureList = new PolymorphicAccessStructureList(stubInfo->stubRoutine, stubInfo->u.getByIdChain.baseObjectStructure, stubInfo->u.getByIdChain.chain);
+ stubInfo->stubRoutine = CodeLocationLabel();
+ stubInfo->initGetByIdProtoList(prototypeStructureList, 2);
+ break;
+ case access_get_by_id_proto_list:
+ prototypeStructureList = stubInfo->u.getByIdProtoList.structureList;
+ listIndex = stubInfo->u.getByIdProtoList.listSize;
+ if (listIndex < POLYMORPHIC_LIST_CACHE_SIZE)
+ stubInfo->u.getByIdProtoList.listSize++;
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ }
+
+ ASSERT(listIndex <= POLYMORPHIC_LIST_CACHE_SIZE);
+ return prototypeStructureList;
+}
+
+DEFINE_STUB_FUNCTION(EncodedJSValue, op_get_by_id_getter_stub)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+ CallFrame* callFrame = stackFrame.callFrame;
+ GetterSetter* getterSetter = asGetterSetter(stackFrame.args[0].jsObject());
+ if (!getterSetter->getter())
+ return JSValue::encode(jsUndefined());
+ JSObject* getter = asObject(getterSetter->getter());
+ CallData callData;
+ CallType callType = getter->getCallData(callData);
+ JSValue result = call(callFrame, getter, callType, callData, stackFrame.args[1].jsObject(), ArgList());
+ if (callFrame->hadException())
+ returnToThrowTrampoline(&callFrame->globalData(), stackFrame.args[2].returnAddress(), STUB_RETURN_ADDRESS);
+
+ return JSValue::encode(result);
+}
+
+DEFINE_STUB_FUNCTION(EncodedJSValue, op_get_by_id_custom_stub)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+ CallFrame* callFrame = stackFrame.callFrame;
+ JSObject* slotBase = stackFrame.args[0].jsObject();
+ PropertySlot::GetValueFunc getter = reinterpret_cast<PropertySlot::GetValueFunc>(stackFrame.args[1].asPointer);
+ const Identifier& ident = stackFrame.args[2].identifier();
+ JSValue result = getter(callFrame, slotBase, ident);
+ if (callFrame->hadException())
+ returnToThrowTrampoline(&callFrame->globalData(), stackFrame.args[3].returnAddress(), STUB_RETURN_ADDRESS);
+
+ return JSValue::encode(result);
+}
+
+DEFINE_STUB_FUNCTION(EncodedJSValue, op_get_by_id_proto_list)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ CallFrame* callFrame = stackFrame.callFrame;
+ const Identifier& propertyName = stackFrame.args[1].identifier();
+
+ JSValue baseValue = stackFrame.args[0].jsValue();
+ PropertySlot slot(baseValue);
+ JSValue result = baseValue.get(callFrame, propertyName, slot);
+
+ CHECK_FOR_EXCEPTION();
+
+ if (!baseValue.isCell() || !slot.isCacheable() || baseValue.asCell()->structure()->isDictionary()) {
+ ctiPatchCallByReturnAddress(callFrame->codeBlock(), STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_id_proto_fail));
+ return JSValue::encode(result);
+ }
+
+ Structure* structure = baseValue.asCell()->structure();
+ CodeBlock* codeBlock = callFrame->codeBlock();
+ StructureStubInfo* stubInfo = &codeBlock->getStubInfo(STUB_RETURN_ADDRESS);
+
+ ASSERT(slot.slotBase().isObject());
+ JSObject* slotBaseObject = asObject(slot.slotBase());
+
+ size_t offset = slot.cachedOffset();
+
+ if (slot.slotBase() == baseValue)
+ ctiPatchCallByReturnAddress(codeBlock, STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_id_proto_fail));
+ else if (slot.slotBase() == baseValue.asCell()->structure()->prototypeForLookup(callFrame)) {
+ ASSERT(!baseValue.asCell()->structure()->isDictionary());
+ // Since we're accessing a prototype in a loop, it's a good bet that it
+ // should not be treated as a dictionary.
+ if (slotBaseObject->structure()->isDictionary()) {
+ slotBaseObject->flattenDictionaryObject();
+ offset = slotBaseObject->structure()->get(propertyName);
+ }
+
+ int listIndex;
+ PolymorphicAccessStructureList* prototypeStructureList = getPolymorphicAccessStructureListSlot(stubInfo, listIndex);
+ if (listIndex < POLYMORPHIC_LIST_CACHE_SIZE) {
+ JIT::compileGetByIdProtoList(callFrame->scopeChain()->globalData, callFrame, codeBlock, stubInfo, prototypeStructureList, listIndex, structure, slotBaseObject->structure(), propertyName, slot, offset);
+
+ if (listIndex == (POLYMORPHIC_LIST_CACHE_SIZE - 1))
+ ctiPatchCallByReturnAddress(codeBlock, STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_id_proto_list_full));
+ }
+ } else if (size_t count = normalizePrototypeChain(callFrame, baseValue, slot.slotBase(), propertyName, offset)) {
+ ASSERT(!baseValue.asCell()->structure()->isDictionary());
+ int listIndex;
+ PolymorphicAccessStructureList* prototypeStructureList = getPolymorphicAccessStructureListSlot(stubInfo, listIndex);
+
+ if (listIndex < POLYMORPHIC_LIST_CACHE_SIZE) {
+ StructureChain* protoChain = structure->prototypeChain(callFrame);
+ JIT::compileGetByIdChainList(callFrame->scopeChain()->globalData, callFrame, codeBlock, stubInfo, prototypeStructureList, listIndex, structure, protoChain, count, propertyName, slot, offset);
+
+ if (listIndex == (POLYMORPHIC_LIST_CACHE_SIZE - 1))
+ ctiPatchCallByReturnAddress(codeBlock, STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_id_proto_list_full));
+ }
+ } else
+ ctiPatchCallByReturnAddress(codeBlock, STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_id_proto_fail));
+
+ return JSValue::encode(result);
+}
+
+DEFINE_STUB_FUNCTION(EncodedJSValue, op_get_by_id_proto_list_full)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ JSValue baseValue = stackFrame.args[0].jsValue();
+ PropertySlot slot(baseValue);
+ JSValue result = baseValue.get(stackFrame.callFrame, stackFrame.args[1].identifier(), slot);
+
+ CHECK_FOR_EXCEPTION_AT_END();
+ return JSValue::encode(result);
+}
+
+DEFINE_STUB_FUNCTION(EncodedJSValue, op_get_by_id_proto_fail)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ JSValue baseValue = stackFrame.args[0].jsValue();
+ PropertySlot slot(baseValue);
+ JSValue result = baseValue.get(stackFrame.callFrame, stackFrame.args[1].identifier(), slot);
+
+ CHECK_FOR_EXCEPTION_AT_END();
+ return JSValue::encode(result);
+}
+
+DEFINE_STUB_FUNCTION(EncodedJSValue, op_get_by_id_array_fail)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ JSValue baseValue = stackFrame.args[0].jsValue();
+ PropertySlot slot(baseValue);
+ JSValue result = baseValue.get(stackFrame.callFrame, stackFrame.args[1].identifier(), slot);
+
+ CHECK_FOR_EXCEPTION_AT_END();
+ return JSValue::encode(result);
+}
+
+DEFINE_STUB_FUNCTION(EncodedJSValue, op_get_by_id_string_fail)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ JSValue baseValue = stackFrame.args[0].jsValue();
+ PropertySlot slot(baseValue);
+ JSValue result = baseValue.get(stackFrame.callFrame, stackFrame.args[1].identifier(), slot);
+
+ CHECK_FOR_EXCEPTION_AT_END();
+ return JSValue::encode(result);
+}
+
+#endif // ENABLE(JIT_OPTIMIZE_PROPERTY_ACCESS)
+
+DEFINE_STUB_FUNCTION(void, op_check_has_instance)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ CallFrame* callFrame = stackFrame.callFrame;
+ JSValue baseVal = stackFrame.args[0].jsValue();
+
+ // ECMA-262 15.3.5.3:
+ // Throw an exception either if baseVal is not an object, or if it does not implement 'HasInstance' (i.e. is a function).
+#ifndef NDEBUG
+ TypeInfo typeInfo(UnspecifiedType);
+ ASSERT(!baseVal.isObject() || !(typeInfo = asObject(baseVal)->structure()->typeInfo()).implementsHasInstance());
+#endif
+ stackFrame.globalData->exception = createInvalidParamError(callFrame, "instanceof", baseVal);
+ VM_THROW_EXCEPTION_AT_END();
+}
+
+DEFINE_STUB_FUNCTION(EncodedJSValue, op_instanceof)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ CallFrame* callFrame = stackFrame.callFrame;
+ JSValue value = stackFrame.args[0].jsValue();
+ JSValue baseVal = stackFrame.args[1].jsValue();
+ JSValue proto = stackFrame.args[2].jsValue();
+
+ // At least one of these checks must have failed to get to the slow case.
+ ASSERT(!value.isCell() || !baseVal.isCell() || !proto.isCell()
+ || !value.isObject() || !baseVal.isObject() || !proto.isObject()
+ || (asObject(baseVal)->structure()->typeInfo().flags() & (ImplementsHasInstance | OverridesHasInstance)) != ImplementsHasInstance);
+
+
+ // ECMA-262 15.3.5.3:
+ // Throw an exception either if baseVal is not an object, or if it does not implement 'HasInstance' (i.e. is a function).
+ TypeInfo typeInfo(UnspecifiedType);
+ if (!baseVal.isObject() || !(typeInfo = asObject(baseVal)->structure()->typeInfo()).implementsHasInstance()) {
+ stackFrame.globalData->exception = createInvalidParamError(stackFrame.callFrame, "instanceof", baseVal);
+ VM_THROW_EXCEPTION();
+ }
+ ASSERT(typeInfo.type() != UnspecifiedType);
+
+ if (!typeInfo.overridesHasInstance()) {
+ if (!value.isObject())
+ return JSValue::encode(jsBoolean(false));
+
+ if (!proto.isObject()) {
+ throwError(callFrame, createTypeError(callFrame, "instanceof called on an object with an invalid prototype property."));
+ VM_THROW_EXCEPTION();
+ }
+ }
+
+ JSValue result = jsBoolean(asObject(baseVal)->hasInstance(callFrame, value, proto));
+ CHECK_FOR_EXCEPTION_AT_END();
+
+ return JSValue::encode(result);
+}
+
+DEFINE_STUB_FUNCTION(EncodedJSValue, op_del_by_id)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ CallFrame* callFrame = stackFrame.callFrame;
+
+ JSObject* baseObj = stackFrame.args[0].jsValue().toObject(callFrame);
+
+ bool couldDelete = baseObj->deleteProperty(callFrame, stackFrame.args[1].identifier());
+ JSValue result = jsBoolean(couldDelete);
+ if (!couldDelete && callFrame->codeBlock()->isStrictMode())
+ stackFrame.globalData->exception = createTypeError(stackFrame.callFrame, "Unable to delete property.");
+
+ CHECK_FOR_EXCEPTION_AT_END();
+ return JSValue::encode(result);
+}
+
+DEFINE_STUB_FUNCTION(EncodedJSValue, op_mul)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ JSValue src1 = stackFrame.args[0].jsValue();
+ JSValue src2 = stackFrame.args[1].jsValue();
+
+ double left;
+ double right;
+ if (src1.getNumber(left) && src2.getNumber(right))
+ return JSValue::encode(jsNumber(left * right));
+
+ CallFrame* callFrame = stackFrame.callFrame;
+ JSValue result = jsNumber(src1.toNumber(callFrame) * src2.toNumber(callFrame));
+ CHECK_FOR_EXCEPTION_AT_END();
+ return JSValue::encode(result);
+}
+
+DEFINE_STUB_FUNCTION(JSObject*, op_new_func)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ ASSERT(stackFrame.callFrame->codeBlock()->codeType() != FunctionCode || !stackFrame.callFrame->codeBlock()->needsFullScopeChain() || stackFrame.callFrame->uncheckedR(stackFrame.callFrame->codeBlock()->activationRegister()).jsValue());
+ return stackFrame.args[0].function()->make(stackFrame.callFrame, stackFrame.callFrame->scopeChain());
+}
+
+DEFINE_STUB_FUNCTION(void*, op_call_jitCompile)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+#if !ASSERT_DISABLED
+ CallData callData;
+ ASSERT(stackFrame.callFrame->callee()->getCallData(callData) == CallTypeJS);
+#endif
+
+ JSFunction* function = asFunction(stackFrame.callFrame->callee());
+ ASSERT(!function->isHostFunction());
+ FunctionExecutable* executable = function->jsExecutable();
+ ScopeChainNode* callDataScopeChain = function->scope().node();
+ JSObject* error = executable->compileForCall(stackFrame.callFrame, callDataScopeChain);
+ if (error) {
+ stackFrame.callFrame->globalData().exception = error;
+ return 0;
+ }
+ return function;
+}
+
+DEFINE_STUB_FUNCTION(void*, op_construct_jitCompile)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+#if !ASSERT_DISABLED
+ ConstructData constructData;
+ ASSERT(asFunction(stackFrame.callFrame->callee())->getConstructData(constructData) == ConstructTypeJS);
+#endif
+
+ JSFunction* function = asFunction(stackFrame.callFrame->callee());
+ ASSERT(!function->isHostFunction());
+ FunctionExecutable* executable = function->jsExecutable();
+ ScopeChainNode* callDataScopeChain = function->scope().node();
+ JSObject* error = executable->compileForConstruct(stackFrame.callFrame, callDataScopeChain);
+ if (error) {
+ stackFrame.callFrame->globalData().exception = error;
+ return 0;
+ }
+ return function;
+}
+
+DEFINE_STUB_FUNCTION(void*, op_call_arityCheck)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ CallFrame* callFrame = stackFrame.callFrame;
+ JSFunction* callee = asFunction(callFrame->callee());
+ ASSERT(!callee->isHostFunction());
+ CodeBlock* newCodeBlock = &callee->jsExecutable()->generatedBytecodeForCall();
+ int argCount = callFrame->argumentCountIncludingThis();
+ ReturnAddressPtr pc = callFrame->returnPC();
+
+ ASSERT(argCount != newCodeBlock->m_numParameters);
+
+ CallFrame* oldCallFrame = callFrame->callerFrame();
+
+ Register* r;
+ if (argCount > newCodeBlock->m_numParameters) {
+ size_t numParameters = newCodeBlock->m_numParameters;
+ r = callFrame->registers() + numParameters;
+ Register* newEnd = r + newCodeBlock->m_numCalleeRegisters;
+ if (!stackFrame.registerFile->grow(newEnd)) {
+ // Rewind to the previous call frame because op_call already optimistically
+ // moved the call frame forward.
+ ExceptionHandler handler = jitThrow(stackFrame.globalData, oldCallFrame, createStackOverflowError(oldCallFrame), pc);
+ STUB_SET_RETURN_ADDRESS(handler.catchRoutine);
+ return handler.callFrame;
+ }
+
+ Register* argv = r - RegisterFile::CallFrameHeaderSize - numParameters - argCount;
+ for (size_t i = 0; i < numParameters; ++i)
+ argv[i + argCount] = argv[i];
+ } else {
+ size_t omittedArgCount = newCodeBlock->m_numParameters - argCount;
+ r = callFrame->registers() + omittedArgCount;
+ Register* newEnd = r + newCodeBlock->m_numCalleeRegisters;
+ if (!stackFrame.registerFile->grow(newEnd)) {
+ // Rewind to the previous call frame because op_call already optimistically
+ // moved the call frame forward.
+ ExceptionHandler handler = jitThrow(stackFrame.globalData, oldCallFrame, createStackOverflowError(oldCallFrame), pc);
+ STUB_SET_RETURN_ADDRESS(handler.catchRoutine);
+ return handler.callFrame;
+ }
+
+ Register* argv = r - RegisterFile::CallFrameHeaderSize - omittedArgCount;
+ for (size_t i = 0; i < omittedArgCount; ++i)
+ argv[i] = jsUndefined();
+ }
+
+ callFrame = CallFrame::create(r);
+ callFrame->setCallerFrame(oldCallFrame);
+ callFrame->setArgumentCountIncludingThis(argCount);
+ callFrame->setCallee(callee);
+ callFrame->setScopeChain(callee->scope().node());
+ callFrame->setReturnPC(pc.value());
+
+ ASSERT((void*)callFrame <= stackFrame.registerFile->end());
+ return callFrame;
+}
+
+DEFINE_STUB_FUNCTION(void*, op_construct_arityCheck)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ CallFrame* callFrame = stackFrame.callFrame;
+ JSFunction* callee = asFunction(callFrame->callee());
+ ASSERT(!callee->isHostFunction());
+ CodeBlock* newCodeBlock = &callee->jsExecutable()->generatedBytecodeForConstruct();
+ int argCount = callFrame->argumentCountIncludingThis();
+ ReturnAddressPtr pc = callFrame->returnPC();
+
+ ASSERT(argCount != newCodeBlock->m_numParameters);
+
+ CallFrame* oldCallFrame = callFrame->callerFrame();
+
+ Register* r;
+ if (argCount > newCodeBlock->m_numParameters) {
+ size_t numParameters = newCodeBlock->m_numParameters;
+ r = callFrame->registers() + numParameters;
+ Register* newEnd = r + newCodeBlock->m_numCalleeRegisters;
+ if (!stackFrame.registerFile->grow(newEnd)) {
+ // Rewind to the previous call frame because op_call already optimistically
+ // moved the call frame forward.
+ ExceptionHandler handler = jitThrow(stackFrame.globalData, oldCallFrame, createStackOverflowError(oldCallFrame), pc);
+ STUB_SET_RETURN_ADDRESS(handler.catchRoutine);
+ return handler.callFrame;
+ }
+
+ Register* argv = r - RegisterFile::CallFrameHeaderSize - numParameters - argCount;
+ for (size_t i = 0; i < numParameters; ++i)
+ argv[i + argCount] = argv[i];
+ } else {
+ size_t omittedArgCount = newCodeBlock->m_numParameters - argCount;
+ r = callFrame->registers() + omittedArgCount;
+ Register* newEnd = r + newCodeBlock->m_numCalleeRegisters;
+ if (!stackFrame.registerFile->grow(newEnd)) {
+ // Rewind to the previous call frame because op_call already optimistically
+ // moved the call frame forward.
+ ExceptionHandler handler = jitThrow(stackFrame.globalData, oldCallFrame, createStackOverflowError(oldCallFrame), pc);
+ STUB_SET_RETURN_ADDRESS(handler.catchRoutine);
+ return handler.callFrame;
+ }
+
+ Register* argv = r - RegisterFile::CallFrameHeaderSize - omittedArgCount;
+ for (size_t i = 0; i < omittedArgCount; ++i)
+ argv[i] = jsUndefined();
+ }
+
+ callFrame = CallFrame::create(r);
+ callFrame->setCallerFrame(oldCallFrame);
+ callFrame->setArgumentCountIncludingThis(argCount);
+ callFrame->setCallee(callee);
+ callFrame->setScopeChain(callee->scope().node());
+ callFrame->setReturnPC(pc.value());
+
+ ASSERT((void*)callFrame <= stackFrame.registerFile->end());
+ return callFrame;
+}
+
+#if ENABLE(JIT_OPTIMIZE_CALL)
+DEFINE_STUB_FUNCTION(void*, vm_lazyLinkCall)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+ CallFrame* callFrame = stackFrame.callFrame;
+ JSFunction* callee = asFunction(callFrame->callee());
+ ExecutableBase* executable = callee->executable();
+
+ MacroAssemblerCodePtr codePtr;
+ CodeBlock* codeBlock = 0;
+ if (executable->isHostFunction())
+ codePtr = executable->generatedJITCodeForCall().addressForCall();
+ else {
+ FunctionExecutable* functionExecutable = static_cast<FunctionExecutable*>(executable);
+ JSObject* error = functionExecutable->compileForCall(callFrame, callee->scope().node());
+ if (error) {
+ callFrame->globalData().exception = createStackOverflowError(callFrame);
+ return 0;
+ }
+ codeBlock = &functionExecutable->generatedBytecodeForCall();
+ if (callFrame->argumentCountIncludingThis() == static_cast<size_t>(codeBlock->m_numParameters))
+ codePtr = functionExecutable->generatedJITCodeForCall().addressForCall();
+ else
+ codePtr = functionExecutable->generatedJITCodeForCallWithArityCheck();
+ }
+ CallLinkInfo* callLinkInfo = &stackFrame.callFrame->callerFrame()->codeBlock()->getCallLinkInfo(callFrame->returnPC());
+
+ if (!callLinkInfo->seenOnce())
+ callLinkInfo->setSeen();
+ else
+ JIT::linkCall(callee, stackFrame.callFrame->callerFrame()->codeBlock(), codeBlock, codePtr, callLinkInfo, callFrame->argumentCountIncludingThis(), stackFrame.globalData);
+
+ return codePtr.executableAddress();
+}
+
+DEFINE_STUB_FUNCTION(void*, vm_lazyLinkConstruct)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+ CallFrame* callFrame = stackFrame.callFrame;
+ JSFunction* callee = asFunction(callFrame->callee());
+ ExecutableBase* executable = callee->executable();
+
+ MacroAssemblerCodePtr codePtr;
+ CodeBlock* codeBlock = 0;
+ if (executable->isHostFunction())
+ codePtr = executable->generatedJITCodeForConstruct().addressForCall();
+ else {
+ FunctionExecutable* functionExecutable = static_cast<FunctionExecutable*>(executable);
+ JSObject* error = functionExecutable->compileForConstruct(callFrame, callee->scope().node());
+ if (error) {
+ throwStackOverflowError(callFrame, stackFrame.globalData, ReturnAddressPtr(callFrame->returnPC()), STUB_RETURN_ADDRESS);
+ return 0;
+ }
+ codeBlock = &functionExecutable->generatedBytecodeForConstruct();
+ if (callFrame->argumentCountIncludingThis() == static_cast<size_t>(codeBlock->m_numParameters))
+ codePtr = functionExecutable->generatedJITCodeForConstruct().addressForCall();
+ else
+ codePtr = functionExecutable->generatedJITCodeForConstructWithArityCheck();
+ }
+ CallLinkInfo* callLinkInfo = &stackFrame.callFrame->callerFrame()->codeBlock()->getCallLinkInfo(callFrame->returnPC());
+
+ if (!callLinkInfo->seenOnce())
+ callLinkInfo->setSeen();
+ else
+ JIT::linkConstruct(callee, stackFrame.callFrame->callerFrame()->codeBlock(), codeBlock, codePtr, callLinkInfo, callFrame->argumentCountIncludingThis(), stackFrame.globalData);
+
+ return codePtr.executableAddress();
+}
+#endif // !ENABLE(JIT_OPTIMIZE_CALL)
+
+DEFINE_STUB_FUNCTION(JSObject*, op_push_activation)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ JSActivation* activation = new (stackFrame.globalData) JSActivation(stackFrame.callFrame, static_cast<FunctionExecutable*>(stackFrame.callFrame->codeBlock()->ownerExecutable()));
+ stackFrame.callFrame->setScopeChain(stackFrame.callFrame->scopeChain()->copy()->push(activation));
+ return activation;
+}
+
+DEFINE_STUB_FUNCTION(EncodedJSValue, op_call_NotJSFunction)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ JSValue funcVal = stackFrame.args[0].jsValue();
+
+ CallData callData;
+ CallType callType = getCallData(funcVal, callData);
+
+ ASSERT(callType != CallTypeJS);
+
+ if (callType == CallTypeHost) {
+ int registerOffset = stackFrame.args[1].int32();
+ int argCount = stackFrame.args[2].int32();
+ CallFrame* previousCallFrame = stackFrame.callFrame;
+ CallFrame* callFrame = CallFrame::create(previousCallFrame->registers() + registerOffset);
+ if (!stackFrame.registerFile->grow(callFrame->registers())) {
+ throwStackOverflowError(previousCallFrame, stackFrame.globalData, callFrame->returnPC(), STUB_RETURN_ADDRESS);
+ VM_THROW_EXCEPTION();
+ }
+
+ callFrame->init(0, static_cast<Instruction*>((STUB_RETURN_ADDRESS).value()), previousCallFrame->scopeChain(), previousCallFrame, argCount, asObject(funcVal));
+
+ EncodedJSValue returnValue;
+ {
+ SamplingTool::HostCallRecord callRecord(CTI_SAMPLER);
+ returnValue = callData.native.function(callFrame);
+ }
+
+ CHECK_FOR_EXCEPTION_AT_END();
+ return returnValue;
+ }
+
+ ASSERT(callType == CallTypeNone);
+
+ stackFrame.globalData->exception = createNotAFunctionError(stackFrame.callFrame, funcVal);
+ VM_THROW_EXCEPTION();
+}
+
+DEFINE_STUB_FUNCTION(EncodedJSValue, op_create_arguments)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ Arguments* arguments = new (stackFrame.globalData) Arguments(stackFrame.callFrame);
+ return JSValue::encode(JSValue(arguments));
+}
+
+DEFINE_STUB_FUNCTION(EncodedJSValue, op_create_arguments_no_params)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ Arguments* arguments = new (stackFrame.globalData) Arguments(stackFrame.callFrame, Arguments::NoParameters);
+ return JSValue::encode(JSValue(arguments));
+}
+
+DEFINE_STUB_FUNCTION(void, op_tear_off_activation)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ ASSERT(stackFrame.callFrame->codeBlock()->needsFullScopeChain());
+ JSValue activationValue = stackFrame.args[0].jsValue();
+ if (!activationValue) {
+ if (JSValue v = stackFrame.args[1].jsValue()) {
+ if (!stackFrame.callFrame->codeBlock()->isStrictMode())
+ asArguments(v)->copyRegisters();
+ }
+ return;
+ }
+ JSActivation* activation = asActivation(stackFrame.args[0].jsValue());
+ activation->copyRegisters();
+ if (JSValue v = stackFrame.args[1].jsValue()) {
+ if (!stackFrame.callFrame->codeBlock()->isStrictMode())
+ asArguments(v)->setActivation(activation);
+ }
+}
+
+DEFINE_STUB_FUNCTION(void, op_tear_off_arguments)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ ASSERT(stackFrame.callFrame->codeBlock()->usesArguments() && !stackFrame.callFrame->codeBlock()->needsFullScopeChain());
+ asArguments(stackFrame.args[0].jsValue())->copyRegisters();
+}
+
+DEFINE_STUB_FUNCTION(void, op_profile_will_call)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ ASSERT(*stackFrame.enabledProfilerReference);
+ (*stackFrame.enabledProfilerReference)->willExecute(stackFrame.callFrame, stackFrame.args[0].jsValue());
+}
+
+DEFINE_STUB_FUNCTION(void, op_profile_did_call)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ ASSERT(*stackFrame.enabledProfilerReference);
+ (*stackFrame.enabledProfilerReference)->didExecute(stackFrame.callFrame, stackFrame.args[0].jsValue());
+}
+
+DEFINE_STUB_FUNCTION(void, op_ret_scopeChain)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ ASSERT(stackFrame.callFrame->codeBlock()->needsFullScopeChain());
+ stackFrame.callFrame->scopeChain()->deref();
+}
+
+DEFINE_STUB_FUNCTION(JSObject*, op_new_array)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ ArgList argList(&stackFrame.callFrame->registers()[stackFrame.args[0].int32()], stackFrame.args[1].int32());
+ return constructArray(stackFrame.callFrame, argList);
+}
+
+DEFINE_STUB_FUNCTION(EncodedJSValue, op_resolve)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ CallFrame* callFrame = stackFrame.callFrame;
+ ScopeChainNode* scopeChain = callFrame->scopeChain();
+
+ ScopeChainIterator iter = scopeChain->begin();
+ ScopeChainIterator end = scopeChain->end();
+ ASSERT(iter != end);
+
+ Identifier& ident = stackFrame.args[0].identifier();
+ do {
+ JSObject* o = *iter;
+ PropertySlot slot(o);
+ if (o->getPropertySlot(callFrame, ident, slot)) {
+ JSValue result = slot.getValue(callFrame, ident);
+ CHECK_FOR_EXCEPTION_AT_END();
+ return JSValue::encode(result);
+ }
+ } while (++iter != end);
+
+ stackFrame.globalData->exception = createUndefinedVariableError(callFrame, ident);
+ VM_THROW_EXCEPTION();
+}
+
+DEFINE_STUB_FUNCTION(EncodedJSValue, op_construct_NotJSConstruct)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ JSValue constrVal = stackFrame.args[0].jsValue();
+
+ ConstructData constructData;
+ ConstructType constructType = getConstructData(constrVal, constructData);
+
+ ASSERT(constructType != ConstructTypeJS);
+
+ if (constructType == ConstructTypeHost) {
+ int registerOffset = stackFrame.args[1].int32();
+ int argCount = stackFrame.args[2].int32();
+ CallFrame* previousCallFrame = stackFrame.callFrame;
+ CallFrame* callFrame = CallFrame::create(previousCallFrame->registers() + registerOffset);
+ if (!stackFrame.registerFile->grow(callFrame->registers())) {
+ throwStackOverflowError(previousCallFrame, stackFrame.globalData, callFrame->returnPC(), STUB_RETURN_ADDRESS);
+ VM_THROW_EXCEPTION();
+ }
+
+ callFrame->init(0, static_cast<Instruction*>((STUB_RETURN_ADDRESS).value()), previousCallFrame->scopeChain(), previousCallFrame, argCount, asObject(constrVal));
+
+ EncodedJSValue returnValue;
+ {
+ SamplingTool::HostCallRecord callRecord(CTI_SAMPLER);
+ returnValue = constructData.native.function(callFrame);
+ }
+
+ CHECK_FOR_EXCEPTION_AT_END();
+ return returnValue;
+ }
+
+ ASSERT(constructType == ConstructTypeNone);
+
+ stackFrame.globalData->exception = createNotAConstructorError(stackFrame.callFrame, constrVal);
+ VM_THROW_EXCEPTION();
+}
+
+DEFINE_STUB_FUNCTION(EncodedJSValue, op_get_by_val)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ CallFrame* callFrame = stackFrame.callFrame;
+ JSGlobalData* globalData = stackFrame.globalData;
+
+ JSValue baseValue = stackFrame.args[0].jsValue();
+ JSValue subscript = stackFrame.args[1].jsValue();
+
+ if (LIKELY(baseValue.isCell() && subscript.isString())) {
+ Identifier propertyName(callFrame, asString(subscript)->value(callFrame));
+ PropertySlot slot(baseValue.asCell());
+ // JSString::value may have thrown, but we shouldn't find a property with a null identifier,
+ // so we should miss this case and wind up in the CHECK_FOR_EXCEPTION_AT_END, below.
+ if (baseValue.asCell()->fastGetOwnPropertySlot(callFrame, propertyName, slot)) {
+ JSValue result = slot.getValue(callFrame, propertyName);
+ CHECK_FOR_EXCEPTION();
+ return JSValue::encode(result);
+ }
+ }
+
+ if (subscript.isUInt32()) {
+ uint32_t i = subscript.asUInt32();
+ if (isJSString(globalData, baseValue) && asString(baseValue)->canGetIndex(i)) {
+ ctiPatchCallByReturnAddress(callFrame->codeBlock(), STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_val_string));
+ JSValue result = asString(baseValue)->getIndex(callFrame, i);
+ CHECK_FOR_EXCEPTION();
+ return JSValue::encode(result);
+ }
+ if (isJSByteArray(globalData, baseValue) && asByteArray(baseValue)->canAccessIndex(i)) {
+ // All fast byte array accesses are safe from exceptions so return immediately to avoid exception checks.
+ ctiPatchCallByReturnAddress(callFrame->codeBlock(), STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_val_byte_array));
+ return JSValue::encode(asByteArray(baseValue)->getIndex(callFrame, i));
+ }
+ JSValue result = baseValue.get(callFrame, i);
+ CHECK_FOR_EXCEPTION();
+ return JSValue::encode(result);
+ }
+
+ Identifier property(callFrame, subscript.toString(callFrame));
+ JSValue result = baseValue.get(callFrame, property);
+ CHECK_FOR_EXCEPTION_AT_END();
+ return JSValue::encode(result);
+}
+
+DEFINE_STUB_FUNCTION(EncodedJSValue, op_get_by_val_string)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ CallFrame* callFrame = stackFrame.callFrame;
+ JSGlobalData* globalData = stackFrame.globalData;
+
+ JSValue baseValue = stackFrame.args[0].jsValue();
+ JSValue subscript = stackFrame.args[1].jsValue();
+
+ JSValue result;
+
+ if (LIKELY(subscript.isUInt32())) {
+ uint32_t i = subscript.asUInt32();
+ if (isJSString(globalData, baseValue) && asString(baseValue)->canGetIndex(i))
+ result = asString(baseValue)->getIndex(callFrame, i);
+ else {
+ result = baseValue.get(callFrame, i);
+ if (!isJSString(globalData, baseValue))
+ ctiPatchCallByReturnAddress(callFrame->codeBlock(), STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_val));
+ }
+ } else {
+ Identifier property(callFrame, subscript.toString(callFrame));
+ result = baseValue.get(callFrame, property);
+ }
+
+ CHECK_FOR_EXCEPTION_AT_END();
+ return JSValue::encode(result);
+}
+
+DEFINE_STUB_FUNCTION(EncodedJSValue, op_get_by_val_byte_array)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ CallFrame* callFrame = stackFrame.callFrame;
+ JSGlobalData* globalData = stackFrame.globalData;
+
+ JSValue baseValue = stackFrame.args[0].jsValue();
+ JSValue subscript = stackFrame.args[1].jsValue();
+
+ JSValue result;
+
+ if (LIKELY(subscript.isUInt32())) {
+ uint32_t i = subscript.asUInt32();
+ if (isJSByteArray(globalData, baseValue) && asByteArray(baseValue)->canAccessIndex(i)) {
+ // All fast byte array accesses are safe from exceptions so return immediately to avoid exception checks.
+ return JSValue::encode(asByteArray(baseValue)->getIndex(callFrame, i));
+ }
+
+ result = baseValue.get(callFrame, i);
+ if (!isJSByteArray(globalData, baseValue))
+ ctiPatchCallByReturnAddress(callFrame->codeBlock(), STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_val));
+ } else {
+ Identifier property(callFrame, subscript.toString(callFrame));
+ result = baseValue.get(callFrame, property);
+ }
+
+ CHECK_FOR_EXCEPTION_AT_END();
+ return JSValue::encode(result);
+}
+
+DEFINE_STUB_FUNCTION(EncodedJSValue, op_sub)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ JSValue src1 = stackFrame.args[0].jsValue();
+ JSValue src2 = stackFrame.args[1].jsValue();
+
+ double left;
+ double right;
+ if (src1.getNumber(left) && src2.getNumber(right))
+ return JSValue::encode(jsNumber(left - right));
+
+ CallFrame* callFrame = stackFrame.callFrame;
+ JSValue result = jsNumber(src1.toNumber(callFrame) - src2.toNumber(callFrame));
+ CHECK_FOR_EXCEPTION_AT_END();
+ return JSValue::encode(result);
+}
+
+DEFINE_STUB_FUNCTION(void, op_put_by_val)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ CallFrame* callFrame = stackFrame.callFrame;
+ JSGlobalData* globalData = stackFrame.globalData;
+
+ JSValue baseValue = stackFrame.args[0].jsValue();
+ JSValue subscript = stackFrame.args[1].jsValue();
+ JSValue value = stackFrame.args[2].jsValue();
+
+ if (LIKELY(subscript.isUInt32())) {
+ uint32_t i = subscript.asUInt32();
+ if (isJSArray(globalData, baseValue)) {
+ JSArray* jsArray = asArray(baseValue);
+ if (jsArray->canSetIndex(i))
+ jsArray->setIndex(i, value);
+ else
+ jsArray->JSArray::put(callFrame, i, value);
+ } else if (isJSByteArray(globalData, baseValue) && asByteArray(baseValue)->canAccessIndex(i)) {
+ JSByteArray* jsByteArray = asByteArray(baseValue);
+ ctiPatchCallByReturnAddress(callFrame->codeBlock(), STUB_RETURN_ADDRESS, FunctionPtr(cti_op_put_by_val_byte_array));
+ // All fast byte array accesses are safe from exceptions so return immediately to avoid exception checks.
+ if (value.isInt32()) {
+ jsByteArray->setIndex(i, value.asInt32());
+ return;
+ } else {
+ double dValue = 0;
+ if (value.getNumber(dValue)) {
+ jsByteArray->setIndex(i, dValue);
+ return;
+ }
+ }
+
+ baseValue.put(callFrame, i, value);
+ } else
+ baseValue.put(callFrame, i, value);
+ } else {
+ Identifier property(callFrame, subscript.toString(callFrame));
+ if (!stackFrame.globalData->exception) { // Don't put to an object if toString threw an exception.
+ PutPropertySlot slot(callFrame->codeBlock()->isStrictMode());
+ baseValue.put(callFrame, property, value, slot);
+ }
+ }
+
+ CHECK_FOR_EXCEPTION_AT_END();
+}
+
+DEFINE_STUB_FUNCTION(void, op_put_by_val_byte_array)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ CallFrame* callFrame = stackFrame.callFrame;
+ JSGlobalData* globalData = stackFrame.globalData;
+
+ JSValue baseValue = stackFrame.args[0].jsValue();
+ JSValue subscript = stackFrame.args[1].jsValue();
+ JSValue value = stackFrame.args[2].jsValue();
+
+ if (LIKELY(subscript.isUInt32())) {
+ uint32_t i = subscript.asUInt32();
+ if (isJSByteArray(globalData, baseValue) && asByteArray(baseValue)->canAccessIndex(i)) {
+ JSByteArray* jsByteArray = asByteArray(baseValue);
+
+ // All fast byte array accesses are safe from exceptions so return immediately to avoid exception checks.
+ if (value.isInt32()) {
+ jsByteArray->setIndex(i, value.asInt32());
+ return;
+ } else {
+ double dValue = 0;
+ if (value.getNumber(dValue)) {
+ jsByteArray->setIndex(i, dValue);
+ return;
+ }
+ }
+ }
+
+ if (!isJSByteArray(globalData, baseValue))
+ ctiPatchCallByReturnAddress(callFrame->codeBlock(), STUB_RETURN_ADDRESS, FunctionPtr(cti_op_put_by_val));
+ baseValue.put(callFrame, i, value);
+ } else {
+ Identifier property(callFrame, subscript.toString(callFrame));
+ if (!stackFrame.globalData->exception) { // Don't put to an object if toString threw an exception.
+ PutPropertySlot slot(callFrame->codeBlock()->isStrictMode());
+ baseValue.put(callFrame, property, value, slot);
+ }
+ }
+
+ CHECK_FOR_EXCEPTION_AT_END();
+}
+
+DEFINE_STUB_FUNCTION(EncodedJSValue, op_lesseq)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ CallFrame* callFrame = stackFrame.callFrame;
+ JSValue result = jsBoolean(jsLessEq(callFrame, stackFrame.args[0].jsValue(), stackFrame.args[1].jsValue()));
+ CHECK_FOR_EXCEPTION_AT_END();
+ return JSValue::encode(result);
+}
+
+DEFINE_STUB_FUNCTION(int, op_load_varargs)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ CallFrame* callFrame = stackFrame.callFrame;
+ RegisterFile* registerFile = stackFrame.registerFile;
+ int argsOffset = stackFrame.args[0].int32();
+ JSValue arguments = callFrame->registers()[argsOffset].jsValue();
+ uint32_t argCount = 0;
+ if (!arguments) {
+ int providedParams = callFrame->registers()[RegisterFile::ArgumentCount].i() - 1;
+ argCount = providedParams;
+ argCount = min(argCount, static_cast<uint32_t>(Arguments::MaxArguments));
+ int32_t sizeDelta = argsOffset + argCount + RegisterFile::CallFrameHeaderSize;
+ Register* newEnd = callFrame->registers() + sizeDelta;
+ if (!registerFile->grow(newEnd) || ((newEnd - callFrame->registers()) != sizeDelta)) {
+ stackFrame.globalData->exception = createStackOverflowError(callFrame);
+ VM_THROW_EXCEPTION();
+ }
+ int32_t expectedParams = asFunction(callFrame->callee())->jsExecutable()->parameterCount();
+ int32_t inplaceArgs = min(providedParams, expectedParams);
+
+ Register* inplaceArgsDst = callFrame->registers() + argsOffset;
+
+ Register* inplaceArgsEnd = inplaceArgsDst + inplaceArgs;
+ Register* inplaceArgsEnd2 = inplaceArgsDst + providedParams;
+
+ Register* inplaceArgsSrc = callFrame->registers() - RegisterFile::CallFrameHeaderSize - expectedParams;
+ Register* inplaceArgsSrc2 = inplaceArgsSrc - providedParams - 1 + inplaceArgs;
+
+ // First step is to copy the "expected" parameters from their normal location relative to the callframe
+ while (inplaceArgsDst < inplaceArgsEnd)
+ *inplaceArgsDst++ = *inplaceArgsSrc++;
+
+ // Then we copy any additional arguments that may be further up the stack ('-1' to account for 'this')
+ while (inplaceArgsDst < inplaceArgsEnd2)
+ *inplaceArgsDst++ = *inplaceArgsSrc2++;
+
+ } else if (!arguments.isUndefinedOrNull()) {
+ if (!arguments.isObject()) {
+ stackFrame.globalData->exception = createInvalidParamError(callFrame, "Function.prototype.apply", arguments);
+ VM_THROW_EXCEPTION();
+ }
+ if (asObject(arguments)->classInfo() == &Arguments::info) {
+ Arguments* argsObject = asArguments(arguments);
+ argCount = argsObject->numProvidedArguments(callFrame);
+ argCount = min(argCount, static_cast<uint32_t>(Arguments::MaxArguments));
+ int32_t sizeDelta = argsOffset + argCount + RegisterFile::CallFrameHeaderSize;
+ Register* newEnd = callFrame->registers() + sizeDelta;
+ if (!registerFile->grow(newEnd) || ((newEnd - callFrame->registers()) != sizeDelta)) {
+ stackFrame.globalData->exception = createStackOverflowError(callFrame);
+ VM_THROW_EXCEPTION();
+ }
+ argsObject->copyToRegisters(callFrame, callFrame->registers() + argsOffset, argCount);
+ } else if (isJSArray(&callFrame->globalData(), arguments)) {
+ JSArray* array = asArray(arguments);
+ argCount = array->length();
+ argCount = min(argCount, static_cast<uint32_t>(Arguments::MaxArguments));
+ int32_t sizeDelta = argsOffset + argCount + RegisterFile::CallFrameHeaderSize;
+ Register* newEnd = callFrame->registers() + sizeDelta;
+ if (!registerFile->grow(newEnd) || ((newEnd - callFrame->registers()) != sizeDelta)) {
+ stackFrame.globalData->exception = createStackOverflowError(callFrame);
+ VM_THROW_EXCEPTION();
+ }
+ array->copyToRegisters(callFrame, callFrame->registers() + argsOffset, argCount);
+ } else if (asObject(arguments)->inherits(&JSArray::info)) {
+ JSObject* argObject = asObject(arguments);
+ argCount = argObject->get(callFrame, callFrame->propertyNames().length).toUInt32(callFrame);
+ argCount = min(argCount, static_cast<uint32_t>(Arguments::MaxArguments));
+ int32_t sizeDelta = argsOffset + argCount + RegisterFile::CallFrameHeaderSize;
+ Register* newEnd = callFrame->registers() + sizeDelta;
+ if (!registerFile->grow(newEnd) || ((newEnd - callFrame->registers()) != sizeDelta)) {
+ stackFrame.globalData->exception = createStackOverflowError(callFrame);
+ VM_THROW_EXCEPTION();
+ }
+ Register* argsBuffer = callFrame->registers() + argsOffset;
+ for (unsigned i = 0; i < argCount; ++i) {
+ argsBuffer[i] = asObject(arguments)->get(callFrame, i);
+ CHECK_FOR_EXCEPTION();
+ }
+ } else {
+ stackFrame.globalData->exception = createInvalidParamError(callFrame, "Function.prototype.apply", arguments);
+ VM_THROW_EXCEPTION();
+ }
+ }
+
+ return argCount + 1;
+}
+
+DEFINE_STUB_FUNCTION(EncodedJSValue, op_negate)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ JSValue src = stackFrame.args[0].jsValue();
+
+ double v;
+ if (src.getNumber(v))
+ return JSValue::encode(jsNumber(-v));
+
+ CallFrame* callFrame = stackFrame.callFrame;
+ JSValue result = jsNumber(-src.toNumber(callFrame));
+ CHECK_FOR_EXCEPTION_AT_END();
+ return JSValue::encode(result);
+}
+
+DEFINE_STUB_FUNCTION(EncodedJSValue, op_resolve_base)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ return JSValue::encode(JSC::resolveBase(stackFrame.callFrame, stackFrame.args[0].identifier(), stackFrame.callFrame->scopeChain(), false));
+}
+
+DEFINE_STUB_FUNCTION(EncodedJSValue, op_resolve_base_strict_put)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+ JSValue base = JSC::resolveBase(stackFrame.callFrame, stackFrame.args[0].identifier(), stackFrame.callFrame->scopeChain(), true);
+ if (!base) {
+ stackFrame.globalData->exception = createErrorForInvalidGlobalAssignment(stackFrame.callFrame, stackFrame.args[0].identifier().ustring());
+ VM_THROW_EXCEPTION();
+ }
+ return JSValue::encode(base);
+}
+
+DEFINE_STUB_FUNCTION(EncodedJSValue, op_ensure_property_exists)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+ JSValue base = stackFrame.callFrame->r(stackFrame.args[0].int32()).jsValue();
+ JSObject* object = asObject(base);
+ PropertySlot slot(object);
+ ASSERT(stackFrame.callFrame->codeBlock()->isStrictMode());
+ if (!object->getPropertySlot(stackFrame.callFrame, stackFrame.args[1].identifier(), slot)) {
+ stackFrame.globalData->exception = createErrorForInvalidGlobalAssignment(stackFrame.callFrame, stackFrame.args[1].identifier().ustring());
+ VM_THROW_EXCEPTION();
+ }
+
+ return JSValue::encode(base);
+}
+
+DEFINE_STUB_FUNCTION(EncodedJSValue, op_resolve_skip)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ CallFrame* callFrame = stackFrame.callFrame;
+ ScopeChainNode* scopeChain = callFrame->scopeChain();
+
+ int skip = stackFrame.args[1].int32();
+
+ ScopeChainIterator iter = scopeChain->begin();
+ ScopeChainIterator end = scopeChain->end();
+ ASSERT(iter != end);
+ CodeBlock* codeBlock = callFrame->codeBlock();
+ bool checkTopLevel = codeBlock->codeType() == FunctionCode && codeBlock->needsFullScopeChain();
+ ASSERT(skip || !checkTopLevel);
+ if (checkTopLevel && skip--) {
+ if (callFrame->uncheckedR(codeBlock->activationRegister()).jsValue())
+ ++iter;
+ }
+ while (skip--) {
+ ++iter;
+ ASSERT(iter != end);
+ }
+ Identifier& ident = stackFrame.args[0].identifier();
+ do {
+ JSObject* o = *iter;
+ PropertySlot slot(o);
+ if (o->getPropertySlot(callFrame, ident, slot)) {
+ JSValue result = slot.getValue(callFrame, ident);
+ CHECK_FOR_EXCEPTION_AT_END();
+ return JSValue::encode(result);
+ }
+ } while (++iter != end);
+
+ stackFrame.globalData->exception = createUndefinedVariableError(callFrame, ident);
+ VM_THROW_EXCEPTION();
+}
+
+DEFINE_STUB_FUNCTION(EncodedJSValue, op_resolve_global)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ CallFrame* callFrame = stackFrame.callFrame;
+ CodeBlock* codeBlock = callFrame->codeBlock();
+ JSGlobalObject* globalObject = codeBlock->globalObject();
+ Identifier& ident = stackFrame.args[0].identifier();
+ unsigned globalResolveInfoIndex = stackFrame.args[1].int32();
+ ASSERT(globalObject->isGlobalObject());
+
+ PropertySlot slot(globalObject);
+ if (globalObject->getPropertySlot(callFrame, ident, slot)) {
+ JSValue result = slot.getValue(callFrame, ident);
+ if (slot.isCacheableValue() && !globalObject->structure()->isUncacheableDictionary() && slot.slotBase() == globalObject) {
+ GlobalResolveInfo& globalResolveInfo = codeBlock->globalResolveInfo(globalResolveInfoIndex);
+ if (globalResolveInfo.structure)
+ globalResolveInfo.structure->deref();
+ globalObject->structure()->ref();
+ globalResolveInfo.structure = globalObject->structure();
+ globalResolveInfo.offset = slot.cachedOffset();
+ return JSValue::encode(result);
+ }
+
+ CHECK_FOR_EXCEPTION_AT_END();
+ return JSValue::encode(result);
+ }
+
+ stackFrame.globalData->exception = createUndefinedVariableError(callFrame, ident);
+ VM_THROW_EXCEPTION();
+}
+
+DEFINE_STUB_FUNCTION(EncodedJSValue, op_div)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ JSValue src1 = stackFrame.args[0].jsValue();
+ JSValue src2 = stackFrame.args[1].jsValue();
+
+ double left;
+ double right;
+ if (src1.getNumber(left) && src2.getNumber(right))
+ return JSValue::encode(jsNumber(left / right));
+
+ CallFrame* callFrame = stackFrame.callFrame;
+ JSValue result = jsNumber(src1.toNumber(callFrame) / src2.toNumber(callFrame));
+ CHECK_FOR_EXCEPTION_AT_END();
+ return JSValue::encode(result);
+}
+
+DEFINE_STUB_FUNCTION(EncodedJSValue, op_pre_dec)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ JSValue v = stackFrame.args[0].jsValue();
+
+ CallFrame* callFrame = stackFrame.callFrame;
+ JSValue result = jsNumber(v.toNumber(callFrame) - 1);
+ CHECK_FOR_EXCEPTION_AT_END();
+ return JSValue::encode(result);
+}
+
+DEFINE_STUB_FUNCTION(int, op_jless)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ JSValue src1 = stackFrame.args[0].jsValue();
+ JSValue src2 = stackFrame.args[1].jsValue();
+ CallFrame* callFrame = stackFrame.callFrame;
+
+ bool result = jsLess(callFrame, src1, src2);
+ CHECK_FOR_EXCEPTION_AT_END();
+ return result;
+}
+
+DEFINE_STUB_FUNCTION(int, op_jlesseq)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ JSValue src1 = stackFrame.args[0].jsValue();
+ JSValue src2 = stackFrame.args[1].jsValue();
+ CallFrame* callFrame = stackFrame.callFrame;
+
+ bool result = jsLessEq(callFrame, src1, src2);
+ CHECK_FOR_EXCEPTION_AT_END();
+ return result;
+}
+
+DEFINE_STUB_FUNCTION(EncodedJSValue, op_not)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ JSValue src = stackFrame.args[0].jsValue();
+
+ CallFrame* callFrame = stackFrame.callFrame;
+
+ JSValue result = jsBoolean(!src.toBoolean(callFrame));
+ CHECK_FOR_EXCEPTION_AT_END();
+ return JSValue::encode(result);
+}
+
+DEFINE_STUB_FUNCTION(int, op_jtrue)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ JSValue src1 = stackFrame.args[0].jsValue();
+
+ CallFrame* callFrame = stackFrame.callFrame;
+
+ bool result = src1.toBoolean(callFrame);
+ CHECK_FOR_EXCEPTION_AT_END();
+ return result;
+}
+
+DEFINE_STUB_FUNCTION(EncodedJSValue, op_post_inc)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ JSValue v = stackFrame.args[0].jsValue();
+
+ CallFrame* callFrame = stackFrame.callFrame;
+
+ JSValue number = v.toJSNumber(callFrame);
+ CHECK_FOR_EXCEPTION_AT_END();
+
+ callFrame->registers()[stackFrame.args[1].int32()] = jsNumber(number.uncheckedGetNumber() + 1);
+ return JSValue::encode(number);
+}
+
+DEFINE_STUB_FUNCTION(int, op_eq)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ JSValue src1 = stackFrame.args[0].jsValue();
+ JSValue src2 = stackFrame.args[1].jsValue();
+
+#if USE(JSVALUE32_64)
+ start:
+ if (src2.isUndefined()) {
+ return src1.isNull() ||
+ (src1.isCell() && src1.asCell()->structure()->typeInfo().masqueradesAsUndefined())
+ || src1.isUndefined();
+ }
+
+ if (src2.isNull()) {
+ return src1.isUndefined() ||
+ (src1.isCell() && src1.asCell()->structure()->typeInfo().masqueradesAsUndefined())
+ || src1.isNull();
+ }
+
+ if (src1.isInt32()) {
+ if (src2.isDouble())
+ return src1.asInt32() == src2.asDouble();
+ double d = src2.toNumber(stackFrame.callFrame);
+ CHECK_FOR_EXCEPTION();
+ return src1.asInt32() == d;
+ }
+
+ if (src1.isDouble()) {
+ if (src2.isInt32())
+ return src1.asDouble() == src2.asInt32();
+ double d = src2.toNumber(stackFrame.callFrame);
+ CHECK_FOR_EXCEPTION();
+ return src1.asDouble() == d;
+ }
+
+ if (src1.isTrue()) {
+ if (src2.isFalse())
+ return false;
+ double d = src2.toNumber(stackFrame.callFrame);
+ CHECK_FOR_EXCEPTION();
+ return d == 1.0;
+ }
+
+ if (src1.isFalse()) {
+ if (src2.isTrue())
+ return false;
+ double d = src2.toNumber(stackFrame.callFrame);
+ CHECK_FOR_EXCEPTION();
+ return d == 0.0;
+ }
+
+ if (src1.isUndefined())
+ return src2.isCell() && src2.asCell()->structure()->typeInfo().masqueradesAsUndefined();
+
+ if (src1.isNull())
+ return src2.isCell() && src2.asCell()->structure()->typeInfo().masqueradesAsUndefined();
+
+ JSCell* cell1 = src1.asCell();
+
+ if (cell1->isString()) {
+ if (src2.isInt32())
+ return jsToNumber(static_cast<JSString*>(cell1)->value(stackFrame.callFrame)) == src2.asInt32();
+
+ if (src2.isDouble())
+ return jsToNumber(static_cast<JSString*>(cell1)->value(stackFrame.callFrame)) == src2.asDouble();
+
+ if (src2.isTrue())
+ return jsToNumber(static_cast<JSString*>(cell1)->value(stackFrame.callFrame)) == 1.0;
+
+ if (src2.isFalse())
+ return jsToNumber(static_cast<JSString*>(cell1)->value(stackFrame.callFrame)) == 0.0;
+
+ JSCell* cell2 = src2.asCell();
+ if (cell2->isString())
+ return static_cast<JSString*>(cell1)->value(stackFrame.callFrame) == static_cast<JSString*>(cell2)->value(stackFrame.callFrame);
+
+ src2 = asObject(cell2)->toPrimitive(stackFrame.callFrame);
+ CHECK_FOR_EXCEPTION();
+ goto start;
+ }
+
+ if (src2.isObject())
+ return asObject(cell1) == asObject(src2);
+ src1 = asObject(cell1)->toPrimitive(stackFrame.callFrame);
+ CHECK_FOR_EXCEPTION();
+ goto start;
+
+#else // USE(JSVALUE32_64)
+ CallFrame* callFrame = stackFrame.callFrame;
+
+ bool result = JSValue::equalSlowCaseInline(callFrame, src1, src2);
+ CHECK_FOR_EXCEPTION_AT_END();
+ return result;
+#endif // USE(JSVALUE32_64)
+}
+
+DEFINE_STUB_FUNCTION(int, op_eq_strings)
+{
+#if USE(JSVALUE32_64)
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ JSString* string1 = stackFrame.args[0].jsString();
+ JSString* string2 = stackFrame.args[1].jsString();
+
+ ASSERT(string1->isString());
+ ASSERT(string2->isString());
+ return string1->value(stackFrame.callFrame) == string2->value(stackFrame.callFrame);
+#else
+ UNUSED_PARAM(args);
+ ASSERT_NOT_REACHED();
+ return 0;
+#endif
+}
+
+DEFINE_STUB_FUNCTION(EncodedJSValue, op_lshift)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ JSValue val = stackFrame.args[0].jsValue();
+ JSValue shift = stackFrame.args[1].jsValue();
+
+ CallFrame* callFrame = stackFrame.callFrame;
+ JSValue result = jsNumber((val.toInt32(callFrame)) << (shift.toUInt32(callFrame) & 0x1f));
+ CHECK_FOR_EXCEPTION_AT_END();
+ return JSValue::encode(result);
+}
+
+DEFINE_STUB_FUNCTION(EncodedJSValue, op_bitand)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ JSValue src1 = stackFrame.args[0].jsValue();
+ JSValue src2 = stackFrame.args[1].jsValue();
+
+ ASSERT(!src1.isInt32() || !src2.isInt32());
+ CallFrame* callFrame = stackFrame.callFrame;
+ JSValue result = jsNumber(src1.toInt32(callFrame) & src2.toInt32(callFrame));
+ CHECK_FOR_EXCEPTION_AT_END();
+ return JSValue::encode(result);
+}
+
+DEFINE_STUB_FUNCTION(EncodedJSValue, op_rshift)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ JSValue val = stackFrame.args[0].jsValue();
+ JSValue shift = stackFrame.args[1].jsValue();
+
+ CallFrame* callFrame = stackFrame.callFrame;
+ JSValue result = jsNumber((val.toInt32(callFrame)) >> (shift.toUInt32(callFrame) & 0x1f));
+
+ CHECK_FOR_EXCEPTION_AT_END();
+ return JSValue::encode(result);
+}
+
+DEFINE_STUB_FUNCTION(EncodedJSValue, op_bitnot)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ JSValue src = stackFrame.args[0].jsValue();
+
+ ASSERT(!src.isInt32());
+ CallFrame* callFrame = stackFrame.callFrame;
+ JSValue result = jsNumber(~src.toInt32(callFrame));
+ CHECK_FOR_EXCEPTION_AT_END();
+ return JSValue::encode(result);
+}
+
+DEFINE_STUB_FUNCTION(EncodedJSValue, op_resolve_with_base)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ CallFrame* callFrame = stackFrame.callFrame;
+ ScopeChainNode* scopeChain = callFrame->scopeChain();
+
+ ScopeChainIterator iter = scopeChain->begin();
+ ScopeChainIterator end = scopeChain->end();
+
+ // FIXME: add scopeDepthIsZero optimization
+
+ ASSERT(iter != end);
+
+ Identifier& ident = stackFrame.args[0].identifier();
+ JSObject* base;
+ do {
+ base = *iter;
+ PropertySlot slot(base);
+ if (base->getPropertySlot(callFrame, ident, slot)) {
+ JSValue result = slot.getValue(callFrame, ident);
+ CHECK_FOR_EXCEPTION_AT_END();
+
+ callFrame->registers()[stackFrame.args[1].int32()] = JSValue(base);
+ return JSValue::encode(result);
+ }
+ ++iter;
+ } while (iter != end);
+
+ stackFrame.globalData->exception = createUndefinedVariableError(callFrame, ident);
+ VM_THROW_EXCEPTION_AT_END();
+ return JSValue::encode(JSValue());
+}
+
+DEFINE_STUB_FUNCTION(JSObject*, op_new_func_exp)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+ CallFrame* callFrame = stackFrame.callFrame;
+
+ FunctionExecutable* function = stackFrame.args[0].function();
+ JSFunction* func = function->make(callFrame, callFrame->scopeChain());
+ ASSERT(callFrame->codeBlock()->codeType() != FunctionCode || !callFrame->codeBlock()->needsFullScopeChain() || callFrame->uncheckedR(callFrame->codeBlock()->activationRegister()).jsValue());
+
+ /*
+ The Identifier in a FunctionExpression can be referenced from inside
+ the FunctionExpression's FunctionBody to allow the function to call
+ itself recursively. However, unlike in a FunctionDeclaration, the
+ Identifier in a FunctionExpression cannot be referenced from and
+ does not affect the scope enclosing the FunctionExpression.
+ */
+ if (!function->name().isNull()) {
+ JSStaticScopeObject* functionScopeObject = new (callFrame) JSStaticScopeObject(callFrame, function->name(), func, ReadOnly | DontDelete);
+ func->scope().push(functionScopeObject);
+ }
+
+ return func;
+}
+
+DEFINE_STUB_FUNCTION(EncodedJSValue, op_mod)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ JSValue dividendValue = stackFrame.args[0].jsValue();
+ JSValue divisorValue = stackFrame.args[1].jsValue();
+
+ CallFrame* callFrame = stackFrame.callFrame;
+ double d = dividendValue.toNumber(callFrame);
+ JSValue result = jsNumber(fmod(d, divisorValue.toNumber(callFrame)));
+ CHECK_FOR_EXCEPTION_AT_END();
+ return JSValue::encode(result);
+}
+
+DEFINE_STUB_FUNCTION(EncodedJSValue, op_less)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ CallFrame* callFrame = stackFrame.callFrame;
+ JSValue result = jsBoolean(jsLess(callFrame, stackFrame.args[0].jsValue(), stackFrame.args[1].jsValue()));
+ CHECK_FOR_EXCEPTION_AT_END();
+ return JSValue::encode(result);
+}
+
+DEFINE_STUB_FUNCTION(EncodedJSValue, op_post_dec)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ JSValue v = stackFrame.args[0].jsValue();
+
+ CallFrame* callFrame = stackFrame.callFrame;
+
+ JSValue number = v.toJSNumber(callFrame);
+ CHECK_FOR_EXCEPTION_AT_END();
+
+ callFrame->registers()[stackFrame.args[1].int32()] = jsNumber(number.uncheckedGetNumber() - 1);
+ return JSValue::encode(number);
+}
+
+DEFINE_STUB_FUNCTION(EncodedJSValue, op_urshift)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ JSValue val = stackFrame.args[0].jsValue();
+ JSValue shift = stackFrame.args[1].jsValue();
+
+ CallFrame* callFrame = stackFrame.callFrame;
+ JSValue result = jsNumber((val.toUInt32(callFrame)) >> (shift.toUInt32(callFrame) & 0x1f));
+ CHECK_FOR_EXCEPTION_AT_END();
+ return JSValue::encode(result);
+}
+
+DEFINE_STUB_FUNCTION(EncodedJSValue, op_bitxor)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ JSValue src1 = stackFrame.args[0].jsValue();
+ JSValue src2 = stackFrame.args[1].jsValue();
+
+ CallFrame* callFrame = stackFrame.callFrame;
+
+ JSValue result = jsNumber(src1.toInt32(callFrame) ^ src2.toInt32(callFrame));
+ CHECK_FOR_EXCEPTION_AT_END();
+ return JSValue::encode(result);
+}
+
+DEFINE_STUB_FUNCTION(JSObject*, op_new_regexp)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ return new (stackFrame.globalData) RegExpObject(stackFrame.callFrame->lexicalGlobalObject(), stackFrame.callFrame->lexicalGlobalObject()->regExpStructure(), stackFrame.args[0].regExp());
+}
+
+DEFINE_STUB_FUNCTION(EncodedJSValue, op_bitor)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ JSValue src1 = stackFrame.args[0].jsValue();
+ JSValue src2 = stackFrame.args[1].jsValue();
+
+ CallFrame* callFrame = stackFrame.callFrame;
+
+ JSValue result = jsNumber(src1.toInt32(callFrame) | src2.toInt32(callFrame));
+ CHECK_FOR_EXCEPTION_AT_END();
+ return JSValue::encode(result);
+}
+
+DEFINE_STUB_FUNCTION(EncodedJSValue, op_call_eval)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+ ASSERT(stackFrame.callFrame->codeBlock()->codeType() != FunctionCode || !stackFrame.callFrame->codeBlock()->needsFullScopeChain() || stackFrame.callFrame->uncheckedR(stackFrame.callFrame->codeBlock()->activationRegister()).jsValue());
+
+ CallFrame* callFrame = stackFrame.callFrame;
+ RegisterFile* registerFile = stackFrame.registerFile;
+
+ Interpreter* interpreter = stackFrame.globalData->interpreter;
+
+ JSValue funcVal = stackFrame.args[0].jsValue();
+ int registerOffset = stackFrame.args[1].int32();
+ int argCount = stackFrame.args[2].int32();
+
+ Register* newCallFrame = callFrame->registers() + registerOffset;
+ Register* argv = newCallFrame - RegisterFile::CallFrameHeaderSize - argCount;
+ JSValue baseValue = argv[0].jsValue();
+ JSGlobalObject* globalObject = callFrame->scopeChain()->globalObject;
+
+ if (baseValue == globalObject && funcVal == globalObject->evalFunction()) {
+ JSValue result = interpreter->callEval(callFrame, registerFile, argv, argCount, registerOffset);
+ CHECK_FOR_EXCEPTION_AT_END();
+ return JSValue::encode(result);
+ }
+
+ return JSValue::encode(JSValue());
+}
+
+DEFINE_STUB_FUNCTION(void*, op_throw)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+ ExceptionHandler handler = jitThrow(stackFrame.globalData, stackFrame.callFrame, stackFrame.args[0].jsValue(), STUB_RETURN_ADDRESS);
+ STUB_SET_RETURN_ADDRESS(handler.catchRoutine);
+ return handler.callFrame;
+}
+
+DEFINE_STUB_FUNCTION(JSPropertyNameIterator*, op_get_pnames)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ CallFrame* callFrame = stackFrame.callFrame;
+ JSObject* o = stackFrame.args[0].jsObject();
+ Structure* structure = o->structure();
+ JSPropertyNameIterator* jsPropertyNameIterator = structure->enumerationCache();
+ if (!jsPropertyNameIterator || jsPropertyNameIterator->cachedPrototypeChain() != structure->prototypeChain(callFrame))
+ jsPropertyNameIterator = JSPropertyNameIterator::create(callFrame, o);
+ return jsPropertyNameIterator;
+}
+
+DEFINE_STUB_FUNCTION(int, has_property)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ JSObject* base = stackFrame.args[0].jsObject();
+ JSString* property = stackFrame.args[1].jsString();
+ int result = base->hasProperty(stackFrame.callFrame, Identifier(stackFrame.callFrame, property->value(stackFrame.callFrame)));
+ CHECK_FOR_EXCEPTION_AT_END();
+ return result;
+}
+
+DEFINE_STUB_FUNCTION(JSObject*, op_push_scope)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ JSObject* o = stackFrame.args[0].jsValue().toObject(stackFrame.callFrame);
+ CHECK_FOR_EXCEPTION();
+ stackFrame.callFrame->setScopeChain(stackFrame.callFrame->scopeChain()->push(o));
+ return o;
+}
+
+DEFINE_STUB_FUNCTION(void, op_pop_scope)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ stackFrame.callFrame->setScopeChain(stackFrame.callFrame->scopeChain()->pop());
+}
+
+DEFINE_STUB_FUNCTION(EncodedJSValue, op_typeof)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ return JSValue::encode(jsTypeStringForValue(stackFrame.callFrame, stackFrame.args[0].jsValue()));
+}
+
+DEFINE_STUB_FUNCTION(EncodedJSValue, op_is_undefined)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ JSValue v = stackFrame.args[0].jsValue();
+ return JSValue::encode(jsBoolean(v.isCell() ? v.asCell()->structure()->typeInfo().masqueradesAsUndefined() : v.isUndefined()));
+}
+
+DEFINE_STUB_FUNCTION(EncodedJSValue, op_is_boolean)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ return JSValue::encode(jsBoolean(stackFrame.args[0].jsValue().isBoolean()));
+}
+
+DEFINE_STUB_FUNCTION(EncodedJSValue, op_is_number)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ return JSValue::encode(jsBoolean(stackFrame.args[0].jsValue().isNumber()));
+}
+
+DEFINE_STUB_FUNCTION(EncodedJSValue, op_is_string)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ return JSValue::encode(jsBoolean(isJSString(stackFrame.globalData, stackFrame.args[0].jsValue())));
+}
+
+DEFINE_STUB_FUNCTION(EncodedJSValue, op_is_object)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ return JSValue::encode(jsBoolean(jsIsObjectType(stackFrame.args[0].jsValue())));
+}
+
+DEFINE_STUB_FUNCTION(EncodedJSValue, op_is_function)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ return JSValue::encode(jsBoolean(jsIsFunctionType(stackFrame.args[0].jsValue())));
+}
+
+DEFINE_STUB_FUNCTION(EncodedJSValue, op_stricteq)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ JSValue src1 = stackFrame.args[0].jsValue();
+ JSValue src2 = stackFrame.args[1].jsValue();
+
+ bool result = JSValue::strictEqual(stackFrame.callFrame, src1, src2);
+ CHECK_FOR_EXCEPTION_AT_END();
+ return JSValue::encode(jsBoolean(result));
+}
+
+DEFINE_STUB_FUNCTION(EncodedJSValue, op_to_primitive)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ return JSValue::encode(stackFrame.args[0].jsValue().toPrimitive(stackFrame.callFrame));
+}
+
+DEFINE_STUB_FUNCTION(EncodedJSValue, op_strcat)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ JSValue result = jsString(stackFrame.callFrame, &stackFrame.callFrame->registers()[stackFrame.args[0].int32()], stackFrame.args[1].int32());
+ CHECK_FOR_EXCEPTION_AT_END();
+ return JSValue::encode(result);
+}
+
+DEFINE_STUB_FUNCTION(EncodedJSValue, op_nstricteq)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ JSValue src1 = stackFrame.args[0].jsValue();
+ JSValue src2 = stackFrame.args[1].jsValue();
+
+ bool result = !JSValue::strictEqual(stackFrame.callFrame, src1, src2);
+ CHECK_FOR_EXCEPTION_AT_END();
+ return JSValue::encode(jsBoolean(result));
+}
+
+DEFINE_STUB_FUNCTION(EncodedJSValue, op_to_jsnumber)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ JSValue src = stackFrame.args[0].jsValue();
+ CallFrame* callFrame = stackFrame.callFrame;
+
+ JSValue result = src.toJSNumber(callFrame);
+ CHECK_FOR_EXCEPTION_AT_END();
+ return JSValue::encode(result);
+}
+
+DEFINE_STUB_FUNCTION(EncodedJSValue, op_in)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ CallFrame* callFrame = stackFrame.callFrame;
+ JSValue baseVal = stackFrame.args[1].jsValue();
+
+ if (!baseVal.isObject()) {
+ stackFrame.globalData->exception = createInvalidParamError(stackFrame.callFrame, "in", baseVal);
+ VM_THROW_EXCEPTION();
+ }
+
+ JSValue propName = stackFrame.args[0].jsValue();
+ JSObject* baseObj = asObject(baseVal);
+
+ uint32_t i;
+ if (propName.getUInt32(i))
+ return JSValue::encode(jsBoolean(baseObj->hasProperty(callFrame, i)));
+
+ Identifier property(callFrame, propName.toString(callFrame));
+ CHECK_FOR_EXCEPTION();
+ return JSValue::encode(jsBoolean(baseObj->hasProperty(callFrame, property)));
+}
+
+DEFINE_STUB_FUNCTION(JSObject*, op_push_new_scope)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ JSObject* scope = new (stackFrame.globalData) JSStaticScopeObject(stackFrame.callFrame, stackFrame.args[0].identifier(), stackFrame.args[1].jsValue(), DontDelete);
+
+ CallFrame* callFrame = stackFrame.callFrame;
+ callFrame->setScopeChain(callFrame->scopeChain()->push(scope));
+ return scope;
+}
+
+DEFINE_STUB_FUNCTION(void, op_jmp_scopes)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ unsigned count = stackFrame.args[0].int32();
+ CallFrame* callFrame = stackFrame.callFrame;
+
+ ScopeChainNode* tmp = callFrame->scopeChain();
+ while (count--)
+ tmp = tmp->pop();
+ callFrame->setScopeChain(tmp);
+}
+
+DEFINE_STUB_FUNCTION(void, op_put_by_index)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ CallFrame* callFrame = stackFrame.callFrame;
+ unsigned property = stackFrame.args[1].int32();
+
+ stackFrame.args[0].jsValue().put(callFrame, property, stackFrame.args[2].jsValue());
+}
+
+DEFINE_STUB_FUNCTION(void*, op_switch_imm)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ JSValue scrutinee = stackFrame.args[0].jsValue();
+ unsigned tableIndex = stackFrame.args[1].int32();
+ CallFrame* callFrame = stackFrame.callFrame;
+ CodeBlock* codeBlock = callFrame->codeBlock();
+
+ if (scrutinee.isInt32())
+ return codeBlock->immediateSwitchJumpTable(tableIndex).ctiForValue(scrutinee.asInt32()).executableAddress();
+ else {
+ double value;
+ int32_t intValue;
+ if (scrutinee.getNumber(value) && ((intValue = static_cast<int32_t>(value)) == value))
+ return codeBlock->immediateSwitchJumpTable(tableIndex).ctiForValue(intValue).executableAddress();
+ else
+ return codeBlock->immediateSwitchJumpTable(tableIndex).ctiDefault.executableAddress();
+ }
+}
+
+DEFINE_STUB_FUNCTION(void*, op_switch_char)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ JSValue scrutinee = stackFrame.args[0].jsValue();
+ unsigned tableIndex = stackFrame.args[1].int32();
+ CallFrame* callFrame = stackFrame.callFrame;
+ CodeBlock* codeBlock = callFrame->codeBlock();
+
+ void* result = codeBlock->characterSwitchJumpTable(tableIndex).ctiDefault.executableAddress();
+
+ if (scrutinee.isString()) {
+ StringImpl* value = asString(scrutinee)->value(callFrame).impl();
+ if (value->length() == 1)
+ result = codeBlock->characterSwitchJumpTable(tableIndex).ctiForValue(value->characters()[0]).executableAddress();
+ }
+
+ CHECK_FOR_EXCEPTION_AT_END();
+ return result;
+}
+
+DEFINE_STUB_FUNCTION(void*, op_switch_string)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ JSValue scrutinee = stackFrame.args[0].jsValue();
+ unsigned tableIndex = stackFrame.args[1].int32();
+ CallFrame* callFrame = stackFrame.callFrame;
+ CodeBlock* codeBlock = callFrame->codeBlock();
+
+ void* result = codeBlock->stringSwitchJumpTable(tableIndex).ctiDefault.executableAddress();
+
+ if (scrutinee.isString()) {
+ StringImpl* value = asString(scrutinee)->value(callFrame).impl();
+ result = codeBlock->stringSwitchJumpTable(tableIndex).ctiForValue(value).executableAddress();
+ }
+
+ CHECK_FOR_EXCEPTION_AT_END();
+ return result;
+}
+
+DEFINE_STUB_FUNCTION(EncodedJSValue, op_del_by_val)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ CallFrame* callFrame = stackFrame.callFrame;
+
+ JSValue baseValue = stackFrame.args[0].jsValue();
+ JSObject* baseObj = baseValue.toObject(callFrame); // may throw
+
+ JSValue subscript = stackFrame.args[1].jsValue();
+ bool result;
+ uint32_t i;
+ if (subscript.getUInt32(i))
+ result = baseObj->deleteProperty(callFrame, i);
+ else {
+ CHECK_FOR_EXCEPTION();
+ Identifier property(callFrame, subscript.toString(callFrame));
+ CHECK_FOR_EXCEPTION();
+ result = baseObj->deleteProperty(callFrame, property);
+ }
+
+ if (!result && callFrame->codeBlock()->isStrictMode())
+ stackFrame.globalData->exception = createTypeError(stackFrame.callFrame, "Unable to delete property.");
+
+ CHECK_FOR_EXCEPTION_AT_END();
+ return JSValue::encode(jsBoolean(result));
+}
+
+DEFINE_STUB_FUNCTION(void, op_put_getter)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ CallFrame* callFrame = stackFrame.callFrame;
+
+ ASSERT(stackFrame.args[0].jsValue().isObject());
+ JSObject* baseObj = asObject(stackFrame.args[0].jsValue());
+ ASSERT(stackFrame.args[2].jsValue().isObject());
+ baseObj->defineGetter(callFrame, stackFrame.args[1].identifier(), asObject(stackFrame.args[2].jsValue()));
+}
+
+DEFINE_STUB_FUNCTION(void, op_put_setter)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ CallFrame* callFrame = stackFrame.callFrame;
+
+ ASSERT(stackFrame.args[0].jsValue().isObject());
+ JSObject* baseObj = asObject(stackFrame.args[0].jsValue());
+ ASSERT(stackFrame.args[2].jsValue().isObject());
+ baseObj->defineSetter(callFrame, stackFrame.args[1].identifier(), asObject(stackFrame.args[2].jsValue()));
+}
+
+DEFINE_STUB_FUNCTION(void, op_throw_reference_error)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ CallFrame* callFrame = stackFrame.callFrame;
+ UString message = stackFrame.args[0].jsValue().toString(callFrame);
+ stackFrame.globalData->exception = createReferenceError(callFrame, message);
+ VM_THROW_EXCEPTION_AT_END();
+}
+
+DEFINE_STUB_FUNCTION(void, op_throw_syntax_error)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ CallFrame* callFrame = stackFrame.callFrame;
+ UString message = stackFrame.args[0].jsValue().toString(callFrame);
+ stackFrame.globalData->exception = createSyntaxError(callFrame, message);
+ VM_THROW_EXCEPTION_AT_END();
+}
+
+DEFINE_STUB_FUNCTION(void, op_debug)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ CallFrame* callFrame = stackFrame.callFrame;
+
+ int debugHookID = stackFrame.args[0].int32();
+ int firstLine = stackFrame.args[1].int32();
+ int lastLine = stackFrame.args[2].int32();
+
+ stackFrame.globalData->interpreter->debug(callFrame, static_cast<DebugHookID>(debugHookID), firstLine, lastLine);
+}
+
+DEFINE_STUB_FUNCTION(void*, vm_throw)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+ JSGlobalData* globalData = stackFrame.globalData;
+ ExceptionHandler handler = jitThrow(globalData, stackFrame.callFrame, globalData->exception, globalData->exceptionLocation);
+ STUB_SET_RETURN_ADDRESS(handler.catchRoutine);
+ return handler.callFrame;
+}
+
+DEFINE_STUB_FUNCTION(EncodedJSValue, to_object)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+
+ CallFrame* callFrame = stackFrame.callFrame;
+ return JSValue::encode(stackFrame.args[0].jsValue().toObject(callFrame));
+}
+
+MacroAssemblerCodePtr JITThunks::ctiStub(JSGlobalData* globalData, ThunkGenerator generator)
+{
+ std::pair<CTIStubMap::iterator, bool> entry = m_ctiStubMap.add(generator, MacroAssemblerCodePtr());
+ if (entry.second)
+ entry.first->second = generator(globalData, m_executablePool.get());
+ return entry.first->second;
+}
+
+PassRefPtr<NativeExecutable> JITThunks::hostFunctionStub(JSGlobalData* globalData, NativeFunction function)
+{
+ std::pair<HostFunctionStubMap::iterator, bool> entry = m_hostFunctionStubMap.add(function, 0);
+ if (entry.second)
+ entry.first->second = NativeExecutable::create(JIT::compileCTINativeCall(globalData, m_executablePool, function), function, ctiNativeConstruct(), callHostFunctionAsConstructor);
+ return entry.first->second;
+}
+
+PassRefPtr<NativeExecutable> JITThunks::hostFunctionStub(JSGlobalData* globalData, NativeFunction function, ThunkGenerator generator)
+{
+ std::pair<HostFunctionStubMap::iterator, bool> entry = m_hostFunctionStubMap.add(function, 0);
+ if (entry.second) {
+ MacroAssemblerCodePtr code = globalData->canUseJIT() ? generator(globalData, m_executablePool.get()) : MacroAssemblerCodePtr();
+ entry.first->second = NativeExecutable::create(code, function, ctiNativeConstruct(), callHostFunctionAsConstructor);
+ }
+ return entry.first->second;
+}
+
+} // namespace JSC
+
+#endif // ENABLE(JIT)
diff --git a/Source/JavaScriptCore/jit/JITStubs.h b/Source/JavaScriptCore/jit/JITStubs.h
new file mode 100644
index 0000000..937134b
--- /dev/null
+++ b/Source/JavaScriptCore/jit/JITStubs.h
@@ -0,0 +1,416 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef JITStubs_h
+#define JITStubs_h
+
+#include "CallData.h"
+#include "MacroAssemblerCodeRef.h"
+#include "Register.h"
+#include "ThunkGenerators.h"
+#include <wtf/HashMap.h>
+
+#if ENABLE(JIT)
+
+namespace JSC {
+
+ struct StructureStubInfo;
+
+ class CodeBlock;
+ class ExecutablePool;
+ class FunctionExecutable;
+ class Identifier;
+ class JSGlobalData;
+ class JSGlobalObject;
+ class JSObject;
+ class JSPropertyNameIterator;
+ class JSValue;
+ class JSValueEncodedAsPointer;
+ class NativeExecutable;
+ class Profiler;
+ class PropertySlot;
+ class PutPropertySlot;
+ class RegisterFile;
+ class RegExp;
+
+ union JITStubArg {
+ void* asPointer;
+ EncodedJSValue asEncodedJSValue;
+ int32_t asInt32;
+
+ JSValue jsValue() { return JSValue::decode(asEncodedJSValue); }
+ JSObject* jsObject() { return static_cast<JSObject*>(asPointer); }
+ Identifier& identifier() { return *static_cast<Identifier*>(asPointer); }
+ int32_t int32() { return asInt32; }
+ CodeBlock* codeBlock() { return static_cast<CodeBlock*>(asPointer); }
+ FunctionExecutable* function() { return static_cast<FunctionExecutable*>(asPointer); }
+ RegExp* regExp() { return static_cast<RegExp*>(asPointer); }
+ JSPropertyNameIterator* propertyNameIterator() { return static_cast<JSPropertyNameIterator*>(asPointer); }
+ JSGlobalObject* globalObject() { return static_cast<JSGlobalObject*>(asPointer); }
+ JSString* jsString() { return static_cast<JSString*>(asPointer); }
+ ReturnAddressPtr returnAddress() { return ReturnAddressPtr(asPointer); }
+ };
+
+ struct TrampolineStructure {
+ MacroAssemblerCodePtr ctiStringLengthTrampoline;
+ MacroAssemblerCodePtr ctiVirtualCallLink;
+ MacroAssemblerCodePtr ctiVirtualConstructLink;
+ MacroAssemblerCodePtr ctiVirtualCall;
+ MacroAssemblerCodePtr ctiVirtualConstruct;
+ MacroAssemblerCodePtr ctiNativeCall;
+ MacroAssemblerCodePtr ctiNativeConstruct;
+ MacroAssemblerCodePtr ctiSoftModulo;
+ };
+
+#if CPU(X86_64)
+ struct JITStackFrame {
+ void* reserved; // Unused
+ JITStubArg args[6];
+ void* padding[2]; // Maintain 32-byte stack alignment (possibly overkill).
+
+ void* code;
+ RegisterFile* registerFile;
+ CallFrame* callFrame;
+ void* unused1;
+ Profiler** enabledProfilerReference;
+ JSGlobalData* globalData;
+
+ void* savedRBX;
+ void* savedR15;
+ void* savedR14;
+ void* savedR13;
+ void* savedR12;
+ void* savedRBP;
+ void* savedRIP;
+
+ // When JIT code makes a call, it pushes its return address just below the rest of the stack.
+ ReturnAddressPtr* returnAddressSlot() { return reinterpret_cast<ReturnAddressPtr*>(this) - 1; }
+ };
+#elif CPU(X86)
+#if COMPILER(MSVC) || (OS(WINDOWS) && COMPILER(GCC))
+#pragma pack(push)
+#pragma pack(4)
+#endif // COMPILER(MSVC) || (OS(WINDOWS) && COMPILER(GCC))
+ struct JITStackFrame {
+ void* reserved; // Unused
+ JITStubArg args[6];
+#if USE(JSVALUE32_64)
+ void* padding[2]; // Maintain 16-byte stack alignment.
+#endif
+
+ void* savedEBX;
+ void* savedEDI;
+ void* savedESI;
+ void* savedEBP;
+ void* savedEIP;
+
+ void* code;
+ RegisterFile* registerFile;
+ CallFrame* callFrame;
+ void* unused1;
+ Profiler** enabledProfilerReference;
+ JSGlobalData* globalData;
+
+ // When JIT code makes a call, it pushes its return address just below the rest of the stack.
+ ReturnAddressPtr* returnAddressSlot() { return reinterpret_cast<ReturnAddressPtr*>(this) - 1; }
+ };
+#if COMPILER(MSVC) || (OS(WINDOWS) && COMPILER(GCC))
+#pragma pack(pop)
+#endif // COMPILER(MSVC) || (OS(WINDOWS) && COMPILER(GCC))
+#elif CPU(ARM_THUMB2)
+ struct JITStackFrame {
+ JITStubArg reserved; // Unused
+ JITStubArg args[6];
+#if USE(JSVALUE64)
+ void* padding; // Maintain 16-byte stack alignment.
+#endif
+
+ ReturnAddressPtr thunkReturnAddress;
+
+ void* preservedReturnAddress;
+ void* preservedR4;
+ void* preservedR5;
+ void* preservedR6;
+
+ // These arguments passed in r1..r3 (r0 contained the entry code pointed, which is not preserved)
+ RegisterFile* registerFile;
+ CallFrame* callFrame;
+ void* unused1;
+
+ // These arguments passed on the stack.
+ Profiler** enabledProfilerReference;
+ JSGlobalData* globalData;
+
+ ReturnAddressPtr* returnAddressSlot() { return &thunkReturnAddress; }
+ };
+#elif CPU(ARM_TRADITIONAL)
+#if COMPILER(MSVC)
+#pragma pack(push)
+#pragma pack(4)
+#endif // COMPILER(MSVC)
+ struct JITStackFrame {
+ JITStubArg padding; // Unused
+ JITStubArg args[7];
+
+ ReturnAddressPtr thunkReturnAddress;
+
+ void* preservedR4;
+ void* preservedR5;
+ void* preservedR6;
+ void* preservedR7;
+ void* preservedR8;
+ void* preservedLink;
+
+ RegisterFile* registerFile;
+ CallFrame* callFrame;
+ void* unused1;
+
+ // These arguments passed on the stack.
+ Profiler** enabledProfilerReference;
+ JSGlobalData* globalData;
+
+ // When JIT code makes a call, it pushes its return address just below the rest of the stack.
+ ReturnAddressPtr* returnAddressSlot() { return &thunkReturnAddress; }
+ };
+#if COMPILER(MSVC)
+#pragma pack(pop)
+#endif // COMPILER(MSVC)
+#elif CPU(MIPS)
+ struct JITStackFrame {
+ JITStubArg reserved; // Unused
+ JITStubArg args[6];
+
+#if USE(JSVALUE32_64)
+ void* padding; // Make the overall stack length 8-byte aligned.
+#endif
+
+ void* preservedGP; // store GP when using PIC code
+ void* preservedS0;
+ void* preservedS1;
+ void* preservedS2;
+ void* preservedReturnAddress;
+
+ ReturnAddressPtr thunkReturnAddress;
+
+ // These arguments passed in a1..a3 (a0 contained the entry code pointed, which is not preserved)
+ RegisterFile* registerFile;
+ CallFrame* callFrame;
+ void* unused1;
+
+ // These arguments passed on the stack.
+ Profiler** enabledProfilerReference;
+ JSGlobalData* globalData;
+
+ ReturnAddressPtr* returnAddressSlot() { return &thunkReturnAddress; }
+ };
+#else
+#error "JITStackFrame not defined for this platform."
+#endif
+
+#define JITSTACKFRAME_ARGS_INDEX (OBJECT_OFFSETOF(JITStackFrame, args) / sizeof(void*))
+
+#define STUB_ARGS_DECLARATION void** args
+#define STUB_ARGS (args)
+
+#if CPU(X86)
+ #if COMPILER(MSVC)
+ #define JIT_STUB __fastcall
+ #elif COMPILER(GCC)
+ #define JIT_STUB __attribute__ ((fastcall))
+ #else
+ #error "JIT_STUB function calls require fastcall conventions on x86, add appropriate directive/attribute here for your compiler!"
+ #endif
+#else
+ #define JIT_STUB
+#endif
+
+ extern "C" void ctiVMThrowTrampoline();
+ extern "C" void ctiOpThrowNotCaught();
+ extern "C" EncodedJSValue ctiTrampoline(void* code, RegisterFile*, CallFrame*, void* /*unused1*/, Profiler**, JSGlobalData*);
+
+ class JITThunks {
+ public:
+ JITThunks(JSGlobalData*);
+ ~JITThunks();
+
+ static void tryCacheGetByID(CallFrame*, CodeBlock*, ReturnAddressPtr returnAddress, JSValue baseValue, const Identifier& propertyName, const PropertySlot&, StructureStubInfo* stubInfo);
+ static void tryCachePutByID(CallFrame*, CodeBlock*, ReturnAddressPtr returnAddress, JSValue baseValue, const PutPropertySlot&, StructureStubInfo* stubInfo, bool direct);
+
+ MacroAssemblerCodePtr ctiStringLengthTrampoline() { return m_trampolineStructure.ctiStringLengthTrampoline; }
+ MacroAssemblerCodePtr ctiVirtualCallLink() { return m_trampolineStructure.ctiVirtualCallLink; }
+ MacroAssemblerCodePtr ctiVirtualConstructLink() { return m_trampolineStructure.ctiVirtualConstructLink; }
+ MacroAssemblerCodePtr ctiVirtualCall() { return m_trampolineStructure.ctiVirtualCall; }
+ MacroAssemblerCodePtr ctiVirtualConstruct() { return m_trampolineStructure.ctiVirtualConstruct; }
+ MacroAssemblerCodePtr ctiNativeCall() { return m_trampolineStructure.ctiNativeCall; }
+ MacroAssemblerCodePtr ctiNativeConstruct() { return m_trampolineStructure.ctiNativeConstruct; }
+ MacroAssemblerCodePtr ctiSoftModulo() { return m_trampolineStructure.ctiSoftModulo; }
+
+ MacroAssemblerCodePtr ctiStub(JSGlobalData* globalData, ThunkGenerator generator);
+
+ PassRefPtr<NativeExecutable> hostFunctionStub(JSGlobalData* globalData, NativeFunction func);
+ PassRefPtr<NativeExecutable> hostFunctionStub(JSGlobalData* globalData, NativeFunction func, ThunkGenerator generator);
+ private:
+ typedef HashMap<ThunkGenerator, MacroAssemblerCodePtr> CTIStubMap;
+ CTIStubMap m_ctiStubMap;
+ typedef HashMap<NativeFunction, RefPtr<NativeExecutable> > HostFunctionStubMap;
+ HostFunctionStubMap m_hostFunctionStubMap;
+ RefPtr<ExecutablePool> m_executablePool;
+
+ TrampolineStructure m_trampolineStructure;
+ };
+
+extern "C" {
+ EncodedJSValue JIT_STUB cti_op_add(STUB_ARGS_DECLARATION);
+ EncodedJSValue JIT_STUB cti_op_bitand(STUB_ARGS_DECLARATION);
+ EncodedJSValue JIT_STUB cti_op_bitnot(STUB_ARGS_DECLARATION);
+ EncodedJSValue JIT_STUB cti_op_bitor(STUB_ARGS_DECLARATION);
+ EncodedJSValue JIT_STUB cti_op_bitxor(STUB_ARGS_DECLARATION);
+ EncodedJSValue JIT_STUB cti_op_call_NotJSFunction(STUB_ARGS_DECLARATION);
+ EncodedJSValue JIT_STUB cti_op_call_eval(STUB_ARGS_DECLARATION);
+ EncodedJSValue JIT_STUB cti_op_construct_NotJSConstruct(STUB_ARGS_DECLARATION);
+ EncodedJSValue JIT_STUB cti_op_create_this(STUB_ARGS_DECLARATION);
+ EncodedJSValue JIT_STUB cti_op_convert_this(STUB_ARGS_DECLARATION);
+ EncodedJSValue JIT_STUB cti_op_convert_this_strict(STUB_ARGS_DECLARATION);
+ EncodedJSValue JIT_STUB cti_op_create_arguments(STUB_ARGS_DECLARATION);
+ EncodedJSValue JIT_STUB cti_op_create_arguments_no_params(STUB_ARGS_DECLARATION);
+ EncodedJSValue JIT_STUB cti_op_del_by_id(STUB_ARGS_DECLARATION);
+ EncodedJSValue JIT_STUB cti_op_del_by_val(STUB_ARGS_DECLARATION);
+ EncodedJSValue JIT_STUB cti_op_div(STUB_ARGS_DECLARATION);
+ EncodedJSValue JIT_STUB cti_op_get_by_id(STUB_ARGS_DECLARATION);
+ EncodedJSValue JIT_STUB cti_op_get_by_id_array_fail(STUB_ARGS_DECLARATION);
+ EncodedJSValue JIT_STUB cti_op_get_by_id_custom_stub(STUB_ARGS_DECLARATION);
+ EncodedJSValue JIT_STUB cti_op_get_by_id_generic(STUB_ARGS_DECLARATION);
+ EncodedJSValue JIT_STUB cti_op_get_by_id_getter_stub(STUB_ARGS_DECLARATION);
+ EncodedJSValue JIT_STUB cti_op_get_by_id_method_check(STUB_ARGS_DECLARATION);
+ EncodedJSValue JIT_STUB cti_op_get_by_id_proto_fail(STUB_ARGS_DECLARATION);
+ EncodedJSValue JIT_STUB cti_op_get_by_id_proto_list(STUB_ARGS_DECLARATION);
+ EncodedJSValue JIT_STUB cti_op_get_by_id_proto_list_full(STUB_ARGS_DECLARATION);
+ EncodedJSValue JIT_STUB cti_op_get_by_id_self_fail(STUB_ARGS_DECLARATION);
+ EncodedJSValue JIT_STUB cti_op_get_by_id_string_fail(STUB_ARGS_DECLARATION);
+ EncodedJSValue JIT_STUB cti_op_get_by_val(STUB_ARGS_DECLARATION);
+ EncodedJSValue JIT_STUB cti_op_get_by_val_byte_array(STUB_ARGS_DECLARATION);
+ EncodedJSValue JIT_STUB cti_op_get_by_val_string(STUB_ARGS_DECLARATION);
+ EncodedJSValue JIT_STUB cti_op_in(STUB_ARGS_DECLARATION);
+ EncodedJSValue JIT_STUB cti_op_instanceof(STUB_ARGS_DECLARATION);
+ EncodedJSValue JIT_STUB cti_op_is_boolean(STUB_ARGS_DECLARATION);
+ EncodedJSValue JIT_STUB cti_op_is_function(STUB_ARGS_DECLARATION);
+ EncodedJSValue JIT_STUB cti_op_is_number(STUB_ARGS_DECLARATION);
+ EncodedJSValue JIT_STUB cti_op_is_object(STUB_ARGS_DECLARATION);
+ EncodedJSValue JIT_STUB cti_op_is_string(STUB_ARGS_DECLARATION);
+ EncodedJSValue JIT_STUB cti_op_is_undefined(STUB_ARGS_DECLARATION);
+ EncodedJSValue JIT_STUB cti_op_less(STUB_ARGS_DECLARATION);
+ EncodedJSValue JIT_STUB cti_op_lesseq(STUB_ARGS_DECLARATION);
+ EncodedJSValue JIT_STUB cti_op_lshift(STUB_ARGS_DECLARATION);
+ EncodedJSValue JIT_STUB cti_op_mod(STUB_ARGS_DECLARATION);
+ EncodedJSValue JIT_STUB cti_op_mul(STUB_ARGS_DECLARATION);
+ EncodedJSValue JIT_STUB cti_op_negate(STUB_ARGS_DECLARATION);
+ EncodedJSValue JIT_STUB cti_op_not(STUB_ARGS_DECLARATION);
+ EncodedJSValue JIT_STUB cti_op_nstricteq(STUB_ARGS_DECLARATION);
+ EncodedJSValue JIT_STUB cti_op_post_dec(STUB_ARGS_DECLARATION);
+ EncodedJSValue JIT_STUB cti_op_post_inc(STUB_ARGS_DECLARATION);
+ EncodedJSValue JIT_STUB cti_op_pre_dec(STUB_ARGS_DECLARATION);
+ EncodedJSValue JIT_STUB cti_op_pre_inc(STUB_ARGS_DECLARATION);
+ EncodedJSValue JIT_STUB cti_op_resolve(STUB_ARGS_DECLARATION);
+ EncodedJSValue JIT_STUB cti_op_resolve_base(STUB_ARGS_DECLARATION);
+ EncodedJSValue JIT_STUB cti_op_resolve_base_strict_put(STUB_ARGS_DECLARATION);
+ EncodedJSValue JIT_STUB cti_op_ensure_property_exists(STUB_ARGS_DECLARATION);
+ EncodedJSValue JIT_STUB cti_op_resolve_global(STUB_ARGS_DECLARATION);
+ EncodedJSValue JIT_STUB cti_op_resolve_global_dynamic(STUB_ARGS_DECLARATION);
+ EncodedJSValue JIT_STUB cti_op_resolve_skip(STUB_ARGS_DECLARATION);
+ EncodedJSValue JIT_STUB cti_op_resolve_with_base(STUB_ARGS_DECLARATION);
+ EncodedJSValue JIT_STUB cti_op_rshift(STUB_ARGS_DECLARATION);
+ EncodedJSValue JIT_STUB cti_op_strcat(STUB_ARGS_DECLARATION);
+ EncodedJSValue JIT_STUB cti_op_stricteq(STUB_ARGS_DECLARATION);
+ EncodedJSValue JIT_STUB cti_op_sub(STUB_ARGS_DECLARATION);
+ EncodedJSValue JIT_STUB cti_op_to_jsnumber(STUB_ARGS_DECLARATION);
+ EncodedJSValue JIT_STUB cti_op_to_primitive(STUB_ARGS_DECLARATION);
+ EncodedJSValue JIT_STUB cti_op_typeof(STUB_ARGS_DECLARATION);
+ EncodedJSValue JIT_STUB cti_op_urshift(STUB_ARGS_DECLARATION);
+ EncodedJSValue JIT_STUB cti_to_object(STUB_ARGS_DECLARATION);
+ JSObject* JIT_STUB cti_op_new_array(STUB_ARGS_DECLARATION);
+ JSObject* JIT_STUB cti_op_new_func(STUB_ARGS_DECLARATION);
+ JSObject* JIT_STUB cti_op_new_func_exp(STUB_ARGS_DECLARATION);
+ JSObject* JIT_STUB cti_op_new_object(STUB_ARGS_DECLARATION);
+ JSObject* JIT_STUB cti_op_new_regexp(STUB_ARGS_DECLARATION);
+ JSObject* JIT_STUB cti_op_push_activation(STUB_ARGS_DECLARATION);
+ JSObject* JIT_STUB cti_op_push_new_scope(STUB_ARGS_DECLARATION);
+ JSObject* JIT_STUB cti_op_push_scope(STUB_ARGS_DECLARATION);
+ JSObject* JIT_STUB cti_op_put_by_id_transition_realloc(STUB_ARGS_DECLARATION);
+ JSPropertyNameIterator* JIT_STUB cti_op_get_pnames(STUB_ARGS_DECLARATION);
+ int JIT_STUB cti_op_eq(STUB_ARGS_DECLARATION);
+ int JIT_STUB cti_op_eq_strings(STUB_ARGS_DECLARATION);
+ int JIT_STUB cti_op_jless(STUB_ARGS_DECLARATION);
+ int JIT_STUB cti_op_jlesseq(STUB_ARGS_DECLARATION);
+ int JIT_STUB cti_op_jtrue(STUB_ARGS_DECLARATION);
+ int JIT_STUB cti_op_load_varargs(STUB_ARGS_DECLARATION);
+ int JIT_STUB cti_op_loop_if_lesseq(STUB_ARGS_DECLARATION);
+ int JIT_STUB cti_timeout_check(STUB_ARGS_DECLARATION);
+ int JIT_STUB cti_has_property(STUB_ARGS_DECLARATION);
+ void JIT_STUB cti_op_check_has_instance(STUB_ARGS_DECLARATION);
+ void JIT_STUB cti_op_debug(STUB_ARGS_DECLARATION);
+ void JIT_STUB cti_op_end(STUB_ARGS_DECLARATION);
+ void JIT_STUB cti_op_jmp_scopes(STUB_ARGS_DECLARATION);
+ void JIT_STUB cti_op_pop_scope(STUB_ARGS_DECLARATION);
+ void JIT_STUB cti_op_profile_did_call(STUB_ARGS_DECLARATION);
+ void JIT_STUB cti_op_profile_will_call(STUB_ARGS_DECLARATION);
+ void JIT_STUB cti_op_put_by_id(STUB_ARGS_DECLARATION);
+ void JIT_STUB cti_op_put_by_id_fail(STUB_ARGS_DECLARATION);
+ void JIT_STUB cti_op_put_by_id_generic(STUB_ARGS_DECLARATION);
+ void JIT_STUB cti_op_put_by_id_direct(STUB_ARGS_DECLARATION);
+ void JIT_STUB cti_op_put_by_id_direct_fail(STUB_ARGS_DECLARATION);
+ void JIT_STUB cti_op_put_by_id_direct_generic(STUB_ARGS_DECLARATION);
+ void JIT_STUB cti_op_put_by_index(STUB_ARGS_DECLARATION);
+ void JIT_STUB cti_op_put_by_val(STUB_ARGS_DECLARATION);
+ void JIT_STUB cti_op_put_by_val_byte_array(STUB_ARGS_DECLARATION);
+ void JIT_STUB cti_op_put_getter(STUB_ARGS_DECLARATION);
+ void JIT_STUB cti_op_put_setter(STUB_ARGS_DECLARATION);
+ void JIT_STUB cti_op_ret_scopeChain(STUB_ARGS_DECLARATION);
+ void JIT_STUB cti_op_tear_off_activation(STUB_ARGS_DECLARATION);
+ void JIT_STUB cti_op_tear_off_arguments(STUB_ARGS_DECLARATION);
+ void JIT_STUB cti_op_throw_reference_error(STUB_ARGS_DECLARATION);
+ void JIT_STUB cti_op_throw_syntax_error(STUB_ARGS_DECLARATION);
+ void* JIT_STUB cti_op_call_arityCheck(STUB_ARGS_DECLARATION);
+ void* JIT_STUB cti_op_construct_arityCheck(STUB_ARGS_DECLARATION);
+ void* JIT_STUB cti_op_call_jitCompile(STUB_ARGS_DECLARATION);
+ void* JIT_STUB cti_op_construct_jitCompile(STUB_ARGS_DECLARATION);
+ void* JIT_STUB cti_op_switch_char(STUB_ARGS_DECLARATION);
+ void* JIT_STUB cti_op_switch_imm(STUB_ARGS_DECLARATION);
+ void* JIT_STUB cti_op_switch_string(STUB_ARGS_DECLARATION);
+ void* JIT_STUB cti_op_throw(STUB_ARGS_DECLARATION);
+ void* JIT_STUB cti_register_file_check(STUB_ARGS_DECLARATION);
+ void* JIT_STUB cti_vm_lazyLinkCall(STUB_ARGS_DECLARATION);
+ void* JIT_STUB cti_vm_lazyLinkConstruct(STUB_ARGS_DECLARATION);
+ void* JIT_STUB cti_vm_throw(STUB_ARGS_DECLARATION);
+} // extern "C"
+
+} // namespace JSC
+
+#endif // ENABLE(JIT)
+
+#endif // JITStubs_h
diff --git a/Source/JavaScriptCore/jit/JSInterfaceJIT.h b/Source/JavaScriptCore/jit/JSInterfaceJIT.h
new file mode 100644
index 0000000..6453bab
--- /dev/null
+++ b/Source/JavaScriptCore/jit/JSInterfaceJIT.h
@@ -0,0 +1,292 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef JSInterfaceJIT_h
+#define JSInterfaceJIT_h
+
+#include "JITCode.h"
+#include "JITStubs.h"
+#include "JSImmediate.h"
+#include "MacroAssembler.h"
+#include "RegisterFile.h"
+#include <wtf/AlwaysInline.h>
+#include <wtf/Vector.h>
+
+namespace JSC {
+ class JSInterfaceJIT : public MacroAssembler {
+ public:
+ // NOTES:
+ //
+ // regT0 has two special meanings. The return value from a stub
+ // call will always be in regT0, and by default (unless
+ // a register is specified) emitPutVirtualRegister() will store
+ // the value from regT0.
+ //
+ // regT3 is required to be callee-preserved.
+ //
+ // tempRegister2 is has no such dependencies. It is important that
+ // on x86/x86-64 it is ecx for performance reasons, since the
+ // MacroAssembler will need to plant register swaps if it is not -
+ // however the code will still function correctly.
+#if CPU(X86_64)
+ static const RegisterID returnValueRegister = X86Registers::eax;
+ static const RegisterID cachedResultRegister = X86Registers::eax;
+ static const RegisterID firstArgumentRegister = X86Registers::edi;
+
+ static const RegisterID timeoutCheckRegister = X86Registers::r12;
+ static const RegisterID callFrameRegister = X86Registers::r13;
+ static const RegisterID tagTypeNumberRegister = X86Registers::r14;
+ static const RegisterID tagMaskRegister = X86Registers::r15;
+
+ static const RegisterID regT0 = X86Registers::eax;
+ static const RegisterID regT1 = X86Registers::edx;
+ static const RegisterID regT2 = X86Registers::ecx;
+ static const RegisterID regT3 = X86Registers::ebx;
+
+ static const FPRegisterID fpRegT0 = X86Registers::xmm0;
+ static const FPRegisterID fpRegT1 = X86Registers::xmm1;
+ static const FPRegisterID fpRegT2 = X86Registers::xmm2;
+ static const FPRegisterID fpRegT3 = X86Registers::xmm3;
+#elif CPU(X86)
+ static const RegisterID returnValueRegister = X86Registers::eax;
+ static const RegisterID cachedResultRegister = X86Registers::eax;
+ // On x86 we always use fastcall conventions = but on
+ // OS X if might make more sense to just use regparm.
+ static const RegisterID firstArgumentRegister = X86Registers::ecx;
+
+ static const RegisterID timeoutCheckRegister = X86Registers::esi;
+ static const RegisterID callFrameRegister = X86Registers::edi;
+
+ static const RegisterID regT0 = X86Registers::eax;
+ static const RegisterID regT1 = X86Registers::edx;
+ static const RegisterID regT2 = X86Registers::ecx;
+ static const RegisterID regT3 = X86Registers::ebx;
+
+ static const FPRegisterID fpRegT0 = X86Registers::xmm0;
+ static const FPRegisterID fpRegT1 = X86Registers::xmm1;
+ static const FPRegisterID fpRegT2 = X86Registers::xmm2;
+ static const FPRegisterID fpRegT3 = X86Registers::xmm3;
+#elif CPU(ARM_THUMB2)
+ static const RegisterID returnValueRegister = ARMRegisters::r0;
+ static const RegisterID cachedResultRegister = ARMRegisters::r0;
+ static const RegisterID firstArgumentRegister = ARMRegisters::r0;
+
+ static const RegisterID regT0 = ARMRegisters::r0;
+ static const RegisterID regT1 = ARMRegisters::r1;
+ static const RegisterID regT2 = ARMRegisters::r2;
+ static const RegisterID regT3 = ARMRegisters::r4;
+
+ static const RegisterID callFrameRegister = ARMRegisters::r5;
+ static const RegisterID timeoutCheckRegister = ARMRegisters::r6;
+
+ static const FPRegisterID fpRegT0 = ARMRegisters::d0;
+ static const FPRegisterID fpRegT1 = ARMRegisters::d1;
+ static const FPRegisterID fpRegT2 = ARMRegisters::d2;
+ static const FPRegisterID fpRegT3 = ARMRegisters::d3;
+#elif CPU(ARM_TRADITIONAL)
+ static const RegisterID returnValueRegister = ARMRegisters::r0;
+ static const RegisterID cachedResultRegister = ARMRegisters::r0;
+ static const RegisterID firstArgumentRegister = ARMRegisters::r0;
+
+ static const RegisterID timeoutCheckRegister = ARMRegisters::r5;
+ static const RegisterID callFrameRegister = ARMRegisters::r4;
+
+ static const RegisterID regT0 = ARMRegisters::r0;
+ static const RegisterID regT1 = ARMRegisters::r1;
+ static const RegisterID regT2 = ARMRegisters::r2;
+ // Callee preserved
+ static const RegisterID regT3 = ARMRegisters::r7;
+
+ static const RegisterID regS0 = ARMRegisters::S0;
+ // Callee preserved
+ static const RegisterID regS1 = ARMRegisters::S1;
+
+ static const RegisterID regStackPtr = ARMRegisters::sp;
+ static const RegisterID regLink = ARMRegisters::lr;
+
+ static const FPRegisterID fpRegT0 = ARMRegisters::d0;
+ static const FPRegisterID fpRegT1 = ARMRegisters::d1;
+ static const FPRegisterID fpRegT2 = ARMRegisters::d2;
+ static const FPRegisterID fpRegT3 = ARMRegisters::d3;
+#elif CPU(MIPS)
+ static const RegisterID returnValueRegister = MIPSRegisters::v0;
+ static const RegisterID cachedResultRegister = MIPSRegisters::v0;
+ static const RegisterID firstArgumentRegister = MIPSRegisters::a0;
+
+ // regT0 must be v0 for returning a 32-bit value.
+ static const RegisterID regT0 = MIPSRegisters::v0;
+
+ // regT1 must be v1 for returning a pair of 32-bit value.
+ static const RegisterID regT1 = MIPSRegisters::v1;
+
+ static const RegisterID regT2 = MIPSRegisters::t4;
+
+ // regT3 must be saved in the callee, so use an S register.
+ static const RegisterID regT3 = MIPSRegisters::s2;
+
+ static const RegisterID callFrameRegister = MIPSRegisters::s0;
+ static const RegisterID timeoutCheckRegister = MIPSRegisters::s1;
+
+ static const FPRegisterID fpRegT0 = MIPSRegisters::f4;
+ static const FPRegisterID fpRegT1 = MIPSRegisters::f6;
+ static const FPRegisterID fpRegT2 = MIPSRegisters::f8;
+ static const FPRegisterID fpRegT3 = MIPSRegisters::f10;
+#else
+#error "JIT not supported on this platform."
+#endif
+
+ inline Jump emitLoadJSCell(unsigned virtualRegisterIndex, RegisterID payload);
+ inline Jump emitLoadInt32(unsigned virtualRegisterIndex, RegisterID dst);
+ inline Jump emitLoadDouble(unsigned virtualRegisterIndex, FPRegisterID dst, RegisterID scratch);
+
+#if USE(JSVALUE32_64)
+ inline Jump emitJumpIfNotJSCell(unsigned virtualRegisterIndex);
+ inline Address tagFor(unsigned index, RegisterID base = callFrameRegister);
+#endif
+
+#if USE(JSVALUE64)
+ Jump emitJumpIfImmediateNumber(RegisterID reg);
+ Jump emitJumpIfNotImmediateNumber(RegisterID reg);
+ void emitFastArithImmToInt(RegisterID reg);
+#endif
+
+ inline Address payloadFor(unsigned index, RegisterID base = callFrameRegister);
+ inline Address addressFor(unsigned index, RegisterID base = callFrameRegister);
+ };
+
+ struct ThunkHelpers {
+ static unsigned stringImplDataOffset() { return StringImpl::dataOffset(); }
+ static unsigned jsStringLengthOffset() { return OBJECT_OFFSETOF(JSString, m_length); }
+ static unsigned jsStringValueOffset() { return OBJECT_OFFSETOF(JSString, m_value); }
+ };
+
+#if USE(JSVALUE32_64)
+ inline JSInterfaceJIT::Jump JSInterfaceJIT::emitLoadJSCell(unsigned virtualRegisterIndex, RegisterID payload)
+ {
+ loadPtr(payloadFor(virtualRegisterIndex), payload);
+ return emitJumpIfNotJSCell(virtualRegisterIndex);
+ }
+
+ inline JSInterfaceJIT::Jump JSInterfaceJIT::emitJumpIfNotJSCell(unsigned virtualRegisterIndex)
+ {
+ ASSERT(static_cast<int>(virtualRegisterIndex) < FirstConstantRegisterIndex);
+ return branch32(NotEqual, tagFor(virtualRegisterIndex), Imm32(JSValue::CellTag));
+ }
+
+ inline JSInterfaceJIT::Jump JSInterfaceJIT::emitLoadInt32(unsigned virtualRegisterIndex, RegisterID dst)
+ {
+ ASSERT(static_cast<int>(virtualRegisterIndex) < FirstConstantRegisterIndex);
+ loadPtr(payloadFor(virtualRegisterIndex), dst);
+ return branch32(NotEqual, tagFor(virtualRegisterIndex), Imm32(JSValue::Int32Tag));
+ }
+
+ inline JSInterfaceJIT::Address JSInterfaceJIT::tagFor(unsigned virtualRegisterIndex, RegisterID base)
+ {
+ ASSERT(static_cast<int>(virtualRegisterIndex) < FirstConstantRegisterIndex);
+ return Address(base, (virtualRegisterIndex * sizeof(Register)) + OBJECT_OFFSETOF(JSValue, u.asBits.tag));
+ }
+
+ inline JSInterfaceJIT::Address JSInterfaceJIT::payloadFor(unsigned virtualRegisterIndex, RegisterID base)
+ {
+ ASSERT(static_cast<int>(virtualRegisterIndex) < FirstConstantRegisterIndex);
+ return Address(base, (virtualRegisterIndex * sizeof(Register)) + OBJECT_OFFSETOF(JSValue, u.asBits.payload));
+ }
+
+ inline JSInterfaceJIT::Jump JSInterfaceJIT::emitLoadDouble(unsigned virtualRegisterIndex, FPRegisterID dst, RegisterID scratch)
+ {
+ ASSERT(static_cast<int>(virtualRegisterIndex) < FirstConstantRegisterIndex);
+ loadPtr(tagFor(virtualRegisterIndex), scratch);
+ Jump isDouble = branch32(Below, scratch, Imm32(JSValue::LowestTag));
+ Jump notInt = branch32(NotEqual, scratch, Imm32(JSValue::Int32Tag));
+ loadPtr(payloadFor(virtualRegisterIndex), scratch);
+ convertInt32ToDouble(scratch, dst);
+ Jump done = jump();
+ isDouble.link(this);
+ loadDouble(addressFor(virtualRegisterIndex), dst);
+ done.link(this);
+ return notInt;
+ }
+#endif
+
+#if USE(JSVALUE64)
+ ALWAYS_INLINE JSInterfaceJIT::Jump JSInterfaceJIT::emitJumpIfImmediateNumber(RegisterID reg)
+ {
+ return branchTestPtr(NonZero, reg, tagTypeNumberRegister);
+ }
+ ALWAYS_INLINE JSInterfaceJIT::Jump JSInterfaceJIT::emitJumpIfNotImmediateNumber(RegisterID reg)
+ {
+ return branchTestPtr(Zero, reg, tagTypeNumberRegister);
+ }
+ inline JSInterfaceJIT::Jump JSInterfaceJIT::emitLoadJSCell(unsigned virtualRegisterIndex, RegisterID dst)
+ {
+ loadPtr(addressFor(virtualRegisterIndex), dst);
+ return branchTestPtr(NonZero, dst, tagMaskRegister);
+ }
+
+ inline JSInterfaceJIT::Jump JSInterfaceJIT::emitLoadInt32(unsigned virtualRegisterIndex, RegisterID dst)
+ {
+ loadPtr(addressFor(virtualRegisterIndex), dst);
+ Jump result = branchPtr(Below, dst, tagTypeNumberRegister);
+ zeroExtend32ToPtr(dst, dst);
+ return result;
+ }
+
+ inline JSInterfaceJIT::Jump JSInterfaceJIT::emitLoadDouble(unsigned virtualRegisterIndex, FPRegisterID dst, RegisterID scratch)
+ {
+ loadPtr(addressFor(virtualRegisterIndex), scratch);
+ Jump notNumber = emitJumpIfNotImmediateNumber(scratch);
+ Jump notInt = branchPtr(Below, scratch, tagTypeNumberRegister);
+ convertInt32ToDouble(scratch, dst);
+ Jump done = jump();
+ notInt.link(this);
+ addPtr(tagTypeNumberRegister, scratch);
+ movePtrToDouble(scratch, dst);
+ done.link(this);
+ return notNumber;
+ }
+
+ ALWAYS_INLINE void JSInterfaceJIT::emitFastArithImmToInt(RegisterID)
+ {
+ }
+
+#endif
+
+#if USE(JSVALUE64)
+ inline JSInterfaceJIT::Address JSInterfaceJIT::payloadFor(unsigned virtualRegisterIndex, RegisterID base)
+ {
+ ASSERT(static_cast<int>(virtualRegisterIndex) < FirstConstantRegisterIndex);
+ return addressFor(virtualRegisterIndex, base);
+ }
+#endif
+
+ inline JSInterfaceJIT::Address JSInterfaceJIT::addressFor(unsigned virtualRegisterIndex, RegisterID base)
+ {
+ ASSERT(static_cast<int>(virtualRegisterIndex) < FirstConstantRegisterIndex);
+ return Address(base, (virtualRegisterIndex * sizeof(Register)));
+ }
+
+}
+
+#endif // JSInterfaceJIT_h
diff --git a/Source/JavaScriptCore/jit/SpecializedThunkJIT.h b/Source/JavaScriptCore/jit/SpecializedThunkJIT.h
new file mode 100644
index 0000000..5c593d9
--- /dev/null
+++ b/Source/JavaScriptCore/jit/SpecializedThunkJIT.h
@@ -0,0 +1,165 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SpecializedThunkJIT_h
+#define SpecializedThunkJIT_h
+
+#if ENABLE(JIT)
+
+#include "Executable.h"
+#include "JSInterfaceJIT.h"
+#include "LinkBuffer.h"
+
+namespace JSC {
+
+ class SpecializedThunkJIT : public JSInterfaceJIT {
+ public:
+ static const int ThisArgument = -1;
+ SpecializedThunkJIT(int expectedArgCount, JSGlobalData* globalData, ExecutablePool* pool)
+ : m_expectedArgCount(expectedArgCount)
+ , m_globalData(globalData)
+ , m_pool(pool)
+ {
+ // Check that we have the expected number of arguments
+ m_failures.append(branch32(NotEqual, Address(callFrameRegister, RegisterFile::ArgumentCount * (int)sizeof(Register)), Imm32(expectedArgCount + 1)));
+ }
+
+ void loadDoubleArgument(int argument, FPRegisterID dst, RegisterID scratch)
+ {
+ unsigned src = argumentToVirtualRegister(argument);
+ m_failures.append(emitLoadDouble(src, dst, scratch));
+ }
+
+ void loadCellArgument(int argument, RegisterID dst)
+ {
+ unsigned src = argumentToVirtualRegister(argument);
+ m_failures.append(emitLoadJSCell(src, dst));
+ }
+
+ void loadJSStringArgument(int argument, RegisterID dst)
+ {
+ loadCellArgument(argument, dst);
+ m_failures.append(branchPtr(NotEqual, Address(dst, 0), ImmPtr(m_globalData->jsStringVPtr)));
+ m_failures.append(branchTest32(NonZero, Address(dst, OBJECT_OFFSETOF(JSString, m_fiberCount))));
+ }
+
+ void loadInt32Argument(int argument, RegisterID dst, Jump& failTarget)
+ {
+ unsigned src = argumentToVirtualRegister(argument);
+ failTarget = emitLoadInt32(src, dst);
+ }
+
+ void loadInt32Argument(int argument, RegisterID dst)
+ {
+ Jump conversionFailed;
+ loadInt32Argument(argument, dst, conversionFailed);
+ m_failures.append(conversionFailed);
+ }
+
+ void appendFailure(const Jump& failure)
+ {
+ m_failures.append(failure);
+ }
+
+ void returnJSValue(RegisterID src)
+ {
+ if (src != regT0)
+ move(src, regT0);
+ loadPtr(Address(callFrameRegister, RegisterFile::CallerFrame * (int)sizeof(Register)), callFrameRegister);
+ ret();
+ }
+
+ void returnDouble(FPRegisterID src)
+ {
+#if USE(JSVALUE64)
+ moveDoubleToPtr(src, regT0);
+ subPtr(tagTypeNumberRegister, regT0);
+#else
+ storeDouble(src, Address(stackPointerRegister, -(int)sizeof(double)));
+ loadPtr(Address(stackPointerRegister, OBJECT_OFFSETOF(JSValue, u.asBits.tag) - sizeof(double)), regT1);
+ loadPtr(Address(stackPointerRegister, OBJECT_OFFSETOF(JSValue, u.asBits.payload) - sizeof(double)), regT0);
+#endif
+ loadPtr(Address(callFrameRegister, RegisterFile::CallerFrame * (int)sizeof(Register)), callFrameRegister);
+ ret();
+ }
+
+ void returnInt32(RegisterID src)
+ {
+ if (src != regT0)
+ move(src, regT0);
+ tagReturnAsInt32();
+ loadPtr(Address(callFrameRegister, RegisterFile::CallerFrame * (int)sizeof(Register)), callFrameRegister);
+ ret();
+ }
+
+ void returnJSCell(RegisterID src)
+ {
+ if (src != regT0)
+ move(src, regT0);
+ tagReturnAsJSCell();
+ loadPtr(Address(callFrameRegister, RegisterFile::CallerFrame * (int)sizeof(Register)), callFrameRegister);
+ ret();
+ }
+
+ MacroAssemblerCodePtr finalize(MacroAssemblerCodePtr fallback)
+ {
+ LinkBuffer patchBuffer(this, m_pool.get(), 0);
+ patchBuffer.link(m_failures, CodeLocationLabel(fallback));
+ return patchBuffer.finalizeCode().m_code;
+ }
+
+ private:
+ int argumentToVirtualRegister(unsigned argument)
+ {
+ return -static_cast<int>(RegisterFile::CallFrameHeaderSize + (m_expectedArgCount - argument));
+ }
+
+ void tagReturnAsInt32()
+ {
+#if USE(JSVALUE64)
+ orPtr(tagTypeNumberRegister, regT0);
+#else
+ move(Imm32(JSValue::Int32Tag), regT1);
+#endif
+ }
+
+ void tagReturnAsJSCell()
+ {
+#if USE(JSVALUE32_64)
+ move(Imm32(JSValue::CellTag), regT1);
+#endif
+ }
+
+ int m_expectedArgCount;
+ JSGlobalData* m_globalData;
+ RefPtr<ExecutablePool> m_pool;
+ MacroAssembler::JumpList m_failures;
+ };
+
+}
+
+#endif // ENABLE(JIT)
+
+#endif // SpecializedThunkJIT_h
diff --git a/Source/JavaScriptCore/jit/ThunkGenerators.cpp b/Source/JavaScriptCore/jit/ThunkGenerators.cpp
new file mode 100644
index 0000000..9b40f12
--- /dev/null
+++ b/Source/JavaScriptCore/jit/ThunkGenerators.cpp
@@ -0,0 +1,162 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "ThunkGenerators.h"
+
+#include "CodeBlock.h"
+#include <wtf/text/StringImpl.h>
+#include "SpecializedThunkJIT.h"
+
+#if ENABLE(JIT)
+
+namespace JSC {
+
+static void stringCharLoad(SpecializedThunkJIT& jit)
+{
+ // load string
+ jit.loadJSStringArgument(SpecializedThunkJIT::ThisArgument, SpecializedThunkJIT::regT0);
+ // regT0 now contains this, and is a non-rope JSString*
+
+ // Load string length to regT2, and start the process of loading the data pointer into regT0
+ jit.load32(MacroAssembler::Address(SpecializedThunkJIT::regT0, ThunkHelpers::jsStringLengthOffset()), SpecializedThunkJIT::regT2);
+ jit.loadPtr(MacroAssembler::Address(SpecializedThunkJIT::regT0, ThunkHelpers::jsStringValueOffset()), SpecializedThunkJIT::regT0);
+ jit.loadPtr(MacroAssembler::Address(SpecializedThunkJIT::regT0, ThunkHelpers::stringImplDataOffset()), SpecializedThunkJIT::regT0);
+
+ // load index
+ jit.loadInt32Argument(0, SpecializedThunkJIT::regT1); // regT1 contains the index
+
+ // Do an unsigned compare to simultaneously filter negative indices as well as indices that are too large
+ jit.appendFailure(jit.branch32(MacroAssembler::AboveOrEqual, SpecializedThunkJIT::regT1, SpecializedThunkJIT::regT2));
+
+ // Load the character
+ jit.load16(MacroAssembler::BaseIndex(SpecializedThunkJIT::regT0, SpecializedThunkJIT::regT1, MacroAssembler::TimesTwo, 0), SpecializedThunkJIT::regT0);
+}
+
+static void charToString(SpecializedThunkJIT& jit, JSGlobalData* globalData, MacroAssembler::RegisterID src, MacroAssembler::RegisterID dst, MacroAssembler::RegisterID scratch)
+{
+ jit.appendFailure(jit.branch32(MacroAssembler::AboveOrEqual, src, MacroAssembler::Imm32(0x100)));
+ jit.move(MacroAssembler::ImmPtr(globalData->smallStrings.singleCharacterStrings()), scratch);
+ jit.loadPtr(MacroAssembler::BaseIndex(scratch, src, MacroAssembler::ScalePtr, 0), dst);
+ jit.appendFailure(jit.branchTestPtr(MacroAssembler::Zero, dst));
+}
+
+MacroAssemblerCodePtr charCodeAtThunkGenerator(JSGlobalData* globalData, ExecutablePool* pool)
+{
+ SpecializedThunkJIT jit(1, globalData, pool);
+ stringCharLoad(jit);
+ jit.returnInt32(SpecializedThunkJIT::regT0);
+ return jit.finalize(globalData->jitStubs->ctiNativeCall());
+}
+
+MacroAssemblerCodePtr charAtThunkGenerator(JSGlobalData* globalData, ExecutablePool* pool)
+{
+ SpecializedThunkJIT jit(1, globalData, pool);
+ stringCharLoad(jit);
+ charToString(jit, globalData, SpecializedThunkJIT::regT0, SpecializedThunkJIT::regT0, SpecializedThunkJIT::regT1);
+ jit.returnJSCell(SpecializedThunkJIT::regT0);
+ return jit.finalize(globalData->jitStubs->ctiNativeCall());
+}
+
+MacroAssemblerCodePtr fromCharCodeThunkGenerator(JSGlobalData* globalData, ExecutablePool* pool)
+{
+ SpecializedThunkJIT jit(1, globalData, pool);
+ // load char code
+ jit.loadInt32Argument(0, SpecializedThunkJIT::regT0);
+ charToString(jit, globalData, SpecializedThunkJIT::regT0, SpecializedThunkJIT::regT0, SpecializedThunkJIT::regT1);
+ jit.returnJSCell(SpecializedThunkJIT::regT0);
+ return jit.finalize(globalData->jitStubs->ctiNativeCall());
+}
+
+MacroAssemblerCodePtr sqrtThunkGenerator(JSGlobalData* globalData, ExecutablePool* pool)
+{
+ SpecializedThunkJIT jit(1, globalData, pool);
+ if (!jit.supportsFloatingPointSqrt())
+ return globalData->jitStubs->ctiNativeCall();
+
+ jit.loadDoubleArgument(0, SpecializedThunkJIT::fpRegT0, SpecializedThunkJIT::regT0);
+ jit.sqrtDouble(SpecializedThunkJIT::fpRegT0, SpecializedThunkJIT::fpRegT0);
+ jit.returnDouble(SpecializedThunkJIT::fpRegT0);
+ return jit.finalize(globalData->jitStubs->ctiNativeCall());
+}
+
+static const double oneConstant = 1.0;
+static const double negativeHalfConstant = -0.5;
+
+MacroAssemblerCodePtr powThunkGenerator(JSGlobalData* globalData, ExecutablePool* pool)
+{
+ SpecializedThunkJIT jit(2, globalData, pool);
+ if (!jit.supportsFloatingPoint())
+ return globalData->jitStubs->ctiNativeCall();
+
+ jit.loadDouble(&oneConstant, SpecializedThunkJIT::fpRegT1);
+ jit.loadDoubleArgument(0, SpecializedThunkJIT::fpRegT0, SpecializedThunkJIT::regT0);
+ MacroAssembler::Jump nonIntExponent;
+ jit.loadInt32Argument(1, SpecializedThunkJIT::regT0, nonIntExponent);
+ jit.appendFailure(jit.branch32(MacroAssembler::LessThan, SpecializedThunkJIT::regT0, MacroAssembler::Imm32(0)));
+
+ MacroAssembler::Jump exponentIsZero = jit.branchTest32(MacroAssembler::Zero, SpecializedThunkJIT::regT0);
+ MacroAssembler::Label startLoop(jit.label());
+
+ MacroAssembler::Jump exponentIsEven = jit.branchTest32(MacroAssembler::Zero, SpecializedThunkJIT::regT0, MacroAssembler::Imm32(1));
+ jit.mulDouble(SpecializedThunkJIT::fpRegT0, SpecializedThunkJIT::fpRegT1);
+ exponentIsEven.link(&jit);
+ jit.mulDouble(SpecializedThunkJIT::fpRegT0, SpecializedThunkJIT::fpRegT0);
+ jit.rshift32(MacroAssembler::Imm32(1), SpecializedThunkJIT::regT0);
+ jit.branchTest32(MacroAssembler::NonZero, SpecializedThunkJIT::regT0).linkTo(startLoop, &jit);
+
+ exponentIsZero.link(&jit);
+
+ {
+ SpecializedThunkJIT::JumpList doubleResult;
+ jit.branchConvertDoubleToInt32(SpecializedThunkJIT::fpRegT1, SpecializedThunkJIT::regT0, doubleResult, SpecializedThunkJIT::fpRegT0);
+ jit.returnInt32(SpecializedThunkJIT::regT0);
+ doubleResult.link(&jit);
+ jit.returnDouble(SpecializedThunkJIT::fpRegT1);
+ }
+
+ if (jit.supportsFloatingPointSqrt()) {
+ nonIntExponent.link(&jit);
+ jit.loadDouble(&negativeHalfConstant, SpecializedThunkJIT::fpRegT3);
+ jit.loadDoubleArgument(1, SpecializedThunkJIT::fpRegT2, SpecializedThunkJIT::regT0);
+ jit.appendFailure(jit.branchDouble(MacroAssembler::DoubleLessThanOrEqual, SpecializedThunkJIT::fpRegT0, SpecializedThunkJIT::fpRegT1));
+ jit.appendFailure(jit.branchDouble(MacroAssembler::DoubleNotEqualOrUnordered, SpecializedThunkJIT::fpRegT2, SpecializedThunkJIT::fpRegT3));
+ jit.sqrtDouble(SpecializedThunkJIT::fpRegT0, SpecializedThunkJIT::fpRegT0);
+ jit.divDouble(SpecializedThunkJIT::fpRegT0, SpecializedThunkJIT::fpRegT1);
+
+ SpecializedThunkJIT::JumpList doubleResult;
+ jit.branchConvertDoubleToInt32(SpecializedThunkJIT::fpRegT1, SpecializedThunkJIT::regT0, doubleResult, SpecializedThunkJIT::fpRegT0);
+ jit.returnInt32(SpecializedThunkJIT::regT0);
+ doubleResult.link(&jit);
+ jit.returnDouble(SpecializedThunkJIT::fpRegT1);
+ } else
+ jit.appendFailure(nonIntExponent);
+
+ return jit.finalize(globalData->jitStubs->ctiNativeCall());
+}
+
+}
+
+#endif // ENABLE(JIT)
diff --git a/Source/JavaScriptCore/jit/ThunkGenerators.h b/Source/JavaScriptCore/jit/ThunkGenerators.h
new file mode 100644
index 0000000..15261f7
--- /dev/null
+++ b/Source/JavaScriptCore/jit/ThunkGenerators.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ThunkGenerators_h
+#define ThunkGenerators_h
+
+#if ENABLE(JIT)
+namespace JSC {
+ class ExecutablePool;
+ class JSGlobalData;
+ class NativeExecutable;
+ class MacroAssemblerCodePtr;
+
+ typedef MacroAssemblerCodePtr (*ThunkGenerator)(JSGlobalData*, ExecutablePool*);
+ MacroAssemblerCodePtr charCodeAtThunkGenerator(JSGlobalData*, ExecutablePool*);
+ MacroAssemblerCodePtr charAtThunkGenerator(JSGlobalData*, ExecutablePool*);
+ MacroAssemblerCodePtr fromCharCodeThunkGenerator(JSGlobalData*, ExecutablePool*);
+ MacroAssemblerCodePtr sqrtThunkGenerator(JSGlobalData*, ExecutablePool*);
+ MacroAssemblerCodePtr powThunkGenerator(JSGlobalData*, ExecutablePool*);
+}
+#endif
+
+#endif // ThunkGenerator_h
diff --git a/Source/JavaScriptCore/jsc.cpp b/Source/JavaScriptCore/jsc.cpp
new file mode 100644
index 0000000..dd4b677
--- /dev/null
+++ b/Source/JavaScriptCore/jsc.cpp
@@ -0,0 +1,568 @@
+/*
+ * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2006 Bjoern Graf (bjoern.graf@gmail.com)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+
+#include "BytecodeGenerator.h"
+#include "Completion.h"
+#include "CurrentTime.h"
+#include "ExceptionHelpers.h"
+#include "InitializeThreading.h"
+#include "JSArray.h"
+#include "JSFunction.h"
+#include "JSLock.h"
+#include "JSString.h"
+#include "PrototypeFunction.h"
+#include "SamplingTool.h"
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !OS(WINDOWS)
+#include <unistd.h>
+#endif
+
+#if HAVE(READLINE)
+#include <readline/history.h>
+#include <readline/readline.h>
+#endif
+
+#if HAVE(SYS_TIME_H)
+#include <sys/time.h>
+#endif
+
+#if HAVE(SIGNAL_H)
+#include <signal.h>
+#endif
+
+#if COMPILER(MSVC) && !OS(WINCE)
+#include <crtdbg.h>
+#include <mmsystem.h>
+#include <windows.h>
+#endif
+
+#if PLATFORM(QT)
+#include <QCoreApplication>
+#include <QDateTime>
+#endif
+
+using namespace JSC;
+using namespace WTF;
+
+static void cleanupGlobalData(JSGlobalData*);
+static bool fillBufferWithContentsOfFile(const UString& fileName, Vector<char>& buffer);
+
+static EncodedJSValue JSC_HOST_CALL functionPrint(ExecState*);
+static EncodedJSValue JSC_HOST_CALL functionDebug(ExecState*);
+static EncodedJSValue JSC_HOST_CALL functionGC(ExecState*);
+static EncodedJSValue JSC_HOST_CALL functionVersion(ExecState*);
+static EncodedJSValue JSC_HOST_CALL functionRun(ExecState*);
+static EncodedJSValue JSC_HOST_CALL functionLoad(ExecState*);
+static EncodedJSValue JSC_HOST_CALL functionCheckSyntax(ExecState*);
+static EncodedJSValue JSC_HOST_CALL functionReadline(ExecState*);
+static NO_RETURN_WITH_VALUE EncodedJSValue JSC_HOST_CALL functionQuit(ExecState*);
+
+#if ENABLE(SAMPLING_FLAGS)
+static EncodedJSValue JSC_HOST_CALL functionSetSamplingFlags(ExecState*);
+static EncodedJSValue JSC_HOST_CALL functionClearSamplingFlags(ExecState*);
+#endif
+
+struct Script {
+ bool isFile;
+ char* argument;
+
+ Script(bool isFile, char *argument)
+ : isFile(isFile)
+ , argument(argument)
+ {
+ }
+};
+
+struct Options {
+ Options()
+ : interactive(false)
+ , dump(false)
+ {
+ }
+
+ bool interactive;
+ bool dump;
+ Vector<Script> scripts;
+ Vector<UString> arguments;
+};
+
+static const char interactivePrompt[] = "> ";
+static const UString interpreterName("Interpreter");
+
+class StopWatch {
+public:
+ void start();
+ void stop();
+ long getElapsedMS(); // call stop() first
+
+private:
+ double m_startTime;
+ double m_stopTime;
+};
+
+void StopWatch::start()
+{
+ m_startTime = currentTime();
+}
+
+void StopWatch::stop()
+{
+ m_stopTime = currentTime();
+}
+
+long StopWatch::getElapsedMS()
+{
+ return static_cast<long>((m_stopTime - m_startTime) * 1000);
+}
+
+class GlobalObject : public JSGlobalObject {
+public:
+ GlobalObject(const Vector<UString>& arguments);
+ virtual UString className() const { return "global"; }
+};
+COMPILE_ASSERT(!IsInteger<GlobalObject>::value, WTF_IsInteger_GlobalObject_false);
+ASSERT_CLASS_FITS_IN_CELL(GlobalObject);
+
+GlobalObject::GlobalObject(const Vector<UString>& arguments)
+ : JSGlobalObject()
+{
+ putDirectFunction(globalExec(), new (globalExec()) NativeFunctionWrapper(globalExec(), this, prototypeFunctionStructure(), 1, Identifier(globalExec(), "debug"), functionDebug));
+ putDirectFunction(globalExec(), new (globalExec()) NativeFunctionWrapper(globalExec(), this, prototypeFunctionStructure(), 1, Identifier(globalExec(), "print"), functionPrint));
+ putDirectFunction(globalExec(), new (globalExec()) NativeFunctionWrapper(globalExec(), this, prototypeFunctionStructure(), 0, Identifier(globalExec(), "quit"), functionQuit));
+ putDirectFunction(globalExec(), new (globalExec()) NativeFunctionWrapper(globalExec(), this, prototypeFunctionStructure(), 0, Identifier(globalExec(), "gc"), functionGC));
+ putDirectFunction(globalExec(), new (globalExec()) NativeFunctionWrapper(globalExec(), this, prototypeFunctionStructure(), 1, Identifier(globalExec(), "version"), functionVersion));
+ putDirectFunction(globalExec(), new (globalExec()) NativeFunctionWrapper(globalExec(), this, prototypeFunctionStructure(), 1, Identifier(globalExec(), "run"), functionRun));
+ putDirectFunction(globalExec(), new (globalExec()) NativeFunctionWrapper(globalExec(), this, prototypeFunctionStructure(), 1, Identifier(globalExec(), "load"), functionLoad));
+ putDirectFunction(globalExec(), new (globalExec()) NativeFunctionWrapper(globalExec(), this, prototypeFunctionStructure(), 1, Identifier(globalExec(), "checkSyntax"), functionCheckSyntax));
+ putDirectFunction(globalExec(), new (globalExec()) NativeFunctionWrapper(globalExec(), this, prototypeFunctionStructure(), 0, Identifier(globalExec(), "readline"), functionReadline));
+
+#if ENABLE(SAMPLING_FLAGS)
+ putDirectFunction(globalExec(), new (globalExec()) NativeFunctionWrapper(globalExec(), this, prototypeFunctionStructure(), 1, Identifier(globalExec(), "setSamplingFlags"), functionSetSamplingFlags));
+ putDirectFunction(globalExec(), new (globalExec()) NativeFunctionWrapper(globalExec(), this, prototypeFunctionStructure(), 1, Identifier(globalExec(), "clearSamplingFlags"), functionClearSamplingFlags));
+#endif
+
+ JSObject* array = constructEmptyArray(globalExec());
+ for (size_t i = 0; i < arguments.size(); ++i)
+ array->put(globalExec(), i, jsString(globalExec(), arguments[i]));
+ putDirect(Identifier(globalExec(), "arguments"), array);
+}
+
+EncodedJSValue JSC_HOST_CALL functionPrint(ExecState* exec)
+{
+ for (unsigned i = 0; i < exec->argumentCount(); ++i) {
+ if (i)
+ putchar(' ');
+
+ printf("%s", exec->argument(i).toString(exec).utf8().data());
+ }
+
+ putchar('\n');
+ fflush(stdout);
+ return JSValue::encode(jsUndefined());
+}
+
+EncodedJSValue JSC_HOST_CALL functionDebug(ExecState* exec)
+{
+ fprintf(stderr, "--> %s\n", exec->argument(0).toString(exec).utf8().data());
+ return JSValue::encode(jsUndefined());
+}
+
+EncodedJSValue JSC_HOST_CALL functionGC(ExecState* exec)
+{
+ JSLock lock(SilenceAssertionsOnly);
+ exec->heap()->collectAllGarbage();
+ return JSValue::encode(jsUndefined());
+}
+
+EncodedJSValue JSC_HOST_CALL functionVersion(ExecState*)
+{
+ // We need this function for compatibility with the Mozilla JS tests but for now
+ // we don't actually do any version-specific handling
+ return JSValue::encode(jsUndefined());
+}
+
+EncodedJSValue JSC_HOST_CALL functionRun(ExecState* exec)
+{
+ UString fileName = exec->argument(0).toString(exec);
+ Vector<char> script;
+ if (!fillBufferWithContentsOfFile(fileName, script))
+ return JSValue::encode(throwError(exec, createError(exec, "Could not open file.")));
+
+ GlobalObject* globalObject = new (&exec->globalData()) GlobalObject(Vector<UString>());
+
+ StopWatch stopWatch;
+ stopWatch.start();
+ evaluate(globalObject->globalExec(), globalObject->globalScopeChain(), makeSource(script.data(), fileName));
+ stopWatch.stop();
+
+ return JSValue::encode(jsNumber(stopWatch.getElapsedMS()));
+}
+
+EncodedJSValue JSC_HOST_CALL functionLoad(ExecState* exec)
+{
+ UString fileName = exec->argument(0).toString(exec);
+ Vector<char> script;
+ if (!fillBufferWithContentsOfFile(fileName, script))
+ return JSValue::encode(throwError(exec, createError(exec, "Could not open file.")));
+
+ JSGlobalObject* globalObject = exec->lexicalGlobalObject();
+ Completion result = evaluate(globalObject->globalExec(), globalObject->globalScopeChain(), makeSource(script.data(), fileName));
+ if (result.complType() == Throw)
+ throwError(exec, result.value());
+ return JSValue::encode(result.value());
+}
+
+EncodedJSValue JSC_HOST_CALL functionCheckSyntax(ExecState* exec)
+{
+ UString fileName = exec->argument(0).toString(exec);
+ Vector<char> script;
+ if (!fillBufferWithContentsOfFile(fileName, script))
+ return JSValue::encode(throwError(exec, createError(exec, "Could not open file.")));
+
+ JSGlobalObject* globalObject = exec->lexicalGlobalObject();
+
+ StopWatch stopWatch;
+ stopWatch.start();
+ Completion result = checkSyntax(globalObject->globalExec(), makeSource(script.data(), fileName));
+ stopWatch.stop();
+
+ if (result.complType() == Throw)
+ throwError(exec, result.value());
+ return JSValue::encode(jsNumber(stopWatch.getElapsedMS()));
+}
+
+#if ENABLE(SAMPLING_FLAGS)
+EncodedJSValue JSC_HOST_CALL functionSetSamplingFlags(ExecState* exec)
+{
+ for (unsigned i = 0; i < exec->argumentCount(); ++i) {
+ unsigned flag = static_cast<unsigned>(exec->argument(i).toNumber(exec));
+ if ((flag >= 1) && (flag <= 32))
+ SamplingFlags::setFlag(flag);
+ }
+ return JSValue::encode(jsNull());
+}
+
+EncodedJSValue JSC_HOST_CALL functionClearSamplingFlags(ExecState* exec)
+{
+ for (unsigned i = 0; i < exec->argumentCount(); ++i) {
+ unsigned flag = static_cast<unsigned>(exec->argument(i).toNumber(exec));
+ if ((flag >= 1) && (flag <= 32))
+ SamplingFlags::clearFlag(flag);
+ }
+ return JSValue::encode(jsNull());
+}
+#endif
+
+EncodedJSValue JSC_HOST_CALL functionReadline(ExecState* exec)
+{
+ Vector<char, 256> line;
+ int c;
+ while ((c = getchar()) != EOF) {
+ // FIXME: Should we also break on \r?
+ if (c == '\n')
+ break;
+ line.append(c);
+ }
+ line.append('\0');
+ return JSValue::encode(jsString(exec, line.data()));
+}
+
+EncodedJSValue JSC_HOST_CALL functionQuit(ExecState* exec)
+{
+ // Technically, destroying the heap in the middle of JS execution is a no-no,
+ // but we want to maintain compatibility with the Mozilla test suite, so
+ // we pretend that execution has terminated to avoid ASSERTs, then tear down the heap.
+ exec->globalData().dynamicGlobalObject = 0;
+
+ cleanupGlobalData(&exec->globalData());
+ exit(EXIT_SUCCESS);
+
+#if COMPILER(MSVC) && OS(WINCE)
+ // Without this, Visual Studio will complain that this method does not return a value.
+ return JSValue::encode(jsUndefined());
+#endif
+}
+
+// Use SEH for Release builds only to get rid of the crash report dialog
+// (luckily the same tests fail in Release and Debug builds so far). Need to
+// be in a separate main function because the jscmain function requires object
+// unwinding.
+
+#if COMPILER(MSVC) && !defined(_DEBUG) && !OS(WINCE)
+#define TRY __try {
+#define EXCEPT(x) } __except (EXCEPTION_EXECUTE_HANDLER) { x; }
+#else
+#define TRY
+#define EXCEPT(x)
+#endif
+
+int jscmain(int argc, char** argv, JSGlobalData*);
+
+int main(int argc, char** argv)
+{
+#if defined(_DEBUG) && OS(WINDOWS)
+ _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
+ _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
+ _CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR);
+ _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE);
+ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);
+ _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE);
+#endif
+
+#if COMPILER(MSVC) && !OS(WINCE)
+ timeBeginPeriod(1);
+#endif
+
+#if PLATFORM(QT)
+ QCoreApplication app(argc, argv);
+#endif
+
+ // Initialize JSC before getting JSGlobalData.
+ JSC::initializeThreading();
+
+ // We can't use destructors in the following code because it uses Windows
+ // Structured Exception Handling
+ int res = 0;
+ JSGlobalData* globalData = JSGlobalData::create(ThreadStackTypeLarge).leakRef();
+ TRY
+ res = jscmain(argc, argv, globalData);
+ EXCEPT(res = 3)
+
+ cleanupGlobalData(globalData);
+ return res;
+}
+
+static void cleanupGlobalData(JSGlobalData* globalData)
+{
+ JSLock lock(SilenceAssertionsOnly);
+ globalData->heap.destroy();
+ globalData->deref();
+}
+
+static bool runWithScripts(GlobalObject* globalObject, const Vector<Script>& scripts, bool dump)
+{
+ UString script;
+ UString fileName;
+ Vector<char> scriptBuffer;
+
+ if (dump)
+ BytecodeGenerator::setDumpsGeneratedCode(true);
+
+ JSGlobalData& globalData = globalObject->globalData();
+
+#if ENABLE(SAMPLING_FLAGS)
+ SamplingFlags::start();
+#endif
+
+ bool success = true;
+ for (size_t i = 0; i < scripts.size(); i++) {
+ if (scripts[i].isFile) {
+ fileName = scripts[i].argument;
+ if (!fillBufferWithContentsOfFile(fileName, scriptBuffer))
+ return false; // fail early so we can catch missing files
+ script = scriptBuffer.data();
+ } else {
+ script = scripts[i].argument;
+ fileName = "[Command Line]";
+ }
+
+ globalData.startSampling();
+
+ Completion completion = evaluate(globalObject->globalExec(), globalObject->globalScopeChain(), makeSource(script, fileName));
+ success = success && completion.complType() != Throw;
+ if (dump) {
+ if (completion.complType() == Throw)
+ printf("Exception: %s\n", completion.value().toString(globalObject->globalExec()).utf8().data());
+ else
+ printf("End: %s\n", completion.value().toString(globalObject->globalExec()).utf8().data());
+ }
+
+ globalData.stopSampling();
+ globalObject->globalExec()->clearException();
+ }
+
+#if ENABLE(SAMPLING_FLAGS)
+ SamplingFlags::stop();
+#endif
+ globalData.dumpSampleData(globalObject->globalExec());
+#if ENABLE(SAMPLING_COUNTERS)
+ AbstractSamplingCounter::dump();
+#endif
+#if ENABLE(REGEXP_TRACING)
+ globalData.dumpRegExpTrace();
+#endif
+ return success;
+}
+
+#define RUNNING_FROM_XCODE 0
+
+static void runInteractive(GlobalObject* globalObject)
+{
+ while (true) {
+#if HAVE(READLINE) && !RUNNING_FROM_XCODE
+ char* line = readline(interactivePrompt);
+ if (!line)
+ break;
+ if (line[0])
+ add_history(line);
+ Completion completion = evaluate(globalObject->globalExec(), globalObject->globalScopeChain(), makeSource(line, interpreterName));
+ free(line);
+#else
+ printf("%s", interactivePrompt);
+ Vector<char, 256> line;
+ int c;
+ while ((c = getchar()) != EOF) {
+ // FIXME: Should we also break on \r?
+ if (c == '\n')
+ break;
+ line.append(c);
+ }
+ if (line.isEmpty())
+ break;
+ line.append('\0');
+ Completion completion = evaluate(globalObject->globalExec(), globalObject->globalScopeChain(), makeSource(line.data(), interpreterName));
+#endif
+ if (completion.complType() == Throw)
+ printf("Exception: %s\n", completion.value().toString(globalObject->globalExec()).utf8().data());
+ else
+ printf("%s\n", completion.value().toString(globalObject->globalExec()).utf8().data());
+
+ globalObject->globalExec()->clearException();
+ }
+ printf("\n");
+}
+
+static NO_RETURN void printUsageStatement(JSGlobalData* globalData, bool help = false)
+{
+ fprintf(stderr, "Usage: jsc [options] [files] [-- arguments]\n");
+ fprintf(stderr, " -d Dumps bytecode (debug builds only)\n");
+ fprintf(stderr, " -e Evaluate argument as script code\n");
+ fprintf(stderr, " -f Specifies a source file (deprecated)\n");
+ fprintf(stderr, " -h|--help Prints this help message\n");
+ fprintf(stderr, " -i Enables interactive mode (default if no files are specified)\n");
+#if HAVE(SIGNAL_H)
+ fprintf(stderr, " -s Installs signal handlers that exit on a crash (Unix platforms only)\n");
+#endif
+
+ cleanupGlobalData(globalData);
+ exit(help ? EXIT_SUCCESS : EXIT_FAILURE);
+}
+
+static void parseArguments(int argc, char** argv, Options& options, JSGlobalData* globalData)
+{
+ int i = 1;
+ for (; i < argc; ++i) {
+ const char* arg = argv[i];
+ if (!strcmp(arg, "-f")) {
+ if (++i == argc)
+ printUsageStatement(globalData);
+ options.scripts.append(Script(true, argv[i]));
+ continue;
+ }
+ if (!strcmp(arg, "-e")) {
+ if (++i == argc)
+ printUsageStatement(globalData);
+ options.scripts.append(Script(false, argv[i]));
+ continue;
+ }
+ if (!strcmp(arg, "-i")) {
+ options.interactive = true;
+ continue;
+ }
+ if (!strcmp(arg, "-d")) {
+ options.dump = true;
+ continue;
+ }
+ if (!strcmp(arg, "-s")) {
+#if HAVE(SIGNAL_H)
+ signal(SIGILL, _exit);
+ signal(SIGFPE, _exit);
+ signal(SIGBUS, _exit);
+ signal(SIGSEGV, _exit);
+#endif
+ continue;
+ }
+ if (!strcmp(arg, "--")) {
+ ++i;
+ break;
+ }
+ if (!strcmp(arg, "-h") || !strcmp(arg, "--help"))
+ printUsageStatement(globalData, true);
+ options.scripts.append(Script(true, argv[i]));
+ }
+
+ if (options.scripts.isEmpty())
+ options.interactive = true;
+
+ for (; i < argc; ++i)
+ options.arguments.append(argv[i]);
+}
+
+int jscmain(int argc, char** argv, JSGlobalData* globalData)
+{
+ JSLock lock(SilenceAssertionsOnly);
+
+ Options options;
+ parseArguments(argc, argv, options, globalData);
+
+ GlobalObject* globalObject = new (globalData) GlobalObject(options.arguments);
+ bool success = runWithScripts(globalObject, options.scripts, options.dump);
+ if (options.interactive && success)
+ runInteractive(globalObject);
+
+ return success ? 0 : 3;
+}
+
+static bool fillBufferWithContentsOfFile(const UString& fileName, Vector<char>& buffer)
+{
+ FILE* f = fopen(fileName.utf8().data(), "r");
+ if (!f) {
+ fprintf(stderr, "Could not open file: %s\n", fileName.utf8().data());
+ return false;
+ }
+
+ size_t bufferSize = 0;
+ size_t bufferCapacity = 1024;
+
+ buffer.resize(bufferCapacity);
+
+ while (!feof(f) && !ferror(f)) {
+ bufferSize += fread(buffer.data() + bufferSize, 1, bufferCapacity - bufferSize, f);
+ if (bufferSize == bufferCapacity) { // guarantees space for trailing '\0'
+ bufferCapacity *= 2;
+ buffer.resize(bufferCapacity);
+ }
+ }
+ fclose(f);
+ buffer[bufferSize] = '\0';
+
+ if (buffer[0] == '#' && buffer[1] == '!')
+ buffer[0] = buffer[1] = '/';
+
+ return true;
+}
diff --git a/Source/JavaScriptCore/jsc.pro b/Source/JavaScriptCore/jsc.pro
new file mode 100644
index 0000000..7c90f37
--- /dev/null
+++ b/Source/JavaScriptCore/jsc.pro
@@ -0,0 +1,41 @@
+TEMPLATE = app
+TARGET = jsc
+DESTDIR = .
+SOURCES = jsc.cpp
+QT -= gui
+CONFIG -= app_bundle
+CONFIG += building-libs
+win32-*: CONFIG += console
+win32-msvc*: CONFIG += exceptions_off stl_off
+
+isEmpty(OUTPUT_DIR): OUTPUT_DIR= ..
+include($$PWD/../../WebKit.pri)
+
+unix:!mac:!symbian:CONFIG += link_pkgconfig
+
+QMAKE_RPATHDIR += $$OUTPUT_DIR/lib
+
+!CONFIG(release, debug|release) {
+ OBJECTS_DIR = obj/debug
+} else { # Release
+ OBJECTS_DIR = obj/release
+}
+OBJECTS_DIR_WTR = $$OBJECTS_DIR$${QMAKE_DIR_SEP}
+include($$PWD/JavaScriptCore.pri)
+addJavaScriptCoreLib(.)
+
+symbian {
+ TARGET.CAPABILITY = ReadUserData WriteUserData NetworkServices
+}
+
+mac {
+ LIBS_PRIVATE += -framework AppKit
+}
+
+wince* {
+ LIBS += mmtimer.lib
+}
+
+# Prevent warnings about difference in visibility on Mac OS X
+contains(QT_CONFIG, reduce_exports):CONFIG += hide_symbols
+unix:contains(QT_CONFIG, reduce_relocations):CONFIG += bsymbolic_functions
diff --git a/Source/JavaScriptCore/make-generated-sources.sh b/Source/JavaScriptCore/make-generated-sources.sh
new file mode 100755
index 0000000..a6b0f63
--- /dev/null
+++ b/Source/JavaScriptCore/make-generated-sources.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+export SRCROOT=$PWD
+export WebCore=$PWD
+export CREATE_HASH_TABLE="$SRCROOT/create_hash_table"
+export CREATE_REGEXP_TABLES="$SRCROOT/create_regex_tables"
+
+mkdir -p DerivedSources/JavaScriptCore
+cd DerivedSources/JavaScriptCore
+
+make -f ../../DerivedSources.make JavaScriptCore=../.. BUILT_PRODUCTS_DIR=../..
+cd ../..
diff --git a/Source/JavaScriptCore/os-win32/WinMain.cpp b/Source/JavaScriptCore/os-win32/WinMain.cpp
new file mode 100644
index 0000000..17800d0
--- /dev/null
+++ b/Source/JavaScriptCore/os-win32/WinMain.cpp
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2009 Patrick Gansterer (paroga@paroga.com)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+#include "Vector.h"
+#include <winbase.h>
+#include <winnls.h>
+#include <wtf/UnusedParam.h>
+
+int main(int argc, char** argv);
+
+static inline char* convertToUtf8(LPCWSTR widecharString, int length)
+{
+ int requiredSize = WideCharToMultiByte(CP_UTF8, 0, widecharString, length, 0, 0, 0, 0);
+ char* multibyteString = new char[requiredSize + 1];
+
+ WideCharToMultiByte(CP_UTF8, 0, widecharString, length, multibyteString, requiredSize, 0, 0);
+ multibyteString[requiredSize] = '\0';
+
+ return multibyteString;
+}
+
+int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow)
+{
+ UNUSED_PARAM(hInstance);
+ UNUSED_PARAM(hPrevInstance);
+ UNUSED_PARAM(nCmdShow);
+
+ Vector<char*> arguments;
+ TCHAR buffer[MAX_PATH];
+
+ int length = GetModuleFileNameW(0, buffer, MAX_PATH);
+ arguments.append(convertToUtf8(buffer, length));
+
+ WCHAR* commandLine = lpCmdLine;
+ while (commandLine[0] != '\0') {
+ int commandLineLength = 1;
+ WCHAR endChar = ' ';
+
+ while (commandLine[0] == ' ')
+ ++commandLine;
+
+ if (commandLine[0] == '\"') {
+ ++commandLine;
+ endChar = '\"';
+ }
+
+ while (commandLine[commandLineLength] != endChar && commandLine[commandLineLength] != '\0')
+ ++commandLineLength;
+
+ arguments.append(convertToUtf8(commandLine, commandLineLength));
+
+ commandLine += commandLineLength;
+ if (endChar != ' ' && commandLine[0] != '\0')
+ ++commandLine;
+ }
+
+ int res = main(arguments.size(), arguments.data());
+
+ for (size_t i = 0; i < arguments.size(); i++)
+ delete arguments[i];
+
+ return res;
+}
diff --git a/Source/JavaScriptCore/os-win32/inttypes.h b/Source/JavaScriptCore/os-win32/inttypes.h
new file mode 100644
index 0000000..0ed6718
--- /dev/null
+++ b/Source/JavaScriptCore/os-win32/inttypes.h
@@ -0,0 +1,261 @@
+// ISO C9x compliant inttypes.h for Microsoft Visual Studio
+// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124
+//
+// Copyright (c) 2006 Alexander Chemeris
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+//
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// 3. The name of the author may be used to endorse or promote products
+// derived from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef INTTYPES_WIN32_H
+#define INTTYPES_WIN32_H
+
+#include <wtf/Platform.h>
+
+#if !COMPILER(MSVC)
+#error "This inttypes.h file should only be compiled with MSVC"
+#endif
+
+#if _MSC_VER > 1000
+#pragma once
+#endif
+
+#include "stdint.h"
+
+// 7.8.1 Macros for format specifiers
+
+#if !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS)
+
+// The fprintf macros for signed integers are:
+#define PRId8 "d"
+#define PRIi8 "i"
+#define PRIdLEAST8 "d"
+#define PRIiLEAST8 "i"
+#define PRIdFAST8 "d"
+#define PRIiFAST8 "i"
+
+#define PRId16 "hd"
+#define PRIi16 "hi"
+#define PRIdLEAST16 "hd"
+#define PRIiLEAST16 "hi"
+#define PRIdFAST16 "hd"
+#define PRIiFAST16 "hi"
+
+#define PRId32 "I32d"
+#define PRIi32 "I32i"
+#define PRIdLEAST32 "I32d"
+#define PRIiLEAST32 "I32i"
+#define PRIdFAST32 "I32d"
+#define PRIiFAST32 "I32i"
+
+#define PRId64 "I64d"
+#define PRIi64 "I64i"
+#define PRIdLEAST64 "I64d"
+#define PRIiLEAST64 "I64i"
+#define PRIdFAST64 "I64d"
+#define PRIiFAST64 "I64i"
+
+#define PRIdMAX "I64d"
+#define PRIiMAX "I64i"
+
+#define PRIdPTR "Id"
+#define PRIiPTR "Ii"
+
+// The fprintf macros for unsigned integers are:
+#define PRIo8 "o"
+#define PRIu8 "u"
+#define PRIx8 "x"
+#define PRIX8 "X"
+#define PRIoLEAST8 "o"
+#define PRIuLEAST8 "u"
+#define PRIxLEAST8 "x"
+#define PRIXLEAST8 "X"
+#define PRIoFAST8 "o"
+#define PRIuFAST8 "u"
+#define PRIxFAST8 "x"
+#define PRIXFAST8 "X"
+
+#define PRIo16 "ho"
+#define PRIu16 "hu"
+#define PRIx16 "hx"
+#define PRIX16 "hX"
+#define PRIoLEAST16 "ho"
+#define PRIuLEAST16 "hu"
+#define PRIxLEAST16 "hx"
+#define PRIXLEAST16 "hX"
+#define PRIoFAST16 "ho"
+#define PRIuFAST16 "hu"
+#define PRIxFAST16 "hx"
+#define PRIXFAST16 "hX"
+
+#define PRIo32 "I32o"
+#define PRIu32 "I32u"
+#define PRIx32 "I32x"
+#define PRIX32 "I32X"
+#define PRIoLEAST32 "I32o"
+#define PRIuLEAST32 "I32u"
+#define PRIxLEAST32 "I32x"
+#define PRIXLEAST32 "I32X"
+#define PRIoFAST32 "I32o"
+#define PRIuFAST32 "I32u"
+#define PRIxFAST32 "I32x"
+#define PRIXFAST32 "I32X"
+
+#define PRIo64 "I64o"
+#define PRIu64 "I64u"
+#define PRIx64 "I64x"
+#define PRIX64 "I64X"
+#define PRIoLEAST64 "I64o"
+#define PRIuLEAST64 "I64u"
+#define PRIxLEAST64 "I64x"
+#define PRIXLEAST64 "I64X"
+#define PRIoFAST64 "I64o"
+#define PRIuFAST64 "I64u"
+#define PRIxFAST64 "I64x"
+#define PRIXFAST64 "I64X"
+
+#define PRIoMAX "I64o"
+#define PRIuMAX "I64u"
+#define PRIxMAX "I64x"
+#define PRIXMAX "I64X"
+
+#define PRIoPTR "Io"
+#define PRIuPTR "Iu"
+#define PRIxPTR "Ix"
+#define PRIXPTR "IX"
+
+// The fscanf macros for signed integers are:
+#define SCNd8 "d"
+#define SCNi8 "i"
+#define SCNdLEAST8 "d"
+#define SCNiLEAST8 "i"
+#define SCNdFAST8 "d"
+#define SCNiFAST8 "i"
+
+#define SCNd16 "hd"
+#define SCNi16 "hi"
+#define SCNdLEAST16 "hd"
+#define SCNiLEAST16 "hi"
+#define SCNdFAST16 "hd"
+#define SCNiFAST16 "hi"
+
+#define SCNd32 "ld"
+#define SCNi32 "li"
+#define SCNdLEAST32 "ld"
+#define SCNiLEAST32 "li"
+#define SCNdFAST32 "ld"
+#define SCNiFAST32 "li"
+
+#define SCNd64 "I64d"
+#define SCNi64 "I64i"
+#define SCNdLEAST64 "I64d"
+#define SCNiLEAST64 "I64i"
+#define SCNdFAST64 "I64d"
+#define SCNiFAST64 "I64i"
+
+#define SCNdMAX "I64d"
+#define SCNiMAX "I64i"
+
+#ifdef _WIN64
+# define SCNdPTR "I64d"
+# define SCNiPTR "I64i"
+#else
+# define SCNdPTR "ld"
+# define SCNiPTR "li"
+#endif
+
+// The fscanf macros for unsigned integers are:
+#define SCNo8 "o"
+#define SCNu8 "u"
+#define SCNx8 "x"
+#define SCNX8 "X"
+#define SCNoLEAST8 "o"
+#define SCNuLEAST8 "u"
+#define SCNxLEAST8 "x"
+#define SCNXLEAST8 "X"
+#define SCNoFAST8 "o"
+#define SCNuFAST8 "u"
+#define SCNxFAST8 "x"
+#define SCNXFAST8 "X"
+
+#define SCNo16 "ho"
+#define SCNu16 "hu"
+#define SCNx16 "hx"
+#define SCNX16 "hX"
+#define SCNoLEAST16 "ho"
+#define SCNuLEAST16 "hu"
+#define SCNxLEAST16 "hx"
+#define SCNXLEAST16 "hX"
+#define SCNoFAST16 "ho"
+#define SCNuFAST16 "hu"
+#define SCNxFAST16 "hx"
+#define SCNXFAST16 "hX"
+
+#define SCNo32 "lo"
+#define SCNu32 "lu"
+#define SCNx32 "lx"
+#define SCNX32 "lX"
+#define SCNoLEAST32 "lo"
+#define SCNuLEAST32 "lu"
+#define SCNxLEAST32 "lx"
+#define SCNXLEAST32 "lX"
+#define SCNoFAST32 "lo"
+#define SCNuFAST32 "lu"
+#define SCNxFAST32 "lx"
+#define SCNXFAST32 "lX"
+
+#define SCNo64 "I64o"
+#define SCNu64 "I64u"
+#define SCNx64 "I64x"
+#define SCNX64 "I64X"
+#define SCNoLEAST64 "I64o"
+#define SCNuLEAST64 "I64u"
+#define SCNxLEAST64 "I64x"
+#define SCNXLEAST64 "I64X"
+#define SCNoFAST64 "I64o"
+#define SCNuFAST64 "I64u"
+#define SCNxFAST64 "I64x"
+#define SCNXFAST64 "I64X"
+
+#define SCNoMAX "I64o"
+#define SCNuMAX "I64u"
+#define SCNxMAX "I64x"
+#define SCNXMAX "I64X"
+
+#ifdef _WIN64
+# define SCNoPTR "I64o"
+# define SCNuPTR "I64u"
+# define SCNxPTR "I64x"
+# define SCNXPTR "I64X"
+#else
+# define SCNoPTR "lo"
+# define SCNuPTR "lu"
+# define SCNxPTR "lx"
+# define SCNXPTR "lX"
+#endif
+
+#endif
+
+#endif
diff --git a/Source/JavaScriptCore/os-win32/stdbool.h b/Source/JavaScriptCore/os-win32/stdbool.h
new file mode 100644
index 0000000..fc8ee28
--- /dev/null
+++ b/Source/JavaScriptCore/os-win32/stdbool.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2005, 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef STDBOOL_WIN32_H
+#define STDBOOL_WIN32_H
+
+#if !COMPILER(MSVC)
+#error "This stdbool.h file should only be compiled with MSVC"
+#endif
+
+#ifndef __cplusplus
+
+typedef unsigned char bool;
+
+#define true 1
+#define false 0
+
+#ifndef CASSERT
+#define CASSERT(exp, name) typedef int dummy##name [(exp) ? 1 : -1];
+#endif
+
+CASSERT(sizeof(bool) == 1, bool_is_one_byte)
+CASSERT(true, true_is_true)
+CASSERT(!false, false_is_false)
+
+#endif
+
+#endif
diff --git a/Source/JavaScriptCore/os-win32/stdint.h b/Source/JavaScriptCore/os-win32/stdint.h
new file mode 100644
index 0000000..b5dff56
--- /dev/null
+++ b/Source/JavaScriptCore/os-win32/stdint.h
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2005, 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef STDINT_WIN32_H
+#define STDINT_WIN32_H
+
+#include <wtf/Platform.h>
+
+/* This file emulates enough of stdint.h on Windows to make JavaScriptCore and WebCore
+ compile using MSVC which does not ship with the stdint.h header. */
+
+#if !COMPILER(MSVC)
+#error "This stdint.h file should only be compiled with MSVC"
+#endif
+
+#include <limits.h>
+
+typedef unsigned char uint8_t;
+typedef signed char int8_t;
+typedef unsigned short uint16_t;
+typedef short int16_t;
+typedef unsigned int uint32_t;
+typedef int int32_t;
+typedef __int64 int64_t;
+typedef unsigned __int64 uint64_t;
+
+#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS)
+#ifndef SIZE_MAX
+#ifdef _WIN64
+#define SIZE_MAX _UI64_MAX
+#else
+#define SIZE_MAX _UI32_MAX
+#endif
+#endif
+#endif
+
+#ifndef CASSERT
+#define CASSERT(exp, name) typedef int dummy##name [(exp) ? 1 : -1];
+#endif
+
+CASSERT(sizeof(int8_t) == 1, int8_t_is_one_byte)
+CASSERT(sizeof(uint8_t) == 1, uint8_t_is_one_byte)
+CASSERT(sizeof(int16_t) == 2, int16_t_is_two_bytes)
+CASSERT(sizeof(uint16_t) == 2, uint16_t_is_two_bytes)
+CASSERT(sizeof(int32_t) == 4, int32_t_is_four_bytes)
+CASSERT(sizeof(uint32_t) == 4, uint32_t_is_four_bytes)
+CASSERT(sizeof(int64_t) == 8, int64_t_is_eight_bytes)
+CASSERT(sizeof(uint64_t) == 8, uint64_t_is_eight_bytes)
+
+#endif
diff --git a/Source/JavaScriptCore/parser/ASTBuilder.h b/Source/JavaScriptCore/parser/ASTBuilder.h
new file mode 100644
index 0000000..04cf272
--- /dev/null
+++ b/Source/JavaScriptCore/parser/ASTBuilder.h
@@ -0,0 +1,967 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ASTBuilder_h
+#define ASTBuilder_h
+
+#include "NodeConstructors.h"
+#include "SyntaxChecker.h"
+#include <utility>
+
+namespace JSC {
+
+class ASTBuilder {
+ struct BinaryOpInfo {
+ BinaryOpInfo() {}
+ BinaryOpInfo(int s, int d, int e, bool r)
+ : start(s)
+ , divot(d)
+ , end(e)
+ , hasAssignment(r)
+ {
+ }
+ BinaryOpInfo(const BinaryOpInfo& lhs, const BinaryOpInfo& rhs)
+ : start(lhs.start)
+ , divot(rhs.start)
+ , end(rhs.end)
+ , hasAssignment(lhs.hasAssignment || rhs.hasAssignment)
+ {
+ }
+ int start;
+ int divot;
+ int end;
+ bool hasAssignment;
+ };
+
+
+ struct AssignmentInfo {
+ AssignmentInfo() {}
+ AssignmentInfo(ExpressionNode* node, int start, int divot, int initAssignments, Operator op)
+ : m_node(node)
+ , m_start(start)
+ , m_divot(divot)
+ , m_initAssignments(initAssignments)
+ , m_op(op)
+ {
+ }
+ ExpressionNode* m_node;
+ int m_start;
+ int m_divot;
+ int m_initAssignments;
+ Operator m_op;
+ };
+public:
+ ASTBuilder(JSGlobalData* globalData, Lexer* lexer)
+ : m_globalData(globalData)
+ , m_lexer(lexer)
+ , m_evalCount(0)
+ {
+ m_scopes.append(Scope(globalData));
+ }
+
+ typedef SyntaxChecker FunctionBodyBuilder;
+
+ typedef ExpressionNode* Expression;
+ typedef JSC::SourceElements* SourceElements;
+ typedef ArgumentsNode* Arguments;
+ typedef CommaNode* Comma;
+ typedef PropertyNode* Property;
+ typedef PropertyListNode* PropertyList;
+ typedef ElementNode* ElementList;
+ typedef ArgumentListNode* ArgumentsList;
+ typedef ParameterNode* FormalParameterList;
+ typedef FunctionBodyNode* FunctionBody;
+ typedef StatementNode* Statement;
+ typedef ClauseListNode* ClauseList;
+ typedef CaseClauseNode* Clause;
+ typedef ConstDeclNode* ConstDeclList;
+ typedef std::pair<ExpressionNode*, BinaryOpInfo> BinaryOperand;
+
+ static const bool CreatesAST = true;
+ static const bool NeedsFreeVariableInfo = true;
+
+ ExpressionNode* makeBinaryNode(int token, std::pair<ExpressionNode*, BinaryOpInfo>, std::pair<ExpressionNode*, BinaryOpInfo>);
+ ExpressionNode* makeFunctionCallNode(ExpressionNode* func, ArgumentsNode* args, int start, int divot, int end);
+
+ JSC::SourceElements* createSourceElements() { return new (m_globalData) JSC::SourceElements(m_globalData); }
+
+ ParserArenaData<DeclarationStacks::VarStack>* varDeclarations() { return m_scopes.last().m_varDeclarations; }
+ ParserArenaData<DeclarationStacks::FunctionStack>* funcDeclarations() { return m_scopes.last().m_funcDeclarations; }
+ int features() const { return m_scopes.last().m_features; }
+ int numConstants() const { return m_scopes.last().m_numConstants; }
+
+ void appendToComma(CommaNode* commaNode, ExpressionNode* expr) { commaNode->append(expr); }
+
+ CommaNode* createCommaExpr(ExpressionNode* lhs, ExpressionNode* rhs) { return new (m_globalData) CommaNode(m_globalData, lhs, rhs); }
+
+ ExpressionNode* makeAssignNode(ExpressionNode* left, Operator, ExpressionNode* right, bool leftHasAssignments, bool rightHasAssignments, int start, int divot, int end);
+ ExpressionNode* makePrefixNode(ExpressionNode*, Operator, int start, int divot, int end);
+ ExpressionNode* makePostfixNode(ExpressionNode*, Operator, int start, int divot, int end);
+ ExpressionNode* makeTypeOfNode(ExpressionNode*);
+ ExpressionNode* makeDeleteNode(ExpressionNode*, int start, int divot, int end);
+ ExpressionNode* makeNegateNode(ExpressionNode*);
+ ExpressionNode* makeBitwiseNotNode(ExpressionNode*);
+ ExpressionNode* makeMultNode(ExpressionNode* left, ExpressionNode* right, bool rightHasAssignments);
+ ExpressionNode* makeDivNode(ExpressionNode* left, ExpressionNode* right, bool rightHasAssignments);
+ ExpressionNode* makeModNode(ExpressionNode* left, ExpressionNode* right, bool rightHasAssignments);
+ ExpressionNode* makeAddNode(ExpressionNode* left, ExpressionNode* right, bool rightHasAssignments);
+ ExpressionNode* makeSubNode(ExpressionNode* left, ExpressionNode* right, bool rightHasAssignments);
+ ExpressionNode* makeBitXOrNode(ExpressionNode* left, ExpressionNode* right, bool rightHasAssignments);
+ ExpressionNode* makeBitAndNode(ExpressionNode* left, ExpressionNode* right, bool rightHasAssignments);
+ ExpressionNode* makeBitOrNode(ExpressionNode* left, ExpressionNode* right, bool rightHasAssignments);
+ ExpressionNode* makeLeftShiftNode(ExpressionNode* left, ExpressionNode* right, bool rightHasAssignments);
+ ExpressionNode* makeRightShiftNode(ExpressionNode* left, ExpressionNode* right, bool rightHasAssignments);
+ ExpressionNode* makeURightShiftNode(ExpressionNode* left, ExpressionNode* right, bool rightHasAssignments);
+
+ ExpressionNode* createLogicalNot(ExpressionNode* expr) { return new (m_globalData) LogicalNotNode(m_globalData, expr); }
+ ExpressionNode* createUnaryPlus(ExpressionNode* expr) { return new (m_globalData) UnaryPlusNode(m_globalData, expr); }
+ ExpressionNode* createVoid(ExpressionNode* expr)
+ {
+ incConstants();
+ return new (m_globalData) VoidNode(m_globalData, expr);
+ }
+ ExpressionNode* thisExpr()
+ {
+ usesThis();
+ return new (m_globalData) ThisNode(m_globalData);
+ }
+ ExpressionNode* createResolve(const Identifier* ident, int start)
+ {
+ if (m_globalData->propertyNames->arguments == *ident)
+ usesArguments();
+ return new (m_globalData) ResolveNode(m_globalData, *ident, start);
+ }
+ ExpressionNode* createObjectLiteral() { return new (m_globalData) ObjectLiteralNode(m_globalData); }
+ ExpressionNode* createObjectLiteral(PropertyListNode* properties) { return new (m_globalData) ObjectLiteralNode(m_globalData, properties); }
+
+ ExpressionNode* createArray(int elisions)
+ {
+ if (elisions)
+ incConstants();
+ return new (m_globalData) ArrayNode(m_globalData, elisions);
+ }
+
+ ExpressionNode* createArray(ElementNode* elems) { return new (m_globalData) ArrayNode(m_globalData, elems); }
+ ExpressionNode* createArray(int elisions, ElementNode* elems)
+ {
+ if (elisions)
+ incConstants();
+ return new (m_globalData) ArrayNode(m_globalData, elisions, elems);
+ }
+ ExpressionNode* createNumberExpr(double d)
+ {
+ incConstants();
+ return new (m_globalData) NumberNode(m_globalData, d);
+ }
+
+ ExpressionNode* createString(const Identifier* string)
+ {
+ incConstants();
+ return new (m_globalData) StringNode(m_globalData, *string);
+ }
+
+ ExpressionNode* createBoolean(bool b)
+ {
+ incConstants();
+ return new (m_globalData) BooleanNode(m_globalData, b);
+ }
+
+ ExpressionNode* createNull()
+ {
+ incConstants();
+ return new (m_globalData) NullNode(m_globalData);
+ }
+
+ ExpressionNode* createBracketAccess(ExpressionNode* base, ExpressionNode* property, bool propertyHasAssignments, int start, int divot, int end)
+ {
+ BracketAccessorNode* node = new (m_globalData) BracketAccessorNode(m_globalData, base, property, propertyHasAssignments);
+ setExceptionLocation(node, start, divot, end);
+ return node;
+ }
+
+ ExpressionNode* createDotAccess(ExpressionNode* base, const Identifier& property, int start, int divot, int end)
+ {
+ DotAccessorNode* node = new (m_globalData) DotAccessorNode(m_globalData, base, property);
+ setExceptionLocation(node, start, divot, end);
+ return node;
+ }
+
+ ExpressionNode* createRegex(const Identifier& pattern, const Identifier& flags, int start)
+ {
+ RegExpNode* node = new (m_globalData) RegExpNode(m_globalData, pattern, flags);
+ int size = pattern.length() + 2; // + 2 for the two /'s
+ setExceptionLocation(node, start, start + size, start + size);
+ return node;
+ }
+
+ ExpressionNode* createNewExpr(ExpressionNode* expr, ArgumentsNode* arguments, int start, int divot, int end)
+ {
+ NewExprNode* node = new (m_globalData) NewExprNode(m_globalData, expr, arguments);
+ setExceptionLocation(node, start, divot, end);
+ return node;
+ }
+
+ ExpressionNode* createNewExpr(ExpressionNode* expr, int start, int end)
+ {
+ NewExprNode* node = new (m_globalData) NewExprNode(m_globalData, expr);
+ setExceptionLocation(node, start, end, end);
+ return node;
+ }
+
+ ExpressionNode* createConditionalExpr(ExpressionNode* condition, ExpressionNode* lhs, ExpressionNode* rhs)
+ {
+ return new (m_globalData) ConditionalNode(m_globalData, condition, lhs, rhs);
+ }
+
+ ExpressionNode* createAssignResolve(const Identifier& ident, ExpressionNode* rhs, bool rhsHasAssignment, int start, int divot, int end)
+ {
+ AssignResolveNode* node = new (m_globalData) AssignResolveNode(m_globalData, ident, rhs, rhsHasAssignment);
+ setExceptionLocation(node, start, divot, end);
+ return node;
+ }
+
+ ExpressionNode* createFunctionExpr(const Identifier* name, FunctionBodyNode* body, ParameterNode* parameters, int openBracePos, int closeBracePos, int bodyStartLine, int bodyEndLine)
+ {
+ FuncExprNode* result = new (m_globalData) FuncExprNode(m_globalData, *name, body, m_lexer->sourceCode(openBracePos, closeBracePos, bodyStartLine), parameters);
+ body->setLoc(bodyStartLine, bodyEndLine);
+ return result;
+ }
+
+ FunctionBodyNode* createFunctionBody(bool inStrictContext)
+ {
+ usesClosures();
+ return FunctionBodyNode::create(m_globalData, inStrictContext);
+ }
+
+ template <bool> PropertyNode* createGetterOrSetterProperty(PropertyNode::Type type, const Identifier* name, ParameterNode* params, FunctionBodyNode* body, int openBracePos, int closeBracePos, int bodyStartLine, int bodyEndLine)
+ {
+ ASSERT(name);
+ body->setLoc(bodyStartLine, bodyEndLine);
+ return new (m_globalData) PropertyNode(m_globalData, *name, new (m_globalData) FuncExprNode(m_globalData, m_globalData->propertyNames->nullIdentifier, body, m_lexer->sourceCode(openBracePos, closeBracePos, bodyStartLine), params), type);
+ }
+
+
+ ArgumentsNode* createArguments() { return new (m_globalData) ArgumentsNode(m_globalData); }
+ ArgumentsNode* createArguments(ArgumentListNode* args) { return new (m_globalData) ArgumentsNode(m_globalData, args); }
+ ArgumentListNode* createArgumentsList(ExpressionNode* arg) { return new (m_globalData) ArgumentListNode(m_globalData, arg); }
+ ArgumentListNode* createArgumentsList(ArgumentListNode* args, ExpressionNode* arg) { return new (m_globalData) ArgumentListNode(m_globalData, args, arg); }
+
+ template <bool> PropertyNode* createProperty(const Identifier* propertyName, ExpressionNode* node, PropertyNode::Type type) { return new (m_globalData) PropertyNode(m_globalData, *propertyName, node, type); }
+ template <bool> PropertyNode* createProperty(JSGlobalData*, double propertyName, ExpressionNode* node, PropertyNode::Type type) { return new (m_globalData) PropertyNode(m_globalData, propertyName, node, type); }
+ PropertyListNode* createPropertyList(PropertyNode* property) { return new (m_globalData) PropertyListNode(m_globalData, property); }
+ PropertyListNode* createPropertyList(PropertyNode* property, PropertyListNode* tail) { return new (m_globalData) PropertyListNode(m_globalData, property, tail); }
+
+ ElementNode* createElementList(int elisions, ExpressionNode* expr) { return new (m_globalData) ElementNode(m_globalData, elisions, expr); }
+ ElementNode* createElementList(ElementNode* elems, int elisions, ExpressionNode* expr) { return new (m_globalData) ElementNode(m_globalData, elems, elisions, expr); }
+
+ ParameterNode* createFormalParameterList(const Identifier& ident) { return new (m_globalData) ParameterNode(m_globalData, ident); }
+ ParameterNode* createFormalParameterList(ParameterNode* list, const Identifier& ident) { return new (m_globalData) ParameterNode(m_globalData, list, ident); }
+
+ CaseClauseNode* createClause(ExpressionNode* expr, JSC::SourceElements* statements) { return new (m_globalData) CaseClauseNode(m_globalData, expr, statements); }
+ ClauseListNode* createClauseList(CaseClauseNode* clause) { return new (m_globalData) ClauseListNode(m_globalData, clause); }
+ ClauseListNode* createClauseList(ClauseListNode* tail, CaseClauseNode* clause) { return new (m_globalData) ClauseListNode(m_globalData, tail, clause); }
+
+ void setUsesArguments(FunctionBodyNode* node) { node->setUsesArguments(); }
+
+ StatementNode* createFuncDeclStatement(const Identifier* name, FunctionBodyNode* body, ParameterNode* parameters, int openBracePos, int closeBracePos, int bodyStartLine, int bodyEndLine)
+ {
+ FuncDeclNode* decl = new (m_globalData) FuncDeclNode(m_globalData, *name, body, m_lexer->sourceCode(openBracePos, closeBracePos, bodyStartLine), parameters);
+ if (*name == m_globalData->propertyNames->arguments)
+ usesArguments();
+ m_scopes.last().m_funcDeclarations->data.append(decl->body());
+ body->setLoc(bodyStartLine, bodyEndLine);
+ return decl;
+ }
+
+ StatementNode* createBlockStatement(JSC::SourceElements* elements, int startLine, int endLine)
+ {
+ BlockNode* block = new (m_globalData) BlockNode(m_globalData, elements);
+ block->setLoc(startLine, endLine);
+ return block;
+ }
+
+ StatementNode* createExprStatement(ExpressionNode* expr, int start, int end)
+ {
+ ExprStatementNode* result = new (m_globalData) ExprStatementNode(m_globalData, expr);
+ result->setLoc(start, end);
+ return result;
+ }
+
+ StatementNode* createIfStatement(ExpressionNode* condition, StatementNode* trueBlock, int start, int end)
+ {
+ IfNode* result = new (m_globalData) IfNode(m_globalData, condition, trueBlock);
+ result->setLoc(start, end);
+ return result;
+ }
+
+ StatementNode* createIfStatement(ExpressionNode* condition, StatementNode* trueBlock, StatementNode* falseBlock, int start, int end)
+ {
+ IfNode* result = new (m_globalData) IfElseNode(m_globalData, condition, trueBlock, falseBlock);
+ result->setLoc(start, end);
+ return result;
+ }
+
+ StatementNode* createForLoop(ExpressionNode* initializer, ExpressionNode* condition, ExpressionNode* iter, StatementNode* statements, bool b, int start, int end)
+ {
+ ForNode* result = new (m_globalData) ForNode(m_globalData, initializer, condition, iter, statements, b);
+ result->setLoc(start, end);
+ return result;
+ }
+
+ StatementNode* createForInLoop(const Identifier* ident, ExpressionNode* initializer, ExpressionNode* iter, StatementNode* statements, int start, int divot, int end, int initStart, int initEnd, int startLine, int endLine)
+ {
+ ForInNode* result = new (m_globalData) ForInNode(m_globalData, *ident, initializer, iter, statements, initStart, initStart - start, initEnd - initStart);
+ result->setLoc(startLine, endLine);
+ setExceptionLocation(result, start, divot + 1, end);
+ return result;
+ }
+
+ StatementNode* createForInLoop(ExpressionNode* lhs, ExpressionNode* iter, StatementNode* statements, int eStart, int eDivot, int eEnd, int start, int end)
+ {
+ ForInNode* result = new (m_globalData) ForInNode(m_globalData, lhs, iter, statements);
+ result->setLoc(start, end);
+ setExceptionLocation(result, eStart, eDivot, eEnd);
+ return result;
+ }
+
+ StatementNode* createEmptyStatement() { return new (m_globalData) EmptyStatementNode(m_globalData); }
+
+ StatementNode* createVarStatement(ExpressionNode* expr, int start, int end)
+ {
+ StatementNode* result;
+ if (!expr)
+ result = new (m_globalData) EmptyStatementNode(m_globalData);
+ else
+ result = new (m_globalData) VarStatementNode(m_globalData, expr);
+ result->setLoc(start, end);
+ return result;
+ }
+
+ StatementNode* createReturnStatement(ExpressionNode* expression, int eStart, int eEnd, int startLine, int endLine)
+ {
+ ReturnNode* result = new (m_globalData) ReturnNode(m_globalData, expression);
+ setExceptionLocation(result, eStart, eEnd, eEnd);
+ result->setLoc(startLine, endLine);
+ return result;
+ }
+
+ StatementNode* createBreakStatement(int eStart, int eEnd, int startLine, int endLine)
+ {
+ BreakNode* result = new (m_globalData) BreakNode(m_globalData);
+ setExceptionLocation(result, eStart, eEnd, eEnd);
+ result->setLoc(startLine, endLine);
+ return result;
+ }
+
+ StatementNode* createBreakStatement(const Identifier* ident, int eStart, int eEnd, int startLine, int endLine)
+ {
+ BreakNode* result = new (m_globalData) BreakNode(m_globalData, *ident);
+ setExceptionLocation(result, eStart, eEnd, eEnd);
+ result->setLoc(startLine, endLine);
+ return result;
+ }
+
+ StatementNode* createContinueStatement(int eStart, int eEnd, int startLine, int endLine)
+ {
+ ContinueNode* result = new (m_globalData) ContinueNode(m_globalData);
+ setExceptionLocation(result, eStart, eEnd, eEnd);
+ result->setLoc(startLine, endLine);
+ return result;
+ }
+
+ StatementNode* createContinueStatement(const Identifier* ident, int eStart, int eEnd, int startLine, int endLine)
+ {
+ ContinueNode* result = new (m_globalData) ContinueNode(m_globalData, *ident);
+ setExceptionLocation(result, eStart, eEnd, eEnd);
+ result->setLoc(startLine, endLine);
+ return result;
+ }
+
+ StatementNode* createTryStatement(StatementNode* tryBlock, const Identifier* ident, bool catchHasEval, StatementNode* catchBlock, StatementNode* finallyBlock, int startLine, int endLine)
+ {
+ TryNode* result = new (m_globalData) TryNode(m_globalData, tryBlock, *ident, catchHasEval, catchBlock, finallyBlock);
+ if (catchBlock)
+ usesCatch();
+ result->setLoc(startLine, endLine);
+ return result;
+ }
+
+ StatementNode* createSwitchStatement(ExpressionNode* expr, ClauseListNode* firstClauses, CaseClauseNode* defaultClause, ClauseListNode* secondClauses, int startLine, int endLine)
+ {
+ CaseBlockNode* cases = new (m_globalData) CaseBlockNode(m_globalData, firstClauses, defaultClause, secondClauses);
+ SwitchNode* result = new (m_globalData) SwitchNode(m_globalData, expr, cases);
+ result->setLoc(startLine, endLine);
+ return result;
+ }
+
+ StatementNode* createWhileStatement(ExpressionNode* expr, StatementNode* statement, int startLine, int endLine)
+ {
+ WhileNode* result = new (m_globalData) WhileNode(m_globalData, expr, statement);
+ result->setLoc(startLine, endLine);
+ return result;
+ }
+
+ StatementNode* createDoWhileStatement(StatementNode* statement, ExpressionNode* expr, int startLine, int endLine)
+ {
+ DoWhileNode* result = new (m_globalData) DoWhileNode(m_globalData, statement, expr);
+ result->setLoc(startLine, endLine);
+ return result;
+ }
+
+ StatementNode* createLabelStatement(const Identifier* ident, StatementNode* statement, int start, int end)
+ {
+ LabelNode* result = new (m_globalData) LabelNode(m_globalData, *ident, statement);
+ setExceptionLocation(result, start, end, end);
+ return result;
+ }
+
+ StatementNode* createWithStatement(ExpressionNode* expr, StatementNode* statement, int start, int end, int startLine, int endLine)
+ {
+ usesWith();
+ WithNode* result = new (m_globalData) WithNode(m_globalData, expr, statement, end, end - start);
+ result->setLoc(startLine, endLine);
+ return result;
+ }
+
+ StatementNode* createThrowStatement(ExpressionNode* expr, int start, int end, int startLine, int endLine)
+ {
+ ThrowNode* result = new (m_globalData) ThrowNode(m_globalData, expr);
+ result->setLoc(startLine, endLine);
+ setExceptionLocation(result, start, end, end);
+ return result;
+ }
+
+ StatementNode* createDebugger(int startLine, int endLine)
+ {
+ DebuggerStatementNode* result = new (m_globalData) DebuggerStatementNode(m_globalData);
+ result->setLoc(startLine, endLine);
+ return result;
+ }
+
+ StatementNode* createConstStatement(ConstDeclNode* decls, int startLine, int endLine)
+ {
+ ConstStatementNode* result = new (m_globalData) ConstStatementNode(m_globalData, decls);
+ result->setLoc(startLine, endLine);
+ return result;
+ }
+
+ ConstDeclNode* appendConstDecl(ConstDeclNode* tail, const Identifier* name, ExpressionNode* initializer)
+ {
+ ConstDeclNode* result = new (m_globalData) ConstDeclNode(m_globalData, *name, initializer);
+ if (tail)
+ tail->m_next = result;
+ return result;
+ }
+
+ void appendStatement(JSC::SourceElements* elements, JSC::StatementNode* statement)
+ {
+ elements->append(statement);
+ }
+
+ void addVar(const Identifier* ident, int attrs)
+ {
+ if (m_globalData->propertyNames->arguments == *ident)
+ usesArguments();
+ m_scopes.last().m_varDeclarations->data.append(std::make_pair(ident, attrs));
+ }
+
+ ExpressionNode* combineCommaNodes(ExpressionNode* list, ExpressionNode* init)
+ {
+ if (!list)
+ return init;
+ if (list->isCommaNode()) {
+ static_cast<CommaNode*>(list)->append(init);
+ return list;
+ }
+ return new (m_globalData) CommaNode(m_globalData, list, init);
+ }
+
+ int evalCount() const { return m_evalCount; }
+
+ void appendBinaryExpressionInfo(int& operandStackDepth, ExpressionNode* current, int exprStart, int lhs, int rhs, bool hasAssignments)
+ {
+ operandStackDepth++;
+ m_binaryOperandStack.append(std::make_pair(current, BinaryOpInfo(exprStart, lhs, rhs, hasAssignments)));
+ }
+
+ // Logic to handle datastructures used during parsing of binary expressions
+ void operatorStackPop(int& operatorStackDepth)
+ {
+ operatorStackDepth--;
+ m_binaryOperatorStack.removeLast();
+ }
+ bool operatorStackHasHigherPrecedence(int&, int precedence)
+ {
+ return precedence <= m_binaryOperatorStack.last().second;
+ }
+ const BinaryOperand& getFromOperandStack(int i) { return m_binaryOperandStack[m_binaryOperandStack.size() + i]; }
+ void shrinkOperandStackBy(int& operandStackDepth, int amount)
+ {
+ operandStackDepth -= amount;
+ ASSERT(operandStackDepth >= 0);
+ m_binaryOperandStack.resize(m_binaryOperandStack.size() - amount);
+ }
+ void appendBinaryOperation(int& operandStackDepth, int&, const BinaryOperand& lhs, const BinaryOperand& rhs)
+ {
+ operandStackDepth++;
+ m_binaryOperandStack.append(std::make_pair(makeBinaryNode(m_binaryOperatorStack.last().first, lhs, rhs), BinaryOpInfo(lhs.second, rhs.second)));
+ }
+ void operatorStackAppend(int& operatorStackDepth, int op, int precedence)
+ {
+ operatorStackDepth++;
+ m_binaryOperatorStack.append(std::make_pair(op, precedence));
+ }
+ ExpressionNode* popOperandStack(int&)
+ {
+ ExpressionNode* result = m_binaryOperandStack.last().first;
+ m_binaryOperandStack.removeLast();
+ return result;
+ }
+
+ void appendUnaryToken(int& tokenStackDepth, int type, int start)
+ {
+ tokenStackDepth++;
+ m_unaryTokenStack.append(std::make_pair(type, start));
+ }
+
+ int unaryTokenStackLastType(int&)
+ {
+ return m_unaryTokenStack.last().first;
+ }
+
+ int unaryTokenStackLastStart(int&)
+ {
+ return m_unaryTokenStack.last().second;
+ }
+
+ void unaryTokenStackRemoveLast(int& tokenStackDepth)
+ {
+ tokenStackDepth--;
+ m_unaryTokenStack.removeLast();
+ }
+
+ void assignmentStackAppend(int& assignmentStackDepth, ExpressionNode* node, int start, int divot, int assignmentCount, Operator op)
+ {
+ assignmentStackDepth++;
+ m_assignmentInfoStack.append(AssignmentInfo(node, start, divot, assignmentCount, op));
+ }
+
+ ExpressionNode* createAssignment(int& assignmentStackDepth, ExpressionNode* rhs, int initialAssignmentCount, int currentAssignmentCount, int lastTokenEnd)
+ {
+ ExpressionNode* result = makeAssignNode(m_assignmentInfoStack.last().m_node, m_assignmentInfoStack.last().m_op, rhs, m_assignmentInfoStack.last().m_initAssignments != initialAssignmentCount, m_assignmentInfoStack.last().m_initAssignments != currentAssignmentCount, m_assignmentInfoStack.last().m_start, m_assignmentInfoStack.last().m_divot + 1, lastTokenEnd);
+ m_assignmentInfoStack.removeLast();
+ assignmentStackDepth--;
+ return result;
+ }
+
+ const Identifier& getName(Property property) const { return property->name(); }
+ PropertyNode::Type getType(Property property) const { return property->type(); }
+
+ bool isResolve(ExpressionNode* expr) const { return expr->isResolveNode(); }
+
+private:
+ struct Scope {
+ Scope(JSGlobalData* globalData)
+ : m_varDeclarations(new (globalData) ParserArenaData<DeclarationStacks::VarStack>)
+ , m_funcDeclarations(new (globalData) ParserArenaData<DeclarationStacks::FunctionStack>)
+ , m_features(0)
+ , m_numConstants(0)
+ {
+ }
+ ParserArenaData<DeclarationStacks::VarStack>* m_varDeclarations;
+ ParserArenaData<DeclarationStacks::FunctionStack>* m_funcDeclarations;
+ int m_features;
+ int m_numConstants;
+ };
+
+ static void setExceptionLocation(ThrowableExpressionData* node, unsigned start, unsigned divot, unsigned end)
+ {
+ node->setExceptionSourceCode(divot, divot - start, end - divot);
+ }
+
+ void incConstants() { m_scopes.last().m_numConstants++; }
+ void usesThis() { m_scopes.last().m_features |= ThisFeature; }
+ void usesCatch() { m_scopes.last().m_features |= CatchFeature; }
+ void usesClosures() { m_scopes.last().m_features |= ClosureFeature; }
+ void usesArguments() { m_scopes.last().m_features |= ArgumentsFeature; }
+ void usesAssignment() { m_scopes.last().m_features |= AssignFeature; }
+ void usesWith() { m_scopes.last().m_features |= WithFeature; }
+ void usesEval()
+ {
+ m_evalCount++;
+ m_scopes.last().m_features |= EvalFeature;
+ }
+ ExpressionNode* createNumber(double d)
+ {
+ return new (m_globalData) NumberNode(m_globalData, d);
+ }
+
+ JSGlobalData* m_globalData;
+ Lexer* m_lexer;
+ Vector<Scope> m_scopes;
+ Vector<BinaryOperand, 10> m_binaryOperandStack;
+ Vector<AssignmentInfo, 10> m_assignmentInfoStack;
+ Vector<pair<int, int>, 10> m_binaryOperatorStack;
+ Vector<pair<int, int>, 10> m_unaryTokenStack;
+ int m_evalCount;
+};
+
+ExpressionNode* ASTBuilder::makeTypeOfNode(ExpressionNode* expr)
+{
+ if (expr->isResolveNode()) {
+ ResolveNode* resolve = static_cast<ResolveNode*>(expr);
+ return new (m_globalData) TypeOfResolveNode(m_globalData, resolve->identifier());
+ }
+ return new (m_globalData) TypeOfValueNode(m_globalData, expr);
+}
+
+ExpressionNode* ASTBuilder::makeDeleteNode(ExpressionNode* expr, int start, int divot, int end)
+{
+ if (!expr->isLocation())
+ return new (m_globalData) DeleteValueNode(m_globalData, expr);
+ if (expr->isResolveNode()) {
+ ResolveNode* resolve = static_cast<ResolveNode*>(expr);
+ return new (m_globalData) DeleteResolveNode(m_globalData, resolve->identifier(), divot, divot - start, end - divot);
+ }
+ if (expr->isBracketAccessorNode()) {
+ BracketAccessorNode* bracket = static_cast<BracketAccessorNode*>(expr);
+ return new (m_globalData) DeleteBracketNode(m_globalData, bracket->base(), bracket->subscript(), divot, divot - start, end - divot);
+ }
+ ASSERT(expr->isDotAccessorNode());
+ DotAccessorNode* dot = static_cast<DotAccessorNode*>(expr);
+ return new (m_globalData) DeleteDotNode(m_globalData, dot->base(), dot->identifier(), divot, divot - start, end - divot);
+}
+
+ExpressionNode* ASTBuilder::makeNegateNode(ExpressionNode* n)
+{
+ if (n->isNumber()) {
+ NumberNode* numberNode = static_cast<NumberNode*>(n);
+ numberNode->setValue(-numberNode->value());
+ return numberNode;
+ }
+
+ return new (m_globalData) NegateNode(m_globalData, n);
+}
+
+ExpressionNode* ASTBuilder::makeBitwiseNotNode(ExpressionNode* expr)
+{
+ if (expr->isNumber())
+ return createNumber(~toInt32(static_cast<NumberNode*>(expr)->value()));
+ return new (m_globalData) BitwiseNotNode(m_globalData, expr);
+}
+
+ExpressionNode* ASTBuilder::makeMultNode(ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
+{
+ expr1 = expr1->stripUnaryPlus();
+ expr2 = expr2->stripUnaryPlus();
+
+ if (expr1->isNumber() && expr2->isNumber())
+ return createNumber(static_cast<NumberNode*>(expr1)->value() * static_cast<NumberNode*>(expr2)->value());
+
+ if (expr1->isNumber() && static_cast<NumberNode*>(expr1)->value() == 1)
+ return new (m_globalData) UnaryPlusNode(m_globalData, expr2);
+
+ if (expr2->isNumber() && static_cast<NumberNode*>(expr2)->value() == 1)
+ return new (m_globalData) UnaryPlusNode(m_globalData, expr1);
+
+ return new (m_globalData) MultNode(m_globalData, expr1, expr2, rightHasAssignments);
+}
+
+ExpressionNode* ASTBuilder::makeDivNode(ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
+{
+ expr1 = expr1->stripUnaryPlus();
+ expr2 = expr2->stripUnaryPlus();
+
+ if (expr1->isNumber() && expr2->isNumber())
+ return createNumber(static_cast<NumberNode*>(expr1)->value() / static_cast<NumberNode*>(expr2)->value());
+ return new (m_globalData) DivNode(m_globalData, expr1, expr2, rightHasAssignments);
+}
+
+ExpressionNode* ASTBuilder::makeModNode(ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
+{
+ expr1 = expr1->stripUnaryPlus();
+ expr2 = expr2->stripUnaryPlus();
+
+ if (expr1->isNumber() && expr2->isNumber())
+ return createNumber(fmod(static_cast<NumberNode*>(expr1)->value(), static_cast<NumberNode*>(expr2)->value()));
+ return new (m_globalData) ModNode(m_globalData, expr1, expr2, rightHasAssignments);
+}
+
+ExpressionNode* ASTBuilder::makeAddNode(ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
+{
+ if (expr1->isNumber() && expr2->isNumber())
+ return createNumber(static_cast<NumberNode*>(expr1)->value() + static_cast<NumberNode*>(expr2)->value());
+ return new (m_globalData) AddNode(m_globalData, expr1, expr2, rightHasAssignments);
+}
+
+ExpressionNode* ASTBuilder::makeSubNode(ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
+{
+ expr1 = expr1->stripUnaryPlus();
+ expr2 = expr2->stripUnaryPlus();
+
+ if (expr1->isNumber() && expr2->isNumber())
+ return createNumber(static_cast<NumberNode*>(expr1)->value() - static_cast<NumberNode*>(expr2)->value());
+ return new (m_globalData) SubNode(m_globalData, expr1, expr2, rightHasAssignments);
+}
+
+ExpressionNode* ASTBuilder::makeLeftShiftNode(ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
+{
+ if (expr1->isNumber() && expr2->isNumber())
+ return createNumber(toInt32(static_cast<NumberNode*>(expr1)->value()) << (toUInt32(static_cast<NumberNode*>(expr2)->value()) & 0x1f));
+ return new (m_globalData) LeftShiftNode(m_globalData, expr1, expr2, rightHasAssignments);
+}
+
+ExpressionNode* ASTBuilder::makeRightShiftNode(ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
+{
+ if (expr1->isNumber() && expr2->isNumber())
+ return createNumber(toInt32(static_cast<NumberNode*>(expr1)->value()) >> (toUInt32(static_cast<NumberNode*>(expr2)->value()) & 0x1f));
+ return new (m_globalData) RightShiftNode(m_globalData, expr1, expr2, rightHasAssignments);
+}
+
+ExpressionNode* ASTBuilder::makeURightShiftNode(ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
+{
+ if (expr1->isNumber() && expr2->isNumber())
+ return createNumber(toUInt32(static_cast<NumberNode*>(expr1)->value()) >> (toUInt32(static_cast<NumberNode*>(expr2)->value()) & 0x1f));
+ return new (m_globalData) UnsignedRightShiftNode(m_globalData, expr1, expr2, rightHasAssignments);
+}
+
+ExpressionNode* ASTBuilder::makeBitOrNode(ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
+{
+ if (expr1->isNumber() && expr2->isNumber())
+ return createNumber(toInt32(static_cast<NumberNode*>(expr1)->value()) | toInt32(static_cast<NumberNode*>(expr2)->value()));
+ return new (m_globalData) BitOrNode(m_globalData, expr1, expr2, rightHasAssignments);
+}
+
+ExpressionNode* ASTBuilder::makeBitAndNode(ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
+{
+ if (expr1->isNumber() && expr2->isNumber())
+ return createNumber(toInt32(static_cast<NumberNode*>(expr1)->value()) & toInt32(static_cast<NumberNode*>(expr2)->value()));
+ return new (m_globalData) BitAndNode(m_globalData, expr1, expr2, rightHasAssignments);
+}
+
+ExpressionNode* ASTBuilder::makeBitXOrNode(ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
+{
+ if (expr1->isNumber() && expr2->isNumber())
+ return createNumber(toInt32(static_cast<NumberNode*>(expr1)->value()) ^ toInt32(static_cast<NumberNode*>(expr2)->value()));
+ return new (m_globalData) BitXOrNode(m_globalData, expr1, expr2, rightHasAssignments);
+}
+
+ExpressionNode* ASTBuilder::makeFunctionCallNode(ExpressionNode* func, ArgumentsNode* args, int start, int divot, int end)
+{
+ if (!func->isLocation())
+ return new (m_globalData) FunctionCallValueNode(m_globalData, func, args, divot, divot - start, end - divot);
+ if (func->isResolveNode()) {
+ ResolveNode* resolve = static_cast<ResolveNode*>(func);
+ const Identifier& identifier = resolve->identifier();
+ if (identifier == m_globalData->propertyNames->eval) {
+ usesEval();
+ return new (m_globalData) EvalFunctionCallNode(m_globalData, args, divot, divot - start, end - divot);
+ }
+ return new (m_globalData) FunctionCallResolveNode(m_globalData, identifier, args, divot, divot - start, end - divot);
+ }
+ if (func->isBracketAccessorNode()) {
+ BracketAccessorNode* bracket = static_cast<BracketAccessorNode*>(func);
+ FunctionCallBracketNode* node = new (m_globalData) FunctionCallBracketNode(m_globalData, bracket->base(), bracket->subscript(), args, divot, divot - start, end - divot);
+ node->setSubexpressionInfo(bracket->divot(), bracket->endOffset());
+ return node;
+ }
+ ASSERT(func->isDotAccessorNode());
+ DotAccessorNode* dot = static_cast<DotAccessorNode*>(func);
+ FunctionCallDotNode* node;
+ if (dot->identifier() == m_globalData->propertyNames->call)
+ node = new (m_globalData) CallFunctionCallDotNode(m_globalData, dot->base(), dot->identifier(), args, divot, divot - start, end - divot);
+ else if (dot->identifier() == m_globalData->propertyNames->apply)
+ node = new (m_globalData) ApplyFunctionCallDotNode(m_globalData, dot->base(), dot->identifier(), args, divot, divot - start, end - divot);
+ else
+ node = new (m_globalData) FunctionCallDotNode(m_globalData, dot->base(), dot->identifier(), args, divot, divot - start, end - divot);
+ node->setSubexpressionInfo(dot->divot(), dot->endOffset());
+ return node;
+}
+
+ExpressionNode* ASTBuilder::makeBinaryNode(int token, pair<ExpressionNode*, BinaryOpInfo> lhs, pair<ExpressionNode*, BinaryOpInfo> rhs)
+{
+ switch (token) {
+ case OR:
+ return new (m_globalData) LogicalOpNode(m_globalData, lhs.first, rhs.first, OpLogicalOr);
+
+ case AND:
+ return new (m_globalData) LogicalOpNode(m_globalData, lhs.first, rhs.first, OpLogicalAnd);
+
+ case BITOR:
+ return makeBitOrNode(lhs.first, rhs.first, rhs.second.hasAssignment);
+
+ case BITXOR:
+ return makeBitXOrNode(lhs.first, rhs.first, rhs.second.hasAssignment);
+
+ case BITAND:
+ return makeBitAndNode(lhs.first, rhs.first, rhs.second.hasAssignment);
+
+ case EQEQ:
+ return new (m_globalData) EqualNode(m_globalData, lhs.first, rhs.first, rhs.second.hasAssignment);
+
+ case NE:
+ return new (m_globalData) NotEqualNode(m_globalData, lhs.first, rhs.first, rhs.second.hasAssignment);
+
+ case STREQ:
+ return new (m_globalData) StrictEqualNode(m_globalData, lhs.first, rhs.first, rhs.second.hasAssignment);
+
+ case STRNEQ:
+ return new (m_globalData) NotStrictEqualNode(m_globalData, lhs.first, rhs.first, rhs.second.hasAssignment);
+
+ case LT:
+ return new (m_globalData) LessNode(m_globalData, lhs.first, rhs.first, rhs.second.hasAssignment);
+
+ case GT:
+ return new (m_globalData) GreaterNode(m_globalData, lhs.first, rhs.first, rhs.second.hasAssignment);
+
+ case LE:
+ return new (m_globalData) LessEqNode(m_globalData, lhs.first, rhs.first, rhs.second.hasAssignment);
+
+ case GE:
+ return new (m_globalData) GreaterEqNode(m_globalData, lhs.first, rhs.first, rhs.second.hasAssignment);
+
+ case INSTANCEOF: {
+ InstanceOfNode* node = new (m_globalData) InstanceOfNode(m_globalData, lhs.first, rhs.first, rhs.second.hasAssignment);
+ setExceptionLocation(node, lhs.second.start, rhs.second.start, rhs.second.end);
+ return node;
+ }
+
+ case INTOKEN: {
+ InNode* node = new (m_globalData) InNode(m_globalData, lhs.first, rhs.first, rhs.second.hasAssignment);
+ setExceptionLocation(node, lhs.second.start, rhs.second.start, rhs.second.end);
+ return node;
+ }
+
+ case LSHIFT:
+ return makeLeftShiftNode(lhs.first, rhs.first, rhs.second.hasAssignment);
+
+ case RSHIFT:
+ return makeRightShiftNode(lhs.first, rhs.first, rhs.second.hasAssignment);
+
+ case URSHIFT:
+ return makeURightShiftNode(lhs.first, rhs.first, rhs.second.hasAssignment);
+
+ case PLUS:
+ return makeAddNode(lhs.first, rhs.first, rhs.second.hasAssignment);
+
+ case MINUS:
+ return makeSubNode(lhs.first, rhs.first, rhs.second.hasAssignment);
+
+ case TIMES:
+ return makeMultNode(lhs.first, rhs.first, rhs.second.hasAssignment);
+
+ case DIVIDE:
+ return makeDivNode(lhs.first, rhs.first, rhs.second.hasAssignment);
+
+ case MOD:
+ return makeModNode(lhs.first, rhs.first, rhs.second.hasAssignment);
+ }
+ CRASH();
+ return 0;
+}
+
+ExpressionNode* ASTBuilder::makeAssignNode(ExpressionNode* loc, Operator op, ExpressionNode* expr, bool locHasAssignments, bool exprHasAssignments, int start, int divot, int end)
+{
+ usesAssignment();
+ if (!loc->isLocation())
+ return new (m_globalData) AssignErrorNode(m_globalData, loc, op, expr, divot, divot - start, end - divot);
+
+ if (loc->isResolveNode()) {
+ ResolveNode* resolve = static_cast<ResolveNode*>(loc);
+ if (op == OpEqual) {
+ AssignResolveNode* node = new (m_globalData) AssignResolveNode(m_globalData, resolve->identifier(), expr, exprHasAssignments);
+ setExceptionLocation(node, start, divot, end);
+ return node;
+ }
+ return new (m_globalData) ReadModifyResolveNode(m_globalData, resolve->identifier(), op, expr, exprHasAssignments, divot, divot - start, end - divot);
+ }
+ if (loc->isBracketAccessorNode()) {
+ BracketAccessorNode* bracket = static_cast<BracketAccessorNode*>(loc);
+ if (op == OpEqual)
+ return new (m_globalData) AssignBracketNode(m_globalData, bracket->base(), bracket->subscript(), expr, locHasAssignments, exprHasAssignments, bracket->divot(), bracket->divot() - start, end - bracket->divot());
+ ReadModifyBracketNode* node = new (m_globalData) ReadModifyBracketNode(m_globalData, bracket->base(), bracket->subscript(), op, expr, locHasAssignments, exprHasAssignments, divot, divot - start, end - divot);
+ node->setSubexpressionInfo(bracket->divot(), bracket->endOffset());
+ return node;
+ }
+ ASSERT(loc->isDotAccessorNode());
+ DotAccessorNode* dot = static_cast<DotAccessorNode*>(loc);
+ if (op == OpEqual)
+ return new (m_globalData) AssignDotNode(m_globalData, dot->base(), dot->identifier(), expr, exprHasAssignments, dot->divot(), dot->divot() - start, end - dot->divot());
+
+ ReadModifyDotNode* node = new (m_globalData) ReadModifyDotNode(m_globalData, dot->base(), dot->identifier(), op, expr, exprHasAssignments, divot, divot - start, end - divot);
+ node->setSubexpressionInfo(dot->divot(), dot->endOffset());
+ return node;
+}
+
+ExpressionNode* ASTBuilder::makePrefixNode(ExpressionNode* expr, Operator op, int start, int divot, int end)
+{
+ usesAssignment();
+ if (!expr->isLocation())
+ return new (m_globalData) PrefixErrorNode(m_globalData, expr, op, divot, divot - start, end - divot);
+
+ if (expr->isResolveNode()) {
+ ResolveNode* resolve = static_cast<ResolveNode*>(expr);
+ return new (m_globalData) PrefixResolveNode(m_globalData, resolve->identifier(), op, divot, divot - start, end - divot);
+ }
+ if (expr->isBracketAccessorNode()) {
+ BracketAccessorNode* bracket = static_cast<BracketAccessorNode*>(expr);
+ PrefixBracketNode* node = new (m_globalData) PrefixBracketNode(m_globalData, bracket->base(), bracket->subscript(), op, divot, divot - start, end - divot);
+ node->setSubexpressionInfo(bracket->divot(), bracket->startOffset());
+ return node;
+ }
+ ASSERT(expr->isDotAccessorNode());
+ DotAccessorNode* dot = static_cast<DotAccessorNode*>(expr);
+ PrefixDotNode* node = new (m_globalData) PrefixDotNode(m_globalData, dot->base(), dot->identifier(), op, divot, divot - start, end - divot);
+ node->setSubexpressionInfo(dot->divot(), dot->startOffset());
+ return node;
+}
+
+ExpressionNode* ASTBuilder::makePostfixNode(ExpressionNode* expr, Operator op, int start, int divot, int end)
+{
+ usesAssignment();
+ if (!expr->isLocation())
+ return new (m_globalData) PostfixErrorNode(m_globalData, expr, op, divot, divot - start, end - divot);
+
+ if (expr->isResolveNode()) {
+ ResolveNode* resolve = static_cast<ResolveNode*>(expr);
+ return new (m_globalData) PostfixResolveNode(m_globalData, resolve->identifier(), op, divot, divot - start, end - divot);
+ }
+ if (expr->isBracketAccessorNode()) {
+ BracketAccessorNode* bracket = static_cast<BracketAccessorNode*>(expr);
+ PostfixBracketNode* node = new (m_globalData) PostfixBracketNode(m_globalData, bracket->base(), bracket->subscript(), op, divot, divot - start, end - divot);
+ node->setSubexpressionInfo(bracket->divot(), bracket->endOffset());
+ return node;
+
+ }
+ ASSERT(expr->isDotAccessorNode());
+ DotAccessorNode* dot = static_cast<DotAccessorNode*>(expr);
+ PostfixDotNode* node = new (m_globalData) PostfixDotNode(m_globalData, dot->base(), dot->identifier(), op, divot, divot - start, end - divot);
+ node->setSubexpressionInfo(dot->divot(), dot->endOffset());
+ return node;
+}
+
+}
+
+#endif
diff --git a/Source/JavaScriptCore/parser/JSParser.cpp b/Source/JavaScriptCore/parser/JSParser.cpp
new file mode 100644
index 0000000..4201555
--- /dev/null
+++ b/Source/JavaScriptCore/parser/JSParser.cpp
@@ -0,0 +1,1907 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#include "JSParser.h"
+
+using namespace JSC;
+
+#include "CodeBlock.h"
+#include "JSGlobalData.h"
+#include "NodeInfo.h"
+#include "ASTBuilder.h"
+#include <wtf/HashFunctions.h>
+#include <wtf/WTFThreadData.h>
+#include <utility>
+
+using namespace std;
+
+namespace JSC {
+#define fail() do { m_error = true; return 0; } while (0)
+#define failIfFalse(cond) do { if (!(cond)) fail(); } while (0)
+#define failIfTrue(cond) do { if ((cond)) fail(); } while (0)
+#define failIfTrueIfStrict(cond) do { if ((cond) && strictMode()) fail(); } while (0)
+#define failIfFalseIfStrict(cond) do { if ((!(cond)) && strictMode()) fail(); } while (0)
+#define consumeOrFail(tokenType) do { if (!consume(tokenType)) fail(); } while (0)
+#define matchOrFail(tokenType) do { if (!match(tokenType)) fail(); } while (0)
+#define failIfStackOverflow() do { failIfFalse(canRecurse()); } while (0)
+
+// Macros to make the more common TreeBuilder types a little less verbose
+#define TreeStatement typename TreeBuilder::Statement
+#define TreeExpression typename TreeBuilder::Expression
+#define TreeFormalParameterList typename TreeBuilder::FormalParameterList
+#define TreeSourceElements typename TreeBuilder::SourceElements
+#define TreeClause typename TreeBuilder::Clause
+#define TreeClauseList typename TreeBuilder::ClauseList
+#define TreeConstDeclList typename TreeBuilder::ConstDeclList
+#define TreeArguments typename TreeBuilder::Arguments
+#define TreeArgumentsList typename TreeBuilder::ArgumentsList
+#define TreeFunctionBody typename TreeBuilder::FunctionBody
+#define TreeProperty typename TreeBuilder::Property
+#define TreePropertyList typename TreeBuilder::PropertyList
+
+COMPILE_ASSERT(LastUntaggedToken < 64, LessThan64UntaggedTokens);
+
+class JSParser {
+public:
+ JSParser(Lexer*, JSGlobalData*, FunctionParameters*, bool isStrictContext, bool isFunction, SourceProvider*);
+ bool parseProgram();
+private:
+ struct AllowInOverride {
+ AllowInOverride(JSParser* parser)
+ : m_parser(parser)
+ , m_oldAllowsIn(parser->m_allowsIn)
+ {
+ parser->m_allowsIn = true;
+ }
+ ~AllowInOverride()
+ {
+ m_parser->m_allowsIn = m_oldAllowsIn;
+ }
+ JSParser* m_parser;
+ bool m_oldAllowsIn;
+ };
+
+ void next(Lexer::LexType lexType = Lexer::IdentifyReservedWords)
+ {
+ m_lastLine = m_token.m_info.line;
+ m_lastTokenEnd = m_token.m_info.endOffset;
+ m_lexer->setLastLineNumber(m_lastLine);
+ m_token.m_type = m_lexer->lex(&m_token.m_data, &m_token.m_info, lexType, strictMode());
+ m_tokenCount++;
+ }
+
+ bool consume(JSTokenType expected)
+ {
+ bool result = m_token.m_type == expected;
+ failIfFalse(result);
+ next();
+ return result;
+ }
+
+ bool match(JSTokenType expected)
+ {
+ return m_token.m_type == expected;
+ }
+
+ int tokenStart()
+ {
+ return m_token.m_info.startOffset;
+ }
+
+ int tokenLine()
+ {
+ return m_token.m_info.line;
+ }
+
+ int tokenEnd()
+ {
+ return m_token.m_info.endOffset;
+ }
+
+ void startLoop() { currentScope()->startLoop(); }
+ void endLoop() { currentScope()->endLoop(); }
+ void startSwitch() { currentScope()->startSwitch(); }
+ void endSwitch() { currentScope()->endSwitch(); }
+ void setStrictMode() { currentScope()->setStrictMode(); }
+ bool strictMode() { return currentScope()->strictMode(); }
+ bool isValidStrictMode() { return currentScope()->isValidStrictMode(); }
+ bool declareParameter(const Identifier* ident) { return currentScope()->declareParameter(ident); }
+ bool breakIsValid() { return currentScope()->breakIsValid(); }
+ void pushLabel(const Identifier* label) { currentScope()->pushLabel(label); }
+ void popLabel() { currentScope()->popLabel(); }
+ bool hasLabel(const Identifier* label) { return currentScope()->hasLabel(label); }
+
+ enum SourceElementsMode { CheckForStrictMode, DontCheckForStrictMode };
+ template <SourceElementsMode mode, class TreeBuilder> TreeSourceElements parseSourceElements(TreeBuilder&);
+ template <class TreeBuilder> TreeStatement parseStatement(TreeBuilder&, const Identifier*& directive);
+ template <class TreeBuilder> TreeStatement parseFunctionDeclaration(TreeBuilder&);
+ template <class TreeBuilder> TreeStatement parseVarDeclaration(TreeBuilder&);
+ template <class TreeBuilder> TreeStatement parseConstDeclaration(TreeBuilder&);
+ template <class TreeBuilder> TreeStatement parseDoWhileStatement(TreeBuilder&);
+ template <class TreeBuilder> TreeStatement parseWhileStatement(TreeBuilder&);
+ template <class TreeBuilder> TreeStatement parseForStatement(TreeBuilder&);
+ template <class TreeBuilder> TreeStatement parseBreakStatement(TreeBuilder&);
+ template <class TreeBuilder> TreeStatement parseContinueStatement(TreeBuilder&);
+ template <class TreeBuilder> TreeStatement parseReturnStatement(TreeBuilder&);
+ template <class TreeBuilder> TreeStatement parseThrowStatement(TreeBuilder&);
+ template <class TreeBuilder> TreeStatement parseWithStatement(TreeBuilder&);
+ template <class TreeBuilder> TreeStatement parseSwitchStatement(TreeBuilder&);
+ template <class TreeBuilder> TreeClauseList parseSwitchClauses(TreeBuilder&);
+ template <class TreeBuilder> TreeClause parseSwitchDefaultClause(TreeBuilder&);
+ template <class TreeBuilder> TreeStatement parseTryStatement(TreeBuilder&);
+ template <class TreeBuilder> TreeStatement parseDebuggerStatement(TreeBuilder&);
+ template <class TreeBuilder> TreeStatement parseExpressionStatement(TreeBuilder&);
+ template <class TreeBuilder> TreeStatement parseExpressionOrLabelStatement(TreeBuilder&);
+ template <class TreeBuilder> TreeStatement parseIfStatement(TreeBuilder&);
+ template <class TreeBuilder> ALWAYS_INLINE TreeStatement parseBlockStatement(TreeBuilder&);
+ template <class TreeBuilder> TreeExpression parseExpression(TreeBuilder&);
+ template <class TreeBuilder> TreeExpression parseAssignmentExpression(TreeBuilder&);
+ template <class TreeBuilder> ALWAYS_INLINE TreeExpression parseConditionalExpression(TreeBuilder&);
+ template <class TreeBuilder> ALWAYS_INLINE TreeExpression parseBinaryExpression(TreeBuilder&);
+ template <class TreeBuilder> ALWAYS_INLINE TreeExpression parseUnaryExpression(TreeBuilder&);
+ template <class TreeBuilder> TreeExpression parseMemberExpression(TreeBuilder&);
+ template <class TreeBuilder> ALWAYS_INLINE TreeExpression parsePrimaryExpression(TreeBuilder&);
+ template <class TreeBuilder> ALWAYS_INLINE TreeExpression parseArrayLiteral(TreeBuilder&);
+ template <class TreeBuilder> ALWAYS_INLINE TreeExpression parseObjectLiteral(TreeBuilder&);
+ template <class TreeBuilder> ALWAYS_INLINE TreeExpression parseStrictObjectLiteral(TreeBuilder&);
+ template <class TreeBuilder> ALWAYS_INLINE TreeArguments parseArguments(TreeBuilder&);
+ template <bool strict, class TreeBuilder> ALWAYS_INLINE TreeProperty parseProperty(TreeBuilder&);
+ template <class TreeBuilder> ALWAYS_INLINE TreeFunctionBody parseFunctionBody(TreeBuilder&);
+ template <class TreeBuilder> ALWAYS_INLINE TreeFormalParameterList parseFormalParameters(TreeBuilder&);
+ template <class TreeBuilder> ALWAYS_INLINE TreeExpression parseVarDeclarationList(TreeBuilder&, int& declarations, const Identifier*& lastIdent, TreeExpression& lastInitializer, int& identStart, int& initStart, int& initEnd);
+ template <class TreeBuilder> ALWAYS_INLINE TreeConstDeclList parseConstDeclarationList(TreeBuilder& context);
+ enum FunctionRequirements { FunctionNoRequirements, FunctionNeedsName };
+ template <FunctionRequirements, bool nameIsInContainingScope, class TreeBuilder> bool parseFunctionInfo(TreeBuilder&, const Identifier*&, TreeFormalParameterList&, TreeFunctionBody&, int& openBrace, int& closeBrace, int& bodyStartLine);
+ ALWAYS_INLINE int isBinaryOperator(JSTokenType token);
+ bool allowAutomaticSemicolon();
+
+ bool autoSemiColon()
+ {
+ if (m_token.m_type == SEMICOLON) {
+ next();
+ return true;
+ }
+ return allowAutomaticSemicolon();
+ }
+
+ bool canRecurse()
+ {
+ return m_stack.recursionCheck();
+ }
+
+ int lastTokenEnd() const
+ {
+ return m_lastTokenEnd;
+ }
+
+ ParserArena m_arena;
+ Lexer* m_lexer;
+ StackBounds m_stack;
+ bool m_error;
+ JSGlobalData* m_globalData;
+ JSToken m_token;
+ bool m_allowsIn;
+ int m_tokenCount;
+ int m_lastLine;
+ int m_lastTokenEnd;
+ int m_assignmentCount;
+ int m_nonLHSCount;
+ bool m_syntaxAlreadyValidated;
+ int m_statementDepth;
+ int m_nonTrivialExpressionCount;
+ const Identifier* m_lastIdentifier;
+
+ struct DepthManager {
+ DepthManager(int* depth)
+ : m_originalDepth(*depth)
+ , m_depth(depth)
+ {
+ }
+
+ ~DepthManager()
+ {
+ *m_depth = m_originalDepth;
+ }
+
+ private:
+ int m_originalDepth;
+ int* m_depth;
+ };
+
+ struct Scope {
+ Scope(JSGlobalData* globalData, bool isFunction, bool strictMode)
+ : m_globalData(globalData)
+ , m_shadowsArguments(false)
+ , m_usesEval(false)
+ , m_needsFullActivation(false)
+ , m_allowsNewDecls(true)
+ , m_strictMode(strictMode)
+ , m_isFunction(isFunction)
+ , m_isValidStrictMode(true)
+ , m_loopDepth(0)
+ , m_switchDepth(0)
+ , m_labels(0)
+ {
+ }
+
+ void startSwitch() { m_switchDepth++; }
+ void endSwitch() { m_switchDepth--; }
+ void startLoop() { m_loopDepth++; }
+ void endLoop() { ASSERT(m_loopDepth); m_loopDepth--; }
+ bool inLoop() { return !!m_loopDepth; }
+ bool breakIsValid() { return m_loopDepth || m_switchDepth; }
+
+ void pushLabel(const Identifier* label)
+ {
+ if (!m_labels)
+ m_labels = new LabelStack;
+ m_labels->append(label->impl());
+ }
+
+ void popLabel()
+ {
+ ASSERT(m_labels);
+ ASSERT(m_labels->size());
+ m_labels->removeLast();
+ }
+
+ bool hasLabel(const Identifier* label)
+ {
+ if (!m_labels)
+ return false;
+ for (int i = m_labels->size(); i > 0; i--) {
+ if (m_labels->at(i - 1) == label->impl())
+ return true;
+ }
+ return false;
+ }
+
+ void setIsFunction() { m_isFunction = true; }
+ bool isFunction() { return m_isFunction; }
+
+ bool declareVariable(const Identifier* ident)
+ {
+ bool isValidStrictMode = m_globalData->propertyNames->eval != *ident && m_globalData->propertyNames->arguments != *ident;
+ m_isValidStrictMode = m_isValidStrictMode && isValidStrictMode;
+ m_declaredVariables.add(ident->ustring().impl());
+ return isValidStrictMode;
+ }
+
+ void declareWrite(const Identifier* ident)
+ {
+ ASSERT(m_strictMode);
+ m_writtenVariables.add(ident->impl());
+ }
+
+ void preventNewDecls() { m_allowsNewDecls = false; }
+ bool allowsNewDecls() const { return m_allowsNewDecls; }
+
+ bool declareParameter(const Identifier* ident)
+ {
+ bool isArguments = m_globalData->propertyNames->arguments == *ident;
+ bool isValidStrictMode = m_declaredVariables.add(ident->ustring().impl()).second && m_globalData->propertyNames->eval != *ident && !isArguments;
+ m_isValidStrictMode = m_isValidStrictMode && isValidStrictMode;
+ if (isArguments)
+ m_shadowsArguments = true;
+ return isValidStrictMode;
+ }
+
+ void useVariable(const Identifier* ident, bool isEval)
+ {
+ m_usesEval |= isEval;
+ m_usedVariables.add(ident->ustring().impl());
+ }
+
+ void setNeedsFullActivation() { m_needsFullActivation = true; }
+
+ bool collectFreeVariables(Scope* nestedScope, bool shouldTrackClosedVariables)
+ {
+ if (nestedScope->m_usesEval)
+ m_usesEval = true;
+ IdentifierSet::iterator end = nestedScope->m_usedVariables.end();
+ for (IdentifierSet::iterator ptr = nestedScope->m_usedVariables.begin(); ptr != end; ++ptr) {
+ if (nestedScope->m_declaredVariables.contains(*ptr))
+ continue;
+ m_usedVariables.add(*ptr);
+ if (shouldTrackClosedVariables)
+ m_closedVariables.add(*ptr);
+ }
+ if (nestedScope->m_writtenVariables.size()) {
+ IdentifierSet::iterator end = nestedScope->m_writtenVariables.end();
+ for (IdentifierSet::iterator ptr = nestedScope->m_writtenVariables.begin(); ptr != end; ++ptr) {
+ if (nestedScope->m_declaredVariables.contains(*ptr))
+ continue;
+ m_writtenVariables.add(*ptr);
+ }
+ }
+
+ return true;
+ }
+
+ void getUncapturedWrittenVariables(IdentifierSet& writtenVariables)
+ {
+ IdentifierSet::iterator end = m_writtenVariables.end();
+ for (IdentifierSet::iterator ptr = m_writtenVariables.begin(); ptr != end; ++ptr) {
+ if (!m_declaredVariables.contains(*ptr))
+ writtenVariables.add(*ptr);
+ }
+ }
+
+ void getCapturedVariables(IdentifierSet& capturedVariables)
+ {
+ if (m_needsFullActivation || m_usesEval) {
+ capturedVariables.swap(m_declaredVariables);
+ return;
+ }
+ for (IdentifierSet::iterator ptr = m_closedVariables.begin(); ptr != m_closedVariables.end(); ++ptr) {
+ if (!m_declaredVariables.contains(*ptr))
+ continue;
+ capturedVariables.add(*ptr);
+ }
+ }
+ void setStrictMode() { m_strictMode = true; }
+ bool strictMode() const { return m_strictMode; }
+ bool isValidStrictMode() const { return m_isValidStrictMode; }
+ bool shadowsArguments() const { return m_shadowsArguments; }
+
+ private:
+ JSGlobalData* m_globalData;
+ bool m_shadowsArguments : 1;
+ bool m_usesEval : 1;
+ bool m_needsFullActivation : 1;
+ bool m_allowsNewDecls : 1;
+ bool m_strictMode : 1;
+ bool m_isFunction : 1;
+ bool m_isValidStrictMode : 1;
+ int m_loopDepth;
+ int m_switchDepth;
+ typedef Vector<StringImpl*, 2> LabelStack;
+ LabelStack* m_labels;
+ IdentifierSet m_declaredVariables;
+ IdentifierSet m_usedVariables;
+ IdentifierSet m_closedVariables;
+ IdentifierSet m_writtenVariables;
+ };
+
+ typedef Vector<Scope, 10> ScopeStack;
+
+ struct ScopeRef {
+ ScopeRef(ScopeStack* scopeStack, unsigned index)
+ : m_scopeStack(scopeStack)
+ , m_index(index)
+ {
+ }
+ Scope* operator->() { return &m_scopeStack->at(m_index); }
+ unsigned index() const { return m_index; }
+ private:
+ ScopeStack* m_scopeStack;
+ unsigned m_index;
+ };
+
+ ScopeRef currentScope()
+ {
+ return ScopeRef(&m_scopeStack, m_scopeStack.size() - 1);
+ }
+
+ ScopeRef pushScope()
+ {
+ bool isFunction = false;
+ bool isStrict = false;
+ if (!m_scopeStack.isEmpty()) {
+ isStrict = m_scopeStack.last().strictMode();
+ isFunction = m_scopeStack.last().isFunction();
+ }
+ m_scopeStack.append(Scope(m_globalData, isFunction, isStrict));
+ return currentScope();
+ }
+
+ bool popScope(ScopeRef scope, bool shouldTrackClosedVariables)
+ {
+ ASSERT_UNUSED(scope, scope.index() == m_scopeStack.size() - 1);
+ ASSERT(m_scopeStack.size() > 1);
+ bool result = m_scopeStack[m_scopeStack.size() - 2].collectFreeVariables(&m_scopeStack.last(), shouldTrackClosedVariables);
+ m_scopeStack.removeLast();
+ return result;
+ }
+
+ bool declareVariable(const Identifier* ident)
+ {
+ unsigned i = m_scopeStack.size() - 1;
+ ASSERT(i < m_scopeStack.size());
+ while (!m_scopeStack[i].allowsNewDecls()) {
+ i--;
+ ASSERT(i < m_scopeStack.size());
+ }
+ return m_scopeStack[i].declareVariable(ident);
+ }
+
+ void declareWrite(const Identifier* ident)
+ {
+ if (!m_syntaxAlreadyValidated)
+ m_scopeStack.last().declareWrite(ident);
+ }
+
+ ScopeStack m_scopeStack;
+};
+
+int jsParse(JSGlobalData* globalData, FunctionParameters* parameters, JSParserStrictness strictness, JSParserMode parserMode, const SourceCode* source)
+{
+ JSParser parser(globalData->lexer, globalData, parameters, strictness == JSParseStrict, parserMode == JSParseFunctionCode, source->provider());
+ return parser.parseProgram();
+}
+
+JSParser::JSParser(Lexer* lexer, JSGlobalData* globalData, FunctionParameters* parameters, bool inStrictContext, bool isFunction, SourceProvider* provider)
+ : m_lexer(lexer)
+ , m_stack(globalData->stack())
+ , m_error(false)
+ , m_globalData(globalData)
+ , m_allowsIn(true)
+ , m_tokenCount(0)
+ , m_lastLine(0)
+ , m_lastTokenEnd(0)
+ , m_assignmentCount(0)
+ , m_nonLHSCount(0)
+ , m_syntaxAlreadyValidated(provider->isValid())
+ , m_statementDepth(0)
+ , m_nonTrivialExpressionCount(0)
+ , m_lastIdentifier(0)
+{
+ ScopeRef scope = pushScope();
+ if (isFunction)
+ scope->setIsFunction();
+ if (inStrictContext)
+ scope->setStrictMode();
+ if (parameters) {
+ for (unsigned i = 0; i < parameters->size(); i++)
+ scope->declareParameter(&parameters->at(i));
+ }
+ next();
+ m_lexer->setLastLineNumber(tokenLine());
+}
+
+bool JSParser::parseProgram()
+{
+ ASTBuilder context(m_globalData, m_lexer);
+ if (m_lexer->isReparsing())
+ m_statementDepth--;
+ ScopeRef scope = currentScope();
+ SourceElements* sourceElements = parseSourceElements<CheckForStrictMode>(context);
+ if (!sourceElements || !consume(EOFTOK))
+ return true;
+ IdentifierSet capturedVariables;
+ scope->getCapturedVariables(capturedVariables);
+ CodeFeatures features = context.features();
+ if (scope->strictMode())
+ features |= StrictModeFeature;
+ if (scope->shadowsArguments())
+ features |= ShadowsArgumentsFeature;
+
+ m_globalData->parser->didFinishParsing(sourceElements, context.varDeclarations(), context.funcDeclarations(), features,
+ m_lastLine, context.numConstants(), capturedVariables);
+ return false;
+}
+
+bool JSParser::allowAutomaticSemicolon()
+{
+ return match(CLOSEBRACE) || match(EOFTOK) || m_lexer->prevTerminator();
+}
+
+template <JSParser::SourceElementsMode mode, class TreeBuilder> TreeSourceElements JSParser::parseSourceElements(TreeBuilder& context)
+{
+ TreeSourceElements sourceElements = context.createSourceElements();
+ bool seenNonDirective = false;
+ const Identifier* directive = 0;
+ unsigned startOffset = m_token.m_info.startOffset;
+ bool hasSetStrict = false;
+ while (TreeStatement statement = parseStatement(context, directive)) {
+ if (mode == CheckForStrictMode && !seenNonDirective) {
+ if (directive) {
+ if (!hasSetStrict && m_globalData->propertyNames->useStrictIdentifier == *directive) {
+ setStrictMode();
+ hasSetStrict = true;
+ failIfFalse(isValidStrictMode());
+ m_lexer->setOffset(startOffset);
+ next();
+ failIfTrue(m_error);
+ continue;
+ }
+ } else
+ seenNonDirective = true;
+ }
+ context.appendStatement(sourceElements, statement);
+ }
+
+ if (m_error)
+ fail();
+ return sourceElements;
+}
+
+template <class TreeBuilder> TreeStatement JSParser::parseVarDeclaration(TreeBuilder& context)
+{
+ ASSERT(match(VAR));
+ int start = tokenLine();
+ int end = 0;
+ int scratch;
+ const Identifier* scratch1 = 0;
+ TreeExpression scratch2 = 0;
+ int scratch3 = 0;
+ TreeExpression varDecls = parseVarDeclarationList(context, scratch, scratch1, scratch2, scratch3, scratch3, scratch3);
+ failIfTrue(m_error);
+ failIfFalse(autoSemiColon());
+
+ return context.createVarStatement(varDecls, start, end);
+}
+
+template <class TreeBuilder> TreeStatement JSParser::parseConstDeclaration(TreeBuilder& context)
+{
+ ASSERT(match(CONSTTOKEN));
+ int start = tokenLine();
+ int end = 0;
+ TreeConstDeclList constDecls = parseConstDeclarationList(context);
+ failIfTrue(m_error);
+ failIfFalse(autoSemiColon());
+
+ return context.createConstStatement(constDecls, start, end);
+}
+
+template <class TreeBuilder> TreeStatement JSParser::parseDoWhileStatement(TreeBuilder& context)
+{
+ ASSERT(match(DO));
+ int startLine = tokenLine();
+ next();
+ const Identifier* unused = 0;
+ startLoop();
+ TreeStatement statement = parseStatement(context, unused);
+ endLoop();
+ failIfFalse(statement);
+ int endLine = tokenLine();
+ consumeOrFail(WHILE);
+ consumeOrFail(OPENPAREN);
+ TreeExpression expr = parseExpression(context);
+ failIfFalse(expr);
+ consumeOrFail(CLOSEPAREN);
+ if (match(SEMICOLON))
+ next(); // Always performs automatic semicolon insertion.
+ return context.createDoWhileStatement(statement, expr, startLine, endLine);
+}
+
+template <class TreeBuilder> TreeStatement JSParser::parseWhileStatement(TreeBuilder& context)
+{
+ ASSERT(match(WHILE));
+ int startLine = tokenLine();
+ next();
+ consumeOrFail(OPENPAREN);
+ TreeExpression expr = parseExpression(context);
+ failIfFalse(expr);
+ int endLine = tokenLine();
+ consumeOrFail(CLOSEPAREN);
+ const Identifier* unused = 0;
+ startLoop();
+ TreeStatement statement = parseStatement(context, unused);
+ endLoop();
+ failIfFalse(statement);
+ return context.createWhileStatement(expr, statement, startLine, endLine);
+}
+
+template <class TreeBuilder> TreeExpression JSParser::parseVarDeclarationList(TreeBuilder& context, int& declarations, const Identifier*& lastIdent, TreeExpression& lastInitializer, int& identStart, int& initStart, int& initEnd)
+{
+ TreeExpression varDecls = 0;
+ do {
+ declarations++;
+ next();
+ matchOrFail(IDENT);
+
+ int varStart = tokenStart();
+ identStart = varStart;
+ const Identifier* name = m_token.m_data.ident;
+ lastIdent = name;
+ next();
+ bool hasInitializer = match(EQUAL);
+ failIfFalseIfStrict(declareVariable(name));
+ context.addVar(name, (hasInitializer || (!m_allowsIn && match(INTOKEN))) ? DeclarationStacks::HasInitializer : 0);
+ if (hasInitializer) {
+ int varDivot = tokenStart() + 1;
+ initStart = tokenStart();
+ next(); // consume '='
+ int initialAssignments = m_assignmentCount;
+ TreeExpression initializer = parseAssignmentExpression(context);
+ initEnd = lastTokenEnd();
+ lastInitializer = initializer;
+ failIfFalse(initializer);
+
+ TreeExpression node = context.createAssignResolve(*name, initializer, initialAssignments != m_assignmentCount, varStart, varDivot, lastTokenEnd());
+ if (!varDecls)
+ varDecls = node;
+ else
+ varDecls = context.combineCommaNodes(varDecls, node);
+ }
+ } while (match(COMMA));
+ return varDecls;
+}
+
+template <class TreeBuilder> TreeConstDeclList JSParser::parseConstDeclarationList(TreeBuilder& context)
+{
+ failIfTrue(strictMode());
+ TreeConstDeclList constDecls = 0;
+ TreeConstDeclList tail = 0;
+ do {
+ next();
+ matchOrFail(IDENT);
+ const Identifier* name = m_token.m_data.ident;
+ next();
+ bool hasInitializer = match(EQUAL);
+ declareVariable(name);
+ context.addVar(name, DeclarationStacks::IsConstant | (hasInitializer ? DeclarationStacks::HasInitializer : 0));
+ TreeExpression initializer = 0;
+ if (hasInitializer) {
+ next(); // consume '='
+ initializer = parseAssignmentExpression(context);
+ }
+ tail = context.appendConstDecl(tail, name, initializer);
+ if (!constDecls)
+ constDecls = tail;
+ } while (match(COMMA));
+ return constDecls;
+}
+
+template <class TreeBuilder> TreeStatement JSParser::parseForStatement(TreeBuilder& context)
+{
+ ASSERT(match(FOR));
+ int startLine = tokenLine();
+ next();
+ consumeOrFail(OPENPAREN);
+ int nonLHSCount = m_nonLHSCount;
+ int declarations = 0;
+ int declsStart = 0;
+ int declsEnd = 0;
+ TreeExpression decls = 0;
+ bool hasDeclaration = false;
+ if (match(VAR)) {
+ /*
+ for (var IDENT in expression) statement
+ for (var IDENT = expression in expression) statement
+ for (var varDeclarationList; expressionOpt; expressionOpt)
+ */
+ hasDeclaration = true;
+ const Identifier* forInTarget = 0;
+ TreeExpression forInInitializer = 0;
+ m_allowsIn = false;
+ int initStart = 0;
+ int initEnd = 0;
+ decls = parseVarDeclarationList(context, declarations, forInTarget, forInInitializer, declsStart, initStart, initEnd);
+ m_allowsIn = true;
+ if (m_error)
+ fail();
+
+ // Remainder of a standard for loop is handled identically
+ if (declarations > 1 || match(SEMICOLON))
+ goto standardForLoop;
+
+ // Handle for-in with var declaration
+ int inLocation = tokenStart();
+ if (!consume(INTOKEN))
+ fail();
+
+ TreeExpression expr = parseExpression(context);
+ failIfFalse(expr);
+ int exprEnd = lastTokenEnd();
+
+ int endLine = tokenLine();
+ consumeOrFail(CLOSEPAREN);
+
+ const Identifier* unused = 0;
+ startLoop();
+ TreeStatement statement = parseStatement(context, unused);
+ endLoop();
+ failIfFalse(statement);
+
+ return context.createForInLoop(forInTarget, forInInitializer, expr, statement, declsStart, inLocation, exprEnd, initStart, initEnd, startLine, endLine);
+ }
+
+ if (!match(SEMICOLON)) {
+ m_allowsIn = false;
+ declsStart = tokenStart();
+ decls = parseExpression(context);
+ declsEnd = lastTokenEnd();
+ m_allowsIn = true;
+ failIfFalse(decls);
+ }
+
+ if (match(SEMICOLON)) {
+ standardForLoop:
+ // Standard for loop
+ next();
+ TreeExpression condition = 0;
+
+ if (!match(SEMICOLON)) {
+ condition = parseExpression(context);
+ failIfFalse(condition);
+ }
+ consumeOrFail(SEMICOLON);
+
+ TreeExpression increment = 0;
+ if (!match(CLOSEPAREN)) {
+ increment = parseExpression(context);
+ failIfFalse(increment);
+ }
+ int endLine = tokenLine();
+ consumeOrFail(CLOSEPAREN);
+ const Identifier* unused = 0;
+ startLoop();
+ TreeStatement statement = parseStatement(context, unused);
+ endLoop();
+ failIfFalse(statement);
+ return context.createForLoop(decls, condition, increment, statement, hasDeclaration, startLine, endLine);
+ }
+
+ // For-in loop
+ failIfFalse(nonLHSCount == m_nonLHSCount);
+ consumeOrFail(INTOKEN);
+ TreeExpression expr = parseExpression(context);
+ failIfFalse(expr);
+ int exprEnd = lastTokenEnd();
+ int endLine = tokenLine();
+ consumeOrFail(CLOSEPAREN);
+ const Identifier* unused = 0;
+ startLoop();
+ TreeStatement statement = parseStatement(context, unused);
+ endLoop();
+ failIfFalse(statement);
+
+ return context.createForInLoop(decls, expr, statement, declsStart, declsEnd, exprEnd, startLine, endLine);
+}
+
+template <class TreeBuilder> TreeStatement JSParser::parseBreakStatement(TreeBuilder& context)
+{
+ ASSERT(match(BREAK));
+ int startCol = tokenStart();
+ int endCol = tokenEnd();
+ int startLine = tokenLine();
+ int endLine = tokenLine();
+ next();
+
+ if (autoSemiColon()) {
+ failIfFalseIfStrict(breakIsValid());
+ return context.createBreakStatement(startCol, endCol, startLine, endLine);
+ }
+ matchOrFail(IDENT);
+ const Identifier* ident = m_token.m_data.ident;
+ failIfFalseIfStrict(hasLabel(ident));
+ endCol = tokenEnd();
+ endLine = tokenLine();
+ next();
+ failIfFalse(autoSemiColon());
+ return context.createBreakStatement(ident, startCol, endCol, startLine, endLine);
+}
+
+template <class TreeBuilder> TreeStatement JSParser::parseContinueStatement(TreeBuilder& context)
+{
+ ASSERT(match(CONTINUE));
+ int startCol = tokenStart();
+ int endCol = tokenEnd();
+ int startLine = tokenLine();
+ int endLine = tokenLine();
+ next();
+
+ if (autoSemiColon()) {
+ failIfFalseIfStrict(breakIsValid());
+ return context.createContinueStatement(startCol, endCol, startLine, endLine);
+ }
+ matchOrFail(IDENT);
+ const Identifier* ident = m_token.m_data.ident;
+ failIfFalseIfStrict(hasLabel(ident));
+ endCol = tokenEnd();
+ endLine = tokenLine();
+ next();
+ failIfFalse(autoSemiColon());
+ return context.createContinueStatement(ident, startCol, endCol, startLine, endLine);
+}
+
+template <class TreeBuilder> TreeStatement JSParser::parseReturnStatement(TreeBuilder& context)
+{
+ ASSERT(match(RETURN));
+ failIfFalseIfStrict(currentScope()->isFunction());
+ int startLine = tokenLine();
+ int endLine = startLine;
+ int start = tokenStart();
+ int end = tokenEnd();
+ next();
+ // We do the auto semicolon check before attempting to parse an expression
+ // as we need to ensure the a line break after the return correctly terminates
+ // the statement
+ if (match(SEMICOLON))
+ endLine = tokenLine();
+ if (autoSemiColon())
+ return context.createReturnStatement(0, start, end, startLine, endLine);
+ TreeExpression expr = parseExpression(context);
+ failIfFalse(expr);
+ end = lastTokenEnd();
+ if (match(SEMICOLON))
+ endLine = tokenLine();
+ failIfFalse(autoSemiColon());
+ return context.createReturnStatement(expr, start, end, startLine, endLine);
+}
+
+template <class TreeBuilder> TreeStatement JSParser::parseThrowStatement(TreeBuilder& context)
+{
+ ASSERT(match(THROW));
+ int eStart = tokenStart();
+ int startLine = tokenLine();
+ next();
+
+ failIfTrue(autoSemiColon());
+
+ TreeExpression expr = parseExpression(context);
+ failIfFalse(expr);
+ int eEnd = lastTokenEnd();
+ int endLine = tokenLine();
+ failIfFalse(autoSemiColon());
+
+ return context.createThrowStatement(expr, eStart, eEnd, startLine, endLine);
+}
+
+template <class TreeBuilder> TreeStatement JSParser::parseWithStatement(TreeBuilder& context)
+{
+ ASSERT(match(WITH));
+ failIfTrue(strictMode());
+ currentScope()->setNeedsFullActivation();
+ int startLine = tokenLine();
+ next();
+ consumeOrFail(OPENPAREN);
+ int start = tokenStart();
+ TreeExpression expr = parseExpression(context);
+ failIfFalse(expr);
+ int end = lastTokenEnd();
+
+ int endLine = tokenLine();
+ consumeOrFail(CLOSEPAREN);
+ const Identifier* unused = 0;
+ TreeStatement statement = parseStatement(context, unused);
+ failIfFalse(statement);
+
+ return context.createWithStatement(expr, statement, start, end, startLine, endLine);
+}
+
+template <class TreeBuilder> TreeStatement JSParser::parseSwitchStatement(TreeBuilder& context)
+{
+ ASSERT(match(SWITCH));
+ int startLine = tokenLine();
+ next();
+ consumeOrFail(OPENPAREN);
+ TreeExpression expr = parseExpression(context);
+ failIfFalse(expr);
+ int endLine = tokenLine();
+ consumeOrFail(CLOSEPAREN);
+ consumeOrFail(OPENBRACE);
+ startSwitch();
+ TreeClauseList firstClauses = parseSwitchClauses(context);
+ failIfTrue(m_error);
+
+ TreeClause defaultClause = parseSwitchDefaultClause(context);
+ failIfTrue(m_error);
+
+ TreeClauseList secondClauses = parseSwitchClauses(context);
+ failIfTrue(m_error);
+ endSwitch();
+ consumeOrFail(CLOSEBRACE);
+
+ return context.createSwitchStatement(expr, firstClauses, defaultClause, secondClauses, startLine, endLine);
+
+}
+
+template <class TreeBuilder> TreeClauseList JSParser::parseSwitchClauses(TreeBuilder& context)
+{
+ if (!match(CASE))
+ return 0;
+ next();
+ TreeExpression condition = parseExpression(context);
+ failIfFalse(condition);
+ consumeOrFail(COLON);
+ TreeSourceElements statements = parseSourceElements<DontCheckForStrictMode>(context);
+ failIfFalse(statements);
+ TreeClause clause = context.createClause(condition, statements);
+ TreeClauseList clauseList = context.createClauseList(clause);
+ TreeClauseList tail = clauseList;
+
+ while (match(CASE)) {
+ next();
+ TreeExpression condition = parseExpression(context);
+ failIfFalse(condition);
+ consumeOrFail(COLON);
+ TreeSourceElements statements = parseSourceElements<DontCheckForStrictMode>(context);
+ failIfFalse(statements);
+ clause = context.createClause(condition, statements);
+ tail = context.createClauseList(tail, clause);
+ }
+ return clauseList;
+}
+
+template <class TreeBuilder> TreeClause JSParser::parseSwitchDefaultClause(TreeBuilder& context)
+{
+ if (!match(DEFAULT))
+ return 0;
+ next();
+ consumeOrFail(COLON);
+ TreeSourceElements statements = parseSourceElements<DontCheckForStrictMode>(context);
+ failIfFalse(statements);
+ return context.createClause(0, statements);
+}
+
+template <class TreeBuilder> TreeStatement JSParser::parseTryStatement(TreeBuilder& context)
+{
+ ASSERT(match(TRY));
+ TreeStatement tryBlock = 0;
+ const Identifier* ident = &m_globalData->propertyNames->nullIdentifier;
+ bool catchHasEval = false;
+ TreeStatement catchBlock = 0;
+ TreeStatement finallyBlock = 0;
+ int firstLine = tokenLine();
+ next();
+ matchOrFail(OPENBRACE);
+
+ tryBlock = parseBlockStatement(context);
+ failIfFalse(tryBlock);
+ int lastLine = m_lastLine;
+
+ if (match(CATCH)) {
+ currentScope()->setNeedsFullActivation();
+ next();
+ consumeOrFail(OPENPAREN);
+ matchOrFail(IDENT);
+ ident = m_token.m_data.ident;
+ next();
+ ScopeRef catchScope = pushScope();
+ failIfFalseIfStrict(catchScope->declareVariable(ident));
+ catchScope->preventNewDecls();
+ consumeOrFail(CLOSEPAREN);
+ matchOrFail(OPENBRACE);
+ int initialEvalCount = context.evalCount();
+ catchBlock = parseBlockStatement(context);
+ failIfFalse(catchBlock);
+ catchHasEval = initialEvalCount != context.evalCount();
+ failIfFalse(popScope(catchScope, TreeBuilder::NeedsFreeVariableInfo));
+ }
+
+ if (match(FINALLY)) {
+ next();
+ matchOrFail(OPENBRACE);
+ finallyBlock = parseBlockStatement(context);
+ failIfFalse(finallyBlock);
+ }
+ failIfFalse(catchBlock || finallyBlock);
+ return context.createTryStatement(tryBlock, ident, catchHasEval, catchBlock, finallyBlock, firstLine, lastLine);
+}
+
+template <class TreeBuilder> TreeStatement JSParser::parseDebuggerStatement(TreeBuilder& context)
+{
+ ASSERT(match(DEBUGGER));
+ int startLine = tokenLine();
+ int endLine = startLine;
+ next();
+ if (match(SEMICOLON))
+ startLine = tokenLine();
+ failIfFalse(autoSemiColon());
+ return context.createDebugger(startLine, endLine);
+}
+
+template <class TreeBuilder> TreeStatement JSParser::parseBlockStatement(TreeBuilder& context)
+{
+ ASSERT(match(OPENBRACE));
+ int start = tokenLine();
+ next();
+ if (match(CLOSEBRACE)) {
+ next();
+ return context.createBlockStatement(0, start, m_lastLine);
+ }
+ TreeSourceElements subtree = parseSourceElements<DontCheckForStrictMode>(context);
+ failIfFalse(subtree);
+ matchOrFail(CLOSEBRACE);
+ next();
+ return context.createBlockStatement(subtree, start, m_lastLine);
+}
+
+template <class TreeBuilder> TreeStatement JSParser::parseStatement(TreeBuilder& context, const Identifier*& directive)
+{
+ DepthManager statementDepth(&m_statementDepth);
+ m_statementDepth++;
+ directive = 0;
+ int nonTrivialExpressionCount = 0;
+ failIfStackOverflow();
+ switch (m_token.m_type) {
+ case OPENBRACE:
+ return parseBlockStatement(context);
+ case VAR:
+ return parseVarDeclaration(context);
+ case CONSTTOKEN:
+ return parseConstDeclaration(context);
+ case FUNCTION:
+ failIfFalseIfStrict(m_statementDepth == 1);
+ return parseFunctionDeclaration(context);
+ case SEMICOLON:
+ next();
+ return context.createEmptyStatement();
+ case IF:
+ return parseIfStatement(context);
+ case DO:
+ return parseDoWhileStatement(context);
+ case WHILE:
+ return parseWhileStatement(context);
+ case FOR:
+ return parseForStatement(context);
+ case CONTINUE:
+ return parseContinueStatement(context);
+ case BREAK:
+ return parseBreakStatement(context);
+ case RETURN:
+ return parseReturnStatement(context);
+ case WITH:
+ return parseWithStatement(context);
+ case SWITCH:
+ return parseSwitchStatement(context);
+ case THROW:
+ return parseThrowStatement(context);
+ case TRY:
+ return parseTryStatement(context);
+ case DEBUGGER:
+ return parseDebuggerStatement(context);
+ case EOFTOK:
+ case CASE:
+ case CLOSEBRACE:
+ case DEFAULT:
+ // These tokens imply the end of a set of source elements
+ return 0;
+ case IDENT:
+ return parseExpressionOrLabelStatement(context);
+ case STRING:
+ directive = m_token.m_data.ident;
+ nonTrivialExpressionCount = m_nonTrivialExpressionCount;
+ default:
+ TreeStatement exprStatement = parseExpressionStatement(context);
+ if (directive && nonTrivialExpressionCount != m_nonTrivialExpressionCount)
+ directive = 0;
+ return exprStatement;
+ }
+}
+
+template <class TreeBuilder> TreeFormalParameterList JSParser::parseFormalParameters(TreeBuilder& context)
+{
+ matchOrFail(IDENT);
+ failIfFalseIfStrict(declareParameter(m_token.m_data.ident));
+ TreeFormalParameterList list = context.createFormalParameterList(*m_token.m_data.ident);
+ TreeFormalParameterList tail = list;
+ next();
+ while (match(COMMA)) {
+ next();
+ matchOrFail(IDENT);
+ const Identifier* ident = m_token.m_data.ident;
+ failIfFalseIfStrict(declareParameter(ident));
+ next();
+ tail = context.createFormalParameterList(tail, *ident);
+ }
+ return list;
+}
+
+template <class TreeBuilder> TreeFunctionBody JSParser::parseFunctionBody(TreeBuilder& context)
+{
+ if (match(CLOSEBRACE))
+ return context.createFunctionBody(strictMode());
+ DepthManager statementDepth(&m_statementDepth);
+ m_statementDepth = 0;
+ typename TreeBuilder::FunctionBodyBuilder bodyBuilder(m_globalData, m_lexer);
+ failIfFalse(parseSourceElements<CheckForStrictMode>(bodyBuilder));
+ return context.createFunctionBody(strictMode());
+}
+
+template <JSParser::FunctionRequirements requirements, bool nameIsInContainingScope, class TreeBuilder> bool JSParser::parseFunctionInfo(TreeBuilder& context, const Identifier*& name, TreeFormalParameterList& parameters, TreeFunctionBody& body, int& openBracePos, int& closeBracePos, int& bodyStartLine)
+{
+ ScopeRef functionScope = pushScope();
+ functionScope->setIsFunction();
+ if (match(IDENT)) {
+ name = m_token.m_data.ident;
+ next();
+ if (!nameIsInContainingScope)
+ failIfFalseIfStrict(functionScope->declareVariable(name));
+ } else if (requirements == FunctionNeedsName)
+ return false;
+ consumeOrFail(OPENPAREN);
+ if (!match(CLOSEPAREN)) {
+ parameters = parseFormalParameters(context);
+ failIfFalse(parameters);
+ }
+ consumeOrFail(CLOSEPAREN);
+ matchOrFail(OPENBRACE);
+
+ openBracePos = m_token.m_data.intValue;
+ bodyStartLine = tokenLine();
+ next();
+
+ body = parseFunctionBody(context);
+ failIfFalse(body);
+ if (functionScope->strictMode() && name) {
+ failIfTrue(m_globalData->propertyNames->arguments == *name);
+ failIfTrue(m_globalData->propertyNames->eval == *name);
+ }
+ failIfFalse(popScope(functionScope, TreeBuilder::NeedsFreeVariableInfo));
+ matchOrFail(CLOSEBRACE);
+ closeBracePos = m_token.m_data.intValue;
+ next();
+ return true;
+}
+
+template <class TreeBuilder> TreeStatement JSParser::parseFunctionDeclaration(TreeBuilder& context)
+{
+ ASSERT(match(FUNCTION));
+ next();
+ const Identifier* name = 0;
+ TreeFormalParameterList parameters = 0;
+ TreeFunctionBody body = 0;
+ int openBracePos = 0;
+ int closeBracePos = 0;
+ int bodyStartLine = 0;
+ failIfFalse((parseFunctionInfo<FunctionNeedsName, true>(context, name, parameters, body, openBracePos, closeBracePos, bodyStartLine)));
+ failIfFalse(name);
+ failIfFalseIfStrict(declareVariable(name));
+ return context.createFuncDeclStatement(name, body, parameters, openBracePos, closeBracePos, bodyStartLine, m_lastLine);
+}
+
+template <class TreeBuilder> TreeStatement JSParser::parseExpressionOrLabelStatement(TreeBuilder& context)
+{
+
+ /* Expression and Label statements are ambiguous at LL(1), to avoid
+ * the cost of having a token buffer to support LL(2) we simply assume
+ * we have an expression statement, and then only look for a label if that
+ * parse fails.
+ */
+ int start = tokenStart();
+ int startLine = tokenLine();
+ const Identifier* ident = m_token.m_data.ident;
+ int currentToken = m_tokenCount;
+ TreeExpression expression = parseExpression(context);
+ failIfFalse(expression);
+ if (autoSemiColon())
+ return context.createExprStatement(expression, startLine, m_lastLine);
+ failIfFalse(currentToken + 1 == m_tokenCount);
+ int end = tokenEnd();
+ consumeOrFail(COLON);
+ const Identifier* unused = 0;
+ if (strictMode() && !m_syntaxAlreadyValidated)
+ pushLabel(ident);
+ TreeStatement statement = parseStatement(context, unused);
+ if (strictMode() && !m_syntaxAlreadyValidated)
+ popLabel();
+ failIfFalse(statement);
+ return context.createLabelStatement(ident, statement, start, end);
+}
+
+template <class TreeBuilder> TreeStatement JSParser::parseExpressionStatement(TreeBuilder& context)
+{
+ int startLine = tokenLine();
+ TreeExpression expression = parseExpression(context);
+ failIfFalse(expression);
+ failIfFalse(autoSemiColon());
+ return context.createExprStatement(expression, startLine, m_lastLine);
+}
+
+template <class TreeBuilder> TreeStatement JSParser::parseIfStatement(TreeBuilder& context)
+{
+ ASSERT(match(IF));
+
+ int start = tokenLine();
+ next();
+
+ consumeOrFail(OPENPAREN);
+
+ TreeExpression condition = parseExpression(context);
+ failIfFalse(condition);
+ int end = tokenLine();
+ consumeOrFail(CLOSEPAREN);
+
+ const Identifier* unused = 0;
+ TreeStatement trueBlock = parseStatement(context, unused);
+ failIfFalse(trueBlock);
+
+ if (!match(ELSE))
+ return context.createIfStatement(condition, trueBlock, start, end);
+
+ Vector<TreeExpression> exprStack;
+ Vector<pair<int, int> > posStack;
+ Vector<TreeStatement> statementStack;
+ bool trailingElse = false;
+ do {
+ next();
+ if (!match(IF)) {
+ const Identifier* unused = 0;
+ TreeStatement block = parseStatement(context, unused);
+ failIfFalse(block);
+ statementStack.append(block);
+ trailingElse = true;
+ break;
+ }
+ int innerStart = tokenLine();
+ next();
+
+ consumeOrFail(OPENPAREN);
+
+ TreeExpression innerCondition = parseExpression(context);
+ failIfFalse(innerCondition);
+ int innerEnd = tokenLine();
+ consumeOrFail(CLOSEPAREN);
+ const Identifier* unused = 0;
+ TreeStatement innerTrueBlock = parseStatement(context, unused);
+ failIfFalse(innerTrueBlock);
+ exprStack.append(innerCondition);
+ posStack.append(make_pair(innerStart, innerEnd));
+ statementStack.append(innerTrueBlock);
+ } while (match(ELSE));
+
+ if (!trailingElse) {
+ TreeExpression condition = exprStack.last();
+ exprStack.removeLast();
+ TreeStatement trueBlock = statementStack.last();
+ statementStack.removeLast();
+ pair<int, int> pos = posStack.last();
+ posStack.removeLast();
+ statementStack.append(context.createIfStatement(condition, trueBlock, pos.first, pos.second));
+ }
+
+ while (!exprStack.isEmpty()) {
+ TreeExpression condition = exprStack.last();
+ exprStack.removeLast();
+ TreeStatement falseBlock = statementStack.last();
+ statementStack.removeLast();
+ TreeStatement trueBlock = statementStack.last();
+ statementStack.removeLast();
+ pair<int, int> pos = posStack.last();
+ posStack.removeLast();
+ statementStack.append(context.createIfStatement(condition, trueBlock, falseBlock, pos.first, pos.second));
+ }
+
+ return context.createIfStatement(condition, trueBlock, statementStack.last(), start, end);
+}
+
+template <class TreeBuilder> TreeExpression JSParser::parseExpression(TreeBuilder& context)
+{
+ failIfStackOverflow();
+ TreeExpression node = parseAssignmentExpression(context);
+ failIfFalse(node);
+ if (!match(COMMA))
+ return node;
+ next();
+ m_nonTrivialExpressionCount++;
+ m_nonLHSCount++;
+ TreeExpression right = parseAssignmentExpression(context);
+ failIfFalse(right);
+ typename TreeBuilder::Comma commaNode = context.createCommaExpr(node, right);
+ while (match(COMMA)) {
+ next();
+ right = parseAssignmentExpression(context);
+ failIfFalse(right);
+ context.appendToComma(commaNode, right);
+ }
+ return commaNode;
+}
+
+
+template <typename TreeBuilder> TreeExpression JSParser::parseAssignmentExpression(TreeBuilder& context)
+{
+ failIfStackOverflow();
+ int start = tokenStart();
+ int initialAssignmentCount = m_assignmentCount;
+ int initialNonLHSCount = m_nonLHSCount;
+ TreeExpression lhs = parseConditionalExpression(context);
+ failIfFalse(lhs);
+ if (initialNonLHSCount != m_nonLHSCount)
+ return lhs;
+
+ int assignmentStack = 0;
+ Operator op;
+ bool hadAssignment = false;
+ while (true) {
+ switch (m_token.m_type) {
+ case EQUAL: op = OpEqual; break;
+ case PLUSEQUAL: op = OpPlusEq; break;
+ case MINUSEQUAL: op = OpMinusEq; break;
+ case MULTEQUAL: op = OpMultEq; break;
+ case DIVEQUAL: op = OpDivEq; break;
+ case LSHIFTEQUAL: op = OpLShift; break;
+ case RSHIFTEQUAL: op = OpRShift; break;
+ case URSHIFTEQUAL: op = OpURShift; break;
+ case ANDEQUAL: op = OpAndEq; break;
+ case XOREQUAL: op = OpXOrEq; break;
+ case OREQUAL: op = OpOrEq; break;
+ case MODEQUAL: op = OpModEq; break;
+ default:
+ goto end;
+ }
+ m_nonTrivialExpressionCount++;
+ hadAssignment = true;
+ context.assignmentStackAppend(assignmentStack, lhs, start, tokenStart(), m_assignmentCount, op);
+ start = tokenStart();
+ m_assignmentCount++;
+ next();
+ if (strictMode() && m_lastIdentifier && context.isResolve(lhs)) {
+ failIfTrueIfStrict(m_globalData->propertyNames->eval == *m_lastIdentifier);
+ declareWrite(m_lastIdentifier);
+ m_lastIdentifier = 0;
+ }
+ lhs = parseConditionalExpression(context);
+ failIfFalse(lhs);
+ if (initialNonLHSCount != m_nonLHSCount)
+ break;
+ }
+end:
+ if (hadAssignment)
+ m_nonLHSCount++;
+
+ if (!TreeBuilder::CreatesAST)
+ return lhs;
+
+ while (assignmentStack)
+ lhs = context.createAssignment(assignmentStack, lhs, initialAssignmentCount, m_assignmentCount, lastTokenEnd());
+
+ return lhs;
+}
+
+template <class TreeBuilder> TreeExpression JSParser::parseConditionalExpression(TreeBuilder& context)
+{
+ TreeExpression cond = parseBinaryExpression(context);
+ failIfFalse(cond);
+ if (!match(QUESTION))
+ return cond;
+ m_nonTrivialExpressionCount++;
+ m_nonLHSCount++;
+ next();
+ TreeExpression lhs = parseAssignmentExpression(context);
+ consumeOrFail(COLON);
+
+ TreeExpression rhs = parseAssignmentExpression(context);
+ failIfFalse(rhs);
+ return context.createConditionalExpr(cond, lhs, rhs);
+}
+
+ALWAYS_INLINE static bool isUnaryOp(JSTokenType token)
+{
+ return token & UnaryOpTokenFlag;
+}
+
+int JSParser::isBinaryOperator(JSTokenType token)
+{
+ if (m_allowsIn)
+ return token & (BinaryOpTokenPrecedenceMask << BinaryOpTokenAllowsInPrecedenceAdditionalShift);
+ return token & BinaryOpTokenPrecedenceMask;
+}
+
+template <class TreeBuilder> TreeExpression JSParser::parseBinaryExpression(TreeBuilder& context)
+{
+
+ int operandStackDepth = 0;
+ int operatorStackDepth = 0;
+ while (true) {
+ int exprStart = tokenStart();
+ int initialAssignments = m_assignmentCount;
+ TreeExpression current = parseUnaryExpression(context);
+ failIfFalse(current);
+
+ context.appendBinaryExpressionInfo(operandStackDepth, current, exprStart, lastTokenEnd(), lastTokenEnd(), initialAssignments != m_assignmentCount);
+ int precedence = isBinaryOperator(m_token.m_type);
+ if (!precedence)
+ break;
+ m_nonTrivialExpressionCount++;
+ m_nonLHSCount++;
+ int operatorToken = m_token.m_type;
+ next();
+
+ while (operatorStackDepth && context.operatorStackHasHigherPrecedence(operatorStackDepth, precedence)) {
+ ASSERT(operandStackDepth > 1);
+
+ typename TreeBuilder::BinaryOperand rhs = context.getFromOperandStack(-1);
+ typename TreeBuilder::BinaryOperand lhs = context.getFromOperandStack(-2);
+ context.shrinkOperandStackBy(operandStackDepth, 2);
+ context.appendBinaryOperation(operandStackDepth, operatorStackDepth, lhs, rhs);
+ context.operatorStackPop(operatorStackDepth);
+ }
+ context.operatorStackAppend(operatorStackDepth, operatorToken, precedence);
+ }
+ while (operatorStackDepth) {
+ ASSERT(operandStackDepth > 1);
+
+ typename TreeBuilder::BinaryOperand rhs = context.getFromOperandStack(-1);
+ typename TreeBuilder::BinaryOperand lhs = context.getFromOperandStack(-2);
+ context.shrinkOperandStackBy(operandStackDepth, 2);
+ context.appendBinaryOperation(operandStackDepth, operatorStackDepth, lhs, rhs);
+ context.operatorStackPop(operatorStackDepth);
+ }
+ return context.popOperandStack(operandStackDepth);
+}
+
+
+template <bool complete, class TreeBuilder> TreeProperty JSParser::parseProperty(TreeBuilder& context)
+{
+ bool wasIdent = false;
+ switch (m_token.m_type) {
+ namedProperty:
+ case IDENT:
+ wasIdent = true;
+ case STRING: {
+ const Identifier* ident = m_token.m_data.ident;
+ next(Lexer::IgnoreReservedWords);
+ if (match(COLON)) {
+ next();
+ TreeExpression node = parseAssignmentExpression(context);
+ failIfFalse(node);
+ return context.template createProperty<complete>(ident, node, PropertyNode::Constant);
+ }
+ failIfFalse(wasIdent);
+ matchOrFail(IDENT);
+ const Identifier* accessorName = 0;
+ TreeFormalParameterList parameters = 0;
+ TreeFunctionBody body = 0;
+ int openBracePos = 0;
+ int closeBracePos = 0;
+ int bodyStartLine = 0;
+ PropertyNode::Type type;
+ if (*ident == m_globalData->propertyNames->get)
+ type = PropertyNode::Getter;
+ else if (*ident == m_globalData->propertyNames->set)
+ type = PropertyNode::Setter;
+ else
+ fail();
+ failIfFalse((parseFunctionInfo<FunctionNeedsName, false>(context, accessorName, parameters, body, openBracePos, closeBracePos, bodyStartLine)));
+ return context.template createGetterOrSetterProperty<complete>(type, accessorName, parameters, body, openBracePos, closeBracePos, bodyStartLine, m_lastLine);
+ }
+ case NUMBER: {
+ double propertyName = m_token.m_data.doubleValue;
+ next();
+ consumeOrFail(COLON);
+ TreeExpression node = parseAssignmentExpression(context);
+ failIfFalse(node);
+ return context.template createProperty<complete>(m_globalData, propertyName, node, PropertyNode::Constant);
+ }
+ default:
+ failIfFalse(m_token.m_type & KeywordTokenFlag);
+ goto namedProperty;
+ }
+}
+
+template <class TreeBuilder> TreeExpression JSParser::parseObjectLiteral(TreeBuilder& context)
+{
+ int startOffset = m_token.m_data.intValue;
+ consumeOrFail(OPENBRACE);
+
+ if (match(CLOSEBRACE)) {
+ next();
+ return context.createObjectLiteral();
+ }
+
+ TreeProperty property = parseProperty<false>(context);
+ failIfFalse(property);
+ if (!m_syntaxAlreadyValidated && context.getType(property) != PropertyNode::Constant) {
+ m_lexer->setOffset(startOffset);
+ next();
+ return parseStrictObjectLiteral(context);
+ }
+ TreePropertyList propertyList = context.createPropertyList(property);
+ TreePropertyList tail = propertyList;
+ while (match(COMMA)) {
+ next();
+ // allow extra comma, see http://bugs.webkit.org/show_bug.cgi?id=5939
+ if (match(CLOSEBRACE))
+ break;
+ property = parseProperty<false>(context);
+ failIfFalse(property);
+ if (!m_syntaxAlreadyValidated && context.getType(property) != PropertyNode::Constant) {
+ m_lexer->setOffset(startOffset);
+ next();
+ return parseStrictObjectLiteral(context);
+ }
+ tail = context.createPropertyList(property, tail);
+ }
+
+ consumeOrFail(CLOSEBRACE);
+
+ return context.createObjectLiteral(propertyList);
+}
+
+template <class TreeBuilder> TreeExpression JSParser::parseStrictObjectLiteral(TreeBuilder& context)
+{
+ consumeOrFail(OPENBRACE);
+
+ if (match(CLOSEBRACE)) {
+ next();
+ return context.createObjectLiteral();
+ }
+
+ TreeProperty property = parseProperty<true>(context);
+ failIfFalse(property);
+
+ typedef HashMap<RefPtr<StringImpl>, unsigned, IdentifierRepHash> ObjectValidationMap;
+ ObjectValidationMap objectValidator;
+ // Add the first property
+ if (!m_syntaxAlreadyValidated)
+ objectValidator.add(context.getName(property).impl(), context.getType(property));
+
+ TreePropertyList propertyList = context.createPropertyList(property);
+ TreePropertyList tail = propertyList;
+ while (match(COMMA)) {
+ next();
+ // allow extra comma, see http://bugs.webkit.org/show_bug.cgi?id=5939
+ if (match(CLOSEBRACE))
+ break;
+ property = parseProperty<true>(context);
+ failIfFalse(property);
+ if (!m_syntaxAlreadyValidated) {
+ std::pair<ObjectValidationMap::iterator, bool> propertyEntryIter = objectValidator.add(context.getName(property).impl(), context.getType(property));
+ if (!propertyEntryIter.second) {
+ failIfTrue(strictMode());
+ if ((context.getType(property) & propertyEntryIter.first->second) != PropertyNode::Constant) {
+ // Can't have multiple getters or setters with the same name, nor can we define
+ // a property as both an accessor and a constant value
+ failIfTrue(context.getType(property) & propertyEntryIter.first->second);
+ failIfTrue((context.getType(property) | propertyEntryIter.first->second) & PropertyNode::Constant);
+ }
+ }
+ }
+ tail = context.createPropertyList(property, tail);
+ }
+
+ consumeOrFail(CLOSEBRACE);
+
+ return context.createObjectLiteral(propertyList);
+}
+
+template <class TreeBuilder> TreeExpression JSParser::parseArrayLiteral(TreeBuilder& context)
+{
+ consumeOrFail(OPENBRACKET);
+
+ int elisions = 0;
+ while (match(COMMA)) {
+ next();
+ elisions++;
+ }
+ if (match(CLOSEBRACKET)) {
+ next();
+ return context.createArray(elisions);
+ }
+
+ TreeExpression elem = parseAssignmentExpression(context);
+ failIfFalse(elem);
+ typename TreeBuilder::ElementList elementList = context.createElementList(elisions, elem);
+ typename TreeBuilder::ElementList tail = elementList;
+ elisions = 0;
+ while (match(COMMA)) {
+ next();
+ elisions = 0;
+
+ while (match(COMMA)) {
+ next();
+ elisions++;
+ }
+
+ if (match(CLOSEBRACKET)) {
+ next();
+ return context.createArray(elisions, elementList);
+ }
+ TreeExpression elem = parseAssignmentExpression(context);
+ failIfFalse(elem);
+ tail = context.createElementList(tail, elisions, elem);
+ }
+
+ consumeOrFail(CLOSEBRACKET);
+
+ return context.createArray(elementList);
+}
+
+template <class TreeBuilder> TreeExpression JSParser::parsePrimaryExpression(TreeBuilder& context)
+{
+ switch (m_token.m_type) {
+ case OPENBRACE:
+ if (strictMode())
+ return parseStrictObjectLiteral(context);
+ return parseObjectLiteral(context);
+ case OPENBRACKET:
+ return parseArrayLiteral(context);
+ case OPENPAREN: {
+ next();
+ int oldNonLHSCount = m_nonLHSCount;
+ TreeExpression result = parseExpression(context);
+ m_nonLHSCount = oldNonLHSCount;
+ consumeOrFail(CLOSEPAREN);
+
+ return result;
+ }
+ case THISTOKEN: {
+ next();
+ return context.thisExpr();
+ }
+ case IDENT: {
+ int start = tokenStart();
+ const Identifier* ident = m_token.m_data.ident;
+ next();
+ currentScope()->useVariable(ident, m_globalData->propertyNames->eval == *ident);
+ m_lastIdentifier = ident;
+ return context.createResolve(ident, start);
+ }
+ case STRING: {
+ const Identifier* ident = m_token.m_data.ident;
+ next();
+ return context.createString(ident);
+ }
+ case NUMBER: {
+ double d = m_token.m_data.doubleValue;
+ next();
+ return context.createNumberExpr(d);
+ }
+ case NULLTOKEN: {
+ next();
+ return context.createNull();
+ }
+ case TRUETOKEN: {
+ next();
+ return context.createBoolean(true);
+ }
+ case FALSETOKEN: {
+ next();
+ return context.createBoolean(false);
+ }
+ case DIVEQUAL:
+ case DIVIDE: {
+ /* regexp */
+ const Identifier* pattern;
+ const Identifier* flags;
+ if (match(DIVEQUAL))
+ failIfFalse(m_lexer->scanRegExp(pattern, flags, '='));
+ else
+ failIfFalse(m_lexer->scanRegExp(pattern, flags));
+
+ int start = tokenStart();
+ next();
+ return context.createRegex(*pattern, *flags, start);
+ }
+ default:
+ fail();
+ }
+}
+
+template <class TreeBuilder> TreeArguments JSParser::parseArguments(TreeBuilder& context)
+{
+ consumeOrFail(OPENPAREN);
+ if (match(CLOSEPAREN)) {
+ next();
+ return context.createArguments();
+ }
+ TreeExpression firstArg = parseAssignmentExpression(context);
+ failIfFalse(firstArg);
+
+ TreeArgumentsList argList = context.createArgumentsList(firstArg);
+ TreeArgumentsList tail = argList;
+ while (match(COMMA)) {
+ next();
+ TreeExpression arg = parseAssignmentExpression(context);
+ failIfFalse(arg);
+ tail = context.createArgumentsList(tail, arg);
+ }
+ consumeOrFail(CLOSEPAREN);
+ return context.createArguments(argList);
+}
+
+template <class TreeBuilder> TreeExpression JSParser::parseMemberExpression(TreeBuilder& context)
+{
+ TreeExpression base = 0;
+ int start = tokenStart();
+ int expressionStart = start;
+ int newCount = 0;
+ while (match(NEW)) {
+ next();
+ newCount++;
+ }
+
+ if (match(FUNCTION)) {
+ const Identifier* name = &m_globalData->propertyNames->nullIdentifier;
+ TreeFormalParameterList parameters = 0;
+ TreeFunctionBody body = 0;
+ int openBracePos = 0;
+ int closeBracePos = 0;
+ int bodyStartLine = 0;
+ next();
+ failIfFalse((parseFunctionInfo<FunctionNoRequirements, false>(context, name, parameters, body, openBracePos, closeBracePos, bodyStartLine)));
+ base = context.createFunctionExpr(name, body, parameters, openBracePos, closeBracePos, bodyStartLine, m_lastLine);
+ } else
+ base = parsePrimaryExpression(context);
+
+ failIfFalse(base);
+ while (true) {
+ switch (m_token.m_type) {
+ case OPENBRACKET: {
+ m_nonTrivialExpressionCount++;
+ int expressionEnd = lastTokenEnd();
+ next();
+ int nonLHSCount = m_nonLHSCount;
+ int initialAssignments = m_assignmentCount;
+ TreeExpression property = parseExpression(context);
+ failIfFalse(property);
+ base = context.createBracketAccess(base, property, initialAssignments != m_assignmentCount, expressionStart, expressionEnd, tokenEnd());
+ if (!consume(CLOSEBRACKET))
+ fail();
+ m_nonLHSCount = nonLHSCount;
+ break;
+ }
+ case OPENPAREN: {
+ m_nonTrivialExpressionCount++;
+ if (newCount) {
+ newCount--;
+ if (match(OPENPAREN)) {
+ int exprEnd = lastTokenEnd();
+ TreeArguments arguments = parseArguments(context);
+ failIfFalse(arguments);
+ base = context.createNewExpr(base, arguments, start, exprEnd, lastTokenEnd());
+ } else
+ base = context.createNewExpr(base, start, lastTokenEnd());
+ } else {
+ int nonLHSCount = m_nonLHSCount;
+ int expressionEnd = lastTokenEnd();
+ TreeArguments arguments = parseArguments(context);
+ failIfFalse(arguments);
+ base = context.makeFunctionCallNode(base, arguments, expressionStart, expressionEnd, lastTokenEnd());
+ m_nonLHSCount = nonLHSCount;
+ }
+ break;
+ }
+ case DOT: {
+ m_nonTrivialExpressionCount++;
+ int expressionEnd = lastTokenEnd();
+ next(Lexer::IgnoreReservedWords);
+ matchOrFail(IDENT);
+ base = context.createDotAccess(base, *m_token.m_data.ident, expressionStart, expressionEnd, tokenEnd());
+ next();
+ break;
+ }
+ default:
+ goto endMemberExpression;
+ }
+ }
+endMemberExpression:
+ while (newCount--)
+ base = context.createNewExpr(base, start, lastTokenEnd());
+ return base;
+}
+
+template <class TreeBuilder> TreeExpression JSParser::parseUnaryExpression(TreeBuilder& context)
+{
+ AllowInOverride allowInOverride(this);
+ int tokenStackDepth = 0;
+ bool modifiesExpr = false;
+ bool requiresLExpr = false;
+ while (isUnaryOp(m_token.m_type)) {
+ if (strictMode()) {
+ switch (m_token.m_type) {
+ case PLUSPLUS:
+ case MINUSMINUS:
+ case AUTOPLUSPLUS:
+ case AUTOMINUSMINUS:
+ failIfTrue(requiresLExpr);
+ modifiesExpr = true;
+ requiresLExpr = true;
+ break;
+ case DELETETOKEN:
+ failIfTrue(requiresLExpr);
+ requiresLExpr = true;
+ break;
+ default:
+ failIfTrue(requiresLExpr);
+ break;
+ }
+ }
+ m_nonLHSCount++;
+ context.appendUnaryToken(tokenStackDepth, m_token.m_type, tokenStart());
+ next();
+ m_nonTrivialExpressionCount++;
+ }
+ int subExprStart = tokenStart();
+ TreeExpression expr = parseMemberExpression(context);
+ failIfFalse(expr);
+ bool isEvalOrArguments = false;
+ if (strictMode() && !m_syntaxAlreadyValidated) {
+ if (context.isResolve(expr)) {
+ isEvalOrArguments = m_globalData->propertyNames->eval == *m_lastIdentifier;
+ if (!isEvalOrArguments && currentScope()->isFunction())
+ isEvalOrArguments = m_globalData->propertyNames->arguments == *m_lastIdentifier;
+ }
+ }
+ failIfTrueIfStrict(isEvalOrArguments && modifiesExpr);
+ switch (m_token.m_type) {
+ case PLUSPLUS:
+ m_nonTrivialExpressionCount++;
+ m_nonLHSCount++;
+ expr = context.makePostfixNode(expr, OpPlusPlus, subExprStart, lastTokenEnd(), tokenEnd());
+ m_assignmentCount++;
+ failIfTrueIfStrict(isEvalOrArguments);
+ failIfTrueIfStrict(requiresLExpr);
+ next();
+ break;
+ case MINUSMINUS:
+ m_nonTrivialExpressionCount++;
+ m_nonLHSCount++;
+ expr = context.makePostfixNode(expr, OpMinusMinus, subExprStart, lastTokenEnd(), tokenEnd());
+ m_assignmentCount++;
+ failIfTrueIfStrict(isEvalOrArguments);
+ failIfTrueIfStrict(requiresLExpr);
+ next();
+ break;
+ default:
+ break;
+ }
+
+ int end = lastTokenEnd();
+
+ if (!TreeBuilder::CreatesAST && (m_syntaxAlreadyValidated || !strictMode()))
+ return expr;
+
+ while (tokenStackDepth) {
+ switch (context.unaryTokenStackLastType(tokenStackDepth)) {
+ case EXCLAMATION:
+ expr = context.createLogicalNot(expr);
+ break;
+ case TILDE:
+ expr = context.makeBitwiseNotNode(expr);
+ break;
+ case MINUS:
+ expr = context.makeNegateNode(expr);
+ break;
+ case PLUS:
+ expr = context.createUnaryPlus(expr);
+ break;
+ case PLUSPLUS:
+ case AUTOPLUSPLUS:
+ expr = context.makePrefixNode(expr, OpPlusPlus, context.unaryTokenStackLastStart(tokenStackDepth), subExprStart + 1, end);
+ m_assignmentCount++;
+ break;
+ case MINUSMINUS:
+ case AUTOMINUSMINUS:
+ expr = context.makePrefixNode(expr, OpMinusMinus, context.unaryTokenStackLastStart(tokenStackDepth), subExprStart + 1, end);
+ m_assignmentCount++;
+ break;
+ case TYPEOF:
+ expr = context.makeTypeOfNode(expr);
+ break;
+ case VOIDTOKEN:
+ expr = context.createVoid(expr);
+ break;
+ case DELETETOKEN:
+ failIfTrueIfStrict(context.isResolve(expr));
+ expr = context.makeDeleteNode(expr, context.unaryTokenStackLastStart(tokenStackDepth), end, end);
+ break;
+ default:
+ // If we get here something has gone horribly horribly wrong
+ CRASH();
+ }
+ subExprStart = context.unaryTokenStackLastStart(tokenStackDepth);
+ context.unaryTokenStackRemoveLast(tokenStackDepth);
+ }
+ return expr;
+}
+
+}
diff --git a/Source/JavaScriptCore/parser/JSParser.h b/Source/JavaScriptCore/parser/JSParser.h
new file mode 100644
index 0000000..0676b41
--- /dev/null
+++ b/Source/JavaScriptCore/parser/JSParser.h
@@ -0,0 +1,164 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef JSParser_h
+#define JSParser_h
+
+namespace JSC {
+
+class ExecState;
+class FunctionParameters;
+class Identifier;
+class JSGlobalData;
+class SourceCode;
+
+enum {
+ UnaryOpTokenFlag = 64,
+ KeywordTokenFlag = 128,
+ BinaryOpTokenPrecedenceShift = 8,
+ BinaryOpTokenAllowsInPrecedenceAdditionalShift = 4,
+ BinaryOpTokenPrecedenceMask = 15 << BinaryOpTokenPrecedenceShift,
+};
+
+#define BINARY_OP_PRECEDENCE(prec) (((prec) << BinaryOpTokenPrecedenceShift) | ((prec) << (BinaryOpTokenPrecedenceShift + BinaryOpTokenAllowsInPrecedenceAdditionalShift)))
+#define IN_OP_PRECEDENCE(prec) ((prec) << (BinaryOpTokenPrecedenceShift + BinaryOpTokenAllowsInPrecedenceAdditionalShift))
+
+enum JSTokenType {
+ NULLTOKEN = KeywordTokenFlag,
+ TRUETOKEN,
+ FALSETOKEN,
+ BREAK,
+ CASE,
+ DEFAULT,
+ FOR,
+ NEW,
+ VAR,
+ CONSTTOKEN,
+ CONTINUE,
+ FUNCTION,
+ RETURN,
+ IF,
+ THISTOKEN,
+ DO,
+ WHILE,
+ SWITCH,
+ WITH,
+ RESERVED,
+ THROW,
+ TRY,
+ CATCH,
+ FINALLY,
+ DEBUGGER,
+ ELSE,
+ OPENBRACE = 0,
+ CLOSEBRACE,
+ OPENPAREN,
+ CLOSEPAREN,
+ OPENBRACKET,
+ CLOSEBRACKET,
+ COMMA,
+ QUESTION,
+ NUMBER,
+ IDENT,
+ STRING,
+ SEMICOLON,
+ COLON,
+ DOT,
+ ERRORTOK,
+ EOFTOK,
+ EQUAL,
+ PLUSEQUAL,
+ MINUSEQUAL,
+ MULTEQUAL,
+ DIVEQUAL,
+ LSHIFTEQUAL,
+ RSHIFTEQUAL,
+ URSHIFTEQUAL,
+ ANDEQUAL,
+ MODEQUAL,
+ XOREQUAL,
+ OREQUAL,
+ LastUntaggedToken,
+
+ // Begin tagged tokens
+ PLUSPLUS = 0 | UnaryOpTokenFlag,
+ MINUSMINUS = 1 | UnaryOpTokenFlag,
+ EXCLAMATION = 2 | UnaryOpTokenFlag,
+ TILDE = 3 | UnaryOpTokenFlag,
+ AUTOPLUSPLUS = 4 | UnaryOpTokenFlag,
+ AUTOMINUSMINUS = 5 | UnaryOpTokenFlag,
+ TYPEOF = 6 | UnaryOpTokenFlag | KeywordTokenFlag,
+ VOIDTOKEN = 7 | UnaryOpTokenFlag | KeywordTokenFlag,
+ DELETETOKEN = 8 | UnaryOpTokenFlag | KeywordTokenFlag,
+ OR = 0 | BINARY_OP_PRECEDENCE(1),
+ AND = 1 | BINARY_OP_PRECEDENCE(2),
+ BITOR = 2 | BINARY_OP_PRECEDENCE(3),
+ BITXOR = 3 | BINARY_OP_PRECEDENCE(4),
+ BITAND = 4 | BINARY_OP_PRECEDENCE(5),
+ EQEQ = 5 | BINARY_OP_PRECEDENCE(6),
+ NE = 6 | BINARY_OP_PRECEDENCE(6),
+ STREQ = 7 | BINARY_OP_PRECEDENCE(6),
+ STRNEQ = 8 | BINARY_OP_PRECEDENCE(6),
+ LT = 9 | BINARY_OP_PRECEDENCE(7),
+ GT = 10 | BINARY_OP_PRECEDENCE(7),
+ LE = 11 | BINARY_OP_PRECEDENCE(7),
+ GE = 12 | BINARY_OP_PRECEDENCE(7),
+ INSTANCEOF = 13 | BINARY_OP_PRECEDENCE(7) | KeywordTokenFlag,
+ INTOKEN = 14 | IN_OP_PRECEDENCE(7) | KeywordTokenFlag,
+ LSHIFT = 15 | BINARY_OP_PRECEDENCE(8),
+ RSHIFT = 16 | BINARY_OP_PRECEDENCE(8),
+ URSHIFT = 17 | BINARY_OP_PRECEDENCE(8),
+ PLUS = 18 | BINARY_OP_PRECEDENCE(9) | UnaryOpTokenFlag,
+ MINUS = 19 | BINARY_OP_PRECEDENCE(9) | UnaryOpTokenFlag,
+ TIMES = 20 | BINARY_OP_PRECEDENCE(10),
+ DIVIDE = 21 | BINARY_OP_PRECEDENCE(10),
+ MOD = 22 | BINARY_OP_PRECEDENCE(10)
+};
+
+union JSTokenData {
+ int intValue;
+ double doubleValue;
+ const Identifier* ident;
+};
+
+struct JSTokenInfo {
+ JSTokenInfo() : line(0) {}
+ int line;
+ int startOffset;
+ int endOffset;
+};
+
+struct JSToken {
+ JSTokenType m_type;
+ JSTokenData m_data;
+ JSTokenInfo m_info;
+};
+
+enum JSParserStrictness { JSParseNormal, JSParseStrict };
+enum JSParserMode { JSParseProgramCode, JSParseFunctionCode };
+
+int jsParse(JSGlobalData*, FunctionParameters*, JSParserStrictness, JSParserMode, const SourceCode*);
+}
+#endif // JSParser_h
diff --git a/Source/JavaScriptCore/parser/Keywords.table b/Source/JavaScriptCore/parser/Keywords.table
new file mode 100644
index 0000000..490c1cc
--- /dev/null
+++ b/Source/JavaScriptCore/parser/Keywords.table
@@ -0,0 +1,72 @@
+# main keywords
+@begin mainTable 41
+
+# types
+null NULLTOKEN
+true TRUETOKEN
+false FALSETOKEN
+
+# keywords
+break BREAK
+case CASE
+catch CATCH
+const CONSTTOKEN
+default DEFAULT
+finally FINALLY
+for FOR
+instanceof INSTANCEOF
+new NEW
+var VAR
+continue CONTINUE
+function FUNCTION
+return RETURN
+void VOIDTOKEN
+delete DELETETOKEN
+if IF
+this THISTOKEN
+do DO
+while WHILE
+else ELSE
+in INTOKEN
+switch SWITCH
+throw THROW
+try TRY
+typeof TYPEOF
+with WITH
+debugger DEBUGGER
+
+# reserved for future use
+class RESERVED
+enum RESERVED
+export RESERVED
+extends RESERVED
+import RESERVED
+super RESERVED
+
+# these words are reserved for future use in the ECMA spec, but not in WinIE
+# (see http://bugs.webkit.org/show_bug.cgi?id=6179)
+# abstract RESERVED
+# boolean RESERVED
+# byte RESERVED
+# char RESERVED
+# double RESERVED
+# final RESERVED
+# float RESERVED
+# goto RESERVED
+# implements RESERVED
+# int RESERVED
+# interface RESERVED
+# long RESERVED
+# native RESERVED
+# package RESERVED
+# private RESERVED
+# protected RESERVED
+# public RESERVED
+# short RESERVED
+# static RESERVED
+# synchronized RESERVED
+# throws RESERVED
+# transient RESERVED
+# volatile RESERVED
+@end
+
diff --git a/Source/JavaScriptCore/parser/Lexer.cpp b/Source/JavaScriptCore/parser/Lexer.cpp
new file mode 100644
index 0000000..ff7079f
--- /dev/null
+++ b/Source/JavaScriptCore/parser/Lexer.cpp
@@ -0,0 +1,1196 @@
+/*
+ * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
+ * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2007 Cameron Zwarich (cwzwarich@uwaterloo.ca)
+ * Copyright (C) 2010 Zoltan Herczeg (zherczeg@inf.u-szeged.hu)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+#include "Lexer.h"
+
+#include "JSFunction.h"
+
+#include "JSGlobalObjectFunctions.h"
+#include "Identifier.h"
+#include "NodeInfo.h"
+#include "Nodes.h"
+#include "dtoa.h"
+#include <ctype.h>
+#include <limits.h>
+#include <string.h>
+#include <wtf/Assertions.h>
+
+using namespace WTF;
+using namespace Unicode;
+
+#include "JSParser.h"
+#include "Lookup.h"
+#include "Lexer.lut.h"
+
+namespace JSC {
+
+
+enum CharacterType {
+ // Types for the main switch
+
+ // The first three types are fixed, and also used for identifying
+ // ASCII alpha and alphanumeric characters (see isIdentStart and isIdentPart).
+ CharacterIdentifierStart,
+ CharacterZero,
+ CharacterNumber,
+
+ CharacterInvalid,
+ CharacterLineTerminator,
+ CharacterExclamationMark,
+ CharacterOpenParen,
+ CharacterCloseParen,
+ CharacterOpenBracket,
+ CharacterCloseBracket,
+ CharacterComma,
+ CharacterColon,
+ CharacterQuestion,
+ CharacterTilde,
+ CharacterQuote,
+ CharacterDot,
+ CharacterSlash,
+ CharacterBackSlash,
+ CharacterSemicolon,
+ CharacterOpenBrace,
+ CharacterCloseBrace,
+
+ CharacterAdd,
+ CharacterSub,
+ CharacterMultiply,
+ CharacterModulo,
+ CharacterAnd,
+ CharacterXor,
+ CharacterOr,
+ CharacterLess,
+ CharacterGreater,
+ CharacterEqual,
+
+ // Other types (only one so far)
+ CharacterWhiteSpace,
+};
+
+// 128 ASCII codes
+static const unsigned short typesOfASCIICharacters[128] = {
+/* 0 - Null */ CharacterInvalid,
+/* 1 - Start of Heading */ CharacterInvalid,
+/* 2 - Start of Text */ CharacterInvalid,
+/* 3 - End of Text */ CharacterInvalid,
+/* 4 - End of Transm. */ CharacterInvalid,
+/* 5 - Enquiry */ CharacterInvalid,
+/* 6 - Acknowledgment */ CharacterInvalid,
+/* 7 - Bell */ CharacterInvalid,
+/* 8 - Back Space */ CharacterInvalid,
+/* 9 - Horizontal Tab */ CharacterWhiteSpace,
+/* 10 - Line Feed */ CharacterLineTerminator,
+/* 11 - Vertical Tab */ CharacterWhiteSpace,
+/* 12 - Form Feed */ CharacterWhiteSpace,
+/* 13 - Carriage Return */ CharacterLineTerminator,
+/* 14 - Shift Out */ CharacterInvalid,
+/* 15 - Shift In */ CharacterInvalid,
+/* 16 - Data Line Escape */ CharacterInvalid,
+/* 17 - Device Control 1 */ CharacterInvalid,
+/* 18 - Device Control 2 */ CharacterInvalid,
+/* 19 - Device Control 3 */ CharacterInvalid,
+/* 20 - Device Control 4 */ CharacterInvalid,
+/* 21 - Negative Ack. */ CharacterInvalid,
+/* 22 - Synchronous Idle */ CharacterInvalid,
+/* 23 - End of Transmit */ CharacterInvalid,
+/* 24 - Cancel */ CharacterInvalid,
+/* 25 - End of Medium */ CharacterInvalid,
+/* 26 - Substitute */ CharacterInvalid,
+/* 27 - Escape */ CharacterInvalid,
+/* 28 - File Separator */ CharacterInvalid,
+/* 29 - Group Separator */ CharacterInvalid,
+/* 30 - Record Separator */ CharacterInvalid,
+/* 31 - Unit Separator */ CharacterInvalid,
+/* 32 - Space */ CharacterWhiteSpace,
+/* 33 - ! */ CharacterExclamationMark,
+/* 34 - " */ CharacterQuote,
+/* 35 - # */ CharacterInvalid,
+/* 36 - $ */ CharacterIdentifierStart,
+/* 37 - % */ CharacterModulo,
+/* 38 - & */ CharacterAnd,
+/* 39 - ' */ CharacterQuote,
+/* 40 - ( */ CharacterOpenParen,
+/* 41 - ) */ CharacterCloseParen,
+/* 42 - * */ CharacterMultiply,
+/* 43 - + */ CharacterAdd,
+/* 44 - , */ CharacterComma,
+/* 45 - - */ CharacterSub,
+/* 46 - . */ CharacterDot,
+/* 47 - / */ CharacterSlash,
+/* 48 - 0 */ CharacterZero,
+/* 49 - 1 */ CharacterNumber,
+/* 50 - 2 */ CharacterNumber,
+/* 51 - 3 */ CharacterNumber,
+/* 52 - 4 */ CharacterNumber,
+/* 53 - 5 */ CharacterNumber,
+/* 54 - 6 */ CharacterNumber,
+/* 55 - 7 */ CharacterNumber,
+/* 56 - 8 */ CharacterNumber,
+/* 57 - 9 */ CharacterNumber,
+/* 58 - : */ CharacterColon,
+/* 59 - ; */ CharacterSemicolon,
+/* 60 - < */ CharacterLess,
+/* 61 - = */ CharacterEqual,
+/* 62 - > */ CharacterGreater,
+/* 63 - ? */ CharacterQuestion,
+/* 64 - @ */ CharacterInvalid,
+/* 65 - A */ CharacterIdentifierStart,
+/* 66 - B */ CharacterIdentifierStart,
+/* 67 - C */ CharacterIdentifierStart,
+/* 68 - D */ CharacterIdentifierStart,
+/* 69 - E */ CharacterIdentifierStart,
+/* 70 - F */ CharacterIdentifierStart,
+/* 71 - G */ CharacterIdentifierStart,
+/* 72 - H */ CharacterIdentifierStart,
+/* 73 - I */ CharacterIdentifierStart,
+/* 74 - J */ CharacterIdentifierStart,
+/* 75 - K */ CharacterIdentifierStart,
+/* 76 - L */ CharacterIdentifierStart,
+/* 77 - M */ CharacterIdentifierStart,
+/* 78 - N */ CharacterIdentifierStart,
+/* 79 - O */ CharacterIdentifierStart,
+/* 80 - P */ CharacterIdentifierStart,
+/* 81 - Q */ CharacterIdentifierStart,
+/* 82 - R */ CharacterIdentifierStart,
+/* 83 - S */ CharacterIdentifierStart,
+/* 84 - T */ CharacterIdentifierStart,
+/* 85 - U */ CharacterIdentifierStart,
+/* 86 - V */ CharacterIdentifierStart,
+/* 87 - W */ CharacterIdentifierStart,
+/* 88 - X */ CharacterIdentifierStart,
+/* 89 - Y */ CharacterIdentifierStart,
+/* 90 - Z */ CharacterIdentifierStart,
+/* 91 - [ */ CharacterOpenBracket,
+/* 92 - \ */ CharacterBackSlash,
+/* 93 - ] */ CharacterCloseBracket,
+/* 94 - ^ */ CharacterXor,
+/* 95 - _ */ CharacterIdentifierStart,
+/* 96 - ` */ CharacterInvalid,
+/* 97 - a */ CharacterIdentifierStart,
+/* 98 - b */ CharacterIdentifierStart,
+/* 99 - c */ CharacterIdentifierStart,
+/* 100 - d */ CharacterIdentifierStart,
+/* 101 - e */ CharacterIdentifierStart,
+/* 102 - f */ CharacterIdentifierStart,
+/* 103 - g */ CharacterIdentifierStart,
+/* 104 - h */ CharacterIdentifierStart,
+/* 105 - i */ CharacterIdentifierStart,
+/* 106 - j */ CharacterIdentifierStart,
+/* 107 - k */ CharacterIdentifierStart,
+/* 108 - l */ CharacterIdentifierStart,
+/* 109 - m */ CharacterIdentifierStart,
+/* 110 - n */ CharacterIdentifierStart,
+/* 111 - o */ CharacterIdentifierStart,
+/* 112 - p */ CharacterIdentifierStart,
+/* 113 - q */ CharacterIdentifierStart,
+/* 114 - r */ CharacterIdentifierStart,
+/* 115 - s */ CharacterIdentifierStart,
+/* 116 - t */ CharacterIdentifierStart,
+/* 117 - u */ CharacterIdentifierStart,
+/* 118 - v */ CharacterIdentifierStart,
+/* 119 - w */ CharacterIdentifierStart,
+/* 120 - x */ CharacterIdentifierStart,
+/* 121 - y */ CharacterIdentifierStart,
+/* 122 - z */ CharacterIdentifierStart,
+/* 123 - { */ CharacterOpenBrace,
+/* 124 - | */ CharacterOr,
+/* 125 - } */ CharacterCloseBrace,
+/* 126 - ~ */ CharacterTilde,
+/* 127 - Delete */ CharacterInvalid,
+};
+
+Lexer::Lexer(JSGlobalData* globalData)
+ : m_isReparsing(false)
+ , m_globalData(globalData)
+ , m_keywordTable(JSC::mainTable)
+{
+}
+
+Lexer::~Lexer()
+{
+ m_keywordTable.deleteTable();
+}
+
+ALWAYS_INLINE const UChar* Lexer::currentCharacter() const
+{
+ ASSERT(m_code <= m_codeEnd);
+ return m_code;
+}
+
+ALWAYS_INLINE int Lexer::currentOffset() const
+{
+ return currentCharacter() - m_codeStart;
+}
+
+void Lexer::setCode(const SourceCode& source, ParserArena& arena)
+{
+ m_arena = &arena.identifierArena();
+
+ m_lineNumber = source.firstLine();
+ m_delimited = false;
+ m_lastToken = -1;
+
+ const UChar* data = source.provider()->data();
+
+ m_source = &source;
+ m_codeStart = data;
+ m_code = data + source.startOffset();
+ m_codeEnd = data + source.endOffset();
+ m_error = false;
+ m_atLineStart = true;
+
+ m_buffer8.reserveInitialCapacity(initialReadBufferCapacity);
+ m_buffer16.reserveInitialCapacity((m_codeEnd - m_code) / 2);
+
+ if (LIKELY(m_code < m_codeEnd))
+ m_current = *m_code;
+ else
+ m_current = -1;
+ ASSERT(currentOffset() == source.startOffset());
+}
+
+ALWAYS_INLINE void Lexer::shift()
+{
+ // Faster than an if-else sequence
+ ASSERT(m_current != -1);
+ m_current = -1;
+ ++m_code;
+ if (LIKELY(m_code < m_codeEnd))
+ m_current = *m_code;
+}
+
+ALWAYS_INLINE int Lexer::peek(int offset)
+{
+ // Only use if necessary
+ ASSERT(offset > 0 && offset < 5);
+ const UChar* code = m_code + offset;
+ return (code < m_codeEnd) ? *code : -1;
+}
+
+int Lexer::getUnicodeCharacter()
+{
+ int char1 = peek(1);
+ int char2 = peek(2);
+ int char3 = peek(3);
+
+ if (UNLIKELY(!isASCIIHexDigit(m_current) || !isASCIIHexDigit(char1) || !isASCIIHexDigit(char2) || !isASCIIHexDigit(char3)))
+ return -1;
+
+ int result = convertUnicode(m_current, char1, char2, char3);
+ shift();
+ shift();
+ shift();
+ shift();
+ return result;
+}
+
+void Lexer::shiftLineTerminator()
+{
+ ASSERT(isLineTerminator(m_current));
+
+ int m_prev = m_current;
+ shift();
+
+ // Allow both CRLF and LFCR.
+ if (m_prev + m_current == '\n' + '\r')
+ shift();
+
+ ++m_lineNumber;
+}
+
+ALWAYS_INLINE const Identifier* Lexer::makeIdentifier(const UChar* characters, size_t length)
+{
+ return &m_arena->makeIdentifier(m_globalData, characters, length);
+}
+
+ALWAYS_INLINE bool Lexer::lastTokenWasRestrKeyword() const
+{
+ return m_lastToken == CONTINUE || m_lastToken == BREAK || m_lastToken == RETURN || m_lastToken == THROW;
+}
+
+static NEVER_INLINE bool isNonASCIIIdentStart(int c)
+{
+ return category(c) & (Letter_Uppercase | Letter_Lowercase | Letter_Titlecase | Letter_Modifier | Letter_Other);
+}
+
+static inline bool isIdentStart(int c)
+{
+ return isASCII(c) ? typesOfASCIICharacters[c] == CharacterIdentifierStart : isNonASCIIIdentStart(c);
+}
+
+static NEVER_INLINE bool isNonASCIIIdentPart(int c)
+{
+ return category(c) & (Letter_Uppercase | Letter_Lowercase | Letter_Titlecase | Letter_Modifier | Letter_Other
+ | Mark_NonSpacing | Mark_SpacingCombining | Number_DecimalDigit | Punctuation_Connector);
+}
+
+static inline bool isIdentPart(int c)
+{
+ // Character types are divided into two groups depending on whether they can be part of an
+ // identifier or not. Those whose type value is less or equal than CharacterNumber can be
+ // part of an identifier. (See the CharacterType definition for more details.)
+ return isASCII(c) ? typesOfASCIICharacters[c] <= CharacterNumber : isNonASCIIIdentPart(c);
+}
+
+static inline int singleEscape(int c)
+{
+ switch (c) {
+ case 'b':
+ return 0x08;
+ case 't':
+ return 0x09;
+ case 'n':
+ return 0x0A;
+ case 'v':
+ return 0x0B;
+ case 'f':
+ return 0x0C;
+ case 'r':
+ return 0x0D;
+ case '\\':
+ return '\\';
+ case '\'':
+ return '\'';
+ case '"':
+ return '"';
+ default:
+ return 0;
+ }
+}
+
+inline void Lexer::record8(int c)
+{
+ ASSERT(c >= 0);
+ ASSERT(c <= 0xFF);
+ m_buffer8.append(static_cast<char>(c));
+}
+
+inline void Lexer::record16(UChar c)
+{
+ m_buffer16.append(c);
+}
+
+inline void Lexer::record16(int c)
+{
+ ASSERT(c >= 0);
+ ASSERT(c <= USHRT_MAX);
+ record16(UChar(static_cast<unsigned short>(c)));
+}
+
+ALWAYS_INLINE JSTokenType Lexer::parseIdentifier(JSTokenData* lvalp, LexType lexType)
+{
+ bool bufferRequired = false;
+ const UChar* identifierStart = currentCharacter();
+ int identifierLength;
+
+ while (true) {
+ if (LIKELY(isIdentPart(m_current))) {
+ shift();
+ continue;
+ }
+ if (LIKELY(m_current != '\\'))
+ break;
+
+ // \uXXXX unicode characters.
+ bufferRequired = true;
+ if (identifierStart != currentCharacter())
+ m_buffer16.append(identifierStart, currentCharacter() - identifierStart);
+ shift();
+ if (UNLIKELY(m_current != 'u'))
+ return ERRORTOK;
+ shift();
+ int character = getUnicodeCharacter();
+ if (UNLIKELY(character == -1))
+ return ERRORTOK;
+ if (UNLIKELY(m_buffer16.size() ? !isIdentPart(character) : !isIdentStart(character)))
+ return ERRORTOK;
+ record16(character);
+ identifierStart = currentCharacter();
+ }
+
+ if (!bufferRequired)
+ identifierLength = currentCharacter() - identifierStart;
+ else {
+ if (identifierStart != currentCharacter())
+ m_buffer16.append(identifierStart, currentCharacter() - identifierStart);
+ identifierStart = m_buffer16.data();
+ identifierLength = m_buffer16.size();
+ }
+
+ const Identifier* ident = makeIdentifier(identifierStart, identifierLength);
+ lvalp->ident = ident;
+ m_delimited = false;
+
+ if (LIKELY(!bufferRequired && lexType == IdentifyReservedWords)) {
+ // Keywords must not be recognized if there was an \uXXXX in the identifier.
+ const HashEntry* entry = m_keywordTable.entry(m_globalData, *ident);
+ return entry ? static_cast<JSTokenType>(entry->lexerValue()) : IDENT;
+ }
+
+ m_buffer16.resize(0);
+ return IDENT;
+}
+
+ALWAYS_INLINE bool Lexer::parseString(JSTokenData* lvalp, bool strictMode)
+{
+ int stringQuoteCharacter = m_current;
+ shift();
+
+ const UChar* stringStart = currentCharacter();
+
+ while (m_current != stringQuoteCharacter) {
+ if (UNLIKELY(m_current == '\\')) {
+ if (stringStart != currentCharacter())
+ m_buffer16.append(stringStart, currentCharacter() - stringStart);
+ shift();
+
+ int escape = singleEscape(m_current);
+
+ // Most common escape sequences first
+ if (escape) {
+ record16(escape);
+ shift();
+ } else if (UNLIKELY(isLineTerminator(m_current)))
+ shiftLineTerminator();
+ else if (m_current == 'x') {
+ shift();
+ if (isASCIIHexDigit(m_current) && isASCIIHexDigit(peek(1))) {
+ int prev = m_current;
+ shift();
+ record16(convertHex(prev, m_current));
+ shift();
+ } else
+ record16('x');
+ } else if (m_current == 'u') {
+ shift();
+ int character = getUnicodeCharacter();
+ if (character != -1)
+ record16(character);
+ else if (m_current == stringQuoteCharacter)
+ record16('u');
+ else // Only stringQuoteCharacter allowed after \u
+ return false;
+ } else if (strictMode && isASCIIDigit(m_current)) {
+ // The only valid numeric escape in strict mode is '\0', and this must not be followed by a decimal digit.
+ int character1 = m_current;
+ shift();
+ if (character1 != '0' || isASCIIDigit(m_current))
+ return false;
+ record16(0);
+ } else if (!strictMode && isASCIIOctalDigit(m_current)) {
+ // Octal character sequences
+ int character1 = m_current;
+ shift();
+ if (isASCIIOctalDigit(m_current)) {
+ // Two octal characters
+ int character2 = m_current;
+ shift();
+ if (character1 >= '0' && character1 <= '3' && isASCIIOctalDigit(m_current)) {
+ record16((character1 - '0') * 64 + (character2 - '0') * 8 + m_current - '0');
+ shift();
+ } else
+ record16((character1 - '0') * 8 + character2 - '0');
+ } else
+ record16(character1 - '0');
+ } else if (m_current != -1) {
+ record16(m_current);
+ shift();
+ } else
+ return false;
+
+ stringStart = currentCharacter();
+ continue;
+ }
+ // Fast check for characters that require special handling.
+ // Catches -1, \n, \r, 0x2028, and 0x2029 as efficiently
+ // as possible, and lets through all common ASCII characters.
+ if (UNLIKELY(((static_cast<unsigned>(m_current) - 0xE) & 0x2000))) {
+ // New-line or end of input is not allowed
+ if (UNLIKELY(isLineTerminator(m_current)) || UNLIKELY(m_current == -1))
+ return false;
+ // Anything else is just a normal character
+ }
+ shift();
+ }
+
+ if (currentCharacter() != stringStart)
+ m_buffer16.append(stringStart, currentCharacter() - stringStart);
+ lvalp->ident = makeIdentifier(m_buffer16.data(), m_buffer16.size());
+ m_buffer16.resize(0);
+ return true;
+}
+
+ALWAYS_INLINE void Lexer::parseHex(double& returnValue)
+{
+ // Optimization: most hexadecimal values fit into 4 bytes.
+ uint32_t hexValue = 0;
+ int maximumDigits = 7;
+
+ // Shift out the 'x' prefix.
+ shift();
+
+ do {
+ hexValue = (hexValue << 4) + toASCIIHexValue(m_current);
+ shift();
+ --maximumDigits;
+ } while (isASCIIHexDigit(m_current) && maximumDigits >= 0);
+
+ if (maximumDigits >= 0) {
+ returnValue = hexValue;
+ return;
+ }
+
+ // No more place in the hexValue buffer.
+ // The values are shifted out and placed into the m_buffer8 vector.
+ for (int i = 0; i < 8; ++i) {
+ int digit = hexValue >> 28;
+ if (digit < 10)
+ record8(digit + '0');
+ else
+ record8(digit - 10 + 'a');
+ hexValue <<= 4;
+ }
+
+ while (isASCIIHexDigit(m_current)) {
+ record8(m_current);
+ shift();
+ }
+
+ returnValue = parseIntOverflow(m_buffer8.data(), m_buffer8.size(), 16);
+}
+
+ALWAYS_INLINE bool Lexer::parseOctal(double& returnValue)
+{
+ // Optimization: most octal values fit into 4 bytes.
+ uint32_t octalValue = 0;
+ int maximumDigits = 9;
+ // Temporary buffer for the digits. Makes easier
+ // to reconstruct the input characters when needed.
+ char digits[10];
+
+ do {
+ octalValue = octalValue * 8 + (m_current - '0');
+ digits[maximumDigits] = m_current;
+ shift();
+ --maximumDigits;
+ } while (isASCIIOctalDigit(m_current) && maximumDigits >= 0);
+
+ if (!isASCIIDigit(m_current) && maximumDigits >= 0) {
+ returnValue = octalValue;
+ return true;
+ }
+
+ for (int i = 9; i > maximumDigits; --i)
+ record8(digits[i]);
+
+ while (isASCIIOctalDigit(m_current)) {
+ record8(m_current);
+ shift();
+ }
+
+ if (isASCIIDigit(m_current))
+ return false;
+
+ returnValue = parseIntOverflow(m_buffer8.data(), m_buffer8.size(), 8);
+ return true;
+}
+
+ALWAYS_INLINE bool Lexer::parseDecimal(double& returnValue)
+{
+ // Optimization: most decimal values fit into 4 bytes.
+ uint32_t decimalValue = 0;
+
+ // Since parseOctal may be executed before parseDecimal,
+ // the m_buffer8 may hold ascii digits.
+ if (!m_buffer8.size()) {
+ int maximumDigits = 9;
+ // Temporary buffer for the digits. Makes easier
+ // to reconstruct the input characters when needed.
+ char digits[10];
+
+ do {
+ decimalValue = decimalValue * 10 + (m_current - '0');
+ digits[maximumDigits] = m_current;
+ shift();
+ --maximumDigits;
+ } while (isASCIIDigit(m_current) && maximumDigits >= 0);
+
+ if (maximumDigits >= 0 && m_current != '.' && (m_current | 0x20) != 'e') {
+ returnValue = decimalValue;
+ return true;
+ }
+
+ for (int i = 9; i > maximumDigits; --i)
+ record8(digits[i]);
+ }
+
+ while (isASCIIDigit(m_current)) {
+ record8(m_current);
+ shift();
+ }
+
+ return false;
+}
+
+ALWAYS_INLINE void Lexer::parseNumberAfterDecimalPoint()
+{
+ record8('.');
+ while (isASCIIDigit(m_current)) {
+ record8(m_current);
+ shift();
+ }
+}
+
+ALWAYS_INLINE bool Lexer::parseNumberAfterExponentIndicator()
+{
+ record8('e');
+ shift();
+ if (m_current == '+' || m_current == '-') {
+ record8(m_current);
+ shift();
+ }
+
+ if (!isASCIIDigit(m_current))
+ return false;
+
+ do {
+ record8(m_current);
+ shift();
+ } while (isASCIIDigit(m_current));
+ return true;
+}
+
+ALWAYS_INLINE bool Lexer::parseMultilineComment()
+{
+ while (true) {
+ while (UNLIKELY(m_current == '*')) {
+ shift();
+ if (m_current == '/') {
+ shift();
+ return true;
+ }
+ }
+
+ if (UNLIKELY(m_current == -1))
+ return false;
+
+ if (isLineTerminator(m_current))
+ shiftLineTerminator();
+ else
+ shift();
+ }
+}
+
+JSTokenType Lexer::lex(JSTokenData* lvalp, JSTokenInfo* llocp, LexType lexType, bool strictMode)
+{
+ ASSERT(!m_error);
+ ASSERT(m_buffer8.isEmpty());
+ ASSERT(m_buffer16.isEmpty());
+
+ JSTokenType token = ERRORTOK;
+ m_terminator = false;
+
+start:
+ while (isWhiteSpace(m_current))
+ shift();
+
+ int startOffset = currentOffset();
+
+ if (UNLIKELY(m_current == -1))
+ return EOFTOK;
+
+ m_delimited = false;
+
+ CharacterType type;
+ if (LIKELY(isASCII(m_current)))
+ type = static_cast<CharacterType>(typesOfASCIICharacters[m_current]);
+ else if (isNonASCIIIdentStart(m_current))
+ type = CharacterIdentifierStart;
+ else if (isLineTerminator(m_current))
+ type = CharacterLineTerminator;
+ else
+ type = CharacterInvalid;
+
+ switch (type) {
+ case CharacterGreater:
+ shift();
+ if (m_current == '>') {
+ shift();
+ if (m_current == '>') {
+ shift();
+ if (m_current == '=') {
+ shift();
+ token = URSHIFTEQUAL;
+ break;
+ }
+ token = URSHIFT;
+ break;
+ }
+ if (m_current == '=') {
+ shift();
+ token = RSHIFTEQUAL;
+ break;
+ }
+ token = RSHIFT;
+ break;
+ }
+ if (m_current == '=') {
+ shift();
+ token = GE;
+ break;
+ }
+ token = GT;
+ break;
+ case CharacterEqual:
+ shift();
+ if (m_current == '=') {
+ shift();
+ if (m_current == '=') {
+ shift();
+ token = STREQ;
+ break;
+ }
+ token = EQEQ;
+ break;
+ }
+ token = EQUAL;
+ break;
+ case CharacterLess:
+ shift();
+ if (m_current == '!' && peek(1) == '-' && peek(2) == '-') {
+ // <!-- marks the beginning of a line comment (for www usage)
+ goto inSingleLineComment;
+ }
+ if (m_current == '<') {
+ shift();
+ if (m_current == '=') {
+ shift();
+ token = LSHIFTEQUAL;
+ break;
+ }
+ token = LSHIFT;
+ break;
+ }
+ if (m_current == '=') {
+ shift();
+ token = LE;
+ break;
+ }
+ token = LT;
+ break;
+ case CharacterExclamationMark:
+ shift();
+ if (m_current == '=') {
+ shift();
+ if (m_current == '=') {
+ shift();
+ token = STRNEQ;
+ break;
+ }
+ token = NE;
+ break;
+ }
+ token = EXCLAMATION;
+ break;
+ case CharacterAdd:
+ shift();
+ if (m_current == '+') {
+ shift();
+ token = (!m_terminator) ? PLUSPLUS : AUTOPLUSPLUS;
+ break;
+ }
+ if (m_current == '=') {
+ shift();
+ token = PLUSEQUAL;
+ break;
+ }
+ token = PLUS;
+ break;
+ case CharacterSub:
+ shift();
+ if (m_current == '-') {
+ shift();
+ if (m_atLineStart && m_current == '>') {
+ shift();
+ goto inSingleLineComment;
+ }
+ token = (!m_terminator) ? MINUSMINUS : AUTOMINUSMINUS;
+ break;
+ }
+ if (m_current == '=') {
+ shift();
+ token = MINUSEQUAL;
+ break;
+ }
+ token = MINUS;
+ break;
+ case CharacterMultiply:
+ shift();
+ if (m_current == '=') {
+ shift();
+ token = MULTEQUAL;
+ break;
+ }
+ token = TIMES;
+ break;
+ case CharacterSlash:
+ shift();
+ if (m_current == '/') {
+ shift();
+ goto inSingleLineComment;
+ }
+ if (m_current == '*') {
+ shift();
+ if (parseMultilineComment())
+ goto start;
+ goto returnError;
+ }
+ if (m_current == '=') {
+ shift();
+ token = DIVEQUAL;
+ break;
+ }
+ token = DIVIDE;
+ break;
+ case CharacterAnd:
+ shift();
+ if (m_current == '&') {
+ shift();
+ token = AND;
+ break;
+ }
+ if (m_current == '=') {
+ shift();
+ token = ANDEQUAL;
+ break;
+ }
+ token = BITAND;
+ break;
+ case CharacterXor:
+ shift();
+ if (m_current == '=') {
+ shift();
+ token = XOREQUAL;
+ break;
+ }
+ token = BITXOR;
+ break;
+ case CharacterModulo:
+ shift();
+ if (m_current == '=') {
+ shift();
+ token = MODEQUAL;
+ break;
+ }
+ token = MOD;
+ break;
+ case CharacterOr:
+ shift();
+ if (m_current == '=') {
+ shift();
+ token = OREQUAL;
+ break;
+ }
+ if (m_current == '|') {
+ shift();
+ token = OR;
+ break;
+ }
+ token = BITOR;
+ break;
+ case CharacterOpenParen:
+ token = OPENPAREN;
+ shift();
+ break;
+ case CharacterCloseParen:
+ token = CLOSEPAREN;
+ shift();
+ break;
+ case CharacterOpenBracket:
+ token = OPENBRACKET;
+ shift();
+ break;
+ case CharacterCloseBracket:
+ token = CLOSEBRACKET;
+ shift();
+ break;
+ case CharacterComma:
+ token = COMMA;
+ shift();
+ break;
+ case CharacterColon:
+ token = COLON;
+ shift();
+ break;
+ case CharacterQuestion:
+ token = QUESTION;
+ shift();
+ break;
+ case CharacterTilde:
+ token = TILDE;
+ shift();
+ break;
+ case CharacterSemicolon:
+ m_delimited = true;
+ shift();
+ token = SEMICOLON;
+ break;
+ case CharacterOpenBrace:
+ lvalp->intValue = currentOffset();
+ shift();
+ token = OPENBRACE;
+ break;
+ case CharacterCloseBrace:
+ lvalp->intValue = currentOffset();
+ m_delimited = true;
+ shift();
+ token = CLOSEBRACE;
+ break;
+ case CharacterDot:
+ shift();
+ if (!isASCIIDigit(m_current)) {
+ token = DOT;
+ break;
+ }
+ goto inNumberAfterDecimalPoint;
+ case CharacterZero:
+ shift();
+ if ((m_current | 0x20) == 'x' && isASCIIHexDigit(peek(1))) {
+ parseHex(lvalp->doubleValue);
+ token = NUMBER;
+ } else {
+ record8('0');
+ if (isASCIIOctalDigit(m_current)) {
+ if (parseOctal(lvalp->doubleValue)) {
+ if (strictMode)
+ goto returnError;
+ token = NUMBER;
+ }
+ }
+ }
+ // Fall through into CharacterNumber
+ case CharacterNumber:
+ if (LIKELY(token != NUMBER)) {
+ if (!parseDecimal(lvalp->doubleValue)) {
+ if (m_current == '.') {
+ shift();
+inNumberAfterDecimalPoint:
+ parseNumberAfterDecimalPoint();
+ }
+ if ((m_current | 0x20) == 'e')
+ if (!parseNumberAfterExponentIndicator())
+ goto returnError;
+ // Null-terminate string for strtod.
+ m_buffer8.append('\0');
+ lvalp->doubleValue = WTF::strtod(m_buffer8.data(), 0);
+ }
+ token = NUMBER;
+ }
+
+ // No identifiers allowed directly after numeric literal, e.g. "3in" is bad.
+ if (UNLIKELY(isIdentStart(m_current)))
+ goto returnError;
+ m_buffer8.resize(0);
+ m_delimited = false;
+ break;
+ case CharacterQuote:
+ if (UNLIKELY(!parseString(lvalp, strictMode)))
+ goto returnError;
+ shift();
+ m_delimited = false;
+ token = STRING;
+ break;
+ case CharacterIdentifierStart:
+ ASSERT(isIdentStart(m_current));
+ // Fall through into CharacterBackSlash.
+ case CharacterBackSlash:
+ token = parseIdentifier(lvalp, lexType);
+ break;
+ case CharacterLineTerminator:
+ ASSERT(isLineTerminator(m_current));
+ shiftLineTerminator();
+ m_atLineStart = true;
+ m_terminator = true;
+ goto start;
+ case CharacterInvalid:
+ goto returnError;
+ default:
+ ASSERT_NOT_REACHED();
+ goto returnError;
+ }
+
+ m_atLineStart = false;
+ goto returnToken;
+
+inSingleLineComment:
+ while (!isLineTerminator(m_current)) {
+ if (UNLIKELY(m_current == -1))
+ return EOFTOK;
+ shift();
+ }
+ shiftLineTerminator();
+ m_atLineStart = true;
+ m_terminator = true;
+ if (!lastTokenWasRestrKeyword())
+ goto start;
+
+ token = SEMICOLON;
+ m_delimited = true;
+ // Fall through into returnToken.
+
+returnToken:
+ llocp->line = m_lineNumber;
+ llocp->startOffset = startOffset;
+ llocp->endOffset = currentOffset();
+ m_lastToken = token;
+ return token;
+
+returnError:
+ m_error = true;
+ return ERRORTOK;
+}
+
+bool Lexer::scanRegExp(const Identifier*& pattern, const Identifier*& flags, UChar patternPrefix)
+{
+ ASSERT(m_buffer16.isEmpty());
+
+ bool lastWasEscape = false;
+ bool inBrackets = false;
+
+ if (patternPrefix) {
+ ASSERT(!isLineTerminator(patternPrefix));
+ ASSERT(patternPrefix != '/');
+ ASSERT(patternPrefix != '[');
+ record16(patternPrefix);
+ }
+
+ while (true) {
+ int current = m_current;
+
+ if (isLineTerminator(current) || current == -1) {
+ m_buffer16.resize(0);
+ return false;
+ }
+
+ shift();
+
+ if (current == '/' && !lastWasEscape && !inBrackets)
+ break;
+
+ record16(current);
+
+ if (lastWasEscape) {
+ lastWasEscape = false;
+ continue;
+ }
+
+ switch (current) {
+ case '[':
+ inBrackets = true;
+ break;
+ case ']':
+ inBrackets = false;
+ break;
+ case '\\':
+ lastWasEscape = true;
+ break;
+ }
+ }
+
+ pattern = makeIdentifier(m_buffer16.data(), m_buffer16.size());
+ m_buffer16.resize(0);
+
+ while (isIdentPart(m_current)) {
+ record16(m_current);
+ shift();
+ }
+
+ flags = makeIdentifier(m_buffer16.data(), m_buffer16.size());
+ m_buffer16.resize(0);
+
+ return true;
+}
+
+bool Lexer::skipRegExp()
+{
+ bool lastWasEscape = false;
+ bool inBrackets = false;
+
+ while (true) {
+ int current = m_current;
+
+ if (isLineTerminator(current) || current == -1)
+ return false;
+
+ shift();
+
+ if (current == '/' && !lastWasEscape && !inBrackets)
+ break;
+
+ if (lastWasEscape) {
+ lastWasEscape = false;
+ continue;
+ }
+
+ switch (current) {
+ case '[':
+ inBrackets = true;
+ break;
+ case ']':
+ inBrackets = false;
+ break;
+ case '\\':
+ lastWasEscape = true;
+ break;
+ }
+ }
+
+ while (isIdentPart(m_current))
+ shift();
+
+ return true;
+}
+
+void Lexer::clear()
+{
+ m_arena = 0;
+
+ Vector<char> newBuffer8;
+ m_buffer8.swap(newBuffer8);
+
+ Vector<UChar> newBuffer16;
+ m_buffer16.swap(newBuffer16);
+
+ m_isReparsing = false;
+}
+
+SourceCode Lexer::sourceCode(int openBrace, int closeBrace, int firstLine)
+{
+ ASSERT(m_source->provider()->data()[openBrace] == '{');
+ ASSERT(m_source->provider()->data()[closeBrace] == '}');
+ return SourceCode(m_source->provider(), openBrace, closeBrace + 1, firstLine);
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/parser/Lexer.h b/Source/JavaScriptCore/parser/Lexer.h
new file mode 100644
index 0000000..4d2513d
--- /dev/null
+++ b/Source/JavaScriptCore/parser/Lexer.h
@@ -0,0 +1,158 @@
+/*
+ * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
+ * Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2010 Zoltan Herczeg (zherczeg@inf.u-szeged.hu)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef Lexer_h
+#define Lexer_h
+
+#include "JSParser.h"
+#include "Lookup.h"
+#include "ParserArena.h"
+#include "SourceCode.h"
+#include <wtf/ASCIICType.h>
+#include <wtf/AlwaysInline.h>
+#include <wtf/SegmentedVector.h>
+#include <wtf/Vector.h>
+#include <wtf/unicode/Unicode.h>
+
+namespace JSC {
+
+ class RegExp;
+
+ class Lexer : public Noncopyable {
+ public:
+ // Character manipulation functions.
+ static bool isWhiteSpace(int character);
+ static bool isLineTerminator(int character);
+ static unsigned char convertHex(int c1, int c2);
+ static UChar convertUnicode(int c1, int c2, int c3, int c4);
+
+ // Functions to set up parsing.
+ void setCode(const SourceCode&, ParserArena&);
+ void setIsReparsing() { m_isReparsing = true; }
+ bool isReparsing() const { return m_isReparsing; }
+
+ // Functions for the parser itself.
+ enum LexType { IdentifyReservedWords, IgnoreReservedWords };
+ JSTokenType lex(JSTokenData* lvalp, JSTokenInfo* llocp, LexType, bool strictMode);
+ int lineNumber() const { return m_lineNumber; }
+ void setLastLineNumber(int lastLineNumber) { m_lastLineNumber = lastLineNumber; }
+ int lastLineNumber() const { return m_lastLineNumber; }
+ bool prevTerminator() const { return m_terminator; }
+ SourceCode sourceCode(int openBrace, int closeBrace, int firstLine);
+ bool scanRegExp(const Identifier*& pattern, const Identifier*& flags, UChar patternPrefix = 0);
+ bool skipRegExp();
+
+ // Functions for use after parsing.
+ bool sawError() const { return m_error; }
+ void clear();
+ int currentOffset() { return m_code - m_codeStart; }
+ void setOffset(int offset)
+ {
+ m_code = m_codeStart + offset;
+ m_current = *m_code;
+ }
+
+ private:
+ friend class JSGlobalData;
+
+ Lexer(JSGlobalData*);
+ ~Lexer();
+
+ void record8(int);
+ void record16(int);
+ void record16(UChar);
+
+ void copyCodeWithoutBOMs();
+
+ ALWAYS_INLINE void shift();
+ ALWAYS_INLINE int peek(int offset);
+ int getUnicodeCharacter();
+ void shiftLineTerminator();
+
+ ALWAYS_INLINE const UChar* currentCharacter() const;
+ ALWAYS_INLINE int currentOffset() const;
+
+ ALWAYS_INLINE const Identifier* makeIdentifier(const UChar* characters, size_t length);
+
+ ALWAYS_INLINE bool lastTokenWasRestrKeyword() const;
+
+ ALWAYS_INLINE JSTokenType parseIdentifier(JSTokenData*, LexType);
+ ALWAYS_INLINE bool parseString(JSTokenData* lvalp, bool strictMode);
+ ALWAYS_INLINE void parseHex(double& returnValue);
+ ALWAYS_INLINE bool parseOctal(double& returnValue);
+ ALWAYS_INLINE bool parseDecimal(double& returnValue);
+ ALWAYS_INLINE void parseNumberAfterDecimalPoint();
+ ALWAYS_INLINE bool parseNumberAfterExponentIndicator();
+ ALWAYS_INLINE bool parseMultilineComment();
+
+ static const size_t initialReadBufferCapacity = 32;
+
+ int m_lineNumber;
+ int m_lastLineNumber;
+
+ Vector<char> m_buffer8;
+ Vector<UChar> m_buffer16;
+ bool m_terminator;
+ bool m_delimited; // encountered delimiter like "'" and "}" on last run
+ int m_lastToken;
+
+ const SourceCode* m_source;
+ const UChar* m_code;
+ const UChar* m_codeStart;
+ const UChar* m_codeEnd;
+ bool m_isReparsing;
+ bool m_atLineStart;
+ bool m_error;
+
+ // current and following unicode characters (int to allow for -1 for end-of-file marker)
+ int m_current;
+
+ IdentifierArena* m_arena;
+
+ JSGlobalData* m_globalData;
+
+ const HashTable m_keywordTable;
+ };
+
+ inline bool Lexer::isWhiteSpace(int ch)
+ {
+ return isASCII(ch) ? (ch == ' ' || ch == '\t' || ch == 0xB || ch == 0xC) : (WTF::Unicode::isSeparatorSpace(ch) || ch == 0xFEFF);
+ }
+
+ inline bool Lexer::isLineTerminator(int ch)
+ {
+ return ch == '\r' || ch == '\n' || (ch & ~1) == 0x2028;
+ }
+
+ inline unsigned char Lexer::convertHex(int c1, int c2)
+ {
+ return (toASCIIHexValue(c1) << 4) | toASCIIHexValue(c2);
+ }
+
+ inline UChar Lexer::convertUnicode(int c1, int c2, int c3, int c4)
+ {
+ return (convertHex(c1, c2) << 8) | convertHex(c3, c4);
+ }
+
+} // namespace JSC
+
+#endif // Lexer_h
diff --git a/Source/JavaScriptCore/parser/NodeConstructors.h b/Source/JavaScriptCore/parser/NodeConstructors.h
new file mode 100644
index 0000000..4e094b6
--- /dev/null
+++ b/Source/JavaScriptCore/parser/NodeConstructors.h
@@ -0,0 +1,908 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef NodeConstructors_h
+#define NodeConstructors_h
+
+#include "Nodes.h"
+#include "Lexer.h"
+#include "Parser.h"
+
+namespace JSC {
+
+ inline void* ParserArenaFreeable::operator new(size_t size, JSGlobalData* globalData)
+ {
+ return globalData->parser->arena().allocateFreeable(size);
+ }
+
+ inline void* ParserArenaDeletable::operator new(size_t size, JSGlobalData* globalData)
+ {
+ return globalData->parser->arena().allocateDeletable(size);
+ }
+
+ inline ParserArenaRefCounted::ParserArenaRefCounted(JSGlobalData* globalData)
+ {
+ globalData->parser->arena().derefWithArena(adoptRef(this));
+ }
+
+ inline Node::Node(JSGlobalData* globalData)
+ : m_line(globalData->lexer->lastLineNumber())
+ {
+ }
+
+ inline ExpressionNode::ExpressionNode(JSGlobalData* globalData, ResultType resultType)
+ : Node(globalData)
+ , m_resultType(resultType)
+ {
+ }
+
+ inline StatementNode::StatementNode(JSGlobalData* globalData)
+ : Node(globalData)
+ , m_lastLine(-1)
+ {
+ }
+
+ inline NullNode::NullNode(JSGlobalData* globalData)
+ : ExpressionNode(globalData, ResultType::nullType())
+ {
+ }
+
+ inline BooleanNode::BooleanNode(JSGlobalData* globalData, bool value)
+ : ExpressionNode(globalData, ResultType::booleanType())
+ , m_value(value)
+ {
+ }
+
+ inline NumberNode::NumberNode(JSGlobalData* globalData, double value)
+ : ExpressionNode(globalData, ResultType::numberType())
+ , m_value(value)
+ {
+ }
+
+ inline StringNode::StringNode(JSGlobalData* globalData, const Identifier& value)
+ : ExpressionNode(globalData, ResultType::stringType())
+ , m_value(value)
+ {
+ }
+
+ inline RegExpNode::RegExpNode(JSGlobalData* globalData, const Identifier& pattern, const Identifier& flags)
+ : ExpressionNode(globalData)
+ , m_pattern(pattern)
+ , m_flags(flags)
+ {
+ }
+
+ inline ThisNode::ThisNode(JSGlobalData* globalData)
+ : ExpressionNode(globalData)
+ {
+ }
+
+ inline ResolveNode::ResolveNode(JSGlobalData* globalData, const Identifier& ident, int startOffset)
+ : ExpressionNode(globalData)
+ , m_ident(ident)
+ , m_startOffset(startOffset)
+ {
+ }
+
+ inline ElementNode::ElementNode(JSGlobalData*, int elision, ExpressionNode* node)
+ : m_next(0)
+ , m_elision(elision)
+ , m_node(node)
+ {
+ }
+
+ inline ElementNode::ElementNode(JSGlobalData*, ElementNode* l, int elision, ExpressionNode* node)
+ : m_next(0)
+ , m_elision(elision)
+ , m_node(node)
+ {
+ l->m_next = this;
+ }
+
+ inline ArrayNode::ArrayNode(JSGlobalData* globalData, int elision)
+ : ExpressionNode(globalData)
+ , m_element(0)
+ , m_elision(elision)
+ , m_optional(true)
+ {
+ }
+
+ inline ArrayNode::ArrayNode(JSGlobalData* globalData, ElementNode* element)
+ : ExpressionNode(globalData)
+ , m_element(element)
+ , m_elision(0)
+ , m_optional(false)
+ {
+ }
+
+ inline ArrayNode::ArrayNode(JSGlobalData* globalData, int elision, ElementNode* element)
+ : ExpressionNode(globalData)
+ , m_element(element)
+ , m_elision(elision)
+ , m_optional(true)
+ {
+ }
+
+ inline PropertyNode::PropertyNode(JSGlobalData*, const Identifier& name, ExpressionNode* assign, Type type)
+ : m_name(name)
+ , m_assign(assign)
+ , m_type(type)
+ {
+ }
+
+ inline PropertyNode::PropertyNode(JSGlobalData* globalData, double name, ExpressionNode* assign, Type type)
+ : m_name(globalData->parser->arena().identifierArena().makeNumericIdentifier(globalData, name))
+ , m_assign(assign)
+ , m_type(type)
+ {
+ }
+
+ inline PropertyListNode::PropertyListNode(JSGlobalData* globalData, PropertyNode* node)
+ : Node(globalData)
+ , m_node(node)
+ , m_next(0)
+ {
+ }
+
+ inline PropertyListNode::PropertyListNode(JSGlobalData* globalData, PropertyNode* node, PropertyListNode* list)
+ : Node(globalData)
+ , m_node(node)
+ , m_next(0)
+ {
+ list->m_next = this;
+ }
+
+ inline ObjectLiteralNode::ObjectLiteralNode(JSGlobalData* globalData)
+ : ExpressionNode(globalData)
+ , m_list(0)
+ {
+ }
+
+ inline ObjectLiteralNode::ObjectLiteralNode(JSGlobalData* globalData, PropertyListNode* list)
+ : ExpressionNode(globalData)
+ , m_list(list)
+ {
+ }
+
+ inline BracketAccessorNode::BracketAccessorNode(JSGlobalData* globalData, ExpressionNode* base, ExpressionNode* subscript, bool subscriptHasAssignments)
+ : ExpressionNode(globalData)
+ , m_base(base)
+ , m_subscript(subscript)
+ , m_subscriptHasAssignments(subscriptHasAssignments)
+ {
+ }
+
+ inline DotAccessorNode::DotAccessorNode(JSGlobalData* globalData, ExpressionNode* base, const Identifier& ident)
+ : ExpressionNode(globalData)
+ , m_base(base)
+ , m_ident(ident)
+ {
+ }
+
+ inline ArgumentListNode::ArgumentListNode(JSGlobalData* globalData, ExpressionNode* expr)
+ : Node(globalData)
+ , m_next(0)
+ , m_expr(expr)
+ {
+ }
+
+ inline ArgumentListNode::ArgumentListNode(JSGlobalData* globalData, ArgumentListNode* listNode, ExpressionNode* expr)
+ : Node(globalData)
+ , m_next(0)
+ , m_expr(expr)
+ {
+ listNode->m_next = this;
+ }
+
+ inline ArgumentsNode::ArgumentsNode(JSGlobalData*)
+ : m_listNode(0)
+ {
+ }
+
+ inline ArgumentsNode::ArgumentsNode(JSGlobalData*, ArgumentListNode* listNode)
+ : m_listNode(listNode)
+ {
+ }
+
+ inline NewExprNode::NewExprNode(JSGlobalData* globalData, ExpressionNode* expr)
+ : ExpressionNode(globalData)
+ , m_expr(expr)
+ , m_args(0)
+ {
+ }
+
+ inline NewExprNode::NewExprNode(JSGlobalData* globalData, ExpressionNode* expr, ArgumentsNode* args)
+ : ExpressionNode(globalData)
+ , m_expr(expr)
+ , m_args(args)
+ {
+ }
+
+ inline EvalFunctionCallNode::EvalFunctionCallNode(JSGlobalData* globalData, ArgumentsNode* args, unsigned divot, unsigned startOffset, unsigned endOffset)
+ : ExpressionNode(globalData)
+ , ThrowableExpressionData(divot, startOffset, endOffset)
+ , m_args(args)
+ {
+ }
+
+ inline FunctionCallValueNode::FunctionCallValueNode(JSGlobalData* globalData, ExpressionNode* expr, ArgumentsNode* args, unsigned divot, unsigned startOffset, unsigned endOffset)
+ : ExpressionNode(globalData)
+ , ThrowableExpressionData(divot, startOffset, endOffset)
+ , m_expr(expr)
+ , m_args(args)
+ {
+ }
+
+ inline FunctionCallResolveNode::FunctionCallResolveNode(JSGlobalData* globalData, const Identifier& ident, ArgumentsNode* args, unsigned divot, unsigned startOffset, unsigned endOffset)
+ : ExpressionNode(globalData)
+ , ThrowableExpressionData(divot, startOffset, endOffset)
+ , m_ident(ident)
+ , m_args(args)
+ {
+ }
+
+ inline FunctionCallBracketNode::FunctionCallBracketNode(JSGlobalData* globalData, ExpressionNode* base, ExpressionNode* subscript, ArgumentsNode* args, unsigned divot, unsigned startOffset, unsigned endOffset)
+ : ExpressionNode(globalData)
+ , ThrowableSubExpressionData(divot, startOffset, endOffset)
+ , m_base(base)
+ , m_subscript(subscript)
+ , m_args(args)
+ {
+ }
+
+ inline FunctionCallDotNode::FunctionCallDotNode(JSGlobalData* globalData, ExpressionNode* base, const Identifier& ident, ArgumentsNode* args, unsigned divot, unsigned startOffset, unsigned endOffset)
+ : ExpressionNode(globalData)
+ , ThrowableSubExpressionData(divot, startOffset, endOffset)
+ , m_base(base)
+ , m_ident(ident)
+ , m_args(args)
+ {
+ }
+
+ inline CallFunctionCallDotNode::CallFunctionCallDotNode(JSGlobalData* globalData, ExpressionNode* base, const Identifier& ident, ArgumentsNode* args, unsigned divot, unsigned startOffset, unsigned endOffset)
+ : FunctionCallDotNode(globalData, base, ident, args, divot, startOffset, endOffset)
+ {
+ }
+
+ inline ApplyFunctionCallDotNode::ApplyFunctionCallDotNode(JSGlobalData* globalData, ExpressionNode* base, const Identifier& ident, ArgumentsNode* args, unsigned divot, unsigned startOffset, unsigned endOffset)
+ : FunctionCallDotNode(globalData, base, ident, args, divot, startOffset, endOffset)
+ {
+ }
+
+ inline PrePostResolveNode::PrePostResolveNode(JSGlobalData* globalData, const Identifier& ident, unsigned divot, unsigned startOffset, unsigned endOffset)
+ : ExpressionNode(globalData, ResultType::numberType()) // could be reusable for pre?
+ , ThrowableExpressionData(divot, startOffset, endOffset)
+ , m_ident(ident)
+ {
+ }
+
+ inline PostfixResolveNode::PostfixResolveNode(JSGlobalData* globalData, const Identifier& ident, Operator oper, unsigned divot, unsigned startOffset, unsigned endOffset)
+ : PrePostResolveNode(globalData, ident, divot, startOffset, endOffset)
+ , m_operator(oper)
+ {
+ }
+
+ inline PostfixBracketNode::PostfixBracketNode(JSGlobalData* globalData, ExpressionNode* base, ExpressionNode* subscript, Operator oper, unsigned divot, unsigned startOffset, unsigned endOffset)
+ : ExpressionNode(globalData)
+ , ThrowableSubExpressionData(divot, startOffset, endOffset)
+ , m_base(base)
+ , m_subscript(subscript)
+ , m_operator(oper)
+ {
+ }
+
+ inline PostfixDotNode::PostfixDotNode(JSGlobalData* globalData, ExpressionNode* base, const Identifier& ident, Operator oper, unsigned divot, unsigned startOffset, unsigned endOffset)
+ : ExpressionNode(globalData)
+ , ThrowableSubExpressionData(divot, startOffset, endOffset)
+ , m_base(base)
+ , m_ident(ident)
+ , m_operator(oper)
+ {
+ }
+
+ inline PostfixErrorNode::PostfixErrorNode(JSGlobalData* globalData, ExpressionNode* expr, Operator oper, unsigned divot, unsigned startOffset, unsigned endOffset)
+ : ExpressionNode(globalData)
+ , ThrowableSubExpressionData(divot, startOffset, endOffset)
+ , m_expr(expr)
+ , m_operator(oper)
+ {
+ }
+
+ inline DeleteResolveNode::DeleteResolveNode(JSGlobalData* globalData, const Identifier& ident, unsigned divot, unsigned startOffset, unsigned endOffset)
+ : ExpressionNode(globalData)
+ , ThrowableExpressionData(divot, startOffset, endOffset)
+ , m_ident(ident)
+ {
+ }
+
+ inline DeleteBracketNode::DeleteBracketNode(JSGlobalData* globalData, ExpressionNode* base, ExpressionNode* subscript, unsigned divot, unsigned startOffset, unsigned endOffset)
+ : ExpressionNode(globalData)
+ , ThrowableExpressionData(divot, startOffset, endOffset)
+ , m_base(base)
+ , m_subscript(subscript)
+ {
+ }
+
+ inline DeleteDotNode::DeleteDotNode(JSGlobalData* globalData, ExpressionNode* base, const Identifier& ident, unsigned divot, unsigned startOffset, unsigned endOffset)
+ : ExpressionNode(globalData)
+ , ThrowableExpressionData(divot, startOffset, endOffset)
+ , m_base(base)
+ , m_ident(ident)
+ {
+ }
+
+ inline DeleteValueNode::DeleteValueNode(JSGlobalData* globalData, ExpressionNode* expr)
+ : ExpressionNode(globalData)
+ , m_expr(expr)
+ {
+ }
+
+ inline VoidNode::VoidNode(JSGlobalData* globalData, ExpressionNode* expr)
+ : ExpressionNode(globalData)
+ , m_expr(expr)
+ {
+ }
+
+ inline TypeOfResolveNode::TypeOfResolveNode(JSGlobalData* globalData, const Identifier& ident)
+ : ExpressionNode(globalData, ResultType::stringType())
+ , m_ident(ident)
+ {
+ }
+
+ inline TypeOfValueNode::TypeOfValueNode(JSGlobalData* globalData, ExpressionNode* expr)
+ : ExpressionNode(globalData, ResultType::stringType())
+ , m_expr(expr)
+ {
+ }
+
+ inline PrefixResolveNode::PrefixResolveNode(JSGlobalData* globalData, const Identifier& ident, Operator oper, unsigned divot, unsigned startOffset, unsigned endOffset)
+ : PrePostResolveNode(globalData, ident, divot, startOffset, endOffset)
+ , m_operator(oper)
+ {
+ }
+
+ inline PrefixBracketNode::PrefixBracketNode(JSGlobalData* globalData, ExpressionNode* base, ExpressionNode* subscript, Operator oper, unsigned divot, unsigned startOffset, unsigned endOffset)
+ : ExpressionNode(globalData)
+ , ThrowablePrefixedSubExpressionData(divot, startOffset, endOffset)
+ , m_base(base)
+ , m_subscript(subscript)
+ , m_operator(oper)
+ {
+ }
+
+ inline PrefixDotNode::PrefixDotNode(JSGlobalData* globalData, ExpressionNode* base, const Identifier& ident, Operator oper, unsigned divot, unsigned startOffset, unsigned endOffset)
+ : ExpressionNode(globalData)
+ , ThrowablePrefixedSubExpressionData(divot, startOffset, endOffset)
+ , m_base(base)
+ , m_ident(ident)
+ , m_operator(oper)
+ {
+ }
+
+ inline PrefixErrorNode::PrefixErrorNode(JSGlobalData* globalData, ExpressionNode* expr, Operator oper, unsigned divot, unsigned startOffset, unsigned endOffset)
+ : ExpressionNode(globalData)
+ , ThrowableExpressionData(divot, startOffset, endOffset)
+ , m_expr(expr)
+ , m_operator(oper)
+ {
+ }
+
+ inline UnaryOpNode::UnaryOpNode(JSGlobalData* globalData, ResultType type, ExpressionNode* expr, OpcodeID opcodeID)
+ : ExpressionNode(globalData, type)
+ , m_expr(expr)
+ , m_opcodeID(opcodeID)
+ {
+ }
+
+ inline UnaryPlusNode::UnaryPlusNode(JSGlobalData* globalData, ExpressionNode* expr)
+ : UnaryOpNode(globalData, ResultType::numberType(), expr, op_to_jsnumber)
+ {
+ }
+
+ inline NegateNode::NegateNode(JSGlobalData* globalData, ExpressionNode* expr)
+ : UnaryOpNode(globalData, ResultType::numberTypeCanReuse(), expr, op_negate)
+ {
+ }
+
+ inline BitwiseNotNode::BitwiseNotNode(JSGlobalData* globalData, ExpressionNode* expr)
+ : UnaryOpNode(globalData, ResultType::forBitOp(), expr, op_bitnot)
+ {
+ }
+
+ inline LogicalNotNode::LogicalNotNode(JSGlobalData* globalData, ExpressionNode* expr)
+ : UnaryOpNode(globalData, ResultType::booleanType(), expr, op_not)
+ {
+ }
+
+ inline BinaryOpNode::BinaryOpNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, OpcodeID opcodeID, bool rightHasAssignments)
+ : ExpressionNode(globalData)
+ , m_expr1(expr1)
+ , m_expr2(expr2)
+ , m_opcodeID(opcodeID)
+ , m_rightHasAssignments(rightHasAssignments)
+ {
+ }
+
+ inline BinaryOpNode::BinaryOpNode(JSGlobalData* globalData, ResultType type, ExpressionNode* expr1, ExpressionNode* expr2, OpcodeID opcodeID, bool rightHasAssignments)
+ : ExpressionNode(globalData, type)
+ , m_expr1(expr1)
+ , m_expr2(expr2)
+ , m_opcodeID(opcodeID)
+ , m_rightHasAssignments(rightHasAssignments)
+ {
+ }
+
+ inline ReverseBinaryOpNode::ReverseBinaryOpNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, OpcodeID opcodeID, bool rightHasAssignments)
+ : BinaryOpNode(globalData, expr1, expr2, opcodeID, rightHasAssignments)
+ {
+ }
+
+ inline ReverseBinaryOpNode::ReverseBinaryOpNode(JSGlobalData* globalData, ResultType type, ExpressionNode* expr1, ExpressionNode* expr2, OpcodeID opcodeID, bool rightHasAssignments)
+ : BinaryOpNode(globalData, type, expr1, expr2, opcodeID, rightHasAssignments)
+ {
+ }
+
+ inline MultNode::MultNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
+ : BinaryOpNode(globalData, ResultType::numberTypeCanReuse(), expr1, expr2, op_mul, rightHasAssignments)
+ {
+ }
+
+ inline DivNode::DivNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
+ : BinaryOpNode(globalData, ResultType::numberTypeCanReuse(), expr1, expr2, op_div, rightHasAssignments)
+ {
+ }
+
+
+ inline ModNode::ModNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
+ : BinaryOpNode(globalData, ResultType::numberTypeCanReuse(), expr1, expr2, op_mod, rightHasAssignments)
+ {
+ }
+
+ inline AddNode::AddNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
+ : BinaryOpNode(globalData, ResultType::forAdd(expr1->resultDescriptor(), expr2->resultDescriptor()), expr1, expr2, op_add, rightHasAssignments)
+ {
+ }
+
+ inline SubNode::SubNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
+ : BinaryOpNode(globalData, ResultType::numberTypeCanReuse(), expr1, expr2, op_sub, rightHasAssignments)
+ {
+ }
+
+ inline LeftShiftNode::LeftShiftNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
+ : BinaryOpNode(globalData, ResultType::forBitOp(), expr1, expr2, op_lshift, rightHasAssignments)
+ {
+ }
+
+ inline RightShiftNode::RightShiftNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
+ : BinaryOpNode(globalData, ResultType::forBitOp(), expr1, expr2, op_rshift, rightHasAssignments)
+ {
+ }
+
+ inline UnsignedRightShiftNode::UnsignedRightShiftNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
+ : BinaryOpNode(globalData, ResultType::numberTypeCanReuse(), expr1, expr2, op_urshift, rightHasAssignments)
+ {
+ }
+
+ inline LessNode::LessNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
+ : BinaryOpNode(globalData, ResultType::booleanType(), expr1, expr2, op_less, rightHasAssignments)
+ {
+ }
+
+ inline GreaterNode::GreaterNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
+ : ReverseBinaryOpNode(globalData, ResultType::booleanType(), expr1, expr2, op_less, rightHasAssignments)
+ {
+ }
+
+ inline LessEqNode::LessEqNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
+ : BinaryOpNode(globalData, ResultType::booleanType(), expr1, expr2, op_lesseq, rightHasAssignments)
+ {
+ }
+
+ inline GreaterEqNode::GreaterEqNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
+ : ReverseBinaryOpNode(globalData, ResultType::booleanType(), expr1, expr2, op_lesseq, rightHasAssignments)
+ {
+ }
+
+ inline ThrowableBinaryOpNode::ThrowableBinaryOpNode(JSGlobalData* globalData, ResultType type, ExpressionNode* expr1, ExpressionNode* expr2, OpcodeID opcodeID, bool rightHasAssignments)
+ : BinaryOpNode(globalData, type, expr1, expr2, opcodeID, rightHasAssignments)
+ {
+ }
+
+ inline ThrowableBinaryOpNode::ThrowableBinaryOpNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, OpcodeID opcodeID, bool rightHasAssignments)
+ : BinaryOpNode(globalData, expr1, expr2, opcodeID, rightHasAssignments)
+ {
+ }
+
+ inline InstanceOfNode::InstanceOfNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
+ : ThrowableBinaryOpNode(globalData, ResultType::booleanType(), expr1, expr2, op_instanceof, rightHasAssignments)
+ {
+ }
+
+ inline InNode::InNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
+ : ThrowableBinaryOpNode(globalData, expr1, expr2, op_in, rightHasAssignments)
+ {
+ }
+
+ inline EqualNode::EqualNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
+ : BinaryOpNode(globalData, ResultType::booleanType(), expr1, expr2, op_eq, rightHasAssignments)
+ {
+ }
+
+ inline NotEqualNode::NotEqualNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
+ : BinaryOpNode(globalData, ResultType::booleanType(), expr1, expr2, op_neq, rightHasAssignments)
+ {
+ }
+
+ inline StrictEqualNode::StrictEqualNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
+ : BinaryOpNode(globalData, ResultType::booleanType(), expr1, expr2, op_stricteq, rightHasAssignments)
+ {
+ }
+
+ inline NotStrictEqualNode::NotStrictEqualNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
+ : BinaryOpNode(globalData, ResultType::booleanType(), expr1, expr2, op_nstricteq, rightHasAssignments)
+ {
+ }
+
+ inline BitAndNode::BitAndNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
+ : BinaryOpNode(globalData, ResultType::forBitOp(), expr1, expr2, op_bitand, rightHasAssignments)
+ {
+ }
+
+ inline BitOrNode::BitOrNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
+ : BinaryOpNode(globalData, ResultType::forBitOp(), expr1, expr2, op_bitor, rightHasAssignments)
+ {
+ }
+
+ inline BitXOrNode::BitXOrNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
+ : BinaryOpNode(globalData, ResultType::forBitOp(), expr1, expr2, op_bitxor, rightHasAssignments)
+ {
+ }
+
+ inline LogicalOpNode::LogicalOpNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, LogicalOperator oper)
+ : ExpressionNode(globalData, ResultType::booleanType())
+ , m_expr1(expr1)
+ , m_expr2(expr2)
+ , m_operator(oper)
+ {
+ }
+
+ inline ConditionalNode::ConditionalNode(JSGlobalData* globalData, ExpressionNode* logical, ExpressionNode* expr1, ExpressionNode* expr2)
+ : ExpressionNode(globalData)
+ , m_logical(logical)
+ , m_expr1(expr1)
+ , m_expr2(expr2)
+ {
+ }
+
+ inline ReadModifyResolveNode::ReadModifyResolveNode(JSGlobalData* globalData, const Identifier& ident, Operator oper, ExpressionNode* right, bool rightHasAssignments, unsigned divot, unsigned startOffset, unsigned endOffset)
+ : ExpressionNode(globalData)
+ , ThrowableExpressionData(divot, startOffset, endOffset)
+ , m_ident(ident)
+ , m_right(right)
+ , m_operator(oper)
+ , m_rightHasAssignments(rightHasAssignments)
+ {
+ }
+
+ inline AssignResolveNode::AssignResolveNode(JSGlobalData* globalData, const Identifier& ident, ExpressionNode* right, bool rightHasAssignments)
+ : ExpressionNode(globalData)
+ , m_ident(ident)
+ , m_right(right)
+ , m_rightHasAssignments(rightHasAssignments)
+ {
+ }
+
+ inline ReadModifyBracketNode::ReadModifyBracketNode(JSGlobalData* globalData, ExpressionNode* base, ExpressionNode* subscript, Operator oper, ExpressionNode* right, bool subscriptHasAssignments, bool rightHasAssignments, unsigned divot, unsigned startOffset, unsigned endOffset)
+ : ExpressionNode(globalData)
+ , ThrowableSubExpressionData(divot, startOffset, endOffset)
+ , m_base(base)
+ , m_subscript(subscript)
+ , m_right(right)
+ , m_operator(oper)
+ , m_subscriptHasAssignments(subscriptHasAssignments)
+ , m_rightHasAssignments(rightHasAssignments)
+ {
+ }
+
+ inline AssignBracketNode::AssignBracketNode(JSGlobalData* globalData, ExpressionNode* base, ExpressionNode* subscript, ExpressionNode* right, bool subscriptHasAssignments, bool rightHasAssignments, unsigned divot, unsigned startOffset, unsigned endOffset)
+ : ExpressionNode(globalData)
+ , ThrowableExpressionData(divot, startOffset, endOffset)
+ , m_base(base)
+ , m_subscript(subscript)
+ , m_right(right)
+ , m_subscriptHasAssignments(subscriptHasAssignments)
+ , m_rightHasAssignments(rightHasAssignments)
+ {
+ }
+
+ inline AssignDotNode::AssignDotNode(JSGlobalData* globalData, ExpressionNode* base, const Identifier& ident, ExpressionNode* right, bool rightHasAssignments, unsigned divot, unsigned startOffset, unsigned endOffset)
+ : ExpressionNode(globalData)
+ , ThrowableExpressionData(divot, startOffset, endOffset)
+ , m_base(base)
+ , m_ident(ident)
+ , m_right(right)
+ , m_rightHasAssignments(rightHasAssignments)
+ {
+ }
+
+ inline ReadModifyDotNode::ReadModifyDotNode(JSGlobalData* globalData, ExpressionNode* base, const Identifier& ident, Operator oper, ExpressionNode* right, bool rightHasAssignments, unsigned divot, unsigned startOffset, unsigned endOffset)
+ : ExpressionNode(globalData)
+ , ThrowableSubExpressionData(divot, startOffset, endOffset)
+ , m_base(base)
+ , m_ident(ident)
+ , m_right(right)
+ , m_operator(oper)
+ , m_rightHasAssignments(rightHasAssignments)
+ {
+ }
+
+ inline AssignErrorNode::AssignErrorNode(JSGlobalData* globalData, ExpressionNode* left, Operator oper, ExpressionNode* right, unsigned divot, unsigned startOffset, unsigned endOffset)
+ : ExpressionNode(globalData)
+ , ThrowableExpressionData(divot, startOffset, endOffset)
+ , m_left(left)
+ , m_operator(oper)
+ , m_right(right)
+ {
+ }
+
+ inline CommaNode::CommaNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2)
+ : ExpressionNode(globalData)
+ {
+ m_expressions.append(expr1);
+ m_expressions.append(expr2);
+ }
+
+ inline ConstStatementNode::ConstStatementNode(JSGlobalData* globalData, ConstDeclNode* next)
+ : StatementNode(globalData)
+ , m_next(next)
+ {
+ }
+
+ inline SourceElements::SourceElements(JSGlobalData*)
+ {
+ }
+
+ inline EmptyStatementNode::EmptyStatementNode(JSGlobalData* globalData)
+ : StatementNode(globalData)
+ {
+ }
+
+ inline DebuggerStatementNode::DebuggerStatementNode(JSGlobalData* globalData)
+ : StatementNode(globalData)
+ {
+ }
+
+ inline ExprStatementNode::ExprStatementNode(JSGlobalData* globalData, ExpressionNode* expr)
+ : StatementNode(globalData)
+ , m_expr(expr)
+ {
+ }
+
+ inline VarStatementNode::VarStatementNode(JSGlobalData* globalData, ExpressionNode* expr)
+ : StatementNode(globalData)
+ , m_expr(expr)
+ {
+ }
+
+ inline IfNode::IfNode(JSGlobalData* globalData, ExpressionNode* condition, StatementNode* ifBlock)
+ : StatementNode(globalData)
+ , m_condition(condition)
+ , m_ifBlock(ifBlock)
+ {
+ }
+
+ inline IfElseNode::IfElseNode(JSGlobalData* globalData, ExpressionNode* condition, StatementNode* ifBlock, StatementNode* elseBlock)
+ : IfNode(globalData, condition, ifBlock)
+ , m_elseBlock(elseBlock)
+ {
+ }
+
+ inline DoWhileNode::DoWhileNode(JSGlobalData* globalData, StatementNode* statement, ExpressionNode* expr)
+ : StatementNode(globalData)
+ , m_statement(statement)
+ , m_expr(expr)
+ {
+ }
+
+ inline WhileNode::WhileNode(JSGlobalData* globalData, ExpressionNode* expr, StatementNode* statement)
+ : StatementNode(globalData)
+ , m_expr(expr)
+ , m_statement(statement)
+ {
+ }
+
+ inline ForNode::ForNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, ExpressionNode* expr3, StatementNode* statement, bool expr1WasVarDecl)
+ : StatementNode(globalData)
+ , m_expr1(expr1)
+ , m_expr2(expr2)
+ , m_expr3(expr3)
+ , m_statement(statement)
+ , m_expr1WasVarDecl(expr1 && expr1WasVarDecl)
+ {
+ ASSERT(statement);
+ }
+
+ inline ContinueNode::ContinueNode(JSGlobalData* globalData)
+ : StatementNode(globalData)
+ , m_ident(globalData->propertyNames->nullIdentifier)
+ {
+ }
+
+ inline ContinueNode::ContinueNode(JSGlobalData* globalData, const Identifier& ident)
+ : StatementNode(globalData)
+ , m_ident(ident)
+ {
+ }
+
+ inline BreakNode::BreakNode(JSGlobalData* globalData)
+ : StatementNode(globalData)
+ , m_ident(globalData->propertyNames->nullIdentifier)
+ {
+ }
+
+ inline BreakNode::BreakNode(JSGlobalData* globalData, const Identifier& ident)
+ : StatementNode(globalData)
+ , m_ident(ident)
+ {
+ }
+
+ inline ReturnNode::ReturnNode(JSGlobalData* globalData, ExpressionNode* value)
+ : StatementNode(globalData)
+ , m_value(value)
+ {
+ }
+
+ inline WithNode::WithNode(JSGlobalData* globalData, ExpressionNode* expr, StatementNode* statement, uint32_t divot, uint32_t expressionLength)
+ : StatementNode(globalData)
+ , m_expr(expr)
+ , m_statement(statement)
+ , m_divot(divot)
+ , m_expressionLength(expressionLength)
+ {
+ }
+
+ inline LabelNode::LabelNode(JSGlobalData* globalData, const Identifier& name, StatementNode* statement)
+ : StatementNode(globalData)
+ , m_name(name)
+ , m_statement(statement)
+ {
+ }
+
+ inline ThrowNode::ThrowNode(JSGlobalData* globalData, ExpressionNode* expr)
+ : StatementNode(globalData)
+ , m_expr(expr)
+ {
+ }
+
+ inline TryNode::TryNode(JSGlobalData* globalData, StatementNode* tryBlock, const Identifier& exceptionIdent, bool catchHasEval, StatementNode* catchBlock, StatementNode* finallyBlock)
+ : StatementNode(globalData)
+ , m_tryBlock(tryBlock)
+ , m_exceptionIdent(exceptionIdent)
+ , m_catchBlock(catchBlock)
+ , m_finallyBlock(finallyBlock)
+ , m_catchHasEval(catchHasEval)
+ {
+ }
+
+ inline ParameterNode::ParameterNode(JSGlobalData*, const Identifier& ident)
+ : m_ident(ident)
+ , m_next(0)
+ {
+ }
+
+ inline ParameterNode::ParameterNode(JSGlobalData*, ParameterNode* l, const Identifier& ident)
+ : m_ident(ident)
+ , m_next(0)
+ {
+ l->m_next = this;
+ }
+
+ inline FuncExprNode::FuncExprNode(JSGlobalData* globalData, const Identifier& ident, FunctionBodyNode* body, const SourceCode& source, ParameterNode* parameter)
+ : ExpressionNode(globalData)
+ , m_body(body)
+ {
+ m_body->finishParsing(source, parameter, ident);
+ }
+
+ inline FuncDeclNode::FuncDeclNode(JSGlobalData* globalData, const Identifier& ident, FunctionBodyNode* body, const SourceCode& source, ParameterNode* parameter)
+ : StatementNode(globalData)
+ , m_body(body)
+ {
+ m_body->finishParsing(source, parameter, ident);
+ }
+
+ inline CaseClauseNode::CaseClauseNode(JSGlobalData*, ExpressionNode* expr, SourceElements* statements)
+ : m_expr(expr)
+ , m_statements(statements)
+ {
+ }
+
+ inline ClauseListNode::ClauseListNode(JSGlobalData*, CaseClauseNode* clause)
+ : m_clause(clause)
+ , m_next(0)
+ {
+ }
+
+ inline ClauseListNode::ClauseListNode(JSGlobalData*, ClauseListNode* clauseList, CaseClauseNode* clause)
+ : m_clause(clause)
+ , m_next(0)
+ {
+ clauseList->m_next = this;
+ }
+
+ inline CaseBlockNode::CaseBlockNode(JSGlobalData*, ClauseListNode* list1, CaseClauseNode* defaultClause, ClauseListNode* list2)
+ : m_list1(list1)
+ , m_defaultClause(defaultClause)
+ , m_list2(list2)
+ {
+ }
+
+ inline SwitchNode::SwitchNode(JSGlobalData* globalData, ExpressionNode* expr, CaseBlockNode* block)
+ : StatementNode(globalData)
+ , m_expr(expr)
+ , m_block(block)
+ {
+ }
+
+ inline ConstDeclNode::ConstDeclNode(JSGlobalData* globalData, const Identifier& ident, ExpressionNode* init)
+ : ExpressionNode(globalData)
+ , m_ident(ident)
+ , m_next(0)
+ , m_init(init)
+ {
+ }
+
+ inline BlockNode::BlockNode(JSGlobalData* globalData, SourceElements* statements)
+ : StatementNode(globalData)
+ , m_statements(statements)
+ {
+ }
+
+ inline ForInNode::ForInNode(JSGlobalData* globalData, ExpressionNode* l, ExpressionNode* expr, StatementNode* statement)
+ : StatementNode(globalData)
+ , m_ident(globalData->propertyNames->nullIdentifier)
+ , m_init(0)
+ , m_lexpr(l)
+ , m_expr(expr)
+ , m_statement(statement)
+ , m_identIsVarDecl(false)
+ {
+ }
+
+ inline ForInNode::ForInNode(JSGlobalData* globalData, const Identifier& ident, ExpressionNode* in, ExpressionNode* expr, StatementNode* statement, int divot, int startOffset, int endOffset)
+ : StatementNode(globalData)
+ , m_ident(ident)
+ , m_init(0)
+ , m_lexpr(new (globalData) ResolveNode(globalData, ident, divot - startOffset))
+ , m_expr(expr)
+ , m_statement(statement)
+ , m_identIsVarDecl(true)
+ {
+ if (in) {
+ AssignResolveNode* node = new (globalData) AssignResolveNode(globalData, ident, in, true);
+ node->setExceptionSourceCode(divot, divot - startOffset, endOffset - divot);
+ m_init = node;
+ }
+ // for( var foo = bar in baz )
+ }
+
+} // namespace JSC
+
+#endif // NodeConstructors_h
diff --git a/Source/JavaScriptCore/parser/NodeInfo.h b/Source/JavaScriptCore/parser/NodeInfo.h
new file mode 100644
index 0000000..7f4deff
--- /dev/null
+++ b/Source/JavaScriptCore/parser/NodeInfo.h
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifndef NodeInfo_h
+#define NodeInfo_h
+
+#include "Nodes.h"
+#include "Parser.h"
+
+namespace JSC {
+
+ template <typename T> struct NodeInfo {
+ T m_node;
+ CodeFeatures m_features;
+ int m_numConstants;
+ };
+
+ typedef NodeInfo<FuncDeclNode*> FuncDeclNodeInfo;
+ typedef NodeInfo<FuncExprNode*> FuncExprNodeInfo;
+ typedef NodeInfo<ExpressionNode*> ExpressionNodeInfo;
+ typedef NodeInfo<ArgumentsNode*> ArgumentsNodeInfo;
+ typedef NodeInfo<ConstDeclNode*> ConstDeclNodeInfo;
+ typedef NodeInfo<PropertyNode*> PropertyNodeInfo;
+ typedef NodeInfo<PropertyList> PropertyListInfo;
+ typedef NodeInfo<ElementList> ElementListInfo;
+ typedef NodeInfo<ArgumentList> ArgumentListInfo;
+
+ template <typename T> struct NodeDeclarationInfo {
+ T m_node;
+ ParserArenaData<DeclarationStacks::VarStack>* m_varDeclarations;
+ ParserArenaData<DeclarationStacks::FunctionStack>* m_funcDeclarations;
+ CodeFeatures m_features;
+ int m_numConstants;
+ };
+
+ typedef NodeDeclarationInfo<StatementNode*> StatementNodeInfo;
+ typedef NodeDeclarationInfo<CaseBlockNode*> CaseBlockNodeInfo;
+ typedef NodeDeclarationInfo<CaseClauseNode*> CaseClauseNodeInfo;
+ typedef NodeDeclarationInfo<SourceElements*> SourceElementsInfo;
+ typedef NodeDeclarationInfo<ClauseList> ClauseListInfo;
+ typedef NodeDeclarationInfo<ExpressionNode*> VarDeclListInfo;
+ typedef NodeDeclarationInfo<ConstDeclList> ConstDeclListInfo;
+ typedef NodeDeclarationInfo<ParameterList> ParameterListInfo;
+
+} // namespace JSC
+
+#endif // NodeInfo_h
diff --git a/Source/JavaScriptCore/parser/Nodes.cpp b/Source/JavaScriptCore/parser/Nodes.cpp
new file mode 100644
index 0000000..34aa674
--- /dev/null
+++ b/Source/JavaScriptCore/parser/Nodes.cpp
@@ -0,0 +1,196 @@
+/*
+* Copyright (C) 1999-2002 Harri Porten (porten@kde.org)
+* Copyright (C) 2001 Peter Kelly (pmk@post.com)
+* Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+* Copyright (C) 2007 Cameron Zwarich (cwzwarich@uwaterloo.ca)
+* Copyright (C) 2007 Maks Orlovich
+* Copyright (C) 2007 Eric Seidel <eric@webkit.org>
+*
+* This library is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Library General Public
+* License as published by the Free Software Foundation; either
+* version 2 of the License, or (at your option) any later version.
+*
+* This library is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Library General Public License for more details.
+*
+* You should have received a copy of the GNU Library General Public License
+* along with this library; see the file COPYING.LIB. If not, write to
+* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+* Boston, MA 02110-1301, USA.
+*
+*/
+
+#include "config.h"
+#include "Nodes.h"
+#include "NodeConstructors.h"
+
+#include "BytecodeGenerator.h"
+#include "CallFrame.h"
+#include "Debugger.h"
+#include "JIT.h"
+#include "JSFunction.h"
+#include "JSGlobalObject.h"
+#include "JSStaticScopeObject.h"
+#include "LabelScope.h"
+#include "Lexer.h"
+#include "Operations.h"
+#include "Parser.h"
+#include "PropertyNameArray.h"
+#include "RegExpObject.h"
+#include "SamplingTool.h"
+#include <wtf/Assertions.h>
+#include <wtf/RefCountedLeakCounter.h>
+#include <wtf/Threading.h>
+
+using namespace WTF;
+
+namespace JSC {
+
+
+// ------------------------------ StatementNode --------------------------------
+
+void StatementNode::setLoc(int firstLine, int lastLine)
+{
+ m_line = firstLine;
+ m_lastLine = lastLine;
+}
+
+// ------------------------------ SourceElements --------------------------------
+
+void SourceElements::append(StatementNode* statement)
+{
+ if (statement->isEmptyStatement())
+ return;
+ m_statements.append(statement);
+}
+
+StatementNode* SourceElements::singleStatement() const
+{
+ size_t size = m_statements.size();
+ return size == 1 ? m_statements[0] : 0;
+}
+
+// -----------------------------ScopeNodeData ---------------------------
+
+ScopeNodeData::ScopeNodeData(ParserArena& arena, SourceElements* statements, VarStack* varStack, FunctionStack* funcStack, IdentifierSet& capturedVariables, int numConstants)
+ : m_numConstants(numConstants)
+ , m_statements(statements)
+{
+ m_arena.swap(arena);
+ if (varStack)
+ m_varStack.swap(*varStack);
+ if (funcStack)
+ m_functionStack.swap(*funcStack);
+ m_capturedVariables.swap(capturedVariables);
+}
+
+// ------------------------------ ScopeNode -----------------------------
+
+ScopeNode::ScopeNode(JSGlobalData* globalData, bool inStrictContext)
+ : StatementNode(globalData)
+ , ParserArenaRefCounted(globalData)
+ , m_features(inStrictContext ? StrictModeFeature : NoFeatures)
+{
+}
+
+ScopeNode::ScopeNode(JSGlobalData* globalData, const SourceCode& source, SourceElements* children, VarStack* varStack, FunctionStack* funcStack, IdentifierSet& capturedVariables, CodeFeatures features, int numConstants)
+ : StatementNode(globalData)
+ , ParserArenaRefCounted(globalData)
+ , m_data(adoptPtr(new ScopeNodeData(globalData->parser->arena(), children, varStack, funcStack, capturedVariables, numConstants)))
+ , m_features(features)
+ , m_source(source)
+{
+}
+
+StatementNode* ScopeNode::singleStatement() const
+{
+ return m_data->m_statements ? m_data->m_statements->singleStatement() : 0;
+}
+
+// ------------------------------ ProgramNode -----------------------------
+
+inline ProgramNode::ProgramNode(JSGlobalData* globalData, SourceElements* children, VarStack* varStack, FunctionStack* funcStack, IdentifierSet& capturedVariables, const SourceCode& source, CodeFeatures features, int numConstants)
+ : ScopeNode(globalData, source, children, varStack, funcStack, capturedVariables, features, numConstants)
+{
+}
+
+PassRefPtr<ProgramNode> ProgramNode::create(JSGlobalData* globalData, SourceElements* children, VarStack* varStack, FunctionStack* funcStack, IdentifierSet& capturedVariables, const SourceCode& source, CodeFeatures features, int numConstants)
+{
+ RefPtr<ProgramNode> node = new ProgramNode(globalData, children, varStack, funcStack, capturedVariables, source, features, numConstants);
+
+ ASSERT(node->data()->m_arena.last() == node);
+ node->data()->m_arena.removeLast();
+ ASSERT(!node->data()->m_arena.contains(node.get()));
+
+ return node.release();
+}
+
+// ------------------------------ EvalNode -----------------------------
+
+inline EvalNode::EvalNode(JSGlobalData* globalData, SourceElements* children, VarStack* varStack, FunctionStack* funcStack, IdentifierSet& capturedVariables, const SourceCode& source, CodeFeatures features, int numConstants)
+ : ScopeNode(globalData, source, children, varStack, funcStack, capturedVariables, features, numConstants)
+{
+}
+
+PassRefPtr<EvalNode> EvalNode::create(JSGlobalData* globalData, SourceElements* children, VarStack* varStack, FunctionStack* funcStack, IdentifierSet& capturedVariables, const SourceCode& source, CodeFeatures features, int numConstants)
+{
+ RefPtr<EvalNode> node = new EvalNode(globalData, children, varStack, funcStack, capturedVariables, source, features, numConstants);
+
+ ASSERT(node->data()->m_arena.last() == node);
+ node->data()->m_arena.removeLast();
+ ASSERT(!node->data()->m_arena.contains(node.get()));
+
+ return node.release();
+}
+
+// ------------------------------ FunctionBodyNode -----------------------------
+
+FunctionParameters::FunctionParameters(ParameterNode* firstParameter)
+{
+ for (ParameterNode* parameter = firstParameter; parameter; parameter = parameter->nextParam())
+ append(parameter->ident());
+}
+
+inline FunctionBodyNode::FunctionBodyNode(JSGlobalData* globalData, bool inStrictContext)
+ : ScopeNode(globalData, inStrictContext)
+{
+}
+
+inline FunctionBodyNode::FunctionBodyNode(JSGlobalData* globalData, SourceElements* children, VarStack* varStack, FunctionStack* funcStack, IdentifierSet& capturedVariables, const SourceCode& sourceCode, CodeFeatures features, int numConstants)
+ : ScopeNode(globalData, sourceCode, children, varStack, funcStack, capturedVariables, features, numConstants)
+{
+}
+
+void FunctionBodyNode::finishParsing(const SourceCode& source, ParameterNode* firstParameter, const Identifier& ident)
+{
+ setSource(source);
+ finishParsing(FunctionParameters::create(firstParameter), ident);
+}
+
+void FunctionBodyNode::finishParsing(PassRefPtr<FunctionParameters> parameters, const Identifier& ident)
+{
+ ASSERT(!source().isNull());
+ m_parameters = parameters;
+ m_ident = ident;
+}
+
+FunctionBodyNode* FunctionBodyNode::create(JSGlobalData* globalData, bool inStrictContext)
+{
+ return new FunctionBodyNode(globalData, inStrictContext);
+}
+
+PassRefPtr<FunctionBodyNode> FunctionBodyNode::create(JSGlobalData* globalData, SourceElements* children, VarStack* varStack, FunctionStack* funcStack, IdentifierSet& capturedVariables, const SourceCode& sourceCode, CodeFeatures features, int numConstants)
+{
+ RefPtr<FunctionBodyNode> node = new FunctionBodyNode(globalData, children, varStack, funcStack, capturedVariables, sourceCode, features, numConstants);
+
+ ASSERT(node->data()->m_arena.last() == node);
+ node->data()->m_arena.removeLast();
+ ASSERT(!node->data()->m_arena.contains(node.get()));
+
+ return node.release();
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/parser/Nodes.h b/Source/JavaScriptCore/parser/Nodes.h
new file mode 100644
index 0000000..b8e9cdf
--- /dev/null
+++ b/Source/JavaScriptCore/parser/Nodes.h
@@ -0,0 +1,1617 @@
+/*
+ * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
+ * Copyright (C) 2001 Peter Kelly (pmk@post.com)
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2007 Cameron Zwarich (cwzwarich@uwaterloo.ca)
+ * Copyright (C) 2007 Maks Orlovich
+ * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef Nodes_h
+#define Nodes_h
+
+#include "Error.h"
+#include "JITCode.h"
+#include "Opcode.h"
+#include "ParserArena.h"
+#include "ResultType.h"
+#include "SourceCode.h"
+#include "SymbolTable.h"
+#include <wtf/MathExtras.h>
+
+namespace JSC {
+
+ class ArgumentListNode;
+ class BytecodeGenerator;
+ class FunctionBodyNode;
+ class Label;
+ class PropertyListNode;
+ class ReadModifyResolveNode;
+ class RegisterID;
+ class ScopeChainNode;
+ class ScopeNode;
+
+ typedef unsigned CodeFeatures;
+
+ const CodeFeatures NoFeatures = 0;
+ const CodeFeatures EvalFeature = 1 << 0;
+ const CodeFeatures ClosureFeature = 1 << 1;
+ const CodeFeatures AssignFeature = 1 << 2;
+ const CodeFeatures ArgumentsFeature = 1 << 3;
+ const CodeFeatures WithFeature = 1 << 4;
+ const CodeFeatures CatchFeature = 1 << 5;
+ const CodeFeatures ThisFeature = 1 << 6;
+ const CodeFeatures StrictModeFeature = 1 << 7;
+ const CodeFeatures ShadowsArgumentsFeature = 1 << 8;
+
+
+ const CodeFeatures AllFeatures = EvalFeature | ClosureFeature | AssignFeature | ArgumentsFeature | WithFeature | CatchFeature | ThisFeature | StrictModeFeature | ShadowsArgumentsFeature;
+
+ enum Operator {
+ OpEqual,
+ OpPlusEq,
+ OpMinusEq,
+ OpMultEq,
+ OpDivEq,
+ OpPlusPlus,
+ OpMinusMinus,
+ OpAndEq,
+ OpXOrEq,
+ OpOrEq,
+ OpModEq,
+ OpLShift,
+ OpRShift,
+ OpURShift
+ };
+
+ enum LogicalOperator {
+ OpLogicalAnd,
+ OpLogicalOr
+ };
+
+ typedef HashSet<RefPtr<StringImpl>, IdentifierRepHash> IdentifierSet;
+
+ namespace DeclarationStacks {
+ enum VarAttrs { IsConstant = 1, HasInitializer = 2 };
+ typedef Vector<std::pair<const Identifier*, unsigned> > VarStack;
+ typedef Vector<FunctionBodyNode*> FunctionStack;
+ }
+
+ struct SwitchInfo {
+ enum SwitchType { SwitchNone, SwitchImmediate, SwitchCharacter, SwitchString };
+ uint32_t bytecodeOffset;
+ SwitchType switchType;
+ };
+
+ class ParserArenaFreeable {
+ public:
+ // ParserArenaFreeable objects are are freed when the arena is deleted.
+ // Destructors are not called. Clients must not call delete on such objects.
+ void* operator new(size_t, JSGlobalData*);
+ };
+
+ class ParserArenaDeletable {
+ public:
+ virtual ~ParserArenaDeletable() { }
+
+ // ParserArenaDeletable objects are deleted when the arena is deleted.
+ // Clients must not call delete directly on such objects.
+ void* operator new(size_t, JSGlobalData*);
+ };
+
+ class ParserArenaRefCounted : public RefCounted<ParserArenaRefCounted> {
+ protected:
+ ParserArenaRefCounted(JSGlobalData*);
+
+ public:
+ virtual ~ParserArenaRefCounted()
+ {
+ ASSERT(deletionHasBegun());
+ }
+ };
+
+ class Node : public ParserArenaFreeable {
+ protected:
+ Node(JSGlobalData*);
+
+ public:
+ virtual ~Node() { }
+
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* destination = 0) = 0;
+
+ int lineNo() const { return m_line; }
+
+ protected:
+ int m_line;
+ };
+
+ class ExpressionNode : public Node {
+ protected:
+ ExpressionNode(JSGlobalData*, ResultType = ResultType::unknownType());
+
+ public:
+ virtual bool isNumber() const { return false; }
+ virtual bool isString() const { return false; }
+ virtual bool isNull() const { return false; }
+ virtual bool isPure(BytecodeGenerator&) const { return false; }
+ virtual bool isLocation() const { return false; }
+ virtual bool isResolveNode() const { return false; }
+ virtual bool isBracketAccessorNode() const { return false; }
+ virtual bool isDotAccessorNode() const { return false; }
+ virtual bool isFuncExprNode() const { return false; }
+ virtual bool isCommaNode() const { return false; }
+ virtual bool isSimpleArray() const { return false; }
+ virtual bool isAdd() const { return false; }
+ virtual bool isSubtract() const { return false; }
+ virtual bool hasConditionContextCodegen() const { return false; }
+
+ virtual void emitBytecodeInConditionContext(BytecodeGenerator&, Label*, Label*, bool) { ASSERT_NOT_REACHED(); }
+
+ virtual ExpressionNode* stripUnaryPlus() { return this; }
+
+ ResultType resultDescriptor() const { return m_resultType; }
+
+ private:
+ ResultType m_resultType;
+ };
+
+ class StatementNode : public Node {
+ protected:
+ StatementNode(JSGlobalData*);
+
+ public:
+ void setLoc(int firstLine, int lastLine);
+ int firstLine() const { return lineNo(); }
+ int lastLine() const { return m_lastLine; }
+
+ virtual bool isEmptyStatement() const { return false; }
+ virtual bool isReturnNode() const { return false; }
+ virtual bool isExprStatement() const { return false; }
+
+ virtual bool isBlock() const { return false; }
+
+ private:
+ int m_lastLine;
+ };
+
+ class NullNode : public ExpressionNode {
+ public:
+ NullNode(JSGlobalData*);
+
+ private:
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+
+ virtual bool isNull() const { return true; }
+ };
+
+ class BooleanNode : public ExpressionNode {
+ public:
+ BooleanNode(JSGlobalData*, bool value);
+
+ private:
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+
+ virtual bool isPure(BytecodeGenerator&) const { return true; }
+
+ bool m_value;
+ };
+
+ class NumberNode : public ExpressionNode {
+ public:
+ NumberNode(JSGlobalData*, double value);
+
+ double value() const { return m_value; }
+ void setValue(double value) { m_value = value; }
+
+ private:
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+
+ virtual bool isNumber() const { return true; }
+ virtual bool isPure(BytecodeGenerator&) const { return true; }
+
+ double m_value;
+ };
+
+ class StringNode : public ExpressionNode {
+ public:
+ StringNode(JSGlobalData*, const Identifier&);
+
+ const Identifier& value() { return m_value; }
+
+ private:
+ virtual bool isPure(BytecodeGenerator&) const { return true; }
+
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+
+ virtual bool isString() const { return true; }
+
+ const Identifier& m_value;
+ };
+
+ class ThrowableExpressionData {
+ public:
+ ThrowableExpressionData()
+ : m_divot(static_cast<uint32_t>(-1))
+ , m_startOffset(static_cast<uint16_t>(-1))
+ , m_endOffset(static_cast<uint16_t>(-1))
+ {
+ }
+
+ ThrowableExpressionData(unsigned divot, unsigned startOffset, unsigned endOffset)
+ : m_divot(divot)
+ , m_startOffset(startOffset)
+ , m_endOffset(endOffset)
+ {
+ }
+
+ void setExceptionSourceCode(unsigned divot, unsigned startOffset, unsigned endOffset)
+ {
+ m_divot = divot;
+ m_startOffset = startOffset;
+ m_endOffset = endOffset;
+ }
+
+ uint32_t divot() const { return m_divot; }
+ uint16_t startOffset() const { return m_startOffset; }
+ uint16_t endOffset() const { return m_endOffset; }
+
+ protected:
+ RegisterID* emitThrowReferenceError(BytecodeGenerator&, const UString& message);
+ RegisterID* emitThrowSyntaxError(BytecodeGenerator&, const UString& message);
+
+ private:
+ uint32_t m_divot;
+ uint16_t m_startOffset;
+ uint16_t m_endOffset;
+ };
+
+ class ThrowableSubExpressionData : public ThrowableExpressionData {
+ public:
+ ThrowableSubExpressionData()
+ : m_subexpressionDivotOffset(0)
+ , m_subexpressionEndOffset(0)
+ {
+ }
+
+ ThrowableSubExpressionData(unsigned divot, unsigned startOffset, unsigned endOffset)
+ : ThrowableExpressionData(divot, startOffset, endOffset)
+ , m_subexpressionDivotOffset(0)
+ , m_subexpressionEndOffset(0)
+ {
+ }
+
+ void setSubexpressionInfo(uint32_t subexpressionDivot, uint16_t subexpressionOffset)
+ {
+ ASSERT(subexpressionDivot <= divot());
+ if ((divot() - subexpressionDivot) & ~0xFFFF) // Overflow means we can't do this safely, so just point at the primary divot
+ return;
+ m_subexpressionDivotOffset = divot() - subexpressionDivot;
+ m_subexpressionEndOffset = subexpressionOffset;
+ }
+
+ protected:
+ uint16_t m_subexpressionDivotOffset;
+ uint16_t m_subexpressionEndOffset;
+ };
+
+ class ThrowablePrefixedSubExpressionData : public ThrowableExpressionData {
+ public:
+ ThrowablePrefixedSubExpressionData()
+ : m_subexpressionDivotOffset(0)
+ , m_subexpressionStartOffset(0)
+ {
+ }
+
+ ThrowablePrefixedSubExpressionData(unsigned divot, unsigned startOffset, unsigned endOffset)
+ : ThrowableExpressionData(divot, startOffset, endOffset)
+ , m_subexpressionDivotOffset(0)
+ , m_subexpressionStartOffset(0)
+ {
+ }
+
+ void setSubexpressionInfo(uint32_t subexpressionDivot, uint16_t subexpressionOffset)
+ {
+ ASSERT(subexpressionDivot >= divot());
+ if ((subexpressionDivot - divot()) & ~0xFFFF) // Overflow means we can't do this safely, so just point at the primary divot
+ return;
+ m_subexpressionDivotOffset = subexpressionDivot - divot();
+ m_subexpressionStartOffset = subexpressionOffset;
+ }
+
+ protected:
+ uint16_t m_subexpressionDivotOffset;
+ uint16_t m_subexpressionStartOffset;
+ };
+
+ class RegExpNode : public ExpressionNode, public ThrowableExpressionData {
+ public:
+ RegExpNode(JSGlobalData*, const Identifier& pattern, const Identifier& flags);
+
+ private:
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+
+ const Identifier& m_pattern;
+ const Identifier& m_flags;
+ };
+
+ class ThisNode : public ExpressionNode {
+ public:
+ ThisNode(JSGlobalData*);
+
+ private:
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+ };
+
+ class ResolveNode : public ExpressionNode {
+ public:
+ ResolveNode(JSGlobalData*, const Identifier&, int startOffset);
+
+ const Identifier& identifier() const { return m_ident; }
+
+ private:
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+
+ virtual bool isPure(BytecodeGenerator&) const ;
+ virtual bool isLocation() const { return true; }
+ virtual bool isResolveNode() const { return true; }
+
+ const Identifier& m_ident;
+ int32_t m_startOffset;
+ };
+
+ class ElementNode : public ParserArenaFreeable {
+ public:
+ ElementNode(JSGlobalData*, int elision, ExpressionNode*);
+ ElementNode(JSGlobalData*, ElementNode*, int elision, ExpressionNode*);
+
+ int elision() const { return m_elision; }
+ ExpressionNode* value() { return m_node; }
+ ElementNode* next() { return m_next; }
+
+ private:
+ ElementNode* m_next;
+ int m_elision;
+ ExpressionNode* m_node;
+ };
+
+ class ArrayNode : public ExpressionNode {
+ public:
+ ArrayNode(JSGlobalData*, int elision);
+ ArrayNode(JSGlobalData*, ElementNode*);
+ ArrayNode(JSGlobalData*, int elision, ElementNode*);
+
+ ArgumentListNode* toArgumentList(JSGlobalData*) const;
+
+ private:
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+
+ virtual bool isSimpleArray() const ;
+
+ ElementNode* m_element;
+ int m_elision;
+ bool m_optional;
+ };
+
+ class PropertyNode : public ParserArenaFreeable {
+ public:
+ enum Type { Constant = 1, Getter = 2, Setter = 4 };
+
+ PropertyNode(JSGlobalData*, const Identifier& name, ExpressionNode* value, Type);
+ PropertyNode(JSGlobalData*, double name, ExpressionNode* value, Type);
+
+ const Identifier& name() const { return m_name; }
+ Type type() const { return m_type; }
+
+ private:
+ friend class PropertyListNode;
+ const Identifier& m_name;
+ ExpressionNode* m_assign;
+ Type m_type;
+ };
+
+ class PropertyListNode : public Node {
+ public:
+ PropertyListNode(JSGlobalData*, PropertyNode*);
+ PropertyListNode(JSGlobalData*, PropertyNode*, PropertyListNode*);
+
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+
+ private:
+ PropertyNode* m_node;
+ PropertyListNode* m_next;
+ };
+
+ class ObjectLiteralNode : public ExpressionNode {
+ public:
+ ObjectLiteralNode(JSGlobalData*);
+ ObjectLiteralNode(JSGlobalData*, PropertyListNode*);
+
+ private:
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+
+ PropertyListNode* m_list;
+ };
+
+ class BracketAccessorNode : public ExpressionNode, public ThrowableExpressionData {
+ public:
+ BracketAccessorNode(JSGlobalData*, ExpressionNode* base, ExpressionNode* subscript, bool subscriptHasAssignments);
+
+ ExpressionNode* base() const { return m_base; }
+ ExpressionNode* subscript() const { return m_subscript; }
+
+ private:
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+
+ virtual bool isLocation() const { return true; }
+ virtual bool isBracketAccessorNode() const { return true; }
+
+ ExpressionNode* m_base;
+ ExpressionNode* m_subscript;
+ bool m_subscriptHasAssignments;
+ };
+
+ class DotAccessorNode : public ExpressionNode, public ThrowableExpressionData {
+ public:
+ DotAccessorNode(JSGlobalData*, ExpressionNode* base, const Identifier&);
+
+ ExpressionNode* base() const { return m_base; }
+ const Identifier& identifier() const { return m_ident; }
+
+ private:
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+
+ virtual bool isLocation() const { return true; }
+ virtual bool isDotAccessorNode() const { return true; }
+
+ ExpressionNode* m_base;
+ const Identifier& m_ident;
+ };
+
+ class ArgumentListNode : public Node {
+ public:
+ ArgumentListNode(JSGlobalData*, ExpressionNode*);
+ ArgumentListNode(JSGlobalData*, ArgumentListNode*, ExpressionNode*);
+
+ ArgumentListNode* m_next;
+ ExpressionNode* m_expr;
+
+ private:
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+ };
+
+ class ArgumentsNode : public ParserArenaFreeable {
+ public:
+ ArgumentsNode(JSGlobalData*);
+ ArgumentsNode(JSGlobalData*, ArgumentListNode*);
+
+ ArgumentListNode* m_listNode;
+ };
+
+ class NewExprNode : public ExpressionNode, public ThrowableExpressionData {
+ public:
+ NewExprNode(JSGlobalData*, ExpressionNode*);
+ NewExprNode(JSGlobalData*, ExpressionNode*, ArgumentsNode*);
+
+ private:
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+
+ ExpressionNode* m_expr;
+ ArgumentsNode* m_args;
+ };
+
+ class EvalFunctionCallNode : public ExpressionNode, public ThrowableExpressionData {
+ public:
+ EvalFunctionCallNode(JSGlobalData*, ArgumentsNode*, unsigned divot, unsigned startOffset, unsigned endOffset);
+
+ private:
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+
+ ArgumentsNode* m_args;
+ };
+
+ class FunctionCallValueNode : public ExpressionNode, public ThrowableExpressionData {
+ public:
+ FunctionCallValueNode(JSGlobalData*, ExpressionNode*, ArgumentsNode*, unsigned divot, unsigned startOffset, unsigned endOffset);
+
+ private:
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+
+ ExpressionNode* m_expr;
+ ArgumentsNode* m_args;
+ };
+
+ class FunctionCallResolveNode : public ExpressionNode, public ThrowableExpressionData {
+ public:
+ FunctionCallResolveNode(JSGlobalData*, const Identifier&, ArgumentsNode*, unsigned divot, unsigned startOffset, unsigned endOffset);
+
+ private:
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+
+ const Identifier& m_ident;
+ ArgumentsNode* m_args;
+ size_t m_index; // Used by LocalVarFunctionCallNode.
+ size_t m_scopeDepth; // Used by ScopedVarFunctionCallNode and NonLocalVarFunctionCallNode
+ };
+
+ class FunctionCallBracketNode : public ExpressionNode, public ThrowableSubExpressionData {
+ public:
+ FunctionCallBracketNode(JSGlobalData*, ExpressionNode* base, ExpressionNode* subscript, ArgumentsNode*, unsigned divot, unsigned startOffset, unsigned endOffset);
+
+ private:
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+
+ ExpressionNode* m_base;
+ ExpressionNode* m_subscript;
+ ArgumentsNode* m_args;
+ };
+
+ class FunctionCallDotNode : public ExpressionNode, public ThrowableSubExpressionData {
+ public:
+ FunctionCallDotNode(JSGlobalData*, ExpressionNode* base, const Identifier&, ArgumentsNode*, unsigned divot, unsigned startOffset, unsigned endOffset);
+
+ private:
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+
+ protected:
+ ExpressionNode* m_base;
+ const Identifier& m_ident;
+ ArgumentsNode* m_args;
+ };
+
+ class CallFunctionCallDotNode : public FunctionCallDotNode {
+ public:
+ CallFunctionCallDotNode(JSGlobalData*, ExpressionNode* base, const Identifier&, ArgumentsNode*, unsigned divot, unsigned startOffset, unsigned endOffset);
+
+ private:
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+ };
+
+ class ApplyFunctionCallDotNode : public FunctionCallDotNode {
+ public:
+ ApplyFunctionCallDotNode(JSGlobalData*, ExpressionNode* base, const Identifier&, ArgumentsNode*, unsigned divot, unsigned startOffset, unsigned endOffset);
+
+ private:
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+ };
+
+ class PrePostResolveNode : public ExpressionNode, public ThrowableExpressionData {
+ public:
+ PrePostResolveNode(JSGlobalData*, const Identifier&, unsigned divot, unsigned startOffset, unsigned endOffset);
+
+ protected:
+ const Identifier& m_ident;
+ };
+
+ class PostfixResolveNode : public PrePostResolveNode {
+ public:
+ PostfixResolveNode(JSGlobalData*, const Identifier&, Operator, unsigned divot, unsigned startOffset, unsigned endOffset);
+
+ private:
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+
+ Operator m_operator;
+ };
+
+ class PostfixBracketNode : public ExpressionNode, public ThrowableSubExpressionData {
+ public:
+ PostfixBracketNode(JSGlobalData*, ExpressionNode* base, ExpressionNode* subscript, Operator, unsigned divot, unsigned startOffset, unsigned endOffset);
+
+ private:
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+
+ ExpressionNode* m_base;
+ ExpressionNode* m_subscript;
+ Operator m_operator;
+ };
+
+ class PostfixDotNode : public ExpressionNode, public ThrowableSubExpressionData {
+ public:
+ PostfixDotNode(JSGlobalData*, ExpressionNode* base, const Identifier&, Operator, unsigned divot, unsigned startOffset, unsigned endOffset);
+
+ private:
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+
+ ExpressionNode* m_base;
+ const Identifier& m_ident;
+ Operator m_operator;
+ };
+
+ class PostfixErrorNode : public ExpressionNode, public ThrowableSubExpressionData {
+ public:
+ PostfixErrorNode(JSGlobalData*, ExpressionNode*, Operator, unsigned divot, unsigned startOffset, unsigned endOffset);
+
+ private:
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+
+ ExpressionNode* m_expr;
+ Operator m_operator;
+ };
+
+ class DeleteResolveNode : public ExpressionNode, public ThrowableExpressionData {
+ public:
+ DeleteResolveNode(JSGlobalData*, const Identifier&, unsigned divot, unsigned startOffset, unsigned endOffset);
+
+ private:
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+
+ const Identifier& m_ident;
+ };
+
+ class DeleteBracketNode : public ExpressionNode, public ThrowableExpressionData {
+ public:
+ DeleteBracketNode(JSGlobalData*, ExpressionNode* base, ExpressionNode* subscript, unsigned divot, unsigned startOffset, unsigned endOffset);
+
+ private:
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+
+ ExpressionNode* m_base;
+ ExpressionNode* m_subscript;
+ };
+
+ class DeleteDotNode : public ExpressionNode, public ThrowableExpressionData {
+ public:
+ DeleteDotNode(JSGlobalData*, ExpressionNode* base, const Identifier&, unsigned divot, unsigned startOffset, unsigned endOffset);
+
+ private:
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+
+ ExpressionNode* m_base;
+ const Identifier& m_ident;
+ };
+
+ class DeleteValueNode : public ExpressionNode {
+ public:
+ DeleteValueNode(JSGlobalData*, ExpressionNode*);
+
+ private:
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+
+ ExpressionNode* m_expr;
+ };
+
+ class VoidNode : public ExpressionNode {
+ public:
+ VoidNode(JSGlobalData*, ExpressionNode*);
+
+ private:
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+
+ ExpressionNode* m_expr;
+ };
+
+ class TypeOfResolveNode : public ExpressionNode {
+ public:
+ TypeOfResolveNode(JSGlobalData*, const Identifier&);
+
+ const Identifier& identifier() const { return m_ident; }
+
+ private:
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+
+ const Identifier& m_ident;
+ };
+
+ class TypeOfValueNode : public ExpressionNode {
+ public:
+ TypeOfValueNode(JSGlobalData*, ExpressionNode*);
+
+ private:
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+
+ ExpressionNode* m_expr;
+ };
+
+ class PrefixResolveNode : public PrePostResolveNode {
+ public:
+ PrefixResolveNode(JSGlobalData*, const Identifier&, Operator, unsigned divot, unsigned startOffset, unsigned endOffset);
+
+ private:
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+
+ Operator m_operator;
+ };
+
+ class PrefixBracketNode : public ExpressionNode, public ThrowablePrefixedSubExpressionData {
+ public:
+ PrefixBracketNode(JSGlobalData*, ExpressionNode* base, ExpressionNode* subscript, Operator, unsigned divot, unsigned startOffset, unsigned endOffset);
+
+ private:
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+
+ ExpressionNode* m_base;
+ ExpressionNode* m_subscript;
+ Operator m_operator;
+ };
+
+ class PrefixDotNode : public ExpressionNode, public ThrowablePrefixedSubExpressionData {
+ public:
+ PrefixDotNode(JSGlobalData*, ExpressionNode* base, const Identifier&, Operator, unsigned divot, unsigned startOffset, unsigned endOffset);
+
+ private:
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+
+ ExpressionNode* m_base;
+ const Identifier& m_ident;
+ Operator m_operator;
+ };
+
+ class PrefixErrorNode : public ExpressionNode, public ThrowableExpressionData {
+ public:
+ PrefixErrorNode(JSGlobalData*, ExpressionNode*, Operator, unsigned divot, unsigned startOffset, unsigned endOffset);
+
+ private:
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+
+ ExpressionNode* m_expr;
+ Operator m_operator;
+ };
+
+ class UnaryOpNode : public ExpressionNode {
+ public:
+ UnaryOpNode(JSGlobalData*, ResultType, ExpressionNode*, OpcodeID);
+
+ protected:
+ ExpressionNode* expr() { return m_expr; }
+ const ExpressionNode* expr() const { return m_expr; }
+
+ private:
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+
+ OpcodeID opcodeID() const { return m_opcodeID; }
+
+ ExpressionNode* m_expr;
+ OpcodeID m_opcodeID;
+ };
+
+ class UnaryPlusNode : public UnaryOpNode {
+ public:
+ UnaryPlusNode(JSGlobalData*, ExpressionNode*);
+
+ private:
+ virtual ExpressionNode* stripUnaryPlus() { return expr(); }
+ };
+
+ class NegateNode : public UnaryOpNode {
+ public:
+ NegateNode(JSGlobalData*, ExpressionNode*);
+ };
+
+ class BitwiseNotNode : public UnaryOpNode {
+ public:
+ BitwiseNotNode(JSGlobalData*, ExpressionNode*);
+ };
+
+ class LogicalNotNode : public UnaryOpNode {
+ public:
+ LogicalNotNode(JSGlobalData*, ExpressionNode*);
+ private:
+ void emitBytecodeInConditionContext(BytecodeGenerator&, Label* trueTarget, Label* falseTarget, bool fallThroughMeansTrue);
+ virtual bool hasConditionContextCodegen() const { return expr()->hasConditionContextCodegen(); }
+ };
+
+ class BinaryOpNode : public ExpressionNode {
+ public:
+ BinaryOpNode(JSGlobalData*, ExpressionNode* expr1, ExpressionNode* expr2, OpcodeID, bool rightHasAssignments);
+ BinaryOpNode(JSGlobalData*, ResultType, ExpressionNode* expr1, ExpressionNode* expr2, OpcodeID, bool rightHasAssignments);
+
+ RegisterID* emitStrcat(BytecodeGenerator& generator, RegisterID* destination, RegisterID* lhs = 0, ReadModifyResolveNode* emitExpressionInfoForMe = 0);
+
+ ExpressionNode* lhs() { return m_expr1; };
+ ExpressionNode* rhs() { return m_expr2; };
+
+ private:
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+
+ protected:
+ OpcodeID opcodeID() const { return m_opcodeID; }
+
+ protected:
+ ExpressionNode* m_expr1;
+ ExpressionNode* m_expr2;
+ private:
+ OpcodeID m_opcodeID;
+ protected:
+ bool m_rightHasAssignments;
+ };
+
+ class ReverseBinaryOpNode : public BinaryOpNode {
+ public:
+ ReverseBinaryOpNode(JSGlobalData*, ExpressionNode* expr1, ExpressionNode* expr2, OpcodeID, bool rightHasAssignments);
+ ReverseBinaryOpNode(JSGlobalData*, ResultType, ExpressionNode* expr1, ExpressionNode* expr2, OpcodeID, bool rightHasAssignments);
+
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+ };
+
+ class MultNode : public BinaryOpNode {
+ public:
+ MultNode(JSGlobalData*, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments);
+ };
+
+ class DivNode : public BinaryOpNode {
+ public:
+ DivNode(JSGlobalData*, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments);
+ };
+
+ class ModNode : public BinaryOpNode {
+ public:
+ ModNode(JSGlobalData*, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments);
+ };
+
+ class AddNode : public BinaryOpNode {
+ public:
+ AddNode(JSGlobalData*, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments);
+
+ virtual bool isAdd() const { return true; }
+ };
+
+ class SubNode : public BinaryOpNode {
+ public:
+ SubNode(JSGlobalData*, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments);
+
+ virtual bool isSubtract() const { return true; }
+ };
+
+ class LeftShiftNode : public BinaryOpNode {
+ public:
+ LeftShiftNode(JSGlobalData*, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments);
+ };
+
+ class RightShiftNode : public BinaryOpNode {
+ public:
+ RightShiftNode(JSGlobalData*, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments);
+ };
+
+ class UnsignedRightShiftNode : public BinaryOpNode {
+ public:
+ UnsignedRightShiftNode(JSGlobalData*, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments);
+ };
+
+ class LessNode : public BinaryOpNode {
+ public:
+ LessNode(JSGlobalData*, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments);
+ };
+
+ class GreaterNode : public ReverseBinaryOpNode {
+ public:
+ GreaterNode(JSGlobalData*, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments);
+ };
+
+ class LessEqNode : public BinaryOpNode {
+ public:
+ LessEqNode(JSGlobalData*, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments);
+ };
+
+ class GreaterEqNode : public ReverseBinaryOpNode {
+ public:
+ GreaterEqNode(JSGlobalData*, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments);
+ };
+
+ class ThrowableBinaryOpNode : public BinaryOpNode, public ThrowableExpressionData {
+ public:
+ ThrowableBinaryOpNode(JSGlobalData*, ResultType, ExpressionNode* expr1, ExpressionNode* expr2, OpcodeID, bool rightHasAssignments);
+ ThrowableBinaryOpNode(JSGlobalData*, ExpressionNode* expr1, ExpressionNode* expr2, OpcodeID, bool rightHasAssignments);
+
+ private:
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+ };
+
+ class InstanceOfNode : public ThrowableBinaryOpNode {
+ public:
+ InstanceOfNode(JSGlobalData*, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments);
+
+ private:
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+ };
+
+ class InNode : public ThrowableBinaryOpNode {
+ public:
+ InNode(JSGlobalData*, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments);
+ };
+
+ class EqualNode : public BinaryOpNode {
+ public:
+ EqualNode(JSGlobalData*, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments);
+
+ private:
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+ };
+
+ class NotEqualNode : public BinaryOpNode {
+ public:
+ NotEqualNode(JSGlobalData*, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments);
+ };
+
+ class StrictEqualNode : public BinaryOpNode {
+ public:
+ StrictEqualNode(JSGlobalData*, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments);
+
+ private:
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+ };
+
+ class NotStrictEqualNode : public BinaryOpNode {
+ public:
+ NotStrictEqualNode(JSGlobalData*, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments);
+ };
+
+ class BitAndNode : public BinaryOpNode {
+ public:
+ BitAndNode(JSGlobalData*, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments);
+ };
+
+ class BitOrNode : public BinaryOpNode {
+ public:
+ BitOrNode(JSGlobalData*, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments);
+ };
+
+ class BitXOrNode : public BinaryOpNode {
+ public:
+ BitXOrNode(JSGlobalData*, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments);
+ };
+
+ // m_expr1 && m_expr2, m_expr1 || m_expr2
+ class LogicalOpNode : public ExpressionNode {
+ public:
+ LogicalOpNode(JSGlobalData*, ExpressionNode* expr1, ExpressionNode* expr2, LogicalOperator);
+
+ private:
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+ void emitBytecodeInConditionContext(BytecodeGenerator&, Label* trueTarget, Label* falseTarget, bool fallThroughMeansTrue);
+ virtual bool hasConditionContextCodegen() const { return true; }
+
+ ExpressionNode* m_expr1;
+ ExpressionNode* m_expr2;
+ LogicalOperator m_operator;
+ };
+
+ // The ternary operator, "m_logical ? m_expr1 : m_expr2"
+ class ConditionalNode : public ExpressionNode {
+ public:
+ ConditionalNode(JSGlobalData*, ExpressionNode* logical, ExpressionNode* expr1, ExpressionNode* expr2);
+
+ private:
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+
+ ExpressionNode* m_logical;
+ ExpressionNode* m_expr1;
+ ExpressionNode* m_expr2;
+ };
+
+ class ReadModifyResolveNode : public ExpressionNode, public ThrowableExpressionData {
+ public:
+ ReadModifyResolveNode(JSGlobalData*, const Identifier&, Operator, ExpressionNode* right, bool rightHasAssignments, unsigned divot, unsigned startOffset, unsigned endOffset);
+
+ private:
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+
+ const Identifier& m_ident;
+ ExpressionNode* m_right;
+ size_t m_index; // Used by ReadModifyLocalVarNode.
+ Operator m_operator;
+ bool m_rightHasAssignments;
+ };
+
+ class AssignResolveNode : public ExpressionNode, public ThrowableExpressionData {
+ public:
+ AssignResolveNode(JSGlobalData*, const Identifier&, ExpressionNode* right, bool rightHasAssignments);
+
+ private:
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+
+ const Identifier& m_ident;
+ ExpressionNode* m_right;
+ size_t m_index; // Used by ReadModifyLocalVarNode.
+ bool m_rightHasAssignments;
+ };
+
+ class ReadModifyBracketNode : public ExpressionNode, public ThrowableSubExpressionData {
+ public:
+ ReadModifyBracketNode(JSGlobalData*, ExpressionNode* base, ExpressionNode* subscript, Operator, ExpressionNode* right, bool subscriptHasAssignments, bool rightHasAssignments, unsigned divot, unsigned startOffset, unsigned endOffset);
+
+ private:
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+
+ ExpressionNode* m_base;
+ ExpressionNode* m_subscript;
+ ExpressionNode* m_right;
+ Operator m_operator : 30;
+ bool m_subscriptHasAssignments : 1;
+ bool m_rightHasAssignments : 1;
+ };
+
+ class AssignBracketNode : public ExpressionNode, public ThrowableExpressionData {
+ public:
+ AssignBracketNode(JSGlobalData*, ExpressionNode* base, ExpressionNode* subscript, ExpressionNode* right, bool subscriptHasAssignments, bool rightHasAssignments, unsigned divot, unsigned startOffset, unsigned endOffset);
+
+ private:
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+
+ ExpressionNode* m_base;
+ ExpressionNode* m_subscript;
+ ExpressionNode* m_right;
+ bool m_subscriptHasAssignments : 1;
+ bool m_rightHasAssignments : 1;
+ };
+
+ class AssignDotNode : public ExpressionNode, public ThrowableExpressionData {
+ public:
+ AssignDotNode(JSGlobalData*, ExpressionNode* base, const Identifier&, ExpressionNode* right, bool rightHasAssignments, unsigned divot, unsigned startOffset, unsigned endOffset);
+
+ private:
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+
+ ExpressionNode* m_base;
+ const Identifier& m_ident;
+ ExpressionNode* m_right;
+ bool m_rightHasAssignments;
+ };
+
+ class ReadModifyDotNode : public ExpressionNode, public ThrowableSubExpressionData {
+ public:
+ ReadModifyDotNode(JSGlobalData*, ExpressionNode* base, const Identifier&, Operator, ExpressionNode* right, bool rightHasAssignments, unsigned divot, unsigned startOffset, unsigned endOffset);
+
+ private:
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+
+ ExpressionNode* m_base;
+ const Identifier& m_ident;
+ ExpressionNode* m_right;
+ Operator m_operator : 31;
+ bool m_rightHasAssignments : 1;
+ };
+
+ class AssignErrorNode : public ExpressionNode, public ThrowableExpressionData {
+ public:
+ AssignErrorNode(JSGlobalData*, ExpressionNode* left, Operator, ExpressionNode* right, unsigned divot, unsigned startOffset, unsigned endOffset);
+
+ private:
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+
+ ExpressionNode* m_left;
+ Operator m_operator;
+ ExpressionNode* m_right;
+ };
+
+ typedef Vector<ExpressionNode*, 8> ExpressionVector;
+
+ class CommaNode : public ExpressionNode, public ParserArenaDeletable {
+ public:
+ CommaNode(JSGlobalData*, ExpressionNode* expr1, ExpressionNode* expr2);
+
+ using ParserArenaDeletable::operator new;
+
+ void append(ExpressionNode* expr) { m_expressions.append(expr); }
+
+ private:
+ virtual bool isCommaNode() const { return true; }
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+
+ ExpressionVector m_expressions;
+ };
+
+ class ConstDeclNode : public ExpressionNode {
+ public:
+ ConstDeclNode(JSGlobalData*, const Identifier&, ExpressionNode*);
+
+ bool hasInitializer() const { return m_init; }
+ const Identifier& ident() { return m_ident; }
+
+ private:
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+ virtual RegisterID* emitCodeSingle(BytecodeGenerator&);
+
+ const Identifier& m_ident;
+
+ public:
+ ConstDeclNode* m_next;
+
+ private:
+ ExpressionNode* m_init;
+ };
+
+ class ConstStatementNode : public StatementNode {
+ public:
+ ConstStatementNode(JSGlobalData*, ConstDeclNode* next);
+
+ private:
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+
+ ConstDeclNode* m_next;
+ };
+
+ class SourceElements : public ParserArenaDeletable {
+ public:
+ SourceElements(JSGlobalData*);
+
+ void append(StatementNode*);
+
+ StatementNode* singleStatement() const;
+ StatementNode* lastStatement() const;
+
+ void emitBytecode(BytecodeGenerator&, RegisterID* destination);
+
+ private:
+ Vector<StatementNode*> m_statements;
+ };
+
+ class BlockNode : public StatementNode {
+ public:
+ BlockNode(JSGlobalData*, SourceElements* = 0);
+
+ StatementNode* singleStatement() const;
+ StatementNode* lastStatement() const;
+
+ private:
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+
+ virtual bool isBlock() const { return true; }
+
+ SourceElements* m_statements;
+ };
+
+ class EmptyStatementNode : public StatementNode {
+ public:
+ EmptyStatementNode(JSGlobalData*);
+
+ private:
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+
+ virtual bool isEmptyStatement() const { return true; }
+ };
+
+ class DebuggerStatementNode : public StatementNode {
+ public:
+ DebuggerStatementNode(JSGlobalData*);
+
+ private:
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+ };
+
+ class ExprStatementNode : public StatementNode {
+ public:
+ ExprStatementNode(JSGlobalData*, ExpressionNode*);
+
+ ExpressionNode* expr() const { return m_expr; }
+
+ private:
+ virtual bool isExprStatement() const { return true; }
+
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+
+ ExpressionNode* m_expr;
+ };
+
+ class VarStatementNode : public StatementNode {
+ public:
+ VarStatementNode(JSGlobalData*, ExpressionNode*);
+
+ private:
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+
+ ExpressionNode* m_expr;
+ };
+
+ class IfNode : public StatementNode {
+ public:
+ IfNode(JSGlobalData*, ExpressionNode* condition, StatementNode* ifBlock);
+
+ protected:
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+
+ ExpressionNode* m_condition;
+ StatementNode* m_ifBlock;
+ };
+
+ class IfElseNode : public IfNode {
+ public:
+ IfElseNode(JSGlobalData*, ExpressionNode* condition, StatementNode* ifBlock, StatementNode* elseBlock);
+
+ private:
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+
+ StatementNode* m_elseBlock;
+ };
+
+ class DoWhileNode : public StatementNode {
+ public:
+ DoWhileNode(JSGlobalData*, StatementNode* statement, ExpressionNode*);
+
+ private:
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+
+ StatementNode* m_statement;
+ ExpressionNode* m_expr;
+ };
+
+ class WhileNode : public StatementNode {
+ public:
+ WhileNode(JSGlobalData*, ExpressionNode*, StatementNode* statement);
+
+ private:
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+
+ ExpressionNode* m_expr;
+ StatementNode* m_statement;
+ };
+
+ class ForNode : public StatementNode {
+ public:
+ ForNode(JSGlobalData*, ExpressionNode* expr1, ExpressionNode* expr2, ExpressionNode* expr3, StatementNode* statement, bool expr1WasVarDecl);
+
+ private:
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+
+ ExpressionNode* m_expr1;
+ ExpressionNode* m_expr2;
+ ExpressionNode* m_expr3;
+ StatementNode* m_statement;
+ bool m_expr1WasVarDecl;
+ };
+
+ class ForInNode : public StatementNode, public ThrowableExpressionData {
+ public:
+ ForInNode(JSGlobalData*, ExpressionNode*, ExpressionNode*, StatementNode*);
+ ForInNode(JSGlobalData*, const Identifier&, ExpressionNode*, ExpressionNode*, StatementNode*, int divot, int startOffset, int endOffset);
+
+ private:
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+
+ const Identifier& m_ident;
+ ExpressionNode* m_init;
+ ExpressionNode* m_lexpr;
+ ExpressionNode* m_expr;
+ StatementNode* m_statement;
+ bool m_identIsVarDecl;
+ };
+
+ class ContinueNode : public StatementNode, public ThrowableExpressionData {
+ public:
+ ContinueNode(JSGlobalData*);
+ ContinueNode(JSGlobalData*, const Identifier&);
+
+ private:
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+
+ const Identifier& m_ident;
+ };
+
+ class BreakNode : public StatementNode, public ThrowableExpressionData {
+ public:
+ BreakNode(JSGlobalData*);
+ BreakNode(JSGlobalData*, const Identifier&);
+
+ private:
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+
+ const Identifier& m_ident;
+ };
+
+ class ReturnNode : public StatementNode, public ThrowableExpressionData {
+ public:
+ ReturnNode(JSGlobalData*, ExpressionNode* value);
+
+ ExpressionNode* value() { return m_value; }
+
+ private:
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+
+ virtual bool isReturnNode() const { return true; }
+
+ ExpressionNode* m_value;
+ };
+
+ class WithNode : public StatementNode {
+ public:
+ WithNode(JSGlobalData*, ExpressionNode*, StatementNode*, uint32_t divot, uint32_t expressionLength);
+
+ private:
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+
+ ExpressionNode* m_expr;
+ StatementNode* m_statement;
+ uint32_t m_divot;
+ uint32_t m_expressionLength;
+ };
+
+ class LabelNode : public StatementNode, public ThrowableExpressionData {
+ public:
+ LabelNode(JSGlobalData*, const Identifier& name, StatementNode*);
+
+ private:
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+
+ const Identifier& m_name;
+ StatementNode* m_statement;
+ };
+
+ class ThrowNode : public StatementNode, public ThrowableExpressionData {
+ public:
+ ThrowNode(JSGlobalData*, ExpressionNode*);
+
+ private:
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+
+ ExpressionNode* m_expr;
+ };
+
+ class TryNode : public StatementNode {
+ public:
+ TryNode(JSGlobalData*, StatementNode* tryBlock, const Identifier& exceptionIdent, bool catchHasEval, StatementNode* catchBlock, StatementNode* finallyBlock);
+
+ private:
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+
+ StatementNode* m_tryBlock;
+ const Identifier& m_exceptionIdent;
+ StatementNode* m_catchBlock;
+ StatementNode* m_finallyBlock;
+ bool m_catchHasEval;
+ };
+
+ class ParameterNode : public ParserArenaFreeable {
+ public:
+ ParameterNode(JSGlobalData*, const Identifier&);
+ ParameterNode(JSGlobalData*, ParameterNode*, const Identifier&);
+
+ const Identifier& ident() const { return m_ident; }
+ ParameterNode* nextParam() const { return m_next; }
+
+ private:
+ const Identifier& m_ident;
+ ParameterNode* m_next;
+ };
+
+ struct ScopeNodeData : FastAllocBase {
+ typedef DeclarationStacks::VarStack VarStack;
+ typedef DeclarationStacks::FunctionStack FunctionStack;
+
+ ScopeNodeData(ParserArena&, SourceElements*, VarStack*, FunctionStack*, IdentifierSet&, int numConstants);
+
+ ParserArena m_arena;
+ VarStack m_varStack;
+ FunctionStack m_functionStack;
+ int m_numConstants;
+ SourceElements* m_statements;
+ IdentifierSet m_capturedVariables;
+ };
+
+ class ScopeNode : public StatementNode, public ParserArenaRefCounted {
+ public:
+ typedef DeclarationStacks::VarStack VarStack;
+ typedef DeclarationStacks::FunctionStack FunctionStack;
+
+ ScopeNode(JSGlobalData*, bool inStrictContext);
+ ScopeNode(JSGlobalData*, const SourceCode&, SourceElements*, VarStack*, FunctionStack*, IdentifierSet&, CodeFeatures, int numConstants);
+
+ using ParserArenaRefCounted::operator new;
+
+ ScopeNodeData* data() const { return m_data.get(); }
+ void destroyData() { m_data.clear(); }
+
+ const SourceCode& source() const { return m_source; }
+ const UString& sourceURL() const { return m_source.provider()->url(); }
+ intptr_t sourceID() const { return m_source.provider()->asID(); }
+
+ void setFeatures(CodeFeatures features) { m_features = features; }
+ CodeFeatures features() { return m_features; }
+
+ bool usesEval() const { return m_features & EvalFeature; }
+ bool usesArguments() const { return (m_features & ArgumentsFeature) && !(m_features & ShadowsArgumentsFeature); }
+ bool isStrictMode() const { return m_features & StrictModeFeature; }
+ void setUsesArguments() { m_features |= ArgumentsFeature; }
+ bool usesThis() const { return m_features & ThisFeature; }
+ bool needsActivationForMoreThanVariables() const { ASSERT(m_data); return m_features & (EvalFeature | WithFeature | CatchFeature); }
+ bool needsActivation() const { ASSERT(m_data); return (hasCapturedVariables()) || (m_features & (EvalFeature | WithFeature | CatchFeature)); }
+ bool hasCapturedVariables() const { return !!m_data->m_capturedVariables.size(); }
+ size_t capturedVariableCount() const { return m_data->m_capturedVariables.size(); }
+ bool captures(const Identifier& ident) { return m_data->m_capturedVariables.contains(ident.impl()); }
+
+ VarStack& varStack() { ASSERT(m_data); return m_data->m_varStack; }
+ FunctionStack& functionStack() { ASSERT(m_data); return m_data->m_functionStack; }
+
+ int neededConstants()
+ {
+ ASSERT(m_data);
+ // We may need 2 more constants than the count given by the parser,
+ // because of the various uses of jsUndefined() and jsNull().
+ return m_data->m_numConstants + 2;
+ }
+
+ StatementNode* singleStatement() const;
+
+ void emitStatementsBytecode(BytecodeGenerator&, RegisterID* destination);
+
+ protected:
+ void setSource(const SourceCode& source) { m_source = source; }
+
+ private:
+ OwnPtr<ScopeNodeData> m_data;
+ CodeFeatures m_features;
+ SourceCode m_source;
+ };
+
+ class ProgramNode : public ScopeNode {
+ public:
+ static const bool isFunctionNode = false;
+ static PassRefPtr<ProgramNode> create(JSGlobalData*, SourceElements*, VarStack*, FunctionStack*, IdentifierSet&, const SourceCode&, CodeFeatures, int numConstants);
+
+ static const bool scopeIsFunction = false;
+
+ private:
+ ProgramNode(JSGlobalData*, SourceElements*, VarStack*, FunctionStack*, IdentifierSet&, const SourceCode&, CodeFeatures, int numConstants);
+
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+ };
+
+ class EvalNode : public ScopeNode {
+ public:
+ static const bool isFunctionNode = false;
+ static PassRefPtr<EvalNode> create(JSGlobalData*, SourceElements*, VarStack*, FunctionStack*, IdentifierSet&, const SourceCode&, CodeFeatures, int numConstants);
+
+ static const bool scopeIsFunction = false;
+
+ private:
+ EvalNode(JSGlobalData*, SourceElements*, VarStack*, FunctionStack*, IdentifierSet&, const SourceCode&, CodeFeatures, int numConstants);
+
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+ };
+
+ class FunctionParameters : public Vector<Identifier>, public RefCounted<FunctionParameters> {
+ public:
+ static PassRefPtr<FunctionParameters> create(ParameterNode* firstParameter) { return adoptRef(new FunctionParameters(firstParameter)); }
+
+ private:
+ FunctionParameters(ParameterNode*);
+ };
+
+ class FunctionBodyNode : public ScopeNode {
+ public:
+ static const bool isFunctionNode = true;
+ static FunctionBodyNode* create(JSGlobalData*, bool isStrictMode);
+ static PassRefPtr<FunctionBodyNode> create(JSGlobalData*, SourceElements*, VarStack*, FunctionStack*, IdentifierSet&, const SourceCode&, CodeFeatures, int numConstants);
+
+ FunctionParameters* parameters() const { return m_parameters.get(); }
+ size_t parameterCount() const { return m_parameters->size(); }
+
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+
+ void finishParsing(const SourceCode&, ParameterNode*, const Identifier&);
+ void finishParsing(PassRefPtr<FunctionParameters>, const Identifier&);
+
+ const Identifier& ident() { return m_ident; }
+
+ static const bool scopeIsFunction = true;
+
+ private:
+ FunctionBodyNode(JSGlobalData*, bool inStrictContext);
+ FunctionBodyNode(JSGlobalData*, SourceElements*, VarStack*, FunctionStack*, IdentifierSet&, const SourceCode&, CodeFeatures, int numConstants);
+
+ Identifier m_ident;
+ RefPtr<FunctionParameters> m_parameters;
+ };
+
+ class FuncExprNode : public ExpressionNode {
+ public:
+ FuncExprNode(JSGlobalData*, const Identifier&, FunctionBodyNode* body, const SourceCode& source, ParameterNode* parameter = 0);
+
+ FunctionBodyNode* body() { return m_body; }
+
+ private:
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+
+ virtual bool isFuncExprNode() const { return true; }
+
+ FunctionBodyNode* m_body;
+ };
+
+ class FuncDeclNode : public StatementNode {
+ public:
+ FuncDeclNode(JSGlobalData*, const Identifier&, FunctionBodyNode*, const SourceCode&, ParameterNode* = 0);
+
+ FunctionBodyNode* body() { return m_body; }
+
+ private:
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+
+ FunctionBodyNode* m_body;
+ };
+
+ class CaseClauseNode : public ParserArenaFreeable {
+ public:
+ CaseClauseNode(JSGlobalData*, ExpressionNode*, SourceElements* = 0);
+
+ ExpressionNode* expr() const { return m_expr; }
+
+ void emitBytecode(BytecodeGenerator&, RegisterID* destination);
+
+ private:
+ ExpressionNode* m_expr;
+ SourceElements* m_statements;
+ };
+
+ class ClauseListNode : public ParserArenaFreeable {
+ public:
+ ClauseListNode(JSGlobalData*, CaseClauseNode*);
+ ClauseListNode(JSGlobalData*, ClauseListNode*, CaseClauseNode*);
+
+ CaseClauseNode* getClause() const { return m_clause; }
+ ClauseListNode* getNext() const { return m_next; }
+
+ private:
+ CaseClauseNode* m_clause;
+ ClauseListNode* m_next;
+ };
+
+ class CaseBlockNode : public ParserArenaFreeable {
+ public:
+ CaseBlockNode(JSGlobalData*, ClauseListNode* list1, CaseClauseNode* defaultClause, ClauseListNode* list2);
+
+ RegisterID* emitBytecodeForBlock(BytecodeGenerator&, RegisterID* input, RegisterID* destination);
+
+ private:
+ SwitchInfo::SwitchType tryOptimizedSwitch(Vector<ExpressionNode*, 8>& literalVector, int32_t& min_num, int32_t& max_num);
+ ClauseListNode* m_list1;
+ CaseClauseNode* m_defaultClause;
+ ClauseListNode* m_list2;
+ };
+
+ class SwitchNode : public StatementNode {
+ public:
+ SwitchNode(JSGlobalData*, ExpressionNode*, CaseBlockNode*);
+
+ private:
+ virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0);
+
+ ExpressionNode* m_expr;
+ CaseBlockNode* m_block;
+ };
+
+ struct ElementList {
+ ElementNode* head;
+ ElementNode* tail;
+ };
+
+ struct PropertyList {
+ PropertyListNode* head;
+ PropertyListNode* tail;
+ };
+
+ struct ArgumentList {
+ ArgumentListNode* head;
+ ArgumentListNode* tail;
+ };
+
+ struct ConstDeclList {
+ ConstDeclNode* head;
+ ConstDeclNode* tail;
+ };
+
+ struct ParameterList {
+ ParameterNode* head;
+ ParameterNode* tail;
+ };
+
+ struct ClauseList {
+ ClauseListNode* head;
+ ClauseListNode* tail;
+ };
+
+} // namespace JSC
+
+#endif // Nodes_h
diff --git a/Source/JavaScriptCore/parser/Parser.cpp b/Source/JavaScriptCore/parser/Parser.cpp
new file mode 100644
index 0000000..b203b21
--- /dev/null
+++ b/Source/JavaScriptCore/parser/Parser.cpp
@@ -0,0 +1,85 @@
+/*
+ * Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
+ * Copyright (C) 2001 Peter Kelly (pmk@post.com)
+ * Copyright (C) 2003, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+#include "Parser.h"
+
+#include "Debugger.h"
+#include "JSParser.h"
+#include "Lexer.h"
+
+#ifdef ANDROID_INSTRUMENT
+#include "TimeCounter.h"
+#endif
+
+namespace JSC {
+
+void Parser::parse(JSGlobalData* globalData, FunctionParameters* parameters, JSParserStrictness strictness, JSParserMode mode, int* errLine, UString* errMsg)
+{
+#ifdef ANDROID_INSTRUMENT
+ android::TimeCounter::start(android::TimeCounter::JavaScriptParseTimeCounter);
+#endif
+ ASSERT(globalData);
+ m_sourceElements = 0;
+
+ int defaultErrLine;
+ UString defaultErrMsg;
+
+ if (!errLine)
+ errLine = &defaultErrLine;
+ if (!errMsg)
+ errMsg = &defaultErrMsg;
+
+ *errLine = -1;
+ *errMsg = UString();
+
+ Lexer& lexer = *globalData->lexer;
+ lexer.setCode(*m_source, m_arena);
+
+ int parseError = jsParse(globalData, parameters, strictness, mode, m_source);
+ int lineNumber = lexer.lineNumber();
+ bool lexError = lexer.sawError();
+ lexer.clear();
+
+ if (parseError || lexError) {
+ *errLine = lineNumber;
+ *errMsg = "Parse error";
+ m_sourceElements = 0;
+ }
+#ifdef ANDROID_INSTRUMENT
+ android::TimeCounter::record(android::TimeCounter::JavaScriptParseTimeCounter, __FUNCTION__);
+#endif
+}
+
+void Parser::didFinishParsing(SourceElements* sourceElements, ParserArenaData<DeclarationStacks::VarStack>* varStack,
+ ParserArenaData<DeclarationStacks::FunctionStack>* funcStack, CodeFeatures features, int lastLine, int numConstants, IdentifierSet& capturedVars)
+{
+ m_sourceElements = sourceElements;
+ m_varDeclarations = varStack;
+ m_funcDeclarations = funcStack;
+ m_capturedVariables.swap(capturedVars);
+ m_features = features;
+ m_lastLine = lastLine;
+ m_numConstants = numConstants;
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/parser/Parser.h b/Source/JavaScriptCore/parser/Parser.h
new file mode 100644
index 0000000..213827b
--- /dev/null
+++ b/Source/JavaScriptCore/parser/Parser.h
@@ -0,0 +1,128 @@
+/*
+ * Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
+ * Copyright (C) 2001 Peter Kelly (pmk@post.com)
+ * Copyright (C) 2003, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef Parser_h
+#define Parser_h
+
+#include "Debugger.h"
+#include "ExceptionHelpers.h"
+#include "Executable.h"
+#include "JSGlobalObject.h"
+#include "Lexer.h"
+#include "Nodes.h"
+#include "ParserArena.h"
+#include "SourceProvider.h"
+#include <wtf/Forward.h>
+#include <wtf/Noncopyable.h>
+#include <wtf/OwnPtr.h>
+#include <wtf/RefPtr.h>
+
+namespace JSC {
+
+ class FunctionBodyNode;
+
+ class ProgramNode;
+ class UString;
+
+ template <typename T> struct ParserArenaData : ParserArenaDeletable { T data; };
+
+ class Parser : public Noncopyable {
+ public:
+ template <class ParsedNode>
+ PassRefPtr<ParsedNode> parse(JSGlobalObject* lexicalGlobalObject, Debugger*, ExecState*, const SourceCode& source, FunctionParameters*, JSParserStrictness strictness, JSObject** exception);
+
+ void didFinishParsing(SourceElements*, ParserArenaData<DeclarationStacks::VarStack>*,
+ ParserArenaData<DeclarationStacks::FunctionStack>*, CodeFeatures features,
+ int lastLine, int numConstants, IdentifierSet&);
+
+ ParserArena& arena() { return m_arena; }
+
+ private:
+ void parse(JSGlobalData*, FunctionParameters*, JSParserStrictness strictness, JSParserMode mode, int* errLine, UString* errMsg);
+
+ // Used to determine type of error to report.
+ bool isFunctionBodyNode(ScopeNode*) { return false; }
+ bool isFunctionBodyNode(FunctionBodyNode*) { return true; }
+
+ ParserArena m_arena;
+ const SourceCode* m_source;
+ SourceElements* m_sourceElements;
+ ParserArenaData<DeclarationStacks::VarStack>* m_varDeclarations;
+ ParserArenaData<DeclarationStacks::FunctionStack>* m_funcDeclarations;
+ IdentifierSet m_capturedVariables;
+ CodeFeatures m_features;
+ int m_lastLine;
+ int m_numConstants;
+ };
+
+ template <class ParsedNode>
+ PassRefPtr<ParsedNode> Parser::parse(JSGlobalObject* lexicalGlobalObject, Debugger* debugger, ExecState* debuggerExecState, const SourceCode& source, FunctionParameters* parameters, JSParserStrictness strictness, JSObject** exception)
+ {
+ ASSERT(lexicalGlobalObject);
+ ASSERT(exception && !*exception);
+ int errLine;
+ UString errMsg;
+
+ m_source = &source;
+ if (ParsedNode::scopeIsFunction)
+ lexicalGlobalObject->globalData().lexer->setIsReparsing();
+ parse(&lexicalGlobalObject->globalData(), parameters, strictness, ParsedNode::isFunctionNode ? JSParseFunctionCode : JSParseProgramCode, &errLine, &errMsg);
+
+ RefPtr<ParsedNode> result;
+ if (m_sourceElements) {
+ result = ParsedNode::create(&lexicalGlobalObject->globalData(),
+ m_sourceElements,
+ m_varDeclarations ? &m_varDeclarations->data : 0,
+ m_funcDeclarations ? &m_funcDeclarations->data : 0,
+ m_capturedVariables,
+ source,
+ m_features,
+ m_numConstants);
+ result->setLoc(m_source->firstLine(), m_lastLine);
+ } else if (lexicalGlobalObject) {
+ // We can never see a syntax error when reparsing a function, since we should have
+ // reported the error when parsing the containing program or eval code. So if we're
+ // parsing a function body node, we assume that what actually happened here is that
+ // we ran out of stack while parsing. If we see an error while parsing eval or program
+ // code we assume that it was a syntax error since running out of stack is much less
+ // likely, and we are currently unable to distinguish between the two cases.
+ if (isFunctionBodyNode(static_cast<ParsedNode*>(0)))
+ *exception = createStackOverflowError(lexicalGlobalObject);
+ else
+ *exception = addErrorInfo(&lexicalGlobalObject->globalData(), createSyntaxError(lexicalGlobalObject, errMsg), errLine, source);
+ }
+
+ m_arena.reset();
+
+ m_source = 0;
+ m_sourceElements = 0;
+ m_varDeclarations = 0;
+ m_funcDeclarations = 0;
+
+ if (debugger && !ParsedNode::scopeIsFunction)
+ debugger->sourceParsed(debuggerExecState, source, errLine, errMsg);
+ return result.release();
+ }
+
+} // namespace JSC
+
+#endif // Parser_h
diff --git a/Source/JavaScriptCore/parser/ParserArena.cpp b/Source/JavaScriptCore/parser/ParserArena.cpp
new file mode 100644
index 0000000..9c96de7
--- /dev/null
+++ b/Source/JavaScriptCore/parser/ParserArena.cpp
@@ -0,0 +1,125 @@
+/*
+ * Copyright (C) 2009, 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "ParserArena.h"
+
+#include "Nodes.h"
+#include <wtf/PassOwnPtr.h>
+
+namespace JSC {
+
+ParserArena::ParserArena()
+ : m_freeableMemory(0)
+ , m_freeablePoolEnd(0)
+ , m_identifierArena(adoptPtr(new IdentifierArena))
+{
+}
+
+inline void* ParserArena::freeablePool()
+{
+ ASSERT(m_freeablePoolEnd);
+ return m_freeablePoolEnd - freeablePoolSize;
+}
+
+inline void ParserArena::deallocateObjects()
+{
+ if (m_freeablePoolEnd)
+ fastFree(freeablePool());
+
+ size_t size = m_freeablePools.size();
+ for (size_t i = 0; i < size; ++i)
+ fastFree(m_freeablePools[i]);
+
+ size = m_deletableObjects.size();
+ for (size_t i = 0; i < size; ++i) {
+ ParserArenaDeletable* object = m_deletableObjects[i];
+ object->~ParserArenaDeletable();
+ fastFree(object);
+ }
+}
+
+ParserArena::~ParserArena()
+{
+ deallocateObjects();
+}
+
+bool ParserArena::contains(ParserArenaRefCounted* object) const
+{
+ return m_refCountedObjects.find(object) != notFound;
+}
+
+ParserArenaRefCounted* ParserArena::last() const
+{
+ return m_refCountedObjects.last().get();
+}
+
+void ParserArena::removeLast()
+{
+ m_refCountedObjects.removeLast();
+}
+
+void ParserArena::reset()
+{
+ // Since this code path is used only when parsing fails, it's not bothering to reuse
+ // any of the memory the arena allocated. We could improve that later if we want to
+ // efficiently reuse the same arena.
+
+ deallocateObjects();
+
+ m_freeableMemory = 0;
+ m_freeablePoolEnd = 0;
+ m_identifierArena->clear();
+ m_freeablePools.clear();
+ m_deletableObjects.clear();
+ m_refCountedObjects.clear();
+}
+
+void ParserArena::allocateFreeablePool()
+{
+ if (m_freeablePoolEnd)
+ m_freeablePools.append(freeablePool());
+
+ char* pool = static_cast<char*>(fastMalloc(freeablePoolSize));
+ m_freeableMemory = pool;
+ m_freeablePoolEnd = pool + freeablePoolSize;
+ ASSERT(freeablePool() == pool);
+}
+
+bool ParserArena::isEmpty() const
+{
+ return !m_freeablePoolEnd
+ && m_identifierArena->isEmpty()
+ && m_freeablePools.isEmpty()
+ && m_deletableObjects.isEmpty()
+ && m_refCountedObjects.isEmpty();
+}
+
+void ParserArena::derefWithArena(PassRefPtr<ParserArenaRefCounted> object)
+{
+ m_refCountedObjects.append(object);
+}
+
+}
diff --git a/Source/JavaScriptCore/parser/ParserArena.h b/Source/JavaScriptCore/parser/ParserArena.h
new file mode 100644
index 0000000..7c1809e
--- /dev/null
+++ b/Source/JavaScriptCore/parser/ParserArena.h
@@ -0,0 +1,130 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ParserArena_h
+#define ParserArena_h
+
+#include "Identifier.h"
+#include <wtf/SegmentedVector.h>
+
+namespace JSC {
+
+ class ParserArenaDeletable;
+ class ParserArenaRefCounted;
+
+ class IdentifierArena : public FastAllocBase {
+ public:
+ ALWAYS_INLINE const Identifier& makeIdentifier(JSGlobalData*, const UChar* characters, size_t length);
+ const Identifier& makeNumericIdentifier(JSGlobalData*, double number);
+
+ void clear() { m_identifiers.clear(); }
+ bool isEmpty() const { return m_identifiers.isEmpty(); }
+
+ private:
+ typedef SegmentedVector<Identifier, 64> IdentifierVector;
+ IdentifierVector m_identifiers;
+ };
+
+ ALWAYS_INLINE const Identifier& IdentifierArena::makeIdentifier(JSGlobalData* globalData, const UChar* characters, size_t length)
+ {
+ m_identifiers.append(Identifier(globalData, characters, length));
+ return m_identifiers.last();
+ }
+
+ inline const Identifier& IdentifierArena::makeNumericIdentifier(JSGlobalData* globalData, double number)
+ {
+ m_identifiers.append(Identifier(globalData, UString::number(number)));
+ return m_identifiers.last();
+ }
+
+ class ParserArena : Noncopyable {
+ public:
+ ParserArena();
+ ~ParserArena();
+
+ void swap(ParserArena& otherArena)
+ {
+ std::swap(m_freeableMemory, otherArena.m_freeableMemory);
+ std::swap(m_freeablePoolEnd, otherArena.m_freeablePoolEnd);
+ m_identifierArena.swap(otherArena.m_identifierArena);
+ m_freeablePools.swap(otherArena.m_freeablePools);
+ m_deletableObjects.swap(otherArena.m_deletableObjects);
+ m_refCountedObjects.swap(otherArena.m_refCountedObjects);
+ }
+
+ void* allocateFreeable(size_t size)
+ {
+ ASSERT(size);
+ ASSERT(size <= freeablePoolSize);
+ size_t alignedSize = alignSize(size);
+ ASSERT(alignedSize <= freeablePoolSize);
+ if (UNLIKELY(static_cast<size_t>(m_freeablePoolEnd - m_freeableMemory) < alignedSize))
+ allocateFreeablePool();
+ void* block = m_freeableMemory;
+ m_freeableMemory += alignedSize;
+ return block;
+ }
+
+ void* allocateDeletable(size_t size)
+ {
+ ParserArenaDeletable* deletable = static_cast<ParserArenaDeletable*>(fastMalloc(size));
+ m_deletableObjects.append(deletable);
+ return deletable;
+ }
+
+ void derefWithArena(PassRefPtr<ParserArenaRefCounted>);
+ bool contains(ParserArenaRefCounted*) const;
+ ParserArenaRefCounted* last() const;
+ void removeLast();
+
+ bool isEmpty() const;
+ void reset();
+
+ IdentifierArena& identifierArena() { return *m_identifierArena; }
+
+ private:
+ static const size_t freeablePoolSize = 8000;
+
+ static size_t alignSize(size_t size)
+ {
+ return (size + sizeof(WTF::AllocAlignmentInteger) - 1) & ~(sizeof(WTF::AllocAlignmentInteger) - 1);
+ }
+
+ void* freeablePool();
+ void allocateFreeablePool();
+ void deallocateObjects();
+
+ char* m_freeableMemory;
+ char* m_freeablePoolEnd;
+
+ OwnPtr<IdentifierArena> m_identifierArena;
+ Vector<void*> m_freeablePools;
+ Vector<ParserArenaDeletable*> m_deletableObjects;
+ Vector<RefPtr<ParserArenaRefCounted> > m_refCountedObjects;
+ };
+
+}
+
+#endif
diff --git a/Source/JavaScriptCore/parser/ResultType.h b/Source/JavaScriptCore/parser/ResultType.h
new file mode 100644
index 0000000..27b8112
--- /dev/null
+++ b/Source/JavaScriptCore/parser/ResultType.h
@@ -0,0 +1,182 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ResultType_h
+#define ResultType_h
+
+namespace JSC {
+
+ struct ResultType {
+ friend struct OperandTypes;
+
+ typedef char Type;
+ static const Type TypeReusable = 1;
+ static const Type TypeInt32 = 2;
+
+ static const Type TypeMaybeNumber = 0x04;
+ static const Type TypeMaybeString = 0x08;
+ static const Type TypeMaybeNull = 0x10;
+ static const Type TypeMaybeBool = 0x20;
+ static const Type TypeMaybeOther = 0x40;
+
+ static const Type TypeBits = TypeMaybeNumber | TypeMaybeString | TypeMaybeNull | TypeMaybeBool | TypeMaybeOther;
+
+ explicit ResultType(Type type)
+ : m_type(type)
+ {
+ }
+
+ bool isReusable()
+ {
+ return m_type & TypeReusable;
+ }
+
+ bool isInt32()
+ {
+ return m_type & TypeInt32;
+ }
+
+ bool definitelyIsNumber()
+ {
+ return (m_type & TypeBits) == TypeMaybeNumber;
+ }
+
+ bool definitelyIsString()
+ {
+ return (m_type & TypeBits) == TypeMaybeString;
+ }
+
+ bool mightBeNumber()
+ {
+ return m_type & TypeMaybeNumber;
+ }
+
+ bool isNotNumber()
+ {
+ return !mightBeNumber();
+ }
+
+ static ResultType nullType()
+ {
+ return ResultType(TypeMaybeNull);
+ }
+
+ static ResultType booleanType()
+ {
+ return ResultType(TypeMaybeBool);
+ }
+
+ static ResultType numberType()
+ {
+ return ResultType(TypeMaybeNumber);
+ }
+
+ static ResultType numberTypeCanReuse()
+ {
+ return ResultType(TypeReusable | TypeMaybeNumber);
+ }
+
+ static ResultType numberTypeCanReuseIsInt32()
+ {
+ return ResultType(TypeReusable | TypeInt32 | TypeMaybeNumber);
+ }
+
+ static ResultType stringOrNumberTypeCanReuse()
+ {
+ return ResultType(TypeReusable | TypeMaybeNumber | TypeMaybeString);
+ }
+
+ static ResultType stringType()
+ {
+ return ResultType(TypeMaybeString);
+ }
+
+ static ResultType unknownType()
+ {
+ return ResultType(TypeBits);
+ }
+
+ static ResultType forAdd(ResultType op1, ResultType op2)
+ {
+ if (op1.definitelyIsNumber() && op2.definitelyIsNumber())
+ return numberTypeCanReuse();
+ if (op1.definitelyIsString() || op2.definitelyIsString())
+ return stringType();
+ return stringOrNumberTypeCanReuse();
+ }
+
+ static ResultType forBitOp()
+ {
+ return numberTypeCanReuseIsInt32();
+ }
+
+ private:
+ Type m_type;
+ };
+
+ struct OperandTypes
+ {
+ OperandTypes(ResultType first = ResultType::unknownType(), ResultType second = ResultType::unknownType())
+ {
+ // We have to initialize one of the int to ensure that
+ // the entire struct is initialized.
+ m_u.i = 0;
+ m_u.rds.first = first.m_type;
+ m_u.rds.second = second.m_type;
+ }
+
+ union {
+ struct {
+ ResultType::Type first;
+ ResultType::Type second;
+ } rds;
+ int i;
+ } m_u;
+
+ ResultType first()
+ {
+ return ResultType(m_u.rds.first);
+ }
+
+ ResultType second()
+ {
+ return ResultType(m_u.rds.second);
+ }
+
+ int toInt()
+ {
+ return m_u.i;
+ }
+ static OperandTypes fromInt(int value)
+ {
+ OperandTypes types;
+ types.m_u.i = value;
+ return types;
+ }
+ };
+
+} // namespace JSC
+
+#endif // ResultType_h
diff --git a/Source/JavaScriptCore/parser/SourceCode.h b/Source/JavaScriptCore/parser/SourceCode.h
new file mode 100644
index 0000000..9ba4da3
--- /dev/null
+++ b/Source/JavaScriptCore/parser/SourceCode.h
@@ -0,0 +1,92 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SourceCode_h
+#define SourceCode_h
+
+#include "SourceProvider.h"
+#include <wtf/RefPtr.h>
+
+namespace JSC {
+
+ class SourceCode {
+ public:
+ SourceCode()
+ : m_provider(0)
+ , m_startChar(0)
+ , m_endChar(0)
+ , m_firstLine(0)
+ {
+ }
+
+ SourceCode(PassRefPtr<SourceProvider> provider, int firstLine = 1)
+ : m_provider(provider)
+ , m_startChar(0)
+ , m_endChar(m_provider->length())
+ , m_firstLine(std::max(firstLine, 1))
+ {
+ }
+
+ SourceCode(PassRefPtr<SourceProvider> provider, int start, int end, int firstLine)
+ : m_provider(provider)
+ , m_startChar(start)
+ , m_endChar(end)
+ , m_firstLine(std::max(firstLine, 1))
+ {
+ }
+
+ UString toString() const
+ {
+ if (!m_provider)
+ return UString();
+ return m_provider->getRange(m_startChar, m_endChar);
+ }
+
+ bool isNull() const { return !m_provider; }
+ SourceProvider* provider() const { return m_provider.get(); }
+ int firstLine() const { return m_firstLine; }
+ int startOffset() const { return m_startChar; }
+ int endOffset() const { return m_endChar; }
+ const UChar* data() const { return m_provider->data() + m_startChar; }
+ int length() const { return m_endChar - m_startChar; }
+
+ private:
+ RefPtr<SourceProvider> m_provider;
+ int m_startChar;
+ int m_endChar;
+ int m_firstLine;
+ };
+
+ inline SourceCode makeSource(const UString& source, const UString& url = UString(), int firstLine = 1)
+ {
+ return SourceCode(UStringSourceProvider::create(source, url), firstLine);
+ }
+
+} // namespace JSC
+
+#endif // SourceCode_h
diff --git a/Source/JavaScriptCore/parser/SourceProvider.h b/Source/JavaScriptCore/parser/SourceProvider.h
new file mode 100644
index 0000000..5ff1d14
--- /dev/null
+++ b/Source/JavaScriptCore/parser/SourceProvider.h
@@ -0,0 +1,87 @@
+/*
+ * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SourceProvider_h
+#define SourceProvider_h
+
+#include "UString.h"
+#include <wtf/RefCounted.h>
+
+namespace JSC {
+
+ class SourceProvider : public RefCounted<SourceProvider> {
+ public:
+ SourceProvider(const UString& url)
+ : m_url(url)
+ , m_validated(false)
+ {
+ }
+ virtual ~SourceProvider() { }
+
+ virtual UString getRange(int start, int end) const = 0;
+ virtual const UChar* data() const = 0;
+ virtual int length() const = 0;
+
+ const UString& url() { return m_url; }
+ intptr_t asID() { return reinterpret_cast<intptr_t>(this); }
+
+ bool isValid() const { return m_validated; }
+ void setValid() { m_validated = true; }
+
+ private:
+ UString m_url;
+ bool m_validated;
+ };
+
+ class UStringSourceProvider : public SourceProvider {
+ public:
+ static PassRefPtr<UStringSourceProvider> create(const UString& source, const UString& url)
+ {
+ return adoptRef(new UStringSourceProvider(source, url));
+ }
+
+ UString getRange(int start, int end) const
+ {
+ return m_source.substringSharingImpl(start, end - start);
+ }
+ const UChar* data() const { return m_source.characters(); }
+ int length() const { return m_source.length(); }
+
+ private:
+ UStringSourceProvider(const UString& source, const UString& url)
+ : SourceProvider(url)
+ , m_source(source)
+ {
+ }
+
+ UString m_source;
+ };
+
+} // namespace JSC
+
+#endif // SourceProvider_h
diff --git a/Source/JavaScriptCore/parser/SyntaxChecker.h b/Source/JavaScriptCore/parser/SyntaxChecker.h
new file mode 100644
index 0000000..b00e710
--- /dev/null
+++ b/Source/JavaScriptCore/parser/SyntaxChecker.h
@@ -0,0 +1,217 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SyntaxChecker_h
+#define SyntaxChecker_h
+
+namespace JSC {
+class SyntaxChecker {
+public:
+ SyntaxChecker(JSGlobalData* , Lexer*)
+ : m_topBinaryExpr(0)
+ {
+ }
+
+ typedef SyntaxChecker FunctionBodyBuilder;
+ enum { NoneExpr = 0,
+ ResolveEvalExpr, ResolveExpr, NumberExpr, StringExpr,
+ ThisExpr, NullExpr, BoolExpr, RegExpExpr, ObjectLiteralExpr,
+ FunctionExpr, BracketExpr, DotExpr, CallExpr,
+ NewExpr, PreExpr, PostExpr, UnaryExpr, BinaryExpr,
+ ConditionalExpr, AssignmentExpr, TypeofExpr,
+ DeleteExpr, ArrayLiteralExpr };
+ typedef int ExpressionType;
+
+ typedef ExpressionType Expression;
+ typedef int SourceElements;
+ typedef int Arguments;
+ typedef ExpressionType Comma;
+ struct Property {
+ ALWAYS_INLINE Property(void* = 0)
+ : type((PropertyNode::Type)0)
+ {
+ }
+ ALWAYS_INLINE Property(const Identifier* ident, PropertyNode::Type ty)
+ : name(ident)
+ , type(ty)
+ {
+ }
+ ALWAYS_INLINE Property(PropertyNode::Type ty)
+ : name(0)
+ , type(ty)
+ {
+ }
+ ALWAYS_INLINE bool operator!() { return !type; }
+ const Identifier* name;
+ PropertyNode::Type type;
+ };
+ typedef int PropertyList;
+ typedef int ElementList;
+ typedef int ArgumentsList;
+ typedef int FormalParameterList;
+ typedef int FunctionBody;
+ typedef int Statement;
+ typedef int ClauseList;
+ typedef int Clause;
+ typedef int ConstDeclList;
+ typedef int BinaryOperand;
+
+ static const bool CreatesAST = false;
+ static const bool NeedsFreeVariableInfo = false;
+
+ int createSourceElements() { return 1; }
+ ExpressionType makeFunctionCallNode(int, int, int, int, int) { return CallExpr; }
+ void appendToComma(ExpressionType& base, ExpressionType right) { base = right; }
+ ExpressionType createCommaExpr(ExpressionType, ExpressionType right) { return right; }
+ ExpressionType makeAssignNode(ExpressionType, Operator, ExpressionType, bool, bool, int, int, int) { return AssignmentExpr; }
+ ExpressionType makePrefixNode(ExpressionType, Operator, int, int, int) { return PreExpr; }
+ ExpressionType makePostfixNode(ExpressionType, Operator, int, int, int) { return PostExpr; }
+ ExpressionType makeTypeOfNode(ExpressionType) { return TypeofExpr; }
+ ExpressionType makeDeleteNode(ExpressionType, int, int, int) { return DeleteExpr; }
+ ExpressionType makeNegateNode(ExpressionType) { return UnaryExpr; }
+ ExpressionType makeBitwiseNotNode(ExpressionType) { return UnaryExpr; }
+ ExpressionType createLogicalNot(ExpressionType) { return UnaryExpr; }
+ ExpressionType createUnaryPlus(ExpressionType) { return UnaryExpr; }
+ ExpressionType createVoid(ExpressionType) { return UnaryExpr; }
+ ExpressionType thisExpr() { return ThisExpr; }
+ ExpressionType createResolve(const Identifier*, int) { return ResolveExpr; }
+ ExpressionType createObjectLiteral() { return ObjectLiteralExpr; }
+ ExpressionType createObjectLiteral(int) { return ObjectLiteralExpr; }
+ ExpressionType createArray(int) { return ArrayLiteralExpr; }
+ ExpressionType createArray(int, int) { return ArrayLiteralExpr; }
+ ExpressionType createNumberExpr(double) { return NumberExpr; }
+ ExpressionType createString(const Identifier*) { return StringExpr; }
+ ExpressionType createBoolean(bool) { return BoolExpr; }
+ ExpressionType createNull() { return NullExpr; }
+ ExpressionType createBracketAccess(ExpressionType, ExpressionType, bool, int, int, int) { return BracketExpr; }
+ ExpressionType createDotAccess(ExpressionType, const Identifier&, int, int, int) { return DotExpr; }
+ ExpressionType createRegex(const Identifier&, const Identifier&, int) { return RegExpExpr; }
+ ExpressionType createNewExpr(ExpressionType, int, int, int, int) { return NewExpr; }
+ ExpressionType createNewExpr(ExpressionType, int, int) { return NewExpr; }
+ ExpressionType createConditionalExpr(ExpressionType, ExpressionType, ExpressionType) { return ConditionalExpr; }
+ ExpressionType createAssignResolve(const Identifier&, ExpressionType, bool, int, int, int) { return AssignmentExpr; }
+ ExpressionType createFunctionExpr(const Identifier*, int, int, int, int, int, int) { return FunctionExpr; }
+ int createFunctionBody(bool) { return 1; }
+ int createArguments() { return 1; }
+ int createArguments(int) { return 1; }
+ int createArgumentsList(int) { return 1; }
+ int createArgumentsList(int, int) { return 1; }
+ template <bool complete> Property createProperty(const Identifier* name, int, PropertyNode::Type type)
+ {
+ ASSERT(name);
+ if (!complete)
+ return Property(type);
+ return Property(name, type);
+ }
+ template <bool complete> Property createProperty(JSGlobalData* globalData, double name, int, PropertyNode::Type type)
+ {
+ if (!complete)
+ return Property(type);
+ return Property(&globalData->parser->arena().identifierArena().makeNumericIdentifier(globalData, name), type);
+ }
+ int createPropertyList(Property) { return 1; }
+ int createPropertyList(Property, int) { return 1; }
+ int createElementList(int, int) { return 1; }
+ int createElementList(int, int, int) { return 1; }
+ int createFormalParameterList(const Identifier&) { return 1; }
+ int createFormalParameterList(int, const Identifier&) { return 1; }
+ int createClause(int, int) { return 1; }
+ int createClauseList(int) { return 1; }
+ int createClauseList(int, int) { return 1; }
+ void setUsesArguments(int) { }
+ int createFuncDeclStatement(const Identifier*, int, int, int, int, int, int) { return 1; }
+ int createBlockStatement(int, int, int) { return 1; }
+ int createExprStatement(int, int, int) { return 1; }
+ int createIfStatement(int, int, int, int) { return 1; }
+ int createIfStatement(int, int, int, int, int) { return 1; }
+ int createForLoop(int, int, int, int, bool, int, int) { return 1; }
+ int createForInLoop(const Identifier*, int, int, int, int, int, int, int, int, int, int) { return 1; }
+ int createForInLoop(int, int, int, int, int, int, int, int) { return 1; }
+ int createEmptyStatement() { return 1; }
+ int createVarStatement(int, int, int) { return 1; }
+ int createReturnStatement(int, int, int, int, int) { return 1; }
+ int createBreakStatement(int, int, int, int) { return 1; }
+ int createBreakStatement(const Identifier*, int, int, int, int) { return 1; }
+ int createContinueStatement(int, int, int, int) { return 1; }
+ int createContinueStatement(const Identifier*, int, int, int, int) { return 1; }
+ int createTryStatement(int, const Identifier*, bool, int, int, int, int) { return 1; }
+ int createSwitchStatement(int, int, int, int, int, int) { return 1; }
+ int createWhileStatement(int, int, int, int) { return 1; }
+ int createWithStatement(int, int, int, int, int, int) { return 1; }
+ int createDoWhileStatement(int, int, int, int) { return 1; }
+ int createLabelStatement(const Identifier*, int, int, int) { return 1; }
+ int createThrowStatement(int, int, int, int, int) { return 1; }
+ int createDebugger(int, int) { return 1; }
+ int createConstStatement(int, int, int) { return 1; }
+ int appendConstDecl(int, const Identifier*, int) { return 1; }
+ template <bool strict> Property createGetterOrSetterProperty(PropertyNode::Type type, const Identifier* name, int, int, int, int, int, int)
+ {
+ ASSERT(name);
+ if (!strict)
+ return Property(type);
+ return Property(name, type);
+ }
+
+ void appendStatement(int, int) { }
+ void addVar(const Identifier*, bool) { }
+ int combineCommaNodes(int, int) { return 1; }
+ int evalCount() const { return 0; }
+ void appendBinaryExpressionInfo(int& operandStackDepth, int expr, int, int, int, bool)
+ {
+ if (!m_topBinaryExpr)
+ m_topBinaryExpr = expr;
+ else
+ m_topBinaryExpr = BinaryExpr;
+ operandStackDepth++;
+ }
+
+ // Logic to handle datastructures used during parsing of binary expressions
+ void operatorStackPop(int& operatorStackDepth) { operatorStackDepth--; }
+ bool operatorStackHasHigherPrecedence(int&, int) { return true; }
+ BinaryOperand getFromOperandStack(int) { return m_topBinaryExpr; }
+ void shrinkOperandStackBy(int& operandStackDepth, int amount) { operandStackDepth -= amount; }
+ void appendBinaryOperation(int& operandStackDepth, int&, BinaryOperand, BinaryOperand) { operandStackDepth++; }
+ void operatorStackAppend(int& operatorStackDepth, int, int) { operatorStackDepth++; }
+ int popOperandStack(int&) { int res = m_topBinaryExpr; m_topBinaryExpr = 0; return res; }
+
+ void appendUnaryToken(int& stackDepth, int tok, int) { stackDepth = 1; m_topUnaryToken = tok; }
+ int unaryTokenStackLastType(int&) { return m_topUnaryToken; }
+ int unaryTokenStackLastStart(int&) { return 0; }
+ void unaryTokenStackRemoveLast(int& stackDepth) { stackDepth = 0; }
+
+ void assignmentStackAppend(int, int, int, int, int, Operator) { }
+ int createAssignment(int, int, int, int, int) { ASSERT_NOT_REACHED(); return 1; }
+ const Identifier& getName(const Property& property) const { ASSERT(property.name); return *property.name; }
+ PropertyNode::Type getType(const Property& property) const { return property.type; }
+ bool isResolve(ExpressionType expr) const { return expr == ResolveExpr || expr == ResolveEvalExpr; }
+
+private:
+ int m_topBinaryExpr;
+ int m_topUnaryToken;
+};
+
+}
+
+#endif
diff --git a/Source/JavaScriptCore/pcre/AUTHORS b/Source/JavaScriptCore/pcre/AUTHORS
new file mode 100644
index 0000000..dbac2a5
--- /dev/null
+++ b/Source/JavaScriptCore/pcre/AUTHORS
@@ -0,0 +1,12 @@
+Originally written by: Philip Hazel
+Email local part: ph10
+Email domain: cam.ac.uk
+
+University of Cambridge Computing Service,
+Cambridge, England. Phone: +44 1223 334714.
+
+Copyright (c) 1997-2005 University of Cambridge. All rights reserved.
+
+Adapted for JavaScriptCore and WebKit by Apple Inc.
+
+Copyright (c) 2005, 2006, 2007 Apple Inc. All rights reserved.
diff --git a/Source/JavaScriptCore/pcre/COPYING b/Source/JavaScriptCore/pcre/COPYING
new file mode 100644
index 0000000..6ffdc24
--- /dev/null
+++ b/Source/JavaScriptCore/pcre/COPYING
@@ -0,0 +1,35 @@
+PCRE is a library of functions to support regular expressions whose syntax
+and semantics are as close as possible to those of the Perl 5 language.
+
+This is JavaScriptCore's variant of the PCRE library. While this library
+started out as a copy of PCRE, many of the features of PCRE have been
+removed.
+
+Copyright (c) 1997-2005 University of Cambridge. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the name of the University of Cambridge nor the name of Apple
+ Inc. nor the names of their contributors may be used to endorse or
+ promote products derived from this software without specific prior
+ written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
diff --git a/Source/JavaScriptCore/pcre/dftables b/Source/JavaScriptCore/pcre/dftables
new file mode 100755
index 0000000..669b948
--- /dev/null
+++ b/Source/JavaScriptCore/pcre/dftables
@@ -0,0 +1,273 @@
+#!/usr/bin/perl -w
+#
+# This is JavaScriptCore's variant of the PCRE library. While this library
+# started out as a copy of PCRE, many of the features of PCRE have been
+# removed. This library now supports only the regular expression features
+# required by the JavaScript language specification, and has only the functions
+# needed by JavaScriptCore and the rest of WebKit.
+#
+# Originally written by Philip Hazel
+# Copyright (c) 1997-2006 University of Cambridge
+# Copyright (C) 2002, 2004, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+#
+# -----------------------------------------------------------------------------
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# * Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# * Neither the name of the University of Cambridge nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# -----------------------------------------------------------------------------
+
+# This is a freestanding support program to generate a file containing
+# character tables. The tables are built according to the default C
+# locale.
+
+use strict;
+
+use File::Basename;
+use File::Spec;
+use File::Temp qw(tempfile);
+use Getopt::Long;
+
+sub readHeaderValues();
+
+my %pcre_internal;
+
+if (scalar(@ARGV) < 1) {
+ print STDERR "Usage: ", basename($0), " [--preprocessor=program] output-file\n";
+ exit 1;
+}
+
+my $outputFile;
+my $preprocessor;
+GetOptions('preprocessor=s' => \$preprocessor);
+if (not $preprocessor) {
+ $preprocessor = "cpp";
+}
+
+$outputFile = $ARGV[0];
+die('Must specify output file.') unless defined($outputFile);
+
+readHeaderValues();
+
+open(OUT, ">", $outputFile) or die "$!";
+binmode(OUT);
+
+printf(OUT
+ "/*************************************************\n" .
+ "* Perl-Compatible Regular Expressions *\n" .
+ "*************************************************/\n\n" .
+ "/* This file is automatically written by the dftables auxiliary \n" .
+ "program. If you edit it by hand, you might like to edit the Makefile to \n" .
+ "prevent its ever being regenerated.\n\n");
+printf(OUT
+ "This file contains the default tables for characters with codes less than\n" .
+ "128 (ASCII characters). These tables are used when no external tables are\n" .
+ "passed to PCRE. */\n\n" .
+ "const unsigned char jsc_pcre_default_tables[%d] = {\n\n" .
+ "/* This table is a lower casing table. */\n\n", $pcre_internal{tables_length});
+
+if ($pcre_internal{lcc_offset} != 0) {
+ die "lcc_offset != 0";
+}
+
+printf(OUT " ");
+for (my $i = 0; $i < 128; $i++) {
+ if (($i & 7) == 0 && $i != 0) {
+ printf(OUT "\n ");
+ }
+ printf(OUT "0x%02X", ord(lc(chr($i))));
+ if ($i != 127) {
+ printf(OUT ", ");
+ }
+}
+printf(OUT ",\n\n");
+
+printf(OUT "/* This table is a case flipping table. */\n\n");
+
+if ($pcre_internal{fcc_offset} != 128) {
+ die "fcc_offset != 128";
+}
+
+printf(OUT " ");
+for (my $i = 0; $i < 128; $i++) {
+ if (($i & 7) == 0 && $i != 0) {
+ printf(OUT "\n ");
+ }
+ my $c = chr($i);
+ printf(OUT "0x%02X", $c =~ /[[:lower:]]/ ? ord(uc($c)) : ord(lc($c)));
+ if ($i != 127) {
+ printf(OUT ", ");
+ }
+}
+printf(OUT ",\n\n");
+
+printf(OUT
+ "/* This table contains bit maps for various character classes.\n" .
+ "Each map is 32 bytes long and the bits run from the least\n" .
+ "significant end of each byte. The classes are: space, digit, word. */\n\n");
+
+if ($pcre_internal{cbits_offset} != $pcre_internal{fcc_offset} + 128) {
+ die "cbits_offset != fcc_offset + 128";
+}
+
+my @cbit_table = (0) x $pcre_internal{cbit_length};
+for (my $i = ord('0'); $i <= ord('9'); $i++) {
+ $cbit_table[$pcre_internal{cbit_digit} + $i / 8] |= 1 << ($i & 7);
+}
+$cbit_table[$pcre_internal{cbit_word} + ord('_') / 8] |= 1 << (ord('_') & 7);
+for (my $i = 0; $i < 128; $i++) {
+ my $c = chr($i);
+ if ($c =~ /[[:alnum:]]/) {
+ $cbit_table[$pcre_internal{cbit_word} + $i / 8] |= 1 << ($i & 7);
+ }
+ if ($c =~ /[[:space:]]/) {
+ $cbit_table[$pcre_internal{cbit_space} + $i / 8] |= 1 << ($i & 7);
+ }
+}
+
+printf(OUT " ");
+for (my $i = 0; $i < $pcre_internal{cbit_length}; $i++) {
+ if (($i & 7) == 0 && $i != 0) {
+ if (($i & 31) == 0) {
+ printf(OUT "\n");
+ }
+ printf(OUT "\n ");
+ }
+ printf(OUT "0x%02X", $cbit_table[$i]);
+ if ($i != $pcre_internal{cbit_length} - 1) {
+ printf(OUT ", ");
+ }
+}
+printf(OUT ",\n\n");
+
+printf(OUT
+ "/* This table identifies various classes of character by individual bits:\n" .
+ " 0x%02x white space character\n" .
+ " 0x%02x hexadecimal digit\n" .
+ " 0x%02x alphanumeric or '_'\n*/\n\n",
+ $pcre_internal{ctype_space}, $pcre_internal{ctype_xdigit}, $pcre_internal{ctype_word});
+
+if ($pcre_internal{ctypes_offset} != $pcre_internal{cbits_offset} + $pcre_internal{cbit_length}) {
+ die "ctypes_offset != cbits_offset + cbit_length";
+}
+
+printf(OUT " ");
+for (my $i = 0; $i < 128; $i++) {
+ my $x = 0;
+ my $c = chr($i);
+ if ($c =~ /[[:space:]]/) {
+ $x += $pcre_internal{ctype_space};
+ }
+ if ($c =~ /[[:xdigit:]]/) {
+ $x += $pcre_internal{ctype_xdigit};
+ }
+ if ($c =~ /[[:alnum:]_]/) {
+ $x += $pcre_internal{ctype_word};
+ }
+ printf(OUT "0x%02X", $x);
+ if ($i != 127) {
+ printf(OUT ", ");
+ } else {
+ printf(OUT "};");
+ }
+ if (($i & 7) == 7) {
+ printf(OUT " /* ");
+ my $d = chr($i - 7);
+ if ($d =~ /[[:print:]]/) {
+ printf(OUT " %c -", $i - 7);
+ } else {
+ printf(OUT "%3d-", $i - 7);
+ }
+ if ($c =~ m/[[:print:]]/) {
+ printf(OUT " %c ", $i);
+ } else {
+ printf(OUT "%3d", $i);
+ }
+ printf(OUT " */\n");
+ if ($i != 127) {
+ printf(OUT " ");
+ }
+ }
+}
+
+if ($pcre_internal{tables_length} != $pcre_internal{ctypes_offset} + 128) {
+ die "tables_length != ctypes_offset + 128";
+}
+
+printf(OUT "\n\n/* End of chartables.c */\n");
+
+close(OUT);
+
+exit 0;
+
+sub readHeaderValues()
+{
+ my @variables = qw(
+ cbit_digit
+ cbit_length
+ cbit_space
+ cbit_word
+ cbits_offset
+ ctype_space
+ ctype_word
+ ctype_xdigit
+ ctypes_offset
+ fcc_offset
+ lcc_offset
+ tables_length
+ );
+
+ local $/ = undef;
+
+ my $headerPath = File::Spec->catfile(dirname($0), "pcre_internal.h");
+
+ my ($fh, $tempFile) = tempfile(
+ basename($0) . "-XXXXXXXX",
+ DIR => File::Spec->tmpdir(),
+ SUFFIX => ".in",
+ UNLINK => 0,
+ );
+
+ print $fh "#define DFTABLES\n\n";
+
+ open(HEADER, "<", $headerPath) or die "$!";
+ print $fh <HEADER>;
+ close(HEADER);
+
+ print $fh "\n\n";
+
+ for my $v (@variables) {
+ print $fh "\$pcre_internal{\"$v\"} = $v;\n";
+ }
+
+ close($fh);
+
+ open(CPP, "$preprocessor \"$tempFile\" |") or die "$!";
+ my $content = <CPP>;
+ close(CPP);
+
+ eval $content;
+ die "$@" if $@;
+ unlink $tempFile;
+}
diff --git a/Source/JavaScriptCore/pcre/pcre.h b/Source/JavaScriptCore/pcre/pcre.h
new file mode 100644
index 0000000..55044fd
--- /dev/null
+++ b/Source/JavaScriptCore/pcre/pcre.h
@@ -0,0 +1,68 @@
+/* This is the public header file for JavaScriptCore's variant of the PCRE
+library. While this library started out as a copy of PCRE, many of the
+features of PCRE have been removed. This library now supports only the
+regular expression features required by the JavaScript language
+specification, and has only the functions needed by JavaScriptCore and the
+rest of WebKit.
+
+ Copyright (c) 1997-2005 University of Cambridge
+ Copyright (C) 2002, 2004, 2006, 2007 Apple Inc. All rights reserved.
+
+-----------------------------------------------------------------------------
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the name of the University of Cambridge nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+-----------------------------------------------------------------------------
+*/
+
+// FIXME: This file needs to be renamed to JSRegExp.h; it's no longer PCRE.
+
+#ifndef JSRegExp_h
+#define JSRegExp_h
+
+#include <wtf/unicode/Unicode.h>
+
+struct JSRegExp;
+
+enum JSRegExpIgnoreCaseOption { JSRegExpDoNotIgnoreCase, JSRegExpIgnoreCase };
+enum JSRegExpMultilineOption { JSRegExpSingleLine, JSRegExpMultiline };
+
+/* jsRegExpExecute error codes */
+const int JSRegExpErrorNoMatch = -1;
+const int JSRegExpErrorHitLimit = -2;
+const int JSRegExpErrorNoMemory = -3;
+const int JSRegExpErrorInternal = -4;
+
+JSRegExp* jsRegExpCompile(const UChar* pattern, int patternLength,
+ JSRegExpIgnoreCaseOption, JSRegExpMultilineOption,
+ unsigned* numSubpatterns, const char** errorMessage);
+
+int jsRegExpExecute(const JSRegExp*,
+ const UChar* subject, int subjectLength, int startOffset,
+ int* offsetsVector, int offsetsVectorLength);
+
+void jsRegExpFree(JSRegExp*);
+
+#endif
diff --git a/Source/JavaScriptCore/pcre/pcre.pri b/Source/JavaScriptCore/pcre/pcre.pri
new file mode 100644
index 0000000..3652d95
--- /dev/null
+++ b/Source/JavaScriptCore/pcre/pcre.pri
@@ -0,0 +1,12 @@
+# Perl Compatible Regular Expressions - Qt4 build info
+VPATH += $$PWD
+INCLUDEPATH += $$PWD $$OUTPUT_DIR/Source/JavaScriptCore/generated
+DEPENDPATH += $$PWD
+
+SOURCES += \
+ pcre_compile.cpp \
+ pcre_exec.cpp \
+ pcre_tables.cpp \
+ pcre_ucp_searchfuncs.cpp \
+ pcre_xclass.cpp
+
diff --git a/Source/JavaScriptCore/pcre/pcre_compile.cpp b/Source/JavaScriptCore/pcre/pcre_compile.cpp
new file mode 100644
index 0000000..9d472d8
--- /dev/null
+++ b/Source/JavaScriptCore/pcre/pcre_compile.cpp
@@ -0,0 +1,2708 @@
+/* This is JavaScriptCore's variant of the PCRE library. While this library
+started out as a copy of PCRE, many of the features of PCRE have been
+removed. This library now supports only the regular expression features
+required by the JavaScript language specification, and has only the functions
+needed by JavaScriptCore and the rest of WebKit.
+
+ Originally written by Philip Hazel
+ Copyright (c) 1997-2006 University of Cambridge
+ Copyright (C) 2002, 2004, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ Copyright (C) 2007 Eric Seidel <eric@webkit.org>
+
+-----------------------------------------------------------------------------
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the name of the University of Cambridge nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+-----------------------------------------------------------------------------
+*/
+
+/* This module contains the external function jsRegExpExecute(), along with
+supporting internal functions that are not used by other modules. */
+
+#include "config.h"
+
+#include "pcre_internal.h"
+
+#include <string.h>
+#include <wtf/ASCIICType.h>
+#include <wtf/FastMalloc.h>
+#include <wtf/FixedArray.h>
+#include <wtf/StdLibExtras.h>
+
+using namespace WTF;
+
+/* Negative values for the firstchar and reqchar variables */
+
+#define REQ_UNSET (-2)
+#define REQ_NONE (-1)
+
+/*************************************************
+* Code parameters and static tables *
+*************************************************/
+
+/* Maximum number of items on the nested bracket stacks at compile time. This
+applies to the nesting of all kinds of parentheses. It does not limit
+un-nested, non-capturing parentheses. This number can be made bigger if
+necessary - it is used to dimension one int and one unsigned char vector at
+compile time. */
+
+#define BRASTACK_SIZE 200
+
+/* Table for handling escaped characters in the range '0'-'z'. Positive returns
+are simple data values; negative values are for special things like \d and so
+on. Zero means further processing is needed (for things like \x), or the escape
+is invalid. */
+
+static const short escapes[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0, /* 0 - 7 */
+ 0, 0, ':', ';', '<', '=', '>', '?', /* 8 - ? */
+ '@', 0, -ESC_B, 0, -ESC_D, 0, 0, 0, /* @ - G */
+ 0, 0, 0, 0, 0, 0, 0, 0, /* H - O */
+ 0, 0, 0, -ESC_S, 0, 0, 0, -ESC_W, /* P - W */
+ 0, 0, 0, '[', '\\', ']', '^', '_', /* X - _ */
+ '`', 7, -ESC_b, 0, -ESC_d, 0, '\f', 0, /* ` - g */
+ 0, 0, 0, 0, 0, 0, '\n', 0, /* h - o */
+ 0, 0, '\r', -ESC_s, '\t', 0, '\v', -ESC_w, /* p - w */
+ 0, 0, 0 /* x - z */
+};
+
+/* Error code numbers. They are given names so that they can more easily be
+tracked. */
+
+enum ErrorCode {
+ ERR0, ERR1, ERR2, ERR3, ERR4, ERR5, ERR6, ERR7, ERR8, ERR9,
+ ERR10, ERR11, ERR12, ERR13, ERR14, ERR15, ERR16, ERR17
+};
+
+/* The texts of compile-time error messages. These are "char *" because they
+are passed to the outside world. */
+
+static const char* errorText(ErrorCode code)
+{
+ static const char errorTexts[] =
+ /* 1 */
+ "\\ at end of pattern\0"
+ "\\c at end of pattern\0"
+ "character value in \\x{...} sequence is too large\0"
+ "numbers out of order in {} quantifier\0"
+ /* 5 */
+ "number too big in {} quantifier\0"
+ "missing terminating ] for character class\0"
+ "internal error: code overflow\0"
+ "range out of order in character class\0"
+ "nothing to repeat\0"
+ /* 10 */
+ "unmatched parentheses\0"
+ "internal error: unexpected repeat\0"
+ "unrecognized character after (?\0"
+ "failed to get memory\0"
+ "missing )\0"
+ /* 15 */
+ "reference to non-existent subpattern\0"
+ "regular expression too large\0"
+ "parentheses nested too deeply"
+ ;
+
+ int i = code;
+ const char* text = errorTexts;
+ while (i > 1)
+ i -= !*text++;
+ return text;
+}
+
+/* Structure for passing "static" information around between the functions
+doing the compiling. */
+
+struct CompileData {
+ CompileData() {
+ topBackref = 0;
+ backrefMap = 0;
+ reqVaryOpt = 0;
+ needOuterBracket = false;
+ numCapturingBrackets = 0;
+ }
+ int topBackref; /* Maximum back reference */
+ unsigned backrefMap; /* Bitmap of low back refs */
+ int reqVaryOpt; /* "After variable item" flag for reqByte */
+ bool needOuterBracket;
+ int numCapturingBrackets;
+};
+
+/* Definitions to allow mutual recursion */
+
+static bool compileBracket(int, int*, unsigned char**, const UChar**, const UChar*, ErrorCode*, int, int*, int*, CompileData&);
+static bool bracketIsAnchored(const unsigned char* code);
+static bool bracketNeedsLineStart(const unsigned char* code, unsigned captureMap, unsigned backrefMap);
+static int bracketFindFirstAssertedCharacter(const unsigned char* code, bool inassert);
+
+/*************************************************
+* Handle escapes *
+*************************************************/
+
+/* This function is called when a \ has been encountered. It either returns a
+positive value for a simple escape such as \n, or a negative value which
+encodes one of the more complicated things such as \d. When UTF-8 is enabled,
+a positive value greater than 255 may be returned. On entry, ptr is pointing at
+the \. On exit, it is on the final character of the escape sequence.
+
+Arguments:
+ ptrPtr points to the pattern position pointer
+ errorCodePtr points to the errorcode variable
+ bracount number of previous extracting brackets
+ options the options bits
+ isClass true if inside a character class
+
+Returns: zero or positive => a data character
+ negative => a special escape sequence
+ on error, errorPtr is set
+*/
+
+static int checkEscape(const UChar** ptrPtr, const UChar* patternEnd, ErrorCode* errorCodePtr, int bracount, bool isClass)
+{
+ const UChar* ptr = *ptrPtr + 1;
+
+ /* If backslash is at the end of the pattern, it's an error. */
+ if (ptr == patternEnd) {
+ *errorCodePtr = ERR1;
+ *ptrPtr = ptr;
+ return 0;
+ }
+
+ int c = *ptr;
+
+ /* Non-alphamerics are literals. For digits or letters, do an initial lookup in
+ a table. A non-zero result is something that can be returned immediately.
+ Otherwise further processing may be required. */
+
+ if (c < '0' || c > 'z') { /* Not alphameric */
+ } else if (int escapeValue = escapes[c - '0']) {
+ c = escapeValue;
+ if (isClass) {
+ if (-c == ESC_b)
+ c = '\b'; /* \b is backslash in a class */
+ else if (-c == ESC_B)
+ c = 'B'; /* and \B is a capital B in a class (in browsers event though ECMAScript 15.10.2.19 says it raises an error) */
+ }
+ /* Escapes that need further processing, or are illegal. */
+
+ } else {
+ switch (c) {
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ /* Escape sequences starting with a non-zero digit are backreferences,
+ unless there are insufficient brackets, in which case they are octal
+ escape sequences. Those sequences end on the first non-octal character
+ or when we overflow 0-255, whichever comes first. */
+
+ if (!isClass) {
+ const UChar* oldptr = ptr;
+ c -= '0';
+ while ((ptr + 1 < patternEnd) && isASCIIDigit(ptr[1]) && c <= bracount)
+ c = c * 10 + *(++ptr) - '0';
+ if (c <= bracount) {
+ c = -(ESC_REF + c);
+ break;
+ }
+ ptr = oldptr; /* Put the pointer back and fall through */
+ }
+
+ /* Handle an octal number following \. If the first digit is 8 or 9,
+ this is not octal. */
+
+ if ((c = *ptr) >= '8') {
+ c = '\\';
+ ptr -= 1;
+ break;
+ }
+
+ /* \0 always starts an octal number, but we may drop through to here with a
+ larger first octal digit. */
+
+ case '0': {
+ c -= '0';
+ int i;
+ for (i = 1; i <= 2; ++i) {
+ if (ptr + i >= patternEnd || ptr[i] < '0' || ptr[i] > '7')
+ break;
+ int cc = c * 8 + ptr[i] - '0';
+ if (cc > 255)
+ break;
+ c = cc;
+ }
+ ptr += i - 1;
+ break;
+ }
+
+ case 'x': {
+ c = 0;
+ int i;
+ for (i = 1; i <= 2; ++i) {
+ if (ptr + i >= patternEnd || !isASCIIHexDigit(ptr[i])) {
+ c = 'x';
+ i = 1;
+ break;
+ }
+ int cc = ptr[i];
+ if (cc >= 'a')
+ cc -= 32; /* Convert to upper case */
+ c = c * 16 + cc - ((cc < 'A') ? '0' : ('A' - 10));
+ }
+ ptr += i - 1;
+ break;
+ }
+
+ case 'u': {
+ c = 0;
+ int i;
+ for (i = 1; i <= 4; ++i) {
+ if (ptr + i >= patternEnd || !isASCIIHexDigit(ptr[i])) {
+ c = 'u';
+ i = 1;
+ break;
+ }
+ int cc = ptr[i];
+ if (cc >= 'a')
+ cc -= 32; /* Convert to upper case */
+ c = c * 16 + cc - ((cc < 'A') ? '0' : ('A' - 10));
+ }
+ ptr += i - 1;
+ break;
+ }
+
+ case 'c':
+ if (++ptr == patternEnd) {
+ *errorCodePtr = ERR2;
+ return 0;
+ }
+
+ c = *ptr;
+
+ /* To match Firefox, inside a character class, we also accept
+ numbers and '_' as control characters */
+ if ((!isClass && !isASCIIAlpha(c)) || (!isASCIIAlphanumeric(c) && c != '_')) {
+ c = '\\';
+ ptr -= 2;
+ break;
+ }
+
+ /* A letter is upper-cased; then the 0x40 bit is flipped. This coding
+ is ASCII-specific, but then the whole concept of \cx is ASCII-specific. */
+ c = toASCIIUpper(c) ^ 0x40;
+ break;
+ }
+ }
+
+ *ptrPtr = ptr;
+ return c;
+}
+
+/*************************************************
+* Check for counted repeat *
+*************************************************/
+
+/* This function is called when a '{' is encountered in a place where it might
+start a quantifier. It looks ahead to see if it really is a quantifier or not.
+It is only a quantifier if it is one of the forms {ddd} {ddd,} or {ddd,ddd}
+where the ddds are digits.
+
+Arguments:
+ p pointer to the first char after '{'
+
+Returns: true or false
+*/
+
+static bool isCountedRepeat(const UChar* p, const UChar* patternEnd)
+{
+ if (p >= patternEnd || !isASCIIDigit(*p))
+ return false;
+ p++;
+ while (p < patternEnd && isASCIIDigit(*p))
+ p++;
+ if (p < patternEnd && *p == '}')
+ return true;
+
+ if (p >= patternEnd || *p++ != ',')
+ return false;
+ if (p < patternEnd && *p == '}')
+ return true;
+
+ if (p >= patternEnd || !isASCIIDigit(*p))
+ return false;
+ p++;
+ while (p < patternEnd && isASCIIDigit(*p))
+ p++;
+
+ return (p < patternEnd && *p == '}');
+}
+
+/*************************************************
+* Read repeat counts *
+*************************************************/
+
+/* Read an item of the form {n,m} and return the values. This is called only
+after isCountedRepeat() has confirmed that a repeat-count quantifier exists,
+so the syntax is guaranteed to be correct, but we need to check the values.
+
+Arguments:
+ p pointer to first char after '{'
+ minp pointer to int for min
+ maxp pointer to int for max
+ returned as -1 if no max
+ errorCodePtr points to error code variable
+
+Returns: pointer to '}' on success;
+ current ptr on error, with errorCodePtr set non-zero
+*/
+
+static const UChar* readRepeatCounts(const UChar* p, int* minp, int* maxp, ErrorCode* errorCodePtr)
+{
+ int min = 0;
+ int max = -1;
+
+ /* Read the minimum value and do a paranoid check: a negative value indicates
+ an integer overflow. */
+
+ while (isASCIIDigit(*p))
+ min = min * 10 + *p++ - '0';
+ if (min < 0 || min > 65535) {
+ *errorCodePtr = ERR5;
+ return p;
+ }
+
+ /* Read the maximum value if there is one, and again do a paranoid on its size.
+ Also, max must not be less than min. */
+
+ if (*p == '}')
+ max = min;
+ else {
+ if (*(++p) != '}') {
+ max = 0;
+ while (isASCIIDigit(*p))
+ max = max * 10 + *p++ - '0';
+ if (max < 0 || max > 65535) {
+ *errorCodePtr = ERR5;
+ return p;
+ }
+ if (max < min) {
+ *errorCodePtr = ERR4;
+ return p;
+ }
+ }
+ }
+
+ /* Fill in the required variables, and pass back the pointer to the terminating
+ '}'. */
+
+ *minp = min;
+ *maxp = max;
+ return p;
+}
+
+/*************************************************
+* Find first significant op code *
+*************************************************/
+
+/* This is called by several functions that scan a compiled expression looking
+for a fixed first character, or an anchoring op code etc. It skips over things
+that do not influence this.
+
+Arguments:
+ code pointer to the start of the group
+Returns: pointer to the first significant opcode
+*/
+
+static const unsigned char* firstSignificantOpcode(const unsigned char* code)
+{
+ while (*code == OP_BRANUMBER)
+ code += 3;
+ return code;
+}
+
+static const unsigned char* firstSignificantOpcodeSkippingAssertions(const unsigned char* code)
+{
+ while (true) {
+ switch (*code) {
+ case OP_ASSERT_NOT:
+ advanceToEndOfBracket(code);
+ code += 1 + LINK_SIZE;
+ break;
+ case OP_WORD_BOUNDARY:
+ case OP_NOT_WORD_BOUNDARY:
+ ++code;
+ break;
+ case OP_BRANUMBER:
+ code += 3;
+ break;
+ default:
+ return code;
+ }
+ }
+}
+
+/*************************************************
+* Get othercase range *
+*************************************************/
+
+/* This function is passed the start and end of a class range, in UTF-8 mode
+with UCP support. It searches up the characters, looking for internal ranges of
+characters in the "other" case. Each call returns the next one, updating the
+start address.
+
+Arguments:
+ cptr points to starting character value; updated
+ d end value
+ ocptr where to put start of othercase range
+ odptr where to put end of othercase range
+
+Yield: true when range returned; false when no more
+*/
+
+static bool getOthercaseRange(int* cptr, int d, int* ocptr, int* odptr)
+{
+ int c, othercase = 0;
+
+ for (c = *cptr; c <= d; c++) {
+ if ((othercase = jsc_pcre_ucp_othercase(c)) >= 0)
+ break;
+ }
+
+ if (c > d)
+ return false;
+
+ *ocptr = othercase;
+ int next = othercase + 1;
+
+ for (++c; c <= d; c++) {
+ if (jsc_pcre_ucp_othercase(c) != next)
+ break;
+ next++;
+ }
+
+ *odptr = next - 1;
+ *cptr = c;
+
+ return true;
+}
+
+/*************************************************
+ * Convert character value to UTF-8 *
+ *************************************************/
+
+/* This function takes an integer value in the range 0 - 0x7fffffff
+ and encodes it as a UTF-8 character in 0 to 6 bytes.
+
+ Arguments:
+ cvalue the character value
+ buffer pointer to buffer for result - at least 6 bytes long
+
+ Returns: number of characters placed in the buffer
+ */
+
+static int encodeUTF8(int cvalue, unsigned char *buffer)
+{
+ int i;
+ for (i = 0; i < jsc_pcre_utf8_table1_size; i++)
+ if (cvalue <= jsc_pcre_utf8_table1[i])
+ break;
+ buffer += i;
+ for (int j = i; j > 0; j--) {
+ *buffer-- = 0x80 | (cvalue & 0x3f);
+ cvalue >>= 6;
+ }
+ *buffer = jsc_pcre_utf8_table2[i] | cvalue;
+ return i + 1;
+}
+
+/*************************************************
+* Compile one branch *
+*************************************************/
+
+/* Scan the pattern, compiling it into the code vector.
+
+Arguments:
+ options the option bits
+ brackets points to number of extracting brackets used
+ codePtr points to the pointer to the current code point
+ ptrPtr points to the current pattern pointer
+ errorCodePtr points to error code variable
+ firstbyteptr set to initial literal character, or < 0 (REQ_UNSET, REQ_NONE)
+ reqbyteptr set to the last literal character required, else < 0
+ cd contains pointers to tables etc.
+
+Returns: true on success
+ false, with *errorCodePtr set non-zero on error
+*/
+
+static inline bool safelyCheckNextChar(const UChar* ptr, const UChar* patternEnd, UChar expected)
+{
+ return ((ptr + 1 < patternEnd) && ptr[1] == expected);
+}
+
+static bool
+compileBranch(int options, int* brackets, unsigned char** codePtr,
+ const UChar** ptrPtr, const UChar* patternEnd, ErrorCode* errorCodePtr, int *firstbyteptr,
+ int* reqbyteptr, CompileData& cd)
+{
+ int repeatType, opType;
+ int repeatMin = 0, repeat_max = 0; /* To please picky compilers */
+ int bravalue = 0;
+ int reqvary, tempreqvary;
+ int c;
+ unsigned char* code = *codePtr;
+ unsigned char* tempcode;
+ bool didGroupSetFirstByte = false;
+ const UChar* ptr = *ptrPtr;
+ const UChar* tempptr;
+ unsigned char* previous = NULL;
+ unsigned char classbits[32];
+
+ bool class_utf8;
+ unsigned char* class_utf8data;
+ unsigned char utf8_char[6];
+
+ /* Initialize no first byte, no required byte. REQ_UNSET means "no char
+ matching encountered yet". It gets changed to REQ_NONE if we hit something that
+ matches a non-fixed char first char; reqByte just remains unset if we never
+ find one.
+
+ When we hit a repeat whose minimum is zero, we may have to adjust these values
+ to take the zero repeat into account. This is implemented by setting them to
+ zeroFirstByte and zeroReqByte when such a repeat is encountered. The individual
+ item types that can be repeated set these backoff variables appropriately. */
+
+ int firstByte = REQ_UNSET;
+ int reqByte = REQ_UNSET;
+ int zeroReqByte = REQ_UNSET;
+ int zeroFirstByte = REQ_UNSET;
+
+ /* The variable reqCaseOpt contains either the REQ_IGNORE_CASE value or zero,
+ according to the current setting of the ignores-case flag. REQ_IGNORE_CASE is a bit
+ value > 255. It is added into the firstByte or reqByte variables to record the
+ case status of the value. This is used only for ASCII characters. */
+
+ int reqCaseOpt = (options & IgnoreCaseOption) ? REQ_IGNORE_CASE : 0;
+
+ /* Switch on next character until the end of the branch */
+
+ for (;; ptr++) {
+ bool negateClass;
+ bool shouldFlipNegation; /* If a negative special such as \S is used, we should negate the whole class to properly support Unicode. */
+ int classCharCount;
+ int classLastChar;
+ int skipBytes;
+ int subReqByte;
+ int subFirstByte;
+ int mcLength;
+ unsigned char mcbuffer[8];
+
+ /* Next byte in the pattern */
+
+ c = ptr < patternEnd ? *ptr : 0;
+
+ /* Fill in length of a previous callout, except when the next thing is
+ a quantifier. */
+
+ bool isQuantifier = c == '*' || c == '+' || c == '?' || (c == '{' && isCountedRepeat(ptr + 1, patternEnd));
+
+ switch (c) {
+ /* The branch terminates at end of string, |, or ). */
+
+ case 0:
+ if (ptr < patternEnd)
+ goto NORMAL_CHAR;
+ // End of string; fall through
+ case '|':
+ case ')':
+ *firstbyteptr = firstByte;
+ *reqbyteptr = reqByte;
+ *codePtr = code;
+ *ptrPtr = ptr;
+ return true;
+
+ /* Handle single-character metacharacters. In multiline mode, ^ disables
+ the setting of any following char as a first character. */
+
+ case '^':
+ if (options & MatchAcrossMultipleLinesOption) {
+ if (firstByte == REQ_UNSET)
+ firstByte = REQ_NONE;
+ *code++ = OP_BOL;
+ } else
+ *code++ = OP_CIRC;
+ previous = NULL;
+ break;
+
+ case '$':
+ previous = NULL;
+ if (options & MatchAcrossMultipleLinesOption)
+ *code++ = OP_EOL;
+ else
+ *code++ = OP_DOLL;
+ break;
+
+ /* There can never be a first char if '.' is first, whatever happens about
+ repeats. The value of reqByte doesn't change either. */
+
+ case '.':
+ if (firstByte == REQ_UNSET)
+ firstByte = REQ_NONE;
+ zeroFirstByte = firstByte;
+ zeroReqByte = reqByte;
+ previous = code;
+ *code++ = OP_NOT_NEWLINE;
+ break;
+
+ /* Character classes. If the included characters are all < 256, we build a
+ 32-byte bitmap of the permitted characters, except in the special case
+ where there is only one such character. For negated classes, we build the
+ map as usual, then invert it at the end. However, we use a different opcode
+ so that data characters > 255 can be handled correctly.
+
+ If the class contains characters outside the 0-255 range, a different
+ opcode is compiled. It may optionally have a bit map for characters < 256,
+ but those above are are explicitly listed afterwards. A flag byte tells
+ whether the bitmap is present, and whether this is a negated class or not.
+ */
+
+ case '[': {
+ previous = code;
+ shouldFlipNegation = false;
+
+ /* PCRE supports POSIX class stuff inside a class. Perl gives an error if
+ they are encountered at the top level, so we'll do that too. */
+
+ /* If the first character is '^', set the negation flag and skip it. */
+
+ if (ptr + 1 >= patternEnd) {
+ *errorCodePtr = ERR6;
+ return false;
+ }
+
+ if (ptr[1] == '^') {
+ negateClass = true;
+ ++ptr;
+ } else
+ negateClass = false;
+
+ /* Keep a count of chars with values < 256 so that we can optimize the case
+ of just a single character (as long as it's < 256). For higher valued UTF-8
+ characters, we don't yet do any optimization. */
+
+ classCharCount = 0;
+ classLastChar = -1;
+
+ class_utf8 = false; /* No chars >= 256 */
+ class_utf8data = code + LINK_SIZE + 34; /* For UTF-8 items */
+
+ /* Initialize the 32-char bit map to all zeros. We have to build the
+ map in a temporary bit of store, in case the class contains only 1
+ character (< 256), because in that case the compiled code doesn't use the
+ bit map. */
+
+ memset(classbits, 0, 32 * sizeof(unsigned char));
+
+ /* Process characters until ] is reached. The first pass
+ through the regex checked the overall syntax, so we don't need to be very
+ strict here. At the start of the loop, c contains the first byte of the
+ character. */
+
+ while ((++ptr < patternEnd) && (c = *ptr) != ']') {
+ /* Backslash may introduce a single character, or it may introduce one
+ of the specials, which just set a flag. Escaped items are checked for
+ validity in the pre-compiling pass. The sequence \b is a special case.
+ Inside a class (and only there) it is treated as backspace. Elsewhere
+ it marks a word boundary. Other escapes have preset maps ready to
+ or into the one we are building. We assume they have more than one
+ character in them, so set classCharCount bigger than one. */
+
+ if (c == '\\') {
+ c = checkEscape(&ptr, patternEnd, errorCodePtr, cd.numCapturingBrackets, true);
+ if (c < 0) {
+ classCharCount += 2; /* Greater than 1 is what matters */
+ switch (-c) {
+ case ESC_d:
+ for (c = 0; c < 32; c++)
+ classbits[c] |= classBitmapForChar(c + cbit_digit);
+ continue;
+
+ case ESC_D:
+ shouldFlipNegation = true;
+ for (c = 0; c < 32; c++)
+ classbits[c] |= ~classBitmapForChar(c + cbit_digit);
+ continue;
+
+ case ESC_w:
+ for (c = 0; c < 32; c++)
+ classbits[c] |= classBitmapForChar(c + cbit_word);
+ continue;
+
+ case ESC_W:
+ shouldFlipNegation = true;
+ for (c = 0; c < 32; c++)
+ classbits[c] |= ~classBitmapForChar(c + cbit_word);
+ continue;
+
+ case ESC_s:
+ for (c = 0; c < 32; c++)
+ classbits[c] |= classBitmapForChar(c + cbit_space);
+ continue;
+
+ case ESC_S:
+ shouldFlipNegation = true;
+ for (c = 0; c < 32; c++)
+ classbits[c] |= ~classBitmapForChar(c + cbit_space);
+ continue;
+
+ /* Unrecognized escapes are faulted if PCRE is running in its
+ strict mode. By default, for compatibility with Perl, they are
+ treated as literals. */
+
+ default:
+ c = *ptr; /* The final character */
+ classCharCount -= 2; /* Undo the default count from above */
+ }
+ }
+
+ /* Fall through if we have a single character (c >= 0). This may be
+ > 256 in UTF-8 mode. */
+
+ } /* End of backslash handling */
+
+ /* A single character may be followed by '-' to form a range. However,
+ Perl does not permit ']' to be the end of the range. A '-' character
+ here is treated as a literal. */
+
+ if ((ptr + 2 < patternEnd) && ptr[1] == '-' && ptr[2] != ']') {
+ ptr += 2;
+
+ int d = *ptr;
+
+ /* The second part of a range can be a single-character escape, but
+ not any of the other escapes. Perl 5.6 treats a hyphen as a literal
+ in such circumstances. */
+
+ if (d == '\\') {
+ const UChar* oldptr = ptr;
+ d = checkEscape(&ptr, patternEnd, errorCodePtr, cd.numCapturingBrackets, true);
+
+ /* \X is literal X; any other special means the '-' was literal */
+ if (d < 0) {
+ ptr = oldptr - 2;
+ goto LONE_SINGLE_CHARACTER; /* A few lines below */
+ }
+ }
+
+ /* The check that the two values are in the correct order happens in
+ the pre-pass. Optimize one-character ranges */
+
+ if (d == c)
+ goto LONE_SINGLE_CHARACTER; /* A few lines below */
+
+ /* In UTF-8 mode, if the upper limit is > 255, or > 127 for caseless
+ matching, we have to use an XCLASS with extra data items. Caseless
+ matching for characters > 127 is available only if UCP support is
+ available. */
+
+ if ((d > 255 || ((options & IgnoreCaseOption) && d > 127))) {
+ class_utf8 = true;
+
+ /* With UCP support, we can find the other case equivalents of
+ the relevant characters. There may be several ranges. Optimize how
+ they fit with the basic range. */
+
+ if (options & IgnoreCaseOption) {
+ int occ, ocd;
+ int cc = c;
+ int origd = d;
+ while (getOthercaseRange(&cc, origd, &occ, &ocd)) {
+ if (occ >= c && ocd <= d)
+ continue; /* Skip embedded ranges */
+
+ if (occ < c && ocd >= c - 1) /* Extend the basic range */
+ { /* if there is overlap, */
+ c = occ; /* noting that if occ < c */
+ continue; /* we can't have ocd > d */
+ } /* because a subrange is */
+ if (ocd > d && occ <= d + 1) /* always shorter than */
+ { /* the basic range. */
+ d = ocd;
+ continue;
+ }
+
+ if (occ == ocd)
+ *class_utf8data++ = XCL_SINGLE;
+ else {
+ *class_utf8data++ = XCL_RANGE;
+ class_utf8data += encodeUTF8(occ, class_utf8data);
+ }
+ class_utf8data += encodeUTF8(ocd, class_utf8data);
+ }
+ }
+
+ /* Now record the original range, possibly modified for UCP caseless
+ overlapping ranges. */
+
+ *class_utf8data++ = XCL_RANGE;
+ class_utf8data += encodeUTF8(c, class_utf8data);
+ class_utf8data += encodeUTF8(d, class_utf8data);
+
+ /* With UCP support, we are done. Without UCP support, there is no
+ caseless matching for UTF-8 characters > 127; we can use the bit map
+ for the smaller ones. */
+
+ continue; /* With next character in the class */
+ }
+
+ /* We use the bit map for all cases when not in UTF-8 mode; else
+ ranges that lie entirely within 0-127 when there is UCP support; else
+ for partial ranges without UCP support. */
+
+ for (; c <= d; c++) {
+ classbits[c/8] |= (1 << (c&7));
+ if (options & IgnoreCaseOption) {
+ int uc = flipCase(c);
+ classbits[uc/8] |= (1 << (uc&7));
+ }
+ classCharCount++; /* in case a one-char range */
+ classLastChar = c;
+ }
+
+ continue; /* Go get the next char in the class */
+ }
+
+ /* Handle a lone single character - we can get here for a normal
+ non-escape char, or after \ that introduces a single character or for an
+ apparent range that isn't. */
+
+ LONE_SINGLE_CHARACTER:
+
+ /* Handle a character that cannot go in the bit map */
+
+ if ((c > 255 || ((options & IgnoreCaseOption) && c > 127))) {
+ class_utf8 = true;
+ *class_utf8data++ = XCL_SINGLE;
+ class_utf8data += encodeUTF8(c, class_utf8data);
+
+ if (options & IgnoreCaseOption) {
+ int othercase;
+ if ((othercase = jsc_pcre_ucp_othercase(c)) >= 0) {
+ *class_utf8data++ = XCL_SINGLE;
+ class_utf8data += encodeUTF8(othercase, class_utf8data);
+ }
+ }
+ } else {
+ /* Handle a single-byte character */
+ classbits[c/8] |= (1 << (c&7));
+ if (options & IgnoreCaseOption) {
+ c = flipCase(c);
+ classbits[c/8] |= (1 << (c&7));
+ }
+ classCharCount++;
+ classLastChar = c;
+ }
+ }
+
+ /* If classCharCount is 1, we saw precisely one character whose value is
+ less than 256. In non-UTF-8 mode we can always optimize. In UTF-8 mode, we
+ can optimize the negative case only if there were no characters >= 128
+ because OP_NOT and the related opcodes like OP_NOTSTAR operate on
+ single-bytes only. This is an historical hangover. Maybe one day we can
+ tidy these opcodes to handle multi-byte characters.
+
+ The optimization throws away the bit map. We turn the item into a
+ 1-character OP_CHAR[NC] if it's positive, or OP_NOT if it's negative. Note
+ that OP_NOT does not support multibyte characters. In the positive case, it
+ can cause firstByte to be set. Otherwise, there can be no first char if
+ this item is first, whatever repeat count may follow. In the case of
+ reqByte, save the previous value for reinstating. */
+
+ if (classCharCount == 1 && (!class_utf8 && (!negateClass || classLastChar < 128))) {
+ zeroReqByte = reqByte;
+
+ /* The OP_NOT opcode works on one-byte characters only. */
+
+ if (negateClass) {
+ if (firstByte == REQ_UNSET)
+ firstByte = REQ_NONE;
+ zeroFirstByte = firstByte;
+ *code++ = OP_NOT;
+ *code++ = classLastChar;
+ break;
+ }
+
+ /* For a single, positive character, get the value into c, and
+ then we can handle this with the normal one-character code. */
+
+ c = classLastChar;
+ goto NORMAL_CHAR;
+ } /* End of 1-char optimization */
+
+ /* The general case - not the one-char optimization. If this is the first
+ thing in the branch, there can be no first char setting, whatever the
+ repeat count. Any reqByte setting must remain unchanged after any kind of
+ repeat. */
+
+ if (firstByte == REQ_UNSET) firstByte = REQ_NONE;
+ zeroFirstByte = firstByte;
+ zeroReqByte = reqByte;
+
+ /* If there are characters with values > 255, we have to compile an
+ extended class, with its own opcode. If there are no characters < 256,
+ we can omit the bitmap. */
+
+ if (class_utf8 && !shouldFlipNegation) {
+ *class_utf8data++ = XCL_END; /* Marks the end of extra data */
+ *code++ = OP_XCLASS;
+ code += LINK_SIZE;
+ *code = negateClass? XCL_NOT : 0;
+
+ /* If the map is required, install it, and move on to the end of
+ the extra data */
+
+ if (classCharCount > 0) {
+ *code++ |= XCL_MAP;
+ memcpy(code, classbits, 32);
+ code = class_utf8data;
+ }
+
+ /* If the map is not required, slide down the extra data. */
+
+ else {
+ int len = class_utf8data - (code + 33);
+ memmove(code + 1, code + 33, len);
+ code += len + 1;
+ }
+
+ /* Now fill in the complete length of the item */
+
+ putLinkValue(previous + 1, code - previous);
+ break; /* End of class handling */
+ }
+
+ /* If there are no characters > 255, negate the 32-byte map if necessary,
+ and copy it into the code vector. If this is the first thing in the branch,
+ there can be no first char setting, whatever the repeat count. Any reqByte
+ setting must remain unchanged after any kind of repeat. */
+
+ *code++ = (negateClass == shouldFlipNegation) ? OP_CLASS : OP_NCLASS;
+ if (negateClass)
+ for (c = 0; c < 32; c++)
+ code[c] = ~classbits[c];
+ else
+ memcpy(code, classbits, 32);
+ code += 32;
+ break;
+ }
+
+ /* Various kinds of repeat; '{' is not necessarily a quantifier, but this
+ has been tested above. */
+
+ case '{':
+ if (!isQuantifier)
+ goto NORMAL_CHAR;
+ ptr = readRepeatCounts(ptr + 1, &repeatMin, &repeat_max, errorCodePtr);
+ if (*errorCodePtr)
+ goto FAILED;
+ goto REPEAT;
+
+ case '*':
+ repeatMin = 0;
+ repeat_max = -1;
+ goto REPEAT;
+
+ case '+':
+ repeatMin = 1;
+ repeat_max = -1;
+ goto REPEAT;
+
+ case '?':
+ repeatMin = 0;
+ repeat_max = 1;
+
+ REPEAT:
+ if (!previous) {
+ *errorCodePtr = ERR9;
+ goto FAILED;
+ }
+
+ if (repeatMin == 0) {
+ firstByte = zeroFirstByte; /* Adjust for zero repeat */
+ reqByte = zeroReqByte; /* Ditto */
+ }
+
+ /* Remember whether this is a variable length repeat */
+
+ reqvary = (repeatMin == repeat_max) ? 0 : REQ_VARY;
+
+ opType = 0; /* Default single-char op codes */
+
+ /* Save start of previous item, in case we have to move it up to make space
+ for an inserted OP_ONCE for the additional '+' extension. */
+ /* FIXME: Probably don't need this because we don't use OP_ONCE. */
+
+ tempcode = previous;
+
+ /* If the next character is '+', we have a possessive quantifier. This
+ implies greediness, whatever the setting of the PCRE_UNGREEDY option.
+ If the next character is '?' this is a minimizing repeat, by default,
+ but if PCRE_UNGREEDY is set, it works the other way round. We change the
+ repeat type to the non-default. */
+
+ if (safelyCheckNextChar(ptr, patternEnd, '?')) {
+ repeatType = 1;
+ ptr++;
+ } else
+ repeatType = 0;
+
+ /* If previous was a character match, abolish the item and generate a
+ repeat item instead. If a char item has a minumum of more than one, ensure
+ that it is set in reqByte - it might not be if a sequence such as x{3} is
+ the first thing in a branch because the x will have gone into firstByte
+ instead. */
+
+ if (*previous == OP_CHAR || *previous == OP_CHAR_IGNORING_CASE) {
+ /* Deal with UTF-8 characters that take up more than one byte. It's
+ easier to write this out separately than try to macrify it. Use c to
+ hold the length of the character in bytes, plus 0x80 to flag that it's a
+ length rather than a small character. */
+
+ if (code[-1] & 0x80) {
+ unsigned char *lastchar = code - 1;
+ while((*lastchar & 0xc0) == 0x80)
+ lastchar--;
+ c = code - lastchar; /* Length of UTF-8 character */
+ memcpy(utf8_char, lastchar, c); /* Save the char */
+ c |= 0x80; /* Flag c as a length */
+ }
+ else {
+ c = code[-1];
+ if (repeatMin > 1)
+ reqByte = c | reqCaseOpt | cd.reqVaryOpt;
+ }
+
+ goto OUTPUT_SINGLE_REPEAT; /* Code shared with single character types */
+ }
+
+ else if (*previous == OP_ASCII_CHAR || *previous == OP_ASCII_LETTER_IGNORING_CASE) {
+ c = previous[1];
+ if (repeatMin > 1)
+ reqByte = c | reqCaseOpt | cd.reqVaryOpt;
+ goto OUTPUT_SINGLE_REPEAT;
+ }
+
+ /* If previous was a single negated character ([^a] or similar), we use
+ one of the special opcodes, replacing it. The code is shared with single-
+ character repeats by setting opt_type to add a suitable offset into
+ repeatType. OP_NOT is currently used only for single-byte chars. */
+
+ else if (*previous == OP_NOT) {
+ opType = OP_NOTSTAR - OP_STAR; /* Use "not" opcodes */
+ c = previous[1];
+ goto OUTPUT_SINGLE_REPEAT;
+ }
+
+ /* If previous was a character type match (\d or similar), abolish it and
+ create a suitable repeat item. The code is shared with single-character
+ repeats by setting opType to add a suitable offset into repeatType. */
+
+ else if (*previous <= OP_NOT_NEWLINE) {
+ opType = OP_TYPESTAR - OP_STAR; /* Use type opcodes */
+ c = *previous;
+
+ OUTPUT_SINGLE_REPEAT:
+ int prop_type = -1;
+ int prop_value = -1;
+
+ unsigned char* oldcode = code;
+ code = previous; /* Usually overwrite previous item */
+
+ /* If the maximum is zero then the minimum must also be zero; Perl allows
+ this case, so we do too - by simply omitting the item altogether. */
+
+ if (repeat_max == 0)
+ goto END_REPEAT;
+
+ /* Combine the opType with the repeatType */
+
+ repeatType += opType;
+
+ /* A minimum of zero is handled either as the special case * or ?, or as
+ an UPTO, with the maximum given. */
+
+ if (repeatMin == 0) {
+ if (repeat_max == -1)
+ *code++ = OP_STAR + repeatType;
+ else if (repeat_max == 1)
+ *code++ = OP_QUERY + repeatType;
+ else {
+ *code++ = OP_UPTO + repeatType;
+ put2ByteValueAndAdvance(code, repeat_max);
+ }
+ }
+
+ /* A repeat minimum of 1 is optimized into some special cases. If the
+ maximum is unlimited, we use OP_PLUS. Otherwise, the original item it
+ left in place and, if the maximum is greater than 1, we use OP_UPTO with
+ one less than the maximum. */
+
+ else if (repeatMin == 1) {
+ if (repeat_max == -1)
+ *code++ = OP_PLUS + repeatType;
+ else {
+ code = oldcode; /* leave previous item in place */
+ if (repeat_max == 1)
+ goto END_REPEAT;
+ *code++ = OP_UPTO + repeatType;
+ put2ByteValueAndAdvance(code, repeat_max - 1);
+ }
+ }
+
+ /* The case {n,n} is just an EXACT, while the general case {n,m} is
+ handled as an EXACT followed by an UPTO. */
+
+ else {
+ *code++ = OP_EXACT + opType; /* NB EXACT doesn't have repeatType */
+ put2ByteValueAndAdvance(code, repeatMin);
+
+ /* If the maximum is unlimited, insert an OP_STAR. Before doing so,
+ we have to insert the character for the previous code. For a repeated
+ Unicode property match, there are two extra bytes that define the
+ required property. In UTF-8 mode, long characters have their length in
+ c, with the 0x80 bit as a flag. */
+
+ if (repeat_max < 0) {
+ if (c >= 128) {
+ memcpy(code, utf8_char, c & 7);
+ code += c & 7;
+ } else {
+ *code++ = c;
+ if (prop_type >= 0) {
+ *code++ = prop_type;
+ *code++ = prop_value;
+ }
+ }
+ *code++ = OP_STAR + repeatType;
+ }
+
+ /* Else insert an UPTO if the max is greater than the min, again
+ preceded by the character, for the previously inserted code. */
+
+ else if (repeat_max != repeatMin) {
+ if (c >= 128) {
+ memcpy(code, utf8_char, c & 7);
+ code += c & 7;
+ } else
+ *code++ = c;
+ if (prop_type >= 0) {
+ *code++ = prop_type;
+ *code++ = prop_value;
+ }
+ repeat_max -= repeatMin;
+ *code++ = OP_UPTO + repeatType;
+ put2ByteValueAndAdvance(code, repeat_max);
+ }
+ }
+
+ /* The character or character type itself comes last in all cases. */
+
+ if (c >= 128) {
+ memcpy(code, utf8_char, c & 7);
+ code += c & 7;
+ } else
+ *code++ = c;
+
+ /* For a repeated Unicode property match, there are two extra bytes that
+ define the required property. */
+
+ if (prop_type >= 0) {
+ *code++ = prop_type;
+ *code++ = prop_value;
+ }
+ }
+
+ /* If previous was a character class or a back reference, we put the repeat
+ stuff after it, but just skip the item if the repeat was {0,0}. */
+
+ else if (*previous == OP_CLASS ||
+ *previous == OP_NCLASS ||
+ *previous == OP_XCLASS ||
+ *previous == OP_REF)
+ {
+ if (repeat_max == 0) {
+ code = previous;
+ goto END_REPEAT;
+ }
+
+ if (repeatMin == 0 && repeat_max == -1)
+ *code++ = OP_CRSTAR + repeatType;
+ else if (repeatMin == 1 && repeat_max == -1)
+ *code++ = OP_CRPLUS + repeatType;
+ else if (repeatMin == 0 && repeat_max == 1)
+ *code++ = OP_CRQUERY + repeatType;
+ else {
+ *code++ = OP_CRRANGE + repeatType;
+ put2ByteValueAndAdvance(code, repeatMin);
+ if (repeat_max == -1)
+ repeat_max = 0; /* 2-byte encoding for max */
+ put2ByteValueAndAdvance(code, repeat_max);
+ }
+ }
+
+ /* If previous was a bracket group, we may have to replicate it in certain
+ cases. */
+
+ else if (*previous >= OP_BRA) {
+ int ketoffset = 0;
+ int len = code - previous;
+ unsigned char* bralink = NULL;
+
+ /* If the maximum repeat count is unlimited, find the end of the bracket
+ by scanning through from the start, and compute the offset back to it
+ from the current code pointer. There may be an OP_OPT setting following
+ the final KET, so we can't find the end just by going back from the code
+ pointer. */
+
+ if (repeat_max == -1) {
+ const unsigned char* ket = previous;
+ advanceToEndOfBracket(ket);
+ ketoffset = code - ket;
+ }
+
+ /* The case of a zero minimum is special because of the need to stick
+ OP_BRAZERO in front of it, and because the group appears once in the
+ data, whereas in other cases it appears the minimum number of times. For
+ this reason, it is simplest to treat this case separately, as otherwise
+ the code gets far too messy. There are several special subcases when the
+ minimum is zero. */
+
+ if (repeatMin == 0) {
+ /* If the maximum is also zero, we just omit the group from the output
+ altogether. */
+
+ if (repeat_max == 0) {
+ code = previous;
+ goto END_REPEAT;
+ }
+
+ /* If the maximum is 1 or unlimited, we just have to stick in the
+ BRAZERO and do no more at this point. However, we do need to adjust
+ any OP_RECURSE calls inside the group that refer to the group itself or
+ any internal group, because the offset is from the start of the whole
+ regex. Temporarily terminate the pattern while doing this. */
+
+ if (repeat_max <= 1) {
+ *code = OP_END;
+ memmove(previous+1, previous, len);
+ code++;
+ *previous++ = OP_BRAZERO + repeatType;
+ }
+
+ /* If the maximum is greater than 1 and limited, we have to replicate
+ in a nested fashion, sticking OP_BRAZERO before each set of brackets.
+ The first one has to be handled carefully because it's the original
+ copy, which has to be moved up. The remainder can be handled by code
+ that is common with the non-zero minimum case below. We have to
+ adjust the value of repeat_max, since one less copy is required. */
+
+ else {
+ *code = OP_END;
+ memmove(previous + 2 + LINK_SIZE, previous, len);
+ code += 2 + LINK_SIZE;
+ *previous++ = OP_BRAZERO + repeatType;
+ *previous++ = OP_BRA;
+
+ /* We chain together the bracket offset fields that have to be
+ filled in later when the ends of the brackets are reached. */
+
+ int offset = (!bralink) ? 0 : previous - bralink;
+ bralink = previous;
+ putLinkValueAllowZeroAndAdvance(previous, offset);
+ }
+
+ repeat_max--;
+ }
+
+ /* If the minimum is greater than zero, replicate the group as many
+ times as necessary, and adjust the maximum to the number of subsequent
+ copies that we need. If we set a first char from the group, and didn't
+ set a required char, copy the latter from the former. */
+
+ else {
+ if (repeatMin > 1) {
+ if (didGroupSetFirstByte && reqByte < 0)
+ reqByte = firstByte;
+ for (int i = 1; i < repeatMin; i++) {
+ memcpy(code, previous, len);
+ code += len;
+ }
+ }
+ if (repeat_max > 0)
+ repeat_max -= repeatMin;
+ }
+
+ /* This code is common to both the zero and non-zero minimum cases. If
+ the maximum is limited, it replicates the group in a nested fashion,
+ remembering the bracket starts on a stack. In the case of a zero minimum,
+ the first one was set up above. In all cases the repeat_max now specifies
+ the number of additional copies needed. */
+
+ if (repeat_max >= 0) {
+ for (int i = repeat_max - 1; i >= 0; i--) {
+ *code++ = OP_BRAZERO + repeatType;
+
+ /* All but the final copy start a new nesting, maintaining the
+ chain of brackets outstanding. */
+
+ if (i != 0) {
+ *code++ = OP_BRA;
+ int offset = (!bralink) ? 0 : code - bralink;
+ bralink = code;
+ putLinkValueAllowZeroAndAdvance(code, offset);
+ }
+
+ memcpy(code, previous, len);
+ code += len;
+ }
+
+ /* Now chain through the pending brackets, and fill in their length
+ fields (which are holding the chain links pro tem). */
+
+ while (bralink) {
+ int offset = code - bralink + 1;
+ unsigned char* bra = code - offset;
+ int oldlinkoffset = getLinkValueAllowZero(bra + 1);
+ bralink = (!oldlinkoffset) ? 0 : bralink - oldlinkoffset;
+ *code++ = OP_KET;
+ putLinkValueAndAdvance(code, offset);
+ putLinkValue(bra + 1, offset);
+ }
+ }
+
+ /* If the maximum is unlimited, set a repeater in the final copy. We
+ can't just offset backwards from the current code point, because we
+ don't know if there's been an options resetting after the ket. The
+ correct offset was computed above. */
+
+ else
+ code[-ketoffset] = OP_KETRMAX + repeatType;
+ }
+
+ // A quantifier after an assertion is mostly meaningless, but it
+ // can nullify the assertion if it has a 0 minimum.
+ else if (*previous == OP_ASSERT || *previous == OP_ASSERT_NOT) {
+ if (repeatMin == 0) {
+ code = previous;
+ goto END_REPEAT;
+ }
+ }
+
+ /* Else there's some kind of shambles */
+
+ else {
+ *errorCodePtr = ERR11;
+ goto FAILED;
+ }
+
+ /* In all case we no longer have a previous item. We also set the
+ "follows varying string" flag for subsequently encountered reqbytes if
+ it isn't already set and we have just passed a varying length item. */
+
+ END_REPEAT:
+ previous = NULL;
+ cd.reqVaryOpt |= reqvary;
+ break;
+
+ /* Start of nested bracket sub-expression, or comment or lookahead or
+ lookbehind or option setting or condition. First deal with special things
+ that can come after a bracket; all are introduced by ?, and the appearance
+ of any of them means that this is not a referencing group. They were
+ checked for validity in the first pass over the string, so we don't have to
+ check for syntax errors here. */
+
+ case '(':
+ skipBytes = 0;
+
+ if (*(++ptr) == '?') {
+ switch (*(++ptr)) {
+ case ':': /* Non-extracting bracket */
+ bravalue = OP_BRA;
+ ptr++;
+ break;
+
+ case '=': /* Positive lookahead */
+ bravalue = OP_ASSERT;
+ ptr++;
+ break;
+
+ case '!': /* Negative lookahead */
+ bravalue = OP_ASSERT_NOT;
+ ptr++;
+ break;
+
+ /* Character after (? not specially recognized */
+
+ default:
+ *errorCodePtr = ERR12;
+ goto FAILED;
+ }
+ }
+
+ /* Else we have a referencing group; adjust the opcode. If the bracket
+ number is greater than EXTRACT_BASIC_MAX, we set the opcode one higher, and
+ arrange for the true number to follow later, in an OP_BRANUMBER item. */
+
+ else {
+ if (++(*brackets) > EXTRACT_BASIC_MAX) {
+ bravalue = OP_BRA + EXTRACT_BASIC_MAX + 1;
+ code[1 + LINK_SIZE] = OP_BRANUMBER;
+ put2ByteValue(code + 2 + LINK_SIZE, *brackets);
+ skipBytes = 3;
+ }
+ else
+ bravalue = OP_BRA + *brackets;
+ }
+
+ /* Process nested bracketed re. We copy code into a non-variable
+ in order to be able to pass its address because some compilers
+ complain otherwise. Pass in a new setting for the ims options
+ if they have changed. */
+
+ previous = code;
+ *code = bravalue;
+ tempcode = code;
+ tempreqvary = cd.reqVaryOpt; /* Save value before bracket */
+
+ if (!compileBracket(
+ options,
+ brackets, /* Extracting bracket count */
+ &tempcode, /* Where to put code (updated) */
+ &ptr, /* Input pointer (updated) */
+ patternEnd,
+ errorCodePtr, /* Where to put an error message */
+ skipBytes, /* Skip over OP_BRANUMBER */
+ &subFirstByte, /* For possible first char */
+ &subReqByte, /* For possible last char */
+ cd)) /* Tables block */
+ goto FAILED;
+
+ /* At the end of compiling, code is still pointing to the start of the
+ group, while tempcode has been updated to point past the end of the group
+ and any option resetting that may follow it. The pattern pointer (ptr)
+ is on the bracket. */
+
+ /* Handle updating of the required and first characters. Update for normal
+ brackets of all kinds, and conditions with two branches (see code above).
+ If the bracket is followed by a quantifier with zero repeat, we have to
+ back off. Hence the definition of zeroReqByte and zeroFirstByte outside the
+ main loop so that they can be accessed for the back off. */
+
+ zeroReqByte = reqByte;
+ zeroFirstByte = firstByte;
+ didGroupSetFirstByte = false;
+
+ if (bravalue >= OP_BRA) {
+ /* If we have not yet set a firstByte in this branch, take it from the
+ subpattern, remembering that it was set here so that a repeat of more
+ than one can replicate it as reqByte if necessary. If the subpattern has
+ no firstByte, set "none" for the whole branch. In both cases, a zero
+ repeat forces firstByte to "none". */
+
+ if (firstByte == REQ_UNSET) {
+ if (subFirstByte >= 0) {
+ firstByte = subFirstByte;
+ didGroupSetFirstByte = true;
+ }
+ else
+ firstByte = REQ_NONE;
+ zeroFirstByte = REQ_NONE;
+ }
+
+ /* If firstByte was previously set, convert the subpattern's firstByte
+ into reqByte if there wasn't one, using the vary flag that was in
+ existence beforehand. */
+
+ else if (subFirstByte >= 0 && subReqByte < 0)
+ subReqByte = subFirstByte | tempreqvary;
+
+ /* If the subpattern set a required byte (or set a first byte that isn't
+ really the first byte - see above), set it. */
+
+ if (subReqByte >= 0)
+ reqByte = subReqByte;
+ }
+
+ /* For a forward assertion, we take the reqByte, if set. This can be
+ helpful if the pattern that follows the assertion doesn't set a different
+ char. For example, it's useful for /(?=abcde).+/. We can't set firstByte
+ for an assertion, however because it leads to incorrect effect for patterns
+ such as /(?=a)a.+/ when the "real" "a" would then become a reqByte instead
+ of a firstByte. This is overcome by a scan at the end if there's no
+ firstByte, looking for an asserted first char. */
+
+ else if (bravalue == OP_ASSERT && subReqByte >= 0)
+ reqByte = subReqByte;
+
+ /* Now update the main code pointer to the end of the group. */
+
+ code = tempcode;
+
+ /* Error if hit end of pattern */
+
+ if (ptr >= patternEnd || *ptr != ')') {
+ *errorCodePtr = ERR14;
+ goto FAILED;
+ }
+ break;
+
+ /* Check \ for being a real metacharacter; if not, fall through and handle
+ it as a data character at the start of a string. Escape items are checked
+ for validity in the pre-compiling pass. */
+
+ case '\\':
+ tempptr = ptr;
+ c = checkEscape(&ptr, patternEnd, errorCodePtr, cd.numCapturingBrackets, false);
+
+ /* Handle metacharacters introduced by \. For ones like \d, the ESC_ values
+ are arranged to be the negation of the corresponding OP_values. For the
+ back references, the values are ESC_REF plus the reference number. Only
+ back references and those types that consume a character may be repeated.
+ We can test for values between ESC_b and ESC_w for the latter; this may
+ have to change if any new ones are ever created. */
+
+ if (c < 0) {
+ /* For metasequences that actually match a character, we disable the
+ setting of a first character if it hasn't already been set. */
+
+ if (firstByte == REQ_UNSET && -c > ESC_b && -c <= ESC_w)
+ firstByte = REQ_NONE;
+
+ /* Set values to reset to if this is followed by a zero repeat. */
+
+ zeroFirstByte = firstByte;
+ zeroReqByte = reqByte;
+
+ /* Back references are handled specially */
+
+ if (-c >= ESC_REF) {
+ int number = -c - ESC_REF;
+ previous = code;
+ *code++ = OP_REF;
+ put2ByteValueAndAdvance(code, number);
+ }
+
+ /* For the rest, we can obtain the OP value by negating the escape
+ value */
+
+ else {
+ previous = (-c > ESC_b && -c <= ESC_w) ? code : NULL;
+ *code++ = -c;
+ }
+ continue;
+ }
+
+ /* Fall through. */
+
+ /* Handle a literal character. It is guaranteed not to be whitespace or #
+ when the extended flag is set. If we are in UTF-8 mode, it may be a
+ multi-byte literal character. */
+
+ default:
+ NORMAL_CHAR:
+
+ previous = code;
+
+ if (c < 128) {
+ mcLength = 1;
+ mcbuffer[0] = c;
+
+ if ((options & IgnoreCaseOption) && (c | 0x20) >= 'a' && (c | 0x20) <= 'z') {
+ *code++ = OP_ASCII_LETTER_IGNORING_CASE;
+ *code++ = c | 0x20;
+ } else {
+ *code++ = OP_ASCII_CHAR;
+ *code++ = c;
+ }
+ } else {
+ mcLength = encodeUTF8(c, mcbuffer);
+
+ *code++ = (options & IgnoreCaseOption) ? OP_CHAR_IGNORING_CASE : OP_CHAR;
+ for (c = 0; c < mcLength; c++)
+ *code++ = mcbuffer[c];
+ }
+
+ /* Set the first and required bytes appropriately. If no previous first
+ byte, set it from this character, but revert to none on a zero repeat.
+ Otherwise, leave the firstByte value alone, and don't change it on a zero
+ repeat. */
+
+ if (firstByte == REQ_UNSET) {
+ zeroFirstByte = REQ_NONE;
+ zeroReqByte = reqByte;
+
+ /* If the character is more than one byte long, we can set firstByte
+ only if it is not to be matched caselessly. */
+
+ if (mcLength == 1 || reqCaseOpt == 0) {
+ firstByte = mcbuffer[0] | reqCaseOpt;
+ if (mcLength != 1)
+ reqByte = code[-1] | cd.reqVaryOpt;
+ }
+ else
+ firstByte = reqByte = REQ_NONE;
+ }
+
+ /* firstByte was previously set; we can set reqByte only the length is
+ 1 or the matching is caseful. */
+
+ else {
+ zeroFirstByte = firstByte;
+ zeroReqByte = reqByte;
+ if (mcLength == 1 || reqCaseOpt == 0)
+ reqByte = code[-1] | reqCaseOpt | cd.reqVaryOpt;
+ }
+
+ break; /* End of literal character handling */
+ }
+ } /* end of big loop */
+
+ /* Control never reaches here by falling through, only by a goto for all the
+ error states. Pass back the position in the pattern so that it can be displayed
+ to the user for diagnosing the error. */
+
+FAILED:
+ *ptrPtr = ptr;
+ return false;
+}
+
+/*************************************************
+* Compile sequence of alternatives *
+*************************************************/
+
+/* On entry, ptr is pointing past the bracket character, but on return
+it points to the closing bracket, or vertical bar, or end of string.
+The code variable is pointing at the byte into which the BRA operator has been
+stored. If the ims options are changed at the start (for a (?ims: group) or
+during any branch, we need to insert an OP_OPT item at the start of every
+following branch to ensure they get set correctly at run time, and also pass
+the new options into every subsequent branch compile.
+
+Argument:
+ options option bits, including any changes for this subpattern
+ brackets -> int containing the number of extracting brackets used
+ codePtr -> the address of the current code pointer
+ ptrPtr -> the address of the current pattern pointer
+ errorCodePtr -> pointer to error code variable
+ skipBytes skip this many bytes at start (for OP_BRANUMBER)
+ firstbyteptr place to put the first required character, or a negative number
+ reqbyteptr place to put the last required character, or a negative number
+ cd points to the data block with tables pointers etc.
+
+Returns: true on success
+*/
+
+static bool
+compileBracket(int options, int* brackets, unsigned char** codePtr,
+ const UChar** ptrPtr, const UChar* patternEnd, ErrorCode* errorCodePtr, int skipBytes,
+ int* firstbyteptr, int* reqbyteptr, CompileData& cd)
+{
+ const UChar* ptr = *ptrPtr;
+ unsigned char* code = *codePtr;
+ unsigned char* lastBranch = code;
+ unsigned char* start_bracket = code;
+ int firstByte = REQ_UNSET;
+ int reqByte = REQ_UNSET;
+
+ /* Offset is set zero to mark that this bracket is still open */
+
+ putLinkValueAllowZero(code + 1, 0);
+ code += 1 + LINK_SIZE + skipBytes;
+
+ /* Loop for each alternative branch */
+
+ while (true) {
+ /* Now compile the branch */
+
+ int branchFirstByte;
+ int branchReqByte;
+ if (!compileBranch(options, brackets, &code, &ptr, patternEnd, errorCodePtr,
+ &branchFirstByte, &branchReqByte, cd)) {
+ *ptrPtr = ptr;
+ return false;
+ }
+
+ /* If this is the first branch, the firstByte and reqByte values for the
+ branch become the values for the regex. */
+
+ if (*lastBranch != OP_ALT) {
+ firstByte = branchFirstByte;
+ reqByte = branchReqByte;
+ }
+
+ /* If this is not the first branch, the first char and reqByte have to
+ match the values from all the previous branches, except that if the previous
+ value for reqByte didn't have REQ_VARY set, it can still match, and we set
+ REQ_VARY for the regex. */
+
+ else {
+ /* If we previously had a firstByte, but it doesn't match the new branch,
+ we have to abandon the firstByte for the regex, but if there was previously
+ no reqByte, it takes on the value of the old firstByte. */
+
+ if (firstByte >= 0 && firstByte != branchFirstByte) {
+ if (reqByte < 0)
+ reqByte = firstByte;
+ firstByte = REQ_NONE;
+ }
+
+ /* If we (now or from before) have no firstByte, a firstByte from the
+ branch becomes a reqByte if there isn't a branch reqByte. */
+
+ if (firstByte < 0 && branchFirstByte >= 0 && branchReqByte < 0)
+ branchReqByte = branchFirstByte;
+
+ /* Now ensure that the reqbytes match */
+
+ if ((reqByte & ~REQ_VARY) != (branchReqByte & ~REQ_VARY))
+ reqByte = REQ_NONE;
+ else
+ reqByte |= branchReqByte; /* To "or" REQ_VARY */
+ }
+
+ /* Reached end of expression, either ')' or end of pattern. Go back through
+ the alternative branches and reverse the chain of offsets, with the field in
+ the BRA item now becoming an offset to the first alternative. If there are
+ no alternatives, it points to the end of the group. The length in the
+ terminating ket is always the length of the whole bracketed item. If any of
+ the ims options were changed inside the group, compile a resetting op-code
+ following, except at the very end of the pattern. Return leaving the pointer
+ at the terminating char. */
+
+ if (ptr >= patternEnd || *ptr != '|') {
+ int length = code - lastBranch;
+ do {
+ int prevLength = getLinkValueAllowZero(lastBranch + 1);
+ putLinkValue(lastBranch + 1, length);
+ length = prevLength;
+ lastBranch -= length;
+ } while (length > 0);
+
+ /* Fill in the ket */
+
+ *code = OP_KET;
+ putLinkValue(code + 1, code - start_bracket);
+ code += 1 + LINK_SIZE;
+
+ /* Set values to pass back */
+
+ *codePtr = code;
+ *ptrPtr = ptr;
+ *firstbyteptr = firstByte;
+ *reqbyteptr = reqByte;
+ return true;
+ }
+
+ /* Another branch follows; insert an "or" node. Its length field points back
+ to the previous branch while the bracket remains open. At the end the chain
+ is reversed. It's done like this so that the start of the bracket has a
+ zero offset until it is closed, making it possible to detect recursion. */
+
+ *code = OP_ALT;
+ putLinkValue(code + 1, code - lastBranch);
+ lastBranch = code;
+ code += 1 + LINK_SIZE;
+ ptr++;
+ }
+ ASSERT_NOT_REACHED();
+}
+
+/*************************************************
+* Check for anchored expression *
+*************************************************/
+
+/* Try to find out if this is an anchored regular expression. Consider each
+alternative branch. If they all start OP_CIRC, or with a bracket
+all of whose alternatives start OP_CIRC (recurse ad lib), then
+it's anchored.
+
+Arguments:
+ code points to start of expression (the bracket)
+ captureMap a bitmap of which brackets we are inside while testing; this
+ handles up to substring 31; all brackets after that share
+ the zero bit
+ backrefMap the back reference bitmap
+*/
+
+static bool branchIsAnchored(const unsigned char* code)
+{
+ const unsigned char* scode = firstSignificantOpcode(code);
+ int op = *scode;
+
+ /* Brackets */
+ if (op >= OP_BRA || op == OP_ASSERT)
+ return bracketIsAnchored(scode);
+
+ /* Check for explicit anchoring */
+ return op == OP_CIRC;
+}
+
+static bool bracketIsAnchored(const unsigned char* code)
+{
+ do {
+ if (!branchIsAnchored(code + 1 + LINK_SIZE))
+ return false;
+ code += getLinkValue(code + 1);
+ } while (*code == OP_ALT); /* Loop for each alternative */
+ return true;
+}
+
+/*************************************************
+* Check for starting with ^ or .* *
+*************************************************/
+
+/* This is called to find out if every branch starts with ^ or .* so that
+"first char" processing can be done to speed things up in multiline
+matching and for non-DOTALL patterns that start with .* (which must start at
+the beginning or after \n)
+
+Except when the .* appears inside capturing parentheses, and there is a
+subsequent back reference to those parentheses. By keeping a bitmap of the
+first 31 back references, we can catch some of the more common cases more
+precisely; all the greater back references share a single bit.
+
+Arguments:
+ code points to start of expression (the bracket)
+ captureMap a bitmap of which brackets we are inside while testing; this
+ handles up to substring 31; all brackets after that share
+ the zero bit
+ backrefMap the back reference bitmap
+*/
+
+static bool branchNeedsLineStart(const unsigned char* code, unsigned captureMap, unsigned backrefMap)
+{
+ const unsigned char* scode = firstSignificantOpcode(code);
+ int op = *scode;
+
+ /* Capturing brackets */
+ if (op > OP_BRA) {
+ int captureNum = op - OP_BRA;
+ if (captureNum > EXTRACT_BASIC_MAX)
+ captureNum = get2ByteValue(scode + 2 + LINK_SIZE);
+ int bracketMask = (captureNum < 32) ? (1 << captureNum) : 1;
+ return bracketNeedsLineStart(scode, captureMap | bracketMask, backrefMap);
+ }
+
+ /* Other brackets */
+ if (op == OP_BRA || op == OP_ASSERT)
+ return bracketNeedsLineStart(scode, captureMap, backrefMap);
+
+ /* .* means "start at start or after \n" if it isn't in brackets that
+ may be referenced. */
+
+ if (op == OP_TYPESTAR || op == OP_TYPEMINSTAR)
+ return scode[1] == OP_NOT_NEWLINE && !(captureMap & backrefMap);
+
+ /* Explicit ^ */
+ return op == OP_CIRC || op == OP_BOL;
+}
+
+static bool bracketNeedsLineStart(const unsigned char* code, unsigned captureMap, unsigned backrefMap)
+{
+ do {
+ if (!branchNeedsLineStart(code + 1 + LINK_SIZE, captureMap, backrefMap))
+ return false;
+ code += getLinkValue(code + 1);
+ } while (*code == OP_ALT); /* Loop for each alternative */
+ return true;
+}
+
+/*************************************************
+* Check for asserted fixed first char *
+*************************************************/
+
+/* During compilation, the "first char" settings from forward assertions are
+discarded, because they can cause conflicts with actual literals that follow.
+However, if we end up without a first char setting for an unanchored pattern,
+it is worth scanning the regex to see if there is an initial asserted first
+char. If all branches start with the same asserted char, or with a bracket all
+of whose alternatives start with the same asserted char (recurse ad lib), then
+we return that char, otherwise -1.
+
+Arguments:
+ code points to start of expression (the bracket)
+ options pointer to the options (used to check casing changes)
+ inassert true if in an assertion
+
+Returns: -1 or the fixed first char
+*/
+
+static int branchFindFirstAssertedCharacter(const unsigned char* code, bool inassert)
+{
+ const unsigned char* scode = firstSignificantOpcodeSkippingAssertions(code);
+ int op = *scode;
+
+ if (op >= OP_BRA)
+ op = OP_BRA;
+
+ switch (op) {
+ default:
+ return -1;
+
+ case OP_BRA:
+ case OP_ASSERT:
+ return bracketFindFirstAssertedCharacter(scode, op == OP_ASSERT);
+
+ case OP_EXACT:
+ scode += 2;
+ /* Fall through */
+
+ case OP_CHAR:
+ case OP_CHAR_IGNORING_CASE:
+ case OP_ASCII_CHAR:
+ case OP_ASCII_LETTER_IGNORING_CASE:
+ case OP_PLUS:
+ case OP_MINPLUS:
+ if (!inassert)
+ return -1;
+ return scode[1];
+ }
+}
+
+static int bracketFindFirstAssertedCharacter(const unsigned char* code, bool inassert)
+{
+ int c = -1;
+ do {
+ int d = branchFindFirstAssertedCharacter(code + 1 + LINK_SIZE, inassert);
+ if (d < 0)
+ return -1;
+ if (c < 0)
+ c = d;
+ else if (c != d)
+ return -1;
+ code += getLinkValue(code + 1);
+ } while (*code == OP_ALT);
+ return c;
+}
+
+static inline int multiplyWithOverflowCheck(int a, int b)
+{
+ if (!a || !b)
+ return 0;
+ if (a > MAX_PATTERN_SIZE / b)
+ return -1;
+ return a * b;
+}
+
+static int calculateCompiledPatternLength(const UChar* pattern, int patternLength, JSRegExpIgnoreCaseOption ignoreCase,
+ CompileData& cd, ErrorCode& errorcode)
+{
+ /* Make a pass over the pattern to compute the
+ amount of store required to hold the compiled code. This does not have to be
+ perfect as long as errors are overestimates. */
+
+ if (patternLength > MAX_PATTERN_SIZE) {
+ errorcode = ERR16;
+ return -1;
+ }
+
+ int length = 1 + LINK_SIZE; /* For initial BRA plus length */
+ int branch_extra = 0;
+ int lastitemlength = 0;
+ unsigned brastackptr = 0;
+ FixedArray<int, BRASTACK_SIZE> brastack;
+ FixedArray<unsigned char, BRASTACK_SIZE> bralenstack;
+ int bracount = 0;
+
+ const UChar* ptr = (const UChar*)(pattern - 1);
+ const UChar* patternEnd = (const UChar*)(pattern + patternLength);
+
+ while (++ptr < patternEnd) {
+ int minRepeats = 0, maxRepeats = 0;
+ int c = *ptr;
+
+ switch (c) {
+ /* A backslashed item may be an escaped data character or it may be a
+ character type. */
+
+ case '\\':
+ c = checkEscape(&ptr, patternEnd, &errorcode, cd.numCapturingBrackets, false);
+ if (errorcode != 0)
+ return -1;
+
+ lastitemlength = 1; /* Default length of last item for repeats */
+
+ if (c >= 0) { /* Data character */
+ length += 2; /* For a one-byte character */
+
+ if (c > 127) {
+ int i;
+ for (i = 0; i < jsc_pcre_utf8_table1_size; i++)
+ if (c <= jsc_pcre_utf8_table1[i]) break;
+ length += i;
+ lastitemlength += i;
+ }
+
+ continue;
+ }
+
+ /* Other escapes need one byte */
+
+ length++;
+
+ /* A back reference needs an additional 2 bytes, plus either one or 5
+ bytes for a repeat. We also need to keep the value of the highest
+ back reference. */
+
+ if (c <= -ESC_REF) {
+ int refnum = -c - ESC_REF;
+ cd.backrefMap |= (refnum < 32) ? (1 << refnum) : 1;
+ if (refnum > cd.topBackref)
+ cd.topBackref = refnum;
+ length += 2; /* For single back reference */
+ if (safelyCheckNextChar(ptr, patternEnd, '{') && isCountedRepeat(ptr + 2, patternEnd)) {
+ ptr = readRepeatCounts(ptr + 2, &minRepeats, &maxRepeats, &errorcode);
+ if (errorcode)
+ return -1;
+ if ((minRepeats == 0 && (maxRepeats == 1 || maxRepeats == -1)) ||
+ (minRepeats == 1 && maxRepeats == -1))
+ length++;
+ else
+ length += 5;
+ if (safelyCheckNextChar(ptr, patternEnd, '?'))
+ ptr++;
+ }
+ }
+ continue;
+
+ case '^': /* Single-byte metacharacters */
+ case '.':
+ case '$':
+ length++;
+ lastitemlength = 1;
+ continue;
+
+ case '*': /* These repeats won't be after brackets; */
+ case '+': /* those are handled separately */
+ case '?':
+ length++;
+ goto POSSESSIVE;
+
+ /* This covers the cases of braced repeats after a single char, metachar,
+ class, or back reference. */
+
+ case '{':
+ if (!isCountedRepeat(ptr + 1, patternEnd))
+ goto NORMAL_CHAR;
+ ptr = readRepeatCounts(ptr + 1, &minRepeats, &maxRepeats, &errorcode);
+ if (errorcode != 0)
+ return -1;
+
+ /* These special cases just insert one extra opcode */
+
+ if ((minRepeats == 0 && (maxRepeats == 1 || maxRepeats == -1)) ||
+ (minRepeats == 1 && maxRepeats == -1))
+ length++;
+
+ /* These cases might insert additional copies of a preceding character. */
+
+ else {
+ if (minRepeats != 1) {
+ length -= lastitemlength; /* Uncount the original char or metachar */
+ if (minRepeats > 0)
+ length += 3 + lastitemlength;
+ }
+ length += lastitemlength + ((maxRepeats > 0) ? 3 : 1);
+ }
+
+ if (safelyCheckNextChar(ptr, patternEnd, '?'))
+ ptr++; /* Needs no extra length */
+
+ POSSESSIVE: /* Test for possessive quantifier */
+ if (safelyCheckNextChar(ptr, patternEnd, '+')) {
+ ptr++;
+ length += 2 + 2 * LINK_SIZE; /* Allow for atomic brackets */
+ }
+ continue;
+
+ /* An alternation contains an offset to the next branch or ket. If any ims
+ options changed in the previous branch(es), and/or if we are in a
+ lookbehind assertion, extra space will be needed at the start of the
+ branch. This is handled by branch_extra. */
+
+ case '|':
+ if (brastackptr == 0)
+ cd.needOuterBracket = true;
+ length += 1 + LINK_SIZE + branch_extra;
+ continue;
+
+ /* A character class uses 33 characters provided that all the character
+ values are less than 256. Otherwise, it uses a bit map for low valued
+ characters, and individual items for others. Don't worry about character
+ types that aren't allowed in classes - they'll get picked up during the
+ compile. A character class that contains only one single-byte character
+ uses 2 or 3 bytes, depending on whether it is negated or not. Notice this
+ where we can. (In UTF-8 mode we can do this only for chars < 128.) */
+
+ case '[': {
+ int class_optcount;
+ if (*(++ptr) == '^') {
+ class_optcount = 10; /* Greater than one */
+ ptr++;
+ }
+ else
+ class_optcount = 0;
+
+ bool class_utf8 = false;
+
+ for (; ptr < patternEnd && *ptr != ']'; ++ptr) {
+ /* Check for escapes */
+
+ if (*ptr == '\\') {
+ c = checkEscape(&ptr, patternEnd, &errorcode, cd.numCapturingBrackets, true);
+ if (errorcode != 0)
+ return -1;
+
+ /* Handle escapes that turn into characters */
+
+ if (c >= 0)
+ goto NON_SPECIAL_CHARACTER;
+
+ /* Escapes that are meta-things. The normal ones just affect the
+ bit map, but Unicode properties require an XCLASS extended item. */
+
+ else
+ class_optcount = 10; /* \d, \s etc; make sure > 1 */
+ }
+
+ /* Anything else increments the possible optimization count. We have to
+ detect ranges here so that we can compute the number of extra ranges for
+ caseless wide characters when UCP support is available. If there are wide
+ characters, we are going to have to use an XCLASS, even for single
+ characters. */
+
+ else {
+ c = *ptr;
+
+ /* Come here from handling \ above when it escapes to a char value */
+
+ NON_SPECIAL_CHARACTER:
+ class_optcount++;
+
+ int d = -1;
+ if (safelyCheckNextChar(ptr, patternEnd, '-')) {
+ const UChar* hyptr = ptr++;
+ if (safelyCheckNextChar(ptr, patternEnd, '\\')) {
+ ptr++;
+ d = checkEscape(&ptr, patternEnd, &errorcode, cd.numCapturingBrackets, true);
+ if (errorcode != 0)
+ return -1;
+ }
+ else if ((ptr + 1 < patternEnd) && ptr[1] != ']')
+ d = *++ptr;
+ if (d < 0)
+ ptr = hyptr; /* go back to hyphen as data */
+ }
+
+ /* If d >= 0 we have a range. In UTF-8 mode, if the end is > 255, or >
+ 127 for caseless matching, we will need to use an XCLASS. */
+
+ if (d >= 0) {
+ class_optcount = 10; /* Ensure > 1 */
+ if (d < c) {
+ errorcode = ERR8;
+ return -1;
+ }
+
+ if ((d > 255 || (ignoreCase && d > 127))) {
+ unsigned char buffer[6];
+ if (!class_utf8) /* Allow for XCLASS overhead */
+ {
+ class_utf8 = true;
+ length += LINK_SIZE + 2;
+ }
+
+ /* If we have UCP support, find out how many extra ranges are
+ needed to map the other case of characters within this range. We
+ have to mimic the range optimization here, because extending the
+ range upwards might push d over a boundary that makes it use
+ another byte in the UTF-8 representation. */
+
+ if (ignoreCase) {
+ int occ, ocd;
+ int cc = c;
+ int origd = d;
+ while (getOthercaseRange(&cc, origd, &occ, &ocd)) {
+ if (occ >= c && ocd <= d)
+ continue; /* Skip embedded */
+
+ if (occ < c && ocd >= c - 1) /* Extend the basic range */
+ { /* if there is overlap, */
+ c = occ; /* noting that if occ < c */
+ continue; /* we can't have ocd > d */
+ } /* because a subrange is */
+ if (ocd > d && occ <= d + 1) /* always shorter than */
+ { /* the basic range. */
+ d = ocd;
+ continue;
+ }
+
+ /* An extra item is needed */
+
+ length += 1 + encodeUTF8(occ, buffer) +
+ ((occ == ocd) ? 0 : encodeUTF8(ocd, buffer));
+ }
+ }
+
+ /* The length of the (possibly extended) range */
+
+ length += 1 + encodeUTF8(c, buffer) + encodeUTF8(d, buffer);
+ }
+
+ }
+
+ /* We have a single character. There is nothing to be done unless we
+ are in UTF-8 mode. If the char is > 255, or 127 when caseless, we must
+ allow for an XCL_SINGLE item, doubled for caselessness if there is UCP
+ support. */
+
+ else {
+ if ((c > 255 || (ignoreCase && c > 127))) {
+ unsigned char buffer[6];
+ class_optcount = 10; /* Ensure > 1 */
+ if (!class_utf8) /* Allow for XCLASS overhead */
+ {
+ class_utf8 = true;
+ length += LINK_SIZE + 2;
+ }
+ length += (ignoreCase ? 2 : 1) * (1 + encodeUTF8(c, buffer));
+ }
+ }
+ }
+ }
+
+ if (ptr >= patternEnd) { /* Missing terminating ']' */
+ errorcode = ERR6;
+ return -1;
+ }
+
+ /* We can optimize when there was only one optimizable character.
+ Note that this does not detect the case of a negated single character.
+ In that case we do an incorrect length computation, but it's not a serious
+ problem because the computed length is too large rather than too small. */
+
+ if (class_optcount == 1)
+ goto NORMAL_CHAR;
+
+ /* Here, we handle repeats for the class opcodes. */
+ {
+ length += 33;
+
+ /* A repeat needs either 1 or 5 bytes. If it is a possessive quantifier,
+ we also need extra for wrapping the whole thing in a sub-pattern. */
+
+ if (safelyCheckNextChar(ptr, patternEnd, '{') && isCountedRepeat(ptr + 2, patternEnd)) {
+ ptr = readRepeatCounts(ptr + 2, &minRepeats, &maxRepeats, &errorcode);
+ if (errorcode != 0)
+ return -1;
+ if ((minRepeats == 0 && (maxRepeats == 1 || maxRepeats == -1)) ||
+ (minRepeats == 1 && maxRepeats == -1))
+ length++;
+ else
+ length += 5;
+ if (safelyCheckNextChar(ptr, patternEnd, '+')) {
+ ptr++;
+ length += 2 + 2 * LINK_SIZE;
+ } else if (safelyCheckNextChar(ptr, patternEnd, '?'))
+ ptr++;
+ }
+ }
+ continue;
+ }
+
+ /* Brackets may be genuine groups or special things */
+
+ case '(': {
+ int branch_newextra = 0;
+ int bracket_length = 1 + LINK_SIZE;
+ bool capturing = false;
+
+ /* Handle special forms of bracket, which all start (? */
+
+ if (safelyCheckNextChar(ptr, patternEnd, '?')) {
+ switch (c = (ptr + 2 < patternEnd ? ptr[2] : 0)) {
+ /* Non-referencing groups and lookaheads just move the pointer on, and
+ then behave like a non-special bracket, except that they don't increment
+ the count of extracting brackets. Ditto for the "once only" bracket,
+ which is in Perl from version 5.005. */
+
+ case ':':
+ case '=':
+ case '!':
+ ptr += 2;
+ break;
+
+ /* Else loop checking valid options until ) is met. Anything else is an
+ error. If we are without any brackets, i.e. at top level, the settings
+ act as if specified in the options, so massage the options immediately.
+ This is for backward compatibility with Perl 5.004. */
+
+ default:
+ errorcode = ERR12;
+ return -1;
+ }
+ } else
+ capturing = 1;
+
+ /* Capturing brackets must be counted so we can process escapes in a
+ Perlish way. If the number exceeds EXTRACT_BASIC_MAX we are going to need
+ an additional 3 bytes of memory per capturing bracket. */
+
+ if (capturing) {
+ bracount++;
+ if (bracount > EXTRACT_BASIC_MAX)
+ bracket_length += 3;
+ }
+
+ /* Save length for computing whole length at end if there's a repeat that
+ requires duplication of the group. Also save the current value of
+ branch_extra, and start the new group with the new value. If non-zero, this
+ will either be 2 for a (?imsx: group, or 3 for a lookbehind assertion. */
+
+ if (brastackptr >= sizeof(brastack)/sizeof(int)) {
+ errorcode = ERR17;
+ return -1;
+ }
+
+ bralenstack[brastackptr] = branch_extra;
+ branch_extra = branch_newextra;
+
+ brastack[brastackptr++] = length;
+ length += bracket_length;
+ continue;
+ }
+
+ /* Handle ket. Look for subsequent maxRepeats/minRepeats; for certain sets of values we
+ have to replicate this bracket up to that many times. If brastackptr is
+ 0 this is an unmatched bracket which will generate an error, but take care
+ not to try to access brastack[-1] when computing the length and restoring
+ the branch_extra value. */
+
+ case ')': {
+ int duplength;
+ length += 1 + LINK_SIZE;
+ if (brastackptr > 0) {
+ duplength = length - brastack[--brastackptr];
+ branch_extra = bralenstack[brastackptr];
+ }
+ else
+ duplength = 0;
+
+ /* Leave ptr at the final char; for readRepeatCounts this happens
+ automatically; for the others we need an increment. */
+
+ if ((ptr + 1 < patternEnd) && (c = ptr[1]) == '{' && isCountedRepeat(ptr + 2, patternEnd)) {
+ ptr = readRepeatCounts(ptr + 2, &minRepeats, &maxRepeats, &errorcode);
+ if (errorcode)
+ return -1;
+ } else if (c == '*') {
+ minRepeats = 0;
+ maxRepeats = -1;
+ ptr++;
+ } else if (c == '+') {
+ minRepeats = 1;
+ maxRepeats = -1;
+ ptr++;
+ } else if (c == '?') {
+ minRepeats = 0;
+ maxRepeats = 1;
+ ptr++;
+ } else {
+ minRepeats = 1;
+ maxRepeats = 1;
+ }
+
+ /* If the minimum is zero, we have to allow for an OP_BRAZERO before the
+ group, and if the maximum is greater than zero, we have to replicate
+ maxval-1 times; each replication acquires an OP_BRAZERO plus a nesting
+ bracket set. */
+
+ int repeatsLength;
+ if (minRepeats == 0) {
+ length++;
+ if (maxRepeats > 0) {
+ repeatsLength = multiplyWithOverflowCheck(maxRepeats - 1, duplength + 3 + 2 * LINK_SIZE);
+ if (repeatsLength < 0) {
+ errorcode = ERR16;
+ return -1;
+ }
+ length += repeatsLength;
+ if (length > MAX_PATTERN_SIZE) {
+ errorcode = ERR16;
+ return -1;
+ }
+ }
+ }
+
+ /* When the minimum is greater than zero, we have to replicate up to
+ minval-1 times, with no additions required in the copies. Then, if there
+ is a limited maximum we have to replicate up to maxval-1 times allowing
+ for a BRAZERO item before each optional copy and nesting brackets for all
+ but one of the optional copies. */
+
+ else {
+ repeatsLength = multiplyWithOverflowCheck(minRepeats - 1, duplength);
+ if (repeatsLength < 0) {
+ errorcode = ERR16;
+ return -1;
+ }
+ length += repeatsLength;
+ if (maxRepeats > minRepeats) { /* Need this test as maxRepeats=-1 means no limit */
+ repeatsLength = multiplyWithOverflowCheck(maxRepeats - minRepeats, duplength + 3 + 2 * LINK_SIZE);
+ if (repeatsLength < 0) {
+ errorcode = ERR16;
+ return -1;
+ }
+ length += repeatsLength - (2 + 2 * LINK_SIZE);
+ }
+ if (length > MAX_PATTERN_SIZE) {
+ errorcode = ERR16;
+ return -1;
+ }
+ }
+
+ /* Allow space for once brackets for "possessive quantifier" */
+
+ if (safelyCheckNextChar(ptr, patternEnd, '+')) {
+ ptr++;
+ length += 2 + 2 * LINK_SIZE;
+ }
+ continue;
+ }
+
+ /* Non-special character. It won't be space or # in extended mode, so it is
+ always a genuine character. If we are in a \Q...\E sequence, check for the
+ end; if not, we have a literal. */
+
+ default:
+ NORMAL_CHAR:
+ length += 2; /* For a one-byte character */
+ lastitemlength = 1; /* Default length of last item for repeats */
+
+ if (c > 127) {
+ int i;
+ for (i = 0; i < jsc_pcre_utf8_table1_size; i++)
+ if (c <= jsc_pcre_utf8_table1[i])
+ break;
+ length += i;
+ lastitemlength += i;
+ }
+
+ continue;
+ }
+ }
+
+ length += 2 + LINK_SIZE; /* For final KET and END */
+
+ cd.numCapturingBrackets = bracount;
+ return length;
+}
+
+/*************************************************
+* Compile a Regular Expression *
+*************************************************/
+
+/* This function takes a string and returns a pointer to a block of store
+holding a compiled version of the expression. The original API for this
+function had no error code return variable; it is retained for backwards
+compatibility. The new function is given a new name.
+
+Arguments:
+ pattern the regular expression
+ options various option bits
+ errorCodePtr pointer to error code variable (pcre_compile2() only)
+ can be NULL if you don't want a code value
+ errorPtr pointer to pointer to error text
+ erroroffset ptr offset in pattern where error was detected
+ tables pointer to character tables or NULL
+
+Returns: pointer to compiled data block, or NULL on error,
+ with errorPtr and erroroffset set
+*/
+
+static inline JSRegExp* returnError(ErrorCode errorcode, const char** errorPtr)
+{
+ *errorPtr = errorText(errorcode);
+ return 0;
+}
+
+JSRegExp* jsRegExpCompile(const UChar* pattern, int patternLength,
+ JSRegExpIgnoreCaseOption ignoreCase, JSRegExpMultilineOption multiline,
+ unsigned* numSubpatterns, const char** errorPtr)
+{
+ /* We can't pass back an error message if errorPtr is NULL; I guess the best we
+ can do is just return NULL, but we can set a code value if there is a code pointer. */
+ if (!errorPtr)
+ return 0;
+ *errorPtr = NULL;
+
+ CompileData cd;
+
+ ErrorCode errorcode = ERR0;
+ /* Call this once just to count the brackets. */
+ calculateCompiledPatternLength(pattern, patternLength, ignoreCase, cd, errorcode);
+ /* Call it again to compute the length. */
+ int length = calculateCompiledPatternLength(pattern, patternLength, ignoreCase, cd, errorcode);
+ if (errorcode)
+ return returnError(errorcode, errorPtr);
+
+ if (length > MAX_PATTERN_SIZE)
+ return returnError(ERR16, errorPtr);
+
+ size_t size = length + sizeof(JSRegExp);
+#if REGEXP_HISTOGRAM
+ size_t stringOffset = (size + sizeof(UChar) - 1) / sizeof(UChar) * sizeof(UChar);
+ size = stringOffset + patternLength * sizeof(UChar);
+#endif
+ JSRegExp* re = reinterpret_cast_ptr<JSRegExp*>(new char[size]);
+
+ if (!re)
+ return returnError(ERR13, errorPtr);
+
+ re->options = (ignoreCase ? IgnoreCaseOption : 0) | (multiline ? MatchAcrossMultipleLinesOption : 0);
+
+ /* The starting points of the name/number translation table and of the code are
+ passed around in the compile data block. */
+
+ const unsigned char* codeStart = (const unsigned char*)(re + 1);
+
+ /* Set up a starting, non-extracting bracket, then compile the expression. On
+ error, errorcode will be set non-zero, so we don't need to look at the result
+ of the function here. */
+
+ const UChar* ptr = (const UChar*)pattern;
+ const UChar* patternEnd = pattern + patternLength;
+ unsigned char* code = const_cast<unsigned char*>(codeStart);
+ int firstByte, reqByte;
+ int bracketCount = 0;
+ if (!cd.needOuterBracket)
+ compileBranch(re->options, &bracketCount, &code, &ptr, patternEnd, &errorcode, &firstByte, &reqByte, cd);
+ else {
+ *code = OP_BRA;
+ compileBracket(re->options, &bracketCount, &code, &ptr, patternEnd, &errorcode, 0, &firstByte, &reqByte, cd);
+ }
+ re->topBracket = bracketCount;
+ re->topBackref = cd.topBackref;
+
+ /* If not reached end of pattern on success, there's an excess bracket. */
+
+ if (errorcode == 0 && ptr < patternEnd)
+ errorcode = ERR10;
+
+ /* Fill in the terminating state and check for disastrous overflow, but
+ if debugging, leave the test till after things are printed out. */
+
+ *code++ = OP_END;
+
+ ASSERT(code - codeStart <= length);
+ if (code - codeStart > length)
+ errorcode = ERR7;
+
+ /* Give an error if there's back reference to a non-existent capturing
+ subpattern. */
+
+ if (re->topBackref > re->topBracket)
+ errorcode = ERR15;
+
+ /* Failed to compile, or error while post-processing */
+
+ if (errorcode != ERR0) {
+ delete [] reinterpret_cast<char*>(re);
+ return returnError(errorcode, errorPtr);
+ }
+
+ /* If the anchored option was not passed, set the flag if we can determine that
+ the pattern is anchored by virtue of ^ characters or \A or anything else (such
+ as starting with .* when DOTALL is set).
+
+ Otherwise, if we know what the first character has to be, save it, because that
+ speeds up unanchored matches no end. If not, see if we can set the
+ UseMultiLineFirstByteOptimizationOption flag. This is helpful for multiline matches when all branches
+ start with ^. and also when all branches start with .* for non-DOTALL matches.
+ */
+
+ if (cd.needOuterBracket ? bracketIsAnchored(codeStart) : branchIsAnchored(codeStart))
+ re->options |= IsAnchoredOption;
+ else {
+ if (firstByte < 0) {
+ firstByte = (cd.needOuterBracket
+ ? bracketFindFirstAssertedCharacter(codeStart, false)
+ : branchFindFirstAssertedCharacter(codeStart, false))
+ | ((re->options & IgnoreCaseOption) ? REQ_IGNORE_CASE : 0);
+ }
+ if (firstByte >= 0) {
+ int ch = firstByte & 255;
+ if (ch < 127) {
+ re->firstByte = ((firstByte & REQ_IGNORE_CASE) && flipCase(ch) == ch) ? ch : firstByte;
+ re->options |= UseFirstByteOptimizationOption;
+ }
+ } else {
+ if (cd.needOuterBracket ? bracketNeedsLineStart(codeStart, 0, cd.backrefMap) : branchNeedsLineStart(codeStart, 0, cd.backrefMap))
+ re->options |= UseMultiLineFirstByteOptimizationOption;
+ }
+ }
+
+ /* For an anchored pattern, we use the "required byte" only if it follows a
+ variable length item in the regex. Remove the caseless flag for non-caseable
+ bytes. */
+
+ if (reqByte >= 0 && (!(re->options & IsAnchoredOption) || (reqByte & REQ_VARY))) {
+ int ch = reqByte & 255;
+ if (ch < 127) {
+ re->reqByte = ((reqByte & REQ_IGNORE_CASE) && flipCase(ch) == ch) ? (reqByte & ~REQ_IGNORE_CASE) : reqByte;
+ re->options |= UseRequiredByteOptimizationOption;
+ }
+ }
+
+#if REGEXP_HISTOGRAM
+ re->stringOffset = stringOffset;
+ re->stringLength = patternLength;
+ memcpy(reinterpret_cast<char*>(re) + stringOffset, pattern, patternLength * 2);
+#endif
+
+ if (numSubpatterns)
+ *numSubpatterns = re->topBracket;
+ return re;
+}
+
+void jsRegExpFree(JSRegExp* re)
+{
+ delete [] reinterpret_cast<char*>(re);
+}
diff --git a/Source/JavaScriptCore/pcre/pcre_exec.cpp b/Source/JavaScriptCore/pcre/pcre_exec.cpp
new file mode 100644
index 0000000..789f80a
--- /dev/null
+++ b/Source/JavaScriptCore/pcre/pcre_exec.cpp
@@ -0,0 +1,2177 @@
+/* This is JavaScriptCore's variant of the PCRE library. While this library
+started out as a copy of PCRE, many of the features of PCRE have been
+removed. This library now supports only the regular expression features
+required by the JavaScript language specification, and has only the functions
+needed by JavaScriptCore and the rest of WebKit.
+
+ Originally written by Philip Hazel
+ Copyright (c) 1997-2006 University of Cambridge
+ Copyright (C) 2002, 2004, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ Copyright (C) 2007 Eric Seidel <eric@webkit.org>
+
+-----------------------------------------------------------------------------
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the name of the University of Cambridge nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+-----------------------------------------------------------------------------
+*/
+
+/* This module contains jsRegExpExecute(), the externally visible function
+that does pattern matching using an NFA algorithm, following the rules from
+the JavaScript specification. There are also some supporting functions. */
+
+#include "config.h"
+#include "pcre_internal.h"
+
+#include <limits.h>
+#include <wtf/ASCIICType.h>
+#include <wtf/Vector.h>
+
+#if REGEXP_HISTOGRAM
+#include <wtf/DateMath.h>
+#include <runtime/UString.h>
+#endif
+
+using namespace WTF;
+
+#if HAVE(COMPUTED_GOTO)
+#define USE_COMPUTED_GOTO_FOR_MATCH_RECURSION
+//#define USE_COMPUTED_GOTO_FOR_MATCH_OPCODE_LOOP
+#endif
+
+/* Avoid warnings on Windows. */
+#undef min
+#undef max
+
+#ifndef USE_COMPUTED_GOTO_FOR_MATCH_RECURSION
+typedef int ReturnLocation;
+#else
+typedef void* ReturnLocation;
+#endif
+
+#if !REGEXP_HISTOGRAM
+
+class HistogramTimeLogger {
+public:
+ HistogramTimeLogger(const JSRegExp*) { }
+};
+
+#else
+
+using namespace JSC;
+
+class Histogram {
+public:
+ ~Histogram();
+ void add(const JSRegExp*, double);
+
+private:
+ typedef HashMap<RefPtr<StringImpl>, double> Map;
+ Map times;
+};
+
+class HistogramTimeLogger {
+public:
+ HistogramTimeLogger(const JSRegExp*);
+ ~HistogramTimeLogger();
+
+private:
+ const JSRegExp* m_re;
+ double m_startTime;
+};
+
+#endif
+
+/* Structure for building a chain of data for holding the values of
+the subject pointer at the start of each bracket, used to detect when
+an empty string has been matched by a bracket to break infinite loops. */
+struct BracketChainNode {
+ BracketChainNode* previousBracket;
+ const UChar* bracketStart;
+};
+
+struct MatchFrame : FastAllocBase {
+ ReturnLocation returnLocation;
+ struct MatchFrame* previousFrame;
+
+ /* Function arguments that may change */
+ struct {
+ const UChar* subjectPtr;
+ const unsigned char* instructionPtr;
+ int offsetTop;
+ BracketChainNode* bracketChain;
+ } args;
+
+
+ /* PCRE uses "fake" recursion built off of gotos, thus
+ stack-based local variables are not safe to use. Instead we have to
+ store local variables on the current MatchFrame. */
+ struct {
+ const unsigned char* data;
+ const unsigned char* startOfRepeatingBracket;
+ const UChar* subjectPtrAtStartOfInstruction; // Several instrutions stash away a subjectPtr here for later compare
+ const unsigned char* instructionPtrAtStartOfOnce;
+
+ int repeatOthercase;
+
+ int ctype;
+ int fc;
+ int fi;
+ int length;
+ int max;
+ int number;
+ int offset;
+ int saveOffset1;
+ int saveOffset2;
+ int saveOffset3;
+
+ BracketChainNode bracketChainNode;
+ } locals;
+};
+
+/* Structure for passing "static" information around between the functions
+doing traditional NFA matching, so that they are thread-safe. */
+
+struct MatchData {
+ int* offsetVector; /* Offset vector */
+ int offsetEnd; /* One past the end */
+ int offsetMax; /* The maximum usable for return data */
+ bool offsetOverflow; /* Set if too many extractions */
+ const UChar* startSubject; /* Start of the subject string */
+ const UChar* endSubject; /* End of the subject string */
+ const UChar* endMatchPtr; /* Subject position at end match */
+ int endOffsetTop; /* Highwater mark at end of match */
+ bool multiline;
+ bool ignoreCase;
+};
+
+/* The maximum remaining length of subject we are prepared to search for a
+reqByte match. */
+
+#define REQ_BYTE_MAX 1000
+
+/* The below limit restricts the number of "recursive" match calls in order to
+avoid spending exponential time on complex regular expressions. */
+
+static const unsigned matchLimit = 1000000;
+
+#ifdef DEBUG
+/*************************************************
+* Debugging function to print chars *
+*************************************************/
+
+/* Print a sequence of chars in printable format, stopping at the end of the
+subject if the requested.
+
+Arguments:
+ p points to characters
+ length number to print
+ isSubject true if printing from within md.startSubject
+ md pointer to matching data block, if isSubject is true
+*/
+
+static void pchars(const UChar* p, int length, bool isSubject, const MatchData& md)
+{
+ if (isSubject && length > md.endSubject - p)
+ length = md.endSubject - p;
+ while (length-- > 0) {
+ int c;
+ if (isASCIIPrintable(c = *(p++)))
+ printf("%c", c);
+ else if (c < 256)
+ printf("\\x%02x", c);
+ else
+ printf("\\x{%x}", c);
+ }
+}
+#endif
+
+/*************************************************
+* Match a back-reference *
+*************************************************/
+
+/* If a back reference hasn't been set, the length that is passed is greater
+than the number of characters left in the string, so the match fails.
+
+Arguments:
+ offset index into the offset vector
+ subjectPtr points into the subject
+ length length to be matched
+ md points to match data block
+
+Returns: true if matched
+*/
+
+static bool matchRef(int offset, const UChar* subjectPtr, int length, const MatchData& md)
+{
+ const UChar* p = md.startSubject + md.offsetVector[offset];
+
+#ifdef DEBUG
+ if (subjectPtr >= md.endSubject)
+ printf("matching subject <null>");
+ else {
+ printf("matching subject ");
+ pchars(subjectPtr, length, true, md);
+ }
+ printf(" against backref ");
+ pchars(p, length, false, md);
+ printf("\n");
+#endif
+
+ /* Always fail if not enough characters left */
+
+ if (length > md.endSubject - subjectPtr)
+ return false;
+
+ /* Separate the caselesss case for speed */
+
+ if (md.ignoreCase) {
+ while (length-- > 0) {
+ UChar c = *p++;
+ int othercase = jsc_pcre_ucp_othercase(c);
+ UChar d = *subjectPtr++;
+ if (c != d && othercase != d)
+ return false;
+ }
+ }
+ else {
+ while (length-- > 0)
+ if (*p++ != *subjectPtr++)
+ return false;
+ }
+
+ return true;
+}
+
+#ifndef USE_COMPUTED_GOTO_FOR_MATCH_RECURSION
+
+/* Use numbered labels and switch statement at the bottom of the match function. */
+
+#define RMATCH_WHERE(num) num
+#define RRETURN_LABEL RRETURN_SWITCH
+
+#else
+
+/* Use GCC's computed goto extension. */
+
+/* For one test case this is more than 40% faster than the switch statement.
+We could avoid the use of the num argument entirely by using local labels,
+but using it for the GCC case as well as the non-GCC case allows us to share
+a bit more code and notice if we use conflicting numbers.*/
+
+#define RMATCH_WHERE(num) &&RRETURN_##num
+#define RRETURN_LABEL *stack.currentFrame->returnLocation
+
+#endif
+
+#define RECURSIVE_MATCH_COMMON(num) \
+ goto RECURSE;\
+ RRETURN_##num: \
+ stack.popCurrentFrame();
+
+#define RECURSIVE_MATCH(num, ra, rb) \
+ do { \
+ stack.pushNewFrame((ra), (rb), RMATCH_WHERE(num)); \
+ RECURSIVE_MATCH_COMMON(num) \
+ } while (0)
+
+#define RECURSIVE_MATCH_NEW_GROUP(num, ra, rb) \
+ do { \
+ stack.pushNewFrame((ra), (rb), RMATCH_WHERE(num)); \
+ startNewGroup(stack.currentFrame); \
+ RECURSIVE_MATCH_COMMON(num) \
+ } while (0)
+
+#define RRETURN goto RRETURN_LABEL
+
+#define RRETURN_NO_MATCH do { isMatch = false; RRETURN; } while (0)
+
+/*************************************************
+* Match from current position *
+*************************************************/
+
+/* On entry instructionPtr points to the first opcode, and subjectPtr to the first character
+in the subject string, while substringStart holds the value of subjectPtr at the start of the
+last bracketed group - used for breaking infinite loops matching zero-length
+strings. This function is called recursively in many circumstances. Whenever it
+returns a negative (error) response, the outer match() call must also return the
+same response.
+
+Arguments:
+ subjectPtr pointer in subject
+ instructionPtr position in code
+ offsetTop current top pointer
+ md pointer to "static" info for the match
+
+Returns: 1 if matched ) these values are >= 0
+ 0 if failed to match )
+ a negative error value if aborted by an error condition
+ (e.g. stopped by repeated call or recursion limit)
+*/
+
+static const unsigned numFramesOnStack = 16;
+
+struct MatchStack {
+ MatchStack()
+ : framesEnd(frames + numFramesOnStack)
+ , currentFrame(frames)
+ , size(1) // match() creates accesses the first frame w/o calling pushNewFrame
+ {
+ ASSERT((sizeof(frames) / sizeof(frames[0])) == numFramesOnStack);
+ }
+
+ MatchFrame frames[numFramesOnStack];
+ MatchFrame* framesEnd;
+ MatchFrame* currentFrame;
+ unsigned size;
+
+ inline bool canUseStackBufferForNextFrame()
+ {
+ return size < numFramesOnStack;
+ }
+
+ inline MatchFrame* allocateNextFrame()
+ {
+ if (canUseStackBufferForNextFrame())
+ return currentFrame + 1;
+ return new MatchFrame;
+ }
+
+ inline void pushNewFrame(const unsigned char* instructionPtr, BracketChainNode* bracketChain, ReturnLocation returnLocation)
+ {
+ MatchFrame* newframe = allocateNextFrame();
+ newframe->previousFrame = currentFrame;
+
+ newframe->args.subjectPtr = currentFrame->args.subjectPtr;
+ newframe->args.offsetTop = currentFrame->args.offsetTop;
+ newframe->args.instructionPtr = instructionPtr;
+ newframe->args.bracketChain = bracketChain;
+ newframe->returnLocation = returnLocation;
+ size++;
+
+ currentFrame = newframe;
+ }
+
+ inline void popCurrentFrame()
+ {
+ MatchFrame* oldFrame = currentFrame;
+ currentFrame = currentFrame->previousFrame;
+ if (size > numFramesOnStack)
+ delete oldFrame;
+ size--;
+ }
+
+ void popAllFrames()
+ {
+ while (size)
+ popCurrentFrame();
+ }
+};
+
+static int matchError(int errorCode, MatchStack& stack)
+{
+ stack.popAllFrames();
+ return errorCode;
+}
+
+/* Get the next UTF-8 character, not advancing the pointer, incrementing length
+ if there are extra bytes. This is called when we know we are in UTF-8 mode. */
+
+static inline void getUTF8CharAndIncrementLength(int& c, const unsigned char* subjectPtr, int& len)
+{
+ c = *subjectPtr;
+ if ((c & 0xc0) == 0xc0) {
+ int gcaa = jsc_pcre_utf8_table4[c & 0x3f]; /* Number of additional bytes */
+ int gcss = 6 * gcaa;
+ c = (c & jsc_pcre_utf8_table3[gcaa]) << gcss;
+ for (int gcii = 1; gcii <= gcaa; gcii++) {
+ gcss -= 6;
+ c |= (subjectPtr[gcii] & 0x3f) << gcss;
+ }
+ len += gcaa;
+ }
+}
+
+static inline void startNewGroup(MatchFrame* currentFrame)
+{
+ /* At the start of a bracketed group, add the current subject pointer to the
+ stack of such pointers, to be re-instated at the end of the group when we hit
+ the closing ket. When match() is called in other circumstances, we don't add to
+ this stack. */
+
+ currentFrame->locals.bracketChainNode.previousBracket = currentFrame->args.bracketChain;
+ currentFrame->locals.bracketChainNode.bracketStart = currentFrame->args.subjectPtr;
+ currentFrame->args.bracketChain = &currentFrame->locals.bracketChainNode;
+}
+
+// FIXME: "minimize" means "not greedy", we should invert the callers to ask for "greedy" to be less confusing
+static inline void repeatInformationFromInstructionOffset(int instructionOffset, bool& minimize, int& minimumRepeats, int& maximumRepeats)
+{
+ // Instruction offsets are based off of OP_CRSTAR, OP_STAR, OP_TYPESTAR, OP_NOTSTAR
+ static const char minimumRepeatsFromInstructionOffset[] = { 0, 0, 1, 1, 0, 0 };
+ static const int maximumRepeatsFromInstructionOffset[] = { INT_MAX, INT_MAX, INT_MAX, INT_MAX, 1, 1 };
+
+ ASSERT(instructionOffset >= 0);
+ ASSERT(instructionOffset <= (OP_CRMINQUERY - OP_CRSTAR));
+
+ minimize = (instructionOffset & 1); // this assumes ordering: Instruction, MinimizeInstruction, Instruction2, MinimizeInstruction2
+ minimumRepeats = minimumRepeatsFromInstructionOffset[instructionOffset];
+ maximumRepeats = maximumRepeatsFromInstructionOffset[instructionOffset];
+}
+
+static int match(const UChar* subjectPtr, const unsigned char* instructionPtr, int offsetTop, MatchData& md)
+{
+ bool isMatch = false;
+ int min;
+ bool minimize = false; /* Initialization not really needed, but some compilers think so. */
+ unsigned remainingMatchCount = matchLimit;
+ int othercase; /* Declare here to avoid errors during jumps */
+
+ MatchStack stack;
+
+ /* The opcode jump table. */
+#ifdef USE_COMPUTED_GOTO_FOR_MATCH_OPCODE_LOOP
+#define EMIT_JUMP_TABLE_ENTRY(opcode) &&LABEL_OP_##opcode,
+ static void* opcodeJumpTable[256] = { FOR_EACH_OPCODE(EMIT_JUMP_TABLE_ENTRY) };
+#undef EMIT_JUMP_TABLE_ENTRY
+#endif
+
+ /* One-time setup of the opcode jump table. */
+#ifdef USE_COMPUTED_GOTO_FOR_MATCH_OPCODE_LOOP
+ for (int i = 255; !opcodeJumpTable[i]; i--)
+ opcodeJumpTable[i] = &&CAPTURING_BRACKET;
+#endif
+
+#ifdef USE_COMPUTED_GOTO_FOR_MATCH_RECURSION
+ // Shark shows this as a hot line
+ // Using a static const here makes this line disappear, but makes later access hotter (not sure why)
+ stack.currentFrame->returnLocation = &&RETURN;
+#else
+ stack.currentFrame->returnLocation = 0;
+#endif
+ stack.currentFrame->args.subjectPtr = subjectPtr;
+ stack.currentFrame->args.instructionPtr = instructionPtr;
+ stack.currentFrame->args.offsetTop = offsetTop;
+ stack.currentFrame->args.bracketChain = 0;
+ startNewGroup(stack.currentFrame);
+
+ /* This is where control jumps back to to effect "recursion" */
+
+RECURSE:
+ if (!--remainingMatchCount)
+ return matchError(JSRegExpErrorHitLimit, stack);
+
+ /* Now start processing the operations. */
+
+#ifndef USE_COMPUTED_GOTO_FOR_MATCH_OPCODE_LOOP
+ while (true)
+#endif
+ {
+
+#ifdef USE_COMPUTED_GOTO_FOR_MATCH_OPCODE_LOOP
+#define BEGIN_OPCODE(opcode) LABEL_OP_##opcode
+#define NEXT_OPCODE goto *opcodeJumpTable[*stack.currentFrame->args.instructionPtr]
+#else
+#define BEGIN_OPCODE(opcode) case OP_##opcode
+#define NEXT_OPCODE continue
+#endif
+
+#ifdef USE_COMPUTED_GOTO_FOR_MATCH_OPCODE_LOOP
+ NEXT_OPCODE;
+#else
+ switch (*stack.currentFrame->args.instructionPtr)
+#endif
+ {
+ /* Non-capturing bracket: optimized */
+
+ BEGIN_OPCODE(BRA):
+ NON_CAPTURING_BRACKET:
+ DPRINTF(("start bracket 0\n"));
+ do {
+ RECURSIVE_MATCH_NEW_GROUP(2, stack.currentFrame->args.instructionPtr + 1 + LINK_SIZE, stack.currentFrame->args.bracketChain);
+ if (isMatch)
+ RRETURN;
+ stack.currentFrame->args.instructionPtr += getLinkValue(stack.currentFrame->args.instructionPtr + 1);
+ } while (*stack.currentFrame->args.instructionPtr == OP_ALT);
+ DPRINTF(("bracket 0 failed\n"));
+ RRETURN;
+
+ /* Skip over large extraction number data if encountered. */
+
+ BEGIN_OPCODE(BRANUMBER):
+ stack.currentFrame->args.instructionPtr += 3;
+ NEXT_OPCODE;
+
+ /* End of the pattern. */
+
+ BEGIN_OPCODE(END):
+ md.endMatchPtr = stack.currentFrame->args.subjectPtr; /* Record where we ended */
+ md.endOffsetTop = stack.currentFrame->args.offsetTop; /* and how many extracts were taken */
+ isMatch = true;
+ RRETURN;
+
+ /* Assertion brackets. Check the alternative branches in turn - the
+ matching won't pass the KET for an assertion. If any one branch matches,
+ the assertion is true. Lookbehind assertions have an OP_REVERSE item at the
+ start of each branch to move the current point backwards, so the code at
+ this level is identical to the lookahead case. */
+
+ BEGIN_OPCODE(ASSERT):
+ do {
+ RECURSIVE_MATCH_NEW_GROUP(6, stack.currentFrame->args.instructionPtr + 1 + LINK_SIZE, NULL);
+ if (isMatch)
+ break;
+ stack.currentFrame->args.instructionPtr += getLinkValue(stack.currentFrame->args.instructionPtr + 1);
+ } while (*stack.currentFrame->args.instructionPtr == OP_ALT);
+ if (*stack.currentFrame->args.instructionPtr == OP_KET)
+ RRETURN_NO_MATCH;
+
+ /* Continue from after the assertion, updating the offsets high water
+ mark, since extracts may have been taken during the assertion. */
+
+ advanceToEndOfBracket(stack.currentFrame->args.instructionPtr);
+ stack.currentFrame->args.instructionPtr += 1 + LINK_SIZE;
+ stack.currentFrame->args.offsetTop = md.endOffsetTop;
+ NEXT_OPCODE;
+
+ /* Negative assertion: all branches must fail to match */
+
+ BEGIN_OPCODE(ASSERT_NOT):
+ do {
+ RECURSIVE_MATCH_NEW_GROUP(7, stack.currentFrame->args.instructionPtr + 1 + LINK_SIZE, NULL);
+ if (isMatch)
+ RRETURN_NO_MATCH;
+ stack.currentFrame->args.instructionPtr += getLinkValue(stack.currentFrame->args.instructionPtr + 1);
+ } while (*stack.currentFrame->args.instructionPtr == OP_ALT);
+
+ stack.currentFrame->args.instructionPtr += 1 + LINK_SIZE;
+ NEXT_OPCODE;
+
+ /* An alternation is the end of a branch; scan along to find the end of the
+ bracketed group and go to there. */
+
+ BEGIN_OPCODE(ALT):
+ advanceToEndOfBracket(stack.currentFrame->args.instructionPtr);
+ NEXT_OPCODE;
+
+ /* BRAZERO and BRAMINZERO occur just before a bracket group, indicating
+ that it may occur zero times. It may repeat infinitely, or not at all -
+ i.e. it could be ()* or ()? in the pattern. Brackets with fixed upper
+ repeat limits are compiled as a number of copies, with the optional ones
+ preceded by BRAZERO or BRAMINZERO. */
+
+ BEGIN_OPCODE(BRAZERO): {
+ stack.currentFrame->locals.startOfRepeatingBracket = stack.currentFrame->args.instructionPtr + 1;
+ RECURSIVE_MATCH_NEW_GROUP(14, stack.currentFrame->locals.startOfRepeatingBracket, stack.currentFrame->args.bracketChain);
+ if (isMatch)
+ RRETURN;
+ advanceToEndOfBracket(stack.currentFrame->locals.startOfRepeatingBracket);
+ stack.currentFrame->args.instructionPtr = stack.currentFrame->locals.startOfRepeatingBracket + 1 + LINK_SIZE;
+ NEXT_OPCODE;
+ }
+
+ BEGIN_OPCODE(BRAMINZERO): {
+ stack.currentFrame->locals.startOfRepeatingBracket = stack.currentFrame->args.instructionPtr + 1;
+ advanceToEndOfBracket(stack.currentFrame->locals.startOfRepeatingBracket);
+ RECURSIVE_MATCH_NEW_GROUP(15, stack.currentFrame->locals.startOfRepeatingBracket + 1 + LINK_SIZE, stack.currentFrame->args.bracketChain);
+ if (isMatch)
+ RRETURN;
+ stack.currentFrame->args.instructionPtr++;
+ NEXT_OPCODE;
+ }
+
+ /* End of a group, repeated or non-repeating. If we are at the end of
+ an assertion "group", stop matching and return 1, but record the
+ current high water mark for use by positive assertions. Do this also
+ for the "once" (not-backup up) groups. */
+
+ BEGIN_OPCODE(KET):
+ BEGIN_OPCODE(KETRMIN):
+ BEGIN_OPCODE(KETRMAX):
+ stack.currentFrame->locals.instructionPtrAtStartOfOnce = stack.currentFrame->args.instructionPtr - getLinkValue(stack.currentFrame->args.instructionPtr + 1);
+ stack.currentFrame->locals.subjectPtrAtStartOfInstruction = stack.currentFrame->args.bracketChain->bracketStart;
+
+ /* Back up the stack of bracket start pointers. */
+
+ stack.currentFrame->args.bracketChain = stack.currentFrame->args.bracketChain->previousBracket;
+
+ if (*stack.currentFrame->locals.instructionPtrAtStartOfOnce == OP_ASSERT || *stack.currentFrame->locals.instructionPtrAtStartOfOnce == OP_ASSERT_NOT) {
+ md.endOffsetTop = stack.currentFrame->args.offsetTop;
+ isMatch = true;
+ RRETURN;
+ }
+
+ /* In all other cases except a conditional group we have to check the
+ group number back at the start and if necessary complete handling an
+ extraction by setting the offsets and bumping the high water mark. */
+
+ stack.currentFrame->locals.number = *stack.currentFrame->locals.instructionPtrAtStartOfOnce - OP_BRA;
+
+ /* For extended extraction brackets (large number), we have to fish out
+ the number from a dummy opcode at the start. */
+
+ if (stack.currentFrame->locals.number > EXTRACT_BASIC_MAX)
+ stack.currentFrame->locals.number = get2ByteValue(stack.currentFrame->locals.instructionPtrAtStartOfOnce + 2 + LINK_SIZE);
+ stack.currentFrame->locals.offset = stack.currentFrame->locals.number << 1;
+
+#ifdef DEBUG
+ printf("end bracket %d", stack.currentFrame->locals.number);
+ printf("\n");
+#endif
+
+ /* Test for a numbered group. This includes groups called as a result
+ of recursion. Note that whole-pattern recursion is coded as a recurse
+ into group 0, so it won't be picked up here. Instead, we catch it when
+ the OP_END is reached. */
+
+ if (stack.currentFrame->locals.number > 0) {
+ if (stack.currentFrame->locals.offset >= md.offsetMax)
+ md.offsetOverflow = true;
+ else {
+ md.offsetVector[stack.currentFrame->locals.offset] =
+ md.offsetVector[md.offsetEnd - stack.currentFrame->locals.number];
+ md.offsetVector[stack.currentFrame->locals.offset+1] = stack.currentFrame->args.subjectPtr - md.startSubject;
+ if (stack.currentFrame->args.offsetTop <= stack.currentFrame->locals.offset)
+ stack.currentFrame->args.offsetTop = stack.currentFrame->locals.offset + 2;
+ }
+ }
+
+ /* For a non-repeating ket, just continue at this level. This also
+ happens for a repeating ket if no characters were matched in the group.
+ This is the forcible breaking of infinite loops as implemented in Perl
+ 5.005. If there is an options reset, it will get obeyed in the normal
+ course of events. */
+
+ if (*stack.currentFrame->args.instructionPtr == OP_KET || stack.currentFrame->args.subjectPtr == stack.currentFrame->locals.subjectPtrAtStartOfInstruction) {
+ stack.currentFrame->args.instructionPtr += 1 + LINK_SIZE;
+ NEXT_OPCODE;
+ }
+
+ /* The repeating kets try the rest of the pattern or restart from the
+ preceding bracket, in the appropriate order. */
+
+ if (*stack.currentFrame->args.instructionPtr == OP_KETRMIN) {
+ RECURSIVE_MATCH(16, stack.currentFrame->args.instructionPtr + 1 + LINK_SIZE, stack.currentFrame->args.bracketChain);
+ if (isMatch)
+ RRETURN;
+ RECURSIVE_MATCH_NEW_GROUP(17, stack.currentFrame->locals.instructionPtrAtStartOfOnce, stack.currentFrame->args.bracketChain);
+ if (isMatch)
+ RRETURN;
+ } else { /* OP_KETRMAX */
+ RECURSIVE_MATCH_NEW_GROUP(18, stack.currentFrame->locals.instructionPtrAtStartOfOnce, stack.currentFrame->args.bracketChain);
+ if (isMatch)
+ RRETURN;
+ RECURSIVE_MATCH(19, stack.currentFrame->args.instructionPtr + 1 + LINK_SIZE, stack.currentFrame->args.bracketChain);
+ if (isMatch)
+ RRETURN;
+ }
+ RRETURN;
+
+ /* Start of subject. */
+
+ BEGIN_OPCODE(CIRC):
+ if (stack.currentFrame->args.subjectPtr != md.startSubject)
+ RRETURN_NO_MATCH;
+ stack.currentFrame->args.instructionPtr++;
+ NEXT_OPCODE;
+
+ /* After internal newline if multiline. */
+
+ BEGIN_OPCODE(BOL):
+ if (stack.currentFrame->args.subjectPtr != md.startSubject && !isNewline(stack.currentFrame->args.subjectPtr[-1]))
+ RRETURN_NO_MATCH;
+ stack.currentFrame->args.instructionPtr++;
+ NEXT_OPCODE;
+
+ /* End of subject. */
+
+ BEGIN_OPCODE(DOLL):
+ if (stack.currentFrame->args.subjectPtr < md.endSubject)
+ RRETURN_NO_MATCH;
+ stack.currentFrame->args.instructionPtr++;
+ NEXT_OPCODE;
+
+ /* Before internal newline if multiline. */
+
+ BEGIN_OPCODE(EOL):
+ if (stack.currentFrame->args.subjectPtr < md.endSubject && !isNewline(*stack.currentFrame->args.subjectPtr))
+ RRETURN_NO_MATCH;
+ stack.currentFrame->args.instructionPtr++;
+ NEXT_OPCODE;
+
+ /* Word boundary assertions */
+
+ BEGIN_OPCODE(NOT_WORD_BOUNDARY):
+ BEGIN_OPCODE(WORD_BOUNDARY): {
+ bool currentCharIsWordChar = false;
+ bool previousCharIsWordChar = false;
+
+ if (stack.currentFrame->args.subjectPtr > md.startSubject)
+ previousCharIsWordChar = isWordChar(stack.currentFrame->args.subjectPtr[-1]);
+ if (stack.currentFrame->args.subjectPtr < md.endSubject)
+ currentCharIsWordChar = isWordChar(*stack.currentFrame->args.subjectPtr);
+
+ /* Now see if the situation is what we want */
+ bool wordBoundaryDesired = (*stack.currentFrame->args.instructionPtr++ == OP_WORD_BOUNDARY);
+ if (wordBoundaryDesired ? currentCharIsWordChar == previousCharIsWordChar : currentCharIsWordChar != previousCharIsWordChar)
+ RRETURN_NO_MATCH;
+ NEXT_OPCODE;
+ }
+
+ /* Match a single character type; inline for speed */
+
+ BEGIN_OPCODE(NOT_NEWLINE):
+ if (stack.currentFrame->args.subjectPtr >= md.endSubject)
+ RRETURN_NO_MATCH;
+ if (isNewline(*stack.currentFrame->args.subjectPtr++))
+ RRETURN_NO_MATCH;
+ stack.currentFrame->args.instructionPtr++;
+ NEXT_OPCODE;
+
+ BEGIN_OPCODE(NOT_DIGIT):
+ if (stack.currentFrame->args.subjectPtr >= md.endSubject)
+ RRETURN_NO_MATCH;
+ if (isASCIIDigit(*stack.currentFrame->args.subjectPtr++))
+ RRETURN_NO_MATCH;
+ stack.currentFrame->args.instructionPtr++;
+ NEXT_OPCODE;
+
+ BEGIN_OPCODE(DIGIT):
+ if (stack.currentFrame->args.subjectPtr >= md.endSubject)
+ RRETURN_NO_MATCH;
+ if (!isASCIIDigit(*stack.currentFrame->args.subjectPtr++))
+ RRETURN_NO_MATCH;
+ stack.currentFrame->args.instructionPtr++;
+ NEXT_OPCODE;
+
+ BEGIN_OPCODE(NOT_WHITESPACE):
+ if (stack.currentFrame->args.subjectPtr >= md.endSubject)
+ RRETURN_NO_MATCH;
+ if (isSpaceChar(*stack.currentFrame->args.subjectPtr++))
+ RRETURN_NO_MATCH;
+ stack.currentFrame->args.instructionPtr++;
+ NEXT_OPCODE;
+
+ BEGIN_OPCODE(WHITESPACE):
+ if (stack.currentFrame->args.subjectPtr >= md.endSubject)
+ RRETURN_NO_MATCH;
+ if (!isSpaceChar(*stack.currentFrame->args.subjectPtr++))
+ RRETURN_NO_MATCH;
+ stack.currentFrame->args.instructionPtr++;
+ NEXT_OPCODE;
+
+ BEGIN_OPCODE(NOT_WORDCHAR):
+ if (stack.currentFrame->args.subjectPtr >= md.endSubject)
+ RRETURN_NO_MATCH;
+ if (isWordChar(*stack.currentFrame->args.subjectPtr++))
+ RRETURN_NO_MATCH;
+ stack.currentFrame->args.instructionPtr++;
+ NEXT_OPCODE;
+
+ BEGIN_OPCODE(WORDCHAR):
+ if (stack.currentFrame->args.subjectPtr >= md.endSubject)
+ RRETURN_NO_MATCH;
+ if (!isWordChar(*stack.currentFrame->args.subjectPtr++))
+ RRETURN_NO_MATCH;
+ stack.currentFrame->args.instructionPtr++;
+ NEXT_OPCODE;
+
+ /* Match a back reference, possibly repeatedly. Look past the end of the
+ item to see if there is repeat information following. The code is similar
+ to that for character classes, but repeated for efficiency. Then obey
+ similar code to character type repeats - written out again for speed.
+ However, if the referenced string is the empty string, always treat
+ it as matched, any number of times (otherwise there could be infinite
+ loops). */
+
+ BEGIN_OPCODE(REF):
+ stack.currentFrame->locals.offset = get2ByteValue(stack.currentFrame->args.instructionPtr + 1) << 1; /* Doubled ref number */
+ stack.currentFrame->args.instructionPtr += 3; /* Advance past item */
+
+ /* If the reference is unset, set the length to be longer than the amount
+ of subject left; this ensures that every attempt at a match fails. We
+ can't just fail here, because of the possibility of quantifiers with zero
+ minima. */
+
+ if (stack.currentFrame->locals.offset >= stack.currentFrame->args.offsetTop || md.offsetVector[stack.currentFrame->locals.offset] < 0)
+ stack.currentFrame->locals.length = 0;
+ else
+ stack.currentFrame->locals.length = md.offsetVector[stack.currentFrame->locals.offset+1] - md.offsetVector[stack.currentFrame->locals.offset];
+
+ /* Set up for repetition, or handle the non-repeated case */
+
+ switch (*stack.currentFrame->args.instructionPtr) {
+ case OP_CRSTAR:
+ case OP_CRMINSTAR:
+ case OP_CRPLUS:
+ case OP_CRMINPLUS:
+ case OP_CRQUERY:
+ case OP_CRMINQUERY:
+ repeatInformationFromInstructionOffset(*stack.currentFrame->args.instructionPtr++ - OP_CRSTAR, minimize, min, stack.currentFrame->locals.max);
+ break;
+
+ case OP_CRRANGE:
+ case OP_CRMINRANGE:
+ minimize = (*stack.currentFrame->args.instructionPtr == OP_CRMINRANGE);
+ min = get2ByteValue(stack.currentFrame->args.instructionPtr + 1);
+ stack.currentFrame->locals.max = get2ByteValue(stack.currentFrame->args.instructionPtr + 3);
+ if (stack.currentFrame->locals.max == 0)
+ stack.currentFrame->locals.max = INT_MAX;
+ stack.currentFrame->args.instructionPtr += 5;
+ break;
+
+ default: /* No repeat follows */
+ if (!matchRef(stack.currentFrame->locals.offset, stack.currentFrame->args.subjectPtr, stack.currentFrame->locals.length, md))
+ RRETURN_NO_MATCH;
+ stack.currentFrame->args.subjectPtr += stack.currentFrame->locals.length;
+ NEXT_OPCODE;
+ }
+
+ /* If the length of the reference is zero, just continue with the
+ main loop. */
+
+ if (stack.currentFrame->locals.length == 0)
+ NEXT_OPCODE;
+
+ /* First, ensure the minimum number of matches are present. */
+
+ for (int i = 1; i <= min; i++) {
+ if (!matchRef(stack.currentFrame->locals.offset, stack.currentFrame->args.subjectPtr, stack.currentFrame->locals.length, md))
+ RRETURN_NO_MATCH;
+ stack.currentFrame->args.subjectPtr += stack.currentFrame->locals.length;
+ }
+
+ /* If min = max, continue at the same level without recursion.
+ They are not both allowed to be zero. */
+
+ if (min == stack.currentFrame->locals.max)
+ NEXT_OPCODE;
+
+ /* If minimizing, keep trying and advancing the pointer */
+
+ if (minimize) {
+ for (stack.currentFrame->locals.fi = min;; stack.currentFrame->locals.fi++) {
+ RECURSIVE_MATCH(20, stack.currentFrame->args.instructionPtr, stack.currentFrame->args.bracketChain);
+ if (isMatch)
+ RRETURN;
+ if (stack.currentFrame->locals.fi >= stack.currentFrame->locals.max || !matchRef(stack.currentFrame->locals.offset, stack.currentFrame->args.subjectPtr, stack.currentFrame->locals.length, md))
+ RRETURN;
+ stack.currentFrame->args.subjectPtr += stack.currentFrame->locals.length;
+ }
+ /* Control never reaches here */
+ }
+
+ /* If maximizing, find the longest string and work backwards */
+
+ else {
+ stack.currentFrame->locals.subjectPtrAtStartOfInstruction = stack.currentFrame->args.subjectPtr;
+ for (int i = min; i < stack.currentFrame->locals.max; i++) {
+ if (!matchRef(stack.currentFrame->locals.offset, stack.currentFrame->args.subjectPtr, stack.currentFrame->locals.length, md))
+ break;
+ stack.currentFrame->args.subjectPtr += stack.currentFrame->locals.length;
+ }
+ while (stack.currentFrame->args.subjectPtr >= stack.currentFrame->locals.subjectPtrAtStartOfInstruction) {
+ RECURSIVE_MATCH(21, stack.currentFrame->args.instructionPtr, stack.currentFrame->args.bracketChain);
+ if (isMatch)
+ RRETURN;
+ stack.currentFrame->args.subjectPtr -= stack.currentFrame->locals.length;
+ }
+ RRETURN_NO_MATCH;
+ }
+ /* Control never reaches here */
+
+ /* Match a bit-mapped character class, possibly repeatedly. This op code is
+ used when all the characters in the class have values in the range 0-255,
+ and either the matching is caseful, or the characters are in the range
+ 0-127 when UTF-8 processing is enabled. The only difference between
+ OP_CLASS and OP_NCLASS occurs when a data character outside the range is
+ encountered.
+
+ First, look past the end of the item to see if there is repeat information
+ following. Then obey similar code to character type repeats - written out
+ again for speed. */
+
+ BEGIN_OPCODE(NCLASS):
+ BEGIN_OPCODE(CLASS):
+ stack.currentFrame->locals.data = stack.currentFrame->args.instructionPtr + 1; /* Save for matching */
+ stack.currentFrame->args.instructionPtr += 33; /* Advance past the item */
+
+ switch (*stack.currentFrame->args.instructionPtr) {
+ case OP_CRSTAR:
+ case OP_CRMINSTAR:
+ case OP_CRPLUS:
+ case OP_CRMINPLUS:
+ case OP_CRQUERY:
+ case OP_CRMINQUERY:
+ repeatInformationFromInstructionOffset(*stack.currentFrame->args.instructionPtr++ - OP_CRSTAR, minimize, min, stack.currentFrame->locals.max);
+ break;
+
+ case OP_CRRANGE:
+ case OP_CRMINRANGE:
+ minimize = (*stack.currentFrame->args.instructionPtr == OP_CRMINRANGE);
+ min = get2ByteValue(stack.currentFrame->args.instructionPtr + 1);
+ stack.currentFrame->locals.max = get2ByteValue(stack.currentFrame->args.instructionPtr + 3);
+ if (stack.currentFrame->locals.max == 0)
+ stack.currentFrame->locals.max = INT_MAX;
+ stack.currentFrame->args.instructionPtr += 5;
+ break;
+
+ default: /* No repeat follows */
+ min = stack.currentFrame->locals.max = 1;
+ break;
+ }
+
+ /* First, ensure the minimum number of matches are present. */
+
+ for (int i = 1; i <= min; i++) {
+ if (stack.currentFrame->args.subjectPtr >= md.endSubject)
+ RRETURN_NO_MATCH;
+ int c = *stack.currentFrame->args.subjectPtr++;
+ if (c > 255) {
+ if (stack.currentFrame->locals.data[-1] == OP_CLASS)
+ RRETURN_NO_MATCH;
+ } else {
+ if (!(stack.currentFrame->locals.data[c / 8] & (1 << (c & 7))))
+ RRETURN_NO_MATCH;
+ }
+ }
+
+ /* If max == min we can continue with the main loop without the
+ need to recurse. */
+
+ if (min == stack.currentFrame->locals.max)
+ NEXT_OPCODE;
+
+ /* If minimizing, keep testing the rest of the expression and advancing
+ the pointer while it matches the class. */
+ if (minimize) {
+ for (stack.currentFrame->locals.fi = min;; stack.currentFrame->locals.fi++) {
+ RECURSIVE_MATCH(22, stack.currentFrame->args.instructionPtr, stack.currentFrame->args.bracketChain);
+ if (isMatch)
+ RRETURN;
+ if (stack.currentFrame->locals.fi >= stack.currentFrame->locals.max || stack.currentFrame->args.subjectPtr >= md.endSubject)
+ RRETURN;
+ int c = *stack.currentFrame->args.subjectPtr++;
+ if (c > 255) {
+ if (stack.currentFrame->locals.data[-1] == OP_CLASS)
+ RRETURN;
+ } else {
+ if ((stack.currentFrame->locals.data[c/8] & (1 << (c&7))) == 0)
+ RRETURN;
+ }
+ }
+ /* Control never reaches here */
+ }
+ /* If maximizing, find the longest possible run, then work backwards. */
+ else {
+ stack.currentFrame->locals.subjectPtrAtStartOfInstruction = stack.currentFrame->args.subjectPtr;
+
+ for (int i = min; i < stack.currentFrame->locals.max; i++) {
+ if (stack.currentFrame->args.subjectPtr >= md.endSubject)
+ break;
+ int c = *stack.currentFrame->args.subjectPtr;
+ if (c > 255) {
+ if (stack.currentFrame->locals.data[-1] == OP_CLASS)
+ break;
+ } else {
+ if (!(stack.currentFrame->locals.data[c / 8] & (1 << (c & 7))))
+ break;
+ }
+ ++stack.currentFrame->args.subjectPtr;
+ }
+ for (;;) {
+ RECURSIVE_MATCH(24, stack.currentFrame->args.instructionPtr, stack.currentFrame->args.bracketChain);
+ if (isMatch)
+ RRETURN;
+ if (stack.currentFrame->args.subjectPtr-- == stack.currentFrame->locals.subjectPtrAtStartOfInstruction)
+ break; /* Stop if tried at original pos */
+ }
+
+ RRETURN;
+ }
+ /* Control never reaches here */
+
+ /* Match an extended character class. */
+
+ BEGIN_OPCODE(XCLASS):
+ stack.currentFrame->locals.data = stack.currentFrame->args.instructionPtr + 1 + LINK_SIZE; /* Save for matching */
+ stack.currentFrame->args.instructionPtr += getLinkValue(stack.currentFrame->args.instructionPtr + 1); /* Advance past the item */
+
+ switch (*stack.currentFrame->args.instructionPtr) {
+ case OP_CRSTAR:
+ case OP_CRMINSTAR:
+ case OP_CRPLUS:
+ case OP_CRMINPLUS:
+ case OP_CRQUERY:
+ case OP_CRMINQUERY:
+ repeatInformationFromInstructionOffset(*stack.currentFrame->args.instructionPtr++ - OP_CRSTAR, minimize, min, stack.currentFrame->locals.max);
+ break;
+
+ case OP_CRRANGE:
+ case OP_CRMINRANGE:
+ minimize = (*stack.currentFrame->args.instructionPtr == OP_CRMINRANGE);
+ min = get2ByteValue(stack.currentFrame->args.instructionPtr + 1);
+ stack.currentFrame->locals.max = get2ByteValue(stack.currentFrame->args.instructionPtr + 3);
+ if (stack.currentFrame->locals.max == 0)
+ stack.currentFrame->locals.max = INT_MAX;
+ stack.currentFrame->args.instructionPtr += 5;
+ break;
+
+ default: /* No repeat follows */
+ min = stack.currentFrame->locals.max = 1;
+ }
+
+ /* First, ensure the minimum number of matches are present. */
+
+ for (int i = 1; i <= min; i++) {
+ if (stack.currentFrame->args.subjectPtr >= md.endSubject)
+ RRETURN_NO_MATCH;
+ int c = *stack.currentFrame->args.subjectPtr++;
+ if (!jsc_pcre_xclass(c, stack.currentFrame->locals.data))
+ RRETURN_NO_MATCH;
+ }
+
+ /* If max == min we can continue with the main loop without the
+ need to recurse. */
+
+ if (min == stack.currentFrame->locals.max)
+ NEXT_OPCODE;
+
+ /* If minimizing, keep testing the rest of the expression and advancing
+ the pointer while it matches the class. */
+
+ if (minimize) {
+ for (stack.currentFrame->locals.fi = min;; stack.currentFrame->locals.fi++) {
+ RECURSIVE_MATCH(26, stack.currentFrame->args.instructionPtr, stack.currentFrame->args.bracketChain);
+ if (isMatch)
+ RRETURN;
+ if (stack.currentFrame->locals.fi >= stack.currentFrame->locals.max || stack.currentFrame->args.subjectPtr >= md.endSubject)
+ RRETURN;
+ int c = *stack.currentFrame->args.subjectPtr++;
+ if (!jsc_pcre_xclass(c, stack.currentFrame->locals.data))
+ RRETURN;
+ }
+ /* Control never reaches here */
+ }
+
+ /* If maximizing, find the longest possible run, then work backwards. */
+
+ else {
+ stack.currentFrame->locals.subjectPtrAtStartOfInstruction = stack.currentFrame->args.subjectPtr;
+ for (int i = min; i < stack.currentFrame->locals.max; i++) {
+ if (stack.currentFrame->args.subjectPtr >= md.endSubject)
+ break;
+ int c = *stack.currentFrame->args.subjectPtr;
+ if (!jsc_pcre_xclass(c, stack.currentFrame->locals.data))
+ break;
+ ++stack.currentFrame->args.subjectPtr;
+ }
+ for(;;) {
+ RECURSIVE_MATCH(27, stack.currentFrame->args.instructionPtr, stack.currentFrame->args.bracketChain);
+ if (isMatch)
+ RRETURN;
+ if (stack.currentFrame->args.subjectPtr-- == stack.currentFrame->locals.subjectPtrAtStartOfInstruction)
+ break; /* Stop if tried at original pos */
+ }
+ RRETURN;
+ }
+
+ /* Control never reaches here */
+
+ /* Match a single character, casefully */
+
+ BEGIN_OPCODE(CHAR):
+ stack.currentFrame->locals.length = 1;
+ stack.currentFrame->args.instructionPtr++;
+ getUTF8CharAndIncrementLength(stack.currentFrame->locals.fc, stack.currentFrame->args.instructionPtr, stack.currentFrame->locals.length);
+ stack.currentFrame->args.instructionPtr += stack.currentFrame->locals.length;
+ if (stack.currentFrame->args.subjectPtr >= md.endSubject)
+ RRETURN_NO_MATCH;
+ if (stack.currentFrame->locals.fc != *stack.currentFrame->args.subjectPtr++)
+ RRETURN_NO_MATCH;
+ NEXT_OPCODE;
+
+ /* Match a single character, caselessly */
+
+ BEGIN_OPCODE(CHAR_IGNORING_CASE): {
+ stack.currentFrame->locals.length = 1;
+ stack.currentFrame->args.instructionPtr++;
+ getUTF8CharAndIncrementLength(stack.currentFrame->locals.fc, stack.currentFrame->args.instructionPtr, stack.currentFrame->locals.length);
+ stack.currentFrame->args.instructionPtr += stack.currentFrame->locals.length;
+ if (stack.currentFrame->args.subjectPtr >= md.endSubject)
+ RRETURN_NO_MATCH;
+ int dc = *stack.currentFrame->args.subjectPtr++;
+ if (stack.currentFrame->locals.fc != dc && jsc_pcre_ucp_othercase(stack.currentFrame->locals.fc) != dc)
+ RRETURN_NO_MATCH;
+ NEXT_OPCODE;
+ }
+
+ /* Match a single ASCII character. */
+
+ BEGIN_OPCODE(ASCII_CHAR):
+ if (md.endSubject == stack.currentFrame->args.subjectPtr)
+ RRETURN_NO_MATCH;
+ if (*stack.currentFrame->args.subjectPtr != stack.currentFrame->args.instructionPtr[1])
+ RRETURN_NO_MATCH;
+ ++stack.currentFrame->args.subjectPtr;
+ stack.currentFrame->args.instructionPtr += 2;
+ NEXT_OPCODE;
+
+ /* Match one of two cases of an ASCII letter. */
+
+ BEGIN_OPCODE(ASCII_LETTER_IGNORING_CASE):
+ if (md.endSubject == stack.currentFrame->args.subjectPtr)
+ RRETURN_NO_MATCH;
+ if ((*stack.currentFrame->args.subjectPtr | 0x20) != stack.currentFrame->args.instructionPtr[1])
+ RRETURN_NO_MATCH;
+ ++stack.currentFrame->args.subjectPtr;
+ stack.currentFrame->args.instructionPtr += 2;
+ NEXT_OPCODE;
+
+ /* Match a single character repeatedly; different opcodes share code. */
+
+ BEGIN_OPCODE(EXACT):
+ min = stack.currentFrame->locals.max = get2ByteValue(stack.currentFrame->args.instructionPtr + 1);
+ minimize = false;
+ stack.currentFrame->args.instructionPtr += 3;
+ goto REPEATCHAR;
+
+ BEGIN_OPCODE(UPTO):
+ BEGIN_OPCODE(MINUPTO):
+ min = 0;
+ stack.currentFrame->locals.max = get2ByteValue(stack.currentFrame->args.instructionPtr + 1);
+ minimize = *stack.currentFrame->args.instructionPtr == OP_MINUPTO;
+ stack.currentFrame->args.instructionPtr += 3;
+ goto REPEATCHAR;
+
+ BEGIN_OPCODE(STAR):
+ BEGIN_OPCODE(MINSTAR):
+ BEGIN_OPCODE(PLUS):
+ BEGIN_OPCODE(MINPLUS):
+ BEGIN_OPCODE(QUERY):
+ BEGIN_OPCODE(MINQUERY):
+ repeatInformationFromInstructionOffset(*stack.currentFrame->args.instructionPtr++ - OP_STAR, minimize, min, stack.currentFrame->locals.max);
+
+ /* Common code for all repeated single-character matches. We can give
+ up quickly if there are fewer than the minimum number of characters left in
+ the subject. */
+
+ REPEATCHAR:
+
+ stack.currentFrame->locals.length = 1;
+ getUTF8CharAndIncrementLength(stack.currentFrame->locals.fc, stack.currentFrame->args.instructionPtr, stack.currentFrame->locals.length);
+ if (min * (stack.currentFrame->locals.fc > 0xFFFF ? 2 : 1) > md.endSubject - stack.currentFrame->args.subjectPtr)
+ RRETURN_NO_MATCH;
+ stack.currentFrame->args.instructionPtr += stack.currentFrame->locals.length;
+
+ if (stack.currentFrame->locals.fc <= 0xFFFF) {
+ othercase = md.ignoreCase ? jsc_pcre_ucp_othercase(stack.currentFrame->locals.fc) : -1;
+
+ for (int i = 1; i <= min; i++) {
+ if (*stack.currentFrame->args.subjectPtr != stack.currentFrame->locals.fc && *stack.currentFrame->args.subjectPtr != othercase)
+ RRETURN_NO_MATCH;
+ ++stack.currentFrame->args.subjectPtr;
+ }
+
+ if (min == stack.currentFrame->locals.max)
+ NEXT_OPCODE;
+
+ if (minimize) {
+ stack.currentFrame->locals.repeatOthercase = othercase;
+ for (stack.currentFrame->locals.fi = min;; stack.currentFrame->locals.fi++) {
+ RECURSIVE_MATCH(28, stack.currentFrame->args.instructionPtr, stack.currentFrame->args.bracketChain);
+ if (isMatch)
+ RRETURN;
+ if (stack.currentFrame->locals.fi >= stack.currentFrame->locals.max || stack.currentFrame->args.subjectPtr >= md.endSubject)
+ RRETURN;
+ if (*stack.currentFrame->args.subjectPtr != stack.currentFrame->locals.fc && *stack.currentFrame->args.subjectPtr != stack.currentFrame->locals.repeatOthercase)
+ RRETURN;
+ ++stack.currentFrame->args.subjectPtr;
+ }
+ /* Control never reaches here */
+ } else {
+ stack.currentFrame->locals.subjectPtrAtStartOfInstruction = stack.currentFrame->args.subjectPtr;
+ for (int i = min; i < stack.currentFrame->locals.max; i++) {
+ if (stack.currentFrame->args.subjectPtr >= md.endSubject)
+ break;
+ if (*stack.currentFrame->args.subjectPtr != stack.currentFrame->locals.fc && *stack.currentFrame->args.subjectPtr != othercase)
+ break;
+ ++stack.currentFrame->args.subjectPtr;
+ }
+ while (stack.currentFrame->args.subjectPtr >= stack.currentFrame->locals.subjectPtrAtStartOfInstruction) {
+ RECURSIVE_MATCH(29, stack.currentFrame->args.instructionPtr, stack.currentFrame->args.bracketChain);
+ if (isMatch)
+ RRETURN;
+ --stack.currentFrame->args.subjectPtr;
+ }
+ RRETURN_NO_MATCH;
+ }
+ /* Control never reaches here */
+ } else {
+ /* No case on surrogate pairs, so no need to bother with "othercase". */
+
+ for (int i = 1; i <= min; i++) {
+ if (*stack.currentFrame->args.subjectPtr != stack.currentFrame->locals.fc)
+ RRETURN_NO_MATCH;
+ stack.currentFrame->args.subjectPtr += 2;
+ }
+
+ if (min == stack.currentFrame->locals.max)
+ NEXT_OPCODE;
+
+ if (minimize) {
+ for (stack.currentFrame->locals.fi = min;; stack.currentFrame->locals.fi++) {
+ RECURSIVE_MATCH(30, stack.currentFrame->args.instructionPtr, stack.currentFrame->args.bracketChain);
+ if (isMatch)
+ RRETURN;
+ if (stack.currentFrame->locals.fi >= stack.currentFrame->locals.max || stack.currentFrame->args.subjectPtr >= md.endSubject)
+ RRETURN;
+ if (*stack.currentFrame->args.subjectPtr != stack.currentFrame->locals.fc)
+ RRETURN;
+ stack.currentFrame->args.subjectPtr += 2;
+ }
+ /* Control never reaches here */
+ } else {
+ stack.currentFrame->locals.subjectPtrAtStartOfInstruction = stack.currentFrame->args.subjectPtr;
+ for (int i = min; i < stack.currentFrame->locals.max; i++) {
+ if (stack.currentFrame->args.subjectPtr > md.endSubject - 2)
+ break;
+ if (*stack.currentFrame->args.subjectPtr != stack.currentFrame->locals.fc)
+ break;
+ stack.currentFrame->args.subjectPtr += 2;
+ }
+ while (stack.currentFrame->args.subjectPtr >= stack.currentFrame->locals.subjectPtrAtStartOfInstruction) {
+ RECURSIVE_MATCH(31, stack.currentFrame->args.instructionPtr, stack.currentFrame->args.bracketChain);
+ if (isMatch)
+ RRETURN;
+ stack.currentFrame->args.subjectPtr -= 2;
+ }
+ RRETURN_NO_MATCH;
+ }
+ /* Control never reaches here */
+ }
+ /* Control never reaches here */
+
+ /* Match a negated single one-byte character. */
+
+ BEGIN_OPCODE(NOT): {
+ if (stack.currentFrame->args.subjectPtr >= md.endSubject)
+ RRETURN_NO_MATCH;
+ int b = stack.currentFrame->args.instructionPtr[1];
+ int c = *stack.currentFrame->args.subjectPtr++;
+ stack.currentFrame->args.instructionPtr += 2;
+ if (md.ignoreCase) {
+ if (c < 128)
+ c = toLowerCase(c);
+ if (toLowerCase(b) == c)
+ RRETURN_NO_MATCH;
+ } else {
+ if (b == c)
+ RRETURN_NO_MATCH;
+ }
+ NEXT_OPCODE;
+ }
+
+ /* Match a negated single one-byte character repeatedly. This is almost a
+ repeat of the code for a repeated single character, but I haven't found a
+ nice way of commoning these up that doesn't require a test of the
+ positive/negative option for each character match. Maybe that wouldn't add
+ very much to the time taken, but character matching *is* what this is all
+ about... */
+
+ BEGIN_OPCODE(NOTEXACT):
+ min = stack.currentFrame->locals.max = get2ByteValue(stack.currentFrame->args.instructionPtr + 1);
+ minimize = false;
+ stack.currentFrame->args.instructionPtr += 3;
+ goto REPEATNOTCHAR;
+
+ BEGIN_OPCODE(NOTUPTO):
+ BEGIN_OPCODE(NOTMINUPTO):
+ min = 0;
+ stack.currentFrame->locals.max = get2ByteValue(stack.currentFrame->args.instructionPtr + 1);
+ minimize = *stack.currentFrame->args.instructionPtr == OP_NOTMINUPTO;
+ stack.currentFrame->args.instructionPtr += 3;
+ goto REPEATNOTCHAR;
+
+ BEGIN_OPCODE(NOTSTAR):
+ BEGIN_OPCODE(NOTMINSTAR):
+ BEGIN_OPCODE(NOTPLUS):
+ BEGIN_OPCODE(NOTMINPLUS):
+ BEGIN_OPCODE(NOTQUERY):
+ BEGIN_OPCODE(NOTMINQUERY):
+ repeatInformationFromInstructionOffset(*stack.currentFrame->args.instructionPtr++ - OP_NOTSTAR, minimize, min, stack.currentFrame->locals.max);
+
+ /* Common code for all repeated single-byte matches. We can give up quickly
+ if there are fewer than the minimum number of bytes left in the
+ subject. */
+
+ REPEATNOTCHAR:
+ if (min > md.endSubject - stack.currentFrame->args.subjectPtr)
+ RRETURN_NO_MATCH;
+ stack.currentFrame->locals.fc = *stack.currentFrame->args.instructionPtr++;
+
+ /* The code is duplicated for the caseless and caseful cases, for speed,
+ since matching characters is likely to be quite common. First, ensure the
+ minimum number of matches are present. If min = max, continue at the same
+ level without recursing. Otherwise, if minimizing, keep trying the rest of
+ the expression and advancing one matching character if failing, up to the
+ maximum. Alternatively, if maximizing, find the maximum number of
+ characters and work backwards. */
+
+ DPRINTF(("negative matching %c{%d,%d}\n", stack.currentFrame->locals.fc, min, stack.currentFrame->locals.max));
+
+ if (md.ignoreCase) {
+ if (stack.currentFrame->locals.fc < 128)
+ stack.currentFrame->locals.fc = toLowerCase(stack.currentFrame->locals.fc);
+
+ for (int i = 1; i <= min; i++) {
+ int d = *stack.currentFrame->args.subjectPtr++;
+ if (d < 128)
+ d = toLowerCase(d);
+ if (stack.currentFrame->locals.fc == d)
+ RRETURN_NO_MATCH;
+ }
+
+ if (min == stack.currentFrame->locals.max)
+ NEXT_OPCODE;
+
+ if (minimize) {
+ for (stack.currentFrame->locals.fi = min;; stack.currentFrame->locals.fi++) {
+ RECURSIVE_MATCH(38, stack.currentFrame->args.instructionPtr, stack.currentFrame->args.bracketChain);
+ if (isMatch)
+ RRETURN;
+ int d = *stack.currentFrame->args.subjectPtr++;
+ if (d < 128)
+ d = toLowerCase(d);
+ if (stack.currentFrame->locals.fi >= stack.currentFrame->locals.max || stack.currentFrame->args.subjectPtr >= md.endSubject || stack.currentFrame->locals.fc == d)
+ RRETURN;
+ }
+ /* Control never reaches here */
+ }
+
+ /* Maximize case */
+
+ else {
+ stack.currentFrame->locals.subjectPtrAtStartOfInstruction = stack.currentFrame->args.subjectPtr;
+
+ for (int i = min; i < stack.currentFrame->locals.max; i++) {
+ if (stack.currentFrame->args.subjectPtr >= md.endSubject)
+ break;
+ int d = *stack.currentFrame->args.subjectPtr;
+ if (d < 128)
+ d = toLowerCase(d);
+ if (stack.currentFrame->locals.fc == d)
+ break;
+ ++stack.currentFrame->args.subjectPtr;
+ }
+ for (;;) {
+ RECURSIVE_MATCH(40, stack.currentFrame->args.instructionPtr, stack.currentFrame->args.bracketChain);
+ if (isMatch)
+ RRETURN;
+ if (stack.currentFrame->args.subjectPtr-- == stack.currentFrame->locals.subjectPtrAtStartOfInstruction)
+ break; /* Stop if tried at original pos */
+ }
+
+ RRETURN;
+ }
+ /* Control never reaches here */
+ }
+
+ /* Caseful comparisons */
+
+ else {
+ for (int i = 1; i <= min; i++) {
+ int d = *stack.currentFrame->args.subjectPtr++;
+ if (stack.currentFrame->locals.fc == d)
+ RRETURN_NO_MATCH;
+ }
+
+ if (min == stack.currentFrame->locals.max)
+ NEXT_OPCODE;
+
+ if (minimize) {
+ for (stack.currentFrame->locals.fi = min;; stack.currentFrame->locals.fi++) {
+ RECURSIVE_MATCH(42, stack.currentFrame->args.instructionPtr, stack.currentFrame->args.bracketChain);
+ if (isMatch)
+ RRETURN;
+ int d = *stack.currentFrame->args.subjectPtr++;
+ if (stack.currentFrame->locals.fi >= stack.currentFrame->locals.max || stack.currentFrame->args.subjectPtr >= md.endSubject || stack.currentFrame->locals.fc == d)
+ RRETURN;
+ }
+ /* Control never reaches here */
+ }
+
+ /* Maximize case */
+
+ else {
+ stack.currentFrame->locals.subjectPtrAtStartOfInstruction = stack.currentFrame->args.subjectPtr;
+
+ for (int i = min; i < stack.currentFrame->locals.max; i++) {
+ if (stack.currentFrame->args.subjectPtr >= md.endSubject)
+ break;
+ int d = *stack.currentFrame->args.subjectPtr;
+ if (stack.currentFrame->locals.fc == d)
+ break;
+ ++stack.currentFrame->args.subjectPtr;
+ }
+ for (;;) {
+ RECURSIVE_MATCH(44, stack.currentFrame->args.instructionPtr, stack.currentFrame->args.bracketChain);
+ if (isMatch)
+ RRETURN;
+ if (stack.currentFrame->args.subjectPtr-- == stack.currentFrame->locals.subjectPtrAtStartOfInstruction)
+ break; /* Stop if tried at original pos */
+ }
+
+ RRETURN;
+ }
+ }
+ /* Control never reaches here */
+
+ /* Match a single character type repeatedly; several different opcodes
+ share code. This is very similar to the code for single characters, but we
+ repeat it in the interests of efficiency. */
+
+ BEGIN_OPCODE(TYPEEXACT):
+ min = stack.currentFrame->locals.max = get2ByteValue(stack.currentFrame->args.instructionPtr + 1);
+ minimize = true;
+ stack.currentFrame->args.instructionPtr += 3;
+ goto REPEATTYPE;
+
+ BEGIN_OPCODE(TYPEUPTO):
+ BEGIN_OPCODE(TYPEMINUPTO):
+ min = 0;
+ stack.currentFrame->locals.max = get2ByteValue(stack.currentFrame->args.instructionPtr + 1);
+ minimize = *stack.currentFrame->args.instructionPtr == OP_TYPEMINUPTO;
+ stack.currentFrame->args.instructionPtr += 3;
+ goto REPEATTYPE;
+
+ BEGIN_OPCODE(TYPESTAR):
+ BEGIN_OPCODE(TYPEMINSTAR):
+ BEGIN_OPCODE(TYPEPLUS):
+ BEGIN_OPCODE(TYPEMINPLUS):
+ BEGIN_OPCODE(TYPEQUERY):
+ BEGIN_OPCODE(TYPEMINQUERY):
+ repeatInformationFromInstructionOffset(*stack.currentFrame->args.instructionPtr++ - OP_TYPESTAR, minimize, min, stack.currentFrame->locals.max);
+
+ /* Common code for all repeated single character type matches. Note that
+ in UTF-8 mode, '.' matches a character of any length, but for the other
+ character types, the valid characters are all one-byte long. */
+
+ REPEATTYPE:
+ stack.currentFrame->locals.ctype = *stack.currentFrame->args.instructionPtr++; /* Code for the character type */
+
+ /* First, ensure the minimum number of matches are present. Use inline
+ code for maximizing the speed, and do the type test once at the start
+ (i.e. keep it out of the loop). Also we can test that there are at least
+ the minimum number of characters before we start. */
+
+ if (min > md.endSubject - stack.currentFrame->args.subjectPtr)
+ RRETURN_NO_MATCH;
+ if (min > 0) {
+ switch (stack.currentFrame->locals.ctype) {
+ case OP_NOT_NEWLINE:
+ for (int i = 1; i <= min; i++) {
+ if (isNewline(*stack.currentFrame->args.subjectPtr))
+ RRETURN_NO_MATCH;
+ ++stack.currentFrame->args.subjectPtr;
+ }
+ break;
+
+ case OP_NOT_DIGIT:
+ for (int i = 1; i <= min; i++) {
+ if (isASCIIDigit(*stack.currentFrame->args.subjectPtr))
+ RRETURN_NO_MATCH;
+ ++stack.currentFrame->args.subjectPtr;
+ }
+ break;
+
+ case OP_DIGIT:
+ for (int i = 1; i <= min; i++) {
+ if (!isASCIIDigit(*stack.currentFrame->args.subjectPtr))
+ RRETURN_NO_MATCH;
+ ++stack.currentFrame->args.subjectPtr;
+ }
+ break;
+
+ case OP_NOT_WHITESPACE:
+ for (int i = 1; i <= min; i++) {
+ if (isSpaceChar(*stack.currentFrame->args.subjectPtr))
+ RRETURN_NO_MATCH;
+ ++stack.currentFrame->args.subjectPtr;
+ }
+ break;
+
+ case OP_WHITESPACE:
+ for (int i = 1; i <= min; i++) {
+ if (!isSpaceChar(*stack.currentFrame->args.subjectPtr))
+ RRETURN_NO_MATCH;
+ ++stack.currentFrame->args.subjectPtr;
+ }
+ break;
+
+ case OP_NOT_WORDCHAR:
+ for (int i = 1; i <= min; i++) {
+ if (isWordChar(*stack.currentFrame->args.subjectPtr))
+ RRETURN_NO_MATCH;
+ ++stack.currentFrame->args.subjectPtr;
+ }
+ break;
+
+ case OP_WORDCHAR:
+ for (int i = 1; i <= min; i++) {
+ if (!isWordChar(*stack.currentFrame->args.subjectPtr))
+ RRETURN_NO_MATCH;
+ ++stack.currentFrame->args.subjectPtr;
+ }
+ break;
+
+ default:
+ ASSERT_NOT_REACHED();
+ return matchError(JSRegExpErrorInternal, stack);
+ } /* End switch(stack.currentFrame->locals.ctype) */
+ }
+
+ /* If min = max, continue at the same level without recursing */
+
+ if (min == stack.currentFrame->locals.max)
+ NEXT_OPCODE;
+
+ /* If minimizing, we have to test the rest of the pattern before each
+ subsequent match. */
+
+ if (minimize) {
+ for (stack.currentFrame->locals.fi = min;; stack.currentFrame->locals.fi++) {
+ RECURSIVE_MATCH(48, stack.currentFrame->args.instructionPtr, stack.currentFrame->args.bracketChain);
+ if (isMatch)
+ RRETURN;
+ if (stack.currentFrame->locals.fi >= stack.currentFrame->locals.max || stack.currentFrame->args.subjectPtr >= md.endSubject)
+ RRETURN;
+
+ int c = *stack.currentFrame->args.subjectPtr++;
+ switch (stack.currentFrame->locals.ctype) {
+ case OP_NOT_NEWLINE:
+ if (isNewline(c))
+ RRETURN;
+ break;
+
+ case OP_NOT_DIGIT:
+ if (isASCIIDigit(c))
+ RRETURN;
+ break;
+
+ case OP_DIGIT:
+ if (!isASCIIDigit(c))
+ RRETURN;
+ break;
+
+ case OP_NOT_WHITESPACE:
+ if (isSpaceChar(c))
+ RRETURN;
+ break;
+
+ case OP_WHITESPACE:
+ if (!isSpaceChar(c))
+ RRETURN;
+ break;
+
+ case OP_NOT_WORDCHAR:
+ if (isWordChar(c))
+ RRETURN;
+ break;
+
+ case OP_WORDCHAR:
+ if (!isWordChar(c))
+ RRETURN;
+ break;
+
+ default:
+ ASSERT_NOT_REACHED();
+ return matchError(JSRegExpErrorInternal, stack);
+ }
+ }
+ /* Control never reaches here */
+ }
+
+ /* If maximizing it is worth using inline code for speed, doing the type
+ test once at the start (i.e. keep it out of the loop). */
+
+ else {
+ stack.currentFrame->locals.subjectPtrAtStartOfInstruction = stack.currentFrame->args.subjectPtr; /* Remember where we started */
+
+ switch (stack.currentFrame->locals.ctype) {
+ case OP_NOT_NEWLINE:
+ for (int i = min; i < stack.currentFrame->locals.max; i++) {
+ if (stack.currentFrame->args.subjectPtr >= md.endSubject || isNewline(*stack.currentFrame->args.subjectPtr))
+ break;
+ stack.currentFrame->args.subjectPtr++;
+ }
+ break;
+
+ case OP_NOT_DIGIT:
+ for (int i = min; i < stack.currentFrame->locals.max; i++) {
+ if (stack.currentFrame->args.subjectPtr >= md.endSubject)
+ break;
+ int c = *stack.currentFrame->args.subjectPtr;
+ if (isASCIIDigit(c))
+ break;
+ ++stack.currentFrame->args.subjectPtr;
+ }
+ break;
+
+ case OP_DIGIT:
+ for (int i = min; i < stack.currentFrame->locals.max; i++) {
+ if (stack.currentFrame->args.subjectPtr >= md.endSubject)
+ break;
+ int c = *stack.currentFrame->args.subjectPtr;
+ if (!isASCIIDigit(c))
+ break;
+ ++stack.currentFrame->args.subjectPtr;
+ }
+ break;
+
+ case OP_NOT_WHITESPACE:
+ for (int i = min; i < stack.currentFrame->locals.max; i++) {
+ if (stack.currentFrame->args.subjectPtr >= md.endSubject)
+ break;
+ int c = *stack.currentFrame->args.subjectPtr;
+ if (isSpaceChar(c))
+ break;
+ ++stack.currentFrame->args.subjectPtr;
+ }
+ break;
+
+ case OP_WHITESPACE:
+ for (int i = min; i < stack.currentFrame->locals.max; i++) {
+ if (stack.currentFrame->args.subjectPtr >= md.endSubject)
+ break;
+ int c = *stack.currentFrame->args.subjectPtr;
+ if (!isSpaceChar(c))
+ break;
+ ++stack.currentFrame->args.subjectPtr;
+ }
+ break;
+
+ case OP_NOT_WORDCHAR:
+ for (int i = min; i < stack.currentFrame->locals.max; i++) {
+ if (stack.currentFrame->args.subjectPtr >= md.endSubject)
+ break;
+ int c = *stack.currentFrame->args.subjectPtr;
+ if (isWordChar(c))
+ break;
+ ++stack.currentFrame->args.subjectPtr;
+ }
+ break;
+
+ case OP_WORDCHAR:
+ for (int i = min; i < stack.currentFrame->locals.max; i++) {
+ if (stack.currentFrame->args.subjectPtr >= md.endSubject)
+ break;
+ int c = *stack.currentFrame->args.subjectPtr;
+ if (!isWordChar(c))
+ break;
+ ++stack.currentFrame->args.subjectPtr;
+ }
+ break;
+
+ default:
+ ASSERT_NOT_REACHED();
+ return matchError(JSRegExpErrorInternal, stack);
+ }
+
+ /* stack.currentFrame->args.subjectPtr is now past the end of the maximum run */
+
+ for (;;) {
+ RECURSIVE_MATCH(52, stack.currentFrame->args.instructionPtr, stack.currentFrame->args.bracketChain);
+ if (isMatch)
+ RRETURN;
+ if (stack.currentFrame->args.subjectPtr-- == stack.currentFrame->locals.subjectPtrAtStartOfInstruction)
+ break; /* Stop if tried at original pos */
+ }
+
+ /* Get here if we can't make it match with any permitted repetitions */
+
+ RRETURN;
+ }
+ /* Control never reaches here */
+
+ BEGIN_OPCODE(CRMINPLUS):
+ BEGIN_OPCODE(CRMINQUERY):
+ BEGIN_OPCODE(CRMINRANGE):
+ BEGIN_OPCODE(CRMINSTAR):
+ BEGIN_OPCODE(CRPLUS):
+ BEGIN_OPCODE(CRQUERY):
+ BEGIN_OPCODE(CRRANGE):
+ BEGIN_OPCODE(CRSTAR):
+ ASSERT_NOT_REACHED();
+ return matchError(JSRegExpErrorInternal, stack);
+
+#ifdef USE_COMPUTED_GOTO_FOR_MATCH_OPCODE_LOOP
+ CAPTURING_BRACKET:
+#else
+ default:
+#endif
+ /* Opening capturing bracket. If there is space in the offset vector, save
+ the current subject position in the working slot at the top of the vector. We
+ mustn't change the current values of the data slot, because they may be set
+ from a previous iteration of this group, and be referred to by a reference
+ inside the group.
+
+ If the bracket fails to match, we need to restore this value and also the
+ values of the final offsets, in case they were set by a previous iteration of
+ the same bracket.
+
+ If there isn't enough space in the offset vector, treat this as if it were a
+ non-capturing bracket. Don't worry about setting the flag for the error case
+ here; that is handled in the code for KET. */
+
+ ASSERT(*stack.currentFrame->args.instructionPtr > OP_BRA);
+
+ stack.currentFrame->locals.number = *stack.currentFrame->args.instructionPtr - OP_BRA;
+
+ /* For extended extraction brackets (large number), we have to fish out the
+ number from a dummy opcode at the start. */
+
+ if (stack.currentFrame->locals.number > EXTRACT_BASIC_MAX)
+ stack.currentFrame->locals.number = get2ByteValue(stack.currentFrame->args.instructionPtr + 2 + LINK_SIZE);
+ stack.currentFrame->locals.offset = stack.currentFrame->locals.number << 1;
+
+#ifdef DEBUG
+ printf("start bracket %d subject=", stack.currentFrame->locals.number);
+ pchars(stack.currentFrame->args.subjectPtr, 16, true, md);
+ printf("\n");
+#endif
+
+ if (stack.currentFrame->locals.offset < md.offsetMax) {
+ stack.currentFrame->locals.saveOffset1 = md.offsetVector[stack.currentFrame->locals.offset];
+ stack.currentFrame->locals.saveOffset2 = md.offsetVector[stack.currentFrame->locals.offset + 1];
+ stack.currentFrame->locals.saveOffset3 = md.offsetVector[md.offsetEnd - stack.currentFrame->locals.number];
+
+ DPRINTF(("saving %d %d %d\n", stack.currentFrame->locals.saveOffset1, stack.currentFrame->locals.saveOffset2, stack.currentFrame->locals.saveOffset3));
+ md.offsetVector[md.offsetEnd - stack.currentFrame->locals.number] = stack.currentFrame->args.subjectPtr - md.startSubject;
+
+ do {
+ RECURSIVE_MATCH_NEW_GROUP(1, stack.currentFrame->args.instructionPtr + 1 + LINK_SIZE, stack.currentFrame->args.bracketChain);
+ if (isMatch)
+ RRETURN;
+ stack.currentFrame->args.instructionPtr += getLinkValue(stack.currentFrame->args.instructionPtr + 1);
+ } while (*stack.currentFrame->args.instructionPtr == OP_ALT);
+
+ DPRINTF(("bracket %d failed\n", stack.currentFrame->locals.number));
+
+ md.offsetVector[stack.currentFrame->locals.offset] = stack.currentFrame->locals.saveOffset1;
+ md.offsetVector[stack.currentFrame->locals.offset + 1] = stack.currentFrame->locals.saveOffset2;
+ md.offsetVector[md.offsetEnd - stack.currentFrame->locals.number] = stack.currentFrame->locals.saveOffset3;
+
+ RRETURN;
+ }
+
+ /* Insufficient room for saving captured contents */
+
+ goto NON_CAPTURING_BRACKET;
+ }
+
+ /* Do not stick any code in here without much thought; it is assumed
+ that "continue" in the code above comes out to here to repeat the main
+ loop. */
+
+ } /* End of main loop */
+
+ ASSERT_NOT_REACHED();
+
+#ifndef USE_COMPUTED_GOTO_FOR_MATCH_RECURSION
+
+RRETURN_SWITCH:
+ switch (stack.currentFrame->returnLocation) {
+ case 0: goto RETURN;
+ case 1: goto RRETURN_1;
+ case 2: goto RRETURN_2;
+ case 6: goto RRETURN_6;
+ case 7: goto RRETURN_7;
+ case 14: goto RRETURN_14;
+ case 15: goto RRETURN_15;
+ case 16: goto RRETURN_16;
+ case 17: goto RRETURN_17;
+ case 18: goto RRETURN_18;
+ case 19: goto RRETURN_19;
+ case 20: goto RRETURN_20;
+ case 21: goto RRETURN_21;
+ case 22: goto RRETURN_22;
+ case 24: goto RRETURN_24;
+ case 26: goto RRETURN_26;
+ case 27: goto RRETURN_27;
+ case 28: goto RRETURN_28;
+ case 29: goto RRETURN_29;
+ case 30: goto RRETURN_30;
+ case 31: goto RRETURN_31;
+ case 38: goto RRETURN_38;
+ case 40: goto RRETURN_40;
+ case 42: goto RRETURN_42;
+ case 44: goto RRETURN_44;
+ case 48: goto RRETURN_48;
+ case 52: goto RRETURN_52;
+ }
+
+ ASSERT_NOT_REACHED();
+ return matchError(JSRegExpErrorInternal, stack);
+
+#endif
+
+RETURN:
+ return isMatch;
+}
+
+
+/*************************************************
+* Execute a Regular Expression *
+*************************************************/
+
+/* This function applies a compiled re to a subject string and picks out
+portions of the string if it matches. Two elements in the vector are set for
+each substring: the offsets to the start and end of the substring.
+
+Arguments:
+ re points to the compiled expression
+ extra_data points to extra data or is NULL
+ subject points to the subject string
+ length length of subject string (may contain binary zeros)
+ start_offset where to start in the subject string
+ options option bits
+ offsets points to a vector of ints to be filled in with offsets
+ offsetCount the number of elements in the vector
+
+Returns: > 0 => success; value is the number of elements filled in
+ = 0 => success, but offsets is not big enough
+ -1 => failed to match
+ < -1 => some kind of unexpected problem
+*/
+
+static void tryFirstByteOptimization(const UChar*& subjectPtr, const UChar* endSubject, int firstByte, bool firstByteIsCaseless, bool useMultiLineFirstCharOptimization, const UChar* originalSubjectStart)
+{
+ // If firstByte is set, try scanning to the first instance of that byte
+ // no need to try and match against any earlier part of the subject string.
+ if (firstByte >= 0) {
+ UChar firstChar = firstByte;
+ if (firstByteIsCaseless)
+ while (subjectPtr < endSubject) {
+ int c = *subjectPtr;
+ if (c > 127)
+ break;
+ if (toLowerCase(c) == firstChar)
+ break;
+ subjectPtr++;
+ }
+ else {
+ while (subjectPtr < endSubject && *subjectPtr != firstChar)
+ subjectPtr++;
+ }
+ } else if (useMultiLineFirstCharOptimization) {
+ /* Or to just after \n for a multiline match if possible */
+ // I'm not sure why this != originalSubjectStart check is necessary -- ecs 11/18/07
+ if (subjectPtr > originalSubjectStart) {
+ while (subjectPtr < endSubject && !isNewline(subjectPtr[-1]))
+ subjectPtr++;
+ }
+ }
+}
+
+static bool tryRequiredByteOptimization(const UChar*& subjectPtr, const UChar* endSubject, int reqByte, int reqByte2, bool reqByteIsCaseless, bool hasFirstByte, const UChar*& reqBytePtr)
+{
+ /* If reqByte is set, we know that that character must appear in the subject
+ for the match to succeed. If the first character is set, reqByte must be
+ later in the subject; otherwise the test starts at the match point. This
+ optimization can save a huge amount of backtracking in patterns with nested
+ unlimited repeats that aren't going to match. Writing separate code for
+ cased/caseless versions makes it go faster, as does using an autoincrement
+ and backing off on a match.
+
+ HOWEVER: when the subject string is very, very long, searching to its end can
+ take a long time, and give bad performance on quite ordinary patterns. This
+ showed up when somebody was matching /^C/ on a 32-megabyte string... so we
+ don't do this when the string is sufficiently long.
+ */
+
+ if (reqByte >= 0 && endSubject - subjectPtr < REQ_BYTE_MAX) {
+ const UChar* p = subjectPtr + (hasFirstByte ? 1 : 0);
+
+ /* We don't need to repeat the search if we haven't yet reached the
+ place we found it at last time. */
+
+ if (p > reqBytePtr) {
+ if (reqByteIsCaseless) {
+ while (p < endSubject) {
+ int pp = *p++;
+ if (pp == reqByte || pp == reqByte2) {
+ p--;
+ break;
+ }
+ }
+ } else {
+ while (p < endSubject) {
+ if (*p++ == reqByte) {
+ p--;
+ break;
+ }
+ }
+ }
+
+ /* If we can't find the required character, break the matching loop */
+
+ if (p >= endSubject)
+ return true;
+
+ /* If we have found the required character, save the point where we
+ found it, so that we don't search again next time round the loop if
+ the start hasn't passed this character yet. */
+
+ reqBytePtr = p;
+ }
+ }
+ return false;
+}
+
+int jsRegExpExecute(const JSRegExp* re,
+ const UChar* subject, int length, int start_offset, int* offsets,
+ int offsetCount)
+{
+ ASSERT(re);
+ ASSERT(subject || !length);
+ ASSERT(offsetCount >= 0);
+ ASSERT(offsets || offsetCount == 0);
+
+ HistogramTimeLogger logger(re);
+
+ MatchData matchBlock;
+ matchBlock.startSubject = subject;
+ matchBlock.endSubject = matchBlock.startSubject + length;
+ const UChar* endSubject = matchBlock.endSubject;
+
+ matchBlock.multiline = (re->options & MatchAcrossMultipleLinesOption);
+ matchBlock.ignoreCase = (re->options & IgnoreCaseOption);
+
+ /* If the expression has got more back references than the offsets supplied can
+ hold, we get a temporary chunk of working store to use during the matching.
+ Otherwise, we can use the vector supplied, rounding down its size to a multiple
+ of 3. */
+
+ int ocount = offsetCount - (offsetCount % 3);
+
+ // FIXME: This is lame that we have to second-guess our caller here.
+ // The API should change to either fail-hard when we don't have enough offset space
+ // or that we shouldn't ask our callers to pre-allocate in the first place.
+ bool usingTemporaryOffsets = false;
+ if (re->topBackref > 0 && re->topBackref >= ocount/3) {
+ ocount = re->topBackref * 3 + 3;
+ matchBlock.offsetVector = new int[ocount];
+ if (!matchBlock.offsetVector)
+ return JSRegExpErrorNoMemory;
+ usingTemporaryOffsets = true;
+ } else
+ matchBlock.offsetVector = offsets;
+
+ matchBlock.offsetEnd = ocount;
+ matchBlock.offsetMax = (2*ocount)/3;
+ matchBlock.offsetOverflow = false;
+
+ /* Compute the minimum number of offsets that we need to reset each time. Doing
+ this makes a huge difference to execution time when there aren't many brackets
+ in the pattern. */
+
+ int resetCount = 2 + re->topBracket * 2;
+ if (resetCount > offsetCount)
+ resetCount = ocount;
+
+ /* Reset the working variable associated with each extraction. These should
+ never be used unless previously set, but they get saved and restored, and so we
+ initialize them to avoid reading uninitialized locations. */
+
+ if (matchBlock.offsetVector) {
+ int* iptr = matchBlock.offsetVector + ocount;
+ int* iend = iptr - resetCount/2 + 1;
+ while (--iptr >= iend)
+ *iptr = -1;
+ }
+
+ /* Set up the first character to match, if available. The firstByte value is
+ never set for an anchored regular expression, but the anchoring may be forced
+ at run time, so we have to test for anchoring. The first char may be unset for
+ an unanchored pattern, of course. If there's no first char and the pattern was
+ studied, there may be a bitmap of possible first characters. */
+
+ bool firstByteIsCaseless = false;
+ int firstByte = -1;
+ if (re->options & UseFirstByteOptimizationOption) {
+ firstByte = re->firstByte & 255;
+ if ((firstByteIsCaseless = (re->firstByte & REQ_IGNORE_CASE)))
+ firstByte = toLowerCase(firstByte);
+ }
+
+ /* For anchored or unanchored matches, there may be a "last known required
+ character" set. */
+
+ bool reqByteIsCaseless = false;
+ int reqByte = -1;
+ int reqByte2 = -1;
+ if (re->options & UseRequiredByteOptimizationOption) {
+ reqByte = re->reqByte & 255; // FIXME: This optimization could be made to work for UTF16 chars as well...
+ reqByteIsCaseless = (re->reqByte & REQ_IGNORE_CASE);
+ reqByte2 = flipCase(reqByte);
+ }
+
+ /* Loop for handling unanchored repeated matching attempts; for anchored regexs
+ the loop runs just once. */
+
+ const UChar* startMatch = subject + start_offset;
+ const UChar* reqBytePtr = startMatch - 1;
+ bool useMultiLineFirstCharOptimization = re->options & UseMultiLineFirstByteOptimizationOption;
+
+ do {
+ /* Reset the maximum number of extractions we might see. */
+ if (matchBlock.offsetVector) {
+ int* iptr = matchBlock.offsetVector;
+ int* iend = iptr + resetCount;
+ while (iptr < iend)
+ *iptr++ = -1;
+ }
+
+ tryFirstByteOptimization(startMatch, endSubject, firstByte, firstByteIsCaseless, useMultiLineFirstCharOptimization, matchBlock.startSubject + start_offset);
+ if (tryRequiredByteOptimization(startMatch, endSubject, reqByte, reqByte2, reqByteIsCaseless, firstByte >= 0, reqBytePtr))
+ break;
+
+ /* When a match occurs, substrings will be set for all internal extractions;
+ we just need to set up the whole thing as substring 0 before returning. If
+ there were too many extractions, set the return code to zero. In the case
+ where we had to get some local store to hold offsets for backreferences, copy
+ those back references that we can. In this case there need not be overflow
+ if certain parts of the pattern were not used. */
+
+ /* The code starts after the JSRegExp block and the capture name table. */
+ const unsigned char* start_code = (const unsigned char*)(re + 1);
+
+ int returnCode = match(startMatch, start_code, 2, matchBlock);
+
+ /* When the result is no match, advance the pointer to the next character
+ and continue. */
+ if (returnCode == 0) {
+ startMatch++;
+ continue;
+ }
+
+ if (returnCode != 1) {
+ ASSERT(returnCode == JSRegExpErrorHitLimit || returnCode == JSRegExpErrorNoMemory);
+ DPRINTF((">>>> error: returning %d\n", returnCode));
+ return returnCode;
+ }
+
+ /* We have a match! Copy the offset information from temporary store if
+ necessary */
+
+ if (usingTemporaryOffsets) {
+ if (offsetCount >= 4) {
+ memcpy(offsets + 2, matchBlock.offsetVector + 2, (offsetCount - 2) * sizeof(int));
+ DPRINTF(("Copied offsets from temporary memory\n"));
+ }
+ if (matchBlock.endOffsetTop > offsetCount)
+ matchBlock.offsetOverflow = true;
+
+ DPRINTF(("Freeing temporary memory\n"));
+ delete [] matchBlock.offsetVector;
+ }
+
+ returnCode = matchBlock.offsetOverflow ? 0 : matchBlock.endOffsetTop / 2;
+
+ if (offsetCount < 2)
+ returnCode = 0;
+ else {
+ offsets[0] = startMatch - matchBlock.startSubject;
+ offsets[1] = matchBlock.endMatchPtr - matchBlock.startSubject;
+ }
+
+ DPRINTF((">>>> returning %d\n", returnCode));
+ return returnCode;
+ } while (!(re->options & IsAnchoredOption) && startMatch <= endSubject);
+
+ if (usingTemporaryOffsets) {
+ DPRINTF(("Freeing temporary memory\n"));
+ delete [] matchBlock.offsetVector;
+ }
+
+ DPRINTF((">>>> returning PCRE_ERROR_NOMATCH\n"));
+ return JSRegExpErrorNoMatch;
+}
+
+#if REGEXP_HISTOGRAM
+
+class CompareHistogramEntries {
+public:
+ bool operator()(const pair<UString, double>& a, const pair<UString, double>& b)
+ {
+ if (a.second == b.second)
+ return a.first < b.first;
+ return a.second < b.second;
+ }
+};
+
+Histogram::~Histogram()
+{
+ Vector<pair<UString, double> > values;
+ Map::iterator end = times.end();
+ for (Map::iterator it = times.begin(); it != end; ++it)
+ values.append(*it);
+ sort(values.begin(), values.end(), CompareHistogramEntries());
+ size_t size = values.size();
+ printf("Regular Expressions, sorted by time spent evaluating them:\n");
+ for (size_t i = 0; i < size; ++i)
+ printf(" %f - %s\n", values[size - i - 1].second, values[size - i - 1].first.utf8().c_str());
+}
+
+void Histogram::add(const JSRegExp* re, double elapsedTime)
+{
+ UString string(reinterpret_cast<const UChar*>(reinterpret_cast<const char*>(re) + re->stringOffset), re->stringLength);
+ if (re->options & IgnoreCaseOption && re->options & MatchAcrossMultipleLinesOption)
+ string += " (multi-line, ignore case)";
+ else {
+ if (re->options & IgnoreCaseOption)
+ string += " (ignore case)";
+ if (re->options & MatchAcrossMultipleLinesOption)
+ string += " (multi-line)";
+ }
+ pair<Map::iterator, bool> result = times.add(string.impl(), elapsedTime);
+ if (!result.second)
+ result.first->second += elapsedTime;
+}
+
+HistogramTimeLogger::HistogramTimeLogger(const JSRegExp* re)
+ : m_re(re)
+ , m_startTime(currentTimeMS())
+{
+}
+
+HistogramTimeLogger::~HistogramTimeLogger()
+{
+ static Histogram histogram;
+ histogram.add(m_re, currentTimeMS() - m_startTime);
+}
+
+#endif
diff --git a/Source/JavaScriptCore/pcre/pcre_internal.h b/Source/JavaScriptCore/pcre/pcre_internal.h
new file mode 100644
index 0000000..0016bb5
--- /dev/null
+++ b/Source/JavaScriptCore/pcre/pcre_internal.h
@@ -0,0 +1,455 @@
+/* This is JavaScriptCore's variant of the PCRE library. While this library
+started out as a copy of PCRE, many of the features of PCRE have been
+removed. This library now supports only the regular expression features
+required by the JavaScript language specification, and has only the functions
+needed by JavaScriptCore and the rest of WebKit.
+
+ Originally written by Philip Hazel
+ Copyright (c) 1997-2006 University of Cambridge
+ Copyright (C) 2002, 2004, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+
+-----------------------------------------------------------------------------
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the name of the University of Cambridge nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+-----------------------------------------------------------------------------
+*/
+
+/* This header contains definitions that are shared between the different
+modules, but which are not relevant to the exported API. This includes some
+functions whose names all begin with "_pcre_". */
+
+#ifndef PCRE_INTERNAL_H
+#define PCRE_INTERNAL_H
+
+/* Bit definitions for entries in the pcre_ctypes table. */
+
+#define ctype_space 0x01
+#define ctype_xdigit 0x08
+#define ctype_word 0x10 /* alphameric or '_' */
+
+/* Offsets for the bitmap tables in pcre_cbits. Each table contains a set
+of bits for a class map. Some classes are built by combining these tables. */
+
+#define cbit_space 0 /* \s */
+#define cbit_digit 32 /* \d */
+#define cbit_word 64 /* \w */
+#define cbit_length 96 /* Length of the cbits table */
+
+/* Offsets of the various tables from the base tables pointer, and
+total length. */
+
+#define lcc_offset 0
+#define fcc_offset 128
+#define cbits_offset 256
+#define ctypes_offset (cbits_offset + cbit_length)
+#define tables_length (ctypes_offset + 128)
+
+#ifndef DFTABLES
+
+// Change the following to 1 to dump used regular expressions at process exit time.
+#define REGEXP_HISTOGRAM 0
+
+#include "Assertions.h"
+
+#if COMPILER(MSVC)
+#pragma warning(disable: 4232)
+#pragma warning(disable: 4244)
+#endif
+
+#include "pcre.h"
+
+/* The value of LINK_SIZE determines the number of bytes used to store links as
+offsets within the compiled regex. The default is 2, which allows for compiled
+patterns up to 64K long. */
+
+#define LINK_SIZE 3
+
+/* Define DEBUG to get debugging output on stdout. */
+
+#if 0
+#define DEBUG
+#endif
+
+/* Use a macro for debugging printing, 'cause that eliminates the use of #ifdef
+inline, and there are *still* stupid compilers about that don't like indented
+pre-processor statements, or at least there were when I first wrote this. After
+all, it had only been about 10 years then... */
+
+#ifdef DEBUG
+#define DPRINTF(p) printf p
+#else
+#define DPRINTF(p) /*nothing*/
+#endif
+
+/* PCRE keeps offsets in its compiled code as 2-byte quantities (always stored
+in big-endian order) by default. These are used, for example, to link from the
+start of a subpattern to its alternatives and its end. The use of 2 bytes per
+offset limits the size of the compiled regex to around 64K, which is big enough
+for almost everybody. However, I received a request for an even bigger limit.
+For this reason, and also to make the code easier to maintain, the storing and
+loading of offsets from the byte string is now handled by the functions that are
+defined here. */
+
+/* PCRE uses some other 2-byte quantities that do not change when the size of
+offsets changes. There are used for repeat counts and for other things such as
+capturing parenthesis numbers in back references. */
+
+static inline void put2ByteValue(unsigned char* opcodePtr, int value)
+{
+ ASSERT(value >= 0 && value <= 0xFFFF);
+ opcodePtr[0] = value >> 8;
+ opcodePtr[1] = value;
+}
+
+static inline void put3ByteValue(unsigned char* opcodePtr, int value)
+{
+ ASSERT(value >= 0 && value <= 0xFFFFFF);
+ opcodePtr[0] = value >> 16;
+ opcodePtr[1] = value >> 8;
+ opcodePtr[2] = value;
+}
+
+static inline int get2ByteValue(const unsigned char* opcodePtr)
+{
+ return (opcodePtr[0] << 8) | opcodePtr[1];
+}
+
+static inline int get3ByteValue(const unsigned char* opcodePtr)
+{
+ return (opcodePtr[0] << 16) | (opcodePtr[1] << 8) | opcodePtr[2];
+}
+
+static inline void put2ByteValueAndAdvance(unsigned char*& opcodePtr, int value)
+{
+ put2ByteValue(opcodePtr, value);
+ opcodePtr += 2;
+}
+
+static inline void put3ByteValueAndAdvance(unsigned char*& opcodePtr, int value)
+{
+ put3ByteValue(opcodePtr, value);
+ opcodePtr += 3;
+}
+
+static inline void putLinkValueAllowZero(unsigned char* opcodePtr, int value)
+{
+#if LINK_SIZE == 3
+ put3ByteValue(opcodePtr, value);
+#elif LINK_SIZE == 2
+ put2ByteValue(opcodePtr, value);
+#else
+# error LINK_SIZE not supported.
+#endif
+}
+
+static inline int getLinkValueAllowZero(const unsigned char* opcodePtr)
+{
+#if LINK_SIZE == 3
+ return get3ByteValue(opcodePtr);
+#elif LINK_SIZE == 2
+ return get2ByteValue(opcodePtr);
+#else
+# error LINK_SIZE not supported.
+#endif
+}
+
+#define MAX_PATTERN_SIZE 1024 * 1024 // Derived by empirical testing of compile time in PCRE and WREC.
+COMPILE_ASSERT(MAX_PATTERN_SIZE < (1 << (8 * LINK_SIZE)), pcre_max_pattern_fits_in_bytecode);
+
+static inline void putLinkValue(unsigned char* opcodePtr, int value)
+{
+ ASSERT(value);
+ putLinkValueAllowZero(opcodePtr, value);
+}
+
+static inline int getLinkValue(const unsigned char* opcodePtr)
+{
+ int value = getLinkValueAllowZero(opcodePtr);
+ ASSERT(value);
+ return value;
+}
+
+static inline void putLinkValueAndAdvance(unsigned char*& opcodePtr, int value)
+{
+ putLinkValue(opcodePtr, value);
+ opcodePtr += LINK_SIZE;
+}
+
+static inline void putLinkValueAllowZeroAndAdvance(unsigned char*& opcodePtr, int value)
+{
+ putLinkValueAllowZero(opcodePtr, value);
+ opcodePtr += LINK_SIZE;
+}
+
+// FIXME: These are really more of a "compiled regexp state" than "regexp options"
+enum RegExpOptions {
+ UseFirstByteOptimizationOption = 0x40000000, /* firstByte is set */
+ UseRequiredByteOptimizationOption = 0x20000000, /* reqByte is set */
+ UseMultiLineFirstByteOptimizationOption = 0x10000000, /* start after \n for multiline */
+ IsAnchoredOption = 0x02000000, /* can't use partial with this regex */
+ IgnoreCaseOption = 0x00000001,
+ MatchAcrossMultipleLinesOption = 0x00000002
+};
+
+/* Flags added to firstByte or reqByte; a "non-literal" item is either a
+variable-length repeat, or a anything other than literal characters. */
+
+#define REQ_IGNORE_CASE 0x0100 /* indicates should ignore case */
+#define REQ_VARY 0x0200 /* reqByte followed non-literal item */
+
+/* Miscellaneous definitions */
+
+/* Flag bits and data types for the extended class (OP_XCLASS) for classes that
+contain UTF-8 characters with values greater than 255. */
+
+#define XCL_NOT 0x01 /* Flag: this is a negative class */
+#define XCL_MAP 0x02 /* Flag: a 32-byte map is present */
+
+#define XCL_END 0 /* Marks end of individual items */
+#define XCL_SINGLE 1 /* Single item (one multibyte char) follows */
+#define XCL_RANGE 2 /* A range (two multibyte chars) follows */
+
+/* These are escaped items that aren't just an encoding of a particular data
+value such as \n. They must have non-zero values, as check_escape() returns
+their negation. Also, they must appear in the same order as in the opcode
+definitions below, up to ESC_w. The final one must be
+ESC_REF as subsequent values are used for \1, \2, \3, etc. There is are two
+tests in the code for an escape > ESC_b and <= ESC_w to
+detect the types that may be repeated. These are the types that consume
+characters. If any new escapes are put in between that don't consume a
+character, that code will have to change. */
+
+enum { ESC_B = 1, ESC_b, ESC_D, ESC_d, ESC_S, ESC_s, ESC_W, ESC_w, ESC_REF };
+
+/* Opcode table: OP_BRA must be last, as all values >= it are used for brackets
+that extract substrings. Starting from 1 (i.e. after OP_END), the values up to
+OP_EOD must correspond in order to the list of escapes immediately above.
+Note that whenever this list is updated, the two macro definitions that follow
+must also be updated to match. */
+
+#define FOR_EACH_OPCODE(macro) \
+ macro(END) \
+ \
+ macro(NOT_WORD_BOUNDARY) \
+ macro(WORD_BOUNDARY) \
+ macro(NOT_DIGIT) \
+ macro(DIGIT) \
+ macro(NOT_WHITESPACE) \
+ macro(WHITESPACE) \
+ macro(NOT_WORDCHAR) \
+ macro(WORDCHAR) \
+ \
+ macro(NOT_NEWLINE) \
+ \
+ macro(CIRC) \
+ macro(DOLL) \
+ macro(BOL) \
+ macro(EOL) \
+ macro(CHAR) \
+ macro(CHAR_IGNORING_CASE) \
+ macro(ASCII_CHAR) \
+ macro(ASCII_LETTER_IGNORING_CASE) \
+ macro(NOT) \
+ \
+ macro(STAR) \
+ macro(MINSTAR) \
+ macro(PLUS) \
+ macro(MINPLUS) \
+ macro(QUERY) \
+ macro(MINQUERY) \
+ macro(UPTO) \
+ macro(MINUPTO) \
+ macro(EXACT) \
+ \
+ macro(NOTSTAR) \
+ macro(NOTMINSTAR) \
+ macro(NOTPLUS) \
+ macro(NOTMINPLUS) \
+ macro(NOTQUERY) \
+ macro(NOTMINQUERY) \
+ macro(NOTUPTO) \
+ macro(NOTMINUPTO) \
+ macro(NOTEXACT) \
+ \
+ macro(TYPESTAR) \
+ macro(TYPEMINSTAR) \
+ macro(TYPEPLUS) \
+ macro(TYPEMINPLUS) \
+ macro(TYPEQUERY) \
+ macro(TYPEMINQUERY) \
+ macro(TYPEUPTO) \
+ macro(TYPEMINUPTO) \
+ macro(TYPEEXACT) \
+ \
+ macro(CRSTAR) \
+ macro(CRMINSTAR) \
+ macro(CRPLUS) \
+ macro(CRMINPLUS) \
+ macro(CRQUERY) \
+ macro(CRMINQUERY) \
+ macro(CRRANGE) \
+ macro(CRMINRANGE) \
+ \
+ macro(CLASS) \
+ macro(NCLASS) \
+ macro(XCLASS) \
+ \
+ macro(REF) \
+ \
+ macro(ALT) \
+ macro(KET) \
+ macro(KETRMAX) \
+ macro(KETRMIN) \
+ \
+ macro(ASSERT) \
+ macro(ASSERT_NOT) \
+ \
+ macro(BRAZERO) \
+ macro(BRAMINZERO) \
+ macro(BRANUMBER) \
+ macro(BRA)
+
+#define OPCODE_ENUM_VALUE(opcode) OP_##opcode,
+enum { FOR_EACH_OPCODE(OPCODE_ENUM_VALUE) };
+
+/* WARNING WARNING WARNING: There is an implicit assumption in pcre.c and
+study.c that all opcodes are less than 128 in value. This makes handling UTF-8
+character sequences easier. */
+
+/* The highest extraction number before we have to start using additional
+bytes. (Originally PCRE didn't have support for extraction counts higher than
+this number.) The value is limited by the number of opcodes left after OP_BRA,
+i.e. 255 - OP_BRA. We actually set it a bit lower to leave room for additional
+opcodes. */
+
+/* FIXME: Note that OP_BRA + 100 is > 128, so the two comments above
+are in conflict! */
+
+#define EXTRACT_BASIC_MAX 100
+
+/* The code vector runs on as long as necessary after the end. */
+
+struct JSRegExp {
+ unsigned options;
+
+ unsigned short topBracket;
+ unsigned short topBackref;
+
+ unsigned short firstByte;
+ unsigned short reqByte;
+
+#if REGEXP_HISTOGRAM
+ size_t stringOffset;
+ size_t stringLength;
+#endif
+};
+
+/* Internal shared data tables. These are tables that are used by more than one
+ of the exported public functions. They have to be "external" in the C sense,
+ but are not part of the PCRE public API. The data for these tables is in the
+ pcre_tables.c module. */
+
+#define jsc_pcre_utf8_table1_size 6
+
+extern const int jsc_pcre_utf8_table1[6];
+extern const int jsc_pcre_utf8_table2[6];
+extern const int jsc_pcre_utf8_table3[6];
+extern const unsigned char jsc_pcre_utf8_table4[0x40];
+
+extern const unsigned char jsc_pcre_default_tables[tables_length];
+
+static inline unsigned char toLowerCase(unsigned char c)
+{
+ static const unsigned char* lowerCaseChars = jsc_pcre_default_tables + lcc_offset;
+ return lowerCaseChars[c];
+}
+
+static inline unsigned char flipCase(unsigned char c)
+{
+ static const unsigned char* flippedCaseChars = jsc_pcre_default_tables + fcc_offset;
+ return flippedCaseChars[c];
+}
+
+static inline unsigned char classBitmapForChar(unsigned char c)
+{
+ static const unsigned char* charClassBitmaps = jsc_pcre_default_tables + cbits_offset;
+ return charClassBitmaps[c];
+}
+
+static inline unsigned char charTypeForChar(unsigned char c)
+{
+ const unsigned char* charTypeMap = jsc_pcre_default_tables + ctypes_offset;
+ return charTypeMap[c];
+}
+
+static inline bool isWordChar(UChar c)
+{
+ return c < 128 && (charTypeForChar(c) & ctype_word);
+}
+
+static inline bool isSpaceChar(UChar c)
+{
+ return (c < 128 && (charTypeForChar(c) & ctype_space)) || c == 0x00A0;
+}
+
+static inline bool isNewline(UChar nl)
+{
+ return (nl == 0xA || nl == 0xD || nl == 0x2028 || nl == 0x2029);
+}
+
+static inline bool isBracketStartOpcode(unsigned char opcode)
+{
+ if (opcode >= OP_BRA)
+ return true;
+ switch (opcode) {
+ case OP_ASSERT:
+ case OP_ASSERT_NOT:
+ return true;
+ default:
+ return false;
+ }
+}
+
+static inline void advanceToEndOfBracket(const unsigned char*& opcodePtr)
+{
+ ASSERT(isBracketStartOpcode(*opcodePtr) || *opcodePtr == OP_ALT);
+ do
+ opcodePtr += getLinkValue(opcodePtr + 1);
+ while (*opcodePtr == OP_ALT);
+}
+
+/* Internal shared functions. These are functions that are used in more
+that one of the source files. They have to have external linkage, but
+but are not part of the public API and so not exported from the library. */
+
+extern int jsc_pcre_ucp_othercase(unsigned);
+extern bool jsc_pcre_xclass(int, const unsigned char*);
+
+#endif
+
+#endif
+
+/* End of pcre_internal.h */
diff --git a/Source/JavaScriptCore/pcre/pcre_tables.cpp b/Source/JavaScriptCore/pcre/pcre_tables.cpp
new file mode 100644
index 0000000..8696879
--- /dev/null
+++ b/Source/JavaScriptCore/pcre/pcre_tables.cpp
@@ -0,0 +1,72 @@
+/* This is JavaScriptCore's variant of the PCRE library. While this library
+started out as a copy of PCRE, many of the features of PCRE have been
+removed. This library now supports only the regular expression features
+required by the JavaScript language specification, and has only the functions
+needed by JavaScriptCore and the rest of WebKit.
+
+ Originally written by Philip Hazel
+ Copyright (c) 1997-2006 University of Cambridge
+ Copyright (C) 2002, 2004, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+
+-----------------------------------------------------------------------------
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the name of the University of Cambridge nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+-----------------------------------------------------------------------------
+*/
+
+/* This module contains some fixed tables that are used by more than one of the
+PCRE code modules. */
+
+#include "config.h"
+#include "pcre_internal.h"
+
+/*************************************************
+* Tables for UTF-8 support *
+*************************************************/
+
+/* These are the breakpoints for different numbers of bytes in a UTF-8
+character. */
+
+const int jsc_pcre_utf8_table1[6] =
+ { 0x7f, 0x7ff, 0xffff, 0x1fffff, 0x3ffffff, 0x7fffffff};
+
+/* These are the indicator bits and the mask for the data bits to set in the
+first byte of a character, indexed by the number of additional bytes. */
+
+const int jsc_pcre_utf8_table2[6] = { 0, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc};
+const int jsc_pcre_utf8_table3[6] = { 0xff, 0x1f, 0x0f, 0x07, 0x03, 0x01};
+
+/* Table of the number of extra characters, indexed by the first character
+masked with 0x3f. The highest number for a valid UTF-8 character is in fact
+0x3d. */
+
+const unsigned char jsc_pcre_utf8_table4[0x40] = {
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
+ 3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5 };
+
+#include "chartables.c"
diff --git a/Source/JavaScriptCore/pcre/pcre_ucp_searchfuncs.cpp b/Source/JavaScriptCore/pcre/pcre_ucp_searchfuncs.cpp
new file mode 100644
index 0000000..d2052b2
--- /dev/null
+++ b/Source/JavaScriptCore/pcre/pcre_ucp_searchfuncs.cpp
@@ -0,0 +1,99 @@
+/* This is JavaScriptCore's variant of the PCRE library. While this library
+started out as a copy of PCRE, many of the features of PCRE have been
+removed. This library now supports only the regular expression features
+required by the JavaScript language specification, and has only the functions
+needed by JavaScriptCore and the rest of WebKit.
+
+ Originally written by Philip Hazel
+ Copyright (c) 1997-2006 University of Cambridge
+ Copyright (C) 2002, 2004, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+
+-----------------------------------------------------------------------------
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the name of the University of Cambridge nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+-----------------------------------------------------------------------------
+*/
+
+
+/* This module contains code for searching the table of Unicode character
+properties. */
+
+#include "config.h"
+#include "pcre_internal.h"
+
+#include "ucpinternal.h" /* Internal table details */
+#include "ucptable.cpp" /* The table itself */
+
+/*************************************************
+* Search table and return other case *
+*************************************************/
+
+/* If the given character is a letter, and there is another case for the
+letter, return the other case. Otherwise, return -1.
+
+Arguments:
+ c the character value
+
+Returns: the other case or -1 if none
+*/
+
+int jsc_pcre_ucp_othercase(unsigned c)
+{
+ int bot = 0;
+ int top = sizeof(ucp_table) / sizeof(cnode);
+ int mid;
+
+ /* The table is searched using a binary chop. You might think that using
+ intermediate variables to hold some of the common expressions would speed
+ things up, but tests with gcc 3.4.4 on Linux showed that, on the contrary, it
+ makes things a lot slower. */
+
+ for (;;) {
+ if (top <= bot)
+ return -1;
+ mid = (bot + top) >> 1;
+ if (c == (ucp_table[mid].f0 & f0_charmask))
+ break;
+ if (c < (ucp_table[mid].f0 & f0_charmask))
+ top = mid;
+ else {
+ if ((ucp_table[mid].f0 & f0_rangeflag) && (c <= (ucp_table[mid].f0 & f0_charmask) + (ucp_table[mid].f1 & f1_rangemask)))
+ break;
+ bot = mid + 1;
+ }
+ }
+
+ /* Found an entry in the table. Return -1 for a range entry. Otherwise return
+ the other case if there is one, else -1. */
+
+ if (ucp_table[mid].f0 & f0_rangeflag)
+ return -1;
+
+ int offset = ucp_table[mid].f1 & f1_casemask;
+ if (offset & f1_caseneg)
+ offset |= f1_caseneg;
+ return !offset ? -1 : static_cast<int>(c + offset);
+}
diff --git a/Source/JavaScriptCore/pcre/pcre_xclass.cpp b/Source/JavaScriptCore/pcre/pcre_xclass.cpp
new file mode 100644
index 0000000..a32edd4
--- /dev/null
+++ b/Source/JavaScriptCore/pcre/pcre_xclass.cpp
@@ -0,0 +1,115 @@
+/* This is JavaScriptCore's variant of the PCRE library. While this library
+started out as a copy of PCRE, many of the features of PCRE have been
+removed. This library now supports only the regular expression features
+required by the JavaScript language specification, and has only the functions
+needed by JavaScriptCore and the rest of WebKit.
+
+ Originally written by Philip Hazel
+ Copyright (c) 1997-2006 University of Cambridge
+ Copyright (C) 2002, 2004, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+
+-----------------------------------------------------------------------------
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the name of the University of Cambridge nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+-----------------------------------------------------------------------------
+*/
+
+/* This module contains an internal function that is used to match an extended
+class (one that contains characters whose values are > 255). */
+
+#include "config.h"
+#include "pcre_internal.h"
+
+/*************************************************
+* Match character against an XCLASS *
+*************************************************/
+
+/* This function is called to match a character against an extended class that
+might contain values > 255.
+
+Arguments:
+ c the character
+ data points to the flag byte of the XCLASS data
+
+Returns: true if character matches, else false
+*/
+
+/* Get the next UTF-8 character, advancing the pointer. This is called when we
+ know we are in UTF-8 mode. */
+
+static inline void getUTF8CharAndAdvancePointer(int& c, const unsigned char*& subjectPtr)
+{
+ c = *subjectPtr++;
+ if ((c & 0xc0) == 0xc0) {
+ int gcaa = jsc_pcre_utf8_table4[c & 0x3f]; /* Number of additional bytes */
+ int gcss = 6 * gcaa;
+ c = (c & jsc_pcre_utf8_table3[gcaa]) << gcss;
+ while (gcaa-- > 0) {
+ gcss -= 6;
+ c |= (*subjectPtr++ & 0x3f) << gcss;
+ }
+ }
+}
+
+bool jsc_pcre_xclass(int c, const unsigned char* data)
+{
+ bool negated = (*data & XCL_NOT);
+
+ /* Character values < 256 are matched against a bitmap, if one is present. If
+ not, we still carry on, because there may be ranges that start below 256 in the
+ additional data. */
+
+ if (c < 256) {
+ if ((*data & XCL_MAP) != 0 && (data[1 + c/8] & (1 << (c&7))) != 0)
+ return !negated; /* char found */
+ }
+
+ /* First skip the bit map if present. Then match against the list of Unicode
+ properties or large chars or ranges that end with a large char. We won't ever
+ encounter XCL_PROP or XCL_NOTPROP when UCP support is not compiled. */
+
+ if ((*data++ & XCL_MAP) != 0)
+ data += 32;
+
+ int t;
+ while ((t = *data++) != XCL_END) {
+ if (t == XCL_SINGLE) {
+ int x;
+ getUTF8CharAndAdvancePointer(x, data);
+ if (c == x)
+ return !negated;
+ }
+ else if (t == XCL_RANGE) {
+ int x, y;
+ getUTF8CharAndAdvancePointer(x, data);
+ getUTF8CharAndAdvancePointer(y, data);
+ if (c >= x && c <= y)
+ return !negated;
+ }
+ }
+
+ return negated; /* char did not match */
+}
diff --git a/Source/JavaScriptCore/pcre/ucpinternal.h b/Source/JavaScriptCore/pcre/ucpinternal.h
new file mode 100644
index 0000000..c8bc4aa
--- /dev/null
+++ b/Source/JavaScriptCore/pcre/ucpinternal.h
@@ -0,0 +1,126 @@
+/* This is JavaScriptCore's variant of the PCRE library. While this library
+started out as a copy of PCRE, many of the features of PCRE have been
+removed. This library now supports only the regular expression features
+required by the JavaScript language specification, and has only the functions
+needed by JavaScriptCore and the rest of WebKit.
+
+ Originally written by Philip Hazel
+ Copyright (c) 1997-2006 University of Cambridge
+ Copyright (C) 2002, 2004, 2006, 2007 Apple Inc. All rights reserved.
+
+-----------------------------------------------------------------------------
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the name of the University of Cambridge nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+-----------------------------------------------------------------------------
+*/
+
+/*************************************************
+* Unicode Property Table handler *
+*************************************************/
+
+/* Internal header file defining the layout of the bits in each pair of 32-bit
+words that form a data item in the table. */
+
+typedef struct cnode {
+ unsigned f0;
+ unsigned f1;
+} cnode;
+
+/* Things for the f0 field */
+
+#define f0_scriptmask 0xff000000 /* Mask for script field */
+#define f0_scriptshift 24 /* Shift for script value */
+#define f0_rangeflag 0x00f00000 /* Flag for a range item */
+#define f0_charmask 0x001fffff /* Mask for code point value */
+
+/* Things for the f1 field */
+
+#define f1_typemask 0xfc000000 /* Mask for char type field */
+#define f1_typeshift 26 /* Shift for the type field */
+#define f1_rangemask 0x0000ffff /* Mask for a range offset */
+#define f1_casemask 0x0000ffff /* Mask for a case offset */
+#define f1_caseneg 0xffff8000 /* Bits for negation */
+
+/* The data consists of a vector of structures of type cnode. The two unsigned
+32-bit integers are used as follows:
+
+(f0) (1) The most significant byte holds the script number. The numbers are
+ defined by the enum in ucp.h.
+
+ (2) The 0x00800000 bit is set if this entry defines a range of characters.
+ It is not set if this entry defines a single character
+
+ (3) The 0x00600000 bits are spare.
+
+ (4) The 0x001fffff bits contain the code point. No Unicode code point will
+ ever be greater than 0x0010ffff, so this should be OK for ever.
+
+(f1) (1) The 0xfc000000 bits contain the character type number. The numbers are
+ defined by an enum in ucp.h.
+
+ (2) The 0x03ff0000 bits are spare.
+
+ (3) The 0x0000ffff bits contain EITHER the unsigned offset to the top of
+ range if this entry defines a range, OR the *signed* offset to the
+ character's "other case" partner if this entry defines a single
+ character. There is no partner if the value is zero.
+
+-------------------------------------------------------------------------------
+| script (8) |.|.|.| codepoint (21) || type (6) |.|.| spare (8) | offset (16) |
+-------------------------------------------------------------------------------
+ | | | | |
+ | | |-> spare | |-> spare
+ | | |
+ | |-> spare |-> spare
+ |
+ |-> range flag
+
+The upper/lower casing information is set only for characters that come in
+pairs. The non-one-to-one mappings in the Unicode data are ignored.
+
+When searching the data, proceed as follows:
+
+(1) Set up for a binary chop search.
+
+(2) If the top is not greater than the bottom, the character is not in the
+ table. Its type must therefore be "Cn" ("Undefined").
+
+(3) Find the middle vector element.
+
+(4) Extract the code point and compare. If equal, we are done.
+
+(5) If the test character is smaller, set the top to the current point, and
+ goto (2).
+
+(6) If the current entry defines a range, compute the last character by adding
+ the offset, and see if the test character is within the range. If it is,
+ we are done.
+
+(7) Otherwise, set the bottom to one element past the current point and goto
+ (2).
+*/
+
+/* End of ucpinternal.h */
diff --git a/Source/JavaScriptCore/pcre/ucptable.cpp b/Source/JavaScriptCore/pcre/ucptable.cpp
new file mode 100644
index 0000000..011f7f5
--- /dev/null
+++ b/Source/JavaScriptCore/pcre/ucptable.cpp
@@ -0,0 +1,2968 @@
+/* This source module is automatically generated from the Unicode
+property table. See ucpinternal.h for a description of the layout. */
+
+static const cnode ucp_table[] = {
+ { 0x09800000, 0x0000001f },
+ { 0x09000020, 0x74000000 },
+ { 0x09800021, 0x54000002 },
+ { 0x09000024, 0x5c000000 },
+ { 0x09800025, 0x54000002 },
+ { 0x09000028, 0x58000000 },
+ { 0x09000029, 0x48000000 },
+ { 0x0900002a, 0x54000000 },
+ { 0x0900002b, 0x64000000 },
+ { 0x0900002c, 0x54000000 },
+ { 0x0900002d, 0x44000000 },
+ { 0x0980002e, 0x54000001 },
+ { 0x09800030, 0x34000009 },
+ { 0x0980003a, 0x54000001 },
+ { 0x0980003c, 0x64000002 },
+ { 0x0980003f, 0x54000001 },
+ { 0x21000041, 0x24000020 },
+ { 0x21000042, 0x24000020 },
+ { 0x21000043, 0x24000020 },
+ { 0x21000044, 0x24000020 },
+ { 0x21000045, 0x24000020 },
+ { 0x21000046, 0x24000020 },
+ { 0x21000047, 0x24000020 },
+ { 0x21000048, 0x24000020 },
+ { 0x21000049, 0x24000020 },
+ { 0x2100004a, 0x24000020 },
+ { 0x2100004b, 0x24000020 },
+ { 0x2100004c, 0x24000020 },
+ { 0x2100004d, 0x24000020 },
+ { 0x2100004e, 0x24000020 },
+ { 0x2100004f, 0x24000020 },
+ { 0x21000050, 0x24000020 },
+ { 0x21000051, 0x24000020 },
+ { 0x21000052, 0x24000020 },
+ { 0x21000053, 0x24000020 },
+ { 0x21000054, 0x24000020 },
+ { 0x21000055, 0x24000020 },
+ { 0x21000056, 0x24000020 },
+ { 0x21000057, 0x24000020 },
+ { 0x21000058, 0x24000020 },
+ { 0x21000059, 0x24000020 },
+ { 0x2100005a, 0x24000020 },
+ { 0x0900005b, 0x58000000 },
+ { 0x0900005c, 0x54000000 },
+ { 0x0900005d, 0x48000000 },
+ { 0x0900005e, 0x60000000 },
+ { 0x0900005f, 0x40000000 },
+ { 0x09000060, 0x60000000 },
+ { 0x21000061, 0x1400ffe0 },
+ { 0x21000062, 0x1400ffe0 },
+ { 0x21000063, 0x1400ffe0 },
+ { 0x21000064, 0x1400ffe0 },
+ { 0x21000065, 0x1400ffe0 },
+ { 0x21000066, 0x1400ffe0 },
+ { 0x21000067, 0x1400ffe0 },
+ { 0x21000068, 0x1400ffe0 },
+ { 0x21000069, 0x1400ffe0 },
+ { 0x2100006a, 0x1400ffe0 },
+ { 0x2100006b, 0x1400ffe0 },
+ { 0x2100006c, 0x1400ffe0 },
+ { 0x2100006d, 0x1400ffe0 },
+ { 0x2100006e, 0x1400ffe0 },
+ { 0x2100006f, 0x1400ffe0 },
+ { 0x21000070, 0x1400ffe0 },
+ { 0x21000071, 0x1400ffe0 },
+ { 0x21000072, 0x1400ffe0 },
+ { 0x21000073, 0x1400ffe0 },
+ { 0x21000074, 0x1400ffe0 },
+ { 0x21000075, 0x1400ffe0 },
+ { 0x21000076, 0x1400ffe0 },
+ { 0x21000077, 0x1400ffe0 },
+ { 0x21000078, 0x1400ffe0 },
+ { 0x21000079, 0x1400ffe0 },
+ { 0x2100007a, 0x1400ffe0 },
+ { 0x0900007b, 0x58000000 },
+ { 0x0900007c, 0x64000000 },
+ { 0x0900007d, 0x48000000 },
+ { 0x0900007e, 0x64000000 },
+ { 0x0980007f, 0x00000020 },
+ { 0x090000a0, 0x74000000 },
+ { 0x090000a1, 0x54000000 },
+ { 0x098000a2, 0x5c000003 },
+ { 0x098000a6, 0x68000001 },
+ { 0x090000a8, 0x60000000 },
+ { 0x090000a9, 0x68000000 },
+ { 0x210000aa, 0x14000000 },
+ { 0x090000ab, 0x50000000 },
+ { 0x090000ac, 0x64000000 },
+ { 0x090000ad, 0x04000000 },
+ { 0x090000ae, 0x68000000 },
+ { 0x090000af, 0x60000000 },
+ { 0x090000b0, 0x68000000 },
+ { 0x090000b1, 0x64000000 },
+ { 0x098000b2, 0x3c000001 },
+ { 0x090000b4, 0x60000000 },
+ { 0x090000b5, 0x140002e7 },
+ { 0x090000b6, 0x68000000 },
+ { 0x090000b7, 0x54000000 },
+ { 0x090000b8, 0x60000000 },
+ { 0x090000b9, 0x3c000000 },
+ { 0x210000ba, 0x14000000 },
+ { 0x090000bb, 0x4c000000 },
+ { 0x098000bc, 0x3c000002 },
+ { 0x090000bf, 0x54000000 },
+ { 0x210000c0, 0x24000020 },
+ { 0x210000c1, 0x24000020 },
+ { 0x210000c2, 0x24000020 },
+ { 0x210000c3, 0x24000020 },
+ { 0x210000c4, 0x24000020 },
+ { 0x210000c5, 0x24000020 },
+ { 0x210000c6, 0x24000020 },
+ { 0x210000c7, 0x24000020 },
+ { 0x210000c8, 0x24000020 },
+ { 0x210000c9, 0x24000020 },
+ { 0x210000ca, 0x24000020 },
+ { 0x210000cb, 0x24000020 },
+ { 0x210000cc, 0x24000020 },
+ { 0x210000cd, 0x24000020 },
+ { 0x210000ce, 0x24000020 },
+ { 0x210000cf, 0x24000020 },
+ { 0x210000d0, 0x24000020 },
+ { 0x210000d1, 0x24000020 },
+ { 0x210000d2, 0x24000020 },
+ { 0x210000d3, 0x24000020 },
+ { 0x210000d4, 0x24000020 },
+ { 0x210000d5, 0x24000020 },
+ { 0x210000d6, 0x24000020 },
+ { 0x090000d7, 0x64000000 },
+ { 0x210000d8, 0x24000020 },
+ { 0x210000d9, 0x24000020 },
+ { 0x210000da, 0x24000020 },
+ { 0x210000db, 0x24000020 },
+ { 0x210000dc, 0x24000020 },
+ { 0x210000dd, 0x24000020 },
+ { 0x210000de, 0x24000020 },
+ { 0x210000df, 0x14000000 },
+ { 0x210000e0, 0x1400ffe0 },
+ { 0x210000e1, 0x1400ffe0 },
+ { 0x210000e2, 0x1400ffe0 },
+ { 0x210000e3, 0x1400ffe0 },
+ { 0x210000e4, 0x1400ffe0 },
+ { 0x210000e5, 0x1400ffe0 },
+ { 0x210000e6, 0x1400ffe0 },
+ { 0x210000e7, 0x1400ffe0 },
+ { 0x210000e8, 0x1400ffe0 },
+ { 0x210000e9, 0x1400ffe0 },
+ { 0x210000ea, 0x1400ffe0 },
+ { 0x210000eb, 0x1400ffe0 },
+ { 0x210000ec, 0x1400ffe0 },
+ { 0x210000ed, 0x1400ffe0 },
+ { 0x210000ee, 0x1400ffe0 },
+ { 0x210000ef, 0x1400ffe0 },
+ { 0x210000f0, 0x1400ffe0 },
+ { 0x210000f1, 0x1400ffe0 },
+ { 0x210000f2, 0x1400ffe0 },
+ { 0x210000f3, 0x1400ffe0 },
+ { 0x210000f4, 0x1400ffe0 },
+ { 0x210000f5, 0x1400ffe0 },
+ { 0x210000f6, 0x1400ffe0 },
+ { 0x090000f7, 0x64000000 },
+ { 0x210000f8, 0x1400ffe0 },
+ { 0x210000f9, 0x1400ffe0 },
+ { 0x210000fa, 0x1400ffe0 },
+ { 0x210000fb, 0x1400ffe0 },
+ { 0x210000fc, 0x1400ffe0 },
+ { 0x210000fd, 0x1400ffe0 },
+ { 0x210000fe, 0x1400ffe0 },
+ { 0x210000ff, 0x14000079 },
+ { 0x21000100, 0x24000001 },
+ { 0x21000101, 0x1400ffff },
+ { 0x21000102, 0x24000001 },
+ { 0x21000103, 0x1400ffff },
+ { 0x21000104, 0x24000001 },
+ { 0x21000105, 0x1400ffff },
+ { 0x21000106, 0x24000001 },
+ { 0x21000107, 0x1400ffff },
+ { 0x21000108, 0x24000001 },
+ { 0x21000109, 0x1400ffff },
+ { 0x2100010a, 0x24000001 },
+ { 0x2100010b, 0x1400ffff },
+ { 0x2100010c, 0x24000001 },
+ { 0x2100010d, 0x1400ffff },
+ { 0x2100010e, 0x24000001 },
+ { 0x2100010f, 0x1400ffff },
+ { 0x21000110, 0x24000001 },
+ { 0x21000111, 0x1400ffff },
+ { 0x21000112, 0x24000001 },
+ { 0x21000113, 0x1400ffff },
+ { 0x21000114, 0x24000001 },
+ { 0x21000115, 0x1400ffff },
+ { 0x21000116, 0x24000001 },
+ { 0x21000117, 0x1400ffff },
+ { 0x21000118, 0x24000001 },
+ { 0x21000119, 0x1400ffff },
+ { 0x2100011a, 0x24000001 },
+ { 0x2100011b, 0x1400ffff },
+ { 0x2100011c, 0x24000001 },
+ { 0x2100011d, 0x1400ffff },
+ { 0x2100011e, 0x24000001 },
+ { 0x2100011f, 0x1400ffff },
+ { 0x21000120, 0x24000001 },
+ { 0x21000121, 0x1400ffff },
+ { 0x21000122, 0x24000001 },
+ { 0x21000123, 0x1400ffff },
+ { 0x21000124, 0x24000001 },
+ { 0x21000125, 0x1400ffff },
+ { 0x21000126, 0x24000001 },
+ { 0x21000127, 0x1400ffff },
+ { 0x21000128, 0x24000001 },
+ { 0x21000129, 0x1400ffff },
+ { 0x2100012a, 0x24000001 },
+ { 0x2100012b, 0x1400ffff },
+ { 0x2100012c, 0x24000001 },
+ { 0x2100012d, 0x1400ffff },
+ { 0x2100012e, 0x24000001 },
+ { 0x2100012f, 0x1400ffff },
+ { 0x21000130, 0x2400ff39 },
+ { 0x21000131, 0x1400ff18 },
+ { 0x21000132, 0x24000001 },
+ { 0x21000133, 0x1400ffff },
+ { 0x21000134, 0x24000001 },
+ { 0x21000135, 0x1400ffff },
+ { 0x21000136, 0x24000001 },
+ { 0x21000137, 0x1400ffff },
+ { 0x21000138, 0x14000000 },
+ { 0x21000139, 0x24000001 },
+ { 0x2100013a, 0x1400ffff },
+ { 0x2100013b, 0x24000001 },
+ { 0x2100013c, 0x1400ffff },
+ { 0x2100013d, 0x24000001 },
+ { 0x2100013e, 0x1400ffff },
+ { 0x2100013f, 0x24000001 },
+ { 0x21000140, 0x1400ffff },
+ { 0x21000141, 0x24000001 },
+ { 0x21000142, 0x1400ffff },
+ { 0x21000143, 0x24000001 },
+ { 0x21000144, 0x1400ffff },
+ { 0x21000145, 0x24000001 },
+ { 0x21000146, 0x1400ffff },
+ { 0x21000147, 0x24000001 },
+ { 0x21000148, 0x1400ffff },
+ { 0x21000149, 0x14000000 },
+ { 0x2100014a, 0x24000001 },
+ { 0x2100014b, 0x1400ffff },
+ { 0x2100014c, 0x24000001 },
+ { 0x2100014d, 0x1400ffff },
+ { 0x2100014e, 0x24000001 },
+ { 0x2100014f, 0x1400ffff },
+ { 0x21000150, 0x24000001 },
+ { 0x21000151, 0x1400ffff },
+ { 0x21000152, 0x24000001 },
+ { 0x21000153, 0x1400ffff },
+ { 0x21000154, 0x24000001 },
+ { 0x21000155, 0x1400ffff },
+ { 0x21000156, 0x24000001 },
+ { 0x21000157, 0x1400ffff },
+ { 0x21000158, 0x24000001 },
+ { 0x21000159, 0x1400ffff },
+ { 0x2100015a, 0x24000001 },
+ { 0x2100015b, 0x1400ffff },
+ { 0x2100015c, 0x24000001 },
+ { 0x2100015d, 0x1400ffff },
+ { 0x2100015e, 0x24000001 },
+ { 0x2100015f, 0x1400ffff },
+ { 0x21000160, 0x24000001 },
+ { 0x21000161, 0x1400ffff },
+ { 0x21000162, 0x24000001 },
+ { 0x21000163, 0x1400ffff },
+ { 0x21000164, 0x24000001 },
+ { 0x21000165, 0x1400ffff },
+ { 0x21000166, 0x24000001 },
+ { 0x21000167, 0x1400ffff },
+ { 0x21000168, 0x24000001 },
+ { 0x21000169, 0x1400ffff },
+ { 0x2100016a, 0x24000001 },
+ { 0x2100016b, 0x1400ffff },
+ { 0x2100016c, 0x24000001 },
+ { 0x2100016d, 0x1400ffff },
+ { 0x2100016e, 0x24000001 },
+ { 0x2100016f, 0x1400ffff },
+ { 0x21000170, 0x24000001 },
+ { 0x21000171, 0x1400ffff },
+ { 0x21000172, 0x24000001 },
+ { 0x21000173, 0x1400ffff },
+ { 0x21000174, 0x24000001 },
+ { 0x21000175, 0x1400ffff },
+ { 0x21000176, 0x24000001 },
+ { 0x21000177, 0x1400ffff },
+ { 0x21000178, 0x2400ff87 },
+ { 0x21000179, 0x24000001 },
+ { 0x2100017a, 0x1400ffff },
+ { 0x2100017b, 0x24000001 },
+ { 0x2100017c, 0x1400ffff },
+ { 0x2100017d, 0x24000001 },
+ { 0x2100017e, 0x1400ffff },
+ { 0x2100017f, 0x1400fed4 },
+ { 0x21000180, 0x14000000 },
+ { 0x21000181, 0x240000d2 },
+ { 0x21000182, 0x24000001 },
+ { 0x21000183, 0x1400ffff },
+ { 0x21000184, 0x24000001 },
+ { 0x21000185, 0x1400ffff },
+ { 0x21000186, 0x240000ce },
+ { 0x21000187, 0x24000001 },
+ { 0x21000188, 0x1400ffff },
+ { 0x21000189, 0x240000cd },
+ { 0x2100018a, 0x240000cd },
+ { 0x2100018b, 0x24000001 },
+ { 0x2100018c, 0x1400ffff },
+ { 0x2100018d, 0x14000000 },
+ { 0x2100018e, 0x2400004f },
+ { 0x2100018f, 0x240000ca },
+ { 0x21000190, 0x240000cb },
+ { 0x21000191, 0x24000001 },
+ { 0x21000192, 0x1400ffff },
+ { 0x21000193, 0x240000cd },
+ { 0x21000194, 0x240000cf },
+ { 0x21000195, 0x14000061 },
+ { 0x21000196, 0x240000d3 },
+ { 0x21000197, 0x240000d1 },
+ { 0x21000198, 0x24000001 },
+ { 0x21000199, 0x1400ffff },
+ { 0x2100019a, 0x140000a3 },
+ { 0x2100019b, 0x14000000 },
+ { 0x2100019c, 0x240000d3 },
+ { 0x2100019d, 0x240000d5 },
+ { 0x2100019e, 0x14000082 },
+ { 0x2100019f, 0x240000d6 },
+ { 0x210001a0, 0x24000001 },
+ { 0x210001a1, 0x1400ffff },
+ { 0x210001a2, 0x24000001 },
+ { 0x210001a3, 0x1400ffff },
+ { 0x210001a4, 0x24000001 },
+ { 0x210001a5, 0x1400ffff },
+ { 0x210001a6, 0x240000da },
+ { 0x210001a7, 0x24000001 },
+ { 0x210001a8, 0x1400ffff },
+ { 0x210001a9, 0x240000da },
+ { 0x218001aa, 0x14000001 },
+ { 0x210001ac, 0x24000001 },
+ { 0x210001ad, 0x1400ffff },
+ { 0x210001ae, 0x240000da },
+ { 0x210001af, 0x24000001 },
+ { 0x210001b0, 0x1400ffff },
+ { 0x210001b1, 0x240000d9 },
+ { 0x210001b2, 0x240000d9 },
+ { 0x210001b3, 0x24000001 },
+ { 0x210001b4, 0x1400ffff },
+ { 0x210001b5, 0x24000001 },
+ { 0x210001b6, 0x1400ffff },
+ { 0x210001b7, 0x240000db },
+ { 0x210001b8, 0x24000001 },
+ { 0x210001b9, 0x1400ffff },
+ { 0x210001ba, 0x14000000 },
+ { 0x210001bb, 0x1c000000 },
+ { 0x210001bc, 0x24000001 },
+ { 0x210001bd, 0x1400ffff },
+ { 0x210001be, 0x14000000 },
+ { 0x210001bf, 0x14000038 },
+ { 0x218001c0, 0x1c000003 },
+ { 0x210001c4, 0x24000002 },
+ { 0x210001c5, 0x2000ffff },
+ { 0x210001c6, 0x1400fffe },
+ { 0x210001c7, 0x24000002 },
+ { 0x210001c8, 0x2000ffff },
+ { 0x210001c9, 0x1400fffe },
+ { 0x210001ca, 0x24000002 },
+ { 0x210001cb, 0x2000ffff },
+ { 0x210001cc, 0x1400fffe },
+ { 0x210001cd, 0x24000001 },
+ { 0x210001ce, 0x1400ffff },
+ { 0x210001cf, 0x24000001 },
+ { 0x210001d0, 0x1400ffff },
+ { 0x210001d1, 0x24000001 },
+ { 0x210001d2, 0x1400ffff },
+ { 0x210001d3, 0x24000001 },
+ { 0x210001d4, 0x1400ffff },
+ { 0x210001d5, 0x24000001 },
+ { 0x210001d6, 0x1400ffff },
+ { 0x210001d7, 0x24000001 },
+ { 0x210001d8, 0x1400ffff },
+ { 0x210001d9, 0x24000001 },
+ { 0x210001da, 0x1400ffff },
+ { 0x210001db, 0x24000001 },
+ { 0x210001dc, 0x1400ffff },
+ { 0x210001dd, 0x1400ffb1 },
+ { 0x210001de, 0x24000001 },
+ { 0x210001df, 0x1400ffff },
+ { 0x210001e0, 0x24000001 },
+ { 0x210001e1, 0x1400ffff },
+ { 0x210001e2, 0x24000001 },
+ { 0x210001e3, 0x1400ffff },
+ { 0x210001e4, 0x24000001 },
+ { 0x210001e5, 0x1400ffff },
+ { 0x210001e6, 0x24000001 },
+ { 0x210001e7, 0x1400ffff },
+ { 0x210001e8, 0x24000001 },
+ { 0x210001e9, 0x1400ffff },
+ { 0x210001ea, 0x24000001 },
+ { 0x210001eb, 0x1400ffff },
+ { 0x210001ec, 0x24000001 },
+ { 0x210001ed, 0x1400ffff },
+ { 0x210001ee, 0x24000001 },
+ { 0x210001ef, 0x1400ffff },
+ { 0x210001f0, 0x14000000 },
+ { 0x210001f1, 0x24000002 },
+ { 0x210001f2, 0x2000ffff },
+ { 0x210001f3, 0x1400fffe },
+ { 0x210001f4, 0x24000001 },
+ { 0x210001f5, 0x1400ffff },
+ { 0x210001f6, 0x2400ff9f },
+ { 0x210001f7, 0x2400ffc8 },
+ { 0x210001f8, 0x24000001 },
+ { 0x210001f9, 0x1400ffff },
+ { 0x210001fa, 0x24000001 },
+ { 0x210001fb, 0x1400ffff },
+ { 0x210001fc, 0x24000001 },
+ { 0x210001fd, 0x1400ffff },
+ { 0x210001fe, 0x24000001 },
+ { 0x210001ff, 0x1400ffff },
+ { 0x21000200, 0x24000001 },
+ { 0x21000201, 0x1400ffff },
+ { 0x21000202, 0x24000001 },
+ { 0x21000203, 0x1400ffff },
+ { 0x21000204, 0x24000001 },
+ { 0x21000205, 0x1400ffff },
+ { 0x21000206, 0x24000001 },
+ { 0x21000207, 0x1400ffff },
+ { 0x21000208, 0x24000001 },
+ { 0x21000209, 0x1400ffff },
+ { 0x2100020a, 0x24000001 },
+ { 0x2100020b, 0x1400ffff },
+ { 0x2100020c, 0x24000001 },
+ { 0x2100020d, 0x1400ffff },
+ { 0x2100020e, 0x24000001 },
+ { 0x2100020f, 0x1400ffff },
+ { 0x21000210, 0x24000001 },
+ { 0x21000211, 0x1400ffff },
+ { 0x21000212, 0x24000001 },
+ { 0x21000213, 0x1400ffff },
+ { 0x21000214, 0x24000001 },
+ { 0x21000215, 0x1400ffff },
+ { 0x21000216, 0x24000001 },
+ { 0x21000217, 0x1400ffff },
+ { 0x21000218, 0x24000001 },
+ { 0x21000219, 0x1400ffff },
+ { 0x2100021a, 0x24000001 },
+ { 0x2100021b, 0x1400ffff },
+ { 0x2100021c, 0x24000001 },
+ { 0x2100021d, 0x1400ffff },
+ { 0x2100021e, 0x24000001 },
+ { 0x2100021f, 0x1400ffff },
+ { 0x21000220, 0x2400ff7e },
+ { 0x21000221, 0x14000000 },
+ { 0x21000222, 0x24000001 },
+ { 0x21000223, 0x1400ffff },
+ { 0x21000224, 0x24000001 },
+ { 0x21000225, 0x1400ffff },
+ { 0x21000226, 0x24000001 },
+ { 0x21000227, 0x1400ffff },
+ { 0x21000228, 0x24000001 },
+ { 0x21000229, 0x1400ffff },
+ { 0x2100022a, 0x24000001 },
+ { 0x2100022b, 0x1400ffff },
+ { 0x2100022c, 0x24000001 },
+ { 0x2100022d, 0x1400ffff },
+ { 0x2100022e, 0x24000001 },
+ { 0x2100022f, 0x1400ffff },
+ { 0x21000230, 0x24000001 },
+ { 0x21000231, 0x1400ffff },
+ { 0x21000232, 0x24000001 },
+ { 0x21000233, 0x1400ffff },
+ { 0x21800234, 0x14000005 },
+ { 0x2100023a, 0x24000000 },
+ { 0x2100023b, 0x24000001 },
+ { 0x2100023c, 0x1400ffff },
+ { 0x2100023d, 0x2400ff5d },
+ { 0x2100023e, 0x24000000 },
+ { 0x2180023f, 0x14000001 },
+ { 0x21000241, 0x24000053 },
+ { 0x21800250, 0x14000002 },
+ { 0x21000253, 0x1400ff2e },
+ { 0x21000254, 0x1400ff32 },
+ { 0x21000255, 0x14000000 },
+ { 0x21000256, 0x1400ff33 },
+ { 0x21000257, 0x1400ff33 },
+ { 0x21000258, 0x14000000 },
+ { 0x21000259, 0x1400ff36 },
+ { 0x2100025a, 0x14000000 },
+ { 0x2100025b, 0x1400ff35 },
+ { 0x2180025c, 0x14000003 },
+ { 0x21000260, 0x1400ff33 },
+ { 0x21800261, 0x14000001 },
+ { 0x21000263, 0x1400ff31 },
+ { 0x21800264, 0x14000003 },
+ { 0x21000268, 0x1400ff2f },
+ { 0x21000269, 0x1400ff2d },
+ { 0x2180026a, 0x14000004 },
+ { 0x2100026f, 0x1400ff2d },
+ { 0x21800270, 0x14000001 },
+ { 0x21000272, 0x1400ff2b },
+ { 0x21800273, 0x14000001 },
+ { 0x21000275, 0x1400ff2a },
+ { 0x21800276, 0x14000009 },
+ { 0x21000280, 0x1400ff26 },
+ { 0x21800281, 0x14000001 },
+ { 0x21000283, 0x1400ff26 },
+ { 0x21800284, 0x14000003 },
+ { 0x21000288, 0x1400ff26 },
+ { 0x21000289, 0x14000000 },
+ { 0x2100028a, 0x1400ff27 },
+ { 0x2100028b, 0x1400ff27 },
+ { 0x2180028c, 0x14000005 },
+ { 0x21000292, 0x1400ff25 },
+ { 0x21000293, 0x14000000 },
+ { 0x21000294, 0x1400ffad },
+ { 0x21800295, 0x1400001a },
+ { 0x218002b0, 0x18000011 },
+ { 0x098002c2, 0x60000003 },
+ { 0x098002c6, 0x1800000b },
+ { 0x098002d2, 0x6000000d },
+ { 0x218002e0, 0x18000004 },
+ { 0x098002e5, 0x60000008 },
+ { 0x090002ee, 0x18000000 },
+ { 0x098002ef, 0x60000010 },
+ { 0x1b800300, 0x30000044 },
+ { 0x1b000345, 0x30000054 },
+ { 0x1b800346, 0x30000029 },
+ { 0x13800374, 0x60000001 },
+ { 0x1300037a, 0x18000000 },
+ { 0x0900037e, 0x54000000 },
+ { 0x13800384, 0x60000001 },
+ { 0x13000386, 0x24000026 },
+ { 0x09000387, 0x54000000 },
+ { 0x13000388, 0x24000025 },
+ { 0x13000389, 0x24000025 },
+ { 0x1300038a, 0x24000025 },
+ { 0x1300038c, 0x24000040 },
+ { 0x1300038e, 0x2400003f },
+ { 0x1300038f, 0x2400003f },
+ { 0x13000390, 0x14000000 },
+ { 0x13000391, 0x24000020 },
+ { 0x13000392, 0x24000020 },
+ { 0x13000393, 0x24000020 },
+ { 0x13000394, 0x24000020 },
+ { 0x13000395, 0x24000020 },
+ { 0x13000396, 0x24000020 },
+ { 0x13000397, 0x24000020 },
+ { 0x13000398, 0x24000020 },
+ { 0x13000399, 0x24000020 },
+ { 0x1300039a, 0x24000020 },
+ { 0x1300039b, 0x24000020 },
+ { 0x1300039c, 0x24000020 },
+ { 0x1300039d, 0x24000020 },
+ { 0x1300039e, 0x24000020 },
+ { 0x1300039f, 0x24000020 },
+ { 0x130003a0, 0x24000020 },
+ { 0x130003a1, 0x24000020 },
+ { 0x130003a3, 0x24000020 },
+ { 0x130003a4, 0x24000020 },
+ { 0x130003a5, 0x24000020 },
+ { 0x130003a6, 0x24000020 },
+ { 0x130003a7, 0x24000020 },
+ { 0x130003a8, 0x24000020 },
+ { 0x130003a9, 0x24000020 },
+ { 0x130003aa, 0x24000020 },
+ { 0x130003ab, 0x24000020 },
+ { 0x130003ac, 0x1400ffda },
+ { 0x130003ad, 0x1400ffdb },
+ { 0x130003ae, 0x1400ffdb },
+ { 0x130003af, 0x1400ffdb },
+ { 0x130003b0, 0x14000000 },
+ { 0x130003b1, 0x1400ffe0 },
+ { 0x130003b2, 0x1400ffe0 },
+ { 0x130003b3, 0x1400ffe0 },
+ { 0x130003b4, 0x1400ffe0 },
+ { 0x130003b5, 0x1400ffe0 },
+ { 0x130003b6, 0x1400ffe0 },
+ { 0x130003b7, 0x1400ffe0 },
+ { 0x130003b8, 0x1400ffe0 },
+ { 0x130003b9, 0x1400ffe0 },
+ { 0x130003ba, 0x1400ffe0 },
+ { 0x130003bb, 0x1400ffe0 },
+ { 0x130003bc, 0x1400ffe0 },
+ { 0x130003bd, 0x1400ffe0 },
+ { 0x130003be, 0x1400ffe0 },
+ { 0x130003bf, 0x1400ffe0 },
+ { 0x130003c0, 0x1400ffe0 },
+ { 0x130003c1, 0x1400ffe0 },
+ { 0x130003c2, 0x1400ffe1 },
+ { 0x130003c3, 0x1400ffe0 },
+ { 0x130003c4, 0x1400ffe0 },
+ { 0x130003c5, 0x1400ffe0 },
+ { 0x130003c6, 0x1400ffe0 },
+ { 0x130003c7, 0x1400ffe0 },
+ { 0x130003c8, 0x1400ffe0 },
+ { 0x130003c9, 0x1400ffe0 },
+ { 0x130003ca, 0x1400ffe0 },
+ { 0x130003cb, 0x1400ffe0 },
+ { 0x130003cc, 0x1400ffc0 },
+ { 0x130003cd, 0x1400ffc1 },
+ { 0x130003ce, 0x1400ffc1 },
+ { 0x130003d0, 0x1400ffc2 },
+ { 0x130003d1, 0x1400ffc7 },
+ { 0x138003d2, 0x24000002 },
+ { 0x130003d5, 0x1400ffd1 },
+ { 0x130003d6, 0x1400ffca },
+ { 0x130003d7, 0x14000000 },
+ { 0x130003d8, 0x24000001 },
+ { 0x130003d9, 0x1400ffff },
+ { 0x130003da, 0x24000001 },
+ { 0x130003db, 0x1400ffff },
+ { 0x130003dc, 0x24000001 },
+ { 0x130003dd, 0x1400ffff },
+ { 0x130003de, 0x24000001 },
+ { 0x130003df, 0x1400ffff },
+ { 0x130003e0, 0x24000001 },
+ { 0x130003e1, 0x1400ffff },
+ { 0x0a0003e2, 0x24000001 },
+ { 0x0a0003e3, 0x1400ffff },
+ { 0x0a0003e4, 0x24000001 },
+ { 0x0a0003e5, 0x1400ffff },
+ { 0x0a0003e6, 0x24000001 },
+ { 0x0a0003e7, 0x1400ffff },
+ { 0x0a0003e8, 0x24000001 },
+ { 0x0a0003e9, 0x1400ffff },
+ { 0x0a0003ea, 0x24000001 },
+ { 0x0a0003eb, 0x1400ffff },
+ { 0x0a0003ec, 0x24000001 },
+ { 0x0a0003ed, 0x1400ffff },
+ { 0x0a0003ee, 0x24000001 },
+ { 0x0a0003ef, 0x1400ffff },
+ { 0x130003f0, 0x1400ffaa },
+ { 0x130003f1, 0x1400ffb0 },
+ { 0x130003f2, 0x14000007 },
+ { 0x130003f3, 0x14000000 },
+ { 0x130003f4, 0x2400ffc4 },
+ { 0x130003f5, 0x1400ffa0 },
+ { 0x130003f6, 0x64000000 },
+ { 0x130003f7, 0x24000001 },
+ { 0x130003f8, 0x1400ffff },
+ { 0x130003f9, 0x2400fff9 },
+ { 0x130003fa, 0x24000001 },
+ { 0x130003fb, 0x1400ffff },
+ { 0x130003fc, 0x14000000 },
+ { 0x138003fd, 0x24000002 },
+ { 0x0c000400, 0x24000050 },
+ { 0x0c000401, 0x24000050 },
+ { 0x0c000402, 0x24000050 },
+ { 0x0c000403, 0x24000050 },
+ { 0x0c000404, 0x24000050 },
+ { 0x0c000405, 0x24000050 },
+ { 0x0c000406, 0x24000050 },
+ { 0x0c000407, 0x24000050 },
+ { 0x0c000408, 0x24000050 },
+ { 0x0c000409, 0x24000050 },
+ { 0x0c00040a, 0x24000050 },
+ { 0x0c00040b, 0x24000050 },
+ { 0x0c00040c, 0x24000050 },
+ { 0x0c00040d, 0x24000050 },
+ { 0x0c00040e, 0x24000050 },
+ { 0x0c00040f, 0x24000050 },
+ { 0x0c000410, 0x24000020 },
+ { 0x0c000411, 0x24000020 },
+ { 0x0c000412, 0x24000020 },
+ { 0x0c000413, 0x24000020 },
+ { 0x0c000414, 0x24000020 },
+ { 0x0c000415, 0x24000020 },
+ { 0x0c000416, 0x24000020 },
+ { 0x0c000417, 0x24000020 },
+ { 0x0c000418, 0x24000020 },
+ { 0x0c000419, 0x24000020 },
+ { 0x0c00041a, 0x24000020 },
+ { 0x0c00041b, 0x24000020 },
+ { 0x0c00041c, 0x24000020 },
+ { 0x0c00041d, 0x24000020 },
+ { 0x0c00041e, 0x24000020 },
+ { 0x0c00041f, 0x24000020 },
+ { 0x0c000420, 0x24000020 },
+ { 0x0c000421, 0x24000020 },
+ { 0x0c000422, 0x24000020 },
+ { 0x0c000423, 0x24000020 },
+ { 0x0c000424, 0x24000020 },
+ { 0x0c000425, 0x24000020 },
+ { 0x0c000426, 0x24000020 },
+ { 0x0c000427, 0x24000020 },
+ { 0x0c000428, 0x24000020 },
+ { 0x0c000429, 0x24000020 },
+ { 0x0c00042a, 0x24000020 },
+ { 0x0c00042b, 0x24000020 },
+ { 0x0c00042c, 0x24000020 },
+ { 0x0c00042d, 0x24000020 },
+ { 0x0c00042e, 0x24000020 },
+ { 0x0c00042f, 0x24000020 },
+ { 0x0c000430, 0x1400ffe0 },
+ { 0x0c000431, 0x1400ffe0 },
+ { 0x0c000432, 0x1400ffe0 },
+ { 0x0c000433, 0x1400ffe0 },
+ { 0x0c000434, 0x1400ffe0 },
+ { 0x0c000435, 0x1400ffe0 },
+ { 0x0c000436, 0x1400ffe0 },
+ { 0x0c000437, 0x1400ffe0 },
+ { 0x0c000438, 0x1400ffe0 },
+ { 0x0c000439, 0x1400ffe0 },
+ { 0x0c00043a, 0x1400ffe0 },
+ { 0x0c00043b, 0x1400ffe0 },
+ { 0x0c00043c, 0x1400ffe0 },
+ { 0x0c00043d, 0x1400ffe0 },
+ { 0x0c00043e, 0x1400ffe0 },
+ { 0x0c00043f, 0x1400ffe0 },
+ { 0x0c000440, 0x1400ffe0 },
+ { 0x0c000441, 0x1400ffe0 },
+ { 0x0c000442, 0x1400ffe0 },
+ { 0x0c000443, 0x1400ffe0 },
+ { 0x0c000444, 0x1400ffe0 },
+ { 0x0c000445, 0x1400ffe0 },
+ { 0x0c000446, 0x1400ffe0 },
+ { 0x0c000447, 0x1400ffe0 },
+ { 0x0c000448, 0x1400ffe0 },
+ { 0x0c000449, 0x1400ffe0 },
+ { 0x0c00044a, 0x1400ffe0 },
+ { 0x0c00044b, 0x1400ffe0 },
+ { 0x0c00044c, 0x1400ffe0 },
+ { 0x0c00044d, 0x1400ffe0 },
+ { 0x0c00044e, 0x1400ffe0 },
+ { 0x0c00044f, 0x1400ffe0 },
+ { 0x0c000450, 0x1400ffb0 },
+ { 0x0c000451, 0x1400ffb0 },
+ { 0x0c000452, 0x1400ffb0 },
+ { 0x0c000453, 0x1400ffb0 },
+ { 0x0c000454, 0x1400ffb0 },
+ { 0x0c000455, 0x1400ffb0 },
+ { 0x0c000456, 0x1400ffb0 },
+ { 0x0c000457, 0x1400ffb0 },
+ { 0x0c000458, 0x1400ffb0 },
+ { 0x0c000459, 0x1400ffb0 },
+ { 0x0c00045a, 0x1400ffb0 },
+ { 0x0c00045b, 0x1400ffb0 },
+ { 0x0c00045c, 0x1400ffb0 },
+ { 0x0c00045d, 0x1400ffb0 },
+ { 0x0c00045e, 0x1400ffb0 },
+ { 0x0c00045f, 0x1400ffb0 },
+ { 0x0c000460, 0x24000001 },
+ { 0x0c000461, 0x1400ffff },
+ { 0x0c000462, 0x24000001 },
+ { 0x0c000463, 0x1400ffff },
+ { 0x0c000464, 0x24000001 },
+ { 0x0c000465, 0x1400ffff },
+ { 0x0c000466, 0x24000001 },
+ { 0x0c000467, 0x1400ffff },
+ { 0x0c000468, 0x24000001 },
+ { 0x0c000469, 0x1400ffff },
+ { 0x0c00046a, 0x24000001 },
+ { 0x0c00046b, 0x1400ffff },
+ { 0x0c00046c, 0x24000001 },
+ { 0x0c00046d, 0x1400ffff },
+ { 0x0c00046e, 0x24000001 },
+ { 0x0c00046f, 0x1400ffff },
+ { 0x0c000470, 0x24000001 },
+ { 0x0c000471, 0x1400ffff },
+ { 0x0c000472, 0x24000001 },
+ { 0x0c000473, 0x1400ffff },
+ { 0x0c000474, 0x24000001 },
+ { 0x0c000475, 0x1400ffff },
+ { 0x0c000476, 0x24000001 },
+ { 0x0c000477, 0x1400ffff },
+ { 0x0c000478, 0x24000001 },
+ { 0x0c000479, 0x1400ffff },
+ { 0x0c00047a, 0x24000001 },
+ { 0x0c00047b, 0x1400ffff },
+ { 0x0c00047c, 0x24000001 },
+ { 0x0c00047d, 0x1400ffff },
+ { 0x0c00047e, 0x24000001 },
+ { 0x0c00047f, 0x1400ffff },
+ { 0x0c000480, 0x24000001 },
+ { 0x0c000481, 0x1400ffff },
+ { 0x0c000482, 0x68000000 },
+ { 0x0c800483, 0x30000003 },
+ { 0x0c800488, 0x2c000001 },
+ { 0x0c00048a, 0x24000001 },
+ { 0x0c00048b, 0x1400ffff },
+ { 0x0c00048c, 0x24000001 },
+ { 0x0c00048d, 0x1400ffff },
+ { 0x0c00048e, 0x24000001 },
+ { 0x0c00048f, 0x1400ffff },
+ { 0x0c000490, 0x24000001 },
+ { 0x0c000491, 0x1400ffff },
+ { 0x0c000492, 0x24000001 },
+ { 0x0c000493, 0x1400ffff },
+ { 0x0c000494, 0x24000001 },
+ { 0x0c000495, 0x1400ffff },
+ { 0x0c000496, 0x24000001 },
+ { 0x0c000497, 0x1400ffff },
+ { 0x0c000498, 0x24000001 },
+ { 0x0c000499, 0x1400ffff },
+ { 0x0c00049a, 0x24000001 },
+ { 0x0c00049b, 0x1400ffff },
+ { 0x0c00049c, 0x24000001 },
+ { 0x0c00049d, 0x1400ffff },
+ { 0x0c00049e, 0x24000001 },
+ { 0x0c00049f, 0x1400ffff },
+ { 0x0c0004a0, 0x24000001 },
+ { 0x0c0004a1, 0x1400ffff },
+ { 0x0c0004a2, 0x24000001 },
+ { 0x0c0004a3, 0x1400ffff },
+ { 0x0c0004a4, 0x24000001 },
+ { 0x0c0004a5, 0x1400ffff },
+ { 0x0c0004a6, 0x24000001 },
+ { 0x0c0004a7, 0x1400ffff },
+ { 0x0c0004a8, 0x24000001 },
+ { 0x0c0004a9, 0x1400ffff },
+ { 0x0c0004aa, 0x24000001 },
+ { 0x0c0004ab, 0x1400ffff },
+ { 0x0c0004ac, 0x24000001 },
+ { 0x0c0004ad, 0x1400ffff },
+ { 0x0c0004ae, 0x24000001 },
+ { 0x0c0004af, 0x1400ffff },
+ { 0x0c0004b0, 0x24000001 },
+ { 0x0c0004b1, 0x1400ffff },
+ { 0x0c0004b2, 0x24000001 },
+ { 0x0c0004b3, 0x1400ffff },
+ { 0x0c0004b4, 0x24000001 },
+ { 0x0c0004b5, 0x1400ffff },
+ { 0x0c0004b6, 0x24000001 },
+ { 0x0c0004b7, 0x1400ffff },
+ { 0x0c0004b8, 0x24000001 },
+ { 0x0c0004b9, 0x1400ffff },
+ { 0x0c0004ba, 0x24000001 },
+ { 0x0c0004bb, 0x1400ffff },
+ { 0x0c0004bc, 0x24000001 },
+ { 0x0c0004bd, 0x1400ffff },
+ { 0x0c0004be, 0x24000001 },
+ { 0x0c0004bf, 0x1400ffff },
+ { 0x0c0004c0, 0x24000000 },
+ { 0x0c0004c1, 0x24000001 },
+ { 0x0c0004c2, 0x1400ffff },
+ { 0x0c0004c3, 0x24000001 },
+ { 0x0c0004c4, 0x1400ffff },
+ { 0x0c0004c5, 0x24000001 },
+ { 0x0c0004c6, 0x1400ffff },
+ { 0x0c0004c7, 0x24000001 },
+ { 0x0c0004c8, 0x1400ffff },
+ { 0x0c0004c9, 0x24000001 },
+ { 0x0c0004ca, 0x1400ffff },
+ { 0x0c0004cb, 0x24000001 },
+ { 0x0c0004cc, 0x1400ffff },
+ { 0x0c0004cd, 0x24000001 },
+ { 0x0c0004ce, 0x1400ffff },
+ { 0x0c0004d0, 0x24000001 },
+ { 0x0c0004d1, 0x1400ffff },
+ { 0x0c0004d2, 0x24000001 },
+ { 0x0c0004d3, 0x1400ffff },
+ { 0x0c0004d4, 0x24000001 },
+ { 0x0c0004d5, 0x1400ffff },
+ { 0x0c0004d6, 0x24000001 },
+ { 0x0c0004d7, 0x1400ffff },
+ { 0x0c0004d8, 0x24000001 },
+ { 0x0c0004d9, 0x1400ffff },
+ { 0x0c0004da, 0x24000001 },
+ { 0x0c0004db, 0x1400ffff },
+ { 0x0c0004dc, 0x24000001 },
+ { 0x0c0004dd, 0x1400ffff },
+ { 0x0c0004de, 0x24000001 },
+ { 0x0c0004df, 0x1400ffff },
+ { 0x0c0004e0, 0x24000001 },
+ { 0x0c0004e1, 0x1400ffff },
+ { 0x0c0004e2, 0x24000001 },
+ { 0x0c0004e3, 0x1400ffff },
+ { 0x0c0004e4, 0x24000001 },
+ { 0x0c0004e5, 0x1400ffff },
+ { 0x0c0004e6, 0x24000001 },
+ { 0x0c0004e7, 0x1400ffff },
+ { 0x0c0004e8, 0x24000001 },
+ { 0x0c0004e9, 0x1400ffff },
+ { 0x0c0004ea, 0x24000001 },
+ { 0x0c0004eb, 0x1400ffff },
+ { 0x0c0004ec, 0x24000001 },
+ { 0x0c0004ed, 0x1400ffff },
+ { 0x0c0004ee, 0x24000001 },
+ { 0x0c0004ef, 0x1400ffff },
+ { 0x0c0004f0, 0x24000001 },
+ { 0x0c0004f1, 0x1400ffff },
+ { 0x0c0004f2, 0x24000001 },
+ { 0x0c0004f3, 0x1400ffff },
+ { 0x0c0004f4, 0x24000001 },
+ { 0x0c0004f5, 0x1400ffff },
+ { 0x0c0004f6, 0x24000001 },
+ { 0x0c0004f7, 0x1400ffff },
+ { 0x0c0004f8, 0x24000001 },
+ { 0x0c0004f9, 0x1400ffff },
+ { 0x0c000500, 0x24000001 },
+ { 0x0c000501, 0x1400ffff },
+ { 0x0c000502, 0x24000001 },
+ { 0x0c000503, 0x1400ffff },
+ { 0x0c000504, 0x24000001 },
+ { 0x0c000505, 0x1400ffff },
+ { 0x0c000506, 0x24000001 },
+ { 0x0c000507, 0x1400ffff },
+ { 0x0c000508, 0x24000001 },
+ { 0x0c000509, 0x1400ffff },
+ { 0x0c00050a, 0x24000001 },
+ { 0x0c00050b, 0x1400ffff },
+ { 0x0c00050c, 0x24000001 },
+ { 0x0c00050d, 0x1400ffff },
+ { 0x0c00050e, 0x24000001 },
+ { 0x0c00050f, 0x1400ffff },
+ { 0x01000531, 0x24000030 },
+ { 0x01000532, 0x24000030 },
+ { 0x01000533, 0x24000030 },
+ { 0x01000534, 0x24000030 },
+ { 0x01000535, 0x24000030 },
+ { 0x01000536, 0x24000030 },
+ { 0x01000537, 0x24000030 },
+ { 0x01000538, 0x24000030 },
+ { 0x01000539, 0x24000030 },
+ { 0x0100053a, 0x24000030 },
+ { 0x0100053b, 0x24000030 },
+ { 0x0100053c, 0x24000030 },
+ { 0x0100053d, 0x24000030 },
+ { 0x0100053e, 0x24000030 },
+ { 0x0100053f, 0x24000030 },
+ { 0x01000540, 0x24000030 },
+ { 0x01000541, 0x24000030 },
+ { 0x01000542, 0x24000030 },
+ { 0x01000543, 0x24000030 },
+ { 0x01000544, 0x24000030 },
+ { 0x01000545, 0x24000030 },
+ { 0x01000546, 0x24000030 },
+ { 0x01000547, 0x24000030 },
+ { 0x01000548, 0x24000030 },
+ { 0x01000549, 0x24000030 },
+ { 0x0100054a, 0x24000030 },
+ { 0x0100054b, 0x24000030 },
+ { 0x0100054c, 0x24000030 },
+ { 0x0100054d, 0x24000030 },
+ { 0x0100054e, 0x24000030 },
+ { 0x0100054f, 0x24000030 },
+ { 0x01000550, 0x24000030 },
+ { 0x01000551, 0x24000030 },
+ { 0x01000552, 0x24000030 },
+ { 0x01000553, 0x24000030 },
+ { 0x01000554, 0x24000030 },
+ { 0x01000555, 0x24000030 },
+ { 0x01000556, 0x24000030 },
+ { 0x01000559, 0x18000000 },
+ { 0x0180055a, 0x54000005 },
+ { 0x01000561, 0x1400ffd0 },
+ { 0x01000562, 0x1400ffd0 },
+ { 0x01000563, 0x1400ffd0 },
+ { 0x01000564, 0x1400ffd0 },
+ { 0x01000565, 0x1400ffd0 },
+ { 0x01000566, 0x1400ffd0 },
+ { 0x01000567, 0x1400ffd0 },
+ { 0x01000568, 0x1400ffd0 },
+ { 0x01000569, 0x1400ffd0 },
+ { 0x0100056a, 0x1400ffd0 },
+ { 0x0100056b, 0x1400ffd0 },
+ { 0x0100056c, 0x1400ffd0 },
+ { 0x0100056d, 0x1400ffd0 },
+ { 0x0100056e, 0x1400ffd0 },
+ { 0x0100056f, 0x1400ffd0 },
+ { 0x01000570, 0x1400ffd0 },
+ { 0x01000571, 0x1400ffd0 },
+ { 0x01000572, 0x1400ffd0 },
+ { 0x01000573, 0x1400ffd0 },
+ { 0x01000574, 0x1400ffd0 },
+ { 0x01000575, 0x1400ffd0 },
+ { 0x01000576, 0x1400ffd0 },
+ { 0x01000577, 0x1400ffd0 },
+ { 0x01000578, 0x1400ffd0 },
+ { 0x01000579, 0x1400ffd0 },
+ { 0x0100057a, 0x1400ffd0 },
+ { 0x0100057b, 0x1400ffd0 },
+ { 0x0100057c, 0x1400ffd0 },
+ { 0x0100057d, 0x1400ffd0 },
+ { 0x0100057e, 0x1400ffd0 },
+ { 0x0100057f, 0x1400ffd0 },
+ { 0x01000580, 0x1400ffd0 },
+ { 0x01000581, 0x1400ffd0 },
+ { 0x01000582, 0x1400ffd0 },
+ { 0x01000583, 0x1400ffd0 },
+ { 0x01000584, 0x1400ffd0 },
+ { 0x01000585, 0x1400ffd0 },
+ { 0x01000586, 0x1400ffd0 },
+ { 0x01000587, 0x14000000 },
+ { 0x09000589, 0x54000000 },
+ { 0x0100058a, 0x44000000 },
+ { 0x19800591, 0x30000028 },
+ { 0x198005bb, 0x30000002 },
+ { 0x190005be, 0x54000000 },
+ { 0x190005bf, 0x30000000 },
+ { 0x190005c0, 0x54000000 },
+ { 0x198005c1, 0x30000001 },
+ { 0x190005c3, 0x54000000 },
+ { 0x198005c4, 0x30000001 },
+ { 0x190005c6, 0x54000000 },
+ { 0x190005c7, 0x30000000 },
+ { 0x198005d0, 0x1c00001a },
+ { 0x198005f0, 0x1c000002 },
+ { 0x198005f3, 0x54000001 },
+ { 0x09800600, 0x04000003 },
+ { 0x0000060b, 0x5c000000 },
+ { 0x0980060c, 0x54000001 },
+ { 0x0080060e, 0x68000001 },
+ { 0x00800610, 0x30000005 },
+ { 0x0900061b, 0x54000000 },
+ { 0x0080061e, 0x54000001 },
+ { 0x00800621, 0x1c000019 },
+ { 0x09000640, 0x18000000 },
+ { 0x00800641, 0x1c000009 },
+ { 0x1b80064b, 0x30000013 },
+ { 0x09800660, 0x34000009 },
+ { 0x0080066a, 0x54000003 },
+ { 0x0080066e, 0x1c000001 },
+ { 0x1b000670, 0x30000000 },
+ { 0x00800671, 0x1c000062 },
+ { 0x000006d4, 0x54000000 },
+ { 0x000006d5, 0x1c000000 },
+ { 0x008006d6, 0x30000006 },
+ { 0x090006dd, 0x04000000 },
+ { 0x000006de, 0x2c000000 },
+ { 0x008006df, 0x30000005 },
+ { 0x008006e5, 0x18000001 },
+ { 0x008006e7, 0x30000001 },
+ { 0x000006e9, 0x68000000 },
+ { 0x008006ea, 0x30000003 },
+ { 0x008006ee, 0x1c000001 },
+ { 0x008006f0, 0x34000009 },
+ { 0x008006fa, 0x1c000002 },
+ { 0x008006fd, 0x68000001 },
+ { 0x000006ff, 0x1c000000 },
+ { 0x31800700, 0x5400000d },
+ { 0x3100070f, 0x04000000 },
+ { 0x31000710, 0x1c000000 },
+ { 0x31000711, 0x30000000 },
+ { 0x31800712, 0x1c00001d },
+ { 0x31800730, 0x3000001a },
+ { 0x3180074d, 0x1c000020 },
+ { 0x37800780, 0x1c000025 },
+ { 0x378007a6, 0x3000000a },
+ { 0x370007b1, 0x1c000000 },
+ { 0x0e800901, 0x30000001 },
+ { 0x0e000903, 0x28000000 },
+ { 0x0e800904, 0x1c000035 },
+ { 0x0e00093c, 0x30000000 },
+ { 0x0e00093d, 0x1c000000 },
+ { 0x0e80093e, 0x28000002 },
+ { 0x0e800941, 0x30000007 },
+ { 0x0e800949, 0x28000003 },
+ { 0x0e00094d, 0x30000000 },
+ { 0x0e000950, 0x1c000000 },
+ { 0x0e800951, 0x30000003 },
+ { 0x0e800958, 0x1c000009 },
+ { 0x0e800962, 0x30000001 },
+ { 0x09800964, 0x54000001 },
+ { 0x0e800966, 0x34000009 },
+ { 0x09000970, 0x54000000 },
+ { 0x0e00097d, 0x1c000000 },
+ { 0x02000981, 0x30000000 },
+ { 0x02800982, 0x28000001 },
+ { 0x02800985, 0x1c000007 },
+ { 0x0280098f, 0x1c000001 },
+ { 0x02800993, 0x1c000015 },
+ { 0x028009aa, 0x1c000006 },
+ { 0x020009b2, 0x1c000000 },
+ { 0x028009b6, 0x1c000003 },
+ { 0x020009bc, 0x30000000 },
+ { 0x020009bd, 0x1c000000 },
+ { 0x028009be, 0x28000002 },
+ { 0x028009c1, 0x30000003 },
+ { 0x028009c7, 0x28000001 },
+ { 0x028009cb, 0x28000001 },
+ { 0x020009cd, 0x30000000 },
+ { 0x020009ce, 0x1c000000 },
+ { 0x020009d7, 0x28000000 },
+ { 0x028009dc, 0x1c000001 },
+ { 0x028009df, 0x1c000002 },
+ { 0x028009e2, 0x30000001 },
+ { 0x028009e6, 0x34000009 },
+ { 0x028009f0, 0x1c000001 },
+ { 0x028009f2, 0x5c000001 },
+ { 0x028009f4, 0x3c000005 },
+ { 0x020009fa, 0x68000000 },
+ { 0x15800a01, 0x30000001 },
+ { 0x15000a03, 0x28000000 },
+ { 0x15800a05, 0x1c000005 },
+ { 0x15800a0f, 0x1c000001 },
+ { 0x15800a13, 0x1c000015 },
+ { 0x15800a2a, 0x1c000006 },
+ { 0x15800a32, 0x1c000001 },
+ { 0x15800a35, 0x1c000001 },
+ { 0x15800a38, 0x1c000001 },
+ { 0x15000a3c, 0x30000000 },
+ { 0x15800a3e, 0x28000002 },
+ { 0x15800a41, 0x30000001 },
+ { 0x15800a47, 0x30000001 },
+ { 0x15800a4b, 0x30000002 },
+ { 0x15800a59, 0x1c000003 },
+ { 0x15000a5e, 0x1c000000 },
+ { 0x15800a66, 0x34000009 },
+ { 0x15800a70, 0x30000001 },
+ { 0x15800a72, 0x1c000002 },
+ { 0x14800a81, 0x30000001 },
+ { 0x14000a83, 0x28000000 },
+ { 0x14800a85, 0x1c000008 },
+ { 0x14800a8f, 0x1c000002 },
+ { 0x14800a93, 0x1c000015 },
+ { 0x14800aaa, 0x1c000006 },
+ { 0x14800ab2, 0x1c000001 },
+ { 0x14800ab5, 0x1c000004 },
+ { 0x14000abc, 0x30000000 },
+ { 0x14000abd, 0x1c000000 },
+ { 0x14800abe, 0x28000002 },
+ { 0x14800ac1, 0x30000004 },
+ { 0x14800ac7, 0x30000001 },
+ { 0x14000ac9, 0x28000000 },
+ { 0x14800acb, 0x28000001 },
+ { 0x14000acd, 0x30000000 },
+ { 0x14000ad0, 0x1c000000 },
+ { 0x14800ae0, 0x1c000001 },
+ { 0x14800ae2, 0x30000001 },
+ { 0x14800ae6, 0x34000009 },
+ { 0x14000af1, 0x5c000000 },
+ { 0x2b000b01, 0x30000000 },
+ { 0x2b800b02, 0x28000001 },
+ { 0x2b800b05, 0x1c000007 },
+ { 0x2b800b0f, 0x1c000001 },
+ { 0x2b800b13, 0x1c000015 },
+ { 0x2b800b2a, 0x1c000006 },
+ { 0x2b800b32, 0x1c000001 },
+ { 0x2b800b35, 0x1c000004 },
+ { 0x2b000b3c, 0x30000000 },
+ { 0x2b000b3d, 0x1c000000 },
+ { 0x2b000b3e, 0x28000000 },
+ { 0x2b000b3f, 0x30000000 },
+ { 0x2b000b40, 0x28000000 },
+ { 0x2b800b41, 0x30000002 },
+ { 0x2b800b47, 0x28000001 },
+ { 0x2b800b4b, 0x28000001 },
+ { 0x2b000b4d, 0x30000000 },
+ { 0x2b000b56, 0x30000000 },
+ { 0x2b000b57, 0x28000000 },
+ { 0x2b800b5c, 0x1c000001 },
+ { 0x2b800b5f, 0x1c000002 },
+ { 0x2b800b66, 0x34000009 },
+ { 0x2b000b70, 0x68000000 },
+ { 0x2b000b71, 0x1c000000 },
+ { 0x35000b82, 0x30000000 },
+ { 0x35000b83, 0x1c000000 },
+ { 0x35800b85, 0x1c000005 },
+ { 0x35800b8e, 0x1c000002 },
+ { 0x35800b92, 0x1c000003 },
+ { 0x35800b99, 0x1c000001 },
+ { 0x35000b9c, 0x1c000000 },
+ { 0x35800b9e, 0x1c000001 },
+ { 0x35800ba3, 0x1c000001 },
+ { 0x35800ba8, 0x1c000002 },
+ { 0x35800bae, 0x1c00000b },
+ { 0x35800bbe, 0x28000001 },
+ { 0x35000bc0, 0x30000000 },
+ { 0x35800bc1, 0x28000001 },
+ { 0x35800bc6, 0x28000002 },
+ { 0x35800bca, 0x28000002 },
+ { 0x35000bcd, 0x30000000 },
+ { 0x35000bd7, 0x28000000 },
+ { 0x35800be6, 0x34000009 },
+ { 0x35800bf0, 0x3c000002 },
+ { 0x35800bf3, 0x68000005 },
+ { 0x35000bf9, 0x5c000000 },
+ { 0x35000bfa, 0x68000000 },
+ { 0x36800c01, 0x28000002 },
+ { 0x36800c05, 0x1c000007 },
+ { 0x36800c0e, 0x1c000002 },
+ { 0x36800c12, 0x1c000016 },
+ { 0x36800c2a, 0x1c000009 },
+ { 0x36800c35, 0x1c000004 },
+ { 0x36800c3e, 0x30000002 },
+ { 0x36800c41, 0x28000003 },
+ { 0x36800c46, 0x30000002 },
+ { 0x36800c4a, 0x30000003 },
+ { 0x36800c55, 0x30000001 },
+ { 0x36800c60, 0x1c000001 },
+ { 0x36800c66, 0x34000009 },
+ { 0x1c800c82, 0x28000001 },
+ { 0x1c800c85, 0x1c000007 },
+ { 0x1c800c8e, 0x1c000002 },
+ { 0x1c800c92, 0x1c000016 },
+ { 0x1c800caa, 0x1c000009 },
+ { 0x1c800cb5, 0x1c000004 },
+ { 0x1c000cbc, 0x30000000 },
+ { 0x1c000cbd, 0x1c000000 },
+ { 0x1c000cbe, 0x28000000 },
+ { 0x1c000cbf, 0x30000000 },
+ { 0x1c800cc0, 0x28000004 },
+ { 0x1c000cc6, 0x30000000 },
+ { 0x1c800cc7, 0x28000001 },
+ { 0x1c800cca, 0x28000001 },
+ { 0x1c800ccc, 0x30000001 },
+ { 0x1c800cd5, 0x28000001 },
+ { 0x1c000cde, 0x1c000000 },
+ { 0x1c800ce0, 0x1c000001 },
+ { 0x1c800ce6, 0x34000009 },
+ { 0x24800d02, 0x28000001 },
+ { 0x24800d05, 0x1c000007 },
+ { 0x24800d0e, 0x1c000002 },
+ { 0x24800d12, 0x1c000016 },
+ { 0x24800d2a, 0x1c00000f },
+ { 0x24800d3e, 0x28000002 },
+ { 0x24800d41, 0x30000002 },
+ { 0x24800d46, 0x28000002 },
+ { 0x24800d4a, 0x28000002 },
+ { 0x24000d4d, 0x30000000 },
+ { 0x24000d57, 0x28000000 },
+ { 0x24800d60, 0x1c000001 },
+ { 0x24800d66, 0x34000009 },
+ { 0x2f800d82, 0x28000001 },
+ { 0x2f800d85, 0x1c000011 },
+ { 0x2f800d9a, 0x1c000017 },
+ { 0x2f800db3, 0x1c000008 },
+ { 0x2f000dbd, 0x1c000000 },
+ { 0x2f800dc0, 0x1c000006 },
+ { 0x2f000dca, 0x30000000 },
+ { 0x2f800dcf, 0x28000002 },
+ { 0x2f800dd2, 0x30000002 },
+ { 0x2f000dd6, 0x30000000 },
+ { 0x2f800dd8, 0x28000007 },
+ { 0x2f800df2, 0x28000001 },
+ { 0x2f000df4, 0x54000000 },
+ { 0x38800e01, 0x1c00002f },
+ { 0x38000e31, 0x30000000 },
+ { 0x38800e32, 0x1c000001 },
+ { 0x38800e34, 0x30000006 },
+ { 0x09000e3f, 0x5c000000 },
+ { 0x38800e40, 0x1c000005 },
+ { 0x38000e46, 0x18000000 },
+ { 0x38800e47, 0x30000007 },
+ { 0x38000e4f, 0x54000000 },
+ { 0x38800e50, 0x34000009 },
+ { 0x38800e5a, 0x54000001 },
+ { 0x20800e81, 0x1c000001 },
+ { 0x20000e84, 0x1c000000 },
+ { 0x20800e87, 0x1c000001 },
+ { 0x20000e8a, 0x1c000000 },
+ { 0x20000e8d, 0x1c000000 },
+ { 0x20800e94, 0x1c000003 },
+ { 0x20800e99, 0x1c000006 },
+ { 0x20800ea1, 0x1c000002 },
+ { 0x20000ea5, 0x1c000000 },
+ { 0x20000ea7, 0x1c000000 },
+ { 0x20800eaa, 0x1c000001 },
+ { 0x20800ead, 0x1c000003 },
+ { 0x20000eb1, 0x30000000 },
+ { 0x20800eb2, 0x1c000001 },
+ { 0x20800eb4, 0x30000005 },
+ { 0x20800ebb, 0x30000001 },
+ { 0x20000ebd, 0x1c000000 },
+ { 0x20800ec0, 0x1c000004 },
+ { 0x20000ec6, 0x18000000 },
+ { 0x20800ec8, 0x30000005 },
+ { 0x20800ed0, 0x34000009 },
+ { 0x20800edc, 0x1c000001 },
+ { 0x39000f00, 0x1c000000 },
+ { 0x39800f01, 0x68000002 },
+ { 0x39800f04, 0x5400000e },
+ { 0x39800f13, 0x68000004 },
+ { 0x39800f18, 0x30000001 },
+ { 0x39800f1a, 0x68000005 },
+ { 0x39800f20, 0x34000009 },
+ { 0x39800f2a, 0x3c000009 },
+ { 0x39000f34, 0x68000000 },
+ { 0x39000f35, 0x30000000 },
+ { 0x39000f36, 0x68000000 },
+ { 0x39000f37, 0x30000000 },
+ { 0x39000f38, 0x68000000 },
+ { 0x39000f39, 0x30000000 },
+ { 0x39000f3a, 0x58000000 },
+ { 0x39000f3b, 0x48000000 },
+ { 0x39000f3c, 0x58000000 },
+ { 0x39000f3d, 0x48000000 },
+ { 0x39800f3e, 0x28000001 },
+ { 0x39800f40, 0x1c000007 },
+ { 0x39800f49, 0x1c000021 },
+ { 0x39800f71, 0x3000000d },
+ { 0x39000f7f, 0x28000000 },
+ { 0x39800f80, 0x30000004 },
+ { 0x39000f85, 0x54000000 },
+ { 0x39800f86, 0x30000001 },
+ { 0x39800f88, 0x1c000003 },
+ { 0x39800f90, 0x30000007 },
+ { 0x39800f99, 0x30000023 },
+ { 0x39800fbe, 0x68000007 },
+ { 0x39000fc6, 0x30000000 },
+ { 0x39800fc7, 0x68000005 },
+ { 0x39000fcf, 0x68000000 },
+ { 0x39800fd0, 0x54000001 },
+ { 0x26801000, 0x1c000021 },
+ { 0x26801023, 0x1c000004 },
+ { 0x26801029, 0x1c000001 },
+ { 0x2600102c, 0x28000000 },
+ { 0x2680102d, 0x30000003 },
+ { 0x26001031, 0x28000000 },
+ { 0x26001032, 0x30000000 },
+ { 0x26801036, 0x30000001 },
+ { 0x26001038, 0x28000000 },
+ { 0x26001039, 0x30000000 },
+ { 0x26801040, 0x34000009 },
+ { 0x2680104a, 0x54000005 },
+ { 0x26801050, 0x1c000005 },
+ { 0x26801056, 0x28000001 },
+ { 0x26801058, 0x30000001 },
+ { 0x100010a0, 0x24001c60 },
+ { 0x100010a1, 0x24001c60 },
+ { 0x100010a2, 0x24001c60 },
+ { 0x100010a3, 0x24001c60 },
+ { 0x100010a4, 0x24001c60 },
+ { 0x100010a5, 0x24001c60 },
+ { 0x100010a6, 0x24001c60 },
+ { 0x100010a7, 0x24001c60 },
+ { 0x100010a8, 0x24001c60 },
+ { 0x100010a9, 0x24001c60 },
+ { 0x100010aa, 0x24001c60 },
+ { 0x100010ab, 0x24001c60 },
+ { 0x100010ac, 0x24001c60 },
+ { 0x100010ad, 0x24001c60 },
+ { 0x100010ae, 0x24001c60 },
+ { 0x100010af, 0x24001c60 },
+ { 0x100010b0, 0x24001c60 },
+ { 0x100010b1, 0x24001c60 },
+ { 0x100010b2, 0x24001c60 },
+ { 0x100010b3, 0x24001c60 },
+ { 0x100010b4, 0x24001c60 },
+ { 0x100010b5, 0x24001c60 },
+ { 0x100010b6, 0x24001c60 },
+ { 0x100010b7, 0x24001c60 },
+ { 0x100010b8, 0x24001c60 },
+ { 0x100010b9, 0x24001c60 },
+ { 0x100010ba, 0x24001c60 },
+ { 0x100010bb, 0x24001c60 },
+ { 0x100010bc, 0x24001c60 },
+ { 0x100010bd, 0x24001c60 },
+ { 0x100010be, 0x24001c60 },
+ { 0x100010bf, 0x24001c60 },
+ { 0x100010c0, 0x24001c60 },
+ { 0x100010c1, 0x24001c60 },
+ { 0x100010c2, 0x24001c60 },
+ { 0x100010c3, 0x24001c60 },
+ { 0x100010c4, 0x24001c60 },
+ { 0x100010c5, 0x24001c60 },
+ { 0x108010d0, 0x1c00002a },
+ { 0x090010fb, 0x54000000 },
+ { 0x100010fc, 0x18000000 },
+ { 0x17801100, 0x1c000059 },
+ { 0x1780115f, 0x1c000043 },
+ { 0x178011a8, 0x1c000051 },
+ { 0x0f801200, 0x1c000048 },
+ { 0x0f80124a, 0x1c000003 },
+ { 0x0f801250, 0x1c000006 },
+ { 0x0f001258, 0x1c000000 },
+ { 0x0f80125a, 0x1c000003 },
+ { 0x0f801260, 0x1c000028 },
+ { 0x0f80128a, 0x1c000003 },
+ { 0x0f801290, 0x1c000020 },
+ { 0x0f8012b2, 0x1c000003 },
+ { 0x0f8012b8, 0x1c000006 },
+ { 0x0f0012c0, 0x1c000000 },
+ { 0x0f8012c2, 0x1c000003 },
+ { 0x0f8012c8, 0x1c00000e },
+ { 0x0f8012d8, 0x1c000038 },
+ { 0x0f801312, 0x1c000003 },
+ { 0x0f801318, 0x1c000042 },
+ { 0x0f00135f, 0x30000000 },
+ { 0x0f001360, 0x68000000 },
+ { 0x0f801361, 0x54000007 },
+ { 0x0f801369, 0x3c000013 },
+ { 0x0f801380, 0x1c00000f },
+ { 0x0f801390, 0x68000009 },
+ { 0x088013a0, 0x1c000054 },
+ { 0x07801401, 0x1c00026b },
+ { 0x0780166d, 0x54000001 },
+ { 0x0780166f, 0x1c000007 },
+ { 0x28001680, 0x74000000 },
+ { 0x28801681, 0x1c000019 },
+ { 0x2800169b, 0x58000000 },
+ { 0x2800169c, 0x48000000 },
+ { 0x2d8016a0, 0x1c00004a },
+ { 0x098016eb, 0x54000002 },
+ { 0x2d8016ee, 0x38000002 },
+ { 0x32801700, 0x1c00000c },
+ { 0x3280170e, 0x1c000003 },
+ { 0x32801712, 0x30000002 },
+ { 0x18801720, 0x1c000011 },
+ { 0x18801732, 0x30000002 },
+ { 0x09801735, 0x54000001 },
+ { 0x06801740, 0x1c000011 },
+ { 0x06801752, 0x30000001 },
+ { 0x33801760, 0x1c00000c },
+ { 0x3380176e, 0x1c000002 },
+ { 0x33801772, 0x30000001 },
+ { 0x1f801780, 0x1c000033 },
+ { 0x1f8017b4, 0x04000001 },
+ { 0x1f0017b6, 0x28000000 },
+ { 0x1f8017b7, 0x30000006 },
+ { 0x1f8017be, 0x28000007 },
+ { 0x1f0017c6, 0x30000000 },
+ { 0x1f8017c7, 0x28000001 },
+ { 0x1f8017c9, 0x3000000a },
+ { 0x1f8017d4, 0x54000002 },
+ { 0x1f0017d7, 0x18000000 },
+ { 0x1f8017d8, 0x54000002 },
+ { 0x1f0017db, 0x5c000000 },
+ { 0x1f0017dc, 0x1c000000 },
+ { 0x1f0017dd, 0x30000000 },
+ { 0x1f8017e0, 0x34000009 },
+ { 0x1f8017f0, 0x3c000009 },
+ { 0x25801800, 0x54000005 },
+ { 0x25001806, 0x44000000 },
+ { 0x25801807, 0x54000003 },
+ { 0x2580180b, 0x30000002 },
+ { 0x2500180e, 0x74000000 },
+ { 0x25801810, 0x34000009 },
+ { 0x25801820, 0x1c000022 },
+ { 0x25001843, 0x18000000 },
+ { 0x25801844, 0x1c000033 },
+ { 0x25801880, 0x1c000028 },
+ { 0x250018a9, 0x30000000 },
+ { 0x22801900, 0x1c00001c },
+ { 0x22801920, 0x30000002 },
+ { 0x22801923, 0x28000003 },
+ { 0x22801927, 0x30000001 },
+ { 0x22801929, 0x28000002 },
+ { 0x22801930, 0x28000001 },
+ { 0x22001932, 0x30000000 },
+ { 0x22801933, 0x28000005 },
+ { 0x22801939, 0x30000002 },
+ { 0x22001940, 0x68000000 },
+ { 0x22801944, 0x54000001 },
+ { 0x22801946, 0x34000009 },
+ { 0x34801950, 0x1c00001d },
+ { 0x34801970, 0x1c000004 },
+ { 0x27801980, 0x1c000029 },
+ { 0x278019b0, 0x28000010 },
+ { 0x278019c1, 0x1c000006 },
+ { 0x278019c8, 0x28000001 },
+ { 0x278019d0, 0x34000009 },
+ { 0x278019de, 0x54000001 },
+ { 0x1f8019e0, 0x6800001f },
+ { 0x05801a00, 0x1c000016 },
+ { 0x05801a17, 0x30000001 },
+ { 0x05801a19, 0x28000002 },
+ { 0x05801a1e, 0x54000001 },
+ { 0x21801d00, 0x1400002b },
+ { 0x21801d2c, 0x18000035 },
+ { 0x21801d62, 0x14000015 },
+ { 0x0c001d78, 0x18000000 },
+ { 0x21801d79, 0x14000021 },
+ { 0x21801d9b, 0x18000024 },
+ { 0x1b801dc0, 0x30000003 },
+ { 0x21001e00, 0x24000001 },
+ { 0x21001e01, 0x1400ffff },
+ { 0x21001e02, 0x24000001 },
+ { 0x21001e03, 0x1400ffff },
+ { 0x21001e04, 0x24000001 },
+ { 0x21001e05, 0x1400ffff },
+ { 0x21001e06, 0x24000001 },
+ { 0x21001e07, 0x1400ffff },
+ { 0x21001e08, 0x24000001 },
+ { 0x21001e09, 0x1400ffff },
+ { 0x21001e0a, 0x24000001 },
+ { 0x21001e0b, 0x1400ffff },
+ { 0x21001e0c, 0x24000001 },
+ { 0x21001e0d, 0x1400ffff },
+ { 0x21001e0e, 0x24000001 },
+ { 0x21001e0f, 0x1400ffff },
+ { 0x21001e10, 0x24000001 },
+ { 0x21001e11, 0x1400ffff },
+ { 0x21001e12, 0x24000001 },
+ { 0x21001e13, 0x1400ffff },
+ { 0x21001e14, 0x24000001 },
+ { 0x21001e15, 0x1400ffff },
+ { 0x21001e16, 0x24000001 },
+ { 0x21001e17, 0x1400ffff },
+ { 0x21001e18, 0x24000001 },
+ { 0x21001e19, 0x1400ffff },
+ { 0x21001e1a, 0x24000001 },
+ { 0x21001e1b, 0x1400ffff },
+ { 0x21001e1c, 0x24000001 },
+ { 0x21001e1d, 0x1400ffff },
+ { 0x21001e1e, 0x24000001 },
+ { 0x21001e1f, 0x1400ffff },
+ { 0x21001e20, 0x24000001 },
+ { 0x21001e21, 0x1400ffff },
+ { 0x21001e22, 0x24000001 },
+ { 0x21001e23, 0x1400ffff },
+ { 0x21001e24, 0x24000001 },
+ { 0x21001e25, 0x1400ffff },
+ { 0x21001e26, 0x24000001 },
+ { 0x21001e27, 0x1400ffff },
+ { 0x21001e28, 0x24000001 },
+ { 0x21001e29, 0x1400ffff },
+ { 0x21001e2a, 0x24000001 },
+ { 0x21001e2b, 0x1400ffff },
+ { 0x21001e2c, 0x24000001 },
+ { 0x21001e2d, 0x1400ffff },
+ { 0x21001e2e, 0x24000001 },
+ { 0x21001e2f, 0x1400ffff },
+ { 0x21001e30, 0x24000001 },
+ { 0x21001e31, 0x1400ffff },
+ { 0x21001e32, 0x24000001 },
+ { 0x21001e33, 0x1400ffff },
+ { 0x21001e34, 0x24000001 },
+ { 0x21001e35, 0x1400ffff },
+ { 0x21001e36, 0x24000001 },
+ { 0x21001e37, 0x1400ffff },
+ { 0x21001e38, 0x24000001 },
+ { 0x21001e39, 0x1400ffff },
+ { 0x21001e3a, 0x24000001 },
+ { 0x21001e3b, 0x1400ffff },
+ { 0x21001e3c, 0x24000001 },
+ { 0x21001e3d, 0x1400ffff },
+ { 0x21001e3e, 0x24000001 },
+ { 0x21001e3f, 0x1400ffff },
+ { 0x21001e40, 0x24000001 },
+ { 0x21001e41, 0x1400ffff },
+ { 0x21001e42, 0x24000001 },
+ { 0x21001e43, 0x1400ffff },
+ { 0x21001e44, 0x24000001 },
+ { 0x21001e45, 0x1400ffff },
+ { 0x21001e46, 0x24000001 },
+ { 0x21001e47, 0x1400ffff },
+ { 0x21001e48, 0x24000001 },
+ { 0x21001e49, 0x1400ffff },
+ { 0x21001e4a, 0x24000001 },
+ { 0x21001e4b, 0x1400ffff },
+ { 0x21001e4c, 0x24000001 },
+ { 0x21001e4d, 0x1400ffff },
+ { 0x21001e4e, 0x24000001 },
+ { 0x21001e4f, 0x1400ffff },
+ { 0x21001e50, 0x24000001 },
+ { 0x21001e51, 0x1400ffff },
+ { 0x21001e52, 0x24000001 },
+ { 0x21001e53, 0x1400ffff },
+ { 0x21001e54, 0x24000001 },
+ { 0x21001e55, 0x1400ffff },
+ { 0x21001e56, 0x24000001 },
+ { 0x21001e57, 0x1400ffff },
+ { 0x21001e58, 0x24000001 },
+ { 0x21001e59, 0x1400ffff },
+ { 0x21001e5a, 0x24000001 },
+ { 0x21001e5b, 0x1400ffff },
+ { 0x21001e5c, 0x24000001 },
+ { 0x21001e5d, 0x1400ffff },
+ { 0x21001e5e, 0x24000001 },
+ { 0x21001e5f, 0x1400ffff },
+ { 0x21001e60, 0x24000001 },
+ { 0x21001e61, 0x1400ffff },
+ { 0x21001e62, 0x24000001 },
+ { 0x21001e63, 0x1400ffff },
+ { 0x21001e64, 0x24000001 },
+ { 0x21001e65, 0x1400ffff },
+ { 0x21001e66, 0x24000001 },
+ { 0x21001e67, 0x1400ffff },
+ { 0x21001e68, 0x24000001 },
+ { 0x21001e69, 0x1400ffff },
+ { 0x21001e6a, 0x24000001 },
+ { 0x21001e6b, 0x1400ffff },
+ { 0x21001e6c, 0x24000001 },
+ { 0x21001e6d, 0x1400ffff },
+ { 0x21001e6e, 0x24000001 },
+ { 0x21001e6f, 0x1400ffff },
+ { 0x21001e70, 0x24000001 },
+ { 0x21001e71, 0x1400ffff },
+ { 0x21001e72, 0x24000001 },
+ { 0x21001e73, 0x1400ffff },
+ { 0x21001e74, 0x24000001 },
+ { 0x21001e75, 0x1400ffff },
+ { 0x21001e76, 0x24000001 },
+ { 0x21001e77, 0x1400ffff },
+ { 0x21001e78, 0x24000001 },
+ { 0x21001e79, 0x1400ffff },
+ { 0x21001e7a, 0x24000001 },
+ { 0x21001e7b, 0x1400ffff },
+ { 0x21001e7c, 0x24000001 },
+ { 0x21001e7d, 0x1400ffff },
+ { 0x21001e7e, 0x24000001 },
+ { 0x21001e7f, 0x1400ffff },
+ { 0x21001e80, 0x24000001 },
+ { 0x21001e81, 0x1400ffff },
+ { 0x21001e82, 0x24000001 },
+ { 0x21001e83, 0x1400ffff },
+ { 0x21001e84, 0x24000001 },
+ { 0x21001e85, 0x1400ffff },
+ { 0x21001e86, 0x24000001 },
+ { 0x21001e87, 0x1400ffff },
+ { 0x21001e88, 0x24000001 },
+ { 0x21001e89, 0x1400ffff },
+ { 0x21001e8a, 0x24000001 },
+ { 0x21001e8b, 0x1400ffff },
+ { 0x21001e8c, 0x24000001 },
+ { 0x21001e8d, 0x1400ffff },
+ { 0x21001e8e, 0x24000001 },
+ { 0x21001e8f, 0x1400ffff },
+ { 0x21001e90, 0x24000001 },
+ { 0x21001e91, 0x1400ffff },
+ { 0x21001e92, 0x24000001 },
+ { 0x21001e93, 0x1400ffff },
+ { 0x21001e94, 0x24000001 },
+ { 0x21001e95, 0x1400ffff },
+ { 0x21801e96, 0x14000004 },
+ { 0x21001e9b, 0x1400ffc5 },
+ { 0x21001ea0, 0x24000001 },
+ { 0x21001ea1, 0x1400ffff },
+ { 0x21001ea2, 0x24000001 },
+ { 0x21001ea3, 0x1400ffff },
+ { 0x21001ea4, 0x24000001 },
+ { 0x21001ea5, 0x1400ffff },
+ { 0x21001ea6, 0x24000001 },
+ { 0x21001ea7, 0x1400ffff },
+ { 0x21001ea8, 0x24000001 },
+ { 0x21001ea9, 0x1400ffff },
+ { 0x21001eaa, 0x24000001 },
+ { 0x21001eab, 0x1400ffff },
+ { 0x21001eac, 0x24000001 },
+ { 0x21001ead, 0x1400ffff },
+ { 0x21001eae, 0x24000001 },
+ { 0x21001eaf, 0x1400ffff },
+ { 0x21001eb0, 0x24000001 },
+ { 0x21001eb1, 0x1400ffff },
+ { 0x21001eb2, 0x24000001 },
+ { 0x21001eb3, 0x1400ffff },
+ { 0x21001eb4, 0x24000001 },
+ { 0x21001eb5, 0x1400ffff },
+ { 0x21001eb6, 0x24000001 },
+ { 0x21001eb7, 0x1400ffff },
+ { 0x21001eb8, 0x24000001 },
+ { 0x21001eb9, 0x1400ffff },
+ { 0x21001eba, 0x24000001 },
+ { 0x21001ebb, 0x1400ffff },
+ { 0x21001ebc, 0x24000001 },
+ { 0x21001ebd, 0x1400ffff },
+ { 0x21001ebe, 0x24000001 },
+ { 0x21001ebf, 0x1400ffff },
+ { 0x21001ec0, 0x24000001 },
+ { 0x21001ec1, 0x1400ffff },
+ { 0x21001ec2, 0x24000001 },
+ { 0x21001ec3, 0x1400ffff },
+ { 0x21001ec4, 0x24000001 },
+ { 0x21001ec5, 0x1400ffff },
+ { 0x21001ec6, 0x24000001 },
+ { 0x21001ec7, 0x1400ffff },
+ { 0x21001ec8, 0x24000001 },
+ { 0x21001ec9, 0x1400ffff },
+ { 0x21001eca, 0x24000001 },
+ { 0x21001ecb, 0x1400ffff },
+ { 0x21001ecc, 0x24000001 },
+ { 0x21001ecd, 0x1400ffff },
+ { 0x21001ece, 0x24000001 },
+ { 0x21001ecf, 0x1400ffff },
+ { 0x21001ed0, 0x24000001 },
+ { 0x21001ed1, 0x1400ffff },
+ { 0x21001ed2, 0x24000001 },
+ { 0x21001ed3, 0x1400ffff },
+ { 0x21001ed4, 0x24000001 },
+ { 0x21001ed5, 0x1400ffff },
+ { 0x21001ed6, 0x24000001 },
+ { 0x21001ed7, 0x1400ffff },
+ { 0x21001ed8, 0x24000001 },
+ { 0x21001ed9, 0x1400ffff },
+ { 0x21001eda, 0x24000001 },
+ { 0x21001edb, 0x1400ffff },
+ { 0x21001edc, 0x24000001 },
+ { 0x21001edd, 0x1400ffff },
+ { 0x21001ede, 0x24000001 },
+ { 0x21001edf, 0x1400ffff },
+ { 0x21001ee0, 0x24000001 },
+ { 0x21001ee1, 0x1400ffff },
+ { 0x21001ee2, 0x24000001 },
+ { 0x21001ee3, 0x1400ffff },
+ { 0x21001ee4, 0x24000001 },
+ { 0x21001ee5, 0x1400ffff },
+ { 0x21001ee6, 0x24000001 },
+ { 0x21001ee7, 0x1400ffff },
+ { 0x21001ee8, 0x24000001 },
+ { 0x21001ee9, 0x1400ffff },
+ { 0x21001eea, 0x24000001 },
+ { 0x21001eeb, 0x1400ffff },
+ { 0x21001eec, 0x24000001 },
+ { 0x21001eed, 0x1400ffff },
+ { 0x21001eee, 0x24000001 },
+ { 0x21001eef, 0x1400ffff },
+ { 0x21001ef0, 0x24000001 },
+ { 0x21001ef1, 0x1400ffff },
+ { 0x21001ef2, 0x24000001 },
+ { 0x21001ef3, 0x1400ffff },
+ { 0x21001ef4, 0x24000001 },
+ { 0x21001ef5, 0x1400ffff },
+ { 0x21001ef6, 0x24000001 },
+ { 0x21001ef7, 0x1400ffff },
+ { 0x21001ef8, 0x24000001 },
+ { 0x21001ef9, 0x1400ffff },
+ { 0x13001f00, 0x14000008 },
+ { 0x13001f01, 0x14000008 },
+ { 0x13001f02, 0x14000008 },
+ { 0x13001f03, 0x14000008 },
+ { 0x13001f04, 0x14000008 },
+ { 0x13001f05, 0x14000008 },
+ { 0x13001f06, 0x14000008 },
+ { 0x13001f07, 0x14000008 },
+ { 0x13001f08, 0x2400fff8 },
+ { 0x13001f09, 0x2400fff8 },
+ { 0x13001f0a, 0x2400fff8 },
+ { 0x13001f0b, 0x2400fff8 },
+ { 0x13001f0c, 0x2400fff8 },
+ { 0x13001f0d, 0x2400fff8 },
+ { 0x13001f0e, 0x2400fff8 },
+ { 0x13001f0f, 0x2400fff8 },
+ { 0x13001f10, 0x14000008 },
+ { 0x13001f11, 0x14000008 },
+ { 0x13001f12, 0x14000008 },
+ { 0x13001f13, 0x14000008 },
+ { 0x13001f14, 0x14000008 },
+ { 0x13001f15, 0x14000008 },
+ { 0x13001f18, 0x2400fff8 },
+ { 0x13001f19, 0x2400fff8 },
+ { 0x13001f1a, 0x2400fff8 },
+ { 0x13001f1b, 0x2400fff8 },
+ { 0x13001f1c, 0x2400fff8 },
+ { 0x13001f1d, 0x2400fff8 },
+ { 0x13001f20, 0x14000008 },
+ { 0x13001f21, 0x14000008 },
+ { 0x13001f22, 0x14000008 },
+ { 0x13001f23, 0x14000008 },
+ { 0x13001f24, 0x14000008 },
+ { 0x13001f25, 0x14000008 },
+ { 0x13001f26, 0x14000008 },
+ { 0x13001f27, 0x14000008 },
+ { 0x13001f28, 0x2400fff8 },
+ { 0x13001f29, 0x2400fff8 },
+ { 0x13001f2a, 0x2400fff8 },
+ { 0x13001f2b, 0x2400fff8 },
+ { 0x13001f2c, 0x2400fff8 },
+ { 0x13001f2d, 0x2400fff8 },
+ { 0x13001f2e, 0x2400fff8 },
+ { 0x13001f2f, 0x2400fff8 },
+ { 0x13001f30, 0x14000008 },
+ { 0x13001f31, 0x14000008 },
+ { 0x13001f32, 0x14000008 },
+ { 0x13001f33, 0x14000008 },
+ { 0x13001f34, 0x14000008 },
+ { 0x13001f35, 0x14000008 },
+ { 0x13001f36, 0x14000008 },
+ { 0x13001f37, 0x14000008 },
+ { 0x13001f38, 0x2400fff8 },
+ { 0x13001f39, 0x2400fff8 },
+ { 0x13001f3a, 0x2400fff8 },
+ { 0x13001f3b, 0x2400fff8 },
+ { 0x13001f3c, 0x2400fff8 },
+ { 0x13001f3d, 0x2400fff8 },
+ { 0x13001f3e, 0x2400fff8 },
+ { 0x13001f3f, 0x2400fff8 },
+ { 0x13001f40, 0x14000008 },
+ { 0x13001f41, 0x14000008 },
+ { 0x13001f42, 0x14000008 },
+ { 0x13001f43, 0x14000008 },
+ { 0x13001f44, 0x14000008 },
+ { 0x13001f45, 0x14000008 },
+ { 0x13001f48, 0x2400fff8 },
+ { 0x13001f49, 0x2400fff8 },
+ { 0x13001f4a, 0x2400fff8 },
+ { 0x13001f4b, 0x2400fff8 },
+ { 0x13001f4c, 0x2400fff8 },
+ { 0x13001f4d, 0x2400fff8 },
+ { 0x13001f50, 0x14000000 },
+ { 0x13001f51, 0x14000008 },
+ { 0x13001f52, 0x14000000 },
+ { 0x13001f53, 0x14000008 },
+ { 0x13001f54, 0x14000000 },
+ { 0x13001f55, 0x14000008 },
+ { 0x13001f56, 0x14000000 },
+ { 0x13001f57, 0x14000008 },
+ { 0x13001f59, 0x2400fff8 },
+ { 0x13001f5b, 0x2400fff8 },
+ { 0x13001f5d, 0x2400fff8 },
+ { 0x13001f5f, 0x2400fff8 },
+ { 0x13001f60, 0x14000008 },
+ { 0x13001f61, 0x14000008 },
+ { 0x13001f62, 0x14000008 },
+ { 0x13001f63, 0x14000008 },
+ { 0x13001f64, 0x14000008 },
+ { 0x13001f65, 0x14000008 },
+ { 0x13001f66, 0x14000008 },
+ { 0x13001f67, 0x14000008 },
+ { 0x13001f68, 0x2400fff8 },
+ { 0x13001f69, 0x2400fff8 },
+ { 0x13001f6a, 0x2400fff8 },
+ { 0x13001f6b, 0x2400fff8 },
+ { 0x13001f6c, 0x2400fff8 },
+ { 0x13001f6d, 0x2400fff8 },
+ { 0x13001f6e, 0x2400fff8 },
+ { 0x13001f6f, 0x2400fff8 },
+ { 0x13001f70, 0x1400004a },
+ { 0x13001f71, 0x1400004a },
+ { 0x13001f72, 0x14000056 },
+ { 0x13001f73, 0x14000056 },
+ { 0x13001f74, 0x14000056 },
+ { 0x13001f75, 0x14000056 },
+ { 0x13001f76, 0x14000064 },
+ { 0x13001f77, 0x14000064 },
+ { 0x13001f78, 0x14000080 },
+ { 0x13001f79, 0x14000080 },
+ { 0x13001f7a, 0x14000070 },
+ { 0x13001f7b, 0x14000070 },
+ { 0x13001f7c, 0x1400007e },
+ { 0x13001f7d, 0x1400007e },
+ { 0x13001f80, 0x14000008 },
+ { 0x13001f81, 0x14000008 },
+ { 0x13001f82, 0x14000008 },
+ { 0x13001f83, 0x14000008 },
+ { 0x13001f84, 0x14000008 },
+ { 0x13001f85, 0x14000008 },
+ { 0x13001f86, 0x14000008 },
+ { 0x13001f87, 0x14000008 },
+ { 0x13001f88, 0x2000fff8 },
+ { 0x13001f89, 0x2000fff8 },
+ { 0x13001f8a, 0x2000fff8 },
+ { 0x13001f8b, 0x2000fff8 },
+ { 0x13001f8c, 0x2000fff8 },
+ { 0x13001f8d, 0x2000fff8 },
+ { 0x13001f8e, 0x2000fff8 },
+ { 0x13001f8f, 0x2000fff8 },
+ { 0x13001f90, 0x14000008 },
+ { 0x13001f91, 0x14000008 },
+ { 0x13001f92, 0x14000008 },
+ { 0x13001f93, 0x14000008 },
+ { 0x13001f94, 0x14000008 },
+ { 0x13001f95, 0x14000008 },
+ { 0x13001f96, 0x14000008 },
+ { 0x13001f97, 0x14000008 },
+ { 0x13001f98, 0x2000fff8 },
+ { 0x13001f99, 0x2000fff8 },
+ { 0x13001f9a, 0x2000fff8 },
+ { 0x13001f9b, 0x2000fff8 },
+ { 0x13001f9c, 0x2000fff8 },
+ { 0x13001f9d, 0x2000fff8 },
+ { 0x13001f9e, 0x2000fff8 },
+ { 0x13001f9f, 0x2000fff8 },
+ { 0x13001fa0, 0x14000008 },
+ { 0x13001fa1, 0x14000008 },
+ { 0x13001fa2, 0x14000008 },
+ { 0x13001fa3, 0x14000008 },
+ { 0x13001fa4, 0x14000008 },
+ { 0x13001fa5, 0x14000008 },
+ { 0x13001fa6, 0x14000008 },
+ { 0x13001fa7, 0x14000008 },
+ { 0x13001fa8, 0x2000fff8 },
+ { 0x13001fa9, 0x2000fff8 },
+ { 0x13001faa, 0x2000fff8 },
+ { 0x13001fab, 0x2000fff8 },
+ { 0x13001fac, 0x2000fff8 },
+ { 0x13001fad, 0x2000fff8 },
+ { 0x13001fae, 0x2000fff8 },
+ { 0x13001faf, 0x2000fff8 },
+ { 0x13001fb0, 0x14000008 },
+ { 0x13001fb1, 0x14000008 },
+ { 0x13001fb2, 0x14000000 },
+ { 0x13001fb3, 0x14000009 },
+ { 0x13001fb4, 0x14000000 },
+ { 0x13801fb6, 0x14000001 },
+ { 0x13001fb8, 0x2400fff8 },
+ { 0x13001fb9, 0x2400fff8 },
+ { 0x13001fba, 0x2400ffb6 },
+ { 0x13001fbb, 0x2400ffb6 },
+ { 0x13001fbc, 0x2000fff7 },
+ { 0x13001fbd, 0x60000000 },
+ { 0x13001fbe, 0x1400e3db },
+ { 0x13801fbf, 0x60000002 },
+ { 0x13001fc2, 0x14000000 },
+ { 0x13001fc3, 0x14000009 },
+ { 0x13001fc4, 0x14000000 },
+ { 0x13801fc6, 0x14000001 },
+ { 0x13001fc8, 0x2400ffaa },
+ { 0x13001fc9, 0x2400ffaa },
+ { 0x13001fca, 0x2400ffaa },
+ { 0x13001fcb, 0x2400ffaa },
+ { 0x13001fcc, 0x2000fff7 },
+ { 0x13801fcd, 0x60000002 },
+ { 0x13001fd0, 0x14000008 },
+ { 0x13001fd1, 0x14000008 },
+ { 0x13801fd2, 0x14000001 },
+ { 0x13801fd6, 0x14000001 },
+ { 0x13001fd8, 0x2400fff8 },
+ { 0x13001fd9, 0x2400fff8 },
+ { 0x13001fda, 0x2400ff9c },
+ { 0x13001fdb, 0x2400ff9c },
+ { 0x13801fdd, 0x60000002 },
+ { 0x13001fe0, 0x14000008 },
+ { 0x13001fe1, 0x14000008 },
+ { 0x13801fe2, 0x14000002 },
+ { 0x13001fe5, 0x14000007 },
+ { 0x13801fe6, 0x14000001 },
+ { 0x13001fe8, 0x2400fff8 },
+ { 0x13001fe9, 0x2400fff8 },
+ { 0x13001fea, 0x2400ff90 },
+ { 0x13001feb, 0x2400ff90 },
+ { 0x13001fec, 0x2400fff9 },
+ { 0x13801fed, 0x60000002 },
+ { 0x13001ff2, 0x14000000 },
+ { 0x13001ff3, 0x14000009 },
+ { 0x13001ff4, 0x14000000 },
+ { 0x13801ff6, 0x14000001 },
+ { 0x13001ff8, 0x2400ff80 },
+ { 0x13001ff9, 0x2400ff80 },
+ { 0x13001ffa, 0x2400ff82 },
+ { 0x13001ffb, 0x2400ff82 },
+ { 0x13001ffc, 0x2000fff7 },
+ { 0x13801ffd, 0x60000001 },
+ { 0x09802000, 0x7400000a },
+ { 0x0980200b, 0x04000004 },
+ { 0x09802010, 0x44000005 },
+ { 0x09802016, 0x54000001 },
+ { 0x09002018, 0x50000000 },
+ { 0x09002019, 0x4c000000 },
+ { 0x0900201a, 0x58000000 },
+ { 0x0980201b, 0x50000001 },
+ { 0x0900201d, 0x4c000000 },
+ { 0x0900201e, 0x58000000 },
+ { 0x0900201f, 0x50000000 },
+ { 0x09802020, 0x54000007 },
+ { 0x09002028, 0x6c000000 },
+ { 0x09002029, 0x70000000 },
+ { 0x0980202a, 0x04000004 },
+ { 0x0900202f, 0x74000000 },
+ { 0x09802030, 0x54000008 },
+ { 0x09002039, 0x50000000 },
+ { 0x0900203a, 0x4c000000 },
+ { 0x0980203b, 0x54000003 },
+ { 0x0980203f, 0x40000001 },
+ { 0x09802041, 0x54000002 },
+ { 0x09002044, 0x64000000 },
+ { 0x09002045, 0x58000000 },
+ { 0x09002046, 0x48000000 },
+ { 0x09802047, 0x5400000a },
+ { 0x09002052, 0x64000000 },
+ { 0x09002053, 0x54000000 },
+ { 0x09002054, 0x40000000 },
+ { 0x09802055, 0x54000009 },
+ { 0x0900205f, 0x74000000 },
+ { 0x09802060, 0x04000003 },
+ { 0x0980206a, 0x04000005 },
+ { 0x09002070, 0x3c000000 },
+ { 0x21002071, 0x14000000 },
+ { 0x09802074, 0x3c000005 },
+ { 0x0980207a, 0x64000002 },
+ { 0x0900207d, 0x58000000 },
+ { 0x0900207e, 0x48000000 },
+ { 0x2100207f, 0x14000000 },
+ { 0x09802080, 0x3c000009 },
+ { 0x0980208a, 0x64000002 },
+ { 0x0900208d, 0x58000000 },
+ { 0x0900208e, 0x48000000 },
+ { 0x21802090, 0x18000004 },
+ { 0x098020a0, 0x5c000015 },
+ { 0x1b8020d0, 0x3000000c },
+ { 0x1b8020dd, 0x2c000003 },
+ { 0x1b0020e1, 0x30000000 },
+ { 0x1b8020e2, 0x2c000002 },
+ { 0x1b8020e5, 0x30000006 },
+ { 0x09802100, 0x68000001 },
+ { 0x09002102, 0x24000000 },
+ { 0x09802103, 0x68000003 },
+ { 0x09002107, 0x24000000 },
+ { 0x09802108, 0x68000001 },
+ { 0x0900210a, 0x14000000 },
+ { 0x0980210b, 0x24000002 },
+ { 0x0980210e, 0x14000001 },
+ { 0x09802110, 0x24000002 },
+ { 0x09002113, 0x14000000 },
+ { 0x09002114, 0x68000000 },
+ { 0x09002115, 0x24000000 },
+ { 0x09802116, 0x68000002 },
+ { 0x09802119, 0x24000004 },
+ { 0x0980211e, 0x68000005 },
+ { 0x09002124, 0x24000000 },
+ { 0x09002125, 0x68000000 },
+ { 0x13002126, 0x2400e2a3 },
+ { 0x09002127, 0x68000000 },
+ { 0x09002128, 0x24000000 },
+ { 0x09002129, 0x68000000 },
+ { 0x2100212a, 0x2400df41 },
+ { 0x2100212b, 0x2400dfba },
+ { 0x0980212c, 0x24000001 },
+ { 0x0900212e, 0x68000000 },
+ { 0x0900212f, 0x14000000 },
+ { 0x09802130, 0x24000001 },
+ { 0x09002132, 0x68000000 },
+ { 0x09002133, 0x24000000 },
+ { 0x09002134, 0x14000000 },
+ { 0x09802135, 0x1c000003 },
+ { 0x09002139, 0x14000000 },
+ { 0x0980213a, 0x68000001 },
+ { 0x0980213c, 0x14000001 },
+ { 0x0980213e, 0x24000001 },
+ { 0x09802140, 0x64000004 },
+ { 0x09002145, 0x24000000 },
+ { 0x09802146, 0x14000003 },
+ { 0x0900214a, 0x68000000 },
+ { 0x0900214b, 0x64000000 },
+ { 0x0900214c, 0x68000000 },
+ { 0x09802153, 0x3c00000c },
+ { 0x09002160, 0x38000010 },
+ { 0x09002161, 0x38000010 },
+ { 0x09002162, 0x38000010 },
+ { 0x09002163, 0x38000010 },
+ { 0x09002164, 0x38000010 },
+ { 0x09002165, 0x38000010 },
+ { 0x09002166, 0x38000010 },
+ { 0x09002167, 0x38000010 },
+ { 0x09002168, 0x38000010 },
+ { 0x09002169, 0x38000010 },
+ { 0x0900216a, 0x38000010 },
+ { 0x0900216b, 0x38000010 },
+ { 0x0900216c, 0x38000010 },
+ { 0x0900216d, 0x38000010 },
+ { 0x0900216e, 0x38000010 },
+ { 0x0900216f, 0x38000010 },
+ { 0x09002170, 0x3800fff0 },
+ { 0x09002171, 0x3800fff0 },
+ { 0x09002172, 0x3800fff0 },
+ { 0x09002173, 0x3800fff0 },
+ { 0x09002174, 0x3800fff0 },
+ { 0x09002175, 0x3800fff0 },
+ { 0x09002176, 0x3800fff0 },
+ { 0x09002177, 0x3800fff0 },
+ { 0x09002178, 0x3800fff0 },
+ { 0x09002179, 0x3800fff0 },
+ { 0x0900217a, 0x3800fff0 },
+ { 0x0900217b, 0x3800fff0 },
+ { 0x0900217c, 0x3800fff0 },
+ { 0x0900217d, 0x3800fff0 },
+ { 0x0900217e, 0x3800fff0 },
+ { 0x0900217f, 0x3800fff0 },
+ { 0x09802180, 0x38000003 },
+ { 0x09802190, 0x64000004 },
+ { 0x09802195, 0x68000004 },
+ { 0x0980219a, 0x64000001 },
+ { 0x0980219c, 0x68000003 },
+ { 0x090021a0, 0x64000000 },
+ { 0x098021a1, 0x68000001 },
+ { 0x090021a3, 0x64000000 },
+ { 0x098021a4, 0x68000001 },
+ { 0x090021a6, 0x64000000 },
+ { 0x098021a7, 0x68000006 },
+ { 0x090021ae, 0x64000000 },
+ { 0x098021af, 0x6800001e },
+ { 0x098021ce, 0x64000001 },
+ { 0x098021d0, 0x68000001 },
+ { 0x090021d2, 0x64000000 },
+ { 0x090021d3, 0x68000000 },
+ { 0x090021d4, 0x64000000 },
+ { 0x098021d5, 0x6800001e },
+ { 0x098021f4, 0x6400010b },
+ { 0x09802300, 0x68000007 },
+ { 0x09802308, 0x64000003 },
+ { 0x0980230c, 0x68000013 },
+ { 0x09802320, 0x64000001 },
+ { 0x09802322, 0x68000006 },
+ { 0x09002329, 0x58000000 },
+ { 0x0900232a, 0x48000000 },
+ { 0x0980232b, 0x68000050 },
+ { 0x0900237c, 0x64000000 },
+ { 0x0980237d, 0x6800001d },
+ { 0x0980239b, 0x64000018 },
+ { 0x090023b4, 0x58000000 },
+ { 0x090023b5, 0x48000000 },
+ { 0x090023b6, 0x54000000 },
+ { 0x098023b7, 0x68000024 },
+ { 0x09802400, 0x68000026 },
+ { 0x09802440, 0x6800000a },
+ { 0x09802460, 0x3c00003b },
+ { 0x0980249c, 0x68000019 },
+ { 0x090024b6, 0x6800001a },
+ { 0x090024b7, 0x6800001a },
+ { 0x090024b8, 0x6800001a },
+ { 0x090024b9, 0x6800001a },
+ { 0x090024ba, 0x6800001a },
+ { 0x090024bb, 0x6800001a },
+ { 0x090024bc, 0x6800001a },
+ { 0x090024bd, 0x6800001a },
+ { 0x090024be, 0x6800001a },
+ { 0x090024bf, 0x6800001a },
+ { 0x090024c0, 0x6800001a },
+ { 0x090024c1, 0x6800001a },
+ { 0x090024c2, 0x6800001a },
+ { 0x090024c3, 0x6800001a },
+ { 0x090024c4, 0x6800001a },
+ { 0x090024c5, 0x6800001a },
+ { 0x090024c6, 0x6800001a },
+ { 0x090024c7, 0x6800001a },
+ { 0x090024c8, 0x6800001a },
+ { 0x090024c9, 0x6800001a },
+ { 0x090024ca, 0x6800001a },
+ { 0x090024cb, 0x6800001a },
+ { 0x090024cc, 0x6800001a },
+ { 0x090024cd, 0x6800001a },
+ { 0x090024ce, 0x6800001a },
+ { 0x090024cf, 0x6800001a },
+ { 0x090024d0, 0x6800ffe6 },
+ { 0x090024d1, 0x6800ffe6 },
+ { 0x090024d2, 0x6800ffe6 },
+ { 0x090024d3, 0x6800ffe6 },
+ { 0x090024d4, 0x6800ffe6 },
+ { 0x090024d5, 0x6800ffe6 },
+ { 0x090024d6, 0x6800ffe6 },
+ { 0x090024d7, 0x6800ffe6 },
+ { 0x090024d8, 0x6800ffe6 },
+ { 0x090024d9, 0x6800ffe6 },
+ { 0x090024da, 0x6800ffe6 },
+ { 0x090024db, 0x6800ffe6 },
+ { 0x090024dc, 0x6800ffe6 },
+ { 0x090024dd, 0x6800ffe6 },
+ { 0x090024de, 0x6800ffe6 },
+ { 0x090024df, 0x6800ffe6 },
+ { 0x090024e0, 0x6800ffe6 },
+ { 0x090024e1, 0x6800ffe6 },
+ { 0x090024e2, 0x6800ffe6 },
+ { 0x090024e3, 0x6800ffe6 },
+ { 0x090024e4, 0x6800ffe6 },
+ { 0x090024e5, 0x6800ffe6 },
+ { 0x090024e6, 0x6800ffe6 },
+ { 0x090024e7, 0x6800ffe6 },
+ { 0x090024e8, 0x6800ffe6 },
+ { 0x090024e9, 0x6800ffe6 },
+ { 0x098024ea, 0x3c000015 },
+ { 0x09802500, 0x680000b6 },
+ { 0x090025b7, 0x64000000 },
+ { 0x098025b8, 0x68000008 },
+ { 0x090025c1, 0x64000000 },
+ { 0x098025c2, 0x68000035 },
+ { 0x098025f8, 0x64000007 },
+ { 0x09802600, 0x6800006e },
+ { 0x0900266f, 0x64000000 },
+ { 0x09802670, 0x6800002c },
+ { 0x098026a0, 0x68000011 },
+ { 0x09802701, 0x68000003 },
+ { 0x09802706, 0x68000003 },
+ { 0x0980270c, 0x6800001b },
+ { 0x09802729, 0x68000022 },
+ { 0x0900274d, 0x68000000 },
+ { 0x0980274f, 0x68000003 },
+ { 0x09002756, 0x68000000 },
+ { 0x09802758, 0x68000006 },
+ { 0x09802761, 0x68000006 },
+ { 0x09002768, 0x58000000 },
+ { 0x09002769, 0x48000000 },
+ { 0x0900276a, 0x58000000 },
+ { 0x0900276b, 0x48000000 },
+ { 0x0900276c, 0x58000000 },
+ { 0x0900276d, 0x48000000 },
+ { 0x0900276e, 0x58000000 },
+ { 0x0900276f, 0x48000000 },
+ { 0x09002770, 0x58000000 },
+ { 0x09002771, 0x48000000 },
+ { 0x09002772, 0x58000000 },
+ { 0x09002773, 0x48000000 },
+ { 0x09002774, 0x58000000 },
+ { 0x09002775, 0x48000000 },
+ { 0x09802776, 0x3c00001d },
+ { 0x09002794, 0x68000000 },
+ { 0x09802798, 0x68000017 },
+ { 0x098027b1, 0x6800000d },
+ { 0x098027c0, 0x64000004 },
+ { 0x090027c5, 0x58000000 },
+ { 0x090027c6, 0x48000000 },
+ { 0x098027d0, 0x64000015 },
+ { 0x090027e6, 0x58000000 },
+ { 0x090027e7, 0x48000000 },
+ { 0x090027e8, 0x58000000 },
+ { 0x090027e9, 0x48000000 },
+ { 0x090027ea, 0x58000000 },
+ { 0x090027eb, 0x48000000 },
+ { 0x098027f0, 0x6400000f },
+ { 0x04802800, 0x680000ff },
+ { 0x09802900, 0x64000082 },
+ { 0x09002983, 0x58000000 },
+ { 0x09002984, 0x48000000 },
+ { 0x09002985, 0x58000000 },
+ { 0x09002986, 0x48000000 },
+ { 0x09002987, 0x58000000 },
+ { 0x09002988, 0x48000000 },
+ { 0x09002989, 0x58000000 },
+ { 0x0900298a, 0x48000000 },
+ { 0x0900298b, 0x58000000 },
+ { 0x0900298c, 0x48000000 },
+ { 0x0900298d, 0x58000000 },
+ { 0x0900298e, 0x48000000 },
+ { 0x0900298f, 0x58000000 },
+ { 0x09002990, 0x48000000 },
+ { 0x09002991, 0x58000000 },
+ { 0x09002992, 0x48000000 },
+ { 0x09002993, 0x58000000 },
+ { 0x09002994, 0x48000000 },
+ { 0x09002995, 0x58000000 },
+ { 0x09002996, 0x48000000 },
+ { 0x09002997, 0x58000000 },
+ { 0x09002998, 0x48000000 },
+ { 0x09802999, 0x6400003e },
+ { 0x090029d8, 0x58000000 },
+ { 0x090029d9, 0x48000000 },
+ { 0x090029da, 0x58000000 },
+ { 0x090029db, 0x48000000 },
+ { 0x098029dc, 0x6400001f },
+ { 0x090029fc, 0x58000000 },
+ { 0x090029fd, 0x48000000 },
+ { 0x098029fe, 0x64000101 },
+ { 0x09802b00, 0x68000013 },
+ { 0x11002c00, 0x24000030 },
+ { 0x11002c01, 0x24000030 },
+ { 0x11002c02, 0x24000030 },
+ { 0x11002c03, 0x24000030 },
+ { 0x11002c04, 0x24000030 },
+ { 0x11002c05, 0x24000030 },
+ { 0x11002c06, 0x24000030 },
+ { 0x11002c07, 0x24000030 },
+ { 0x11002c08, 0x24000030 },
+ { 0x11002c09, 0x24000030 },
+ { 0x11002c0a, 0x24000030 },
+ { 0x11002c0b, 0x24000030 },
+ { 0x11002c0c, 0x24000030 },
+ { 0x11002c0d, 0x24000030 },
+ { 0x11002c0e, 0x24000030 },
+ { 0x11002c0f, 0x24000030 },
+ { 0x11002c10, 0x24000030 },
+ { 0x11002c11, 0x24000030 },
+ { 0x11002c12, 0x24000030 },
+ { 0x11002c13, 0x24000030 },
+ { 0x11002c14, 0x24000030 },
+ { 0x11002c15, 0x24000030 },
+ { 0x11002c16, 0x24000030 },
+ { 0x11002c17, 0x24000030 },
+ { 0x11002c18, 0x24000030 },
+ { 0x11002c19, 0x24000030 },
+ { 0x11002c1a, 0x24000030 },
+ { 0x11002c1b, 0x24000030 },
+ { 0x11002c1c, 0x24000030 },
+ { 0x11002c1d, 0x24000030 },
+ { 0x11002c1e, 0x24000030 },
+ { 0x11002c1f, 0x24000030 },
+ { 0x11002c20, 0x24000030 },
+ { 0x11002c21, 0x24000030 },
+ { 0x11002c22, 0x24000030 },
+ { 0x11002c23, 0x24000030 },
+ { 0x11002c24, 0x24000030 },
+ { 0x11002c25, 0x24000030 },
+ { 0x11002c26, 0x24000030 },
+ { 0x11002c27, 0x24000030 },
+ { 0x11002c28, 0x24000030 },
+ { 0x11002c29, 0x24000030 },
+ { 0x11002c2a, 0x24000030 },
+ { 0x11002c2b, 0x24000030 },
+ { 0x11002c2c, 0x24000030 },
+ { 0x11002c2d, 0x24000030 },
+ { 0x11002c2e, 0x24000030 },
+ { 0x11002c30, 0x1400ffd0 },
+ { 0x11002c31, 0x1400ffd0 },
+ { 0x11002c32, 0x1400ffd0 },
+ { 0x11002c33, 0x1400ffd0 },
+ { 0x11002c34, 0x1400ffd0 },
+ { 0x11002c35, 0x1400ffd0 },
+ { 0x11002c36, 0x1400ffd0 },
+ { 0x11002c37, 0x1400ffd0 },
+ { 0x11002c38, 0x1400ffd0 },
+ { 0x11002c39, 0x1400ffd0 },
+ { 0x11002c3a, 0x1400ffd0 },
+ { 0x11002c3b, 0x1400ffd0 },
+ { 0x11002c3c, 0x1400ffd0 },
+ { 0x11002c3d, 0x1400ffd0 },
+ { 0x11002c3e, 0x1400ffd0 },
+ { 0x11002c3f, 0x1400ffd0 },
+ { 0x11002c40, 0x1400ffd0 },
+ { 0x11002c41, 0x1400ffd0 },
+ { 0x11002c42, 0x1400ffd0 },
+ { 0x11002c43, 0x1400ffd0 },
+ { 0x11002c44, 0x1400ffd0 },
+ { 0x11002c45, 0x1400ffd0 },
+ { 0x11002c46, 0x1400ffd0 },
+ { 0x11002c47, 0x1400ffd0 },
+ { 0x11002c48, 0x1400ffd0 },
+ { 0x11002c49, 0x1400ffd0 },
+ { 0x11002c4a, 0x1400ffd0 },
+ { 0x11002c4b, 0x1400ffd0 },
+ { 0x11002c4c, 0x1400ffd0 },
+ { 0x11002c4d, 0x1400ffd0 },
+ { 0x11002c4e, 0x1400ffd0 },
+ { 0x11002c4f, 0x1400ffd0 },
+ { 0x11002c50, 0x1400ffd0 },
+ { 0x11002c51, 0x1400ffd0 },
+ { 0x11002c52, 0x1400ffd0 },
+ { 0x11002c53, 0x1400ffd0 },
+ { 0x11002c54, 0x1400ffd0 },
+ { 0x11002c55, 0x1400ffd0 },
+ { 0x11002c56, 0x1400ffd0 },
+ { 0x11002c57, 0x1400ffd0 },
+ { 0x11002c58, 0x1400ffd0 },
+ { 0x11002c59, 0x1400ffd0 },
+ { 0x11002c5a, 0x1400ffd0 },
+ { 0x11002c5b, 0x1400ffd0 },
+ { 0x11002c5c, 0x1400ffd0 },
+ { 0x11002c5d, 0x1400ffd0 },
+ { 0x11002c5e, 0x1400ffd0 },
+ { 0x0a002c80, 0x24000001 },
+ { 0x0a002c81, 0x1400ffff },
+ { 0x0a002c82, 0x24000001 },
+ { 0x0a002c83, 0x1400ffff },
+ { 0x0a002c84, 0x24000001 },
+ { 0x0a002c85, 0x1400ffff },
+ { 0x0a002c86, 0x24000001 },
+ { 0x0a002c87, 0x1400ffff },
+ { 0x0a002c88, 0x24000001 },
+ { 0x0a002c89, 0x1400ffff },
+ { 0x0a002c8a, 0x24000001 },
+ { 0x0a002c8b, 0x1400ffff },
+ { 0x0a002c8c, 0x24000001 },
+ { 0x0a002c8d, 0x1400ffff },
+ { 0x0a002c8e, 0x24000001 },
+ { 0x0a002c8f, 0x1400ffff },
+ { 0x0a002c90, 0x24000001 },
+ { 0x0a002c91, 0x1400ffff },
+ { 0x0a002c92, 0x24000001 },
+ { 0x0a002c93, 0x1400ffff },
+ { 0x0a002c94, 0x24000001 },
+ { 0x0a002c95, 0x1400ffff },
+ { 0x0a002c96, 0x24000001 },
+ { 0x0a002c97, 0x1400ffff },
+ { 0x0a002c98, 0x24000001 },
+ { 0x0a002c99, 0x1400ffff },
+ { 0x0a002c9a, 0x24000001 },
+ { 0x0a002c9b, 0x1400ffff },
+ { 0x0a002c9c, 0x24000001 },
+ { 0x0a002c9d, 0x1400ffff },
+ { 0x0a002c9e, 0x24000001 },
+ { 0x0a002c9f, 0x1400ffff },
+ { 0x0a002ca0, 0x24000001 },
+ { 0x0a002ca1, 0x1400ffff },
+ { 0x0a002ca2, 0x24000001 },
+ { 0x0a002ca3, 0x1400ffff },
+ { 0x0a002ca4, 0x24000001 },
+ { 0x0a002ca5, 0x1400ffff },
+ { 0x0a002ca6, 0x24000001 },
+ { 0x0a002ca7, 0x1400ffff },
+ { 0x0a002ca8, 0x24000001 },
+ { 0x0a002ca9, 0x1400ffff },
+ { 0x0a002caa, 0x24000001 },
+ { 0x0a002cab, 0x1400ffff },
+ { 0x0a002cac, 0x24000001 },
+ { 0x0a002cad, 0x1400ffff },
+ { 0x0a002cae, 0x24000001 },
+ { 0x0a002caf, 0x1400ffff },
+ { 0x0a002cb0, 0x24000001 },
+ { 0x0a002cb1, 0x1400ffff },
+ { 0x0a002cb2, 0x24000001 },
+ { 0x0a002cb3, 0x1400ffff },
+ { 0x0a002cb4, 0x24000001 },
+ { 0x0a002cb5, 0x1400ffff },
+ { 0x0a002cb6, 0x24000001 },
+ { 0x0a002cb7, 0x1400ffff },
+ { 0x0a002cb8, 0x24000001 },
+ { 0x0a002cb9, 0x1400ffff },
+ { 0x0a002cba, 0x24000001 },
+ { 0x0a002cbb, 0x1400ffff },
+ { 0x0a002cbc, 0x24000001 },
+ { 0x0a002cbd, 0x1400ffff },
+ { 0x0a002cbe, 0x24000001 },
+ { 0x0a002cbf, 0x1400ffff },
+ { 0x0a002cc0, 0x24000001 },
+ { 0x0a002cc1, 0x1400ffff },
+ { 0x0a002cc2, 0x24000001 },
+ { 0x0a002cc3, 0x1400ffff },
+ { 0x0a002cc4, 0x24000001 },
+ { 0x0a002cc5, 0x1400ffff },
+ { 0x0a002cc6, 0x24000001 },
+ { 0x0a002cc7, 0x1400ffff },
+ { 0x0a002cc8, 0x24000001 },
+ { 0x0a002cc9, 0x1400ffff },
+ { 0x0a002cca, 0x24000001 },
+ { 0x0a002ccb, 0x1400ffff },
+ { 0x0a002ccc, 0x24000001 },
+ { 0x0a002ccd, 0x1400ffff },
+ { 0x0a002cce, 0x24000001 },
+ { 0x0a002ccf, 0x1400ffff },
+ { 0x0a002cd0, 0x24000001 },
+ { 0x0a002cd1, 0x1400ffff },
+ { 0x0a002cd2, 0x24000001 },
+ { 0x0a002cd3, 0x1400ffff },
+ { 0x0a002cd4, 0x24000001 },
+ { 0x0a002cd5, 0x1400ffff },
+ { 0x0a002cd6, 0x24000001 },
+ { 0x0a002cd7, 0x1400ffff },
+ { 0x0a002cd8, 0x24000001 },
+ { 0x0a002cd9, 0x1400ffff },
+ { 0x0a002cda, 0x24000001 },
+ { 0x0a002cdb, 0x1400ffff },
+ { 0x0a002cdc, 0x24000001 },
+ { 0x0a002cdd, 0x1400ffff },
+ { 0x0a002cde, 0x24000001 },
+ { 0x0a002cdf, 0x1400ffff },
+ { 0x0a002ce0, 0x24000001 },
+ { 0x0a002ce1, 0x1400ffff },
+ { 0x0a002ce2, 0x24000001 },
+ { 0x0a002ce3, 0x1400ffff },
+ { 0x0a002ce4, 0x14000000 },
+ { 0x0a802ce5, 0x68000005 },
+ { 0x0a802cf9, 0x54000003 },
+ { 0x0a002cfd, 0x3c000000 },
+ { 0x0a802cfe, 0x54000001 },
+ { 0x10002d00, 0x1400e3a0 },
+ { 0x10002d01, 0x1400e3a0 },
+ { 0x10002d02, 0x1400e3a0 },
+ { 0x10002d03, 0x1400e3a0 },
+ { 0x10002d04, 0x1400e3a0 },
+ { 0x10002d05, 0x1400e3a0 },
+ { 0x10002d06, 0x1400e3a0 },
+ { 0x10002d07, 0x1400e3a0 },
+ { 0x10002d08, 0x1400e3a0 },
+ { 0x10002d09, 0x1400e3a0 },
+ { 0x10002d0a, 0x1400e3a0 },
+ { 0x10002d0b, 0x1400e3a0 },
+ { 0x10002d0c, 0x1400e3a0 },
+ { 0x10002d0d, 0x1400e3a0 },
+ { 0x10002d0e, 0x1400e3a0 },
+ { 0x10002d0f, 0x1400e3a0 },
+ { 0x10002d10, 0x1400e3a0 },
+ { 0x10002d11, 0x1400e3a0 },
+ { 0x10002d12, 0x1400e3a0 },
+ { 0x10002d13, 0x1400e3a0 },
+ { 0x10002d14, 0x1400e3a0 },
+ { 0x10002d15, 0x1400e3a0 },
+ { 0x10002d16, 0x1400e3a0 },
+ { 0x10002d17, 0x1400e3a0 },
+ { 0x10002d18, 0x1400e3a0 },
+ { 0x10002d19, 0x1400e3a0 },
+ { 0x10002d1a, 0x1400e3a0 },
+ { 0x10002d1b, 0x1400e3a0 },
+ { 0x10002d1c, 0x1400e3a0 },
+ { 0x10002d1d, 0x1400e3a0 },
+ { 0x10002d1e, 0x1400e3a0 },
+ { 0x10002d1f, 0x1400e3a0 },
+ { 0x10002d20, 0x1400e3a0 },
+ { 0x10002d21, 0x1400e3a0 },
+ { 0x10002d22, 0x1400e3a0 },
+ { 0x10002d23, 0x1400e3a0 },
+ { 0x10002d24, 0x1400e3a0 },
+ { 0x10002d25, 0x1400e3a0 },
+ { 0x3a802d30, 0x1c000035 },
+ { 0x3a002d6f, 0x18000000 },
+ { 0x0f802d80, 0x1c000016 },
+ { 0x0f802da0, 0x1c000006 },
+ { 0x0f802da8, 0x1c000006 },
+ { 0x0f802db0, 0x1c000006 },
+ { 0x0f802db8, 0x1c000006 },
+ { 0x0f802dc0, 0x1c000006 },
+ { 0x0f802dc8, 0x1c000006 },
+ { 0x0f802dd0, 0x1c000006 },
+ { 0x0f802dd8, 0x1c000006 },
+ { 0x09802e00, 0x54000001 },
+ { 0x09002e02, 0x50000000 },
+ { 0x09002e03, 0x4c000000 },
+ { 0x09002e04, 0x50000000 },
+ { 0x09002e05, 0x4c000000 },
+ { 0x09802e06, 0x54000002 },
+ { 0x09002e09, 0x50000000 },
+ { 0x09002e0a, 0x4c000000 },
+ { 0x09002e0b, 0x54000000 },
+ { 0x09002e0c, 0x50000000 },
+ { 0x09002e0d, 0x4c000000 },
+ { 0x09802e0e, 0x54000008 },
+ { 0x09002e17, 0x44000000 },
+ { 0x09002e1c, 0x50000000 },
+ { 0x09002e1d, 0x4c000000 },
+ { 0x16802e80, 0x68000019 },
+ { 0x16802e9b, 0x68000058 },
+ { 0x16802f00, 0x680000d5 },
+ { 0x09802ff0, 0x6800000b },
+ { 0x09003000, 0x74000000 },
+ { 0x09803001, 0x54000002 },
+ { 0x09003004, 0x68000000 },
+ { 0x16003005, 0x18000000 },
+ { 0x09003006, 0x1c000000 },
+ { 0x16003007, 0x38000000 },
+ { 0x09003008, 0x58000000 },
+ { 0x09003009, 0x48000000 },
+ { 0x0900300a, 0x58000000 },
+ { 0x0900300b, 0x48000000 },
+ { 0x0900300c, 0x58000000 },
+ { 0x0900300d, 0x48000000 },
+ { 0x0900300e, 0x58000000 },
+ { 0x0900300f, 0x48000000 },
+ { 0x09003010, 0x58000000 },
+ { 0x09003011, 0x48000000 },
+ { 0x09803012, 0x68000001 },
+ { 0x09003014, 0x58000000 },
+ { 0x09003015, 0x48000000 },
+ { 0x09003016, 0x58000000 },
+ { 0x09003017, 0x48000000 },
+ { 0x09003018, 0x58000000 },
+ { 0x09003019, 0x48000000 },
+ { 0x0900301a, 0x58000000 },
+ { 0x0900301b, 0x48000000 },
+ { 0x0900301c, 0x44000000 },
+ { 0x0900301d, 0x58000000 },
+ { 0x0980301e, 0x48000001 },
+ { 0x09003020, 0x68000000 },
+ { 0x16803021, 0x38000008 },
+ { 0x1b80302a, 0x30000005 },
+ { 0x09003030, 0x44000000 },
+ { 0x09803031, 0x18000004 },
+ { 0x09803036, 0x68000001 },
+ { 0x16803038, 0x38000002 },
+ { 0x1600303b, 0x18000000 },
+ { 0x0900303c, 0x1c000000 },
+ { 0x0900303d, 0x54000000 },
+ { 0x0980303e, 0x68000001 },
+ { 0x1a803041, 0x1c000055 },
+ { 0x1b803099, 0x30000001 },
+ { 0x0980309b, 0x60000001 },
+ { 0x1a80309d, 0x18000001 },
+ { 0x1a00309f, 0x1c000000 },
+ { 0x090030a0, 0x44000000 },
+ { 0x1d8030a1, 0x1c000059 },
+ { 0x090030fb, 0x54000000 },
+ { 0x098030fc, 0x18000002 },
+ { 0x1d0030ff, 0x1c000000 },
+ { 0x03803105, 0x1c000027 },
+ { 0x17803131, 0x1c00005d },
+ { 0x09803190, 0x68000001 },
+ { 0x09803192, 0x3c000003 },
+ { 0x09803196, 0x68000009 },
+ { 0x038031a0, 0x1c000017 },
+ { 0x098031c0, 0x6800000f },
+ { 0x1d8031f0, 0x1c00000f },
+ { 0x17803200, 0x6800001e },
+ { 0x09803220, 0x3c000009 },
+ { 0x0980322a, 0x68000019 },
+ { 0x09003250, 0x68000000 },
+ { 0x09803251, 0x3c00000e },
+ { 0x17803260, 0x6800001f },
+ { 0x09803280, 0x3c000009 },
+ { 0x0980328a, 0x68000026 },
+ { 0x098032b1, 0x3c00000e },
+ { 0x098032c0, 0x6800003e },
+ { 0x09803300, 0x680000ff },
+ { 0x16803400, 0x1c0019b5 },
+ { 0x09804dc0, 0x6800003f },
+ { 0x16804e00, 0x1c0051bb },
+ { 0x3c80a000, 0x1c000014 },
+ { 0x3c00a015, 0x18000000 },
+ { 0x3c80a016, 0x1c000476 },
+ { 0x3c80a490, 0x68000036 },
+ { 0x0980a700, 0x60000016 },
+ { 0x3080a800, 0x1c000001 },
+ { 0x3000a802, 0x28000000 },
+ { 0x3080a803, 0x1c000002 },
+ { 0x3000a806, 0x30000000 },
+ { 0x3080a807, 0x1c000003 },
+ { 0x3000a80b, 0x30000000 },
+ { 0x3080a80c, 0x1c000016 },
+ { 0x3080a823, 0x28000001 },
+ { 0x3080a825, 0x30000001 },
+ { 0x3000a827, 0x28000000 },
+ { 0x3080a828, 0x68000003 },
+ { 0x1780ac00, 0x1c002ba3 },
+ { 0x0980d800, 0x1000037f },
+ { 0x0980db80, 0x1000007f },
+ { 0x0980dc00, 0x100003ff },
+ { 0x0980e000, 0x0c0018ff },
+ { 0x1680f900, 0x1c00012d },
+ { 0x1680fa30, 0x1c00003a },
+ { 0x1680fa70, 0x1c000069 },
+ { 0x2180fb00, 0x14000006 },
+ { 0x0180fb13, 0x14000004 },
+ { 0x1900fb1d, 0x1c000000 },
+ { 0x1900fb1e, 0x30000000 },
+ { 0x1980fb1f, 0x1c000009 },
+ { 0x1900fb29, 0x64000000 },
+ { 0x1980fb2a, 0x1c00000c },
+ { 0x1980fb38, 0x1c000004 },
+ { 0x1900fb3e, 0x1c000000 },
+ { 0x1980fb40, 0x1c000001 },
+ { 0x1980fb43, 0x1c000001 },
+ { 0x1980fb46, 0x1c00006b },
+ { 0x0080fbd3, 0x1c00016a },
+ { 0x0900fd3e, 0x58000000 },
+ { 0x0900fd3f, 0x48000000 },
+ { 0x0080fd50, 0x1c00003f },
+ { 0x0080fd92, 0x1c000035 },
+ { 0x0080fdf0, 0x1c00000b },
+ { 0x0000fdfc, 0x5c000000 },
+ { 0x0900fdfd, 0x68000000 },
+ { 0x1b80fe00, 0x3000000f },
+ { 0x0980fe10, 0x54000006 },
+ { 0x0900fe17, 0x58000000 },
+ { 0x0900fe18, 0x48000000 },
+ { 0x0900fe19, 0x54000000 },
+ { 0x1b80fe20, 0x30000003 },
+ { 0x0900fe30, 0x54000000 },
+ { 0x0980fe31, 0x44000001 },
+ { 0x0980fe33, 0x40000001 },
+ { 0x0900fe35, 0x58000000 },
+ { 0x0900fe36, 0x48000000 },
+ { 0x0900fe37, 0x58000000 },
+ { 0x0900fe38, 0x48000000 },
+ { 0x0900fe39, 0x58000000 },
+ { 0x0900fe3a, 0x48000000 },
+ { 0x0900fe3b, 0x58000000 },
+ { 0x0900fe3c, 0x48000000 },
+ { 0x0900fe3d, 0x58000000 },
+ { 0x0900fe3e, 0x48000000 },
+ { 0x0900fe3f, 0x58000000 },
+ { 0x0900fe40, 0x48000000 },
+ { 0x0900fe41, 0x58000000 },
+ { 0x0900fe42, 0x48000000 },
+ { 0x0900fe43, 0x58000000 },
+ { 0x0900fe44, 0x48000000 },
+ { 0x0980fe45, 0x54000001 },
+ { 0x0900fe47, 0x58000000 },
+ { 0x0900fe48, 0x48000000 },
+ { 0x0980fe49, 0x54000003 },
+ { 0x0980fe4d, 0x40000002 },
+ { 0x0980fe50, 0x54000002 },
+ { 0x0980fe54, 0x54000003 },
+ { 0x0900fe58, 0x44000000 },
+ { 0x0900fe59, 0x58000000 },
+ { 0x0900fe5a, 0x48000000 },
+ { 0x0900fe5b, 0x58000000 },
+ { 0x0900fe5c, 0x48000000 },
+ { 0x0900fe5d, 0x58000000 },
+ { 0x0900fe5e, 0x48000000 },
+ { 0x0980fe5f, 0x54000002 },
+ { 0x0900fe62, 0x64000000 },
+ { 0x0900fe63, 0x44000000 },
+ { 0x0980fe64, 0x64000002 },
+ { 0x0900fe68, 0x54000000 },
+ { 0x0900fe69, 0x5c000000 },
+ { 0x0980fe6a, 0x54000001 },
+ { 0x0080fe70, 0x1c000004 },
+ { 0x0080fe76, 0x1c000086 },
+ { 0x0900feff, 0x04000000 },
+ { 0x0980ff01, 0x54000002 },
+ { 0x0900ff04, 0x5c000000 },
+ { 0x0980ff05, 0x54000002 },
+ { 0x0900ff08, 0x58000000 },
+ { 0x0900ff09, 0x48000000 },
+ { 0x0900ff0a, 0x54000000 },
+ { 0x0900ff0b, 0x64000000 },
+ { 0x0900ff0c, 0x54000000 },
+ { 0x0900ff0d, 0x44000000 },
+ { 0x0980ff0e, 0x54000001 },
+ { 0x0980ff10, 0x34000009 },
+ { 0x0980ff1a, 0x54000001 },
+ { 0x0980ff1c, 0x64000002 },
+ { 0x0980ff1f, 0x54000001 },
+ { 0x2100ff21, 0x24000020 },
+ { 0x2100ff22, 0x24000020 },
+ { 0x2100ff23, 0x24000020 },
+ { 0x2100ff24, 0x24000020 },
+ { 0x2100ff25, 0x24000020 },
+ { 0x2100ff26, 0x24000020 },
+ { 0x2100ff27, 0x24000020 },
+ { 0x2100ff28, 0x24000020 },
+ { 0x2100ff29, 0x24000020 },
+ { 0x2100ff2a, 0x24000020 },
+ { 0x2100ff2b, 0x24000020 },
+ { 0x2100ff2c, 0x24000020 },
+ { 0x2100ff2d, 0x24000020 },
+ { 0x2100ff2e, 0x24000020 },
+ { 0x2100ff2f, 0x24000020 },
+ { 0x2100ff30, 0x24000020 },
+ { 0x2100ff31, 0x24000020 },
+ { 0x2100ff32, 0x24000020 },
+ { 0x2100ff33, 0x24000020 },
+ { 0x2100ff34, 0x24000020 },
+ { 0x2100ff35, 0x24000020 },
+ { 0x2100ff36, 0x24000020 },
+ { 0x2100ff37, 0x24000020 },
+ { 0x2100ff38, 0x24000020 },
+ { 0x2100ff39, 0x24000020 },
+ { 0x2100ff3a, 0x24000020 },
+ { 0x0900ff3b, 0x58000000 },
+ { 0x0900ff3c, 0x54000000 },
+ { 0x0900ff3d, 0x48000000 },
+ { 0x0900ff3e, 0x60000000 },
+ { 0x0900ff3f, 0x40000000 },
+ { 0x0900ff40, 0x60000000 },
+ { 0x2100ff41, 0x1400ffe0 },
+ { 0x2100ff42, 0x1400ffe0 },
+ { 0x2100ff43, 0x1400ffe0 },
+ { 0x2100ff44, 0x1400ffe0 },
+ { 0x2100ff45, 0x1400ffe0 },
+ { 0x2100ff46, 0x1400ffe0 },
+ { 0x2100ff47, 0x1400ffe0 },
+ { 0x2100ff48, 0x1400ffe0 },
+ { 0x2100ff49, 0x1400ffe0 },
+ { 0x2100ff4a, 0x1400ffe0 },
+ { 0x2100ff4b, 0x1400ffe0 },
+ { 0x2100ff4c, 0x1400ffe0 },
+ { 0x2100ff4d, 0x1400ffe0 },
+ { 0x2100ff4e, 0x1400ffe0 },
+ { 0x2100ff4f, 0x1400ffe0 },
+ { 0x2100ff50, 0x1400ffe0 },
+ { 0x2100ff51, 0x1400ffe0 },
+ { 0x2100ff52, 0x1400ffe0 },
+ { 0x2100ff53, 0x1400ffe0 },
+ { 0x2100ff54, 0x1400ffe0 },
+ { 0x2100ff55, 0x1400ffe0 },
+ { 0x2100ff56, 0x1400ffe0 },
+ { 0x2100ff57, 0x1400ffe0 },
+ { 0x2100ff58, 0x1400ffe0 },
+ { 0x2100ff59, 0x1400ffe0 },
+ { 0x2100ff5a, 0x1400ffe0 },
+ { 0x0900ff5b, 0x58000000 },
+ { 0x0900ff5c, 0x64000000 },
+ { 0x0900ff5d, 0x48000000 },
+ { 0x0900ff5e, 0x64000000 },
+ { 0x0900ff5f, 0x58000000 },
+ { 0x0900ff60, 0x48000000 },
+ { 0x0900ff61, 0x54000000 },
+ { 0x0900ff62, 0x58000000 },
+ { 0x0900ff63, 0x48000000 },
+ { 0x0980ff64, 0x54000001 },
+ { 0x1d80ff66, 0x1c000009 },
+ { 0x0900ff70, 0x18000000 },
+ { 0x1d80ff71, 0x1c00002c },
+ { 0x0980ff9e, 0x18000001 },
+ { 0x1780ffa0, 0x1c00001e },
+ { 0x1780ffc2, 0x1c000005 },
+ { 0x1780ffca, 0x1c000005 },
+ { 0x1780ffd2, 0x1c000005 },
+ { 0x1780ffda, 0x1c000002 },
+ { 0x0980ffe0, 0x5c000001 },
+ { 0x0900ffe2, 0x64000000 },
+ { 0x0900ffe3, 0x60000000 },
+ { 0x0900ffe4, 0x68000000 },
+ { 0x0980ffe5, 0x5c000001 },
+ { 0x0900ffe8, 0x68000000 },
+ { 0x0980ffe9, 0x64000003 },
+ { 0x0980ffed, 0x68000001 },
+ { 0x0980fff9, 0x04000002 },
+ { 0x0980fffc, 0x68000001 },
+ { 0x23810000, 0x1c00000b },
+ { 0x2381000d, 0x1c000019 },
+ { 0x23810028, 0x1c000012 },
+ { 0x2381003c, 0x1c000001 },
+ { 0x2381003f, 0x1c00000e },
+ { 0x23810050, 0x1c00000d },
+ { 0x23810080, 0x1c00007a },
+ { 0x09810100, 0x54000001 },
+ { 0x09010102, 0x68000000 },
+ { 0x09810107, 0x3c00002c },
+ { 0x09810137, 0x68000008 },
+ { 0x13810140, 0x38000034 },
+ { 0x13810175, 0x3c000003 },
+ { 0x13810179, 0x68000010 },
+ { 0x1301018a, 0x3c000000 },
+ { 0x29810300, 0x1c00001e },
+ { 0x29810320, 0x3c000003 },
+ { 0x12810330, 0x1c000019 },
+ { 0x1201034a, 0x38000000 },
+ { 0x3b810380, 0x1c00001d },
+ { 0x3b01039f, 0x54000000 },
+ { 0x2a8103a0, 0x1c000023 },
+ { 0x2a8103c8, 0x1c000007 },
+ { 0x2a0103d0, 0x68000000 },
+ { 0x2a8103d1, 0x38000004 },
+ { 0x0d010400, 0x24000028 },
+ { 0x0d010401, 0x24000028 },
+ { 0x0d010402, 0x24000028 },
+ { 0x0d010403, 0x24000028 },
+ { 0x0d010404, 0x24000028 },
+ { 0x0d010405, 0x24000028 },
+ { 0x0d010406, 0x24000028 },
+ { 0x0d010407, 0x24000028 },
+ { 0x0d010408, 0x24000028 },
+ { 0x0d010409, 0x24000028 },
+ { 0x0d01040a, 0x24000028 },
+ { 0x0d01040b, 0x24000028 },
+ { 0x0d01040c, 0x24000028 },
+ { 0x0d01040d, 0x24000028 },
+ { 0x0d01040e, 0x24000028 },
+ { 0x0d01040f, 0x24000028 },
+ { 0x0d010410, 0x24000028 },
+ { 0x0d010411, 0x24000028 },
+ { 0x0d010412, 0x24000028 },
+ { 0x0d010413, 0x24000028 },
+ { 0x0d010414, 0x24000028 },
+ { 0x0d010415, 0x24000028 },
+ { 0x0d010416, 0x24000028 },
+ { 0x0d010417, 0x24000028 },
+ { 0x0d010418, 0x24000028 },
+ { 0x0d010419, 0x24000028 },
+ { 0x0d01041a, 0x24000028 },
+ { 0x0d01041b, 0x24000028 },
+ { 0x0d01041c, 0x24000028 },
+ { 0x0d01041d, 0x24000028 },
+ { 0x0d01041e, 0x24000028 },
+ { 0x0d01041f, 0x24000028 },
+ { 0x0d010420, 0x24000028 },
+ { 0x0d010421, 0x24000028 },
+ { 0x0d010422, 0x24000028 },
+ { 0x0d010423, 0x24000028 },
+ { 0x0d010424, 0x24000028 },
+ { 0x0d010425, 0x24000028 },
+ { 0x0d010426, 0x24000028 },
+ { 0x0d010427, 0x24000028 },
+ { 0x0d010428, 0x1400ffd8 },
+ { 0x0d010429, 0x1400ffd8 },
+ { 0x0d01042a, 0x1400ffd8 },
+ { 0x0d01042b, 0x1400ffd8 },
+ { 0x0d01042c, 0x1400ffd8 },
+ { 0x0d01042d, 0x1400ffd8 },
+ { 0x0d01042e, 0x1400ffd8 },
+ { 0x0d01042f, 0x1400ffd8 },
+ { 0x0d010430, 0x1400ffd8 },
+ { 0x0d010431, 0x1400ffd8 },
+ { 0x0d010432, 0x1400ffd8 },
+ { 0x0d010433, 0x1400ffd8 },
+ { 0x0d010434, 0x1400ffd8 },
+ { 0x0d010435, 0x1400ffd8 },
+ { 0x0d010436, 0x1400ffd8 },
+ { 0x0d010437, 0x1400ffd8 },
+ { 0x0d010438, 0x1400ffd8 },
+ { 0x0d010439, 0x1400ffd8 },
+ { 0x0d01043a, 0x1400ffd8 },
+ { 0x0d01043b, 0x1400ffd8 },
+ { 0x0d01043c, 0x1400ffd8 },
+ { 0x0d01043d, 0x1400ffd8 },
+ { 0x0d01043e, 0x1400ffd8 },
+ { 0x0d01043f, 0x1400ffd8 },
+ { 0x0d010440, 0x1400ffd8 },
+ { 0x0d010441, 0x1400ffd8 },
+ { 0x0d010442, 0x1400ffd8 },
+ { 0x0d010443, 0x1400ffd8 },
+ { 0x0d010444, 0x1400ffd8 },
+ { 0x0d010445, 0x1400ffd8 },
+ { 0x0d010446, 0x1400ffd8 },
+ { 0x0d010447, 0x1400ffd8 },
+ { 0x0d010448, 0x1400ffd8 },
+ { 0x0d010449, 0x1400ffd8 },
+ { 0x0d01044a, 0x1400ffd8 },
+ { 0x0d01044b, 0x1400ffd8 },
+ { 0x0d01044c, 0x1400ffd8 },
+ { 0x0d01044d, 0x1400ffd8 },
+ { 0x0d01044e, 0x1400ffd8 },
+ { 0x0d01044f, 0x1400ffd8 },
+ { 0x2e810450, 0x1c00004d },
+ { 0x2c8104a0, 0x34000009 },
+ { 0x0b810800, 0x1c000005 },
+ { 0x0b010808, 0x1c000000 },
+ { 0x0b81080a, 0x1c00002b },
+ { 0x0b810837, 0x1c000001 },
+ { 0x0b01083c, 0x1c000000 },
+ { 0x0b01083f, 0x1c000000 },
+ { 0x1e010a00, 0x1c000000 },
+ { 0x1e810a01, 0x30000002 },
+ { 0x1e810a05, 0x30000001 },
+ { 0x1e810a0c, 0x30000003 },
+ { 0x1e810a10, 0x1c000003 },
+ { 0x1e810a15, 0x1c000002 },
+ { 0x1e810a19, 0x1c00001a },
+ { 0x1e810a38, 0x30000002 },
+ { 0x1e010a3f, 0x30000000 },
+ { 0x1e810a40, 0x3c000007 },
+ { 0x1e810a50, 0x54000008 },
+ { 0x0981d000, 0x680000f5 },
+ { 0x0981d100, 0x68000026 },
+ { 0x0981d12a, 0x6800003a },
+ { 0x0981d165, 0x28000001 },
+ { 0x1b81d167, 0x30000002 },
+ { 0x0981d16a, 0x68000002 },
+ { 0x0981d16d, 0x28000005 },
+ { 0x0981d173, 0x04000007 },
+ { 0x1b81d17b, 0x30000007 },
+ { 0x0981d183, 0x68000001 },
+ { 0x1b81d185, 0x30000006 },
+ { 0x0981d18c, 0x6800001d },
+ { 0x1b81d1aa, 0x30000003 },
+ { 0x0981d1ae, 0x6800002f },
+ { 0x1381d200, 0x68000041 },
+ { 0x1381d242, 0x30000002 },
+ { 0x1301d245, 0x68000000 },
+ { 0x0981d300, 0x68000056 },
+ { 0x0981d400, 0x24000019 },
+ { 0x0981d41a, 0x14000019 },
+ { 0x0981d434, 0x24000019 },
+ { 0x0981d44e, 0x14000006 },
+ { 0x0981d456, 0x14000011 },
+ { 0x0981d468, 0x24000019 },
+ { 0x0981d482, 0x14000019 },
+ { 0x0901d49c, 0x24000000 },
+ { 0x0981d49e, 0x24000001 },
+ { 0x0901d4a2, 0x24000000 },
+ { 0x0981d4a5, 0x24000001 },
+ { 0x0981d4a9, 0x24000003 },
+ { 0x0981d4ae, 0x24000007 },
+ { 0x0981d4b6, 0x14000003 },
+ { 0x0901d4bb, 0x14000000 },
+ { 0x0981d4bd, 0x14000006 },
+ { 0x0981d4c5, 0x1400000a },
+ { 0x0981d4d0, 0x24000019 },
+ { 0x0981d4ea, 0x14000019 },
+ { 0x0981d504, 0x24000001 },
+ { 0x0981d507, 0x24000003 },
+ { 0x0981d50d, 0x24000007 },
+ { 0x0981d516, 0x24000006 },
+ { 0x0981d51e, 0x14000019 },
+ { 0x0981d538, 0x24000001 },
+ { 0x0981d53b, 0x24000003 },
+ { 0x0981d540, 0x24000004 },
+ { 0x0901d546, 0x24000000 },
+ { 0x0981d54a, 0x24000006 },
+ { 0x0981d552, 0x14000019 },
+ { 0x0981d56c, 0x24000019 },
+ { 0x0981d586, 0x14000019 },
+ { 0x0981d5a0, 0x24000019 },
+ { 0x0981d5ba, 0x14000019 },
+ { 0x0981d5d4, 0x24000019 },
+ { 0x0981d5ee, 0x14000019 },
+ { 0x0981d608, 0x24000019 },
+ { 0x0981d622, 0x14000019 },
+ { 0x0981d63c, 0x24000019 },
+ { 0x0981d656, 0x14000019 },
+ { 0x0981d670, 0x24000019 },
+ { 0x0981d68a, 0x1400001b },
+ { 0x0981d6a8, 0x24000018 },
+ { 0x0901d6c1, 0x64000000 },
+ { 0x0981d6c2, 0x14000018 },
+ { 0x0901d6db, 0x64000000 },
+ { 0x0981d6dc, 0x14000005 },
+ { 0x0981d6e2, 0x24000018 },
+ { 0x0901d6fb, 0x64000000 },
+ { 0x0981d6fc, 0x14000018 },
+ { 0x0901d715, 0x64000000 },
+ { 0x0981d716, 0x14000005 },
+ { 0x0981d71c, 0x24000018 },
+ { 0x0901d735, 0x64000000 },
+ { 0x0981d736, 0x14000018 },
+ { 0x0901d74f, 0x64000000 },
+ { 0x0981d750, 0x14000005 },
+ { 0x0981d756, 0x24000018 },
+ { 0x0901d76f, 0x64000000 },
+ { 0x0981d770, 0x14000018 },
+ { 0x0901d789, 0x64000000 },
+ { 0x0981d78a, 0x14000005 },
+ { 0x0981d790, 0x24000018 },
+ { 0x0901d7a9, 0x64000000 },
+ { 0x0981d7aa, 0x14000018 },
+ { 0x0901d7c3, 0x64000000 },
+ { 0x0981d7c4, 0x14000005 },
+ { 0x0981d7ce, 0x34000031 },
+ { 0x16820000, 0x1c00a6d6 },
+ { 0x1682f800, 0x1c00021d },
+ { 0x090e0001, 0x04000000 },
+ { 0x098e0020, 0x0400005f },
+ { 0x1b8e0100, 0x300000ef },
+ { 0x098f0000, 0x0c00fffd },
+ { 0x09900000, 0x0c00fffd },
+};
diff --git a/Source/JavaScriptCore/profiler/CallIdentifier.h b/Source/JavaScriptCore/profiler/CallIdentifier.h
new file mode 100644
index 0000000..76c1470
--- /dev/null
+++ b/Source/JavaScriptCore/profiler/CallIdentifier.h
@@ -0,0 +1,100 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+#ifndef CallIdentifier_h
+#define CallIdentifier_h
+
+#include <runtime/UString.h>
+#include "FastAllocBase.h"
+#include <wtf/text/CString.h>
+#include <wtf/text/StringHash.h>
+
+namespace JSC {
+
+ struct CallIdentifier : public FastAllocBase {
+ UString m_name;
+ UString m_url;
+ unsigned m_lineNumber;
+
+ CallIdentifier()
+ : m_lineNumber(0)
+ {
+ }
+
+ CallIdentifier(const UString& name, const UString& url, int lineNumber)
+ : m_name(name)
+ , m_url(!url.isNull() ? url : "")
+ , m_lineNumber(lineNumber)
+ {
+ }
+
+ inline bool operator==(const CallIdentifier& ci) const { return ci.m_lineNumber == m_lineNumber && ci.m_name == m_name && ci.m_url == m_url; }
+ inline bool operator!=(const CallIdentifier& ci) const { return !(*this == ci); }
+
+ struct Hash {
+ static unsigned hash(const CallIdentifier& key)
+ {
+ unsigned hashCodes[3] = {
+ key.m_name.impl()->hash(),
+ key.m_url.impl()->hash(),
+ key.m_lineNumber
+ };
+ return WTF::StringHasher::createBlobHash<sizeof(hashCodes)>(hashCodes);
+ }
+
+ static bool equal(const CallIdentifier& a, const CallIdentifier& b) { return a == b; }
+ static const bool safeToCompareToEmptyOrDeleted = true;
+ };
+
+ unsigned hash() const { return Hash::hash(*this); }
+
+#ifndef NDEBUG
+ operator const char*() const { return c_str(); }
+ const char* c_str() const { return m_name.utf8().data(); }
+#endif
+ };
+
+} // namespace JSC
+
+namespace WTF {
+
+ template<> struct DefaultHash<JSC::CallIdentifier> { typedef JSC::CallIdentifier::Hash Hash; };
+
+ template<> struct HashTraits<JSC::CallIdentifier> : GenericHashTraits<JSC::CallIdentifier> {
+ static void constructDeletedValue(JSC::CallIdentifier& slot)
+ {
+ new (&slot) JSC::CallIdentifier(JSC::UString(), JSC::UString(), std::numeric_limits<unsigned>::max());
+ }
+ static bool isDeletedValue(const JSC::CallIdentifier& value)
+ {
+ return value.m_name.isNull() && value.m_url.isNull() && value.m_lineNumber == std::numeric_limits<unsigned>::max();
+ }
+ };
+
+} // namespace WTF
+
+#endif // CallIdentifier_h
+
diff --git a/Source/JavaScriptCore/profiler/Profile.cpp b/Source/JavaScriptCore/profiler/Profile.cpp
new file mode 100644
index 0000000..1a84518
--- /dev/null
+++ b/Source/JavaScriptCore/profiler/Profile.cpp
@@ -0,0 +1,136 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "Profile.h"
+
+#include "ProfileNode.h"
+#include <stdio.h>
+
+namespace JSC {
+
+PassRefPtr<Profile> Profile::create(const UString& title, unsigned uid)
+{
+ return adoptRef(new Profile(title, uid));
+}
+
+Profile::Profile(const UString& title, unsigned uid)
+ : m_title(title)
+ , m_uid(uid)
+{
+ // FIXME: When multi-threading is supported this will be a vector and calls
+ // into the profiler will need to know which thread it is executing on.
+ m_head = ProfileNode::create(0, CallIdentifier("Thread_1", UString(), 0), 0, 0);
+}
+
+Profile::~Profile()
+{
+}
+
+void Profile::forEach(void (ProfileNode::*function)())
+{
+ ProfileNode* currentNode = m_head->firstChild();
+ for (ProfileNode* nextNode = currentNode; nextNode; nextNode = nextNode->firstChild())
+ currentNode = nextNode;
+
+ if (!currentNode)
+ currentNode = m_head.get();
+
+ ProfileNode* endNode = m_head->traverseNextNodePostOrder();
+ while (currentNode && currentNode != endNode) {
+ (currentNode->*function)();
+ currentNode = currentNode->traverseNextNodePostOrder();
+ }
+}
+
+void Profile::focus(const ProfileNode* profileNode)
+{
+ if (!profileNode || !m_head)
+ return;
+
+ bool processChildren;
+ const CallIdentifier& callIdentifier = profileNode->callIdentifier();
+ for (ProfileNode* currentNode = m_head.get(); currentNode; currentNode = currentNode->traverseNextNodePreOrder(processChildren))
+ processChildren = currentNode->focus(callIdentifier);
+
+ // Set the visible time of all nodes so that the %s display correctly.
+ forEach(&ProfileNode::calculateVisibleTotalTime);
+}
+
+void Profile::exclude(const ProfileNode* profileNode)
+{
+ if (!profileNode || !m_head)
+ return;
+
+ const CallIdentifier& callIdentifier = profileNode->callIdentifier();
+
+ for (ProfileNode* currentNode = m_head.get(); currentNode; currentNode = currentNode->traverseNextNodePreOrder())
+ currentNode->exclude(callIdentifier);
+
+ // Set the visible time of the head so the %s display correctly.
+ m_head->setVisibleTotalTime(m_head->totalTime() - m_head->selfTime());
+ m_head->setVisibleSelfTime(0.0);
+}
+
+void Profile::restoreAll()
+{
+ forEach(&ProfileNode::restore);
+}
+
+#ifndef NDEBUG
+void Profile::debugPrintData() const
+{
+ printf("Call graph:\n");
+ m_head->debugPrintData(0);
+}
+
+typedef pair<StringImpl*, unsigned> NameCountPair;
+
+static inline bool functionNameCountPairComparator(const NameCountPair& a, const NameCountPair& b)
+{
+ return a.second > b.second;
+}
+
+void Profile::debugPrintDataSampleStyle() const
+{
+ typedef Vector<NameCountPair> NameCountPairVector;
+
+ FunctionCallHashCount countedFunctions;
+ printf("Call graph:\n");
+ m_head->debugPrintDataSampleStyle(0, countedFunctions);
+
+ printf("\nTotal number in stack:\n");
+ NameCountPairVector sortedFunctions(countedFunctions.size());
+ copyToVector(countedFunctions, sortedFunctions);
+
+ std::sort(sortedFunctions.begin(), sortedFunctions.end(), functionNameCountPairComparator);
+ for (NameCountPairVector::iterator it = sortedFunctions.begin(); it != sortedFunctions.end(); ++it)
+ printf(" %-12d%s\n", (*it).second, UString((*it).first).utf8().data());
+
+ printf("\nSort by top of stack, same collapsed (when >= 5):\n");
+}
+#endif
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/profiler/Profile.h b/Source/JavaScriptCore/profiler/Profile.h
new file mode 100644
index 0000000..6bf29f7
--- /dev/null
+++ b/Source/JavaScriptCore/profiler/Profile.h
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef Profile_h
+#define Profile_h
+
+#include "ProfileNode.h"
+#include <runtime/UString.h>
+#include <wtf/RefCounted.h>
+#include <wtf/RefPtr.h>
+
+namespace JSC {
+
+ class Profile : public RefCounted<Profile> {
+ public:
+ static PassRefPtr<Profile> create(const UString& title, unsigned uid);
+ virtual ~Profile();
+
+ const UString& title() const { return m_title; }
+ ProfileNode* head() const { return m_head.get(); }
+ void setHead(PassRefPtr<ProfileNode> head) { m_head = head; }
+ double totalTime() const { return m_head->totalTime(); }
+ unsigned int uid() const { return m_uid; }
+
+ void forEach(void (ProfileNode::*)());
+
+ void focus(const ProfileNode*);
+ void exclude(const ProfileNode*);
+ void restoreAll();
+
+#ifndef NDEBUG
+ void debugPrintData() const;
+ void debugPrintDataSampleStyle() const;
+#endif
+
+ protected:
+ Profile(const UString& title, unsigned uid);
+
+ private:
+ void removeProfileStart();
+ void removeProfileEnd();
+
+ UString m_title;
+ RefPtr<ProfileNode> m_head;
+ unsigned int m_uid;
+ };
+
+} // namespace JSC
+
+#endif // Profile_h
diff --git a/Source/JavaScriptCore/profiler/ProfileGenerator.cpp b/Source/JavaScriptCore/profiler/ProfileGenerator.cpp
new file mode 100644
index 0000000..68d1733
--- /dev/null
+++ b/Source/JavaScriptCore/profiler/ProfileGenerator.cpp
@@ -0,0 +1,181 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "ProfileGenerator.h"
+
+#include "CallFrame.h"
+#include "CodeBlock.h"
+#include "JSGlobalObject.h"
+#include "JSStringRef.h"
+#include "JSFunction.h"
+#include "Interpreter.h"
+#include "Profile.h"
+#include "Profiler.h"
+#include "Tracing.h"
+
+namespace JSC {
+
+static const char* NonJSExecution = "(idle)";
+
+PassRefPtr<ProfileGenerator> ProfileGenerator::create(const UString& title, ExecState* originatingExec, unsigned uid)
+{
+ return adoptRef(new ProfileGenerator(title, originatingExec, uid));
+}
+
+ProfileGenerator::ProfileGenerator(const UString& title, ExecState* originatingExec, unsigned uid)
+ : m_originatingGlobalExec(originatingExec ? originatingExec->lexicalGlobalObject()->globalExec() : 0)
+ , m_profileGroup(originatingExec ? originatingExec->lexicalGlobalObject()->profileGroup() : 0)
+{
+ m_profile = Profile::create(title, uid);
+ m_currentNode = m_head = m_profile->head();
+ if (originatingExec)
+ addParentForConsoleStart(originatingExec);
+}
+
+void ProfileGenerator::addParentForConsoleStart(ExecState* exec)
+{
+ int lineNumber;
+ intptr_t sourceID;
+ UString sourceURL;
+ JSValue function;
+
+ exec->interpreter()->retrieveLastCaller(exec, lineNumber, sourceID, sourceURL, function);
+ m_currentNode = ProfileNode::create(exec, Profiler::createCallIdentifier(exec, function ? function.toThisObject(exec) : 0, sourceURL, lineNumber), m_head.get(), m_head.get());
+ m_head->insertNode(m_currentNode.get());
+}
+
+const UString& ProfileGenerator::title() const
+{
+ return m_profile->title();
+}
+
+void ProfileGenerator::willExecute(ExecState* callerCallFrame, const CallIdentifier& callIdentifier)
+{
+ if (JAVASCRIPTCORE_PROFILE_WILL_EXECUTE_ENABLED()) {
+ CString name = callIdentifier.m_name.utf8();
+ CString url = callIdentifier.m_url.utf8();
+ JAVASCRIPTCORE_PROFILE_WILL_EXECUTE(m_profileGroup, const_cast<char*>(name.data()), const_cast<char*>(url.data()), callIdentifier.m_lineNumber);
+ }
+
+ if (!m_originatingGlobalExec)
+ return;
+
+ ASSERT(m_currentNode);
+ m_currentNode = m_currentNode->willExecute(callerCallFrame, callIdentifier);
+}
+
+void ProfileGenerator::didExecute(ExecState* callerCallFrame, const CallIdentifier& callIdentifier)
+{
+ if (JAVASCRIPTCORE_PROFILE_DID_EXECUTE_ENABLED()) {
+ CString name = callIdentifier.m_name.utf8();
+ CString url = callIdentifier.m_url.utf8();
+ JAVASCRIPTCORE_PROFILE_DID_EXECUTE(m_profileGroup, const_cast<char*>(name.data()), const_cast<char*>(url.data()), callIdentifier.m_lineNumber);
+ }
+
+ if (!m_originatingGlobalExec)
+ return;
+
+ ASSERT(m_currentNode);
+ if (m_currentNode->callIdentifier() != callIdentifier) {
+ RefPtr<ProfileNode> returningNode = ProfileNode::create(callerCallFrame, callIdentifier, m_head.get(), m_currentNode.get());
+ returningNode->setStartTime(m_currentNode->startTime());
+ returningNode->didExecute();
+ m_currentNode->insertNode(returningNode.release());
+ return;
+ }
+
+ m_currentNode = m_currentNode->didExecute();
+}
+
+void ProfileGenerator::exceptionUnwind(ExecState* handlerCallFrame, const CallIdentifier&)
+{
+ // If the current node was called by the handler (==) or any
+ // more nested function (>) the we have exited early from it.
+ ASSERT(m_currentNode);
+ while (m_currentNode->callerCallFrame() >= handlerCallFrame) {
+ didExecute(m_currentNode->callerCallFrame(), m_currentNode->callIdentifier());
+ ASSERT(m_currentNode);
+ }
+}
+
+void ProfileGenerator::stopProfiling()
+{
+ m_profile->forEach(&ProfileNode::stopProfiling);
+
+ removeProfileStart();
+ removeProfileEnd();
+
+ ASSERT(m_currentNode);
+
+ // Set the current node to the parent, because we are in a call that
+ // will not get didExecute call.
+ m_currentNode = m_currentNode->parent();
+
+ if (double headSelfTime = m_head->selfTime()) {
+ RefPtr<ProfileNode> idleNode = ProfileNode::create(0, CallIdentifier(NonJSExecution, UString(), 0), m_head.get(), m_head.get());
+
+ idleNode->setTotalTime(headSelfTime);
+ idleNode->setSelfTime(headSelfTime);
+ idleNode->setVisible(true);
+
+ m_head->setSelfTime(0.0);
+ m_head->addChild(idleNode.release());
+ }
+}
+
+// The console.ProfileGenerator that started this ProfileGenerator will be the first child.
+void ProfileGenerator::removeProfileStart()
+{
+ ProfileNode* currentNode = 0;
+ for (ProfileNode* next = m_head.get(); next; next = next->firstChild())
+ currentNode = next;
+
+ if (currentNode->callIdentifier().m_name != "profile")
+ return;
+
+ // Attribute the time of the node aobut to be removed to the self time of its parent
+ currentNode->parent()->setSelfTime(currentNode->parent()->selfTime() + currentNode->totalTime());
+ currentNode->parent()->removeChild(currentNode);
+}
+
+// The console.ProfileGeneratorEnd that stopped this ProfileGenerator will be the last child.
+void ProfileGenerator::removeProfileEnd()
+{
+ ProfileNode* currentNode = 0;
+ for (ProfileNode* next = m_head.get(); next; next = next->lastChild())
+ currentNode = next;
+
+ if (currentNode->callIdentifier().m_name != "profileEnd")
+ return;
+
+ // Attribute the time of the node aobut to be removed to the self time of its parent
+ currentNode->parent()->setSelfTime(currentNode->parent()->selfTime() + currentNode->totalTime());
+
+ ASSERT(currentNode->callIdentifier() == (currentNode->parent()->children()[currentNode->parent()->children().size() - 1])->callIdentifier());
+ currentNode->parent()->removeChild(currentNode);
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/profiler/ProfileGenerator.h b/Source/JavaScriptCore/profiler/ProfileGenerator.h
new file mode 100644
index 0000000..cbed73b
--- /dev/null
+++ b/Source/JavaScriptCore/profiler/ProfileGenerator.h
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ProfileGenerator_h
+#define ProfileGenerator_h
+
+#include "Profile.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/RefPtr.h>
+
+namespace JSC {
+
+ class ExecState;
+ class Profile;
+ class ProfileNode;
+ class UString;
+ struct CallIdentifier;
+
+ class ProfileGenerator : public RefCounted<ProfileGenerator> {
+ public:
+ static PassRefPtr<ProfileGenerator> create(const UString& title, ExecState* originatingExec, unsigned uid);
+
+ // Members
+ const UString& title() const;
+ PassRefPtr<Profile> profile() const { return m_profile; }
+ ExecState* originatingGlobalExec() const { return m_originatingGlobalExec; }
+ unsigned profileGroup() const { return m_profileGroup; }
+
+ // Collecting
+ void willExecute(ExecState* callerCallFrame, const CallIdentifier&);
+ void didExecute(ExecState* callerCallFrame, const CallIdentifier&);
+
+ void exceptionUnwind(ExecState* handlerCallFrame, const CallIdentifier&);
+
+ // Stopping Profiling
+ void stopProfiling();
+
+ typedef void (ProfileGenerator::*ProfileFunction)(ExecState* callerOrHandlerCallFrame, const CallIdentifier& callIdentifier);
+
+ private:
+ ProfileGenerator(const UString& title, ExecState* originatingExec, unsigned uid);
+ void addParentForConsoleStart(ExecState*);
+
+ void removeProfileStart();
+ void removeProfileEnd();
+
+ RefPtr<Profile> m_profile;
+ ExecState* m_originatingGlobalExec;
+ unsigned m_profileGroup;
+ RefPtr<ProfileNode> m_head;
+ RefPtr<ProfileNode> m_currentNode;
+ };
+
+} // namespace JSC
+
+#endif // ProfileGenerator_h
diff --git a/Source/JavaScriptCore/profiler/ProfileNode.cpp b/Source/JavaScriptCore/profiler/ProfileNode.cpp
new file mode 100644
index 0000000..8f20bbe
--- /dev/null
+++ b/Source/JavaScriptCore/profiler/ProfileNode.cpp
@@ -0,0 +1,351 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "ProfileNode.h"
+
+#include "Profiler.h"
+#include <stdio.h>
+#include <wtf/DateMath.h>
+#include <wtf/text/StringHash.h>
+
+#if OS(WINDOWS)
+#include <windows.h>
+#endif
+
+using namespace WTF;
+
+namespace JSC {
+
+static double getCount()
+{
+#if OS(WINDOWS)
+ static LARGE_INTEGER frequency;
+ if (!frequency.QuadPart)
+ QueryPerformanceFrequency(&frequency);
+ LARGE_INTEGER counter;
+ QueryPerformanceCounter(&counter);
+ return static_cast<double>(counter.QuadPart) / frequency.QuadPart;
+#else
+ return currentTimeMS();
+#endif
+}
+
+ProfileNode::ProfileNode(ExecState* callerCallFrame, const CallIdentifier& callIdentifier, ProfileNode* headNode, ProfileNode* parentNode)
+ : m_callerCallFrame(callerCallFrame)
+ , m_callIdentifier(callIdentifier)
+ , m_head(headNode)
+ , m_parent(parentNode)
+ , m_nextSibling(0)
+ , m_startTime(0.0)
+ , m_actualTotalTime(0.0)
+ , m_visibleTotalTime(0.0)
+ , m_actualSelfTime(0.0)
+ , m_visibleSelfTime(0.0)
+ , m_numberOfCalls(0)
+ , m_visible(true)
+{
+ startTimer();
+}
+
+ProfileNode::ProfileNode(ExecState* callerCallFrame, ProfileNode* headNode, ProfileNode* nodeToCopy)
+ : m_callerCallFrame(callerCallFrame)
+ , m_callIdentifier(nodeToCopy->callIdentifier())
+ , m_head(headNode)
+ , m_parent(nodeToCopy->parent())
+ , m_nextSibling(0)
+ , m_startTime(0.0)
+ , m_actualTotalTime(nodeToCopy->actualTotalTime())
+ , m_visibleTotalTime(nodeToCopy->totalTime())
+ , m_actualSelfTime(nodeToCopy->actualSelfTime())
+ , m_visibleSelfTime(nodeToCopy->selfTime())
+ , m_numberOfCalls(nodeToCopy->numberOfCalls())
+ , m_visible(nodeToCopy->visible())
+{
+}
+
+ProfileNode* ProfileNode::willExecute(ExecState* callerCallFrame, const CallIdentifier& callIdentifier)
+{
+ for (StackIterator currentChild = m_children.begin(); currentChild != m_children.end(); ++currentChild) {
+ if ((*currentChild)->callIdentifier() == callIdentifier) {
+ (*currentChild)->startTimer();
+ return (*currentChild).get();
+ }
+ }
+
+ RefPtr<ProfileNode> newChild = ProfileNode::create(callerCallFrame, callIdentifier, m_head ? m_head : this, this); // If this ProfileNode has no head it is the head.
+ if (m_children.size())
+ m_children.last()->setNextSibling(newChild.get());
+ m_children.append(newChild.release());
+ return m_children.last().get();
+}
+
+ProfileNode* ProfileNode::didExecute()
+{
+ endAndRecordCall();
+ return m_parent;
+}
+
+void ProfileNode::addChild(PassRefPtr<ProfileNode> prpChild)
+{
+ RefPtr<ProfileNode> child = prpChild;
+ child->setParent(this);
+ if (m_children.size())
+ m_children.last()->setNextSibling(child.get());
+ m_children.append(child.release());
+}
+
+ProfileNode* ProfileNode::findChild(ProfileNode* node) const
+{
+ if (!node)
+ return 0;
+
+ for (size_t i = 0; i < m_children.size(); ++i) {
+ if (*node == m_children[i].get())
+ return m_children[i].get();
+ }
+
+ return 0;
+}
+
+void ProfileNode::removeChild(ProfileNode* node)
+{
+ if (!node)
+ return;
+
+ for (size_t i = 0; i < m_children.size(); ++i) {
+ if (*node == m_children[i].get()) {
+ m_children.remove(i);
+ break;
+ }
+ }
+
+ resetChildrensSiblings();
+}
+
+void ProfileNode::insertNode(PassRefPtr<ProfileNode> prpNode)
+{
+ RefPtr<ProfileNode> node = prpNode;
+
+ for (unsigned i = 0; i < m_children.size(); ++i)
+ node->addChild(m_children[i].release());
+
+ m_children.clear();
+ m_children.append(node.release());
+}
+
+void ProfileNode::stopProfiling()
+{
+ if (m_startTime)
+ endAndRecordCall();
+
+ m_visibleTotalTime = m_actualTotalTime;
+
+ ASSERT(m_actualSelfTime == 0.0 && m_startTime == 0.0);
+
+ // Because we iterate in post order all of our children have been stopped before us.
+ for (unsigned i = 0; i < m_children.size(); ++i)
+ m_actualSelfTime += m_children[i]->totalTime();
+
+ ASSERT(m_actualSelfTime <= m_actualTotalTime);
+ m_actualSelfTime = m_actualTotalTime - m_actualSelfTime;
+ m_visibleSelfTime = m_actualSelfTime;
+}
+
+ProfileNode* ProfileNode::traverseNextNodePostOrder() const
+{
+ ProfileNode* next = m_nextSibling;
+ if (!next)
+ return m_parent;
+ while (ProfileNode* firstChild = next->firstChild())
+ next = firstChild;
+ return next;
+}
+
+ProfileNode* ProfileNode::traverseNextNodePreOrder(bool processChildren) const
+{
+ if (processChildren && m_children.size())
+ return m_children[0].get();
+
+ if (m_nextSibling)
+ return m_nextSibling;
+
+ ProfileNode* nextParent = m_parent;
+ if (!nextParent)
+ return 0;
+
+ ProfileNode* next;
+ for (next = m_parent->nextSibling(); !next; next = nextParent->nextSibling()) {
+ nextParent = nextParent->parent();
+ if (!nextParent)
+ return 0;
+ }
+
+ return next;
+}
+
+void ProfileNode::setTreeVisible(ProfileNode* node, bool visible)
+{
+ ProfileNode* nodeParent = node->parent();
+ ProfileNode* nodeSibling = node->nextSibling();
+ node->setParent(0);
+ node->setNextSibling(0);
+
+ for (ProfileNode* currentNode = node; currentNode; currentNode = currentNode->traverseNextNodePreOrder())
+ currentNode->setVisible(visible);
+
+ node->setParent(nodeParent);
+ node->setNextSibling(nodeSibling);
+}
+
+void ProfileNode::calculateVisibleTotalTime()
+{
+ double sumOfVisibleChildrensTime = 0.0;
+
+ for (unsigned i = 0; i < m_children.size(); ++i) {
+ if (m_children[i]->visible())
+ sumOfVisibleChildrensTime += m_children[i]->totalTime();
+ }
+
+ m_visibleTotalTime = m_visibleSelfTime + sumOfVisibleChildrensTime;
+}
+
+bool ProfileNode::focus(const CallIdentifier& callIdentifier)
+{
+ if (!m_visible)
+ return false;
+
+ if (m_callIdentifier != callIdentifier) {
+ m_visible = false;
+ return true;
+ }
+
+ for (ProfileNode* currentParent = m_parent; currentParent; currentParent = currentParent->parent())
+ currentParent->setVisible(true);
+
+ return false;
+}
+
+void ProfileNode::exclude(const CallIdentifier& callIdentifier)
+{
+ if (m_visible && m_callIdentifier == callIdentifier) {
+ setTreeVisible(this, false);
+
+ m_parent->setVisibleSelfTime(m_parent->selfTime() + m_visibleTotalTime);
+ }
+}
+
+void ProfileNode::restore()
+{
+ m_visibleTotalTime = m_actualTotalTime;
+ m_visibleSelfTime = m_actualSelfTime;
+ m_visible = true;
+}
+
+void ProfileNode::endAndRecordCall()
+{
+ m_actualTotalTime += m_startTime ? getCount() - m_startTime : 0.0;
+ m_startTime = 0.0;
+
+ ++m_numberOfCalls;
+}
+
+void ProfileNode::startTimer()
+{
+ if (!m_startTime)
+ m_startTime = getCount();
+}
+
+void ProfileNode::resetChildrensSiblings()
+{
+ unsigned size = m_children.size();
+ for (unsigned i = 0; i < size; ++i)
+ m_children[i]->setNextSibling(i + 1 == size ? 0 : m_children[i + 1].get());
+}
+
+#ifndef NDEBUG
+void ProfileNode::debugPrintData(int indentLevel) const
+{
+ // Print function names
+ for (int i = 0; i < indentLevel; ++i)
+ printf(" ");
+
+ printf("Function Name %s %d SelfTime %.3fms/%.3f%% TotalTime %.3fms/%.3f%% VSelf %.3fms VTotal %.3fms Visible %s Next Sibling %s\n",
+ functionName().utf8().data(),
+ m_numberOfCalls, m_actualSelfTime, selfPercent(), m_actualTotalTime, totalPercent(),
+ m_visibleSelfTime, m_visibleTotalTime,
+ (m_visible ? "True" : "False"),
+ m_nextSibling ? m_nextSibling->functionName().utf8().data() : "");
+
+ ++indentLevel;
+
+ // Print children's names and information
+ for (StackIterator currentChild = m_children.begin(); currentChild != m_children.end(); ++currentChild)
+ (*currentChild)->debugPrintData(indentLevel);
+}
+
+// print the profiled data in a format that matches the tool sample's output.
+double ProfileNode::debugPrintDataSampleStyle(int indentLevel, FunctionCallHashCount& countedFunctions) const
+{
+ printf(" ");
+
+ // Print function names
+ const char* name = functionName().utf8().data();
+ double sampleCount = m_actualTotalTime * 1000;
+ if (indentLevel) {
+ for (int i = 0; i < indentLevel; ++i)
+ printf(" ");
+
+ countedFunctions.add(functionName().impl());
+
+ printf("%.0f %s\n", sampleCount ? sampleCount : 1, name);
+ } else
+ printf("%s\n", name);
+
+ ++indentLevel;
+
+ // Print children's names and information
+ double sumOfChildrensCount = 0.0;
+ for (StackIterator currentChild = m_children.begin(); currentChild != m_children.end(); ++currentChild)
+ sumOfChildrensCount += (*currentChild)->debugPrintDataSampleStyle(indentLevel, countedFunctions);
+
+ sumOfChildrensCount *= 1000; //
+ // Print remainder of samples to match sample's output
+ if (sumOfChildrensCount < sampleCount) {
+ printf(" ");
+ while (indentLevel--)
+ printf(" ");
+
+ printf("%.0f %s\n", sampleCount - sumOfChildrensCount, functionName().utf8().data());
+ }
+
+ return m_actualTotalTime;
+}
+#endif
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/profiler/ProfileNode.h b/Source/JavaScriptCore/profiler/ProfileNode.h
new file mode 100644
index 0000000..ffe7b6f
--- /dev/null
+++ b/Source/JavaScriptCore/profiler/ProfileNode.h
@@ -0,0 +1,172 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ProfileNode_h
+#define ProfileNode_h
+
+#include "CallIdentifier.h"
+#include <wtf/HashCountedSet.h>
+#include <wtf/RefCounted.h>
+#include <wtf/RefPtr.h>
+#include <wtf/Vector.h>
+
+namespace JSC {
+
+ class ExecState;
+ class ProfileNode;
+
+ typedef Vector<RefPtr<ProfileNode> >::const_iterator StackIterator;
+ typedef HashCountedSet<StringImpl*> FunctionCallHashCount;
+
+ class ProfileNode : public RefCounted<ProfileNode> {
+ public:
+ static PassRefPtr<ProfileNode> create(ExecState* callerCallFrame, const CallIdentifier& callIdentifier, ProfileNode* headNode, ProfileNode* parentNode)
+ {
+ return adoptRef(new ProfileNode(callerCallFrame, callIdentifier, headNode, parentNode));
+ }
+ static PassRefPtr<ProfileNode> create(ExecState* callerCallFrame, ProfileNode* headNode, ProfileNode* node)
+ {
+ return adoptRef(new ProfileNode(callerCallFrame, headNode, node));
+ }
+
+ bool operator==(ProfileNode* node) { return m_callIdentifier == node->callIdentifier(); }
+
+ ProfileNode* willExecute(ExecState* callerCallFrame, const CallIdentifier&);
+ ProfileNode* didExecute();
+
+ void stopProfiling();
+
+ // CallIdentifier members
+ ExecState* callerCallFrame() const { return m_callerCallFrame; }
+ const CallIdentifier& callIdentifier() const { return m_callIdentifier; }
+ const UString& functionName() const { return m_callIdentifier.m_name; }
+ const UString& url() const { return m_callIdentifier.m_url; }
+ unsigned lineNumber() const { return m_callIdentifier.m_lineNumber; }
+
+ // Relationships
+ ProfileNode* head() const { return m_head; }
+ void setHead(ProfileNode* head) { m_head = head; }
+ ProfileNode* parent() const { return m_parent; }
+ void setParent(ProfileNode* parent) { m_parent = parent; }
+ ProfileNode* nextSibling() const { return m_nextSibling; }
+ void setNextSibling(ProfileNode* nextSibling) { m_nextSibling = nextSibling; }
+
+ // Time members
+ double startTime() const { return m_startTime; }
+ void setStartTime(double startTime) { m_startTime = startTime; }
+ double totalTime() const { return m_visibleTotalTime; }
+ double actualTotalTime() const { return m_actualTotalTime; }
+ void setTotalTime(double time) { m_actualTotalTime = time; m_visibleTotalTime = time; }
+ void setActualTotalTime(double time) { m_actualTotalTime = time; }
+ void setVisibleTotalTime(double time) { m_visibleTotalTime = time; }
+ double selfTime() const { return m_visibleSelfTime; }
+ double actualSelfTime() const { return m_actualSelfTime; }
+ void setSelfTime(double time) {m_actualSelfTime = time; m_visibleSelfTime = time; }
+ void setActualSelfTime(double time) { m_actualSelfTime = time; }
+ void setVisibleSelfTime(double time) { m_visibleSelfTime = time; }
+
+ double totalPercent() const { return (m_visibleTotalTime / (m_head ? m_head->totalTime() : totalTime())) * 100.0; }
+ double selfPercent() const { return (m_visibleSelfTime / (m_head ? m_head->totalTime() : totalTime())) * 100.0; }
+
+ unsigned numberOfCalls() const { return m_numberOfCalls; }
+ void setNumberOfCalls(unsigned number) { m_numberOfCalls = number; }
+
+ // Children members
+ const Vector<RefPtr<ProfileNode> >& children() const { return m_children; }
+ ProfileNode* firstChild() const { return m_children.size() ? m_children.first().get() : 0; }
+ ProfileNode* lastChild() const { return m_children.size() ? m_children.last().get() : 0; }
+ ProfileNode* findChild(ProfileNode*) const;
+ void removeChild(ProfileNode*);
+ void addChild(PassRefPtr<ProfileNode> prpChild);
+ void insertNode(PassRefPtr<ProfileNode> prpNode);
+
+ // Visiblity
+ bool visible() const { return m_visible; }
+ void setVisible(bool visible) { m_visible = visible; }
+
+ static void setTreeVisible(ProfileNode*, bool visible);
+
+ // Sorting
+ ProfileNode* traverseNextNodePostOrder() const;
+ ProfileNode* traverseNextNodePreOrder(bool processChildren = true) const;
+
+ // Views
+ void calculateVisibleTotalTime();
+ bool focus(const CallIdentifier&);
+ void exclude(const CallIdentifier&);
+ void restore();
+
+ void endAndRecordCall();
+
+#ifndef NDEBUG
+ const char* c_str() const { return m_callIdentifier; }
+ void debugPrintData(int indentLevel) const;
+ double debugPrintDataSampleStyle(int indentLevel, FunctionCallHashCount&) const;
+#endif
+
+ private:
+ ProfileNode(ExecState* callerCallFrame, const CallIdentifier&, ProfileNode* headNode, ProfileNode* parentNode);
+ ProfileNode(ExecState* callerCallFrame, ProfileNode* headNode, ProfileNode* nodeToCopy);
+
+ void startTimer();
+ void resetChildrensSiblings();
+
+ RefPtr<ProfileNode>* childrenBegin() { return m_children.begin(); }
+ RefPtr<ProfileNode>* childrenEnd() { return m_children.end(); }
+
+ // Sorting comparators
+ static inline bool totalTimeDescendingComparator(const RefPtr<ProfileNode>& a, const RefPtr<ProfileNode>& b) { return a->totalTime() > b->totalTime(); }
+ static inline bool totalTimeAscendingComparator(const RefPtr<ProfileNode>& a, const RefPtr<ProfileNode>& b) { return a->totalTime() < b->totalTime(); }
+ static inline bool selfTimeDescendingComparator(const RefPtr<ProfileNode>& a, const RefPtr<ProfileNode>& b) { return a->selfTime() > b->selfTime(); }
+ static inline bool selfTimeAscendingComparator(const RefPtr<ProfileNode>& a, const RefPtr<ProfileNode>& b) { return a->selfTime() < b->selfTime(); }
+ static inline bool callsDescendingComparator(const RefPtr<ProfileNode>& a, const RefPtr<ProfileNode>& b) { return a->numberOfCalls() > b->numberOfCalls(); }
+ static inline bool callsAscendingComparator(const RefPtr<ProfileNode>& a, const RefPtr<ProfileNode>& b) { return a->numberOfCalls() < b->numberOfCalls(); }
+ static inline bool functionNameDescendingComparator(const RefPtr<ProfileNode>& a, const RefPtr<ProfileNode>& b) { return a->functionName() > b->functionName(); }
+ static inline bool functionNameAscendingComparator(const RefPtr<ProfileNode>& a, const RefPtr<ProfileNode>& b) { return a->functionName() < b->functionName(); }
+
+ ExecState* m_callerCallFrame;
+ CallIdentifier m_callIdentifier;
+ ProfileNode* m_head;
+ ProfileNode* m_parent;
+ ProfileNode* m_nextSibling;
+
+ double m_startTime;
+ double m_actualTotalTime;
+ double m_visibleTotalTime;
+ double m_actualSelfTime;
+ double m_visibleSelfTime;
+ unsigned m_numberOfCalls;
+
+ bool m_visible;
+
+ Vector<RefPtr<ProfileNode> > m_children;
+ };
+
+} // namespace JSC
+
+#endif // ProfileNode_h
diff --git a/Source/JavaScriptCore/profiler/Profiler.cpp b/Source/JavaScriptCore/profiler/Profiler.cpp
new file mode 100644
index 0000000..9ac73fd
--- /dev/null
+++ b/Source/JavaScriptCore/profiler/Profiler.cpp
@@ -0,0 +1,172 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "Profiler.h"
+
+#include "CommonIdentifiers.h"
+#include "CallFrame.h"
+#include "CodeBlock.h"
+#include "InternalFunction.h"
+#include "JSFunction.h"
+#include "JSGlobalObject.h"
+#include "Nodes.h"
+#include "Profile.h"
+#include "ProfileGenerator.h"
+#include "ProfileNode.h"
+#include "UStringConcatenate.h"
+#include <stdio.h>
+
+namespace JSC {
+
+static const char* GlobalCodeExecution = "(program)";
+static const char* AnonymousFunction = "(anonymous function)";
+static unsigned ProfilesUID = 0;
+
+static CallIdentifier createCallIdentifierFromFunctionImp(ExecState*, JSFunction*);
+
+Profiler* Profiler::s_sharedProfiler = 0;
+Profiler* Profiler::s_sharedEnabledProfilerReference = 0;
+
+Profiler* Profiler::profiler()
+{
+ if (!s_sharedProfiler)
+ s_sharedProfiler = new Profiler();
+ return s_sharedProfiler;
+}
+
+void Profiler::startProfiling(ExecState* exec, const UString& title)
+{
+ ASSERT_ARG(title, !title.isNull());
+
+ // Check if we currently have a Profile for this global ExecState and title.
+ // If so return early and don't create a new Profile.
+ ExecState* globalExec = exec ? exec->lexicalGlobalObject()->globalExec() : 0;
+
+ for (size_t i = 0; i < m_currentProfiles.size(); ++i) {
+ ProfileGenerator* profileGenerator = m_currentProfiles[i].get();
+ if (profileGenerator->originatingGlobalExec() == globalExec && profileGenerator->title() == title)
+ return;
+ }
+
+ s_sharedEnabledProfilerReference = this;
+ RefPtr<ProfileGenerator> profileGenerator = ProfileGenerator::create(title, exec, ++ProfilesUID);
+ m_currentProfiles.append(profileGenerator);
+}
+
+PassRefPtr<Profile> Profiler::stopProfiling(ExecState* exec, const UString& title)
+{
+ ExecState* globalExec = exec ? exec->lexicalGlobalObject()->globalExec() : 0;
+ for (ptrdiff_t i = m_currentProfiles.size() - 1; i >= 0; --i) {
+ ProfileGenerator* profileGenerator = m_currentProfiles[i].get();
+ if (profileGenerator->originatingGlobalExec() == globalExec && (title.isNull() || profileGenerator->title() == title)) {
+ profileGenerator->stopProfiling();
+ RefPtr<Profile> returnProfile = profileGenerator->profile();
+
+ m_currentProfiles.remove(i);
+ if (!m_currentProfiles.size())
+ s_sharedEnabledProfilerReference = 0;
+
+ return returnProfile;
+ }
+ }
+
+ return 0;
+}
+
+static inline void dispatchFunctionToProfiles(ExecState* callerOrHandlerCallFrame, const Vector<RefPtr<ProfileGenerator> >& profiles, ProfileGenerator::ProfileFunction function, const CallIdentifier& callIdentifier, unsigned currentProfileTargetGroup)
+{
+ for (size_t i = 0; i < profiles.size(); ++i) {
+ if (profiles[i]->profileGroup() == currentProfileTargetGroup || !profiles[i]->originatingGlobalExec())
+ (profiles[i].get()->*function)(callerOrHandlerCallFrame, callIdentifier);
+ }
+}
+
+void Profiler::willExecute(ExecState* callerCallFrame, JSValue function)
+{
+ ASSERT(!m_currentProfiles.isEmpty());
+
+ dispatchFunctionToProfiles(callerCallFrame, m_currentProfiles, &ProfileGenerator::willExecute, createCallIdentifier(callerCallFrame, function, "", 0), callerCallFrame->lexicalGlobalObject()->profileGroup());
+}
+
+void Profiler::willExecute(ExecState* callerCallFrame, const UString& sourceURL, int startingLineNumber)
+{
+ ASSERT(!m_currentProfiles.isEmpty());
+
+ CallIdentifier callIdentifier = createCallIdentifier(callerCallFrame, JSValue(), sourceURL, startingLineNumber);
+
+ dispatchFunctionToProfiles(callerCallFrame, m_currentProfiles, &ProfileGenerator::willExecute, callIdentifier, callerCallFrame->lexicalGlobalObject()->profileGroup());
+}
+
+void Profiler::didExecute(ExecState* callerCallFrame, JSValue function)
+{
+ ASSERT(!m_currentProfiles.isEmpty());
+
+ dispatchFunctionToProfiles(callerCallFrame, m_currentProfiles, &ProfileGenerator::didExecute, createCallIdentifier(callerCallFrame, function, "", 0), callerCallFrame->lexicalGlobalObject()->profileGroup());
+}
+
+void Profiler::didExecute(ExecState* callerCallFrame, const UString& sourceURL, int startingLineNumber)
+{
+ ASSERT(!m_currentProfiles.isEmpty());
+
+ dispatchFunctionToProfiles(callerCallFrame, m_currentProfiles, &ProfileGenerator::didExecute, createCallIdentifier(callerCallFrame, JSValue(), sourceURL, startingLineNumber), callerCallFrame->lexicalGlobalObject()->profileGroup());
+}
+
+void Profiler::exceptionUnwind(ExecState* handlerCallFrame)
+{
+ ASSERT(!m_currentProfiles.isEmpty());
+
+ dispatchFunctionToProfiles(handlerCallFrame, m_currentProfiles, &ProfileGenerator::exceptionUnwind, createCallIdentifier(handlerCallFrame, JSValue(), "", 0), handlerCallFrame->lexicalGlobalObject()->profileGroup());
+}
+
+CallIdentifier Profiler::createCallIdentifier(ExecState* exec, JSValue functionValue, const UString& defaultSourceURL, int defaultLineNumber)
+{
+ if (!functionValue)
+ return CallIdentifier(GlobalCodeExecution, defaultSourceURL, defaultLineNumber);
+ if (!functionValue.isObject())
+ return CallIdentifier("(unknown)", defaultSourceURL, defaultLineNumber);
+ if (asObject(functionValue)->inherits(&JSFunction::info)) {
+ JSFunction* function = asFunction(functionValue);
+ if (!function->executable()->isHostFunction())
+ return createCallIdentifierFromFunctionImp(exec, function);
+ }
+ if (asObject(functionValue)->inherits(&JSFunction::info))
+ return CallIdentifier(static_cast<JSFunction*>(asObject(functionValue))->name(exec), defaultSourceURL, defaultLineNumber);
+ if (asObject(functionValue)->inherits(&InternalFunction::info))
+ return CallIdentifier(static_cast<InternalFunction*>(asObject(functionValue))->name(exec), defaultSourceURL, defaultLineNumber);
+ return CallIdentifier(makeUString("(", asObject(functionValue)->className(), " object)"), defaultSourceURL, defaultLineNumber);
+}
+
+CallIdentifier createCallIdentifierFromFunctionImp(ExecState* exec, JSFunction* function)
+{
+ ASSERT(!function->isHostFunction());
+ const UString& name = function->calculatedDisplayName(exec);
+ return CallIdentifier(name.isEmpty() ? AnonymousFunction : name, function->jsExecutable()->sourceURL(), function->jsExecutable()->lineNo());
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/profiler/Profiler.h b/Source/JavaScriptCore/profiler/Profiler.h
new file mode 100644
index 0000000..f9c2ccb
--- /dev/null
+++ b/Source/JavaScriptCore/profiler/Profiler.h
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef Profiler_h
+#define Profiler_h
+
+#include "Profile.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
+#include <wtf/Vector.h>
+
+namespace JSC {
+
+ class ExecState;
+ class JSGlobalData;
+ class JSObject;
+ class JSValue;
+ class ProfileGenerator;
+ class UString;
+ struct CallIdentifier;
+
+ class Profiler : public FastAllocBase {
+ public:
+ static Profiler** enabledProfilerReference()
+ {
+ return &s_sharedEnabledProfilerReference;
+ }
+
+ static Profiler* profiler();
+ static CallIdentifier createCallIdentifier(ExecState* exec, JSValue, const UString& sourceURL, int lineNumber);
+
+ void startProfiling(ExecState*, const UString& title);
+ PassRefPtr<Profile> stopProfiling(ExecState*, const UString& title);
+
+ void willExecute(ExecState* callerCallFrame, JSValue function);
+ void willExecute(ExecState* callerCallFrame, const UString& sourceURL, int startingLineNumber);
+ void didExecute(ExecState* callerCallFrame, JSValue function);
+ void didExecute(ExecState* callerCallFrame, const UString& sourceURL, int startingLineNumber);
+
+ void exceptionUnwind(ExecState* handlerCallFrame);
+
+ const Vector<RefPtr<ProfileGenerator> >& currentProfiles() { return m_currentProfiles; };
+
+ private:
+ Vector<RefPtr<ProfileGenerator> > m_currentProfiles;
+ static Profiler* s_sharedProfiler;
+ static Profiler* s_sharedEnabledProfilerReference;
+ };
+
+} // namespace JSC
+
+#endif // Profiler_h
diff --git a/Source/JavaScriptCore/profiler/ProfilerServer.h b/Source/JavaScriptCore/profiler/ProfilerServer.h
new file mode 100644
index 0000000..5b7cc46
--- /dev/null
+++ b/Source/JavaScriptCore/profiler/ProfilerServer.h
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ProfileServer_h
+#define ProfileServer_h
+
+namespace JSC {
+
+void startProfilerServerIfNeeded();
+
+} // namespace JSC
+
+#endif // ProfileServer_h
diff --git a/Source/JavaScriptCore/profiler/ProfilerServer.mm b/Source/JavaScriptCore/profiler/ProfilerServer.mm
new file mode 100644
index 0000000..7d87f96
--- /dev/null
+++ b/Source/JavaScriptCore/profiler/ProfilerServer.mm
@@ -0,0 +1,115 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+#import "ProfilerServer.h"
+
+#import "JSProfilerPrivate.h"
+#import "JSRetainPtr.h"
+#import <Foundation/Foundation.h>
+
+#if PLATFORM(IOS_SIMULATOR)
+#import <Foundation/NSDistributedNotificationCenter.h>
+#endif
+
+@interface ProfilerServer : NSObject {
+@private
+ NSString *_serverName;
+ unsigned _listenerCount;
+}
++ (ProfilerServer *)sharedProfileServer;
+- (void)startProfiling;
+- (void)stopProfiling;
+@end
+
+@implementation ProfilerServer
+
++ (ProfilerServer *)sharedProfileServer
+{
+ static ProfilerServer *sharedServer;
+ if (!sharedServer)
+ sharedServer = [[ProfilerServer alloc] init];
+ return sharedServer;
+}
+
+- (id)init
+{
+ if (!(self = [super init]))
+ return nil;
+
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+
+ NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
+ if ([defaults boolForKey:@"EnableJSProfiling"])
+ [self startProfiling];
+
+#if !PLATFORM(IOS) || PLATFORM(IOS_SIMULATOR)
+ // FIXME: <rdar://problem/6546135>
+ // The catch-all notifications
+ [[NSDistributedNotificationCenter defaultCenter] addObserver:self selector:@selector(startProfiling) name:@"ProfilerServerStartNotification" object:nil];
+ [[NSDistributedNotificationCenter defaultCenter] addObserver:self selector:@selector(stopProfiling) name:@"ProfilerServerStopNotification" object:nil];
+#endif
+
+ // The specific notifications
+ NSProcessInfo *processInfo = [NSProcessInfo processInfo];
+ _serverName = [[NSString alloc] initWithFormat:@"ProfilerServer-%d", [processInfo processIdentifier]];
+
+#if !PLATFORM(IOS) || PLATFORM(IOS_SIMULATOR)
+ // FIXME: <rdar://problem/6546135>
+ [[NSDistributedNotificationCenter defaultCenter] addObserver:self selector:@selector(startProfiling) name:[_serverName stringByAppendingString:@"-Start"] object:nil];
+ [[NSDistributedNotificationCenter defaultCenter] addObserver:self selector:@selector(stopProfiling) name:[_serverName stringByAppendingString:@"-Stop"] object:nil];
+#endif
+
+ [pool drain];
+
+ return self;
+}
+
+- (void)startProfiling
+{
+ if (++_listenerCount > 1)
+ return;
+ JSRetainPtr<JSStringRef> profileName(Adopt, JSStringCreateWithUTF8CString([_serverName UTF8String]));
+ JSStartProfiling(0, profileName.get());
+}
+
+- (void)stopProfiling
+{
+ if (!_listenerCount || --_listenerCount > 0)
+ return;
+ JSRetainPtr<JSStringRef> profileName(Adopt, JSStringCreateWithUTF8CString([_serverName UTF8String]));
+ JSEndProfiling(0, profileName.get());
+}
+
+@end
+
+namespace JSC {
+
+void startProfilerServerIfNeeded()
+{
+ [ProfilerServer sharedProfileServer];
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/qt/ChangeLog b/Source/JavaScriptCore/qt/ChangeLog
new file mode 100644
index 0000000..11018b4
--- /dev/null
+++ b/Source/JavaScriptCore/qt/ChangeLog
@@ -0,0 +1,447 @@
+2010-09-29 Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
+
+ Reviewed by Andreas Kling.
+
+ [Qt] QScriptEngine should have an API for creating Date objects
+ https://bugs.webkit.org/show_bug.cgi?id=41667
+
+ Implement newDate(), isDate() and toDateTime() functions. Use the
+ QDateTime::{to,set}MSecsSinceEpoch() functions to do the
+ calculations.
+
+ * api/qscriptengine.cpp:
+ (QScriptEngine::newDate):
+ * api/qscriptengine.h:
+ * api/qscriptengine_p.cpp:
+ (QScriptEnginePrivate::newDate):
+ * api/qscriptengine_p.h:
+ (QScriptEnginePrivate::isDate):
+
+ * api/qscriptoriginalglobalobject_p.h:
+ (QScriptOriginalGlobalObject::QScriptOriginalGlobalObject): need
+ to keep track of Date Constructor and Prototype.
+ (QScriptOriginalGlobalObject::~QScriptOriginalGlobalObject): ditto.
+ (QScriptOriginalGlobalObject::isDate): use the Date Constructor
+ and Prototype to identify Date values.
+
+ * api/qscriptvalue.cpp:
+ (QScriptValue::isDate):
+ (QScriptValue::toDateTime):
+ * api/qscriptvalue.h:
+ * api/qscriptvalue_p.h:
+ (QScriptValuePrivate::isDate):
+ (QScriptValuePrivate::toDateTime):
+ * tests/qscriptengine/tst_qscriptengine.cpp:
+ (tst_QScriptEngine::newDate):
+
+2010-07-27 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Update the QScriptValue autotests suite.
+
+ QScriptValue generated files were updated, changes are:
+ - More tested values (for example QSE::newObject() and QSE::newArray())
+ - Tested values are recreated before each test and are not reused.
+ The change implies better code coverage and some expected result changes.
+ - A new test to check copy and assign functions.
+ - Tests are using standard QTestLib interface, without any custom macros.
+
+ [Qt] Improve test coverage for the QScriptValue
+ https://bugs.webkit.org/show_bug.cgi?id=42366
+
+ * tests/qscriptvalue/tst_qscriptvalue.cpp:
+ (tst_QScriptValue::tst_QScriptValue):
+ (tst_QScriptValue::~tst_QScriptValue):
+ (tst_QScriptValue::assignAndCopyConstruct_data):
+ (tst_QScriptValue::assignAndCopyConstruct):
+ * tests/qscriptvalue/tst_qscriptvalue.h:
+ * tests/qscriptvalue/tst_qscriptvalue_generated_comparison.cpp:
+ (tst_QScriptValue::equals_data):
+ (tst_QScriptValue::equals):
+ (tst_QScriptValue::strictlyEquals_data):
+ (tst_QScriptValue::strictlyEquals):
+ (tst_QScriptValue::instanceOf_data):
+ (tst_QScriptValue::instanceOf):
+ * tests/qscriptvalue/tst_qscriptvalue_generated_init.cpp:
+ (tst_QScriptValue::initScriptValues):
+ * tests/qscriptvalue/tst_qscriptvalue_generated_istype.cpp:
+ (tst_QScriptValue::isValid_data):
+ (tst_QScriptValue::isValid):
+ (tst_QScriptValue::isBool_data):
+ (tst_QScriptValue::isBool):
+ (tst_QScriptValue::isBoolean_data):
+ (tst_QScriptValue::isBoolean):
+ (tst_QScriptValue::isNumber_data):
+ (tst_QScriptValue::isNumber):
+ (tst_QScriptValue::isFunction_data):
+ (tst_QScriptValue::isFunction):
+ (tst_QScriptValue::isNull_data):
+ (tst_QScriptValue::isNull):
+ (tst_QScriptValue::isString_data):
+ (tst_QScriptValue::isString):
+ (tst_QScriptValue::isUndefined_data):
+ (tst_QScriptValue::isUndefined):
+ (tst_QScriptValue::isObject_data):
+ (tst_QScriptValue::isObject):
+ (tst_QScriptValue::isArray_data):
+ (tst_QScriptValue::isArray):
+ (tst_QScriptValue::isError_data):
+ (tst_QScriptValue::isError):
+ * tests/qscriptvalue/tst_qscriptvalue_generated_totype.cpp:
+ (tst_QScriptValue::toString_data):
+ (tst_QScriptValue::toString):
+ (tst_QScriptValue::toNumber_data):
+ (tst_QScriptValue::toNumber):
+ (tst_QScriptValue::toBool_data):
+ (tst_QScriptValue::toBool):
+ (tst_QScriptValue::toBoolean_data):
+ (tst_QScriptValue::toBoolean):
+ (tst_QScriptValue::toInteger_data):
+ (tst_QScriptValue::toInteger):
+ (tst_QScriptValue::toInt32_data):
+ (tst_QScriptValue::toInt32):
+ (tst_QScriptValue::toUInt32_data):
+ (tst_QScriptValue::toUInt32):
+ (tst_QScriptValue::toUInt16_data):
+ (tst_QScriptValue::toUInt16):
+
+2010-07-27 Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] Implement QScriptEngine::newFunction() parts that doesn't depend on QScriptContext
+ https://bugs.webkit.org/show_bug.cgi?id=42174
+
+ Since our function can be called in Javascript both as a function
+ and as a constructor, we couldn't use the existing
+ JSObjectMakeFunctionWithCallback() and JSObjectMakeConstructor().
+
+ Instead, a JSClassRef was created, implementing the needed
+ callbacks (the callAsConstructor is not there yet because its
+ behaviour depends on QScriptContext).
+
+ For the moment, QScriptContext is defined as a void type, since we
+ still don't use it.
+
+ The variant of newFunction() that also takes an external argument
+ was also implemented. The details of implementation were added to
+ the qscriptfunction{.c,_p.h} files.
+
+ This commit also adds tests, some of them from Qt's upstream.
+
+ * api/QtScript.pro:
+ * api/qscriptengine.cpp:
+ (QScriptEngine::newFunction):
+ * api/qscriptengine.h:
+ * api/qscriptengine_p.cpp:
+ (QScriptEnginePrivate::QScriptEnginePrivate):
+ (QScriptEnginePrivate::~QScriptEnginePrivate):
+ (QScriptEnginePrivate::newFunction):
+ * api/qscriptengine_p.h:
+ * api/qscriptfunction.cpp: Added.
+ (qt_NativeFunction_finalize):
+ (qt_NativeFunction_callAsFunction):
+ (qt_NativeFunctionWithArg_finalize):
+ (qt_NativeFunctionWithArg_callAsFunction):
+ * api/qscriptfunction_p.h: Added.
+ (QNativeFunctionData::QNativeFunctionData):
+ (QNativeFunctionWithArgData::QNativeFunctionWithArgData):
+ * api/qscriptoriginalglobalobject_p.h:
+ (QScriptOriginalGlobalObject::QScriptOriginalGlobalObject):
+ (QScriptOriginalGlobalObject::~QScriptOriginalGlobalObject):
+ (QScriptOriginalGlobalObject::functionPrototype):
+ * tests/qscriptengine/tst_qscriptengine.cpp:
+ (myFunction):
+ (myFunctionWithArg):
+ (myFunctionThatReturns):
+ (myFunctionThatReturnsWithoutEngine):
+ (myFunctionThatReturnsWrongEngine):
+ (tst_QScriptEngine::newFunction):
+
+2010-07-23 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ QScriptValue::equals benchmark crash fix.
+
+ Patch changes QScriptValue::equals implementation to cover
+ more edge cases.
+
+ Problem exposes an issue in our autotests (all values got
+ bound to an engine too fast - bug 42366).
+
+ [Qt] QScriptValue::equals asserts
+ https://bugs.webkit.org/show_bug.cgi?id=42363
+
+ * api/qscriptvalue_p.h:
+ (QScriptValuePrivate::equals):
+
+2010-07-14 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Introduce QScriptOriginalGlobalObject.
+
+ QtScript exposes more functionality than JSC C API. Sometimes it is
+ necessary to take a shortcut in implementation. Really often we have
+ to use a standard JS function. These function could be changed or
+ even deleted by a script, so a backup of a reference to an object is needed.
+
+ In them same time this is rather a workaround then real fix, so the code
+ should be separated and changed easily in future. It is why we need
+ the new internal class.
+
+ The patch fixes a few crashes.
+
+ [Qt] QScriptEngine should work correctly even after global object changes
+ https://bugs.webkit.org/show_bug.cgi?id=41839
+
+ * api/QtScript.pro:
+ * api/qscriptengine_p.cpp:
+ (QScriptEnginePrivate::QScriptEnginePrivate):
+ (QScriptEnginePrivate::~QScriptEnginePrivate):
+ * api/qscriptengine_p.h:
+ (QScriptEnginePrivate::isArray):
+ (QScriptEnginePrivate::isError):
+ (QScriptEnginePrivate::objectHasOwnProperty):
+ (QScriptEnginePrivate::objectGetOwnPropertyNames):
+ * api/qscriptoriginalglobalobject_p.h: Added.
+ (QScriptOriginalGlobalObject::QScriptOriginalGlobalObject):
+ (QScriptOriginalGlobalObject::initializeMember):
+ (QScriptOriginalGlobalObject::~QScriptOriginalGlobalObject):
+ (QScriptOriginalGlobalObject::objectHasOwnProperty):
+ (QScriptOriginalGlobalObject::objectGetOwnPropertyNames):
+ (QScriptOriginalGlobalObject::isArray):
+ (QScriptOriginalGlobalObject::isError):
+ (QScriptOriginalGlobalObject::isType):
+ * api/qscriptvalue_p.h:
+ (QScriptValuePrivate::isError):
+ (QScriptValuePrivate::hasOwnProperty):
+ * api/qscriptvalueiterator_p.h:
+ (QScriptValueIteratorPrivate::QScriptValueIteratorPrivate):
+ * tests/qscriptvalue/tst_qscriptvalue.cpp:
+ (tst_QScriptValue::globalObjectChanges):
+ * tests/qscriptvalue/tst_qscriptvalue.h:
+
+2010-07-13 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Introduce QScriptValueIterator.
+
+ The QScriptValueIterator class permits to iterate over a QScriptValue's properties.
+
+ [Qt] QtScript should provide an API for enumerating a JS object's properties
+ https://bugs.webkit.org/show_bug.cgi?id=41680
+
+ * api/QtScript.pro:
+ * api/qscriptvalueiterator.cpp: Added.
+ (QScriptValueIterator::QScriptValueIterator):
+ (QScriptValueIterator::~QScriptValueIterator):
+ (QScriptValueIterator::hasNext):
+ (QScriptValueIterator::next):
+ (QScriptValueIterator::hasPrevious):
+ (QScriptValueIterator::previous):
+ (QScriptValueIterator::toFront):
+ (QScriptValueIterator::toBack):
+ (QScriptValueIterator::name):
+ (QScriptValueIterator::scriptName):
+ (QScriptValueIterator::value):
+ (QScriptValueIterator::setValue):
+ (QScriptValueIterator::remove):
+ (QScriptValueIterator::flags):
+ (QScriptValueIterator::operator=):
+ * api/qscriptvalueiterator.h: Added.
+ * api/qscriptvalueiterator_p.h: Added.
+ (QScriptValueIteratorPrivate::QScriptValueIteratorPrivate):
+ (QScriptValueIteratorPrivate::~QScriptValueIteratorPrivate):
+ (QScriptValueIteratorPrivate::hasNext):
+ (QScriptValueIteratorPrivate::next):
+ (QScriptValueIteratorPrivate::hasPrevious):
+ (QScriptValueIteratorPrivate::previous):
+ (QScriptValueIteratorPrivate::name):
+ (QScriptValueIteratorPrivate::scriptName):
+ (QScriptValueIteratorPrivate::value):
+ (QScriptValueIteratorPrivate::setValue):
+ (QScriptValueIteratorPrivate::remove):
+ (QScriptValueIteratorPrivate::toFront):
+ (QScriptValueIteratorPrivate::toBack):
+ (QScriptValueIteratorPrivate::flags):
+ (QScriptValueIteratorPrivate::isValid):
+ (QScriptValueIteratorPrivate::engine):
+ * tests/qscriptvalueiterator/qscriptvalueiterator.pro: Added.
+ * tests/qscriptvalueiterator/tst_qscriptvalueiterator.cpp: Added.
+ (tst_QScriptValueIterator::tst_QScriptValueIterator):
+ (tst_QScriptValueIterator::~tst_QScriptValueIterator):
+ (tst_QScriptValueIterator::iterateForward_data):
+ (tst_QScriptValueIterator::iterateForward):
+ (tst_QScriptValueIterator::iterateBackward_data):
+ (tst_QScriptValueIterator::iterateBackward):
+ (tst_QScriptValueIterator::iterateArray_data):
+ (tst_QScriptValueIterator::iterateArray):
+ (tst_QScriptValueIterator::iterateBackAndForth):
+ (tst_QScriptValueIterator::setValue):
+ (tst_QScriptValueIterator::remove):
+ (tst_QScriptValueIterator::removeMixed):
+ (tst_QScriptValueIterator::removeUndeletable):
+ (tst_QScriptValueIterator::iterateString):
+ (tst_QScriptValueIterator::assignObjectToIterator):
+ * tests/tests.pro:
+
+2010-07-09 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Implementation of the QScriptValue::propertyFlags function.
+
+ The function returns the flags of a property with the given name,
+ using a given mode to resolve the property. This is a simple
+ implementation that is sufficient to test the QScriptValueIterator.
+
+ [Qt] QScriptValue API should have a property flag accessor.
+ https://bugs.webkit.org/show_bug.cgi?id=41769
+
+ * api/qscriptvalue.cpp:
+ (QScriptValue::propertyFlags):
+ * api/qscriptvalue.h:
+ * api/qscriptvalue_p.h:
+ (QScriptValuePrivate::propertyFlags):
+ * tests/qscriptvalue/tst_qscriptvalue.cpp:
+ (tst_QScriptValue::propertyFlag_data):
+ (tst_QScriptValue::propertyFlag):
+ * tests/qscriptvalue/tst_qscriptvalue.h:
+
+2010-07-07 Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Implementation of QScriptValue::isArray()
+ https://bugs.webkit.org/show_bug.cgi?id=41713
+
+ Since we don't have access to the [[Class]] internal property of
+ builtins (including Array), the solution was to keep the original 'Array'
+ (constructor) and 'Array.prototype' objects and use them to identify
+ if a given object is an Array.
+
+ Also uncomment some tests and add some tests of newArray() that
+ depended on isArray().
+
+ * api/qscriptengine_p.cpp:
+ (QScriptEnginePrivate::QScriptEnginePrivate):
+ (QScriptEnginePrivate::~QScriptEnginePrivate):
+ * api/qscriptengine_p.h:
+ (QScriptEnginePrivate::isArray):
+ * api/qscriptvalue.cpp:
+ (QScriptValue::isArray):
+ * api/qscriptvalue.h:
+ * api/qscriptvalue_p.h:
+ (QScriptValuePrivate::isArray):
+ * tests/qscriptengine/tst_qscriptengine.cpp:
+ (tst_QScriptEngine::newArray):
+
+2010-07-06 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Implementation of QScriptValue properties accessors.
+
+ The patch contains implementation of the QScriptValue::property() and
+ the QScriptValue::setProperty(). It is not full functionality, as these
+ method are too complex for one patch, but it is enough to cover about
+ 95% of use cases.
+
+ Missing functionality:
+ - Few of the PropertyFlags are ignored.
+ - Only a public part of the ResolveFlags can be used (ResolveLocal,
+ ResolvePrototype).
+
+ A lot of new test cases were added.
+
+ [Qt] QScriptValue should have API for accessing object properties
+ https://bugs.webkit.org/show_bug.cgi?id=40903
+
+ * api/qscriptconverter_p.h:
+ (QScriptConverter::toPropertyFlags):
+ * api/qscriptstring_p.h:
+ (QScriptStringPrivate::operator JSStringRef):
+ * api/qscriptvalue.cpp:
+ (QScriptValue::property):
+ (QScriptValue::setProperty):
+ * api/qscriptvalue.h:
+ (QScriptValue::):
+ * api/qscriptvalue_p.h:
+ (QScriptValuePrivate::assignEngine):
+ (QScriptValuePrivate::property):
+ (QScriptValuePrivate::hasOwnProperty):
+ (QScriptValuePrivate::setProperty):
+ (QScriptValuePrivate::deleteProperty):
+ * tests/qscriptvalue/tst_qscriptvalue.cpp:
+ (tst_QScriptValue::getPropertySimple_data):
+ (tst_QScriptValue::getPropertySimple):
+ (tst_QScriptValue::setPropertySimple):
+ (tst_QScriptValue::getPropertyResolveFlag):
+ (tst_QScriptValue::getSetProperty):
+ (tst_QScriptValue::setProperty_data):
+ (tst_QScriptValue::setProperty):
+ * tests/qscriptvalue/tst_qscriptvalue.h:
+
+2010-07-02 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Compilation fix.
+
+ QScriptEnginePrivate::newArray can't be const because it can
+ throw an exception.
+
+ [Qt] QScriptEnginePrivate compilation fix
+ https://bugs.webkit.org/show_bug.cgi?id=41520
+
+ * api/qscriptengine_p.cpp:
+ (QScriptEnginePrivate::newArray):
+ * api/qscriptengine_p.h:
+
+2010-06-28 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Implement exception reporting in the QtScript API.
+
+ The exception should be accessible through the API by the uncaughtException
+ function. Functions; hasUncaughtException, clearExceptions, uncaughtExceptionLineNumber,
+ uncaughtExceptionBacktrace were added to facilitate error checking and debugging.
+
+ [Qt] QtScript API should be exceptions aware.
+ https://bugs.webkit.org/show_bug.cgi?id=41199
+
+ * api/qscriptengine.cpp:
+ (QScriptEngine::hasUncaughtException):
+ (QScriptEngine::uncaughtException):
+ (QScriptEngine::clearExceptions):
+ (QScriptEngine::uncaughtExceptionLineNumber):
+ (QScriptEngine::uncaughtExceptionBacktrace):
+ * api/qscriptengine.h:
+ * api/qscriptengine_p.cpp:
+ (QScriptEnginePrivate::QScriptEnginePrivate):
+ (QScriptEnginePrivate::~QScriptEnginePrivate):
+ (QScriptEnginePrivate::uncaughtException):
+ * api/qscriptengine_p.h:
+ (QScriptEnginePrivate::):
+ (QScriptEnginePrivate::evaluate):
+ (QScriptEnginePrivate::hasUncaughtException):
+ (QScriptEnginePrivate::clearExceptions):
+ (QScriptEnginePrivate::setException):
+ (QScriptEnginePrivate::uncaughtExceptionLineNumber):
+ (QScriptEnginePrivate::uncaughtExceptionBacktrace):
+ * api/qscriptvalue_p.h:
+ (QScriptValuePrivate::toString):
+ (QScriptValuePrivate::toNumber):
+ (QScriptValuePrivate::toObject):
+ (QScriptValuePrivate::equals):
+ (QScriptValuePrivate::instanceOf):
+ (QScriptValuePrivate::call):
+ (QScriptValuePrivate::inherits):
+ * tests/qscriptengine/tst_qscriptengine.cpp:
+ (tst_QScriptEngine::uncaughtException):
+
diff --git a/Source/JavaScriptCore/qt/api/QtScript.pro b/Source/JavaScriptCore/qt/api/QtScript.pro
new file mode 100644
index 0000000..490758c
--- /dev/null
+++ b/Source/JavaScriptCore/qt/api/QtScript.pro
@@ -0,0 +1,51 @@
+TARGET = QtScript
+TEMPLATE = lib
+QT = core
+
+INCLUDEPATH += $$PWD
+
+CONFIG += building-libs
+
+isEmpty(JSC_GENERATED_SOURCES_DIR):JSC_GENERATED_SOURCES_DIR = ../../generated
+!CONFIG(release, debug|release) {
+ OBJECTS_DIR = obj/debug
+} else { # Release
+ OBJECTS_DIR = obj/release
+}
+
+isEmpty(OUTPUT_DIR): OUTPUT_DIR = ../../..
+include($$PWD/../../../WebKit.pri)
+
+include($$PWD/../../JavaScriptCore.pri)
+addJavaScriptCoreLib(../..)
+
+INCLUDEPATH += $$PWD/../../API
+
+SOURCES += $$PWD/qscriptengine.cpp \
+ $$PWD/qscriptengine_p.cpp \
+ $$PWD/qscriptvalue.cpp \
+ $$PWD/qscriptvalueiterator.cpp \
+ $$PWD/qscriptstring.cpp \
+ $$PWD/qscriptprogram.cpp \
+ $$PWD/qscriptsyntaxcheckresult.cpp \
+ $$PWD/qscriptfunction.cpp
+
+HEADERS += $$PWD/qtscriptglobal.h \
+ $$PWD/qscriptengine.h \
+ $$PWD/qscriptengine_p.h \
+ $$PWD/qscriptvalue.h \
+ $$PWD/qscriptvalue_p.h \
+ $$PWD/qscriptvalueiterator.h \
+ $$PWD/qscriptvalueiterator_p.h \
+ $$PWD/qscriptconverter_p.h \
+ $$PWD/qscriptstring.h \
+ $$PWD/qscriptstring_p.h \
+ $$PWD/qscriptprogram.h \
+ $$PWD/qscriptprogram_p.h \
+ $$PWD/qscriptsyntaxcheckresult.h \
+ $$PWD/qscriptoriginalglobalobject_p.h \
+ $$PWD/qscriptfunction_p.h
+
+!static: DEFINES += QT_MAKEDLL
+
+DESTDIR = $$OUTPUT_DIR/lib
diff --git a/Source/JavaScriptCore/qt/api/qscriptconverter_p.h b/Source/JavaScriptCore/qt/api/qscriptconverter_p.h
new file mode 100644
index 0000000..0c57d95
--- /dev/null
+++ b/Source/JavaScriptCore/qt/api/qscriptconverter_p.h
@@ -0,0 +1,146 @@
+/*
+ Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef qscriptconverter_p_h
+#define qscriptconverter_p_h
+
+#include "qscriptvalue.h"
+#include <JavaScriptCore/JavaScript.h>
+#include <QtCore/qglobal.h>
+#include <QtCore/qnumeric.h>
+#include <QtCore/qstring.h>
+#include <QtCore/qvarlengtharray.h>
+
+extern char *qdtoa(double d, int mode, int ndigits, int *decpt, int *sign, char **rve, char **digits_str);
+
+/*
+ \internal
+ \class QScriptConverter
+ QScriptValue and QScriptEngine helper class. This class's responsibility is to convert values
+ between JS values and Qt/C++ values.
+
+ This is a nice way to inline these functions in both QScriptValue and QScriptEngine.
+*/
+class QScriptConverter {
+public:
+ static quint32 toArrayIndex(const JSStringRef jsstring)
+ {
+ // FIXME this function should be exported by JSC C API.
+ QString qstring = toString(jsstring);
+
+ bool ok;
+ quint32 idx = qstring.toUInt(&ok);
+ if (!ok || toString(idx) != qstring)
+ idx = 0xffffffff;
+
+ return idx;
+ }
+
+ static QString toString(const JSStringRef str)
+ {
+ return QString(reinterpret_cast<const QChar*>(JSStringGetCharactersPtr(str)), JSStringGetLength(str));
+ }
+ static JSStringRef toString(const QString& str)
+ {
+ return JSStringCreateWithUTF8CString(str.toUtf8().constData());
+ }
+ static JSStringRef toString(const char* str)
+ {
+ return JSStringCreateWithUTF8CString(str);
+ }
+ static QString toString(double value)
+ {
+ // FIXME this should be easier. The ideal fix is to create
+ // a new function in JSC C API which could cover the functionality.
+
+ if (qIsNaN(value))
+ return QString::fromLatin1("NaN");
+ if (qIsInf(value))
+ return QString::fromLatin1(value < 0 ? "-Infinity" : "Infinity");
+ if (!value)
+ return QString::fromLatin1("0");
+
+ QVarLengthArray<char, 25> buf;
+ int decpt;
+ int sign;
+ char* result = 0;
+ char* endresult;
+ (void)qdtoa(value, 0, 0, &decpt, &sign, &endresult, &result);
+
+ if (!result)
+ return QString();
+
+ int resultLen = endresult - result;
+ if (decpt <= 0 && decpt > -6) {
+ buf.resize(-decpt + 2 + sign);
+ qMemSet(buf.data(), '0', -decpt + 2 + sign);
+ if (sign) // fix the sign.
+ buf[0] = '-';
+ buf[sign + 1] = '.';
+ buf.append(result, resultLen);
+ } else {
+ if (sign)
+ buf.append('-');
+ int length = buf.size() - sign + resultLen;
+ if (decpt <= 21 && decpt > 0) {
+ if (length <= decpt) {
+ const char* zeros = "0000000000000000000000000";
+ buf.append(result, resultLen);
+ buf.append(zeros, decpt - length);
+ } else {
+ buf.append(result, decpt);
+ buf.append('.');
+ buf.append(result + decpt, resultLen - decpt);
+ }
+ } else if (result[0] >= '0' && result[0] <= '9') {
+ if (length > 1) {
+ buf.append(result, 1);
+ buf.append('.');
+ buf.append(result + 1, resultLen - 1);
+ } else
+ buf.append(result, resultLen);
+ buf.append('e');
+ buf.append(decpt >= 0 ? '+' : '-');
+ int e = qAbs(decpt - 1);
+ if (e >= 100)
+ buf.append('0' + e / 100);
+ if (e >= 10)
+ buf.append('0' + (e % 100) / 10);
+ buf.append('0' + e % 10);
+ }
+ }
+ free(result);
+ buf.append(0);
+ return QString::fromLatin1(buf.constData());
+ }
+
+ static JSPropertyAttributes toPropertyFlags(const QFlags<QScriptValue::PropertyFlag>& flags)
+ {
+ JSPropertyAttributes attr = 0;
+ if (flags.testFlag(QScriptValue::ReadOnly))
+ attr |= kJSPropertyAttributeReadOnly;
+ if (flags.testFlag(QScriptValue::Undeletable))
+ attr |= kJSPropertyAttributeDontDelete;
+ if (flags.testFlag(QScriptValue::SkipInEnumeration))
+ attr |= kJSPropertyAttributeDontEnum;
+ return attr;
+ }
+};
+
+#endif // qscriptconverter_p_h
diff --git a/Source/JavaScriptCore/qt/api/qscriptengine.cpp b/Source/JavaScriptCore/qt/api/qscriptengine.cpp
new file mode 100644
index 0000000..607b0b9
--- /dev/null
+++ b/Source/JavaScriptCore/qt/api/qscriptengine.cpp
@@ -0,0 +1,426 @@
+/*
+ Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include "config.h"
+
+#include "qscriptengine.h"
+
+#include "qscriptengine_p.h"
+#include "qscriptprogram_p.h"
+#include "qscriptsyntaxcheckresult_p.h"
+#include "qscriptvalue_p.h"
+#include <QtCore/qdatetime.h>
+#include <QtCore/qnumeric.h>
+
+/*!
+ Constructs a QScriptEngine object.
+
+ The globalObject() is initialized to have properties as described in ECMA-262, Section 15.1.
+*/
+QScriptEngine::QScriptEngine()
+ : d_ptr(new QScriptEnginePrivate(this))
+{
+}
+
+/*!
+ Destroys this QScriptEngine.
+*/
+QScriptEngine::~QScriptEngine()
+{
+}
+
+/*!
+ Checks the syntax of the given \a program. Returns a
+ QScriptSyntaxCheckResult object that contains the result of the check.
+*/
+QScriptSyntaxCheckResult QScriptEngine::checkSyntax(const QString &program)
+{
+ // FIXME This is not optimal.
+ // The JSC C API needs a context to perform a syntax check, it means that a QScriptEnginePrivate
+ // had to be created. This function is static so we have to create QScriptEnginePrivate for each
+ // call. We can't remove the "static" for compatibility reason, at least up to Qt5.
+ // QScriptSyntaxCheckResultPrivate takes ownership of newly created engine. The engine will be
+ // kept as long as it is needed for lazy evaluation of properties of
+ // the QScriptSyntaxCheckResultPrivate.
+ QScriptEnginePrivate* engine = new QScriptEnginePrivate(/* q_ptr */ 0);
+ return QScriptSyntaxCheckResultPrivate::get(engine->checkSyntax(program));
+}
+
+/*!
+ Evaluates \a program, using \a lineNumber as the base line number,
+ and returns the result of the evaluation.
+
+ The script code will be evaluated in the current context.
+
+ The evaluation of \a program can cause an exception in the
+ engine; in this case the return value will be the exception
+ that was thrown (typically an \c{Error} object). You can call
+ hasUncaughtException() to determine if an exception occurred in
+ the last call to evaluate().
+
+ \a lineNumber is used to specify a starting line number for \a
+ program; line number information reported by the engine that pertain
+ to this evaluation (e.g. uncaughtExceptionLineNumber()) will be
+ based on this argument. For example, if \a program consists of two
+ lines of code, and the statement on the second line causes a script
+ exception, uncaughtExceptionLineNumber() would return the given \a
+ lineNumber plus one. When no starting line number is specified, line
+ numbers will be 1-based.
+
+ \a fileName is used for error reporting. For example in error objects
+ the file name is accessible through the "fileName" property if it's
+ provided with this function.
+*/
+QScriptValue QScriptEngine::evaluate(const QString& program, const QString& fileName, int lineNumber)
+{
+ return QScriptValuePrivate::get(d_ptr->evaluate(program, fileName, lineNumber));
+}
+
+QScriptValue QScriptEngine::evaluate(const QScriptProgram& program)
+{
+ return QScriptValuePrivate::get(d_ptr->evaluate(QScriptProgramPrivate::get(program)));
+}
+
+/*!
+ Returns true if the last script evaluation resulted in an uncaught
+ exception; otherwise returns false.
+
+ The exception state is cleared when evaluate() is called.
+
+ \sa uncaughtException(), uncaughtExceptionLineNumber(),
+ uncaughtExceptionBacktrace()
+*/
+bool QScriptEngine::hasUncaughtException() const
+{
+ return d_ptr->hasUncaughtException();
+}
+
+/*!
+ Returns the current uncaught exception, or an invalid QScriptValue
+ if there is no uncaught exception.
+
+ The exception value is typically an \c{Error} object; in that case,
+ you can call toString() on the return value to obtain an error
+ message.
+
+ \sa hasUncaughtException(), uncaughtExceptionLineNumber(),
+ uncaughtExceptionBacktrace()
+*/
+QScriptValue QScriptEngine::uncaughtException() const
+{
+ return QScriptValuePrivate::get(d_ptr->uncaughtException());
+}
+
+/*!
+ Clears any uncaught exceptions in this engine.
+
+ \sa hasUncaughtException()
+*/
+void QScriptEngine::clearExceptions()
+{
+ d_ptr->clearExceptions();
+}
+
+/*!
+ Returns the line number where the last uncaught exception occurred.
+
+ Line numbers are 1-based, unless a different base was specified as
+ the second argument to evaluate().
+
+ \sa hasUncaughtException(), uncaughtExceptionBacktrace()
+*/
+int QScriptEngine::uncaughtExceptionLineNumber() const
+{
+ return d_ptr->uncaughtExceptionLineNumber();
+}
+
+/*!
+ Returns a human-readable backtrace of the last uncaught exception.
+
+ Each line is of the form \c{<function-name>(<arguments>)@<file-name>:<line-number>}.
+
+ \sa uncaughtException()
+*/
+QStringList QScriptEngine::uncaughtExceptionBacktrace() const
+{
+ return d_ptr->uncaughtExceptionBacktrace();
+}
+
+/*!
+ Runs the garbage collector.
+
+ The garbage collector will attempt to reclaim memory by locating and disposing of objects that are
+ no longer reachable in the script environment.
+
+ Normally you don't need to call this function; the garbage collector will automatically be invoked
+ when the QScriptEngine decides that it's wise to do so (i.e. when a certain number of new objects
+ have been created). However, you can call this function to explicitly request that garbage
+ collection should be performed as soon as possible.
+
+ \sa reportAdditionalMemoryCost()
+*/
+void QScriptEngine::collectGarbage()
+{
+ d_ptr->collectGarbage();
+}
+
+/*!
+ Reports an additional memory cost of the given \a size, measured in
+ bytes, to the garbage collector.
+
+ This function can be called to indicate that a JavaScript object has
+ memory associated with it that isn't managed by Qt Script itself.
+ Reporting the additional cost makes it more likely that the garbage
+ collector will be triggered.
+
+ Note that if the additional memory is shared with objects outside
+ the scripting environment, the cost should not be reported, since
+ collecting the JavaScript object would not cause the memory to be
+ freed anyway.
+
+ Negative \a size values are ignored, i.e. this function can't be
+ used to report that the additional memory has been deallocated.
+
+ \sa collectGarbage()
+*/
+void QScriptEngine::reportAdditionalMemoryCost(int cost)
+{
+ d_ptr->reportAdditionalMemoryCost(cost);
+}
+
+/*!
+ Returns a handle that represents the given string, \a str.
+
+ QScriptString can be used to quickly look up properties, and
+ compare property names, of script objects.
+
+ \sa QScriptValue::property()
+*/
+QScriptString QScriptEngine::toStringHandle(const QString& str)
+{
+ return QScriptStringPrivate::get(d_ptr->toStringHandle(str));
+}
+
+/*!
+ Converts the given \a value to an object, if such a conversion is
+ possible; otherwise returns an invalid QScriptValue. The conversion
+ is performed according to the following table:
+
+ \table
+ \header \o Input Type \o Result
+ \row \o Undefined \o An invalid QScriptValue.
+ \row \o Null \o An invalid QScriptValue.
+ \row \o Boolean \o A new Boolean object whose internal value is set to the value of the boolean.
+ \row \o Number \o A new Number object whose internal value is set to the value of the number.
+ \row \o String \o A new String object whose internal value is set to the value of the string.
+ \row \o Object \o The result is the object itself (no conversion).
+ \endtable
+
+ \sa newObject()
+*/
+QScriptValue QScriptEngine::toObject(const QScriptValue& value)
+{
+ return QScriptValuePrivate::get(QScriptValuePrivate::get(value)->toObject(d_ptr.data()));
+}
+
+/*!
+ Returns a QScriptValue of the primitive type Null.
+
+ \sa undefinedValue()
+*/
+QScriptValue QScriptEngine::nullValue()
+{
+ return QScriptValue(this, QScriptValue::NullValue);
+}
+
+/*!
+ Returns a QScriptValue of the primitive type Undefined.
+
+ \sa nullValue()
+*/
+QScriptValue QScriptEngine::undefinedValue()
+{
+ return QScriptValue(this, QScriptValue::UndefinedValue);
+}
+
+/*!
+ Creates a QScriptValue that wraps a native (C++) function. \a fun
+ must be a C++ function with signature QScriptEngine::FunctionSignature.
+ \a length is the number of arguments that \a fun expects; this becomes
+ the \c{length} property of the created QScriptValue.
+
+ Note that \a length only gives an indication of the number of
+ arguments that the function expects; an actual invocation of a
+ function can include any number of arguments. You can check the
+ \l{QScriptContext::argumentCount()}{argumentCount()} of the
+ QScriptContext associated with the invocation to determine the
+ actual number of arguments passed.
+
+ A \c{prototype} property is automatically created for the resulting
+ function object, to provide for the possibility that the function
+ will be used as a constructor.
+
+ By combining newFunction() and the property flags
+ QScriptValue::PropertyGetter and QScriptValue::PropertySetter, you
+ can create script object properties that behave like normal
+ properties in script code, but are in fact accessed through
+ functions (analogous to how properties work in \l{Qt's Property
+ System}). Example:
+
+ \snippet doc/src/snippets/code/src_script_qscriptengine.cpp 11
+
+ When the property \c{foo} of the script object is subsequently
+ accessed in script code, \c{getSetFoo()} will be invoked to handle
+ the access. In this particular case, we chose to store the "real"
+ value of \c{foo} as a property of the accessor function itself; you
+ are of course free to do whatever you like in this function.
+
+ In the above example, a single native function was used to handle
+ both reads and writes to the property; the argument count is used to
+ determine if we are handling a read or write. You can also use two
+ separate functions; just specify the relevant flag
+ (QScriptValue::PropertyGetter or QScriptValue::PropertySetter) when
+ setting the property, e.g.:
+
+ \snippet doc/src/snippets/code/src_script_qscriptengine.cpp 12
+
+ \sa QScriptValue::call()
+*/
+QScriptValue QScriptEngine::newFunction(QScriptEngine::FunctionSignature fun, int length)
+{
+ return QScriptValuePrivate::get(d_ptr->newFunction(fun, 0, length));
+}
+
+/*!
+ Creates a constructor function from \a fun, with the given \a length.
+ The \c{prototype} property of the resulting function is set to be the
+ given \a prototype. The \c{constructor} property of \a prototype is
+ set to be the resulting function.
+
+ When a function is called as a constructor (e.g. \c{new Foo()}), the
+ `this' object associated with the function call is the new object
+ that the function is expected to initialize; the prototype of this
+ default constructed object will be the function's public
+ \c{prototype} property. If you always want the function to behave as
+ a constructor (e.g. \c{Foo()} should also create a new object), or
+ if you need to create your own object rather than using the default
+ `this' object, you should make sure that the prototype of your
+ object is set correctly; either by setting it manually, or, when
+ wrapping a custom type, by having registered the defaultPrototype()
+ of that type. Example:
+
+ \snippet doc/src/snippets/code/src_script_qscriptengine.cpp 9
+
+ To wrap a custom type and provide a constructor for it, you'd typically
+ do something like this:
+
+ \snippet doc/src/snippets/code/src_script_qscriptengine.cpp 10
+*/
+QScriptValue QScriptEngine::newFunction(QScriptEngine::FunctionSignature fun, const QScriptValue& prototype, int length)
+{
+ return QScriptValuePrivate::get(d_ptr->newFunction(fun, QScriptValuePrivate::get(prototype), length));
+}
+
+/*!
+ \internal
+ \since 4.4
+*/
+QScriptValue QScriptEngine::newFunction(QScriptEngine::FunctionWithArgSignature fun, void* arg)
+{
+ return QScriptValuePrivate::get(d_ptr->newFunction(fun, arg));
+}
+
+/*!
+ Creates a QtScript object of class Object.
+
+ The prototype of the created object will be the Object
+ prototype object.
+
+ \sa newArray(), QScriptValue::setProperty()
+*/
+QScriptValue QScriptEngine::newObject()
+{
+ return QScriptValuePrivate::get(d_ptr->newObject());
+}
+
+/*!
+ Creates a QtScript object of class Array with the given \a length.
+
+ \sa newObject()
+*/
+QScriptValue QScriptEngine::newArray(uint length)
+{
+ return QScriptValuePrivate::get(d_ptr->newArray(length));
+}
+
+/*!
+ Creates a QtScript object of class Date with the given \a value
+ (the number of milliseconds since 01 January 1970, UTC).
+*/
+QScriptValue QScriptEngine::newDate(qsreal value)
+{
+ return QScriptValuePrivate::get(d_ptr->newDate(value));
+}
+
+/*!
+ Creates a QtScript object of class Date from the given \a value.
+
+ \sa QScriptValue::toDateTime()
+*/
+QScriptValue QScriptEngine::newDate(const QDateTime& value)
+{
+ if (value.isValid())
+ return QScriptValuePrivate::get(d_ptr->newDate(qsreal(value.toMSecsSinceEpoch())));
+ return QScriptValuePrivate::get(d_ptr->newDate(qSNaN()));
+}
+
+/*!
+ Returns this engine's Global Object.
+
+ By default, the Global Object contains the built-in objects that are
+ part of \l{ECMA-262}, such as Math, Date and String. Additionally,
+ you can set properties of the Global Object to make your own
+ extensions available to all script code. Non-local variables in
+ script code will be created as properties of the Global Object, as
+ well as local variables in global code.
+*/
+QScriptValue QScriptEngine::globalObject() const
+{
+ return QScriptValuePrivate::get(d_ptr->globalObject());
+}
+
+/*!
+ \typedef QScriptEngine::FunctionSignature
+ \relates QScriptEngine
+
+ The function signature \c{QScriptValue f(QScriptContext *, QScriptEngine *)}.
+
+ A function with such a signature can be passed to
+ QScriptEngine::newFunction() to wrap the function.
+*/
+
+/*!
+ \typedef QScriptEngine::FunctionWithArgSignature
+ \relates QScriptEngine
+
+ The function signature \c{QScriptValue f(QScriptContext *, QScriptEngine *, void *)}.
+
+ A function with such a signature can be passed to
+ QScriptEngine::newFunction() to wrap the function.
+*/
diff --git a/Source/JavaScriptCore/qt/api/qscriptengine.h b/Source/JavaScriptCore/qt/api/qscriptengine.h
new file mode 100644
index 0000000..281707f
--- /dev/null
+++ b/Source/JavaScriptCore/qt/api/qscriptengine.h
@@ -0,0 +1,82 @@
+/*
+ Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef qscriptengine_h
+#define qscriptengine_h
+
+#include "qscriptprogram.h"
+#include "qscriptstring.h"
+#include "qscriptsyntaxcheckresult.h"
+#include "qscriptvalue.h"
+#include <QtCore/qobject.h>
+#include <QtCore/qshareddata.h>
+#include <QtCore/qstring.h>
+
+class QDateTime;
+class QScriptEnginePrivate;
+
+// FIXME: Remove this once QScriptContext is properly defined.
+typedef void QScriptContext;
+
+// Internal typedef
+typedef QExplicitlySharedDataPointer<QScriptEnginePrivate> QScriptEnginePtr;
+
+class QScriptEngine : public QObject {
+public:
+ QScriptEngine();
+ ~QScriptEngine();
+
+ static QScriptSyntaxCheckResult checkSyntax(const QString& program);
+ QScriptValue evaluate(const QString& program, const QString& fileName = QString(), int lineNumber = 1);
+ QScriptValue evaluate(const QScriptProgram& program);
+
+ bool hasUncaughtException() const;
+ QScriptValue uncaughtException() const;
+ void clearExceptions();
+ int uncaughtExceptionLineNumber() const;
+ QStringList uncaughtExceptionBacktrace() const;
+
+ void collectGarbage();
+ void reportAdditionalMemoryCost(int cost);
+
+ QScriptString toStringHandle(const QString& str);
+ QScriptValue toObject(const QScriptValue& value);
+
+ QScriptValue nullValue();
+ QScriptValue undefinedValue();
+
+ typedef QScriptValue (*FunctionSignature)(QScriptContext *, QScriptEngine *);
+ typedef QScriptValue (*FunctionWithArgSignature)(QScriptContext *, QScriptEngine *, void *);
+
+ QScriptValue newFunction(FunctionSignature fun, int length = 0);
+ QScriptValue newFunction(FunctionSignature fun, const QScriptValue& prototype, int length = 0);
+ QScriptValue newFunction(FunctionWithArgSignature fun, void* arg);
+
+ QScriptValue newObject();
+ QScriptValue newArray(uint length = 0);
+ QScriptValue newDate(qsreal value);
+ QScriptValue newDate(const QDateTime& value);
+ QScriptValue globalObject() const;
+private:
+ friend class QScriptEnginePrivate;
+
+ QScriptEnginePtr d_ptr;
+};
+
+#endif
diff --git a/Source/JavaScriptCore/qt/api/qscriptengine_p.cpp b/Source/JavaScriptCore/qt/api/qscriptengine_p.cpp
new file mode 100644
index 0000000..89054c0
--- /dev/null
+++ b/Source/JavaScriptCore/qt/api/qscriptengine_p.cpp
@@ -0,0 +1,167 @@
+/*
+ Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include "config.h"
+
+#include "qscriptengine_p.h"
+
+#include "qscriptfunction_p.h"
+#include "qscriptprogram_p.h"
+#include "qscriptvalue_p.h"
+
+/*!
+ Constructs a default QScriptEnginePrivate object, a new global context will be created.
+ \internal
+*/
+QScriptEnginePrivate::QScriptEnginePrivate(const QScriptEngine* engine)
+ : q_ptr(const_cast<QScriptEngine*>(engine))
+ , m_context(JSGlobalContextCreate(0))
+ , m_exception(0)
+ , m_originalGlobalObject(m_context)
+ , m_nativeFunctionClass(JSClassCreate(&qt_NativeFunctionClass))
+ , m_nativeFunctionWithArgClass(JSClassCreate(&qt_NativeFunctionWithArgClass))
+{
+}
+
+QScriptEnginePrivate::~QScriptEnginePrivate()
+{
+ JSClassRelease(m_nativeFunctionClass);
+ JSClassRelease(m_nativeFunctionWithArgClass);
+ if (m_exception)
+ JSValueUnprotect(m_context, m_exception);
+ JSGlobalContextRelease(m_context);
+}
+
+QScriptSyntaxCheckResultPrivate* QScriptEnginePrivate::checkSyntax(const QString& program)
+{
+ JSValueRef exception;
+ JSStringRef source = QScriptConverter::toString(program);
+ bool syntaxIsCorrect = JSCheckScriptSyntax(m_context, source, /* url */ 0, /* starting line */ 1, &exception);
+ JSStringRelease(source);
+ if (syntaxIsCorrect) {
+ return new QScriptSyntaxCheckResultPrivate(this);
+ }
+ JSValueProtect(m_context, exception);
+ return new QScriptSyntaxCheckResultPrivate(this, const_cast<JSObjectRef>(exception));
+}
+
+/*!
+ Evaluates program and returns the result of the evaluation.
+ \internal
+*/
+QScriptValuePrivate* QScriptEnginePrivate::evaluate(const QString& program, const QString& fileName, int lineNumber)
+{
+ JSStringRef script = QScriptConverter::toString(program);
+ JSStringRef file = QScriptConverter::toString(fileName);
+ QScriptValuePrivate* result = new QScriptValuePrivate(this, evaluate(script, file, lineNumber));
+ JSStringRelease(script);
+ JSStringRelease(file);
+ return result;
+}
+
+/*!
+ Evaluates program and returns the result of the evaluation.
+ \internal
+*/
+QScriptValuePrivate* QScriptEnginePrivate::evaluate(const QScriptProgramPrivate* program)
+{
+ if (program->isNull())
+ return new QScriptValuePrivate;
+ return new QScriptValuePrivate(this, evaluate(*program, program->file(), program->line()));
+}
+
+QScriptValuePrivate* QScriptEnginePrivate::uncaughtException() const
+{
+ return m_exception ? new QScriptValuePrivate(this, m_exception) : new QScriptValuePrivate();
+}
+
+QScriptValuePrivate* QScriptEnginePrivate::newFunction(QScriptEngine::FunctionSignature fun, QScriptValuePrivate* prototype, int length)
+{
+ // Note that this private data will be deleted in the object finalize function.
+ QNativeFunctionData* data = new QNativeFunctionData(this, fun);
+ JSObjectRef funJS = JSObjectMake(m_context, m_nativeFunctionClass, reinterpret_cast<void*>(data));
+ QScriptValuePrivate* proto = prototype ? prototype : newObject();
+ return newFunction(funJS, proto);
+}
+
+QScriptValuePrivate* QScriptEnginePrivate::newFunction(QScriptEngine::FunctionWithArgSignature fun, void* arg)
+{
+ // Note that this private data will be deleted in the object finalize function.
+ QNativeFunctionWithArgData* data = new QNativeFunctionWithArgData(this, fun, arg);
+ JSObjectRef funJS = JSObjectMake(m_context, m_nativeFunctionWithArgClass, reinterpret_cast<void*>(data));
+ QScriptValuePrivate* proto = newObject();
+ return newFunction(funJS, proto);
+}
+
+QScriptValuePrivate* QScriptEnginePrivate::newFunction(JSObjectRef funJS, QScriptValuePrivate* prototype)
+{
+ JSObjectSetPrototype(m_context, funJS, m_originalGlobalObject.functionPrototype());
+
+ QScriptValuePrivate* result = new QScriptValuePrivate(this, funJS);
+ static JSStringRef protoName = QScriptConverter::toString("prototype");
+ static JSStringRef constructorName = QScriptConverter::toString("constructor");
+ result->setProperty(protoName, prototype, QScriptValue::Undeletable);
+ prototype->setProperty(constructorName, result, QScriptValue::PropertyFlags(QScriptValue::Undeletable | QScriptValue::SkipInEnumeration));
+
+ return result;
+}
+
+QScriptValuePrivate* QScriptEnginePrivate::newObject() const
+{
+ return new QScriptValuePrivate(this, JSObjectMake(m_context, /* jsClass */ 0, /* userData */ 0));
+}
+
+QScriptValuePrivate* QScriptEnginePrivate::newArray(uint length)
+{
+ JSValueRef exception = 0;
+ JSObjectRef array = JSObjectMakeArray(m_context, /* argumentCount */ 0, /* arguments */ 0, &exception);
+
+ if (!exception) {
+ if (length > 0) {
+ JSRetainPtr<JSStringRef> lengthRef(Adopt, JSStringCreateWithUTF8CString("length"));
+ // array is an Array instance, so an exception should not occure here.
+ JSObjectSetProperty(m_context, array, lengthRef.get(), JSValueMakeNumber(m_context, length), kJSPropertyAttributeNone, /* exception */ 0);
+ }
+ } else {
+ setException(exception, NotNullException);
+ return new QScriptValuePrivate();
+ }
+
+ return new QScriptValuePrivate(this, array);
+}
+
+QScriptValuePrivate* QScriptEnginePrivate::newDate(qsreal value)
+{
+ JSValueRef exception = 0;
+ JSValueRef argument = JSValueMakeNumber(m_context, value);
+ JSObjectRef result = JSObjectMakeDate(m_context, /* argumentCount */ 1, &argument, &exception);
+
+ if (exception) {
+ setException(exception, NotNullException);
+ return new QScriptValuePrivate();
+ }
+
+ return new QScriptValuePrivate(this, result);
+}
+
+QScriptValuePrivate* QScriptEnginePrivate::globalObject() const
+{
+ JSObjectRef globalObject = JSContextGetGlobalObject(m_context);
+ return new QScriptValuePrivate(this, globalObject);
+}
diff --git a/Source/JavaScriptCore/qt/api/qscriptengine_p.h b/Source/JavaScriptCore/qt/api/qscriptengine_p.h
new file mode 100644
index 0000000..4603b91
--- /dev/null
+++ b/Source/JavaScriptCore/qt/api/qscriptengine_p.h
@@ -0,0 +1,259 @@
+/*
+ Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef qscriptengine_p_h
+#define qscriptengine_p_h
+
+#include "qscriptconverter_p.h"
+#include "qscriptengine.h"
+#include "qscriptoriginalglobalobject_p.h"
+#include "qscriptstring_p.h"
+#include "qscriptsyntaxcheckresult_p.h"
+#include "qscriptvalue.h"
+#include <JavaScriptCore/JavaScript.h>
+#include <JavaScriptCore/JSRetainPtr.h>
+#include <JSBasePrivate.h>
+#include <QtCore/qshareddata.h>
+#include <QtCore/qstring.h>
+#include <QtCore/qstringlist.h>
+
+class QScriptEngine;
+class QScriptSyntaxCheckResultPrivate;
+
+class QScriptEnginePrivate : public QSharedData {
+public:
+ static QScriptEnginePrivate* get(const QScriptEngine* q) { Q_ASSERT(q); return q->d_ptr.data(); }
+ static QScriptEngine* get(const QScriptEnginePrivate* d) { Q_ASSERT(d); return d->q_ptr; }
+
+ QScriptEnginePrivate(const QScriptEngine*);
+ ~QScriptEnginePrivate();
+
+ enum SetExceptionFlag {
+ IgnoreNullException = 0x01,
+ NotNullException = 0x02,
+ };
+
+ QScriptSyntaxCheckResultPrivate* checkSyntax(const QString& program);
+ QScriptValuePrivate* evaluate(const QString& program, const QString& fileName, int lineNumber);
+ QScriptValuePrivate* evaluate(const QScriptProgramPrivate* program);
+ inline JSValueRef evaluate(JSStringRef program, JSStringRef fileName, int lineNumber);
+
+ inline bool hasUncaughtException() const;
+ QScriptValuePrivate* uncaughtException() const;
+ inline void clearExceptions();
+ inline void setException(JSValueRef exception, const /* SetExceptionFlags */ unsigned flags = IgnoreNullException);
+ inline int uncaughtExceptionLineNumber() const;
+ inline QStringList uncaughtExceptionBacktrace() const;
+
+ inline void collectGarbage();
+ inline void reportAdditionalMemoryCost(int cost);
+
+ inline JSValueRef makeJSValue(double number) const;
+ inline JSValueRef makeJSValue(int number) const;
+ inline JSValueRef makeJSValue(uint number) const;
+ inline JSValueRef makeJSValue(const QString& string) const;
+ inline JSValueRef makeJSValue(bool number) const;
+ inline JSValueRef makeJSValue(QScriptValue::SpecialValue value) const;
+
+ QScriptValuePrivate* newFunction(QScriptEngine::FunctionSignature fun, QScriptValuePrivate* prototype, int length);
+ QScriptValuePrivate* newFunction(QScriptEngine::FunctionWithArgSignature fun, void* arg);
+ QScriptValuePrivate* newFunction(JSObjectRef funObject, QScriptValuePrivate* prototype);
+
+ QScriptValuePrivate* newObject() const;
+ QScriptValuePrivate* newArray(uint length);
+ QScriptValuePrivate* newDate(qsreal value);
+ QScriptValuePrivate* globalObject() const;
+
+ inline QScriptStringPrivate* toStringHandle(const QString& str) const;
+
+ inline operator JSGlobalContextRef() const;
+
+ inline bool isDate(JSValueRef value) const;
+ inline bool isArray(JSValueRef value) const;
+ inline bool isError(JSValueRef value) const;
+ inline bool objectHasOwnProperty(JSObjectRef object, JSStringRef property) const;
+ inline QVector<JSStringRef> objectGetOwnPropertyNames(JSObjectRef object) const;
+
+private:
+ QScriptEngine* q_ptr;
+ JSGlobalContextRef m_context;
+ JSValueRef m_exception;
+
+ QScriptOriginalGlobalObject m_originalGlobalObject;
+
+ JSClassRef m_nativeFunctionClass;
+ JSClassRef m_nativeFunctionWithArgClass;
+};
+
+
+/*!
+ Evaluates given JavaScript program and returns result of the evaluation.
+ \attention this function doesn't take ownership of the parameters.
+ \internal
+*/
+JSValueRef QScriptEnginePrivate::evaluate(JSStringRef program, JSStringRef fileName, int lineNumber)
+{
+ JSValueRef exception;
+ JSValueRef result = JSEvaluateScript(m_context, program, /* Global Object */ 0, fileName, lineNumber, &exception);
+ if (!result) {
+ setException(exception, NotNullException);
+ return exception; // returns an exception
+ }
+ clearExceptions();
+ return result;
+}
+
+bool QScriptEnginePrivate::hasUncaughtException() const
+{
+ return m_exception;
+}
+
+void QScriptEnginePrivate::clearExceptions()
+{
+ if (m_exception)
+ JSValueUnprotect(m_context, m_exception);
+ m_exception = 0;
+}
+
+void QScriptEnginePrivate::setException(JSValueRef exception, const /* SetExceptionFlags */ unsigned flags)
+{
+ if (!((flags & NotNullException) || exception))
+ return;
+ Q_ASSERT(exception);
+
+ if (m_exception)
+ JSValueUnprotect(m_context, m_exception);
+ JSValueProtect(m_context, exception);
+ m_exception = exception;
+}
+
+int QScriptEnginePrivate::uncaughtExceptionLineNumber() const
+{
+ if (!hasUncaughtException() || !JSValueIsObject(m_context, m_exception))
+ return -1;
+
+ JSValueRef exception = 0;
+ JSRetainPtr<JSStringRef> lineNumberPropertyName(Adopt, QScriptConverter::toString("line"));
+ JSValueRef lineNumber = JSObjectGetProperty(m_context, const_cast<JSObjectRef>(m_exception), lineNumberPropertyName.get(), &exception);
+ int result = JSValueToNumber(m_context, lineNumber, &exception);
+ return exception ? -1 : result;
+}
+
+QStringList QScriptEnginePrivate::uncaughtExceptionBacktrace() const
+{
+ if (!hasUncaughtException() || !JSValueIsObject(m_context, m_exception))
+ return QStringList();
+
+ JSValueRef exception = 0;
+ JSRetainPtr<JSStringRef> fileNamePropertyName(Adopt, QScriptConverter::toString("sourceURL"));
+ JSRetainPtr<JSStringRef> lineNumberPropertyName(Adopt, QScriptConverter::toString("line"));
+ JSValueRef jsFileName = JSObjectGetProperty(m_context, const_cast<JSObjectRef>(m_exception), fileNamePropertyName.get(), &exception);
+ JSValueRef jsLineNumber = JSObjectGetProperty(m_context, const_cast<JSObjectRef>(m_exception), lineNumberPropertyName.get(), &exception);
+ JSRetainPtr<JSStringRef> fileName(Adopt, JSValueToStringCopy(m_context, jsFileName, &exception));
+ int lineNumber = JSValueToNumber(m_context, jsLineNumber, &exception);
+ return QStringList(QString::fromLatin1("<anonymous>()@%0:%1")
+ .arg(QScriptConverter::toString(fileName.get()))
+ .arg(QScriptConverter::toString(exception ? -1 : lineNumber)));
+}
+
+void QScriptEnginePrivate::collectGarbage()
+{
+ JSGarbageCollect(m_context);
+}
+
+void QScriptEnginePrivate::reportAdditionalMemoryCost(int cost)
+{
+ if (cost > 0)
+ JSReportExtraMemoryCost(m_context, cost);
+}
+
+JSValueRef QScriptEnginePrivate::makeJSValue(double number) const
+{
+ return JSValueMakeNumber(m_context, number);
+}
+
+JSValueRef QScriptEnginePrivate::makeJSValue(int number) const
+{
+ return JSValueMakeNumber(m_context, number);
+}
+
+JSValueRef QScriptEnginePrivate::makeJSValue(uint number) const
+{
+ return JSValueMakeNumber(m_context, number);
+}
+
+JSValueRef QScriptEnginePrivate::makeJSValue(const QString& string) const
+{
+ JSStringRef tmp = QScriptConverter::toString(string);
+ JSValueRef result = JSValueMakeString(m_context, tmp);
+ JSStringRelease(tmp);
+ return result;
+}
+
+JSValueRef QScriptEnginePrivate::makeJSValue(bool value) const
+{
+ return JSValueMakeBoolean(m_context, value);
+}
+
+JSValueRef QScriptEnginePrivate::makeJSValue(QScriptValue::SpecialValue value) const
+{
+ if (value == QScriptValue::NullValue)
+ return JSValueMakeNull(m_context);
+ return JSValueMakeUndefined(m_context);
+}
+
+QScriptStringPrivate* QScriptEnginePrivate::toStringHandle(const QString& str) const
+{
+ return new QScriptStringPrivate(str);
+}
+
+QScriptEnginePrivate::operator JSGlobalContextRef() const
+{
+ Q_ASSERT(this);
+ return m_context;
+}
+
+bool QScriptEnginePrivate::isDate(JSValueRef value) const
+{
+ return m_originalGlobalObject.isDate(value);
+}
+
+bool QScriptEnginePrivate::isArray(JSValueRef value) const
+{
+ return m_originalGlobalObject.isArray(value);
+}
+
+bool QScriptEnginePrivate::isError(JSValueRef value) const
+{
+ return m_originalGlobalObject.isError(value);
+}
+
+inline bool QScriptEnginePrivate::objectHasOwnProperty(JSObjectRef object, JSStringRef property) const
+{
+ // FIXME We need a JSC C API function for this.
+ return m_originalGlobalObject.objectHasOwnProperty(object, property);
+}
+
+inline QVector<JSStringRef> QScriptEnginePrivate::objectGetOwnPropertyNames(JSObjectRef object) const
+{
+ // FIXME We can't use C API function JSObjectGetPropertyNames as it returns only enumerable properties.
+ return m_originalGlobalObject.objectGetOwnPropertyNames(object);
+}
+
+#endif
diff --git a/Source/JavaScriptCore/qt/api/qscriptfunction.cpp b/Source/JavaScriptCore/qt/api/qscriptfunction.cpp
new file mode 100644
index 0000000..9fe37e6
--- /dev/null
+++ b/Source/JavaScriptCore/qt/api/qscriptfunction.cpp
@@ -0,0 +1,145 @@
+/*
+ Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+// Contains the necessary helper structures to make possible expose
+// C/C++ functions to JavaScript environment.
+
+#include "config.h"
+
+#include "qscriptfunction_p.h"
+
+static void qt_NativeFunction_finalize(JSObjectRef object)
+{
+ void* priv = JSObjectGetPrivate(object);
+ delete reinterpret_cast<QNativeFunctionData*>(priv);
+}
+
+static JSValueRef qt_NativeFunction_callAsFunction(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ QNativeFunctionData* data = reinterpret_cast<QNativeFunctionData*>(JSObjectGetPrivate(object));
+
+ // TODO: build a QScriptContext and use it in the native call.
+ QScriptContext* scriptContext = 0;
+ Q_UNUSED(context);
+ Q_UNUSED(thisObject);
+ Q_UNUSED(argumentCount);
+ Q_UNUSED(arguments);
+ Q_UNUSED(exception);
+
+ QScriptEnginePrivate* engine = data->engine;
+ QScriptValuePrivate* result = QScriptValuePrivate::get(data->fun(scriptContext, QScriptEnginePrivate::get(engine)));
+ if (!result->isValid()) {
+ qWarning("Invalid value returned from native function, returning undefined value instead.");
+ return engine->makeJSValue(QScriptValue::UndefinedValue);
+ }
+
+ // Make sure that the result will be assigned to the correct engine.
+ if (!result->engine()) {
+ Q_ASSERT(result->isValid());
+ result->assignEngine(engine);
+ } else if (result->engine() != engine) {
+ qWarning("Value from different engine returned from native function, returning undefined value instead.");
+ return engine->makeJSValue(QScriptValue::UndefinedValue);
+ }
+
+ return *result;
+}
+
+JSClassDefinition qt_NativeFunctionClass = {
+ 0, // version
+ kJSClassAttributeNoAutomaticPrototype, // attributes
+
+ "", // className
+ 0, // parentClass
+
+ 0, // staticValues
+ 0, // staticFunctions
+
+ 0, // initialize
+ qt_NativeFunction_finalize, // finalize
+ 0, // hasProperty
+ 0, // getProperty
+ 0, // setProperty
+ 0, // deleteProperty
+ 0, // getPropertyNames
+ qt_NativeFunction_callAsFunction, // callAsFunction
+ 0, // callAsConstructor
+ 0, // hasInstance
+ 0 // convertToType
+};
+
+static void qt_NativeFunctionWithArg_finalize(JSObjectRef object)
+{
+ void* priv = JSObjectGetPrivate(object);
+ delete reinterpret_cast<QNativeFunctionWithArgData*>(priv);
+}
+
+static JSValueRef qt_NativeFunctionWithArg_callAsFunction(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ QNativeFunctionWithArgData* data = reinterpret_cast<QNativeFunctionWithArgData*>(JSObjectGetPrivate(object));
+
+ // TODO: build a QScriptContext and use it in the native call.
+ QScriptContext* scriptContext = 0;
+ Q_UNUSED(context);
+ Q_UNUSED(thisObject);
+ Q_UNUSED(argumentCount);
+ Q_UNUSED(arguments);
+ Q_UNUSED(exception);
+
+ QScriptEnginePrivate* engine = data->engine;
+ QScriptValuePrivate* result = QScriptValuePrivate::get(data->fun(scriptContext, QScriptEnginePrivate::get(engine), data->arg));
+ if (!result->isValid()) {
+ qWarning("Invalid value returned from native function, returning undefined value instead.");
+ return engine->makeJSValue(QScriptValue::UndefinedValue);
+ }
+
+ // Make sure that the result will be assigned to the correct engine.
+ if (!result->engine()) {
+ Q_ASSERT(result->isValid());
+ result->assignEngine(engine);
+ } else if (result->engine() != engine) {
+ qWarning("Value from different engine returned from native function, returning undefined value instead.");
+ return engine->makeJSValue(QScriptValue::UndefinedValue);
+ }
+
+ return *result;
+}
+
+JSClassDefinition qt_NativeFunctionWithArgClass = {
+ 0, // version
+ kJSClassAttributeNoAutomaticPrototype, // attributes
+
+ "", // className
+ 0, // parentClass
+
+ 0, // staticValues
+ 0, // staticFunctions
+
+ 0, // initialize
+ qt_NativeFunctionWithArg_finalize, // finalize
+ 0, // hasProperty
+ 0, // getProperty
+ 0, // setProperty
+ 0, // deleteProperty
+ 0, // getPropertyNames
+ qt_NativeFunctionWithArg_callAsFunction, // callAsFunction
+ 0, // callAsConstructor
+ 0, // hasInstance
+ 0 // convertToType
+};
diff --git a/Source/JavaScriptCore/qt/api/qscriptfunction_p.h b/Source/JavaScriptCore/qt/api/qscriptfunction_p.h
new file mode 100644
index 0000000..65b6046
--- /dev/null
+++ b/Source/JavaScriptCore/qt/api/qscriptfunction_p.h
@@ -0,0 +1,57 @@
+/*
+ Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef qscriptfunction_p_h
+#define qscriptfunction_p_h
+
+#include "config.h"
+
+#include "qscriptengine.h"
+#include "qscriptvalue_p.h"
+
+extern JSClassDefinition qt_NativeFunctionClass;
+extern JSClassDefinition qt_NativeFunctionWithArgClass;
+
+struct QNativeFunctionData
+{
+ QNativeFunctionData(QScriptEnginePrivate* engine, QScriptEngine::FunctionSignature fun)
+ : engine(engine)
+ , fun(fun)
+ {
+ }
+
+ QScriptEnginePrivate* engine;
+ QScriptEngine::FunctionSignature fun;
+};
+
+struct QNativeFunctionWithArgData
+{
+ QNativeFunctionWithArgData(QScriptEnginePrivate* engine, QScriptEngine::FunctionWithArgSignature fun, void* arg)
+ : engine(engine)
+ , fun(fun)
+ , arg(arg)
+ {
+ }
+
+ QScriptEnginePrivate* engine;
+ QScriptEngine::FunctionWithArgSignature fun;
+ void* arg;
+};
+
+#endif
diff --git a/Source/JavaScriptCore/qt/api/qscriptoriginalglobalobject_p.h b/Source/JavaScriptCore/qt/api/qscriptoriginalglobalobject_p.h
new file mode 100644
index 0000000..2bd945f
--- /dev/null
+++ b/Source/JavaScriptCore/qt/api/qscriptoriginalglobalobject_p.h
@@ -0,0 +1,209 @@
+/*
+ Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef qscriptoriginalglobalobject_p_h
+#define qscriptoriginalglobalobject_p_h
+
+#include <JavaScriptCore/JavaScript.h>
+#include <JavaScriptCore/JSRetainPtr.h>
+#include <QtCore/qvector.h>
+
+/*!
+ \internal
+ This class is a workaround for missing JSC C API functionality. This class keeps all important
+ properties of an original (default) global object, so we can use it even if the global object was
+ changed.
+
+ FIXME this class is a container for workarounds :-) it should be replaced by proper JSC C API calls.
+
+ The class have to be created on the QScriptEnginePrivate creation time (before any change got applied to
+ global object).
+*/
+class QScriptOriginalGlobalObject {
+public:
+ inline QScriptOriginalGlobalObject(JSGlobalContextRef context);
+ inline ~QScriptOriginalGlobalObject();
+
+ inline bool objectHasOwnProperty(JSObjectRef object, JSStringRef property) const;
+ inline QVector<JSStringRef> objectGetOwnPropertyNames(JSObjectRef object) const;
+
+ inline bool isDate(JSValueRef value) const;
+ inline bool isArray(JSValueRef value) const;
+ inline bool isError(JSValueRef value) const;
+
+ inline JSValueRef functionPrototype() const;
+private:
+ inline bool isType(JSValueRef value, JSObjectRef constructor, JSValueRef prototype) const;
+ inline void initializeMember(JSObjectRef globalObject, JSStringRef prototypeName, const char* type, JSObjectRef& constructor, JSValueRef& prototype);
+
+ // Copy of the global context reference (the same as in QScriptEnginePrivate).
+ JSGlobalContextRef m_context;
+
+ // Copy of constructors and prototypes used in isType functions.
+ JSObjectRef m_arrayConstructor;
+ JSValueRef m_arrayPrototype;
+ JSObjectRef m_errorConstructor;
+ JSValueRef m_errorPrototype;
+ JSObjectRef m_functionConstructor;
+ JSValueRef m_functionPrototype;
+ JSObjectRef m_dateConstructor;
+ JSValueRef m_datePrototype;
+
+ // Reference to standard JS functions that are not exposed by JSC C API.
+ JSObjectRef m_hasOwnPropertyFunction;
+ JSObjectRef m_getOwnPropertyNamesFunction;
+};
+
+QScriptOriginalGlobalObject::QScriptOriginalGlobalObject(JSGlobalContextRef context)
+ : m_context(JSGlobalContextRetain(context))
+{
+ JSObjectRef globalObject = JSContextGetGlobalObject(m_context);
+ JSValueRef exception = 0;
+ JSRetainPtr<JSStringRef> propertyName;
+
+ propertyName.adopt(JSStringCreateWithUTF8CString("prototype"));
+ initializeMember(globalObject, propertyName.get(), "Array", m_arrayConstructor, m_arrayPrototype);
+ initializeMember(globalObject, propertyName.get(), "Error", m_errorConstructor, m_errorPrototype);
+ initializeMember(globalObject, propertyName.get(), "Function", m_functionConstructor, m_functionPrototype);
+ initializeMember(globalObject, propertyName.get(), "Date", m_dateConstructor, m_datePrototype);
+
+ propertyName.adopt(JSStringCreateWithUTF8CString("hasOwnProperty"));
+ m_hasOwnPropertyFunction = const_cast<JSObjectRef>(JSObjectGetProperty(m_context, globalObject, propertyName.get(), &exception));
+ JSValueProtect(m_context, m_hasOwnPropertyFunction);
+ Q_ASSERT(JSValueIsObject(m_context, m_hasOwnPropertyFunction));
+ Q_ASSERT(JSObjectIsFunction(m_context, m_hasOwnPropertyFunction));
+ Q_ASSERT(!exception);
+
+ propertyName.adopt(JSStringCreateWithUTF8CString("Object"));
+ JSObjectRef objectConstructor
+ = const_cast<JSObjectRef>(JSObjectGetProperty(m_context, globalObject, propertyName.get(), &exception));
+ propertyName.adopt(JSStringCreateWithUTF8CString("getOwnPropertyNames"));
+ m_getOwnPropertyNamesFunction
+ = const_cast<JSObjectRef>(JSObjectGetProperty(m_context, objectConstructor, propertyName.get(), &exception));
+ JSValueProtect(m_context, m_getOwnPropertyNamesFunction);
+ Q_ASSERT(JSValueIsObject(m_context, m_getOwnPropertyNamesFunction));
+ Q_ASSERT(JSObjectIsFunction(m_context, m_getOwnPropertyNamesFunction));
+ Q_ASSERT(!exception);
+}
+
+inline void QScriptOriginalGlobalObject::initializeMember(JSObjectRef globalObject, JSStringRef prototypeName, const char* type, JSObjectRef& constructor, JSValueRef& prototype)
+{
+ JSRetainPtr<JSStringRef> typeName(Adopt, JSStringCreateWithUTF8CString(type));
+ JSValueRef exception = 0;
+
+ // Save references to the Type constructor and prototype.
+ JSValueRef typeConstructor = JSObjectGetProperty(m_context, globalObject, typeName.get(), &exception);
+ Q_ASSERT(JSValueIsObject(m_context, typeConstructor));
+ constructor = JSValueToObject(m_context, typeConstructor, &exception);
+ JSValueProtect(m_context, constructor);
+
+ // Note that this is not the [[Prototype]] internal property (which we could
+ // get via JSObjectGetPrototype), but the Type.prototype, that will be set
+ // as [[Prototype]] of Type instances.
+ prototype = JSObjectGetProperty(m_context, constructor, prototypeName, &exception);
+ Q_ASSERT(JSValueIsObject(m_context, prototype));
+ JSValueProtect(m_context, prototype);
+ Q_ASSERT(!exception);
+}
+
+QScriptOriginalGlobalObject::~QScriptOriginalGlobalObject()
+{
+ JSValueUnprotect(m_context, m_arrayConstructor);
+ JSValueUnprotect(m_context, m_arrayPrototype);
+ JSValueUnprotect(m_context, m_errorConstructor);
+ JSValueUnprotect(m_context, m_errorPrototype);
+ JSValueUnprotect(m_context, m_functionConstructor);
+ JSValueUnprotect(m_context, m_functionPrototype);
+ JSValueUnprotect(m_context, m_dateConstructor);
+ JSValueUnprotect(m_context, m_datePrototype);
+ JSValueUnprotect(m_context, m_hasOwnPropertyFunction);
+ JSValueUnprotect(m_context, m_getOwnPropertyNamesFunction);
+ JSGlobalContextRelease(m_context);
+}
+
+inline bool QScriptOriginalGlobalObject::objectHasOwnProperty(JSObjectRef object, JSStringRef property) const
+{
+ // FIXME This function should be replaced by JSC C API.
+ JSValueRef exception = 0;
+ JSValueRef propertyName[] = { JSValueMakeString(m_context, property) };
+ JSValueRef result = JSObjectCallAsFunction(m_context, m_hasOwnPropertyFunction, object, 1, propertyName, &exception);
+ return exception ? false : JSValueToBoolean(m_context, result);
+}
+
+/*!
+ \internal
+ This method gives ownership of all JSStringRefs.
+*/
+inline QVector<JSStringRef> QScriptOriginalGlobalObject::objectGetOwnPropertyNames(JSObjectRef object) const
+{
+ JSValueRef exception = 0;
+ JSObjectRef propertyNames
+ = const_cast<JSObjectRef>(JSObjectCallAsFunction(m_context,
+ m_getOwnPropertyNamesFunction,
+ /* thisObject */ 0,
+ /* argumentCount */ 1,
+ &object,
+ &exception));
+ Q_ASSERT(JSValueIsObject(m_context, propertyNames));
+ Q_ASSERT(!exception);
+ JSStringRef lengthName = QScriptConverter::toString("length");
+ int count = JSValueToNumber(m_context, JSObjectGetProperty(m_context, propertyNames, lengthName, &exception), &exception);
+
+ Q_ASSERT(!exception);
+ QVector<JSStringRef> names;
+ names.reserve(count);
+ for (int i = 0; i < count; ++i) {
+ JSValueRef tmp = JSObjectGetPropertyAtIndex(m_context, propertyNames, i, &exception);
+ names.append(JSValueToStringCopy(m_context, tmp, &exception));
+ Q_ASSERT(!exception);
+ }
+ return names;
+}
+
+inline bool QScriptOriginalGlobalObject::isDate(JSValueRef value) const
+{
+ return isType(value, m_dateConstructor, m_datePrototype);
+}
+
+inline bool QScriptOriginalGlobalObject::isArray(JSValueRef value) const
+{
+ return isType(value, m_arrayConstructor, m_arrayPrototype);
+}
+
+inline bool QScriptOriginalGlobalObject::isError(JSValueRef value) const
+{
+ return isType(value, m_errorConstructor, m_errorPrototype);
+}
+
+inline JSValueRef QScriptOriginalGlobalObject::functionPrototype() const
+{
+ return m_functionPrototype;
+}
+
+inline bool QScriptOriginalGlobalObject::isType(JSValueRef value, JSObjectRef constructor, JSValueRef prototype) const
+{
+ // JSC API doesn't export the [[Class]] information for the builtins. But we know that a value
+ // is an object of the Type if it was created with the Type constructor or if it is the Type.prototype.
+ JSValueRef exception = 0;
+ bool result = JSValueIsInstanceOfConstructor(m_context, value, constructor, &exception) || JSValueIsStrictEqual(m_context, value, prototype);
+ Q_ASSERT(!exception);
+ return result;
+}
+
+#endif // qscriptoriginalglobalobject_p_h
diff --git a/Source/JavaScriptCore/qt/api/qscriptprogram.cpp b/Source/JavaScriptCore/qt/api/qscriptprogram.cpp
new file mode 100644
index 0000000..d7d4948
--- /dev/null
+++ b/Source/JavaScriptCore/qt/api/qscriptprogram.cpp
@@ -0,0 +1,136 @@
+/*
+ Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include "config.h"
+
+#include "qscriptprogram.h"
+
+#include "qscriptprogram_p.h"
+
+/*!
+ \internal
+
+ \class QScriptProgram
+
+ \brief The QScriptProgram class encapsulates a Qt Script program.
+
+ \ingroup script
+
+ QScriptProgram retains the compiled representation of the script if
+ possible. Thus, QScriptProgram can be used to evaluate the same
+ script multiple times more efficiently.
+
+ \code
+ QScriptEngine engine;
+ QScriptProgram program("1 + 2");
+ QScriptValue result = engine.evaluate(program);
+ \endcode
+*/
+
+/*!
+ Constructs a null QScriptProgram.
+*/
+QScriptProgram::QScriptProgram()
+ : d_ptr(new QScriptProgramPrivate)
+{}
+
+/*!
+ Constructs a new QScriptProgram with the given \a sourceCode, \a
+ fileName and \a firstLineNumber.
+*/
+QScriptProgram::QScriptProgram(const QString& sourceCode,
+ const QString fileName,
+ int firstLineNumber)
+ : d_ptr(new QScriptProgramPrivate(sourceCode, fileName, firstLineNumber))
+{}
+
+/*!
+ Destroys this QScriptProgram.
+*/
+QScriptProgram::~QScriptProgram()
+{}
+
+/*!
+ Constructs a new QScriptProgram that is a copy of \a other.
+*/
+QScriptProgram::QScriptProgram(const QScriptProgram& other)
+{
+ d_ptr = other.d_ptr;
+}
+
+/*!
+ Assigns the \a other value to this QScriptProgram.
+*/
+QScriptProgram& QScriptProgram::operator=(const QScriptProgram& other)
+{
+ d_ptr = other.d_ptr;
+ return *this;
+}
+
+/*!
+ Returns true if this QScriptProgram is null; otherwise
+ returns false.
+*/
+bool QScriptProgram::isNull() const
+{
+ return d_ptr->isNull();
+}
+
+/*!
+ Returns the source code of this program.
+*/
+QString QScriptProgram::sourceCode() const
+{
+ return d_ptr->sourceCode();
+}
+
+/*!
+ Returns the filename associated with this program.
+*/
+QString QScriptProgram::fileName() const
+{
+ return d_ptr->fileName();
+}
+
+/*!
+ Returns the line number associated with this program.
+*/
+int QScriptProgram::firstLineNumber() const
+{
+ return d_ptr->firstLineNumber();
+}
+
+/*!
+ Returns true if this QScriptProgram is equal to \a other;
+ otherwise returns false.
+*/
+bool QScriptProgram::operator==(const QScriptProgram& other) const
+{
+ return d_ptr == other.d_ptr || *d_ptr == *other.d_ptr;
+}
+
+/*!
+ Returns true if this QScriptProgram is not equal to \a other;
+ otherwise returns false.
+*/
+bool QScriptProgram::operator!=(const QScriptProgram& other) const
+{
+ return d_ptr != other.d_ptr && *d_ptr != *other.d_ptr;
+}
+
diff --git a/Source/JavaScriptCore/qt/api/qscriptprogram.h b/Source/JavaScriptCore/qt/api/qscriptprogram.h
new file mode 100644
index 0000000..93c8a3c
--- /dev/null
+++ b/Source/JavaScriptCore/qt/api/qscriptprogram.h
@@ -0,0 +1,53 @@
+/*
+ Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef qscriptprogram_h
+#define qscriptprogram_h
+
+#include "qtscriptglobal.h"
+#include <QtCore/qshareddata.h>
+#include <QtCore/qstring.h>
+
+class QScriptProgramPrivate;
+class Q_JAVASCRIPT_EXPORT QScriptProgram {
+public:
+ QScriptProgram();
+ QScriptProgram(const QString& sourceCode,
+ const QString fileName = QString(),
+ int firstLineNumber = 1);
+ QScriptProgram(const QScriptProgram& other);
+ ~QScriptProgram();
+
+ QScriptProgram& operator=(const QScriptProgram& other);
+
+ bool isNull() const;
+
+ QString sourceCode() const;
+ QString fileName() const;
+ int firstLineNumber() const;
+
+ bool operator==(const QScriptProgram& other) const;
+ bool operator!=(const QScriptProgram& other) const;
+
+private:
+ QExplicitlySharedDataPointer<QScriptProgramPrivate> d_ptr;
+ Q_DECLARE_PRIVATE(QScriptProgram)
+};
+
+#endif // qscriptprogram_h
diff --git a/Source/JavaScriptCore/qt/api/qscriptprogram_p.h b/Source/JavaScriptCore/qt/api/qscriptprogram_p.h
new file mode 100644
index 0000000..f6882c5
--- /dev/null
+++ b/Source/JavaScriptCore/qt/api/qscriptprogram_p.h
@@ -0,0 +1,133 @@
+/*
+ Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef qscriptprogram_p_h
+#define qscriptprogram_p_h
+
+#include "qscriptconverter_p.h"
+#include "qscriptprogram.h"
+#include <JavaScriptCore/JavaScript.h>
+#include <QtCore/qshareddata.h>
+#include <QtCore/qstring.h>
+
+/*
+ FIXME The QScriptProgramPrivate potentially could be much faster. In current implementation we
+ gain CPU time only by avoiding QString -> JSStringRef conversion. In the ideal world we should
+ have a function inside the JSC C API that could provide us "parse once, execute multiple times"
+ functionality.
+*/
+
+class QScriptProgramPrivate : public QSharedData {
+public:
+ inline static QScriptProgramPrivate* get(const QScriptProgram& program);
+ inline QScriptProgramPrivate();
+ inline QScriptProgramPrivate(const QString& sourceCode,
+ const QString fileName,
+ int firstLineNumber);
+
+ inline ~QScriptProgramPrivate();
+
+ inline bool isNull() const;
+
+ inline QString sourceCode() const;
+ inline QString fileName() const;
+ inline int firstLineNumber() const;
+
+ inline bool operator==(const QScriptProgramPrivate& other) const;
+ inline bool operator!=(const QScriptProgramPrivate& other) const;
+
+ inline operator JSStringRef() const;
+ inline JSStringRef file() const;
+ inline int line() const;
+private:
+ JSStringRef m_program;
+ JSStringRef m_fileName;
+ int m_line;
+};
+
+QScriptProgramPrivate* QScriptProgramPrivate::get(const QScriptProgram& program)
+{
+ return const_cast<QScriptProgramPrivate*>(program.d_ptr.constData());
+}
+
+QScriptProgramPrivate::QScriptProgramPrivate()
+ : m_program(0)
+ , m_fileName(0)
+ , m_line(-1)
+{}
+
+QScriptProgramPrivate::QScriptProgramPrivate(const QString& sourceCode,
+ const QString fileName,
+ int firstLineNumber)
+ : m_program(QScriptConverter::toString(sourceCode))
+ , m_fileName(QScriptConverter::toString(fileName))
+ , m_line(firstLineNumber)
+{}
+
+QScriptProgramPrivate::~QScriptProgramPrivate()
+{
+ if (!isNull()) {
+ JSStringRelease(m_program);
+ JSStringRelease(m_fileName);
+ }
+}
+
+bool QScriptProgramPrivate::isNull() const
+{
+ return !m_program;
+}
+
+QString QScriptProgramPrivate::sourceCode() const
+{
+ return QScriptConverter::toString(m_program);
+}
+
+QString QScriptProgramPrivate::fileName() const
+{
+ return QScriptConverter::toString(m_fileName);
+}
+
+int QScriptProgramPrivate::firstLineNumber() const
+{
+ return m_line;
+}
+
+bool QScriptProgramPrivate::operator==(const QScriptProgramPrivate& other) const
+{
+ return m_line == other.m_line
+ && JSStringIsEqual(m_fileName, other.m_fileName)
+ && JSStringIsEqual(m_program, other.m_program);
+}
+
+bool QScriptProgramPrivate::operator!=(const QScriptProgramPrivate& other) const
+{
+ return m_line != other.m_line
+ || !JSStringIsEqual(m_fileName, other.m_fileName)
+ || !JSStringIsEqual(m_program, other.m_program);
+}
+
+QScriptProgramPrivate::operator JSStringRef() const
+{
+ return m_program;
+}
+
+JSStringRef QScriptProgramPrivate::file() const {return m_fileName; }
+int QScriptProgramPrivate::line() const { return m_line; }
+
+#endif // qscriptprogram_p_h
diff --git a/Source/JavaScriptCore/qt/api/qscriptstring.cpp b/Source/JavaScriptCore/qt/api/qscriptstring.cpp
new file mode 100644
index 0000000..83c03c5
--- /dev/null
+++ b/Source/JavaScriptCore/qt/api/qscriptstring.cpp
@@ -0,0 +1,131 @@
+/*
+ Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include "config.h"
+
+#include "qscriptstring.h"
+
+#include "qscriptstring_p.h"
+#include <QtCore/qhash.h>
+
+/*!
+ Constructs an invalid QScriptString.
+*/
+QScriptString::QScriptString()
+ : d_ptr(new QScriptStringPrivate())
+{
+}
+/*!
+ Constructs an QScriptString from internal representation
+ \internal
+*/
+QScriptString::QScriptString(QScriptStringPrivate* d)
+ : d_ptr(d)
+{
+}
+
+/*!
+ Constructs a new QScriptString that is a copy of \a other.
+*/
+QScriptString::QScriptString(const QScriptString& other)
+{
+ d_ptr = other.d_ptr;
+}
+
+/*!
+ Destroys this QScriptString.
+*/
+QScriptString::~QScriptString()
+{
+}
+
+/*!
+ Assigns the \a other value to this QScriptString.
+*/
+QScriptString& QScriptString::operator=(const QScriptString& other)
+{
+ d_ptr = other.d_ptr;
+ return *this;
+}
+
+/*!
+ Returns true if this QScriptString is valid; otherwise
+ returns false.
+*/
+bool QScriptString::isValid() const
+{
+ return d_ptr->isValid();
+}
+
+/*!
+ Returns true if this QScriptString is equal to \a other;
+ otherwise returns false.
+*/
+bool QScriptString::operator==(const QScriptString& other) const
+{
+ return d_ptr == other.d_ptr || *d_ptr == *(other.d_ptr);
+}
+
+/*!
+ Returns true if this QScriptString is not equal to \a other;
+ otherwise returns false.
+*/
+bool QScriptString::operator!=(const QScriptString& other) const
+{
+ return d_ptr != other.d_ptr || *d_ptr != *(other.d_ptr);
+}
+
+/*!
+ Attempts to convert this QScriptString to a QtScript array index,
+ and returns the result.
+
+ If a conversion error occurs, *\a{ok} is set to false; otherwise
+ *\a{ok} is set to true.
+*/
+quint32 QScriptString::toArrayIndex(bool* ok) const
+{
+ return d_ptr->toArrayIndex(ok);
+}
+
+/*!
+ Returns the string that this QScriptString represents, or a
+ null string if this QScriptString is not valid.
+
+ \sa isValid()
+*/
+QString QScriptString::toString() const
+{
+ return d_ptr->toString();
+}
+
+/*!
+ Returns the string that this QScriptString represents, or a
+ null string if this QScriptString is not valid.
+
+ \sa toString()
+*/
+QScriptString::operator QString() const
+{
+ return d_ptr->toString();
+}
+
+uint qHash(const QScriptString& key)
+{
+ return qHash(QScriptStringPrivate::get(key)->id());
+}
diff --git a/Source/JavaScriptCore/qt/api/qscriptstring.h b/Source/JavaScriptCore/qt/api/qscriptstring.h
new file mode 100644
index 0000000..16593bc
--- /dev/null
+++ b/Source/JavaScriptCore/qt/api/qscriptstring.h
@@ -0,0 +1,58 @@
+/*
+ Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef qscriptstring_h
+#define qscriptstring_h
+
+#include "qtscriptglobal.h"
+#include <QtCore/qshareddata.h>
+#include <QtCore/qstring.h>
+
+class QScriptStringPrivate;
+typedef QExplicitlySharedDataPointer<QScriptStringPrivate> QScriptStringPtr;
+
+class Q_JAVASCRIPT_EXPORT QScriptString {
+public:
+ QScriptString();
+ QScriptString(const QScriptString& other);
+ ~QScriptString();
+
+ QScriptString& operator=(const QScriptString& other);
+
+ bool isValid() const;
+
+ bool operator==(const QScriptString& other) const;
+ bool operator!=(const QScriptString& other) const;
+
+ quint32 toArrayIndex(bool* ok = 0) const;
+
+ QString toString() const;
+ operator QString() const;
+
+private:
+ QScriptString(QScriptStringPrivate* d);
+
+ QScriptStringPtr d_ptr;
+
+ friend class QScriptStringPrivate;
+};
+
+uint qHash(const QScriptString& key);
+
+#endif // qscriptstring_h
diff --git a/Source/JavaScriptCore/qt/api/qscriptstring_p.h b/Source/JavaScriptCore/qt/api/qscriptstring_p.h
new file mode 100644
index 0000000..fe84f4d
--- /dev/null
+++ b/Source/JavaScriptCore/qt/api/qscriptstring_p.h
@@ -0,0 +1,124 @@
+/*
+ Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef qscriptstring_p_h
+#define qscriptstring_p_h
+
+#include "qscriptconverter_p.h"
+#include "qscriptstring.h"
+#include <JavaScriptCore/JavaScript.h>
+#include <QtCore/qnumeric.h>
+#include <QtCore/qshareddata.h>
+
+class QScriptStringPrivate : public QSharedData {
+public:
+ inline QScriptStringPrivate();
+ inline QScriptStringPrivate(const QString& qtstring);
+ inline ~QScriptStringPrivate();
+
+ static inline QScriptString get(QScriptStringPrivate* d);
+ static inline QScriptStringPtr get(const QScriptString& p);
+
+ inline bool isValid() const;
+
+ inline bool operator==(const QScriptStringPrivate& other) const;
+ inline bool operator!=(const QScriptStringPrivate& other) const;
+
+ inline quint32 toArrayIndex(bool* ok = 0) const;
+
+ inline QString toString() const;
+
+ inline quint64 id() const;
+
+ inline operator JSStringRef() const;
+
+private:
+ JSStringRef m_string;
+};
+
+
+QScriptStringPrivate::QScriptStringPrivate()
+ : m_string(0)
+{}
+
+QScriptStringPrivate::QScriptStringPrivate(const QString& qtstring)
+ : m_string(QScriptConverter::toString(qtstring))
+{}
+
+QScriptStringPrivate::~QScriptStringPrivate()
+{
+ if (isValid())
+ JSStringRelease(m_string);
+}
+
+QScriptString QScriptStringPrivate::get(QScriptStringPrivate* d)
+{
+ Q_ASSERT(d);
+ return QScriptString(d);
+}
+
+QScriptStringPtr QScriptStringPrivate::get(const QScriptString& p)
+{
+ return p.d_ptr;
+}
+
+bool QScriptStringPrivate::isValid() const
+{
+ return m_string;
+}
+
+bool QScriptStringPrivate::operator==(const QScriptStringPrivate& other) const
+{
+ return isValid() && other.isValid() && JSStringIsEqual(m_string, other.m_string);
+}
+
+bool QScriptStringPrivate::operator!=(const QScriptStringPrivate& other) const
+{
+ return isValid() && other.isValid() && !JSStringIsEqual(m_string, other.m_string);
+}
+
+quint32 QScriptStringPrivate::toArrayIndex(bool* ok) const
+{
+ quint32 idx = QScriptConverter::toArrayIndex(m_string);
+ if (ok)
+ *ok = (idx != 0xffffffff);
+ return idx;
+}
+
+QString QScriptStringPrivate::toString() const
+{
+ return QScriptConverter::toString(m_string);
+}
+
+quint64 QScriptStringPrivate::id() const
+{
+ return reinterpret_cast<quint32>(m_string);
+}
+
+/*!
+ \internal
+ This method should be used for invoking JSC functions.
+ \note This method keeps ownership of an internal JSStringRef.
+*/
+QScriptStringPrivate::operator JSStringRef() const
+{
+ return m_string;
+}
+
+#endif // qscriptstring_p_h
diff --git a/Source/JavaScriptCore/qt/api/qscriptsyntaxcheckresult.cpp b/Source/JavaScriptCore/qt/api/qscriptsyntaxcheckresult.cpp
new file mode 100644
index 0000000..3948c5d
--- /dev/null
+++ b/Source/JavaScriptCore/qt/api/qscriptsyntaxcheckresult.cpp
@@ -0,0 +1,148 @@
+/*
+ Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include "config.h"
+
+#include "qscriptsyntaxcheckresult.h"
+#include "qscriptsyntaxcheckresult_p.h"
+
+/*!
+ \class QScriptSyntaxCheckResult
+
+ \brief The QScriptSyntaxCheckResult class provides the result of a script syntax check.
+
+ \ingroup script
+ \mainclass
+
+ QScriptSyntaxCheckResult is returned by QScriptEngine::checkSyntax() to
+ provide information about the syntactical (in)correctness of a script.
+*/
+
+/*!
+ \enum QScriptSyntaxCheckResult::State
+
+ This enum specifies the state of a syntax check.
+
+ \value Error The program contains a syntax error.
+ \value Intermediate The program is incomplete.
+ \value Valid The program is a syntactically correct Qt Script program.
+*/
+
+/*!
+ Constructs a new QScriptSyntaxCheckResult from the \a other result.
+*/
+QScriptSyntaxCheckResult::QScriptSyntaxCheckResult(const QScriptSyntaxCheckResult& other)
+ : d_ptr(other.d_ptr)
+{}
+
+/*!
+ Constructs a new QScriptSyntaxCheckResult from an internal representation.
+ \internal
+*/
+QScriptSyntaxCheckResult::QScriptSyntaxCheckResult(QScriptSyntaxCheckResultPrivate* d)
+ : d_ptr(d)
+{}
+
+/*!
+ Destroys this QScriptSyntaxCheckResult.
+*/
+QScriptSyntaxCheckResult::~QScriptSyntaxCheckResult()
+{}
+
+/*!
+ Assigns the \a other result to this QScriptSyntaxCheckResult, and returns a
+ reference to this QScriptSyntaxCheckResult.
+*/
+QScriptSyntaxCheckResult& QScriptSyntaxCheckResult::operator=(const QScriptSyntaxCheckResult& other)
+{
+ d_ptr = other.d_ptr;
+ return *this;
+}
+
+/*!
+ Returns the state of this QScriptSyntaxCheckResult.
+*/
+QScriptSyntaxCheckResult::State QScriptSyntaxCheckResult::state() const
+{
+ return d_ptr->state();
+}
+
+/*!
+ Returns the error line number of this QScriptSyntaxCheckResult, or -1 if
+ there is no error.
+
+ \sa state(), errorMessage()
+*/
+int QScriptSyntaxCheckResult::errorLineNumber() const
+{
+ return d_ptr->errorLineNumber();
+}
+
+/*!
+ Returns the error column number of this QScriptSyntaxCheckResult, or -1 if
+ there is no error.
+
+ \sa state(), errorLineNumber()
+*/
+int QScriptSyntaxCheckResult::errorColumnNumber() const
+{
+ return d_ptr->errorColumnNumber();
+}
+
+/*!
+ Returns the error message of this QScriptSyntaxCheckResult, or an empty
+ string if there is no error.
+
+ \sa state(), errorLineNumber()
+*/
+QString QScriptSyntaxCheckResult::errorMessage() const
+{
+ return d_ptr->errorMessage();
+}
+
+QScriptSyntaxCheckResultPrivate::~QScriptSyntaxCheckResultPrivate()
+{
+ if (m_exception)
+ JSValueUnprotect(*m_engine, m_exception);
+}
+
+QString QScriptSyntaxCheckResultPrivate::errorMessage() const
+{
+ if (!m_exception)
+ return QString();
+
+ JSStringRef tmp = JSValueToStringCopy(*m_engine, m_exception, /* exception */ 0);
+ QString message = QScriptConverter::toString(tmp);
+ JSStringRelease(tmp);
+ return message;
+}
+
+int QScriptSyntaxCheckResultPrivate::errorLineNumber() const
+{
+ if (!m_exception)
+ return -1;
+ // m_exception is an instance of the Exception so it has "line" attribute.
+ JSStringRef lineAttrName = QScriptConverter::toString("line");
+ JSValueRef line = JSObjectGetProperty(*m_engine,
+ m_exception,
+ lineAttrName,
+ /* exceptions */0);
+ JSStringRelease(lineAttrName);
+ return JSValueToNumber(*m_engine, line, /* exceptions */0);
+}
diff --git a/Source/JavaScriptCore/qt/api/qscriptsyntaxcheckresult.h b/Source/JavaScriptCore/qt/api/qscriptsyntaxcheckresult.h
new file mode 100644
index 0000000..aa57744
--- /dev/null
+++ b/Source/JavaScriptCore/qt/api/qscriptsyntaxcheckresult.h
@@ -0,0 +1,50 @@
+/*
+ Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef qscriptsyntaxcheckresult_h
+#define qscriptsyntaxcheckresult_h
+
+#include "qtscriptglobal.h"
+#include <QtCore/qshareddata.h>
+
+class QScriptSyntaxCheckResultPrivate;
+class Q_JAVASCRIPT_EXPORT QScriptSyntaxCheckResult {
+public:
+ enum State {
+ Error,
+ Intermediate,
+ Valid
+ };
+
+ QScriptSyntaxCheckResult(const QScriptSyntaxCheckResult& other);
+ ~QScriptSyntaxCheckResult();
+ QScriptSyntaxCheckResult& operator=(const QScriptSyntaxCheckResult& other);
+
+ State state() const;
+ int errorLineNumber() const;
+ int errorColumnNumber() const;
+ QString errorMessage() const;
+
+private:
+ QScriptSyntaxCheckResult(QScriptSyntaxCheckResultPrivate* d);
+ QExplicitlySharedDataPointer<QScriptSyntaxCheckResultPrivate> d_ptr;
+
+ friend class QScriptSyntaxCheckResultPrivate;
+};
+#endif // qscriptsyntaxcheckresult_h
diff --git a/Source/JavaScriptCore/qt/api/qscriptsyntaxcheckresult_p.h b/Source/JavaScriptCore/qt/api/qscriptsyntaxcheckresult_p.h
new file mode 100644
index 0000000..6e1a131
--- /dev/null
+++ b/Source/JavaScriptCore/qt/api/qscriptsyntaxcheckresult_p.h
@@ -0,0 +1,73 @@
+/*
+ Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef qscriptsyntaxcheckresult_p_h
+#define qscriptsyntaxcheckresult_p_h
+
+#include "qscriptconverter_p.h"
+#include "qscriptengine_p.h"
+#include "qscriptsyntaxcheckresult.h"
+#include <JavaScriptCore/JavaScript.h>
+#include <QtCore/qshareddata.h>
+
+class QScriptSyntaxCheckResultPrivate : public QSharedData {
+public:
+ static inline QScriptSyntaxCheckResult get(QScriptSyntaxCheckResultPrivate* p);
+ inline QScriptSyntaxCheckResultPrivate(const QScriptEnginePrivate* engine);
+ inline QScriptSyntaxCheckResultPrivate(const QScriptEnginePrivate* engine, JSObjectRef value);
+ ~QScriptSyntaxCheckResultPrivate();
+
+ inline QScriptSyntaxCheckResult::State state() const;
+ int errorLineNumber() const;
+ inline int errorColumnNumber() const;
+ QString errorMessage() const;
+private:
+ JSObjectRef m_exception;
+ QScriptEnginePtr m_engine;
+};
+
+QScriptSyntaxCheckResult QScriptSyntaxCheckResultPrivate::get(QScriptSyntaxCheckResultPrivate* p)
+{
+ return QScriptSyntaxCheckResult(p);
+}
+
+QScriptSyntaxCheckResultPrivate::QScriptSyntaxCheckResultPrivate(const QScriptEnginePrivate* engine)
+ : m_exception(0)
+ , m_engine(const_cast<QScriptEnginePrivate*>(engine))
+{}
+
+QScriptSyntaxCheckResultPrivate::QScriptSyntaxCheckResultPrivate(const QScriptEnginePrivate* engine, JSObjectRef value)
+ : m_exception(value)
+ , m_engine(const_cast<QScriptEnginePrivate*>(engine))
+{}
+
+QScriptSyntaxCheckResult::State QScriptSyntaxCheckResultPrivate::state() const
+{
+ // FIXME This function doesn't return QScriptSyntaxCheckResult::Intermediate
+ return m_exception ? QScriptSyntaxCheckResult::Error : QScriptSyntaxCheckResult::Valid;
+}
+
+int QScriptSyntaxCheckResultPrivate::errorColumnNumber() const
+{
+ // FIXME JSC C API doesn't expose the error column number.
+ return m_exception ? 1 : -1;
+}
+
+
+#endif // qscriptsyntaxcheckresult_p_h
diff --git a/Source/JavaScriptCore/qt/api/qscriptvalue.cpp b/Source/JavaScriptCore/qt/api/qscriptvalue.cpp
new file mode 100644
index 0000000..8a7a6c4
--- /dev/null
+++ b/Source/JavaScriptCore/qt/api/qscriptvalue.cpp
@@ -0,0 +1,802 @@
+/*
+ Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include "config.h"
+
+#include "qscriptvalue.h"
+
+#include "qscriptengine.h"
+#include "qscriptengine_p.h"
+#include "qscriptvalue_p.h"
+#include <QtCore/qdebug.h>
+
+/*!
+ Constructs an invalid value.
+*/
+QScriptValue::QScriptValue()
+ : d_ptr(new QScriptValuePrivate())
+{
+}
+
+/*!
+ Constructs a new QScriptValue with a boolean \a value.
+*/
+QScriptValue::QScriptValue(bool value)
+ : d_ptr(new QScriptValuePrivate(value))
+{
+}
+
+/*!
+ Constructs a new QScriptValue with a number \a value.
+*/
+QScriptValue::QScriptValue(int value)
+ : d_ptr(new QScriptValuePrivate(value))
+{
+}
+
+/*!
+ Constructs a new QScriptValue with a number \a value.
+*/
+QScriptValue::QScriptValue(uint value)
+ : d_ptr(new QScriptValuePrivate(value))
+{
+}
+
+/*!
+ Constructs a new QScriptValue with a number \a value.
+*/
+QScriptValue::QScriptValue(qsreal value)
+ : d_ptr(new QScriptValuePrivate(value))
+{
+}
+
+/*!
+ Constructs a new QScriptValue with a string \a value.
+*/
+QScriptValue::QScriptValue(const QString& value)
+ : d_ptr(new QScriptValuePrivate(value))
+{
+}
+
+/*!
+ Constructs a new QScriptValue with a special \a value.
+*/
+QScriptValue::QScriptValue(SpecialValue value)
+ : d_ptr(new QScriptValuePrivate(value))
+{
+}
+
+/*!
+ Constructs a new QScriptValue with a string \a value.
+*/
+QScriptValue::QScriptValue(const char* value)
+ : d_ptr(new QScriptValuePrivate(QString::fromUtf8(value)))
+{
+}
+
+/*!
+ Block automatic convertion to bool
+ \internal
+*/
+QScriptValue::QScriptValue(void* d)
+{
+ Q_ASSERT(false);
+}
+
+/*!
+ Constructs a new QScriptValue from private
+ \internal
+*/
+QScriptValue::QScriptValue(QScriptValuePrivate* d)
+ : d_ptr(d)
+{
+}
+
+/*!
+ \obsolete
+
+ Constructs a new QScriptValue with the boolean \a value and
+ registers it with the script \a engine.
+*/
+QScriptValue::QScriptValue(QScriptEngine* engine, bool value)
+{
+ if (engine)
+ d_ptr = new QScriptValuePrivate(QScriptEnginePrivate::get(engine), value);
+ else
+ d_ptr = new QScriptValuePrivate(value);
+}
+
+/*!
+ \obsolete
+
+ Constructs a new QScriptValue with the integer \a value and
+ registers it with the script \a engine.
+*/
+QScriptValue::QScriptValue(QScriptEngine* engine, int value)
+{
+ if (engine)
+ d_ptr = new QScriptValuePrivate(QScriptEnginePrivate::get(engine), value);
+ else
+ d_ptr = new QScriptValuePrivate(value);
+}
+
+/*!
+ \obsolete
+
+ Constructs a new QScriptValue with the unsigned integer \a value and
+ registers it with the script \a engine.
+ */
+QScriptValue::QScriptValue(QScriptEngine* engine, uint value)
+{
+ if (engine)
+ d_ptr = new QScriptValuePrivate(QScriptEnginePrivate::get(engine), value);
+ else
+ d_ptr = new QScriptValuePrivate(value);
+}
+
+/*!
+ \obsolete
+
+ Constructs a new QScriptValue with the qsreal \a value and
+ registers it with the script \a engine.
+*/
+QScriptValue::QScriptValue(QScriptEngine* engine, qsreal value)
+{
+ if (engine)
+ d_ptr = new QScriptValuePrivate(QScriptEnginePrivate::get(engine), value);
+ else
+ d_ptr = new QScriptValuePrivate(value);
+}
+
+/*!
+ \obsolete
+
+ Constructs a new QScriptValue with the string \a value and
+ registers it with the script \a engine.
+*/
+QScriptValue::QScriptValue(QScriptEngine* engine, const QString& value)
+{
+ if (engine)
+ d_ptr = new QScriptValuePrivate(QScriptEnginePrivate::get(engine), value);
+ else
+ d_ptr = new QScriptValuePrivate(value);
+}
+
+/*!
+ \obsolete
+
+ Constructs a new QScriptValue with the string \a value and
+ registers it with the script \a engine.
+*/
+QScriptValue::QScriptValue(QScriptEngine* engine, const char* value)
+{
+ if (engine)
+ d_ptr = new QScriptValuePrivate(QScriptEnginePrivate::get(engine), QString::fromUtf8(value));
+ else
+ d_ptr = new QScriptValuePrivate(QString::fromUtf8(value));
+}
+
+/*!
+ \obsolete
+
+ Constructs a new QScriptValue with the special \a value and
+ registers it with the script \a engine.
+*/
+QScriptValue::QScriptValue(QScriptEngine* engine, SpecialValue value)
+{
+ if (engine)
+ d_ptr = new QScriptValuePrivate(QScriptEnginePrivate::get(engine), value);
+ else
+ d_ptr = new QScriptValuePrivate(value);
+}
+
+/*!
+ Constructs a new QScriptValue that is a copy of \a other.
+
+ Note that if \a other is an object (i.e., isObject() would return
+ true), then only a reference to the underlying object is copied into
+ the new script value (i.e., the object itself is not copied).
+*/
+QScriptValue::QScriptValue(const QScriptValue& other)
+ : d_ptr(other.d_ptr)
+{
+}
+
+/*!
+ Destroys this QScriptValue.
+*/
+QScriptValue::~QScriptValue()
+{
+}
+
+/*!
+ Returns true if this QScriptValue is valid; otherwise returns
+ false.
+*/
+bool QScriptValue::isValid() const
+{
+ return d_ptr->isValid();
+}
+
+/*!
+ Returns true if this QScriptValue is of the primitive type Boolean;
+ otherwise returns false.
+
+ \sa toBool()
+*/
+bool QScriptValue::isBool() const
+{
+ return d_ptr->isBool();
+}
+
+/*!
+ \obsolete
+
+ Use isBool() instead.
+ Returns true if this QScriptValue is of the primitive type Boolean;
+ otherwise returns false.
+*/
+bool QScriptValue::isBoolean() const
+{
+ return d_ptr->isBool();
+}
+
+/*!
+ Returns true if this QScriptValue is of the primitive type Number;
+ otherwise returns false.
+
+ \sa toNumber()
+*/
+bool QScriptValue::isNumber() const
+{
+ return d_ptr->isNumber();
+}
+
+/*!
+ Returns true if this QScriptValue is of the primitive type Null;
+ otherwise returns false.
+
+ \sa QScriptEngine::nullValue()
+*/
+bool QScriptValue::isNull() const
+{
+ return d_ptr->isNull();
+}
+
+/*!
+ Returns true if this QScriptValue is of the primitive type String;
+ otherwise returns false.
+
+ \sa toString()
+*/
+bool QScriptValue::isString() const
+{
+ return d_ptr->isString();
+}
+
+/*!
+ Returns true if this QScriptValue is of the primitive type Undefined;
+ otherwise returns false.
+
+ \sa QScriptEngine::undefinedValue()
+*/
+bool QScriptValue::isUndefined() const
+{
+ return d_ptr->isUndefined();
+}
+
+/*!
+ Returns true if this QScriptValue is an object of the Error class;
+ otherwise returns false.
+
+ \sa QScriptContext::throwError()
+*/
+bool QScriptValue::isError() const
+{
+ return d_ptr->isError();
+}
+
+/*!
+ Returns true if this QScriptValue is an object of the Array class;
+ otherwise returns false.
+
+ \sa QScriptEngine::newArray()
+*/
+bool QScriptValue::isArray() const
+{
+ return d_ptr->isArray();
+}
+
+/*!
+ Returns true if this QScriptValue is an object of the Date class;
+ otherwise returns false.
+
+ \sa QScriptEngine::newDate()
+*/
+bool QScriptValue::isDate() const
+{
+ return d_ptr->isDate();
+}
+
+/*!
+ Returns true if this QScriptValue is of the Object type; otherwise
+ returns false.
+
+ Note that function values, variant values, and QObject values are
+ objects, so this function returns true for such values.
+
+ \sa toObject(), QScriptEngine::newObject()
+*/
+bool QScriptValue::isObject() const
+{
+ return d_ptr->isObject();
+}
+
+/*!
+ Returns true if this QScriptValue is a function; otherwise returns
+ false.
+
+ \sa call()
+*/
+bool QScriptValue::isFunction() const
+{
+ return d_ptr->isFunction();
+}
+
+/*!
+ Returns the string value of this QScriptValue, as defined in
+ \l{ECMA-262} section 9.8, "ToString".
+
+ Note that if this QScriptValue is an object, calling this function
+ has side effects on the script engine, since the engine will call
+ the object's toString() function (and possibly valueOf()) in an
+ attempt to convert the object to a primitive value (possibly
+ resulting in an uncaught script exception).
+
+ \sa isString()
+*/
+QString QScriptValue::toString() const
+{
+ return d_ptr->toString();
+}
+
+/*!
+ Returns the number value of this QScriptValue, as defined in
+ \l{ECMA-262} section 9.3, "ToNumber".
+
+ Note that if this QScriptValue is an object, calling this function
+ has side effects on the script engine, since the engine will call
+ the object's valueOf() function (and possibly toString()) in an
+ attempt to convert the object to a primitive value (possibly
+ resulting in an uncaught script exception).
+
+ \sa isNumber(), toInteger(), toInt32(), toUInt32(), toUInt16()
+*/
+qsreal QScriptValue::toNumber() const
+{
+ return d_ptr->toNumber();
+}
+
+/*!
+ Returns the boolean value of this QScriptValue, using the conversion
+ rules described in \l{ECMA-262} section 9.2, "ToBoolean".
+
+ Note that if this QScriptValue is an object, calling this function
+ has side effects on the script engine, since the engine will call
+ the object's valueOf() function (and possibly toString()) in an
+ attempt to convert the object to a primitive value (possibly
+ resulting in an uncaught script exception).
+
+ \sa isBool()
+*/
+bool QScriptValue::toBool() const
+{
+ return d_ptr->toBool();
+}
+
+/*!
+ \obsolete
+
+ Use toBool() instead.
+*/
+bool QScriptValue::toBoolean() const
+{
+ return d_ptr->toBool();
+}
+
+/*!
+ Returns the integer value of this QScriptValue, using the conversion
+ rules described in \l{ECMA-262} section 9.4, "ToInteger".
+
+ Note that if this QScriptValue is an object, calling this function
+ has side effects on the script engine, since the engine will call
+ the object's valueOf() function (and possibly toString()) in an
+ attempt to convert the object to a primitive value (possibly
+ resulting in an uncaught script exception).
+
+ \sa toNumber()
+*/
+qsreal QScriptValue::toInteger() const
+{
+ return d_ptr->toInteger();
+}
+
+/*!
+ Returns the signed 32-bit integer value of this QScriptValue, using
+ the conversion rules described in \l{ECMA-262} section 9.5, "ToInt32".
+
+ Note that if this QScriptValue is an object, calling this function
+ has side effects on the script engine, since the engine will call
+ the object's valueOf() function (and possibly toString()) in an
+ attempt to convert the object to a primitive value (possibly
+ resulting in an uncaught script exception).
+
+ \sa toNumber(), toUInt32()
+*/
+qint32 QScriptValue::toInt32() const
+{
+ return d_ptr->toInt32();
+}
+
+/*!
+ Returns the unsigned 32-bit integer value of this QScriptValue, using
+ the conversion rules described in \l{ECMA-262} section 9.6, "ToUint32".
+
+ Note that if this QScriptValue is an object, calling this function
+ has side effects on the script engine, since the engine will call
+ the object's valueOf() function (and possibly toString()) in an
+ attempt to convert the object to a primitive value (possibly
+ resulting in an uncaught script exception).
+
+ \sa toNumber(), toInt32()
+*/
+quint32 QScriptValue::toUInt32() const
+{
+ return d_ptr->toUInt32();
+}
+
+/*!
+ Returns the unsigned 16-bit integer value of this QScriptValue, using
+ the conversion rules described in \l{ECMA-262} section 9.7, "ToUint16".
+
+ Note that if this QScriptValue is an object, calling this function
+ has side effects on the script engine, since the engine will call
+ the object's valueOf() function (and possibly toString()) in an
+ attempt to convert the object to a primitive value (possibly
+ resulting in an uncaught script exception).
+
+ \sa toNumber()
+*/
+quint16 QScriptValue::toUInt16() const
+{
+ return d_ptr->toUInt16();
+}
+
+/*!
+ \obsolete
+
+ This function is obsolete; use QScriptEngine::toObject() instead.
+*/
+QScriptValue QScriptValue::toObject() const
+{
+ return QScriptValuePrivate::get(d_ptr->toObject());
+}
+
+/*!
+ Returns a QDateTime representation of this value, in local time.
+ If this QScriptValue is not a date, or the value of the date is
+ NaN (Not-a-Number), an invalid QDateTime is returned.
+
+ \sa isDate()
+*/
+QDateTime QScriptValue::toDateTime() const
+{
+ return d_ptr->toDateTime();
+}
+
+/*!
+ Calls this QScriptValue as a function, using \a thisObject as
+ the `this' object in the function call, and passing \a args
+ as arguments to the function. Returns the value returned from
+ the function.
+
+ If this QScriptValue is not a function, call() does nothing
+ and returns an invalid QScriptValue.
+
+ Note that if \a thisObject is not an object, the global object
+ (see \l{QScriptEngine::globalObject()}) will be used as the
+ `this' object.
+
+ Calling call() can cause an exception to occur in the script engine;
+ in that case, call() returns the value that was thrown (typically an
+ \c{Error} object). You can call
+ QScriptEngine::hasUncaughtException() to determine if an exception
+ occurred.
+
+ \snippet doc/src/snippets/code/src_script_qscriptvalue.cpp 2
+
+ \sa construct()
+*/
+QScriptValue QScriptValue::call(const QScriptValue& thisObject, const QScriptValueList& args)
+{
+ return d_ptr->call(thisObject.d_ptr.data(), args);
+}
+
+/*!
+ Returns the QScriptEngine that created this QScriptValue,
+ or 0 if this QScriptValue is invalid or the value is not
+ associated with a particular engine.
+*/
+QScriptEngine* QScriptValue::engine() const
+{
+ QScriptEnginePrivate* engine = d_ptr->engine();
+ if (engine)
+ return QScriptEnginePrivate::get(engine);
+ return 0;
+}
+
+/*!
+ If this QScriptValue is an object, returns the internal prototype
+ (\c{__proto__} property) of this object; otherwise returns an
+ invalid QScriptValue.
+
+ \sa setPrototype(), isObject()
+*/
+QScriptValue QScriptValue::prototype() const
+{
+ return QScriptValuePrivate::get(d_ptr->prototype());
+}
+
+/*!
+ If this QScriptValue is an object, sets the internal prototype
+ (\c{__proto__} property) of this object to be \a prototype;
+ otherwise does nothing.
+
+ The internal prototype should not be confused with the public
+ property with name "prototype"; the public prototype is usually
+ only set on functions that act as constructors.
+
+ \sa prototype(), isObject()
+*/
+void QScriptValue::setPrototype(const QScriptValue& prototype)
+{
+ d_ptr->setPrototype(QScriptValuePrivate::get(prototype));
+}
+
+/*!
+ Assigns the \a other value to this QScriptValue.
+
+ Note that if \a other is an object (isObject() returns true),
+ only a reference to the underlying object will be assigned;
+ the object itself will not be copied.
+*/
+QScriptValue& QScriptValue::operator=(const QScriptValue& other)
+{
+ d_ptr = other.d_ptr;
+ return *this;
+}
+
+/*!
+ Returns true if this QScriptValue is equal to \a other, otherwise
+ returns false. The comparison follows the behavior described in
+ \l{ECMA-262} section 11.9.3, "The Abstract Equality Comparison
+ Algorithm".
+
+ This function can return true even if the type of this QScriptValue
+ is different from the type of the \a other value; i.e. the
+ comparison is not strict. For example, comparing the number 9 to
+ the string "9" returns true; comparing an undefined value to a null
+ value returns true; comparing a \c{Number} object whose primitive
+ value is 6 to a \c{String} object whose primitive value is "6"
+ returns true; and comparing the number 1 to the boolean value
+ \c{true} returns true. If you want to perform a comparison
+ without such implicit value conversion, use strictlyEquals().
+
+ Note that if this QScriptValue or the \a other value are objects,
+ calling this function has side effects on the script engine, since
+ the engine will call the object's valueOf() function (and possibly
+ toString()) in an attempt to convert the object to a primitive value
+ (possibly resulting in an uncaught script exception).
+
+ \sa strictlyEquals(), lessThan()
+*/
+bool QScriptValue::equals(const QScriptValue& other) const
+{
+ return d_ptr->equals(QScriptValuePrivate::get(other));
+}
+
+/*!
+ Returns true if this QScriptValue is equal to \a other using strict
+ comparison (no conversion), otherwise returns false. The comparison
+ follows the behavior described in \l{ECMA-262} section 11.9.6, "The
+ Strict Equality Comparison Algorithm".
+
+ If the type of this QScriptValue is different from the type of the
+ \a other value, this function returns false. If the types are equal,
+ the result depends on the type, as shown in the following table:
+
+ \table
+ \header \o Type \o Result
+ \row \o Undefined \o true
+ \row \o Null \o true
+ \row \o Boolean \o true if both values are true, false otherwise
+ \row \o Number \o false if either value is NaN (Not-a-Number); true if values are equal, false otherwise
+ \row \o String \o true if both values are exactly the same sequence of characters, false otherwise
+ \row \o Object \o true if both values refer to the same object, false otherwise
+ \endtable
+
+ \sa equals()
+*/
+bool QScriptValue::strictlyEquals(const QScriptValue& other) const
+{
+ return d_ptr->strictlyEquals(QScriptValuePrivate::get(other));
+}
+
+/*!
+ Returns true if this QScriptValue is an instance of
+ \a other; otherwise returns false.
+
+ This QScriptValue is considered to be an instance of \a other if
+ \a other is a function and the value of the \c{prototype}
+ property of \a other is in the prototype chain of this
+ QScriptValue.
+*/
+bool QScriptValue::instanceOf(const QScriptValue& other) const
+{
+ return d_ptr->instanceOf(QScriptValuePrivate::get(other));
+}
+
+/*!
+ Returns the value of this QScriptValue's property with the given \a name,
+ using the given \a mode to resolve the property.
+
+ If no such property exists, an invalid QScriptValue is returned.
+
+ If the property is implemented using a getter function (i.e. has the
+ PropertyGetter flag set), calling property() has side-effects on the
+ script engine, since the getter function will be called (possibly
+ resulting in an uncaught script exception). If an exception
+ occurred, property() returns the value that was thrown (typically
+ an \c{Error} object).
+
+ \sa setProperty(), propertyFlags(), QScriptValueIterator
+*/
+QScriptValue QScriptValue::property(const QString& name, const ResolveFlags& mode) const
+{
+ return QScriptValuePrivate::get(d_ptr->property(name, mode));
+}
+
+/*!
+ \overload
+
+ Returns the value of this QScriptValue's property with the given \a name,
+ using the given \a mode to resolve the property.
+
+ This overload of property() is useful when you need to look up the
+ same property repeatedly, since the lookup can be performed faster
+ when the name is represented as an interned string.
+
+ \sa QScriptEngine::toStringHandle(), setProperty()
+*/
+QScriptValue QScriptValue::property(const QScriptString& name, const ResolveFlags& mode) const
+{
+ return QScriptValuePrivate::get(d_ptr->property(QScriptStringPrivate::get(name).constData(), mode));
+}
+
+/*!
+ \overload
+
+ Returns the property at the given \a arrayIndex, using the given \a
+ mode to resolve the property.
+
+ This function is provided for convenience and performance when
+ working with array objects.
+
+ If this QScriptValue is not an Array object, this function behaves
+ as if property() was called with the string representation of \a
+ arrayIndex.
+*/
+QScriptValue QScriptValue::property(quint32 arrayIndex, const ResolveFlags& mode) const
+{
+ return QScriptValuePrivate::get(d_ptr->property(arrayIndex, mode));
+}
+
+/*!
+ Sets the value of this QScriptValue's property with the given \a name to
+ the given \a value.
+
+ If this QScriptValue is not an object, this function does nothing.
+
+ If this QScriptValue does not already have a property with name \a name,
+ a new property is created; the given \a flags then specify how this
+ property may be accessed by script code.
+
+ If \a value is invalid, the property is removed.
+
+ If the property is implemented using a setter function (i.e. has the
+ PropertySetter flag set), calling setProperty() has side-effects on
+ the script engine, since the setter function will be called with the
+ given \a value as argument (possibly resulting in an uncaught script
+ exception).
+
+ Note that you cannot specify custom getter or setter functions for
+ built-in properties, such as the \c{length} property of Array objects
+ or meta properties of QObject objects.
+
+ \sa property()
+*/
+void QScriptValue::setProperty(const QString& name, const QScriptValue& value, const PropertyFlags& flags)
+{
+ d_ptr->setProperty(name, QScriptValuePrivate::get(value), flags);
+}
+
+/*!
+ \overload
+
+ Sets the property at the given \a arrayIndex to the given \a value.
+
+ This function is provided for convenience and performance when
+ working with array objects.
+
+ If this QScriptValue is not an Array object, this function behaves
+ as if setProperty() was called with the string representation of \a
+ arrayIndex.
+*/
+void QScriptValue::setProperty(quint32 arrayIndex, const QScriptValue& value, const PropertyFlags& flags)
+{
+ d_ptr->setProperty(arrayIndex, QScriptValuePrivate::get(value), flags);
+}
+
+/*!
+ Sets the value of this QScriptValue's property with the given \a
+ name to the given \a value. The given \a flags specify how this
+ property may be accessed by script code.
+
+ This overload of setProperty() is useful when you need to set the
+ same property repeatedly, since the operation can be performed
+ faster when the name is represented as an interned string.
+
+ \sa QScriptEngine::toStringHandle()
+*/
+void QScriptValue::setProperty(const QScriptString& name, const QScriptValue& value, const PropertyFlags& flags)
+{
+ d_ptr->setProperty(QScriptStringPrivate::get(name).constData(), QScriptValuePrivate::get(value), flags);
+}
+
+/*!
+ Returns the flags of the property with the given \a name, using the
+ given \a mode to resolve the property.
+
+ \sa property()
+*/
+QScriptValue::PropertyFlags QScriptValue::propertyFlags(const QString& name, const ResolveFlags& mode) const
+{
+ return d_ptr->propertyFlags(name, mode);
+}
+
+/*!
+ Returns the flags of the property with the given \a name, using the
+ given \a mode to resolve the property.
+
+ \sa property()
+*/
+QScriptValue::PropertyFlags QScriptValue::propertyFlags(const QScriptString& name, const ResolveFlags& mode) const
+{
+ return d_ptr->propertyFlags(QScriptStringPrivate::get(name).constData(), mode);
+}
diff --git a/Source/JavaScriptCore/qt/api/qscriptvalue.h b/Source/JavaScriptCore/qt/api/qscriptvalue.h
new file mode 100644
index 0000000..bd33849
--- /dev/null
+++ b/Source/JavaScriptCore/qt/api/qscriptvalue.h
@@ -0,0 +1,140 @@
+/*
+ Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef qscriptvalue_h
+#define qscriptvalue_h
+
+#include "qscriptstring.h"
+#include <QtCore/qlist.h>
+#include <QtCore/qshareddata.h>
+
+class QScriptEngine;
+class QScriptValuePrivate;
+class QDateTime;
+
+class QScriptValue;
+typedef QList<QScriptValue> QScriptValueList;
+
+typedef double qsreal;
+
+class QScriptValue {
+public:
+ enum ResolveFlag {
+ ResolveLocal = 0x00,
+ ResolvePrototype = 0x01,
+ ResolveScope = 0x02,
+ ResolveFull = ResolvePrototype | ResolveScope
+ };
+ Q_DECLARE_FLAGS(ResolveFlags, ResolveFlag)
+
+ enum PropertyFlag {
+ ReadOnly = 0x00000001,
+ Undeletable = 0x00000002,
+ SkipInEnumeration = 0x00000004,
+ PropertyGetter = 0x00000008,
+ PropertySetter = 0x00000010,
+ QObjectMember = 0x00000020,
+ KeepExistingFlags = 0x00000800,
+ UserRange = 0xff000000 // Users may use these as they see fit.
+ };
+ Q_DECLARE_FLAGS(PropertyFlags, PropertyFlag)
+
+ enum SpecialValue {
+ NullValue,
+ UndefinedValue
+ };
+
+ QScriptValue();
+ QScriptValue(bool value);
+ QScriptValue(int value);
+ QScriptValue(uint value);
+ QScriptValue(qsreal value);
+ QScriptValue(const QString& value);
+ QScriptValue(const char* value);
+ QScriptValue(SpecialValue value);
+ QScriptValue(const QScriptValue& other);
+
+ QScriptValue(QScriptEngine* engine, bool value);
+ QScriptValue(QScriptEngine* engine, int value);
+ QScriptValue(QScriptEngine* engine, uint value);
+ QScriptValue(QScriptEngine* engine, qsreal value);
+ QScriptValue(QScriptEngine* engine, const QString& value);
+ QScriptValue(QScriptEngine* engine, const char* value);
+ QScriptValue(QScriptEngine* engine, SpecialValue value);
+
+ ~QScriptValue();
+
+ QScriptValue& operator=(const QScriptValue& other);
+
+ QScriptValue prototype() const;
+ void setPrototype(const QScriptValue& prototype);
+
+ bool equals(const QScriptValue& other) const;
+ bool strictlyEquals(const QScriptValue& other) const;
+ bool instanceOf(const QScriptValue& other) const;
+
+ QScriptValue property(const QString& name, const ResolveFlags& mode = ResolvePrototype) const;
+ QScriptValue property(const QScriptString& name, const ResolveFlags& mode = ResolvePrototype) const;
+ QScriptValue property(quint32 arrayIndex, const ResolveFlags& mode = ResolvePrototype) const;
+
+ void setProperty(const QString& name, const QScriptValue& value, const PropertyFlags& flags = KeepExistingFlags);
+ void setProperty(quint32 arrayIndex, const QScriptValue& value, const PropertyFlags& flags = KeepExistingFlags);
+ void setProperty(const QScriptString& name, const QScriptValue& value, const PropertyFlags& flags = KeepExistingFlags);
+
+ PropertyFlags propertyFlags(const QString& name, const ResolveFlags& mode = ResolvePrototype) const;
+ PropertyFlags propertyFlags(const QScriptString& name, const ResolveFlags& mode = ResolvePrototype) const;
+
+ QScriptEngine* engine() const;
+
+ bool isValid() const;
+ bool isBool() const;
+ bool isBoolean() const;
+ bool isNumber() const;
+ bool isFunction() const;
+ bool isNull() const;
+ bool isString() const;
+ bool isUndefined() const;
+ bool isObject() const;
+ bool isError() const;
+ bool isArray() const;
+ bool isDate() const;
+
+ QString toString() const;
+ qsreal toNumber() const;
+ bool toBool() const;
+ bool toBoolean() const;
+ qsreal toInteger() const;
+ qint32 toInt32() const;
+ quint32 toUInt32() const;
+ quint16 toUInt16() const;
+ QScriptValue toObject() const;
+ QDateTime toDateTime() const;
+
+ QScriptValue call(const QScriptValue& thisObject = QScriptValue(),
+ const QScriptValueList& args = QScriptValueList());
+private:
+ QScriptValue(void*);
+ QScriptValue(QScriptValuePrivate*);
+
+ QExplicitlySharedDataPointer<QScriptValuePrivate> d_ptr;
+
+ friend class QScriptValuePrivate;
+};
+
+#endif // qscriptvalue_h
diff --git a/Source/JavaScriptCore/qt/api/qscriptvalue_p.h b/Source/JavaScriptCore/qt/api/qscriptvalue_p.h
new file mode 100644
index 0000000..f98a06a
--- /dev/null
+++ b/Source/JavaScriptCore/qt/api/qscriptvalue_p.h
@@ -0,0 +1,1220 @@
+/*
+ Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef qscriptvalue_p_h
+#define qscriptvalue_p_h
+
+#include "qscriptconverter_p.h"
+#include "qscriptengine_p.h"
+#include "qscriptvalue.h"
+#include <JavaScriptCore/JavaScript.h>
+#include <JavaScriptCore/JSRetainPtr.h>
+#include <JSObjectRefPrivate.h>
+#include <QtCore/qdatetime.h>
+#include <QtCore/qmath.h>
+#include <QtCore/qnumeric.h>
+#include <QtCore/qshareddata.h>
+#include <QtCore/qvarlengtharray.h>
+
+class QScriptEngine;
+class QScriptValue;
+
+/*
+ \internal
+ \class QScriptValuePrivate
+
+ Implementation of QScriptValue.
+ The implementation is based on a state machine. The states names are included in
+ QScriptValuePrivate::State. Each method should check for the current state and then perform a
+ correct action.
+
+ State:
+ Invalid -> QSVP is invalid, no assumptions should be made about class members (apart from m_value).
+ CString -> QSVP is created from QString or const char* and no JSC engine has been associated yet.
+ Current value is kept in m_string,
+ CNumber -> QSVP is created from int, uint, double... and no JSC engine has been bind yet. Current
+ value is kept in m_number
+ CBool -> QSVP is created from bool and no JSC engine has been associated yet. Current value is kept
+ in m_bool
+ CNull -> QSVP is null, but a JSC engine hasn't been associated yet.
+ CUndefined -> QSVP is undefined, but a JSC engine hasn't been associated yet.
+ JSValue -> QSVP is associated with engine, but there is no information about real type, the state
+ have really short live cycle. Normally it is created as a function call result.
+ JSPrimitive -> QSVP is associated with engine, and it is sure that it isn't a JavaScript object.
+ JSObject -> QSVP is associated with engine, and it is sure that it is a JavaScript object.
+
+ Each state keep all necessary information to invoke all methods, if not it should be changed to
+ a proper state. Changed state shouldn't be reverted.
+
+ The QScriptValuePrivate use the JSC C API directly. The QSVP type is equal to combination of
+ the JSValueRef and the JSObjectRef, and it could be automatically casted to these types by cast
+ operators.
+*/
+
+class QScriptValuePrivate : public QSharedData {
+public:
+ inline static QScriptValuePrivate* get(const QScriptValue& q);
+ inline static QScriptValue get(const QScriptValuePrivate* d);
+ inline static QScriptValue get(QScriptValuePrivate* d);
+
+ inline ~QScriptValuePrivate();
+
+ inline QScriptValuePrivate();
+ inline QScriptValuePrivate(const QString& string);
+ inline QScriptValuePrivate(bool value);
+ inline QScriptValuePrivate(int number);
+ inline QScriptValuePrivate(uint number);
+ inline QScriptValuePrivate(qsreal number);
+ inline QScriptValuePrivate(QScriptValue::SpecialValue value);
+
+ inline QScriptValuePrivate(const QScriptEnginePrivate* engine, bool value);
+ inline QScriptValuePrivate(const QScriptEnginePrivate* engine, int value);
+ inline QScriptValuePrivate(const QScriptEnginePrivate* engine, uint value);
+ inline QScriptValuePrivate(const QScriptEnginePrivate* engine, qsreal value);
+ inline QScriptValuePrivate(const QScriptEnginePrivate* engine, const QString& value);
+ inline QScriptValuePrivate(const QScriptEnginePrivate* engine, QScriptValue::SpecialValue value);
+
+ inline QScriptValuePrivate(const QScriptEnginePrivate* engine, JSValueRef value);
+ inline QScriptValuePrivate(const QScriptEnginePrivate* engine, JSObjectRef object);
+
+ inline bool isValid() const;
+ inline bool isBool();
+ inline bool isNumber();
+ inline bool isNull();
+ inline bool isString();
+ inline bool isUndefined();
+ inline bool isError();
+ inline bool isObject();
+ inline bool isFunction();
+ inline bool isArray();
+ inline bool isDate();
+
+ inline QString toString() const;
+ inline qsreal toNumber() const;
+ inline bool toBool() const;
+ inline qsreal toInteger() const;
+ inline qint32 toInt32() const;
+ inline quint32 toUInt32() const;
+ inline quint16 toUInt16() const;
+
+ inline QScriptValuePrivate* toObject(QScriptEnginePrivate* engine);
+ inline QScriptValuePrivate* toObject();
+ inline QDateTime toDateTime();
+ inline QScriptValuePrivate* prototype();
+ inline void setPrototype(QScriptValuePrivate* prototype);
+
+ inline bool equals(QScriptValuePrivate* other);
+ inline bool strictlyEquals(QScriptValuePrivate* other);
+ inline bool instanceOf(QScriptValuePrivate* other);
+ inline bool assignEngine(QScriptEnginePrivate* engine);
+
+ inline QScriptValuePrivate* property(const QString& name, const QScriptValue::ResolveFlags& mode);
+ inline QScriptValuePrivate* property(const QScriptStringPrivate* name, const QScriptValue::ResolveFlags& mode);
+ inline QScriptValuePrivate* property(quint32 arrayIndex, const QScriptValue::ResolveFlags& mode);
+ inline JSValueRef property(quint32 property, JSValueRef* exception);
+ inline JSValueRef property(JSStringRef property, JSValueRef* exception);
+ inline bool hasOwnProperty(quint32 property);
+ inline bool hasOwnProperty(JSStringRef property);
+ template<typename T>
+ inline QScriptValuePrivate* property(T name, const QScriptValue::ResolveFlags& mode);
+
+ inline void setProperty(const QString& name, QScriptValuePrivate* value, const QScriptValue::PropertyFlags& flags);
+ inline void setProperty(const QScriptStringPrivate* name, QScriptValuePrivate* value, const QScriptValue::PropertyFlags& flags);
+ inline void setProperty(const quint32 indexArray, QScriptValuePrivate* value, const QScriptValue::PropertyFlags& flags);
+ inline void setProperty(quint32 property, JSValueRef value, JSPropertyAttributes flags, JSValueRef* exception);
+ inline void setProperty(JSStringRef property, JSValueRef value, JSPropertyAttributes flags, JSValueRef* exception);
+ inline void deleteProperty(quint32 property, JSValueRef* exception);
+ inline void deleteProperty(JSStringRef property, JSValueRef* exception);
+ template<typename T>
+ inline void setProperty(T name, QScriptValuePrivate* value, const QScriptValue::PropertyFlags& flags);
+
+ QScriptValue::PropertyFlags propertyFlags(const QString& name, const QScriptValue::ResolveFlags& mode);
+ QScriptValue::PropertyFlags propertyFlags(const QScriptStringPrivate* name, const QScriptValue::ResolveFlags& mode);
+ QScriptValue::PropertyFlags propertyFlags(const JSStringRef name, const QScriptValue::ResolveFlags& mode);
+
+ inline QScriptValuePrivate* call(const QScriptValuePrivate* , const QScriptValueList& args);
+
+ inline operator JSValueRef() const;
+ inline operator JSObjectRef() const;
+
+ inline QScriptEnginePrivate* engine() const;
+
+private:
+ // Please, update class documentation when you change the enum.
+ enum State {
+ Invalid = 0,
+ CString = 0x1000,
+ CNumber,
+ CBool,
+ CNull,
+ CUndefined,
+ JSValue = 0x2000, // JS values are equal or higher then this value.
+ JSPrimitive,
+ JSObject
+ } m_state;
+ QScriptEnginePtr m_engine;
+ union Value
+ {
+ bool m_bool;
+ qsreal m_number;
+ JSValueRef m_value;
+ JSObjectRef m_object;
+ QString* m_string;
+
+ Value() : m_number(0) {}
+ Value(bool value) : m_bool(value) {}
+ Value(int number) : m_number(number) {}
+ Value(uint number) : m_number(number) {}
+ Value(qsreal number) : m_number(number) {}
+ Value(JSValueRef value) : m_value(value) {}
+ Value(JSObjectRef object) : m_object(object) {}
+ Value(QString* string) : m_string(string) {}
+ } u;
+
+ inline State refinedJSValue();
+
+ inline bool isJSBased() const;
+ inline bool isNumberBased() const;
+ inline bool isStringBased() const;
+};
+
+QScriptValuePrivate* QScriptValuePrivate::get(const QScriptValue& q) { return q.d_ptr.data(); }
+
+QScriptValue QScriptValuePrivate::get(const QScriptValuePrivate* d)
+{
+ return QScriptValue(const_cast<QScriptValuePrivate*>(d));
+}
+
+QScriptValue QScriptValuePrivate::get(QScriptValuePrivate* d)
+{
+ return QScriptValue(d);
+}
+
+QScriptValuePrivate::~QScriptValuePrivate()
+{
+ if (isJSBased())
+ JSValueUnprotect(*m_engine, u.m_value);
+ else if (isStringBased())
+ delete u.m_string;
+}
+
+QScriptValuePrivate::QScriptValuePrivate()
+ : m_state(Invalid)
+{
+}
+
+QScriptValuePrivate::QScriptValuePrivate(const QString& string)
+ : m_state(CString)
+ , u(new QString(string))
+{
+}
+
+QScriptValuePrivate::QScriptValuePrivate(bool value)
+ : m_state(CBool)
+ , u(value)
+{
+}
+
+QScriptValuePrivate::QScriptValuePrivate(int number)
+ : m_state(CNumber)
+ , u(number)
+{
+}
+
+QScriptValuePrivate::QScriptValuePrivate(uint number)
+ : m_state(CNumber)
+ , u(number)
+{
+}
+
+QScriptValuePrivate::QScriptValuePrivate(qsreal number)
+ : m_state(CNumber)
+ , u(number)
+{
+}
+
+QScriptValuePrivate::QScriptValuePrivate(QScriptValue::SpecialValue value)
+ : m_state(value == QScriptValue::NullValue ? CNull : CUndefined)
+{
+}
+
+QScriptValuePrivate::QScriptValuePrivate(const QScriptEnginePrivate* engine, bool value)
+ : m_state(JSPrimitive)
+ , m_engine(const_cast<QScriptEnginePrivate*>(engine))
+ , u(engine->makeJSValue(value))
+{
+ Q_ASSERT(engine);
+ JSValueProtect(*m_engine, u.m_value);
+}
+
+QScriptValuePrivate::QScriptValuePrivate(const QScriptEnginePrivate* engine, int value)
+ : m_state(JSPrimitive)
+ , m_engine(const_cast<QScriptEnginePrivate*>(engine))
+ , u(m_engine->makeJSValue(value))
+{
+ Q_ASSERT(engine);
+ JSValueProtect(*m_engine, u.m_value);
+}
+
+QScriptValuePrivate::QScriptValuePrivate(const QScriptEnginePrivate* engine, uint value)
+ : m_state(JSPrimitive)
+ , m_engine(const_cast<QScriptEnginePrivate*>(engine))
+ , u(m_engine->makeJSValue(value))
+{
+ Q_ASSERT(engine);
+ JSValueProtect(*m_engine, u.m_value);
+}
+
+QScriptValuePrivate::QScriptValuePrivate(const QScriptEnginePrivate* engine, qsreal value)
+ : m_state(JSPrimitive)
+ , m_engine(const_cast<QScriptEnginePrivate*>(engine))
+ , u(m_engine->makeJSValue(value))
+{
+ Q_ASSERT(engine);
+ JSValueProtect(*m_engine, u.m_value);
+}
+
+QScriptValuePrivate::QScriptValuePrivate(const QScriptEnginePrivate* engine, const QString& value)
+ : m_state(JSPrimitive)
+ , m_engine(const_cast<QScriptEnginePrivate*>(engine))
+ , u(m_engine->makeJSValue(value))
+{
+ Q_ASSERT(engine);
+ JSValueProtect(*m_engine, u.m_value);
+}
+
+QScriptValuePrivate::QScriptValuePrivate(const QScriptEnginePrivate* engine, QScriptValue::SpecialValue value)
+ : m_state(JSPrimitive)
+ , m_engine(const_cast<QScriptEnginePrivate*>(engine))
+ , u(m_engine->makeJSValue(value))
+{
+ Q_ASSERT(engine);
+ JSValueProtect(*m_engine, u.m_value);
+}
+
+QScriptValuePrivate::QScriptValuePrivate(const QScriptEnginePrivate* engine, JSValueRef value)
+ : m_state(JSValue)
+ , m_engine(const_cast<QScriptEnginePrivate*>(engine))
+ , u(value)
+{
+ Q_ASSERT(engine);
+ Q_ASSERT(value);
+ JSValueProtect(*m_engine, u.m_value);
+}
+
+QScriptValuePrivate::QScriptValuePrivate(const QScriptEnginePrivate* engine, JSObjectRef object)
+ : m_state(JSObject)
+ , m_engine(const_cast<QScriptEnginePrivate*>(engine))
+ , u(object)
+{
+ Q_ASSERT(engine);
+ Q_ASSERT(object);
+ JSValueProtect(*m_engine, object);
+}
+
+bool QScriptValuePrivate::isValid() const { return m_state != Invalid; }
+
+bool QScriptValuePrivate::isBool()
+{
+ switch (m_state) {
+ case CBool:
+ return true;
+ case JSValue:
+ if (refinedJSValue() != JSPrimitive)
+ return false;
+ // Fall-through.
+ case JSPrimitive:
+ return JSValueIsBoolean(*m_engine, *this);
+ default:
+ return false;
+ }
+}
+
+bool QScriptValuePrivate::isNumber()
+{
+ switch (m_state) {
+ case CNumber:
+ return true;
+ case JSValue:
+ if (refinedJSValue() != JSPrimitive)
+ return false;
+ // Fall-through.
+ case JSPrimitive:
+ return JSValueIsNumber(*m_engine, *this);
+ default:
+ return false;
+ }
+}
+
+bool QScriptValuePrivate::isNull()
+{
+ switch (m_state) {
+ case CNull:
+ return true;
+ case JSValue:
+ if (refinedJSValue() != JSPrimitive)
+ return false;
+ // Fall-through.
+ case JSPrimitive:
+ return JSValueIsNull(*m_engine, *this);
+ default:
+ return false;
+ }
+}
+
+bool QScriptValuePrivate::isString()
+{
+ switch (m_state) {
+ case CString:
+ return true;
+ case JSValue:
+ if (refinedJSValue() != JSPrimitive)
+ return false;
+ // Fall-through.
+ case JSPrimitive:
+ return JSValueIsString(*m_engine, *this);
+ default:
+ return false;
+ }
+}
+
+bool QScriptValuePrivate::isUndefined()
+{
+ switch (m_state) {
+ case CUndefined:
+ return true;
+ case JSValue:
+ if (refinedJSValue() != JSPrimitive)
+ return false;
+ // Fall-through.
+ case JSPrimitive:
+ return JSValueIsUndefined(*m_engine, *this);
+ default:
+ return false;
+ }
+}
+
+bool QScriptValuePrivate::isError()
+{
+ switch (m_state) {
+ case JSValue:
+ if (refinedJSValue() != JSObject)
+ return false;
+ // Fall-through.
+ case JSObject:
+ return m_engine->isError(*this);
+ default:
+ return false;
+ }
+}
+
+bool QScriptValuePrivate::isObject()
+{
+ switch (m_state) {
+ case JSValue:
+ return refinedJSValue() == JSObject;
+ case JSObject:
+ return true;
+
+ default:
+ return false;
+ }
+}
+
+bool QScriptValuePrivate::isFunction()
+{
+ switch (m_state) {
+ case JSValue:
+ if (refinedJSValue() != JSObject)
+ return false;
+ // Fall-through.
+ case JSObject:
+ return JSObjectIsFunction(*m_engine, *this);
+ default:
+ return false;
+ }
+}
+
+bool QScriptValuePrivate::isArray()
+{
+ switch (m_state) {
+ case JSValue:
+ if (refinedJSValue() != JSObject)
+ return false;
+ // Fall-through.
+ case JSObject:
+ return m_engine->isArray(*this);
+ default:
+ return false;
+ }
+}
+
+bool QScriptValuePrivate::isDate()
+{
+ switch (m_state) {
+ case JSValue:
+ if (refinedJSValue() != JSObject)
+ return false;
+ // Fall-through.
+ case JSObject:
+ return m_engine->isDate(*this);
+ default:
+ return false;
+ }
+}
+
+QString QScriptValuePrivate::toString() const
+{
+ switch (m_state) {
+ case Invalid:
+ return QString();
+ case CBool:
+ return u.m_bool ? QString::fromLatin1("true") : QString::fromLatin1("false");
+ case CString:
+ return *u.m_string;
+ case CNumber:
+ return QScriptConverter::toString(u.m_number);
+ case CNull:
+ return QString::fromLatin1("null");
+ case CUndefined:
+ return QString::fromLatin1("undefined");
+ case JSValue:
+ case JSPrimitive:
+ case JSObject:
+ JSValueRef exception = 0;
+ JSRetainPtr<JSStringRef> ptr(Adopt, JSValueToStringCopy(*m_engine, *this, &exception));
+ m_engine->setException(exception);
+ return QScriptConverter::toString(ptr.get());
+ }
+
+ Q_ASSERT_X(false, "toString()", "Not all states are included in the previous switch statement.");
+ return QString(); // Avoid compiler warning.
+}
+
+qsreal QScriptValuePrivate::toNumber() const
+{
+ switch (m_state) {
+ case JSValue:
+ case JSPrimitive:
+ case JSObject:
+ {
+ JSValueRef exception = 0;
+ qsreal result = JSValueToNumber(*m_engine, *this, &exception);
+ m_engine->setException(exception);
+ return result;
+ }
+ case CNumber:
+ return u.m_number;
+ case CBool:
+ return u.m_bool ? 1 : 0;
+ case CNull:
+ case Invalid:
+ return 0;
+ case CUndefined:
+ return qQNaN();
+ case CString:
+ bool ok;
+ qsreal result = u.m_string->toDouble(&ok);
+ if (ok)
+ return result;
+ result = u.m_string->toInt(&ok, 0); // Try other bases.
+ if (ok)
+ return result;
+ if (*u.m_string == "Infinity" || *u.m_string == "-Infinity")
+ return qInf();
+ return u.m_string->length() ? qQNaN() : 0;
+ }
+
+ Q_ASSERT_X(false, "toNumber()", "Not all states are included in the previous switch statement.");
+ return 0; // Avoid compiler warning.
+}
+
+bool QScriptValuePrivate::toBool() const
+{
+ switch (m_state) {
+ case JSValue:
+ case JSPrimitive:
+ return JSValueToBoolean(*m_engine, *this);
+ case JSObject:
+ return true;
+ case CNumber:
+ return !(qIsNaN(u.m_number) || !u.m_number);
+ case CBool:
+ return u.m_bool;
+ case Invalid:
+ case CNull:
+ case CUndefined:
+ return false;
+ case CString:
+ return u.m_string->length();
+ }
+
+ Q_ASSERT_X(false, "toBool()", "Not all states are included in the previous switch statement.");
+ return false; // Avoid compiler warning.
+}
+
+qsreal QScriptValuePrivate::toInteger() const
+{
+ qsreal result = toNumber();
+ if (qIsNaN(result))
+ return 0;
+ if (qIsInf(result))
+ return result;
+ return (result > 0) ? qFloor(result) : -1 * qFloor(-result);
+}
+
+qint32 QScriptValuePrivate::toInt32() const
+{
+ qsreal result = toInteger();
+ // Orginaly it should look like that (result == 0 || qIsInf(result) || qIsNaN(result)), but
+ // some of these operation are invoked in toInteger subcall.
+ if (qIsInf(result))
+ return 0;
+ return result;
+}
+
+quint32 QScriptValuePrivate::toUInt32() const
+{
+ qsreal result = toInteger();
+ // Orginaly it should look like that (result == 0 || qIsInf(result) || qIsNaN(result)), but
+ // some of these operation are invoked in toInteger subcall.
+ if (qIsInf(result))
+ return 0;
+ return result;
+}
+
+quint16 QScriptValuePrivate::toUInt16() const
+{
+ return toInt32();
+}
+
+/*!
+ Creates a copy of this value and converts it to an object. If this value is an object
+ then pointer to this value will be returned.
+ \attention it should not happen but if this value is bounded to a different engine that the given, the first
+ one will be used.
+ \internal
+ */
+QScriptValuePrivate* QScriptValuePrivate::toObject(QScriptEnginePrivate* engine)
+{
+ switch (m_state) {
+ case Invalid:
+ case CNull:
+ case CUndefined:
+ return new QScriptValuePrivate;
+ case CString:
+ {
+ // Exception can't occur here.
+ JSObjectRef object = JSValueToObject(*engine, engine->makeJSValue(*u.m_string), /* exception */ 0);
+ Q_ASSERT(object);
+ return new QScriptValuePrivate(engine, object);
+ }
+ case CNumber:
+ {
+ // Exception can't occur here.
+ JSObjectRef object = JSValueToObject(*engine, engine->makeJSValue(u.m_number), /* exception */ 0);
+ Q_ASSERT(object);
+ return new QScriptValuePrivate(engine, object);
+ }
+ case CBool:
+ {
+ // Exception can't occure here.
+ JSObjectRef object = JSValueToObject(*engine, engine->makeJSValue(u.m_bool), /* exception */ 0);
+ Q_ASSERT(object);
+ return new QScriptValuePrivate(engine, object);
+ }
+ case JSValue:
+ if (refinedJSValue() != JSPrimitive)
+ break;
+ // Fall-through.
+ case JSPrimitive:
+ {
+ if (engine != this->engine())
+ qWarning("QScriptEngine::toObject: cannot convert value created in a different engine");
+ JSValueRef exception = 0;
+ JSObjectRef object = JSValueToObject(*m_engine, *this, &exception);
+ if (object)
+ return new QScriptValuePrivate(m_engine.constData(), object);
+ else
+ m_engine->setException(exception, QScriptEnginePrivate::NotNullException);
+
+ }
+ return new QScriptValuePrivate;
+ case JSObject:
+ break;
+ }
+
+ if (engine != this->engine())
+ qWarning("QScriptEngine::toObject: cannot convert value created in a different engine");
+ Q_ASSERT(m_state == JSObject);
+ return this;
+}
+
+/*!
+ This method is created only for QScriptValue::toObject() purpose which is obsolete.
+ \internal
+ */
+QScriptValuePrivate* QScriptValuePrivate::toObject()
+{
+ if (isJSBased())
+ return toObject(m_engine.data());
+
+ // Without an engine there is not much we can do.
+ return new QScriptValuePrivate;
+}
+
+QDateTime QScriptValuePrivate::toDateTime()
+{
+ if (!isDate())
+ return QDateTime();
+
+ JSValueRef exception = 0;
+ qsreal t = JSValueToNumber(*m_engine, *this, &exception);
+
+ if (exception) {
+ m_engine->setException(exception, QScriptEnginePrivate::NotNullException);
+ return QDateTime();
+ }
+
+ QDateTime result;
+ result.setMSecsSinceEpoch(qint64(t));
+ return result;
+}
+
+inline QScriptValuePrivate* QScriptValuePrivate::prototype()
+{
+ if (isObject()) {
+ JSValueRef prototype = JSObjectGetPrototype(*m_engine, *this);
+ if (JSValueIsNull(*m_engine, prototype))
+ return new QScriptValuePrivate(engine(), prototype);
+ // The prototype could be either a null or a JSObject, so it is safe to cast the prototype
+ // to the JSObjectRef here.
+ return new QScriptValuePrivate(engine(), const_cast<JSObjectRef>(prototype));
+ }
+ return new QScriptValuePrivate;
+}
+
+inline void QScriptValuePrivate::setPrototype(QScriptValuePrivate* prototype)
+{
+ if (isObject() && prototype->isValid() && (prototype->isObject() || prototype->isNull())) {
+ if (engine() != prototype->engine()) {
+ qWarning("QScriptValue::setPrototype() failed: cannot set a prototype created in a different engine");
+ return;
+ }
+ // FIXME: This could be replaced by a new, faster API
+ // look at https://bugs.webkit.org/show_bug.cgi?id=40060
+ JSObjectSetPrototype(*m_engine, *this, *prototype);
+ JSValueRef proto = JSObjectGetPrototype(*m_engine, *this);
+ if (!JSValueIsStrictEqual(*m_engine, proto, *prototype))
+ qWarning("QScriptValue::setPrototype() failed: cyclic prototype value");
+ }
+}
+
+bool QScriptValuePrivate::equals(QScriptValuePrivate* other)
+{
+ if (!isValid())
+ return !other->isValid();
+
+ if (!other->isValid())
+ return false;
+
+ if (!isJSBased() && !other->isJSBased()) {
+ switch (m_state) {
+ case CNull:
+ case CUndefined:
+ return other->isUndefined() || other->isNull();
+ case CNumber:
+ switch (other->m_state) {
+ case CBool:
+ case CString:
+ return u.m_number == other->toNumber();
+ case CNumber:
+ return u.m_number == other->u.m_number;
+ default:
+ return false;
+ }
+ case CBool:
+ switch (other->m_state) {
+ case CBool:
+ return u.m_bool == other->u.m_bool;
+ case CNumber:
+ return toNumber() == other->u.m_number;
+ case CString:
+ return toNumber() == other->toNumber();
+ default:
+ return false;
+ }
+ case CString:
+ switch (other->m_state) {
+ case CBool:
+ return toNumber() == other->toNumber();
+ case CNumber:
+ return toNumber() == other->u.m_number;
+ case CString:
+ return *u.m_string == *other->u.m_string;
+ default:
+ return false;
+ }
+ default:
+ Q_ASSERT_X(false, "equals()", "Not all states are included in the previous switch statement.");
+ }
+ }
+
+ if (isJSBased() && !other->isJSBased()) {
+ if (!other->assignEngine(engine())) {
+ qWarning("equals(): Cannot compare to a value created in a different engine");
+ return false;
+ }
+ } else if (!isJSBased() && other->isJSBased()) {
+ if (!assignEngine(other->engine())) {
+ qWarning("equals(): Cannot compare to a value created in a different engine");
+ return false;
+ }
+ }
+
+ JSValueRef exception = 0;
+ bool result = JSValueIsEqual(*m_engine, *this, *other, &exception);
+ m_engine->setException(exception);
+ return result;
+}
+
+bool QScriptValuePrivate::strictlyEquals(QScriptValuePrivate* other)
+{
+ if (isJSBased()) {
+ // We can't compare these two values without binding to the same engine.
+ if (!other->isJSBased()) {
+ if (other->assignEngine(engine()))
+ return JSValueIsStrictEqual(*m_engine, *this, *other);
+ return false;
+ }
+ if (other->engine() != engine()) {
+ qWarning("strictlyEquals(): Cannot compare to a value created in a different engine");
+ return false;
+ }
+ return JSValueIsStrictEqual(*m_engine, *this, *other);
+ }
+ if (isStringBased()) {
+ if (other->isStringBased())
+ return *u.m_string == *(other->u.m_string);
+ if (other->isJSBased()) {
+ assignEngine(other->engine());
+ return JSValueIsStrictEqual(*m_engine, *this, *other);
+ }
+ }
+ if (isNumberBased()) {
+ if (other->isNumberBased())
+ return u.m_number == other->u.m_number;
+ if (other->isJSBased()) {
+ assignEngine(other->engine());
+ return JSValueIsStrictEqual(*m_engine, *this, *other);
+ }
+ }
+ if (!isValid() && !other->isValid())
+ return true;
+
+ return false;
+}
+
+inline bool QScriptValuePrivate::instanceOf(QScriptValuePrivate* other)
+{
+ if (!isJSBased() || !other->isObject())
+ return false;
+ JSValueRef exception = 0;
+ bool result = JSValueIsInstanceOfConstructor(*m_engine, *this, *other, &exception);
+ m_engine->setException(exception);
+ return result;
+}
+
+/*!
+ Tries to assign \a engine to this value. Returns true on success; otherwise returns false.
+*/
+bool QScriptValuePrivate::assignEngine(QScriptEnginePrivate* engine)
+{
+ Q_ASSERT(engine);
+ JSValueRef value;
+ switch (m_state) {
+ case CBool:
+ value = engine->makeJSValue(u.m_bool);
+ break;
+ case CString:
+ value = engine->makeJSValue(*u.m_string);
+ delete u.m_string;
+ break;
+ case CNumber:
+ value = engine->makeJSValue(u.m_number);
+ break;
+ case CNull:
+ value = engine->makeJSValue(QScriptValue::NullValue);
+ break;
+ case CUndefined:
+ value = engine->makeJSValue(QScriptValue::UndefinedValue);
+ break;
+ default:
+ if (!isJSBased())
+ Q_ASSERT_X(!isJSBased(), "assignEngine()", "Not all states are included in the previous switch statement.");
+ else
+ qWarning("JSValue can't be rassigned to an another engine.");
+ return false;
+ }
+ m_engine = engine;
+ m_state = JSPrimitive;
+ u.m_value = value;
+ JSValueProtect(*m_engine, value);
+ return true;
+}
+
+inline QScriptValuePrivate* QScriptValuePrivate::property(const QString& name, const QScriptValue::ResolveFlags& mode)
+{
+ JSRetainPtr<JSStringRef> propertyName(Adopt, QScriptConverter::toString(name));
+ return property<JSStringRef>(propertyName.get(), mode);
+}
+
+inline QScriptValuePrivate* QScriptValuePrivate::property(const QScriptStringPrivate* name, const QScriptValue::ResolveFlags& mode)
+{
+ return property<JSStringRef>(*name, mode);
+}
+
+inline QScriptValuePrivate* QScriptValuePrivate::property(quint32 arrayIndex, const QScriptValue::ResolveFlags& mode)
+{
+ return property<quint32>(arrayIndex, mode);
+}
+
+/*!
+ \internal
+ This method was created to unify access to the JSObjectGetPropertyAtIndex and the JSObjectGetProperty.
+*/
+inline JSValueRef QScriptValuePrivate::property(quint32 property, JSValueRef* exception)
+{
+ return JSObjectGetPropertyAtIndex(*m_engine, *this, property, exception);
+}
+
+/*!
+ \internal
+ This method was created to unify access to the JSObjectGetPropertyAtIndex and the JSObjectGetProperty.
+*/
+inline JSValueRef QScriptValuePrivate::property(JSStringRef property, JSValueRef* exception)
+{
+ return JSObjectGetProperty(*m_engine, *this, property, exception);
+}
+
+/*!
+ \internal
+ This method was created to unify acccess to hasOwnProperty, same function for an array index
+ and a property name access.
+*/
+inline bool QScriptValuePrivate::hasOwnProperty(quint32 property)
+{
+ Q_ASSERT(isObject());
+ // FIXME it could be faster, but JSC C API doesn't expose needed functionality.
+ JSRetainPtr<JSStringRef> propertyName(Adopt, QScriptConverter::toString(QString::number(property)));
+ return hasOwnProperty(propertyName.get());
+}
+
+/*!
+ \internal
+ This method was created to unify acccess to hasOwnProperty, same function for an array index
+ and a property name access.
+*/
+inline bool QScriptValuePrivate::hasOwnProperty(JSStringRef property)
+{
+ Q_ASSERT(isObject());
+ return m_engine->objectHasOwnProperty(*this, property);
+}
+
+/*!
+ \internal
+ This function gets property of an object.
+ \arg propertyName could be type of quint32 (an array index) or JSStringRef (a property name).
+*/
+template<typename T>
+inline QScriptValuePrivate* QScriptValuePrivate::property(T propertyName, const QScriptValue::ResolveFlags& mode)
+{
+ if (!isObject())
+ return new QScriptValuePrivate();
+
+ if ((mode == QScriptValue::ResolveLocal) && (!hasOwnProperty(propertyName)))
+ return new QScriptValuePrivate();
+
+ JSValueRef exception = 0;
+ JSValueRef value = property(propertyName, &exception);
+
+ if (exception) {
+ m_engine->setException(exception, QScriptEnginePrivate::NotNullException);
+ return new QScriptValuePrivate(engine(), exception);
+ }
+ if (JSValueIsUndefined(*m_engine, value))
+ return new QScriptValuePrivate;
+ return new QScriptValuePrivate(engine(), value);
+}
+
+inline void QScriptValuePrivate::setProperty(const QString& name, QScriptValuePrivate* value, const QScriptValue::PropertyFlags& flags)
+{
+ JSRetainPtr<JSStringRef> propertyName(Adopt, QScriptConverter::toString(name));
+ setProperty<JSStringRef>(propertyName.get(), value, flags);
+}
+
+inline void QScriptValuePrivate::setProperty(quint32 arrayIndex, QScriptValuePrivate* value, const QScriptValue::PropertyFlags& flags)
+{
+ setProperty<quint32>(arrayIndex, value, flags);
+}
+
+inline void QScriptValuePrivate::setProperty(const QScriptStringPrivate* name, QScriptValuePrivate* value, const QScriptValue::PropertyFlags& flags)
+{
+ setProperty<JSStringRef>(*name, value, flags);
+}
+
+/*!
+ \internal
+ This method was created to unify access to the JSObjectSetPropertyAtIndex and the JSObjectSetProperty.
+*/
+inline void QScriptValuePrivate::setProperty(quint32 property, JSValueRef value, JSPropertyAttributes flags, JSValueRef* exception)
+{
+ Q_ASSERT(isObject());
+ if (flags) {
+ // FIXME This could be better, but JSC C API doesn't expose needed functionality. It is
+ // not possible to create / modify a property attribute via an array index.
+ JSRetainPtr<JSStringRef> propertyName(Adopt, QScriptConverter::toString(QString::number(property)));
+ JSObjectSetProperty(*m_engine, *this, propertyName.get(), value, flags, exception);
+ return;
+ }
+ JSObjectSetPropertyAtIndex(*m_engine, *this, property, value, exception);
+}
+
+/*!
+ \internal
+ This method was created to unify access to the JSObjectSetPropertyAtIndex and the JSObjectSetProperty.
+*/
+inline void QScriptValuePrivate::setProperty(JSStringRef property, JSValueRef value, JSPropertyAttributes flags, JSValueRef* exception)
+{
+ Q_ASSERT(isObject());
+ JSObjectSetProperty(*m_engine, *this, property, value, flags, exception);
+}
+
+/*!
+ \internal
+ This method was created to unify access to the JSObjectDeleteProperty and a teoretical JSObjectDeletePropertyAtIndex
+ which doesn't exist now.
+*/
+inline void QScriptValuePrivate::deleteProperty(quint32 property, JSValueRef* exception)
+{
+ // FIXME It could be faster, we need a JSC C API for deleting array index properties.
+ JSRetainPtr<JSStringRef> propertyName(Adopt, QScriptConverter::toString(QString::number(property)));
+ JSObjectDeleteProperty(*m_engine, *this, propertyName.get(), exception);
+}
+
+/*!
+ \internal
+ This method was created to unify access to the JSObjectDeleteProperty and a teoretical JSObjectDeletePropertyAtIndex.
+*/
+inline void QScriptValuePrivate::deleteProperty(JSStringRef property, JSValueRef* exception)
+{
+ Q_ASSERT(isObject());
+ JSObjectDeleteProperty(*m_engine, *this, property, exception);
+}
+
+template<typename T>
+inline void QScriptValuePrivate::setProperty(T name, QScriptValuePrivate* value, const QScriptValue::PropertyFlags& flags)
+{
+ if (!isObject())
+ return;
+
+ if (!value->isJSBased())
+ value->assignEngine(engine());
+
+ JSValueRef exception = 0;
+ if (!value->isValid()) {
+ // Remove the property.
+ deleteProperty(name, &exception);
+ m_engine->setException(exception);
+ return;
+ }
+ if (m_engine != value->m_engine) {
+ qWarning("QScriptValue::setProperty() failed: cannot set value created in a different engine");
+ return;
+ }
+
+ setProperty(name, *value, QScriptConverter::toPropertyFlags(flags), &exception);
+ m_engine->setException(exception);
+}
+
+inline QScriptValue::PropertyFlags QScriptValuePrivate::propertyFlags(const QString& name, const QScriptValue::ResolveFlags& mode)
+{
+ JSRetainPtr<JSStringRef> propertyName(Adopt, QScriptConverter::toString(name));
+ return propertyFlags(propertyName.get(), mode);
+}
+
+inline QScriptValue::PropertyFlags QScriptValuePrivate::propertyFlags(const QScriptStringPrivate* name, const QScriptValue::ResolveFlags& mode)
+{
+ return propertyFlags(*name, mode);
+}
+
+inline QScriptValue::PropertyFlags QScriptValuePrivate::propertyFlags(JSStringRef name, const QScriptValue::ResolveFlags& mode)
+{
+ unsigned flags = 0;
+ if (!isObject())
+ return QScriptValue::PropertyFlags(flags);
+
+ // FIXME It could be faster and nicer, but new JSC C API should be created.
+ static JSStringRef objectName = QScriptConverter::toString("Object");
+ static JSStringRef propertyDescriptorName = QScriptConverter::toString("getOwnPropertyDescriptor");
+
+ // FIXME This is dangerous if global object was modified (bug 41839).
+ JSValueRef exception = 0;
+ JSObjectRef globalObject = JSContextGetGlobalObject(*m_engine);
+ JSValueRef objectConstructor = JSObjectGetProperty(*m_engine, globalObject, objectName, &exception);
+ Q_ASSERT(JSValueIsObject(*m_engine, objectConstructor));
+ JSValueRef propertyDescriptorGetter = JSObjectGetProperty(*m_engine, const_cast<JSObjectRef>(objectConstructor), propertyDescriptorName, &exception);
+ Q_ASSERT(JSValueIsObject(*m_engine, propertyDescriptorGetter));
+
+ JSValueRef arguments[] = { *this, JSValueMakeString(*m_engine, name) };
+ JSObjectRef propertyDescriptor
+ = const_cast<JSObjectRef>(JSObjectCallAsFunction(*m_engine,
+ const_cast<JSObjectRef>(propertyDescriptorGetter),
+ /* thisObject */ 0,
+ /* argumentCount */ 2,
+ arguments,
+ &exception));
+ if (exception) {
+ // Invalid property.
+ return QScriptValue::PropertyFlags(flags);
+ }
+
+ if (!JSValueIsObject(*m_engine, propertyDescriptor)) {
+ // Property isn't owned by this object.
+ JSObjectRef proto;
+ if (mode == QScriptValue::ResolveLocal
+ || ((proto = const_cast<JSObjectRef>(JSObjectGetPrototype(*m_engine, *this))) && JSValueIsNull(*m_engine, proto))) {
+ return QScriptValue::PropertyFlags(flags);
+ }
+ QScriptValuePrivate p(engine(), proto);
+ return p.propertyFlags(name, QScriptValue::ResolvePrototype);
+ }
+
+ static JSStringRef writableName = QScriptConverter::toString("writable");
+ static JSStringRef configurableName = QScriptConverter::toString("configurable");
+ static JSStringRef enumerableName = QScriptConverter::toString("enumerable");
+
+ bool readOnly = !JSValueToBoolean(*m_engine, JSObjectGetProperty(*m_engine, propertyDescriptor, writableName, &exception));
+ if (!exception && readOnly)
+ flags |= QScriptValue::ReadOnly;
+ bool undeletable = !JSValueToBoolean(*m_engine, JSObjectGetProperty(*m_engine, propertyDescriptor, configurableName, &exception));
+ if (!exception && undeletable)
+ flags |= QScriptValue::Undeletable;
+ bool skipInEnum = !JSValueToBoolean(*m_engine, JSObjectGetProperty(*m_engine, propertyDescriptor, enumerableName, &exception));
+ if (!exception && skipInEnum)
+ flags |= QScriptValue::SkipInEnumeration;
+
+ return QScriptValue::PropertyFlags(flags);
+}
+
+QScriptValuePrivate* QScriptValuePrivate::call(const QScriptValuePrivate*, const QScriptValueList& args)
+{
+ switch (m_state) {
+ case JSValue:
+ if (refinedJSValue() != JSObject)
+ return new QScriptValuePrivate;
+ // Fall-through.
+ case JSObject:
+ {
+ // Convert all arguments and bind to the engine.
+ int argc = args.size();
+ QVarLengthArray<JSValueRef, 8> argv(argc);
+ QScriptValueList::const_iterator i = args.constBegin();
+ for (int j = 0; i != args.constEnd(); j++, i++) {
+ QScriptValuePrivate* value = QScriptValuePrivate::get(*i);
+ if (!value->assignEngine(engine())) {
+ qWarning("QScriptValue::call() failed: cannot call function with values created in a different engine");
+ return new QScriptValuePrivate;
+ }
+ argv[j] = *value;
+ }
+
+ // Make the call
+ JSValueRef exception = 0;
+ JSValueRef result = JSObjectCallAsFunction(*m_engine, *this, /* thisObject */ 0, argc, argv.constData(), &exception);
+ if (!result && exception) {
+ m_engine->setException(exception);
+ return new QScriptValuePrivate(engine(), exception);
+ }
+ if (result && !exception)
+ return new QScriptValuePrivate(engine(), result);
+ }
+ // this QSV is not a function <-- !result && !exception. Fall-through.
+ default:
+ return new QScriptValuePrivate;
+ }
+}
+
+QScriptEnginePrivate* QScriptValuePrivate::engine() const
+{
+ // As long as m_engine is an autoinitializated pointer we can safely return it without
+ // checking current state.
+ return m_engine.data();
+}
+
+QScriptValuePrivate::operator JSValueRef() const
+{
+ Q_ASSERT(isJSBased());
+ Q_ASSERT(u.m_value);
+ return u.m_value;
+}
+
+QScriptValuePrivate::operator JSObjectRef() const
+{
+ Q_ASSERT(m_state == JSObject);
+ Q_ASSERT(u.m_object);
+ return u.m_object;
+}
+
+/*!
+ \internal
+ Refines the state of this QScriptValuePrivate. Returns the new state.
+*/
+QScriptValuePrivate::State QScriptValuePrivate::refinedJSValue()
+{
+ Q_ASSERT(m_state == JSValue);
+ if (!JSValueIsObject(*m_engine, *this)) {
+ m_state = JSPrimitive;
+ } else {
+ // Difference between JSValueRef and JSObjectRef is only in their type, binarywise it is the same.
+ // As m_value and m_object are stored in the u union, it is enough to change the m_state only.
+ m_state = JSObject;
+ }
+ return m_state;
+}
+
+/*!
+ \internal
+ Returns true if QSV have an engine associated.
+*/
+bool QScriptValuePrivate::isJSBased() const { return m_state >= JSValue; }
+
+/*!
+ \internal
+ Returns true if current value of QSV is placed in m_number.
+*/
+bool QScriptValuePrivate::isNumberBased() const { return m_state == CNumber || m_state == CBool; }
+
+/*!
+ \internal
+ Returns true if current value of QSV is placed in m_string.
+*/
+bool QScriptValuePrivate::isStringBased() const { return m_state == CString; }
+
+#endif // qscriptvalue_p_h
diff --git a/Source/JavaScriptCore/qt/api/qscriptvalueiterator.cpp b/Source/JavaScriptCore/qt/api/qscriptvalueiterator.cpp
new file mode 100644
index 0000000..f1caa61
--- /dev/null
+++ b/Source/JavaScriptCore/qt/api/qscriptvalueiterator.cpp
@@ -0,0 +1,226 @@
+/*
+ Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include "config.h"
+
+#include "qscriptvalueiterator.h"
+
+#include "qscriptvalue_p.h"
+#include "qscriptvalueiterator_p.h"
+
+/*!
+ \class QScriptValueIterator
+
+ \brief The QScriptValueIterator class provides a Java-style iterator for QScriptValue.
+
+ \ingroup script
+
+
+ The QScriptValueIterator constructor takes a QScriptValue as
+ argument. After construction, the iterator is located at the very
+ beginning of the sequence of properties. Here's how to iterate over
+ all the properties of a QScriptValue:
+
+ \snippet doc/src/snippets/code/src_script_qscriptvalueiterator.cpp 0
+
+ The next() advances the iterator. The name(), value() and flags()
+ functions return the name, value and flags of the last item that was
+ jumped over.
+
+ If you want to remove properties as you iterate over the
+ QScriptValue, use remove(). If you want to modify the value of a
+ property, use setValue().
+
+ Note that QScriptValueIterator only iterates over the QScriptValue's
+ own properties; i.e. it does not follow the prototype chain. You can
+ use a loop like this to follow the prototype chain:
+
+ \snippet doc/src/snippets/code/src_script_qscriptvalueiterator.cpp 1
+
+ Note that QScriptValueIterator will not automatically skip over
+ properties that have the QScriptValue::SkipInEnumeration flag set;
+ that flag only affects iteration in script code. If you want, you
+ can skip over such properties with code like the following:
+
+ \snippet doc/src/snippets/code/src_script_qscriptvalueiterator.cpp 2
+
+ \sa QScriptValue::property()
+*/
+
+/*!
+ Constructs an iterator for traversing \a object. The iterator is
+ set to be at the front of the sequence of properties (before the
+ first property).
+*/
+QScriptValueIterator::QScriptValueIterator(const QScriptValue& object)
+ : d_ptr(new QScriptValueIteratorPrivate(QScriptValuePrivate::get(object)))
+{}
+
+/*!
+ Destroys the iterator.
+*/
+QScriptValueIterator::~QScriptValueIterator()
+{}
+
+/*!
+ Returns true if there is at least one item ahead of the iterator
+ (i.e. the iterator is \e not at the back of the property sequence);
+ otherwise returns false.
+
+ \sa next(), hasPrevious()
+*/
+bool QScriptValueIterator::hasNext() const
+{
+ return d_ptr->hasNext();
+}
+
+/*!
+ Advances the iterator by one position.
+
+ Calling this function on an iterator located at the back of the
+ container leads to undefined results.
+
+ \sa hasNext(), previous(), name()
+*/
+void QScriptValueIterator::next()
+{
+ d_ptr->next();
+}
+
+/*!
+ Returns true if there is at least one item behind the iterator
+ (i.e. the iterator is \e not at the front of the property sequence);
+ otherwise returns false.
+
+ \sa previous(), hasNext()
+*/
+bool QScriptValueIterator::hasPrevious() const
+{
+ return d_ptr->hasPrevious();
+}
+
+/*!
+ Moves the iterator back by one position.
+
+ Calling this function on an iterator located at the front of the
+ container leads to undefined results.
+
+ \sa hasPrevious(), next(), name()
+*/
+void QScriptValueIterator::previous()
+{
+ d_ptr->previous();
+}
+
+/*!
+ Moves the iterator to the front of the QScriptValue (before the
+ first property).
+
+ \sa toBack(), next()
+*/
+void QScriptValueIterator::toFront()
+{
+ d_ptr->toFront();
+}
+
+/*!
+ Moves the iterator to the back of the QScriptValue (after the
+ last property).
+
+ \sa toFront(), previous()
+*/
+void QScriptValueIterator::toBack()
+{
+ d_ptr->toBack();
+}
+
+/*!
+ Returns the name of the last property that was jumped over using
+ next() or previous().
+
+ \sa value(), flags()
+*/
+QString QScriptValueIterator::name() const
+{
+ return d_ptr->name();
+}
+
+/*!
+ Returns the name of the last property that was jumped over using
+ next() or previous().
+*/
+QScriptString QScriptValueIterator::scriptName() const
+{
+ return QScriptStringPrivate::get(d_ptr->scriptName());
+}
+
+/*!
+ Returns the value of the last property that was jumped over using
+ next() or previous().
+
+ \sa setValue(), name()
+*/
+QScriptValue QScriptValueIterator::value() const
+{
+ return QScriptValuePrivate::get(d_ptr->value());
+}
+
+/*!
+ Sets the \a value of the last property that was jumped over using
+ next() or previous().
+
+ \sa value(), name()
+*/
+void QScriptValueIterator::setValue(const QScriptValue& value)
+{
+ d_ptr->setValue(QScriptValuePrivate::get(value));
+}
+
+/*!
+ Removes the last property that was jumped over using next()
+ or previous().
+
+ \sa setValue()
+*/
+void QScriptValueIterator::remove()
+{
+ d_ptr->remove();
+}
+
+/*!
+ Returns the flags of the last property that was jumped over using
+ next() or previous().
+
+ \sa value()
+*/
+QScriptValue::PropertyFlags QScriptValueIterator::flags() const
+{
+ return d_ptr->flags();
+}
+
+/*!
+ Makes the iterator operate on \a object. The iterator is set to be
+ at the front of the sequence of properties (before the first
+ property).
+*/
+QScriptValueIterator& QScriptValueIterator::operator=(QScriptValue& object)
+{
+ d_ptr = new QScriptValueIteratorPrivate(QScriptValuePrivate::get(object));
+ return *this;
+}
diff --git a/Source/JavaScriptCore/qt/api/qscriptvalueiterator.h b/Source/JavaScriptCore/qt/api/qscriptvalueiterator.h
new file mode 100644
index 0000000..0c90661
--- /dev/null
+++ b/Source/JavaScriptCore/qt/api/qscriptvalueiterator.h
@@ -0,0 +1,63 @@
+/*
+ Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef qscriptvalueiterator_h
+#define qscriptvalueiterator_h
+
+#include "qtscriptglobal.h"
+#include "qscriptstring.h"
+#include <QtCore/qshareddata.h>
+#include "qscriptvalue.h"
+
+class QScriptValue;
+class QScriptValueIteratorPrivate;
+
+
+class Q_JAVASCRIPT_EXPORT QScriptValueIterator {
+public:
+ QScriptValueIterator(const QScriptValue& value);
+ ~QScriptValueIterator();
+
+ bool hasNext() const;
+ void next();
+
+ bool hasPrevious() const;
+ void previous();
+
+ QString name() const;
+ QScriptString scriptName() const;
+
+ QScriptValue value() const;
+ void setValue(const QScriptValue& value);
+
+ void remove();
+ QScriptValue::PropertyFlags flags() const;
+
+ void toFront();
+ void toBack();
+
+ QScriptValueIterator& operator=(QScriptValue& value);
+private:
+ QExplicitlySharedDataPointer<QScriptValueIteratorPrivate> d_ptr;
+
+ Q_DECLARE_PRIVATE(QScriptValueIterator)
+ Q_DISABLE_COPY(QScriptValueIterator)
+};
+
+#endif // qscriptvalueiterator_h
diff --git a/Source/JavaScriptCore/qt/api/qscriptvalueiterator_p.h b/Source/JavaScriptCore/qt/api/qscriptvalueiterator_p.h
new file mode 100644
index 0000000..b93b518
--- /dev/null
+++ b/Source/JavaScriptCore/qt/api/qscriptvalueiterator_p.h
@@ -0,0 +1,172 @@
+/*
+ Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef qscriptvalueiterator_p_h
+#define qscriptvalueiterator_p_h
+
+#include "qscriptvalue_p.h"
+#include <JavaScriptCore/JavaScript.h>
+#include <JavaScriptCore/JSRetainPtr.h>
+#include <QtCore/qshareddata.h>
+#include <QtCore/qvector.h>
+
+class QScriptValueIteratorPrivate: public QSharedData {
+public:
+ inline QScriptValueIteratorPrivate(const QScriptValuePrivate* value);
+ inline ~QScriptValueIteratorPrivate();
+
+ inline bool hasNext();
+ inline void next();
+
+ inline bool hasPrevious();
+ inline void previous();
+
+ inline QString name() const;
+ inline QScriptStringPrivate* scriptName() const;
+
+ inline QScriptValuePrivate* value() const;
+ inline void setValue(const QScriptValuePrivate* value);
+
+ inline void remove();
+
+ inline void toFront();
+ inline void toBack();
+
+ QScriptValue::PropertyFlags flags() const;
+
+ inline bool isValid() const;
+private:
+ inline QScriptEnginePrivate* engine() const;
+
+ QExplicitlySharedDataPointer<QScriptValuePrivate> m_object;
+ QVector<JSStringRef> m_names;
+ QMutableVectorIterator<JSStringRef> m_idx;
+};
+
+inline QScriptValueIteratorPrivate::QScriptValueIteratorPrivate(const QScriptValuePrivate* value)
+ : m_object(const_cast<QScriptValuePrivate*>(value))
+ , m_idx(m_names)
+{
+ if (m_object->isObject()) {
+ m_names = engine()->objectGetOwnPropertyNames(*m_object);
+ m_idx = m_names;
+ } else
+ m_object = 0;
+}
+
+inline QScriptValueIteratorPrivate::~QScriptValueIteratorPrivate()
+{
+ QVector<JSStringRef>::const_iterator i = m_names.constBegin();
+ for (; i != m_names.constEnd(); ++i)
+ JSStringRelease(*i);
+}
+
+inline bool QScriptValueIteratorPrivate::hasNext()
+{
+ return m_idx.hasNext();
+}
+
+inline void QScriptValueIteratorPrivate::next()
+{
+ // FIXME (Qt5) This method should return a value (QTBUG-11226).
+ m_idx.next();
+}
+
+inline bool QScriptValueIteratorPrivate::hasPrevious()
+{
+ return m_idx.hasPrevious();
+}
+
+inline void QScriptValueIteratorPrivate::previous()
+{
+ m_idx.previous();
+}
+
+inline QString QScriptValueIteratorPrivate::name() const
+{
+ if (!isValid())
+ return QString();
+ return QScriptConverter::toString(m_idx.value());
+}
+
+inline QScriptStringPrivate* QScriptValueIteratorPrivate::scriptName() const
+{
+ if (!isValid())
+ return new QScriptStringPrivate();
+ return new QScriptStringPrivate(QScriptConverter::toString(m_idx.value()));
+}
+
+inline QScriptValuePrivate* QScriptValueIteratorPrivate::value() const
+{
+ if (!isValid())
+ return new QScriptValuePrivate();
+ JSValueRef exception = 0;
+ JSValueRef value = m_object->property(m_idx.value(), &exception);
+ engine()->setException(exception);
+ return new QScriptValuePrivate(engine(), value);
+}
+
+inline void QScriptValueIteratorPrivate::setValue(const QScriptValuePrivate* value)
+{
+ if (!isValid())
+ return;
+ JSValueRef exception = 0;
+ m_object->setProperty(m_idx.value(), *value, /* flags */ 0, &exception);
+ engine()->setException(exception);
+}
+
+inline void QScriptValueIteratorPrivate::remove()
+{
+ if (!isValid())
+ return;
+ JSValueRef exception = 0;
+ m_object->deleteProperty(m_idx.value(), &exception);
+ engine()->setException(exception);
+ m_idx.remove();
+}
+
+inline void QScriptValueIteratorPrivate::toFront()
+{
+ m_idx.toFront();
+}
+
+inline void QScriptValueIteratorPrivate::toBack()
+{
+ m_idx.toBack();
+}
+
+QScriptValue::PropertyFlags QScriptValueIteratorPrivate::flags() const
+{
+ if (!isValid())
+ return QScriptValue::PropertyFlags(0);
+ return m_object->propertyFlags(m_idx.value(), QScriptValue::ResolveLocal);
+}
+
+inline bool QScriptValueIteratorPrivate::isValid() const
+{
+ return m_object;
+}
+
+inline QScriptEnginePrivate* QScriptValueIteratorPrivate::engine() const
+{
+ Q_ASSERT(isValid());
+ return m_object->engine();
+}
+
+#endif // qscriptvalueiterator_p_h
diff --git a/Source/JavaScriptCore/qt/api/qtscriptglobal.h b/Source/JavaScriptCore/qt/api/qtscriptglobal.h
new file mode 100644
index 0000000..efdfc50
--- /dev/null
+++ b/Source/JavaScriptCore/qt/api/qtscriptglobal.h
@@ -0,0 +1,43 @@
+/*
+ Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef qtscriptglobal_h
+#define qtscriptglobal_h
+
+#include <QtCore/qglobal.h>
+
+#if defined(QT_MAKEDLL) /* create a Qt DLL library */
+# if defined(QT_BUILD_JAVASCRIPT_LIB)
+# define Q_JAVASCRIPT_EXPORT Q_DECL_EXPORT
+# else
+# define Q_JAVASCRIPT_EXPORT Q_DECL_IMPORT
+# endif
+#elif defined(QT_DLL) /* use a Qt DLL library */
+# define Q_JAVASCRIPT_EXPORT
+#endif
+
+#if !defined(Q_JAVASCRIPT_EXPORT)
+# if defined(QT_SHARED)
+# define Q_JAVASCRIPT_EXPORT Q_DECL_EXPORT
+# else
+# define Q_JAVASCRIPT_EXPORT
+# endif
+#endif
+
+#endif
diff --git a/Source/JavaScriptCore/qt/benchmarks/benchmarks.pri b/Source/JavaScriptCore/qt/benchmarks/benchmarks.pri
new file mode 100644
index 0000000..5af3383
--- /dev/null
+++ b/Source/JavaScriptCore/qt/benchmarks/benchmarks.pri
@@ -0,0 +1,19 @@
+QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR
+QMAKE_LIBDIR = $$OUTPUT_DIR/lib $$QMAKE_LIBDIR
+mac:!static:contains(QT_CONFIG, qt_framework):!CONFIG(webkit_no_framework) {
+ LIBS += -framework QtScript
+ QMAKE_FRAMEWORKPATH = $$OUTPUT_DIR/lib $$QMAKE_FRAMEWORKPATH
+} else {
+ win32-*|wince* {
+ LIBS += -lQtScript$${QT_MAJOR_VERSION}
+ } else {
+ LIBS += -lQtScript
+ }
+}
+
+CONFIG(release, debug|release) {
+ DEFINES += NDEBUG
+}
+
+INCLUDEPATH += $$PWD/../api
+
diff --git a/Source/JavaScriptCore/qt/benchmarks/benchmarks.pro b/Source/JavaScriptCore/qt/benchmarks/benchmarks.pro
new file mode 100644
index 0000000..85fa82c
--- /dev/null
+++ b/Source/JavaScriptCore/qt/benchmarks/benchmarks.pro
@@ -0,0 +1,4 @@
+TEMPLATE = subdirs
+SUBDIRS = qscriptengine \
+ qscriptvalue \
+
diff --git a/Source/JavaScriptCore/qt/benchmarks/qscriptengine/qscriptengine.pro b/Source/JavaScriptCore/qt/benchmarks/qscriptengine/qscriptengine.pro
new file mode 100644
index 0000000..e94137d
--- /dev/null
+++ b/Source/JavaScriptCore/qt/benchmarks/qscriptengine/qscriptengine.pro
@@ -0,0 +1,13 @@
+TEMPLATE = app
+TARGET = tst_bench_qscriptengine
+
+SOURCES += tst_qscriptengine.cpp
+
+QT += testlib
+
+include(../benchmarks.pri)
+
+symbian* {
+ TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 // Min 128kB, Max 32MB
+ TARGET.EPOCSTACKSIZE = 0x14000
+}
diff --git a/Source/JavaScriptCore/qt/benchmarks/qscriptengine/tst_qscriptengine.cpp b/Source/JavaScriptCore/qt/benchmarks/qscriptengine/tst_qscriptengine.cpp
new file mode 100644
index 0000000..0c447c6
--- /dev/null
+++ b/Source/JavaScriptCore/qt/benchmarks/qscriptengine/tst_qscriptengine.cpp
@@ -0,0 +1,142 @@
+/*
+ Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include "qscriptengine.h"
+#include "qscriptvalue.h"
+#include <qtest.h>
+
+class tst_QScriptEngine : public QObject {
+ Q_OBJECT
+
+private slots:
+ void checkSyntax_data();
+ void checkSyntax();
+ void constructor();
+ void evaluateString_data();
+ void evaluateString();
+ void evaluateProgram_data();
+ void evaluateProgram();
+ void newObject();
+ void nullValue();
+ void undefinedValue();
+ void globalObject();
+ void toStringHandle();
+};
+
+void tst_QScriptEngine::checkSyntax_data()
+{
+ evaluateString_data();
+}
+
+void tst_QScriptEngine::checkSyntax()
+{
+ QFETCH(QString, code);
+ QScriptEngine engine;
+ QBENCHMARK {
+ engine.checkSyntax(code);
+ }
+}
+
+void tst_QScriptEngine::constructor()
+{
+ QBENCHMARK {
+ QScriptEngine engine;
+ }
+}
+
+void tst_QScriptEngine::evaluateString_data()
+{
+ QTest::addColumn<QString>("code");
+ QTest::newRow("empty script") << QString::fromLatin1("");
+ QTest::newRow("number literal") << QString::fromLatin1("123");
+ QTest::newRow("string literal") << QString::fromLatin1("'ciao'");
+ QTest::newRow("regexp literal") << QString::fromLatin1("/foo/gim");
+ QTest::newRow("null literal") << QString::fromLatin1("null");
+ QTest::newRow("undefined literal") << QString::fromLatin1("undefined");
+ QTest::newRow("empty object literal") << QString::fromLatin1("{}");
+ QTest::newRow("this") << QString::fromLatin1("this");
+}
+
+void tst_QScriptEngine::evaluateString()
+{
+ QFETCH(QString, code);
+ QScriptEngine engine;
+ QBENCHMARK {
+ engine.evaluate(code);
+ }
+}
+
+void tst_QScriptEngine::evaluateProgram_data()
+{
+ evaluateString_data();
+}
+
+void tst_QScriptEngine::evaluateProgram()
+{
+ QFETCH(QString, code);
+ QScriptEngine engine;
+ QScriptProgram program(code);
+ QBENCHMARK {
+ engine.evaluate(program);
+ }
+}
+
+void tst_QScriptEngine::newObject()
+{
+ QScriptEngine engine;
+ QBENCHMARK {
+ engine.newObject();
+ }
+}
+
+void tst_QScriptEngine::nullValue()
+{
+ QScriptEngine engine;
+ QBENCHMARK {
+ engine.nullValue();
+ }
+}
+
+void tst_QScriptEngine::undefinedValue()
+{
+ QScriptEngine engine;
+ QBENCHMARK {
+ engine.undefinedValue();
+ }
+}
+
+void tst_QScriptEngine::globalObject()
+{
+ QScriptEngine engine;
+ QBENCHMARK {
+ engine.globalObject();
+ }
+}
+
+void tst_QScriptEngine::toStringHandle()
+{
+ QScriptEngine engine;
+ QString str = QString::fromLatin1("foobarbaz");
+ QBENCHMARK {
+ engine.toStringHandle(str);
+ }
+}
+
+QTEST_MAIN(tst_QScriptEngine)
+#include "tst_qscriptengine.moc"
diff --git a/Source/JavaScriptCore/qt/benchmarks/qscriptvalue/qscriptvalue.pro b/Source/JavaScriptCore/qt/benchmarks/qscriptvalue/qscriptvalue.pro
new file mode 100644
index 0000000..673fe65
--- /dev/null
+++ b/Source/JavaScriptCore/qt/benchmarks/qscriptvalue/qscriptvalue.pro
@@ -0,0 +1,9 @@
+TEMPLATE = app
+TARGET = tst_bench_qscriptvalue
+QT += testlib
+
+isEmpty(OUTPUT_DIR): OUTPUT_DIR = ../../../..
+include(../benchmarks.pri)
+
+SOURCES += tst_qscriptvalue.cpp
+
diff --git a/Source/JavaScriptCore/qt/benchmarks/qscriptvalue/tst_qscriptvalue.cpp b/Source/JavaScriptCore/qt/benchmarks/qscriptvalue/tst_qscriptvalue.cpp
new file mode 100644
index 0000000..7c39b8e
--- /dev/null
+++ b/Source/JavaScriptCore/qt/benchmarks/qscriptvalue/tst_qscriptvalue.cpp
@@ -0,0 +1,442 @@
+/*
+ Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include "qscriptengine.h"
+#include "qscriptstring.h"
+#include "qscriptvalue.h"
+#include <qtest.h>
+
+Q_DECLARE_METATYPE(QScriptValue);
+
+class tst_QScriptValue : public QObject {
+ Q_OBJECT
+
+public:
+ tst_QScriptValue()
+ : m_engine(0)
+ {}
+
+ ~tst_QScriptValue()
+ {
+ if (m_engine)
+ delete m_engine;
+ }
+
+private slots:
+ void values_data();
+
+ void ctorBool();
+ void ctorReal();
+ void ctorNumber();
+ void ctorQString();
+ void ctorCString();
+ void ctorSpecial();
+ void ctorQScriptValue();
+
+ void isValid_data();
+ void isValid();
+ void isBool_data();
+ void isBool();
+ void isNumber_data();
+ void isNumber();
+ void isFunction_data();
+ void isFunction();
+ void isNull_data();
+ void isNull();
+ void isString_data();
+ void isString();
+ void isUndefined_data();
+ void isUndefined();
+ void isObject_data();
+ void isObject();
+ void isError_data();
+ void isError();
+
+ void toString_data();
+ void toString();
+ void toNumber_data();
+ void toNumber();
+ void toBool_data();
+ void toBool();
+ void toInteger_data();
+ void toInteger();
+ void toInt32_data();
+ void toInt32();
+ void toUInt32_data();
+ void toUInt32();
+ void toUInt16_data();
+ void toUInt16();
+ void toObject_data();
+ void toObject();
+
+ void equals_data();
+ void equals();
+ void strictlyEquals_data();
+ void strictlyEquals();
+ void instanceOf_data();
+ void instanceOf();
+
+private:
+ QScriptEngine* m_engine;
+};
+
+void tst_QScriptValue::values_data()
+{
+ if (m_engine)
+ delete m_engine;
+ m_engine = new QScriptEngine;
+
+ QTest::addColumn<QScriptValue>("value");
+
+ QTest::newRow("invalid") << QScriptValue();
+
+ QTest::newRow("cbool") << QScriptValue(true);
+ QTest::newRow("cnumber") << QScriptValue(1234);
+ QTest::newRow("cstring") << QScriptValue("abc");
+ QTest::newRow("cnull") << QScriptValue(QScriptValue::NullValue);
+ QTest::newRow("cundefined") << QScriptValue(QScriptValue::UndefinedValue);
+
+ QTest::newRow("jsbool") << m_engine->evaluate("true");
+ QTest::newRow("jsnumber") << m_engine->evaluate("12345");
+ QTest::newRow("jsstring") << m_engine->evaluate("'go'");
+ QTest::newRow("jsfunction") << m_engine->evaluate("(function {})");
+ QTest::newRow("jsnull") << m_engine->nullValue();
+ QTest::newRow("jsundefined") << m_engine->undefinedValue();
+ QTest::newRow("jsobject") << m_engine->newObject();
+ QTest::newRow("jserror") << m_engine->evaluate("new Error()");
+}
+
+void tst_QScriptValue::ctorBool()
+{
+ QBENCHMARK {
+ QScriptValue(true);
+ }
+}
+
+void tst_QScriptValue::ctorReal()
+{
+ QBENCHMARK {
+ QScriptValue(12.3);
+ }
+}
+
+void tst_QScriptValue::ctorNumber()
+{
+ QBENCHMARK {
+ QScriptValue(123);
+ }
+}
+
+void tst_QScriptValue::ctorQString()
+{
+ QString str = QString::fromLatin1("ciao");
+ QBENCHMARK {
+ QScriptValue(str);
+ }
+}
+
+void tst_QScriptValue::ctorCString()
+{
+ QBENCHMARK {
+ QScriptValue("Pong!");
+ }
+}
+
+void tst_QScriptValue::ctorSpecial()
+{
+ QBENCHMARK {
+ (void)QScriptValue(QScriptValue::NullValue);
+ }
+}
+
+void tst_QScriptValue::ctorQScriptValue()
+{
+ QScriptValue tmp(1234);
+ QBENCHMARK {
+ QScriptValue(tmp);
+ }
+}
+
+void tst_QScriptValue::isValid_data()
+{
+ values_data();
+}
+
+void tst_QScriptValue::isValid()
+{
+ QFETCH(QScriptValue, value);
+ QBENCHMARK {
+ value.isValid();
+ }
+}
+
+void tst_QScriptValue::isBool_data()
+{
+ values_data();
+}
+
+void tst_QScriptValue::isBool()
+{
+ QFETCH(QScriptValue, value);
+ QBENCHMARK {
+ value.isBool();
+ }
+}
+
+void tst_QScriptValue::isNumber_data()
+{
+ values_data();
+}
+
+void tst_QScriptValue::isNumber()
+{
+ QFETCH(QScriptValue, value);
+ QBENCHMARK {
+ value.isNumber();
+ }
+}
+
+void tst_QScriptValue::isFunction_data()
+{
+ values_data();
+}
+
+void tst_QScriptValue::isFunction()
+{
+ QFETCH(QScriptValue, value);
+ QBENCHMARK {
+ value.isFunction();
+ }
+}
+
+void tst_QScriptValue::isNull_data()
+{
+ values_data();
+}
+
+void tst_QScriptValue::isNull()
+{
+ QFETCH(QScriptValue, value);
+ QBENCHMARK {
+ value.isNull();
+ }
+}
+
+void tst_QScriptValue::isString_data()
+{
+ values_data();
+}
+
+void tst_QScriptValue::isString()
+{
+ QFETCH(QScriptValue, value);
+ QBENCHMARK {
+ value.isString();
+ }
+}
+
+void tst_QScriptValue::isUndefined_data()
+{
+ values_data();
+}
+
+void tst_QScriptValue::isUndefined()
+{
+ QFETCH(QScriptValue, value);
+ QBENCHMARK {
+ value.isUndefined();
+ }
+}
+
+void tst_QScriptValue::isObject_data()
+{
+ values_data();
+}
+
+void tst_QScriptValue::isObject()
+{
+ QFETCH(QScriptValue, value);
+ QBENCHMARK {
+ value.isObject();
+ }
+}
+
+void tst_QScriptValue::isError_data()
+{
+ values_data();
+}
+
+void tst_QScriptValue::isError()
+{
+ QFETCH(QScriptValue, value);
+ QBENCHMARK {
+ value.isError();
+ }
+}
+
+void tst_QScriptValue::toString_data()
+{
+ values_data();
+}
+
+void tst_QScriptValue::toString()
+{
+ QFETCH(QScriptValue, value);
+ QBENCHMARK {
+ value.toString();
+ }
+}
+
+void tst_QScriptValue::toNumber_data()
+{
+ values_data();
+}
+
+void tst_QScriptValue::toNumber()
+{
+ QFETCH(QScriptValue, value);
+ QBENCHMARK {
+ value.toNumber();
+ }
+}
+
+void tst_QScriptValue::toBool_data()
+{
+ values_data();
+}
+
+void tst_QScriptValue::toBool()
+{
+ QFETCH(QScriptValue, value);
+ QBENCHMARK {
+ value.toBool();
+ }
+}
+
+void tst_QScriptValue::toInteger_data()
+{
+ values_data();
+}
+
+void tst_QScriptValue::toInteger()
+{
+ QFETCH(QScriptValue, value);
+ QBENCHMARK {
+ value.toInteger();
+ }
+}
+
+void tst_QScriptValue::toInt32_data()
+{
+ values_data();
+}
+
+void tst_QScriptValue::toInt32()
+{
+ QFETCH(QScriptValue, value);
+ QBENCHMARK {
+ value.toInt32();
+ }
+}
+
+void tst_QScriptValue::toUInt32_data()
+{
+ values_data();
+}
+
+void tst_QScriptValue::toUInt32()
+{
+ QFETCH(QScriptValue, value);
+ QBENCHMARK {
+ value.toUInt32();
+ }
+}
+
+void tst_QScriptValue::toUInt16_data()
+{
+ values_data();
+}
+
+void tst_QScriptValue::toUInt16()
+{
+ QFETCH(QScriptValue, value);
+ QBENCHMARK {
+ value.toUInt16();
+ }
+}
+
+void tst_QScriptValue::toObject_data()
+{
+ values_data();
+}
+
+void tst_QScriptValue::toObject()
+{
+ QFETCH(QScriptValue, value);
+ QBENCHMARK {
+ value.toObject();
+ }
+}
+
+void tst_QScriptValue::equals_data()
+{
+ values_data();
+}
+
+void tst_QScriptValue::equals()
+{
+ QFETCH(QScriptValue, value);
+ static QScriptValue previous;
+ QBENCHMARK {
+ value.equals(previous);
+ }
+ previous = value;
+}
+
+void tst_QScriptValue::strictlyEquals_data()
+{
+ values_data();
+}
+
+void tst_QScriptValue::strictlyEquals()
+{
+ QFETCH(QScriptValue, value);
+ static QScriptValue previous;
+ QBENCHMARK {
+ value.strictlyEquals(previous);
+ }
+ previous = value;
+}
+
+void tst_QScriptValue::instanceOf_data()
+{
+ values_data();
+}
+
+void tst_QScriptValue::instanceOf()
+{
+ QFETCH(QScriptValue, value);
+ static QScriptValue object = m_engine->newObject();
+ QBENCHMARK {
+ value.instanceOf(object);
+ }
+}
+
+QTEST_MAIN(tst_QScriptValue)
+#include "tst_qscriptvalue.moc"
diff --git a/Source/JavaScriptCore/qt/tests/qscriptengine/qscriptengine.pro b/Source/JavaScriptCore/qt/tests/qscriptengine/qscriptengine.pro
new file mode 100644
index 0000000..d521dd8
--- /dev/null
+++ b/Source/JavaScriptCore/qt/tests/qscriptengine/qscriptengine.pro
@@ -0,0 +1,8 @@
+TEMPLATE = app
+TARGET = tst_qscriptengine
+QT += testlib
+isEmpty(OUTPUT_DIR): OUTPUT_DIR = ../../../..
+include(../tests.pri)
+
+SOURCES += tst_qscriptengine.cpp
+
diff --git a/Source/JavaScriptCore/qt/tests/qscriptengine/tst_qscriptengine.cpp b/Source/JavaScriptCore/qt/tests/qscriptengine/tst_qscriptengine.cpp
new file mode 100644
index 0000000..dabcfb2
--- /dev/null
+++ b/Source/JavaScriptCore/qt/tests/qscriptengine/tst_qscriptengine.cpp
@@ -0,0 +1,734 @@
+/*
+ Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include "qscriptengine.h"
+#include "qscriptprogram.h"
+#include "qscriptsyntaxcheckresult.h"
+#include "qscriptvalue.h"
+#include <QtCore/qnumeric.h>
+#include <QtTest/qtest.h>
+
+class tst_QScriptEngine : public QObject {
+ Q_OBJECT
+
+public:
+ tst_QScriptEngine() {}
+ virtual ~tst_QScriptEngine() {}
+
+public slots:
+ void init() {}
+ void cleanup() {}
+
+private slots:
+ void newFunction();
+ void newObject();
+ void globalObject();
+ void evaluate();
+ void collectGarbage();
+ void reportAdditionalMemoryCost();
+ void nullValue();
+ void undefinedValue();
+ void evaluateProgram();
+ void checkSyntax_data();
+ void checkSyntax();
+ void toObject();
+ void toObjectTwoEngines();
+ void newArray();
+ void uncaughtException();
+ void newDate();
+};
+
+/* Evaluating a script that throw an unhandled exception should return an invalid value. */
+void tst_QScriptEngine::evaluate()
+{
+ QScriptEngine engine;
+ QVERIFY2(engine.evaluate("1+1").isValid(), "the expression should be evaluated and an valid result should be returned");
+ QVERIFY2(engine.evaluate("ping").isValid(), "Script throwing an unhandled exception should return an exception value");
+}
+
+static QScriptValue myFunction(QScriptContext*, QScriptEngine* eng)
+{
+ return eng->nullValue();
+}
+
+static QScriptValue myFunctionWithArg(QScriptContext*, QScriptEngine* eng, void* arg)
+{
+ int* result = reinterpret_cast<int*>(arg);
+ return QScriptValue(eng, *result);
+}
+
+static QScriptValue myFunctionThatReturns(QScriptContext*, QScriptEngine* eng)
+{
+ return QScriptValue(eng, 42);
+}
+
+static QScriptValue myFunctionThatReturnsWithoutEngine(QScriptContext*, QScriptEngine*)
+{
+ return QScriptValue(1024);
+}
+
+static QScriptValue myFunctionThatReturnsWrongEngine(QScriptContext*, QScriptEngine*, void* arg)
+{
+ QScriptEngine* wrongEngine = reinterpret_cast<QScriptEngine*>(arg);
+ return QScriptValue(wrongEngine, 42);
+}
+
+void tst_QScriptEngine::newFunction()
+{
+ QScriptEngine eng;
+ {
+ QScriptValue fun = eng.newFunction(myFunction);
+ QCOMPARE(fun.isValid(), true);
+ QCOMPARE(fun.isFunction(), true);
+ QCOMPARE(fun.isObject(), true);
+ // QCOMPARE(fun.scriptClass(), (QScriptClass*)0);
+ // a prototype property is automatically constructed
+ {
+ QScriptValue prot = fun.property("prototype", QScriptValue::ResolveLocal);
+ QVERIFY(prot.isObject());
+ QVERIFY(prot.property("constructor").strictlyEquals(fun));
+ QEXPECT_FAIL("", "JSCallbackObject::getOwnPropertyDescriptor() doesn't return correct information yet", Continue);
+ QCOMPARE(fun.propertyFlags("prototype"), QScriptValue::Undeletable);
+ QEXPECT_FAIL("", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QCOMPARE(prot.propertyFlags("constructor"), QScriptValue::PropertyFlags(QScriptValue::Undeletable | QScriptValue::SkipInEnumeration));
+ }
+ // prototype should be Function.prototype
+ QCOMPARE(fun.prototype().isValid(), true);
+ QCOMPARE(fun.prototype().isFunction(), true);
+ QCOMPARE(fun.prototype().strictlyEquals(eng.evaluate("Function.prototype")), true);
+
+ QCOMPARE(fun.call().isNull(), true);
+ // QCOMPARE(fun.construct().isObject(), true);
+ }
+ // the overload that takes an extra argument
+ {
+ int expectedResult = 42;
+ QScriptValue fun = eng.newFunction(myFunctionWithArg, reinterpret_cast<void*>(&expectedResult));
+ QVERIFY(fun.isFunction());
+ // QCOMPARE(fun.scriptClass(), (QScriptClass*)0);
+ // a prototype property is automatically constructed
+ {
+ QScriptValue prot = fun.property("prototype", QScriptValue::ResolveLocal);
+ QVERIFY(prot.isObject());
+ QVERIFY(prot.property("constructor").strictlyEquals(fun));
+ QEXPECT_FAIL("", "JSCallbackObject::getOwnPropertyDescriptor() doesn't return correct information yet", Continue);
+ QCOMPARE(fun.propertyFlags("prototype"), QScriptValue::Undeletable);
+ QEXPECT_FAIL("", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QCOMPARE(prot.propertyFlags("constructor"), QScriptValue::PropertyFlags(QScriptValue::Undeletable | QScriptValue::SkipInEnumeration));
+ }
+ // prototype should be Function.prototype
+ QCOMPARE(fun.prototype().isValid(), true);
+ QCOMPARE(fun.prototype().isFunction(), true);
+ QCOMPARE(fun.prototype().strictlyEquals(eng.evaluate("Function.prototype")), true);
+
+ QScriptValue result = fun.call();
+ QCOMPARE(result.isNumber(), true);
+ QCOMPARE(result.toInt32(), expectedResult);
+ }
+ // the overload that takes a prototype
+ {
+ QScriptValue proto = eng.newObject();
+ QScriptValue fun = eng.newFunction(myFunction, proto);
+ QCOMPARE(fun.isValid(), true);
+ QCOMPARE(fun.isFunction(), true);
+ QCOMPARE(fun.isObject(), true);
+ // internal prototype should be Function.prototype
+ QCOMPARE(fun.prototype().isValid(), true);
+ QCOMPARE(fun.prototype().isFunction(), true);
+ QCOMPARE(fun.prototype().strictlyEquals(eng.evaluate("Function.prototype")), true);
+ // public prototype should be the one we passed
+ QCOMPARE(fun.property("prototype").strictlyEquals(proto), true);
+ QEXPECT_FAIL("", "JSCallbackObject::getOwnPropertyDescriptor() doesn't return correct information yet", Continue);
+ QCOMPARE(fun.propertyFlags("prototype"), QScriptValue::Undeletable);
+ QCOMPARE(proto.property("constructor").strictlyEquals(fun), true);
+ QEXPECT_FAIL("", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QCOMPARE(proto.propertyFlags("constructor"), QScriptValue::PropertyFlags(QScriptValue::Undeletable | QScriptValue::SkipInEnumeration));
+
+ QCOMPARE(fun.call().isNull(), true);
+ // QCOMPARE(fun.construct().isObject(), true);
+ }
+ // whether the return value is correct
+ {
+ QScriptValue fun = eng.newFunction(myFunctionThatReturns);
+ QCOMPARE(fun.isValid(), true);
+ QCOMPARE(fun.isFunction(), true);
+ QCOMPARE(fun.isObject(), true);
+
+ QScriptValue result = fun.call();
+ QCOMPARE(result.isNumber(), true);
+ QCOMPARE(result.toInt32(), 42);
+ }
+ // whether the return value is assigned to the correct engine
+ {
+ QScriptValue fun = eng.newFunction(myFunctionThatReturnsWithoutEngine);
+ QCOMPARE(fun.isValid(), true);
+ QCOMPARE(fun.isFunction(), true);
+ QCOMPARE(fun.isObject(), true);
+
+ QScriptValue result = fun.call();
+ QCOMPARE(result.engine(), &eng);
+ QCOMPARE(result.isNumber(), true);
+ QCOMPARE(result.toInt32(), 1024);
+ }
+ // whether the return value is undefined when returning a value with wrong engine
+ {
+ QScriptEngine wrongEngine;
+
+ QScriptValue fun = eng.newFunction(myFunctionThatReturnsWrongEngine, reinterpret_cast<void*>(&wrongEngine));
+ QCOMPARE(fun.isValid(), true);
+ QCOMPARE(fun.isFunction(), true);
+ QCOMPARE(fun.isObject(), true);
+
+ QTest::ignoreMessage(QtWarningMsg, "Value from different engine returned from native function, returning undefined value instead.");
+ QScriptValue result = fun.call();
+ QCOMPARE(result.isValid(), true);
+ QCOMPARE(result.isUndefined(), true);
+ }
+}
+
+void tst_QScriptEngine::newObject()
+{
+ QScriptEngine engine;
+ QScriptValue object = engine.newObject();
+ QVERIFY(object.isObject());
+ QVERIFY(object.engine() == &engine);
+ QVERIFY(!object.isError());
+ QVERIFY(!object.equals(engine.newObject()));
+ QVERIFY(!object.strictlyEquals(engine.newObject()));
+ QCOMPARE(object.toString(), QString::fromAscii("[object Object]"));
+}
+
+void tst_QScriptEngine::globalObject()
+{
+ QScriptEngine engine;
+ QScriptValue global = engine.globalObject();
+ QScriptValue self = engine.evaluate("this");
+ QVERIFY(global.isObject());
+ QVERIFY(engine.globalObject().equals(engine.evaluate("this")));
+ QVERIFY(engine.globalObject().strictlyEquals(self));
+}
+
+/* Test garbage collection, at least try to not crash. */
+void tst_QScriptEngine::collectGarbage()
+{
+ QScriptEngine engine;
+ QScriptValue foo = engine.evaluate("( function foo() {return 'pong';} )");
+ QVERIFY(foo.isFunction());
+ engine.collectGarbage();
+ QCOMPARE(foo.call().toString(), QString::fromAscii("pong"));
+}
+
+void tst_QScriptEngine::reportAdditionalMemoryCost()
+{
+ // There isn't any easy way to test the responsiveness of the GC;
+ // just try to call the function a few times with various sizes.
+ QScriptEngine eng;
+ for (int i = 0; i < 100; ++i) {
+ eng.reportAdditionalMemoryCost(0);
+ eng.reportAdditionalMemoryCost(10);
+ eng.reportAdditionalMemoryCost(1000);
+ eng.reportAdditionalMemoryCost(10000);
+ eng.reportAdditionalMemoryCost(100000);
+ eng.reportAdditionalMemoryCost(1000000);
+ eng.reportAdditionalMemoryCost(10000000);
+ eng.reportAdditionalMemoryCost(-1);
+ eng.reportAdditionalMemoryCost(-1000);
+ QScriptValue obj = eng.evaluate("new Object");
+ eng.collectGarbage();
+ }
+}
+
+void tst_QScriptEngine::nullValue()
+{
+ QScriptEngine engine;
+ QScriptValue value = engine.nullValue();
+ QVERIFY(value.isValid());
+ QVERIFY(value.isNull());
+}
+
+void tst_QScriptEngine::undefinedValue()
+{
+ QScriptEngine engine;
+ QScriptValue value = engine.undefinedValue();
+ QVERIFY(value.isValid());
+ QVERIFY(value.isUndefined());
+}
+
+void tst_QScriptEngine::evaluateProgram()
+{
+ QScriptEngine eng;
+ {
+ QString code("1 + 2");
+ QString fileName("hello.js");
+ int lineNumber = 123;
+ QScriptProgram program(code, fileName, lineNumber);
+ QVERIFY(!program.isNull());
+ QCOMPARE(program.sourceCode(), code);
+ QCOMPARE(program.fileName(), fileName);
+ QCOMPARE(program.firstLineNumber(), lineNumber);
+
+ QScriptValue expected = eng.evaluate(code);
+ for (int x = 0; x < 10; ++x) {
+ QScriptValue ret = eng.evaluate(program);
+ QVERIFY(ret.equals(expected));
+ }
+
+ // operator=
+ QScriptProgram sameProgram = program;
+ QVERIFY(sameProgram == program);
+ QVERIFY(eng.evaluate(sameProgram).equals(expected));
+
+ // copy constructor
+ QScriptProgram sameProgram2(program);
+ QVERIFY(sameProgram2 == program);
+ QVERIFY(eng.evaluate(sameProgram2).equals(expected));
+
+ QScriptProgram differentProgram("2 + 3");
+ QVERIFY(differentProgram != program);
+ QVERIFY(!eng.evaluate(differentProgram).equals(expected));
+ }
+
+ // Program that accesses variable in the scope
+ {
+ QScriptProgram program("a");
+ QVERIFY(!program.isNull());
+ {
+ QScriptValue ret = eng.evaluate(program);
+ QVERIFY(ret.isError());
+ QCOMPARE(ret.toString(), QString::fromLatin1("ReferenceError: Can't find variable: a"));
+ }
+ {
+ QScriptValue ret = eng.evaluate(program);
+ QVERIFY(ret.isError());
+ }
+ eng.evaluate("a = 456");
+ {
+ QScriptValue ret = eng.evaluate(program);
+ QVERIFY(!ret.isError());
+ QCOMPARE(ret.toNumber(), 456.0);
+ }
+ }
+
+ // Program that creates closure
+ {
+ QScriptProgram program("(function() { var count = 0; return function() { return count++; }; })");
+ QVERIFY(!program.isNull());
+ QScriptValue createCounter = eng.evaluate(program);
+ QVERIFY(createCounter.isFunction());
+ QScriptValue counter = createCounter.call();
+ QVERIFY(counter.isFunction());
+ {
+ QScriptValue ret = counter.call();
+ QVERIFY(ret.isNumber());
+ }
+ QScriptValue counter2 = createCounter.call();
+ QVERIFY(counter2.isFunction());
+ QVERIFY(!counter2.equals(counter));
+ {
+ QScriptValue ret = counter2.call();
+ QVERIFY(ret.isNumber());
+ }
+ }
+
+ // Same program run in different engines
+ {
+ QString code("1 + 2");
+ QScriptProgram program(code);
+ QVERIFY(!program.isNull());
+ double expected = eng.evaluate(program).toNumber();
+ for (int x = 0; x < 2; ++x) {
+ QScriptEngine eng2;
+ for (int y = 0; y < 2; ++y) {
+ double ret = eng2.evaluate(program).toNumber();
+ QCOMPARE(ret, expected);
+ }
+ }
+ }
+
+ // No program
+ {
+ QScriptProgram program;
+ QVERIFY(program.isNull());
+ QScriptValue ret = eng.evaluate(program);
+ QVERIFY(!ret.isValid());
+ }
+}
+
+void tst_QScriptEngine::checkSyntax_data()
+{
+ QTest::addColumn<QString>("code");
+ QTest::addColumn<int>("expectedState");
+ QTest::addColumn<int>("errorLineNumber");
+ QTest::addColumn<int>("errorColumnNumber");
+ QTest::addColumn<QString>("errorMessage");
+
+ QTest::newRow("0")
+ << QString("0") << int(QScriptSyntaxCheckResult::Valid)
+ << -1 << -1 << "";
+ QTest::newRow("if (")
+ << QString("if (\n") << int(QScriptSyntaxCheckResult::Intermediate)
+ << 1 << 4 << "";
+ QTest::newRow("if else")
+ << QString("\nif else") << int(QScriptSyntaxCheckResult::Error)
+ << 2 << 4 << "SyntaxError: Parse error";
+ QTest::newRow("{if}")
+ << QString("{\n{\nif\n}\n") << int(QScriptSyntaxCheckResult::Error)
+ << 4 << 1 << "SyntaxError: Parse error";
+ QTest::newRow("foo[")
+ << QString("foo[") << int(QScriptSyntaxCheckResult::Error)
+ << 1 << 4 << "SyntaxError: Parse error";
+ QTest::newRow("foo['bar']")
+ << QString("foo['bar']") << int(QScriptSyntaxCheckResult::Valid)
+ << -1 << -1 << "";
+
+ QTest::newRow("/*")
+ << QString("/*") << int(QScriptSyntaxCheckResult::Intermediate)
+ << 1 << 1 << "Unclosed comment at end of file";
+ QTest::newRow("/*\nMy comment")
+ << QString("/*\nMy comment") << int(QScriptSyntaxCheckResult::Intermediate)
+ << 1 << 1 << "Unclosed comment at end of file";
+ QTest::newRow("/*\nMy comment */\nfoo = 10")
+ << QString("/*\nMy comment */\nfoo = 10") << int(QScriptSyntaxCheckResult::Valid)
+ << -1 << -1 << "";
+ QTest::newRow("foo = 10 /*")
+ << QString("foo = 10 /*") << int(QScriptSyntaxCheckResult::Intermediate)
+ << -1 << -1 << "";
+ QTest::newRow("foo = 10; /*")
+ << QString("foo = 10; /*") << int(QScriptSyntaxCheckResult::Intermediate)
+ << 1 << 11 << "Expected `end of file'";
+ QTest::newRow("foo = 10 /* My comment */")
+ << QString("foo = 10 /* My comment */") << int(QScriptSyntaxCheckResult::Valid)
+ << -1 << -1 << "";
+
+ QTest::newRow("/=/")
+ << QString("/=/") << int(QScriptSyntaxCheckResult::Valid) << -1 << -1 << "";
+ QTest::newRow("/=/g")
+ << QString("/=/g") << int(QScriptSyntaxCheckResult::Valid) << -1 << -1 << "";
+ QTest::newRow("/a/")
+ << QString("/a/") << int(QScriptSyntaxCheckResult::Valid) << -1 << -1 << "";
+ QTest::newRow("/a/g")
+ << QString("/a/g") << int(QScriptSyntaxCheckResult::Valid) << -1 << -1 << "";
+}
+
+void tst_QScriptEngine::checkSyntax()
+{
+ QFETCH(QString, code);
+ QFETCH(int, expectedState);
+ QFETCH(int, errorLineNumber);
+ QFETCH(int, errorColumnNumber);
+ QFETCH(QString, errorMessage);
+
+ QScriptSyntaxCheckResult result = QScriptEngine::checkSyntax(code);
+
+ // assignment
+ {
+ QScriptSyntaxCheckResult copy = result;
+ QCOMPARE(copy.state(), result.state());
+ QCOMPARE(copy.errorLineNumber(), result.errorLineNumber());
+ QCOMPARE(copy.errorColumnNumber(), result.errorColumnNumber());
+ QCOMPARE(copy.errorMessage(), result.errorMessage());
+ }
+ {
+ QScriptSyntaxCheckResult copy(result);
+ QCOMPARE(copy.state(), result.state());
+ QCOMPARE(copy.errorLineNumber(), result.errorLineNumber());
+ QCOMPARE(copy.errorColumnNumber(), result.errorColumnNumber());
+ QCOMPARE(copy.errorMessage(), result.errorMessage());
+ }
+
+ if (expectedState == QScriptSyntaxCheckResult::Intermediate)
+ QEXPECT_FAIL("", "QScriptSyntaxCheckResult::state() doesn't return the Intermediate state", Abort);
+ QCOMPARE(result.state(), QScriptSyntaxCheckResult::State(expectedState));
+ QCOMPARE(result.errorLineNumber(), errorLineNumber);
+ if (expectedState != QScriptSyntaxCheckResult::Valid && errorColumnNumber != 1)
+ QEXPECT_FAIL("", "QScriptSyntaxCheckResult::errorColumnNumber() doesn't return correct value", Continue);
+ QCOMPARE(result.errorColumnNumber(), errorColumnNumber);
+ QCOMPARE(result.errorMessage(), errorMessage);
+}
+
+void tst_QScriptEngine::toObject()
+{
+ QScriptEngine eng;
+ QVERIFY(!eng.toObject(eng.undefinedValue()).isValid());
+ QVERIFY(!eng.toObject(eng.nullValue()).isValid());
+ QVERIFY(!eng.toObject(QScriptValue()).isValid());
+
+ QScriptValue falskt(false);
+ {
+ QScriptValue tmp = eng.toObject(falskt);
+ QVERIFY(tmp.isObject());
+ QVERIFY(!falskt.isObject());
+ QVERIFY(!falskt.engine());
+ QCOMPARE(tmp.toNumber(), falskt.toNumber());
+ }
+
+ QScriptValue sant(true);
+ {
+ QScriptValue tmp = eng.toObject(sant);
+ QVERIFY(tmp.isObject());
+ QVERIFY(!sant.isObject());
+ QVERIFY(!sant.engine());
+ QCOMPARE(tmp.toNumber(), sant.toNumber());
+ }
+
+ QScriptValue number(123.0);
+ {
+ QScriptValue tmp = eng.toObject(number);
+ QVERIFY(tmp.isObject());
+ QVERIFY(!number.isObject());
+ QVERIFY(!number.engine());
+ QCOMPARE(tmp.toNumber(), number.toNumber());
+ }
+
+ QScriptValue str = QScriptValue(&eng, QString("ciao"));
+ {
+ QScriptValue tmp = eng.toObject(str);
+ QVERIFY(tmp.isObject());
+ QVERIFY(!str.isObject());
+ QCOMPARE(tmp.toString(), str.toString());
+ }
+
+ QScriptValue object = eng.evaluate("new Object");
+ {
+ QScriptValue tmp = eng.toObject(object);
+ QVERIFY(tmp.isObject());
+ QVERIFY(object.isObject());
+ QVERIFY(tmp.strictlyEquals(object));
+ }
+}
+
+void tst_QScriptEngine::toObjectTwoEngines()
+{
+ QScriptEngine engine1;
+ QScriptEngine engine2;
+
+ {
+ QScriptValue null = engine1.nullValue();
+ QTest::ignoreMessage(QtWarningMsg, "QScriptEngine::toObject: cannot convert value created in a different engine");
+ QVERIFY(!engine2.toObject(null).isValid());
+ QVERIFY(null.isValid());
+ QTest::ignoreMessage(QtWarningMsg, "QScriptEngine::toObject: cannot convert value created in a different engine");
+ QVERIFY(engine2.toObject(null).engine() != &engine2);
+ }
+ {
+ QScriptValue undefined = engine1.undefinedValue();
+ QTest::ignoreMessage(QtWarningMsg, "QScriptEngine::toObject: cannot convert value created in a different engine");
+ QVERIFY(!engine2.toObject(undefined).isValid());
+ QVERIFY(undefined.isValid());
+ QTest::ignoreMessage(QtWarningMsg, "QScriptEngine::toObject: cannot convert value created in a different engine");
+ QVERIFY(engine2.toObject(undefined).engine() != &engine2);
+ }
+ {
+ QScriptValue value = engine1.evaluate("1");
+ QTest::ignoreMessage(QtWarningMsg, "QScriptEngine::toObject: cannot convert value created in a different engine");
+ QVERIFY(engine2.toObject(value).engine() != &engine2);
+ QVERIFY(!value.isObject());
+ }
+ {
+ QScriptValue string = engine1.evaluate("'Qt'");
+ QTest::ignoreMessage(QtWarningMsg, "QScriptEngine::toObject: cannot convert value created in a different engine");
+ QVERIFY(engine2.toObject(string).engine() != &engine2);
+ QVERIFY(!string.isObject());
+ }
+ {
+ QScriptValue object = engine1.evaluate("new Object");
+ QTest::ignoreMessage(QtWarningMsg, "QScriptEngine::toObject: cannot convert value created in a different engine");
+ QVERIFY(engine2.toObject(object).engine() != &engine2);
+ QVERIFY(object.isObject());
+ }
+}
+
+void tst_QScriptEngine::newArray()
+{
+ QScriptEngine eng;
+ QScriptValue array = eng.newArray();
+ QCOMPARE(array.isValid(), true);
+ QCOMPARE(array.isArray(), true);
+ QCOMPARE(array.isObject(), true);
+ QVERIFY(!array.isFunction());
+ // QCOMPARE(array.scriptClass(), (QScriptClass*)0);
+
+ // Prototype should be Array.prototype.
+ QCOMPARE(array.prototype().isValid(), true);
+ QCOMPARE(array.prototype().isArray(), true);
+ QCOMPARE(array.prototype().strictlyEquals(eng.evaluate("Array.prototype")), true);
+
+ QScriptValue arrayWithSize = eng.newArray(42);
+ QCOMPARE(arrayWithSize.isValid(), true);
+ QCOMPARE(arrayWithSize.isArray(), true);
+ QCOMPARE(arrayWithSize.isObject(), true);
+ QCOMPARE(arrayWithSize.property("length").toInt32(), 42);
+
+ // task 218092
+ {
+ QScriptValue ret = eng.evaluate("[].splice(0, 0, 'a')");
+ QVERIFY(ret.isArray());
+ QCOMPARE(ret.property("length").toInt32(), 0);
+ }
+ {
+ QScriptValue ret = eng.evaluate("['a'].splice(0, 1, 'b')");
+ QVERIFY(ret.isArray());
+ QCOMPARE(ret.property("length").toInt32(), 1);
+ }
+ {
+ QScriptValue ret = eng.evaluate("['a', 'b'].splice(0, 1, 'c')");
+ QVERIFY(ret.isArray());
+ QCOMPARE(ret.property("length").toInt32(), 1);
+ }
+ {
+ QScriptValue ret = eng.evaluate("['a', 'b', 'c'].splice(0, 2, 'd')");
+ QVERIFY(ret.isArray());
+ QCOMPARE(ret.property("length").toInt32(), 2);
+ }
+ {
+ QScriptValue ret = eng.evaluate("['a', 'b', 'c'].splice(1, 2, 'd', 'e', 'f')");
+ QVERIFY(ret.isArray());
+ QCOMPARE(ret.property("length").toInt32(), 2);
+ }
+}
+
+void tst_QScriptEngine::uncaughtException()
+{
+ QScriptEngine eng;
+ QScriptValue fun = eng.evaluate("(function foo () { return null; });");
+ QVERIFY(!eng.uncaughtException().isValid());
+ QVERIFY(fun.isFunction());
+ QScriptValue throwFun = eng.evaluate("( function() { throw new Error('Pong'); });");
+ QVERIFY(throwFun.isFunction());
+ {
+ eng.evaluate("a = 10");
+ QVERIFY(!eng.hasUncaughtException());
+ QVERIFY(!eng.uncaughtException().isValid());
+ }
+ {
+ eng.evaluate("1 = 2");
+ QVERIFY(eng.hasUncaughtException());
+ eng.clearExceptions();
+ QVERIFY(!eng.hasUncaughtException());
+ }
+ {
+ // Check if the call or toString functions can remove the last exception.
+ QVERIFY(throwFun.call().isError());
+ QVERIFY(eng.hasUncaughtException());
+ QScriptValue exception = eng.uncaughtException();
+ fun.call();
+ exception.toString();
+ QVERIFY(eng.hasUncaughtException());
+ QVERIFY(eng.uncaughtException().strictlyEquals(exception));
+ }
+ eng.clearExceptions();
+ {
+ // Check if in the call function a new exception can override an existing one.
+ throwFun.call();
+ QVERIFY(eng.hasUncaughtException());
+ QScriptValue exception = eng.uncaughtException();
+ throwFun.call();
+ QVERIFY(eng.hasUncaughtException());
+ QVERIFY(!exception.strictlyEquals(eng.uncaughtException()));
+ }
+ {
+ eng.evaluate("throwFun = (function foo () { throw new Error('bla') });");
+ eng.evaluate("1;\nthrowFun();");
+ QVERIFY(eng.hasUncaughtException());
+ QCOMPARE(eng.uncaughtExceptionLineNumber(), 1);
+ eng.clearExceptions();
+ QVERIFY(!eng.hasUncaughtException());
+ }
+ for (int x = 1; x < 4; ++x) {
+ QScriptValue ret = eng.evaluate("a = 10;\nb = 20;\n0 = 0;\n",
+ QString::fromLatin1("FooScript") + QString::number(x),
+ /* lineNumber */ x);
+ QVERIFY(eng.hasUncaughtException());
+ QCOMPARE(eng.uncaughtExceptionLineNumber(), x + 2);
+ QVERIFY(eng.uncaughtException().strictlyEquals(ret));
+ QVERIFY(eng.hasUncaughtException());
+ QVERIFY(eng.uncaughtException().strictlyEquals(ret));
+ QString backtrace = QString::fromLatin1("<anonymous>()@FooScript") + QString::number(x) + ":" + QString::number(x + 2);
+ QCOMPARE(eng.uncaughtExceptionBacktrace().join(""), backtrace);
+ QVERIFY(fun.call().isNull());
+ QVERIFY(eng.hasUncaughtException());
+ QCOMPARE(eng.uncaughtExceptionLineNumber(), x + 2);
+ QVERIFY(eng.uncaughtException().strictlyEquals(ret));
+ eng.clearExceptions();
+ QVERIFY(!eng.hasUncaughtException());
+ QCOMPARE(eng.uncaughtExceptionLineNumber(), -1);
+ QVERIFY(!eng.uncaughtException().isValid());
+ eng.evaluate("2 = 3");
+ QVERIFY(eng.hasUncaughtException());
+ QScriptValue ret2 = throwFun.call();
+ QVERIFY(ret2.isError());
+ QVERIFY(eng.hasUncaughtException());
+ QVERIFY(eng.uncaughtException().strictlyEquals(ret2));
+ QCOMPARE(eng.uncaughtExceptionLineNumber(), 1);
+ eng.clearExceptions();
+ QVERIFY(!eng.hasUncaughtException());
+ eng.evaluate("1 + 2");
+ QVERIFY(!eng.hasUncaughtException());
+ }
+}
+
+void tst_QScriptEngine::newDate()
+{
+ QScriptEngine eng;
+ {
+ QScriptValue date = eng.newDate(0);
+ QCOMPARE(date.isValid(), true);
+ QCOMPARE(date.isDate(), true);
+ QCOMPARE(date.isObject(), true);
+ QVERIFY(!date.isFunction());
+ // prototype should be Date.prototype
+ QCOMPARE(date.prototype().isValid(), true);
+ QCOMPARE(date.prototype().isDate(), true);
+ QCOMPARE(date.prototype().strictlyEquals(eng.evaluate("Date.prototype")), true);
+ }
+ {
+ QDateTime dt = QDateTime(QDate(1, 2, 3), QTime(4, 5, 6, 7), Qt::LocalTime);
+ QScriptValue date = eng.newDate(dt);
+ QCOMPARE(date.isValid(), true);
+ QCOMPARE(date.isDate(), true);
+ QCOMPARE(date.isObject(), true);
+ // prototype should be Date.prototype
+ QCOMPARE(date.prototype().isValid(), true);
+ QCOMPARE(date.prototype().isDate(), true);
+ QCOMPARE(date.prototype().strictlyEquals(eng.evaluate("Date.prototype")), true);
+
+ QCOMPARE(date.toDateTime(), dt);
+ }
+ {
+ QDateTime dt = QDateTime(QDate(1, 2, 3), QTime(4, 5, 6, 7), Qt::UTC);
+ QScriptValue date = eng.newDate(dt);
+ // toDateTime() result should be in local time
+ QCOMPARE(date.toDateTime(), dt.toLocalTime());
+ }
+ // Date.parse() should return NaN when it fails
+ {
+ QScriptValue ret = eng.evaluate("Date.parse()");
+ QVERIFY(ret.isNumber());
+ QVERIFY(qIsNaN(ret.toNumber()));
+ }
+ // Date.parse() should be able to parse the output of Date().toString()
+ {
+ QScriptValue ret = eng.evaluate("var x = new Date(); var s = x.toString(); s == new Date(Date.parse(s)).toString()");
+ QVERIFY(ret.isBoolean());
+ QCOMPARE(ret.toBoolean(), true);
+ }
+}
+
+QTEST_MAIN(tst_QScriptEngine)
+#include "tst_qscriptengine.moc"
diff --git a/Source/JavaScriptCore/qt/tests/qscriptstring/qscriptstring.pro b/Source/JavaScriptCore/qt/tests/qscriptstring/qscriptstring.pro
new file mode 100644
index 0000000..5ad9b7c
--- /dev/null
+++ b/Source/JavaScriptCore/qt/tests/qscriptstring/qscriptstring.pro
@@ -0,0 +1,7 @@
+TEMPLATE = app
+TARGET = tst_qscriptstring
+QT += testlib
+include(../tests.pri)
+
+SOURCES += tst_qscriptstring.cpp
+
diff --git a/Source/JavaScriptCore/qt/tests/qscriptstring/tst_qscriptstring.cpp b/Source/JavaScriptCore/qt/tests/qscriptstring/tst_qscriptstring.cpp
new file mode 100644
index 0000000..ff31835
--- /dev/null
+++ b/Source/JavaScriptCore/qt/tests/qscriptstring/tst_qscriptstring.cpp
@@ -0,0 +1,175 @@
+/*
+ Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef tst_qscriptstring_h
+#define tst_qscriptstring_h
+
+#include "qscriptengine.h"
+#include "qscriptstring.h"
+#include <QtCore/qhash.h>
+#include <QtTest/QtTest>
+
+class tst_QScriptString : public QObject {
+ Q_OBJECT
+
+public:
+ tst_QScriptString();
+ virtual ~tst_QScriptString();
+
+private slots:
+ void test();
+ void hash();
+ void toArrayIndex_data();
+ void toArrayIndex();
+};
+
+tst_QScriptString::tst_QScriptString()
+{
+}
+
+tst_QScriptString::~tst_QScriptString()
+{
+}
+
+void tst_QScriptString::test()
+{
+ QScriptEngine eng;
+ {
+ QScriptString str;
+ QVERIFY(!str.isValid());
+ QVERIFY(str == str);
+ QVERIFY(!(str != str));
+ QVERIFY(str.toString().isNull());
+
+ QScriptString str1(str);
+ QVERIFY(!str1.isValid());
+
+ QScriptString str2 = str;
+ QVERIFY(!str2.isValid());
+
+ QCOMPARE(str.toArrayIndex(), quint32(0xffffffff));
+ }
+ for (int x = 0; x < 2; ++x) {
+ QString ciao = QString::fromLatin1("ciao");
+ QScriptString str = eng.toStringHandle(ciao);
+ QVERIFY(str.isValid());
+ QVERIFY(str == str);
+ QVERIFY(!(str != str));
+ QCOMPARE(str.toString(), ciao);
+
+ QScriptString str1(str);
+ QCOMPARE(str, str1);
+
+ QScriptString str2 = str;
+ QCOMPARE(str, str2);
+
+ QScriptString str3 = eng.toStringHandle(ciao);
+ QVERIFY(str3.isValid());
+ QCOMPARE(str, str3);
+
+ eng.collectGarbage();
+
+ QVERIFY(str.isValid());
+ QCOMPARE(str.toString(), ciao);
+ QVERIFY(str1.isValid());
+ QCOMPARE(str1.toString(), ciao);
+ QVERIFY(str2.isValid());
+ QCOMPARE(str2.toString(), ciao);
+ QVERIFY(str3.isValid());
+ QCOMPARE(str3.toString(), ciao);
+ }
+ {
+ QScriptEngine* eng2 = new QScriptEngine;
+ QString one = QString::fromLatin1("one");
+ QString two = QString::fromLatin1("two");
+ QScriptString oneInterned = eng2->toStringHandle(one);
+ QCOMPARE(oneInterned.toString(), one);
+ QScriptString twoInterned = eng2->toStringHandle(two);
+ QCOMPARE(twoInterned.toString(), two);
+ QVERIFY(oneInterned != twoInterned);
+ QVERIFY(!(oneInterned == twoInterned));
+
+ delete eng2;
+ }
+}
+
+void tst_QScriptString::hash()
+{
+ QScriptEngine engine;
+ QHash<QScriptString, int> stringToInt;
+ QScriptString foo = engine.toStringHandle("foo");
+
+ QScriptString bar = engine.toStringHandle("bar");
+ QVERIFY(!stringToInt.contains(foo));
+ for (int i = 0; i < 1000000; ++i)
+ stringToInt.insert(foo, 123);
+ QCOMPARE(stringToInt.value(foo), 123);
+ QVERIFY(!stringToInt.contains(bar));
+ stringToInt.insert(bar, 456);
+ QCOMPARE(stringToInt.value(bar), 456);
+ QCOMPARE(stringToInt.value(foo), 123);
+}
+
+void tst_QScriptString::toArrayIndex_data()
+{
+ QTest::addColumn<QString>("input");
+ QTest::addColumn<bool>("expectSuccess");
+ QTest::addColumn<quint32>("expectedIndex");
+ QTest::newRow("foo") << QString::fromLatin1("foo") << false << quint32(0xffffffff);
+ QTest::newRow("empty") << QString::fromLatin1("") << false << quint32(0xffffffff);
+ QTest::newRow("0") << QString::fromLatin1("0") << true << quint32(0);
+ QTest::newRow("00") << QString::fromLatin1("00") << false << quint32(0xffffffff);
+ QTest::newRow("1") << QString::fromLatin1("1") << true << quint32(1);
+ QTest::newRow("123") << QString::fromLatin1("123") << true << quint32(123);
+ QTest::newRow("-1") << QString::fromLatin1("-1") << false << quint32(0xffffffff);
+ QTest::newRow("0a") << QString::fromLatin1("0a") << false << quint32(0xffffffff);
+ QTest::newRow("0x1") << QString::fromLatin1("0x1") << false << quint32(0xffffffff);
+ QTest::newRow("01") << QString::fromLatin1("01") << false << quint32(0xffffffff);
+ QTest::newRow("101a") << QString::fromLatin1("101a") << false << quint32(0xffffffff);
+ QTest::newRow("4294967294") << QString::fromLatin1("4294967294") << true << quint32(0xfffffffe);
+ QTest::newRow("4294967295") << QString::fromLatin1("4294967295") << false << quint32(0xffffffff);
+ QTest::newRow("11111111111") << QString::fromLatin1("11111111111") << false << quint32(0xffffffff);
+ QTest::newRow("0.0") << QString::fromLatin1("0.0") << false << quint32(0xffffffff);
+ QTest::newRow("1.0") << QString::fromLatin1("1.0") << false << quint32(0xffffffff);
+ QTest::newRow("1.5") << QString::fromLatin1("1.5") << false << quint32(0xffffffff);
+ QTest::newRow("1.") << QString::fromLatin1("1.") << false << quint32(0xffffffff);
+ QTest::newRow(".1") << QString::fromLatin1(".1") << false << quint32(0xffffffff);
+ QTest::newRow("1e0") << QString::fromLatin1("1e0") << false << quint32(0xffffffff);
+}
+
+void tst_QScriptString::toArrayIndex()
+{
+ QFETCH(QString, input);
+ QFETCH(bool, expectSuccess);
+ QFETCH(quint32, expectedIndex);
+ QScriptEngine engine;
+ for (int x = 0; x < 2; ++x) {
+ bool isArrayIndex;
+ bool* ptr = (!x) ? &isArrayIndex : (bool*)0;
+ quint32 result = engine.toStringHandle(input).toArrayIndex(ptr);
+ if (!x)
+ QCOMPARE(isArrayIndex, expectSuccess);
+ QCOMPARE(result, expectedIndex);
+ }
+}
+
+QTEST_MAIN(tst_QScriptString)
+#include "tst_qscriptstring.moc"
+
+#endif // tst_qscriptstring_h
diff --git a/Source/JavaScriptCore/qt/tests/qscriptvalue/qscriptvalue.pro b/Source/JavaScriptCore/qt/tests/qscriptvalue/qscriptvalue.pro
new file mode 100644
index 0000000..02e94ec
--- /dev/null
+++ b/Source/JavaScriptCore/qt/tests/qscriptvalue/qscriptvalue.pro
@@ -0,0 +1,15 @@
+TEMPLATE = app
+TARGET = tst_qscriptvalue
+QT += testlib
+isEmpty(OUTPUT_DIR): OUTPUT_DIR = ../../../..
+include(../tests.pri)
+
+SOURCES += \
+ tst_qscriptvalue.cpp \
+ tst_qscriptvalue_generated_init.cpp \
+ tst_qscriptvalue_generated_comparison.cpp \
+ tst_qscriptvalue_generated_istype.cpp \
+ tst_qscriptvalue_generated_totype.cpp \
+
+HEADERS += \
+ tst_qscriptvalue.h
diff --git a/Source/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue.cpp b/Source/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue.cpp
new file mode 100644
index 0000000..e04d3e9
--- /dev/null
+++ b/Source/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue.cpp
@@ -0,0 +1,1296 @@
+/*
+ Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include "tst_qscriptvalue.h"
+#include <QtCore/qnumeric.h>
+
+tst_QScriptValue::tst_QScriptValue()
+ : m_engine(0)
+{
+}
+
+tst_QScriptValue::~tst_QScriptValue()
+{
+ delete m_engine;
+}
+
+void tst_QScriptValue::ctor()
+{
+ QScriptEngine eng;
+ {
+ QScriptValue v;
+ QCOMPARE(v.isValid(), false);
+ QCOMPARE(v.engine(), (QScriptEngine*)0);
+ }
+ {
+ QScriptValue v(&eng, QScriptValue::UndefinedValue);
+ QCOMPARE(v.isValid(), true);
+ QCOMPARE(v.isUndefined(), true);
+ QCOMPARE(v.isObject(), false);
+ QCOMPARE(v.engine(), &eng);
+ }
+ {
+ QScriptValue v(&eng, QScriptValue::NullValue);
+ QCOMPARE(v.isValid(), true);
+ QCOMPARE(v.isNull(), true);
+ QCOMPARE(v.isObject(), false);
+ QCOMPARE(v.engine(), &eng);
+ }
+ {
+ QScriptValue v(&eng, false);
+ QCOMPARE(v.isValid(), true);
+ QCOMPARE(v.isBoolean(), true);
+ QCOMPARE(v.isBool(), true);
+ QCOMPARE(v.isObject(), false);
+ QCOMPARE(v.toBoolean(), false);
+ QCOMPARE(v.engine(), &eng);
+ }
+ {
+ QScriptValue v(&eng, int(1));
+ QCOMPARE(v.isValid(), true);
+ QCOMPARE(v.isNumber(), true);
+ QCOMPARE(v.isObject(), false);
+ QCOMPARE(v.toNumber(), 1.0);
+ QCOMPARE(v.engine(), &eng);
+ }
+ {
+ QScriptValue v(int(0x43211234));
+ QVERIFY(v.isNumber());
+ QCOMPARE(v.toInt32(), 0x43211234);
+ }
+ {
+ QScriptValue v(&eng, uint(1));
+ QCOMPARE(v.isValid(), true);
+ QCOMPARE(v.isNumber(), true);
+ QCOMPARE(v.isObject(), false);
+ QCOMPARE(v.toNumber(), 1.0);
+ QCOMPARE(v.engine(), &eng);
+ }
+ {
+ QScriptValue v(uint(0x43211234));
+ QVERIFY(v.isNumber());
+ QCOMPARE(v.toUInt32(), uint(0x43211234));
+ }
+ {
+ QScriptValue v(&eng, 1.0);
+ QCOMPARE(v.isValid(), true);
+ QCOMPARE(v.isNumber(), true);
+ QCOMPARE(v.isObject(), false);
+ QCOMPARE(v.toNumber(), 1.0);
+ QCOMPARE(v.engine(), &eng);
+ }
+ {
+ QScriptValue v(12345678910.5);
+ QVERIFY(v.isNumber());
+ QCOMPARE(v.toNumber(), 12345678910.5);
+ }
+ {
+ QScriptValue v(&eng, "ciao");
+ QCOMPARE(v.isValid(), true);
+ QCOMPARE(v.isString(), true);
+ QCOMPARE(v.isObject(), false);
+ QCOMPARE(v.toString(), QLatin1String("ciao"));
+ QCOMPARE(v.engine(), &eng);
+ }
+ {
+ QScriptValue v(&eng, QString("ciao"));
+ QCOMPARE(v.isValid(), true);
+ QCOMPARE(v.isString(), true);
+ QCOMPARE(v.isObject(), false);
+ QCOMPARE(v.toString(), QLatin1String("ciao"));
+ QCOMPARE(v.engine(), &eng);
+ }
+ // copy constructor, operator=
+ {
+ QScriptValue v(&eng, 1.0);
+ QScriptValue v2(v);
+ QCOMPARE(v2.strictlyEquals(v), true);
+ QCOMPARE(v2.engine(), &eng);
+
+ QScriptValue v3(v);
+ QCOMPARE(v3.strictlyEquals(v), true);
+ QCOMPARE(v3.strictlyEquals(v2), true);
+ QCOMPARE(v3.engine(), &eng);
+
+ QScriptValue v4(&eng, 2.0);
+ QCOMPARE(v4.strictlyEquals(v), false);
+ v3 = v4;
+ QCOMPARE(v3.strictlyEquals(v), false);
+ QCOMPARE(v3.strictlyEquals(v4), true);
+
+ v2 = QScriptValue();
+ QCOMPARE(v2.strictlyEquals(v), false);
+ QCOMPARE(v.toNumber(), 1.0);
+
+ QScriptValue v5(v);
+ QCOMPARE(v5.strictlyEquals(v), true);
+ v = QScriptValue();
+ QCOMPARE(v5.strictlyEquals(v), false);
+ QCOMPARE(v5.toNumber(), 1.0);
+ }
+
+ // constructors that take no engine argument
+ {
+ QScriptValue v(QScriptValue::UndefinedValue);
+ QCOMPARE(v.isValid(), true);
+ QCOMPARE(v.isUndefined(), true);
+ QCOMPARE(v.isObject(), false);
+ QCOMPARE(v.engine(), (QScriptEngine*)0);
+ }
+ {
+ QScriptValue v(QScriptValue::NullValue);
+ QCOMPARE(v.isValid(), true);
+ QCOMPARE(v.isNull(), true);
+ QCOMPARE(v.isObject(), false);
+ QCOMPARE(v.engine(), (QScriptEngine*)0);
+ }
+ {
+ QScriptValue v(false);
+ QCOMPARE(v.isValid(), true);
+ QCOMPARE(v.isBoolean(), true);
+ QCOMPARE(v.isBool(), true);
+ QCOMPARE(v.isObject(), false);
+ QCOMPARE(v.toBoolean(), false);
+ QCOMPARE(v.engine(), (QScriptEngine*)0);
+ }
+ {
+ QScriptValue v(int(1));
+ QCOMPARE(v.isValid(), true);
+ QCOMPARE(v.isNumber(), true);
+ QCOMPARE(v.isObject(), false);
+ QCOMPARE(v.toNumber(), 1.0);
+ QCOMPARE(v.engine(), (QScriptEngine*)0);
+ }
+ {
+ QScriptValue v(uint(1));
+ QCOMPARE(v.isValid(), true);
+ QCOMPARE(v.isNumber(), true);
+ QCOMPARE(v.isObject(), false);
+ QCOMPARE(v.toNumber(), 1.0);
+ QCOMPARE(v.engine(), (QScriptEngine*)0);
+ }
+ {
+ QScriptValue v(1.0);
+ QCOMPARE(v.isValid(), true);
+ QCOMPARE(v.isNumber(), true);
+ QCOMPARE(v.isObject(), false);
+ QCOMPARE(v.toNumber(), 1.0);
+ QCOMPARE(v.engine(), (QScriptEngine*)0);
+ }
+ {
+ QScriptValue v("ciao");
+ QCOMPARE(v.isValid(), true);
+ QCOMPARE(v.isString(), true);
+ QCOMPARE(v.isObject(), false);
+ QCOMPARE(v.toString(), QLatin1String("ciao"));
+ QCOMPARE(v.engine(), (QScriptEngine*)0);
+ }
+ {
+ QScriptValue v(QString("ciao"));
+ QCOMPARE(v.isValid(), true);
+ QCOMPARE(v.isString(), true);
+ QCOMPARE(v.isObject(), false);
+ QCOMPARE(v.toString(), QLatin1String("ciao"));
+ QCOMPARE(v.engine(), (QScriptEngine*)0);
+ }
+ // copy constructor, operator=
+ {
+ QScriptValue v(1.0);
+ QScriptValue v2(v);
+ QCOMPARE(v2.strictlyEquals(v), true);
+ QCOMPARE(v2.engine(), (QScriptEngine*)0);
+
+ QScriptValue v3(v);
+ QCOMPARE(v3.strictlyEquals(v), true);
+ QCOMPARE(v3.strictlyEquals(v2), true);
+ QCOMPARE(v3.engine(), (QScriptEngine*)0);
+
+ QScriptValue v4(2.0);
+ QCOMPARE(v4.strictlyEquals(v), false);
+ v3 = v4;
+ QCOMPARE(v3.strictlyEquals(v), false);
+ QCOMPARE(v3.strictlyEquals(v4), true);
+
+ v2 = QScriptValue();
+ QCOMPARE(v2.strictlyEquals(v), false);
+ QCOMPARE(v.toNumber(), 1.0);
+
+ QScriptValue v5(v);
+ QCOMPARE(v5.strictlyEquals(v), true);
+ v = QScriptValue();
+ QCOMPARE(v5.strictlyEquals(v), false);
+ QCOMPARE(v5.toNumber(), 1.0);
+ }
+
+ // 0 engine
+ QVERIFY(QScriptValue(0, QScriptValue::UndefinedValue).isUndefined());
+ QVERIFY(QScriptValue(0, QScriptValue::NullValue).isNull());
+ QVERIFY(QScriptValue(0, false).isBool());
+ QVERIFY(QScriptValue(0, int(1)).isNumber());
+ QVERIFY(QScriptValue(0, uint(1)).isNumber());
+ QVERIFY(QScriptValue(0, 1.0).isNumber());
+ QVERIFY(QScriptValue(0, "ciao").isString());
+ QVERIFY(QScriptValue(0, QString("ciao")).isString());
+}
+
+void tst_QScriptValue::getPropertySimple_data()
+{
+ QTest::addColumn<QString>("code");
+ QTest::addColumn<QString>("propertyName");
+ QTest::addColumn<QString>("desc");
+ QTest::addColumn<bool>("isArrayIndex");
+
+ QTest::newRow("new Array()")
+ << QString::fromAscii("new Array()")
+ << QString::fromAscii("length")
+ << QString::fromAscii("0")
+ << false;
+ QTest::newRow("new Object().length")
+ << QString::fromAscii("new Object()")
+ << QString::fromAscii("length")
+ << QString::fromAscii("") // Undefined is an invalid property.
+ << false;
+ QTest::newRow("new Object().toString")
+ << QString::fromAscii("new Object()")
+ << QString::fromAscii("toString")
+ << QString::fromAscii("function toString() {\n [native code]\n}")
+ << false;
+ QTest::newRow("[1,2,3,4]")
+ << QString::fromAscii("[1,2,3,'s',4]")
+ << QString::fromAscii("2")
+ << QString::fromAscii("3")
+ << true;
+ QTest::newRow("[1,3,'a','b']")
+ << QString::fromAscii("[1,3,'a','b']")
+ << QString::fromAscii("3")
+ << QString::fromAscii("b")
+ << true;
+ QTest::newRow("[4,5]")
+ << QString::fromAscii("[4,5]")
+ << QString::fromAscii("123")
+ << QString::fromAscii("") // Undefined is an invalid property.
+ << true;
+ QTest::newRow("[1,3,4]")
+ << QString::fromAscii("[1,3,4]")
+ << QString::fromAscii("abc")
+ << QString::fromAscii("") // Undefined is an invalid property.
+ << true;
+}
+
+void tst_QScriptValue::getPropertySimple()
+{
+ QFETCH(QString, code);
+ QFETCH(QString, propertyName);
+ QFETCH(QString, desc);
+
+ QScriptEngine engine;
+ QScriptValue object = engine.evaluate(code);
+ QVERIFY(object.isValid());
+ {
+ QScriptValue property = object.property(propertyName);
+ QCOMPARE(property.toString(), desc);
+ }
+ {
+ QScriptString name = engine.toStringHandle(propertyName);
+ QScriptValue property = object.property(name);
+ QCOMPARE(property.toString(), desc);
+ }
+ {
+ bool ok;
+ quint32 idx = engine.toStringHandle(propertyName).toArrayIndex(&ok);
+ if (ok) {
+ QScriptValue property = object.property(idx);
+ QCOMPARE(property.toString(), desc);
+ }
+ }
+}
+
+void tst_QScriptValue::setPropertySimple()
+{
+ QScriptEngine engine;
+ {
+ QScriptValue invalid;
+ QScriptValue property(1234);
+
+ invalid.setProperty("aaa", property);
+ invalid.setProperty(13, property);
+ invalid.setProperty(engine.toStringHandle("aaa"), property);
+
+ QVERIFY(!invalid.property("aaa").isValid());
+ QVERIFY(!invalid.property(13).isValid());
+ QVERIFY(!invalid.property(engine.toStringHandle("aaa")).isValid());
+ }
+ {
+ QScriptValue object = engine.newObject();
+ QScriptValue property;
+
+ object.setProperty(13, property);
+ object.setProperty("aaa", property);
+ object.setProperty(engine.toStringHandle("aaa"), property);
+
+ QVERIFY(!object.property(13).isValid());
+ QVERIFY(!object.property("aaa").isValid());
+ QVERIFY(!object.property(engine.toStringHandle("aaa")).isValid());
+ }
+ {
+ // Check if setting an invalid property works as deleteProperty.
+ QScriptValue object = engine.evaluate("o = {13: 0, 'aaa': 3, 'bbb': 1}");
+ QScriptValue property;
+
+ QVERIFY(object.property(13).isValid());
+ QVERIFY(object.property("aaa").isValid());
+ QVERIFY(object.property(engine.toStringHandle("aaa")).isValid());
+
+ object.setProperty(13, property);
+ object.setProperty("aaa", property);
+ object.setProperty(engine.toStringHandle("bbb"), property);
+
+ QVERIFY(!object.property(13).isValid());
+ QVERIFY(!object.property("aaa").isValid());
+ QVERIFY(!object.property(engine.toStringHandle("aaa")).isValid());
+ }
+ {
+ QScriptValue object = engine.evaluate("new Object");
+ QVERIFY(object.isObject());
+ QScriptValue property = object.property("foo");
+ QVERIFY(!property.isValid());
+ property = QScriptValue(2);
+ object.setProperty("foo", property);
+ QVERIFY(object.property("foo").isNumber());
+ QVERIFY(object.property("foo").toNumber() == 2);
+ }
+ {
+ QScriptValue o1 = engine.evaluate("o1 = new Object; o1");
+ QScriptValue o2 = engine.evaluate("o2 = new Object; o2");
+ QVERIFY(engine.evaluate("o1.__proto__ = o2; o1.__proto__ === o2").toBool());
+ QVERIFY(engine.evaluate("o2.foo = 22; o1.foo == 22").toBool());
+ QVERIFY(o1.property("foo").toString() == "22");
+ o2.setProperty("foo", QScriptValue(&engine, 456.0));
+ QVERIFY(engine.evaluate("o1.foo == 456").toBool());
+ QVERIFY(o1.property("foo").isNumber());
+ }
+}
+
+void tst_QScriptValue::getPropertyResolveFlag()
+{
+ QScriptEngine engine;
+ QScriptValue object1 = engine.evaluate("o1 = new Object();");
+ QScriptValue object2 = engine.evaluate("o2 = new Object(); o1.__proto__ = o2; o2");
+ QScriptValue number(&engine, 456.0);
+ QVERIFY(object1.isObject());
+ QVERIFY(object2.isObject());
+ QVERIFY(number.isNumber());
+
+ object2.setProperty("propertyInPrototype", number);
+ QVERIFY(object2.property("propertyInPrototype").isNumber());
+ // default is ResolvePrototype
+ QCOMPARE(object1.property("propertyInPrototype").strictlyEquals(number), true);
+ QCOMPARE(object1.property("propertyInPrototype", QScriptValue::ResolvePrototype)
+ .strictlyEquals(number), true);
+ QCOMPARE(object1.property("propertyInPrototype", QScriptValue::ResolveLocal).isValid(), false);
+}
+
+void tst_QScriptValue::getSetProperty()
+{
+ QScriptEngine eng;
+
+ QScriptValue object = eng.newObject();
+
+ QScriptValue str = QScriptValue(&eng, "bar");
+ object.setProperty("foo", str);
+ QCOMPARE(object.property("foo").toString(), str.toString());
+
+ QScriptValue num = QScriptValue(&eng, 123.0);
+ object.setProperty("baz", num);
+ QCOMPARE(object.property("baz").toNumber(), num.toNumber());
+
+ QScriptValue strstr = QScriptValue("bar");
+ QCOMPARE(strstr.engine(), (QScriptEngine *)0);
+ object.setProperty("foo", strstr);
+ QCOMPARE(object.property("foo").toString(), strstr.toString());
+ QCOMPARE(strstr.engine(), &eng); // the value has been bound to the engine
+
+ QScriptValue numnum = QScriptValue(123.0);
+ object.setProperty("baz", numnum);
+ QCOMPARE(object.property("baz").toNumber(), numnum.toNumber());
+
+ QScriptValue inv;
+ inv.setProperty("foo", num);
+ QCOMPARE(inv.property("foo").isValid(), false);
+
+ QScriptValue array = eng.newArray();
+ array.setProperty(0, num);
+ QCOMPARE(array.property(0).toNumber(), num.toNumber());
+ QCOMPARE(array.property("0").toNumber(), num.toNumber());
+ QCOMPARE(array.property("length").toUInt32(), quint32(1));
+ array.setProperty(1, str);
+ QCOMPARE(array.property(1).toString(), str.toString());
+ QCOMPARE(array.property("1").toString(), str.toString());
+ QCOMPARE(array.property("length").toUInt32(), quint32(2));
+ array.setProperty("length", QScriptValue(&eng, 1));
+ QCOMPARE(array.property("length").toUInt32(), quint32(1));
+ QCOMPARE(array.property(1).isValid(), false);
+
+ // task 162051 -- detecting whether the property is an array index or not
+ QVERIFY(eng.evaluate("a = []; a['00'] = 123; a['00']").strictlyEquals(QScriptValue(&eng, 123)));
+ QVERIFY(eng.evaluate("a.length").strictlyEquals(QScriptValue(&eng, 0)));
+ QVERIFY(eng.evaluate("a.hasOwnProperty('00')").strictlyEquals(QScriptValue(&eng, true)));
+ QVERIFY(eng.evaluate("a.hasOwnProperty('0')").strictlyEquals(QScriptValue(&eng, false)));
+ QVERIFY(eng.evaluate("a[0]").isUndefined());
+ QVERIFY(eng.evaluate("a[0.5] = 456; a[0.5]").strictlyEquals(QScriptValue(&eng, 456)));
+ QVERIFY(eng.evaluate("a.length").strictlyEquals(QScriptValue(&eng, 0)));
+ QVERIFY(eng.evaluate("a.hasOwnProperty('0.5')").strictlyEquals(QScriptValue(&eng, true)));
+ QVERIFY(eng.evaluate("a[0]").isUndefined());
+ QVERIFY(eng.evaluate("a[0] = 789; a[0]").strictlyEquals(QScriptValue(&eng, 789)));
+ QVERIFY(eng.evaluate("a.length").strictlyEquals(QScriptValue(&eng, 1)));
+
+ // task 183072 -- 0x800000000 is not an array index
+ eng.evaluate("a = []; a[0x800000000] = 123");
+ QVERIFY(eng.evaluate("a.length").strictlyEquals(QScriptValue(&eng, 0)));
+ QVERIFY(eng.evaluate("a[0]").isUndefined());
+ QVERIFY(eng.evaluate("a[0x800000000]").strictlyEquals(QScriptValue(&eng, 123)));
+
+ QScriptEngine otherEngine;
+ QScriptValue otherNum = QScriptValue(&otherEngine, 123);
+ QTest::ignoreMessage(QtWarningMsg, "QScriptValue::setProperty() failed: cannot set value created in a different engine");
+ object.setProperty("oof", otherNum);
+ QCOMPARE(object.property("oof").isValid(), false);
+
+ // test ResolveMode
+ QScriptValue object2 = eng.newObject();
+ object.setPrototype(object2);
+ QScriptValue num2 = QScriptValue(&eng, 456.0);
+ object2.setProperty("propertyInPrototype", num2);
+ // default is ResolvePrototype
+ QCOMPARE(object.property("propertyInPrototype")
+ .strictlyEquals(num2), true);
+ QCOMPARE(object.property("propertyInPrototype", QScriptValue::ResolvePrototype)
+ .strictlyEquals(num2), true);
+ QCOMPARE(object.property("propertyInPrototype", QScriptValue::ResolveLocal)
+ .isValid(), false);
+ QEXPECT_FAIL("", "QScriptValue::ResolveScope is not implemented", Continue);
+ QCOMPARE(object.property("propertyInPrototype", QScriptValue::ResolveScope)
+ .strictlyEquals(num2), false);
+ QCOMPARE(object.property("propertyInPrototype", QScriptValue::ResolveFull)
+ .strictlyEquals(num2), true);
+
+ // test property removal (setProperty(QScriptValue()))
+ QScriptValue object3 = eng.newObject();
+ object3.setProperty("foo", num);
+ QCOMPARE(object3.property("foo").strictlyEquals(num), true);
+ object3.setProperty("bar", str);
+ QCOMPARE(object3.property("bar").strictlyEquals(str), true);
+ object3.setProperty("foo", QScriptValue());
+ QCOMPARE(object3.property("foo").isValid(), false);
+ QCOMPARE(object3.property("bar").strictlyEquals(str), true);
+ object3.setProperty("foo", num);
+ QCOMPARE(object3.property("foo").strictlyEquals(num), true);
+ QCOMPARE(object3.property("bar").strictlyEquals(str), true);
+ object3.setProperty("bar", QScriptValue());
+ QCOMPARE(object3.property("bar").isValid(), false);
+ QCOMPARE(object3.property("foo").strictlyEquals(num), true);
+ object3.setProperty("foo", QScriptValue());
+ object3.setProperty("foo", QScriptValue());
+
+ eng.globalObject().setProperty("object3", object3);
+ QCOMPARE(eng.evaluate("object3.hasOwnProperty('foo')")
+ .strictlyEquals(QScriptValue(&eng, false)), true);
+ object3.setProperty("foo", num);
+ QCOMPARE(eng.evaluate("object3.hasOwnProperty('foo')")
+ .strictlyEquals(QScriptValue(&eng, true)), true);
+ eng.globalObject().setProperty("object3", QScriptValue());
+ QCOMPARE(eng.evaluate("this.hasOwnProperty('object3')")
+ .strictlyEquals(QScriptValue(&eng, false)), true);
+
+ eng.globalObject().setProperty("object", object);
+
+ // ReadOnly
+ object.setProperty("readOnlyProperty", num, QScriptValue::ReadOnly);
+ // QCOMPARE(object.propertyFlags("readOnlyProperty"), QScriptValue::ReadOnly);
+ QCOMPARE(object.property("readOnlyProperty").strictlyEquals(num), true);
+ eng.evaluate("object.readOnlyProperty = !object.readOnlyProperty");
+ QCOMPARE(object.property("readOnlyProperty").strictlyEquals(num), true);
+ // Should still be part of enumeration.
+ {
+ QScriptValue ret = eng.evaluate(
+ "found = false;"
+ "for (var p in object) {"
+ " if (p == 'readOnlyProperty') {"
+ " found = true; break;"
+ " }"
+ "} found");
+ QCOMPARE(ret.strictlyEquals(QScriptValue(&eng, true)), true);
+ }
+ // should still be deletable
+ {
+ QScriptValue ret = eng.evaluate("delete object.readOnlyProperty");
+ QCOMPARE(ret.strictlyEquals(QScriptValue(&eng, true)), true);
+ QCOMPARE(object.property("readOnlyProperty").isValid(), false);
+ }
+
+ // Undeletable
+ object.setProperty("undeletableProperty", num, QScriptValue::Undeletable);
+ // QCOMPARE(object.propertyFlags("undeletableProperty"), QScriptValue::Undeletable);
+ QCOMPARE(object.property("undeletableProperty").strictlyEquals(num), true);
+ {
+ QScriptValue ret = eng.evaluate("delete object.undeletableProperty");
+ QCOMPARE(ret.strictlyEquals(QScriptValue(&eng, true)), false);
+ QCOMPARE(object.property("undeletableProperty").strictlyEquals(num), true);
+ }
+ // should still be writable
+ eng.evaluate("object.undeletableProperty = object.undeletableProperty + 1");
+ QCOMPARE(object.property("undeletableProperty").toNumber(), num.toNumber() + 1);
+ // should still be part of enumeration
+ {
+ QScriptValue ret = eng.evaluate(
+ "found = false;"
+ "for (var p in object) {"
+ " if (p == 'undeletableProperty') {"
+ " found = true; break;"
+ " }"
+ "} found");
+ QCOMPARE(ret.strictlyEquals(QScriptValue(&eng, true)), true);
+ }
+ // should still be deletable from C++
+ object.setProperty("undeletableProperty", QScriptValue());
+ QEXPECT_FAIL("", "With JSC-based back-end, undeletable properties can't be deleted from C++", Continue);
+ QVERIFY(!object.property("undeletableProperty").isValid());
+ // QEXPECT_FAIL("", "With JSC-based back-end, undeletable properties can't be deleted from C++", Continue);
+ // QCOMPARE(object.propertyFlags("undeletableProperty"), 0);
+
+ // SkipInEnumeration
+ object.setProperty("dontEnumProperty", num, QScriptValue::SkipInEnumeration);
+ // QCOMPARE(object.propertyFlags("dontEnumProperty"), QScriptValue::SkipInEnumeration);
+ QCOMPARE(object.property("dontEnumProperty").strictlyEquals(num), true);
+ // should not be part of enumeration
+ {
+ QScriptValue ret = eng.evaluate(
+ "found = false;"
+ "for (var p in object) {"
+ " if (p == 'dontEnumProperty') {"
+ " found = true; break;"
+ " }"
+ "} found");
+ QCOMPARE(ret.strictlyEquals(QScriptValue(&eng, false)), true);
+ }
+ // should still be writable
+ eng.evaluate("object.dontEnumProperty = object.dontEnumProperty + 1");
+ QCOMPARE(object.property("dontEnumProperty").toNumber(), num.toNumber() + 1);
+ // should still be deletable
+ {
+ QScriptValue ret = eng.evaluate("delete object.dontEnumProperty");
+ QCOMPARE(ret.strictlyEquals(QScriptValue(&eng, true)), true);
+ QCOMPARE(object.property("dontEnumProperty").isValid(), false);
+ }
+
+ // change flags
+ object.setProperty("flagProperty", str);
+ // QCOMPARE(object.propertyFlags("flagProperty"), static_cast<QScriptValue::PropertyFlags>(0));
+
+ object.setProperty("flagProperty", str, QScriptValue::ReadOnly);
+ // QCOMPARE(object.propertyFlags("flagProperty"), QScriptValue::ReadOnly);
+
+ // object.setProperty("flagProperty", str, object.propertyFlags("flagProperty") | QScriptValue::SkipInEnumeration);
+ // QCOMPARE(object.propertyFlags("flagProperty"), QScriptValue::ReadOnly | QScriptValue::SkipInEnumeration);
+
+ object.setProperty("flagProperty", str, QScriptValue::KeepExistingFlags);
+ // QCOMPARE(object.propertyFlags("flagProperty"), QScriptValue::ReadOnly | QScriptValue::SkipInEnumeration);
+
+ object.setProperty("flagProperty", str, QScriptValue::UserRange);
+ // QCOMPARE(object.propertyFlags("flagProperty"), QScriptValue::UserRange);
+
+ // flags of property in the prototype
+ {
+ QScriptValue object2 = eng.newObject();
+ object2.setPrototype(object);
+ // QCOMPARE(object2.propertyFlags("flagProperty", QScriptValue::ResolveLocal), 0);
+ // QCOMPARE(object2.propertyFlags("flagProperty"), QScriptValue::UserRange);
+ }
+
+ // using interned strings
+ QScriptString foo = eng.toStringHandle("foo");
+
+ object.setProperty(foo, QScriptValue());
+ QVERIFY(!object.property(foo).isValid());
+
+ object.setProperty(foo, num);
+ QVERIFY(object.property(foo).strictlyEquals(num));
+ QVERIFY(object.property("foo").strictlyEquals(num));
+ // QVERIFY(object.propertyFlags(foo) == 0);
+}
+
+void tst_QScriptValue::toStringSimple_data()
+{
+ QTest::addColumn<QString>("code");
+ QTest::addColumn<QString>("result");
+
+ QTest::newRow("string") << QString::fromAscii("'hello'") << QString::fromAscii("hello");
+ QTest::newRow("string utf") << QString::fromUtf8("'ąśćżźółńę'") << QString::fromUtf8("ąśćżźółńę");
+ QTest::newRow("expression") << QString::fromAscii("1 + 4") << QString::fromAscii("5");
+ QTest::newRow("null") << QString::fromAscii("null") << QString::fromAscii("null");
+ QTest::newRow("boolean") << QString::fromAscii("false") << QString::fromAscii("false");
+ QTest::newRow("undefined") << QString::fromAscii("undefined") << QString::fromAscii("undefined");
+ QTest::newRow("object") << QString::fromAscii("new Object") << QString::fromAscii("[object Object]");
+}
+
+/* Test conversion to string from different JSC types */
+void tst_QScriptValue::toStringSimple()
+{
+ QFETCH(QString, code);
+ QFETCH(QString, result);
+
+ QScriptEngine engine;
+ QCOMPARE(engine.evaluate(code).toString(), result);
+}
+
+void tst_QScriptValue::copyConstructor_data()
+{
+ QScriptEngine engine;
+ QScriptValue nnumber(123);
+ QScriptValue nstring("ping");
+ QScriptValue number(engine.evaluate("1"));
+ QScriptValue string(engine.evaluate("'foo'"));
+ QScriptValue object(engine.evaluate("new Object"));
+ QScriptValue undefined(engine.evaluate("undefined"));
+ QScriptValue null(engine.evaluate("null"));
+
+ QTest::addColumn<QScriptValue>("value");
+ QTest::addColumn<QString>("result");
+
+ QTest::newRow("native number") << nnumber << QString::number(123);
+ QTest::newRow("native string") << nstring << QString("ping");
+ QTest::newRow("number") << number << QString::fromAscii("1");
+ QTest::newRow("string") << string << QString::fromAscii("foo");
+ QTest::newRow("object") << object << QString::fromAscii("[object Object]");
+ QTest::newRow("undefined") << undefined << QString::fromAscii("undefined");
+ QTest::newRow("null") << null << QString::fromAscii("null");
+}
+
+void tst_QScriptValue::copyConstructor()
+{
+ QFETCH(QScriptValue, value);
+ QFETCH(QString, result);
+
+ QVERIFY(value.isValid());
+ QScriptValue tmp(value);
+ QVERIFY(tmp.isValid());
+ QCOMPARE(tmp.toString(), result);
+}
+
+void tst_QScriptValue::assignOperator_data()
+{
+ copyConstructor_data();
+}
+
+void tst_QScriptValue::assignOperator()
+{
+ QFETCH(QScriptValue, value);
+ QFETCH(QString, result);
+
+ QScriptValue tmp;
+ tmp = value;
+ QVERIFY(tmp.isValid());
+ QCOMPARE(tmp.toString(), result);
+}
+
+/* Test internal data sharing between a diffrenet QScriptValue. */
+void tst_QScriptValue::dataSharing()
+{
+ QScriptEngine engine;
+ QScriptValue v1;
+ QScriptValue v2(v1);
+
+ v1 = engine.evaluate("1"); // v1 == 1 ; v2 invalid.
+ QVERIFY(v1.isValid());
+ QVERIFY(!v2.isValid());
+
+ v2 = v1; // v1 == 1; v2 == 1.
+ QVERIFY(v1.isValid());
+ QVERIFY(v2.isValid());
+
+ v1 = engine.evaluate("obj = new Date"); // v1 == [object Date] ; v2 == 1.
+ QVERIFY(v1.isValid());
+ QVERIFY(v2.isValid());
+ QVERIFY(v2.toString() != v1.toString());
+
+ // TODO add object manipulation (v1 and v2 point to the same object).
+}
+
+void tst_QScriptValue::constructors_data()
+{
+ QScriptEngine engine;
+
+ QTest::addColumn<QScriptValue>("value");
+ QTest::addColumn<QString>("string");
+ QTest::addColumn<bool>("valid");
+ QTest::addColumn<bool>("object");
+
+ QTest::newRow("invalid") << QScriptValue() << QString() << false << false;
+ QTest::newRow("number") << QScriptValue(-21) << QString::number(-21) << true << false;
+ QTest::newRow("bool") << QScriptValue(true) << QString::fromAscii("true") << true << false;
+ QTest::newRow("double") << QScriptValue(21.12) << QString::number(21.12) << true << false;
+ QTest::newRow("string") << QScriptValue("AlaMaKota") << QString::fromAscii("AlaMaKota") << true << false;
+ QTest::newRow("object") << engine.evaluate("new Object") << QString::fromAscii("[object Object]") << true << true;
+ QTest::newRow("null") << QScriptValue(QScriptValue::NullValue)<< QString::fromAscii("null") << true << false;
+ QTest::newRow("undef") << QScriptValue(QScriptValue::UndefinedValue)<< QString::fromAscii("undefined") << true << false;
+}
+
+void tst_QScriptValue::constructors()
+{
+ QFETCH(QScriptValue, value);
+ QFETCH(QString, string);
+ QFETCH(bool, valid);
+ QFETCH(bool, object);
+
+ QCOMPARE(value.isValid(), valid);
+ QCOMPARE(value.toString(), string);
+ QCOMPARE(value.isObject(), object);
+}
+
+void tst_QScriptValue::call()
+{
+ QScriptEngine engine;
+ QScriptValue ping = engine.evaluate("( function() {return 'ping';} )");
+ QScriptValue incr = engine.evaluate("( function(i) {return i + 1;} )");
+ QScriptValue one(1);
+ QScriptValue five(5);
+ QScriptValue result;
+
+ QVERIFY(one.isValid());
+ QVERIFY(five.isValid());
+
+ QVERIFY(ping.isValid());
+ QVERIFY(ping.isFunction());
+ result = ping.call();
+ QVERIFY(result.isValid());
+ QCOMPARE(result.toString(), QString::fromUtf8("ping"));
+
+ QVERIFY(incr.isValid());
+ QVERIFY(incr.isFunction());
+ result = incr.call(QScriptValue(), QScriptValueList() << one);
+ QVERIFY(result.isValid());
+ QCOMPARE(result.toString(), QString("2"));
+
+ QCOMPARE(incr.call(QScriptValue(), QScriptValueList() << five).toString(), QString::fromAscii("6"));
+
+ QVERIFY(incr.call().isValid()); // Exception.
+}
+
+void tst_QScriptValue::getSetPrototype()
+{
+ QScriptEngine engine;
+ QScriptValue object = engine.evaluate("new Object()");
+ QScriptValue object2 = engine.evaluate("new Object()");
+ object2.setPrototype(object);
+ QCOMPARE(object2.prototype().strictlyEquals(object), true);
+
+ QScriptValue inv;
+ inv.setPrototype(object);
+ QCOMPARE(inv.prototype().isValid(), false);
+
+ QScriptEngine otherEngine;
+ QScriptValue object3 = otherEngine.evaluate("new Object()");
+ QTest::ignoreMessage(QtWarningMsg, "QScriptValue::setPrototype() failed: cannot set a prototype created in a different engine");
+ object2.setPrototype(object3);
+ QCOMPARE(object2.prototype().strictlyEquals(object), true);
+
+ // cyclic prototypes
+ {
+ QScriptValue ret = engine.evaluate("o = { }; p = { }; o.__proto__ = p; p.__proto__ = o");
+ QCOMPARE(ret.isError(), true);
+ QCOMPARE(ret.toString(), QLatin1String("Error: cyclic __proto__ value"));
+ }
+ {
+ QScriptValue ret = engine.evaluate("p.__proto__ = { }");
+ QCOMPARE(ret.isError(), false);
+ }
+
+ QScriptValue old = object.prototype();
+ QTest::ignoreMessage(QtWarningMsg, "QScriptValue::setPrototype() failed: cyclic prototype value");
+ object.setPrototype(object);
+ QCOMPARE(object.prototype().strictlyEquals(old), true);
+
+ object2.setPrototype(object);
+ QTest::ignoreMessage(QtWarningMsg, "QScriptValue::setPrototype() failed: cyclic prototype value");
+ object.setPrototype(object2);
+ QCOMPARE(object.prototype().strictlyEquals(old), true);
+}
+
+void tst_QScriptValue::toObjectSimple()
+{
+ QScriptEngine eng;
+
+ QScriptValue undefined = eng.undefinedValue();
+ QCOMPARE(undefined.toObject().isValid(), false);
+ QScriptValue null = eng.nullValue();
+ QCOMPARE(null.toObject().isValid(), false);
+ QCOMPARE(QScriptValue().toObject().isValid(), false);
+
+ QScriptValue falskt = QScriptValue(&eng, false);
+ {
+ QScriptValue tmp = falskt.toObject();
+ QCOMPARE(tmp.isObject(), true);
+ QCOMPARE(falskt.isObject(), false);
+ QCOMPARE(tmp.toNumber(), falskt.toNumber());
+ }
+
+ QScriptValue sant = QScriptValue(&eng, true);
+ {
+ QScriptValue tmp = sant.toObject();
+ QCOMPARE(tmp.isObject(), true);
+ QCOMPARE(sant.isObject(), false);
+ QCOMPARE(tmp.toNumber(), sant.toNumber());
+ }
+
+ QScriptValue number = QScriptValue(&eng, 123.0);
+ {
+ QScriptValue tmp = number.toObject();
+ QCOMPARE(tmp.isObject(), true);
+ QCOMPARE(number.isObject(), false);
+ QCOMPARE(tmp.toNumber(), number.toNumber());
+ }
+
+ QScriptValue str = QScriptValue(&eng, QString("ciao"));
+ {
+ QScriptValue tmp = str.toObject();
+ QCOMPARE(tmp.isObject(), true);
+ QCOMPARE(str.isObject(), false);
+ QCOMPARE(tmp.toString(), str.toString());
+ }
+
+
+ QScriptValue object = eng.evaluate("new Object");
+ {
+ QScriptValue tmp = object.toObject();
+ QVERIFY(tmp.strictlyEquals(object));
+ QCOMPARE(tmp.isObject(), true);
+ }
+
+
+ // V2 constructors: in this case, you have to use QScriptEngine::toObject()
+ {
+ QScriptValue undefined = QScriptValue(QScriptValue::UndefinedValue);
+ QVERIFY(!undefined.toObject().isValid());
+ QVERIFY(!eng.toObject(undefined).isValid());
+ QVERIFY(!undefined.engine());
+
+ QScriptValue null = QScriptValue(QScriptValue::NullValue);
+ QVERIFY(!null.toObject().isValid());
+ QVERIFY(!eng.toObject(null).isValid());
+ QVERIFY(!null.engine());
+
+ QScriptValue falskt = QScriptValue(false);
+ QVERIFY(!falskt.toObject().isValid());
+ QCOMPARE(falskt.isObject(), false);
+ QVERIFY(!falskt.engine());
+ {
+ QScriptValue tmp = eng.toObject(falskt);
+ QVERIFY(tmp.isObject());
+ QVERIFY(tmp.toBool());
+ QVERIFY(!falskt.isObject());
+ }
+
+ QScriptValue sant = QScriptValue(true);
+ QVERIFY(!sant.toObject().isValid());
+ QCOMPARE(sant.isObject(), false);
+ QVERIFY(!sant.engine());
+ {
+ QScriptValue tmp = eng.toObject(sant);
+ QVERIFY(tmp.isObject());
+ QVERIFY(tmp.toBool());
+ QVERIFY(!sant.isObject());
+ }
+
+ QScriptValue number = QScriptValue(123.0);
+ QVERIFY(!number.toObject().isValid());
+ QVERIFY(!number.engine());
+ QCOMPARE(number.isObject(), false);
+ {
+ QScriptValue tmp = eng.toObject(number);
+ QVERIFY(tmp.isObject());
+ QCOMPARE(tmp.toInt32(), number.toInt32());
+ QVERIFY(!number.isObject());
+ }
+
+ QScriptValue str = QScriptValue(QString::fromLatin1("ciao"));
+ QVERIFY(!str.toObject().isValid());
+ QVERIFY(!str.engine());
+ QCOMPARE(str.isObject(), false);
+ {
+ QScriptValue tmp = eng.toObject(str);
+ QVERIFY(tmp.isObject());
+ QCOMPARE(tmp.toString(), QString::fromLatin1("ciao"));
+ QVERIFY(!str.isObject());
+ }
+ }
+}
+
+void tst_QScriptValue::setProperty_data()
+{
+ QTest::addColumn<QScriptValue>("property");
+ QTest::addColumn<int>("flag");
+
+ QTest::newRow("int + keepExistingFlags") << QScriptValue(123456) << static_cast<int>(QScriptValue::KeepExistingFlags);
+ QTest::newRow("int + undeletable") << QScriptValue(123456) << static_cast<int>(QScriptValue::Undeletable);
+ QTest::newRow("int + readOnly") << QScriptValue(123456) << static_cast<int>(QScriptValue::ReadOnly);
+ QTest::newRow("int + readOnly|undeletable") << QScriptValue(123456) << static_cast<int>(QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ QTest::newRow("int + skipInEnumeration") << QScriptValue(123456) << static_cast<int>(QScriptValue::SkipInEnumeration);
+ QTest::newRow("int + skipInEnumeration|readOnly") << QScriptValue(123456) << static_cast<int>(QScriptValue::SkipInEnumeration | QScriptValue::ReadOnly);
+ QTest::newRow("int + skipInEnumeration|undeletable") << QScriptValue(123456) << static_cast<int>(QScriptValue::SkipInEnumeration | QScriptValue::Undeletable);
+ QTest::newRow("int + skipInEnumeration|readOnly|undeletable") << QScriptValue(123456) << static_cast<int>(QScriptValue::SkipInEnumeration | QScriptValue::ReadOnly | QScriptValue::Undeletable);
+}
+
+void tst_QScriptValue::setProperty()
+{
+ QFETCH(QScriptValue, property);
+ QFETCH(int, flag);
+ QScriptValue::PropertyFlags flags = static_cast<QScriptValue::PropertyFlag>(flag);
+
+ QScriptEngine engine;
+ QScriptValue object = engine.evaluate("o = new Object; o");
+ QScriptValue proto = engine.evaluate("p = new Object; o.__proto__ = p; p");
+ engine.evaluate("o.defined1 = 1");
+ engine.evaluate("o.defined2 = 1");
+ engine.evaluate("o[5] = 1");
+ engine.evaluate("p.overloaded1 = 1");
+ engine.evaluate("o.overloaded1 = 2");
+ engine.evaluate("p[6] = 1");
+ engine.evaluate("o[6] = 2");
+ engine.evaluate("p.overloaded2 = 1");
+ engine.evaluate("o.overloaded2 = 2");
+ engine.evaluate("p.overloaded3 = 1");
+ engine.evaluate("o.overloaded3 = 2");
+ engine.evaluate("p[7] = 1");
+ engine.evaluate("o[7] = 2");
+ engine.evaluate("p.overloaded4 = 1");
+ engine.evaluate("o.overloaded4 = 2");
+
+ // tries to set undefined property directly on object.
+ object.setProperty(QString::fromAscii("undefined1"), property, flags);
+ QVERIFY(engine.evaluate("o.undefined1").strictlyEquals(property));
+ object.setProperty(engine.toStringHandle("undefined2"), property, flags);
+ QVERIFY(object.property("undefined2").strictlyEquals(property));
+ object.setProperty(4, property, flags);
+ QVERIFY(object.property(4).strictlyEquals(property));
+
+ // tries to set defined property directly on object
+ object.setProperty("defined1", property, flags);
+ QVERIFY(engine.evaluate("o.defined1").strictlyEquals(property));
+ object.setProperty(engine.toStringHandle("defined2"), property, flags);
+ QVERIFY(object.property("defined2").strictlyEquals(property));
+ object.setProperty(5, property, flags);
+ QVERIFY(object.property(5).strictlyEquals(property));
+
+ // tries to set overloaded property directly on object
+ object.setProperty("overloaded1", property, flags);
+ QVERIFY(engine.evaluate("o.overloaded1").strictlyEquals(property));
+ object.setProperty(engine.toStringHandle("overloaded2"), property, flags);
+ QVERIFY(object.property("overloaded2").strictlyEquals(property));
+ object.setProperty(6, property, flags);
+ QVERIFY(object.property(6).strictlyEquals(property));
+
+ // tries to set overloaded property directly on prototype
+ proto.setProperty("overloaded3", property, flags);
+ QVERIFY(!engine.evaluate("o.overloaded3").strictlyEquals(property));
+ proto.setProperty(engine.toStringHandle("overloaded4"), property, flags);
+ QVERIFY(!object.property("overloaded4").strictlyEquals(property));
+ proto.setProperty(7, property, flags);
+ QVERIFY(!object.property(7).strictlyEquals(property));
+
+ // tries to set undefined property directly on prototype
+ proto.setProperty("undefined3", property, flags);
+ QVERIFY(engine.evaluate("o.undefined3").strictlyEquals(property));
+ proto.setProperty(engine.toStringHandle("undefined4"), property, flags);
+ QVERIFY(object.property("undefined4").strictlyEquals(property));
+ proto.setProperty(8, property, flags);
+ QVERIFY(object.property(8).strictlyEquals(property));
+
+ bool readOnly = flags & QScriptValue::ReadOnly;
+ bool skipInEnumeration = flags & QScriptValue::SkipInEnumeration;
+ bool undeletable = flags & QScriptValue::Undeletable;
+
+ QVERIFY(readOnly == engine.evaluate("!Object.getOwnPropertyDescriptor(o, '4').writable").toBool());
+ QEXPECT_FAIL("int + readOnly", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + readOnly|undeletable", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + skipInEnumeration|readOnly", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + skipInEnumeration|readOnly|undeletable", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QVERIFY(readOnly == engine.evaluate("!Object.getOwnPropertyDescriptor(o, '5').writable").toBool());
+ QEXPECT_FAIL("int + readOnly", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + readOnly|undeletable", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + skipInEnumeration|readOnly", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + skipInEnumeration|readOnly|undeletable", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QVERIFY(readOnly == engine.evaluate("!Object.getOwnPropertyDescriptor(o, '6').writable").toBool());
+ QEXPECT_FAIL("int + readOnly", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + readOnly|undeletable", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + skipInEnumeration|readOnly", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + skipInEnumeration|readOnly|undeletable", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QVERIFY(readOnly == engine.evaluate("!Object.getOwnPropertyDescriptor(p, '7').writable").toBool());
+ QVERIFY(readOnly == engine.evaluate("!Object.getOwnPropertyDescriptor(p, '8').writable").toBool());
+ QVERIFY(readOnly == engine.evaluate("!Object.getOwnPropertyDescriptor(o, 'undefined1').writable").toBool());
+ QVERIFY(readOnly == engine.evaluate("!Object.getOwnPropertyDescriptor(o, 'undefined2').writable").toBool());
+ QVERIFY(readOnly == engine.evaluate("!Object.getOwnPropertyDescriptor(p, 'undefined3').writable").toBool());
+ QVERIFY(readOnly == engine.evaluate("!Object.getOwnPropertyDescriptor(p, 'undefined4').writable").toBool());
+ QEXPECT_FAIL("int + readOnly", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + readOnly|undeletable", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + skipInEnumeration|readOnly", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + skipInEnumeration|readOnly|undeletable", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QVERIFY(readOnly == engine.evaluate("!Object.getOwnPropertyDescriptor(o, 'defined1').writable").toBool());
+ QEXPECT_FAIL("int + readOnly", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + readOnly|undeletable", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + skipInEnumeration|readOnly", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + skipInEnumeration|readOnly|undeletable", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QVERIFY(readOnly == engine.evaluate("!Object.getOwnPropertyDescriptor(o, 'defined2').writable").toBool());
+ QVERIFY(engine.evaluate("!Object.getOwnPropertyDescriptor(p, 'undefined1').writable").toBool());
+ QVERIFY(engine.evaluate("!Object.getOwnPropertyDescriptor(p, 'undefined1').writable").toBool());
+ QEXPECT_FAIL("int + readOnly", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + readOnly|undeletable", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + skipInEnumeration|readOnly", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + skipInEnumeration|readOnly|undeletable", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QVERIFY(readOnly == engine.evaluate("!Object.getOwnPropertyDescriptor(p, 'overloaded3').writable").toBool());
+ QEXPECT_FAIL("int + readOnly", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + readOnly|undeletable", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + skipInEnumeration|readOnly", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + skipInEnumeration|readOnly|undeletable", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QVERIFY(readOnly == engine.evaluate("!Object.getOwnPropertyDescriptor(p, 'overloaded4').writable").toBool());
+ QEXPECT_FAIL("int + readOnly", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + readOnly|undeletable", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + skipInEnumeration|readOnly", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + skipInEnumeration|readOnly|undeletable", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QVERIFY(readOnly == engine.evaluate("!Object.getOwnPropertyDescriptor(o, 'overloaded1').writable").toBool());
+ QEXPECT_FAIL("int + readOnly", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + readOnly|undeletable", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + skipInEnumeration|readOnly", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + skipInEnumeration|readOnly|undeletable", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QVERIFY(readOnly == engine.evaluate("!Object.getOwnPropertyDescriptor(o, 'overloaded2').writable").toBool());
+ QVERIFY(!engine.evaluate("!Object.getOwnPropertyDescriptor(o, 'overloaded3').writable").toBool());
+ QVERIFY(!engine.evaluate("!Object.getOwnPropertyDescriptor(o, 'overloaded4').writable").toBool());
+
+ QVERIFY(undeletable == engine.evaluate("!Object.getOwnPropertyDescriptor(o, '4').configurable").toBool());
+ QEXPECT_FAIL("int + undeletable", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + readOnly|undeletable", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + skipInEnumeration|undeletable", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + skipInEnumeration|readOnly|undeletable", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QVERIFY(undeletable == engine.evaluate("!Object.getOwnPropertyDescriptor(o, '5').configurable").toBool());
+ QEXPECT_FAIL("int + undeletable", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + readOnly|undeletable", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + skipInEnumeration|undeletable", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + skipInEnumeration|readOnly|undeletable", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QVERIFY(undeletable == engine.evaluate("!Object.getOwnPropertyDescriptor(o, '6').configurable").toBool());
+ QEXPECT_FAIL("int + undeletable", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + readOnly|undeletable", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + skipInEnumeration|undeletable", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + skipInEnumeration|readOnly|undeletable", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QVERIFY(undeletable == engine.evaluate("!Object.getOwnPropertyDescriptor(p, '7').configurable").toBool());
+ QVERIFY(undeletable == engine.evaluate("!Object.getOwnPropertyDescriptor(p, '8').configurable").toBool());
+ QVERIFY(undeletable == engine.evaluate("!Object.getOwnPropertyDescriptor(o, 'undefined1').configurable").toBool());
+ QVERIFY(undeletable == engine.evaluate("!Object.getOwnPropertyDescriptor(o, 'undefined2').configurable").toBool());
+ QVERIFY(undeletable == engine.evaluate("!Object.getOwnPropertyDescriptor(p, 'undefined3').configurable").toBool());
+ QVERIFY(undeletable == engine.evaluate("!Object.getOwnPropertyDescriptor(p, 'undefined4').configurable").toBool());
+ QEXPECT_FAIL("int + undeletable", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + readOnly|undeletable", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + skipInEnumeration|undeletable", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + skipInEnumeration|readOnly|undeletable", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QVERIFY(undeletable == engine.evaluate("!Object.getOwnPropertyDescriptor(o, 'defined1').configurable").toBool());
+ QEXPECT_FAIL("int + undeletable", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + readOnly|undeletable", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + skipInEnumeration|undeletable", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + skipInEnumeration|readOnly|undeletable", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QVERIFY(undeletable == engine.evaluate("!Object.getOwnPropertyDescriptor(o, 'defined2').configurable").toBool());
+ QEXPECT_FAIL("int + undeletable", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + readOnly|undeletable", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + skipInEnumeration|undeletable", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + skipInEnumeration|readOnly|undeletable", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QVERIFY(undeletable == engine.evaluate("!Object.getOwnPropertyDescriptor(o, 'overloaded1').configurable").toBool());
+ QEXPECT_FAIL("int + undeletable", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + readOnly|undeletable", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + skipInEnumeration|undeletable", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + skipInEnumeration|readOnly|undeletable", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QVERIFY(undeletable == engine.evaluate("!Object.getOwnPropertyDescriptor(o, 'overloaded2').configurable").toBool());
+ QVERIFY(engine.evaluate("Object.getOwnPropertyDescriptor(p, 'overloaded1').configurable").toBool());
+ QVERIFY(engine.evaluate("Object.getOwnPropertyDescriptor(p, 'overloaded2').configurable").toBool());
+ QVERIFY(engine.evaluate("Object.getOwnPropertyDescriptor(o, 'overloaded3').configurable").toBool());
+ QVERIFY(engine.evaluate("Object.getOwnPropertyDescriptor(o, 'overloaded4').configurable").toBool());
+ QEXPECT_FAIL("int + undeletable", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + readOnly|undeletable", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + skipInEnumeration|undeletable", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + skipInEnumeration|readOnly|undeletable", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QVERIFY(undeletable == engine.evaluate("!Object.getOwnPropertyDescriptor(p, 'overloaded3').configurable").toBool());
+ QEXPECT_FAIL("int + undeletable", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + readOnly|undeletable", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + skipInEnumeration|undeletable", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + skipInEnumeration|readOnly|undeletable", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QVERIFY(undeletable == engine.evaluate("!Object.getOwnPropertyDescriptor(p, 'overloaded4').configurable").toBool());
+
+ QVERIFY(skipInEnumeration != engine.evaluate("Object.getOwnPropertyDescriptor(o, '4').enumerable").toBool());
+ QEXPECT_FAIL("int + skipInEnumeration", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + skipInEnumeration|undeletable", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + skipInEnumeration|readOnly", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + skipInEnumeration|readOnly|undeletable", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QVERIFY(skipInEnumeration != engine.evaluate("Object.getOwnPropertyDescriptor(o, '5').enumerable").toBool());
+ QEXPECT_FAIL("int + skipInEnumeration", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + skipInEnumeration|undeletable", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + skipInEnumeration|readOnly", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + skipInEnumeration|readOnly|undeletable", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QVERIFY(skipInEnumeration != engine.evaluate("Object.getOwnPropertyDescriptor(o, '6').enumerable").toBool());
+ QEXPECT_FAIL("int + skipInEnumeration", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + skipInEnumeration|undeletable", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + skipInEnumeration|readOnly", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + skipInEnumeration|readOnly|undeletable", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QVERIFY(skipInEnumeration != engine.evaluate("Object.getOwnPropertyDescriptor(p, '7').enumerable").toBool());
+ QVERIFY(skipInEnumeration != engine.evaluate("Object.getOwnPropertyDescriptor(p, '8').enumerable").toBool());
+ QVERIFY(skipInEnumeration != engine.evaluate("Object.getOwnPropertyDescriptor(o, 'undefined1').enumerable").toBool());
+ QVERIFY(skipInEnumeration != engine.evaluate("Object.getOwnPropertyDescriptor(o, 'undefined2').enumerable").toBool());
+ QVERIFY(skipInEnumeration != engine.evaluate("Object.getOwnPropertyDescriptor(p, 'undefined3').enumerable").toBool());
+ QVERIFY(skipInEnumeration != engine.evaluate("Object.getOwnPropertyDescriptor(p, 'undefined4').enumerable").toBool());
+ QEXPECT_FAIL("int + skipInEnumeration", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + skipInEnumeration|undeletable", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + skipInEnumeration|readOnly", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + skipInEnumeration|readOnly|undeletable", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QVERIFY(skipInEnumeration != engine.evaluate("Object.getOwnPropertyDescriptor(o, 'overloaded1').enumerable").toBool());
+ QEXPECT_FAIL("int + skipInEnumeration", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + skipInEnumeration|undeletable", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + skipInEnumeration|readOnly", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + skipInEnumeration|readOnly|undeletable", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QVERIFY(skipInEnumeration != engine.evaluate("Object.getOwnPropertyDescriptor(o, 'overloaded2').enumerable").toBool());
+ QVERIFY(engine.evaluate("p.propertyIsEnumerable('overloaded1')").toBool());
+ QVERIFY(engine.evaluate("p.propertyIsEnumerable('overloaded2')").toBool());
+ QVERIFY(engine.evaluate("o.propertyIsEnumerable('overloaded3')").toBool());
+ QVERIFY(engine.evaluate("o.propertyIsEnumerable('overloaded4')").toBool());
+ QEXPECT_FAIL("int + skipInEnumeration", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + skipInEnumeration|undeletable", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + skipInEnumeration|readOnly", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + skipInEnumeration|readOnly|undeletable", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QVERIFY(skipInEnumeration != engine.evaluate("p.propertyIsEnumerable('overloaded3')").toBool());
+ QEXPECT_FAIL("int + skipInEnumeration", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + skipInEnumeration|undeletable", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + skipInEnumeration|readOnly", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + skipInEnumeration|readOnly|undeletable", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QVERIFY(skipInEnumeration != engine.evaluate("p.propertyIsEnumerable('overloaded4')").toBool());
+ QEXPECT_FAIL("int + skipInEnumeration", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + skipInEnumeration|undeletable", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + skipInEnumeration|readOnly", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + skipInEnumeration|readOnly|undeletable", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QVERIFY(skipInEnumeration != engine.evaluate("o.propertyIsEnumerable('defined1')").toBool());
+ QEXPECT_FAIL("int + skipInEnumeration", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + skipInEnumeration|undeletable", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + skipInEnumeration|readOnly", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QEXPECT_FAIL("int + skipInEnumeration|readOnly|undeletable", "WebKit bug: 40613 (The JSObjectSetProperty doesn't overwrite property flags)", Continue);
+ QVERIFY(skipInEnumeration != engine.evaluate("o.propertyIsEnumerable('defined2')").toBool());
+}
+
+void tst_QScriptValue::propertyFlag_data()
+{
+ QTest::addColumn<QString>("name");
+ QTest::addColumn<int>("flag");
+
+ QTest::newRow("?Cr@jzi!%$") << "?Cr@jzi!%$" << static_cast<int>(0);
+ QTest::newRow("ReadOnly") << "ReadOnly" << static_cast<int>(QScriptValue::ReadOnly);
+ QTest::newRow("Undeletable") << "Undeletable" << static_cast<int>(QScriptValue::Undeletable);
+ QTest::newRow("SkipInEnumeration") << "SkipInEnumeration" << static_cast<int>(QScriptValue::SkipInEnumeration);
+ QTest::newRow("ReadOnly | Undeletable") << "ReadOnly_Undeletable" << static_cast<int>(QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ QTest::newRow("ReadOnly | SkipInEnumeration") << "ReadOnly_SkipInEnumeration" << static_cast<int>(QScriptValue::ReadOnly | QScriptValue::SkipInEnumeration);
+ QTest::newRow("Undeletable | SkipInEnumeration") << "Undeletable_SkipInEnumeration" << static_cast<int>(QScriptValue::Undeletable | QScriptValue::SkipInEnumeration);
+ QTest::newRow("ReadOnly | Undeletable | SkipInEnumeration") << "ReadOnly_Undeletable_SkipInEnumeration" << static_cast<int>(QScriptValue::ReadOnly | QScriptValue::Undeletable | QScriptValue::SkipInEnumeration);
+}
+
+void tst_QScriptValue::propertyFlag()
+{
+ QScriptEngine engine;
+ QFETCH(QString, name);
+ QFETCH(int, flag);
+ const QScriptString nameHandle = engine.toStringHandle(name);
+ const QString protoName = "proto" + name;
+ const QScriptString protoNameHandle = engine.toStringHandle(protoName);
+
+ QScriptValue proto = engine.newObject();
+ QScriptValue object = engine.newObject();
+ object.setPrototype(proto);
+
+ proto.setProperty(protoName, QScriptValue(124816), QScriptValue::PropertyFlag(flag));
+ object.setProperty(name, QScriptValue(124816), QScriptValue::PropertyFlag(flag));
+
+ // Check using QString name
+ QCOMPARE(object.propertyFlags(name), QScriptValue::PropertyFlag(flag));
+ QCOMPARE(object.propertyFlags(protoName, QScriptValue::ResolvePrototype), QScriptValue::PropertyFlag(flag));
+ QVERIFY(!object.propertyFlags(protoName, QScriptValue::ResolveLocal));
+
+ // Check using QScriptString name
+ QCOMPARE(object.propertyFlags(nameHandle), QScriptValue::PropertyFlag(flag));
+ QCOMPARE(object.propertyFlags(protoNameHandle, QScriptValue::ResolvePrototype), QScriptValue::PropertyFlag(flag));
+ QVERIFY(!object.propertyFlags(protoNameHandle, QScriptValue::ResolveLocal));
+}
+
+void tst_QScriptValue::globalObjectChanges()
+{
+ // API functionality shouldn't depend on Global Object.
+ QScriptEngine engine;
+ QScriptValue array = engine.newArray();
+ QScriptValue error = engine.evaluate("new Error");
+ QScriptValue object = engine.newObject();
+
+ object.setProperty("foo", 512);
+
+ // Remove properties form global object.
+ engine.evaluate("delete Object; delete Error; delete Array;");
+
+ QVERIFY(array.isArray());
+ QVERIFY(error.isError());
+ QVERIFY(object.isObject());
+
+ QVERIFY(object.property("foo").isValid());
+ QVERIFY(object.property("foo", QScriptValue::ResolveLocal).isValid());
+ object.setProperty("foo", QScriptValue());
+ QVERIFY(!object.property("foo").isValid());
+ QVERIFY(!object.property("foo", QScriptValue::ResolveLocal).isValid());
+}
+
+void tst_QScriptValue::assignAndCopyConstruct_data()
+{
+ QTest::addColumn<QScriptValue>("value");
+ if (m_engine)
+ delete m_engine;
+ m_engine = new QScriptEngine;
+ // Copy & assign code is the same for all types, so it is enough to check only a few value.
+ for (unsigned i = 0; i < 10; ++i) {
+ QPair<QString, QScriptValue> testcase = initScriptValues(i);
+ QTest::newRow(testcase.first.toAscii().constData()) << testcase.second;
+ }
+}
+
+void tst_QScriptValue::assignAndCopyConstruct()
+{
+ QFETCH(QScriptValue, value);
+ QScriptValue copy(value);
+ QEXPECT_FAIL("QScriptValue(QScriptValue::NullValue)", "FIXME: WebKit bug 43038", Abort);
+ QEXPECT_FAIL("QScriptValue(QScriptValue::UndefinedValue)", "FIXME: WebKit bug 43038", Abort);
+ QCOMPARE(copy.strictlyEquals(value), !value.isNumber() || !qIsNaN(value.toNumber()));
+ QCOMPARE(copy.engine(), value.engine());
+
+ QScriptValue assigned = copy;
+ QCOMPARE(assigned.strictlyEquals(value), !copy.isNumber() || !qIsNaN(copy.toNumber()));
+ QCOMPARE(assigned.engine(), assigned.engine());
+
+ QScriptValue other(!value.toBool());
+ assigned = other;
+ QVERIFY(!assigned.strictlyEquals(copy));
+ QVERIFY(assigned.strictlyEquals(other));
+ QCOMPARE(assigned.engine(), other.engine());
+}
+
+QTEST_MAIN(tst_QScriptValue)
diff --git a/Source/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue.h b/Source/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue.h
new file mode 100644
index 0000000..7b7d9bc
--- /dev/null
+++ b/Source/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue.h
@@ -0,0 +1,143 @@
+/*
+ Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef tst_qscriptvalue_h
+#define tst_qscriptvalue_h
+
+#include "qscriptengine.h"
+#include "qscriptvalue.h"
+#include <QtCore/qnumeric.h>
+#include <QtTest/qtest.h>
+
+#define DEFINE_TEST_VALUE(expr) m_values.insert(QString::fromLatin1(#expr), expr)
+
+Q_DECLARE_METATYPE(QScriptValue*);
+Q_DECLARE_METATYPE(QScriptValue);
+typedef QPair<QString, QScriptValue> QPairQStringAndQScriptValue;
+Q_DECLARE_METATYPE(QPairQStringAndQScriptValue);
+
+class tst_QScriptValue : public QObject {
+ Q_OBJECT
+
+public:
+ tst_QScriptValue();
+ virtual ~tst_QScriptValue();
+
+private slots:
+ void toStringSimple_data();
+ void toStringSimple();
+ void copyConstructor_data();
+ void copyConstructor();
+ void assignOperator_data();
+ void assignOperator();
+ void dataSharing();
+ void constructors_data();
+ void constructors();
+ void getSetPrototype();
+ void call();
+ void ctor();
+ void toObjectSimple();
+ void getPropertySimple_data();
+ void getPropertySimple();
+ void setPropertySimple();
+ void setProperty_data();
+ void setProperty();
+ void getSetProperty();
+ void getPropertyResolveFlag();
+ void propertyFlag_data();
+ void propertyFlag();
+ void globalObjectChanges();
+ void assignAndCopyConstruct_data();
+ void assignAndCopyConstruct();
+
+ // Generated test functions.
+ void isArray_data();
+ void isArray();
+
+ void isBool_data();
+ void isBool();
+
+ void isBoolean_data();
+ void isBoolean();
+
+ void isError_data();
+ void isError();
+
+ void isNumber_data();
+ void isNumber();
+
+ void isFunction_data();
+ void isFunction();
+
+ void isNull_data();
+ void isNull();
+
+ void isObject_data();
+ void isObject();
+
+ void isString_data();
+ void isString();
+
+ void isUndefined_data();
+ void isUndefined();
+
+ void isValid_data();
+ void isValid();
+
+ void toString_data();
+ void toString();
+
+ void toNumber_data();
+ void toNumber();
+
+ void toBool_data();
+ void toBool();
+
+ void toBoolean_data();
+ void toBoolean();
+
+ void toInteger_data();
+ void toInteger();
+
+ void toInt32_data();
+ void toInt32();
+
+ void toUInt32_data();
+ void toUInt32();
+
+ void toUInt16_data();
+ void toUInt16();
+
+ void equals_data();
+ void equals();
+
+ void strictlyEquals_data();
+ void strictlyEquals();
+
+ void instanceOf_data();
+ void instanceOf();
+
+private:
+ // Generated function
+ QPair<QString, QScriptValue> initScriptValues(uint idx);
+
+ QScriptEngine* m_engine;
+};
+
+#endif // tst_qscriptvalue_h
diff --git a/Source/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue_generated_comparison.cpp b/Source/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue_generated_comparison.cpp
new file mode 100644
index 0000000..3209530
--- /dev/null
+++ b/Source/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue_generated_comparison.cpp
@@ -0,0 +1,1799 @@
+/*
+ Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+/****************************************************************************
+*************** This file has been generated. DO NOT MODIFY! ****************
+****************************************************************************/
+
+#include "tst_qscriptvalue.h"
+
+static const QString equals_array[] = {
+ "QScriptValue() <=> QScriptValue()",
+ "QScriptValue(QScriptValue::UndefinedValue) <=> QScriptValue(QScriptValue::UndefinedValue)",
+ "QScriptValue(QScriptValue::UndefinedValue) <=> QScriptValue(QScriptValue::NullValue)",
+ "QScriptValue(QScriptValue::UndefinedValue) <=> QScriptValue(0, QScriptValue::UndefinedValue)",
+ "QScriptValue(QScriptValue::UndefinedValue) <=> QScriptValue(0, QScriptValue::NullValue)",
+ "QScriptValue(QScriptValue::UndefinedValue) <=> QScriptValue(engine, QScriptValue::UndefinedValue)",
+ "QScriptValue(QScriptValue::UndefinedValue) <=> QScriptValue(engine, QScriptValue::NullValue)",
+ "QScriptValue(QScriptValue::UndefinedValue) <=> engine->evaluate(\"{}\")",
+ "QScriptValue(QScriptValue::UndefinedValue) <=> engine->evaluate(\"undefined\")",
+ "QScriptValue(QScriptValue::UndefinedValue) <=> engine->evaluate(\"null\")",
+ "QScriptValue(QScriptValue::UndefinedValue) <=> engine->nullValue()",
+ "QScriptValue(QScriptValue::UndefinedValue) <=> engine->undefinedValue()",
+ "QScriptValue(QScriptValue::NullValue) <=> QScriptValue(QScriptValue::UndefinedValue)",
+ "QScriptValue(QScriptValue::NullValue) <=> QScriptValue(QScriptValue::NullValue)",
+ "QScriptValue(QScriptValue::NullValue) <=> QScriptValue(0, QScriptValue::UndefinedValue)",
+ "QScriptValue(QScriptValue::NullValue) <=> QScriptValue(0, QScriptValue::NullValue)",
+ "QScriptValue(QScriptValue::NullValue) <=> QScriptValue(engine, QScriptValue::UndefinedValue)",
+ "QScriptValue(QScriptValue::NullValue) <=> QScriptValue(engine, QScriptValue::NullValue)",
+ "QScriptValue(QScriptValue::NullValue) <=> engine->evaluate(\"{}\")",
+ "QScriptValue(QScriptValue::NullValue) <=> engine->evaluate(\"undefined\")",
+ "QScriptValue(QScriptValue::NullValue) <=> engine->evaluate(\"null\")",
+ "QScriptValue(QScriptValue::NullValue) <=> engine->nullValue()",
+ "QScriptValue(QScriptValue::NullValue) <=> engine->undefinedValue()",
+ "QScriptValue(true) <=> QScriptValue(true)",
+ "QScriptValue(true) <=> QScriptValue(0, true)",
+ "QScriptValue(true) <=> QScriptValue(engine, true)",
+ "QScriptValue(true) <=> engine->evaluate(\"true\")",
+ "QScriptValue(false) <=> QScriptValue(false)",
+ "QScriptValue(false) <=> QScriptValue(0)",
+ "QScriptValue(false) <=> QScriptValue(0.0)",
+ "QScriptValue(false) <=> QScriptValue(QString(\"\"))",
+ "QScriptValue(false) <=> QScriptValue(QString())",
+ "QScriptValue(false) <=> QScriptValue(QString(\"0\"))",
+ "QScriptValue(false) <=> QScriptValue(0, false)",
+ "QScriptValue(false) <=> QScriptValue(0, 0)",
+ "QScriptValue(false) <=> QScriptValue(0, 0.0)",
+ "QScriptValue(false) <=> QScriptValue(0, QString(\"\"))",
+ "QScriptValue(false) <=> QScriptValue(0, QString())",
+ "QScriptValue(false) <=> QScriptValue(0, QString(\"0\"))",
+ "QScriptValue(false) <=> QScriptValue(engine, false)",
+ "QScriptValue(false) <=> QScriptValue(engine, 0)",
+ "QScriptValue(false) <=> QScriptValue(engine, 0.0)",
+ "QScriptValue(false) <=> QScriptValue(engine, QString(\"\"))",
+ "QScriptValue(false) <=> QScriptValue(engine, QString())",
+ "QScriptValue(false) <=> QScriptValue(engine, QString(\"0\"))",
+ "QScriptValue(false) <=> engine->evaluate(\"[]\")",
+ "QScriptValue(false) <=> engine->evaluate(\"Array.prototype\")",
+ "QScriptValue(false) <=> engine->evaluate(\"new Array()\")",
+ "QScriptValue(false) <=> engine->evaluate(\"false\")",
+ "QScriptValue(false) <=> engine->evaluate(\"0\")",
+ "QScriptValue(false) <=> engine->evaluate(\"0.0\")",
+ "QScriptValue(false) <=> engine->evaluate(\"''\")",
+ "QScriptValue(false) <=> engine->evaluate(\"'0'\")",
+ "QScriptValue(false) <=> engine->newArray()",
+ "QScriptValue(int(122)) <=> QScriptValue(int(122))",
+ "QScriptValue(int(122)) <=> QScriptValue(0, int(122))",
+ "QScriptValue(int(122)) <=> QScriptValue(engine, int(122))",
+ "QScriptValue(int(122)) <=> engine->evaluate(\"122\")",
+ "QScriptValue(uint(124)) <=> QScriptValue(uint(124))",
+ "QScriptValue(uint(124)) <=> QScriptValue(0, uint(124))",
+ "QScriptValue(uint(124)) <=> QScriptValue(engine, uint(124))",
+ "QScriptValue(uint(124)) <=> engine->evaluate(\"124\")",
+ "QScriptValue(0) <=> QScriptValue(false)",
+ "QScriptValue(0) <=> QScriptValue(0)",
+ "QScriptValue(0) <=> QScriptValue(0.0)",
+ "QScriptValue(0) <=> QScriptValue(QString(\"\"))",
+ "QScriptValue(0) <=> QScriptValue(QString())",
+ "QScriptValue(0) <=> QScriptValue(QString(\"0\"))",
+ "QScriptValue(0) <=> QScriptValue(0, false)",
+ "QScriptValue(0) <=> QScriptValue(0, 0)",
+ "QScriptValue(0) <=> QScriptValue(0, 0.0)",
+ "QScriptValue(0) <=> QScriptValue(0, QString(\"\"))",
+ "QScriptValue(0) <=> QScriptValue(0, QString())",
+ "QScriptValue(0) <=> QScriptValue(0, QString(\"0\"))",
+ "QScriptValue(0) <=> QScriptValue(engine, false)",
+ "QScriptValue(0) <=> QScriptValue(engine, 0)",
+ "QScriptValue(0) <=> QScriptValue(engine, 0.0)",
+ "QScriptValue(0) <=> QScriptValue(engine, QString(\"\"))",
+ "QScriptValue(0) <=> QScriptValue(engine, QString())",
+ "QScriptValue(0) <=> QScriptValue(engine, QString(\"0\"))",
+ "QScriptValue(0) <=> engine->evaluate(\"[]\")",
+ "QScriptValue(0) <=> engine->evaluate(\"Array.prototype\")",
+ "QScriptValue(0) <=> engine->evaluate(\"new Array()\")",
+ "QScriptValue(0) <=> engine->evaluate(\"false\")",
+ "QScriptValue(0) <=> engine->evaluate(\"0\")",
+ "QScriptValue(0) <=> engine->evaluate(\"0.0\")",
+ "QScriptValue(0) <=> engine->evaluate(\"''\")",
+ "QScriptValue(0) <=> engine->evaluate(\"'0'\")",
+ "QScriptValue(0) <=> engine->newArray()",
+ "QScriptValue(0.0) <=> QScriptValue(false)",
+ "QScriptValue(0.0) <=> QScriptValue(0)",
+ "QScriptValue(0.0) <=> QScriptValue(0.0)",
+ "QScriptValue(0.0) <=> QScriptValue(QString(\"\"))",
+ "QScriptValue(0.0) <=> QScriptValue(QString())",
+ "QScriptValue(0.0) <=> QScriptValue(QString(\"0\"))",
+ "QScriptValue(0.0) <=> QScriptValue(0, false)",
+ "QScriptValue(0.0) <=> QScriptValue(0, 0)",
+ "QScriptValue(0.0) <=> QScriptValue(0, 0.0)",
+ "QScriptValue(0.0) <=> QScriptValue(0, QString(\"\"))",
+ "QScriptValue(0.0) <=> QScriptValue(0, QString())",
+ "QScriptValue(0.0) <=> QScriptValue(0, QString(\"0\"))",
+ "QScriptValue(0.0) <=> QScriptValue(engine, false)",
+ "QScriptValue(0.0) <=> QScriptValue(engine, 0)",
+ "QScriptValue(0.0) <=> QScriptValue(engine, 0.0)",
+ "QScriptValue(0.0) <=> QScriptValue(engine, QString(\"\"))",
+ "QScriptValue(0.0) <=> QScriptValue(engine, QString())",
+ "QScriptValue(0.0) <=> QScriptValue(engine, QString(\"0\"))",
+ "QScriptValue(0.0) <=> engine->evaluate(\"[]\")",
+ "QScriptValue(0.0) <=> engine->evaluate(\"Array.prototype\")",
+ "QScriptValue(0.0) <=> engine->evaluate(\"new Array()\")",
+ "QScriptValue(0.0) <=> engine->evaluate(\"false\")",
+ "QScriptValue(0.0) <=> engine->evaluate(\"0\")",
+ "QScriptValue(0.0) <=> engine->evaluate(\"0.0\")",
+ "QScriptValue(0.0) <=> engine->evaluate(\"''\")",
+ "QScriptValue(0.0) <=> engine->evaluate(\"'0'\")",
+ "QScriptValue(0.0) <=> engine->newArray()",
+ "QScriptValue(123.0) <=> QScriptValue(123.0)",
+ "QScriptValue(123.0) <=> QScriptValue(QString(\"123\"))",
+ "QScriptValue(123.0) <=> QScriptValue(0, 123.0)",
+ "QScriptValue(123.0) <=> QScriptValue(0, QString(\"123\"))",
+ "QScriptValue(123.0) <=> QScriptValue(engine, 123.0)",
+ "QScriptValue(123.0) <=> QScriptValue(engine, QString(\"123\"))",
+ "QScriptValue(123.0) <=> engine->evaluate(\"123.0\")",
+ "QScriptValue(123.0) <=> engine->evaluate(\"'123'\")",
+ "QScriptValue(6.37e-8) <=> QScriptValue(6.37e-8)",
+ "QScriptValue(6.37e-8) <=> QScriptValue(0, 6.37e-8)",
+ "QScriptValue(6.37e-8) <=> QScriptValue(engine, 6.37e-8)",
+ "QScriptValue(6.37e-8) <=> engine->evaluate(\"6.37e-8\")",
+ "QScriptValue(-6.37e-8) <=> QScriptValue(-6.37e-8)",
+ "QScriptValue(-6.37e-8) <=> QScriptValue(0, -6.37e-8)",
+ "QScriptValue(-6.37e-8) <=> QScriptValue(engine, -6.37e-8)",
+ "QScriptValue(-6.37e-8) <=> engine->evaluate(\"-6.37e-8\")",
+ "QScriptValue(0x43211234) <=> QScriptValue(0x43211234)",
+ "QScriptValue(0x43211234) <=> QScriptValue(0, 0x43211234)",
+ "QScriptValue(0x43211234) <=> QScriptValue(engine, 0x43211234)",
+ "QScriptValue(0x43211234) <=> engine->evaluate(\"0x43211234\")",
+ "QScriptValue(0x10000) <=> QScriptValue(0x10000)",
+ "QScriptValue(0x10000) <=> QScriptValue(0, 0x10000)",
+ "QScriptValue(0x10000) <=> QScriptValue(engine, 0x10000)",
+ "QScriptValue(0x10000) <=> engine->evaluate(\"0x10000\")",
+ "QScriptValue(0x10001) <=> QScriptValue(0x10001)",
+ "QScriptValue(0x10001) <=> QScriptValue(0, 0x10001)",
+ "QScriptValue(0x10001) <=> QScriptValue(engine, 0x10001)",
+ "QScriptValue(0x10001) <=> engine->evaluate(\"0x10001\")",
+ "QScriptValue(qInf()) <=> QScriptValue(qInf())",
+ "QScriptValue(qInf()) <=> QScriptValue(\"Infinity\")",
+ "QScriptValue(qInf()) <=> QScriptValue(0, qInf())",
+ "QScriptValue(qInf()) <=> QScriptValue(0, \"Infinity\")",
+ "QScriptValue(qInf()) <=> QScriptValue(engine, qInf())",
+ "QScriptValue(qInf()) <=> QScriptValue(engine, \"Infinity\")",
+ "QScriptValue(qInf()) <=> engine->evaluate(\"Infinity\")",
+ "QScriptValue(-qInf()) <=> QScriptValue(-qInf())",
+ "QScriptValue(-qInf()) <=> QScriptValue(\"-Infinity\")",
+ "QScriptValue(-qInf()) <=> QScriptValue(0, -qInf())",
+ "QScriptValue(-qInf()) <=> QScriptValue(0, \"-Infinity\")",
+ "QScriptValue(-qInf()) <=> QScriptValue(engine, -qInf())",
+ "QScriptValue(-qInf()) <=> QScriptValue(engine, \"-Infinity\")",
+ "QScriptValue(-qInf()) <=> engine->evaluate(\"-Infinity\")",
+ "QScriptValue(\"NaN\") <=> QScriptValue(\"NaN\")",
+ "QScriptValue(\"NaN\") <=> QScriptValue(0, \"NaN\")",
+ "QScriptValue(\"NaN\") <=> QScriptValue(engine, \"NaN\")",
+ "QScriptValue(\"Infinity\") <=> QScriptValue(qInf())",
+ "QScriptValue(\"Infinity\") <=> QScriptValue(\"Infinity\")",
+ "QScriptValue(\"Infinity\") <=> QScriptValue(0, qInf())",
+ "QScriptValue(\"Infinity\") <=> QScriptValue(0, \"Infinity\")",
+ "QScriptValue(\"Infinity\") <=> QScriptValue(engine, qInf())",
+ "QScriptValue(\"Infinity\") <=> QScriptValue(engine, \"Infinity\")",
+ "QScriptValue(\"Infinity\") <=> engine->evaluate(\"Infinity\")",
+ "QScriptValue(\"-Infinity\") <=> QScriptValue(-qInf())",
+ "QScriptValue(\"-Infinity\") <=> QScriptValue(\"-Infinity\")",
+ "QScriptValue(\"-Infinity\") <=> QScriptValue(0, -qInf())",
+ "QScriptValue(\"-Infinity\") <=> QScriptValue(0, \"-Infinity\")",
+ "QScriptValue(\"-Infinity\") <=> QScriptValue(engine, -qInf())",
+ "QScriptValue(\"-Infinity\") <=> QScriptValue(engine, \"-Infinity\")",
+ "QScriptValue(\"-Infinity\") <=> engine->evaluate(\"-Infinity\")",
+ "QScriptValue(\"ciao\") <=> QScriptValue(\"ciao\")",
+ "QScriptValue(\"ciao\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(\"ciao\") <=> QScriptValue(0, \"ciao\")",
+ "QScriptValue(\"ciao\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(\"ciao\") <=> QScriptValue(engine, \"ciao\")",
+ "QScriptValue(\"ciao\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(\"ciao\") <=> engine->evaluate(\"'ciao'\")",
+ "QScriptValue(QString::fromLatin1(\"ciao\")) <=> QScriptValue(\"ciao\")",
+ "QScriptValue(QString::fromLatin1(\"ciao\")) <=> QScriptValue(QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(QString::fromLatin1(\"ciao\")) <=> QScriptValue(0, \"ciao\")",
+ "QScriptValue(QString::fromLatin1(\"ciao\")) <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(QString::fromLatin1(\"ciao\")) <=> QScriptValue(engine, \"ciao\")",
+ "QScriptValue(QString::fromLatin1(\"ciao\")) <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"'ciao'\")",
+ "QScriptValue(QString(\"\")) <=> QScriptValue(false)",
+ "QScriptValue(QString(\"\")) <=> QScriptValue(0)",
+ "QScriptValue(QString(\"\")) <=> QScriptValue(0.0)",
+ "QScriptValue(QString(\"\")) <=> QScriptValue(QString(\"\"))",
+ "QScriptValue(QString(\"\")) <=> QScriptValue(QString())",
+ "QScriptValue(QString(\"\")) <=> QScriptValue(0, false)",
+ "QScriptValue(QString(\"\")) <=> QScriptValue(0, 0)",
+ "QScriptValue(QString(\"\")) <=> QScriptValue(0, 0.0)",
+ "QScriptValue(QString(\"\")) <=> QScriptValue(0, QString(\"\"))",
+ "QScriptValue(QString(\"\")) <=> QScriptValue(0, QString())",
+ "QScriptValue(QString(\"\")) <=> QScriptValue(engine, false)",
+ "QScriptValue(QString(\"\")) <=> QScriptValue(engine, 0)",
+ "QScriptValue(QString(\"\")) <=> QScriptValue(engine, 0.0)",
+ "QScriptValue(QString(\"\")) <=> QScriptValue(engine, QString(\"\"))",
+ "QScriptValue(QString(\"\")) <=> QScriptValue(engine, QString())",
+ "QScriptValue(QString(\"\")) <=> engine->evaluate(\"[]\")",
+ "QScriptValue(QString(\"\")) <=> engine->evaluate(\"Array.prototype\")",
+ "QScriptValue(QString(\"\")) <=> engine->evaluate(\"new Array()\")",
+ "QScriptValue(QString(\"\")) <=> engine->evaluate(\"false\")",
+ "QScriptValue(QString(\"\")) <=> engine->evaluate(\"0\")",
+ "QScriptValue(QString(\"\")) <=> engine->evaluate(\"0.0\")",
+ "QScriptValue(QString(\"\")) <=> engine->evaluate(\"''\")",
+ "QScriptValue(QString(\"\")) <=> engine->newArray()",
+ "QScriptValue(QString()) <=> QScriptValue(false)",
+ "QScriptValue(QString()) <=> QScriptValue(0)",
+ "QScriptValue(QString()) <=> QScriptValue(0.0)",
+ "QScriptValue(QString()) <=> QScriptValue(QString(\"\"))",
+ "QScriptValue(QString()) <=> QScriptValue(QString())",
+ "QScriptValue(QString()) <=> QScriptValue(0, false)",
+ "QScriptValue(QString()) <=> QScriptValue(0, 0)",
+ "QScriptValue(QString()) <=> QScriptValue(0, 0.0)",
+ "QScriptValue(QString()) <=> QScriptValue(0, QString(\"\"))",
+ "QScriptValue(QString()) <=> QScriptValue(0, QString())",
+ "QScriptValue(QString()) <=> QScriptValue(engine, false)",
+ "QScriptValue(QString()) <=> QScriptValue(engine, 0)",
+ "QScriptValue(QString()) <=> QScriptValue(engine, 0.0)",
+ "QScriptValue(QString()) <=> QScriptValue(engine, QString(\"\"))",
+ "QScriptValue(QString()) <=> QScriptValue(engine, QString())",
+ "QScriptValue(QString()) <=> engine->evaluate(\"[]\")",
+ "QScriptValue(QString()) <=> engine->evaluate(\"Array.prototype\")",
+ "QScriptValue(QString()) <=> engine->evaluate(\"new Array()\")",
+ "QScriptValue(QString()) <=> engine->evaluate(\"false\")",
+ "QScriptValue(QString()) <=> engine->evaluate(\"0\")",
+ "QScriptValue(QString()) <=> engine->evaluate(\"0.0\")",
+ "QScriptValue(QString()) <=> engine->evaluate(\"''\")",
+ "QScriptValue(QString()) <=> engine->newArray()",
+ "QScriptValue(QString(\"0\")) <=> QScriptValue(false)",
+ "QScriptValue(QString(\"0\")) <=> QScriptValue(0)",
+ "QScriptValue(QString(\"0\")) <=> QScriptValue(0.0)",
+ "QScriptValue(QString(\"0\")) <=> QScriptValue(QString(\"0\"))",
+ "QScriptValue(QString(\"0\")) <=> QScriptValue(0, false)",
+ "QScriptValue(QString(\"0\")) <=> QScriptValue(0, 0)",
+ "QScriptValue(QString(\"0\")) <=> QScriptValue(0, 0.0)",
+ "QScriptValue(QString(\"0\")) <=> QScriptValue(0, QString(\"0\"))",
+ "QScriptValue(QString(\"0\")) <=> QScriptValue(engine, false)",
+ "QScriptValue(QString(\"0\")) <=> QScriptValue(engine, 0)",
+ "QScriptValue(QString(\"0\")) <=> QScriptValue(engine, 0.0)",
+ "QScriptValue(QString(\"0\")) <=> QScriptValue(engine, QString(\"0\"))",
+ "QScriptValue(QString(\"0\")) <=> engine->evaluate(\"false\")",
+ "QScriptValue(QString(\"0\")) <=> engine->evaluate(\"0\")",
+ "QScriptValue(QString(\"0\")) <=> engine->evaluate(\"0.0\")",
+ "QScriptValue(QString(\"0\")) <=> engine->evaluate(\"'0'\")",
+ "QScriptValue(QString(\"123\")) <=> QScriptValue(123.0)",
+ "QScriptValue(QString(\"123\")) <=> QScriptValue(QString(\"123\"))",
+ "QScriptValue(QString(\"123\")) <=> QScriptValue(0, 123.0)",
+ "QScriptValue(QString(\"123\")) <=> QScriptValue(0, QString(\"123\"))",
+ "QScriptValue(QString(\"123\")) <=> QScriptValue(engine, 123.0)",
+ "QScriptValue(QString(\"123\")) <=> QScriptValue(engine, QString(\"123\"))",
+ "QScriptValue(QString(\"123\")) <=> engine->evaluate(\"123.0\")",
+ "QScriptValue(QString(\"123\")) <=> engine->evaluate(\"'123'\")",
+ "QScriptValue(QString(\"12.4\")) <=> QScriptValue(QString(\"12.4\"))",
+ "QScriptValue(QString(\"12.4\")) <=> engine->evaluate(\"'12.4'\")",
+ "QScriptValue(0, QScriptValue::UndefinedValue) <=> QScriptValue(QScriptValue::UndefinedValue)",
+ "QScriptValue(0, QScriptValue::UndefinedValue) <=> QScriptValue(QScriptValue::NullValue)",
+ "QScriptValue(0, QScriptValue::UndefinedValue) <=> QScriptValue(0, QScriptValue::UndefinedValue)",
+ "QScriptValue(0, QScriptValue::UndefinedValue) <=> QScriptValue(0, QScriptValue::NullValue)",
+ "QScriptValue(0, QScriptValue::UndefinedValue) <=> QScriptValue(engine, QScriptValue::UndefinedValue)",
+ "QScriptValue(0, QScriptValue::UndefinedValue) <=> QScriptValue(engine, QScriptValue::NullValue)",
+ "QScriptValue(0, QScriptValue::UndefinedValue) <=> engine->evaluate(\"{}\")",
+ "QScriptValue(0, QScriptValue::UndefinedValue) <=> engine->evaluate(\"undefined\")",
+ "QScriptValue(0, QScriptValue::UndefinedValue) <=> engine->evaluate(\"null\")",
+ "QScriptValue(0, QScriptValue::UndefinedValue) <=> engine->nullValue()",
+ "QScriptValue(0, QScriptValue::UndefinedValue) <=> engine->undefinedValue()",
+ "QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(QScriptValue::UndefinedValue)",
+ "QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(QScriptValue::NullValue)",
+ "QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(0, QScriptValue::UndefinedValue)",
+ "QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(0, QScriptValue::NullValue)",
+ "QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(engine, QScriptValue::UndefinedValue)",
+ "QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(engine, QScriptValue::NullValue)",
+ "QScriptValue(0, QScriptValue::NullValue) <=> engine->evaluate(\"{}\")",
+ "QScriptValue(0, QScriptValue::NullValue) <=> engine->evaluate(\"undefined\")",
+ "QScriptValue(0, QScriptValue::NullValue) <=> engine->evaluate(\"null\")",
+ "QScriptValue(0, QScriptValue::NullValue) <=> engine->nullValue()",
+ "QScriptValue(0, QScriptValue::NullValue) <=> engine->undefinedValue()",
+ "QScriptValue(0, true) <=> QScriptValue(true)",
+ "QScriptValue(0, true) <=> QScriptValue(0, true)",
+ "QScriptValue(0, true) <=> QScriptValue(engine, true)",
+ "QScriptValue(0, true) <=> engine->evaluate(\"true\")",
+ "QScriptValue(0, false) <=> QScriptValue(false)",
+ "QScriptValue(0, false) <=> QScriptValue(0)",
+ "QScriptValue(0, false) <=> QScriptValue(0.0)",
+ "QScriptValue(0, false) <=> QScriptValue(QString(\"\"))",
+ "QScriptValue(0, false) <=> QScriptValue(QString())",
+ "QScriptValue(0, false) <=> QScriptValue(QString(\"0\"))",
+ "QScriptValue(0, false) <=> QScriptValue(0, false)",
+ "QScriptValue(0, false) <=> QScriptValue(0, 0)",
+ "QScriptValue(0, false) <=> QScriptValue(0, 0.0)",
+ "QScriptValue(0, false) <=> QScriptValue(0, QString(\"\"))",
+ "QScriptValue(0, false) <=> QScriptValue(0, QString())",
+ "QScriptValue(0, false) <=> QScriptValue(0, QString(\"0\"))",
+ "QScriptValue(0, false) <=> QScriptValue(engine, false)",
+ "QScriptValue(0, false) <=> QScriptValue(engine, 0)",
+ "QScriptValue(0, false) <=> QScriptValue(engine, 0.0)",
+ "QScriptValue(0, false) <=> QScriptValue(engine, QString(\"\"))",
+ "QScriptValue(0, false) <=> QScriptValue(engine, QString())",
+ "QScriptValue(0, false) <=> QScriptValue(engine, QString(\"0\"))",
+ "QScriptValue(0, false) <=> engine->evaluate(\"[]\")",
+ "QScriptValue(0, false) <=> engine->evaluate(\"Array.prototype\")",
+ "QScriptValue(0, false) <=> engine->evaluate(\"new Array()\")",
+ "QScriptValue(0, false) <=> engine->evaluate(\"false\")",
+ "QScriptValue(0, false) <=> engine->evaluate(\"0\")",
+ "QScriptValue(0, false) <=> engine->evaluate(\"0.0\")",
+ "QScriptValue(0, false) <=> engine->evaluate(\"''\")",
+ "QScriptValue(0, false) <=> engine->evaluate(\"'0'\")",
+ "QScriptValue(0, false) <=> engine->newArray()",
+ "QScriptValue(0, int(122)) <=> QScriptValue(int(122))",
+ "QScriptValue(0, int(122)) <=> QScriptValue(0, int(122))",
+ "QScriptValue(0, int(122)) <=> QScriptValue(engine, int(122))",
+ "QScriptValue(0, int(122)) <=> engine->evaluate(\"122\")",
+ "QScriptValue(0, uint(124)) <=> QScriptValue(uint(124))",
+ "QScriptValue(0, uint(124)) <=> QScriptValue(0, uint(124))",
+ "QScriptValue(0, uint(124)) <=> QScriptValue(engine, uint(124))",
+ "QScriptValue(0, uint(124)) <=> engine->evaluate(\"124\")",
+ "QScriptValue(0, 0) <=> QScriptValue(false)",
+ "QScriptValue(0, 0) <=> QScriptValue(0)",
+ "QScriptValue(0, 0) <=> QScriptValue(0.0)",
+ "QScriptValue(0, 0) <=> QScriptValue(QString(\"\"))",
+ "QScriptValue(0, 0) <=> QScriptValue(QString())",
+ "QScriptValue(0, 0) <=> QScriptValue(QString(\"0\"))",
+ "QScriptValue(0, 0) <=> QScriptValue(0, false)",
+ "QScriptValue(0, 0) <=> QScriptValue(0, 0)",
+ "QScriptValue(0, 0) <=> QScriptValue(0, 0.0)",
+ "QScriptValue(0, 0) <=> QScriptValue(0, QString(\"\"))",
+ "QScriptValue(0, 0) <=> QScriptValue(0, QString())",
+ "QScriptValue(0, 0) <=> QScriptValue(0, QString(\"0\"))",
+ "QScriptValue(0, 0) <=> QScriptValue(engine, false)",
+ "QScriptValue(0, 0) <=> QScriptValue(engine, 0)",
+ "QScriptValue(0, 0) <=> QScriptValue(engine, 0.0)",
+ "QScriptValue(0, 0) <=> QScriptValue(engine, QString(\"\"))",
+ "QScriptValue(0, 0) <=> QScriptValue(engine, QString())",
+ "QScriptValue(0, 0) <=> QScriptValue(engine, QString(\"0\"))",
+ "QScriptValue(0, 0) <=> engine->evaluate(\"[]\")",
+ "QScriptValue(0, 0) <=> engine->evaluate(\"Array.prototype\")",
+ "QScriptValue(0, 0) <=> engine->evaluate(\"new Array()\")",
+ "QScriptValue(0, 0) <=> engine->evaluate(\"false\")",
+ "QScriptValue(0, 0) <=> engine->evaluate(\"0\")",
+ "QScriptValue(0, 0) <=> engine->evaluate(\"0.0\")",
+ "QScriptValue(0, 0) <=> engine->evaluate(\"''\")",
+ "QScriptValue(0, 0) <=> engine->evaluate(\"'0'\")",
+ "QScriptValue(0, 0) <=> engine->newArray()",
+ "QScriptValue(0, 0.0) <=> QScriptValue(false)",
+ "QScriptValue(0, 0.0) <=> QScriptValue(0)",
+ "QScriptValue(0, 0.0) <=> QScriptValue(0.0)",
+ "QScriptValue(0, 0.0) <=> QScriptValue(QString(\"\"))",
+ "QScriptValue(0, 0.0) <=> QScriptValue(QString())",
+ "QScriptValue(0, 0.0) <=> QScriptValue(QString(\"0\"))",
+ "QScriptValue(0, 0.0) <=> QScriptValue(0, false)",
+ "QScriptValue(0, 0.0) <=> QScriptValue(0, 0)",
+ "QScriptValue(0, 0.0) <=> QScriptValue(0, 0.0)",
+ "QScriptValue(0, 0.0) <=> QScriptValue(0, QString(\"\"))",
+ "QScriptValue(0, 0.0) <=> QScriptValue(0, QString())",
+ "QScriptValue(0, 0.0) <=> QScriptValue(0, QString(\"0\"))",
+ "QScriptValue(0, 0.0) <=> QScriptValue(engine, false)",
+ "QScriptValue(0, 0.0) <=> QScriptValue(engine, 0)",
+ "QScriptValue(0, 0.0) <=> QScriptValue(engine, 0.0)",
+ "QScriptValue(0, 0.0) <=> QScriptValue(engine, QString(\"\"))",
+ "QScriptValue(0, 0.0) <=> QScriptValue(engine, QString())",
+ "QScriptValue(0, 0.0) <=> QScriptValue(engine, QString(\"0\"))",
+ "QScriptValue(0, 0.0) <=> engine->evaluate(\"[]\")",
+ "QScriptValue(0, 0.0) <=> engine->evaluate(\"Array.prototype\")",
+ "QScriptValue(0, 0.0) <=> engine->evaluate(\"new Array()\")",
+ "QScriptValue(0, 0.0) <=> engine->evaluate(\"false\")",
+ "QScriptValue(0, 0.0) <=> engine->evaluate(\"0\")",
+ "QScriptValue(0, 0.0) <=> engine->evaluate(\"0.0\")",
+ "QScriptValue(0, 0.0) <=> engine->evaluate(\"''\")",
+ "QScriptValue(0, 0.0) <=> engine->evaluate(\"'0'\")",
+ "QScriptValue(0, 0.0) <=> engine->newArray()",
+ "QScriptValue(0, 123.0) <=> QScriptValue(123.0)",
+ "QScriptValue(0, 123.0) <=> QScriptValue(QString(\"123\"))",
+ "QScriptValue(0, 123.0) <=> QScriptValue(0, 123.0)",
+ "QScriptValue(0, 123.0) <=> QScriptValue(0, QString(\"123\"))",
+ "QScriptValue(0, 123.0) <=> QScriptValue(engine, 123.0)",
+ "QScriptValue(0, 123.0) <=> QScriptValue(engine, QString(\"123\"))",
+ "QScriptValue(0, 123.0) <=> engine->evaluate(\"123.0\")",
+ "QScriptValue(0, 123.0) <=> engine->evaluate(\"'123'\")",
+ "QScriptValue(0, 6.37e-8) <=> QScriptValue(6.37e-8)",
+ "QScriptValue(0, 6.37e-8) <=> QScriptValue(0, 6.37e-8)",
+ "QScriptValue(0, 6.37e-8) <=> QScriptValue(engine, 6.37e-8)",
+ "QScriptValue(0, 6.37e-8) <=> engine->evaluate(\"6.37e-8\")",
+ "QScriptValue(0, -6.37e-8) <=> QScriptValue(-6.37e-8)",
+ "QScriptValue(0, -6.37e-8) <=> QScriptValue(0, -6.37e-8)",
+ "QScriptValue(0, -6.37e-8) <=> QScriptValue(engine, -6.37e-8)",
+ "QScriptValue(0, -6.37e-8) <=> engine->evaluate(\"-6.37e-8\")",
+ "QScriptValue(0, 0x43211234) <=> QScriptValue(0x43211234)",
+ "QScriptValue(0, 0x43211234) <=> QScriptValue(0, 0x43211234)",
+ "QScriptValue(0, 0x43211234) <=> QScriptValue(engine, 0x43211234)",
+ "QScriptValue(0, 0x43211234) <=> engine->evaluate(\"0x43211234\")",
+ "QScriptValue(0, 0x10000) <=> QScriptValue(0x10000)",
+ "QScriptValue(0, 0x10000) <=> QScriptValue(0, 0x10000)",
+ "QScriptValue(0, 0x10000) <=> QScriptValue(engine, 0x10000)",
+ "QScriptValue(0, 0x10000) <=> engine->evaluate(\"0x10000\")",
+ "QScriptValue(0, 0x10001) <=> QScriptValue(0x10001)",
+ "QScriptValue(0, 0x10001) <=> QScriptValue(0, 0x10001)",
+ "QScriptValue(0, 0x10001) <=> QScriptValue(engine, 0x10001)",
+ "QScriptValue(0, 0x10001) <=> engine->evaluate(\"0x10001\")",
+ "QScriptValue(0, qInf()) <=> QScriptValue(qInf())",
+ "QScriptValue(0, qInf()) <=> QScriptValue(\"Infinity\")",
+ "QScriptValue(0, qInf()) <=> QScriptValue(0, qInf())",
+ "QScriptValue(0, qInf()) <=> QScriptValue(0, \"Infinity\")",
+ "QScriptValue(0, qInf()) <=> QScriptValue(engine, qInf())",
+ "QScriptValue(0, qInf()) <=> QScriptValue(engine, \"Infinity\")",
+ "QScriptValue(0, qInf()) <=> engine->evaluate(\"Infinity\")",
+ "QScriptValue(0, -qInf()) <=> QScriptValue(-qInf())",
+ "QScriptValue(0, -qInf()) <=> QScriptValue(\"-Infinity\")",
+ "QScriptValue(0, -qInf()) <=> QScriptValue(0, -qInf())",
+ "QScriptValue(0, -qInf()) <=> QScriptValue(0, \"-Infinity\")",
+ "QScriptValue(0, -qInf()) <=> QScriptValue(engine, -qInf())",
+ "QScriptValue(0, -qInf()) <=> QScriptValue(engine, \"-Infinity\")",
+ "QScriptValue(0, -qInf()) <=> engine->evaluate(\"-Infinity\")",
+ "QScriptValue(0, \"NaN\") <=> QScriptValue(\"NaN\")",
+ "QScriptValue(0, \"NaN\") <=> QScriptValue(0, \"NaN\")",
+ "QScriptValue(0, \"NaN\") <=> QScriptValue(engine, \"NaN\")",
+ "QScriptValue(0, \"Infinity\") <=> QScriptValue(qInf())",
+ "QScriptValue(0, \"Infinity\") <=> QScriptValue(\"Infinity\")",
+ "QScriptValue(0, \"Infinity\") <=> QScriptValue(0, qInf())",
+ "QScriptValue(0, \"Infinity\") <=> QScriptValue(0, \"Infinity\")",
+ "QScriptValue(0, \"Infinity\") <=> QScriptValue(engine, qInf())",
+ "QScriptValue(0, \"Infinity\") <=> QScriptValue(engine, \"Infinity\")",
+ "QScriptValue(0, \"Infinity\") <=> engine->evaluate(\"Infinity\")",
+ "QScriptValue(0, \"-Infinity\") <=> QScriptValue(-qInf())",
+ "QScriptValue(0, \"-Infinity\") <=> QScriptValue(\"-Infinity\")",
+ "QScriptValue(0, \"-Infinity\") <=> QScriptValue(0, -qInf())",
+ "QScriptValue(0, \"-Infinity\") <=> QScriptValue(0, \"-Infinity\")",
+ "QScriptValue(0, \"-Infinity\") <=> QScriptValue(engine, -qInf())",
+ "QScriptValue(0, \"-Infinity\") <=> QScriptValue(engine, \"-Infinity\")",
+ "QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"-Infinity\")",
+ "QScriptValue(0, \"ciao\") <=> QScriptValue(\"ciao\")",
+ "QScriptValue(0, \"ciao\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(0, \"ciao\") <=> QScriptValue(0, \"ciao\")",
+ "QScriptValue(0, \"ciao\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(0, \"ciao\") <=> QScriptValue(engine, \"ciao\")",
+ "QScriptValue(0, \"ciao\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(0, \"ciao\") <=> engine->evaluate(\"'ciao'\")",
+ "QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> QScriptValue(\"ciao\")",
+ "QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> QScriptValue(QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> QScriptValue(0, \"ciao\")",
+ "QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> QScriptValue(engine, \"ciao\")",
+ "QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"'ciao'\")",
+ "QScriptValue(0, QString(\"\")) <=> QScriptValue(false)",
+ "QScriptValue(0, QString(\"\")) <=> QScriptValue(0)",
+ "QScriptValue(0, QString(\"\")) <=> QScriptValue(0.0)",
+ "QScriptValue(0, QString(\"\")) <=> QScriptValue(QString(\"\"))",
+ "QScriptValue(0, QString(\"\")) <=> QScriptValue(QString())",
+ "QScriptValue(0, QString(\"\")) <=> QScriptValue(0, false)",
+ "QScriptValue(0, QString(\"\")) <=> QScriptValue(0, 0)",
+ "QScriptValue(0, QString(\"\")) <=> QScriptValue(0, 0.0)",
+ "QScriptValue(0, QString(\"\")) <=> QScriptValue(0, QString(\"\"))",
+ "QScriptValue(0, QString(\"\")) <=> QScriptValue(0, QString())",
+ "QScriptValue(0, QString(\"\")) <=> QScriptValue(engine, false)",
+ "QScriptValue(0, QString(\"\")) <=> QScriptValue(engine, 0)",
+ "QScriptValue(0, QString(\"\")) <=> QScriptValue(engine, 0.0)",
+ "QScriptValue(0, QString(\"\")) <=> QScriptValue(engine, QString(\"\"))",
+ "QScriptValue(0, QString(\"\")) <=> QScriptValue(engine, QString())",
+ "QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"[]\")",
+ "QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"Array.prototype\")",
+ "QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"new Array()\")",
+ "QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"false\")",
+ "QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"0\")",
+ "QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"0.0\")",
+ "QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"''\")",
+ "QScriptValue(0, QString(\"\")) <=> engine->newArray()",
+ "QScriptValue(0, QString()) <=> QScriptValue(false)",
+ "QScriptValue(0, QString()) <=> QScriptValue(0)",
+ "QScriptValue(0, QString()) <=> QScriptValue(0.0)",
+ "QScriptValue(0, QString()) <=> QScriptValue(QString(\"\"))",
+ "QScriptValue(0, QString()) <=> QScriptValue(QString())",
+ "QScriptValue(0, QString()) <=> QScriptValue(0, false)",
+ "QScriptValue(0, QString()) <=> QScriptValue(0, 0)",
+ "QScriptValue(0, QString()) <=> QScriptValue(0, 0.0)",
+ "QScriptValue(0, QString()) <=> QScriptValue(0, QString(\"\"))",
+ "QScriptValue(0, QString()) <=> QScriptValue(0, QString())",
+ "QScriptValue(0, QString()) <=> QScriptValue(engine, false)",
+ "QScriptValue(0, QString()) <=> QScriptValue(engine, 0)",
+ "QScriptValue(0, QString()) <=> QScriptValue(engine, 0.0)",
+ "QScriptValue(0, QString()) <=> QScriptValue(engine, QString(\"\"))",
+ "QScriptValue(0, QString()) <=> QScriptValue(engine, QString())",
+ "QScriptValue(0, QString()) <=> engine->evaluate(\"[]\")",
+ "QScriptValue(0, QString()) <=> engine->evaluate(\"Array.prototype\")",
+ "QScriptValue(0, QString()) <=> engine->evaluate(\"new Array()\")",
+ "QScriptValue(0, QString()) <=> engine->evaluate(\"false\")",
+ "QScriptValue(0, QString()) <=> engine->evaluate(\"0\")",
+ "QScriptValue(0, QString()) <=> engine->evaluate(\"0.0\")",
+ "QScriptValue(0, QString()) <=> engine->evaluate(\"''\")",
+ "QScriptValue(0, QString()) <=> engine->newArray()",
+ "QScriptValue(0, QString(\"0\")) <=> QScriptValue(false)",
+ "QScriptValue(0, QString(\"0\")) <=> QScriptValue(0)",
+ "QScriptValue(0, QString(\"0\")) <=> QScriptValue(0.0)",
+ "QScriptValue(0, QString(\"0\")) <=> QScriptValue(QString(\"0\"))",
+ "QScriptValue(0, QString(\"0\")) <=> QScriptValue(0, false)",
+ "QScriptValue(0, QString(\"0\")) <=> QScriptValue(0, 0)",
+ "QScriptValue(0, QString(\"0\")) <=> QScriptValue(0, 0.0)",
+ "QScriptValue(0, QString(\"0\")) <=> QScriptValue(0, QString(\"0\"))",
+ "QScriptValue(0, QString(\"0\")) <=> QScriptValue(engine, false)",
+ "QScriptValue(0, QString(\"0\")) <=> QScriptValue(engine, 0)",
+ "QScriptValue(0, QString(\"0\")) <=> QScriptValue(engine, 0.0)",
+ "QScriptValue(0, QString(\"0\")) <=> QScriptValue(engine, QString(\"0\"))",
+ "QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"false\")",
+ "QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"0\")",
+ "QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"0.0\")",
+ "QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"'0'\")",
+ "QScriptValue(0, QString(\"123\")) <=> QScriptValue(123.0)",
+ "QScriptValue(0, QString(\"123\")) <=> QScriptValue(QString(\"123\"))",
+ "QScriptValue(0, QString(\"123\")) <=> QScriptValue(0, 123.0)",
+ "QScriptValue(0, QString(\"123\")) <=> QScriptValue(0, QString(\"123\"))",
+ "QScriptValue(0, QString(\"123\")) <=> QScriptValue(engine, 123.0)",
+ "QScriptValue(0, QString(\"123\")) <=> QScriptValue(engine, QString(\"123\"))",
+ "QScriptValue(0, QString(\"123\")) <=> engine->evaluate(\"123.0\")",
+ "QScriptValue(0, QString(\"123\")) <=> engine->evaluate(\"'123'\")",
+ "QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(0, QString(\"12.3\"))",
+ "QScriptValue(engine, QScriptValue::UndefinedValue) <=> QScriptValue(QScriptValue::UndefinedValue)",
+ "QScriptValue(engine, QScriptValue::UndefinedValue) <=> QScriptValue(QScriptValue::NullValue)",
+ "QScriptValue(engine, QScriptValue::UndefinedValue) <=> QScriptValue(0, QScriptValue::UndefinedValue)",
+ "QScriptValue(engine, QScriptValue::UndefinedValue) <=> QScriptValue(0, QScriptValue::NullValue)",
+ "QScriptValue(engine, QScriptValue::UndefinedValue) <=> QScriptValue(engine, QScriptValue::UndefinedValue)",
+ "QScriptValue(engine, QScriptValue::UndefinedValue) <=> QScriptValue(engine, QScriptValue::NullValue)",
+ "QScriptValue(engine, QScriptValue::UndefinedValue) <=> engine->evaluate(\"{}\")",
+ "QScriptValue(engine, QScriptValue::UndefinedValue) <=> engine->evaluate(\"undefined\")",
+ "QScriptValue(engine, QScriptValue::UndefinedValue) <=> engine->evaluate(\"null\")",
+ "QScriptValue(engine, QScriptValue::UndefinedValue) <=> engine->nullValue()",
+ "QScriptValue(engine, QScriptValue::UndefinedValue) <=> engine->undefinedValue()",
+ "QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(QScriptValue::UndefinedValue)",
+ "QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(QScriptValue::NullValue)",
+ "QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(0, QScriptValue::UndefinedValue)",
+ "QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(0, QScriptValue::NullValue)",
+ "QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(engine, QScriptValue::UndefinedValue)",
+ "QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(engine, QScriptValue::NullValue)",
+ "QScriptValue(engine, QScriptValue::NullValue) <=> engine->evaluate(\"{}\")",
+ "QScriptValue(engine, QScriptValue::NullValue) <=> engine->evaluate(\"undefined\")",
+ "QScriptValue(engine, QScriptValue::NullValue) <=> engine->evaluate(\"null\")",
+ "QScriptValue(engine, QScriptValue::NullValue) <=> engine->nullValue()",
+ "QScriptValue(engine, QScriptValue::NullValue) <=> engine->undefinedValue()",
+ "QScriptValue(engine, true) <=> QScriptValue(true)",
+ "QScriptValue(engine, true) <=> QScriptValue(0, true)",
+ "QScriptValue(engine, true) <=> QScriptValue(engine, true)",
+ "QScriptValue(engine, true) <=> engine->evaluate(\"true\")",
+ "QScriptValue(engine, false) <=> QScriptValue(false)",
+ "QScriptValue(engine, false) <=> QScriptValue(0)",
+ "QScriptValue(engine, false) <=> QScriptValue(0.0)",
+ "QScriptValue(engine, false) <=> QScriptValue(QString(\"\"))",
+ "QScriptValue(engine, false) <=> QScriptValue(QString())",
+ "QScriptValue(engine, false) <=> QScriptValue(QString(\"0\"))",
+ "QScriptValue(engine, false) <=> QScriptValue(0, false)",
+ "QScriptValue(engine, false) <=> QScriptValue(0, 0)",
+ "QScriptValue(engine, false) <=> QScriptValue(0, 0.0)",
+ "QScriptValue(engine, false) <=> QScriptValue(0, QString(\"\"))",
+ "QScriptValue(engine, false) <=> QScriptValue(0, QString())",
+ "QScriptValue(engine, false) <=> QScriptValue(0, QString(\"0\"))",
+ "QScriptValue(engine, false) <=> QScriptValue(engine, false)",
+ "QScriptValue(engine, false) <=> QScriptValue(engine, 0)",
+ "QScriptValue(engine, false) <=> QScriptValue(engine, 0.0)",
+ "QScriptValue(engine, false) <=> QScriptValue(engine, QString(\"\"))",
+ "QScriptValue(engine, false) <=> QScriptValue(engine, QString())",
+ "QScriptValue(engine, false) <=> QScriptValue(engine, QString(\"0\"))",
+ "QScriptValue(engine, false) <=> engine->evaluate(\"[]\")",
+ "QScriptValue(engine, false) <=> engine->evaluate(\"Array.prototype\")",
+ "QScriptValue(engine, false) <=> engine->evaluate(\"new Array()\")",
+ "QScriptValue(engine, false) <=> engine->evaluate(\"false\")",
+ "QScriptValue(engine, false) <=> engine->evaluate(\"0\")",
+ "QScriptValue(engine, false) <=> engine->evaluate(\"0.0\")",
+ "QScriptValue(engine, false) <=> engine->evaluate(\"''\")",
+ "QScriptValue(engine, false) <=> engine->evaluate(\"'0'\")",
+ "QScriptValue(engine, false) <=> engine->newArray()",
+ "QScriptValue(engine, int(122)) <=> QScriptValue(int(122))",
+ "QScriptValue(engine, int(122)) <=> QScriptValue(0, int(122))",
+ "QScriptValue(engine, int(122)) <=> QScriptValue(engine, int(122))",
+ "QScriptValue(engine, int(122)) <=> engine->evaluate(\"122\")",
+ "QScriptValue(engine, uint(124)) <=> QScriptValue(uint(124))",
+ "QScriptValue(engine, uint(124)) <=> QScriptValue(0, uint(124))",
+ "QScriptValue(engine, uint(124)) <=> QScriptValue(engine, uint(124))",
+ "QScriptValue(engine, uint(124)) <=> engine->evaluate(\"124\")",
+ "QScriptValue(engine, 0) <=> QScriptValue(false)",
+ "QScriptValue(engine, 0) <=> QScriptValue(0)",
+ "QScriptValue(engine, 0) <=> QScriptValue(0.0)",
+ "QScriptValue(engine, 0) <=> QScriptValue(QString(\"\"))",
+ "QScriptValue(engine, 0) <=> QScriptValue(QString())",
+ "QScriptValue(engine, 0) <=> QScriptValue(QString(\"0\"))",
+ "QScriptValue(engine, 0) <=> QScriptValue(0, false)",
+ "QScriptValue(engine, 0) <=> QScriptValue(0, 0)",
+ "QScriptValue(engine, 0) <=> QScriptValue(0, 0.0)",
+ "QScriptValue(engine, 0) <=> QScriptValue(0, QString(\"\"))",
+ "QScriptValue(engine, 0) <=> QScriptValue(0, QString())",
+ "QScriptValue(engine, 0) <=> QScriptValue(0, QString(\"0\"))",
+ "QScriptValue(engine, 0) <=> QScriptValue(engine, false)",
+ "QScriptValue(engine, 0) <=> QScriptValue(engine, 0)",
+ "QScriptValue(engine, 0) <=> QScriptValue(engine, 0.0)",
+ "QScriptValue(engine, 0) <=> QScriptValue(engine, QString(\"\"))",
+ "QScriptValue(engine, 0) <=> QScriptValue(engine, QString())",
+ "QScriptValue(engine, 0) <=> QScriptValue(engine, QString(\"0\"))",
+ "QScriptValue(engine, 0) <=> engine->evaluate(\"[]\")",
+ "QScriptValue(engine, 0) <=> engine->evaluate(\"Array.prototype\")",
+ "QScriptValue(engine, 0) <=> engine->evaluate(\"new Array()\")",
+ "QScriptValue(engine, 0) <=> engine->evaluate(\"false\")",
+ "QScriptValue(engine, 0) <=> engine->evaluate(\"0\")",
+ "QScriptValue(engine, 0) <=> engine->evaluate(\"0.0\")",
+ "QScriptValue(engine, 0) <=> engine->evaluate(\"''\")",
+ "QScriptValue(engine, 0) <=> engine->evaluate(\"'0'\")",
+ "QScriptValue(engine, 0) <=> engine->newArray()",
+ "QScriptValue(engine, 0.0) <=> QScriptValue(false)",
+ "QScriptValue(engine, 0.0) <=> QScriptValue(0)",
+ "QScriptValue(engine, 0.0) <=> QScriptValue(0.0)",
+ "QScriptValue(engine, 0.0) <=> QScriptValue(QString(\"\"))",
+ "QScriptValue(engine, 0.0) <=> QScriptValue(QString())",
+ "QScriptValue(engine, 0.0) <=> QScriptValue(QString(\"0\"))",
+ "QScriptValue(engine, 0.0) <=> QScriptValue(0, false)",
+ "QScriptValue(engine, 0.0) <=> QScriptValue(0, 0)",
+ "QScriptValue(engine, 0.0) <=> QScriptValue(0, 0.0)",
+ "QScriptValue(engine, 0.0) <=> QScriptValue(0, QString(\"\"))",
+ "QScriptValue(engine, 0.0) <=> QScriptValue(0, QString())",
+ "QScriptValue(engine, 0.0) <=> QScriptValue(0, QString(\"0\"))",
+ "QScriptValue(engine, 0.0) <=> QScriptValue(engine, false)",
+ "QScriptValue(engine, 0.0) <=> QScriptValue(engine, 0)",
+ "QScriptValue(engine, 0.0) <=> QScriptValue(engine, 0.0)",
+ "QScriptValue(engine, 0.0) <=> QScriptValue(engine, QString(\"\"))",
+ "QScriptValue(engine, 0.0) <=> QScriptValue(engine, QString())",
+ "QScriptValue(engine, 0.0) <=> QScriptValue(engine, QString(\"0\"))",
+ "QScriptValue(engine, 0.0) <=> engine->evaluate(\"[]\")",
+ "QScriptValue(engine, 0.0) <=> engine->evaluate(\"Array.prototype\")",
+ "QScriptValue(engine, 0.0) <=> engine->evaluate(\"new Array()\")",
+ "QScriptValue(engine, 0.0) <=> engine->evaluate(\"false\")",
+ "QScriptValue(engine, 0.0) <=> engine->evaluate(\"0\")",
+ "QScriptValue(engine, 0.0) <=> engine->evaluate(\"0.0\")",
+ "QScriptValue(engine, 0.0) <=> engine->evaluate(\"''\")",
+ "QScriptValue(engine, 0.0) <=> engine->evaluate(\"'0'\")",
+ "QScriptValue(engine, 0.0) <=> engine->newArray()",
+ "QScriptValue(engine, 123.0) <=> QScriptValue(123.0)",
+ "QScriptValue(engine, 123.0) <=> QScriptValue(QString(\"123\"))",
+ "QScriptValue(engine, 123.0) <=> QScriptValue(0, 123.0)",
+ "QScriptValue(engine, 123.0) <=> QScriptValue(0, QString(\"123\"))",
+ "QScriptValue(engine, 123.0) <=> QScriptValue(engine, 123.0)",
+ "QScriptValue(engine, 123.0) <=> QScriptValue(engine, QString(\"123\"))",
+ "QScriptValue(engine, 123.0) <=> engine->evaluate(\"123.0\")",
+ "QScriptValue(engine, 123.0) <=> engine->evaluate(\"'123'\")",
+ "QScriptValue(engine, 6.37e-8) <=> QScriptValue(6.37e-8)",
+ "QScriptValue(engine, 6.37e-8) <=> QScriptValue(0, 6.37e-8)",
+ "QScriptValue(engine, 6.37e-8) <=> QScriptValue(engine, 6.37e-8)",
+ "QScriptValue(engine, 6.37e-8) <=> engine->evaluate(\"6.37e-8\")",
+ "QScriptValue(engine, -6.37e-8) <=> QScriptValue(-6.37e-8)",
+ "QScriptValue(engine, -6.37e-8) <=> QScriptValue(0, -6.37e-8)",
+ "QScriptValue(engine, -6.37e-8) <=> QScriptValue(engine, -6.37e-8)",
+ "QScriptValue(engine, -6.37e-8) <=> engine->evaluate(\"-6.37e-8\")",
+ "QScriptValue(engine, 0x43211234) <=> QScriptValue(0x43211234)",
+ "QScriptValue(engine, 0x43211234) <=> QScriptValue(0, 0x43211234)",
+ "QScriptValue(engine, 0x43211234) <=> QScriptValue(engine, 0x43211234)",
+ "QScriptValue(engine, 0x43211234) <=> engine->evaluate(\"0x43211234\")",
+ "QScriptValue(engine, 0x10000) <=> QScriptValue(0x10000)",
+ "QScriptValue(engine, 0x10000) <=> QScriptValue(0, 0x10000)",
+ "QScriptValue(engine, 0x10000) <=> QScriptValue(engine, 0x10000)",
+ "QScriptValue(engine, 0x10000) <=> engine->evaluate(\"0x10000\")",
+ "QScriptValue(engine, 0x10001) <=> QScriptValue(0x10001)",
+ "QScriptValue(engine, 0x10001) <=> QScriptValue(0, 0x10001)",
+ "QScriptValue(engine, 0x10001) <=> QScriptValue(engine, 0x10001)",
+ "QScriptValue(engine, 0x10001) <=> engine->evaluate(\"0x10001\")",
+ "QScriptValue(engine, qInf()) <=> QScriptValue(qInf())",
+ "QScriptValue(engine, qInf()) <=> QScriptValue(\"Infinity\")",
+ "QScriptValue(engine, qInf()) <=> QScriptValue(0, qInf())",
+ "QScriptValue(engine, qInf()) <=> QScriptValue(0, \"Infinity\")",
+ "QScriptValue(engine, qInf()) <=> QScriptValue(engine, qInf())",
+ "QScriptValue(engine, qInf()) <=> QScriptValue(engine, \"Infinity\")",
+ "QScriptValue(engine, qInf()) <=> engine->evaluate(\"Infinity\")",
+ "QScriptValue(engine, -qInf()) <=> QScriptValue(-qInf())",
+ "QScriptValue(engine, -qInf()) <=> QScriptValue(\"-Infinity\")",
+ "QScriptValue(engine, -qInf()) <=> QScriptValue(0, -qInf())",
+ "QScriptValue(engine, -qInf()) <=> QScriptValue(0, \"-Infinity\")",
+ "QScriptValue(engine, -qInf()) <=> QScriptValue(engine, -qInf())",
+ "QScriptValue(engine, -qInf()) <=> QScriptValue(engine, \"-Infinity\")",
+ "QScriptValue(engine, -qInf()) <=> engine->evaluate(\"-Infinity\")",
+ "QScriptValue(engine, \"NaN\") <=> QScriptValue(\"NaN\")",
+ "QScriptValue(engine, \"NaN\") <=> QScriptValue(0, \"NaN\")",
+ "QScriptValue(engine, \"NaN\") <=> QScriptValue(engine, \"NaN\")",
+ "QScriptValue(engine, \"Infinity\") <=> QScriptValue(qInf())",
+ "QScriptValue(engine, \"Infinity\") <=> QScriptValue(\"Infinity\")",
+ "QScriptValue(engine, \"Infinity\") <=> QScriptValue(0, qInf())",
+ "QScriptValue(engine, \"Infinity\") <=> QScriptValue(0, \"Infinity\")",
+ "QScriptValue(engine, \"Infinity\") <=> QScriptValue(engine, qInf())",
+ "QScriptValue(engine, \"Infinity\") <=> QScriptValue(engine, \"Infinity\")",
+ "QScriptValue(engine, \"Infinity\") <=> engine->evaluate(\"Infinity\")",
+ "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(-qInf())",
+ "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(\"-Infinity\")",
+ "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(0, -qInf())",
+ "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(0, \"-Infinity\")",
+ "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(engine, -qInf())",
+ "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(engine, \"-Infinity\")",
+ "QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"-Infinity\")",
+ "QScriptValue(engine, \"ciao\") <=> QScriptValue(\"ciao\")",
+ "QScriptValue(engine, \"ciao\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(engine, \"ciao\") <=> QScriptValue(0, \"ciao\")",
+ "QScriptValue(engine, \"ciao\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(engine, \"ciao\") <=> QScriptValue(engine, \"ciao\")",
+ "QScriptValue(engine, \"ciao\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(engine, \"ciao\") <=> engine->evaluate(\"'ciao'\")",
+ "QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> QScriptValue(\"ciao\")",
+ "QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> QScriptValue(QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> QScriptValue(0, \"ciao\")",
+ "QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> QScriptValue(engine, \"ciao\")",
+ "QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"'ciao'\")",
+ "QScriptValue(engine, QString(\"\")) <=> QScriptValue(false)",
+ "QScriptValue(engine, QString(\"\")) <=> QScriptValue(0)",
+ "QScriptValue(engine, QString(\"\")) <=> QScriptValue(0.0)",
+ "QScriptValue(engine, QString(\"\")) <=> QScriptValue(QString(\"\"))",
+ "QScriptValue(engine, QString(\"\")) <=> QScriptValue(QString())",
+ "QScriptValue(engine, QString(\"\")) <=> QScriptValue(0, false)",
+ "QScriptValue(engine, QString(\"\")) <=> QScriptValue(0, 0)",
+ "QScriptValue(engine, QString(\"\")) <=> QScriptValue(0, 0.0)",
+ "QScriptValue(engine, QString(\"\")) <=> QScriptValue(0, QString(\"\"))",
+ "QScriptValue(engine, QString(\"\")) <=> QScriptValue(0, QString())",
+ "QScriptValue(engine, QString(\"\")) <=> QScriptValue(engine, false)",
+ "QScriptValue(engine, QString(\"\")) <=> QScriptValue(engine, 0)",
+ "QScriptValue(engine, QString(\"\")) <=> QScriptValue(engine, 0.0)",
+ "QScriptValue(engine, QString(\"\")) <=> QScriptValue(engine, QString(\"\"))",
+ "QScriptValue(engine, QString(\"\")) <=> QScriptValue(engine, QString())",
+ "QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"[]\")",
+ "QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"Array.prototype\")",
+ "QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"new Array()\")",
+ "QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"false\")",
+ "QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"0\")",
+ "QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"0.0\")",
+ "QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"''\")",
+ "QScriptValue(engine, QString(\"\")) <=> engine->newArray()",
+ "QScriptValue(engine, QString()) <=> QScriptValue(false)",
+ "QScriptValue(engine, QString()) <=> QScriptValue(0)",
+ "QScriptValue(engine, QString()) <=> QScriptValue(0.0)",
+ "QScriptValue(engine, QString()) <=> QScriptValue(QString(\"\"))",
+ "QScriptValue(engine, QString()) <=> QScriptValue(QString())",
+ "QScriptValue(engine, QString()) <=> QScriptValue(0, false)",
+ "QScriptValue(engine, QString()) <=> QScriptValue(0, 0)",
+ "QScriptValue(engine, QString()) <=> QScriptValue(0, 0.0)",
+ "QScriptValue(engine, QString()) <=> QScriptValue(0, QString(\"\"))",
+ "QScriptValue(engine, QString()) <=> QScriptValue(0, QString())",
+ "QScriptValue(engine, QString()) <=> QScriptValue(engine, false)",
+ "QScriptValue(engine, QString()) <=> QScriptValue(engine, 0)",
+ "QScriptValue(engine, QString()) <=> QScriptValue(engine, 0.0)",
+ "QScriptValue(engine, QString()) <=> QScriptValue(engine, QString(\"\"))",
+ "QScriptValue(engine, QString()) <=> QScriptValue(engine, QString())",
+ "QScriptValue(engine, QString()) <=> engine->evaluate(\"[]\")",
+ "QScriptValue(engine, QString()) <=> engine->evaluate(\"Array.prototype\")",
+ "QScriptValue(engine, QString()) <=> engine->evaluate(\"new Array()\")",
+ "QScriptValue(engine, QString()) <=> engine->evaluate(\"false\")",
+ "QScriptValue(engine, QString()) <=> engine->evaluate(\"0\")",
+ "QScriptValue(engine, QString()) <=> engine->evaluate(\"0.0\")",
+ "QScriptValue(engine, QString()) <=> engine->evaluate(\"''\")",
+ "QScriptValue(engine, QString()) <=> engine->newArray()",
+ "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(false)",
+ "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(0)",
+ "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(0.0)",
+ "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(QString(\"0\"))",
+ "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(0, false)",
+ "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(0, 0)",
+ "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(0, 0.0)",
+ "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(0, QString(\"0\"))",
+ "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(engine, false)",
+ "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(engine, 0)",
+ "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(engine, 0.0)",
+ "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(engine, QString(\"0\"))",
+ "QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"false\")",
+ "QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"0\")",
+ "QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"0.0\")",
+ "QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"'0'\")",
+ "QScriptValue(engine, QString(\"123\")) <=> QScriptValue(123.0)",
+ "QScriptValue(engine, QString(\"123\")) <=> QScriptValue(QString(\"123\"))",
+ "QScriptValue(engine, QString(\"123\")) <=> QScriptValue(0, 123.0)",
+ "QScriptValue(engine, QString(\"123\")) <=> QScriptValue(0, QString(\"123\"))",
+ "QScriptValue(engine, QString(\"123\")) <=> QScriptValue(engine, 123.0)",
+ "QScriptValue(engine, QString(\"123\")) <=> QScriptValue(engine, QString(\"123\"))",
+ "QScriptValue(engine, QString(\"123\")) <=> engine->evaluate(\"123.0\")",
+ "QScriptValue(engine, QString(\"123\")) <=> engine->evaluate(\"'123'\")",
+ "QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(engine, QString(\"1.23\"))",
+ "engine->evaluate(\"[]\") <=> QScriptValue(false)",
+ "engine->evaluate(\"[]\") <=> QScriptValue(0)",
+ "engine->evaluate(\"[]\") <=> QScriptValue(0.0)",
+ "engine->evaluate(\"[]\") <=> QScriptValue(QString(\"\"))",
+ "engine->evaluate(\"[]\") <=> QScriptValue(QString())",
+ "engine->evaluate(\"[]\") <=> QScriptValue(0, false)",
+ "engine->evaluate(\"[]\") <=> QScriptValue(0, 0)",
+ "engine->evaluate(\"[]\") <=> QScriptValue(0, 0.0)",
+ "engine->evaluate(\"[]\") <=> QScriptValue(0, QString(\"\"))",
+ "engine->evaluate(\"[]\") <=> QScriptValue(0, QString())",
+ "engine->evaluate(\"[]\") <=> QScriptValue(engine, false)",
+ "engine->evaluate(\"[]\") <=> QScriptValue(engine, 0)",
+ "engine->evaluate(\"[]\") <=> QScriptValue(engine, 0.0)",
+ "engine->evaluate(\"[]\") <=> QScriptValue(engine, QString(\"\"))",
+ "engine->evaluate(\"[]\") <=> QScriptValue(engine, QString())",
+ "engine->evaluate(\"[]\") <=> engine->evaluate(\"false\")",
+ "engine->evaluate(\"[]\") <=> engine->evaluate(\"0\")",
+ "engine->evaluate(\"[]\") <=> engine->evaluate(\"0.0\")",
+ "engine->evaluate(\"[]\") <=> engine->evaluate(\"''\")",
+ "engine->evaluate(\"{}\") <=> QScriptValue(QScriptValue::UndefinedValue)",
+ "engine->evaluate(\"{}\") <=> QScriptValue(QScriptValue::NullValue)",
+ "engine->evaluate(\"{}\") <=> QScriptValue(0, QScriptValue::UndefinedValue)",
+ "engine->evaluate(\"{}\") <=> QScriptValue(0, QScriptValue::NullValue)",
+ "engine->evaluate(\"{}\") <=> QScriptValue(engine, QScriptValue::UndefinedValue)",
+ "engine->evaluate(\"{}\") <=> QScriptValue(engine, QScriptValue::NullValue)",
+ "engine->evaluate(\"{}\") <=> engine->evaluate(\"{}\")",
+ "engine->evaluate(\"{}\") <=> engine->evaluate(\"undefined\")",
+ "engine->evaluate(\"{}\") <=> engine->evaluate(\"null\")",
+ "engine->evaluate(\"{}\") <=> engine->nullValue()",
+ "engine->evaluate(\"{}\") <=> engine->undefinedValue()",
+ "engine->evaluate(\"Object.prototype\") <=> engine->evaluate(\"Object.prototype\")",
+ "engine->evaluate(\"Date.prototype\") <=> engine->evaluate(\"Date.prototype\")",
+ "engine->evaluate(\"Array.prototype\") <=> QScriptValue(false)",
+ "engine->evaluate(\"Array.prototype\") <=> QScriptValue(0)",
+ "engine->evaluate(\"Array.prototype\") <=> QScriptValue(0.0)",
+ "engine->evaluate(\"Array.prototype\") <=> QScriptValue(QString(\"\"))",
+ "engine->evaluate(\"Array.prototype\") <=> QScriptValue(QString())",
+ "engine->evaluate(\"Array.prototype\") <=> QScriptValue(0, false)",
+ "engine->evaluate(\"Array.prototype\") <=> QScriptValue(0, 0)",
+ "engine->evaluate(\"Array.prototype\") <=> QScriptValue(0, 0.0)",
+ "engine->evaluate(\"Array.prototype\") <=> QScriptValue(0, QString(\"\"))",
+ "engine->evaluate(\"Array.prototype\") <=> QScriptValue(0, QString())",
+ "engine->evaluate(\"Array.prototype\") <=> QScriptValue(engine, false)",
+ "engine->evaluate(\"Array.prototype\") <=> QScriptValue(engine, 0)",
+ "engine->evaluate(\"Array.prototype\") <=> QScriptValue(engine, 0.0)",
+ "engine->evaluate(\"Array.prototype\") <=> QScriptValue(engine, QString(\"\"))",
+ "engine->evaluate(\"Array.prototype\") <=> QScriptValue(engine, QString())",
+ "engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"Array.prototype\")",
+ "engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"false\")",
+ "engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"0\")",
+ "engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"0.0\")",
+ "engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"''\")",
+ "engine->evaluate(\"Function.prototype\") <=> engine->evaluate(\"Function.prototype\")",
+ "engine->evaluate(\"Error.prototype\") <=> engine->evaluate(\"Error.prototype\")",
+ "engine->evaluate(\"Object\") <=> engine->evaluate(\"Object\")",
+ "engine->evaluate(\"Array\") <=> engine->evaluate(\"Array\")",
+ "engine->evaluate(\"Number\") <=> engine->evaluate(\"Number\")",
+ "engine->evaluate(\"Function\") <=> engine->evaluate(\"Function\")",
+ "engine->evaluate(\"new Array()\") <=> QScriptValue(false)",
+ "engine->evaluate(\"new Array()\") <=> QScriptValue(0)",
+ "engine->evaluate(\"new Array()\") <=> QScriptValue(0.0)",
+ "engine->evaluate(\"new Array()\") <=> QScriptValue(QString(\"\"))",
+ "engine->evaluate(\"new Array()\") <=> QScriptValue(QString())",
+ "engine->evaluate(\"new Array()\") <=> QScriptValue(0, false)",
+ "engine->evaluate(\"new Array()\") <=> QScriptValue(0, 0)",
+ "engine->evaluate(\"new Array()\") <=> QScriptValue(0, 0.0)",
+ "engine->evaluate(\"new Array()\") <=> QScriptValue(0, QString(\"\"))",
+ "engine->evaluate(\"new Array()\") <=> QScriptValue(0, QString())",
+ "engine->evaluate(\"new Array()\") <=> QScriptValue(engine, false)",
+ "engine->evaluate(\"new Array()\") <=> QScriptValue(engine, 0)",
+ "engine->evaluate(\"new Array()\") <=> QScriptValue(engine, 0.0)",
+ "engine->evaluate(\"new Array()\") <=> QScriptValue(engine, QString(\"\"))",
+ "engine->evaluate(\"new Array()\") <=> QScriptValue(engine, QString())",
+ "engine->evaluate(\"new Array()\") <=> engine->evaluate(\"false\")",
+ "engine->evaluate(\"new Array()\") <=> engine->evaluate(\"0\")",
+ "engine->evaluate(\"new Array()\") <=> engine->evaluate(\"0.0\")",
+ "engine->evaluate(\"new Array()\") <=> engine->evaluate(\"''\")",
+ "engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")",
+ "engine->evaluate(\"undefined\") <=> QScriptValue(QScriptValue::UndefinedValue)",
+ "engine->evaluate(\"undefined\") <=> QScriptValue(QScriptValue::NullValue)",
+ "engine->evaluate(\"undefined\") <=> QScriptValue(0, QScriptValue::UndefinedValue)",
+ "engine->evaluate(\"undefined\") <=> QScriptValue(0, QScriptValue::NullValue)",
+ "engine->evaluate(\"undefined\") <=> QScriptValue(engine, QScriptValue::UndefinedValue)",
+ "engine->evaluate(\"undefined\") <=> QScriptValue(engine, QScriptValue::NullValue)",
+ "engine->evaluate(\"undefined\") <=> engine->evaluate(\"{}\")",
+ "engine->evaluate(\"undefined\") <=> engine->evaluate(\"undefined\")",
+ "engine->evaluate(\"undefined\") <=> engine->evaluate(\"null\")",
+ "engine->evaluate(\"undefined\") <=> engine->nullValue()",
+ "engine->evaluate(\"undefined\") <=> engine->undefinedValue()",
+ "engine->evaluate(\"null\") <=> QScriptValue(QScriptValue::UndefinedValue)",
+ "engine->evaluate(\"null\") <=> QScriptValue(QScriptValue::NullValue)",
+ "engine->evaluate(\"null\") <=> QScriptValue(0, QScriptValue::UndefinedValue)",
+ "engine->evaluate(\"null\") <=> QScriptValue(0, QScriptValue::NullValue)",
+ "engine->evaluate(\"null\") <=> QScriptValue(engine, QScriptValue::UndefinedValue)",
+ "engine->evaluate(\"null\") <=> QScriptValue(engine, QScriptValue::NullValue)",
+ "engine->evaluate(\"null\") <=> engine->evaluate(\"{}\")",
+ "engine->evaluate(\"null\") <=> engine->evaluate(\"undefined\")",
+ "engine->evaluate(\"null\") <=> engine->evaluate(\"null\")",
+ "engine->evaluate(\"null\") <=> engine->nullValue()",
+ "engine->evaluate(\"null\") <=> engine->undefinedValue()",
+ "engine->evaluate(\"true\") <=> QScriptValue(true)",
+ "engine->evaluate(\"true\") <=> QScriptValue(0, true)",
+ "engine->evaluate(\"true\") <=> QScriptValue(engine, true)",
+ "engine->evaluate(\"true\") <=> engine->evaluate(\"true\")",
+ "engine->evaluate(\"false\") <=> QScriptValue(false)",
+ "engine->evaluate(\"false\") <=> QScriptValue(0)",
+ "engine->evaluate(\"false\") <=> QScriptValue(0.0)",
+ "engine->evaluate(\"false\") <=> QScriptValue(QString(\"\"))",
+ "engine->evaluate(\"false\") <=> QScriptValue(QString())",
+ "engine->evaluate(\"false\") <=> QScriptValue(QString(\"0\"))",
+ "engine->evaluate(\"false\") <=> QScriptValue(0, false)",
+ "engine->evaluate(\"false\") <=> QScriptValue(0, 0)",
+ "engine->evaluate(\"false\") <=> QScriptValue(0, 0.0)",
+ "engine->evaluate(\"false\") <=> QScriptValue(0, QString(\"\"))",
+ "engine->evaluate(\"false\") <=> QScriptValue(0, QString())",
+ "engine->evaluate(\"false\") <=> QScriptValue(0, QString(\"0\"))",
+ "engine->evaluate(\"false\") <=> QScriptValue(engine, false)",
+ "engine->evaluate(\"false\") <=> QScriptValue(engine, 0)",
+ "engine->evaluate(\"false\") <=> QScriptValue(engine, 0.0)",
+ "engine->evaluate(\"false\") <=> QScriptValue(engine, QString(\"\"))",
+ "engine->evaluate(\"false\") <=> QScriptValue(engine, QString())",
+ "engine->evaluate(\"false\") <=> QScriptValue(engine, QString(\"0\"))",
+ "engine->evaluate(\"false\") <=> engine->evaluate(\"[]\")",
+ "engine->evaluate(\"false\") <=> engine->evaluate(\"Array.prototype\")",
+ "engine->evaluate(\"false\") <=> engine->evaluate(\"new Array()\")",
+ "engine->evaluate(\"false\") <=> engine->evaluate(\"false\")",
+ "engine->evaluate(\"false\") <=> engine->evaluate(\"0\")",
+ "engine->evaluate(\"false\") <=> engine->evaluate(\"0.0\")",
+ "engine->evaluate(\"false\") <=> engine->evaluate(\"''\")",
+ "engine->evaluate(\"false\") <=> engine->evaluate(\"'0'\")",
+ "engine->evaluate(\"false\") <=> engine->newArray()",
+ "engine->evaluate(\"122\") <=> QScriptValue(int(122))",
+ "engine->evaluate(\"122\") <=> QScriptValue(0, int(122))",
+ "engine->evaluate(\"122\") <=> QScriptValue(engine, int(122))",
+ "engine->evaluate(\"122\") <=> engine->evaluate(\"122\")",
+ "engine->evaluate(\"124\") <=> QScriptValue(uint(124))",
+ "engine->evaluate(\"124\") <=> QScriptValue(0, uint(124))",
+ "engine->evaluate(\"124\") <=> QScriptValue(engine, uint(124))",
+ "engine->evaluate(\"124\") <=> engine->evaluate(\"124\")",
+ "engine->evaluate(\"0\") <=> QScriptValue(false)",
+ "engine->evaluate(\"0\") <=> QScriptValue(0)",
+ "engine->evaluate(\"0\") <=> QScriptValue(0.0)",
+ "engine->evaluate(\"0\") <=> QScriptValue(QString(\"\"))",
+ "engine->evaluate(\"0\") <=> QScriptValue(QString())",
+ "engine->evaluate(\"0\") <=> QScriptValue(QString(\"0\"))",
+ "engine->evaluate(\"0\") <=> QScriptValue(0, false)",
+ "engine->evaluate(\"0\") <=> QScriptValue(0, 0)",
+ "engine->evaluate(\"0\") <=> QScriptValue(0, 0.0)",
+ "engine->evaluate(\"0\") <=> QScriptValue(0, QString(\"\"))",
+ "engine->evaluate(\"0\") <=> QScriptValue(0, QString())",
+ "engine->evaluate(\"0\") <=> QScriptValue(0, QString(\"0\"))",
+ "engine->evaluate(\"0\") <=> QScriptValue(engine, false)",
+ "engine->evaluate(\"0\") <=> QScriptValue(engine, 0)",
+ "engine->evaluate(\"0\") <=> QScriptValue(engine, 0.0)",
+ "engine->evaluate(\"0\") <=> QScriptValue(engine, QString(\"\"))",
+ "engine->evaluate(\"0\") <=> QScriptValue(engine, QString())",
+ "engine->evaluate(\"0\") <=> QScriptValue(engine, QString(\"0\"))",
+ "engine->evaluate(\"0\") <=> engine->evaluate(\"[]\")",
+ "engine->evaluate(\"0\") <=> engine->evaluate(\"Array.prototype\")",
+ "engine->evaluate(\"0\") <=> engine->evaluate(\"new Array()\")",
+ "engine->evaluate(\"0\") <=> engine->evaluate(\"false\")",
+ "engine->evaluate(\"0\") <=> engine->evaluate(\"0\")",
+ "engine->evaluate(\"0\") <=> engine->evaluate(\"0.0\")",
+ "engine->evaluate(\"0\") <=> engine->evaluate(\"''\")",
+ "engine->evaluate(\"0\") <=> engine->evaluate(\"'0'\")",
+ "engine->evaluate(\"0\") <=> engine->newArray()",
+ "engine->evaluate(\"0.0\") <=> QScriptValue(false)",
+ "engine->evaluate(\"0.0\") <=> QScriptValue(0)",
+ "engine->evaluate(\"0.0\") <=> QScriptValue(0.0)",
+ "engine->evaluate(\"0.0\") <=> QScriptValue(QString(\"\"))",
+ "engine->evaluate(\"0.0\") <=> QScriptValue(QString())",
+ "engine->evaluate(\"0.0\") <=> QScriptValue(QString(\"0\"))",
+ "engine->evaluate(\"0.0\") <=> QScriptValue(0, false)",
+ "engine->evaluate(\"0.0\") <=> QScriptValue(0, 0)",
+ "engine->evaluate(\"0.0\") <=> QScriptValue(0, 0.0)",
+ "engine->evaluate(\"0.0\") <=> QScriptValue(0, QString(\"\"))",
+ "engine->evaluate(\"0.0\") <=> QScriptValue(0, QString())",
+ "engine->evaluate(\"0.0\") <=> QScriptValue(0, QString(\"0\"))",
+ "engine->evaluate(\"0.0\") <=> QScriptValue(engine, false)",
+ "engine->evaluate(\"0.0\") <=> QScriptValue(engine, 0)",
+ "engine->evaluate(\"0.0\") <=> QScriptValue(engine, 0.0)",
+ "engine->evaluate(\"0.0\") <=> QScriptValue(engine, QString(\"\"))",
+ "engine->evaluate(\"0.0\") <=> QScriptValue(engine, QString())",
+ "engine->evaluate(\"0.0\") <=> QScriptValue(engine, QString(\"0\"))",
+ "engine->evaluate(\"0.0\") <=> engine->evaluate(\"[]\")",
+ "engine->evaluate(\"0.0\") <=> engine->evaluate(\"Array.prototype\")",
+ "engine->evaluate(\"0.0\") <=> engine->evaluate(\"new Array()\")",
+ "engine->evaluate(\"0.0\") <=> engine->evaluate(\"false\")",
+ "engine->evaluate(\"0.0\") <=> engine->evaluate(\"0\")",
+ "engine->evaluate(\"0.0\") <=> engine->evaluate(\"0.0\")",
+ "engine->evaluate(\"0.0\") <=> engine->evaluate(\"''\")",
+ "engine->evaluate(\"0.0\") <=> engine->evaluate(\"'0'\")",
+ "engine->evaluate(\"0.0\") <=> engine->newArray()",
+ "engine->evaluate(\"123.0\") <=> QScriptValue(123.0)",
+ "engine->evaluate(\"123.0\") <=> QScriptValue(QString(\"123\"))",
+ "engine->evaluate(\"123.0\") <=> QScriptValue(0, 123.0)",
+ "engine->evaluate(\"123.0\") <=> QScriptValue(0, QString(\"123\"))",
+ "engine->evaluate(\"123.0\") <=> QScriptValue(engine, 123.0)",
+ "engine->evaluate(\"123.0\") <=> QScriptValue(engine, QString(\"123\"))",
+ "engine->evaluate(\"123.0\") <=> engine->evaluate(\"123.0\")",
+ "engine->evaluate(\"123.0\") <=> engine->evaluate(\"'123'\")",
+ "engine->evaluate(\"6.37e-8\") <=> QScriptValue(6.37e-8)",
+ "engine->evaluate(\"6.37e-8\") <=> QScriptValue(0, 6.37e-8)",
+ "engine->evaluate(\"6.37e-8\") <=> QScriptValue(engine, 6.37e-8)",
+ "engine->evaluate(\"6.37e-8\") <=> engine->evaluate(\"6.37e-8\")",
+ "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(-6.37e-8)",
+ "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(0, -6.37e-8)",
+ "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(engine, -6.37e-8)",
+ "engine->evaluate(\"-6.37e-8\") <=> engine->evaluate(\"-6.37e-8\")",
+ "engine->evaluate(\"0x43211234\") <=> QScriptValue(0x43211234)",
+ "engine->evaluate(\"0x43211234\") <=> QScriptValue(0, 0x43211234)",
+ "engine->evaluate(\"0x43211234\") <=> QScriptValue(engine, 0x43211234)",
+ "engine->evaluate(\"0x43211234\") <=> engine->evaluate(\"0x43211234\")",
+ "engine->evaluate(\"0x10000\") <=> QScriptValue(0x10000)",
+ "engine->evaluate(\"0x10000\") <=> QScriptValue(0, 0x10000)",
+ "engine->evaluate(\"0x10000\") <=> QScriptValue(engine, 0x10000)",
+ "engine->evaluate(\"0x10000\") <=> engine->evaluate(\"0x10000\")",
+ "engine->evaluate(\"0x10001\") <=> QScriptValue(0x10001)",
+ "engine->evaluate(\"0x10001\") <=> QScriptValue(0, 0x10001)",
+ "engine->evaluate(\"0x10001\") <=> QScriptValue(engine, 0x10001)",
+ "engine->evaluate(\"0x10001\") <=> engine->evaluate(\"0x10001\")",
+ "engine->evaluate(\"Infinity\") <=> QScriptValue(qInf())",
+ "engine->evaluate(\"Infinity\") <=> QScriptValue(\"Infinity\")",
+ "engine->evaluate(\"Infinity\") <=> QScriptValue(0, qInf())",
+ "engine->evaluate(\"Infinity\") <=> QScriptValue(0, \"Infinity\")",
+ "engine->evaluate(\"Infinity\") <=> QScriptValue(engine, qInf())",
+ "engine->evaluate(\"Infinity\") <=> QScriptValue(engine, \"Infinity\")",
+ "engine->evaluate(\"Infinity\") <=> engine->evaluate(\"Infinity\")",
+ "engine->evaluate(\"-Infinity\") <=> QScriptValue(-qInf())",
+ "engine->evaluate(\"-Infinity\") <=> QScriptValue(\"-Infinity\")",
+ "engine->evaluate(\"-Infinity\") <=> QScriptValue(0, -qInf())",
+ "engine->evaluate(\"-Infinity\") <=> QScriptValue(0, \"-Infinity\")",
+ "engine->evaluate(\"-Infinity\") <=> QScriptValue(engine, -qInf())",
+ "engine->evaluate(\"-Infinity\") <=> QScriptValue(engine, \"-Infinity\")",
+ "engine->evaluate(\"-Infinity\") <=> engine->evaluate(\"-Infinity\")",
+ "engine->evaluate(\"'ciao'\") <=> QScriptValue(\"ciao\")",
+ "engine->evaluate(\"'ciao'\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))",
+ "engine->evaluate(\"'ciao'\") <=> QScriptValue(0, \"ciao\")",
+ "engine->evaluate(\"'ciao'\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))",
+ "engine->evaluate(\"'ciao'\") <=> QScriptValue(engine, \"ciao\")",
+ "engine->evaluate(\"'ciao'\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))",
+ "engine->evaluate(\"'ciao'\") <=> engine->evaluate(\"'ciao'\")",
+ "engine->evaluate(\"''\") <=> QScriptValue(false)",
+ "engine->evaluate(\"''\") <=> QScriptValue(0)",
+ "engine->evaluate(\"''\") <=> QScriptValue(0.0)",
+ "engine->evaluate(\"''\") <=> QScriptValue(QString(\"\"))",
+ "engine->evaluate(\"''\") <=> QScriptValue(QString())",
+ "engine->evaluate(\"''\") <=> QScriptValue(0, false)",
+ "engine->evaluate(\"''\") <=> QScriptValue(0, 0)",
+ "engine->evaluate(\"''\") <=> QScriptValue(0, 0.0)",
+ "engine->evaluate(\"''\") <=> QScriptValue(0, QString(\"\"))",
+ "engine->evaluate(\"''\") <=> QScriptValue(0, QString())",
+ "engine->evaluate(\"''\") <=> QScriptValue(engine, false)",
+ "engine->evaluate(\"''\") <=> QScriptValue(engine, 0)",
+ "engine->evaluate(\"''\") <=> QScriptValue(engine, 0.0)",
+ "engine->evaluate(\"''\") <=> QScriptValue(engine, QString(\"\"))",
+ "engine->evaluate(\"''\") <=> QScriptValue(engine, QString())",
+ "engine->evaluate(\"''\") <=> engine->evaluate(\"[]\")",
+ "engine->evaluate(\"''\") <=> engine->evaluate(\"Array.prototype\")",
+ "engine->evaluate(\"''\") <=> engine->evaluate(\"new Array()\")",
+ "engine->evaluate(\"''\") <=> engine->evaluate(\"false\")",
+ "engine->evaluate(\"''\") <=> engine->evaluate(\"0\")",
+ "engine->evaluate(\"''\") <=> engine->evaluate(\"0.0\")",
+ "engine->evaluate(\"''\") <=> engine->evaluate(\"''\")",
+ "engine->evaluate(\"''\") <=> engine->newArray()",
+ "engine->evaluate(\"'0'\") <=> QScriptValue(false)",
+ "engine->evaluate(\"'0'\") <=> QScriptValue(0)",
+ "engine->evaluate(\"'0'\") <=> QScriptValue(0.0)",
+ "engine->evaluate(\"'0'\") <=> QScriptValue(QString(\"0\"))",
+ "engine->evaluate(\"'0'\") <=> QScriptValue(0, false)",
+ "engine->evaluate(\"'0'\") <=> QScriptValue(0, 0)",
+ "engine->evaluate(\"'0'\") <=> QScriptValue(0, 0.0)",
+ "engine->evaluate(\"'0'\") <=> QScriptValue(0, QString(\"0\"))",
+ "engine->evaluate(\"'0'\") <=> QScriptValue(engine, false)",
+ "engine->evaluate(\"'0'\") <=> QScriptValue(engine, 0)",
+ "engine->evaluate(\"'0'\") <=> QScriptValue(engine, 0.0)",
+ "engine->evaluate(\"'0'\") <=> QScriptValue(engine, QString(\"0\"))",
+ "engine->evaluate(\"'0'\") <=> engine->evaluate(\"false\")",
+ "engine->evaluate(\"'0'\") <=> engine->evaluate(\"0\")",
+ "engine->evaluate(\"'0'\") <=> engine->evaluate(\"0.0\")",
+ "engine->evaluate(\"'0'\") <=> engine->evaluate(\"'0'\")",
+ "engine->evaluate(\"'123'\") <=> QScriptValue(123.0)",
+ "engine->evaluate(\"'123'\") <=> QScriptValue(QString(\"123\"))",
+ "engine->evaluate(\"'123'\") <=> QScriptValue(0, 123.0)",
+ "engine->evaluate(\"'123'\") <=> QScriptValue(0, QString(\"123\"))",
+ "engine->evaluate(\"'123'\") <=> QScriptValue(engine, 123.0)",
+ "engine->evaluate(\"'123'\") <=> QScriptValue(engine, QString(\"123\"))",
+ "engine->evaluate(\"'123'\") <=> engine->evaluate(\"123.0\")",
+ "engine->evaluate(\"'123'\") <=> engine->evaluate(\"'123'\")",
+ "engine->evaluate(\"'12.4'\") <=> QScriptValue(QString(\"12.4\"))",
+ "engine->evaluate(\"'12.4'\") <=> engine->evaluate(\"'12.4'\")",
+ "engine->nullValue() <=> QScriptValue(QScriptValue::UndefinedValue)",
+ "engine->nullValue() <=> QScriptValue(QScriptValue::NullValue)",
+ "engine->nullValue() <=> QScriptValue(0, QScriptValue::UndefinedValue)",
+ "engine->nullValue() <=> QScriptValue(0, QScriptValue::NullValue)",
+ "engine->nullValue() <=> QScriptValue(engine, QScriptValue::UndefinedValue)",
+ "engine->nullValue() <=> QScriptValue(engine, QScriptValue::NullValue)",
+ "engine->nullValue() <=> engine->evaluate(\"{}\")",
+ "engine->nullValue() <=> engine->evaluate(\"undefined\")",
+ "engine->nullValue() <=> engine->evaluate(\"null\")",
+ "engine->nullValue() <=> engine->nullValue()",
+ "engine->nullValue() <=> engine->undefinedValue()",
+ "engine->undefinedValue() <=> QScriptValue(QScriptValue::UndefinedValue)",
+ "engine->undefinedValue() <=> QScriptValue(QScriptValue::NullValue)",
+ "engine->undefinedValue() <=> QScriptValue(0, QScriptValue::UndefinedValue)",
+ "engine->undefinedValue() <=> QScriptValue(0, QScriptValue::NullValue)",
+ "engine->undefinedValue() <=> QScriptValue(engine, QScriptValue::UndefinedValue)",
+ "engine->undefinedValue() <=> QScriptValue(engine, QScriptValue::NullValue)",
+ "engine->undefinedValue() <=> engine->evaluate(\"{}\")",
+ "engine->undefinedValue() <=> engine->evaluate(\"undefined\")",
+ "engine->undefinedValue() <=> engine->evaluate(\"null\")",
+ "engine->undefinedValue() <=> engine->nullValue()",
+ "engine->undefinedValue() <=> engine->undefinedValue()",
+ "engine->newArray() <=> QScriptValue(false)",
+ "engine->newArray() <=> QScriptValue(0)",
+ "engine->newArray() <=> QScriptValue(0.0)",
+ "engine->newArray() <=> QScriptValue(QString(\"\"))",
+ "engine->newArray() <=> QScriptValue(QString())",
+ "engine->newArray() <=> QScriptValue(0, false)",
+ "engine->newArray() <=> QScriptValue(0, 0)",
+ "engine->newArray() <=> QScriptValue(0, 0.0)",
+ "engine->newArray() <=> QScriptValue(0, QString(\"\"))",
+ "engine->newArray() <=> QScriptValue(0, QString())",
+ "engine->newArray() <=> QScriptValue(engine, false)",
+ "engine->newArray() <=> QScriptValue(engine, 0)",
+ "engine->newArray() <=> QScriptValue(engine, 0.0)",
+ "engine->newArray() <=> QScriptValue(engine, QString(\"\"))",
+ "engine->newArray() <=> QScriptValue(engine, QString())",
+ "engine->newArray() <=> engine->evaluate(\"false\")",
+ "engine->newArray() <=> engine->evaluate(\"0\")",
+ "engine->newArray() <=> engine->evaluate(\"0.0\")",
+ "engine->newArray() <=> engine->evaluate(\"''\")"};
+
+void tst_QScriptValue::equals_data()
+{
+ QTest::addColumn<QScriptValue>("value");
+ QTest::addColumn<QScriptValue>("other");
+ QTest::addColumn<bool>("expected");
+ if (m_engine)
+ delete m_engine;
+ m_engine = new QScriptEngine();
+ QSet<QString> equals;
+ equals.reserve(1111);
+ for (unsigned i = 0; i < 1111; ++i)
+ equals.insert(equals_array[i]);
+ for (unsigned i = 0; i < 135; ++i) {
+ QPair<QString, QScriptValue> value1 = initScriptValues(i);
+ for (unsigned j = 0; j < 135; ++j) {
+ QPair<QString, QScriptValue> value2 = initScriptValues(j);
+ QString tag = QString::fromLatin1("%20 <=> %21").arg(value1.first, value2.first);
+ QTest::newRow(tag.toAscii().constData()) << value1.second << value2.second << equals.contains(tag); }
+ }
+}
+
+void tst_QScriptValue::equals()
+{
+ QFETCH(QScriptValue, value);
+ QFETCH(QScriptValue, other);
+ QFETCH(bool, expected);
+ QEXPECT_FAIL("QScriptValue(qInf()) <=> QScriptValue(\"-Infinity\")", "FIXME: WebKit bug 43038", Continue);
+ QEXPECT_FAIL("QScriptValue(qInf()) <=> QScriptValue(0, \"-Infinity\")", "FIXME: WebKit bug 43038", Continue);
+ QEXPECT_FAIL("QScriptValue(-qInf()) <=> QScriptValue(\"-Infinity\")", "FIXME: WebKit bug 43038", Continue);
+ QEXPECT_FAIL("QScriptValue(-qInf()) <=> QScriptValue(0, \"-Infinity\")", "FIXME: WebKit bug 43038", Continue);
+ QEXPECT_FAIL("QScriptValue(\"-Infinity\") <=> QScriptValue(qInf())", "FIXME: WebKit bug 43038", Continue);
+ QEXPECT_FAIL("QScriptValue(\"-Infinity\") <=> QScriptValue(-qInf())", "FIXME: WebKit bug 43038", Continue);
+ QEXPECT_FAIL("QScriptValue(\"-Infinity\") <=> QScriptValue(0, qInf())", "FIXME: WebKit bug 43038", Continue);
+ QEXPECT_FAIL("QScriptValue(\"-Infinity\") <=> QScriptValue(0, -qInf())", "FIXME: WebKit bug 43038", Continue);
+ QEXPECT_FAIL("QScriptValue(0, qInf()) <=> QScriptValue(\"-Infinity\")", "FIXME: WebKit bug 43038", Continue);
+ QEXPECT_FAIL("QScriptValue(0, qInf()) <=> QScriptValue(0, \"-Infinity\")", "FIXME: WebKit bug 43038", Continue);
+ QEXPECT_FAIL("QScriptValue(0, -qInf()) <=> QScriptValue(\"-Infinity\")", "FIXME: WebKit bug 43038", Continue);
+ QEXPECT_FAIL("QScriptValue(0, -qInf()) <=> QScriptValue(0, \"-Infinity\")", "FIXME: WebKit bug 43038", Continue);
+ QEXPECT_FAIL("QScriptValue(0, \"-Infinity\") <=> QScriptValue(qInf())", "FIXME: WebKit bug 43038", Continue);
+ QEXPECT_FAIL("QScriptValue(0, \"-Infinity\") <=> QScriptValue(-qInf())", "FIXME: WebKit bug 43038", Continue);
+ QEXPECT_FAIL("QScriptValue(0, \"-Infinity\") <=> QScriptValue(0, qInf())", "FIXME: WebKit bug 43038", Continue);
+ QEXPECT_FAIL("QScriptValue(0, \"-Infinity\") <=> QScriptValue(0, -qInf())", "FIXME: WebKit bug 43038", Continue);
+ QCOMPARE(value.equals(other), expected);
+}
+
+static const QString strictlyEquals_array[] = {
+ "QScriptValue() <=> QScriptValue()",
+ "QScriptValue(QScriptValue::UndefinedValue) <=> QScriptValue(QScriptValue::UndefinedValue)",
+ "QScriptValue(QScriptValue::UndefinedValue) <=> QScriptValue(0, QScriptValue::UndefinedValue)",
+ "QScriptValue(QScriptValue::UndefinedValue) <=> QScriptValue(engine, QScriptValue::UndefinedValue)",
+ "QScriptValue(QScriptValue::UndefinedValue) <=> engine->evaluate(\"{}\")",
+ "QScriptValue(QScriptValue::UndefinedValue) <=> engine->evaluate(\"undefined\")",
+ "QScriptValue(QScriptValue::UndefinedValue) <=> engine->undefinedValue()",
+ "QScriptValue(QScriptValue::NullValue) <=> QScriptValue(QScriptValue::NullValue)",
+ "QScriptValue(QScriptValue::NullValue) <=> QScriptValue(0, QScriptValue::NullValue)",
+ "QScriptValue(QScriptValue::NullValue) <=> QScriptValue(engine, QScriptValue::NullValue)",
+ "QScriptValue(QScriptValue::NullValue) <=> engine->evaluate(\"null\")",
+ "QScriptValue(QScriptValue::NullValue) <=> engine->nullValue()",
+ "QScriptValue(true) <=> QScriptValue(true)",
+ "QScriptValue(true) <=> QScriptValue(0, true)",
+ "QScriptValue(true) <=> QScriptValue(engine, true)",
+ "QScriptValue(true) <=> engine->evaluate(\"true\")",
+ "QScriptValue(false) <=> QScriptValue(false)",
+ "QScriptValue(false) <=> QScriptValue(0, false)",
+ "QScriptValue(false) <=> QScriptValue(engine, false)",
+ "QScriptValue(false) <=> engine->evaluate(\"false\")",
+ "QScriptValue(int(122)) <=> QScriptValue(int(122))",
+ "QScriptValue(int(122)) <=> QScriptValue(0, int(122))",
+ "QScriptValue(int(122)) <=> QScriptValue(engine, int(122))",
+ "QScriptValue(int(122)) <=> engine->evaluate(\"122\")",
+ "QScriptValue(uint(124)) <=> QScriptValue(uint(124))",
+ "QScriptValue(uint(124)) <=> QScriptValue(0, uint(124))",
+ "QScriptValue(uint(124)) <=> QScriptValue(engine, uint(124))",
+ "QScriptValue(uint(124)) <=> engine->evaluate(\"124\")",
+ "QScriptValue(0) <=> QScriptValue(0)",
+ "QScriptValue(0) <=> QScriptValue(0.0)",
+ "QScriptValue(0) <=> QScriptValue(0, 0)",
+ "QScriptValue(0) <=> QScriptValue(0, 0.0)",
+ "QScriptValue(0) <=> QScriptValue(engine, 0)",
+ "QScriptValue(0) <=> QScriptValue(engine, 0.0)",
+ "QScriptValue(0) <=> engine->evaluate(\"0\")",
+ "QScriptValue(0) <=> engine->evaluate(\"0.0\")",
+ "QScriptValue(0.0) <=> QScriptValue(0)",
+ "QScriptValue(0.0) <=> QScriptValue(0.0)",
+ "QScriptValue(0.0) <=> QScriptValue(0, 0)",
+ "QScriptValue(0.0) <=> QScriptValue(0, 0.0)",
+ "QScriptValue(0.0) <=> QScriptValue(engine, 0)",
+ "QScriptValue(0.0) <=> QScriptValue(engine, 0.0)",
+ "QScriptValue(0.0) <=> engine->evaluate(\"0\")",
+ "QScriptValue(0.0) <=> engine->evaluate(\"0.0\")",
+ "QScriptValue(123.0) <=> QScriptValue(123.0)",
+ "QScriptValue(123.0) <=> QScriptValue(0, 123.0)",
+ "QScriptValue(123.0) <=> QScriptValue(engine, 123.0)",
+ "QScriptValue(123.0) <=> engine->evaluate(\"123.0\")",
+ "QScriptValue(6.37e-8) <=> QScriptValue(6.37e-8)",
+ "QScriptValue(6.37e-8) <=> QScriptValue(0, 6.37e-8)",
+ "QScriptValue(6.37e-8) <=> QScriptValue(engine, 6.37e-8)",
+ "QScriptValue(6.37e-8) <=> engine->evaluate(\"6.37e-8\")",
+ "QScriptValue(-6.37e-8) <=> QScriptValue(-6.37e-8)",
+ "QScriptValue(-6.37e-8) <=> QScriptValue(0, -6.37e-8)",
+ "QScriptValue(-6.37e-8) <=> QScriptValue(engine, -6.37e-8)",
+ "QScriptValue(-6.37e-8) <=> engine->evaluate(\"-6.37e-8\")",
+ "QScriptValue(0x43211234) <=> QScriptValue(0x43211234)",
+ "QScriptValue(0x43211234) <=> QScriptValue(0, 0x43211234)",
+ "QScriptValue(0x43211234) <=> QScriptValue(engine, 0x43211234)",
+ "QScriptValue(0x43211234) <=> engine->evaluate(\"0x43211234\")",
+ "QScriptValue(0x10000) <=> QScriptValue(0x10000)",
+ "QScriptValue(0x10000) <=> QScriptValue(0, 0x10000)",
+ "QScriptValue(0x10000) <=> QScriptValue(engine, 0x10000)",
+ "QScriptValue(0x10000) <=> engine->evaluate(\"0x10000\")",
+ "QScriptValue(0x10001) <=> QScriptValue(0x10001)",
+ "QScriptValue(0x10001) <=> QScriptValue(0, 0x10001)",
+ "QScriptValue(0x10001) <=> QScriptValue(engine, 0x10001)",
+ "QScriptValue(0x10001) <=> engine->evaluate(\"0x10001\")",
+ "QScriptValue(qInf()) <=> QScriptValue(qInf())",
+ "QScriptValue(qInf()) <=> QScriptValue(0, qInf())",
+ "QScriptValue(qInf()) <=> QScriptValue(engine, qInf())",
+ "QScriptValue(qInf()) <=> engine->evaluate(\"Infinity\")",
+ "QScriptValue(-qInf()) <=> QScriptValue(-qInf())",
+ "QScriptValue(-qInf()) <=> QScriptValue(0, -qInf())",
+ "QScriptValue(-qInf()) <=> QScriptValue(engine, -qInf())",
+ "QScriptValue(-qInf()) <=> engine->evaluate(\"-Infinity\")",
+ "QScriptValue(\"NaN\") <=> QScriptValue(\"NaN\")",
+ "QScriptValue(\"NaN\") <=> QScriptValue(0, \"NaN\")",
+ "QScriptValue(\"NaN\") <=> QScriptValue(engine, \"NaN\")",
+ "QScriptValue(\"Infinity\") <=> QScriptValue(\"Infinity\")",
+ "QScriptValue(\"Infinity\") <=> QScriptValue(0, \"Infinity\")",
+ "QScriptValue(\"Infinity\") <=> QScriptValue(engine, \"Infinity\")",
+ "QScriptValue(\"-Infinity\") <=> QScriptValue(\"-Infinity\")",
+ "QScriptValue(\"-Infinity\") <=> QScriptValue(0, \"-Infinity\")",
+ "QScriptValue(\"-Infinity\") <=> QScriptValue(engine, \"-Infinity\")",
+ "QScriptValue(\"ciao\") <=> QScriptValue(\"ciao\")",
+ "QScriptValue(\"ciao\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(\"ciao\") <=> QScriptValue(0, \"ciao\")",
+ "QScriptValue(\"ciao\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(\"ciao\") <=> QScriptValue(engine, \"ciao\")",
+ "QScriptValue(\"ciao\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(\"ciao\") <=> engine->evaluate(\"'ciao'\")",
+ "QScriptValue(QString::fromLatin1(\"ciao\")) <=> QScriptValue(\"ciao\")",
+ "QScriptValue(QString::fromLatin1(\"ciao\")) <=> QScriptValue(QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(QString::fromLatin1(\"ciao\")) <=> QScriptValue(0, \"ciao\")",
+ "QScriptValue(QString::fromLatin1(\"ciao\")) <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(QString::fromLatin1(\"ciao\")) <=> QScriptValue(engine, \"ciao\")",
+ "QScriptValue(QString::fromLatin1(\"ciao\")) <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"'ciao'\")",
+ "QScriptValue(QString(\"\")) <=> QScriptValue(QString(\"\"))",
+ "QScriptValue(QString(\"\")) <=> QScriptValue(QString())",
+ "QScriptValue(QString(\"\")) <=> QScriptValue(0, QString(\"\"))",
+ "QScriptValue(QString(\"\")) <=> QScriptValue(0, QString())",
+ "QScriptValue(QString(\"\")) <=> QScriptValue(engine, QString(\"\"))",
+ "QScriptValue(QString(\"\")) <=> QScriptValue(engine, QString())",
+ "QScriptValue(QString(\"\")) <=> engine->evaluate(\"''\")",
+ "QScriptValue(QString()) <=> QScriptValue(QString(\"\"))",
+ "QScriptValue(QString()) <=> QScriptValue(QString())",
+ "QScriptValue(QString()) <=> QScriptValue(0, QString(\"\"))",
+ "QScriptValue(QString()) <=> QScriptValue(0, QString())",
+ "QScriptValue(QString()) <=> QScriptValue(engine, QString(\"\"))",
+ "QScriptValue(QString()) <=> QScriptValue(engine, QString())",
+ "QScriptValue(QString()) <=> engine->evaluate(\"''\")",
+ "QScriptValue(QString(\"0\")) <=> QScriptValue(QString(\"0\"))",
+ "QScriptValue(QString(\"0\")) <=> QScriptValue(0, QString(\"0\"))",
+ "QScriptValue(QString(\"0\")) <=> QScriptValue(engine, QString(\"0\"))",
+ "QScriptValue(QString(\"0\")) <=> engine->evaluate(\"'0'\")",
+ "QScriptValue(QString(\"123\")) <=> QScriptValue(QString(\"123\"))",
+ "QScriptValue(QString(\"123\")) <=> QScriptValue(0, QString(\"123\"))",
+ "QScriptValue(QString(\"123\")) <=> QScriptValue(engine, QString(\"123\"))",
+ "QScriptValue(QString(\"123\")) <=> engine->evaluate(\"'123'\")",
+ "QScriptValue(QString(\"12.4\")) <=> QScriptValue(QString(\"12.4\"))",
+ "QScriptValue(QString(\"12.4\")) <=> engine->evaluate(\"'12.4'\")",
+ "QScriptValue(0, QScriptValue::UndefinedValue) <=> QScriptValue(QScriptValue::UndefinedValue)",
+ "QScriptValue(0, QScriptValue::UndefinedValue) <=> QScriptValue(0, QScriptValue::UndefinedValue)",
+ "QScriptValue(0, QScriptValue::UndefinedValue) <=> QScriptValue(engine, QScriptValue::UndefinedValue)",
+ "QScriptValue(0, QScriptValue::UndefinedValue) <=> engine->evaluate(\"{}\")",
+ "QScriptValue(0, QScriptValue::UndefinedValue) <=> engine->evaluate(\"undefined\")",
+ "QScriptValue(0, QScriptValue::UndefinedValue) <=> engine->undefinedValue()",
+ "QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(QScriptValue::NullValue)",
+ "QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(0, QScriptValue::NullValue)",
+ "QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(engine, QScriptValue::NullValue)",
+ "QScriptValue(0, QScriptValue::NullValue) <=> engine->evaluate(\"null\")",
+ "QScriptValue(0, QScriptValue::NullValue) <=> engine->nullValue()",
+ "QScriptValue(0, true) <=> QScriptValue(true)",
+ "QScriptValue(0, true) <=> QScriptValue(0, true)",
+ "QScriptValue(0, true) <=> QScriptValue(engine, true)",
+ "QScriptValue(0, true) <=> engine->evaluate(\"true\")",
+ "QScriptValue(0, false) <=> QScriptValue(false)",
+ "QScriptValue(0, false) <=> QScriptValue(0, false)",
+ "QScriptValue(0, false) <=> QScriptValue(engine, false)",
+ "QScriptValue(0, false) <=> engine->evaluate(\"false\")",
+ "QScriptValue(0, int(122)) <=> QScriptValue(int(122))",
+ "QScriptValue(0, int(122)) <=> QScriptValue(0, int(122))",
+ "QScriptValue(0, int(122)) <=> QScriptValue(engine, int(122))",
+ "QScriptValue(0, int(122)) <=> engine->evaluate(\"122\")",
+ "QScriptValue(0, uint(124)) <=> QScriptValue(uint(124))",
+ "QScriptValue(0, uint(124)) <=> QScriptValue(0, uint(124))",
+ "QScriptValue(0, uint(124)) <=> QScriptValue(engine, uint(124))",
+ "QScriptValue(0, uint(124)) <=> engine->evaluate(\"124\")",
+ "QScriptValue(0, 0) <=> QScriptValue(0)",
+ "QScriptValue(0, 0) <=> QScriptValue(0.0)",
+ "QScriptValue(0, 0) <=> QScriptValue(0, 0)",
+ "QScriptValue(0, 0) <=> QScriptValue(0, 0.0)",
+ "QScriptValue(0, 0) <=> QScriptValue(engine, 0)",
+ "QScriptValue(0, 0) <=> QScriptValue(engine, 0.0)",
+ "QScriptValue(0, 0) <=> engine->evaluate(\"0\")",
+ "QScriptValue(0, 0) <=> engine->evaluate(\"0.0\")",
+ "QScriptValue(0, 0.0) <=> QScriptValue(0)",
+ "QScriptValue(0, 0.0) <=> QScriptValue(0.0)",
+ "QScriptValue(0, 0.0) <=> QScriptValue(0, 0)",
+ "QScriptValue(0, 0.0) <=> QScriptValue(0, 0.0)",
+ "QScriptValue(0, 0.0) <=> QScriptValue(engine, 0)",
+ "QScriptValue(0, 0.0) <=> QScriptValue(engine, 0.0)",
+ "QScriptValue(0, 0.0) <=> engine->evaluate(\"0\")",
+ "QScriptValue(0, 0.0) <=> engine->evaluate(\"0.0\")",
+ "QScriptValue(0, 123.0) <=> QScriptValue(123.0)",
+ "QScriptValue(0, 123.0) <=> QScriptValue(0, 123.0)",
+ "QScriptValue(0, 123.0) <=> QScriptValue(engine, 123.0)",
+ "QScriptValue(0, 123.0) <=> engine->evaluate(\"123.0\")",
+ "QScriptValue(0, 6.37e-8) <=> QScriptValue(6.37e-8)",
+ "QScriptValue(0, 6.37e-8) <=> QScriptValue(0, 6.37e-8)",
+ "QScriptValue(0, 6.37e-8) <=> QScriptValue(engine, 6.37e-8)",
+ "QScriptValue(0, 6.37e-8) <=> engine->evaluate(\"6.37e-8\")",
+ "QScriptValue(0, -6.37e-8) <=> QScriptValue(-6.37e-8)",
+ "QScriptValue(0, -6.37e-8) <=> QScriptValue(0, -6.37e-8)",
+ "QScriptValue(0, -6.37e-8) <=> QScriptValue(engine, -6.37e-8)",
+ "QScriptValue(0, -6.37e-8) <=> engine->evaluate(\"-6.37e-8\")",
+ "QScriptValue(0, 0x43211234) <=> QScriptValue(0x43211234)",
+ "QScriptValue(0, 0x43211234) <=> QScriptValue(0, 0x43211234)",
+ "QScriptValue(0, 0x43211234) <=> QScriptValue(engine, 0x43211234)",
+ "QScriptValue(0, 0x43211234) <=> engine->evaluate(\"0x43211234\")",
+ "QScriptValue(0, 0x10000) <=> QScriptValue(0x10000)",
+ "QScriptValue(0, 0x10000) <=> QScriptValue(0, 0x10000)",
+ "QScriptValue(0, 0x10000) <=> QScriptValue(engine, 0x10000)",
+ "QScriptValue(0, 0x10000) <=> engine->evaluate(\"0x10000\")",
+ "QScriptValue(0, 0x10001) <=> QScriptValue(0x10001)",
+ "QScriptValue(0, 0x10001) <=> QScriptValue(0, 0x10001)",
+ "QScriptValue(0, 0x10001) <=> QScriptValue(engine, 0x10001)",
+ "QScriptValue(0, 0x10001) <=> engine->evaluate(\"0x10001\")",
+ "QScriptValue(0, qInf()) <=> QScriptValue(qInf())",
+ "QScriptValue(0, qInf()) <=> QScriptValue(0, qInf())",
+ "QScriptValue(0, qInf()) <=> QScriptValue(engine, qInf())",
+ "QScriptValue(0, qInf()) <=> engine->evaluate(\"Infinity\")",
+ "QScriptValue(0, -qInf()) <=> QScriptValue(-qInf())",
+ "QScriptValue(0, -qInf()) <=> QScriptValue(0, -qInf())",
+ "QScriptValue(0, -qInf()) <=> QScriptValue(engine, -qInf())",
+ "QScriptValue(0, -qInf()) <=> engine->evaluate(\"-Infinity\")",
+ "QScriptValue(0, \"NaN\") <=> QScriptValue(\"NaN\")",
+ "QScriptValue(0, \"NaN\") <=> QScriptValue(0, \"NaN\")",
+ "QScriptValue(0, \"NaN\") <=> QScriptValue(engine, \"NaN\")",
+ "QScriptValue(0, \"Infinity\") <=> QScriptValue(\"Infinity\")",
+ "QScriptValue(0, \"Infinity\") <=> QScriptValue(0, \"Infinity\")",
+ "QScriptValue(0, \"Infinity\") <=> QScriptValue(engine, \"Infinity\")",
+ "QScriptValue(0, \"-Infinity\") <=> QScriptValue(\"-Infinity\")",
+ "QScriptValue(0, \"-Infinity\") <=> QScriptValue(0, \"-Infinity\")",
+ "QScriptValue(0, \"-Infinity\") <=> QScriptValue(engine, \"-Infinity\")",
+ "QScriptValue(0, \"ciao\") <=> QScriptValue(\"ciao\")",
+ "QScriptValue(0, \"ciao\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(0, \"ciao\") <=> QScriptValue(0, \"ciao\")",
+ "QScriptValue(0, \"ciao\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(0, \"ciao\") <=> QScriptValue(engine, \"ciao\")",
+ "QScriptValue(0, \"ciao\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(0, \"ciao\") <=> engine->evaluate(\"'ciao'\")",
+ "QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> QScriptValue(\"ciao\")",
+ "QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> QScriptValue(QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> QScriptValue(0, \"ciao\")",
+ "QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> QScriptValue(engine, \"ciao\")",
+ "QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(0, QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"'ciao'\")",
+ "QScriptValue(0, QString(\"\")) <=> QScriptValue(QString(\"\"))",
+ "QScriptValue(0, QString(\"\")) <=> QScriptValue(QString())",
+ "QScriptValue(0, QString(\"\")) <=> QScriptValue(0, QString(\"\"))",
+ "QScriptValue(0, QString(\"\")) <=> QScriptValue(0, QString())",
+ "QScriptValue(0, QString(\"\")) <=> QScriptValue(engine, QString(\"\"))",
+ "QScriptValue(0, QString(\"\")) <=> QScriptValue(engine, QString())",
+ "QScriptValue(0, QString(\"\")) <=> engine->evaluate(\"''\")",
+ "QScriptValue(0, QString()) <=> QScriptValue(QString(\"\"))",
+ "QScriptValue(0, QString()) <=> QScriptValue(QString())",
+ "QScriptValue(0, QString()) <=> QScriptValue(0, QString(\"\"))",
+ "QScriptValue(0, QString()) <=> QScriptValue(0, QString())",
+ "QScriptValue(0, QString()) <=> QScriptValue(engine, QString(\"\"))",
+ "QScriptValue(0, QString()) <=> QScriptValue(engine, QString())",
+ "QScriptValue(0, QString()) <=> engine->evaluate(\"''\")",
+ "QScriptValue(0, QString(\"0\")) <=> QScriptValue(QString(\"0\"))",
+ "QScriptValue(0, QString(\"0\")) <=> QScriptValue(0, QString(\"0\"))",
+ "QScriptValue(0, QString(\"0\")) <=> QScriptValue(engine, QString(\"0\"))",
+ "QScriptValue(0, QString(\"0\")) <=> engine->evaluate(\"'0'\")",
+ "QScriptValue(0, QString(\"123\")) <=> QScriptValue(QString(\"123\"))",
+ "QScriptValue(0, QString(\"123\")) <=> QScriptValue(0, QString(\"123\"))",
+ "QScriptValue(0, QString(\"123\")) <=> QScriptValue(engine, QString(\"123\"))",
+ "QScriptValue(0, QString(\"123\")) <=> engine->evaluate(\"'123'\")",
+ "QScriptValue(0, QString(\"12.3\")) <=> QScriptValue(0, QString(\"12.3\"))",
+ "QScriptValue(engine, QScriptValue::UndefinedValue) <=> QScriptValue(QScriptValue::UndefinedValue)",
+ "QScriptValue(engine, QScriptValue::UndefinedValue) <=> QScriptValue(0, QScriptValue::UndefinedValue)",
+ "QScriptValue(engine, QScriptValue::UndefinedValue) <=> QScriptValue(engine, QScriptValue::UndefinedValue)",
+ "QScriptValue(engine, QScriptValue::UndefinedValue) <=> engine->evaluate(\"{}\")",
+ "QScriptValue(engine, QScriptValue::UndefinedValue) <=> engine->evaluate(\"undefined\")",
+ "QScriptValue(engine, QScriptValue::UndefinedValue) <=> engine->undefinedValue()",
+ "QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(QScriptValue::NullValue)",
+ "QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(0, QScriptValue::NullValue)",
+ "QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(engine, QScriptValue::NullValue)",
+ "QScriptValue(engine, QScriptValue::NullValue) <=> engine->evaluate(\"null\")",
+ "QScriptValue(engine, QScriptValue::NullValue) <=> engine->nullValue()",
+ "QScriptValue(engine, true) <=> QScriptValue(true)",
+ "QScriptValue(engine, true) <=> QScriptValue(0, true)",
+ "QScriptValue(engine, true) <=> QScriptValue(engine, true)",
+ "QScriptValue(engine, true) <=> engine->evaluate(\"true\")",
+ "QScriptValue(engine, false) <=> QScriptValue(false)",
+ "QScriptValue(engine, false) <=> QScriptValue(0, false)",
+ "QScriptValue(engine, false) <=> QScriptValue(engine, false)",
+ "QScriptValue(engine, false) <=> engine->evaluate(\"false\")",
+ "QScriptValue(engine, int(122)) <=> QScriptValue(int(122))",
+ "QScriptValue(engine, int(122)) <=> QScriptValue(0, int(122))",
+ "QScriptValue(engine, int(122)) <=> QScriptValue(engine, int(122))",
+ "QScriptValue(engine, int(122)) <=> engine->evaluate(\"122\")",
+ "QScriptValue(engine, uint(124)) <=> QScriptValue(uint(124))",
+ "QScriptValue(engine, uint(124)) <=> QScriptValue(0, uint(124))",
+ "QScriptValue(engine, uint(124)) <=> QScriptValue(engine, uint(124))",
+ "QScriptValue(engine, uint(124)) <=> engine->evaluate(\"124\")",
+ "QScriptValue(engine, 0) <=> QScriptValue(0)",
+ "QScriptValue(engine, 0) <=> QScriptValue(0.0)",
+ "QScriptValue(engine, 0) <=> QScriptValue(0, 0)",
+ "QScriptValue(engine, 0) <=> QScriptValue(0, 0.0)",
+ "QScriptValue(engine, 0) <=> QScriptValue(engine, 0)",
+ "QScriptValue(engine, 0) <=> QScriptValue(engine, 0.0)",
+ "QScriptValue(engine, 0) <=> engine->evaluate(\"0\")",
+ "QScriptValue(engine, 0) <=> engine->evaluate(\"0.0\")",
+ "QScriptValue(engine, 0.0) <=> QScriptValue(0)",
+ "QScriptValue(engine, 0.0) <=> QScriptValue(0.0)",
+ "QScriptValue(engine, 0.0) <=> QScriptValue(0, 0)",
+ "QScriptValue(engine, 0.0) <=> QScriptValue(0, 0.0)",
+ "QScriptValue(engine, 0.0) <=> QScriptValue(engine, 0)",
+ "QScriptValue(engine, 0.0) <=> QScriptValue(engine, 0.0)",
+ "QScriptValue(engine, 0.0) <=> engine->evaluate(\"0\")",
+ "QScriptValue(engine, 0.0) <=> engine->evaluate(\"0.0\")",
+ "QScriptValue(engine, 123.0) <=> QScriptValue(123.0)",
+ "QScriptValue(engine, 123.0) <=> QScriptValue(0, 123.0)",
+ "QScriptValue(engine, 123.0) <=> QScriptValue(engine, 123.0)",
+ "QScriptValue(engine, 123.0) <=> engine->evaluate(\"123.0\")",
+ "QScriptValue(engine, 6.37e-8) <=> QScriptValue(6.37e-8)",
+ "QScriptValue(engine, 6.37e-8) <=> QScriptValue(0, 6.37e-8)",
+ "QScriptValue(engine, 6.37e-8) <=> QScriptValue(engine, 6.37e-8)",
+ "QScriptValue(engine, 6.37e-8) <=> engine->evaluate(\"6.37e-8\")",
+ "QScriptValue(engine, -6.37e-8) <=> QScriptValue(-6.37e-8)",
+ "QScriptValue(engine, -6.37e-8) <=> QScriptValue(0, -6.37e-8)",
+ "QScriptValue(engine, -6.37e-8) <=> QScriptValue(engine, -6.37e-8)",
+ "QScriptValue(engine, -6.37e-8) <=> engine->evaluate(\"-6.37e-8\")",
+ "QScriptValue(engine, 0x43211234) <=> QScriptValue(0x43211234)",
+ "QScriptValue(engine, 0x43211234) <=> QScriptValue(0, 0x43211234)",
+ "QScriptValue(engine, 0x43211234) <=> QScriptValue(engine, 0x43211234)",
+ "QScriptValue(engine, 0x43211234) <=> engine->evaluate(\"0x43211234\")",
+ "QScriptValue(engine, 0x10000) <=> QScriptValue(0x10000)",
+ "QScriptValue(engine, 0x10000) <=> QScriptValue(0, 0x10000)",
+ "QScriptValue(engine, 0x10000) <=> QScriptValue(engine, 0x10000)",
+ "QScriptValue(engine, 0x10000) <=> engine->evaluate(\"0x10000\")",
+ "QScriptValue(engine, 0x10001) <=> QScriptValue(0x10001)",
+ "QScriptValue(engine, 0x10001) <=> QScriptValue(0, 0x10001)",
+ "QScriptValue(engine, 0x10001) <=> QScriptValue(engine, 0x10001)",
+ "QScriptValue(engine, 0x10001) <=> engine->evaluate(\"0x10001\")",
+ "QScriptValue(engine, qInf()) <=> QScriptValue(qInf())",
+ "QScriptValue(engine, qInf()) <=> QScriptValue(0, qInf())",
+ "QScriptValue(engine, qInf()) <=> QScriptValue(engine, qInf())",
+ "QScriptValue(engine, qInf()) <=> engine->evaluate(\"Infinity\")",
+ "QScriptValue(engine, -qInf()) <=> QScriptValue(-qInf())",
+ "QScriptValue(engine, -qInf()) <=> QScriptValue(0, -qInf())",
+ "QScriptValue(engine, -qInf()) <=> QScriptValue(engine, -qInf())",
+ "QScriptValue(engine, -qInf()) <=> engine->evaluate(\"-Infinity\")",
+ "QScriptValue(engine, \"NaN\") <=> QScriptValue(\"NaN\")",
+ "QScriptValue(engine, \"NaN\") <=> QScriptValue(0, \"NaN\")",
+ "QScriptValue(engine, \"NaN\") <=> QScriptValue(engine, \"NaN\")",
+ "QScriptValue(engine, \"Infinity\") <=> QScriptValue(\"Infinity\")",
+ "QScriptValue(engine, \"Infinity\") <=> QScriptValue(0, \"Infinity\")",
+ "QScriptValue(engine, \"Infinity\") <=> QScriptValue(engine, \"Infinity\")",
+ "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(\"-Infinity\")",
+ "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(0, \"-Infinity\")",
+ "QScriptValue(engine, \"-Infinity\") <=> QScriptValue(engine, \"-Infinity\")",
+ "QScriptValue(engine, \"ciao\") <=> QScriptValue(\"ciao\")",
+ "QScriptValue(engine, \"ciao\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(engine, \"ciao\") <=> QScriptValue(0, \"ciao\")",
+ "QScriptValue(engine, \"ciao\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(engine, \"ciao\") <=> QScriptValue(engine, \"ciao\")",
+ "QScriptValue(engine, \"ciao\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(engine, \"ciao\") <=> engine->evaluate(\"'ciao'\")",
+ "QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> QScriptValue(\"ciao\")",
+ "QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> QScriptValue(QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> QScriptValue(0, \"ciao\")",
+ "QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> QScriptValue(engine, \"ciao\")",
+ "QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(engine, QString::fromLatin1(\"ciao\")) <=> engine->evaluate(\"'ciao'\")",
+ "QScriptValue(engine, QString(\"\")) <=> QScriptValue(QString(\"\"))",
+ "QScriptValue(engine, QString(\"\")) <=> QScriptValue(QString())",
+ "QScriptValue(engine, QString(\"\")) <=> QScriptValue(0, QString(\"\"))",
+ "QScriptValue(engine, QString(\"\")) <=> QScriptValue(0, QString())",
+ "QScriptValue(engine, QString(\"\")) <=> QScriptValue(engine, QString(\"\"))",
+ "QScriptValue(engine, QString(\"\")) <=> QScriptValue(engine, QString())",
+ "QScriptValue(engine, QString(\"\")) <=> engine->evaluate(\"''\")",
+ "QScriptValue(engine, QString()) <=> QScriptValue(QString(\"\"))",
+ "QScriptValue(engine, QString()) <=> QScriptValue(QString())",
+ "QScriptValue(engine, QString()) <=> QScriptValue(0, QString(\"\"))",
+ "QScriptValue(engine, QString()) <=> QScriptValue(0, QString())",
+ "QScriptValue(engine, QString()) <=> QScriptValue(engine, QString(\"\"))",
+ "QScriptValue(engine, QString()) <=> QScriptValue(engine, QString())",
+ "QScriptValue(engine, QString()) <=> engine->evaluate(\"''\")",
+ "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(QString(\"0\"))",
+ "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(0, QString(\"0\"))",
+ "QScriptValue(engine, QString(\"0\")) <=> QScriptValue(engine, QString(\"0\"))",
+ "QScriptValue(engine, QString(\"0\")) <=> engine->evaluate(\"'0'\")",
+ "QScriptValue(engine, QString(\"123\")) <=> QScriptValue(QString(\"123\"))",
+ "QScriptValue(engine, QString(\"123\")) <=> QScriptValue(0, QString(\"123\"))",
+ "QScriptValue(engine, QString(\"123\")) <=> QScriptValue(engine, QString(\"123\"))",
+ "QScriptValue(engine, QString(\"123\")) <=> engine->evaluate(\"'123'\")",
+ "QScriptValue(engine, QString(\"1.23\")) <=> QScriptValue(engine, QString(\"1.23\"))",
+ "engine->evaluate(\"{}\") <=> QScriptValue(QScriptValue::UndefinedValue)",
+ "engine->evaluate(\"{}\") <=> QScriptValue(0, QScriptValue::UndefinedValue)",
+ "engine->evaluate(\"{}\") <=> QScriptValue(engine, QScriptValue::UndefinedValue)",
+ "engine->evaluate(\"{}\") <=> engine->evaluate(\"{}\")",
+ "engine->evaluate(\"{}\") <=> engine->evaluate(\"undefined\")",
+ "engine->evaluate(\"{}\") <=> engine->undefinedValue()",
+ "engine->evaluate(\"Object.prototype\") <=> engine->evaluate(\"Object.prototype\")",
+ "engine->evaluate(\"Date.prototype\") <=> engine->evaluate(\"Date.prototype\")",
+ "engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"Array.prototype\")",
+ "engine->evaluate(\"Function.prototype\") <=> engine->evaluate(\"Function.prototype\")",
+ "engine->evaluate(\"Error.prototype\") <=> engine->evaluate(\"Error.prototype\")",
+ "engine->evaluate(\"Object\") <=> engine->evaluate(\"Object\")",
+ "engine->evaluate(\"Array\") <=> engine->evaluate(\"Array\")",
+ "engine->evaluate(\"Number\") <=> engine->evaluate(\"Number\")",
+ "engine->evaluate(\"Function\") <=> engine->evaluate(\"Function\")",
+ "engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\") <=> engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")",
+ "engine->evaluate(\"undefined\") <=> QScriptValue(QScriptValue::UndefinedValue)",
+ "engine->evaluate(\"undefined\") <=> QScriptValue(0, QScriptValue::UndefinedValue)",
+ "engine->evaluate(\"undefined\") <=> QScriptValue(engine, QScriptValue::UndefinedValue)",
+ "engine->evaluate(\"undefined\") <=> engine->evaluate(\"{}\")",
+ "engine->evaluate(\"undefined\") <=> engine->evaluate(\"undefined\")",
+ "engine->evaluate(\"undefined\") <=> engine->undefinedValue()",
+ "engine->evaluate(\"null\") <=> QScriptValue(QScriptValue::NullValue)",
+ "engine->evaluate(\"null\") <=> QScriptValue(0, QScriptValue::NullValue)",
+ "engine->evaluate(\"null\") <=> QScriptValue(engine, QScriptValue::NullValue)",
+ "engine->evaluate(\"null\") <=> engine->evaluate(\"null\")",
+ "engine->evaluate(\"null\") <=> engine->nullValue()",
+ "engine->evaluate(\"true\") <=> QScriptValue(true)",
+ "engine->evaluate(\"true\") <=> QScriptValue(0, true)",
+ "engine->evaluate(\"true\") <=> QScriptValue(engine, true)",
+ "engine->evaluate(\"true\") <=> engine->evaluate(\"true\")",
+ "engine->evaluate(\"false\") <=> QScriptValue(false)",
+ "engine->evaluate(\"false\") <=> QScriptValue(0, false)",
+ "engine->evaluate(\"false\") <=> QScriptValue(engine, false)",
+ "engine->evaluate(\"false\") <=> engine->evaluate(\"false\")",
+ "engine->evaluate(\"122\") <=> QScriptValue(int(122))",
+ "engine->evaluate(\"122\") <=> QScriptValue(0, int(122))",
+ "engine->evaluate(\"122\") <=> QScriptValue(engine, int(122))",
+ "engine->evaluate(\"122\") <=> engine->evaluate(\"122\")",
+ "engine->evaluate(\"124\") <=> QScriptValue(uint(124))",
+ "engine->evaluate(\"124\") <=> QScriptValue(0, uint(124))",
+ "engine->evaluate(\"124\") <=> QScriptValue(engine, uint(124))",
+ "engine->evaluate(\"124\") <=> engine->evaluate(\"124\")",
+ "engine->evaluate(\"0\") <=> QScriptValue(0)",
+ "engine->evaluate(\"0\") <=> QScriptValue(0.0)",
+ "engine->evaluate(\"0\") <=> QScriptValue(0, 0)",
+ "engine->evaluate(\"0\") <=> QScriptValue(0, 0.0)",
+ "engine->evaluate(\"0\") <=> QScriptValue(engine, 0)",
+ "engine->evaluate(\"0\") <=> QScriptValue(engine, 0.0)",
+ "engine->evaluate(\"0\") <=> engine->evaluate(\"0\")",
+ "engine->evaluate(\"0\") <=> engine->evaluate(\"0.0\")",
+ "engine->evaluate(\"0.0\") <=> QScriptValue(0)",
+ "engine->evaluate(\"0.0\") <=> QScriptValue(0.0)",
+ "engine->evaluate(\"0.0\") <=> QScriptValue(0, 0)",
+ "engine->evaluate(\"0.0\") <=> QScriptValue(0, 0.0)",
+ "engine->evaluate(\"0.0\") <=> QScriptValue(engine, 0)",
+ "engine->evaluate(\"0.0\") <=> QScriptValue(engine, 0.0)",
+ "engine->evaluate(\"0.0\") <=> engine->evaluate(\"0\")",
+ "engine->evaluate(\"0.0\") <=> engine->evaluate(\"0.0\")",
+ "engine->evaluate(\"123.0\") <=> QScriptValue(123.0)",
+ "engine->evaluate(\"123.0\") <=> QScriptValue(0, 123.0)",
+ "engine->evaluate(\"123.0\") <=> QScriptValue(engine, 123.0)",
+ "engine->evaluate(\"123.0\") <=> engine->evaluate(\"123.0\")",
+ "engine->evaluate(\"6.37e-8\") <=> QScriptValue(6.37e-8)",
+ "engine->evaluate(\"6.37e-8\") <=> QScriptValue(0, 6.37e-8)",
+ "engine->evaluate(\"6.37e-8\") <=> QScriptValue(engine, 6.37e-8)",
+ "engine->evaluate(\"6.37e-8\") <=> engine->evaluate(\"6.37e-8\")",
+ "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(-6.37e-8)",
+ "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(0, -6.37e-8)",
+ "engine->evaluate(\"-6.37e-8\") <=> QScriptValue(engine, -6.37e-8)",
+ "engine->evaluate(\"-6.37e-8\") <=> engine->evaluate(\"-6.37e-8\")",
+ "engine->evaluate(\"0x43211234\") <=> QScriptValue(0x43211234)",
+ "engine->evaluate(\"0x43211234\") <=> QScriptValue(0, 0x43211234)",
+ "engine->evaluate(\"0x43211234\") <=> QScriptValue(engine, 0x43211234)",
+ "engine->evaluate(\"0x43211234\") <=> engine->evaluate(\"0x43211234\")",
+ "engine->evaluate(\"0x10000\") <=> QScriptValue(0x10000)",
+ "engine->evaluate(\"0x10000\") <=> QScriptValue(0, 0x10000)",
+ "engine->evaluate(\"0x10000\") <=> QScriptValue(engine, 0x10000)",
+ "engine->evaluate(\"0x10000\") <=> engine->evaluate(\"0x10000\")",
+ "engine->evaluate(\"0x10001\") <=> QScriptValue(0x10001)",
+ "engine->evaluate(\"0x10001\") <=> QScriptValue(0, 0x10001)",
+ "engine->evaluate(\"0x10001\") <=> QScriptValue(engine, 0x10001)",
+ "engine->evaluate(\"0x10001\") <=> engine->evaluate(\"0x10001\")",
+ "engine->evaluate(\"Infinity\") <=> QScriptValue(qInf())",
+ "engine->evaluate(\"Infinity\") <=> QScriptValue(0, qInf())",
+ "engine->evaluate(\"Infinity\") <=> QScriptValue(engine, qInf())",
+ "engine->evaluate(\"Infinity\") <=> engine->evaluate(\"Infinity\")",
+ "engine->evaluate(\"-Infinity\") <=> QScriptValue(-qInf())",
+ "engine->evaluate(\"-Infinity\") <=> QScriptValue(0, -qInf())",
+ "engine->evaluate(\"-Infinity\") <=> QScriptValue(engine, -qInf())",
+ "engine->evaluate(\"-Infinity\") <=> engine->evaluate(\"-Infinity\")",
+ "engine->evaluate(\"'ciao'\") <=> QScriptValue(\"ciao\")",
+ "engine->evaluate(\"'ciao'\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))",
+ "engine->evaluate(\"'ciao'\") <=> QScriptValue(0, \"ciao\")",
+ "engine->evaluate(\"'ciao'\") <=> QScriptValue(0, QString::fromLatin1(\"ciao\"))",
+ "engine->evaluate(\"'ciao'\") <=> QScriptValue(engine, \"ciao\")",
+ "engine->evaluate(\"'ciao'\") <=> QScriptValue(engine, QString::fromLatin1(\"ciao\"))",
+ "engine->evaluate(\"'ciao'\") <=> engine->evaluate(\"'ciao'\")",
+ "engine->evaluate(\"''\") <=> QScriptValue(QString(\"\"))",
+ "engine->evaluate(\"''\") <=> QScriptValue(QString())",
+ "engine->evaluate(\"''\") <=> QScriptValue(0, QString(\"\"))",
+ "engine->evaluate(\"''\") <=> QScriptValue(0, QString())",
+ "engine->evaluate(\"''\") <=> QScriptValue(engine, QString(\"\"))",
+ "engine->evaluate(\"''\") <=> QScriptValue(engine, QString())",
+ "engine->evaluate(\"''\") <=> engine->evaluate(\"''\")",
+ "engine->evaluate(\"'0'\") <=> QScriptValue(QString(\"0\"))",
+ "engine->evaluate(\"'0'\") <=> QScriptValue(0, QString(\"0\"))",
+ "engine->evaluate(\"'0'\") <=> QScriptValue(engine, QString(\"0\"))",
+ "engine->evaluate(\"'0'\") <=> engine->evaluate(\"'0'\")",
+ "engine->evaluate(\"'123'\") <=> QScriptValue(QString(\"123\"))",
+ "engine->evaluate(\"'123'\") <=> QScriptValue(0, QString(\"123\"))",
+ "engine->evaluate(\"'123'\") <=> QScriptValue(engine, QString(\"123\"))",
+ "engine->evaluate(\"'123'\") <=> engine->evaluate(\"'123'\")",
+ "engine->evaluate(\"'12.4'\") <=> QScriptValue(QString(\"12.4\"))",
+ "engine->evaluate(\"'12.4'\") <=> engine->evaluate(\"'12.4'\")",
+ "engine->nullValue() <=> QScriptValue(QScriptValue::NullValue)",
+ "engine->nullValue() <=> QScriptValue(0, QScriptValue::NullValue)",
+ "engine->nullValue() <=> QScriptValue(engine, QScriptValue::NullValue)",
+ "engine->nullValue() <=> engine->evaluate(\"null\")",
+ "engine->nullValue() <=> engine->nullValue()",
+ "engine->undefinedValue() <=> QScriptValue(QScriptValue::UndefinedValue)",
+ "engine->undefinedValue() <=> QScriptValue(0, QScriptValue::UndefinedValue)",
+ "engine->undefinedValue() <=> QScriptValue(engine, QScriptValue::UndefinedValue)",
+ "engine->undefinedValue() <=> engine->evaluate(\"{}\")",
+ "engine->undefinedValue() <=> engine->evaluate(\"undefined\")",
+ "engine->undefinedValue() <=> engine->undefinedValue()"};
+
+void tst_QScriptValue::strictlyEquals_data()
+{
+ QTest::addColumn<QScriptValue>("value");
+ QTest::addColumn<QScriptValue>("other");
+ QTest::addColumn<bool>("expected");
+ if (m_engine)
+ delete m_engine;
+ m_engine = new QScriptEngine();
+ QSet<QString> equals;
+ equals.reserve(491);
+ for (unsigned i = 0; i < 491; ++i)
+ equals.insert(strictlyEquals_array[i]);
+ for (unsigned i = 0; i < 135; ++i) {
+ QPair<QString, QScriptValue> value1 = initScriptValues(i);
+ for (unsigned j = 0; j < 135; ++j) {
+ QPair<QString, QScriptValue> value2 = initScriptValues(j);
+ QString tag = QString::fromLatin1("%20 <=> %21").arg(value1.first, value2.first);
+ QTest::newRow(tag.toAscii().constData()) << value1.second << value2.second << equals.contains(tag); }
+ }
+}
+
+void tst_QScriptValue::strictlyEquals()
+{
+ QFETCH(QScriptValue, value);
+ QFETCH(QScriptValue, other);
+ QFETCH(bool, expected);
+ QEXPECT_FAIL("QScriptValue(QScriptValue::UndefinedValue) <=> QScriptValue(QScriptValue::UndefinedValue)", "FIXME: WebKit bug 43038", Continue);
+ QEXPECT_FAIL("QScriptValue(QScriptValue::UndefinedValue) <=> QScriptValue(0, QScriptValue::UndefinedValue)", "FIXME: WebKit bug 43038", Continue);
+ QEXPECT_FAIL("QScriptValue(QScriptValue::UndefinedValue) <=> QScriptValue(engine, QScriptValue::UndefinedValue)", "FIXME: WebKit bug 43038", Continue);
+ QEXPECT_FAIL("QScriptValue(QScriptValue::UndefinedValue) <=> engine->evaluate(\"{}\")", "FIXME: WebKit bug 43038", Continue);
+ QEXPECT_FAIL("QScriptValue(QScriptValue::UndefinedValue) <=> engine->evaluate(\"undefined\")", "FIXME: WebKit bug 43038", Continue);
+ QEXPECT_FAIL("QScriptValue(QScriptValue::UndefinedValue) <=> engine->undefinedValue()", "FIXME: WebKit bug 43038", Continue);
+ QEXPECT_FAIL("QScriptValue(QScriptValue::NullValue) <=> QScriptValue(QScriptValue::NullValue)", "FIXME: WebKit bug 43038", Continue);
+ QEXPECT_FAIL("QScriptValue(QScriptValue::NullValue) <=> QScriptValue(0, QScriptValue::NullValue)", "FIXME: WebKit bug 43038", Continue);
+ QEXPECT_FAIL("QScriptValue(QScriptValue::NullValue) <=> QScriptValue(engine, QScriptValue::NullValue)", "FIXME: WebKit bug 43038", Continue);
+ QEXPECT_FAIL("QScriptValue(QScriptValue::NullValue) <=> engine->evaluate(\"null\")", "FIXME: WebKit bug 43038", Continue);
+ QEXPECT_FAIL("QScriptValue(QScriptValue::NullValue) <=> engine->nullValue()", "FIXME: WebKit bug 43038", Continue);
+ QEXPECT_FAIL("QScriptValue(true) <=> QScriptValue(true)", "FIXME: WebKit bug 43038", Continue);
+ QEXPECT_FAIL("QScriptValue(true) <=> QScriptValue(0, true)", "FIXME: WebKit bug 43038", Continue);
+ QEXPECT_FAIL("QScriptValue(false) <=> QScriptValue(false)", "FIXME: WebKit bug 43038", Continue);
+ QEXPECT_FAIL("QScriptValue(false) <=> QScriptValue(0, false)", "FIXME: WebKit bug 43038", Continue);
+ QEXPECT_FAIL("QScriptValue(0, QScriptValue::UndefinedValue) <=> QScriptValue(QScriptValue::UndefinedValue)", "FIXME: WebKit bug 43038", Continue);
+ QEXPECT_FAIL("QScriptValue(0, QScriptValue::UndefinedValue) <=> QScriptValue(0, QScriptValue::UndefinedValue)", "FIXME: WebKit bug 43038", Continue);
+ QEXPECT_FAIL("QScriptValue(0, QScriptValue::UndefinedValue) <=> QScriptValue(engine, QScriptValue::UndefinedValue)", "FIXME: WebKit bug 43038", Continue);
+ QEXPECT_FAIL("QScriptValue(0, QScriptValue::UndefinedValue) <=> engine->evaluate(\"{}\")", "FIXME: WebKit bug 43038", Continue);
+ QEXPECT_FAIL("QScriptValue(0, QScriptValue::UndefinedValue) <=> engine->evaluate(\"undefined\")", "FIXME: WebKit bug 43038", Continue);
+ QEXPECT_FAIL("QScriptValue(0, QScriptValue::UndefinedValue) <=> engine->undefinedValue()", "FIXME: WebKit bug 43038", Continue);
+ QEXPECT_FAIL("QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(QScriptValue::NullValue)", "FIXME: WebKit bug 43038", Continue);
+ QEXPECT_FAIL("QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(0, QScriptValue::NullValue)", "FIXME: WebKit bug 43038", Continue);
+ QEXPECT_FAIL("QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(engine, QScriptValue::NullValue)", "FIXME: WebKit bug 43038", Continue);
+ QEXPECT_FAIL("QScriptValue(0, QScriptValue::NullValue) <=> engine->evaluate(\"null\")", "FIXME: WebKit bug 43038", Continue);
+ QEXPECT_FAIL("QScriptValue(0, QScriptValue::NullValue) <=> engine->nullValue()", "FIXME: WebKit bug 43038", Continue);
+ QEXPECT_FAIL("QScriptValue(0, true) <=> QScriptValue(true)", "FIXME: WebKit bug 43038", Continue);
+ QEXPECT_FAIL("QScriptValue(0, true) <=> QScriptValue(0, true)", "FIXME: WebKit bug 43038", Continue);
+ QEXPECT_FAIL("QScriptValue(0, false) <=> QScriptValue(false)", "FIXME: WebKit bug 43038", Continue);
+ QEXPECT_FAIL("QScriptValue(0, false) <=> QScriptValue(0, false)", "FIXME: WebKit bug 43038", Continue);
+ QCOMPARE(value.strictlyEquals(other), expected);
+}
+
+static const QString instanceOf_array[] = {
+ "engine->evaluate(\"[]\") <=> engine->evaluate(\"Object\")",
+ "engine->evaluate(\"[]\") <=> engine->evaluate(\"Array\")",
+ "engine->evaluate(\"Date.prototype\") <=> engine->evaluate(\"Object\")",
+ "engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"Object\")",
+ "engine->evaluate(\"Function.prototype\") <=> engine->evaluate(\"Object\")",
+ "engine->evaluate(\"Error.prototype\") <=> engine->evaluate(\"Object\")",
+ "engine->evaluate(\"Object\") <=> engine->evaluate(\"Object\")",
+ "engine->evaluate(\"Object\") <=> engine->evaluate(\"Function\")",
+ "engine->evaluate(\"Array\") <=> engine->evaluate(\"Object\")",
+ "engine->evaluate(\"Array\") <=> engine->evaluate(\"Function\")",
+ "engine->evaluate(\"Number\") <=> engine->evaluate(\"Object\")",
+ "engine->evaluate(\"Number\") <=> engine->evaluate(\"Function\")",
+ "engine->evaluate(\"Function\") <=> engine->evaluate(\"Object\")",
+ "engine->evaluate(\"Function\") <=> engine->evaluate(\"Function\")",
+ "engine->evaluate(\"(function() { return 1; })\") <=> engine->evaluate(\"Object\")",
+ "engine->evaluate(\"(function() { return 1; })\") <=> engine->evaluate(\"Function\")",
+ "engine->evaluate(\"(function() { return 'ciao'; })\") <=> engine->evaluate(\"Object\")",
+ "engine->evaluate(\"(function() { return 'ciao'; })\") <=> engine->evaluate(\"Function\")",
+ "engine->evaluate(\"(function() { throw new Error('foo'); })\") <=> engine->evaluate(\"Object\")",
+ "engine->evaluate(\"(function() { throw new Error('foo'); })\") <=> engine->evaluate(\"Function\")",
+ "engine->evaluate(\"/foo/\") <=> engine->evaluate(\"Object\")",
+ "engine->evaluate(\"new Object()\") <=> engine->evaluate(\"Object\")",
+ "engine->evaluate(\"new Array()\") <=> engine->evaluate(\"Object\")",
+ "engine->evaluate(\"new Array()\") <=> engine->evaluate(\"Array\")",
+ "engine->evaluate(\"new Error()\") <=> engine->evaluate(\"Object\")",
+ "engine->evaluate(\"Undefined\") <=> engine->evaluate(\"Object\")",
+ "engine->evaluate(\"Null\") <=> engine->evaluate(\"Object\")",
+ "engine->evaluate(\"True\") <=> engine->evaluate(\"Object\")",
+ "engine->evaluate(\"False\") <=> engine->evaluate(\"Object\")",
+ "engine->newObject() <=> engine->evaluate(\"Object\")",
+ "engine->newArray() <=> engine->evaluate(\"Object\")",
+ "engine->newArray() <=> engine->evaluate(\"Array\")",
+ "engine->newArray(10) <=> engine->evaluate(\"Object\")",
+ "engine->newArray(10) <=> engine->evaluate(\"Array\")"};
+
+void tst_QScriptValue::instanceOf_data()
+{
+ QTest::addColumn<QScriptValue>("value");
+ QTest::addColumn<QScriptValue>("other");
+ QTest::addColumn<bool>("expected");
+ if (m_engine)
+ delete m_engine;
+ m_engine = new QScriptEngine();
+ QSet<QString> equals;
+ equals.reserve(34);
+ for (unsigned i = 0; i < 34; ++i)
+ equals.insert(instanceOf_array[i]);
+ for (unsigned i = 0; i < 135; ++i) {
+ QPair<QString, QScriptValue> value1 = initScriptValues(i);
+ for (unsigned j = 0; j < 135; ++j) {
+ QPair<QString, QScriptValue> value2 = initScriptValues(j);
+ QString tag = QString::fromLatin1("%20 <=> %21").arg(value1.first, value2.first);
+ QTest::newRow(tag.toAscii().constData()) << value1.second << value2.second << equals.contains(tag); }
+ }
+}
+
+void tst_QScriptValue::instanceOf()
+{
+ QFETCH(QScriptValue, value);
+ QFETCH(QScriptValue, other);
+ QFETCH(bool, expected);
+ QCOMPARE(value.instanceOf(other), expected);
+}
diff --git a/Source/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue_generated_init.cpp b/Source/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue_generated_init.cpp
new file mode 100644
index 0000000..4c97dd4
--- /dev/null
+++ b/Source/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue_generated_init.cpp
@@ -0,0 +1,169 @@
+/*
+ Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+/****************************************************************************
+*************** This file has been generated. DO NOT MODIFY! ****************
+****************************************************************************/
+
+#include "tst_qscriptvalue.h"
+
+
+QPair<QString, QScriptValue> tst_QScriptValue::initScriptValues(uint idx)
+{
+ QScriptEngine* engine = m_engine;
+ switch (idx) {
+ case 0: return QPair<QString, QScriptValue>("QScriptValue()", QScriptValue());
+ case 1: return QPair<QString, QScriptValue>("QScriptValue(QScriptValue::UndefinedValue)", QScriptValue(QScriptValue::UndefinedValue));
+ case 2: return QPair<QString, QScriptValue>("QScriptValue(QScriptValue::NullValue)", QScriptValue(QScriptValue::NullValue));
+ case 3: return QPair<QString, QScriptValue>("QScriptValue(true)", QScriptValue(true));
+ case 4: return QPair<QString, QScriptValue>("QScriptValue(false)", QScriptValue(false));
+ case 5: return QPair<QString, QScriptValue>("QScriptValue(int(122))", QScriptValue(int(122)));
+ case 6: return QPair<QString, QScriptValue>("QScriptValue(uint(124))", QScriptValue(uint(124)));
+ case 7: return QPair<QString, QScriptValue>("QScriptValue(0)", QScriptValue(0));
+ case 8: return QPair<QString, QScriptValue>("QScriptValue(0.0)", QScriptValue(0.0));
+ case 9: return QPair<QString, QScriptValue>("QScriptValue(123.0)", QScriptValue(123.0));
+ case 10: return QPair<QString, QScriptValue>("QScriptValue(6.37e-8)", QScriptValue(6.37e-8));
+ case 11: return QPair<QString, QScriptValue>("QScriptValue(-6.37e-8)", QScriptValue(-6.37e-8));
+ case 12: return QPair<QString, QScriptValue>("QScriptValue(0x43211234)", QScriptValue(0x43211234));
+ case 13: return QPair<QString, QScriptValue>("QScriptValue(0x10000)", QScriptValue(0x10000));
+ case 14: return QPair<QString, QScriptValue>("QScriptValue(0x10001)", QScriptValue(0x10001));
+ case 15: return QPair<QString, QScriptValue>("QScriptValue(qSNaN())", QScriptValue(qSNaN()));
+ case 16: return QPair<QString, QScriptValue>("QScriptValue(qQNaN())", QScriptValue(qQNaN()));
+ case 17: return QPair<QString, QScriptValue>("QScriptValue(qInf())", QScriptValue(qInf()));
+ case 18: return QPair<QString, QScriptValue>("QScriptValue(-qInf())", QScriptValue(-qInf()));
+ case 19: return QPair<QString, QScriptValue>("QScriptValue(\"NaN\")", QScriptValue("NaN"));
+ case 20: return QPair<QString, QScriptValue>("QScriptValue(\"Infinity\")", QScriptValue("Infinity"));
+ case 21: return QPair<QString, QScriptValue>("QScriptValue(\"-Infinity\")", QScriptValue("-Infinity"));
+ case 22: return QPair<QString, QScriptValue>("QScriptValue(\"ciao\")", QScriptValue("ciao"));
+ case 23: return QPair<QString, QScriptValue>("QScriptValue(QString::fromLatin1(\"ciao\"))", QScriptValue(QString::fromLatin1("ciao")));
+ case 24: return QPair<QString, QScriptValue>("QScriptValue(QString(\"\"))", QScriptValue(QString("")));
+ case 25: return QPair<QString, QScriptValue>("QScriptValue(QString())", QScriptValue(QString()));
+ case 26: return QPair<QString, QScriptValue>("QScriptValue(QString(\"0\"))", QScriptValue(QString("0")));
+ case 27: return QPair<QString, QScriptValue>("QScriptValue(QString(\"123\"))", QScriptValue(QString("123")));
+ case 28: return QPair<QString, QScriptValue>("QScriptValue(QString(\"12.4\"))", QScriptValue(QString("12.4")));
+ case 29: return QPair<QString, QScriptValue>("QScriptValue(0, QScriptValue::UndefinedValue)", QScriptValue(0, QScriptValue::UndefinedValue));
+ case 30: return QPair<QString, QScriptValue>("QScriptValue(0, QScriptValue::NullValue)", QScriptValue(0, QScriptValue::NullValue));
+ case 31: return QPair<QString, QScriptValue>("QScriptValue(0, true)", QScriptValue(0, true));
+ case 32: return QPair<QString, QScriptValue>("QScriptValue(0, false)", QScriptValue(0, false));
+ case 33: return QPair<QString, QScriptValue>("QScriptValue(0, int(122))", QScriptValue(0, int(122)));
+ case 34: return QPair<QString, QScriptValue>("QScriptValue(0, uint(124))", QScriptValue(0, uint(124)));
+ case 35: return QPair<QString, QScriptValue>("QScriptValue(0, 0)", QScriptValue(0, 0));
+ case 36: return QPair<QString, QScriptValue>("QScriptValue(0, 0.0)", QScriptValue(0, 0.0));
+ case 37: return QPair<QString, QScriptValue>("QScriptValue(0, 123.0)", QScriptValue(0, 123.0));
+ case 38: return QPair<QString, QScriptValue>("QScriptValue(0, 6.37e-8)", QScriptValue(0, 6.37e-8));
+ case 39: return QPair<QString, QScriptValue>("QScriptValue(0, -6.37e-8)", QScriptValue(0, -6.37e-8));
+ case 40: return QPair<QString, QScriptValue>("QScriptValue(0, 0x43211234)", QScriptValue(0, 0x43211234));
+ case 41: return QPair<QString, QScriptValue>("QScriptValue(0, 0x10000)", QScriptValue(0, 0x10000));
+ case 42: return QPair<QString, QScriptValue>("QScriptValue(0, 0x10001)", QScriptValue(0, 0x10001));
+ case 43: return QPair<QString, QScriptValue>("QScriptValue(0, qSNaN())", QScriptValue(0, qSNaN()));
+ case 44: return QPair<QString, QScriptValue>("QScriptValue(0, qQNaN())", QScriptValue(0, qQNaN()));
+ case 45: return QPair<QString, QScriptValue>("QScriptValue(0, qInf())", QScriptValue(0, qInf()));
+ case 46: return QPair<QString, QScriptValue>("QScriptValue(0, -qInf())", QScriptValue(0, -qInf()));
+ case 47: return QPair<QString, QScriptValue>("QScriptValue(0, \"NaN\")", QScriptValue(0, "NaN"));
+ case 48: return QPair<QString, QScriptValue>("QScriptValue(0, \"Infinity\")", QScriptValue(0, "Infinity"));
+ case 49: return QPair<QString, QScriptValue>("QScriptValue(0, \"-Infinity\")", QScriptValue(0, "-Infinity"));
+ case 50: return QPair<QString, QScriptValue>("QScriptValue(0, \"ciao\")", QScriptValue(0, "ciao"));
+ case 51: return QPair<QString, QScriptValue>("QScriptValue(0, QString::fromLatin1(\"ciao\"))", QScriptValue(0, QString::fromLatin1("ciao")));
+ case 52: return QPair<QString, QScriptValue>("QScriptValue(0, QString(\"\"))", QScriptValue(0, QString("")));
+ case 53: return QPair<QString, QScriptValue>("QScriptValue(0, QString())", QScriptValue(0, QString()));
+ case 54: return QPair<QString, QScriptValue>("QScriptValue(0, QString(\"0\"))", QScriptValue(0, QString("0")));
+ case 55: return QPair<QString, QScriptValue>("QScriptValue(0, QString(\"123\"))", QScriptValue(0, QString("123")));
+ case 56: return QPair<QString, QScriptValue>("QScriptValue(0, QString(\"12.3\"))", QScriptValue(0, QString("12.3")));
+ case 57: return QPair<QString, QScriptValue>("QScriptValue(engine, QScriptValue::UndefinedValue)", QScriptValue(engine, QScriptValue::UndefinedValue));
+ case 58: return QPair<QString, QScriptValue>("QScriptValue(engine, QScriptValue::NullValue)", QScriptValue(engine, QScriptValue::NullValue));
+ case 59: return QPair<QString, QScriptValue>("QScriptValue(engine, true)", QScriptValue(engine, true));
+ case 60: return QPair<QString, QScriptValue>("QScriptValue(engine, false)", QScriptValue(engine, false));
+ case 61: return QPair<QString, QScriptValue>("QScriptValue(engine, int(122))", QScriptValue(engine, int(122)));
+ case 62: return QPair<QString, QScriptValue>("QScriptValue(engine, uint(124))", QScriptValue(engine, uint(124)));
+ case 63: return QPair<QString, QScriptValue>("QScriptValue(engine, 0)", QScriptValue(engine, 0));
+ case 64: return QPair<QString, QScriptValue>("QScriptValue(engine, 0.0)", QScriptValue(engine, 0.0));
+ case 65: return QPair<QString, QScriptValue>("QScriptValue(engine, 123.0)", QScriptValue(engine, 123.0));
+ case 66: return QPair<QString, QScriptValue>("QScriptValue(engine, 6.37e-8)", QScriptValue(engine, 6.37e-8));
+ case 67: return QPair<QString, QScriptValue>("QScriptValue(engine, -6.37e-8)", QScriptValue(engine, -6.37e-8));
+ case 68: return QPair<QString, QScriptValue>("QScriptValue(engine, 0x43211234)", QScriptValue(engine, 0x43211234));
+ case 69: return QPair<QString, QScriptValue>("QScriptValue(engine, 0x10000)", QScriptValue(engine, 0x10000));
+ case 70: return QPair<QString, QScriptValue>("QScriptValue(engine, 0x10001)", QScriptValue(engine, 0x10001));
+ case 71: return QPair<QString, QScriptValue>("QScriptValue(engine, qSNaN())", QScriptValue(engine, qSNaN()));
+ case 72: return QPair<QString, QScriptValue>("QScriptValue(engine, qQNaN())", QScriptValue(engine, qQNaN()));
+ case 73: return QPair<QString, QScriptValue>("QScriptValue(engine, qInf())", QScriptValue(engine, qInf()));
+ case 74: return QPair<QString, QScriptValue>("QScriptValue(engine, -qInf())", QScriptValue(engine, -qInf()));
+ case 75: return QPair<QString, QScriptValue>("QScriptValue(engine, \"NaN\")", QScriptValue(engine, "NaN"));
+ case 76: return QPair<QString, QScriptValue>("QScriptValue(engine, \"Infinity\")", QScriptValue(engine, "Infinity"));
+ case 77: return QPair<QString, QScriptValue>("QScriptValue(engine, \"-Infinity\")", QScriptValue(engine, "-Infinity"));
+ case 78: return QPair<QString, QScriptValue>("QScriptValue(engine, \"ciao\")", QScriptValue(engine, "ciao"));
+ case 79: return QPair<QString, QScriptValue>("QScriptValue(engine, QString::fromLatin1(\"ciao\"))", QScriptValue(engine, QString::fromLatin1("ciao")));
+ case 80: return QPair<QString, QScriptValue>("QScriptValue(engine, QString(\"\"))", QScriptValue(engine, QString("")));
+ case 81: return QPair<QString, QScriptValue>("QScriptValue(engine, QString())", QScriptValue(engine, QString()));
+ case 82: return QPair<QString, QScriptValue>("QScriptValue(engine, QString(\"0\"))", QScriptValue(engine, QString("0")));
+ case 83: return QPair<QString, QScriptValue>("QScriptValue(engine, QString(\"123\"))", QScriptValue(engine, QString("123")));
+ case 84: return QPair<QString, QScriptValue>("QScriptValue(engine, QString(\"1.23\"))", QScriptValue(engine, QString("1.23")));
+ case 85: return QPair<QString, QScriptValue>("engine->evaluate(\"[]\")", engine->evaluate("[]"));
+ case 86: return QPair<QString, QScriptValue>("engine->evaluate(\"{}\")", engine->evaluate("{}"));
+ case 87: return QPair<QString, QScriptValue>("engine->evaluate(\"Object.prototype\")", engine->evaluate("Object.prototype"));
+ case 88: return QPair<QString, QScriptValue>("engine->evaluate(\"Date.prototype\")", engine->evaluate("Date.prototype"));
+ case 89: return QPair<QString, QScriptValue>("engine->evaluate(\"Array.prototype\")", engine->evaluate("Array.prototype"));
+ case 90: return QPair<QString, QScriptValue>("engine->evaluate(\"Function.prototype\")", engine->evaluate("Function.prototype"));
+ case 91: return QPair<QString, QScriptValue>("engine->evaluate(\"Error.prototype\")", engine->evaluate("Error.prototype"));
+ case 92: return QPair<QString, QScriptValue>("engine->evaluate(\"Object\")", engine->evaluate("Object"));
+ case 93: return QPair<QString, QScriptValue>("engine->evaluate(\"Array\")", engine->evaluate("Array"));
+ case 94: return QPair<QString, QScriptValue>("engine->evaluate(\"Number\")", engine->evaluate("Number"));
+ case 95: return QPair<QString, QScriptValue>("engine->evaluate(\"Function\")", engine->evaluate("Function"));
+ case 96: return QPair<QString, QScriptValue>("engine->evaluate(\"(function() { return 1; })\")", engine->evaluate("(function() { return 1; })"));
+ case 97: return QPair<QString, QScriptValue>("engine->evaluate(\"(function() { return 'ciao'; })\")", engine->evaluate("(function() { return 'ciao'; })"));
+ case 98: return QPair<QString, QScriptValue>("engine->evaluate(\"(function() { throw new Error('foo'); })\")", engine->evaluate("(function() { throw new Error('foo'); })"));
+ case 99: return QPair<QString, QScriptValue>("engine->evaluate(\"/foo/\")", engine->evaluate("/foo/"));
+ case 100: return QPair<QString, QScriptValue>("engine->evaluate(\"new Object()\")", engine->evaluate("new Object()"));
+ case 101: return QPair<QString, QScriptValue>("engine->evaluate(\"new Array()\")", engine->evaluate("new Array()"));
+ case 102: return QPair<QString, QScriptValue>("engine->evaluate(\"new Error()\")", engine->evaluate("new Error()"));
+ case 103: return QPair<QString, QScriptValue>("engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", engine->evaluate("a = new Object(); a.foo = 22; a.foo"));
+ case 104: return QPair<QString, QScriptValue>("engine->evaluate(\"Undefined\")", engine->evaluate("Undefined"));
+ case 105: return QPair<QString, QScriptValue>("engine->evaluate(\"Null\")", engine->evaluate("Null"));
+ case 106: return QPair<QString, QScriptValue>("engine->evaluate(\"True\")", engine->evaluate("True"));
+ case 107: return QPair<QString, QScriptValue>("engine->evaluate(\"False\")", engine->evaluate("False"));
+ case 108: return QPair<QString, QScriptValue>("engine->evaluate(\"undefined\")", engine->evaluate("undefined"));
+ case 109: return QPair<QString, QScriptValue>("engine->evaluate(\"null\")", engine->evaluate("null"));
+ case 110: return QPair<QString, QScriptValue>("engine->evaluate(\"true\")", engine->evaluate("true"));
+ case 111: return QPair<QString, QScriptValue>("engine->evaluate(\"false\")", engine->evaluate("false"));
+ case 112: return QPair<QString, QScriptValue>("engine->evaluate(\"122\")", engine->evaluate("122"));
+ case 113: return QPair<QString, QScriptValue>("engine->evaluate(\"124\")", engine->evaluate("124"));
+ case 114: return QPair<QString, QScriptValue>("engine->evaluate(\"0\")", engine->evaluate("0"));
+ case 115: return QPair<QString, QScriptValue>("engine->evaluate(\"0.0\")", engine->evaluate("0.0"));
+ case 116: return QPair<QString, QScriptValue>("engine->evaluate(\"123.0\")", engine->evaluate("123.0"));
+ case 117: return QPair<QString, QScriptValue>("engine->evaluate(\"6.37e-8\")", engine->evaluate("6.37e-8"));
+ case 118: return QPair<QString, QScriptValue>("engine->evaluate(\"-6.37e-8\")", engine->evaluate("-6.37e-8"));
+ case 119: return QPair<QString, QScriptValue>("engine->evaluate(\"0x43211234\")", engine->evaluate("0x43211234"));
+ case 120: return QPair<QString, QScriptValue>("engine->evaluate(\"0x10000\")", engine->evaluate("0x10000"));
+ case 121: return QPair<QString, QScriptValue>("engine->evaluate(\"0x10001\")", engine->evaluate("0x10001"));
+ case 122: return QPair<QString, QScriptValue>("engine->evaluate(\"NaN\")", engine->evaluate("NaN"));
+ case 123: return QPair<QString, QScriptValue>("engine->evaluate(\"Infinity\")", engine->evaluate("Infinity"));
+ case 124: return QPair<QString, QScriptValue>("engine->evaluate(\"-Infinity\")", engine->evaluate("-Infinity"));
+ case 125: return QPair<QString, QScriptValue>("engine->evaluate(\"'ciao'\")", engine->evaluate("'ciao'"));
+ case 126: return QPair<QString, QScriptValue>("engine->evaluate(\"''\")", engine->evaluate("''"));
+ case 127: return QPair<QString, QScriptValue>("engine->evaluate(\"'0'\")", engine->evaluate("'0'"));
+ case 128: return QPair<QString, QScriptValue>("engine->evaluate(\"'123'\")", engine->evaluate("'123'"));
+ case 129: return QPair<QString, QScriptValue>("engine->evaluate(\"'12.4'\")", engine->evaluate("'12.4'"));
+ case 130: return QPair<QString, QScriptValue>("engine->nullValue()", engine->nullValue());
+ case 131: return QPair<QString, QScriptValue>("engine->undefinedValue()", engine->undefinedValue());
+ case 132: return QPair<QString, QScriptValue>("engine->newObject()", engine->newObject());
+ case 133: return QPair<QString, QScriptValue>("engine->newArray()", engine->newArray());
+ case 134: return QPair<QString, QScriptValue>("engine->newArray(10)", engine->newArray(10));
+ }
+ Q_ASSERT(false);
+ return qMakePair(QString(), QScriptValue());
+}
diff --git a/Source/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue_generated_istype.cpp b/Source/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue_generated_istype.cpp
new file mode 100644
index 0000000..433597f
--- /dev/null
+++ b/Source/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue_generated_istype.cpp
@@ -0,0 +1,622 @@
+/*
+ Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+
+/****************************************************************************
+*************** This file has been generated. DO NOT MODIFY! ****************
+****************************************************************************/
+
+#include "tst_qscriptvalue.h"
+
+
+static const QString isValid_array[] = {
+ "QScriptValue(QScriptValue::UndefinedValue)",
+ "QScriptValue(QScriptValue::NullValue)",
+ "QScriptValue(true)",
+ "QScriptValue(false)",
+ "QScriptValue(int(122))",
+ "QScriptValue(uint(124))",
+ "QScriptValue(0)",
+ "QScriptValue(0.0)",
+ "QScriptValue(123.0)",
+ "QScriptValue(6.37e-8)",
+ "QScriptValue(-6.37e-8)",
+ "QScriptValue(0x43211234)",
+ "QScriptValue(0x10000)",
+ "QScriptValue(0x10001)",
+ "QScriptValue(qSNaN())",
+ "QScriptValue(qQNaN())",
+ "QScriptValue(qInf())",
+ "QScriptValue(-qInf())",
+ "QScriptValue(\"NaN\")",
+ "QScriptValue(\"Infinity\")",
+ "QScriptValue(\"-Infinity\")",
+ "QScriptValue(\"ciao\")",
+ "QScriptValue(QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(QString(\"\"))",
+ "QScriptValue(QString())",
+ "QScriptValue(QString(\"0\"))",
+ "QScriptValue(QString(\"123\"))",
+ "QScriptValue(QString(\"12.4\"))",
+ "QScriptValue(0, QScriptValue::UndefinedValue)",
+ "QScriptValue(0, QScriptValue::NullValue)",
+ "QScriptValue(0, true)",
+ "QScriptValue(0, false)",
+ "QScriptValue(0, int(122))",
+ "QScriptValue(0, uint(124))",
+ "QScriptValue(0, 0)",
+ "QScriptValue(0, 0.0)",
+ "QScriptValue(0, 123.0)",
+ "QScriptValue(0, 6.37e-8)",
+ "QScriptValue(0, -6.37e-8)",
+ "QScriptValue(0, 0x43211234)",
+ "QScriptValue(0, 0x10000)",
+ "QScriptValue(0, 0x10001)",
+ "QScriptValue(0, qSNaN())",
+ "QScriptValue(0, qQNaN())",
+ "QScriptValue(0, qInf())",
+ "QScriptValue(0, -qInf())",
+ "QScriptValue(0, \"NaN\")",
+ "QScriptValue(0, \"Infinity\")",
+ "QScriptValue(0, \"-Infinity\")",
+ "QScriptValue(0, \"ciao\")",
+ "QScriptValue(0, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(0, QString(\"\"))",
+ "QScriptValue(0, QString())",
+ "QScriptValue(0, QString(\"0\"))",
+ "QScriptValue(0, QString(\"123\"))",
+ "QScriptValue(0, QString(\"12.3\"))",
+ "QScriptValue(engine, QScriptValue::UndefinedValue)",
+ "QScriptValue(engine, QScriptValue::NullValue)",
+ "QScriptValue(engine, true)",
+ "QScriptValue(engine, false)",
+ "QScriptValue(engine, int(122))",
+ "QScriptValue(engine, uint(124))",
+ "QScriptValue(engine, 0)",
+ "QScriptValue(engine, 0.0)",
+ "QScriptValue(engine, 123.0)",
+ "QScriptValue(engine, 6.37e-8)",
+ "QScriptValue(engine, -6.37e-8)",
+ "QScriptValue(engine, 0x43211234)",
+ "QScriptValue(engine, 0x10000)",
+ "QScriptValue(engine, 0x10001)",
+ "QScriptValue(engine, qSNaN())",
+ "QScriptValue(engine, qQNaN())",
+ "QScriptValue(engine, qInf())",
+ "QScriptValue(engine, -qInf())",
+ "QScriptValue(engine, \"NaN\")",
+ "QScriptValue(engine, \"Infinity\")",
+ "QScriptValue(engine, \"-Infinity\")",
+ "QScriptValue(engine, \"ciao\")",
+ "QScriptValue(engine, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(engine, QString(\"\"))",
+ "QScriptValue(engine, QString())",
+ "QScriptValue(engine, QString(\"0\"))",
+ "QScriptValue(engine, QString(\"123\"))",
+ "QScriptValue(engine, QString(\"1.23\"))",
+ "engine->evaluate(\"[]\")",
+ "engine->evaluate(\"{}\")",
+ "engine->evaluate(\"Object.prototype\")",
+ "engine->evaluate(\"Date.prototype\")",
+ "engine->evaluate(\"Array.prototype\")",
+ "engine->evaluate(\"Function.prototype\")",
+ "engine->evaluate(\"Error.prototype\")",
+ "engine->evaluate(\"Object\")",
+ "engine->evaluate(\"Array\")",
+ "engine->evaluate(\"Number\")",
+ "engine->evaluate(\"Function\")",
+ "engine->evaluate(\"(function() { return 1; })\")",
+ "engine->evaluate(\"(function() { return 'ciao'; })\")",
+ "engine->evaluate(\"(function() { throw new Error('foo'); })\")",
+ "engine->evaluate(\"/foo/\")",
+ "engine->evaluate(\"new Object()\")",
+ "engine->evaluate(\"new Array()\")",
+ "engine->evaluate(\"new Error()\")",
+ "engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")",
+ "engine->evaluate(\"Undefined\")",
+ "engine->evaluate(\"Null\")",
+ "engine->evaluate(\"True\")",
+ "engine->evaluate(\"False\")",
+ "engine->evaluate(\"undefined\")",
+ "engine->evaluate(\"null\")",
+ "engine->evaluate(\"true\")",
+ "engine->evaluate(\"false\")",
+ "engine->evaluate(\"122\")",
+ "engine->evaluate(\"124\")",
+ "engine->evaluate(\"0\")",
+ "engine->evaluate(\"0.0\")",
+ "engine->evaluate(\"123.0\")",
+ "engine->evaluate(\"6.37e-8\")",
+ "engine->evaluate(\"-6.37e-8\")",
+ "engine->evaluate(\"0x43211234\")",
+ "engine->evaluate(\"0x10000\")",
+ "engine->evaluate(\"0x10001\")",
+ "engine->evaluate(\"NaN\")",
+ "engine->evaluate(\"Infinity\")",
+ "engine->evaluate(\"-Infinity\")",
+ "engine->evaluate(\"'ciao'\")",
+ "engine->evaluate(\"''\")",
+ "engine->evaluate(\"'0'\")",
+ "engine->evaluate(\"'123'\")",
+ "engine->evaluate(\"'12.4'\")",
+ "engine->nullValue()",
+ "engine->undefinedValue()",
+ "engine->newObject()",
+ "engine->newArray()",
+ "engine->newArray(10)"};
+
+void tst_QScriptValue::isValid_data()
+{
+ QTest::addColumn<QScriptValue>("value");
+ QTest::addColumn<bool>("expected");
+ if (m_engine)
+ delete m_engine;
+ m_engine = new QScriptEngine();
+ QSet<QString> expectedValue;
+ expectedValue.reserve(134);
+ for (uint i = 0; i < 134; ++i)
+ expectedValue.insert(isValid_array[i]);
+ for (uint i = 0; i < 135; ++i) {
+ QPair<QString, QScriptValue> testcase = initScriptValues(i);
+ QTest::newRow(testcase.first.toAscii().constData()) << testcase.second << expectedValue.contains(testcase.first);
+ }
+}
+
+void tst_QScriptValue::isValid()
+{
+ QFETCH(QScriptValue, value);
+ QFETCH(bool, expected);
+ QCOMPARE(value.isValid(), expected);
+ QCOMPARE(value.isValid(), expected);
+}
+
+static const QString isBool_array[] = {
+ "QScriptValue(true)",
+ "QScriptValue(false)",
+ "QScriptValue(0, true)",
+ "QScriptValue(0, false)",
+ "QScriptValue(engine, true)",
+ "QScriptValue(engine, false)",
+ "engine->evaluate(\"true\")",
+ "engine->evaluate(\"false\")"};
+
+void tst_QScriptValue::isBool_data()
+{
+ QTest::addColumn<QScriptValue>("value");
+ QTest::addColumn<bool>("expected");
+ if (m_engine)
+ delete m_engine;
+ m_engine = new QScriptEngine();
+ QSet<QString> expectedValue;
+ expectedValue.reserve(8);
+ for (uint i = 0; i < 8; ++i)
+ expectedValue.insert(isBool_array[i]);
+ for (uint i = 0; i < 135; ++i) {
+ QPair<QString, QScriptValue> testcase = initScriptValues(i);
+ QTest::newRow(testcase.first.toAscii().constData()) << testcase.second << expectedValue.contains(testcase.first);
+ }
+}
+
+void tst_QScriptValue::isBool()
+{
+ QFETCH(QScriptValue, value);
+ QFETCH(bool, expected);
+ QCOMPARE(value.isBool(), expected);
+ QCOMPARE(value.isBool(), expected);
+}
+
+static const QString isBoolean_array[] = {
+ "QScriptValue(true)",
+ "QScriptValue(false)",
+ "QScriptValue(0, true)",
+ "QScriptValue(0, false)",
+ "QScriptValue(engine, true)",
+ "QScriptValue(engine, false)",
+ "engine->evaluate(\"true\")",
+ "engine->evaluate(\"false\")"};
+
+void tst_QScriptValue::isBoolean_data()
+{
+ QTest::addColumn<QScriptValue>("value");
+ QTest::addColumn<bool>("expected");
+ if (m_engine)
+ delete m_engine;
+ m_engine = new QScriptEngine();
+ QSet<QString> expectedValue;
+ expectedValue.reserve(8);
+ for (uint i = 0; i < 8; ++i)
+ expectedValue.insert(isBoolean_array[i]);
+ for (uint i = 0; i < 135; ++i) {
+ QPair<QString, QScriptValue> testcase = initScriptValues(i);
+ QTest::newRow(testcase.first.toAscii().constData()) << testcase.second << expectedValue.contains(testcase.first);
+ }
+}
+
+void tst_QScriptValue::isBoolean()
+{
+ QFETCH(QScriptValue, value);
+ QFETCH(bool, expected);
+ QCOMPARE(value.isBoolean(), expected);
+ QCOMPARE(value.isBoolean(), expected);
+}
+
+static const QString isNumber_array[] = {
+ "QScriptValue(int(122))",
+ "QScriptValue(uint(124))",
+ "QScriptValue(0)",
+ "QScriptValue(0.0)",
+ "QScriptValue(123.0)",
+ "QScriptValue(6.37e-8)",
+ "QScriptValue(-6.37e-8)",
+ "QScriptValue(0x43211234)",
+ "QScriptValue(0x10000)",
+ "QScriptValue(0x10001)",
+ "QScriptValue(qSNaN())",
+ "QScriptValue(qQNaN())",
+ "QScriptValue(qInf())",
+ "QScriptValue(-qInf())",
+ "QScriptValue(0, int(122))",
+ "QScriptValue(0, uint(124))",
+ "QScriptValue(0, 0)",
+ "QScriptValue(0, 0.0)",
+ "QScriptValue(0, 123.0)",
+ "QScriptValue(0, 6.37e-8)",
+ "QScriptValue(0, -6.37e-8)",
+ "QScriptValue(0, 0x43211234)",
+ "QScriptValue(0, 0x10000)",
+ "QScriptValue(0, 0x10001)",
+ "QScriptValue(0, qSNaN())",
+ "QScriptValue(0, qQNaN())",
+ "QScriptValue(0, qInf())",
+ "QScriptValue(0, -qInf())",
+ "QScriptValue(engine, int(122))",
+ "QScriptValue(engine, uint(124))",
+ "QScriptValue(engine, 0)",
+ "QScriptValue(engine, 0.0)",
+ "QScriptValue(engine, 123.0)",
+ "QScriptValue(engine, 6.37e-8)",
+ "QScriptValue(engine, -6.37e-8)",
+ "QScriptValue(engine, 0x43211234)",
+ "QScriptValue(engine, 0x10000)",
+ "QScriptValue(engine, 0x10001)",
+ "QScriptValue(engine, qSNaN())",
+ "QScriptValue(engine, qQNaN())",
+ "QScriptValue(engine, qInf())",
+ "QScriptValue(engine, -qInf())",
+ "engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")",
+ "engine->evaluate(\"122\")",
+ "engine->evaluate(\"124\")",
+ "engine->evaluate(\"0\")",
+ "engine->evaluate(\"0.0\")",
+ "engine->evaluate(\"123.0\")",
+ "engine->evaluate(\"6.37e-8\")",
+ "engine->evaluate(\"-6.37e-8\")",
+ "engine->evaluate(\"0x43211234\")",
+ "engine->evaluate(\"0x10000\")",
+ "engine->evaluate(\"0x10001\")",
+ "engine->evaluate(\"NaN\")",
+ "engine->evaluate(\"Infinity\")",
+ "engine->evaluate(\"-Infinity\")"};
+
+void tst_QScriptValue::isNumber_data()
+{
+ QTest::addColumn<QScriptValue>("value");
+ QTest::addColumn<bool>("expected");
+ if (m_engine)
+ delete m_engine;
+ m_engine = new QScriptEngine();
+ QSet<QString> expectedValue;
+ expectedValue.reserve(56);
+ for (uint i = 0; i < 56; ++i)
+ expectedValue.insert(isNumber_array[i]);
+ for (uint i = 0; i < 135; ++i) {
+ QPair<QString, QScriptValue> testcase = initScriptValues(i);
+ QTest::newRow(testcase.first.toAscii().constData()) << testcase.second << expectedValue.contains(testcase.first);
+ }
+}
+
+void tst_QScriptValue::isNumber()
+{
+ QFETCH(QScriptValue, value);
+ QFETCH(bool, expected);
+ QCOMPARE(value.isNumber(), expected);
+ QCOMPARE(value.isNumber(), expected);
+}
+
+static const QString isFunction_array[] = {
+ "engine->evaluate(\"Function.prototype\")",
+ "engine->evaluate(\"Object\")",
+ "engine->evaluate(\"Array\")",
+ "engine->evaluate(\"Number\")",
+ "engine->evaluate(\"Function\")",
+ "engine->evaluate(\"(function() { return 1; })\")",
+ "engine->evaluate(\"(function() { return 'ciao'; })\")",
+ "engine->evaluate(\"(function() { throw new Error('foo'); })\")",
+ "engine->evaluate(\"/foo/\")"};
+
+void tst_QScriptValue::isFunction_data()
+{
+ QTest::addColumn<QScriptValue>("value");
+ QTest::addColumn<bool>("expected");
+ if (m_engine)
+ delete m_engine;
+ m_engine = new QScriptEngine();
+ QSet<QString> expectedValue;
+ expectedValue.reserve(9);
+ for (uint i = 0; i < 9; ++i)
+ expectedValue.insert(isFunction_array[i]);
+ for (uint i = 0; i < 135; ++i) {
+ QPair<QString, QScriptValue> testcase = initScriptValues(i);
+ QTest::newRow(testcase.first.toAscii().constData()) << testcase.second << expectedValue.contains(testcase.first);
+ }
+}
+
+void tst_QScriptValue::isFunction()
+{
+ QFETCH(QScriptValue, value);
+ QFETCH(bool, expected);
+ QCOMPARE(value.isFunction(), expected);
+ QCOMPARE(value.isFunction(), expected);
+}
+
+static const QString isNull_array[] = {
+ "QScriptValue(QScriptValue::NullValue)",
+ "QScriptValue(0, QScriptValue::NullValue)",
+ "QScriptValue(engine, QScriptValue::NullValue)",
+ "engine->evaluate(\"null\")",
+ "engine->nullValue()"};
+
+void tst_QScriptValue::isNull_data()
+{
+ QTest::addColumn<QScriptValue>("value");
+ QTest::addColumn<bool>("expected");
+ if (m_engine)
+ delete m_engine;
+ m_engine = new QScriptEngine();
+ QSet<QString> expectedValue;
+ expectedValue.reserve(5);
+ for (uint i = 0; i < 5; ++i)
+ expectedValue.insert(isNull_array[i]);
+ for (uint i = 0; i < 135; ++i) {
+ QPair<QString, QScriptValue> testcase = initScriptValues(i);
+ QTest::newRow(testcase.first.toAscii().constData()) << testcase.second << expectedValue.contains(testcase.first);
+ }
+}
+
+void tst_QScriptValue::isNull()
+{
+ QFETCH(QScriptValue, value);
+ QFETCH(bool, expected);
+ QCOMPARE(value.isNull(), expected);
+ QCOMPARE(value.isNull(), expected);
+}
+
+static const QString isString_array[] = {
+ "QScriptValue(\"NaN\")",
+ "QScriptValue(\"Infinity\")",
+ "QScriptValue(\"-Infinity\")",
+ "QScriptValue(\"ciao\")",
+ "QScriptValue(QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(QString(\"\"))",
+ "QScriptValue(QString())",
+ "QScriptValue(QString(\"0\"))",
+ "QScriptValue(QString(\"123\"))",
+ "QScriptValue(QString(\"12.4\"))",
+ "QScriptValue(0, \"NaN\")",
+ "QScriptValue(0, \"Infinity\")",
+ "QScriptValue(0, \"-Infinity\")",
+ "QScriptValue(0, \"ciao\")",
+ "QScriptValue(0, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(0, QString(\"\"))",
+ "QScriptValue(0, QString())",
+ "QScriptValue(0, QString(\"0\"))",
+ "QScriptValue(0, QString(\"123\"))",
+ "QScriptValue(0, QString(\"12.3\"))",
+ "QScriptValue(engine, \"NaN\")",
+ "QScriptValue(engine, \"Infinity\")",
+ "QScriptValue(engine, \"-Infinity\")",
+ "QScriptValue(engine, \"ciao\")",
+ "QScriptValue(engine, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(engine, QString(\"\"))",
+ "QScriptValue(engine, QString())",
+ "QScriptValue(engine, QString(\"0\"))",
+ "QScriptValue(engine, QString(\"123\"))",
+ "QScriptValue(engine, QString(\"1.23\"))",
+ "engine->evaluate(\"'ciao'\")",
+ "engine->evaluate(\"''\")",
+ "engine->evaluate(\"'0'\")",
+ "engine->evaluate(\"'123'\")",
+ "engine->evaluate(\"'12.4'\")"};
+
+void tst_QScriptValue::isString_data()
+{
+ QTest::addColumn<QScriptValue>("value");
+ QTest::addColumn<bool>("expected");
+ if (m_engine)
+ delete m_engine;
+ m_engine = new QScriptEngine();
+ QSet<QString> expectedValue;
+ expectedValue.reserve(35);
+ for (uint i = 0; i < 35; ++i)
+ expectedValue.insert(isString_array[i]);
+ for (uint i = 0; i < 135; ++i) {
+ QPair<QString, QScriptValue> testcase = initScriptValues(i);
+ QTest::newRow(testcase.first.toAscii().constData()) << testcase.second << expectedValue.contains(testcase.first);
+ }
+}
+
+void tst_QScriptValue::isString()
+{
+ QFETCH(QScriptValue, value);
+ QFETCH(bool, expected);
+ QCOMPARE(value.isString(), expected);
+ QCOMPARE(value.isString(), expected);
+}
+
+static const QString isUndefined_array[] = {
+ "QScriptValue(QScriptValue::UndefinedValue)",
+ "QScriptValue(0, QScriptValue::UndefinedValue)",
+ "QScriptValue(engine, QScriptValue::UndefinedValue)",
+ "engine->evaluate(\"{}\")",
+ "engine->evaluate(\"undefined\")",
+ "engine->undefinedValue()"};
+
+void tst_QScriptValue::isUndefined_data()
+{
+ QTest::addColumn<QScriptValue>("value");
+ QTest::addColumn<bool>("expected");
+ if (m_engine)
+ delete m_engine;
+ m_engine = new QScriptEngine();
+ QSet<QString> expectedValue;
+ expectedValue.reserve(6);
+ for (uint i = 0; i < 6; ++i)
+ expectedValue.insert(isUndefined_array[i]);
+ for (uint i = 0; i < 135; ++i) {
+ QPair<QString, QScriptValue> testcase = initScriptValues(i);
+ QTest::newRow(testcase.first.toAscii().constData()) << testcase.second << expectedValue.contains(testcase.first);
+ }
+}
+
+void tst_QScriptValue::isUndefined()
+{
+ QFETCH(QScriptValue, value);
+ QFETCH(bool, expected);
+ QCOMPARE(value.isUndefined(), expected);
+ QCOMPARE(value.isUndefined(), expected);
+}
+
+
+
+
+static const QString isObject_array[] = {
+ "engine->evaluate(\"[]\")",
+ "engine->evaluate(\"Object.prototype\")",
+ "engine->evaluate(\"Date.prototype\")",
+ "engine->evaluate(\"Array.prototype\")",
+ "engine->evaluate(\"Function.prototype\")",
+ "engine->evaluate(\"Error.prototype\")",
+ "engine->evaluate(\"Object\")",
+ "engine->evaluate(\"Array\")",
+ "engine->evaluate(\"Number\")",
+ "engine->evaluate(\"Function\")",
+ "engine->evaluate(\"(function() { return 1; })\")",
+ "engine->evaluate(\"(function() { return 'ciao'; })\")",
+ "engine->evaluate(\"(function() { throw new Error('foo'); })\")",
+ "engine->evaluate(\"/foo/\")",
+ "engine->evaluate(\"new Object()\")",
+ "engine->evaluate(\"new Array()\")",
+ "engine->evaluate(\"new Error()\")",
+ "engine->evaluate(\"Undefined\")",
+ "engine->evaluate(\"Null\")",
+ "engine->evaluate(\"True\")",
+ "engine->evaluate(\"False\")",
+ "engine->newObject()",
+ "engine->newArray()",
+ "engine->newArray(10)"};
+
+void tst_QScriptValue::isObject_data()
+{
+ QTest::addColumn<QScriptValue>("value");
+ QTest::addColumn<bool>("expected");
+ if (m_engine)
+ delete m_engine;
+ m_engine = new QScriptEngine();
+ QSet<QString> expectedValue;
+ expectedValue.reserve(24);
+ for (uint i = 0; i < 24; ++i)
+ expectedValue.insert(isObject_array[i]);
+ for (uint i = 0; i < 135; ++i) {
+ QPair<QString, QScriptValue> testcase = initScriptValues(i);
+ QTest::newRow(testcase.first.toAscii().constData()) << testcase.second << expectedValue.contains(testcase.first);
+ }
+}
+
+void tst_QScriptValue::isObject()
+{
+ QFETCH(QScriptValue, value);
+ QFETCH(bool, expected);
+ QCOMPARE(value.isObject(), expected);
+ QCOMPARE(value.isObject(), expected);
+}
+
+static const QString isArray_array[] = {
+ "engine->evaluate(\"[]\")",
+ "engine->evaluate(\"Array.prototype\")",
+ "engine->evaluate(\"new Array()\")",
+ "engine->newArray()",
+ "engine->newArray(10)"};
+
+void tst_QScriptValue::isArray_data()
+{
+ QTest::addColumn<QScriptValue>("value");
+ QTest::addColumn<bool>("expected");
+ if (m_engine)
+ delete m_engine;
+ m_engine = new QScriptEngine();
+ QSet<QString> expectedValue;
+ expectedValue.reserve(5);
+ for (uint i = 0; i < 5; ++i)
+ expectedValue.insert(isArray_array[i]);
+ for (uint i = 0; i < 135; ++i) {
+ QPair<QString, QScriptValue> testcase = initScriptValues(i);
+ QTest::newRow(testcase.first.toAscii().constData()) << testcase.second << expectedValue.contains(testcase.first);
+ }
+}
+
+void tst_QScriptValue::isArray()
+{
+ QFETCH(QScriptValue, value);
+ QFETCH(bool, expected);
+ QCOMPARE(value.isArray(), expected);
+ QCOMPARE(value.isArray(), expected);
+}
+
+static const QString isError_array[] = {
+ "engine->evaluate(\"Error.prototype\")",
+ "engine->evaluate(\"new Error()\")",
+ "engine->evaluate(\"Undefined\")",
+ "engine->evaluate(\"Null\")",
+ "engine->evaluate(\"True\")",
+ "engine->evaluate(\"False\")"};
+
+void tst_QScriptValue::isError_data()
+{
+ QTest::addColumn<QScriptValue>("value");
+ QTest::addColumn<bool>("expected");
+ if (m_engine)
+ delete m_engine;
+ m_engine = new QScriptEngine();
+ QSet<QString> expectedValue;
+ expectedValue.reserve(6);
+ for (uint i = 0; i < 6; ++i)
+ expectedValue.insert(isError_array[i]);
+ for (uint i = 0; i < 135; ++i) {
+ QPair<QString, QScriptValue> testcase = initScriptValues(i);
+ QTest::newRow(testcase.first.toAscii().constData()) << testcase.second << expectedValue.contains(testcase.first);
+ }
+}
+
+void tst_QScriptValue::isError()
+{
+ QFETCH(QScriptValue, value);
+ QFETCH(bool, expected);
+ QCOMPARE(value.isError(), expected);
+ QCOMPARE(value.isError(), expected);
+}
diff --git a/Source/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue_generated_totype.cpp b/Source/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue_generated_totype.cpp
new file mode 100644
index 0000000..eaa5d14
--- /dev/null
+++ b/Source/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue_generated_totype.cpp
@@ -0,0 +1,1786 @@
+/*
+ Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+/****************************************************************************
+*************** This file has been generated. DO NOT MODIFY! ****************
+****************************************************************************/
+
+#include "tst_qscriptvalue.h"
+
+static const QString toString_tagArray[] = {
+ "QScriptValue()",
+ "QScriptValue(QScriptValue::UndefinedValue)",
+ "QScriptValue(QScriptValue::NullValue)",
+ "QScriptValue(true)",
+ "QScriptValue(false)",
+ "QScriptValue(int(122))",
+ "QScriptValue(uint(124))",
+ "QScriptValue(0)",
+ "QScriptValue(0.0)",
+ "QScriptValue(123.0)",
+ "QScriptValue(6.37e-8)",
+ "QScriptValue(-6.37e-8)",
+ "QScriptValue(0x43211234)",
+ "QScriptValue(0x10000)",
+ "QScriptValue(0x10001)",
+ "QScriptValue(qSNaN())",
+ "QScriptValue(qQNaN())",
+ "QScriptValue(qInf())",
+ "QScriptValue(-qInf())",
+ "QScriptValue(\"NaN\")",
+ "QScriptValue(\"Infinity\")",
+ "QScriptValue(\"-Infinity\")",
+ "QScriptValue(\"ciao\")",
+ "QScriptValue(QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(QString(\"\"))",
+ "QScriptValue(QString())",
+ "QScriptValue(QString(\"0\"))",
+ "QScriptValue(QString(\"123\"))",
+ "QScriptValue(QString(\"12.4\"))",
+ "QScriptValue(0, QScriptValue::UndefinedValue)",
+ "QScriptValue(0, QScriptValue::NullValue)",
+ "QScriptValue(0, true)",
+ "QScriptValue(0, false)",
+ "QScriptValue(0, int(122))",
+ "QScriptValue(0, uint(124))",
+ "QScriptValue(0, 0)",
+ "QScriptValue(0, 0.0)",
+ "QScriptValue(0, 123.0)",
+ "QScriptValue(0, 6.37e-8)",
+ "QScriptValue(0, -6.37e-8)",
+ "QScriptValue(0, 0x43211234)",
+ "QScriptValue(0, 0x10000)",
+ "QScriptValue(0, 0x10001)",
+ "QScriptValue(0, qSNaN())",
+ "QScriptValue(0, qQNaN())",
+ "QScriptValue(0, qInf())",
+ "QScriptValue(0, -qInf())",
+ "QScriptValue(0, \"NaN\")",
+ "QScriptValue(0, \"Infinity\")",
+ "QScriptValue(0, \"-Infinity\")",
+ "QScriptValue(0, \"ciao\")",
+ "QScriptValue(0, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(0, QString(\"\"))",
+ "QScriptValue(0, QString())",
+ "QScriptValue(0, QString(\"0\"))",
+ "QScriptValue(0, QString(\"123\"))",
+ "QScriptValue(0, QString(\"12.3\"))",
+ "QScriptValue(engine, QScriptValue::UndefinedValue)",
+ "QScriptValue(engine, QScriptValue::NullValue)",
+ "QScriptValue(engine, true)",
+ "QScriptValue(engine, false)",
+ "QScriptValue(engine, int(122))",
+ "QScriptValue(engine, uint(124))",
+ "QScriptValue(engine, 0)",
+ "QScriptValue(engine, 0.0)",
+ "QScriptValue(engine, 123.0)",
+ "QScriptValue(engine, 6.37e-8)",
+ "QScriptValue(engine, -6.37e-8)",
+ "QScriptValue(engine, 0x43211234)",
+ "QScriptValue(engine, 0x10000)",
+ "QScriptValue(engine, 0x10001)",
+ "QScriptValue(engine, qSNaN())",
+ "QScriptValue(engine, qQNaN())",
+ "QScriptValue(engine, qInf())",
+ "QScriptValue(engine, -qInf())",
+ "QScriptValue(engine, \"NaN\")",
+ "QScriptValue(engine, \"Infinity\")",
+ "QScriptValue(engine, \"-Infinity\")",
+ "QScriptValue(engine, \"ciao\")",
+ "QScriptValue(engine, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(engine, QString(\"\"))",
+ "QScriptValue(engine, QString())",
+ "QScriptValue(engine, QString(\"0\"))",
+ "QScriptValue(engine, QString(\"123\"))",
+ "QScriptValue(engine, QString(\"1.23\"))",
+ "engine->evaluate(\"[]\")",
+ "engine->evaluate(\"{}\")",
+ "engine->evaluate(\"Object.prototype\")",
+ "engine->evaluate(\"Date.prototype\")",
+ "engine->evaluate(\"Array.prototype\")",
+ "engine->evaluate(\"Function.prototype\")",
+ "engine->evaluate(\"Error.prototype\")",
+ "engine->evaluate(\"Object\")",
+ "engine->evaluate(\"Array\")",
+ "engine->evaluate(\"Number\")",
+ "engine->evaluate(\"Function\")",
+ "engine->evaluate(\"(function() { return 1; })\")",
+ "engine->evaluate(\"(function() { return 'ciao'; })\")",
+ "engine->evaluate(\"(function() { throw new Error('foo'); })\")",
+ "engine->evaluate(\"/foo/\")",
+ "engine->evaluate(\"new Object()\")",
+ "engine->evaluate(\"new Array()\")",
+ "engine->evaluate(\"new Error()\")",
+ "engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")",
+ "engine->evaluate(\"Undefined\")",
+ "engine->evaluate(\"Null\")",
+ "engine->evaluate(\"True\")",
+ "engine->evaluate(\"False\")",
+ "engine->evaluate(\"undefined\")",
+ "engine->evaluate(\"null\")",
+ "engine->evaluate(\"true\")",
+ "engine->evaluate(\"false\")",
+ "engine->evaluate(\"122\")",
+ "engine->evaluate(\"124\")",
+ "engine->evaluate(\"0\")",
+ "engine->evaluate(\"0.0\")",
+ "engine->evaluate(\"123.0\")",
+ "engine->evaluate(\"6.37e-8\")",
+ "engine->evaluate(\"-6.37e-8\")",
+ "engine->evaluate(\"0x43211234\")",
+ "engine->evaluate(\"0x10000\")",
+ "engine->evaluate(\"0x10001\")",
+ "engine->evaluate(\"NaN\")",
+ "engine->evaluate(\"Infinity\")",
+ "engine->evaluate(\"-Infinity\")",
+ "engine->evaluate(\"'ciao'\")",
+ "engine->evaluate(\"''\")",
+ "engine->evaluate(\"'0'\")",
+ "engine->evaluate(\"'123'\")",
+ "engine->evaluate(\"'12.4'\")",
+ "engine->nullValue()",
+ "engine->undefinedValue()",
+ "engine->newObject()",
+ "engine->newArray()",
+ "engine->newArray(10)"};
+
+static const QString toString_valueArray[] = {
+ "", "undefined",
+ "null", "true",
+ "false", "122",
+ "124", "0",
+ "0", "123",
+ "6.37e-8", "-6.37e-8",
+ "1126240820", "65536",
+ "65537", "NaN",
+ "NaN", "Infinity",
+ "-Infinity", "NaN",
+ "Infinity", "-Infinity",
+ "ciao", "ciao",
+ "", "",
+ "0", "123",
+ "12.4", "undefined",
+ "null", "true",
+ "false", "122",
+ "124", "0",
+ "0", "123",
+ "6.37e-8", "-6.37e-8",
+ "1126240820", "65536",
+ "65537", "NaN",
+ "NaN", "Infinity",
+ "-Infinity", "NaN",
+ "Infinity", "-Infinity",
+ "ciao", "ciao",
+ "", "",
+ "0", "123",
+ "12.3", "undefined",
+ "null", "true",
+ "false", "122",
+ "124", "0",
+ "0", "123",
+ "6.37e-8", "-6.37e-8",
+ "1126240820", "65536",
+ "65537", "NaN",
+ "NaN", "Infinity",
+ "-Infinity", "NaN",
+ "Infinity", "-Infinity",
+ "ciao", "ciao",
+ "", "",
+ "0", "123",
+ "1.23", "",
+ "undefined", "[object Object]",
+ "Invalid Date", "",
+ "function () {\n [native code]\n}", "Error: Unknown error",
+ "function Object() {\n [native code]\n}", "function Array() {\n [native code]\n}",
+ "function Number() {\n [native code]\n}", "function Function() {\n [native code]\n}",
+ "function () { return 1; }", "function () { return 'ciao'; }",
+ "function () { throw new Error('foo'); }", "/foo/",
+ "[object Object]", "",
+ "Error: Unknown error", "22",
+ "ReferenceError: Can't find variable: Undefined", "ReferenceError: Can't find variable: Null",
+ "ReferenceError: Can't find variable: True", "ReferenceError: Can't find variable: False",
+ "undefined", "null",
+ "true", "false",
+ "122", "124",
+ "0", "0",
+ "123", "6.37e-8",
+ "-6.37e-8", "1126240820",
+ "65536", "65537",
+ "NaN", "Infinity",
+ "-Infinity", "ciao",
+ "", "0",
+ "123", "12.4",
+ "null", "undefined",
+ "[object Object]", "",
+ ",,,,,,,,,"};
+
+void tst_QScriptValue::toString_data()
+{
+ QTest::addColumn<QScriptValue>("value");
+ QTest::addColumn<QString>("expected");
+ if (m_engine)
+ delete m_engine;
+ m_engine = new QScriptEngine();
+ QHash<QString, QString> expectedValue;
+ expectedValue.reserve(135);
+ for (uint i = 0; i < 135; ++i)
+ expectedValue.insert(toString_tagArray[i], toString_valueArray[i]);
+ for (uint i = 0; i < 135; ++i) {
+ QPair<QString, QScriptValue> testcase = initScriptValues(i);
+ QTest::newRow(testcase.first.toAscii().constData()) << testcase.second << expectedValue[testcase.first];
+ }
+}
+
+void tst_QScriptValue::toString()
+{
+ QFETCH(QScriptValue, value);
+ QFETCH(QString, expected);
+ QCOMPARE(value.toString(), expected);
+ QCOMPARE(value.toString(), expected);
+}
+
+static const QString toNumber_tagArray[] = {
+ "QScriptValue()",
+ "QScriptValue(QScriptValue::UndefinedValue)",
+ "QScriptValue(QScriptValue::NullValue)",
+ "QScriptValue(true)",
+ "QScriptValue(false)",
+ "QScriptValue(int(122))",
+ "QScriptValue(uint(124))",
+ "QScriptValue(0)",
+ "QScriptValue(0.0)",
+ "QScriptValue(123.0)",
+ "QScriptValue(6.37e-8)",
+ "QScriptValue(-6.37e-8)",
+ "QScriptValue(0x43211234)",
+ "QScriptValue(0x10000)",
+ "QScriptValue(0x10001)",
+ "QScriptValue(qSNaN())",
+ "QScriptValue(qQNaN())",
+ "QScriptValue(qInf())",
+ "QScriptValue(-qInf())",
+ "QScriptValue(\"NaN\")",
+ "QScriptValue(\"Infinity\")",
+ "QScriptValue(\"-Infinity\")",
+ "QScriptValue(\"ciao\")",
+ "QScriptValue(QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(QString(\"\"))",
+ "QScriptValue(QString())",
+ "QScriptValue(QString(\"0\"))",
+ "QScriptValue(QString(\"123\"))",
+ "QScriptValue(QString(\"12.4\"))",
+ "QScriptValue(0, QScriptValue::UndefinedValue)",
+ "QScriptValue(0, QScriptValue::NullValue)",
+ "QScriptValue(0, true)",
+ "QScriptValue(0, false)",
+ "QScriptValue(0, int(122))",
+ "QScriptValue(0, uint(124))",
+ "QScriptValue(0, 0)",
+ "QScriptValue(0, 0.0)",
+ "QScriptValue(0, 123.0)",
+ "QScriptValue(0, 6.37e-8)",
+ "QScriptValue(0, -6.37e-8)",
+ "QScriptValue(0, 0x43211234)",
+ "QScriptValue(0, 0x10000)",
+ "QScriptValue(0, 0x10001)",
+ "QScriptValue(0, qSNaN())",
+ "QScriptValue(0, qQNaN())",
+ "QScriptValue(0, qInf())",
+ "QScriptValue(0, -qInf())",
+ "QScriptValue(0, \"NaN\")",
+ "QScriptValue(0, \"Infinity\")",
+ "QScriptValue(0, \"-Infinity\")",
+ "QScriptValue(0, \"ciao\")",
+ "QScriptValue(0, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(0, QString(\"\"))",
+ "QScriptValue(0, QString())",
+ "QScriptValue(0, QString(\"0\"))",
+ "QScriptValue(0, QString(\"123\"))",
+ "QScriptValue(0, QString(\"12.3\"))",
+ "QScriptValue(engine, QScriptValue::UndefinedValue)",
+ "QScriptValue(engine, QScriptValue::NullValue)",
+ "QScriptValue(engine, true)",
+ "QScriptValue(engine, false)",
+ "QScriptValue(engine, int(122))",
+ "QScriptValue(engine, uint(124))",
+ "QScriptValue(engine, 0)",
+ "QScriptValue(engine, 0.0)",
+ "QScriptValue(engine, 123.0)",
+ "QScriptValue(engine, 6.37e-8)",
+ "QScriptValue(engine, -6.37e-8)",
+ "QScriptValue(engine, 0x43211234)",
+ "QScriptValue(engine, 0x10000)",
+ "QScriptValue(engine, 0x10001)",
+ "QScriptValue(engine, qSNaN())",
+ "QScriptValue(engine, qQNaN())",
+ "QScriptValue(engine, qInf())",
+ "QScriptValue(engine, -qInf())",
+ "QScriptValue(engine, \"NaN\")",
+ "QScriptValue(engine, \"Infinity\")",
+ "QScriptValue(engine, \"-Infinity\")",
+ "QScriptValue(engine, \"ciao\")",
+ "QScriptValue(engine, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(engine, QString(\"\"))",
+ "QScriptValue(engine, QString())",
+ "QScriptValue(engine, QString(\"0\"))",
+ "QScriptValue(engine, QString(\"123\"))",
+ "QScriptValue(engine, QString(\"1.23\"))",
+ "engine->evaluate(\"[]\")",
+ "engine->evaluate(\"{}\")",
+ "engine->evaluate(\"Object.prototype\")",
+ "engine->evaluate(\"Date.prototype\")",
+ "engine->evaluate(\"Array.prototype\")",
+ "engine->evaluate(\"Function.prototype\")",
+ "engine->evaluate(\"Error.prototype\")",
+ "engine->evaluate(\"Object\")",
+ "engine->evaluate(\"Array\")",
+ "engine->evaluate(\"Number\")",
+ "engine->evaluate(\"Function\")",
+ "engine->evaluate(\"(function() { return 1; })\")",
+ "engine->evaluate(\"(function() { return 'ciao'; })\")",
+ "engine->evaluate(\"(function() { throw new Error('foo'); })\")",
+ "engine->evaluate(\"/foo/\")",
+ "engine->evaluate(\"new Object()\")",
+ "engine->evaluate(\"new Array()\")",
+ "engine->evaluate(\"new Error()\")",
+ "engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")",
+ "engine->evaluate(\"Undefined\")",
+ "engine->evaluate(\"Null\")",
+ "engine->evaluate(\"True\")",
+ "engine->evaluate(\"False\")",
+ "engine->evaluate(\"undefined\")",
+ "engine->evaluate(\"null\")",
+ "engine->evaluate(\"true\")",
+ "engine->evaluate(\"false\")",
+ "engine->evaluate(\"122\")",
+ "engine->evaluate(\"124\")",
+ "engine->evaluate(\"0\")",
+ "engine->evaluate(\"0.0\")",
+ "engine->evaluate(\"123.0\")",
+ "engine->evaluate(\"6.37e-8\")",
+ "engine->evaluate(\"-6.37e-8\")",
+ "engine->evaluate(\"0x43211234\")",
+ "engine->evaluate(\"0x10000\")",
+ "engine->evaluate(\"0x10001\")",
+ "engine->evaluate(\"NaN\")",
+ "engine->evaluate(\"Infinity\")",
+ "engine->evaluate(\"-Infinity\")",
+ "engine->evaluate(\"'ciao'\")",
+ "engine->evaluate(\"''\")",
+ "engine->evaluate(\"'0'\")",
+ "engine->evaluate(\"'123'\")",
+ "engine->evaluate(\"'12.4'\")",
+ "engine->nullValue()",
+ "engine->undefinedValue()",
+ "engine->newObject()",
+ "engine->newArray()",
+ "engine->newArray(10)"};
+
+static const qsreal toNumber_valueArray[] = {
+ 0, qQNaN(), 0, 1, 0, 122, 124, 0, 0, 123,
+ 6.369999999999999e-08, -6.369999999999999e-08, 1126240820, 65536, 65537, qQNaN(), qQNaN(), qInf(), qInf(), qQNaN(),
+ qInf(), qInf(), qQNaN(), qQNaN(), 0, 0, 0, 123, 12.4, qQNaN(),
+ 0, 1, 0, 122, 124, 0, 0, 123, 6.369999999999999e-08, -6.369999999999999e-08,
+ 1126240820, 65536, 65537, qQNaN(), qQNaN(), qInf(), qInf(), qQNaN(), qInf(), qInf(),
+ qQNaN(), qQNaN(), 0, 0, 0, 123, 12.3, qQNaN(), 0, 1,
+ 0, 122, 124, 0, 0, 123, 6.369999999999999e-08, -6.369999999999999e-08, 1126240820, 65536,
+ 65537, qQNaN(), qQNaN(), qInf(), qInf(), qQNaN(), qInf(), qInf(), qQNaN(), qQNaN(),
+ 0, 0, 0, 123, 1.23, 0, qQNaN(), qQNaN(), qQNaN(), 0,
+ qQNaN(), qQNaN(), qQNaN(), qQNaN(), qQNaN(), qQNaN(), qQNaN(), qQNaN(), qQNaN(), qQNaN(),
+ qQNaN(), 0, qQNaN(), 22, qQNaN(), qQNaN(), qQNaN(), qQNaN(), qQNaN(), 0,
+ 1, 0, 122, 124, 0, 0, 123, 6.369999999999999e-08, -6.369999999999999e-08, 1126240820,
+ 65536, 65537, qQNaN(), qInf(), qInf(), qQNaN(), 0, 0, 123, 12.4,
+ 0, qQNaN(), qQNaN(), 0, qQNaN()};
+
+void tst_QScriptValue::toNumber_data()
+{
+ QTest::addColumn<QScriptValue>("value");
+ QTest::addColumn<qsreal>("expected");
+ if (m_engine)
+ delete m_engine;
+ m_engine = new QScriptEngine();
+ QHash<QString, qsreal> expectedValue;
+ expectedValue.reserve(135);
+ for (uint i = 0; i < 135; ++i)
+ expectedValue.insert(toNumber_tagArray[i], toNumber_valueArray[i]);
+ for (uint i = 0; i < 135; ++i) {
+ QPair<QString, QScriptValue> testcase = initScriptValues(i);
+ QTest::newRow(testcase.first.toAscii().constData()) << testcase.second << expectedValue[testcase.first];
+ }
+}
+
+void tst_QScriptValue::toNumber()
+{
+ QFETCH(QScriptValue, value);
+ QFETCH(qsreal, expected);
+ if (qIsNaN(expected)) {
+ QVERIFY(qIsNaN(value.toNumber()));
+ return;
+ }
+ if (qIsInf(expected)) {
+ QVERIFY(qIsInf(value.toNumber()));
+ QVERIFY(qIsInf(value.toNumber()));
+ return;
+ }
+ QCOMPARE(value.toNumber(), expected);
+ QCOMPARE(value.toNumber(), expected);
+}
+
+static const QString toBool_tagArray[] = {
+ "QScriptValue()",
+ "QScriptValue(QScriptValue::UndefinedValue)",
+ "QScriptValue(QScriptValue::NullValue)",
+ "QScriptValue(true)",
+ "QScriptValue(false)",
+ "QScriptValue(int(122))",
+ "QScriptValue(uint(124))",
+ "QScriptValue(0)",
+ "QScriptValue(0.0)",
+ "QScriptValue(123.0)",
+ "QScriptValue(6.37e-8)",
+ "QScriptValue(-6.37e-8)",
+ "QScriptValue(0x43211234)",
+ "QScriptValue(0x10000)",
+ "QScriptValue(0x10001)",
+ "QScriptValue(qSNaN())",
+ "QScriptValue(qQNaN())",
+ "QScriptValue(qInf())",
+ "QScriptValue(-qInf())",
+ "QScriptValue(\"NaN\")",
+ "QScriptValue(\"Infinity\")",
+ "QScriptValue(\"-Infinity\")",
+ "QScriptValue(\"ciao\")",
+ "QScriptValue(QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(QString(\"\"))",
+ "QScriptValue(QString())",
+ "QScriptValue(QString(\"0\"))",
+ "QScriptValue(QString(\"123\"))",
+ "QScriptValue(QString(\"12.4\"))",
+ "QScriptValue(0, QScriptValue::UndefinedValue)",
+ "QScriptValue(0, QScriptValue::NullValue)",
+ "QScriptValue(0, true)",
+ "QScriptValue(0, false)",
+ "QScriptValue(0, int(122))",
+ "QScriptValue(0, uint(124))",
+ "QScriptValue(0, 0)",
+ "QScriptValue(0, 0.0)",
+ "QScriptValue(0, 123.0)",
+ "QScriptValue(0, 6.37e-8)",
+ "QScriptValue(0, -6.37e-8)",
+ "QScriptValue(0, 0x43211234)",
+ "QScriptValue(0, 0x10000)",
+ "QScriptValue(0, 0x10001)",
+ "QScriptValue(0, qSNaN())",
+ "QScriptValue(0, qQNaN())",
+ "QScriptValue(0, qInf())",
+ "QScriptValue(0, -qInf())",
+ "QScriptValue(0, \"NaN\")",
+ "QScriptValue(0, \"Infinity\")",
+ "QScriptValue(0, \"-Infinity\")",
+ "QScriptValue(0, \"ciao\")",
+ "QScriptValue(0, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(0, QString(\"\"))",
+ "QScriptValue(0, QString())",
+ "QScriptValue(0, QString(\"0\"))",
+ "QScriptValue(0, QString(\"123\"))",
+ "QScriptValue(0, QString(\"12.3\"))",
+ "QScriptValue(engine, QScriptValue::UndefinedValue)",
+ "QScriptValue(engine, QScriptValue::NullValue)",
+ "QScriptValue(engine, true)",
+ "QScriptValue(engine, false)",
+ "QScriptValue(engine, int(122))",
+ "QScriptValue(engine, uint(124))",
+ "QScriptValue(engine, 0)",
+ "QScriptValue(engine, 0.0)",
+ "QScriptValue(engine, 123.0)",
+ "QScriptValue(engine, 6.37e-8)",
+ "QScriptValue(engine, -6.37e-8)",
+ "QScriptValue(engine, 0x43211234)",
+ "QScriptValue(engine, 0x10000)",
+ "QScriptValue(engine, 0x10001)",
+ "QScriptValue(engine, qSNaN())",
+ "QScriptValue(engine, qQNaN())",
+ "QScriptValue(engine, qInf())",
+ "QScriptValue(engine, -qInf())",
+ "QScriptValue(engine, \"NaN\")",
+ "QScriptValue(engine, \"Infinity\")",
+ "QScriptValue(engine, \"-Infinity\")",
+ "QScriptValue(engine, \"ciao\")",
+ "QScriptValue(engine, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(engine, QString(\"\"))",
+ "QScriptValue(engine, QString())",
+ "QScriptValue(engine, QString(\"0\"))",
+ "QScriptValue(engine, QString(\"123\"))",
+ "QScriptValue(engine, QString(\"1.23\"))",
+ "engine->evaluate(\"[]\")",
+ "engine->evaluate(\"{}\")",
+ "engine->evaluate(\"Object.prototype\")",
+ "engine->evaluate(\"Date.prototype\")",
+ "engine->evaluate(\"Array.prototype\")",
+ "engine->evaluate(\"Function.prototype\")",
+ "engine->evaluate(\"Error.prototype\")",
+ "engine->evaluate(\"Object\")",
+ "engine->evaluate(\"Array\")",
+ "engine->evaluate(\"Number\")",
+ "engine->evaluate(\"Function\")",
+ "engine->evaluate(\"(function() { return 1; })\")",
+ "engine->evaluate(\"(function() { return 'ciao'; })\")",
+ "engine->evaluate(\"(function() { throw new Error('foo'); })\")",
+ "engine->evaluate(\"/foo/\")",
+ "engine->evaluate(\"new Object()\")",
+ "engine->evaluate(\"new Array()\")",
+ "engine->evaluate(\"new Error()\")",
+ "engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")",
+ "engine->evaluate(\"Undefined\")",
+ "engine->evaluate(\"Null\")",
+ "engine->evaluate(\"True\")",
+ "engine->evaluate(\"False\")",
+ "engine->evaluate(\"undefined\")",
+ "engine->evaluate(\"null\")",
+ "engine->evaluate(\"true\")",
+ "engine->evaluate(\"false\")",
+ "engine->evaluate(\"122\")",
+ "engine->evaluate(\"124\")",
+ "engine->evaluate(\"0\")",
+ "engine->evaluate(\"0.0\")",
+ "engine->evaluate(\"123.0\")",
+ "engine->evaluate(\"6.37e-8\")",
+ "engine->evaluate(\"-6.37e-8\")",
+ "engine->evaluate(\"0x43211234\")",
+ "engine->evaluate(\"0x10000\")",
+ "engine->evaluate(\"0x10001\")",
+ "engine->evaluate(\"NaN\")",
+ "engine->evaluate(\"Infinity\")",
+ "engine->evaluate(\"-Infinity\")",
+ "engine->evaluate(\"'ciao'\")",
+ "engine->evaluate(\"''\")",
+ "engine->evaluate(\"'0'\")",
+ "engine->evaluate(\"'123'\")",
+ "engine->evaluate(\"'12.4'\")",
+ "engine->nullValue()",
+ "engine->undefinedValue()",
+ "engine->newObject()",
+ "engine->newArray()",
+ "engine->newArray(10)"};
+
+static const bool toBool_valueArray[] = {
+ false, false,
+ false, true,
+ false, true,
+ true, false,
+ false, true,
+ true, true,
+ true, true,
+ true, false,
+ false, true,
+ true, true,
+ true, true,
+ true, true,
+ false, false,
+ true, true,
+ true, false,
+ false, true,
+ false, true,
+ true, false,
+ false, true,
+ true, true,
+ true, true,
+ true, false,
+ false, true,
+ true, true,
+ true, true,
+ true, true,
+ false, false,
+ true, true,
+ true, false,
+ false, true,
+ false, true,
+ true, false,
+ false, true,
+ true, true,
+ true, true,
+ true, false,
+ false, true,
+ true, true,
+ true, true,
+ true, true,
+ false, false,
+ true, true,
+ true, true,
+ false, true,
+ true, true,
+ true, true,
+ true, true,
+ true, true,
+ true, true,
+ true, true,
+ true, true,
+ true, true,
+ true, true,
+ true, true,
+ false, false,
+ true, false,
+ true, true,
+ false, false,
+ true, true,
+ true, true,
+ true, true,
+ false, true,
+ true, true,
+ false, true,
+ true, true,
+ false, false,
+ true, true,
+ true};
+
+void tst_QScriptValue::toBool_data()
+{
+ QTest::addColumn<QScriptValue>("value");
+ QTest::addColumn<bool>("expected");
+ if (m_engine)
+ delete m_engine;
+ m_engine = new QScriptEngine();
+ QHash<QString, bool> expectedValue;
+ expectedValue.reserve(135);
+ for (uint i = 0; i < 135; ++i)
+ expectedValue.insert(toBool_tagArray[i], toBool_valueArray[i]);
+ for (uint i = 0; i < 135; ++i) {
+ QPair<QString, QScriptValue> testcase = initScriptValues(i);
+ QTest::newRow(testcase.first.toAscii().constData()) << testcase.second << expectedValue[testcase.first];
+ }
+}
+
+void tst_QScriptValue::toBool()
+{
+ QFETCH(QScriptValue, value);
+ QFETCH(bool, expected);
+ QCOMPARE(value.toBool(), expected);
+ QCOMPARE(value.toBool(), expected);
+}
+
+static const QString toBoolean_tagArray[] = {
+ "QScriptValue()",
+ "QScriptValue(QScriptValue::UndefinedValue)",
+ "QScriptValue(QScriptValue::NullValue)",
+ "QScriptValue(true)",
+ "QScriptValue(false)",
+ "QScriptValue(int(122))",
+ "QScriptValue(uint(124))",
+ "QScriptValue(0)",
+ "QScriptValue(0.0)",
+ "QScriptValue(123.0)",
+ "QScriptValue(6.37e-8)",
+ "QScriptValue(-6.37e-8)",
+ "QScriptValue(0x43211234)",
+ "QScriptValue(0x10000)",
+ "QScriptValue(0x10001)",
+ "QScriptValue(qSNaN())",
+ "QScriptValue(qQNaN())",
+ "QScriptValue(qInf())",
+ "QScriptValue(-qInf())",
+ "QScriptValue(\"NaN\")",
+ "QScriptValue(\"Infinity\")",
+ "QScriptValue(\"-Infinity\")",
+ "QScriptValue(\"ciao\")",
+ "QScriptValue(QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(QString(\"\"))",
+ "QScriptValue(QString())",
+ "QScriptValue(QString(\"0\"))",
+ "QScriptValue(QString(\"123\"))",
+ "QScriptValue(QString(\"12.4\"))",
+ "QScriptValue(0, QScriptValue::UndefinedValue)",
+ "QScriptValue(0, QScriptValue::NullValue)",
+ "QScriptValue(0, true)",
+ "QScriptValue(0, false)",
+ "QScriptValue(0, int(122))",
+ "QScriptValue(0, uint(124))",
+ "QScriptValue(0, 0)",
+ "QScriptValue(0, 0.0)",
+ "QScriptValue(0, 123.0)",
+ "QScriptValue(0, 6.37e-8)",
+ "QScriptValue(0, -6.37e-8)",
+ "QScriptValue(0, 0x43211234)",
+ "QScriptValue(0, 0x10000)",
+ "QScriptValue(0, 0x10001)",
+ "QScriptValue(0, qSNaN())",
+ "QScriptValue(0, qQNaN())",
+ "QScriptValue(0, qInf())",
+ "QScriptValue(0, -qInf())",
+ "QScriptValue(0, \"NaN\")",
+ "QScriptValue(0, \"Infinity\")",
+ "QScriptValue(0, \"-Infinity\")",
+ "QScriptValue(0, \"ciao\")",
+ "QScriptValue(0, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(0, QString(\"\"))",
+ "QScriptValue(0, QString())",
+ "QScriptValue(0, QString(\"0\"))",
+ "QScriptValue(0, QString(\"123\"))",
+ "QScriptValue(0, QString(\"12.3\"))",
+ "QScriptValue(engine, QScriptValue::UndefinedValue)",
+ "QScriptValue(engine, QScriptValue::NullValue)",
+ "QScriptValue(engine, true)",
+ "QScriptValue(engine, false)",
+ "QScriptValue(engine, int(122))",
+ "QScriptValue(engine, uint(124))",
+ "QScriptValue(engine, 0)",
+ "QScriptValue(engine, 0.0)",
+ "QScriptValue(engine, 123.0)",
+ "QScriptValue(engine, 6.37e-8)",
+ "QScriptValue(engine, -6.37e-8)",
+ "QScriptValue(engine, 0x43211234)",
+ "QScriptValue(engine, 0x10000)",
+ "QScriptValue(engine, 0x10001)",
+ "QScriptValue(engine, qSNaN())",
+ "QScriptValue(engine, qQNaN())",
+ "QScriptValue(engine, qInf())",
+ "QScriptValue(engine, -qInf())",
+ "QScriptValue(engine, \"NaN\")",
+ "QScriptValue(engine, \"Infinity\")",
+ "QScriptValue(engine, \"-Infinity\")",
+ "QScriptValue(engine, \"ciao\")",
+ "QScriptValue(engine, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(engine, QString(\"\"))",
+ "QScriptValue(engine, QString())",
+ "QScriptValue(engine, QString(\"0\"))",
+ "QScriptValue(engine, QString(\"123\"))",
+ "QScriptValue(engine, QString(\"1.23\"))",
+ "engine->evaluate(\"[]\")",
+ "engine->evaluate(\"{}\")",
+ "engine->evaluate(\"Object.prototype\")",
+ "engine->evaluate(\"Date.prototype\")",
+ "engine->evaluate(\"Array.prototype\")",
+ "engine->evaluate(\"Function.prototype\")",
+ "engine->evaluate(\"Error.prototype\")",
+ "engine->evaluate(\"Object\")",
+ "engine->evaluate(\"Array\")",
+ "engine->evaluate(\"Number\")",
+ "engine->evaluate(\"Function\")",
+ "engine->evaluate(\"(function() { return 1; })\")",
+ "engine->evaluate(\"(function() { return 'ciao'; })\")",
+ "engine->evaluate(\"(function() { throw new Error('foo'); })\")",
+ "engine->evaluate(\"/foo/\")",
+ "engine->evaluate(\"new Object()\")",
+ "engine->evaluate(\"new Array()\")",
+ "engine->evaluate(\"new Error()\")",
+ "engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")",
+ "engine->evaluate(\"Undefined\")",
+ "engine->evaluate(\"Null\")",
+ "engine->evaluate(\"True\")",
+ "engine->evaluate(\"False\")",
+ "engine->evaluate(\"undefined\")",
+ "engine->evaluate(\"null\")",
+ "engine->evaluate(\"true\")",
+ "engine->evaluate(\"false\")",
+ "engine->evaluate(\"122\")",
+ "engine->evaluate(\"124\")",
+ "engine->evaluate(\"0\")",
+ "engine->evaluate(\"0.0\")",
+ "engine->evaluate(\"123.0\")",
+ "engine->evaluate(\"6.37e-8\")",
+ "engine->evaluate(\"-6.37e-8\")",
+ "engine->evaluate(\"0x43211234\")",
+ "engine->evaluate(\"0x10000\")",
+ "engine->evaluate(\"0x10001\")",
+ "engine->evaluate(\"NaN\")",
+ "engine->evaluate(\"Infinity\")",
+ "engine->evaluate(\"-Infinity\")",
+ "engine->evaluate(\"'ciao'\")",
+ "engine->evaluate(\"''\")",
+ "engine->evaluate(\"'0'\")",
+ "engine->evaluate(\"'123'\")",
+ "engine->evaluate(\"'12.4'\")",
+ "engine->nullValue()",
+ "engine->undefinedValue()",
+ "engine->newObject()",
+ "engine->newArray()",
+ "engine->newArray(10)"};
+
+static const bool toBoolean_valueArray[] = {
+ false, false,
+ false, true,
+ false, true,
+ true, false,
+ false, true,
+ true, true,
+ true, true,
+ true, false,
+ false, true,
+ true, true,
+ true, true,
+ true, true,
+ false, false,
+ true, true,
+ true, false,
+ false, true,
+ false, true,
+ true, false,
+ false, true,
+ true, true,
+ true, true,
+ true, false,
+ false, true,
+ true, true,
+ true, true,
+ true, true,
+ false, false,
+ true, true,
+ true, false,
+ false, true,
+ false, true,
+ true, false,
+ false, true,
+ true, true,
+ true, true,
+ true, false,
+ false, true,
+ true, true,
+ true, true,
+ true, true,
+ false, false,
+ true, true,
+ true, true,
+ false, true,
+ true, true,
+ true, true,
+ true, true,
+ true, true,
+ true, true,
+ true, true,
+ true, true,
+ true, true,
+ true, true,
+ true, true,
+ false, false,
+ true, false,
+ true, true,
+ false, false,
+ true, true,
+ true, true,
+ true, true,
+ false, true,
+ true, true,
+ false, true,
+ true, true,
+ false, false,
+ true, true,
+ true};
+
+void tst_QScriptValue::toBoolean_data()
+{
+ QTest::addColumn<QScriptValue>("value");
+ QTest::addColumn<bool>("expected");
+ if (m_engine)
+ delete m_engine;
+ m_engine = new QScriptEngine();
+ QHash<QString, bool> expectedValue;
+ expectedValue.reserve(135);
+ for (uint i = 0; i < 135; ++i)
+ expectedValue.insert(toBoolean_tagArray[i], toBoolean_valueArray[i]);
+ for (uint i = 0; i < 135; ++i) {
+ QPair<QString, QScriptValue> testcase = initScriptValues(i);
+ QTest::newRow(testcase.first.toAscii().constData()) << testcase.second << expectedValue[testcase.first];
+ }
+}
+
+void tst_QScriptValue::toBoolean()
+{
+ QFETCH(QScriptValue, value);
+ QFETCH(bool, expected);
+ QCOMPARE(value.toBoolean(), expected);
+ QCOMPARE(value.toBoolean(), expected);
+}
+
+static const QString toInteger_tagArray[] = {
+ "QScriptValue()",
+ "QScriptValue(QScriptValue::UndefinedValue)",
+ "QScriptValue(QScriptValue::NullValue)",
+ "QScriptValue(true)",
+ "QScriptValue(false)",
+ "QScriptValue(int(122))",
+ "QScriptValue(uint(124))",
+ "QScriptValue(0)",
+ "QScriptValue(0.0)",
+ "QScriptValue(123.0)",
+ "QScriptValue(6.37e-8)",
+ "QScriptValue(-6.37e-8)",
+ "QScriptValue(0x43211234)",
+ "QScriptValue(0x10000)",
+ "QScriptValue(0x10001)",
+ "QScriptValue(qSNaN())",
+ "QScriptValue(qQNaN())",
+ "QScriptValue(qInf())",
+ "QScriptValue(-qInf())",
+ "QScriptValue(\"NaN\")",
+ "QScriptValue(\"Infinity\")",
+ "QScriptValue(\"-Infinity\")",
+ "QScriptValue(\"ciao\")",
+ "QScriptValue(QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(QString(\"\"))",
+ "QScriptValue(QString())",
+ "QScriptValue(QString(\"0\"))",
+ "QScriptValue(QString(\"123\"))",
+ "QScriptValue(QString(\"12.4\"))",
+ "QScriptValue(0, QScriptValue::UndefinedValue)",
+ "QScriptValue(0, QScriptValue::NullValue)",
+ "QScriptValue(0, true)",
+ "QScriptValue(0, false)",
+ "QScriptValue(0, int(122))",
+ "QScriptValue(0, uint(124))",
+ "QScriptValue(0, 0)",
+ "QScriptValue(0, 0.0)",
+ "QScriptValue(0, 123.0)",
+ "QScriptValue(0, 6.37e-8)",
+ "QScriptValue(0, -6.37e-8)",
+ "QScriptValue(0, 0x43211234)",
+ "QScriptValue(0, 0x10000)",
+ "QScriptValue(0, 0x10001)",
+ "QScriptValue(0, qSNaN())",
+ "QScriptValue(0, qQNaN())",
+ "QScriptValue(0, qInf())",
+ "QScriptValue(0, -qInf())",
+ "QScriptValue(0, \"NaN\")",
+ "QScriptValue(0, \"Infinity\")",
+ "QScriptValue(0, \"-Infinity\")",
+ "QScriptValue(0, \"ciao\")",
+ "QScriptValue(0, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(0, QString(\"\"))",
+ "QScriptValue(0, QString())",
+ "QScriptValue(0, QString(\"0\"))",
+ "QScriptValue(0, QString(\"123\"))",
+ "QScriptValue(0, QString(\"12.3\"))",
+ "QScriptValue(engine, QScriptValue::UndefinedValue)",
+ "QScriptValue(engine, QScriptValue::NullValue)",
+ "QScriptValue(engine, true)",
+ "QScriptValue(engine, false)",
+ "QScriptValue(engine, int(122))",
+ "QScriptValue(engine, uint(124))",
+ "QScriptValue(engine, 0)",
+ "QScriptValue(engine, 0.0)",
+ "QScriptValue(engine, 123.0)",
+ "QScriptValue(engine, 6.37e-8)",
+ "QScriptValue(engine, -6.37e-8)",
+ "QScriptValue(engine, 0x43211234)",
+ "QScriptValue(engine, 0x10000)",
+ "QScriptValue(engine, 0x10001)",
+ "QScriptValue(engine, qSNaN())",
+ "QScriptValue(engine, qQNaN())",
+ "QScriptValue(engine, qInf())",
+ "QScriptValue(engine, -qInf())",
+ "QScriptValue(engine, \"NaN\")",
+ "QScriptValue(engine, \"Infinity\")",
+ "QScriptValue(engine, \"-Infinity\")",
+ "QScriptValue(engine, \"ciao\")",
+ "QScriptValue(engine, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(engine, QString(\"\"))",
+ "QScriptValue(engine, QString())",
+ "QScriptValue(engine, QString(\"0\"))",
+ "QScriptValue(engine, QString(\"123\"))",
+ "QScriptValue(engine, QString(\"1.23\"))",
+ "engine->evaluate(\"[]\")",
+ "engine->evaluate(\"{}\")",
+ "engine->evaluate(\"Object.prototype\")",
+ "engine->evaluate(\"Date.prototype\")",
+ "engine->evaluate(\"Array.prototype\")",
+ "engine->evaluate(\"Function.prototype\")",
+ "engine->evaluate(\"Error.prototype\")",
+ "engine->evaluate(\"Object\")",
+ "engine->evaluate(\"Array\")",
+ "engine->evaluate(\"Number\")",
+ "engine->evaluate(\"Function\")",
+ "engine->evaluate(\"(function() { return 1; })\")",
+ "engine->evaluate(\"(function() { return 'ciao'; })\")",
+ "engine->evaluate(\"(function() { throw new Error('foo'); })\")",
+ "engine->evaluate(\"/foo/\")",
+ "engine->evaluate(\"new Object()\")",
+ "engine->evaluate(\"new Array()\")",
+ "engine->evaluate(\"new Error()\")",
+ "engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")",
+ "engine->evaluate(\"Undefined\")",
+ "engine->evaluate(\"Null\")",
+ "engine->evaluate(\"True\")",
+ "engine->evaluate(\"False\")",
+ "engine->evaluate(\"undefined\")",
+ "engine->evaluate(\"null\")",
+ "engine->evaluate(\"true\")",
+ "engine->evaluate(\"false\")",
+ "engine->evaluate(\"122\")",
+ "engine->evaluate(\"124\")",
+ "engine->evaluate(\"0\")",
+ "engine->evaluate(\"0.0\")",
+ "engine->evaluate(\"123.0\")",
+ "engine->evaluate(\"6.37e-8\")",
+ "engine->evaluate(\"-6.37e-8\")",
+ "engine->evaluate(\"0x43211234\")",
+ "engine->evaluate(\"0x10000\")",
+ "engine->evaluate(\"0x10001\")",
+ "engine->evaluate(\"NaN\")",
+ "engine->evaluate(\"Infinity\")",
+ "engine->evaluate(\"-Infinity\")",
+ "engine->evaluate(\"'ciao'\")",
+ "engine->evaluate(\"''\")",
+ "engine->evaluate(\"'0'\")",
+ "engine->evaluate(\"'123'\")",
+ "engine->evaluate(\"'12.4'\")",
+ "engine->nullValue()",
+ "engine->undefinedValue()",
+ "engine->newObject()",
+ "engine->newArray()",
+ "engine->newArray(10)"};
+
+static const qsreal toInteger_valueArray[] = {
+ 0, 0, 0, 1, 0, 122, 124, 0, 0, 123,
+ 0, 0, 1126240820, 65536, 65537, 0, 0, qInf(), qInf(), 0,
+ qInf(), qInf(), 0, 0, 0, 0, 0, 123, 12, 0,
+ 0, 1, 0, 122, 124, 0, 0, 123, 0, 0,
+ 1126240820, 65536, 65537, 0, 0, qInf(), qInf(), 0, qInf(), qInf(),
+ 0, 0, 0, 0, 0, 123, 12, 0, 0, 1,
+ 0, 122, 124, 0, 0, 123, 0, 0, 1126240820, 65536,
+ 65537, 0, 0, qInf(), qInf(), 0, qInf(), qInf(), 0, 0,
+ 0, 0, 0, 123, 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 22, 0, 0, 0, 0, 0, 0,
+ 1, 0, 122, 124, 0, 0, 123, 0, 0, 1126240820,
+ 65536, 65537, 0, qInf(), qInf(), 0, 0, 0, 123, 12,
+ 0, 0, 0, 0, 0};
+
+void tst_QScriptValue::toInteger_data()
+{
+ QTest::addColumn<QScriptValue>("value");
+ QTest::addColumn<qsreal>("expected");
+ if (m_engine)
+ delete m_engine;
+ m_engine = new QScriptEngine();
+ QHash<QString, qsreal> expectedValue;
+ expectedValue.reserve(135);
+ for (uint i = 0; i < 135; ++i)
+ expectedValue.insert(toInteger_tagArray[i], toInteger_valueArray[i]);
+ for (uint i = 0; i < 135; ++i) {
+ QPair<QString, QScriptValue> testcase = initScriptValues(i);
+ QTest::newRow(testcase.first.toAscii().constData()) << testcase.second << expectedValue[testcase.first];
+ }
+}
+
+void tst_QScriptValue::toInteger()
+{
+ QFETCH(QScriptValue, value);
+ QFETCH(qsreal, expected);
+ if (qIsInf(expected)) {
+ QVERIFY(qIsInf(value.toInteger()));
+ QVERIFY(qIsInf(value.toInteger()));
+ return;
+ }
+ QCOMPARE(value.toInteger(), expected);
+ QCOMPARE(value.toInteger(), expected);
+}
+
+static const QString toInt32_tagArray[] = {
+ "QScriptValue()",
+ "QScriptValue(QScriptValue::UndefinedValue)",
+ "QScriptValue(QScriptValue::NullValue)",
+ "QScriptValue(true)",
+ "QScriptValue(false)",
+ "QScriptValue(int(122))",
+ "QScriptValue(uint(124))",
+ "QScriptValue(0)",
+ "QScriptValue(0.0)",
+ "QScriptValue(123.0)",
+ "QScriptValue(6.37e-8)",
+ "QScriptValue(-6.37e-8)",
+ "QScriptValue(0x43211234)",
+ "QScriptValue(0x10000)",
+ "QScriptValue(0x10001)",
+ "QScriptValue(qSNaN())",
+ "QScriptValue(qQNaN())",
+ "QScriptValue(qInf())",
+ "QScriptValue(-qInf())",
+ "QScriptValue(\"NaN\")",
+ "QScriptValue(\"Infinity\")",
+ "QScriptValue(\"-Infinity\")",
+ "QScriptValue(\"ciao\")",
+ "QScriptValue(QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(QString(\"\"))",
+ "QScriptValue(QString())",
+ "QScriptValue(QString(\"0\"))",
+ "QScriptValue(QString(\"123\"))",
+ "QScriptValue(QString(\"12.4\"))",
+ "QScriptValue(0, QScriptValue::UndefinedValue)",
+ "QScriptValue(0, QScriptValue::NullValue)",
+ "QScriptValue(0, true)",
+ "QScriptValue(0, false)",
+ "QScriptValue(0, int(122))",
+ "QScriptValue(0, uint(124))",
+ "QScriptValue(0, 0)",
+ "QScriptValue(0, 0.0)",
+ "QScriptValue(0, 123.0)",
+ "QScriptValue(0, 6.37e-8)",
+ "QScriptValue(0, -6.37e-8)",
+ "QScriptValue(0, 0x43211234)",
+ "QScriptValue(0, 0x10000)",
+ "QScriptValue(0, 0x10001)",
+ "QScriptValue(0, qSNaN())",
+ "QScriptValue(0, qQNaN())",
+ "QScriptValue(0, qInf())",
+ "QScriptValue(0, -qInf())",
+ "QScriptValue(0, \"NaN\")",
+ "QScriptValue(0, \"Infinity\")",
+ "QScriptValue(0, \"-Infinity\")",
+ "QScriptValue(0, \"ciao\")",
+ "QScriptValue(0, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(0, QString(\"\"))",
+ "QScriptValue(0, QString())",
+ "QScriptValue(0, QString(\"0\"))",
+ "QScriptValue(0, QString(\"123\"))",
+ "QScriptValue(0, QString(\"12.3\"))",
+ "QScriptValue(engine, QScriptValue::UndefinedValue)",
+ "QScriptValue(engine, QScriptValue::NullValue)",
+ "QScriptValue(engine, true)",
+ "QScriptValue(engine, false)",
+ "QScriptValue(engine, int(122))",
+ "QScriptValue(engine, uint(124))",
+ "QScriptValue(engine, 0)",
+ "QScriptValue(engine, 0.0)",
+ "QScriptValue(engine, 123.0)",
+ "QScriptValue(engine, 6.37e-8)",
+ "QScriptValue(engine, -6.37e-8)",
+ "QScriptValue(engine, 0x43211234)",
+ "QScriptValue(engine, 0x10000)",
+ "QScriptValue(engine, 0x10001)",
+ "QScriptValue(engine, qSNaN())",
+ "QScriptValue(engine, qQNaN())",
+ "QScriptValue(engine, qInf())",
+ "QScriptValue(engine, -qInf())",
+ "QScriptValue(engine, \"NaN\")",
+ "QScriptValue(engine, \"Infinity\")",
+ "QScriptValue(engine, \"-Infinity\")",
+ "QScriptValue(engine, \"ciao\")",
+ "QScriptValue(engine, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(engine, QString(\"\"))",
+ "QScriptValue(engine, QString())",
+ "QScriptValue(engine, QString(\"0\"))",
+ "QScriptValue(engine, QString(\"123\"))",
+ "QScriptValue(engine, QString(\"1.23\"))",
+ "engine->evaluate(\"[]\")",
+ "engine->evaluate(\"{}\")",
+ "engine->evaluate(\"Object.prototype\")",
+ "engine->evaluate(\"Date.prototype\")",
+ "engine->evaluate(\"Array.prototype\")",
+ "engine->evaluate(\"Function.prototype\")",
+ "engine->evaluate(\"Error.prototype\")",
+ "engine->evaluate(\"Object\")",
+ "engine->evaluate(\"Array\")",
+ "engine->evaluate(\"Number\")",
+ "engine->evaluate(\"Function\")",
+ "engine->evaluate(\"(function() { return 1; })\")",
+ "engine->evaluate(\"(function() { return 'ciao'; })\")",
+ "engine->evaluate(\"(function() { throw new Error('foo'); })\")",
+ "engine->evaluate(\"/foo/\")",
+ "engine->evaluate(\"new Object()\")",
+ "engine->evaluate(\"new Array()\")",
+ "engine->evaluate(\"new Error()\")",
+ "engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")",
+ "engine->evaluate(\"Undefined\")",
+ "engine->evaluate(\"Null\")",
+ "engine->evaluate(\"True\")",
+ "engine->evaluate(\"False\")",
+ "engine->evaluate(\"undefined\")",
+ "engine->evaluate(\"null\")",
+ "engine->evaluate(\"true\")",
+ "engine->evaluate(\"false\")",
+ "engine->evaluate(\"122\")",
+ "engine->evaluate(\"124\")",
+ "engine->evaluate(\"0\")",
+ "engine->evaluate(\"0.0\")",
+ "engine->evaluate(\"123.0\")",
+ "engine->evaluate(\"6.37e-8\")",
+ "engine->evaluate(\"-6.37e-8\")",
+ "engine->evaluate(\"0x43211234\")",
+ "engine->evaluate(\"0x10000\")",
+ "engine->evaluate(\"0x10001\")",
+ "engine->evaluate(\"NaN\")",
+ "engine->evaluate(\"Infinity\")",
+ "engine->evaluate(\"-Infinity\")",
+ "engine->evaluate(\"'ciao'\")",
+ "engine->evaluate(\"''\")",
+ "engine->evaluate(\"'0'\")",
+ "engine->evaluate(\"'123'\")",
+ "engine->evaluate(\"'12.4'\")",
+ "engine->nullValue()",
+ "engine->undefinedValue()",
+ "engine->newObject()",
+ "engine->newArray()",
+ "engine->newArray(10)"};
+
+static const qint32 toInt32_valueArray[] = {
+ 0, 0,
+ 0, 1,
+ 0, 122,
+ 124, 0,
+ 0, 123,
+ 0, 0,
+ 1126240820, 65536,
+ 65537, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 123,
+ 12, 0,
+ 0, 1,
+ 0, 122,
+ 124, 0,
+ 0, 123,
+ 0, 0,
+ 1126240820, 65536,
+ 65537, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 123,
+ 12, 0,
+ 0, 1,
+ 0, 122,
+ 124, 0,
+ 0, 123,
+ 0, 0,
+ 1126240820, 65536,
+ 65537, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 123,
+ 1, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 22,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 1, 0,
+ 122, 124,
+ 0, 0,
+ 123, 0,
+ 0, 1126240820,
+ 65536, 65537,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 123, 12,
+ 0, 0,
+ 0, 0,
+ 0};
+
+void tst_QScriptValue::toInt32_data()
+{
+ QTest::addColumn<QScriptValue>("value");
+ QTest::addColumn<qint32>("expected");
+ if (m_engine)
+ delete m_engine;
+ m_engine = new QScriptEngine();
+ QHash<QString, qint32> expectedValue;
+ expectedValue.reserve(135);
+ for (uint i = 0; i < 135; ++i)
+ expectedValue.insert(toInt32_tagArray[i], toInt32_valueArray[i]);
+ for (uint i = 0; i < 135; ++i) {
+ QPair<QString, QScriptValue> testcase = initScriptValues(i);
+ QTest::newRow(testcase.first.toAscii().constData()) << testcase.second << expectedValue[testcase.first];
+ }
+}
+
+void tst_QScriptValue::toInt32()
+{
+ QFETCH(QScriptValue, value);
+ QFETCH(qint32, expected);
+ QCOMPARE(value.toInt32(), expected);
+ QCOMPARE(value.toInt32(), expected);
+}
+
+static const QString toUInt32_tagArray[] = {
+ "QScriptValue()",
+ "QScriptValue(QScriptValue::UndefinedValue)",
+ "QScriptValue(QScriptValue::NullValue)",
+ "QScriptValue(true)",
+ "QScriptValue(false)",
+ "QScriptValue(int(122))",
+ "QScriptValue(uint(124))",
+ "QScriptValue(0)",
+ "QScriptValue(0.0)",
+ "QScriptValue(123.0)",
+ "QScriptValue(6.37e-8)",
+ "QScriptValue(-6.37e-8)",
+ "QScriptValue(0x43211234)",
+ "QScriptValue(0x10000)",
+ "QScriptValue(0x10001)",
+ "QScriptValue(qSNaN())",
+ "QScriptValue(qQNaN())",
+ "QScriptValue(qInf())",
+ "QScriptValue(-qInf())",
+ "QScriptValue(\"NaN\")",
+ "QScriptValue(\"Infinity\")",
+ "QScriptValue(\"-Infinity\")",
+ "QScriptValue(\"ciao\")",
+ "QScriptValue(QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(QString(\"\"))",
+ "QScriptValue(QString())",
+ "QScriptValue(QString(\"0\"))",
+ "QScriptValue(QString(\"123\"))",
+ "QScriptValue(QString(\"12.4\"))",
+ "QScriptValue(0, QScriptValue::UndefinedValue)",
+ "QScriptValue(0, QScriptValue::NullValue)",
+ "QScriptValue(0, true)",
+ "QScriptValue(0, false)",
+ "QScriptValue(0, int(122))",
+ "QScriptValue(0, uint(124))",
+ "QScriptValue(0, 0)",
+ "QScriptValue(0, 0.0)",
+ "QScriptValue(0, 123.0)",
+ "QScriptValue(0, 6.37e-8)",
+ "QScriptValue(0, -6.37e-8)",
+ "QScriptValue(0, 0x43211234)",
+ "QScriptValue(0, 0x10000)",
+ "QScriptValue(0, 0x10001)",
+ "QScriptValue(0, qSNaN())",
+ "QScriptValue(0, qQNaN())",
+ "QScriptValue(0, qInf())",
+ "QScriptValue(0, -qInf())",
+ "QScriptValue(0, \"NaN\")",
+ "QScriptValue(0, \"Infinity\")",
+ "QScriptValue(0, \"-Infinity\")",
+ "QScriptValue(0, \"ciao\")",
+ "QScriptValue(0, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(0, QString(\"\"))",
+ "QScriptValue(0, QString())",
+ "QScriptValue(0, QString(\"0\"))",
+ "QScriptValue(0, QString(\"123\"))",
+ "QScriptValue(0, QString(\"12.3\"))",
+ "QScriptValue(engine, QScriptValue::UndefinedValue)",
+ "QScriptValue(engine, QScriptValue::NullValue)",
+ "QScriptValue(engine, true)",
+ "QScriptValue(engine, false)",
+ "QScriptValue(engine, int(122))",
+ "QScriptValue(engine, uint(124))",
+ "QScriptValue(engine, 0)",
+ "QScriptValue(engine, 0.0)",
+ "QScriptValue(engine, 123.0)",
+ "QScriptValue(engine, 6.37e-8)",
+ "QScriptValue(engine, -6.37e-8)",
+ "QScriptValue(engine, 0x43211234)",
+ "QScriptValue(engine, 0x10000)",
+ "QScriptValue(engine, 0x10001)",
+ "QScriptValue(engine, qSNaN())",
+ "QScriptValue(engine, qQNaN())",
+ "QScriptValue(engine, qInf())",
+ "QScriptValue(engine, -qInf())",
+ "QScriptValue(engine, \"NaN\")",
+ "QScriptValue(engine, \"Infinity\")",
+ "QScriptValue(engine, \"-Infinity\")",
+ "QScriptValue(engine, \"ciao\")",
+ "QScriptValue(engine, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(engine, QString(\"\"))",
+ "QScriptValue(engine, QString())",
+ "QScriptValue(engine, QString(\"0\"))",
+ "QScriptValue(engine, QString(\"123\"))",
+ "QScriptValue(engine, QString(\"1.23\"))",
+ "engine->evaluate(\"[]\")",
+ "engine->evaluate(\"{}\")",
+ "engine->evaluate(\"Object.prototype\")",
+ "engine->evaluate(\"Date.prototype\")",
+ "engine->evaluate(\"Array.prototype\")",
+ "engine->evaluate(\"Function.prototype\")",
+ "engine->evaluate(\"Error.prototype\")",
+ "engine->evaluate(\"Object\")",
+ "engine->evaluate(\"Array\")",
+ "engine->evaluate(\"Number\")",
+ "engine->evaluate(\"Function\")",
+ "engine->evaluate(\"(function() { return 1; })\")",
+ "engine->evaluate(\"(function() { return 'ciao'; })\")",
+ "engine->evaluate(\"(function() { throw new Error('foo'); })\")",
+ "engine->evaluate(\"/foo/\")",
+ "engine->evaluate(\"new Object()\")",
+ "engine->evaluate(\"new Array()\")",
+ "engine->evaluate(\"new Error()\")",
+ "engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")",
+ "engine->evaluate(\"Undefined\")",
+ "engine->evaluate(\"Null\")",
+ "engine->evaluate(\"True\")",
+ "engine->evaluate(\"False\")",
+ "engine->evaluate(\"undefined\")",
+ "engine->evaluate(\"null\")",
+ "engine->evaluate(\"true\")",
+ "engine->evaluate(\"false\")",
+ "engine->evaluate(\"122\")",
+ "engine->evaluate(\"124\")",
+ "engine->evaluate(\"0\")",
+ "engine->evaluate(\"0.0\")",
+ "engine->evaluate(\"123.0\")",
+ "engine->evaluate(\"6.37e-8\")",
+ "engine->evaluate(\"-6.37e-8\")",
+ "engine->evaluate(\"0x43211234\")",
+ "engine->evaluate(\"0x10000\")",
+ "engine->evaluate(\"0x10001\")",
+ "engine->evaluate(\"NaN\")",
+ "engine->evaluate(\"Infinity\")",
+ "engine->evaluate(\"-Infinity\")",
+ "engine->evaluate(\"'ciao'\")",
+ "engine->evaluate(\"''\")",
+ "engine->evaluate(\"'0'\")",
+ "engine->evaluate(\"'123'\")",
+ "engine->evaluate(\"'12.4'\")",
+ "engine->nullValue()",
+ "engine->undefinedValue()",
+ "engine->newObject()",
+ "engine->newArray()",
+ "engine->newArray(10)"};
+
+static const quint32 toUInt32_valueArray[] = {
+ 0, 0,
+ 0, 1,
+ 0, 122,
+ 124, 0,
+ 0, 123,
+ 0, 0,
+ 1126240820, 65536,
+ 65537, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 123,
+ 12, 0,
+ 0, 1,
+ 0, 122,
+ 124, 0,
+ 0, 123,
+ 0, 0,
+ 1126240820, 65536,
+ 65537, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 123,
+ 12, 0,
+ 0, 1,
+ 0, 122,
+ 124, 0,
+ 0, 123,
+ 0, 0,
+ 1126240820, 65536,
+ 65537, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 123,
+ 1, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 22,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 1, 0,
+ 122, 124,
+ 0, 0,
+ 123, 0,
+ 0, 1126240820,
+ 65536, 65537,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 123, 12,
+ 0, 0,
+ 0, 0,
+ 0};
+
+void tst_QScriptValue::toUInt32_data()
+{
+ QTest::addColumn<QScriptValue>("value");
+ QTest::addColumn<quint32>("expected");
+ if (m_engine)
+ delete m_engine;
+ m_engine = new QScriptEngine();
+ QHash<QString, quint32> expectedValue;
+ expectedValue.reserve(135);
+ for (uint i = 0; i < 135; ++i)
+ expectedValue.insert(toUInt32_tagArray[i], toUInt32_valueArray[i]);
+ for (uint i = 0; i < 135; ++i) {
+ QPair<QString, QScriptValue> testcase = initScriptValues(i);
+ QTest::newRow(testcase.first.toAscii().constData()) << testcase.second << expectedValue[testcase.first];
+ }
+}
+
+void tst_QScriptValue::toUInt32()
+{
+ QFETCH(QScriptValue, value);
+ QFETCH(quint32, expected);
+ QCOMPARE(value.toUInt32(), expected);
+ QCOMPARE(value.toUInt32(), expected);
+}
+
+static const QString toUInt16_tagArray[] = {
+ "QScriptValue()",
+ "QScriptValue(QScriptValue::UndefinedValue)",
+ "QScriptValue(QScriptValue::NullValue)",
+ "QScriptValue(true)",
+ "QScriptValue(false)",
+ "QScriptValue(int(122))",
+ "QScriptValue(uint(124))",
+ "QScriptValue(0)",
+ "QScriptValue(0.0)",
+ "QScriptValue(123.0)",
+ "QScriptValue(6.37e-8)",
+ "QScriptValue(-6.37e-8)",
+ "QScriptValue(0x43211234)",
+ "QScriptValue(0x10000)",
+ "QScriptValue(0x10001)",
+ "QScriptValue(qSNaN())",
+ "QScriptValue(qQNaN())",
+ "QScriptValue(qInf())",
+ "QScriptValue(-qInf())",
+ "QScriptValue(\"NaN\")",
+ "QScriptValue(\"Infinity\")",
+ "QScriptValue(\"-Infinity\")",
+ "QScriptValue(\"ciao\")",
+ "QScriptValue(QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(QString(\"\"))",
+ "QScriptValue(QString())",
+ "QScriptValue(QString(\"0\"))",
+ "QScriptValue(QString(\"123\"))",
+ "QScriptValue(QString(\"12.4\"))",
+ "QScriptValue(0, QScriptValue::UndefinedValue)",
+ "QScriptValue(0, QScriptValue::NullValue)",
+ "QScriptValue(0, true)",
+ "QScriptValue(0, false)",
+ "QScriptValue(0, int(122))",
+ "QScriptValue(0, uint(124))",
+ "QScriptValue(0, 0)",
+ "QScriptValue(0, 0.0)",
+ "QScriptValue(0, 123.0)",
+ "QScriptValue(0, 6.37e-8)",
+ "QScriptValue(0, -6.37e-8)",
+ "QScriptValue(0, 0x43211234)",
+ "QScriptValue(0, 0x10000)",
+ "QScriptValue(0, 0x10001)",
+ "QScriptValue(0, qSNaN())",
+ "QScriptValue(0, qQNaN())",
+ "QScriptValue(0, qInf())",
+ "QScriptValue(0, -qInf())",
+ "QScriptValue(0, \"NaN\")",
+ "QScriptValue(0, \"Infinity\")",
+ "QScriptValue(0, \"-Infinity\")",
+ "QScriptValue(0, \"ciao\")",
+ "QScriptValue(0, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(0, QString(\"\"))",
+ "QScriptValue(0, QString())",
+ "QScriptValue(0, QString(\"0\"))",
+ "QScriptValue(0, QString(\"123\"))",
+ "QScriptValue(0, QString(\"12.3\"))",
+ "QScriptValue(engine, QScriptValue::UndefinedValue)",
+ "QScriptValue(engine, QScriptValue::NullValue)",
+ "QScriptValue(engine, true)",
+ "QScriptValue(engine, false)",
+ "QScriptValue(engine, int(122))",
+ "QScriptValue(engine, uint(124))",
+ "QScriptValue(engine, 0)",
+ "QScriptValue(engine, 0.0)",
+ "QScriptValue(engine, 123.0)",
+ "QScriptValue(engine, 6.37e-8)",
+ "QScriptValue(engine, -6.37e-8)",
+ "QScriptValue(engine, 0x43211234)",
+ "QScriptValue(engine, 0x10000)",
+ "QScriptValue(engine, 0x10001)",
+ "QScriptValue(engine, qSNaN())",
+ "QScriptValue(engine, qQNaN())",
+ "QScriptValue(engine, qInf())",
+ "QScriptValue(engine, -qInf())",
+ "QScriptValue(engine, \"NaN\")",
+ "QScriptValue(engine, \"Infinity\")",
+ "QScriptValue(engine, \"-Infinity\")",
+ "QScriptValue(engine, \"ciao\")",
+ "QScriptValue(engine, QString::fromLatin1(\"ciao\"))",
+ "QScriptValue(engine, QString(\"\"))",
+ "QScriptValue(engine, QString())",
+ "QScriptValue(engine, QString(\"0\"))",
+ "QScriptValue(engine, QString(\"123\"))",
+ "QScriptValue(engine, QString(\"1.23\"))",
+ "engine->evaluate(\"[]\")",
+ "engine->evaluate(\"{}\")",
+ "engine->evaluate(\"Object.prototype\")",
+ "engine->evaluate(\"Date.prototype\")",
+ "engine->evaluate(\"Array.prototype\")",
+ "engine->evaluate(\"Function.prototype\")",
+ "engine->evaluate(\"Error.prototype\")",
+ "engine->evaluate(\"Object\")",
+ "engine->evaluate(\"Array\")",
+ "engine->evaluate(\"Number\")",
+ "engine->evaluate(\"Function\")",
+ "engine->evaluate(\"(function() { return 1; })\")",
+ "engine->evaluate(\"(function() { return 'ciao'; })\")",
+ "engine->evaluate(\"(function() { throw new Error('foo'); })\")",
+ "engine->evaluate(\"/foo/\")",
+ "engine->evaluate(\"new Object()\")",
+ "engine->evaluate(\"new Array()\")",
+ "engine->evaluate(\"new Error()\")",
+ "engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")",
+ "engine->evaluate(\"Undefined\")",
+ "engine->evaluate(\"Null\")",
+ "engine->evaluate(\"True\")",
+ "engine->evaluate(\"False\")",
+ "engine->evaluate(\"undefined\")",
+ "engine->evaluate(\"null\")",
+ "engine->evaluate(\"true\")",
+ "engine->evaluate(\"false\")",
+ "engine->evaluate(\"122\")",
+ "engine->evaluate(\"124\")",
+ "engine->evaluate(\"0\")",
+ "engine->evaluate(\"0.0\")",
+ "engine->evaluate(\"123.0\")",
+ "engine->evaluate(\"6.37e-8\")",
+ "engine->evaluate(\"-6.37e-8\")",
+ "engine->evaluate(\"0x43211234\")",
+ "engine->evaluate(\"0x10000\")",
+ "engine->evaluate(\"0x10001\")",
+ "engine->evaluate(\"NaN\")",
+ "engine->evaluate(\"Infinity\")",
+ "engine->evaluate(\"-Infinity\")",
+ "engine->evaluate(\"'ciao'\")",
+ "engine->evaluate(\"''\")",
+ "engine->evaluate(\"'0'\")",
+ "engine->evaluate(\"'123'\")",
+ "engine->evaluate(\"'12.4'\")",
+ "engine->nullValue()",
+ "engine->undefinedValue()",
+ "engine->newObject()",
+ "engine->newArray()",
+ "engine->newArray(10)"};
+
+static const quint16 toUInt16_valueArray[] = {
+ 0, 0,
+ 0, 1,
+ 0, 122,
+ 124, 0,
+ 0, 123,
+ 0, 0,
+ 4660, 0,
+ 1, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 123,
+ 12, 0,
+ 0, 1,
+ 0, 122,
+ 124, 0,
+ 0, 123,
+ 0, 0,
+ 4660, 0,
+ 1, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 123,
+ 12, 0,
+ 0, 1,
+ 0, 122,
+ 124, 0,
+ 0, 123,
+ 0, 0,
+ 4660, 0,
+ 1, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 123,
+ 1, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, 22,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 1, 0,
+ 122, 124,
+ 0, 0,
+ 123, 0,
+ 0, 4660,
+ 0, 1,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ 123, 12,
+ 0, 0,
+ 0, 0,
+ 0};
+
+void tst_QScriptValue::toUInt16_data()
+{
+ QTest::addColumn<QScriptValue>("value");
+ QTest::addColumn<quint16>("expected");
+ if (m_engine)
+ delete m_engine;
+ m_engine = new QScriptEngine();
+ QHash<QString, quint16> expectedValue;
+ expectedValue.reserve(135);
+ for (uint i = 0; i < 135; ++i)
+ expectedValue.insert(toUInt16_tagArray[i], toUInt16_valueArray[i]);
+ for (uint i = 0; i < 135; ++i) {
+ QPair<QString, QScriptValue> testcase = initScriptValues(i);
+ QTest::newRow(testcase.first.toAscii().constData()) << testcase.second << expectedValue[testcase.first];
+ }
+}
+
+void tst_QScriptValue::toUInt16()
+{
+ QFETCH(QScriptValue, value);
+ QFETCH(quint16, expected);
+ QCOMPARE(value.toUInt16(), expected);
+ QCOMPARE(value.toUInt16(), expected);
+}
diff --git a/Source/JavaScriptCore/qt/tests/qscriptvalueiterator/qscriptvalueiterator.pro b/Source/JavaScriptCore/qt/tests/qscriptvalueiterator/qscriptvalueiterator.pro
new file mode 100644
index 0000000..5314ec9
--- /dev/null
+++ b/Source/JavaScriptCore/qt/tests/qscriptvalueiterator/qscriptvalueiterator.pro
@@ -0,0 +1,7 @@
+TEMPLATE = app
+TARGET = tst_qscriptvalueiterator
+QT += testlib
+include(../tests.pri)
+
+SOURCES += tst_qscriptvalueiterator.cpp
+
diff --git a/Source/JavaScriptCore/qt/tests/qscriptvalueiterator/tst_qscriptvalueiterator.cpp b/Source/JavaScriptCore/qt/tests/qscriptvalueiterator/tst_qscriptvalueiterator.cpp
new file mode 100644
index 0000000..43d0042
--- /dev/null
+++ b/Source/JavaScriptCore/qt/tests/qscriptvalueiterator/tst_qscriptvalueiterator.cpp
@@ -0,0 +1,531 @@
+/*
+ Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef tst_qscriptvalueiterator_h
+#define tst_qscriptvalueiterator_h
+
+#include "qscriptengine.h"
+#include "qscriptvalue.h"
+#include "qscriptvalueiterator.h"
+#include <QtCore/qhash.h>
+#include <QtTest/QtTest>
+
+class tst_QScriptValueIterator : public QObject {
+ Q_OBJECT
+
+public:
+ tst_QScriptValueIterator();
+ virtual ~tst_QScriptValueIterator();
+
+private slots:
+ void iterateForward_data();
+ void iterateForward();
+ void iterateBackward_data();
+ void iterateBackward();
+ void iterateArray_data();
+ void iterateArray();
+ void iterateBackAndForth();
+ void setValue();
+ void remove();
+ void removeMixed();
+ void removeUndeletable();
+ void iterateString();
+ void assignObjectToIterator();
+};
+
+tst_QScriptValueIterator::tst_QScriptValueIterator()
+{
+}
+
+tst_QScriptValueIterator::~tst_QScriptValueIterator()
+{
+}
+
+void tst_QScriptValueIterator::iterateForward_data()
+{
+ QTest::addColumn<QStringList>("propertyNames");
+ QTest::addColumn<QStringList>("propertyValues");
+
+ QTest::newRow("no properties")
+ << QStringList() << QStringList();
+ QTest::newRow("foo=bar")
+ << (QStringList() << "foo")
+ << (QStringList() << "bar");
+ QTest::newRow("foo=bar, baz=123")
+ << (QStringList() << "foo" << "baz")
+ << (QStringList() << "bar" << "123");
+ QTest::newRow("foo=bar, baz=123, rab=oof")
+ << (QStringList() << "foo" << "baz" << "rab")
+ << (QStringList() << "bar" << "123" << "oof");
+}
+
+void tst_QScriptValueIterator::iterateForward()
+{
+ QFETCH(QStringList, propertyNames);
+ QFETCH(QStringList, propertyValues);
+ QMap<QString, QString> pmap;
+ Q_ASSERT(propertyNames.size() == propertyValues.size());
+
+ QScriptEngine engine;
+ QScriptValue object = engine.newObject();
+ for (int i = 0; i < propertyNames.size(); ++i) {
+ QString name = propertyNames.at(i);
+ QString value = propertyValues.at(i);
+ pmap.insert(name, value);
+ object.setProperty(name, QScriptValue(&engine, value));
+ }
+ QScriptValue otherObject = engine.newObject();
+ otherObject.setProperty("foo", QScriptValue(&engine, 123456));
+ otherObject.setProperty("protoProperty", QScriptValue(&engine, 654321));
+ object.setPrototype(otherObject); // should not affect iterator
+
+ QStringList lst;
+ QScriptValueIterator it(object);
+ while (!pmap.isEmpty()) {
+ QCOMPARE(it.hasNext(), true);
+ QCOMPARE(it.hasNext(), true);
+ it.next();
+ QString name = it.name();
+ QCOMPARE(pmap.contains(name), true);
+ QCOMPARE(it.name(), name);
+ QCOMPARE(it.flags(), object.propertyFlags(name));
+ QCOMPARE(it.value().strictlyEquals(QScriptValue(&engine, pmap.value(name))), true);
+ QCOMPARE(it.scriptName(), engine.toStringHandle(name));
+ pmap.remove(name);
+ lst.append(name);
+ }
+
+ QCOMPARE(it.hasNext(), false);
+ QCOMPARE(it.hasNext(), false);
+
+ it.toFront();
+ for (int i = 0; i < lst.count(); ++i) {
+ QCOMPARE(it.hasNext(), true);
+ it.next();
+ QCOMPARE(it.name(), lst.at(i));
+ }
+
+ for (int i = 0; i < lst.count(); ++i) {
+ QCOMPARE(it.hasPrevious(), true);
+ it.previous();
+ QCOMPARE(it.name(), lst.at(lst.count()-1-i));
+ }
+ QCOMPARE(it.hasPrevious(), false);
+}
+
+void tst_QScriptValueIterator::iterateBackward_data()
+{
+ iterateForward_data();
+}
+
+void tst_QScriptValueIterator::iterateBackward()
+{
+ QFETCH(QStringList, propertyNames);
+ QFETCH(QStringList, propertyValues);
+ QMap<QString, QString> pmap;
+ Q_ASSERT(propertyNames.size() == propertyValues.size());
+
+ QScriptEngine engine;
+ QScriptValue object = engine.newObject();
+ for (int i = 0; i < propertyNames.size(); ++i) {
+ QString name = propertyNames.at(i);
+ QString value = propertyValues.at(i);
+ pmap.insert(name, value);
+ object.setProperty(name, QScriptValue(&engine, value));
+ }
+
+ QStringList lst;
+ QScriptValueIterator it(object);
+ it.toBack();
+ while (!pmap.isEmpty()) {
+ QCOMPARE(it.hasPrevious(), true);
+ QCOMPARE(it.hasPrevious(), true);
+ it.previous();
+ QString name = it.name();
+ QCOMPARE(pmap.contains(name), true);
+ QCOMPARE(it.name(), name);
+ QCOMPARE(it.flags(), object.propertyFlags(name));
+ QCOMPARE(it.value().strictlyEquals(QScriptValue(&engine, pmap.value(name))), true);
+ pmap.remove(name);
+ lst.append(name);
+ }
+
+ QCOMPARE(it.hasPrevious(), false);
+ QCOMPARE(it.hasPrevious(), false);
+
+ it.toBack();
+ for (int i = 0; i < lst.count(); ++i) {
+ QCOMPARE(it.hasPrevious(), true);
+ it.previous();
+ QCOMPARE(it.name(), lst.at(i));
+ }
+
+ for (int i = 0; i < lst.count(); ++i) {
+ QCOMPARE(it.hasNext(), true);
+ it.next();
+ QCOMPARE(it.name(), lst.at(lst.count()-1-i));
+ }
+ QCOMPARE(it.hasNext(), false);
+}
+
+void tst_QScriptValueIterator::iterateArray_data()
+{
+ QTest::addColumn<QStringList>("inputPropertyNames");
+ QTest::addColumn<QStringList>("inputPropertyValues");
+ QTest::addColumn<QStringList>("propertyNames");
+ QTest::addColumn<QStringList>("propertyValues");
+ QTest::newRow("no elements") << QStringList() << QStringList() << QStringList() << QStringList();
+
+ QTest::newRow("0=foo, 1=barr")
+ << (QStringList() << "0" << "1")
+ << (QStringList() << "foo" << "bar")
+ << (QStringList() << "0" << "1")
+ << (QStringList() << "foo" << "bar");
+
+ QTest::newRow("0=foo, 3=barr")
+ << (QStringList() << "0" << "1" << "2" << "3")
+ << (QStringList() << "foo" << "" << "" << "bar")
+ << (QStringList() << "0" << "1" << "2" << "3")
+ << (QStringList() << "foo" << "" << "" << "bar");
+}
+
+void tst_QScriptValueIterator::iterateArray()
+{
+ QFETCH(QStringList, inputPropertyNames);
+ QFETCH(QStringList, inputPropertyValues);
+ QFETCH(QStringList, propertyNames);
+ QFETCH(QStringList, propertyValues);
+
+ QScriptEngine engine;
+ QScriptValue array = engine.newArray();
+ for (int i = 0; i < inputPropertyNames.size(); ++i)
+ array.setProperty(inputPropertyNames.at(i), inputPropertyValues.at(i));
+
+ int length = array.property("length").toInt32();
+ QCOMPARE(length, propertyNames.size());
+ QScriptValueIterator it(array);
+ for (int i = 0; i < length; ++i) {
+ QCOMPARE(it.hasNext(), true);
+ it.next();
+ QCOMPARE(it.name(), propertyNames.at(i));
+ QCOMPARE(it.flags(), array.propertyFlags(propertyNames.at(i)));
+ QVERIFY(it.value().strictlyEquals(array.property(propertyNames.at(i))));
+ QCOMPARE(it.value().toString(), propertyValues.at(i));
+ }
+ QVERIFY(it.hasNext());
+ it.next();
+ QCOMPARE(it.name(), QString::fromLatin1("length"));
+ QVERIFY(it.value().isNumber());
+ QCOMPARE(it.value().toInt32(), length);
+ QCOMPARE(it.flags(), QScriptValue::PropertyFlags(QScriptValue::SkipInEnumeration | QScriptValue::Undeletable));
+
+ it.previous();
+ QCOMPARE(it.hasPrevious(), length > 0);
+ for (int i = length - 1; i >= 0; --i) {
+ it.previous();
+ QCOMPARE(it.name(), propertyNames.at(i));
+ QCOMPARE(it.flags(), array.propertyFlags(propertyNames.at(i)));
+ QVERIFY(it.value().strictlyEquals(array.property(propertyNames.at(i))));
+ QCOMPARE(it.value().toString(), propertyValues.at(i));
+ QCOMPARE(it.hasPrevious(), i > 0);
+ }
+ QCOMPARE(it.hasPrevious(), false);
+
+ // hasNext() and hasPrevious() cache their result; verify that the result is in sync
+ if (length > 1) {
+ QVERIFY(it.hasNext());
+ it.next();
+ QCOMPARE(it.name(), QString::fromLatin1("0"));
+ QVERIFY(it.hasNext());
+ it.previous();
+ QCOMPARE(it.name(), QString::fromLatin1("0"));
+ QVERIFY(!it.hasPrevious());
+ it.next();
+ QCOMPARE(it.name(), QString::fromLatin1("0"));
+ QVERIFY(it.hasPrevious());
+ it.next();
+ QCOMPARE(it.name(), QString::fromLatin1("1"));
+ }
+ {
+ // same test as object:
+ QScriptValue originalArray = engine.newArray();
+ for (int i = 0; i < inputPropertyNames.size(); ++i)
+ originalArray.setProperty(inputPropertyNames.at(i), inputPropertyValues.at(i));
+
+ QScriptValue array = originalArray.toObject();
+ int length = array.property("length").toInt32();
+ QCOMPARE(length, propertyNames.size());
+ QScriptValueIterator it(array);
+ for (int i = 0; i < length; ++i) {
+ QCOMPARE(it.hasNext(), true);
+ it.next();
+ QCOMPARE(it.name(), propertyNames.at(i));
+ QCOMPARE(it.flags(), array.propertyFlags(propertyNames.at(i)));
+ QVERIFY(it.value().strictlyEquals(array.property(propertyNames.at(i))));
+ QCOMPARE(it.value().toString(), propertyValues.at(i));
+ }
+ QCOMPARE(it.hasNext(), true);
+ it.next();
+ QCOMPARE(it.name(), QString::fromLatin1("length"));
+ }
+}
+
+void tst_QScriptValueIterator::iterateBackAndForth()
+{
+ QScriptEngine engine;
+ {
+ QScriptValue object = engine.newObject();
+ object.setProperty("foo", QScriptValue(&engine, "bar"));
+ object.setProperty("rab", QScriptValue(&engine, "oof"),
+ QScriptValue::SkipInEnumeration); // should not affect iterator
+ QScriptValueIterator it(object);
+ QVERIFY(it.hasNext());
+ it.next();
+ QCOMPARE(it.name(), QLatin1String("foo"));
+ QVERIFY(it.hasPrevious());
+ it.previous();
+ QCOMPARE(it.name(), QLatin1String("foo"));
+ QVERIFY(it.hasNext());
+ it.next();
+ QCOMPARE(it.name(), QLatin1String("foo"));
+ QVERIFY(it.hasPrevious());
+ it.previous();
+ QCOMPARE(it.name(), QLatin1String("foo"));
+ QVERIFY(it.hasNext());
+ it.next();
+ QCOMPARE(it.name(), QLatin1String("foo"));
+ QVERIFY(it.hasNext());
+ it.next();
+ QCOMPARE(it.name(), QLatin1String("rab"));
+ QVERIFY(it.hasPrevious());
+ it.previous();
+ QCOMPARE(it.name(), QLatin1String("rab"));
+ QVERIFY(it.hasNext());
+ it.next();
+ QCOMPARE(it.name(), QLatin1String("rab"));
+ QVERIFY(it.hasPrevious());
+ it.previous();
+ QCOMPARE(it.name(), QLatin1String("rab"));
+ }
+ {
+ // hasNext() and hasPrevious() cache their result; verify that the result is in sync
+ QScriptValue object = engine.newObject();
+ object.setProperty("foo", QScriptValue(&engine, "bar"));
+ object.setProperty("rab", QScriptValue(&engine, "oof"));
+ QScriptValueIterator it(object);
+ QVERIFY(it.hasNext());
+ it.next();
+ QCOMPARE(it.name(), QString::fromLatin1("foo"));
+ QVERIFY(it.hasNext());
+ it.previous();
+ QCOMPARE(it.name(), QString::fromLatin1("foo"));
+ QVERIFY(!it.hasPrevious());
+ it.next();
+ QCOMPARE(it.name(), QString::fromLatin1("foo"));
+ QVERIFY(it.hasPrevious());
+ it.next();
+ QCOMPARE(it.name(), QString::fromLatin1("rab"));
+ }
+}
+
+void tst_QScriptValueIterator::setValue()
+{
+ QScriptEngine engine;
+ QScriptValue object = engine.newObject();
+ object.setProperty("foo", QScriptValue(&engine, "bar"));
+ QScriptValueIterator it(object);
+ it.next();
+ QCOMPARE(it.name(), QLatin1String("foo"));
+ it.setValue(QScriptValue(&engine, "baz"));
+ QCOMPARE(it.value().strictlyEquals(QScriptValue(&engine, QLatin1String("baz"))), true);
+ QCOMPARE(object.property("foo").toString(), QLatin1String("baz"));
+ it.setValue(QScriptValue(&engine, "zab"));
+ QCOMPARE(it.value().strictlyEquals(QScriptValue(&engine, QLatin1String("zab"))), true);
+ QCOMPARE(object.property("foo").toString(), QLatin1String("zab"));
+}
+
+void tst_QScriptValueIterator::remove()
+{
+ QScriptEngine engine;
+ QScriptValue object = engine.newObject();
+ object.setProperty("foo", QScriptValue(&engine, "bar"),
+ QScriptValue::SkipInEnumeration); // should not affect iterator
+ object.setProperty("rab", QScriptValue(&engine, "oof"));
+ QScriptValueIterator it(object);
+ it.next();
+ QCOMPARE(it.name(), QLatin1String("foo"));
+ it.remove();
+ QCOMPARE(it.hasPrevious(), false);
+ QCOMPARE(object.property("foo").isValid(), false);
+ QCOMPARE(object.property("rab").toString(), QLatin1String("oof"));
+ it.next();
+ QCOMPARE(it.name(), QLatin1String("rab"));
+ QCOMPARE(it.value().toString(), QLatin1String("oof"));
+ QCOMPARE(it.hasNext(), false);
+ it.remove();
+ QCOMPARE(object.property("rab").isValid(), false);
+ QCOMPARE(it.hasPrevious(), false);
+ QCOMPARE(it.hasNext(), false);
+}
+
+void tst_QScriptValueIterator::removeMixed()
+{
+ // This test checks if QScriptValueIterator behaives correctly if an object's property got deleted
+ // in different way.
+ QScriptEngine engine;
+ QScriptValue object = engine.evaluate("o = new Object; o");
+ object.setProperty("a", QScriptValue(124), QScriptValue::SkipInEnumeration);
+ object.setProperty("b", QScriptValue(816));
+ object.setProperty("c", QScriptValue(3264));
+ QScriptValueIterator it(object);
+ it.next();
+ it.next();
+ QCOMPARE(it.name(), QLatin1String("b"));
+ QCOMPARE(it.hasPrevious(), true);
+ QCOMPARE(it.hasNext(), true);
+ // Remove 'a'
+ object.setProperty("a", QScriptValue());
+ QEXPECT_FAIL("", "That would be a significant behavioral and performance change, new QtScript API should be developed (QTBUG-12087)", Abort);
+ QCOMPARE(it.hasPrevious(), false);
+ QCOMPARE(it.hasNext(), true);
+ // Remove 'c'
+ engine.evaluate("delete o.c");
+ QCOMPARE(it.hasPrevious(), false);
+ QCOMPARE(it.hasNext(), false);
+ // Remove 'b'
+ object.setProperty("b", QScriptValue());
+ QCOMPARE(it.hasPrevious(), false);
+ QCOMPARE(it.hasNext(), false);
+ QCOMPARE(it.name(), QString());
+ QCOMPARE(it.value().toString(), QString());
+
+ // Try to remove a removed property.
+ it.remove();
+ QCOMPARE(it.hasPrevious(), false);
+ QCOMPARE(it.hasNext(), false);
+ QCOMPARE(it.name(), QString());
+ QCOMPARE(it.value().toString(), QString());
+
+ for (int i = 0; i < 2; ++i) {
+ it.next();
+ QCOMPARE(it.hasPrevious(), false);
+ QCOMPARE(it.hasNext(), false);
+ QCOMPARE(it.name(), QString());
+ QCOMPARE(it.value().toString(), QString());
+ }
+
+ for (int i = 0; i < 2; ++i) {
+ it.previous();
+ QCOMPARE(it.hasPrevious(), false);
+ QCOMPARE(it.hasNext(), false);
+ QCOMPARE(it.name(), QString());
+ QCOMPARE(it.value().toString(), QString());
+ }
+}
+
+void tst_QScriptValueIterator::removeUndeletable()
+{
+ // Undeletable property can't be deleted via iterator.
+ QScriptEngine engine;
+ QScriptValue object = engine.evaluate("o = new Object; o");
+ object.setProperty("a", QScriptValue(&engine, 124));
+ object.setProperty("b", QScriptValue(&engine, 816), QScriptValue::Undeletable);
+ QVERIFY(object.property("b").isValid());
+ QScriptValueIterator it(object);
+ it.next();
+ it.next();
+ it.remove();
+ it.toFront();
+ QVERIFY(it.hasNext());
+ QVERIFY(object.property("b").isValid());
+}
+
+void tst_QScriptValueIterator::iterateString()
+{
+ QScriptEngine engine;
+ QScriptValue str = QScriptValue(&engine, QString::fromLatin1("ciao"));
+ QVERIFY(str.isString());
+ QScriptValue obj = str.toObject();
+ int length = obj.property("length").toInt32();
+ QCOMPARE(length, 4);
+ QScriptValueIterator it(obj);
+ for (int i = 0; i < length; ++i) {
+ QCOMPARE(it.hasNext(), true);
+ QString indexStr = QScriptValue(&engine, i).toString();
+ it.next();
+ QCOMPARE(it.name(), indexStr);
+ QCOMPARE(it.flags(), obj.propertyFlags(indexStr));
+ QCOMPARE(it.value().strictlyEquals(obj.property(indexStr)), true);
+ }
+ QVERIFY(it.hasNext());
+ it.next();
+ QCOMPARE(it.name(), QString::fromLatin1("length"));
+ QVERIFY(it.value().isNumber());
+ QCOMPARE(it.value().toInt32(), length);
+ QCOMPARE(it.flags(), QScriptValue::PropertyFlags(QScriptValue::ReadOnly | QScriptValue::SkipInEnumeration | QScriptValue::Undeletable));
+
+ it.previous();
+ QCOMPARE(it.hasPrevious(), length > 0);
+ for (int i = length - 1; i >= 0; --i) {
+ it.previous();
+ QString indexStr = QScriptValue(&engine, i).toString();
+ QCOMPARE(it.name(), indexStr);
+ QCOMPARE(it.flags(), obj.propertyFlags(indexStr));
+ QCOMPARE(it.value().strictlyEquals(obj.property(indexStr)), true);
+ QCOMPARE(it.hasPrevious(), i > 0);
+ }
+ QCOMPARE(it.hasPrevious(), false);
+}
+
+void tst_QScriptValueIterator::assignObjectToIterator()
+{
+ QScriptEngine eng;
+ QScriptValue obj1 = eng.newObject();
+ obj1.setProperty("foo", 123);
+ QScriptValue obj2 = eng.newObject();
+ obj2.setProperty("bar", 456);
+
+ QScriptValueIterator it(obj1);
+ QVERIFY(it.hasNext());
+ it.next();
+ it = obj2;
+ QVERIFY(it.hasNext());
+ it.next();
+ QCOMPARE(it.name(), QString::fromLatin1("bar"));
+
+ it = obj1;
+ QVERIFY(it.hasNext());
+ it.next();
+ QCOMPARE(it.name(), QString::fromLatin1("foo"));
+
+ it = obj2;
+ QVERIFY(it.hasNext());
+ it.next();
+ QCOMPARE(it.name(), QString::fromLatin1("bar"));
+
+ it = obj2;
+ QVERIFY(it.hasNext());
+ it.next();
+ QCOMPARE(it.name(), QString::fromLatin1("bar"));
+}
+
+QTEST_MAIN(tst_QScriptValueIterator)
+#include "tst_qscriptvalueiterator.moc"
+
+#endif // tst_qscriptvalueiterator_h
diff --git a/Source/JavaScriptCore/qt/tests/tests.pri b/Source/JavaScriptCore/qt/tests/tests.pri
new file mode 100644
index 0000000..5af3383
--- /dev/null
+++ b/Source/JavaScriptCore/qt/tests/tests.pri
@@ -0,0 +1,19 @@
+QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR
+QMAKE_LIBDIR = $$OUTPUT_DIR/lib $$QMAKE_LIBDIR
+mac:!static:contains(QT_CONFIG, qt_framework):!CONFIG(webkit_no_framework) {
+ LIBS += -framework QtScript
+ QMAKE_FRAMEWORKPATH = $$OUTPUT_DIR/lib $$QMAKE_FRAMEWORKPATH
+} else {
+ win32-*|wince* {
+ LIBS += -lQtScript$${QT_MAJOR_VERSION}
+ } else {
+ LIBS += -lQtScript
+ }
+}
+
+CONFIG(release, debug|release) {
+ DEFINES += NDEBUG
+}
+
+INCLUDEPATH += $$PWD/../api
+
diff --git a/Source/JavaScriptCore/qt/tests/tests.pro b/Source/JavaScriptCore/qt/tests/tests.pro
new file mode 100644
index 0000000..6d5559b
--- /dev/null
+++ b/Source/JavaScriptCore/qt/tests/tests.pro
@@ -0,0 +1,5 @@
+TEMPLATE = subdirs
+SUBDIRS = qscriptengine \
+ qscriptvalue \
+ qscriptvalueiterator \
+ qscriptstring
diff --git a/Source/JavaScriptCore/runtime/ArgList.cpp b/Source/JavaScriptCore/runtime/ArgList.cpp
new file mode 100644
index 0000000..ab2b5d7
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/ArgList.cpp
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2009 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+#include "ArgList.h"
+
+#include "JSValue.h"
+#include "JSCell.h"
+
+using std::min;
+
+namespace JSC {
+
+void ArgList::getSlice(int startIndex, ArgList& result) const
+{
+ if (startIndex <= 0 || static_cast<unsigned>(startIndex) >= m_argCount) {
+ result = ArgList(m_args, 0);
+ return;
+ }
+ result = ArgList(m_args + startIndex, m_argCount - startIndex);
+}
+
+void MarkedArgumentBuffer::markLists(MarkStack& markStack, ListSet& markSet)
+{
+ ListSet::iterator end = markSet.end();
+ for (ListSet::iterator it = markSet.begin(); it != end; ++it) {
+ MarkedArgumentBuffer* list = *it;
+ markStack.appendValues(reinterpret_cast<JSValue*>(list->m_buffer), list->m_size);
+ }
+}
+
+void MarkedArgumentBuffer::slowAppend(JSValue v)
+{
+ // As long as our size stays within our Vector's inline
+ // capacity, all our values are allocated on the stack, and
+ // therefore don't need explicit marking. Once our size exceeds
+ // our Vector's inline capacity, though, our values move to the
+ // heap, where they do need explicit marking.
+ if (!m_markSet) {
+ // We can only register for explicit marking once we know which heap
+ // is the current one, i.e., when a non-immediate value is appended.
+ if (Heap* heap = Heap::heap(v)) {
+ ListSet& markSet = heap->markListSet();
+ markSet.add(this);
+ m_markSet = &markSet;
+ }
+ }
+
+ if (m_vector.size() < m_vector.capacity()) {
+ m_vector.uncheckedAppend(v);
+ return;
+ }
+
+ // 4x growth would be excessive for a normal vector, but it's OK for Lists
+ // because they're short-lived.
+ m_vector.reserveCapacity(m_vector.capacity() * 4);
+
+ m_vector.uncheckedAppend(v);
+ m_buffer = m_vector.data();
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/ArgList.h b/Source/JavaScriptCore/runtime/ArgList.h
new file mode 100644
index 0000000..cd563a2
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/ArgList.h
@@ -0,0 +1,245 @@
+/*
+ * Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
+ * Copyright (C) 2003, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef ArgList_h
+#define ArgList_h
+
+#include "CallFrame.h"
+#include "Register.h"
+#include <wtf/HashSet.h>
+#include <wtf/Noncopyable.h>
+#include <wtf/Vector.h>
+
+namespace JSC {
+
+ class MarkStack;
+
+ class MarkedArgumentBuffer : public Noncopyable {
+ private:
+ static const unsigned inlineCapacity = 8;
+ typedef Vector<Register, inlineCapacity> VectorType;
+ typedef HashSet<MarkedArgumentBuffer*> ListSet;
+
+ public:
+ typedef VectorType::iterator iterator;
+ typedef VectorType::const_iterator const_iterator;
+
+ // Constructor for a read-write list, to which you may append values.
+ // FIXME: Remove all clients of this API, then remove this API.
+ MarkedArgumentBuffer()
+ : m_isUsingInlineBuffer(true)
+ , m_markSet(0)
+#ifndef NDEBUG
+ , m_isReadOnly(false)
+#endif
+ {
+ m_buffer = m_vector.data();
+ m_size = 0;
+ }
+
+ // Constructor for a read-only list whose data has already been allocated elsewhere.
+ MarkedArgumentBuffer(Register* buffer, size_t size)
+ : m_buffer(buffer)
+ , m_size(size)
+ , m_isUsingInlineBuffer(true)
+ , m_markSet(0)
+#ifndef NDEBUG
+ , m_isReadOnly(true)
+#endif
+ {
+ }
+
+ void initialize(Register* buffer, size_t size)
+ {
+ ASSERT(!m_markSet);
+ ASSERT(isEmpty());
+
+ m_buffer = buffer;
+ m_size = size;
+#ifndef NDEBUG
+ m_isReadOnly = true;
+#endif
+ }
+
+ ~MarkedArgumentBuffer()
+ {
+ if (m_markSet)
+ m_markSet->remove(this);
+ }
+
+ size_t size() const { return m_size; }
+ bool isEmpty() const { return !m_size; }
+
+ JSValue at(size_t i) const
+ {
+ if (i < m_size)
+ return m_buffer[i].jsValue();
+ return jsUndefined();
+ }
+
+ void clear()
+ {
+ m_vector.clear();
+ m_buffer = 0;
+ m_size = 0;
+ }
+
+ void append(JSValue v)
+ {
+ ASSERT(!m_isReadOnly);
+
+#if ENABLE(JSC_ZOMBIES)
+ ASSERT(!v.isZombie());
+#endif
+
+ if (m_isUsingInlineBuffer && m_size < inlineCapacity) {
+ m_vector.uncheckedAppend(v);
+ ++m_size;
+ } else {
+ // Putting this case all in one function measurably improves
+ // the performance of the fast "just append to inline buffer" case.
+ slowAppend(v);
+ ++m_size;
+ m_isUsingInlineBuffer = false;
+ }
+ }
+
+ void removeLast()
+ {
+ ASSERT(m_size);
+ m_size--;
+ m_vector.removeLast();
+ }
+
+ JSValue last()
+ {
+ ASSERT(m_size);
+ return m_buffer[m_size - 1].jsValue();
+ }
+
+ iterator begin() { return m_buffer; }
+ iterator end() { return m_buffer + m_size; }
+
+ const_iterator begin() const { return m_buffer; }
+ const_iterator end() const { return m_buffer + m_size; }
+
+ static void markLists(MarkStack&, ListSet&);
+
+ private:
+ void slowAppend(JSValue);
+
+ Register* m_buffer;
+ size_t m_size;
+ bool m_isUsingInlineBuffer;
+
+ VectorType m_vector;
+ ListSet* m_markSet;
+#ifndef NDEBUG
+ bool m_isReadOnly;
+#endif
+
+ private:
+ // Prohibits new / delete, which would break GC.
+ friend class JSGlobalData;
+
+ void* operator new(size_t size)
+ {
+ return fastMalloc(size);
+ }
+ void operator delete(void* p)
+ {
+ fastFree(p);
+ }
+
+ void* operator new[](size_t);
+ void operator delete[](void*);
+
+ void* operator new(size_t, void*);
+ void operator delete(void*, size_t);
+ };
+
+ class ArgList {
+ friend class JIT;
+ public:
+ typedef JSValue* iterator;
+ typedef const JSValue* const_iterator;
+
+ ArgList()
+ : m_args(0)
+ , m_argCount(0)
+ {
+ }
+
+ ArgList(ExecState* exec)
+ : m_args(reinterpret_cast<JSValue*>(&exec[exec->hostThisRegister() + 1]))
+ , m_argCount(exec->argumentCount())
+ {
+ }
+
+ ArgList(JSValue* args, unsigned argCount)
+ : m_args(args)
+ , m_argCount(argCount)
+ {
+#if ENABLE(JSC_ZOMBIES)
+ for (size_t i = 0; i < argCount; i++)
+ ASSERT(!m_args[i].isZombie());
+#endif
+ }
+
+ ArgList(Register* args, int argCount)
+ : m_args(reinterpret_cast<JSValue*>(args))
+ , m_argCount(argCount)
+ {
+ ASSERT(argCount >= 0);
+ }
+
+ ArgList(const MarkedArgumentBuffer& args)
+ : m_args(reinterpret_cast<JSValue*>(const_cast<Register*>(args.begin())))
+ , m_argCount(args.size())
+ {
+ }
+
+ JSValue at(size_t idx) const
+ {
+ if (idx < m_argCount)
+ return m_args[idx];
+ return jsUndefined();
+ }
+
+ bool isEmpty() const { return !m_argCount; }
+
+ size_t size() const { return m_argCount; }
+
+ iterator begin() { return m_args; }
+ iterator end() { return m_args + m_argCount; }
+
+ const_iterator begin() const { return m_args; }
+ const_iterator end() const { return m_args + m_argCount; }
+
+ void getSlice(int startIndex, ArgList& result) const;
+ private:
+ JSValue* m_args;
+ size_t m_argCount;
+ };
+
+} // namespace JSC
+
+#endif // ArgList_h
diff --git a/Source/JavaScriptCore/runtime/Arguments.cpp b/Source/JavaScriptCore/runtime/Arguments.cpp
new file mode 100644
index 0000000..39886a8
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/Arguments.cpp
@@ -0,0 +1,352 @@
+/*
+ * Copyright (C) 1999-2002 Harri Porten (porten@kde.org)
+ * Copyright (C) 2001 Peter Kelly (pmk@post.com)
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2007 Cameron Zwarich (cwzwarich@uwaterloo.ca)
+ * Copyright (C) 2007 Maks Orlovich
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+#include "Arguments.h"
+
+#include "JSActivation.h"
+#include "JSFunction.h"
+#include "JSGlobalObject.h"
+
+using namespace std;
+
+namespace JSC {
+
+ASSERT_CLASS_FITS_IN_CELL(Arguments);
+
+const ClassInfo Arguments::info = { "Arguments", 0, 0, 0 };
+
+Arguments::~Arguments()
+{
+ if (d->extraArguments != d->extraArgumentsFixedBuffer)
+ delete [] d->extraArguments;
+}
+
+void Arguments::markChildren(MarkStack& markStack)
+{
+ JSObject::markChildren(markStack);
+
+ if (d->registerArray)
+ markStack.appendValues(reinterpret_cast<JSValue*>(d->registerArray.get()), d->numParameters);
+
+ if (d->extraArguments) {
+ unsigned numExtraArguments = d->numArguments - d->numParameters;
+ markStack.appendValues(reinterpret_cast<JSValue*>(d->extraArguments), numExtraArguments);
+ }
+
+ markStack.append(d->callee);
+
+ if (d->activation)
+ markStack.append(d->activation);
+}
+
+void Arguments::copyToRegisters(ExecState* exec, Register* buffer, uint32_t maxSize)
+{
+ if (UNLIKELY(d->overrodeLength)) {
+ unsigned length = min(get(exec, exec->propertyNames().length).toUInt32(exec), maxSize);
+ for (unsigned i = 0; i < length; i++)
+ buffer[i] = get(exec, i);
+ return;
+ }
+
+ if (LIKELY(!d->deletedArguments)) {
+ unsigned parametersLength = min(min(d->numParameters, d->numArguments), maxSize);
+ unsigned i = 0;
+ for (; i < parametersLength; ++i)
+ buffer[i] = d->registers[d->firstParameterIndex + i].jsValue();
+ for (; i < d->numArguments; ++i)
+ buffer[i] = d->extraArguments[i - d->numParameters].jsValue();
+ return;
+ }
+
+ unsigned parametersLength = min(min(d->numParameters, d->numArguments), maxSize);
+ unsigned i = 0;
+ for (; i < parametersLength; ++i) {
+ if (!d->deletedArguments[i])
+ buffer[i] = d->registers[d->firstParameterIndex + i].jsValue();
+ else
+ buffer[i] = get(exec, i);
+ }
+ for (; i < d->numArguments; ++i) {
+ if (!d->deletedArguments[i])
+ buffer[i] = d->extraArguments[i - d->numParameters].jsValue();
+ else
+ buffer[i] = get(exec, i);
+ }
+}
+
+void Arguments::fillArgList(ExecState* exec, MarkedArgumentBuffer& args)
+{
+ if (UNLIKELY(d->overrodeLength)) {
+ unsigned length = get(exec, exec->propertyNames().length).toUInt32(exec);
+ for (unsigned i = 0; i < length; i++)
+ args.append(get(exec, i));
+ return;
+ }
+
+ if (LIKELY(!d->deletedArguments)) {
+ if (LIKELY(!d->numParameters)) {
+ args.initialize(d->extraArguments, d->numArguments);
+ return;
+ }
+
+ if (d->numParameters == d->numArguments) {
+ args.initialize(&d->registers[d->firstParameterIndex], d->numArguments);
+ return;
+ }
+
+ unsigned parametersLength = min(d->numParameters, d->numArguments);
+ unsigned i = 0;
+ for (; i < parametersLength; ++i)
+ args.append(d->registers[d->firstParameterIndex + i].jsValue());
+ for (; i < d->numArguments; ++i)
+ args.append(d->extraArguments[i - d->numParameters].jsValue());
+ return;
+ }
+
+ unsigned parametersLength = min(d->numParameters, d->numArguments);
+ unsigned i = 0;
+ for (; i < parametersLength; ++i) {
+ if (!d->deletedArguments[i])
+ args.append(d->registers[d->firstParameterIndex + i].jsValue());
+ else
+ args.append(get(exec, i));
+ }
+ for (; i < d->numArguments; ++i) {
+ if (!d->deletedArguments[i])
+ args.append(d->extraArguments[i - d->numParameters].jsValue());
+ else
+ args.append(get(exec, i));
+ }
+}
+
+bool Arguments::getOwnPropertySlot(ExecState* exec, unsigned i, PropertySlot& slot)
+{
+ if (i < d->numArguments && (!d->deletedArguments || !d->deletedArguments[i])) {
+ if (i < d->numParameters) {
+ slot.setRegisterSlot(&d->registers[d->firstParameterIndex + i]);
+ } else
+ slot.setValue(d->extraArguments[i - d->numParameters].jsValue());
+ return true;
+ }
+
+ return JSObject::getOwnPropertySlot(exec, Identifier(exec, UString::number(i)), slot);
+}
+
+void Arguments::createStrictModeCallerIfNecessary(ExecState* exec)
+{
+ if (d->overrodeCaller)
+ return;
+
+ d->overrodeCaller = true;
+ PropertyDescriptor descriptor;
+ JSValue thrower = createTypeErrorFunction(exec, "Unable to access caller of strict mode function");
+ descriptor.setAccessorDescriptor(thrower, thrower, DontEnum | DontDelete | Getter | Setter);
+ defineOwnProperty(exec, exec->propertyNames().caller, descriptor, false);
+}
+
+void Arguments::createStrictModeCalleeIfNecessary(ExecState* exec)
+{
+ if (d->overrodeCallee)
+ return;
+
+ d->overrodeCallee = true;
+ PropertyDescriptor descriptor;
+ JSValue thrower = createTypeErrorFunction(exec, "Unable to access callee of strict mode function");
+ descriptor.setAccessorDescriptor(thrower, thrower, DontEnum | DontDelete | Getter | Setter);
+ defineOwnProperty(exec, exec->propertyNames().callee, descriptor, false);
+}
+
+bool Arguments::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
+{
+ bool isArrayIndex;
+ unsigned i = propertyName.toArrayIndex(isArrayIndex);
+ if (isArrayIndex && i < d->numArguments && (!d->deletedArguments || !d->deletedArguments[i])) {
+ if (i < d->numParameters) {
+ slot.setRegisterSlot(&d->registers[d->firstParameterIndex + i]);
+ } else
+ slot.setValue(d->extraArguments[i - d->numParameters].jsValue());
+ return true;
+ }
+
+ if (propertyName == exec->propertyNames().length && LIKELY(!d->overrodeLength)) {
+ slot.setValue(jsNumber(d->numArguments));
+ return true;
+ }
+
+ if (propertyName == exec->propertyNames().callee && LIKELY(!d->overrodeCallee)) {
+ if (!d->isStrictMode) {
+ slot.setValue(d->callee);
+ return true;
+ }
+ createStrictModeCalleeIfNecessary(exec);
+ }
+
+ if (propertyName == exec->propertyNames().caller && d->isStrictMode)
+ createStrictModeCallerIfNecessary(exec);
+
+ return JSObject::getOwnPropertySlot(exec, propertyName, slot);
+}
+
+bool Arguments::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
+{
+ bool isArrayIndex;
+ unsigned i = propertyName.toArrayIndex(isArrayIndex);
+ if (isArrayIndex && i < d->numArguments && (!d->deletedArguments || !d->deletedArguments[i])) {
+ if (i < d->numParameters) {
+ descriptor.setDescriptor(d->registers[d->firstParameterIndex + i].jsValue(), DontEnum);
+ } else
+ descriptor.setDescriptor(d->extraArguments[i - d->numParameters].jsValue(), DontEnum);
+ return true;
+ }
+
+ if (propertyName == exec->propertyNames().length && LIKELY(!d->overrodeLength)) {
+ descriptor.setDescriptor(jsNumber(d->numArguments), DontEnum);
+ return true;
+ }
+
+ if (propertyName == exec->propertyNames().callee && LIKELY(!d->overrodeCallee)) {
+ if (!d->isStrictMode) {
+ descriptor.setDescriptor(d->callee, DontEnum);
+ return true;
+ }
+ createStrictModeCalleeIfNecessary(exec);
+ }
+
+ if (propertyName == exec->propertyNames().caller && d->isStrictMode)
+ createStrictModeCallerIfNecessary(exec);
+
+ return JSObject::getOwnPropertyDescriptor(exec, propertyName, descriptor);
+}
+
+void Arguments::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
+{
+ if (mode == IncludeDontEnumProperties) {
+ for (unsigned i = 0; i < d->numArguments; ++i) {
+ if (!d->deletedArguments || !d->deletedArguments[i])
+ propertyNames.add(Identifier(exec, UString::number(i)));
+ }
+ propertyNames.add(exec->propertyNames().callee);
+ propertyNames.add(exec->propertyNames().length);
+ }
+ JSObject::getOwnPropertyNames(exec, propertyNames, mode);
+}
+
+void Arguments::put(ExecState* exec, unsigned i, JSValue value, PutPropertySlot& slot)
+{
+ if (i < d->numArguments && (!d->deletedArguments || !d->deletedArguments[i])) {
+ if (i < d->numParameters)
+ d->registers[d->firstParameterIndex + i] = JSValue(value);
+ else
+ d->extraArguments[i - d->numParameters] = JSValue(value);
+ return;
+ }
+
+ JSObject::put(exec, Identifier(exec, UString::number(i)), value, slot);
+}
+
+void Arguments::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
+{
+ bool isArrayIndex;
+ unsigned i = propertyName.toArrayIndex(isArrayIndex);
+ if (isArrayIndex && i < d->numArguments && (!d->deletedArguments || !d->deletedArguments[i])) {
+ if (i < d->numParameters)
+ d->registers[d->firstParameterIndex + i] = JSValue(value);
+ else
+ d->extraArguments[i - d->numParameters] = JSValue(value);
+ return;
+ }
+
+ if (propertyName == exec->propertyNames().length && !d->overrodeLength) {
+ d->overrodeLength = true;
+ putDirect(propertyName, value, DontEnum);
+ return;
+ }
+
+ if (propertyName == exec->propertyNames().callee && !d->overrodeCallee) {
+ if (!d->isStrictMode) {
+ d->overrodeCallee = true;
+ putDirect(propertyName, value, DontEnum);
+ return;
+ }
+ createStrictModeCalleeIfNecessary(exec);
+ }
+
+ if (propertyName == exec->propertyNames().caller && d->isStrictMode)
+ createStrictModeCallerIfNecessary(exec);
+
+ JSObject::put(exec, propertyName, value, slot);
+}
+
+bool Arguments::deleteProperty(ExecState* exec, unsigned i)
+{
+ if (i < d->numArguments) {
+ if (!d->deletedArguments) {
+ d->deletedArguments.set(new bool[d->numArguments]);
+ memset(d->deletedArguments.get(), 0, sizeof(bool) * d->numArguments);
+ }
+ if (!d->deletedArguments[i]) {
+ d->deletedArguments[i] = true;
+ return true;
+ }
+ }
+
+ return JSObject::deleteProperty(exec, Identifier(exec, UString::number(i)));
+}
+
+bool Arguments::deleteProperty(ExecState* exec, const Identifier& propertyName)
+{
+ bool isArrayIndex;
+ unsigned i = propertyName.toArrayIndex(isArrayIndex);
+ if (isArrayIndex && i < d->numArguments) {
+ if (!d->deletedArguments) {
+ d->deletedArguments.set(new bool[d->numArguments]);
+ memset(d->deletedArguments.get(), 0, sizeof(bool) * d->numArguments);
+ }
+ if (!d->deletedArguments[i]) {
+ d->deletedArguments[i] = true;
+ return true;
+ }
+ }
+
+ if (propertyName == exec->propertyNames().length && !d->overrodeLength) {
+ d->overrodeLength = true;
+ return true;
+ }
+
+ if (propertyName == exec->propertyNames().callee && !d->overrodeCallee) {
+ if (!d->isStrictMode) {
+ d->overrodeCallee = true;
+ return true;
+ }
+ createStrictModeCalleeIfNecessary(exec);
+ }
+
+ if (propertyName == exec->propertyNames().caller && !d->isStrictMode)
+ createStrictModeCallerIfNecessary(exec);
+
+ return JSObject::deleteProperty(exec, propertyName);
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/Arguments.h b/Source/JavaScriptCore/runtime/Arguments.h
new file mode 100644
index 0000000..715a2ac
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/Arguments.h
@@ -0,0 +1,255 @@
+/*
+ * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
+ * Copyright (C) 2003, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2007 Cameron Zwarich (cwzwarich@uwaterloo.ca)
+ * Copyright (C) 2007 Maks Orlovich
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef Arguments_h
+#define Arguments_h
+
+#include "JSActivation.h"
+#include "JSFunction.h"
+#include "JSGlobalObject.h"
+#include "Interpreter.h"
+#include "ObjectConstructor.h"
+#include "PrototypeFunction.h"
+
+namespace JSC {
+
+ struct ArgumentsData : Noncopyable {
+ JSActivation* activation;
+
+ unsigned numParameters;
+ ptrdiff_t firstParameterIndex;
+ unsigned numArguments;
+
+ Register* registers;
+ OwnArrayPtr<Register> registerArray;
+
+ Register* extraArguments;
+ OwnArrayPtr<bool> deletedArguments;
+ Register extraArgumentsFixedBuffer[4];
+
+ JSFunction* callee;
+ bool overrodeLength : 1;
+ bool overrodeCallee : 1;
+ bool overrodeCaller : 1;
+ bool isStrictMode : 1;
+ };
+
+
+ class Arguments : public JSObject {
+ public:
+ // Use an enum because otherwise gcc insists on doing a memory
+ // read.
+ enum { MaxArguments = 0x10000 };
+
+ enum NoParametersType { NoParameters };
+
+ Arguments(CallFrame*);
+ Arguments(CallFrame*, NoParametersType);
+ virtual ~Arguments();
+
+ static const ClassInfo info;
+
+ virtual void markChildren(MarkStack&);
+
+ void fillArgList(ExecState*, MarkedArgumentBuffer&);
+
+ uint32_t numProvidedArguments(ExecState* exec) const
+ {
+ if (UNLIKELY(d->overrodeLength))
+ return get(exec, exec->propertyNames().length).toUInt32(exec);
+ return d->numArguments;
+ }
+
+ void copyToRegisters(ExecState* exec, Register* buffer, uint32_t maxSize);
+ void copyRegisters();
+ bool isTornOff() const { return d->registerArray; }
+ void setActivation(JSActivation* activation)
+ {
+ d->activation = activation;
+ d->registers = &activation->registerAt(0);
+ }
+
+ static PassRefPtr<Structure> createStructure(JSValue prototype)
+ {
+ return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount);
+ }
+
+ protected:
+ static const unsigned StructureFlags = OverridesGetOwnPropertySlot | OverridesMarkChildren | OverridesGetPropertyNames | JSObject::StructureFlags;
+
+ private:
+ void getArgumentsData(CallFrame*, JSFunction*&, ptrdiff_t& firstParameterIndex, Register*& argv, int& argc);
+ virtual bool getOwnPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&);
+ virtual bool getOwnPropertySlot(ExecState*, unsigned propertyName, PropertySlot&);
+ virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
+ virtual void getOwnPropertyNames(ExecState*, PropertyNameArray&, EnumerationMode mode = ExcludeDontEnumProperties);
+ virtual void put(ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&);
+ virtual void put(ExecState*, unsigned propertyName, JSValue, PutPropertySlot&);
+ virtual bool deleteProperty(ExecState*, const Identifier& propertyName);
+ virtual bool deleteProperty(ExecState*, unsigned propertyName);
+ void createStrictModeCallerIfNecessary(ExecState*);
+ void createStrictModeCalleeIfNecessary(ExecState*);
+
+ virtual const ClassInfo* classInfo() const { return &info; }
+
+ void init(CallFrame*);
+
+ OwnPtr<ArgumentsData> d;
+ };
+
+ Arguments* asArguments(JSValue);
+
+ inline Arguments* asArguments(JSValue value)
+ {
+ ASSERT(asObject(value)->inherits(&Arguments::info));
+ return static_cast<Arguments*>(asObject(value));
+ }
+
+ ALWAYS_INLINE void Arguments::getArgumentsData(CallFrame* callFrame, JSFunction*& function, ptrdiff_t& firstParameterIndex, Register*& argv, int& argc)
+ {
+ function = asFunction(callFrame->callee());
+
+ int numParameters = function->jsExecutable()->parameterCount();
+ argc = callFrame->argumentCountIncludingThis();
+
+ if (argc <= numParameters)
+ argv = callFrame->registers() - RegisterFile::CallFrameHeaderSize - numParameters;
+ else
+ argv = callFrame->registers() - RegisterFile::CallFrameHeaderSize - numParameters - argc;
+
+ argc -= 1; // - 1 to skip "this"
+ firstParameterIndex = -RegisterFile::CallFrameHeaderSize - numParameters;
+ }
+
+ inline Arguments::Arguments(CallFrame* callFrame)
+ : JSObject(callFrame->lexicalGlobalObject()->argumentsStructure())
+ , d(adoptPtr(new ArgumentsData))
+ {
+ JSFunction* callee;
+ ptrdiff_t firstParameterIndex;
+ Register* argv;
+ int numArguments;
+ getArgumentsData(callFrame, callee, firstParameterIndex, argv, numArguments);
+
+ d->numParameters = callee->jsExecutable()->parameterCount();
+ d->firstParameterIndex = firstParameterIndex;
+ d->numArguments = numArguments;
+
+ d->activation = 0;
+ d->registers = callFrame->registers();
+
+ Register* extraArguments;
+ if (d->numArguments <= d->numParameters)
+ extraArguments = 0;
+ else {
+ unsigned numExtraArguments = d->numArguments - d->numParameters;
+ if (numExtraArguments > sizeof(d->extraArgumentsFixedBuffer) / sizeof(Register))
+ extraArguments = new Register[numExtraArguments];
+ else
+ extraArguments = d->extraArgumentsFixedBuffer;
+ for (unsigned i = 0; i < numExtraArguments; ++i)
+ extraArguments[i] = argv[d->numParameters + i];
+ }
+
+ d->extraArguments = extraArguments;
+
+ d->callee = callee;
+ d->overrodeLength = false;
+ d->overrodeCallee = false;
+ d->overrodeCaller = false;
+ d->isStrictMode = callFrame->codeBlock()->isStrictMode();
+ if (d->isStrictMode)
+ copyRegisters();
+ }
+
+ inline Arguments::Arguments(CallFrame* callFrame, NoParametersType)
+ : JSObject(callFrame->lexicalGlobalObject()->argumentsStructure())
+ , d(adoptPtr(new ArgumentsData))
+ {
+ ASSERT(!asFunction(callFrame->callee())->jsExecutable()->parameterCount());
+
+ unsigned numArguments = callFrame->argumentCount();
+
+ d->numParameters = 0;
+ d->numArguments = numArguments;
+ d->activation = 0;
+
+ Register* extraArguments;
+ if (numArguments > sizeof(d->extraArgumentsFixedBuffer) / sizeof(Register))
+ extraArguments = new Register[numArguments];
+ else
+ extraArguments = d->extraArgumentsFixedBuffer;
+
+ Register* argv = callFrame->registers() - RegisterFile::CallFrameHeaderSize - numArguments - 1;
+ for (unsigned i = 0; i < numArguments; ++i)
+ extraArguments[i] = argv[i];
+
+ d->extraArguments = extraArguments;
+
+ d->callee = asFunction(callFrame->callee());
+ d->overrodeLength = false;
+ d->overrodeCallee = false;
+ d->overrodeCaller = false;
+ d->isStrictMode = callFrame->codeBlock()->isStrictMode();
+ if (d->isStrictMode)
+ copyRegisters();
+ }
+
+ inline void Arguments::copyRegisters()
+ {
+ ASSERT(!isTornOff());
+
+ if (!d->numParameters)
+ return;
+
+ int registerOffset = d->numParameters + RegisterFile::CallFrameHeaderSize;
+ size_t registerArraySize = d->numParameters;
+
+ Register* registerArray = new Register[registerArraySize];
+ memcpy(registerArray, d->registers - registerOffset, registerArraySize * sizeof(Register));
+ d->registerArray.set(registerArray);
+ d->registers = registerArray + registerOffset;
+ }
+
+ // This JSActivation function is defined here so it can get at Arguments::setRegisters.
+ inline void JSActivation::copyRegisters()
+ {
+ ASSERT(!d()->registerArray);
+
+ size_t numParametersMinusThis = d()->functionExecutable->parameterCount();
+ size_t numVars = d()->functionExecutable->capturedVariableCount();
+ size_t numLocals = numVars + numParametersMinusThis;
+
+ if (!numLocals)
+ return;
+
+ int registerOffset = numParametersMinusThis + RegisterFile::CallFrameHeaderSize;
+ size_t registerArraySize = numLocals + RegisterFile::CallFrameHeaderSize;
+
+ Register* registerArray = copyRegisterArray(d()->registers - registerOffset, registerArraySize);
+ setRegisters(registerArray + registerOffset, registerArray);
+ }
+
+} // namespace JSC
+
+#endif // Arguments_h
diff --git a/Source/JavaScriptCore/runtime/ArrayConstructor.cpp b/Source/JavaScriptCore/runtime/ArrayConstructor.cpp
new file mode 100644
index 0000000..632d466
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/ArrayConstructor.cpp
@@ -0,0 +1,100 @@
+/*
+ * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
+ * Copyright (C) 2003, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2003 Peter Kelly (pmk@post.com)
+ * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ */
+
+#include "config.h"
+#include "ArrayConstructor.h"
+
+#include "ArrayPrototype.h"
+#include "Error.h"
+#include "ExceptionHelpers.h"
+#include "JSArray.h"
+#include "JSFunction.h"
+#include "Lookup.h"
+#include "PrototypeFunction.h"
+
+namespace JSC {
+
+ASSERT_CLASS_FITS_IN_CELL(ArrayConstructor);
+
+static EncodedJSValue JSC_HOST_CALL arrayConstructorIsArray(ExecState*);
+
+ArrayConstructor::ArrayConstructor(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, ArrayPrototype* arrayPrototype, Structure* prototypeFunctionStructure)
+ : InternalFunction(&exec->globalData(), globalObject, structure, Identifier(exec, arrayPrototype->classInfo()->className))
+{
+ // ECMA 15.4.3.1 Array.prototype
+ putDirectWithoutTransition(exec->propertyNames().prototype, arrayPrototype, DontEnum | DontDelete | ReadOnly);
+
+ // no. of arguments for constructor
+ putDirectWithoutTransition(exec->propertyNames().length, jsNumber(1), ReadOnly | DontEnum | DontDelete);
+
+ // ES5
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 1, exec->propertyNames().isArray, arrayConstructorIsArray), DontEnum);
+}
+
+static inline JSObject* constructArrayWithSizeQuirk(ExecState* exec, const ArgList& args)
+{
+ // a single numeric argument denotes the array size (!)
+ if (args.size() == 1 && args.at(0).isNumber()) {
+ uint32_t n = args.at(0).toUInt32(exec);
+ if (n != args.at(0).toNumber(exec))
+ return throwError(exec, createRangeError(exec, "Array size is not a small enough positive integer."));
+ return new (exec) JSArray(exec->lexicalGlobalObject()->arrayStructure(), n, CreateInitialized);
+ }
+
+ // otherwise the array is constructed with the arguments in it
+ return new (exec) JSArray(exec->lexicalGlobalObject()->arrayStructure(), args);
+}
+
+static EncodedJSValue JSC_HOST_CALL constructWithArrayConstructor(ExecState* exec)
+{
+ ArgList args(exec);
+ return JSValue::encode(constructArrayWithSizeQuirk(exec, args));
+}
+
+// ECMA 15.4.2
+ConstructType ArrayConstructor::getConstructData(ConstructData& constructData)
+{
+ constructData.native.function = constructWithArrayConstructor;
+ return ConstructTypeHost;
+}
+
+static EncodedJSValue JSC_HOST_CALL callArrayConstructor(ExecState* exec)
+{
+ ArgList args(exec);
+ return JSValue::encode(constructArrayWithSizeQuirk(exec, args));
+}
+
+// ECMA 15.6.1
+CallType ArrayConstructor::getCallData(CallData& callData)
+{
+ // equivalent to 'new Array(....)'
+ callData.native.function = callArrayConstructor;
+ return CallTypeHost;
+}
+
+EncodedJSValue JSC_HOST_CALL arrayConstructorIsArray(ExecState* exec)
+{
+ return JSValue::encode(jsBoolean(exec->argument(0).inherits(&JSArray::info)));
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/ArrayConstructor.h b/Source/JavaScriptCore/runtime/ArrayConstructor.h
new file mode 100644
index 0000000..5e1408f
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/ArrayConstructor.h
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifndef ArrayConstructor_h
+#define ArrayConstructor_h
+
+#include "InternalFunction.h"
+
+namespace JSC {
+
+ class ArrayPrototype;
+
+ class ArrayConstructor : public InternalFunction {
+ public:
+ ArrayConstructor(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure>, ArrayPrototype*, Structure*);
+
+ virtual ConstructType getConstructData(ConstructData&);
+ virtual CallType getCallData(CallData&);
+ };
+
+} // namespace JSC
+
+#endif // ArrayConstructor_h
diff --git a/Source/JavaScriptCore/runtime/ArrayPrototype.cpp b/Source/JavaScriptCore/runtime/ArrayPrototype.cpp
new file mode 100644
index 0000000..ab0c3d4
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/ArrayPrototype.cpp
@@ -0,0 +1,1098 @@
+/*
+ * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
+ * Copyright (C) 2003, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2003 Peter Kelly (pmk@post.com)
+ * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ */
+
+#include "config.h"
+#include "ArrayPrototype.h"
+
+#include "CachedCall.h"
+#include "CodeBlock.h"
+#include "Interpreter.h"
+#include "JIT.h"
+#include "JSStringBuilder.h"
+#include "Lookup.h"
+#include "ObjectPrototype.h"
+#include "Operations.h"
+#include <algorithm>
+#include <wtf/Assertions.h>
+#include <wtf/HashSet.h>
+
+namespace JSC {
+
+ASSERT_CLASS_FITS_IN_CELL(ArrayPrototype);
+
+static EncodedJSValue JSC_HOST_CALL arrayProtoFuncToString(ExecState*);
+static EncodedJSValue JSC_HOST_CALL arrayProtoFuncToLocaleString(ExecState*);
+static EncodedJSValue JSC_HOST_CALL arrayProtoFuncConcat(ExecState*);
+static EncodedJSValue JSC_HOST_CALL arrayProtoFuncJoin(ExecState*);
+static EncodedJSValue JSC_HOST_CALL arrayProtoFuncPop(ExecState*);
+static EncodedJSValue JSC_HOST_CALL arrayProtoFuncPush(ExecState*);
+static EncodedJSValue JSC_HOST_CALL arrayProtoFuncReverse(ExecState*);
+static EncodedJSValue JSC_HOST_CALL arrayProtoFuncShift(ExecState*);
+static EncodedJSValue JSC_HOST_CALL arrayProtoFuncSlice(ExecState*);
+static EncodedJSValue JSC_HOST_CALL arrayProtoFuncSort(ExecState*);
+static EncodedJSValue JSC_HOST_CALL arrayProtoFuncSplice(ExecState*);
+static EncodedJSValue JSC_HOST_CALL arrayProtoFuncUnShift(ExecState*);
+static EncodedJSValue JSC_HOST_CALL arrayProtoFuncEvery(ExecState*);
+static EncodedJSValue JSC_HOST_CALL arrayProtoFuncForEach(ExecState*);
+static EncodedJSValue JSC_HOST_CALL arrayProtoFuncSome(ExecState*);
+static EncodedJSValue JSC_HOST_CALL arrayProtoFuncIndexOf(ExecState*);
+static EncodedJSValue JSC_HOST_CALL arrayProtoFuncFilter(ExecState*);
+static EncodedJSValue JSC_HOST_CALL arrayProtoFuncMap(ExecState*);
+static EncodedJSValue JSC_HOST_CALL arrayProtoFuncReduce(ExecState*);
+static EncodedJSValue JSC_HOST_CALL arrayProtoFuncReduceRight(ExecState*);
+static EncodedJSValue JSC_HOST_CALL arrayProtoFuncLastIndexOf(ExecState*);
+
+}
+
+#include "ArrayPrototype.lut.h"
+
+namespace JSC {
+
+static inline bool isNumericCompareFunction(ExecState* exec, CallType callType, const CallData& callData)
+{
+ if (callType != CallTypeJS)
+ return false;
+
+ FunctionExecutable* executable = callData.js.functionExecutable;
+
+ JSObject* error = executable->compileForCall(exec, callData.js.scopeChain);
+ if (error)
+ return false;
+
+ return executable->generatedBytecodeForCall().isNumericCompareFunction();
+}
+
+// ------------------------------ ArrayPrototype ----------------------------
+
+const ClassInfo ArrayPrototype::info = {"Array", &JSArray::info, 0, ExecState::arrayTable};
+
+/* Source for ArrayPrototype.lut.h
+@begin arrayTable 16
+ toString arrayProtoFuncToString DontEnum|Function 0
+ toLocaleString arrayProtoFuncToLocaleString DontEnum|Function 0
+ concat arrayProtoFuncConcat DontEnum|Function 1
+ join arrayProtoFuncJoin DontEnum|Function 1
+ pop arrayProtoFuncPop DontEnum|Function 0
+ push arrayProtoFuncPush DontEnum|Function 1
+ reverse arrayProtoFuncReverse DontEnum|Function 0
+ shift arrayProtoFuncShift DontEnum|Function 0
+ slice arrayProtoFuncSlice DontEnum|Function 2
+ sort arrayProtoFuncSort DontEnum|Function 1
+ splice arrayProtoFuncSplice DontEnum|Function 2
+ unshift arrayProtoFuncUnShift DontEnum|Function 1
+ every arrayProtoFuncEvery DontEnum|Function 1
+ forEach arrayProtoFuncForEach DontEnum|Function 1
+ some arrayProtoFuncSome DontEnum|Function 1
+ indexOf arrayProtoFuncIndexOf DontEnum|Function 1
+ lastIndexOf arrayProtoFuncLastIndexOf DontEnum|Function 1
+ filter arrayProtoFuncFilter DontEnum|Function 1
+ reduce arrayProtoFuncReduce DontEnum|Function 1
+ reduceRight arrayProtoFuncReduceRight DontEnum|Function 1
+ map arrayProtoFuncMap DontEnum|Function 1
+@end
+*/
+
+// ECMA 15.4.4
+ArrayPrototype::ArrayPrototype(JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure)
+ : JSArray(structure)
+{
+ putAnonymousValue(0, globalObject);
+}
+
+bool ArrayPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
+{
+ return getStaticFunctionSlot<JSArray>(exec, ExecState::arrayTable(exec), this, propertyName, slot);
+}
+
+bool ArrayPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
+{
+ return getStaticFunctionDescriptor<JSArray>(exec, ExecState::arrayTable(exec), this, propertyName, descriptor);
+}
+
+// ------------------------------ Array Functions ----------------------------
+
+// Helper function
+static JSValue getProperty(ExecState* exec, JSObject* obj, unsigned index)
+{
+ PropertySlot slot(obj);
+ if (!obj->getPropertySlot(exec, index, slot))
+ return JSValue();
+ return slot.getValue(exec, index);
+}
+
+static void putProperty(ExecState* exec, JSObject* obj, const Identifier& propertyName, JSValue value)
+{
+ PutPropertySlot slot;
+ obj->put(exec, propertyName, value, slot);
+}
+
+static unsigned argumentClampedIndexFromStartOrEnd(ExecState* exec, int argument, unsigned length, unsigned undefinedValue = 0)
+{
+ JSValue value = exec->argument(argument);
+ if (value.isUndefined())
+ return undefinedValue;
+
+ double indexDouble = value.toInteger(exec);
+ if (indexDouble < 0) {
+ indexDouble += length;
+ return indexDouble < 0 ? 0 : static_cast<unsigned>(indexDouble);
+ }
+ return indexDouble > length ? length : static_cast<unsigned>(indexDouble);
+}
+
+EncodedJSValue JSC_HOST_CALL arrayProtoFuncToString(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ bool isRealArray = isJSArray(&exec->globalData(), thisValue);
+ if (!isRealArray && !thisValue.inherits(&JSArray::info))
+ return throwVMTypeError(exec);
+ JSArray* thisObj = asArray(thisValue);
+
+ HashSet<JSObject*>& arrayVisitedElements = exec->globalData().arrayVisitedElements;
+ if (arrayVisitedElements.size() >= MaxSmallThreadReentryDepth) {
+ if (arrayVisitedElements.size() >= exec->globalData().maxReentryDepth)
+ return throwVMError(exec, createStackOverflowError(exec));
+ }
+
+ bool alreadyVisited = !arrayVisitedElements.add(thisObj).second;
+ if (alreadyVisited)
+ return JSValue::encode(jsEmptyString(exec)); // return an empty string, avoiding infinite recursion.
+
+ unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec);
+ unsigned totalSize = length ? length - 1 : 0;
+#if OS(SYMBIAN)
+ // Symbian has very limited stack size available.
+ // This function could be called recursively and allocating 1K on stack here cause
+ // stack overflow on Symbian devices.
+ Vector<RefPtr<StringImpl> > strBuffer(length);
+#else
+ Vector<RefPtr<StringImpl>, 256> strBuffer(length);
+#endif
+ for (unsigned k = 0; k < length; k++) {
+ JSValue element;
+ if (isRealArray && thisObj->canGetIndex(k))
+ element = thisObj->getIndex(k);
+ else
+ element = thisObj->get(exec, k);
+
+ if (element.isUndefinedOrNull())
+ continue;
+
+ UString str = element.toString(exec);
+ strBuffer[k] = str.impl();
+ totalSize += str.length();
+
+ if (!strBuffer.data()) {
+ throwOutOfMemoryError(exec);
+ }
+
+ if (exec->hadException())
+ break;
+ }
+ arrayVisitedElements.remove(thisObj);
+ if (!totalSize)
+ return JSValue::encode(jsEmptyString(exec));
+ Vector<UChar> buffer;
+ buffer.reserveCapacity(totalSize);
+ if (!buffer.data())
+ return JSValue::encode(throwOutOfMemoryError(exec));
+
+ for (unsigned i = 0; i < length; i++) {
+ if (i)
+ buffer.append(',');
+ if (RefPtr<StringImpl> rep = strBuffer[i])
+ buffer.append(rep->characters(), rep->length());
+ }
+ ASSERT(buffer.size() == totalSize);
+ return JSValue::encode(jsString(exec, UString::adopt(buffer)));
+}
+
+EncodedJSValue JSC_HOST_CALL arrayProtoFuncToLocaleString(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ if (!thisValue.inherits(&JSArray::info))
+ return throwVMTypeError(exec);
+ JSObject* thisObj = asArray(thisValue);
+
+ HashSet<JSObject*>& arrayVisitedElements = exec->globalData().arrayVisitedElements;
+ if (arrayVisitedElements.size() >= MaxSmallThreadReentryDepth) {
+ if (arrayVisitedElements.size() >= exec->globalData().maxReentryDepth)
+ return throwVMError(exec, createStackOverflowError(exec));
+ }
+
+ bool alreadyVisited = !arrayVisitedElements.add(thisObj).second;
+ if (alreadyVisited)
+ return JSValue::encode(jsEmptyString(exec)); // return an empty string, avoding infinite recursion.
+
+ JSStringBuilder strBuffer;
+ unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec);
+ for (unsigned k = 0; k < length; k++) {
+ if (k >= 1)
+ strBuffer.append(',');
+
+ JSValue element = thisObj->get(exec, k);
+ if (!element.isUndefinedOrNull()) {
+ JSObject* o = element.toObject(exec);
+ JSValue conversionFunction = o->get(exec, exec->propertyNames().toLocaleString);
+ UString str;
+ CallData callData;
+ CallType callType = getCallData(conversionFunction, callData);
+ if (callType != CallTypeNone)
+ str = call(exec, conversionFunction, callType, callData, element, exec->emptyList()).toString(exec);
+ else
+ str = element.toString(exec);
+ strBuffer.append(str);
+ }
+ }
+ arrayVisitedElements.remove(thisObj);
+ return JSValue::encode(strBuffer.build(exec));
+}
+
+EncodedJSValue JSC_HOST_CALL arrayProtoFuncJoin(ExecState* exec)
+{
+ JSObject* thisObj = exec->hostThisValue().toThisObject(exec);
+
+ HashSet<JSObject*>& arrayVisitedElements = exec->globalData().arrayVisitedElements;
+ if (arrayVisitedElements.size() >= MaxSmallThreadReentryDepth) {
+ if (arrayVisitedElements.size() >= exec->globalData().maxReentryDepth)
+ return throwVMError(exec, createStackOverflowError(exec));
+ }
+
+ bool alreadyVisited = !arrayVisitedElements.add(thisObj).second;
+ if (alreadyVisited)
+ return JSValue::encode(jsEmptyString(exec)); // return an empty string, avoding infinite recursion.
+
+ JSStringBuilder strBuffer;
+
+ UString separator;
+ if (!exec->argument(0).isUndefined())
+ separator = exec->argument(0).toString(exec);
+
+ unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec);
+ unsigned k = 0;
+ if (isJSArray(&exec->globalData(), thisObj)) {
+ JSArray* array = asArray(thisObj);
+
+ if (length) {
+ if (!array->canGetIndex(k))
+ goto skipFirstLoop;
+ JSValue element = array->getIndex(k);
+ if (!element.isUndefinedOrNull())
+ strBuffer.append(element.toString(exec));
+ k++;
+ }
+
+ if (separator.isNull()) {
+ for (; k < length; k++) {
+ if (!array->canGetIndex(k))
+ break;
+ strBuffer.append(',');
+ JSValue element = array->getIndex(k);
+ if (!element.isUndefinedOrNull())
+ strBuffer.append(element.toString(exec));
+ }
+ } else {
+ for (; k < length; k++) {
+ if (!array->canGetIndex(k))
+ break;
+ strBuffer.append(separator);
+ JSValue element = array->getIndex(k);
+ if (!element.isUndefinedOrNull())
+ strBuffer.append(element.toString(exec));
+ }
+ }
+ }
+ skipFirstLoop:
+ for (; k < length; k++) {
+ if (k >= 1) {
+ if (separator.isNull())
+ strBuffer.append(',');
+ else
+ strBuffer.append(separator);
+ }
+
+ JSValue element = thisObj->get(exec, k);
+ if (!element.isUndefinedOrNull())
+ strBuffer.append(element.toString(exec));
+ }
+ arrayVisitedElements.remove(thisObj);
+ return JSValue::encode(strBuffer.build(exec));
+}
+
+EncodedJSValue JSC_HOST_CALL arrayProtoFuncConcat(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ JSArray* arr = constructEmptyArray(exec);
+ unsigned n = 0;
+ JSValue curArg = thisValue.toThisObject(exec);
+ size_t i = 0;
+ size_t argCount = exec->argumentCount();
+ while (1) {
+ if (curArg.inherits(&JSArray::info)) {
+ unsigned length = curArg.get(exec, exec->propertyNames().length).toUInt32(exec);
+ JSObject* curObject = curArg.toObject(exec);
+ for (unsigned k = 0; k < length; ++k) {
+ if (JSValue v = getProperty(exec, curObject, k))
+ arr->put(exec, n, v);
+ n++;
+ }
+ } else {
+ arr->put(exec, n, curArg);
+ n++;
+ }
+ if (i == argCount)
+ break;
+ curArg = (exec->argument(i));
+ ++i;
+ }
+ arr->setLength(n);
+ return JSValue::encode(arr);
+}
+
+EncodedJSValue JSC_HOST_CALL arrayProtoFuncPop(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ if (isJSArray(&exec->globalData(), thisValue))
+ return JSValue::encode(asArray(thisValue)->pop());
+
+ JSObject* thisObj = thisValue.toThisObject(exec);
+ JSValue result;
+ unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec);
+ if (length == 0) {
+ putProperty(exec, thisObj, exec->propertyNames().length, jsNumber(length));
+ result = jsUndefined();
+ } else {
+ result = thisObj->get(exec, length - 1);
+ thisObj->deleteProperty(exec, length - 1);
+ putProperty(exec, thisObj, exec->propertyNames().length, jsNumber(length - 1));
+ }
+ return JSValue::encode(result);
+}
+
+EncodedJSValue JSC_HOST_CALL arrayProtoFuncPush(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ if (isJSArray(&exec->globalData(), thisValue) && exec->argumentCount() == 1) {
+ JSArray* array = asArray(thisValue);
+ array->push(exec, exec->argument(0));
+ return JSValue::encode(jsNumber(array->length()));
+ }
+
+ JSObject* thisObj = thisValue.toThisObject(exec);
+ unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec);
+ for (unsigned n = 0; n < exec->argumentCount(); n++)
+ thisObj->put(exec, length + n, exec->argument(n));
+ length += exec->argumentCount();
+ putProperty(exec, thisObj, exec->propertyNames().length, jsNumber(length));
+ return JSValue::encode(jsNumber(length));
+}
+
+EncodedJSValue JSC_HOST_CALL arrayProtoFuncReverse(ExecState* exec)
+{
+ JSObject* thisObj = exec->hostThisValue().toThisObject(exec);
+ unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec);
+ unsigned middle = length / 2;
+
+ for (unsigned k = 0; k < middle; k++) {
+ unsigned lk1 = length - k - 1;
+ JSValue obj2 = getProperty(exec, thisObj, lk1);
+ JSValue obj = getProperty(exec, thisObj, k);
+
+ if (obj2)
+ thisObj->put(exec, k, obj2);
+ else
+ thisObj->deleteProperty(exec, k);
+
+ if (obj)
+ thisObj->put(exec, lk1, obj);
+ else
+ thisObj->deleteProperty(exec, lk1);
+ }
+ return JSValue::encode(thisObj);
+}
+
+EncodedJSValue JSC_HOST_CALL arrayProtoFuncShift(ExecState* exec)
+{
+ JSObject* thisObj = exec->hostThisValue().toThisObject(exec);
+ JSValue result;
+
+ unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec);
+ if (length == 0) {
+ putProperty(exec, thisObj, exec->propertyNames().length, jsNumber(length));
+ result = jsUndefined();
+ } else {
+ result = thisObj->get(exec, 0);
+ if (isJSArray(&exec->globalData(), thisObj))
+ ((JSArray *)thisObj)->shiftCount(exec, 1);
+ else {
+ for (unsigned k = 1; k < length; k++) {
+ if (JSValue obj = getProperty(exec, thisObj, k))
+ thisObj->put(exec, k - 1, obj);
+ else
+ thisObj->deleteProperty(exec, k - 1);
+ }
+ thisObj->deleteProperty(exec, length - 1);
+ }
+ putProperty(exec, thisObj, exec->propertyNames().length, jsNumber(length - 1));
+ }
+ return JSValue::encode(result);
+}
+
+EncodedJSValue JSC_HOST_CALL arrayProtoFuncSlice(ExecState* exec)
+{
+ // http://developer.netscape.com/docs/manuals/js/client/jsref/array.htm#1193713 or 15.4.4.10
+ JSObject* thisObj = exec->hostThisValue().toThisObject(exec);
+
+ // We return a new array
+ JSArray* resObj = constructEmptyArray(exec);
+ JSValue result = resObj;
+
+ unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec);
+ unsigned begin = argumentClampedIndexFromStartOrEnd(exec, 0, length);
+ unsigned end = argumentClampedIndexFromStartOrEnd(exec, 1, length, length);
+
+ unsigned n = 0;
+ for (unsigned k = begin; k < end; k++, n++) {
+ if (JSValue v = getProperty(exec, thisObj, k))
+ resObj->put(exec, n, v);
+ }
+ resObj->setLength(n);
+ return JSValue::encode(result);
+}
+
+EncodedJSValue JSC_HOST_CALL arrayProtoFuncSort(ExecState* exec)
+{
+ JSObject* thisObj = exec->hostThisValue().toThisObject(exec);
+
+ JSValue function = exec->argument(0);
+ CallData callData;
+ CallType callType = getCallData(function, callData);
+
+ if (thisObj->classInfo() == &JSArray::info) {
+ if (isNumericCompareFunction(exec, callType, callData))
+ asArray(thisObj)->sortNumeric(exec, function, callType, callData);
+ else if (callType != CallTypeNone)
+ asArray(thisObj)->sort(exec, function, callType, callData);
+ else
+ asArray(thisObj)->sort(exec);
+ return JSValue::encode(thisObj);
+ }
+
+ unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec);
+
+ if (!length)
+ return JSValue::encode(thisObj);
+
+ // "Min" sort. Not the fastest, but definitely less code than heapsort
+ // or quicksort, and much less swapping than bubblesort/insertionsort.
+ for (unsigned i = 0; i < length - 1; ++i) {
+ JSValue iObj = thisObj->get(exec, i);
+ unsigned themin = i;
+ JSValue minObj = iObj;
+ for (unsigned j = i + 1; j < length; ++j) {
+ JSValue jObj = thisObj->get(exec, j);
+ double compareResult;
+ if (jObj.isUndefined())
+ compareResult = 1; // don't check minObj because there's no need to differentiate == (0) from > (1)
+ else if (minObj.isUndefined())
+ compareResult = -1;
+ else if (callType != CallTypeNone) {
+ MarkedArgumentBuffer l;
+ l.append(jObj);
+ l.append(minObj);
+ compareResult = call(exec, function, callType, callData, exec->globalThisValue(), l).toNumber(exec);
+ } else
+ compareResult = (jObj.toString(exec) < minObj.toString(exec)) ? -1 : 1;
+
+ if (compareResult < 0) {
+ themin = j;
+ minObj = jObj;
+ }
+ }
+ // Swap themin and i
+ if (themin > i) {
+ thisObj->put(exec, i, minObj);
+ thisObj->put(exec, themin, iObj);
+ }
+ }
+ return JSValue::encode(thisObj);
+}
+
+EncodedJSValue JSC_HOST_CALL arrayProtoFuncSplice(ExecState* exec)
+{
+ JSObject* thisObj = exec->hostThisValue().toThisObject(exec);
+
+ // 15.4.4.12
+
+ if (!exec->argumentCount())
+ return JSValue::encode(constructEmptyArray(exec));
+
+ unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec);
+ unsigned begin = argumentClampedIndexFromStartOrEnd(exec, 0, length);
+
+ unsigned deleteCount = length - begin;
+ if (exec->argumentCount() > 1) {
+ double deleteDouble = exec->argument(1).toInteger(exec);
+ if (deleteDouble < 0)
+ deleteCount = 0;
+ else if (deleteDouble > length - begin)
+ deleteCount = length - begin;
+ else
+ deleteCount = static_cast<unsigned>(deleteDouble);
+ }
+
+ JSArray* resObj = new (exec) JSArray(exec->lexicalGlobalObject()->arrayStructure(), deleteCount, CreateCompact);
+ JSValue result = resObj;
+
+ for (unsigned k = 0; k < deleteCount; k++)
+ resObj->uncheckedSetIndex(k, getProperty(exec, thisObj, k + begin));
+
+ resObj->setLength(deleteCount);
+
+ unsigned additionalArgs = std::max<int>(exec->argumentCount() - 2, 0);
+ if (additionalArgs != deleteCount) {
+ if (additionalArgs < deleteCount) {
+ if ((!begin) && (isJSArray(&exec->globalData(), thisObj)))
+ ((JSArray *)thisObj)->shiftCount(exec, deleteCount - additionalArgs);
+ else {
+ for (unsigned k = begin; k < length - deleteCount; ++k) {
+ if (JSValue v = getProperty(exec, thisObj, k + deleteCount))
+ thisObj->put(exec, k + additionalArgs, v);
+ else
+ thisObj->deleteProperty(exec, k + additionalArgs);
+ }
+ for (unsigned k = length; k > length - deleteCount + additionalArgs; --k)
+ thisObj->deleteProperty(exec, k - 1);
+ }
+ } else {
+ if ((!begin) && (isJSArray(&exec->globalData(), thisObj)))
+ ((JSArray *)thisObj)->unshiftCount(exec, additionalArgs - deleteCount);
+ else {
+ for (unsigned k = length - deleteCount; k > begin; --k) {
+ if (JSValue obj = getProperty(exec, thisObj, k + deleteCount - 1))
+ thisObj->put(exec, k + additionalArgs - 1, obj);
+ else
+ thisObj->deleteProperty(exec, k + additionalArgs - 1);
+ }
+ }
+ }
+ }
+ for (unsigned k = 0; k < additionalArgs; ++k)
+ thisObj->put(exec, k + begin, exec->argument(k + 2));
+
+ putProperty(exec, thisObj, exec->propertyNames().length, jsNumber(length - deleteCount + additionalArgs));
+ return JSValue::encode(result);
+}
+
+EncodedJSValue JSC_HOST_CALL arrayProtoFuncUnShift(ExecState* exec)
+{
+ JSObject* thisObj = exec->hostThisValue().toThisObject(exec);
+
+ // 15.4.4.13
+ unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec);
+ unsigned nrArgs = exec->argumentCount();
+ if ((nrArgs) && (length)) {
+ if (isJSArray(&exec->globalData(), thisObj))
+ ((JSArray *)thisObj)->unshiftCount(exec, nrArgs);
+ else {
+ for (unsigned k = length; k > 0; --k) {
+ if (JSValue v = getProperty(exec, thisObj, k - 1))
+ thisObj->put(exec, k + nrArgs - 1, v);
+ else
+ thisObj->deleteProperty(exec, k + nrArgs - 1);
+ }
+ }
+ }
+ for (unsigned k = 0; k < nrArgs; ++k)
+ thisObj->put(exec, k, exec->argument(k));
+ JSValue result = jsNumber(length + nrArgs);
+ putProperty(exec, thisObj, exec->propertyNames().length, result);
+ return JSValue::encode(result);
+}
+
+EncodedJSValue JSC_HOST_CALL arrayProtoFuncFilter(ExecState* exec)
+{
+ JSObject* thisObj = exec->hostThisValue().toThisObject(exec);
+
+ JSValue function = exec->argument(0);
+ CallData callData;
+ CallType callType = getCallData(function, callData);
+ if (callType == CallTypeNone)
+ return throwVMTypeError(exec);
+
+ JSObject* applyThis = exec->argument(1).isUndefinedOrNull() ? exec->globalThisValue() : exec->argument(1).toObject(exec);
+ JSArray* resultArray = constructEmptyArray(exec);
+
+ unsigned filterIndex = 0;
+ unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec);
+ unsigned k = 0;
+ if (callType == CallTypeJS && isJSArray(&exec->globalData(), thisObj)) {
+ JSFunction* f = asFunction(function);
+ JSArray* array = asArray(thisObj);
+ CachedCall cachedCall(exec, f, 3);
+ for (; k < length && !exec->hadException(); ++k) {
+ if (!array->canGetIndex(k))
+ break;
+ JSValue v = array->getIndex(k);
+ cachedCall.setThis(applyThis);
+ cachedCall.setArgument(0, v);
+ cachedCall.setArgument(1, jsNumber(k));
+ cachedCall.setArgument(2, thisObj);
+
+ JSValue result = cachedCall.call();
+ if (result.toBoolean(exec))
+ resultArray->put(exec, filterIndex++, v);
+ }
+ if (k == length)
+ return JSValue::encode(resultArray);
+ }
+ for (; k < length && !exec->hadException(); ++k) {
+ PropertySlot slot(thisObj);
+
+ if (!thisObj->getPropertySlot(exec, k, slot))
+ continue;
+
+ JSValue v = slot.getValue(exec, k);
+
+ MarkedArgumentBuffer eachArguments;
+
+ eachArguments.append(v);
+ eachArguments.append(jsNumber(k));
+ eachArguments.append(thisObj);
+
+ JSValue result = call(exec, function, callType, callData, applyThis, eachArguments);
+
+ if (result.toBoolean(exec))
+ resultArray->put(exec, filterIndex++, v);
+ }
+ return JSValue::encode(resultArray);
+}
+
+EncodedJSValue JSC_HOST_CALL arrayProtoFuncMap(ExecState* exec)
+{
+ JSObject* thisObj = exec->hostThisValue().toThisObject(exec);
+
+ JSValue function = exec->argument(0);
+ CallData callData;
+ CallType callType = getCallData(function, callData);
+ if (callType == CallTypeNone)
+ return throwVMTypeError(exec);
+
+ JSObject* applyThis = exec->argument(1).isUndefinedOrNull() ? exec->globalThisValue() : exec->argument(1).toObject(exec);
+
+ unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec);
+
+ JSArray* resultArray = constructEmptyArray(exec, length);
+ unsigned k = 0;
+ if (callType == CallTypeJS && isJSArray(&exec->globalData(), thisObj)) {
+ JSFunction* f = asFunction(function);
+ JSArray* array = asArray(thisObj);
+ CachedCall cachedCall(exec, f, 3);
+ for (; k < length && !exec->hadException(); ++k) {
+ if (UNLIKELY(!array->canGetIndex(k)))
+ break;
+
+ cachedCall.setThis(applyThis);
+ cachedCall.setArgument(0, array->getIndex(k));
+ cachedCall.setArgument(1, jsNumber(k));
+ cachedCall.setArgument(2, thisObj);
+
+ resultArray->JSArray::put(exec, k, cachedCall.call());
+ }
+ }
+ for (; k < length && !exec->hadException(); ++k) {
+ PropertySlot slot(thisObj);
+ if (!thisObj->getPropertySlot(exec, k, slot))
+ continue;
+
+ JSValue v = slot.getValue(exec, k);
+
+ MarkedArgumentBuffer eachArguments;
+
+ eachArguments.append(v);
+ eachArguments.append(jsNumber(k));
+ eachArguments.append(thisObj);
+
+ JSValue result = call(exec, function, callType, callData, applyThis, eachArguments);
+ resultArray->put(exec, k, result);
+ }
+
+ return JSValue::encode(resultArray);
+}
+
+// Documentation for these three is available at:
+// http://developer-test.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Objects:Array:every
+// http://developer-test.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Objects:Array:forEach
+// http://developer-test.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Objects:Array:some
+
+EncodedJSValue JSC_HOST_CALL arrayProtoFuncEvery(ExecState* exec)
+{
+ JSObject* thisObj = exec->hostThisValue().toThisObject(exec);
+
+ JSValue function = exec->argument(0);
+ CallData callData;
+ CallType callType = getCallData(function, callData);
+ if (callType == CallTypeNone)
+ return throwVMTypeError(exec);
+
+ JSObject* applyThis = exec->argument(1).isUndefinedOrNull() ? exec->globalThisValue() : exec->argument(1).toObject(exec);
+
+ JSValue result = jsBoolean(true);
+
+ unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec);
+ unsigned k = 0;
+ if (callType == CallTypeJS && isJSArray(&exec->globalData(), thisObj)) {
+ JSFunction* f = asFunction(function);
+ JSArray* array = asArray(thisObj);
+ CachedCall cachedCall(exec, f, 3);
+ for (; k < length && !exec->hadException(); ++k) {
+ if (UNLIKELY(!array->canGetIndex(k)))
+ break;
+
+ cachedCall.setThis(applyThis);
+ cachedCall.setArgument(0, array->getIndex(k));
+ cachedCall.setArgument(1, jsNumber(k));
+ cachedCall.setArgument(2, thisObj);
+ JSValue result = cachedCall.call();
+ if (!result.toBoolean(cachedCall.newCallFrame(exec)))
+ return JSValue::encode(jsBoolean(false));
+ }
+ }
+ for (; k < length && !exec->hadException(); ++k) {
+ PropertySlot slot(thisObj);
+
+ if (!thisObj->getPropertySlot(exec, k, slot))
+ continue;
+
+ MarkedArgumentBuffer eachArguments;
+
+ eachArguments.append(slot.getValue(exec, k));
+ eachArguments.append(jsNumber(k));
+ eachArguments.append(thisObj);
+
+ bool predicateResult = call(exec, function, callType, callData, applyThis, eachArguments).toBoolean(exec);
+
+ if (!predicateResult) {
+ result = jsBoolean(false);
+ break;
+ }
+ }
+
+ return JSValue::encode(result);
+}
+
+EncodedJSValue JSC_HOST_CALL arrayProtoFuncForEach(ExecState* exec)
+{
+ JSObject* thisObj = exec->hostThisValue().toThisObject(exec);
+
+ JSValue function = exec->argument(0);
+ CallData callData;
+ CallType callType = getCallData(function, callData);
+ if (callType == CallTypeNone)
+ return throwVMTypeError(exec);
+
+ JSObject* applyThis = exec->argument(1).isUndefinedOrNull() ? exec->globalThisValue() : exec->argument(1).toObject(exec);
+
+ unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec);
+ unsigned k = 0;
+ if (callType == CallTypeJS && isJSArray(&exec->globalData(), thisObj)) {
+ JSFunction* f = asFunction(function);
+ JSArray* array = asArray(thisObj);
+ CachedCall cachedCall(exec, f, 3);
+ for (; k < length && !exec->hadException(); ++k) {
+ if (UNLIKELY(!array->canGetIndex(k)))
+ break;
+
+ cachedCall.setThis(applyThis);
+ cachedCall.setArgument(0, array->getIndex(k));
+ cachedCall.setArgument(1, jsNumber(k));
+ cachedCall.setArgument(2, thisObj);
+
+ cachedCall.call();
+ }
+ }
+ for (; k < length && !exec->hadException(); ++k) {
+ PropertySlot slot(thisObj);
+ if (!thisObj->getPropertySlot(exec, k, slot))
+ continue;
+
+ MarkedArgumentBuffer eachArguments;
+ eachArguments.append(slot.getValue(exec, k));
+ eachArguments.append(jsNumber(k));
+ eachArguments.append(thisObj);
+
+ call(exec, function, callType, callData, applyThis, eachArguments);
+ }
+ return JSValue::encode(jsUndefined());
+}
+
+EncodedJSValue JSC_HOST_CALL arrayProtoFuncSome(ExecState* exec)
+{
+ JSObject* thisObj = exec->hostThisValue().toThisObject(exec);
+
+ JSValue function = exec->argument(0);
+ CallData callData;
+ CallType callType = getCallData(function, callData);
+ if (callType == CallTypeNone)
+ return throwVMTypeError(exec);
+
+ JSObject* applyThis = exec->argument(1).isUndefinedOrNull() ? exec->globalThisValue() : exec->argument(1).toObject(exec);
+
+ JSValue result = jsBoolean(false);
+
+ unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec);
+ unsigned k = 0;
+ if (callType == CallTypeJS && isJSArray(&exec->globalData(), thisObj)) {
+ JSFunction* f = asFunction(function);
+ JSArray* array = asArray(thisObj);
+ CachedCall cachedCall(exec, f, 3);
+ for (; k < length && !exec->hadException(); ++k) {
+ if (UNLIKELY(!array->canGetIndex(k)))
+ break;
+
+ cachedCall.setThis(applyThis);
+ cachedCall.setArgument(0, array->getIndex(k));
+ cachedCall.setArgument(1, jsNumber(k));
+ cachedCall.setArgument(2, thisObj);
+ JSValue result = cachedCall.call();
+ if (result.toBoolean(cachedCall.newCallFrame(exec)))
+ return JSValue::encode(jsBoolean(true));
+ }
+ }
+ for (; k < length && !exec->hadException(); ++k) {
+ PropertySlot slot(thisObj);
+ if (!thisObj->getPropertySlot(exec, k, slot))
+ continue;
+
+ MarkedArgumentBuffer eachArguments;
+ eachArguments.append(slot.getValue(exec, k));
+ eachArguments.append(jsNumber(k));
+ eachArguments.append(thisObj);
+
+ bool predicateResult = call(exec, function, callType, callData, applyThis, eachArguments).toBoolean(exec);
+
+ if (predicateResult) {
+ result = jsBoolean(true);
+ break;
+ }
+ }
+ return JSValue::encode(result);
+}
+
+EncodedJSValue JSC_HOST_CALL arrayProtoFuncReduce(ExecState* exec)
+{
+ JSObject* thisObj = exec->hostThisValue().toThisObject(exec);
+
+ JSValue function = exec->argument(0);
+ CallData callData;
+ CallType callType = getCallData(function, callData);
+ if (callType == CallTypeNone)
+ return throwVMTypeError(exec);
+
+ unsigned i = 0;
+ JSValue rv;
+ unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec);
+ if (!length && exec->argumentCount() == 1)
+ return throwVMTypeError(exec);
+ JSArray* array = 0;
+ if (isJSArray(&exec->globalData(), thisObj))
+ array = asArray(thisObj);
+
+ if (exec->argumentCount() >= 2)
+ rv = exec->argument(1);
+ else if (array && array->canGetIndex(0)){
+ rv = array->getIndex(0);
+ i = 1;
+ } else {
+ for (i = 0; i < length; i++) {
+ rv = getProperty(exec, thisObj, i);
+ if (rv)
+ break;
+ }
+ if (!rv)
+ return throwVMTypeError(exec);
+ i++;
+ }
+
+ if (callType == CallTypeJS && array) {
+ CachedCall cachedCall(exec, asFunction(function), 4);
+ for (; i < length && !exec->hadException(); ++i) {
+ cachedCall.setThis(jsNull());
+ cachedCall.setArgument(0, rv);
+ JSValue v;
+ if (LIKELY(array->canGetIndex(i)))
+ v = array->getIndex(i);
+ else
+ break; // length has been made unsafe while we enumerate fallback to slow path
+ cachedCall.setArgument(1, v);
+ cachedCall.setArgument(2, jsNumber(i));
+ cachedCall.setArgument(3, array);
+ rv = cachedCall.call();
+ }
+ if (i == length) // only return if we reached the end of the array
+ return JSValue::encode(rv);
+ }
+
+ for (; i < length && !exec->hadException(); ++i) {
+ JSValue prop = getProperty(exec, thisObj, i);
+ if (!prop)
+ continue;
+
+ MarkedArgumentBuffer eachArguments;
+ eachArguments.append(rv);
+ eachArguments.append(prop);
+ eachArguments.append(jsNumber(i));
+ eachArguments.append(thisObj);
+
+ rv = call(exec, function, callType, callData, jsNull(), eachArguments);
+ }
+ return JSValue::encode(rv);
+}
+
+EncodedJSValue JSC_HOST_CALL arrayProtoFuncReduceRight(ExecState* exec)
+{
+ JSObject* thisObj = exec->hostThisValue().toThisObject(exec);
+
+ JSValue function = exec->argument(0);
+ CallData callData;
+ CallType callType = getCallData(function, callData);
+ if (callType == CallTypeNone)
+ return throwVMTypeError(exec);
+
+ unsigned i = 0;
+ JSValue rv;
+ unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec);
+ if (!length && exec->argumentCount() == 1)
+ return throwVMTypeError(exec);
+ JSArray* array = 0;
+ if (isJSArray(&exec->globalData(), thisObj))
+ array = asArray(thisObj);
+
+ if (exec->argumentCount() >= 2)
+ rv = exec->argument(1);
+ else if (array && array->canGetIndex(length - 1)){
+ rv = array->getIndex(length - 1);
+ i = 1;
+ } else {
+ for (i = 0; i < length; i++) {
+ rv = getProperty(exec, thisObj, length - i - 1);
+ if (rv)
+ break;
+ }
+ if (!rv)
+ return throwVMTypeError(exec);
+ i++;
+ }
+
+ if (callType == CallTypeJS && array) {
+ CachedCall cachedCall(exec, asFunction(function), 4);
+ for (; i < length && !exec->hadException(); ++i) {
+ unsigned idx = length - i - 1;
+ cachedCall.setThis(jsNull());
+ cachedCall.setArgument(0, rv);
+ if (UNLIKELY(!array->canGetIndex(idx)))
+ break; // length has been made unsafe while we enumerate fallback to slow path
+ cachedCall.setArgument(1, array->getIndex(idx));
+ cachedCall.setArgument(2, jsNumber(idx));
+ cachedCall.setArgument(3, array);
+ rv = cachedCall.call();
+ }
+ if (i == length) // only return if we reached the end of the array
+ return JSValue::encode(rv);
+ }
+
+ for (; i < length && !exec->hadException(); ++i) {
+ unsigned idx = length - i - 1;
+ JSValue prop = getProperty(exec, thisObj, idx);
+ if (!prop)
+ continue;
+
+ MarkedArgumentBuffer eachArguments;
+ eachArguments.append(rv);
+ eachArguments.append(prop);
+ eachArguments.append(jsNumber(idx));
+ eachArguments.append(thisObj);
+
+ rv = call(exec, function, callType, callData, jsNull(), eachArguments);
+ }
+ return JSValue::encode(rv);
+}
+
+EncodedJSValue JSC_HOST_CALL arrayProtoFuncIndexOf(ExecState* exec)
+{
+ // JavaScript 1.5 Extension by Mozilla
+ // Documentation: http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Array:indexOf
+ JSObject* thisObj = exec->hostThisValue().toThisObject(exec);
+
+ unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec);
+ unsigned index = argumentClampedIndexFromStartOrEnd(exec, 1, length);
+
+ JSValue searchElement = exec->argument(0);
+ for (; index < length; ++index) {
+ JSValue e = getProperty(exec, thisObj, index);
+ if (!e)
+ continue;
+ if (JSValue::strictEqual(exec, searchElement, e))
+ return JSValue::encode(jsNumber(index));
+ }
+
+ return JSValue::encode(jsNumber(-1));
+}
+
+EncodedJSValue JSC_HOST_CALL arrayProtoFuncLastIndexOf(ExecState* exec)
+{
+ // JavaScript 1.6 Extension by Mozilla
+ // Documentation: http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Array:lastIndexOf
+ JSObject* thisObj = exec->hostThisValue().toThisObject(exec);
+
+ unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec);
+ if (!length)
+ return JSValue::encode(jsNumber(-1));
+
+ unsigned index = length - 1;
+ JSValue fromValue = exec->argument(1);
+ if (!fromValue.isUndefined()) {
+ double fromDouble = fromValue.toInteger(exec);
+ if (fromDouble < 0) {
+ fromDouble += length;
+ if (fromDouble < 0)
+ return JSValue::encode(jsNumber(-1));
+ }
+ if (fromDouble < length)
+ index = static_cast<unsigned>(fromDouble);
+ }
+
+ JSValue searchElement = exec->argument(0);
+ do {
+ ASSERT(index < length);
+ JSValue e = getProperty(exec, thisObj, index);
+ if (!e)
+ continue;
+ if (JSValue::strictEqual(exec, searchElement, e))
+ return JSValue::encode(jsNumber(index));
+ } while (index--);
+
+ return JSValue::encode(jsNumber(-1));
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/ArrayPrototype.h b/Source/JavaScriptCore/runtime/ArrayPrototype.h
new file mode 100644
index 0000000..42665e3
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/ArrayPrototype.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifndef ArrayPrototype_h
+#define ArrayPrototype_h
+
+#include "JSArray.h"
+#include "Lookup.h"
+
+namespace JSC {
+
+ class ArrayPrototype : public JSArray {
+ public:
+ explicit ArrayPrototype(JSGlobalObject*, NonNullPassRefPtr<Structure>);
+
+ bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
+ virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
+
+ virtual const ClassInfo* classInfo() const { return &info; }
+ static const ClassInfo info;
+
+ static PassRefPtr<Structure> createStructure(JSValue prototype)
+ {
+ return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount);
+ }
+
+ protected:
+ static const unsigned AnonymousSlotCount = JSArray::AnonymousSlotCount + 1;
+ };
+
+} // namespace JSC
+
+#endif // ArrayPrototype_h
diff --git a/Source/JavaScriptCore/runtime/BatchedTransitionOptimizer.h b/Source/JavaScriptCore/runtime/BatchedTransitionOptimizer.h
new file mode 100644
index 0000000..74089a5
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/BatchedTransitionOptimizer.h
@@ -0,0 +1,55 @@
+// -*- mode: c++; c-basic-offset: 4 -*-
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef BatchedTransitionOptimizer_h
+#define BatchedTransitionOptimizer_h
+
+#include <wtf/Noncopyable.h>
+#include "JSObject.h"
+
+namespace JSC {
+
+ class BatchedTransitionOptimizer : public Noncopyable {
+ public:
+ BatchedTransitionOptimizer(JSObject* object)
+ : m_object(object)
+ {
+ if (!m_object->structure()->isDictionary())
+ m_object->setStructure(Structure::toCacheableDictionaryTransition(m_object->structure()));
+ }
+
+ ~BatchedTransitionOptimizer()
+ {
+ m_object->flattenDictionaryObject();
+ }
+
+ private:
+ JSObject* m_object;
+ };
+
+} // namespace JSC
+
+#endif // BatchedTransitionOptimizer_h
diff --git a/Source/JavaScriptCore/runtime/BooleanConstructor.cpp b/Source/JavaScriptCore/runtime/BooleanConstructor.cpp
new file mode 100644
index 0000000..0167e03
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/BooleanConstructor.cpp
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
+ * Copyright (C) 2003, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#include "config.h"
+#include "BooleanConstructor.h"
+
+#include "BooleanPrototype.h"
+#include "JSGlobalObject.h"
+
+namespace JSC {
+
+ASSERT_CLASS_FITS_IN_CELL(BooleanConstructor);
+
+BooleanConstructor::BooleanConstructor(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, BooleanPrototype* booleanPrototype)
+ : InternalFunction(&exec->globalData(), globalObject, structure, Identifier(exec, booleanPrototype->classInfo()->className))
+{
+ putDirectWithoutTransition(exec->propertyNames().prototype, booleanPrototype, DontEnum | DontDelete | ReadOnly);
+
+ // no. of arguments for constructor
+ putDirectWithoutTransition(exec->propertyNames().length, jsNumber(1), ReadOnly | DontDelete | DontEnum);
+}
+
+// ECMA 15.6.2
+JSObject* constructBoolean(ExecState* exec, const ArgList& args)
+{
+ BooleanObject* obj = new (exec) BooleanObject(exec->lexicalGlobalObject()->booleanObjectStructure());
+ obj->setInternalValue(jsBoolean(args.at(0).toBoolean(exec)));
+ return obj;
+}
+
+static EncodedJSValue JSC_HOST_CALL constructWithBooleanConstructor(ExecState* exec)
+{
+ ArgList args(exec);
+ return JSValue::encode(constructBoolean(exec, args));
+}
+
+ConstructType BooleanConstructor::getConstructData(ConstructData& constructData)
+{
+ constructData.native.function = constructWithBooleanConstructor;
+ return ConstructTypeHost;
+}
+
+// ECMA 15.6.1
+static EncodedJSValue JSC_HOST_CALL callBooleanConstructor(ExecState* exec)
+{
+ return JSValue::encode(jsBoolean(exec->argument(0).toBoolean(exec)));
+}
+
+CallType BooleanConstructor::getCallData(CallData& callData)
+{
+ callData.native.function = callBooleanConstructor;
+ return CallTypeHost;
+}
+
+JSObject* constructBooleanFromImmediateBoolean(ExecState* exec, JSValue immediateBooleanValue)
+{
+ BooleanObject* obj = new (exec) BooleanObject(exec->lexicalGlobalObject()->booleanObjectStructure());
+ obj->setInternalValue(immediateBooleanValue);
+ return obj;
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/BooleanConstructor.h b/Source/JavaScriptCore/runtime/BooleanConstructor.h
new file mode 100644
index 0000000..0f3efa7
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/BooleanConstructor.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifndef BooleanConstructor_h
+#define BooleanConstructor_h
+
+#include "InternalFunction.h"
+
+namespace JSC {
+
+ class BooleanPrototype;
+
+ class BooleanConstructor : public InternalFunction {
+ public:
+ BooleanConstructor(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure>, BooleanPrototype*);
+
+ private:
+ virtual ConstructType getConstructData(ConstructData&);
+ virtual CallType getCallData(CallData&);
+ };
+
+ JSObject* constructBooleanFromImmediateBoolean(ExecState*, JSValue);
+ JSObject* constructBoolean(ExecState*, const ArgList&);
+
+} // namespace JSC
+
+#endif // BooleanConstructor_h
diff --git a/Source/JavaScriptCore/runtime/BooleanObject.cpp b/Source/JavaScriptCore/runtime/BooleanObject.cpp
new file mode 100644
index 0000000..c9b3846
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/BooleanObject.cpp
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
+ * Copyright (C) 2003, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#include "config.h"
+#include "BooleanObject.h"
+
+namespace JSC {
+
+ASSERT_CLASS_FITS_IN_CELL(BooleanObject);
+
+const ClassInfo BooleanObject::info = { "Boolean", 0, 0, 0 };
+
+BooleanObject::BooleanObject(NonNullPassRefPtr<Structure> structure)
+ : JSWrapperObject(structure)
+{
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/BooleanObject.h b/Source/JavaScriptCore/runtime/BooleanObject.h
new file mode 100644
index 0000000..4b02acb
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/BooleanObject.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifndef BooleanObject_h
+#define BooleanObject_h
+
+#include "JSWrapperObject.h"
+
+namespace JSC {
+
+ class BooleanObject : public JSWrapperObject {
+ public:
+ explicit BooleanObject(NonNullPassRefPtr<Structure>);
+
+ virtual const ClassInfo* classInfo() const { return &info; }
+ static const ClassInfo info;
+
+ static PassRefPtr<Structure> createStructure(JSValue prototype)
+ {
+ return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount);
+ }
+ };
+
+ BooleanObject* asBooleanObject(JSValue);
+
+ inline BooleanObject* asBooleanObject(JSValue value)
+ {
+ ASSERT(asObject(value)->inherits(&BooleanObject::info));
+ return static_cast<BooleanObject*>(asObject(value));
+ }
+
+} // namespace JSC
+
+#endif // BooleanObject_h
diff --git a/Source/JavaScriptCore/runtime/BooleanPrototype.cpp b/Source/JavaScriptCore/runtime/BooleanPrototype.cpp
new file mode 100644
index 0000000..7ffd095
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/BooleanPrototype.cpp
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
+ * Copyright (C) 2003, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#include "config.h"
+#include "BooleanPrototype.h"
+
+#include "Error.h"
+#include "ExceptionHelpers.h"
+#include "JSFunction.h"
+#include "JSString.h"
+#include "ObjectPrototype.h"
+#include "PrototypeFunction.h"
+
+namespace JSC {
+
+ASSERT_CLASS_FITS_IN_CELL(BooleanPrototype);
+
+// Functions
+static EncodedJSValue JSC_HOST_CALL booleanProtoFuncToString(ExecState*);
+static EncodedJSValue JSC_HOST_CALL booleanProtoFuncValueOf(ExecState*);
+
+// ECMA 15.6.4
+
+BooleanPrototype::BooleanPrototype(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, Structure* prototypeFunctionStructure)
+ : BooleanObject(structure)
+{
+ setInternalValue(jsBoolean(false));
+
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 0, exec->propertyNames().toString, booleanProtoFuncToString), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 0, exec->propertyNames().valueOf, booleanProtoFuncValueOf), DontEnum);
+}
+
+
+// ------------------------------ Functions --------------------------
+
+// ECMA 15.6.4.2 + 15.6.4.3
+
+EncodedJSValue JSC_HOST_CALL booleanProtoFuncToString(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ if (thisValue == jsBoolean(false))
+ return JSValue::encode(jsNontrivialString(exec, "false"));
+
+ if (thisValue == jsBoolean(true))
+ return JSValue::encode(jsNontrivialString(exec, "true"));
+
+ if (!thisValue.inherits(&BooleanObject::info))
+ return throwVMTypeError(exec);
+
+ if (asBooleanObject(thisValue)->internalValue() == jsBoolean(false))
+ return JSValue::encode(jsNontrivialString(exec, "false"));
+
+ ASSERT(asBooleanObject(thisValue)->internalValue() == jsBoolean(true));
+ return JSValue::encode(jsNontrivialString(exec, "true"));
+}
+
+EncodedJSValue JSC_HOST_CALL booleanProtoFuncValueOf(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ if (thisValue.isBoolean())
+ return JSValue::encode(thisValue);
+
+ if (!thisValue.inherits(&BooleanObject::info))
+ return throwVMTypeError(exec);
+
+ return JSValue::encode(asBooleanObject(thisValue)->internalValue());
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/BooleanPrototype.h b/Source/JavaScriptCore/runtime/BooleanPrototype.h
new file mode 100644
index 0000000..ddadc43
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/BooleanPrototype.h
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifndef BooleanPrototype_h
+#define BooleanPrototype_h
+
+#include "BooleanObject.h"
+
+namespace JSC {
+
+ class BooleanPrototype : public BooleanObject {
+ public:
+ BooleanPrototype(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure>, Structure* prototypeFunctionStructure);
+ };
+
+} // namespace JSC
+
+#endif // BooleanPrototype_h
diff --git a/Source/JavaScriptCore/runtime/CachedTranscendentalFunction.h b/Source/JavaScriptCore/runtime/CachedTranscendentalFunction.h
new file mode 100644
index 0000000..67c7af8
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/CachedTranscendentalFunction.h
@@ -0,0 +1,103 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CachedTranscendentalFunction_h
+#define CachedTranscendentalFunction_h
+
+#include "JSValue.h"
+
+namespace JSC {
+
+extern const double NaN;
+
+typedef double (*TranscendentalFunctionPtr)(double);
+
+// CachedTranscendentalFunction provides a generic mechanism to cache results
+// for pure functions with the signature "double func(double)", and where NaN
+// maps to NaN.
+template<TranscendentalFunctionPtr orignalFunction>
+class CachedTranscendentalFunction {
+ struct CacheEntry {
+ double operand;
+ double result;
+ };
+
+public:
+ CachedTranscendentalFunction()
+ : m_cache(0)
+ {
+ }
+
+ ~CachedTranscendentalFunction()
+ {
+ if (m_cache)
+ fastFree(m_cache);
+ }
+
+ JSValue operator() (double operand)
+ {
+ if (UNLIKELY(!m_cache))
+ initialize();
+ CacheEntry* entry = &m_cache[hash(operand)];
+
+ if (entry->operand == operand)
+ return jsDoubleNumber(entry->result);
+ double result = orignalFunction(operand);
+ entry->operand = operand;
+ entry->result = result;
+ return jsDoubleNumber(result);
+ }
+
+private:
+ void initialize()
+ {
+ // Lazily allocate the table, populate with NaN->NaN mapping.
+ m_cache = static_cast<CacheEntry*>(fastMalloc(s_cacheSize * sizeof(CacheEntry)));
+ for (unsigned x = 0; x < s_cacheSize; ++x) {
+ m_cache[x].operand = NaN;
+ m_cache[x].result = NaN;
+ }
+ }
+
+ static unsigned hash(double d)
+ {
+ union doubleAndUInt64 {
+ double d;
+ uint32_t is[2];
+ } u;
+ u.d = d;
+
+ unsigned x = u.is[0] ^ u.is[1];
+ x = (x >> 20) ^ (x >> 8);
+ return x & (s_cacheSize - 1);
+ }
+
+ static const unsigned s_cacheSize = 0x1000;
+ CacheEntry* m_cache;
+};
+
+}
+
+#endif // CachedTranscendentalFunction_h
diff --git a/Source/JavaScriptCore/runtime/CallData.cpp b/Source/JavaScriptCore/runtime/CallData.cpp
new file mode 100644
index 0000000..018e2ca
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/CallData.cpp
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "CallData.h"
+
+#include "Executable.h"
+#include "Interpreter.h"
+#include "JSFunction.h"
+
+namespace JSC {
+
+JSValue call(ExecState* exec, JSValue functionObject, CallType callType, const CallData& callData, JSValue thisValue, const ArgList& args)
+{
+ ASSERT(callType == CallTypeJS || callType == CallTypeHost);
+ return exec->interpreter()->executeCall(exec, asObject(functionObject), callType, callData, thisValue, args);
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/CallData.h b/Source/JavaScriptCore/runtime/CallData.h
new file mode 100644
index 0000000..32e1094
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/CallData.h
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CallData_h
+#define CallData_h
+
+#include "JSValue.h"
+#include "NativeFunctionWrapper.h"
+
+namespace JSC {
+
+ class ArgList;
+ class ExecState;
+ class FunctionExecutable;
+ class JSObject;
+ class ScopeChainNode;
+
+ enum CallType {
+ CallTypeNone,
+ CallTypeHost,
+ CallTypeJS
+ };
+
+ typedef EncodedJSValue (JSC_HOST_CALL *NativeFunction)(ExecState*);
+
+ union CallData {
+ struct {
+ NativeFunction function;
+ } native;
+ struct {
+ FunctionExecutable* functionExecutable;
+ ScopeChainNode* scopeChain;
+ } js;
+ };
+
+ JSValue call(ExecState*, JSValue functionObject, CallType, const CallData&, JSValue thisValue, const ArgList&);
+
+} // namespace JSC
+
+#endif // CallData_h
diff --git a/Source/JavaScriptCore/runtime/ClassInfo.h b/Source/JavaScriptCore/runtime/ClassInfo.h
new file mode 100644
index 0000000..acec4e7
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/ClassInfo.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
+ * Copyright (C) 2001 Peter Kelly (pmk@post.com)
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef ClassInfo_h
+#define ClassInfo_h
+
+#include "CallFrame.h"
+
+namespace JSC {
+
+ class HashEntry;
+ struct HashTable;
+
+ struct ClassInfo {
+ /**
+ * A string denoting the class name. Example: "Window".
+ */
+ const char* className;
+
+ /**
+ * Pointer to the class information of the base class.
+ * 0L if there is none.
+ */
+ const ClassInfo* parentClass;
+ /**
+ * Static hash-table of properties.
+ * For classes that can be used from multiple threads, it is accessed via a getter function that would typically return a pointer to thread-specific value.
+ */
+ const HashTable* propHashTable(ExecState* exec) const
+ {
+ if (classPropHashTableGetterFunction)
+ return classPropHashTableGetterFunction(exec);
+ return staticPropHashTable;
+ }
+
+ const HashTable* staticPropHashTable;
+ typedef const HashTable* (*ClassPropHashTableGetterFunction)(ExecState*);
+ const ClassPropHashTableGetterFunction classPropHashTableGetterFunction;
+ };
+
+} // namespace JSC
+
+#endif // ClassInfo_h
diff --git a/Source/JavaScriptCore/runtime/Collector.cpp b/Source/JavaScriptCore/runtime/Collector.cpp
new file mode 100644
index 0000000..38845ce
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/Collector.cpp
@@ -0,0 +1,1100 @@
+/*
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#include "config.h"
+#include "Collector.h"
+
+#include "ArgList.h"
+#include "CallFrame.h"
+#include "CodeBlock.h"
+#include "CollectorHeapIterator.h"
+#include "GCActivityCallback.h"
+#include "Interpreter.h"
+#include "JSArray.h"
+#include "JSGlobalObject.h"
+#include "JSLock.h"
+#include "JSONObject.h"
+#include "JSString.h"
+#include "JSValue.h"
+#include "JSZombie.h"
+#include "MarkStack.h"
+#include "Nodes.h"
+#include "Tracing.h"
+#include <algorithm>
+#include <limits.h>
+#include <setjmp.h>
+#include <stdlib.h>
+#include <wtf/FastMalloc.h>
+#include <wtf/HashCountedSet.h>
+#include <wtf/WTFThreadData.h>
+#include <wtf/UnusedParam.h>
+#include <wtf/VMTags.h>
+
+#if OS(DARWIN)
+
+#include <mach/mach_init.h>
+#include <mach/mach_port.h>
+#include <mach/task.h>
+#include <mach/thread_act.h>
+#include <mach/vm_map.h>
+
+#elif OS(WINDOWS)
+
+#include <windows.h>
+#include <malloc.h>
+
+#elif OS(HAIKU)
+
+#include <OS.h>
+
+#elif OS(UNIX)
+
+#include <stdlib.h>
+#if !OS(HAIKU)
+#include <sys/mman.h>
+#endif
+#include <unistd.h>
+
+#if OS(SOLARIS)
+#include <thread.h>
+#else
+#include <pthread.h>
+#endif
+
+#if HAVE(PTHREAD_NP_H)
+#include <pthread_np.h>
+#endif
+
+#if OS(QNX)
+#include <fcntl.h>
+#include <sys/procfs.h>
+#include <stdio.h>
+#include <errno.h>
+#endif
+
+#endif
+
+#define COLLECT_ON_EVERY_ALLOCATION 0
+
+using std::max;
+
+namespace JSC {
+
+// tunable parameters
+
+const size_t GROWTH_FACTOR = 2;
+const size_t LOW_WATER_FACTOR = 4;
+const size_t ALLOCATIONS_PER_COLLECTION = 3600;
+// This value has to be a macro to be used in max() without introducing
+// a PIC branch in Mach-O binaries, see <rdar://problem/5971391>.
+#define MIN_ARRAY_SIZE (static_cast<size_t>(14))
+
+#if ENABLE(JSC_MULTIPLE_THREADS)
+
+#if OS(DARWIN)
+typedef mach_port_t PlatformThread;
+#elif OS(WINDOWS)
+typedef HANDLE PlatformThread;
+#endif
+
+class Heap::Thread {
+public:
+ Thread(pthread_t pthread, const PlatformThread& platThread, void* base)
+ : posixThread(pthread)
+ , platformThread(platThread)
+ , stackBase(base)
+ {
+ }
+
+ Thread* next;
+ pthread_t posixThread;
+ PlatformThread platformThread;
+ void* stackBase;
+};
+
+#endif
+
+Heap::Heap(JSGlobalData* globalData)
+ : m_markListSet(0)
+#if ENABLE(JSC_MULTIPLE_THREADS)
+ , m_registeredThreads(0)
+ , m_currentThreadRegistrar(0)
+#endif
+ , m_globalData(globalData)
+{
+ ASSERT(globalData);
+ memset(&m_heap, 0, sizeof(CollectorHeap));
+ allocateBlock();
+ m_activityCallback = DefaultGCActivityCallback::create(this);
+ (*m_activityCallback)();
+}
+
+Heap::~Heap()
+{
+ // The destroy function must already have been called, so assert this.
+ ASSERT(!m_globalData);
+}
+
+void Heap::destroy()
+{
+ JSLock lock(SilenceAssertionsOnly);
+
+ if (!m_globalData)
+ return;
+
+ ASSERT(!m_globalData->dynamicGlobalObject);
+ ASSERT(!isBusy());
+
+ // The global object is not GC protected at this point, so sweeping may delete it
+ // (and thus the global data) before other objects that may use the global data.
+ RefPtr<JSGlobalData> protect(m_globalData);
+
+ delete m_markListSet;
+ m_markListSet = 0;
+
+ freeBlocks();
+
+#if ENABLE(JSC_MULTIPLE_THREADS)
+ if (m_currentThreadRegistrar) {
+ int error = pthread_key_delete(m_currentThreadRegistrar);
+ ASSERT_UNUSED(error, !error);
+ }
+
+ MutexLocker registeredThreadsLock(m_registeredThreadsMutex);
+ for (Heap::Thread* t = m_registeredThreads; t;) {
+ Heap::Thread* next = t->next;
+ delete t;
+ t = next;
+ }
+#endif
+ m_globalData = 0;
+}
+
+NEVER_INLINE CollectorBlock* Heap::allocateBlock()
+{
+ PageAllocationAligned allocation = PageAllocationAligned::allocate(BLOCK_SIZE, BLOCK_SIZE, OSAllocator::JSGCHeapPages);
+ CollectorBlock* block = static_cast<CollectorBlock*>(allocation.base());
+ if (!block)
+ CRASH();
+
+ // Initialize block.
+
+ block->heap = this;
+ clearMarkBits(block);
+
+ Structure* dummyMarkableCellStructure = m_globalData->dummyMarkableCellStructure.get();
+ for (size_t i = 0; i < HeapConstants::cellsPerBlock; ++i)
+ new (&block->cells[i]) JSCell(dummyMarkableCellStructure);
+
+ // Add block to blocks vector.
+
+ size_t numBlocks = m_heap.numBlocks;
+ if (m_heap.usedBlocks == numBlocks) {
+ static const size_t maxNumBlocks = ULONG_MAX / sizeof(PageAllocationAligned) / GROWTH_FACTOR;
+ if (numBlocks > maxNumBlocks)
+ CRASH();
+ numBlocks = max(MIN_ARRAY_SIZE, numBlocks * GROWTH_FACTOR);
+ m_heap.numBlocks = numBlocks;
+ m_heap.blocks = static_cast<PageAllocationAligned*>(fastRealloc(m_heap.blocks, numBlocks * sizeof(PageAllocationAligned)));
+ }
+ m_heap.blocks[m_heap.usedBlocks++] = allocation;
+
+ return block;
+}
+
+NEVER_INLINE void Heap::freeBlock(size_t block)
+{
+ m_heap.didShrink = true;
+
+ ObjectIterator it(m_heap, block);
+ ObjectIterator end(m_heap, block + 1);
+ for ( ; it != end; ++it)
+ (*it)->~JSCell();
+ m_heap.blocks[block].deallocate();
+
+ // swap with the last block so we compact as we go
+ m_heap.blocks[block] = m_heap.blocks[m_heap.usedBlocks - 1];
+ m_heap.usedBlocks--;
+
+ if (m_heap.numBlocks > MIN_ARRAY_SIZE && m_heap.usedBlocks < m_heap.numBlocks / LOW_WATER_FACTOR) {
+ m_heap.numBlocks = m_heap.numBlocks / GROWTH_FACTOR;
+ m_heap.blocks = static_cast<PageAllocationAligned*>(fastRealloc(m_heap.blocks, m_heap.numBlocks * sizeof(PageAllocationAligned)));
+ }
+}
+
+void Heap::freeBlocks()
+{
+ ProtectCountSet protectedValuesCopy = m_protectedValues;
+
+ clearMarkBits();
+ ProtectCountSet::iterator protectedValuesEnd = protectedValuesCopy.end();
+ for (ProtectCountSet::iterator it = protectedValuesCopy.begin(); it != protectedValuesEnd; ++it)
+ markCell(it->first);
+
+ m_heap.nextCell = 0;
+ m_heap.nextBlock = 0;
+ DeadObjectIterator it(m_heap, m_heap.nextBlock, m_heap.nextCell);
+ DeadObjectIterator end(m_heap, m_heap.usedBlocks);
+ for ( ; it != end; ++it)
+ (*it)->~JSCell();
+
+ ASSERT(!protectedObjectCount());
+
+ protectedValuesEnd = protectedValuesCopy.end();
+ for (ProtectCountSet::iterator it = protectedValuesCopy.begin(); it != protectedValuesEnd; ++it)
+ it->first->~JSCell();
+
+ for (size_t block = 0; block < m_heap.usedBlocks; ++block)
+ m_heap.blocks[block].deallocate();
+
+ fastFree(m_heap.blocks);
+
+ memset(&m_heap, 0, sizeof(CollectorHeap));
+}
+
+void Heap::recordExtraCost(size_t cost)
+{
+ // Our frequency of garbage collection tries to balance memory use against speed
+ // by collecting based on the number of newly created values. However, for values
+ // that hold on to a great deal of memory that's not in the form of other JS values,
+ // that is not good enough - in some cases a lot of those objects can pile up and
+ // use crazy amounts of memory without a GC happening. So we track these extra
+ // memory costs. Only unusually large objects are noted, and we only keep track
+ // of this extra cost until the next GC. In garbage collected languages, most values
+ // are either very short lived temporaries, or have extremely long lifetimes. So
+ // if a large value survives one garbage collection, there is not much point to
+ // collecting more frequently as long as it stays alive.
+
+ if (m_heap.extraCost > maxExtraCost && m_heap.extraCost > m_heap.usedBlocks * BLOCK_SIZE / 2) {
+ // If the last iteration through the heap deallocated blocks, we need
+ // to clean up remaining garbage before marking. Otherwise, the conservative
+ // marking mechanism might follow a pointer to unmapped memory.
+ if (m_heap.didShrink)
+ sweep();
+ reset();
+ }
+ m_heap.extraCost += cost;
+}
+
+void* Heap::allocate(size_t s)
+{
+ ASSERT(globalData()->identifierTable == wtfThreadData().currentIdentifierTable());
+ typedef HeapConstants::Block Block;
+ typedef HeapConstants::Cell Cell;
+
+ ASSERT(JSLock::lockCount() > 0);
+ ASSERT(JSLock::currentThreadIsHoldingLock());
+ ASSERT_UNUSED(s, s <= HeapConstants::cellSize);
+
+ ASSERT(m_heap.operationInProgress == NoOperation);
+
+#if COLLECT_ON_EVERY_ALLOCATION
+ collectAllGarbage();
+ ASSERT(m_heap.operationInProgress == NoOperation);
+#endif
+
+allocate:
+
+ // Fast case: find the next garbage cell and recycle it.
+
+ do {
+ ASSERT(m_heap.nextBlock < m_heap.usedBlocks);
+ Block* block = m_heap.collectorBlock(m_heap.nextBlock);
+ do {
+ ASSERT(m_heap.nextCell < HeapConstants::cellsPerBlock);
+ if (!block->marked.get(m_heap.nextCell)) { // Always false for the last cell in the block
+ Cell* cell = &block->cells[m_heap.nextCell];
+
+ m_heap.operationInProgress = Allocation;
+ JSCell* imp = reinterpret_cast<JSCell*>(cell);
+ imp->~JSCell();
+ m_heap.operationInProgress = NoOperation;
+
+ ++m_heap.nextCell;
+ return cell;
+ }
+ block->marked.advanceToNextPossibleFreeCell(m_heap.nextCell);
+ } while (m_heap.nextCell != HeapConstants::cellsPerBlock);
+ m_heap.nextCell = 0;
+ } while (++m_heap.nextBlock != m_heap.usedBlocks);
+
+ // Slow case: reached the end of the heap. Mark live objects and start over.
+
+ reset();
+ goto allocate;
+}
+
+void Heap::resizeBlocks()
+{
+ m_heap.didShrink = false;
+
+ size_t usedCellCount = markedCells();
+ size_t minCellCount = usedCellCount + max(ALLOCATIONS_PER_COLLECTION, usedCellCount);
+ size_t minBlockCount = (minCellCount + HeapConstants::cellsPerBlock - 1) / HeapConstants::cellsPerBlock;
+
+ size_t maxCellCount = 1.25f * minCellCount;
+ size_t maxBlockCount = (maxCellCount + HeapConstants::cellsPerBlock - 1) / HeapConstants::cellsPerBlock;
+
+ if (m_heap.usedBlocks < minBlockCount)
+ growBlocks(minBlockCount);
+ else if (m_heap.usedBlocks > maxBlockCount)
+ shrinkBlocks(maxBlockCount);
+}
+
+void Heap::growBlocks(size_t neededBlocks)
+{
+ ASSERT(m_heap.usedBlocks < neededBlocks);
+ while (m_heap.usedBlocks < neededBlocks)
+ allocateBlock();
+}
+
+void Heap::shrinkBlocks(size_t neededBlocks)
+{
+ ASSERT(m_heap.usedBlocks > neededBlocks);
+
+ // Clear the always-on last bit, so isEmpty() isn't fooled by it.
+ for (size_t i = 0; i < m_heap.usedBlocks; ++i)
+ m_heap.collectorBlock(i)->marked.clear(HeapConstants::cellsPerBlock - 1);
+
+ for (size_t i = 0; i != m_heap.usedBlocks && m_heap.usedBlocks != neededBlocks; ) {
+ if (m_heap.collectorBlock(i)->marked.isEmpty()) {
+ freeBlock(i);
+ } else
+ ++i;
+ }
+
+ // Reset the always-on last bit.
+ for (size_t i = 0; i < m_heap.usedBlocks; ++i)
+ m_heap.collectorBlock(i)->marked.set(HeapConstants::cellsPerBlock - 1);
+}
+
+#if ENABLE(JSC_MULTIPLE_THREADS)
+
+static inline PlatformThread getCurrentPlatformThread()
+{
+#if OS(DARWIN)
+ return pthread_mach_thread_np(pthread_self());
+#elif OS(WINDOWS)
+ return pthread_getw32threadhandle_np(pthread_self());
+#endif
+}
+
+void Heap::makeUsableFromMultipleThreads()
+{
+ if (m_currentThreadRegistrar)
+ return;
+
+ int error = pthread_key_create(&m_currentThreadRegistrar, unregisterThread);
+ if (error)
+ CRASH();
+}
+
+void Heap::registerThread()
+{
+ ASSERT(!m_globalData->exclusiveThread || m_globalData->exclusiveThread == currentThread());
+
+ if (!m_currentThreadRegistrar || pthread_getspecific(m_currentThreadRegistrar))
+ return;
+
+ pthread_setspecific(m_currentThreadRegistrar, this);
+ Heap::Thread* thread = new Heap::Thread(pthread_self(), getCurrentPlatformThread(), m_globalData->stack().origin());
+
+ MutexLocker lock(m_registeredThreadsMutex);
+
+ thread->next = m_registeredThreads;
+ m_registeredThreads = thread;
+}
+
+void Heap::unregisterThread(void* p)
+{
+ if (p)
+ static_cast<Heap*>(p)->unregisterThread();
+}
+
+void Heap::unregisterThread()
+{
+ pthread_t currentPosixThread = pthread_self();
+
+ MutexLocker lock(m_registeredThreadsMutex);
+
+ if (pthread_equal(currentPosixThread, m_registeredThreads->posixThread)) {
+ Thread* t = m_registeredThreads;
+ m_registeredThreads = m_registeredThreads->next;
+ delete t;
+ } else {
+ Heap::Thread* last = m_registeredThreads;
+ Heap::Thread* t;
+ for (t = m_registeredThreads->next; t; t = t->next) {
+ if (pthread_equal(t->posixThread, currentPosixThread)) {
+ last->next = t->next;
+ break;
+ }
+ last = t;
+ }
+ ASSERT(t); // If t is NULL, we never found ourselves in the list.
+ delete t;
+ }
+}
+
+#else // ENABLE(JSC_MULTIPLE_THREADS)
+
+void Heap::registerThread()
+{
+}
+
+#endif
+
+inline bool isPointerAligned(void* p)
+{
+ return (((intptr_t)(p) & (sizeof(char*) - 1)) == 0);
+}
+
+// Cell size needs to be a power of two for isPossibleCell to be valid.
+COMPILE_ASSERT(sizeof(CollectorCell) % 2 == 0, Collector_cell_size_is_power_of_two);
+
+static inline bool isCellAligned(void *p)
+{
+ return (((intptr_t)(p) & CELL_MASK) == 0);
+}
+
+static inline bool isPossibleCell(void* p)
+{
+ return isCellAligned(p) && p;
+}
+
+void Heap::markConservatively(MarkStack& markStack, void* start, void* end)
+{
+#if OS(WINCE)
+ if (start > end) {
+ void* tmp = start;
+ start = end;
+ end = tmp;
+ }
+#else
+ ASSERT(start <= end);
+#endif
+
+ ASSERT((static_cast<char*>(end) - static_cast<char*>(start)) < 0x1000000);
+ ASSERT(isPointerAligned(start));
+ ASSERT(isPointerAligned(end));
+
+ char** p = static_cast<char**>(start);
+ char** e = static_cast<char**>(end);
+
+ while (p != e) {
+ char* x = *p++;
+ if (isPossibleCell(x)) {
+ size_t usedBlocks;
+ uintptr_t xAsBits = reinterpret_cast<uintptr_t>(x);
+ xAsBits &= CELL_ALIGN_MASK;
+
+ uintptr_t offset = xAsBits & BLOCK_OFFSET_MASK;
+ const size_t lastCellOffset = sizeof(CollectorCell) * (CELLS_PER_BLOCK - 1);
+ if (offset > lastCellOffset)
+ continue;
+
+ CollectorBlock* blockAddr = reinterpret_cast<CollectorBlock*>(xAsBits - offset);
+ usedBlocks = m_heap.usedBlocks;
+ for (size_t block = 0; block < usedBlocks; block++) {
+ if (m_heap.collectorBlock(block) != blockAddr)
+ continue;
+ markStack.append(reinterpret_cast<JSCell*>(xAsBits));
+ }
+ }
+ }
+}
+
+void NEVER_INLINE Heap::markCurrentThreadConservativelyInternal(MarkStack& markStack)
+{
+ markConservatively(markStack, m_globalData->stack().current(), m_globalData->stack().origin());
+ markStack.drain();
+}
+
+#if COMPILER(GCC)
+#define REGISTER_BUFFER_ALIGNMENT __attribute__ ((aligned (sizeof(void*))))
+#else
+#define REGISTER_BUFFER_ALIGNMENT
+#endif
+
+void Heap::markCurrentThreadConservatively(MarkStack& markStack)
+{
+ // setjmp forces volatile registers onto the stack
+ jmp_buf registers REGISTER_BUFFER_ALIGNMENT;
+#if COMPILER(MSVC)
+#pragma warning(push)
+#pragma warning(disable: 4611)
+#endif
+ setjmp(registers);
+#if COMPILER(MSVC)
+#pragma warning(pop)
+#endif
+
+ markCurrentThreadConservativelyInternal(markStack);
+}
+
+#if ENABLE(JSC_MULTIPLE_THREADS)
+
+static inline void suspendThread(const PlatformThread& platformThread)
+{
+#if OS(DARWIN)
+ thread_suspend(platformThread);
+#elif OS(WINDOWS)
+ SuspendThread(platformThread);
+#else
+#error Need a way to suspend threads on this platform
+#endif
+}
+
+static inline void resumeThread(const PlatformThread& platformThread)
+{
+#if OS(DARWIN)
+ thread_resume(platformThread);
+#elif OS(WINDOWS)
+ ResumeThread(platformThread);
+#else
+#error Need a way to resume threads on this platform
+#endif
+}
+
+typedef unsigned long usword_t; // word size, assumed to be either 32 or 64 bit
+
+#if OS(DARWIN)
+
+#if CPU(X86)
+typedef i386_thread_state_t PlatformThreadRegisters;
+#elif CPU(X86_64)
+typedef x86_thread_state64_t PlatformThreadRegisters;
+#elif CPU(PPC)
+typedef ppc_thread_state_t PlatformThreadRegisters;
+#elif CPU(PPC64)
+typedef ppc_thread_state64_t PlatformThreadRegisters;
+#elif CPU(ARM)
+typedef arm_thread_state_t PlatformThreadRegisters;
+#else
+#error Unknown Architecture
+#endif
+
+#elif OS(WINDOWS) && CPU(X86)
+typedef CONTEXT PlatformThreadRegisters;
+#else
+#error Need a thread register struct for this platform
+#endif
+
+static size_t getPlatformThreadRegisters(const PlatformThread& platformThread, PlatformThreadRegisters& regs)
+{
+#if OS(DARWIN)
+
+#if CPU(X86)
+ unsigned user_count = sizeof(regs)/sizeof(int);
+ thread_state_flavor_t flavor = i386_THREAD_STATE;
+#elif CPU(X86_64)
+ unsigned user_count = x86_THREAD_STATE64_COUNT;
+ thread_state_flavor_t flavor = x86_THREAD_STATE64;
+#elif CPU(PPC)
+ unsigned user_count = PPC_THREAD_STATE_COUNT;
+ thread_state_flavor_t flavor = PPC_THREAD_STATE;
+#elif CPU(PPC64)
+ unsigned user_count = PPC_THREAD_STATE64_COUNT;
+ thread_state_flavor_t flavor = PPC_THREAD_STATE64;
+#elif CPU(ARM)
+ unsigned user_count = ARM_THREAD_STATE_COUNT;
+ thread_state_flavor_t flavor = ARM_THREAD_STATE;
+#else
+#error Unknown Architecture
+#endif
+
+ kern_return_t result = thread_get_state(platformThread, flavor, (thread_state_t)&regs, &user_count);
+ if (result != KERN_SUCCESS) {
+ WTFReportFatalError(__FILE__, __LINE__, WTF_PRETTY_FUNCTION,
+ "JavaScript garbage collection failed because thread_get_state returned an error (%d). This is probably the result of running inside Rosetta, which is not supported.", result);
+ CRASH();
+ }
+ return user_count * sizeof(usword_t);
+// end OS(DARWIN)
+
+#elif OS(WINDOWS) && CPU(X86)
+ regs.ContextFlags = CONTEXT_INTEGER | CONTEXT_CONTROL | CONTEXT_SEGMENTS;
+ GetThreadContext(platformThread, &regs);
+ return sizeof(CONTEXT);
+#else
+#error Need a way to get thread registers on this platform
+#endif
+}
+
+static inline void* otherThreadStackPointer(const PlatformThreadRegisters& regs)
+{
+#if OS(DARWIN)
+
+#if __DARWIN_UNIX03
+
+#if CPU(X86)
+ return reinterpret_cast<void*>(regs.__esp);
+#elif CPU(X86_64)
+ return reinterpret_cast<void*>(regs.__rsp);
+#elif CPU(PPC) || CPU(PPC64)
+ return reinterpret_cast<void*>(regs.__r1);
+#elif CPU(ARM)
+ return reinterpret_cast<void*>(regs.__sp);
+#else
+#error Unknown Architecture
+#endif
+
+#else // !__DARWIN_UNIX03
+
+#if CPU(X86)
+ return reinterpret_cast<void*>(regs.esp);
+#elif CPU(X86_64)
+ return reinterpret_cast<void*>(regs.rsp);
+#elif CPU(PPC) || CPU(PPC64)
+ return reinterpret_cast<void*>(regs.r1);
+#else
+#error Unknown Architecture
+#endif
+
+#endif // __DARWIN_UNIX03
+
+// end OS(DARWIN)
+#elif CPU(X86) && OS(WINDOWS)
+ return reinterpret_cast<void*>((uintptr_t) regs.Esp);
+#else
+#error Need a way to get the stack pointer for another thread on this platform
+#endif
+}
+
+void Heap::markOtherThreadConservatively(MarkStack& markStack, Thread* thread)
+{
+ suspendThread(thread->platformThread);
+
+ PlatformThreadRegisters regs;
+ size_t regSize = getPlatformThreadRegisters(thread->platformThread, regs);
+
+ // mark the thread's registers
+ markConservatively(markStack, static_cast<void*>(&regs), static_cast<void*>(reinterpret_cast<char*>(&regs) + regSize));
+ markStack.drain();
+
+ void* stackPointer = otherThreadStackPointer(regs);
+ markConservatively(markStack, stackPointer, thread->stackBase);
+ markStack.drain();
+
+ resumeThread(thread->platformThread);
+}
+
+#endif
+
+void Heap::markStackObjectsConservatively(MarkStack& markStack)
+{
+ markCurrentThreadConservatively(markStack);
+
+#if ENABLE(JSC_MULTIPLE_THREADS)
+
+ if (m_currentThreadRegistrar) {
+
+ MutexLocker lock(m_registeredThreadsMutex);
+
+#ifndef NDEBUG
+ // Forbid malloc during the mark phase. Marking a thread suspends it, so
+ // a malloc inside markChildren() would risk a deadlock with a thread that had been
+ // suspended while holding the malloc lock.
+ fastMallocForbid();
+#endif
+ // It is safe to access the registeredThreads list, because we earlier asserted that locks are being held,
+ // and since this is a shared heap, they are real locks.
+ for (Thread* thread = m_registeredThreads; thread; thread = thread->next) {
+ if (!pthread_equal(thread->posixThread, pthread_self()))
+ markOtherThreadConservatively(markStack, thread);
+ }
+#ifndef NDEBUG
+ fastMallocAllow();
+#endif
+ }
+#endif
+}
+
+void Heap::updateWeakGCHandles()
+{
+ for (unsigned i = 0; i < m_weakGCHandlePools.size(); ++i)
+ weakGCHandlePool(i)->update();
+}
+
+void WeakGCHandlePool::update()
+{
+ for (unsigned i = 1; i < WeakGCHandlePool::numPoolEntries; ++i) {
+ if (m_entries[i].isValidPtr()) {
+ JSCell* cell = m_entries[i].get();
+ if (!cell || !Heap::isCellMarked(cell))
+ m_entries[i].invalidate();
+ }
+ }
+}
+
+WeakGCHandle* Heap::addWeakGCHandle(JSCell* ptr)
+{
+ for (unsigned i = 0; i < m_weakGCHandlePools.size(); ++i)
+ if (!weakGCHandlePool(i)->isFull())
+ return weakGCHandlePool(i)->allocate(ptr);
+
+ PageAllocationAligned allocation = PageAllocationAligned::allocate(WeakGCHandlePool::poolSize, WeakGCHandlePool::poolSize, OSAllocator::JSGCHeapPages);
+ m_weakGCHandlePools.append(allocation);
+
+ WeakGCHandlePool* pool = new (allocation.base()) WeakGCHandlePool();
+ return pool->allocate(ptr);
+}
+
+void Heap::protect(JSValue k)
+{
+ ASSERT(k);
+ ASSERT(JSLock::currentThreadIsHoldingLock() || !m_globalData->isSharedInstance());
+
+ if (!k.isCell())
+ return;
+
+ m_protectedValues.add(k.asCell());
+}
+
+bool Heap::unprotect(JSValue k)
+{
+ ASSERT(k);
+ ASSERT(JSLock::currentThreadIsHoldingLock() || !m_globalData->isSharedInstance());
+
+ if (!k.isCell())
+ return false;
+
+ return m_protectedValues.remove(k.asCell());
+}
+
+void Heap::markProtectedObjects(MarkStack& markStack)
+{
+ ProtectCountSet::iterator end = m_protectedValues.end();
+ for (ProtectCountSet::iterator it = m_protectedValues.begin(); it != end; ++it) {
+ markStack.append(it->first);
+ markStack.drain();
+ }
+}
+
+void Heap::pushTempSortVector(Vector<ValueStringPair>* tempVector)
+{
+ m_tempSortingVectors.append(tempVector);
+}
+
+void Heap::popTempSortVector(Vector<ValueStringPair>* tempVector)
+{
+ ASSERT_UNUSED(tempVector, tempVector == m_tempSortingVectors.last());
+ m_tempSortingVectors.removeLast();
+}
+
+void Heap::markTempSortVectors(MarkStack& markStack)
+{
+ typedef Vector<Vector<ValueStringPair>* > VectorOfValueStringVectors;
+
+ VectorOfValueStringVectors::iterator end = m_tempSortingVectors.end();
+ for (VectorOfValueStringVectors::iterator it = m_tempSortingVectors.begin(); it != end; ++it) {
+ Vector<ValueStringPair>* tempSortingVector = *it;
+
+ Vector<ValueStringPair>::iterator vectorEnd = tempSortingVector->end();
+ for (Vector<ValueStringPair>::iterator vectorIt = tempSortingVector->begin(); vectorIt != vectorEnd; ++vectorIt)
+ if (vectorIt->first)
+ markStack.append(vectorIt->first);
+ markStack.drain();
+ }
+}
+
+void Heap::clearMarkBits()
+{
+ for (size_t i = 0; i < m_heap.usedBlocks; ++i)
+ clearMarkBits(m_heap.collectorBlock(i));
+}
+
+void Heap::clearMarkBits(CollectorBlock* block)
+{
+ // allocate assumes that the last cell in every block is marked.
+ block->marked.clearAll();
+ block->marked.set(HeapConstants::cellsPerBlock - 1);
+}
+
+size_t Heap::markedCells(size_t startBlock, size_t startCell) const
+{
+ ASSERT(startBlock <= m_heap.usedBlocks);
+ ASSERT(startCell < HeapConstants::cellsPerBlock);
+
+ if (startBlock >= m_heap.usedBlocks)
+ return 0;
+
+ size_t result = 0;
+ result += m_heap.collectorBlock(startBlock)->marked.count(startCell);
+ for (size_t i = startBlock + 1; i < m_heap.usedBlocks; ++i)
+ result += m_heap.collectorBlock(i)->marked.count();
+
+ return result;
+}
+
+void Heap::sweep()
+{
+ ASSERT(m_heap.operationInProgress == NoOperation);
+ if (m_heap.operationInProgress != NoOperation)
+ CRASH();
+ m_heap.operationInProgress = Collection;
+
+#if !ENABLE(JSC_ZOMBIES)
+ Structure* dummyMarkableCellStructure = m_globalData->dummyMarkableCellStructure.get();
+#endif
+
+ DeadObjectIterator it(m_heap, m_heap.nextBlock, m_heap.nextCell);
+ DeadObjectIterator end(m_heap, m_heap.usedBlocks);
+ for ( ; it != end; ++it) {
+ JSCell* cell = *it;
+#if ENABLE(JSC_ZOMBIES)
+ if (!cell->isZombie()) {
+ const ClassInfo* info = cell->classInfo();
+ cell->~JSCell();
+ new (cell) JSZombie(info, JSZombie::leakedZombieStructure());
+ Heap::markCell(cell);
+ }
+#else
+ cell->~JSCell();
+ // Callers of sweep assume it's safe to mark any cell in the heap.
+ new (cell) JSCell(dummyMarkableCellStructure);
+#endif
+ }
+
+ m_heap.operationInProgress = NoOperation;
+}
+
+void Heap::markRoots()
+{
+#ifndef NDEBUG
+ if (m_globalData->isSharedInstance()) {
+ ASSERT(JSLock::lockCount() > 0);
+ ASSERT(JSLock::currentThreadIsHoldingLock());
+ }
+#endif
+
+ ASSERT(m_heap.operationInProgress == NoOperation);
+ if (m_heap.operationInProgress != NoOperation)
+ CRASH();
+
+ m_heap.operationInProgress = Collection;
+
+ MarkStack& markStack = m_globalData->markStack;
+
+ // Reset mark bits.
+ clearMarkBits();
+
+ // Mark stack roots.
+ markStackObjectsConservatively(markStack);
+ m_globalData->interpreter->registerFile().markCallFrames(markStack, this);
+
+ // Mark explicitly registered roots.
+ markProtectedObjects(markStack);
+
+ // Mark temporary vector for Array sorting
+ markTempSortVectors(markStack);
+
+ // Mark misc. other roots.
+ if (m_markListSet && m_markListSet->size())
+ MarkedArgumentBuffer::markLists(markStack, *m_markListSet);
+ if (m_globalData->exception)
+ markStack.append(m_globalData->exception);
+ if (m_globalData->firstStringifierToMark)
+ JSONObject::markStringifiers(markStack, m_globalData->firstStringifierToMark);
+
+ // Mark the small strings cache last, since it will clear itself if nothing
+ // else has marked it.
+ m_globalData->smallStrings.markChildren(markStack);
+
+ markStack.drain();
+ markStack.compact();
+
+ updateWeakGCHandles();
+
+ m_heap.operationInProgress = NoOperation;
+}
+
+size_t Heap::objectCount() const
+{
+ return m_heap.nextBlock * HeapConstants::cellsPerBlock // allocated full blocks
+ + m_heap.nextCell // allocated cells in current block
+ + markedCells(m_heap.nextBlock, m_heap.nextCell) // marked cells in remainder of m_heap
+ - m_heap.usedBlocks; // 1 cell per block is a dummy sentinel
+}
+
+void Heap::addToStatistics(Heap::Statistics& statistics) const
+{
+ statistics.size += m_heap.usedBlocks * BLOCK_SIZE;
+ statistics.free += m_heap.usedBlocks * BLOCK_SIZE - (objectCount() * HeapConstants::cellSize);
+}
+
+Heap::Statistics Heap::statistics() const
+{
+ Statistics statistics = { 0, 0 };
+ addToStatistics(statistics);
+ return statistics;
+}
+
+size_t Heap::size() const
+{
+ return m_heap.usedBlocks * BLOCK_SIZE;
+}
+
+size_t Heap::globalObjectCount()
+{
+ size_t count = 0;
+ if (JSGlobalObject* head = m_globalData->head) {
+ JSGlobalObject* o = head;
+ do {
+ ++count;
+ o = o->next();
+ } while (o != head);
+ }
+ return count;
+}
+
+size_t Heap::protectedGlobalObjectCount()
+{
+ size_t count = 0;
+ if (JSGlobalObject* head = m_globalData->head) {
+ JSGlobalObject* o = head;
+ do {
+ if (m_protectedValues.contains(o))
+ ++count;
+ o = o->next();
+ } while (o != head);
+ }
+
+ return count;
+}
+
+size_t Heap::protectedObjectCount()
+{
+ return m_protectedValues.size();
+}
+
+static const char* typeName(JSCell* cell)
+{
+ if (cell->isString())
+ return "string";
+ if (cell->isGetterSetter())
+ return "Getter-Setter";
+ if (cell->isAPIValueWrapper())
+ return "API wrapper";
+ if (cell->isPropertyNameIterator())
+ return "For-in iterator";
+ if (!cell->isObject())
+ return "[empty cell]";
+ const ClassInfo* info = cell->classInfo();
+ return info ? info->className : "Object";
+}
+
+HashCountedSet<const char*>* Heap::protectedObjectTypeCounts()
+{
+ HashCountedSet<const char*>* counts = new HashCountedSet<const char*>;
+
+ ProtectCountSet::iterator end = m_protectedValues.end();
+ for (ProtectCountSet::iterator it = m_protectedValues.begin(); it != end; ++it)
+ counts->add(typeName(it->first));
+
+ return counts;
+}
+
+HashCountedSet<const char*>* Heap::objectTypeCounts()
+{
+ HashCountedSet<const char*>* counts = new HashCountedSet<const char*>;
+
+ LiveObjectIterator it = primaryHeapBegin();
+ LiveObjectIterator heapEnd = primaryHeapEnd();
+ for ( ; it != heapEnd; ++it)
+ counts->add(typeName(*it));
+
+ return counts;
+}
+
+bool Heap::isBusy()
+{
+ return m_heap.operationInProgress != NoOperation;
+}
+
+void Heap::reset()
+{
+ ASSERT(globalData()->identifierTable == wtfThreadData().currentIdentifierTable());
+ JAVASCRIPTCORE_GC_BEGIN();
+
+ markRoots();
+
+ JAVASCRIPTCORE_GC_MARKED();
+
+ m_heap.nextCell = 0;
+ m_heap.nextBlock = 0;
+ m_heap.nextNumber = 0;
+ m_heap.extraCost = 0;
+#if ENABLE(JSC_ZOMBIES)
+ sweep();
+#endif
+ resizeBlocks();
+
+ JAVASCRIPTCORE_GC_END();
+
+ (*m_activityCallback)();
+}
+
+void Heap::collectAllGarbage()
+{
+ ASSERT(globalData()->identifierTable == wtfThreadData().currentIdentifierTable());
+ JAVASCRIPTCORE_GC_BEGIN();
+
+ // If the last iteration through the heap deallocated blocks, we need
+ // to clean up remaining garbage before marking. Otherwise, the conservative
+ // marking mechanism might follow a pointer to unmapped memory.
+ if (m_heap.didShrink)
+ sweep();
+
+ markRoots();
+
+ JAVASCRIPTCORE_GC_MARKED();
+
+ m_heap.nextCell = 0;
+ m_heap.nextBlock = 0;
+ m_heap.nextNumber = 0;
+ m_heap.extraCost = 0;
+ sweep();
+ resizeBlocks();
+
+ JAVASCRIPTCORE_GC_END();
+}
+
+LiveObjectIterator Heap::primaryHeapBegin()
+{
+ return LiveObjectIterator(m_heap, 0);
+}
+
+LiveObjectIterator Heap::primaryHeapEnd()
+{
+ return LiveObjectIterator(m_heap, m_heap.usedBlocks);
+}
+
+void Heap::setActivityCallback(PassOwnPtr<GCActivityCallback> activityCallback)
+{
+ m_activityCallback = activityCallback;
+}
+
+GCActivityCallback* Heap::activityCallback()
+{
+ return m_activityCallback.get();
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/Collector.h b/Source/JavaScriptCore/runtime/Collector.h
new file mode 100644
index 0000000..a4e2fe1
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/Collector.h
@@ -0,0 +1,336 @@
+/*
+ * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
+ * Copyright (C) 2001 Peter Kelly (pmk@post.com)
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifndef Collector_h
+#define Collector_h
+
+#include "GCHandle.h"
+#include "JSValue.h"
+#include <stddef.h>
+#include <string.h>
+#include <wtf/Bitmap.h>
+#include <wtf/FixedArray.h>
+#include <wtf/HashCountedSet.h>
+#include <wtf/HashSet.h>
+#include <wtf/Noncopyable.h>
+#include <wtf/OwnPtr.h>
+#include <wtf/PageAllocation.h>
+#include <wtf/PageAllocationAligned.h>
+#include <wtf/PassOwnPtr.h>
+#include <wtf/StdLibExtras.h>
+#include <wtf/Threading.h>
+
+#if ENABLE(JSC_MULTIPLE_THREADS)
+#include <pthread.h>
+#endif
+
+#define ASSERT_CLASS_FITS_IN_CELL(class) COMPILE_ASSERT(sizeof(class) <= CELL_SIZE, class_fits_in_cell)
+
+namespace JSC {
+
+ class CollectorBlock;
+ class GCActivityCallback;
+ class JSCell;
+ class JSGlobalData;
+ class JSValue;
+ class MarkedArgumentBuffer;
+ class MarkStack;
+
+ enum OperationInProgress { NoOperation, Allocation, Collection };
+
+ class LiveObjectIterator;
+
+#if OS(WINCE) || OS(SYMBIAN) || PLATFORM(BREWMP)
+ const size_t BLOCK_SIZE = 64 * 1024; // 64k
+#else
+ const size_t BLOCK_SIZE = 256 * 1024; // 256k
+#endif
+
+ struct CollectorHeap {
+ size_t nextBlock;
+ size_t nextCell;
+ PageAllocationAligned* blocks;
+
+ void* nextNumber;
+
+ size_t numBlocks;
+ size_t usedBlocks;
+
+ size_t extraCost;
+ bool didShrink;
+
+ OperationInProgress operationInProgress;
+
+ CollectorBlock* collectorBlock(size_t index) const
+ {
+ return static_cast<CollectorBlock*>(blocks[index].base());
+ }
+ };
+
+ class Heap : public Noncopyable {
+ public:
+ class Thread;
+
+ void destroy();
+
+ void* allocateNumber(size_t);
+ void* allocate(size_t);
+
+ bool isBusy(); // true if an allocation or collection is in progress
+ void collectAllGarbage();
+
+ GCActivityCallback* activityCallback();
+ void setActivityCallback(PassOwnPtr<GCActivityCallback>);
+
+ static const size_t minExtraCost = 256;
+ static const size_t maxExtraCost = 1024 * 1024;
+
+ void reportExtraMemoryCost(size_t cost);
+
+ size_t objectCount() const;
+ struct Statistics {
+ size_t size;
+ size_t free;
+ };
+ Statistics statistics() const;
+ size_t size() const;
+
+ void protect(JSValue);
+ // Returns true if the value is no longer protected by any protect pointers
+ // (though it may still be alive due to heap/stack references).
+ bool unprotect(JSValue);
+
+ static Heap* heap(JSValue); // 0 for immediate values
+ static Heap* heap(JSCell*);
+
+ size_t globalObjectCount();
+ size_t protectedObjectCount();
+ size_t protectedGlobalObjectCount();
+ HashCountedSet<const char*>* protectedObjectTypeCounts();
+ HashCountedSet<const char*>* objectTypeCounts();
+
+ void registerThread(); // Only needs to be called by clients that can use the same heap from multiple threads.
+
+ static bool isCellMarked(const JSCell*);
+ static bool checkMarkCell(const JSCell*);
+ static void markCell(JSCell*);
+
+ WeakGCHandle* addWeakGCHandle(JSCell*);
+
+ void markConservatively(MarkStack&, void* start, void* end);
+
+ void pushTempSortVector(WTF::Vector<ValueStringPair>*);
+ void popTempSortVector(WTF::Vector<ValueStringPair>*);
+
+ HashSet<MarkedArgumentBuffer*>& markListSet() { if (!m_markListSet) m_markListSet = new HashSet<MarkedArgumentBuffer*>; return *m_markListSet; }
+
+ JSGlobalData* globalData() const { return m_globalData; }
+ static bool isNumber(JSCell*);
+
+ LiveObjectIterator primaryHeapBegin();
+ LiveObjectIterator primaryHeapEnd();
+
+ private:
+ void reset();
+ void sweep();
+ static CollectorBlock* cellBlock(const JSCell*);
+ static size_t cellOffset(const JSCell*);
+
+ friend class JSGlobalData;
+ Heap(JSGlobalData*);
+ ~Heap();
+
+ NEVER_INLINE CollectorBlock* allocateBlock();
+ NEVER_INLINE void freeBlock(size_t);
+ void freeBlocks();
+ void resizeBlocks();
+ void growBlocks(size_t neededBlocks);
+ void shrinkBlocks(size_t neededBlocks);
+ void clearMarkBits();
+ void clearMarkBits(CollectorBlock*);
+ size_t markedCells(size_t startBlock = 0, size_t startCell = 0) const;
+
+ void recordExtraCost(size_t);
+
+ void addToStatistics(Statistics&) const;
+
+ void markRoots();
+ void markProtectedObjects(MarkStack&);
+ void markTempSortVectors(MarkStack&);
+ void markCurrentThreadConservatively(MarkStack&);
+ void markCurrentThreadConservativelyInternal(MarkStack&);
+ void markOtherThreadConservatively(MarkStack&, Thread*);
+ void markStackObjectsConservatively(MarkStack&);
+
+ void updateWeakGCHandles();
+ WeakGCHandlePool* weakGCHandlePool(size_t index);
+
+ typedef HashCountedSet<JSCell*> ProtectCountSet;
+
+ CollectorHeap m_heap;
+
+ ProtectCountSet m_protectedValues;
+ WTF::Vector<PageAllocationAligned> m_weakGCHandlePools;
+ WTF::Vector<WTF::Vector<ValueStringPair>* > m_tempSortingVectors;
+
+ HashSet<MarkedArgumentBuffer*>* m_markListSet;
+
+ OwnPtr<GCActivityCallback> m_activityCallback;
+
+#if ENABLE(JSC_MULTIPLE_THREADS)
+ void makeUsableFromMultipleThreads();
+
+ static void unregisterThread(void*);
+ void unregisterThread();
+
+ Mutex m_registeredThreadsMutex;
+ Thread* m_registeredThreads;
+ pthread_key_t m_currentThreadRegistrar;
+#endif
+
+ JSGlobalData* m_globalData;
+ };
+
+ // tunable parameters
+ // derived constants
+ const size_t BLOCK_OFFSET_MASK = BLOCK_SIZE - 1;
+ const size_t BLOCK_MASK = ~BLOCK_OFFSET_MASK;
+ const size_t MINIMUM_CELL_SIZE = 64;
+ const size_t CELL_ARRAY_LENGTH = (MINIMUM_CELL_SIZE / sizeof(double)) + (MINIMUM_CELL_SIZE % sizeof(double) != 0 ? sizeof(double) : 0);
+ const size_t CELL_SIZE = CELL_ARRAY_LENGTH * sizeof(double);
+ const size_t SMALL_CELL_SIZE = CELL_SIZE / 2;
+ const size_t CELL_MASK = CELL_SIZE - 1;
+ const size_t CELL_ALIGN_MASK = ~CELL_MASK;
+ const size_t CELLS_PER_BLOCK = (BLOCK_SIZE - sizeof(Heap*)) * 8 * CELL_SIZE / (8 * CELL_SIZE + 1) / CELL_SIZE; // one bitmap byte can represent 8 cells.
+
+ const size_t BITMAP_SIZE = (CELLS_PER_BLOCK + 7) / 8;
+ const size_t BITMAP_WORDS = (BITMAP_SIZE + 3) / sizeof(uint32_t);
+
+ struct CollectorBitmap {
+ FixedArray<uint32_t, BITMAP_WORDS> bits;
+ bool get(size_t n) const { return !!(bits[n >> 5] & (1 << (n & 0x1F))); }
+ void set(size_t n) { bits[n >> 5] |= (1 << (n & 0x1F)); }
+ bool getset(size_t n)
+ {
+ unsigned i = (1 << (n & 0x1F));
+ uint32_t& b = bits[n >> 5];
+ bool r = !!(b & i);
+ b |= i;
+ return r;
+ }
+ void clear(size_t n) { bits[n >> 5] &= ~(1 << (n & 0x1F)); }
+ void clearAll() { memset(bits.data(), 0, sizeof(bits)); }
+ ALWAYS_INLINE void advanceToNextPossibleFreeCell(size_t& startCell)
+ {
+ if (!~bits[startCell >> 5])
+ startCell = (startCell & (~0x1F)) + 32;
+ else
+ ++startCell;
+ }
+ size_t count(size_t startCell = 0)
+ {
+ size_t result = 0;
+ for ( ; (startCell & 0x1F) != 0; ++startCell) {
+ if (get(startCell))
+ ++result;
+ }
+ for (size_t i = startCell >> 5; i < BITMAP_WORDS; ++i)
+ result += WTF::bitCount(bits[i]);
+ return result;
+ }
+ size_t isEmpty() // Much more efficient than testing count() == 0.
+ {
+ for (size_t i = 0; i < BITMAP_WORDS; ++i)
+ if (bits[i] != 0)
+ return false;
+ return true;
+ }
+ };
+
+ struct CollectorCell {
+ FixedArray<double, CELL_ARRAY_LENGTH> memory;
+ };
+
+ class CollectorBlock {
+ public:
+ FixedArray<CollectorCell, CELLS_PER_BLOCK> cells;
+ CollectorBitmap marked;
+ Heap* heap;
+ };
+
+ struct HeapConstants {
+ static const size_t cellSize = CELL_SIZE;
+ static const size_t cellsPerBlock = CELLS_PER_BLOCK;
+ typedef CollectorCell Cell;
+ typedef CollectorBlock Block;
+ };
+
+ inline CollectorBlock* Heap::cellBlock(const JSCell* cell)
+ {
+ return reinterpret_cast<CollectorBlock*>(reinterpret_cast<uintptr_t>(cell) & BLOCK_MASK);
+ }
+
+ inline size_t Heap::cellOffset(const JSCell* cell)
+ {
+ return (reinterpret_cast<uintptr_t>(cell) & BLOCK_OFFSET_MASK) / CELL_SIZE;
+ }
+
+ inline bool Heap::isCellMarked(const JSCell* cell)
+ {
+ return cellBlock(cell)->marked.get(cellOffset(cell));
+ }
+
+ inline bool Heap::checkMarkCell(const JSCell* cell)
+ {
+ return cellBlock(cell)->marked.getset(cellOffset(cell));
+ }
+
+ inline void Heap::markCell(JSCell* cell)
+ {
+ cellBlock(cell)->marked.set(cellOffset(cell));
+ }
+
+ inline void Heap::reportExtraMemoryCost(size_t cost)
+ {
+ if (cost > minExtraCost)
+ recordExtraCost(cost);
+ }
+
+ inline void* Heap::allocateNumber(size_t s)
+ {
+ if (void* result = m_heap.nextNumber) {
+ m_heap.nextNumber = 0;
+ return result;
+ }
+
+ void* result = allocate(s);
+ m_heap.nextNumber = static_cast<char*>(result) + (CELL_SIZE / 2);
+ return result;
+ }
+
+
+ inline WeakGCHandlePool* Heap::weakGCHandlePool(size_t index)
+ {
+ return static_cast<WeakGCHandlePool*>(m_weakGCHandlePools[index].base());
+ }
+} // namespace JSC
+
+#endif /* Collector_h */
diff --git a/Source/JavaScriptCore/runtime/CollectorHeapIterator.h b/Source/JavaScriptCore/runtime/CollectorHeapIterator.h
new file mode 100644
index 0000000..9d107b7
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/CollectorHeapIterator.h
@@ -0,0 +1,140 @@
+/*
+ * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "Collector.h"
+
+#ifndef CollectorHeapIterator_h
+#define CollectorHeapIterator_h
+
+namespace JSC {
+
+ class CollectorHeapIterator {
+ public:
+ bool operator!=(const CollectorHeapIterator& other);
+ JSCell* operator*() const;
+
+ protected:
+ CollectorHeapIterator(CollectorHeap&, size_t startBlock, size_t startCell);
+ void advance(size_t max);
+
+ CollectorHeap& m_heap;
+ size_t m_block;
+ size_t m_cell;
+ };
+
+ class LiveObjectIterator : public CollectorHeapIterator {
+ public:
+ LiveObjectIterator(CollectorHeap&, size_t startBlock, size_t startCell = 0);
+ LiveObjectIterator& operator++();
+ };
+
+ class DeadObjectIterator : public CollectorHeapIterator {
+ public:
+ DeadObjectIterator(CollectorHeap&, size_t startBlock, size_t startCell = 0);
+ DeadObjectIterator& operator++();
+ };
+
+ class ObjectIterator : public CollectorHeapIterator {
+ public:
+ ObjectIterator(CollectorHeap&, size_t startBlock, size_t startCell = 0);
+ ObjectIterator& operator++();
+ };
+
+ inline CollectorHeapIterator::CollectorHeapIterator(CollectorHeap& heap, size_t startBlock, size_t startCell)
+ : m_heap(heap)
+ , m_block(startBlock)
+ , m_cell(startCell)
+ {
+ }
+
+ inline bool CollectorHeapIterator::operator!=(const CollectorHeapIterator& other)
+ {
+ return m_block != other.m_block || m_cell != other.m_cell;
+ }
+
+ inline JSCell* CollectorHeapIterator::operator*() const
+ {
+ return reinterpret_cast<JSCell*>(&m_heap.collectorBlock(m_block)->cells[m_cell]);
+ }
+
+ // Iterators advance up to the next-to-last -- and not the last -- cell in a
+ // block, since the last cell is a dummy sentinel.
+ inline void CollectorHeapIterator::advance(size_t max)
+ {
+ ++m_cell;
+ if (m_cell == max) {
+ m_cell = 0;
+ ++m_block;
+ }
+ }
+
+ inline LiveObjectIterator::LiveObjectIterator(CollectorHeap& heap, size_t startBlock, size_t startCell)
+ : CollectorHeapIterator(heap, startBlock, startCell - 1)
+ {
+ ++(*this);
+ }
+
+ inline LiveObjectIterator& LiveObjectIterator::operator++()
+ {
+ advance(HeapConstants::cellsPerBlock - 1);
+ if (m_block < m_heap.nextBlock || (m_block == m_heap.nextBlock && m_cell < m_heap.nextCell))
+ return *this;
+
+ while (m_block < m_heap.usedBlocks && !m_heap.collectorBlock(m_block)->marked.get(m_cell))
+ advance(HeapConstants::cellsPerBlock - 1);
+ return *this;
+ }
+
+ inline DeadObjectIterator::DeadObjectIterator(CollectorHeap& heap, size_t startBlock, size_t startCell)
+ : CollectorHeapIterator(heap, startBlock, startCell - 1)
+ {
+ ++(*this);
+ }
+
+ inline DeadObjectIterator& DeadObjectIterator::operator++()
+ {
+ do {
+ advance(HeapConstants::cellsPerBlock - 1);
+ ASSERT(m_block > m_heap.nextBlock || (m_block == m_heap.nextBlock && m_cell >= m_heap.nextCell));
+ } while (m_block < m_heap.usedBlocks && m_heap.collectorBlock(m_block)->marked.get(m_cell));
+ return *this;
+ }
+
+ inline ObjectIterator::ObjectIterator(CollectorHeap& heap, size_t startBlock, size_t startCell)
+ : CollectorHeapIterator(heap, startBlock, startCell - 1)
+ {
+ ++(*this);
+ }
+
+ inline ObjectIterator& ObjectIterator::operator++()
+ {
+ advance(HeapConstants::cellsPerBlock - 1);
+ return *this;
+ }
+
+} // namespace JSC
+
+#endif // CollectorHeapIterator_h
diff --git a/Source/JavaScriptCore/runtime/CommonIdentifiers.cpp b/Source/JavaScriptCore/runtime/CommonIdentifiers.cpp
new file mode 100644
index 0000000..1561102
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/CommonIdentifiers.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2003, 2007, 2009 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+#include "CommonIdentifiers.h"
+
+namespace JSC {
+
+static const char* const nullCString = 0;
+
+#define INITIALIZE_PROPERTY_NAME(name) , name(globalData, #name)
+
+CommonIdentifiers::CommonIdentifiers(JSGlobalData* globalData)
+ : nullIdentifier(globalData, nullCString)
+ , emptyIdentifier(globalData, "")
+ , underscoreProto(globalData, "__proto__")
+ , thisIdentifier(globalData, "this")
+ , useStrictIdentifier(globalData, "use strict")
+ JSC_COMMON_IDENTIFIERS_EACH_PROPERTY_NAME(INITIALIZE_PROPERTY_NAME)
+{
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/CommonIdentifiers.h b/Source/JavaScriptCore/runtime/CommonIdentifiers.h
new file mode 100644
index 0000000..1e22b6a
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/CommonIdentifiers.h
@@ -0,0 +1,106 @@
+/*
+ * Copyright (C) 2003, 2007, 2009 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef CommonIdentifiers_h
+#define CommonIdentifiers_h
+
+#include "Identifier.h"
+#include <wtf/Noncopyable.h>
+
+// MarkedArgumentBuffer of property names, passed to a macro so we can do set them up various
+// ways without repeating the list.
+#define JSC_COMMON_IDENTIFIERS_EACH_PROPERTY_NAME(macro) \
+ macro(__defineGetter__) \
+ macro(__defineSetter__) \
+ macro(__lookupGetter__) \
+ macro(__lookupSetter__) \
+ macro(apply) \
+ macro(arguments) \
+ macro(call) \
+ macro(callee) \
+ macro(caller) \
+ macro(compile) \
+ macro(configurable) \
+ macro(constructor) \
+ macro(create) \
+ macro(defineProperty) \
+ macro(defineProperties) \
+ macro(enumerable) \
+ macro(eval) \
+ macro(exec) \
+ macro(fromCharCode) \
+ macro(global) \
+ macro(get) \
+ macro(getPrototypeOf) \
+ macro(getOwnPropertyDescriptor) \
+ macro(getOwnPropertyNames) \
+ macro(hasOwnProperty) \
+ macro(ignoreCase) \
+ macro(index) \
+ macro(input) \
+ macro(isArray) \
+ macro(isPrototypeOf) \
+ macro(keys) \
+ macro(length) \
+ macro(message) \
+ macro(multiline) \
+ macro(name) \
+ macro(now) \
+ macro(parse) \
+ macro(propertyIsEnumerable) \
+ macro(prototype) \
+ macro(set) \
+ macro(source) \
+ macro(test) \
+ macro(toExponential) \
+ macro(toFixed) \
+ macro(toISOString) \
+ macro(toJSON) \
+ macro(toLocaleString) \
+ macro(toPrecision) \
+ macro(toString) \
+ macro(UTC) \
+ macro(value) \
+ macro(valueOf) \
+ macro(writable) \
+ macro(displayName)
+
+namespace JSC {
+
+ class CommonIdentifiers : public Noncopyable {
+ private:
+ CommonIdentifiers(JSGlobalData*);
+ friend class JSGlobalData;
+
+ public:
+ const Identifier nullIdentifier;
+ const Identifier emptyIdentifier;
+ const Identifier underscoreProto;
+ const Identifier thisIdentifier;
+ const Identifier useStrictIdentifier;
+
+#define JSC_IDENTIFIER_DECLARE_PROPERTY_NAME_GLOBAL(name) const Identifier name;
+ JSC_COMMON_IDENTIFIERS_EACH_PROPERTY_NAME(JSC_IDENTIFIER_DECLARE_PROPERTY_NAME_GLOBAL)
+#undef JSC_IDENTIFIER_DECLARE_PROPERTY_NAME_GLOBAL
+ };
+
+} // namespace JSC
+
+#endif // CommonIdentifiers_h
diff --git a/Source/JavaScriptCore/runtime/Completion.cpp b/Source/JavaScriptCore/runtime/Completion.cpp
new file mode 100644
index 0000000..eeb8b0d
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/Completion.cpp
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
+ * Copyright (C) 2001 Peter Kelly (pmk@post.com)
+ * Copyright (C) 2003, 2007 Apple Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+#include "Completion.h"
+
+#include "CallFrame.h"
+#include "JSGlobalObject.h"
+#include "JSLock.h"
+#include "Interpreter.h"
+#include "Parser.h"
+#include "Debugger.h"
+#include "WTFThreadData.h"
+#include <stdio.h>
+
+namespace JSC {
+
+Completion checkSyntax(ExecState* exec, const SourceCode& source)
+{
+ JSLock lock(exec);
+ ASSERT(exec->globalData().identifierTable == wtfThreadData().currentIdentifierTable());
+
+ RefPtr<ProgramExecutable> program = ProgramExecutable::create(exec, source);
+ JSObject* error = program->checkSyntax(exec);
+ if (error)
+ return Completion(Throw, error);
+
+ return Completion(Normal);
+}
+
+Completion evaluate(ExecState* exec, ScopeChain& scopeChain, const SourceCode& source, JSValue thisValue)
+{
+ JSLock lock(exec);
+ ASSERT(exec->globalData().identifierTable == wtfThreadData().currentIdentifierTable());
+
+ RefPtr<ProgramExecutable> program = ProgramExecutable::create(exec, source);
+ JSObject* error = program->compile(exec, scopeChain.node());
+ if (error)
+ return Completion(Throw, error);
+
+ JSObject* thisObj = (!thisValue || thisValue.isUndefinedOrNull()) ? exec->dynamicGlobalObject() : thisValue.toObject(exec);
+
+ JSValue result = exec->interpreter()->execute(program.get(), exec, scopeChain.node(), thisObj);
+
+ if (exec->hadException()) {
+ JSValue exception = exec->exception();
+ exec->clearException();
+
+ ComplType exceptionType = Throw;
+ if (exception.isObject())
+ exceptionType = asObject(exception)->exceptionType();
+ return Completion(exceptionType, exception);
+ }
+ return Completion(Normal, result);
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/Completion.h b/Source/JavaScriptCore/runtime/Completion.h
new file mode 100644
index 0000000..63b315e
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/Completion.h
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
+ * Copyright (C) 2001 Peter Kelly (pmk@post.com)
+ * Copyright (C) 2003, 2007 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef Completion_h
+#define Completion_h
+
+#include "JSValue.h"
+
+namespace JSC {
+
+ class ExecState;
+ class ScopeChain;
+ class SourceCode;
+
+ enum ComplType { Normal, Break, Continue, ReturnValue, Throw, Interrupted, Terminated };
+
+ /*
+ * Completion objects are used to convey the return status and value
+ * from functions.
+ */
+ class Completion {
+ public:
+ Completion(ComplType type = Normal, JSValue value = JSValue())
+ : m_type(type)
+ , m_value(value)
+ {
+ }
+
+ ComplType complType() const { return m_type; }
+ JSValue value() const { return m_value; }
+ void setValue(JSValue v) { m_value = v; }
+ bool isValueCompletion() const { return m_value; }
+
+ private:
+ ComplType m_type;
+ JSValue m_value;
+ };
+
+ Completion checkSyntax(ExecState*, const SourceCode&);
+ Completion evaluate(ExecState*, ScopeChain&, const SourceCode&, JSValue thisValue = JSValue());
+
+} // namespace JSC
+
+#endif // Completion_h
diff --git a/Source/JavaScriptCore/runtime/ConstructData.cpp b/Source/JavaScriptCore/runtime/ConstructData.cpp
new file mode 100644
index 0000000..5da2a91
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/ConstructData.cpp
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "ConstructData.h"
+
+#include "Executable.h"
+#include "Interpreter.h"
+#include "JSFunction.h"
+#include "JSGlobalObject.h"
+
+namespace JSC {
+
+JSObject* construct(ExecState* exec, JSValue constructorObject, ConstructType constructType, const ConstructData& constructData, const ArgList& args)
+{
+ ASSERT(constructType == ConstructTypeJS || constructType == ConstructTypeHost);
+ return exec->interpreter()->executeConstruct(exec, asObject(constructorObject), constructType, constructData, args);
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/ConstructData.h b/Source/JavaScriptCore/runtime/ConstructData.h
new file mode 100644
index 0000000..3d5f732
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/ConstructData.h
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ConstructData_h
+#define ConstructData_h
+
+#include "JSValue.h"
+
+namespace JSC {
+
+ class ArgList;
+ class ExecState;
+ class FunctionExecutable;
+ class JSObject;
+ class ScopeChainNode;
+
+ enum ConstructType {
+ ConstructTypeNone,
+ ConstructTypeHost,
+ ConstructTypeJS
+ };
+
+ typedef EncodedJSValue (JSC_HOST_CALL *NativeConstructor)(ExecState*);
+
+ union ConstructData {
+ struct {
+ NativeConstructor function;
+ } native;
+ struct {
+ FunctionExecutable* functionExecutable;
+ ScopeChainNode* scopeChain;
+ } js;
+ };
+
+ JSObject* construct(ExecState*, JSValue constructor, ConstructType, const ConstructData&, const ArgList&);
+
+} // namespace JSC
+
+#endif // ConstructData_h
diff --git a/Source/JavaScriptCore/runtime/DateConstructor.cpp b/Source/JavaScriptCore/runtime/DateConstructor.cpp
new file mode 100644
index 0000000..dcbe12d
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/DateConstructor.cpp
@@ -0,0 +1,203 @@
+/*
+ * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ */
+
+#include "config.h"
+#include "DateConstructor.h"
+
+#include "DateConversion.h"
+#include "DateInstance.h"
+#include "DatePrototype.h"
+#include "JSFunction.h"
+#include "JSGlobalObject.h"
+#include "JSString.h"
+#include "JSStringBuilder.h"
+#include "ObjectPrototype.h"
+#include "PrototypeFunction.h"
+#include <math.h>
+#include <time.h>
+#include <wtf/DateMath.h>
+#include <wtf/MathExtras.h>
+
+#if OS(WINCE) && !PLATFORM(QT)
+extern "C" time_t time(time_t* timer); // Provided by libce.
+#endif
+
+#if HAVE(SYS_TIME_H)
+#include <sys/time.h>
+#endif
+
+#if HAVE(SYS_TIMEB_H)
+#include <sys/timeb.h>
+#endif
+
+using namespace WTF;
+
+namespace JSC {
+
+ASSERT_CLASS_FITS_IN_CELL(DateConstructor);
+
+static EncodedJSValue JSC_HOST_CALL dateParse(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateNow(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateUTC(ExecState*);
+
+DateConstructor::DateConstructor(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, Structure* prototypeFunctionStructure, DatePrototype* datePrototype)
+ : InternalFunction(&exec->globalData(), globalObject, structure, Identifier(exec, datePrototype->classInfo()->className))
+{
+ putDirectWithoutTransition(exec->propertyNames().prototype, datePrototype, DontEnum|DontDelete|ReadOnly);
+
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 1, exec->propertyNames().parse, dateParse), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 7, exec->propertyNames().UTC, dateUTC), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 0, exec->propertyNames().now, dateNow), DontEnum);
+
+ putDirectWithoutTransition(exec->propertyNames().length, jsNumber(7), ReadOnly | DontEnum | DontDelete);
+}
+
+// ECMA 15.9.3
+JSObject* constructDate(ExecState* exec, const ArgList& args)
+{
+ int numArgs = args.size();
+
+ double value;
+
+ if (numArgs == 0) // new Date() ECMA 15.9.3.3
+ value = jsCurrentTime();
+ else if (numArgs == 1) {
+ if (args.at(0).inherits(&DateInstance::info))
+ value = asDateInstance(args.at(0))->internalNumber();
+ else {
+ JSValue primitive = args.at(0).toPrimitive(exec);
+ if (primitive.isString())
+ value = parseDate(exec, primitive.getString(exec));
+ else
+ value = primitive.toNumber(exec);
+ }
+ } else {
+ double doubleArguments[7] = {
+ args.at(0).toNumber(exec),
+ args.at(1).toNumber(exec),
+ args.at(2).toNumber(exec),
+ args.at(3).toNumber(exec),
+ args.at(4).toNumber(exec),
+ args.at(5).toNumber(exec),
+ args.at(6).toNumber(exec)
+ };
+ if (isnan(doubleArguments[0])
+ || isnan(doubleArguments[1])
+ || (numArgs >= 3 && isnan(doubleArguments[2]))
+ || (numArgs >= 4 && isnan(doubleArguments[3]))
+ || (numArgs >= 5 && isnan(doubleArguments[4]))
+ || (numArgs >= 6 && isnan(doubleArguments[5]))
+ || (numArgs >= 7 && isnan(doubleArguments[6])))
+ value = NaN;
+ else {
+ GregorianDateTime t;
+ int year = JSC::toInt32(doubleArguments[0]);
+ t.year = (year >= 0 && year <= 99) ? year : year - 1900;
+ t.month = JSC::toInt32(doubleArguments[1]);
+ t.monthDay = (numArgs >= 3) ? JSC::toInt32(doubleArguments[2]) : 1;
+ t.hour = JSC::toInt32(doubleArguments[3]);
+ t.minute = JSC::toInt32(doubleArguments[4]);
+ t.second = JSC::toInt32(doubleArguments[5]);
+ t.isDST = -1;
+ double ms = (numArgs >= 7) ? doubleArguments[6] : 0;
+ value = gregorianDateTimeToMS(exec, t, ms, false);
+ }
+ }
+
+ return new (exec) DateInstance(exec, value);
+}
+
+static EncodedJSValue JSC_HOST_CALL constructWithDateConstructor(ExecState* exec)
+{
+ ArgList args(exec);
+ return JSValue::encode(constructDate(exec, args));
+}
+
+ConstructType DateConstructor::getConstructData(ConstructData& constructData)
+{
+ constructData.native.function = constructWithDateConstructor;
+ return ConstructTypeHost;
+}
+
+// ECMA 15.9.2
+static EncodedJSValue JSC_HOST_CALL callDate(ExecState* exec)
+{
+ time_t localTime = time(0);
+ tm localTM;
+ getLocalTime(&localTime, &localTM);
+ GregorianDateTime ts(exec, localTM);
+ DateConversionBuffer date;
+ DateConversionBuffer time;
+ formatDate(ts, date);
+ formatTime(ts, time);
+ return JSValue::encode(jsMakeNontrivialString(exec, date, " ", time));
+}
+
+CallType DateConstructor::getCallData(CallData& callData)
+{
+ callData.native.function = callDate;
+ return CallTypeHost;
+}
+
+static EncodedJSValue JSC_HOST_CALL dateParse(ExecState* exec)
+{
+ return JSValue::encode(jsNumber(parseDate(exec, exec->argument(0).toString(exec))));
+}
+
+static EncodedJSValue JSC_HOST_CALL dateNow(ExecState*)
+{
+ return JSValue::encode(jsNumber(jsCurrentTime()));
+}
+
+static EncodedJSValue JSC_HOST_CALL dateUTC(ExecState* exec)
+{
+ double doubleArguments[7] = {
+ exec->argument(0).toNumber(exec),
+ exec->argument(1).toNumber(exec),
+ exec->argument(2).toNumber(exec),
+ exec->argument(3).toNumber(exec),
+ exec->argument(4).toNumber(exec),
+ exec->argument(5).toNumber(exec),
+ exec->argument(6).toNumber(exec)
+ };
+ int n = exec->argumentCount();
+ if (isnan(doubleArguments[0])
+ || isnan(doubleArguments[1])
+ || (n >= 3 && isnan(doubleArguments[2]))
+ || (n >= 4 && isnan(doubleArguments[3]))
+ || (n >= 5 && isnan(doubleArguments[4]))
+ || (n >= 6 && isnan(doubleArguments[5]))
+ || (n >= 7 && isnan(doubleArguments[6])))
+ return JSValue::encode(jsNaN());
+
+ GregorianDateTime t;
+ int year = JSC::toInt32(doubleArguments[0]);
+ t.year = (year >= 0 && year <= 99) ? year : year - 1900;
+ t.month = JSC::toInt32(doubleArguments[1]);
+ t.monthDay = (n >= 3) ? JSC::toInt32(doubleArguments[2]) : 1;
+ t.hour = JSC::toInt32(doubleArguments[3]);
+ t.minute = JSC::toInt32(doubleArguments[4]);
+ t.second = JSC::toInt32(doubleArguments[5]);
+ double ms = (n >= 7) ? doubleArguments[6] : 0;
+ return JSValue::encode(jsNumber(timeClip(gregorianDateTimeToMS(exec, t, ms, true))));
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/DateConstructor.h b/Source/JavaScriptCore/runtime/DateConstructor.h
new file mode 100644
index 0000000..c8ca456
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/DateConstructor.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifndef DateConstructor_h
+#define DateConstructor_h
+
+#include "InternalFunction.h"
+
+namespace JSC {
+
+ class DatePrototype;
+
+ class DateConstructor : public InternalFunction {
+ public:
+ DateConstructor(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure>, Structure* prototypeFunctionStructure, DatePrototype*);
+
+ private:
+ virtual ConstructType getConstructData(ConstructData&);
+ virtual CallType getCallData(CallData&);
+ };
+
+ JSObject* constructDate(ExecState*, const ArgList&);
+
+} // namespace JSC
+
+#endif // DateConstructor_h
diff --git a/Source/JavaScriptCore/runtime/DateConversion.cpp b/Source/JavaScriptCore/runtime/DateConversion.cpp
new file mode 100644
index 0000000..d4b8232
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/DateConversion.cpp
@@ -0,0 +1,105 @@
+/*
+ * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Alternatively, the contents of this file may be used under the terms
+ * of either the Mozilla Public License Version 1.1, found at
+ * http://www.mozilla.org/MPL/ (the "MPL") or the GNU General Public
+ * License Version 2.0, found at http://www.fsf.org/copyleft/gpl.html
+ * (the "GPL"), in which case the provisions of the MPL or the GPL are
+ * applicable instead of those above. If you wish to allow use of your
+ * version of this file only under the terms of one of those two
+ * licenses (the MPL or the GPL) and not to allow others to use your
+ * version of this file under the LGPL, indicate your decision by
+ * deletingthe provisions above and replace them with the notice and
+ * other provisions required by the MPL or the GPL, as the case may be.
+ * If you do not delete the provisions above, a recipient may use your
+ * version of this file under any of the LGPL, the MPL or the GPL.
+ */
+
+#include "config.h"
+#include "DateConversion.h"
+
+#include "CallFrame.h"
+#include "UString.h"
+#include <wtf/DateMath.h>
+#include <wtf/StringExtras.h>
+#include <wtf/text/CString.h>
+
+using namespace WTF;
+
+namespace JSC {
+
+double parseDate(ExecState* exec, const UString &date)
+{
+ if (date == exec->globalData().cachedDateString)
+ return exec->globalData().cachedDateStringValue;
+ double value = parseES5DateFromNullTerminatedCharacters(date.utf8().data());
+ if (isnan(value))
+ value = parseDateFromNullTerminatedCharacters(exec, date.utf8().data());
+ exec->globalData().cachedDateString = date;
+ exec->globalData().cachedDateStringValue = value;
+ return value;
+}
+
+void formatDate(const GregorianDateTime &t, DateConversionBuffer& buffer)
+{
+ snprintf(buffer, DateConversionBufferSize, "%s %s %02d %04d",
+ weekdayName[(t.weekDay + 6) % 7],
+ monthName[t.month], t.monthDay, t.year + 1900);
+}
+
+void formatDateUTCVariant(const GregorianDateTime &t, DateConversionBuffer& buffer)
+{
+ snprintf(buffer, DateConversionBufferSize, "%s, %02d %s %04d",
+ weekdayName[(t.weekDay + 6) % 7],
+ t.monthDay, monthName[t.month], t.year + 1900);
+}
+
+void formatTime(const GregorianDateTime &t, DateConversionBuffer& buffer)
+{
+ int offset = abs(gmtoffset(t));
+ char timeZoneName[70];
+ struct tm gtm = t;
+ strftime(timeZoneName, sizeof(timeZoneName), "%Z", &gtm);
+
+ if (timeZoneName[0]) {
+ snprintf(buffer, DateConversionBufferSize, "%02d:%02d:%02d GMT%c%02d%02d (%s)",
+ t.hour, t.minute, t.second,
+ gmtoffset(t) < 0 ? '-' : '+', offset / (60*60), (offset / 60) % 60, timeZoneName);
+ } else {
+ snprintf(buffer, DateConversionBufferSize, "%02d:%02d:%02d GMT%c%02d%02d",
+ t.hour, t.minute, t.second,
+ gmtoffset(t) < 0 ? '-' : '+', offset / (60*60), (offset / 60) % 60);
+ }
+}
+
+void formatTimeUTC(const GregorianDateTime &t, DateConversionBuffer& buffer)
+{
+ snprintf(buffer, DateConversionBufferSize, "%02d:%02d:%02d GMT", t.hour, t.minute, t.second);
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/DateConversion.h b/Source/JavaScriptCore/runtime/DateConversion.h
new file mode 100644
index 0000000..ff32b50
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/DateConversion.h
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either of the GNU General Public License Version 2 or later (the "GPL"),
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ */
+
+#ifndef DateConversion_h
+#define DateConversion_h
+
+#include "UString.h"
+
+namespace JSC {
+
+class ExecState;
+struct GregorianDateTime;
+
+static const unsigned DateConversionBufferSize = 100;
+typedef char DateConversionBuffer[DateConversionBufferSize];
+
+double parseDate(ExecState* exec, const UString&);
+void formatDate(const GregorianDateTime&, DateConversionBuffer&);
+void formatDateUTCVariant(const GregorianDateTime&, DateConversionBuffer&);
+void formatTime(const GregorianDateTime&, DateConversionBuffer&);
+void formatTimeUTC(const GregorianDateTime&, DateConversionBuffer&);
+
+} // namespace JSC
+
+#endif // DateConversion_h
diff --git a/Source/JavaScriptCore/runtime/DateInstance.cpp b/Source/JavaScriptCore/runtime/DateInstance.cpp
new file mode 100644
index 0000000..8562e2d
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/DateInstance.cpp
@@ -0,0 +1,87 @@
+/*
+ * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ */
+
+#include "config.h"
+#include "DateInstance.h"
+
+#include "JSGlobalObject.h"
+
+#include <math.h>
+#include <wtf/DateMath.h>
+#include <wtf/MathExtras.h>
+
+using namespace WTF;
+
+namespace JSC {
+
+const ClassInfo DateInstance::info = {"Date", 0, 0, 0};
+
+DateInstance::DateInstance(ExecState*, NonNullPassRefPtr<Structure> structure)
+ : JSWrapperObject(structure)
+{
+ setInternalValue(jsNaN());
+}
+
+DateInstance::DateInstance(ExecState*, NonNullPassRefPtr<Structure> structure, double time)
+ : JSWrapperObject(structure)
+{
+ setInternalValue(jsNumber(timeClip(time)));
+}
+
+DateInstance::DateInstance(ExecState* exec, double time)
+ : JSWrapperObject(exec->lexicalGlobalObject()->dateStructure())
+{
+ setInternalValue(jsNumber(timeClip(time)));
+}
+
+const GregorianDateTime* DateInstance::calculateGregorianDateTime(ExecState* exec) const
+{
+ double milli = internalNumber();
+ if (isnan(milli))
+ return 0;
+
+ if (!m_data)
+ m_data = exec->globalData().dateInstanceCache.add(milli);
+
+ if (m_data->m_gregorianDateTimeCachedForMS != milli) {
+ msToGregorianDateTime(exec, milli, false, m_data->m_cachedGregorianDateTime);
+ m_data->m_gregorianDateTimeCachedForMS = milli;
+ }
+ return &m_data->m_cachedGregorianDateTime;
+}
+
+const GregorianDateTime* DateInstance::calculateGregorianDateTimeUTC(ExecState* exec) const
+{
+ double milli = internalNumber();
+ if (isnan(milli))
+ return 0;
+
+ if (!m_data)
+ m_data = exec->globalData().dateInstanceCache.add(milli);
+
+ if (m_data->m_gregorianDateTimeUTCCachedForMS != milli) {
+ msToGregorianDateTime(exec, milli, true, m_data->m_cachedGregorianDateTimeUTC);
+ m_data->m_gregorianDateTimeUTCCachedForMS = milli;
+ }
+ return &m_data->m_cachedGregorianDateTimeUTC;
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/DateInstance.h b/Source/JavaScriptCore/runtime/DateInstance.h
new file mode 100644
index 0000000..77d46de
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/DateInstance.h
@@ -0,0 +1,82 @@
+/*
+ * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifndef DateInstance_h
+#define DateInstance_h
+
+#include "JSWrapperObject.h"
+
+namespace WTF {
+ struct GregorianDateTime;
+}
+
+namespace JSC {
+
+ class DateInstance : public JSWrapperObject {
+ public:
+ DateInstance(ExecState*, double);
+ DateInstance(ExecState*, NonNullPassRefPtr<Structure>, double);
+ explicit DateInstance(ExecState*, NonNullPassRefPtr<Structure>);
+
+ double internalNumber() const { return internalValue().uncheckedGetNumber(); }
+
+ static JS_EXPORTDATA const ClassInfo info;
+
+ const GregorianDateTime* gregorianDateTime(ExecState* exec) const
+ {
+ if (m_data && m_data->m_gregorianDateTimeCachedForMS == internalNumber())
+ return &m_data->m_cachedGregorianDateTime;
+ return calculateGregorianDateTime(exec);
+ }
+
+ const GregorianDateTime* gregorianDateTimeUTC(ExecState* exec) const
+ {
+ if (m_data && m_data->m_gregorianDateTimeUTCCachedForMS == internalNumber())
+ return &m_data->m_cachedGregorianDateTimeUTC;
+ return calculateGregorianDateTimeUTC(exec);
+ }
+
+ static PassRefPtr<Structure> createStructure(JSValue prototype)
+ {
+ return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount);
+ }
+
+ protected:
+ static const unsigned StructureFlags = OverridesMarkChildren | JSWrapperObject::StructureFlags;
+
+ private:
+ const GregorianDateTime* calculateGregorianDateTime(ExecState*) const;
+ const GregorianDateTime* calculateGregorianDateTimeUTC(ExecState*) const;
+ virtual const ClassInfo* classInfo() const { return &info; }
+
+ mutable RefPtr<DateInstanceData> m_data;
+ };
+
+ DateInstance* asDateInstance(JSValue);
+
+ inline DateInstance* asDateInstance(JSValue value)
+ {
+ ASSERT(asObject(value)->inherits(&DateInstance::info));
+ return static_cast<DateInstance*>(asObject(value));
+ }
+
+} // namespace JSC
+
+#endif // DateInstance_h
diff --git a/Source/JavaScriptCore/runtime/DateInstanceCache.h b/Source/JavaScriptCore/runtime/DateInstanceCache.h
new file mode 100644
index 0000000..b60c29a
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/DateInstanceCache.h
@@ -0,0 +1,94 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DateInstanceCache_h
+#define DateInstanceCache_h
+
+#include <wtf/DateMath.h>
+#include <wtf/HashFunctions.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+
+namespace JSC {
+
+ extern const double NaN;
+
+ class DateInstanceData : public RefCounted<DateInstanceData> {
+ public:
+ static PassRefPtr<DateInstanceData> create() { return adoptRef(new DateInstanceData); }
+
+ double m_gregorianDateTimeCachedForMS;
+ GregorianDateTime m_cachedGregorianDateTime;
+ double m_gregorianDateTimeUTCCachedForMS;
+ GregorianDateTime m_cachedGregorianDateTimeUTC;
+
+ private:
+ DateInstanceData()
+ : m_gregorianDateTimeCachedForMS(NaN)
+ , m_gregorianDateTimeUTCCachedForMS(NaN)
+ {
+ }
+ };
+
+ class DateInstanceCache {
+ public:
+ DateInstanceCache()
+ {
+ reset();
+ }
+
+ void reset()
+ {
+ for (size_t i = 0; i < cacheSize; ++i)
+ m_cache[i].key = NaN;
+ }
+
+ DateInstanceData* add(double d)
+ {
+ CacheEntry& entry = lookup(d);
+ if (d == entry.key)
+ return entry.value.get();
+
+ entry.key = d;
+ entry.value = DateInstanceData::create();
+ return entry.value.get();
+ }
+
+ private:
+ static const size_t cacheSize = 16;
+
+ struct CacheEntry {
+ double key;
+ RefPtr<DateInstanceData> value;
+ };
+
+ CacheEntry& lookup(double d) { return m_cache[WTF::FloatHash<double>::hash(d) & (cacheSize - 1)]; }
+
+ FixedArray<CacheEntry, cacheSize> m_cache;
+ };
+
+} // namespace JSC
+
+#endif // DateInstanceCache_h
diff --git a/Source/JavaScriptCore/runtime/DatePrototype.cpp b/Source/JavaScriptCore/runtime/DatePrototype.cpp
new file mode 100644
index 0000000..085cb33
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/DatePrototype.cpp
@@ -0,0 +1,1094 @@
+/*
+ * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2008, 2009 Torch Mobile, Inc. All rights reserved.
+ * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ */
+
+#include "config.h"
+#include "DatePrototype.h"
+
+#include "DateConversion.h"
+#include "DateInstance.h"
+#include "Error.h"
+#include "JSString.h"
+#include "JSStringBuilder.h"
+#include "Lookup.h"
+#include "ObjectPrototype.h"
+
+#if !PLATFORM(MAC) && HAVE(LANGINFO_H)
+#include <langinfo.h>
+#endif
+
+#include <limits.h>
+#include <locale.h>
+#include <math.h>
+#include <stdlib.h>
+#include <time.h>
+#include <wtf/Assertions.h>
+#include <wtf/DateMath.h>
+#include <wtf/MathExtras.h>
+#include <wtf/StringExtras.h>
+#include <wtf/UnusedParam.h>
+
+#if HAVE(SYS_PARAM_H)
+#include <sys/param.h>
+#endif
+
+#if HAVE(SYS_TIME_H)
+#include <sys/time.h>
+#endif
+
+#if HAVE(SYS_TIMEB_H)
+#include <sys/timeb.h>
+#endif
+
+#if PLATFORM(MAC)
+#include <CoreFoundation/CoreFoundation.h>
+#endif
+
+#if OS(WINCE) && !PLATFORM(QT)
+extern "C" size_t strftime(char * const s, const size_t maxsize, const char * const format, const struct tm * const t); //provided by libce
+#endif
+
+using namespace WTF;
+
+namespace JSC {
+
+ASSERT_CLASS_FITS_IN_CELL(DatePrototype);
+
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetDate(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetDay(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetFullYear(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetHours(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetMilliSeconds(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetMinutes(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetMonth(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetSeconds(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetTime(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetTimezoneOffset(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCDate(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCDay(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCFullYear(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCHours(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCMilliseconds(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCMinutes(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCMonth(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCSeconds(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncGetYear(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncSetDate(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncSetFullYear(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncSetHours(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncSetMilliSeconds(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncSetMinutes(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncSetMonth(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncSetSeconds(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncSetTime(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncSetUTCDate(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncSetUTCFullYear(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncSetUTCHours(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncSetUTCMilliseconds(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncSetUTCMinutes(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncSetUTCMonth(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncSetUTCSeconds(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncSetYear(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncToDateString(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncToGMTString(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncToLocaleDateString(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncToLocaleString(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncToLocaleTimeString(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncToString(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncToTimeString(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncToUTCString(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncToISOString(ExecState*);
+static EncodedJSValue JSC_HOST_CALL dateProtoFuncToJSON(ExecState*);
+
+}
+
+#include "DatePrototype.lut.h"
+
+namespace JSC {
+
+enum LocaleDateTimeFormat { LocaleDateAndTime, LocaleDate, LocaleTime };
+
+#if PLATFORM(MAC)
+
+// FIXME: Since this is superior to the strftime-based version, why limit this to PLATFORM(MAC)?
+// Instead we should consider using this whenever PLATFORM(CF) is true.
+
+static CFDateFormatterStyle styleFromArgString(const UString& string, CFDateFormatterStyle defaultStyle)
+{
+ if (string == "short")
+ return kCFDateFormatterShortStyle;
+ if (string == "medium")
+ return kCFDateFormatterMediumStyle;
+ if (string == "long")
+ return kCFDateFormatterLongStyle;
+ if (string == "full")
+ return kCFDateFormatterFullStyle;
+ return defaultStyle;
+}
+
+static JSCell* formatLocaleDate(ExecState* exec, DateInstance*, double timeInMilliseconds, LocaleDateTimeFormat format)
+{
+ CFDateFormatterStyle dateStyle = (format != LocaleTime ? kCFDateFormatterLongStyle : kCFDateFormatterNoStyle);
+ CFDateFormatterStyle timeStyle = (format != LocaleDate ? kCFDateFormatterLongStyle : kCFDateFormatterNoStyle);
+
+ bool useCustomFormat = false;
+ UString customFormatString;
+
+ UString arg0String = exec->argument(0).toString(exec);
+ if (arg0String == "custom" && !exec->argument(1).isUndefined()) {
+ useCustomFormat = true;
+ customFormatString = exec->argument(1).toString(exec);
+ } else if (format == LocaleDateAndTime && !exec->argument(1).isUndefined()) {
+ dateStyle = styleFromArgString(arg0String, dateStyle);
+ timeStyle = styleFromArgString(exec->argument(1).toString(exec), timeStyle);
+ } else if (format != LocaleTime && !exec->argument(0).isUndefined())
+ dateStyle = styleFromArgString(arg0String, dateStyle);
+ else if (format != LocaleDate && !exec->argument(0).isUndefined())
+ timeStyle = styleFromArgString(arg0String, timeStyle);
+
+ CFLocaleRef locale = CFLocaleCopyCurrent();
+ CFDateFormatterRef formatter = CFDateFormatterCreate(0, locale, dateStyle, timeStyle);
+ CFRelease(locale);
+
+ if (useCustomFormat) {
+ CFStringRef customFormatCFString = CFStringCreateWithCharacters(0, customFormatString.characters(), customFormatString.length());
+ CFDateFormatterSetFormat(formatter, customFormatCFString);
+ CFRelease(customFormatCFString);
+ }
+
+ CFStringRef string = CFDateFormatterCreateStringWithAbsoluteTime(0, formatter, floor(timeInMilliseconds / msPerSecond) - kCFAbsoluteTimeIntervalSince1970);
+
+ CFRelease(formatter);
+
+ // We truncate the string returned from CFDateFormatter if it's absurdly long (> 200 characters).
+ // That's not great error handling, but it just won't happen so it doesn't matter.
+ UChar buffer[200];
+ const size_t bufferLength = WTF_ARRAY_LENGTH(buffer);
+ size_t length = CFStringGetLength(string);
+ ASSERT(length <= bufferLength);
+ if (length > bufferLength)
+ length = bufferLength;
+ CFStringGetCharacters(string, CFRangeMake(0, length), buffer);
+
+ CFRelease(string);
+
+ return jsNontrivialString(exec, UString(buffer, length));
+}
+
+#else // !PLATFORM(MAC)
+
+static JSCell* formatLocaleDate(ExecState* exec, const GregorianDateTime& gdt, LocaleDateTimeFormat format)
+{
+#if HAVE(LANGINFO_H)
+ static const nl_item formats[] = { D_T_FMT, D_FMT, T_FMT };
+#elif (OS(WINCE) && !PLATFORM(QT)) || OS(SYMBIAN)
+ // strftime() does not support '#' on WinCE or Symbian
+ static const char* const formatStrings[] = { "%c", "%x", "%X" };
+#else
+ static const char* const formatStrings[] = { "%#c", "%#x", "%X" };
+#endif
+
+ // Offset year if needed
+ struct tm localTM = gdt;
+ int year = gdt.year + 1900;
+ bool yearNeedsOffset = year < 1900 || year > 2038;
+ if (yearNeedsOffset)
+ localTM.tm_year = equivalentYearForDST(year) - 1900;
+
+#if HAVE(LANGINFO_H)
+ // We do not allow strftime to generate dates with 2-digits years,
+ // both to avoid ambiguity, and a crash in strncpy, for years that
+ // need offset.
+ char* formatString = strdup(nl_langinfo(formats[format]));
+ char* yPos = strchr(formatString, 'y');
+ if (yPos)
+ *yPos = 'Y';
+#endif
+
+ // Do the formatting
+ const int bufsize = 128;
+ char timebuffer[bufsize];
+
+#if HAVE(LANGINFO_H)
+ size_t ret = strftime(timebuffer, bufsize, formatString, &localTM);
+ free(formatString);
+#else
+ size_t ret = strftime(timebuffer, bufsize, formatStrings[format], &localTM);
+#endif
+
+ if (ret == 0)
+ return jsEmptyString(exec);
+
+ // Copy original into the buffer
+ if (yearNeedsOffset && format != LocaleTime) {
+ static const int yearLen = 5; // FIXME will be a problem in the year 10,000
+ char yearString[yearLen];
+
+ snprintf(yearString, yearLen, "%d", localTM.tm_year + 1900);
+ char* yearLocation = strstr(timebuffer, yearString);
+ snprintf(yearString, yearLen, "%d", year);
+
+ strncpy(yearLocation, yearString, yearLen - 1);
+ }
+
+ // Convert multi-byte result to UNICODE.
+ // If __STDC_ISO_10646__ is defined, wide character represents
+ // UTF-16 (or UTF-32) code point. In most modern Unix like system
+ // (e.g. Linux with glibc 2.2 and above) the macro is defined,
+ // and wide character represents UTF-32 code point.
+ // Here we static_cast potential UTF-32 to UTF-16, it should be
+ // safe because date and (or) time related characters in different languages
+ // should be in UNICODE BMP. If mbstowcs fails, we just fall
+ // back on using multi-byte result as-is.
+#ifdef __STDC_ISO_10646__
+ UChar buffer[bufsize];
+ wchar_t tempbuffer[bufsize];
+ size_t length = mbstowcs(tempbuffer, timebuffer, bufsize - 1);
+ if (length != static_cast<size_t>(-1)) {
+ for (size_t i = 0; i < length; ++i)
+ buffer[i] = static_cast<UChar>(tempbuffer[i]);
+ return jsNontrivialString(exec, UString(buffer, length));
+ }
+#endif
+
+ return jsNontrivialString(exec, timebuffer);
+}
+
+static JSCell* formatLocaleDate(ExecState* exec, DateInstance* dateObject, double, LocaleDateTimeFormat format)
+{
+ const GregorianDateTime* gregorianDateTime = dateObject->gregorianDateTime(exec);
+ if (!gregorianDateTime)
+ return jsNontrivialString(exec, "Invalid Date");
+ return formatLocaleDate(exec, *gregorianDateTime, format);
+}
+
+#endif // !PLATFORM(MAC)
+
+// Converts a list of arguments sent to a Date member function into milliseconds, updating
+// ms (representing milliseconds) and t (representing the rest of the date structure) appropriately.
+//
+// Format of member function: f([hour,] [min,] [sec,] [ms])
+static bool fillStructuresUsingTimeArgs(ExecState* exec, int maxArgs, double* ms, GregorianDateTime* t)
+{
+ double milliseconds = 0;
+ bool ok = true;
+ int idx = 0;
+ int numArgs = exec->argumentCount();
+
+ // JS allows extra trailing arguments -- ignore them
+ if (numArgs > maxArgs)
+ numArgs = maxArgs;
+
+ // hours
+ if (maxArgs >= 4 && idx < numArgs) {
+ t->hour = 0;
+ double hours = exec->argument(idx++).toIntegerPreserveNaN(exec);
+ ok = isfinite(hours);
+ milliseconds += hours * msPerHour;
+ }
+
+ // minutes
+ if (maxArgs >= 3 && idx < numArgs && ok) {
+ t->minute = 0;
+ double minutes = exec->argument(idx++).toIntegerPreserveNaN(exec);
+ ok = isfinite(minutes);
+ milliseconds += minutes * msPerMinute;
+ }
+
+ // seconds
+ if (maxArgs >= 2 && idx < numArgs && ok) {
+ t->second = 0;
+ double seconds = exec->argument(idx++).toIntegerPreserveNaN(exec);
+ ok = isfinite(seconds);
+ milliseconds += seconds * msPerSecond;
+ }
+
+ if (!ok)
+ return false;
+
+ // milliseconds
+ if (idx < numArgs) {
+ double millis = exec->argument(idx).toIntegerPreserveNaN(exec);
+ ok = isfinite(millis);
+ milliseconds += millis;
+ } else
+ milliseconds += *ms;
+
+ *ms = milliseconds;
+ return ok;
+}
+
+// Converts a list of arguments sent to a Date member function into years, months, and milliseconds, updating
+// ms (representing milliseconds) and t (representing the rest of the date structure) appropriately.
+//
+// Format of member function: f([years,] [months,] [days])
+static bool fillStructuresUsingDateArgs(ExecState *exec, int maxArgs, double *ms, GregorianDateTime *t)
+{
+ int idx = 0;
+ bool ok = true;
+ int numArgs = exec->argumentCount();
+
+ // JS allows extra trailing arguments -- ignore them
+ if (numArgs > maxArgs)
+ numArgs = maxArgs;
+
+ // years
+ if (maxArgs >= 3 && idx < numArgs) {
+ double years = exec->argument(idx++).toIntegerPreserveNaN(exec);
+ ok = isfinite(years);
+ t->year = toInt32(years - 1900);
+ }
+ // months
+ if (maxArgs >= 2 && idx < numArgs && ok) {
+ double months = exec->argument(idx++).toIntegerPreserveNaN(exec);
+ ok = isfinite(months);
+ t->month = toInt32(months);
+ }
+ // days
+ if (idx < numArgs && ok) {
+ double days = exec->argument(idx++).toIntegerPreserveNaN(exec);
+ ok = isfinite(days);
+ t->monthDay = 0;
+ *ms += days * msPerDay;
+ }
+
+ return ok;
+}
+
+const ClassInfo DatePrototype::info = {"Date", &DateInstance::info, 0, ExecState::dateTable};
+
+/* Source for DatePrototype.lut.h
+@begin dateTable
+ toString dateProtoFuncToString DontEnum|Function 0
+ toISOString dateProtoFuncToISOString DontEnum|Function 0
+ toUTCString dateProtoFuncToUTCString DontEnum|Function 0
+ toDateString dateProtoFuncToDateString DontEnum|Function 0
+ toTimeString dateProtoFuncToTimeString DontEnum|Function 0
+ toLocaleString dateProtoFuncToLocaleString DontEnum|Function 0
+ toLocaleDateString dateProtoFuncToLocaleDateString DontEnum|Function 0
+ toLocaleTimeString dateProtoFuncToLocaleTimeString DontEnum|Function 0
+ valueOf dateProtoFuncGetTime DontEnum|Function 0
+ getTime dateProtoFuncGetTime DontEnum|Function 0
+ getFullYear dateProtoFuncGetFullYear DontEnum|Function 0
+ getUTCFullYear dateProtoFuncGetUTCFullYear DontEnum|Function 0
+ toGMTString dateProtoFuncToGMTString DontEnum|Function 0
+ getMonth dateProtoFuncGetMonth DontEnum|Function 0
+ getUTCMonth dateProtoFuncGetUTCMonth DontEnum|Function 0
+ getDate dateProtoFuncGetDate DontEnum|Function 0
+ getUTCDate dateProtoFuncGetUTCDate DontEnum|Function 0
+ getDay dateProtoFuncGetDay DontEnum|Function 0
+ getUTCDay dateProtoFuncGetUTCDay DontEnum|Function 0
+ getHours dateProtoFuncGetHours DontEnum|Function 0
+ getUTCHours dateProtoFuncGetUTCHours DontEnum|Function 0
+ getMinutes dateProtoFuncGetMinutes DontEnum|Function 0
+ getUTCMinutes dateProtoFuncGetUTCMinutes DontEnum|Function 0
+ getSeconds dateProtoFuncGetSeconds DontEnum|Function 0
+ getUTCSeconds dateProtoFuncGetUTCSeconds DontEnum|Function 0
+ getMilliseconds dateProtoFuncGetMilliSeconds DontEnum|Function 0
+ getUTCMilliseconds dateProtoFuncGetUTCMilliseconds DontEnum|Function 0
+ getTimezoneOffset dateProtoFuncGetTimezoneOffset DontEnum|Function 0
+ setTime dateProtoFuncSetTime DontEnum|Function 1
+ setMilliseconds dateProtoFuncSetMilliSeconds DontEnum|Function 1
+ setUTCMilliseconds dateProtoFuncSetUTCMilliseconds DontEnum|Function 1
+ setSeconds dateProtoFuncSetSeconds DontEnum|Function 2
+ setUTCSeconds dateProtoFuncSetUTCSeconds DontEnum|Function 2
+ setMinutes dateProtoFuncSetMinutes DontEnum|Function 3
+ setUTCMinutes dateProtoFuncSetUTCMinutes DontEnum|Function 3
+ setHours dateProtoFuncSetHours DontEnum|Function 4
+ setUTCHours dateProtoFuncSetUTCHours DontEnum|Function 4
+ setDate dateProtoFuncSetDate DontEnum|Function 1
+ setUTCDate dateProtoFuncSetUTCDate DontEnum|Function 1
+ setMonth dateProtoFuncSetMonth DontEnum|Function 2
+ setUTCMonth dateProtoFuncSetUTCMonth DontEnum|Function 2
+ setFullYear dateProtoFuncSetFullYear DontEnum|Function 3
+ setUTCFullYear dateProtoFuncSetUTCFullYear DontEnum|Function 3
+ setYear dateProtoFuncSetYear DontEnum|Function 1
+ getYear dateProtoFuncGetYear DontEnum|Function 0
+ toJSON dateProtoFuncToJSON DontEnum|Function 1
+@end
+*/
+
+// ECMA 15.9.4
+
+DatePrototype::DatePrototype(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure)
+ : DateInstance(exec, structure)
+{
+ // The constructor will be added later, after DateConstructor has been built.
+ putAnonymousValue(0, globalObject);
+}
+
+bool DatePrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
+{
+ return getStaticFunctionSlot<JSObject>(exec, ExecState::dateTable(exec), this, propertyName, slot);
+}
+
+
+bool DatePrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
+{
+ return getStaticFunctionDescriptor<JSObject>(exec, ExecState::dateTable(exec), this, propertyName, descriptor);
+}
+
+// Functions
+
+EncodedJSValue JSC_HOST_CALL dateProtoFuncToString(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ if (!thisValue.inherits(&DateInstance::info))
+ return throwVMTypeError(exec);
+
+ DateInstance* thisDateObj = asDateInstance(thisValue);
+
+ const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec);
+ if (!gregorianDateTime)
+ return JSValue::encode(jsNontrivialString(exec, "Invalid Date"));
+ DateConversionBuffer date;
+ DateConversionBuffer time;
+ formatDate(*gregorianDateTime, date);
+ formatTime(*gregorianDateTime, time);
+ return JSValue::encode(jsMakeNontrivialString(exec, date, " ", time));
+}
+
+EncodedJSValue JSC_HOST_CALL dateProtoFuncToUTCString(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ if (!thisValue.inherits(&DateInstance::info))
+ return throwVMTypeError(exec);
+
+ DateInstance* thisDateObj = asDateInstance(thisValue);
+
+ const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTimeUTC(exec);
+ if (!gregorianDateTime)
+ return JSValue::encode(jsNontrivialString(exec, "Invalid Date"));
+ DateConversionBuffer date;
+ DateConversionBuffer time;
+ formatDateUTCVariant(*gregorianDateTime, date);
+ formatTimeUTC(*gregorianDateTime, time);
+ return JSValue::encode(jsMakeNontrivialString(exec, date, " ", time));
+}
+
+EncodedJSValue JSC_HOST_CALL dateProtoFuncToISOString(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ if (!thisValue.inherits(&DateInstance::info))
+ return throwVMTypeError(exec);
+
+ DateInstance* thisDateObj = asDateInstance(thisValue);
+
+ const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTimeUTC(exec);
+ if (!gregorianDateTime)
+ return JSValue::encode(jsNontrivialString(exec, "Invalid Date"));
+ // Maximum amount of space we need in buffer: 6 (max. digits in year) + 2 * 5 (2 characters each for month, day, hour, minute, second) + 4 (. + 3 digits for milliseconds)
+ // 6 for formatting and one for null termination = 27. We add one extra character to allow us to force null termination.
+ char buffer[28];
+ snprintf(buffer, sizeof(buffer) - 1, "%04d-%02d-%02dT%02d:%02d:%02d.%03dZ", 1900 + gregorianDateTime->year, gregorianDateTime->month + 1, gregorianDateTime->monthDay, gregorianDateTime->hour, gregorianDateTime->minute, gregorianDateTime->second, static_cast<int>(fmod(thisDateObj->internalNumber(), 1000)));
+ buffer[sizeof(buffer) - 1] = 0;
+ return JSValue::encode(jsNontrivialString(exec, buffer));
+}
+
+EncodedJSValue JSC_HOST_CALL dateProtoFuncToDateString(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ if (!thisValue.inherits(&DateInstance::info))
+ return throwVMTypeError(exec);
+
+ DateInstance* thisDateObj = asDateInstance(thisValue);
+
+ const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec);
+ if (!gregorianDateTime)
+ return JSValue::encode(jsNontrivialString(exec, "Invalid Date"));
+ DateConversionBuffer date;
+ formatDate(*gregorianDateTime, date);
+ return JSValue::encode(jsNontrivialString(exec, date));
+}
+
+EncodedJSValue JSC_HOST_CALL dateProtoFuncToTimeString(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ if (!thisValue.inherits(&DateInstance::info))
+ return throwVMTypeError(exec);
+
+ DateInstance* thisDateObj = asDateInstance(thisValue);
+
+ const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec);
+ if (!gregorianDateTime)
+ return JSValue::encode(jsNontrivialString(exec, "Invalid Date"));
+ DateConversionBuffer time;
+ formatTime(*gregorianDateTime, time);
+ return JSValue::encode(jsNontrivialString(exec, time));
+}
+
+EncodedJSValue JSC_HOST_CALL dateProtoFuncToLocaleString(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ if (!thisValue.inherits(&DateInstance::info))
+ return throwVMTypeError(exec);
+
+ DateInstance* thisDateObj = asDateInstance(thisValue);
+ return JSValue::encode(formatLocaleDate(exec, thisDateObj, thisDateObj->internalNumber(), LocaleDateAndTime));
+}
+
+EncodedJSValue JSC_HOST_CALL dateProtoFuncToLocaleDateString(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ if (!thisValue.inherits(&DateInstance::info))
+ return throwVMTypeError(exec);
+
+ DateInstance* thisDateObj = asDateInstance(thisValue);
+ return JSValue::encode(formatLocaleDate(exec, thisDateObj, thisDateObj->internalNumber(), LocaleDate));
+}
+
+EncodedJSValue JSC_HOST_CALL dateProtoFuncToLocaleTimeString(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ if (!thisValue.inherits(&DateInstance::info))
+ return throwVMTypeError(exec);
+
+ DateInstance* thisDateObj = asDateInstance(thisValue);
+ return JSValue::encode(formatLocaleDate(exec, thisDateObj, thisDateObj->internalNumber(), LocaleTime));
+}
+
+EncodedJSValue JSC_HOST_CALL dateProtoFuncGetTime(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ if (!thisValue.inherits(&DateInstance::info))
+ return throwVMTypeError(exec);
+
+ return JSValue::encode(asDateInstance(thisValue)->internalValue());
+}
+
+EncodedJSValue JSC_HOST_CALL dateProtoFuncGetFullYear(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ if (!thisValue.inherits(&DateInstance::info))
+ return throwVMTypeError(exec);
+
+ DateInstance* thisDateObj = asDateInstance(thisValue);
+
+ const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec);
+ if (!gregorianDateTime)
+ return JSValue::encode(jsNaN());
+ return JSValue::encode(jsNumber(1900 + gregorianDateTime->year));
+}
+
+EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCFullYear(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ if (!thisValue.inherits(&DateInstance::info))
+ return throwVMTypeError(exec);
+
+ DateInstance* thisDateObj = asDateInstance(thisValue);
+
+ const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTimeUTC(exec);
+ if (!gregorianDateTime)
+ return JSValue::encode(jsNaN());
+ return JSValue::encode(jsNumber(1900 + gregorianDateTime->year));
+}
+
+EncodedJSValue JSC_HOST_CALL dateProtoFuncToGMTString(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ if (!thisValue.inherits(&DateInstance::info))
+ return throwVMTypeError(exec);
+
+ DateInstance* thisDateObj = asDateInstance(thisValue);
+
+ const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTimeUTC(exec);
+ if (!gregorianDateTime)
+ return JSValue::encode(jsNontrivialString(exec, "Invalid Date"));
+ DateConversionBuffer date;
+ DateConversionBuffer time;
+ formatDateUTCVariant(*gregorianDateTime, date);
+ formatTimeUTC(*gregorianDateTime, time);
+ return JSValue::encode(jsMakeNontrivialString(exec, date, " ", time));
+}
+
+EncodedJSValue JSC_HOST_CALL dateProtoFuncGetMonth(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ if (!thisValue.inherits(&DateInstance::info))
+ return throwVMTypeError(exec);
+
+ DateInstance* thisDateObj = asDateInstance(thisValue);
+
+ const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec);
+ if (!gregorianDateTime)
+ return JSValue::encode(jsNaN());
+ return JSValue::encode(jsNumber(gregorianDateTime->month));
+}
+
+EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCMonth(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ if (!thisValue.inherits(&DateInstance::info))
+ return throwVMTypeError(exec);
+
+ DateInstance* thisDateObj = asDateInstance(thisValue);
+
+ const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTimeUTC(exec);
+ if (!gregorianDateTime)
+ return JSValue::encode(jsNaN());
+ return JSValue::encode(jsNumber(gregorianDateTime->month));
+}
+
+EncodedJSValue JSC_HOST_CALL dateProtoFuncGetDate(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ if (!thisValue.inherits(&DateInstance::info))
+ return throwVMTypeError(exec);
+
+ DateInstance* thisDateObj = asDateInstance(thisValue);
+
+ const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec);
+ if (!gregorianDateTime)
+ return JSValue::encode(jsNaN());
+ return JSValue::encode(jsNumber(gregorianDateTime->monthDay));
+}
+
+EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCDate(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ if (!thisValue.inherits(&DateInstance::info))
+ return throwVMTypeError(exec);
+
+ DateInstance* thisDateObj = asDateInstance(thisValue);
+
+ const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTimeUTC(exec);
+ if (!gregorianDateTime)
+ return JSValue::encode(jsNaN());
+ return JSValue::encode(jsNumber(gregorianDateTime->monthDay));
+}
+
+EncodedJSValue JSC_HOST_CALL dateProtoFuncGetDay(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ if (!thisValue.inherits(&DateInstance::info))
+ return throwVMTypeError(exec);
+
+ DateInstance* thisDateObj = asDateInstance(thisValue);
+
+ const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec);
+ if (!gregorianDateTime)
+ return JSValue::encode(jsNaN());
+ return JSValue::encode(jsNumber(gregorianDateTime->weekDay));
+}
+
+EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCDay(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ if (!thisValue.inherits(&DateInstance::info))
+ return throwVMTypeError(exec);
+
+ DateInstance* thisDateObj = asDateInstance(thisValue);
+
+ const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTimeUTC(exec);
+ if (!gregorianDateTime)
+ return JSValue::encode(jsNaN());
+ return JSValue::encode(jsNumber(gregorianDateTime->weekDay));
+}
+
+EncodedJSValue JSC_HOST_CALL dateProtoFuncGetHours(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ if (!thisValue.inherits(&DateInstance::info))
+ return throwVMTypeError(exec);
+
+ DateInstance* thisDateObj = asDateInstance(thisValue);
+
+ const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec);
+ if (!gregorianDateTime)
+ return JSValue::encode(jsNaN());
+ return JSValue::encode(jsNumber(gregorianDateTime->hour));
+}
+
+EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCHours(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ if (!thisValue.inherits(&DateInstance::info))
+ return throwVMTypeError(exec);
+
+ DateInstance* thisDateObj = asDateInstance(thisValue);
+
+ const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTimeUTC(exec);
+ if (!gregorianDateTime)
+ return JSValue::encode(jsNaN());
+ return JSValue::encode(jsNumber(gregorianDateTime->hour));
+}
+
+EncodedJSValue JSC_HOST_CALL dateProtoFuncGetMinutes(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ if (!thisValue.inherits(&DateInstance::info))
+ return throwVMTypeError(exec);
+
+ DateInstance* thisDateObj = asDateInstance(thisValue);
+
+ const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec);
+ if (!gregorianDateTime)
+ return JSValue::encode(jsNaN());
+ return JSValue::encode(jsNumber(gregorianDateTime->minute));
+}
+
+EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCMinutes(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ if (!thisValue.inherits(&DateInstance::info))
+ return throwVMTypeError(exec);
+
+ DateInstance* thisDateObj = asDateInstance(thisValue);
+
+ const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTimeUTC(exec);
+ if (!gregorianDateTime)
+ return JSValue::encode(jsNaN());
+ return JSValue::encode(jsNumber(gregorianDateTime->minute));
+}
+
+EncodedJSValue JSC_HOST_CALL dateProtoFuncGetSeconds(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ if (!thisValue.inherits(&DateInstance::info))
+ return throwVMTypeError(exec);
+
+ DateInstance* thisDateObj = asDateInstance(thisValue);
+
+ const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec);
+ if (!gregorianDateTime)
+ return JSValue::encode(jsNaN());
+ return JSValue::encode(jsNumber(gregorianDateTime->second));
+}
+
+EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCSeconds(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ if (!thisValue.inherits(&DateInstance::info))
+ return throwVMTypeError(exec);
+
+ DateInstance* thisDateObj = asDateInstance(thisValue);
+
+ const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTimeUTC(exec);
+ if (!gregorianDateTime)
+ return JSValue::encode(jsNaN());
+ return JSValue::encode(jsNumber(gregorianDateTime->second));
+}
+
+EncodedJSValue JSC_HOST_CALL dateProtoFuncGetMilliSeconds(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ if (!thisValue.inherits(&DateInstance::info))
+ return throwVMTypeError(exec);
+
+ DateInstance* thisDateObj = asDateInstance(thisValue);
+ double milli = thisDateObj->internalNumber();
+ if (isnan(milli))
+ return JSValue::encode(jsNaN());
+
+ double secs = floor(milli / msPerSecond);
+ double ms = milli - secs * msPerSecond;
+ return JSValue::encode(jsNumber(ms));
+}
+
+EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCMilliseconds(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ if (!thisValue.inherits(&DateInstance::info))
+ return throwVMTypeError(exec);
+
+ DateInstance* thisDateObj = asDateInstance(thisValue);
+ double milli = thisDateObj->internalNumber();
+ if (isnan(milli))
+ return JSValue::encode(jsNaN());
+
+ double secs = floor(milli / msPerSecond);
+ double ms = milli - secs * msPerSecond;
+ return JSValue::encode(jsNumber(ms));
+}
+
+EncodedJSValue JSC_HOST_CALL dateProtoFuncGetTimezoneOffset(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ if (!thisValue.inherits(&DateInstance::info))
+ return throwVMTypeError(exec);
+
+ DateInstance* thisDateObj = asDateInstance(thisValue);
+
+ const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec);
+ if (!gregorianDateTime)
+ return JSValue::encode(jsNaN());
+ return JSValue::encode(jsNumber(-gregorianDateTime->utcOffset / minutesPerHour));
+}
+
+EncodedJSValue JSC_HOST_CALL dateProtoFuncSetTime(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ if (!thisValue.inherits(&DateInstance::info))
+ return throwVMTypeError(exec);
+
+ DateInstance* thisDateObj = asDateInstance(thisValue);
+
+ double milli = timeClip(exec->argument(0).toNumber(exec));
+ JSValue result = jsNumber(milli);
+ thisDateObj->setInternalValue(result);
+ return JSValue::encode(result);
+}
+
+static EncodedJSValue setNewValueFromTimeArgs(ExecState* exec, int numArgsToUse, bool inputIsUTC)
+{
+ JSValue thisValue = exec->hostThisValue();
+ if (!thisValue.inherits(&DateInstance::info))
+ return throwVMTypeError(exec);
+
+ DateInstance* thisDateObj = asDateInstance(thisValue);
+ double milli = thisDateObj->internalNumber();
+
+ if (!exec->argumentCount() || isnan(milli)) {
+ JSValue result = jsNaN();
+ thisDateObj->setInternalValue(result);
+ return JSValue::encode(result);
+ }
+
+ double secs = floor(milli / msPerSecond);
+ double ms = milli - secs * msPerSecond;
+
+ const GregorianDateTime* other = inputIsUTC
+ ? thisDateObj->gregorianDateTimeUTC(exec)
+ : thisDateObj->gregorianDateTime(exec);
+ if (!other)
+ return JSValue::encode(jsNaN());
+
+ GregorianDateTime gregorianDateTime;
+ gregorianDateTime.copyFrom(*other);
+ if (!fillStructuresUsingTimeArgs(exec, numArgsToUse, &ms, &gregorianDateTime)) {
+ JSValue result = jsNaN();
+ thisDateObj->setInternalValue(result);
+ return JSValue::encode(result);
+ }
+
+ JSValue result = jsNumber(gregorianDateTimeToMS(exec, gregorianDateTime, ms, inputIsUTC));
+ thisDateObj->setInternalValue(result);
+ return JSValue::encode(result);
+}
+
+static EncodedJSValue setNewValueFromDateArgs(ExecState* exec, int numArgsToUse, bool inputIsUTC)
+{
+ JSValue thisValue = exec->hostThisValue();
+ if (!thisValue.inherits(&DateInstance::info))
+ return throwVMTypeError(exec);
+
+ DateInstance* thisDateObj = asDateInstance(thisValue);
+ if (!exec->argumentCount()) {
+ JSValue result = jsNaN();
+ thisDateObj->setInternalValue(result);
+ return JSValue::encode(result);
+ }
+
+ double milli = thisDateObj->internalNumber();
+ double ms = 0;
+
+ GregorianDateTime gregorianDateTime;
+ if (numArgsToUse == 3 && isnan(milli))
+ msToGregorianDateTime(exec, 0, true, gregorianDateTime);
+ else {
+ ms = milli - floor(milli / msPerSecond) * msPerSecond;
+ const GregorianDateTime* other = inputIsUTC
+ ? thisDateObj->gregorianDateTimeUTC(exec)
+ : thisDateObj->gregorianDateTime(exec);
+ if (!other)
+ return JSValue::encode(jsNaN());
+ gregorianDateTime.copyFrom(*other);
+ }
+
+ if (!fillStructuresUsingDateArgs(exec, numArgsToUse, &ms, &gregorianDateTime)) {
+ JSValue result = jsNaN();
+ thisDateObj->setInternalValue(result);
+ return JSValue::encode(result);
+ }
+
+ JSValue result = jsNumber(gregorianDateTimeToMS(exec, gregorianDateTime, ms, inputIsUTC));
+ thisDateObj->setInternalValue(result);
+ return JSValue::encode(result);
+}
+
+EncodedJSValue JSC_HOST_CALL dateProtoFuncSetMilliSeconds(ExecState* exec)
+{
+ const bool inputIsUTC = false;
+ return setNewValueFromTimeArgs(exec, 1, inputIsUTC);
+}
+
+EncodedJSValue JSC_HOST_CALL dateProtoFuncSetUTCMilliseconds(ExecState* exec)
+{
+ const bool inputIsUTC = true;
+ return setNewValueFromTimeArgs(exec, 1, inputIsUTC);
+}
+
+EncodedJSValue JSC_HOST_CALL dateProtoFuncSetSeconds(ExecState* exec)
+{
+ const bool inputIsUTC = false;
+ return setNewValueFromTimeArgs(exec, 2, inputIsUTC);
+}
+
+EncodedJSValue JSC_HOST_CALL dateProtoFuncSetUTCSeconds(ExecState* exec)
+{
+ const bool inputIsUTC = true;
+ return setNewValueFromTimeArgs(exec, 2, inputIsUTC);
+}
+
+EncodedJSValue JSC_HOST_CALL dateProtoFuncSetMinutes(ExecState* exec)
+{
+ const bool inputIsUTC = false;
+ return setNewValueFromTimeArgs(exec, 3, inputIsUTC);
+}
+
+EncodedJSValue JSC_HOST_CALL dateProtoFuncSetUTCMinutes(ExecState* exec)
+{
+ const bool inputIsUTC = true;
+ return setNewValueFromTimeArgs(exec, 3, inputIsUTC);
+}
+
+EncodedJSValue JSC_HOST_CALL dateProtoFuncSetHours(ExecState* exec)
+{
+ const bool inputIsUTC = false;
+ return setNewValueFromTimeArgs(exec, 4, inputIsUTC);
+}
+
+EncodedJSValue JSC_HOST_CALL dateProtoFuncSetUTCHours(ExecState* exec)
+{
+ const bool inputIsUTC = true;
+ return setNewValueFromTimeArgs(exec, 4, inputIsUTC);
+}
+
+EncodedJSValue JSC_HOST_CALL dateProtoFuncSetDate(ExecState* exec)
+{
+ const bool inputIsUTC = false;
+ return setNewValueFromDateArgs(exec, 1, inputIsUTC);
+}
+
+EncodedJSValue JSC_HOST_CALL dateProtoFuncSetUTCDate(ExecState* exec)
+{
+ const bool inputIsUTC = true;
+ return setNewValueFromDateArgs(exec, 1, inputIsUTC);
+}
+
+EncodedJSValue JSC_HOST_CALL dateProtoFuncSetMonth(ExecState* exec)
+{
+ const bool inputIsUTC = false;
+ return setNewValueFromDateArgs(exec, 2, inputIsUTC);
+}
+
+EncodedJSValue JSC_HOST_CALL dateProtoFuncSetUTCMonth(ExecState* exec)
+{
+ const bool inputIsUTC = true;
+ return setNewValueFromDateArgs(exec, 2, inputIsUTC);
+}
+
+EncodedJSValue JSC_HOST_CALL dateProtoFuncSetFullYear(ExecState* exec)
+{
+ const bool inputIsUTC = false;
+ return setNewValueFromDateArgs(exec, 3, inputIsUTC);
+}
+
+EncodedJSValue JSC_HOST_CALL dateProtoFuncSetUTCFullYear(ExecState* exec)
+{
+ const bool inputIsUTC = true;
+ return setNewValueFromDateArgs(exec, 3, inputIsUTC);
+}
+
+EncodedJSValue JSC_HOST_CALL dateProtoFuncSetYear(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ if (!thisValue.inherits(&DateInstance::info))
+ return throwVMTypeError(exec);
+
+ DateInstance* thisDateObj = asDateInstance(thisValue);
+ if (!exec->argumentCount()) {
+ JSValue result = jsNaN();
+ thisDateObj->setInternalValue(result);
+ return JSValue::encode(result);
+ }
+
+ double milli = thisDateObj->internalNumber();
+ double ms = 0;
+
+ GregorianDateTime gregorianDateTime;
+ if (isnan(milli))
+ // Based on ECMA 262 B.2.5 (setYear)
+ // the time must be reset to +0 if it is NaN.
+ msToGregorianDateTime(exec, 0, true, gregorianDateTime);
+ else {
+ double secs = floor(milli / msPerSecond);
+ ms = milli - secs * msPerSecond;
+ if (const GregorianDateTime* other = thisDateObj->gregorianDateTime(exec))
+ gregorianDateTime.copyFrom(*other);
+ }
+
+ double year = exec->argument(0).toIntegerPreserveNaN(exec);
+ if (!isfinite(year)) {
+ JSValue result = jsNaN();
+ thisDateObj->setInternalValue(result);
+ return JSValue::encode(result);
+ }
+
+ gregorianDateTime.year = toInt32((year > 99 || year < 0) ? year - 1900 : year);
+ JSValue result = jsNumber(gregorianDateTimeToMS(exec, gregorianDateTime, ms, false));
+ thisDateObj->setInternalValue(result);
+ return JSValue::encode(result);
+}
+
+EncodedJSValue JSC_HOST_CALL dateProtoFuncGetYear(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ if (!thisValue.inherits(&DateInstance::info))
+ return throwVMTypeError(exec);
+
+ DateInstance* thisDateObj = asDateInstance(thisValue);
+
+ const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec);
+ if (!gregorianDateTime)
+ return JSValue::encode(jsNaN());
+
+ // NOTE: IE returns the full year even in getYear.
+ return JSValue::encode(jsNumber(gregorianDateTime->year));
+}
+
+EncodedJSValue JSC_HOST_CALL dateProtoFuncToJSON(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ JSObject* object = thisValue.toThisObject(exec);
+ if (exec->hadException())
+ return JSValue::encode(jsNull());
+
+ JSValue toISOValue = object->get(exec, exec->globalData().propertyNames->toISOString);
+ if (exec->hadException())
+ return JSValue::encode(jsNull());
+
+ CallData callData;
+ CallType callType = getCallData(toISOValue, callData);
+ if (callType == CallTypeNone)
+ return throwVMError(exec, createTypeError(exec, "toISOString is not a function"));
+
+ JSValue result = call(exec, asObject(toISOValue), callType, callData, object, exec->emptyList());
+ if (exec->hadException())
+ return JSValue::encode(jsNull());
+ if (result.isObject())
+ return throwVMError(exec, createTypeError(exec, "toISOString did not return a primitive value"));
+ return JSValue::encode(result);
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/DatePrototype.h b/Source/JavaScriptCore/runtime/DatePrototype.h
new file mode 100644
index 0000000..e3672aa
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/DatePrototype.h
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifndef DatePrototype_h
+#define DatePrototype_h
+
+#include "DateInstance.h"
+
+namespace JSC {
+
+ class ObjectPrototype;
+
+ class DatePrototype : public DateInstance {
+ public:
+ DatePrototype(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure>);
+
+ virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
+ virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
+
+ virtual const ClassInfo* classInfo() const { return &info; }
+ static const ClassInfo info;
+
+ static PassRefPtr<Structure> createStructure(JSValue prototype)
+ {
+ return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount);
+ }
+
+ protected:
+ static const unsigned StructureFlags = OverridesGetOwnPropertySlot | DateInstance::StructureFlags;
+
+ };
+
+} // namespace JSC
+
+#endif // DatePrototype_h
diff --git a/Source/JavaScriptCore/runtime/Error.cpp b/Source/JavaScriptCore/runtime/Error.cpp
new file mode 100644
index 0000000..227e9ec
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/Error.cpp
@@ -0,0 +1,211 @@
+/*
+ * Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
+ * Copyright (C) 2001 Peter Kelly (pmk@post.com)
+ * Copyright (C) 2003, 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2007 Eric Seidel (eric@webkit.org)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+#include "Error.h"
+
+#include "ConstructData.h"
+#include "ErrorConstructor.h"
+#include "JSFunction.h"
+#include "JSGlobalObject.h"
+#include "JSObject.h"
+#include "JSString.h"
+#include "NativeErrorConstructor.h"
+#include "SourceCode.h"
+
+namespace JSC {
+
+static const char* linePropertyName = "line";
+static const char* sourceIdPropertyName = "sourceId";
+static const char* sourceURLPropertyName = "sourceURL";
+
+JSObject* createError(JSGlobalObject* globalObject, const UString& message)
+{
+ ASSERT(!message.isEmpty());
+ return ErrorInstance::create(&globalObject->globalData(), globalObject->errorStructure(), message);
+}
+
+JSObject* createEvalError(JSGlobalObject* globalObject, const UString& message)
+{
+ ASSERT(!message.isEmpty());
+ return ErrorInstance::create(&globalObject->globalData(), globalObject->evalErrorConstructor()->errorStructure(), message);
+}
+
+JSObject* createRangeError(JSGlobalObject* globalObject, const UString& message)
+{
+ ASSERT(!message.isEmpty());
+ return ErrorInstance::create(&globalObject->globalData(), globalObject->rangeErrorConstructor()->errorStructure(), message);
+}
+
+JSObject* createReferenceError(JSGlobalObject* globalObject, const UString& message)
+{
+ ASSERT(!message.isEmpty());
+ return ErrorInstance::create(&globalObject->globalData(), globalObject->referenceErrorConstructor()->errorStructure(), message);
+}
+
+JSObject* createSyntaxError(JSGlobalObject* globalObject, const UString& message)
+{
+ ASSERT(!message.isEmpty());
+ return ErrorInstance::create(&globalObject->globalData(), globalObject->syntaxErrorConstructor()->errorStructure(), message);
+}
+
+JSObject* createTypeError(JSGlobalObject* globalObject, const UString& message)
+{
+ ASSERT(!message.isEmpty());
+ return ErrorInstance::create(&globalObject->globalData(), globalObject->typeErrorConstructor()->errorStructure(), message);
+}
+
+JSObject* createURIError(JSGlobalObject* globalObject, const UString& message)
+{
+ ASSERT(!message.isEmpty());
+ return ErrorInstance::create(&globalObject->globalData(), globalObject->URIErrorConstructor()->errorStructure(), message);
+}
+
+JSObject* createError(ExecState* exec, const UString& message)
+{
+ return createError(exec->lexicalGlobalObject(), message);
+}
+
+JSObject* createEvalError(ExecState* exec, const UString& message)
+{
+ return createEvalError(exec->lexicalGlobalObject(), message);
+}
+
+JSObject* createRangeError(ExecState* exec, const UString& message)
+{
+ return createRangeError(exec->lexicalGlobalObject(), message);
+}
+
+JSObject* createReferenceError(ExecState* exec, const UString& message)
+{
+ return createReferenceError(exec->lexicalGlobalObject(), message);
+}
+
+JSObject* createSyntaxError(ExecState* exec, const UString& message)
+{
+ return createSyntaxError(exec->lexicalGlobalObject(), message);
+}
+
+JSObject* createTypeError(ExecState* exec, const UString& message)
+{
+ return createTypeError(exec->lexicalGlobalObject(), message);
+}
+
+JSObject* createURIError(ExecState* exec, const UString& message)
+{
+ return createURIError(exec->lexicalGlobalObject(), message);
+}
+
+JSObject* addErrorInfo(JSGlobalData* globalData, JSObject* error, int line, const SourceCode& source)
+{
+ intptr_t sourceID = source.provider()->asID();
+ const UString& sourceURL = source.provider()->url();
+
+ if (line != -1)
+ error->putWithAttributes(globalData, Identifier(globalData, linePropertyName), jsNumber(line), ReadOnly | DontDelete);
+ if (sourceID != -1)
+ error->putWithAttributes(globalData, Identifier(globalData, sourceIdPropertyName), jsNumber((double)sourceID), ReadOnly | DontDelete);
+ if (!sourceURL.isNull())
+ error->putWithAttributes(globalData, Identifier(globalData, sourceURLPropertyName), jsString(globalData, sourceURL), ReadOnly | DontDelete);
+
+ return error;
+}
+
+JSObject* addErrorInfo(ExecState* exec, JSObject* error, int line, const SourceCode& source)
+{
+ return addErrorInfo(&exec->globalData(), error, line, source);
+}
+
+bool hasErrorInfo(ExecState* exec, JSObject* error)
+{
+ return error->hasProperty(exec, Identifier(exec, linePropertyName))
+ || error->hasProperty(exec, Identifier(exec, sourceIdPropertyName))
+ || error->hasProperty(exec, Identifier(exec, sourceURLPropertyName));
+}
+
+JSValue throwError(ExecState* exec, JSValue error)
+{
+ exec->globalData().exception = error;
+ return error;
+}
+
+JSObject* throwError(ExecState* exec, JSObject* error)
+{
+ exec->globalData().exception = error;
+ return error;
+}
+
+JSObject* throwTypeError(ExecState* exec)
+{
+ return throwError(exec, createTypeError(exec, "Type error"));
+}
+
+JSObject* throwSyntaxError(ExecState* exec)
+{
+ return throwError(exec, createSyntaxError(exec, "Syntax error"));
+}
+
+class StrictModeTypeErrorFunction : public InternalFunction {
+public:
+ StrictModeTypeErrorFunction(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, const UString& message)
+ : InternalFunction(&exec->globalData(), globalObject, structure, exec->globalData().propertyNames->emptyIdentifier)
+ , m_message(message)
+ {
+ }
+
+ static EncodedJSValue JSC_HOST_CALL constructThrowTypeError(ExecState* exec)
+ {
+ throwTypeError(exec, static_cast<StrictModeTypeErrorFunction*>(exec->callee())->m_message);
+ return JSValue::encode(jsNull());
+ }
+
+ ConstructType getConstructData(ConstructData& constructData)
+ {
+ constructData.native.function = constructThrowTypeError;
+ return ConstructTypeHost;
+ }
+
+ static EncodedJSValue JSC_HOST_CALL callThrowTypeError(ExecState* exec)
+ {
+ throwTypeError(exec, static_cast<StrictModeTypeErrorFunction*>(exec->callee())->m_message);
+ return JSValue::encode(jsNull());
+ }
+
+ CallType getCallData(CallData& callData)
+ {
+ callData.native.function = callThrowTypeError;
+ return CallTypeHost;
+ }
+
+private:
+ UString m_message;
+};
+
+COMPILE_ASSERT(sizeof(StrictModeTypeErrorFunction) <= sizeof(CollectorCell), sizeof_StrictModeTypeErrorFunction_must_be_less_than_CollectorCell);
+
+JSValue createTypeErrorFunction(ExecState* exec, const UString& message)
+{
+ return new (exec) StrictModeTypeErrorFunction(exec, exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->internalFunctionStructure(), message);
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/Error.h b/Source/JavaScriptCore/runtime/Error.h
new file mode 100644
index 0000000..c0f9d32
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/Error.h
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
+ * Copyright (C) 2001 Peter Kelly (pmk@post.com)
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef Error_h
+#define Error_h
+
+#include "JSObject.h"
+#include <stdint.h>
+
+namespace JSC {
+
+ class ExecState;
+ class JSGlobalData;
+ class JSGlobalObject;
+ class JSObject;
+ class SourceCode;
+ class Structure;
+ class UString;
+
+ // Methods to create a range of internal errors.
+ JSObject* createError(JSGlobalObject*, const UString&);
+ JSObject* createEvalError(JSGlobalObject*, const UString&);
+ JSObject* createRangeError(JSGlobalObject*, const UString&);
+ JSObject* createReferenceError(JSGlobalObject*, const UString&);
+ JSObject* createSyntaxError(JSGlobalObject*, const UString&);
+ JSObject* createTypeError(JSGlobalObject*, const UString&);
+ JSObject* createURIError(JSGlobalObject*, const UString&);
+ // ExecState wrappers.
+ JSObject* createError(ExecState*, const UString&);
+ JSObject* createEvalError(ExecState*, const UString&);
+ JSObject* createRangeError(ExecState*, const UString&);
+ JSObject* createReferenceError(ExecState*, const UString&);
+ JSObject* createSyntaxError(ExecState*, const UString&);
+ JSObject* createTypeError(ExecState*, const UString&);
+ JSObject* createURIError(ExecState*, const UString&);
+
+ // Methods to add
+ bool hasErrorInfo(ExecState*, JSObject* error);
+ JSObject* addErrorInfo(JSGlobalData*, JSObject* error, int line, const SourceCode&);
+ // ExecState wrappers.
+ JSObject* addErrorInfo(ExecState*, JSObject* error, int line, const SourceCode&);
+
+ // Methods to throw Errors.
+ JSValue throwError(ExecState*, JSValue);
+ JSObject* throwError(ExecState*, JSObject*);
+
+ // Convenience wrappers, create an throw an exception with a default message.
+ JSObject* throwTypeError(ExecState*);
+ JSObject* throwSyntaxError(ExecState*);
+
+ // Convenience wrappers, wrap result as an EncodedJSValue.
+ inline EncodedJSValue throwVMError(ExecState* exec, JSValue error) { return JSValue::encode(throwError(exec, error)); }
+ inline EncodedJSValue throwVMTypeError(ExecState* exec) { return JSValue::encode(throwTypeError(exec)); }
+
+ JSValue createTypeErrorFunction(ExecState* exec, const UString& message);
+
+} // namespace JSC
+
+#endif // Error_h
diff --git a/Source/JavaScriptCore/runtime/ErrorConstructor.cpp b/Source/JavaScriptCore/runtime/ErrorConstructor.cpp
new file mode 100644
index 0000000..4326a4d
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/ErrorConstructor.cpp
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
+ * Copyright (C) 2003, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#include "config.h"
+#include "ErrorConstructor.h"
+
+#include "ErrorPrototype.h"
+#include "JSGlobalObject.h"
+#include "JSString.h"
+
+namespace JSC {
+
+ASSERT_CLASS_FITS_IN_CELL(ErrorConstructor);
+
+ErrorConstructor::ErrorConstructor(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, ErrorPrototype* errorPrototype)
+ : InternalFunction(&exec->globalData(), globalObject, structure, Identifier(exec, errorPrototype->classInfo()->className))
+{
+ // ECMA 15.11.3.1 Error.prototype
+ putDirectWithoutTransition(exec->propertyNames().prototype, errorPrototype, DontEnum | DontDelete | ReadOnly);
+ putDirectWithoutTransition(exec->propertyNames().length, jsNumber(1), DontDelete | ReadOnly | DontEnum);
+}
+
+// ECMA 15.9.3
+
+static EncodedJSValue JSC_HOST_CALL constructWithErrorConstructor(ExecState* exec)
+{
+ JSValue message = exec->argumentCount() ? exec->argument(0) : jsUndefined();
+ Structure* errorStructure = exec->lexicalGlobalObject()->errorStructure();
+ return JSValue::encode(ErrorInstance::create(exec, errorStructure, message));
+}
+
+ConstructType ErrorConstructor::getConstructData(ConstructData& constructData)
+{
+ constructData.native.function = constructWithErrorConstructor;
+ return ConstructTypeHost;
+}
+
+static EncodedJSValue JSC_HOST_CALL callErrorConstructor(ExecState* exec)
+{
+ JSValue message = exec->argumentCount() ? exec->argument(0) : jsUndefined();
+ Structure* errorStructure = exec->lexicalGlobalObject()->errorStructure();
+ return JSValue::encode(ErrorInstance::create(exec, errorStructure, message));
+}
+
+CallType ErrorConstructor::getCallData(CallData& callData)
+{
+ callData.native.function = callErrorConstructor;
+ return CallTypeHost;
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/ErrorConstructor.h b/Source/JavaScriptCore/runtime/ErrorConstructor.h
new file mode 100644
index 0000000..3d0d706
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/ErrorConstructor.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifndef ErrorConstructor_h
+#define ErrorConstructor_h
+
+#include "ErrorInstance.h"
+#include "InternalFunction.h"
+
+namespace JSC {
+
+ class ErrorPrototype;
+
+ class ErrorConstructor : public InternalFunction {
+ public:
+ ErrorConstructor(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure>, ErrorPrototype*);
+
+ private:
+ virtual ConstructType getConstructData(ConstructData&);
+ virtual CallType getCallData(CallData&);
+ };
+
+} // namespace JSC
+
+#endif // ErrorConstructor_h
diff --git a/Source/JavaScriptCore/runtime/ErrorInstance.cpp b/Source/JavaScriptCore/runtime/ErrorInstance.cpp
new file mode 100644
index 0000000..0f3153c
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/ErrorInstance.cpp
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
+ * Copyright (C) 2003, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#include "config.h"
+#include "ErrorInstance.h"
+
+namespace JSC {
+
+const ClassInfo ErrorInstance::info = { "Error", 0, 0, 0 };
+
+ErrorInstance::ErrorInstance(JSGlobalData* globalData, NonNullPassRefPtr<Structure> structure)
+ : JSObject(structure)
+ , m_appendSourceToMessage(false)
+{
+ putDirect(globalData->propertyNames->message, jsString(globalData, ""));
+}
+
+ErrorInstance::ErrorInstance(JSGlobalData* globalData, NonNullPassRefPtr<Structure> structure, const UString& message)
+ : JSObject(structure)
+ , m_appendSourceToMessage(false)
+{
+ putDirect(globalData->propertyNames->message, jsString(globalData, message));
+}
+
+ErrorInstance* ErrorInstance::create(JSGlobalData* globalData, NonNullPassRefPtr<Structure> structure, const UString& message)
+{
+ return new (globalData) ErrorInstance(globalData, structure, message);
+}
+
+ErrorInstance* ErrorInstance::create(ExecState* exec, NonNullPassRefPtr<Structure> structure, JSValue message)
+{
+ if (message.isUndefined())
+ return new (exec) ErrorInstance(&exec->globalData(), structure);
+ return new (exec) ErrorInstance(&exec->globalData(), structure, message.toString(exec));
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/ErrorInstance.h b/Source/JavaScriptCore/runtime/ErrorInstance.h
new file mode 100644
index 0000000..b3bebec
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/ErrorInstance.h
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifndef ErrorInstance_h
+#define ErrorInstance_h
+
+#include "JSObject.h"
+
+namespace JSC {
+
+ class ErrorInstance : public JSObject {
+ public:
+
+ virtual const ClassInfo* classInfo() const { return &info; }
+ static const ClassInfo info;
+
+ static ErrorInstance* create(JSGlobalData*, NonNullPassRefPtr<Structure>, const UString&);
+ static ErrorInstance* create(ExecState* exec, NonNullPassRefPtr<Structure>, JSValue message);
+
+
+ bool appendSourceToMessage() { return m_appendSourceToMessage; }
+ void setAppendSourceToMessage() { m_appendSourceToMessage = true; }
+ void clearAppendSourceToMessage() { m_appendSourceToMessage = false; }
+
+ virtual bool isErrorInstance() const { return true; }
+
+ protected:
+ explicit ErrorInstance(JSGlobalData*, NonNullPassRefPtr<Structure>);
+ explicit ErrorInstance(JSGlobalData*, NonNullPassRefPtr<Structure>, const UString&);
+
+ bool m_appendSourceToMessage;
+ };
+
+} // namespace JSC
+
+#endif // ErrorInstance_h
diff --git a/Source/JavaScriptCore/runtime/ErrorPrototype.cpp b/Source/JavaScriptCore/runtime/ErrorPrototype.cpp
new file mode 100644
index 0000000..d18e7d8
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/ErrorPrototype.cpp
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
+ * Copyright (C) 2003, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#include "config.h"
+#include "ErrorPrototype.h"
+
+#include "JSFunction.h"
+#include "JSString.h"
+#include "JSStringBuilder.h"
+#include "ObjectPrototype.h"
+#include "PrototypeFunction.h"
+#include "UString.h"
+
+namespace JSC {
+
+ASSERT_CLASS_FITS_IN_CELL(ErrorPrototype);
+
+static EncodedJSValue JSC_HOST_CALL errorProtoFuncToString(ExecState*);
+
+// ECMA 15.9.4
+ErrorPrototype::ErrorPrototype(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, Structure* prototypeFunctionStructure)
+ : ErrorInstance(&exec->globalData(), structure)
+{
+ // The constructor will be added later in ErrorConstructor's constructor
+
+ putDirectWithoutTransition(exec->propertyNames().name, jsNontrivialString(exec, "Error"), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 0, exec->propertyNames().toString, errorProtoFuncToString), DontEnum);
+}
+
+EncodedJSValue JSC_HOST_CALL errorProtoFuncToString(ExecState* exec)
+{
+ JSObject* thisObj = exec->hostThisValue().toThisObject(exec);
+ JSValue name = thisObj->get(exec, exec->propertyNames().name);
+ JSValue message = thisObj->get(exec, exec->propertyNames().message);
+
+ // Mozilla-compatible format.
+
+ if (!name.isUndefined()) {
+ if (!message.isUndefined())
+ return JSValue::encode(jsMakeNontrivialString(exec, name.toString(exec), ": ", message.toString(exec)));
+ return JSValue::encode(jsNontrivialString(exec, name.toString(exec)));
+ }
+ if (!message.isUndefined())
+ return JSValue::encode(jsMakeNontrivialString(exec, "Error: ", message.toString(exec)));
+ return JSValue::encode(jsNontrivialString(exec, "Error"));
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/ErrorPrototype.h b/Source/JavaScriptCore/runtime/ErrorPrototype.h
new file mode 100644
index 0000000..fce2742
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/ErrorPrototype.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifndef ErrorPrototype_h
+#define ErrorPrototype_h
+
+#include "ErrorInstance.h"
+
+namespace JSC {
+
+ class ObjectPrototype;
+
+ class ErrorPrototype : public ErrorInstance {
+ public:
+ ErrorPrototype(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure>, Structure* prototypeFunctionStructure);
+ };
+
+} // namespace JSC
+
+#endif // ErrorPrototype_h
diff --git a/Source/JavaScriptCore/runtime/ExceptionHelpers.cpp b/Source/JavaScriptCore/runtime/ExceptionHelpers.cpp
new file mode 100644
index 0000000..1ef264c
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/ExceptionHelpers.cpp
@@ -0,0 +1,145 @@
+/*
+ * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "ExceptionHelpers.h"
+
+#include "CodeBlock.h"
+#include "CallFrame.h"
+#include "ErrorInstance.h"
+#include "JSGlobalObjectFunctions.h"
+#include "JSObject.h"
+#include "JSNotAnObject.h"
+#include "Interpreter.h"
+#include "Nodes.h"
+#include "UStringConcatenate.h"
+
+namespace JSC {
+
+class InterruptedExecutionError : public JSObject {
+public:
+ InterruptedExecutionError(JSGlobalData* globalData)
+ : JSObject(globalData->interruptedExecutionErrorStructure)
+ {
+ }
+
+ virtual ComplType exceptionType() const { return Interrupted; }
+
+ virtual UString toString(ExecState*) const { return "JavaScript execution exceeded timeout."; }
+};
+
+JSObject* createInterruptedExecutionException(JSGlobalData* globalData)
+{
+ return new (globalData) InterruptedExecutionError(globalData);
+}
+
+class TerminatedExecutionError : public JSObject {
+public:
+ TerminatedExecutionError(JSGlobalData* globalData)
+ : JSObject(globalData->terminatedExecutionErrorStructure)
+ {
+ }
+
+ virtual ComplType exceptionType() const { return Terminated; }
+
+ virtual UString toString(ExecState*) const { return "JavaScript execution terminated."; }
+};
+
+JSObject* createTerminatedExecutionException(JSGlobalData* globalData)
+{
+ return new (globalData) TerminatedExecutionError(globalData);
+}
+
+JSObject* createStackOverflowError(ExecState* exec)
+{
+ return createRangeError(exec, "Maximum call stack size exceeded.");
+}
+
+JSObject* createStackOverflowError(JSGlobalObject* globalObject)
+{
+ return createRangeError(globalObject, "Maximum call stack size exceeded.");
+}
+
+JSObject* createUndefinedVariableError(ExecState* exec, const Identifier& ident)
+{
+ UString message(makeUString("Can't find variable: ", ident.ustring()));
+ return createReferenceError(exec, message);
+}
+
+JSObject* createInvalidParamError(ExecState* exec, const char* op, JSValue value)
+{
+ UString errorMessage = makeUString("'", value.toString(exec), "' is not a valid argument for '", op, "'");
+ JSObject* exception = createTypeError(exec, errorMessage);
+ ASSERT(exception->isErrorInstance());
+ static_cast<ErrorInstance*>(exception)->setAppendSourceToMessage();
+ return exception;
+}
+
+JSObject* createNotAConstructorError(ExecState* exec, JSValue value)
+{
+ UString errorMessage = makeUString("'", value.toString(exec), "' is not a constructor");
+ JSObject* exception = createTypeError(exec, errorMessage);
+ ASSERT(exception->isErrorInstance());
+ static_cast<ErrorInstance*>(exception)->setAppendSourceToMessage();
+ return exception;
+}
+
+JSObject* createNotAFunctionError(ExecState* exec, JSValue value)
+{
+ UString errorMessage = makeUString("'", value.toString(exec), "' is not a function");
+ JSObject* exception = createTypeError(exec, errorMessage);
+ ASSERT(exception->isErrorInstance());
+ static_cast<ErrorInstance*>(exception)->setAppendSourceToMessage();
+ return exception;
+}
+
+JSObject* createNotAnObjectError(ExecState* exec, JSValue value)
+{
+ UString errorMessage = makeUString("'", value.toString(exec), "' is not an object");
+ JSObject* exception = createTypeError(exec, errorMessage);
+ ASSERT(exception->isErrorInstance());
+ static_cast<ErrorInstance*>(exception)->setAppendSourceToMessage();
+ return exception;
+}
+
+JSObject* createErrorForInvalidGlobalAssignment(ExecState* exec, const UString& propertyName)
+{
+ return createReferenceError(exec, makeUString("Strict mode forbids implicit creation of global property '", propertyName, "'"));
+}
+
+JSObject* throwOutOfMemoryError(ExecState* exec)
+{
+ return throwError(exec, createError(exec, "Out of memory"));
+}
+
+JSObject* throwStackOverflowError(ExecState* exec)
+{
+ return throwError(exec, createStackOverflowError(exec));
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/ExceptionHelpers.h b/Source/JavaScriptCore/runtime/ExceptionHelpers.h
new file mode 100644
index 0000000..7edffad
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/ExceptionHelpers.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ExceptionHelpers_h
+#define ExceptionHelpers_h
+
+#include "JSValue.h"
+
+namespace JSC {
+
+ class CodeBlock;
+ class ExecState;
+ class Identifier;
+ class JSGlobalData;
+ class JSGlobalObject;
+ class JSNotAnObjectErrorStub;
+ class JSObject;
+ class Node;
+ struct Instruction;
+
+ JSObject* createInterruptedExecutionException(JSGlobalData*);
+ JSObject* createTerminatedExecutionException(JSGlobalData*);
+ JSObject* createStackOverflowError(ExecState*);
+ JSObject* createStackOverflowError(JSGlobalObject*);
+ JSObject* createUndefinedVariableError(ExecState*, const Identifier&);
+ JSObject* createNotAnObjectError(ExecState*, JSValue);
+ JSObject* createInvalidParamError(ExecState*, const char* op, JSValue);
+ JSObject* createNotAConstructorError(ExecState*, JSValue);
+ JSObject* createNotAFunctionError(ExecState*, JSValue);
+ JSObject* createErrorForInvalidGlobalAssignment(ExecState*, const UString&);
+
+ JSObject* throwOutOfMemoryError(ExecState*);
+ JSObject* throwStackOverflowError(ExecState*);
+
+} // namespace JSC
+
+#endif // ExceptionHelpers_h
diff --git a/Source/JavaScriptCore/runtime/Executable.cpp b/Source/JavaScriptCore/runtime/Executable.cpp
new file mode 100644
index 0000000..c7262be
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/Executable.cpp
@@ -0,0 +1,313 @@
+/*
+ * Copyright (C) 2009, 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "Executable.h"
+
+#include "BytecodeGenerator.h"
+#include "CodeBlock.h"
+#include "JIT.h"
+#include "Parser.h"
+#include "UStringBuilder.h"
+#include "Vector.h"
+
+namespace JSC {
+
+#if ENABLE(JIT)
+NativeExecutable::~NativeExecutable()
+{
+}
+#endif
+
+VPtrHackExecutable::~VPtrHackExecutable()
+{
+}
+
+EvalExecutable::EvalExecutable(ExecState* exec, const SourceCode& source, bool inStrictContext)
+ : ScriptExecutable(exec, source, inStrictContext)
+{
+}
+
+EvalExecutable::~EvalExecutable()
+{
+}
+
+ProgramExecutable::ProgramExecutable(ExecState* exec, const SourceCode& source)
+ : ScriptExecutable(exec, source, false)
+{
+}
+
+ProgramExecutable::~ProgramExecutable()
+{
+}
+
+FunctionExecutable::FunctionExecutable(JSGlobalData* globalData, const Identifier& name, const SourceCode& source, bool forceUsesArguments, FunctionParameters* parameters, bool inStrictContext, int firstLine, int lastLine)
+ : ScriptExecutable(globalData, source, inStrictContext)
+ , m_numCapturedVariables(0)
+ , m_forceUsesArguments(forceUsesArguments)
+ , m_parameters(parameters)
+ , m_name(name)
+ , m_symbolTable(0)
+{
+ m_firstLine = firstLine;
+ m_lastLine = lastLine;
+}
+
+FunctionExecutable::FunctionExecutable(ExecState* exec, const Identifier& name, const SourceCode& source, bool forceUsesArguments, FunctionParameters* parameters, bool inStrictContext, int firstLine, int lastLine)
+ : ScriptExecutable(exec, source, inStrictContext)
+ , m_numCapturedVariables(0)
+ , m_forceUsesArguments(forceUsesArguments)
+ , m_parameters(parameters)
+ , m_name(name)
+ , m_symbolTable(0)
+{
+ m_firstLine = firstLine;
+ m_lastLine = lastLine;
+}
+
+FunctionExecutable::~FunctionExecutable()
+{
+}
+
+JSObject* EvalExecutable::compileInternal(ExecState* exec, ScopeChainNode* scopeChainNode)
+{
+ JSObject* exception = 0;
+ JSGlobalData* globalData = &exec->globalData();
+ JSGlobalObject* lexicalGlobalObject = exec->lexicalGlobalObject();
+ RefPtr<EvalNode> evalNode = globalData->parser->parse<EvalNode>(lexicalGlobalObject, lexicalGlobalObject->debugger(), exec, m_source, 0, isStrictMode() ? JSParseStrict : JSParseNormal, &exception);
+ if (!evalNode) {
+ ASSERT(exception);
+ return exception;
+ }
+ recordParse(evalNode->features(), evalNode->hasCapturedVariables(), evalNode->lineNo(), evalNode->lastLine());
+
+ ScopeChain scopeChain(scopeChainNode);
+ JSGlobalObject* globalObject = scopeChain.globalObject();
+
+ ASSERT(!m_evalCodeBlock);
+ m_evalCodeBlock = adoptPtr(new EvalCodeBlock(this, globalObject, source().provider(), scopeChain.localDepth()));
+ OwnPtr<BytecodeGenerator> generator(adoptPtr(new BytecodeGenerator(evalNode.get(), scopeChain, m_evalCodeBlock->symbolTable(), m_evalCodeBlock.get())));
+ generator->generate();
+
+ evalNode->destroyData();
+
+#if ENABLE(JIT)
+ if (exec->globalData().canUseJIT()) {
+ m_jitCodeForCall = JIT::compile(scopeChainNode->globalData, m_evalCodeBlock.get());
+#if !ENABLE(OPCODE_SAMPLING)
+ if (!BytecodeGenerator::dumpsGeneratedCode())
+ m_evalCodeBlock->discardBytecode();
+#endif
+ }
+#endif
+
+ return 0;
+}
+
+JSObject* ProgramExecutable::checkSyntax(ExecState* exec)
+{
+ JSObject* exception = 0;
+ JSGlobalData* globalData = &exec->globalData();
+ JSGlobalObject* lexicalGlobalObject = exec->lexicalGlobalObject();
+ RefPtr<ProgramNode> programNode = globalData->parser->parse<ProgramNode>(lexicalGlobalObject, lexicalGlobalObject->debugger(), exec, m_source, 0, JSParseNormal, &exception);
+ if (programNode)
+ return 0;
+ ASSERT(exception);
+ return exception;
+}
+
+JSObject* ProgramExecutable::compileInternal(ExecState* exec, ScopeChainNode* scopeChainNode)
+{
+ ASSERT(!m_programCodeBlock);
+
+ JSObject* exception = 0;
+ JSGlobalData* globalData = &exec->globalData();
+ JSGlobalObject* lexicalGlobalObject = exec->lexicalGlobalObject();
+ RefPtr<ProgramNode> programNode = globalData->parser->parse<ProgramNode>(lexicalGlobalObject, lexicalGlobalObject->debugger(), exec, m_source, 0, isStrictMode() ? JSParseStrict : JSParseNormal, &exception);
+ if (!programNode) {
+ ASSERT(exception);
+ return exception;
+ }
+ recordParse(programNode->features(), programNode->hasCapturedVariables(), programNode->lineNo(), programNode->lastLine());
+
+ ScopeChain scopeChain(scopeChainNode);
+ JSGlobalObject* globalObject = scopeChain.globalObject();
+
+ m_programCodeBlock = adoptPtr(new ProgramCodeBlock(this, GlobalCode, globalObject, source().provider()));
+ OwnPtr<BytecodeGenerator> generator(adoptPtr(new BytecodeGenerator(programNode.get(), scopeChain, &globalObject->symbolTable(), m_programCodeBlock.get())));
+ generator->generate();
+
+ programNode->destroyData();
+
+#if ENABLE(JIT)
+ if (exec->globalData().canUseJIT()) {
+ m_jitCodeForCall = JIT::compile(scopeChainNode->globalData, m_programCodeBlock.get());
+#if !ENABLE(OPCODE_SAMPLING)
+ if (!BytecodeGenerator::dumpsGeneratedCode())
+ m_programCodeBlock->discardBytecode();
+#endif
+ }
+#endif
+
+ return 0;
+}
+
+JSObject* FunctionExecutable::compileForCallInternal(ExecState* exec, ScopeChainNode* scopeChainNode)
+{
+ JSObject* exception = 0;
+ JSGlobalData* globalData = scopeChainNode->globalData;
+ RefPtr<FunctionBodyNode> body = globalData->parser->parse<FunctionBodyNode>(exec->lexicalGlobalObject(), 0, 0, m_source, m_parameters.get(), isStrictMode() ? JSParseStrict : JSParseNormal, &exception);
+ if (!body) {
+ ASSERT(exception);
+ return exception;
+ }
+ if (m_forceUsesArguments)
+ body->setUsesArguments();
+ body->finishParsing(m_parameters, m_name);
+ recordParse(body->features(), body->hasCapturedVariables(), body->lineNo(), body->lastLine());
+
+ ScopeChain scopeChain(scopeChainNode);
+ JSGlobalObject* globalObject = scopeChain.globalObject();
+
+ ASSERT(!m_codeBlockForCall);
+ m_codeBlockForCall = adoptPtr(new FunctionCodeBlock(this, FunctionCode, globalObject, source().provider(), source().startOffset(), false));
+ OwnPtr<BytecodeGenerator> generator(adoptPtr(new BytecodeGenerator(body.get(), scopeChain, m_codeBlockForCall->symbolTable(), m_codeBlockForCall.get())));
+ generator->generate();
+ m_numParametersForCall = m_codeBlockForCall->m_numParameters;
+ ASSERT(m_numParametersForCall);
+ m_numCapturedVariables = m_codeBlockForCall->m_numCapturedVars;
+ m_symbolTable = m_codeBlockForCall->sharedSymbolTable();
+
+ body->destroyData();
+
+#if ENABLE(JIT)
+ if (exec->globalData().canUseJIT()) {
+ m_jitCodeForCall = JIT::compile(scopeChainNode->globalData, m_codeBlockForCall.get(), &m_jitCodeForCallWithArityCheck);
+#if !ENABLE(OPCODE_SAMPLING)
+ if (!BytecodeGenerator::dumpsGeneratedCode())
+ m_codeBlockForCall->discardBytecode();
+#endif
+ }
+#endif
+
+ return 0;
+}
+
+JSObject* FunctionExecutable::compileForConstructInternal(ExecState* exec, ScopeChainNode* scopeChainNode)
+{
+ JSObject* exception = 0;
+ JSGlobalData* globalData = scopeChainNode->globalData;
+ RefPtr<FunctionBodyNode> body = globalData->parser->parse<FunctionBodyNode>(exec->lexicalGlobalObject(), 0, 0, m_source, m_parameters.get(), isStrictMode() ? JSParseStrict : JSParseNormal, &exception);
+ if (!body) {
+ ASSERT(exception);
+ return exception;
+ }
+ if (m_forceUsesArguments)
+ body->setUsesArguments();
+ body->finishParsing(m_parameters, m_name);
+ recordParse(body->features(), body->hasCapturedVariables(), body->lineNo(), body->lastLine());
+
+ ScopeChain scopeChain(scopeChainNode);
+ JSGlobalObject* globalObject = scopeChain.globalObject();
+
+ ASSERT(!m_codeBlockForConstruct);
+ m_codeBlockForConstruct = adoptPtr(new FunctionCodeBlock(this, FunctionCode, globalObject, source().provider(), source().startOffset(), true));
+ OwnPtr<BytecodeGenerator> generator(adoptPtr(new BytecodeGenerator(body.get(), scopeChain, m_codeBlockForConstruct->symbolTable(), m_codeBlockForConstruct.get())));
+ generator->generate();
+ m_numParametersForConstruct = m_codeBlockForConstruct->m_numParameters;
+ ASSERT(m_numParametersForConstruct);
+ m_numCapturedVariables = m_codeBlockForConstruct->m_numCapturedVars;
+ m_symbolTable = m_codeBlockForConstruct->sharedSymbolTable();
+
+ body->destroyData();
+
+#if ENABLE(JIT)
+ if (exec->globalData().canUseJIT()) {
+ m_jitCodeForConstruct = JIT::compile(scopeChainNode->globalData, m_codeBlockForConstruct.get(), &m_jitCodeForConstructWithArityCheck);
+#if !ENABLE(OPCODE_SAMPLING)
+ if (!BytecodeGenerator::dumpsGeneratedCode())
+ m_codeBlockForConstruct->discardBytecode();
+#endif
+ }
+#endif
+
+ return 0;
+}
+
+void FunctionExecutable::markAggregate(MarkStack& markStack)
+{
+ if (m_codeBlockForCall)
+ m_codeBlockForCall->markAggregate(markStack);
+ if (m_codeBlockForConstruct)
+ m_codeBlockForConstruct->markAggregate(markStack);
+}
+
+void FunctionExecutable::discardCode()
+{
+ m_codeBlockForCall.clear();
+ m_codeBlockForConstruct.clear();
+ m_numParametersForCall = NUM_PARAMETERS_NOT_COMPILED;
+ m_numParametersForConstruct = NUM_PARAMETERS_NOT_COMPILED;
+#if ENABLE(JIT)
+ m_jitCodeForCall = JITCode();
+ m_jitCodeForConstruct = JITCode();
+#endif
+}
+
+PassRefPtr<FunctionExecutable> FunctionExecutable::fromGlobalCode(const Identifier& functionName, ExecState* exec, Debugger* debugger, const SourceCode& source, JSObject** exception)
+{
+ JSGlobalObject* lexicalGlobalObject = exec->lexicalGlobalObject();
+ RefPtr<ProgramNode> program = exec->globalData().parser->parse<ProgramNode>(lexicalGlobalObject, debugger, exec, source, 0, JSParseNormal, exception);
+ if (!program) {
+ ASSERT(*exception);
+ return 0;
+ }
+
+ // Uses of this function that would not result in a single function expression are invalid.
+ StatementNode* exprStatement = program->singleStatement();
+ ASSERT(exprStatement);
+ ASSERT(exprStatement->isExprStatement());
+ ExpressionNode* funcExpr = static_cast<ExprStatementNode*>(exprStatement)->expr();
+ ASSERT(funcExpr);
+ ASSERT(funcExpr->isFuncExprNode());
+ FunctionBodyNode* body = static_cast<FuncExprNode*>(funcExpr)->body();
+ ASSERT(body);
+
+ return FunctionExecutable::create(&exec->globalData(), functionName, body->source(), body->usesArguments(), body->parameters(), body->isStrictMode(), body->lineNo(), body->lastLine());
+}
+
+UString FunctionExecutable::paramString() const
+{
+ FunctionParameters& parameters = *m_parameters;
+ UStringBuilder builder;
+ for (size_t pos = 0; pos < parameters.size(); ++pos) {
+ if (!builder.isEmpty())
+ builder.append(", ");
+ builder.append(parameters[pos].ustring());
+ }
+ return builder.toUString();
+}
+
+}
diff --git a/Source/JavaScriptCore/runtime/Executable.h b/Source/JavaScriptCore/runtime/Executable.h
new file mode 100644
index 0000000..544e487
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/Executable.h
@@ -0,0 +1,410 @@
+/*
+ * Copyright (C) 2009, 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef Executable_h
+#define Executable_h
+
+#include "CallData.h"
+#include "JSFunction.h"
+#include "Interpreter.h"
+#include "Nodes.h"
+#include "SamplingTool.h"
+#include <wtf/PassOwnPtr.h>
+
+namespace JSC {
+
+ class CodeBlock;
+ class Debugger;
+ class EvalCodeBlock;
+ class FunctionCodeBlock;
+ class ProgramCodeBlock;
+ class ScopeChainNode;
+
+ struct ExceptionInfo;
+
+ class ExecutableBase : public RefCounted<ExecutableBase> {
+ friend class JIT;
+
+ protected:
+ static const int NUM_PARAMETERS_IS_HOST = 0;
+ static const int NUM_PARAMETERS_NOT_COMPILED = -1;
+
+ public:
+ ExecutableBase(int numParameters)
+ : m_numParametersForCall(numParameters)
+ , m_numParametersForConstruct(numParameters)
+ {
+ }
+
+ virtual ~ExecutableBase() {}
+
+ bool isHostFunction() const
+ {
+ ASSERT((m_numParametersForCall == NUM_PARAMETERS_IS_HOST) == (m_numParametersForConstruct == NUM_PARAMETERS_IS_HOST));
+ return m_numParametersForCall == NUM_PARAMETERS_IS_HOST;
+ }
+
+ protected:
+ int m_numParametersForCall;
+ int m_numParametersForConstruct;
+
+#if ENABLE(JIT)
+ public:
+ JITCode& generatedJITCodeForCall()
+ {
+ ASSERT(m_jitCodeForCall);
+ return m_jitCodeForCall;
+ }
+
+ JITCode& generatedJITCodeForConstruct()
+ {
+ ASSERT(m_jitCodeForConstruct);
+ return m_jitCodeForConstruct;
+ }
+
+ protected:
+ JITCode m_jitCodeForCall;
+ JITCode m_jitCodeForConstruct;
+ MacroAssemblerCodePtr m_jitCodeForCallWithArityCheck;
+ MacroAssemblerCodePtr m_jitCodeForConstructWithArityCheck;
+#endif
+ };
+
+#if ENABLE(JIT)
+ class NativeExecutable : public ExecutableBase {
+ friend class JIT;
+ public:
+ static PassRefPtr<NativeExecutable> create(MacroAssemblerCodePtr callThunk, NativeFunction function, MacroAssemblerCodePtr constructThunk, NativeFunction constructor)
+ {
+ if (!callThunk)
+ return adoptRef(new NativeExecutable(JITCode(), function, JITCode(), constructor));
+ return adoptRef(new NativeExecutable(JITCode::HostFunction(callThunk), function, JITCode::HostFunction(constructThunk), constructor));
+ }
+
+ ~NativeExecutable();
+
+ NativeFunction function() { return m_function; }
+
+ private:
+ NativeExecutable(JITCode callThunk, NativeFunction function, JITCode constructThunk, NativeFunction constructor)
+ : ExecutableBase(NUM_PARAMETERS_IS_HOST)
+ , m_function(function)
+ , m_constructor(constructor)
+ {
+ m_jitCodeForCall = callThunk;
+ m_jitCodeForConstruct = constructThunk;
+ m_jitCodeForCallWithArityCheck = callThunk.addressForCall();
+ m_jitCodeForConstructWithArityCheck = constructThunk.addressForCall();
+ }
+
+ NativeFunction m_function;
+ // Probably should be a NativeConstructor, but this will currently require rewriting the JIT
+ // trampoline. It may be easier to make NativeFunction be passed 'this' as a part of the ArgList.
+ NativeFunction m_constructor;
+ };
+#endif
+
+ class VPtrHackExecutable : public ExecutableBase {
+ public:
+ VPtrHackExecutable()
+ : ExecutableBase(NUM_PARAMETERS_IS_HOST)
+ {
+ }
+
+ ~VPtrHackExecutable();
+ };
+
+ class ScriptExecutable : public ExecutableBase {
+ public:
+ ScriptExecutable(JSGlobalData* globalData, const SourceCode& source, bool isInStrictContext)
+ : ExecutableBase(NUM_PARAMETERS_NOT_COMPILED)
+ , m_source(source)
+ , m_features(isInStrictContext ? StrictModeFeature : 0)
+ {
+#if ENABLE(CODEBLOCK_SAMPLING)
+ relaxAdoptionRequirement();
+ if (SamplingTool* sampler = globalData->interpreter->sampler())
+ sampler->notifyOfScope(this);
+#else
+ UNUSED_PARAM(globalData);
+#endif
+ }
+
+ ScriptExecutable(ExecState* exec, const SourceCode& source, bool isInStrictContext)
+ : ExecutableBase(NUM_PARAMETERS_NOT_COMPILED)
+ , m_source(source)
+ , m_features(isInStrictContext ? StrictModeFeature : 0)
+ {
+#if ENABLE(CODEBLOCK_SAMPLING)
+ relaxAdoptionRequirement();
+ if (SamplingTool* sampler = exec->globalData().interpreter->sampler())
+ sampler->notifyOfScope(this);
+#else
+ UNUSED_PARAM(exec);
+#endif
+ }
+
+ const SourceCode& source() { return m_source; }
+ intptr_t sourceID() const { return m_source.provider()->asID(); }
+ const UString& sourceURL() const { return m_source.provider()->url(); }
+ int lineNo() const { return m_firstLine; }
+ int lastLine() const { return m_lastLine; }
+
+ bool usesEval() const { return m_features & EvalFeature; }
+ bool usesArguments() const { return m_features & ArgumentsFeature; }
+ bool needsActivation() const { return m_hasCapturedVariables || m_features & (EvalFeature | WithFeature | CatchFeature); }
+ bool isStrictMode() const { return m_features & StrictModeFeature; }
+
+ protected:
+ void recordParse(CodeFeatures features, bool hasCapturedVariables, int firstLine, int lastLine)
+ {
+ m_features = features;
+ m_hasCapturedVariables = hasCapturedVariables;
+ m_firstLine = firstLine;
+ m_lastLine = lastLine;
+ }
+
+ SourceCode m_source;
+ CodeFeatures m_features;
+ bool m_hasCapturedVariables;
+ int m_firstLine;
+ int m_lastLine;
+ };
+
+ class EvalExecutable : public ScriptExecutable {
+ public:
+
+ ~EvalExecutable();
+
+ JSObject* compile(ExecState* exec, ScopeChainNode* scopeChainNode)
+ {
+ JSObject* error = 0;
+ if (!m_evalCodeBlock)
+ error = compileInternal(exec, scopeChainNode);
+ ASSERT(!error == !!m_evalCodeBlock);
+ return error;
+ }
+
+ EvalCodeBlock& generatedBytecode()
+ {
+ ASSERT(m_evalCodeBlock);
+ return *m_evalCodeBlock;
+ }
+
+ static PassRefPtr<EvalExecutable> create(ExecState* exec, const SourceCode& source, bool isInStrictContext) { return adoptRef(new EvalExecutable(exec, source, isInStrictContext)); }
+
+#if ENABLE(JIT)
+ JITCode& generatedJITCode()
+ {
+ return generatedJITCodeForCall();
+ }
+#endif
+
+ private:
+ EvalExecutable(ExecState*, const SourceCode&, bool);
+
+ JSObject* compileInternal(ExecState*, ScopeChainNode*);
+
+ OwnPtr<EvalCodeBlock> m_evalCodeBlock;
+ };
+
+ class ProgramExecutable : public ScriptExecutable {
+ public:
+ static PassRefPtr<ProgramExecutable> create(ExecState* exec, const SourceCode& source)
+ {
+ return adoptRef(new ProgramExecutable(exec, source));
+ }
+
+ ~ProgramExecutable();
+
+ JSObject* compile(ExecState* exec, ScopeChainNode* scopeChainNode)
+ {
+ JSObject* error = 0;
+ if (!m_programCodeBlock)
+ error = compileInternal(exec, scopeChainNode);
+ ASSERT(!error == !!m_programCodeBlock);
+ return error;
+ }
+
+ ProgramCodeBlock& generatedBytecode()
+ {
+ ASSERT(m_programCodeBlock);
+ return *m_programCodeBlock;
+ }
+
+ JSObject* checkSyntax(ExecState*);
+
+#if ENABLE(JIT)
+ JITCode& generatedJITCode()
+ {
+ return generatedJITCodeForCall();
+ }
+#endif
+
+ private:
+ ProgramExecutable(ExecState*, const SourceCode&);
+
+ JSObject* compileInternal(ExecState*, ScopeChainNode*);
+
+ OwnPtr<ProgramCodeBlock> m_programCodeBlock;
+ };
+
+ class FunctionExecutable : public ScriptExecutable {
+ friend class JIT;
+ public:
+ static PassRefPtr<FunctionExecutable> create(ExecState* exec, const Identifier& name, const SourceCode& source, bool forceUsesArguments, FunctionParameters* parameters, bool isInStrictContext, int firstLine, int lastLine)
+ {
+ return adoptRef(new FunctionExecutable(exec, name, source, forceUsesArguments, parameters, isInStrictContext, firstLine, lastLine));
+ }
+
+ static PassRefPtr<FunctionExecutable> create(JSGlobalData* globalData, const Identifier& name, const SourceCode& source, bool forceUsesArguments, FunctionParameters* parameters, bool isInStrictContext, int firstLine, int lastLine)
+ {
+ return adoptRef(new FunctionExecutable(globalData, name, source, forceUsesArguments, parameters, isInStrictContext, firstLine, lastLine));
+ }
+
+ ~FunctionExecutable();
+
+ JSFunction* make(ExecState* exec, ScopeChainNode* scopeChain)
+ {
+ return new (exec) JSFunction(exec, this, scopeChain);
+ }
+
+ // Returns either call or construct bytecode. This can be appropriate
+ // for answering questions that that don't vary between call and construct --
+ // for example, argumentsRegister().
+ FunctionCodeBlock& generatedBytecode()
+ {
+ if (m_codeBlockForCall)
+ return *m_codeBlockForCall;
+ ASSERT(m_codeBlockForConstruct);
+ return *m_codeBlockForConstruct;
+ }
+
+ JSObject* compileForCall(ExecState* exec, ScopeChainNode* scopeChainNode)
+ {
+ JSObject* error = 0;
+ if (!m_codeBlockForCall)
+ error = compileForCallInternal(exec, scopeChainNode);
+ ASSERT(!error == !!m_codeBlockForCall);
+ return error;
+ }
+
+ bool isGeneratedForCall() const
+ {
+ return m_codeBlockForCall;
+ }
+
+ FunctionCodeBlock& generatedBytecodeForCall()
+ {
+ ASSERT(m_codeBlockForCall);
+ return *m_codeBlockForCall;
+ }
+
+ JSObject* compileForConstruct(ExecState* exec, ScopeChainNode* scopeChainNode)
+ {
+ JSObject* error = 0;
+ if (!m_codeBlockForConstruct)
+ error = compileForConstructInternal(exec, scopeChainNode);
+ ASSERT(!error == !!m_codeBlockForConstruct);
+ return error;
+ }
+
+ bool isGeneratedForConstruct() const
+ {
+ return m_codeBlockForConstruct;
+ }
+
+ FunctionCodeBlock& generatedBytecodeForConstruct()
+ {
+ ASSERT(m_codeBlockForConstruct);
+ return *m_codeBlockForConstruct;
+ }
+
+ const Identifier& name() { return m_name; }
+ size_t parameterCount() const { return m_parameters->size(); }
+ unsigned capturedVariableCount() const { return m_numCapturedVariables; }
+ UString paramString() const;
+ SharedSymbolTable* symbolTable() const { return m_symbolTable; }
+
+ void discardCode();
+ void markAggregate(MarkStack&);
+ static PassRefPtr<FunctionExecutable> fromGlobalCode(const Identifier&, ExecState*, Debugger*, const SourceCode&, JSObject** exception);
+
+ private:
+ FunctionExecutable(JSGlobalData*, const Identifier& name, const SourceCode&, bool forceUsesArguments, FunctionParameters*, bool, int firstLine, int lastLine);
+ FunctionExecutable(ExecState*, const Identifier& name, const SourceCode&, bool forceUsesArguments, FunctionParameters*, bool, int firstLine, int lastLine);
+
+ JSObject* compileForCallInternal(ExecState*, ScopeChainNode*);
+ JSObject* compileForConstructInternal(ExecState*, ScopeChainNode*);
+
+ unsigned m_numCapturedVariables : 31;
+ bool m_forceUsesArguments : 1;
+
+ RefPtr<FunctionParameters> m_parameters;
+ OwnPtr<FunctionCodeBlock> m_codeBlockForCall;
+ OwnPtr<FunctionCodeBlock> m_codeBlockForConstruct;
+ Identifier m_name;
+ SharedSymbolTable* m_symbolTable;
+
+#if ENABLE(JIT)
+ public:
+ MacroAssemblerCodePtr generatedJITCodeForCallWithArityCheck()
+ {
+ ASSERT(m_jitCodeForCall);
+ ASSERT(m_jitCodeForCallWithArityCheck);
+ return m_jitCodeForCallWithArityCheck;
+ }
+
+ MacroAssemblerCodePtr generatedJITCodeForConstructWithArityCheck()
+ {
+ ASSERT(m_jitCodeForConstruct);
+ ASSERT(m_jitCodeForConstructWithArityCheck);
+ return m_jitCodeForConstructWithArityCheck;
+ }
+#endif
+ };
+
+ inline FunctionExecutable* JSFunction::jsExecutable() const
+ {
+ ASSERT(!isHostFunctionNonInline());
+ return static_cast<FunctionExecutable*>(m_executable.get());
+ }
+
+ inline bool JSFunction::isHostFunction() const
+ {
+ ASSERT(m_executable);
+ return m_executable->isHostFunction();
+ }
+
+#if ENABLE(JIT)
+ inline NativeFunction JSFunction::nativeFunction()
+ {
+ ASSERT(isHostFunction());
+ return static_cast<NativeExecutable*>(m_executable.get())->function();
+ }
+#endif
+}
+
+#endif
diff --git a/Source/JavaScriptCore/runtime/FunctionConstructor.cpp b/Source/JavaScriptCore/runtime/FunctionConstructor.cpp
new file mode 100644
index 0000000..45b4802
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/FunctionConstructor.cpp
@@ -0,0 +1,119 @@
+/*
+ * Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#include "config.h"
+#include "FunctionConstructor.h"
+
+#include "Debugger.h"
+#include "ExceptionHelpers.h"
+#include "FunctionPrototype.h"
+#include "JSFunction.h"
+#include "JSGlobalObject.h"
+#include "JSString.h"
+#include "Lexer.h"
+#include "Nodes.h"
+#include "Parser.h"
+#include "UStringBuilder.h"
+#include "UStringConcatenate.h"
+
+namespace JSC {
+
+ASSERT_CLASS_FITS_IN_CELL(FunctionConstructor);
+
+FunctionConstructor::FunctionConstructor(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, FunctionPrototype* functionPrototype)
+ : InternalFunction(&exec->globalData(), globalObject, structure, Identifier(exec, functionPrototype->classInfo()->className))
+{
+ putDirectWithoutTransition(exec->propertyNames().prototype, functionPrototype, DontEnum | DontDelete | ReadOnly);
+
+ // Number of arguments for constructor
+ putDirectWithoutTransition(exec->propertyNames().length, jsNumber(1), ReadOnly | DontDelete | DontEnum);
+}
+
+static EncodedJSValue JSC_HOST_CALL constructWithFunctionConstructor(ExecState* exec)
+{
+ ArgList args(exec);
+ return JSValue::encode(constructFunction(exec, args));
+}
+
+ConstructType FunctionConstructor::getConstructData(ConstructData& constructData)
+{
+ constructData.native.function = constructWithFunctionConstructor;
+ return ConstructTypeHost;
+}
+
+static EncodedJSValue JSC_HOST_CALL callFunctionConstructor(ExecState* exec)
+{
+ ArgList args(exec);
+ return JSValue::encode(constructFunction(exec, args));
+}
+
+// ECMA 15.3.1 The Function Constructor Called as a Function
+CallType FunctionConstructor::getCallData(CallData& callData)
+{
+ callData.native.function = callFunctionConstructor;
+ return CallTypeHost;
+}
+
+// ECMA 15.3.2 The Function Constructor
+JSObject* constructFunction(ExecState* exec, const ArgList& args, const Identifier& functionName, const UString& sourceURL, int lineNumber)
+{
+ // Functions need to have a space following the opening { due to for web compatibility
+ // see https://bugs.webkit.org/show_bug.cgi?id=24350
+ // We also need \n before the closing } to handle // comments at the end of the last line
+ UString program;
+ if (args.isEmpty())
+ program = "(function() { \n})";
+ else if (args.size() == 1)
+ program = makeUString("(function() { ", args.at(0).toString(exec), "\n})");
+ else {
+ UStringBuilder builder;
+ builder.append("(function(");
+ builder.append(args.at(0).toString(exec));
+ for (size_t i = 1; i < args.size() - 1; i++) {
+ builder.append(",");
+ builder.append(args.at(i).toString(exec));
+ }
+ builder.append(") { ");
+ builder.append(args.at(args.size() - 1).toString(exec));
+ builder.append("\n})");
+ program = builder.toUString();
+ }
+
+ JSGlobalObject* globalObject = exec->lexicalGlobalObject();
+ JSGlobalData& globalData = globalObject->globalData();
+ SourceCode source = makeSource(program, sourceURL, lineNumber);
+ JSObject* exception = 0;
+ RefPtr<FunctionExecutable> function = FunctionExecutable::fromGlobalCode(functionName, exec, exec->dynamicGlobalObject()->debugger(), source, &exception);
+ if (!function) {
+ ASSERT(exception);
+ return throwError(exec, exception);
+ }
+
+ ScopeChain scopeChain(globalObject, &globalData, globalObject, exec->globalThisValue());
+ return new (exec) JSFunction(exec, function, scopeChain.node());
+}
+
+// ECMA 15.3.2 The Function Constructor
+JSObject* constructFunction(ExecState* exec, const ArgList& args)
+{
+ return constructFunction(exec, args, Identifier(exec, "anonymous"), UString(), 1);
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/FunctionConstructor.h b/Source/JavaScriptCore/runtime/FunctionConstructor.h
new file mode 100644
index 0000000..6af4861
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/FunctionConstructor.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
+ * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifndef FunctionConstructor_h
+#define FunctionConstructor_h
+
+#include "InternalFunction.h"
+
+namespace JSC {
+
+ class FunctionPrototype;
+
+ class FunctionConstructor : public InternalFunction {
+ public:
+ FunctionConstructor(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure>, FunctionPrototype*);
+
+ private:
+ virtual ConstructType getConstructData(ConstructData&);
+ virtual CallType getCallData(CallData&);
+ };
+
+ JSObject* constructFunction(ExecState*, const ArgList&, const Identifier& functionName, const UString& sourceURL, int lineNumber);
+ JSObject* constructFunction(ExecState*, const ArgList&);
+
+} // namespace JSC
+
+#endif // FunctionConstructor_h
diff --git a/Source/JavaScriptCore/runtime/FunctionPrototype.cpp b/Source/JavaScriptCore/runtime/FunctionPrototype.cpp
new file mode 100644
index 0000000..cd7739d
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/FunctionPrototype.cpp
@@ -0,0 +1,150 @@
+/*
+ * Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#include "config.h"
+#include "FunctionPrototype.h"
+
+#include "Arguments.h"
+#include "JSArray.h"
+#include "JSFunction.h"
+#include "JSString.h"
+#include "JSStringBuilder.h"
+#include "Interpreter.h"
+#include "Lexer.h"
+#include "PrototypeFunction.h"
+
+namespace JSC {
+
+ASSERT_CLASS_FITS_IN_CELL(FunctionPrototype);
+
+static EncodedJSValue JSC_HOST_CALL functionProtoFuncToString(ExecState*);
+static EncodedJSValue JSC_HOST_CALL functionProtoFuncApply(ExecState*);
+static EncodedJSValue JSC_HOST_CALL functionProtoFuncCall(ExecState*);
+
+FunctionPrototype::FunctionPrototype(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure)
+ : InternalFunction(&exec->globalData(), globalObject, structure, exec->propertyNames().nullIdentifier)
+{
+ putDirectWithoutTransition(exec->propertyNames().length, jsNumber(0), DontDelete | ReadOnly | DontEnum);
+}
+
+void FunctionPrototype::addFunctionProperties(ExecState* exec, JSGlobalObject* globalObject, Structure* prototypeFunctionStructure, NativeFunctionWrapper** callFunction, NativeFunctionWrapper** applyFunction)
+{
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 0, exec->propertyNames().toString, functionProtoFuncToString), DontEnum);
+ *applyFunction = new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 2, exec->propertyNames().apply, functionProtoFuncApply);
+ putDirectFunctionWithoutTransition(exec, *applyFunction, DontEnum);
+ *callFunction = new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 1, exec->propertyNames().call, functionProtoFuncCall);
+ putDirectFunctionWithoutTransition(exec, *callFunction, DontEnum);
+}
+
+static EncodedJSValue JSC_HOST_CALL callFunctionPrototype(ExecState*)
+{
+ return JSValue::encode(jsUndefined());
+}
+
+// ECMA 15.3.4
+CallType FunctionPrototype::getCallData(CallData& callData)
+{
+ callData.native.function = callFunctionPrototype;
+ return CallTypeHost;
+}
+
+// Functions
+
+// Compatibility hack for the Optimost JavaScript library. (See <rdar://problem/6595040>.)
+static inline void insertSemicolonIfNeeded(UString& functionBody)
+{
+ ASSERT(functionBody[0] == '{');
+ ASSERT(functionBody[functionBody.length() - 1] == '}');
+
+ for (size_t i = functionBody.length() - 2; i > 0; --i) {
+ UChar ch = functionBody[i];
+ if (!Lexer::isWhiteSpace(ch) && !Lexer::isLineTerminator(ch)) {
+ if (ch != ';' && ch != '}')
+ functionBody = makeUString(functionBody.substringSharingImpl(0, i + 1), ";", functionBody.substringSharingImpl(i + 1, functionBody.length() - (i + 1)));
+ return;
+ }
+ }
+}
+
+EncodedJSValue JSC_HOST_CALL functionProtoFuncToString(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ if (thisValue.inherits(&JSFunction::info)) {
+ JSFunction* function = asFunction(thisValue);
+ if (function->isHostFunction())
+ return JSValue::encode(jsMakeNontrivialString(exec, "function ", function->name(exec), "() {\n [native code]\n}"));
+ FunctionExecutable* executable = function->jsExecutable();
+ UString sourceString = executable->source().toString();
+ insertSemicolonIfNeeded(sourceString);
+ return JSValue::encode(jsMakeNontrivialString(exec, "function ", function->name(exec), "(", executable->paramString(), ") ", sourceString));
+ }
+
+ if (thisValue.inherits(&InternalFunction::info)) {
+ InternalFunction* function = asInternalFunction(thisValue);
+ return JSValue::encode(jsMakeNontrivialString(exec, "function ", function->name(exec), "() {\n [native code]\n}"));
+ }
+
+ return throwVMTypeError(exec);
+}
+
+EncodedJSValue JSC_HOST_CALL functionProtoFuncApply(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ CallData callData;
+ CallType callType = getCallData(thisValue, callData);
+ if (callType == CallTypeNone)
+ return throwVMTypeError(exec);
+
+ JSValue array = exec->argument(1);
+
+ MarkedArgumentBuffer applyArgs;
+ if (!array.isUndefinedOrNull()) {
+ if (!array.isObject())
+ return throwVMTypeError(exec);
+ if (asObject(array)->classInfo() == &Arguments::info)
+ asArguments(array)->fillArgList(exec, applyArgs);
+ else if (isJSArray(&exec->globalData(), array))
+ asArray(array)->fillArgList(exec, applyArgs);
+ else if (asObject(array)->inherits(&JSArray::info)) {
+ unsigned length = asArray(array)->get(exec, exec->propertyNames().length).toUInt32(exec);
+ for (unsigned i = 0; i < length; ++i)
+ applyArgs.append(asArray(array)->get(exec, i));
+ } else
+ return throwVMTypeError(exec);
+ }
+
+ return JSValue::encode(call(exec, thisValue, callType, callData, exec->argument(0), applyArgs));
+}
+
+EncodedJSValue JSC_HOST_CALL functionProtoFuncCall(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ CallData callData;
+ CallType callType = getCallData(thisValue, callData);
+ if (callType == CallTypeNone)
+ return throwVMTypeError(exec);
+
+ ArgList args(exec);
+ ArgList callArgs;
+ args.getSlice(1, callArgs);
+ return JSValue::encode(call(exec, thisValue, callType, callData, exec->argument(0), callArgs));
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/FunctionPrototype.h b/Source/JavaScriptCore/runtime/FunctionPrototype.h
new file mode 100644
index 0000000..5661194
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/FunctionPrototype.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
+ * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifndef FunctionPrototype_h
+#define FunctionPrototype_h
+
+#include "InternalFunction.h"
+
+namespace JSC {
+
+ class PrototypeFunction;
+
+ class FunctionPrototype : public InternalFunction {
+ public:
+ FunctionPrototype(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure>);
+ void addFunctionProperties(ExecState*, JSGlobalObject*, Structure* prototypeFunctionStructure, NativeFunctionWrapper** callFunction, NativeFunctionWrapper** applyFunction);
+
+ static PassRefPtr<Structure> createStructure(JSValue proto)
+ {
+ return Structure::create(proto, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount);
+ }
+
+ private:
+ virtual CallType getCallData(CallData&);
+ };
+
+} // namespace JSC
+
+#endif // FunctionPrototype_h
diff --git a/Source/JavaScriptCore/runtime/GCActivityCallback.cpp b/Source/JavaScriptCore/runtime/GCActivityCallback.cpp
new file mode 100644
index 0000000..161abfb
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/GCActivityCallback.cpp
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "GCActivityCallback.h"
+
+namespace JSC {
+
+struct DefaultGCActivityCallbackPlatformData {
+};
+
+DefaultGCActivityCallback::DefaultGCActivityCallback(Heap* heap)
+{
+}
+
+DefaultGCActivityCallback::~DefaultGCActivityCallback()
+{
+}
+
+void DefaultGCActivityCallback::operator()()
+{
+}
+
+void DefaultGCActivityCallback::synchronize()
+{
+}
+
+}
+
diff --git a/Source/JavaScriptCore/runtime/GCActivityCallback.h b/Source/JavaScriptCore/runtime/GCActivityCallback.h
new file mode 100644
index 0000000..862b4df
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/GCActivityCallback.h
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef GCActivityCallback_h
+#define GCActivityCallback_h
+
+#include <wtf/OwnPtr.h>
+#include <wtf/PassOwnPtr.h>
+
+namespace JSC {
+
+class Heap;
+
+class GCActivityCallback {
+public:
+ virtual ~GCActivityCallback() {}
+ virtual void operator()() {}
+ virtual void synchronize() {}
+
+protected:
+ GCActivityCallback() {}
+};
+
+struct DefaultGCActivityCallbackPlatformData;
+
+class DefaultGCActivityCallback : public GCActivityCallback {
+public:
+ static PassOwnPtr<DefaultGCActivityCallback> create(Heap*);
+
+ DefaultGCActivityCallback(Heap*);
+ ~DefaultGCActivityCallback();
+
+ void operator()();
+ void synchronize();
+
+private:
+ OwnPtr<DefaultGCActivityCallbackPlatformData*> d;
+};
+
+inline PassOwnPtr<DefaultGCActivityCallback> DefaultGCActivityCallback::create(Heap* heap)
+{
+ return adoptPtr(new DefaultGCActivityCallback(heap));
+}
+
+}
+
+#endif
diff --git a/Source/JavaScriptCore/runtime/GCActivityCallbackCF.cpp b/Source/JavaScriptCore/runtime/GCActivityCallbackCF.cpp
new file mode 100644
index 0000000..7168a05
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/GCActivityCallbackCF.cpp
@@ -0,0 +1,98 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "GCActivityCallback.h"
+
+#include "APIShims.h"
+#include "Collector.h"
+#include "JSGlobalData.h"
+#include "JSLock.h"
+#include <wtf/RetainPtr.h>
+#include <wtf/WTFThreadData.h>
+#include <CoreFoundation/CoreFoundation.h>
+
+#if !PLATFORM(CF)
+#error "This file should only be used on CF platforms."
+#endif
+
+namespace JSC {
+
+struct DefaultGCActivityCallbackPlatformData {
+ static void trigger(CFRunLoopTimerRef, void *info);
+
+ RetainPtr<CFRunLoopTimerRef> timer;
+ RetainPtr<CFRunLoopRef> runLoop;
+ CFRunLoopTimerContext context;
+};
+
+const CFTimeInterval decade = 60 * 60 * 24 * 365 * 10;
+const CFTimeInterval triggerInterval = 2; // seconds
+
+void DefaultGCActivityCallbackPlatformData::trigger(CFRunLoopTimerRef, void *info)
+{
+ Heap* heap = static_cast<Heap*>(info);
+ APIEntryShim shim(heap->globalData());
+ heap->collectAllGarbage();
+}
+
+DefaultGCActivityCallback::DefaultGCActivityCallback(Heap* heap)
+{
+ d = adoptPtr(new DefaultGCActivityCallbackPlatformData);
+
+ memset(&d->context, '\0', sizeof(CFRunLoopTimerContext));
+ d->context.info = heap;
+ d->runLoop = CFRunLoopGetCurrent();
+ d->timer.adoptCF(CFRunLoopTimerCreate(0, decade, decade, 0, 0, DefaultGCActivityCallbackPlatformData::trigger, &d->context));
+ CFRunLoopAddTimer(d->runLoop.get(), d->timer.get(), kCFRunLoopCommonModes);
+}
+
+DefaultGCActivityCallback::~DefaultGCActivityCallback()
+{
+ CFRunLoopRemoveTimer(d->runLoop.get(), d->timer.get(), kCFRunLoopCommonModes);
+ CFRunLoopTimerInvalidate(d->timer.get());
+ d->context.info = 0;
+ d->runLoop = 0;
+ d->timer = 0;
+}
+
+void DefaultGCActivityCallback::operator()()
+{
+ CFRunLoopTimerSetNextFireDate(d->timer.get(), CFAbsoluteTimeGetCurrent() + triggerInterval);
+}
+
+void DefaultGCActivityCallback::synchronize()
+{
+ if (CFRunLoopGetCurrent() == d->runLoop.get())
+ return;
+ CFRunLoopRemoveTimer(d->runLoop.get(), d->timer.get(), kCFRunLoopCommonModes);
+ d->runLoop = CFRunLoopGetCurrent();
+ CFRunLoopAddTimer(d->runLoop.get(), d->timer.get(), kCFRunLoopCommonModes);
+}
+
+}
diff --git a/Source/JavaScriptCore/runtime/GCHandle.cpp b/Source/JavaScriptCore/runtime/GCHandle.cpp
new file mode 100644
index 0000000..297de38
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/GCHandle.cpp
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "GCHandle.h"
+
+namespace JSC {
+
+WeakGCHandlePool* WeakGCHandle::pool()
+{
+ uintptr_t pool = (reinterpret_cast<uintptr_t>(this) & WeakGCHandlePool::poolMask);
+ return reinterpret_cast<WeakGCHandlePool*>(pool);
+}
+
+WeakGCHandlePool::WeakGCHandlePool()
+{
+ ASSERT(sizeof(WeakGCHandlePool) <= WeakGCHandlePool::poolSize);
+ m_entriesSize = 0;
+ m_initialAlloc = 1;
+ m_entries[0].setNextInFreeList(0);
+}
+
+WeakGCHandle* WeakGCHandlePool::allocate(JSCell* cell)
+{
+ ASSERT(cell);
+ ASSERT(m_entries[0].isNext());
+ unsigned freeList = m_entries[0].getNextInFreeList();
+ ASSERT(freeList < WeakGCHandlePool::numPoolEntries);
+ ASSERT(m_entriesSize < WeakGCHandlePool::numPoolEntries);
+
+ if (m_entriesSize == WeakGCHandlePool::numPoolEntries - 1)
+ return 0;
+
+ if (freeList) {
+ unsigned i = freeList;
+ freeList = m_entries[i].getNextInFreeList();
+ m_entries[i].set(cell);
+ m_entries[0].setNextInFreeList(freeList);
+ ++m_entriesSize;
+ return &m_entries[i];
+ }
+
+ ASSERT(m_initialAlloc < WeakGCHandlePool::numPoolEntries);
+
+ unsigned i = m_initialAlloc;
+ ++m_initialAlloc;
+ m_entries[i].set(cell);
+ ++m_entriesSize;
+ return &m_entries[i];
+
+}
+
+void WeakGCHandlePool::free(WeakGCHandle* handle)
+{
+ ASSERT(handle->pool() == this);
+ ASSERT(m_entries[0].isNext());
+ unsigned freeList = m_entries[0].getNextInFreeList();
+ ASSERT(freeList < WeakGCHandlePool::numPoolEntries);
+ handle->setNextInFreeList(freeList);
+ m_entries[0].setNextInFreeList(handle - m_entries);
+ --m_entriesSize;
+}
+
+}
diff --git a/Source/JavaScriptCore/runtime/GCHandle.h b/Source/JavaScriptCore/runtime/GCHandle.h
new file mode 100644
index 0000000..8818f79
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/GCHandle.h
@@ -0,0 +1,116 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef GCHandle_h
+#define GCHandle_h
+
+#include <wtf/Assertions.h>
+
+namespace JSC {
+
+class Heap;
+class JSCell;
+class WeakGCHandle;
+class WeakGCHandlePool;
+
+class WeakGCHandle {
+ friend class WeakGCHandlePool;
+
+public:
+ // Because JSCell objects are aligned, we can use the lower two bits as
+ // status flags. The least significant bit is set when the handle is not a
+ // pointer, i.e. when it's used as a offset for the free list in
+ // WeakGCHandlePool. The second least significant bit is set when the object
+ // the pointer corresponds to has been deleted by a garbage collection
+
+ bool isValidPtr() { return !(m_ptr & 3); }
+ bool isPtr() { return !(m_ptr & 1); }
+ bool isNext() { return (m_ptr & 3) == 1; }
+
+ void invalidate()
+ {
+ ASSERT(isValidPtr());
+ m_ptr |= 2;
+ }
+
+ JSCell* get()
+ {
+ ASSERT(isPtr());
+ return reinterpret_cast<JSCell*>(m_ptr & ~3);
+ }
+
+ void set(JSCell* p)
+ {
+ m_ptr = reinterpret_cast<uintptr_t>(p);
+ ASSERT(isPtr());
+ }
+
+ WeakGCHandlePool* pool();
+
+private:
+ uintptr_t getNextInFreeList()
+ {
+ ASSERT(isNext());
+ return m_ptr >> 2;
+ }
+
+ void setNextInFreeList(uintptr_t n)
+ {
+ m_ptr = (n << 2) | 1;
+ ASSERT(isNext());
+ }
+
+ uintptr_t m_ptr;
+};
+
+class WeakGCHandlePool {
+public:
+ static const size_t poolSize = 32 * 1024; // 32k
+ static const size_t poolMask = ~(poolSize - 1);
+ static const size_t numPoolEntries = (poolSize - sizeof(Heap*) - 3 * sizeof(unsigned)) / sizeof(WeakGCHandle);
+
+ WeakGCHandlePool();
+
+ WeakGCHandle* allocate(JSCell* cell);
+ void free(WeakGCHandle*);
+
+ bool isFull()
+ {
+ ASSERT(m_entriesSize < WeakGCHandlePool::numPoolEntries);
+ return m_entriesSize == WeakGCHandlePool::numPoolEntries - 1;
+ }
+
+ void update();
+
+private:
+ Heap* m_heap;
+ unsigned m_entriesSize;
+ unsigned m_initialAlloc;
+
+ WeakGCHandle m_entries[WeakGCHandlePool::numPoolEntries];
+};
+
+}
+#endif
diff --git a/Source/JavaScriptCore/runtime/GetterSetter.cpp b/Source/JavaScriptCore/runtime/GetterSetter.cpp
new file mode 100644
index 0000000..7e54053
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/GetterSetter.cpp
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 1999-2002 Harri Porten (porten@kde.org)
+ * Copyright (C) 2001 Peter Kelly (pmk@post.com)
+ * Copyright (C) 2004, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+#include "GetterSetter.h"
+
+#include "JSObject.h"
+#include <wtf/Assertions.h>
+
+namespace JSC {
+
+void GetterSetter::markChildren(MarkStack& markStack)
+{
+ JSCell::markChildren(markStack);
+
+ if (m_getter)
+ markStack.append(m_getter);
+ if (m_setter)
+ markStack.append(m_setter);
+}
+
+bool GetterSetter::isGetterSetter() const
+{
+ return true;
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/GetterSetter.h b/Source/JavaScriptCore/runtime/GetterSetter.h
new file mode 100644
index 0000000..e7b1938
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/GetterSetter.h
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
+ * Copyright (C) 2001 Peter Kelly (pmk@post.com)
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef GetterSetter_h
+#define GetterSetter_h
+
+#include "JSCell.h"
+
+#include "CallFrame.h"
+
+namespace JSC {
+
+ class JSObject;
+
+ // This is an internal value object which stores getter and setter functions
+ // for a property.
+ class GetterSetter : public JSCell {
+ friend class JIT;
+ public:
+ GetterSetter(ExecState* exec)
+ : JSCell(exec->globalData().getterSetterStructure.get())
+ , m_getter(0)
+ , m_setter(0)
+ {
+ }
+
+ virtual void markChildren(MarkStack&);
+
+ JSObject* getter() const { return m_getter; }
+ void setGetter(JSObject* getter) { m_getter = getter; }
+ JSObject* setter() const { return m_setter; }
+ void setSetter(JSObject* setter) { m_setter = setter; }
+ static PassRefPtr<Structure> createStructure(JSValue prototype)
+ {
+ return Structure::create(prototype, TypeInfo(GetterSetterType, OverridesMarkChildren), AnonymousSlotCount);
+ }
+ private:
+ virtual bool isGetterSetter() const;
+
+ JSObject* m_getter;
+ JSObject* m_setter;
+ };
+
+ GetterSetter* asGetterSetter(JSValue);
+
+ inline GetterSetter* asGetterSetter(JSValue value)
+ {
+ ASSERT(value.asCell()->isGetterSetter());
+ return static_cast<GetterSetter*>(value.asCell());
+ }
+
+
+} // namespace JSC
+
+#endif // GetterSetter_h
diff --git a/Source/JavaScriptCore/runtime/GlobalEvalFunction.cpp b/Source/JavaScriptCore/runtime/GlobalEvalFunction.cpp
new file mode 100644
index 0000000..3ad4644
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/GlobalEvalFunction.cpp
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 1999-2002 Harri Porten (porten@kde.org)
+ * Copyright (C) 2001 Peter Kelly (pmk@post.com)
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2007 Cameron Zwarich (cwzwarich@uwaterloo.ca)
+ * Copyright (C) 2007 Maks Orlovich
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+#include "GlobalEvalFunction.h"
+
+#include "JSGlobalObject.h"
+#include <wtf/Assertions.h>
+
+namespace JSC {
+
+ASSERT_CLASS_FITS_IN_CELL(GlobalEvalFunction);
+
+GlobalEvalFunction::GlobalEvalFunction(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, int len, const Identifier& name, NativeFunction function, JSGlobalObject* cachedGlobalObject)
+ : PrototypeFunction(exec, globalObject, structure, len, name, function)
+ , m_cachedGlobalObject(cachedGlobalObject)
+{
+ ASSERT_ARG(cachedGlobalObject, cachedGlobalObject);
+}
+
+void GlobalEvalFunction::markChildren(MarkStack& markStack)
+{
+ PrototypeFunction::markChildren(markStack);
+ markStack.append(m_cachedGlobalObject);
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/GlobalEvalFunction.h b/Source/JavaScriptCore/runtime/GlobalEvalFunction.h
new file mode 100644
index 0000000..b889ca9
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/GlobalEvalFunction.h
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
+ * Copyright (C) 2003, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2007 Cameron Zwarich (cwzwarich@uwaterloo.ca)
+ * Copyright (C) 2007 Maks Orlovich
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef GlobalEvalFunction_h
+#define GlobalEvalFunction_h
+
+#include "PrototypeFunction.h"
+
+namespace JSC {
+
+ class JSGlobalObject;
+
+ class GlobalEvalFunction : public PrototypeFunction {
+ public:
+ GlobalEvalFunction(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure>, int len, const Identifier&, NativeFunction, JSGlobalObject* expectedThisObject);
+ JSGlobalObject* cachedGlobalObject() const { return m_cachedGlobalObject; }
+
+ static PassRefPtr<Structure> createStructure(JSValue prototype)
+ {
+ return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount);
+ }
+
+ protected:
+ static const unsigned StructureFlags = ImplementsHasInstance | OverridesMarkChildren | OverridesGetPropertyNames | PrototypeFunction::StructureFlags;
+
+ private:
+ virtual void markChildren(MarkStack&);
+
+ JSGlobalObject* m_cachedGlobalObject;
+ };
+
+} // namespace JSC
+
+#endif // GlobalEvalFunction_h
diff --git a/Source/JavaScriptCore/runtime/Identifier.cpp b/Source/JavaScriptCore/runtime/Identifier.cpp
new file mode 100644
index 0000000..28cfd0a
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/Identifier.cpp
@@ -0,0 +1,312 @@
+/*
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+#include "Identifier.h"
+
+#include "CallFrame.h"
+#include "NumericStrings.h"
+#include <new> // for placement new
+#include <string.h> // for strlen
+#include <wtf/Assertions.h>
+#include <wtf/FastMalloc.h>
+#include <wtf/HashSet.h>
+#include <wtf/WTFThreadData.h>
+#include <wtf/text/StringHash.h>
+
+using WTF::ThreadSpecific;
+
+namespace JSC {
+
+IdentifierTable::~IdentifierTable()
+{
+ HashSet<StringImpl*>::iterator end = m_table.end();
+ for (HashSet<StringImpl*>::iterator iter = m_table.begin(); iter != end; ++iter)
+ (*iter)->setIsIdentifier(false);
+}
+std::pair<HashSet<StringImpl*>::iterator, bool> IdentifierTable::add(StringImpl* value)
+{
+ std::pair<HashSet<StringImpl*>::iterator, bool> result = m_table.add(value);
+ (*result.first)->setIsIdentifier(true);
+ return result;
+}
+template<typename U, typename V>
+std::pair<HashSet<StringImpl*>::iterator, bool> IdentifierTable::add(U value)
+{
+ std::pair<HashSet<StringImpl*>::iterator, bool> result = m_table.add<U, V>(value);
+ (*result.first)->setIsIdentifier(true);
+ return result;
+}
+
+IdentifierTable* createIdentifierTable()
+{
+ return new IdentifierTable;
+}
+
+void deleteIdentifierTable(IdentifierTable* table)
+{
+ delete table;
+}
+
+bool Identifier::equal(const StringImpl* r, const char* s)
+{
+ int length = r->length();
+ const UChar* d = r->characters();
+ for (int i = 0; i != length; ++i)
+ if (d[i] != (unsigned char)s[i])
+ return false;
+ return s[length] == 0;
+}
+
+bool Identifier::equal(const StringImpl* r, const UChar* s, unsigned length)
+{
+ if (r->length() != length)
+ return false;
+ const UChar* d = r->characters();
+ for (unsigned i = 0; i != length; ++i)
+ if (d[i] != s[i])
+ return false;
+ return true;
+}
+
+struct IdentifierCStringTranslator {
+ static unsigned hash(const char* c)
+ {
+ return WTF::StringHasher::createHash<char>(c);
+ }
+
+ static bool equal(StringImpl* r, const char* s)
+ {
+ return Identifier::equal(r, s);
+ }
+
+ static void translate(StringImpl*& location, const char* c, unsigned hash)
+ {
+ size_t length = strlen(c);
+ UChar* d;
+ StringImpl* r = StringImpl::createUninitialized(length, d).leakRef();
+ for (size_t i = 0; i != length; i++)
+ d[i] = static_cast<unsigned char>(c[i]); // use unsigned char to zero-extend instead of sign-extend
+ r->setHash(hash);
+ location = r;
+ }
+};
+
+PassRefPtr<StringImpl> Identifier::add(JSGlobalData* globalData, const char* c)
+{
+ if (!c)
+ return 0;
+ if (!c[0])
+ return StringImpl::empty();
+ if (!c[1])
+ return add(globalData, globalData->smallStrings.singleCharacterStringRep(static_cast<unsigned char>(c[0])));
+
+ IdentifierTable& identifierTable = *globalData->identifierTable;
+ LiteralIdentifierTable& literalIdentifierTable = identifierTable.literalTable();
+
+ const LiteralIdentifierTable::iterator& iter = literalIdentifierTable.find(c);
+ if (iter != literalIdentifierTable.end())
+ return iter->second;
+
+ pair<HashSet<StringImpl*>::iterator, bool> addResult = identifierTable.add<const char*, IdentifierCStringTranslator>(c);
+
+ // If the string is newly-translated, then we need to adopt it.
+ // The boolean in the pair tells us if that is so.
+ RefPtr<StringImpl> addedString = addResult.second ? adoptRef(*addResult.first) : *addResult.first;
+
+ literalIdentifierTable.add(c, addedString.get());
+
+ return addedString.release();
+}
+
+PassRefPtr<StringImpl> Identifier::add(ExecState* exec, const char* c)
+{
+ return add(&exec->globalData(), c);
+}
+
+struct UCharBuffer {
+ const UChar* s;
+ unsigned int length;
+};
+
+struct IdentifierUCharBufferTranslator {
+ static unsigned hash(const UCharBuffer& buf)
+ {
+ return WTF::StringHasher::createHash<UChar>(buf.s, buf.length);
+ }
+
+ static bool equal(StringImpl* str, const UCharBuffer& buf)
+ {
+ return Identifier::equal(str, buf.s, buf.length);
+ }
+
+ static void translate(StringImpl*& location, const UCharBuffer& buf, unsigned hash)
+ {
+ UChar* d;
+ StringImpl* r = StringImpl::createUninitialized(buf.length, d).leakRef();
+ for (unsigned i = 0; i != buf.length; i++)
+ d[i] = buf.s[i];
+ r->setHash(hash);
+ location = r;
+ }
+};
+
+uint32_t Identifier::toUInt32(const UString& string, bool& ok)
+{
+ ok = false;
+
+ unsigned length = string.length();
+ const UChar* characters = string.characters();
+
+ // An empty string is not a number.
+ if (!length)
+ return 0;
+
+ // Get the first character, turning it into a digit.
+ uint32_t value = characters[0] - '0';
+ if (value > 9)
+ return 0;
+
+ // Check for leading zeros. If the first characher is 0, then the
+ // length of the string must be one - e.g. "042" is not equal to "42".
+ if (!value && length > 1)
+ return 0;
+
+ while (--length) {
+ // Multiply value by 10, checking for overflow out of 32 bits.
+ if (value > 0xFFFFFFFFU / 10)
+ return 0;
+ value *= 10;
+
+ // Get the next character, turning it into a digit.
+ uint32_t newValue = *(++characters) - '0';
+ if (newValue > 9)
+ return 0;
+
+ // Add in the old value, checking for overflow out of 32 bits.
+ newValue += value;
+ if (newValue < value)
+ return 0;
+ value = newValue;
+ }
+
+ ok = true;
+ return value;
+}
+
+PassRefPtr<StringImpl> Identifier::add(JSGlobalData* globalData, const UChar* s, int length)
+{
+ if (length == 1) {
+ UChar c = s[0];
+ if (c <= 0xFF)
+ return add(globalData, globalData->smallStrings.singleCharacterStringRep(c));
+ }
+ if (!length)
+ return StringImpl::empty();
+ UCharBuffer buf = {s, length};
+ pair<HashSet<StringImpl*>::iterator, bool> addResult = globalData->identifierTable->add<UCharBuffer, IdentifierUCharBufferTranslator>(buf);
+
+ // If the string is newly-translated, then we need to adopt it.
+ // The boolean in the pair tells us if that is so.
+ return addResult.second ? adoptRef(*addResult.first) : *addResult.first;
+}
+
+PassRefPtr<StringImpl> Identifier::add(ExecState* exec, const UChar* s, int length)
+{
+ return add(&exec->globalData(), s, length);
+}
+
+PassRefPtr<StringImpl> Identifier::addSlowCase(JSGlobalData* globalData, StringImpl* r)
+{
+ ASSERT(!r->isIdentifier());
+ // The empty & null strings are static singletons, and static strings are handled
+ // in ::add() in the header, so we should never get here with a zero length string.
+ ASSERT(r->length());
+
+ if (r->length() == 1) {
+ UChar c = r->characters()[0];
+ if (c <= 0xFF)
+ r = globalData->smallStrings.singleCharacterStringRep(c);
+ if (r->isIdentifier())
+ return r;
+ }
+
+ return *globalData->identifierTable->add(r).first;
+}
+
+PassRefPtr<StringImpl> Identifier::addSlowCase(ExecState* exec, StringImpl* r)
+{
+ return addSlowCase(&exec->globalData(), r);
+}
+
+Identifier Identifier::from(ExecState* exec, unsigned value)
+{
+ return Identifier(exec, exec->globalData().numericStrings.add(value));
+}
+
+Identifier Identifier::from(ExecState* exec, int value)
+{
+ return Identifier(exec, exec->globalData().numericStrings.add(value));
+}
+
+Identifier Identifier::from(ExecState* exec, double value)
+{
+ return Identifier(exec, exec->globalData().numericStrings.add(value));
+}
+
+Identifier Identifier::from(JSGlobalData* globalData, unsigned value)
+{
+ return Identifier(globalData, globalData->numericStrings.add(value));
+}
+
+Identifier Identifier::from(JSGlobalData* globalData, int value)
+{
+ return Identifier(globalData, globalData->numericStrings.add(value));
+}
+
+Identifier Identifier::from(JSGlobalData* globalData, double value)
+{
+ return Identifier(globalData, globalData->numericStrings.add(value));
+}
+
+#ifndef NDEBUG
+
+void Identifier::checkCurrentIdentifierTable(JSGlobalData* globalData)
+{
+ // Check the identifier table accessible through the threadspecific matches the
+ // globalData's identifier table.
+ ASSERT_UNUSED(globalData, globalData->identifierTable == wtfThreadData().currentIdentifierTable());
+}
+
+void Identifier::checkCurrentIdentifierTable(ExecState* exec)
+{
+ checkCurrentIdentifierTable(&exec->globalData());
+}
+
+#else
+
+// These only exists so that our exports are the same for debug and release builds.
+// This would be an ASSERT_NOT_REACHED(), but we're in NDEBUG only code here!
+void Identifier::checkCurrentIdentifierTable(JSGlobalData*) { CRASH(); }
+void Identifier::checkCurrentIdentifierTable(ExecState*) { CRASH(); }
+
+#endif
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/Identifier.h b/Source/JavaScriptCore/runtime/Identifier.h
new file mode 100644
index 0000000..3a8aed7
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/Identifier.h
@@ -0,0 +1,148 @@
+/*
+ * Copyright (C) 2003, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef Identifier_h
+#define Identifier_h
+
+#include "JSGlobalData.h"
+#include "ThreadSpecific.h"
+#include "UString.h"
+#include <wtf/text/CString.h>
+
+namespace JSC {
+
+ class ExecState;
+
+ class Identifier {
+ friend class Structure;
+ public:
+ Identifier() { }
+
+ Identifier(ExecState* exec, const char* s) : m_string(add(exec, s)) { } // Only to be used with string literals.
+ Identifier(ExecState* exec, const UChar* s, int length) : m_string(add(exec, s, length)) { }
+ Identifier(ExecState* exec, StringImpl* rep) : m_string(add(exec, rep)) { }
+ Identifier(ExecState* exec, const UString& s) : m_string(add(exec, s.impl())) { }
+
+ Identifier(JSGlobalData* globalData, const char* s) : m_string(add(globalData, s)) { } // Only to be used with string literals.
+ Identifier(JSGlobalData* globalData, const UChar* s, int length) : m_string(add(globalData, s, length)) { }
+ Identifier(JSGlobalData* globalData, StringImpl* rep) : m_string(add(globalData, rep)) { }
+ Identifier(JSGlobalData* globalData, const UString& s) : m_string(add(globalData, s.impl())) { }
+
+ const UString& ustring() const { return m_string; }
+ StringImpl* impl() const { return m_string.impl(); }
+
+ const UChar* characters() const { return m_string.characters(); }
+ int length() const { return m_string.length(); }
+
+ CString ascii() const { return m_string.ascii(); }
+
+ static Identifier from(ExecState* exec, unsigned y);
+ static Identifier from(ExecState* exec, int y);
+ static Identifier from(ExecState* exec, double y);
+ static Identifier from(JSGlobalData*, unsigned y);
+ static Identifier from(JSGlobalData*, int y);
+ static Identifier from(JSGlobalData*, double y);
+
+ static uint32_t toUInt32(const UString&, bool& ok);
+ uint32_t toUInt32(bool& ok) const { return toUInt32(m_string, ok); }
+ unsigned toArrayIndex(bool& ok) const;
+
+ bool isNull() const { return m_string.isNull(); }
+ bool isEmpty() const { return m_string.isEmpty(); }
+
+ friend bool operator==(const Identifier&, const Identifier&);
+ friend bool operator!=(const Identifier&, const Identifier&);
+
+ friend bool operator==(const Identifier&, const char*);
+ friend bool operator!=(const Identifier&, const char*);
+
+ static bool equal(const StringImpl*, const char*);
+ static bool equal(const StringImpl*, const UChar*, unsigned length);
+ static bool equal(const StringImpl* a, const StringImpl* b) { return ::equal(a, b); }
+
+ static PassRefPtr<StringImpl> add(ExecState*, const char*); // Only to be used with string literals.
+ static PassRefPtr<StringImpl> add(JSGlobalData*, const char*); // Only to be used with string literals.
+
+ private:
+ UString m_string;
+
+ static bool equal(const Identifier& a, const Identifier& b) { return a.m_string.impl() == b.m_string.impl(); }
+ static bool equal(const Identifier& a, const char* b) { return equal(a.m_string.impl(), b); }
+
+ static PassRefPtr<StringImpl> add(ExecState*, const UChar*, int length);
+ static PassRefPtr<StringImpl> add(JSGlobalData*, const UChar*, int length);
+
+ static PassRefPtr<StringImpl> add(ExecState* exec, StringImpl* r)
+ {
+#ifndef NDEBUG
+ checkCurrentIdentifierTable(exec);
+#endif
+ if (r->isIdentifier())
+ return r;
+ return addSlowCase(exec, r);
+ }
+ static PassRefPtr<StringImpl> add(JSGlobalData* globalData, StringImpl* r)
+ {
+#ifndef NDEBUG
+ checkCurrentIdentifierTable(globalData);
+#endif
+ if (r->isIdentifier())
+ return r;
+ return addSlowCase(globalData, r);
+ }
+
+ static PassRefPtr<StringImpl> addSlowCase(ExecState*, StringImpl* r);
+ static PassRefPtr<StringImpl> addSlowCase(JSGlobalData*, StringImpl* r);
+
+ static void checkCurrentIdentifierTable(ExecState*);
+ static void checkCurrentIdentifierTable(JSGlobalData*);
+ };
+
+ inline bool operator==(const Identifier& a, const Identifier& b)
+ {
+ return Identifier::equal(a, b);
+ }
+
+ inline bool operator!=(const Identifier& a, const Identifier& b)
+ {
+ return !Identifier::equal(a, b);
+ }
+
+ inline bool operator==(const Identifier& a, const char* b)
+ {
+ return Identifier::equal(a, b);
+ }
+
+ inline bool operator!=(const Identifier& a, const char* b)
+ {
+ return !Identifier::equal(a, b);
+ }
+
+ IdentifierTable* createIdentifierTable();
+ void deleteIdentifierTable(IdentifierTable*);
+
+ struct IdentifierRepHash : PtrHash<RefPtr<StringImpl> > {
+ static unsigned hash(const RefPtr<StringImpl>& key) { return key->existingHash(); }
+ static unsigned hash(StringImpl* key) { return key->existingHash(); }
+ };
+
+} // namespace JSC
+
+#endif // Identifier_h
diff --git a/Source/JavaScriptCore/runtime/InitializeThreading.cpp b/Source/JavaScriptCore/runtime/InitializeThreading.cpp
new file mode 100644
index 0000000..08dddc1
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/InitializeThreading.cpp
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "InitializeThreading.h"
+
+#include "Collector.h"
+#include "dtoa.h"
+#include "Identifier.h"
+#include "JSGlobalObject.h"
+#include "UString.h"
+#include <wtf/DateMath.h>
+#include <wtf/Threading.h>
+#include <wtf/WTFThreadData.h>
+
+using namespace WTF;
+
+namespace JSC {
+
+#if OS(DARWIN) && ENABLE(JSC_MULTIPLE_THREADS)
+static pthread_once_t initializeThreadingKeyOnce = PTHREAD_ONCE_INIT;
+#endif
+
+static void initializeThreadingOnce()
+{
+ // StringImpl::empty() does not construct its static string in a threadsafe fashion,
+ // so ensure it has been initialized from here.
+ StringImpl::empty();
+
+ WTF::initializeThreading();
+ wtfThreadData();
+ JSGlobalData::storeVPtrs();
+#if ENABLE(JSC_MULTIPLE_THREADS)
+ s_dtoaP5Mutex = new Mutex;
+ initializeDates();
+ RegisterFile::initializeThreading();
+#endif
+}
+
+void initializeThreading()
+{
+#if OS(DARWIN) && ENABLE(JSC_MULTIPLE_THREADS)
+ pthread_once(&initializeThreadingKeyOnce, initializeThreadingOnce);
+#else
+ static bool initializedThreading = false;
+ if (!initializedThreading) {
+ initializeThreadingOnce();
+ initializedThreading = true;
+ }
+#endif
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/InitializeThreading.h b/Source/JavaScriptCore/runtime/InitializeThreading.h
new file mode 100644
index 0000000..1a93ccb
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/InitializeThreading.h
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef InitializeThreading_h
+#define InitializeThreading_h
+
+namespace JSC {
+
+ // This function must be called from the main thread. It is safe to call it repeatedly.
+ // Darwin is an exception to this rule: it is OK to call this function from any thread, even reentrantly.
+ void initializeThreading();
+
+}
+
+#endif // InitializeThreading_h
diff --git a/Source/JavaScriptCore/runtime/InternalFunction.cpp b/Source/JavaScriptCore/runtime/InternalFunction.cpp
new file mode 100644
index 0000000..0a8d9de
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/InternalFunction.cpp
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 1999-2002 Harri Porten (porten@kde.org)
+ * Copyright (C) 2001 Peter Kelly (pmk@post.com)
+ * Copyright (C) 2004, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+#include "InternalFunction.h"
+
+#include "FunctionPrototype.h"
+#include "JSGlobalObject.h"
+#include "JSString.h"
+
+namespace JSC {
+
+ASSERT_CLASS_FITS_IN_CELL(InternalFunction);
+
+const ClassInfo InternalFunction::info = { "Function", 0, 0, 0 };
+
+const ClassInfo* InternalFunction::classInfo() const
+{
+ return &info;
+}
+
+InternalFunction::InternalFunction(NonNullPassRefPtr<Structure> structure)
+ : JSObjectWithGlobalObject(structure)
+{
+}
+
+InternalFunction::InternalFunction(JSGlobalData* globalData, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, const Identifier& name)
+ : JSObjectWithGlobalObject(globalObject, structure)
+{
+ putDirect(globalData->propertyNames->name, jsString(globalData, name.isNull() ? "" : name.ustring()), DontDelete | ReadOnly | DontEnum);
+}
+
+const UString& InternalFunction::name(ExecState* exec)
+{
+ return asString(getDirect(exec->globalData().propertyNames->name))->tryGetValue();
+}
+
+const UString InternalFunction::displayName(ExecState* exec)
+{
+ JSValue displayName = getDirect(exec->globalData().propertyNames->displayName);
+
+ if (displayName && isJSString(&exec->globalData(), displayName))
+ return asString(displayName)->tryGetValue();
+
+ return UString();
+}
+
+const UString InternalFunction::calculatedDisplayName(ExecState* exec)
+{
+ const UString explicitName = displayName(exec);
+
+ if (!explicitName.isEmpty())
+ return explicitName;
+
+ return name(exec);
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/InternalFunction.h b/Source/JavaScriptCore/runtime/InternalFunction.h
new file mode 100644
index 0000000..401f17b
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/InternalFunction.h
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
+ * Copyright (C) 2003, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2007 Cameron Zwarich (cwzwarich@uwaterloo.ca)
+ * Copyright (C) 2007 Maks Orlovich
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef InternalFunction_h
+#define InternalFunction_h
+
+#include "JSObjectWithGlobalObject.h"
+#include "Identifier.h"
+
+namespace JSC {
+
+ class FunctionPrototype;
+
+ class InternalFunction : public JSObjectWithGlobalObject {
+ public:
+ virtual const ClassInfo* classInfo() const;
+ static JS_EXPORTDATA const ClassInfo info;
+
+ const UString& name(ExecState*);
+ const UString displayName(ExecState*);
+ const UString calculatedDisplayName(ExecState*);
+
+ static PassRefPtr<Structure> createStructure(JSValue proto)
+ {
+ return Structure::create(proto, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount);
+ }
+
+ protected:
+ static const unsigned StructureFlags = ImplementsHasInstance | JSObject::StructureFlags;
+
+ // Only used to allow us to determine the JSFunction vptr
+ InternalFunction(NonNullPassRefPtr<Structure> structure);
+
+ InternalFunction(JSGlobalData*, JSGlobalObject*, NonNullPassRefPtr<Structure>, const Identifier&);
+
+ private:
+ virtual CallType getCallData(CallData&) = 0;
+ };
+
+ InternalFunction* asInternalFunction(JSValue);
+
+ inline InternalFunction* asInternalFunction(JSValue value)
+ {
+ ASSERT(asObject(value)->inherits(&InternalFunction::info));
+ return static_cast<InternalFunction*>(asObject(value));
+ }
+
+} // namespace JSC
+
+#endif // InternalFunction_h
diff --git a/Source/JavaScriptCore/runtime/JSAPIValueWrapper.cpp b/Source/JavaScriptCore/runtime/JSAPIValueWrapper.cpp
new file mode 100644
index 0000000..e83724a
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/JSAPIValueWrapper.cpp
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 1999-2002 Harri Porten (porten@kde.org)
+ * Copyright (C) 2001 Peter Kelly (pmk@post.com)
+ * Copyright (C) 2004, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+#include "JSAPIValueWrapper.h"
+
+#include "NumberObject.h"
+#include "UString.h"
+
+namespace JSC {
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/JSAPIValueWrapper.h b/Source/JavaScriptCore/runtime/JSAPIValueWrapper.h
new file mode 100644
index 0000000..10ded4c
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/JSAPIValueWrapper.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
+ * Copyright (C) 2001 Peter Kelly (pmk@post.com)
+ * Copyright (C) 2003, 2004, 2005, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef JSAPIValueWrapper_h
+#define JSAPIValueWrapper_h
+
+#include "JSCell.h"
+#include "CallFrame.h"
+
+namespace JSC {
+
+ class JSAPIValueWrapper : public JSCell {
+ friend JSValue jsAPIValueWrapper(ExecState*, JSValue);
+ public:
+ JSValue value() const { return m_value; }
+
+ virtual bool isAPIValueWrapper() const { return true; }
+
+ static PassRefPtr<Structure> createStructure(JSValue prototype)
+ {
+ return Structure::create(prototype, TypeInfo(CompoundType, OverridesMarkChildren | OverridesGetPropertyNames), AnonymousSlotCount);
+ }
+
+
+ private:
+ JSAPIValueWrapper(ExecState* exec, JSValue value)
+ : JSCell(exec->globalData().apiWrapperStructure.get())
+ , m_value(value)
+ {
+ ASSERT(!value.isCell());
+ }
+
+ JSValue m_value;
+ };
+
+ inline JSValue jsAPIValueWrapper(ExecState* exec, JSValue value)
+ {
+ return new (exec) JSAPIValueWrapper(exec, value);
+ }
+
+} // namespace JSC
+
+#endif // JSAPIValueWrapper_h
diff --git a/Source/JavaScriptCore/runtime/JSActivation.cpp b/Source/JavaScriptCore/runtime/JSActivation.cpp
new file mode 100644
index 0000000..1147858
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/JSActivation.cpp
@@ -0,0 +1,223 @@
+/*
+ * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JSActivation.h"
+
+#include "Arguments.h"
+#include "Interpreter.h"
+#include "JSFunction.h"
+
+namespace JSC {
+
+ASSERT_CLASS_FITS_IN_CELL(JSActivation);
+
+const ClassInfo JSActivation::info = { "JSActivation", 0, 0, 0 };
+
+JSActivation::JSActivation(CallFrame* callFrame, NonNullPassRefPtr<FunctionExecutable> functionExecutable)
+ : Base(callFrame->globalData().activationStructure, new JSActivationData(functionExecutable, callFrame->registers()))
+{
+}
+
+JSActivation::~JSActivation()
+{
+ delete d();
+}
+
+void JSActivation::markChildren(MarkStack& markStack)
+{
+ Base::markChildren(markStack);
+
+ Register* registerArray = d()->registerArray.get();
+ if (!registerArray)
+ return;
+
+ size_t numParametersMinusThis = d()->functionExecutable->parameterCount();
+
+ size_t count = numParametersMinusThis;
+ markStack.appendValues(registerArray, count);
+
+ size_t numVars = d()->functionExecutable->capturedVariableCount();
+
+ // Skip the call frame, which sits between the parameters and vars.
+ markStack.appendValues(registerArray + count + RegisterFile::CallFrameHeaderSize, numVars, MayContainNullValues);
+}
+
+inline bool JSActivation::symbolTableGet(const Identifier& propertyName, PropertySlot& slot)
+{
+ SymbolTableEntry entry = symbolTable().inlineGet(propertyName.impl());
+ if (!entry.isNull()) {
+ ASSERT(entry.getIndex() < static_cast<int>(d()->functionExecutable->capturedVariableCount()));
+ slot.setRegisterSlot(&registerAt(entry.getIndex()));
+ return true;
+ }
+ return false;
+}
+
+inline bool JSActivation::symbolTablePut(const Identifier& propertyName, JSValue value)
+{
+ ASSERT(!Heap::heap(value) || Heap::heap(value) == Heap::heap(this));
+
+ SymbolTableEntry entry = symbolTable().inlineGet(propertyName.impl());
+ if (entry.isNull())
+ return false;
+ if (entry.isReadOnly())
+ return true;
+ ASSERT(entry.getIndex() < static_cast<int>(d()->functionExecutable->capturedVariableCount()));
+ registerAt(entry.getIndex()) = value;
+ return true;
+}
+
+void JSActivation::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
+{
+ SymbolTable::const_iterator end = symbolTable().end();
+ for (SymbolTable::const_iterator it = symbolTable().begin(); it != end; ++it) {
+ ASSERT(it->second.getIndex() < static_cast<int>(d()->functionExecutable->capturedVariableCount()));
+ if (!(it->second.getAttributes() & DontEnum) || (mode == IncludeDontEnumProperties))
+ propertyNames.add(Identifier(exec, it->first.get()));
+ }
+ // Skip the JSVariableObject implementation of getOwnPropertyNames
+ JSObject::getOwnPropertyNames(exec, propertyNames, mode);
+}
+
+inline bool JSActivation::symbolTablePutWithAttributes(const Identifier& propertyName, JSValue value, unsigned attributes)
+{
+ ASSERT(!Heap::heap(value) || Heap::heap(value) == Heap::heap(this));
+
+ SymbolTable::iterator iter = symbolTable().find(propertyName.impl());
+ if (iter == symbolTable().end())
+ return false;
+ SymbolTableEntry& entry = iter->second;
+ ASSERT(!entry.isNull());
+ if (entry.getIndex() >= static_cast<int>(d()->functionExecutable->capturedVariableCount()))
+ return false;
+ entry.setAttributes(attributes);
+ registerAt(entry.getIndex()) = value;
+ return true;
+}
+
+bool JSActivation::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
+{
+ if (propertyName == exec->propertyNames().arguments) {
+ slot.setCustom(this, getArgumentsGetter());
+ return true;
+ }
+
+ if (symbolTableGet(propertyName, slot))
+ return true;
+
+ if (JSValue* location = getDirectLocation(propertyName)) {
+ slot.setValueSlot(location);
+ return true;
+ }
+
+ // We don't call through to JSObject because there's no way to give an
+ // activation object getter properties or a prototype.
+ ASSERT(!hasGetterSetterProperties());
+ ASSERT(prototype().isNull());
+ return false;
+}
+
+void JSActivation::put(ExecState*, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
+{
+ ASSERT(!Heap::heap(value) || Heap::heap(value) == Heap::heap(this));
+
+ if (symbolTablePut(propertyName, value))
+ return;
+
+ // We don't call through to JSObject because __proto__ and getter/setter
+ // properties are non-standard extensions that other implementations do not
+ // expose in the activation object.
+ ASSERT(!hasGetterSetterProperties());
+ putDirect(propertyName, value, 0, true, slot);
+}
+
+// FIXME: Make this function honor ReadOnly (const) and DontEnum
+void JSActivation::putWithAttributes(ExecState* exec, const Identifier& propertyName, JSValue value, unsigned attributes)
+{
+ ASSERT(!Heap::heap(value) || Heap::heap(value) == Heap::heap(this));
+
+ if (symbolTablePutWithAttributes(propertyName, value, attributes))
+ return;
+
+ // We don't call through to JSObject because __proto__ and getter/setter
+ // properties are non-standard extensions that other implementations do not
+ // expose in the activation object.
+ ASSERT(!hasGetterSetterProperties());
+ PutPropertySlot slot;
+ JSObject::putWithAttributes(exec, propertyName, value, attributes, true, slot);
+}
+
+bool JSActivation::deleteProperty(ExecState* exec, const Identifier& propertyName)
+{
+ if (propertyName == exec->propertyNames().arguments)
+ return false;
+
+ return Base::deleteProperty(exec, propertyName);
+}
+
+JSObject* JSActivation::toThisObject(ExecState* exec) const
+{
+ return exec->globalThisValue();
+}
+
+JSValue JSActivation::toStrictThisObject(ExecState*) const
+{
+ return jsNull();
+}
+
+bool JSActivation::isDynamicScope(bool& requiresDynamicChecks) const
+{
+ requiresDynamicChecks = d()->functionExecutable->usesEval();
+ return false;
+}
+
+JSValue JSActivation::argumentsGetter(ExecState*, JSValue slotBase, const Identifier&)
+{
+ JSActivation* activation = asActivation(slotBase);
+ CallFrame* callFrame = CallFrame::create(activation->d()->registers);
+ int argumentsRegister = activation->d()->functionExecutable->generatedBytecode().argumentsRegister();
+ if (!callFrame->uncheckedR(argumentsRegister).jsValue()) {
+ JSValue arguments = JSValue(new (callFrame) Arguments(callFrame));
+ callFrame->uncheckedR(argumentsRegister) = arguments;
+ callFrame->uncheckedR(unmodifiedArgumentsRegister(argumentsRegister)) = arguments;
+ }
+
+ ASSERT(callFrame->uncheckedR(argumentsRegister).jsValue().inherits(&Arguments::info));
+ return callFrame->uncheckedR(argumentsRegister).jsValue();
+}
+
+// These two functions serve the purpose of isolating the common case from a
+// PIC branch.
+
+PropertySlot::GetValueFunc JSActivation::getArgumentsGetter()
+{
+ return argumentsGetter;
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/JSActivation.h b/Source/JavaScriptCore/runtime/JSActivation.h
new file mode 100644
index 0000000..6dd6d70
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/JSActivation.h
@@ -0,0 +1,115 @@
+/*
+ * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef JSActivation_h
+#define JSActivation_h
+
+#include "CodeBlock.h"
+#include "JSVariableObject.h"
+#include "SymbolTable.h"
+#include "Nodes.h"
+
+namespace JSC {
+
+ class Arguments;
+ class Register;
+
+ class JSActivation : public JSVariableObject {
+ typedef JSVariableObject Base;
+ public:
+ JSActivation(CallFrame*, NonNullPassRefPtr<FunctionExecutable>);
+ virtual ~JSActivation();
+
+ virtual void markChildren(MarkStack&);
+
+ virtual bool isDynamicScope(bool& requiresDynamicChecks) const;
+
+ virtual bool isActivationObject() const { return true; }
+
+ virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
+ virtual void getOwnPropertyNames(ExecState*, PropertyNameArray&, EnumerationMode);
+
+ virtual void put(ExecState*, const Identifier&, JSValue, PutPropertySlot&);
+
+ virtual void putWithAttributes(ExecState*, const Identifier&, JSValue, unsigned attributes);
+ virtual bool deleteProperty(ExecState*, const Identifier& propertyName);
+
+ virtual JSObject* toThisObject(ExecState*) const;
+ virtual JSValue toStrictThisObject(ExecState*) const;
+
+ void copyRegisters();
+
+ virtual const ClassInfo* classInfo() const { return &info; }
+ static const ClassInfo info;
+
+ static PassRefPtr<Structure> createStructure(JSValue proto) { return Structure::create(proto, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount); }
+
+ protected:
+ static const unsigned StructureFlags = OverridesGetOwnPropertySlot | NeedsThisConversion | OverridesMarkChildren | OverridesGetPropertyNames | JSVariableObject::StructureFlags;
+
+ private:
+ struct JSActivationData : public JSVariableObjectData {
+ JSActivationData(NonNullPassRefPtr<FunctionExecutable> _functionExecutable, Register* registers)
+ : JSVariableObjectData(_functionExecutable->symbolTable(), registers)
+ , functionExecutable(_functionExecutable)
+ {
+ // We have to manually ref and deref the symbol table as JSVariableObjectData
+ // doesn't know about SharedSymbolTable
+ functionExecutable->symbolTable()->ref();
+ }
+ ~JSActivationData()
+ {
+ static_cast<SharedSymbolTable*>(symbolTable)->deref();
+ }
+
+ RefPtr<FunctionExecutable> functionExecutable;
+ };
+
+ bool symbolTableGet(const Identifier&, PropertySlot&);
+ bool symbolTableGet(const Identifier&, PropertyDescriptor&);
+ bool symbolTableGet(const Identifier&, PropertySlot&, bool& slotIsWriteable);
+ bool symbolTablePut(const Identifier&, JSValue);
+ bool symbolTablePutWithAttributes(const Identifier&, JSValue, unsigned attributes);
+
+ static JSValue argumentsGetter(ExecState*, JSValue, const Identifier&);
+ NEVER_INLINE PropertySlot::GetValueFunc getArgumentsGetter();
+
+ JSActivationData* d() const { return static_cast<JSActivationData*>(JSVariableObject::d); }
+ };
+
+ JSActivation* asActivation(JSValue);
+
+ inline JSActivation* asActivation(JSValue value)
+ {
+ ASSERT(asObject(value)->inherits(&JSActivation::info));
+ return static_cast<JSActivation*>(asObject(value));
+ }
+
+} // namespace JSC
+
+#endif // JSActivation_h
diff --git a/Source/JavaScriptCore/runtime/JSArray.cpp b/Source/JavaScriptCore/runtime/JSArray.cpp
new file mode 100644
index 0000000..556a16e
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/JSArray.cpp
@@ -0,0 +1,1322 @@
+/*
+ * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
+ * Copyright (C) 2003, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2003 Peter Kelly (pmk@post.com)
+ * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#include "config.h"
+#include "JSArray.h"
+
+#include "ArrayPrototype.h"
+#include "CachedCall.h"
+#include "Error.h"
+#include "Executable.h"
+#include "PropertyNameArray.h"
+#include <wtf/AVLTree.h>
+#include <wtf/Assertions.h>
+#include <wtf/OwnPtr.h>
+#include <Operations.h>
+
+using namespace std;
+using namespace WTF;
+
+namespace JSC {
+
+ASSERT_CLASS_FITS_IN_CELL(JSArray);
+
+// Overview of JSArray
+//
+// Properties of JSArray objects may be stored in one of three locations:
+// * The regular JSObject property map.
+// * A storage vector.
+// * A sparse map of array entries.
+//
+// Properties with non-numeric identifiers, with identifiers that are not representable
+// as an unsigned integer, or where the value is greater than MAX_ARRAY_INDEX
+// (specifically, this is only one property - the value 0xFFFFFFFFU as an unsigned 32-bit
+// integer) are not considered array indices and will be stored in the JSObject property map.
+//
+// All properties with a numeric identifer, representable as an unsigned integer i,
+// where (i <= MAX_ARRAY_INDEX), are an array index and will be stored in either the
+// storage vector or the sparse map. An array index i will be handled in the following
+// fashion:
+//
+// * Where (i < MIN_SPARSE_ARRAY_INDEX) the value will be stored in the storage vector.
+// * Where (MIN_SPARSE_ARRAY_INDEX <= i <= MAX_STORAGE_VECTOR_INDEX) the value will either
+// be stored in the storage vector or in the sparse array, depending on the density of
+// data that would be stored in the vector (a vector being used where at least
+// (1 / minDensityMultiplier) of the entries would be populated).
+// * Where (MAX_STORAGE_VECTOR_INDEX < i <= MAX_ARRAY_INDEX) the value will always be stored
+// in the sparse array.
+
+// The definition of MAX_STORAGE_VECTOR_LENGTH is dependant on the definition storageSize
+// function below - the MAX_STORAGE_VECTOR_LENGTH limit is defined such that the storage
+// size calculation cannot overflow. (sizeof(ArrayStorage) - sizeof(JSValue)) +
+// (vectorLength * sizeof(JSValue)) must be <= 0xFFFFFFFFU (which is maximum value of size_t).
+#define MAX_STORAGE_VECTOR_LENGTH static_cast<unsigned>((0xFFFFFFFFU - (sizeof(ArrayStorage) - sizeof(JSValue))) / sizeof(JSValue))
+
+// These values have to be macros to be used in max() and min() without introducing
+// a PIC branch in Mach-O binaries, see <rdar://problem/5971391>.
+#define MIN_SPARSE_ARRAY_INDEX 10000U
+#define MAX_STORAGE_VECTOR_INDEX (MAX_STORAGE_VECTOR_LENGTH - 1)
+// 0xFFFFFFFF is a bit weird -- is not an array index even though it's an integer.
+#define MAX_ARRAY_INDEX 0xFFFFFFFEU
+
+// The value BASE_VECTOR_LEN is the maximum number of vector elements we'll allocate
+// for an array that was created with a sepcified length (e.g. a = new Array(123))
+#define BASE_VECTOR_LEN 4U
+
+// The upper bound to the size we'll grow a zero length array when the first element
+// is added.
+#define FIRST_VECTOR_GROW 4U
+
+// Our policy for when to use a vector and when to use a sparse map.
+// For all array indices under MIN_SPARSE_ARRAY_INDEX, we always use a vector.
+// When indices greater than MIN_SPARSE_ARRAY_INDEX are involved, we use a vector
+// as long as it is 1/8 full. If more sparse than that, we use a map.
+static const unsigned minDensityMultiplier = 8;
+
+const ClassInfo JSArray::info = {"Array", 0, 0, 0};
+
+// We keep track of the size of the last array after it was grown. We use this
+// as a simple heuristic for as the value to grow the next array from size 0.
+// This value is capped by the constant FIRST_VECTOR_GROW defined above.
+static unsigned lastArraySize = 0;
+
+static inline size_t storageSize(unsigned vectorLength)
+{
+ ASSERT(vectorLength <= MAX_STORAGE_VECTOR_LENGTH);
+
+ // MAX_STORAGE_VECTOR_LENGTH is defined such that provided (vectorLength <= MAX_STORAGE_VECTOR_LENGTH)
+ // - as asserted above - the following calculation cannot overflow.
+ size_t size = (sizeof(ArrayStorage) - sizeof(JSValue)) + (vectorLength * sizeof(JSValue));
+ // Assertion to detect integer overflow in previous calculation (should not be possible, provided that
+ // MAX_STORAGE_VECTOR_LENGTH is correctly defined).
+ ASSERT(((size - (sizeof(ArrayStorage) - sizeof(JSValue))) / sizeof(JSValue) == vectorLength) && (size >= (sizeof(ArrayStorage) - sizeof(JSValue))));
+
+ return size;
+}
+
+static inline bool isDenseEnoughForVector(unsigned length, unsigned numValues)
+{
+ return length / minDensityMultiplier <= numValues;
+}
+
+#if !CHECK_ARRAY_CONSISTENCY
+
+inline void JSArray::checkConsistency(ConsistencyCheckType)
+{
+}
+
+#endif
+
+JSArray::JSArray(VPtrStealingHackType)
+ : JSObject(createStructure(jsNull()))
+{
+ unsigned initialCapacity = 0;
+
+ m_storage = static_cast<ArrayStorage*>(fastZeroedMalloc(storageSize(initialCapacity)));
+ m_storage->m_allocBase = m_storage;
+ m_indexBias = 0;
+ m_vectorLength = initialCapacity;
+
+ checkConsistency();
+
+ // It's not safe to call Heap::heap(this) in order to report extra memory
+ // cost here, because the VPtrStealingHackType JSArray is not allocated on
+ // the heap. For the same reason, it's OK not to report extra cost.
+}
+
+JSArray::JSArray(NonNullPassRefPtr<Structure> structure)
+ : JSObject(structure)
+{
+ unsigned initialCapacity = 0;
+
+ m_storage = static_cast<ArrayStorage*>(fastZeroedMalloc(storageSize(initialCapacity)));
+ m_storage->m_allocBase = m_storage;
+ m_indexBias = 0;
+ m_vectorLength = initialCapacity;
+
+ checkConsistency();
+
+ Heap::heap(this)->reportExtraMemoryCost(storageSize(0));
+}
+
+JSArray::JSArray(NonNullPassRefPtr<Structure> structure, unsigned initialLength, ArrayCreationMode creationMode)
+ : JSObject(structure)
+{
+ unsigned initialCapacity;
+ if (creationMode == CreateCompact)
+ initialCapacity = initialLength;
+ else
+ initialCapacity = min(BASE_VECTOR_LEN, MIN_SPARSE_ARRAY_INDEX);
+
+ m_storage = static_cast<ArrayStorage*>(fastMalloc(storageSize(initialCapacity)));
+ m_storage->m_allocBase = m_storage;
+ m_storage->m_length = initialLength;
+ m_indexBias = 0;
+ m_vectorLength = initialCapacity;
+ m_storage->m_sparseValueMap = 0;
+ m_storage->subclassData = 0;
+ m_storage->reportedMapCapacity = 0;
+
+ if (creationMode == CreateCompact) {
+#if CHECK_ARRAY_CONSISTENCY
+ m_storage->m_inCompactInitialization = !!initialCapacity;
+#endif
+ m_storage->m_length = 0;
+ m_storage->m_numValuesInVector = initialCapacity;
+ } else {
+#if CHECK_ARRAY_CONSISTENCY
+ storage->m_inCompactInitialization = false;
+#endif
+ m_storage->m_length = initialLength;
+ m_storage->m_numValuesInVector = 0;
+ JSValue* vector = m_storage->m_vector;
+ for (size_t i = 0; i < initialCapacity; ++i)
+ vector[i] = JSValue();
+ }
+
+ checkConsistency();
+
+ Heap::heap(this)->reportExtraMemoryCost(storageSize(initialCapacity));
+}
+
+JSArray::JSArray(NonNullPassRefPtr<Structure> structure, const ArgList& list)
+ : JSObject(structure)
+{
+ unsigned initialCapacity = list.size();
+ unsigned initialStorage;
+
+ // If the ArgList is empty, allocate space for 3 entries. This value empirically
+ // works well for benchmarks.
+ if (!initialCapacity)
+ initialStorage = 3;
+ else
+ initialStorage = initialCapacity;
+
+ m_storage = static_cast<ArrayStorage*>(fastMalloc(storageSize(initialStorage)));
+ m_storage->m_allocBase = m_storage;
+ m_indexBias = 0;
+ m_storage->m_length = initialCapacity;
+ m_vectorLength = initialStorage;
+ m_storage->m_numValuesInVector = initialCapacity;
+ m_storage->m_sparseValueMap = 0;
+ m_storage->subclassData = 0;
+ m_storage->reportedMapCapacity = 0;
+#if CHECK_ARRAY_CONSISTENCY
+ m_storage->m_inCompactInitialization = false;
+#endif
+
+ size_t i = 0;
+ JSValue* vector = m_storage->m_vector;
+ ArgList::const_iterator end = list.end();
+ for (ArgList::const_iterator it = list.begin(); it != end; ++it, ++i)
+ vector[i] = *it;
+ for (; i < initialStorage; i++)
+ vector[i] = JSValue();
+
+ checkConsistency();
+
+ Heap::heap(this)->reportExtraMemoryCost(storageSize(initialStorage));
+}
+
+JSArray::~JSArray()
+{
+ ASSERT(vptr() == JSGlobalData::jsArrayVPtr);
+ checkConsistency(DestructorConsistencyCheck);
+
+ delete m_storage->m_sparseValueMap;
+ fastFree(m_storage->m_allocBase);
+}
+
+bool JSArray::getOwnPropertySlot(ExecState* exec, unsigned i, PropertySlot& slot)
+{
+ ArrayStorage* storage = m_storage;
+
+ if (i >= storage->m_length) {
+ if (i > MAX_ARRAY_INDEX)
+ return getOwnPropertySlot(exec, Identifier::from(exec, i), slot);
+ return false;
+ }
+
+ if (i < m_vectorLength) {
+ JSValue& valueSlot = storage->m_vector[i];
+ if (valueSlot) {
+ slot.setValueSlot(&valueSlot);
+ return true;
+ }
+ } else if (SparseArrayValueMap* map = storage->m_sparseValueMap) {
+ if (i >= MIN_SPARSE_ARRAY_INDEX) {
+ SparseArrayValueMap::iterator it = map->find(i);
+ if (it != map->end()) {
+ slot.setValueSlot(&it->second);
+ return true;
+ }
+ }
+ }
+
+ return JSObject::getOwnPropertySlot(exec, Identifier::from(exec, i), slot);
+}
+
+bool JSArray::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
+{
+ if (propertyName == exec->propertyNames().length) {
+ slot.setValue(jsNumber(length()));
+ return true;
+ }
+
+ bool isArrayIndex;
+ unsigned i = propertyName.toArrayIndex(isArrayIndex);
+ if (isArrayIndex)
+ return JSArray::getOwnPropertySlot(exec, i, slot);
+
+ return JSObject::getOwnPropertySlot(exec, propertyName, slot);
+}
+
+bool JSArray::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
+{
+ if (propertyName == exec->propertyNames().length) {
+ descriptor.setDescriptor(jsNumber(length()), DontDelete | DontEnum);
+ return true;
+ }
+
+ ArrayStorage* storage = m_storage;
+
+ bool isArrayIndex;
+ unsigned i = propertyName.toArrayIndex(isArrayIndex);
+ if (isArrayIndex) {
+ if (i >= storage->m_length)
+ return false;
+ if (i < m_vectorLength) {
+ JSValue& value = storage->m_vector[i];
+ if (value) {
+ descriptor.setDescriptor(value, 0);
+ return true;
+ }
+ } else if (SparseArrayValueMap* map = storage->m_sparseValueMap) {
+ if (i >= MIN_SPARSE_ARRAY_INDEX) {
+ SparseArrayValueMap::iterator it = map->find(i);
+ if (it != map->end()) {
+ descriptor.setDescriptor(it->second, 0);
+ return true;
+ }
+ }
+ }
+ }
+ return JSObject::getOwnPropertyDescriptor(exec, propertyName, descriptor);
+}
+
+// ECMA 15.4.5.1
+void JSArray::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
+{
+ bool isArrayIndex;
+ unsigned i = propertyName.toArrayIndex(isArrayIndex);
+ if (isArrayIndex) {
+ put(exec, i, value);
+ return;
+ }
+
+ if (propertyName == exec->propertyNames().length) {
+ unsigned newLength = value.toUInt32(exec);
+ if (value.toNumber(exec) != static_cast<double>(newLength)) {
+ throwError(exec, createRangeError(exec, "Invalid array length."));
+ return;
+ }
+ setLength(newLength);
+ return;
+ }
+
+ JSObject::put(exec, propertyName, value, slot);
+}
+
+void JSArray::put(ExecState* exec, unsigned i, JSValue value)
+{
+ checkConsistency();
+
+ ArrayStorage* storage = m_storage;
+
+ unsigned length = storage->m_length;
+ if (i >= length && i <= MAX_ARRAY_INDEX) {
+ length = i + 1;
+ storage->m_length = length;
+ }
+
+ if (i < m_vectorLength) {
+ JSValue& valueSlot = storage->m_vector[i];
+ if (valueSlot) {
+ valueSlot = value;
+ checkConsistency();
+ return;
+ }
+ valueSlot = value;
+ ++storage->m_numValuesInVector;
+ checkConsistency();
+ return;
+ }
+
+ putSlowCase(exec, i, value);
+}
+
+NEVER_INLINE void JSArray::putSlowCase(ExecState* exec, unsigned i, JSValue value)
+{
+ ArrayStorage* storage = m_storage;
+
+ SparseArrayValueMap* map = storage->m_sparseValueMap;
+
+ if (i >= MIN_SPARSE_ARRAY_INDEX) {
+ if (i > MAX_ARRAY_INDEX) {
+ PutPropertySlot slot;
+ put(exec, Identifier::from(exec, i), value, slot);
+ return;
+ }
+
+ // We miss some cases where we could compact the storage, such as a large array that is being filled from the end
+ // (which will only be compacted as we reach indices that are less than MIN_SPARSE_ARRAY_INDEX) - but this makes the check much faster.
+ if ((i > MAX_STORAGE_VECTOR_INDEX) || !isDenseEnoughForVector(i + 1, storage->m_numValuesInVector + 1)) {
+ if (!map) {
+ map = new SparseArrayValueMap;
+ storage->m_sparseValueMap = map;
+ }
+
+ pair<SparseArrayValueMap::iterator, bool> result = map->add(i, value);
+ if (!result.second) { // pre-existing entry
+ result.first->second = value;
+ return;
+ }
+
+ size_t capacity = map->capacity();
+ if (capacity != storage->reportedMapCapacity) {
+ Heap::heap(this)->reportExtraMemoryCost((capacity - storage->reportedMapCapacity) * (sizeof(unsigned) + sizeof(JSValue)));
+ storage->reportedMapCapacity = capacity;
+ }
+ return;
+ }
+ }
+
+ // We have decided that we'll put the new item into the vector.
+ // Fast case is when there is no sparse map, so we can increase the vector size without moving values from it.
+ if (!map || map->isEmpty()) {
+ if (increaseVectorLength(i + 1)) {
+ storage = m_storage;
+ storage->m_vector[i] = value;
+ ++storage->m_numValuesInVector;
+ checkConsistency();
+ } else
+ throwOutOfMemoryError(exec);
+ return;
+ }
+
+ // Decide how many values it would be best to move from the map.
+ unsigned newNumValuesInVector = storage->m_numValuesInVector + 1;
+ unsigned newVectorLength = getNewVectorLength(i + 1);
+ for (unsigned j = max(m_vectorLength, MIN_SPARSE_ARRAY_INDEX); j < newVectorLength; ++j)
+ newNumValuesInVector += map->contains(j);
+ if (i >= MIN_SPARSE_ARRAY_INDEX)
+ newNumValuesInVector -= map->contains(i);
+ if (isDenseEnoughForVector(newVectorLength, newNumValuesInVector)) {
+ unsigned needLength = max(i + 1, storage->m_length);
+ unsigned proposedNewNumValuesInVector = newNumValuesInVector;
+ // If newVectorLength is already the maximum - MAX_STORAGE_VECTOR_LENGTH - then do not attempt to grow any further.
+ while ((newVectorLength < needLength) && (newVectorLength < MAX_STORAGE_VECTOR_LENGTH)) {
+ unsigned proposedNewVectorLength = getNewVectorLength(newVectorLength + 1);
+ for (unsigned j = max(newVectorLength, MIN_SPARSE_ARRAY_INDEX); j < proposedNewVectorLength; ++j)
+ proposedNewNumValuesInVector += map->contains(j);
+ if (!isDenseEnoughForVector(proposedNewVectorLength, proposedNewNumValuesInVector))
+ break;
+ newVectorLength = proposedNewVectorLength;
+ newNumValuesInVector = proposedNewNumValuesInVector;
+ }
+ }
+
+ void* baseStorage = storage->m_allocBase;
+
+ if (!tryFastRealloc(baseStorage, storageSize(newVectorLength + m_indexBias)).getValue(baseStorage)) {
+ throwOutOfMemoryError(exec);
+ return;
+ }
+
+ m_storage = reinterpret_cast_ptr<ArrayStorage*>(static_cast<char*>(baseStorage) + m_indexBias * sizeof(JSValue));
+ m_storage->m_allocBase = baseStorage;
+ storage = m_storage;
+
+ unsigned vectorLength = m_vectorLength;
+ JSValue* vector = storage->m_vector;
+
+ if (newNumValuesInVector == storage->m_numValuesInVector + 1) {
+ for (unsigned j = vectorLength; j < newVectorLength; ++j)
+ vector[j] = JSValue();
+ if (i > MIN_SPARSE_ARRAY_INDEX)
+ map->remove(i);
+ } else {
+ for (unsigned j = vectorLength; j < max(vectorLength, MIN_SPARSE_ARRAY_INDEX); ++j)
+ vector[j] = JSValue();
+ for (unsigned j = max(vectorLength, MIN_SPARSE_ARRAY_INDEX); j < newVectorLength; ++j)
+ vector[j] = map->take(j);
+ }
+
+ ASSERT(i < newVectorLength);
+
+ m_vectorLength = newVectorLength;
+ storage->m_numValuesInVector = newNumValuesInVector;
+
+ storage->m_vector[i] = value;
+
+ checkConsistency();
+
+ Heap::heap(this)->reportExtraMemoryCost(storageSize(newVectorLength) - storageSize(vectorLength));
+}
+
+bool JSArray::deleteProperty(ExecState* exec, const Identifier& propertyName)
+{
+ bool isArrayIndex;
+ unsigned i = propertyName.toArrayIndex(isArrayIndex);
+ if (isArrayIndex)
+ return deleteProperty(exec, i);
+
+ if (propertyName == exec->propertyNames().length)
+ return false;
+
+ return JSObject::deleteProperty(exec, propertyName);
+}
+
+bool JSArray::deleteProperty(ExecState* exec, unsigned i)
+{
+ checkConsistency();
+
+ ArrayStorage* storage = m_storage;
+
+ if (i < m_vectorLength) {
+ JSValue& valueSlot = storage->m_vector[i];
+ if (!valueSlot) {
+ checkConsistency();
+ return false;
+ }
+ valueSlot = JSValue();
+ --storage->m_numValuesInVector;
+ checkConsistency();
+ return true;
+ }
+
+ if (SparseArrayValueMap* map = storage->m_sparseValueMap) {
+ if (i >= MIN_SPARSE_ARRAY_INDEX) {
+ SparseArrayValueMap::iterator it = map->find(i);
+ if (it != map->end()) {
+ map->remove(it);
+ checkConsistency();
+ return true;
+ }
+ }
+ }
+
+ checkConsistency();
+
+ if (i > MAX_ARRAY_INDEX)
+ return deleteProperty(exec, Identifier::from(exec, i));
+
+ return false;
+}
+
+void JSArray::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
+{
+ // FIXME: Filling PropertyNameArray with an identifier for every integer
+ // is incredibly inefficient for large arrays. We need a different approach,
+ // which almost certainly means a different structure for PropertyNameArray.
+
+ ArrayStorage* storage = m_storage;
+
+ unsigned usedVectorLength = min(storage->m_length, m_vectorLength);
+ for (unsigned i = 0; i < usedVectorLength; ++i) {
+ if (storage->m_vector[i])
+ propertyNames.add(Identifier::from(exec, i));
+ }
+
+ if (SparseArrayValueMap* map = storage->m_sparseValueMap) {
+ SparseArrayValueMap::iterator end = map->end();
+ for (SparseArrayValueMap::iterator it = map->begin(); it != end; ++it)
+ propertyNames.add(Identifier::from(exec, it->first));
+ }
+
+ if (mode == IncludeDontEnumProperties)
+ propertyNames.add(exec->propertyNames().length);
+
+ JSObject::getOwnPropertyNames(exec, propertyNames, mode);
+}
+
+ALWAYS_INLINE unsigned JSArray::getNewVectorLength(unsigned desiredLength)
+{
+ ASSERT(desiredLength <= MAX_STORAGE_VECTOR_LENGTH);
+
+ unsigned increasedLength;
+ unsigned maxInitLength = min(m_storage->m_length, 100000U);
+
+ if (desiredLength < maxInitLength)
+ increasedLength = maxInitLength;
+ else if (!m_vectorLength)
+ increasedLength = max(desiredLength, lastArraySize);
+ else {
+ // Mathematically equivalent to:
+ // increasedLength = (newLength * 3 + 1) / 2;
+ // or:
+ // increasedLength = (unsigned)ceil(newLength * 1.5));
+ // This form is not prone to internal overflow.
+ increasedLength = desiredLength + (desiredLength >> 1) + (desiredLength & 1);
+ }
+
+ ASSERT(increasedLength >= desiredLength);
+
+ lastArraySize = min(increasedLength, FIRST_VECTOR_GROW);
+
+ return min(increasedLength, MAX_STORAGE_VECTOR_LENGTH);
+}
+
+bool JSArray::increaseVectorLength(unsigned newLength)
+{
+ // This function leaves the array in an internally inconsistent state, because it does not move any values from sparse value map
+ // to the vector. Callers have to account for that, because they can do it more efficiently.
+
+ ArrayStorage* storage = m_storage;
+
+ unsigned vectorLength = m_vectorLength;
+ ASSERT(newLength > vectorLength);
+ ASSERT(newLength <= MAX_STORAGE_VECTOR_INDEX);
+ unsigned newVectorLength = getNewVectorLength(newLength);
+ void* baseStorage = storage->m_allocBase;
+
+ if (!tryFastRealloc(baseStorage, storageSize(newVectorLength + m_indexBias)).getValue(baseStorage))
+ return false;
+
+ storage = m_storage = reinterpret_cast_ptr<ArrayStorage*>(static_cast<char*>(baseStorage) + m_indexBias * sizeof(JSValue));
+ m_storage->m_allocBase = baseStorage;
+
+ JSValue* vector = storage->m_vector;
+ for (unsigned i = vectorLength; i < newVectorLength; ++i)
+ vector[i] = JSValue();
+
+ m_vectorLength = newVectorLength;
+
+ Heap::heap(this)->reportExtraMemoryCost(storageSize(newVectorLength) - storageSize(vectorLength));
+
+ return true;
+}
+
+bool JSArray::increaseVectorPrefixLength(unsigned newLength)
+{
+ // This function leaves the array in an internally inconsistent state, because it does not move any values from sparse value map
+ // to the vector. Callers have to account for that, because they can do it more efficiently.
+
+ ArrayStorage* storage = m_storage;
+
+ unsigned vectorLength = m_vectorLength;
+ ASSERT(newLength > vectorLength);
+ ASSERT(newLength <= MAX_STORAGE_VECTOR_INDEX);
+ unsigned newVectorLength = getNewVectorLength(newLength);
+
+ void* newBaseStorage = fastMalloc(storageSize(newVectorLength + m_indexBias));
+ if (!newBaseStorage)
+ return false;
+
+ m_indexBias += newVectorLength - newLength;
+
+ m_storage = reinterpret_cast_ptr<ArrayStorage*>(static_cast<char*>(newBaseStorage) + m_indexBias * sizeof(JSValue));
+
+ memcpy(m_storage, storage, storageSize(0));
+ memcpy(&m_storage->m_vector[newLength - m_vectorLength], &storage->m_vector[0], vectorLength * sizeof(JSValue));
+
+ m_storage->m_allocBase = newBaseStorage;
+ m_vectorLength = newLength;
+
+ fastFree(storage->m_allocBase);
+
+ Heap::heap(this)->reportExtraMemoryCost(storageSize(newVectorLength) - storageSize(vectorLength));
+
+ return true;
+}
+
+
+void JSArray::setLength(unsigned newLength)
+{
+ ArrayStorage* storage = m_storage;
+
+#if CHECK_ARRAY_CONSISTENCY
+ if (!storage->m_inCompactInitialization)
+ checkConsistency();
+ else
+ storage->m_inCompactInitialization = false;
+#endif
+
+ unsigned length = storage->m_length;
+
+ if (newLength < length) {
+ unsigned usedVectorLength = min(length, m_vectorLength);
+ for (unsigned i = newLength; i < usedVectorLength; ++i) {
+ JSValue& valueSlot = storage->m_vector[i];
+ bool hadValue = valueSlot;
+ valueSlot = JSValue();
+ storage->m_numValuesInVector -= hadValue;
+ }
+
+ if (SparseArrayValueMap* map = storage->m_sparseValueMap) {
+ SparseArrayValueMap copy = *map;
+ SparseArrayValueMap::iterator end = copy.end();
+ for (SparseArrayValueMap::iterator it = copy.begin(); it != end; ++it) {
+ if (it->first >= newLength)
+ map->remove(it->first);
+ }
+ if (map->isEmpty()) {
+ delete map;
+ storage->m_sparseValueMap = 0;
+ }
+ }
+ }
+
+ storage->m_length = newLength;
+
+ checkConsistency();
+}
+
+JSValue JSArray::pop()
+{
+ checkConsistency();
+
+ ArrayStorage* storage = m_storage;
+
+ unsigned length = storage->m_length;
+ if (!length)
+ return jsUndefined();
+
+ --length;
+
+ JSValue result;
+
+ if (length < m_vectorLength) {
+ JSValue& valueSlot = storage->m_vector[length];
+ if (valueSlot) {
+ --storage->m_numValuesInVector;
+ result = valueSlot;
+ valueSlot = JSValue();
+ } else
+ result = jsUndefined();
+ } else {
+ result = jsUndefined();
+ if (SparseArrayValueMap* map = storage->m_sparseValueMap) {
+ SparseArrayValueMap::iterator it = map->find(length);
+ if (it != map->end()) {
+ result = it->second;
+ map->remove(it);
+ if (map->isEmpty()) {
+ delete map;
+ storage->m_sparseValueMap = 0;
+ }
+ }
+ }
+ }
+
+ storage->m_length = length;
+
+ checkConsistency();
+
+ return result;
+}
+
+void JSArray::push(ExecState* exec, JSValue value)
+{
+ checkConsistency();
+
+ ArrayStorage* storage = m_storage;
+
+ if (storage->m_length < m_vectorLength) {
+ storage->m_vector[storage->m_length] = value;
+ ++storage->m_numValuesInVector;
+ ++storage->m_length;
+ checkConsistency();
+ return;
+ }
+
+ if (storage->m_length < MIN_SPARSE_ARRAY_INDEX) {
+ SparseArrayValueMap* map = storage->m_sparseValueMap;
+ if (!map || map->isEmpty()) {
+ if (increaseVectorLength(storage->m_length + 1)) {
+ storage = m_storage;
+ storage->m_vector[storage->m_length] = value;
+ ++storage->m_numValuesInVector;
+ ++storage->m_length;
+ checkConsistency();
+ return;
+ }
+ checkConsistency();
+ throwOutOfMemoryError(exec);
+ return;
+ }
+ }
+
+ putSlowCase(exec, storage->m_length++, value);
+}
+
+void JSArray::shiftCount(ExecState* exec, int count)
+{
+ ASSERT(count > 0);
+
+ ArrayStorage* storage = m_storage;
+
+ unsigned oldLength = storage->m_length;
+
+ if (!oldLength)
+ return;
+
+ if (oldLength != storage->m_numValuesInVector) {
+ // If m_length and m_numValuesInVector aren't the same, we have a sparse vector
+ // which means we need to go through each entry looking for the the "empty"
+ // slots and then fill them with possible properties. See ECMA spec.
+ // 15.4.4.9 steps 11 through 13.
+ for (unsigned i = count; i < oldLength; ++i) {
+ if ((i >= m_vectorLength) || (!m_storage->m_vector[i])) {
+ PropertySlot slot(this);
+ JSValue p = prototype();
+ if ((!p.isNull()) && (asObject(p)->getPropertySlot(exec, i, slot)))
+ put(exec, i, slot.getValue(exec, i));
+ }
+ }
+
+ storage = m_storage; // The put() above could have grown the vector and realloc'ed storage.
+
+ // Need to decrement numValuesInvector based on number of real entries
+ for (unsigned i = 0; i < (unsigned)count; ++i)
+ if ((i < m_vectorLength) && (storage->m_vector[i]))
+ --storage->m_numValuesInVector;
+ } else
+ storage->m_numValuesInVector -= count;
+
+ storage->m_length -= count;
+
+ if (m_vectorLength) {
+ count = min(m_vectorLength, (unsigned)count);
+
+ m_vectorLength -= count;
+
+ if (m_vectorLength) {
+ char* newBaseStorage = reinterpret_cast<char*>(storage) + count * sizeof(JSValue);
+ memmove(newBaseStorage, storage, storageSize(0));
+ m_storage = reinterpret_cast_ptr<ArrayStorage*>(newBaseStorage);
+
+ m_indexBias += count;
+ }
+ }
+}
+
+void JSArray::unshiftCount(ExecState* exec, int count)
+{
+ ArrayStorage* storage = m_storage;
+
+ ASSERT(m_indexBias >= 0);
+ ASSERT(count >= 0);
+
+ unsigned length = storage->m_length;
+
+ if (length != storage->m_numValuesInVector) {
+ // If m_length and m_numValuesInVector aren't the same, we have a sparse vector
+ // which means we need to go through each entry looking for the the "empty"
+ // slots and then fill them with possible properties. See ECMA spec.
+ // 15.4.4.13 steps 8 through 10.
+ for (unsigned i = 0; i < length; ++i) {
+ if ((i >= m_vectorLength) || (!m_storage->m_vector[i])) {
+ PropertySlot slot(this);
+ JSValue p = prototype();
+ if ((!p.isNull()) && (asObject(p)->getPropertySlot(exec, i, slot)))
+ put(exec, i, slot.getValue(exec, i));
+ }
+ }
+ }
+
+ storage = m_storage; // The put() above could have grown the vector and realloc'ed storage.
+
+ if (m_indexBias >= count) {
+ m_indexBias -= count;
+ char* newBaseStorage = reinterpret_cast<char*>(storage) - count * sizeof(JSValue);
+ memmove(newBaseStorage, storage, storageSize(0));
+ m_storage = reinterpret_cast_ptr<ArrayStorage*>(newBaseStorage);
+ m_vectorLength += count;
+ } else if (!increaseVectorPrefixLength(m_vectorLength + count)) {
+ throwOutOfMemoryError(exec);
+ return;
+ }
+
+ JSValue* vector = m_storage->m_vector;
+ for (int i = 0; i < count; i++)
+ vector[i] = JSValue();
+}
+
+void JSArray::markChildren(MarkStack& markStack)
+{
+ markChildrenDirect(markStack);
+}
+
+static int compareNumbersForQSort(const void* a, const void* b)
+{
+ double da = static_cast<const JSValue*>(a)->uncheckedGetNumber();
+ double db = static_cast<const JSValue*>(b)->uncheckedGetNumber();
+ return (da > db) - (da < db);
+}
+
+static int compareByStringPairForQSort(const void* a, const void* b)
+{
+ const ValueStringPair* va = static_cast<const ValueStringPair*>(a);
+ const ValueStringPair* vb = static_cast<const ValueStringPair*>(b);
+ return codePointCompare(va->second, vb->second);
+}
+
+void JSArray::sortNumeric(ExecState* exec, JSValue compareFunction, CallType callType, const CallData& callData)
+{
+ ArrayStorage* storage = m_storage;
+
+ unsigned lengthNotIncludingUndefined = compactForSorting();
+ if (storage->m_sparseValueMap) {
+ throwOutOfMemoryError(exec);
+ return;
+ }
+
+ if (!lengthNotIncludingUndefined)
+ return;
+
+ bool allValuesAreNumbers = true;
+ size_t size = storage->m_numValuesInVector;
+ for (size_t i = 0; i < size; ++i) {
+ if (!storage->m_vector[i].isNumber()) {
+ allValuesAreNumbers = false;
+ break;
+ }
+ }
+
+ if (!allValuesAreNumbers)
+ return sort(exec, compareFunction, callType, callData);
+
+ // For numeric comparison, which is fast, qsort is faster than mergesort. We
+ // also don't require mergesort's stability, since there's no user visible
+ // side-effect from swapping the order of equal primitive values.
+ qsort(storage->m_vector, size, sizeof(JSValue), compareNumbersForQSort);
+
+ checkConsistency(SortConsistencyCheck);
+}
+
+void JSArray::sort(ExecState* exec)
+{
+ ArrayStorage* storage = m_storage;
+
+ unsigned lengthNotIncludingUndefined = compactForSorting();
+ if (storage->m_sparseValueMap) {
+ throwOutOfMemoryError(exec);
+ return;
+ }
+
+ if (!lengthNotIncludingUndefined)
+ return;
+
+ // Converting JavaScript values to strings can be expensive, so we do it once up front and sort based on that.
+ // This is a considerable improvement over doing it twice per comparison, though it requires a large temporary
+ // buffer. Besides, this protects us from crashing if some objects have custom toString methods that return
+ // random or otherwise changing results, effectively making compare function inconsistent.
+
+ Vector<ValueStringPair> values(lengthNotIncludingUndefined);
+ if (!values.begin()) {
+ throwOutOfMemoryError(exec);
+ return;
+ }
+
+ Heap::heap(this)->pushTempSortVector(&values);
+
+ for (size_t i = 0; i < lengthNotIncludingUndefined; i++) {
+ JSValue value = storage->m_vector[i];
+ ASSERT(!value.isUndefined());
+ values[i].first = value;
+ }
+
+ // FIXME: The following loop continues to call toString on subsequent values even after
+ // a toString call raises an exception.
+
+ for (size_t i = 0; i < lengthNotIncludingUndefined; i++)
+ values[i].second = values[i].first.toString(exec);
+
+ if (exec->hadException())
+ return;
+
+ // FIXME: Since we sort by string value, a fast algorithm might be to use a radix sort. That would be O(N) rather
+ // than O(N log N).
+
+#if HAVE(MERGESORT)
+ mergesort(values.begin(), values.size(), sizeof(ValueStringPair), compareByStringPairForQSort);
+#else
+ // FIXME: The qsort library function is likely to not be a stable sort.
+ // ECMAScript-262 does not specify a stable sort, but in practice, browsers perform a stable sort.
+ qsort(values.begin(), values.size(), sizeof(ValueStringPair), compareByStringPairForQSort);
+#endif
+
+ // If the toString function changed the length of the array or vector storage,
+ // increase the length to handle the orignal number of actual values.
+ if (m_vectorLength < lengthNotIncludingUndefined)
+ increaseVectorLength(lengthNotIncludingUndefined);
+ if (storage->m_length < lengthNotIncludingUndefined)
+ storage->m_length = lengthNotIncludingUndefined;
+
+ for (size_t i = 0; i < lengthNotIncludingUndefined; i++)
+ storage->m_vector[i] = values[i].first;
+
+ Heap::heap(this)->popTempSortVector(&values);
+
+ checkConsistency(SortConsistencyCheck);
+}
+
+struct AVLTreeNodeForArrayCompare {
+ JSValue value;
+
+ // Child pointers. The high bit of gt is robbed and used as the
+ // balance factor sign. The high bit of lt is robbed and used as
+ // the magnitude of the balance factor.
+ int32_t gt;
+ int32_t lt;
+};
+
+struct AVLTreeAbstractorForArrayCompare {
+ typedef int32_t handle; // Handle is an index into m_nodes vector.
+ typedef JSValue key;
+ typedef int32_t size;
+
+ Vector<AVLTreeNodeForArrayCompare> m_nodes;
+ ExecState* m_exec;
+ JSValue m_compareFunction;
+ CallType m_compareCallType;
+ const CallData* m_compareCallData;
+ JSValue m_globalThisValue;
+ OwnPtr<CachedCall> m_cachedCall;
+
+ handle get_less(handle h) { return m_nodes[h].lt & 0x7FFFFFFF; }
+ void set_less(handle h, handle lh) { m_nodes[h].lt &= 0x80000000; m_nodes[h].lt |= lh; }
+ handle get_greater(handle h) { return m_nodes[h].gt & 0x7FFFFFFF; }
+ void set_greater(handle h, handle gh) { m_nodes[h].gt &= 0x80000000; m_nodes[h].gt |= gh; }
+
+ int get_balance_factor(handle h)
+ {
+ if (m_nodes[h].gt & 0x80000000)
+ return -1;
+ return static_cast<unsigned>(m_nodes[h].lt) >> 31;
+ }
+
+ void set_balance_factor(handle h, int bf)
+ {
+ if (bf == 0) {
+ m_nodes[h].lt &= 0x7FFFFFFF;
+ m_nodes[h].gt &= 0x7FFFFFFF;
+ } else {
+ m_nodes[h].lt |= 0x80000000;
+ if (bf < 0)
+ m_nodes[h].gt |= 0x80000000;
+ else
+ m_nodes[h].gt &= 0x7FFFFFFF;
+ }
+ }
+
+ int compare_key_key(key va, key vb)
+ {
+ ASSERT(!va.isUndefined());
+ ASSERT(!vb.isUndefined());
+
+ if (m_exec->hadException())
+ return 1;
+
+ double compareResult;
+ if (m_cachedCall) {
+ m_cachedCall->setThis(m_globalThisValue);
+ m_cachedCall->setArgument(0, va);
+ m_cachedCall->setArgument(1, vb);
+ compareResult = m_cachedCall->call().toNumber(m_cachedCall->newCallFrame(m_exec));
+ } else {
+ MarkedArgumentBuffer arguments;
+ arguments.append(va);
+ arguments.append(vb);
+ compareResult = call(m_exec, m_compareFunction, m_compareCallType, *m_compareCallData, m_globalThisValue, arguments).toNumber(m_exec);
+ }
+ return (compareResult < 0) ? -1 : 1; // Not passing equality through, because we need to store all values, even if equivalent.
+ }
+
+ int compare_key_node(key k, handle h) { return compare_key_key(k, m_nodes[h].value); }
+ int compare_node_node(handle h1, handle h2) { return compare_key_key(m_nodes[h1].value, m_nodes[h2].value); }
+
+ static handle null() { return 0x7FFFFFFF; }
+};
+
+void JSArray::sort(ExecState* exec, JSValue compareFunction, CallType callType, const CallData& callData)
+{
+ checkConsistency();
+
+ ArrayStorage* storage = m_storage;
+
+ // FIXME: This ignores exceptions raised in the compare function or in toNumber.
+
+ // The maximum tree depth is compiled in - but the caller is clearly up to no good
+ // if a larger array is passed.
+ ASSERT(storage->m_length <= static_cast<unsigned>(std::numeric_limits<int>::max()));
+ if (storage->m_length > static_cast<unsigned>(std::numeric_limits<int>::max()))
+ return;
+
+ unsigned usedVectorLength = min(storage->m_length, m_vectorLength);
+ unsigned nodeCount = usedVectorLength + (storage->m_sparseValueMap ? storage->m_sparseValueMap->size() : 0);
+
+ if (!nodeCount)
+ return;
+
+ AVLTree<AVLTreeAbstractorForArrayCompare, 44> tree; // Depth 44 is enough for 2^31 items
+ tree.abstractor().m_exec = exec;
+ tree.abstractor().m_compareFunction = compareFunction;
+ tree.abstractor().m_compareCallType = callType;
+ tree.abstractor().m_compareCallData = &callData;
+ tree.abstractor().m_globalThisValue = exec->globalThisValue();
+ tree.abstractor().m_nodes.grow(nodeCount);
+
+ if (callType == CallTypeJS)
+ tree.abstractor().m_cachedCall = adoptPtr(new CachedCall(exec, asFunction(compareFunction), 2));
+
+ if (!tree.abstractor().m_nodes.begin()) {
+ throwOutOfMemoryError(exec);
+ return;
+ }
+
+ // FIXME: If the compare function modifies the array, the vector, map, etc. could be modified
+ // right out from under us while we're building the tree here.
+
+ unsigned numDefined = 0;
+ unsigned numUndefined = 0;
+
+ // Iterate over the array, ignoring missing values, counting undefined ones, and inserting all other ones into the tree.
+ for (; numDefined < usedVectorLength; ++numDefined) {
+ JSValue v = storage->m_vector[numDefined];
+ if (!v || v.isUndefined())
+ break;
+ tree.abstractor().m_nodes[numDefined].value = v;
+ tree.insert(numDefined);
+ }
+ for (unsigned i = numDefined; i < usedVectorLength; ++i) {
+ JSValue v = storage->m_vector[i];
+ if (v) {
+ if (v.isUndefined())
+ ++numUndefined;
+ else {
+ tree.abstractor().m_nodes[numDefined].value = v;
+ tree.insert(numDefined);
+ ++numDefined;
+ }
+ }
+ }
+
+ unsigned newUsedVectorLength = numDefined + numUndefined;
+
+ if (SparseArrayValueMap* map = storage->m_sparseValueMap) {
+ newUsedVectorLength += map->size();
+ if (newUsedVectorLength > m_vectorLength) {
+ // Check that it is possible to allocate an array large enough to hold all the entries.
+ if ((newUsedVectorLength > MAX_STORAGE_VECTOR_LENGTH) || !increaseVectorLength(newUsedVectorLength)) {
+ throwOutOfMemoryError(exec);
+ return;
+ }
+ }
+
+ storage = m_storage;
+
+ SparseArrayValueMap::iterator end = map->end();
+ for (SparseArrayValueMap::iterator it = map->begin(); it != end; ++it) {
+ tree.abstractor().m_nodes[numDefined].value = it->second;
+ tree.insert(numDefined);
+ ++numDefined;
+ }
+
+ delete map;
+ storage->m_sparseValueMap = 0;
+ }
+
+ ASSERT(tree.abstractor().m_nodes.size() >= numDefined);
+
+ // FIXME: If the compare function changed the length of the array, the following might be
+ // modifying the vector incorrectly.
+
+ // Copy the values back into m_storage.
+ AVLTree<AVLTreeAbstractorForArrayCompare, 44>::Iterator iter;
+ iter.start_iter_least(tree);
+ for (unsigned i = 0; i < numDefined; ++i) {
+ storage->m_vector[i] = tree.abstractor().m_nodes[*iter].value;
+ ++iter;
+ }
+
+ // Put undefined values back in.
+ for (unsigned i = numDefined; i < newUsedVectorLength; ++i)
+ storage->m_vector[i] = jsUndefined();
+
+ // Ensure that unused values in the vector are zeroed out.
+ for (unsigned i = newUsedVectorLength; i < usedVectorLength; ++i)
+ storage->m_vector[i] = JSValue();
+
+ storage->m_numValuesInVector = newUsedVectorLength;
+
+ checkConsistency(SortConsistencyCheck);
+}
+
+void JSArray::fillArgList(ExecState* exec, MarkedArgumentBuffer& args)
+{
+ ArrayStorage* storage = m_storage;
+
+ JSValue* vector = storage->m_vector;
+ unsigned vectorEnd = min(storage->m_length, m_vectorLength);
+ unsigned i = 0;
+ for (; i < vectorEnd; ++i) {
+ JSValue& v = vector[i];
+ if (!v)
+ break;
+ args.append(v);
+ }
+
+ for (; i < storage->m_length; ++i)
+ args.append(get(exec, i));
+}
+
+void JSArray::copyToRegisters(ExecState* exec, Register* buffer, uint32_t maxSize)
+{
+ ASSERT(m_storage->m_length >= maxSize);
+ UNUSED_PARAM(maxSize);
+ JSValue* vector = m_storage->m_vector;
+ unsigned vectorEnd = min(maxSize, m_vectorLength);
+ unsigned i = 0;
+ for (; i < vectorEnd; ++i) {
+ JSValue& v = vector[i];
+ if (!v)
+ break;
+ buffer[i] = v;
+ }
+
+ for (; i < maxSize; ++i)
+ buffer[i] = get(exec, i);
+}
+
+unsigned JSArray::compactForSorting()
+{
+ checkConsistency();
+
+ ArrayStorage* storage = m_storage;
+
+ unsigned usedVectorLength = min(storage->m_length, m_vectorLength);
+
+ unsigned numDefined = 0;
+ unsigned numUndefined = 0;
+
+ for (; numDefined < usedVectorLength; ++numDefined) {
+ JSValue v = storage->m_vector[numDefined];
+ if (!v || v.isUndefined())
+ break;
+ }
+ for (unsigned i = numDefined; i < usedVectorLength; ++i) {
+ JSValue v = storage->m_vector[i];
+ if (v) {
+ if (v.isUndefined())
+ ++numUndefined;
+ else
+ storage->m_vector[numDefined++] = v;
+ }
+ }
+
+ unsigned newUsedVectorLength = numDefined + numUndefined;
+
+ if (SparseArrayValueMap* map = storage->m_sparseValueMap) {
+ newUsedVectorLength += map->size();
+ if (newUsedVectorLength > m_vectorLength) {
+ // Check that it is possible to allocate an array large enough to hold all the entries - if not,
+ // exception is thrown by caller.
+ if ((newUsedVectorLength > MAX_STORAGE_VECTOR_LENGTH) || !increaseVectorLength(newUsedVectorLength))
+ return 0;
+
+ storage = m_storage;
+ }
+
+ SparseArrayValueMap::iterator end = map->end();
+ for (SparseArrayValueMap::iterator it = map->begin(); it != end; ++it)
+ storage->m_vector[numDefined++] = it->second;
+
+ delete map;
+ storage->m_sparseValueMap = 0;
+ }
+
+ for (unsigned i = numDefined; i < newUsedVectorLength; ++i)
+ storage->m_vector[i] = jsUndefined();
+ for (unsigned i = newUsedVectorLength; i < usedVectorLength; ++i)
+ storage->m_vector[i] = JSValue();
+
+ storage->m_numValuesInVector = newUsedVectorLength;
+
+ checkConsistency(SortConsistencyCheck);
+
+ return numDefined;
+}
+
+void* JSArray::subclassData() const
+{
+ return m_storage->subclassData;
+}
+
+void JSArray::setSubclassData(void* d)
+{
+ m_storage->subclassData = d;
+}
+
+#if CHECK_ARRAY_CONSISTENCY
+
+void JSArray::checkConsistency(ConsistencyCheckType type)
+{
+ ArrayStorage* storage = m_storage;
+
+ ASSERT(storage);
+ if (type == SortConsistencyCheck)
+ ASSERT(!storage->m_sparseValueMap);
+
+ unsigned numValuesInVector = 0;
+ for (unsigned i = 0; i < m_vectorLength; ++i) {
+ if (JSValue value = storage->m_vector[i]) {
+ ASSERT(i < storage->m_length);
+ if (type != DestructorConsistencyCheck)
+ value.isUndefined(); // Likely to crash if the object was deallocated.
+ ++numValuesInVector;
+ } else {
+ if (type == SortConsistencyCheck)
+ ASSERT(i >= storage->m_numValuesInVector);
+ }
+ }
+ ASSERT(numValuesInVector == storage->m_numValuesInVector);
+ ASSERT(numValuesInVector <= storage->m_length);
+
+ if (storage->m_sparseValueMap) {
+ SparseArrayValueMap::iterator end = storage->m_sparseValueMap->end();
+ for (SparseArrayValueMap::iterator it = storage->m_sparseValueMap->begin(); it != end; ++it) {
+ unsigned index = it->first;
+ ASSERT(index < storage->m_length);
+ ASSERT(index >= storage->m_vectorLength);
+ ASSERT(index <= MAX_ARRAY_INDEX);
+ ASSERT(it->second);
+ if (type != DestructorConsistencyCheck)
+ it->second.isUndefined(); // Likely to crash if the object was deallocated.
+ }
+ }
+}
+
+#endif
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/JSArray.h b/Source/JavaScriptCore/runtime/JSArray.h
new file mode 100644
index 0000000..de28b65
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/JSArray.h
@@ -0,0 +1,284 @@
+/*
+ * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
+ * Copyright (C) 2003, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifndef JSArray_h
+#define JSArray_h
+
+#include "JSObject.h"
+
+#define CHECK_ARRAY_CONSISTENCY 0
+
+namespace JSC {
+
+ typedef HashMap<unsigned, JSValue> SparseArrayValueMap;
+
+ // This struct holds the actual data values of an array. A JSArray object points to it's contained ArrayStorage
+ // struct by pointing to m_vector. To access the contained ArrayStorage struct, use the getStorage() and
+ // setStorage() methods. It is important to note that there may be space before the ArrayStorage that
+ // is used to quick unshift / shift operation. The actual allocated pointer is available by using:
+ // getStorage() - m_indexBias * sizeof(JSValue)
+ struct ArrayStorage {
+ unsigned m_length; // The "length" property on the array
+ unsigned m_numValuesInVector;
+ SparseArrayValueMap* m_sparseValueMap;
+ void* subclassData; // A JSArray subclass can use this to fill the vector lazily.
+ void* m_allocBase; // Pointer to base address returned by malloc(). Keeping this pointer does eliminate false positives from the leak detector.
+ size_t reportedMapCapacity;
+#if CHECK_ARRAY_CONSISTENCY
+ bool m_inCompactInitialization;
+#endif
+ JSValue m_vector[1];
+ };
+
+ // The CreateCompact creation mode is used for fast construction of arrays
+ // whose size and contents are known at time of creation.
+ //
+ // There are two obligations when using this mode:
+ //
+ // - uncheckedSetIndex() must be used when initializing the array.
+ // - setLength() must be called after initialization.
+
+ enum ArrayCreationMode { CreateCompact, CreateInitialized };
+
+ class JSArray : public JSObject {
+ friend class JIT;
+ friend class Walker;
+
+ public:
+ enum VPtrStealingHackType { VPtrStealingHack };
+ JSArray(VPtrStealingHackType);
+
+ explicit JSArray(NonNullPassRefPtr<Structure>);
+ JSArray(NonNullPassRefPtr<Structure>, unsigned initialLength, ArrayCreationMode);
+ JSArray(NonNullPassRefPtr<Structure>, const ArgList& initialValues);
+ virtual ~JSArray();
+
+ virtual bool getOwnPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&);
+ virtual bool getOwnPropertySlot(ExecState*, unsigned propertyName, PropertySlot&);
+ virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
+ virtual void put(ExecState*, unsigned propertyName, JSValue); // FIXME: Make protected and add setItem.
+
+ static JS_EXPORTDATA const ClassInfo info;
+
+ unsigned length() const { return m_storage->m_length; }
+ void setLength(unsigned); // OK to use on new arrays, but not if it might be a RegExpMatchArray.
+
+ void sort(ExecState*);
+ void sort(ExecState*, JSValue compareFunction, CallType, const CallData&);
+ void sortNumeric(ExecState*, JSValue compareFunction, CallType, const CallData&);
+
+ void push(ExecState*, JSValue);
+ JSValue pop();
+
+ void shiftCount(ExecState*, int count);
+ void unshiftCount(ExecState*, int count);
+
+ bool canGetIndex(unsigned i) { return i < m_vectorLength && m_storage->m_vector[i]; }
+ JSValue getIndex(unsigned i)
+ {
+ ASSERT(canGetIndex(i));
+ return m_storage->m_vector[i];
+ }
+
+ bool canSetIndex(unsigned i) { return i < m_vectorLength; }
+ void setIndex(unsigned i, JSValue v)
+ {
+ ASSERT(canSetIndex(i));
+
+ JSValue& x = m_storage->m_vector[i];
+ if (!x) {
+ ArrayStorage *storage = m_storage;
+ ++storage->m_numValuesInVector;
+ if (i >= storage->m_length)
+ storage->m_length = i + 1;
+ }
+ x = v;
+ }
+
+ void uncheckedSetIndex(unsigned i, JSValue v)
+ {
+ ASSERT(canSetIndex(i));
+ ArrayStorage *storage = m_storage;
+#if CHECK_ARRAY_CONSISTENCY
+ ASSERT(storage->m_inCompactInitialization);
+#endif
+ storage->m_vector[i] = v;
+ }
+
+ void fillArgList(ExecState*, MarkedArgumentBuffer&);
+ void copyToRegisters(ExecState*, Register*, uint32_t);
+
+ static PassRefPtr<Structure> createStructure(JSValue prototype)
+ {
+ return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount);
+ }
+
+ inline void markChildrenDirect(MarkStack& markStack);
+
+ protected:
+ static const unsigned StructureFlags = OverridesGetOwnPropertySlot | OverridesMarkChildren | OverridesGetPropertyNames | JSObject::StructureFlags;
+ virtual void put(ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&);
+ virtual bool deleteProperty(ExecState*, const Identifier& propertyName);
+ virtual bool deleteProperty(ExecState*, unsigned propertyName);
+ virtual void getOwnPropertyNames(ExecState*, PropertyNameArray&, EnumerationMode mode = ExcludeDontEnumProperties);
+ virtual void markChildren(MarkStack&);
+
+ void* subclassData() const;
+ void setSubclassData(void*);
+
+ private:
+ virtual const ClassInfo* classInfo() const { return &info; }
+
+ bool getOwnPropertySlotSlowCase(ExecState*, unsigned propertyName, PropertySlot&);
+ void putSlowCase(ExecState*, unsigned propertyName, JSValue);
+
+ unsigned getNewVectorLength(unsigned desiredLength);
+ bool increaseVectorLength(unsigned newLength);
+ bool increaseVectorPrefixLength(unsigned newLength);
+
+ unsigned compactForSorting();
+
+ enum ConsistencyCheckType { NormalConsistencyCheck, DestructorConsistencyCheck, SortConsistencyCheck };
+ void checkConsistency(ConsistencyCheckType = NormalConsistencyCheck);
+
+ unsigned m_vectorLength; // The valid length of m_vector
+ int m_indexBias; // The number of JSValue sized blocks before ArrayStorage.
+ ArrayStorage *m_storage;
+ };
+
+ JSArray* asArray(JSValue);
+
+ inline JSArray* asArray(JSCell* cell)
+ {
+ ASSERT(cell->inherits(&JSArray::info));
+ return static_cast<JSArray*>(cell);
+ }
+
+ inline JSArray* asArray(JSValue value)
+ {
+ return asArray(value.asCell());
+ }
+
+ inline bool isJSArray(JSGlobalData* globalData, JSValue v)
+ {
+ return v.isCell() && v.asCell()->vptr() == globalData->jsArrayVPtr;
+ }
+ inline bool isJSArray(JSGlobalData* globalData, JSCell* cell) { return cell->vptr() == globalData->jsArrayVPtr; }
+
+ inline void JSArray::markChildrenDirect(MarkStack& markStack)
+ {
+ JSObject::markChildrenDirect(markStack);
+
+ ArrayStorage* storage = m_storage;
+
+ unsigned usedVectorLength = std::min(storage->m_length, m_vectorLength);
+ markStack.appendValues(storage->m_vector, usedVectorLength, MayContainNullValues);
+
+ if (SparseArrayValueMap* map = storage->m_sparseValueMap) {
+ SparseArrayValueMap::iterator end = map->end();
+ for (SparseArrayValueMap::iterator it = map->begin(); it != end; ++it)
+ markStack.append(it->second);
+ }
+ }
+
+ inline void MarkStack::markChildren(JSCell* cell)
+ {
+ ASSERT(Heap::isCellMarked(cell));
+ if (!cell->structure()->typeInfo().overridesMarkChildren()) {
+#ifdef NDEBUG
+ asObject(cell)->markChildrenDirect(*this);
+#else
+ ASSERT(!m_isCheckingForDefaultMarkViolation);
+ m_isCheckingForDefaultMarkViolation = true;
+ cell->markChildren(*this);
+ ASSERT(m_isCheckingForDefaultMarkViolation);
+ m_isCheckingForDefaultMarkViolation = false;
+#endif
+ return;
+ }
+ if (cell->vptr() == m_jsArrayVPtr) {
+ asArray(cell)->markChildrenDirect(*this);
+ return;
+ }
+ cell->markChildren(*this);
+ }
+
+ inline void MarkStack::drain()
+ {
+#if !ASSERT_DISABLED
+ ASSERT(!m_isDraining);
+ m_isDraining = true;
+#endif
+ while (!m_markSets.isEmpty() || !m_values.isEmpty()) {
+ while (!m_markSets.isEmpty() && m_values.size() < 50) {
+ ASSERT(!m_markSets.isEmpty());
+ MarkSet& current = m_markSets.last();
+ ASSERT(current.m_values);
+ JSValue* end = current.m_end;
+ ASSERT(current.m_values);
+ ASSERT(current.m_values != end);
+ findNextUnmarkedNullValue:
+ ASSERT(current.m_values != end);
+ JSValue value = *current.m_values;
+ current.m_values++;
+
+ JSCell* cell;
+ if (!value || !value.isCell() || Heap::checkMarkCell(cell = value.asCell())) {
+ if (current.m_values == end) {
+ m_markSets.removeLast();
+ continue;
+ }
+ goto findNextUnmarkedNullValue;
+ }
+
+ if (cell->structure()->typeInfo().type() < CompoundType) {
+ if (current.m_values == end) {
+ m_markSets.removeLast();
+ continue;
+ }
+ goto findNextUnmarkedNullValue;
+ }
+
+ if (current.m_values == end)
+ m_markSets.removeLast();
+
+ markChildren(cell);
+ }
+ while (!m_values.isEmpty())
+ markChildren(m_values.removeLast());
+ }
+#if !ASSERT_DISABLED
+ m_isDraining = false;
+#endif
+ }
+
+ // Rule from ECMA 15.2 about what an array index is.
+ // Must exactly match string form of an unsigned integer, and be less than 2^32 - 1.
+ inline unsigned Identifier::toArrayIndex(bool& ok) const
+ {
+ unsigned i = toUInt32(ok);
+ if (ok && i >= 0xFFFFFFFFU)
+ ok = false;
+ return i;
+ }
+
+} // namespace JSC
+
+#endif // JSArray_h
diff --git a/Source/JavaScriptCore/runtime/JSByteArray.cpp b/Source/JavaScriptCore/runtime/JSByteArray.cpp
new file mode 100644
index 0000000..6af9d75
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/JSByteArray.cpp
@@ -0,0 +1,116 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JSByteArray.h"
+
+#include "JSGlobalObject.h"
+#include "PropertyNameArray.h"
+
+using namespace WTF;
+
+namespace JSC {
+
+const ClassInfo JSByteArray::s_defaultInfo = { "ByteArray", 0, 0, 0 };
+
+JSByteArray::JSByteArray(ExecState* exec, NonNullPassRefPtr<Structure> structure, ByteArray* storage, const JSC::ClassInfo* classInfo)
+ : JSObject(structure)
+ , m_storage(storage)
+ , m_classInfo(classInfo)
+{
+ putDirect(exec->globalData().propertyNames->length, jsNumber(m_storage->length()), ReadOnly | DontDelete);
+}
+
+#if !ASSERT_DISABLED
+JSByteArray::~JSByteArray()
+{
+ ASSERT(vptr() == JSGlobalData::jsByteArrayVPtr);
+}
+#endif
+
+
+PassRefPtr<Structure> JSByteArray::createStructure(JSValue prototype)
+{
+ PassRefPtr<Structure> result = Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount);
+ return result;
+}
+
+bool JSByteArray::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
+{
+ bool ok;
+ unsigned index = propertyName.toUInt32(ok);
+ if (ok && canAccessIndex(index)) {
+ slot.setValue(getIndex(exec, index));
+ return true;
+ }
+ return JSObject::getOwnPropertySlot(exec, propertyName, slot);
+}
+
+bool JSByteArray::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
+{
+ bool ok;
+ unsigned index = propertyName.toUInt32(ok);
+ if (ok && canAccessIndex(index)) {
+ descriptor.setDescriptor(getIndex(exec, index), DontDelete);
+ return true;
+ }
+ return JSObject::getOwnPropertyDescriptor(exec, propertyName, descriptor);
+}
+
+bool JSByteArray::getOwnPropertySlot(ExecState* exec, unsigned propertyName, PropertySlot& slot)
+{
+ if (canAccessIndex(propertyName)) {
+ slot.setValue(getIndex(exec, propertyName));
+ return true;
+ }
+ return JSObject::getOwnPropertySlot(exec, Identifier::from(exec, propertyName), slot);
+}
+
+void JSByteArray::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
+{
+ bool ok;
+ unsigned index = propertyName.toUInt32(ok);
+ if (ok) {
+ setIndex(exec, index, value);
+ return;
+ }
+ JSObject::put(exec, propertyName, value, slot);
+}
+
+void JSByteArray::put(ExecState* exec, unsigned propertyName, JSValue value)
+{
+ setIndex(exec, propertyName, value);
+}
+
+void JSByteArray::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
+{
+ unsigned length = m_storage->length();
+ for (unsigned i = 0; i < length; ++i)
+ propertyNames.add(Identifier::from(exec, i));
+ JSObject::getOwnPropertyNames(exec, propertyNames, mode);
+}
+
+}
+
diff --git a/Source/JavaScriptCore/runtime/JSByteArray.h b/Source/JavaScriptCore/runtime/JSByteArray.h
new file mode 100644
index 0000000..44bae2d
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/JSByteArray.h
@@ -0,0 +1,116 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef JSByteArray_h
+#define JSByteArray_h
+
+#include "JSObject.h"
+
+#include <wtf/ByteArray.h>
+
+namespace JSC {
+
+ class JSByteArray : public JSObject {
+ friend class JSGlobalData;
+ public:
+ bool canAccessIndex(unsigned i) { return i < m_storage->length(); }
+ JSValue getIndex(ExecState*, unsigned i)
+ {
+ ASSERT(canAccessIndex(i));
+ return jsNumber(m_storage->data()[i]);
+ }
+
+ void setIndex(unsigned i, int value)
+ {
+ ASSERT(canAccessIndex(i));
+ m_storage->data()[i] = static_cast<unsigned char>(value);
+ }
+
+ void setIndex(unsigned i, double value)
+ {
+ ASSERT(canAccessIndex(i));
+ // The largest integer value that a double can represent without loss of precision
+ // is 2^53. long long is the smallest integral type that gives correct results
+ // when casting numbers larger than 2^31 from a value of type double.
+ m_storage->data()[i] = static_cast<unsigned char>(static_cast<long long>(value));
+ }
+
+ void setIndex(ExecState* exec, unsigned i, JSValue value)
+ {
+ double byteValue = value.toNumber(exec);
+ if (exec->hadException())
+ return;
+ if (canAccessIndex(i))
+ setIndex(i, byteValue);
+ }
+
+ JSByteArray(ExecState* exec, NonNullPassRefPtr<Structure>, WTF::ByteArray* storage, const JSC::ClassInfo* = &s_defaultInfo);
+ static PassRefPtr<Structure> createStructure(JSValue prototype);
+
+ virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertySlot&);
+ virtual bool getOwnPropertySlot(JSC::ExecState*, unsigned propertyName, JSC::PropertySlot&);
+ virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
+ virtual void put(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSValue, JSC::PutPropertySlot&);
+ virtual void put(JSC::ExecState*, unsigned propertyName, JSC::JSValue);
+
+ virtual void getOwnPropertyNames(JSC::ExecState*, JSC::PropertyNameArray&, EnumerationMode mode = ExcludeDontEnumProperties);
+
+ virtual const ClassInfo* classInfo() const { return m_classInfo; }
+ static const ClassInfo s_defaultInfo;
+
+ size_t length() const { return m_storage->length(); }
+
+ WTF::ByteArray* storage() const { return m_storage.get(); }
+
+#if !ASSERT_DISABLED
+ virtual ~JSByteArray();
+#endif
+
+ protected:
+ static const unsigned StructureFlags = OverridesGetOwnPropertySlot | OverridesGetPropertyNames | JSObject::StructureFlags;
+
+ private:
+ enum VPtrStealingHackType { VPtrStealingHack };
+ JSByteArray(VPtrStealingHackType)
+ : JSObject(createStructure(jsNull()))
+ , m_classInfo(0)
+ {
+ }
+
+ RefPtr<WTF::ByteArray> m_storage;
+ const ClassInfo* m_classInfo;
+ };
+
+ JSByteArray* asByteArray(JSValue value);
+ inline JSByteArray* asByteArray(JSValue value)
+ {
+ return static_cast<JSByteArray*>(value.asCell());
+ }
+
+ inline bool isJSByteArray(JSGlobalData* globalData, JSValue v) { return v.isCell() && v.asCell()->vptr() == globalData->jsByteArrayVPtr; }
+
+} // namespace JSC
+
+#endif // JSByteArray_h
diff --git a/Source/JavaScriptCore/runtime/JSCell.cpp b/Source/JavaScriptCore/runtime/JSCell.cpp
new file mode 100644
index 0000000..0cc1ab1
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/JSCell.cpp
@@ -0,0 +1,217 @@
+/*
+ * Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
+ * Copyright (C) 2001 Peter Kelly (pmk@post.com)
+ * Copyright (C) 2003, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+#include "JSCell.h"
+
+#include "JSFunction.h"
+#include "JSString.h"
+#include "JSObject.h"
+#include <wtf/MathExtras.h>
+
+namespace JSC {
+
+#if defined NAN && defined INFINITY
+
+extern const double NaN = NAN;
+extern const double Inf = INFINITY;
+
+#else // !(defined NAN && defined INFINITY)
+
+// The trick is to define the NaN and Inf globals with a different type than the declaration.
+// This trick works because the mangled name of the globals does not include the type, although
+// I'm not sure that's guaranteed. There could be alignment issues with this, since arrays of
+// characters don't necessarily need the same alignment doubles do, but for now it seems to work.
+// It would be good to figure out a 100% clean way that still avoids code that runs at init time.
+
+// Note, we have to use union to ensure alignment. Otherwise, NaN_Bytes can start anywhere,
+// while NaN_double has to be 4-byte aligned for 32-bits.
+// With -fstrict-aliasing enabled, unions are the only safe way to do type masquerading.
+
+static const union {
+ struct {
+ unsigned char NaN_Bytes[8];
+ unsigned char Inf_Bytes[8];
+ } bytes;
+
+ struct {
+ double NaN_Double;
+ double Inf_Double;
+ } doubles;
+
+} NaNInf = { {
+#if CPU(BIG_ENDIAN)
+ { 0x7f, 0xf8, 0, 0, 0, 0, 0, 0 },
+ { 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 }
+#elif CPU(MIDDLE_ENDIAN)
+ { 0, 0, 0xf8, 0x7f, 0, 0, 0, 0 },
+ { 0, 0, 0xf0, 0x7f, 0, 0, 0, 0 }
+#else
+ { 0, 0, 0, 0, 0, 0, 0xf8, 0x7f },
+ { 0, 0, 0, 0, 0, 0, 0xf0, 0x7f }
+#endif
+} } ;
+
+extern const double NaN = NaNInf.doubles.NaN_Double;
+extern const double Inf = NaNInf.doubles.Inf_Double;
+
+#endif // !(defined NAN && defined INFINITY)
+
+bool JSCell::getUInt32(uint32_t&) const
+{
+ return false;
+}
+
+bool JSCell::getString(ExecState* exec, UString&stringValue) const
+{
+ if (!isString())
+ return false;
+ stringValue = static_cast<const JSString*>(this)->value(exec);
+ return true;
+}
+
+UString JSCell::getString(ExecState* exec) const
+{
+ return isString() ? static_cast<const JSString*>(this)->value(exec) : UString();
+}
+
+JSObject* JSCell::getObject()
+{
+ return isObject() ? asObject(this) : 0;
+}
+
+const JSObject* JSCell::getObject() const
+{
+ return isObject() ? static_cast<const JSObject*>(this) : 0;
+}
+
+CallType JSCell::getCallData(CallData&)
+{
+ return CallTypeNone;
+}
+
+ConstructType JSCell::getConstructData(ConstructData&)
+{
+ return ConstructTypeNone;
+}
+
+bool JSCell::getOwnPropertySlot(ExecState* exec, const Identifier& identifier, PropertySlot& slot)
+{
+ // This is not a general purpose implementation of getOwnPropertySlot.
+ // It should only be called by JSValue::get.
+ // It calls getPropertySlot, not getOwnPropertySlot.
+ JSObject* object = toObject(exec);
+ slot.setBase(object);
+ if (!object->getPropertySlot(exec, identifier, slot))
+ slot.setUndefined();
+ return true;
+}
+
+bool JSCell::getOwnPropertySlot(ExecState* exec, unsigned identifier, PropertySlot& slot)
+{
+ // This is not a general purpose implementation of getOwnPropertySlot.
+ // It should only be called by JSValue::get.
+ // It calls getPropertySlot, not getOwnPropertySlot.
+ JSObject* object = toObject(exec);
+ slot.setBase(object);
+ if (!object->getPropertySlot(exec, identifier, slot))
+ slot.setUndefined();
+ return true;
+}
+
+void JSCell::put(ExecState* exec, const Identifier& identifier, JSValue value, PutPropertySlot& slot)
+{
+ toObject(exec)->put(exec, identifier, value, slot);
+}
+
+void JSCell::put(ExecState* exec, unsigned identifier, JSValue value)
+{
+ toObject(exec)->put(exec, identifier, value);
+}
+
+bool JSCell::deleteProperty(ExecState* exec, const Identifier& identifier)
+{
+ return toObject(exec)->deleteProperty(exec, identifier);
+}
+
+bool JSCell::deleteProperty(ExecState* exec, unsigned identifier)
+{
+ return toObject(exec)->deleteProperty(exec, identifier);
+}
+
+JSObject* JSCell::toThisObject(ExecState* exec) const
+{
+ return toObject(exec);
+}
+
+const ClassInfo* JSCell::classInfo() const
+{
+ return 0;
+}
+
+JSValue JSCell::getJSNumber()
+{
+ return JSValue();
+}
+
+bool JSCell::isGetterSetter() const
+{
+ return false;
+}
+
+JSValue JSCell::toPrimitive(ExecState*, PreferredPrimitiveType) const
+{
+ ASSERT_NOT_REACHED();
+ return JSValue();
+}
+
+bool JSCell::getPrimitiveNumber(ExecState*, double&, JSValue&)
+{
+ ASSERT_NOT_REACHED();
+ return false;
+}
+
+bool JSCell::toBoolean(ExecState*) const
+{
+ ASSERT_NOT_REACHED();
+ return false;
+}
+
+double JSCell::toNumber(ExecState*) const
+{
+ ASSERT_NOT_REACHED();
+ return 0;
+}
+
+UString JSCell::toString(ExecState*) const
+{
+ ASSERT_NOT_REACHED();
+ return UString();
+}
+
+JSObject* JSCell::toObject(ExecState*) const
+{
+ ASSERT_NOT_REACHED();
+ return 0;
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/JSCell.h b/Source/JavaScriptCore/runtime/JSCell.h
new file mode 100644
index 0000000..7d4929d
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/JSCell.h
@@ -0,0 +1,376 @@
+/*
+ * Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
+ * Copyright (C) 2001 Peter Kelly (pmk@post.com)
+ * Copyright (C) 2003, 2004, 2005, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef JSCell_h
+#define JSCell_h
+
+#include "CallData.h"
+#include "ConstructData.h"
+#include "Collector.h"
+#include "JSImmediate.h"
+#include "JSValue.h"
+#include "MarkStack.h"
+#include "Structure.h"
+#include <wtf/Noncopyable.h>
+
+namespace JSC {
+
+#if COMPILER(MSVC)
+ // If WTF_MAKE_NONCOPYABLE is applied to JSCell we end up with a bunch of
+ // undefined references to the JSCell copy constructor and assignment operator
+ // when linking JavaScriptCore.
+ class MSVCBugWorkaround {
+ WTF_MAKE_NONCOPYABLE(MSVCBugWorkaround);
+
+ protected:
+ MSVCBugWorkaround() { }
+ ~MSVCBugWorkaround() { }
+ };
+
+ class JSCell : MSVCBugWorkaround {
+#else
+ class JSCell {
+ WTF_MAKE_NONCOPYABLE(JSCell);
+#endif
+
+ friend class GetterSetter;
+ friend class Heap;
+ friend class JIT;
+ friend class JSNumberCell;
+ friend class JSObject;
+ friend class JSPropertyNameIterator;
+ friend class JSString;
+ friend class JSValue;
+ friend class JSAPIValueWrapper;
+ friend class JSZombie;
+ friend class JSGlobalData;
+
+ private:
+ explicit JSCell(Structure*);
+ virtual ~JSCell();
+
+ public:
+ static PassRefPtr<Structure> createDummyStructure()
+ {
+ return Structure::create(jsNull(), TypeInfo(UnspecifiedType), AnonymousSlotCount);
+ }
+
+ // Querying the type.
+ bool isString() const;
+ bool isObject() const;
+ virtual bool isGetterSetter() const;
+ bool inherits(const ClassInfo*) const;
+ virtual bool isAPIValueWrapper() const { return false; }
+ virtual bool isPropertyNameIterator() const { return false; }
+
+ Structure* structure() const;
+
+ // Extracting the value.
+ bool getString(ExecState* exec, UString&) const;
+ UString getString(ExecState* exec) const; // null string if not a string
+ JSObject* getObject(); // NULL if not an object
+ const JSObject* getObject() const; // NULL if not an object
+
+ virtual CallType getCallData(CallData&);
+ virtual ConstructType getConstructData(ConstructData&);
+
+ // Extracting integer values.
+ // FIXME: remove these methods, can check isNumberCell in JSValue && then call asNumberCell::*.
+ virtual bool getUInt32(uint32_t&) const;
+
+ // Basic conversions.
+ virtual JSValue toPrimitive(ExecState*, PreferredPrimitiveType) const;
+ virtual bool getPrimitiveNumber(ExecState*, double& number, JSValue&);
+ virtual bool toBoolean(ExecState*) const;
+ virtual double toNumber(ExecState*) const;
+ virtual UString toString(ExecState*) const;
+ virtual JSObject* toObject(ExecState*) const;
+
+ // Garbage collection.
+ void* operator new(size_t, ExecState*);
+ void* operator new(size_t, JSGlobalData*);
+ void* operator new(size_t, void* placementNewDestination) { return placementNewDestination; }
+
+ virtual void markChildren(MarkStack&);
+#if ENABLE(JSC_ZOMBIES)
+ virtual bool isZombie() const { return false; }
+#endif
+
+ // Object operations, with the toObject operation included.
+ virtual const ClassInfo* classInfo() const;
+ virtual void put(ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&);
+ virtual void put(ExecState*, unsigned propertyName, JSValue);
+ virtual bool deleteProperty(ExecState*, const Identifier& propertyName);
+ virtual bool deleteProperty(ExecState*, unsigned propertyName);
+
+ virtual JSObject* toThisObject(ExecState*) const;
+ virtual JSValue getJSNumber();
+ void* vptr() { return *reinterpret_cast<void**>(this); }
+ void setVPtr(void* vptr) { *reinterpret_cast<void**>(this) = vptr; }
+
+ // FIXME: Rename getOwnPropertySlot to virtualGetOwnPropertySlot, and
+ // fastGetOwnPropertySlot to getOwnPropertySlot. Callers should always
+ // call this function, not its slower virtual counterpart. (For integer
+ // property names, we want a similar interface with appropriate optimizations.)
+ bool fastGetOwnPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&);
+
+ protected:
+ static const unsigned AnonymousSlotCount = 0;
+
+ private:
+ // Base implementation; for non-object classes implements getPropertySlot.
+ virtual bool getOwnPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&);
+ virtual bool getOwnPropertySlot(ExecState*, unsigned propertyName, PropertySlot&);
+
+ Structure* m_structure;
+ };
+
+ inline JSCell::JSCell(Structure* structure)
+ : m_structure(structure)
+ {
+ }
+
+ inline JSCell::~JSCell()
+ {
+ }
+
+ inline bool JSCell::isObject() const
+ {
+ return m_structure->typeInfo().type() == ObjectType;
+ }
+
+ inline bool JSCell::isString() const
+ {
+ return m_structure->typeInfo().type() == StringType;
+ }
+
+ inline Structure* JSCell::structure() const
+ {
+ return m_structure;
+ }
+
+ inline void JSCell::markChildren(MarkStack&)
+ {
+ }
+
+ inline void* JSCell::operator new(size_t size, JSGlobalData* globalData)
+ {
+ return globalData->heap.allocate(size);
+ }
+
+ inline void* JSCell::operator new(size_t size, ExecState* exec)
+ {
+ return exec->heap()->allocate(size);
+ }
+
+ // --- JSValue inlines ----------------------------
+
+ inline bool JSValue::isString() const
+ {
+ return isCell() && asCell()->isString();
+ }
+
+ inline bool JSValue::isGetterSetter() const
+ {
+ return isCell() && asCell()->isGetterSetter();
+ }
+
+ inline bool JSValue::isObject() const
+ {
+ return isCell() && asCell()->isObject();
+ }
+
+ inline bool JSValue::getString(ExecState* exec, UString& s) const
+ {
+ return isCell() && asCell()->getString(exec, s);
+ }
+
+ inline UString JSValue::getString(ExecState* exec) const
+ {
+ return isCell() ? asCell()->getString(exec) : UString();
+ }
+
+ inline JSObject* JSValue::getObject() const
+ {
+ return isCell() ? asCell()->getObject() : 0;
+ }
+
+ inline CallType getCallData(JSValue value, CallData& callData)
+ {
+ CallType result = value.isCell() ? value.asCell()->getCallData(callData) : CallTypeNone;
+ ASSERT(result == CallTypeNone || value.isValidCallee());
+ return result;
+ }
+
+ inline ConstructType getConstructData(JSValue value, ConstructData& constructData)
+ {
+ ConstructType result = value.isCell() ? value.asCell()->getConstructData(constructData) : ConstructTypeNone;
+ ASSERT(result == ConstructTypeNone || value.isValidCallee());
+ return result;
+ }
+
+ ALWAYS_INLINE bool JSValue::getUInt32(uint32_t& v) const
+ {
+ if (isInt32()) {
+ int32_t i = asInt32();
+ v = static_cast<uint32_t>(i);
+ return i >= 0;
+ }
+ if (isDouble()) {
+ double d = asDouble();
+ v = static_cast<uint32_t>(d);
+ return v == d;
+ }
+ return false;
+ }
+
+#if USE(JSVALUE64)
+ ALWAYS_INLINE JSCell* JSValue::asCell() const
+ {
+ ASSERT(isCell());
+ return m_ptr;
+ }
+#endif // USE(JSVALUE64)
+
+ inline JSValue JSValue::toPrimitive(ExecState* exec, PreferredPrimitiveType preferredType) const
+ {
+ return isCell() ? asCell()->toPrimitive(exec, preferredType) : asValue();
+ }
+
+ inline bool JSValue::getPrimitiveNumber(ExecState* exec, double& number, JSValue& value)
+ {
+ if (isInt32()) {
+ number = asInt32();
+ value = *this;
+ return true;
+ }
+ if (isDouble()) {
+ number = asDouble();
+ value = *this;
+ return true;
+ }
+ if (isCell())
+ return asCell()->getPrimitiveNumber(exec, number, value);
+ if (isTrue()) {
+ number = 1.0;
+ value = *this;
+ return true;
+ }
+ if (isFalse() || isNull()) {
+ number = 0.0;
+ value = *this;
+ return true;
+ }
+ ASSERT(isUndefined());
+ number = nonInlineNaN();
+ value = *this;
+ return true;
+ }
+
+ inline bool JSValue::toBoolean(ExecState* exec) const
+ {
+ if (isInt32())
+ return asInt32() != 0;
+ if (isDouble())
+ return asDouble() > 0.0 || asDouble() < 0.0; // false for NaN
+ if (isCell())
+ return asCell()->toBoolean(exec);
+ return isTrue(); // false, null, and undefined all convert to false.
+ }
+
+ ALWAYS_INLINE double JSValue::toNumber(ExecState* exec) const
+ {
+ if (isInt32())
+ return asInt32();
+ if (isDouble())
+ return asDouble();
+ if (isCell())
+ return asCell()->toNumber(exec);
+ if (isTrue())
+ return 1.0;
+ return isUndefined() ? nonInlineNaN() : 0; // null and false both convert to 0.
+ }
+
+ inline bool JSValue::needsThisConversion() const
+ {
+ if (UNLIKELY(!isCell()))
+ return true;
+ return asCell()->structure()->typeInfo().needsThisConversion();
+ }
+
+ inline JSValue JSValue::getJSNumber()
+ {
+ if (isInt32() || isDouble())
+ return *this;
+ if (isCell())
+ return asCell()->getJSNumber();
+ return JSValue();
+ }
+
+ inline JSObject* JSValue::toObject(ExecState* exec) const
+ {
+ return isCell() ? asCell()->toObject(exec) : toObjectSlowCase(exec);
+ }
+
+ inline JSObject* JSValue::toThisObject(ExecState* exec) const
+ {
+ return isCell() ? asCell()->toThisObject(exec) : toThisObjectSlowCase(exec);
+ }
+
+ ALWAYS_INLINE void MarkStack::append(JSCell* cell)
+ {
+ ASSERT(!m_isCheckingForDefaultMarkViolation);
+ ASSERT(cell);
+ if (Heap::checkMarkCell(cell))
+ return;
+ if (cell->structure()->typeInfo().type() >= CompoundType)
+ m_values.append(cell);
+ }
+
+ ALWAYS_INLINE void MarkStack::append(JSValue value)
+ {
+ ASSERT(value);
+ if (value.isCell())
+ append(value.asCell());
+ }
+
+ inline Heap* Heap::heap(JSValue v)
+ {
+ if (!v.isCell())
+ return 0;
+ return heap(v.asCell());
+ }
+
+ inline Heap* Heap::heap(JSCell* c)
+ {
+ return cellBlock(c)->heap;
+ }
+
+#if ENABLE(JSC_ZOMBIES)
+ inline bool JSValue::isZombie() const
+ {
+ return isCell() && asCell() && asCell()->isZombie();
+ }
+#endif
+} // namespace JSC
+
+#endif // JSCell_h
diff --git a/Source/JavaScriptCore/runtime/JSFunction.cpp b/Source/JavaScriptCore/runtime/JSFunction.cpp
new file mode 100644
index 0000000..99f8e6f
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/JSFunction.cpp
@@ -0,0 +1,343 @@
+/*
+ * Copyright (C) 1999-2002 Harri Porten (porten@kde.org)
+ * Copyright (C) 2001 Peter Kelly (pmk@post.com)
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2007 Cameron Zwarich (cwzwarich@uwaterloo.ca)
+ * Copyright (C) 2007 Maks Orlovich
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+#include "JSFunction.h"
+
+#include "CodeBlock.h"
+#include "CommonIdentifiers.h"
+#include "CallFrame.h"
+#include "ExceptionHelpers.h"
+#include "FunctionPrototype.h"
+#include "JSGlobalObject.h"
+#include "JSNotAnObject.h"
+#include "Interpreter.h"
+#include "ObjectPrototype.h"
+#include "Parser.h"
+#include "PropertyNameArray.h"
+#include "ScopeChainMark.h"
+
+using namespace WTF;
+using namespace Unicode;
+
+namespace JSC {
+#if ENABLE(JIT)
+EncodedJSValue JSC_HOST_CALL callHostFunctionAsConstructor(ExecState* exec)
+{
+ return throwVMError(exec, createNotAConstructorError(exec, exec->callee()));
+}
+#endif
+
+ASSERT_CLASS_FITS_IN_CELL(JSFunction);
+
+const ClassInfo JSFunction::info = { "Function", 0, 0, 0 };
+
+bool JSFunction::isHostFunctionNonInline() const
+{
+ return isHostFunction();
+}
+
+JSFunction::JSFunction(NonNullPassRefPtr<Structure> structure)
+ : Base(structure)
+ , m_executable(adoptRef(new VPtrHackExecutable()))
+ , m_scopeChain(NoScopeChain())
+{
+}
+
+#if ENABLE(JIT)
+JSFunction::JSFunction(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, int length, const Identifier& name, PassRefPtr<NativeExecutable> thunk)
+ : Base(globalObject, structure)
+ , m_executable(thunk)
+ , m_scopeChain(globalObject->globalScopeChain())
+{
+ putDirect(exec->globalData().propertyNames->name, jsString(exec, name.isNull() ? "" : name.ustring()), DontDelete | ReadOnly | DontEnum);
+ putDirect(exec->propertyNames().length, jsNumber(length), DontDelete | ReadOnly | DontEnum);
+}
+#endif
+
+JSFunction::JSFunction(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, int length, const Identifier& name, NativeFunction func)
+ : Base(globalObject, structure)
+#if ENABLE(JIT)
+ , m_executable(exec->globalData().getHostFunction(func))
+#endif
+ , m_scopeChain(globalObject->globalScopeChain())
+{
+ putDirect(exec->globalData().propertyNames->name, jsString(exec, name.isNull() ? "" : name.ustring()), DontDelete | ReadOnly | DontEnum);
+#if ENABLE(JIT)
+ putDirect(exec->propertyNames().length, jsNumber(length), DontDelete | ReadOnly | DontEnum);
+#else
+ UNUSED_PARAM(length);
+ UNUSED_PARAM(func);
+ ASSERT_NOT_REACHED();
+#endif
+}
+
+JSFunction::JSFunction(ExecState* exec, NonNullPassRefPtr<FunctionExecutable> executable, ScopeChainNode* scopeChainNode)
+ : Base(scopeChainNode->globalObject, scopeChainNode->globalObject->functionStructure())
+ , m_executable(executable)
+ , m_scopeChain(scopeChainNode)
+{
+ const Identifier& name = static_cast<FunctionExecutable*>(m_executable.get())->name();
+ putDirect(exec->globalData().propertyNames->name, jsString(exec, name.isNull() ? "" : name.ustring()), DontDelete | ReadOnly | DontEnum);
+}
+
+JSFunction::~JSFunction()
+{
+ ASSERT(vptr() == JSGlobalData::jsFunctionVPtr);
+
+ // JIT code for other functions may have had calls linked directly to the code for this function; these links
+ // are based on a check for the this pointer value for this JSFunction - which will no longer be valid once
+ // this memory is freed and may be reused (potentially for another, different JSFunction).
+ if (!isHostFunction()) {
+#if ENABLE(JIT_OPTIMIZE_CALL)
+ ASSERT(m_executable);
+ if (jsExecutable()->isGeneratedForCall())
+ jsExecutable()->generatedBytecodeForCall().unlinkCallers();
+ if (jsExecutable()->isGeneratedForConstruct())
+ jsExecutable()->generatedBytecodeForConstruct().unlinkCallers();
+#endif
+ }
+}
+
+static const char* StrictModeCallerAccessError = "Cannot access caller property of a strict mode function";
+static const char* StrictModeArgumentsAccessError = "Cannot access arguments property of a strict mode function";
+
+static void createDescriptorForThrowingProperty(ExecState* exec, PropertyDescriptor& descriptor, const char* message)
+{
+ JSValue thrower = createTypeErrorFunction(exec, message);
+ descriptor.setAccessorDescriptor(thrower, thrower, DontEnum | DontDelete | Getter | Setter);
+}
+
+const UString& JSFunction::name(ExecState* exec)
+{
+ return asString(getDirect(exec->globalData().propertyNames->name))->tryGetValue();
+}
+
+const UString JSFunction::displayName(ExecState* exec)
+{
+ JSValue displayName = getDirect(exec->globalData().propertyNames->displayName);
+
+ if (displayName && isJSString(&exec->globalData(), displayName))
+ return asString(displayName)->tryGetValue();
+
+ return UString();
+}
+
+const UString JSFunction::calculatedDisplayName(ExecState* exec)
+{
+ const UString explicitName = displayName(exec);
+
+ if (!explicitName.isEmpty())
+ return explicitName;
+
+ return name(exec);
+}
+
+void JSFunction::markChildren(MarkStack& markStack)
+{
+ Base::markChildren(markStack);
+ if (!isHostFunction()) {
+ jsExecutable()->markAggregate(markStack);
+ scope().markAggregate(markStack);
+ }
+}
+
+CallType JSFunction::getCallData(CallData& callData)
+{
+#if ENABLE(JIT)
+ if (isHostFunction()) {
+ callData.native.function = nativeFunction();
+ return CallTypeHost;
+ }
+#endif
+ callData.js.functionExecutable = jsExecutable();
+ callData.js.scopeChain = scope().node();
+ return CallTypeJS;
+}
+
+JSValue JSFunction::argumentsGetter(ExecState* exec, JSValue slotBase, const Identifier&)
+{
+ JSFunction* thisObj = asFunction(slotBase);
+ ASSERT(!thisObj->isHostFunction());
+ return exec->interpreter()->retrieveArguments(exec, thisObj);
+}
+
+JSValue JSFunction::callerGetter(ExecState* exec, JSValue slotBase, const Identifier&)
+{
+ JSFunction* thisObj = asFunction(slotBase);
+ ASSERT(!thisObj->isHostFunction());
+ return exec->interpreter()->retrieveCaller(exec, thisObj);
+}
+
+JSValue JSFunction::lengthGetter(ExecState*, JSValue slotBase, const Identifier&)
+{
+ JSFunction* thisObj = asFunction(slotBase);
+ ASSERT(!thisObj->isHostFunction());
+ return jsNumber(thisObj->jsExecutable()->parameterCount());
+}
+
+bool JSFunction::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
+{
+ if (isHostFunction())
+ return Base::getOwnPropertySlot(exec, propertyName, slot);
+
+ if (propertyName == exec->propertyNames().prototype) {
+ JSValue* location = getDirectLocation(propertyName);
+
+ if (!location) {
+ JSObject* prototype = new (exec) JSObject(scope().globalObject()->emptyObjectStructure());
+ prototype->putDirect(exec->propertyNames().constructor, this, DontEnum);
+ putDirect(exec->propertyNames().prototype, prototype, DontDelete | DontEnum);
+ location = getDirectLocation(propertyName);
+ }
+
+ slot.setValueSlot(this, location, offsetForLocation(location));
+ }
+
+ if (propertyName == exec->propertyNames().arguments) {
+ if (jsExecutable()->isStrictMode()) {
+ throwTypeError(exec, "Can't access arguments object of a strict mode function");
+ slot.setValue(jsNull());
+ return true;
+ }
+
+ slot.setCacheableCustom(this, argumentsGetter);
+ return true;
+ }
+
+ if (propertyName == exec->propertyNames().length) {
+ slot.setCacheableCustom(this, lengthGetter);
+ return true;
+ }
+
+ if (propertyName == exec->propertyNames().caller) {
+ if (jsExecutable()->isStrictMode()) {
+ throwTypeError(exec, StrictModeCallerAccessError);
+ slot.setValue(jsNull());
+ return true;
+ }
+ slot.setCacheableCustom(this, callerGetter);
+ return true;
+ }
+
+ return Base::getOwnPropertySlot(exec, propertyName, slot);
+}
+
+bool JSFunction::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
+{
+ if (isHostFunction())
+ return Base::getOwnPropertyDescriptor(exec, propertyName, descriptor);
+
+ if (propertyName == exec->propertyNames().prototype) {
+ PropertySlot slot;
+ getOwnPropertySlot(exec, propertyName, slot);
+ return Base::getOwnPropertyDescriptor(exec, propertyName, descriptor);
+ }
+
+ if (propertyName == exec->propertyNames().arguments) {
+ if (jsExecutable()->isStrictMode())
+ createDescriptorForThrowingProperty(exec, descriptor, StrictModeArgumentsAccessError);
+ else
+ descriptor.setDescriptor(exec->interpreter()->retrieveArguments(exec, this), ReadOnly | DontEnum | DontDelete);
+ return true;
+ }
+
+ if (propertyName == exec->propertyNames().length) {
+ descriptor.setDescriptor(jsNumber(jsExecutable()->parameterCount()), ReadOnly | DontEnum | DontDelete);
+ return true;
+ }
+
+ if (propertyName == exec->propertyNames().caller) {
+ if (jsExecutable()->isStrictMode())
+ createDescriptorForThrowingProperty(exec, descriptor, StrictModeCallerAccessError);
+ else
+ descriptor.setDescriptor(exec->interpreter()->retrieveCaller(exec, this), ReadOnly | DontEnum | DontDelete);
+ return true;
+ }
+
+ return Base::getOwnPropertyDescriptor(exec, propertyName, descriptor);
+}
+
+void JSFunction::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
+{
+ if (!isHostFunction() && (mode == IncludeDontEnumProperties)) {
+ // Make sure prototype has been reified.
+ PropertySlot slot;
+ getOwnPropertySlot(exec, exec->propertyNames().prototype, slot);
+
+ propertyNames.add(exec->propertyNames().arguments);
+ propertyNames.add(exec->propertyNames().callee);
+ propertyNames.add(exec->propertyNames().caller);
+ propertyNames.add(exec->propertyNames().length);
+ }
+ Base::getOwnPropertyNames(exec, propertyNames, mode);
+}
+
+void JSFunction::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
+{
+ if (isHostFunction()) {
+ Base::put(exec, propertyName, value, slot);
+ return;
+ }
+ if (propertyName == exec->propertyNames().prototype) {
+ // Make sure prototype has been reified, such that it can only be overwritten
+ // following the rules set out in ECMA-262 8.12.9.
+ PropertySlot slot;
+ getOwnPropertySlot(exec, propertyName, slot);
+ }
+ if (jsExecutable()->isStrictMode()) {
+ if (propertyName == exec->propertyNames().arguments) {
+ throwTypeError(exec, StrictModeArgumentsAccessError);
+ return;
+ }
+ if (propertyName == exec->propertyNames().caller) {
+ throwTypeError(exec, StrictModeCallerAccessError);
+ return;
+ }
+ }
+ if (propertyName == exec->propertyNames().arguments || propertyName == exec->propertyNames().length)
+ return;
+ Base::put(exec, propertyName, value, slot);
+}
+
+bool JSFunction::deleteProperty(ExecState* exec, const Identifier& propertyName)
+{
+ if (isHostFunction())
+ return Base::deleteProperty(exec, propertyName);
+ if (propertyName == exec->propertyNames().arguments || propertyName == exec->propertyNames().length)
+ return false;
+ return Base::deleteProperty(exec, propertyName);
+}
+
+// ECMA 13.2.2 [[Construct]]
+ConstructType JSFunction::getConstructData(ConstructData& constructData)
+{
+ if (isHostFunction())
+ return ConstructTypeNone;
+ constructData.js.functionExecutable = jsExecutable();
+ constructData.js.scopeChain = scope().node();
+ return ConstructTypeJS;
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/JSFunction.h b/Source/JavaScriptCore/runtime/JSFunction.h
new file mode 100644
index 0000000..3a2fe30
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/JSFunction.h
@@ -0,0 +1,123 @@
+/*
+ * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
+ * Copyright (C) 2003, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2007 Cameron Zwarich (cwzwarich@uwaterloo.ca)
+ * Copyright (C) 2007 Maks Orlovich
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef JSFunction_h
+#define JSFunction_h
+
+#include "JSObjectWithGlobalObject.h"
+
+namespace JSC {
+
+ class ExecutableBase;
+ class FunctionExecutable;
+ class FunctionPrototype;
+ class JSActivation;
+ class JSGlobalObject;
+ class NativeExecutable;
+
+ EncodedJSValue JSC_HOST_CALL callHostFunctionAsConstructor(ExecState*);
+
+ class JSFunction : public JSObjectWithGlobalObject {
+ friend class JIT;
+ friend class JSGlobalData;
+
+ typedef JSObjectWithGlobalObject Base;
+
+ public:
+ JSFunction(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure>, int length, const Identifier&, NativeFunction);
+#if ENABLE(JIT)
+ JSFunction(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure>, int length, const Identifier&, PassRefPtr<NativeExecutable>);
+#endif
+ JSFunction(ExecState*, NonNullPassRefPtr<FunctionExecutable>, ScopeChainNode*);
+ virtual ~JSFunction();
+
+ const UString& name(ExecState*);
+ const UString displayName(ExecState*);
+ const UString calculatedDisplayName(ExecState*);
+
+ ScopeChain& scope()
+ {
+ ASSERT(!isHostFunctionNonInline());
+ return m_scopeChain;
+ }
+ void setScope(const ScopeChain& scopeChain)
+ {
+ ASSERT(!isHostFunctionNonInline());
+ m_scopeChain = scopeChain;
+ }
+
+ ExecutableBase* executable() const { return m_executable.get(); }
+
+ // To call either of these methods include Executable.h
+ inline bool isHostFunction() const;
+ FunctionExecutable* jsExecutable() const;
+
+ static JS_EXPORTDATA const ClassInfo info;
+
+ static PassRefPtr<Structure> createStructure(JSValue prototype)
+ {
+ return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount);
+ }
+
+ NativeFunction nativeFunction();
+
+ virtual ConstructType getConstructData(ConstructData&);
+ virtual CallType getCallData(CallData&);
+
+ protected:
+ const static unsigned StructureFlags = OverridesGetOwnPropertySlot | ImplementsHasInstance | OverridesMarkChildren | OverridesGetPropertyNames | JSObject::StructureFlags;
+
+ private:
+ JSFunction(NonNullPassRefPtr<Structure>);
+
+ bool isHostFunctionNonInline() const;
+
+ virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
+ virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
+ virtual void getOwnPropertyNames(ExecState*, PropertyNameArray&, EnumerationMode mode = ExcludeDontEnumProperties);
+ virtual void put(ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&);
+ virtual bool deleteProperty(ExecState*, const Identifier& propertyName);
+
+ virtual void markChildren(MarkStack&);
+
+ virtual const ClassInfo* classInfo() const { return &info; }
+
+ static JSValue argumentsGetter(ExecState*, JSValue, const Identifier&);
+ static JSValue callerGetter(ExecState*, JSValue, const Identifier&);
+ static JSValue lengthGetter(ExecState*, JSValue, const Identifier&);
+
+ RefPtr<ExecutableBase> m_executable;
+ ScopeChain m_scopeChain;
+ };
+
+ JSFunction* asFunction(JSValue);
+
+ inline JSFunction* asFunction(JSValue value)
+ {
+ ASSERT(asObject(value)->inherits(&JSFunction::info));
+ return static_cast<JSFunction*>(asObject(value));
+ }
+
+} // namespace JSC
+
+#endif // JSFunction_h
diff --git a/Source/JavaScriptCore/runtime/JSGlobalData.cpp b/Source/JavaScriptCore/runtime/JSGlobalData.cpp
new file mode 100644
index 0000000..aca995a
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/JSGlobalData.cpp
@@ -0,0 +1,365 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JSGlobalData.h"
+
+#include "ArgList.h"
+#include "Collector.h"
+#include "CollectorHeapIterator.h"
+#include "CommonIdentifiers.h"
+#include "FunctionConstructor.h"
+#include "GetterSetter.h"
+#include "Interpreter.h"
+#include "JSActivation.h"
+#include "JSAPIValueWrapper.h"
+#include "JSArray.h"
+#include "JSByteArray.h"
+#include "JSClassRef.h"
+#include "JSFunction.h"
+#include "JSLock.h"
+#include "JSNotAnObject.h"
+#include "JSPropertyNameIterator.h"
+#include "JSStaticScopeObject.h"
+#include "Lexer.h"
+#include "Lookup.h"
+#include "Nodes.h"
+#include "Parser.h"
+#include "RegExpCache.h"
+#include "StrictEvalActivation.h"
+#include <wtf/WTFThreadData.h>
+#if ENABLE(REGEXP_TRACING)
+#include "RegExp.h"
+#endif
+
+
+#if ENABLE(JSC_MULTIPLE_THREADS)
+#include <wtf/Threading.h>
+#endif
+
+#if PLATFORM(MAC)
+#include "ProfilerServer.h"
+#include <CoreFoundation/CoreFoundation.h>
+#endif
+
+using namespace WTF;
+
+namespace JSC {
+
+extern JSC_CONST_HASHTABLE HashTable arrayTable;
+extern JSC_CONST_HASHTABLE HashTable jsonTable;
+extern JSC_CONST_HASHTABLE HashTable dateTable;
+extern JSC_CONST_HASHTABLE HashTable mathTable;
+extern JSC_CONST_HASHTABLE HashTable numberTable;
+extern JSC_CONST_HASHTABLE HashTable regExpTable;
+extern JSC_CONST_HASHTABLE HashTable regExpConstructorTable;
+extern JSC_CONST_HASHTABLE HashTable stringTable;
+
+void* JSGlobalData::jsArrayVPtr;
+void* JSGlobalData::jsByteArrayVPtr;
+void* JSGlobalData::jsStringVPtr;
+void* JSGlobalData::jsFunctionVPtr;
+
+void JSGlobalData::storeVPtrs()
+{
+ CollectorCell cell;
+ void* storage = &cell;
+
+ COMPILE_ASSERT(sizeof(JSArray) <= sizeof(CollectorCell), sizeof_JSArray_must_be_less_than_CollectorCell);
+ JSCell* jsArray = new (storage) JSArray(JSArray::VPtrStealingHack);
+ JSGlobalData::jsArrayVPtr = jsArray->vptr();
+ jsArray->~JSCell();
+
+ COMPILE_ASSERT(sizeof(JSByteArray) <= sizeof(CollectorCell), sizeof_JSByteArray_must_be_less_than_CollectorCell);
+ JSCell* jsByteArray = new (storage) JSByteArray(JSByteArray::VPtrStealingHack);
+ JSGlobalData::jsByteArrayVPtr = jsByteArray->vptr();
+ jsByteArray->~JSCell();
+
+ COMPILE_ASSERT(sizeof(JSString) <= sizeof(CollectorCell), sizeof_JSString_must_be_less_than_CollectorCell);
+ JSCell* jsString = new (storage) JSString(JSString::VPtrStealingHack);
+ JSGlobalData::jsStringVPtr = jsString->vptr();
+ jsString->~JSCell();
+
+ COMPILE_ASSERT(sizeof(JSFunction) <= sizeof(CollectorCell), sizeof_JSFunction_must_be_less_than_CollectorCell);
+ JSCell* jsFunction = new (storage) JSFunction(JSFunction::createStructure(jsNull()));
+ JSGlobalData::jsFunctionVPtr = jsFunction->vptr();
+ jsFunction->~JSCell();
+}
+
+JSGlobalData::JSGlobalData(GlobalDataType globalDataType, ThreadStackType threadStackType)
+ : globalDataType(globalDataType)
+ , clientData(0)
+ , arrayTable(fastNew<HashTable>(JSC::arrayTable))
+ , dateTable(fastNew<HashTable>(JSC::dateTable))
+ , jsonTable(fastNew<HashTable>(JSC::jsonTable))
+ , mathTable(fastNew<HashTable>(JSC::mathTable))
+ , numberTable(fastNew<HashTable>(JSC::numberTable))
+ , regExpTable(fastNew<HashTable>(JSC::regExpTable))
+ , regExpConstructorTable(fastNew<HashTable>(JSC::regExpConstructorTable))
+ , stringTable(fastNew<HashTable>(JSC::stringTable))
+ , activationStructure(JSActivation::createStructure(jsNull()))
+ , interruptedExecutionErrorStructure(JSObject::createStructure(jsNull()))
+ , terminatedExecutionErrorStructure(JSObject::createStructure(jsNull()))
+ , staticScopeStructure(JSStaticScopeObject::createStructure(jsNull()))
+ , strictEvalActivationStructure(StrictEvalActivation::createStructure(jsNull()))
+ , stringStructure(JSString::createStructure(jsNull()))
+ , notAnObjectStructure(JSNotAnObject::createStructure(jsNull()))
+ , propertyNameIteratorStructure(JSPropertyNameIterator::createStructure(jsNull()))
+ , getterSetterStructure(GetterSetter::createStructure(jsNull()))
+ , apiWrapperStructure(JSAPIValueWrapper::createStructure(jsNull()))
+ , dummyMarkableCellStructure(JSCell::createDummyStructure())
+ , identifierTable(globalDataType == Default ? wtfThreadData().currentIdentifierTable() : createIdentifierTable())
+ , propertyNames(new CommonIdentifiers(this))
+ , emptyList(new MarkedArgumentBuffer)
+ , lexer(new Lexer(this))
+ , parser(new Parser)
+ , interpreter(new Interpreter)
+ , heap(this)
+ , head(0)
+ , dynamicGlobalObject(0)
+ , firstStringifierToMark(0)
+ , markStack(jsArrayVPtr)
+ , cachedUTCOffset(NaN)
+ , maxReentryDepth(threadStackType == ThreadStackTypeSmall ? MaxSmallThreadReentryDepth : MaxLargeThreadReentryDepth)
+ , m_regExpCache(new RegExpCache(this))
+#if ENABLE(REGEXP_TRACING)
+ , m_rtTraceList(new RTTraceList())
+#endif
+#ifndef NDEBUG
+ , exclusiveThread(0)
+#endif
+{
+ if (globalDataType == Default)
+ m_stack = wtfThreadData().stack();
+
+#if PLATFORM(MAC)
+ startProfilerServerIfNeeded();
+#endif
+#if ENABLE(JIT) && ENABLE(INTERPRETER)
+#if PLATFORM(CF)
+ CFStringRef canUseJITKey = CFStringCreateWithCString(0 , "JavaScriptCoreUseJIT", kCFStringEncodingMacRoman);
+ CFBooleanRef canUseJIT = (CFBooleanRef)CFPreferencesCopyAppValue(canUseJITKey, kCFPreferencesCurrentApplication);
+ if (canUseJIT) {
+ m_canUseJIT = kCFBooleanTrue == canUseJIT;
+ CFRelease(canUseJIT);
+ } else
+ m_canUseJIT = !getenv("JavaScriptCoreUseJIT");
+ CFRelease(canUseJITKey);
+#elif OS(UNIX)
+ m_canUseJIT = !getenv("JavaScriptCoreUseJIT");
+#else
+ m_canUseJIT = true;
+#endif
+#endif
+#if ENABLE(JIT)
+#if ENABLE(INTERPRETER)
+ if (m_canUseJIT)
+ m_canUseJIT = executableAllocator.isValid();
+#endif
+ jitStubs = new JITThunks(this);
+#endif
+}
+
+JSGlobalData::~JSGlobalData()
+{
+ // By the time this is destroyed, heap.destroy() must already have been called.
+
+ delete interpreter;
+#ifndef NDEBUG
+ // Zeroing out to make the behavior more predictable when someone attempts to use a deleted instance.
+ interpreter = 0;
+#endif
+
+ arrayTable->deleteTable();
+ dateTable->deleteTable();
+ jsonTable->deleteTable();
+ mathTable->deleteTable();
+ numberTable->deleteTable();
+ regExpTable->deleteTable();
+ regExpConstructorTable->deleteTable();
+ stringTable->deleteTable();
+
+ fastDelete(const_cast<HashTable*>(arrayTable));
+ fastDelete(const_cast<HashTable*>(dateTable));
+ fastDelete(const_cast<HashTable*>(jsonTable));
+ fastDelete(const_cast<HashTable*>(mathTable));
+ fastDelete(const_cast<HashTable*>(numberTable));
+ fastDelete(const_cast<HashTable*>(regExpTable));
+ fastDelete(const_cast<HashTable*>(regExpConstructorTable));
+ fastDelete(const_cast<HashTable*>(stringTable));
+
+ delete parser;
+ delete lexer;
+
+ deleteAllValues(opaqueJSClassData);
+
+ delete emptyList;
+
+ delete propertyNames;
+ if (globalDataType != Default)
+ deleteIdentifierTable(identifierTable);
+
+ delete clientData;
+ delete m_regExpCache;
+#if ENABLE(REGEXP_TRACING)
+ delete m_rtTraceList;
+#endif
+}
+
+PassRefPtr<JSGlobalData> JSGlobalData::createContextGroup(ThreadStackType type)
+{
+ return adoptRef(new JSGlobalData(APIContextGroup, type));
+}
+
+PassRefPtr<JSGlobalData> JSGlobalData::create(ThreadStackType type)
+{
+ return adoptRef(new JSGlobalData(Default, type));
+}
+
+PassRefPtr<JSGlobalData> JSGlobalData::createLeaked(ThreadStackType type)
+{
+ Structure::startIgnoringLeaks();
+ RefPtr<JSGlobalData> data = create(type);
+ Structure::stopIgnoringLeaks();
+ return data.release();
+}
+
+bool JSGlobalData::sharedInstanceExists()
+{
+ return sharedInstanceInternal();
+}
+
+JSGlobalData& JSGlobalData::sharedInstance()
+{
+ JSGlobalData*& instance = sharedInstanceInternal();
+ if (!instance) {
+ instance = adoptRef(new JSGlobalData(APIShared, ThreadStackTypeSmall)).leakRef();
+#if ENABLE(JSC_MULTIPLE_THREADS)
+ instance->makeUsableFromMultipleThreads();
+#endif
+ }
+ return *instance;
+}
+
+JSGlobalData*& JSGlobalData::sharedInstanceInternal()
+{
+ ASSERT(JSLock::currentThreadIsHoldingLock());
+ static JSGlobalData* sharedInstance;
+ return sharedInstance;
+}
+
+#if ENABLE(JIT)
+PassRefPtr<NativeExecutable> JSGlobalData::getHostFunction(NativeFunction function)
+{
+ return jitStubs->hostFunctionStub(this, function);
+}
+PassRefPtr<NativeExecutable> JSGlobalData::getHostFunction(NativeFunction function, ThunkGenerator generator)
+{
+ return jitStubs->hostFunctionStub(this, function, generator);
+}
+#endif
+
+JSGlobalData::ClientData::~ClientData()
+{
+}
+
+void JSGlobalData::resetDateCache()
+{
+ cachedUTCOffset = NaN;
+ dstOffsetCache.reset();
+ cachedDateString = UString();
+ cachedDateStringValue = NaN;
+ dateInstanceCache.reset();
+}
+
+void JSGlobalData::startSampling()
+{
+ interpreter->startSampling();
+}
+
+void JSGlobalData::stopSampling()
+{
+ interpreter->stopSampling();
+}
+
+void JSGlobalData::dumpSampleData(ExecState* exec)
+{
+ interpreter->dumpSampleData(exec);
+}
+
+void JSGlobalData::recompileAllJSFunctions()
+{
+ // If JavaScript is running, it's not safe to recompile, since we'll end
+ // up throwing away code that is live on the stack.
+ ASSERT(!dynamicGlobalObject);
+
+ LiveObjectIterator it = heap.primaryHeapBegin();
+ LiveObjectIterator heapEnd = heap.primaryHeapEnd();
+ for ( ; it != heapEnd; ++it) {
+ if ((*it)->inherits(&JSFunction::info)) {
+ JSFunction* function = asFunction(*it);
+ if (!function->executable()->isHostFunction())
+ function->jsExecutable()->discardCode();
+ }
+ }
+}
+
+#if ENABLE(REGEXP_TRACING)
+void JSGlobalData::addRegExpToTrace(PassRefPtr<RegExp> regExp)
+{
+ m_rtTraceList->add(regExp);
+}
+
+void JSGlobalData::dumpRegExpTrace()
+{
+ // The first RegExp object is ignored. It is create by the RegExpPrototype ctor and not used.
+ RTTraceList::iterator iter = ++m_rtTraceList->begin();
+
+ if (iter != m_rtTraceList->end()) {
+ printf("\nRegExp Tracing\n");
+ printf(" match() matches\n");
+ printf("Regular Expression JIT Address calls found\n");
+ printf("----------------------------------------+----------------+----------+----------\n");
+
+ unsigned reCount = 0;
+
+ for (; iter != m_rtTraceList->end(); ++iter, ++reCount)
+ (*iter)->printTraceData();
+
+ printf("%d Regular Expressions\n", reCount);
+ }
+
+ m_rtTraceList->clear();
+}
+#else
+void JSGlobalData::dumpRegExpTrace()
+{
+}
+#endif
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/JSGlobalData.h b/Source/JavaScriptCore/runtime/JSGlobalData.h
new file mode 100644
index 0000000..699f975
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/JSGlobalData.h
@@ -0,0 +1,269 @@
+/*
+ * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef JSGlobalData_h
+#define JSGlobalData_h
+
+#include "CachedTranscendentalFunction.h"
+#include "Collector.h"
+#include "DateInstanceCache.h"
+#include "ExecutableAllocator.h"
+#include "JITStubs.h"
+#include "JSValue.h"
+#include "MarkStack.h"
+#include "NumericStrings.h"
+#include "SmallStrings.h"
+#include "Terminator.h"
+#include "TimeoutChecker.h"
+#include "WeakRandom.h"
+#include <wtf/BumpPointerAllocator.h>
+#include <wtf/Forward.h>
+#include <wtf/HashMap.h>
+#include <wtf/RefCounted.h>
+#include <wtf/ThreadSpecific.h>
+#include <wtf/WTFThreadData.h>
+#if ENABLE(REGEXP_TRACING)
+#include <wtf/ListHashSet.h>
+#endif
+
+struct OpaqueJSClass;
+struct OpaqueJSClassContextData;
+
+namespace JSC {
+
+ class CodeBlock;
+ class CommonIdentifiers;
+ class IdentifierTable;
+ class Interpreter;
+ class JSGlobalObject;
+ class JSObject;
+ class Lexer;
+ class Parser;
+ class RegExpCache;
+ class Stringifier;
+ class Structure;
+ class UString;
+#if ENABLE(REGEXP_TRACING)
+ class RegExp;
+#endif
+
+ struct HashTable;
+ struct Instruction;
+
+ struct DSTOffsetCache {
+ DSTOffsetCache()
+ {
+ reset();
+ }
+
+ void reset()
+ {
+ offset = 0.0;
+ start = 0.0;
+ end = -1.0;
+ increment = 0.0;
+ }
+
+ double offset;
+ double start;
+ double end;
+ double increment;
+ };
+
+ enum ThreadStackType {
+ ThreadStackTypeLarge,
+ ThreadStackTypeSmall
+ };
+
+ class JSGlobalData : public RefCounted<JSGlobalData> {
+ public:
+ // WebCore has a one-to-one mapping of threads to JSGlobalDatas;
+ // either create() or createLeaked() should only be called once
+ // on a thread, this is the 'default' JSGlobalData (it uses the
+ // thread's default string uniquing table from wtfThreadData).
+ // API contexts created using the new context group aware interface
+ // create APIContextGroup objects which require less locking of JSC
+ // than the old singleton APIShared JSGlobalData created for use by
+ // the original API.
+ enum GlobalDataType { Default, APIContextGroup, APIShared };
+
+ struct ClientData {
+ virtual ~ClientData() = 0;
+ };
+
+ bool isSharedInstance() { return globalDataType == APIShared; }
+ bool usingAPI() { return globalDataType != Default; }
+ static bool sharedInstanceExists();
+ static JSGlobalData& sharedInstance();
+
+ static PassRefPtr<JSGlobalData> create(ThreadStackType);
+ static PassRefPtr<JSGlobalData> createLeaked(ThreadStackType);
+ static PassRefPtr<JSGlobalData> createContextGroup(ThreadStackType);
+ ~JSGlobalData();
+
+#if ENABLE(JSC_MULTIPLE_THREADS)
+ // Will start tracking threads that use the heap, which is resource-heavy.
+ void makeUsableFromMultipleThreads() { heap.makeUsableFromMultipleThreads(); }
+#endif
+
+ GlobalDataType globalDataType;
+ ClientData* clientData;
+
+ const HashTable* arrayTable;
+ const HashTable* dateTable;
+ const HashTable* jsonTable;
+ const HashTable* mathTable;
+ const HashTable* numberTable;
+ const HashTable* regExpTable;
+ const HashTable* regExpConstructorTable;
+ const HashTable* stringTable;
+
+ RefPtr<Structure> activationStructure;
+ RefPtr<Structure> interruptedExecutionErrorStructure;
+ RefPtr<Structure> terminatedExecutionErrorStructure;
+ RefPtr<Structure> staticScopeStructure;
+ RefPtr<Structure> strictEvalActivationStructure;
+ RefPtr<Structure> stringStructure;
+ RefPtr<Structure> notAnObjectStructure;
+ RefPtr<Structure> propertyNameIteratorStructure;
+ RefPtr<Structure> getterSetterStructure;
+ RefPtr<Structure> apiWrapperStructure;
+ RefPtr<Structure> dummyMarkableCellStructure;
+
+ static void storeVPtrs();
+ static JS_EXPORTDATA void* jsArrayVPtr;
+ static JS_EXPORTDATA void* jsByteArrayVPtr;
+ static JS_EXPORTDATA void* jsStringVPtr;
+ static JS_EXPORTDATA void* jsFunctionVPtr;
+
+ IdentifierTable* identifierTable;
+ CommonIdentifiers* propertyNames;
+ const MarkedArgumentBuffer* emptyList; // Lists are supposed to be allocated on the stack to have their elements properly marked, which is not the case here - but this list has nothing to mark.
+ SmallStrings smallStrings;
+ NumericStrings numericStrings;
+ DateInstanceCache dateInstanceCache;
+
+#if ENABLE(ASSEMBLER)
+ ExecutableAllocator executableAllocator;
+ ExecutableAllocator regexAllocator;
+#endif
+
+#if !ENABLE(JIT)
+ bool canUseJIT() { return false; } // interpreter only
+#elif !ENABLE(INTERPRETER)
+ bool canUseJIT() { return true; } // jit only
+#else
+ bool canUseJIT() { return m_canUseJIT; }
+#endif
+
+ const StackBounds& stack()
+ {
+ return (globalDataType == Default)
+ ? m_stack
+ : wtfThreadData().stack();
+ }
+
+ Lexer* lexer;
+ Parser* parser;
+ Interpreter* interpreter;
+#if ENABLE(JIT)
+ OwnPtr<JITThunks> jitStubs;
+ MacroAssemblerCodePtr getCTIStub(ThunkGenerator generator)
+ {
+ return jitStubs->ctiStub(this, generator);
+ }
+ PassRefPtr<NativeExecutable> getHostFunction(NativeFunction function);
+ PassRefPtr<NativeExecutable> getHostFunction(NativeFunction function, ThunkGenerator generator);
+#endif
+ TimeoutChecker timeoutChecker;
+ Terminator terminator;
+ Heap heap;
+
+ JSValue exception;
+#if ENABLE(JIT)
+ ReturnAddressPtr exceptionLocation;
+#endif
+
+ HashMap<OpaqueJSClass*, OpaqueJSClassContextData*> opaqueJSClassData;
+
+ JSGlobalObject* head;
+ JSGlobalObject* dynamicGlobalObject;
+
+ HashSet<JSObject*> arrayVisitedElements;
+
+ Stringifier* firstStringifierToMark;
+
+ MarkStack markStack;
+
+ double cachedUTCOffset;
+ DSTOffsetCache dstOffsetCache;
+
+ UString cachedDateString;
+ double cachedDateStringValue;
+
+ int maxReentryDepth;
+
+ RegExpCache* m_regExpCache;
+
+ BumpPointerAllocator m_regexAllocator;
+
+#if ENABLE(REGEXP_TRACING)
+ typedef ListHashSet<RefPtr<RegExp> > RTTraceList;
+ RTTraceList* m_rtTraceList;
+#endif
+
+#ifndef NDEBUG
+ ThreadIdentifier exclusiveThread;
+#endif
+
+ CachedTranscendentalFunction<sin> cachedSin;
+
+ void resetDateCache();
+
+ void startSampling();
+ void stopSampling();
+ void dumpSampleData(ExecState* exec);
+ void recompileAllJSFunctions();
+ RegExpCache* regExpCache() { return m_regExpCache; }
+#if ENABLE(REGEXP_TRACING)
+ void addRegExpToTrace(PassRefPtr<RegExp> regExp);
+#endif
+ void dumpRegExpTrace();
+ private:
+ JSGlobalData(GlobalDataType, ThreadStackType);
+ static JSGlobalData*& sharedInstanceInternal();
+ void createNativeThunk();
+#if ENABLE(JIT) && ENABLE(INTERPRETER)
+ bool m_canUseJIT;
+#endif
+ StackBounds m_stack;
+ };
+
+} // namespace JSC
+
+#endif // JSGlobalData_h
diff --git a/Source/JavaScriptCore/runtime/JSGlobalObject.cpp b/Source/JavaScriptCore/runtime/JSGlobalObject.cpp
new file mode 100644
index 0000000..408aea7
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/JSGlobalObject.cpp
@@ -0,0 +1,476 @@
+/*
+ * Copyright (C) 2007, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2008 Cameron Zwarich (cwzwarich@uwaterloo.ca)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JSGlobalObject.h"
+
+#include "JSCallbackConstructor.h"
+#include "JSCallbackFunction.h"
+#include "JSCallbackObject.h"
+
+#include "Arguments.h"
+#include "ArrayConstructor.h"
+#include "ArrayPrototype.h"
+#include "BooleanConstructor.h"
+#include "BooleanPrototype.h"
+#include "CodeBlock.h"
+#include "DateConstructor.h"
+#include "DatePrototype.h"
+#include "ErrorConstructor.h"
+#include "ErrorPrototype.h"
+#include "FunctionConstructor.h"
+#include "FunctionPrototype.h"
+#include "GlobalEvalFunction.h"
+#include "JSFunction.h"
+#include "JSGlobalObjectFunctions.h"
+#include "JSLock.h"
+#include "JSONObject.h"
+#include "Interpreter.h"
+#include "MathObject.h"
+#include "NativeErrorConstructor.h"
+#include "NativeErrorPrototype.h"
+#include "NumberConstructor.h"
+#include "NumberPrototype.h"
+#include "ObjectConstructor.h"
+#include "ObjectPrototype.h"
+#include "Profiler.h"
+#include "PrototypeFunction.h"
+#include "RegExpConstructor.h"
+#include "RegExpMatchesArray.h"
+#include "RegExpObject.h"
+#include "RegExpPrototype.h"
+#include "ScopeChainMark.h"
+#include "StringConstructor.h"
+#include "StringPrototype.h"
+#include "Debugger.h"
+
+namespace JSC {
+
+ASSERT_CLASS_FITS_IN_CELL(JSGlobalObject);
+
+// Default number of ticks before a timeout check should be done.
+static const int initialTickCountThreshold = 255;
+
+// Preferred number of milliseconds between each timeout check
+static const int preferredScriptCheckTimeInterval = 1000;
+
+static inline void markIfNeeded(MarkStack& markStack, JSValue v)
+{
+ if (v)
+ markStack.append(v);
+}
+
+static inline void markIfNeeded(MarkStack& markStack, const RefPtr<Structure>& s)
+{
+ if (s)
+ markIfNeeded(markStack, s->storedPrototype());
+}
+
+JSGlobalObject::~JSGlobalObject()
+{
+ ASSERT(JSLock::currentThreadIsHoldingLock());
+
+ if (d()->debugger)
+ d()->debugger->detach(this);
+
+ Profiler** profiler = Profiler::enabledProfilerReference();
+ if (UNLIKELY(*profiler != 0)) {
+ (*profiler)->stopProfiling(globalExec(), UString());
+ }
+
+ d()->next->d()->prev = d()->prev;
+ d()->prev->d()->next = d()->next;
+ JSGlobalObject*& headObject = head();
+ if (headObject == this)
+ headObject = d()->next;
+ if (headObject == this)
+ headObject = 0;
+
+ HashSet<GlobalCodeBlock*>::const_iterator end = codeBlocks().end();
+ for (HashSet<GlobalCodeBlock*>::const_iterator it = codeBlocks().begin(); it != end; ++it)
+ (*it)->clearGlobalObject();
+
+ RegisterFile& registerFile = globalData().interpreter->registerFile();
+ if (registerFile.clearGlobalObject(this))
+ registerFile.setNumGlobals(0);
+ d()->destructor(d());
+}
+
+void JSGlobalObject::init(JSObject* thisValue)
+{
+ ASSERT(JSLock::currentThreadIsHoldingLock());
+
+ structure()->disableSpecificFunctionTracking();
+
+ d()->globalData = Heap::heap(this)->globalData();
+ d()->globalScopeChain = ScopeChain(this, d()->globalData.get(), this, thisValue);
+
+ JSGlobalObject::globalExec()->init(0, 0, d()->globalScopeChain.node(), CallFrame::noCaller(), 0, 0);
+
+ if (JSGlobalObject*& headObject = head()) {
+ d()->prev = headObject;
+ d()->next = headObject->d()->next;
+ headObject->d()->next->d()->prev = this;
+ headObject->d()->next = this;
+ } else
+ headObject = d()->next = d()->prev = this;
+
+ d()->debugger = 0;
+
+ d()->profileGroup = 0;
+
+ reset(prototype());
+}
+
+void JSGlobalObject::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
+{
+ ASSERT(!Heap::heap(value) || Heap::heap(value) == Heap::heap(this));
+
+ if (symbolTablePut(propertyName, value))
+ return;
+ JSVariableObject::put(exec, propertyName, value, slot);
+}
+
+void JSGlobalObject::putWithAttributes(ExecState* exec, const Identifier& propertyName, JSValue value, unsigned attributes)
+{
+ ASSERT(!Heap::heap(value) || Heap::heap(value) == Heap::heap(this));
+
+ if (symbolTablePutWithAttributes(propertyName, value, attributes))
+ return;
+
+ JSValue valueBefore = getDirect(propertyName);
+ PutPropertySlot slot;
+ JSVariableObject::put(exec, propertyName, value, slot);
+ if (!valueBefore) {
+ JSValue valueAfter = getDirect(propertyName);
+ if (valueAfter)
+ JSObject::putWithAttributes(exec, propertyName, valueAfter, attributes);
+ }
+}
+
+void JSGlobalObject::defineGetter(ExecState* exec, const Identifier& propertyName, JSObject* getterFunc, unsigned attributes)
+{
+ PropertySlot slot;
+ if (!symbolTableGet(propertyName, slot))
+ JSVariableObject::defineGetter(exec, propertyName, getterFunc, attributes);
+}
+
+void JSGlobalObject::defineSetter(ExecState* exec, const Identifier& propertyName, JSObject* setterFunc, unsigned attributes)
+{
+ PropertySlot slot;
+ if (!symbolTableGet(propertyName, slot))
+ JSVariableObject::defineSetter(exec, propertyName, setterFunc, attributes);
+}
+
+static inline JSObject* lastInPrototypeChain(JSObject* object)
+{
+ JSObject* o = object;
+ while (o->prototype().isObject())
+ o = asObject(o->prototype());
+ return o;
+}
+
+void JSGlobalObject::reset(JSValue prototype)
+{
+ ExecState* exec = JSGlobalObject::globalExec();
+
+ // Prototypes
+
+ d()->functionPrototype = new (exec) FunctionPrototype(exec, this, FunctionPrototype::createStructure(jsNull())); // The real prototype will be set once ObjectPrototype is created.
+ d()->prototypeFunctionStructure = PrototypeFunction::createStructure(d()->functionPrototype);
+ d()->internalFunctionStructure = InternalFunction::createStructure(d()->functionPrototype);
+ NativeFunctionWrapper* callFunction = 0;
+ NativeFunctionWrapper* applyFunction = 0;
+ d()->functionPrototype->addFunctionProperties(exec, this, d()->prototypeFunctionStructure.get(), &callFunction, &applyFunction);
+ d()->callFunction = callFunction;
+ d()->applyFunction = applyFunction;
+ d()->objectPrototype = new (exec) ObjectPrototype(exec, this, ObjectPrototype::createStructure(jsNull()), d()->prototypeFunctionStructure.get());
+ d()->functionPrototype->structure()->setPrototypeWithoutTransition(d()->objectPrototype);
+
+ d()->emptyObjectStructure = d()->objectPrototype->inheritorID();
+
+ d()->functionStructure = JSFunction::createStructure(d()->functionPrototype);
+ d()->callbackFunctionStructure = JSCallbackFunction::createStructure(d()->functionPrototype);
+ d()->argumentsStructure = Arguments::createStructure(d()->objectPrototype);
+ d()->callbackConstructorStructure = JSCallbackConstructor::createStructure(d()->objectPrototype);
+ d()->callbackObjectStructure = JSCallbackObject<JSObjectWithGlobalObject>::createStructure(d()->objectPrototype);
+
+ d()->arrayPrototype = new (exec) ArrayPrototype(this, ArrayPrototype::createStructure(d()->objectPrototype));
+ d()->arrayStructure = JSArray::createStructure(d()->arrayPrototype);
+ d()->regExpMatchesArrayStructure = RegExpMatchesArray::createStructure(d()->arrayPrototype);
+
+ d()->stringPrototype = new (exec) StringPrototype(exec, this, StringPrototype::createStructure(d()->objectPrototype));
+ d()->stringObjectStructure = StringObject::createStructure(d()->stringPrototype);
+
+ d()->booleanPrototype = new (exec) BooleanPrototype(exec, this, BooleanPrototype::createStructure(d()->objectPrototype), d()->prototypeFunctionStructure.get());
+ d()->booleanObjectStructure = BooleanObject::createStructure(d()->booleanPrototype);
+
+ d()->numberPrototype = new (exec) NumberPrototype(exec, this, NumberPrototype::createStructure(d()->objectPrototype), d()->prototypeFunctionStructure.get());
+ d()->numberObjectStructure = NumberObject::createStructure(d()->numberPrototype);
+
+ d()->datePrototype = new (exec) DatePrototype(exec, this, DatePrototype::createStructure(d()->objectPrototype));
+ d()->dateStructure = DateInstance::createStructure(d()->datePrototype);
+
+ d()->regExpPrototype = new (exec) RegExpPrototype(exec, this, RegExpPrototype::createStructure(d()->objectPrototype), d()->prototypeFunctionStructure.get());
+ d()->regExpStructure = RegExpObject::createStructure(d()->regExpPrototype);
+
+ d()->methodCallDummy = constructEmptyObject(exec);
+
+ ErrorPrototype* errorPrototype = new (exec) ErrorPrototype(exec, this, ErrorPrototype::createStructure(d()->objectPrototype), d()->prototypeFunctionStructure.get());
+ d()->errorStructure = ErrorInstance::createStructure(errorPrototype);
+
+ // Constructors
+
+ JSCell* objectConstructor = new (exec) ObjectConstructor(exec, this, ObjectConstructor::createStructure(d()->functionPrototype), d()->objectPrototype, d()->prototypeFunctionStructure.get());
+ JSCell* functionConstructor = new (exec) FunctionConstructor(exec, this, FunctionConstructor::createStructure(d()->functionPrototype), d()->functionPrototype);
+ JSCell* arrayConstructor = new (exec) ArrayConstructor(exec, this, ArrayConstructor::createStructure(d()->functionPrototype), d()->arrayPrototype, d()->prototypeFunctionStructure.get());
+ JSCell* stringConstructor = new (exec) StringConstructor(exec, this, StringConstructor::createStructure(d()->functionPrototype), d()->prototypeFunctionStructure.get(), d()->stringPrototype);
+ JSCell* booleanConstructor = new (exec) BooleanConstructor(exec, this, BooleanConstructor::createStructure(d()->functionPrototype), d()->booleanPrototype);
+ JSCell* numberConstructor = new (exec) NumberConstructor(exec, this, NumberConstructor::createStructure(d()->functionPrototype), d()->numberPrototype);
+ JSCell* dateConstructor = new (exec) DateConstructor(exec, this, DateConstructor::createStructure(d()->functionPrototype), d()->prototypeFunctionStructure.get(), d()->datePrototype);
+
+ d()->regExpConstructor = new (exec) RegExpConstructor(exec, this, RegExpConstructor::createStructure(d()->functionPrototype), d()->regExpPrototype);
+
+ d()->errorConstructor = new (exec) ErrorConstructor(exec, this, ErrorConstructor::createStructure(d()->functionPrototype), errorPrototype);
+
+ RefPtr<Structure> nativeErrorPrototypeStructure = NativeErrorPrototype::createStructure(errorPrototype);
+ RefPtr<Structure> nativeErrorStructure = NativeErrorConstructor::createStructure(d()->functionPrototype);
+ d()->evalErrorConstructor = new (exec) NativeErrorConstructor(exec, this, nativeErrorStructure, nativeErrorPrototypeStructure, "EvalError");
+ d()->rangeErrorConstructor = new (exec) NativeErrorConstructor(exec, this, nativeErrorStructure, nativeErrorPrototypeStructure, "RangeError");
+ d()->referenceErrorConstructor = new (exec) NativeErrorConstructor(exec, this, nativeErrorStructure, nativeErrorPrototypeStructure, "ReferenceError");
+ d()->syntaxErrorConstructor = new (exec) NativeErrorConstructor(exec, this, nativeErrorStructure, nativeErrorPrototypeStructure, "SyntaxError");
+ d()->typeErrorConstructor = new (exec) NativeErrorConstructor(exec, this, nativeErrorStructure, nativeErrorPrototypeStructure, "TypeError");
+ d()->URIErrorConstructor = new (exec) NativeErrorConstructor(exec, this, nativeErrorStructure, nativeErrorPrototypeStructure, "URIError");
+
+ d()->objectPrototype->putDirectFunctionWithoutTransition(exec->propertyNames().constructor, objectConstructor, DontEnum);
+ d()->functionPrototype->putDirectFunctionWithoutTransition(exec->propertyNames().constructor, functionConstructor, DontEnum);
+ d()->arrayPrototype->putDirectFunctionWithoutTransition(exec->propertyNames().constructor, arrayConstructor, DontEnum);
+ d()->booleanPrototype->putDirectFunctionWithoutTransition(exec->propertyNames().constructor, booleanConstructor, DontEnum);
+ d()->stringPrototype->putDirectFunctionWithoutTransition(exec->propertyNames().constructor, stringConstructor, DontEnum);
+ d()->numberPrototype->putDirectFunctionWithoutTransition(exec->propertyNames().constructor, numberConstructor, DontEnum);
+ d()->datePrototype->putDirectFunctionWithoutTransition(exec->propertyNames().constructor, dateConstructor, DontEnum);
+ d()->regExpPrototype->putDirectFunctionWithoutTransition(exec->propertyNames().constructor, d()->regExpConstructor, DontEnum);
+ errorPrototype->putDirectFunctionWithoutTransition(exec->propertyNames().constructor, d()->errorConstructor, DontEnum);
+
+ // Set global constructors
+
+ // FIXME: These properties could be handled by a static hash table.
+
+ putDirectFunctionWithoutTransition(Identifier(exec, "Object"), objectConstructor, DontEnum);
+ putDirectFunctionWithoutTransition(Identifier(exec, "Function"), functionConstructor, DontEnum);
+ putDirectFunctionWithoutTransition(Identifier(exec, "Array"), arrayConstructor, DontEnum);
+ putDirectFunctionWithoutTransition(Identifier(exec, "Boolean"), booleanConstructor, DontEnum);
+ putDirectFunctionWithoutTransition(Identifier(exec, "String"), stringConstructor, DontEnum);
+ putDirectFunctionWithoutTransition(Identifier(exec, "Number"), numberConstructor, DontEnum);
+ putDirectFunctionWithoutTransition(Identifier(exec, "Date"), dateConstructor, DontEnum);
+ putDirectFunctionWithoutTransition(Identifier(exec, "RegExp"), d()->regExpConstructor, DontEnum);
+ putDirectFunctionWithoutTransition(Identifier(exec, "Error"), d()->errorConstructor, DontEnum);
+ putDirectFunctionWithoutTransition(Identifier(exec, "EvalError"), d()->evalErrorConstructor, DontEnum);
+ putDirectFunctionWithoutTransition(Identifier(exec, "RangeError"), d()->rangeErrorConstructor, DontEnum);
+ putDirectFunctionWithoutTransition(Identifier(exec, "ReferenceError"), d()->referenceErrorConstructor, DontEnum);
+ putDirectFunctionWithoutTransition(Identifier(exec, "SyntaxError"), d()->syntaxErrorConstructor, DontEnum);
+ putDirectFunctionWithoutTransition(Identifier(exec, "TypeError"), d()->typeErrorConstructor, DontEnum);
+ putDirectFunctionWithoutTransition(Identifier(exec, "URIError"), d()->URIErrorConstructor, DontEnum);
+
+ // Set global values.
+ GlobalPropertyInfo staticGlobals[] = {
+ GlobalPropertyInfo(Identifier(exec, "Math"), new (exec) MathObject(exec, this, MathObject::createStructure(d()->objectPrototype)), DontEnum | DontDelete),
+ GlobalPropertyInfo(Identifier(exec, "NaN"), jsNaN(), DontEnum | DontDelete | ReadOnly),
+ GlobalPropertyInfo(Identifier(exec, "Infinity"), jsNumber(Inf), DontEnum | DontDelete | ReadOnly),
+ GlobalPropertyInfo(Identifier(exec, "undefined"), jsUndefined(), DontEnum | DontDelete | ReadOnly),
+ GlobalPropertyInfo(Identifier(exec, "JSON"), new (exec) JSONObject(this, JSONObject::createStructure(d()->objectPrototype)), DontEnum | DontDelete)
+ };
+
+ addStaticGlobals(staticGlobals, WTF_ARRAY_LENGTH(staticGlobals));
+
+ // Set global functions.
+
+ d()->evalFunction = new (exec) GlobalEvalFunction(exec, this, GlobalEvalFunction::createStructure(d()->functionPrototype), 1, exec->propertyNames().eval, globalFuncEval, this);
+ putDirectFunctionWithoutTransition(exec, d()->evalFunction, DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, this, d()->prototypeFunctionStructure.get(), 2, Identifier(exec, "parseInt"), globalFuncParseInt), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, this, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "parseFloat"), globalFuncParseFloat), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, this, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "isNaN"), globalFuncIsNaN), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, this, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "isFinite"), globalFuncIsFinite), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, this, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "escape"), globalFuncEscape), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, this, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "unescape"), globalFuncUnescape), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, this, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "decodeURI"), globalFuncDecodeURI), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, this, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "decodeURIComponent"), globalFuncDecodeURIComponent), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, this, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "encodeURI"), globalFuncEncodeURI), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, this, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "encodeURIComponent"), globalFuncEncodeURIComponent), DontEnum);
+#ifndef NDEBUG
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, this, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "jscprint"), globalFuncJSCPrint), DontEnum);
+#endif
+
+ resetPrototype(prototype);
+}
+
+// Set prototype, and also insert the object prototype at the end of the chain.
+void JSGlobalObject::resetPrototype(JSValue prototype)
+{
+ setPrototype(prototype);
+
+ JSObject* oldLastInPrototypeChain = lastInPrototypeChain(this);
+ JSObject* objectPrototype = d()->objectPrototype;
+ if (oldLastInPrototypeChain != objectPrototype)
+ oldLastInPrototypeChain->setPrototype(objectPrototype);
+}
+
+void JSGlobalObject::markChildren(MarkStack& markStack)
+{
+ JSVariableObject::markChildren(markStack);
+
+ HashSet<GlobalCodeBlock*>::const_iterator end = codeBlocks().end();
+ for (HashSet<GlobalCodeBlock*>::const_iterator it = codeBlocks().begin(); it != end; ++it)
+ (*it)->markAggregate(markStack);
+
+ RegisterFile& registerFile = globalData().interpreter->registerFile();
+ if (registerFile.globalObject() == this)
+ registerFile.markGlobals(markStack, &globalData().heap);
+
+ markIfNeeded(markStack, d()->regExpConstructor);
+ markIfNeeded(markStack, d()->errorConstructor);
+ markIfNeeded(markStack, d()->evalErrorConstructor);
+ markIfNeeded(markStack, d()->rangeErrorConstructor);
+ markIfNeeded(markStack, d()->referenceErrorConstructor);
+ markIfNeeded(markStack, d()->syntaxErrorConstructor);
+ markIfNeeded(markStack, d()->typeErrorConstructor);
+ markIfNeeded(markStack, d()->URIErrorConstructor);
+
+ markIfNeeded(markStack, d()->evalFunction);
+ markIfNeeded(markStack, d()->callFunction);
+ markIfNeeded(markStack, d()->applyFunction);
+
+ markIfNeeded(markStack, d()->objectPrototype);
+ markIfNeeded(markStack, d()->functionPrototype);
+ markIfNeeded(markStack, d()->arrayPrototype);
+ markIfNeeded(markStack, d()->booleanPrototype);
+ markIfNeeded(markStack, d()->stringPrototype);
+ markIfNeeded(markStack, d()->numberPrototype);
+ markIfNeeded(markStack, d()->datePrototype);
+ markIfNeeded(markStack, d()->regExpPrototype);
+
+ markIfNeeded(markStack, d()->methodCallDummy);
+
+ markIfNeeded(markStack, d()->errorStructure);
+ markIfNeeded(markStack, d()->argumentsStructure);
+ markIfNeeded(markStack, d()->arrayStructure);
+ markIfNeeded(markStack, d()->booleanObjectStructure);
+ markIfNeeded(markStack, d()->callbackConstructorStructure);
+ markIfNeeded(markStack, d()->callbackFunctionStructure);
+ markIfNeeded(markStack, d()->callbackObjectStructure);
+ markIfNeeded(markStack, d()->dateStructure);
+ markIfNeeded(markStack, d()->emptyObjectStructure);
+ markIfNeeded(markStack, d()->errorStructure);
+ markIfNeeded(markStack, d()->functionStructure);
+ markIfNeeded(markStack, d()->numberObjectStructure);
+ markIfNeeded(markStack, d()->prototypeFunctionStructure);
+ markIfNeeded(markStack, d()->regExpMatchesArrayStructure);
+ markIfNeeded(markStack, d()->regExpStructure);
+ markIfNeeded(markStack, d()->stringObjectStructure);
+
+ // No need to mark the other structures, because their prototypes are all
+ // guaranteed to be referenced elsewhere.
+
+ Register* registerArray = d()->registerArray.get();
+ if (!registerArray)
+ return;
+
+ size_t size = d()->registerArraySize;
+ markStack.appendValues(reinterpret_cast<JSValue*>(registerArray), size);
+}
+
+ExecState* JSGlobalObject::globalExec()
+{
+ return CallFrame::create(d()->globalCallFrame + RegisterFile::CallFrameHeaderSize);
+}
+
+bool JSGlobalObject::isDynamicScope(bool&) const
+{
+ return true;
+}
+
+void JSGlobalObject::copyGlobalsFrom(RegisterFile& registerFile)
+{
+ ASSERT(!d()->registerArray);
+ ASSERT(!d()->registerArraySize);
+
+ int numGlobals = registerFile.numGlobals();
+ if (!numGlobals) {
+ d()->registers = 0;
+ return;
+ }
+
+ Register* registerArray = copyRegisterArray(registerFile.lastGlobal(), numGlobals);
+ setRegisters(registerArray + numGlobals, registerArray, numGlobals);
+}
+
+void JSGlobalObject::copyGlobalsTo(RegisterFile& registerFile)
+{
+ JSGlobalObject* lastGlobalObject = registerFile.globalObject();
+ if (lastGlobalObject && lastGlobalObject != this)
+ lastGlobalObject->copyGlobalsFrom(registerFile);
+
+ registerFile.setGlobalObject(this);
+ registerFile.setNumGlobals(symbolTable().size());
+
+ if (d()->registerArray) {
+ memcpy(registerFile.start() - d()->registerArraySize, d()->registerArray.get(), d()->registerArraySize * sizeof(Register));
+ setRegisters(registerFile.start(), 0, 0);
+ }
+}
+
+void* JSGlobalObject::operator new(size_t size, JSGlobalData* globalData)
+{
+ return globalData->heap.allocate(size);
+}
+
+void JSGlobalObject::destroyJSGlobalObjectData(void* jsGlobalObjectData)
+{
+ delete static_cast<JSGlobalObjectData*>(jsGlobalObjectData);
+}
+
+DynamicGlobalObjectScope::DynamicGlobalObjectScope(CallFrame* callFrame, JSGlobalObject* dynamicGlobalObject)
+ : m_dynamicGlobalObjectSlot(callFrame->globalData().dynamicGlobalObject)
+ , m_savedDynamicGlobalObject(m_dynamicGlobalObjectSlot)
+{
+ if (!m_dynamicGlobalObjectSlot) {
+#if ENABLE(ASSEMBLER)
+ if (ExecutableAllocator::underMemoryPressure())
+ callFrame->globalData().recompileAllJSFunctions();
+#endif
+
+ m_dynamicGlobalObjectSlot = dynamicGlobalObject;
+
+ // Reset the date cache between JS invocations to force the VM
+ // to observe time zone changes.
+ callFrame->globalData().resetDateCache();
+ }
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/JSGlobalObject.h b/Source/JavaScriptCore/runtime/JSGlobalObject.h
new file mode 100644
index 0000000..a22b0aa
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/JSGlobalObject.h
@@ -0,0 +1,484 @@
+/*
+ * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
+ * Copyright (C) 2007, 2008, 2009 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef JSGlobalObject_h
+#define JSGlobalObject_h
+
+#include "JSArray.h"
+#include "JSGlobalData.h"
+#include "JSVariableObject.h"
+#include "JSWeakObjectMapRefInternal.h"
+#include "NativeFunctionWrapper.h"
+#include "NumberPrototype.h"
+#include "StringPrototype.h"
+#include <wtf/HashSet.h>
+#include <wtf/OwnPtr.h>
+#include <wtf/RandomNumber.h>
+
+namespace JSC {
+
+ class ArrayPrototype;
+ class BooleanPrototype;
+ class DatePrototype;
+ class Debugger;
+ class ErrorConstructor;
+ class FunctionPrototype;
+ class GlobalCodeBlock;
+ class GlobalEvalFunction;
+ class NativeErrorConstructor;
+ class ProgramCodeBlock;
+ class PrototypeFunction;
+ class RegExpConstructor;
+ class RegExpPrototype;
+ class RegisterFile;
+
+ struct ActivationStackNode;
+ struct HashTable;
+
+ typedef Vector<ExecState*, 16> ExecStateStack;
+
+ class JSGlobalObject : public JSVariableObject {
+ protected:
+ using JSVariableObject::JSVariableObjectData;
+ typedef HashSet<RefPtr<OpaqueJSWeakObjectMap> > WeakMapSet;
+
+ struct JSGlobalObjectData : public JSVariableObjectData {
+ // We use an explicit destructor function pointer instead of a
+ // virtual destructor because we want to avoid adding a vtable
+ // pointer to this struct. Adding a vtable pointer would force the
+ // compiler to emit costly pointer fixup code when casting from
+ // JSVariableObjectData* to JSGlobalObjectData*.
+ typedef void (*Destructor)(void*);
+
+ JSGlobalObjectData(Destructor destructor)
+ : JSVariableObjectData(&symbolTable, 0)
+ , destructor(destructor)
+ , registerArraySize(0)
+ , globalScopeChain(NoScopeChain())
+ , regExpConstructor(0)
+ , errorConstructor(0)
+ , evalErrorConstructor(0)
+ , rangeErrorConstructor(0)
+ , referenceErrorConstructor(0)
+ , syntaxErrorConstructor(0)
+ , typeErrorConstructor(0)
+ , URIErrorConstructor(0)
+ , evalFunction(0)
+ , callFunction(0)
+ , applyFunction(0)
+ , objectPrototype(0)
+ , functionPrototype(0)
+ , arrayPrototype(0)
+ , booleanPrototype(0)
+ , stringPrototype(0)
+ , numberPrototype(0)
+ , datePrototype(0)
+ , regExpPrototype(0)
+ , methodCallDummy(0)
+ , weakRandom(static_cast<unsigned>(randomNumber() * (std::numeric_limits<unsigned>::max() + 1.0)))
+ {
+ }
+
+ Destructor destructor;
+
+ size_t registerArraySize;
+
+ JSGlobalObject* next;
+ JSGlobalObject* prev;
+
+ Debugger* debugger;
+
+ ScopeChain globalScopeChain;
+ Register globalCallFrame[RegisterFile::CallFrameHeaderSize];
+
+ RegExpConstructor* regExpConstructor;
+ ErrorConstructor* errorConstructor;
+ NativeErrorConstructor* evalErrorConstructor;
+ NativeErrorConstructor* rangeErrorConstructor;
+ NativeErrorConstructor* referenceErrorConstructor;
+ NativeErrorConstructor* syntaxErrorConstructor;
+ NativeErrorConstructor* typeErrorConstructor;
+ NativeErrorConstructor* URIErrorConstructor;
+
+ GlobalEvalFunction* evalFunction;
+ NativeFunctionWrapper* callFunction;
+ NativeFunctionWrapper* applyFunction;
+
+ ObjectPrototype* objectPrototype;
+ FunctionPrototype* functionPrototype;
+ ArrayPrototype* arrayPrototype;
+ BooleanPrototype* booleanPrototype;
+ StringPrototype* stringPrototype;
+ NumberPrototype* numberPrototype;
+ DatePrototype* datePrototype;
+ RegExpPrototype* regExpPrototype;
+
+ JSObject* methodCallDummy;
+
+ RefPtr<Structure> argumentsStructure;
+ RefPtr<Structure> arrayStructure;
+ RefPtr<Structure> booleanObjectStructure;
+ RefPtr<Structure> callbackConstructorStructure;
+ RefPtr<Structure> callbackFunctionStructure;
+ RefPtr<Structure> callbackObjectStructure;
+ RefPtr<Structure> dateStructure;
+ RefPtr<Structure> emptyObjectStructure;
+ RefPtr<Structure> errorStructure;
+ RefPtr<Structure> functionStructure;
+ RefPtr<Structure> numberObjectStructure;
+ RefPtr<Structure> prototypeFunctionStructure;
+ RefPtr<Structure> regExpMatchesArrayStructure;
+ RefPtr<Structure> regExpStructure;
+ RefPtr<Structure> stringObjectStructure;
+ RefPtr<Structure> internalFunctionStructure;
+
+ SymbolTable symbolTable;
+ unsigned profileGroup;
+
+ RefPtr<JSGlobalData> globalData;
+
+ HashSet<GlobalCodeBlock*> codeBlocks;
+ WeakMapSet weakMaps;
+ WeakRandom weakRandom;
+ };
+
+ public:
+ void* operator new(size_t, JSGlobalData*);
+
+ explicit JSGlobalObject()
+ : JSVariableObject(JSGlobalObject::createStructure(jsNull()), new JSGlobalObjectData(destroyJSGlobalObjectData))
+ {
+ COMPILE_ASSERT(JSGlobalObject::AnonymousSlotCount == 1, JSGlobalObject_has_only_a_single_slot);
+ putAnonymousValue(0, this);
+ init(this);
+ }
+
+ explicit JSGlobalObject(NonNullPassRefPtr<Structure> structure)
+ : JSVariableObject(structure, new JSGlobalObjectData(destroyJSGlobalObjectData))
+ {
+ COMPILE_ASSERT(JSGlobalObject::AnonymousSlotCount == 1, JSGlobalObject_has_only_a_single_slot);
+ putAnonymousValue(0, this);
+ init(this);
+ }
+
+ protected:
+ JSGlobalObject(NonNullPassRefPtr<Structure> structure, JSGlobalObjectData* data, JSObject* thisValue)
+ : JSVariableObject(structure, data)
+ {
+ COMPILE_ASSERT(JSGlobalObject::AnonymousSlotCount == 1, JSGlobalObject_has_only_a_single_slot);
+ putAnonymousValue(0, this);
+ init(thisValue);
+ }
+
+ public:
+ virtual ~JSGlobalObject();
+
+ virtual void markChildren(MarkStack&);
+
+ virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
+ virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
+ virtual bool hasOwnPropertyForWrite(ExecState*, const Identifier&);
+ virtual void put(ExecState*, const Identifier&, JSValue, PutPropertySlot&);
+ virtual void putWithAttributes(ExecState*, const Identifier& propertyName, JSValue value, unsigned attributes);
+
+ virtual void defineGetter(ExecState*, const Identifier& propertyName, JSObject* getterFunc, unsigned attributes);
+ virtual void defineSetter(ExecState*, const Identifier& propertyName, JSObject* setterFunc, unsigned attributes);
+
+ // Linked list of all global objects that use the same JSGlobalData.
+ JSGlobalObject*& head() { return d()->globalData->head; }
+ JSGlobalObject* next() { return d()->next; }
+
+ // The following accessors return pristine values, even if a script
+ // replaces the global object's associated property.
+
+ RegExpConstructor* regExpConstructor() const { return d()->regExpConstructor; }
+
+ ErrorConstructor* errorConstructor() const { return d()->errorConstructor; }
+ NativeErrorConstructor* evalErrorConstructor() const { return d()->evalErrorConstructor; }
+ NativeErrorConstructor* rangeErrorConstructor() const { return d()->rangeErrorConstructor; }
+ NativeErrorConstructor* referenceErrorConstructor() const { return d()->referenceErrorConstructor; }
+ NativeErrorConstructor* syntaxErrorConstructor() const { return d()->syntaxErrorConstructor; }
+ NativeErrorConstructor* typeErrorConstructor() const { return d()->typeErrorConstructor; }
+ NativeErrorConstructor* URIErrorConstructor() const { return d()->URIErrorConstructor; }
+
+ GlobalEvalFunction* evalFunction() const { return d()->evalFunction; }
+
+ ObjectPrototype* objectPrototype() const { return d()->objectPrototype; }
+ FunctionPrototype* functionPrototype() const { return d()->functionPrototype; }
+ ArrayPrototype* arrayPrototype() const { return d()->arrayPrototype; }
+ BooleanPrototype* booleanPrototype() const { return d()->booleanPrototype; }
+ StringPrototype* stringPrototype() const { return d()->stringPrototype; }
+ NumberPrototype* numberPrototype() const { return d()->numberPrototype; }
+ DatePrototype* datePrototype() const { return d()->datePrototype; }
+ RegExpPrototype* regExpPrototype() const { return d()->regExpPrototype; }
+
+ JSObject* methodCallDummy() const { return d()->methodCallDummy; }
+
+ Structure* argumentsStructure() const { return d()->argumentsStructure.get(); }
+ Structure* arrayStructure() const { return d()->arrayStructure.get(); }
+ Structure* booleanObjectStructure() const { return d()->booleanObjectStructure.get(); }
+ Structure* callbackConstructorStructure() const { return d()->callbackConstructorStructure.get(); }
+ Structure* callbackFunctionStructure() const { return d()->callbackFunctionStructure.get(); }
+ Structure* callbackObjectStructure() const { return d()->callbackObjectStructure.get(); }
+ Structure* dateStructure() const { return d()->dateStructure.get(); }
+ Structure* emptyObjectStructure() const { return d()->emptyObjectStructure.get(); }
+ Structure* errorStructure() const { return d()->errorStructure.get(); }
+ Structure* functionStructure() const { return d()->functionStructure.get(); }
+ Structure* numberObjectStructure() const { return d()->numberObjectStructure.get(); }
+ Structure* prototypeFunctionStructure() const { return d()->prototypeFunctionStructure.get(); }
+ Structure* internalFunctionStructure() const { return d()->internalFunctionStructure.get(); }
+ Structure* regExpMatchesArrayStructure() const { return d()->regExpMatchesArrayStructure.get(); }
+ Structure* regExpStructure() const { return d()->regExpStructure.get(); }
+ Structure* stringObjectStructure() const { return d()->stringObjectStructure.get(); }
+
+ void setProfileGroup(unsigned value) { d()->profileGroup = value; }
+ unsigned profileGroup() const { return d()->profileGroup; }
+
+ Debugger* debugger() const { return d()->debugger; }
+ void setDebugger(Debugger* debugger) { d()->debugger = debugger; }
+
+ virtual bool supportsProfiling() const { return false; }
+ virtual bool supportsRichSourceInfo() const { return true; }
+
+ ScopeChain& globalScopeChain() { return d()->globalScopeChain; }
+
+ virtual bool isGlobalObject() const { return true; }
+
+ virtual ExecState* globalExec();
+
+ virtual bool shouldInterruptScript() const { return true; }
+
+ virtual bool allowsAccessFrom(const JSGlobalObject*) const { return true; }
+
+ virtual bool isDynamicScope(bool& requiresDynamicChecks) const;
+
+ HashSet<GlobalCodeBlock*>& codeBlocks() { return d()->codeBlocks; }
+
+ void copyGlobalsFrom(RegisterFile&);
+ void copyGlobalsTo(RegisterFile&);
+
+ void resetPrototype(JSValue prototype);
+
+ JSGlobalData& globalData() const { return *d()->globalData.get(); }
+ JSGlobalObjectData* d() const { return static_cast<JSGlobalObjectData*>(JSVariableObject::d); }
+
+ static PassRefPtr<Structure> createStructure(JSValue prototype)
+ {
+ return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount);
+ }
+
+ void registerWeakMap(OpaqueJSWeakObjectMap* map)
+ {
+ d()->weakMaps.add(map);
+ }
+
+ void deregisterWeakMap(OpaqueJSWeakObjectMap* map)
+ {
+ d()->weakMaps.remove(map);
+ }
+
+ double weakRandomNumber() { return d()->weakRandom.get(); }
+ protected:
+
+ static const unsigned AnonymousSlotCount = JSVariableObject::AnonymousSlotCount + 1;
+ static const unsigned StructureFlags = OverridesGetOwnPropertySlot | OverridesMarkChildren | OverridesGetPropertyNames | JSVariableObject::StructureFlags;
+
+ struct GlobalPropertyInfo {
+ GlobalPropertyInfo(const Identifier& i, JSValue v, unsigned a)
+ : identifier(i)
+ , value(v)
+ , attributes(a)
+ {
+ }
+
+ const Identifier identifier;
+ JSValue value;
+ unsigned attributes;
+ };
+ void addStaticGlobals(GlobalPropertyInfo*, int count);
+
+ private:
+ static void destroyJSGlobalObjectData(void*);
+
+ // FIXME: Fold reset into init.
+ void init(JSObject* thisValue);
+ void reset(JSValue prototype);
+
+ void setRegisters(Register* registers, Register* registerArray, size_t count);
+
+ void* operator new(size_t); // can only be allocated with JSGlobalData
+ };
+
+ JSGlobalObject* asGlobalObject(JSValue);
+
+ inline JSGlobalObject* asGlobalObject(JSValue value)
+ {
+ ASSERT(asObject(value)->isGlobalObject());
+ return static_cast<JSGlobalObject*>(asObject(value));
+ }
+
+ inline void JSGlobalObject::setRegisters(Register* registers, Register* registerArray, size_t count)
+ {
+ JSVariableObject::setRegisters(registers, registerArray);
+ d()->registerArraySize = count;
+ }
+
+ inline void JSGlobalObject::addStaticGlobals(GlobalPropertyInfo* globals, int count)
+ {
+ size_t oldSize = d()->registerArraySize;
+ size_t newSize = oldSize + count;
+ Register* registerArray = new Register[newSize];
+ if (d()->registerArray)
+ memcpy(registerArray + count, d()->registerArray.get(), oldSize * sizeof(Register));
+ setRegisters(registerArray + newSize, registerArray, newSize);
+
+ for (int i = 0, index = -static_cast<int>(oldSize) - 1; i < count; ++i, --index) {
+ GlobalPropertyInfo& global = globals[i];
+ ASSERT(global.attributes & DontDelete);
+ SymbolTableEntry newEntry(index, global.attributes);
+ symbolTable().add(global.identifier.impl(), newEntry);
+ registerAt(index) = global.value;
+ }
+ }
+
+ inline bool JSGlobalObject::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
+ {
+ if (JSVariableObject::getOwnPropertySlot(exec, propertyName, slot))
+ return true;
+ return symbolTableGet(propertyName, slot);
+ }
+
+ inline bool JSGlobalObject::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
+ {
+ if (symbolTableGet(propertyName, descriptor))
+ return true;
+ return JSVariableObject::getOwnPropertyDescriptor(exec, propertyName, descriptor);
+ }
+
+ inline bool JSGlobalObject::hasOwnPropertyForWrite(ExecState* exec, const Identifier& propertyName)
+ {
+ PropertySlot slot;
+ if (JSVariableObject::getOwnPropertySlot(exec, propertyName, slot))
+ return true;
+ bool slotIsWriteable;
+ return symbolTableGet(propertyName, slot, slotIsWriteable);
+ }
+
+ inline JSValue Structure::prototypeForLookup(ExecState* exec) const
+ {
+ if (typeInfo().type() == ObjectType)
+ return m_prototype;
+
+ ASSERT(typeInfo().type() == StringType);
+ return exec->lexicalGlobalObject()->stringPrototype();
+ }
+
+ inline StructureChain* Structure::prototypeChain(ExecState* exec) const
+ {
+ // We cache our prototype chain so our clients can share it.
+ if (!isValid(exec, m_cachedPrototypeChain.get())) {
+ JSValue prototype = prototypeForLookup(exec);
+ m_cachedPrototypeChain = StructureChain::create(prototype.isNull() ? 0 : asObject(prototype)->structure());
+ }
+ return m_cachedPrototypeChain.get();
+ }
+
+ inline bool Structure::isValid(ExecState* exec, StructureChain* cachedPrototypeChain) const
+ {
+ if (!cachedPrototypeChain)
+ return false;
+
+ JSValue prototype = prototypeForLookup(exec);
+ RefPtr<Structure>* cachedStructure = cachedPrototypeChain->head();
+ while(*cachedStructure && !prototype.isNull()) {
+ if (asObject(prototype)->structure() != *cachedStructure)
+ return false;
+ ++cachedStructure;
+ prototype = asObject(prototype)->prototype();
+ }
+ return prototype.isNull() && !*cachedStructure;
+ }
+
+ inline JSGlobalObject* ExecState::dynamicGlobalObject()
+ {
+ if (this == lexicalGlobalObject()->globalExec())
+ return lexicalGlobalObject();
+
+ // For any ExecState that's not a globalExec, the
+ // dynamic global object must be set since code is running
+ ASSERT(globalData().dynamicGlobalObject);
+ return globalData().dynamicGlobalObject;
+ }
+
+ inline JSObject* constructEmptyObject(ExecState* exec)
+ {
+ return new (exec) JSObject(exec->lexicalGlobalObject()->emptyObjectStructure());
+ }
+
+ inline JSObject* constructEmptyObject(ExecState* exec, JSGlobalObject* globalObject)
+ {
+ return new (exec) JSObject(globalObject->emptyObjectStructure());
+ }
+
+ inline JSArray* constructEmptyArray(ExecState* exec)
+ {
+ return new (exec) JSArray(exec->lexicalGlobalObject()->arrayStructure());
+ }
+
+ inline JSArray* constructEmptyArray(ExecState* exec, JSGlobalObject* globalObject)
+ {
+ return new (exec) JSArray(globalObject->arrayStructure());
+ }
+
+ inline JSArray* constructEmptyArray(ExecState* exec, unsigned initialLength)
+ {
+ return new (exec) JSArray(exec->lexicalGlobalObject()->arrayStructure(), initialLength, CreateInitialized);
+ }
+
+ inline JSArray* constructArray(ExecState* exec, JSValue singleItemValue)
+ {
+ MarkedArgumentBuffer values;
+ values.append(singleItemValue);
+ return new (exec) JSArray(exec->lexicalGlobalObject()->arrayStructure(), values);
+ }
+
+ inline JSArray* constructArray(ExecState* exec, const ArgList& values)
+ {
+ return new (exec) JSArray(exec->lexicalGlobalObject()->arrayStructure(), values);
+ }
+
+ class DynamicGlobalObjectScope : public Noncopyable {
+ public:
+ DynamicGlobalObjectScope(CallFrame* callFrame, JSGlobalObject* dynamicGlobalObject);
+
+ ~DynamicGlobalObjectScope()
+ {
+ m_dynamicGlobalObjectSlot = m_savedDynamicGlobalObject;
+ }
+
+ private:
+ JSGlobalObject*& m_dynamicGlobalObjectSlot;
+ JSGlobalObject* m_savedDynamicGlobalObject;
+ };
+
+} // namespace JSC
+
+#endif // JSGlobalObject_h
diff --git a/Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp b/Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp
new file mode 100644
index 0000000..284806e
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp
@@ -0,0 +1,600 @@
+/*
+ * Copyright (C) 1999-2002 Harri Porten (porten@kde.org)
+ * Copyright (C) 2001 Peter Kelly (pmk@post.com)
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2007 Cameron Zwarich (cwzwarich@uwaterloo.ca)
+ * Copyright (C) 2007 Maks Orlovich
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+#include "JSGlobalObjectFunctions.h"
+
+#include "CallFrame.h"
+#include "GlobalEvalFunction.h"
+#include "Interpreter.h"
+#include "JSGlobalObject.h"
+#include "JSString.h"
+#include "JSStringBuilder.h"
+#include "Lexer.h"
+#include "LiteralParser.h"
+#include "Nodes.h"
+#include "Parser.h"
+#include "UStringBuilder.h"
+#include "dtoa.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <wtf/ASCIICType.h>
+#include <wtf/Assertions.h>
+#include <wtf/MathExtras.h>
+#include <wtf/StringExtras.h>
+#include <wtf/unicode/UTF8.h>
+
+using namespace WTF;
+using namespace Unicode;
+
+namespace JSC {
+
+static JSValue encode(ExecState* exec, const char* doNotEscape)
+{
+ UString str = exec->argument(0).toString(exec);
+ CString cstr = str.utf8(true);
+ if (!cstr.data())
+ return throwError(exec, createURIError(exec, "String contained an illegal UTF-16 sequence."));
+
+ JSStringBuilder builder;
+ const char* p = cstr.data();
+ for (size_t k = 0; k < cstr.length(); k++, p++) {
+ char c = *p;
+ if (c && strchr(doNotEscape, c))
+ builder.append(c);
+ else {
+ char tmp[4];
+ snprintf(tmp, sizeof(tmp), "%%%02X", static_cast<unsigned char>(c));
+ builder.append(tmp);
+ }
+ }
+ return builder.build(exec);
+}
+
+static JSValue decode(ExecState* exec, const char* doNotUnescape, bool strict)
+{
+ JSStringBuilder builder;
+ UString str = exec->argument(0).toString(exec);
+ int k = 0;
+ int len = str.length();
+ const UChar* d = str.characters();
+ UChar u = 0;
+ while (k < len) {
+ const UChar* p = d + k;
+ UChar c = *p;
+ if (c == '%') {
+ int charLen = 0;
+ if (k <= len - 3 && isASCIIHexDigit(p[1]) && isASCIIHexDigit(p[2])) {
+ const char b0 = Lexer::convertHex(p[1], p[2]);
+ const int sequenceLen = UTF8SequenceLength(b0);
+ if (sequenceLen != 0 && k <= len - sequenceLen * 3) {
+ charLen = sequenceLen * 3;
+ char sequence[5];
+ sequence[0] = b0;
+ for (int i = 1; i < sequenceLen; ++i) {
+ const UChar* q = p + i * 3;
+ if (q[0] == '%' && isASCIIHexDigit(q[1]) && isASCIIHexDigit(q[2]))
+ sequence[i] = Lexer::convertHex(q[1], q[2]);
+ else {
+ charLen = 0;
+ break;
+ }
+ }
+ if (charLen != 0) {
+ sequence[sequenceLen] = 0;
+ const int character = decodeUTF8Sequence(sequence);
+ if (character < 0 || character >= 0x110000)
+ charLen = 0;
+ else if (character >= 0x10000) {
+ // Convert to surrogate pair.
+ builder.append(static_cast<UChar>(0xD800 | ((character - 0x10000) >> 10)));
+ u = static_cast<UChar>(0xDC00 | ((character - 0x10000) & 0x3FF));
+ } else
+ u = static_cast<UChar>(character);
+ }
+ }
+ }
+ if (charLen == 0) {
+ if (strict)
+ return throwError(exec, createURIError(exec, "URI error"));
+ // The only case where we don't use "strict" mode is the "unescape" function.
+ // For that, it's good to support the wonky "%u" syntax for compatibility with WinIE.
+ if (k <= len - 6 && p[1] == 'u'
+ && isASCIIHexDigit(p[2]) && isASCIIHexDigit(p[3])
+ && isASCIIHexDigit(p[4]) && isASCIIHexDigit(p[5])) {
+ charLen = 6;
+ u = Lexer::convertUnicode(p[2], p[3], p[4], p[5]);
+ }
+ }
+ if (charLen && (u == 0 || u >= 128 || !strchr(doNotUnescape, u))) {
+ c = u;
+ k += charLen - 1;
+ }
+ }
+ k++;
+ builder.append(c);
+ }
+ return builder.build(exec);
+}
+
+bool isStrWhiteSpace(UChar c)
+{
+ switch (c) {
+ // ECMA-262-5th 7.2 & 7.3
+ case 0x0009:
+ case 0x000A:
+ case 0x000B:
+ case 0x000C:
+ case 0x000D:
+ case 0x0020:
+ case 0x00A0:
+ case 0x2028:
+ case 0x2029:
+ case 0xFEFF:
+ return true;
+ default:
+ return c > 0xff && isSeparatorSpace(c);
+ }
+}
+
+static int parseDigit(unsigned short c, int radix)
+{
+ int digit = -1;
+
+ if (c >= '0' && c <= '9')
+ digit = c - '0';
+ else if (c >= 'A' && c <= 'Z')
+ digit = c - 'A' + 10;
+ else if (c >= 'a' && c <= 'z')
+ digit = c - 'a' + 10;
+
+ if (digit >= radix)
+ return -1;
+ return digit;
+}
+
+double parseIntOverflow(const char* s, int length, int radix)
+{
+ double number = 0.0;
+ double radixMultiplier = 1.0;
+
+ for (const char* p = s + length - 1; p >= s; p--) {
+ if (radixMultiplier == Inf) {
+ if (*p != '0') {
+ number = Inf;
+ break;
+ }
+ } else {
+ int digit = parseDigit(*p, radix);
+ number += digit * radixMultiplier;
+ }
+
+ radixMultiplier *= radix;
+ }
+
+ return number;
+}
+
+double parseIntOverflow(const UChar* s, int length, int radix)
+{
+ double number = 0.0;
+ double radixMultiplier = 1.0;
+
+ for (const UChar* p = s + length - 1; p >= s; p--) {
+ if (radixMultiplier == Inf) {
+ if (*p != '0') {
+ number = Inf;
+ break;
+ }
+ } else {
+ int digit = parseDigit(*p, radix);
+ number += digit * radixMultiplier;
+ }
+
+ radixMultiplier *= radix;
+ }
+
+ return number;
+}
+
+static double parseInt(const UString& s, int radix)
+{
+ int length = s.length();
+ const UChar* data = s.characters();
+ int p = 0;
+
+ while (p < length && isStrWhiteSpace(data[p]))
+ ++p;
+
+ double sign = 1;
+ if (p < length) {
+ if (data[p] == '+')
+ ++p;
+ else if (data[p] == '-') {
+ sign = -1;
+ ++p;
+ }
+ }
+
+ if ((radix == 0 || radix == 16) && length - p >= 2 && data[p] == '0' && (data[p + 1] == 'x' || data[p + 1] == 'X')) {
+ radix = 16;
+ p += 2;
+ } else if (radix == 0) {
+ if (p < length && data[p] == '0')
+ radix = 8;
+ else
+ radix = 10;
+ }
+
+ if (radix < 2 || radix > 36)
+ return NaN;
+
+ int firstDigitPosition = p;
+ bool sawDigit = false;
+ double number = 0;
+ while (p < length) {
+ int digit = parseDigit(data[p], radix);
+ if (digit == -1)
+ break;
+ sawDigit = true;
+ number *= radix;
+ number += digit;
+ ++p;
+ }
+
+ if (number >= mantissaOverflowLowerBound) {
+ if (radix == 10)
+ number = WTF::strtod(s.substringSharingImpl(firstDigitPosition, p - firstDigitPosition).utf8().data(), 0);
+ else if (radix == 2 || radix == 4 || radix == 8 || radix == 16 || radix == 32)
+ number = parseIntOverflow(s.substringSharingImpl(firstDigitPosition, p - firstDigitPosition).utf8().data(), p - firstDigitPosition, radix);
+ }
+
+ if (!sawDigit)
+ return NaN;
+
+ return sign * number;
+}
+
+static const int SizeOfInfinity = 8;
+
+static bool isInfinity(const UChar* data, const UChar* end)
+{
+ return (end - data) >= SizeOfInfinity
+ && data[0] == 'I'
+ && data[1] == 'n'
+ && data[2] == 'f'
+ && data[3] == 'i'
+ && data[4] == 'n'
+ && data[5] == 'i'
+ && data[6] == 't'
+ && data[7] == 'y';
+}
+
+// See ecma-262 9.3.1
+static double jsHexIntegerLiteral(const UChar*& data, const UChar* end)
+{
+ // Hex number.
+ data += 2;
+ const UChar* firstDigitPosition = data;
+ double number = 0;
+ while (true) {
+ number = number * 16 + toASCIIHexValue(*data);
+ ++data;
+ if (data == end)
+ break;
+ if (!isASCIIHexDigit(*data))
+ break;
+ }
+ if (number >= mantissaOverflowLowerBound)
+ number = parseIntOverflow(firstDigitPosition, data - firstDigitPosition, 16);
+
+ return number;
+}
+
+// See ecma-262 9.3.1
+static double jsStrDecimalLiteral(const UChar*& data, const UChar* end)
+{
+ ASSERT(data < end);
+
+ // Copy the sting into a null-terminated byte buffer, and call strtod.
+ Vector<char, 32> byteBuffer;
+ for (const UChar* characters = data; characters < end; ++characters) {
+ UChar character = *characters;
+ byteBuffer.append(isASCII(character) ? character : 0);
+ }
+ byteBuffer.append(0);
+ char* endOfNumber;
+ double number = WTF::strtod(byteBuffer.data(), &endOfNumber);
+
+ // Check if strtod found a number; if so return it.
+ ptrdiff_t consumed = endOfNumber - byteBuffer.data();
+ if (consumed) {
+ data += consumed;
+ return number;
+ }
+
+ // Check for [+-]?Infinity
+ switch (*data) {
+ case 'I':
+ if (isInfinity(data, end)) {
+ data += SizeOfInfinity;
+ return Inf;
+ }
+ break;
+
+ case '+':
+ if (isInfinity(data + 1, end)) {
+ data += SizeOfInfinity + 1;
+ return Inf;
+ }
+ break;
+
+ case '-':
+ if (isInfinity(data + 1, end)) {
+ data += SizeOfInfinity + 1;
+ return -Inf;
+ }
+ break;
+ }
+
+ // Not a number.
+ return NaN;
+}
+
+// See ecma-262 9.3.1
+double jsToNumber(const UString& s)
+{
+ unsigned size = s.length();
+
+ if (size == 1) {
+ UChar c = s.characters()[0];
+ if (isASCIIDigit(c))
+ return c - '0';
+ if (isStrWhiteSpace(c))
+ return 0;
+ return NaN;
+ }
+
+ const UChar* data = s.characters();
+ const UChar* end = data + size;
+
+ // Skip leading white space.
+ for (; data < end; ++data) {
+ if (!isStrWhiteSpace(*data))
+ break;
+ }
+
+ // Empty string.
+ if (data == end)
+ return 0.0;
+
+ double number;
+ if (data[0] == '0' && data + 2 < end && (data[1] | 0x20) == 'x' && isASCIIHexDigit(data[2]))
+ number = jsHexIntegerLiteral(data, end);
+ else
+ number = jsStrDecimalLiteral(data, end);
+
+ // Allow trailing white space.
+ for (; data < end; ++data) {
+ if (!isStrWhiteSpace(*data))
+ break;
+ }
+ if (data != end)
+ return NaN;
+
+ return number;
+}
+
+static double parseFloat(const UString& s)
+{
+ unsigned size = s.length();
+
+ if (size == 1) {
+ UChar c = s.characters()[0];
+ if (isASCIIDigit(c))
+ return c - '0';
+ return NaN;
+ }
+
+ const UChar* data = s.characters();
+ const UChar* end = data + size;
+
+ // Skip leading white space.
+ for (; data < end; ++data) {
+ if (!isStrWhiteSpace(*data))
+ break;
+ }
+
+ // Empty string.
+ if (data == end)
+ return NaN;
+
+ return jsStrDecimalLiteral(data, end);
+}
+
+EncodedJSValue JSC_HOST_CALL globalFuncEval(ExecState* exec)
+{
+ JSObject* thisObject = exec->hostThisValue().toThisObject(exec);
+ JSObject* unwrappedObject = thisObject->unwrappedObject();
+ if (!unwrappedObject->isGlobalObject() || static_cast<JSGlobalObject*>(unwrappedObject)->evalFunction() != exec->callee())
+ return throwVMError(exec, createEvalError(exec, "The \"this\" value passed to eval must be the global object from which eval originated"));
+
+ JSValue x = exec->argument(0);
+ if (!x.isString())
+ return JSValue::encode(x);
+
+ UString s = x.toString(exec);
+
+ LiteralParser preparser(exec, s, LiteralParser::NonStrictJSON);
+ if (JSValue parsedObject = preparser.tryLiteralParse())
+ return JSValue::encode(parsedObject);
+
+ RefPtr<EvalExecutable> eval = EvalExecutable::create(exec, makeSource(s), false);
+ JSObject* error = eval->compile(exec, static_cast<JSGlobalObject*>(unwrappedObject)->globalScopeChain().node());
+ if (error)
+ return throwVMError(exec, error);
+
+ return JSValue::encode(exec->interpreter()->execute(eval.get(), exec, thisObject, static_cast<JSGlobalObject*>(unwrappedObject)->globalScopeChain().node()));
+}
+
+EncodedJSValue JSC_HOST_CALL globalFuncParseInt(ExecState* exec)
+{
+ JSValue value = exec->argument(0);
+ int32_t radix = exec->argument(1).toInt32(exec);
+
+ if (radix != 0 && radix != 10)
+ return JSValue::encode(jsNumber(parseInt(value.toString(exec), radix)));
+
+ if (value.isInt32())
+ return JSValue::encode(value);
+
+ if (value.isDouble()) {
+ double d = value.asDouble();
+ if (isfinite(d))
+ return JSValue::encode(jsNumber((d > 0) ? floor(d) : ceil(d)));
+ if (isnan(d) || isinf(d))
+ return JSValue::encode(jsNaN());
+ return JSValue::encode(jsNumber(0));
+ }
+
+ return JSValue::encode(jsNumber(parseInt(value.toString(exec), radix)));
+}
+
+EncodedJSValue JSC_HOST_CALL globalFuncParseFloat(ExecState* exec)
+{
+ return JSValue::encode(jsNumber(parseFloat(exec->argument(0).toString(exec))));
+}
+
+EncodedJSValue JSC_HOST_CALL globalFuncIsNaN(ExecState* exec)
+{
+ return JSValue::encode(jsBoolean(isnan(exec->argument(0).toNumber(exec))));
+}
+
+EncodedJSValue JSC_HOST_CALL globalFuncIsFinite(ExecState* exec)
+{
+ double n = exec->argument(0).toNumber(exec);
+ return JSValue::encode(jsBoolean(!isnan(n) && !isinf(n)));
+}
+
+EncodedJSValue JSC_HOST_CALL globalFuncDecodeURI(ExecState* exec)
+{
+ static const char do_not_unescape_when_decoding_URI[] =
+ "#$&+,/:;=?@";
+
+ return JSValue::encode(decode(exec, do_not_unescape_when_decoding_URI, true));
+}
+
+EncodedJSValue JSC_HOST_CALL globalFuncDecodeURIComponent(ExecState* exec)
+{
+ return JSValue::encode(decode(exec, "", true));
+}
+
+EncodedJSValue JSC_HOST_CALL globalFuncEncodeURI(ExecState* exec)
+{
+ static const char do_not_escape_when_encoding_URI[] =
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "abcdefghijklmnopqrstuvwxyz"
+ "0123456789"
+ "!#$&'()*+,-./:;=?@_~";
+
+ return JSValue::encode(encode(exec, do_not_escape_when_encoding_URI));
+}
+
+EncodedJSValue JSC_HOST_CALL globalFuncEncodeURIComponent(ExecState* exec)
+{
+ static const char do_not_escape_when_encoding_URI_component[] =
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "abcdefghijklmnopqrstuvwxyz"
+ "0123456789"
+ "!'()*-._~";
+
+ return JSValue::encode(encode(exec, do_not_escape_when_encoding_URI_component));
+}
+
+EncodedJSValue JSC_HOST_CALL globalFuncEscape(ExecState* exec)
+{
+ static const char do_not_escape[] =
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "abcdefghijklmnopqrstuvwxyz"
+ "0123456789"
+ "*+-./@_";
+
+ JSStringBuilder builder;
+ UString str = exec->argument(0).toString(exec);
+ const UChar* c = str.characters();
+ for (unsigned k = 0; k < str.length(); k++, c++) {
+ int u = c[0];
+ if (u > 255) {
+ char tmp[7];
+ snprintf(tmp, sizeof(tmp), "%%u%04X", u);
+ builder.append(tmp);
+ } else if (u != 0 && strchr(do_not_escape, static_cast<char>(u)))
+ builder.append(c, 1);
+ else {
+ char tmp[4];
+ snprintf(tmp, sizeof(tmp), "%%%02X", u);
+ builder.append(tmp);
+ }
+ }
+
+ return JSValue::encode(builder.build(exec));
+}
+
+EncodedJSValue JSC_HOST_CALL globalFuncUnescape(ExecState* exec)
+{
+ UStringBuilder builder;
+ UString str = exec->argument(0).toString(exec);
+ int k = 0;
+ int len = str.length();
+ while (k < len) {
+ const UChar* c = str.characters() + k;
+ UChar u;
+ if (c[0] == '%' && k <= len - 6 && c[1] == 'u') {
+ if (isASCIIHexDigit(c[2]) && isASCIIHexDigit(c[3]) && isASCIIHexDigit(c[4]) && isASCIIHexDigit(c[5])) {
+ u = Lexer::convertUnicode(c[2], c[3], c[4], c[5]);
+ c = &u;
+ k += 5;
+ }
+ } else if (c[0] == '%' && k <= len - 3 && isASCIIHexDigit(c[1]) && isASCIIHexDigit(c[2])) {
+ u = UChar(Lexer::convertHex(c[1], c[2]));
+ c = &u;
+ k += 2;
+ }
+ k++;
+ builder.append(*c);
+ }
+
+ return JSValue::encode(jsString(exec, builder.toUString()));
+}
+
+#ifndef NDEBUG
+EncodedJSValue JSC_HOST_CALL globalFuncJSCPrint(ExecState* exec)
+{
+ CString string = exec->argument(0).toString(exec).utf8();
+ puts(string.data());
+ return JSValue::encode(jsUndefined());
+}
+#endif
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.h b/Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.h
new file mode 100644
index 0000000..6dc7343
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
+ * Copyright (C) 2003, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2007 Cameron Zwarich (cwzwarich@uwaterloo.ca)
+ * Copyright (C) 2007 Maks Orlovich
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef JSGlobalObjectFunctions_h
+#define JSGlobalObjectFunctions_h
+
+#include "JSValue.h"
+#include <wtf/unicode/Unicode.h>
+
+namespace JSC {
+
+ class ArgList;
+ class ExecState;
+ class JSObject;
+
+ // FIXME: These functions should really be in JSGlobalObject.cpp, but putting them there
+ // is a 0.5% reduction.
+
+ EncodedJSValue JSC_HOST_CALL globalFuncEval(ExecState*);
+ EncodedJSValue JSC_HOST_CALL globalFuncParseInt(ExecState*);
+ EncodedJSValue JSC_HOST_CALL globalFuncParseFloat(ExecState*);
+ EncodedJSValue JSC_HOST_CALL globalFuncIsNaN(ExecState*);
+ EncodedJSValue JSC_HOST_CALL globalFuncIsFinite(ExecState*);
+ EncodedJSValue JSC_HOST_CALL globalFuncDecodeURI(ExecState*);
+ EncodedJSValue JSC_HOST_CALL globalFuncDecodeURIComponent(ExecState*);
+ EncodedJSValue JSC_HOST_CALL globalFuncEncodeURI(ExecState*);
+ EncodedJSValue JSC_HOST_CALL globalFuncEncodeURIComponent(ExecState*);
+ EncodedJSValue JSC_HOST_CALL globalFuncEscape(ExecState*);
+ EncodedJSValue JSC_HOST_CALL globalFuncUnescape(ExecState*);
+#ifndef NDEBUG
+ EncodedJSValue JSC_HOST_CALL globalFuncJSCPrint(ExecState*);
+#endif
+
+ static const double mantissaOverflowLowerBound = 9007199254740992.0;
+ double parseIntOverflow(const char*, int length, int radix);
+ double parseIntOverflow(const UChar*, int length, int radix);
+ bool isStrWhiteSpace(UChar);
+ double jsToNumber(const UString& s);
+
+} // namespace JSC
+
+#endif // JSGlobalObjectFunctions_h
diff --git a/Source/JavaScriptCore/runtime/JSImmediate.cpp b/Source/JavaScriptCore/runtime/JSImmediate.cpp
new file mode 100644
index 0000000..846238d
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/JSImmediate.cpp
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2003-2006, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+#include "JSImmediate.h"
+
+namespace JSC {
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/JSImmediate.h b/Source/JavaScriptCore/runtime/JSImmediate.h
new file mode 100644
index 0000000..68ba75c
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/JSImmediate.h
@@ -0,0 +1,568 @@
+/*
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef JSImmediate_h
+#define JSImmediate_h
+
+#if USE(JSVALUE64)
+
+#include <wtf/Assertions.h>
+#include <wtf/AlwaysInline.h>
+#include <wtf/MathExtras.h>
+#include <wtf/StdLibExtras.h>
+#include "JSValue.h"
+#include <limits>
+#include <limits.h>
+#include <stdarg.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+namespace JSC {
+
+ class ExecState;
+ class JSCell;
+ class JSGlobalData;
+ class JSObject;
+ class UString;
+
+ inline intptr_t reinterpretDoubleToIntptr(double value)
+ {
+ return WTF::bitwise_cast<intptr_t>(value);
+ }
+
+ inline double reinterpretIntptrToDouble(intptr_t value)
+ {
+ return WTF::bitwise_cast<double>(value);
+ }
+
+ /*
+ * A JSValue* is either a pointer to a cell (a heap-allocated object) or an immediate (a type-tagged
+ * value masquerading as a pointer). The low two bits in a JSValue* are available for type tagging
+ * because allocator alignment guarantees they will be 00 in cell pointers.
+ *
+ * For example, on a 32 bit system:
+ *
+ * JSCell*: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 00
+ * [ high 30 bits: pointer address ] [ low 2 bits -- always 0 ]
+ * JSImmediate: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX TT
+ * [ high 30 bits: 'payload' ] [ low 2 bits -- tag ]
+ *
+ * Where the bottom two bits are non-zero they either indicate that the immediate is a 31 bit signed
+ * integer, or they mark the value as being an immediate of a type other than integer, with a secondary
+ * tag used to indicate the exact type.
+ *
+ * Where the lowest bit is set (TT is equal to 01 or 11) the high 31 bits form a 31 bit signed int value.
+ * Where TT is equal to 10 this indicates this is a type of immediate other than an integer, and the next
+ * two bits will form an extended tag.
+ *
+ * 31 bit signed int: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX X1
+ * [ high 30 bits of the value ] [ high bit part of value ]
+ * Other: YYYYYYYYYYYYYYYYYYYYYYYYYYYY ZZ 10
+ * [ extended 'payload' ] [ extended tag ] [ tag 'other' ]
+ *
+ * Where the first bit of the extended tag is set this flags the value as being a boolean, and the following
+ * bit would flag the value as undefined. If neither bits are set, the value is null.
+ *
+ * Other: YYYYYYYYYYYYYYYYYYYYYYYYYYYY UB 10
+ * [ extended 'payload' ] [ undefined | bool ] [ tag 'other' ]
+ *
+ * For boolean value the lowest bit in the payload holds the value of the bool, all remaining bits are zero.
+ * For undefined or null immediates the payload is zero.
+ *
+ * Boolean: 000000000000000000000000000V 01 10
+ * [ boolean value ] [ bool ] [ tag 'other' ]
+ * Undefined: 0000000000000000000000000000 10 10
+ * [ zero ] [ undefined ] [ tag 'other' ]
+ * Null: 0000000000000000000000000000 00 10
+ * [ zero ] [ zero ] [ tag 'other' ]
+ */
+
+ /*
+ * On 64-bit platforms, we support an alternative encoding form for immediates, if
+ * USE(JSVALUE64) is defined. When this format is used, double precision
+ * floating point values may also be encoded as JSImmediates.
+ *
+ * The encoding makes use of unused NaN space in the IEEE754 representation. Any value
+ * with the top 13 bits set represents a QNaN (with the sign bit set). QNaN values
+ * can encode a 51-bit payload. Hardware produced and C-library payloads typically
+ * have a payload of zero. We assume that non-zero payloads are available to encode
+ * pointer and integer values. Since any 64-bit bit pattern where the top 15 bits are
+ * all set represents a NaN with a non-zero payload, we can use this space in the NaN
+ * ranges to encode other values (however there are also other ranges of NaN space that
+ * could have been selected). This range of NaN space is represented by 64-bit numbers
+ * begining with the 16-bit hex patterns 0xFFFE and 0xFFFF - we rely on the fact that no
+ * valid double-precision numbers will begin fall in these ranges.
+ *
+ * The scheme we have implemented encodes double precision values by adding 2^48 to the
+ * 64-bit integer representation of the number. After this manipulation, no encoded
+ * double-precision value will begin with the pattern 0x0000 or 0xFFFF.
+ *
+ * The top 16-bits denote the type of the encoded JSImmediate:
+ *
+ * Pointer: 0000:PPPP:PPPP:PPPP
+ * 0001:****:****:****
+ * Double:{ ...
+ * FFFE:****:****:****
+ * Integer: FFFF:0000:IIII:IIII
+ *
+ * 32-bit signed integers are marked with the 16-bit tag 0xFFFF. The tag 0x0000
+ * denotes a pointer, or another form of tagged immediate. Boolean, null and undefined
+ * values are encoded in the same manner as the default format.
+ */
+
+ class JSImmediate {
+ private:
+ friend class JIT;
+ friend class JSValue;
+ friend class JSInterfaceJIT;
+ friend class SpecializedThunkJIT;
+ friend JSValue jsNumber(ExecState* exec, double d);
+ friend JSValue jsNumber(ExecState*, char i);
+ friend JSValue jsNumber(ExecState*, unsigned char i);
+ friend JSValue jsNumber(ExecState*, short i);
+ friend JSValue jsNumber(ExecState*, unsigned short i);
+ friend JSValue jsNumber(ExecState* exec, int i);
+ friend JSValue jsNumber(ExecState* exec, unsigned i);
+ friend JSValue jsNumber(ExecState* exec, long i);
+ friend JSValue jsNumber(ExecState* exec, unsigned long i);
+ friend JSValue jsNumber(ExecState* exec, long long i);
+ friend JSValue jsNumber(ExecState* exec, unsigned long long i);
+ friend JSValue jsNumber(JSGlobalData* globalData, double d);
+ friend JSValue jsNumber(JSGlobalData* globalData, short i);
+ friend JSValue jsNumber(JSGlobalData* globalData, unsigned short i);
+ friend JSValue jsNumber(JSGlobalData* globalData, int i);
+ friend JSValue jsNumber(JSGlobalData* globalData, unsigned i);
+ friend JSValue jsNumber(JSGlobalData* globalData, long i);
+ friend JSValue jsNumber(JSGlobalData* globalData, unsigned long i);
+ friend JSValue jsNumber(JSGlobalData* globalData, long long i);
+ friend JSValue jsNumber(JSGlobalData* globalData, unsigned long long i);
+
+ // If all bits in the mask are set, this indicates an integer number,
+ // if any but not all are set this value is a double precision number.
+ static const intptr_t TagTypeNumber = 0xffff000000000000ll;
+ // This value is 2^48, used to encode doubles such that the encoded value will begin
+ // with a 16-bit pattern within the range 0x0001..0xFFFE.
+ static const intptr_t DoubleEncodeOffset = 0x1000000000000ll;
+ static const intptr_t TagBitTypeOther = 0x2; // second bit set indicates immediate other than an integer
+ static const intptr_t TagMask = TagTypeNumber | TagBitTypeOther;
+
+ static const intptr_t ExtendedTagMask = 0xC; // extended tag holds a further two bits
+ static const intptr_t ExtendedTagBitBool = 0x4;
+ static const intptr_t ExtendedTagBitUndefined = 0x8;
+
+ static const intptr_t FullTagTypeMask = TagMask | ExtendedTagMask;
+ static const intptr_t FullTagTypeBool = TagBitTypeOther | ExtendedTagBitBool;
+ static const intptr_t FullTagTypeUndefined = TagBitTypeOther | ExtendedTagBitUndefined;
+ static const intptr_t FullTagTypeNull = TagBitTypeOther;
+
+ static const int32_t IntegerPayloadShift = 0;
+ static const int32_t ExtendedPayloadShift = 4;
+
+ static const intptr_t ExtendedPayloadBitBoolValue = 1 << ExtendedPayloadShift;
+
+ static const int32_t signBit = 0x80000000;
+
+ static ALWAYS_INLINE bool isImmediate(JSValue v)
+ {
+ return rawValue(v) & TagMask;
+ }
+
+ static ALWAYS_INLINE bool isNumber(JSValue v)
+ {
+ return rawValue(v) & TagTypeNumber;
+ }
+
+ static ALWAYS_INLINE bool isIntegerNumber(JSValue v)
+ {
+ return (rawValue(v) & TagTypeNumber) == TagTypeNumber;
+ }
+
+ static ALWAYS_INLINE bool isDouble(JSValue v)
+ {
+ return isNumber(v) && !isIntegerNumber(v);
+ }
+
+ static ALWAYS_INLINE bool isPositiveIntegerNumber(JSValue v)
+ {
+ // A single mask to check for the sign bit and the number tag all at once.
+ return (rawValue(v) & (signBit | TagTypeNumber)) == TagTypeNumber;
+ }
+
+ static ALWAYS_INLINE bool isBoolean(JSValue v)
+ {
+ return (rawValue(v) & FullTagTypeMask) == FullTagTypeBool;
+ }
+
+ static ALWAYS_INLINE bool isUndefinedOrNull(JSValue v)
+ {
+ // Undefined and null share the same value, bar the 'undefined' bit in the extended tag.
+ return (rawValue(v) & ~ExtendedTagBitUndefined) == FullTagTypeNull;
+ }
+
+ static JSValue from(char);
+ static JSValue from(signed char);
+ static JSValue from(unsigned char);
+ static JSValue from(short);
+ static JSValue from(unsigned short);
+ static JSValue from(int);
+ static JSValue from(unsigned);
+ static JSValue from(long);
+ static JSValue from(unsigned long);
+ static JSValue from(long long);
+ static JSValue from(unsigned long long);
+ static JSValue from(double);
+
+ static ALWAYS_INLINE bool isEitherImmediate(JSValue v1, JSValue v2)
+ {
+ return (rawValue(v1) | rawValue(v2)) & TagMask;
+ }
+
+ static ALWAYS_INLINE bool areBothImmediate(JSValue v1, JSValue v2)
+ {
+ return isImmediate(v1) & isImmediate(v2);
+ }
+
+ static ALWAYS_INLINE bool areBothImmediateIntegerNumbers(JSValue v1, JSValue v2)
+ {
+ return (rawValue(v1) & rawValue(v2) & TagTypeNumber) == TagTypeNumber;
+ }
+
+ static double toDouble(JSValue);
+ static bool toBoolean(JSValue);
+
+ static bool getUInt32(JSValue, uint32_t&);
+ static bool getTruncatedInt32(JSValue, int32_t&);
+ static bool getTruncatedUInt32(JSValue, uint32_t&);
+
+ static int32_t getTruncatedInt32(JSValue);
+ static uint32_t getTruncatedUInt32(JSValue);
+
+ static JSValue trueImmediate();
+ static JSValue falseImmediate();
+ static JSValue undefinedImmediate();
+ static JSValue nullImmediate();
+ static JSValue zeroImmediate();
+ static JSValue oneImmediate();
+
+ private:
+ static const int minImmediateInt = ((-INT_MAX) - 1);
+ static const int maxImmediateInt = INT_MAX;
+ static const unsigned maxImmediateUInt = maxImmediateInt;
+
+ static ALWAYS_INLINE JSValue makeValue(intptr_t integer)
+ {
+ return JSValue::makeImmediate(integer);
+ }
+
+ // With USE(JSVALUE64) we want the argument to be zero extended, so the
+ // integer doesn't interfere with the tag bits in the upper word. In the default encoding,
+ // if intptr_t id larger then int32_t we sign extend the value through the upper word.
+ static ALWAYS_INLINE JSValue makeInt(uint32_t value)
+ {
+ return makeValue((static_cast<intptr_t>(value) << IntegerPayloadShift) | TagTypeNumber);
+ }
+
+ static ALWAYS_INLINE JSValue makeDouble(double value)
+ {
+ return makeValue(reinterpretDoubleToIntptr(value) + DoubleEncodeOffset);
+ }
+
+ static ALWAYS_INLINE JSValue makeBool(bool b)
+ {
+ return makeValue((static_cast<intptr_t>(b) << ExtendedPayloadShift) | FullTagTypeBool);
+ }
+
+ static ALWAYS_INLINE JSValue makeUndefined()
+ {
+ return makeValue(FullTagTypeUndefined);
+ }
+
+ static ALWAYS_INLINE JSValue makeNull()
+ {
+ return makeValue(FullTagTypeNull);
+ }
+
+ template<typename T>
+ static JSValue fromNumberOutsideIntegerRange(T);
+
+ static ALWAYS_INLINE double doubleValue(JSValue v)
+ {
+ return reinterpretIntptrToDouble(rawValue(v) - DoubleEncodeOffset);
+ }
+
+ static ALWAYS_INLINE int32_t intValue(JSValue v)
+ {
+ return static_cast<int32_t>(rawValue(v) >> IntegerPayloadShift);
+ }
+
+ static ALWAYS_INLINE uint32_t uintValue(JSValue v)
+ {
+ return static_cast<uint32_t>(rawValue(v) >> IntegerPayloadShift);
+ }
+
+ static ALWAYS_INLINE bool boolValue(JSValue v)
+ {
+ return rawValue(v) & ExtendedPayloadBitBoolValue;
+ }
+
+ static ALWAYS_INLINE intptr_t rawValue(JSValue v)
+ {
+ return v.immediateValue();
+ }
+ };
+
+ ALWAYS_INLINE JSValue JSImmediate::trueImmediate() { return makeBool(true); }
+ ALWAYS_INLINE JSValue JSImmediate::falseImmediate() { return makeBool(false); }
+ ALWAYS_INLINE JSValue JSImmediate::undefinedImmediate() { return makeUndefined(); }
+ ALWAYS_INLINE JSValue JSImmediate::nullImmediate() { return makeNull(); }
+ ALWAYS_INLINE JSValue JSImmediate::zeroImmediate() { return makeInt(0); }
+ ALWAYS_INLINE JSValue JSImmediate::oneImmediate() { return makeInt(1); }
+
+ inline bool doubleToBoolean(double value)
+ {
+ return value < 0.0 || value > 0.0;
+ }
+
+ ALWAYS_INLINE bool JSImmediate::toBoolean(JSValue v)
+ {
+ ASSERT(isImmediate(v));
+ return isNumber(v) ? isIntegerNumber(v) ? v != zeroImmediate()
+ : doubleToBoolean(doubleValue(v)) : v == trueImmediate();
+ }
+
+ ALWAYS_INLINE uint32_t JSImmediate::getTruncatedUInt32(JSValue v)
+ {
+ // FIXME: should probably be asserting isPositiveIntegerNumber here.
+ ASSERT(isIntegerNumber(v));
+ return intValue(v);
+ }
+
+ template<typename T>
+ inline JSValue JSImmediate::fromNumberOutsideIntegerRange(T value)
+ {
+ return makeDouble(static_cast<double>(value));
+ }
+
+ ALWAYS_INLINE JSValue JSImmediate::from(char i)
+ {
+ return makeInt(i);
+ }
+
+ ALWAYS_INLINE JSValue JSImmediate::from(signed char i)
+ {
+ return makeInt(i);
+ }
+
+ ALWAYS_INLINE JSValue JSImmediate::from(unsigned char i)
+ {
+ return makeInt(i);
+ }
+
+ ALWAYS_INLINE JSValue JSImmediate::from(short i)
+ {
+ return makeInt(i);
+ }
+
+ ALWAYS_INLINE JSValue JSImmediate::from(unsigned short i)
+ {
+ return makeInt(i);
+ }
+
+ ALWAYS_INLINE JSValue JSImmediate::from(int i)
+ {
+ return makeInt(i);
+ }
+
+ ALWAYS_INLINE JSValue JSImmediate::from(unsigned i)
+ {
+ if (i > maxImmediateUInt)
+ return fromNumberOutsideIntegerRange(i);
+ return makeInt(i);
+ }
+
+ ALWAYS_INLINE JSValue JSImmediate::from(long i)
+ {
+ if ((i < minImmediateInt) | (i > maxImmediateInt))
+ return fromNumberOutsideIntegerRange(i);
+ return makeInt(i);
+ }
+
+ ALWAYS_INLINE JSValue JSImmediate::from(unsigned long i)
+ {
+ if (i > maxImmediateUInt)
+ return fromNumberOutsideIntegerRange(i);
+ return makeInt(i);
+ }
+
+ ALWAYS_INLINE JSValue JSImmediate::from(long long i)
+ {
+ if ((i < minImmediateInt) | (i > maxImmediateInt))
+ return JSValue();
+ return makeInt(static_cast<intptr_t>(i));
+ }
+
+ ALWAYS_INLINE JSValue JSImmediate::from(unsigned long long i)
+ {
+ if (i > maxImmediateUInt)
+ return fromNumberOutsideIntegerRange(i);
+ return makeInt(static_cast<intptr_t>(i));
+ }
+
+ ALWAYS_INLINE JSValue JSImmediate::from(double d)
+ {
+ const int intVal = static_cast<int>(d);
+
+ // Check for data loss from conversion to int.
+ if (intVal != d || (!intVal && signbit(d)))
+ return fromNumberOutsideIntegerRange(d);
+
+ return from(intVal);
+ }
+
+ ALWAYS_INLINE int32_t JSImmediate::getTruncatedInt32(JSValue v)
+ {
+ ASSERT(isIntegerNumber(v));
+ return intValue(v);
+ }
+
+ ALWAYS_INLINE double JSImmediate::toDouble(JSValue v)
+ {
+ ASSERT(isImmediate(v));
+
+ if (isIntegerNumber(v))
+ return intValue(v);
+
+ if (isNumber(v)) {
+ ASSERT(isDouble(v));
+ return doubleValue(v);
+ }
+
+ if (rawValue(v) == FullTagTypeUndefined)
+ return nonInlineNaN();
+
+ ASSERT(JSImmediate::isBoolean(v) || (v == JSImmediate::nullImmediate()));
+ return rawValue(v) >> ExtendedPayloadShift;
+ }
+
+ ALWAYS_INLINE bool JSImmediate::getUInt32(JSValue v, uint32_t& i)
+ {
+ i = uintValue(v);
+ return isPositiveIntegerNumber(v);
+ }
+
+ ALWAYS_INLINE bool JSImmediate::getTruncatedInt32(JSValue v, int32_t& i)
+ {
+ i = intValue(v);
+ return isIntegerNumber(v);
+ }
+
+ ALWAYS_INLINE bool JSImmediate::getTruncatedUInt32(JSValue v, uint32_t& i)
+ {
+ return getUInt32(v, i);
+ }
+
+ inline JSValue::JSValue(JSNullTag)
+ {
+ *this = JSImmediate::nullImmediate();
+ }
+
+ inline JSValue::JSValue(JSUndefinedTag)
+ {
+ *this = JSImmediate::undefinedImmediate();
+ }
+
+ inline JSValue::JSValue(JSTrueTag)
+ {
+ *this = JSImmediate::trueImmediate();
+ }
+
+ inline JSValue::JSValue(JSFalseTag)
+ {
+ *this = JSImmediate::falseImmediate();
+ }
+
+ inline bool JSValue::isUndefinedOrNull() const
+ {
+ return JSImmediate::isUndefinedOrNull(asValue());
+ }
+
+ inline bool JSValue::isBoolean() const
+ {
+ return JSImmediate::isBoolean(asValue());
+ }
+
+ inline bool JSValue::isTrue() const
+ {
+ return asValue() == JSImmediate::trueImmediate();
+ }
+
+ inline bool JSValue::isFalse() const
+ {
+ return asValue() == JSImmediate::falseImmediate();
+ }
+
+ inline bool JSValue::getBoolean(bool& v) const
+ {
+ if (JSImmediate::isBoolean(asValue())) {
+ v = JSImmediate::toBoolean(asValue());
+ return true;
+ }
+
+ return false;
+ }
+
+ inline bool JSValue::getBoolean() const
+ {
+ return asValue() == jsBoolean(true);
+ }
+
+ inline bool JSValue::isCell() const
+ {
+ return !JSImmediate::isImmediate(asValue());
+ }
+
+ inline bool JSValue::isInt32() const
+ {
+ return JSImmediate::isIntegerNumber(asValue());
+ }
+
+ inline int32_t JSValue::asInt32() const
+ {
+ ASSERT(isInt32());
+ return JSImmediate::getTruncatedInt32(asValue());
+ }
+
+ inline bool JSValue::isUInt32() const
+ {
+ return JSImmediate::isPositiveIntegerNumber(asValue());
+ }
+
+ inline uint32_t JSValue::asUInt32() const
+ {
+ ASSERT(isUInt32());
+ return JSImmediate::getTruncatedUInt32(asValue());
+ }
+
+} // namespace JSC
+
+#endif // USE(JSVALUE64)
+
+#endif // JSImmediate_h
diff --git a/Source/JavaScriptCore/runtime/JSLock.cpp b/Source/JavaScriptCore/runtime/JSLock.cpp
new file mode 100644
index 0000000..10f4f3f
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/JSLock.cpp
@@ -0,0 +1,260 @@
+/*
+ * Copyright (C) 2005, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the NU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA
+ *
+ */
+
+#include "config.h"
+#include "JSLock.h"
+
+#include "Collector.h"
+#include "CallFrame.h"
+
+#if ENABLE(JSC_MULTIPLE_THREADS)
+#include <pthread.h>
+#endif
+
+namespace JSC {
+
+#if ENABLE(JSC_MULTIPLE_THREADS)
+
+// Acquire this mutex before accessing lock-related data.
+static pthread_mutex_t JSMutex = PTHREAD_MUTEX_INITIALIZER;
+
+// Thread-specific key that tells whether a thread holds the JSMutex, and how many times it was taken recursively.
+pthread_key_t JSLockCount;
+
+static void createJSLockCount()
+{
+ pthread_key_create(&JSLockCount, 0);
+}
+
+pthread_once_t createJSLockCountOnce = PTHREAD_ONCE_INIT;
+
+// Lock nesting count.
+intptr_t JSLock::lockCount()
+{
+ pthread_once(&createJSLockCountOnce, createJSLockCount);
+
+ return reinterpret_cast<intptr_t>(pthread_getspecific(JSLockCount));
+}
+
+static void setLockCount(intptr_t count)
+{
+ ASSERT(count >= 0);
+ pthread_setspecific(JSLockCount, reinterpret_cast<void*>(count));
+}
+
+JSLock::JSLock(ExecState* exec)
+ : m_lockBehavior(exec->globalData().isSharedInstance() ? LockForReal : SilenceAssertionsOnly)
+{
+ lock(m_lockBehavior);
+}
+
+JSLock::JSLock(JSGlobalData* globalData)
+ : m_lockBehavior(globalData->isSharedInstance() ? LockForReal : SilenceAssertionsOnly)
+{
+ lock(m_lockBehavior);
+}
+
+void JSLock::lock(JSLockBehavior lockBehavior)
+{
+#ifdef NDEBUG
+ // Locking "not for real" is a debug-only feature.
+ if (lockBehavior == SilenceAssertionsOnly)
+ return;
+#endif
+
+ pthread_once(&createJSLockCountOnce, createJSLockCount);
+
+ intptr_t currentLockCount = lockCount();
+ if (!currentLockCount && lockBehavior == LockForReal) {
+ int result;
+ result = pthread_mutex_lock(&JSMutex);
+ ASSERT(!result);
+ }
+ setLockCount(currentLockCount + 1);
+}
+
+void JSLock::unlock(JSLockBehavior lockBehavior)
+{
+ ASSERT(lockCount());
+
+#ifdef NDEBUG
+ // Locking "not for real" is a debug-only feature.
+ if (lockBehavior == SilenceAssertionsOnly)
+ return;
+#endif
+
+ intptr_t newLockCount = lockCount() - 1;
+ setLockCount(newLockCount);
+ if (!newLockCount && lockBehavior == LockForReal) {
+ int result;
+ result = pthread_mutex_unlock(&JSMutex);
+ ASSERT(!result);
+ }
+}
+
+void JSLock::lock(ExecState* exec)
+{
+ lock(exec->globalData().isSharedInstance() ? LockForReal : SilenceAssertionsOnly);
+}
+
+void JSLock::unlock(ExecState* exec)
+{
+ unlock(exec->globalData().isSharedInstance() ? LockForReal : SilenceAssertionsOnly);
+}
+
+bool JSLock::currentThreadIsHoldingLock()
+{
+ pthread_once(&createJSLockCountOnce, createJSLockCount);
+ return !!pthread_getspecific(JSLockCount);
+}
+
+// This is fairly nasty. We allow multiple threads to run on the same
+// context, and we do not require any locking semantics in doing so -
+// clients of the API may simply use the context from multiple threads
+// concurently, and assume this will work. In order to make this work,
+// We lock the context when a thread enters, and unlock it when it leaves.
+// However we do not only unlock when the thread returns from its
+// entry point (evaluate script or call function), we also unlock the
+// context if the thread leaves JSC by making a call out to an external
+// function through a callback.
+//
+// All threads using the context share the same JS stack (the RegisterFile).
+// Whenever a thread calls into JSC it starts using the RegisterFile from the
+// previous 'high water mark' - the maximum point the stack has ever grown to
+// (returned by RegisterFile::end()). So if a first thread calls out to a
+// callback, and a second thread enters JSC, then also exits by calling out
+// to a callback, we can be left with stackframes from both threads in the
+// RegisterFile. As such, a problem may occur should the first thread's
+// callback complete first, and attempt to return to JSC. Were we to allow
+// this to happen, and were its stack to grow further, then it may potentially
+// write over the second thread's call frames.
+//
+// In avoid JS stack corruption we enforce a policy of only ever allowing two
+// threads to use a JS context concurrently, and only allowing the second of
+// these threads to execute until it has completed and fully returned from its
+// outermost call into JSC. We enforce this policy using 'lockDropDepth'. The
+// first time a thread exits it will call DropAllLocks - which will do as expected
+// and drop locks allowing another thread to enter. Should another thread, or the
+// same thread again, enter JSC (through evaluate script or call function), and exit
+// again through a callback, then the locks will not be dropped when DropAllLocks
+// is called (since lockDropDepth is non-zero). Since this thread is still holding
+// the locks, only it will re able to re-enter JSC (either be returning from the
+// callback, or by re-entering through another call to evaulate script or call
+// function).
+//
+// This policy is slightly more restricive than it needs to be for correctness -
+// we could validly allow futher entries into JSC from other threads, we only
+// need ensure that callbacks return in the reverse chronological order of the
+// order in which they were made - though implementing the less restrictive policy
+// would likely increase complexity and overhead.
+//
+static unsigned lockDropDepth = 0;
+
+JSLock::DropAllLocks::DropAllLocks(ExecState* exec)
+ : m_lockBehavior(exec->globalData().isSharedInstance() ? LockForReal : SilenceAssertionsOnly)
+{
+ pthread_once(&createJSLockCountOnce, createJSLockCount);
+
+ if (lockDropDepth++) {
+ m_lockCount = 0;
+ return;
+ }
+
+ m_lockCount = JSLock::lockCount();
+ for (intptr_t i = 0; i < m_lockCount; i++)
+ JSLock::unlock(m_lockBehavior);
+}
+
+JSLock::DropAllLocks::DropAllLocks(JSLockBehavior JSLockBehavior)
+ : m_lockBehavior(JSLockBehavior)
+{
+ pthread_once(&createJSLockCountOnce, createJSLockCount);
+
+ if (lockDropDepth++) {
+ m_lockCount = 0;
+ return;
+ }
+
+ // It is necessary to drop even "unreal" locks, because having a non-zero lock count
+ // will prevent a real lock from being taken.
+
+ m_lockCount = JSLock::lockCount();
+ for (intptr_t i = 0; i < m_lockCount; i++)
+ JSLock::unlock(m_lockBehavior);
+}
+
+JSLock::DropAllLocks::~DropAllLocks()
+{
+ for (intptr_t i = 0; i < m_lockCount; i++)
+ JSLock::lock(m_lockBehavior);
+
+ --lockDropDepth;
+}
+
+#else
+
+JSLock::JSLock(ExecState*)
+ : m_lockBehavior(SilenceAssertionsOnly)
+{
+}
+
+// If threading support is off, set the lock count to a constant value of 1 so ssertions
+// that the lock is held don't fail
+intptr_t JSLock::lockCount()
+{
+ return 1;
+}
+
+bool JSLock::currentThreadIsHoldingLock()
+{
+ return true;
+}
+
+void JSLock::lock(JSLockBehavior)
+{
+}
+
+void JSLock::unlock(JSLockBehavior)
+{
+}
+
+void JSLock::lock(ExecState*)
+{
+}
+
+void JSLock::unlock(ExecState*)
+{
+}
+
+JSLock::DropAllLocks::DropAllLocks(ExecState*)
+{
+}
+
+JSLock::DropAllLocks::DropAllLocks(JSLockBehavior)
+{
+}
+
+JSLock::DropAllLocks::~DropAllLocks()
+{
+}
+
+#endif // USE(MULTIPLE_THREADS)
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/JSLock.h b/Source/JavaScriptCore/runtime/JSLock.h
new file mode 100644
index 0000000..05b388c
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/JSLock.h
@@ -0,0 +1,106 @@
+/*
+ * Copyright (C) 2005, 2008, 2009 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef JSLock_h
+#define JSLock_h
+
+#include <wtf/Assertions.h>
+#include <wtf/Noncopyable.h>
+
+namespace JSC {
+
+ // To make it safe to use JavaScript on multiple threads, it is
+ // important to lock before doing anything that allocates a
+ // JavaScript data structure or that interacts with shared state
+ // such as the protect count hash table. The simplest way to lock
+ // is to create a local JSLock object in the scope where the lock
+ // must be held. The lock is recursive so nesting is ok. The JSLock
+ // object also acts as a convenience short-hand for running important
+ // initialization routines.
+
+ // To avoid deadlock, sometimes it is necessary to temporarily
+ // release the lock. Since it is recursive you actually have to
+ // release all locks held by your thread. This is safe to do if
+ // you are executing code that doesn't require the lock, and you
+ // reacquire the right number of locks at the end. You can do this
+ // by constructing a locally scoped JSLock::DropAllLocks object. The
+ // DropAllLocks object takes care to release the JSLock only if your
+ // thread acquired it to begin with.
+
+ // For contexts other than the single shared one, implicit locking is not done,
+ // but we still need to perform all the counting in order to keep debug
+ // assertions working, so that clients that use the shared context don't break.
+
+ class ExecState;
+ class JSGlobalData;
+
+ enum JSLockBehavior { SilenceAssertionsOnly, LockForReal };
+
+ class JSLock : public Noncopyable {
+ public:
+ JSLock(ExecState*);
+ JSLock(JSGlobalData*);
+
+ JSLock(JSLockBehavior lockBehavior)
+ : m_lockBehavior(lockBehavior)
+ {
+#ifdef NDEBUG
+ // Locking "not for real" is a debug-only feature.
+ if (lockBehavior == SilenceAssertionsOnly)
+ return;
+#endif
+ lock(lockBehavior);
+ }
+
+ ~JSLock()
+ {
+#ifdef NDEBUG
+ // Locking "not for real" is a debug-only feature.
+ if (m_lockBehavior == SilenceAssertionsOnly)
+ return;
+#endif
+ unlock(m_lockBehavior);
+ }
+
+ static void lock(JSLockBehavior);
+ static void unlock(JSLockBehavior);
+ static void lock(ExecState*);
+ static void unlock(ExecState*);
+
+ static intptr_t lockCount();
+ static bool currentThreadIsHoldingLock();
+
+ JSLockBehavior m_lockBehavior;
+
+ class DropAllLocks : public Noncopyable {
+ public:
+ DropAllLocks(ExecState* exec);
+ DropAllLocks(JSLockBehavior);
+ ~DropAllLocks();
+
+ private:
+ intptr_t m_lockCount;
+ JSLockBehavior m_lockBehavior;
+ };
+ };
+
+} // namespace
+
+#endif // JSLock_h
diff --git a/Source/JavaScriptCore/runtime/JSNotAnObject.cpp b/Source/JavaScriptCore/runtime/JSNotAnObject.cpp
new file mode 100644
index 0000000..e01b401
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/JSNotAnObject.cpp
@@ -0,0 +1,122 @@
+/*
+ * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+#include "config.h"
+#include "JSNotAnObject.h"
+
+#include <wtf/UnusedParam.h>
+
+namespace JSC {
+
+ASSERT_CLASS_FITS_IN_CELL(JSNotAnObject);
+
+// JSValue methods
+JSValue JSNotAnObject::toPrimitive(ExecState* exec, PreferredPrimitiveType) const
+{
+ ASSERT_UNUSED(exec, exec->hadException());
+ return jsNumber(0);
+}
+
+bool JSNotAnObject::getPrimitiveNumber(ExecState* exec, double&, JSValue&)
+{
+ ASSERT_UNUSED(exec, exec->hadException());
+ return false;
+}
+
+bool JSNotAnObject::toBoolean(ExecState* exec) const
+{
+ ASSERT_UNUSED(exec, exec->hadException());
+ return false;
+}
+
+double JSNotAnObject::toNumber(ExecState* exec) const
+{
+ ASSERT_UNUSED(exec, exec->hadException());
+ return NaN;
+}
+
+UString JSNotAnObject::toString(ExecState* exec) const
+{
+ ASSERT_UNUSED(exec, exec->hadException());
+ return "";
+}
+
+JSObject* JSNotAnObject::toObject(ExecState* exec) const
+{
+ ASSERT_UNUSED(exec, exec->hadException());
+ return const_cast<JSNotAnObject*>(this);
+}
+
+// JSObject methods
+bool JSNotAnObject::getOwnPropertySlot(ExecState* exec, const Identifier&, PropertySlot&)
+{
+ ASSERT_UNUSED(exec, exec->hadException());
+ return false;
+}
+
+bool JSNotAnObject::getOwnPropertySlot(ExecState* exec, unsigned, PropertySlot&)
+{
+ ASSERT_UNUSED(exec, exec->hadException());
+ return false;
+}
+
+bool JSNotAnObject::getOwnPropertyDescriptor(ExecState* exec, const Identifier&, PropertyDescriptor&)
+{
+ ASSERT_UNUSED(exec, exec->hadException());
+ return false;
+}
+
+void JSNotAnObject::put(ExecState* exec, const Identifier& , JSValue, PutPropertySlot&)
+{
+ ASSERT_UNUSED(exec, exec->hadException());
+}
+
+void JSNotAnObject::put(ExecState* exec, unsigned, JSValue)
+{
+ ASSERT_UNUSED(exec, exec->hadException());
+}
+
+bool JSNotAnObject::deleteProperty(ExecState* exec, const Identifier&)
+{
+ ASSERT_UNUSED(exec, exec->hadException());
+ return false;
+}
+
+bool JSNotAnObject::deleteProperty(ExecState* exec, unsigned)
+{
+ ASSERT_UNUSED(exec, exec->hadException());
+ return false;
+}
+
+void JSNotAnObject::getOwnPropertyNames(ExecState* exec, PropertyNameArray&, EnumerationMode)
+{
+ ASSERT_UNUSED(exec, exec->hadException());
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/JSNotAnObject.h b/Source/JavaScriptCore/runtime/JSNotAnObject.h
new file mode 100644
index 0000000..9f527cf
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/JSNotAnObject.h
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef JSNotAnObject_h
+#define JSNotAnObject_h
+
+#include "JSObject.h"
+
+namespace JSC {
+
+ // This unholy class is used to allow us to avoid multiple exception checks
+ // in certain SquirrelFish bytecodes -- effectively it just silently consumes
+ // any operations performed on the result of a failed toObject call.
+ class JSNotAnObject : public JSObject {
+ public:
+ JSNotAnObject(ExecState* exec)
+ : JSObject(exec->globalData().notAnObjectStructure)
+ {
+ }
+
+ static PassRefPtr<Structure> createStructure(JSValue prototype)
+ {
+ return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount);
+ }
+
+ private:
+
+ static const unsigned StructureFlags = OverridesGetOwnPropertySlot | OverridesGetPropertyNames | JSObject::StructureFlags;
+
+ // JSValue methods
+ virtual JSValue toPrimitive(ExecState*, PreferredPrimitiveType) const;
+ virtual bool getPrimitiveNumber(ExecState*, double& number, JSValue&);
+ virtual bool toBoolean(ExecState*) const;
+ virtual double toNumber(ExecState*) const;
+ virtual UString toString(ExecState*) const;
+ virtual JSObject* toObject(ExecState*) const;
+
+ // JSObject methods
+ virtual bool getOwnPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&);
+ virtual bool getOwnPropertySlot(ExecState*, unsigned propertyName, PropertySlot&);
+ virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
+
+ virtual void put(ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&);
+ virtual void put(ExecState*, unsigned propertyName, JSValue);
+
+ virtual bool deleteProperty(ExecState*, const Identifier& propertyName);
+ virtual bool deleteProperty(ExecState*, unsigned propertyName);
+
+ virtual void getOwnPropertyNames(ExecState*, PropertyNameArray&, EnumerationMode mode = ExcludeDontEnumProperties);
+ };
+
+} // namespace JSC
+
+#endif // JSNotAnObject_h
diff --git a/Source/JavaScriptCore/runtime/JSNumberCell.cpp b/Source/JavaScriptCore/runtime/JSNumberCell.cpp
new file mode 100644
index 0000000..6fa6b2a
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/JSNumberCell.cpp
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 1999-2002 Harri Porten (porten@kde.org)
+ * Copyright (C) 2001 Peter Kelly (pmk@post.com)
+ * Copyright (C) 2004, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+#include "JSNumberCell.h"
+
+// Keep our exported symbols lists happy.
+namespace JSC {
+
+JSValue jsNumberCell(ExecState*, double);
+
+JSValue jsNumberCell(ExecState*, double)
+{
+ ASSERT_NOT_REACHED();
+ return JSValue();
+}
+
+} // namespace JSC
+
diff --git a/Source/JavaScriptCore/runtime/JSNumberCell.h b/Source/JavaScriptCore/runtime/JSNumberCell.h
new file mode 100644
index 0000000..0040067
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/JSNumberCell.h
@@ -0,0 +1,171 @@
+/*
+ * Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
+ * Copyright (C) 2001 Peter Kelly (pmk@post.com)
+ * Copyright (C) 2003, 2004, 2005, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef JSNumberCell_h
+#define JSNumberCell_h
+
+#include "CallFrame.h"
+#include "JSCell.h"
+#include "JSImmediate.h"
+#include "Collector.h"
+#include "UString.h"
+#include <stddef.h> // for size_t
+
+namespace JSC {
+
+ extern const double NaN;
+ extern const double Inf;
+
+#if USE(JSVALUE64)
+ ALWAYS_INLINE JSValue::JSValue(EncodeAsDoubleTag, double d)
+ {
+ *this = JSImmediate::fromNumberOutsideIntegerRange(d);
+ }
+
+ inline JSValue::JSValue(double d)
+ {
+ JSValue v = JSImmediate::from(d);
+ ASSERT(v);
+ *this = v;
+ }
+
+ inline JSValue::JSValue(int i)
+ {
+ JSValue v = JSImmediate::from(i);
+ ASSERT(v);
+ *this = v;
+ }
+
+ inline JSValue::JSValue(unsigned i)
+ {
+ JSValue v = JSImmediate::from(i);
+ ASSERT(v);
+ *this = v;
+ }
+
+ inline JSValue::JSValue(long i)
+ {
+ JSValue v = JSImmediate::from(i);
+ ASSERT(v);
+ *this = v;
+ }
+
+ inline JSValue::JSValue(unsigned long i)
+ {
+ JSValue v = JSImmediate::from(i);
+ ASSERT(v);
+ *this = v;
+ }
+
+ inline JSValue::JSValue(long long i)
+ {
+ JSValue v = JSImmediate::from(static_cast<double>(i));
+ ASSERT(v);
+ *this = v;
+ }
+
+ inline JSValue::JSValue(unsigned long long i)
+ {
+ JSValue v = JSImmediate::from(static_cast<double>(i));
+ ASSERT(v);
+ *this = v;
+ }
+
+ inline bool JSValue::isDouble() const
+ {
+ return JSImmediate::isDouble(asValue());
+ }
+
+ inline double JSValue::asDouble() const
+ {
+ return JSImmediate::doubleValue(asValue());
+ }
+
+ inline bool JSValue::isNumber() const
+ {
+ return JSImmediate::isNumber(asValue());
+ }
+
+ inline double JSValue::uncheckedGetNumber() const
+ {
+ ASSERT(isNumber());
+ return JSImmediate::toDouble(asValue());
+ }
+
+#endif // USE(JSVALUE64)
+
+#if USE(JSVALUE64)
+
+ inline JSValue::JSValue(char i)
+ {
+ ASSERT(JSImmediate::from(i));
+ *this = JSImmediate::from(i);
+ }
+
+ inline JSValue::JSValue(unsigned char i)
+ {
+ ASSERT(JSImmediate::from(i));
+ *this = JSImmediate::from(i);
+ }
+
+ inline JSValue::JSValue(short i)
+ {
+ ASSERT(JSImmediate::from(i));
+ *this = JSImmediate::from(i);
+ }
+
+ inline JSValue::JSValue(unsigned short i)
+ {
+ ASSERT(JSImmediate::from(i));
+ *this = JSImmediate::from(i);
+ }
+
+ inline JSValue jsNaN()
+ {
+ return jsNumber(NaN);
+ }
+
+ // --- JSValue inlines ----------------------------
+
+ ALWAYS_INLINE JSValue JSValue::toJSNumber(ExecState* exec) const
+ {
+ return isNumber() ? asValue() : jsNumber(this->toNumber(exec));
+ }
+
+ inline bool JSValue::getNumber(double &result) const
+ {
+ if (isInt32())
+ result = asInt32();
+ else if (LIKELY(isDouble()))
+ result = asDouble();
+ else {
+ ASSERT(!isNumber());
+ return false;
+ }
+ return true;
+ }
+
+#endif // USE(JSVALUE64)
+
+} // namespace JSC
+
+#endif // JSNumberCell_h
diff --git a/Source/JavaScriptCore/runtime/JSONObject.cpp b/Source/JavaScriptCore/runtime/JSONObject.cpp
new file mode 100644
index 0000000..9e63027
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/JSONObject.cpp
@@ -0,0 +1,877 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JSONObject.h"
+
+#include "BooleanObject.h"
+#include "Error.h"
+#include "ExceptionHelpers.h"
+#include "JSArray.h"
+#include "JSGlobalObject.h"
+#include "LiteralParser.h"
+#include "Lookup.h"
+#include "PropertyNameArray.h"
+#include "UStringBuilder.h"
+#include "UStringConcatenate.h"
+#include <wtf/MathExtras.h>
+
+namespace JSC {
+
+ASSERT_CLASS_FITS_IN_CELL(JSONObject);
+
+static EncodedJSValue JSC_HOST_CALL JSONProtoFuncParse(ExecState*);
+static EncodedJSValue JSC_HOST_CALL JSONProtoFuncStringify(ExecState*);
+
+}
+
+#include "JSONObject.lut.h"
+
+namespace JSC {
+
+JSONObject::JSONObject(JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure)
+ : JSObjectWithGlobalObject(globalObject, structure)
+{
+}
+
+// PropertyNameForFunctionCall objects must be on the stack, since the JSValue that they create is not marked.
+class PropertyNameForFunctionCall {
+public:
+ PropertyNameForFunctionCall(const Identifier&);
+ PropertyNameForFunctionCall(unsigned);
+
+ JSValue value(ExecState*) const;
+
+private:
+ const Identifier* m_identifier;
+ unsigned m_number;
+ mutable JSValue m_value;
+};
+
+class Stringifier : public Noncopyable {
+public:
+ Stringifier(ExecState*, JSValue replacer, JSValue space);
+ ~Stringifier();
+ JSValue stringify(JSValue);
+
+ void markAggregate(MarkStack&);
+
+private:
+ class Holder {
+ public:
+ Holder(JSObject*);
+
+ JSObject* object() const { return m_object; }
+
+ bool appendNextProperty(Stringifier&, UStringBuilder&);
+
+ private:
+ JSObject* const m_object;
+ const bool m_isArray;
+ bool m_isJSArray;
+ unsigned m_index;
+ unsigned m_size;
+ RefPtr<PropertyNameArrayData> m_propertyNames;
+ };
+
+ friend class Holder;
+
+ static void appendQuotedString(UStringBuilder&, const UString&);
+
+ JSValue toJSON(JSValue, const PropertyNameForFunctionCall&);
+
+ enum StringifyResult { StringifyFailed, StringifySucceeded, StringifyFailedDueToUndefinedValue };
+ StringifyResult appendStringifiedValue(UStringBuilder&, JSValue, JSObject* holder, const PropertyNameForFunctionCall&);
+
+ bool willIndent() const;
+ void indent();
+ void unindent();
+ void startNewLine(UStringBuilder&) const;
+
+ Stringifier* const m_nextStringifierToMark;
+ ExecState* const m_exec;
+ const JSValue m_replacer;
+ bool m_usingArrayReplacer;
+ PropertyNameArray m_arrayReplacerPropertyNames;
+ CallType m_replacerCallType;
+ CallData m_replacerCallData;
+ const UString m_gap;
+
+ HashSet<JSObject*> m_holderCycleDetector;
+ Vector<Holder, 16> m_holderStack;
+ UString m_repeatedGap;
+ UString m_indent;
+};
+
+// ------------------------------ helper functions --------------------------------
+
+static inline JSValue unwrapBoxedPrimitive(ExecState* exec, JSValue value)
+{
+ if (!value.isObject())
+ return value;
+ JSObject* object = asObject(value);
+ if (object->inherits(&NumberObject::info))
+ return jsNumber(object->toNumber(exec));
+ if (object->inherits(&StringObject::info))
+ return jsString(exec, object->toString(exec));
+ if (object->inherits(&BooleanObject::info))
+ return object->toPrimitive(exec);
+ return value;
+}
+
+static inline UString gap(ExecState* exec, JSValue space)
+{
+ const unsigned maxGapLength = 10;
+ space = unwrapBoxedPrimitive(exec, space);
+
+ // If the space value is a number, create a gap string with that number of spaces.
+ double spaceCount;
+ if (space.getNumber(spaceCount)) {
+ int count;
+ if (spaceCount > maxGapLength)
+ count = maxGapLength;
+ else if (!(spaceCount > 0))
+ count = 0;
+ else
+ count = static_cast<int>(spaceCount);
+ UChar spaces[maxGapLength];
+ for (int i = 0; i < count; ++i)
+ spaces[i] = ' ';
+ return UString(spaces, count);
+ }
+
+ // If the space value is a string, use it as the gap string, otherwise use no gap string.
+ UString spaces = space.getString(exec);
+ if (spaces.length() > maxGapLength) {
+ spaces = spaces.substringSharingImpl(0, maxGapLength);
+ }
+ return spaces;
+}
+
+// ------------------------------ PropertyNameForFunctionCall --------------------------------
+
+inline PropertyNameForFunctionCall::PropertyNameForFunctionCall(const Identifier& identifier)
+ : m_identifier(&identifier)
+{
+}
+
+inline PropertyNameForFunctionCall::PropertyNameForFunctionCall(unsigned number)
+ : m_identifier(0)
+ , m_number(number)
+{
+}
+
+JSValue PropertyNameForFunctionCall::value(ExecState* exec) const
+{
+ if (!m_value) {
+ if (m_identifier)
+ m_value = jsString(exec, m_identifier->ustring());
+ else
+ m_value = jsNumber(m_number);
+ }
+ return m_value;
+}
+
+// ------------------------------ Stringifier --------------------------------
+
+Stringifier::Stringifier(ExecState* exec, JSValue replacer, JSValue space)
+ : m_nextStringifierToMark(exec->globalData().firstStringifierToMark)
+ , m_exec(exec)
+ , m_replacer(replacer)
+ , m_usingArrayReplacer(false)
+ , m_arrayReplacerPropertyNames(exec)
+ , m_replacerCallType(CallTypeNone)
+ , m_gap(gap(exec, space))
+{
+ exec->globalData().firstStringifierToMark = this;
+
+ if (!m_replacer.isObject())
+ return;
+
+ if (asObject(m_replacer)->inherits(&JSArray::info)) {
+ m_usingArrayReplacer = true;
+ JSObject* array = asObject(m_replacer);
+ unsigned length = array->get(exec, exec->globalData().propertyNames->length).toUInt32(exec);
+ for (unsigned i = 0; i < length; ++i) {
+ JSValue name = array->get(exec, i);
+ if (exec->hadException())
+ break;
+
+ UString propertyName;
+ if (name.getString(exec, propertyName)) {
+ m_arrayReplacerPropertyNames.add(Identifier(exec, propertyName));
+ continue;
+ }
+
+ double value = 0;
+ if (name.getNumber(value)) {
+ m_arrayReplacerPropertyNames.add(Identifier::from(exec, value));
+ continue;
+ }
+
+ if (name.isObject()) {
+ if (!asObject(name)->inherits(&NumberObject::info) && !asObject(name)->inherits(&StringObject::info))
+ continue;
+ propertyName = name.toString(exec);
+ if (exec->hadException())
+ break;
+ m_arrayReplacerPropertyNames.add(Identifier(exec, propertyName));
+ }
+ }
+ return;
+ }
+
+ m_replacerCallType = asObject(m_replacer)->getCallData(m_replacerCallData);
+}
+
+Stringifier::~Stringifier()
+{
+ ASSERT(m_exec->globalData().firstStringifierToMark == this);
+ m_exec->globalData().firstStringifierToMark = m_nextStringifierToMark;
+}
+
+void Stringifier::markAggregate(MarkStack& markStack)
+{
+ for (Stringifier* stringifier = this; stringifier; stringifier = stringifier->m_nextStringifierToMark) {
+ size_t size = m_holderStack.size();
+ for (size_t i = 0; i < size; ++i)
+ markStack.append(m_holderStack[i].object());
+ }
+}
+
+JSValue Stringifier::stringify(JSValue value)
+{
+ JSObject* object = constructEmptyObject(m_exec);
+ if (m_exec->hadException())
+ return jsNull();
+
+ PropertyNameForFunctionCall emptyPropertyName(m_exec->globalData().propertyNames->emptyIdentifier);
+ object->putDirect(m_exec->globalData().propertyNames->emptyIdentifier, value);
+
+ UStringBuilder result;
+ if (appendStringifiedValue(result, value, object, emptyPropertyName) != StringifySucceeded)
+ return jsUndefined();
+ if (m_exec->hadException())
+ return jsNull();
+
+ return jsString(m_exec, result.toUString());
+}
+
+void Stringifier::appendQuotedString(UStringBuilder& builder, const UString& value)
+{
+ int length = value.length();
+
+ // String length plus 2 for quote marks plus 8 so we can accomodate a few escaped characters.
+ builder.reserveCapacity(builder.length() + length + 2 + 8);
+
+ builder.append('"');
+
+ const UChar* data = value.characters();
+ for (int i = 0; i < length; ++i) {
+ int start = i;
+ while (i < length && (data[i] > 0x1F && data[i] != '"' && data[i] != '\\'))
+ ++i;
+ builder.append(data + start, i - start);
+ if (i >= length)
+ break;
+ switch (data[i]) {
+ case '\t':
+ builder.append('\\');
+ builder.append('t');
+ break;
+ case '\r':
+ builder.append('\\');
+ builder.append('r');
+ break;
+ case '\n':
+ builder.append('\\');
+ builder.append('n');
+ break;
+ case '\f':
+ builder.append('\\');
+ builder.append('f');
+ break;
+ case '\b':
+ builder.append('\\');
+ builder.append('b');
+ break;
+ case '"':
+ builder.append('\\');
+ builder.append('"');
+ break;
+ case '\\':
+ builder.append('\\');
+ builder.append('\\');
+ break;
+ default:
+ static const char hexDigits[] = "0123456789abcdef";
+ UChar ch = data[i];
+ UChar hex[] = { '\\', 'u', hexDigits[(ch >> 12) & 0xF], hexDigits[(ch >> 8) & 0xF], hexDigits[(ch >> 4) & 0xF], hexDigits[ch & 0xF] };
+ builder.append(hex, WTF_ARRAY_LENGTH(hex));
+ break;
+ }
+ }
+
+ builder.append('"');
+}
+
+inline JSValue Stringifier::toJSON(JSValue value, const PropertyNameForFunctionCall& propertyName)
+{
+ ASSERT(!m_exec->hadException());
+ if (!value.isObject() || !asObject(value)->hasProperty(m_exec, m_exec->globalData().propertyNames->toJSON))
+ return value;
+
+ JSValue toJSONFunction = asObject(value)->get(m_exec, m_exec->globalData().propertyNames->toJSON);
+ if (m_exec->hadException())
+ return jsNull();
+
+ if (!toJSONFunction.isObject())
+ return value;
+
+ JSObject* object = asObject(toJSONFunction);
+ CallData callData;
+ CallType callType = object->getCallData(callData);
+ if (callType == CallTypeNone)
+ return value;
+
+ JSValue list[] = { propertyName.value(m_exec) };
+ ArgList args(list, WTF_ARRAY_LENGTH(list));
+ return call(m_exec, object, callType, callData, value, args);
+}
+
+Stringifier::StringifyResult Stringifier::appendStringifiedValue(UStringBuilder& builder, JSValue value, JSObject* holder, const PropertyNameForFunctionCall& propertyName)
+{
+ // Call the toJSON function.
+ value = toJSON(value, propertyName);
+ if (m_exec->hadException())
+ return StringifyFailed;
+
+ // Call the replacer function.
+ if (m_replacerCallType != CallTypeNone) {
+ JSValue list[] = { propertyName.value(m_exec), value };
+ ArgList args(list, WTF_ARRAY_LENGTH(list));
+ value = call(m_exec, m_replacer, m_replacerCallType, m_replacerCallData, holder, args);
+ if (m_exec->hadException())
+ return StringifyFailed;
+ }
+
+ if (value.isUndefined() && !holder->inherits(&JSArray::info))
+ return StringifyFailedDueToUndefinedValue;
+
+ if (value.isNull()) {
+ builder.append("null");
+ return StringifySucceeded;
+ }
+
+ value = unwrapBoxedPrimitive(m_exec, value);
+
+ if (m_exec->hadException())
+ return StringifyFailed;
+
+ if (value.isBoolean()) {
+ builder.append(value.getBoolean() ? "true" : "false");
+ return StringifySucceeded;
+ }
+
+ UString stringValue;
+ if (value.getString(m_exec, stringValue)) {
+ appendQuotedString(builder, stringValue);
+ return StringifySucceeded;
+ }
+
+ double numericValue;
+ if (value.getNumber(numericValue)) {
+ if (!isfinite(numericValue))
+ builder.append("null");
+ else
+ builder.append(UString::number(numericValue));
+ return StringifySucceeded;
+ }
+
+ if (!value.isObject())
+ return StringifyFailed;
+
+ JSObject* object = asObject(value);
+
+ CallData callData;
+ if (object->getCallData(callData) != CallTypeNone) {
+ if (holder->inherits(&JSArray::info)) {
+ builder.append("null");
+ return StringifySucceeded;
+ }
+ return StringifyFailedDueToUndefinedValue;
+ }
+
+ // Handle cycle detection, and put the holder on the stack.
+ if (!m_holderCycleDetector.add(object).second) {
+ throwError(m_exec, createTypeError(m_exec, "JSON.stringify cannot serialize cyclic structures."));
+ return StringifyFailed;
+ }
+ bool holderStackWasEmpty = m_holderStack.isEmpty();
+ m_holderStack.append(object);
+ if (!holderStackWasEmpty)
+ return StringifySucceeded;
+
+ // If this is the outermost call, then loop to handle everything on the holder stack.
+ TimeoutChecker localTimeoutChecker(m_exec->globalData().timeoutChecker);
+ localTimeoutChecker.reset();
+ unsigned tickCount = localTimeoutChecker.ticksUntilNextCheck();
+ do {
+ while (m_holderStack.last().appendNextProperty(*this, builder)) {
+ if (m_exec->hadException())
+ return StringifyFailed;
+ if (!--tickCount) {
+ if (localTimeoutChecker.didTimeOut(m_exec)) {
+ throwError(m_exec, createInterruptedExecutionException(&m_exec->globalData()));
+ return StringifyFailed;
+ }
+ tickCount = localTimeoutChecker.ticksUntilNextCheck();
+ }
+ }
+ m_holderCycleDetector.remove(m_holderStack.last().object());
+ m_holderStack.removeLast();
+ } while (!m_holderStack.isEmpty());
+ return StringifySucceeded;
+}
+
+inline bool Stringifier::willIndent() const
+{
+ return !m_gap.isEmpty();
+}
+
+inline void Stringifier::indent()
+{
+ // Use a single shared string, m_repeatedGap, so we don't keep allocating new ones as we indent and unindent.
+ unsigned newSize = m_indent.length() + m_gap.length();
+ if (newSize > m_repeatedGap.length())
+ m_repeatedGap = makeUString(m_repeatedGap, m_gap);
+ ASSERT(newSize <= m_repeatedGap.length());
+ m_indent = m_repeatedGap.substringSharingImpl(0, newSize);
+}
+
+inline void Stringifier::unindent()
+{
+ ASSERT(m_indent.length() >= m_gap.length());
+ m_indent = m_repeatedGap.substringSharingImpl(0, m_indent.length() - m_gap.length());
+}
+
+inline void Stringifier::startNewLine(UStringBuilder& builder) const
+{
+ if (m_gap.isEmpty())
+ return;
+ builder.append('\n');
+ builder.append(m_indent);
+}
+
+inline Stringifier::Holder::Holder(JSObject* object)
+ : m_object(object)
+ , m_isArray(object->inherits(&JSArray::info))
+ , m_index(0)
+{
+}
+
+bool Stringifier::Holder::appendNextProperty(Stringifier& stringifier, UStringBuilder& builder)
+{
+ ASSERT(m_index <= m_size);
+
+ ExecState* exec = stringifier.m_exec;
+
+ // First time through, initialize.
+ if (!m_index) {
+ if (m_isArray) {
+ m_isJSArray = isJSArray(&exec->globalData(), m_object);
+ m_size = m_object->get(exec, exec->globalData().propertyNames->length).toUInt32(exec);
+ builder.append('[');
+ } else {
+ if (stringifier.m_usingArrayReplacer)
+ m_propertyNames = stringifier.m_arrayReplacerPropertyNames.data();
+ else {
+ PropertyNameArray objectPropertyNames(exec);
+ m_object->getOwnPropertyNames(exec, objectPropertyNames);
+ m_propertyNames = objectPropertyNames.releaseData();
+ }
+ m_size = m_propertyNames->propertyNameVector().size();
+ builder.append('{');
+ }
+ stringifier.indent();
+ }
+
+ // Last time through, finish up and return false.
+ if (m_index == m_size) {
+ stringifier.unindent();
+ if (m_size && builder[builder.length() - 1] != '{')
+ stringifier.startNewLine(builder);
+ builder.append(m_isArray ? ']' : '}');
+ return false;
+ }
+
+ // Handle a single element of the array or object.
+ unsigned index = m_index++;
+ unsigned rollBackPoint = 0;
+ StringifyResult stringifyResult;
+ if (m_isArray) {
+ // Get the value.
+ JSValue value;
+ if (m_isJSArray && asArray(m_object)->canGetIndex(index))
+ value = asArray(m_object)->getIndex(index);
+ else {
+ PropertySlot slot(m_object);
+ if (!m_object->getOwnPropertySlot(exec, index, slot))
+ slot.setUndefined();
+ if (exec->hadException())
+ return false;
+ value = slot.getValue(exec, index);
+ }
+
+ // Append the separator string.
+ if (index)
+ builder.append(',');
+ stringifier.startNewLine(builder);
+
+ // Append the stringified value.
+ stringifyResult = stringifier.appendStringifiedValue(builder, value, m_object, index);
+ } else {
+ // Get the value.
+ PropertySlot slot(m_object);
+ Identifier& propertyName = m_propertyNames->propertyNameVector()[index];
+ if (!m_object->getOwnPropertySlot(exec, propertyName, slot))
+ return true;
+ JSValue value = slot.getValue(exec, propertyName);
+ if (exec->hadException())
+ return false;
+
+ rollBackPoint = builder.length();
+
+ // Append the separator string.
+ if (builder[rollBackPoint - 1] != '{')
+ builder.append(',');
+ stringifier.startNewLine(builder);
+
+ // Append the property name.
+ appendQuotedString(builder, propertyName.ustring());
+ builder.append(':');
+ if (stringifier.willIndent())
+ builder.append(' ');
+
+ // Append the stringified value.
+ stringifyResult = stringifier.appendStringifiedValue(builder, value, m_object, propertyName);
+ }
+
+ // From this point on, no access to the this pointer or to any members, because the
+ // Holder object may have moved if the call to stringify pushed a new Holder onto
+ // m_holderStack.
+
+ switch (stringifyResult) {
+ case StringifyFailed:
+ builder.append("null");
+ break;
+ case StringifySucceeded:
+ break;
+ case StringifyFailedDueToUndefinedValue:
+ // This only occurs when get an undefined value for an object property.
+ // In this case we don't want the separator and property name that we
+ // already appended, so roll back.
+ builder.resize(rollBackPoint);
+ break;
+ }
+
+ return true;
+}
+
+// ------------------------------ JSONObject --------------------------------
+
+const ClassInfo JSONObject::info = { "JSON", 0, 0, ExecState::jsonTable };
+
+/* Source for JSONObject.lut.h
+@begin jsonTable
+ parse JSONProtoFuncParse DontEnum|Function 2
+ stringify JSONProtoFuncStringify DontEnum|Function 3
+@end
+*/
+
+// ECMA 15.8
+
+bool JSONObject::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
+{
+ return getStaticFunctionSlot<JSObject>(exec, ExecState::jsonTable(exec), this, propertyName, slot);
+}
+
+bool JSONObject::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
+{
+ return getStaticFunctionDescriptor<JSObject>(exec, ExecState::jsonTable(exec), this, propertyName, descriptor);
+}
+
+void JSONObject::markStringifiers(MarkStack& markStack, Stringifier* stringifier)
+{
+ stringifier->markAggregate(markStack);
+}
+
+class Walker {
+public:
+ Walker(ExecState* exec, JSObject* function, CallType callType, CallData callData)
+ : m_exec(exec)
+ , m_function(function)
+ , m_callType(callType)
+ , m_callData(callData)
+ {
+ }
+ JSValue walk(JSValue unfiltered);
+private:
+ JSValue callReviver(JSObject* thisObj, JSValue property, JSValue unfiltered)
+ {
+ JSValue args[] = { property, unfiltered };
+ ArgList argList(args, 2);
+ return call(m_exec, m_function, m_callType, m_callData, thisObj, argList);
+ }
+
+ friend class Holder;
+
+ ExecState* m_exec;
+ JSObject* m_function;
+ CallType m_callType;
+ CallData m_callData;
+};
+
+// We clamp recursion well beyond anything reasonable, but we also have a timeout check
+// to guard against "infinite" execution by inserting arbitrarily large objects.
+static const unsigned maximumFilterRecursion = 40000;
+enum WalkerState { StateUnknown, ArrayStartState, ArrayStartVisitMember, ArrayEndVisitMember,
+ ObjectStartState, ObjectStartVisitMember, ObjectEndVisitMember };
+NEVER_INLINE JSValue Walker::walk(JSValue unfiltered)
+{
+ Vector<PropertyNameArray, 16> propertyStack;
+ Vector<uint32_t, 16> indexStack;
+ Vector<JSObject*, 16> objectStack;
+ Vector<JSArray*, 16> arrayStack;
+
+ Vector<WalkerState, 16> stateStack;
+ WalkerState state = StateUnknown;
+ JSValue inValue = unfiltered;
+ JSValue outValue = jsNull();
+
+ TimeoutChecker localTimeoutChecker(m_exec->globalData().timeoutChecker);
+ localTimeoutChecker.reset();
+ unsigned tickCount = localTimeoutChecker.ticksUntilNextCheck();
+ while (1) {
+ switch (state) {
+ arrayStartState:
+ case ArrayStartState: {
+ ASSERT(inValue.isObject());
+ ASSERT(isJSArray(&m_exec->globalData(), asObject(inValue)) || asObject(inValue)->inherits(&JSArray::info));
+ if (objectStack.size() + arrayStack.size() > maximumFilterRecursion)
+ return throwError(m_exec, createStackOverflowError(m_exec));
+
+ JSArray* array = asArray(inValue);
+ arrayStack.append(array);
+ indexStack.append(0);
+ // fallthrough
+ }
+ arrayStartVisitMember:
+ case ArrayStartVisitMember: {
+ if (!--tickCount) {
+ if (localTimeoutChecker.didTimeOut(m_exec))
+ return throwError(m_exec, createInterruptedExecutionException(&m_exec->globalData()));
+ tickCount = localTimeoutChecker.ticksUntilNextCheck();
+ }
+
+ JSArray* array = arrayStack.last();
+ uint32_t index = indexStack.last();
+ if (index == array->length()) {
+ outValue = array;
+ arrayStack.removeLast();
+ indexStack.removeLast();
+ break;
+ }
+ if (isJSArray(&m_exec->globalData(), array) && array->canGetIndex(index))
+ inValue = array->getIndex(index);
+ else {
+ PropertySlot slot;
+ if (array->getOwnPropertySlot(m_exec, index, slot))
+ inValue = slot.getValue(m_exec, index);
+ else
+ inValue = jsUndefined();
+ }
+
+ if (inValue.isObject()) {
+ stateStack.append(ArrayEndVisitMember);
+ goto stateUnknown;
+ } else
+ outValue = inValue;
+ // fallthrough
+ }
+ case ArrayEndVisitMember: {
+ JSArray* array = arrayStack.last();
+ JSValue filteredValue = callReviver(array, jsString(m_exec, UString::number(indexStack.last())), outValue);
+ if (filteredValue.isUndefined())
+ array->deleteProperty(m_exec, indexStack.last());
+ else {
+ if (isJSArray(&m_exec->globalData(), array) && array->canSetIndex(indexStack.last()))
+ array->setIndex(indexStack.last(), filteredValue);
+ else
+ array->put(m_exec, indexStack.last(), filteredValue);
+ }
+ if (m_exec->hadException())
+ return jsNull();
+ indexStack.last()++;
+ goto arrayStartVisitMember;
+ }
+ objectStartState:
+ case ObjectStartState: {
+ ASSERT(inValue.isObject());
+ ASSERT(!isJSArray(&m_exec->globalData(), asObject(inValue)) && !asObject(inValue)->inherits(&JSArray::info));
+ if (objectStack.size() + arrayStack.size() > maximumFilterRecursion)
+ return throwError(m_exec, createStackOverflowError(m_exec));
+
+ JSObject* object = asObject(inValue);
+ objectStack.append(object);
+ indexStack.append(0);
+ propertyStack.append(PropertyNameArray(m_exec));
+ object->getOwnPropertyNames(m_exec, propertyStack.last());
+ // fallthrough
+ }
+ objectStartVisitMember:
+ case ObjectStartVisitMember: {
+ if (!--tickCount) {
+ if (localTimeoutChecker.didTimeOut(m_exec))
+ return throwError(m_exec, createInterruptedExecutionException(&m_exec->globalData()));
+ tickCount = localTimeoutChecker.ticksUntilNextCheck();
+ }
+
+ JSObject* object = objectStack.last();
+ uint32_t index = indexStack.last();
+ PropertyNameArray& properties = propertyStack.last();
+ if (index == properties.size()) {
+ outValue = object;
+ objectStack.removeLast();
+ indexStack.removeLast();
+ propertyStack.removeLast();
+ break;
+ }
+ PropertySlot slot;
+ if (object->getOwnPropertySlot(m_exec, properties[index], slot))
+ inValue = slot.getValue(m_exec, properties[index]);
+ else
+ inValue = jsUndefined();
+
+ // The holder may be modified by the reviver function so any lookup may throw
+ if (m_exec->hadException())
+ return jsNull();
+
+ if (inValue.isObject()) {
+ stateStack.append(ObjectEndVisitMember);
+ goto stateUnknown;
+ } else
+ outValue = inValue;
+ // fallthrough
+ }
+ case ObjectEndVisitMember: {
+ JSObject* object = objectStack.last();
+ Identifier prop = propertyStack.last()[indexStack.last()];
+ PutPropertySlot slot;
+ JSValue filteredValue = callReviver(object, jsString(m_exec, prop.ustring()), outValue);
+ if (filteredValue.isUndefined())
+ object->deleteProperty(m_exec, prop);
+ else
+ object->put(m_exec, prop, filteredValue, slot);
+ if (m_exec->hadException())
+ return jsNull();
+ indexStack.last()++;
+ goto objectStartVisitMember;
+ }
+ stateUnknown:
+ case StateUnknown:
+ if (!inValue.isObject()) {
+ outValue = inValue;
+ break;
+ }
+ JSObject* object = asObject(inValue);
+ if (isJSArray(&m_exec->globalData(), object) || object->inherits(&JSArray::info))
+ goto arrayStartState;
+ goto objectStartState;
+ }
+ if (stateStack.isEmpty())
+ break;
+
+ state = stateStack.last();
+ stateStack.removeLast();
+
+ if (!--tickCount) {
+ if (localTimeoutChecker.didTimeOut(m_exec))
+ return throwError(m_exec, createInterruptedExecutionException(&m_exec->globalData()));
+ tickCount = localTimeoutChecker.ticksUntilNextCheck();
+ }
+ }
+ JSObject* finalHolder = constructEmptyObject(m_exec);
+ PutPropertySlot slot;
+ finalHolder->put(m_exec, m_exec->globalData().propertyNames->emptyIdentifier, outValue, slot);
+ return callReviver(finalHolder, jsEmptyString(m_exec), outValue);
+}
+
+// ECMA-262 v5 15.12.2
+EncodedJSValue JSC_HOST_CALL JSONProtoFuncParse(ExecState* exec)
+{
+ if (!exec->argumentCount())
+ return throwVMError(exec, createError(exec, "JSON.parse requires at least one parameter"));
+ JSValue value = exec->argument(0);
+ UString source = value.toString(exec);
+ if (exec->hadException())
+ return JSValue::encode(jsNull());
+
+ LiteralParser jsonParser(exec, source, LiteralParser::StrictJSON);
+ JSValue unfiltered = jsonParser.tryLiteralParse();
+ if (!unfiltered)
+ return throwVMError(exec, createSyntaxError(exec, "Unable to parse JSON string"));
+
+ if (exec->argumentCount() < 2)
+ return JSValue::encode(unfiltered);
+
+ JSValue function = exec->argument(1);
+ CallData callData;
+ CallType callType = getCallData(function, callData);
+ if (callType == CallTypeNone)
+ return JSValue::encode(unfiltered);
+ return JSValue::encode(Walker(exec, asObject(function), callType, callData).walk(unfiltered));
+}
+
+// ECMA-262 v5 15.12.3
+EncodedJSValue JSC_HOST_CALL JSONProtoFuncStringify(ExecState* exec)
+{
+ if (!exec->argumentCount())
+ return throwVMError(exec, createError(exec, "No input to stringify"));
+ JSValue value = exec->argument(0);
+ JSValue replacer = exec->argument(1);
+ JSValue space = exec->argument(2);
+ return JSValue::encode(Stringifier(exec, replacer, space).stringify(value));
+}
+
+UString JSONStringify(ExecState* exec, JSValue value, unsigned indent)
+{
+ JSValue result = Stringifier(exec, jsNull(), jsNumber(indent)).stringify(value);
+ if (result.isUndefinedOrNull())
+ return UString();
+ return result.getString(exec);
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/JSONObject.h b/Source/JavaScriptCore/runtime/JSONObject.h
new file mode 100644
index 0000000..f64be12
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/JSONObject.h
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef JSONObject_h
+#define JSONObject_h
+
+#include "JSObjectWithGlobalObject.h"
+
+namespace JSC {
+
+ class Stringifier;
+
+ class JSONObject : public JSObjectWithGlobalObject {
+ public:
+ JSONObject(JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure);
+
+ static PassRefPtr<Structure> createStructure(JSValue prototype)
+ {
+ return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount);
+ }
+
+ static void markStringifiers(MarkStack&, Stringifier*);
+
+ protected:
+ static const unsigned StructureFlags = OverridesGetOwnPropertySlot | JSObject::StructureFlags;
+
+ private:
+ virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
+ virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
+
+ virtual const ClassInfo* classInfo() const { return &info; }
+ static const ClassInfo info;
+ };
+
+ UString JSONStringify(ExecState* exec, JSValue value, unsigned indent);
+
+} // namespace JSC
+
+#endif // JSONObject_h
diff --git a/Source/JavaScriptCore/runtime/JSObject.cpp b/Source/JavaScriptCore/runtime/JSObject.cpp
new file mode 100644
index 0000000..30e40e4
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/JSObject.cpp
@@ -0,0 +1,722 @@
+/*
+ * Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
+ * Copyright (C) 2001 Peter Kelly (pmk@post.com)
+ * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2007 Eric Seidel (eric@webkit.org)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+#include "JSObject.h"
+
+#include "DatePrototype.h"
+#include "ErrorConstructor.h"
+#include "GetterSetter.h"
+#include "JSFunction.h"
+#include "JSGlobalObject.h"
+#include "NativeErrorConstructor.h"
+#include "ObjectPrototype.h"
+#include "PropertyDescriptor.h"
+#include "PropertyNameArray.h"
+#include "Lookup.h"
+#include "Nodes.h"
+#include "Operations.h"
+#include <math.h>
+#include <wtf/Assertions.h>
+
+namespace JSC {
+
+ASSERT_CLASS_FITS_IN_CELL(JSObject);
+
+const char* StrictModeReadonlyPropertyWriteError = "Attempted to assign to readonly property.";
+
+static inline void getClassPropertyNames(ExecState* exec, const ClassInfo* classInfo, PropertyNameArray& propertyNames, EnumerationMode mode)
+{
+ // Add properties from the static hashtables of properties
+ for (; classInfo; classInfo = classInfo->parentClass) {
+ const HashTable* table = classInfo->propHashTable(exec);
+ if (!table)
+ continue;
+ table->initializeIfNeeded(exec);
+ ASSERT(table->table);
+
+ int hashSizeMask = table->compactSize - 1;
+ const HashEntry* entry = table->table;
+ for (int i = 0; i <= hashSizeMask; ++i, ++entry) {
+ if (entry->key() && (!(entry->attributes() & DontEnum) || (mode == IncludeDontEnumProperties)))
+ propertyNames.add(entry->key());
+ }
+ }
+}
+
+void JSObject::markChildren(MarkStack& markStack)
+{
+#ifndef NDEBUG
+ bool wasCheckingForDefaultMarkViolation = markStack.m_isCheckingForDefaultMarkViolation;
+ markStack.m_isCheckingForDefaultMarkViolation = false;
+#endif
+
+ markChildrenDirect(markStack);
+
+#ifndef NDEBUG
+ markStack.m_isCheckingForDefaultMarkViolation = wasCheckingForDefaultMarkViolation;
+#endif
+}
+
+UString JSObject::className() const
+{
+ const ClassInfo* info = classInfo();
+ if (info)
+ return info->className;
+ return "Object";
+}
+
+bool JSObject::getOwnPropertySlot(ExecState* exec, unsigned propertyName, PropertySlot& slot)
+{
+ return getOwnPropertySlot(exec, Identifier::from(exec, propertyName), slot);
+}
+
+static void throwSetterError(ExecState* exec)
+{
+ throwError(exec, createTypeError(exec, "setting a property that has only a getter"));
+}
+
+// ECMA 8.6.2.2
+void JSObject::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
+{
+ ASSERT(value);
+ ASSERT(!Heap::heap(value) || Heap::heap(value) == Heap::heap(this));
+
+ if (propertyName == exec->propertyNames().underscoreProto) {
+ // Setting __proto__ to a non-object, non-null value is silently ignored to match Mozilla.
+ if (!value.isObject() && !value.isNull())
+ return;
+ if (!setPrototypeWithCycleCheck(value))
+ throwError(exec, createError(exec, "cyclic __proto__ value"));
+ return;
+ }
+
+ // Check if there are any setters or getters in the prototype chain
+ JSValue prototype;
+ for (JSObject* obj = this; !obj->structure()->hasGetterSetterProperties(); obj = asObject(prototype)) {
+ prototype = obj->prototype();
+ if (prototype.isNull()) {
+ if (!putDirectInternal(exec->globalData(), propertyName, value, 0, true, slot) && slot.isStrictMode())
+ throwTypeError(exec, StrictModeReadonlyPropertyWriteError);
+ return;
+ }
+ }
+
+ unsigned attributes;
+ JSCell* specificValue;
+ if ((m_structure->get(propertyName, attributes, specificValue) != WTF::notFound) && attributes & ReadOnly) {
+ if (slot.isStrictMode())
+ throwError(exec, createTypeError(exec, StrictModeReadonlyPropertyWriteError));
+ return;
+ }
+
+ for (JSObject* obj = this; ; obj = asObject(prototype)) {
+ if (JSValue gs = obj->getDirect(propertyName)) {
+ if (gs.isGetterSetter()) {
+ JSObject* setterFunc = asGetterSetter(gs)->setter();
+ if (!setterFunc) {
+ throwSetterError(exec);
+ return;
+ }
+
+ CallData callData;
+ CallType callType = setterFunc->getCallData(callData);
+ MarkedArgumentBuffer args;
+ args.append(value);
+ call(exec, setterFunc, callType, callData, this, args);
+ return;
+ }
+
+ // If there's an existing property on the object or one of its
+ // prototypes it should be replaced, so break here.
+ break;
+ }
+
+ prototype = obj->prototype();
+ if (prototype.isNull())
+ break;
+ }
+
+ if (!putDirectInternal(exec->globalData(), propertyName, value, 0, true, slot) && slot.isStrictMode())
+ throwTypeError(exec, StrictModeReadonlyPropertyWriteError);
+ return;
+}
+
+void JSObject::put(ExecState* exec, unsigned propertyName, JSValue value)
+{
+ PutPropertySlot slot;
+ put(exec, Identifier::from(exec, propertyName), value, slot);
+}
+
+void JSObject::putWithAttributes(JSGlobalData* globalData, const Identifier& propertyName, JSValue value, unsigned attributes, bool checkReadOnly, PutPropertySlot& slot)
+{
+ putDirectInternal(*globalData, propertyName, value, attributes, checkReadOnly, slot);
+}
+
+void JSObject::putWithAttributes(JSGlobalData* globalData, const Identifier& propertyName, JSValue value, unsigned attributes)
+{
+ putDirectInternal(*globalData, propertyName, value, attributes);
+}
+
+void JSObject::putWithAttributes(JSGlobalData* globalData, unsigned propertyName, JSValue value, unsigned attributes)
+{
+ putWithAttributes(globalData, Identifier::from(globalData, propertyName), value, attributes);
+}
+
+void JSObject::putWithAttributes(ExecState* exec, const Identifier& propertyName, JSValue value, unsigned attributes, bool checkReadOnly, PutPropertySlot& slot)
+{
+ putDirectInternal(exec->globalData(), propertyName, value, attributes, checkReadOnly, slot);
+}
+
+void JSObject::putWithAttributes(ExecState* exec, const Identifier& propertyName, JSValue value, unsigned attributes)
+{
+ putDirectInternal(exec->globalData(), propertyName, value, attributes);
+}
+
+void JSObject::putWithAttributes(ExecState* exec, unsigned propertyName, JSValue value, unsigned attributes)
+{
+ putWithAttributes(exec, Identifier::from(exec, propertyName), value, attributes);
+}
+
+bool JSObject::hasProperty(ExecState* exec, const Identifier& propertyName) const
+{
+ PropertySlot slot;
+ return const_cast<JSObject*>(this)->getPropertySlot(exec, propertyName, slot);
+}
+
+bool JSObject::hasProperty(ExecState* exec, unsigned propertyName) const
+{
+ PropertySlot slot;
+ return const_cast<JSObject*>(this)->getPropertySlot(exec, propertyName, slot);
+}
+
+// ECMA 8.6.2.5
+bool JSObject::deleteProperty(ExecState* exec, const Identifier& propertyName)
+{
+ unsigned attributes;
+ JSCell* specificValue;
+ if (m_structure->get(propertyName, attributes, specificValue) != WTF::notFound) {
+ if ((attributes & DontDelete))
+ return false;
+ removeDirect(propertyName);
+ return true;
+ }
+
+ // Look in the static hashtable of properties
+ const HashEntry* entry = findPropertyHashEntry(exec, propertyName);
+ if (entry && entry->attributes() & DontDelete)
+ return false; // this builtin property can't be deleted
+
+ // FIXME: Should the code here actually do some deletion?
+ return true;
+}
+
+bool JSObject::hasOwnProperty(ExecState* exec, const Identifier& propertyName) const
+{
+ PropertySlot slot;
+ return const_cast<JSObject*>(this)->getOwnPropertySlot(exec, propertyName, slot);
+}
+
+bool JSObject::deleteProperty(ExecState* exec, unsigned propertyName)
+{
+ return deleteProperty(exec, Identifier::from(exec, propertyName));
+}
+
+static ALWAYS_INLINE JSValue callDefaultValueFunction(ExecState* exec, const JSObject* object, const Identifier& propertyName)
+{
+ JSValue function = object->get(exec, propertyName);
+ CallData callData;
+ CallType callType = getCallData(function, callData);
+ if (callType == CallTypeNone)
+ return exec->exception();
+
+ // Prevent "toString" and "valueOf" from observing execution if an exception
+ // is pending.
+ if (exec->hadException())
+ return exec->exception();
+
+ JSValue result = call(exec, function, callType, callData, const_cast<JSObject*>(object), exec->emptyList());
+ ASSERT(!result.isGetterSetter());
+ if (exec->hadException())
+ return exec->exception();
+ if (result.isObject())
+ return JSValue();
+ return result;
+}
+
+bool JSObject::getPrimitiveNumber(ExecState* exec, double& number, JSValue& result)
+{
+ result = defaultValue(exec, PreferNumber);
+ number = result.toNumber(exec);
+ return !result.isString();
+}
+
+// ECMA 8.6.2.6
+JSValue JSObject::defaultValue(ExecState* exec, PreferredPrimitiveType hint) const
+{
+ // Must call toString first for Date objects.
+ if ((hint == PreferString) || (hint != PreferNumber && prototype() == exec->lexicalGlobalObject()->datePrototype())) {
+ JSValue value = callDefaultValueFunction(exec, this, exec->propertyNames().toString);
+ if (value)
+ return value;
+ value = callDefaultValueFunction(exec, this, exec->propertyNames().valueOf);
+ if (value)
+ return value;
+ } else {
+ JSValue value = callDefaultValueFunction(exec, this, exec->propertyNames().valueOf);
+ if (value)
+ return value;
+ value = callDefaultValueFunction(exec, this, exec->propertyNames().toString);
+ if (value)
+ return value;
+ }
+
+ ASSERT(!exec->hadException());
+
+ return throwError(exec, createTypeError(exec, "No default value"));
+}
+
+const HashEntry* JSObject::findPropertyHashEntry(ExecState* exec, const Identifier& propertyName) const
+{
+ for (const ClassInfo* info = classInfo(); info; info = info->parentClass) {
+ if (const HashTable* propHashTable = info->propHashTable(exec)) {
+ if (const HashEntry* entry = propHashTable->entry(exec, propertyName))
+ return entry;
+ }
+ }
+ return 0;
+}
+
+void JSObject::defineGetter(ExecState* exec, const Identifier& propertyName, JSObject* getterFunction, unsigned attributes)
+{
+ JSValue object = getDirect(propertyName);
+ if (object && object.isGetterSetter()) {
+ ASSERT(m_structure->hasGetterSetterProperties());
+ asGetterSetter(object)->setGetter(getterFunction);
+ return;
+ }
+
+ PutPropertySlot slot;
+ GetterSetter* getterSetter = new (exec) GetterSetter(exec);
+ putDirectInternal(exec->globalData(), propertyName, getterSetter, attributes | Getter, true, slot);
+
+ // putDirect will change our Structure if we add a new property. For
+ // getters and setters, though, we also need to change our Structure
+ // if we override an existing non-getter or non-setter.
+ if (slot.type() != PutPropertySlot::NewProperty) {
+ if (!m_structure->isDictionary()) {
+ RefPtr<Structure> structure = Structure::getterSetterTransition(m_structure);
+ setStructure(structure.release());
+ }
+ }
+
+ m_structure->setHasGetterSetterProperties(true);
+ getterSetter->setGetter(getterFunction);
+}
+
+void JSObject::defineSetter(ExecState* exec, const Identifier& propertyName, JSObject* setterFunction, unsigned attributes)
+{
+ JSValue object = getDirect(propertyName);
+ if (object && object.isGetterSetter()) {
+ ASSERT(m_structure->hasGetterSetterProperties());
+ asGetterSetter(object)->setSetter(setterFunction);
+ return;
+ }
+
+ PutPropertySlot slot;
+ GetterSetter* getterSetter = new (exec) GetterSetter(exec);
+ putDirectInternal(exec->globalData(), propertyName, getterSetter, attributes | Setter, true, slot);
+
+ // putDirect will change our Structure if we add a new property. For
+ // getters and setters, though, we also need to change our Structure
+ // if we override an existing non-getter or non-setter.
+ if (slot.type() != PutPropertySlot::NewProperty) {
+ if (!m_structure->isDictionary()) {
+ RefPtr<Structure> structure = Structure::getterSetterTransition(m_structure);
+ setStructure(structure.release());
+ }
+ }
+
+ m_structure->setHasGetterSetterProperties(true);
+ getterSetter->setSetter(setterFunction);
+}
+
+JSValue JSObject::lookupGetter(ExecState*, const Identifier& propertyName)
+{
+ JSObject* object = this;
+ while (true) {
+ if (JSValue value = object->getDirect(propertyName)) {
+ if (!value.isGetterSetter())
+ return jsUndefined();
+ JSObject* functionObject = asGetterSetter(value)->getter();
+ if (!functionObject)
+ return jsUndefined();
+ return functionObject;
+ }
+
+ if (!object->prototype() || !object->prototype().isObject())
+ return jsUndefined();
+ object = asObject(object->prototype());
+ }
+}
+
+JSValue JSObject::lookupSetter(ExecState*, const Identifier& propertyName)
+{
+ JSObject* object = this;
+ while (true) {
+ if (JSValue value = object->getDirect(propertyName)) {
+ if (!value.isGetterSetter())
+ return jsUndefined();
+ JSObject* functionObject = asGetterSetter(value)->setter();
+ if (!functionObject)
+ return jsUndefined();
+ return functionObject;
+ }
+
+ if (!object->prototype() || !object->prototype().isObject())
+ return jsUndefined();
+ object = asObject(object->prototype());
+ }
+}
+
+bool JSObject::hasInstance(ExecState* exec, JSValue value, JSValue proto)
+{
+ if (!value.isObject())
+ return false;
+
+ if (!proto.isObject()) {
+ throwError(exec, createTypeError(exec, "instanceof called on an object with an invalid prototype property."));
+ return false;
+ }
+
+ JSObject* object = asObject(value);
+ while ((object = object->prototype().getObject())) {
+ if (proto == object)
+ return true;
+ }
+ return false;
+}
+
+bool JSObject::propertyIsEnumerable(ExecState* exec, const Identifier& propertyName) const
+{
+ PropertyDescriptor descriptor;
+ if (!const_cast<JSObject*>(this)->getOwnPropertyDescriptor(exec, propertyName, descriptor))
+ return false;
+ return descriptor.enumerable();
+}
+
+bool JSObject::getPropertySpecificValue(ExecState*, const Identifier& propertyName, JSCell*& specificValue) const
+{
+ unsigned attributes;
+ if (m_structure->get(propertyName, attributes, specificValue) != WTF::notFound)
+ return true;
+
+ // This could be a function within the static table? - should probably
+ // also look in the hash? This currently should not be a problem, since
+ // we've currently always call 'get' first, which should have populated
+ // the normal storage.
+ return false;
+}
+
+void JSObject::getPropertyNames(ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
+{
+ getOwnPropertyNames(exec, propertyNames, mode);
+
+ if (prototype().isNull())
+ return;
+
+ JSObject* prototype = asObject(this->prototype());
+ while(1) {
+ if (prototype->structure()->typeInfo().overridesGetPropertyNames()) {
+ prototype->getPropertyNames(exec, propertyNames, mode);
+ break;
+ }
+ prototype->getOwnPropertyNames(exec, propertyNames, mode);
+ JSValue nextProto = prototype->prototype();
+ if (nextProto.isNull())
+ break;
+ prototype = asObject(nextProto);
+ }
+}
+
+void JSObject::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
+{
+ m_structure->getPropertyNames(propertyNames, mode);
+ getClassPropertyNames(exec, classInfo(), propertyNames, mode);
+}
+
+bool JSObject::toBoolean(ExecState*) const
+{
+ return true;
+}
+
+double JSObject::toNumber(ExecState* exec) const
+{
+ JSValue primitive = toPrimitive(exec, PreferNumber);
+ if (exec->hadException()) // should be picked up soon in Nodes.cpp
+ return 0.0;
+ return primitive.toNumber(exec);
+}
+
+UString JSObject::toString(ExecState* exec) const
+{
+ JSValue primitive = toPrimitive(exec, PreferString);
+ if (exec->hadException())
+ return "";
+ return primitive.toString(exec);
+}
+
+JSObject* JSObject::toObject(ExecState*) const
+{
+ return const_cast<JSObject*>(this);
+}
+
+JSObject* JSObject::toThisObject(ExecState*) const
+{
+ return const_cast<JSObject*>(this);
+}
+
+JSValue JSObject::toStrictThisObject(ExecState*) const
+{
+ return const_cast<JSObject*>(this);
+}
+
+JSObject* JSObject::unwrappedObject()
+{
+ return this;
+}
+
+void JSObject::removeDirect(const Identifier& propertyName)
+{
+ size_t offset;
+ if (m_structure->isUncacheableDictionary()) {
+ offset = m_structure->removePropertyWithoutTransition(propertyName);
+ if (offset != WTF::notFound)
+ putDirectOffset(offset, jsUndefined());
+ return;
+ }
+
+ RefPtr<Structure> structure = Structure::removePropertyTransition(m_structure, propertyName, offset);
+ setStructure(structure.release());
+ if (offset != WTF::notFound)
+ putDirectOffset(offset, jsUndefined());
+}
+
+void JSObject::putDirectFunction(ExecState* exec, InternalFunction* function, unsigned attr)
+{
+ putDirectFunction(Identifier(exec, function->name(exec)), function, attr);
+}
+
+void JSObject::putDirectFunction(ExecState* exec, JSFunction* function, unsigned attr)
+{
+ putDirectFunction(Identifier(exec, function->name(exec)), function, attr);
+}
+
+void JSObject::putDirectFunctionWithoutTransition(ExecState* exec, InternalFunction* function, unsigned attr)
+{
+ putDirectFunctionWithoutTransition(Identifier(exec, function->name(exec)), function, attr);
+}
+
+void JSObject::putDirectFunctionWithoutTransition(ExecState* exec, JSFunction* function, unsigned attr)
+{
+ putDirectFunctionWithoutTransition(Identifier(exec, function->name(exec)), function, attr);
+}
+
+NEVER_INLINE void JSObject::fillGetterPropertySlot(PropertySlot& slot, JSValue* location)
+{
+ if (JSObject* getterFunction = asGetterSetter(*location)->getter()) {
+ if (!structure()->isDictionary())
+ slot.setCacheableGetterSlot(this, getterFunction, offsetForLocation(location));
+ else
+ slot.setGetterSlot(getterFunction);
+ } else
+ slot.setUndefined();
+}
+
+Structure* JSObject::createInheritorID()
+{
+ m_inheritorID = JSObject::createStructure(this);
+ return m_inheritorID.get();
+}
+
+void JSObject::allocatePropertyStorage(size_t oldSize, size_t newSize)
+{
+ allocatePropertyStorageInline(oldSize, newSize);
+}
+
+bool JSObject::getOwnPropertyDescriptor(ExecState*, const Identifier& propertyName, PropertyDescriptor& descriptor)
+{
+ unsigned attributes = 0;
+ JSCell* cell = 0;
+ size_t offset = m_structure->get(propertyName, attributes, cell);
+ if (offset == WTF::notFound)
+ return false;
+ descriptor.setDescriptor(getDirectOffset(offset), attributes);
+ return true;
+}
+
+bool JSObject::getPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
+{
+ JSObject* object = this;
+ while (true) {
+ if (object->getOwnPropertyDescriptor(exec, propertyName, descriptor))
+ return true;
+ JSValue prototype = object->prototype();
+ if (!prototype.isObject())
+ return false;
+ object = asObject(prototype);
+ }
+}
+
+static bool putDescriptor(ExecState* exec, JSObject* target, const Identifier& propertyName, PropertyDescriptor& descriptor, unsigned attributes, JSValue oldValue)
+{
+ if (descriptor.isGenericDescriptor() || descriptor.isDataDescriptor()) {
+ target->putWithAttributes(exec, propertyName, descriptor.value() ? descriptor.value() : oldValue, attributes & ~(Getter | Setter));
+ return true;
+ }
+ attributes &= ~ReadOnly;
+ if (descriptor.getter() && descriptor.getter().isObject())
+ target->defineGetter(exec, propertyName, asObject(descriptor.getter()), attributes);
+ if (exec->hadException())
+ return false;
+ if (descriptor.setter() && descriptor.setter().isObject())
+ target->defineSetter(exec, propertyName, asObject(descriptor.setter()), attributes);
+ return !exec->hadException();
+}
+
+bool JSObject::defineOwnProperty(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor, bool throwException)
+{
+ // If we have a new property we can just put it on normally
+ PropertyDescriptor current;
+ if (!getOwnPropertyDescriptor(exec, propertyName, current))
+ return putDescriptor(exec, this, propertyName, descriptor, descriptor.attributes(), jsUndefined());
+
+ if (descriptor.isEmpty())
+ return true;
+
+ if (current.equalTo(exec, descriptor))
+ return true;
+
+ // Filter out invalid changes
+ if (!current.configurable()) {
+ if (descriptor.configurable()) {
+ if (throwException)
+ throwError(exec, createTypeError(exec, "Attempting to configurable attribute of unconfigurable property."));
+ return false;
+ }
+ if (descriptor.enumerablePresent() && descriptor.enumerable() != current.enumerable()) {
+ if (throwException)
+ throwError(exec, createTypeError(exec, "Attempting to change enumerable attribute of unconfigurable property."));
+ return false;
+ }
+ }
+
+ // A generic descriptor is simply changing the attributes of an existing property
+ if (descriptor.isGenericDescriptor()) {
+ if (!current.attributesEqual(descriptor)) {
+ deleteProperty(exec, propertyName);
+ putDescriptor(exec, this, propertyName, descriptor, current.attributesWithOverride(descriptor), current.value());
+ }
+ return true;
+ }
+
+ // Changing between a normal property or an accessor property
+ if (descriptor.isDataDescriptor() != current.isDataDescriptor()) {
+ if (!current.configurable()) {
+ if (throwException)
+ throwError(exec, createTypeError(exec, "Attempting to change access mechanism for an unconfigurable property."));
+ return false;
+ }
+ deleteProperty(exec, propertyName);
+ return putDescriptor(exec, this, propertyName, descriptor, current.attributesWithOverride(descriptor), current.value() ? current.value() : jsUndefined());
+ }
+
+ // Changing the value and attributes of an existing property
+ if (descriptor.isDataDescriptor()) {
+ if (!current.configurable()) {
+ if (!current.writable() && descriptor.writable()) {
+ if (throwException)
+ throwError(exec, createTypeError(exec, "Attempting to change writable attribute of unconfigurable property."));
+ return false;
+ }
+ if (!current.writable()) {
+ if (descriptor.value() || !JSValue::strictEqual(exec, current.value(), descriptor.value())) {
+ if (throwException)
+ throwError(exec, createTypeError(exec, "Attempting to change value of a readonly property."));
+ return false;
+ }
+ }
+ } else if (current.attributesEqual(descriptor)) {
+ if (!descriptor.value())
+ return true;
+ PutPropertySlot slot;
+ put(exec, propertyName, descriptor.value(), slot);
+ if (exec->hadException())
+ return false;
+ return true;
+ }
+ deleteProperty(exec, propertyName);
+ return putDescriptor(exec, this, propertyName, descriptor, current.attributesWithOverride(descriptor), current.value());
+ }
+
+ // Changing the accessor functions of an existing accessor property
+ ASSERT(descriptor.isAccessorDescriptor());
+ if (!current.configurable()) {
+ if (descriptor.setterPresent() && !(current.setter() && JSValue::strictEqual(exec, current.setter(), descriptor.setter()))) {
+ if (throwException)
+ throwError(exec, createTypeError(exec, "Attempting to change the setter of an unconfigurable property."));
+ return false;
+ }
+ if (descriptor.getterPresent() && !(current.getter() && JSValue::strictEqual(exec, current.getter(), descriptor.getter()))) {
+ if (throwException)
+ throwError(exec, createTypeError(exec, "Attempting to change the getter of an unconfigurable property."));
+ return false;
+ }
+ }
+ JSValue accessor = getDirect(propertyName);
+ if (!accessor)
+ return false;
+ GetterSetter* getterSetter = asGetterSetter(accessor);
+ if (current.attributesEqual(descriptor)) {
+ if (descriptor.setter())
+ getterSetter->setSetter(asObject(descriptor.setter()));
+ if (descriptor.getter())
+ getterSetter->setGetter(asObject(descriptor.getter()));
+ return true;
+ }
+ deleteProperty(exec, propertyName);
+ unsigned attrs = current.attributesWithOverride(descriptor);
+ if (descriptor.setter())
+ attrs |= Setter;
+ if (descriptor.getter())
+ attrs |= Getter;
+ putDirect(propertyName, getterSetter, attrs);
+ return true;
+}
+
+JSObject* throwTypeError(ExecState* exec, const UString& message)
+{
+ return throwError(exec, createTypeError(exec, message));
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/JSObject.h b/Source/JavaScriptCore/runtime/JSObject.h
new file mode 100644
index 0000000..803abfd
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/JSObject.h
@@ -0,0 +1,771 @@
+/*
+ * Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
+ * Copyright (C) 2001 Peter Kelly (pmk@post.com)
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef JSObject_h
+#define JSObject_h
+
+#include "ArgList.h"
+#include "ClassInfo.h"
+#include "CommonIdentifiers.h"
+#include "Completion.h"
+#include "CallFrame.h"
+#include "JSCell.h"
+#include "JSNumberCell.h"
+#include "MarkStack.h"
+#include "PropertySlot.h"
+#include "PutPropertySlot.h"
+#include "ScopeChain.h"
+#include "Structure.h"
+#include "JSGlobalData.h"
+#include "JSString.h"
+#include <wtf/StdLibExtras.h>
+
+namespace JSC {
+
+ inline JSCell* getJSFunction(JSGlobalData& globalData, JSValue value)
+ {
+ if (value.isCell() && (value.asCell()->vptr() == globalData.jsFunctionVPtr))
+ return value.asCell();
+ return 0;
+ }
+
+ class HashEntry;
+ class InternalFunction;
+ class PropertyDescriptor;
+ class PropertyNameArray;
+ class Structure;
+ struct HashTable;
+
+ JSObject* throwTypeError(ExecState*, const UString&);
+ extern const char* StrictModeReadonlyPropertyWriteError;
+
+ // ECMA 262-3 8.6.1
+ // Property attributes
+ enum Attribute {
+ None = 0,
+ ReadOnly = 1 << 1, // property can be only read, not written
+ DontEnum = 1 << 2, // property doesn't appear in (for .. in ..)
+ DontDelete = 1 << 3, // property can't be deleted
+ Function = 1 << 4, // property is a function - only used by static hashtables
+ Getter = 1 << 5, // property is a getter
+ Setter = 1 << 6 // property is a setter
+ };
+
+ typedef EncodedJSValue* PropertyStorage;
+ typedef const EncodedJSValue* ConstPropertyStorage;
+
+ class JSObject : public JSCell {
+ friend class BatchedTransitionOptimizer;
+ friend class JIT;
+ friend class JSCell;
+ friend void setUpStaticFunctionSlot(ExecState* exec, const HashEntry* entry, JSObject* thisObj, const Identifier& propertyName, PropertySlot& slot);
+
+ public:
+ explicit JSObject(NonNullPassRefPtr<Structure>);
+
+ virtual void markChildren(MarkStack&);
+ ALWAYS_INLINE void markChildrenDirect(MarkStack& markStack);
+
+ // The inline virtual destructor cannot be the first virtual function declared
+ // in the class as it results in the vtable being generated as a weak symbol
+ virtual ~JSObject();
+
+ JSValue prototype() const;
+ void setPrototype(JSValue prototype);
+ bool setPrototypeWithCycleCheck(JSValue prototype);
+
+ void setStructure(NonNullPassRefPtr<Structure>);
+ Structure* inheritorID();
+
+ virtual UString className() const;
+
+ JSValue get(ExecState*, const Identifier& propertyName) const;
+ JSValue get(ExecState*, unsigned propertyName) const;
+
+ bool getPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&);
+ bool getPropertySlot(ExecState*, unsigned propertyName, PropertySlot&);
+ bool getPropertyDescriptor(ExecState*, const Identifier& propertyName, PropertyDescriptor&);
+
+ virtual bool getOwnPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&);
+ virtual bool getOwnPropertySlot(ExecState*, unsigned propertyName, PropertySlot&);
+ virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
+
+ virtual void put(ExecState*, const Identifier& propertyName, JSValue value, PutPropertySlot&);
+ virtual void put(ExecState*, unsigned propertyName, JSValue value);
+
+ virtual void putWithAttributes(JSGlobalData*, const Identifier& propertyName, JSValue value, unsigned attributes, bool checkReadOnly, PutPropertySlot& slot);
+ virtual void putWithAttributes(JSGlobalData*, const Identifier& propertyName, JSValue value, unsigned attributes);
+ virtual void putWithAttributes(JSGlobalData*, unsigned propertyName, JSValue value, unsigned attributes);
+ virtual void putWithAttributes(ExecState*, const Identifier& propertyName, JSValue value, unsigned attributes, bool checkReadOnly, PutPropertySlot& slot);
+ virtual void putWithAttributes(ExecState*, const Identifier& propertyName, JSValue value, unsigned attributes);
+ virtual void putWithAttributes(ExecState*, unsigned propertyName, JSValue value, unsigned attributes);
+
+ bool propertyIsEnumerable(ExecState*, const Identifier& propertyName) const;
+
+ bool hasProperty(ExecState*, const Identifier& propertyName) const;
+ bool hasProperty(ExecState*, unsigned propertyName) const;
+ bool hasOwnProperty(ExecState*, const Identifier& propertyName) const;
+
+ virtual bool deleteProperty(ExecState*, const Identifier& propertyName);
+ virtual bool deleteProperty(ExecState*, unsigned propertyName);
+
+ virtual JSValue defaultValue(ExecState*, PreferredPrimitiveType) const;
+
+ virtual bool hasInstance(ExecState*, JSValue, JSValue prototypeProperty);
+
+ virtual void getPropertyNames(ExecState*, PropertyNameArray&, EnumerationMode mode = ExcludeDontEnumProperties);
+ virtual void getOwnPropertyNames(ExecState*, PropertyNameArray&, EnumerationMode mode = ExcludeDontEnumProperties);
+
+ virtual JSValue toPrimitive(ExecState*, PreferredPrimitiveType = NoPreference) const;
+ virtual bool getPrimitiveNumber(ExecState*, double& number, JSValue& value);
+ virtual bool toBoolean(ExecState*) const;
+ virtual double toNumber(ExecState*) const;
+ virtual UString toString(ExecState*) const;
+ virtual JSObject* toObject(ExecState*) const;
+
+ virtual JSObject* toThisObject(ExecState*) const;
+ virtual JSValue toStrictThisObject(ExecState*) const;
+ virtual JSObject* unwrappedObject();
+
+ bool getPropertySpecificValue(ExecState* exec, const Identifier& propertyName, JSCell*& specificFunction) const;
+
+ // This get function only looks at the property map.
+ JSValue getDirect(const Identifier& propertyName) const
+ {
+ size_t offset = m_structure->get(propertyName);
+ return offset != WTF::notFound ? getDirectOffset(offset) : JSValue();
+ }
+
+ JSValue* getDirectLocation(const Identifier& propertyName)
+ {
+ size_t offset = m_structure->get(propertyName);
+ return offset != WTF::notFound ? locationForOffset(offset) : 0;
+ }
+
+ JSValue* getDirectLocation(const Identifier& propertyName, unsigned& attributes)
+ {
+ JSCell* specificFunction;
+ size_t offset = m_structure->get(propertyName, attributes, specificFunction);
+ return offset != WTF::notFound ? locationForOffset(offset) : 0;
+ }
+
+ size_t offsetForLocation(JSValue* location) const
+ {
+ return location - reinterpret_cast<const JSValue*>(propertyStorage());
+ }
+
+ void transitionTo(Structure*);
+
+ void removeDirect(const Identifier& propertyName);
+ bool hasCustomProperties() { return !m_structure->isEmpty(); }
+ bool hasGetterSetterProperties() { return m_structure->hasGetterSetterProperties(); }
+
+ bool putDirect(const Identifier& propertyName, JSValue value, unsigned attr, bool checkReadOnly, PutPropertySlot& slot);
+ void putDirect(const Identifier& propertyName, JSValue value, unsigned attr = 0);
+ bool putDirect(const Identifier& propertyName, JSValue value, PutPropertySlot&);
+
+ void putDirectFunction(const Identifier& propertyName, JSCell* value, unsigned attr = 0);
+ void putDirectFunction(const Identifier& propertyName, JSCell* value, unsigned attr, bool checkReadOnly, PutPropertySlot& slot);
+ void putDirectFunction(ExecState* exec, InternalFunction* function, unsigned attr = 0);
+ void putDirectFunction(ExecState* exec, JSFunction* function, unsigned attr = 0);
+
+ void putDirectWithoutTransition(const Identifier& propertyName, JSValue value, unsigned attr = 0);
+ void putDirectFunctionWithoutTransition(const Identifier& propertyName, JSCell* value, unsigned attr = 0);
+ void putDirectFunctionWithoutTransition(ExecState* exec, InternalFunction* function, unsigned attr = 0);
+ void putDirectFunctionWithoutTransition(ExecState* exec, JSFunction* function, unsigned attr = 0);
+
+ // Fast access to known property offsets.
+ JSValue getDirectOffset(size_t offset) const { return JSValue::decode(propertyStorage()[offset]); }
+ void putDirectOffset(size_t offset, JSValue value) { propertyStorage()[offset] = JSValue::encode(value); }
+
+ void fillGetterPropertySlot(PropertySlot&, JSValue* location);
+
+ virtual void defineGetter(ExecState*, const Identifier& propertyName, JSObject* getterFunction, unsigned attributes = 0);
+ virtual void defineSetter(ExecState*, const Identifier& propertyName, JSObject* setterFunction, unsigned attributes = 0);
+ virtual JSValue lookupGetter(ExecState*, const Identifier& propertyName);
+ virtual JSValue lookupSetter(ExecState*, const Identifier& propertyName);
+ virtual bool defineOwnProperty(ExecState*, const Identifier& propertyName, PropertyDescriptor&, bool shouldThrow);
+
+ virtual bool isGlobalObject() const { return false; }
+ virtual bool isVariableObject() const { return false; }
+ virtual bool isActivationObject() const { return false; }
+ virtual bool isStrictModeFunction() const { return false; }
+ virtual bool isErrorInstance() const { return false; }
+
+ virtual ComplType exceptionType() const { return Throw; }
+
+ void allocatePropertyStorage(size_t oldSize, size_t newSize);
+ void allocatePropertyStorageInline(size_t oldSize, size_t newSize);
+ bool isUsingInlineStorage() const { return m_structure->isUsingInlineStorage(); }
+
+ static const unsigned inlineStorageCapacity = sizeof(EncodedJSValue) == 2 * sizeof(void*) ? 4 : 3;
+ static const unsigned nonInlineBaseStorageCapacity = 16;
+
+ static PassRefPtr<Structure> createStructure(JSValue prototype)
+ {
+ return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount);
+ }
+
+ void flattenDictionaryObject()
+ {
+ m_structure->flattenDictionaryStructure(this);
+ }
+
+ void putAnonymousValue(unsigned index, JSValue value)
+ {
+ ASSERT(index < m_structure->anonymousSlotCount());
+ *locationForOffset(index) = value;
+ }
+ JSValue getAnonymousValue(unsigned index) const
+ {
+ ASSERT(index < m_structure->anonymousSlotCount());
+ return *locationForOffset(index);
+ }
+
+ protected:
+ static const unsigned StructureFlags = 0;
+
+ private:
+ // Nobody should ever ask any of these questions on something already known to be a JSObject.
+ using JSCell::isAPIValueWrapper;
+ using JSCell::isGetterSetter;
+ using JSCell::toObject;
+ void getObject();
+ void getString(ExecState* exec);
+ void isObject();
+ void isString();
+
+ ConstPropertyStorage propertyStorage() const { return (isUsingInlineStorage() ? m_inlineStorage : m_externalStorage); }
+ PropertyStorage propertyStorage() { return (isUsingInlineStorage() ? m_inlineStorage : m_externalStorage); }
+
+ const JSValue* locationForOffset(size_t offset) const
+ {
+ return reinterpret_cast<const JSValue*>(&propertyStorage()[offset]);
+ }
+
+ JSValue* locationForOffset(size_t offset)
+ {
+ return reinterpret_cast<JSValue*>(&propertyStorage()[offset]);
+ }
+
+ bool putDirectInternal(const Identifier& propertyName, JSValue value, unsigned attr, bool checkReadOnly, PutPropertySlot& slot, JSCell*);
+ bool putDirectInternal(JSGlobalData&, const Identifier& propertyName, JSValue value, unsigned attr, bool checkReadOnly, PutPropertySlot& slot);
+ void putDirectInternal(JSGlobalData&, const Identifier& propertyName, JSValue value, unsigned attr = 0);
+
+ bool inlineGetOwnPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&);
+
+ const HashEntry* findPropertyHashEntry(ExecState*, const Identifier& propertyName) const;
+ Structure* createInheritorID();
+
+ union {
+ PropertyStorage m_externalStorage;
+ EncodedJSValue m_inlineStorage[inlineStorageCapacity];
+ };
+
+ RefPtr<Structure> m_inheritorID;
+ };
+
+inline JSObject* asObject(JSCell* cell)
+{
+ ASSERT(cell->isObject());
+ return static_cast<JSObject*>(cell);
+}
+
+inline JSObject* asObject(JSValue value)
+{
+ return asObject(value.asCell());
+}
+
+inline JSObject::JSObject(NonNullPassRefPtr<Structure> structure)
+ : JSCell(structure.releaseRef()) // ~JSObject balances this ref()
+{
+ ASSERT(m_structure->propertyStorageCapacity() == inlineStorageCapacity);
+ ASSERT(m_structure->isEmpty());
+ ASSERT(prototype().isNull() || Heap::heap(this) == Heap::heap(prototype()));
+ ASSERT(OBJECT_OFFSETOF(JSObject, m_inlineStorage) % sizeof(double) == 0);
+}
+
+inline JSObject::~JSObject()
+{
+ ASSERT(m_structure);
+ if (!isUsingInlineStorage())
+ delete [] m_externalStorage;
+ m_structure->deref();
+}
+
+inline JSValue JSObject::prototype() const
+{
+ return m_structure->storedPrototype();
+}
+
+inline bool JSObject::setPrototypeWithCycleCheck(JSValue prototype)
+{
+ JSValue nextPrototypeValue = prototype;
+ while (nextPrototypeValue && nextPrototypeValue.isObject()) {
+ JSObject* nextPrototype = asObject(nextPrototypeValue)->unwrappedObject();
+ if (nextPrototype == this)
+ return false;
+ nextPrototypeValue = nextPrototype->prototype();
+ }
+ setPrototype(prototype);
+ return true;
+}
+
+inline void JSObject::setPrototype(JSValue prototype)
+{
+ ASSERT(prototype);
+ RefPtr<Structure> newStructure = Structure::changePrototypeTransition(m_structure, prototype);
+ setStructure(newStructure.release());
+}
+
+inline void JSObject::setStructure(NonNullPassRefPtr<Structure> structure)
+{
+ m_structure->deref();
+ m_structure = structure.leakRef(); // ~JSObject balances this ref()
+}
+
+inline Structure* JSObject::inheritorID()
+{
+ if (m_inheritorID)
+ return m_inheritorID.get();
+ return createInheritorID();
+}
+
+inline bool Structure::isUsingInlineStorage() const
+{
+ return (propertyStorageCapacity() == JSObject::inlineStorageCapacity);
+}
+
+inline bool JSCell::inherits(const ClassInfo* info) const
+{
+ for (const ClassInfo* ci = classInfo(); ci; ci = ci->parentClass) {
+ if (ci == info)
+ return true;
+ }
+ return false;
+}
+
+// this method is here to be after the inline declaration of JSCell::inherits
+inline bool JSValue::inherits(const ClassInfo* classInfo) const
+{
+ return isCell() && asCell()->inherits(classInfo);
+}
+
+ALWAYS_INLINE bool JSObject::inlineGetOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
+{
+ if (JSValue* location = getDirectLocation(propertyName)) {
+ if (m_structure->hasGetterSetterProperties() && location[0].isGetterSetter())
+ fillGetterPropertySlot(slot, location);
+ else
+ slot.setValueSlot(this, location, offsetForLocation(location));
+ return true;
+ }
+
+ // non-standard Netscape extension
+ if (propertyName == exec->propertyNames().underscoreProto) {
+ slot.setValue(prototype());
+ return true;
+ }
+
+ return false;
+}
+
+// It may seem crazy to inline a function this large, especially a virtual function,
+// but it makes a big difference to property lookup that derived classes can inline their
+// base class call to this.
+ALWAYS_INLINE bool JSObject::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
+{
+ return inlineGetOwnPropertySlot(exec, propertyName, slot);
+}
+
+ALWAYS_INLINE bool JSCell::fastGetOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
+{
+ if (!structure()->typeInfo().overridesGetOwnPropertySlot())
+ return asObject(this)->inlineGetOwnPropertySlot(exec, propertyName, slot);
+ return getOwnPropertySlot(exec, propertyName, slot);
+}
+
+// It may seem crazy to inline a function this large but it makes a big difference
+// since this is function very hot in variable lookup
+ALWAYS_INLINE bool JSObject::getPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
+{
+ JSObject* object = this;
+ while (true) {
+ if (object->fastGetOwnPropertySlot(exec, propertyName, slot))
+ return true;
+ JSValue prototype = object->prototype();
+ if (!prototype.isObject())
+ return false;
+ object = asObject(prototype);
+ }
+}
+
+ALWAYS_INLINE bool JSObject::getPropertySlot(ExecState* exec, unsigned propertyName, PropertySlot& slot)
+{
+ JSObject* object = this;
+ while (true) {
+ if (object->getOwnPropertySlot(exec, propertyName, slot))
+ return true;
+ JSValue prototype = object->prototype();
+ if (!prototype.isObject())
+ return false;
+ object = asObject(prototype);
+ }
+}
+
+inline JSValue JSObject::get(ExecState* exec, const Identifier& propertyName) const
+{
+ PropertySlot slot(this);
+ if (const_cast<JSObject*>(this)->getPropertySlot(exec, propertyName, slot))
+ return slot.getValue(exec, propertyName);
+
+ return jsUndefined();
+}
+
+inline JSValue JSObject::get(ExecState* exec, unsigned propertyName) const
+{
+ PropertySlot slot(this);
+ if (const_cast<JSObject*>(this)->getPropertySlot(exec, propertyName, slot))
+ return slot.getValue(exec, propertyName);
+
+ return jsUndefined();
+}
+
+inline bool JSObject::putDirectInternal(const Identifier& propertyName, JSValue value, unsigned attributes, bool checkReadOnly, PutPropertySlot& slot, JSCell* specificFunction)
+{
+ ASSERT(value);
+ ASSERT(!Heap::heap(value) || Heap::heap(value) == Heap::heap(this));
+
+ if (m_structure->isDictionary()) {
+ unsigned currentAttributes;
+ JSCell* currentSpecificFunction;
+ size_t offset = m_structure->get(propertyName, currentAttributes, currentSpecificFunction);
+ if (offset != WTF::notFound) {
+ // If there is currently a specific function, and there now either isn't,
+ // or the new value is different, then despecify.
+ if (currentSpecificFunction && (specificFunction != currentSpecificFunction))
+ m_structure->despecifyDictionaryFunction(propertyName);
+ if (checkReadOnly && currentAttributes & ReadOnly)
+ return false;
+
+ putDirectOffset(offset, value);
+ // At this point, the objects structure only has a specific value set if previously there
+ // had been one set, and if the new value being specified is the same (otherwise we would
+ // have despecified, above). So, if currentSpecificFunction is not set, or if the new
+ // value is different (or there is no new value), then the slot now has no value - and
+ // as such it is cachable.
+ // If there was previously a value, and the new value is the same, then we cannot cache.
+ if (!currentSpecificFunction || (specificFunction != currentSpecificFunction))
+ slot.setExistingProperty(this, offset);
+ return true;
+ }
+
+ size_t currentCapacity = m_structure->propertyStorageCapacity();
+ offset = m_structure->addPropertyWithoutTransition(propertyName, attributes, specificFunction);
+ if (currentCapacity != m_structure->propertyStorageCapacity())
+ allocatePropertyStorage(currentCapacity, m_structure->propertyStorageCapacity());
+
+ ASSERT(offset < m_structure->propertyStorageCapacity());
+ putDirectOffset(offset, value);
+ // See comment on setNewProperty call below.
+ if (!specificFunction)
+ slot.setNewProperty(this, offset);
+ return true;
+ }
+
+ size_t offset;
+ size_t currentCapacity = m_structure->propertyStorageCapacity();
+ if (RefPtr<Structure> structure = Structure::addPropertyTransitionToExistingStructure(m_structure, propertyName, attributes, specificFunction, offset)) {
+ if (currentCapacity != structure->propertyStorageCapacity())
+ allocatePropertyStorage(currentCapacity, structure->propertyStorageCapacity());
+
+ ASSERT(offset < structure->propertyStorageCapacity());
+ setStructure(structure.release());
+ putDirectOffset(offset, value);
+ // This is a new property; transitions with specific values are not currently cachable,
+ // so leave the slot in an uncachable state.
+ if (!specificFunction)
+ slot.setNewProperty(this, offset);
+ return true;
+ }
+
+ unsigned currentAttributes;
+ JSCell* currentSpecificFunction;
+ offset = m_structure->get(propertyName, currentAttributes, currentSpecificFunction);
+ if (offset != WTF::notFound) {
+ if (checkReadOnly && currentAttributes & ReadOnly)
+ return false;
+
+ // There are three possibilities here:
+ // (1) There is an existing specific value set, and we're overwriting with *the same value*.
+ // * Do nothing - no need to despecify, but that means we can't cache (a cached
+ // put could write a different value). Leave the slot in an uncachable state.
+ // (2) There is a specific value currently set, but we're writing a different value.
+ // * First, we have to despecify. Having done so, this is now a regular slot
+ // with no specific value, so go ahead & cache like normal.
+ // (3) Normal case, there is no specific value set.
+ // * Go ahead & cache like normal.
+ if (currentSpecificFunction) {
+ // case (1) Do the put, then return leaving the slot uncachable.
+ if (specificFunction == currentSpecificFunction) {
+ putDirectOffset(offset, value);
+ return true;
+ }
+ // case (2) Despecify, fall through to (3).
+ setStructure(Structure::despecifyFunctionTransition(m_structure, propertyName));
+ }
+
+ // case (3) set the slot, do the put, return.
+ slot.setExistingProperty(this, offset);
+ putDirectOffset(offset, value);
+ return true;
+ }
+
+ // If we have a specific function, we may have got to this point if there is
+ // already a transition with the correct property name and attributes, but
+ // specialized to a different function. In this case we just want to give up
+ // and despecialize the transition.
+ // In this case we clear the value of specificFunction which will result
+ // in us adding a non-specific transition, and any subsequent lookup in
+ // Structure::addPropertyTransitionToExistingStructure will just use that.
+ if (specificFunction && m_structure->hasTransition(propertyName, attributes))
+ specificFunction = 0;
+
+ RefPtr<Structure> structure = Structure::addPropertyTransition(m_structure, propertyName, attributes, specificFunction, offset);
+
+ if (currentCapacity != structure->propertyStorageCapacity())
+ allocatePropertyStorage(currentCapacity, structure->propertyStorageCapacity());
+
+ ASSERT(offset < structure->propertyStorageCapacity());
+ setStructure(structure.release());
+ putDirectOffset(offset, value);
+ // This is a new property; transitions with specific values are not currently cachable,
+ // so leave the slot in an uncachable state.
+ if (!specificFunction)
+ slot.setNewProperty(this, offset);
+ return true;
+}
+
+inline bool JSObject::putDirectInternal(JSGlobalData& globalData, const Identifier& propertyName, JSValue value, unsigned attributes, bool checkReadOnly, PutPropertySlot& slot)
+{
+ ASSERT(value);
+ ASSERT(!Heap::heap(value) || Heap::heap(value) == Heap::heap(this));
+
+ return putDirectInternal(propertyName, value, attributes, checkReadOnly, slot, getJSFunction(globalData, value));
+}
+
+inline void JSObject::putDirectInternal(JSGlobalData& globalData, const Identifier& propertyName, JSValue value, unsigned attributes)
+{
+ PutPropertySlot slot;
+ putDirectInternal(propertyName, value, attributes, false, slot, getJSFunction(globalData, value));
+}
+
+inline bool JSObject::putDirect(const Identifier& propertyName, JSValue value, unsigned attributes, bool checkReadOnly, PutPropertySlot& slot)
+{
+ ASSERT(value);
+ ASSERT(!Heap::heap(value) || Heap::heap(value) == Heap::heap(this));
+
+ return putDirectInternal(propertyName, value, attributes, checkReadOnly, slot, 0);
+}
+
+inline void JSObject::putDirect(const Identifier& propertyName, JSValue value, unsigned attributes)
+{
+ PutPropertySlot slot;
+ putDirectInternal(propertyName, value, attributes, false, slot, 0);
+}
+
+inline bool JSObject::putDirect(const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
+{
+ return putDirectInternal(propertyName, value, 0, false, slot, 0);
+}
+
+inline void JSObject::putDirectFunction(const Identifier& propertyName, JSCell* value, unsigned attributes, bool checkReadOnly, PutPropertySlot& slot)
+{
+ putDirectInternal(propertyName, value, attributes, checkReadOnly, slot, value);
+}
+
+inline void JSObject::putDirectFunction(const Identifier& propertyName, JSCell* value, unsigned attr)
+{
+ PutPropertySlot slot;
+ putDirectInternal(propertyName, value, attr, false, slot, value);
+}
+
+inline void JSObject::putDirectWithoutTransition(const Identifier& propertyName, JSValue value, unsigned attributes)
+{
+ size_t currentCapacity = m_structure->propertyStorageCapacity();
+ size_t offset = m_structure->addPropertyWithoutTransition(propertyName, attributes, 0);
+ if (currentCapacity != m_structure->propertyStorageCapacity())
+ allocatePropertyStorage(currentCapacity, m_structure->propertyStorageCapacity());
+ putDirectOffset(offset, value);
+}
+
+inline void JSObject::putDirectFunctionWithoutTransition(const Identifier& propertyName, JSCell* value, unsigned attributes)
+{
+ size_t currentCapacity = m_structure->propertyStorageCapacity();
+ size_t offset = m_structure->addPropertyWithoutTransition(propertyName, attributes, value);
+ if (currentCapacity != m_structure->propertyStorageCapacity())
+ allocatePropertyStorage(currentCapacity, m_structure->propertyStorageCapacity());
+ putDirectOffset(offset, value);
+}
+
+inline void JSObject::transitionTo(Structure* newStructure)
+{
+ if (m_structure->propertyStorageCapacity() != newStructure->propertyStorageCapacity())
+ allocatePropertyStorage(m_structure->propertyStorageCapacity(), newStructure->propertyStorageCapacity());
+ setStructure(newStructure);
+}
+
+inline JSValue JSObject::toPrimitive(ExecState* exec, PreferredPrimitiveType preferredType) const
+{
+ return defaultValue(exec, preferredType);
+}
+
+inline JSValue JSValue::get(ExecState* exec, const Identifier& propertyName) const
+{
+ PropertySlot slot(asValue());
+ return get(exec, propertyName, slot);
+}
+
+inline JSValue JSValue::get(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) const
+{
+ if (UNLIKELY(!isCell())) {
+ JSObject* prototype = synthesizePrototype(exec);
+ if (propertyName == exec->propertyNames().underscoreProto)
+ return prototype;
+ if (!prototype->getPropertySlot(exec, propertyName, slot))
+ return jsUndefined();
+ return slot.getValue(exec, propertyName);
+ }
+ JSCell* cell = asCell();
+ while (true) {
+ if (cell->fastGetOwnPropertySlot(exec, propertyName, slot))
+ return slot.getValue(exec, propertyName);
+ JSValue prototype = asObject(cell)->prototype();
+ if (!prototype.isObject())
+ return jsUndefined();
+ cell = asObject(prototype);
+ }
+}
+
+inline JSValue JSValue::get(ExecState* exec, unsigned propertyName) const
+{
+ PropertySlot slot(asValue());
+ return get(exec, propertyName, slot);
+}
+
+inline JSValue JSValue::get(ExecState* exec, unsigned propertyName, PropertySlot& slot) const
+{
+ if (UNLIKELY(!isCell())) {
+ JSObject* prototype = synthesizePrototype(exec);
+ if (!prototype->getPropertySlot(exec, propertyName, slot))
+ return jsUndefined();
+ return slot.getValue(exec, propertyName);
+ }
+ JSCell* cell = const_cast<JSCell*>(asCell());
+ while (true) {
+ if (cell->getOwnPropertySlot(exec, propertyName, slot))
+ return slot.getValue(exec, propertyName);
+ JSValue prototype = asObject(cell)->prototype();
+ if (!prototype.isObject())
+ return jsUndefined();
+ cell = prototype.asCell();
+ }
+}
+
+inline void JSValue::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
+{
+ if (UNLIKELY(!isCell())) {
+ synthesizeObject(exec)->put(exec, propertyName, value, slot);
+ return;
+ }
+ asCell()->put(exec, propertyName, value, slot);
+}
+
+inline void JSValue::putDirect(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
+{
+ ASSERT(isCell() && isObject());
+ if (!asObject(asCell())->putDirect(propertyName, value, slot) && slot.isStrictMode())
+ throwTypeError(exec, StrictModeReadonlyPropertyWriteError);
+}
+
+inline void JSValue::put(ExecState* exec, unsigned propertyName, JSValue value)
+{
+ if (UNLIKELY(!isCell())) {
+ synthesizeObject(exec)->put(exec, propertyName, value);
+ return;
+ }
+ asCell()->put(exec, propertyName, value);
+}
+
+ALWAYS_INLINE void JSObject::allocatePropertyStorageInline(size_t oldSize, size_t newSize)
+{
+ ASSERT(newSize > oldSize);
+
+ // It's important that this function not rely on m_structure, since
+ // we might be in the middle of a transition.
+ bool wasInline = (oldSize == JSObject::inlineStorageCapacity);
+
+ PropertyStorage oldPropertyStorage = (wasInline ? m_inlineStorage : m_externalStorage);
+ PropertyStorage newPropertyStorage = new EncodedJSValue[newSize];
+
+ for (unsigned i = 0; i < oldSize; ++i)
+ newPropertyStorage[i] = oldPropertyStorage[i];
+
+ if (!wasInline)
+ delete [] oldPropertyStorage;
+
+ m_externalStorage = newPropertyStorage;
+}
+
+ALWAYS_INLINE void JSObject::markChildrenDirect(MarkStack& markStack)
+{
+ JSCell::markChildren(markStack);
+
+ markStack.append(prototype());
+
+ PropertyStorage storage = propertyStorage();
+ size_t storageSize = m_structure->propertyStorageSize();
+ markStack.appendValues(reinterpret_cast<JSValue*>(storage), storageSize);
+}
+
+// --- JSValue inlines ----------------------------
+
+ALWAYS_INLINE UString JSValue::toThisString(ExecState* exec) const
+{
+ return isString() ? static_cast<JSString*>(asCell())->value(exec) : toThisObject(exec)->toString(exec);
+}
+
+inline JSString* JSValue::toThisJSString(ExecState* exec) const
+{
+ return isString() ? static_cast<JSString*>(asCell()) : jsString(exec, toThisObject(exec)->toString(exec));
+}
+
+inline JSValue JSValue::toStrictThisObject(ExecState* exec) const
+{
+ if (!isObject())
+ return *this;
+ return asObject(asCell())->toStrictThisObject(exec);
+}
+
+} // namespace JSC
+
+#endif // JSObject_h
diff --git a/Source/JavaScriptCore/runtime/JSObjectWithGlobalObject.cpp b/Source/JavaScriptCore/runtime/JSObjectWithGlobalObject.cpp
new file mode 100644
index 0000000..e9d6c96
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/JSObjectWithGlobalObject.cpp
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JSObjectWithGlobalObject.h"
+
+#include "JSGlobalObject.h"
+
+namespace JSC {
+
+JSObjectWithGlobalObject::JSObjectWithGlobalObject(JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure)
+ : JSObject(structure)
+{
+ COMPILE_ASSERT(AnonymousSlotCount == 1, AnonymousSlotCount_must_be_one);
+ ASSERT(!globalObject || globalObject->isGlobalObject());
+ putAnonymousValue(GlobalObjectSlot, globalObject);
+}
+
+JSGlobalObject* JSObjectWithGlobalObject::globalObject() const
+{
+ return asGlobalObject((getAnonymousValue(GlobalObjectSlot).asCell()));
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/JSObjectWithGlobalObject.h b/Source/JavaScriptCore/runtime/JSObjectWithGlobalObject.h
new file mode 100644
index 0000000..9416a62
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/JSObjectWithGlobalObject.h
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef JSObjectWithGlobalObject_h
+#define JSObjectWithGlobalObject_h
+
+#include "JSObject.h"
+
+namespace JSC {
+
+class JSGlobalObject;
+
+class JSObjectWithGlobalObject : public JSObject {
+public:
+ static PassRefPtr<Structure> createStructure(JSValue proto)
+ {
+ return Structure::create(proto, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount);
+ }
+
+ JSGlobalObject* globalObject() const;
+
+protected:
+ JSObjectWithGlobalObject(JSGlobalObject*, NonNullPassRefPtr<Structure>);
+
+ JSObjectWithGlobalObject(NonNullPassRefPtr<Structure> structure)
+ : JSObject(structure)
+ {
+ // Should only be used by JSFunction when we aquire the JSFunction vptr.
+ }
+ static const unsigned AnonymousSlotCount = JSObject::AnonymousSlotCount + 1;
+ static const unsigned GlobalObjectSlot = 0;
+};
+
+} // namespace JSC
+
+#endif // JSObjectWithGlobalObject_h
diff --git a/Source/JavaScriptCore/runtime/JSPropertyNameIterator.cpp b/Source/JavaScriptCore/runtime/JSPropertyNameIterator.cpp
new file mode 100644
index 0000000..a5d4da0
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/JSPropertyNameIterator.cpp
@@ -0,0 +1,108 @@
+/*
+ * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JSPropertyNameIterator.h"
+
+#include "JSGlobalObject.h"
+
+namespace JSC {
+
+ASSERT_CLASS_FITS_IN_CELL(JSPropertyNameIterator);
+
+inline JSPropertyNameIterator::JSPropertyNameIterator(ExecState* exec, PropertyNameArrayData* propertyNameArrayData, size_t numCacheableSlots)
+ : JSCell(exec->globalData().propertyNameIteratorStructure.get())
+ , m_cachedStructure(0)
+ , m_numCacheableSlots(numCacheableSlots)
+ , m_jsStringsSize(propertyNameArrayData->propertyNameVector().size())
+ , m_jsStrings(new JSValue[m_jsStringsSize])
+{
+ PropertyNameArrayData::PropertyNameVector& propertyNameVector = propertyNameArrayData->propertyNameVector();
+ for (size_t i = 0; i < m_jsStringsSize; ++i)
+ m_jsStrings[i] = jsOwnedString(exec, propertyNameVector[i].ustring());
+}
+
+JSPropertyNameIterator::~JSPropertyNameIterator()
+{
+ if (m_cachedStructure)
+ m_cachedStructure->clearEnumerationCache(this);
+}
+
+JSPropertyNameIterator* JSPropertyNameIterator::create(ExecState* exec, JSObject* o)
+{
+ ASSERT(!o->structure()->enumerationCache() ||
+ o->structure()->enumerationCache()->cachedStructure() != o->structure() ||
+ o->structure()->enumerationCache()->cachedPrototypeChain() != o->structure()->prototypeChain(exec));
+
+ PropertyNameArray propertyNames(exec);
+ o->getPropertyNames(exec, propertyNames);
+ size_t numCacheableSlots = 0;
+ if (!o->structure()->hasNonEnumerableProperties() && !o->structure()->hasAnonymousSlots() &&
+ !o->structure()->hasGetterSetterProperties() && !o->structure()->isUncacheableDictionary() &&
+ !o->structure()->typeInfo().overridesGetPropertyNames())
+ numCacheableSlots = o->structure()->propertyStorageSize();
+
+ JSPropertyNameIterator* jsPropertyNameIterator = new (exec) JSPropertyNameIterator(exec, propertyNames.data(), numCacheableSlots);
+
+ if (o->structure()->isDictionary())
+ return jsPropertyNameIterator;
+
+ if (o->structure()->typeInfo().overridesGetPropertyNames())
+ return jsPropertyNameIterator;
+
+ size_t count = normalizePrototypeChain(exec, o);
+ StructureChain* structureChain = o->structure()->prototypeChain(exec);
+ RefPtr<Structure>* structure = structureChain->head();
+ for (size_t i = 0; i < count; ++i) {
+ if (structure[i]->typeInfo().overridesGetPropertyNames())
+ return jsPropertyNameIterator;
+ }
+
+ jsPropertyNameIterator->setCachedPrototypeChain(structureChain);
+ jsPropertyNameIterator->setCachedStructure(o->structure());
+ o->structure()->setEnumerationCache(jsPropertyNameIterator);
+ return jsPropertyNameIterator;
+}
+
+JSValue JSPropertyNameIterator::get(ExecState* exec, JSObject* base, size_t i)
+{
+ JSValue& identifier = m_jsStrings[i];
+ if (m_cachedStructure == base->structure() && m_cachedPrototypeChain == base->structure()->prototypeChain(exec))
+ return identifier;
+
+ if (!base->hasProperty(exec, Identifier(exec, asString(identifier)->value(exec))))
+ return JSValue();
+ return identifier;
+}
+
+void JSPropertyNameIterator::markChildren(MarkStack& markStack)
+{
+ markStack.appendValues(m_jsStrings.get(), m_jsStringsSize, MayContainNullValues);
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/JSPropertyNameIterator.h b/Source/JavaScriptCore/runtime/JSPropertyNameIterator.h
new file mode 100644
index 0000000..01700ac
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/JSPropertyNameIterator.h
@@ -0,0 +1,109 @@
+/*
+ * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef JSPropertyNameIterator_h
+#define JSPropertyNameIterator_h
+
+#include "JSObject.h"
+#include "JSString.h"
+#include "Operations.h"
+#include "PropertyNameArray.h"
+
+namespace JSC {
+
+ class Identifier;
+ class JSObject;
+
+ class JSPropertyNameIterator : public JSCell {
+ friend class JIT;
+
+ public:
+ static JSPropertyNameIterator* create(ExecState*, JSObject*);
+
+ static PassRefPtr<Structure> createStructure(JSValue prototype)
+ {
+ return Structure::create(prototype, TypeInfo(CompoundType, OverridesMarkChildren), AnonymousSlotCount);
+ }
+
+ virtual ~JSPropertyNameIterator();
+
+ virtual bool isPropertyNameIterator() const { return true; }
+
+ virtual void markChildren(MarkStack&);
+
+ bool getOffset(size_t i, int& offset)
+ {
+ if (i >= m_numCacheableSlots)
+ return false;
+ offset = i;
+ return true;
+ }
+
+ JSValue get(ExecState*, JSObject*, size_t i);
+ size_t size() { return m_jsStringsSize; }
+
+ void setCachedStructure(Structure* structure)
+ {
+ ASSERT(!m_cachedStructure);
+ ASSERT(structure);
+ m_cachedStructure = structure;
+ }
+ Structure* cachedStructure() { return m_cachedStructure.get(); }
+
+ void setCachedPrototypeChain(NonNullPassRefPtr<StructureChain> cachedPrototypeChain) { m_cachedPrototypeChain = cachedPrototypeChain; }
+ StructureChain* cachedPrototypeChain() { return m_cachedPrototypeChain.get(); }
+
+ private:
+ JSPropertyNameIterator(ExecState*, PropertyNameArrayData* propertyNameArrayData, size_t numCacheableSlot);
+
+ RefPtr<Structure> m_cachedStructure;
+ RefPtr<StructureChain> m_cachedPrototypeChain;
+ uint32_t m_numCacheableSlots;
+ uint32_t m_jsStringsSize;
+ OwnArrayPtr<JSValue> m_jsStrings;
+ };
+
+ inline void Structure::setEnumerationCache(JSPropertyNameIterator* enumerationCache)
+ {
+ ASSERT(!isDictionary());
+ m_enumerationCache = enumerationCache;
+ }
+
+ inline void Structure::clearEnumerationCache(JSPropertyNameIterator* enumerationCache)
+ {
+ m_enumerationCache.clear(enumerationCache);
+ }
+
+ inline JSPropertyNameIterator* Structure::enumerationCache()
+ {
+ return m_enumerationCache.get();
+ }
+
+} // namespace JSC
+
+#endif // JSPropertyNameIterator_h
diff --git a/Source/JavaScriptCore/runtime/JSStaticScopeObject.cpp b/Source/JavaScriptCore/runtime/JSStaticScopeObject.cpp
new file mode 100644
index 0000000..7ab1d1c
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/JSStaticScopeObject.cpp
@@ -0,0 +1,82 @@
+/*
+ * Copyright (C) 2008, 2009 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#include "JSStaticScopeObject.h"
+
+namespace JSC {
+
+ASSERT_CLASS_FITS_IN_CELL(JSStaticScopeObject);
+
+void JSStaticScopeObject::markChildren(MarkStack& markStack)
+{
+ JSVariableObject::markChildren(markStack);
+ markStack.append(d()->registerStore.jsValue());
+}
+
+JSObject* JSStaticScopeObject::toThisObject(ExecState* exec) const
+{
+ return exec->globalThisValue();
+}
+
+JSValue JSStaticScopeObject::toStrictThisObject(ExecState*) const
+{
+ return jsNull();
+}
+
+void JSStaticScopeObject::put(ExecState*, const Identifier& propertyName, JSValue value, PutPropertySlot&)
+{
+ if (symbolTablePut(propertyName, value))
+ return;
+
+ ASSERT_NOT_REACHED();
+}
+
+void JSStaticScopeObject::putWithAttributes(ExecState*, const Identifier& propertyName, JSValue value, unsigned attributes)
+{
+ if (symbolTablePutWithAttributes(propertyName, value, attributes))
+ return;
+
+ ASSERT_NOT_REACHED();
+}
+
+bool JSStaticScopeObject::isDynamicScope(bool&) const
+{
+ return false;
+}
+
+JSStaticScopeObject::~JSStaticScopeObject()
+{
+ ASSERT(d());
+ delete d();
+}
+
+inline bool JSStaticScopeObject::getOwnPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot& slot)
+{
+ return symbolTableGet(propertyName, slot);
+}
+
+}
diff --git a/Source/JavaScriptCore/runtime/JSStaticScopeObject.h b/Source/JavaScriptCore/runtime/JSStaticScopeObject.h
new file mode 100644
index 0000000..e69356a
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/JSStaticScopeObject.h
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2008, 2009 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef JSStaticScopeObject_h
+#define JSStaticScopeObject_h
+
+#include "JSVariableObject.h"
+
+namespace JSC{
+
+ class JSStaticScopeObject : public JSVariableObject {
+ protected:
+ using JSVariableObject::JSVariableObjectData;
+ struct JSStaticScopeObjectData : public JSVariableObjectData {
+ JSStaticScopeObjectData()
+ : JSVariableObjectData(&symbolTable, &registerStore + 1)
+ {
+ }
+ SymbolTable symbolTable;
+ Register registerStore;
+ };
+
+ public:
+ JSStaticScopeObject(ExecState* exec, const Identifier& ident, JSValue value, unsigned attributes)
+ : JSVariableObject(exec->globalData().staticScopeStructure, new JSStaticScopeObjectData())
+ {
+ d()->registerStore = value;
+ symbolTable().add(ident.impl(), SymbolTableEntry(-1, attributes));
+ }
+ virtual ~JSStaticScopeObject();
+ virtual void markChildren(MarkStack&);
+ bool isDynamicScope(bool& requiresDynamicChecks) const;
+ virtual JSObject* toThisObject(ExecState*) const;
+ virtual JSValue toStrictThisObject(ExecState*) const;
+ virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
+ virtual void put(ExecState*, const Identifier&, JSValue, PutPropertySlot&);
+ void putWithAttributes(ExecState*, const Identifier&, JSValue, unsigned attributes);
+
+ static PassRefPtr<Structure> createStructure(JSValue proto) { return Structure::create(proto, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount); }
+
+ protected:
+ static const unsigned StructureFlags = OverridesGetOwnPropertySlot | NeedsThisConversion | OverridesMarkChildren | OverridesGetPropertyNames | JSVariableObject::StructureFlags;
+
+ private:
+ JSStaticScopeObjectData* d() { return static_cast<JSStaticScopeObjectData*>(JSVariableObject::d); }
+ };
+
+}
+
+#endif // JSStaticScopeObject_h
diff --git a/Source/JavaScriptCore/runtime/JSString.cpp b/Source/JavaScriptCore/runtime/JSString.cpp
new file mode 100644
index 0000000..ba28139
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/JSString.cpp
@@ -0,0 +1,328 @@
+/*
+ * Copyright (C) 1999-2002 Harri Porten (porten@kde.org)
+ * Copyright (C) 2001 Peter Kelly (pmk@post.com)
+ * Copyright (C) 2004, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+#include "JSString.h"
+
+#include "JSGlobalObject.h"
+#include "JSGlobalObjectFunctions.h"
+#include "JSObject.h"
+#include "Operations.h"
+#include "StringObject.h"
+#include "StringPrototype.h"
+
+namespace JSC {
+
+static const unsigned substringFromRopeCutoff = 4;
+
+// Overview: this methods converts a JSString from holding a string in rope form
+// down to a simple UString representation. It does so by building up the string
+// backwards, since we want to avoid recursion, we expect that the tree structure
+// representing the rope is likely imbalanced with more nodes down the left side
+// (since appending to the string is likely more common) - and as such resolving
+// in this fashion should minimize work queue size. (If we built the queue forwards
+// we would likely have to place all of the constituent StringImpls into the
+// Vector before performing any concatenation, but by working backwards we likely
+// only fill the queue with the number of substrings at any given level in a
+// rope-of-ropes.)
+void JSString::resolveRope(ExecState* exec) const
+{
+ ASSERT(isRope());
+
+ // Allocate the buffer to hold the final string, position initially points to the end.
+ UChar* buffer;
+ if (PassRefPtr<StringImpl> newImpl = StringImpl::tryCreateUninitialized(m_length, buffer))
+ m_value = newImpl;
+ else {
+ for (unsigned i = 0; i < m_fiberCount; ++i) {
+ RopeImpl::deref(m_other.m_fibers[i]);
+ m_other.m_fibers[i] = 0;
+ }
+ m_fiberCount = 0;
+ ASSERT(!isRope());
+ ASSERT(m_value == UString());
+ if (exec)
+ throwOutOfMemoryError(exec);
+ return;
+ }
+ UChar* position = buffer + m_length;
+
+ // Start with the current RopeImpl.
+ Vector<RopeImpl::Fiber, 32> workQueue;
+ RopeImpl::Fiber currentFiber;
+ for (unsigned i = 0; i < (m_fiberCount - 1); ++i)
+ workQueue.append(m_other.m_fibers[i]);
+ currentFiber = m_other.m_fibers[m_fiberCount - 1];
+ while (true) {
+ if (RopeImpl::isRope(currentFiber)) {
+ RopeImpl* rope = static_cast<RopeImpl*>(currentFiber);
+ // Copy the contents of the current rope into the workQueue, with the last item in 'currentFiber'
+ // (we will be working backwards over the rope).
+ unsigned fiberCountMinusOne = rope->fiberCount() - 1;
+ for (unsigned i = 0; i < fiberCountMinusOne; ++i)
+ workQueue.append(rope->fibers()[i]);
+ currentFiber = rope->fibers()[fiberCountMinusOne];
+ } else {
+ StringImpl* string = static_cast<StringImpl*>(currentFiber);
+ unsigned length = string->length();
+ position -= length;
+ StringImpl::copyChars(position, string->characters(), length);
+
+ // Was this the last item in the work queue?
+ if (workQueue.isEmpty()) {
+ // Create a string from the UChar buffer, clear the rope RefPtr.
+ ASSERT(buffer == position);
+ for (unsigned i = 0; i < m_fiberCount; ++i) {
+ RopeImpl::deref(m_other.m_fibers[i]);
+ m_other.m_fibers[i] = 0;
+ }
+ m_fiberCount = 0;
+
+ ASSERT(!isRope());
+ return;
+ }
+
+ // No! - set the next item up to process.
+ currentFiber = workQueue.last();
+ workQueue.removeLast();
+ }
+ }
+}
+
+// This function construsts a substring out of a rope without flattening by reusing the existing fibers.
+// This can reduce memory usage substantially. Since traversing ropes is slow the function will revert
+// back to flattening if the rope turns out to be long.
+JSString* JSString::substringFromRope(ExecState* exec, unsigned substringStart, unsigned substringLength)
+{
+ ASSERT(isRope());
+ ASSERT(substringLength);
+
+ JSGlobalData* globalData = &exec->globalData();
+
+ UString substringFibers[3];
+
+ unsigned fiberCount = 0;
+ unsigned substringFiberCount = 0;
+ unsigned substringEnd = substringStart + substringLength;
+ unsigned fiberEnd = 0;
+
+ RopeIterator end;
+ for (RopeIterator it(m_other.m_fibers.data(), m_fiberCount); it != end; ++it) {
+ ++fiberCount;
+ StringImpl* fiberString = *it;
+ unsigned fiberStart = fiberEnd;
+ fiberEnd = fiberStart + fiberString->length();
+ if (fiberEnd <= substringStart)
+ continue;
+ unsigned copyStart = std::max(substringStart, fiberStart);
+ unsigned copyEnd = std::min(substringEnd, fiberEnd);
+ if (copyStart == fiberStart && copyEnd == fiberEnd)
+ substringFibers[substringFiberCount++] = UString(fiberString);
+ else
+ substringFibers[substringFiberCount++] = UString(StringImpl::create(fiberString, copyStart - fiberStart, copyEnd - copyStart));
+ if (fiberEnd >= substringEnd)
+ break;
+ if (fiberCount > substringFromRopeCutoff || substringFiberCount >= 3) {
+ // This turned out to be a really inefficient rope. Just flatten it.
+ resolveRope(exec);
+ return jsSubstring(&exec->globalData(), m_value, substringStart, substringLength);
+ }
+ }
+ ASSERT(substringFiberCount && substringFiberCount <= 3);
+
+ if (substringLength == 1) {
+ ASSERT(substringFiberCount == 1);
+ UChar c = substringFibers[0].characters()[0];
+ if (c <= 0xFF)
+ return globalData->smallStrings.singleCharacterString(globalData, c);
+ }
+ if (substringFiberCount == 1)
+ return new (globalData) JSString(globalData, substringFibers[0]);
+ if (substringFiberCount == 2)
+ return new (globalData) JSString(globalData, substringFibers[0], substringFibers[1]);
+ return new (globalData) JSString(globalData, substringFibers[0], substringFibers[1], substringFibers[2]);
+}
+
+JSValue JSString::replaceCharacter(ExecState* exec, UChar character, const UString& replacement)
+{
+ if (!isRope()) {
+ size_t matchPosition = m_value.find(character);
+ if (matchPosition == notFound)
+ return JSValue(this);
+ return jsString(exec, m_value.substringSharingImpl(0, matchPosition), replacement, m_value.substringSharingImpl(matchPosition + 1));
+ }
+
+ RopeIterator end;
+
+ // Count total fibers and find matching string.
+ size_t fiberCount = 0;
+ StringImpl* matchString = 0;
+ size_t matchPosition = notFound;
+ for (RopeIterator it(m_other.m_fibers.data(), m_fiberCount); it != end; ++it) {
+ ++fiberCount;
+ if (matchString)
+ continue;
+
+ StringImpl* string = *it;
+ matchPosition = string->find(character);
+ if (matchPosition == notFound)
+ continue;
+ matchString = string;
+ }
+
+ if (!matchString)
+ return this;
+
+ RopeBuilder builder(replacement.length() ? fiberCount + 2 : fiberCount + 1);
+ if (UNLIKELY(builder.isOutOfMemory()))
+ return throwOutOfMemoryError(exec);
+
+ for (RopeIterator it(m_other.m_fibers.data(), m_fiberCount); it != end; ++it) {
+ StringImpl* string = *it;
+ if (string != matchString) {
+ builder.append(UString(string));
+ continue;
+ }
+
+ builder.append(UString(string).substringSharingImpl(0, matchPosition));
+ if (replacement.length())
+ builder.append(replacement);
+ builder.append(UString(string).substringSharingImpl(matchPosition + 1));
+ matchString = 0;
+ }
+
+ JSGlobalData* globalData = &exec->globalData();
+ return JSValue(new (globalData) JSString(globalData, builder.release()));
+}
+
+JSString* JSString::getIndexSlowCase(ExecState* exec, unsigned i)
+{
+ ASSERT(isRope());
+ resolveRope(exec);
+ // Return a safe no-value result, this should never be used, since the excetion will be thrown.
+ if (exec->exception())
+ return jsString(exec, "");
+ ASSERT(!isRope());
+ ASSERT(i < m_value.length());
+ return jsSingleCharacterSubstring(exec, m_value, i);
+}
+
+JSValue JSString::toPrimitive(ExecState*, PreferredPrimitiveType) const
+{
+ return const_cast<JSString*>(this);
+}
+
+bool JSString::getPrimitiveNumber(ExecState* exec, double& number, JSValue& result)
+{
+ result = this;
+ number = jsToNumber(value(exec));
+ return false;
+}
+
+bool JSString::toBoolean(ExecState*) const
+{
+ return m_length;
+}
+
+double JSString::toNumber(ExecState* exec) const
+{
+ return jsToNumber(value(exec));
+}
+
+UString JSString::toString(ExecState* exec) const
+{
+ return value(exec);
+}
+
+inline StringObject* StringObject::create(ExecState* exec, JSString* string)
+{
+ return new (exec) StringObject(exec->lexicalGlobalObject()->stringObjectStructure(), string);
+}
+
+JSObject* JSString::toObject(ExecState* exec) const
+{
+ return StringObject::create(exec, const_cast<JSString*>(this));
+}
+
+JSObject* JSString::toThisObject(ExecState* exec) const
+{
+ return StringObject::create(exec, const_cast<JSString*>(this));
+}
+
+bool JSString::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
+{
+ // The semantics here are really getPropertySlot, not getOwnPropertySlot.
+ // This function should only be called by JSValue::get.
+ if (getStringPropertySlot(exec, propertyName, slot))
+ return true;
+ if (propertyName == exec->propertyNames().underscoreProto) {
+ slot.setValue(exec->lexicalGlobalObject()->stringPrototype());
+ return true;
+ }
+ slot.setBase(this);
+ JSObject* object;
+ for (JSValue prototype = exec->lexicalGlobalObject()->stringPrototype(); !prototype.isNull(); prototype = object->prototype()) {
+ object = asObject(prototype);
+ if (object->getOwnPropertySlot(exec, propertyName, slot))
+ return true;
+ }
+ slot.setUndefined();
+ return true;
+}
+
+bool JSString::getStringPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
+{
+ if (propertyName == exec->propertyNames().length) {
+ descriptor.setDescriptor(jsNumber(m_length), DontEnum | DontDelete | ReadOnly);
+ return true;
+ }
+
+ bool isStrictUInt32;
+ unsigned i = propertyName.toUInt32(isStrictUInt32);
+ if (isStrictUInt32 && i < m_length) {
+ descriptor.setDescriptor(getIndex(exec, i), DontDelete | ReadOnly);
+ return true;
+ }
+
+ return false;
+}
+
+bool JSString::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
+{
+ if (getStringPropertyDescriptor(exec, propertyName, descriptor))
+ return true;
+ if (propertyName != exec->propertyNames().underscoreProto)
+ return false;
+ descriptor.setDescriptor(exec->lexicalGlobalObject()->stringPrototype(), DontEnum);
+ return true;
+}
+
+bool JSString::getOwnPropertySlot(ExecState* exec, unsigned propertyName, PropertySlot& slot)
+{
+ // The semantics here are really getPropertySlot, not getOwnPropertySlot.
+ // This function should only be called by JSValue::get.
+ if (getStringPropertySlot(exec, propertyName, slot))
+ return true;
+ return JSString::getOwnPropertySlot(exec, Identifier::from(exec, propertyName), slot);
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/JSString.h b/Source/JavaScriptCore/runtime/JSString.h
new file mode 100644
index 0000000..fefffde
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/JSString.h
@@ -0,0 +1,647 @@
+/*
+ * Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
+ * Copyright (C) 2001 Peter Kelly (pmk@post.com)
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef JSString_h
+#define JSString_h
+
+#include "CallFrame.h"
+#include "CommonIdentifiers.h"
+#include "Identifier.h"
+#include "JSNumberCell.h"
+#include "PropertyDescriptor.h"
+#include "PropertySlot.h"
+#include "RopeImpl.h"
+
+namespace JSC {
+
+ class JSString;
+
+ JSString* jsEmptyString(JSGlobalData*);
+ JSString* jsEmptyString(ExecState*);
+ JSString* jsString(JSGlobalData*, const UString&); // returns empty string if passed null string
+ JSString* jsString(ExecState*, const UString&); // returns empty string if passed null string
+
+ JSString* jsSingleCharacterString(JSGlobalData*, UChar);
+ JSString* jsSingleCharacterString(ExecState*, UChar);
+ JSString* jsSingleCharacterSubstring(ExecState*, const UString&, unsigned offset);
+ JSString* jsSubstring(JSGlobalData*, const UString&, unsigned offset, unsigned length);
+ JSString* jsSubstring(ExecState*, const UString&, unsigned offset, unsigned length);
+
+ // Non-trivial strings are two or more characters long.
+ // These functions are faster than just calling jsString.
+ JSString* jsNontrivialString(JSGlobalData*, const UString&);
+ JSString* jsNontrivialString(ExecState*, const UString&);
+ JSString* jsNontrivialString(JSGlobalData*, const char*);
+ JSString* jsNontrivialString(ExecState*, const char*);
+
+ // Should be used for strings that are owned by an object that will
+ // likely outlive the JSValue this makes, such as the parse tree or a
+ // DOM object that contains a UString
+ JSString* jsOwnedString(JSGlobalData*, const UString&);
+ JSString* jsOwnedString(ExecState*, const UString&);
+
+ typedef void (*JSStringFinalizerCallback)(JSString*, void* context);
+ JSString* jsStringWithFinalizer(ExecState*, const UString&, JSStringFinalizerCallback callback, void* context);
+
+ class JS_EXPORTCLASS JSString : public JSCell {
+ public:
+ friend class JIT;
+ friend class JSGlobalData;
+ friend class SpecializedThunkJIT;
+ friend struct ThunkHelpers;
+
+ class RopeBuilder {
+ public:
+ RopeBuilder(unsigned fiberCount)
+ : m_index(0)
+ , m_rope(RopeImpl::tryCreateUninitialized(fiberCount))
+ {
+ }
+
+ bool isOutOfMemory() { return !m_rope; }
+
+ void append(RopeImpl::Fiber& fiber)
+ {
+ ASSERT(m_rope);
+ m_rope->initializeFiber(m_index, fiber);
+ }
+ void append(const UString& string)
+ {
+ ASSERT(m_rope);
+ m_rope->initializeFiber(m_index, string.impl());
+ }
+ void append(JSString* jsString)
+ {
+ if (jsString->isRope()) {
+ for (unsigned i = 0; i < jsString->m_fiberCount; ++i)
+ append(jsString->m_other.m_fibers[i]);
+ } else
+ append(jsString->string());
+ }
+
+ PassRefPtr<RopeImpl> release()
+ {
+ ASSERT(m_index == m_rope->fiberCount());
+ return m_rope.release();
+ }
+
+ unsigned length() { return m_rope->length(); }
+
+ private:
+ unsigned m_index;
+ RefPtr<RopeImpl> m_rope;
+ };
+
+ class RopeIterator {
+ public:
+ RopeIterator() { }
+
+ RopeIterator(RopeImpl::Fiber* fibers, size_t fiberCount)
+ {
+ ASSERT(fiberCount);
+ m_workQueue.append(WorkItem(fibers, fiberCount));
+ skipRopes();
+ }
+
+ RopeIterator& operator++()
+ {
+ WorkItem& item = m_workQueue.last();
+ ASSERT(!RopeImpl::isRope(item.fibers[item.i]));
+ if (++item.i == item.fiberCount)
+ m_workQueue.removeLast();
+ skipRopes();
+ return *this;
+ }
+
+ StringImpl* operator*()
+ {
+ WorkItem& item = m_workQueue.last();
+ RopeImpl::Fiber fiber = item.fibers[item.i];
+ ASSERT(!RopeImpl::isRope(fiber));
+ return static_cast<StringImpl*>(fiber);
+ }
+
+ bool operator!=(const RopeIterator& other) const
+ {
+ return m_workQueue != other.m_workQueue;
+ }
+
+ private:
+ struct WorkItem {
+ WorkItem(RopeImpl::Fiber* fibers, size_t fiberCount)
+ : fibers(fibers)
+ , fiberCount(fiberCount)
+ , i(0)
+ {
+ }
+
+ bool operator!=(const WorkItem& other) const
+ {
+ return fibers != other.fibers || fiberCount != other.fiberCount || i != other.i;
+ }
+
+ RopeImpl::Fiber* fibers;
+ size_t fiberCount;
+ size_t i;
+ };
+
+ void skipRopes()
+ {
+ if (m_workQueue.isEmpty())
+ return;
+
+ while (1) {
+ WorkItem& item = m_workQueue.last();
+ RopeImpl::Fiber fiber = item.fibers[item.i];
+ if (!RopeImpl::isRope(fiber))
+ break;
+ RopeImpl* rope = static_cast<RopeImpl*>(fiber);
+ if (++item.i == item.fiberCount)
+ m_workQueue.removeLast();
+ m_workQueue.append(WorkItem(rope->fibers(), rope->fiberCount()));
+ }
+ }
+
+ Vector<WorkItem, 16> m_workQueue;
+ };
+
+ ALWAYS_INLINE JSString(JSGlobalData* globalData, const UString& value)
+ : JSCell(globalData->stringStructure.get())
+ , m_length(value.length())
+ , m_value(value)
+ , m_fiberCount(0)
+ {
+ ASSERT(!m_value.isNull());
+ Heap::heap(this)->reportExtraMemoryCost(value.impl()->cost());
+ }
+
+ enum HasOtherOwnerType { HasOtherOwner };
+ JSString(JSGlobalData* globalData, const UString& value, HasOtherOwnerType)
+ : JSCell(globalData->stringStructure.get())
+ , m_length(value.length())
+ , m_value(value)
+ , m_fiberCount(0)
+ {
+ ASSERT(!m_value.isNull());
+ }
+ JSString(JSGlobalData* globalData, PassRefPtr<StringImpl> value, HasOtherOwnerType)
+ : JSCell(globalData->stringStructure.get())
+ , m_length(value->length())
+ , m_value(value)
+ , m_fiberCount(0)
+ {
+ ASSERT(!m_value.isNull());
+ }
+ JSString(JSGlobalData* globalData, PassRefPtr<RopeImpl> rope)
+ : JSCell(globalData->stringStructure.get())
+ , m_length(rope->length())
+ , m_fiberCount(1)
+ {
+ m_other.m_fibers[0] = rope.leakRef();
+ }
+ // This constructor constructs a new string by concatenating s1 & s2.
+ // This should only be called with fiberCount <= 3.
+ JSString(JSGlobalData* globalData, unsigned fiberCount, JSString* s1, JSString* s2)
+ : JSCell(globalData->stringStructure.get())
+ , m_length(s1->length() + s2->length())
+ , m_fiberCount(fiberCount)
+ {
+ ASSERT(fiberCount <= s_maxInternalRopeLength);
+ unsigned index = 0;
+ appendStringInConstruct(index, s1);
+ appendStringInConstruct(index, s2);
+ ASSERT(fiberCount == index);
+ }
+ // This constructor constructs a new string by concatenating s1 & s2.
+ // This should only be called with fiberCount <= 3.
+ JSString(JSGlobalData* globalData, unsigned fiberCount, JSString* s1, const UString& u2)
+ : JSCell(globalData->stringStructure.get())
+ , m_length(s1->length() + u2.length())
+ , m_fiberCount(fiberCount)
+ {
+ ASSERT(fiberCount <= s_maxInternalRopeLength);
+ unsigned index = 0;
+ appendStringInConstruct(index, s1);
+ appendStringInConstruct(index, u2);
+ ASSERT(fiberCount == index);
+ }
+ // This constructor constructs a new string by concatenating s1 & s2.
+ // This should only be called with fiberCount <= 3.
+ JSString(JSGlobalData* globalData, unsigned fiberCount, const UString& u1, JSString* s2)
+ : JSCell(globalData->stringStructure.get())
+ , m_length(u1.length() + s2->length())
+ , m_fiberCount(fiberCount)
+ {
+ ASSERT(fiberCount <= s_maxInternalRopeLength);
+ unsigned index = 0;
+ appendStringInConstruct(index, u1);
+ appendStringInConstruct(index, s2);
+ ASSERT(fiberCount == index);
+ }
+ // This constructor constructs a new string by concatenating v1, v2 & v3.
+ // This should only be called with fiberCount <= 3 ... which since every
+ // value must require a fiberCount of at least one implies that the length
+ // for each value must be exactly 1!
+ JSString(ExecState* exec, JSValue v1, JSValue v2, JSValue v3)
+ : JSCell(exec->globalData().stringStructure.get())
+ , m_length(0)
+ , m_fiberCount(s_maxInternalRopeLength)
+ {
+ unsigned index = 0;
+ appendValueInConstructAndIncrementLength(exec, index, v1);
+ appendValueInConstructAndIncrementLength(exec, index, v2);
+ appendValueInConstructAndIncrementLength(exec, index, v3);
+ ASSERT(index == s_maxInternalRopeLength);
+ }
+
+ // This constructor constructs a new string by concatenating u1 & u2.
+ JSString(JSGlobalData* globalData, const UString& u1, const UString& u2)
+ : JSCell(globalData->stringStructure.get())
+ , m_length(u1.length() + u2.length())
+ , m_fiberCount(2)
+ {
+ unsigned index = 0;
+ appendStringInConstruct(index, u1);
+ appendStringInConstruct(index, u2);
+ ASSERT(index <= s_maxInternalRopeLength);
+ }
+
+ // This constructor constructs a new string by concatenating u1, u2 & u3.
+ JSString(JSGlobalData* globalData, const UString& u1, const UString& u2, const UString& u3)
+ : JSCell(globalData->stringStructure.get())
+ , m_length(u1.length() + u2.length() + u3.length())
+ , m_fiberCount(s_maxInternalRopeLength)
+ {
+ unsigned index = 0;
+ appendStringInConstruct(index, u1);
+ appendStringInConstruct(index, u2);
+ appendStringInConstruct(index, u3);
+ ASSERT(index <= s_maxInternalRopeLength);
+ }
+
+ JSString(JSGlobalData* globalData, const UString& value, JSStringFinalizerCallback finalizer, void* context)
+ : JSCell(globalData->stringStructure.get())
+ , m_length(value.length())
+ , m_value(value)
+ , m_fiberCount(0)
+ {
+ ASSERT(!m_value.isNull());
+ // nasty hack because we can't union non-POD types
+ m_other.m_finalizerCallback = finalizer;
+ m_other.m_finalizerContext = context;
+ Heap::heap(this)->reportExtraMemoryCost(value.impl()->cost());
+ }
+
+ ~JSString()
+ {
+ ASSERT(vptr() == JSGlobalData::jsStringVPtr);
+ for (unsigned i = 0; i < m_fiberCount; ++i)
+ RopeImpl::deref(m_other.m_fibers[i]);
+
+ if (!m_fiberCount && m_other.m_finalizerCallback)
+ m_other.m_finalizerCallback(this, m_other.m_finalizerContext);
+ }
+
+ const UString& value(ExecState* exec) const
+ {
+ if (isRope())
+ resolveRope(exec);
+ return m_value;
+ }
+ const UString& tryGetValue() const
+ {
+ if (isRope())
+ resolveRope(0);
+ return m_value;
+ }
+ unsigned length() { return m_length; }
+
+ bool getStringPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&);
+ bool getStringPropertySlot(ExecState*, unsigned propertyName, PropertySlot&);
+ bool getStringPropertyDescriptor(ExecState*, const Identifier& propertyName, PropertyDescriptor&);
+
+ bool canGetIndex(unsigned i) { return i < m_length; }
+ JSString* getIndex(ExecState*, unsigned);
+ JSString* getIndexSlowCase(ExecState*, unsigned);
+
+ JSValue replaceCharacter(ExecState*, UChar, const UString& replacement);
+
+ static PassRefPtr<Structure> createStructure(JSValue proto) { return Structure::create(proto, TypeInfo(StringType, OverridesGetOwnPropertySlot | NeedsThisConversion), AnonymousSlotCount); }
+
+ private:
+ enum VPtrStealingHackType { VPtrStealingHack };
+ JSString(VPtrStealingHackType)
+ : JSCell(0)
+ , m_fiberCount(0)
+ {
+ }
+
+ void resolveRope(ExecState*) const;
+ JSString* substringFromRope(ExecState*, unsigned offset, unsigned length);
+
+ void appendStringInConstruct(unsigned& index, const UString& string)
+ {
+ StringImpl* impl = string.impl();
+ impl->ref();
+ m_other.m_fibers[index++] = impl;
+ }
+
+ void appendStringInConstruct(unsigned& index, JSString* jsString)
+ {
+ if (jsString->isRope()) {
+ for (unsigned i = 0; i < jsString->m_fiberCount; ++i) {
+ RopeImpl::Fiber fiber = jsString->m_other.m_fibers[i];
+ fiber->ref();
+ m_other.m_fibers[index++] = fiber;
+ }
+ } else
+ appendStringInConstruct(index, jsString->string());
+ }
+
+ void appendValueInConstructAndIncrementLength(ExecState* exec, unsigned& index, JSValue v)
+ {
+ if (v.isString()) {
+ ASSERT(v.asCell()->isString());
+ JSString* s = static_cast<JSString*>(v.asCell());
+ ASSERT(s->fiberCount() == 1);
+ appendStringInConstruct(index, s);
+ m_length += s->length();
+ } else {
+ UString u(v.toString(exec));
+ StringImpl* impl = u.impl();
+ impl->ref();
+ m_other.m_fibers[index++] = impl;
+ m_length += u.length();
+ }
+ }
+
+ virtual JSValue toPrimitive(ExecState*, PreferredPrimitiveType) const;
+ virtual bool getPrimitiveNumber(ExecState*, double& number, JSValue& value);
+ virtual bool toBoolean(ExecState*) const;
+ virtual double toNumber(ExecState*) const;
+ virtual JSObject* toObject(ExecState*) const;
+ virtual UString toString(ExecState*) const;
+
+ virtual JSObject* toThisObject(ExecState*) const;
+
+ // Actually getPropertySlot, not getOwnPropertySlot (see JSCell).
+ virtual bool getOwnPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&);
+ virtual bool getOwnPropertySlot(ExecState*, unsigned propertyName, PropertySlot&);
+ virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
+
+ static const unsigned s_maxInternalRopeLength = 3;
+
+ // A string is represented either by a UString or a RopeImpl.
+ unsigned m_length;
+ mutable UString m_value;
+ mutable unsigned m_fiberCount;
+ // This structure exists to support a temporary workaround for a GC issue.
+ struct JSStringFinalizerStruct {
+ JSStringFinalizerStruct() : m_finalizerCallback(0) {}
+ union {
+ mutable FixedArray<RopeImpl::Fiber, s_maxInternalRopeLength> m_fibers;
+ struct {
+ JSStringFinalizerCallback m_finalizerCallback;
+ void* m_finalizerContext;
+ };
+ };
+ } m_other;
+
+ bool isRope() const { return m_fiberCount; }
+ UString& string() { ASSERT(!isRope()); return m_value; }
+ unsigned fiberCount() { return m_fiberCount ? m_fiberCount : 1; }
+
+ friend JSValue jsString(ExecState* exec, JSString* s1, JSString* s2);
+ friend JSValue jsString(ExecState* exec, const UString& u1, JSString* s2);
+ friend JSValue jsString(ExecState* exec, JSString* s1, const UString& u2);
+ friend JSValue jsString(ExecState* exec, Register* strings, unsigned count);
+ friend JSValue jsString(ExecState* exec, JSValue thisValue);
+ friend JSString* jsStringWithFinalizer(ExecState*, const UString&, JSStringFinalizerCallback callback, void* context);
+ friend JSString* jsSubstring(ExecState* exec, JSString* s, unsigned offset, unsigned length);
+ };
+
+ JSString* asString(JSValue);
+
+ // When an object is created from a different DLL, MSVC changes vptr to a "local" one right after invoking a constructor,
+ // see <http://groups.google.com/group/microsoft.public.vc.language/msg/55cdcefeaf770212>.
+ // This breaks isJSString(), and we don't need that hack anyway, so we change vptr back to primary one.
+ // The below function must be called by any inline function that invokes a JSString constructor.
+#if COMPILER(MSVC) && !defined(BUILDING_JavaScriptCore)
+ inline JSString* fixupVPtr(JSGlobalData* globalData, JSString* string) { string->setVPtr(globalData->jsStringVPtr); return string; }
+#else
+ inline JSString* fixupVPtr(JSGlobalData*, JSString* string) { return string; }
+#endif
+
+ inline JSString* asString(JSValue value)
+ {
+ ASSERT(value.asCell()->isString());
+ return static_cast<JSString*>(value.asCell());
+ }
+
+ inline JSString* jsEmptyString(JSGlobalData* globalData)
+ {
+ return globalData->smallStrings.emptyString(globalData);
+ }
+
+ inline JSString* jsSingleCharacterString(JSGlobalData* globalData, UChar c)
+ {
+ if (c <= 0xFF)
+ return globalData->smallStrings.singleCharacterString(globalData, c);
+ return fixupVPtr(globalData, new (globalData) JSString(globalData, UString(&c, 1)));
+ }
+
+ inline JSString* jsSingleCharacterSubstring(ExecState* exec, const UString& s, unsigned offset)
+ {
+ JSGlobalData* globalData = &exec->globalData();
+ ASSERT(offset < static_cast<unsigned>(s.length()));
+ UChar c = s.characters()[offset];
+ if (c <= 0xFF)
+ return globalData->smallStrings.singleCharacterString(globalData, c);
+ return fixupVPtr(globalData, new (globalData) JSString(globalData, UString(StringImpl::create(s.impl(), offset, 1))));
+ }
+
+ inline JSString* jsNontrivialString(JSGlobalData* globalData, const char* s)
+ {
+ ASSERT(s);
+ ASSERT(s[0]);
+ ASSERT(s[1]);
+ return fixupVPtr(globalData, new (globalData) JSString(globalData, s));
+ }
+
+ inline JSString* jsNontrivialString(JSGlobalData* globalData, const UString& s)
+ {
+ ASSERT(s.length() > 1);
+ return fixupVPtr(globalData, new (globalData) JSString(globalData, s));
+ }
+
+ inline JSString* JSString::getIndex(ExecState* exec, unsigned i)
+ {
+ ASSERT(canGetIndex(i));
+ if (isRope())
+ return getIndexSlowCase(exec, i);
+ ASSERT(i < m_value.length());
+ return jsSingleCharacterSubstring(exec, m_value, i);
+ }
+
+ inline JSString* jsString(JSGlobalData* globalData, const UString& s)
+ {
+ int size = s.length();
+ if (!size)
+ return globalData->smallStrings.emptyString(globalData);
+ if (size == 1) {
+ UChar c = s.characters()[0];
+ if (c <= 0xFF)
+ return globalData->smallStrings.singleCharacterString(globalData, c);
+ }
+ return fixupVPtr(globalData, new (globalData) JSString(globalData, s));
+ }
+
+ inline JSString* jsStringWithFinalizer(ExecState* exec, const UString& s, JSStringFinalizerCallback callback, void* context)
+ {
+ ASSERT(s.length() && (s.length() > 1 || s.characters()[0] > 0xFF));
+ JSGlobalData* globalData = &exec->globalData();
+ return fixupVPtr(globalData, new (globalData) JSString(globalData, s, callback, context));
+ }
+
+ inline JSString* jsSubstring(ExecState* exec, JSString* s, unsigned offset, unsigned length)
+ {
+ ASSERT(offset <= static_cast<unsigned>(s->length()));
+ ASSERT(length <= static_cast<unsigned>(s->length()));
+ ASSERT(offset + length <= static_cast<unsigned>(s->length()));
+ JSGlobalData* globalData = &exec->globalData();
+ if (!length)
+ return globalData->smallStrings.emptyString(globalData);
+ if (s->isRope())
+ return s->substringFromRope(exec, offset, length);
+ return jsSubstring(globalData, s->m_value, offset, length);
+ }
+
+ inline JSString* jsSubstring(JSGlobalData* globalData, const UString& s, unsigned offset, unsigned length)
+ {
+ ASSERT(offset <= static_cast<unsigned>(s.length()));
+ ASSERT(length <= static_cast<unsigned>(s.length()));
+ ASSERT(offset + length <= static_cast<unsigned>(s.length()));
+ if (!length)
+ return globalData->smallStrings.emptyString(globalData);
+ if (length == 1) {
+ UChar c = s.characters()[offset];
+ if (c <= 0xFF)
+ return globalData->smallStrings.singleCharacterString(globalData, c);
+ }
+ return fixupVPtr(globalData, new (globalData) JSString(globalData, UString(StringImpl::create(s.impl(), offset, length)), JSString::HasOtherOwner));
+ }
+
+ inline JSString* jsOwnedString(JSGlobalData* globalData, const UString& s)
+ {
+ int size = s.length();
+ if (!size)
+ return globalData->smallStrings.emptyString(globalData);
+ if (size == 1) {
+ UChar c = s.characters()[0];
+ if (c <= 0xFF)
+ return globalData->smallStrings.singleCharacterString(globalData, c);
+ }
+ return fixupVPtr(globalData, new (globalData) JSString(globalData, s, JSString::HasOtherOwner));
+ }
+
+ inline JSString* jsEmptyString(ExecState* exec) { return jsEmptyString(&exec->globalData()); }
+ inline JSString* jsString(ExecState* exec, const UString& s) { return jsString(&exec->globalData(), s); }
+ inline JSString* jsSingleCharacterString(ExecState* exec, UChar c) { return jsSingleCharacterString(&exec->globalData(), c); }
+ inline JSString* jsSubstring(ExecState* exec, const UString& s, unsigned offset, unsigned length) { return jsSubstring(&exec->globalData(), s, offset, length); }
+ inline JSString* jsNontrivialString(ExecState* exec, const UString& s) { return jsNontrivialString(&exec->globalData(), s); }
+ inline JSString* jsNontrivialString(ExecState* exec, const char* s) { return jsNontrivialString(&exec->globalData(), s); }
+ inline JSString* jsOwnedString(ExecState* exec, const UString& s) { return jsOwnedString(&exec->globalData(), s); }
+
+ ALWAYS_INLINE bool JSString::getStringPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
+ {
+ if (propertyName == exec->propertyNames().length) {
+ slot.setValue(jsNumber(m_length));
+ return true;
+ }
+
+ bool isStrictUInt32;
+ unsigned i = propertyName.toUInt32(isStrictUInt32);
+ if (isStrictUInt32 && i < m_length) {
+ slot.setValue(getIndex(exec, i));
+ return true;
+ }
+
+ return false;
+ }
+
+ ALWAYS_INLINE bool JSString::getStringPropertySlot(ExecState* exec, unsigned propertyName, PropertySlot& slot)
+ {
+ if (propertyName < m_length) {
+ slot.setValue(getIndex(exec, propertyName));
+ return true;
+ }
+
+ return false;
+ }
+
+ inline bool isJSString(JSGlobalData* globalData, JSValue v) { return v.isCell() && v.asCell()->vptr() == globalData->jsStringVPtr; }
+
+ // --- JSValue inlines ----------------------------
+
+ inline UString JSValue::toString(ExecState* exec) const
+ {
+ if (isString())
+ return static_cast<JSString*>(asCell())->value(exec);
+ if (isInt32())
+ return exec->globalData().numericStrings.add(asInt32());
+ if (isDouble())
+ return exec->globalData().numericStrings.add(asDouble());
+ if (isTrue())
+ return "true";
+ if (isFalse())
+ return "false";
+ if (isNull())
+ return "null";
+ if (isUndefined())
+ return "undefined";
+ ASSERT(isCell());
+ return asCell()->toString(exec);
+ }
+
+ inline UString JSValue::toPrimitiveString(ExecState* exec) const
+ {
+ if (isString())
+ return static_cast<JSString*>(asCell())->value(exec);
+ if (isInt32())
+ return exec->globalData().numericStrings.add(asInt32());
+ if (isDouble())
+ return exec->globalData().numericStrings.add(asDouble());
+ if (isTrue())
+ return "true";
+ if (isFalse())
+ return "false";
+ if (isNull())
+ return "null";
+ if (isUndefined())
+ return "undefined";
+ ASSERT(isCell());
+ return asCell()->toPrimitive(exec, NoPreference).toString(exec);
+ }
+
+} // namespace JSC
+
+#endif // JSString_h
diff --git a/Source/JavaScriptCore/runtime/JSStringBuilder.h b/Source/JavaScriptCore/runtime/JSStringBuilder.h
new file mode 100644
index 0000000..49d4a63
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/JSStringBuilder.h
@@ -0,0 +1,134 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef JSStringBuilder_h
+#define JSStringBuilder_h
+
+#include "ExceptionHelpers.h"
+#include "JSString.h"
+#include "UStringConcatenate.h"
+#include "Vector.h"
+
+namespace JSC {
+
+class JSStringBuilder {
+public:
+ JSStringBuilder()
+ : m_okay(true)
+ {
+ }
+
+ void append(const UChar u)
+ {
+ m_okay &= buffer.tryAppend(&u, 1);
+ }
+
+ void append(const char* str)
+ {
+ append(str, strlen(str));
+ }
+
+ void append(const char* str, size_t len)
+ {
+ m_okay &= buffer.tryReserveCapacity(buffer.size() + len);
+ for (size_t i = 0; i < len; i++) {
+ UChar u = static_cast<unsigned char>(str[i]);
+ m_okay &= buffer.tryAppend(&u, 1);
+ }
+ }
+
+ void append(const UChar* str, size_t len)
+ {
+ m_okay &= buffer.tryAppend(str, len);
+ }
+
+ void append(const UString& str)
+ {
+ m_okay &= buffer.tryAppend(str.characters(), str.length());
+ }
+
+ JSValue build(ExecState* exec)
+ {
+ if (!m_okay)
+ return throwOutOfMemoryError(exec);
+ buffer.shrinkToFit();
+ if (!buffer.data())
+ return throwOutOfMemoryError(exec);
+ return jsString(exec, UString::adopt(buffer));
+ }
+
+protected:
+ Vector<UChar, 64> buffer;
+ bool m_okay;
+};
+
+template<typename StringType1, typename StringType2>
+inline JSValue jsMakeNontrivialString(ExecState* exec, StringType1 string1, StringType2 string2)
+{
+ PassRefPtr<StringImpl> result = WTF::tryMakeString(string1, string2);
+ if (!result)
+ return throwOutOfMemoryError(exec);
+ return jsNontrivialString(exec, result);
+}
+
+template<typename StringType1, typename StringType2, typename StringType3>
+inline JSValue jsMakeNontrivialString(ExecState* exec, StringType1 string1, StringType2 string2, StringType3 string3)
+{
+ PassRefPtr<StringImpl> result = WTF::tryMakeString(string1, string2, string3);
+ if (!result)
+ return throwOutOfMemoryError(exec);
+ return jsNontrivialString(exec, result);
+}
+
+template<typename StringType1, typename StringType2, typename StringType3, typename StringType4>
+inline JSValue jsMakeNontrivialString(ExecState* exec, StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4)
+{
+ PassRefPtr<StringImpl> result = WTF::tryMakeString(string1, string2, string3, string4);
+ if (!result)
+ return throwOutOfMemoryError(exec);
+ return jsNontrivialString(exec, result);
+}
+
+template<typename StringType1, typename StringType2, typename StringType3, typename StringType4, typename StringType5>
+inline JSValue jsMakeNontrivialString(ExecState* exec, StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4, StringType5 string5)
+{
+ PassRefPtr<StringImpl> result = WTF::tryMakeString(string1, string2, string3, string4, string5);
+ if (!result)
+ return throwOutOfMemoryError(exec);
+ return jsNontrivialString(exec, result);
+}
+
+template<typename StringType1, typename StringType2, typename StringType3, typename StringType4, typename StringType5, typename StringType6>
+inline JSValue jsMakeNontrivialString(ExecState* exec, StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4, StringType5 string5, StringType6 string6)
+{
+ PassRefPtr<StringImpl> result = WTF::tryMakeString(string1, string2, string3, string4, string5, string6);
+ if (!result)
+ return throwOutOfMemoryError(exec);
+ return jsNontrivialString(exec, result);
+}
+
+}
+
+#endif
diff --git a/Source/JavaScriptCore/runtime/JSType.h b/Source/JavaScriptCore/runtime/JSType.h
new file mode 100644
index 0000000..882b218
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/JSType.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef JSType_h
+#define JSType_h
+
+namespace JSC {
+
+ /**
+ * Primitive types
+ */
+ enum JSType {
+ UnspecifiedType = 0,
+ UndefinedType = 1,
+ BooleanType = 2,
+ NumberType = 3,
+ NullType = 4,
+ StringType = 5,
+ // The CompoundType value must come before any JSType that may have children
+ CompoundType = 6,
+ ObjectType = 7,
+ GetterSetterType = 8
+ };
+
+} // namespace JSC
+
+#endif
diff --git a/Source/JavaScriptCore/runtime/JSTypeInfo.h b/Source/JavaScriptCore/runtime/JSTypeInfo.h
new file mode 100644
index 0000000..e225bc7
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/JSTypeInfo.h
@@ -0,0 +1,80 @@
+// -*- mode: c++; c-basic-offset: 4 -*-
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef JSTypeInfo_h
+#define JSTypeInfo_h
+
+// This file would be called TypeInfo.h, but that conflicts with <typeinfo.h>
+// in the STL on systems without case-sensitive file systems.
+
+#include "JSType.h"
+
+namespace JSC {
+
+ // WebCore uses MasqueradesAsUndefined to make document.all and style.filter undetectable.
+ static const unsigned MasqueradesAsUndefined = 1;
+ static const unsigned ImplementsHasInstance = 1 << 1;
+ static const unsigned OverridesHasInstance = 1 << 2;
+ static const unsigned ImplementsDefaultHasInstance = 1 << 3;
+ static const unsigned NeedsThisConversion = 1 << 4;
+ static const unsigned OverridesGetOwnPropertySlot = 1 << 5;
+ static const unsigned OverridesMarkChildren = 1 << 6;
+ static const unsigned OverridesGetPropertyNames = 1 << 7;
+
+ class TypeInfo {
+ friend class JIT;
+ public:
+ TypeInfo(JSType type, unsigned flags = 0)
+ : m_type(type)
+ {
+ ASSERT(flags <= 0xFF);
+ ASSERT(type <= 0xFF);
+ // ImplementsDefaultHasInstance means (ImplementsHasInstance & !OverridesHasInstance)
+ if ((flags & (ImplementsHasInstance | OverridesHasInstance)) == ImplementsHasInstance)
+ m_flags = flags | ImplementsDefaultHasInstance;
+ else
+ m_flags = flags;
+ }
+
+ JSType type() const { return (JSType)m_type; }
+
+ bool masqueradesAsUndefined() const { return m_flags & MasqueradesAsUndefined; }
+ bool implementsHasInstance() const { return m_flags & ImplementsHasInstance; }
+ bool overridesHasInstance() const { return m_flags & OverridesHasInstance; }
+ bool needsThisConversion() const { return m_flags & NeedsThisConversion; }
+ bool overridesGetOwnPropertySlot() const { return m_flags & OverridesGetOwnPropertySlot; }
+ bool overridesMarkChildren() const { return m_flags & OverridesMarkChildren; }
+ bool overridesGetPropertyNames() const { return m_flags & OverridesGetPropertyNames; }
+ unsigned flags() const { return m_flags; }
+
+ private:
+ unsigned char m_type;
+ unsigned char m_flags;
+ };
+
+}
+
+#endif // JSTypeInfo_h
diff --git a/Source/JavaScriptCore/runtime/JSValue.cpp b/Source/JavaScriptCore/runtime/JSValue.cpp
new file mode 100644
index 0000000..f4662db
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/JSValue.cpp
@@ -0,0 +1,197 @@
+/*
+ * Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
+ * Copyright (C) 2001 Peter Kelly (pmk@post.com)
+ * Copyright (C) 2003, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+#include "JSValue.h"
+
+#include "BooleanConstructor.h"
+#include "BooleanPrototype.h"
+#include "Error.h"
+#include "ExceptionHelpers.h"
+#include "JSGlobalObject.h"
+#include "JSFunction.h"
+#include "JSNotAnObject.h"
+#include "NumberObject.h"
+#include <wtf/MathExtras.h>
+#include <wtf/StringExtras.h>
+
+namespace JSC {
+
+static const double D32 = 4294967296.0;
+
+// ECMA 9.4
+double JSValue::toInteger(ExecState* exec) const
+{
+ if (isInt32())
+ return asInt32();
+ double d = toNumber(exec);
+ return isnan(d) ? 0.0 : trunc(d);
+}
+
+double JSValue::toIntegerPreserveNaN(ExecState* exec) const
+{
+ if (isInt32())
+ return asInt32();
+ return trunc(toNumber(exec));
+}
+
+JSObject* JSValue::toObjectSlowCase(ExecState* exec) const
+{
+ ASSERT(!isCell());
+
+ if (isInt32() || isDouble())
+ return constructNumber(exec, asValue());
+ if (isTrue() || isFalse())
+ return constructBooleanFromImmediateBoolean(exec, asValue());
+
+ ASSERT(isUndefinedOrNull());
+ throwError(exec, createNotAnObjectError(exec, *this));
+ return new (exec) JSNotAnObject(exec);
+}
+
+JSObject* JSValue::toThisObjectSlowCase(ExecState* exec) const
+{
+ ASSERT(!isCell());
+
+ if (isInt32() || isDouble())
+ return constructNumber(exec, asValue());
+ if (isTrue() || isFalse())
+ return constructBooleanFromImmediateBoolean(exec, asValue());
+ ASSERT(isUndefinedOrNull());
+ return exec->globalThisValue();
+}
+
+JSObject* JSValue::synthesizeObject(ExecState* exec) const
+{
+ ASSERT(!isCell());
+ if (isNumber())
+ return constructNumber(exec, asValue());
+ if (isBoolean())
+ return constructBooleanFromImmediateBoolean(exec, asValue());
+
+ ASSERT(isUndefinedOrNull());
+ throwError(exec, createNotAnObjectError(exec, *this));
+ return new (exec) JSNotAnObject(exec);
+}
+
+JSObject* JSValue::synthesizePrototype(ExecState* exec) const
+{
+ ASSERT(!isCell());
+ if (isNumber())
+ return exec->lexicalGlobalObject()->numberPrototype();
+ if (isBoolean())
+ return exec->lexicalGlobalObject()->booleanPrototype();
+
+ ASSERT(isUndefinedOrNull());
+ throwError(exec, createNotAnObjectError(exec, *this));
+ return new (exec) JSNotAnObject(exec);
+}
+
+#ifndef NDEBUG
+char* JSValue::description()
+{
+ static const size_t size = 32;
+ static char description[size];
+
+ if (!*this)
+ snprintf(description, size, "<JSValue()>");
+ else if (isInt32())
+ snprintf(description, size, "Int32: %d", asInt32());
+ else if (isDouble())
+ snprintf(description, size, "Double: %lf", asDouble());
+ else if (isCell())
+ snprintf(description, size, "Cell: %p", asCell());
+ else if (isTrue())
+ snprintf(description, size, "True");
+ else if (isFalse())
+ snprintf(description, size, "False");
+ else if (isNull())
+ snprintf(description, size, "Null");
+ else if (isUndefined())
+ snprintf(description, size, "Undefined");
+ else
+ snprintf(description, size, "INVALID");
+
+ return description;
+}
+#endif
+
+// This in the ToInt32 operation is defined in section 9.5 of the ECMA-262 spec.
+// Note that this operation is identical to ToUInt32 other than to interpretation
+// of the resulting bit-pattern (as such this metod is also called to implement
+// ToUInt32).
+//
+// The operation can be descibed as round towards zero, then select the 32 least
+// bits of the resulting value in 2s-complement representation.
+int32_t toInt32(double number)
+{
+ int64_t bits = WTF::bitwise_cast<int64_t>(number);
+ int32_t exp = (static_cast<int32_t>(bits >> 52) & 0x7ff) - 0x3ff;
+
+ // If exponent < 0 there will be no bits to the left of the decimal point
+ // after rounding; if the exponent is > 83 then no bits of precision can be
+ // left in the low 32-bit range of the result (IEEE-754 doubles have 52 bits
+ // of fractional precision).
+ // Note this case handles 0, -0, and all infinte, NaN, & denormal value.
+ if (exp < 0 || exp > 83)
+ return 0;
+
+ // Select the appropriate 32-bits from the floating point mantissa. If the
+ // exponent is 52 then the bits we need to select are already aligned to the
+ // lowest bits of the 64-bit integer representation of tghe number, no need
+ // to shift. If the exponent is greater than 52 we need to shift the value
+ // left by (exp - 52), if the value is less than 52 we need to shift right
+ // accordingly.
+ int32_t result = (exp > 52)
+ ? static_cast<int32_t>(bits << (exp - 52))
+ : static_cast<int32_t>(bits >> (52 - exp));
+
+ // IEEE-754 double precision values are stored omitting an implicit 1 before
+ // the decimal point; we need to reinsert this now. We may also the shifted
+ // invalid bits into the result that are not a part of the mantissa (the sign
+ // and exponent bits from the floatingpoint representation); mask these out.
+ if (exp < 32) {
+ int32_t missingOne = 1 << exp;
+ result &= missingOne - 1;
+ result += missingOne;
+ }
+
+ // If the input value was negative (we could test either 'number' or 'bits',
+ // but testing 'bits' is likely faster) invert the result appropriately.
+ return bits < 0 ? -result : result;
+}
+
+NEVER_INLINE double nonInlineNaN()
+{
+#if OS(SYMBIAN)
+ return nanval();
+#else
+ return std::numeric_limits<double>::quiet_NaN();
+#endif
+}
+
+bool JSValue::isValidCallee()
+{
+ return asObject(asObject(asCell())->getAnonymousValue(0))->isGlobalObject();
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/JSValue.h b/Source/JavaScriptCore/runtime/JSValue.h
new file mode 100644
index 0000000..dc54f40
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/JSValue.h
@@ -0,0 +1,770 @@
+/*
+ * Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
+ * Copyright (C) 2001 Peter Kelly (pmk@post.com)
+ * Copyright (C) 2003, 2004, 2005, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef JSValue_h
+#define JSValue_h
+
+#include <math.h>
+#include <stddef.h> // for size_t
+#include <stdint.h>
+#include <wtf/AlwaysInline.h>
+#include <wtf/Assertions.h>
+#include <wtf/HashTraits.h>
+#include <wtf/MathExtras.h>
+
+namespace JSC {
+
+ class ExecState;
+ class Identifier;
+ class JSCell;
+ class JSGlobalData;
+ class JSImmediate;
+ class JSObject;
+ class JSString;
+ class PropertySlot;
+ class PutPropertySlot;
+ class UString;
+
+ struct ClassInfo;
+ struct Instruction;
+
+ enum PreferredPrimitiveType { NoPreference, PreferNumber, PreferString };
+
+#if USE(JSVALUE32_64)
+ typedef int64_t EncodedJSValue;
+#else
+ typedef void* EncodedJSValue;
+#endif
+
+ double nonInlineNaN();
+
+ // This implements ToInt32, defined in ECMA-262 9.5.
+ int32_t toInt32(double);
+
+ // This implements ToUInt32, defined in ECMA-262 9.6.
+ inline uint32_t toUInt32(double number)
+ {
+ // As commented in the spec, the operation of ToInt32 and ToUint32 only differ
+ // in how the result is interpreted; see NOTEs in sections 9.5 and 9.6.
+ return toInt32(number);
+ }
+
+ class JSValue {
+ friend class JSImmediate;
+ friend struct EncodedJSValueHashTraits;
+ friend class JIT;
+ friend class JITStubs;
+ friend class JITStubCall;
+ friend class JSInterfaceJIT;
+ friend class SpecializedThunkJIT;
+
+ public:
+ static EncodedJSValue encode(JSValue value);
+ static JSValue decode(EncodedJSValue ptr);
+#if USE(JSVALUE64)
+ private:
+ static JSValue makeImmediate(intptr_t value);
+ intptr_t immediateValue();
+ public:
+#endif
+ enum JSNullTag { JSNull };
+ enum JSUndefinedTag { JSUndefined };
+ enum JSTrueTag { JSTrue };
+ enum JSFalseTag { JSFalse };
+ enum EncodeAsDoubleTag { EncodeAsDouble };
+
+ JSValue();
+ JSValue(JSNullTag);
+ JSValue(JSUndefinedTag);
+ JSValue(JSTrueTag);
+ JSValue(JSFalseTag);
+ JSValue(JSCell* ptr);
+ JSValue(const JSCell* ptr);
+
+ // Numbers
+ JSValue(EncodeAsDoubleTag, double);
+ explicit JSValue(double);
+ explicit JSValue(char);
+ explicit JSValue(unsigned char);
+ explicit JSValue(short);
+ explicit JSValue(unsigned short);
+ explicit JSValue(int);
+ explicit JSValue(unsigned);
+ explicit JSValue(long);
+ explicit JSValue(unsigned long);
+ explicit JSValue(long long);
+ explicit JSValue(unsigned long long);
+
+ operator bool() const;
+ bool operator==(const JSValue& other) const;
+ bool operator!=(const JSValue& other) const;
+
+ bool isInt32() const;
+ bool isUInt32() const;
+ bool isDouble() const;
+ bool isTrue() const;
+ bool isFalse() const;
+
+ int32_t asInt32() const;
+ uint32_t asUInt32() const;
+ double asDouble() const;
+
+ // Querying the type.
+ bool isUndefined() const;
+ bool isNull() const;
+ bool isUndefinedOrNull() const;
+ bool isBoolean() const;
+ bool isNumber() const;
+ bool isString() const;
+ bool isGetterSetter() const;
+ bool isObject() const;
+ bool inherits(const ClassInfo*) const;
+
+ // Extracting the value.
+ bool getBoolean(bool&) const;
+ bool getBoolean() const; // false if not a boolean
+ bool getNumber(double&) const;
+ double uncheckedGetNumber() const;
+ bool getString(ExecState* exec, UString&) const;
+ UString getString(ExecState* exec) const; // null string if not a string
+ JSObject* getObject() const; // 0 if not an object
+
+ // Extracting integer values.
+ bool getUInt32(uint32_t&) const;
+
+ // Basic conversions.
+ JSValue toPrimitive(ExecState*, PreferredPrimitiveType = NoPreference) const;
+ bool getPrimitiveNumber(ExecState*, double& number, JSValue&);
+
+ bool toBoolean(ExecState*) const;
+
+ // toNumber conversion is expected to be side effect free if an exception has
+ // been set in the ExecState already.
+ double toNumber(ExecState*) const;
+ JSValue toJSNumber(ExecState*) const; // Fast path for when you expect that the value is an immediate number.
+ UString toString(ExecState*) const;
+ UString toPrimitiveString(ExecState*) const;
+ JSObject* toObject(ExecState*) const;
+
+ // Integer conversions.
+ double toInteger(ExecState*) const;
+ double toIntegerPreserveNaN(ExecState*) const;
+ int32_t toInt32(ExecState*) const;
+ uint32_t toUInt32(ExecState*) const;
+
+#if ENABLE(JSC_ZOMBIES)
+ bool isZombie() const;
+#endif
+
+ // Floating point conversions (this is a convenience method for webcore;
+ // signle precision float is not a representation used in JS or JSC).
+ float toFloat(ExecState* exec) const { return static_cast<float>(toNumber(exec)); }
+
+ // Object operations, with the toObject operation included.
+ JSValue get(ExecState*, const Identifier& propertyName) const;
+ JSValue get(ExecState*, const Identifier& propertyName, PropertySlot&) const;
+ JSValue get(ExecState*, unsigned propertyName) const;
+ JSValue get(ExecState*, unsigned propertyName, PropertySlot&) const;
+ void put(ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&);
+ void putDirect(ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&);
+ void put(ExecState*, unsigned propertyName, JSValue);
+
+ bool needsThisConversion() const;
+ JSObject* toThisObject(ExecState*) const;
+ JSValue toStrictThisObject(ExecState*) const;
+ UString toThisString(ExecState*) const;
+ JSString* toThisJSString(ExecState*) const;
+
+ static bool equal(ExecState* exec, JSValue v1, JSValue v2);
+ static bool equalSlowCase(ExecState* exec, JSValue v1, JSValue v2);
+ static bool equalSlowCaseInline(ExecState* exec, JSValue v1, JSValue v2);
+ static bool strictEqual(ExecState* exec, JSValue v1, JSValue v2);
+ static bool strictEqualSlowCase(ExecState* exec, JSValue v1, JSValue v2);
+ static bool strictEqualSlowCaseInline(ExecState* exec, JSValue v1, JSValue v2);
+
+ JSValue getJSNumber(); // JSValue() if this is not a JSNumber or number object
+
+ bool isCell() const;
+ JSCell* asCell() const;
+ bool isValidCallee();
+
+#ifndef NDEBUG
+ char* description();
+#endif
+
+ private:
+ enum HashTableDeletedValueTag { HashTableDeletedValue };
+ JSValue(HashTableDeletedValueTag);
+
+ inline const JSValue asValue() const { return *this; }
+ JSObject* toObjectSlowCase(ExecState*) const;
+ JSObject* toThisObjectSlowCase(ExecState*) const;
+
+ JSObject* synthesizePrototype(ExecState*) const;
+ JSObject* synthesizeObject(ExecState*) const;
+
+#if USE(JSVALUE32_64)
+ enum { NullTag = 0xffffffff };
+ enum { UndefinedTag = 0xfffffffe };
+ enum { Int32Tag = 0xfffffffd };
+ enum { CellTag = 0xfffffffc };
+ enum { TrueTag = 0xfffffffb };
+ enum { FalseTag = 0xfffffffa };
+ enum { EmptyValueTag = 0xfffffff9 };
+ enum { DeletedValueTag = 0xfffffff8 };
+
+ enum { LowestTag = DeletedValueTag };
+
+ uint32_t tag() const;
+ int32_t payload() const;
+
+ union {
+ EncodedJSValue asEncodedJSValue;
+ double asDouble;
+#if CPU(BIG_ENDIAN)
+ struct {
+ int32_t tag;
+ int32_t payload;
+ } asBits;
+#else
+ struct {
+ int32_t payload;
+ int32_t tag;
+ } asBits;
+#endif
+ } u;
+#else // USE(JSVALUE32_64)
+ JSCell* m_ptr;
+#endif // USE(JSVALUE32_64)
+ };
+
+#if USE(JSVALUE32_64)
+ typedef IntHash<EncodedJSValue> EncodedJSValueHash;
+
+ struct EncodedJSValueHashTraits : HashTraits<EncodedJSValue> {
+ static const bool emptyValueIsZero = false;
+ static EncodedJSValue emptyValue() { return JSValue::encode(JSValue()); }
+ static void constructDeletedValue(EncodedJSValue& slot) { slot = JSValue::encode(JSValue(JSValue::HashTableDeletedValue)); }
+ static bool isDeletedValue(EncodedJSValue value) { return value == JSValue::encode(JSValue(JSValue::HashTableDeletedValue)); }
+ };
+#else
+ typedef PtrHash<EncodedJSValue> EncodedJSValueHash;
+
+ struct EncodedJSValueHashTraits : HashTraits<EncodedJSValue> {
+ static void constructDeletedValue(EncodedJSValue& slot) { slot = JSValue::encode(JSValue(JSValue::HashTableDeletedValue)); }
+ static bool isDeletedValue(EncodedJSValue value) { return value == JSValue::encode(JSValue(JSValue::HashTableDeletedValue)); }
+ };
+#endif
+
+ // Stand-alone helper functions.
+ inline JSValue jsNull()
+ {
+ return JSValue(JSValue::JSNull);
+ }
+
+ inline JSValue jsUndefined()
+ {
+ return JSValue(JSValue::JSUndefined);
+ }
+
+ inline JSValue jsBoolean(bool b)
+ {
+ return b ? JSValue(JSValue::JSTrue) : JSValue(JSValue::JSFalse);
+ }
+
+ ALWAYS_INLINE JSValue jsDoubleNumber(double d)
+ {
+ return JSValue(JSValue::EncodeAsDouble, d);
+ }
+
+ ALWAYS_INLINE JSValue jsNumber(double d)
+ {
+ return JSValue(d);
+ }
+
+ ALWAYS_INLINE JSValue jsNumber(char i)
+ {
+ return JSValue(i);
+ }
+
+ ALWAYS_INLINE JSValue jsNumber(unsigned char i)
+ {
+ return JSValue(i);
+ }
+
+ ALWAYS_INLINE JSValue jsNumber(short i)
+ {
+ return JSValue(i);
+ }
+
+ ALWAYS_INLINE JSValue jsNumber(unsigned short i)
+ {
+ return JSValue(i);
+ }
+
+ ALWAYS_INLINE JSValue jsNumber(int i)
+ {
+ return JSValue(i);
+ }
+
+ ALWAYS_INLINE JSValue jsNumber(unsigned i)
+ {
+ return JSValue(i);
+ }
+
+ ALWAYS_INLINE JSValue jsNumber(long i)
+ {
+ return JSValue(i);
+ }
+
+ ALWAYS_INLINE JSValue jsNumber(unsigned long i)
+ {
+ return JSValue(i);
+ }
+
+ ALWAYS_INLINE JSValue jsNumber(long long i)
+ {
+ return JSValue(i);
+ }
+
+ ALWAYS_INLINE JSValue jsNumber(unsigned long long i)
+ {
+ return JSValue(i);
+ }
+
+ inline bool operator==(const JSValue a, const JSCell* b) { return a == JSValue(b); }
+ inline bool operator==(const JSCell* a, const JSValue b) { return JSValue(a) == b; }
+
+ inline bool operator!=(const JSValue a, const JSCell* b) { return a != JSValue(b); }
+ inline bool operator!=(const JSCell* a, const JSValue b) { return JSValue(a) != b; }
+
+ ALWAYS_INLINE int32_t JSValue::toInt32(ExecState* exec) const
+ {
+ if (isInt32())
+ return asInt32();
+ return JSC::toInt32(toNumber(exec));
+ }
+
+ inline uint32_t JSValue::toUInt32(ExecState* exec) const
+ {
+ // See comment on JSC::toUInt32, above.
+ return toInt32(exec);
+ }
+
+#if USE(JSVALUE32_64)
+ inline JSValue jsNaN()
+ {
+ return JSValue(nonInlineNaN());
+ }
+
+ // JSValue member functions.
+ inline EncodedJSValue JSValue::encode(JSValue value)
+ {
+ return value.u.asEncodedJSValue;
+ }
+
+ inline JSValue JSValue::decode(EncodedJSValue encodedJSValue)
+ {
+ JSValue v;
+ v.u.asEncodedJSValue = encodedJSValue;
+#if ENABLE(JSC_ZOMBIES)
+ ASSERT(!v.isZombie());
+#endif
+ return v;
+ }
+
+ inline JSValue::JSValue()
+ {
+ u.asBits.tag = EmptyValueTag;
+ u.asBits.payload = 0;
+ }
+
+ inline JSValue::JSValue(JSNullTag)
+ {
+ u.asBits.tag = NullTag;
+ u.asBits.payload = 0;
+ }
+
+ inline JSValue::JSValue(JSUndefinedTag)
+ {
+ u.asBits.tag = UndefinedTag;
+ u.asBits.payload = 0;
+ }
+
+ inline JSValue::JSValue(JSTrueTag)
+ {
+ u.asBits.tag = TrueTag;
+ u.asBits.payload = 0;
+ }
+
+ inline JSValue::JSValue(JSFalseTag)
+ {
+ u.asBits.tag = FalseTag;
+ u.asBits.payload = 0;
+ }
+
+ inline JSValue::JSValue(HashTableDeletedValueTag)
+ {
+ u.asBits.tag = DeletedValueTag;
+ u.asBits.payload = 0;
+ }
+
+ inline JSValue::JSValue(JSCell* ptr)
+ {
+ if (ptr)
+ u.asBits.tag = CellTag;
+ else
+ u.asBits.tag = EmptyValueTag;
+ u.asBits.payload = reinterpret_cast<int32_t>(ptr);
+#if ENABLE(JSC_ZOMBIES)
+ ASSERT(!isZombie());
+#endif
+ }
+
+ inline JSValue::JSValue(const JSCell* ptr)
+ {
+ if (ptr)
+ u.asBits.tag = CellTag;
+ else
+ u.asBits.tag = EmptyValueTag;
+ u.asBits.payload = reinterpret_cast<int32_t>(const_cast<JSCell*>(ptr));
+#if ENABLE(JSC_ZOMBIES)
+ ASSERT(!isZombie());
+#endif
+ }
+
+ inline JSValue::operator bool() const
+ {
+ ASSERT(tag() != DeletedValueTag);
+ return tag() != EmptyValueTag;
+ }
+
+ inline bool JSValue::operator==(const JSValue& other) const
+ {
+ return u.asEncodedJSValue == other.u.asEncodedJSValue;
+ }
+
+ inline bool JSValue::operator!=(const JSValue& other) const
+ {
+ return u.asEncodedJSValue != other.u.asEncodedJSValue;
+ }
+
+ inline bool JSValue::isUndefined() const
+ {
+ return tag() == UndefinedTag;
+ }
+
+ inline bool JSValue::isNull() const
+ {
+ return tag() == NullTag;
+ }
+
+ inline bool JSValue::isUndefinedOrNull() const
+ {
+ return isUndefined() || isNull();
+ }
+
+ inline bool JSValue::isCell() const
+ {
+ return tag() == CellTag;
+ }
+
+ inline bool JSValue::isInt32() const
+ {
+ return tag() == Int32Tag;
+ }
+
+ inline bool JSValue::isUInt32() const
+ {
+ return tag() == Int32Tag && asInt32() > -1;
+ }
+
+ inline bool JSValue::isDouble() const
+ {
+ return tag() < LowestTag;
+ }
+
+ inline bool JSValue::isTrue() const
+ {
+ return tag() == TrueTag;
+ }
+
+ inline bool JSValue::isFalse() const
+ {
+ return tag() == FalseTag;
+ }
+
+ inline uint32_t JSValue::tag() const
+ {
+ return u.asBits.tag;
+ }
+
+ inline int32_t JSValue::payload() const
+ {
+ return u.asBits.payload;
+ }
+
+ inline int32_t JSValue::asInt32() const
+ {
+ ASSERT(isInt32());
+ return u.asBits.payload;
+ }
+
+ inline uint32_t JSValue::asUInt32() const
+ {
+ ASSERT(isUInt32());
+ return u.asBits.payload;
+ }
+
+ inline double JSValue::asDouble() const
+ {
+ ASSERT(isDouble());
+ return u.asDouble;
+ }
+
+ ALWAYS_INLINE JSCell* JSValue::asCell() const
+ {
+ ASSERT(isCell());
+ return reinterpret_cast<JSCell*>(u.asBits.payload);
+ }
+
+ ALWAYS_INLINE JSValue::JSValue(EncodeAsDoubleTag, double d)
+ {
+ u.asDouble = d;
+ }
+
+ inline JSValue::JSValue(double d)
+ {
+ const int32_t asInt32 = static_cast<int32_t>(d);
+ if (asInt32 != d || (!asInt32 && signbit(d))) { // true for -0.0
+ u.asDouble = d;
+ return;
+ }
+ *this = JSValue(static_cast<int32_t>(d));
+ }
+
+ inline JSValue::JSValue(char i)
+ {
+ *this = JSValue(static_cast<int32_t>(i));
+ }
+
+ inline JSValue::JSValue(unsigned char i)
+ {
+ *this = JSValue(static_cast<int32_t>(i));
+ }
+
+ inline JSValue::JSValue(short i)
+ {
+ *this = JSValue(static_cast<int32_t>(i));
+ }
+
+ inline JSValue::JSValue(unsigned short i)
+ {
+ *this = JSValue(static_cast<int32_t>(i));
+ }
+
+ inline JSValue::JSValue(int i)
+ {
+ u.asBits.tag = Int32Tag;
+ u.asBits.payload = i;
+ }
+
+ inline JSValue::JSValue(unsigned i)
+ {
+ if (static_cast<int32_t>(i) < 0) {
+ *this = JSValue(static_cast<double>(i));
+ return;
+ }
+ *this = JSValue(static_cast<int32_t>(i));
+ }
+
+ inline JSValue::JSValue(long i)
+ {
+ if (static_cast<int32_t>(i) != i) {
+ *this = JSValue(static_cast<double>(i));
+ return;
+ }
+ *this = JSValue(static_cast<int32_t>(i));
+ }
+
+ inline JSValue::JSValue(unsigned long i)
+ {
+ if (static_cast<uint32_t>(i) != i) {
+ *this = JSValue(static_cast<double>(i));
+ return;
+ }
+ *this = JSValue(static_cast<uint32_t>(i));
+ }
+
+ inline JSValue::JSValue(long long i)
+ {
+ if (static_cast<int32_t>(i) != i) {
+ *this = JSValue(static_cast<double>(i));
+ return;
+ }
+ *this = JSValue(static_cast<int32_t>(i));
+ }
+
+ inline JSValue::JSValue(unsigned long long i)
+ {
+ if (static_cast<uint32_t>(i) != i) {
+ *this = JSValue(static_cast<double>(i));
+ return;
+ }
+ *this = JSValue(static_cast<uint32_t>(i));
+ }
+
+ inline bool JSValue::isNumber() const
+ {
+ return isInt32() || isDouble();
+ }
+
+ inline bool JSValue::isBoolean() const
+ {
+ return isTrue() || isFalse();
+ }
+
+ inline bool JSValue::getBoolean(bool& v) const
+ {
+ if (isTrue()) {
+ v = true;
+ return true;
+ }
+ if (isFalse()) {
+ v = false;
+ return true;
+ }
+
+ return false;
+ }
+
+ inline bool JSValue::getBoolean() const
+ {
+ ASSERT(isBoolean());
+ return tag() == TrueTag;
+ }
+
+ inline double JSValue::uncheckedGetNumber() const
+ {
+ ASSERT(isNumber());
+ return isInt32() ? asInt32() : asDouble();
+ }
+
+ ALWAYS_INLINE JSValue JSValue::toJSNumber(ExecState* exec) const
+ {
+ return isNumber() ? asValue() : jsNumber(this->toNumber(exec));
+ }
+
+ inline bool JSValue::getNumber(double& result) const
+ {
+ if (isInt32()) {
+ result = asInt32();
+ return true;
+ }
+ if (isDouble()) {
+ result = asDouble();
+ return true;
+ }
+ return false;
+ }
+
+#else // USE(JSVALUE32_64)
+
+ // JSValue member functions.
+ inline EncodedJSValue JSValue::encode(JSValue value)
+ {
+ return reinterpret_cast<EncodedJSValue>(value.m_ptr);
+ }
+
+ inline JSValue JSValue::decode(EncodedJSValue ptr)
+ {
+ return JSValue(reinterpret_cast<JSCell*>(ptr));
+ }
+
+ inline JSValue JSValue::makeImmediate(intptr_t value)
+ {
+ return JSValue(reinterpret_cast<JSCell*>(value));
+ }
+
+ inline intptr_t JSValue::immediateValue()
+ {
+ return reinterpret_cast<intptr_t>(m_ptr);
+ }
+
+ // 0x0 can never occur naturally because it has a tag of 00, indicating a pointer value, but a payload of 0x0, which is in the (invalid) zero page.
+ inline JSValue::JSValue()
+ : m_ptr(0)
+ {
+ }
+
+ // 0x4 can never occur naturally because it has a tag of 00, indicating a pointer value, but a payload of 0x4, which is in the (invalid) zero page.
+ inline JSValue::JSValue(HashTableDeletedValueTag)
+ : m_ptr(reinterpret_cast<JSCell*>(0x4))
+ {
+ }
+
+ inline JSValue::JSValue(JSCell* ptr)
+ : m_ptr(ptr)
+ {
+#if ENABLE(JSC_ZOMBIES)
+ ASSERT(!isZombie());
+#endif
+ }
+
+ inline JSValue::JSValue(const JSCell* ptr)
+ : m_ptr(const_cast<JSCell*>(ptr))
+ {
+#if ENABLE(JSC_ZOMBIES)
+ ASSERT(!isZombie());
+#endif
+ }
+
+ inline JSValue::operator bool() const
+ {
+ return m_ptr;
+ }
+
+ inline bool JSValue::operator==(const JSValue& other) const
+ {
+ return m_ptr == other.m_ptr;
+ }
+
+ inline bool JSValue::operator!=(const JSValue& other) const
+ {
+ return m_ptr != other.m_ptr;
+ }
+
+ inline bool JSValue::isUndefined() const
+ {
+ return asValue() == jsUndefined();
+ }
+
+ inline bool JSValue::isNull() const
+ {
+ return asValue() == jsNull();
+ }
+#endif // USE(JSVALUE32_64)
+
+ typedef std::pair<JSValue, UString> ValueStringPair;
+} // namespace JSC
+
+#endif // JSValue_h
diff --git a/Source/JavaScriptCore/runtime/JSVariableObject.cpp b/Source/JavaScriptCore/runtime/JSVariableObject.cpp
new file mode 100644
index 0000000..81d05ba
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/JSVariableObject.cpp
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JSVariableObject.h"
+
+#include "PropertyNameArray.h"
+#include "PropertyDescriptor.h"
+
+namespace JSC {
+
+bool JSVariableObject::deleteProperty(ExecState* exec, const Identifier& propertyName)
+{
+ if (symbolTable().contains(propertyName.impl()))
+ return false;
+
+ return JSObject::deleteProperty(exec, propertyName);
+}
+
+void JSVariableObject::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
+{
+ SymbolTable::const_iterator end = symbolTable().end();
+ for (SymbolTable::const_iterator it = symbolTable().begin(); it != end; ++it) {
+ if (!(it->second.getAttributes() & DontEnum) || (mode == IncludeDontEnumProperties))
+ propertyNames.add(Identifier(exec, it->first.get()));
+ }
+
+ JSObject::getOwnPropertyNames(exec, propertyNames, mode);
+}
+
+bool JSVariableObject::isVariableObject() const
+{
+ return true;
+}
+
+bool JSVariableObject::symbolTableGet(const Identifier& propertyName, PropertyDescriptor& descriptor)
+{
+ SymbolTableEntry entry = symbolTable().inlineGet(propertyName.impl());
+ if (!entry.isNull()) {
+ descriptor.setDescriptor(registerAt(entry.getIndex()).jsValue(), entry.getAttributes() | DontDelete);
+ return true;
+ }
+ return false;
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/JSVariableObject.h b/Source/JavaScriptCore/runtime/JSVariableObject.h
new file mode 100644
index 0000000..3f2e218
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/JSVariableObject.h
@@ -0,0 +1,169 @@
+/*
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef JSVariableObject_h
+#define JSVariableObject_h
+
+#include "JSObject.h"
+#include "Register.h"
+#include "SymbolTable.h"
+#include "UnusedParam.h"
+#include <wtf/OwnArrayPtr.h>
+#include <wtf/UnusedParam.h>
+
+namespace JSC {
+
+ class Register;
+
+ class JSVariableObject : public JSObject {
+ friend class JIT;
+
+ public:
+ SymbolTable& symbolTable() const { return *d->symbolTable; }
+
+ virtual void putWithAttributes(ExecState*, const Identifier&, JSValue, unsigned attributes) = 0;
+
+ virtual bool deleteProperty(ExecState*, const Identifier&);
+ virtual void getOwnPropertyNames(ExecState*, PropertyNameArray&, EnumerationMode mode = ExcludeDontEnumProperties);
+
+ virtual bool isVariableObject() const;
+ virtual bool isDynamicScope(bool& requiresDynamicChecks) const = 0;
+
+ Register& registerAt(int index) const { return d->registers[index]; }
+
+ static PassRefPtr<Structure> createStructure(JSValue prototype)
+ {
+ return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount);
+ }
+
+ protected:
+ static const unsigned StructureFlags = OverridesGetPropertyNames | JSObject::StructureFlags;
+ // Subclasses of JSVariableObject can subclass this struct to add data
+ // without increasing their own size (since there's a hard limit on the
+ // size of a JSCell).
+ struct JSVariableObjectData {
+ JSVariableObjectData(SymbolTable* symbolTable, Register* registers)
+ : symbolTable(symbolTable)
+ , registers(registers)
+ {
+ ASSERT(symbolTable);
+ }
+
+ SymbolTable* symbolTable; // Maps name -> offset from "r" in register file.
+ Register* registers; // "r" in the register file.
+ OwnArrayPtr<Register> registerArray; // Independent copy of registers, used when a variable object copies its registers out of the register file.
+
+ private:
+ JSVariableObjectData(const JSVariableObjectData&);
+ JSVariableObjectData& operator=(const JSVariableObjectData&);
+ };
+
+ JSVariableObject(NonNullPassRefPtr<Structure> structure, JSVariableObjectData* data)
+ : JSObject(structure)
+ , d(data) // Subclass owns this pointer.
+ {
+ }
+
+ Register* copyRegisterArray(Register* src, size_t count);
+ void setRegisters(Register* r, Register* registerArray);
+
+ bool symbolTableGet(const Identifier&, PropertySlot&);
+ bool symbolTableGet(const Identifier&, PropertyDescriptor&);
+ bool symbolTableGet(const Identifier&, PropertySlot&, bool& slotIsWriteable);
+ bool symbolTablePut(const Identifier&, JSValue);
+ bool symbolTablePutWithAttributes(const Identifier&, JSValue, unsigned attributes);
+
+ JSVariableObjectData* d;
+ };
+
+ inline bool JSVariableObject::symbolTableGet(const Identifier& propertyName, PropertySlot& slot)
+ {
+ SymbolTableEntry entry = symbolTable().inlineGet(propertyName.impl());
+ if (!entry.isNull()) {
+ slot.setRegisterSlot(&registerAt(entry.getIndex()));
+ return true;
+ }
+ return false;
+ }
+
+ inline bool JSVariableObject::symbolTableGet(const Identifier& propertyName, PropertySlot& slot, bool& slotIsWriteable)
+ {
+ SymbolTableEntry entry = symbolTable().inlineGet(propertyName.impl());
+ if (!entry.isNull()) {
+ slot.setRegisterSlot(&registerAt(entry.getIndex()));
+ slotIsWriteable = !entry.isReadOnly();
+ return true;
+ }
+ return false;
+ }
+
+ inline bool JSVariableObject::symbolTablePut(const Identifier& propertyName, JSValue value)
+ {
+ ASSERT(!Heap::heap(value) || Heap::heap(value) == Heap::heap(this));
+
+ SymbolTableEntry entry = symbolTable().inlineGet(propertyName.impl());
+ if (entry.isNull())
+ return false;
+ if (entry.isReadOnly())
+ return true;
+ registerAt(entry.getIndex()) = value;
+ return true;
+ }
+
+ inline bool JSVariableObject::symbolTablePutWithAttributes(const Identifier& propertyName, JSValue value, unsigned attributes)
+ {
+ ASSERT(!Heap::heap(value) || Heap::heap(value) == Heap::heap(this));
+
+ SymbolTable::iterator iter = symbolTable().find(propertyName.impl());
+ if (iter == symbolTable().end())
+ return false;
+ SymbolTableEntry& entry = iter->second;
+ ASSERT(!entry.isNull());
+ entry.setAttributes(attributes);
+ registerAt(entry.getIndex()) = value;
+ return true;
+ }
+
+ inline Register* JSVariableObject::copyRegisterArray(Register* src, size_t count)
+ {
+ Register* registerArray = new Register[count];
+ memcpy(registerArray, src, count * sizeof(Register));
+
+ return registerArray;
+ }
+
+ inline void JSVariableObject::setRegisters(Register* registers, Register* registerArray)
+ {
+ ASSERT(registerArray != d->registerArray.get());
+ d->registerArray.set(registerArray);
+ d->registers = registers;
+ }
+
+} // namespace JSC
+
+#endif // JSVariableObject_h
diff --git a/Source/JavaScriptCore/runtime/JSWrapperObject.cpp b/Source/JavaScriptCore/runtime/JSWrapperObject.cpp
new file mode 100644
index 0000000..2c39f5c
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/JSWrapperObject.cpp
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2006 Maks Orlovich
+ * Copyright (C) 2006, 2009 Apple, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+#include "JSWrapperObject.h"
+
+namespace JSC {
+
+ASSERT_CLASS_FITS_IN_CELL(JSWrapperObject);
+
+void JSWrapperObject::markChildren(MarkStack& markStack)
+{
+ JSObject::markChildren(markStack);
+ if (m_internalValue)
+ markStack.append(m_internalValue);
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/JSWrapperObject.h b/Source/JavaScriptCore/runtime/JSWrapperObject.h
new file mode 100644
index 0000000..f19cd30
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/JSWrapperObject.h
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2006 Maks Orlovich
+ * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef JSWrapperObject_h
+#define JSWrapperObject_h
+
+#include "JSObject.h"
+
+namespace JSC {
+
+ // This class is used as a base for classes such as String,
+ // Number, Boolean and Date which are wrappers for primitive types.
+ class JSWrapperObject : public JSObject {
+ protected:
+ explicit JSWrapperObject(NonNullPassRefPtr<Structure>);
+
+ public:
+ JSValue internalValue() const { return m_internalValue; }
+ void setInternalValue(JSValue);
+
+ static PassRefPtr<Structure> createStructure(JSValue prototype)
+ {
+ return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount);
+ }
+
+ protected:
+ static const unsigned AnonymousSlotCount = 1 + JSObject::AnonymousSlotCount;
+
+ private:
+ virtual void markChildren(MarkStack&);
+
+ JSValue m_internalValue;
+ };
+
+ inline JSWrapperObject::JSWrapperObject(NonNullPassRefPtr<Structure> structure)
+ : JSObject(structure)
+ {
+ putAnonymousValue(0, jsNull());
+ }
+
+ inline void JSWrapperObject::setInternalValue(JSValue value)
+ {
+ ASSERT(value);
+ ASSERT(!value.isObject());
+ m_internalValue = value;
+ putAnonymousValue(0, value);
+ }
+
+} // namespace JSC
+
+#endif // JSWrapperObject_h
diff --git a/Source/JavaScriptCore/runtime/JSZombie.cpp b/Source/JavaScriptCore/runtime/JSZombie.cpp
new file mode 100644
index 0000000..8a36bda
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/JSZombie.cpp
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JSZombie.h"
+#include "ClassInfo.h"
+
+#if ENABLE(JSC_ZOMBIES)
+
+namespace JSC {
+
+const ClassInfo JSZombie::s_info = { "Zombie", 0, 0, 0 };
+
+Structure* JSZombie::leakedZombieStructure() {
+ static Structure* structure = 0;
+ if (!structure) {
+ Structure::startIgnoringLeaks();
+ structure = Structure::create(jsNull(), TypeInfo(UnspecifiedType), 0).leakRef();
+ Structure::stopIgnoringLeaks();
+ }
+ return structure;
+}
+
+}
+
+#endif // ENABLE(JSC_ZOMBIES)
diff --git a/Source/JavaScriptCore/runtime/JSZombie.h b/Source/JavaScriptCore/runtime/JSZombie.h
new file mode 100644
index 0000000..da45699
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/JSZombie.h
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef JSZombie_h
+#define JSZombie_h
+
+#include "JSCell.h"
+
+#if ENABLE(JSC_ZOMBIES)
+namespace JSC {
+
+class JSZombie : public JSCell {
+public:
+ JSZombie(const ClassInfo* oldInfo, Structure* structure)
+ : JSCell(structure)
+ , m_oldInfo(oldInfo)
+ {
+ }
+ virtual bool isZombie() const { return true; }
+ virtual const ClassInfo* classInfo() const { return &s_info; }
+ static Structure* leakedZombieStructure();
+
+ virtual bool isGetterSetter() const { ASSERT_NOT_REACHED(); return false; }
+ virtual bool isAPIValueWrapper() const { ASSERT_NOT_REACHED(); return false; }
+ virtual bool isPropertyNameIterator() const { ASSERT_NOT_REACHED(); return false; }
+ virtual CallType getCallData(CallData&) { ASSERT_NOT_REACHED(); return CallTypeNone; }
+ virtual ConstructType getConstructData(ConstructData&) { ASSERT_NOT_REACHED(); return ConstructTypeNone; }
+ virtual bool getUInt32(uint32_t&) const { ASSERT_NOT_REACHED(); return false; }
+ virtual JSValue toPrimitive(ExecState*, PreferredPrimitiveType) const { ASSERT_NOT_REACHED(); return jsNull(); }
+ virtual bool getPrimitiveNumber(ExecState*, double&, JSValue&) { ASSERT_NOT_REACHED(); return false; }
+ virtual bool toBoolean(ExecState*) const { ASSERT_NOT_REACHED(); return false; }
+ virtual double toNumber(ExecState*) const { ASSERT_NOT_REACHED(); return 0.0; }
+ virtual UString toString(ExecState*) const { ASSERT_NOT_REACHED(); return ""; }
+ virtual JSObject* toObject(ExecState*) const { ASSERT_NOT_REACHED(); return 0; }
+ virtual void markChildren(MarkStack&) { ASSERT_NOT_REACHED(); }
+ virtual void put(ExecState*, const Identifier&, JSValue, PutPropertySlot&) { ASSERT_NOT_REACHED(); }
+ virtual void put(ExecState*, unsigned, JSValue) { ASSERT_NOT_REACHED(); }
+ virtual bool deleteProperty(ExecState*, const Identifier&) { ASSERT_NOT_REACHED(); return false; }
+ virtual bool deleteProperty(ExecState*, unsigned) { ASSERT_NOT_REACHED(); return false; }
+ virtual JSObject* toThisObject(ExecState*) const { ASSERT_NOT_REACHED(); return 0; }
+ virtual JSValue toStrictThisObject(ExecState*) const { ASSERT_NOT_REACHED(); return JSValue(); }
+ virtual JSValue getJSNumber() { ASSERT_NOT_REACHED(); return jsNull(); }
+ virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&) { ASSERT_NOT_REACHED(); return false; }
+ virtual bool getOwnPropertySlot(ExecState*, unsigned, PropertySlot&) { ASSERT_NOT_REACHED(); return false; }
+
+ static const ClassInfo s_info;
+private:
+ const ClassInfo* m_oldInfo;
+};
+
+}
+
+#endif // ENABLE(JSC_ZOMBIES)
+
+#endif // JSZombie_h
diff --git a/Source/JavaScriptCore/runtime/LiteralParser.cpp b/Source/JavaScriptCore/runtime/LiteralParser.cpp
new file mode 100644
index 0000000..df87e7f
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/LiteralParser.cpp
@@ -0,0 +1,462 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "LiteralParser.h"
+
+#include "JSArray.h"
+#include "JSString.h"
+#include "Lexer.h"
+#include "UStringBuilder.h"
+#include <wtf/ASCIICType.h>
+#include <wtf/dtoa.h>
+
+namespace JSC {
+
+static inline bool isJSONWhiteSpace(const UChar& c)
+{
+ // The JSON RFC 4627 defines a list of allowed characters to be considered
+ // insignificant white space: http://www.ietf.org/rfc/rfc4627.txt (2. JSON Grammar).
+ return c == ' ' || c == 0x9 || c == 0xA || c == 0xD;
+}
+
+LiteralParser::TokenType LiteralParser::Lexer::lex(LiteralParserToken& token)
+{
+ while (m_ptr < m_end && isJSONWhiteSpace(*m_ptr))
+ ++m_ptr;
+
+ ASSERT(m_ptr <= m_end);
+ if (m_ptr >= m_end) {
+ token.type = TokEnd;
+ token.start = token.end = m_ptr;
+ return TokEnd;
+ }
+ token.type = TokError;
+ token.start = m_ptr;
+ switch (*m_ptr) {
+ case '[':
+ token.type = TokLBracket;
+ token.end = ++m_ptr;
+ return TokLBracket;
+ case ']':
+ token.type = TokRBracket;
+ token.end = ++m_ptr;
+ return TokRBracket;
+ case '(':
+ token.type = TokLParen;
+ token.end = ++m_ptr;
+ return TokLBracket;
+ case ')':
+ token.type = TokRParen;
+ token.end = ++m_ptr;
+ return TokRBracket;
+ case '{':
+ token.type = TokLBrace;
+ token.end = ++m_ptr;
+ return TokLBrace;
+ case '}':
+ token.type = TokRBrace;
+ token.end = ++m_ptr;
+ return TokRBrace;
+ case ',':
+ token.type = TokComma;
+ token.end = ++m_ptr;
+ return TokComma;
+ case ':':
+ token.type = TokColon;
+ token.end = ++m_ptr;
+ return TokColon;
+ case '"':
+ if (m_mode == StrictJSON)
+ return lexString<StrictJSON>(token);
+ return lexString<NonStrictJSON>(token);
+ case 't':
+ if (m_end - m_ptr >= 4 && m_ptr[1] == 'r' && m_ptr[2] == 'u' && m_ptr[3] == 'e') {
+ m_ptr += 4;
+ token.type = TokTrue;
+ token.end = m_ptr;
+ return TokTrue;
+ }
+ break;
+ case 'f':
+ if (m_end - m_ptr >= 5 && m_ptr[1] == 'a' && m_ptr[2] == 'l' && m_ptr[3] == 's' && m_ptr[4] == 'e') {
+ m_ptr += 5;
+ token.type = TokFalse;
+ token.end = m_ptr;
+ return TokFalse;
+ }
+ break;
+ case 'n':
+ if (m_end - m_ptr >= 4 && m_ptr[1] == 'u' && m_ptr[2] == 'l' && m_ptr[3] == 'l') {
+ m_ptr += 4;
+ token.type = TokNull;
+ token.end = m_ptr;
+ return TokNull;
+ }
+ break;
+ case '-':
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ return lexNumber(token);
+ }
+ return TokError;
+}
+
+template <LiteralParser::ParserMode mode> static inline bool isSafeStringCharacter(UChar c)
+{
+ return (c >= ' ' && (mode == LiteralParser::StrictJSON || c <= 0xff) && c != '\\' && c != '"') || c == '\t';
+}
+
+// "inline" is required here to help WINSCW compiler resolve specialized argument in templated functions.
+template <LiteralParser::ParserMode mode> inline LiteralParser::TokenType LiteralParser::Lexer::lexString(LiteralParserToken& token)
+{
+ ++m_ptr;
+ const UChar* runStart;
+ UStringBuilder builder;
+ do {
+ runStart = m_ptr;
+ while (m_ptr < m_end && isSafeStringCharacter<mode>(*m_ptr))
+ ++m_ptr;
+ if (runStart < m_ptr)
+ builder.append(runStart, m_ptr - runStart);
+ if ((mode == StrictJSON) && m_ptr < m_end && *m_ptr == '\\') {
+ ++m_ptr;
+ if (m_ptr >= m_end)
+ return TokError;
+ switch (*m_ptr) {
+ case '"':
+ builder.append('"');
+ m_ptr++;
+ break;
+ case '\\':
+ builder.append('\\');
+ m_ptr++;
+ break;
+ case '/':
+ builder.append('/');
+ m_ptr++;
+ break;
+ case 'b':
+ builder.append('\b');
+ m_ptr++;
+ break;
+ case 'f':
+ builder.append('\f');
+ m_ptr++;
+ break;
+ case 'n':
+ builder.append('\n');
+ m_ptr++;
+ break;
+ case 'r':
+ builder.append('\r');
+ m_ptr++;
+ break;
+ case 't':
+ builder.append('\t');
+ m_ptr++;
+ break;
+
+ case 'u':
+ if ((m_end - m_ptr) < 5) // uNNNN == 5 characters
+ return TokError;
+ for (int i = 1; i < 5; i++) {
+ if (!isASCIIHexDigit(m_ptr[i]))
+ return TokError;
+ }
+ builder.append(JSC::Lexer::convertUnicode(m_ptr[1], m_ptr[2], m_ptr[3], m_ptr[4]));
+ m_ptr += 5;
+ break;
+
+ default:
+ return TokError;
+ }
+ }
+ } while ((mode == StrictJSON) && m_ptr != runStart && (m_ptr < m_end) && *m_ptr != '"');
+
+ if (m_ptr >= m_end || *m_ptr != '"')
+ return TokError;
+
+ token.stringToken = builder.toUString();
+ token.type = TokString;
+ token.end = ++m_ptr;
+ return TokString;
+}
+
+LiteralParser::TokenType LiteralParser::Lexer::lexNumber(LiteralParserToken& token)
+{
+ // ES5 and json.org define numbers as
+ // number
+ // int
+ // int frac? exp?
+ //
+ // int
+ // -? 0
+ // -? digit1-9 digits?
+ //
+ // digits
+ // digit digits?
+ //
+ // -?(0 | [1-9][0-9]*) ('.' [0-9]+)? ([eE][+-]? [0-9]+)?
+
+ if (m_ptr < m_end && *m_ptr == '-') // -?
+ ++m_ptr;
+
+ // (0 | [1-9][0-9]*)
+ if (m_ptr < m_end && *m_ptr == '0') // 0
+ ++m_ptr;
+ else if (m_ptr < m_end && *m_ptr >= '1' && *m_ptr <= '9') { // [1-9]
+ ++m_ptr;
+ // [0-9]*
+ while (m_ptr < m_end && isASCIIDigit(*m_ptr))
+ ++m_ptr;
+ } else
+ return TokError;
+
+ // ('.' [0-9]+)?
+ if (m_ptr < m_end && *m_ptr == '.') {
+ ++m_ptr;
+ // [0-9]+
+ if (m_ptr >= m_end || !isASCIIDigit(*m_ptr))
+ return TokError;
+
+ ++m_ptr;
+ while (m_ptr < m_end && isASCIIDigit(*m_ptr))
+ ++m_ptr;
+ }
+
+ // ([eE][+-]? [0-9]+)?
+ if (m_ptr < m_end && (*m_ptr == 'e' || *m_ptr == 'E')) { // [eE]
+ ++m_ptr;
+
+ // [-+]?
+ if (m_ptr < m_end && (*m_ptr == '-' || *m_ptr == '+'))
+ ++m_ptr;
+
+ // [0-9]+
+ if (m_ptr >= m_end || !isASCIIDigit(*m_ptr))
+ return TokError;
+
+ ++m_ptr;
+ while (m_ptr < m_end && isASCIIDigit(*m_ptr))
+ ++m_ptr;
+ }
+
+ token.type = TokNumber;
+ token.end = m_ptr;
+ Vector<char, 64> buffer(token.end - token.start + 1);
+ int i;
+ for (i = 0; i < token.end - token.start; i++) {
+ ASSERT(static_cast<char>(token.start[i]) == token.start[i]);
+ buffer[i] = static_cast<char>(token.start[i]);
+ }
+ buffer[i] = 0;
+ char* end;
+ token.numberToken = WTF::strtod(buffer.data(), &end);
+ ASSERT(buffer.data() + (token.end - token.start) == end);
+ return TokNumber;
+}
+
+JSValue LiteralParser::parse(ParserState initialState)
+{
+ ParserState state = initialState;
+ MarkedArgumentBuffer objectStack;
+ JSValue lastValue;
+ Vector<ParserState, 16> stateStack;
+ Vector<Identifier, 16> identifierStack;
+ while (1) {
+ switch(state) {
+ startParseArray:
+ case StartParseArray: {
+ JSArray* array = constructEmptyArray(m_exec);
+ objectStack.append(array);
+ // fallthrough
+ }
+ doParseArrayStartExpression:
+ case DoParseArrayStartExpression: {
+ TokenType lastToken = m_lexer.currentToken().type;
+ if (m_lexer.next() == TokRBracket) {
+ if (lastToken == TokComma)
+ return JSValue();
+ m_lexer.next();
+ lastValue = objectStack.last();
+ objectStack.removeLast();
+ break;
+ }
+
+ stateStack.append(DoParseArrayEndExpression);
+ goto startParseExpression;
+ }
+ case DoParseArrayEndExpression: {
+ asArray(objectStack.last())->push(m_exec, lastValue);
+
+ if (m_lexer.currentToken().type == TokComma)
+ goto doParseArrayStartExpression;
+
+ if (m_lexer.currentToken().type != TokRBracket)
+ return JSValue();
+
+ m_lexer.next();
+ lastValue = objectStack.last();
+ objectStack.removeLast();
+ break;
+ }
+ startParseObject:
+ case StartParseObject: {
+ JSObject* object = constructEmptyObject(m_exec);
+ objectStack.append(object);
+
+ TokenType type = m_lexer.next();
+ if (type == TokString) {
+ Lexer::LiteralParserToken identifierToken = m_lexer.currentToken();
+
+ // Check for colon
+ if (m_lexer.next() != TokColon)
+ return JSValue();
+
+ m_lexer.next();
+ identifierStack.append(Identifier(m_exec, identifierToken.stringToken));
+ stateStack.append(DoParseObjectEndExpression);
+ goto startParseExpression;
+ } else if (type != TokRBrace)
+ return JSValue();
+ m_lexer.next();
+ lastValue = objectStack.last();
+ objectStack.removeLast();
+ break;
+ }
+ doParseObjectStartExpression:
+ case DoParseObjectStartExpression: {
+ TokenType type = m_lexer.next();
+ if (type != TokString)
+ return JSValue();
+ Lexer::LiteralParserToken identifierToken = m_lexer.currentToken();
+
+ // Check for colon
+ if (m_lexer.next() != TokColon)
+ return JSValue();
+
+ m_lexer.next();
+ identifierStack.append(Identifier(m_exec, identifierToken.stringToken));
+ stateStack.append(DoParseObjectEndExpression);
+ goto startParseExpression;
+ }
+ case DoParseObjectEndExpression:
+ {
+ asObject(objectStack.last())->putDirect(identifierStack.last(), lastValue);
+ identifierStack.removeLast();
+ if (m_lexer.currentToken().type == TokComma)
+ goto doParseObjectStartExpression;
+ if (m_lexer.currentToken().type != TokRBrace)
+ return JSValue();
+ m_lexer.next();
+ lastValue = objectStack.last();
+ objectStack.removeLast();
+ break;
+ }
+ startParseExpression:
+ case StartParseExpression: {
+ switch (m_lexer.currentToken().type) {
+ case TokLBracket:
+ goto startParseArray;
+ case TokLBrace:
+ goto startParseObject;
+ case TokString: {
+ Lexer::LiteralParserToken stringToken = m_lexer.currentToken();
+ m_lexer.next();
+ lastValue = jsString(m_exec, stringToken.stringToken);
+ break;
+ }
+ case TokNumber: {
+ Lexer::LiteralParserToken numberToken = m_lexer.currentToken();
+ m_lexer.next();
+ lastValue = jsNumber(numberToken.numberToken);
+ break;
+ }
+ case TokNull:
+ m_lexer.next();
+ lastValue = jsNull();
+ break;
+
+ case TokTrue:
+ m_lexer.next();
+ lastValue = jsBoolean(true);
+ break;
+
+ case TokFalse:
+ m_lexer.next();
+ lastValue = jsBoolean(false);
+ break;
+
+ default:
+ // Error
+ return JSValue();
+ }
+ break;
+ }
+ case StartParseStatement: {
+ switch (m_lexer.currentToken().type) {
+ case TokLBracket:
+ case TokNumber:
+ case TokString:
+ goto startParseExpression;
+
+ case TokLParen: {
+ m_lexer.next();
+ stateStack.append(StartParseStatementEndStatement);
+ goto startParseExpression;
+ }
+ default:
+ return JSValue();
+ }
+ }
+ case StartParseStatementEndStatement: {
+ ASSERT(stateStack.isEmpty());
+ if (m_lexer.currentToken().type != TokRParen)
+ return JSValue();
+ if (m_lexer.next() == TokEnd)
+ return lastValue;
+ return JSValue();
+ }
+ default:
+ ASSERT_NOT_REACHED();
+ }
+ if (stateStack.isEmpty())
+ return lastValue;
+ state = stateStack.last();
+ stateStack.removeLast();
+ continue;
+ }
+}
+
+}
diff --git a/Source/JavaScriptCore/runtime/LiteralParser.h b/Source/JavaScriptCore/runtime/LiteralParser.h
new file mode 100644
index 0000000..6df5d06
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/LiteralParser.h
@@ -0,0 +1,110 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef LiteralParser_h
+#define LiteralParser_h
+
+#include "JSGlobalObjectFunctions.h"
+#include "JSValue.h"
+#include "UString.h"
+
+namespace JSC {
+
+ class LiteralParser {
+ public:
+ typedef enum { StrictJSON, NonStrictJSON } ParserMode;
+ LiteralParser(ExecState* exec, const UString& s, ParserMode mode)
+ : m_exec(exec)
+ , m_lexer(s, mode)
+ , m_mode(mode)
+ {
+ }
+
+ JSValue tryLiteralParse()
+ {
+ m_lexer.next();
+ JSValue result = parse(m_mode == StrictJSON ? StartParseExpression : StartParseStatement);
+ if (m_lexer.currentToken().type != TokEnd)
+ return JSValue();
+ return result;
+ }
+ private:
+ enum ParserState { StartParseObject, StartParseArray, StartParseExpression,
+ StartParseStatement, StartParseStatementEndStatement,
+ DoParseObjectStartExpression, DoParseObjectEndExpression,
+ DoParseArrayStartExpression, DoParseArrayEndExpression };
+ enum TokenType { TokLBracket, TokRBracket, TokLBrace, TokRBrace,
+ TokString, TokIdentifier, TokNumber, TokColon,
+ TokLParen, TokRParen, TokComma, TokTrue, TokFalse,
+ TokNull, TokEnd, TokError };
+
+ class Lexer {
+ public:
+ struct LiteralParserToken {
+ TokenType type;
+ const UChar* start;
+ const UChar* end;
+ UString stringToken;
+ double numberToken;
+ };
+ Lexer(const UString& s, ParserMode mode)
+ : m_string(s)
+ , m_mode(mode)
+ , m_ptr(s.characters())
+ , m_end(s.characters() + s.length())
+ {
+ }
+
+ TokenType next()
+ {
+ return lex(m_currentToken);
+ }
+
+ const LiteralParserToken& currentToken()
+ {
+ return m_currentToken;
+ }
+
+ private:
+ TokenType lex(LiteralParserToken&);
+ template <ParserMode mode> TokenType lexString(LiteralParserToken&);
+ TokenType lexNumber(LiteralParserToken&);
+ LiteralParserToken m_currentToken;
+ UString m_string;
+ ParserMode m_mode;
+ const UChar* m_ptr;
+ const UChar* m_end;
+ };
+
+ class StackGuard;
+ JSValue parse(ParserState);
+
+ ExecState* m_exec;
+ LiteralParser::Lexer m_lexer;
+ ParserMode m_mode;
+ };
+}
+
+#endif
diff --git a/Source/JavaScriptCore/runtime/Lookup.cpp b/Source/JavaScriptCore/runtime/Lookup.cpp
new file mode 100644
index 0000000..dac1c94
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/Lookup.cpp
@@ -0,0 +1,96 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#include "config.h"
+#include "Lookup.h"
+
+#include "Executable.h"
+#include "JSFunction.h"
+#include "PrototypeFunction.h"
+
+namespace JSC {
+
+void HashTable::createTable(JSGlobalData* globalData) const
+{
+ ASSERT(!table);
+ int linkIndex = compactHashSizeMask + 1;
+ HashEntry* entries = new HashEntry[compactSize];
+ for (int i = 0; i < compactSize; ++i)
+ entries[i].setKey(0);
+ for (int i = 0; values[i].key; ++i) {
+ StringImpl* identifier = Identifier::add(globalData, values[i].key).leakRef();
+ int hashIndex = identifier->existingHash() & compactHashSizeMask;
+ HashEntry* entry = &entries[hashIndex];
+
+ if (entry->key()) {
+ while (entry->next()) {
+ entry = entry->next();
+ }
+ ASSERT(linkIndex < compactSize);
+ entry->setNext(&entries[linkIndex++]);
+ entry = entry->next();
+ }
+
+ entry->initialize(identifier, values[i].attributes, values[i].value1, values[i].value2
+#if ENABLE(JIT)
+ , values[i].generator
+#endif
+ );
+ }
+ table = entries;
+}
+
+void HashTable::deleteTable() const
+{
+ if (table) {
+ int max = compactSize;
+ for (int i = 0; i != max; ++i) {
+ if (StringImpl* key = table[i].key())
+ key->deref();
+ }
+ delete [] table;
+ table = 0;
+ }
+}
+
+void setUpStaticFunctionSlot(ExecState* exec, const HashEntry* entry, JSObject* thisObj, const Identifier& propertyName, PropertySlot& slot)
+{
+ ASSERT(thisObj->structure()->anonymousSlotCount() > 0);
+ ASSERT(thisObj->getAnonymousValue(0).isCell() && asObject(thisObj->getAnonymousValue(0).asCell())->isGlobalObject());
+ ASSERT(entry->attributes() & Function);
+ JSValue* location = thisObj->getDirectLocation(propertyName);
+
+ if (!location) {
+ NativeFunctionWrapper* function;
+ JSGlobalObject* globalObject = asGlobalObject(thisObj->getAnonymousValue(0).asCell());
+#if ENABLE(JIT) && ENABLE(JIT_OPTIMIZE_NATIVE_CALL)
+ if (entry->generator())
+ function = new (exec) NativeFunctionWrapper(exec, globalObject, globalObject->prototypeFunctionStructure(), entry->functionLength(), propertyName, exec->globalData().getHostFunction(entry->function(), entry->generator()));
+ else
+#endif
+ function = new (exec) NativeFunctionWrapper(exec, globalObject, globalObject->prototypeFunctionStructure(), entry->functionLength(), propertyName, entry->function());
+
+ thisObj->putDirectFunction(propertyName, function, entry->attributes());
+ location = thisObj->getDirectLocation(propertyName);
+ }
+
+ slot.setValueSlot(thisObj, location, thisObj->offsetForLocation(location));
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/Lookup.h b/Source/JavaScriptCore/runtime/Lookup.h
new file mode 100644
index 0000000..9bc81d4
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/Lookup.h
@@ -0,0 +1,338 @@
+/*
+ * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
+ * Copyright (C) 2003, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifndef Lookup_h
+#define Lookup_h
+
+#include "CallFrame.h"
+#include "Identifier.h"
+#include "JSGlobalObject.h"
+#include "JSObject.h"
+#include "PropertySlot.h"
+#include <stdio.h>
+#include <wtf/Assertions.h>
+
+// Bug #26843: Work around Metrowerks compiler bug
+#if COMPILER(WINSCW)
+#define JSC_CONST_HASHTABLE
+#else
+#define JSC_CONST_HASHTABLE const
+#endif
+
+namespace JSC {
+ // Hash table generated by the create_hash_table script.
+ struct HashTableValue {
+ const char* key; // property name
+ unsigned char attributes; // JSObject attributes
+ intptr_t value1;
+ intptr_t value2;
+#if ENABLE(JIT)
+ ThunkGenerator generator;
+#endif
+ };
+
+ // FIXME: There is no reason this get function can't be simpler.
+ // ie. typedef JSValue (*GetFunction)(ExecState*, JSObject* baseObject)
+ typedef PropertySlot::GetValueFunc GetFunction;
+ typedef void (*PutFunction)(ExecState*, JSObject* baseObject, JSValue value);
+
+ class HashEntry : public FastAllocBase {
+ public:
+ void initialize(StringImpl* key, unsigned char attributes, intptr_t v1, intptr_t v2
+#if ENABLE(JIT)
+ , ThunkGenerator generator = 0
+#endif
+ )
+ {
+ m_key = key;
+ m_attributes = attributes;
+ m_u.store.value1 = v1;
+ m_u.store.value2 = v2;
+#if ENABLE(JIT)
+ m_u.function.generator = generator;
+#endif
+ m_next = 0;
+ }
+
+ void setKey(StringImpl* key) { m_key = key; }
+ StringImpl* key() const { return m_key; }
+
+ unsigned char attributes() const { return m_attributes; }
+
+#if ENABLE(JIT) && ENABLE(JIT_OPTIMIZE_NATIVE_CALL)
+ ThunkGenerator generator() const { ASSERT(m_attributes & Function); return m_u.function.generator; }
+#endif
+ NativeFunction function() const { ASSERT(m_attributes & Function); return m_u.function.functionValue; }
+ unsigned char functionLength() const { ASSERT(m_attributes & Function); return static_cast<unsigned char>(m_u.function.length); }
+
+ GetFunction propertyGetter() const { ASSERT(!(m_attributes & Function)); return m_u.property.get; }
+ PutFunction propertyPutter() const { ASSERT(!(m_attributes & Function)); return m_u.property.put; }
+
+ intptr_t lexerValue() const { ASSERT(!m_attributes); return m_u.lexer.value; }
+
+ void setNext(HashEntry *next) { m_next = next; }
+ HashEntry* next() const { return m_next; }
+
+ private:
+ StringImpl* m_key;
+ unsigned char m_attributes; // JSObject attributes
+
+ union {
+ struct {
+ intptr_t value1;
+ intptr_t value2;
+ } store;
+ struct {
+ NativeFunction functionValue;
+ intptr_t length; // number of arguments for function
+#if ENABLE(JIT)
+ ThunkGenerator generator;
+#endif
+ } function;
+ struct {
+ GetFunction get;
+ PutFunction put;
+ } property;
+ struct {
+ intptr_t value;
+ intptr_t unused;
+ } lexer;
+ } m_u;
+
+ HashEntry* m_next;
+ };
+
+ struct HashTable {
+
+ int compactSize;
+ int compactHashSizeMask;
+
+ const HashTableValue* values; // Fixed values generated by script.
+ mutable const HashEntry* table; // Table allocated at runtime.
+
+ ALWAYS_INLINE void initializeIfNeeded(JSGlobalData* globalData) const
+ {
+ if (!table)
+ createTable(globalData);
+ }
+
+ ALWAYS_INLINE void initializeIfNeeded(ExecState* exec) const
+ {
+ if (!table)
+ createTable(&exec->globalData());
+ }
+
+ void deleteTable() const;
+
+ // Find an entry in the table, and return the entry.
+ ALWAYS_INLINE const HashEntry* entry(JSGlobalData* globalData, const Identifier& identifier) const
+ {
+ initializeIfNeeded(globalData);
+ return entry(identifier);
+ }
+
+ ALWAYS_INLINE const HashEntry* entry(ExecState* exec, const Identifier& identifier) const
+ {
+ initializeIfNeeded(exec);
+ return entry(identifier);
+ }
+
+ private:
+ ALWAYS_INLINE const HashEntry* entry(const Identifier& identifier) const
+ {
+ ASSERT(table);
+
+ const HashEntry* entry = &table[identifier.impl()->existingHash() & compactHashSizeMask];
+
+ if (!entry->key())
+ return 0;
+
+ do {
+ if (entry->key() == identifier.impl())
+ return entry;
+ entry = entry->next();
+ } while (entry);
+
+ return 0;
+ }
+
+ // Convert the hash table keys to identifiers.
+ void createTable(JSGlobalData*) const;
+ };
+
+ void setUpStaticFunctionSlot(ExecState*, const HashEntry*, JSObject* thisObject, const Identifier& propertyName, PropertySlot&);
+
+ /**
+ * This method does it all (looking in the hashtable, checking for function
+ * overrides, creating the function or retrieving from cache, calling
+ * getValueProperty in case of a non-function property, forwarding to parent if
+ * unknown property).
+ */
+ template <class ThisImp, class ParentImp>
+ inline bool getStaticPropertySlot(ExecState* exec, const HashTable* table, ThisImp* thisObj, const Identifier& propertyName, PropertySlot& slot)
+ {
+ const HashEntry* entry = table->entry(exec, propertyName);
+
+ if (!entry) // not found, forward to parent
+ return thisObj->ParentImp::getOwnPropertySlot(exec, propertyName, slot);
+
+ if (entry->attributes() & Function)
+ setUpStaticFunctionSlot(exec, entry, thisObj, propertyName, slot);
+ else
+ slot.setCacheableCustom(thisObj, entry->propertyGetter());
+
+ return true;
+ }
+
+ template <class ThisImp, class ParentImp>
+ inline bool getStaticPropertyDescriptor(ExecState* exec, const HashTable* table, ThisImp* thisObj, const Identifier& propertyName, PropertyDescriptor& descriptor)
+ {
+ const HashEntry* entry = table->entry(exec, propertyName);
+
+ if (!entry) // not found, forward to parent
+ return thisObj->ParentImp::getOwnPropertyDescriptor(exec, propertyName, descriptor);
+
+ PropertySlot slot;
+ if (entry->attributes() & Function)
+ setUpStaticFunctionSlot(exec, entry, thisObj, propertyName, slot);
+ else
+ slot.setCustom(thisObj, entry->propertyGetter());
+
+ descriptor.setDescriptor(slot.getValue(exec, propertyName), entry->attributes());
+ return true;
+ }
+
+ /**
+ * Simplified version of getStaticPropertySlot in case there are only functions.
+ * Using this instead of getStaticPropertySlot allows 'this' to avoid implementing
+ * a dummy getValueProperty.
+ */
+ template <class ParentImp>
+ inline bool getStaticFunctionSlot(ExecState* exec, const HashTable* table, JSObject* thisObj, const Identifier& propertyName, PropertySlot& slot)
+ {
+ if (static_cast<ParentImp*>(thisObj)->ParentImp::getOwnPropertySlot(exec, propertyName, slot))
+ return true;
+
+ const HashEntry* entry = table->entry(exec, propertyName);
+ if (!entry)
+ return false;
+
+ setUpStaticFunctionSlot(exec, entry, thisObj, propertyName, slot);
+ return true;
+ }
+
+ /**
+ * Simplified version of getStaticPropertyDescriptor in case there are only functions.
+ * Using this instead of getStaticPropertyDescriptor allows 'this' to avoid implementing
+ * a dummy getValueProperty.
+ */
+ template <class ParentImp>
+ inline bool getStaticFunctionDescriptor(ExecState* exec, const HashTable* table, JSObject* thisObj, const Identifier& propertyName, PropertyDescriptor& descriptor)
+ {
+ if (static_cast<ParentImp*>(thisObj)->ParentImp::getOwnPropertyDescriptor(exec, propertyName, descriptor))
+ return true;
+
+ const HashEntry* entry = table->entry(exec, propertyName);
+ if (!entry)
+ return false;
+
+ PropertySlot slot;
+ setUpStaticFunctionSlot(exec, entry, thisObj, propertyName, slot);
+ descriptor.setDescriptor(slot.getValue(exec, propertyName), entry->attributes());
+ return true;
+ }
+
+ /**
+ * Simplified version of getStaticPropertySlot in case there are no functions, only "values".
+ * Using this instead of getStaticPropertySlot removes the need for a FuncImp class.
+ */
+ template <class ThisImp, class ParentImp>
+ inline bool getStaticValueSlot(ExecState* exec, const HashTable* table, ThisImp* thisObj, const Identifier& propertyName, PropertySlot& slot)
+ {
+ const HashEntry* entry = table->entry(exec, propertyName);
+
+ if (!entry) // not found, forward to parent
+ return thisObj->ParentImp::getOwnPropertySlot(exec, propertyName, slot);
+
+ ASSERT(!(entry->attributes() & Function));
+
+ slot.setCacheableCustom(thisObj, entry->propertyGetter());
+ return true;
+ }
+
+ /**
+ * Simplified version of getStaticPropertyDescriptor in case there are no functions, only "values".
+ * Using this instead of getStaticPropertyDescriptor removes the need for a FuncImp class.
+ */
+ template <class ThisImp, class ParentImp>
+ inline bool getStaticValueDescriptor(ExecState* exec, const HashTable* table, ThisImp* thisObj, const Identifier& propertyName, PropertyDescriptor& descriptor)
+ {
+ const HashEntry* entry = table->entry(exec, propertyName);
+
+ if (!entry) // not found, forward to parent
+ return thisObj->ParentImp::getOwnPropertyDescriptor(exec, propertyName, descriptor);
+
+ ASSERT(!(entry->attributes() & Function));
+ PropertySlot slot;
+ slot.setCustom(thisObj, entry->propertyGetter());
+ descriptor.setDescriptor(slot.getValue(exec, propertyName), entry->attributes());
+ return true;
+ }
+
+ /**
+ * This one is for "put".
+ * It looks up a hash entry for the property to be set. If an entry
+ * is found it sets the value and returns true, else it returns false.
+ */
+ template <class ThisImp>
+ inline bool lookupPut(ExecState* exec, const Identifier& propertyName, JSValue value, const HashTable* table, ThisImp* thisObj)
+ {
+ const HashEntry* entry = table->entry(exec, propertyName);
+
+ if (!entry)
+ return false;
+
+ if (entry->attributes() & Function) { // function: put as override property
+ if (LIKELY(value.isCell()))
+ thisObj->putDirectFunction(propertyName, value.asCell());
+ else
+ thisObj->putDirect(propertyName, value);
+ } else if (!(entry->attributes() & ReadOnly))
+ entry->propertyPutter()(exec, thisObj, value);
+
+ return true;
+ }
+
+ /**
+ * This one is for "put".
+ * It calls lookupPut<ThisImp>() to set the value. If that call
+ * returns false (meaning no entry in the hash table was found),
+ * then it calls put() on the ParentImp class.
+ */
+ template <class ThisImp, class ParentImp>
+ inline void lookupPut(ExecState* exec, const Identifier& propertyName, JSValue value, const HashTable* table, ThisImp* thisObj, PutPropertySlot& slot)
+ {
+ if (!lookupPut<ThisImp>(exec, propertyName, value, table, thisObj))
+ thisObj->ParentImp::put(exec, propertyName, value, slot); // not found: forward to parent
+ }
+
+} // namespace JSC
+
+#endif // Lookup_h
diff --git a/Source/JavaScriptCore/runtime/MarkStack.cpp b/Source/JavaScriptCore/runtime/MarkStack.cpp
new file mode 100644
index 0000000..a350c35
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/MarkStack.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "MarkStack.h"
+
+namespace JSC {
+
+size_t MarkStack::s_pageSize = 0;
+
+void MarkStack::compact()
+{
+ ASSERT(s_pageSize);
+ m_values.shrinkAllocation(s_pageSize);
+ m_markSets.shrinkAllocation(s_pageSize);
+}
+
+}
diff --git a/Source/JavaScriptCore/runtime/MarkStack.h b/Source/JavaScriptCore/runtime/MarkStack.h
new file mode 100644
index 0000000..7bccadf
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/MarkStack.h
@@ -0,0 +1,190 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef MarkStack_h
+#define MarkStack_h
+
+#include "JSValue.h"
+#include <wtf/Noncopyable.h>
+#include <wtf/OSAllocator.h>
+
+namespace JSC {
+
+ class JSGlobalData;
+ class Register;
+
+ enum MarkSetProperties { MayContainNullValues, NoNullValues };
+
+ class MarkStack : Noncopyable {
+ public:
+ MarkStack(void* jsArrayVPtr)
+ : m_jsArrayVPtr(jsArrayVPtr)
+#if !ASSERT_DISABLED
+ , m_isCheckingForDefaultMarkViolation(false)
+ , m_isDraining(false)
+#endif
+ {
+ }
+
+ ALWAYS_INLINE void append(JSValue);
+ void append(JSCell*);
+
+ ALWAYS_INLINE void appendValues(Register* values, size_t count, MarkSetProperties properties = NoNullValues)
+ {
+ appendValues(reinterpret_cast<JSValue*>(values), count, properties);
+ }
+
+ ALWAYS_INLINE void appendValues(JSValue* values, size_t count, MarkSetProperties properties = NoNullValues)
+ {
+ if (count)
+ m_markSets.append(MarkSet(values, values + count, properties));
+ }
+
+ inline void drain();
+ void compact();
+
+ ~MarkStack()
+ {
+ ASSERT(m_markSets.isEmpty());
+ ASSERT(m_values.isEmpty());
+ }
+
+ private:
+ void markChildren(JSCell*);
+
+ struct MarkSet {
+ MarkSet(JSValue* values, JSValue* end, MarkSetProperties properties)
+ : m_values(values)
+ , m_end(end)
+ , m_properties(properties)
+ {
+ ASSERT(values);
+ }
+ JSValue* m_values;
+ JSValue* m_end;
+ MarkSetProperties m_properties;
+ };
+
+ static void* allocateStack(size_t size) { return OSAllocator::reserveAndCommit(size); }
+ static void releaseStack(void* addr, size_t size) { OSAllocator::decommitAndRelease(addr, size); }
+
+ static void initializePagesize();
+ static size_t pageSize()
+ {
+ if (!s_pageSize)
+ initializePagesize();
+ return s_pageSize;
+ }
+
+ template <typename T> struct MarkStackArray {
+ MarkStackArray()
+ : m_top(0)
+ , m_allocated(MarkStack::pageSize())
+ , m_capacity(m_allocated / sizeof(T))
+ {
+ m_data = reinterpret_cast<T*>(allocateStack(m_allocated));
+ }
+
+ ~MarkStackArray()
+ {
+ releaseStack(m_data, m_allocated);
+ }
+
+ void expand()
+ {
+ size_t oldAllocation = m_allocated;
+ m_allocated *= 2;
+ m_capacity = m_allocated / sizeof(T);
+ void* newData = allocateStack(m_allocated);
+ memcpy(newData, m_data, oldAllocation);
+ releaseStack(m_data, oldAllocation);
+ m_data = reinterpret_cast<T*>(newData);
+ }
+
+ inline void append(const T& v)
+ {
+ if (m_top == m_capacity)
+ expand();
+ m_data[m_top++] = v;
+ }
+
+ inline T removeLast()
+ {
+ ASSERT(m_top);
+ return m_data[--m_top];
+ }
+
+ inline T& last()
+ {
+ ASSERT(m_top);
+ return m_data[m_top - 1];
+ }
+
+ inline bool isEmpty()
+ {
+ return m_top == 0;
+ }
+
+ inline size_t size() { return m_top; }
+
+ inline void shrinkAllocation(size_t size)
+ {
+ ASSERT(size <= m_allocated);
+ ASSERT(0 == (size % MarkStack::pageSize()));
+ if (size == m_allocated)
+ return;
+#if OS(WINDOWS) || OS(SYMBIAN) || PLATFORM(BREWMP)
+ // We cannot release a part of a region with VirtualFree. To get around this,
+ // we'll release the entire region and reallocate the size that we want.
+ releaseStack(m_data, m_allocated);
+ m_data = reinterpret_cast<T*>(allocateStack(size));
+#else
+ releaseStack(reinterpret_cast<char*>(m_data) + size, m_allocated - size);
+#endif
+ m_allocated = size;
+ m_capacity = m_allocated / sizeof(T);
+ }
+
+ private:
+ size_t m_top;
+ size_t m_allocated;
+ size_t m_capacity;
+ T* m_data;
+ };
+
+ void* m_jsArrayVPtr;
+ MarkStackArray<MarkSet> m_markSets;
+ MarkStackArray<JSCell*> m_values;
+ static size_t s_pageSize;
+
+#if !ASSERT_DISABLED
+ public:
+ bool m_isCheckingForDefaultMarkViolation;
+ bool m_isDraining;
+#endif
+ };
+}
+
+#endif
diff --git a/Source/JavaScriptCore/runtime/MarkStackPosix.cpp b/Source/JavaScriptCore/runtime/MarkStackPosix.cpp
new file mode 100644
index 0000000..2a5b298
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/MarkStackPosix.cpp
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "MarkStack.h"
+
+#if OS(UNIX) && !OS(SYMBIAN)
+
+#include <unistd.h>
+#include <sys/mman.h>
+
+namespace JSC {
+
+void MarkStack::initializePagesize()
+{
+ MarkStack::s_pageSize = getpagesize();
+}
+
+}
+
+#endif
diff --git a/Source/JavaScriptCore/runtime/MarkStackSymbian.cpp b/Source/JavaScriptCore/runtime/MarkStackSymbian.cpp
new file mode 100644
index 0000000..a3893d7
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/MarkStackSymbian.cpp
@@ -0,0 +1,38 @@
+/*
+ Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include "config.h"
+#include "MarkStack.h"
+
+#if OS(SYMBIAN)
+
+#include <e32hal.h>
+
+namespace JSC {
+
+void MarkStack::initializePagesize()
+{
+ TInt page_size;
+ UserHal::PageSizeInBytes(page_size);
+ MarkStack::s_pageSize = page_size;
+}
+
+}
+
+#endif
diff --git a/Source/JavaScriptCore/runtime/MarkStackWin.cpp b/Source/JavaScriptCore/runtime/MarkStackWin.cpp
new file mode 100644
index 0000000..2d2a1b3
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/MarkStackWin.cpp
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "MarkStack.h"
+
+#if OS(WINDOWS)
+
+#include "windows.h"
+
+namespace JSC {
+
+void MarkStack::initializePagesize()
+{
+ SYSTEM_INFO system_info;
+ GetSystemInfo(&system_info);
+ MarkStack::s_pageSize = system_info.dwPageSize;
+}
+
+}
+
+#endif
diff --git a/Source/JavaScriptCore/runtime/MathObject.cpp b/Source/JavaScriptCore/runtime/MathObject.cpp
new file mode 100644
index 0000000..080d7d2
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/MathObject.cpp
@@ -0,0 +1,241 @@
+/*
+ * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
+ * Copyright (C) 2007, 2008 Apple Inc. All Rights Reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#include "config.h"
+#include "MathObject.h"
+
+#include "Lookup.h"
+#include "ObjectPrototype.h"
+#include "Operations.h"
+#include <time.h>
+#include <wtf/Assertions.h>
+#include <wtf/MathExtras.h>
+#include <wtf/RandomNumber.h>
+#include <wtf/RandomNumberSeed.h>
+
+namespace JSC {
+
+ASSERT_CLASS_FITS_IN_CELL(MathObject);
+
+static EncodedJSValue JSC_HOST_CALL mathProtoFuncAbs(ExecState*);
+static EncodedJSValue JSC_HOST_CALL mathProtoFuncACos(ExecState*);
+static EncodedJSValue JSC_HOST_CALL mathProtoFuncASin(ExecState*);
+static EncodedJSValue JSC_HOST_CALL mathProtoFuncATan(ExecState*);
+static EncodedJSValue JSC_HOST_CALL mathProtoFuncATan2(ExecState*);
+static EncodedJSValue JSC_HOST_CALL mathProtoFuncCeil(ExecState*);
+static EncodedJSValue JSC_HOST_CALL mathProtoFuncCos(ExecState*);
+static EncodedJSValue JSC_HOST_CALL mathProtoFuncExp(ExecState*);
+static EncodedJSValue JSC_HOST_CALL mathProtoFuncFloor(ExecState*);
+static EncodedJSValue JSC_HOST_CALL mathProtoFuncLog(ExecState*);
+static EncodedJSValue JSC_HOST_CALL mathProtoFuncMax(ExecState*);
+static EncodedJSValue JSC_HOST_CALL mathProtoFuncMin(ExecState*);
+static EncodedJSValue JSC_HOST_CALL mathProtoFuncPow(ExecState*);
+static EncodedJSValue JSC_HOST_CALL mathProtoFuncRandom(ExecState*);
+static EncodedJSValue JSC_HOST_CALL mathProtoFuncRound(ExecState*);
+static EncodedJSValue JSC_HOST_CALL mathProtoFuncSin(ExecState*);
+static EncodedJSValue JSC_HOST_CALL mathProtoFuncSqrt(ExecState*);
+static EncodedJSValue JSC_HOST_CALL mathProtoFuncTan(ExecState*);
+
+}
+
+#include "MathObject.lut.h"
+
+namespace JSC {
+
+// ------------------------------ MathObject --------------------------------
+
+const ClassInfo MathObject::info = { "Math", 0, 0, ExecState::mathTable };
+
+/* Source for MathObject.lut.h
+@begin mathTable
+ abs mathProtoFuncAbs DontEnum|Function 1
+ acos mathProtoFuncACos DontEnum|Function 1
+ asin mathProtoFuncASin DontEnum|Function 1
+ atan mathProtoFuncATan DontEnum|Function 1
+ atan2 mathProtoFuncATan2 DontEnum|Function 2
+ ceil mathProtoFuncCeil DontEnum|Function 1
+ cos mathProtoFuncCos DontEnum|Function 1
+ exp mathProtoFuncExp DontEnum|Function 1
+ floor mathProtoFuncFloor DontEnum|Function 1
+ log mathProtoFuncLog DontEnum|Function 1
+ max mathProtoFuncMax DontEnum|Function 2
+ min mathProtoFuncMin DontEnum|Function 2
+ pow mathProtoFuncPow DontEnum|Function 2
+ random mathProtoFuncRandom DontEnum|Function 0
+ round mathProtoFuncRound DontEnum|Function 1
+ sin mathProtoFuncSin DontEnum|Function 1
+ sqrt mathProtoFuncSqrt DontEnum|Function 1
+ tan mathProtoFuncTan DontEnum|Function 1
+@end
+*/
+
+MathObject::MathObject(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure)
+ : JSObjectWithGlobalObject(globalObject, structure)
+{
+ putDirectWithoutTransition(Identifier(exec, "E"), jsNumber(exp(1.0)), DontDelete | DontEnum | ReadOnly);
+ putDirectWithoutTransition(Identifier(exec, "LN2"), jsNumber(log(2.0)), DontDelete | DontEnum | ReadOnly);
+ putDirectWithoutTransition(Identifier(exec, "LN10"), jsNumber(log(10.0)), DontDelete | DontEnum | ReadOnly);
+ putDirectWithoutTransition(Identifier(exec, "LOG2E"), jsNumber(1.0 / log(2.0)), DontDelete | DontEnum | ReadOnly);
+ putDirectWithoutTransition(Identifier(exec, "LOG10E"), jsNumber(1.0 / log(10.0)), DontDelete | DontEnum | ReadOnly);
+ putDirectWithoutTransition(Identifier(exec, "PI"), jsNumber(piDouble), DontDelete | DontEnum | ReadOnly);
+ putDirectWithoutTransition(Identifier(exec, "SQRT1_2"), jsNumber(sqrt(0.5)), DontDelete | DontEnum | ReadOnly);
+ putDirectWithoutTransition(Identifier(exec, "SQRT2"), jsNumber(sqrt(2.0)), DontDelete | DontEnum | ReadOnly);
+}
+
+// ECMA 15.8
+
+bool MathObject::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot &slot)
+{
+ return getStaticFunctionSlot<JSObject>(exec, ExecState::mathTable(exec), this, propertyName, slot);
+}
+
+bool MathObject::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
+{
+ return getStaticFunctionDescriptor<JSObject>(exec, ExecState::mathTable(exec), this, propertyName, descriptor);
+}
+
+// ------------------------------ Functions --------------------------------
+
+EncodedJSValue JSC_HOST_CALL mathProtoFuncAbs(ExecState* exec)
+{
+ return JSValue::encode(jsNumber(fabs(exec->argument(0).toNumber(exec))));
+}
+
+EncodedJSValue JSC_HOST_CALL mathProtoFuncACos(ExecState* exec)
+{
+ return JSValue::encode(jsDoubleNumber(acos(exec->argument(0).toNumber(exec))));
+}
+
+EncodedJSValue JSC_HOST_CALL mathProtoFuncASin(ExecState* exec)
+{
+ return JSValue::encode(jsDoubleNumber(asin(exec->argument(0).toNumber(exec))));
+}
+
+EncodedJSValue JSC_HOST_CALL mathProtoFuncATan(ExecState* exec)
+{
+ return JSValue::encode(jsDoubleNumber(atan(exec->argument(0).toNumber(exec))));
+}
+
+EncodedJSValue JSC_HOST_CALL mathProtoFuncATan2(ExecState* exec)
+{
+ double arg0 = exec->argument(0).toNumber(exec);
+ double arg1 = exec->argument(1).toNumber(exec);
+ return JSValue::encode(jsDoubleNumber(atan2(arg0, arg1)));
+}
+
+EncodedJSValue JSC_HOST_CALL mathProtoFuncCeil(ExecState* exec)
+{
+ return JSValue::encode(jsNumber(ceil(exec->argument(0).toNumber(exec))));
+}
+
+EncodedJSValue JSC_HOST_CALL mathProtoFuncCos(ExecState* exec)
+{
+ return JSValue::encode(jsDoubleNumber(cos(exec->argument(0).toNumber(exec))));
+}
+
+EncodedJSValue JSC_HOST_CALL mathProtoFuncExp(ExecState* exec)
+{
+ return JSValue::encode(jsDoubleNumber(exp(exec->argument(0).toNumber(exec))));
+}
+
+EncodedJSValue JSC_HOST_CALL mathProtoFuncFloor(ExecState* exec)
+{
+ return JSValue::encode(jsNumber(floor(exec->argument(0).toNumber(exec))));
+}
+
+EncodedJSValue JSC_HOST_CALL mathProtoFuncLog(ExecState* exec)
+{
+ return JSValue::encode(jsDoubleNumber(log(exec->argument(0).toNumber(exec))));
+}
+
+EncodedJSValue JSC_HOST_CALL mathProtoFuncMax(ExecState* exec)
+{
+ unsigned argsCount = exec->argumentCount();
+ double result = -Inf;
+ for (unsigned k = 0; k < argsCount; ++k) {
+ double val = exec->argument(k).toNumber(exec);
+ if (isnan(val)) {
+ result = NaN;
+ break;
+ }
+ if (val > result || (val == 0 && result == 0 && !signbit(val)))
+ result = val;
+ }
+ return JSValue::encode(jsNumber(result));
+}
+
+EncodedJSValue JSC_HOST_CALL mathProtoFuncMin(ExecState* exec)
+{
+ unsigned argsCount = exec->argumentCount();
+ double result = +Inf;
+ for (unsigned k = 0; k < argsCount; ++k) {
+ double val = exec->argument(k).toNumber(exec);
+ if (isnan(val)) {
+ result = NaN;
+ break;
+ }
+ if (val < result || (val == 0 && result == 0 && signbit(val)))
+ result = val;
+ }
+ return JSValue::encode(jsNumber(result));
+}
+
+EncodedJSValue JSC_HOST_CALL mathProtoFuncPow(ExecState* exec)
+{
+ // ECMA 15.8.2.1.13
+
+ double arg = exec->argument(0).toNumber(exec);
+ double arg2 = exec->argument(1).toNumber(exec);
+
+ if (isnan(arg2))
+ return JSValue::encode(jsNaN());
+ if (isinf(arg2) && fabs(arg) == 1)
+ return JSValue::encode(jsNaN());
+ return JSValue::encode(jsNumber(pow(arg, arg2)));
+}
+
+EncodedJSValue JSC_HOST_CALL mathProtoFuncRandom(ExecState* exec)
+{
+ return JSValue::encode(jsDoubleNumber(exec->lexicalGlobalObject()->weakRandomNumber()));
+}
+
+EncodedJSValue JSC_HOST_CALL mathProtoFuncRound(ExecState* exec)
+{
+ double arg = exec->argument(0).toNumber(exec);
+ double integer = ceil(arg);
+ return JSValue::encode(jsNumber(integer - (integer - arg > 0.5)));
+}
+
+EncodedJSValue JSC_HOST_CALL mathProtoFuncSin(ExecState* exec)
+{
+ return JSValue::encode(exec->globalData().cachedSin(exec->argument(0).toNumber(exec)));
+}
+
+EncodedJSValue JSC_HOST_CALL mathProtoFuncSqrt(ExecState* exec)
+{
+ return JSValue::encode(jsDoubleNumber(sqrt(exec->argument(0).toNumber(exec))));
+}
+
+EncodedJSValue JSC_HOST_CALL mathProtoFuncTan(ExecState* exec)
+{
+ return JSValue::encode(jsDoubleNumber(tan(exec->argument(0).toNumber(exec))));
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/MathObject.h b/Source/JavaScriptCore/runtime/MathObject.h
new file mode 100644
index 0000000..31fa2fe
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/MathObject.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifndef MathObject_h
+#define MathObject_h
+
+#include "JSObjectWithGlobalObject.h"
+
+namespace JSC {
+
+ class MathObject : public JSObjectWithGlobalObject {
+ public:
+ MathObject(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure>);
+
+ virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
+ virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
+
+ virtual const ClassInfo* classInfo() const { return &info; }
+ static const ClassInfo info;
+
+ static PassRefPtr<Structure> createStructure(JSValue prototype)
+ {
+ return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount);
+ }
+
+ protected:
+ static const unsigned StructureFlags = OverridesGetOwnPropertySlot | JSObject::StructureFlags;
+ };
+
+} // namespace JSC
+
+#endif // MathObject_h
diff --git a/Source/JavaScriptCore/runtime/MemoryStatistics.cpp b/Source/JavaScriptCore/runtime/MemoryStatistics.cpp
new file mode 100644
index 0000000..7fafa9c
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/MemoryStatistics.cpp
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "MemoryStatistics.h"
+
+#include "ExecutableAllocator.h"
+#include "JSGlobalData.h"
+#include "RegisterFile.h"
+
+namespace JSC {
+
+Heap::Statistics heapStatistics(JSGlobalData* commonGlobalData)
+{
+ return commonGlobalData->heap.statistics();
+}
+
+GlobalMemoryStatistics globalMemoryStatistics()
+{
+ GlobalMemoryStatistics stats;
+
+ stats.stackBytes = RegisterFile::committedByteCount();
+#if ENABLE(EXECUTABLE_ALLOCATOR_FIXED)
+ stats.JITBytes = ExecutableAllocator::committedByteCount();
+#else
+ stats.JITBytes = 0;
+#endif
+ return stats;
+}
+
+}
+
+
diff --git a/Source/JavaScriptCore/runtime/MemoryStatistics.h b/Source/JavaScriptCore/runtime/MemoryStatistics.h
new file mode 100644
index 0000000..1b92eb9
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/MemoryStatistics.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef MemoryStatistics_h
+#define MemoryStatistics_h
+
+#include "Collector.h"
+
+class JSGlobalData;
+
+namespace JSC {
+
+struct GlobalMemoryStatistics {
+ size_t stackBytes;
+ size_t JITBytes;
+};
+
+Heap::Statistics heapStatistics(JSGlobalData* commonGlobalData);
+GlobalMemoryStatistics globalMemoryStatistics();
+
+}
+
+#endif // MemoryStatistics_h
+
diff --git a/Source/JavaScriptCore/runtime/NativeErrorConstructor.cpp b/Source/JavaScriptCore/runtime/NativeErrorConstructor.cpp
new file mode 100644
index 0000000..eb508eb
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/NativeErrorConstructor.cpp
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
+ * Copyright (C) 2003, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#include "config.h"
+#include "NativeErrorConstructor.h"
+
+#include "ErrorInstance.h"
+#include "JSFunction.h"
+#include "JSString.h"
+#include "NativeErrorPrototype.h"
+
+namespace JSC {
+
+ASSERT_CLASS_FITS_IN_CELL(NativeErrorConstructor);
+
+const ClassInfo NativeErrorConstructor::info = { "Function", &InternalFunction::info, 0, 0 };
+
+NativeErrorConstructor::NativeErrorConstructor(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, NonNullPassRefPtr<Structure> prototypeStructure, const UString& nameAndMessage)
+ : InternalFunction(&exec->globalData(), globalObject, structure, Identifier(exec, nameAndMessage))
+{
+ NativeErrorPrototype* prototype = new (exec) NativeErrorPrototype(exec, globalObject, prototypeStructure, nameAndMessage, this);
+
+ putDirect(exec->propertyNames().length, jsNumber(1), DontDelete | ReadOnly | DontEnum); // ECMA 15.11.7.5
+ putDirect(exec->propertyNames().prototype, prototype, DontDelete | ReadOnly | DontEnum);
+ m_errorStructure = ErrorInstance::createStructure(prototype);
+}
+
+static EncodedJSValue JSC_HOST_CALL constructWithNativeErrorConstructor(ExecState* exec)
+{
+ JSValue message = exec->argumentCount() ? exec->argument(0) : jsUndefined();
+ Structure* errorStructure = static_cast<NativeErrorConstructor*>(exec->callee())->errorStructure();
+ return JSValue::encode(ErrorInstance::create(exec, errorStructure, message));
+}
+
+ConstructType NativeErrorConstructor::getConstructData(ConstructData& constructData)
+{
+ constructData.native.function = constructWithNativeErrorConstructor;
+ return ConstructTypeHost;
+}
+
+static EncodedJSValue JSC_HOST_CALL callNativeErrorConstructor(ExecState* exec)
+{
+ JSValue message = exec->argumentCount() ? exec->argument(0) : jsUndefined();
+ Structure* errorStructure = static_cast<NativeErrorConstructor*>(exec->callee())->errorStructure();
+ return JSValue::encode(ErrorInstance::create(exec, errorStructure, message));
+}
+
+CallType NativeErrorConstructor::getCallData(CallData& callData)
+{
+ callData.native.function = callNativeErrorConstructor;
+ return CallTypeHost;
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/NativeErrorConstructor.h b/Source/JavaScriptCore/runtime/NativeErrorConstructor.h
new file mode 100644
index 0000000..1ff8207
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/NativeErrorConstructor.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifndef NativeErrorConstructor_h
+#define NativeErrorConstructor_h
+
+#include "InternalFunction.h"
+
+namespace JSC {
+
+ class ErrorInstance;
+ class FunctionPrototype;
+ class NativeErrorPrototype;
+
+ class NativeErrorConstructor : public InternalFunction {
+ public:
+ NativeErrorConstructor(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure> structure, NonNullPassRefPtr<Structure> prototypeStructure, const UString&);
+
+ static const ClassInfo info;
+
+ Structure* errorStructure() { return m_errorStructure.get(); }
+
+ private:
+ virtual ConstructType getConstructData(ConstructData&);
+ virtual CallType getCallData(CallData&);
+
+ virtual const ClassInfo* classInfo() const { return &info; }
+
+ RefPtr<Structure> m_errorStructure;
+ };
+
+} // namespace JSC
+
+#endif // NativeErrorConstructor_h
diff --git a/Source/JavaScriptCore/runtime/NativeErrorPrototype.cpp b/Source/JavaScriptCore/runtime/NativeErrorPrototype.cpp
new file mode 100644
index 0000000..540220a
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/NativeErrorPrototype.cpp
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
+ * Copyright (C) 2003, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#include "config.h"
+#include "NativeErrorPrototype.h"
+
+#include "ErrorPrototype.h"
+#include "JSGlobalObject.h"
+#include "JSString.h"
+#include "NativeErrorConstructor.h"
+#include "UString.h"
+
+namespace JSC {
+
+ASSERT_CLASS_FITS_IN_CELL(NativeErrorPrototype);
+
+NativeErrorPrototype::NativeErrorPrototype(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, const UString& nameAndMessage, NativeErrorConstructor* constructor)
+ : JSObjectWithGlobalObject(globalObject, structure)
+{
+ putDirect(exec->propertyNames().name, jsString(exec, nameAndMessage), 0);
+ putDirect(exec->propertyNames().message, jsString(exec, nameAndMessage), 0);
+ putDirect(exec->propertyNames().constructor, constructor, DontEnum);
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/NativeErrorPrototype.h b/Source/JavaScriptCore/runtime/NativeErrorPrototype.h
new file mode 100644
index 0000000..30690d5
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/NativeErrorPrototype.h
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifndef NativeErrorPrototype_h
+#define NativeErrorPrototype_h
+
+#include "JSObjectWithGlobalObject.h"
+
+namespace JSC {
+ class NativeErrorConstructor;
+
+ class NativeErrorPrototype : public JSObjectWithGlobalObject {
+ public:
+ NativeErrorPrototype(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure>, const UString&, NativeErrorConstructor*);
+ };
+
+} // namespace JSC
+
+#endif // NativeErrorPrototype_h
diff --git a/Source/JavaScriptCore/runtime/NativeFunctionWrapper.h b/Source/JavaScriptCore/runtime/NativeFunctionWrapper.h
new file mode 100644
index 0000000..d4eeb3b
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/NativeFunctionWrapper.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef NativeFunctionWrapper_h
+#define NativeFunctionWrapper_h
+
+namespace JSC {
+#if ENABLE(JIT) && ENABLE(JIT_OPTIMIZE_NATIVE_CALL)
+ class JSFunction;
+ typedef JSFunction NativeFunctionWrapper;
+#else
+ class PrototypeFunction;
+ typedef PrototypeFunction NativeFunctionWrapper;
+#endif
+}
+
+#endif
diff --git a/Source/JavaScriptCore/runtime/NumberConstructor.cpp b/Source/JavaScriptCore/runtime/NumberConstructor.cpp
new file mode 100644
index 0000000..5369ca0
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/NumberConstructor.cpp
@@ -0,0 +1,129 @@
+/*
+ * Copyright (C) 1999-2000,2003 Harri Porten (porten@kde.org)
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ */
+
+#include "config.h"
+#include "NumberConstructor.h"
+
+#include "Lookup.h"
+#include "NumberObject.h"
+#include "NumberPrototype.h"
+
+namespace JSC {
+
+ASSERT_CLASS_FITS_IN_CELL(NumberConstructor);
+
+static JSValue numberConstructorNaNValue(ExecState*, JSValue, const Identifier&);
+static JSValue numberConstructorNegInfinity(ExecState*, JSValue, const Identifier&);
+static JSValue numberConstructorPosInfinity(ExecState*, JSValue, const Identifier&);
+static JSValue numberConstructorMaxValue(ExecState*, JSValue, const Identifier&);
+static JSValue numberConstructorMinValue(ExecState*, JSValue, const Identifier&);
+
+} // namespace JSC
+
+#include "NumberConstructor.lut.h"
+
+namespace JSC {
+
+const ClassInfo NumberConstructor::info = { "Function", &InternalFunction::info, 0, ExecState::numberTable };
+
+/* Source for NumberConstructor.lut.h
+@begin numberTable
+ NaN numberConstructorNaNValue DontEnum|DontDelete|ReadOnly
+ NEGATIVE_INFINITY numberConstructorNegInfinity DontEnum|DontDelete|ReadOnly
+ POSITIVE_INFINITY numberConstructorPosInfinity DontEnum|DontDelete|ReadOnly
+ MAX_VALUE numberConstructorMaxValue DontEnum|DontDelete|ReadOnly
+ MIN_VALUE numberConstructorMinValue DontEnum|DontDelete|ReadOnly
+@end
+*/
+
+NumberConstructor::NumberConstructor(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, NumberPrototype* numberPrototype)
+ : InternalFunction(&exec->globalData(), globalObject, structure, Identifier(exec, numberPrototype->info.className))
+{
+ // Number.Prototype
+ putDirectWithoutTransition(exec->propertyNames().prototype, numberPrototype, DontEnum | DontDelete | ReadOnly);
+
+ // no. of arguments for constructor
+ putDirectWithoutTransition(exec->propertyNames().length, jsNumber(1), ReadOnly | DontEnum | DontDelete);
+}
+
+bool NumberConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
+{
+ return getStaticValueSlot<NumberConstructor, InternalFunction>(exec, ExecState::numberTable(exec), this, propertyName, slot);
+}
+
+bool NumberConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
+{
+ return getStaticValueDescriptor<NumberConstructor, InternalFunction>(exec, ExecState::numberTable(exec), this, propertyName, descriptor);
+}
+
+static JSValue numberConstructorNaNValue(ExecState*, JSValue, const Identifier&)
+{
+ return jsNaN();
+}
+
+static JSValue numberConstructorNegInfinity(ExecState*, JSValue, const Identifier&)
+{
+ return jsNumber(-Inf);
+}
+
+static JSValue numberConstructorPosInfinity(ExecState*, JSValue, const Identifier&)
+{
+ return jsNumber(Inf);
+}
+
+static JSValue numberConstructorMaxValue(ExecState*, JSValue, const Identifier&)
+{
+ return jsNumber(1.7976931348623157E+308);
+}
+
+static JSValue numberConstructorMinValue(ExecState*, JSValue, const Identifier&)
+{
+ return jsNumber(5E-324);
+}
+
+// ECMA 15.7.1
+static EncodedJSValue JSC_HOST_CALL constructWithNumberConstructor(ExecState* exec)
+{
+ NumberObject* object = new (exec) NumberObject(exec->lexicalGlobalObject()->numberObjectStructure());
+ double n = exec->argumentCount() ? exec->argument(0).toNumber(exec) : 0;
+ object->setInternalValue(jsNumber(n));
+ return JSValue::encode(object);
+}
+
+ConstructType NumberConstructor::getConstructData(ConstructData& constructData)
+{
+ constructData.native.function = constructWithNumberConstructor;
+ return ConstructTypeHost;
+}
+
+// ECMA 15.7.2
+static EncodedJSValue JSC_HOST_CALL callNumberConstructor(ExecState* exec)
+{
+ return JSValue::encode(jsNumber(!exec->argumentCount() ? 0 : exec->argument(0).toNumber(exec)));
+}
+
+CallType NumberConstructor::getCallData(CallData& callData)
+{
+ callData.native.function = callNumberConstructor;
+ return CallTypeHost;
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/NumberConstructor.h b/Source/JavaScriptCore/runtime/NumberConstructor.h
new file mode 100644
index 0000000..d8a2593
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/NumberConstructor.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifndef NumberConstructor_h
+#define NumberConstructor_h
+
+#include "InternalFunction.h"
+
+namespace JSC {
+
+ class NumberPrototype;
+
+ class NumberConstructor : public InternalFunction {
+ public:
+ NumberConstructor(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure>, NumberPrototype*);
+
+ virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
+ virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
+ JSValue getValueProperty(ExecState*, int token) const;
+
+ static const ClassInfo info;
+
+ static PassRefPtr<Structure> createStructure(JSValue proto)
+ {
+ return Structure::create(proto, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount);
+ }
+
+ enum { NaNValue, NegInfinity, PosInfinity, MaxValue, MinValue };
+
+ protected:
+ static const unsigned StructureFlags = OverridesGetOwnPropertySlot | ImplementsHasInstance | InternalFunction::StructureFlags;
+
+ private:
+ virtual ConstructType getConstructData(ConstructData&);
+ virtual CallType getCallData(CallData&);
+
+ virtual const ClassInfo* classInfo() const { return &info; }
+ };
+
+} // namespace JSC
+
+#endif // NumberConstructor_h
diff --git a/Source/JavaScriptCore/runtime/NumberObject.cpp b/Source/JavaScriptCore/runtime/NumberObject.cpp
new file mode 100644
index 0000000..1a7e44c
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/NumberObject.cpp
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 1999-2000,2003 Harri Porten (porten@kde.org)
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ */
+
+#include "config.h"
+#include "NumberObject.h"
+
+#include "JSGlobalObject.h"
+#include "NumberPrototype.h"
+
+namespace JSC {
+
+ASSERT_CLASS_FITS_IN_CELL(NumberObject);
+
+const ClassInfo NumberObject::info = { "Number", 0, 0, 0 };
+
+NumberObject::NumberObject(NonNullPassRefPtr<Structure> structure)
+ : JSWrapperObject(structure)
+{
+}
+
+JSValue NumberObject::getJSNumber()
+{
+ return internalValue();
+}
+
+NumberObject* constructNumber(ExecState* exec, JSValue number)
+{
+ NumberObject* object = new (exec) NumberObject(exec->lexicalGlobalObject()->numberObjectStructure());
+ object->setInternalValue(number);
+ return object;
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/NumberObject.h b/Source/JavaScriptCore/runtime/NumberObject.h
new file mode 100644
index 0000000..e82b593
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/NumberObject.h
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifndef NumberObject_h
+#define NumberObject_h
+
+#include "JSWrapperObject.h"
+
+namespace JSC {
+
+ class NumberObject : public JSWrapperObject {
+ public:
+ explicit NumberObject(NonNullPassRefPtr<Structure>);
+
+ static const ClassInfo info;
+
+ static PassRefPtr<Structure> createStructure(JSValue prototype)
+ {
+ return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount);
+ }
+
+ protected:
+ static const unsigned StructureFlags = JSWrapperObject::StructureFlags;
+
+ private:
+ virtual const ClassInfo* classInfo() const { return &info; }
+
+ virtual JSValue getJSNumber();
+ };
+
+ NumberObject* constructNumber(ExecState*, JSValue);
+
+} // namespace JSC
+
+#endif // NumberObject_h
diff --git a/Source/JavaScriptCore/runtime/NumberPrototype.cpp b/Source/JavaScriptCore/runtime/NumberPrototype.cpp
new file mode 100644
index 0000000..0b86c00
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/NumberPrototype.cpp
@@ -0,0 +1,310 @@
+/*
+ * Copyright (C) 1999-2000,2003 Harri Porten (porten@kde.org)
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ */
+
+#include "config.h"
+#include "NumberPrototype.h"
+
+#include "Error.h"
+#include "JSFunction.h"
+#include "JSString.h"
+#include "Operations.h"
+#include "PrototypeFunction.h"
+#include "dtoa.h"
+#include <wtf/Assertions.h>
+#include <wtf/DecimalNumber.h>
+#include <wtf/MathExtras.h>
+#include <wtf/Vector.h>
+
+namespace JSC {
+
+ASSERT_CLASS_FITS_IN_CELL(NumberPrototype);
+
+static EncodedJSValue JSC_HOST_CALL numberProtoFuncToString(ExecState*);
+static EncodedJSValue JSC_HOST_CALL numberProtoFuncToLocaleString(ExecState*);
+static EncodedJSValue JSC_HOST_CALL numberProtoFuncValueOf(ExecState*);
+static EncodedJSValue JSC_HOST_CALL numberProtoFuncToFixed(ExecState*);
+static EncodedJSValue JSC_HOST_CALL numberProtoFuncToExponential(ExecState*);
+static EncodedJSValue JSC_HOST_CALL numberProtoFuncToPrecision(ExecState*);
+
+// ECMA 15.7.4
+
+NumberPrototype::NumberPrototype(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, Structure* prototypeFunctionStructure)
+ : NumberObject(structure)
+{
+ setInternalValue(jsNumber(0));
+
+ // The constructor will be added later, after NumberConstructor has been constructed
+
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 1, exec->propertyNames().toString, numberProtoFuncToString), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 0, exec->propertyNames().toLocaleString, numberProtoFuncToLocaleString), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 0, exec->propertyNames().valueOf, numberProtoFuncValueOf), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 1, exec->propertyNames().toFixed, numberProtoFuncToFixed), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 1, exec->propertyNames().toExponential, numberProtoFuncToExponential), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 1, exec->propertyNames().toPrecision, numberProtoFuncToPrecision), DontEnum);
+}
+
+// ------------------------------ Functions ---------------------------
+
+// ECMA 15.7.4.2 - 15.7.4.7
+
+static ALWAYS_INLINE bool toThisNumber(JSValue thisValue, double &x)
+{
+ JSValue v = thisValue.getJSNumber();
+ if (UNLIKELY(!v))
+ return false;
+ x = v.uncheckedGetNumber();
+ return true;
+}
+
+static ALWAYS_INLINE bool getIntegerArgumentInRange(ExecState* exec, int low, int high, int& result, bool& isUndefined)
+{
+ result = 0;
+ isUndefined = false;
+
+ JSValue argument0 = exec->argument(0);
+ if (argument0.isUndefined()) {
+ isUndefined = true;
+ return true;
+ }
+
+ double asDouble = argument0.toInteger(exec);
+ if (asDouble < low || asDouble > high)
+ return false;
+
+ result = static_cast<int>(asDouble);
+ return true;
+}
+
+// toExponential converts a number to a string, always formatting as an expoential.
+// This method takes an optional argument specifying a number of *decimal places*
+// to round the significand to (or, put another way, this method optionally rounds
+// to argument-plus-one significant figures).
+EncodedJSValue JSC_HOST_CALL numberProtoFuncToExponential(ExecState* exec)
+{
+ // Get x (the double value of this, which should be a Number).
+ double x;
+ if (!toThisNumber(exec->hostThisValue(), x))
+ return throwVMTypeError(exec);
+
+ // Get the argument.
+ int decimalPlacesInExponent;
+ bool isUndefined;
+ if (!getIntegerArgumentInRange(exec, 0, 20, decimalPlacesInExponent, isUndefined))
+ return throwVMError(exec, createRangeError(exec, "toExponential() argument must be between 0 and 20"));
+
+ // Handle NaN and Infinity.
+ if (isnan(x) || isinf(x))
+ return JSValue::encode(jsString(exec, UString::number(x)));
+
+ // Round if the argument is not undefined, always format as exponential.
+ NumberToStringBuffer buffer;
+ unsigned length = isUndefined
+ ? DecimalNumber(x).toStringExponential(buffer, WTF::NumberToStringBufferLength)
+ : DecimalNumber(x, RoundingSignificantFigures, decimalPlacesInExponent + 1).toStringExponential(buffer, WTF::NumberToStringBufferLength);
+
+ return JSValue::encode(jsString(exec, UString(buffer, length)));
+}
+
+// toFixed converts a number to a string, always formatting as an a decimal fraction.
+// This method takes an argument specifying a number of decimal places to round the
+// significand to. However when converting large values (1e+21 and above) this
+// method will instead fallback to calling ToString.
+EncodedJSValue JSC_HOST_CALL numberProtoFuncToFixed(ExecState* exec)
+{
+ // Get x (the double value of this, which should be a Number).
+ JSValue thisValue = exec->hostThisValue();
+ JSValue v = thisValue.getJSNumber();
+ if (!v)
+ return throwVMTypeError(exec);
+ double x = v.uncheckedGetNumber();
+
+ // Get the argument.
+ int decimalPlaces;
+ bool isUndefined; // This is ignored; undefined treated as 0.
+ if (!getIntegerArgumentInRange(exec, 0, 20, decimalPlaces, isUndefined))
+ return throwVMError(exec, createRangeError(exec, "toFixed() argument must be between 0 and 20"));
+
+ // 15.7.4.5.7 states "If x >= 10^21, then let m = ToString(x)"
+ // This also covers Ininity, and structure the check so that NaN
+ // values are also handled by numberToString
+ if (!(fabs(x) < 1e+21))
+ return JSValue::encode(jsString(exec, UString::number(x)));
+
+ // The check above will return false for NaN or Infinity, these will be
+ // handled by numberToString.
+ ASSERT(!isnan(x) && !isinf(x));
+
+ // Convert to decimal with rounding, and format as decimal.
+ NumberToStringBuffer buffer;
+ unsigned length = DecimalNumber(x, RoundingDecimalPlaces, decimalPlaces).toStringDecimal(buffer, WTF::NumberToStringBufferLength);
+ return JSValue::encode(jsString(exec, UString(buffer, length)));
+}
+
+// toPrecision converts a number to a string, takeing an argument specifying a
+// number of significant figures to round the significand to. For positive
+// exponent, all values that can be represented using a decimal fraction will
+// be, e.g. when rounding to 3 s.f. any value up to 999 will be formated as a
+// decimal, whilst 1000 is converted to the exponential representation 1.00e+3.
+// For negative exponents values >= 1e-6 are formated as decimal fractions,
+// with smaller values converted to exponential representation.
+EncodedJSValue JSC_HOST_CALL numberProtoFuncToPrecision(ExecState* exec)
+{
+ // Get x (the double value of this, which should be a Number).
+ JSValue thisValue = exec->hostThisValue();
+ JSValue v = thisValue.getJSNumber();
+ if (!v)
+ return throwVMTypeError(exec);
+ double x = v.uncheckedGetNumber();
+
+ // Get the argument.
+ int significantFigures;
+ bool isUndefined;
+ if (!getIntegerArgumentInRange(exec, 1, 21, significantFigures, isUndefined))
+ return throwVMError(exec, createRangeError(exec, "toPrecision() argument must be between 1 and 21"));
+
+ // To precision called with no argument is treated as ToString.
+ if (isUndefined)
+ return JSValue::encode(jsString(exec, UString::number(x)));
+
+ // Handle NaN and Infinity.
+ if (isnan(x) || isinf(x))
+ return JSValue::encode(jsString(exec, UString::number(x)));
+
+ // Convert to decimal with rounding.
+ DecimalNumber number(x, RoundingSignificantFigures, significantFigures);
+ // If number is in the range 1e-6 <= x < pow(10, significantFigures) then format
+ // as decimal. Otherwise, format the number as an exponential. Decimal format
+ // demands a minimum of (exponent + 1) digits to represent a number, for example
+ // 1234 (1.234e+3) requires 4 digits. (See ECMA-262 15.7.4.7.10.c)
+ NumberToStringBuffer buffer;
+ unsigned length = number.exponent() >= -6 && number.exponent() < significantFigures
+ ? number.toStringDecimal(buffer, WTF::NumberToStringBufferLength)
+ : number.toStringExponential(buffer, WTF::NumberToStringBufferLength);
+ return JSValue::encode(jsString(exec, UString(buffer, length)));
+}
+
+EncodedJSValue JSC_HOST_CALL numberProtoFuncToString(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ JSValue v = thisValue.getJSNumber();
+ if (!v)
+ return throwVMTypeError(exec);
+
+ JSValue radixValue = exec->argument(0);
+ int radix;
+ if (radixValue.isInt32())
+ radix = radixValue.asInt32();
+ else if (radixValue.isUndefined())
+ radix = 10;
+ else
+ radix = static_cast<int>(radixValue.toInteger(exec)); // nan -> 0
+
+ if (radix == 10)
+ return JSValue::encode(jsString(exec, v.toString(exec)));
+
+ static const char* const digits = "0123456789abcdefghijklmnopqrstuvwxyz";
+
+ // Fast path for number to character conversion.
+ if (radix == 36) {
+ if (v.isInt32()) {
+ int x = v.asInt32();
+ if (static_cast<unsigned>(x) < 36) { // Exclude negatives
+ JSGlobalData* globalData = &exec->globalData();
+ return JSValue::encode(globalData->smallStrings.singleCharacterString(globalData, digits[x]));
+ }
+ }
+ }
+
+ if (radix < 2 || radix > 36)
+ return throwVMError(exec, createRangeError(exec, "toString() radix argument must be between 2 and 36"));
+
+ // INT_MAX results in 1024 characters left of the dot with radix 2
+ // give the same space on the right side. safety checks are in place
+ // unless someone finds a precise rule.
+ char s[2048 + 3];
+ const char* lastCharInString = s + sizeof(s) - 1;
+ double x = v.uncheckedGetNumber();
+ if (isnan(x) || isinf(x))
+ return JSValue::encode(jsString(exec, UString::number(x)));
+
+ bool isNegative = x < 0.0;
+ if (isNegative)
+ x = -x;
+
+ double integerPart = floor(x);
+ char* decimalPoint = s + sizeof(s) / 2;
+
+ // convert integer portion
+ char* p = decimalPoint;
+ double d = integerPart;
+ do {
+ int remainderDigit = static_cast<int>(fmod(d, radix));
+ *--p = digits[remainderDigit];
+ d /= radix;
+ } while ((d <= -1.0 || d >= 1.0) && s < p);
+
+ if (isNegative)
+ *--p = '-';
+ char* startOfResultString = p;
+ ASSERT(s <= startOfResultString);
+
+ d = x - integerPart;
+ p = decimalPoint;
+ const double epsilon = 0.001; // TODO: guessed. base on radix ?
+ bool hasFractionalPart = (d < -epsilon || d > epsilon);
+ if (hasFractionalPart) {
+ *p++ = '.';
+ do {
+ d *= radix;
+ const int digit = static_cast<int>(d);
+ *p++ = digits[digit];
+ d -= digit;
+ } while ((d < -epsilon || d > epsilon) && p < lastCharInString);
+ }
+ *p = '\0';
+ ASSERT(p < s + sizeof(s));
+
+ return JSValue::encode(jsString(exec, startOfResultString));
+}
+
+EncodedJSValue JSC_HOST_CALL numberProtoFuncToLocaleString(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ // FIXME: Not implemented yet.
+
+ JSValue v = thisValue.getJSNumber();
+ if (!v)
+ return throwVMTypeError(exec);
+
+ return JSValue::encode(jsString(exec, v.toString(exec)));
+}
+
+EncodedJSValue JSC_HOST_CALL numberProtoFuncValueOf(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ JSValue v = thisValue.getJSNumber();
+ if (!v)
+ return throwVMTypeError(exec);
+
+ return JSValue::encode(v);
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/NumberPrototype.h b/Source/JavaScriptCore/runtime/NumberPrototype.h
new file mode 100644
index 0000000..78b690e
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/NumberPrototype.h
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifndef NumberPrototype_h
+#define NumberPrototype_h
+
+#include "NumberObject.h"
+
+namespace JSC {
+
+ class NumberPrototype : public NumberObject {
+ public:
+ NumberPrototype(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure>, Structure* prototypeFunctionStructure);
+ };
+
+} // namespace JSC
+
+#endif // NumberPrototype_h
diff --git a/Source/JavaScriptCore/runtime/NumericStrings.h b/Source/JavaScriptCore/runtime/NumericStrings.h
new file mode 100644
index 0000000..d65f142
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/NumericStrings.h
@@ -0,0 +1,98 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef NumericStrings_h
+#define NumericStrings_h
+
+#include "UString.h"
+#include <wtf/FixedArray.h>
+#include <wtf/HashFunctions.h>
+
+namespace JSC {
+
+ class NumericStrings {
+ public:
+ UString add(double d)
+ {
+ CacheEntry<double>& entry = lookup(d);
+ if (d == entry.key && !entry.value.isNull())
+ return entry.value;
+ entry.key = d;
+ entry.value = UString::number(d);
+ return entry.value;
+ }
+
+ UString add(int i)
+ {
+ if (static_cast<unsigned>(i) < cacheSize)
+ return lookupSmallString(static_cast<unsigned>(i));
+ CacheEntry<int>& entry = lookup(i);
+ if (i == entry.key && !entry.value.isNull())
+ return entry.value;
+ entry.key = i;
+ entry.value = UString::number(i);
+ return entry.value;
+ }
+
+ UString add(unsigned i)
+ {
+ if (i < cacheSize)
+ return lookupSmallString(static_cast<unsigned>(i));
+ CacheEntry<unsigned>& entry = lookup(i);
+ if (i == entry.key && !entry.value.isNull())
+ return entry.value;
+ entry.key = i;
+ entry.value = UString::number(i);
+ return entry.value;
+ }
+ private:
+ static const size_t cacheSize = 64;
+
+ template<typename T>
+ struct CacheEntry {
+ T key;
+ UString value;
+ };
+
+ CacheEntry<double>& lookup(double d) { return doubleCache[WTF::FloatHash<double>::hash(d) & (cacheSize - 1)]; }
+ CacheEntry<int>& lookup(int i) { return intCache[WTF::IntHash<int>::hash(i) & (cacheSize - 1)]; }
+ CacheEntry<unsigned>& lookup(unsigned i) { return unsignedCache[WTF::IntHash<unsigned>::hash(i) & (cacheSize - 1)]; }
+ const UString& lookupSmallString(unsigned i)
+ {
+ ASSERT(i < cacheSize);
+ if (smallIntCache[i].isNull())
+ smallIntCache[i] = UString::number(i);
+ return smallIntCache[i];
+ }
+
+ FixedArray<CacheEntry<double>, cacheSize> doubleCache;
+ FixedArray<CacheEntry<int>, cacheSize> intCache;
+ FixedArray<CacheEntry<unsigned>, cacheSize> unsignedCache;
+ FixedArray<UString, cacheSize> smallIntCache;
+ };
+
+} // namespace JSC
+
+#endif // NumericStrings_h
diff --git a/Source/JavaScriptCore/runtime/ObjectConstructor.cpp b/Source/JavaScriptCore/runtime/ObjectConstructor.cpp
new file mode 100644
index 0000000..ca3dcd7
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/ObjectConstructor.cpp
@@ -0,0 +1,320 @@
+/*
+ * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#include "config.h"
+#include "ObjectConstructor.h"
+
+#include "Error.h"
+#include "ExceptionHelpers.h"
+#include "JSFunction.h"
+#include "JSArray.h"
+#include "JSGlobalObject.h"
+#include "ObjectPrototype.h"
+#include "PropertyDescriptor.h"
+#include "PropertyNameArray.h"
+#include "PrototypeFunction.h"
+
+namespace JSC {
+
+ASSERT_CLASS_FITS_IN_CELL(ObjectConstructor);
+
+static EncodedJSValue JSC_HOST_CALL objectConstructorGetPrototypeOf(ExecState*);
+static EncodedJSValue JSC_HOST_CALL objectConstructorGetOwnPropertyDescriptor(ExecState*);
+static EncodedJSValue JSC_HOST_CALL objectConstructorGetOwnPropertyNames(ExecState*);
+static EncodedJSValue JSC_HOST_CALL objectConstructorKeys(ExecState*);
+static EncodedJSValue JSC_HOST_CALL objectConstructorDefineProperty(ExecState*);
+static EncodedJSValue JSC_HOST_CALL objectConstructorDefineProperties(ExecState*);
+static EncodedJSValue JSC_HOST_CALL objectConstructorCreate(ExecState*);
+
+ObjectConstructor::ObjectConstructor(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, ObjectPrototype* objectPrototype, Structure* prototypeFunctionStructure)
+: InternalFunction(&exec->globalData(), globalObject, structure, Identifier(exec, "Object"))
+{
+ // ECMA 15.2.3.1
+ putDirectWithoutTransition(exec->propertyNames().prototype, objectPrototype, DontEnum | DontDelete | ReadOnly);
+
+ // no. of arguments for constructor
+ putDirectWithoutTransition(exec->propertyNames().length, jsNumber(1), ReadOnly | DontEnum | DontDelete);
+
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 1, exec->propertyNames().getPrototypeOf, objectConstructorGetPrototypeOf), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 2, exec->propertyNames().getOwnPropertyDescriptor, objectConstructorGetOwnPropertyDescriptor), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 1, exec->propertyNames().getOwnPropertyNames, objectConstructorGetOwnPropertyNames), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 1, exec->propertyNames().keys, objectConstructorKeys), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 3, exec->propertyNames().defineProperty, objectConstructorDefineProperty), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 2, exec->propertyNames().defineProperties, objectConstructorDefineProperties), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 2, exec->propertyNames().create, objectConstructorCreate), DontEnum);
+}
+
+// ECMA 15.2.2
+static ALWAYS_INLINE JSObject* constructObject(ExecState* exec, const ArgList& args)
+{
+ JSValue arg = args.at(0);
+ if (arg.isUndefinedOrNull())
+ return new (exec) JSObject(exec->lexicalGlobalObject()->emptyObjectStructure());
+ return arg.toObject(exec);
+}
+
+static EncodedJSValue JSC_HOST_CALL constructWithObjectConstructor(ExecState* exec)
+{
+ ArgList args(exec);
+ return JSValue::encode(constructObject(exec, args));
+}
+
+ConstructType ObjectConstructor::getConstructData(ConstructData& constructData)
+{
+ constructData.native.function = constructWithObjectConstructor;
+ return ConstructTypeHost;
+}
+
+static EncodedJSValue JSC_HOST_CALL callObjectConstructor(ExecState* exec)
+{
+ ArgList args(exec);
+ return JSValue::encode(constructObject(exec, args));
+}
+
+CallType ObjectConstructor::getCallData(CallData& callData)
+{
+ callData.native.function = callObjectConstructor;
+ return CallTypeHost;
+}
+
+EncodedJSValue JSC_HOST_CALL objectConstructorGetPrototypeOf(ExecState* exec)
+{
+ if (!exec->argument(0).isObject())
+ return throwVMError(exec, createTypeError(exec, "Requested prototype of a value that is not an object."));
+ return JSValue::encode(asObject(exec->argument(0))->prototype());
+}
+
+EncodedJSValue JSC_HOST_CALL objectConstructorGetOwnPropertyDescriptor(ExecState* exec)
+{
+ if (!exec->argument(0).isObject())
+ return throwVMError(exec, createTypeError(exec, "Requested property descriptor of a value that is not an object."));
+ UString propertyName = exec->argument(1).toString(exec);
+ if (exec->hadException())
+ return JSValue::encode(jsNull());
+ JSObject* object = asObject(exec->argument(0));
+ PropertyDescriptor descriptor;
+ if (!object->getOwnPropertyDescriptor(exec, Identifier(exec, propertyName), descriptor))
+ return JSValue::encode(jsUndefined());
+ if (exec->hadException())
+ return JSValue::encode(jsUndefined());
+
+ JSObject* description = constructEmptyObject(exec);
+ if (!descriptor.isAccessorDescriptor()) {
+ description->putDirect(exec->propertyNames().value, descriptor.value() ? descriptor.value() : jsUndefined(), 0);
+ description->putDirect(exec->propertyNames().writable, jsBoolean(descriptor.writable()), 0);
+ } else {
+ description->putDirect(exec->propertyNames().get, descriptor.getter() ? descriptor.getter() : jsUndefined(), 0);
+ description->putDirect(exec->propertyNames().set, descriptor.setter() ? descriptor.setter() : jsUndefined(), 0);
+ }
+
+ description->putDirect(exec->propertyNames().enumerable, jsBoolean(descriptor.enumerable()), 0);
+ description->putDirect(exec->propertyNames().configurable, jsBoolean(descriptor.configurable()), 0);
+
+ return JSValue::encode(description);
+}
+
+// FIXME: Use the enumeration cache.
+EncodedJSValue JSC_HOST_CALL objectConstructorGetOwnPropertyNames(ExecState* exec)
+{
+ if (!exec->argument(0).isObject())
+ return throwVMError(exec, createTypeError(exec, "Requested property names of a value that is not an object."));
+ PropertyNameArray properties(exec);
+ asObject(exec->argument(0))->getOwnPropertyNames(exec, properties, IncludeDontEnumProperties);
+ JSArray* names = constructEmptyArray(exec);
+ size_t numProperties = properties.size();
+ for (size_t i = 0; i < numProperties; i++)
+ names->push(exec, jsOwnedString(exec, properties[i].ustring()));
+ return JSValue::encode(names);
+}
+
+// FIXME: Use the enumeration cache.
+EncodedJSValue JSC_HOST_CALL objectConstructorKeys(ExecState* exec)
+{
+ if (!exec->argument(0).isObject())
+ return throwVMError(exec, createTypeError(exec, "Requested keys of a value that is not an object."));
+ PropertyNameArray properties(exec);
+ asObject(exec->argument(0))->getOwnPropertyNames(exec, properties);
+ JSArray* keys = constructEmptyArray(exec);
+ size_t numProperties = properties.size();
+ for (size_t i = 0; i < numProperties; i++)
+ keys->push(exec, jsOwnedString(exec, properties[i].ustring()));
+ return JSValue::encode(keys);
+}
+
+// ES5 8.10.5 ToPropertyDescriptor
+static bool toPropertyDescriptor(ExecState* exec, JSValue in, PropertyDescriptor& desc)
+{
+ if (!in.isObject()) {
+ throwError(exec, createTypeError(exec, "Property description must be an object."));
+ return false;
+ }
+ JSObject* description = asObject(in);
+
+ PropertySlot enumerableSlot(description);
+ if (description->getPropertySlot(exec, exec->propertyNames().enumerable, enumerableSlot)) {
+ desc.setEnumerable(enumerableSlot.getValue(exec, exec->propertyNames().enumerable).toBoolean(exec));
+ if (exec->hadException())
+ return false;
+ }
+
+ PropertySlot configurableSlot(description);
+ if (description->getPropertySlot(exec, exec->propertyNames().configurable, configurableSlot)) {
+ desc.setConfigurable(configurableSlot.getValue(exec, exec->propertyNames().configurable).toBoolean(exec));
+ if (exec->hadException())
+ return false;
+ }
+
+ JSValue value;
+ PropertySlot valueSlot(description);
+ if (description->getPropertySlot(exec, exec->propertyNames().value, valueSlot)) {
+ desc.setValue(valueSlot.getValue(exec, exec->propertyNames().value));
+ if (exec->hadException())
+ return false;
+ }
+
+ PropertySlot writableSlot(description);
+ if (description->getPropertySlot(exec, exec->propertyNames().writable, writableSlot)) {
+ desc.setWritable(writableSlot.getValue(exec, exec->propertyNames().writable).toBoolean(exec));
+ if (exec->hadException())
+ return false;
+ }
+
+ PropertySlot getSlot(description);
+ if (description->getPropertySlot(exec, exec->propertyNames().get, getSlot)) {
+ JSValue get = getSlot.getValue(exec, exec->propertyNames().get);
+ if (exec->hadException())
+ return false;
+ if (!get.isUndefined()) {
+ CallData callData;
+ if (getCallData(get, callData) == CallTypeNone) {
+ throwError(exec, createTypeError(exec, "Getter must be a function."));
+ return false;
+ }
+ } else
+ get = JSValue();
+ desc.setGetter(get);
+ }
+
+ PropertySlot setSlot(description);
+ if (description->getPropertySlot(exec, exec->propertyNames().set, setSlot)) {
+ JSValue set = setSlot.getValue(exec, exec->propertyNames().set);
+ if (exec->hadException())
+ return false;
+ if (!set.isUndefined()) {
+ CallData callData;
+ if (getCallData(set, callData) == CallTypeNone) {
+ throwError(exec, createTypeError(exec, "Setter must be a function."));
+ return false;
+ }
+ } else
+ set = JSValue();
+
+ desc.setSetter(set);
+ }
+
+ if (!desc.isAccessorDescriptor())
+ return true;
+
+ if (desc.value()) {
+ throwError(exec, createTypeError(exec, "Invalid property. 'value' present on property with getter or setter."));
+ return false;
+ }
+
+ if (desc.writablePresent()) {
+ throwError(exec, createTypeError(exec, "Invalid property. 'writable' present on property with getter or setter."));
+ return false;
+ }
+ return true;
+}
+
+EncodedJSValue JSC_HOST_CALL objectConstructorDefineProperty(ExecState* exec)
+{
+ if (!exec->argument(0).isObject())
+ return throwVMError(exec, createTypeError(exec, "Properties can only be defined on Objects."));
+ JSObject* O = asObject(exec->argument(0));
+ UString propertyName = exec->argument(1).toString(exec);
+ if (exec->hadException())
+ return JSValue::encode(jsNull());
+ PropertyDescriptor descriptor;
+ if (!toPropertyDescriptor(exec, exec->argument(2), descriptor))
+ return JSValue::encode(jsNull());
+ ASSERT((descriptor.attributes() & (Getter | Setter)) || (!descriptor.isAccessorDescriptor()));
+ ASSERT(!exec->hadException());
+ O->defineOwnProperty(exec, Identifier(exec, propertyName), descriptor, true);
+ return JSValue::encode(O);
+}
+
+static JSValue defineProperties(ExecState* exec, JSObject* object, JSObject* properties)
+{
+ PropertyNameArray propertyNames(exec);
+ asObject(properties)->getOwnPropertyNames(exec, propertyNames);
+ size_t numProperties = propertyNames.size();
+ Vector<PropertyDescriptor> descriptors;
+ MarkedArgumentBuffer markBuffer;
+ for (size_t i = 0; i < numProperties; i++) {
+ PropertySlot slot;
+ JSValue prop = properties->get(exec, propertyNames[i]);
+ if (exec->hadException())
+ return jsNull();
+ PropertyDescriptor descriptor;
+ if (!toPropertyDescriptor(exec, prop, descriptor))
+ return jsNull();
+ descriptors.append(descriptor);
+ // Ensure we mark all the values that we're accumulating
+ if (descriptor.isDataDescriptor() && descriptor.value())
+ markBuffer.append(descriptor.value());
+ if (descriptor.isAccessorDescriptor()) {
+ if (descriptor.getter())
+ markBuffer.append(descriptor.getter());
+ if (descriptor.setter())
+ markBuffer.append(descriptor.setter());
+ }
+ }
+ for (size_t i = 0; i < numProperties; i++) {
+ object->defineOwnProperty(exec, propertyNames[i], descriptors[i], true);
+ if (exec->hadException())
+ return jsNull();
+ }
+ return object;
+}
+
+EncodedJSValue JSC_HOST_CALL objectConstructorDefineProperties(ExecState* exec)
+{
+ if (!exec->argument(0).isObject())
+ return throwVMError(exec, createTypeError(exec, "Properties can only be defined on Objects."));
+ if (!exec->argument(1).isObject())
+ return throwVMError(exec, createTypeError(exec, "Property descriptor list must be an Object."));
+ return JSValue::encode(defineProperties(exec, asObject(exec->argument(0)), asObject(exec->argument(1))));
+}
+
+EncodedJSValue JSC_HOST_CALL objectConstructorCreate(ExecState* exec)
+{
+ if (!exec->argument(0).isObject() && !exec->argument(0).isNull())
+ return throwVMError(exec, createTypeError(exec, "Object prototype may only be an Object or null."));
+ JSObject* newObject = constructEmptyObject(exec);
+ newObject->setPrototype(exec->argument(0));
+ if (exec->argument(1).isUndefined())
+ return JSValue::encode(newObject);
+ if (!exec->argument(1).isObject())
+ return throwVMError(exec, createTypeError(exec, "Property descriptor list must be an Object."));
+ return JSValue::encode(defineProperties(exec, newObject, asObject(exec->argument(1))));
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/ObjectConstructor.h b/Source/JavaScriptCore/runtime/ObjectConstructor.h
new file mode 100644
index 0000000..04a3c1a
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/ObjectConstructor.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifndef ObjectConstructor_h
+#define ObjectConstructor_h
+
+#include "InternalFunction.h"
+
+namespace JSC {
+
+ class ObjectPrototype;
+
+ class ObjectConstructor : public InternalFunction {
+ public:
+ ObjectConstructor(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure>, ObjectPrototype*, Structure* prototypeFunctionStructure);
+
+ private:
+ virtual ConstructType getConstructData(ConstructData&);
+ virtual CallType getCallData(CallData&);
+ };
+
+} // namespace JSC
+
+#endif // ObjectConstructor_h
diff --git a/Source/JavaScriptCore/runtime/ObjectPrototype.cpp b/Source/JavaScriptCore/runtime/ObjectPrototype.cpp
new file mode 100644
index 0000000..57a8a31
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/ObjectPrototype.cpp
@@ -0,0 +1,165 @@
+/*
+ * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#include "config.h"
+#include "ObjectPrototype.h"
+
+#include "Error.h"
+#include "JSFunction.h"
+#include "JSString.h"
+#include "JSStringBuilder.h"
+#include "PrototypeFunction.h"
+
+namespace JSC {
+
+ASSERT_CLASS_FITS_IN_CELL(ObjectPrototype);
+
+static EncodedJSValue JSC_HOST_CALL objectProtoFuncValueOf(ExecState*);
+static EncodedJSValue JSC_HOST_CALL objectProtoFuncHasOwnProperty(ExecState*);
+static EncodedJSValue JSC_HOST_CALL objectProtoFuncIsPrototypeOf(ExecState*);
+static EncodedJSValue JSC_HOST_CALL objectProtoFuncDefineGetter(ExecState*);
+static EncodedJSValue JSC_HOST_CALL objectProtoFuncDefineSetter(ExecState*);
+static EncodedJSValue JSC_HOST_CALL objectProtoFuncLookupGetter(ExecState*);
+static EncodedJSValue JSC_HOST_CALL objectProtoFuncLookupSetter(ExecState*);
+static EncodedJSValue JSC_HOST_CALL objectProtoFuncPropertyIsEnumerable(ExecState*);
+static EncodedJSValue JSC_HOST_CALL objectProtoFuncToLocaleString(ExecState*);
+
+ObjectPrototype::ObjectPrototype(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> stucture, Structure* prototypeFunctionStructure)
+ : JSObject(stucture)
+ , m_hasNoPropertiesWithUInt32Names(true)
+{
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 0, exec->propertyNames().toString, objectProtoFuncToString), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 0, exec->propertyNames().toLocaleString, objectProtoFuncToLocaleString), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 0, exec->propertyNames().valueOf, objectProtoFuncValueOf), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 1, exec->propertyNames().hasOwnProperty, objectProtoFuncHasOwnProperty), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 1, exec->propertyNames().propertyIsEnumerable, objectProtoFuncPropertyIsEnumerable), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 1, exec->propertyNames().isPrototypeOf, objectProtoFuncIsPrototypeOf), DontEnum);
+
+ // Mozilla extensions
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 2, exec->propertyNames().__defineGetter__, objectProtoFuncDefineGetter), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 2, exec->propertyNames().__defineSetter__, objectProtoFuncDefineSetter), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 1, exec->propertyNames().__lookupGetter__, objectProtoFuncLookupGetter), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 1, exec->propertyNames().__lookupSetter__, objectProtoFuncLookupSetter), DontEnum);
+}
+
+void ObjectPrototype::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
+{
+ JSObject::put(exec, propertyName, value, slot);
+
+ if (m_hasNoPropertiesWithUInt32Names) {
+ bool isUInt32;
+ propertyName.toUInt32(isUInt32);
+ m_hasNoPropertiesWithUInt32Names = !isUInt32;
+ }
+}
+
+bool ObjectPrototype::getOwnPropertySlot(ExecState* exec, unsigned propertyName, PropertySlot& slot)
+{
+ if (m_hasNoPropertiesWithUInt32Names)
+ return false;
+ return JSObject::getOwnPropertySlot(exec, propertyName, slot);
+}
+
+// ------------------------------ Functions --------------------------------
+
+// ECMA 15.2.4.2, 15.2.4.4, 15.2.4.5, 15.2.4.7
+
+EncodedJSValue JSC_HOST_CALL objectProtoFuncValueOf(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ return JSValue::encode(thisValue.toThisObject(exec));
+}
+
+EncodedJSValue JSC_HOST_CALL objectProtoFuncHasOwnProperty(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ return JSValue::encode(jsBoolean(thisValue.toThisObject(exec)->hasOwnProperty(exec, Identifier(exec, exec->argument(0).toString(exec)))));
+}
+
+EncodedJSValue JSC_HOST_CALL objectProtoFuncIsPrototypeOf(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ JSObject* thisObj = thisValue.toThisObject(exec);
+
+ if (!exec->argument(0).isObject())
+ return JSValue::encode(jsBoolean(false));
+
+ JSValue v = asObject(exec->argument(0))->prototype();
+
+ while (true) {
+ if (!v.isObject())
+ return JSValue::encode(jsBoolean(false));
+ if (v == thisObj)
+ return JSValue::encode(jsBoolean(true));
+ v = asObject(v)->prototype();
+ }
+}
+
+EncodedJSValue JSC_HOST_CALL objectProtoFuncDefineGetter(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ CallData callData;
+ if (getCallData(exec->argument(1), callData) == CallTypeNone)
+ return throwVMError(exec, createSyntaxError(exec, "invalid getter usage"));
+ thisValue.toThisObject(exec)->defineGetter(exec, Identifier(exec, exec->argument(0).toString(exec)), asObject(exec->argument(1)));
+ return JSValue::encode(jsUndefined());
+}
+
+EncodedJSValue JSC_HOST_CALL objectProtoFuncDefineSetter(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ CallData callData;
+ if (getCallData(exec->argument(1), callData) == CallTypeNone)
+ return throwVMError(exec, createSyntaxError(exec, "invalid setter usage"));
+ thisValue.toThisObject(exec)->defineSetter(exec, Identifier(exec, exec->argument(0).toString(exec)), asObject(exec->argument(1)));
+ return JSValue::encode(jsUndefined());
+}
+
+EncodedJSValue JSC_HOST_CALL objectProtoFuncLookupGetter(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ return JSValue::encode(thisValue.toThisObject(exec)->lookupGetter(exec, Identifier(exec, exec->argument(0).toString(exec))));
+}
+
+EncodedJSValue JSC_HOST_CALL objectProtoFuncLookupSetter(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ return JSValue::encode(thisValue.toThisObject(exec)->lookupSetter(exec, Identifier(exec, exec->argument(0).toString(exec))));
+}
+
+EncodedJSValue JSC_HOST_CALL objectProtoFuncPropertyIsEnumerable(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ return JSValue::encode(jsBoolean(thisValue.toThisObject(exec)->propertyIsEnumerable(exec, Identifier(exec, exec->argument(0).toString(exec)))));
+}
+
+EncodedJSValue JSC_HOST_CALL objectProtoFuncToLocaleString(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ return JSValue::encode(thisValue.toThisJSString(exec));
+}
+
+EncodedJSValue JSC_HOST_CALL objectProtoFuncToString(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ return JSValue::encode(jsMakeNontrivialString(exec, "[object ", thisValue.toThisObject(exec)->className(), "]"));
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/ObjectPrototype.h b/Source/JavaScriptCore/runtime/ObjectPrototype.h
new file mode 100644
index 0000000..0382ae4
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/ObjectPrototype.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifndef ObjectPrototype_h
+#define ObjectPrototype_h
+
+#include "JSObject.h"
+
+namespace JSC {
+
+ class ObjectPrototype : public JSObject {
+ public:
+ ObjectPrototype(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure>, Structure* prototypeFunctionStructure);
+
+ private:
+ virtual void put(ExecState*, const Identifier&, JSValue, PutPropertySlot&);
+ virtual bool getOwnPropertySlot(ExecState*, unsigned propertyName, PropertySlot&);
+
+ bool m_hasNoPropertiesWithUInt32Names;
+ };
+
+ EncodedJSValue JSC_HOST_CALL objectProtoFuncToString(ExecState*);
+
+} // namespace JSC
+
+#endif // ObjectPrototype_h
diff --git a/Source/JavaScriptCore/runtime/Operations.cpp b/Source/JavaScriptCore/runtime/Operations.cpp
new file mode 100644
index 0000000..f129a80
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/Operations.cpp
@@ -0,0 +1,111 @@
+/*
+ * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+#include "Operations.h"
+
+#include "Error.h"
+#include "JSObject.h"
+#include "JSString.h"
+#include <math.h>
+#include <stdio.h>
+#include <wtf/MathExtras.h>
+
+namespace JSC {
+
+bool JSValue::equalSlowCase(ExecState* exec, JSValue v1, JSValue v2)
+{
+ return equalSlowCaseInline(exec, v1, v2);
+}
+
+bool JSValue::strictEqualSlowCase(ExecState* exec, JSValue v1, JSValue v2)
+{
+ return strictEqualSlowCaseInline(exec, v1, v2);
+}
+
+NEVER_INLINE JSValue jsAddSlowCase(CallFrame* callFrame, JSValue v1, JSValue v2)
+{
+ // exception for the Date exception in defaultValue()
+ JSValue p1 = v1.toPrimitive(callFrame);
+ JSValue p2 = v2.toPrimitive(callFrame);
+
+ if (p1.isString()) {
+ return p2.isString()
+ ? jsString(callFrame, asString(p1), asString(p2))
+ : jsString(callFrame, asString(p1), p2.toString(callFrame));
+ }
+ if (p2.isString())
+ return jsString(callFrame, p1.toString(callFrame), asString(p2));
+
+ return jsNumber(p1.toNumber(callFrame) + p2.toNumber(callFrame));
+}
+
+JSValue jsTypeStringForValue(CallFrame* callFrame, JSValue v)
+{
+ if (v.isUndefined())
+ return jsNontrivialString(callFrame, "undefined");
+ if (v.isBoolean())
+ return jsNontrivialString(callFrame, "boolean");
+ if (v.isNumber())
+ return jsNontrivialString(callFrame, "number");
+ if (v.isString())
+ return jsNontrivialString(callFrame, "string");
+ if (v.isObject()) {
+ // Return "undefined" for objects that should be treated
+ // as null when doing comparisons.
+ if (asObject(v)->structure()->typeInfo().masqueradesAsUndefined())
+ return jsNontrivialString(callFrame, "undefined");
+ CallData callData;
+ if (asObject(v)->getCallData(callData) != CallTypeNone)
+ return jsNontrivialString(callFrame, "function");
+ }
+ return jsNontrivialString(callFrame, "object");
+}
+
+bool jsIsObjectType(JSValue v)
+{
+ if (!v.isCell())
+ return v.isNull();
+
+ JSType type = v.asCell()->structure()->typeInfo().type();
+ if (type == NumberType || type == StringType)
+ return false;
+ if (type == ObjectType) {
+ if (asObject(v)->structure()->typeInfo().masqueradesAsUndefined())
+ return false;
+ CallData callData;
+ if (asObject(v)->getCallData(callData) != CallTypeNone)
+ return false;
+ }
+ return true;
+}
+
+bool jsIsFunctionType(JSValue v)
+{
+ if (v.isObject()) {
+ CallData callData;
+ if (asObject(v)->getCallData(callData) != CallTypeNone)
+ return true;
+ }
+ return false;
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/Operations.h b/Source/JavaScriptCore/runtime/Operations.h
new file mode 100644
index 0000000..1252345
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/Operations.h
@@ -0,0 +1,489 @@
+/*
+ * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
+ * Copyright (C) 2002, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef Operations_h
+#define Operations_h
+
+#include "ExceptionHelpers.h"
+#include "Interpreter.h"
+#include "JSImmediate.h"
+#include "JSNumberCell.h"
+#include "JSString.h"
+
+namespace JSC {
+
+ NEVER_INLINE JSValue jsAddSlowCase(CallFrame*, JSValue, JSValue);
+ JSValue jsTypeStringForValue(CallFrame*, JSValue);
+ bool jsIsObjectType(JSValue);
+ bool jsIsFunctionType(JSValue);
+
+ ALWAYS_INLINE JSValue jsString(ExecState* exec, JSString* s1, JSString* s2)
+ {
+ unsigned length1 = s1->length();
+ if (!length1)
+ return s2;
+ unsigned length2 = s2->length();
+ if (!length2)
+ return s1;
+ if ((length1 + length2) < length1)
+ return throwOutOfMemoryError(exec);
+
+ unsigned fiberCount = s1->fiberCount() + s2->fiberCount();
+ JSGlobalData* globalData = &exec->globalData();
+
+ if (fiberCount <= JSString::s_maxInternalRopeLength)
+ return new (globalData) JSString(globalData, fiberCount, s1, s2);
+
+ JSString::RopeBuilder ropeBuilder(fiberCount);
+ if (UNLIKELY(ropeBuilder.isOutOfMemory()))
+ return throwOutOfMemoryError(exec);
+ ropeBuilder.append(s1);
+ ropeBuilder.append(s2);
+ return new (globalData) JSString(globalData, ropeBuilder.release());
+ }
+
+ ALWAYS_INLINE JSValue jsString(ExecState* exec, const UString& u1, JSString* s2)
+ {
+ unsigned length1 = u1.length();
+ if (!length1)
+ return s2;
+ unsigned length2 = s2->length();
+ if (!length2)
+ return jsString(exec, u1);
+ if ((length1 + length2) < length1)
+ return throwOutOfMemoryError(exec);
+
+ unsigned fiberCount = 1 + s2->fiberCount();
+ JSGlobalData* globalData = &exec->globalData();
+
+ if (fiberCount <= JSString::s_maxInternalRopeLength)
+ return new (globalData) JSString(globalData, fiberCount, u1, s2);
+
+ JSString::RopeBuilder ropeBuilder(fiberCount);
+ if (UNLIKELY(ropeBuilder.isOutOfMemory()))
+ return throwOutOfMemoryError(exec);
+ ropeBuilder.append(u1);
+ ropeBuilder.append(s2);
+ return new (globalData) JSString(globalData, ropeBuilder.release());
+ }
+
+ ALWAYS_INLINE JSValue jsString(ExecState* exec, JSString* s1, const UString& u2)
+ {
+ unsigned length1 = s1->length();
+ if (!length1)
+ return jsString(exec, u2);
+ unsigned length2 = u2.length();
+ if (!length2)
+ return s1;
+ if ((length1 + length2) < length1)
+ return throwOutOfMemoryError(exec);
+
+ unsigned fiberCount = s1->fiberCount() + 1;
+ JSGlobalData* globalData = &exec->globalData();
+
+ if (fiberCount <= JSString::s_maxInternalRopeLength)
+ return new (globalData) JSString(globalData, fiberCount, s1, u2);
+
+ JSString::RopeBuilder ropeBuilder(fiberCount);
+ if (UNLIKELY(ropeBuilder.isOutOfMemory()))
+ return throwOutOfMemoryError(exec);
+ ropeBuilder.append(s1);
+ ropeBuilder.append(u2);
+ return new (globalData) JSString(globalData, ropeBuilder.release());
+ }
+
+ ALWAYS_INLINE JSValue jsString(ExecState* exec, const UString& u1, const UString& u2)
+ {
+ unsigned length1 = u1.length();
+ if (!length1)
+ return jsString(exec, u2);
+ unsigned length2 = u2.length();
+ if (!length2)
+ return jsString(exec, u1);
+ if ((length1 + length2) < length1)
+ return throwOutOfMemoryError(exec);
+
+ JSGlobalData* globalData = &exec->globalData();
+ return new (globalData) JSString(globalData, u1, u2);
+ }
+
+ ALWAYS_INLINE JSValue jsString(ExecState* exec, const UString& u1, const UString& u2, const UString& u3)
+ {
+ unsigned length1 = u1.length();
+ unsigned length2 = u2.length();
+ unsigned length3 = u3.length();
+ if (!length1)
+ return jsString(exec, u2, u3);
+ if (!length2)
+ return jsString(exec, u1, u3);
+ if (!length3)
+ return jsString(exec, u1, u2);
+
+ if ((length1 + length2) < length1)
+ return throwOutOfMemoryError(exec);
+ if ((length1 + length2 + length3) < length3)
+ return throwOutOfMemoryError(exec);
+
+ JSGlobalData* globalData = &exec->globalData();
+ return new (globalData) JSString(globalData, u1, u2, u3);
+ }
+
+ ALWAYS_INLINE JSValue jsString(ExecState* exec, Register* strings, unsigned count)
+ {
+ ASSERT(count >= 3);
+
+ unsigned fiberCount = 0;
+ for (unsigned i = 0; i < count; ++i) {
+ JSValue v = strings[i].jsValue();
+ if (LIKELY(v.isString()))
+ fiberCount += asString(v)->fiberCount();
+ else
+ ++fiberCount;
+ }
+
+ JSGlobalData* globalData = &exec->globalData();
+ if (fiberCount == 3)
+ return new (globalData) JSString(exec, strings[0].jsValue(), strings[1].jsValue(), strings[2].jsValue());
+
+ JSString::RopeBuilder ropeBuilder(fiberCount);
+ if (UNLIKELY(ropeBuilder.isOutOfMemory()))
+ return throwOutOfMemoryError(exec);
+
+ unsigned length = 0;
+ bool overflow = false;
+
+ for (unsigned i = 0; i < count; ++i) {
+ JSValue v = strings[i].jsValue();
+ if (LIKELY(v.isString()))
+ ropeBuilder.append(asString(v));
+ else
+ ropeBuilder.append(v.toString(exec));
+
+ unsigned newLength = ropeBuilder.length();
+ if (newLength < length)
+ overflow = true;
+ length = newLength;
+ }
+
+ if (overflow)
+ return throwOutOfMemoryError(exec);
+
+ return new (globalData) JSString(globalData, ropeBuilder.release());
+ }
+
+ ALWAYS_INLINE JSValue jsString(ExecState* exec, JSValue thisValue)
+ {
+ unsigned fiberCount = 0;
+ if (LIKELY(thisValue.isString()))
+ fiberCount += asString(thisValue)->fiberCount();
+ else
+ ++fiberCount;
+ for (unsigned i = 0; i < exec->argumentCount(); ++i) {
+ JSValue v = exec->argument(i);
+ if (LIKELY(v.isString()))
+ fiberCount += asString(v)->fiberCount();
+ else
+ ++fiberCount;
+ }
+
+ JSString::RopeBuilder ropeBuilder(fiberCount);
+ if (UNLIKELY(ropeBuilder.isOutOfMemory()))
+ return throwOutOfMemoryError(exec);
+
+ if (LIKELY(thisValue.isString()))
+ ropeBuilder.append(asString(thisValue));
+ else
+ ropeBuilder.append(thisValue.toString(exec));
+
+ unsigned length = 0;
+ bool overflow = false;
+
+ for (unsigned i = 0; i < exec->argumentCount(); ++i) {
+ JSValue v = exec->argument(i);
+ if (LIKELY(v.isString()))
+ ropeBuilder.append(asString(v));
+ else
+ ropeBuilder.append(v.toString(exec));
+
+ unsigned newLength = ropeBuilder.length();
+ if (newLength < length)
+ overflow = true;
+ length = newLength;
+ }
+
+ if (overflow)
+ return throwOutOfMemoryError(exec);
+
+ JSGlobalData* globalData = &exec->globalData();
+ return new (globalData) JSString(globalData, ropeBuilder.release());
+ }
+
+ // ECMA 11.9.3
+ inline bool JSValue::equal(ExecState* exec, JSValue v1, JSValue v2)
+ {
+ if (v1.isInt32() && v2.isInt32())
+ return v1 == v2;
+
+ return equalSlowCase(exec, v1, v2);
+ }
+
+ ALWAYS_INLINE bool JSValue::equalSlowCaseInline(ExecState* exec, JSValue v1, JSValue v2)
+ {
+ do {
+ if (v1.isNumber() && v2.isNumber())
+ return v1.uncheckedGetNumber() == v2.uncheckedGetNumber();
+
+ bool s1 = v1.isString();
+ bool s2 = v2.isString();
+ if (s1 && s2)
+ return asString(v1)->value(exec) == asString(v2)->value(exec);
+
+ if (v1.isUndefinedOrNull()) {
+ if (v2.isUndefinedOrNull())
+ return true;
+ if (!v2.isCell())
+ return false;
+ return v2.asCell()->structure()->typeInfo().masqueradesAsUndefined();
+ }
+
+ if (v2.isUndefinedOrNull()) {
+ if (!v1.isCell())
+ return false;
+ return v1.asCell()->structure()->typeInfo().masqueradesAsUndefined();
+ }
+
+ if (v1.isObject()) {
+ if (v2.isObject())
+ return v1 == v2;
+ JSValue p1 = v1.toPrimitive(exec);
+ if (exec->hadException())
+ return false;
+ v1 = p1;
+ if (v1.isInt32() && v2.isInt32())
+ return v1 == v2;
+ continue;
+ }
+
+ if (v2.isObject()) {
+ JSValue p2 = v2.toPrimitive(exec);
+ if (exec->hadException())
+ return false;
+ v2 = p2;
+ if (v1.isInt32() && v2.isInt32())
+ return v1 == v2;
+ continue;
+ }
+
+ if (s1 || s2) {
+ double d1 = v1.toNumber(exec);
+ double d2 = v2.toNumber(exec);
+ return d1 == d2;
+ }
+
+ if (v1.isBoolean()) {
+ if (v2.isNumber())
+ return static_cast<double>(v1.getBoolean()) == v2.uncheckedGetNumber();
+ } else if (v2.isBoolean()) {
+ if (v1.isNumber())
+ return v1.uncheckedGetNumber() == static_cast<double>(v2.getBoolean());
+ }
+
+ return v1 == v2;
+ } while (true);
+ }
+
+ // ECMA 11.9.3
+ ALWAYS_INLINE bool JSValue::strictEqualSlowCaseInline(ExecState* exec, JSValue v1, JSValue v2)
+ {
+ ASSERT(v1.isCell() && v2.isCell());
+
+ if (v1.asCell()->isString() && v2.asCell()->isString())
+ return asString(v1)->value(exec) == asString(v2)->value(exec);
+
+ return v1 == v2;
+ }
+
+ inline bool JSValue::strictEqual(ExecState* exec, JSValue v1, JSValue v2)
+ {
+ if (v1.isInt32() && v2.isInt32())
+ return v1 == v2;
+
+ if (v1.isNumber() && v2.isNumber())
+ return v1.uncheckedGetNumber() == v2.uncheckedGetNumber();
+
+ if (!v1.isCell() || !v2.isCell())
+ return v1 == v2;
+
+ return strictEqualSlowCaseInline(exec, v1, v2);
+ }
+
+ ALWAYS_INLINE bool jsLess(CallFrame* callFrame, JSValue v1, JSValue v2)
+ {
+ if (v1.isInt32() && v2.isInt32())
+ return v1.asInt32() < v2.asInt32();
+
+ double n1;
+ double n2;
+ if (v1.getNumber(n1) && v2.getNumber(n2))
+ return n1 < n2;
+
+ JSGlobalData* globalData = &callFrame->globalData();
+ if (isJSString(globalData, v1) && isJSString(globalData, v2))
+ return asString(v1)->value(callFrame) < asString(v2)->value(callFrame);
+
+ JSValue p1;
+ JSValue p2;
+ bool wasNotString1 = v1.getPrimitiveNumber(callFrame, n1, p1);
+ bool wasNotString2 = v2.getPrimitiveNumber(callFrame, n2, p2);
+
+ if (wasNotString1 | wasNotString2)
+ return n1 < n2;
+
+ return asString(p1)->value(callFrame) < asString(p2)->value(callFrame);
+ }
+
+ inline bool jsLessEq(CallFrame* callFrame, JSValue v1, JSValue v2)
+ {
+ if (v1.isInt32() && v2.isInt32())
+ return v1.asInt32() <= v2.asInt32();
+
+ double n1;
+ double n2;
+ if (v1.getNumber(n1) && v2.getNumber(n2))
+ return n1 <= n2;
+
+ JSGlobalData* globalData = &callFrame->globalData();
+ if (isJSString(globalData, v1) && isJSString(globalData, v2))
+ return !(asString(v2)->value(callFrame) < asString(v1)->value(callFrame));
+
+ JSValue p1;
+ JSValue p2;
+ bool wasNotString1 = v1.getPrimitiveNumber(callFrame, n1, p1);
+ bool wasNotString2 = v2.getPrimitiveNumber(callFrame, n2, p2);
+
+ if (wasNotString1 | wasNotString2)
+ return n1 <= n2;
+
+ return !(asString(p2)->value(callFrame) < asString(p1)->value(callFrame));
+ }
+
+ // Fast-path choices here are based on frequency data from SunSpider:
+ // <times> Add case: <t1> <t2>
+ // ---------------------------
+ // 5626160 Add case: 3 3 (of these, 3637690 are for immediate values)
+ // 247412 Add case: 5 5
+ // 20900 Add case: 5 6
+ // 13962 Add case: 5 3
+ // 4000 Add case: 3 5
+
+ ALWAYS_INLINE JSValue jsAdd(CallFrame* callFrame, JSValue v1, JSValue v2)
+ {
+ double left = 0.0, right;
+ if (v1.getNumber(left) && v2.getNumber(right))
+ return jsNumber(left + right);
+
+ if (v1.isString()) {
+ return v2.isString()
+ ? jsString(callFrame, asString(v1), asString(v2))
+ : jsString(callFrame, asString(v1), v2.toPrimitiveString(callFrame));
+ }
+
+ // All other cases are pretty uncommon
+ return jsAddSlowCase(callFrame, v1, v2);
+ }
+
+ inline size_t normalizePrototypeChain(CallFrame* callFrame, JSValue base, JSValue slotBase, const Identifier& propertyName, size_t& slotOffset)
+ {
+ JSCell* cell = base.asCell();
+ size_t count = 0;
+
+ while (slotBase != cell) {
+ JSValue v = cell->structure()->prototypeForLookup(callFrame);
+
+ // If we didn't find slotBase in base's prototype chain, then base
+ // must be a proxy for another object.
+
+ if (v.isNull())
+ return 0;
+
+ cell = v.asCell();
+
+ // Since we're accessing a prototype in a loop, it's a good bet that it
+ // should not be treated as a dictionary.
+ if (cell->structure()->isDictionary()) {
+ asObject(cell)->flattenDictionaryObject();
+ if (slotBase == cell)
+ slotOffset = cell->structure()->get(propertyName);
+ }
+
+ ++count;
+ }
+
+ ASSERT(count);
+ return count;
+ }
+
+ inline size_t normalizePrototypeChain(CallFrame* callFrame, JSCell* base)
+ {
+ size_t count = 0;
+ while (1) {
+ JSValue v = base->structure()->prototypeForLookup(callFrame);
+ if (v.isNull())
+ return count;
+
+ base = v.asCell();
+
+ // Since we're accessing a prototype in a loop, it's a good bet that it
+ // should not be treated as a dictionary.
+ if (base->structure()->isDictionary())
+ asObject(base)->flattenDictionaryObject();
+
+ ++count;
+ }
+ }
+
+ ALWAYS_INLINE JSValue resolveBase(CallFrame* callFrame, Identifier& property, ScopeChainNode* scopeChain, bool isStrictPut)
+ {
+ ScopeChainIterator iter = scopeChain->begin();
+ ScopeChainIterator next = iter;
+ ++next;
+ ScopeChainIterator end = scopeChain->end();
+ ASSERT(iter != end);
+
+ PropertySlot slot;
+ JSObject* base;
+ while (true) {
+ base = *iter;
+ if (next == end)
+ return isStrictPut ? JSValue() : base;
+ if (base->getPropertySlot(callFrame, property, slot))
+ return base;
+
+ iter = next;
+ ++next;
+ }
+
+ ASSERT_NOT_REACHED();
+ return JSValue();
+ }
+} // namespace JSC
+
+#endif // Operations_h
diff --git a/Source/JavaScriptCore/runtime/PropertyDescriptor.cpp b/Source/JavaScriptCore/runtime/PropertyDescriptor.cpp
new file mode 100644
index 0000000..558ae28
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/PropertyDescriptor.cpp
@@ -0,0 +1,195 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+#include "config.h"
+
+#include "PropertyDescriptor.h"
+
+#include "GetterSetter.h"
+#include "JSObject.h"
+#include "Operations.h"
+
+namespace JSC {
+unsigned PropertyDescriptor::defaultAttributes = (DontDelete << 1) - 1;
+
+bool PropertyDescriptor::writable() const
+{
+ ASSERT(!isAccessorDescriptor());
+ return !(m_attributes & ReadOnly);
+}
+
+bool PropertyDescriptor::enumerable() const
+{
+ return !(m_attributes & DontEnum);
+}
+
+bool PropertyDescriptor::configurable() const
+{
+ return !(m_attributes & DontDelete);
+}
+
+bool PropertyDescriptor::isDataDescriptor() const
+{
+ return m_value || (m_seenAttributes & WritablePresent);
+}
+
+bool PropertyDescriptor::isGenericDescriptor() const
+{
+ return !isAccessorDescriptor() && !isDataDescriptor();
+}
+
+bool PropertyDescriptor::isAccessorDescriptor() const
+{
+ return m_getter || m_setter;
+}
+
+void PropertyDescriptor::setUndefined()
+{
+ m_value = jsUndefined();
+ m_attributes = ReadOnly | DontDelete | DontEnum;
+}
+
+JSValue PropertyDescriptor::getter() const
+{
+ ASSERT(isAccessorDescriptor());
+ return m_getter;
+}
+
+JSValue PropertyDescriptor::setter() const
+{
+ ASSERT(isAccessorDescriptor());
+ return m_setter;
+}
+
+void PropertyDescriptor::setDescriptor(JSValue value, unsigned attributes)
+{
+ ASSERT(value);
+ m_attributes = attributes;
+ if (attributes & (Getter | Setter)) {
+ GetterSetter* accessor = asGetterSetter(value);
+ m_getter = accessor->getter();
+ m_setter = accessor->setter();
+ ASSERT(m_getter || m_setter);
+ m_seenAttributes = EnumerablePresent | ConfigurablePresent;
+ m_attributes &= ~ReadOnly;
+ } else {
+ m_value = value;
+ m_seenAttributes = EnumerablePresent | ConfigurablePresent | WritablePresent;
+ }
+}
+
+void PropertyDescriptor::setAccessorDescriptor(JSValue getter, JSValue setter, unsigned attributes)
+{
+ ASSERT(attributes & (Getter | Setter));
+ ASSERT(getter || setter);
+ m_attributes = attributes;
+ m_getter = getter;
+ m_setter = setter;
+ m_attributes &= ~ReadOnly;
+ m_seenAttributes = EnumerablePresent | ConfigurablePresent;
+}
+
+void PropertyDescriptor::setWritable(bool writable)
+{
+ if (writable)
+ m_attributes &= ~ReadOnly;
+ else
+ m_attributes |= ReadOnly;
+ m_seenAttributes |= WritablePresent;
+}
+
+void PropertyDescriptor::setEnumerable(bool enumerable)
+{
+ if (enumerable)
+ m_attributes &= ~DontEnum;
+ else
+ m_attributes |= DontEnum;
+ m_seenAttributes |= EnumerablePresent;
+}
+
+void PropertyDescriptor::setConfigurable(bool configurable)
+{
+ if (configurable)
+ m_attributes &= ~DontDelete;
+ else
+ m_attributes |= DontDelete;
+ m_seenAttributes |= ConfigurablePresent;
+}
+
+void PropertyDescriptor::setSetter(JSValue setter)
+{
+ m_setter = setter;
+ m_attributes |= Setter;
+ m_attributes &= ~ReadOnly;
+}
+
+void PropertyDescriptor::setGetter(JSValue getter)
+{
+ m_getter = getter;
+ m_attributes |= Getter;
+ m_attributes &= ~ReadOnly;
+}
+
+bool PropertyDescriptor::equalTo(ExecState* exec, const PropertyDescriptor& other) const
+{
+ if (!other.m_value == m_value ||
+ !other.m_getter == m_getter ||
+ !other.m_setter == m_setter)
+ return false;
+ return (!m_value || JSValue::strictEqual(exec, other.m_value, m_value)) &&
+ (!m_getter || JSValue::strictEqual(exec, other.m_getter, m_getter)) &&
+ (!m_setter || JSValue::strictEqual(exec, other.m_setter, m_setter)) &&
+ attributesEqual(other);
+}
+
+bool PropertyDescriptor::attributesEqual(const PropertyDescriptor& other) const
+{
+ unsigned mismatch = other.m_attributes ^ m_attributes;
+ unsigned sharedSeen = other.m_seenAttributes & m_seenAttributes;
+ if (sharedSeen & WritablePresent && mismatch & ReadOnly)
+ return false;
+ if (sharedSeen & ConfigurablePresent && mismatch & DontDelete)
+ return false;
+ if (sharedSeen & EnumerablePresent && mismatch & DontEnum)
+ return false;
+ return true;
+}
+
+unsigned PropertyDescriptor::attributesWithOverride(const PropertyDescriptor& other) const
+{
+ unsigned mismatch = other.m_attributes ^ m_attributes;
+ unsigned sharedSeen = other.m_seenAttributes & m_seenAttributes;
+ unsigned newAttributes = m_attributes & defaultAttributes;
+ if (sharedSeen & WritablePresent && mismatch & ReadOnly)
+ newAttributes ^= ReadOnly;
+ if (sharedSeen & ConfigurablePresent && mismatch & DontDelete)
+ newAttributes ^= DontDelete;
+ if (sharedSeen & EnumerablePresent && mismatch & DontEnum)
+ newAttributes ^= DontEnum;
+ return newAttributes;
+}
+
+}
diff --git a/Source/JavaScriptCore/runtime/PropertyDescriptor.h b/Source/JavaScriptCore/runtime/PropertyDescriptor.h
new file mode 100644
index 0000000..ff9f160
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/PropertyDescriptor.h
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef PropertyDescriptor_h
+#define PropertyDescriptor_h
+
+#include "JSValue.h"
+
+namespace JSC {
+ class PropertyDescriptor {
+ public:
+ PropertyDescriptor()
+ : m_attributes(defaultAttributes)
+ , m_seenAttributes(0)
+ {
+ }
+ bool writable() const;
+ bool enumerable() const;
+ bool configurable() const;
+ bool isDataDescriptor() const;
+ bool isGenericDescriptor() const;
+ bool isAccessorDescriptor() const;
+ unsigned attributes() const { return m_attributes; }
+ JSValue value() const { return m_value; }
+ JSValue getter() const;
+ JSValue setter() const;
+ void setUndefined();
+ void setDescriptor(JSValue value, unsigned attributes);
+ void setAccessorDescriptor(JSValue getter, JSValue setter, unsigned attributes);
+ void setWritable(bool);
+ void setEnumerable(bool);
+ void setConfigurable(bool);
+ void setValue(JSValue value) { m_value = value; }
+ void setSetter(JSValue);
+ void setGetter(JSValue);
+ bool isEmpty() const { return !(m_value || m_getter || m_setter || m_seenAttributes); }
+ bool writablePresent() const { return m_seenAttributes & WritablePresent; }
+ bool enumerablePresent() const { return m_seenAttributes & EnumerablePresent; }
+ bool configurablePresent() const { return m_seenAttributes & ConfigurablePresent; }
+ bool setterPresent() const { return m_setter; }
+ bool getterPresent() const { return m_getter; }
+ bool equalTo(ExecState* exec, const PropertyDescriptor& other) const;
+ bool attributesEqual(const PropertyDescriptor& other) const;
+ unsigned attributesWithOverride(const PropertyDescriptor& other) const;
+ private:
+ static unsigned defaultAttributes;
+ bool operator==(const PropertyDescriptor&){ return false; }
+ enum { WritablePresent = 1, EnumerablePresent = 2, ConfigurablePresent = 4};
+ // May be a getter/setter
+ JSValue m_value;
+ JSValue m_getter;
+ JSValue m_setter;
+ unsigned m_attributes;
+ unsigned m_seenAttributes;
+ };
+}
+
+#endif
diff --git a/Source/JavaScriptCore/runtime/PropertyMapHashTable.h b/Source/JavaScriptCore/runtime/PropertyMapHashTable.h
new file mode 100644
index 0000000..bd452b6
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/PropertyMapHashTable.h
@@ -0,0 +1,90 @@
+/*
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PropertyMapHashTable_h
+#define PropertyMapHashTable_h
+
+#include "UString.h"
+#include <wtf/Vector.h>
+
+namespace JSC {
+
+ struct PropertyMapEntry {
+ StringImpl* key;
+ unsigned offset;
+ unsigned attributes;
+ JSCell* specificValue;
+ unsigned index;
+
+ PropertyMapEntry(StringImpl* key, unsigned attributes, JSCell* specificValue)
+ : key(key)
+ , offset(0)
+ , attributes(attributes)
+ , specificValue(specificValue)
+ , index(0)
+ {
+ }
+
+ PropertyMapEntry(StringImpl* key, unsigned offset, unsigned attributes, JSCell* specificValue, unsigned index)
+ : key(key)
+ , offset(offset)
+ , attributes(attributes)
+ , specificValue(specificValue)
+ , index(index)
+ {
+ }
+ };
+
+ // lastIndexUsed is an ever-increasing index used to identify the order items
+ // were inserted into the property map. It's required that getEnumerablePropertyNames
+ // return the properties in the order they were added for compatibility with other
+ // browsers' JavaScript implementations.
+ struct PropertyMapHashTable {
+ unsigned sizeMask;
+ unsigned size;
+ unsigned keyCount;
+ unsigned deletedSentinelCount;
+ unsigned lastIndexUsed;
+ Vector<unsigned>* deletedOffsets;
+ unsigned entryIndices[1];
+
+ PropertyMapEntry* entries()
+ {
+ // The entries vector comes after the indices vector.
+ // The 0th item in the entries vector is not really used; it has to
+ // have a 0 in its key to allow the hash table lookup to handle deleted
+ // sentinels without any special-case code, but the other fields are unused.
+ return reinterpret_cast<PropertyMapEntry*>(&entryIndices[size]);
+ }
+
+ static size_t allocationSize(unsigned size)
+ {
+ // We never let a hash table get more than half full,
+ // So the number of indices we need is the size of the hash table.
+ // But the number of entries is half that (plus one for the deleted sentinel).
+ return sizeof(PropertyMapHashTable)
+ + (size - 1) * sizeof(unsigned)
+ + (1 + size / 2) * sizeof(PropertyMapEntry);
+ }
+ };
+
+} // namespace JSC
+
+#endif // PropertyMapHashTable_h
diff --git a/Source/JavaScriptCore/runtime/PropertyNameArray.cpp b/Source/JavaScriptCore/runtime/PropertyNameArray.cpp
new file mode 100644
index 0000000..afb41be
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/PropertyNameArray.cpp
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+#include "PropertyNameArray.h"
+
+#include "Structure.h"
+#include "StructureChain.h"
+
+namespace JSC {
+
+static const size_t setThreshold = 20;
+
+void PropertyNameArray::add(StringImpl* identifier)
+{
+ ASSERT(!identifier || identifier == StringImpl::empty() || identifier->isIdentifier());
+
+ size_t size = m_data->propertyNameVector().size();
+ if (size < setThreshold) {
+ for (size_t i = 0; i < size; ++i) {
+ if (identifier == m_data->propertyNameVector()[i].impl())
+ return;
+ }
+ } else {
+ if (m_set.isEmpty()) {
+ for (size_t i = 0; i < size; ++i)
+ m_set.add(m_data->propertyNameVector()[i].impl());
+ }
+ if (!m_set.add(identifier).second)
+ return;
+ }
+
+ addKnownUnique(identifier);
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/PropertyNameArray.h b/Source/JavaScriptCore/runtime/PropertyNameArray.h
new file mode 100644
index 0000000..0da930f
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/PropertyNameArray.h
@@ -0,0 +1,99 @@
+/*
+ * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PropertyNameArray_h
+#define PropertyNameArray_h
+
+#include "CallFrame.h"
+#include "Identifier.h"
+#include <wtf/HashSet.h>
+#include <wtf/OwnArrayPtr.h>
+#include <wtf/Vector.h>
+
+namespace JSC {
+
+ class Structure;
+ class StructureChain;
+
+ // FIXME: Rename to PropertyNameArray.
+ class PropertyNameArrayData : public RefCounted<PropertyNameArrayData> {
+ public:
+ typedef Vector<Identifier, 20> PropertyNameVector;
+
+ static PassRefPtr<PropertyNameArrayData> create() { return adoptRef(new PropertyNameArrayData); }
+
+ PropertyNameVector& propertyNameVector() { return m_propertyNameVector; }
+
+ private:
+ PropertyNameArrayData()
+ {
+ }
+
+ PropertyNameVector m_propertyNameVector;
+ };
+
+ // FIXME: Rename to PropertyNameArrayBuilder.
+ class PropertyNameArray {
+ public:
+ PropertyNameArray(JSGlobalData* globalData)
+ : m_data(PropertyNameArrayData::create())
+ , m_globalData(globalData)
+ , m_shouldCache(true)
+ {
+ }
+
+ PropertyNameArray(ExecState* exec)
+ : m_data(PropertyNameArrayData::create())
+ , m_globalData(&exec->globalData())
+ , m_shouldCache(true)
+ {
+ }
+
+ JSGlobalData* globalData() { return m_globalData; }
+
+ void add(const Identifier& identifier) { add(identifier.impl()); }
+ void add(StringImpl*);
+ void addKnownUnique(StringImpl* identifier) { m_data->propertyNameVector().append(Identifier(m_globalData, identifier)); }
+
+ Identifier& operator[](unsigned i) { return m_data->propertyNameVector()[i]; }
+ const Identifier& operator[](unsigned i) const { return m_data->propertyNameVector()[i]; }
+
+ void setData(PassRefPtr<PropertyNameArrayData> data) { m_data = data; }
+ PropertyNameArrayData* data() { return m_data.get(); }
+ PassRefPtr<PropertyNameArrayData> releaseData() { return m_data.release(); }
+
+ // FIXME: Remove these functions.
+ typedef PropertyNameArrayData::PropertyNameVector::const_iterator const_iterator;
+ size_t size() const { return m_data->propertyNameVector().size(); }
+ const_iterator begin() const { return m_data->propertyNameVector().begin(); }
+ const_iterator end() const { return m_data->propertyNameVector().end(); }
+
+ private:
+ typedef HashSet<StringImpl*, PtrHash<StringImpl*> > IdentifierSet;
+
+ RefPtr<PropertyNameArrayData> m_data;
+ IdentifierSet m_set;
+ JSGlobalData* m_globalData;
+ bool m_shouldCache;
+ };
+
+} // namespace JSC
+
+#endif // PropertyNameArray_h
diff --git a/Source/JavaScriptCore/runtime/PropertySlot.cpp b/Source/JavaScriptCore/runtime/PropertySlot.cpp
new file mode 100644
index 0000000..fd16c0c
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/PropertySlot.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2005, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+#include "PropertySlot.h"
+
+#include "JSFunction.h"
+#include "JSGlobalObject.h"
+
+namespace JSC {
+
+JSValue PropertySlot::functionGetter(ExecState* exec) const
+{
+ // Prevent getter functions from observing execution if an exception is pending.
+ if (exec->hadException())
+ return exec->exception();
+
+ CallData callData;
+ CallType callType = m_data.getterFunc->getCallData(callData);
+ return call(exec, m_data.getterFunc, callType, callData, thisValue(), exec->emptyList());
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/PropertySlot.h b/Source/JavaScriptCore/runtime/PropertySlot.h
new file mode 100644
index 0000000..de9ddc9
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/PropertySlot.h
@@ -0,0 +1,268 @@
+/*
+ * Copyright (C) 2005, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PropertySlot_h
+#define PropertySlot_h
+
+#include "Identifier.h"
+#include "JSValue.h"
+#include "Register.h"
+#include <wtf/Assertions.h>
+#include <wtf/NotFound.h>
+
+namespace JSC {
+
+ class ExecState;
+ class JSObject;
+
+#define JSC_VALUE_SLOT_MARKER 0
+#define JSC_REGISTER_SLOT_MARKER reinterpret_cast<GetValueFunc>(1)
+#define INDEX_GETTER_MARKER reinterpret_cast<GetValueFunc>(2)
+#define GETTER_FUNCTION_MARKER reinterpret_cast<GetValueFunc>(3)
+
+ class PropertySlot {
+ public:
+ enum CachedPropertyType {
+ Uncacheable,
+ Getter,
+ Custom,
+ Value
+ };
+
+ PropertySlot()
+ : m_cachedPropertyType(Uncacheable)
+ {
+ clearBase();
+ clearOffset();
+ clearValue();
+ }
+
+ explicit PropertySlot(const JSValue base)
+ : m_slotBase(base)
+ , m_cachedPropertyType(Uncacheable)
+ {
+ clearOffset();
+ clearValue();
+ }
+
+ typedef JSValue (*GetValueFunc)(ExecState*, JSValue slotBase, const Identifier&);
+ typedef JSValue (*GetIndexValueFunc)(ExecState*, JSValue slotBase, unsigned);
+
+ JSValue getValue(ExecState* exec, const Identifier& propertyName) const
+ {
+ if (m_getValue == JSC_VALUE_SLOT_MARKER)
+ return *m_data.valueSlot;
+ if (m_getValue == JSC_REGISTER_SLOT_MARKER)
+ return (*m_data.registerSlot).jsValue();
+ if (m_getValue == INDEX_GETTER_MARKER)
+ return m_getIndexValue(exec, slotBase(), index());
+ if (m_getValue == GETTER_FUNCTION_MARKER)
+ return functionGetter(exec);
+ return m_getValue(exec, slotBase(), propertyName);
+ }
+
+ JSValue getValue(ExecState* exec, unsigned propertyName) const
+ {
+ if (m_getValue == JSC_VALUE_SLOT_MARKER)
+ return *m_data.valueSlot;
+ if (m_getValue == JSC_REGISTER_SLOT_MARKER)
+ return (*m_data.registerSlot).jsValue();
+ if (m_getValue == INDEX_GETTER_MARKER)
+ return m_getIndexValue(exec, m_slotBase, m_data.index);
+ if (m_getValue == GETTER_FUNCTION_MARKER)
+ return functionGetter(exec);
+ return m_getValue(exec, slotBase(), Identifier::from(exec, propertyName));
+ }
+
+ CachedPropertyType cachedPropertyType() const { return m_cachedPropertyType; }
+ bool isCacheable() const { return m_cachedPropertyType != Uncacheable; }
+ bool isCacheableValue() const { return m_cachedPropertyType == Value; }
+ size_t cachedOffset() const
+ {
+ ASSERT(isCacheable());
+ return m_offset;
+ }
+
+ void setValueSlot(JSValue* valueSlot)
+ {
+ ASSERT(valueSlot);
+ clearBase();
+ clearOffset();
+ m_getValue = JSC_VALUE_SLOT_MARKER;
+ m_data.valueSlot = valueSlot;
+ }
+
+ void setValueSlot(JSValue slotBase, JSValue* valueSlot)
+ {
+ ASSERT(valueSlot);
+ m_getValue = JSC_VALUE_SLOT_MARKER;
+ m_slotBase = slotBase;
+ m_data.valueSlot = valueSlot;
+ }
+
+ void setValueSlot(JSValue slotBase, JSValue* valueSlot, size_t offset)
+ {
+ ASSERT(valueSlot);
+ m_getValue = JSC_VALUE_SLOT_MARKER;
+ m_slotBase = slotBase;
+ m_data.valueSlot = valueSlot;
+ m_offset = offset;
+ m_cachedPropertyType = Value;
+ }
+
+ void setValue(JSValue value)
+ {
+ ASSERT(value);
+ clearBase();
+ clearOffset();
+ m_getValue = JSC_VALUE_SLOT_MARKER;
+ m_value = value;
+ m_data.valueSlot = &m_value;
+ }
+
+ void setRegisterSlot(Register* registerSlot)
+ {
+ ASSERT(registerSlot);
+ clearBase();
+ clearOffset();
+ m_getValue = JSC_REGISTER_SLOT_MARKER;
+ m_data.registerSlot = registerSlot;
+ }
+
+ void setCustom(JSValue slotBase, GetValueFunc getValue)
+ {
+ ASSERT(slotBase);
+ ASSERT(getValue);
+ m_getValue = getValue;
+ m_getIndexValue = 0;
+ m_slotBase = slotBase;
+ }
+
+ void setCacheableCustom(JSValue slotBase, GetValueFunc getValue)
+ {
+ ASSERT(slotBase);
+ ASSERT(getValue);
+ m_getValue = getValue;
+ m_getIndexValue = 0;
+ m_slotBase = slotBase;
+ m_cachedPropertyType = Custom;
+ }
+
+ void setCustomIndex(JSValue slotBase, unsigned index, GetIndexValueFunc getIndexValue)
+ {
+ ASSERT(slotBase);
+ ASSERT(getIndexValue);
+ m_getValue = INDEX_GETTER_MARKER;
+ m_getIndexValue = getIndexValue;
+ m_slotBase = slotBase;
+ m_data.index = index;
+ }
+
+ void setGetterSlot(JSObject* getterFunc)
+ {
+ ASSERT(getterFunc);
+ m_thisValue = m_slotBase;
+ m_getValue = GETTER_FUNCTION_MARKER;
+ m_data.getterFunc = getterFunc;
+ }
+
+ void setCacheableGetterSlot(JSValue slotBase, JSObject* getterFunc, unsigned offset)
+ {
+ ASSERT(getterFunc);
+ m_getValue = GETTER_FUNCTION_MARKER;
+ m_thisValue = m_slotBase;
+ m_slotBase = slotBase;
+ m_data.getterFunc = getterFunc;
+ m_offset = offset;
+ m_cachedPropertyType = Getter;
+ }
+
+ void setUndefined()
+ {
+ setValue(jsUndefined());
+ }
+
+ JSValue slotBase() const
+ {
+ return m_slotBase;
+ }
+
+ void setBase(JSValue base)
+ {
+ ASSERT(m_slotBase);
+ ASSERT(base);
+ m_slotBase = base;
+ }
+
+ void clearBase()
+ {
+#ifndef NDEBUG
+ m_slotBase = JSValue();
+#endif
+ }
+
+ void clearValue()
+ {
+#ifndef NDEBUG
+ m_value = JSValue();
+#endif
+ }
+
+ void clearOffset()
+ {
+ // Clear offset even in release builds, in case this PropertySlot has been used before.
+ // (For other data members, we don't need to clear anything because reuse would meaningfully overwrite them.)
+ m_offset = 0;
+ m_cachedPropertyType = Uncacheable;
+ }
+
+ unsigned index() const { return m_data.index; }
+
+ JSValue thisValue() const { return m_thisValue; }
+
+ GetValueFunc customGetter() const
+ {
+ ASSERT(m_cachedPropertyType == Custom);
+ return m_getValue;
+ }
+ private:
+ JSValue functionGetter(ExecState*) const;
+
+ GetValueFunc m_getValue;
+ GetIndexValueFunc m_getIndexValue;
+
+ JSValue m_slotBase;
+ union {
+ JSObject* getterFunc;
+ JSValue* valueSlot;
+ Register* registerSlot;
+ unsigned index;
+ } m_data;
+
+ JSValue m_value;
+ JSValue m_thisValue;
+
+ size_t m_offset;
+ CachedPropertyType m_cachedPropertyType;
+ };
+
+} // namespace JSC
+
+#endif // PropertySlot_h
diff --git a/Source/JavaScriptCore/runtime/Protect.h b/Source/JavaScriptCore/runtime/Protect.h
new file mode 100644
index 0000000..06cf97f
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/Protect.h
@@ -0,0 +1,215 @@
+/*
+ * Copyright (C) 2004, 2008, 2009 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+
+#ifndef Protect_h
+#define Protect_h
+
+#include "Collector.h"
+#include "JSValue.h"
+
+namespace JSC {
+
+ inline void gcProtect(JSCell* val)
+ {
+ Heap::heap(val)->protect(val);
+ }
+
+ inline void gcUnprotect(JSCell* val)
+ {
+ Heap::heap(val)->unprotect(val);
+ }
+
+ inline void gcProtectNullTolerant(JSCell* val)
+ {
+ if (val)
+ gcProtect(val);
+ }
+
+ inline void gcUnprotectNullTolerant(JSCell* val)
+ {
+ if (val)
+ gcUnprotect(val);
+ }
+
+ inline void gcProtect(JSValue value)
+ {
+ if (value && value.isCell())
+ gcProtect(value.asCell());
+ }
+
+ inline void gcUnprotect(JSValue value)
+ {
+ if (value && value.isCell())
+ gcUnprotect(value.asCell());
+ }
+
+ // FIXME: Share more code with RefPtr template? The only differences are the ref/deref operation
+ // and the implicit conversion to raw pointer
+ template <class T> class ProtectedPtr {
+ public:
+ ProtectedPtr() : m_ptr(0) {}
+ ProtectedPtr(T* ptr);
+ ProtectedPtr(const ProtectedPtr&);
+ ~ProtectedPtr();
+
+ template <class U> ProtectedPtr(const ProtectedPtr<U>&);
+
+ T* get() const { return m_ptr; }
+ operator T*() const { return m_ptr; }
+ operator JSValue() const { return JSValue(m_ptr); }
+ T* operator->() const { return m_ptr; }
+
+ operator bool() const { return m_ptr; }
+ bool operator!() const { return !m_ptr; }
+
+ ProtectedPtr& operator=(const ProtectedPtr&);
+ ProtectedPtr& operator=(T*);
+
+ private:
+ T* m_ptr;
+ };
+
+ class ProtectedJSValue {
+ public:
+ ProtectedJSValue() {}
+ ProtectedJSValue(JSValue value);
+ ProtectedJSValue(const ProtectedJSValue&);
+ ~ProtectedJSValue();
+
+ template <class U> ProtectedJSValue(const ProtectedPtr<U>&);
+
+ JSValue get() const { return m_value; }
+ operator JSValue() const { return m_value; }
+ JSValue operator->() const { return m_value; }
+
+ operator bool() const { return m_value; }
+ bool operator!() const { return !m_value; }
+
+ ProtectedJSValue& operator=(const ProtectedJSValue&);
+ ProtectedJSValue& operator=(JSValue);
+
+ private:
+ JSValue m_value;
+ };
+
+ template <class T> inline ProtectedPtr<T>::ProtectedPtr(T* ptr)
+ : m_ptr(ptr)
+ {
+ gcProtectNullTolerant(m_ptr);
+ }
+
+ template <class T> inline ProtectedPtr<T>::ProtectedPtr(const ProtectedPtr& o)
+ : m_ptr(o.get())
+ {
+ gcProtectNullTolerant(m_ptr);
+ }
+
+ template <class T> inline ProtectedPtr<T>::~ProtectedPtr()
+ {
+ gcUnprotectNullTolerant(m_ptr);
+ }
+
+ template <class T> template <class U> inline ProtectedPtr<T>::ProtectedPtr(const ProtectedPtr<U>& o)
+ : m_ptr(o.get())
+ {
+ gcProtectNullTolerant(m_ptr);
+ }
+
+ template <class T> inline ProtectedPtr<T>& ProtectedPtr<T>::operator=(const ProtectedPtr<T>& o)
+ {
+ T* optr = o.m_ptr;
+ gcProtectNullTolerant(optr);
+ gcUnprotectNullTolerant(m_ptr);
+ m_ptr = optr;
+ return *this;
+ }
+
+ template <class T> inline ProtectedPtr<T>& ProtectedPtr<T>::operator=(T* optr)
+ {
+ gcProtectNullTolerant(optr);
+ gcUnprotectNullTolerant(m_ptr);
+ m_ptr = optr;
+ return *this;
+ }
+
+ inline ProtectedJSValue::ProtectedJSValue(JSValue value)
+ : m_value(value)
+ {
+ gcProtect(m_value);
+ }
+
+ inline ProtectedJSValue::ProtectedJSValue(const ProtectedJSValue& o)
+ : m_value(o.get())
+ {
+ gcProtect(m_value);
+ }
+
+ inline ProtectedJSValue::~ProtectedJSValue()
+ {
+ gcUnprotect(m_value);
+ }
+
+ template <class U> ProtectedJSValue::ProtectedJSValue(const ProtectedPtr<U>& o)
+ : m_value(o.get())
+ {
+ gcProtect(m_value);
+ }
+
+ inline ProtectedJSValue& ProtectedJSValue::operator=(const ProtectedJSValue& o)
+ {
+ JSValue ovalue = o.m_value;
+ gcProtect(ovalue);
+ gcUnprotect(m_value);
+ m_value = ovalue;
+ return *this;
+ }
+
+ inline ProtectedJSValue& ProtectedJSValue::operator=(JSValue ovalue)
+ {
+ gcProtect(ovalue);
+ gcUnprotect(m_value);
+ m_value = ovalue;
+ return *this;
+ }
+
+ template <class T> inline bool operator==(const ProtectedPtr<T>& a, const ProtectedPtr<T>& b) { return a.get() == b.get(); }
+ template <class T> inline bool operator==(const ProtectedPtr<T>& a, const T* b) { return a.get() == b; }
+ template <class T> inline bool operator==(const T* a, const ProtectedPtr<T>& b) { return a == b.get(); }
+
+ template <class T> inline bool operator!=(const ProtectedPtr<T>& a, const ProtectedPtr<T>& b) { return a.get() != b.get(); }
+ template <class T> inline bool operator!=(const ProtectedPtr<T>& a, const T* b) { return a.get() != b; }
+ template <class T> inline bool operator!=(const T* a, const ProtectedPtr<T>& b) { return a != b.get(); }
+
+ inline bool operator==(const ProtectedJSValue& a, const ProtectedJSValue& b) { return a.get() == b.get(); }
+ inline bool operator==(const ProtectedJSValue& a, const JSValue b) { return a.get() == b; }
+ template <class T> inline bool operator==(const ProtectedJSValue& a, const ProtectedPtr<T>& b) { return a.get() == JSValue(b.get()); }
+ inline bool operator==(const JSValue a, const ProtectedJSValue& b) { return a == b.get(); }
+ template <class T> inline bool operator==(const ProtectedPtr<T>& a, const ProtectedJSValue& b) { return JSValue(a.get()) == b.get(); }
+
+ inline bool operator!=(const ProtectedJSValue& a, const ProtectedJSValue& b) { return a.get() != b.get(); }
+ inline bool operator!=(const ProtectedJSValue& a, const JSValue b) { return a.get() != b; }
+ template <class T> inline bool operator!=(const ProtectedJSValue& a, const ProtectedPtr<T>& b) { return a.get() != JSValue(b.get()); }
+ inline bool operator!=(const JSValue a, const ProtectedJSValue& b) { return a != b.get(); }
+ template <class T> inline bool operator!=(const ProtectedPtr<T>& a, const ProtectedJSValue& b) { return JSValue(a.get()) != b.get(); }
+
+} // namespace JSC
+
+#endif // Protect_h
diff --git a/Source/JavaScriptCore/runtime/PrototypeFunction.cpp b/Source/JavaScriptCore/runtime/PrototypeFunction.cpp
new file mode 100644
index 0000000..3529080
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/PrototypeFunction.cpp
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 1999-2002 Harri Porten (porten@kde.org)
+ * Copyright (C) 2001 Peter Kelly (pmk@post.com)
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2007 Cameron Zwarich (cwzwarich@uwaterloo.ca)
+ * Copyright (C) 2007 Maks Orlovich
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+#include "PrototypeFunction.h"
+
+#include "JSGlobalObject.h"
+#include <wtf/Assertions.h>
+
+namespace JSC {
+
+ASSERT_CLASS_FITS_IN_CELL(PrototypeFunction);
+
+PrototypeFunction::PrototypeFunction(ExecState* exec, JSGlobalObject* globalObject, int length, const Identifier& name, NativeFunction function)
+ : InternalFunction(&exec->globalData(), globalObject, exec->lexicalGlobalObject()->prototypeFunctionStructure(), name)
+ , m_function(function)
+{
+ ASSERT_ARG(function, function);
+ putDirect(exec->propertyNames().length, jsNumber(length), DontDelete | ReadOnly | DontEnum);
+}
+
+PrototypeFunction::PrototypeFunction(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> prototypeFunctionStructure, int length, const Identifier& name, NativeFunction function)
+ : InternalFunction(&exec->globalData(), globalObject, prototypeFunctionStructure, name)
+ , m_function(function)
+{
+ ASSERT_ARG(function, function);
+ putDirect(exec->propertyNames().length, jsNumber(length), DontDelete | ReadOnly | DontEnum);
+}
+
+CallType PrototypeFunction::getCallData(CallData& callData)
+{
+ callData.native.function = m_function;
+ return CallTypeHost;
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/PrototypeFunction.h b/Source/JavaScriptCore/runtime/PrototypeFunction.h
new file mode 100644
index 0000000..6ca2342
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/PrototypeFunction.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
+ * Copyright (C) 2003, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2007 Cameron Zwarich (cwzwarich@uwaterloo.ca)
+ * Copyright (C) 2007 Maks Orlovich
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PrototypeFunction_h
+#define PrototypeFunction_h
+
+#include "InternalFunction.h"
+#include "CallData.h"
+
+namespace JSC {
+
+ class PrototypeFunction : public InternalFunction {
+ public:
+ PrototypeFunction(ExecState*, JSGlobalObject*, int length, const Identifier&, NativeFunction);
+ PrototypeFunction(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure>, int length, const Identifier&, NativeFunction);
+
+ private:
+ virtual CallType getCallData(CallData&);
+
+ const NativeFunction m_function;
+ };
+
+} // namespace JSC
+
+#endif // PrototypeFunction_h
diff --git a/Source/JavaScriptCore/runtime/PutPropertySlot.h b/Source/JavaScriptCore/runtime/PutPropertySlot.h
new file mode 100644
index 0000000..4b0b394
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/PutPropertySlot.h
@@ -0,0 +1,80 @@
+// -*- mode: c++; c-basic-offset: 4 -*-
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef PutPropertySlot_h
+#define PutPropertySlot_h
+
+#include <wtf/Assertions.h>
+
+namespace JSC {
+
+ class JSObject;
+ class JSFunction;
+
+ class PutPropertySlot {
+ public:
+ enum Type { Uncachable, ExistingProperty, NewProperty };
+
+ PutPropertySlot(bool isStrictMode = false)
+ : m_type(Uncachable)
+ , m_base(0)
+ , m_isStrictMode(isStrictMode)
+ {
+ }
+
+ void setExistingProperty(JSObject* base, size_t offset)
+ {
+ m_type = ExistingProperty;
+ m_base = base;
+ m_offset = offset;
+ }
+
+ void setNewProperty(JSObject* base, size_t offset)
+ {
+ m_type = NewProperty;
+ m_base = base;
+ m_offset = offset;
+ }
+
+ Type type() const { return m_type; }
+ JSObject* base() const { return m_base; }
+
+ bool isStrictMode() const { return m_isStrictMode; }
+ bool isCacheable() const { return m_type != Uncachable; }
+ size_t cachedOffset() const {
+ ASSERT(isCacheable());
+ return m_offset;
+ }
+ private:
+ Type m_type;
+ JSObject* m_base;
+ size_t m_offset;
+ bool m_isStrictMode;
+ };
+
+} // namespace JSC
+
+#endif // PutPropertySlot_h
diff --git a/Source/JavaScriptCore/runtime/RegExp.cpp b/Source/JavaScriptCore/runtime/RegExp.cpp
new file mode 100644
index 0000000..664a7fb
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/RegExp.cpp
@@ -0,0 +1,248 @@
+/*
+ * Copyright (C) 1999-2001, 2004 Harri Porten (porten@kde.org)
+ * Copyright (c) 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2009 Torch Mobile, Inc.
+ * Copyright (C) 2010 Peter Varga (pvarga@inf.u-szeged.hu), University of Szeged
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#include "config.h"
+#include "RegExp.h"
+#include "Lexer.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <wtf/Assertions.h>
+#include <wtf/OwnArrayPtr.h>
+
+#include "yarr/RegexJIT.h"
+#include "yarr/RegexInterpreter.h"
+#include "yarr/RegexPattern.h"
+
+namespace JSC {
+
+struct RegExpRepresentation {
+#if ENABLE(YARR_JIT)
+ Yarr::RegexCodeBlock m_regExpJITCode;
+#endif
+ OwnPtr<Yarr::BytecodePattern> m_regExpBytecode;
+};
+
+inline RegExp::RegExp(JSGlobalData* globalData, const UString& patternString, const UString& flags)
+ : m_patternString(patternString)
+ , m_flagBits(0)
+ , m_constructionError(0)
+ , m_numSubpatterns(0)
+#if ENABLE(REGEXP_TRACING)
+ , m_rtMatchCallCount(0)
+ , m_rtMatchFoundCount(0)
+#endif
+ , m_representation(adoptPtr(new RegExpRepresentation))
+{
+ // NOTE: The global flag is handled on a case-by-case basis by functions like
+ // String::match and RegExpObject::match.
+ if (!flags.isNull()) {
+ if (flags.find('g') != notFound)
+ m_flagBits |= Global;
+ if (flags.find('i') != notFound)
+ m_flagBits |= IgnoreCase;
+ if (flags.find('m') != notFound)
+ m_flagBits |= Multiline;
+ }
+
+ m_state = compile(globalData);
+}
+
+RegExp::~RegExp()
+{
+}
+
+PassRefPtr<RegExp> RegExp::create(JSGlobalData* globalData, const UString& patternString, const UString& flags)
+{
+ RefPtr<RegExp> res = adoptRef(new RegExp(globalData, patternString, flags));
+#if ENABLE(REGEXP_TRACING)
+ globalData->addRegExpToTrace(res);
+#endif
+ return res.release();
+}
+
+RegExp::RegExpState RegExp::compile(JSGlobalData* globalData)
+{
+ Yarr::RegexPattern pattern(m_patternString, ignoreCase(), multiline(), &m_constructionError);
+ if (m_constructionError)
+ return ParseError;
+
+ m_numSubpatterns = pattern.m_numSubpatterns;
+
+ RegExpState res = ByteCode;
+
+#if ENABLE(YARR_JIT)
+ if (!pattern.m_containsBackreferences && globalData->canUseJIT()) {
+ Yarr::jitCompileRegex(pattern, globalData, m_representation->m_regExpJITCode);
+#if ENABLE(YARR_JIT_DEBUG)
+ if (!m_representation->m_regExpJITCode.isFallBack())
+ res = JITCode;
+ else
+ res = ByteCode;
+#else
+ if (!m_representation->m_regExpJITCode.isFallBack())
+ return JITCode;
+#endif
+ }
+#endif
+
+ m_representation->m_regExpBytecode = Yarr::byteCompileRegex(pattern, &globalData->m_regexAllocator);
+
+ return res;
+}
+
+int RegExp::match(const UString& s, int startOffset, Vector<int, 32>* ovector)
+{
+ if (startOffset < 0)
+ startOffset = 0;
+
+#if ENABLE(REGEXP_TRACING)
+ m_rtMatchCallCount++;
+#endif
+
+ if (static_cast<unsigned>(startOffset) > s.length() || s.isNull())
+ return -1;
+
+ if (m_state != ParseError) {
+ int offsetVectorSize = (m_numSubpatterns + 1) * 2;
+ int* offsetVector;
+ Vector<int, 32> nonReturnedOvector;
+ if (ovector) {
+ ovector->resize(offsetVectorSize);
+ offsetVector = ovector->data();
+ } else {
+ nonReturnedOvector.resize(offsetVectorSize);
+ offsetVector = nonReturnedOvector.data();
+ }
+
+ ASSERT(offsetVector);
+ // Initialize offsetVector with the return value (index 0) and the
+ // first subpattern start indicies (even index values) set to -1.
+ // No need to init the subpattern end indicies.
+ for (unsigned j = 0, i = 0; i < m_numSubpatterns + 1; j += 2, i++)
+ offsetVector[j] = -1;
+
+ int result;
+#if ENABLE(YARR_JIT)
+ if (m_state == JITCode) {
+ result = Yarr::executeRegex(m_representation->m_regExpJITCode, s.characters(), startOffset, s.length(), offsetVector);
+#if ENABLE(YARR_JIT_DEBUG)
+ matchCompareWithInterpreter(s, startOffset, offsetVector, result);
+#endif
+ } else
+#endif
+ result = Yarr::interpretRegex(m_representation->m_regExpBytecode.get(), s.characters(), startOffset, s.length(), offsetVector);
+ ASSERT(result >= -1);
+
+#if ENABLE(REGEXP_TRACING)
+ if (result != -1)
+ m_rtMatchFoundCount++;
+#endif
+
+ return result;
+ }
+
+ return -1;
+}
+
+
+#if ENABLE(YARR_JIT_DEBUG)
+void RegExp::matchCompareWithInterpreter(const UString& s, int startOffset, int* offsetVector, int jitResult)
+{
+ int offsetVectorSize = (m_numSubpatterns + 1) * 2;
+ Vector<int, 32> interpreterOvector;
+ interpreterOvector.resize(offsetVectorSize);
+ int* interpreterOffsetVector = interpreterOvector.data();
+ int interpreterResult = 0;
+ int differences = 0;
+
+ // Initialize interpreterOffsetVector with the return value (index 0) and the
+ // first subpattern start indicies (even index values) set to -1.
+ // No need to init the subpattern end indicies.
+ for (unsigned j = 0, i = 0; i < m_numSubpatterns + 1; j += 2, i++)
+ interpreterOffsetVector[j] = -1;
+
+ interpreterResult = Yarr::interpretRegex(m_representation->m_regExpBytecode.get(), s.characters(), startOffset, s.length(), interpreterOffsetVector);
+
+ if (jitResult != interpreterResult)
+ differences++;
+
+ for (unsigned j = 2, i = 0; i < m_numSubpatterns; j +=2, i++)
+ if ((offsetVector[j] != interpreterOffsetVector[j])
+ || ((offsetVector[j] >= 0) && (offsetVector[j+1] != interpreterOffsetVector[j+1])))
+ differences++;
+
+ if (differences) {
+ fprintf(stderr, "RegExp Discrepency for /%s/\n string input ", pattern().utf8().data());
+ unsigned segmentLen = s.length() - static_cast<unsigned>(startOffset);
+
+ fprintf(stderr, (segmentLen < 150) ? "\"%s\"\n" : "\"%148s...\"\n", s.utf8().data() + startOffset);
+
+ if (jitResult != interpreterResult) {
+ fprintf(stderr, " JIT result = %d, blah interpreted result = %d\n", jitResult, interpreterResult);
+ differences--;
+ } else {
+ fprintf(stderr, " Correct result = %d\n", jitResult);
+ }
+
+ if (differences) {
+ for (unsigned j = 2, i = 0; i < m_numSubpatterns; j +=2, i++) {
+ if (offsetVector[j] != interpreterOffsetVector[j])
+ fprintf(stderr, " JIT offset[%d] = %d, interpreted offset[%d] = %d\n", j, offsetVector[j], j, interpreterOffsetVector[j]);
+ if ((offsetVector[j] >= 0) && (offsetVector[j+1] != interpreterOffsetVector[j+1]))
+ fprintf(stderr, " JIT offset[%d] = %d, interpreted offset[%d] = %d\n", j+1, offsetVector[j+1], j+1, interpreterOffsetVector[j+1]);
+ }
+ }
+ }
+}
+#endif
+
+#if ENABLE(REGEXP_TRACING)
+ void RegExp::printTraceData()
+ {
+ char formattedPattern[41];
+ char rawPattern[41];
+
+ strncpy(rawPattern, pattern().utf8().data(), 40);
+ rawPattern[40]= '\0';
+
+ int pattLen = strlen(rawPattern);
+
+ snprintf(formattedPattern, 41, (pattLen <= 38) ? "/%.38s/" : "/%.36s...", rawPattern);
+
+#if ENABLE(YARR_JIT)
+ Yarr::RegexCodeBlock& codeBlock = m_representation->m_regExpJITCode;
+
+ char jitAddr[20];
+ if (m_state == JITCode)
+ sprintf(jitAddr, "fallback");
+ else
+ sprintf(jitAddr, "0x%014lx", reinterpret_cast<unsigned long int>(codeBlock.getAddr()));
+#else
+ const char* jitAddr = "JIT Off";
+#endif
+
+ printf("%-40.40s %16.16s %10d %10d\n", formattedPattern, jitAddr, m_rtMatchCallCount, m_rtMatchFoundCount);
+ }
+#endif
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/RegExp.h b/Source/JavaScriptCore/runtime/RegExp.h
new file mode 100644
index 0000000..d99befb
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/RegExp.h
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
+ * Copyright (C) 2007, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2009 Torch Mobile, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifndef RegExp_h
+#define RegExp_h
+
+#include "UString.h"
+#include "ExecutableAllocator.h"
+#include <wtf/Forward.h>
+#include <wtf/RefCounted.h>
+
+namespace JSC {
+
+ struct RegExpRepresentation;
+ class JSGlobalData;
+
+ class RegExp : public RefCounted<RegExp> {
+ public:
+ static PassRefPtr<RegExp> create(JSGlobalData* globalData, const UString& pattern, const UString& flags);
+ ~RegExp();
+
+ bool global() const { return m_flagBits & Global; }
+ bool ignoreCase() const { return m_flagBits & IgnoreCase; }
+ bool multiline() const { return m_flagBits & Multiline; }
+
+ const UString& pattern() const { return m_patternString; }
+
+ bool isValid() const { return !m_constructionError; }
+ const char* errorMessage() const { return m_constructionError; }
+
+ int match(const UString&, int startOffset, Vector<int, 32>* ovector = 0);
+ unsigned numSubpatterns() const { return m_numSubpatterns; }
+
+#if ENABLE(REGEXP_TRACING)
+ void printTraceData();
+#endif
+
+ private:
+ RegExp(JSGlobalData* globalData, const UString& pattern, const UString& flags);
+
+ enum RegExpState {
+ ParseError,
+ JITCode,
+ ByteCode
+ } m_state;
+
+ RegExpState compile(JSGlobalData*);
+
+#if ENABLE(YARR_JIT_DEBUG)
+ void matchCompareWithInterpreter(const UString&, int startOffset, int* offsetVector, int jitResult);
+#endif
+
+ enum FlagBits { Global = 1, IgnoreCase = 2, Multiline = 4 };
+ UString m_patternString;
+ int m_flagBits;
+ const char* m_constructionError;
+ unsigned m_numSubpatterns;
+#if ENABLE(REGEXP_TRACING)
+ unsigned m_rtMatchCallCount;
+ unsigned m_rtMatchFoundCount;
+#endif
+
+ OwnPtr<RegExpRepresentation> m_representation;
+ };
+
+} // namespace JSC
+
+#endif // RegExp_h
diff --git a/Source/JavaScriptCore/runtime/RegExpCache.cpp b/Source/JavaScriptCore/runtime/RegExpCache.cpp
new file mode 100644
index 0000000..d101758
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/RegExpCache.cpp
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2010 University of Szeged
+ * Copyright (C) 2010 Renata Hodovan (hodovan@inf.u-szeged.hu)
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY UNIVERSITY OF SZEGED ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL UNIVERSITY OF SZEGED OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#include "RegExpCache.h"
+
+namespace JSC {
+
+PassRefPtr<RegExp> RegExpCache::lookupOrCreate(const UString& patternString, const UString& flags)
+{
+ if (patternString.length() < maxCacheablePatternLength) {
+ pair<RegExpCacheMap::iterator, bool> result = m_cacheMap.add(RegExpKey(flags, patternString), 0);
+ if (!result.second)
+ return result.first->second;
+ else
+ return create(patternString, flags, result.first);
+ }
+ return create(patternString, flags, m_cacheMap.end());
+}
+
+PassRefPtr<RegExp> RegExpCache::create(const UString& patternString, const UString& flags, RegExpCacheMap::iterator iterator)
+{
+ RefPtr<RegExp> regExp = RegExp::create(m_globalData, patternString, flags);
+
+ if (patternString.length() >= maxCacheablePatternLength)
+ return regExp;
+
+ RegExpKey key = RegExpKey(flags, patternString);
+ iterator->first = key;
+ iterator->second = regExp;
+
+ ++m_nextKeyToEvict;
+ if (m_nextKeyToEvict == maxCacheableEntries) {
+ m_nextKeyToEvict = 0;
+ m_isFull = true;
+ }
+ if (m_isFull)
+ m_cacheMap.remove(RegExpKey(patternKeyArray[m_nextKeyToEvict].flagsValue, patternKeyArray[m_nextKeyToEvict].pattern));
+
+ patternKeyArray[m_nextKeyToEvict].flagsValue = key.flagsValue;
+ patternKeyArray[m_nextKeyToEvict].pattern = patternString.impl();
+ return regExp;
+}
+
+RegExpCache::RegExpCache(JSGlobalData* globalData)
+ : m_globalData(globalData)
+ , m_nextKeyToEvict(-1)
+ , m_isFull(false)
+{
+}
+
+}
diff --git a/Source/JavaScriptCore/runtime/RegExpCache.h b/Source/JavaScriptCore/runtime/RegExpCache.h
new file mode 100644
index 0000000..b5b637f
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/RegExpCache.h
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2010 University of Szeged
+ * Copyright (C) 2010 Renata Hodovan (hodovan@inf.u-szeged.hu)
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY UNIVERSITY OF SZEGED ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL UNIVERSITY OF SZEGED OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "RegExp.h"
+#include "RegExpKey.h"
+#include "UString.h"
+#include <wtf/FixedArray.h>
+#include <wtf/HashMap.h>
+
+#ifndef RegExpCache_h
+#define RegExpCache_h
+
+namespace JSC {
+
+class RegExpCache {
+
+typedef HashMap<RegExpKey, RefPtr<RegExp> > RegExpCacheMap;
+
+public:
+ PassRefPtr<RegExp> lookupOrCreate(const UString& patternString, const UString& flags);
+ PassRefPtr<RegExp> create(const UString& patternString, const UString& flags, RegExpCacheMap::iterator iterator);
+ RegExpCache(JSGlobalData* globalData);
+
+private:
+ static const unsigned maxCacheablePatternLength = 256;
+
+#if PLATFORM(IOS)
+ // The RegExpCache can currently hold onto multiple Mb of memory;
+ // as a short-term fix some embedded platforms may wish to reduce the cache size.
+ static const int maxCacheableEntries = 32;
+#else
+ static const int maxCacheableEntries = 256;
+#endif
+
+ FixedArray<RegExpKey, maxCacheableEntries> patternKeyArray;
+ RegExpCacheMap m_cacheMap;
+ JSGlobalData* m_globalData;
+ int m_nextKeyToEvict;
+ bool m_isFull;
+};
+
+} // namespace JSC
+
+#endif // RegExpCache_h
diff --git a/Source/JavaScriptCore/runtime/RegExpConstructor.cpp b/Source/JavaScriptCore/runtime/RegExpConstructor.cpp
new file mode 100644
index 0000000..21ca170
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/RegExpConstructor.cpp
@@ -0,0 +1,361 @@
+/*
+ * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
+ * Copyright (C) 2003, 2007, 2008 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2009 Torch Mobile, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#include "config.h"
+#include "RegExpConstructor.h"
+
+#include "ArrayPrototype.h"
+#include "Error.h"
+#include "ExceptionHelpers.h"
+#include "JSArray.h"
+#include "JSFunction.h"
+#include "JSString.h"
+#include "Lookup.h"
+#include "ObjectPrototype.h"
+#include "RegExpMatchesArray.h"
+#include "RegExpObject.h"
+#include "RegExpPrototype.h"
+#include "RegExp.h"
+#include "RegExpCache.h"
+#include "UStringConcatenate.h"
+#include <wtf/PassOwnPtr.h>
+
+namespace JSC {
+
+static JSValue regExpConstructorInput(ExecState*, JSValue, const Identifier&);
+static JSValue regExpConstructorMultiline(ExecState*, JSValue, const Identifier&);
+static JSValue regExpConstructorLastMatch(ExecState*, JSValue, const Identifier&);
+static JSValue regExpConstructorLastParen(ExecState*, JSValue, const Identifier&);
+static JSValue regExpConstructorLeftContext(ExecState*, JSValue, const Identifier&);
+static JSValue regExpConstructorRightContext(ExecState*, JSValue, const Identifier&);
+static JSValue regExpConstructorDollar1(ExecState*, JSValue, const Identifier&);
+static JSValue regExpConstructorDollar2(ExecState*, JSValue, const Identifier&);
+static JSValue regExpConstructorDollar3(ExecState*, JSValue, const Identifier&);
+static JSValue regExpConstructorDollar4(ExecState*, JSValue, const Identifier&);
+static JSValue regExpConstructorDollar5(ExecState*, JSValue, const Identifier&);
+static JSValue regExpConstructorDollar6(ExecState*, JSValue, const Identifier&);
+static JSValue regExpConstructorDollar7(ExecState*, JSValue, const Identifier&);
+static JSValue regExpConstructorDollar8(ExecState*, JSValue, const Identifier&);
+static JSValue regExpConstructorDollar9(ExecState*, JSValue, const Identifier&);
+
+static void setRegExpConstructorInput(ExecState*, JSObject*, JSValue);
+static void setRegExpConstructorMultiline(ExecState*, JSObject*, JSValue);
+
+} // namespace JSC
+
+#include "RegExpConstructor.lut.h"
+
+namespace JSC {
+
+ASSERT_CLASS_FITS_IN_CELL(RegExpConstructor);
+
+const ClassInfo RegExpConstructor::info = { "Function", &InternalFunction::info, 0, ExecState::regExpConstructorTable };
+
+/* Source for RegExpConstructor.lut.h
+@begin regExpConstructorTable
+ input regExpConstructorInput None
+ $_ regExpConstructorInput DontEnum
+ multiline regExpConstructorMultiline None
+ $* regExpConstructorMultiline DontEnum
+ lastMatch regExpConstructorLastMatch DontDelete|ReadOnly
+ $& regExpConstructorLastMatch DontDelete|ReadOnly|DontEnum
+ lastParen regExpConstructorLastParen DontDelete|ReadOnly
+ $+ regExpConstructorLastParen DontDelete|ReadOnly|DontEnum
+ leftContext regExpConstructorLeftContext DontDelete|ReadOnly
+ $` regExpConstructorLeftContext DontDelete|ReadOnly|DontEnum
+ rightContext regExpConstructorRightContext DontDelete|ReadOnly
+ $' regExpConstructorRightContext DontDelete|ReadOnly|DontEnum
+ $1 regExpConstructorDollar1 DontDelete|ReadOnly
+ $2 regExpConstructorDollar2 DontDelete|ReadOnly
+ $3 regExpConstructorDollar3 DontDelete|ReadOnly
+ $4 regExpConstructorDollar4 DontDelete|ReadOnly
+ $5 regExpConstructorDollar5 DontDelete|ReadOnly
+ $6 regExpConstructorDollar6 DontDelete|ReadOnly
+ $7 regExpConstructorDollar7 DontDelete|ReadOnly
+ $8 regExpConstructorDollar8 DontDelete|ReadOnly
+ $9 regExpConstructorDollar9 DontDelete|ReadOnly
+@end
+*/
+
+RegExpConstructor::RegExpConstructor(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, RegExpPrototype* regExpPrototype)
+ : InternalFunction(&exec->globalData(), globalObject, structure, Identifier(exec, "RegExp"))
+ , d(adoptPtr(new RegExpConstructorPrivate))
+{
+ // ECMA 15.10.5.1 RegExp.prototype
+ putDirectWithoutTransition(exec->propertyNames().prototype, regExpPrototype, DontEnum | DontDelete | ReadOnly);
+
+ // no. of arguments for constructor
+ putDirectWithoutTransition(exec->propertyNames().length, jsNumber(2), ReadOnly | DontDelete | DontEnum);
+}
+
+RegExpMatchesArray::RegExpMatchesArray(ExecState* exec, RegExpConstructorPrivate* data)
+ : JSArray(exec->lexicalGlobalObject()->regExpMatchesArrayStructure(), data->lastNumSubPatterns + 1, CreateInitialized)
+{
+ RegExpConstructorPrivate* d = new RegExpConstructorPrivate;
+ d->input = data->lastInput;
+ d->lastInput = data->lastInput;
+ d->lastNumSubPatterns = data->lastNumSubPatterns;
+ unsigned offsetVectorSize = (data->lastNumSubPatterns + 1) * 2; // only copying the result part of the vector
+ d->lastOvector().resize(offsetVectorSize);
+ memcpy(d->lastOvector().data(), data->lastOvector().data(), offsetVectorSize * sizeof(int));
+ // d->multiline is not needed, and remains uninitialized
+
+ setSubclassData(d);
+}
+
+RegExpMatchesArray::~RegExpMatchesArray()
+{
+ delete static_cast<RegExpConstructorPrivate*>(subclassData());
+}
+
+void RegExpMatchesArray::fillArrayInstance(ExecState* exec)
+{
+ RegExpConstructorPrivate* d = static_cast<RegExpConstructorPrivate*>(subclassData());
+ ASSERT(d);
+
+ unsigned lastNumSubpatterns = d->lastNumSubPatterns;
+
+ for (unsigned i = 0; i <= lastNumSubpatterns; ++i) {
+ int start = d->lastOvector()[2 * i];
+ if (start >= 0)
+ JSArray::put(exec, i, jsSubstring(exec, d->lastInput, start, d->lastOvector()[2 * i + 1] - start));
+ else
+ JSArray::put(exec, i, jsUndefined());
+ }
+
+ PutPropertySlot slot;
+ JSArray::put(exec, exec->propertyNames().index, jsNumber(d->lastOvector()[0]), slot);
+ JSArray::put(exec, exec->propertyNames().input, jsString(exec, d->input), slot);
+
+ delete d;
+ setSubclassData(0);
+}
+
+JSObject* RegExpConstructor::arrayOfMatches(ExecState* exec) const
+{
+ return new (exec) RegExpMatchesArray(exec, d.get());
+}
+
+JSValue RegExpConstructor::getBackref(ExecState* exec, unsigned i) const
+{
+ if (!d->lastOvector().isEmpty() && i <= d->lastNumSubPatterns) {
+ int start = d->lastOvector()[2 * i];
+ if (start >= 0)
+ return jsSubstring(exec, d->lastInput, start, d->lastOvector()[2 * i + 1] - start);
+ }
+ return jsEmptyString(exec);
+}
+
+JSValue RegExpConstructor::getLastParen(ExecState* exec) const
+{
+ unsigned i = d->lastNumSubPatterns;
+ if (i > 0) {
+ ASSERT(!d->lastOvector().isEmpty());
+ int start = d->lastOvector()[2 * i];
+ if (start >= 0)
+ return jsSubstring(exec, d->lastInput, start, d->lastOvector()[2 * i + 1] - start);
+ }
+ return jsEmptyString(exec);
+}
+
+JSValue RegExpConstructor::getLeftContext(ExecState* exec) const
+{
+ if (!d->lastOvector().isEmpty())
+ return jsSubstring(exec, d->lastInput, 0, d->lastOvector()[0]);
+ return jsEmptyString(exec);
+}
+
+JSValue RegExpConstructor::getRightContext(ExecState* exec) const
+{
+ if (!d->lastOvector().isEmpty())
+ return jsSubstring(exec, d->lastInput, d->lastOvector()[1], d->lastInput.length() - d->lastOvector()[1]);
+ return jsEmptyString(exec);
+}
+
+bool RegExpConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
+{
+ return getStaticValueSlot<RegExpConstructor, InternalFunction>(exec, ExecState::regExpConstructorTable(exec), this, propertyName, slot);
+}
+
+bool RegExpConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
+{
+ return getStaticValueDescriptor<RegExpConstructor, InternalFunction>(exec, ExecState::regExpConstructorTable(exec), this, propertyName, descriptor);
+}
+
+JSValue regExpConstructorDollar1(ExecState* exec, JSValue slotBase, const Identifier&)
+{
+ return asRegExpConstructor(slotBase)->getBackref(exec, 1);
+}
+
+JSValue regExpConstructorDollar2(ExecState* exec, JSValue slotBase, const Identifier&)
+{
+ return asRegExpConstructor(slotBase)->getBackref(exec, 2);
+}
+
+JSValue regExpConstructorDollar3(ExecState* exec, JSValue slotBase, const Identifier&)
+{
+ return asRegExpConstructor(slotBase)->getBackref(exec, 3);
+}
+
+JSValue regExpConstructorDollar4(ExecState* exec, JSValue slotBase, const Identifier&)
+{
+ return asRegExpConstructor(slotBase)->getBackref(exec, 4);
+}
+
+JSValue regExpConstructorDollar5(ExecState* exec, JSValue slotBase, const Identifier&)
+{
+ return asRegExpConstructor(slotBase)->getBackref(exec, 5);
+}
+
+JSValue regExpConstructorDollar6(ExecState* exec, JSValue slotBase, const Identifier&)
+{
+ return asRegExpConstructor(slotBase)->getBackref(exec, 6);
+}
+
+JSValue regExpConstructorDollar7(ExecState* exec, JSValue slotBase, const Identifier&)
+{
+ return asRegExpConstructor(slotBase)->getBackref(exec, 7);
+}
+
+JSValue regExpConstructorDollar8(ExecState* exec, JSValue slotBase, const Identifier&)
+{
+ return asRegExpConstructor(slotBase)->getBackref(exec, 8);
+}
+
+JSValue regExpConstructorDollar9(ExecState* exec, JSValue slotBase, const Identifier&)
+{
+ return asRegExpConstructor(slotBase)->getBackref(exec, 9);
+}
+
+JSValue regExpConstructorInput(ExecState* exec, JSValue slotBase, const Identifier&)
+{
+ return jsString(exec, asRegExpConstructor(slotBase)->input());
+}
+
+JSValue regExpConstructorMultiline(ExecState*, JSValue slotBase, const Identifier&)
+{
+ return jsBoolean(asRegExpConstructor(slotBase)->multiline());
+}
+
+JSValue regExpConstructorLastMatch(ExecState* exec, JSValue slotBase, const Identifier&)
+{
+ return asRegExpConstructor(slotBase)->getBackref(exec, 0);
+}
+
+JSValue regExpConstructorLastParen(ExecState* exec, JSValue slotBase, const Identifier&)
+{
+ return asRegExpConstructor(slotBase)->getLastParen(exec);
+}
+
+JSValue regExpConstructorLeftContext(ExecState* exec, JSValue slotBase, const Identifier&)
+{
+ return asRegExpConstructor(slotBase)->getLeftContext(exec);
+}
+
+JSValue regExpConstructorRightContext(ExecState* exec, JSValue slotBase, const Identifier&)
+{
+ return asRegExpConstructor(slotBase)->getRightContext(exec);
+}
+
+void RegExpConstructor::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
+{
+ lookupPut<RegExpConstructor, InternalFunction>(exec, propertyName, value, ExecState::regExpConstructorTable(exec), this, slot);
+}
+
+void setRegExpConstructorInput(ExecState* exec, JSObject* baseObject, JSValue value)
+{
+ asRegExpConstructor(baseObject)->setInput(value.toString(exec));
+}
+
+void setRegExpConstructorMultiline(ExecState* exec, JSObject* baseObject, JSValue value)
+{
+ asRegExpConstructor(baseObject)->setMultiline(value.toBoolean(exec));
+}
+
+// ECMA 15.10.4
+JSObject* constructRegExp(ExecState* exec, const ArgList& args)
+{
+ JSValue arg0 = args.at(0);
+ JSValue arg1 = args.at(1);
+
+ if (arg0.inherits(&RegExpObject::info)) {
+ if (!arg1.isUndefined())
+ return throwError(exec, createTypeError(exec, "Cannot supply flags when constructing one RegExp from another."));
+ return asObject(arg0);
+ }
+
+ UString pattern = arg0.isUndefined() ? UString("") : arg0.toString(exec);
+ UString flags = arg1.isUndefined() ? UString("") : arg1.toString(exec);
+
+ RefPtr<RegExp> regExp = exec->globalData().regExpCache()->lookupOrCreate(pattern, flags);
+ if (!regExp->isValid())
+ return throwError(exec, createSyntaxError(exec, makeUString("Invalid regular expression: ", regExp->errorMessage())));
+ return new (exec) RegExpObject(exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->regExpStructure(), regExp.release());
+}
+
+static EncodedJSValue JSC_HOST_CALL constructWithRegExpConstructor(ExecState* exec)
+{
+ ArgList args(exec);
+ return JSValue::encode(constructRegExp(exec, args));
+}
+
+ConstructType RegExpConstructor::getConstructData(ConstructData& constructData)
+{
+ constructData.native.function = constructWithRegExpConstructor;
+ return ConstructTypeHost;
+}
+
+// ECMA 15.10.3
+static EncodedJSValue JSC_HOST_CALL callRegExpConstructor(ExecState* exec)
+{
+ ArgList args(exec);
+ return JSValue::encode(constructRegExp(exec, args));
+}
+
+CallType RegExpConstructor::getCallData(CallData& callData)
+{
+ callData.native.function = callRegExpConstructor;
+ return CallTypeHost;
+}
+
+void RegExpConstructor::setInput(const UString& input)
+{
+ d->input = input;
+}
+
+const UString& RegExpConstructor::input() const
+{
+ // Can detect a distinct initial state that is invisible to JavaScript, by checking for null
+ // state (since jsString turns null strings to empty strings).
+ return d->input;
+}
+
+void RegExpConstructor::setMultiline(bool multiline)
+{
+ d->multiline = multiline;
+}
+
+bool RegExpConstructor::multiline() const
+{
+ return d->multiline;
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/RegExpConstructor.h b/Source/JavaScriptCore/runtime/RegExpConstructor.h
new file mode 100644
index 0000000..58abde5
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/RegExpConstructor.h
@@ -0,0 +1,133 @@
+/*
+ * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
+ * Copyright (C) 2003, 2007, 2008 Apple Inc. All Rights Reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifndef RegExpConstructor_h
+#define RegExpConstructor_h
+
+#include "InternalFunction.h"
+#include "RegExp.h"
+#include <wtf/OwnPtr.h>
+
+namespace JSC {
+
+ class RegExp;
+ class RegExpPrototype;
+ struct RegExpConstructorPrivate;
+
+ struct RegExpConstructorPrivate : FastAllocBase {
+ // Global search cache / settings
+ RegExpConstructorPrivate()
+ : lastNumSubPatterns(0)
+ , multiline(false)
+ , lastOvectorIndex(0)
+ {
+ }
+
+ const Vector<int, 32>& lastOvector() const { return ovector[lastOvectorIndex]; }
+ Vector<int, 32>& lastOvector() { return ovector[lastOvectorIndex]; }
+ Vector<int, 32>& tempOvector() { return ovector[lastOvectorIndex ? 0 : 1]; }
+ void changeLastOvector() { lastOvectorIndex = lastOvectorIndex ? 0 : 1; }
+
+ UString input;
+ UString lastInput;
+ Vector<int, 32> ovector[2];
+ unsigned lastNumSubPatterns : 30;
+ bool multiline : 1;
+ unsigned lastOvectorIndex : 1;
+ };
+
+ class RegExpConstructor : public InternalFunction {
+ public:
+ RegExpConstructor(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure>, RegExpPrototype*);
+
+ static PassRefPtr<Structure> createStructure(JSValue prototype)
+ {
+ return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount);
+ }
+
+ virtual void put(ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&);
+ virtual bool getOwnPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&);
+ virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
+
+ static const ClassInfo info;
+
+ void performMatch(RegExp*, const UString&, int startOffset, int& position, int& length, int** ovector = 0);
+ JSObject* arrayOfMatches(ExecState*) const;
+
+ void setInput(const UString&);
+ const UString& input() const;
+
+ void setMultiline(bool);
+ bool multiline() const;
+
+ JSValue getBackref(ExecState*, unsigned) const;
+ JSValue getLastParen(ExecState*) const;
+ JSValue getLeftContext(ExecState*) const;
+ JSValue getRightContext(ExecState*) const;
+
+ protected:
+ static const unsigned StructureFlags = OverridesGetOwnPropertySlot | ImplementsHasInstance | InternalFunction::StructureFlags;
+
+ private:
+ virtual ConstructType getConstructData(ConstructData&);
+ virtual CallType getCallData(CallData&);
+
+ virtual const ClassInfo* classInfo() const { return &info; }
+
+ OwnPtr<RegExpConstructorPrivate> d;
+ };
+
+ RegExpConstructor* asRegExpConstructor(JSValue);
+
+ JSObject* constructRegExp(ExecState*, const ArgList&);
+
+ inline RegExpConstructor* asRegExpConstructor(JSValue value)
+ {
+ ASSERT(asObject(value)->inherits(&RegExpConstructor::info));
+ return static_cast<RegExpConstructor*>(asObject(value));
+ }
+
+ /*
+ To facilitate result caching, exec(), test(), match(), search(), and replace() dipatch regular
+ expression matching through the performMatch function. We use cached results to calculate,
+ e.g., RegExp.lastMatch and RegExp.leftParen.
+ */
+ ALWAYS_INLINE void RegExpConstructor::performMatch(RegExp* r, const UString& s, int startOffset, int& position, int& length, int** ovector)
+ {
+ position = r->match(s, startOffset, &d->tempOvector());
+
+ if (ovector)
+ *ovector = d->tempOvector().data();
+
+ if (position != -1) {
+ ASSERT(!d->tempOvector().isEmpty());
+
+ length = d->tempOvector()[1] - d->tempOvector()[0];
+
+ d->input = s;
+ d->lastInput = s;
+ d->changeLastOvector();
+ d->lastNumSubPatterns = r->numSubpatterns();
+ }
+ }
+
+} // namespace JSC
+
+#endif // RegExpConstructor_h
diff --git a/Source/JavaScriptCore/runtime/RegExpKey.h b/Source/JavaScriptCore/runtime/RegExpKey.h
new file mode 100644
index 0000000..cd1368d
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/RegExpKey.h
@@ -0,0 +1,120 @@
+/*
+ * Copyright (C) 2010 University of Szeged
+ * Copyright (C) 2010 Renata Hodovan (hodovan@inf.u-szeged.hu)
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY UNIVERSITY OF SZEGED ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL UNIVERSITY OF SZEGED OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "UString.h"
+#include <wtf/text/StringHash.h>
+
+#ifndef RegExpKey_h
+#define RegExpKey_h
+
+namespace JSC {
+
+struct RegExpKey {
+ int flagsValue;
+ RefPtr<StringImpl> pattern;
+
+ RegExpKey()
+ : flagsValue(0)
+ {
+ }
+
+ RegExpKey(int flags)
+ : flagsValue(flags)
+ {
+ }
+
+ RegExpKey(int flags, const UString& pattern)
+ : flagsValue(flags)
+ , pattern(pattern.impl())
+ {
+ }
+
+ RegExpKey(int flags, const PassRefPtr<StringImpl> pattern)
+ : flagsValue(flags)
+ , pattern(pattern)
+ {
+ }
+
+ RegExpKey(int flags, const RefPtr<StringImpl>& pattern)
+ : flagsValue(flags)
+ , pattern(pattern)
+ {
+ }
+
+ RegExpKey(const UString& flags, const UString& pattern)
+ : pattern(pattern.impl())
+ {
+ flagsValue = getFlagsValue(flags);
+ }
+
+ int getFlagsValue(const UString flags)
+ {
+ flagsValue = 0;
+ if (flags.find('g') != notFound)
+ flagsValue += 4;
+ if (flags.find('i') != notFound)
+ flagsValue += 2;
+ if (flags.find('m') != notFound)
+ flagsValue += 1;
+ return flagsValue;
+ }
+};
+
+inline bool operator==(const RegExpKey& a, const RegExpKey& b)
+{
+ if (a.flagsValue != b.flagsValue)
+ return false;
+ if (!a.pattern)
+ return !b.pattern;
+ if (!b.pattern)
+ return false;
+ return equal(a.pattern.get(), b.pattern.get());
+}
+
+} // namespace JSC
+
+namespace WTF {
+template<typename T> struct DefaultHash;
+template<typename T> struct RegExpHash;
+
+template<> struct RegExpHash<JSC::RegExpKey> {
+ static unsigned hash(const JSC::RegExpKey& key) { return key.pattern->hash(); }
+ static bool equal(const JSC::RegExpKey& a, const JSC::RegExpKey& b) { return a == b; }
+ static const bool safeToCompareToEmptyOrDeleted = false;
+};
+
+template<> struct DefaultHash<JSC::RegExpKey> {
+ typedef RegExpHash<JSC::RegExpKey> Hash;
+};
+
+template<> struct HashTraits<JSC::RegExpKey> : GenericHashTraits<JSC::RegExpKey> {
+ static void constructDeletedValue(JSC::RegExpKey& slot) { slot.flagsValue = -1; }
+ static bool isDeletedValue(const JSC::RegExpKey& value) { return value.flagsValue == -1; }
+};
+} // namespace WTF
+
+#endif // RegExpKey_h
diff --git a/Source/JavaScriptCore/runtime/RegExpMatchesArray.h b/Source/JavaScriptCore/runtime/RegExpMatchesArray.h
new file mode 100644
index 0000000..b823621
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/RegExpMatchesArray.h
@@ -0,0 +1,94 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifndef RegExpMatchesArray_h
+#define RegExpMatchesArray_h
+
+#include "JSArray.h"
+
+namespace JSC {
+
+ class RegExpMatchesArray : public JSArray {
+ public:
+ RegExpMatchesArray(ExecState*, RegExpConstructorPrivate*);
+ virtual ~RegExpMatchesArray();
+
+ private:
+ virtual bool getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
+ {
+ if (subclassData())
+ fillArrayInstance(exec);
+ return JSArray::getOwnPropertySlot(exec, propertyName, slot);
+ }
+
+ virtual bool getOwnPropertySlot(ExecState* exec, unsigned propertyName, PropertySlot& slot)
+ {
+ if (subclassData())
+ fillArrayInstance(exec);
+ return JSArray::getOwnPropertySlot(exec, propertyName, slot);
+ }
+
+ virtual bool getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
+ {
+ if (subclassData())
+ fillArrayInstance(exec);
+ return JSArray::getOwnPropertyDescriptor(exec, propertyName, descriptor);
+ }
+
+ virtual void put(ExecState* exec, const Identifier& propertyName, JSValue v, PutPropertySlot& slot)
+ {
+ if (subclassData())
+ fillArrayInstance(exec);
+ JSArray::put(exec, propertyName, v, slot);
+ }
+
+ virtual void put(ExecState* exec, unsigned propertyName, JSValue v)
+ {
+ if (subclassData())
+ fillArrayInstance(exec);
+ JSArray::put(exec, propertyName, v);
+ }
+
+ virtual bool deleteProperty(ExecState* exec, const Identifier& propertyName)
+ {
+ if (subclassData())
+ fillArrayInstance(exec);
+ return JSArray::deleteProperty(exec, propertyName);
+ }
+
+ virtual bool deleteProperty(ExecState* exec, unsigned propertyName)
+ {
+ if (subclassData())
+ fillArrayInstance(exec);
+ return JSArray::deleteProperty(exec, propertyName);
+ }
+
+ virtual void getOwnPropertyNames(ExecState* exec, PropertyNameArray& arr, EnumerationMode mode = ExcludeDontEnumProperties)
+ {
+ if (subclassData())
+ fillArrayInstance(exec);
+ JSArray::getOwnPropertyNames(exec, arr, mode);
+ }
+
+ void fillArrayInstance(ExecState*);
+};
+
+}
+
+#endif // RegExpMatchesArray_h
diff --git a/Source/JavaScriptCore/runtime/RegExpObject.cpp b/Source/JavaScriptCore/runtime/RegExpObject.cpp
new file mode 100644
index 0000000..7fda5b1
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/RegExpObject.cpp
@@ -0,0 +1,177 @@
+/*
+ * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
+ * Copyright (C) 2003, 2007, 2008 Apple Inc. All Rights Reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#include "config.h"
+#include "RegExpObject.h"
+
+#include "Error.h"
+#include "ExceptionHelpers.h"
+#include "JSArray.h"
+#include "JSGlobalObject.h"
+#include "JSString.h"
+#include "Lookup.h"
+#include "RegExpConstructor.h"
+#include "RegExpPrototype.h"
+#include "UStringConcatenate.h"
+#include <wtf/PassOwnPtr.h>
+
+namespace JSC {
+
+static JSValue regExpObjectGlobal(ExecState*, JSValue, const Identifier&);
+static JSValue regExpObjectIgnoreCase(ExecState*, JSValue, const Identifier&);
+static JSValue regExpObjectMultiline(ExecState*, JSValue, const Identifier&);
+static JSValue regExpObjectSource(ExecState*, JSValue, const Identifier&);
+static JSValue regExpObjectLastIndex(ExecState*, JSValue, const Identifier&);
+static void setRegExpObjectLastIndex(ExecState*, JSObject*, JSValue);
+
+} // namespace JSC
+
+#include "RegExpObject.lut.h"
+
+namespace JSC {
+
+ASSERT_CLASS_FITS_IN_CELL(RegExpObject);
+
+const ClassInfo RegExpObject::info = { "RegExp", 0, 0, ExecState::regExpTable };
+
+/* Source for RegExpObject.lut.h
+@begin regExpTable
+ global regExpObjectGlobal DontDelete|ReadOnly|DontEnum
+ ignoreCase regExpObjectIgnoreCase DontDelete|ReadOnly|DontEnum
+ multiline regExpObjectMultiline DontDelete|ReadOnly|DontEnum
+ source regExpObjectSource DontDelete|ReadOnly|DontEnum
+ lastIndex regExpObjectLastIndex DontDelete|DontEnum
+@end
+*/
+
+RegExpObject::RegExpObject(JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, NonNullPassRefPtr<RegExp> regExp)
+ : JSObjectWithGlobalObject(globalObject, structure)
+ , d(adoptPtr(new RegExpObjectData(regExp, 0)))
+{
+}
+
+RegExpObject::~RegExpObject()
+{
+}
+
+bool RegExpObject::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
+{
+ return getStaticValueSlot<RegExpObject, JSObject>(exec, ExecState::regExpTable(exec), this, propertyName, slot);
+}
+
+bool RegExpObject::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
+{
+ return getStaticValueDescriptor<RegExpObject, JSObject>(exec, ExecState::regExpTable(exec), this, propertyName, descriptor);
+}
+
+JSValue regExpObjectGlobal(ExecState*, JSValue slotBase, const Identifier&)
+{
+ return jsBoolean(asRegExpObject(slotBase)->regExp()->global());
+}
+
+JSValue regExpObjectIgnoreCase(ExecState*, JSValue slotBase, const Identifier&)
+{
+ return jsBoolean(asRegExpObject(slotBase)->regExp()->ignoreCase());
+}
+
+JSValue regExpObjectMultiline(ExecState*, JSValue slotBase, const Identifier&)
+{
+ return jsBoolean(asRegExpObject(slotBase)->regExp()->multiline());
+}
+
+JSValue regExpObjectSource(ExecState* exec, JSValue slotBase, const Identifier&)
+{
+ return jsString(exec, asRegExpObject(slotBase)->regExp()->pattern());
+}
+
+JSValue regExpObjectLastIndex(ExecState*, JSValue slotBase, const Identifier&)
+{
+ return jsNumber(asRegExpObject(slotBase)->lastIndex());
+}
+
+void RegExpObject::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
+{
+ lookupPut<RegExpObject, JSObject>(exec, propertyName, value, ExecState::regExpTable(exec), this, slot);
+}
+
+void setRegExpObjectLastIndex(ExecState* exec, JSObject* baseObject, JSValue value)
+{
+ asRegExpObject(baseObject)->setLastIndex(value.toInteger(exec));
+}
+
+JSValue RegExpObject::test(ExecState* exec)
+{
+ return jsBoolean(match(exec));
+}
+
+JSValue RegExpObject::exec(ExecState* exec)
+{
+ if (match(exec))
+ return exec->lexicalGlobalObject()->regExpConstructor()->arrayOfMatches(exec);
+ return jsNull();
+}
+
+static EncodedJSValue JSC_HOST_CALL callRegExpObject(ExecState* exec)
+{
+ return JSValue::encode(asRegExpObject(exec->callee())->exec(exec));
+}
+
+CallType RegExpObject::getCallData(CallData& callData)
+{
+ callData.native.function = callRegExpObject;
+ return CallTypeHost;
+}
+
+// Shared implementation used by test and exec.
+bool RegExpObject::match(ExecState* exec)
+{
+ RegExpConstructor* regExpConstructor = exec->lexicalGlobalObject()->regExpConstructor();
+
+ UString input = !exec->argumentCount() ? regExpConstructor->input() : exec->argument(0).toString(exec);
+ if (input.isNull()) {
+ throwError(exec, createError(exec, makeUString("No input to ", toString(exec), ".")));
+ return false;
+ }
+
+ if (!regExp()->global()) {
+ int position;
+ int length;
+ regExpConstructor->performMatch(d->regExp.get(), input, 0, position, length);
+ return position >= 0;
+ }
+
+ if (d->lastIndex < 0 || d->lastIndex > input.length()) {
+ d->lastIndex = 0;
+ return false;
+ }
+
+ int position;
+ int length = 0;
+ regExpConstructor->performMatch(d->regExp.get(), input, static_cast<int>(d->lastIndex), position, length);
+ if (position < 0) {
+ d->lastIndex = 0;
+ return false;
+ }
+
+ d->lastIndex = position + length;
+ return true;
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/RegExpObject.h b/Source/JavaScriptCore/runtime/RegExpObject.h
new file mode 100644
index 0000000..19de929
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/RegExpObject.h
@@ -0,0 +1,87 @@
+/*
+ * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
+ * Copyright (C) 2003, 2007, 2008 Apple Inc. All Rights Reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifndef RegExpObject_h
+#define RegExpObject_h
+
+#include "JSObjectWithGlobalObject.h"
+#include "RegExp.h"
+
+namespace JSC {
+
+ class RegExpObject : public JSObjectWithGlobalObject {
+ public:
+ RegExpObject(JSGlobalObject* globalObject, NonNullPassRefPtr<Structure>, NonNullPassRefPtr<RegExp>);
+ virtual ~RegExpObject();
+
+ void setRegExp(PassRefPtr<RegExp> r) { d->regExp = r; }
+ RegExp* regExp() const { return d->regExp.get(); }
+
+ void setLastIndex(double lastIndex) { d->lastIndex = lastIndex; }
+ double lastIndex() const { return d->lastIndex; }
+
+ JSValue test(ExecState*);
+ JSValue exec(ExecState*);
+
+ virtual bool getOwnPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&);
+ virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
+ virtual void put(ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&);
+
+ virtual const ClassInfo* classInfo() const { return &info; }
+ static JS_EXPORTDATA const ClassInfo info;
+
+ static PassRefPtr<Structure> createStructure(JSValue prototype)
+ {
+ return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount);
+ }
+
+ protected:
+ static const unsigned StructureFlags = OverridesGetOwnPropertySlot | JSObjectWithGlobalObject::StructureFlags;
+
+ private:
+ bool match(ExecState*);
+
+ virtual CallType getCallData(CallData&);
+
+ struct RegExpObjectData : FastAllocBase {
+ RegExpObjectData(NonNullPassRefPtr<RegExp> regExp, double lastIndex)
+ : regExp(regExp)
+ , lastIndex(lastIndex)
+ {
+ }
+
+ RefPtr<RegExp> regExp;
+ double lastIndex;
+ };
+
+ OwnPtr<RegExpObjectData> d;
+ };
+
+ RegExpObject* asRegExpObject(JSValue);
+
+ inline RegExpObject* asRegExpObject(JSValue value)
+ {
+ ASSERT(asObject(value)->inherits(&RegExpObject::info));
+ return static_cast<RegExpObject*>(asObject(value));
+ }
+
+} // namespace JSC
+
+#endif // RegExpObject_h
diff --git a/Source/JavaScriptCore/runtime/RegExpPrototype.cpp b/Source/JavaScriptCore/runtime/RegExpPrototype.cpp
new file mode 100644
index 0000000..0a4c8bf
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/RegExpPrototype.cpp
@@ -0,0 +1,127 @@
+/*
+ * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
+ * Copyright (C) 2003, 2007, 2008 Apple Inc. All Rights Reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#include "config.h"
+#include "RegExpPrototype.h"
+
+#include "ArrayPrototype.h"
+#include "Error.h"
+#include "JSArray.h"
+#include "JSFunction.h"
+#include "JSObject.h"
+#include "JSString.h"
+#include "JSStringBuilder.h"
+#include "JSValue.h"
+#include "ObjectPrototype.h"
+#include "PrototypeFunction.h"
+#include "RegExpObject.h"
+#include "RegExp.h"
+#include "RegExpCache.h"
+#include "UStringConcatenate.h"
+
+namespace JSC {
+
+ASSERT_CLASS_FITS_IN_CELL(RegExpPrototype);
+
+static EncodedJSValue JSC_HOST_CALL regExpProtoFuncTest(ExecState*);
+static EncodedJSValue JSC_HOST_CALL regExpProtoFuncExec(ExecState*);
+static EncodedJSValue JSC_HOST_CALL regExpProtoFuncCompile(ExecState*);
+static EncodedJSValue JSC_HOST_CALL regExpProtoFuncToString(ExecState*);
+
+// ECMA 15.10.5
+
+RegExpPrototype::RegExpPrototype(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, Structure* prototypeFunctionStructure)
+ : RegExpObject(globalObject, structure, RegExp::create(&exec->globalData(), "", ""))
+{
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 0, exec->propertyNames().compile, regExpProtoFuncCompile), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 0, exec->propertyNames().exec, regExpProtoFuncExec), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 0, exec->propertyNames().test, regExpProtoFuncTest), DontEnum);
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 0, exec->propertyNames().toString, regExpProtoFuncToString), DontEnum);
+}
+
+// ------------------------------ Functions ---------------------------
+
+EncodedJSValue JSC_HOST_CALL regExpProtoFuncTest(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ if (!thisValue.inherits(&RegExpObject::info))
+ return throwVMTypeError(exec);
+ return JSValue::encode(asRegExpObject(thisValue)->test(exec));
+}
+
+EncodedJSValue JSC_HOST_CALL regExpProtoFuncExec(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ if (!thisValue.inherits(&RegExpObject::info))
+ return throwVMTypeError(exec);
+ return JSValue::encode(asRegExpObject(thisValue)->exec(exec));
+}
+
+EncodedJSValue JSC_HOST_CALL regExpProtoFuncCompile(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ if (!thisValue.inherits(&RegExpObject::info))
+ return throwVMTypeError(exec);
+
+ RefPtr<RegExp> regExp;
+ JSValue arg0 = exec->argument(0);
+ JSValue arg1 = exec->argument(1);
+
+ if (arg0.inherits(&RegExpObject::info)) {
+ if (!arg1.isUndefined())
+ return throwVMError(exec, createTypeError(exec, "Cannot supply flags when constructing one RegExp from another."));
+ regExp = asRegExpObject(arg0)->regExp();
+ } else {
+ UString pattern = !exec->argumentCount() ? UString("") : arg0.toString(exec);
+ UString flags = arg1.isUndefined() ? UString("") : arg1.toString(exec);
+ regExp = exec->globalData().regExpCache()->lookupOrCreate(pattern, flags);
+ }
+
+ if (!regExp->isValid())
+ return throwVMError(exec, createSyntaxError(exec, makeUString("Invalid regular expression: ", regExp->errorMessage())));
+
+ asRegExpObject(thisValue)->setRegExp(regExp.release());
+ asRegExpObject(thisValue)->setLastIndex(0);
+ return JSValue::encode(jsUndefined());
+}
+
+EncodedJSValue JSC_HOST_CALL regExpProtoFuncToString(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ if (!thisValue.inherits(&RegExpObject::info)) {
+ if (thisValue.inherits(&RegExpPrototype::info))
+ return JSValue::encode(jsNontrivialString(exec, "//"));
+ return throwVMTypeError(exec);
+ }
+
+ char postfix[5] = { '/', 0, 0, 0, 0 };
+ int index = 1;
+ if (asRegExpObject(thisValue)->get(exec, exec->propertyNames().global).toBoolean(exec))
+ postfix[index++] = 'g';
+ if (asRegExpObject(thisValue)->get(exec, exec->propertyNames().ignoreCase).toBoolean(exec))
+ postfix[index++] = 'i';
+ if (asRegExpObject(thisValue)->get(exec, exec->propertyNames().multiline).toBoolean(exec))
+ postfix[index] = 'm';
+ UString source = asRegExpObject(thisValue)->get(exec, exec->propertyNames().source).toString(exec);
+ // If source is empty, use "/(?:)/" to avoid colliding with comment syntax
+ return JSValue::encode(jsMakeNontrivialString(exec, "/", source.length() ? source : UString("(?:)"), postfix));
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/RegExpPrototype.h b/Source/JavaScriptCore/runtime/RegExpPrototype.h
new file mode 100644
index 0000000..eb4ae00
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/RegExpPrototype.h
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
+ * Copyright (C) 2003, 2007, 2008 Apple Inc. All Rights Reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifndef RegExpPrototype_h
+#define RegExpPrototype_h
+
+#include "RegExpObject.h"
+#include "JSObject.h"
+
+namespace JSC {
+
+ class RegExpPrototype : public RegExpObject {
+ public:
+ RegExpPrototype(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure>, Structure* prototypeFunctionStructure);
+ };
+
+} // namespace JSC
+
+#endif // RegExpPrototype_h
diff --git a/Source/JavaScriptCore/runtime/RopeImpl.cpp b/Source/JavaScriptCore/runtime/RopeImpl.cpp
new file mode 100644
index 0000000..09c24a9
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/RopeImpl.cpp
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "RopeImpl.h"
+
+namespace JSC {
+
+void RopeImpl::derefFibersNonRecursive(Vector<RopeImpl*, 32>& workQueue)
+{
+ unsigned fiberCount = this->fiberCount();
+ for (unsigned i = 0; i < fiberCount; ++i) {
+ Fiber& fiber = m_fibers[i];
+ if (isRope(fiber)) {
+ RopeImpl* nextRope = static_cast<RopeImpl*>(fiber);
+ if (nextRope->hasOneRef())
+ workQueue.append(nextRope);
+ else
+ nextRope->deref();
+ } else
+ static_cast<StringImpl*>(fiber)->deref();
+ }
+}
+
+void RopeImpl::destructNonRecursive()
+{
+ Vector<RopeImpl*, 32> workQueue;
+
+ derefFibersNonRecursive(workQueue);
+ delete this;
+
+ while (!workQueue.isEmpty()) {
+ RopeImpl* rope = workQueue.last();
+ workQueue.removeLast();
+ rope->derefFibersNonRecursive(workQueue);
+ delete rope;
+ }
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/RopeImpl.h b/Source/JavaScriptCore/runtime/RopeImpl.h
new file mode 100644
index 0000000..dfacbf5
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/RopeImpl.h
@@ -0,0 +1,97 @@
+/*
+ * Copyright (C) 2009, 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef RopeImpl_h
+#define RopeImpl_h
+
+#include <wtf/text/StringImpl.h>
+
+namespace JSC {
+
+class RopeImpl : public StringImplBase {
+public:
+ // A RopeImpl is composed from a set of smaller strings called Fibers.
+ // Each Fiber in a rope is either StringImpl or another RopeImpl.
+ typedef StringImplBase* Fiber;
+
+ // Creates a RopeImpl comprising of 'fiberCount' Fibers.
+ // The RopeImpl is constructed in an uninitialized state - initialize must be called for each Fiber in the RopeImpl.
+ static PassRefPtr<RopeImpl> tryCreateUninitialized(unsigned fiberCount)
+ {
+ void* allocation;
+ if (tryFastMalloc(sizeof(RopeImpl) + (fiberCount - 1) * sizeof(Fiber)).getValue(allocation))
+ return adoptRef(new (allocation) RopeImpl(fiberCount));
+ return 0;
+ }
+
+ static bool isRope(Fiber fiber)
+ {
+ return !fiber->isStringImpl();
+ }
+
+ static void deref(Fiber fiber)
+ {
+ if (isRope(fiber))
+ static_cast<RopeImpl*>(fiber)->deref();
+ else
+ static_cast<StringImpl*>(fiber)->deref();
+ }
+
+ void initializeFiber(unsigned &index, Fiber fiber)
+ {
+ m_fibers[index++] = fiber;
+ fiber->ref();
+ m_length += fiber->length();
+ }
+
+ unsigned fiberCount() { return m_size; }
+ Fiber* fibers() { return m_fibers; }
+
+ ALWAYS_INLINE void deref()
+ {
+ m_refCountAndFlags -= s_refCountIncrement;
+ if (!(m_refCountAndFlags & s_refCountMask))
+ destructNonRecursive();
+ }
+
+private:
+ RopeImpl(unsigned fiberCount)
+ : StringImplBase(ConstructNonStringImpl)
+ , m_size(fiberCount)
+ {
+ }
+
+ void destructNonRecursive();
+ void derefFibersNonRecursive(Vector<RopeImpl*, 32>& workQueue);
+
+ bool hasOneRef() { return (m_refCountAndFlags & s_refCountMask) == s_refCountIncrement; }
+
+ unsigned m_size;
+ Fiber m_fibers[1];
+};
+
+}
+
+#endif
diff --git a/Source/JavaScriptCore/runtime/ScopeChain.cpp b/Source/JavaScriptCore/runtime/ScopeChain.cpp
new file mode 100644
index 0000000..54c5082
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/ScopeChain.cpp
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2003, 2006, 2008 Apple Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+#include "ScopeChain.h"
+
+#include "JSActivation.h"
+#include "JSGlobalObject.h"
+#include "JSObject.h"
+#include "PropertyNameArray.h"
+#include <stdio.h>
+
+namespace JSC {
+
+#ifndef NDEBUG
+
+void ScopeChainNode::print() const
+{
+ ScopeChainIterator scopeEnd = end();
+ for (ScopeChainIterator scopeIter = begin(); scopeIter != scopeEnd; ++scopeIter) {
+ JSObject* o = *scopeIter;
+ PropertyNameArray propertyNames(globalObject->globalExec());
+ o->getPropertyNames(globalObject->globalExec(), propertyNames);
+ PropertyNameArray::const_iterator propEnd = propertyNames.end();
+
+ fprintf(stderr, "----- [scope %p] -----\n", o);
+ for (PropertyNameArray::const_iterator propIter = propertyNames.begin(); propIter != propEnd; propIter++) {
+ Identifier name = *propIter;
+ fprintf(stderr, "%s, ", name.ustring().utf8().data());
+ }
+ fprintf(stderr, "\n");
+ }
+}
+
+#endif
+
+int ScopeChain::localDepth() const
+{
+ int scopeDepth = 0;
+ ScopeChainIterator iter = this->begin();
+ ScopeChainIterator end = this->end();
+ while (!(*iter)->inherits(&JSActivation::info)) {
+ ++iter;
+ if (iter == end)
+ break;
+ ++scopeDepth;
+ }
+ return scopeDepth;
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/ScopeChain.h b/Source/JavaScriptCore/runtime/ScopeChain.h
new file mode 100644
index 0000000..0b15b67
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/ScopeChain.h
@@ -0,0 +1,242 @@
+/*
+ * Copyright (C) 2003, 2008, 2009 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef ScopeChain_h
+#define ScopeChain_h
+
+#include "FastAllocBase.h"
+
+namespace JSC {
+
+ class JSGlobalData;
+ class JSGlobalObject;
+ class JSObject;
+ class MarkStack;
+ class ScopeChainIterator;
+
+ class ScopeChainNode : public FastAllocBase {
+ public:
+ ScopeChainNode(ScopeChainNode* next, JSObject* object, JSGlobalData* globalData, JSGlobalObject* globalObject, JSObject* globalThis)
+ : next(next)
+ , object(object)
+ , globalData(globalData)
+ , globalObject(globalObject)
+ , globalThis(globalThis)
+ , refCount(1)
+ {
+ ASSERT(globalData);
+ ASSERT(globalObject);
+ }
+#ifndef NDEBUG
+ // Due to the number of subtle and timing dependent bugs that have occurred due
+ // to deleted but still "valid" ScopeChainNodes we now deliberately clobber the
+ // contents in debug builds.
+ ~ScopeChainNode()
+ {
+ next = 0;
+ object = 0;
+ globalData = 0;
+ globalObject = 0;
+ globalThis = 0;
+ }
+#endif
+
+ ScopeChainNode* next;
+ JSObject* object;
+ JSGlobalData* globalData;
+ JSGlobalObject* globalObject;
+ JSObject* globalThis;
+ int refCount;
+
+ void deref() { ASSERT(refCount); if (--refCount == 0) { release();} }
+ void ref() { ASSERT(refCount); ++refCount; }
+ void release();
+
+ // Before calling "push" on a bare ScopeChainNode, a client should
+ // logically "copy" the node. Later, the client can "deref" the head
+ // of its chain of ScopeChainNodes to reclaim all the nodes it added
+ // after the logical copy, leaving nodes added before the logical copy
+ // (nodes shared with other clients) untouched.
+ ScopeChainNode* copy()
+ {
+ ref();
+ return this;
+ }
+
+ ScopeChainNode* push(JSObject*);
+ ScopeChainNode* pop();
+
+ ScopeChainIterator begin() const;
+ ScopeChainIterator end() const;
+
+#ifndef NDEBUG
+ void print() const;
+#endif
+ };
+
+ inline ScopeChainNode* ScopeChainNode::push(JSObject* o)
+ {
+ ASSERT(o);
+ return new ScopeChainNode(this, o, globalData, globalObject, globalThis);
+ }
+
+ inline ScopeChainNode* ScopeChainNode::pop()
+ {
+ ASSERT(next);
+ ScopeChainNode* result = next;
+
+ if (--refCount != 0)
+ ++result->refCount;
+ else
+ delete this;
+
+ return result;
+ }
+
+ inline void ScopeChainNode::release()
+ {
+ // This function is only called by deref(),
+ // Deref ensures these conditions are true.
+ ASSERT(refCount == 0);
+ ScopeChainNode* n = this;
+ do {
+ ScopeChainNode* next = n->next;
+ delete n;
+ n = next;
+ } while (n && --n->refCount == 0);
+ }
+
+ class ScopeChainIterator {
+ public:
+ ScopeChainIterator(const ScopeChainNode* node)
+ : m_node(node)
+ {
+ }
+
+ JSObject* const & operator*() const { return m_node->object; }
+ JSObject* const * operator->() const { return &(operator*()); }
+
+ ScopeChainIterator& operator++() { m_node = m_node->next; return *this; }
+
+ // postfix ++ intentionally omitted
+
+ bool operator==(const ScopeChainIterator& other) const { return m_node == other.m_node; }
+ bool operator!=(const ScopeChainIterator& other) const { return m_node != other.m_node; }
+
+ private:
+ const ScopeChainNode* m_node;
+ };
+
+ inline ScopeChainIterator ScopeChainNode::begin() const
+ {
+ return ScopeChainIterator(this);
+ }
+
+ inline ScopeChainIterator ScopeChainNode::end() const
+ {
+ return ScopeChainIterator(0);
+ }
+
+ class NoScopeChain {};
+
+ class ScopeChain {
+ friend class JIT;
+ public:
+ ScopeChain(NoScopeChain)
+ : m_node(0)
+ {
+ }
+
+ ScopeChain(JSObject* o, JSGlobalData* globalData, JSGlobalObject* globalObject, JSObject* globalThis)
+ : m_node(new ScopeChainNode(0, o, globalData, globalObject, globalThis))
+ {
+ }
+
+ ScopeChain(const ScopeChain& c)
+ : m_node(c.m_node->copy())
+ {
+ }
+
+ ScopeChain& operator=(const ScopeChain& c);
+
+ explicit ScopeChain(ScopeChainNode* node)
+ : m_node(node->copy())
+ {
+ }
+
+ ~ScopeChain()
+ {
+ if (m_node)
+ m_node->deref();
+#ifndef NDEBUG
+ m_node = 0;
+#endif
+ }
+
+ void swap(ScopeChain&);
+
+ ScopeChainNode* node() const { return m_node; }
+
+ JSObject* top() const { return m_node->object; }
+
+ ScopeChainIterator begin() const { return m_node->begin(); }
+ ScopeChainIterator end() const { return m_node->end(); }
+
+ void push(JSObject* o) { m_node = m_node->push(o); }
+
+ void pop() { m_node = m_node->pop(); }
+ void clear() { m_node->deref(); m_node = 0; }
+
+ JSGlobalObject* globalObject() const { return m_node->globalObject; }
+
+ void markAggregate(MarkStack&) const;
+
+ // Caution: this should only be used if the codeblock this is being used
+ // with needs a full scope chain, otherwise this returns the depth of
+ // the preceeding call frame
+ //
+ // Returns the depth of the current call frame's scope chain
+ int localDepth() const;
+
+#ifndef NDEBUG
+ void print() const { m_node->print(); }
+#endif
+
+ private:
+ ScopeChainNode* m_node;
+ };
+
+ inline void ScopeChain::swap(ScopeChain& o)
+ {
+ ScopeChainNode* tmp = m_node;
+ m_node = o.m_node;
+ o.m_node = tmp;
+ }
+
+ inline ScopeChain& ScopeChain::operator=(const ScopeChain& c)
+ {
+ ScopeChain tmp(c);
+ swap(tmp);
+ return *this;
+ }
+
+} // namespace JSC
+
+#endif // ScopeChain_h
diff --git a/Source/JavaScriptCore/runtime/ScopeChainMark.h b/Source/JavaScriptCore/runtime/ScopeChainMark.h
new file mode 100644
index 0000000..984d101
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/ScopeChainMark.h
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2003, 2006, 2008, 2009 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef ScopeChainMark_h
+#define ScopeChainMark_h
+
+#include "ScopeChain.h"
+
+namespace JSC {
+
+ inline void ScopeChain::markAggregate(MarkStack& markStack) const
+ {
+ for (ScopeChainNode* n = m_node; n; n = n->next)
+ markStack.append(n->object);
+ }
+
+} // namespace JSC
+
+#endif // ScopeChainMark_h
diff --git a/Source/JavaScriptCore/runtime/SmallStrings.cpp b/Source/JavaScriptCore/runtime/SmallStrings.cpp
new file mode 100644
index 0000000..f358727
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/SmallStrings.cpp
@@ -0,0 +1,142 @@
+/*
+ * Copyright (C) 2008, 2010 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "SmallStrings.h"
+
+#include "JSGlobalObject.h"
+#include "JSString.h"
+#include <wtf/Noncopyable.h>
+#include <wtf/PassOwnPtr.h>
+
+namespace JSC {
+
+static const unsigned numCharactersToStore = 0x100;
+
+static inline bool isMarked(JSString* string)
+{
+ return string && Heap::isCellMarked(string);
+}
+
+class SmallStringsStorage : public Noncopyable {
+public:
+ SmallStringsStorage();
+
+ StringImpl* rep(unsigned char character) { return m_reps[character].get(); }
+
+private:
+ RefPtr<StringImpl> m_reps[numCharactersToStore];
+};
+
+SmallStringsStorage::SmallStringsStorage()
+{
+ UChar* characterBuffer = 0;
+ RefPtr<StringImpl> baseString = StringImpl::createUninitialized(numCharactersToStore, characterBuffer);
+ for (unsigned i = 0; i < numCharactersToStore; ++i) {
+ characterBuffer[i] = i;
+ m_reps[i] = StringImpl::create(baseString, i, 1);
+ }
+}
+
+SmallStrings::SmallStrings()
+{
+ COMPILE_ASSERT(numCharactersToStore == sizeof(m_singleCharacterStrings) / sizeof(m_singleCharacterStrings[0]), IsNumCharactersConstInSyncWithClassUsage);
+ clear();
+}
+
+SmallStrings::~SmallStrings()
+{
+}
+
+void SmallStrings::markChildren(MarkStack& markStack)
+{
+ /*
+ Our hypothesis is that small strings are very common. So, we cache them
+ to avoid GC churn. However, in cases where this hypothesis turns out to
+ be false -- including the degenerate case where all JavaScript execution
+ has terminated -- we don't want to waste memory.
+
+ To test our hypothesis, we check if any small string has been marked. If
+ so, it's probably reasonable to mark the rest. If not, we clear the cache.
+ */
+
+ bool isAnyStringMarked = isMarked(m_emptyString);
+ for (unsigned i = 0; i < numCharactersToStore && !isAnyStringMarked; ++i)
+ isAnyStringMarked = isMarked(m_singleCharacterStrings[i]);
+
+ if (!isAnyStringMarked) {
+ clear();
+ return;
+ }
+
+ if (m_emptyString)
+ markStack.append(m_emptyString);
+ for (unsigned i = 0; i < numCharactersToStore; ++i) {
+ if (m_singleCharacterStrings[i])
+ markStack.append(m_singleCharacterStrings[i]);
+ }
+}
+
+void SmallStrings::clear()
+{
+ m_emptyString = 0;
+ for (unsigned i = 0; i < numCharactersToStore; ++i)
+ m_singleCharacterStrings[i] = 0;
+}
+
+unsigned SmallStrings::count() const
+{
+ unsigned count = 0;
+ if (m_emptyString)
+ ++count;
+ for (unsigned i = 0; i < numCharactersToStore; ++i) {
+ if (m_singleCharacterStrings[i])
+ ++count;
+ }
+ return count;
+}
+
+void SmallStrings::createEmptyString(JSGlobalData* globalData)
+{
+ ASSERT(!m_emptyString);
+ m_emptyString = new (globalData) JSString(globalData, "", JSString::HasOtherOwner);
+}
+
+void SmallStrings::createSingleCharacterString(JSGlobalData* globalData, unsigned char character)
+{
+ if (!m_storage)
+ m_storage = adoptPtr(new SmallStringsStorage);
+ ASSERT(!m_singleCharacterStrings[character]);
+ m_singleCharacterStrings[character] = new (globalData) JSString(globalData, PassRefPtr<StringImpl>(m_storage->rep(character)), JSString::HasOtherOwner);
+}
+
+StringImpl* SmallStrings::singleCharacterStringRep(unsigned char character)
+{
+ if (!m_storage)
+ m_storage = adoptPtr(new SmallStringsStorage);
+ return m_storage->rep(character);
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/SmallStrings.h b/Source/JavaScriptCore/runtime/SmallStrings.h
new file mode 100644
index 0000000..d1ebfb1
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/SmallStrings.h
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2008, 2009 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SmallStrings_h
+#define SmallStrings_h
+
+#include "UString.h"
+#include <wtf/FixedArray.h>
+#include <wtf/OwnPtr.h>
+
+namespace JSC {
+
+ class JSGlobalData;
+ class JSString;
+ class MarkStack;
+ class SmallStringsStorage;
+
+ class SmallStrings : public Noncopyable {
+ public:
+ SmallStrings();
+ ~SmallStrings();
+
+ JSString* emptyString(JSGlobalData* globalData)
+ {
+ if (!m_emptyString)
+ createEmptyString(globalData);
+ return m_emptyString;
+ }
+ JSString* singleCharacterString(JSGlobalData* globalData, unsigned char character)
+ {
+ if (!m_singleCharacterStrings[character])
+ createSingleCharacterString(globalData, character);
+ return m_singleCharacterStrings[character];
+ }
+
+ StringImpl* singleCharacterStringRep(unsigned char character);
+
+ void markChildren(MarkStack&);
+ void clear();
+
+ unsigned count() const;
+#if ENABLE(JIT)
+ JSString** singleCharacterStrings() { return m_singleCharacterStrings.data(); }
+#endif
+ private:
+ void createEmptyString(JSGlobalData*);
+ void createSingleCharacterString(JSGlobalData*, unsigned char);
+
+ JSString* m_emptyString;
+ FixedArray<JSString*, 0x100> m_singleCharacterStrings;
+ OwnPtr<SmallStringsStorage> m_storage;
+ };
+
+} // namespace JSC
+
+#endif // SmallStrings_h
diff --git a/Source/JavaScriptCore/runtime/StrictEvalActivation.cpp b/Source/JavaScriptCore/runtime/StrictEvalActivation.cpp
new file mode 100644
index 0000000..5bb013b
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/StrictEvalActivation.cpp
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "StrictEvalActivation.h"
+
+namespace JSC {
+
+StrictEvalActivation::StrictEvalActivation(ExecState* exec)
+ : JSObject(exec->globalData().strictEvalActivationStructure)
+{
+}
+
+bool StrictEvalActivation::deleteProperty(ExecState*, const Identifier&)
+{
+ return false;
+}
+
+JSObject* StrictEvalActivation::toThisObject(ExecState* exec) const
+{
+ return exec->globalThisValue();
+}
+
+JSValue StrictEvalActivation::toStrictThisObject(ExecState*) const
+{
+ return jsNull();
+}
+
+}
diff --git a/Source/JavaScriptCore/runtime/StrictEvalActivation.h b/Source/JavaScriptCore/runtime/StrictEvalActivation.h
new file mode 100644
index 0000000..1385eec
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/StrictEvalActivation.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef StrictEvalActivation_h
+#define StrictEvalActivation_h
+
+#include "JSObject.h"
+
+namespace JSC {
+
+class StrictEvalActivation : public JSObject {
+public:
+ StrictEvalActivation(ExecState*);
+ virtual bool deleteProperty(ExecState*, const Identifier&);
+ virtual JSObject* toThisObject(ExecState*) const;
+ virtual JSValue toStrictThisObject(ExecState*) const;
+};
+
+} // namespace JSC
+
+#endif // StrictEvalActivation_h
diff --git a/Source/JavaScriptCore/runtime/StringConstructor.cpp b/Source/JavaScriptCore/runtime/StringConstructor.cpp
new file mode 100644
index 0000000..101650c
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/StringConstructor.cpp
@@ -0,0 +1,96 @@
+/*
+ * Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#include "config.h"
+#include "StringConstructor.h"
+
+#include "Executable.h"
+#include "JITCode.h"
+#include "JSFunction.h"
+#include "JSGlobalObject.h"
+#include "PrototypeFunction.h"
+#include "StringPrototype.h"
+
+namespace JSC {
+
+static NEVER_INLINE JSValue stringFromCharCodeSlowCase(ExecState* exec)
+{
+ unsigned length = exec->argumentCount();
+ UChar* buf;
+ PassRefPtr<StringImpl> impl = StringImpl::createUninitialized(length, buf);
+ for (unsigned i = 0; i < length; ++i)
+ buf[i] = static_cast<UChar>(exec->argument(i).toUInt32(exec));
+ return jsString(exec, impl);
+}
+
+static EncodedJSValue JSC_HOST_CALL stringFromCharCode(ExecState* exec)
+{
+ if (LIKELY(exec->argumentCount() == 1))
+ return JSValue::encode(jsSingleCharacterString(exec, exec->argument(0).toUInt32(exec)));
+ return JSValue::encode(stringFromCharCodeSlowCase(exec));
+}
+
+ASSERT_CLASS_FITS_IN_CELL(StringConstructor);
+
+StringConstructor::StringConstructor(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, Structure* prototypeFunctionStructure, StringPrototype* stringPrototype)
+ : InternalFunction(&exec->globalData(), globalObject, structure, Identifier(exec, stringPrototype->classInfo()->className))
+{
+ // ECMA 15.5.3.1 String.prototype
+ putDirectWithoutTransition(exec->propertyNames().prototype, stringPrototype, ReadOnly | DontEnum | DontDelete);
+
+ // ECMA 15.5.3.2 fromCharCode()
+#if ENABLE(JIT) && ENABLE(JIT_OPTIMIZE_NATIVE_CALL)
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 1, exec->propertyNames().fromCharCode, exec->globalData().getHostFunction(stringFromCharCode, fromCharCodeThunkGenerator)), DontEnum);
+#else
+ putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 1, exec->propertyNames().fromCharCode, stringFromCharCode), DontEnum);
+#endif
+ // no. of arguments for constructor
+ putDirectWithoutTransition(exec->propertyNames().length, jsNumber(1), ReadOnly | DontEnum | DontDelete);
+}
+
+// ECMA 15.5.2
+static EncodedJSValue JSC_HOST_CALL constructWithStringConstructor(ExecState* exec)
+{
+ if (!exec->argumentCount())
+ return JSValue::encode(new (exec) StringObject(exec, exec->lexicalGlobalObject()->stringObjectStructure()));
+ return JSValue::encode(new (exec) StringObject(exec, exec->lexicalGlobalObject()->stringObjectStructure(), exec->argument(0).toString(exec)));
+}
+
+ConstructType StringConstructor::getConstructData(ConstructData& constructData)
+{
+ constructData.native.function = constructWithStringConstructor;
+ return ConstructTypeHost;
+}
+
+// ECMA 15.5.1
+static EncodedJSValue JSC_HOST_CALL callStringConstructor(ExecState* exec)
+{
+ if (!exec->argumentCount())
+ return JSValue::encode(jsEmptyString(exec));
+ return JSValue::encode(jsString(exec, exec->argument(0).toString(exec)));
+}
+
+CallType StringConstructor::getCallData(CallData& callData)
+{
+ callData.native.function = callStringConstructor;
+ return CallTypeHost;
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/StringConstructor.h b/Source/JavaScriptCore/runtime/StringConstructor.h
new file mode 100644
index 0000000..20f3a52
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/StringConstructor.h
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifndef StringConstructor_h
+#define StringConstructor_h
+
+#include "InternalFunction.h"
+
+namespace JSC {
+
+ class StringPrototype;
+
+ class StringConstructor : public InternalFunction {
+ public:
+ StringConstructor(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure>, Structure* prototypeFunctionStructure, StringPrototype*);
+
+ virtual ConstructType getConstructData(ConstructData&);
+ virtual CallType getCallData(CallData&);
+ };
+
+} // namespace JSC
+
+#endif // StringConstructor_h
diff --git a/Source/JavaScriptCore/runtime/StringObject.cpp b/Source/JavaScriptCore/runtime/StringObject.cpp
new file mode 100644
index 0000000..dc27618
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/StringObject.cpp
@@ -0,0 +1,99 @@
+/*
+ * Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#include "config.h"
+#include "StringObject.h"
+
+#include "PropertyNameArray.h"
+
+namespace JSC {
+
+ASSERT_CLASS_FITS_IN_CELL(StringObject);
+
+const ClassInfo StringObject::info = { "String", 0, 0, 0 };
+
+StringObject::StringObject(ExecState* exec, NonNullPassRefPtr<Structure> structure)
+ : JSWrapperObject(structure)
+{
+ setInternalValue(jsEmptyString(exec));
+}
+
+StringObject::StringObject(NonNullPassRefPtr<Structure> structure, JSString* string)
+ : JSWrapperObject(structure)
+{
+ setInternalValue(string);
+}
+
+StringObject::StringObject(ExecState* exec, NonNullPassRefPtr<Structure> structure, const UString& string)
+ : JSWrapperObject(structure)
+{
+ setInternalValue(jsString(exec, string));
+}
+
+bool StringObject::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
+{
+ if (internalValue()->getStringPropertySlot(exec, propertyName, slot))
+ return true;
+ return JSObject::getOwnPropertySlot(exec, propertyName, slot);
+}
+
+bool StringObject::getOwnPropertySlot(ExecState* exec, unsigned propertyName, PropertySlot& slot)
+{
+ if (internalValue()->getStringPropertySlot(exec, propertyName, slot))
+ return true;
+ return JSObject::getOwnPropertySlot(exec, Identifier::from(exec, propertyName), slot);
+}
+
+bool StringObject::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
+{
+ if (internalValue()->getStringPropertyDescriptor(exec, propertyName, descriptor))
+ return true;
+ return JSObject::getOwnPropertyDescriptor(exec, propertyName, descriptor);
+}
+
+void StringObject::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
+{
+ if (propertyName == exec->propertyNames().length)
+ return;
+ JSObject::put(exec, propertyName, value, slot);
+}
+
+bool StringObject::deleteProperty(ExecState* exec, const Identifier& propertyName)
+{
+ if (propertyName == exec->propertyNames().length)
+ return false;
+ bool isStrictUInt32;
+ unsigned i = propertyName.toUInt32(isStrictUInt32);
+ if (isStrictUInt32 && internalValue()->canGetIndex(i))
+ return false;
+ return JSObject::deleteProperty(exec, propertyName);
+}
+
+void StringObject::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
+{
+ int size = internalValue()->length();
+ for (int i = 0; i < size; ++i)
+ propertyNames.add(Identifier(exec, UString::number(i)));
+ if (mode == IncludeDontEnumProperties)
+ propertyNames.add(exec->propertyNames().length);
+ return JSObject::getOwnPropertyNames(exec, propertyNames, mode);
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/StringObject.h b/Source/JavaScriptCore/runtime/StringObject.h
new file mode 100644
index 0000000..e3add77
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/StringObject.h
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifndef StringObject_h
+#define StringObject_h
+
+#include "JSWrapperObject.h"
+#include "JSString.h"
+
+namespace JSC {
+
+ class StringObject : public JSWrapperObject {
+ public:
+ StringObject(ExecState*, NonNullPassRefPtr<Structure>);
+ StringObject(ExecState*, NonNullPassRefPtr<Structure>, const UString&);
+
+ static StringObject* create(ExecState*, JSString*);
+
+ virtual bool getOwnPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&);
+ virtual bool getOwnPropertySlot(ExecState*, unsigned propertyName, PropertySlot&);
+ virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
+
+ virtual void put(ExecState* exec, const Identifier& propertyName, JSValue, PutPropertySlot&);
+ virtual bool deleteProperty(ExecState*, const Identifier& propertyName);
+ virtual void getOwnPropertyNames(ExecState*, PropertyNameArray&, EnumerationMode mode = ExcludeDontEnumProperties);
+
+ virtual const ClassInfo* classInfo() const { return &info; }
+ static const JS_EXPORTDATA ClassInfo info;
+
+ JSString* internalValue() const { return asString(JSWrapperObject::internalValue());}
+
+ static PassRefPtr<Structure> createStructure(JSValue prototype)
+ {
+ return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount);
+ }
+
+ protected:
+ static const unsigned StructureFlags = OverridesGetOwnPropertySlot | OverridesMarkChildren | OverridesGetPropertyNames | JSWrapperObject::StructureFlags;
+ StringObject(NonNullPassRefPtr<Structure>, JSString*);
+ };
+
+ StringObject* asStringObject(JSValue);
+
+ inline StringObject* asStringObject(JSValue value)
+ {
+ ASSERT(asObject(value)->inherits(&StringObject::info));
+ return static_cast<StringObject*>(asObject(value));
+ }
+
+} // namespace JSC
+
+#endif // StringObject_h
diff --git a/Source/JavaScriptCore/runtime/StringObjectThatMasqueradesAsUndefined.h b/Source/JavaScriptCore/runtime/StringObjectThatMasqueradesAsUndefined.h
new file mode 100644
index 0000000..43c3e38
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/StringObjectThatMasqueradesAsUndefined.h
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifndef StringObjectThatMasqueradesAsUndefined_h
+#define StringObjectThatMasqueradesAsUndefined_h
+
+#include "JSGlobalObject.h"
+#include "StringObject.h"
+#include "UString.h"
+
+namespace JSC {
+
+ // WebCore uses this to make style.filter undetectable
+ class StringObjectThatMasqueradesAsUndefined : public StringObject {
+ public:
+ static StringObjectThatMasqueradesAsUndefined* create(ExecState* exec, const UString& string)
+ {
+ return new (exec) StringObjectThatMasqueradesAsUndefined(exec,
+ createStructure(exec->lexicalGlobalObject()->stringPrototype()), string);
+ }
+
+ private:
+ StringObjectThatMasqueradesAsUndefined(ExecState* exec, NonNullPassRefPtr<Structure> structure, const UString& string)
+ : StringObject(exec, structure, string)
+ {
+ }
+
+ static PassRefPtr<Structure> createStructure(JSValue proto)
+ {
+ return Structure::create(proto, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount);
+ }
+
+ static const unsigned StructureFlags = OverridesGetOwnPropertySlot | MasqueradesAsUndefined | OverridesGetPropertyNames | StringObject::StructureFlags;
+
+ virtual bool toBoolean(ExecState*) const { return false; }
+ };
+
+} // namespace JSC
+
+#endif // StringObjectThatMasqueradesAsUndefined_h
diff --git a/Source/JavaScriptCore/runtime/StringPrototype.cpp b/Source/JavaScriptCore/runtime/StringPrototype.cpp
new file mode 100644
index 0000000..8b3d056
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/StringPrototype.cpp
@@ -0,0 +1,1155 @@
+/*
+ * Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2009 Torch Mobile, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#include "config.h"
+#include "StringPrototype.h"
+
+#include "CachedCall.h"
+#include "Error.h"
+#include "Executable.h"
+#include "JSGlobalObjectFunctions.h"
+#include "JSArray.h"
+#include "JSFunction.h"
+#include "JSStringBuilder.h"
+#include "Lookup.h"
+#include "ObjectPrototype.h"
+#include "Operations.h"
+#include "PropertyNameArray.h"
+#include "RegExpCache.h"
+#include "RegExpConstructor.h"
+#include "RegExpObject.h"
+#include <wtf/ASCIICType.h>
+#include <wtf/MathExtras.h>
+#include <wtf/unicode/Collator.h>
+
+using namespace WTF;
+
+namespace JSC {
+
+ASSERT_CLASS_FITS_IN_CELL(StringPrototype);
+
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncToString(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncCharAt(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncCharCodeAt(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncConcat(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncIndexOf(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncLastIndexOf(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncMatch(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncReplace(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncSearch(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncSlice(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncSplit(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncSubstr(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncSubstring(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncToLowerCase(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncToUpperCase(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncLocaleCompare(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncBig(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncSmall(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncBlink(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncBold(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncFixed(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncItalics(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncStrike(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncSub(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncSup(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncFontcolor(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncFontsize(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncAnchor(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncLink(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncTrim(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncTrimLeft(ExecState*);
+static EncodedJSValue JSC_HOST_CALL stringProtoFuncTrimRight(ExecState*);
+
+}
+
+#include "StringPrototype.lut.h"
+
+namespace JSC {
+
+const ClassInfo StringPrototype::info = { "String", &StringObject::info, 0, ExecState::stringTable };
+
+/* Source for StringPrototype.lut.h
+@begin stringTable 26
+ toString stringProtoFuncToString DontEnum|Function 0
+ valueOf stringProtoFuncToString DontEnum|Function 0
+ charAt stringProtoFuncCharAt DontEnum|Function 1
+ charCodeAt stringProtoFuncCharCodeAt DontEnum|Function 1
+ concat stringProtoFuncConcat DontEnum|Function 1
+ indexOf stringProtoFuncIndexOf DontEnum|Function 1
+ lastIndexOf stringProtoFuncLastIndexOf DontEnum|Function 1
+ match stringProtoFuncMatch DontEnum|Function 1
+ replace stringProtoFuncReplace DontEnum|Function 2
+ search stringProtoFuncSearch DontEnum|Function 1
+ slice stringProtoFuncSlice DontEnum|Function 2
+ split stringProtoFuncSplit DontEnum|Function 2
+ substr stringProtoFuncSubstr DontEnum|Function 2
+ substring stringProtoFuncSubstring DontEnum|Function 2
+ toLowerCase stringProtoFuncToLowerCase DontEnum|Function 0
+ toUpperCase stringProtoFuncToUpperCase DontEnum|Function 0
+ localeCompare stringProtoFuncLocaleCompare DontEnum|Function 1
+
+ # toLocaleLowerCase and toLocaleUpperCase are currently identical to toLowerCase and toUpperCase
+ toLocaleLowerCase stringProtoFuncToLowerCase DontEnum|Function 0
+ toLocaleUpperCase stringProtoFuncToUpperCase DontEnum|Function 0
+
+ big stringProtoFuncBig DontEnum|Function 0
+ small stringProtoFuncSmall DontEnum|Function 0
+ blink stringProtoFuncBlink DontEnum|Function 0
+ bold stringProtoFuncBold DontEnum|Function 0
+ fixed stringProtoFuncFixed DontEnum|Function 0
+ italics stringProtoFuncItalics DontEnum|Function 0
+ strike stringProtoFuncStrike DontEnum|Function 0
+ sub stringProtoFuncSub DontEnum|Function 0
+ sup stringProtoFuncSup DontEnum|Function 0
+ fontcolor stringProtoFuncFontcolor DontEnum|Function 1
+ fontsize stringProtoFuncFontsize DontEnum|Function 1
+ anchor stringProtoFuncAnchor DontEnum|Function 1
+ link stringProtoFuncLink DontEnum|Function 1
+ trim stringProtoFuncTrim DontEnum|Function 0
+ trimLeft stringProtoFuncTrimLeft DontEnum|Function 0
+ trimRight stringProtoFuncTrimRight DontEnum|Function 0
+@end
+*/
+
+// ECMA 15.5.4
+StringPrototype::StringPrototype(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure)
+ : StringObject(exec, structure)
+{
+ putAnonymousValue(0, globalObject);
+ // The constructor will be added later, after StringConstructor has been built
+ putDirectWithoutTransition(exec->propertyNames().length, jsNumber(0), DontDelete | ReadOnly | DontEnum);
+}
+
+bool StringPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot &slot)
+{
+ return getStaticFunctionSlot<StringObject>(exec, ExecState::stringTable(exec), this, propertyName, slot);
+}
+
+bool StringPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
+{
+ return getStaticFunctionDescriptor<StringObject>(exec, ExecState::stringTable(exec), this, propertyName, descriptor);
+}
+
+// ------------------------------ Functions --------------------------
+
+static NEVER_INLINE UString substituteBackreferencesSlow(const UString& replacement, const UString& source, const int* ovector, RegExp* reg, size_t i)
+{
+ Vector<UChar> substitutedReplacement;
+ int offset = 0;
+ do {
+ if (i + 1 == replacement.length())
+ break;
+
+ UChar ref = replacement[i + 1];
+ if (ref == '$') {
+ // "$$" -> "$"
+ ++i;
+ substitutedReplacement.append(replacement.characters() + offset, i - offset);
+ offset = i + 1;
+ continue;
+ }
+
+ int backrefStart;
+ int backrefLength;
+ int advance = 0;
+ if (ref == '&') {
+ backrefStart = ovector[0];
+ backrefLength = ovector[1] - backrefStart;
+ } else if (ref == '`') {
+ backrefStart = 0;
+ backrefLength = ovector[0];
+ } else if (ref == '\'') {
+ backrefStart = ovector[1];
+ backrefLength = source.length() - backrefStart;
+ } else if (reg && ref >= '0' && ref <= '9') {
+ // 1- and 2-digit back references are allowed
+ unsigned backrefIndex = ref - '0';
+ if (backrefIndex > reg->numSubpatterns())
+ continue;
+ if (replacement.length() > i + 2) {
+ ref = replacement[i + 2];
+ if (ref >= '0' && ref <= '9') {
+ backrefIndex = 10 * backrefIndex + ref - '0';
+ if (backrefIndex > reg->numSubpatterns())
+ backrefIndex = backrefIndex / 10; // Fall back to the 1-digit reference
+ else
+ advance = 1;
+ }
+ }
+ if (!backrefIndex)
+ continue;
+ backrefStart = ovector[2 * backrefIndex];
+ backrefLength = ovector[2 * backrefIndex + 1] - backrefStart;
+ } else
+ continue;
+
+ if (i - offset)
+ substitutedReplacement.append(replacement.characters() + offset, i - offset);
+ i += 1 + advance;
+ offset = i + 1;
+ if (backrefStart >= 0)
+ substitutedReplacement.append(source.characters() + backrefStart, backrefLength);
+ } while ((i = replacement.find('$', i + 1)) != notFound);
+
+ if (replacement.length() - offset)
+ substitutedReplacement.append(replacement.characters() + offset, replacement.length() - offset);
+
+ substitutedReplacement.shrinkToFit();
+ return UString::adopt(substitutedReplacement);
+}
+
+static inline UString substituteBackreferences(const UString& replacement, const UString& source, const int* ovector, RegExp* reg)
+{
+ size_t i = replacement.find('$', 0);
+ if (UNLIKELY(i != notFound))
+ return substituteBackreferencesSlow(replacement, source, ovector, reg, i);
+ return replacement;
+}
+
+static inline int localeCompare(const UString& a, const UString& b)
+{
+ return Collator::userDefault()->collate(reinterpret_cast<const ::UChar*>(a.characters()), a.length(), reinterpret_cast<const ::UChar*>(b.characters()), b.length());
+}
+
+struct StringRange {
+public:
+ StringRange(int pos, int len)
+ : position(pos)
+ , length(len)
+ {
+ }
+
+ StringRange()
+ {
+ }
+
+ int position;
+ int length;
+};
+
+static ALWAYS_INLINE JSValue jsSpliceSubstringsWithSeparators(ExecState* exec, JSString* sourceVal, const UString& source, const StringRange* substringRanges, int rangeCount, const UString* separators, int separatorCount)
+{
+ if (rangeCount == 1 && separatorCount == 0) {
+ int sourceSize = source.length();
+ int position = substringRanges[0].position;
+ int length = substringRanges[0].length;
+ if (position <= 0 && length >= sourceSize)
+ return sourceVal;
+ // We could call UString::substr, but this would result in redundant checks
+ return jsString(exec, StringImpl::create(source.impl(), max(0, position), min(sourceSize, length)));
+ }
+
+ int totalLength = 0;
+ for (int i = 0; i < rangeCount; i++)
+ totalLength += substringRanges[i].length;
+ for (int i = 0; i < separatorCount; i++)
+ totalLength += separators[i].length();
+
+ if (totalLength == 0)
+ return jsString(exec, "");
+
+ UChar* buffer;
+ PassRefPtr<StringImpl> impl = StringImpl::tryCreateUninitialized(totalLength, buffer);
+ if (!impl)
+ return throwOutOfMemoryError(exec);
+
+ int maxCount = max(rangeCount, separatorCount);
+ int bufferPos = 0;
+ for (int i = 0; i < maxCount; i++) {
+ if (i < rangeCount) {
+ if (int srcLen = substringRanges[i].length) {
+ StringImpl::copyChars(buffer + bufferPos, source.characters() + substringRanges[i].position, srcLen);
+ bufferPos += srcLen;
+ }
+ }
+ if (i < separatorCount) {
+ if (int sepLen = separators[i].length()) {
+ StringImpl::copyChars(buffer + bufferPos, separators[i].characters(), sepLen);
+ bufferPos += sepLen;
+ }
+ }
+ }
+
+ return jsString(exec, impl);
+}
+
+EncodedJSValue JSC_HOST_CALL stringProtoFuncReplace(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ JSString* sourceVal = thisValue.toThisJSString(exec);
+ JSValue pattern = exec->argument(0);
+ JSValue replacement = exec->argument(1);
+
+ UString replacementString;
+ CallData callData;
+ CallType callType = getCallData(replacement, callData);
+ if (callType == CallTypeNone)
+ replacementString = replacement.toString(exec);
+
+ if (pattern.inherits(&RegExpObject::info)) {
+ const UString& source = sourceVal->value(exec);
+ unsigned sourceLen = source.length();
+ if (exec->hadException())
+ return JSValue::encode(JSValue());
+ RegExp* reg = asRegExpObject(pattern)->regExp();
+ bool global = reg->global();
+
+ RegExpConstructor* regExpConstructor = exec->lexicalGlobalObject()->regExpConstructor();
+
+ int lastIndex = 0;
+ unsigned startPosition = 0;
+
+ Vector<StringRange, 16> sourceRanges;
+ Vector<UString, 16> replacements;
+
+ // This is either a loop (if global is set) or a one-way (if not).
+ if (global && callType == CallTypeJS) {
+ // reg->numSubpatterns() + 1 for pattern args, + 2 for match start and sourceValue
+ int argCount = reg->numSubpatterns() + 1 + 2;
+ JSFunction* func = asFunction(replacement);
+ CachedCall cachedCall(exec, func, argCount);
+ if (exec->hadException())
+ return JSValue::encode(jsNull());
+ while (true) {
+ int matchIndex;
+ int matchLen = 0;
+ int* ovector;
+ regExpConstructor->performMatch(reg, source, startPosition, matchIndex, matchLen, &ovector);
+ if (matchIndex < 0)
+ break;
+
+ sourceRanges.append(StringRange(lastIndex, matchIndex - lastIndex));
+
+ int completeMatchStart = ovector[0];
+ unsigned i = 0;
+ for (; i < reg->numSubpatterns() + 1; ++i) {
+ int matchStart = ovector[i * 2];
+ int matchLen = ovector[i * 2 + 1] - matchStart;
+
+ if (matchStart < 0)
+ cachedCall.setArgument(i, jsUndefined());
+ else
+ cachedCall.setArgument(i, jsSubstring(exec, source, matchStart, matchLen));
+ }
+
+ cachedCall.setArgument(i++, jsNumber(completeMatchStart));
+ cachedCall.setArgument(i++, sourceVal);
+
+ cachedCall.setThis(exec->globalThisValue());
+ JSValue result = cachedCall.call();
+ if (LIKELY(result.isString()))
+ replacements.append(asString(result)->value(exec));
+ else
+ replacements.append(result.toString(cachedCall.newCallFrame(exec)));
+ if (exec->hadException())
+ break;
+
+ lastIndex = matchIndex + matchLen;
+ startPosition = lastIndex;
+
+ // special case of empty match
+ if (matchLen == 0) {
+ startPosition++;
+ if (startPosition > sourceLen)
+ break;
+ }
+ }
+ } else {
+ do {
+ int matchIndex;
+ int matchLen = 0;
+ int* ovector;
+ regExpConstructor->performMatch(reg, source, startPosition, matchIndex, matchLen, &ovector);
+ if (matchIndex < 0)
+ break;
+
+ if (callType != CallTypeNone) {
+ sourceRanges.append(StringRange(lastIndex, matchIndex - lastIndex));
+
+ int completeMatchStart = ovector[0];
+ MarkedArgumentBuffer args;
+
+ for (unsigned i = 0; i < reg->numSubpatterns() + 1; ++i) {
+ int matchStart = ovector[i * 2];
+ int matchLen = ovector[i * 2 + 1] - matchStart;
+
+ if (matchStart < 0)
+ args.append(jsUndefined());
+ else
+ args.append(jsSubstring(exec, source, matchStart, matchLen));
+ }
+
+ args.append(jsNumber(completeMatchStart));
+ args.append(sourceVal);
+
+ replacements.append(call(exec, replacement, callType, callData, exec->globalThisValue(), args).toString(exec));
+ if (exec->hadException())
+ break;
+ } else {
+ int replLen = replacementString.length();
+ if (lastIndex < matchIndex || replLen) {
+ sourceRanges.append(StringRange(lastIndex, matchIndex - lastIndex));
+
+ if (replLen)
+ replacements.append(substituteBackreferences(replacementString, source, ovector, reg));
+ else
+ replacements.append(UString());
+ }
+ }
+
+ lastIndex = matchIndex + matchLen;
+ startPosition = lastIndex;
+
+ // special case of empty match
+ if (matchLen == 0) {
+ startPosition++;
+ if (startPosition > sourceLen)
+ break;
+ }
+ } while (global);
+ }
+
+ if (!lastIndex && replacements.isEmpty())
+ return JSValue::encode(sourceVal);
+
+ if (static_cast<unsigned>(lastIndex) < sourceLen)
+ sourceRanges.append(StringRange(lastIndex, sourceLen - lastIndex));
+
+ return JSValue::encode(jsSpliceSubstringsWithSeparators(exec, sourceVal, source, sourceRanges.data(), sourceRanges.size(), replacements.data(), replacements.size()));
+ }
+
+ // Not a regular expression, so treat the pattern as a string.
+
+ UString patternString = pattern.toString(exec);
+ // Special case for single character patterns without back reference replacement
+ if (patternString.length() == 1 && callType == CallTypeNone && replacementString.find('$', 0) == notFound)
+ return JSValue::encode(sourceVal->replaceCharacter(exec, patternString[0], replacementString));
+
+ const UString& source = sourceVal->value(exec);
+ size_t matchPos = source.find(patternString);
+
+ if (matchPos == notFound)
+ return JSValue::encode(sourceVal);
+
+ int matchLen = patternString.length();
+ if (callType != CallTypeNone) {
+ MarkedArgumentBuffer args;
+ args.append(jsSubstring(exec, source, matchPos, matchLen));
+ args.append(jsNumber(matchPos));
+ args.append(sourceVal);
+
+ replacementString = call(exec, replacement, callType, callData, exec->globalThisValue(), args).toString(exec);
+ }
+
+ size_t matchEnd = matchPos + matchLen;
+ int ovector[2] = { matchPos, matchEnd };
+ return JSValue::encode(jsString(exec, source.substringSharingImpl(0, matchPos), substituteBackreferences(replacementString, source, ovector, 0), source.substringSharingImpl(matchEnd)));
+}
+
+EncodedJSValue JSC_HOST_CALL stringProtoFuncToString(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ // Also used for valueOf.
+
+ if (thisValue.isString())
+ return JSValue::encode(thisValue);
+
+ if (thisValue.inherits(&StringObject::info))
+ return JSValue::encode(asStringObject(thisValue)->internalValue());
+
+ return throwVMTypeError(exec);
+}
+
+EncodedJSValue JSC_HOST_CALL stringProtoFuncCharAt(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ if (thisValue.isUndefinedOrNull()) // CheckObjectCoercible
+ return throwVMTypeError(exec);
+ UString s = thisValue.toThisString(exec);
+ unsigned len = s.length();
+ JSValue a0 = exec->argument(0);
+ if (a0.isUInt32()) {
+ uint32_t i = a0.asUInt32();
+ if (i < len)
+ return JSValue::encode(jsSingleCharacterSubstring(exec, s, i));
+ return JSValue::encode(jsEmptyString(exec));
+ }
+ double dpos = a0.toInteger(exec);
+ if (dpos >= 0 && dpos < len)
+ return JSValue::encode(jsSingleCharacterSubstring(exec, s, static_cast<unsigned>(dpos)));
+ return JSValue::encode(jsEmptyString(exec));
+}
+
+EncodedJSValue JSC_HOST_CALL stringProtoFuncCharCodeAt(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ if (thisValue.isUndefinedOrNull()) // CheckObjectCoercible
+ return throwVMTypeError(exec);
+ UString s = thisValue.toThisString(exec);
+ unsigned len = s.length();
+ JSValue a0 = exec->argument(0);
+ if (a0.isUInt32()) {
+ uint32_t i = a0.asUInt32();
+ if (i < len)
+ return JSValue::encode(jsNumber(s.characters()[i]));
+ return JSValue::encode(jsNaN());
+ }
+ double dpos = a0.toInteger(exec);
+ if (dpos >= 0 && dpos < len)
+ return JSValue::encode(jsNumber(s[static_cast<int>(dpos)]));
+ return JSValue::encode(jsNaN());
+}
+
+EncodedJSValue JSC_HOST_CALL stringProtoFuncConcat(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ if (thisValue.isString() && (exec->argumentCount() == 1)) {
+ JSValue v = exec->argument(0);
+ return JSValue::encode(v.isString()
+ ? jsString(exec, asString(thisValue), asString(v))
+ : jsString(exec, asString(thisValue), v.toString(exec)));
+ }
+ if (thisValue.isUndefinedOrNull()) // CheckObjectCoercible
+ return throwVMTypeError(exec);
+ return JSValue::encode(jsString(exec, thisValue));
+}
+
+EncodedJSValue JSC_HOST_CALL stringProtoFuncIndexOf(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ if (thisValue.isUndefinedOrNull()) // CheckObjectCoercible
+ return throwVMTypeError(exec);
+ UString s = thisValue.toThisString(exec);
+ int len = s.length();
+
+ JSValue a0 = exec->argument(0);
+ JSValue a1 = exec->argument(1);
+ UString u2 = a0.toString(exec);
+ int pos;
+ if (a1.isUndefined())
+ pos = 0;
+ else if (a1.isUInt32())
+ pos = min<uint32_t>(a1.asUInt32(), len);
+ else {
+ double dpos = a1.toInteger(exec);
+ if (dpos < 0)
+ dpos = 0;
+ else if (dpos > len)
+ dpos = len;
+ pos = static_cast<int>(dpos);
+ }
+
+ size_t result = s.find(u2, pos);
+ if (result == notFound)
+ return JSValue::encode(jsNumber(-1));
+ return JSValue::encode(jsNumber(result));
+}
+
+EncodedJSValue JSC_HOST_CALL stringProtoFuncLastIndexOf(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ if (thisValue.isUndefinedOrNull()) // CheckObjectCoercible
+ return throwVMTypeError(exec);
+ UString s = thisValue.toThisString(exec);
+ int len = s.length();
+
+ JSValue a0 = exec->argument(0);
+ JSValue a1 = exec->argument(1);
+
+ UString u2 = a0.toString(exec);
+ double dpos = a1.toIntegerPreserveNaN(exec);
+ if (dpos < 0)
+ dpos = 0;
+ else if (!(dpos <= len)) // true for NaN
+ dpos = len;
+#if OS(SYMBIAN)
+ // Work around for broken NaN compare operator
+ else if (isnan(dpos))
+ dpos = len;
+#endif
+
+ size_t result = s.reverseFind(u2, static_cast<unsigned>(dpos));
+ if (result == notFound)
+ return JSValue::encode(jsNumber(-1));
+ return JSValue::encode(jsNumber(result));
+}
+
+EncodedJSValue JSC_HOST_CALL stringProtoFuncMatch(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ if (thisValue.isUndefinedOrNull()) // CheckObjectCoercible
+ return throwVMTypeError(exec);
+ UString s = thisValue.toThisString(exec);
+
+ JSValue a0 = exec->argument(0);
+
+ UString u = s;
+ RefPtr<RegExp> reg;
+ RegExpObject* imp = 0;
+ if (a0.inherits(&RegExpObject::info))
+ reg = asRegExpObject(a0)->regExp();
+ else {
+ /*
+ * ECMA 15.5.4.12 String.prototype.search (regexp)
+ * If regexp is not an object whose [[Class]] property is "RegExp", it is
+ * replaced with the result of the expression new RegExp(regexp).
+ */
+ reg = exec->globalData().regExpCache()->lookupOrCreate(a0.toString(exec), UString());
+ }
+ RegExpConstructor* regExpConstructor = exec->lexicalGlobalObject()->regExpConstructor();
+ int pos;
+ int matchLength = 0;
+ regExpConstructor->performMatch(reg.get(), u, 0, pos, matchLength);
+ if (!(reg->global())) {
+ // case without 'g' flag is handled like RegExp.prototype.exec
+ if (pos < 0)
+ return JSValue::encode(jsNull());
+ return JSValue::encode(regExpConstructor->arrayOfMatches(exec));
+ }
+
+ // return array of matches
+ MarkedArgumentBuffer list;
+ int lastIndex = 0;
+ while (pos >= 0) {
+ list.append(jsSubstring(exec, u, pos, matchLength));
+ lastIndex = pos;
+ pos += matchLength == 0 ? 1 : matchLength;
+ regExpConstructor->performMatch(reg.get(), u, pos, pos, matchLength);
+ }
+ if (imp)
+ imp->setLastIndex(lastIndex);
+ if (list.isEmpty()) {
+ // if there are no matches at all, it's important to return
+ // Null instead of an empty array, because this matches
+ // other browsers and because Null is a false value.
+ return JSValue::encode(jsNull());
+ }
+
+ return JSValue::encode(constructArray(exec, list));
+}
+
+EncodedJSValue JSC_HOST_CALL stringProtoFuncSearch(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ if (thisValue.isUndefinedOrNull()) // CheckObjectCoercible
+ return throwVMTypeError(exec);
+ UString s = thisValue.toThisString(exec);
+
+ JSValue a0 = exec->argument(0);
+
+ UString u = s;
+ RefPtr<RegExp> reg;
+ if (a0.inherits(&RegExpObject::info))
+ reg = asRegExpObject(a0)->regExp();
+ else {
+ /*
+ * ECMA 15.5.4.12 String.prototype.search (regexp)
+ * If regexp is not an object whose [[Class]] property is "RegExp", it is
+ * replaced with the result of the expression new RegExp(regexp).
+ */
+ reg = exec->globalData().regExpCache()->lookupOrCreate(a0.toString(exec), UString());
+ }
+ RegExpConstructor* regExpConstructor = exec->lexicalGlobalObject()->regExpConstructor();
+ int pos;
+ int matchLength = 0;
+ regExpConstructor->performMatch(reg.get(), u, 0, pos, matchLength);
+ return JSValue::encode(jsNumber(pos));
+}
+
+EncodedJSValue JSC_HOST_CALL stringProtoFuncSlice(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ if (thisValue.isUndefinedOrNull()) // CheckObjectCoercible
+ return throwVMTypeError(exec);
+ UString s = thisValue.toThisString(exec);
+ int len = s.length();
+
+ JSValue a0 = exec->argument(0);
+ JSValue a1 = exec->argument(1);
+
+ // The arg processing is very much like ArrayProtoFunc::Slice
+ double start = a0.toInteger(exec);
+ double end = a1.isUndefined() ? len : a1.toInteger(exec);
+ double from = start < 0 ? len + start : start;
+ double to = end < 0 ? len + end : end;
+ if (to > from && to > 0 && from < len) {
+ if (from < 0)
+ from = 0;
+ if (to > len)
+ to = len;
+ return JSValue::encode(jsSubstring(exec, s, static_cast<unsigned>(from), static_cast<unsigned>(to) - static_cast<unsigned>(from)));
+ }
+
+ return JSValue::encode(jsEmptyString(exec));
+}
+
+EncodedJSValue JSC_HOST_CALL stringProtoFuncSplit(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ if (thisValue.isUndefinedOrNull()) // CheckObjectCoercible
+ return throwVMTypeError(exec);
+ UString s = thisValue.toThisString(exec);
+
+ JSValue a0 = exec->argument(0);
+ JSValue a1 = exec->argument(1);
+
+ JSArray* result = constructEmptyArray(exec);
+ unsigned i = 0;
+ unsigned p0 = 0;
+ unsigned limit = a1.isUndefined() ? 0xFFFFFFFFU : a1.toUInt32(exec);
+ if (a0.inherits(&RegExpObject::info)) {
+ RegExp* reg = asRegExpObject(a0)->regExp();
+ if (s.isEmpty() && reg->match(s, 0) >= 0) {
+ // empty string matched by regexp -> empty array
+ return JSValue::encode(result);
+ }
+ unsigned pos = 0;
+ while (i != limit && pos < s.length()) {
+ Vector<int, 32> ovector;
+ int mpos = reg->match(s, pos, &ovector);
+ if (mpos < 0)
+ break;
+ int mlen = ovector[1] - ovector[0];
+ pos = mpos + (mlen == 0 ? 1 : mlen);
+ if (static_cast<unsigned>(mpos) != p0 || mlen) {
+ result->put(exec, i++, jsSubstring(exec, s, p0, mpos - p0));
+ p0 = mpos + mlen;
+ }
+ for (unsigned si = 1; si <= reg->numSubpatterns(); ++si) {
+ int spos = ovector[si * 2];
+ if (spos < 0)
+ result->put(exec, i++, jsUndefined());
+ else
+ result->put(exec, i++, jsSubstring(exec, s, spos, ovector[si * 2 + 1] - spos));
+ }
+ }
+ } else {
+ UString u2 = a0.toString(exec);
+ if (u2.isEmpty()) {
+ if (s.isEmpty()) {
+ // empty separator matches empty string -> empty array
+ return JSValue::encode(result);
+ }
+ while (i != limit && p0 < s.length() - 1)
+ result->put(exec, i++, jsSingleCharacterSubstring(exec, s, p0++));
+ } else {
+ size_t pos;
+ while (i != limit && (pos = s.find(u2, p0)) != notFound) {
+ result->put(exec, i++, jsSubstring(exec, s, p0, pos - p0));
+ p0 = pos + u2.length();
+ }
+ }
+ }
+
+ // add remaining string
+ if (i != limit)
+ result->put(exec, i++, jsSubstring(exec, s, p0, s.length() - p0));
+
+ return JSValue::encode(result);
+}
+
+EncodedJSValue JSC_HOST_CALL stringProtoFuncSubstr(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ if (thisValue.isUndefinedOrNull()) // CheckObjectCoercible
+ return throwVMTypeError(exec);
+ unsigned len;
+ JSString* jsString = 0;
+ UString uString;
+ if (thisValue.isString()) {
+ jsString = static_cast<JSString*>(thisValue.asCell());
+ len = jsString->length();
+ } else {
+ uString = thisValue.toThisObject(exec)->toString(exec);
+ len = uString.length();
+ }
+
+ JSValue a0 = exec->argument(0);
+ JSValue a1 = exec->argument(1);
+
+ double start = a0.toInteger(exec);
+ double length = a1.isUndefined() ? len : a1.toInteger(exec);
+ if (start >= len || length <= 0)
+ return JSValue::encode(jsEmptyString(exec));
+ if (start < 0) {
+ start += len;
+ if (start < 0)
+ start = 0;
+ }
+ if (start + length > len)
+ length = len - start;
+ unsigned substringStart = static_cast<unsigned>(start);
+ unsigned substringLength = static_cast<unsigned>(length);
+ if (jsString)
+ return JSValue::encode(jsSubstring(exec, jsString, substringStart, substringLength));
+ return JSValue::encode(jsSubstring(exec, uString, substringStart, substringLength));
+}
+
+EncodedJSValue JSC_HOST_CALL stringProtoFuncSubstring(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ if (thisValue.isUndefinedOrNull()) // CheckObjectCoercible
+ return throwVMTypeError(exec);
+ int len;
+ JSString* jsString = 0;
+ UString uString;
+ if (thisValue.isString()) {
+ jsString = static_cast<JSString*>(thisValue.asCell());
+ len = jsString->length();
+ } else {
+ uString = thisValue.toThisObject(exec)->toString(exec);
+ len = uString.length();
+ }
+
+ JSValue a0 = exec->argument(0);
+ JSValue a1 = exec->argument(1);
+
+ double start = a0.toNumber(exec);
+ double end;
+ if (!(start >= 0)) // check for negative values or NaN
+ start = 0;
+ else if (start > len)
+ start = len;
+ if (a1.isUndefined())
+ end = len;
+ else {
+ end = a1.toNumber(exec);
+ if (!(end >= 0)) // check for negative values or NaN
+ end = 0;
+ else if (end > len)
+ end = len;
+ }
+ if (start > end) {
+ double temp = end;
+ end = start;
+ start = temp;
+ }
+ unsigned substringStart = static_cast<unsigned>(start);
+ unsigned substringLength = static_cast<unsigned>(end) - substringStart;
+ if (jsString)
+ return JSValue::encode(jsSubstring(exec, jsString, substringStart, substringLength));
+ return JSValue::encode(jsSubstring(exec, uString, substringStart, substringLength));
+}
+
+EncodedJSValue JSC_HOST_CALL stringProtoFuncToLowerCase(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ if (thisValue.isUndefinedOrNull()) // CheckObjectCoercible
+ return throwVMTypeError(exec);
+ JSString* sVal = thisValue.toThisJSString(exec);
+ const UString& s = sVal->value(exec);
+
+ int sSize = s.length();
+ if (!sSize)
+ return JSValue::encode(sVal);
+
+ const UChar* sData = s.characters();
+ Vector<UChar> buffer(sSize);
+
+ UChar ored = 0;
+ for (int i = 0; i < sSize; i++) {
+ UChar c = sData[i];
+ ored |= c;
+ buffer[i] = toASCIILower(c);
+ }
+ if (!(ored & ~0x7f))
+ return JSValue::encode(jsString(exec, UString::adopt(buffer)));
+
+ bool error;
+ int length = Unicode::toLower(buffer.data(), sSize, sData, sSize, &error);
+ if (error) {
+ buffer.resize(length);
+ length = Unicode::toLower(buffer.data(), length, sData, sSize, &error);
+ if (error)
+ return JSValue::encode(sVal);
+ }
+ if (length == sSize) {
+ if (memcmp(buffer.data(), sData, length * sizeof(UChar)) == 0)
+ return JSValue::encode(sVal);
+ } else
+ buffer.resize(length);
+ return JSValue::encode(jsString(exec, UString::adopt(buffer)));
+}
+
+EncodedJSValue JSC_HOST_CALL stringProtoFuncToUpperCase(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ if (thisValue.isUndefinedOrNull()) // CheckObjectCoercible
+ return throwVMTypeError(exec);
+ JSString* sVal = thisValue.toThisJSString(exec);
+ const UString& s = sVal->value(exec);
+
+ int sSize = s.length();
+ if (!sSize)
+ return JSValue::encode(sVal);
+
+ const UChar* sData = s.characters();
+ Vector<UChar> buffer(sSize);
+
+ UChar ored = 0;
+ for (int i = 0; i < sSize; i++) {
+ UChar c = sData[i];
+ ored |= c;
+ buffer[i] = toASCIIUpper(c);
+ }
+ if (!(ored & ~0x7f))
+ return JSValue::encode(jsString(exec, UString::adopt(buffer)));
+
+ bool error;
+ int length = Unicode::toUpper(buffer.data(), sSize, sData, sSize, &error);
+ if (error) {
+ buffer.resize(length);
+ length = Unicode::toUpper(buffer.data(), length, sData, sSize, &error);
+ if (error)
+ return JSValue::encode(sVal);
+ }
+ if (length == sSize) {
+ if (memcmp(buffer.data(), sData, length * sizeof(UChar)) == 0)
+ return JSValue::encode(sVal);
+ } else
+ buffer.resize(length);
+ return JSValue::encode(jsString(exec, UString::adopt(buffer)));
+}
+
+EncodedJSValue JSC_HOST_CALL stringProtoFuncLocaleCompare(ExecState* exec)
+{
+ if (exec->argumentCount() < 1)
+ return JSValue::encode(jsNumber(0));
+
+ JSValue thisValue = exec->hostThisValue();
+ if (thisValue.isUndefinedOrNull()) // CheckObjectCoercible
+ return throwVMTypeError(exec);
+
+ UString s = thisValue.toThisString(exec);
+ JSValue a0 = exec->argument(0);
+ return JSValue::encode(jsNumber(localeCompare(s, a0.toString(exec))));
+}
+
+EncodedJSValue JSC_HOST_CALL stringProtoFuncBig(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ UString s = thisValue.toThisString(exec);
+ return JSValue::encode(jsMakeNontrivialString(exec, "<big>", s, "</big>"));
+}
+
+EncodedJSValue JSC_HOST_CALL stringProtoFuncSmall(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ UString s = thisValue.toThisString(exec);
+ return JSValue::encode(jsMakeNontrivialString(exec, "<small>", s, "</small>"));
+}
+
+EncodedJSValue JSC_HOST_CALL stringProtoFuncBlink(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ UString s = thisValue.toThisString(exec);
+ return JSValue::encode(jsMakeNontrivialString(exec, "<blink>", s, "</blink>"));
+}
+
+EncodedJSValue JSC_HOST_CALL stringProtoFuncBold(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ UString s = thisValue.toThisString(exec);
+ return JSValue::encode(jsMakeNontrivialString(exec, "<b>", s, "</b>"));
+}
+
+EncodedJSValue JSC_HOST_CALL stringProtoFuncFixed(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ UString s = thisValue.toThisString(exec);
+ return JSValue::encode(jsMakeNontrivialString(exec, "<tt>", s, "</tt>"));
+}
+
+EncodedJSValue JSC_HOST_CALL stringProtoFuncItalics(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ UString s = thisValue.toThisString(exec);
+ return JSValue::encode(jsMakeNontrivialString(exec, "<i>", s, "</i>"));
+}
+
+EncodedJSValue JSC_HOST_CALL stringProtoFuncStrike(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ UString s = thisValue.toThisString(exec);
+ return JSValue::encode(jsMakeNontrivialString(exec, "<strike>", s, "</strike>"));
+}
+
+EncodedJSValue JSC_HOST_CALL stringProtoFuncSub(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ UString s = thisValue.toThisString(exec);
+ return JSValue::encode(jsMakeNontrivialString(exec, "<sub>", s, "</sub>"));
+}
+
+EncodedJSValue JSC_HOST_CALL stringProtoFuncSup(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ UString s = thisValue.toThisString(exec);
+ return JSValue::encode(jsMakeNontrivialString(exec, "<sup>", s, "</sup>"));
+}
+
+EncodedJSValue JSC_HOST_CALL stringProtoFuncFontcolor(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ UString s = thisValue.toThisString(exec);
+ JSValue a0 = exec->argument(0);
+ return JSValue::encode(jsMakeNontrivialString(exec, "<font color=\"", a0.toString(exec), "\">", s, "</font>"));
+}
+
+EncodedJSValue JSC_HOST_CALL stringProtoFuncFontsize(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ UString s = thisValue.toThisString(exec);
+ JSValue a0 = exec->argument(0);
+
+ uint32_t smallInteger;
+ if (a0.getUInt32(smallInteger) && smallInteger <= 9) {
+ unsigned stringSize = s.length();
+ unsigned bufferSize = 22 + stringSize;
+ UChar* buffer;
+ PassRefPtr<StringImpl> impl = StringImpl::tryCreateUninitialized(bufferSize, buffer);
+ if (!impl)
+ return JSValue::encode(jsUndefined());
+ buffer[0] = '<';
+ buffer[1] = 'f';
+ buffer[2] = 'o';
+ buffer[3] = 'n';
+ buffer[4] = 't';
+ buffer[5] = ' ';
+ buffer[6] = 's';
+ buffer[7] = 'i';
+ buffer[8] = 'z';
+ buffer[9] = 'e';
+ buffer[10] = '=';
+ buffer[11] = '"';
+ buffer[12] = '0' + smallInteger;
+ buffer[13] = '"';
+ buffer[14] = '>';
+ memcpy(&buffer[15], s.characters(), stringSize * sizeof(UChar));
+ buffer[15 + stringSize] = '<';
+ buffer[16 + stringSize] = '/';
+ buffer[17 + stringSize] = 'f';
+ buffer[18 + stringSize] = 'o';
+ buffer[19 + stringSize] = 'n';
+ buffer[20 + stringSize] = 't';
+ buffer[21 + stringSize] = '>';
+ return JSValue::encode(jsNontrivialString(exec, impl));
+ }
+
+ return JSValue::encode(jsMakeNontrivialString(exec, "<font size=\"", a0.toString(exec), "\">", s, "</font>"));
+}
+
+EncodedJSValue JSC_HOST_CALL stringProtoFuncAnchor(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ UString s = thisValue.toThisString(exec);
+ JSValue a0 = exec->argument(0);
+ return JSValue::encode(jsMakeNontrivialString(exec, "<a name=\"", a0.toString(exec), "\">", s, "</a>"));
+}
+
+EncodedJSValue JSC_HOST_CALL stringProtoFuncLink(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ UString s = thisValue.toThisString(exec);
+ JSValue a0 = exec->argument(0);
+ UString linkText = a0.toString(exec);
+
+ unsigned linkTextSize = linkText.length();
+ unsigned stringSize = s.length();
+ unsigned bufferSize = 15 + linkTextSize + stringSize;
+ UChar* buffer;
+ PassRefPtr<StringImpl> impl = StringImpl::tryCreateUninitialized(bufferSize, buffer);
+ if (!impl)
+ return JSValue::encode(jsUndefined());
+ buffer[0] = '<';
+ buffer[1] = 'a';
+ buffer[2] = ' ';
+ buffer[3] = 'h';
+ buffer[4] = 'r';
+ buffer[5] = 'e';
+ buffer[6] = 'f';
+ buffer[7] = '=';
+ buffer[8] = '"';
+ memcpy(&buffer[9], linkText.characters(), linkTextSize * sizeof(UChar));
+ buffer[9 + linkTextSize] = '"';
+ buffer[10 + linkTextSize] = '>';
+ memcpy(&buffer[11 + linkTextSize], s.characters(), stringSize * sizeof(UChar));
+ buffer[11 + linkTextSize + stringSize] = '<';
+ buffer[12 + linkTextSize + stringSize] = '/';
+ buffer[13 + linkTextSize + stringSize] = 'a';
+ buffer[14 + linkTextSize + stringSize] = '>';
+ return JSValue::encode(jsNontrivialString(exec, impl));
+}
+
+enum {
+ TrimLeft = 1,
+ TrimRight = 2
+};
+
+static inline bool isTrimWhitespace(UChar c)
+{
+ return isStrWhiteSpace(c) || c == 0x200b;
+}
+
+static inline JSValue trimString(ExecState* exec, JSValue thisValue, int trimKind)
+{
+ if (thisValue.isUndefinedOrNull()) // CheckObjectCoercible
+ return throwTypeError(exec);
+ UString str = thisValue.toThisString(exec);
+ unsigned left = 0;
+ if (trimKind & TrimLeft) {
+ while (left < str.length() && isTrimWhitespace(str[left]))
+ left++;
+ }
+ unsigned right = str.length();
+ if (trimKind & TrimRight) {
+ while (right > left && isTrimWhitespace(str[right - 1]))
+ right--;
+ }
+
+ // Don't gc allocate a new string if we don't have to.
+ if (left == 0 && right == str.length() && thisValue.isString())
+ return thisValue;
+
+ return jsString(exec, str.substringSharingImpl(left, right - left));
+}
+
+EncodedJSValue JSC_HOST_CALL stringProtoFuncTrim(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ return JSValue::encode(trimString(exec, thisValue, TrimLeft | TrimRight));
+}
+
+EncodedJSValue JSC_HOST_CALL stringProtoFuncTrimLeft(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ return JSValue::encode(trimString(exec, thisValue, TrimLeft));
+}
+
+EncodedJSValue JSC_HOST_CALL stringProtoFuncTrimRight(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ return JSValue::encode(trimString(exec, thisValue, TrimRight));
+}
+
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/StringPrototype.h b/Source/JavaScriptCore/runtime/StringPrototype.h
new file mode 100644
index 0000000..4b0f88f
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/StringPrototype.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifndef StringPrototype_h
+#define StringPrototype_h
+
+#include "StringObject.h"
+
+namespace JSC {
+
+ class ObjectPrototype;
+
+ class StringPrototype : public StringObject {
+ public:
+ StringPrototype(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure>);
+
+ virtual bool getOwnPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&);
+ virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
+
+ virtual const ClassInfo* classInfo() const { return &info; }
+ static const ClassInfo info;
+ };
+
+} // namespace JSC
+
+#endif // StringPrototype_h
diff --git a/Source/JavaScriptCore/runtime/Structure.cpp b/Source/JavaScriptCore/runtime/Structure.cpp
new file mode 100644
index 0000000..0179eed
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/Structure.cpp
@@ -0,0 +1,1270 @@
+/*
+ * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "Structure.h"
+
+#include "Identifier.h"
+#include "JSObject.h"
+#include "JSPropertyNameIterator.h"
+#include "Lookup.h"
+#include "PropertyNameArray.h"
+#include "StructureChain.h"
+#include <wtf/RefCountedLeakCounter.h>
+#include <wtf/RefPtr.h>
+
+#if ENABLE(JSC_MULTIPLE_THREADS)
+#include <wtf/Threading.h>
+#endif
+
+#define DUMP_STRUCTURE_ID_STATISTICS 0
+
+#ifndef NDEBUG
+#define DO_PROPERTYMAP_CONSTENCY_CHECK 0
+#else
+#define DO_PROPERTYMAP_CONSTENCY_CHECK 0
+#endif
+
+using namespace std;
+using namespace WTF;
+
+namespace JSC {
+
+// Choose a number for the following so that most property maps are smaller,
+// but it's not going to blow out the stack to allocate this number of pointers.
+static const int smallMapThreshold = 1024;
+
+// The point at which the function call overhead of the qsort implementation
+// becomes small compared to the inefficiency of insertion sort.
+static const unsigned tinyMapThreshold = 20;
+
+static const unsigned newTableSize = 16;
+
+#ifndef NDEBUG
+static WTF::RefCountedLeakCounter structureCounter("Structure");
+
+#if ENABLE(JSC_MULTIPLE_THREADS)
+static Mutex& ignoreSetMutex = *(new Mutex);
+#endif
+
+static bool shouldIgnoreLeaks;
+static HashSet<Structure*>& ignoreSet = *(new HashSet<Structure*>);
+#endif
+
+#if DUMP_STRUCTURE_ID_STATISTICS
+static HashSet<Structure*>& liveStructureSet = *(new HashSet<Structure*>);
+#endif
+
+static int comparePropertyMapEntryIndices(const void* a, const void* b);
+
+inline void Structure::setTransitionTable(TransitionTable* table)
+{
+ ASSERT(m_isUsingSingleSlot);
+#ifndef NDEBUG
+ setSingleTransition(0);
+#endif
+ m_isUsingSingleSlot = false;
+ m_transitions.m_table = table;
+ // This implicitly clears the flag that indicates we're using a single transition
+ ASSERT(!m_isUsingSingleSlot);
+}
+
+// The contains and get methods accept imprecise matches, so if an unspecialised transition exists
+// for the given key they will consider that transition to be a match. If a specialised transition
+// exists and it matches the provided specificValue, get will return the specific transition.
+inline bool Structure::transitionTableContains(const StructureTransitionTableHash::Key& key, JSCell* specificValue)
+{
+ if (m_isUsingSingleSlot) {
+ Structure* existingTransition = singleTransition();
+ return existingTransition && existingTransition->m_nameInPrevious.get() == key.first
+ && existingTransition->m_attributesInPrevious == key.second
+ && (existingTransition->m_specificValueInPrevious == specificValue || existingTransition->m_specificValueInPrevious == 0);
+ }
+ TransitionTable::iterator find = transitionTable()->find(key);
+ if (find == transitionTable()->end())
+ return false;
+
+ return find->second.first || find->second.second->transitionedFor(specificValue);
+}
+
+inline Structure* Structure::transitionTableGet(const StructureTransitionTableHash::Key& key, JSCell* specificValue) const
+{
+ if (m_isUsingSingleSlot) {
+ Structure* existingTransition = singleTransition();
+ if (existingTransition && existingTransition->m_nameInPrevious.get() == key.first
+ && existingTransition->m_attributesInPrevious == key.second
+ && (existingTransition->m_specificValueInPrevious == specificValue || existingTransition->m_specificValueInPrevious == 0))
+ return existingTransition;
+ return 0;
+ }
+
+ Transition transition = transitionTable()->get(key);
+ if (transition.second && transition.second->transitionedFor(specificValue))
+ return transition.second;
+ return transition.first;
+}
+
+inline bool Structure::transitionTableHasTransition(const StructureTransitionTableHash::Key& key) const
+{
+ if (m_isUsingSingleSlot) {
+ Structure* transition = singleTransition();
+ return transition && transition->m_nameInPrevious == key.first
+ && transition->m_attributesInPrevious == key.second;
+ }
+ return transitionTable()->contains(key);
+}
+
+inline void Structure::transitionTableRemove(const StructureTransitionTableHash::Key& key, JSCell* specificValue)
+{
+ if (m_isUsingSingleSlot) {
+ ASSERT(transitionTableContains(key, specificValue));
+ setSingleTransition(0);
+ return;
+ }
+ TransitionTable::iterator find = transitionTable()->find(key);
+ if (!specificValue)
+ find->second.first = 0;
+ else
+ find->second.second = 0;
+ if (!find->second.first && !find->second.second)
+ transitionTable()->remove(find);
+}
+
+inline void Structure::transitionTableAdd(const StructureTransitionTableHash::Key& key, Structure* structure, JSCell* specificValue)
+{
+ if (m_isUsingSingleSlot) {
+ if (!singleTransition()) {
+ setSingleTransition(structure);
+ return;
+ }
+ Structure* existingTransition = singleTransition();
+ TransitionTable* transitionTable = new TransitionTable;
+ setTransitionTable(transitionTable);
+ if (existingTransition)
+ transitionTableAdd(std::make_pair(existingTransition->m_nameInPrevious.get(), existingTransition->m_attributesInPrevious), existingTransition, existingTransition->m_specificValueInPrevious);
+ }
+ if (!specificValue) {
+ TransitionTable::iterator find = transitionTable()->find(key);
+ if (find == transitionTable()->end())
+ transitionTable()->add(key, Transition(structure, static_cast<Structure*>(0)));
+ else
+ find->second.first = structure;
+ } else {
+ // If we're adding a transition to a specific value, then there cannot be
+ // an existing transition
+ ASSERT(!transitionTable()->contains(key));
+ transitionTable()->add(key, Transition(static_cast<Structure*>(0), structure));
+ }
+}
+
+void Structure::dumpStatistics()
+{
+#if DUMP_STRUCTURE_ID_STATISTICS
+ unsigned numberLeaf = 0;
+ unsigned numberUsingSingleSlot = 0;
+ unsigned numberSingletons = 0;
+ unsigned numberWithPropertyMaps = 0;
+ unsigned totalPropertyMapsSize = 0;
+
+ HashSet<Structure*>::const_iterator end = liveStructureSet.end();
+ for (HashSet<Structure*>::const_iterator it = liveStructureSet.begin(); it != end; ++it) {
+ Structure* structure = *it;
+ if (structure->m_usingSingleTransitionSlot) {
+ if (!structure->m_transitions.singleTransition)
+ ++numberLeaf;
+ else
+ ++numberUsingSingleSlot;
+
+ if (!structure->m_previous && !structure->m_transitions.singleTransition)
+ ++numberSingletons;
+ }
+
+ if (structure->m_propertyTable) {
+ ++numberWithPropertyMaps;
+ totalPropertyMapsSize += PropertyMapHashTable::allocationSize(structure->m_propertyTable->size);
+ if (structure->m_propertyTable->deletedOffsets)
+ totalPropertyMapsSize += (structure->m_propertyTable->deletedOffsets->capacity() * sizeof(unsigned));
+ }
+ }
+
+ printf("Number of live Structures: %d\n", liveStructureSet.size());
+ printf("Number of Structures using the single item optimization for transition map: %d\n", numberUsingSingleSlot);
+ printf("Number of Structures that are leaf nodes: %d\n", numberLeaf);
+ printf("Number of Structures that singletons: %d\n", numberSingletons);
+ printf("Number of Structures with PropertyMaps: %d\n", numberWithPropertyMaps);
+
+ printf("Size of a single Structures: %d\n", static_cast<unsigned>(sizeof(Structure)));
+ printf("Size of sum of all property maps: %d\n", totalPropertyMapsSize);
+ printf("Size of average of all property maps: %f\n", static_cast<double>(totalPropertyMapsSize) / static_cast<double>(liveStructureSet.size()));
+#else
+ printf("Dumping Structure statistics is not enabled.\n");
+#endif
+}
+
+Structure::Structure(JSValue prototype, const TypeInfo& typeInfo, unsigned anonymousSlotCount)
+ : m_typeInfo(typeInfo)
+ , m_prototype(prototype)
+ , m_specificValueInPrevious(0)
+ , m_propertyTable(0)
+ , m_propertyStorageCapacity(JSObject::inlineStorageCapacity)
+ , m_offset(noOffset)
+ , m_dictionaryKind(NoneDictionaryKind)
+ , m_isPinnedPropertyTable(false)
+ , m_hasGetterSetterProperties(false)
+ , m_hasNonEnumerableProperties(false)
+ , m_attributesInPrevious(0)
+ , m_specificFunctionThrashCount(0)
+ , m_anonymousSlotCount(anonymousSlotCount)
+ , m_isUsingSingleSlot(true)
+{
+ m_transitions.m_singleTransition = 0;
+
+ ASSERT(m_prototype);
+ ASSERT(m_prototype.isObject() || m_prototype.isNull());
+
+#ifndef NDEBUG
+#if ENABLE(JSC_MULTIPLE_THREADS)
+ MutexLocker protect(ignoreSetMutex);
+#endif
+ if (shouldIgnoreLeaks)
+ ignoreSet.add(this);
+ else
+ structureCounter.increment();
+#endif
+
+#if DUMP_STRUCTURE_ID_STATISTICS
+ liveStructureSet.add(this);
+#endif
+}
+
+Structure::~Structure()
+{
+ if (m_previous) {
+ ASSERT(m_nameInPrevious);
+ m_previous->transitionTableRemove(make_pair(m_nameInPrevious.get(), m_attributesInPrevious), m_specificValueInPrevious);
+
+ }
+ ASSERT(!m_enumerationCache.hasDeadObject());
+
+ if (m_propertyTable) {
+ unsigned entryCount = m_propertyTable->keyCount + m_propertyTable->deletedSentinelCount;
+ for (unsigned i = 1; i <= entryCount; i++) {
+ if (StringImpl* key = m_propertyTable->entries()[i].key)
+ key->deref();
+ }
+
+ delete m_propertyTable->deletedOffsets;
+ fastFree(m_propertyTable);
+ }
+
+ if (!m_isUsingSingleSlot)
+ delete transitionTable();
+
+#ifndef NDEBUG
+#if ENABLE(JSC_MULTIPLE_THREADS)
+ MutexLocker protect(ignoreSetMutex);
+#endif
+ HashSet<Structure*>::iterator it = ignoreSet.find(this);
+ if (it != ignoreSet.end())
+ ignoreSet.remove(it);
+ else
+ structureCounter.decrement();
+#endif
+
+#if DUMP_STRUCTURE_ID_STATISTICS
+ liveStructureSet.remove(this);
+#endif
+}
+
+void Structure::startIgnoringLeaks()
+{
+#ifndef NDEBUG
+ shouldIgnoreLeaks = true;
+#endif
+}
+
+void Structure::stopIgnoringLeaks()
+{
+#ifndef NDEBUG
+ shouldIgnoreLeaks = false;
+#endif
+}
+
+static bool isPowerOf2(unsigned v)
+{
+ // Taken from http://www.cs.utk.edu/~vose/c-stuff/bithacks.html
+
+ return !(v & (v - 1)) && v;
+}
+
+static unsigned nextPowerOf2(unsigned v)
+{
+ // Taken from http://www.cs.utk.edu/~vose/c-stuff/bithacks.html
+ // Devised by Sean Anderson, Sepember 14, 2001
+
+ v--;
+ v |= v >> 1;
+ v |= v >> 2;
+ v |= v >> 4;
+ v |= v >> 8;
+ v |= v >> 16;
+ v++;
+
+ return v;
+}
+
+static unsigned sizeForKeyCount(size_t keyCount)
+{
+ if (keyCount == notFound)
+ return newTableSize;
+
+ if (keyCount < 8)
+ return newTableSize;
+
+ if (isPowerOf2(keyCount))
+ return keyCount * 4;
+
+ return nextPowerOf2(keyCount) * 2;
+}
+
+void Structure::materializePropertyMap()
+{
+ ASSERT(!m_propertyTable);
+
+ Vector<Structure*, 8> structures;
+ structures.append(this);
+
+ Structure* structure = this;
+
+ // Search for the last Structure with a property table.
+ while ((structure = structure->previousID())) {
+ if (structure->m_isPinnedPropertyTable) {
+ ASSERT(structure->m_propertyTable);
+ ASSERT(!structure->m_previous);
+
+ m_propertyTable = structure->copyPropertyTable();
+ break;
+ }
+
+ structures.append(structure);
+ }
+
+ if (!m_propertyTable)
+ createPropertyMapHashTable(sizeForKeyCount(m_offset + 1));
+ else {
+ if (sizeForKeyCount(m_offset + 1) > m_propertyTable->size)
+ rehashPropertyMapHashTable(sizeForKeyCount(m_offset + 1)); // This could be made more efficient by combining with the copy above.
+ }
+
+ for (ptrdiff_t i = structures.size() - 2; i >= 0; --i) {
+ structure = structures[i];
+ structure->m_nameInPrevious->ref();
+ PropertyMapEntry entry(structure->m_nameInPrevious.get(), m_anonymousSlotCount + structure->m_offset, structure->m_attributesInPrevious, structure->m_specificValueInPrevious, ++m_propertyTable->lastIndexUsed);
+ insertIntoPropertyMapHashTable(entry);
+ }
+}
+
+void Structure::growPropertyStorageCapacity()
+{
+ if (m_propertyStorageCapacity == JSObject::inlineStorageCapacity)
+ m_propertyStorageCapacity = JSObject::nonInlineBaseStorageCapacity;
+ else
+ m_propertyStorageCapacity *= 2;
+}
+
+void Structure::despecifyDictionaryFunction(const Identifier& propertyName)
+{
+ const StringImpl* rep = propertyName.impl();
+
+ materializePropertyMapIfNecessary();
+
+ ASSERT(isDictionary());
+ ASSERT(m_propertyTable);
+
+ unsigned i = rep->existingHash();
+
+#if DUMP_PROPERTYMAP_STATS
+ ++numProbes;
+#endif
+
+ unsigned entryIndex = m_propertyTable->entryIndices[i & m_propertyTable->sizeMask];
+ ASSERT(entryIndex != emptyEntryIndex);
+
+ if (rep == m_propertyTable->entries()[entryIndex - 1].key) {
+ m_propertyTable->entries()[entryIndex - 1].specificValue = 0;
+ return;
+ }
+
+#if DUMP_PROPERTYMAP_STATS
+ ++numCollisions;
+#endif
+
+ unsigned k = 1 | doubleHash(rep->existingHash());
+
+ while (1) {
+ i += k;
+
+#if DUMP_PROPERTYMAP_STATS
+ ++numRehashes;
+#endif
+
+ entryIndex = m_propertyTable->entryIndices[i & m_propertyTable->sizeMask];
+ ASSERT(entryIndex != emptyEntryIndex);
+
+ if (rep == m_propertyTable->entries()[entryIndex - 1].key) {
+ m_propertyTable->entries()[entryIndex - 1].specificValue = 0;
+ return;
+ }
+ }
+}
+
+PassRefPtr<Structure> Structure::addPropertyTransitionToExistingStructure(Structure* structure, const Identifier& propertyName, unsigned attributes, JSCell* specificValue, size_t& offset)
+{
+ ASSERT(!structure->isDictionary());
+ ASSERT(structure->typeInfo().type() == ObjectType);
+
+ if (Structure* existingTransition = structure->transitionTableGet(make_pair(propertyName.impl(), attributes), specificValue)) {
+ ASSERT(existingTransition->m_offset != noOffset);
+ offset = existingTransition->m_offset + existingTransition->m_anonymousSlotCount;
+ ASSERT(offset >= structure->m_anonymousSlotCount);
+ ASSERT(structure->m_anonymousSlotCount == existingTransition->m_anonymousSlotCount);
+ return existingTransition;
+ }
+
+ return 0;
+}
+
+PassRefPtr<Structure> Structure::addPropertyTransition(Structure* structure, const Identifier& propertyName, unsigned attributes, JSCell* specificValue, size_t& offset)
+{
+ ASSERT(!structure->isDictionary());
+ ASSERT(structure->typeInfo().type() == ObjectType);
+ ASSERT(!Structure::addPropertyTransitionToExistingStructure(structure, propertyName, attributes, specificValue, offset));
+
+ if (structure->m_specificFunctionThrashCount == maxSpecificFunctionThrashCount)
+ specificValue = 0;
+
+ if (structure->transitionCount() > s_maxTransitionLength) {
+ RefPtr<Structure> transition = toCacheableDictionaryTransition(structure);
+ ASSERT(structure != transition);
+ offset = transition->put(propertyName, attributes, specificValue);
+ ASSERT(offset >= structure->m_anonymousSlotCount);
+ ASSERT(structure->m_anonymousSlotCount == transition->m_anonymousSlotCount);
+ if (transition->propertyStorageSize() > transition->propertyStorageCapacity())
+ transition->growPropertyStorageCapacity();
+ return transition.release();
+ }
+
+ RefPtr<Structure> transition = create(structure->m_prototype, structure->typeInfo(), structure->anonymousSlotCount());
+
+ transition->m_cachedPrototypeChain = structure->m_cachedPrototypeChain;
+ transition->m_previous = structure;
+ transition->m_nameInPrevious = propertyName.impl();
+ transition->m_attributesInPrevious = attributes;
+ transition->m_specificValueInPrevious = specificValue;
+ transition->m_propertyStorageCapacity = structure->m_propertyStorageCapacity;
+ transition->m_hasGetterSetterProperties = structure->m_hasGetterSetterProperties;
+ transition->m_hasNonEnumerableProperties = structure->m_hasNonEnumerableProperties;
+ transition->m_specificFunctionThrashCount = structure->m_specificFunctionThrashCount;
+
+ if (structure->m_propertyTable) {
+ if (structure->m_isPinnedPropertyTable)
+ transition->m_propertyTable = structure->copyPropertyTable();
+ else {
+ transition->m_propertyTable = structure->m_propertyTable;
+ structure->m_propertyTable = 0;
+ }
+ } else {
+ if (structure->m_previous)
+ transition->materializePropertyMap();
+ else
+ transition->createPropertyMapHashTable();
+ }
+
+ offset = transition->put(propertyName, attributes, specificValue);
+ ASSERT(offset >= structure->m_anonymousSlotCount);
+ ASSERT(structure->m_anonymousSlotCount == transition->m_anonymousSlotCount);
+ if (transition->propertyStorageSize() > transition->propertyStorageCapacity())
+ transition->growPropertyStorageCapacity();
+
+ transition->m_offset = offset - structure->m_anonymousSlotCount;
+ ASSERT(structure->anonymousSlotCount() == transition->anonymousSlotCount());
+ structure->transitionTableAdd(make_pair(propertyName.impl(), attributes), transition.get(), specificValue);
+ return transition.release();
+}
+
+PassRefPtr<Structure> Structure::removePropertyTransition(Structure* structure, const Identifier& propertyName, size_t& offset)
+{
+ ASSERT(!structure->isUncacheableDictionary());
+
+ RefPtr<Structure> transition = toUncacheableDictionaryTransition(structure);
+
+ offset = transition->remove(propertyName);
+ ASSERT(offset >= structure->m_anonymousSlotCount);
+ ASSERT(structure->m_anonymousSlotCount == transition->m_anonymousSlotCount);
+
+ return transition.release();
+}
+
+PassRefPtr<Structure> Structure::changePrototypeTransition(Structure* structure, JSValue prototype)
+{
+ RefPtr<Structure> transition = create(prototype, structure->typeInfo(), structure->anonymousSlotCount());
+
+ transition->m_propertyStorageCapacity = structure->m_propertyStorageCapacity;
+ transition->m_hasGetterSetterProperties = structure->m_hasGetterSetterProperties;
+ transition->m_hasNonEnumerableProperties = structure->m_hasNonEnumerableProperties;
+ transition->m_specificFunctionThrashCount = structure->m_specificFunctionThrashCount;
+
+ // Don't set m_offset, as one can not transition to this.
+
+ structure->materializePropertyMapIfNecessary();
+ transition->m_propertyTable = structure->copyPropertyTable();
+ transition->m_isPinnedPropertyTable = true;
+
+ ASSERT(structure->anonymousSlotCount() == transition->anonymousSlotCount());
+ return transition.release();
+}
+
+PassRefPtr<Structure> Structure::despecifyFunctionTransition(Structure* structure, const Identifier& replaceFunction)
+{
+ ASSERT(structure->m_specificFunctionThrashCount < maxSpecificFunctionThrashCount);
+ RefPtr<Structure> transition = create(structure->storedPrototype(), structure->typeInfo(), structure->anonymousSlotCount());
+
+ transition->m_propertyStorageCapacity = structure->m_propertyStorageCapacity;
+ transition->m_hasGetterSetterProperties = structure->m_hasGetterSetterProperties;
+ transition->m_hasNonEnumerableProperties = structure->m_hasNonEnumerableProperties;
+ transition->m_specificFunctionThrashCount = structure->m_specificFunctionThrashCount + 1;
+
+ // Don't set m_offset, as one can not transition to this.
+
+ structure->materializePropertyMapIfNecessary();
+ transition->m_propertyTable = structure->copyPropertyTable();
+ transition->m_isPinnedPropertyTable = true;
+
+ if (transition->m_specificFunctionThrashCount == maxSpecificFunctionThrashCount)
+ transition->despecifyAllFunctions();
+ else {
+ bool removed = transition->despecifyFunction(replaceFunction);
+ ASSERT_UNUSED(removed, removed);
+ }
+
+ ASSERT(structure->anonymousSlotCount() == transition->anonymousSlotCount());
+ return transition.release();
+}
+
+PassRefPtr<Structure> Structure::getterSetterTransition(Structure* structure)
+{
+ RefPtr<Structure> transition = create(structure->storedPrototype(), structure->typeInfo(), structure->anonymousSlotCount());
+ transition->m_propertyStorageCapacity = structure->m_propertyStorageCapacity;
+ transition->m_hasGetterSetterProperties = transition->m_hasGetterSetterProperties;
+ transition->m_hasNonEnumerableProperties = structure->m_hasNonEnumerableProperties;
+ transition->m_specificFunctionThrashCount = structure->m_specificFunctionThrashCount;
+
+ // Don't set m_offset, as one can not transition to this.
+
+ structure->materializePropertyMapIfNecessary();
+ transition->m_propertyTable = structure->copyPropertyTable();
+ transition->m_isPinnedPropertyTable = true;
+
+ ASSERT(structure->anonymousSlotCount() == transition->anonymousSlotCount());
+ return transition.release();
+}
+
+PassRefPtr<Structure> Structure::toDictionaryTransition(Structure* structure, DictionaryKind kind)
+{
+ ASSERT(!structure->isUncacheableDictionary());
+
+ RefPtr<Structure> transition = create(structure->m_prototype, structure->typeInfo(), structure->anonymousSlotCount());
+ transition->m_dictionaryKind = kind;
+ transition->m_propertyStorageCapacity = structure->m_propertyStorageCapacity;
+ transition->m_hasGetterSetterProperties = structure->m_hasGetterSetterProperties;
+ transition->m_hasNonEnumerableProperties = structure->m_hasNonEnumerableProperties;
+ transition->m_specificFunctionThrashCount = structure->m_specificFunctionThrashCount;
+
+ structure->materializePropertyMapIfNecessary();
+ transition->m_propertyTable = structure->copyPropertyTable();
+ transition->m_isPinnedPropertyTable = true;
+
+ ASSERT(structure->anonymousSlotCount() == transition->anonymousSlotCount());
+ return transition.release();
+}
+
+PassRefPtr<Structure> Structure::toCacheableDictionaryTransition(Structure* structure)
+{
+ return toDictionaryTransition(structure, CachedDictionaryKind);
+}
+
+PassRefPtr<Structure> Structure::toUncacheableDictionaryTransition(Structure* structure)
+{
+ return toDictionaryTransition(structure, UncachedDictionaryKind);
+}
+
+PassRefPtr<Structure> Structure::flattenDictionaryStructure(JSObject* object)
+{
+ ASSERT(isDictionary());
+ if (isUncacheableDictionary()) {
+ ASSERT(m_propertyTable);
+ Vector<PropertyMapEntry*> sortedPropertyEntries(m_propertyTable->keyCount);
+ PropertyMapEntry** p = sortedPropertyEntries.data();
+ unsigned entryCount = m_propertyTable->keyCount + m_propertyTable->deletedSentinelCount;
+ for (unsigned i = 1; i <= entryCount; i++) {
+ if (m_propertyTable->entries()[i].key)
+ *p++ = &m_propertyTable->entries()[i];
+ }
+ size_t propertyCount = p - sortedPropertyEntries.data();
+ qsort(sortedPropertyEntries.data(), propertyCount, sizeof(PropertyMapEntry*), comparePropertyMapEntryIndices);
+ sortedPropertyEntries.resize(propertyCount);
+
+ // We now have the properties currently defined on this object
+ // in the order that they are expected to be in, but we need to
+ // reorder the storage, so we have to copy the current values out
+ Vector<JSValue> values(propertyCount);
+ unsigned anonymousSlotCount = m_anonymousSlotCount;
+ for (unsigned i = 0; i < propertyCount; i++) {
+ PropertyMapEntry* entry = sortedPropertyEntries[i];
+ values[i] = object->getDirectOffset(entry->offset);
+ // Update property table to have the new property offsets
+ entry->offset = anonymousSlotCount + i;
+ entry->index = i;
+ }
+
+ // Copy the original property values into their final locations
+ for (unsigned i = 0; i < propertyCount; i++)
+ object->putDirectOffset(anonymousSlotCount + i, values[i]);
+
+ if (m_propertyTable->deletedOffsets) {
+ delete m_propertyTable->deletedOffsets;
+ m_propertyTable->deletedOffsets = 0;
+ }
+ }
+
+ m_dictionaryKind = NoneDictionaryKind;
+ return this;
+}
+
+size_t Structure::addPropertyWithoutTransition(const Identifier& propertyName, unsigned attributes, JSCell* specificValue)
+{
+ ASSERT(!m_enumerationCache);
+
+ if (m_specificFunctionThrashCount == maxSpecificFunctionThrashCount)
+ specificValue = 0;
+
+ materializePropertyMapIfNecessary();
+
+ m_isPinnedPropertyTable = true;
+
+ size_t offset = put(propertyName, attributes, specificValue);
+ ASSERT(offset >= m_anonymousSlotCount);
+ if (propertyStorageSize() > propertyStorageCapacity())
+ growPropertyStorageCapacity();
+ return offset;
+}
+
+size_t Structure::removePropertyWithoutTransition(const Identifier& propertyName)
+{
+ ASSERT(isUncacheableDictionary());
+ ASSERT(!m_enumerationCache);
+
+ materializePropertyMapIfNecessary();
+
+ m_isPinnedPropertyTable = true;
+ size_t offset = remove(propertyName);
+ ASSERT(offset >= m_anonymousSlotCount);
+ return offset;
+}
+
+#if DUMP_PROPERTYMAP_STATS
+
+static int numProbes;
+static int numCollisions;
+static int numRehashes;
+static int numRemoves;
+
+struct PropertyMapStatisticsExitLogger {
+ ~PropertyMapStatisticsExitLogger();
+};
+
+static PropertyMapStatisticsExitLogger logger;
+
+PropertyMapStatisticsExitLogger::~PropertyMapStatisticsExitLogger()
+{
+ printf("\nJSC::PropertyMap statistics\n\n");
+ printf("%d probes\n", numProbes);
+ printf("%d collisions (%.1f%%)\n", numCollisions, 100.0 * numCollisions / numProbes);
+ printf("%d rehashes\n", numRehashes);
+ printf("%d removes\n", numRemoves);
+}
+
+#endif
+
+static const unsigned deletedSentinelIndex = 1;
+
+#if !DO_PROPERTYMAP_CONSTENCY_CHECK
+
+inline void Structure::checkConsistency()
+{
+}
+
+#endif
+
+PropertyMapHashTable* Structure::copyPropertyTable()
+{
+ if (!m_propertyTable)
+ return 0;
+
+ size_t tableSize = PropertyMapHashTable::allocationSize(m_propertyTable->size);
+ PropertyMapHashTable* newTable = static_cast<PropertyMapHashTable*>(fastMalloc(tableSize));
+ memcpy(newTable, m_propertyTable, tableSize);
+
+ unsigned entryCount = m_propertyTable->keyCount + m_propertyTable->deletedSentinelCount;
+ for (unsigned i = 1; i <= entryCount; ++i) {
+ if (StringImpl* key = newTable->entries()[i].key)
+ key->ref();
+ }
+
+ // Copy the deletedOffsets vector.
+ if (m_propertyTable->deletedOffsets)
+ newTable->deletedOffsets = new Vector<unsigned>(*m_propertyTable->deletedOffsets);
+
+ return newTable;
+}
+
+size_t Structure::get(const StringImpl* rep, unsigned& attributes, JSCell*& specificValue)
+{
+ materializePropertyMapIfNecessary();
+ if (!m_propertyTable)
+ return notFound;
+
+ unsigned i = rep->existingHash();
+
+#if DUMP_PROPERTYMAP_STATS
+ ++numProbes;
+#endif
+
+ unsigned entryIndex = m_propertyTable->entryIndices[i & m_propertyTable->sizeMask];
+ if (entryIndex == emptyEntryIndex)
+ return notFound;
+
+ if (rep == m_propertyTable->entries()[entryIndex - 1].key) {
+ attributes = m_propertyTable->entries()[entryIndex - 1].attributes;
+ specificValue = m_propertyTable->entries()[entryIndex - 1].specificValue;
+ ASSERT(m_propertyTable->entries()[entryIndex - 1].offset >= m_anonymousSlotCount);
+ return m_propertyTable->entries()[entryIndex - 1].offset;
+ }
+
+#if DUMP_PROPERTYMAP_STATS
+ ++numCollisions;
+#endif
+
+ unsigned k = 1 | doubleHash(rep->existingHash());
+
+ while (1) {
+ i += k;
+
+#if DUMP_PROPERTYMAP_STATS
+ ++numRehashes;
+#endif
+
+ entryIndex = m_propertyTable->entryIndices[i & m_propertyTable->sizeMask];
+ if (entryIndex == emptyEntryIndex)
+ return notFound;
+
+ if (rep == m_propertyTable->entries()[entryIndex - 1].key) {
+ attributes = m_propertyTable->entries()[entryIndex - 1].attributes;
+ specificValue = m_propertyTable->entries()[entryIndex - 1].specificValue;
+ ASSERT(m_propertyTable->entries()[entryIndex - 1].offset >= m_anonymousSlotCount);
+ return m_propertyTable->entries()[entryIndex - 1].offset;
+ }
+ }
+}
+
+bool Structure::despecifyFunction(const Identifier& propertyName)
+{
+ ASSERT(!propertyName.isNull());
+
+ materializePropertyMapIfNecessary();
+ if (!m_propertyTable)
+ return false;
+
+ StringImpl* rep = propertyName.impl();
+
+ unsigned i = rep->existingHash();
+
+#if DUMP_PROPERTYMAP_STATS
+ ++numProbes;
+#endif
+
+ unsigned entryIndex = m_propertyTable->entryIndices[i & m_propertyTable->sizeMask];
+ if (entryIndex == emptyEntryIndex)
+ return false;
+
+ if (rep == m_propertyTable->entries()[entryIndex - 1].key) {
+ ASSERT(m_propertyTable->entries()[entryIndex - 1].specificValue);
+ m_propertyTable->entries()[entryIndex - 1].specificValue = 0;
+ return true;
+ }
+
+#if DUMP_PROPERTYMAP_STATS
+ ++numCollisions;
+#endif
+
+ unsigned k = 1 | doubleHash(rep->existingHash());
+
+ while (1) {
+ i += k;
+
+#if DUMP_PROPERTYMAP_STATS
+ ++numRehashes;
+#endif
+
+ entryIndex = m_propertyTable->entryIndices[i & m_propertyTable->sizeMask];
+ if (entryIndex == emptyEntryIndex)
+ return false;
+
+ if (rep == m_propertyTable->entries()[entryIndex - 1].key) {
+ ASSERT(m_propertyTable->entries()[entryIndex - 1].specificValue);
+ m_propertyTable->entries()[entryIndex - 1].specificValue = 0;
+ return true;
+ }
+ }
+}
+
+void Structure::despecifyAllFunctions()
+{
+ materializePropertyMapIfNecessary();
+ if (!m_propertyTable)
+ return;
+
+ unsigned entryCount = m_propertyTable->keyCount + m_propertyTable->deletedSentinelCount;
+ for (unsigned i = 1; i <= entryCount; ++i)
+ m_propertyTable->entries()[i].specificValue = 0;
+}
+
+size_t Structure::put(const Identifier& propertyName, unsigned attributes, JSCell* specificValue)
+{
+ ASSERT(!propertyName.isNull());
+ ASSERT(get(propertyName) == notFound);
+
+ checkConsistency();
+
+ if (attributes & DontEnum)
+ m_hasNonEnumerableProperties = true;
+
+ StringImpl* rep = propertyName.impl();
+
+ if (!m_propertyTable)
+ createPropertyMapHashTable();
+
+ // FIXME: Consider a fast case for tables with no deleted sentinels.
+
+ unsigned i = rep->existingHash();
+ unsigned k = 0;
+ bool foundDeletedElement = false;
+ unsigned deletedElementIndex = 0; // initialize to make the compiler happy
+
+#if DUMP_PROPERTYMAP_STATS
+ ++numProbes;
+#endif
+
+ while (1) {
+ unsigned entryIndex = m_propertyTable->entryIndices[i & m_propertyTable->sizeMask];
+ if (entryIndex == emptyEntryIndex)
+ break;
+
+ if (entryIndex == deletedSentinelIndex) {
+ // If we find a deleted-element sentinel, remember it for use later.
+ if (!foundDeletedElement) {
+ foundDeletedElement = true;
+ deletedElementIndex = i;
+ }
+ }
+
+ if (k == 0) {
+ k = 1 | doubleHash(rep->existingHash());
+#if DUMP_PROPERTYMAP_STATS
+ ++numCollisions;
+#endif
+ }
+
+ i += k;
+
+#if DUMP_PROPERTYMAP_STATS
+ ++numRehashes;
+#endif
+ }
+
+ // Figure out which entry to use.
+ unsigned entryIndex = m_propertyTable->keyCount + m_propertyTable->deletedSentinelCount + 2;
+ if (foundDeletedElement) {
+ i = deletedElementIndex;
+ --m_propertyTable->deletedSentinelCount;
+
+ // Since we're not making the table bigger, we can't use the entry one past
+ // the end that we were planning on using, so search backwards for the empty
+ // slot that we can use. We know it will be there because we did at least one
+ // deletion in the past that left an entry empty.
+ while (m_propertyTable->entries()[--entryIndex - 1].key) { }
+ }
+
+ // Create a new hash table entry.
+ m_propertyTable->entryIndices[i & m_propertyTable->sizeMask] = entryIndex;
+
+ // Create a new hash table entry.
+ rep->ref();
+ m_propertyTable->entries()[entryIndex - 1].key = rep;
+ m_propertyTable->entries()[entryIndex - 1].attributes = attributes;
+ m_propertyTable->entries()[entryIndex - 1].specificValue = specificValue;
+ m_propertyTable->entries()[entryIndex - 1].index = ++m_propertyTable->lastIndexUsed;
+
+ unsigned newOffset;
+ if (m_propertyTable->deletedOffsets && !m_propertyTable->deletedOffsets->isEmpty()) {
+ newOffset = m_propertyTable->deletedOffsets->last();
+ m_propertyTable->deletedOffsets->removeLast();
+ } else
+ newOffset = m_propertyTable->keyCount + m_anonymousSlotCount;
+ m_propertyTable->entries()[entryIndex - 1].offset = newOffset;
+
+ ASSERT(newOffset >= m_anonymousSlotCount);
+ ++m_propertyTable->keyCount;
+
+ if ((m_propertyTable->keyCount + m_propertyTable->deletedSentinelCount) * 2 >= m_propertyTable->size)
+ expandPropertyMapHashTable();
+
+ checkConsistency();
+ return newOffset;
+}
+
+bool Structure::hasTransition(StringImpl* rep, unsigned attributes)
+{
+ return transitionTableHasTransition(make_pair(rep, attributes));
+}
+
+size_t Structure::remove(const Identifier& propertyName)
+{
+ ASSERT(!propertyName.isNull());
+
+ checkConsistency();
+
+ StringImpl* rep = propertyName.impl();
+
+ if (!m_propertyTable)
+ return notFound;
+
+#if DUMP_PROPERTYMAP_STATS
+ ++numProbes;
+ ++numRemoves;
+#endif
+
+ // Find the thing to remove.
+ unsigned i = rep->existingHash();
+ unsigned k = 0;
+ unsigned entryIndex;
+ StringImpl* key = 0;
+ while (1) {
+ entryIndex = m_propertyTable->entryIndices[i & m_propertyTable->sizeMask];
+ if (entryIndex == emptyEntryIndex)
+ return notFound;
+
+ key = m_propertyTable->entries()[entryIndex - 1].key;
+ if (rep == key)
+ break;
+
+ if (k == 0) {
+ k = 1 | doubleHash(rep->existingHash());
+#if DUMP_PROPERTYMAP_STATS
+ ++numCollisions;
+#endif
+ }
+
+ i += k;
+
+#if DUMP_PROPERTYMAP_STATS
+ ++numRehashes;
+#endif
+ }
+
+ // Replace this one element with the deleted sentinel. Also clear out
+ // the entry so we can iterate all the entries as needed.
+ m_propertyTable->entryIndices[i & m_propertyTable->sizeMask] = deletedSentinelIndex;
+
+ size_t offset = m_propertyTable->entries()[entryIndex - 1].offset;
+ ASSERT(offset >= m_anonymousSlotCount);
+
+ key->deref();
+ m_propertyTable->entries()[entryIndex - 1].key = 0;
+ m_propertyTable->entries()[entryIndex - 1].attributes = 0;
+ m_propertyTable->entries()[entryIndex - 1].specificValue = 0;
+ m_propertyTable->entries()[entryIndex - 1].offset = 0;
+
+ if (!m_propertyTable->deletedOffsets)
+ m_propertyTable->deletedOffsets = new Vector<unsigned>;
+ m_propertyTable->deletedOffsets->append(offset);
+
+ ASSERT(m_propertyTable->keyCount >= 1);
+ --m_propertyTable->keyCount;
+ ++m_propertyTable->deletedSentinelCount;
+
+ if (m_propertyTable->deletedSentinelCount * 4 >= m_propertyTable->size)
+ rehashPropertyMapHashTable();
+
+ checkConsistency();
+ return offset;
+}
+
+void Structure::insertIntoPropertyMapHashTable(const PropertyMapEntry& entry)
+{
+ ASSERT(m_propertyTable);
+ ASSERT(entry.offset >= m_anonymousSlotCount);
+ unsigned i = entry.key->existingHash();
+ unsigned k = 0;
+
+#if DUMP_PROPERTYMAP_STATS
+ ++numProbes;
+#endif
+
+ while (1) {
+ unsigned entryIndex = m_propertyTable->entryIndices[i & m_propertyTable->sizeMask];
+ if (entryIndex == emptyEntryIndex)
+ break;
+
+ if (k == 0) {
+ k = 1 | doubleHash(entry.key->existingHash());
+#if DUMP_PROPERTYMAP_STATS
+ ++numCollisions;
+#endif
+ }
+
+ i += k;
+
+#if DUMP_PROPERTYMAP_STATS
+ ++numRehashes;
+#endif
+ }
+
+ unsigned entryIndex = m_propertyTable->keyCount + 2;
+ m_propertyTable->entryIndices[i & m_propertyTable->sizeMask] = entryIndex;
+ m_propertyTable->entries()[entryIndex - 1] = entry;
+
+ ++m_propertyTable->keyCount;
+}
+
+void Structure::createPropertyMapHashTable()
+{
+ ASSERT(sizeForKeyCount(7) == newTableSize);
+ createPropertyMapHashTable(newTableSize);
+}
+
+void Structure::createPropertyMapHashTable(unsigned newTableSize)
+{
+ ASSERT(!m_propertyTable);
+ ASSERT(isPowerOf2(newTableSize));
+
+ checkConsistency();
+
+ m_propertyTable = static_cast<PropertyMapHashTable*>(fastZeroedMalloc(PropertyMapHashTable::allocationSize(newTableSize)));
+ m_propertyTable->size = newTableSize;
+ m_propertyTable->sizeMask = newTableSize - 1;
+
+ checkConsistency();
+}
+
+void Structure::expandPropertyMapHashTable()
+{
+ ASSERT(m_propertyTable);
+ rehashPropertyMapHashTable(m_propertyTable->size * 2);
+}
+
+void Structure::rehashPropertyMapHashTable()
+{
+ ASSERT(m_propertyTable);
+ ASSERT(m_propertyTable->size);
+ rehashPropertyMapHashTable(m_propertyTable->size);
+}
+
+void Structure::rehashPropertyMapHashTable(unsigned newTableSize)
+{
+ ASSERT(m_propertyTable);
+ ASSERT(isPowerOf2(newTableSize));
+
+ checkConsistency();
+
+ PropertyMapHashTable* oldTable = m_propertyTable;
+
+ m_propertyTable = static_cast<PropertyMapHashTable*>(fastZeroedMalloc(PropertyMapHashTable::allocationSize(newTableSize)));
+ m_propertyTable->size = newTableSize;
+ m_propertyTable->sizeMask = newTableSize - 1;
+
+ unsigned lastIndexUsed = 0;
+ unsigned entryCount = oldTable->keyCount + oldTable->deletedSentinelCount;
+ for (unsigned i = 1; i <= entryCount; ++i) {
+ if (oldTable->entries()[i].key) {
+ lastIndexUsed = max(oldTable->entries()[i].index, lastIndexUsed);
+ insertIntoPropertyMapHashTable(oldTable->entries()[i]);
+ }
+ }
+ m_propertyTable->lastIndexUsed = lastIndexUsed;
+ m_propertyTable->deletedOffsets = oldTable->deletedOffsets;
+
+ fastFree(oldTable);
+
+ checkConsistency();
+}
+
+int comparePropertyMapEntryIndices(const void* a, const void* b)
+{
+ unsigned ia = static_cast<PropertyMapEntry* const*>(a)[0]->index;
+ unsigned ib = static_cast<PropertyMapEntry* const*>(b)[0]->index;
+ if (ia < ib)
+ return -1;
+ if (ia > ib)
+ return +1;
+ return 0;
+}
+
+void Structure::getPropertyNames(PropertyNameArray& propertyNames, EnumerationMode mode)
+{
+ materializePropertyMapIfNecessary();
+ if (!m_propertyTable)
+ return;
+
+ if (m_propertyTable->keyCount < tinyMapThreshold) {
+ PropertyMapEntry* a[tinyMapThreshold];
+ int i = 0;
+ unsigned entryCount = m_propertyTable->keyCount + m_propertyTable->deletedSentinelCount;
+ for (unsigned k = 1; k <= entryCount; k++) {
+ ASSERT(m_hasNonEnumerableProperties || !(m_propertyTable->entries()[k].attributes & DontEnum));
+ if (m_propertyTable->entries()[k].key && (!(m_propertyTable->entries()[k].attributes & DontEnum) || (mode == IncludeDontEnumProperties))) {
+ PropertyMapEntry* value = &m_propertyTable->entries()[k];
+ int j;
+ for (j = i - 1; j >= 0 && a[j]->index > value->index; --j)
+ a[j + 1] = a[j];
+ a[j + 1] = value;
+ ++i;
+ }
+ }
+ if (!propertyNames.size()) {
+ for (int k = 0; k < i; ++k)
+ propertyNames.addKnownUnique(a[k]->key);
+ } else {
+ for (int k = 0; k < i; ++k)
+ propertyNames.add(a[k]->key);
+ }
+
+ return;
+ }
+
+ // Allocate a buffer to use to sort the keys.
+ Vector<PropertyMapEntry*, smallMapThreshold> sortedEnumerables(m_propertyTable->keyCount);
+
+ // Get pointers to the enumerable entries in the buffer.
+ PropertyMapEntry** p = sortedEnumerables.data();
+ unsigned entryCount = m_propertyTable->keyCount + m_propertyTable->deletedSentinelCount;
+ for (unsigned i = 1; i <= entryCount; i++) {
+ if (m_propertyTable->entries()[i].key && (!(m_propertyTable->entries()[i].attributes & DontEnum) || (mode == IncludeDontEnumProperties)))
+ *p++ = &m_propertyTable->entries()[i];
+ }
+
+ size_t enumerableCount = p - sortedEnumerables.data();
+ // Sort the entries by index.
+ qsort(sortedEnumerables.data(), enumerableCount, sizeof(PropertyMapEntry*), comparePropertyMapEntryIndices);
+ sortedEnumerables.resize(enumerableCount);
+
+ // Put the keys of the sorted entries into the list.
+ if (!propertyNames.size()) {
+ for (size_t i = 0; i < sortedEnumerables.size(); ++i)
+ propertyNames.addKnownUnique(sortedEnumerables[i]->key);
+ } else {
+ for (size_t i = 0; i < sortedEnumerables.size(); ++i)
+ propertyNames.add(sortedEnumerables[i]->key);
+ }
+}
+
+#if DO_PROPERTYMAP_CONSTENCY_CHECK
+
+void Structure::checkConsistency()
+{
+ if (!m_propertyTable)
+ return;
+
+ ASSERT(m_propertyTable->size >= newTableSize);
+ ASSERT(m_propertyTable->sizeMask);
+ ASSERT(m_propertyTable->size == m_propertyTable->sizeMask + 1);
+ ASSERT(!(m_propertyTable->size & m_propertyTable->sizeMask));
+
+ ASSERT(m_propertyTable->keyCount <= m_propertyTable->size / 2);
+ ASSERT(m_propertyTable->deletedSentinelCount <= m_propertyTable->size / 4);
+
+ ASSERT(m_propertyTable->keyCount + m_propertyTable->deletedSentinelCount <= m_propertyTable->size / 2);
+
+ unsigned indexCount = 0;
+ unsigned deletedIndexCount = 0;
+ for (unsigned a = 0; a != m_propertyTable->size; ++a) {
+ unsigned entryIndex = m_propertyTable->entryIndices[a];
+ if (entryIndex == emptyEntryIndex)
+ continue;
+ if (entryIndex == deletedSentinelIndex) {
+ ++deletedIndexCount;
+ continue;
+ }
+ ASSERT(entryIndex > deletedSentinelIndex);
+ ASSERT(entryIndex - 1 <= m_propertyTable->keyCount + m_propertyTable->deletedSentinelCount);
+ ++indexCount;
+
+ for (unsigned b = a + 1; b != m_propertyTable->size; ++b)
+ ASSERT(m_propertyTable->entryIndices[b] != entryIndex);
+ }
+ ASSERT(indexCount == m_propertyTable->keyCount);
+ ASSERT(deletedIndexCount == m_propertyTable->deletedSentinelCount);
+
+ ASSERT(m_propertyTable->entries()[0].key == 0);
+
+ unsigned nonEmptyEntryCount = 0;
+ for (unsigned c = 1; c <= m_propertyTable->keyCount + m_propertyTable->deletedSentinelCount; ++c) {
+ ASSERT(m_hasNonEnumerableProperties || !(m_propertyTable->entries()[c].attributes & DontEnum));
+ StringImpl* rep = m_propertyTable->entries()[c].key;
+ ASSERT(m_propertyTable->entries()[c].offset >= m_anonymousSlotCount);
+ if (!rep)
+ continue;
+ ++nonEmptyEntryCount;
+ unsigned i = rep->existingHash();
+ unsigned k = 0;
+ unsigned entryIndex;
+ while (1) {
+ entryIndex = m_propertyTable->entryIndices[i & m_propertyTable->sizeMask];
+ ASSERT(entryIndex != emptyEntryIndex);
+ if (rep == m_propertyTable->entries()[entryIndex - 1].key)
+ break;
+ if (k == 0)
+ k = 1 | doubleHash(rep->existingHash());
+ i += k;
+ }
+ ASSERT(entryIndex == c + 1);
+ }
+
+ ASSERT(nonEmptyEntryCount == m_propertyTable->keyCount);
+}
+
+#endif // DO_PROPERTYMAP_CONSTENCY_CHECK
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/Structure.h b/Source/JavaScriptCore/runtime/Structure.h
new file mode 100644
index 0000000..f480051
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/Structure.h
@@ -0,0 +1,296 @@
+/*
+ * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef Structure_h
+#define Structure_h
+
+#include "Identifier.h"
+#include "JSType.h"
+#include "JSValue.h"
+#include "PropertyMapHashTable.h"
+#include "PropertyNameArray.h"
+#include "Protect.h"
+#include "StructureChain.h"
+#include "StructureTransitionTable.h"
+#include "JSTypeInfo.h"
+#include "UString.h"
+#include "WeakGCPtr.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+
+#ifndef NDEBUG
+#define DUMP_PROPERTYMAP_STATS 0
+#else
+#define DUMP_PROPERTYMAP_STATS 0
+#endif
+
+namespace JSC {
+
+ class MarkStack;
+ class PropertyNameArray;
+ class PropertyNameArrayData;
+
+ enum EnumerationMode {
+ ExcludeDontEnumProperties,
+ IncludeDontEnumProperties
+ };
+
+ class Structure : public RefCounted<Structure> {
+ public:
+ friend class JIT;
+ friend class StructureTransitionTable;
+ static PassRefPtr<Structure> create(JSValue prototype, const TypeInfo& typeInfo, unsigned anonymousSlotCount)
+ {
+ return adoptRef(new Structure(prototype, typeInfo, anonymousSlotCount));
+ }
+
+ static void startIgnoringLeaks();
+ static void stopIgnoringLeaks();
+
+ static void dumpStatistics();
+
+ static PassRefPtr<Structure> addPropertyTransition(Structure*, const Identifier& propertyName, unsigned attributes, JSCell* specificValue, size_t& offset);
+ static PassRefPtr<Structure> addPropertyTransitionToExistingStructure(Structure*, const Identifier& propertyName, unsigned attributes, JSCell* specificValue, size_t& offset);
+ static PassRefPtr<Structure> removePropertyTransition(Structure*, const Identifier& propertyName, size_t& offset);
+ static PassRefPtr<Structure> changePrototypeTransition(Structure*, JSValue prototype);
+ static PassRefPtr<Structure> despecifyFunctionTransition(Structure*, const Identifier&);
+ static PassRefPtr<Structure> getterSetterTransition(Structure*);
+ static PassRefPtr<Structure> toCacheableDictionaryTransition(Structure*);
+ static PassRefPtr<Structure> toUncacheableDictionaryTransition(Structure*);
+
+ PassRefPtr<Structure> flattenDictionaryStructure(JSObject*);
+
+ ~Structure();
+
+ // These should be used with caution.
+ size_t addPropertyWithoutTransition(const Identifier& propertyName, unsigned attributes, JSCell* specificValue);
+ size_t removePropertyWithoutTransition(const Identifier& propertyName);
+ void setPrototypeWithoutTransition(JSValue prototype) { m_prototype = prototype; }
+
+ bool isDictionary() const { return m_dictionaryKind != NoneDictionaryKind; }
+ bool isUncacheableDictionary() const { return m_dictionaryKind == UncachedDictionaryKind; }
+
+ const TypeInfo& typeInfo() const { return m_typeInfo; }
+
+ JSValue storedPrototype() const { return m_prototype; }
+ JSValue prototypeForLookup(ExecState*) const;
+ StructureChain* prototypeChain(ExecState*) const;
+
+ Structure* previousID() const { return m_previous.get(); }
+
+ void growPropertyStorageCapacity();
+ unsigned propertyStorageCapacity() const { return m_propertyStorageCapacity; }
+ unsigned propertyStorageSize() const { return m_anonymousSlotCount + (m_propertyTable ? m_propertyTable->keyCount + (m_propertyTable->deletedOffsets ? m_propertyTable->deletedOffsets->size() : 0) : static_cast<unsigned>(m_offset + 1)); }
+ bool isUsingInlineStorage() const;
+
+ size_t get(const Identifier& propertyName);
+ size_t get(const StringImpl* rep, unsigned& attributes, JSCell*& specificValue);
+ size_t get(const Identifier& propertyName, unsigned& attributes, JSCell*& specificValue)
+ {
+ ASSERT(!propertyName.isNull());
+ return get(propertyName.impl(), attributes, specificValue);
+ }
+ bool transitionedFor(const JSCell* specificValue)
+ {
+ return m_specificValueInPrevious == specificValue;
+ }
+ bool hasTransition(StringImpl*, unsigned attributes);
+ bool hasTransition(const Identifier& propertyName, unsigned attributes)
+ {
+ return hasTransition(propertyName.impl(), attributes);
+ }
+
+ bool hasGetterSetterProperties() const { return m_hasGetterSetterProperties; }
+ void setHasGetterSetterProperties(bool hasGetterSetterProperties) { m_hasGetterSetterProperties = hasGetterSetterProperties; }
+
+ bool hasNonEnumerableProperties() const { return m_hasNonEnumerableProperties; }
+
+ bool hasAnonymousSlots() const { return !!m_anonymousSlotCount; }
+ unsigned anonymousSlotCount() const { return m_anonymousSlotCount; }
+
+ bool isEmpty() const { return m_propertyTable ? !m_propertyTable->keyCount : m_offset == noOffset; }
+
+ void despecifyDictionaryFunction(const Identifier& propertyName);
+ void disableSpecificFunctionTracking() { m_specificFunctionThrashCount = maxSpecificFunctionThrashCount; }
+
+ void setEnumerationCache(JSPropertyNameIterator* enumerationCache); // Defined in JSPropertyNameIterator.h.
+ void clearEnumerationCache(JSPropertyNameIterator* enumerationCache); // Defined in JSPropertyNameIterator.h.
+ JSPropertyNameIterator* enumerationCache(); // Defined in JSPropertyNameIterator.h.
+ void getPropertyNames(PropertyNameArray&, EnumerationMode mode);
+
+ private:
+
+ Structure(JSValue prototype, const TypeInfo&, unsigned anonymousSlotCount);
+
+ typedef enum {
+ NoneDictionaryKind = 0,
+ CachedDictionaryKind = 1,
+ UncachedDictionaryKind = 2
+ } DictionaryKind;
+ static PassRefPtr<Structure> toDictionaryTransition(Structure*, DictionaryKind);
+
+ size_t put(const Identifier& propertyName, unsigned attributes, JSCell* specificValue);
+ size_t remove(const Identifier& propertyName);
+
+ void expandPropertyMapHashTable();
+ void rehashPropertyMapHashTable();
+ void rehashPropertyMapHashTable(unsigned newTableSize);
+ void createPropertyMapHashTable();
+ void createPropertyMapHashTable(unsigned newTableSize);
+ void insertIntoPropertyMapHashTable(const PropertyMapEntry&);
+ void checkConsistency();
+
+ bool despecifyFunction(const Identifier&);
+ void despecifyAllFunctions();
+
+ PropertyMapHashTable* copyPropertyTable();
+ void materializePropertyMap();
+ void materializePropertyMapIfNecessary()
+ {
+ if (m_propertyTable || !m_previous)
+ return;
+ materializePropertyMap();
+ }
+
+ signed char transitionCount() const
+ {
+ // Since the number of transitions is always the same as m_offset, we keep the size of Structure down by not storing both.
+ return m_offset == noOffset ? 0 : m_offset + 1;
+ }
+
+ typedef std::pair<Structure*, Structure*> Transition;
+ typedef HashMap<StructureTransitionTableHash::Key, Transition, StructureTransitionTableHash, StructureTransitionTableHashTraits> TransitionTable;
+
+ inline bool transitionTableContains(const StructureTransitionTableHash::Key& key, JSCell* specificValue);
+ inline void transitionTableRemove(const StructureTransitionTableHash::Key& key, JSCell* specificValue);
+ inline void transitionTableAdd(const StructureTransitionTableHash::Key& key, Structure* structure, JSCell* specificValue);
+ inline bool transitionTableHasTransition(const StructureTransitionTableHash::Key& key) const;
+ inline Structure* transitionTableGet(const StructureTransitionTableHash::Key& key, JSCell* specificValue) const;
+
+ TransitionTable* transitionTable() const { ASSERT(!m_isUsingSingleSlot); return m_transitions.m_table; }
+ inline void setTransitionTable(TransitionTable* table);
+ Structure* singleTransition() const { ASSERT(m_isUsingSingleSlot); return m_transitions.m_singleTransition; }
+ void setSingleTransition(Structure* structure) { ASSERT(m_isUsingSingleSlot); m_transitions.m_singleTransition = structure; }
+
+ bool isValid(ExecState*, StructureChain* cachedPrototypeChain) const;
+
+ static const unsigned emptyEntryIndex = 0;
+
+ static const signed char s_maxTransitionLength = 64;
+
+ static const signed char noOffset = -1;
+
+ static const unsigned maxSpecificFunctionThrashCount = 3;
+
+ TypeInfo m_typeInfo;
+
+ JSValue m_prototype;
+ mutable RefPtr<StructureChain> m_cachedPrototypeChain;
+
+ RefPtr<Structure> m_previous;
+ RefPtr<StringImpl> m_nameInPrevious;
+ JSCell* m_specificValueInPrevious;
+
+ // 'm_isUsingSingleSlot' indicates whether we are using the single transition optimisation.
+ union {
+ TransitionTable* m_table;
+ Structure* m_singleTransition;
+ } m_transitions;
+
+ WeakGCPtr<JSPropertyNameIterator> m_enumerationCache;
+
+ PropertyMapHashTable* m_propertyTable;
+
+ uint32_t m_propertyStorageCapacity;
+
+ // m_offset does not account for anonymous slots
+ signed char m_offset;
+
+ unsigned m_dictionaryKind : 2;
+ bool m_isPinnedPropertyTable : 1;
+ bool m_hasGetterSetterProperties : 1;
+ bool m_hasNonEnumerableProperties : 1;
+#if COMPILER(WINSCW)
+ // Workaround for Symbian WINSCW compiler that cannot resolve unsigned type of the declared
+ // bitfield, when used as argument in make_pair() function calls in structure.ccp.
+ // This bitfield optimization is insignificant for the Symbian emulator target.
+ unsigned m_attributesInPrevious;
+#else
+ unsigned m_attributesInPrevious : 7;
+#endif
+ unsigned m_specificFunctionThrashCount : 2;
+ unsigned m_anonymousSlotCount : 5;
+ unsigned m_isUsingSingleSlot : 1;
+ // 4 free bits
+ };
+
+ inline size_t Structure::get(const Identifier& propertyName)
+ {
+ ASSERT(!propertyName.isNull());
+
+ materializePropertyMapIfNecessary();
+ if (!m_propertyTable)
+ return WTF::notFound;
+
+ StringImpl* rep = propertyName.impl();
+
+ unsigned i = rep->existingHash();
+
+#if DUMP_PROPERTYMAP_STATS
+ ++numProbes;
+#endif
+
+ unsigned entryIndex = m_propertyTable->entryIndices[i & m_propertyTable->sizeMask];
+ if (entryIndex == emptyEntryIndex)
+ return WTF::notFound;
+
+ if (rep == m_propertyTable->entries()[entryIndex - 1].key)
+ return m_propertyTable->entries()[entryIndex - 1].offset;
+
+#if DUMP_PROPERTYMAP_STATS
+ ++numCollisions;
+#endif
+
+ unsigned k = 1 | WTF::doubleHash(rep->existingHash());
+
+ while (1) {
+ i += k;
+
+#if DUMP_PROPERTYMAP_STATS
+ ++numRehashes;
+#endif
+
+ entryIndex = m_propertyTable->entryIndices[i & m_propertyTable->sizeMask];
+ if (entryIndex == emptyEntryIndex)
+ return WTF::notFound;
+
+ if (rep == m_propertyTable->entries()[entryIndex - 1].key)
+ return m_propertyTable->entries()[entryIndex - 1].offset;
+ }
+ }
+
+} // namespace JSC
+
+#endif // Structure_h
diff --git a/Source/JavaScriptCore/runtime/StructureChain.cpp b/Source/JavaScriptCore/runtime/StructureChain.cpp
new file mode 100644
index 0000000..085876c
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/StructureChain.cpp
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "StructureChain.h"
+
+#include "JSObject.h"
+#include "Structure.h"
+#include <wtf/RefPtr.h>
+
+namespace JSC {
+
+StructureChain::StructureChain(Structure* head)
+{
+ size_t size = 0;
+ for (Structure* current = head; current; current = current->storedPrototype().isNull() ? 0 : asObject(current->storedPrototype())->structure())
+ ++size;
+
+ m_vector.set(new RefPtr<Structure>[size + 1]);
+
+ size_t i = 0;
+ for (Structure* current = head; current; current = current->storedPrototype().isNull() ? 0 : asObject(current->storedPrototype())->structure())
+ m_vector[i++] = current;
+ m_vector[i] = 0;
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/StructureChain.h b/Source/JavaScriptCore/runtime/StructureChain.h
new file mode 100644
index 0000000..816b66d
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/StructureChain.h
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef StructureChain_h
+#define StructureChain_h
+
+#include <wtf/OwnArrayPtr.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/RefPtr.h>
+
+namespace JSC {
+
+ class Structure;
+
+ class StructureChain : public RefCounted<StructureChain> {
+ friend class JIT;
+
+ public:
+ static PassRefPtr<StructureChain> create(Structure* head) { return adoptRef(new StructureChain(head)); }
+ RefPtr<Structure>* head() { return m_vector.get(); }
+
+ private:
+ StructureChain(Structure* head);
+
+ OwnArrayPtr<RefPtr<Structure> > m_vector;
+ };
+
+} // namespace JSC
+
+#endif // StructureChain_h
diff --git a/Source/JavaScriptCore/runtime/StructureTransitionTable.h b/Source/JavaScriptCore/runtime/StructureTransitionTable.h
new file mode 100644
index 0000000..7e9d7ff
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/StructureTransitionTable.h
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef StructureTransitionTable_h
+#define StructureTransitionTable_h
+
+#include "UString.h"
+#include <wtf/HashFunctions.h>
+#include <wtf/HashMap.h>
+#include <wtf/HashTraits.h>
+#include <wtf/OwnPtr.h>
+#include <wtf/RefPtr.h>
+
+namespace JSC {
+
+ class Structure;
+
+ struct StructureTransitionTableHash {
+ typedef std::pair<RefPtr<StringImpl>, unsigned> Key;
+ static unsigned hash(const Key& p)
+ {
+ return p.first->existingHash();
+ }
+
+ static bool equal(const Key& a, const Key& b)
+ {
+ return a == b;
+ }
+
+ static const bool safeToCompareToEmptyOrDeleted = true;
+ };
+
+ struct StructureTransitionTableHashTraits {
+ typedef WTF::HashTraits<RefPtr<StringImpl> > FirstTraits;
+ typedef WTF::GenericHashTraits<unsigned> SecondTraits;
+ typedef std::pair<FirstTraits::TraitType, SecondTraits::TraitType > TraitType;
+
+ static const bool emptyValueIsZero = FirstTraits::emptyValueIsZero && SecondTraits::emptyValueIsZero;
+ static TraitType emptyValue() { return std::make_pair(FirstTraits::emptyValue(), SecondTraits::emptyValue()); }
+
+ static const bool needsDestruction = FirstTraits::needsDestruction || SecondTraits::needsDestruction;
+
+ static void constructDeletedValue(TraitType& slot) { FirstTraits::constructDeletedValue(slot.first); }
+ static bool isDeletedValue(const TraitType& value) { return FirstTraits::isDeletedValue(value.first); }
+ };
+
+} // namespace JSC
+
+#endif // StructureTransitionTable_h
diff --git a/Source/JavaScriptCore/runtime/SymbolTable.h b/Source/JavaScriptCore/runtime/SymbolTable.h
new file mode 100644
index 0000000..1b1636d
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/SymbolTable.h
@@ -0,0 +1,133 @@
+/*
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SymbolTable_h
+#define SymbolTable_h
+
+#include "JSObject.h"
+#include "UString.h"
+#include <wtf/AlwaysInline.h>
+
+namespace JSC {
+
+ static ALWAYS_INLINE int missingSymbolMarker() { return std::numeric_limits<int>::max(); }
+
+ // The bit twiddling in this class assumes that every register index is a
+ // reasonably small positive or negative number, and therefore has its high
+ // four bits all set or all unset.
+
+ struct SymbolTableEntry {
+ SymbolTableEntry()
+ : m_bits(0)
+ {
+ }
+
+ SymbolTableEntry(int index)
+ {
+ ASSERT(isValidIndex(index));
+ pack(index, false, false);
+ }
+
+ SymbolTableEntry(int index, unsigned attributes)
+ {
+ ASSERT(isValidIndex(index));
+ pack(index, attributes & ReadOnly, attributes & DontEnum);
+ }
+
+ bool isNull() const
+ {
+ return !m_bits;
+ }
+
+ int getIndex() const
+ {
+ return m_bits >> FlagBits;
+ }
+
+ unsigned getAttributes() const
+ {
+ unsigned attributes = 0;
+ if (m_bits & ReadOnlyFlag)
+ attributes |= ReadOnly;
+ if (m_bits & DontEnumFlag)
+ attributes |= DontEnum;
+ return attributes;
+ }
+
+ void setAttributes(unsigned attributes)
+ {
+ pack(getIndex(), attributes & ReadOnly, attributes & DontEnum);
+ }
+
+ bool isReadOnly() const
+ {
+ return m_bits & ReadOnlyFlag;
+ }
+
+ private:
+ static const unsigned ReadOnlyFlag = 0x1;
+ static const unsigned DontEnumFlag = 0x2;
+ static const unsigned NotNullFlag = 0x4;
+ static const unsigned FlagBits = 3;
+
+ void pack(int index, bool readOnly, bool dontEnum)
+ {
+ m_bits = (index << FlagBits) | NotNullFlag;
+ if (readOnly)
+ m_bits |= ReadOnlyFlag;
+ if (dontEnum)
+ m_bits |= DontEnumFlag;
+ }
+
+ bool isValidIndex(int index)
+ {
+ return ((index << FlagBits) >> FlagBits) == index;
+ }
+
+ int m_bits;
+ };
+
+ struct SymbolTableIndexHashTraits {
+ typedef SymbolTableEntry TraitType;
+ static SymbolTableEntry emptyValue() { return SymbolTableEntry(); }
+ static const bool emptyValueIsZero = true;
+ static const bool needsDestruction = false;
+ };
+
+ typedef HashMap<RefPtr<StringImpl>, SymbolTableEntry, IdentifierRepHash, HashTraits<RefPtr<StringImpl> >, SymbolTableIndexHashTraits> SymbolTable;
+
+ class SharedSymbolTable : public SymbolTable, public RefCounted<SharedSymbolTable> {
+ public:
+ static PassRefPtr<SharedSymbolTable> create() { return adoptRef(new SharedSymbolTable); }
+ private:
+ SharedSymbolTable() { }
+ };
+
+} // namespace JSC
+
+#endif // SymbolTable_h
diff --git a/Source/JavaScriptCore/runtime/Terminator.h b/Source/JavaScriptCore/runtime/Terminator.h
new file mode 100644
index 0000000..6b0f236
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/Terminator.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Google Inc. ("Google") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef Terminator_h
+#define Terminator_h
+
+namespace JSC {
+
+class Terminator {
+public:
+ Terminator() : m_shouldTerminate(false) { }
+
+ void terminateSoon() { m_shouldTerminate = true; }
+ bool shouldTerminate() const { return m_shouldTerminate; }
+
+private:
+ bool m_shouldTerminate;
+};
+
+} // namespace JSC
+
+#endif // Terminator_h
diff --git a/Source/JavaScriptCore/runtime/TimeoutChecker.cpp b/Source/JavaScriptCore/runtime/TimeoutChecker.cpp
new file mode 100644
index 0000000..04d904d
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/TimeoutChecker.cpp
@@ -0,0 +1,158 @@
+/*
+ * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2008 Cameron Zwarich <cwzwarich@uwaterloo.ca>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "TimeoutChecker.h"
+
+#include "CallFrame.h"
+#include "JSGlobalObject.h"
+
+#if OS(DARWIN)
+#include <mach/mach.h>
+#elif OS(WINDOWS)
+#include <windows.h>
+#else
+#include "CurrentTime.h"
+#endif
+
+#if PLATFORM(BREWMP)
+#include <AEEStdLib.h>
+#endif
+
+using namespace std;
+
+namespace JSC {
+
+// Number of ticks before the first timeout check is done.
+static const int ticksUntilFirstCheck = 1024;
+
+// Number of milliseconds between each timeout check.
+static const int intervalBetweenChecks = 1000;
+
+// Returns the time the current thread has spent executing, in milliseconds.
+static inline unsigned getCPUTime()
+{
+#if OS(DARWIN)
+ mach_msg_type_number_t infoCount = THREAD_BASIC_INFO_COUNT;
+ thread_basic_info_data_t info;
+
+ // Get thread information
+ mach_port_t threadPort = mach_thread_self();
+ thread_info(threadPort, THREAD_BASIC_INFO, reinterpret_cast<thread_info_t>(&info), &infoCount);
+ mach_port_deallocate(mach_task_self(), threadPort);
+
+ unsigned time = info.user_time.seconds * 1000 + info.user_time.microseconds / 1000;
+ time += info.system_time.seconds * 1000 + info.system_time.microseconds / 1000;
+
+ return time;
+#elif OS(WINDOWS)
+ union {
+ FILETIME fileTime;
+ unsigned long long fileTimeAsLong;
+ } userTime, kernelTime;
+
+ // GetThreadTimes won't accept NULL arguments so we pass these even though
+ // they're not used.
+ FILETIME creationTime, exitTime;
+
+ GetThreadTimes(GetCurrentThread(), &creationTime, &exitTime, &kernelTime.fileTime, &userTime.fileTime);
+
+ return userTime.fileTimeAsLong / 10000 + kernelTime.fileTimeAsLong / 10000;
+#elif OS(SYMBIAN)
+ RThread current;
+ TTimeIntervalMicroSeconds cpuTime;
+
+ TInt err = current.GetCpuTime(cpuTime);
+ ASSERT_WITH_MESSAGE(err == KErrNone, "GetCpuTime failed with %d", err);
+ return cpuTime.Int64() / 1000;
+#elif PLATFORM(BREWMP)
+ // This function returns a continuously and linearly increasing millisecond
+ // timer from the time the device was powered on.
+ // There is only one thread in BREW, so this is enough.
+ return GETUPTIMEMS();
+#else
+ // FIXME: We should return the time the current thread has spent executing.
+
+ // use a relative time from first call in order to avoid an overflow
+ static double firstTime = currentTime();
+ return (currentTime() - firstTime) * 1000;
+#endif
+}
+
+TimeoutChecker::TimeoutChecker()
+ : m_timeoutInterval(0)
+ , m_startCount(0)
+{
+ reset();
+}
+
+void TimeoutChecker::reset()
+{
+ m_ticksUntilNextCheck = ticksUntilFirstCheck;
+ m_timeAtLastCheck = 0;
+ m_timeExecuting = 0;
+}
+
+bool TimeoutChecker::didTimeOut(ExecState* exec)
+{
+ unsigned currentTime = getCPUTime();
+
+ if (!m_timeAtLastCheck) {
+ // Suspicious amount of looping in a script -- start timing it
+ m_timeAtLastCheck = currentTime;
+ return false;
+ }
+
+ unsigned timeDiff = currentTime - m_timeAtLastCheck;
+
+ if (timeDiff == 0)
+ timeDiff = 1;
+
+ m_timeExecuting += timeDiff;
+ m_timeAtLastCheck = currentTime;
+
+ // Adjust the tick threshold so we get the next checkTimeout call in the
+ // interval specified in intervalBetweenChecks.
+ m_ticksUntilNextCheck = static_cast<unsigned>((static_cast<float>(intervalBetweenChecks) / timeDiff) * m_ticksUntilNextCheck);
+ // If the new threshold is 0 reset it to the default threshold. This can happen if the timeDiff is higher than the
+ // preferred script check time interval.
+ if (m_ticksUntilNextCheck == 0)
+ m_ticksUntilNextCheck = ticksUntilFirstCheck;
+
+ if (m_timeoutInterval && m_timeExecuting > m_timeoutInterval) {
+ if (exec->dynamicGlobalObject()->shouldInterruptScript())
+ return true;
+
+ reset();
+ }
+
+ return false;
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/TimeoutChecker.h b/Source/JavaScriptCore/runtime/TimeoutChecker.h
new file mode 100644
index 0000000..71ce169
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/TimeoutChecker.h
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef TimeoutChecker_h
+#define TimeoutChecker_h
+
+#include <wtf/Assertions.h>
+
+#ifdef ANDROID_INSTRUMENT
+#include "TimeCounter.h"
+#endif
+
+namespace JSC {
+
+ class ExecState;
+
+ class TimeoutChecker {
+ public:
+ TimeoutChecker();
+
+ void setTimeoutInterval(unsigned timeoutInterval) { m_timeoutInterval = timeoutInterval; }
+ unsigned timeoutInterval() const { return m_timeoutInterval; }
+
+ unsigned ticksUntilNextCheck() { return m_ticksUntilNextCheck; }
+
+ void start()
+ {
+ if (!m_startCount)
+ reset();
+#ifdef ANDROID_INSTRUMENT
+ if (!m_startCount)
+ android::TimeCounter::start(android::TimeCounter::JavaScriptTimeCounter);
+#endif
+ ++m_startCount;
+ }
+
+ void stop()
+ {
+ ASSERT(m_startCount);
+ --m_startCount;
+#ifdef ANDROID_INSTRUMENT
+ if (!m_startCount)
+ android::TimeCounter::record(android::TimeCounter::JavaScriptTimeCounter, __FUNCTION__);
+#endif
+ }
+
+ void reset();
+
+ bool didTimeOut(ExecState*);
+
+ private:
+ unsigned m_timeoutInterval;
+ unsigned m_timeAtLastCheck;
+ unsigned m_timeExecuting;
+ unsigned m_startCount;
+ unsigned m_ticksUntilNextCheck;
+ };
+
+} // namespace JSC
+
+#endif // TimeoutChecker_h
diff --git a/Source/JavaScriptCore/runtime/Tracing.d b/Source/JavaScriptCore/runtime/Tracing.d
new file mode 100644
index 0000000..da854b9
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/Tracing.d
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+provider JavaScriptCore
+{
+ probe gc__begin();
+ probe gc__marked();
+ probe gc__end();
+
+ probe profile__will_execute(int, char*, char*, int);
+ probe profile__did_execute(int, char*, char*, int);
+};
+
+#pragma D attributes Unstable/Unstable/Common provider JavaScriptCore provider
+#pragma D attributes Private/Private/Unknown provider JavaScriptCore module
+#pragma D attributes Private/Private/Unknown provider JavaScriptCore function
+#pragma D attributes Unstable/Unstable/Common provider JavaScriptCore name
+#pragma D attributes Unstable/Unstable/Common provider JavaScriptCore args
diff --git a/Source/JavaScriptCore/runtime/Tracing.h b/Source/JavaScriptCore/runtime/Tracing.h
new file mode 100644
index 0000000..c28c85f
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/Tracing.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef Tracing_h
+#define Tracing_h
+
+#if HAVE(DTRACE)
+#include "TracingDtrace.h"
+#else
+
+#define JAVASCRIPTCORE_GC_BEGIN()
+#define JAVASCRIPTCORE_GC_BEGIN_ENABLED() 0
+
+#define JAVASCRIPTCORE_GC_END()
+#define JAVASCRIPTCORE_GC_END_ENABLED() 0
+
+#define JAVASCRIPTCORE_GC_MARKED()
+#define JAVASCRIPTCORE_GC_MARKED_ENABLED() 0
+
+#define JAVASCRIPTCORE_PROFILE_WILL_EXECUTE(arg0, arg1, arg2, arg3)
+#define JAVASCRIPTCORE_PROFILE_WILL_EXECUTE_ENABLED() 0
+
+#define JAVASCRIPTCORE_PROFILE_DID_EXECUTE(arg0, arg1, arg2, arg3)
+#define JAVASCRIPTCORE_PROFILE_DID_EXECUTE_ENABLED() 0
+
+#endif
+
+#endif // Tracing_h
diff --git a/Source/JavaScriptCore/runtime/UString.cpp b/Source/JavaScriptCore/runtime/UString.cpp
new file mode 100644
index 0000000..b3cd40c
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/UString.cpp
@@ -0,0 +1,366 @@
+/*
+ * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2007 Cameron Zwarich (cwzwarich@uwaterloo.ca)
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+#include "UString.h"
+
+#include "JSGlobalObjectFunctions.h"
+#include "Collector.h"
+#include "Identifier.h"
+#include "Operations.h"
+#include <ctype.h>
+#include <limits.h>
+#include <limits>
+#include <stdio.h>
+#include <stdlib.h>
+#include <wtf/ASCIICType.h>
+#include <wtf/Assertions.h>
+#include <wtf/DecimalNumber.h>
+#include <wtf/MathExtras.h>
+#include <wtf/StringExtras.h>
+#include <wtf/Vector.h>
+#include <wtf/unicode/UTF8.h>
+
+#if HAVE(STRINGS_H)
+#include <strings.h>
+#endif
+
+using namespace WTF;
+using namespace WTF::Unicode;
+using namespace std;
+
+namespace JSC {
+
+extern const double NaN;
+extern const double Inf;
+
+COMPILE_ASSERT(sizeof(UString) == sizeof(void*), UString_should_stay_small);
+
+// Construct a string with UTF-16 data.
+UString::UString(const UChar* characters, unsigned length)
+ : m_impl(characters ? StringImpl::create(characters, length) : 0)
+{
+}
+
+// Construct a string with UTF-16 data, from a null-terminated source.
+UString::UString(const UChar* characters)
+{
+ if (!characters)
+ return;
+
+ int length = 0;
+ while (characters[length] != UChar(0))
+ ++length;
+
+ m_impl = StringImpl::create(characters, length);
+}
+
+// Construct a string with latin1 data.
+UString::UString(const char* characters, unsigned length)
+ : m_impl(characters ? StringImpl::create(characters, length) : 0)
+{
+}
+
+// Construct a string with latin1 data, from a null-terminated source.
+UString::UString(const char* characters)
+ : m_impl(characters ? StringImpl::create(characters) : 0)
+{
+}
+
+UString UString::number(int i)
+{
+ UChar buf[1 + sizeof(i) * 3];
+ UChar* end = buf + WTF_ARRAY_LENGTH(buf);
+ UChar* p = end;
+
+ if (i == 0)
+ *--p = '0';
+ else if (i == INT_MIN) {
+ char minBuf[1 + sizeof(i) * 3];
+ snprintf(minBuf, sizeof(minBuf), "%d", INT_MIN);
+ return UString(minBuf);
+ } else {
+ bool negative = false;
+ if (i < 0) {
+ negative = true;
+ i = -i;
+ }
+ while (i) {
+ *--p = static_cast<unsigned short>((i % 10) + '0');
+ i /= 10;
+ }
+ if (negative)
+ *--p = '-';
+ }
+
+ return UString(p, static_cast<unsigned>(end - p));
+}
+
+UString UString::number(long long i)
+{
+ UChar buf[1 + sizeof(i) * 3];
+ UChar* end = buf + WTF_ARRAY_LENGTH(buf);
+ UChar* p = end;
+
+ if (i == 0)
+ *--p = '0';
+ else if (i == std::numeric_limits<long long>::min()) {
+ char minBuf[1 + sizeof(i) * 3];
+#if OS(WINDOWS)
+ snprintf(minBuf, sizeof(minBuf), "%I64d", std::numeric_limits<long long>::min());
+#else
+ snprintf(minBuf, sizeof(minBuf), "%lld", std::numeric_limits<long long>::min());
+#endif
+ return UString(minBuf);
+ } else {
+ bool negative = false;
+ if (i < 0) {
+ negative = true;
+ i = -i;
+ }
+ while (i) {
+ *--p = static_cast<unsigned short>((i % 10) + '0');
+ i /= 10;
+ }
+ if (negative)
+ *--p = '-';
+ }
+
+ return UString(p, static_cast<unsigned>(end - p));
+}
+
+UString UString::number(unsigned u)
+{
+ UChar buf[sizeof(u) * 3];
+ UChar* end = buf + WTF_ARRAY_LENGTH(buf);
+ UChar* p = end;
+
+ if (u == 0)
+ *--p = '0';
+ else {
+ while (u) {
+ *--p = static_cast<unsigned short>((u % 10) + '0');
+ u /= 10;
+ }
+ }
+
+ return UString(p, static_cast<unsigned>(end - p));
+}
+
+UString UString::number(long l)
+{
+ UChar buf[1 + sizeof(l) * 3];
+ UChar* end = buf + WTF_ARRAY_LENGTH(buf);
+ UChar* p = end;
+
+ if (l == 0)
+ *--p = '0';
+ else if (l == LONG_MIN) {
+ char minBuf[1 + sizeof(l) * 3];
+ snprintf(minBuf, sizeof(minBuf), "%ld", LONG_MIN);
+ return UString(minBuf);
+ } else {
+ bool negative = false;
+ if (l < 0) {
+ negative = true;
+ l = -l;
+ }
+ while (l) {
+ *--p = static_cast<unsigned short>((l % 10) + '0');
+ l /= 10;
+ }
+ if (negative)
+ *--p = '-';
+ }
+
+ return UString(p, end - p);
+}
+
+UString UString::number(double d)
+{
+ NumberToStringBuffer buffer;
+ unsigned length = numberToString(d, buffer);
+ return UString(buffer, length);
+}
+
+UString UString::substringSharingImpl(unsigned offset, unsigned length) const
+{
+ // FIXME: We used to check against a limit of Heap::minExtraCost / sizeof(UChar).
+
+ unsigned stringLength = this->length();
+ offset = min(offset, stringLength);
+ length = min(length, stringLength - offset);
+
+ if (!offset && length == stringLength)
+ return *this;
+ return UString(StringImpl::create(m_impl, offset, length));
+}
+
+bool operator==(const UString& s1, const char *s2)
+{
+ if (s2 == 0)
+ return s1.isEmpty();
+
+ const UChar* u = s1.characters();
+ const UChar* uend = u + s1.length();
+ while (u != uend && *s2) {
+ if (u[0] != (unsigned char)*s2)
+ return false;
+ s2++;
+ u++;
+ }
+
+ return u == uend && *s2 == 0;
+}
+
+bool operator<(const UString& s1, const UString& s2)
+{
+ const unsigned l1 = s1.length();
+ const unsigned l2 = s2.length();
+ const unsigned lmin = l1 < l2 ? l1 : l2;
+ const UChar* c1 = s1.characters();
+ const UChar* c2 = s2.characters();
+ unsigned l = 0;
+ while (l < lmin && *c1 == *c2) {
+ c1++;
+ c2++;
+ l++;
+ }
+ if (l < lmin)
+ return (c1[0] < c2[0]);
+
+ return (l1 < l2);
+}
+
+bool operator>(const UString& s1, const UString& s2)
+{
+ const unsigned l1 = s1.length();
+ const unsigned l2 = s2.length();
+ const unsigned lmin = l1 < l2 ? l1 : l2;
+ const UChar* c1 = s1.characters();
+ const UChar* c2 = s2.characters();
+ unsigned l = 0;
+ while (l < lmin && *c1 == *c2) {
+ c1++;
+ c2++;
+ l++;
+ }
+ if (l < lmin)
+ return (c1[0] > c2[0]);
+
+ return (l1 > l2);
+}
+
+CString UString::ascii() const
+{
+ // Basic Latin1 (ISO) encoding - Unicode characters 0..255 are
+ // preserved, characters outside of this range are converted to '?'.
+
+ unsigned length = this->length();
+ const UChar* characters = this->characters();
+
+ char* characterBuffer;
+ CString result = CString::newUninitialized(length, characterBuffer);
+
+ for (unsigned i = 0; i < length; ++i) {
+ UChar ch = characters[i];
+ characterBuffer[i] = ch && (ch < 0x20 || ch >= 0x7f) ? '?' : ch;
+ }
+
+ return result;
+}
+
+CString UString::latin1() const
+{
+ // Basic Latin1 (ISO) encoding - Unicode characters 0..255 are
+ // preserved, characters outside of this range are converted to '?'.
+
+ unsigned length = this->length();
+ const UChar* characters = this->characters();
+
+ char* characterBuffer;
+ CString result = CString::newUninitialized(length, characterBuffer);
+
+ for (unsigned i = 0; i < length; ++i) {
+ UChar ch = characters[i];
+ characterBuffer[i] = ch > 0xff ? '?' : ch;
+ }
+
+ return result;
+}
+
+// Helper to write a three-byte UTF-8 code point to the buffer, caller must check room is available.
+static inline void putUTF8Triple(char*& buffer, UChar ch)
+{
+ ASSERT(ch >= 0x0800);
+ *buffer++ = static_cast<char>(((ch >> 12) & 0x0F) | 0xE0);
+ *buffer++ = static_cast<char>(((ch >> 6) & 0x3F) | 0x80);
+ *buffer++ = static_cast<char>((ch & 0x3F) | 0x80);
+}
+
+CString UString::utf8(bool strict) const
+{
+ unsigned length = this->length();
+ const UChar* characters = this->characters();
+
+ // Allocate a buffer big enough to hold all the characters
+ // (an individual UTF-16 UChar can only expand to 3 UTF-8 bytes).
+ // Optimization ideas, if we find this function is hot:
+ // * We could speculatively create a CStringBuffer to contain 'length'
+ // characters, and resize if necessary (i.e. if the buffer contains
+ // non-ascii characters). (Alternatively, scan the buffer first for
+ // ascii characters, so we know this will be sufficient).
+ // * We could allocate a CStringBuffer with an appropriate size to
+ // have a good chance of being able to write the string into the
+ // buffer without reallocing (say, 1.5 x length).
+ if (length > numeric_limits<unsigned>::max() / 3)
+ return CString();
+ Vector<char, 1024> bufferVector(length * 3);
+
+ char* buffer = bufferVector.data();
+ ConversionResult result = convertUTF16ToUTF8(&characters, characters + length, &buffer, buffer + bufferVector.size(), strict);
+ ASSERT(result != targetExhausted); // (length * 3) should be sufficient for any conversion
+
+ // Only produced from strict conversion.
+ if (result == sourceIllegal)
+ return CString();
+
+ // Check for an unconverted high surrogate.
+ if (result == sourceExhausted) {
+ if (strict)
+ return CString();
+ // This should be one unpaired high surrogate. Treat it the same
+ // was as an unpaired high surrogate would have been handled in
+ // the middle of a string with non-strict conversion - which is
+ // to say, simply encode it to UTF-8.
+ ASSERT((characters + 1) == (this->characters() + length));
+ ASSERT((*characters >= 0xD800) && (*characters <= 0xDBFF));
+ // There should be room left, since one UChar hasn't been converted.
+ ASSERT((buffer + 3) <= (buffer + bufferVector.size()));
+ putUTF8Triple(buffer, *characters);
+ }
+
+ return CString(bufferVector.data(), buffer - bufferVector.data());
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/UString.h b/Source/JavaScriptCore/runtime/UString.h
new file mode 100644
index 0000000..8f6c083
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/UString.h
@@ -0,0 +1,263 @@
+/*
+ * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef UString_h
+#define UString_h
+
+#include <wtf/text/StringImpl.h>
+
+namespace JSC {
+
+class UString {
+public:
+ // Construct a null string, distinguishable from an empty string.
+ UString() { }
+
+ // Construct a string with UTF-16 data.
+ UString(const UChar* characters, unsigned length);
+
+ // Construct a string with UTF-16 data, from a null-terminated source.
+ UString(const UChar*);
+
+ // Construct a string with latin1 data.
+ UString(const char* characters, unsigned length);
+
+ // Construct a string with latin1 data, from a null-terminated source.
+ UString(const char* characters);
+
+ // Construct a string referencing an existing StringImpl.
+ UString(StringImpl* impl) : m_impl(impl) { }
+ UString(PassRefPtr<StringImpl> impl) : m_impl(impl) { }
+ UString(RefPtr<StringImpl> impl) : m_impl(impl) { }
+
+ // Inline the destructor.
+ ALWAYS_INLINE ~UString() { }
+
+ void swap(UString& o) { m_impl.swap(o.m_impl); }
+
+ template<size_t inlineCapacity>
+ static UString adopt(Vector<UChar, inlineCapacity>& vector) { return StringImpl::adopt(vector); }
+
+ bool isNull() const { return !m_impl; }
+ bool isEmpty() const { return !m_impl || !m_impl->length(); }
+
+ StringImpl* impl() const { return m_impl.get(); }
+
+ unsigned length() const
+ {
+ if (!m_impl)
+ return 0;
+ return m_impl->length();
+ }
+
+ const UChar* characters() const
+ {
+ if (!m_impl)
+ return 0;
+ return m_impl->characters();
+ }
+
+ CString ascii() const;
+ CString latin1() const;
+ CString utf8(bool strict = false) const;
+
+ UChar operator[](unsigned index) const
+ {
+ if (!m_impl || index >= m_impl->length())
+ return 0;
+ return m_impl->characters()[index];
+ }
+
+ static UString number(int);
+ static UString number(unsigned);
+ static UString number(long);
+ static UString number(long long);
+ static UString number(double);
+
+ // Find a single character or string, also with match function & latin1 forms.
+ size_t find(UChar c, unsigned start = 0) const
+ { return m_impl ? m_impl->find(c, start) : notFound; }
+ size_t find(const UString& str, unsigned start = 0) const
+ { return m_impl ? m_impl->find(str.impl(), start) : notFound; }
+ size_t find(const char* str, unsigned start = 0) const
+ { return m_impl ? m_impl->find(str, start) : notFound; }
+
+ // Find the last instance of a single character or string.
+ size_t reverseFind(UChar c, unsigned start = UINT_MAX) const
+ { return m_impl ? m_impl->reverseFind(c, start) : notFound; }
+ size_t reverseFind(const UString& str, unsigned start = UINT_MAX) const
+ { return m_impl ? m_impl->reverseFind(str.impl(), start) : notFound; }
+
+ UString substringSharingImpl(unsigned pos, unsigned len = UINT_MAX) const;
+
+private:
+ RefPtr<StringImpl> m_impl;
+};
+
+ALWAYS_INLINE bool operator==(const UString& s1, const UString& s2)
+{
+ StringImpl* rep1 = s1.impl();
+ StringImpl* rep2 = s2.impl();
+ unsigned size1 = 0;
+ unsigned size2 = 0;
+
+ if (rep1 == rep2) // If they're the same rep, they're equal.
+ return true;
+
+ if (rep1)
+ size1 = rep1->length();
+
+ if (rep2)
+ size2 = rep2->length();
+
+ if (size1 != size2) // If the lengths are not the same, we're done.
+ return false;
+
+ if (!size1)
+ return true;
+
+ // At this point we know
+ // (a) that the strings are the same length and
+ // (b) that they are greater than zero length.
+ const UChar* d1 = rep1->characters();
+ const UChar* d2 = rep2->characters();
+
+ if (d1 == d2) // Check to see if the data pointers are the same.
+ return true;
+
+ // Do quick checks for sizes 1 and 2.
+ switch (size1) {
+ case 1:
+ return d1[0] == d2[0];
+ case 2:
+ return (d1[0] == d2[0]) & (d1[1] == d2[1]);
+ default:
+ return memcmp(d1, d2, size1 * sizeof(UChar)) == 0;
+ }
+}
+
+
+inline bool operator!=(const UString& s1, const UString& s2)
+{
+ return !JSC::operator==(s1, s2);
+}
+
+bool operator<(const UString& s1, const UString& s2);
+bool operator>(const UString& s1, const UString& s2);
+
+bool operator==(const UString& s1, const char* s2);
+
+inline bool operator!=(const UString& s1, const char* s2)
+{
+ return !JSC::operator==(s1, s2);
+}
+
+inline bool operator==(const char *s1, const UString& s2)
+{
+ return operator==(s2, s1);
+}
+
+inline bool operator!=(const char *s1, const UString& s2)
+{
+ return !JSC::operator==(s1, s2);
+}
+
+inline int codePointCompare(const UString& s1, const UString& s2)
+{
+ return codePointCompare(s1.impl(), s2.impl());
+}
+
+struct UStringHash {
+ static unsigned hash(StringImpl* key) { return key->hash(); }
+ static bool equal(const StringImpl* a, const StringImpl* b)
+ {
+ if (a == b)
+ return true;
+ if (!a || !b)
+ return false;
+
+ unsigned aLength = a->length();
+ unsigned bLength = b->length();
+ if (aLength != bLength)
+ return false;
+
+ // FIXME: perhaps we should have a more abstract macro that indicates when
+ // going 4 bytes at a time is unsafe
+#if CPU(ARM) || CPU(SH4) || CPU(MIPS)
+ const UChar* aChars = a->characters();
+ const UChar* bChars = b->characters();
+ for (unsigned i = 0; i != aLength; ++i) {
+ if (*aChars++ != *bChars++)
+ return false;
+ }
+ return true;
+#else
+ /* Do it 4-bytes-at-a-time on architectures where it's safe */
+ const uint32_t* aChars = reinterpret_cast<const uint32_t*>(a->characters());
+ const uint32_t* bChars = reinterpret_cast<const uint32_t*>(b->characters());
+
+ unsigned halfLength = aLength >> 1;
+ for (unsigned i = 0; i != halfLength; ++i)
+ if (*aChars++ != *bChars++)
+ return false;
+
+ if (aLength & 1 && *reinterpret_cast<const uint16_t*>(aChars) != *reinterpret_cast<const uint16_t*>(bChars))
+ return false;
+
+ return true;
+#endif
+ }
+
+ static unsigned hash(const RefPtr<StringImpl>& key) { return key->hash(); }
+ static bool equal(const RefPtr<StringImpl>& a, const RefPtr<StringImpl>& b)
+ {
+ return equal(a.get(), b.get());
+ }
+
+ static unsigned hash(const UString& key) { return key.impl()->hash(); }
+ static bool equal(const UString& a, const UString& b)
+ {
+ return equal(a.impl(), b.impl());
+ }
+
+ static const bool safeToCompareToEmptyOrDeleted = false;
+};
+
+} // namespace JSC
+
+namespace WTF {
+
+// UStringHash is the default hash for UString
+template<typename T> struct DefaultHash;
+template<> struct DefaultHash<JSC::UString> {
+ typedef JSC::UStringHash Hash;
+};
+
+template <> struct VectorTraits<JSC::UString> : SimpleClassVectorTraits
+{
+ static const bool canInitializeWithMemset = true;
+};
+
+} // namespace WTF
+
+#endif
+
diff --git a/Source/JavaScriptCore/runtime/UStringBuilder.h b/Source/JavaScriptCore/runtime/UStringBuilder.h
new file mode 100644
index 0000000..31ccf38
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/UStringBuilder.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef UStringBuilder_h
+#define UStringBuilder_h
+
+#include <wtf/text/StringBuilder.h>
+
+namespace JSC {
+
+class UStringBuilder : public StringBuilder {
+public:
+ using StringBuilder::append;
+ void append(const UString& str) { append(String(str.impl())); }
+
+ UString toUString() { return toString().impl(); }
+};
+
+} // namespace JSC
+
+#endif // UStringBuilder_h
diff --git a/Source/JavaScriptCore/runtime/UStringConcatenate.h b/Source/JavaScriptCore/runtime/UStringConcatenate.h
new file mode 100644
index 0000000..0990c72
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/UStringConcatenate.h
@@ -0,0 +1,125 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef UStringConcatenate_h
+#define UStringConcatenate_h
+
+#include "UString.h"
+#include <wtf/text/StringConcatenate.h>
+
+namespace WTF {
+
+template<>
+class StringTypeAdapter<JSC::UString> {
+public:
+ StringTypeAdapter<JSC::UString>(JSC::UString& string)
+ : m_data(string.characters())
+ , m_length(string.length())
+ {
+ }
+
+ unsigned length() { return m_length; }
+
+ void writeTo(UChar* destination)
+ {
+ for (unsigned i = 0; i < m_length; ++i)
+ destination[i] = m_data[i];
+ }
+
+private:
+ const UChar* m_data;
+ unsigned m_length;
+};
+
+}; // namespace WTF
+
+namespace JSC {
+
+template<typename StringType1, typename StringType2>
+UString makeUString(StringType1 string1, StringType2 string2)
+{
+ PassRefPtr<StringImpl> resultImpl = WTF::tryMakeString(string1, string2);
+ if (!resultImpl)
+ CRASH();
+ return resultImpl;
+}
+
+template<typename StringType1, typename StringType2, typename StringType3>
+UString makeUString(StringType1 string1, StringType2 string2, StringType3 string3)
+{
+ PassRefPtr<StringImpl> resultImpl = WTF::tryMakeString(string1, string2, string3);
+ if (!resultImpl)
+ CRASH();
+ return resultImpl;
+}
+
+template<typename StringType1, typename StringType2, typename StringType3, typename StringType4>
+UString makeUString(StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4)
+{
+ PassRefPtr<StringImpl> resultImpl = WTF::tryMakeString(string1, string2, string3, string4);
+ if (!resultImpl)
+ CRASH();
+ return resultImpl;
+}
+
+template<typename StringType1, typename StringType2, typename StringType3, typename StringType4, typename StringType5>
+UString makeUString(StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4, StringType5 string5)
+{
+ PassRefPtr<StringImpl> resultImpl = WTF::tryMakeString(string1, string2, string3, string4, string5);
+ if (!resultImpl)
+ CRASH();
+ return resultImpl;
+}
+
+template<typename StringType1, typename StringType2, typename StringType3, typename StringType4, typename StringType5, typename StringType6>
+UString makeUString(StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4, StringType5 string5, StringType6 string6)
+{
+ PassRefPtr<StringImpl> resultImpl = WTF::tryMakeString(string1, string2, string3, string4, string5, string6);
+ if (!resultImpl)
+ CRASH();
+ return resultImpl;
+}
+
+template<typename StringType1, typename StringType2, typename StringType3, typename StringType4, typename StringType5, typename StringType6, typename StringType7>
+UString makeUString(StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4, StringType5 string5, StringType6 string6, StringType7 string7)
+{
+ PassRefPtr<StringImpl> resultImpl = WTF::tryMakeString(string1, string2, string3, string4, string5, string6, string7);
+ if (!resultImpl)
+ CRASH();
+ return resultImpl;
+}
+
+template<typename StringType1, typename StringType2, typename StringType3, typename StringType4, typename StringType5, typename StringType6, typename StringType7, typename StringType8>
+UString makeUString(StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4, StringType5 string5, StringType6 string6, StringType7 string7, StringType8 string8)
+{
+ PassRefPtr<StringImpl> resultImpl = WTF::tryMakeString(string1, string2, string3, string4, string5, string6, string7, string8);
+ if (!resultImpl)
+ CRASH();
+ return resultImpl;
+}
+
+} // namespace JSC
+
+#endif
diff --git a/Source/JavaScriptCore/runtime/WeakGCMap.h b/Source/JavaScriptCore/runtime/WeakGCMap.h
new file mode 100644
index 0000000..6b96a74
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/WeakGCMap.h
@@ -0,0 +1,123 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WeakGCMap_h
+#define WeakGCMap_h
+
+#include "Collector.h"
+#include <wtf/HashMap.h>
+
+namespace JSC {
+
+class JSCell;
+
+// A HashMap whose get() function returns emptyValue() for cells awaiting destruction.
+template<typename KeyType, typename MappedType>
+class WeakGCMap : public FastAllocBase {
+ /*
+ Invariants:
+ * A value enters the WeakGCMap marked. (Guaranteed by set().)
+ * A value that becomes unmarked leaves the WeakGCMap before being recycled. (Guaranteed by the value's destructor removing it from the WeakGCMap.)
+ * A value that becomes unmarked leaves the WeakGCMap before becoming marked again. (Guaranteed by all destructors running before the mark phase begins.)
+ * During the mark phase, all values in the WeakGCMap are valid. (Guaranteed by all destructors running before the mark phase begins.)
+ */
+
+public:
+ typedef typename HashMap<KeyType, MappedType>::iterator iterator;
+ typedef typename HashMap<KeyType, MappedType>::const_iterator const_iterator;
+
+ bool isEmpty() { return m_map.isEmpty(); }
+ void clear() { m_map.clear(); }
+
+ MappedType get(const KeyType& key) const;
+ pair<iterator, bool> set(const KeyType&, const MappedType&);
+ MappedType take(const KeyType& key);
+
+ // These unchecked functions provide access to a value even if the value's
+ // mark bit is not set. This is used, among other things, to retrieve values
+ // during the GC mark phase, which begins by clearing all mark bits.
+
+ MappedType uncheckedGet(const KeyType& key) const { return m_map.get(key); }
+ bool uncheckedRemove(const KeyType&, const MappedType&);
+
+ iterator uncheckedBegin() { return m_map.begin(); }
+ iterator uncheckedEnd() { return m_map.end(); }
+
+ const_iterator uncheckedBegin() const { return m_map.begin(); }
+ const_iterator uncheckedEnd() const { return m_map.end(); }
+
+private:
+ HashMap<KeyType, MappedType> m_map;
+};
+
+template<typename KeyType, typename MappedType>
+inline MappedType WeakGCMap<KeyType, MappedType>::get(const KeyType& key) const
+{
+ MappedType result = m_map.get(key);
+ if (result == HashTraits<MappedType>::emptyValue())
+ return result;
+ if (!Heap::isCellMarked(result))
+ return HashTraits<MappedType>::emptyValue();
+ return result;
+}
+
+template<typename KeyType, typename MappedType>
+MappedType WeakGCMap<KeyType, MappedType>::take(const KeyType& key)
+{
+ MappedType result = m_map.take(key);
+ if (result == HashTraits<MappedType>::emptyValue())
+ return result;
+ if (!Heap::isCellMarked(result))
+ return HashTraits<MappedType>::emptyValue();
+ return result;
+}
+
+template<typename KeyType, typename MappedType>
+pair<typename HashMap<KeyType, MappedType>::iterator, bool> WeakGCMap<KeyType, MappedType>::set(const KeyType& key, const MappedType& value)
+{
+ Heap::markCell(value); // If value is newly allocated, it's not marked, so mark it now.
+ pair<iterator, bool> result = m_map.add(key, value);
+ if (!result.second) { // pre-existing entry
+ result.second = !Heap::isCellMarked(result.first->second);
+ result.first->second = value;
+ }
+ return result;
+}
+
+template<typename KeyType, typename MappedType>
+bool WeakGCMap<KeyType, MappedType>::uncheckedRemove(const KeyType& key, const MappedType& value)
+{
+ iterator it = m_map.find(key);
+ if (it == m_map.end())
+ return false;
+ if (it->second != value)
+ return false;
+ m_map.remove(it);
+ return true;
+}
+
+} // namespace JSC
+
+#endif // WeakGCMap_h
diff --git a/Source/JavaScriptCore/runtime/WeakGCPtr.h b/Source/JavaScriptCore/runtime/WeakGCPtr.h
new file mode 100644
index 0000000..ac77cf3
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/WeakGCPtr.h
@@ -0,0 +1,153 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WeakGCPtr_h
+#define WeakGCPtr_h
+
+#include "Collector.h"
+#include "GCHandle.h"
+#include <wtf/Noncopyable.h>
+
+namespace JSC {
+
+// A smart pointer whose get() function returns 0 for cells awaiting destruction.
+template <typename T> class WeakGCPtr : Noncopyable {
+public:
+ WeakGCPtr()
+ : m_ptr(0)
+ {
+ }
+
+ WeakGCPtr(T* ptr) { assign(ptr); }
+
+ ~WeakGCPtr()
+ {
+ if (m_ptr)
+ m_ptr->pool()->free(m_ptr);
+ }
+
+ T* get() const
+ {
+ if (m_ptr && m_ptr->isValidPtr())
+ return static_cast<T*>(m_ptr->get());
+ return 0;
+ }
+
+ bool clear(JSCell* p)
+ {
+ if (!m_ptr || m_ptr->get() != p)
+ return false;
+
+ m_ptr->pool()->free(m_ptr);
+ m_ptr = 0;
+ return true;
+ }
+
+ T& operator*() const { return *get(); }
+ T* operator->() const { return get(); }
+
+ bool operator!() const { return !get(); }
+
+ // This conversion operator allows implicit conversion to bool but not to other integer types.
+#if COMPILER(WINSCW)
+ operator bool() const { return m_ptr; }
+#else
+ typedef WeakGCHandle* WeakGCPtr::*UnspecifiedBoolType;
+ operator UnspecifiedBoolType() const { return get() ? &WeakGCPtr::m_ptr : 0; }
+#endif
+
+ WeakGCPtr& operator=(T*);
+
+#if !ASSERT_DISABLED
+ bool hasDeadObject() const { return !!m_ptr; }
+#endif
+
+private:
+ void assign(JSCell* ptr)
+ {
+ ASSERT(ptr);
+ if (m_ptr)
+ m_ptr->set(ptr);
+ else
+ m_ptr = Heap::heap(ptr)->addWeakGCHandle(ptr);
+ }
+
+ WeakGCHandle* m_ptr;
+};
+
+template <typename T> inline WeakGCPtr<T>& WeakGCPtr<T>::operator=(T* optr)
+{
+ assign(optr);
+ return *this;
+}
+
+template <typename T, typename U> inline bool operator==(const WeakGCPtr<T>& a, const WeakGCPtr<U>& b)
+{
+ return a.get() == b.get();
+}
+
+template <typename T, typename U> inline bool operator==(const WeakGCPtr<T>& a, U* b)
+{
+ return a.get() == b;
+}
+
+template <typename T, typename U> inline bool operator==(T* a, const WeakGCPtr<U>& b)
+{
+ return a == b.get();
+}
+
+template <typename T, typename U> inline bool operator!=(const WeakGCPtr<T>& a, const WeakGCPtr<U>& b)
+{
+ return a.get() != b.get();
+}
+
+template <typename T, typename U> inline bool operator!=(const WeakGCPtr<T>& a, U* b)
+{
+ return a.get() != b;
+}
+
+template <typename T, typename U> inline bool operator!=(T* a, const WeakGCPtr<U>& b)
+{
+ return a != b.get();
+}
+
+template <typename T, typename U> inline WeakGCPtr<T> static_pointer_cast(const WeakGCPtr<U>& p)
+{
+ return WeakGCPtr<T>(static_cast<T*>(p.get()));
+}
+
+template <typename T, typename U> inline WeakGCPtr<T> const_pointer_cast(const WeakGCPtr<U>& p)
+{
+ return WeakGCPtr<T>(const_cast<T*>(p.get()));
+}
+
+template <typename T> inline T* get(const WeakGCPtr<T>& p)
+{
+ return p.get();
+}
+
+} // namespace JSC
+
+#endif // WeakGCPtr_h
diff --git a/Source/JavaScriptCore/runtime/WeakRandom.h b/Source/JavaScriptCore/runtime/WeakRandom.h
new file mode 100644
index 0000000..ff3995e
--- /dev/null
+++ b/Source/JavaScriptCore/runtime/WeakRandom.h
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * Copyright (c) 2009 Ian C. Bullard
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef WeakRandom_h
+#define WeakRandom_h
+
+#include <limits.h>
+#include <wtf/StdLibExtras.h>
+
+namespace JSC {
+
+class WeakRandom {
+public:
+ WeakRandom(unsigned seed)
+ : m_low(seed ^ 0x49616E42)
+ , m_high(seed)
+ {
+ }
+
+ double get()
+ {
+ return advance() / (UINT_MAX + 1.0);
+ }
+
+private:
+ unsigned advance()
+ {
+ m_high = (m_high << 16) + (m_high >> 16);
+ m_high += m_low;
+ m_low += m_high;
+ return m_high;
+ }
+
+ unsigned m_low;
+ unsigned m_high;
+};
+
+} // namespace JSC
+
+#endif // WeakRandom_h
diff --git a/Source/JavaScriptCore/shell/CMakeLists.txt b/Source/JavaScriptCore/shell/CMakeLists.txt
new file mode 100644
index 0000000..a327204
--- /dev/null
+++ b/Source/JavaScriptCore/shell/CMakeLists.txt
@@ -0,0 +1,25 @@
+SET(JSC_HEADERS
+)
+
+SET(JSC_SOURCES
+ ../jsc.cpp
+)
+
+SET(JSC_LIBRARIES
+ ${JavaScriptCore_LIBRARY_NAME}
+)
+
+INCLUDE_IF_EXISTS(${JAVASCRIPTCORE_DIR}/shell/CMakeLists${PORT}.txt)
+
+WEBKIT_WRAP_SOURCELIST(${JSC_SOURCES})
+INCLUDE_DIRECTORIES(./ ${JavaScriptCore_INCLUDE_DIRECTORIES})
+ADD_EXECUTABLE(${JSC_EXECUTABLE_NAME} ${JSC_HEADERS} ${JSC_SOURCES})
+TARGET_LINK_LIBRARIES(${JSC_EXECUTABLE_NAME} ${JSC_LIBRARIES})
+
+IF (JSC_LINK_FLAGS)
+ ADD_TARGET_PROPERTIES(${JSC_EXECUTABLE_NAME} LINK_FLAGS "${JSC_LINK_FLAGS}")
+ENDIF ()
+
+IF (SHARED_CORE)
+ SET_TARGET_PROPERTIES(${JSC_EXECUTABLE_NAME} PROPERTIES VERSION ${PROJECT_VERSION})
+ENDIF ()
diff --git a/Source/JavaScriptCore/shell/CMakeListsEfl.txt b/Source/JavaScriptCore/shell/CMakeListsEfl.txt
new file mode 100644
index 0000000..58d44f4
--- /dev/null
+++ b/Source/JavaScriptCore/shell/CMakeListsEfl.txt
@@ -0,0 +1,8 @@
+LIST(APPEND JSC_LIBRARIES
+ ${Glib_LIBRARIES}
+ ${ECORE_LIBRARIES}
+)
+
+LIST(APPEND JSC_LINK_FLAGS
+ ${ECORE_LDFLAGS}
+)
diff --git a/Source/JavaScriptCore/shell/CMakeListsWinCE.txt b/Source/JavaScriptCore/shell/CMakeListsWinCE.txt
new file mode 100644
index 0000000..0b7a3bf
--- /dev/null
+++ b/Source/JavaScriptCore/shell/CMakeListsWinCE.txt
@@ -0,0 +1,3 @@
+LIST(APPEND JSC_SOURCES
+ ../os-win32/WinMain.cpp
+)
diff --git a/Source/JavaScriptCore/tests/mozilla/Getopt/Mixed.pm b/Source/JavaScriptCore/tests/mozilla/Getopt/Mixed.pm
new file mode 100644
index 0000000..3caee45
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/Getopt/Mixed.pm
@@ -0,0 +1,754 @@
+#---------------------------------------------------------------------
+package Getopt::Mixed;
+#
+# Copyright 1995 Christopher J. Madsen
+#
+# Author: Christopher J. Madsen <ac608@yfn.ysu.edu>
+# Created: 1 Jan 1995
+# Version: $Revision: 1.8 $ ($Date: 1996/02/09 00:05:00 $)
+# Note that RCS revision 1.23 => $Getopt::Mixed::VERSION = "1.023"
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Perl; see the file COPYING. If not, write to the
+# Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+#
+# Process both single-character and extended options
+#---------------------------------------------------------------------
+
+require 5.000;
+use Carp;
+
+require Exporter;
+@ISA = qw(Exporter);
+@EXPORT = ();
+@EXPORT_OK = qw(abortMsg getOptions nextOption);
+
+#=====================================================================
+# Package Global Variables:
+
+BEGIN
+{
+ # The permissible settings for $order:
+ $REQUIRE_ORDER = 0;
+ $PERMUTE = 1;
+ $RETURN_IN_ORDER = 2;
+
+ # Regular expressions:
+ $intRegexp = '^[-+]?\d+$'; # Match an integer
+ $floatRegexp = '^[-+]?(\d*\.?\d+|\d+\.)$'; # Match a real number
+ $typeChars = 'sif'; # Match type characters
+
+ # Convert RCS revision number (must be main branch) to d.ddd format:
+ ' $Revision: 1.8 $ ' =~ / (\d+)\.(\d{1,3}) /
+ or die "Invalid version number";
+ $VERSION = sprintf("%d.%03d",$1,$2);
+} # end BEGIN
+
+#=====================================================================
+# Subroutines:
+#---------------------------------------------------------------------
+# Initialize the option processor:
+#
+# You should set any customization variables *after* calling init.
+#
+# For a description of option declarations, see the documentation at
+# the end of this file.
+#
+# Input:
+# List of option declarations (separated by whitespace)
+# If the first argument is entirely non-alphanumeric characters
+# with no whitespace, it is the characters that start options.
+
+sub init
+{
+ undef %options;
+ my($opt,$type);
+
+ $ignoreCase = 1; # Ignore case by default
+ $optionStart = "-"; # Dash is the default option starter
+
+ # If the first argument is entirely non-alphanumeric characters
+ # with no whitespace, it is the desired value for $optionStart:
+ $optionStart = shift @_ if $_[0] =~ /^[^a-z0-9\s]+$/i;
+
+ foreach $group (@_) {
+ # Ignore case unless there are upper-case options:
+ $ignoreCase = 0 if $group =~ /[A-Z]/;
+ foreach $option (split(/\s+/,$group)) {
+ croak "Invalid option declaration `$option'"
+ unless $option =~ /^([^=:>]+)([=:][$typeChars]|>[^=:>]+)?$/o;
+ $opt = $1;
+ $type = $2 || "";
+ if ($type =~ /^>(.*)$/) {
+ $type = $1;
+ croak "Invalid synonym `$option'"
+ if (not defined $options{$type}
+ or $options{$type} =~ /^[^:=]/);
+ } # end if synonym
+ $options{$opt} = $type;
+ } # end foreach option
+ } # end foreach group
+
+ # Handle POSIX compliancy:
+ if (defined $ENV{"POSIXLY_CORRECT"}) {
+ $order = $REQUIRE_ORDER;
+ } else {
+ $order = $PERMUTE;
+ }
+
+ $optionEnd = 0;
+ $badOption = \&badOption;
+ $checkArg = \&checkArg;
+} # end init
+
+#---------------------------------------------------------------------
+# Clean up when we're done:
+#
+# This just releases the memory used by the %options hash.
+#
+# If 'help' was defined as an option, a new hash with just 'help' is
+# created, in case the program calls abortMsg.
+
+sub cleanup
+{
+ my $help = defined($options{'help'});
+ undef %options;
+ $options{'help'} = "" if $help;
+} # end cleanup
+
+#---------------------------------------------------------------------
+# Abort program with message:
+#
+# Prints program name and arguments to STDERR
+# If --help is an option, prints message saying 'Try --help'
+# Exits with code 1
+
+sub abortMsg
+{
+ my $name = $0;
+ $name =~ s|^.+[\\/]||; # Remove any directories from name
+ print STDERR $name,": ",@_,"\n";
+ print STDERR "Try `$name --help' for more information.\n"
+ if defined $options{"help"};
+ exit 1;
+} # end abortMsg
+
+#---------------------------------------------------------------------
+# Standard function for handling bad options:
+#
+# Prints an error message and exits.
+#
+# You can override this by setting $Getopt::Mixed::badOption to a
+# function reference.
+#
+# Input:
+# Index into @ARGV
+# The option that caused the error
+# An optional string describing the problem
+# Currently, this can be
+# undef The option was not recognized
+# 'ambiguous' The option could match several long options
+#
+# Note:
+# The option has already been removed from @ARGV. To put it back,
+# you can say:
+# splice(@ARGV,$_[0],0,$_[1]);
+#
+# If your function returns, it should return whatever you want
+# nextOption to return.
+
+sub badOption
+{
+ my ($index, $option, $problem) = @_;
+
+ $problem = 'unrecognized' unless $problem;
+
+ abortMsg("$problem option `$option'");
+} # end badOption
+
+#---------------------------------------------------------------------
+# Make sure we have the proper argument for this option:
+#
+# You can override this by setting $Getopt::Mixed::checkArg to a
+# function reference.
+#
+# Input:
+# $i: Position of argument in @ARGV
+# $value: The text appended to the option (undef if no text)
+# $option: The pretty name of the option (as the user typed it)
+# $type: The type of the option
+#
+# Returns:
+# The value of the option's argument
+
+sub checkArg
+{
+ my ($i,$value,$option,$type) = @_;
+
+ abortMsg("option `$option' does not take an argument")
+ if (not $type and defined $value);
+
+ if ($type =~ /^=/) {
+ # An argument is required for this option:
+ $value = splice(@ARGV,$i,1) unless defined $value;
+ abortMsg("option `$option' requires an argument")
+ unless defined $value;
+ }
+
+ if ($type =~ /i$/) {
+ abortMsg("option `$option' requires integer argument")
+ if (defined $value and $value !~ /$intRegexp/o);
+ }
+ elsif ($type =~ /f$/) {
+ abortMsg("option `$option' requires numeric argument")
+ if (defined $value and $value !~ /$floatRegexp/o);
+ }
+ elsif ($type =~ /^[=:]/ and ref($checkType)) {
+ $value = &$checkType($i,$value,$option,$type);
+ }
+
+ $value = "" if not defined $value and $type =~ /^:/;
+
+ $value;
+} # end checkArg
+
+#---------------------------------------------------------------------
+# Find a match for an incomplete long option:
+#
+# Input:
+# The option text to match
+#
+# Returns:
+# The option that matched, or
+# undef, if no option matched, or
+# (undef, 'ambiguous'), if multiple options matched
+
+sub findMatch
+{
+ my $opt = shift;
+
+ $opt =~ s/-/[^-]*-/g;
+ $opt .= ".*";
+
+ my @matches = grep(/^$opt$/, keys %options);
+
+ return undef if $#matches < 0;
+ return $matches[0] if $#matches == 0;
+
+ $opt = $matches[0];
+ $opt = $options{$opt} if $options{$opt} =~ /^[^=:]/;
+
+ foreach (@matches) {
+ return (undef, 'ambiguous')
+ unless $_ eq $opt or $options{$_} eq $opt;
+ }
+
+ $opt;
+} # end findMatch
+
+#---------------------------------------------------------------------
+# Return the next option:
+#
+# Returns a list of 3 elements: (OPTION, VALUE, PRETTYNAME), where
+# OPTION is the name of the option,
+# VALUE is its argument, and
+# PRETTYNAME is the option as the user entered it.
+# Returns the null list if there are no more options to process
+#
+# If $order is $RETURN_IN_ORDER, and this is a normal argument (not an
+# option), OPTION will be the null string, VALUE will be the argument,
+# and PRETTYNAME will be undefined.
+
+sub nextOption
+{
+ return () if $#ARGV < 0; # No more arguments
+
+ if ($optionEnd) {
+ # We aren't processing any more options:
+ return ("", shift @ARGV) if $order == $RETURN_IN_ORDER;
+ return ();
+ }
+
+ # Find the next option:
+ my $i = 0;
+ while (length($ARGV[$i]) < 2 or
+ index($optionStart,substr($ARGV[$i],0,1)) < 0) {
+ return () if $order == $REQUIRE_ORDER;
+ return ("", shift @ARGV) if $order == $RETURN_IN_ORDER;
+ ++$i;
+ return () if $i > $#ARGV;
+ } # end while
+
+ # Process the option:
+ my($option,$opt,$value,$optType,$prettyOpt);
+ $option = $ARGV[$i];
+ if (substr($option,0,1) eq substr($option,1,1)) {
+ # If the option start character is repeated, it's a long option:
+ splice @ARGV,$i,1;
+ if (length($option) == 2) {
+ # A double dash by itself marks the end of the options:
+ $optionEnd = 1; # Don't process any more options
+ return nextOption();
+ } # end if bare double dash
+ $opt = substr($option,2);
+ if ($opt =~ /^([^=]+)=(.*)$/) {
+ $opt = $1;
+ $value = $2;
+ } # end if option is followed by value
+ $opt =~ tr/A-Z/a-z/ if $ignoreCase;
+ $prettyOpt = substr($option,0,2) . $opt;
+ my $problem;
+ ($opt, $problem) = findMatch($opt)
+ unless defined $options{$opt} and length($opt) > 1;
+ return &$badOption($i,$option,$problem) unless $opt;
+ $optType = $options{$opt};
+ if ($optType =~ /^[^:=]/) {
+ $opt = $optType;
+ $optType = $options{$opt};
+ }
+ $value = &$checkArg($i,$value,$prettyOpt,$optType);
+ } # end if long option
+ else {
+ # It's a short option:
+ $opt = substr($option,1,1);
+ $opt =~ tr/A-Z/a-z/ if $ignoreCase;
+ return &$badOption($i,$option) unless defined $options{$opt};
+ $optType = $options{$opt};
+ if ($optType =~ /^[^:=]/) {
+ $opt = $optType;
+ $optType = $options{$opt};
+ }
+ if (length($option) == 2 or $optType) {
+ # This is the last option in the group, so remove the group:
+ splice(@ARGV,$i,1);
+ } else {
+ # Just remove this option from the group:
+ substr($ARGV[$i],1,1) = "";
+ }
+ if ($optType) {
+ $value = (length($option) > 2) ? substr($option,2) : undef;
+ $value =~ s/^=// if $value; # Allow either -d3 or -d=3
+ } # end if option takes an argument
+ $prettyOpt = substr($option,0,2);
+ $value = &$checkArg($i,$value,$prettyOpt,$optType);
+ } # end else short option
+ ($opt,$value,$prettyOpt);
+} # end nextOption
+
+#---------------------------------------------------------------------
+# Get options:
+#
+# Input:
+# The same as for init()
+# If no parameters are supplied, init() is NOT called. This allows
+# you to call init() yourself and then change the configuration
+# variables.
+#
+# Output Variables:
+# Sets $opt_X for each `-X' option encountered.
+#
+# Note that if --apple is a synonym for -a, then --apple will cause
+# $opt_a to be set, not $opt_apple.
+
+sub getOptions
+{
+ &init if $#_ >= 0; # Pass arguments (if any) on to init
+
+ # If you want to use $RETURN_IN_ORDER, you have to call
+ # nextOption yourself; getOptions doesn't support it:
+ $order = $PERMUTE if $order == $RETURN_IN_ORDER;
+
+ my ($option,$value,$package);
+
+ $package = (caller)[0];
+
+ while (($option, $value) = nextOption()) {
+ $option =~ s/\W/_/g; # Make a legal Perl identifier
+ $value = 1 unless defined $value;
+ eval("\$" . $package . '::opt_' . $option . ' = $value;');
+ } # end while
+
+ cleanup();
+} # end getOptions
+
+#=====================================================================
+# Package return value:
+
+$VERSION;
+
+__END__
+
+=head1 NAME
+
+Getopt::Mixed - getopt processing with both long and short options
+
+=head1 SYNOPSIS
+
+ use Getopt::Mixed;
+ Getopt::Mixed::getOptions(...option-descriptions...);
+ ...examine $opt_* variables...
+
+or
+
+ use Getopt::Mixed "nextOption";
+ Getopt::Mixed::init(...option-descriptions...);
+ while (($option, $value) = nextOption()) {
+ ...process option...
+ }
+ Getopt::Mixed::cleanup();
+
+=head1 DESCRIPTION
+
+This package is my response to the standard modules Getopt::Std and
+Getopt::Long. C<Std> doesn't support long options, and C<Long>
+doesn't support short options. I wanted both, since long options are
+easier to remember and short options are faster to type.
+
+This package is intended to be the "Getopt-to-end-all-Getop's". It
+combines (I hope) flexibility and simplicity. It supports both short
+options (introduced by C<->) and long options (introduced by C<-->).
+Short options which do not take an argument can be grouped together.
+Short options which do take an argument must be the last option in
+their group, because everything following the option will be
+considered to be its argument.
+
+There are two methods for using Getopt::Mixed: the simple method and
+the flexible method. Both methods use the same format for option
+descriptions.
+
+=head2 Option Descriptions
+
+The option-description arguments required by C<init> and C<getOptions>
+are strings composed of individual option descriptions. Several
+option descriptions can appear in the same string if they are
+separated by whitespace.
+
+Each description consists of the option name and an optional trailing
+argument specifier. Option names may consist of any characters but
+whitespace, C<=>, C<:>, and C<E<gt>>.
+
+Values for argument specifiers are:
+
+ <none> option does not take an argument
+ =s :s option takes a mandatory (=) or optional (:) string argument
+ =i :i option takes a mandatory (=) or optional (:) integer argument
+ =f :f option takes a mandatory (=) or optional (:) real number argument
+ >new option is a synonym for option `new'
+
+The C<E<gt>> specifier is not really an argument specifier. It
+defines an option as being a synonym for another option. For example,
+"a=i apples>a" would define B<-a> as an option that requires an
+integer argument and B<--apples> as a synonym for B<-a>. Only one
+level of synonyms is supported, and the root option must be listed
+first. For example, "apples>a a=i" and "a=i apples>a oranges>apples"
+are illegal; use "a=i apples>a oranges>a" if that's what you want.
+
+For example, in the option description:
+ "a b=i c:s apple baker>b charlie:s"
+ -a and --apple do not take arguments
+ -b takes a mandatory integer argument
+ --baker is a synonym for -b
+ -c and --charlie take an optional string argument
+
+If the first argument to C<init> or C<getOptions> is entirely
+non-alphanumeric characters with no whitespace, it represents the
+characters which can begin options.
+
+=head2 User Interface
+
+From the user's perspective, short options are introduced by a dash
+(C<->) and long options are introduced by a double dash (C<-->).
+Short options may be combined ("-a -b" can be written "-ab"), but an
+option that takes an argument must be the last one in its group,
+because anything following it is considered part of the argument. A
+double dash by itself marks the end of the options; all arguments
+following it are treated as normal arguments, not options. A single
+dash by itself is treated as a normal argument, I<not> an option.
+
+Long options may be abbreviated. An option B<--all-the-time> could be
+abbreviated B<--all>, B<--a--tim>, or even B<--a>. Note that B<--time>
+would not work; the abbreviation must start at the beginning of the
+option name. If an abbreviation is ambiguous, an error message will
+be printed.
+
+In the following examples, B<-i> and B<--int> take integer arguments,
+B<-f> and B<--float> take floating point arguments, and B<-s> and
+B<--string> take string arguments. All other options do not take an
+argument.
+
+ -i24 -f24.5 -sHello
+ -i=24 --int=-27 -f=24.5 --float=0.27 -s=Hello --string=Hello
+
+If the argument is required, it can also be separated by whitespace:
+
+ -i 24 --int -27 -f 24.5 --float 0.27 -s Hello --string Hello
+
+Note that if the option is followed by C<=>, whatever follows the C<=>
+I<is> the argument, even if it's the null string. In the example
+
+ -i= 24 -f= 24.5 -s= Hello
+
+B<-i> and B<-f> will cause an error, because the null string is not a
+number, but B<-s> is perfectly legal; its argument is the null string,
+not "Hello".
+
+Remember that optional arguments I<cannot> be separated from the
+option by whitespace.
+
+=head2 The Simple Method
+
+The simple method is
+
+ use Getopt::Mixed;
+ Getopt::Mixed::getOptions(...option-descriptions...);
+
+You then examine the C<$opt_*> variables to find out what options were
+specified and the C<@ARGV> array to see what arguments are left.
+
+If B<-a> is an option that doesn't take an argument, then C<$opt_a>
+will be set to 1 if the option is present, or left undefined if the
+option is not present.
+
+If B<-b> is an option that takes an argument, then C<$opt_b> will be
+set to the value of the argument if the option is present, or left
+undefined if the option is not present. If the argument is optional
+but not supplied, C<$opt_b> will be set to the null string.
+
+Note that even if you specify that an option I<requires> a string
+argument, you can still get the null string (if the user specifically
+enters it). If the option requires a numeric argument, you will never
+get the null string (because it isn't a number).
+
+When converting the option name to a Perl identifier, any non-word
+characters in the name will be converted to underscores (C<_>).
+
+If the same option occurs more than once, only the last occurrence
+will be recorded. If that's not acceptable, you'll have to use the
+flexible method instead.
+
+=head2 The Flexible Method
+
+The flexible method is
+
+ use Getopt::Mixed "nextOption";
+ Getopt::Mixed::init(...option-descriptions...);
+ while (($option, $value, $pretty) = nextOption()) {
+ ...process option...
+ }
+ Getopt::Mixed::cleanup();
+
+This lets you process arguments one at a time. You can then handle
+repeated options any way you want to. It also lets you see option
+names with non-alphanumeric characters without any translation. This
+is also the only method that lets you find out what order the options
+and other arguments were in.
+
+First, you call Getopt::Mixed::init with the option descriptions.
+Then, you keep calling nextOption until it returns an empty list.
+Finally, you call Getopt::Mixed::cleanup when you're done. The
+remaining (non-option) arguments will be found in @ARGV.
+
+Each call to nextOption returns a list of the next option, its value,
+and the option as the user typed it. The value will be undefined if
+the option does not take an argument. The option is stripped of its
+starter (e.g., you get "a" and "foo", not "-a" or "--foo"). If you
+want to print an error message, use the third element, which does
+include the option starter.
+
+=head1 OTHER FUNCTIONS
+
+Getopt::Mixed provides one other function you can use. C<abortMsg>
+prints its arguments on STDERR, plus your program's name and a
+newline. It then exits with status 1. For example, if F<foo.pl>
+calls C<abortMsg> like this:
+
+ Getopt::Mixed::abortMsg("Error");
+
+The output will be:
+
+ foo.pl: Error
+
+=head1 CUSTOMIZATION
+
+There are several customization variables you can set. All of these
+variables should be set I<after> calling Getopt::Mixed::init and
+I<before> calling nextOption.
+
+If you set any of these variables, you I<must> check the version
+number first. The easiest way to do this is like this:
+
+ use Getopt::Mixed 1.006;
+
+If you are using the simple method, and you want to set these
+variables, you'll need to call init before calling getOptions, like
+this:
+
+ use Getopt::Mixed 1.006;
+ Getopt::Mixed::init(...option-descriptions...);
+ ...set configuration variables...
+ Getopt::Mixed::getOptions(); # IMPORTANT: no parameters
+
+=over 4
+
+=item $order
+
+$order can be set to $REQUIRE_ORDER, $PERMUTE, or $RETURN_IN_ORDER.
+The default is $REQUIRE_ORDER if the environment variable
+POSIXLY_CORRECT has been set, $PERMUTE otherwise.
+
+$REQUIRE_ORDER means that no options can follow the first argument
+which isn't an option.
+
+$PERMUTE means that all options are treated as if they preceded all
+other arguments.
+
+$RETURN_IN_ORDER means that all arguments maintain their ordering.
+When nextOption is called, and the next argument is not an option, it
+returns the null string as the option and the argument as the value.
+nextOption never returns the null list until all the arguments have
+been processed.
+
+=item $ignoreCase
+
+Ignore case when matching options. Default is 1 unless the option
+descriptions contain an upper-case letter.
+
+=item $optionStart
+
+A string of characters that can start options. Default is "-".
+
+=item $badOption
+
+A reference to a function that is called when an unrecognized option
+is encountered. The function receives three arguments. $_[0] is the
+position in @ARGV where the option came from. $_[1] is the option as
+the user typed it (including the option start character). $_[2] is
+either undef or a string describing the reason the option was not
+recognized (Currently, the only possible value is 'ambiguous', for a
+long option with several possible matches). The option has already
+been removed from @ARGV. To put it back, you can say:
+
+ splice(@ARGV,$_[0],0,$_[1]);
+
+The function can do anything you want to @ARGV. It should return
+whatever you want nextOption to return.
+
+The default is a function that prints an error message and exits the
+program.
+
+=item $checkArg
+
+A reference to a function that is called to make sure the argument
+type is correct. The function receives four arguments. $_[0] is the
+position in @ARGV where the option came from. $_[1] is the text
+following the option, or undefined if there was no text following the
+option. $_[2] is the name of the option as the user typed it
+(including the option start character), suitable for error messages.
+$_[3] is the argument type specifier.
+
+The function can do anything you want to @ARGV. It should return
+the value for this option.
+
+The default is a function that prints an error message and exits the
+program if the argument is not the right type for the option. You can
+also adjust the behavior of the default function by changing
+$intRegexp or $floatRegexp.
+
+=item $intRegexp
+
+A regular expression that matches an integer. Default is
+'^[-+]?\d+$', which matches a string of digits preceded by an
+optional sign. Unlike the other configuration variables, this cannot
+be changed after nextOption is called, because the pattern is compiled
+only once.
+
+=item $floatRegexp
+
+A regular expression that matches a floating point number. Default is
+'^[-+]?(\d*\.?\d+|\d+\.)$', which matches the following formats:
+"123", "123.", "123.45", and ".123" (plus an optional sign). It does
+not match exponential notation. Unlike the other configuration
+variables, this cannot be changed after nextOption is called, because
+the pattern is compiled only once.
+
+=item $typeChars
+
+A string of the characters which are legal argument types. The
+default is 'sif', for String, Integer, and Floating point arguments.
+The string should consist only of letters. Upper case letters are
+discouraged, since this will hamper the case-folding of options. If
+you change this, you should set $checkType to a function that will
+check arguments of your new type. Unlike the other configuration
+variables, this must be set I<before> calling init(), and cannot be
+changed afterwards.
+
+=item $checkType
+
+If you add new types to $typeChars, you should set this to a function
+which will check arguments of the new types.
+
+=back
+
+=head1 BUGS
+
+=over 4
+
+=item *
+
+This document should be expanded.
+
+=item *
+
+A long option must be at least two characters long. Sorry.
+
+=item *
+
+The C<!> argument specifier of Getopt::Long is not supported, but you
+could have options B<--foo> and B<--nofoo> and then do something like:
+
+ $opt_foo = 0 if $opt_nofoo;
+
+=item *
+
+The C<@> argument specifier of Getopt::Long is not supported. If you
+want your values pushed into an array, you'll have to use nextOption
+and do it yourself.
+
+=back
+
+=head1 LICENSE
+
+Getopt::Mixed is distributed under the terms of the GNU General Public
+License as published by the Free Software Foundation; either version
+2, or (at your option) any later version.
+
+This means it is distributed in the hope that it will be useful, but
+I<without any warranty>; without even the implied warranty of
+I<merchantability> or I<fitness for a particular purpose>. See the
+GNU General Public License for more details.
+
+Since Perl scripts are only compiled at runtime, and simply calling
+Getopt::Mixed does I<not> bring your program under the GPL, the only
+real restriction is that you can't use Getopt::Mixed in an
+binary-only distribution produced with C<dump> (unless you also
+provide source code).
+
+=head1 AUTHOR
+
+Christopher J. Madsen E<lt>F<ac608@yfn.ysu.edu>E<gt>
+
+Thanks are also due to Andreas Koenig for helping Getopt::Mixed
+conform to the standards for Perl modules and for answering a bunch of
+questions. Any remaining deficiencies are my fault.
+
+=cut
diff --git a/Source/JavaScriptCore/tests/mozilla/Makefile b/Source/JavaScriptCore/tests/mozilla/Makefile
new file mode 100644
index 0000000..21cfc6f
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/Makefile
@@ -0,0 +1,3 @@
+testmenu:
+ exec perl mklistpage.pl > menubody.html
+ cat menuhead.html menubody.html menufoot.html > menu.html
diff --git a/Source/JavaScriptCore/tests/mozilla/README-jsDriver.html b/Source/JavaScriptCore/tests/mozilla/README-jsDriver.html
new file mode 100644
index 0000000..57e4c24
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/README-jsDriver.html
@@ -0,0 +1,344 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+ <head>
+ <title>jsDriver.pl</title>
+ </head>
+
+ <body bgcolor="white">
+ <h1 align="right">jsDriver.pl</h1>
+
+ <dl>
+ <dt><b>NAME</b></dt>
+ <dd>
+ <b>jsDriver.pl</b> - execute JavaScript programs in various shells in
+ batch or single mode, reporting on failures encountered.
+ <br>
+ <br>
+
+ <dt><b>SYNOPSIS</b></dt>
+ <dd>
+ <table>
+ <tr>
+ <td align="right" valign="top">
+ <code>
+ <b>jsDriver.pl</b>
+ </code>
+ </td>
+ <td>
+ <code>
+ [-hkt] [-b BUGURL] [-c CLASSPATH] [-f OUTFILE]
+ [-j JAVAPATH] [-l TESTLIST ...] [-L NEGLIST ...] [-p TESTPATH]
+ [-s SHELLPATH] [-u LXRURL] [--help] [--confail] [--trace]
+ [--classpath=CLASSPATH] [--file=OUTFILE] [--javapath=JAVAPATH]
+ [--list=TESTLIST] [--neglist=TESTLIST] [--testpath=TESTPATH]
+ [--shellpath=SHELLPATH] [--lxrurl=LXRURL] {-e ENGINETYPE |
+ --engine=ENGINETYPE}
+ </code>
+ </td>
+ </tr>
+ </table>
+ <br>
+ <br>
+
+ <dt><b>DESCRIPTION</b></dt>
+ <dd>
+ <b>jsDriver.pl</b> is normally used to run a series of tests against
+ one of the JavaScript shells. These tests are expected to be laid out
+ in a directory structure exactly three levels deep. The first level
+ is considered the <b>root</b> of the tests, subdirectories under the
+ <b>root</b> represent <b>Test Suites</b> and generally mark broad
+ categories such as <i>ECMA Level 1</i> or <i>Live Connect 3</i>. Under the
+ <b>Test Suites</b> are the <b>Test Categories</b>, which divide the
+ <b>Test Suite</b> into smaller categories, such as <i>Execution Contexts</i>
+ or <i>Lexical Rules</i>. Testcases are located under the
+ <B>Test Categories</b> as normal JavaScript (*.js) files.
+ <p>
+ If a file named <b>shell.js</b> exists in either the
+ <b>Test Suite</b> or the <b>Test Category</b> directory, it is
+ loaded into the shell before the testcase. If <b>shell.js</b>
+ exists in both directories, the version in the <b>Test Suite</b>
+ directory is loaded <i>first</i>, giving the version associated with
+ the <b>Test Category</b> the ability to override functions previously
+ declared. You can use this to
+ create functions and variables common to an entire suite or category.
+ <p>
+ Testcases can report failures back to <b>jsDriver.pl</b> in one of
+ two ways. The most common is to write a line of text containing
+ the word <code>FAILED!</code> to <b>STDOUT</b> or <b>STDERR</b>.
+ When the engine encounters a matching line, the test is marked as
+ failed, and any line containing <code>FAILED!</code> is displayed in
+ the failure report. The second way a test case can report failure is
+ to return an unexpected exit code. By default, <b>jsDriver.pl</b>
+ expects all test cases to return exit code 0, although a test
+ can output a line containing <code>EXPECT EXIT <i>n</i></code> where
+ <i>n</i> is the exit code the driver should expect to see. Testcases
+ can return a nonzero exit code by calling the shell function
+ <code>quit(<i>n</i>)</code> where <code><i>n</i></code> is the
+ code to exit with. The various JavaScript shells report
+ non-zero exit codes under the following conditions:
+
+ <center>
+ <table border="1">
+ <tr>
+ <th>Reason</th>
+ <th>Exit Code</th>
+ </tr>
+ <tr>
+ <td>
+ Engine initialization failure.
+ </td>
+ <td>
+ 1
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Invalid argument on command line.
+ </td>
+ <td>
+ 2
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Runtime error (uncaught exception) encountered.
+ </td>
+ <td>
+ 3
+ </td>
+ </tr>
+ <tr>
+ <td>
+ File argument specified on command line not found.
+ </td>
+ <td>
+ 4
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Reserved for future use.
+ </td>
+ <td>
+ 5-9
+ </td>
+ </tr>
+ </table>
+ </center>
+ <br>
+ <br>
+
+ <dt><b>OPTIONS</b></dt>
+ <dd>
+ <dl>
+ <dt><b>-b URL, --bugurl=URL</b></dt>
+ <dd>
+ Bugzilla URL. When a testcase writes a line in the format
+ <code>BUGNUMBER <i>n</i></code> to <b>STDOUT</b> or <b>STDERR</b>,
+ <b>jsDriver.pl</b> interprets <code><i>n</i></code> as a bugnumber
+ in the <a href="http://bugzilla.mozilla.org">BugZilla</a> bug
+ tracking system. In the event that a testcase which has specified
+ a bugnumber fails, a hyperlink to the BugZilla database
+ will be included in the output by prefixing the bugnumber with the
+ URL specified here. By default, URL is assumed to be
+ &quot;http://bugzilla.mozilla.org/show_bug.cgi?id=&quot;.
+ <br>
+ <br>
+ <a name="classpath"></a>
+ <dt><b>-c PATH, --classpath=PATH</b></dt>
+ <dd>
+ Classpath to pass the the Java Virtual Machine. When running tests
+ against the <b>Rhino</b> engine, PATH will be passed in as the value
+ to an argument named &quot;-classpath&quot;. If your particular JVM
+ does not support this option, it is recommended you specify your
+ class path via an environment setting. Refer to your JVM
+ documentation for more details about CLASSPATH.
+ <br>
+ <br>
+ <dt><b>-e TYPE ..., --engine=TYPE ...</b></dt>
+ <dd>
+ Required. Type of engine(s) to run the tests against. TYPE can be
+ one or more of the following values:
+ <center>
+ <table border="1">
+ <tr>
+ <th>TYPE</th>
+ <th>Engine</th>
+ </tr>
+ <tr>
+ <td>lcopt</td>
+ <td>LiveConnect, optimized</td>
+ </tr>
+ <tr>
+ <td>lcdebug</td>
+ <td>LiveConnect, debug</td>
+ </tr>
+ <tr>
+ <td>rhino</td>
+ <td>Rhino compiled mode</td>
+ </tr>
+ <tr>
+ <td>rhinoi</td>
+ <td>Rhino interpreted mode</td>
+ </tr>
+ <tr>
+ <td>rhinoms</td>
+ <td>Rhino compiled mode for the Microsoft VM (jview)</td>
+ </tr>
+ <tr>
+ <td>rhinomsi</td>
+ <td>Rhino interpreted mode for the Microsoft VM (jview)</td>
+ </tr>
+ <tr>
+ <td>smopt</td>
+ <td>Spider-Monkey, optimized</td>
+ </tr>
+ <tr>
+ <td>smdebug</td>
+ <td>Spider-Monkey, debug</td>
+ </tr>
+ <tr>
+ <td>xpcshell</td>
+ <td>XPConnect shell</td>
+ </tr>
+ </table>
+ </center>
+ <br>
+ <br>
+ <dt><b>-f FILE, --file=FILE</b></dt>
+ <dd>
+ Generate html output to the HTML file named by FILE. By default,
+ a filename will be generated using a combination of the engine type
+ and a date/time stamp, in the format:
+ <code>results-<i>&lt;engine-type&gt;</i>-<i>&lt;date-stamp&gt;</i>.html</code>
+ <br>
+ <br>
+ <dt><b>-h, --help</b></dt>
+ <dd>
+ Prints usage information.
+ <br>
+ <br>
+ <dt><b>-j PATH, --javapath=PATH</b></dt>
+ <dd>
+ Set the location of the Java Virtual Machine to use when running
+ tests against the <b>Rhino</b> engine. This can be used to test
+ against multiple JVMs on the same system.
+ <br>
+ <br>
+ <dt><b>-k, --confail</b></dt>
+ <dd>
+ Log failures to the console. This will show any failures, as they
+ occur, on <b>STDERR</b> in addition to creating the HTML results
+ file. This can be useful for times when it may be
+ counter-productive to load an HTML version of the results each time
+ a test is re-run.
+ <br>
+ <br>
+ <dt><b>-l FILE ..., --list=FILE ...</b></dt>
+ <dd>
+ Specify a list of tests to execute. FILE can be a plain text file
+ containing a list of testcases to execute, a subdirectory
+ in which to
+ <a href="http://www.instantweb.com/~foldoc/foldoc.cgi?query=grovel">grovel</a>
+ for tests, or a single testcase to execute. Any number of FILE
+ specifiers may follow this option. The driver uses the fact that a
+ valid testcase should be a file ending in .js to make the distinction
+ between a file containing a list of tests and an actual testcase.
+ <br>
+ <br>
+ <dt><b>-L FILE ..., --neglist=FILE ...</b></dt>
+ <dd>
+ Specify a list of tests to skip. FILE has the same meaning as in
+ the <b>-l</b> option. This option is evaluated after
+ <b>all</b> <b>-l</b> and <b>--list</b> options, allowing a user
+ to subtract a single testcase, a directory of testcases, or a
+ collection of unrelated testcases from the execution list.
+ <br>
+ <br>
+ <dt><b>-p PATH, --testpath=PATH</b></dt>
+ <dd>
+ Directory holding the &quot;Test Suite&quot; subdirectories. By
+ default this is ./
+ <br>
+ <br>
+ <dt><b>-s PATH, --shellpath=PATH</b></dt>
+ <dd>
+ Directory holding the JavaScript shell. This can be used to override
+ the automatic shell location <b>jsDriver.pl</b> performs based on
+ you OS and engine type. For Non <b>Rhino</b> engines, this
+ includes the name of the executable as well as the path. In
+ <b>Rhino</b>, this path will be appended to your
+ <a href="#classpath">CLASSPATH</a>. For the
+ <b>SpiderMonkey</b> shells, this value defaults to
+ ../src/&lt;Platform-and-buildtype-specific-directory&gt;/[js|jsshell],
+ for the
+ <b>LiveConnect</b> shells,
+ ../src/liveconnect/src/&lt;Platform-and-buildtype-specific-directory&gt;/lschell
+ and for the <b>xpcshell</b> the default is the value of your
+ <code>MOZILLA_FIVE_HOME</code> environment variable. There is no
+ default (as it is usually not needed) for the <b>Rhino</b> shell.
+ <br>
+ <br>
+ <dt><b>-t, --trace</b></dt>
+ <dd>
+ Trace execution of <b>jsDriver.pl</b>. This option is primarily
+ used for debugging of the script itself, but if you are interested in
+ seeing the actual command being run, or generally like gobs of
+ useless information, you may find it entertaining.
+ <br>
+ <br>
+ <dt><b>-u URL, --lxrurl=URL</b></dt>
+ <dd>
+ Failures listed in the HTML results will be hyperlinked to the
+ lxr source available online by prefixing the test path and
+ name with this URL. By default, URL is
+ http://lxr.mozilla.org/mozilla/source/js/tests/
+ <br>
+ <br>
+
+ </dl>
+ <dt><b>SEE ALSO</b></dt>
+ <dd>
+ <a href="http://lxr.mozilla.org/mozilla/source/js/tests/jsDriver.pl">jsDriver.pl</a>,
+ <a href="http://lxr.mozilla.org/mozilla/source/js/tests/mklistpage.pl">mklistpage.pl</a>,
+ <a href="http://www.mozilla.org/js/">http://www.mozilla.org/js/</a>,
+ <a href="http://www.mozilla.org/js/tests/library.html">http://www.mozilla.org/js/tests/library.html</a>
+ <br>
+ <br>
+
+ <dt><b>REQUIREMENTS</b></dt>
+ <dd>
+ <b>jsDriver.pl</b> requires the
+ <a href="http://search.cpan.org/search?module=Getopt::Mixed">Getopt::Mixed</a>
+ perl package, available from <a href="http://www.cpan.org">cpan.org</a>.
+ <br>
+ <br>
+ <dt><b>EXAMPLES</b></dt>
+ <dd>
+ <code>perl jsDriver.pl -e smdebug -L lc*</code><br>
+ Executes all tests EXCEPT the liveconnect tests against the
+ SpiderMonkey debug shell, writing the results
+ to the default result file. (NOTE: Unix shells take care of wildcard
+ expansion, turning <code>lc*</code> into <code>lc2 lc3</code>. Under
+ a DOS shell, you must explicitly list the directories.)
+ <p>
+ <code>perl jsDriver.pl -e rhino -L rhino-n.tests</code><br>
+ Executes all tests EXCEPT those listed in the
+ <code>rhino-n.tests</code> file.
+ <p>
+ <code>perl -I/home/rginda/perl/lib/ jsDriver.pl -e lcopt -l lc2
+ lc3 -f lcresults.html -k</code><br>
+ Executes ONLY the tests under the <code>lc2</code> and <code>lc3</code>
+ directories against the LiveConnect shell. Results will be written to
+ the file <code>lcresults.html</code> <b>AND</b> the console. The
+ <code>-I</code> option tells perl to look for modules in the
+ <code>/home/rginda/perl/lib</code> directory (in addition to the
+ usual places), useful if you do not have root access to install new
+ modules on the system.
+ </dl>
+ <hr>
+ Author: Robert Ginda<br>
+ Currently maintained by <i><a href="mailto:pschwartau@netscape.com">Phil Schwartau</a> </i><br>
+<!-- Created: Thu Dec 2 19:08:05 PST 1999 -->
+ </body>
+</html>
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4-1.js
new file mode 100644
index 0000000..c5c3178
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4-1.js
@@ -0,0 +1,126 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.4-1.js
+ ECMA Section: 15.4 Array Objects
+
+ Description: Every Array object has a length property whose value
+ is always an integer with positive sign and less than
+ Math.pow(2,32).
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+ var SECTION = "15.4-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Array Objects";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION,
+ "var myarr = new Array(); myarr[Math.pow(2,32)-2]='hi'; myarr[Math.pow(2,32)-2]",
+ "hi",
+ eval("var myarr = new Array(); myarr[Math.pow(2,32)-2]='hi'; myarr[Math.pow(2,32)-2]")
+ );
+ array[item++] = new TestCase( SECTION,
+ "var myarr = new Array(); myarr[Math.pow(2,32)-2]='hi'; myarr.length",
+ (Math.pow(2,32)-1),
+ eval("var myarr = new Array(); myarr[Math.pow(2,32)-2]='hi'; myarr.length")
+ );
+ array[item++] = new TestCase( SECTION,
+ "var myarr = new Array(); myarr[Math.pow(2,32)-3]='hi'; myarr[Math.pow(2,32)-3]",
+ "hi",
+ eval("var myarr = new Array(); myarr[Math.pow(2,32)-3]='hi'; myarr[Math.pow(2,32)-3]")
+ );
+ array[item++] = new TestCase( SECTION,
+ "var myarr = new Array(); myarr[Math.pow(2,32)-3]='hi'; myarr.length",
+ (Math.pow(2,32)-2),
+ eval("var myarr = new Array(); myarr[Math.pow(2,32)-3]='hi'; myarr.length")
+ );
+
+ array[item++] = new TestCase( SECTION,
+ "var myarr = new Array(); myarr[Math.pow(2,31)-2]='hi'; myarr[Math.pow(2,31)-2]",
+ "hi",
+ eval("var myarr = new Array(); myarr[Math.pow(2,31)-2]='hi'; myarr[Math.pow(2,31)-2]")
+ );
+ array[item++] = new TestCase( SECTION,
+ "var myarr = new Array(); myarr[Math.pow(2,31)-2]='hi'; myarr.length",
+ (Math.pow(2,31)-1),
+ eval("var myarr = new Array(); myarr[Math.pow(2,31)-2]='hi'; myarr.length")
+ );
+
+ array[item++] = new TestCase( SECTION,
+ "var myarr = new Array(); myarr[Math.pow(2,31)-1]='hi'; myarr[Math.pow(2,31)-1]",
+ "hi",
+ eval("var myarr = new Array(); myarr[Math.pow(2,31)-1]='hi'; myarr[Math.pow(2,31)-1]")
+ );
+ array[item++] = new TestCase( SECTION,
+ "var myarr = new Array(); myarr[Math.pow(2,31)-1]='hi'; myarr.length",
+ (Math.pow(2,31)),
+ eval("var myarr = new Array(); myarr[Math.pow(2,31)-1]='hi'; myarr.length")
+ );
+
+
+ array[item++] = new TestCase( SECTION,
+ "var myarr = new Array(); myarr[Math.pow(2,31)]='hi'; myarr[Math.pow(2,31)]",
+ "hi",
+ eval("var myarr = new Array(); myarr[Math.pow(2,31)]='hi'; myarr[Math.pow(2,31)]")
+ );
+ array[item++] = new TestCase( SECTION,
+ "var myarr = new Array(); myarr[Math.pow(2,31)]='hi'; myarr.length",
+ (Math.pow(2,31)+1),
+ eval("var myarr = new Array(); myarr[Math.pow(2,31)]='hi'; myarr.length")
+ );
+
+ array[item++] = new TestCase( SECTION,
+ "var myarr = new Array(); myarr[Math.pow(2,30)-2]='hi'; myarr[Math.pow(2,30)-2]",
+ "hi",
+ eval("var myarr = new Array(); myarr[Math.pow(2,30)-2]='hi'; myarr[Math.pow(2,30)-2]")
+ );
+ array[item++] = new TestCase( SECTION,
+ "var myarr = new Array(); myarr[Math.pow(2,30)-2]='hi'; myarr.length",
+ (Math.pow(2,30)-1),
+ eval("var myarr = new Array(); myarr[Math.pow(2,30)-2]='hi'; myarr.length")
+ );
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4-2.js
new file mode 100644
index 0000000..ca046e6
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4-2.js
@@ -0,0 +1,83 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.4-2.js
+ ECMA Section: 15.4 Array Objects
+
+ Description: Whenever a property is added whose name is an array
+ index, the length property is changed, if necessary,
+ to be one more than the numeric value of that array
+ index; and whenever the length property is changed,
+ every property whose name is an array index whose value
+ is not smaller than the new length is automatically
+ deleted. This constraint applies only to the Array
+ object itself, and is unaffected by length or array
+ index properties that may be inherited from its
+ prototype.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+ var SECTION = "15.4-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Array Objects";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "var arr=new Array(); arr[Math.pow(2,16)] = 'hi'; arr.length", Math.pow(2,16)+1, eval("var arr=new Array(); arr[Math.pow(2,16)] = 'hi'; arr.length") );
+
+ array[item++] = new TestCase( SECTION, "var arr=new Array(); arr[Math.pow(2,30)-2] = 'hi'; arr.length", Math.pow(2,30)-1, eval("var arr=new Array(); arr[Math.pow(2,30)-2] = 'hi'; arr.length") );
+ array[item++] = new TestCase( SECTION, "var arr=new Array(); arr[Math.pow(2,30)-1] = 'hi'; arr.length", Math.pow(2,30), eval("var arr=new Array(); arr[Math.pow(2,30)-1] = 'hi'; arr.length") );
+ array[item++] = new TestCase( SECTION, "var arr=new Array(); arr[Math.pow(2,30)] = 'hi'; arr.length", Math.pow(2,30)+1, eval("var arr=new Array(); arr[Math.pow(2,30)] = 'hi'; arr.length") );
+
+ array[item++] = new TestCase( SECTION, "var arr=new Array(); arr[Math.pow(2,31)-2] = 'hi'; arr.length", Math.pow(2,31)-1, eval("var arr=new Array(); arr[Math.pow(2,31)-2] = 'hi'; arr.length") );
+ array[item++] = new TestCase( SECTION, "var arr=new Array(); arr[Math.pow(2,31)-1] = 'hi'; arr.length", Math.pow(2,31), eval("var arr=new Array(); arr[Math.pow(2,31)-1] = 'hi'; arr.length") );
+ array[item++] = new TestCase( SECTION, "var arr=new Array(); arr[Math.pow(2,31)] = 'hi'; arr.length", Math.pow(2,31)+1, eval("var arr=new Array(); arr[Math.pow(2,31)] = 'hi'; arr.length") );
+
+ array[item++] = new TestCase( SECTION, "var arr = new Array(0,1,2,3,4,5); arr.length = 2; String(arr)", "0,1", eval("var arr = new Array(0,1,2,3,4,5); arr.length = 2; String(arr)") );
+ array[item++] = new TestCase( SECTION, "var arr = new Array(0,1); arr.length = 3; String(arr)", "0,1,", eval("var arr = new Array(0,1); arr.length = 3; String(arr)") );
+// array[item++] = new TestCase( SECTION, "var arr = new Array(0,1,2,3,4,5); delete arr[0]; arr.length", 5, eval("var arr = new Array(0,1,2,3,4,5); delete arr[0]; arr.length") );
+// array[item++] = new TestCase( SECTION, "var arr = new Array(0,1,2,3,4,5); delete arr[6]; arr.length", 5, eval("var arr = new Array(0,1,2,3,4,5); delete arr[6]; arr.length") );
+
+ return ( array );
+}
+function test( array ) {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.1.1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.1.1.js
new file mode 100644
index 0000000..315aa2c
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.1.1.js
@@ -0,0 +1,88 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.4.1.1.js
+ ECMA Section: 15.4.1 Array( item0, item1,... )
+
+ Description: When Array is called as a function rather than as a
+ constructor, it creates and initializes a new array
+ object. Thus, the function call Array(...) is
+ equivalent to the object creation new Array(...) with
+ the same arguments.
+
+ An array is created and returned as if by the expression
+ new Array( item0, item1, ... ).
+
+ Author: christine@netscape.com
+ Date: 7 october 1997
+*/
+ var SECTION = "15.4.1.1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Array Constructor Called as a Function";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function ToUint32( n ) {
+ n = Number( n );
+ if( isNaN(n) || n == 0 || n == Number.POSITIVE_INFINITY ||
+ n == Number.NEGATIVE_INFINITY ) {
+ return 0;
+ }
+ var sign = n < 0 ? -1 : 1;
+
+ return ( sign * ( n * Math.floor( Math.abs(n) ) ) ) % Math.pow(2, 32);
+}
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "typeof Array(1,2)", "object", typeof Array(1,2) );
+ array[item++] = new TestCase( SECTION, "(Array(1,2)).toString", Array.prototype.toString, (Array(1,2)).toString );
+ array[item++] = new TestCase( SECTION,
+ "var arr = Array(1,2,3); arr.toString = Object.prototype.toString; arr.toString()",
+ "[object Array]",
+ eval("var arr = Array(1,2,3); arr.toString = Object.prototype.toString; arr.toString()") );
+
+
+ array[item++] = new TestCase( SECTION, "(Array(1,2)).length", 2, (Array(1,2)).length );
+ array[item++] = new TestCase( SECTION, "var arr = (Array(1,2)); arr[0]", 1, eval("var arr = (Array(1,2)); arr[0]") );
+ array[item++] = new TestCase( SECTION, "var arr = (Array(1,2)); arr[1]", 2, eval("var arr = (Array(1,2)); arr[1]") );
+ array[item++] = new TestCase( SECTION, "var arr = (Array(1,2)); String(arr)", "1,2", eval("var arr = (Array(1,2)); String(arr)") );
+
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.1.2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.1.2.js
new file mode 100644
index 0000000..29352e1
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.1.2.js
@@ -0,0 +1,98 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.4.1.2.js
+ ECMA Section: 15.4.1.2 Array(len)
+
+ Description: When Array is called as a function rather than as a
+ constructor, it creates and initializes a new array
+ object. Thus, the function call Array(...) is
+ equivalent to the object creationi new Array(...) with
+ the same arguments.
+
+ An array is created and returned as if by the
+ expression new Array(len).
+
+ Author: christine@netscape.com
+ Date: 7 october 1997
+*/
+ var SECTION = "15.4.1.2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Array Constructor Called as a Function: Array(len)";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "(Array()).length", 0, (Array()).length );
+ array[item++] = new TestCase( SECTION, "(Array(0)).length", 0, (Array(0)).length );
+ array[item++] = new TestCase( SECTION, "(Array(1)).length", 1, (Array(1)).length );
+ array[item++] = new TestCase( SECTION, "(Array(10)).length", 10, (Array(10)).length );
+ array[item++] = new TestCase( SECTION, "(Array('1')).length", 1, (Array('1')).length );
+ array[item++] = new TestCase( SECTION, "(Array(1000)).length", 1000, (Array(1000)).length );
+ array[item++] = new TestCase( SECTION, "(Array('1000')).length", 1, (Array('1000')).length );
+ array[item++] = new TestCase( SECTION, "(Array(4294967295)).length", ToUint32(4294967295), (Array(4294967295)).length );
+ array[item++] = new TestCase( SECTION, "(Array(Math.pow(2,31)-1)).length", ToUint32(Math.pow(2,31)-1), (Array(Math.pow(2,31)-1)).length );
+ array[item++] = new TestCase( SECTION, "(Array(Math.pow(2,31))).length", ToUint32(Math.pow(2,31)), (Array(Math.pow(2,31))).length );
+ array[item++] = new TestCase( SECTION, "(Array(Math.pow(2,31)+1)).length", ToUint32(Math.pow(2,31)+1), (Array(Math.pow(2,31)+1)).length );
+ array[item++] = new TestCase( SECTION, "(Array('8589934592')).length", 1, (Array("8589934592")).length );
+ array[item++] = new TestCase( SECTION, "(Array('4294967296')).length", 1, (Array("4294967296")).length );
+ array[item++] = new TestCase( SECTION, "(Array(1073741823)).length", ToUint32(1073741823), (Array(1073741823)).length );
+ array[item++] = new TestCase( SECTION, "(Array(1073741824)).length", ToUint32(1073741824), (Array(1073741824)).length );
+ array[item++] = new TestCase( SECTION, "(Array('a string')).length", 1, (Array("a string")).length );
+
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function ToUint32( n ) {
+ n = Number( n );
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
+ return 0;
+ }
+ n = sign * Math.floor( Math.abs(n) )
+
+ n = n % Math.pow(2,32);
+
+ if ( n < 0 ){
+ n += Math.pow(2,32);
+ }
+
+ return ( n );
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.1.3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.1.3.js
new file mode 100644
index 0000000..4c3393e
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.1.3.js
@@ -0,0 +1,86 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.4.1.3.js
+ ECMA Section: 15.4.1.3 Array()
+
+ Description: When Array is called as a function rather than as a
+ constructor, it creates and initializes a new array
+ object. Thus, the function call Array(...) is
+ equivalent to the object creationi new Array(...) with
+ the same arguments.
+
+ An array is created and returned as if by the
+ expression new Array(len).
+
+ Author: christine@netscape.com
+ Date: 7 october 1997
+*/
+ var SECTION = "15.4.1.3";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Array Constructor Called as a Function: Array()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION,
+ "typeof Array()",
+ "object",
+ typeof Array() );
+
+ array[item++] = new TestCase( SECTION,
+ "MYARR = new Array();MYARR.getClass = Object.prototype.toString;MYARR.getClass()",
+ "[object Array]",
+ eval("MYARR = Array();MYARR.getClass = Object.prototype.toString;MYARR.getClass()") );
+
+ array[item++] = new TestCase( SECTION,
+ "(Array()).length",
+ 0, (
+ Array()).length );
+
+ array[item++] = new TestCase( SECTION,
+ "Array().toString()",
+ "",
+ Array().toString() );
+
+
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.1.js
new file mode 100644
index 0000000..5640584
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.1.js
@@ -0,0 +1,133 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.4.1.js
+ ECMA Section: 15.4.1 The Array Constructor Called as a Function
+
+ Description: When Array is called as a function rather than as a
+ constructor, it creates and initializes a new array
+ object. Thus, the function call Array(...) is
+ equivalent to the object creationi new Array(...) with
+ the same arguments.
+
+ Author: christine@netscape.com
+ Date: 7 october 1997
+*/
+
+ var SECTION = "15.4.1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "The Array Constructor Called as a Function";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION,
+ "Array() +''",
+ "",
+ Array() +"" );
+
+ array[item++] = new TestCase( SECTION,
+ "typeof Array()",
+ "object",
+ typeof Array() );
+
+ array[item++] = new TestCase( SECTION,
+ "var arr = Array(); arr.getClass = Object.prototype.toString; arr.getClass()",
+ "[object Array]",
+ eval("var arr = Array(); arr.getClass = Object.prototype.toString; arr.getClass()") );
+
+ array[item++] = new TestCase( SECTION,
+ "var arr = Array(); arr.toString == Array.prototype.toString",
+ true,
+ eval("var arr = Array(); arr.toString == Array.prototype.toString") );
+
+ array[item++] = new TestCase( SECTION,
+ "Array().length",
+ 0,
+ Array().length );
+
+
+ array[item++] = new TestCase( SECTION,
+ "Array(1,2,3) +''",
+ "1,2,3",
+ Array(1,2,3) +"" );
+
+ array[item++] = new TestCase( SECTION,
+ "typeof Array(1,2,3)",
+ "object",
+ typeof Array(1,2,3) );
+
+ array[item++] = new TestCase( SECTION,
+ "var arr = Array(1,2,3); arr.getClass = Object.prototype.toString; arr.getClass()",
+ "[object Array]",
+ eval("var arr = Array(1,2,3); arr.getClass = Object.prototype.toString; arr.getClass()") );
+
+ array[item++] = new TestCase( SECTION,
+ "var arr = Array(1,2,3); arr.toString == Array.prototype.toString",
+ true,
+ eval("var arr = Array(1,2,3); arr.toString == Array.prototype.toString") );
+
+ array[item++] = new TestCase( SECTION,
+ "Array(1,2,3).length",
+ 3,
+ Array(1,2,3).length );
+
+ array[item++] = new TestCase( SECTION,
+ "typeof Array(12345)",
+ "object",
+ typeof Array(12345) );
+
+ array[item++] = new TestCase( SECTION,
+ "var arr = Array(12345); arr.getClass = Object.prototype.toString; arr.getClass()",
+ "[object Array]",
+ eval("var arr = Array(12345); arr.getClass = Object.prototype.toString; arr.getClass()") );
+
+ array[item++] = new TestCase( SECTION,
+ "var arr = Array(1,2,3,4,5); arr.toString == Array.prototype.toString",
+ true,
+ eval("var arr = Array(1,2,3,4,5); arr.toString == Array.prototype.toString") );
+
+ array[item++] = new TestCase( SECTION,
+ "Array(12345).length",
+ 12345,
+ Array(12345).length );
+
+ return ( array );
+}
+function test() {
+ for (tc=0 ; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.2.1-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.2.1-1.js
new file mode 100644
index 0000000..4c1c0c6
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.2.1-1.js
@@ -0,0 +1,92 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.4.2.1-1.js
+ ECMA Section: 15.4.2.1 new Array( item0, item1, ... )
+ Description: This description only applies of the constructor is
+ given two or more arguments.
+
+ The [[Prototype]] property of the newly constructed
+ object is set to the original Array prototype object,
+ the one that is the initial value of Array.prototype
+ (15.4.3.1).
+
+ The [[Class]] property of the newly constructed object
+ is set to "Array".
+
+ The length property of the newly constructed object is
+ set to the number of arguments.
+
+ The 0 property of the newly constructed object is set
+ to item0... in general, for as many arguments as there
+ are, the k property of the newly constructed object is
+ set to argument k, where the first argument is
+ considered to be argument number 0.
+
+ This file tests the typeof the newly constructed object.
+
+ Author: christine@netscape.com
+ Date: 7 october 1997
+*/
+
+ var SECTION = "15.4.2.1-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "The Array Constructor: new Array( item0, item1, ...)";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "typeof new Array(1,2)", "object", typeof new Array(1,2) );
+ array[item++] = new TestCase( SECTION, "(new Array(1,2)).toString", Array.prototype.toString, (new Array(1,2)).toString );
+ array[item++] = new TestCase( SECTION,
+ "var arr = new Array(1,2,3); arr.getClass = Object.prototype.toString; arr.getClass()",
+ "[object Array]",
+ eval("var arr = new Array(1,2,3); arr.getClass = Object.prototype.toString; arr.getClass()") );
+
+ array[item++] = new TestCase( SECTION, "(new Array(1,2)).length", 2, (new Array(1,2)).length );
+ array[item++] = new TestCase( SECTION, "var arr = (new Array(1,2)); arr[0]", 1, eval("var arr = (new Array(1,2)); arr[0]") );
+ array[item++] = new TestCase( SECTION, "var arr = (new Array(1,2)); arr[1]", 2, eval("var arr = (new Array(1,2)); arr[1]") );
+ array[item++] = new TestCase( SECTION, "var arr = (new Array(1,2)); String(arr)", "1,2", eval("var arr = (new Array(1,2)); String(arr)") );
+
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.2.1-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.2.1-2.js
new file mode 100644
index 0000000..d5a65de
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.2.1-2.js
@@ -0,0 +1,83 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.4.2.1-2.js
+ ECMA Section: 15.4.2.1 new Array( item0, item1, ... )
+ Description: This description only applies of the constructor is
+ given two or more arguments.
+
+ The [[Prototype]] property of the newly constructed
+ object is set to the original Array prototype object,
+ the one that is the initial value of Array.prototype
+ (15.4.3.1).
+
+ The [[Class]] property of the newly constructed object
+ is set to "Array".
+
+ The length property of the newly constructed object is
+ set to the number of arguments.
+
+ The 0 property of the newly constructed object is set
+ to item0... in general, for as many arguments as there
+ are, the k property of the newly constructed object is
+ set to argument k, where the first argument is
+ considered to be argument number 0.
+
+
+ Author: christine@netscape.com
+ Date: 7 october 1997
+*/
+ var SECTION = "15.4.2.1-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "The Array Constructor: new Array( item0, item1, ...)";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ testcases = getTestCases();
+
+ test();
+
+function getTestCases() {
+ var array = new Array();
+
+ var TEST_STRING = "new Array(";
+ var ARGUMENTS = ""
+ var TEST_LENGTH = Math.pow(2,10); //Math.pow(2,32);
+
+ for ( var index = 0; index < TEST_LENGTH; index++ ) {
+ ARGUMENTS += index;
+ ARGUMENTS += (index == (TEST_LENGTH-1) ) ? "" : ",";
+ }
+
+ TEST_STRING += ARGUMENTS + ")";
+
+ TEST_ARRAY = eval( TEST_STRING );
+
+ for ( item = 0; item < TEST_LENGTH; item++ ) {
+ array[item] = new TestCase( SECTION, "["+item+"]", item, TEST_ARRAY[item] );
+ }
+
+ array[item++ ] = new TestCase( SECTION, "new Array( ["+TEST_LENGTH+" arguments] ) +''", ARGUMENTS, TEST_ARRAY +"" );
+
+ return ( array );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.2.1-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.2.1-3.js
new file mode 100644
index 0000000..b299183
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.2.1-3.js
@@ -0,0 +1,112 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.4.2.1-3.js
+ ECMA Section: 15.4.2.1 new Array( item0, item1, ... )
+ Description: This description only applies of the constructor is
+ given two or more arguments.
+
+ The [[Prototype]] property of the newly constructed
+ object is set to the original Array prototype object,
+ the one that is the initial value of Array.prototype
+ (15.4.3.1).
+
+ The [[Class]] property of the newly constructed object
+ is set to "Array".
+
+ The length property of the newly constructed object is
+ set to the number of arguments.
+
+ The 0 property of the newly constructed object is set
+ to item0... in general, for as many arguments as there
+ are, the k property of the newly constructed object is
+ set to argument k, where the first argument is
+ considered to be argument number 0.
+
+ This test stresses the number of arguments presented to
+ the Array constructor. Should support up to Math.pow
+ (2,32) arguments, since that is the maximum length of an
+ ECMAScript array.
+
+ ***Change TEST_LENGTH to Math.pow(2,32) when larger array
+ lengths are supported.
+
+ Author: christine@netscape.com
+ Date: 7 october 1997
+*/
+ var SECTION = "15.4.2.1-3";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "The Array Constructor: new Array( item0, item1, ...)";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+
+ var TEST_STRING = "new Array(";
+ var ARGUMENTS = ""
+ var TEST_LENGTH = Math.pow(2,10); //Math.pow(2,32);
+
+ for ( var index = 0; index < TEST_LENGTH; index++ ) {
+ ARGUMENTS += index;
+ ARGUMENTS += (index == (TEST_LENGTH-1) ) ? "" : ",";
+ }
+
+ TEST_STRING += ARGUMENTS + ")";
+
+ TEST_ARRAY = eval( TEST_STRING );
+
+ for ( item = 0; item < TEST_LENGTH; item++ ) {
+ array[item] = new TestCase( SECTION, "TEST_ARRAY["+item+"]", item, TEST_ARRAY[item] );
+ }
+
+ array[item++] = new TestCase( SECTION, "new Array( ["+TEST_LENGTH+" arguments] ) +''", ARGUMENTS, TEST_ARRAY +"" );
+ array[item++] = new TestCase( SECTION, "TEST_ARRAY.toString", Array.prototype.toString, TEST_ARRAY.toString );
+ array[item++] = new TestCase( SECTION, "TEST_ARRAY.join", Array.prototype.join, TEST_ARRAY.join );
+ array[item++] = new TestCase( SECTION, "TEST_ARRAY.sort", Array.prototype.sort, TEST_ARRAY.sort );
+ array[item++] = new TestCase( SECTION, "TEST_ARRAY.reverse", Array.prototype.reverse, TEST_ARRAY.reverse );
+ array[item++] = new TestCase( SECTION, "TEST_ARRAY.length", TEST_LENGTH, TEST_ARRAY.length );
+ array[item++] = new TestCase( SECTION,
+ "TEST_ARRAY.toString = Object.prototype.toString; TEST_ARRAY.toString()",
+ "[object Array]",
+ eval("TEST_ARRAY.toString = Object.prototype.toString; TEST_ARRAY.toString()") );
+
+ return ( array );
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.2.2-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.2.2-1.js
new file mode 100644
index 0000000..a2e41ef
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.2.2-1.js
@@ -0,0 +1,124 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.4.2.2-1.js
+ ECMA Section: 15.4.2.2 new Array(len)
+
+ Description: This description only applies of the constructor is
+ given two or more arguments.
+
+ The [[Prototype]] property of the newly constructed
+ object is set to the original Array prototype object,
+ the one that is the initial value of Array.prototype(0)
+ (15.4.3.1).
+
+ The [[Class]] property of the newly constructed object
+ is set to "Array".
+
+ If the argument len is a number, then the length
+ property of the newly constructed object is set to
+ ToUint32(len).
+
+ If the argument len is not a number, then the length
+ property of the newly constructed object is set to 1
+ and the 0 property of the newly constructed object is
+ set to len.
+
+ This file tests cases where len is a number.
+
+ The cases in this test need to be updated since the
+ ToUint32 description has changed.
+
+ Author: christine@netscape.com
+ Date: 7 october 1997
+*/
+ var SECTION = "15.4.2.2-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "The Array Constructor: new Array( len )";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "new Array(0)", "", (new Array(0)).toString() );
+ array[item++] = new TestCase( SECTION, "typeof new Array(0)", "object", (typeof new Array(0)) );
+ array[item++] = new TestCase( SECTION, "(new Array(0)).length", 0, (new Array(0)).length );
+ array[item++] = new TestCase( SECTION, "(new Array(0)).toString", Array.prototype.toString, (new Array(0)).toString );
+
+ array[item++] = new TestCase( SECTION, "new Array(1)", "", (new Array(1)).toString() );
+ array[item++] = new TestCase( SECTION, "new Array(1).length", 1, (new Array(1)).length );
+ array[item++] = new TestCase( SECTION, "(new Array(1)).toString", Array.prototype.toString, (new Array(1)).toString );
+
+ array[item++] = new TestCase( SECTION, "(new Array(-0)).length", 0, (new Array(-0)).length );
+ array[item++] = new TestCase( SECTION, "(new Array(0)).length", 0, (new Array(0)).length );
+
+ array[item++] = new TestCase( SECTION, "(new Array(10)).length", 10, (new Array(10)).length );
+ array[item++] = new TestCase( SECTION, "(new Array('1')).length", 1, (new Array('1')).length );
+ array[item++] = new TestCase( SECTION, "(new Array(1000)).length", 1000, (new Array(1000)).length );
+ array[item++] = new TestCase( SECTION, "(new Array('1000')).length", 1, (new Array('1000')).length );
+
+ array[item++] = new TestCase( SECTION, "(new Array(4294967295)).length", ToUint32(4294967295), (new Array(4294967295)).length );
+
+ array[item++] = new TestCase( SECTION, "(new Array('8589934592')).length", 1, (new Array("8589934592")).length );
+ array[item++] = new TestCase( SECTION, "(new Array('4294967296')).length", 1, (new Array("4294967296")).length );
+ array[item++] = new TestCase( SECTION, "(new Array(1073741824)).length", ToUint32(1073741824), (new Array(1073741824)).length );
+
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed )
+ ? ""
+ : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function ToUint32( n ) {
+ n = Number( n );
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
+ return 0;
+ }
+ n = sign * Math.floor( Math.abs(n) )
+
+ n = n % Math.pow(2,32);
+
+ if ( n < 0 ){
+ n += Math.pow(2,32);
+ }
+
+ return ( n );
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.2.2-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.2.2-2.js
new file mode 100644
index 0000000..c360702
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.2.2-2.js
@@ -0,0 +1,89 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.4.2.2-2.js
+ ECMA Section: 15.4.2.2 new Array(len)
+
+ Description: This description only applies of the constructor is
+ given two or more arguments.
+
+ The [[Prototype]] property of the newly constructed
+ object is set to the original Array prototype object,
+ the one that is the initial value of Array.prototype(0)
+ (15.4.3.1).
+
+ The [[Class]] property of the newly constructed object
+ is set to "Array".
+
+ If the argument len is a number, then the length
+ property of the newly constructed object is set to
+ ToUint32(len).
+
+ If the argument len is not a number, then the length
+ property of the newly constructed object is set to 1
+ and the 0 property of the newly constructed object is
+ set to len.
+
+ This file tests length of the newly constructed array
+ when len is not a number.
+
+ Author: christine@netscape.com
+ Date: 7 october 1997
+*/
+ var SECTION = "15.4.2.2-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "The Array Constructor: new Array( len )";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "(new Array(new Number(1073741823))).length", 1, (new Array(new Number(1073741823))).length );
+ array[item++] = new TestCase( SECTION, "(new Array(new Number(0))).length", 1, (new Array(new Number(0))).length );
+ array[item++] = new TestCase( SECTION, "(new Array(new Number(1000))).length", 1, (new Array(new Number(1000))).length );
+ array[item++] = new TestCase( SECTION, "(new Array('mozilla, larryzilla, curlyzilla')).length", 1, (new Array('mozilla, larryzilla, curlyzilla')).length );
+ array[item++] = new TestCase( SECTION, "(new Array(true)).length", 1, (new Array(true)).length );
+ array[item++] = new TestCase( SECTION, "(new Array(false)).length", 1, (new Array(false)).length);
+ array[item++] = new TestCase( SECTION, "(new Array(new Boolean(true)).length", 1, (new Array(new Boolean(true))).length );
+ array[item++] = new TestCase( SECTION, "(new Array(new Boolean(false)).length", 1, (new Array(new Boolean(false))).length );
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed )
+ ? ""
+ : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.2.3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.2.3.js
new file mode 100644
index 0000000..2ddd31b
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.2.3.js
@@ -0,0 +1,74 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.4.2.3.js
+ ECMA Section: 15.4.2.3 new Array()
+ Description: The [[Prototype]] property of the newly constructed
+ object is set to the origianl Array prototype object,
+ the one that is the initial value of Array.prototype.
+ The [[Class]] property of the new object is set to
+ "Array". The length of the object is set to 0.
+
+ Author: christine@netscape.com
+ Date: 7 october 1997
+*/
+
+ var SECTION = "15.4.2.3";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "The Array Constructor: new Array()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION, "new Array() +''", "", (new Array()) +"" );
+ array[item++] = new TestCase( SECTION, "typeof new Array()", "object", (typeof new Array()) );
+ array[item++] = new TestCase( SECTION,
+ "var arr = new Array(); arr.getClass = Object.prototype.toString; arr.getClass()",
+ "[object Array]",
+ eval("var arr = new Array(); arr.getClass = Object.prototype.toString; arr.getClass()") );
+
+ array[item++] = new TestCase( SECTION, "(new Array()).length", 0, (new Array()).length );
+ array[item++] = new TestCase( SECTION, "(new Array()).toString == Array.prototype.toString", true, (new Array()).toString == Array.prototype.toString );
+ array[item++] = new TestCase( SECTION, "(new Array()).join == Array.prototype.join", true, (new Array()).join == Array.prototype.join );
+ array[item++] = new TestCase( SECTION, "(new Array()).reverse == Array.prototype.reverse", true, (new Array()).reverse == Array.prototype.reverse );
+ array[item++] = new TestCase( SECTION, "(new Array()).sort == Array.prototype.sort", true, (new Array()).sort == Array.prototype.sort );
+
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.3.1-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.3.1-2.js
new file mode 100644
index 0000000..994ce5e
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.3.1-2.js
@@ -0,0 +1,66 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.4.3.1-1.js
+ ECMA Section: 15.4.3.1 Array.prototype
+ Description: The initial value of Array.prototype is the built-in
+ Array prototype object (15.4.4).
+
+ Author: christine@netscape.com
+ Date: 7 october 1997
+*/
+
+ var SECTION = "15.4.3.1-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Array.prototype";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ var ARRAY_PROTO = Array.prototype;
+
+ array[item++] = new TestCase( SECTION, "var props = ''; for ( p in Array ) { props += p } props", "", eval("var props = ''; for ( p in Array ) { props += p } props") );
+
+ array[item++] = new TestCase( SECTION, "Array.prototype = null; Array.prototype", ARRAY_PROTO, eval("Array.prototype = null; Array.prototype") );
+
+ array[item++] = new TestCase( SECTION, "delete Array.prototype", false, delete Array.prototype );
+ array[item++] = new TestCase( SECTION, "delete Array.prototype; Array.prototype", ARRAY_PROTO, eval("delete Array.prototype; Array.prototype") );
+
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.3.2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.3.2.js
new file mode 100644
index 0000000..43c2b4c
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.3.2.js
@@ -0,0 +1,57 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.4.3.2.js
+ ECMA Section: 15.4.3.2 Array.length
+ Description: The length property is 1.
+
+ Author: christine@netscape.com
+ Date: 7 october 1997
+*/
+
+ var SECTION = "15.4.3.2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Array.length";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION, "Array.length", 1, Array.length );
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.3.js
new file mode 100644
index 0000000..b44c6cb
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.3.js
@@ -0,0 +1,63 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.4.3.js
+ ECMA Section: 15.4.3 Properties of the Array Constructor
+ Description: The value of the internal [[Prototype]] property of the
+ Array constructor is the Function prototype object.
+
+ Author: christine@netscape.com
+ Date: 7 october 1997
+*/
+
+ var SECTION = "15.4.3";
+ var VERSION = "ECMA_2";
+ startTest();
+ var TITLE = "Properties of the Array Constructor";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "Array.__proto__", Function.prototype, Array.__proto__ );
+
+ return ( array );
+}
+function test() {
+ for (tc=0 ; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+
+ stopTest();
+
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.4.1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.4.1.js
new file mode 100644
index 0000000..4b46136
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.4.1.js
@@ -0,0 +1,57 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.4.4.1.js
+ ECMA Section: 15.4.4.1 Array.prototype.constructor
+ Description: The initial value of Array.prototype.constructor
+ is the built-in Array constructor.
+ Author: christine@netscape.com
+ Date: 7 october 1997
+*/
+
+ var SECTION = "15.4.4.1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Array.prototype.constructor";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION, "Array.prototype.constructor == Array", true, Array.prototype.constructor == Array);
+ return ( array );
+}
+function test() {
+ for (tc=0 ; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.4.2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.4.2.js
new file mode 100644
index 0000000..9565798
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.4.2.js
@@ -0,0 +1,83 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.4.4.2.js
+ ECMA Section: 15.4.4.2 Array.prototype.toString()
+ Description: The elements of this object are converted to strings
+ and these strings are then concatenated, separated by
+ comma characters. The result is the same as if the
+ built-in join method were invoiked for this object
+ with no argument.
+ Author: christine@netscape.com
+ Date: 7 october 1997
+*/
+
+ var SECTION = "15.4.4.2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Array.prototype.toString";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "Array.prototype.toString.length", 0, Array.prototype.toString.length );
+
+ array[item++] = new TestCase( SECTION, "(new Array()).toString()", "", (new Array()).toString() );
+ array[item++] = new TestCase( SECTION, "(new Array(2)).toString()", ",", (new Array(2)).toString() );
+ array[item++] = new TestCase( SECTION, "(new Array(0,1)).toString()", "0,1", (new Array(0,1)).toString() );
+ array[item++] = new TestCase( SECTION, "(new Array( Number.NaN, Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY)).toString()", "NaN,Infinity,-Infinity", (new Array( Number.NaN, Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY)).toString() );
+
+ array[item++] = new TestCase( SECTION, "(new Array( Boolean(1), Boolean(0))).toString()", "true,false", (new Array(Boolean(1),Boolean(0))).toString() );
+ array[item++] = new TestCase( SECTION, "(new Array(void 0,null)).toString()", ",", (new Array(void 0,null)).toString() );
+
+ var EXPECT_STRING = "";
+ var MYARR = new Array();
+
+ for ( var i = -50; i < 50; i+= 0.25 ) {
+ MYARR[MYARR.length] = i;
+ EXPECT_STRING += i +",";
+ }
+
+ EXPECT_STRING = EXPECT_STRING.substring( 0, EXPECT_STRING.length -1 );
+
+ array[item++] = new TestCase( SECTION, "MYARR.toString()", EXPECT_STRING, MYARR.toString() );
+
+
+ return ( array );
+}
+function test() {
+ for ( tc=0 ; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.4.3-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.4.3-1.js
new file mode 100644
index 0000000..63ec5b0
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.4.3-1.js
@@ -0,0 +1,159 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.4.4.3-1.js
+ ECMA Section: 15.4.4.3-1 Array.prototype.join()
+ Description: The elements of this object are converted to strings and
+ these strings are then concatenated, separated by comma
+ characters. The result is the same as if the built-in join
+ method were invoiked for this object with no argument.
+ Author: christine@netscape.com, pschwartau@netscape.com
+ Date: 07 October 1997
+ Modified: 14 July 2002
+ Reason: See http://bugzilla.mozilla.org/show_bug.cgi?id=155285
+ ECMA-262 Ed.3 Section 15.4.4.5 Array.prototype.join()
+ Step 3: If |separator| is |undefined|, let |separator|
+ be the single-character string ","
+*
+*/
+
+ var SECTION = "15.4.4.3-1";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Array.prototype.join()");
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ var ARR_PROTOTYPE = Array.prototype;
+
+ array[item++] = new TestCase( SECTION, "Array.prototype.join.length", 1, Array.prototype.join.length );
+ array[item++] = new TestCase( SECTION, "delete Array.prototype.join.length", false, delete Array.prototype.join.length );
+ array[item++] = new TestCase( SECTION, "delete Array.prototype.join.length; Array.prototype.join.length", 1, eval("delete Array.prototype.join.length; Array.prototype.join.length") );
+
+ // case where array length is 0
+
+ array[item++] = new TestCase( SECTION,
+ "var TEST_ARRAY = new Array(); TEST_ARRAY.join()",
+ "",
+ eval("var TEST_ARRAY = new Array(); TEST_ARRAY.join()") );
+
+ // array length is 0, but spearator is specified
+
+ array[item++] = new TestCase( SECTION,
+ "var TEST_ARRAY = new Array(); TEST_ARRAY.join(' ')",
+ "",
+ eval("var TEST_ARRAY = new Array(); TEST_ARRAY.join(' ')") );
+
+ // length is greater than 0, separator is supplied
+ array[item++] = new TestCase( SECTION,
+ "var TEST_ARRAY = new Array(null, void 0, true, false, 123, new Object(), new Boolean(true) ); TEST_ARRAY.join('&')",
+ "&&true&false&123&[object Object]&true",
+ eval("var TEST_ARRAY = new Array(null, void 0, true, false, 123, new Object(), new Boolean(true) ); TEST_ARRAY.join('&')") );
+
+ // length is greater than 0, separator is empty string
+ array[item++] = new TestCase( SECTION,
+ "var TEST_ARRAY = new Array(null, void 0, true, false, 123, new Object(), new Boolean(true) ); TEST_ARRAY.join('')",
+ "truefalse123[object Object]true",
+ eval("var TEST_ARRAY = new Array(null, void 0, true, false, 123, new Object(), new Boolean(true) ); TEST_ARRAY.join('')") );
+ // length is greater than 0, separator is undefined
+ array[item++] = new TestCase( SECTION,
+ "var TEST_ARRAY = new Array(null, void 0, true, false, 123, new Object(), new Boolean(true) ); TEST_ARRAY.join(void 0)",
+ ",,true,false,123,[object Object],true",
+ eval("var TEST_ARRAY = new Array(null, void 0, true, false, 123, new Object(), new Boolean(true) ); TEST_ARRAY.join(void 0)") );
+
+ // length is greater than 0, separator is not supplied
+ array[item++] = new TestCase( SECTION,
+ "var TEST_ARRAY = new Array(null, void 0, true, false, 123, new Object(), new Boolean(true) ); TEST_ARRAY.join()",
+ ",,true,false,123,[object Object],true",
+ eval("var TEST_ARRAY = new Array(null, void 0, true, false, 123, new Object(), new Boolean(true) ); TEST_ARRAY.join()") );
+
+ // separator is a control character
+ array[item++] = new TestCase( SECTION,
+ "var TEST_ARRAY = new Array(null, void 0, true, false, 123, new Object(), new Boolean(true) ); TEST_ARRAY.join('\v')",
+ unescape("%u000B%u000Btrue%u000Bfalse%u000B123%u000B[object Object]%u000Btrue"),
+ eval("var TEST_ARRAY = new Array(null, void 0, true, false, 123, new Object(), new Boolean(true) ); TEST_ARRAY.join('\v')") );
+
+ // length of array is 1
+ array[item++] = new TestCase( SECTION,
+ "var TEST_ARRAY = new Array(true) ); TEST_ARRAY.join('\v')",
+ "true",
+ eval("var TEST_ARRAY = new Array(true); TEST_ARRAY.join('\v')") );
+
+
+ SEPARATOR = "\t"
+ TEST_LENGTH = 100;
+ TEST_STRING = "";
+ ARGUMENTS = "";
+ TEST_RESULT = "";
+
+ for ( var index = 0; index < TEST_LENGTH; index++ ) {
+ ARGUMENTS += index;
+ ARGUMENTS += ( index == TEST_LENGTH -1 ) ? "" : ",";
+
+ TEST_RESULT += index;
+ TEST_RESULT += ( index == TEST_LENGTH -1 ) ? "" : SEPARATOR;
+ }
+
+ TEST_ARRAY = eval( "new Array( "+ARGUMENTS +")" );
+
+ array[item++] = new TestCase( SECTION, "TEST_ARRAY.join("+SEPARATOR+")", TEST_RESULT, TEST_ARRAY.join( SEPARATOR ) );
+
+ array[item++] = new TestCase( SECTION, "(new Array( Boolean(true), Boolean(false), null, void 0, Number(1e+21), Number(1e-7))).join()",
+ "true,false,,,1e+21,1e-7",
+ (new Array( Boolean(true), Boolean(false), null, void 0, Number(1e+21), Number(1e-7))).join() );
+
+ // this is not an Array object
+ array[item++] = new TestCase( SECTION,
+ "var OB = new Object_1('true,false,111,0.5,1.23e6,NaN,void 0,null'); OB.join(':')",
+ "true:false:111:0.5:1230000:NaN::",
+ eval("var OB = new Object_1('true,false,111,0.5,1.23e6,NaN,void 0,null'); OB.join(':')") );
+
+
+
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function Object_1( value ) {
+ this.array = value.split(",");
+ this.length = this.array.length;
+ for ( var i = 0; i < this.length; i++ ) {
+ this[i] = eval(this.array[i]);
+ }
+ this.join = Array.prototype.join;
+ this.getClass = Object.prototype.toString;
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.4.4-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.4.4-1.js
new file mode 100644
index 0000000..c8e7422
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.4.4-1.js
@@ -0,0 +1,272 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.4.4.3-1.js
+ ECMA Section: 15.4.4.3-1 Array.prototype.reverse()
+ Description:
+
+ The elements of the array are rearranged so as to reverse their order.
+ This object is returned as the result of the call.
+
+ 1. Call the [[Get]] method of this object with argument "length".
+ 2. Call ToUint32(Result(1)).
+ 3. Compute floor(Result(2)/2).
+ 4. Let k be 0.
+ 5. If k equals Result(3), return this object.
+ 6. Compute Result(2)k1.
+ 7. Call ToString(k).
+ 8. ToString(Result(6)).
+ 9. Call the [[Get]] method of this object with argument Result(7).
+ 10. Call the [[Get]] method of this object with argument Result(8).
+ 11. If this object has a property named by Result(8), go to step 12; but
+ if this object has no property named by Result(8), then go to either
+ step 12 or step 14, depending on the implementation.
+ 12. Call the [[Put]] method of this object with arguments Result(7) and
+ Result(10).
+ 13. Go to step 15.
+ 14. Call the [[Delete]] method on this object, providing Result(7) as the
+ name of the property to delete.
+ 15. If this object has a property named by Result(7), go to step 16; but if
+ this object has no property named by Result(7), then go to either step 16
+ or step 18, depending on the implementation.
+ 16. Call the [[Put]] method of this object with arguments Result(8) and
+ Result(9).
+ 17. Go to step 19.
+ 18. Call the [[Delete]] method on this object, providing Result(8) as the
+ name of the property to delete.
+ 19. Increase k by 1.
+ 20. Go to step 5.
+
+Note that the reverse function is intentionally generic; it does not require
+that its this value be an Array object. Therefore it can be transferred to other
+kinds of objects for use as a method. Whether the reverse function can be applied
+successfully to a host object is implementation dependent.
+
+ Note: Array.prototype.reverse allows some flexibility in implementation
+ regarding array indices that have not been populated. This test covers the
+ cases in which unpopulated indices are not deleted, since the JavaScript
+ implementation does not delete uninitialzed indices.
+
+ Author: christine@netscape.com
+ Date: 7 october 1997
+*/
+ var SECTION = "15.4.4.4-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var BUGNUMBER="123724";
+
+ writeHeaderToLog( SECTION + " Array.prototype.reverse()");
+
+ var testcases = new Array();
+ getTestCases();
+ test();
+
+function getTestCases() {
+ var ARR_PROTOTYPE = Array.prototype;
+
+ testcases[testcases.length] = new TestCase( SECTION, "Array.prototype.reverse.length", 0, Array.prototype.reverse.length );
+ testcases[testcases.length] = new TestCase( SECTION, "delete Array.prototype.reverse.length", false, delete Array.prototype.reverse.length );
+ testcases[testcases.length] = new TestCase( SECTION, "delete Array.prototype.reverse.length; Array.prototype.reverse.length", 0, eval("delete Array.prototype.reverse.length; Array.prototype.reverse.length") );
+
+ // length of array is 0
+ testcases[testcases.length] = new TestCase( SECTION,
+ "var A = new Array(); A.reverse(); A.length",
+ 0,
+ eval("var A = new Array(); A.reverse(); A.length") );
+
+ // length of array is 1
+ var A = new Array(true);
+ var R = Reverse(A);
+
+ testcases[testcases.length] = new TestCase( SECTION,
+ "var A = new Array(true); A.reverse(); A.length",
+ R.length,
+ eval("var A = new Array(true); A.reverse(); A.length") );
+ CheckItems( R, A );
+
+ // length of array is 2
+ var S = "var A = new Array( true,false )";
+ eval(S);
+ var R = Reverse(A);
+
+ testcases[testcases.length] = new TestCase(
+ SECTION,
+ S +"; A.reverse(); A.length",
+ R.length,
+ eval( S + "; A.reverse(); A.length") );
+
+ CheckItems( R, A );
+
+ // length of array is 3
+ var S = "var A = new Array( true,false,null )";
+ eval(S);
+ var R = Reverse(A);
+
+ testcases[testcases.length] = new TestCase( SECTION,
+ S +"; A.reverse(); A.length",
+ R.length,
+ eval( S + "; A.reverse(); A.length") );
+ CheckItems( R, A );
+
+ // length of array is 4
+ var S = "var A = new Array( true,false,null,void 0 )";
+ eval(S);
+ var R = Reverse(A);
+
+ testcases[testcases.length] = new TestCase( SECTION,
+ S +"; A.reverse(); A.length",
+ R.length,
+ eval( S + "; A.reverse(); A.length") );
+ CheckItems( R, A );
+
+
+ // some array indexes have not been set
+ var S = "var A = new Array(); A[8] = 'hi', A[3] = 'yo'";
+ eval(S);
+ var R = Reverse(A);
+
+ testcases[testcases.length] = new TestCase( SECTION,
+ S +"; A.reverse(); A.length",
+ R.length,
+ eval( S + "; A.reverse(); A.length") );
+ CheckItems( R, A );
+
+
+ var OBJECT_OBJECT = new Object();
+ var FUNCTION_OBJECT = new Function( 'return this' );
+ var BOOLEAN_OBJECT = new Boolean;
+ var DATE_OBJECT = new Date(0);
+ var STRING_OBJECT = new String('howdy');
+ var NUMBER_OBJECT = new Number(Math.PI);
+ var ARRAY_OBJECT= new Array(1000);
+
+ var args = "null, void 0, Math.pow(2,32), 1.234e-32, OBJECT_OBJECT, BOOLEAN_OBJECT, FUNCTION_OBJECT, DATE_OBJECT, STRING_OBJECT,"+
+ "ARRAY_OBJECT, NUMBER_OBJECT, Math, true, false, 123, '90210'";
+
+ var S = "var A = new Array("+args+")";
+ eval(S);
+ var R = Reverse(A);
+
+ testcases[testcases.length] = new TestCase( SECTION,
+ S +"; A.reverse(); A.length",
+ R.length,
+ eval( S + "; A.reverse(); A.length") );
+ CheckItems( R, A );
+
+ var limit = 1000;
+ var args = "";
+ for (var i = 0; i < limit; i++ ) {
+ args += i +"";
+ if ( i + 1 < limit ) {
+ args += ",";
+ }
+ }
+
+ var S = "var A = new Array("+args+")";
+ eval(S);
+ var R = Reverse(A);
+
+ testcases[testcases.length] = new TestCase( SECTION,
+ S +"; A.reverse(); A.length",
+ R.length,
+ eval( S + "; A.reverse(); A.length") );
+ CheckItems( R, A );
+
+ var S = "var MYOBJECT = new Object_1( \"void 0, 1, null, 2, \'\'\" )";
+ eval(S);
+ var R = Reverse( A );
+
+ testcases[testcases.length] = new TestCase( SECTION,
+ S +"; A.reverse(); A.length",
+ R.length,
+ eval( S + "; A.reverse(); A.length") );
+ CheckItems( R, A );
+
+ return ( testcases );
+}
+function CheckItems( R, A ) {
+ for ( var i = 0; i < R.length; i++ ) {
+ testcases[testcases.length] = new TestCase(
+ SECTION,
+ "A["+i+ "]",
+ R[i],
+ A[i] );
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function Object_1( value ) {
+ this.array = value.split(",");
+ this.length = this.array.length;
+ for ( var i = 0; i < this.length; i++ ) {
+ this[i] = eval(this.array[i]);
+ }
+ this.join = Array.prototype.reverse;
+ this.getClass = Object.prototype.toString;
+}
+function Reverse( array ) {
+ var r2 = array.length;
+ var k = 0;
+ var r3 = Math.floor( r2/2 );
+ if ( r3 == k ) {
+ return array;
+ }
+
+ for ( k = 0; k < r3; k++ ) {
+ var r6 = r2 - k - 1;
+// var r7 = String( k );
+ var r7 = k;
+ var r8 = String( r6 );
+
+ var r9 = array[r7];
+ var r10 = array[r8];
+
+ array[r7] = r10;
+ array[r8] = r9;
+ }
+
+ return array;
+}
+function Iterate( array ) {
+ for ( var i = 0; i < array.length; i++ ) {
+// print( i+": "+ array[String(i)] );
+ }
+}
+
+function Object_1( value ) {
+ this.array = value.split(",");
+ this.length = this.array.length;
+ for ( var i = 0; i < this.length; i++ ) {
+ this[i] = this.array[i];
+ }
+ this.reverse = Array.prototype.reverse;
+ this.getClass = Object.prototype.toString;
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.4.4-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.4.4-2.js
new file mode 100644
index 0000000..1d0d850
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.4.4-2.js
@@ -0,0 +1,163 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.4.4.3-1.js
+ ECMA Section: 15.4.4.3-1 Array.prototype.reverse()
+ Description:
+
+ The elements of the array are rearranged so as to reverse their order.
+ This object is returned as the result of the call.
+
+ 1. Call the [[Get]] method of this object with argument "length".
+ 2. Call ToUint32(Result(1)).
+ 3. Compute floor(Result(2)/2).
+ 4. Let k be 0.
+ 5. If k equals Result(3), return this object.
+ 6. Compute Result(2)k1.
+ 7. Call ToString(k).
+ 8. ToString(Result(6)).
+ 9. Call the [[Get]] method of this object with argument Result(7).
+ 10. Call the [[Get]] method of this object with argument Result(8).
+ 11. If this object has a property named by Result(8), go to step 12; but
+ if this object has no property named by Result(8), then go to either
+ step 12 or step 14, depending on the implementation.
+ 12. Call the [[Put]] method of this object with arguments Result(7) and
+ Result(10).
+ 13. Go to step 15.
+ 14. Call the [[Delete]] method on this object, providing Result(7) as the
+ name of the property to delete.
+ 15. If this object has a property named by Result(7), go to step 16; but if
+ this object has no property named by Result(7), then go to either step 16
+ or step 18, depending on the implementation.
+ 16. Call the [[Put]] method of this object with arguments Result(8) and
+ Result(9).
+ 17. Go to step 19.
+ 18. Call the [[Delete]] method on this object, providing Result(8) as the
+ name of the property to delete.
+ 19. Increase k by 1.
+ 20. Go to step 5.
+
+Note that the reverse function is intentionally generic; it does not require
+that its this value be an Array object. Therefore it can be transferred to other
+kinds of objects for use as a method. Whether the reverse function can be applied
+successfully to a host object is implementation dependent.
+
+ Note: Array.prototype.reverse allows some flexibility in implementation
+ regarding array indices that have not been populated. This test covers the
+ cases in which unpopulated indices are not deleted, since the JavaScript
+ implementation does not delete uninitialzed indices.
+
+ Author: christine@netscape.com
+ Date: 7 october 1997
+*/
+
+ var SECTION = "15.4.4.4-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var testcases = new Array();
+
+ writeHeaderToLog( SECTION + " Array.prototype.reverse()");
+
+ getTestCases();
+ test();
+
+function getTestCases() {
+ var ARR_PROTOTYPE = Array.prototype;
+
+ testcases[testcases.length] = new TestCase( SECTION, "Array.prototype.reverse.length", 0, Array.prototype.reverse.length );
+ testcases[testcases.length] = new TestCase( SECTION, "delete Array.prototype.reverse.length", false, delete Array.prototype.reverse.length );
+ testcases[testcases.length] = new TestCase( SECTION, "delete Array.prototype.reverse.length; Array.prototype.reverse.length", 0, eval("delete Array.prototype.reverse.length; Array.prototype.reverse.length") );
+
+ // length of array is 0
+ testcases[testcases.length] = new TestCase( SECTION,
+ "var A = new Array(); A.reverse(); A.length",
+ 0,
+ eval("var A = new Array(); A.reverse(); A.length") );
+ return ( testcases );
+}
+function CheckItems( R, A ) {
+ for ( var i = 0; i < R.length; i++ ) {
+ testcases[testcases.length] = new TestCase(
+ SECTION,
+ "A["+i+ "]",
+ R[i],
+ A[i] );
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function Object_1( value ) {
+ this.array = value.split(",");
+ this.length = this.array.length;
+ for ( var i = 0; i < this.length; i++ ) {
+ this[i] = eval(this.array[i]);
+ }
+ this.join = Array.prototype.reverse;
+ this.getClass = Object.prototype.toString;
+}
+function Reverse( array ) {
+ var r2 = array.length;
+ var k = 0;
+ var r3 = Math.floor( r2/2 );
+ if ( r3 == k ) {
+ return array;
+ }
+
+ for ( k = 0; k < r3; k++ ) {
+ var r6 = r2 - k - 1;
+// var r7 = String( k );
+ var r7 = k;
+ var r8 = String( r6 );
+
+ var r9 = array[r7];
+ var r10 = array[r8];
+
+ array[r7] = r10;
+ array[r8] = r9;
+ }
+
+ return array;
+}
+function Iterate( array ) {
+ for ( var i = 0; i < array.length; i++ ) {
+// print( i+": "+ array[String(i)] );
+ }
+}
+
+function Object_1( value ) {
+ this.array = value.split(",");
+ this.length = this.array.length;
+ for ( var i = 0; i < this.length; i++ ) {
+ this[i] = this.array[i];
+ }
+ this.reverse = Array.prototype.reverse;
+ this.getClass = Object.prototype.toString;
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.4.5-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.4.5-1.js
new file mode 100644
index 0000000..0a759c3
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.4.5-1.js
@@ -0,0 +1,223 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.4.4.5.js
+ ECMA Section: Array.prototype.sort(comparefn)
+ Description:
+
+ This test file tests cases in which the compare function is not supplied.
+
+ The elements of this array are sorted. The sort is not necessarily stable.
+ If comparefn is provided, it should be a function that accepts two arguments
+ x and y and returns a negative value if x < y, zero if x = y, or a positive
+ value if x > y.
+
+ 1. Call the [[Get]] method of this object with argument "length".
+ 2. Call ToUint32(Result(1)).
+ 1. Perform an implementation-dependent sequence of calls to the
+ [[Get]] , [[Put]], and [[Delete]] methods of this object and
+ toSortCompare (described below), where the first argument for each call
+ to [[Get]], [[Put]] , or [[Delete]] is a nonnegative integer less
+ than Result(2) and where the arguments for calls to SortCompare are
+ results of previous calls to the [[Get]] method. After this sequence
+ is complete, this object must have the following two properties.
+ (1) There must be some mathematical permutation of the nonnegative
+ integers less than Result(2), such that for every nonnegative integer
+ j less than Result(2), if property old[j] existed, then new[(j)] is
+ exactly the same value as old[j],. but if property old[j] did not exist,
+ then new[(j)] either does not exist or exists with value undefined.
+ (2) If comparefn is not supplied or is a consistent comparison
+ function for the elements of this array, then for all nonnegative
+ integers j and k, each less than Result(2), if old[j] compares less
+ than old[k] (see SortCompare below), then (j) < (k). Here we use the
+ notation old[j] to refer to the hypothetical result of calling the [
+ [Get]] method of this object with argument j before this step is
+ executed, and the notation new[j] to refer to the hypothetical result
+ of calling the [[Get]] method of this object with argument j after this
+ step has been completely executed. A function is a consistent
+ comparison function for a set of values if (a) for any two of those
+ values (possibly the same value) considered as an ordered pair, it
+ always returns the same value when given that pair of values as its
+ two arguments, and the result of applying ToNumber to this value is
+ not NaN; (b) when considered as a relation, where the pair (x, y) is
+ considered to be in the relation if and only if applying the function
+ to x and y and then applying ToNumber to the result produces a
+ negative value, this relation is a partial order; and (c) when
+ considered as a different relation, where the pair (x, y) is considered
+ to be in the relation if and only if applying the function to x and y
+ and then applying ToNumber to the result produces a zero value (of either
+ sign), this relation is an equivalence relation. In this context, the
+ phrase "x compares less than y" means applying Result(2) to x and y and
+ then applying ToNumber to the result produces a negative value.
+ 3.Return this object.
+
+ When the SortCompare operator is called with two arguments x and y, the following steps are taken:
+ 1.If x and y are both undefined, return +0.
+ 2.If x is undefined, return 1.
+ 3.If y is undefined, return 1.
+ 4.If the argument comparefn was not provided in the call to sort, go to step 7.
+ 5.Call comparefn with arguments x and y.
+ 6.Return Result(5).
+ 7.Call ToString(x).
+ 8.Call ToString(y).
+ 9.If Result(7) < Result(8), return 1.
+ 10.If Result(7) > Result(8), return 1.
+ 11.Return +0.
+
+Note that, because undefined always compared greater than any other value, undefined and nonexistent
+property values always sort to the end of the result. It is implementation-dependent whether or not such
+properties will exist or not at the end of the array when the sort is concluded.
+
+Note that the sort function is intentionally generic; it does not require that its this value be an Array object.
+Therefore it can be transferred to other kinds of objects for use as a method. Whether the sort function can be
+applied successfully to a host object is implementation dependent .
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+
+ var SECTION = "15.4.4.5-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Array.prototype.sort(comparefn)";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+ getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCases() {
+ var S = new Array();
+ var item = 0;
+
+ // array is empty.
+ S[item++] = "var A = new Array()";
+
+ // array contains one item
+ S[item++] = "var A = new Array( true )";
+
+ // length of array is 2
+ S[item++] = "var A = new Array( true, false, new Boolean(true), new Boolean(false), 'true', 'false' )";
+
+ S[item++] = "var A = new Array(); A[3] = 'undefined'; A[6] = null; A[8] = 'null'; A[0] = void 0";
+
+ S[item] = "var A = new Array( ";
+
+ var limit = 0x0061;
+ for ( var i = 0x007A; i >= limit; i-- ) {
+ S[item] += "\'"+ String.fromCharCode(i) +"\'" ;
+ if ( i > limit ) {
+ S[item] += ",";
+ }
+ }
+
+ S[item] += ")";
+
+ item++;
+
+ for ( var i = 0; i < S.length; i++ ) {
+ CheckItems( S[i] );
+ }
+}
+function CheckItems( S ) {
+ eval( S );
+ var E = Sort( A );
+
+ testcases[testcases.length] = new TestCase( SECTION,
+ S +"; A.sort(); A.length",
+ E.length,
+ eval( S + "; A.sort(); A.length") );
+
+ for ( var i = 0; i < E.length; i++ ) {
+ testcases[testcases.length] = new TestCase(
+ SECTION,
+ "A["+i+ "].toString()",
+ E[i] +"",
+ A[i] +"");
+
+ if ( A[i] == void 0 && typeof A[i] == "undefined" ) {
+ testcases[testcases.length] = new TestCase(
+ SECTION,
+ "typeof A["+i+ "]",
+ typeof E[i],
+ typeof A[i] );
+ }
+ }
+}
+function Object_1( value ) {
+ this.array = value.split(",");
+ this.length = this.array.length;
+ for ( var i = 0; i < this.length; i++ ) {
+ this[i] = eval(this.array[i]);
+ }
+ this.sort = Array.prototype.sort;
+ this.getClass = Object.prototype.toString;
+}
+function Sort( a ) {
+ for ( i = 0; i < a.length; i++ ) {
+ for ( j = i+1; j < a.length; j++ ) {
+ var lo = a[i];
+ var hi = a[j];
+ var c = Compare( lo, hi );
+ if ( c == 1 ) {
+ a[i] = hi;
+ a[j] = lo;
+ }
+ }
+ }
+ return a;
+}
+function Compare( x, y ) {
+ if ( x == void 0 && y == void 0 && typeof x == "undefined" && typeof y == "undefined" ) {
+ return +0;
+ }
+ if ( x == void 0 && typeof x == "undefined" ) {
+ return 1;
+ }
+ if ( y == void 0 && typeof y == "undefined" ) {
+ return -1;
+ }
+ x = String(x);
+ y = String(y);
+ if ( x < y ) {
+ return -1;
+ }
+ if ( x > y ) {
+ return 1;
+ }
+ return 0;
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.4.5-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.4.5-2.js
new file mode 100644
index 0000000..23e1eac
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.4.5-2.js
@@ -0,0 +1,224 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.4.4.5-2.js
+ ECMA Section: Array.prototype.sort(comparefn)
+ Description:
+
+ This test file tests cases in which the compare function is supplied.
+ In this cases, the sort creates a reverse sort.
+
+ The elements of this array are sorted. The sort is not necessarily stable.
+ If comparefn is provided, it should be a function that accepts two arguments
+ x and y and returns a negative value if x < y, zero if x = y, or a positive
+ value if x > y.
+
+ 1. Call the [[Get]] method of this object with argument "length".
+ 2. Call ToUint32(Result(1)).
+ 1. Perform an implementation-dependent sequence of calls to the
+ [[Get]] , [[Put]], and [[Delete]] methods of this object and
+ toSortCompare (described below), where the first argument for each call
+ to [[Get]], [[Put]] , or [[Delete]] is a nonnegative integer less
+ than Result(2) and where the arguments for calls to SortCompare are
+ results of previous calls to the [[Get]] method. After this sequence
+ is complete, this object must have the following two properties.
+ (1) There must be some mathematical permutation of the nonnegative
+ integers less than Result(2), such that for every nonnegative integer
+ j less than Result(2), if property old[j] existed, then new[(j)] is
+ exactly the same value as old[j],. but if property old[j] did not exist,
+ then new[(j)] either does not exist or exists with value undefined.
+ (2) If comparefn is not supplied or is a consistent comparison
+ function for the elements of this array, then for all nonnegative
+ integers j and k, each less than Result(2), if old[j] compares less
+ than old[k] (see SortCompare below), then (j) < (k). Here we use the
+ notation old[j] to refer to the hypothetical result of calling the [
+ [Get]] method of this object with argument j before this step is
+ executed, and the notation new[j] to refer to the hypothetical result
+ of calling the [[Get]] method of this object with argument j after this
+ step has been completely executed. A function is a consistent
+ comparison function for a set of values if (a) for any two of those
+ values (possibly the same value) considered as an ordered pair, it
+ always returns the same value when given that pair of values as its
+ two arguments, and the result of applying ToNumber to this value is
+ not NaN; (b) when considered as a relation, where the pair (x, y) is
+ considered to be in the relation if and only if applying the function
+ to x and y and then applying ToNumber to the result produces a
+ negative value, this relation is a partial order; and (c) when
+ considered as a different relation, where the pair (x, y) is considered
+ to be in the relation if and only if applying the function to x and y
+ and then applying ToNumber to the result produces a zero value (of either
+ sign), this relation is an equivalence relation. In this context, the
+ phrase "x compares less than y" means applying Result(2) to x and y and
+ then applying ToNumber to the result produces a negative value.
+ 3.Return this object.
+
+ When the SortCompare operator is called with two arguments x and y, the following steps are taken:
+ 1.If x and y are both undefined, return +0.
+ 2.If x is undefined, return 1.
+ 3.If y is undefined, return 1.
+ 4.If the argument comparefn was not provided in the call to sort, go to step 7.
+ 5.Call comparefn with arguments x and y.
+ 6.Return Result(5).
+ 7.Call ToString(x).
+ 8.Call ToString(y).
+ 9.If Result(7) < Result(8), return 1.
+ 10.If Result(7) > Result(8), return 1.
+ 11.Return +0.
+
+Note that, because undefined always compared greater than any other value, undefined and nonexistent
+property values always sort to the end of the result. It is implementation-dependent whether or not such
+properties will exist or not at the end of the array when the sort is concluded.
+
+Note that the sort function is intentionally generic; it does not require that its this value be an Array object.
+Therefore it can be transferred to other kinds of objects for use as a method. Whether the sort function can be
+applied successfully to a host object is implementation dependent .
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+
+ var SECTION = "15.4.4.5-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Array.prototype.sort(comparefn)";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+ getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCases() {
+ var S = new Array();
+ var item = 0;
+
+ // array is empty.
+ S[item++] = "var A = new Array()";
+
+ // array contains one item
+ S[item++] = "var A = new Array( true )";
+
+ // length of array is 2
+ S[item++] = "var A = new Array( true, false, new Boolean(true), new Boolean(false), 'true', 'false' )";
+
+ S[item++] = "var A = new Array(); A[3] = 'undefined'; A[6] = null; A[8] = 'null'; A[0] = void 0";
+
+ S[item] = "var A = new Array( ";
+
+ var limit = 0x0061;
+ for ( var i = 0x007A; i >= limit; i-- ) {
+ S[item] += "\'"+ String.fromCharCode(i) +"\'" ;
+ if ( i > limit ) {
+ S[item] += ",";
+ }
+ }
+
+ S[item] += ")";
+
+ for ( var i = 0; i < S.length; i++ ) {
+ CheckItems( S[i] );
+ }
+
+}
+function CheckItems( S ) {
+ eval( S );
+ var E = Sort( A );
+
+ testcases[testcases.length] = new TestCase( SECTION,
+ S +"; A.sort(Compare); A.length",
+ E.length,
+ eval( S + "; A.sort(Compare); A.length") );
+
+ for ( var i = 0; i < E.length; i++ ) {
+ testcases[testcases.length] = new TestCase(
+ SECTION,
+ "A["+i+ "].toString()",
+ E[i] +"",
+ A[i] +"");
+
+ if ( A[i] == void 0 && typeof A[i] == "undefined" ) {
+ testcases[testcases.length] = new TestCase(
+ SECTION,
+ "typeof A["+i+ "]",
+ typeof E[i],
+ typeof A[i] );
+ }
+ }
+}
+function Object_1( value ) {
+ this.array = value.split(",");
+ this.length = this.array.length;
+ for ( var i = 0; i < this.length; i++ ) {
+ this[i] = eval(this.array[i]);
+ }
+ this.sort = Array.prototype.sort;
+ this.getClass = Object.prototype.toString;
+}
+function Sort( a ) {
+ var r1 = a.length;
+ for ( i = 0; i < a.length; i++ ) {
+ for ( j = i+1; j < a.length; j++ ) {
+ var lo = a[i];
+ var hi = a[j];
+ var c = Compare( lo, hi );
+ if ( c == 1 ) {
+ a[i] = hi;
+ a[j] = lo;
+ }
+ }
+ }
+ return a;
+}
+function Compare( x, y ) {
+ if ( x == void 0 && y == void 0 && typeof x == "undefined" && typeof y == "undefined" ) {
+ return +0;
+ }
+ if ( x == void 0 && typeof x == "undefined" ) {
+ return 1;
+ }
+ if ( y == void 0 && typeof y == "undefined" ) {
+ return -1;
+ }
+ x = String(x);
+ y = String(y);
+ if ( x < y ) {
+ return 1;
+ }
+ if ( x > y ) {
+ return -1;
+ }
+ return 0;
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.4.5-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.4.5-3.js
new file mode 100644
index 0000000..47bbe5d
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.4.5-3.js
@@ -0,0 +1,181 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.4.4.5-3.js
+ ECMA Section: Array.prototype.sort(comparefn)
+ Description:
+
+ This is a regression test for
+ http://scopus/bugsplat/show_bug.cgi?id=117144
+
+ Verify that sort is successfull, even if the sort compare function returns
+ a very large negative or positive value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+
+ var SECTION = "15.4.4.5-3";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Array.prototype.sort(comparefn)";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+ getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
+function getTestCases() {
+ var array = new Array();
+
+ array[array.length] = new Date( TIME_2000 * Math.PI );
+ array[array.length] = new Date( TIME_2000 * 10 );
+ array[array.length] = new Date( TIME_1900 + TIME_1900 );
+ array[array.length] = new Date(0);
+ array[array.length] = new Date( TIME_2000 );
+ array[array.length] = new Date( TIME_1900 + TIME_1900 +TIME_1900 );
+ array[array.length] = new Date( TIME_1900 * Math.PI );
+ array[array.length] = new Date( TIME_1900 * 10 );
+ array[array.length] = new Date( TIME_1900 );
+ array[array.length] = new Date( TIME_2000 + TIME_2000 );
+ array[array.length] = new Date( 1899, 0, 1 );
+ array[array.length] = new Date( 2000, 1, 29 );
+ array[array.length] = new Date( 2000, 0, 1 );
+ array[array.length] = new Date( 1999, 11, 31 );
+
+ var testarr1 = new Array()
+ clone( array, testarr1 );
+ testarr1.sort( comparefn1 );
+
+ var testarr2 = new Array()
+ clone( array, testarr2 );
+ testarr2.sort( comparefn2 );
+
+ testarr3 = new Array();
+ clone( array, testarr3 );
+ testarr3.sort( comparefn3 );
+
+ // when there's no sort function, sort sorts by the toString value of Date.
+
+ var testarr4 = new Array()
+ clone( array, testarr4 );
+ testarr4.sort();
+
+ var realarr = new Array();
+ clone( array, realarr );
+ realarr.sort( realsort );
+
+ var stringarr = new Array();
+ clone( array, stringarr );
+ stringarr.sort( stringsort );
+
+ for ( var i = 0, tc = 0; i < array.length; i++, tc++) {
+ testcases[tc] = new TestCase(
+ SECTION,
+ "testarr1["+i+"]",
+ realarr[i],
+ testarr1[i] );
+ }
+
+ for ( var i=0; i < array.length; i++, tc++) {
+ testcases[tc] = new TestCase(
+ SECTION,
+ "testarr2["+i+"]",
+ realarr[i],
+ testarr2[i] );
+ }
+
+ for ( var i=0; i < array.length; i++, tc++) {
+ testcases[tc] = new TestCase(
+ SECTION,
+ "testarr3["+i+"]",
+ realarr[i],
+ testarr3[i] );
+ }
+
+ for ( var i=0; i < array.length; i++, tc++) {
+ testcases[tc] = new TestCase(
+ SECTION,
+ "testarr4["+i+"]",
+ stringarr[i].toString(),
+ testarr4[i].toString() );
+ }
+
+}
+function comparefn1( x, y ) {
+ return x - y;
+}
+function comparefn2( x, y ) {
+ return x.valueOf() - y.valueOf();
+}
+function realsort( x, y ) {
+ return ( x.valueOf() == y.valueOf() ? 0 : ( x.valueOf() > y.valueOf() ? 1 : -1 ) );
+}
+function comparefn3( x, y ) {
+ return ( +x == +y ? 0 : ( x > y ? 1 : -1 ) );
+}
+function clone( source, target ) {
+ for (i = 0; i < source.length; i++ ) {
+ target[i] = source[i];
+ }
+}
+function stringsort( x, y ) {
+ for ( var i = 0; i < x.toString().length; i++ ) {
+ var d = (x.toString()).charCodeAt(i) - (y.toString()).charCodeAt(i);
+ if ( d > 0 ) {
+ return 1;
+ } else {
+ if ( d < 0 ) {
+ return -1;
+ } else {
+ continue;
+ }
+ }
+
+ var d = x.length - y.length;
+
+ if ( d > 0 ) {
+ return 1;
+ } else {
+ if ( d < 0 ) {
+ return -1;
+ }
+ }
+ }
+ return 0;
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.4.js b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.4.js
new file mode 100644
index 0000000..4197dfb
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.4.js
@@ -0,0 +1,77 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.4.4.js
+ ECMA Section: 15.4.4 Properties of the Array Prototype Object
+ Description: The value of the internal [[Prototype]] property of
+ the Array prototype object is the Object prototype
+ object.
+
+ Note that the Array prototype object is itself an
+ array; it has a length property (whose initial value
+ is (0) and the special [[Put]] method.
+
+ Author: christine@netscape.com
+ Date: 7 october 1997
+*/
+
+ var SECTION = "15.4.4";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Properties of the Array Prototype Object";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+// these testcases are ECMA_2
+// array[item++] = new TestCase( SECTION, "Array.prototype.__proto__", Object.prototype, Array.prototype.__proto__ );
+// array[item++] = new TestCase( SECTION, "Array.__proto__.valueOf == Object.__proto__.valueOf", true, (Array.__proto__.valueOf == Object.__proto__.valueOf) );
+
+ array[item++] = new TestCase( SECTION, "Array.prototype.length", 0, Array.prototype.length );
+
+// verify that prototype object is an Array object.
+ array[item++] = new TestCase( SECTION, "typeof Array.prototype", "object", typeof Array.prototype );
+
+ array[item++] = new TestCase( SECTION,
+ "Array.prototype.toString = Object.prototype.toString; Array.prototype.toString()",
+ "[object Array]",
+ eval("Array.prototype.toString = Object.prototype.toString; Array.prototype.toString()") );
+
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.5.1-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.5.1-1.js
new file mode 100644
index 0000000..e57408b
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.5.1-1.js
@@ -0,0 +1,172 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.4.5.1-1.js
+ ECMA Section: [[ Put]] (P, V)
+ Description:
+ Array objects use a variation of the [[Put]] method used for other native
+ ECMAScript objects (section 8.6.2.2).
+
+ Assume A is an Array object and P is a string.
+
+ When the [[Put]] method of A is called with property P and value V, the
+ following steps are taken:
+
+ 1. Call the [[CanPut]] method of A with name P.
+ 2. If Result(1) is false, return.
+ 3. If A doesn't have a property with name P, go to step 7.
+ 4. If P is "length", go to step 12.
+ 5. Set the value of property P of A to V.
+ 6. Go to step 8.
+ 7. Create a property with name P, set its value to V and give it empty
+ attributes.
+ 8. If P is not an array index, return.
+ 9. If A itself has a property (not an inherited property) named "length",
+ andToUint32(P) is less than the value of the length property of A, then
+ return.
+ 10. Change (or set) the value of the length property of A to ToUint32(P)+1.
+ 11. Return.
+ 12. Compute ToUint32(V).
+ 13. For every integer k that is less than the value of the length property
+ of A but not less than Result(12), if A itself has a property (not an
+ inherited property) named ToString(k), then delete that property.
+ 14. Set the value of property P of A to Result(12).
+ 15. Return.
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.4.5.1-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Array [[Put]] (P, V)";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+
+ var item = 0;
+
+ // P is "length"
+
+ array[item++] = new TestCase( SECTION,
+ "var A = new Array(); A.length = 1000; A.length",
+ 1000,
+ eval("var A = new Array(); A.length = 1000; A.length") );
+
+ // A has Property P, and P is not length or an array index
+ array[item++] = new TestCase( SECTION,
+ "var A = new Array(1000); A.name = 'name of this array'; A.name",
+ 'name of this array',
+ eval("var A = new Array(1000); A.name = 'name of this array'; A.name") );
+
+ array[item++] = new TestCase( SECTION,
+ "var A = new Array(1000); A.name = 'name of this array'; A.length",
+ 1000,
+ eval("var A = new Array(1000); A.name = 'name of this array'; A.length") );
+
+
+ // A has Property P, P is not length, P is an array index, and ToUint32(p) is less than the
+ // value of length
+
+ array[item++] = new TestCase( SECTION,
+ "var A = new Array(1000); A[123] = 'hola'; A[123]",
+ 'hola',
+ eval("var A = new Array(1000); A[123] = 'hola'; A[123]") );
+
+ array[item++] = new TestCase( SECTION,
+ "var A = new Array(1000); A[123] = 'hola'; A.length",
+ 1000,
+ eval("var A = new Array(1000); A[123] = 'hola'; A.length") );
+
+
+ for ( var i = 0X0020, TEST_STRING = "var A = new Array( " ; i < 0x00ff; i++ ) {
+ TEST_STRING += "\'\\"+ String.fromCharCode( i ) +"\'";
+ if ( i < 0x00FF - 1 ) {
+ TEST_STRING += ",";
+ } else {
+ TEST_STRING += ");"
+ }
+ }
+
+ var LENGTH = 0x00ff - 0x0020;
+
+ array[item++] = new TestCase( SECTION,
+ TEST_STRING +" A[150] = 'hello'; A[150]",
+ 'hello',
+ eval( TEST_STRING + " A[150] = 'hello'; A[150]" ) );
+
+ array[item++] = new TestCase( SECTION,
+ TEST_STRING +" A[150] = 'hello'; A[150]",
+ LENGTH,
+ eval( TEST_STRING + " A[150] = 'hello'; A.length" ) );
+
+ // A has Property P, P is not length, P is an array index, and ToUint32(p) is not less than the
+ // value of length
+
+ array[item++] = new TestCase( SECTION,
+ "var A = new Array(); A[123] = true; A.length",
+ 124,
+ eval("var A = new Array(); A[123] = true; A.length") );
+
+ array[item++] = new TestCase( SECTION,
+ "var A = new Array(0,1,2,3,4,5,6,7,8,9,10); A[15] ='15'; A.length",
+ 16,
+ eval("var A = new Array(0,1,2,3,4,5,6,7,8,9,10); A[15] ='15'; A.length") );
+
+ for ( var i = 0; i < A.length; i++, item++ ) {
+ array[item] = new TestCase( SECTION,
+ "var A = new Array(0,1,2,3,4,5,6,7,8,9,10); A[15] ='15'; A[" +i +"]",
+ (i <= 10) ? i : ( i == 15 ? '15' : void 0 ),
+ A[i] );
+ }
+ // P is not an array index, and P is not "length"
+
+ array[item++] = new TestCase( SECTION,
+ "var A = new Array(); A.join.length = 4; A.join.length",
+ 1,
+ eval("var A = new Array(); A.join.length = 4; A.join.length") );
+
+ array[item++] = new TestCase( SECTION,
+ "var A = new Array(); A.join.length = 4; A.length",
+ 0,
+ eval("var A = new Array(); A.join.length = 4; A.length") );
+
+ return array;
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.5.1-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.5.1-2.js
new file mode 100644
index 0000000..08b4721
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.5.1-2.js
@@ -0,0 +1,150 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.4.5.1-2.js
+ ECMA Section: [[ Put]] (P, V)
+ Description:
+ Array objects use a variation of the [[Put]] method used for other native
+ ECMAScript objects (section 8.6.2.2).
+
+ Assume A is an Array object and P is a string.
+
+ When the [[Put]] method of A is called with property P and value V, the
+ following steps are taken:
+
+ 1. Call the [[CanPut]] method of A with name P.
+ 2. If Result(1) is false, return.
+ 3. If A doesn't have a property with name P, go to step 7.
+ 4. If P is "length", go to step 12.
+ 5. Set the value of property P of A to V.
+ 6. Go to step 8.
+ 7. Create a property with name P, set its value to V and give it empty
+ attributes.
+ 8. If P is not an array index, return.
+ 9. If A itself has a property (not an inherited property) named "length",
+ andToUint32(P) is less than the value of the length property of A, then
+ return.
+ 10. Change (or set) the value of the length property of A to ToUint32(P)+1.
+ 11. Return.
+ 12. Compute ToUint32(V).
+ 13. For every integer k that is less than the value of the length property
+ of A but not less than Result(12), if A itself has a property (not an
+ inherited property) named ToString(k), then delete that property.
+ 14. Set the value of property P of A to Result(12).
+ 15. Return.
+
+
+ These are testcases from Waldemar, detailed in
+ http://scopus.mcom.com/bugsplat/show_bug.cgi?id=123552
+
+ Author: christine@netscape.com
+ Date: 15 June 1998
+*/
+
+ var SECTION = "15.4.5.1-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Array [[Put]] (P,V)";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var a = new Array();
+
+ AddCase( "3.00", "three" );
+ AddCase( "00010", "eight" );
+ AddCase( "37xyz", "thirty-five" );
+ AddCase("5000000000", 5)
+ AddCase( "-2", -3 );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "a[10]",
+ void 0,
+ a[10] );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "a[3]",
+ void 0,
+ a[3] );
+
+ a[4] = "four";
+
+ testcases[tc++] = new TestCase( SECTION,
+ "a[4] = \"four\"; a[4]",
+ "four",
+ a[4] );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "a[\"4\"]",
+ "four",
+ a["4"] );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "a[\"4.00\"]",
+ void 0,
+ a["4.00"] );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "a.length",
+ 5,
+ a.length );
+
+
+ a["5000000000"] = 5;
+
+ testcases[tc++] = new TestCase( SECTION,
+ "a[\"5000000000\"] = 5; a.length",
+ 5,
+ a.length );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "a[\"-2\"] = -3; a.length",
+ 5,
+ a.length );
+
+ test();
+
+function AddCase ( arg, value ) {
+
+ a[arg] = value;
+
+ testcases[tc++] = new TestCase( SECTION,
+ "a[\"" + arg + "\"] = "+ value +"; a.length",
+ 0,
+ a.length );
+}
+
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.5.2-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.5.2-1.js
new file mode 100644
index 0000000..069ae57
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.5.2-1.js
@@ -0,0 +1,93 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.4.5.2-1.js
+ ECMA Section: Array.length
+ Description:
+ 15.4.5.2 length
+ The length property of this Array object is always numerically greater
+ than the name of every property whose name is an array index.
+
+ The length property has the attributes { DontEnum, DontDelete }.
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.4.5.2-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Array.length";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION,
+ "var A = new Array(); A.length",
+ 0,
+ eval("var A = new Array(); A.length") );
+
+ array[item++] = new TestCase( SECTION,
+ "var A = new Array(); A[Math.pow(2,32)-2] = 'hi'; A.length",
+ Math.pow(2,32)-1,
+ eval("var A = new Array(); A[Math.pow(2,32)-2] = 'hi'; A.length") );
+
+ array[item++] = new TestCase( SECTION,
+ "var A = new Array(); A.length = 123; A.length",
+ 123,
+ eval("var A = new Array(); A.length = 123; A.length") );
+
+ array[item++] = new TestCase( SECTION,
+ "var A = new Array(); A.length = 123; var PROPS = ''; for ( var p in A ) { PROPS += ( p == 'length' ? p : ''); } PROPS",
+ "",
+ eval("var A = new Array(); A.length = 123; var PROPS = ''; for ( var p in A ) { PROPS += ( p == 'length' ? p : ''); } PROPS") );
+
+
+ array[item++] = new TestCase( SECTION,
+ "var A = new Array(); A.length = 123; delete A.length",
+ false ,
+ eval("var A = new Array(); A.length = 123; delete A.length") );
+
+ array[item++] = new TestCase( SECTION,
+ "var A = new Array(); A.length = 123; delete A.length; A.length",
+ 123,
+ eval("var A = new Array(); A.length = 123; delete A.length; A.length") );
+ return array;
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.5.2-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.5.2-2.js
new file mode 100644
index 0000000..9d65b2c
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.5.2-2.js
@@ -0,0 +1,123 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.4.5.2-2.js
+ ECMA Section: Array.length
+ Description:
+ 15.4.5.2 length
+ The length property of this Array object is always numerically greater
+ than the name of every property whose name is an array index.
+
+ The length property has the attributes { DontEnum, DontDelete }.
+
+ This test verifies that the Array.length property is not Read Only.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.4.5.2-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Array.length";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ addCase( new Array(), 0, Math.pow(2,14), Math.pow(2,14) );
+
+ addCase( new Array(), 0, 1, 1 );
+
+ addCase( new Array(Math.pow(2,12)), Math.pow(2,12), 0, 0 );
+ addCase( new Array(Math.pow(2,13)), Math.pow(2,13), Math.pow(2,12), Math.pow(2,12) );
+ addCase( new Array(Math.pow(2,12)), Math.pow(2,12), Math.pow(2,12), Math.pow(2,12) );
+ addCase( new Array(Math.pow(2,14)), Math.pow(2,14), Math.pow(2,12), Math.pow(2,12) )
+
+ // some tests where array is not empty
+ // array is populated with strings
+ for ( var arg = "", i = 0; i < Math.pow(2,12); i++ ) {
+ arg += String(i) + ( i != Math.pow(2,12)-1 ? "," : "" );
+
+ }
+// print(i +":"+arg);
+
+ var a = eval( "new Array("+arg+")" );
+
+ addCase( a, i, i, i );
+ addCase( a, i, Math.pow(2,12)+i+1, Math.pow(2,12)+i+1, true );
+ addCase( a, Math.pow(2,12)+5, 0, 0, true );
+
+ test();
+
+function addCase( object, old_len, set_len, new_len, checkitems ) {
+ object.length = set_len;
+
+ testcases[testcases.length] = new TestCase( SECTION,
+ "array = new Array("+ old_len+"); array.length = " + set_len +
+ "; array.length",
+ new_len,
+ object.length );
+
+ if ( checkitems ) {
+ // verify that items between old and newlen are all undefined
+ if ( new_len < old_len ) {
+ var passed = true;
+ for ( var i = new_len; i < old_len; i++ ) {
+ if ( object[i] != void 0 ) {
+ passed = false;
+ }
+ }
+ testcases[testcases.length] = new TestCase( SECTION,
+ "verify that array items have been deleted",
+ true,
+ passed );
+ }
+ if ( new_len > old_len ) {
+ var passed = true;
+ for ( var i = old_len; i < new_len; i++ ) {
+ if ( object[i] != void 0 ) {
+ passed = false;
+ }
+ }
+ testcases[testcases.length] = new TestCase( SECTION,
+ "verify that new items are undefined",
+ true,
+ passed );
+ }
+ }
+
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.1.js
new file mode 100644
index 0000000..762b06d
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.1.js
@@ -0,0 +1,96 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.6.1.js
+ ECMA Section: 15.6.1 The Boolean Function
+ 15.6.1.1 Boolean( value )
+ 15.6.1.2 Boolean ()
+ Description: Boolean( value ) should return a Boolean value
+ not a Boolean object) computed by
+ Boolean.toBooleanValue( value)
+
+ 15.6.1.2 Boolean() returns false
+
+ Author: christine@netscape.com
+ Date: 27 jun 1997
+
+
+ Data File Fields:
+ VALUE Argument passed to the Boolean function
+ TYPE typeof VALUE (not used, but helpful in understanding
+ the data file)
+ E_RETURN Expected return value of Boolean( VALUE )
+*/
+ var SECTION = "15.6.1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "The Boolean constructor called as a function: Boolean( value ) and Boolean()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "Boolean(1)", true, Boolean(1) );
+ array[item++] = new TestCase( SECTION, "Boolean(0)", false, Boolean(0) );
+ array[item++] = new TestCase( SECTION, "Boolean(-1)", true, Boolean(-1) );
+ array[item++] = new TestCase( SECTION, "Boolean('1')", true, Boolean("1") );
+ array[item++] = new TestCase( SECTION, "Boolean('0')", true, Boolean("0") );
+ array[item++] = new TestCase( SECTION, "Boolean('-1')", true, Boolean("-1") );
+ array[item++] = new TestCase( SECTION, "Boolean(true)", true, Boolean(true) );
+ array[item++] = new TestCase( SECTION, "Boolean(false)", false, Boolean(false) );
+
+ array[item++] = new TestCase( SECTION, "Boolean('true')", true, Boolean("true") );
+ array[item++] = new TestCase( SECTION, "Boolean('false')", true, Boolean("false") );
+ array[item++] = new TestCase( SECTION, "Boolean(null)", false, Boolean(null) );
+
+ array[item++] = new TestCase( SECTION, "Boolean(-Infinity)", true, Boolean(Number.NEGATIVE_INFINITY) );
+ array[item++] = new TestCase( SECTION, "Boolean(NaN)", false, Boolean(Number.NaN) );
+ array[item++] = new TestCase( SECTION, "Boolean(void(0))", false, Boolean( void(0) ) );
+ array[item++] = new TestCase( SECTION, "Boolean(x=0)", false, Boolean( x=0 ) );
+ array[item++] = new TestCase( SECTION, "Boolean(x=1)", true, Boolean( x=1 ) );
+ array[item++] = new TestCase( SECTION, "Boolean(x=false)", false, Boolean( x=false ) );
+ array[item++] = new TestCase( SECTION, "Boolean(x=true)", true, Boolean( x=true ) );
+ array[item++] = new TestCase( SECTION, "Boolean(x=null)", false, Boolean( x=null ) );
+ array[item++] = new TestCase( SECTION, "Boolean()", false, Boolean() );
+// array[item++] = new TestCase( SECTION, "Boolean(var someVar)", false, Boolean( someVar ) );
+
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.2.js
new file mode 100644
index 0000000..2d4e142
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.2.js
@@ -0,0 +1,160 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.6.2.js
+ ECMA Section: 15.6.2 The Boolean Constructor
+ 15.6.2.1 new Boolean( value )
+ 15.6.2.2 new Boolean()
+
+ This test verifies that the Boolean constructor
+ initializes a new object (typeof should return
+ "object"). The prototype of the new object should
+ be Boolean.prototype. The value of the object
+ should be ToBoolean( value ) (a boolean value).
+
+ Description:
+ Author: christine@netscape.com
+ Date: june 27, 1997
+
+*/
+ var SECTION = "15.6.2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "15.6.2 The Boolean Constructor; 15.6.2.1 new Boolean( value ); 15.6.2.2 new Boolean()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "typeof (new Boolean(1))", "object", typeof (new Boolean(1)) );
+ array[item++] = new TestCase( SECTION, "(new Boolean(1)).constructor", Boolean.prototype.constructor, (new Boolean(1)).constructor );
+ array[item++] = new TestCase( SECTION,
+ "TESTBOOL=new Boolean(1);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()",
+ "[object Boolean]",
+ eval("TESTBOOL=new Boolean(1);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") );
+ array[item++] = new TestCase( SECTION, "(new Boolean(1)).valueOf()", true, (new Boolean(1)).valueOf() );
+ array[item++] = new TestCase( SECTION, "typeof new Boolean(1)", "object", typeof new Boolean(1) );
+ array[item++] = new TestCase( SECTION, "(new Boolean(0)).constructor", Boolean.prototype.constructor, (new Boolean(0)).constructor );
+ array[item++] = new TestCase( SECTION,
+ "TESTBOOL=new Boolean(0);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()",
+ "[object Boolean]",
+ eval("TESTBOOL=new Boolean(0);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") );
+ array[item++] = new TestCase( SECTION, "(new Boolean(0)).valueOf()", false, (new Boolean(0)).valueOf() );
+ array[item++] = new TestCase( SECTION, "typeof new Boolean(0)", "object", typeof new Boolean(0) );
+ array[item++] = new TestCase( SECTION, "(new Boolean(-1)).constructor", Boolean.prototype.constructor, (new Boolean(-1)).constructor );
+ array[item++] = new TestCase( SECTION,
+ "TESTBOOL=new Boolean(-1);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()",
+ "[object Boolean]",
+ eval("TESTBOOL=new Boolean(-1);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") );
+ array[item++] = new TestCase( SECTION, "(new Boolean(-1)).valueOf()", true, (new Boolean(-1)).valueOf() );
+ array[item++] = new TestCase( SECTION, "typeof new Boolean(-1)", "object", typeof new Boolean(-1) );
+ array[item++] = new TestCase( SECTION, "(new Boolean('1')).constructor", Boolean.prototype.constructor, (new Boolean('1')).constructor );
+ array[item++] = new TestCase( SECTION,
+ "TESTBOOL=new Boolean('1');TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()",
+ "[object Boolean]",
+ eval("TESTBOOL=new Boolean('1');TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") );
+ array[item++] = new TestCase( SECTION, "(new Boolean('1')).valueOf()", true, (new Boolean('1')).valueOf() );
+ array[item++] = new TestCase( SECTION, "typeof new Boolean('1')", "object", typeof new Boolean('1') );
+ array[item++] = new TestCase( SECTION, "(new Boolean('0')).constructor", Boolean.prototype.constructor, (new Boolean('0')).constructor );
+ array[item++] = new TestCase( SECTION,
+ "TESTBOOL=new Boolean('0');TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()",
+ "[object Boolean]",
+ eval("TESTBOOL=new Boolean('0');TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") );
+ array[item++] = new TestCase( SECTION, "(new Boolean('0')).valueOf()", true, (new Boolean('0')).valueOf() );
+ array[item++] = new TestCase( SECTION, "typeof new Boolean('0')", "object", typeof new Boolean('0') );
+ array[item++] = new TestCase( SECTION, "(new Boolean('-1')).constructor", Boolean.prototype.constructor, (new Boolean('-1')).constructor );
+ array[item++] = new TestCase( SECTION,
+ "TESTBOOL=new Boolean('-1');TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()",
+ "[object Boolean]",
+ eval("TESTBOOL=new Boolean('-1');TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") );
+ array[item++] = new TestCase( SECTION, "(new Boolean('-1')).valueOf()", true, (new Boolean('-1')).valueOf() );
+ array[item++] = new TestCase( SECTION, "typeof new Boolean('-1')", "object", typeof new Boolean('-1') );
+ array[item++] = new TestCase( SECTION, "(new Boolean(new Boolean(true))).constructor", Boolean.prototype.constructor, (new Boolean(new Boolean(true))).constructor );
+ array[item++] = new TestCase( SECTION,
+ "TESTBOOL=new Boolean(new Boolean(true));TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()",
+ "[object Boolean]",
+ eval("TESTBOOL=new Boolean(new Boolean(true));TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") );
+ array[item++] = new TestCase( SECTION, "(new Boolean(new Boolean(true))).valueOf()", true, (new Boolean(new Boolean(true))).valueOf() );
+ array[item++] = new TestCase( SECTION, "typeof new Boolean(new Boolean(true))", "object", typeof new Boolean(new Boolean(true)) );
+ array[item++] = new TestCase( SECTION, "(new Boolean(Number.NaN)).constructor", Boolean.prototype.constructor, (new Boolean(Number.NaN)).constructor );
+ array[item++] = new TestCase( SECTION,
+ "TESTBOOL=new Boolean(Number.NaN);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()",
+ "[object Boolean]",
+ eval("TESTBOOL=new Boolean(Number.NaN);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") );
+ array[item++] = new TestCase( SECTION, "(new Boolean(Number.NaN)).valueOf()", false, (new Boolean(Number.NaN)).valueOf() );
+ array[item++] = new TestCase( SECTION, "typeof new Boolean(Number.NaN)", "object", typeof new Boolean(Number.NaN) );
+ array[item++] = new TestCase( SECTION, "(new Boolean(null)).constructor", Boolean.prototype.constructor, (new Boolean(null)).constructor );
+ array[item++] = new TestCase( SECTION,
+ "TESTBOOL=new Boolean(null);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()",
+ "[object Boolean]",
+ eval("TESTBOOL=new Boolean(null);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") );
+ array[item++] = new TestCase( SECTION, "(new Boolean(null)).valueOf()", false, (new Boolean(null)).valueOf() );
+ array[item++] = new TestCase( SECTION, "typeof new Boolean(null)", "object", typeof new Boolean(null) );
+ array[item++] = new TestCase( SECTION, "(new Boolean(void 0)).constructor", Boolean.prototype.constructor, (new Boolean(void 0)).constructor );
+ array[item++] = new TestCase( SECTION,
+ "TESTBOOL=new Boolean(void 0);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()",
+ "[object Boolean]",
+ eval("TESTBOOL=new Boolean(void 0);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") );
+ array[item++] = new TestCase( SECTION, "(new Boolean(void 0)).valueOf()", false, (new Boolean(void 0)).valueOf() );
+ array[item++] = new TestCase( SECTION, "typeof new Boolean(void 0)", "object", typeof new Boolean(void 0) );
+ array[item++] = new TestCase( SECTION, "(new Boolean(Number.POSITIVE_INFINITY)).constructor", Boolean.prototype.constructor, (new Boolean(Number.POSITIVE_INFINITY)).constructor );
+ array[item++] = new TestCase( SECTION,
+ "TESTBOOL=new Boolean(Number.POSITIVE_INFINITY);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()",
+ "[object Boolean]",
+ eval("TESTBOOL=new Boolean(Number.POSITIVE_INFINITY);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") );
+ array[item++] = new TestCase( SECTION, "(new Boolean(Number.POSITIVE_INFINITY)).valueOf()", true, (new Boolean(Number.POSITIVE_INFINITY)).valueOf() );
+ array[item++] = new TestCase( SECTION, "typeof new Boolean(Number.POSITIVE_INFINITY)", "object", typeof new Boolean(Number.POSITIVE_INFINITY) );
+ array[item++] = new TestCase( SECTION, "(new Boolean(Number.NEGATIVE_INFINITY)).constructor", Boolean.prototype.constructor, (new Boolean(Number.NEGATIVE_INFINITY)).constructor );
+ array[item++] = new TestCase( SECTION,
+ "TESTBOOL=new Boolean(Number.NEGATIVE_INFINITY);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()",
+ "[object Boolean]",
+ eval("TESTBOOL=new Boolean(Number.NEGATIVE_INFINITY);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") );
+ array[item++] = new TestCase( SECTION, "(new Boolean(Number.NEGATIVE_INFINITY)).valueOf()", true, (new Boolean(Number.NEGATIVE_INFINITY)).valueOf() );
+ array[item++] = new TestCase( SECTION, "typeof new Boolean(Number.NEGATIVE_INFINITY)", "object", typeof new Boolean(Number.NEGATIVE_INFINITY) );
+ array[item++] = new TestCase( SECTION, "(new Boolean(Number.NEGATIVE_INFINITY)).constructor", Boolean.prototype.constructor, (new Boolean(Number.NEGATIVE_INFINITY)).constructor );
+ array[item++] = new TestCase( "15.6.2.2",
+ "TESTBOOL=new Boolean();TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()",
+ "[object Boolean]",
+ eval("TESTBOOL=new Boolean();TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") );
+ array[item++] = new TestCase( "15.6.2.2", "(new Boolean()).valueOf()", false, (new Boolean()).valueOf() );
+ array[item++] = new TestCase( "15.6.2.2", "typeof new Boolean()", "object", typeof new Boolean() );
+
+ return ( array );
+}
+
+function test() {
+ for ( tc = 0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.3.1-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.3.1-1.js
new file mode 100644
index 0000000..c3897e4
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.3.1-1.js
@@ -0,0 +1,72 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.6.3.1-1.js
+ ECMA Section: 15.6.3 Boolean.prototype
+
+ Description: The initial value of Boolean.prototype is the built-in
+ Boolean prototype object (15.6.4).
+
+ The property shall have the attributes [DontEnum,
+ DontDelete, ReadOnly ].
+
+ This tests the DontEnum property of Boolean.prototype
+
+ Author: christine@netscape.com
+ Date: june 27, 1997
+
+*/
+ var SECTION = "15.6.3.1-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Boolean.prototype";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION,
+ "var str='';for ( p in Boolean ) { str += p } str;",
+ "",
+ eval("var str='';for ( p in Boolean ) { str += p } str;") );
+ return ( array );
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.3.1-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.3.1-2.js
new file mode 100644
index 0000000..0ff248a
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.3.1-2.js
@@ -0,0 +1,69 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.6.3.1-2.js
+ ECMA Section: 15.6.3.1 Boolean.prototype
+
+ Description: The initial valu eof Boolean.prototype is the built-in
+ Boolean prototype object (15.6.4).
+
+ The property shall have the attributes [DontEnum,
+ DontDelete, ReadOnly ].
+
+ This tests the DontDelete property of Boolean.prototype
+
+ Author: christine@netscape.com
+ Date: june 27, 1997
+
+*/
+ var SECTION = "15.6.3.1-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Boolean.prototype"
+ writeHeaderToLog( SECTION + TITLE );
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION,
+ "delete( Boolean.prototype)",
+ false,
+ delete( Boolean.prototype) );
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.3.1-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.3.1-3.js
new file mode 100644
index 0000000..5ba5c95
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.3.1-3.js
@@ -0,0 +1,69 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.6.3.1-3.js
+ ECMA Section: 15.6.3.1 Boolean.prototype
+
+ Description: The initial valu eof Boolean.prototype is the built-in
+ Boolean prototype object (15.6.4).
+
+ The property shall have the attributes [DontEnum,
+ DontDelete, ReadOnly ].
+
+ This tests the DontDelete property of Boolean.prototype
+
+ Author: christine@netscape.com
+ Date: june 27, 1997
+
+*/
+ var SECTION = "15.6.3.1-3";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Boolean.prototype"
+ writeHeaderToLog( SECTION + TITLE );
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION,
+ "delete( Boolean.prototype); Boolean.prototype",
+ Boolean.prototype,
+ eval("delete( Boolean.prototype); Boolean.prototype") );
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.3.1-4.js b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.3.1-4.js
new file mode 100644
index 0000000..56972e8
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.3.1-4.js
@@ -0,0 +1,79 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.6.3.1-4.js
+ ECMA Section: 15.6.3.1 Properties of the Boolean Prototype Object
+
+ Description: The initial value of Boolean.prototype is the built-in
+ Boolean prototype object (15.6.4).
+
+ The property shall have the attributes [DontEnum,
+ DontDelete, ReadOnly ].
+
+ This tests the ReadOnly property of Boolean.prototype
+
+ Author: christine@netscape.com
+ Date: 30 september 1997
+
+*/
+ var SECTION = "15.6.3.1-4";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Boolean.prototype"
+ writeHeaderToLog( SECTION + TITLE );
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ var BOOL_PROTO = Boolean.prototype;
+
+ array[item++] = new TestCase( SECTION,
+ "var BOOL_PROTO = Boolean.prototype; Boolean.prototype=null; Boolean.prototype == BOOL_PROTO",
+ true,
+ eval("var BOOL_PROTO = Boolean.prototype; Boolean.prototype=null; Boolean.prototype == BOOL_PROTO") );
+
+ array[item++] = new TestCase( SECTION,
+ "var BOOL_PROTO = Boolean.prototype; Boolean.prototype=null; Boolean.prototype == null",
+ false,
+ eval("var BOOL_PROTO = Boolean.prototype; Boolean.prototype=null; Boolean.prototype == null") );
+
+ return ( array );
+}
+
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.3.1-5.js b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.3.1-5.js
new file mode 100644
index 0000000..fb3605c
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.3.1-5.js
@@ -0,0 +1,61 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.6.3.1-5.js
+ ECMA Section: 15.6.3.1 Boolean.prototype
+ Description:
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+ var VERSION = "ECMA_2";
+ startTest();
+ var SECTION = "15.6.3.1-5";
+ var TITLE = "Boolean.prototype"
+
+ writeHeaderToLog( SECTION + " " + TITLE );
+ var tc= 0;
+ var testcases = getTestCases();
+
+// all tests must call a function that returns an array of TestCase objects.
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION, "Function.prototype == Boolean.__proto__", true, Function.prototype == Boolean.__proto__ );
+
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.3.1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.3.1.js
new file mode 100644
index 0000000..55614f5
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.3.1.js
@@ -0,0 +1,72 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.6.3.1.js
+ ECMA Section: 15.6.3.1 Boolean.prototype
+
+ Description: The initial valu eof Boolean.prototype is the built-in
+ Boolean prototype object (15.6.4).
+
+ The property shall have the attributes [DontEnum,
+ DontDelete, ReadOnly ].
+
+ It has the internal [[Call]] and [[Construct]]
+ properties (not tested), and the length property.
+
+ Author: christine@netscape.com
+ Date: june 27, 1997
+
+*/
+
+ var SECTION = "15.6.3.1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Boolean.prototype";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "Boolean.prototype.valueOf()", false, Boolean.prototype.valueOf() );
+ array[item++] = new TestCase( SECTION, "Boolean.length", 1, Boolean.length );
+
+ return ( array );
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.3.js
new file mode 100644
index 0000000..0e9a252
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.3.js
@@ -0,0 +1,67 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.6.3.js
+ ECMA Section: 15.6.3 Properties of the Boolean Constructor
+
+ Description: The value of the internal prototype property is
+ the Function prototype object.
+
+ It has the internal [[Call]] and [[Construct]]
+ properties, and the length property.
+
+ Author: christine@netscape.com
+ Date: june 27, 1997
+
+*/
+ var SECTION = "15.6.3";
+ var VERSION = "ECMA_2";
+ startTest();
+ var TITLE = "Properties of the Boolean Constructor"
+ writeHeaderToLog( SECTION + TITLE );
+
+ var testcases = getTestCases();
+
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "Boolean.__proto__ == Function.prototype", true, Boolean.__proto__ == Function.prototype );
+ array[item++] = new TestCase( SECTION, "Boolean.length", 1, Boolean.length );
+
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4-1.js
new file mode 100644
index 0000000..e40d71a
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4-1.js
@@ -0,0 +1,73 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.6.4-1.js
+ ECMA Section: 15.6.4 Properties of the Boolean Prototype Object
+
+ Description:
+ The Boolean prototype object is itself a Boolean object (its [[Class]] is
+ "Boolean") whose value is false.
+
+ The value of the internal [[Prototype]] property of the Boolean prototype object
+ is the Object prototype object (15.2.3.1).
+
+ Author: christine@netscape.com
+ Date: 30 september 1997
+
+*/
+
+
+ var VERSION = "ECMA_1"
+ startTest();
+ var SECTION = "15.6.4-1";
+
+ writeHeaderToLog( SECTION + " Properties of the Boolean Prototype Object");
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "typeof Boolean.prototype == typeof( new Boolean )", true, typeof Boolean.prototype == typeof( new Boolean ) );
+ array[item++] = new TestCase( SECTION, "typeof( Boolean.prototype )", "object", typeof(Boolean.prototype) );
+ array[item++] = new TestCase( SECTION,
+ "Boolean.prototype.toString = Object.prototype.toString; Boolean.prototype.toString()",
+ "[object Boolean]",
+ eval("Boolean.prototype.toString = Object.prototype.toString; Boolean.prototype.toString()") );
+ array[item++] = new TestCase( SECTION, "Boolean.prototype.valueOf()", false, Boolean.prototype.valueOf() );
+
+ return ( array );
+}
+
+function test() {
+ for (tc = 0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4-2.js
new file mode 100644
index 0000000..760272e
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4-2.js
@@ -0,0 +1,67 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.6.4-2.js
+ ECMA Section: 15.6.4 Properties of the Boolean Prototype Object
+
+ Description:
+ The Boolean prototype object is itself a Boolean object (its [[Class]] is
+ "Boolean") whose value is false.
+
+ The value of the internal [[Prototype]] property of the Boolean prototype object
+ is the Object prototype object (15.2.3.1).
+
+ Author: christine@netscape.com
+ Date: 30 september 1997
+
+*/
+
+
+ var VERSION = "ECMA_2"
+ startTest();
+ var SECTION = "15.6.4-2";
+
+ writeHeaderToLog( SECTION + " Properties of the Boolean Prototype Object");
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "Boolean.prototype.__proto__", Object.prototype, Boolean.prototype.__proto__ );
+
+ return ( array );
+}
+
+function test() {
+ for (tc = 0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.1.js
new file mode 100644
index 0000000..848b1f4
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.1.js
@@ -0,0 +1,65 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.6.4.1.js
+ ECMA Section: 15.6.4.1 Boolean.prototype.constructor
+
+ Description: The initial value of Boolean.prototype.constructor
+ is the built-in Boolean constructor.
+
+ Author: christine@netscape.com
+ Date: 30 september 1997
+
+*/
+ var SECTION = "15.6.4.1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Boolean.prototype.constructor"
+ writeHeaderToLog( SECTION + TITLE );
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION,
+ "( Boolean.prototype.constructor == Boolean )",
+ true ,
+ (Boolean.prototype.constructor == Boolean) );
+
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.2-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.2-1.js
new file mode 100644
index 0000000..85514fd
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.2-1.js
@@ -0,0 +1,97 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.6.4.2.js
+ ECMA Section: 15.6.4.2-1 Boolean.prototype.toString()
+ Description: If this boolean value is true, then the string "true"
+ is returned; otherwise this boolean value must be false,
+ and the string "false" is returned.
+
+ The toString function is not generic; it generates
+ a runtime error if its this value is not a Boolean
+ object. Therefore it cannot be transferred to other
+ kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: june 27, 1997
+*/
+
+ var SECTION = "15.6.4.2-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Boolean.prototype.toString()"
+ writeHeaderToLog( SECTION + TITLE );
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "new Boolean(1)", "true", (new Boolean(1)).toString() );
+ array[item++] = new TestCase( SECTION, "new Boolean(0)", "false", (new Boolean(0)).toString() );
+ array[item++] = new TestCase( SECTION, "new Boolean(-1)", "true", (new Boolean(-1)).toString() );
+ array[item++] = new TestCase( SECTION, "new Boolean('1')", "true", (new Boolean("1")).toString() );
+ array[item++] = new TestCase( SECTION, "new Boolean('0')", "true", (new Boolean("0")).toString() );
+ array[item++] = new TestCase( SECTION, "new Boolean(true)", "true", (new Boolean(true)).toString() );
+ array[item++] = new TestCase( SECTION, "new Boolean(false)", "false", (new Boolean(false)).toString() );
+ array[item++] = new TestCase( SECTION, "new Boolean('true')", "true", (new Boolean('true')).toString() );
+ array[item++] = new TestCase( SECTION, "new Boolean('false')", "true", (new Boolean('false')).toString() );
+
+ array[item++] = new TestCase( SECTION, "new Boolean('')", "false", (new Boolean('')).toString() );
+ array[item++] = new TestCase( SECTION, "new Boolean(null)", "false", (new Boolean(null)).toString() );
+ array[item++] = new TestCase( SECTION, "new Boolean(void(0))", "false", (new Boolean(void(0))).toString() );
+ array[item++] = new TestCase( SECTION, "new Boolean(-Infinity)", "true", (new Boolean(Number.NEGATIVE_INFINITY)).toString() );
+ array[item++] = new TestCase( SECTION, "new Boolean(NaN)", "false", (new Boolean(Number.NaN)).toString() );
+ array[item++] = new TestCase( SECTION, "new Boolean()", "false", (new Boolean()).toString() );
+ array[item++] = new TestCase( SECTION, "new Boolean(x=1)", "true", (new Boolean(x=1)).toString() );
+ array[item++] = new TestCase( SECTION, "new Boolean(x=0)", "false", (new Boolean(x=0)).toString() );
+ array[item++] = new TestCase( SECTION, "new Boolean(x=false)", "false", (new Boolean(x=false)).toString() );
+ array[item++] = new TestCase( SECTION, "new Boolean(x=true)", "true", (new Boolean(x=true)).toString() );
+ array[item++] = new TestCase( SECTION, "new Boolean(x=null)", "false", (new Boolean(x=null)).toString() );
+ array[item++] = new TestCase( SECTION, "new Boolean(x='')", "false", (new Boolean(x="")).toString() );
+ array[item++] = new TestCase( SECTION, "new Boolean(x=' ')", "true", (new Boolean(x=" ")).toString() );
+
+ array[item++] = new TestCase( SECTION, "new Boolean(new MyObject(true))", "true", (new Boolean(new MyObject(true))).toString() );
+ array[item++] = new TestCase( SECTION, "new Boolean(new MyObject(false))", "true", (new Boolean(new MyObject(false))).toString() );
+
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function MyObject( value ) {
+ this.value = value;
+ this.valueOf = new Function( "return this.value" );
+ return this;
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.2-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.2-2.js
new file mode 100644
index 0000000..d46c49b
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.2-2.js
@@ -0,0 +1,79 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.6.4.2-2.js
+ ECMA Section: 15.6.4.2 Boolean.prototype.toString()
+ Description: Returns this boolean value.
+
+ The toString function is not generic; it generates
+ a runtime error if its this value is not a Boolean
+ object. Therefore it cannot be transferred to other
+ kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: june 27, 1997
+*/
+
+ var SECTION = "15.6.4.2-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Boolean.prototype.toString()"
+ writeHeaderToLog( SECTION + TITLE );
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+
+ array[item++] = new TestCase( SECTION,
+ "tostr=Boolean.prototype.toString; x=new Boolean(); x.toString=tostr;x.toString()",
+ "false",
+ "tostr=Boolean.prototype.toString; x=new Boolean(); x.toString=tostr;x.toString()" );
+ array[item++] = new TestCase( SECTION,
+ "tostr=Boolean.prototype.toString; x=new Boolean(true); x.toString=tostr; x.toString()",
+ "true",
+ "tostr=Boolean.prototype.toString; x=new Boolean(true); x.toString=tostr; x.toString()" );
+ array[item++] = new TestCase( SECTION,
+ "tostr=Boolean.prototype.toString; x=new Boolean(false); x.toString=tostr;x.toString()",
+ "false",
+ "tostr=Boolean.prototype.toString; x=new Boolean(); x.toString=tostr;x.toString()" );
+ return ( array );
+
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.2-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.2-3.js
new file mode 100644
index 0000000..faf0a94
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.2-3.js
@@ -0,0 +1,67 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.6.4.2-3.js
+ ECMA Section: 15.6.4.2 Boolean.prototype.toString()
+ Description: Returns this boolean value.
+
+ The toString function is not generic; it generates
+ a runtime error if its this value is not a Boolean
+ object. Therefore it cannot be transferred to other
+ kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: june 27, 1997
+*/
+
+
+ var SECTION = "15.6.4.2-3";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Boolean.prototype.toString()"
+ writeHeaderToLog( SECTION + TITLE );
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "tostr=Boolean.prototype.toString; x=true; x.toString=tostr;x.toString()", "true", eval("tostr=Boolean.prototype.toString; x=true; x.toString=tostr;x.toString()") );
+ array[item++] = new TestCase( SECTION, "tostr=Boolean.prototype.toString; x=false; x.toString=tostr;x.toString()", "false", eval("tostr=Boolean.prototype.toString; x=false; x.toString=tostr;x.toString()") );
+
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.2-4-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.2-4-n.js
new file mode 100644
index 0000000..a86ba51
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.2-4-n.js
@@ -0,0 +1,70 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.6.4.2-4.js
+ ECMA Section: 15.6.4.2 Boolean.prototype.toString()
+ Description: Returns this boolean value.
+
+ The toString function is not generic; it generates
+ a runtime error if its this value is not a Boolean
+ object. Therefore it cannot be transferred to other
+ kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: june 27, 1997
+*/
+
+ var SECTION = "15.6.4.2-4-n";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Boolean.prototype.toString()";
+ writeHeaderToLog( SECTION +" "+ TITLE );
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION,
+ "tostr=Boolean.prototype.toString; x=new String( 'hello' ); x.toString=tostr; x.toString()",
+ "error",
+ "tostr=Boolean.prototype.toString; x=new String( 'hello' ); x.toString=tostr; x.toString()" );
+ return ( array );
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval(testcases[tc].actual);
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.3-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.3-1.js
new file mode 100644
index 0000000..3589197
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.3-1.js
@@ -0,0 +1,91 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.6.4.3.js
+ ECMA Section: 15.6.4.3 Boolean.prototype.valueOf()
+ Description: Returns this boolean value.
+
+ The valueOf function is not generic; it generates
+ a runtime error if its this value is not a Boolean
+ object. Therefore it cannot be transferred to other
+ kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: june 27, 1997
+*/
+
+ var SECTION = "15.6.4.3-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Boolean.prototype.valueOf()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "new Boolean(1)", true, (new Boolean(1)).valueOf() );
+
+ array[item++] = new TestCase( SECTION, "new Boolean(0)", false, (new Boolean(0)).valueOf() );
+ array[item++] = new TestCase( SECTION, "new Boolean(-1)", true, (new Boolean(-1)).valueOf() );
+ array[item++] = new TestCase( SECTION, "new Boolean('1')", true, (new Boolean("1")).valueOf() );
+ array[item++] = new TestCase( SECTION, "new Boolean('0')", true, (new Boolean("0")).valueOf() );
+ array[item++] = new TestCase( SECTION, "new Boolean(true)", true, (new Boolean(true)).valueOf() );
+ array[item++] = new TestCase( SECTION, "new Boolean(false)", false, (new Boolean(false)).valueOf() );
+ array[item++] = new TestCase( SECTION, "new Boolean('true')", true, (new Boolean("true")).valueOf() );
+ array[item++] = new TestCase( SECTION, "new Boolean('false')", true, (new Boolean('false')).valueOf() );
+
+ array[item++] = new TestCase( SECTION, "new Boolean('')", false, (new Boolean('')).valueOf() );
+ array[item++] = new TestCase( SECTION, "new Boolean(null)", false, (new Boolean(null)).valueOf() );
+ array[item++] = new TestCase( SECTION, "new Boolean(void(0))", false, (new Boolean(void(0))).valueOf() );
+ array[item++] = new TestCase( SECTION, "new Boolean(-Infinity)", true, (new Boolean(Number.NEGATIVE_INFINITY)).valueOf() );
+ array[item++] = new TestCase( SECTION, "new Boolean(NaN)", false, (new Boolean(Number.NaN)).valueOf() );
+ array[item++] = new TestCase( SECTION, "new Boolean()", false, (new Boolean()).valueOf() );
+
+ array[item++] = new TestCase( SECTION, "new Boolean(x=1)", true, (new Boolean(x=1)).valueOf() );
+ array[item++] = new TestCase( SECTION, "new Boolean(x=0)", false, (new Boolean(x=0)).valueOf() );
+ array[item++] = new TestCase( SECTION, "new Boolean(x=false)", false, (new Boolean(x=false)).valueOf() );
+ array[item++] = new TestCase( SECTION, "new Boolean(x=true)", true, (new Boolean(x=true)).valueOf() );
+ array[item++] = new TestCase( SECTION, "new Boolean(x=null)", false, (new Boolean(x=null)).valueOf() );
+ array[item++] = new TestCase( SECTION, "new Boolean(x='')", false, (new Boolean(x="")).valueOf() );
+ array[item++] = new TestCase( SECTION, "new Boolean(x=' ')", true, (new Boolean(x=" ")).valueOf() );
+
+ return ( array );
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.3-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.3-2.js
new file mode 100644
index 0000000..f1bc83d
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.3-2.js
@@ -0,0 +1,67 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.6.4.3-2.js
+ ECMA Section: 15.6.4.3 Boolean.prototype.valueOf()
+ Description: Returns this boolean value.
+
+ The valueOf function is not generic; it generates
+ a runtime error if its this value is not a Boolean
+ object. Therefore it cannot be transferred to other
+ kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: june 27, 1997
+*/
+
+ var SECTION = "15.6.4.3-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Boolean.prototype.valueOf()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "valof=Boolean.prototype.valueOf; x=new Boolean(); x.valueOf=valof;x.valueOf()", false, eval("valof=Boolean.prototype.valueOf; x=new Boolean(); x.valueOf=valof;x.valueOf()") );
+ array[item++] = new TestCase( SECTION, "valof=Boolean.prototype.valueOf; x=new Boolean(true); x.valueOf=valof;x.valueOf()", true, eval("valof=Boolean.prototype.valueOf; x=new Boolean(true); x.valueOf=valof;x.valueOf()") );
+ return ( array );
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.3-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.3-3.js
new file mode 100644
index 0000000..f19c168
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.3-3.js
@@ -0,0 +1,71 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.6.4.3-3.js
+ ECMA Section: 15.6.4.3 Boolean.prototype.valueOf()
+ Description: Returns this boolean value.
+
+ The valueOf function is not generic; it generates
+ a runtime error if its this value is not a Boolean
+ object. Therefore it cannot be transferred to other
+ kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: june 27, 1997
+*/
+
+ var SECTION = "15.6.4.3-3";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Boolean.prototype.valueOf()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION,
+ "x=true; x.valueOf=Boolean.prototype.valueOf;x.valueOf()",
+ true,
+ eval("x=true; x.valueOf=Boolean.prototype.valueOf;x.valueOf()") );
+ return ( array );
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.3-4-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.3-4-n.js
new file mode 100644
index 0000000..fe7b17c
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.3-4-n.js
@@ -0,0 +1,71 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.6.4.3-4.js
+ ECMA Section: 15.6.4.3 Boolean.prototype.valueOf()
+ Description: Returns this boolean value.
+
+ The valueOf function is not generic; it generates
+ a runtime error if its this value is not a Boolean
+ object. Therefore it cannot be transferred to other
+ kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: june 27, 1997
+*/
+ var SECTION = "15.6.4.3-4-n";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Boolean.prototype.valueOf()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION,
+ "valof=Boolean.prototype.valueOf; x=new String( 'hello' ); x.valueOf=valof;x.valueOf()",
+ "error",
+ "valof=Boolean.prototype.valueOf; x=new String( 'hello' ); x.valueOf=valof;x.valueOf()" );
+ return ( array );
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.3.js
new file mode 100644
index 0000000..67b9a1b
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.3.js
@@ -0,0 +1,97 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.6.4.3.js
+ ECMA Section: 15.6.4.3 Boolean.prototype.valueOf()
+ Description: Returns this boolean value.
+
+ The valueOf function is not generic; it generates
+ a runtime error if its this value is not a Boolean
+ object. Therefore it cannot be transferred to other
+ kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: june 27, 1997
+*/
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( "15.8.6.4", "new Boolean(1)", true, (new Boolean(1)).valueOf() );
+
+ array[item++] = new TestCase( "15.8.6.4", "new Boolean(0)", false, (new Boolean(0)).valueOf() );
+ array[item++] = new TestCase( "15.8.6.4", "new Boolean(-1)", true, (new Boolean(-1)).valueOf() );
+ array[item++] = new TestCase( "15.8.6.4", "new Boolean('1')", true, (new Boolean("1")).valueOf() );
+ array[item++] = new TestCase( "15.8.6.4", "new Boolean('0')", true, (new Boolean("0")).valueOf() );
+ array[item++] = new TestCase( "15.8.6.4", "new Boolean(true)", true, (new Boolean(true)).valueOf() );
+ array[item++] = new TestCase( "15.8.6.4", "new Boolean(false)", false, (new Boolean(false)).valueOf() );
+ array[item++] = new TestCase( "15.8.6.4", "new Boolean('true')", true, (new Boolean("true")).valueOf() );
+ array[item++] = new TestCase( "15.8.6.4", "new Boolean('false')", true, (new Boolean('false')).valueOf() );
+
+ array[item++] = new TestCase( "15.8.6.4", "new Boolean('')", false, (new Boolean('')).valueOf() );
+ array[item++] = new TestCase( "15.8.6.4", "new Boolean(null)", false, (new Boolean(null)).valueOf() );
+ array[item++] = new TestCase( "15.8.6.4", "new Boolean(void(0))", false, (new Boolean(void(0))).valueOf() );
+ array[item++] = new TestCase( "15.8.6.4", "new Boolean(-Infinity)", true, (new Boolean(Number.NEGATIVE_INFINITY)).valueOf() );
+ array[item++] = new TestCase( "15.8.6.4", "new Boolean(NaN)", false, (new Boolean(Number.NaN)).valueOf() );
+ array[item++] = new TestCase( "15.8.6.4", "new Boolean()", false, (new Boolean()).valueOf() );
+
+ array[item++] = new TestCase( "15.8.6.4", "new Boolean(x=1)", true, (new Boolean(x=1)).valueOf() );
+ array[item++] = new TestCase( "15.8.6.4", "new Boolean(x=0)", false, (new Boolean(x=0)).valueOf() );
+ array[item++] = new TestCase( "15.8.6.4", "new Boolean(x=false)", false, (new Boolean(x=false)).valueOf() );
+ array[item++] = new TestCase( "15.8.6.4", "new Boolean(x=true)", true, (new Boolean(x=true)).valueOf() );
+ array[item++] = new TestCase( "15.8.6.4", "new Boolean(x=null)", false, (new Boolean(x=null)).valueOf() );
+ array[item++] = new TestCase( "15.8.6.4", "new Boolean(x='')", false, (new Boolean(x="")).valueOf() );
+ array[item++] = new TestCase( "15.8.6.4", "new Boolean(x=' ')", true, (new Boolean(x=" ")).valueOf() );
+
+ return ( array );
+}
+
+function test( array ) {
+ var passed = true;
+
+ writeHeaderToLog("15.8.6.4.3 Properties of the Boolean Object: valueOf");
+
+ for ( i = 0; i < array.length; i++ ) {
+
+ array[i].passed = writeTestCaseResult(
+ array[i].expect,
+ array[i].actual,
+ "( "+ array[i].description +" ).valueOf() = "+ array[i].actual );
+
+ array[i].reason += ( array[i].passed ) ? "" : "wrong value ";
+
+ passed = ( array[i].passed ) ? passed : false;
+
+ }
+
+ stopTest();
+
+ // all tests must return a boolean value
+ return ( array );
+}
+
+// for TCMS, the testcases array must be global.
+ var testcases = getTestCases();
+
+// all tests must call a function that returns a boolean value
+ test( testcases );
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.js b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.js
new file mode 100644
index 0000000..44d12c1
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.js
@@ -0,0 +1,77 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.6.4.js
+ ECMA Section: Properties of the Boolean Prototype Object
+ Description:
+ The Boolean prototype object is itself a Boolean object (its [[Class]] is "
+ Boolean") whose value is false.
+
+ The value of the internal [[Prototype]] property of the Boolean prototype
+ object is the Object prototype object (15.2.3.1).
+
+ In following descriptions of functions that are properties of the Boolean
+ prototype object, the phrase "this Boolean object" refers to the object that
+ is the this value for the invocation of the function; it is an error if
+ this does not refer to an object for which the value of the internal
+ [[Class]] property is "Boolean". Also, the phrase "this boolean value"
+ refers to the boolean value represented by this Boolean object, that is,
+ the value of the internal [[Value]] property of this Boolean object.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.6.4";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Properties of the Boolean Prototype Object";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Boolean.prototype == false",
+ true,
+ Boolean.prototype == false );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Boolean.prototype.toString = Object.prototype.toString; Boolean.prototype.toString()",
+ "[object Boolean]",
+ eval("Boolean.prototype.toString = Object.prototype.toString; Boolean.prototype.toString()") );
+
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.1.1-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.1.1-1.js
new file mode 100644
index 0000000..4d936af
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.1.1-1.js
@@ -0,0 +1,87 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.1.1-1.js
+ ECMA Section: 15.9.1.1 Time Range
+ Description:
+ - leap seconds are ignored
+ - assume 86400000 ms / day
+ - numbers range fom +/- 9,007,199,254,740,991
+ - ms precision for any instant that is within
+ approximately +/-285,616 years from 1 jan 1970
+ UTC
+ - range of times supported is -100,000,000 days
+ to 100,000,000 days from 1 jan 1970 12:00 am
+ - time supported is 8.64e5*10e8 milliseconds from
+ 1 jan 1970 UTC (+/-273972.6027397 years)
+
+ - this test generates its own data -- it does not
+ read data from a file.
+ Author: christine@netscape.com
+ Date: 7 july 1997
+
+ Static variables:
+ FOUR_HUNDRED_YEARS
+
+*/
+
+function test() {
+ writeHeaderToLog("15.8.1.1 Time Range");
+
+ for ( M_SECS = 0, CURRENT_YEAR = 1970;
+ M_SECS < 8640000000000000;
+ tc++, M_SECS += FOUR_HUNDRED_YEARS, CURRENT_YEAR += 400 ) {
+
+ testcases[tc] = new TestCase( SECTION, "new Date("+M_SECS+")", CURRENT_YEAR, (new Date( M_SECS)).getUTCFullYear() );
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ if ( ! testcases[tc].passed ) {
+ testcases[tc].reason = "wrong year value";
+ }
+ }
+
+ stopTest();
+
+ return ( testcases );
+}
+
+// every one hundred years contains:
+// 24 years with 366 days
+//
+// every four hundred years contains:
+// 97 years with 366 days
+// 303 years with 365 days
+//
+// 86400000*365*97 = 3067372800000
+// +86400000*366*303 = + 9555408000000
+// = 1.26227808e+13
+ var FOUR_HUNDRED_YEARS = 1.26227808e+13;
+ var SECTION = "15.9.1.1-1";
+ var tc = 0;
+ var testcases = new Array();
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.1.1-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.1.1-2.js
new file mode 100644
index 0000000..c66ce38
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.1.1-2.js
@@ -0,0 +1,82 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.1.1-2.js
+ ECMA Section: 15.9.1.1 Time Range
+ Description:
+ - leap seconds are ignored
+ - assume 86400000 ms / day
+ - numbers range fom +/- 9,007,199,254,740,991
+ - ms precision for any instant that is within
+ approximately +/-285,616 years from 1 jan 1970
+ UTC
+ - range of times supported is -100,000,000 days
+ to 100,000,000 days from 1 jan 1970 12:00 am
+ - time supported is 8.64e5*10e8 milliseconds from
+ 1 jan 1970 UTC (+/-273972.6027397 years)
+ Author: christine@netscape.com
+ Date: 9 july 1997
+*/
+
+function test() {
+
+ writeHeaderToLog("15.8.1.1 Time Range");
+
+ for ( M_SECS = 0, CURRENT_YEAR = 1970;
+ M_SECS > -8640000000000000;
+ tc++, M_SECS -= FOUR_HUNDRED_YEARS, CURRENT_YEAR -= 400 ) {
+
+ testcases[tc] = new TestCase( SECTION, "new Date("+M_SECS+")", CURRENT_YEAR, (new Date( M_SECS )).getUTCFullYear() );
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description + " = " +
+ testcases[tc].actual );
+
+ if ( ! testcases[tc].passed ) {
+ testcases[tc].reason = "wrong year value";
+ }
+ }
+
+ stopTest();
+
+ return ( testcases );
+}
+ // every one hundred years contains:
+ // 24 years with 366 days
+ //
+ // every four hundred years contains:
+ // 97 years with 366 days
+ // 303 years with 365 days
+ //
+ // 86400000*366*97 = 3067372800000
+ // +86400000*365*303 = + 9555408000000
+ // = 1.26227808e+13
+
+ var FOUR_HUNDRED_YEARS = 1.26227808e+13;
+ var SECTION = "15.9.1.1-2";
+ var tc = 0;
+ var testcases = new Array();
+
+ test();
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.1.js
new file mode 100644
index 0000000..3545806
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.1.js
@@ -0,0 +1,108 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.2.1.js
+ ECMA Section: 15.9.2.1 Date constructor used as a function
+ Date( year, month, date, hours, minutes, seconds, ms )
+ Description: The arguments are accepted, but are completely ignored.
+ A string is created and returned as if by the
+ expression (new Date()).toString().
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+ var VERSION = "ECMA_1";
+ startTest();
+ var SECTION = "15.9.2.1";
+ var TITLE = "Date Constructor used as a function";
+ var TYPEOF = "string";
+ var TOLERANCE = 1000;
+
+ writeHeaderToLog("15.9.2.1 The Date Constructor Called as a Function: " +
+ "Date( year, month, date, hours, minutes, seconds, ms )" );
+ var tc= 0;
+ var testcases = getTestCases();
+
+// all tests must call a function that returns an array of TestCase objects.
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ var TODAY = new Date();
+
+ // Dates around 1970
+
+ array[item++] = new TestCase( SECTION, "Date(1970,0,1,0,0,0,0)", (new Date()).toString(), Date(1970,0,1,0,0,0,0) );
+ array[item++] = new TestCase( SECTION, "Date(1969,11,31,15,59,59,999)", (new Date()).toString(), Date(1969,11,31,15,59,59,999))
+ array[item++] = new TestCase( SECTION, "Date(1969,11,31,16,0,0,0)", (new Date()).toString(), Date(1969,11,31,16,0,0,0))
+ array[item++] = new TestCase( SECTION, "Date(1969,11,31,16,0,0,1)", (new Date()).toString(), Date(1969,11,31,16,0,0,1))
+
+ // Dates around 2000
+ array[item++] = new TestCase( SECTION, "Date(1999,11,15,59,59,999)", (new Date()).toString(), Date(1999,11,15,59,59,999));
+ array[item++] = new TestCase( SECTION, "Date(1999,11,16,0,0,0,0)", (new Date()).toString(), Date(1999,11,16,0,0,0,0));
+ array[item++] = new TestCase( SECTION, "Date(1999,11,31,23,59,59,999)", (new Date()).toString(), Date(1999,11,31,23,59,59,999) );
+ array[item++] = new TestCase( SECTION, "Date(2000,0,1,0,0,0,0)", (new Date()).toString(), Date(2000,0,0,0,0,0,0) );
+ array[item++] = new TestCase( SECTION, "Date(2000,0,1,0,0,0,1)", (new Date()).toString(), Date(2000,0,0,0,0,0,1) );
+
+ // Dates around 1900
+
+ array[item++] = new TestCase( SECTION, "Date(1899,11,31,23,59,59,999)", (new Date()).toString(), Date(1899,11,31,23,59,59,999));
+ array[item++] = new TestCase( SECTION, "Date(1900,0,1,0,0,0,0)", (new Date()).toString(), Date(1900,0,1,0,0,0,0) );
+ array[item++] = new TestCase( SECTION, "Date(1900,0,1,0,0,0,1)", (new Date()).toString(), Date(1900,0,1,0,0,0,1) );
+ array[item++] = new TestCase( SECTION, "Date(1899,11,31,16,0,0,0,0)", (new Date()).toString(), Date(1899,11,31,16,0,0,0,0));
+
+ // Dates around feb 29, 2000
+
+ array[item++] = new TestCase( SECTION, "Date( 2000,1,29,0,0,0,0)", (new Date()).toString(), Date(2000,1,29,0,0,0,0));
+ array[item++] = new TestCase( SECTION, "Date( 2000,1,28,23,59,59,999)", (new Date()).toString(), Date( 2000,1,28,23,59,59,999));
+ array[item++] = new TestCase( SECTION, "Date( 2000,1,27,16,0,0,0)", (new Date()).toString(), Date(2000,1,27,16,0,0,0));
+
+ // Dates around jan 1, 2005
+ array[item++] = new TestCase( SECTION, "Date(2004,11,31,23,59,59,999)", (new Date()).toString(), Date(2004,11,31,23,59,59,999));
+ array[item++] = new TestCase( SECTION, "Date(2005,0,1,0,0,0,0)", (new Date()).toString(), Date(2005,0,1,0,0,0,0) );
+ array[item++] = new TestCase( SECTION, "Date(2005,0,1,0,0,0,1)", (new Date()).toString(), Date(2005,0,1,0,0,0,1) );
+ array[item++] = new TestCase( SECTION, "Date(2004,11,31,16,0,0,0,0)", (new Date()).toString(), Date(2004,11,31,16,0,0,0,0));
+
+ // Dates around jan 1, 2032
+ array[item++] = new TestCase( SECTION, "Date(2031,11,31,23,59,59,999)", (new Date()).toString(), Date(2031,11,31,23,59,59,999));
+ array[item++] = new TestCase( SECTION, "Date(2032,0,1,0,0,0,0)", (new Date()).toString(), Date(2032,0,1,0,0,0,0) );
+ array[item++] = new TestCase( SECTION, "Date(2032,0,1,0,0,0,1)", (new Date()).toString(), Date(2032,0,1,0,0,0,1) );
+ array[item++] = new TestCase( SECTION, "Date(2031,11,31,16,0,0,0,0)", (new Date()).toString(), Date(2031,11,31,16,0,0,0,0));
+
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.2-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.2-1.js
new file mode 100644
index 0000000..8ad5694
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.2-1.js
@@ -0,0 +1,105 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.2.2.js
+ ECMA Section: 15.9.2.2 Date constructor used as a function
+ Date( year, month, date, hours, minutes, seconds )
+ Description: The arguments are accepted, but are completely ignored.
+ A string is created and returned as if by the
+ expression (new Date()).toString().
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+ Version: 9706
+
+*/
+ var VERSION = 9706;
+ startTest();
+ var SECTION = "15.9.2.2";
+ var TOLERANCE = 100;
+ var TITLE = "The Date Constructor Called as a Function";
+
+ writeHeaderToLog(SECTION+" "+TITLE );
+ var tc= 0;
+ var testcases = getTestCases();
+
+// all tests must call a function that returns an array of TestCase objects.
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ // Dates around 1970
+
+ array[item++] = new TestCase( SECTION, "Date(1970,0,1,0,0,0)", (new Date()).toString(), Date(1970,0,1,0,0,0) );
+ array[item++] = new TestCase( SECTION, "Date(1969,11,31,15,59,59)", (new Date()).toString(), Date(1969,11,31,15,59,59))
+ array[item++] = new TestCase( SECTION, "Date(1969,11,31,16,0,0)", (new Date()).toString(), Date(1969,11,31,16,0,0))
+ array[item++] = new TestCase( SECTION, "Date(1969,11,31,16,0,1)", (new Date()).toString(), Date(1969,11,31,16,0,1))
+/*
+ // Dates around 2000
+ array[item++] = new TestCase( SECTION, "Date(1999,11,15,59,59)", (new Date()).toString(), Date(1999,11,15,59,59));
+ array[item++] = new TestCase( SECTION, "Date(1999,11,16,0,0,0)", (new Date()).toString(), Date(1999,11,16,0,0,0));
+ array[item++] = new TestCase( SECTION, "Date(1999,11,31,23,59,59)", (new Date()).toString(), Date(1999,11,31,23,59,59) );
+ array[item++] = new TestCase( SECTION, "Date(2000,0,1,0,0,0)", (new Date()).toString(), Date(2000,0,0,0,0,0) );
+ array[item++] = new TestCase( SECTION, "Date(2000,0,1,0,0,1)", (new Date()).toString(), Date(2000,0,0,0,0,1) );
+
+ // Dates around 1900
+
+ array[item++] = new TestCase( SECTION, "Date(1899,11,31,23,59,59)", (new Date()).toString(), Date(1899,11,31,23,59,59));
+ array[item++] = new TestCase( SECTION, "Date(1900,0,1,0,0,0)", (new Date()).toString(), Date(1900,0,1,0,0,0) );
+ array[item++] = new TestCase( SECTION, "Date(1900,0,1,0,0,1)", (new Date()).toString(), Date(1900,0,1,0,0,1) );
+ array[item++] = new TestCase( SECTION, "Date(1899,11,31,16,0,0,0)", (new Date()).toString(), Date(1899,11,31,16,0,0,0));
+
+ // Dates around feb 29, 2000
+
+ array[item++] = new TestCase( SECTION, "Date( 2000,1,29,0,0,0)", (new Date()).toString(), Date(2000,1,29,0,0,0));
+ array[item++] = new TestCase( SECTION, "Date( 2000,1,28,23,59,59)", (new Date()).toString(), Date( 2000,1,28,23,59,59));
+ array[item++] = new TestCase( SECTION, "Date( 2000,1,27,16,0,0)", (new Date()).toString(), Date(2000,1,27,16,0,0));
+
+ // Dates around jan 1, 2005
+ array[item++] = new TestCase( SECTION, "Date(2004,11,31,23,59,59)", (new Date()).toString(), Date(2004,11,31,23,59,59));
+ array[item++] = new TestCase( SECTION, "Date(2005,0,1,0,0,0)", (new Date()).toString(), Date(2005,0,1,0,0,0) );
+ array[item++] = new TestCase( SECTION, "Date(2005,0,1,0,0,1)", (new Date()).toString(), Date(2005,0,1,0,0,1) );
+ array[item++] = new TestCase( SECTION, "Date(2004,11,31,16,0,0,0)", (new Date()).toString(), Date(2004,11,31,16,0,0,0));
+
+ // Dates around jan 1, 2032
+ array[item++] = new TestCase( SECTION, "Date(2031,11,31,23,59,59)", (new Date()).toString(), Date(2031,11,31,23,59,59));
+ array[item++] = new TestCase( SECTION, "Date(2032,0,1,0,0,0)", (new Date()).toString(), Date(2032,0,1,0,0,0) );
+ array[item++] = new TestCase( SECTION, "Date(2032,0,1,0,0,1)", (new Date()).toString(), Date(2032,0,1,0,0,1) );
+ array[item++] = new TestCase( SECTION, "Date(2031,11,31,16,0,0,0)", (new Date()).toString(), Date(2031,11,31,16,0,0,0));
+*/
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.2-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.2-2.js
new file mode 100644
index 0000000..5baaf53
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.2-2.js
@@ -0,0 +1,99 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.2.2.js
+ ECMA Section: 15.9.2.2 Date constructor used as a function
+ Date( year, month, date, hours, minutes, seconds )
+ Description: The arguments are accepted, but are completely ignored.
+ A string is created and returned as if by the
+ expression (new Date()).toString().
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+ Version: 9706
+
+*/
+ var VERSION = 9706;
+ startTest();
+ var SECTION = "15.9.2.2";
+ var TOLERANCE = 100;
+ var TITLE = "The Date Constructor Called as a Function";
+
+ writeHeaderToLog(SECTION+" "+TITLE );
+ var tc= 0;
+ var testcases = getTestCases();
+
+// all tests must call a function that returns an array of TestCase objects.
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ // Dates around 2000
+ array[item++] = new TestCase( SECTION, "Date(1999,11,15,59,59)", (new Date()).toString(), Date(1999,11,15,59,59));
+ array[item++] = new TestCase( SECTION, "Date(1999,11,16,0,0,0)", (new Date()).toString(), Date(1999,11,16,0,0,0));
+ array[item++] = new TestCase( SECTION, "Date(1999,11,31,23,59,59)", (new Date()).toString(), Date(1999,11,31,23,59,59) );
+ array[item++] = new TestCase( SECTION, "Date(2000,0,1,0,0,0)", (new Date()).toString(), Date(2000,0,0,0,0,0) );
+ array[item++] = new TestCase( SECTION, "Date(2000,0,1,0,0,1)", (new Date()).toString(), Date(2000,0,0,0,0,1) );
+
+/*
+ // Dates around 1900
+
+ array[item++] = new TestCase( SECTION, "Date(1899,11,31,23,59,59)", (new Date()).toString(), Date(1899,11,31,23,59,59));
+ array[item++] = new TestCase( SECTION, "Date(1900,0,1,0,0,0)", (new Date()).toString(), Date(1900,0,1,0,0,0) );
+ array[item++] = new TestCase( SECTION, "Date(1900,0,1,0,0,1)", (new Date()).toString(), Date(1900,0,1,0,0,1) );
+ array[item++] = new TestCase( SECTION, "Date(1899,11,31,16,0,0,0)", (new Date()).toString(), Date(1899,11,31,16,0,0,0));
+
+ // Dates around feb 29, 2000
+
+ array[item++] = new TestCase( SECTION, "Date( 2000,1,29,0,0,0)", (new Date()).toString(), Date(2000,1,29,0,0,0));
+ array[item++] = new TestCase( SECTION, "Date( 2000,1,28,23,59,59)", (new Date()).toString(), Date( 2000,1,28,23,59,59));
+ array[item++] = new TestCase( SECTION, "Date( 2000,1,27,16,0,0)", (new Date()).toString(), Date(2000,1,27,16,0,0));
+
+ // Dates around jan 1, 2005
+ array[item++] = new TestCase( SECTION, "Date(2004,11,31,23,59,59)", (new Date()).toString(), Date(2004,11,31,23,59,59));
+ array[item++] = new TestCase( SECTION, "Date(2005,0,1,0,0,0)", (new Date()).toString(), Date(2005,0,1,0,0,0) );
+ array[item++] = new TestCase( SECTION, "Date(2005,0,1,0,0,1)", (new Date()).toString(), Date(2005,0,1,0,0,1) );
+ array[item++] = new TestCase( SECTION, "Date(2004,11,31,16,0,0,0)", (new Date()).toString(), Date(2004,11,31,16,0,0,0));
+
+ // Dates around jan 1, 2032
+ array[item++] = new TestCase( SECTION, "Date(2031,11,31,23,59,59)", (new Date()).toString(), Date(2031,11,31,23,59,59));
+ array[item++] = new TestCase( SECTION, "Date(2032,0,1,0,0,0)", (new Date()).toString(), Date(2032,0,1,0,0,0) );
+ array[item++] = new TestCase( SECTION, "Date(2032,0,1,0,0,1)", (new Date()).toString(), Date(2032,0,1,0,0,1) );
+ array[item++] = new TestCase( SECTION, "Date(2031,11,31,16,0,0,0)", (new Date()).toString(), Date(2031,11,31,16,0,0,0));
+*/
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.2-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.2-3.js
new file mode 100644
index 0000000..59255e2
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.2-3.js
@@ -0,0 +1,92 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.2.2.js
+ ECMA Section: 15.9.2.2 Date constructor used as a function
+ Date( year, month, date, hours, minutes, seconds )
+ Description: The arguments are accepted, but are completely ignored.
+ A string is created and returned as if by the
+ expression (new Date()).toString().
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+ Version: 9706
+
+*/
+ var VERSION = 9706;
+ startTest();
+ var SECTION = "15.9.2.2";
+ var TOLERANCE = 100;
+ var TITLE = "The Date Constructor Called as a Function";
+
+ writeHeaderToLog(SECTION+" "+TITLE );
+ var tc= 0;
+ var testcases = getTestCases();
+
+// all tests must call a function that returns an array of TestCase objects.
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ // Dates around 1900
+
+ array[item++] = new TestCase( SECTION, "Date(1899,11,31,23,59,59)", (new Date()).toString(), Date(1899,11,31,23,59,59));
+ array[item++] = new TestCase( SECTION, "Date(1900,0,1,0,0,0)", (new Date()).toString(), Date(1900,0,1,0,0,0) );
+ array[item++] = new TestCase( SECTION, "Date(1900,0,1,0,0,1)", (new Date()).toString(), Date(1900,0,1,0,0,1) );
+ array[item++] = new TestCase( SECTION, "Date(1899,11,31,16,0,0,0)", (new Date()).toString(), Date(1899,11,31,16,0,0,0));
+
+/*
+ // Dates around feb 29, 2000
+
+ array[item++] = new TestCase( SECTION, "Date( 2000,1,29,0,0,0)", (new Date()).toString(), Date(2000,1,29,0,0,0));
+ array[item++] = new TestCase( SECTION, "Date( 2000,1,28,23,59,59)", (new Date()).toString(), Date( 2000,1,28,23,59,59));
+ array[item++] = new TestCase( SECTION, "Date( 2000,1,27,16,0,0)", (new Date()).toString(), Date(2000,1,27,16,0,0));
+
+ // Dates around jan 1, 2005
+ array[item++] = new TestCase( SECTION, "Date(2004,11,31,23,59,59)", (new Date()).toString(), Date(2004,11,31,23,59,59));
+ array[item++] = new TestCase( SECTION, "Date(2005,0,1,0,0,0)", (new Date()).toString(), Date(2005,0,1,0,0,0) );
+ array[item++] = new TestCase( SECTION, "Date(2005,0,1,0,0,1)", (new Date()).toString(), Date(2005,0,1,0,0,1) );
+ array[item++] = new TestCase( SECTION, "Date(2004,11,31,16,0,0,0)", (new Date()).toString(), Date(2004,11,31,16,0,0,0));
+
+ // Dates around jan 1, 2032
+ array[item++] = new TestCase( SECTION, "Date(2031,11,31,23,59,59)", (new Date()).toString(), Date(2031,11,31,23,59,59));
+ array[item++] = new TestCase( SECTION, "Date(2032,0,1,0,0,0)", (new Date()).toString(), Date(2032,0,1,0,0,0) );
+ array[item++] = new TestCase( SECTION, "Date(2032,0,1,0,0,1)", (new Date()).toString(), Date(2032,0,1,0,0,1) );
+ array[item++] = new TestCase( SECTION, "Date(2031,11,31,16,0,0,0)", (new Date()).toString(), Date(2031,11,31,16,0,0,0));
+*/
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.2-4.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.2-4.js
new file mode 100644
index 0000000..b63bb3e
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.2-4.js
@@ -0,0 +1,85 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.2.2.js
+ ECMA Section: 15.9.2.2 Date constructor used as a function
+ Date( year, month, date, hours, minutes, seconds )
+ Description: The arguments are accepted, but are completely ignored.
+ A string is created and returned as if by the
+ expression (new Date()).toString().
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+ Version: 9706
+
+*/
+ var VERSION = 9706;
+ startTest();
+ var SECTION = "15.9.2.2";
+ var TOLERANCE = 100;
+ var TITLE = "The Date Constructor Called as a Function";
+
+ writeHeaderToLog(SECTION+" "+TITLE );
+ var tc= 0;
+ var testcases = getTestCases();
+
+// all tests must call a function that returns an array of TestCase objects.
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ // Dates around feb 29, 2000
+
+ array[item++] = new TestCase( SECTION, "Date( 2000,1,29,0,0,0)", (new Date()).toString(), Date(2000,1,29,0,0,0));
+ array[item++] = new TestCase( SECTION, "Date( 2000,1,28,23,59,59)", (new Date()).toString(), Date( 2000,1,28,23,59,59));
+ array[item++] = new TestCase( SECTION, "Date( 2000,1,27,16,0,0)", (new Date()).toString(), Date(2000,1,27,16,0,0));
+
+/*
+ // Dates around jan 1, 2005
+ array[item++] = new TestCase( SECTION, "Date(2004,11,31,23,59,59)", (new Date()).toString(), Date(2004,11,31,23,59,59));
+ array[item++] = new TestCase( SECTION, "Date(2005,0,1,0,0,0)", (new Date()).toString(), Date(2005,0,1,0,0,0) );
+ array[item++] = new TestCase( SECTION, "Date(2005,0,1,0,0,1)", (new Date()).toString(), Date(2005,0,1,0,0,1) );
+ array[item++] = new TestCase( SECTION, "Date(2004,11,31,16,0,0,0)", (new Date()).toString(), Date(2004,11,31,16,0,0,0));
+
+ // Dates around jan 1, 2032
+ array[item++] = new TestCase( SECTION, "Date(2031,11,31,23,59,59)", (new Date()).toString(), Date(2031,11,31,23,59,59));
+ array[item++] = new TestCase( SECTION, "Date(2032,0,1,0,0,0)", (new Date()).toString(), Date(2032,0,1,0,0,0) );
+ array[item++] = new TestCase( SECTION, "Date(2032,0,1,0,0,1)", (new Date()).toString(), Date(2032,0,1,0,0,1) );
+ array[item++] = new TestCase( SECTION, "Date(2031,11,31,16,0,0,0)", (new Date()).toString(), Date(2031,11,31,16,0,0,0));
+*/
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.2-5.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.2-5.js
new file mode 100644
index 0000000..5422682
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.2-5.js
@@ -0,0 +1,78 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.2.2.js
+ ECMA Section: 15.9.2.2 Date constructor used as a function
+ Date( year, month, date, hours, minutes, seconds )
+ Description: The arguments are accepted, but are completely ignored.
+ A string is created and returned as if by the
+ expression (new Date()).toString().
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+ Version: 9706
+
+*/
+ var VERSION = 9706;
+ startTest();
+ var SECTION = "15.9.2.2";
+ var TOLERANCE = 100;
+ var TITLE = "The Date Constructor Called as a Function";
+
+ writeHeaderToLog(SECTION+" "+TITLE );
+ var tc= 0;
+ var testcases = getTestCases();
+
+// all tests must call a function that returns an array of TestCase objects.
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ // Dates around jan 1, 2005
+ array[item++] = new TestCase( SECTION, "Date(2004,11,31,23,59,59)", (new Date()).toString(), Date(2004,11,31,23,59,59));
+ array[item++] = new TestCase( SECTION, "Date(2005,0,1,0,0,0)", (new Date()).toString(), Date(2005,0,1,0,0,0) );
+ array[item++] = new TestCase( SECTION, "Date(2005,0,1,0,0,1)", (new Date()).toString(), Date(2005,0,1,0,0,1) );
+ array[item++] = new TestCase( SECTION, "Date(2004,11,31,16,0,0,0)", (new Date()).toString(), Date(2004,11,31,16,0,0,0));
+/*
+ // Dates around jan 1, 2032
+ array[item++] = new TestCase( SECTION, "Date(2031,11,31,23,59,59)", (new Date()).toString(), Date(2031,11,31,23,59,59));
+ array[item++] = new TestCase( SECTION, "Date(2032,0,1,0,0,0)", (new Date()).toString(), Date(2032,0,1,0,0,0) );
+ array[item++] = new TestCase( SECTION, "Date(2032,0,1,0,0,1)", (new Date()).toString(), Date(2032,0,1,0,0,1) );
+ array[item++] = new TestCase( SECTION, "Date(2031,11,31,16,0,0,0)", (new Date()).toString(), Date(2031,11,31,16,0,0,0));
+*/
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.2-6.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.2-6.js
new file mode 100644
index 0000000..8e269d0
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.2-6.js
@@ -0,0 +1,72 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.2.2.js
+ ECMA Section: 15.9.2.2 Date constructor used as a function
+ Date( year, month, date, hours, minutes, seconds )
+ Description: The arguments are accepted, but are completely ignored.
+ A string is created and returned as if by the
+ expression (new Date()).toString().
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+ Version: 9706
+
+*/
+ var VERSION = 9706;
+ startTest();
+ var SECTION = "15.9.2.2";
+ var TOLERANCE = 100;
+ var TITLE = "The Date Constructor Called as a Function";
+
+ writeHeaderToLog(SECTION+" "+TITLE );
+ var tc= 0;
+ var testcases = getTestCases();
+
+// all tests must call a function that returns an array of TestCase objects.
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ // Dates around jan 1, 2032
+ array[item++] = new TestCase( SECTION, "Date(2031,11,31,23,59,59)", (new Date()).toString(), Date(2031,11,31,23,59,59));
+ array[item++] = new TestCase( SECTION, "Date(2032,0,1,0,0,0)", (new Date()).toString(), Date(2032,0,1,0,0,0) );
+ array[item++] = new TestCase( SECTION, "Date(2032,0,1,0,0,1)", (new Date()).toString(), Date(2032,0,1,0,0,1) );
+ array[item++] = new TestCase( SECTION, "Date(2031,11,31,16,0,0,0)", (new Date()).toString(), Date(2031,11,31,16,0,0,0));
+
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.1-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.1-1.js
new file mode 100644
index 0000000..3090055
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.1-1.js
@@ -0,0 +1,274 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.3.1.js
+ ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms)
+ Description: The [[Prototype]] property of the newly constructed
+ object is set to the original Date prototype object,
+ the one that is the initial value of Date.prototype.
+
+ The [[Class]] property of the newly constructed object
+ is set as follows:
+ 1. Call ToNumber(year)
+ 2. Call ToNumber(month)
+ 3. Call ToNumber(date)
+ 4. Call ToNumber(hours)
+ 5. Call ToNumber(minutes)
+ 6. Call ToNumber(seconds)
+ 7. Call ToNumber(ms)
+ 8. If Result(1) is NaN and 0 <= ToInteger(Result(1)) <=
+ 99, Result(8) is 1900+ToInteger(Result(1)); otherwise,
+ Result(8) is Result(1)
+ 9. Compute MakeDay(Result(8), Result(2), Result(3)
+ 10. Compute MakeTime(Result(4), Result(5), Result(6),
+ Result(7)
+ 11. Compute MakeDate(Result(9), Result(10))
+ 12. Set the [[Value]] property of the newly constructed
+ object to TimeClip(UTC(Result(11))).
+
+
+ This tests the returned value of a newly constructed
+ Date object.
+
+ Author: christine@netscape.com
+ Date: 7 july 1997
+*/
+
+ var SECTION = "15.9.3.1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "new Date( year, month, date, hours, minutes, seconds, ms )";
+
+ var TIME = 0;
+ var UTC_YEAR = 1;
+ var UTC_MONTH = 2;
+ var UTC_DATE = 3;
+ var UTC_DAY = 4;
+ var UTC_HOURS = 5;
+ var UTC_MINUTES = 6;
+ var UTC_SECONDS = 7;
+ var UTC_MS = 8;
+
+ var YEAR = 9;
+ var MONTH = 10;
+ var DATE = 11;
+ var DAY = 12;
+ var HOURS = 13;
+ var MINUTES = 14;
+ var SECONDS = 15;
+ var MS = 16;
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ getTestCases();
+ test();
+
+function getTestCases( ) {
+ // all the "ResultArrays" below are hard-coded to Pacific Standard Time values -
+ var TZ_ADJUST = TZ_PST * msPerHour;
+
+ // Dates around 1970
+
+ addNewTestCase( new Date( 1969,11,31,15,59,59,999),
+ "new Date( 1969,11,31,15,59,59,999)",
+ [TIME_1970-1,1969,11,31,3,23,59,59,999,1969,11,31,3,15,59,59,999] );
+
+ addNewTestCase( new Date( 1969,11,31,23,59,59,999),
+ "new Date( 1969,11,31,23,59,59,999)",
+ [TIME_1970-TZ_ADJUST-1,1970,0,1,4,7,59,59,999,1969,11,31,3,23,59,59,999] );
+
+ addNewTestCase( new Date( 1970,0,1,0,0,0,0),
+ "new Date( 1970,0,1,0,0,0,0)",
+ [TIME_1970-TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
+
+ addNewTestCase( new Date( 1969,11,31,16,0,0,0),
+ "new Date( 1969,11,31,16,0,0,0)",
+ [TIME_1970,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] );
+
+ addNewTestCase( new Date(1969,12,1,0,0,0,0),
+ "new Date(1969,12,1,0,0,0,0)",
+ [TIME_1970-TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
+
+ addNewTestCase( new Date(1969,11,32,0,0,0,0),
+ "new Date(1969,11,32,0,0,0,0)",
+ [TIME_1970-TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
+
+ addNewTestCase( new Date(1969,11,31,24,0,0,0),
+ "new Date(1969,11,31,24,0,0,0)",
+ [TIME_1970-TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
+
+ addNewTestCase( new Date(1969,11,31,23,60,0,0),
+ "new Date(1969,11,31,23,60,0,0)",
+ [TIME_1970-TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
+
+ addNewTestCase( new Date(1969,11,31,23,59,60,0),
+ "new Date(1969,11,31,23,59,60,0)",
+ [TIME_1970-TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
+
+ addNewTestCase( new Date(1969,11,31,23,59,59,1000),
+ "new Date(1969,11,31,23,59,59,1000)",
+ [TIME_1970-TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
+
+ // Dates around 2000
+
+ addNewTestCase( new Date( 1999,11,31,15,59,59,999),
+ "new Date( 1999,11,31,15,59,59,999)",
+ [TIME_2000-1,1999,11,31,5,23,59,59,999,1999,11,31,5,15,59,59,999] );
+
+ addNewTestCase( new Date( 1999,11,31,16,0,0,0),
+ "new Date( 1999,11,31,16,0,0,0)",
+ [TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5, 16,0,0,0] );
+
+ addNewTestCase( new Date( 1999,11,31,23,59,59,999),
+ "new Date( 1999,11,31,23,59,59,999)",
+ [TIME_2000-TZ_ADJUST-1,2000,0,1,6,7,59,59,999,1999,11,31,5,23,59,59,999] );
+
+ addNewTestCase( new Date( 2000,0,1,0,0,0,0),
+ "new Date( 2000,0,1,0,0,0,0)",
+ [TIME_2000-TZ_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] );
+
+ addNewTestCase( new Date( 2000,0,1,0,0,0,1),
+ "new Date( 2000,0,1,0,0,0,1)",
+ [TIME_2000-TZ_ADJUST+1,2000,0,1,6,8,0,0,1,2000,0,1,6,0,0,0,1] );
+
+ // Dates around 29 Feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + ( 30 * msPerDay ) + ( 29 * msPerDay );
+
+ addNewTestCase( new Date(2000,1,28,16,0,0,0),
+ "new Date(2000,1,28,16,0,0,0)",
+ [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] );
+
+ addNewTestCase( new Date(2000,1,29,0,0,0,0),
+ "new Date(2000,1,29,0,0,0,0)",
+ [UTC_FEB_29_2000-TZ_ADJUST,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+
+ addNewTestCase( new Date(2000,1,28,24,0,0,0),
+ "new Date(2000,1,28,24,0,0,0)",
+ [UTC_FEB_29_2000-TZ_ADJUST,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+
+ // Dates around 1900
+
+ addNewTestCase( new Date(1899,11,31,16,0,0,0),
+ "new Date(1899,11,31,16,0,0,0)",
+ [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+
+ addNewTestCase( new Date(1899,11,31,15,59,59,999),
+ "new Date(1899,11,31,15,59,59,999)",
+ [TIME_1900-1,1899,11,31,0,23,59,59,999,1899,11,31,0,15,59,59,999] );
+
+ addNewTestCase( new Date(1899,11,31,23,59,59,999),
+ "new Date(1899,11,31,23,59,59,999)",
+ [TIME_1900-TZ_ADJUST-1,1900,0,1,1,7,59,59,999,1899,11,31,0,23,59,59,999] );
+
+ addNewTestCase( new Date(1900,0,1,0,0,0,0),
+ "new Date(1900,0,1,0,0,0,0)",
+ [TIME_1900-TZ_ADJUST,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+
+ addNewTestCase( new Date(1900,0,1,0,0,0,1),
+ "new Date(1900,0,1,0,0,0,1)",
+ [TIME_1900-TZ_ADJUST+1,1900,0,1,1,8,0,0,1,1900,0,1,1,0,0,0,1] );
+
+ // Dates around 2005
+
+ var UTC_YEAR_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001) +
+ TimeInYear(2002) + TimeInYear(2003) + TimeInYear(2004);
+
+ addNewTestCase( new Date(2005,0,1,0,0,0,0),
+ "new Date(2005,0,1,0,0,0,0)",
+ [UTC_YEAR_2005-TZ_ADJUST,2005,0,1,6,8,0,0,0,2005,0,1,6,0,0,0,0] );
+
+ addNewTestCase( new Date(2004,11,31,16,0,0,0),
+ "new Date(2004,11,31,16,0,0,0)",
+ [UTC_YEAR_2005,2005,0,1,6,0,0,0,0,2004,11,31,5,16,0,0,0] );
+
+/*
+ This test case is incorrect. Need to fix the DaylightSavings functions in
+ shell.js for this to work properly.
+
+ // Daylight Savings test case
+
+ var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour )
+
+ addNewTestCase( new Date(1998,3,5,1,59,59,999),
+ "new Date(1998,3,5,1,59,59,999)",
+ [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] );
+
+ addNewTestCase( new Date(1998,3,5,2,0,0,0),
+ "new Date(1998,3,5,2,0,0,0)",
+ [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]);
+
+ var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour );
+
+ addNewTestCase ( new Date(1998,9,25,1,59,59,999),
+ "new Date(1998,9,25,1,59,59,999)",
+ [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] );
+
+ addNewTestCase ( new Date(1998,9,25,2,0,0,0),
+ "new Date(1998,9,25,2,0,0,0)",
+ [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] );
+*/
+}
+
+function addNewTestCase( DateCase, DateString, ResultArray ) {
+ //adjust hard-coded ResultArray for tester's timezone instead of PST
+ adjustResultArray(ResultArray);
+
+ var item = testcases.length;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
+}
+
+
+function test() {
+ for( tc = 0; tc < testcases.length; tc++ ) {
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = " +
+ testcases[tc].actual );
+ }
+ stopTest();
+ return testcases;
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.1-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.1-2.js
new file mode 100644
index 0000000..13d0ab6
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.1-2.js
@@ -0,0 +1,231 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.3.1.js
+ ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms)
+ Description: The [[Prototype]] property of the newly constructed
+ object is set to the original Date prototype object,
+ the one that is the initial value of Date.prototype.
+
+ The [[Class]] property of the newly constructed object
+ is set as follows:
+ 1. Call ToNumber(year)
+ 2. Call ToNumber(month)
+ 3. Call ToNumber(date)
+ 4. Call ToNumber(hours)
+ 5. Call ToNumber(minutes)
+ 6. Call ToNumber(seconds)
+ 7. Call ToNumber(ms)
+ 8. If Result(1) is NaN and 0 <= ToInteger(Result(1)) <=
+ 99, Result(8) is 1900+ToInteger(Result(1)); otherwise,
+ Result(8) is Result(1)
+ 9. Compute MakeDay(Result(8), Result(2), Result(3)
+ 10. Compute MakeTime(Result(4), Result(5), Result(6),
+ Result(7)
+ 11. Compute MakeDate(Result(9), Result(10))
+ 12. Set the [[Value]] property of the newly constructed
+ object to TimeClip(UTC(Result(11))).
+
+
+ This tests the returned value of a newly constructed
+ Date object.
+
+ Author: christine@netscape.com
+ Date: 7 july 1997
+*/
+
+ var SECTION = "15.9.3.1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "new Date( year, month, date, hours, minutes, seconds, ms )";
+
+ var TIME = 0;
+ var UTC_YEAR = 1;
+ var UTC_MONTH = 2;
+ var UTC_DATE = 3;
+ var UTC_DAY = 4;
+ var UTC_HOURS = 5;
+ var UTC_MINUTES = 6;
+ var UTC_SECONDS = 7;
+ var UTC_MS = 8;
+
+ var YEAR = 9;
+ var MONTH = 10;
+ var DATE = 11;
+ var DAY = 12;
+ var HOURS = 13;
+ var MINUTES = 14;
+ var SECONDS = 15;
+ var MS = 16;
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ getTestCases();
+ test();
+
+function getTestCases( ) {
+ // all the "ResultArrays" below are hard-coded to Pacific Standard Time values -
+ var TZ_ADJUST = TZ_PST * msPerHour;
+
+ // Dates around 2000
+
+ addNewTestCase( new Date( 1999,11,31,15,59,59,999),
+ "new Date( 1999,11,31,15,59,59,999)",
+ [TIME_2000-1,1999,11,31,5,23,59,59,999,1999,11,31,5,15,59,59,999] );
+
+ addNewTestCase( new Date( 1999,11,31,16,0,0,0),
+ "new Date( 1999,11,31,16,0,0,0)",
+ [TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5, 16,0,0,0] );
+
+ addNewTestCase( new Date( 1999,11,31,23,59,59,999),
+ "new Date( 1999,11,31,23,59,59,999)",
+ [TIME_2000-TZ_ADJUST-1,2000,0,1,6,7,59,59,999,1999,11,31,5,23,59,59,999] );
+
+ addNewTestCase( new Date( 2000,0,1,0,0,0,0),
+ "new Date( 2000,0,1,0,0,0,0)",
+ [TIME_2000-TZ_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] );
+
+ addNewTestCase( new Date( 2000,0,1,0,0,0,1),
+ "new Date( 2000,0,1,0,0,0,1)",
+ [TIME_2000-TZ_ADJUST+1,2000,0,1,6,8,0,0,1,2000,0,1,6,0,0,0,1] );
+/*
+ // Dates around 29 Feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + ( 30 * msPerDay ) + ( 29 * msPerDay );
+
+ addNewTestCase( new Date(2000,1,28,16,0,0,0),
+ "new Date(2000,1,28,16,0,0,0)",
+ [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] );
+
+ addNewTestCase( new Date(2000,1,29,0,0,0,0),
+ "new Date(2000,1,29,0,0,0,0)",
+ [UTC_FEB_29_2000-TZ_ADJUST,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+
+ addNewTestCase( new Date(2000,1,28,24,0,0,0),
+ "new Date(2000,1,28,24,0,0,0)",
+ [UTC_FEB_29_2000-TZ_ADJUST,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+
+ // Dates around 1900
+
+ addNewTestCase( new Date(1899,11,31,16,0,0,0),
+ "new Date(1899,11,31,16,0,0,0)",
+ [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+
+ addNewTestCase( new Date(1899,11,31,15,59,59,999),
+ "new Date(1899,11,31,15,59,59,999)",
+ [TIME_1900-1,1899,11,31,0,23,59,59,999,1899,11,31,0,15,59,59,999] );
+
+ addNewTestCase( new Date(1899,11,31,23,59,59,999),
+ "new Date(1899,11,31,23,59,59,999)",
+ [TIME_1900-TZ_ADJUST-1,1900,0,1,1,7,59,59,999,1899,11,31,0,23,59,59,999] );
+
+ addNewTestCase( new Date(1900,0,1,0,0,0,0),
+ "new Date(1900,0,1,0,0,0,0)",
+ [TIME_1900-TZ_ADJUST,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+
+ addNewTestCase( new Date(1900,0,1,0,0,0,1),
+ "new Date(1900,0,1,0,0,0,1)",
+ [TIME_1900-TZ_ADJUST+1,1900,0,1,1,8,0,0,1,1900,0,1,1,0,0,0,1] );
+
+ // Dates around 2005
+
+ var UTC_YEAR_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001) +
+ TimeInYear(2002) + TimeInYear(2003) + TimeInYear(2004);
+
+ addNewTestCase( new Date(2005,0,1,0,0,0,0),
+ "new Date(2005,0,1,0,0,0,0)",
+ [UTC_YEAR_2005-TZ_ADJUST,2005,0,1,6,8,0,0,0,2005,0,1,6,0,0,0,0] );
+
+ addNewTestCase( new Date(2004,11,31,16,0,0,0),
+ "new Date(2004,11,31,16,0,0,0)",
+ [UTC_YEAR_2005,2005,0,1,6,0,0,0,0,2004,11,31,5,16,0,0,0] );
+*/
+/*
+ This test case is incorrect. Need to fix the DaylightSavings functions in
+ shell.js for this to work properly.
+
+ // Daylight Savings test case
+
+ var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour )
+
+ addNewTestCase( new Date(1998,3,5,1,59,59,999),
+ "new Date(1998,3,5,1,59,59,999)",
+ [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] );
+
+ addNewTestCase( new Date(1998,3,5,2,0,0,0),
+ "new Date(1998,3,5,2,0,0,0)",
+ [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]);
+
+ var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour );
+
+ addNewTestCase ( new Date(1998,9,25,1,59,59,999),
+ "new Date(1998,9,25,1,59,59,999)",
+ [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] );
+
+ addNewTestCase ( new Date(1998,9,25,2,0,0,0),
+ "new Date(1998,9,25,2,0,0,0)",
+ [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] );
+*/
+}
+
+function addNewTestCase( DateCase, DateString, ResultArray ) {
+ //adjust hard-coded ResultArray for tester's timezone instead of PST
+ adjustResultArray(ResultArray);
+
+ var item = testcases.length;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
+}
+
+function test() {
+ for( tc = 0; tc < testcases.length; tc++ ) {
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = " +
+ testcases[tc].actual );
+ }
+ stopTest();
+ return testcases;
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.1-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.1-3.js
new file mode 100644
index 0000000..ced3027
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.1-3.js
@@ -0,0 +1,209 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.3.1.js
+ ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms)
+ Description: The [[Prototype]] property of the newly constructed
+ object is set to the original Date prototype object,
+ the one that is the initial value of Date.prototype.
+
+ The [[Class]] property of the newly constructed object
+ is set as follows:
+ 1. Call ToNumber(year)
+ 2. Call ToNumber(month)
+ 3. Call ToNumber(date)
+ 4. Call ToNumber(hours)
+ 5. Call ToNumber(minutes)
+ 6. Call ToNumber(seconds)
+ 7. Call ToNumber(ms)
+ 8. If Result(1) is NaN and 0 <= ToInteger(Result(1)) <=
+ 99, Result(8) is 1900+ToInteger(Result(1)); otherwise,
+ Result(8) is Result(1)
+ 9. Compute MakeDay(Result(8), Result(2), Result(3)
+ 10. Compute MakeTime(Result(4), Result(5), Result(6),
+ Result(7)
+ 11. Compute MakeDate(Result(9), Result(10))
+ 12. Set the [[Value]] property of the newly constructed
+ object to TimeClip(UTC(Result(11))).
+
+
+ This tests the returned value of a newly constructed
+ Date object.
+
+ Author: christine@netscape.com
+ Date: 7 july 1997
+*/
+
+ var SECTION = "15.9.3.1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "new Date( year, month, date, hours, minutes, seconds, ms )";
+
+ var TIME = 0;
+ var UTC_YEAR = 1;
+ var UTC_MONTH = 2;
+ var UTC_DATE = 3;
+ var UTC_DAY = 4;
+ var UTC_HOURS = 5;
+ var UTC_MINUTES = 6;
+ var UTC_SECONDS = 7;
+ var UTC_MS = 8;
+
+ var YEAR = 9;
+ var MONTH = 10;
+ var DATE = 11;
+ var DAY = 12;
+ var HOURS = 13;
+ var MINUTES = 14;
+ var SECONDS = 15;
+ var MS = 16;
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ getTestCases();
+ test();
+
+function getTestCases( ) {
+ // all the "ResultArrays" below are hard-coded to Pacific Standard Time values -
+ var TZ_ADJUST = TZ_PST * msPerHour;
+
+ // Dates around 29 Feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + ( 30 * msPerDay ) + ( 29 * msPerDay );
+
+ addNewTestCase( new Date(2000,1,28,16,0,0,0),
+ "new Date(2000,1,28,16,0,0,0)",
+ [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] );
+
+ addNewTestCase( new Date(2000,1,29,0,0,0,0),
+ "new Date(2000,1,29,0,0,0,0)",
+ [UTC_FEB_29_2000-TZ_ADJUST,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+
+ addNewTestCase( new Date(2000,1,28,24,0,0,0),
+ "new Date(2000,1,28,24,0,0,0)",
+ [UTC_FEB_29_2000-TZ_ADJUST,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+/*
+ // Dates around 1900
+
+ addNewTestCase( new Date(1899,11,31,16,0,0,0),
+ "new Date(1899,11,31,16,0,0,0)",
+ [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+
+ addNewTestCase( new Date(1899,11,31,15,59,59,999),
+ "new Date(1899,11,31,15,59,59,999)",
+ [TIME_1900-1,1899,11,31,0,23,59,59,999,1899,11,31,0,15,59,59,999] );
+
+ addNewTestCase( new Date(1899,11,31,23,59,59,999),
+ "new Date(1899,11,31,23,59,59,999)",
+ [TIME_1900-TZ_ADJUST-1,1900,0,1,1,7,59,59,999,1899,11,31,0,23,59,59,999] );
+
+ addNewTestCase( new Date(1900,0,1,0,0,0,0),
+ "new Date(1900,0,1,0,0,0,0)",
+ [TIME_1900-TZ_ADJUST,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+
+ addNewTestCase( new Date(1900,0,1,0,0,0,1),
+ "new Date(1900,0,1,0,0,0,1)",
+ [TIME_1900-TZ_ADJUST+1,1900,0,1,1,8,0,0,1,1900,0,1,1,0,0,0,1] );
+
+ // Dates around 2005
+
+ var UTC_YEAR_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001) +
+ TimeInYear(2002) + TimeInYear(2003) + TimeInYear(2004);
+
+ addNewTestCase( new Date(2005,0,1,0,0,0,0),
+ "new Date(2005,0,1,0,0,0,0)",
+ [UTC_YEAR_2005-TZ_ADJUST,2005,0,1,6,8,0,0,0,2005,0,1,6,0,0,0,0] );
+
+ addNewTestCase( new Date(2004,11,31,16,0,0,0),
+ "new Date(2004,11,31,16,0,0,0)",
+ [UTC_YEAR_2005,2005,0,1,6,0,0,0,0,2004,11,31,5,16,0,0,0] );
+*/
+/*
+ This test case is incorrect. Need to fix the DaylightSavings functions in
+ shell.js for this to work properly.
+
+ // Daylight Savings test case
+
+ var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour )
+
+ addNewTestCase( new Date(1998,3,5,1,59,59,999),
+ "new Date(1998,3,5,1,59,59,999)",
+ [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] );
+
+ addNewTestCase( new Date(1998,3,5,2,0,0,0),
+ "new Date(1998,3,5,2,0,0,0)",
+ [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]);
+
+ var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour );
+
+ addNewTestCase ( new Date(1998,9,25,1,59,59,999),
+ "new Date(1998,9,25,1,59,59,999)",
+ [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] );
+
+ addNewTestCase ( new Date(1998,9,25,2,0,0,0),
+ "new Date(1998,9,25,2,0,0,0)",
+ [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] );
+*/
+}
+
+function addNewTestCase( DateCase, DateString, ResultArray ) {
+ //adjust hard-coded ResultArray for tester's timezone instead of PST
+ adjustResultArray(ResultArray);
+
+ var item = testcases.length;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
+}
+
+function test() {
+ for( tc = 0; tc < testcases.length; tc++ ) {
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = " +
+ testcases[tc].actual );
+ }
+ stopTest();
+ return testcases;
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.1-4.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.1-4.js
new file mode 100644
index 0000000..0f18b12
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.1-4.js
@@ -0,0 +1,193 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.3.1.js
+ ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms)
+ Description: The [[Prototype]] property of the newly constructed
+ object is set to the original Date prototype object,
+ the one that is the initial value of Date.prototype.
+
+ The [[Class]] property of the newly constructed object
+ is set as follows:
+ 1. Call ToNumber(year)
+ 2. Call ToNumber(month)
+ 3. Call ToNumber(date)
+ 4. Call ToNumber(hours)
+ 5. Call ToNumber(minutes)
+ 6. Call ToNumber(seconds)
+ 7. Call ToNumber(ms)
+ 8. If Result(1) is NaN and 0 <= ToInteger(Result(1)) <=
+ 99, Result(8) is 1900+ToInteger(Result(1)); otherwise,
+ Result(8) is Result(1)
+ 9. Compute MakeDay(Result(8), Result(2), Result(3)
+ 10. Compute MakeTime(Result(4), Result(5), Result(6),
+ Result(7)
+ 11. Compute MakeDate(Result(9), Result(10))
+ 12. Set the [[Value]] property of the newly constructed
+ object to TimeClip(UTC(Result(11))).
+
+
+ This tests the returned value of a newly constructed
+ Date object.
+
+ Author: christine@netscape.com
+ Date: 7 july 1997
+*/
+
+ var SECTION = "15.9.3.1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "new Date( year, month, date, hours, minutes, seconds, ms )";
+
+ var TIME = 0;
+ var UTC_YEAR = 1;
+ var UTC_MONTH = 2;
+ var UTC_DATE = 3;
+ var UTC_DAY = 4;
+ var UTC_HOURS = 5;
+ var UTC_MINUTES = 6;
+ var UTC_SECONDS = 7;
+ var UTC_MS = 8;
+
+ var YEAR = 9;
+ var MONTH = 10;
+ var DATE = 11;
+ var DAY = 12;
+ var HOURS = 13;
+ var MINUTES = 14;
+ var SECONDS = 15;
+ var MS = 16;
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ getTestCases();
+ test();
+
+function getTestCases( ) {
+ // all the "ResultArrays" below are hard-coded to Pacific Standard Time values -
+ var TZ_ADJUST = TZ_PST * msPerHour;
+
+ // Dates around 1900
+
+ addNewTestCase( new Date(1899,11,31,16,0,0,0),
+ "new Date(1899,11,31,16,0,0,0)",
+ [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+
+ addNewTestCase( new Date(1899,11,31,15,59,59,999),
+ "new Date(1899,11,31,15,59,59,999)",
+ [TIME_1900-1,1899,11,31,0,23,59,59,999,1899,11,31,0,15,59,59,999] );
+
+ addNewTestCase( new Date(1899,11,31,23,59,59,999),
+ "new Date(1899,11,31,23,59,59,999)",
+ [TIME_1900-TZ_ADJUST-1,1900,0,1,1,7,59,59,999,1899,11,31,0,23,59,59,999] );
+
+ addNewTestCase( new Date(1900,0,1,0,0,0,0),
+ "new Date(1900,0,1,0,0,0,0)",
+ [TIME_1900-TZ_ADJUST,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+
+ addNewTestCase( new Date(1900,0,1,0,0,0,1),
+ "new Date(1900,0,1,0,0,0,1)",
+ [TIME_1900-TZ_ADJUST+1,1900,0,1,1,8,0,0,1,1900,0,1,1,0,0,0,1] );
+/*
+ // Dates around 2005
+
+ var UTC_YEAR_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001) +
+ TimeInYear(2002) + TimeInYear(2003) + TimeInYear(2004);
+
+ addNewTestCase( new Date(2005,0,1,0,0,0,0),
+ "new Date(2005,0,1,0,0,0,0)",
+ [UTC_YEAR_2005-TZ_ADJUST,2005,0,1,6,8,0,0,0,2005,0,1,6,0,0,0,0] );
+
+ addNewTestCase( new Date(2004,11,31,16,0,0,0),
+ "new Date(2004,11,31,16,0,0,0)",
+ [UTC_YEAR_2005,2005,0,1,6,0,0,0,0,2004,11,31,5,16,0,0,0] );
+*/
+/*
+ This test case is incorrect. Need to fix the DaylightSavings functions in
+ shell.js for this to work properly.
+
+ // Daylight Savings test case
+
+ var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour )
+
+ addNewTestCase( new Date(1998,3,5,1,59,59,999),
+ "new Date(1998,3,5,1,59,59,999)",
+ [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] );
+
+ addNewTestCase( new Date(1998,3,5,2,0,0,0),
+ "new Date(1998,3,5,2,0,0,0)",
+ [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]);
+
+ var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour );
+
+ addNewTestCase ( new Date(1998,9,25,1,59,59,999),
+ "new Date(1998,9,25,1,59,59,999)",
+ [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] );
+
+ addNewTestCase ( new Date(1998,9,25,2,0,0,0),
+ "new Date(1998,9,25,2,0,0,0)",
+ [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] );
+*/
+}
+
+function addNewTestCase( DateCase, DateString, ResultArray ) {
+ //adjust hard-coded ResultArray for tester's timezone instead of PST
+ adjustResultArray(ResultArray);
+
+ var item = testcases.length;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
+}
+
+function test() {
+ for( tc = 0; tc < testcases.length; tc++ ) {
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = " +
+ testcases[tc].actual );
+ }
+ stopTest();
+ return testcases;
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.1-5.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.1-5.js
new file mode 100644
index 0000000..0b7d436
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.1-5.js
@@ -0,0 +1,170 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.3.1.js
+ ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms)
+ Description: The [[Prototype]] property of the newly constructed
+ object is set to the original Date prototype object,
+ the one that is the initial value of Date.prototype.
+
+ The [[Class]] property of the newly constructed object
+ is set as follows:
+ 1. Call ToNumber(year)
+ 2. Call ToNumber(month)
+ 3. Call ToNumber(date)
+ 4. Call ToNumber(hours)
+ 5. Call ToNumber(minutes)
+ 6. Call ToNumber(seconds)
+ 7. Call ToNumber(ms)
+ 8. If Result(1) is NaN and 0 <= ToInteger(Result(1)) <=
+ 99, Result(8) is 1900+ToInteger(Result(1)); otherwise,
+ Result(8) is Result(1)
+ 9. Compute MakeDay(Result(8), Result(2), Result(3)
+ 10. Compute MakeTime(Result(4), Result(5), Result(6),
+ Result(7)
+ 11. Compute MakeDate(Result(9), Result(10))
+ 12. Set the [[Value]] property of the newly constructed
+ object to TimeClip(UTC(Result(11))).
+
+
+ This tests the returned value of a newly constructed
+ Date object.
+
+ Author: christine@netscape.com
+ Date: 7 july 1997
+*/
+
+ var SECTION = "15.9.3.1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "new Date( year, month, date, hours, minutes, seconds, ms )";
+
+ var TIME = 0;
+ var UTC_YEAR = 1;
+ var UTC_MONTH = 2;
+ var UTC_DATE = 3;
+ var UTC_DAY = 4;
+ var UTC_HOURS = 5;
+ var UTC_MINUTES = 6;
+ var UTC_SECONDS = 7;
+ var UTC_MS = 8;
+
+ var YEAR = 9;
+ var MONTH = 10;
+ var DATE = 11;
+ var DAY = 12;
+ var HOURS = 13;
+ var MINUTES = 14;
+ var SECONDS = 15;
+ var MS = 16;
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ getTestCases();
+ test();
+
+function getTestCases( ) {
+ // all the "ResultArrays" below are hard-coded to Pacific Standard Time values -
+ var TZ_ADJUST = TZ_PST * msPerHour;
+
+ // Dates around 2005
+
+ var UTC_YEAR_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001) +
+ TimeInYear(2002) + TimeInYear(2003) + TimeInYear(2004);
+
+ addNewTestCase( new Date(2005,0,1,0,0,0,0),
+ "new Date(2005,0,1,0,0,0,0)",
+ [UTC_YEAR_2005-TZ_ADJUST,2005,0,1,6,8,0,0,0,2005,0,1,6,0,0,0,0] );
+
+ addNewTestCase( new Date(2004,11,31,16,0,0,0),
+ "new Date(2004,11,31,16,0,0,0)",
+ [UTC_YEAR_2005,2005,0,1,6,0,0,0,0,2004,11,31,5,16,0,0,0] );
+/*
+ This test case is incorrect. Need to fix the DaylightSavings functions in
+ shell.js for this to work properly.
+
+ // Daylight Savings test case
+
+ var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour )
+
+ addNewTestCase( new Date(1998,3,5,1,59,59,999),
+ "new Date(1998,3,5,1,59,59,999)",
+ [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] );
+
+ addNewTestCase( new Date(1998,3,5,2,0,0,0),
+ "new Date(1998,3,5,2,0,0,0)",
+ [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]);
+
+ var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour );
+
+ addNewTestCase ( new Date(1998,9,25,1,59,59,999),
+ "new Date(1998,9,25,1,59,59,999)",
+ [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] );
+
+ addNewTestCase ( new Date(1998,9,25,2,0,0,0),
+ "new Date(1998,9,25,2,0,0,0)",
+ [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] );
+*/
+}
+
+function addNewTestCase( DateCase, DateString, ResultArray ) {
+ //adjust hard-coded ResultArray for tester's timezone instead of PST
+ adjustResultArray(ResultArray);
+
+ var item = testcases.length;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
+}
+
+function test() {
+ for( tc = 0; tc < testcases.length; tc++ ) {
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = " +
+ testcases[tc].actual );
+ }
+ stopTest();
+ return testcases;
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.2-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.2-1.js
new file mode 100644
index 0000000..718d314
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.2-1.js
@@ -0,0 +1,241 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.3.1.js
+ ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms)
+ Description: The [[Prototype]] property of the newly constructed
+ object is set to the original Date prototype object,
+ the one that is the initial value of Date.prototype.
+
+ The [[Class]] property of the newly constructed object
+ is set as follows:
+ 1. Call ToNumber(year)
+ 2. Call ToNumber(month)
+ 3. Call ToNumber(date)
+ 4. Call ToNumber(hours)
+ 5. Call ToNumber(minutes)
+ 6. Call ToNumber(seconds)
+ 7. Call ToNumber(ms)
+ 8. If Result(1)is NaN and 0 <= ToInteger(Result(1)) <=
+ 99, Result(8) is 1900+ToInteger(Result(1)); otherwise,
+ Result(8) is Result(1)
+ 9. Compute MakeDay(Result(8), Result(2), Result(3)
+ 10. Compute MakeTime(Result(4), Result(5), Result(6),
+ Result(7)
+ 11. Compute MakeDate(Result(9), Result(10))
+ 12. Set the [[Value]] property of the newly constructed
+ object to TimeClip(UTC(Result(11))).
+
+
+ This tests the returned value of a newly constructed
+ Date object.
+
+ Author: christine@netscape.com
+ Date: 7 july 1997
+*/
+
+ var TIME = 0;
+ var UTC_YEAR = 1;
+ var UTC_MONTH = 2;
+ var UTC_DATE = 3;
+ var UTC_DAY = 4;
+ var UTC_HOURS = 5;
+ var UTC_MINUTES = 6;
+ var UTC_SECONDS = 7;
+ var UTC_MS = 8;
+
+ var YEAR = 9;
+ var MONTH = 10;
+ var DATE = 11;
+ var DAY = 12;
+ var HOURS = 13;
+ var MINUTES = 14;
+ var SECONDS = 15;
+ var MS = 16;
+
+// for TCMS, the testcases array must be global.
+ var SECTION = "15.9.3.1";
+ var TITLE = "Date( year, month, date, hours, minutes, seconds )";
+
+ writeHeaderToLog( SECTION+" " +TITLE );
+
+ var testcases = new Array();
+ getTestCases();
+
+// all tests must call a function that returns an array of TestCase object
+ test();
+
+function getTestCases( ) {
+
+ // Dates around 1970
+
+ addNewTestCase( new Date( 1969,11,31,15,59,59),
+ "new Date( 1969,11,31,15,59,59)",
+ [-1000,1969,11,31,3,23,59,59,0,1969,11,31,3,15,59,59,0] );
+
+ addNewTestCase( new Date( 1969,11,31,16,0,0),
+ "new Date( 1969,11,31,16,0,0)",
+ [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] );
+
+ addNewTestCase( new Date( 1969,11,31,23,59,59),
+ "new Date( 1969,11,31,23,59,59)",
+ [28799000,1970,0,1,4,7,59,59,0,1969,11,31,3,23,59,59,0] );
+
+ addNewTestCase( new Date( 1970, 0, 1, 0, 0, 0),
+ "new Date( 1970, 0, 1, 0, 0, 0)",
+ [28800000,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
+
+ addNewTestCase( new Date( 1969,11,31,16,0,0),
+ "new Date( 1969,11,31,16,0,0)",
+ [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] );
+/*
+ // Dates around 2000
+
+ addNewTestCase( new Date( 1999,11,31,15,59,59),
+ "new Date( 1999,11,31,15,59,59)",
+ [946684799000,1999,11,31,5,23,59,59,0,1999,11,31,5,15,59,59,0] );
+
+ addNewTestCase( new Date( 1999,11,31,16,0,0),
+ "new Date( 1999,11,31,16,0,0)",
+ [946684800000,2000,0,1,6,0,0,0,0,1999,11,31,5, 16,0,0,0] );
+
+ addNewTestCase( new Date( 2000,0,1,0,0,0),
+ "new Date( 2000,0,1,0,0,0)",
+ [946713600000,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] );
+
+ // Dates around 1900
+
+ addNewTestCase( new Date(1899,11,31,16,0,0),
+ "new Date(1899,11,31,16,0,0)",
+ [-2208988800000,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+
+ addNewTestCase( new Date(1899,11,31,15,59,59),
+ "new Date(1899,11,31,15,59,59)",
+ [-2208988801000,1899,11,31,0,23,59,59,0,1899,11,31,0,15,59,59,0] );
+
+ addNewTestCase( new Date(1900,0,1,0,0,0),
+ "new Date(1900,0,1,0,0,0)",
+ [-2208960000000,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+
+ addNewTestCase( new Date(1900,0,1,0,0,1),
+ "new Date(1900,0,1,0,0,1)",
+ [-2208959999000,1900,0,1,1,8,0,1,0,1900,0,1,1,0,0,1,0] );
+
+ var UTC_FEB_29_2000 = TIME_2000 + msPerDay*31 + msPerDay*28;
+ var PST_FEB_29_2000 = UTC_FEB_29_2000 + 8*msPerHour;
+
+ // Dates around Feb 29, 2000
+ addNewTestCase( new Date(2000,1,28,16,0,0,0),
+ "new Date(2000,1,28,16,0,0,0)",
+ [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0,0] );
+
+ addNewTestCase( new Date(2000,1,29,0,0,0,0),
+ "new Date(2000,1,29,0,0,0,0)",
+ [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+
+ addNewTestCase( new Date(2000,1,29,24,0,0,0),
+ "new Date(2000,1,29,24,0,0,0)",
+ [PST_FEB_29_2000+msPerDay,2000,2,1,3,8,0,0,0,2000,2,1,3,0,0,0,0] );
+
+ // Dates around Jan 1, 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001) +
+ TimeInYear(2002)+ TimeInYear(2003) + TimeInYear(2004);
+ var PST_JAN_1_2005 = UTC_JAN_1_2005 + 8*msPerHour;
+
+ addNewTestCase( new Date(2005,0,1,0,0,0,0),
+ "new Date(2005,0,1,0,0,0,0)",
+ [PST_JAN_1_2005,2005,0,1,6,8,0,0,0,2005,0,1,6,0,0,0,0] );
+
+ addNewTestCase( new Date(2004,11,31,16,0,0,0),
+ "new Date(2004,11,31,16,0,0,0)",
+ [UTC_JAN_1_2005,2005,0,1,6,0,0,0,0,2004,11,31,5,16,0,0,0] );
+*/
+/*
+ This test case is incorrect. Need to fix the DaylightSavings functions in
+ shell.js for this to work properly.
+
+ // Daylight Savings Time
+
+ var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour )
+
+ addNewTestCase( new Date(1998,3,5,1,59,59,999),
+ "new Date(1998,3,5,1,59,59,999)",
+ [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] );
+
+ addNewTestCase( new Date(1998,3,5,2,0,0,0),
+ "new Date(1998,3,5,2,0,0,0)",
+ [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]);
+
+ var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour );
+
+ addNewTestCase ( new Date(1998,9,25,1,59,59,999),
+ "new Date(1998,9,25,1,59,59,999)",
+ [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] );
+
+ addNewTestCase ( new Date(1998,9,25,2,0,0,0),
+ "new Date(1998,9,25,2,0,0,0)",
+ [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] );
+*/
+}
+
+function addNewTestCase( DateCase, DateString, ResultArray ) {
+ //adjust hard-coded ResultArray for tester's timezone instead of PST
+ adjustResultArray(ResultArray);
+
+ item = testcases.length;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
+
+}
+
+function test() {
+ for( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = " +
+ testcases[tc].actual );
+ }
+ stopTest();
+ return testcases;
+}
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.2-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.2-2.js
new file mode 100644
index 0000000..b110f52
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.2-2.js
@@ -0,0 +1,219 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.3.1.js
+ ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms)
+ Description: The [[Prototype]] property of the newly constructed
+ object is set to the original Date prototype object,
+ the one that is the initial value of Date.prototype.
+
+ The [[Class]] property of the newly constructed object
+ is set as follows:
+ 1. Call ToNumber(year)
+ 2. Call ToNumber(month)
+ 3. Call ToNumber(date)
+ 4. Call ToNumber(hours)
+ 5. Call ToNumber(minutes)
+ 6. Call ToNumber(seconds)
+ 7. Call ToNumber(ms)
+ 8. If Result(1)is NaN and 0 <= ToInteger(Result(1)) <=
+ 99, Result(8) is 1900+ToInteger(Result(1)); otherwise,
+ Result(8) is Result(1)
+ 9. Compute MakeDay(Result(8), Result(2), Result(3)
+ 10. Compute MakeTime(Result(4), Result(5), Result(6),
+ Result(7)
+ 11. Compute MakeDate(Result(9), Result(10))
+ 12. Set the [[Value]] property of the newly constructed
+ object to TimeClip(UTC(Result(11))).
+
+
+ This tests the returned value of a newly constructed
+ Date object.
+
+ Author: christine@netscape.com
+ Date: 7 july 1997
+*/
+
+ var TIME = 0;
+ var UTC_YEAR = 1;
+ var UTC_MONTH = 2;
+ var UTC_DATE = 3;
+ var UTC_DAY = 4;
+ var UTC_HOURS = 5;
+ var UTC_MINUTES = 6;
+ var UTC_SECONDS = 7;
+ var UTC_MS = 8;
+
+ var YEAR = 9;
+ var MONTH = 10;
+ var DATE = 11;
+ var DAY = 12;
+ var HOURS = 13;
+ var MINUTES = 14;
+ var SECONDS = 15;
+ var MS = 16;
+
+// for TCMS, the testcases array must be global.
+ var SECTION = "15.9.3.1";
+ var TITLE = "Date( year, month, date, hours, minutes, seconds )";
+
+ writeHeaderToLog( SECTION+" " +TITLE );
+
+ var testcases = new Array();
+ getTestCases();
+
+// all tests must call a function that returns an array of TestCase object
+ test();
+
+function getTestCases( ) {
+
+ // Dates around 2000
+
+ addNewTestCase( new Date( 1999,11,31,15,59,59),
+ "new Date( 1999,11,31,15,59,59)",
+ [946684799000,1999,11,31,5,23,59,59,0,1999,11,31,5,15,59,59,0] );
+
+ addNewTestCase( new Date( 1999,11,31,16,0,0),
+ "new Date( 1999,11,31,16,0,0)",
+ [946684800000,2000,0,1,6,0,0,0,0,1999,11,31,5, 16,0,0,0] );
+
+ addNewTestCase( new Date( 2000,0,1,0,0,0),
+ "new Date( 2000,0,1,0,0,0)",
+ [946713600000,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] );
+/*
+ // Dates around 1900
+
+ addNewTestCase( new Date(1899,11,31,16,0,0),
+ "new Date(1899,11,31,16,0,0)",
+ [-2208988800000,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+
+ addNewTestCase( new Date(1899,11,31,15,59,59),
+ "new Date(1899,11,31,15,59,59)",
+ [-2208988801000,1899,11,31,0,23,59,59,0,1899,11,31,0,15,59,59,0] );
+
+ addNewTestCase( new Date(1900,0,1,0,0,0),
+ "new Date(1900,0,1,0,0,0)",
+ [-2208960000000,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+
+ addNewTestCase( new Date(1900,0,1,0,0,1),
+ "new Date(1900,0,1,0,0,1)",
+ [-2208959999000,1900,0,1,1,8,0,1,0,1900,0,1,1,0,0,1,0] );
+
+ var UTC_FEB_29_2000 = TIME_2000 + msPerDay*31 + msPerDay*28;
+ var PST_FEB_29_2000 = UTC_FEB_29_2000 + 8*msPerHour;
+
+ // Dates around Feb 29, 2000
+ addNewTestCase( new Date(2000,1,28,16,0,0,0),
+ "new Date(2000,1,28,16,0,0,0)",
+ [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0,0] );
+
+ addNewTestCase( new Date(2000,1,29,0,0,0,0),
+ "new Date(2000,1,29,0,0,0,0)",
+ [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+
+ addNewTestCase( new Date(2000,1,29,24,0,0,0),
+ "new Date(2000,1,29,24,0,0,0)",
+ [PST_FEB_29_2000+msPerDay,2000,2,1,3,8,0,0,0,2000,2,1,3,0,0,0,0] );
+
+ // Dates around Jan 1, 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001) +
+ TimeInYear(2002)+ TimeInYear(2003) + TimeInYear(2004);
+ var PST_JAN_1_2005 = UTC_JAN_1_2005 + 8*msPerHour;
+
+ addNewTestCase( new Date(2005,0,1,0,0,0,0),
+ "new Date(2005,0,1,0,0,0,0)",
+ [PST_JAN_1_2005,2005,0,1,6,8,0,0,0,2005,0,1,6,0,0,0,0] );
+
+ addNewTestCase( new Date(2004,11,31,16,0,0,0),
+ "new Date(2004,11,31,16,0,0,0)",
+ [UTC_JAN_1_2005,2005,0,1,6,0,0,0,0,2004,11,31,5,16,0,0,0] );
+*/
+/*
+ This test case is incorrect. Need to fix the DaylightSavings functions in
+ shell.js for this to work properly.
+
+ // Daylight Savings Time
+
+ var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour )
+
+ addNewTestCase( new Date(1998,3,5,1,59,59,999),
+ "new Date(1998,3,5,1,59,59,999)",
+ [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] );
+
+ addNewTestCase( new Date(1998,3,5,2,0,0,0),
+ "new Date(1998,3,5,2,0,0,0)",
+ [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]);
+
+ var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour );
+
+ addNewTestCase ( new Date(1998,9,25,1,59,59,999),
+ "new Date(1998,9,25,1,59,59,999)",
+ [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] );
+
+ addNewTestCase ( new Date(1998,9,25,2,0,0,0),
+ "new Date(1998,9,25,2,0,0,0)",
+ [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] );
+*/
+}
+
+function addNewTestCase( DateCase, DateString, ResultArray ) {
+ //adjust hard-coded ResultArray for tester's timezone instead of PST
+ adjustResultArray(ResultArray);
+
+ item = testcases.length;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
+
+}
+
+function test() {
+ for( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = " +
+ testcases[tc].actual );
+ }
+ stopTest();
+ return testcases;
+}
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.2-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.2-3.js
new file mode 100644
index 0000000..9e57730
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.2-3.js
@@ -0,0 +1,205 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.3.1.js
+ ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms)
+ Description: The [[Prototype]] property of the newly constructed
+ object is set to the original Date prototype object,
+ the one that is the initial value of Date.prototype.
+
+ The [[Class]] property of the newly constructed object
+ is set as follows:
+ 1. Call ToNumber(year)
+ 2. Call ToNumber(month)
+ 3. Call ToNumber(date)
+ 4. Call ToNumber(hours)
+ 5. Call ToNumber(minutes)
+ 6. Call ToNumber(seconds)
+ 7. Call ToNumber(ms)
+ 8. If Result(1)is NaN and 0 <= ToInteger(Result(1)) <=
+ 99, Result(8) is 1900+ToInteger(Result(1)); otherwise,
+ Result(8) is Result(1)
+ 9. Compute MakeDay(Result(8), Result(2), Result(3)
+ 10. Compute MakeTime(Result(4), Result(5), Result(6),
+ Result(7)
+ 11. Compute MakeDate(Result(9), Result(10))
+ 12. Set the [[Value]] property of the newly constructed
+ object to TimeClip(UTC(Result(11))).
+
+
+ This tests the returned value of a newly constructed
+ Date object.
+
+ Author: christine@netscape.com
+ Date: 7 july 1997
+*/
+
+ var TIME = 0;
+ var UTC_YEAR = 1;
+ var UTC_MONTH = 2;
+ var UTC_DATE = 3;
+ var UTC_DAY = 4;
+ var UTC_HOURS = 5;
+ var UTC_MINUTES = 6;
+ var UTC_SECONDS = 7;
+ var UTC_MS = 8;
+
+ var YEAR = 9;
+ var MONTH = 10;
+ var DATE = 11;
+ var DAY = 12;
+ var HOURS = 13;
+ var MINUTES = 14;
+ var SECONDS = 15;
+ var MS = 16;
+
+// for TCMS, the testcases array must be global.
+ var SECTION = "15.9.3.1";
+ var TITLE = "Date( year, month, date, hours, minutes, seconds )";
+
+ writeHeaderToLog( SECTION+" " +TITLE );
+
+ var testcases = new Array();
+ getTestCases();
+
+// all tests must call a function that returns an array of TestCase object
+ test();
+
+function getTestCases( ) {
+
+ // Dates around 1900
+
+ addNewTestCase( new Date(1899,11,31,16,0,0),
+ "new Date(1899,11,31,16,0,0)",
+ [-2208988800000,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+
+ addNewTestCase( new Date(1899,11,31,15,59,59),
+ "new Date(1899,11,31,15,59,59)",
+ [-2208988801000,1899,11,31,0,23,59,59,0,1899,11,31,0,15,59,59,0] );
+
+ addNewTestCase( new Date(1900,0,1,0,0,0),
+ "new Date(1900,0,1,0,0,0)",
+ [-2208960000000,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+
+ addNewTestCase( new Date(1900,0,1,0,0,1),
+ "new Date(1900,0,1,0,0,1)",
+ [-2208959999000,1900,0,1,1,8,0,1,0,1900,0,1,1,0,0,1,0] );
+/*
+ var UTC_FEB_29_2000 = TIME_2000 + msPerDay*31 + msPerDay*28;
+ var PST_FEB_29_2000 = UTC_FEB_29_2000 + 8*msPerHour;
+
+ // Dates around Feb 29, 2000
+ addNewTestCase( new Date(2000,1,28,16,0,0,0),
+ "new Date(2000,1,28,16,0,0,0)",
+ [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0,0] );
+
+ addNewTestCase( new Date(2000,1,29,0,0,0,0),
+ "new Date(2000,1,29,0,0,0,0)",
+ [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+
+ addNewTestCase( new Date(2000,1,29,24,0,0,0),
+ "new Date(2000,1,29,24,0,0,0)",
+ [PST_FEB_29_2000+msPerDay,2000,2,1,3,8,0,0,0,2000,2,1,3,0,0,0,0] );
+
+ // Dates around Jan 1, 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001) +
+ TimeInYear(2002)+ TimeInYear(2003) + TimeInYear(2004);
+ var PST_JAN_1_2005 = UTC_JAN_1_2005 + 8*msPerHour;
+
+ addNewTestCase( new Date(2005,0,1,0,0,0,0),
+ "new Date(2005,0,1,0,0,0,0)",
+ [PST_JAN_1_2005,2005,0,1,6,8,0,0,0,2005,0,1,6,0,0,0,0] );
+
+ addNewTestCase( new Date(2004,11,31,16,0,0,0),
+ "new Date(2004,11,31,16,0,0,0)",
+ [UTC_JAN_1_2005,2005,0,1,6,0,0,0,0,2004,11,31,5,16,0,0,0] );
+*/
+/*
+ This test case is incorrect. Need to fix the DaylightSavings functions in
+ shell.js for this to work properly.
+
+ // Daylight Savings Time
+
+ var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour )
+
+ addNewTestCase( new Date(1998,3,5,1,59,59,999),
+ "new Date(1998,3,5,1,59,59,999)",
+ [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] );
+
+ addNewTestCase( new Date(1998,3,5,2,0,0,0),
+ "new Date(1998,3,5,2,0,0,0)",
+ [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]);
+
+ var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour );
+
+ addNewTestCase ( new Date(1998,9,25,1,59,59,999),
+ "new Date(1998,9,25,1,59,59,999)",
+ [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] );
+
+ addNewTestCase ( new Date(1998,9,25,2,0,0,0),
+ "new Date(1998,9,25,2,0,0,0)",
+ [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] );
+*/
+}
+
+function addNewTestCase( DateCase, DateString, ResultArray ) {
+ //adjust hard-coded ResultArray for tester's timezone instead of PST
+ adjustResultArray(ResultArray);
+
+ item = testcases.length;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
+
+}
+
+function test() {
+ for( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = " +
+ testcases[tc].actual );
+ }
+ stopTest();
+ return testcases;
+}
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.2-4.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.2-4.js
new file mode 100644
index 0000000..6b6b0c4
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.2-4.js
@@ -0,0 +1,188 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.3.1.js
+ ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms)
+ Description: The [[Prototype]] property of the newly constructed
+ object is set to the original Date prototype object,
+ the one that is the initial value of Date.prototype.
+
+ The [[Class]] property of the newly constructed object
+ is set as follows:
+ 1. Call ToNumber(year)
+ 2. Call ToNumber(month)
+ 3. Call ToNumber(date)
+ 4. Call ToNumber(hours)
+ 5. Call ToNumber(minutes)
+ 6. Call ToNumber(seconds)
+ 7. Call ToNumber(ms)
+ 8. If Result(1)is NaN and 0 <= ToInteger(Result(1)) <=
+ 99, Result(8) is 1900+ToInteger(Result(1)); otherwise,
+ Result(8) is Result(1)
+ 9. Compute MakeDay(Result(8), Result(2), Result(3)
+ 10. Compute MakeTime(Result(4), Result(5), Result(6),
+ Result(7)
+ 11. Compute MakeDate(Result(9), Result(10))
+ 12. Set the [[Value]] property of the newly constructed
+ object to TimeClip(UTC(Result(11))).
+
+
+ This tests the returned value of a newly constructed
+ Date object.
+
+ Author: christine@netscape.com
+ Date: 7 july 1997
+*/
+
+ var TIME = 0;
+ var UTC_YEAR = 1;
+ var UTC_MONTH = 2;
+ var UTC_DATE = 3;
+ var UTC_DAY = 4;
+ var UTC_HOURS = 5;
+ var UTC_MINUTES = 6;
+ var UTC_SECONDS = 7;
+ var UTC_MS = 8;
+
+ var YEAR = 9;
+ var MONTH = 10;
+ var DATE = 11;
+ var DAY = 12;
+ var HOURS = 13;
+ var MINUTES = 14;
+ var SECONDS = 15;
+ var MS = 16;
+
+// for TCMS, the testcases array must be global.
+ var SECTION = "15.9.3.1";
+ var TITLE = "Date( year, month, date, hours, minutes, seconds )";
+
+ writeHeaderToLog( SECTION+" " +TITLE );
+
+ var testcases = new Array();
+ getTestCases();
+
+// all tests must call a function that returns an array of TestCase object
+ test();
+
+function getTestCases( ) {
+
+
+ var UTC_FEB_29_2000 = TIME_2000 + msPerDay*31 + msPerDay*28;
+ var PST_FEB_29_2000 = UTC_FEB_29_2000 + 8*msPerHour;
+
+ // Dates around Feb 29, 2000
+ addNewTestCase( new Date(2000,1,28,16,0,0,0),
+ "new Date(2000,1,28,16,0,0,0)",
+ [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0,0] );
+
+ addNewTestCase( new Date(2000,1,29,0,0,0,0),
+ "new Date(2000,1,29,0,0,0,0)",
+ [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+
+ addNewTestCase( new Date(2000,1,29,24,0,0,0),
+ "new Date(2000,1,29,24,0,0,0)",
+ [PST_FEB_29_2000+msPerDay,2000,2,1,3,8,0,0,0,2000,2,1,3,0,0,0,0] );
+/*
+ // Dates around Jan 1, 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001) +
+ TimeInYear(2002)+ TimeInYear(2003) + TimeInYear(2004);
+ var PST_JAN_1_2005 = UTC_JAN_1_2005 + 8*msPerHour;
+
+ addNewTestCase( new Date(2005,0,1,0,0,0,0),
+ "new Date(2005,0,1,0,0,0,0)",
+ [PST_JAN_1_2005,2005,0,1,6,8,0,0,0,2005,0,1,6,0,0,0,0] );
+
+ addNewTestCase( new Date(2004,11,31,16,0,0,0),
+ "new Date(2004,11,31,16,0,0,0)",
+ [UTC_JAN_1_2005,2005,0,1,6,0,0,0,0,2004,11,31,5,16,0,0,0] );
+*/
+/*
+ This test case is incorrect. Need to fix the DaylightSavings functions in
+ shell.js for this to work properly.
+
+ // Daylight Savings Time
+
+ var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour )
+
+ addNewTestCase( new Date(1998,3,5,1,59,59,999),
+ "new Date(1998,3,5,1,59,59,999)",
+ [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] );
+
+ addNewTestCase( new Date(1998,3,5,2,0,0,0),
+ "new Date(1998,3,5,2,0,0,0)",
+ [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]);
+
+ var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour );
+
+ addNewTestCase ( new Date(1998,9,25,1,59,59,999),
+ "new Date(1998,9,25,1,59,59,999)",
+ [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] );
+
+ addNewTestCase ( new Date(1998,9,25,2,0,0,0),
+ "new Date(1998,9,25,2,0,0,0)",
+ [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] );
+*/
+}
+
+function addNewTestCase( DateCase, DateString, ResultArray ) {
+ //adjust hard-coded ResultArray for tester's timezone instead of PST
+ adjustResultArray(ResultArray);
+
+ item = testcases.length;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
+
+}
+
+function test() {
+ for( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = " +
+ testcases[tc].actual );
+ }
+ stopTest();
+ return testcases;
+}
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.2-5.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.2-5.js
new file mode 100644
index 0000000..798320b
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.2-5.js
@@ -0,0 +1,170 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.3.1.js
+ ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms)
+ Description: The [[Prototype]] property of the newly constructed
+ object is set to the original Date prototype object,
+ the one that is the initial value of Date.prototype.
+
+ The [[Class]] property of the newly constructed object
+ is set as follows:
+ 1. Call ToNumber(year)
+ 2. Call ToNumber(month)
+ 3. Call ToNumber(date)
+ 4. Call ToNumber(hours)
+ 5. Call ToNumber(minutes)
+ 6. Call ToNumber(seconds)
+ 7. Call ToNumber(ms)
+ 8. If Result(1)is NaN and 0 <= ToInteger(Result(1)) <=
+ 99, Result(8) is 1900+ToInteger(Result(1)); otherwise,
+ Result(8) is Result(1)
+ 9. Compute MakeDay(Result(8), Result(2), Result(3)
+ 10. Compute MakeTime(Result(4), Result(5), Result(6),
+ Result(7)
+ 11. Compute MakeDate(Result(9), Result(10))
+ 12. Set the [[Value]] property of the newly constructed
+ object to TimeClip(UTC(Result(11))).
+
+
+ This tests the returned value of a newly constructed
+ Date object.
+
+ Author: christine@netscape.com
+ Date: 7 july 1997
+*/
+
+ var TIME = 0;
+ var UTC_YEAR = 1;
+ var UTC_MONTH = 2;
+ var UTC_DATE = 3;
+ var UTC_DAY = 4;
+ var UTC_HOURS = 5;
+ var UTC_MINUTES = 6;
+ var UTC_SECONDS = 7;
+ var UTC_MS = 8;
+
+ var YEAR = 9;
+ var MONTH = 10;
+ var DATE = 11;
+ var DAY = 12;
+ var HOURS = 13;
+ var MINUTES = 14;
+ var SECONDS = 15;
+ var MS = 16;
+
+// for TCMS, the testcases array must be global.
+ var SECTION = "15.9.3.1";
+ var TITLE = "Date( year, month, date, hours, minutes, seconds )";
+
+ writeHeaderToLog( SECTION+" " +TITLE );
+
+ var testcases = new Array();
+ getTestCases();
+
+// all tests must call a function that returns an array of TestCase object
+ test();
+
+function getTestCases( ) {
+
+ // Dates around Jan 1, 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001) +
+ TimeInYear(2002)+ TimeInYear(2003) + TimeInYear(2004);
+ var PST_JAN_1_2005 = UTC_JAN_1_2005 + 8*msPerHour;
+
+ addNewTestCase( new Date(2005,0,1,0,0,0,0),
+ "new Date(2005,0,1,0,0,0,0)",
+ [PST_JAN_1_2005,2005,0,1,6,8,0,0,0,2005,0,1,6,0,0,0,0] );
+
+ addNewTestCase( new Date(2004,11,31,16,0,0,0),
+ "new Date(2004,11,31,16,0,0,0)",
+ [UTC_JAN_1_2005,2005,0,1,6,0,0,0,0,2004,11,31,5,16,0,0,0] );
+/*
+ This test case is incorrect. Need to fix the DaylightSavings functions in
+ shell.js for this to work properly.
+
+ // Daylight Savings Time
+
+ var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour )
+
+ addNewTestCase( new Date(1998,3,5,1,59,59,999),
+ "new Date(1998,3,5,1,59,59,999)",
+ [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] );
+
+ addNewTestCase( new Date(1998,3,5,2,0,0,0),
+ "new Date(1998,3,5,2,0,0,0)",
+ [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]);
+
+ var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour );
+
+ addNewTestCase ( new Date(1998,9,25,1,59,59,999),
+ "new Date(1998,9,25,1,59,59,999)",
+ [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] );
+
+ addNewTestCase ( new Date(1998,9,25,2,0,0,0),
+ "new Date(1998,9,25,2,0,0,0)",
+ [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] );
+*/
+}
+
+function addNewTestCase( DateCase, DateString, ResultArray ) {
+ //adjust hard-coded ResultArray for tester's timezone instead of PST
+ adjustResultArray(ResultArray);
+
+ item = testcases.length;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
+
+}
+
+function test() {
+ for( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = " +
+ testcases[tc].actual );
+ }
+ stopTest();
+ return testcases;
+}
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.8-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.8-1.js
new file mode 100644
index 0000000..644f37c
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.8-1.js
@@ -0,0 +1,300 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.3.8.js
+ ECMA Section: 15.9.3.8 The Date Constructor
+ new Date( value )
+ Description: The [[Prototype]] property of the newly constructed
+ object is set to the original Date prototype object,
+ the one that is the initial valiue of Date.prototype.
+
+ The [[Class]] property of the newly constructed object is
+ set to "Date".
+
+ The [[Value]] property of the newly constructed object is
+ set as follows:
+
+ 1. Call ToPrimitive(value)
+ 2. If Type( Result(1) ) is String, then go to step 5.
+ 3. Let V be ToNumber( Result(1) ).
+ 4. Set the [[Value]] property of the newly constructed
+ object to TimeClip(V) and return.
+ 5. Parse Result(1) as a date, in exactly the same manner
+ as for the parse method. Let V be the time value for
+ this date.
+ 6. Go to step 4.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+ Version: 9706
+
+*/
+
+ var VERSION = "ECMA_1";
+ startTest();
+ var SECTION = "15.9.3.8";
+ var TYPEOF = "object";
+
+ var TIME = 0;
+ var UTC_YEAR = 1;
+ var UTC_MONTH = 2;
+ var UTC_DATE = 3;
+ var UTC_DAY = 4;
+ var UTC_HOURS = 5;
+ var UTC_MINUTES = 6;
+ var UTC_SECONDS = 7;
+ var UTC_MS = 8;
+
+ var YEAR = 9;
+ var MONTH = 10;
+ var DATE = 11;
+ var DAY = 12;
+ var HOURS = 13;
+ var MINUTES = 14;
+ var SECONDS = 15;
+ var MS = 16;
+
+
+// for TCMS, the testcases array must be global.
+ var tc= 0;
+ var TITLE = "Date constructor: new Date( value )";
+ var SECTION = "15.9.3.8";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION +" " + TITLE );
+
+ testcases = new Array();
+ getTestCases();
+
+// all tests must call a function that returns a boolean value
+ test();
+
+function getTestCases( ) {
+ // all the "ResultArrays" below are hard-coded to Pacific Standard Time values -
+ var TZ_ADJUST = -TZ_PST * msPerHour;
+
+
+ // Dates around 1970
+ addNewTestCase( new Date(0),
+ "new Date(0)",
+ [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] );
+
+ addNewTestCase( new Date(1),
+ "new Date(1)",
+ [1,1970,0,1,4,0,0,0,1,1969,11,31,3,16,0,0,1] );
+
+ addNewTestCase( new Date(true),
+ "new Date(true)",
+ [1,1970,0,1,4,0,0,0,1,1969,11,31,3,16,0,0,1] );
+
+ addNewTestCase( new Date(false),
+ "new Date(false)",
+ [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(0)).toString() ),
+ "new Date(\""+ (new Date(0)).toString()+"\" )",
+ [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] );
+/*
+// addNewTestCase( "new Date(\""+ (new Date(0)).toLocaleString()+"\")", [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] );
+
+ addNewTestCase( new Date((new Date(0)).toUTCString()),
+ "new Date(\""+ (new Date(0)).toUTCString()+"\" )",
+ [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] );
+
+ addNewTestCase( new Date((new Date(1)).toString()),
+ "new Date(\""+ (new Date(1)).toString()+"\" )",
+ [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] );
+
+ addNewTestCase( new Date( TZ_ADJUST ),
+ "new Date(" + TZ_ADJUST+")",
+ [TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
+
+ addNewTestCase( new Date((new Date(TZ_ADJUST)).toString()),
+ "new Date(\""+ (new Date(TZ_ADJUST)).toString()+"\")",
+ [TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
+
+// addNewTestCase( "new Date(\""+ (new Date(TZ_ADJUST)).toLocaleString()+"\")",[TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(TZ_ADJUST)).toUTCString() ),
+ "new Date(\""+ (new Date(TZ_ADJUST)).toUTCString()+"\")",
+ [TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
+
+ // Dates around 2000
+
+ addNewTestCase( new Date(TIME_2000+TZ_ADJUST),
+ "new Date(" +(TIME_2000+TZ_ADJUST)+")",
+ [TIME_2000+TZ_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] );
+
+ addNewTestCase( new Date(TIME_2000),
+ "new Date(" +TIME_2000+")",
+ [TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5,16,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(TIME_2000+TZ_ADJUST)).toString()),
+ "new Date(\"" +(new Date(TIME_2000+TZ_ADJUST)).toString()+"\")",
+ [TIME_2000+TZ_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] );
+
+ addNewTestCase( new Date((new Date(TIME_2000)).toString()),
+ "new Date(\"" +(new Date(TIME_2000)).toString()+"\")",
+ [TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5,16,0,0,0] );
+
+// addNewTestCase( "new Date(\"" +(new Date(TIME_2000+TZ_ADJUST)).toLocaleString()+"\")", [TIME_2000+TZ_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] );
+// addNewTestCase( "new Date(\"" +(new Date(TIME_2000)).toLocaleString()+"\")", [TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5,16,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(TIME_2000+TZ_ADJUST)).toUTCString()),
+ "new Date(\"" +(new Date(TIME_2000+TZ_ADJUST)).toUTCString()+"\")",
+ [TIME_2000+TZ_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(TIME_2000)).toUTCString()),
+ "new Date(\"" +(new Date(TIME_2000)).toUTCString()+"\")",
+ [TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5,16,0,0,0] );
+
+ // Dates around Feb 29, 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerDay;
+ var PST_FEB_29_2000 = UTC_FEB_29_2000 + TZ_ADJUST;
+
+ addNewTestCase( new Date(UTC_FEB_29_2000),
+ "new Date("+UTC_FEB_29_2000+")",
+ [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] );
+
+ addNewTestCase( new Date(PST_FEB_29_2000),
+ "new Date("+PST_FEB_29_2000+")",
+ [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(UTC_FEB_29_2000)).toString() ),
+ "new Date(\""+(new Date(UTC_FEB_29_2000)).toString()+"\")",
+ [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(PST_FEB_29_2000)).toString() ),
+ "new Date(\""+(new Date(PST_FEB_29_2000)).toString()+"\")",
+ [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+
+// Parsing toLocaleString() is not guaranteed by ECMA.
+// addNewTestCase( "new Date(\""+(new Date(UTC_FEB_29_2000)).toLocaleString()+"\")", [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] );
+// addNewTestCase( "new Date(\""+(new Date(PST_FEB_29_2000)).toLocaleString()+"\")", [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(UTC_FEB_29_2000)).toGMTString() ),
+ "new Date(\""+(new Date(UTC_FEB_29_2000)).toGMTString()+"\")",
+ [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(PST_FEB_29_2000)).toGMTString() ),
+ "new Date(\""+(new Date(PST_FEB_29_2000)).toGMTString()+"\")",
+ [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+
+ // Dates around 1900
+
+ var PST_1900 = TIME_1900 + 8*msPerHour;
+
+ addNewTestCase( new Date( TIME_1900 ),
+ "new Date("+TIME_1900+")",
+ [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+
+ addNewTestCase( new Date(PST_1900),
+ "new Date("+PST_1900+")",
+ [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(TIME_1900)).toString() ),
+ "new Date(\""+(new Date(TIME_1900)).toString()+"\")",
+ [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(PST_1900)).toString() ),
+ "new Date(\""+(new Date(PST_1900 )).toString()+"\")",
+ [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(TIME_1900)).toUTCString() ),
+ "new Date(\""+(new Date(TIME_1900)).toUTCString()+"\")",
+ [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(PST_1900)).toUTCString() ),
+ "new Date(\""+(new Date(PST_1900 )).toUTCString()+"\")",
+ [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+
+// addNewTestCase( "new Date(\""+(new Date(TIME_1900)).toLocaleString()+"\")", [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+// addNewTestCase( "new Date(\""+(new Date(PST_1900 )).toLocaleString()+"\")", [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+*/
+/*
+ This test case is incorrect. Need to fix the DaylightSavings functions in
+ shell.js for this to work properly.
+
+ var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour )
+
+ addNewTestCase( new Date(DST_START_1998-1),
+ "new Date("+(DST_START_1998-1)+")",
+ [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] );
+
+ addNewTestCase( new Date(DST_START_1998),
+ "new Date("+DST_START_1998+")",
+ [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]);
+
+ var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour );
+
+ addNewTestCase ( new Date(DST_END_1998-1),
+ "new Date("+(DST_END_1998-1)+")",
+ [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] );
+
+ addNewTestCase ( new Date(DST_END_1998),
+ "new Date("+DST_END_1998+")",
+ [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] );
+*/
+}
+
+function addNewTestCase( DateCase, DateString, ResultArray ) {
+ //adjust hard-coded ResultArray for tester's timezone instead of PST
+ adjustResultArray(ResultArray, 'msMode');
+
+ item = testcases.length;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
+}
+
+function test() {
+ for( tc = 0; tc < testcases.length; tc++ ) {
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = " +
+ testcases[tc].actual );
+ }
+ stopTest();
+
+ // all tests must return a boolean value
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.8-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.8-2.js
new file mode 100644
index 0000000..4cfcb04
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.8-2.js
@@ -0,0 +1,275 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.3.8.js
+ ECMA Section: 15.9.3.8 The Date Constructor
+ new Date( value )
+ Description: The [[Prototype]] property of the newly constructed
+ object is set to the original Date prototype object,
+ the one that is the initial valiue of Date.prototype.
+
+ The [[Class]] property of the newly constructed object is
+ set to "Date".
+
+ The [[Value]] property of the newly constructed object is
+ set as follows:
+
+ 1. Call ToPrimitive(value)
+ 2. If Type( Result(1) ) is String, then go to step 5.
+ 3. Let V be ToNumber( Result(1) ).
+ 4. Set the [[Value]] property of the newly constructed
+ object to TimeClip(V) and return.
+ 5. Parse Result(1) as a date, in exactly the same manner
+ as for the parse method. Let V be the time value for
+ this date.
+ 6. Go to step 4.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+ Version: 9706
+
+*/
+
+ var VERSION = "ECMA_1";
+ startTest();
+ var SECTION = "15.9.3.8";
+ var TYPEOF = "object";
+
+ var TIME = 0;
+ var UTC_YEAR = 1;
+ var UTC_MONTH = 2;
+ var UTC_DATE = 3;
+ var UTC_DAY = 4;
+ var UTC_HOURS = 5;
+ var UTC_MINUTES = 6;
+ var UTC_SECONDS = 7;
+ var UTC_MS = 8;
+
+ var YEAR = 9;
+ var MONTH = 10;
+ var DATE = 11;
+ var DAY = 12;
+ var HOURS = 13;
+ var MINUTES = 14;
+ var SECONDS = 15;
+ var MS = 16;
+
+
+// for TCMS, the testcases array must be global.
+ var tc= 0;
+ var TITLE = "Date constructor: new Date( value )";
+ var SECTION = "15.9.3.8";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION +" " + TITLE );
+
+ testcases = new Array();
+ getTestCases();
+
+// all tests must call a function that returns a boolean value
+ test();
+
+function getTestCases( ) {
+ // all the "ResultArrays" below are hard-coded to Pacific Standard Time values -
+ var TZ_ADJUST = -TZ_PST * msPerHour;
+
+ addNewTestCase( new Date((new Date(0)).toUTCString()),
+ "new Date(\""+ (new Date(0)).toUTCString()+"\" )",
+ [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] );
+
+ addNewTestCase( new Date((new Date(1)).toString()),
+ "new Date(\""+ (new Date(1)).toString()+"\" )",
+ [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] );
+
+ addNewTestCase( new Date( TZ_ADJUST ),
+ "new Date(" + TZ_ADJUST+")",
+ [TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
+
+ addNewTestCase( new Date((new Date(TZ_ADJUST)).toString()),
+ "new Date(\""+ (new Date(TZ_ADJUST)).toString()+"\")",
+ [TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
+
+
+ addNewTestCase( new Date( (new Date(TZ_ADJUST)).toUTCString() ),
+ "new Date(\""+ (new Date(TZ_ADJUST)).toUTCString()+"\")",
+ [TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
+/*
+ // Dates around 2000
+
+ addNewTestCase( new Date(TIME_2000+TZ_ADJUST),
+ "new Date(" +(TIME_2000+TZ_ADJUST)+")",
+ [TIME_2000+TZ_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] );
+
+ addNewTestCase( new Date(TIME_2000),
+ "new Date(" +TIME_2000+")",
+ [TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5,16,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(TIME_2000+TZ_ADJUST)).toString()),
+ "new Date(\"" +(new Date(TIME_2000+TZ_ADJUST)).toString()+"\")",
+ [TIME_2000+TZ_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] );
+
+ addNewTestCase( new Date((new Date(TIME_2000)).toString()),
+ "new Date(\"" +(new Date(TIME_2000)).toString()+"\")",
+ [TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5,16,0,0,0] );
+
+// addNewTestCase( "new Date(\"" +(new Date(TIME_2000+TZ_ADJUST)).toLocaleString()+"\")", [TIME_2000+TZ_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] );
+// addNewTestCase( "new Date(\"" +(new Date(TIME_2000)).toLocaleString()+"\")", [TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5,16,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(TIME_2000+TZ_ADJUST)).toUTCString()),
+ "new Date(\"" +(new Date(TIME_2000+TZ_ADJUST)).toUTCString()+"\")",
+ [TIME_2000+TZ_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(TIME_2000)).toUTCString()),
+ "new Date(\"" +(new Date(TIME_2000)).toUTCString()+"\")",
+ [TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5,16,0,0,0] );
+
+ // Dates around Feb 29, 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerDay;
+ var PST_FEB_29_2000 = UTC_FEB_29_2000 + TZ_ADJUST;
+
+ addNewTestCase( new Date(UTC_FEB_29_2000),
+ "new Date("+UTC_FEB_29_2000+")",
+ [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] );
+
+ addNewTestCase( new Date(PST_FEB_29_2000),
+ "new Date("+PST_FEB_29_2000+")",
+ [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(UTC_FEB_29_2000)).toString() ),
+ "new Date(\""+(new Date(UTC_FEB_29_2000)).toString()+"\")",
+ [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(PST_FEB_29_2000)).toString() ),
+ "new Date(\""+(new Date(PST_FEB_29_2000)).toString()+"\")",
+ [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+
+// Parsing toLocaleString() is not guaranteed by ECMA.
+// addNewTestCase( "new Date(\""+(new Date(UTC_FEB_29_2000)).toLocaleString()+"\")", [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] );
+// addNewTestCase( "new Date(\""+(new Date(PST_FEB_29_2000)).toLocaleString()+"\")", [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(UTC_FEB_29_2000)).toGMTString() ),
+ "new Date(\""+(new Date(UTC_FEB_29_2000)).toGMTString()+"\")",
+ [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(PST_FEB_29_2000)).toGMTString() ),
+ "new Date(\""+(new Date(PST_FEB_29_2000)).toGMTString()+"\")",
+ [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+
+ // Dates around 1900
+
+ var PST_1900 = TIME_1900 + 8*msPerHour;
+
+ addNewTestCase( new Date( TIME_1900 ),
+ "new Date("+TIME_1900+")",
+ [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+
+ addNewTestCase( new Date(PST_1900),
+ "new Date("+PST_1900+")",
+ [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(TIME_1900)).toString() ),
+ "new Date(\""+(new Date(TIME_1900)).toString()+"\")",
+ [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(PST_1900)).toString() ),
+ "new Date(\""+(new Date(PST_1900 )).toString()+"\")",
+ [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(TIME_1900)).toUTCString() ),
+ "new Date(\""+(new Date(TIME_1900)).toUTCString()+"\")",
+ [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(PST_1900)).toUTCString() ),
+ "new Date(\""+(new Date(PST_1900 )).toUTCString()+"\")",
+ [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+
+// addNewTestCase( "new Date(\""+(new Date(TIME_1900)).toLocaleString()+"\")", [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+// addNewTestCase( "new Date(\""+(new Date(PST_1900 )).toLocaleString()+"\")", [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+*/
+/*
+ This test case is incorrect. Need to fix the DaylightSavings functions in
+ shell.js for this to work properly.
+
+ var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour )
+
+ addNewTestCase( new Date(DST_START_1998-1),
+ "new Date("+(DST_START_1998-1)+")",
+ [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] );
+
+ addNewTestCase( new Date(DST_START_1998),
+ "new Date("+DST_START_1998+")",
+ [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]);
+
+ var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour );
+
+ addNewTestCase ( new Date(DST_END_1998-1),
+ "new Date("+(DST_END_1998-1)+")",
+ [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] );
+
+ addNewTestCase ( new Date(DST_END_1998),
+ "new Date("+DST_END_1998+")",
+ [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] );
+*/
+}
+
+function addNewTestCase( DateCase, DateString, ResultArray ) {
+ //adjust hard-coded ResultArray for tester's timezone instead of PST
+ adjustResultArray(ResultArray, 'msMode');
+
+ item = testcases.length;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
+}
+
+function test() {
+ for( tc = 0; tc < testcases.length; tc++ ) {
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = " +
+ testcases[tc].actual );
+ }
+ stopTest();
+
+ // all tests must return a boolean value
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.8-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.8-3.js
new file mode 100644
index 0000000..aaf430d
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.8-3.js
@@ -0,0 +1,253 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.3.8.js
+ ECMA Section: 15.9.3.8 The Date Constructor
+ new Date( value )
+ Description: The [[Prototype]] property of the newly constructed
+ object is set to the original Date prototype object,
+ the one that is the initial valiue of Date.prototype.
+
+ The [[Class]] property of the newly constructed object is
+ set to "Date".
+
+ The [[Value]] property of the newly constructed object is
+ set as follows:
+
+ 1. Call ToPrimitive(value)
+ 2. If Type( Result(1) ) is String, then go to step 5.
+ 3. Let V be ToNumber( Result(1) ).
+ 4. Set the [[Value]] property of the newly constructed
+ object to TimeClip(V) and return.
+ 5. Parse Result(1) as a date, in exactly the same manner
+ as for the parse method. Let V be the time value for
+ this date.
+ 6. Go to step 4.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+ Version: 9706
+
+*/
+
+ var VERSION = "ECMA_1";
+ startTest();
+ var SECTION = "15.9.3.8";
+ var TYPEOF = "object";
+
+ var TIME = 0;
+ var UTC_YEAR = 1;
+ var UTC_MONTH = 2;
+ var UTC_DATE = 3;
+ var UTC_DAY = 4;
+ var UTC_HOURS = 5;
+ var UTC_MINUTES = 6;
+ var UTC_SECONDS = 7;
+ var UTC_MS = 8;
+
+ var YEAR = 9;
+ var MONTH = 10;
+ var DATE = 11;
+ var DAY = 12;
+ var HOURS = 13;
+ var MINUTES = 14;
+ var SECONDS = 15;
+ var MS = 16;
+
+
+// for TCMS, the testcases array must be global.
+ var tc= 0;
+ var TITLE = "Date constructor: new Date( value )";
+ var SECTION = "15.9.3.8";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION +" " + TITLE );
+
+ testcases = new Array();
+ getTestCases();
+
+// all tests must call a function that returns a boolean value
+ test();
+
+function getTestCases( ) {
+ // all the "ResultArrays" below are hard-coded to Pacific Standard Time values -
+ var TZ_ADJUST = -TZ_PST * msPerHour;
+
+
+ // Dates around 2000
+
+ addNewTestCase( new Date(TIME_2000+TZ_ADJUST),
+ "new Date(" +(TIME_2000+TZ_ADJUST)+")",
+ [TIME_2000+TZ_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] );
+
+ addNewTestCase( new Date(TIME_2000),
+ "new Date(" +TIME_2000+")",
+ [TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5,16,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(TIME_2000+TZ_ADJUST)).toString()),
+ "new Date(\"" +(new Date(TIME_2000+TZ_ADJUST)).toString()+"\")",
+ [TIME_2000+TZ_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] );
+
+ addNewTestCase( new Date((new Date(TIME_2000)).toString()),
+ "new Date(\"" +(new Date(TIME_2000)).toString()+"\")",
+ [TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5,16,0,0,0] );
+
+
+ addNewTestCase( new Date( (new Date(TIME_2000+TZ_ADJUST)).toUTCString()),
+ "new Date(\"" +(new Date(TIME_2000+TZ_ADJUST)).toUTCString()+"\")",
+ [TIME_2000+TZ_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(TIME_2000)).toUTCString()),
+ "new Date(\"" +(new Date(TIME_2000)).toUTCString()+"\")",
+ [TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5,16,0,0,0] );
+/*
+ // Dates around Feb 29, 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerDay;
+ var PST_FEB_29_2000 = UTC_FEB_29_2000 + TZ_ADJUST;
+
+ addNewTestCase( new Date(UTC_FEB_29_2000),
+ "new Date("+UTC_FEB_29_2000+")",
+ [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] );
+
+ addNewTestCase( new Date(PST_FEB_29_2000),
+ "new Date("+PST_FEB_29_2000+")",
+ [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(UTC_FEB_29_2000)).toString() ),
+ "new Date(\""+(new Date(UTC_FEB_29_2000)).toString()+"\")",
+ [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(PST_FEB_29_2000)).toString() ),
+ "new Date(\""+(new Date(PST_FEB_29_2000)).toString()+"\")",
+ [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+
+// Parsing toLocaleString() is not guaranteed by ECMA.
+// addNewTestCase( "new Date(\""+(new Date(UTC_FEB_29_2000)).toLocaleString()+"\")", [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] );
+// addNewTestCase( "new Date(\""+(new Date(PST_FEB_29_2000)).toLocaleString()+"\")", [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(UTC_FEB_29_2000)).toGMTString() ),
+ "new Date(\""+(new Date(UTC_FEB_29_2000)).toGMTString()+"\")",
+ [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(PST_FEB_29_2000)).toGMTString() ),
+ "new Date(\""+(new Date(PST_FEB_29_2000)).toGMTString()+"\")",
+ [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+
+ // Dates around 1900
+
+ var PST_1900 = TIME_1900 + 8*msPerHour;
+
+ addNewTestCase( new Date( TIME_1900 ),
+ "new Date("+TIME_1900+")",
+ [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+
+ addNewTestCase( new Date(PST_1900),
+ "new Date("+PST_1900+")",
+ [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(TIME_1900)).toString() ),
+ "new Date(\""+(new Date(TIME_1900)).toString()+"\")",
+ [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(PST_1900)).toString() ),
+ "new Date(\""+(new Date(PST_1900 )).toString()+"\")",
+ [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(TIME_1900)).toUTCString() ),
+ "new Date(\""+(new Date(TIME_1900)).toUTCString()+"\")",
+ [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(PST_1900)).toUTCString() ),
+ "new Date(\""+(new Date(PST_1900 )).toUTCString()+"\")",
+ [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+
+// addNewTestCase( "new Date(\""+(new Date(TIME_1900)).toLocaleString()+"\")", [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+// addNewTestCase( "new Date(\""+(new Date(PST_1900 )).toLocaleString()+"\")", [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+*/
+/*
+ This test case is incorrect. Need to fix the DaylightSavings functions in
+ shell.js for this to work properly.
+
+ var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour )
+
+ addNewTestCase( new Date(DST_START_1998-1),
+ "new Date("+(DST_START_1998-1)+")",
+ [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] );
+
+ addNewTestCase( new Date(DST_START_1998),
+ "new Date("+DST_START_1998+")",
+ [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]);
+
+ var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour );
+
+ addNewTestCase ( new Date(DST_END_1998-1),
+ "new Date("+(DST_END_1998-1)+")",
+ [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] );
+
+ addNewTestCase ( new Date(DST_END_1998),
+ "new Date("+DST_END_1998+")",
+ [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] );
+*/
+}
+
+function addNewTestCase( DateCase, DateString, ResultArray ) {
+ //adjust hard-coded ResultArray for tester's timezone instead of PST
+ adjustResultArray(ResultArray, 'msMode');
+
+ item = testcases.length;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
+}
+
+function test() {
+ for( tc = 0; tc < testcases.length; tc++ ) {
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = " +
+ testcases[tc].actual );
+ }
+ stopTest();
+
+ // all tests must return a boolean value
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.8-4.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.8-4.js
new file mode 100644
index 0000000..c25bda8
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.8-4.js
@@ -0,0 +1,222 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.3.8.js
+ ECMA Section: 15.9.3.8 The Date Constructor
+ new Date( value )
+ Description: The [[Prototype]] property of the newly constructed
+ object is set to the original Date prototype object,
+ the one that is the initial valiue of Date.prototype.
+
+ The [[Class]] property of the newly constructed object is
+ set to "Date".
+
+ The [[Value]] property of the newly constructed object is
+ set as follows:
+
+ 1. Call ToPrimitive(value)
+ 2. If Type( Result(1) ) is String, then go to step 5.
+ 3. Let V be ToNumber( Result(1) ).
+ 4. Set the [[Value]] property of the newly constructed
+ object to TimeClip(V) and return.
+ 5. Parse Result(1) as a date, in exactly the same manner
+ as for the parse method. Let V be the time value for
+ this date.
+ 6. Go to step 4.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+ Version: 9706
+
+*/
+
+ var VERSION = "ECMA_1";
+ startTest();
+ var SECTION = "15.9.3.8";
+ var TYPEOF = "object";
+
+ var TIME = 0;
+ var UTC_YEAR = 1;
+ var UTC_MONTH = 2;
+ var UTC_DATE = 3;
+ var UTC_DAY = 4;
+ var UTC_HOURS = 5;
+ var UTC_MINUTES = 6;
+ var UTC_SECONDS = 7;
+ var UTC_MS = 8;
+
+ var YEAR = 9;
+ var MONTH = 10;
+ var DATE = 11;
+ var DAY = 12;
+ var HOURS = 13;
+ var MINUTES = 14;
+ var SECONDS = 15;
+ var MS = 16;
+
+
+// for TCMS, the testcases array must be global.
+ var tc= 0;
+ var TITLE = "Date constructor: new Date( value )";
+ var SECTION = "15.9.3.8";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION +" " + TITLE );
+
+ testcases = new Array();
+ getTestCases();
+
+// all tests must call a function that returns a boolean value
+ test();
+
+function getTestCases( ) {
+ // all the "ResultArrays" below are hard-coded to Pacific Standard Time values -
+ var TZ_ADJUST = -TZ_PST * msPerHour;
+
+ // Dates around Feb 29, 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerDay;
+ var PST_FEB_29_2000 = UTC_FEB_29_2000 + TZ_ADJUST;
+
+ addNewTestCase( new Date(UTC_FEB_29_2000),
+ "new Date("+UTC_FEB_29_2000+")",
+ [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] );
+
+ addNewTestCase( new Date(PST_FEB_29_2000),
+ "new Date("+PST_FEB_29_2000+")",
+ [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(UTC_FEB_29_2000)).toString() ),
+ "new Date(\""+(new Date(UTC_FEB_29_2000)).toString()+"\")",
+ [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(PST_FEB_29_2000)).toString() ),
+ "new Date(\""+(new Date(PST_FEB_29_2000)).toString()+"\")",
+ [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+
+
+ addNewTestCase( new Date( (new Date(UTC_FEB_29_2000)).toGMTString() ),
+ "new Date(\""+(new Date(UTC_FEB_29_2000)).toGMTString()+"\")",
+ [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(PST_FEB_29_2000)).toGMTString() ),
+ "new Date(\""+(new Date(PST_FEB_29_2000)).toGMTString()+"\")",
+ [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+/*
+ // Dates around 1900
+
+ var PST_1900 = TIME_1900 + 8*msPerHour;
+
+ addNewTestCase( new Date( TIME_1900 ),
+ "new Date("+TIME_1900+")",
+ [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+
+ addNewTestCase( new Date(PST_1900),
+ "new Date("+PST_1900+")",
+ [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(TIME_1900)).toString() ),
+ "new Date(\""+(new Date(TIME_1900)).toString()+"\")",
+ [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(PST_1900)).toString() ),
+ "new Date(\""+(new Date(PST_1900 )).toString()+"\")",
+ [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(TIME_1900)).toUTCString() ),
+ "new Date(\""+(new Date(TIME_1900)).toUTCString()+"\")",
+ [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(PST_1900)).toUTCString() ),
+ "new Date(\""+(new Date(PST_1900 )).toUTCString()+"\")",
+ [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+
+// addNewTestCase( "new Date(\""+(new Date(TIME_1900)).toLocaleString()+"\")", [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+// addNewTestCase( "new Date(\""+(new Date(PST_1900 )).toLocaleString()+"\")", [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+*/
+/*
+ This test case is incorrect. Need to fix the DaylightSavings functions in
+ shell.js for this to work properly.
+
+ var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour )
+
+ addNewTestCase( new Date(DST_START_1998-1),
+ "new Date("+(DST_START_1998-1)+")",
+ [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] );
+
+ addNewTestCase( new Date(DST_START_1998),
+ "new Date("+DST_START_1998+")",
+ [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]);
+
+ var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour );
+
+ addNewTestCase ( new Date(DST_END_1998-1),
+ "new Date("+(DST_END_1998-1)+")",
+ [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] );
+
+ addNewTestCase ( new Date(DST_END_1998),
+ "new Date("+DST_END_1998+")",
+ [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] );
+*/
+}
+
+function addNewTestCase( DateCase, DateString, ResultArray ) {
+ //adjust hard-coded ResultArray for tester's timezone instead of PST
+ adjustResultArray(ResultArray, 'msMode');
+
+ item = testcases.length;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
+}
+
+function test() {
+ for( tc = 0; tc < testcases.length; tc++ ) {
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = " +
+ testcases[tc].actual );
+ }
+ stopTest();
+
+ // all tests must return a boolean value
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.8-5.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.8-5.js
new file mode 100644
index 0000000..00b3b47
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.8-5.js
@@ -0,0 +1,190 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.3.8.js
+ ECMA Section: 15.9.3.8 The Date Constructor
+ new Date( value )
+ Description: The [[Prototype]] property of the newly constructed
+ object is set to the original Date prototype object,
+ the one that is the initial valiue of Date.prototype.
+
+ The [[Class]] property of the newly constructed object is
+ set to "Date".
+
+ The [[Value]] property of the newly constructed object is
+ set as follows:
+
+ 1. Call ToPrimitive(value)
+ 2. If Type( Result(1) ) is String, then go to step 5.
+ 3. Let V be ToNumber( Result(1) ).
+ 4. Set the [[Value]] property of the newly constructed
+ object to TimeClip(V) and return.
+ 5. Parse Result(1) as a date, in exactly the same manner
+ as for the parse method. Let V be the time value for
+ this date.
+ 6. Go to step 4.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+ Version: 9706
+
+*/
+
+ var VERSION = "ECMA_1";
+ startTest();
+ var SECTION = "15.9.3.8";
+ var TYPEOF = "object";
+
+ var TIME = 0;
+ var UTC_YEAR = 1;
+ var UTC_MONTH = 2;
+ var UTC_DATE = 3;
+ var UTC_DAY = 4;
+ var UTC_HOURS = 5;
+ var UTC_MINUTES = 6;
+ var UTC_SECONDS = 7;
+ var UTC_MS = 8;
+
+ var YEAR = 9;
+ var MONTH = 10;
+ var DATE = 11;
+ var DAY = 12;
+ var HOURS = 13;
+ var MINUTES = 14;
+ var SECONDS = 15;
+ var MS = 16;
+
+
+// for TCMS, the testcases array must be global.
+ var tc= 0;
+ var TITLE = "Date constructor: new Date( value )";
+ var SECTION = "15.9.3.8";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION +" " + TITLE );
+
+ testcases = new Array();
+ getTestCases();
+
+// all tests must call a function that returns a boolean value
+ test();
+
+function getTestCases( ) {
+ // all the "ResultArrays" below are hard-coded to Pacific Standard Time values -
+ var TZ_ADJUST = -TZ_PST * msPerHour;
+
+
+ // Dates around 1900
+
+ var PST_1900 = TIME_1900 + 8*msPerHour;
+
+ addNewTestCase( new Date( TIME_1900 ),
+ "new Date("+TIME_1900+")",
+ [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+
+ addNewTestCase( new Date(PST_1900),
+ "new Date("+PST_1900+")",
+ [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(TIME_1900)).toString() ),
+ "new Date(\""+(new Date(TIME_1900)).toString()+"\")",
+ [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(PST_1900)).toString() ),
+ "new Date(\""+(new Date(PST_1900 )).toString()+"\")",
+ [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(TIME_1900)).toUTCString() ),
+ "new Date(\""+(new Date(TIME_1900)).toUTCString()+"\")",
+ [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(PST_1900)).toUTCString() ),
+ "new Date(\""+(new Date(PST_1900 )).toUTCString()+"\")",
+ [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+
+/*
+ This test case is incorrect. Need to fix the DaylightSavings functions in
+ shell.js for this to work properly.
+
+ var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour )
+
+ addNewTestCase( new Date(DST_START_1998-1),
+ "new Date("+(DST_START_1998-1)+")",
+ [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] );
+
+ addNewTestCase( new Date(DST_START_1998),
+ "new Date("+DST_START_1998+")",
+ [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]);
+
+ var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour );
+
+ addNewTestCase ( new Date(DST_END_1998-1),
+ "new Date("+(DST_END_1998-1)+")",
+ [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] );
+
+ addNewTestCase ( new Date(DST_END_1998),
+ "new Date("+DST_END_1998+")",
+ [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] );
+*/
+}
+
+function addNewTestCase( DateCase, DateString, ResultArray ) {
+ //adjust hard-coded ResultArray for tester's timezone instead of PST
+ adjustResultArray(ResultArray, 'msMode');
+
+ item = testcases.length;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
+}
+
+function test() {
+ for( tc = 0; tc < testcases.length; tc++ ) {
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = " +
+ testcases[tc].actual );
+ }
+ stopTest();
+
+ // all tests must return a boolean value
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.4.2-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.4.2-1.js
new file mode 100644
index 0000000..2fa4cbf
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.4.2-1.js
@@ -0,0 +1,63 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS
+* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+* implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation. All
+* Rights Reserved.
+*
+* Contributor(s):
+*/
+
+/**
+ * File Name:
+ * Reference: http://bugzilla.mozilla.org/show_bug.cgi?id=4088
+ * Description: Date parsing gets 12:30 AM wrong.
+ * New behavior:
+ * js> d = new Date('1/1/1999 13:30 AM')
+ * Invalid Date
+ * js> d = new Date('1/1/1999 13:30 PM')
+ * Invalid Date
+ * js> d = new Date('1/1/1999 12:30 AM')
+ * Fri Jan 01 00:30:00 GMT-0800 (PST) 1999
+ * js> d = new Date('1/1/1999 12:30 PM')
+ * Fri Jan 01 12:30:00 GMT-0800 (PST) 1999
+ * Author: christine@netscape.com
+ */
+
+ var SECTION = "15.9.4.2-1"; // provide a document reference (ie, ECMA section)
+ var VERSION = "ECMA"; // Version of JavaScript or ECMA
+ var TITLE = "Regression Test for Date.parse"; // Provide ECMA section title or a description
+ var BUGNUMBER = "http://bugzilla.mozilla.org/show_bug.cgi?id=4088"; // Provide URL to bugsplat or bugzilla report
+
+ startTest(); // leave this alone
+
+ AddTestCase( "new Date('1/1/1999 12:30 AM').toString()",
+ new Date(1999,0,1,0,30).toString(),
+ new Date('1/1/1999 12:30 AM').toString() );
+
+ AddTestCase( "new Date('1/1/1999 12:30 PM').toString()",
+ new Date( 1999,0,1,12,30 ).toString(),
+ new Date('1/1/1999 12:30 PM').toString() );
+
+ AddTestCase( "new Date('1/1/1999 13:30 AM')",
+ "Invalid Date",
+ new Date('1/1/1999 13:30 AM').toString() );
+
+
+ AddTestCase( "new Date('1/1/1999 13:30 PM')",
+ "Invalid Date",
+ new Date('1/1/1999 13:30 PM').toString() );
+
+ test(); // leave this alone. this executes the test cases and
+ // displays results.
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.4.2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.4.2.js
new file mode 100644
index 0000000..5fd15ba
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.4.2.js
@@ -0,0 +1,213 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.4.2.js
+ ECMA Section: 15.9.4.2 Date.parse()
+ Description: The parse() function applies the to ToString() operator
+ to its argument and interprets the resulting string as
+ a date. It returns a number, the UTC time value
+ corresponding to the date.
+
+ The string may be interpreted as a local time, a UTC
+ time, or a time in some other time zone, depending on
+ the contents of the string.
+
+ (need to test strings containing stuff with the time
+ zone specified, and verify that parse() returns the
+ correct GMT time)
+
+ so for any Date object x, all of these things should
+ be equal:
+
+ value tested in function:
+ x.valueOf() test_value()
+ Date.parse(x.toString()) test_tostring()
+ Date.parse(x.toGMTString()) test_togmt()
+
+ Date.parse(x.toLocaleString()) is not required to
+ produce the same number value as the preceeding three
+ expressions. in general the value produced by
+ Date.parse is implementation dependent when given any
+ string value that could not be produced in that
+ implementation by the toString or toGMTString method.
+
+ value tested in function:
+ Date.parse( x.toLocaleString()) test_tolocale()
+
+ Author: christine@netscape.com
+ Date: 10 july 1997
+
+*/
+
+ var VERSION = "ECMA_1";
+ startTest();
+ var SECTION = "15.9.4.2";
+ var TITLE = "Date.parse()";
+
+ var TIME = 0;
+ var UTC_YEAR = 1;
+ var UTC_MONTH = 2;
+ var UTC_DATE = 3;
+ var UTC_DAY = 4;
+ var UTC_HOURS = 5;
+ var UTC_MINUTES = 6;
+ var UTC_SECONDS = 7;
+ var UTC_MS = 8;
+
+ var YEAR = 9;
+ var MONTH = 10;
+ var DATE = 11;
+ var DAY = 12;
+ var HOURS = 13;
+ var MINUTES = 14;
+ var SECONDS = 15;
+ var MS = 16;
+ var TYPEOF = "object";
+
+// for TCMS, the testcases array must be global.
+ writeHeaderToLog("15.9.4.2 Date.parse()" );
+ var tc= 0;
+ testcases = new Array();
+ getTestCases();
+
+// all tests must call a function that returns an array of TestCase objects.
+ test();
+
+function getTestCases() {
+
+ // Dates around 1970
+
+ addNewTestCase( new Date(0),
+ "new Date(0)",
+ [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] );
+
+ addNewTestCase( new Date(-1),
+ "new Date(-1)",
+ [-1,1969,11,31,3,23,59,59,999,1969,11,31,3,15,59,59,999] );
+ addNewTestCase( new Date(28799999),
+ "new Date(28799999)",
+ [28799999,1970,0,1,4,7,59,59,999,1969,11,31,3,23,59,59,999] );
+ addNewTestCase( new Date(28800000),
+ "new Date(28800000)",
+ [28800000,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
+
+ // Dates around 2000
+
+ addNewTestCase( new Date(946684799999),
+ "new Date(946684799999)",
+ [946684799999,1999,11,31,5,23,59,59,999,1999,11,31,5,15,59,59,999] );
+ addNewTestCase( new Date(946713599999),
+ "new Date(946713599999)",
+ [946713599999,2000,0,1,6,7,59,59,999,1999,11,31,5,23,59,59,999] );
+ addNewTestCase( new Date(946684800000),
+ "new Date(946684800000)",
+ [946684800000,2000,0,1,6,0,0,0,0,1999,11,31,5, 16,0,0,0] );
+ addNewTestCase( new Date(946713600000),
+ "new Date(946713600000)",
+ [946713600000,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] );
+
+ // Dates around 1900
+
+ addNewTestCase( new Date(-2208988800000),
+ "new Date(-2208988800000)",
+ [-2208988800000,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+
+ addNewTestCase( new Date(-2208988800001),
+ "new Date(-2208988800001)",
+ [-2208988800001,1899,11,31,0,23,59,59,999,1899,11,31,0,15,59,59,999] );
+
+ addNewTestCase( new Date(-2208960000001),
+ "new Date(-2208960000001)",
+ [-2208960000001,1900,0,1,1,7,59,59,0,1899,11,31,0,23,59,59,999] );
+ addNewTestCase( new Date(-2208960000000),
+ "new Date(-2208960000000)",
+ [-2208960000000,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+ addNewTestCase( new Date(-2208959999999),
+ "new Date(-2208959999999)",
+ [-2208959999999,1900,0,1,1,8,0,0,1,1900,0,1,1,0,0,0,1] );
+
+ // Dates around Feb 29, 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerDay;
+ var PST_FEB_29_2000 = UTC_FEB_29_2000 + 8*msPerHour;
+ addNewTestCase( new Date(UTC_FEB_29_2000),
+ "new Date(" + UTC_FEB_29_2000 +")",
+ [UTC_FEB_29_2000,2000,0,1,6,0,0,0,0,1999,11,31,5,16,0,0,0] );
+ addNewTestCase( new Date(PST_FEB_29_2000),
+ "new Date(" + PST_FEB_29_2000 +")",
+ [PST_FEB_29_2000,2000,0,1,6,8.0,0,0,2000,0,1,6,0,0,0,0]);
+
+ // Dates around Jan 1 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001) +
+ TimeInYear(2002) + TimeInYear(2003) + TimeInYear(2004);
+ var PST_JAN_1_2005 = UTC_JAN_1_2005 + 8*msPerHour;
+
+ addNewTestCase( new Date(UTC_JAN_1_2005),
+ "new Date("+ UTC_JAN_1_2005 +")",
+ [UTC_JAN_1_2005,2005,0,1,6,0,0,0,0,2004,11,31,5,16,0,0,0] );
+ addNewTestCase( new Date(PST_JAN_1_2005),
+ "new Date("+ PST_JAN_1_2005 +")",
+ [PST_JAN_1_2005,2005,0,1,6,8,0,0,0,2005,0,1,6,0,0,0,0] );
+
+}
+function addNewTestCase( DateCase, DateString, ResultArray ) {
+ DateCase = DateCase;
+
+ item = testcases.length;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
+ testcases[item++] = new TestCase( SECTION, "Date.parse(" + DateCase.toString() +")", Math.floor(ResultArray[TIME]/1000)*1000, Date.parse(DateCase.toString()) );
+ testcases[item++] = new TestCase( SECTION, "Date.parse(" + DateCase.toGMTString() +")", Math.floor(ResultArray[TIME]/1000)*1000, Date.parse(DateCase.toGMTString()) );
+/*
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() z inutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
+// testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
+// testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
+*/
+}
+function test() {
+ for( tc = 0; tc < testcases.length; tc++ ) {
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = " +
+ testcases[tc].actual );
+ }
+ stopTest();
+
+ // all tests must return an array of TestCase objects
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.4.3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.4.3.js
new file mode 100644
index 0000000..e56f971
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.4.3.js
@@ -0,0 +1,209 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+
+
+ var testcases = new Array();
+ var SECTION = "15.9.4.3";
+ var TITLE = "Date.UTC( year, month, date, hours, minutes, seconds, ms )";
+
+ getTestCases();
+ test();
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+
+function utc( year, month, date, hours, minutes, seconds, ms ) {
+ d = new MyDate();
+ d.year = Number(year);
+
+ if (month)
+ d.month = Number(month);
+ if (date)
+ d.date = Number(date);
+ if (hours)
+ d.hours = Number(hours);
+ if (minutes)
+ d.minutes = Number(minutes);
+ if (seconds)
+ d.seconds = Number(seconds);
+ if (ms)
+ d.ms = Number(ms);
+
+ if ( isNaN(d.year) && 0 <= ToInteger(d.year) && d.year <= 99 ) {
+ d.year = 1900 + ToInteger(d.year);
+ }
+
+ if (isNaN(month) || isNaN(year) || isNaN(date) || isNaN(hours) ||
+ isNaN(minutes) || isNaN(seconds) || isNaN(ms) ) {
+ d.year = Number.NaN;
+ d.month = Number.NaN;
+ d.date = Number.NaN;
+ d.hours = Number.NaN;
+ d.minutes = Number.NaN;
+ d.seconds = Number.NaN;
+ d.ms = Number.NaN;
+ d.value = Number.NaN;
+ d.time = Number.NaN;
+ d.day =Number.NaN;
+ return d;
+ }
+
+ d.day = MakeDay( d.year, d.month, d.date );
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = (TimeClip( MakeDate(d.day,d.time)));
+
+ return d;
+}
+
+function UTCTime( t ) {
+ sign = ( t < 0 ) ? -1 : 1;
+ return ( (t +(TZ_DIFF*msPerHour)) );
+}
+
+function getTestCases() {
+
+ // Dates around 1970
+
+ addNewTestCase( Date.UTC( 1970,0,1,0,0,0,0),
+ "Date.UTC( 1970,0,1,0,0,0,0)",
+ utc(1970,0,1,0,0,0,0) );
+
+ addNewTestCase( Date.UTC( 1969,11,31,23,59,59,999),
+ "Date.UTC( 1969,11,31,23,59,59,999)",
+ utc(1969,11,31,23,59,59,999) );
+ addNewTestCase( Date.UTC( 1972,1,29,23,59,59,999),
+ "Date.UTC( 1972,1,29,23,59,59,999)",
+ utc(1972,1,29,23,59,59,999) );
+ addNewTestCase( Date.UTC( 1972,2,1,23,59,59,999),
+ "Date.UTC( 1972,2,1,23,59,59,999)",
+ utc(1972,2,1,23,59,59,999) );
+ addNewTestCase( Date.UTC( 1968,1,29,23,59,59,999),
+ "Date.UTC( 1968,1,29,23,59,59,999)",
+ utc(1968,1,29,23,59,59,999) );
+ addNewTestCase( Date.UTC( 1968,2,1,23,59,59,999),
+ "Date.UTC( 1968,2,1,23,59,59,999)",
+ utc(1968,2,1,23,59,59,999) );
+ addNewTestCase( Date.UTC( 1969,0,1,0,0,0,0),
+ "Date.UTC( 1969,0,1,0,0,0,0)",
+ utc(1969,0,1,0,0,0,0) );
+ addNewTestCase( Date.UTC( 1969,11,31,23,59,59,1000),
+ "Date.UTC( 1969,11,31,23,59,59,1000)",
+ utc(1970,0,1,0,0,0,0) );
+ addNewTestCase( Date.UTC( 1969,Number.NaN,31,23,59,59,999),
+ "Date.UTC( 1969,Number.NaN,31,23,59,59,999)",
+ utc(1969,Number.NaN,31,23,59,59,999) );
+
+ // Dates around 2000
+
+ addNewTestCase( Date.UTC( 1999,11,31,23,59,59,999),
+ "Date.UTC( 1999,11,31,23,59,59,999)",
+ utc(1999,11,31,23,59,59,999) );
+ addNewTestCase( Date.UTC( 2000,0,1,0,0,0,0),
+ "Date.UTC( 2000,0,1,0,0,0,0)",
+ utc(2000,0,1,0,0,0,0) );
+
+ // Dates around 1900
+ addNewTestCase( Date.UTC( 1899,11,31,23,59,59,999),
+ "Date.UTC( 1899,11,31,23,59,59,999)",
+ utc(1899,11,31,23,59,59,999) );
+ addNewTestCase( Date.UTC( 1900,0,1,0,0,0,0),
+ "Date.UTC( 1900,0,1,0,0,0,0)",
+ utc(1900,0,1,0,0,0,0) );
+ addNewTestCase( Date.UTC( 1973,0,1,0,0,0,0),
+ "Date.UTC( 1973,0,1,0,0,0,0)",
+ utc(1973,0,1,0,0,0,0) );
+ addNewTestCase( Date.UTC( 1776,6,4,12,36,13,111),
+ "Date.UTC( 1776,6,4,12,36,13,111)",
+ utc(1776,6,4,12,36,13,111) );
+ addNewTestCase( Date.UTC( 2525,9,18,15,30,1,123),
+ "Date.UTC( 2525,9,18,15,30,1,123)",
+ utc(2525,9,18,15,30,1,123) );
+
+ // Dates around 29 Feb 2000
+
+ addNewTestCase( Date.UTC( 2000,1,29,0,0,0,0 ),
+ "Date.UTC( 2000,1,29,0,0,0,0 )",
+ utc(2000,1,29,0,0,0,0) );
+ addNewTestCase( Date.UTC( 2000,1,29,8,0,0,0 ),
+ "Date.UTC( 2000,1,29,8,0,0,0 )",
+ utc(2000,1,29,8,0,0,0) );
+
+ // Dates around 1 Jan 2005
+
+ addNewTestCase( Date.UTC( 2005,0,1,0,0,0,0 ),
+ "Date.UTC( 2005,0,1,0,0,0,0 )",
+ utc(2005,0,1,0,0,0,0) );
+ addNewTestCase( Date.UTC( 2004,11,31,16,0,0,0 ),
+ "Date.UTC( 2004,11,31,16,0,0,0 )",
+ utc(2004,11,31,16,0,0,0) );
+}
+
+function addNewTestCase( DateCase, DateString, ExpectDate) {
+ DateCase = DateCase;
+
+ item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString, ExpectDate.value, DateCase );
+ testcases[item++] = new TestCase( SECTION, DateString, ExpectDate.value, DateCase );
+/*
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", ExpectDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", ExpectDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", ExpectDate.date, DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", ExpectDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", ExpectDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", ExpectDate.minutes,DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", ExpectDate.seconds,DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", ExpectDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", ExpectDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", ExpectDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", ExpectDate.date, DateCase.getDate() );
+// testcases[item++] = new TestCase( SECTION, DateString+".getDay()", ExpectDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", ExpectDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", ExpectDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", ExpectDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", ExpectDate.ms, DateCase.getMilliseconds() );
+*/
+}
+function test() {
+ for( tc=0; tc < testcases.length; tc++ ) {
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = " +
+ testcases[tc].actual );
+ }
+
+ stopTest();
+ return testcases;
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.1.js
new file mode 100644
index 0000000..d605896
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.1.js
@@ -0,0 +1,59 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.1.js
+ ECMA Section: 15.9.5.1 Date.prototype.constructor
+ Description:
+ The initial value of Date.prototype.constructor is the built-in Date
+ constructor.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.constructor";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.constructor == Date",
+ true,
+ Date.prototype.constructor == Date );
+ test();
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-1.js
new file mode 100644
index 0000000..f13e9d7
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-1.js
@@ -0,0 +1,115 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.10.js
+ ECMA Section: 15.9.5.10
+ Description: Date.prototype.getDate
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return DateFromTime(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.10";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getDate()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ // some daylight savings time cases
+
+ var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour )
+
+ var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour );
+
+/*
+ // We don't use |now| because it fails every night at midnight.
+ // The test is more reproducable if we use concrete times.
+ addTestCase( now );
+ addTestCase( TIME_YEAR_0 );
+ addTestCase( TIME_1970 );
+ addTestCase( TIME_1900 );
+ addTestCase( TIME_2000 );
+ addTestCase( UTC_FEB_29_2000 );
+*/
+ addTestCase( UTC_JAN_1_2005 );
+/*
+ addTestCase( DST_START_1998 );
+ addTestCase( DST_START_1998-1 );
+ addTestCase( DST_START_1998+1 );
+ addTestCase( DST_END_1998 );
+ addTestCase( DST_END_1998-1 );
+ addTestCase( DST_END_1998+1 );
+*/
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getDate()",
+ NaN,
+ (new Date(NaN)).getDate() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getDate.length",
+ 0,
+ Date.prototype.getDate.length );
+ test();
+function addTestCase( t ) {
+ for ( d = 0; d < TimeInMonth(MonthFromTime(t)); d+= msPerDay ) {
+ t += d;
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getDate()",
+ DateFromTime(LocalTime(t)),
+ (new Date(t)).getDate() );
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-10.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-10.js
new file mode 100644
index 0000000..1d8060d
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-10.js
@@ -0,0 +1,102 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.10.js
+ ECMA Section: 15.9.5.10
+ Description: Date.prototype.getDate
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return DateFromTime(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.10";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getDate()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ // some daylight savings time cases
+
+ var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour )
+
+ var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour );
+
+ addTestCase( DST_START_1998+1 );
+/*
+ addTestCase( DST_END_1998 );
+ addTestCase( DST_END_1998-1 );
+ addTestCase( DST_END_1998+1 );
+*/
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getDate()",
+ NaN,
+ (new Date(NaN)).getDate() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getDate.length",
+ 0,
+ Date.prototype.getDate.length );
+ test();
+function addTestCase( t ) {
+ for ( d = 0; d < TimeInMonth(MonthFromTime(t)); d+= msPerDay ) {
+ t += d;
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getDate()",
+ DateFromTime(LocalTime(t)),
+ (new Date(t)).getDate() );
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-11.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-11.js
new file mode 100644
index 0000000..752b114
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-11.js
@@ -0,0 +1,101 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.10.js
+ ECMA Section: 15.9.5.10
+ Description: Date.prototype.getDate
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return DateFromTime(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.10";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getDate()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ // some daylight savings time cases
+
+ var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour )
+
+ var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour );
+
+ addTestCase( DST_END_1998 );
+/*
+ addTestCase( DST_END_1998-1 );
+ addTestCase( DST_END_1998+1 );
+*/
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getDate()",
+ NaN,
+ (new Date(NaN)).getDate() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getDate.length",
+ 0,
+ Date.prototype.getDate.length );
+ test();
+function addTestCase( t ) {
+ for ( d = 0; d < TimeInMonth(MonthFromTime(t)); d+= msPerDay ) {
+ t += d;
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getDate()",
+ DateFromTime(LocalTime(t)),
+ (new Date(t)).getDate() );
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-12.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-12.js
new file mode 100644
index 0000000..587b023
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-12.js
@@ -0,0 +1,100 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.10.js
+ ECMA Section: 15.9.5.10
+ Description: Date.prototype.getDate
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return DateFromTime(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.10";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getDate()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ // some daylight savings time cases
+
+ var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour )
+
+ var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour );
+
+ addTestCase( DST_END_1998-1 );
+/*
+ addTestCase( DST_END_1998+1 );
+*/
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getDate()",
+ NaN,
+ (new Date(NaN)).getDate() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getDate.length",
+ 0,
+ Date.prototype.getDate.length );
+ test();
+function addTestCase( t ) {
+ for ( d = 0; d < TimeInMonth(MonthFromTime(t)); d+= msPerDay ) {
+ t += d;
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getDate()",
+ DateFromTime(LocalTime(t)),
+ (new Date(t)).getDate() );
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-13.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-13.js
new file mode 100644
index 0000000..bf9027a
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-13.js
@@ -0,0 +1,97 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.10.js
+ ECMA Section: 15.9.5.10
+ Description: Date.prototype.getDate
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return DateFromTime(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.10";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getDate()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ // some daylight savings time cases
+
+ var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour )
+
+ var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour );
+
+ addTestCase( DST_END_1998+1 );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getDate()",
+ NaN,
+ (new Date(NaN)).getDate() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getDate.length",
+ 0,
+ Date.prototype.getDate.length );
+ test();
+function addTestCase( t ) {
+ for ( d = 0; d < TimeInMonth(MonthFromTime(t)); d+= msPerDay ) {
+ t += d;
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getDate()",
+ DateFromTime(LocalTime(t)),
+ (new Date(t)).getDate() );
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-2.js
new file mode 100644
index 0000000..a775643
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-2.js
@@ -0,0 +1,110 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.10.js
+ ECMA Section: 15.9.5.10
+ Description: Date.prototype.getDate
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return DateFromTime(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.10";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getDate()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ // some daylight savings time cases
+
+ var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour )
+
+ var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour );
+
+ addTestCase( TIME_YEAR_0 );
+/*
+ addTestCase( TIME_1970 );
+ addTestCase( TIME_1900 );
+ addTestCase( TIME_2000 );
+ addTestCase( UTC_FEB_29_2000 );
+ addTestCase( UTC_JAN_1_2005 );
+ addTestCase( DST_START_1998 );
+ addTestCase( DST_START_1998-1 );
+ addTestCase( DST_START_1998+1 );
+ addTestCase( DST_END_1998 );
+ addTestCase( DST_END_1998-1 );
+ addTestCase( DST_END_1998+1 );
+*/
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getDate()",
+ NaN,
+ (new Date(NaN)).getDate() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getDate.length",
+ 0,
+ Date.prototype.getDate.length );
+ test();
+function addTestCase( t ) {
+ for ( d = 0; d < TimeInMonth(MonthFromTime(t)); d+= msPerDay ) {
+ t += d;
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getDate()",
+ DateFromTime(LocalTime(t)),
+ (new Date(t)).getDate() );
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-3.js
new file mode 100644
index 0000000..56fee4b
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-3.js
@@ -0,0 +1,109 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.10.js
+ ECMA Section: 15.9.5.10
+ Description: Date.prototype.getDate
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return DateFromTime(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.10";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getDate()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ // some daylight savings time cases
+
+ var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour )
+
+ var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour );
+
+ addTestCase( TIME_1970 );
+/*
+ addTestCase( TIME_1900 );
+ addTestCase( TIME_2000 );
+ addTestCase( UTC_FEB_29_2000 );
+ addTestCase( UTC_JAN_1_2005 );
+ addTestCase( DST_START_1998 );
+ addTestCase( DST_START_1998-1 );
+ addTestCase( DST_START_1998+1 );
+ addTestCase( DST_END_1998 );
+ addTestCase( DST_END_1998-1 );
+ addTestCase( DST_END_1998+1 );
+*/
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getDate()",
+ NaN,
+ (new Date(NaN)).getDate() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getDate.length",
+ 0,
+ Date.prototype.getDate.length );
+ test();
+function addTestCase( t ) {
+ for ( d = 0; d < TimeInMonth(MonthFromTime(t)); d+= msPerDay ) {
+ t += d;
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getDate()",
+ DateFromTime(LocalTime(t)),
+ (new Date(t)).getDate() );
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-4.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-4.js
new file mode 100644
index 0000000..1f22d11
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-4.js
@@ -0,0 +1,107 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.10.js
+ ECMA Section: 15.9.5.10
+ Description: Date.prototype.getDate
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return DateFromTime(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.10";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getDate()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ // some daylight savings time cases
+
+ var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour )
+
+ var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour );
+
+ addTestCase( TIME_1900 );
+/*
+ addTestCase( UTC_FEB_29_2000 );
+ addTestCase( UTC_JAN_1_2005 );
+ addTestCase( DST_START_1998 );
+ addTestCase( DST_START_1998-1 );
+ addTestCase( DST_START_1998+1 );
+ addTestCase( DST_END_1998 );
+ addTestCase( DST_END_1998-1 );
+ addTestCase( DST_END_1998+1 );
+*/
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getDate()",
+ NaN,
+ (new Date(NaN)).getDate() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getDate.length",
+ 0,
+ Date.prototype.getDate.length );
+ test();
+function addTestCase( t ) {
+ for ( d = 0; d < TimeInMonth(MonthFromTime(t)); d+= msPerDay ) {
+ t += d;
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getDate()",
+ DateFromTime(LocalTime(t)),
+ (new Date(t)).getDate() );
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-5.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-5.js
new file mode 100644
index 0000000..4e7c80a
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-5.js
@@ -0,0 +1,107 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.10.js
+ ECMA Section: 15.9.5.10
+ Description: Date.prototype.getDate
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return DateFromTime(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.10";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getDate()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ // some daylight savings time cases
+
+ var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour )
+
+ var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour );
+
+ addTestCase( TIME_2000 );
+/*
+ addTestCase( UTC_FEB_29_2000 );
+ addTestCase( UTC_JAN_1_2005 );
+ addTestCase( DST_START_1998 );
+ addTestCase( DST_START_1998-1 );
+ addTestCase( DST_START_1998+1 );
+ addTestCase( DST_END_1998 );
+ addTestCase( DST_END_1998-1 );
+ addTestCase( DST_END_1998+1 );
+*/
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getDate()",
+ NaN,
+ (new Date(NaN)).getDate() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getDate.length",
+ 0,
+ Date.prototype.getDate.length );
+ test();
+function addTestCase( t ) {
+ for ( d = 0; d < TimeInMonth(MonthFromTime(t)); d+= msPerDay ) {
+ t += d;
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getDate()",
+ DateFromTime(LocalTime(t)),
+ (new Date(t)).getDate() );
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-6.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-6.js
new file mode 100644
index 0000000..6408622
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-6.js
@@ -0,0 +1,106 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.10.js
+ ECMA Section: 15.9.5.10
+ Description: Date.prototype.getDate
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return DateFromTime(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.10";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getDate()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ // some daylight savings time cases
+
+ var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour )
+
+ var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour );
+
+ addTestCase( UTC_FEB_29_2000 );
+/*
+ addTestCase( UTC_JAN_1_2005 );
+ addTestCase( DST_START_1998 );
+ addTestCase( DST_START_1998-1 );
+ addTestCase( DST_START_1998+1 );
+ addTestCase( DST_END_1998 );
+ addTestCase( DST_END_1998-1 );
+ addTestCase( DST_END_1998+1 );
+*/
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getDate()",
+ NaN,
+ (new Date(NaN)).getDate() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getDate.length",
+ 0,
+ Date.prototype.getDate.length );
+ test();
+function addTestCase( t ) {
+ for ( d = 0; d < TimeInMonth(MonthFromTime(t)); d+= msPerDay ) {
+ t += d;
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getDate()",
+ DateFromTime(LocalTime(t)),
+ (new Date(t)).getDate() );
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-7.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-7.js
new file mode 100644
index 0000000..d1741e3
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-7.js
@@ -0,0 +1,105 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.10.js
+ ECMA Section: 15.9.5.10
+ Description: Date.prototype.getDate
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return DateFromTime(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.10";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getDate()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ // some daylight savings time cases
+
+ var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour )
+
+ var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour );
+
+ addTestCase( UTC_JAN_1_2005 );
+/*
+ addTestCase( DST_START_1998 );
+ addTestCase( DST_START_1998-1 );
+ addTestCase( DST_START_1998+1 );
+ addTestCase( DST_END_1998 );
+ addTestCase( DST_END_1998-1 );
+ addTestCase( DST_END_1998+1 );
+*/
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getDate()",
+ NaN,
+ (new Date(NaN)).getDate() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getDate.length",
+ 0,
+ Date.prototype.getDate.length );
+ test();
+function addTestCase( t ) {
+ for ( d = 0; d < TimeInMonth(MonthFromTime(t)); d+= msPerDay ) {
+ t += d;
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getDate()",
+ DateFromTime(LocalTime(t)),
+ (new Date(t)).getDate() );
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-8.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-8.js
new file mode 100644
index 0000000..3ef0398
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-8.js
@@ -0,0 +1,104 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.10.js
+ ECMA Section: 15.9.5.10
+ Description: Date.prototype.getDate
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return DateFromTime(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.10";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getDate()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ // some daylight savings time cases
+
+ var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour )
+
+ var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour );
+
+ addTestCase( DST_START_1998 );
+/*
+ addTestCase( DST_START_1998-1 );
+ addTestCase( DST_START_1998+1 );
+ addTestCase( DST_END_1998 );
+ addTestCase( DST_END_1998-1 );
+ addTestCase( DST_END_1998+1 );
+*/
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getDate()",
+ NaN,
+ (new Date(NaN)).getDate() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getDate.length",
+ 0,
+ Date.prototype.getDate.length );
+ test();
+function addTestCase( t ) {
+ for ( d = 0; d < TimeInMonth(MonthFromTime(t)); d+= msPerDay ) {
+ t += d;
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getDate()",
+ DateFromTime(LocalTime(t)),
+ (new Date(t)).getDate() );
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-9.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-9.js
new file mode 100644
index 0000000..1d8325c
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-9.js
@@ -0,0 +1,103 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.10.js
+ ECMA Section: 15.9.5.10
+ Description: Date.prototype.getDate
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return DateFromTime(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.10";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getDate()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ // some daylight savings time cases
+
+ var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour )
+
+ var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour );
+
+ addTestCase( DST_START_1998-1 );
+/*
+ addTestCase( DST_START_1998+1 );
+ addTestCase( DST_END_1998 );
+ addTestCase( DST_END_1998-1 );
+ addTestCase( DST_END_1998+1 );
+*/
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getDate()",
+ NaN,
+ (new Date(NaN)).getDate() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getDate.length",
+ 0,
+ Date.prototype.getDate.length );
+ test();
+function addTestCase( t ) {
+ for ( d = 0; d < TimeInMonth(MonthFromTime(t)); d+= msPerDay ) {
+ t += d;
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getDate()",
+ DateFromTime(LocalTime(t)),
+ (new Date(t)).getDate() );
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-1.js
new file mode 100644
index 0000000..9b425e8
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-1.js
@@ -0,0 +1,99 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.11.js
+ ECMA Section: 15.9.5.11
+ Description: Date.prototype.getUTCDate
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 1.Return DateFromTime(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.11";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getUTCDate()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ addTestCase( now );
+
+ test()
+
+function addTestCase( t ) {
+ for ( var m = 0; m < 11; m++ ) {
+ t += TimeInMonth(m);
+
+ for ( var d = 0; d < TimeInMonth( m ); d += 7*msPerDay ) {
+ t += d;
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getUTCDate()",
+ DateFromTime((t)),
+ (new Date(t)).getUTCDate() );
+/*
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t+1)+")).getUTCDate()",
+ DateFromTime((t+1)),
+ (new Date(t+1)).getUTCDate() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t-1)+")).getUTCDate()",
+ DateFromTime((t-1)),
+ (new Date(t-1)).getUTCDate() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t-TZ_ADJUST)+")).getUTCDate()",
+ DateFromTime((t-TZ_ADJUST)),
+ (new Date(t-TZ_ADJUST)).getUTCDate() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t+TZ_ADJUST)+")).getUTCDate()",
+ DateFromTime((t+TZ_ADJUST)),
+ (new Date(t+TZ_ADJUST)).getUTCDate() );
+*/
+ }
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-2.js
new file mode 100644
index 0000000..ed946ea
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-2.js
@@ -0,0 +1,96 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.11
+ ECMA Section: 15.9.5.11
+ Description: Date.prototype.getUTCDate
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 1.Return DateFromTime(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.11";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getUTCDate()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+
+ addTestCase( TIME_YEAR_0 );
+
+ test();
+function addTestCase( t ) {
+ for ( var m = 0; m < 11; m++ ) {
+ t += TimeInMonth(m);
+
+ for ( var d = 0; d < TimeInMonth( m ); d += 7*msPerDay ) {
+ t += d;
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getUTCDate()",
+ DateFromTime((t)),
+ (new Date(t)).getUTCDate() );
+/*
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t+1)+")).getUTCDate()",
+ DateFromTime((t+1)),
+ (new Date(t+1)).getUTCDate() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t-1)+")).getUTCDate()",
+ DateFromTime((t-1)),
+ (new Date(t-1)).getUTCDate() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t-TZ_ADJUST)+")).getUTCDate()",
+ DateFromTime((t-TZ_ADJUST)),
+ (new Date(t-TZ_ADJUST)).getUTCDate() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t+TZ_ADJUST)+")).getUTCDate()",
+ DateFromTime((t+TZ_ADJUST)),
+ (new Date(t+TZ_ADJUST)).getUTCDate() );
+*/
+ }
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-3.js
new file mode 100644
index 0000000..f596a83
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-3.js
@@ -0,0 +1,95 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.11.js
+ ECMA Section: 15.9.5.11
+ Description: Date.prototype.getUTCDate
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 1.Return DateFromTime(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.11";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getUTCDate()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ addTestCase( TIME_1970 );
+
+ test();
+function addTestCase( t ) {
+ for ( var m = 0; m < 11; m++ ) {
+ t += TimeInMonth(m);
+
+ for ( var d = 0; d < TimeInMonth( m ); d += 7*msPerDay ) {
+ t += d;
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getUTCDate()",
+ DateFromTime((t)),
+ (new Date(t)).getUTCDate() );
+/*
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t+1)+")).getUTCDate()",
+ DateFromTime((t+1)),
+ (new Date(t+1)).getUTCDate() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t-1)+")).getUTCDate()",
+ DateFromTime((t-1)),
+ (new Date(t-1)).getUTCDate() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t-TZ_ADJUST)+")).getUTCDate()",
+ DateFromTime((t-TZ_ADJUST)),
+ (new Date(t-TZ_ADJUST)).getUTCDate() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t+TZ_ADJUST)+")).getUTCDate()",
+ DateFromTime((t+TZ_ADJUST)),
+ (new Date(t+TZ_ADJUST)).getUTCDate() );
+*/
+ }
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-4.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-4.js
new file mode 100644
index 0000000..3b9d480
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-4.js
@@ -0,0 +1,95 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.11.js
+ ECMA Section: 15.9.5.11
+ Description: Date.prototype.getUTCDate
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 1.Return DateFromTime(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.11";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getUTCDate()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ addTestCase( TIME_1900 );
+
+ test();
+function addTestCase( t ) {
+ for ( var m = 0; m < 11; m++ ) {
+ t += TimeInMonth(m);
+
+ for ( var d = 0; d < TimeInMonth( m ); d += 7* msPerDay ) {
+ t += d;
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getUTCDate()",
+ DateFromTime((t)),
+ (new Date(t)).getUTCDate() );
+/*
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t+1)+")).getUTCDate()",
+ DateFromTime((t+1)),
+ (new Date(t+1)).getUTCDate() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t-1)+")).getUTCDate()",
+ DateFromTime((t-1)),
+ (new Date(t-1)).getUTCDate() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t-TZ_ADJUST)+")).getUTCDate()",
+ DateFromTime((t-TZ_ADJUST)),
+ (new Date(t-TZ_ADJUST)).getUTCDate() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t+TZ_ADJUST)+")).getUTCDate()",
+ DateFromTime((t+TZ_ADJUST)),
+ (new Date(t+TZ_ADJUST)).getUTCDate() );
+*/
+ }
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-5.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-5.js
new file mode 100644
index 0000000..d76f392
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-5.js
@@ -0,0 +1,95 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.11.js
+ ECMA Section: 15.9.5.11
+ Description: Date.prototype.getUTCDate
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 1.Return DateFromTime(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.11";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getUTCDate()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ addTestCase( TIME_2000 );
+
+ test();
+function addTestCase( t ) {
+ for ( var m = 0; m < 11; m++ ) {
+ t += TimeInMonth(m);
+
+ for ( var d = 0; d < TimeInMonth( m ); d += 7*msPerDay ) {
+ t += d;
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getUTCDate()",
+ DateFromTime((t)),
+ (new Date(t)).getUTCDate() );
+/*
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t+1)+")).getUTCDate()",
+ DateFromTime((t+1)),
+ (new Date(t+1)).getUTCDate() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t-1)+")).getUTCDate()",
+ DateFromTime((t-1)),
+ (new Date(t-1)).getUTCDate() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t-TZ_ADJUST)+")).getUTCDate()",
+ DateFromTime((t-TZ_ADJUST)),
+ (new Date(t-TZ_ADJUST)).getUTCDate() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t+TZ_ADJUST)+")).getUTCDate()",
+ DateFromTime((t+TZ_ADJUST)),
+ (new Date(t+TZ_ADJUST)).getUTCDate() );
+*/
+ }
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-6.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-6.js
new file mode 100644
index 0000000..7cb0509
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-6.js
@@ -0,0 +1,96 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.11.js
+ ECMA Section: 15.9.5.11
+ Description: Date.prototype.getUTCDate
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 1.Return DateFromTime(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.11";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getUTCDate()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ var UTC_FEB_29_2000 = TIME_2000 + ( 30 * msPerDay ) + ( 29 * msPerDay );
+
+ addTestCase( UTC_FEB_29_2000 );
+ test();
+function addTestCase( t ) {
+ for ( var m = 0; m < 11; m++ ) {
+ t += TimeInMonth(m);
+
+ for ( var d = 0; d < TimeInMonth( m ); d += 7*msPerDay ) {
+ t += d;
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getUTCDate()",
+ DateFromTime((t)),
+ (new Date(t)).getUTCDate() );
+/*
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t+1)+")).getUTCDate()",
+ DateFromTime((t+1)),
+ (new Date(t+1)).getUTCDate() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t-1)+")).getUTCDate()",
+ DateFromTime((t-1)),
+ (new Date(t-1)).getUTCDate() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t-TZ_ADJUST)+")).getUTCDate()",
+ DateFromTime((t-TZ_ADJUST)),
+ (new Date(t-TZ_ADJUST)).getUTCDate() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t+TZ_ADJUST)+")).getUTCDate()",
+ DateFromTime((t+TZ_ADJUST)),
+ (new Date(t+TZ_ADJUST)).getUTCDate() );
+*/
+ }
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-7.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-7.js
new file mode 100644
index 0000000..08eb7f6
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-7.js
@@ -0,0 +1,98 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.11.js
+ ECMA Section: 15.9.5.11
+ Description: Date.prototype.getUTCDate
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 1.Return DateFromTime(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.11";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getUTCDate()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ addTestCase( UTC_JAN_1_2005 );
+
+ test();
+function addTestCase( t ) {
+ for ( var m = 0; m < 11; m++ ) {
+ t += TimeInMonth(m);
+
+ for ( var d = 0; d < TimeInMonth( m ); d += 7*msPerDay ) {
+ t += d;
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getUTCDate()",
+ DateFromTime((t)),
+ (new Date(t)).getUTCDate() );
+/*
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t+1)+")).getUTCDate()",
+ DateFromTime((t+1)),
+ (new Date(t+1)).getUTCDate() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t-1)+")).getUTCDate()",
+ DateFromTime((t-1)),
+ (new Date(t-1)).getUTCDate() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t-TZ_ADJUST)+")).getUTCDate()",
+ DateFromTime((t-TZ_ADJUST)),
+ (new Date(t-TZ_ADJUST)).getUTCDate() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t+TZ_ADJUST)+")).getUTCDate()",
+ DateFromTime((t+TZ_ADJUST)),
+ (new Date(t+TZ_ADJUST)).getUTCDate() );
+*/
+ }
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-1.js
new file mode 100644
index 0000000..8dcf1a4
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-1.js
@@ -0,0 +1,110 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.12.js
+ ECMA Section: 15.9.5.12
+ Description: Date.prototype.getDay
+
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return WeekDay(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.12";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getDay()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+/*
+ // We don't use |now| because it fails every night at midnight.
+ // The test is more reproducable if we use concrete times.
+ addTestCase( now );
+
+ addTestCase( TIME_YEAR_0 );
+ addTestCase( TIME_1970 );
+ addTestCase( TIME_1900 );
+ addTestCase( TIME_2000 );
+ addTestCase( UTC_FEB_29_2000 );
+*/
+ addTestCase( UTC_JAN_1_2005 );
+/*
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getDay()",
+ NaN,
+ (new Date(NaN)).getDay() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getDay.length",
+ 0,
+ Date.prototype.getDay.length );
+*/
+ test();
+function addTestCase( t ) {
+ for ( var m = 0; m < 12; m++ ) {
+ t += TimeInMonth(m);
+
+ for ( d = 0; d < TimeInMonth(m); d+= msPerDay*6 ) {
+ t += d;
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getDay()",
+ WeekDay(LocalTime(t)),
+ (new Date(t)).getDay() );
+ }
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-2.js
new file mode 100644
index 0000000..dd58cb0
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-2.js
@@ -0,0 +1,104 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.12.js
+ ECMA Section: 15.9.5.12
+ Description: Date.prototype.getDay
+
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return WeekDay(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.12";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getDay()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ addTestCase( TIME_YEAR_0 );
+/*
+ addTestCase( TIME_1970 );
+ addTestCase( TIME_1900 );
+ addTestCase( TIME_2000 );
+ addTestCase( UTC_FEB_29_2000 );
+ addTestCase( UTC_JAN_1_2005 );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getDay()",
+ NaN,
+ (new Date(NaN)).getDay() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getDay.length",
+ 0,
+ Date.prototype.getDay.length );
+*/
+ test();
+function addTestCase( t ) {
+ for ( var m = 0; m < 12; m++ ) {
+ t += TimeInMonth(m);
+
+ for ( d = 0; d < TimeInMonth(m); d+= msPerDay*6 ) {
+ t += d;
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getDay()",
+ WeekDay(LocalTime(t)),
+ (new Date(t)).getDay() );
+ }
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-3.js
new file mode 100644
index 0000000..6212458
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-3.js
@@ -0,0 +1,103 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.12.js
+ ECMA Section: 15.9.5.12
+ Description: Date.prototype.getDay
+
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return WeekDay(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.12";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getDay()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ addTestCase( TIME_1970 );
+/*
+ addTestCase( TIME_1900 );
+ addTestCase( TIME_2000 );
+ addTestCase( UTC_FEB_29_2000 );
+ addTestCase( UTC_JAN_1_2005 );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getDay()",
+ NaN,
+ (new Date(NaN)).getDay() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getDay.length",
+ 0,
+ Date.prototype.getDay.length );
+*/
+ test();
+function addTestCase( t ) {
+ for ( var m = 0; m < 12; m++ ) {
+ t += TimeInMonth(m);
+
+ for ( d = 0; d < TimeInMonth(m); d+= msPerDay*6 ) {
+ t += d;
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getDay()",
+ WeekDay(LocalTime(t)),
+ (new Date(t)).getDay() );
+ }
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-4.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-4.js
new file mode 100644
index 0000000..e7bde15
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-4.js
@@ -0,0 +1,102 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.12.js
+ ECMA Section: 15.9.5.12
+ Description: Date.prototype.getDay
+
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return WeekDay(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.12";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getDay()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ addTestCase( TIME_1900 );
+/*
+ addTestCase( TIME_2000 );
+ addTestCase( UTC_FEB_29_2000 );
+ addTestCase( UTC_JAN_1_2005 );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getDay()",
+ NaN,
+ (new Date(NaN)).getDay() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getDay.length",
+ 0,
+ Date.prototype.getDay.length );
+*/
+ test();
+function addTestCase( t ) {
+ for ( var m = 0; m < 12; m++ ) {
+ t += TimeInMonth(m);
+
+ for ( d = 0; d < TimeInMonth(m); d+= msPerDay*6 ) {
+ t += d;
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getDay()",
+ WeekDay(LocalTime(t)),
+ (new Date(t)).getDay() );
+ }
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-5.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-5.js
new file mode 100644
index 0000000..796187a
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-5.js
@@ -0,0 +1,101 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.12.js
+ ECMA Section: 15.9.5.12
+ Description: Date.prototype.getDay
+
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return WeekDay(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.12";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getDay()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ addTestCase( TIME_2000 );
+/*
+ addTestCase( UTC_FEB_29_2000 );
+ addTestCase( UTC_JAN_1_2005 );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getDay()",
+ NaN,
+ (new Date(NaN)).getDay() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getDay.length",
+ 0,
+ Date.prototype.getDay.length );
+*/
+ test();
+function addTestCase( t ) {
+ for ( var m = 0; m < 12; m++ ) {
+ t += TimeInMonth(m);
+
+ for ( d = 0; d < TimeInMonth(m); d+= msPerDay*6 ) {
+ t += d;
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getDay()",
+ WeekDay(LocalTime(t)),
+ (new Date(t)).getDay() );
+ }
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-6.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-6.js
new file mode 100644
index 0000000..1aa0a1d
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-6.js
@@ -0,0 +1,100 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.12.js
+ ECMA Section: 15.9.5.12
+ Description: Date.prototype.getDay
+
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return WeekDay(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.12";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getDay()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ addTestCase( UTC_FEB_29_2000 );
+/*
+ addTestCase( UTC_JAN_1_2005 );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getDay()",
+ NaN,
+ (new Date(NaN)).getDay() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getDay.length",
+ 0,
+ Date.prototype.getDay.length );
+*/
+ test();
+function addTestCase( t ) {
+ for ( var m = 0; m < 12; m++ ) {
+ t += TimeInMonth(m);
+
+ for ( d = 0; d < TimeInMonth(m); d+= msPerDay*6 ) {
+ t += d;
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getDay()",
+ WeekDay(LocalTime(t)),
+ (new Date(t)).getDay() );
+ }
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-7.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-7.js
new file mode 100644
index 0000000..c638614
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-7.js
@@ -0,0 +1,98 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.12.js
+ ECMA Section: 15.9.5.12
+ Description: Date.prototype.getDay
+
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return WeekDay(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.12";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getDay()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ addTestCase( UTC_JAN_1_2005 );
+/*
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getDay()",
+ NaN,
+ (new Date(NaN)).getDay() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getDay.length",
+ 0,
+ Date.prototype.getDay.length );
+*/
+ test();
+function addTestCase( t ) {
+ for ( var m = 0; m < 12; m++ ) {
+ t += TimeInMonth(m);
+
+ for ( d = 0; d < TimeInMonth(m); d+= msPerDay*6 ) {
+ t += d;
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getDay()",
+ WeekDay(LocalTime(t)),
+ (new Date(t)).getDay() );
+ }
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-8.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-8.js
new file mode 100644
index 0000000..54260ca
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-8.js
@@ -0,0 +1,95 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.12
+ ECMA Section: 15.9.5.12
+ Description: Date.prototype.getDay
+
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return WeekDay(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.12";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getDay()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getDay()",
+ NaN,
+ (new Date(NaN)).getDay() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getDay.length",
+ 0,
+ Date.prototype.getDay.length );
+ test();
+function addTestCase( t ) {
+ for ( var m = 0; m < 12; m++ ) {
+ t += TimeInMonth(m);
+
+ for ( d = 0; d < TimeInMonth(m); d+= msPerDay*6 ) {
+ t += d;
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getDay()",
+ WeekDay(LocalTime(t)),
+ (new Date(t)).getDay() );
+ }
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-1.js
new file mode 100644
index 0000000..06bd92e
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-1.js
@@ -0,0 +1,78 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.13.js
+ ECMA Section: 15.9.5.13
+ Description: Date.prototype.getUTCDay
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return WeekDay(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.13";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getUTCDay()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ addTestCase( now );
+
+ test();
+function addTestCase( t ) {
+ for ( var m = 0; m < 12; m++ ) {
+ t += TimeInMonth(m);
+
+ for ( d = 0; d < TimeInMonth(m); d+= msPerDay*14 ) {
+ t += d;
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getUTCDay()",
+ WeekDay((t)),
+ (new Date(t)).getUTCDay() );
+ }
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-2.js
new file mode 100644
index 0000000..bec562c
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-2.js
@@ -0,0 +1,75 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.13
+ ECMA Section: 15.9.5.13
+ Description: Date.prototype.getUTCDay
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return WeekDay(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.13";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getUTCDay()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+
+ addTestCase( TIME_YEAR_0 );
+ test();
+function addTestCase( t ) {
+ for ( var m = 0; m < 12; m++ ) {
+ t += TimeInMonth(m);
+
+ for ( d = 0; d < TimeInMonth(m); d+= msPerDay*14 ) {
+ t += d;
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getUTCDay()",
+ WeekDay((t)),
+ (new Date(t)).getUTCDay() );
+ }
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-3.js
new file mode 100644
index 0000000..6124d86
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-3.js
@@ -0,0 +1,75 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.13.js
+ ECMA Section: 15.9.5.13
+ Description: Date.prototype.getUTCDay
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return WeekDay(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.13";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getUTCDay()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ addTestCase( TIME_1970 );
+
+ test();
+function addTestCase( t ) {
+ for ( var m = 0; m < 12; m++ ) {
+ t += TimeInMonth(m);
+
+ for ( d = 0; d < TimeInMonth(m); d+= msPerDay*14 ) {
+ t += d;
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getUTCDay()",
+ WeekDay((t)),
+ (new Date(t)).getUTCDay() );
+ }
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-4.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-4.js
new file mode 100644
index 0000000..37fd989
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-4.js
@@ -0,0 +1,75 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.13.js
+ ECMA Section: 15.9.5.13
+ Description: Date.prototype.getUTCDay
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return WeekDay(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.13";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getUTCDay()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ addTestCase( TIME_1900 );
+
+ test();
+function addTestCase( t ) {
+ for ( var m = 0; m < 12; m++ ) {
+ t += TimeInMonth(m);
+
+ for ( d = 0; d < TimeInMonth(m); d+= msPerDay*14 ) {
+ t += d;
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getUTCDay()",
+ WeekDay((t)),
+ (new Date(t)).getUTCDay() );
+ }
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-5.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-5.js
new file mode 100644
index 0000000..2af2e9e
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-5.js
@@ -0,0 +1,75 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.13.js
+ ECMA Section: 15.9.5.13
+ Description: Date.prototype.getUTCDay
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return WeekDay(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.13";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getUTCDay()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ addTestCase( TIME_2000 );
+
+ test();
+function addTestCase( t ) {
+ for ( var m = 0; m < 12; m++ ) {
+ t += TimeInMonth(m);
+
+ for ( d = 0; d < TimeInMonth(m); d+= msPerDay*14 ) {
+ t += d;
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getUTCDay()",
+ WeekDay((t)),
+ (new Date(t)).getUTCDay() );
+ }
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-6.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-6.js
new file mode 100644
index 0000000..ce5e335
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-6.js
@@ -0,0 +1,78 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.13.js
+ ECMA Section: 15.9.5.13
+ Description: Date.prototype.getUTCDay
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return WeekDay(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.13";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getUTCDay()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ addTestCase( UTC_FEB_29_2000 );
+ test();
+function addTestCase( t ) {
+ for ( var m = 0; m < 12; m++ ) {
+ t += TimeInMonth(m);
+
+ for ( d = 0; d < TimeInMonth(m); d+= msPerDay*7 ) {
+ t += d;
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getUTCDay()",
+ WeekDay((t)),
+ (new Date(t)).getUTCDay() );
+ }
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-7.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-7.js
new file mode 100644
index 0000000..2870bc5
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-7.js
@@ -0,0 +1,80 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.13.js
+ ECMA Section: 15.9.5.13
+ Description: Date.prototype.getUTCDay
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return WeekDay(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.13";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getUTCDay()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ addTestCase( UTC_JAN_1_2005 );
+
+ test();
+function addTestCase( t ) {
+ for ( var m = 0; m < 12; m++ ) {
+ t += TimeInMonth(m);
+
+ for ( d = 0; d < TimeInMonth(m); d+= msPerDay*7 ) {
+ t += d;
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getUTCDay()",
+ WeekDay((t)),
+ (new Date(t)).getUTCDay() );
+ }
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-8.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-8.js
new file mode 100644
index 0000000..703483e
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-8.js
@@ -0,0 +1,95 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.13.js
+ ECMA Section: 15.9.5.13
+ Description: Date.prototype.getUTCDay
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return WeekDay(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.13";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getUTCDay()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getUTCDay()",
+ NaN,
+ (new Date(NaN)).getUTCDay() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getUTCDay.length",
+ 0,
+ Date.prototype.getUTCDay.length );
+
+ test();
+function addTestCase( t ) {
+ for ( var m = 0; m < 12; m++ ) {
+ t += TimeInMonth(m);
+
+ for ( d = 0; d < TimeInMonth(m); d+= msPerDay*7 ) {
+ t += d;
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getUTCDay()",
+ WeekDay((t)),
+ (new Date(t)).getUTCDay() );
+ }
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.14.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.14.js
new file mode 100644
index 0000000..4d95ada
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.14.js
@@ -0,0 +1,96 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.14.js
+ ECMA Section: 15.9.5.14
+ Description: Date.prototype.getHours
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return HourFromTime(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.14";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getHours()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ addTestCase( now );
+ addTestCase( TIME_YEAR_0 );
+ addTestCase( TIME_1970 );
+ addTestCase( TIME_1900 );
+ addTestCase( TIME_2000 );
+ addTestCase( UTC_FEB_29_2000 );
+ addTestCase( UTC_JAN_1_2005 );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getHours()",
+ NaN,
+ (new Date(NaN)).getHours() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getHours.length",
+ 0,
+ Date.prototype.getHours.length );
+ test();
+function addTestCase( t ) {
+ for ( h = 0; h < 24; h+=4 ) {
+ t += msPerHour;
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getHours()",
+ HourFromTime((LocalTime(t))),
+ (new Date(t)).getHours() );
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.15.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.15.js
new file mode 100644
index 0000000..de4a132
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.15.js
@@ -0,0 +1,97 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.15.js
+ ECMA Section: 15.9.5.15
+ Description: Date.prototype.getUTCHours
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return HourFromTime(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.15";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getUTCHours()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ addTestCase( now );
+ addTestCase( TIME_YEAR_0 );
+ addTestCase( TIME_1970 );
+ addTestCase( TIME_1900 );
+ addTestCase( TIME_2000 );
+ addTestCase( UTC_FEB_29_2000 );
+ addTestCase( UTC_JAN_1_2005 );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getUTCHours()",
+ NaN,
+ (new Date(NaN)).getUTCHours() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getUTCHours.length",
+ 0,
+ Date.prototype.getUTCHours.length );
+ test();
+function addTestCase( t ) {
+ for ( h = 0; h < 24; h+=3 ) {
+ t += msPerHour;
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getUTCHours()",
+ HourFromTime((t)),
+ (new Date(t)).getUTCHours() );
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.16.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.16.js
new file mode 100644
index 0000000..2a02370
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.16.js
@@ -0,0 +1,96 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.16.js
+ ECMA Section: 15.9.5.16
+ Description: Date.prototype.getMinutes
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return MinFromTime(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.16";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getMinutes()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ addTestCase( now );
+ addTestCase( TIME_YEAR_0 );
+ addTestCase( TIME_1970 );
+ addTestCase( TIME_1900 );
+ addTestCase( TIME_2000 );
+ addTestCase( UTC_FEB_29_2000 );
+ addTestCase( UTC_JAN_1_2005 );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getMinutes()",
+ NaN,
+ (new Date(NaN)).getMinutes() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getMinutes.length",
+ 0,
+ Date.prototype.getMinutes.length );
+ test();
+function addTestCase( t ) {
+ for ( m = 0; m <= 60; m+=10 ) {
+ t += msPerMinute;
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getMinutes()",
+ MinFromTime((LocalTime(t))),
+ (new Date(t)).getMinutes() );
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.17.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.17.js
new file mode 100644
index 0000000..0afaa7b
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.17.js
@@ -0,0 +1,97 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.17.js
+ ECMA Section: 15.9.5.17
+ Description: Date.prototype.getUTCMinutes
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return MinFromTime(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.17";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getUTCMinutes()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ addTestCase( now );
+ addTestCase( TIME_YEAR_0 );
+ addTestCase( TIME_1970 );
+ addTestCase( TIME_1900 );
+ addTestCase( TIME_2000 );
+ addTestCase( UTC_FEB_29_2000 );
+ addTestCase( UTC_JAN_1_2005 );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getUTCMinutes()",
+ NaN,
+ (new Date(NaN)).getUTCMinutes() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getUTCMinutes.length",
+ 0,
+ Date.prototype.getUTCMinutes.length );
+ test();
+function addTestCase( t ) {
+ for ( m = 0; m <= 60; m+=10 ) {
+ t += msPerMinute;
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getUTCMinutes()",
+ MinFromTime(t),
+ (new Date(t)).getUTCMinutes() );
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.18.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.18.js
new file mode 100644
index 0000000..1537683
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.18.js
@@ -0,0 +1,97 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.18.js
+ ECMA Section: 15.9.5.18
+ Description: Date.prototype.getSeconds
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return SecFromTime(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.18";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getSeconds()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ addTestCase( now );
+ addTestCase( TIME_YEAR_0 );
+ addTestCase( TIME_1970 );
+ addTestCase( TIME_1900 );
+ addTestCase( TIME_2000 );
+ addTestCase( UTC_FEB_29_2000 );
+ addTestCase( UTC_JAN_1_2005 );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getSeconds()",
+ NaN,
+ (new Date(NaN)).getSeconds() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getSeconds.length",
+ 0,
+ Date.prototype.getSeconds.length );
+ test();
+function addTestCase( t ) {
+ for ( m = 0; m <= 60; m+=10 ) {
+ t += 1000;
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getSeconds()",
+ SecFromTime(LocalTime(t)),
+ (new Date(t)).getSeconds() );
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.19.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.19.js
new file mode 100644
index 0000000..91f2a0a
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.19.js
@@ -0,0 +1,97 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.19.js
+ ECMA Section: 15.9.5.19
+ Description: Date.prototype.getUTCSeconds
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return SecFromTime(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.19";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getUTCSeconds()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ addTestCase( now );
+ addTestCase( TIME_YEAR_0 );
+ addTestCase( TIME_1970 );
+ addTestCase( TIME_1900 );
+ addTestCase( TIME_2000 );
+ addTestCase( UTC_FEB_29_2000 );
+ addTestCase( UTC_JAN_1_2005 );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getUTCSeconds()",
+ NaN,
+ (new Date(NaN)).getUTCSeconds() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getUTCSeconds.length",
+ 0,
+ Date.prototype.getUTCSeconds.length );
+ test();
+function addTestCase( t ) {
+ for ( m = 0; m <= 60; m+=10 ) {
+ t += 1000;
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getUTCSeconds()",
+ SecFromTime(t),
+ (new Date(t)).getUTCSeconds() );
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.2-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.2-1.js
new file mode 100644
index 0000000..bb0fb02
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.2-1.js
@@ -0,0 +1,152 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.2.js
+ ECMA Section: 15.9.5.2 Date.prototype.toString
+ Description:
+ This function returns a string value. The contents of the string are
+ implementation dependent, but are intended to represent the Date in a
+ convenient, human-readable form in the current time zone.
+
+ The toString function is not generic; it generates a runtime error if its
+ this value is not a Date object. Therefore it cannot be transferred to
+ other kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.toString";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.toString.length",
+ 0,
+ Date.prototype.toString.length );
+
+ var now = new Date();
+
+ // can't test the content of the string, but can verify that the string is
+ // parsable by Date.parse
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Math.abs(Date.parse(now.toString()) - now.valueOf()) < 1000",
+ true,
+ Math.abs(Date.parse(now.toString()) - now.valueOf()) < 1000 );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "typeof now.toString()",
+ "string",
+ typeof now.toString() );
+ // 1970
+
+ TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.parse( (new Date(0)).toString() )",
+ 0,
+ Date.parse( (new Date(0)).toString() ) )
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.parse( (new Date("+TZ_ADJUST+")).toString() )",
+ TZ_ADJUST,
+ Date.parse( (new Date(TZ_ADJUST)).toString() ) )
+
+ // 1900
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.parse( (new Date("+TIME_1900+")).toString() )",
+ TIME_1900,
+ Date.parse( (new Date(TIME_1900)).toString() ) )
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.parse( (new Date("+TIME_1900 -TZ_ADJUST+")).toString() )",
+ TIME_1900 -TZ_ADJUST,
+ Date.parse( (new Date(TIME_1900 -TZ_ADJUST)).toString() ) )
+
+ // 2000
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.parse( (new Date("+TIME_2000+")).toString() )",
+ TIME_2000,
+ Date.parse( (new Date(TIME_2000)).toString() ) )
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.parse( (new Date("+TIME_2000 -TZ_ADJUST+")).toString() )",
+ TIME_2000 -TZ_ADJUST,
+ Date.parse( (new Date(TIME_2000 -TZ_ADJUST)).toString() ) )
+
+ // 29 Feb 2000
+
+ var UTC_29_FEB_2000 = TIME_2000 + 31*msPerDay + 28*msPerDay;
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.parse( (new Date("+UTC_29_FEB_2000+")).toString() )",
+ UTC_29_FEB_2000,
+ Date.parse( (new Date(UTC_29_FEB_2000)).toString() ) )
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.parse( (new Date("+(UTC_29_FEB_2000-1000)+")).toString() )",
+ UTC_29_FEB_2000-1000,
+ Date.parse( (new Date(UTC_29_FEB_2000-1000)).toString() ) )
+
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.parse( (new Date("+(UTC_29_FEB_2000-TZ_ADJUST)+")).toString() )",
+ UTC_29_FEB_2000-TZ_ADJUST,
+ Date.parse( (new Date(UTC_29_FEB_2000-TZ_ADJUST)).toString() ) )
+ // 2O05
+
+ var UTC_1_JAN_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001) +
+ TimeInYear(2002) + TimeInYear(2003) + TimeInYear(2004);
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.parse( (new Date("+UTC_1_JAN_2005+")).toString() )",
+ UTC_1_JAN_2005,
+ Date.parse( (new Date(UTC_1_JAN_2005)).toString() ) )
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.parse( (new Date("+(UTC_1_JAN_2005-1000)+")).toString() )",
+ UTC_1_JAN_2005-1000,
+ Date.parse( (new Date(UTC_1_JAN_2005-1000)).toString() ) )
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.parse( (new Date("+(UTC_1_JAN_2005-TZ_ADJUST)+")).toString() )",
+ UTC_1_JAN_2005-TZ_ADJUST,
+ Date.parse( (new Date(UTC_1_JAN_2005-TZ_ADJUST)).toString() ) )
+
+ test();
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.2-2-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.2-2-n.js
new file mode 100644
index 0000000..8044dd8
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.2-2-n.js
@@ -0,0 +1,77 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.2-2.js
+ ECMA Section: 15.9.5.2 Date.prototype.toString
+ Description:
+ This function returns a string value. The contents of the string are
+ implementation dependent, but are intended to represent the Date in a
+ convenient, human-readable form in the current time zone.
+
+ The toString function is not generic; it generates a runtime error if its
+ this value is not a Date object. Therefore it cannot be transferred to
+ other kinds of objects for use as a method.
+
+
+ This verifies that calling toString on an object that is not a string
+ generates a runtime error.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.2-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.toString";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var OBJ = new MyObject( new Date(0) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "var OBJ = new MyObject( new Date(0) ); OBJ.toString()",
+ "error",
+ OBJ.toString() );
+ test();
+
+function MyObject( value ) {
+ this.value = value;
+ this.valueOf = new Function( "return this.value" );
+ this.toString = Date.prototype.toString;
+ return this;
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.2.js
new file mode 100644
index 0000000..bb0fb02
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.2.js
@@ -0,0 +1,152 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.2.js
+ ECMA Section: 15.9.5.2 Date.prototype.toString
+ Description:
+ This function returns a string value. The contents of the string are
+ implementation dependent, but are intended to represent the Date in a
+ convenient, human-readable form in the current time zone.
+
+ The toString function is not generic; it generates a runtime error if its
+ this value is not a Date object. Therefore it cannot be transferred to
+ other kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.toString";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.toString.length",
+ 0,
+ Date.prototype.toString.length );
+
+ var now = new Date();
+
+ // can't test the content of the string, but can verify that the string is
+ // parsable by Date.parse
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Math.abs(Date.parse(now.toString()) - now.valueOf()) < 1000",
+ true,
+ Math.abs(Date.parse(now.toString()) - now.valueOf()) < 1000 );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "typeof now.toString()",
+ "string",
+ typeof now.toString() );
+ // 1970
+
+ TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.parse( (new Date(0)).toString() )",
+ 0,
+ Date.parse( (new Date(0)).toString() ) )
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.parse( (new Date("+TZ_ADJUST+")).toString() )",
+ TZ_ADJUST,
+ Date.parse( (new Date(TZ_ADJUST)).toString() ) )
+
+ // 1900
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.parse( (new Date("+TIME_1900+")).toString() )",
+ TIME_1900,
+ Date.parse( (new Date(TIME_1900)).toString() ) )
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.parse( (new Date("+TIME_1900 -TZ_ADJUST+")).toString() )",
+ TIME_1900 -TZ_ADJUST,
+ Date.parse( (new Date(TIME_1900 -TZ_ADJUST)).toString() ) )
+
+ // 2000
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.parse( (new Date("+TIME_2000+")).toString() )",
+ TIME_2000,
+ Date.parse( (new Date(TIME_2000)).toString() ) )
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.parse( (new Date("+TIME_2000 -TZ_ADJUST+")).toString() )",
+ TIME_2000 -TZ_ADJUST,
+ Date.parse( (new Date(TIME_2000 -TZ_ADJUST)).toString() ) )
+
+ // 29 Feb 2000
+
+ var UTC_29_FEB_2000 = TIME_2000 + 31*msPerDay + 28*msPerDay;
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.parse( (new Date("+UTC_29_FEB_2000+")).toString() )",
+ UTC_29_FEB_2000,
+ Date.parse( (new Date(UTC_29_FEB_2000)).toString() ) )
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.parse( (new Date("+(UTC_29_FEB_2000-1000)+")).toString() )",
+ UTC_29_FEB_2000-1000,
+ Date.parse( (new Date(UTC_29_FEB_2000-1000)).toString() ) )
+
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.parse( (new Date("+(UTC_29_FEB_2000-TZ_ADJUST)+")).toString() )",
+ UTC_29_FEB_2000-TZ_ADJUST,
+ Date.parse( (new Date(UTC_29_FEB_2000-TZ_ADJUST)).toString() ) )
+ // 2O05
+
+ var UTC_1_JAN_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001) +
+ TimeInYear(2002) + TimeInYear(2003) + TimeInYear(2004);
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.parse( (new Date("+UTC_1_JAN_2005+")).toString() )",
+ UTC_1_JAN_2005,
+ Date.parse( (new Date(UTC_1_JAN_2005)).toString() ) )
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.parse( (new Date("+(UTC_1_JAN_2005-1000)+")).toString() )",
+ UTC_1_JAN_2005-1000,
+ Date.parse( (new Date(UTC_1_JAN_2005-1000)).toString() ) )
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.parse( (new Date("+(UTC_1_JAN_2005-TZ_ADJUST)+")).toString() )",
+ UTC_1_JAN_2005-TZ_ADJUST,
+ Date.parse( (new Date(UTC_1_JAN_2005-TZ_ADJUST)).toString() ) )
+
+ test();
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.20.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.20.js
new file mode 100644
index 0000000..3ef81f2
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.20.js
@@ -0,0 +1,97 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.20.js
+ ECMA Section: 15.9.5.20
+ Description: Date.prototype.getMilliseconds
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return msFromTime(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.20";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getMilliseconds()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ addTestCase( now );
+ addTestCase( TIME_YEAR_0 );
+ addTestCase( TIME_1970 );
+ addTestCase( TIME_1900 );
+ addTestCase( TIME_2000 );
+ addTestCase( UTC_FEB_29_2000 );
+ addTestCase( UTC_JAN_1_2005 );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getMilliseconds()",
+ NaN,
+ (new Date(NaN)).getMilliseconds() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getMilliseconds.length",
+ 0,
+ Date.prototype.getMilliseconds.length );
+ test();
+function addTestCase( t ) {
+ for ( m = 0; m <= 1000; m+=100 ) {
+ t++;
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getMilliseconds()",
+ msFromTime(LocalTime(t)),
+ (new Date(t)).getMilliseconds() );
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-1.js
new file mode 100644
index 0000000..eb89ba4
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-1.js
@@ -0,0 +1,97 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.21.js
+ ECMA Section: 15.9.5.21
+ Description: Date.prototype.getUTCMilliseconds
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return msFromTime(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.21";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getUTCMilliseconds()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ addTestCase( now );
+/*
+ addTestCase( TIME_YEAR_0 );
+
+ addTestCase( TIME_1970 );
+ addTestCase( TIME_1900 );
+ addTestCase( TIME_2000 );
+ addTestCase( UTC_FEB_29_2000 );
+ addTestCase( UTC_JAN_1_2005 );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getUTCMilliseconds()",
+ NaN,
+ (new Date(NaN)).getUTCMilliseconds() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getUTCMilliseconds.length",
+ 0,
+ Date.prototype.getUTCMilliseconds.length );
+*/
+ test();
+function addTestCase( t ) {
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getUTCMilliseconds()",
+ msFromTime(t),
+ (new Date(t)).getUTCMilliseconds() );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-2.js
new file mode 100644
index 0000000..5a70d47
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-2.js
@@ -0,0 +1,95 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.21.js
+ ECMA Section: 15.9.5.21
+ Description: Date.prototype.getUTCMilliseconds
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return msFromTime(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.21";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getUTCMilliseconds()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ addTestCase( TIME_YEAR_0 );
+/*
+ addTestCase( TIME_1970 );
+ addTestCase( TIME_1900 );
+ addTestCase( TIME_2000 );
+ addTestCase( UTC_FEB_29_2000 );
+ addTestCase( UTC_JAN_1_2005 );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getUTCMilliseconds()",
+ NaN,
+ (new Date(NaN)).getUTCMilliseconds() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getUTCMilliseconds.length",
+ 0,
+ Date.prototype.getUTCMilliseconds.length );
+*/
+ test();
+function addTestCase( t ) {
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getUTCMilliseconds()",
+ msFromTime(t),
+ (new Date(t)).getUTCMilliseconds() );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-3.js
new file mode 100644
index 0000000..bfd80c8
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-3.js
@@ -0,0 +1,78 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.21.js
+ ECMA Section: 15.9.5.21
+ Description: Date.prototype.getUTCMilliseconds
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return msFromTime(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.21";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getUTCMilliseconds()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ addTestCase( TIME_1970 );
+ test();
+function addTestCase( t ) {
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getUTCMilliseconds()",
+ msFromTime(t),
+ (new Date(t)).getUTCMilliseconds() );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-4.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-4.js
new file mode 100644
index 0000000..3f0e4e8
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-4.js
@@ -0,0 +1,78 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.21.js
+ ECMA Section: 15.9.5.21
+ Description: Date.prototype.getUTCMilliseconds
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return msFromTime(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.21";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getUTCMilliseconds()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ addTestCase( TIME_1900 );
+ test();
+function addTestCase( t ) {
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getUTCMilliseconds()",
+ msFromTime(t),
+ (new Date(t)).getUTCMilliseconds() );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-5.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-5.js
new file mode 100644
index 0000000..2ef6e21
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-5.js
@@ -0,0 +1,78 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.21.js
+ ECMA Section: 15.9.5.21
+ Description: Date.prototype.getUTCMilliseconds
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return msFromTime(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.21";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getUTCMilliseconds()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ addTestCase( TIME_2000 );
+ test();
+function addTestCase( t ) {
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getUTCMilliseconds()",
+ msFromTime(t),
+ (new Date(t)).getUTCMilliseconds() );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-6.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-6.js
new file mode 100644
index 0000000..3973472
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-6.js
@@ -0,0 +1,79 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.21.js
+ ECMA Section: 15.9.5.21
+ Description: Date.prototype.getUTCMilliseconds
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return msFromTime(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.21";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getUTCMilliseconds()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ addTestCase( UTC_FEB_29_2000 );
+
+ test();
+function addTestCase( t ) {
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getUTCMilliseconds()",
+ msFromTime(t),
+ (new Date(t)).getUTCMilliseconds() );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-7.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-7.js
new file mode 100644
index 0000000..e50aa04
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-7.js
@@ -0,0 +1,78 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.21.js
+ ECMA Section: 15.9.5.21
+ Description: Date.prototype.getUTCMilliseconds
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return msFromTime(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.21";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getUTCMilliseconds()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ addTestCase( UTC_JAN_1_2005 );
+ test();
+function addTestCase( t ) {
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getUTCMilliseconds()",
+ msFromTime(t),
+ (new Date(t)).getUTCMilliseconds() );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-8.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-8.js
new file mode 100644
index 0000000..b23dfc3
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-8.js
@@ -0,0 +1,86 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.21.js
+ ECMA Section: 15.9.5.21
+ Description: Date.prototype.getUTCMilliseconds
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return msFromTime(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.21";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getUTCMilliseconds()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getUTCMilliseconds()",
+ NaN,
+ (new Date(NaN)).getUTCMilliseconds() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getUTCMilliseconds.length",
+ 0,
+ Date.prototype.getUTCMilliseconds.length );
+ test();
+function addTestCase( t ) {
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getUTCMilliseconds()",
+ msFromTime(t),
+ (new Date(t)).getUTCMilliseconds() );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-1.js
new file mode 100644
index 0000000..cd84a9b
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-1.js
@@ -0,0 +1,100 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.22.js
+ ECMA Section: 15.9.5.22
+ Description: Date.prototype.getTimezoneOffset
+
+ Returns the difference between local time and UTC time in minutes.
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return (t - LocalTime(t)) / msPerMinute.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.22";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getTimezoneOffset()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+// addTestCase( now );
+
+ addTestCase( TIME_YEAR_0 );
+ addTestCase( TIME_1970 );
+ addTestCase( TIME_1900 );
+ addTestCase( TIME_2000 );
+ addTestCase( UTC_FEB_29_2000 );
+ addTestCase( UTC_JAN_1_2005 );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getTimezoneOffset()",
+ NaN,
+ (new Date(NaN)).getTimezoneOffset() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getTimezoneOffset.length",
+ 0,
+ Date.prototype.getTimezoneOffset.length );
+
+ test();
+function addTestCase( t ) {
+ for ( m = 0; m <= 1000; m+=100 ) {
+ t++;
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getTimezoneOffset()",
+ (t - LocalTime(t)) / msPerMinute,
+ (new Date(t)).getTimezoneOffset() );
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-2.js
new file mode 100644
index 0000000..e516135
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-2.js
@@ -0,0 +1,99 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.22.js
+ ECMA Section: 15.9.5.22
+ Description: Date.prototype.getTimezoneOffset
+
+ Returns the difference between local time and UTC time in minutes.
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return (t - LocalTime(t)) / msPerMinute.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.22";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getTimezoneOffset()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ addTestCase( TIME_YEAR_0 );
+/*
+ addTestCase( TIME_1970 );
+ addTestCase( TIME_1900 );
+ addTestCase( TIME_2000 );
+ addTestCase( UTC_FEB_29_2000 );
+ addTestCase( UTC_JAN_1_2005 );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getTimezoneOffset()",
+ NaN,
+ (new Date(NaN)).getTimezoneOffset() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getTimezoneOffset.length",
+ 0,
+ Date.prototype.getTimezoneOffset.length );
+*/
+ test();
+function addTestCase( t ) {
+ for ( m = 0; m <= 1000; m+=100 ) {
+ t++;
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getTimezoneOffset()",
+ (t - LocalTime(t)) / msPerMinute,
+ (new Date(t)).getTimezoneOffset() );
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-3.js
new file mode 100644
index 0000000..371cbc2
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-3.js
@@ -0,0 +1,98 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.22.js
+ ECMA Section: 15.9.5.22
+ Description: Date.prototype.getTimezoneOffset
+
+ Returns the difference between local time and UTC time in minutes.
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return (t - LocalTime(t)) / msPerMinute.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.22";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getTimezoneOffset()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ addTestCase( TIME_1970 );
+/*
+ addTestCase( TIME_1900 );
+ addTestCase( TIME_2000 );
+ addTestCase( UTC_FEB_29_2000 );
+ addTestCase( UTC_JAN_1_2005 );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getTimezoneOffset()",
+ NaN,
+ (new Date(NaN)).getTimezoneOffset() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getTimezoneOffset.length",
+ 0,
+ Date.prototype.getTimezoneOffset.length );
+*/
+ test();
+function addTestCase( t ) {
+ for ( m = 0; m <= 1000; m+=100 ) {
+ t++;
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getTimezoneOffset()",
+ (t - LocalTime(t)) / msPerMinute,
+ (new Date(t)).getTimezoneOffset() );
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-4.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-4.js
new file mode 100644
index 0000000..1c63441
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-4.js
@@ -0,0 +1,97 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.22.js
+ ECMA Section: 15.9.5.22
+ Description: Date.prototype.getTimezoneOffset
+
+ Returns the difference between local time and UTC time in minutes.
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return (t - LocalTime(t)) / msPerMinute.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.22";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getTimezoneOffset()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ addTestCase( TIME_1900 );
+/*
+ addTestCase( TIME_2000 );
+ addTestCase( UTC_FEB_29_2000 );
+ addTestCase( UTC_JAN_1_2005 );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getTimezoneOffset()",
+ NaN,
+ (new Date(NaN)).getTimezoneOffset() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getTimezoneOffset.length",
+ 0,
+ Date.prototype.getTimezoneOffset.length );
+*/
+ test();
+function addTestCase( t ) {
+ for ( m = 0; m <= 1000; m+=100 ) {
+ t++;
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getTimezoneOffset()",
+ (t - LocalTime(t)) / msPerMinute,
+ (new Date(t)).getTimezoneOffset() );
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-5.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-5.js
new file mode 100644
index 0000000..3f20ea4
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-5.js
@@ -0,0 +1,96 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.22.js
+ ECMA Section: 15.9.5.22
+ Description: Date.prototype.getTimezoneOffset
+
+ Returns the difference between local time and UTC time in minutes.
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return (t - LocalTime(t)) / msPerMinute.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.22";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getTimezoneOffset()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ addTestCase( TIME_2000 );
+/*
+ addTestCase( UTC_FEB_29_2000 );
+ addTestCase( UTC_JAN_1_2005 );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getTimezoneOffset()",
+ NaN,
+ (new Date(NaN)).getTimezoneOffset() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getTimezoneOffset.length",
+ 0,
+ Date.prototype.getTimezoneOffset.length );
+*/
+ test();
+function addTestCase( t ) {
+ for ( m = 0; m <= 1000; m+=100 ) {
+ t++;
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getTimezoneOffset()",
+ (t - LocalTime(t)) / msPerMinute,
+ (new Date(t)).getTimezoneOffset() );
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-6.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-6.js
new file mode 100644
index 0000000..0aee4a0
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-6.js
@@ -0,0 +1,95 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.22.js
+ ECMA Section: 15.9.5.22
+ Description: Date.prototype.getTimezoneOffset
+
+ Returns the difference between local time and UTC time in minutes.
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return (t - LocalTime(t)) / msPerMinute.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.22";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getTimezoneOffset()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ addTestCase( UTC_FEB_29_2000 );
+/*
+ addTestCase( UTC_JAN_1_2005 );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getTimezoneOffset()",
+ NaN,
+ (new Date(NaN)).getTimezoneOffset() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getTimezoneOffset.length",
+ 0,
+ Date.prototype.getTimezoneOffset.length );
+*/
+ test();
+function addTestCase( t ) {
+ for ( m = 0; m <= 1000; m+=100 ) {
+ t++;
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getTimezoneOffset()",
+ (t - LocalTime(t)) / msPerMinute,
+ (new Date(t)).getTimezoneOffset() );
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-7.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-7.js
new file mode 100644
index 0000000..2d6ecfc
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-7.js
@@ -0,0 +1,93 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.22.js
+ ECMA Section: 15.9.5.22
+ Description: Date.prototype.getTimezoneOffset
+
+ Returns the difference between local time and UTC time in minutes.
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return (t - LocalTime(t)) / msPerMinute.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.22";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getTimezoneOffset()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ addTestCase( UTC_JAN_1_2005 );
+/*
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getTimezoneOffset()",
+ NaN,
+ (new Date(NaN)).getTimezoneOffset() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getTimezoneOffset.length",
+ 0,
+ Date.prototype.getTimezoneOffset.length );
+*/
+ test();
+function addTestCase( t ) {
+ for ( m = 0; m <= 1000; m+=100 ) {
+ t++;
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getTimezoneOffset()",
+ (t - LocalTime(t)) / msPerMinute,
+ (new Date(t)).getTimezoneOffset() );
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-8.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-8.js
new file mode 100644
index 0000000..f7d6520
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-8.js
@@ -0,0 +1,90 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.22.js
+ ECMA Section: 15.9.5.22
+ Description: Date.prototype.getTimezoneOffset
+
+ Returns the difference between local time and UTC time in minutes.
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return (t - LocalTime(t)) / msPerMinute.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.22";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getTimezoneOffset()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getTimezoneOffset()",
+ NaN,
+ (new Date(NaN)).getTimezoneOffset() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getTimezoneOffset.length",
+ 0,
+ Date.prototype.getTimezoneOffset.length );
+ test();
+function addTestCase( t ) {
+ for ( m = 0; m <= 1000; m+=100 ) {
+ t++;
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getTimezoneOffset()",
+ (t - LocalTime(t)) / msPerMinute,
+ (new Date(t)).getTimezoneOffset() );
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-1.js
new file mode 100644
index 0000000..3a74450
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-1.js
@@ -0,0 +1,157 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.23-1.js
+ ECMA Section: 15.9.5.23 Date.prototype.setTime(time)
+ Description:
+
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var SECTION = "15.9.5.23-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.setTime()";
+
+
+ var testcases = new Array();
+ writeHeaderToLog( SECTION + " Date.prototype.setTime(time)");
+
+ getTestCases();
+ test();
+
+function getTestCases() {
+ var now = "now";
+ addTestCase( 0, 0 );
+/*
+ addTestCase( now, -2208988800000 );
+ addTestCase( now, -86400000 );
+ addTestCase( now, 946684800000 );
+
+ // this daylight savings case fails -- need to fix date test functions
+// addTestCase( now, -69609600000 );
+ addTestCase( now, -2208988800000 );
+ addTestCase( now, 946684800000 );
+
+ // this daylight savings case fails -- need to fix date test functions
+// addTestCase( now, -69609600000 );
+ addTestCase( now, 0 );
+ addTestCase( now, String( TIME_1900 ) );
+ addTestCase( now, String( TZ_DIFF* msPerHour ) );
+ addTestCase( now, String( TIME_2000 ) );
+*/
+}
+
+function addTestCase( startTime, setTime ) {
+ if ( startTime == "now" ) {
+ DateCase = new Date();
+ } else {
+ DateCase = new Date( startTime );
+ }
+
+ DateCase.setTime( setTime );
+ var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ;
+ var UTCDate = UTCDateFromTime ( Number(setTime) );
+ var LocalDate = LocalDateFromTime( Number(setTime) );
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+ return (d);
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-10.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-10.js
new file mode 100644
index 0000000..406123b
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-10.js
@@ -0,0 +1,156 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.23-1.js
+ ECMA Section: 15.9.5.23 Date.prototype.setTime(time)
+ Description:
+
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var SECTION = "15.9.5.23-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.setTime()";
+
+
+ var testcases = new Array();
+
+ getTestCases();
+ writeHeaderToLog( SECTION + " Date.prototype.setTime(time)");
+ test();
+
+function getTestCases() {
+ var now = "now";
+ addTestCase( now, -2208988800000 );
+/*
+ addTestCase( now, -86400000 );
+ addTestCase( now, 946684800000 );
+
+ // this daylight savings case fails -- need to fix date test functions
+// addTestCase( now, -69609600000 );
+ addTestCase( now, -2208988800000 );
+ addTestCase( now, 946684800000 );
+
+ // this daylight savings case fails -- need to fix date test functions
+// addTestCase( now, -69609600000 );
+ addTestCase( now, 0 );
+ addTestCase( now, String( TIME_1900 ) );
+ addTestCase( now, String( TZ_DIFF* msPerHour ) );
+ addTestCase( now, String( TIME_2000 ) );
+*/
+}
+
+function addTestCase( startTime, setTime ) {
+ if ( startTime == "now" ) {
+ DateCase = new Date();
+ } else {
+ DateCase = new Date( startTime );
+ }
+
+ DateCase.setTime( setTime );
+ var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ;
+ var UTCDate = UTCDateFromTime ( Number(setTime) );
+ var LocalDate = LocalDateFromTime( Number(setTime) );
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+ return (d);
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-11.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-11.js
new file mode 100644
index 0000000..377edd5
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-11.js
@@ -0,0 +1,155 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.23-1.js
+ ECMA Section: 15.9.5.23 Date.prototype.setTime(time)
+ Description:
+
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var SECTION = "15.9.5.23-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.setTime()";
+
+ writeHeaderToLog( SECTION + " Date.prototype.setTime(time)");
+
+ var testcases = new Array();
+ getTestCases();
+
+ test();
+
+function getTestCases() {
+ var now = "now";
+ addTestCase( now, -86400000 );
+/*
+ addTestCase( now, 946684800000 );
+
+ // this daylight savings case fails -- need to fix date test functions
+// addTestCase( now, -69609600000 );
+ addTestCase( now, -2208988800000 );
+ addTestCase( now, 946684800000 );
+
+ // this daylight savings case fails -- need to fix date test functions
+// addTestCase( now, -69609600000 );
+ addTestCase( now, 0 );
+ addTestCase( now, String( TIME_1900 ) );
+ addTestCase( now, String( TZ_DIFF* msPerHour ) );
+ addTestCase( now, String( TIME_2000 ) );
+*/
+}
+
+function addTestCase( startTime, setTime ) {
+ if ( startTime == "now" ) {
+ DateCase = new Date();
+ } else {
+ DateCase = new Date( startTime );
+ }
+
+ DateCase.setTime( setTime );
+ var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ;
+ var UTCDate = UTCDateFromTime ( Number(setTime) );
+ var LocalDate = LocalDateFromTime( Number(setTime) );
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+ return (d);
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-12.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-12.js
new file mode 100644
index 0000000..b0820c0
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-12.js
@@ -0,0 +1,153 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.23-1.js
+ ECMA Section: 15.9.5.23 Date.prototype.setTime(time)
+ Description:
+
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var SECTION = "15.9.5.23-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.setTime()";
+
+
+ var testcases = new Array();
+ getTestCases();
+
+ writeHeaderToLog( SECTION + " Date.prototype.setTime(time)");
+ test();
+
+function getTestCases() {
+ var now = "now";
+ addTestCase( now, 946684800000 );
+/*
+ // this daylight savings case fails -- need to fix date test functions
+// addTestCase( now, -69609600000 );
+ addTestCase( now, -2208988800000 );
+ addTestCase( now, 946684800000 );
+
+ // this daylight savings case fails -- need to fix date test functions
+// addTestCase( now, -69609600000 );
+ addTestCase( now, 0 );
+ addTestCase( now, String( TIME_1900 ) );
+ addTestCase( now, String( TZ_DIFF* msPerHour ) );
+ addTestCase( now, String( TIME_2000 ) );
+*/
+}
+
+function addTestCase( startTime, setTime ) {
+ if ( startTime == "now" ) {
+ DateCase = new Date();
+ } else {
+ DateCase = new Date( startTime );
+ }
+
+ DateCase.setTime( setTime );
+ var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ;
+ var UTCDate = UTCDateFromTime ( Number(setTime) );
+ var LocalDate = LocalDateFromTime( Number(setTime) );
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+ return (d);
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-13.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-13.js
new file mode 100644
index 0000000..058a7c7
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-13.js
@@ -0,0 +1,150 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.23-1.js
+ ECMA Section: 15.9.5.23 Date.prototype.setTime(time)
+ Description:
+
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var SECTION = "15.9.5.23-13";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.setTime()";
+
+
+ writeHeaderToLog( SECTION + " Date.prototype.setTime(time)");
+
+ var testcases = new Array();
+ getTestCases();
+ test();
+
+function getTestCases() {
+ var now = "now";
+ addTestCase( now, -2208988800000 );
+/*
+ addTestCase( now, 946684800000 );
+
+ // this daylight savings case fails -- need to fix date test functions
+// addTestCase( now, -69609600000 );
+ addTestCase( now, 0 );
+ addTestCase( now, String( TIME_1900 ) );
+ addTestCase( now, String( TZ_DIFF* msPerHour ) );
+ addTestCase( now, String( TIME_2000 ) );
+*/
+}
+
+function addTestCase( startTime, setTime ) {
+ if ( startTime == "now" ) {
+ DateCase = new Date();
+ } else {
+ DateCase = new Date( startTime );
+ }
+
+ DateCase.setTime( setTime );
+ var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ;
+ var UTCDate = UTCDateFromTime ( Number(setTime) );
+ var LocalDate = LocalDateFromTime( Number(setTime) );
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+ return (d);
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-14.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-14.js
new file mode 100644
index 0000000..135e808
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-14.js
@@ -0,0 +1,148 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.23-1.js
+ ECMA Section: 15.9.5.23 Date.prototype.setTime(time)
+ Description:
+
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var SECTION = "15.9.5.23-14";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.setTime()";
+
+
+ writeHeaderToLog( SECTION + " Date.prototype.setTime(time)");
+
+ var testcases = new Array();
+ getTestCases();
+ test();
+
+function getTestCases() {
+ var now = "now";
+ addTestCase( now, 946684800000 );
+/*
+ // this daylight savings case fails -- need to fix date test functions
+// addTestCase( now, -69609600000 );
+ addTestCase( now, 0 );
+ addTestCase( now, String( TIME_1900 ) );
+ addTestCase( now, String( TZ_DIFF* msPerHour ) );
+ addTestCase( now, String( TIME_2000 ) );
+*/
+}
+
+function addTestCase( startTime, setTime ) {
+ if ( startTime == "now" ) {
+ DateCase = new Date();
+ } else {
+ DateCase = new Date( startTime );
+ }
+
+ DateCase.setTime( setTime );
+ var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ;
+ var UTCDate = UTCDateFromTime ( Number(setTime) );
+ var LocalDate = LocalDateFromTime( Number(setTime) );
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+ return (d);
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-15.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-15.js
new file mode 100644
index 0000000..0f4e587
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-15.js
@@ -0,0 +1,144 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.23-1.js
+ ECMA Section: 15.9.5.23 Date.prototype.setTime(time)
+ Description:
+
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var SECTION = "15.9.5.23-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.setTime()";
+
+ writeHeaderToLog( SECTION + " Date.prototype.setTime(time)");
+
+ var testcases = new Array();
+ getTestCases();
+ test();
+
+function getTestCases() {
+ var now = "now";
+ addTestCase( now, 0 );
+/*
+ addTestCase( now, String( TIME_1900 ) );
+ addTestCase( now, String( TZ_DIFF* msPerHour ) );
+ addTestCase( now, String( TIME_2000 ) );
+*/
+}
+
+function addTestCase( startTime, setTime ) {
+ if ( startTime == "now" ) {
+ DateCase = new Date();
+ } else {
+ DateCase = new Date( startTime );
+ }
+
+ DateCase.setTime( setTime );
+ var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ;
+ var UTCDate = UTCDateFromTime ( Number(setTime) );
+ var LocalDate = LocalDateFromTime( Number(setTime) );
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+ return (d);
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-16.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-16.js
new file mode 100644
index 0000000..7390eb5
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-16.js
@@ -0,0 +1,143 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.23-1.js
+ ECMA Section: 15.9.5.23 Date.prototype.setTime(time)
+ Description:
+
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var SECTION = "15.9.5.23-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.setTime()";
+
+ writeHeaderToLog( SECTION + " Date.prototype.setTime(time)");
+
+ var testcases = new Array();
+ getTestCases();
+ test();
+
+function getTestCases() {
+ var now = "now";
+ addTestCase( now, String( TIME_1900 ) );
+/*
+ addTestCase( now, String( TZ_DIFF* msPerHour ) );
+ addTestCase( now, String( TIME_2000 ) );
+*/
+}
+
+function addTestCase( startTime, setTime ) {
+ if ( startTime == "now" ) {
+ DateCase = new Date();
+ } else {
+ DateCase = new Date( startTime );
+ }
+
+ DateCase.setTime( setTime );
+ var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ;
+ var UTCDate = UTCDateFromTime ( Number(setTime) );
+ var LocalDate = LocalDateFromTime( Number(setTime) );
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+ return (d);
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-17.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-17.js
new file mode 100644
index 0000000..0ac866e
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-17.js
@@ -0,0 +1,142 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.23-1.js
+ ECMA Section: 15.9.5.23 Date.prototype.setTime(time)
+ Description:
+
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var SECTION = "15.9.5.23-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.setTime()";
+
+ writeHeaderToLog( SECTION + " Date.prototype.setTime(time)");
+
+ var testcases = new Array();
+ getTestCases();
+ test();
+
+function getTestCases() {
+ var now = "now";
+ addTestCase( now, String( TZ_DIFF* msPerHour ) );
+/*
+ addTestCase( now, String( TIME_2000 ) );
+*/
+}
+
+function addTestCase( startTime, setTime ) {
+ if ( startTime == "now" ) {
+ DateCase = new Date();
+ } else {
+ DateCase = new Date( startTime );
+ }
+
+ DateCase.setTime( setTime );
+ var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ;
+ var UTCDate = UTCDateFromTime ( Number(setTime) );
+ var LocalDate = LocalDateFromTime( Number(setTime) );
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+ return (d);
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-18.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-18.js
new file mode 100644
index 0000000..902f411
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-18.js
@@ -0,0 +1,139 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.23-1.js
+ ECMA Section: 15.9.5.23 Date.prototype.setTime(time)
+ Description:
+
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var SECTION = "15.9.5.23-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.setTime()";
+
+ writeHeaderToLog( SECTION + " Date.prototype.setTime(time)");
+
+ var testcases = new Array();
+ getTestCases();
+ test();
+
+function getTestCases() {
+ var now = "now";
+ addTestCase( now, String( TIME_2000 ) );
+}
+
+function addTestCase( startTime, setTime ) {
+ if ( startTime == "now" ) {
+ DateCase = new Date();
+ } else {
+ DateCase = new Date( startTime );
+ }
+
+ DateCase.setTime( setTime );
+ var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ;
+ var UTCDate = UTCDateFromTime ( Number(setTime) );
+ var LocalDate = LocalDateFromTime( Number(setTime) );
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+ return (d);
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-2.js
new file mode 100644
index 0000000..e471514
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-2.js
@@ -0,0 +1,111 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.23-2.js
+ ECMA Section: 15.9.5.23
+ Description: Date.prototype.setTime
+
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "15.9.5.23-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.setTime()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ test_times = new Array( now, TIME_1970, TIME_1900, TIME_2000 );
+
+
+ for ( var j = 0; j < test_times.length; j++ ) {
+ addTestCase( new Date(now), test_times[j] );
+ }
+
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).setTime()",
+ NaN,
+ (new Date(NaN)).setTime() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.setTime.length",
+ 1,
+ Date.prototype.setTime.length );
+ test();
+function addTestCase( d, t ) {
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+t+")",
+ t,
+ d.setTime(t) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+1.1)+")",
+ TimeClip(t+1.1),
+ d.setTime(t+1.1) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+1)+")",
+ t+1,
+ d.setTime(t+1) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t-1)+")",
+ t-1,
+ d.setTime(t-1) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t-TZ_ADJUST)+")",
+ t-TZ_ADJUST,
+ d.setTime(t-TZ_ADJUST) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+TZ_ADJUST)+")",
+ t+TZ_ADJUST,
+ d.setTime(t+TZ_ADJUST) );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-3-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-3-n.js
new file mode 100644
index 0000000..44fffdf
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-3-n.js
@@ -0,0 +1,70 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.23-3-n.js
+ ECMA Section: 15.9.5.23
+ Description: Date.prototype.setTime
+
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.23-3-n";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.setTime()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var MYDATE = new MyDate(TIME_1970);
+
+ testcases[tc++] = new TestCase( SECTION,
+ "MYDATE.setTime(TIME_2000)",
+ "error",
+ MYDATE.setTime(TIME_2000) );
+
+function MyDate(value) {
+ this.value = value;
+ this.setTime = Date.prototype.setTime;
+ return this;
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-4.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-4.js
new file mode 100644
index 0000000..633bbf6
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-4.js
@@ -0,0 +1,122 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.23-2.js
+ ECMA Section: 15.9.5.23
+ Description: Date.prototype.setTime
+
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.23-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.setTime()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ test_times = new Array( now, TIME_YEAR_0, TIME_1970, TIME_1900, TIME_2000,
+ UTC_FEB_29_2000, UTC_JAN_1_2005 );
+
+
+ for ( var j = 0; j < test_times.length; j++ ) {
+ addTestCase( new Date(TIME_YEAR_0), test_times[j] );
+ }
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).setTime()",
+ NaN,
+ (new Date(NaN)).setTime() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.setTime.length",
+ 1,
+ Date.prototype.setTime.length );
+ test();
+
+function addTestCase( d, t ) {
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+t+")",
+ t,
+ d.setTime(t) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+1.1)+")",
+ TimeClip(t+1.1),
+ d.setTime(t+1.1) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+1)+")",
+ t+1,
+ d.setTime(t+1) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t-1)+")",
+ t-1,
+ d.setTime(t-1) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t-TZ_ADJUST)+")",
+ t-TZ_ADJUST,
+ d.setTime(t-TZ_ADJUST) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+TZ_ADJUST)+")",
+ t+TZ_ADJUST,
+ d.setTime(t+TZ_ADJUST) );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-5.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-5.js
new file mode 100644
index 0000000..ab8d9a7
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-5.js
@@ -0,0 +1,122 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.23-2.js
+ ECMA Section: 15.9.5.23
+ Description: Date.prototype.setTime
+
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.23-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.setTime()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ test_times = new Array( now, TIME_YEAR_0, TIME_1970, TIME_1900, TIME_2000,
+ UTC_FEB_29_2000, UTC_JAN_1_2005 );
+
+
+ for ( var j = 0; j < test_times.length; j++ ) {
+ addTestCase( new Date(TIME_1970), test_times[j] );
+ }
+
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).setTime()",
+ NaN,
+ (new Date(NaN)).setTime() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.setTime.length",
+ 1,
+ Date.prototype.setTime.length );
+ test();
+function addTestCase( d, t ) {
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+t+")",
+ t,
+ d.setTime(t) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+1.1)+")",
+ TimeClip(t+1.1),
+ d.setTime(t+1.1) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+1)+")",
+ t+1,
+ d.setTime(t+1) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t-1)+")",
+ t-1,
+ d.setTime(t-1) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t-TZ_ADJUST)+")",
+ t-TZ_ADJUST,
+ d.setTime(t-TZ_ADJUST) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+TZ_ADJUST)+")",
+ t+TZ_ADJUST,
+ d.setTime(t+TZ_ADJUST) );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-6.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-6.js
new file mode 100644
index 0000000..3f0c3f7
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-6.js
@@ -0,0 +1,122 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.23-2.js
+ ECMA Section: 15.9.5.23
+ Description: Date.prototype.setTime
+
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.23-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.setTime()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ test_times = new Array( now, TIME_YEAR_0, TIME_1970, TIME_1900, TIME_2000,
+ UTC_FEB_29_2000, UTC_JAN_1_2005 );
+
+
+ for ( var j = 0; j < test_times.length; j++ ) {
+ addTestCase( new Date(TIME_1900), test_times[j] );
+ }
+
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).setTime()",
+ NaN,
+ (new Date(NaN)).setTime() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.setTime.length",
+ 1,
+ Date.prototype.setTime.length );
+ test();
+function addTestCase( d, t ) {
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+t+")",
+ t,
+ d.setTime(t) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+1.1)+")",
+ TimeClip(t+1.1),
+ d.setTime(t+1.1) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+1)+")",
+ t+1,
+ d.setTime(t+1) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t-1)+")",
+ t-1,
+ d.setTime(t-1) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t-TZ_ADJUST)+")",
+ t-TZ_ADJUST,
+ d.setTime(t-TZ_ADJUST) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+TZ_ADJUST)+")",
+ t+TZ_ADJUST,
+ d.setTime(t+TZ_ADJUST) );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-7.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-7.js
new file mode 100644
index 0000000..328642f
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-7.js
@@ -0,0 +1,122 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.23-2.js
+ ECMA Section: 15.9.5.23
+ Description: Date.prototype.setTime
+
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.23-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.setTime()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ test_times = new Array( now, TIME_YEAR_0, TIME_1970, TIME_1900, TIME_2000,
+ UTC_FEB_29_2000, UTC_JAN_1_2005 );
+
+
+ for ( var j = 0; j < test_times.length; j++ ) {
+ addTestCase( new Date(TIME_2000), test_times[j] );
+ }
+
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).setTime()",
+ NaN,
+ (new Date(NaN)).setTime() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.setTime.length",
+ 1,
+ Date.prototype.setTime.length );
+ test();
+function addTestCase( d, t ) {
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+t+")",
+ t,
+ d.setTime(t) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+1.1)+")",
+ TimeClip(t+1.1),
+ d.setTime(t+1.1) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+1)+")",
+ t+1,
+ d.setTime(t+1) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t-1)+")",
+ t-1,
+ d.setTime(t-1) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t-TZ_ADJUST)+")",
+ t-TZ_ADJUST,
+ d.setTime(t-TZ_ADJUST) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+TZ_ADJUST)+")",
+ t+TZ_ADJUST,
+ d.setTime(t+TZ_ADJUST) );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-8.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-8.js
new file mode 100644
index 0000000..4b9fbb3
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-8.js
@@ -0,0 +1,111 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.23-2.js
+ ECMA Section: 15.9.5.23
+ Description: Date.prototype.setTime
+
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.23-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.setTime()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+ test_times = new Array( now, TIME_YEAR_0, TIME_1970, TIME_1900, TIME_2000,
+ UTC_FEB_29_2000, UTC_JAN_1_2005 );
+
+
+ for ( var j = 0; j < test_times.length; j++ ) {
+ addTestCase( new Date(UTC_FEB_29_2000), test_times[j] );
+ }
+
+ test();
+function addTestCase( d, t ) {
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+t+")",
+ t,
+ d.setTime(t) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+1.1)+")",
+ TimeClip(t+1.1),
+ d.setTime(t+1.1) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+1)+")",
+ t+1,
+ d.setTime(t+1) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t-1)+")",
+ t-1,
+ d.setTime(t-1) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t-TZ_ADJUST)+")",
+ t-TZ_ADJUST,
+ d.setTime(t-TZ_ADJUST) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+TZ_ADJUST)+")",
+ t+TZ_ADJUST,
+ d.setTime(t+TZ_ADJUST) );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-9.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-9.js
new file mode 100644
index 0000000..cbf8f18
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-9.js
@@ -0,0 +1,112 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.23-2.js
+ ECMA Section: 15.9.5.23
+ Description: Date.prototype.setTime
+
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.23-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.setTime()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ test_times = new Array( now, TIME_YEAR_0, TIME_1970, TIME_1900, TIME_2000,
+ UTC_FEB_29_2000, UTC_JAN_1_2005 );
+
+
+ for ( var j = 0; j < test_times.length; j++ ) {
+ addTestCase( new Date(UTC_JAN_1_2005), test_times[j] );
+ }
+
+ test();
+function addTestCase( d, t ) {
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+t+")",
+ t,
+ d.setTime(t) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+1.1)+")",
+ TimeClip(t+1.1),
+ d.setTime(t+1.1) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+1)+")",
+ t+1,
+ d.setTime(t+1) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t-1)+")",
+ t-1,
+ d.setTime(t-1) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t-TZ_ADJUST)+")",
+ t-TZ_ADJUST,
+ d.setTime(t-TZ_ADJUST) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+TZ_ADJUST)+")",
+ t+TZ_ADJUST,
+ d.setTime(t+TZ_ADJUST) );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-1.js
new file mode 100644
index 0000000..4e7a4fb
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-1.js
@@ -0,0 +1,151 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.24-1.js
+ ECMA Section: 15.9.5.24 Date.prototype.setTime(time)
+ Description:
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var TITLE = "Date.prototype.setTime"
+ var SECTION = "15.9.5.24-1";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Date.prototype.setMilliseconds(ms)");
+
+ var testcases = new Array();
+ getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
+function getTestCases() {
+
+ addTestCase( 0, 0 );
+/*
+ addTestCase( 0, -86400000 );
+ addTestCase( 0, -2208988800000 );
+ addTestCase( 0, 946684800000 );
+
+// This test case is incorrect. Need to fix the DaylightSavings functions in
+// shell.js for this to work properly.
+// addTestCase( 0, -69609600000 );
+// addTestCase( 0, "-69609600000" );
+
+ addTestCase( 0, "0" );
+ addTestCase( 0, "-2208988800000" );
+ addTestCase( 0, "-86400000" );
+ addTestCase( 0, "946684800000" );
+*/
+}
+function addTestCase( startms, newms ) {
+
+ var DateCase = new Date( startms );
+ DateCase.setMilliseconds( newms );
+ var DateString = "var date = new Date("+ startms +"); date.setMilliseconds("+ newms +"); date";
+ var UTCDate = UTCDateFromTime( Number(newms) );
+ var LocalDate = LocalDateFromTime( Number(newms) );
+
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+// testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+// testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-2.js
new file mode 100644
index 0000000..8995cf2
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-2.js
@@ -0,0 +1,150 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.24-1.js
+ ECMA Section: 15.9.5.24 Date.prototype.setTime(time)
+ Description:
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var TITLE = "Date.prototype.setTime"
+ var SECTION = "15.9.5.24-1";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Date.prototype.setMilliseconds(ms)");
+
+ var testcases = new Array();
+ getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
+function getTestCases() {
+
+ addTestCase( 0, -86400000 );
+/*
+ addTestCase( 0, -2208988800000 );
+ addTestCase( 0, 946684800000 );
+
+// This test case is incorrect. Need to fix the DaylightSavings functions in
+// shell.js for this to work properly.
+// addTestCase( 0, -69609600000 );
+// addTestCase( 0, "-69609600000" );
+
+ addTestCase( 0, "0" );
+ addTestCase( 0, "-2208988800000" );
+ addTestCase( 0, "-86400000" );
+ addTestCase( 0, "946684800000" );
+*/
+}
+function addTestCase( startms, newms ) {
+
+ var DateCase = new Date( startms );
+ DateCase.setMilliseconds( newms );
+ var DateString = "var date = new Date("+ startms +"); date.setMilliseconds("+ newms +"); date";
+ var UTCDate = UTCDateFromTime( Number(newms) );
+ var LocalDate = LocalDateFromTime( Number(newms) );
+
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+// testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+// testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-3.js
new file mode 100644
index 0000000..788fc80
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-3.js
@@ -0,0 +1,149 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.24-1.js
+ ECMA Section: 15.9.5.24 Date.prototype.setTime(time)
+ Description:
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var TITLE = "Date.prototype.setTime"
+ var SECTION = "15.9.5.24-1";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Date.prototype.setMilliseconds(ms)");
+
+ var testcases = new Array();
+ getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
+function getTestCases() {
+
+ addTestCase( 0, -2208988800000 );
+/*
+ addTestCase( 0, 946684800000 );
+
+// This test case is incorrect. Need to fix the DaylightSavings functions in
+// shell.js for this to work properly.
+// addTestCase( 0, -69609600000 );
+// addTestCase( 0, "-69609600000" );
+
+ addTestCase( 0, "0" );
+ addTestCase( 0, "-2208988800000" );
+ addTestCase( 0, "-86400000" );
+ addTestCase( 0, "946684800000" );
+*/
+}
+function addTestCase( startms, newms ) {
+
+ var DateCase = new Date( startms );
+ DateCase.setMilliseconds( newms );
+ var DateString = "var date = new Date("+ startms +"); date.setMilliseconds("+ newms +"); date";
+ var UTCDate = UTCDateFromTime( Number(newms) );
+ var LocalDate = LocalDateFromTime( Number(newms) );
+
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+// testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+// testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-4.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-4.js
new file mode 100644
index 0000000..b003de4
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-4.js
@@ -0,0 +1,148 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.24-1.js
+ ECMA Section: 15.9.5.24 Date.prototype.setTime(time)
+ Description:
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var TITLE = "Date.prototype.setTime"
+ var SECTION = "15.9.5.24-1";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Date.prototype.setMilliseconds(ms)");
+
+ var testcases = new Array();
+ getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
+function getTestCases() {
+
+ addTestCase( 0, 946684800000 );
+/*
+
+// This test case is incorrect. Need to fix the DaylightSavings functions in
+// shell.js for this to work properly.
+// addTestCase( 0, -69609600000 );
+// addTestCase( 0, "-69609600000" );
+
+ addTestCase( 0, "0" );
+ addTestCase( 0, "-2208988800000" );
+ addTestCase( 0, "-86400000" );
+ addTestCase( 0, "946684800000" );
+*/
+}
+function addTestCase( startms, newms ) {
+
+ var DateCase = new Date( startms );
+ DateCase.setMilliseconds( newms );
+ var DateString = "var date = new Date("+ startms +"); date.setMilliseconds("+ newms +"); date";
+ var UTCDate = UTCDateFromTime( Number(newms) );
+ var LocalDate = LocalDateFromTime( Number(newms) );
+
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+// testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+// testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-5.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-5.js
new file mode 100644
index 0000000..ccfadc0
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-5.js
@@ -0,0 +1,141 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.24-1.js
+ ECMA Section: 15.9.5.24 Date.prototype.setTime(time)
+ Description:
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var TITLE = "Date.prototype.setTime"
+ var SECTION = "15.9.5.24-1";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Date.prototype.setMilliseconds(ms)");
+
+ var testcases = new Array();
+ getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
+function getTestCases() {
+
+ addTestCase( 0, "0" );
+/*
+ addTestCase( 0, "-2208988800000" );
+ addTestCase( 0, "-86400000" );
+ addTestCase( 0, "946684800000" );
+*/
+}
+function addTestCase( startms, newms ) {
+
+ var DateCase = new Date( startms );
+ DateCase.setMilliseconds( newms );
+ var DateString = "var date = new Date("+ startms +"); date.setMilliseconds("+ newms +"); date";
+ var UTCDate = UTCDateFromTime( Number(newms) );
+ var LocalDate = LocalDateFromTime( Number(newms) );
+
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+// testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+// testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-6.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-6.js
new file mode 100644
index 0000000..cd2d9d1
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-6.js
@@ -0,0 +1,140 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.24-1.js
+ ECMA Section: 15.9.5.24 Date.prototype.setTime(time)
+ Description:
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var TITLE = "Date.prototype.setTime"
+ var SECTION = "15.9.5.24-1";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Date.prototype.setMilliseconds(ms)");
+
+ var testcases = new Array();
+ getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
+function getTestCases() {
+
+ addTestCase( 0, "-2208988800000" );
+/*
+ addTestCase( 0, "-86400000" );
+ addTestCase( 0, "946684800000" );
+*/
+}
+function addTestCase( startms, newms ) {
+
+ var DateCase = new Date( startms );
+ DateCase.setMilliseconds( newms );
+ var DateString = "var date = new Date("+ startms +"); date.setMilliseconds("+ newms +"); date";
+ var UTCDate = UTCDateFromTime( Number(newms) );
+ var LocalDate = LocalDateFromTime( Number(newms) );
+
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+// testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+// testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-7.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-7.js
new file mode 100644
index 0000000..8e5846e
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-7.js
@@ -0,0 +1,139 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.24-1.js
+ ECMA Section: 15.9.5.24 Date.prototype.setTime(time)
+ Description:
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var TITLE = "Date.prototype.setTime"
+ var SECTION = "15.9.5.24-1";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Date.prototype.setMilliseconds(ms)");
+
+ var testcases = new Array();
+ getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
+function getTestCases() {
+
+ addTestCase( 0, "-86400000" );
+/*
+ addTestCase( 0, "946684800000" );
+*/
+}
+function addTestCase( startms, newms ) {
+
+ var DateCase = new Date( startms );
+ DateCase.setMilliseconds( newms );
+ var DateString = "var date = new Date("+ startms +"); date.setMilliseconds("+ newms +"); date";
+ var UTCDate = UTCDateFromTime( Number(newms) );
+ var LocalDate = LocalDateFromTime( Number(newms) );
+
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+// testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+// testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-8.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-8.js
new file mode 100644
index 0000000..956bc9d
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-8.js
@@ -0,0 +1,135 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.24-1.js
+ ECMA Section: 15.9.5.24 Date.prototype.setTime(time)
+ Description:
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var TITLE = "Date.prototype.setTime"
+ var SECTION = "15.9.5.24-1";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Date.prototype.setMilliseconds(ms)");
+
+ var testcases = new Array();
+ getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
+function getTestCases() {
+ addTestCase( 0, "946684800000" );
+}
+function addTestCase( startms, newms ) {
+
+ var DateCase = new Date( startms );
+ DateCase.setMilliseconds( newms );
+ var DateString = "var date = new Date("+ startms +"); date.setMilliseconds("+ newms +"); date";
+ var UTCDate = UTCDateFromTime( Number(newms) );
+ var LocalDate = LocalDateFromTime( Number(newms) );
+
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+// testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+// testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.25-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.25-1.js
new file mode 100644
index 0000000..65cecdc
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.25-1.js
@@ -0,0 +1,190 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.25-1.js
+ ECMA Section: 15.9.5.25 Date.prototype.setUTCMilliseconds(ms)
+ Description:
+ 1. Let t be this time value.
+ 2. Call ToNumber(ms).
+ 3. Compute MakeTime(HourFromTime(t), MinFromTime(t), SecFromTime(t), Result(2)).
+ 4. Compute MakeDate(Day(t), Result(3)).
+ 5. Set the [[Value]] property of the this value to TimeClip(Result(4)).
+ 6. Return the value of the [[Value]] property of the this value.
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "15.9.5.25-1";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Date.prototype.setUTCMilliseconds(ms)");
+
+ var testcases = new Array();
+ getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
+function getTestCases() {
+ addNewTestCase( 0, 0, "TDATE = new Date(0);(TDATE).setUTCMilliseconds(0);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(0,0)),
+ LocalDateFromTime(SetUTCMilliseconds(0,0)) );
+ addNewTestCase( 28800000,999,
+ "TDATE = new Date(28800000);(TDATE).setUTCMilliseconds(999);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(28800000,999)),
+ LocalDateFromTime(SetUTCMilliseconds(28800000,999)) );
+ addNewTestCase( 28800000,-28800000,
+ "TDATE = new Date(28800000);(TDATE).setUTCMilliseconds(-28800000);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(28800000,-28800000)),
+ LocalDateFromTime(SetUTCMilliseconds(28800000,-28800000)) );
+ addNewTestCase( 946684800000,1234567,
+ "TDATE = new Date(946684800000);(TDATE).setUTCMilliseconds(1234567);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(946684800000,1234567)),
+ LocalDateFromTime(SetUTCMilliseconds(946684800000,1234567)) );
+ addNewTestCase( 946684800000, 123456789,
+ "TDATE = new Date(946684800000);(TDATE).setUTCMilliseconds(123456789);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(946684800000,123456789)),
+ LocalDateFromTime(SetUTCMilliseconds(946684800000,123456789)) );
+
+ addNewTestCase( -2208988800000,123456789,
+ "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(123456789);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(-2208988800000,123456789)),
+ LocalDateFromTime(SetUTCMilliseconds(-2208988800000,123456789)) );
+
+ addNewTestCase( -2208988800000,123456,
+ "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(123456);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(-2208988800000,123456)),
+ LocalDateFromTime(SetUTCMilliseconds(-2208988800000,123456)) );
+
+ addNewTestCase( -2208988800000,-123456,
+ "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(-123456);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(-2208988800000,-123456)),
+ LocalDateFromTime(SetUTCMilliseconds(-2208988800000,-123456)) );
+
+ addNewTestCase( 0,-999,
+ "TDATE = new Date(0);(TDATE).setUTCMilliseconds(-999);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(0,-999)),
+ LocalDateFromTime(SetUTCMilliseconds(0,-999)) );
+/*
+ addNewTestCase( "TEST_DATE = new Date(0);(TEST_DATE).setMilliseconds(0);TEST_DATE", UTCDateFromTime(0), LocalDateFromTime(0) );
+// addNewTestCase( "TEST_DATE = new Date(0);(TEST_DATE).setMilliseconds(-2208988800000);TEST_DATE", UTCDateFromTime(-2208988800000), LocalDateFromTime(-2208988800000) );
+ addNewTestCase( "TEST_DATE = new Date(0);(TEST_DATE).setMilliseconds(-86400000);TEST_DATE", UTCDateFromTime(-86400000), LocalDateFromTime(-86400000) );
+ addNewTestCase( "TEST_DATE = new Date(0);(TEST_DATE).setMilliseconds(946684800000);TEST_DATE", UTCDateFromTime(946684800000), LocalDateFromTime(946684800000) );
+ addNewTestCase( "TEST_DATE = new Date(0);(TEST_DATE).setMilliseconds(-69609600000);TEST_DATE", UTCDateFromTime(-69609600000), LocalDateFromTime(-69609600000) );
+
+
+ addNewTestCase( "TEST_DATE = new Date(0);(TEST_DATE).setMilliseconds('0');TEST_DATE", UTCDateFromTime(0), LocalDateFromTime(0) );
+// addNewTestCase( "TEST_DATE = new Date(0);(TEST_DATE).setMilliseconds('-2208988800000');TEST_DATE", UTCDateFromTime(-2208988800000), LocalDateFromTime(-2208988800000) );
+ addNewTestCase( "TEST_DATE = new Date(0);(TEST_DATE).setMilliseconds('-86400000');TEST_DATE", UTCDateFromTime(-86400000), LocalDateFromTime(-86400000) );
+ addNewTestCase( "TEST_DATE = new Date(0);(TEST_DATE).setMilliseconds('946684800000');TEST_DATE", UTCDateFromTime(946684800000), LocalDateFromTime(946684800000) );
+ addNewTestCase( "TEST_DATE = new Date(0);(TEST_DATE).setMilliseconds('-69609600000');TEST_DATE", UTCDateFromTime(-69609600000), LocalDateFromTime(-69609600000) );
+*/
+}
+function addNewTestCase( initialTime, ms, DateString, UTCDate, LocalDate) {
+ DateCase = new Date(initialTime);
+ DateCase.setUTCMilliseconds(ms);
+
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+// testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+// testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
+
+function SetUTCMilliseconds( T, MS ) {
+ T = Number( T );
+ TIME = MakeTime( HourFromTime(T),
+ MinFromTime(T),
+ SecFromTime(T),
+ MS );
+ return( MakeDate( Day(T), TIME ));
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.26-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.26-1.js
new file mode 100644
index 0000000..58f70ff
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.26-1.js
@@ -0,0 +1,203 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/** File Name: 15.9.5.26-1.js
+ ECMA Section: 15.9.5.26 Date.prototype.setSeconds(sec [,ms])
+ Description:
+
+ If ms is not specified, this behaves as if ms were specified with the
+ value getMilliseconds( ).
+
+ 1. Let t be the result of LocalTime(this time value).
+ 2. Call ToNumber(sec).
+ 3. If ms is not specified, compute msFromTime(t); otherwise, call
+ ToNumber(ms).
+ 4. Compute MakeTime(HourFromTime(t), MinFromTime(t), Result(2),
+ Result(3)).
+ 5. Compute UTC(MakeDate(Day(t), Result(4))).
+ 6. Set the [[Value]] property of the this value to TimeClip(Result(5)).
+ 7. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "15.9.5.26-1";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Date.prototype.setSeconds(sec [,ms] )");
+
+ var testcases = new Array();
+ getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
+function getTestCases() {
+ addNewTestCase( 0, 0, 0,
+ "TDATE = new Date(0);(TDATE).setSeconds(0,0);TDATE",
+ UTCDateFromTime(SetSeconds(0,0,0)),
+ LocalDateFromTime(SetSeconds(0,0,0)) );
+
+ addNewTestCase( 28800000,59,999,
+ "TDATE = new Date(28800000);(TDATE).setSeconds(59,999);TDATE",
+ UTCDateFromTime(SetSeconds(28800000,59,999)),
+ LocalDateFromTime(SetSeconds(28800000,59,999)) );
+
+ addNewTestCase( 28800000,999,999,
+ "TDATE = new Date(28800000);(TDATE).setSeconds(999,999);TDATE",
+ UTCDateFromTime(SetSeconds(28800000,999,999)),
+ LocalDateFromTime(SetSeconds(28800000,999,999)) );
+
+ addNewTestCase( 28800000,999, void 0,
+ "TDATE = new Date(28800000);(TDATE).setSeconds(999);TDATE",
+ UTCDateFromTime(SetSeconds(28800000,999,0)),
+ LocalDateFromTime(SetSeconds(28800000,999,0)) );
+
+ addNewTestCase( 28800000,-28800, void 0,
+ "TDATE = new Date(28800000);(TDATE).setSeconds(-28800);TDATE",
+ UTCDateFromTime(SetSeconds(28800000,-28800)),
+ LocalDateFromTime(SetSeconds(28800000,-28800)) );
+
+ addNewTestCase( 946684800000,1234567,void 0,
+ "TDATE = new Date(946684800000);(TDATE).setSeconds(1234567);TDATE",
+ UTCDateFromTime(SetSeconds(946684800000,1234567)),
+ LocalDateFromTime(SetSeconds(946684800000,1234567)) );
+
+ addNewTestCase( -2208988800000,59,999,
+ "TDATE = new Date(-2208988800000);(TDATE).setSeconds(59,999);TDATE",
+ UTCDateFromTime(SetSeconds(-2208988800000,59,999)),
+ LocalDateFromTime(SetSeconds(-2208988800000,59,999)) );
+
+/*
+ addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(123456789);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(-2208988800000,123456789)),
+ LocalDateFromTime(SetUTCMilliseconds(-2208988800000,123456789)) );
+
+ addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(123456);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(-2208988800000,123456)),
+ LocalDateFromTime(SetUTCMilliseconds(-2208988800000,123456)) );
+
+ addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(-123456);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(-2208988800000,-123456)),
+ LocalDateFromTime(SetUTCMilliseconds(-2208988800000,-123456)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCMilliseconds(-999);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(0,-999)),
+ LocalDateFromTime(SetUTCMilliseconds(0,-999)) );
+*/
+}
+function addNewTestCase( startTime, sec, ms, DateString,UTCDate, LocalDate) {
+ DateCase = new Date( startTime );
+ if ( ms != void 0 ) {
+ DateCase.setSeconds( sec, ms );
+ } else {
+ DateCase.setSeconds( sec );
+ }
+
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+// testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+// testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
+function SetSeconds( t, s, m ) {
+ var MS = ( m == void 0 ) ? msFromTime(t) : Number( m );
+ var TIME = LocalTime( t );
+ var SEC = Number(s);
+ var RESULT4 = MakeTime( HourFromTime( TIME ),
+ MinFromTime( TIME ),
+ SEC,
+ MS );
+ var UTC_TIME = UTC(MakeDate(Day(TIME), RESULT4));
+ return ( TimeClip(UTC_TIME) );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.27-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.27-1.js
new file mode 100644
index 0000000..38cd843
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.27-1.js
@@ -0,0 +1,202 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.27-1.js
+ ECMA Section: 15.9.5.27 Date.prototype.setUTCSeconds(sec [,ms])
+ Description:
+
+ If ms is not specified, this behaves as if ms were specified with the
+ value getUTCMilliseconds( ).
+
+ 1. Let t be this time value.
+ 2. Call ToNumber(sec).
+ 3. If ms is not specified, compute msFromTime(t); otherwise, call
+ ToNumber(ms)
+ 4. Compute MakeTime(HourFromTime(t), MinFromTime(t), Result(2), Result(3))
+ 5. Compute MakeDate(Day(t), Result(4)).
+ 6. Set the [[Value]] property of the this value to TimeClip(Result(5)).
+ 7. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "15.9.5.27-1";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Date.prototype.setUTCSeconds(sec [,ms] )");
+
+ getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
+function getTestCases() {
+ addNewTestCase( 0, 0, 0, "TDATE = new Date(0);(TDATE).setUTCSeconds(0,0);TDATE",
+ UTCDateFromTime(SetUTCSeconds(0,0,0)),
+ LocalDateFromTime(SetUTCSeconds(0,0,0)) );
+
+ addNewTestCase( 28800000,59,999,
+ "TDATE = new Date(28800000);(TDATE).setUTCSeconds(59,999);TDATE",
+ UTCDateFromTime(SetUTCSeconds(28800000,59,999)),
+ LocalDateFromTime(SetUTCSeconds(28800000,59,999)) );
+
+ addNewTestCase( 28800000,999,999,
+ "TDATE = new Date(28800000);(TDATE).setUTCSeconds(999,999);TDATE",
+ UTCDateFromTime(SetUTCSeconds(28800000,999,999)),
+ LocalDateFromTime(SetUTCSeconds(28800000,999,999)) );
+
+ addNewTestCase( 28800000, 999, void 0,
+ "TDATE = new Date(28800000);(TDATE).setUTCSeconds(999);TDATE",
+ UTCDateFromTime(SetUTCSeconds(28800000,999,0)),
+ LocalDateFromTime(SetUTCSeconds(28800000,999,0)) );
+
+ addNewTestCase( 28800000, -28800, void 0,
+ "TDATE = new Date(28800000);(TDATE).setUTCSeconds(-28800);TDATE",
+ UTCDateFromTime(SetUTCSeconds(28800000,-28800)),
+ LocalDateFromTime(SetUTCSeconds(28800000,-28800)) );
+
+ addNewTestCase( 946684800000, 1234567, void 0,
+ "TDATE = new Date(946684800000);(TDATE).setUTCSeconds(1234567);TDATE",
+ UTCDateFromTime(SetUTCSeconds(946684800000,1234567)),
+ LocalDateFromTime(SetUTCSeconds(946684800000,1234567)) );
+
+ addNewTestCase( -2208988800000,59,999,
+ "TDATE = new Date(-2208988800000);(TDATE).setUTCSeconds(59,999);TDATE",
+ UTCDateFromTime(SetUTCSeconds(-2208988800000,59,999)),
+ LocalDateFromTime(SetUTCSeconds(-2208988800000,59,999)) );
+/*
+ addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(123456789);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(-2208988800000,123456789)),
+ LocalDateFromTime(SetUTCMilliseconds(-2208988800000,123456789)) );
+
+ addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(123456);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(-2208988800000,123456)),
+ LocalDateFromTime(SetUTCMilliseconds(-2208988800000,123456)) );
+
+ addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(-123456);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(-2208988800000,-123456)),
+ LocalDateFromTime(SetUTCMilliseconds(-2208988800000,-123456)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCMilliseconds(-999);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(0,-999)),
+ LocalDateFromTime(SetUTCMilliseconds(0,-999)) );
+*/
+}
+function addNewTestCase( startTime, sec, ms, DateString, UTCDate, LocalDate) {
+ DateCase = new Date( startTime );
+ if ( ms == void 0) {
+ DateCase.setSeconds( sec );
+ } else {
+ DateCase.setSeconds( sec, ms );
+ }
+
+
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+// testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+// testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
+
+function SetUTCSeconds( t, s, m ) {
+ var TIME = t;
+ var SEC = Number(s);
+ var MS = ( m == void 0 ) ? msFromTime(TIME) : Number( m );
+ var RESULT4 = MakeTime( HourFromTime( TIME ),
+ MinFromTime( TIME ),
+ SEC,
+ MS );
+ return ( TimeClip(MakeDate(Day(TIME), RESULT4)) );
+}
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.28-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.28-1.js
new file mode 100644
index 0000000..8fd97d1
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.28-1.js
@@ -0,0 +1,216 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.28-1.js
+ ECMA Section: 15.9.5.28 Date.prototype.setMinutes(min [, sec [, ms ]] )
+ Description:
+ If sec is not specified, this behaves as if sec were specified with the
+ value getSeconds ( ).
+
+ If ms is not specified, this behaves as if ms were specified with the
+ value getMilliseconds( ).
+
+ 1. Let t be the result of LocalTime(this time value).
+ 2. Call ToNumber(min).
+ 3. If sec is not specified, compute SecFromTime(t); otherwise, call ToNumber(sec).
+ 4. If ms is not specified, compute msFromTime(t); otherwise, call ToNumber(ms).
+ 5. Compute MakeTime(HourFromTime(t), Result(2), Result(3), Result(4)).
+ 6. Compute UTC(MakeDate(Day(t), Result(5))).
+ 7. Set the [[Value]] property of the this value to TimeClip(Result(6)).
+ 8. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "15.9.5.28-1";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Date.prototype.setMinutes(sec [,ms] )");
+
+ getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
+function getTestCases() {
+ addNewTestCase( 0, 0, void 0, void 0,
+ "TDATE = new Date(0);(TDATE).setMinutes(0);TDATE",
+ UTCDateFromTime(SetMinutes(0,0,0,0)),
+ LocalDateFromTime(SetMinutes(0,0,0,0)) );
+
+ addNewTestCase( 28800000, 59, 59, void 0,
+ "TDATE = new Date(28800000);(TDATE).setMinutes(59,59);TDATE",
+ UTCDateFromTime(SetMinutes(28800000,59,59)),
+ LocalDateFromTime(SetMinutes(28800000,59,59)) );
+
+ addNewTestCase( 28800000, 59, 59, 999,
+ "TDATE = new Date(28800000);(TDATE).setMinutes(59,59,999);TDATE",
+ UTCDateFromTime(SetMinutes(28800000,59,59,999)),
+ LocalDateFromTime(SetMinutes(28800000,59,59,999)) );
+
+ addNewTestCase( 28800000, 59, void 0, void 0,
+ "TDATE = new Date(28800000);(TDATE).setMinutes(59);TDATE",
+ UTCDateFromTime(SetMinutes(28800000,59,0)),
+ LocalDateFromTime(SetMinutes(28800000,59,0)) );
+
+ addNewTestCase( 28800000, -480, void 0, void 0,
+ "TDATE = new Date(28800000);(TDATE).setMinutes(-480);TDATE",
+ UTCDateFromTime(SetMinutes(28800000,-480)),
+ LocalDateFromTime(SetMinutes(28800000,-480)) );
+
+ addNewTestCase( 946684800000, 1234567, void 0, void 0,
+ "TDATE = new Date(946684800000);(TDATE).setMinutes(1234567);TDATE",
+ UTCDateFromTime(SetMinutes(946684800000,1234567)),
+ LocalDateFromTime(SetMinutes(946684800000,1234567)) );
+
+ addNewTestCase( -2208988800000,59, 59, void 0,
+ "TDATE = new Date(-2208988800000);(TDATE).setMinutes(59,59);TDATE",
+ UTCDateFromTime(SetMinutes(-2208988800000,59,59)),
+ LocalDateFromTime(SetMinutes(-2208988800000,59,59)) );
+
+ addNewTestCase( -2208988800000, 59, 59, 999,
+ "TDATE = new Date(-2208988800000);(TDATE).setMinutes(59,59,999);TDATE",
+ UTCDateFromTime(SetMinutes(-2208988800000,59,59,999)),
+ LocalDateFromTime(SetMinutes(-2208988800000,59,59,999)) );
+/*
+ addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(123456789);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(-2208988800000,123456789)),
+ LocalDateFromTime(SetUTCMilliseconds(-2208988800000,123456789)) );
+
+ addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(123456);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(-2208988800000,123456)),
+ LocalDateFromTime(SetUTCMilliseconds(-2208988800000,123456)) );
+
+ addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(-123456);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(-2208988800000,-123456)),
+ LocalDateFromTime(SetUTCMilliseconds(-2208988800000,-123456)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCMilliseconds(-999);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(0,-999)),
+ LocalDateFromTime(SetUTCMilliseconds(0,-999)) );
+*/
+
+}
+function addNewTestCase( time, min, sec, ms, DateString, UTCDate, LocalDate) {
+ DateCase = new Date( time );
+
+ if ( sec == void 0 ) {
+ DateCase.setMinutes( min );
+ } else {
+ if ( ms == void 0 ) {
+ DateCase.setMinutes( min, sec );
+ } else {
+ DateCase.setMinutes( min, sec, ms );
+ }
+ }
+
+
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+// testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+// testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
+
+function SetMinutes( t, min, sec, ms ) {
+ var TIME = LocalTime(t);
+ var MIN = Number(min);
+ var SEC = ( sec == void 0) ? SecFromTime(TIME) : Number(sec);
+ var MS = ( ms == void 0 ) ? msFromTime(TIME) : Number(ms);
+ var RESULT5 = MakeTime( HourFromTime( TIME ),
+ MIN,
+ SEC,
+ MS );
+ return ( TimeClip(UTC( MakeDate(Day(TIME),RESULT5))) );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.29-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.29-1.js
new file mode 100644
index 0000000..0640a74
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.29-1.js
@@ -0,0 +1,210 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.29-1.js
+ ECMA Section: 15.9.5.29 Date.prototype.setUTCMinutes(min [, sec [, ms ]] )
+ Description:
+ If sec is not specified, this behaves as if sec were specified with the
+ value getUTCSeconds ( ).
+
+ If ms is not specified, this behaves as if ms were specified with the value
+ getUTCMilliseconds( ).
+
+ 1. Let t be this time value.
+ 2. Call ToNumber(min).
+ 3. If sec is not specified, compute SecFromTime(t); otherwise, call
+ ToNumber(sec).
+ 4. If ms is not specified, compute msFromTime(t); otherwise, call
+ ToNumber(ms).
+ 5. Compute MakeTime(HourFromTime(t), Result(2), Result(3), Result(4)).
+ 6. Compute MakeDate(Day(t), Result(5)).
+ 7. Set the [[Value]] property of the this value to TimeClip(Result(6)).
+ 8. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "15.9.5.29-1";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Date.prototype.setUTCMinutes( min [, sec, ms] )");
+
+ getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
+function getTestCases() {
+ addNewTestCase( 0, 0, void 0, void 0,
+ "TDATE = new Date(0);(TDATE).setUTCMinutes(0);TDATE",
+ UTCDateFromTime(SetUTCMinutes(0,0,0,0)),
+ LocalDateFromTime(SetUTCMinutes(0,0,0,0)) );
+
+ addNewTestCase( 28800000, 59, 59, void 0,
+ "TDATE = new Date(28800000);(TDATE).setUTCMinutes(59,59);TDATE",
+ UTCDateFromTime(SetUTCMinutes(28800000,59,59)),
+ LocalDateFromTime(SetUTCMinutes(28800000,59,59)) );
+
+ addNewTestCase( 28800000, 59, 59, 999,
+ "TDATE = new Date(28800000);(TDATE).setUTCMinutes(59,59,999);TDATE",
+ UTCDateFromTime(SetUTCMinutes(28800000,59,59,999)),
+ LocalDateFromTime(SetUTCMinutes(28800000,59,59,999)) );
+
+ addNewTestCase( 28800000, 59, void 0, void 0,
+ "TDATE = new Date(28800000);(TDATE).setUTCMinutes(59);TDATE",
+ UTCDateFromTime(SetUTCMinutes(28800000,59)),
+ LocalDateFromTime(SetUTCMinutes(28800000,59)) );
+
+ addNewTestCase( 28800000, -480, 0, 0,
+ "TDATE = new Date(28800000);(TDATE).setUTCMinutes(-480);TDATE",
+ UTCDateFromTime(SetUTCMinutes(28800000,-480)),
+ LocalDateFromTime(SetUTCMinutes(28800000,-480)) );
+
+ addNewTestCase( 946684800000, 1234567, void 0, void 0,
+ "TDATE = new Date(946684800000);(TDATE).setUTCMinutes(1234567);TDATE",
+ UTCDateFromTime(SetUTCMinutes(946684800000,1234567)),
+ LocalDateFromTime(SetUTCMinutes(946684800000,1234567)) );
+
+ addNewTestCase( -2208988800000, 59, 999, void 0,
+ "TDATE = new Date(-2208988800000);(TDATE).setUTCMinutes(59,999);TDATE",
+ UTCDateFromTime(SetUTCMinutes(-2208988800000,59,999)),
+ LocalDateFromTime(SetUTCMinutes(-2208988800000,59,999)) );
+/*
+ addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(123456789);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(-2208988800000,123456789)),
+ LocalDateFromTime(SetUTCMilliseconds(-2208988800000,123456789)) );
+
+ addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(123456);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(-2208988800000,123456)),
+ LocalDateFromTime(SetUTCMilliseconds(-2208988800000,123456)) );
+
+ addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(-123456);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(-2208988800000,-123456)),
+ LocalDateFromTime(SetUTCMilliseconds(-2208988800000,-123456)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCMilliseconds(-999);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(0,-999)),
+ LocalDateFromTime(SetUTCMilliseconds(0,-999)) );
+*/
+
+}
+function addNewTestCase( time, min, sec, ms, DateString, UTCDate, LocalDate) {
+ var DateCase = new Date( time );
+
+ if ( sec == void 0 ) {
+ DateCase.setUTCMinutes( min );
+ } else {
+ if ( ms == void 0 ) {
+ DateCase.setUTCMinutes( min, sec );
+ } else {
+ DateCase.setUTCMinutes( min, sec, ms );
+ }
+ }
+
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+// testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+// testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
+function SetUTCMinutes( t, min, sec, ms ) {
+ var TIME = t;
+ var MIN = Number(min);
+ var SEC = ( sec == void 0) ? SecFromTime(TIME) : Number(sec);
+ var MS = ( ms == void 0 ) ? msFromTime(TIME) : Number(ms);
+ var RESULT5 = MakeTime( HourFromTime( TIME ),
+ MIN,
+ SEC,
+ MS );
+ return ( TimeClip(MakeDate(Day(TIME),RESULT5)) );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.3-1-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.3-1-n.js
new file mode 100644
index 0000000..109fc26
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.3-1-n.js
@@ -0,0 +1,73 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.3-1.js
+ ECMA Section: 15.9.5.3-1 Date.prototype.valueOf
+ Description:
+
+ The valueOf function returns a number, which is this time value.
+
+ The valueOf function is not generic; it generates a runtime error if
+ its this value is not a Date object. Therefore it cannot be transferred
+ to other kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.3-1-n";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.valueOf";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var OBJ = new MyObject( new Date(0) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "var OBJ = new MyObject( new Date(0) ); OBJ.valueOf()",
+ "error",
+ OBJ.valueOf() );
+ test();
+
+function MyObject( value ) {
+ this.value = value;
+ this.valueOf = Date.prototype.valueOf;
+// The following line causes an infinte loop
+// this.toString = new Function( "return this+\"\";");
+ return this;
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.3-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.3-2.js
new file mode 100644
index 0000000..7698ac1
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.3-2.js
@@ -0,0 +1,107 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.3-2.js
+ ECMA Section: 15.9.5.3-2 Date.prototype.valueOf
+ Description:
+
+ The valueOf function returns a number, which is this time value.
+
+ The valueOf function is not generic; it generates a runtime error if
+ its this value is not a Date object. Therefore it cannot be transferred
+ to other kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.3-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.valueOf";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+ var now = (new Date()).valueOf();
+ var UTC_29_FEB_2000 = TIME_2000 + 31*msPerDay + 28*msPerDay;
+ var UTC_1_JAN_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ addTestCase( now );
+ addTestCase( TIME_1970 );
+ addTestCase( TIME_1900 );
+ addTestCase( TIME_2000 );
+ addTestCase( UTC_29_FEB_2000 );
+ addTestCase( UTC_1_JAN_2005 );
+
+ test();
+
+function addTestCase( t ) {
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+").valueOf()",
+ t,
+ (new Date(t)).valueOf() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t+1)+").valueOf()",
+ t+1,
+ (new Date(t+1)).valueOf() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t-1)+").valueOf()",
+ t-1,
+ (new Date(t-1)).valueOf() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t-TZ_ADJUST)+").valueOf()",
+ t-TZ_ADJUST,
+ (new Date(t-TZ_ADJUST)).valueOf() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t+TZ_ADJUST)+").valueOf()",
+ t+TZ_ADJUST,
+ (new Date(t+TZ_ADJUST)).valueOf() );
+}
+
+function MyObject( value ) {
+ this.value = value;
+ this.valueOf = Date.prototype.valueOf;
+ this.toString = new Function( "return this+\"\";");
+ return this;
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.30-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.30-1.js
new file mode 100644
index 0000000..6e6715f
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.30-1.js
@@ -0,0 +1,215 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.30-1.js
+ ECMA Section: 15.9.5.30 Date.prototype.setHours(hour [, min [, sec [, ms ]]] )
+ Description:
+ If min is not specified, this behaves as if min were specified with the
+ value getMinutes( ). If sec is not specified, this behaves as if sec were
+ specified with the value getSeconds ( ). If ms is not specified, this
+ behaves as if ms were specified with the value getMilliseconds( ).
+
+ 1. Let t be the result of LocalTime(this time value).
+ 2. Call ToNumber(hour).
+ 3. If min is not specified, compute MinFromTime(t); otherwise, call
+ ToNumber(min).
+ 4. If sec is not specified, compute SecFromTime(t); otherwise, call
+ ToNumber(sec).
+ 5. If ms is not specified, compute msFromTime(t); otherwise, call
+ ToNumber(ms).
+ 6. Compute MakeTime(Result(2), Result(3), Result(4), Result(5)).
+ 7. Compute UTC(MakeDate(Day(t), Result(6))).
+ 8. Set the [[Value]] property of the this value to TimeClip(Result(7)).
+ 9. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "15.9.5.30-1";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Date.prototype.setHours( hour [, min, sec, ms] )");
+
+ getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
+function getTestCases() {
+ addNewTestCase( 0,0,0,0,void 0,
+ "TDATE = new Date(0);(TDATE).setHours(0);TDATE" );
+
+ addNewTestCase( 28800000, 23, 59, 999,void 0,
+ "TDATE = new Date(28800000);(TDATE).setHours(23,59,999);TDATE" );
+
+ addNewTestCase( 28800000, 999, 999, void 0, void 0,
+ "TDATE = new Date(28800000);(TDATE).setHours(999,999);TDATE" );
+
+ addNewTestCase( 28800000,999,0, void 0, void 0,
+ "TDATE = new Date(28800000);(TDATE).setHours(999);TDATE" );
+
+ addNewTestCase( 28800000,-8, void 0, void 0, void 0,
+ "TDATE = new Date(28800000);(TDATE).setHours(-8);TDATE" );
+
+ addNewTestCase( 946684800000,8760, void 0, void 0, void 0,
+ "TDATE = new Date(946684800000);(TDATE).setHours(8760);TDATE" );
+
+ addNewTestCase( TIME_2000 - msPerDay, 23, 59, 59, 999,
+ "d = new Date( " + (TIME_2000-msPerDay) +"); d.setHours(23,59,59,999)" );
+
+ addNewTestCase( TIME_2000 - msPerDay, 23, 59, 59, 1000,
+ "d = new Date( " + (TIME_2000-msPerDay) +"); d.setHours(23,59,59,1000)" );
+
+
+/*
+ addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setHours(59,999);TDATE",
+ UTCDateFromTime(SetHours(-2208988800000,59,999)),
+ LocalDateFromTime(SetHours(-2208988800000,59,999)) );
+
+ addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(123456789);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(-2208988800000,123456789)),
+ LocalDateFromTime(SetUTCMilliseconds(-2208988800000,123456789)) );
+
+ addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(123456);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(-2208988800000,123456)),
+ LocalDateFromTime(SetUTCMilliseconds(-2208988800000,123456)) );
+
+ addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(-123456);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(-2208988800000,-123456)),
+ LocalDateFromTime(SetUTCMilliseconds(-2208988800000,-123456)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCMilliseconds(-999);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(0,-999)),
+ LocalDateFromTime(SetUTCMilliseconds(0,-999)) );
+*/
+
+}
+function addNewTestCase( time, hours, min, sec, ms, DateString) {
+ var UTCDate = UTCDateFromTime( SetHours( time, hours, min, sec, ms ));
+ var LocalDate = LocalDateFromTime( SetHours( time, hours, min, sec, ms ));
+
+ var DateCase = new Date( time );
+
+ if ( min == void 0 ) {
+ DateCase.setHours( hours );
+ } else {
+ if ( sec == void 0 ) {
+ DateCase.setHours( hours, min );
+ } else {
+ if ( ms == void 0 ) {
+ DateCase.setHours( hours, min, sec );
+ } else {
+ DateCase.setHours( hours, min, sec, ms );
+ }
+ }
+ }
+
+
+ var item = testcases.length;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.day = WeekDay( t );
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+
+ return (d);
+}
+function SetHours( t, hour, min, sec, ms ) {
+ var TIME = LocalTime(t);
+ var HOUR = Number(hour);
+ var MIN = ( min == void 0) ? MinFromTime(TIME) : Number(min);
+ var SEC = ( sec == void 0) ? SecFromTime(TIME) : Number(sec);
+ var MS = ( ms == void 0 ) ? msFromTime(TIME) : Number(ms);
+ var RESULT6 = MakeTime( HOUR,
+ MIN,
+ SEC,
+ MS );
+ var UTC_TIME = UTC( MakeDate(Day(TIME), RESULT6) );
+ return ( TimeClip(UTC_TIME) );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.31-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.31-1.js
new file mode 100644
index 0000000..b6a2fee
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.31-1.js
@@ -0,0 +1,212 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.31-1.js
+ ECMA Section: 15.9.5.31 Date.prototype.setUTCHours(hour [, min [, sec [, ms ]]] )
+ Description:
+ If min is not specified, this behaves as if min were specified with the value getUTCMinutes( ).
+ If sec is not specified, this behaves as if sec were specified with the value getUTCSeconds ( ).
+ If ms is not specified, this behaves as if ms were specified with the value getUTCMilliseconds( ).
+
+ 1.Let t be this time value.
+ 2.Call ToNumber(hour).
+ 3.If min is not specified, compute MinFromTime(t); otherwise, call ToNumber(min).
+ 4.If sec is not specified, compute SecFromTime(t); otherwise, call ToNumber(sec).
+ 5.If ms is not specified, compute msFromTime(t); otherwise, call ToNumber(ms).
+ 6.Compute MakeTime(Result(2), Result(3), Result(4), Result(5)).
+ 7.Compute MakeDate(Day(t), Result(6)).
+ 8.Set the [[Value]] property of the this value to TimeClip(Result(7)).
+
+ 1.Return the value of the [[Value]] property of the this value.
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "15.9.5.31-1";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Date.prototype.setUTCHours(hour [, min [, sec [, ms ]]] )");
+
+ getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
+function getTestCases() {
+ addNewTestCase( 0, 0, void 0, void 0, void 0,
+ "TDATE = new Date(0);(TDATE).setUTCHours(0);TDATE",
+ UTCDateFromTime(SetUTCHours(0,0,0,0)),
+ LocalDateFromTime(SetUTCHours(0,0,0,0)) );
+
+ addNewTestCase( 28800000, 23, 59, 999, void 0,
+ "TDATE = new Date(28800000);(TDATE).setUTCHours(23,59,999);TDATE",
+ UTCDateFromTime(SetUTCHours(28800000,23,59,999)),
+ LocalDateFromTime(SetUTCHours(28800000,23,59,999)) );
+
+ addNewTestCase( 28800000,999,999, void 0, void 0,
+ "TDATE = new Date(28800000);(TDATE).setUTCHours(999,999);TDATE",
+ UTCDateFromTime(SetUTCHours(28800000,999,999)),
+ LocalDateFromTime(SetUTCHours(28800000,999,999)) );
+
+ addNewTestCase( 28800000, 999, void 0, void 0, void 0,
+ "TDATE = new Date(28800000);(TDATE).setUTCHours(999);TDATE",
+ UTCDateFromTime(SetUTCHours(28800000,999,0)),
+ LocalDateFromTime(SetUTCHours(28800000,999,0)) );
+
+ addNewTestCase( 28800000, -8670, void 0, void 0, void 0,
+ "TDATE = new Date(28800000);(TDATE).setUTCHours(-8670);TDATE",
+ UTCDateFromTime(SetUTCHours(28800000,-8670)),
+ LocalDateFromTime(SetUTCHours(28800000,-8670)) );
+
+ addNewTestCase( 946684800000, 1234567, void 0, void 0, void 0,
+ "TDATE = new Date(946684800000);(TDATE).setUTCHours(1234567);TDATE",
+ UTCDateFromTime(SetUTCHours(946684800000,1234567)),
+ LocalDateFromTime(SetUTCHours(946684800000,1234567)) );
+
+ addNewTestCase( -2208988800000, 59, 999, void 0, void 0,
+ "TDATE = new Date(-2208988800000);(TDATE).setUTCHours(59,999);TDATE",
+ UTCDateFromTime(SetUTCHours(-2208988800000,59,999)),
+ LocalDateFromTime(SetUTCHours(-2208988800000,59,999)) );
+/*
+ addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(123456789);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(-2208988800000,123456789)),
+ LocalDateFromTime(SetUTCMilliseconds(-2208988800000,123456789)) );
+
+ addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(123456);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(-2208988800000,123456)),
+ LocalDateFromTime(SetUTCMilliseconds(-2208988800000,123456)) );
+
+ addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(-123456);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(-2208988800000,-123456)),
+ LocalDateFromTime(SetUTCMilliseconds(-2208988800000,-123456)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCMilliseconds(-999);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(0,-999)),
+ LocalDateFromTime(SetUTCMilliseconds(0,-999)) );
+*/
+
+}
+function addNewTestCase( time, hours, min, sec, ms, DateString, UTCDate, LocalDate) {
+
+ DateCase = new Date(time);
+ if ( min == void 0 ) {
+ DateCase.setUTCHours( hours );
+ } else {
+ if ( sec == void 0 ) {
+ DateCase.setUTCHours( hours, min );
+ } else {
+ if ( ms == void 0 ) {
+ DateCase.setUTCHours( hours, min, sec );
+ } else {
+ DateCase.setUTCHours( hours, min, sec, ms );
+ }
+ }
+ }
+
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
+function SetUTCHours( t, hour, min, sec, ms ) {
+ var TIME = t;
+ var HOUR = Number(hour);
+ var MIN = ( min == void 0) ? MinFromTime(TIME) : Number(min);
+ var SEC = ( sec == void 0) ? SecFromTime(TIME) : Number(sec);
+ var MS = ( ms == void 0 ) ? msFromTime(TIME) : Number(ms);
+ var RESULT6 = MakeTime( HOUR,
+ MIN,
+ SEC,
+ MS );
+ return ( TimeClip(MakeDate(Day(TIME), RESULT6)) );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.32-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.32-1.js
new file mode 100644
index 0000000..eded146
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.32-1.js
@@ -0,0 +1,157 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+ /**
+ File Name: 15.9.5.32-1.js
+ ECMA Section: 15.9.5.32 Date.prototype.setDate(date)
+ Description:
+ 1. Let t be the result of LocalTime(this time value).
+ 2. Call ToNumber(date).
+ 3. Compute MakeDay(YearFromTime(t), MonthFromTime(t), Result(2)).
+ 4. Compute UTC(MakeDate(Result(3), TimeWithinDay(t))).
+ 5. Set the [[Value]] property of the this value to TimeClip(Result(4)).
+ 6. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "15.9.5.32-1";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Date.prototype.setDate(date) ");
+
+ getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
+function getTestCases() {
+ addNewTestCase( 0, 1,
+ "TDATE = new Date(0);(TDATE).setDate(1);TDATE" );
+
+/*
+ addNewTestCase( "TDATE = new Date(86400000);(TDATE).setDate(1);TDATE",
+ UTCDateFromTime(SetDate(86400000,1)),
+ LocalDateFromTime(SetDate(86400000,1)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1972);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1972)),
+ LocalDateFromTime(SetUTCFullYear(0,1972)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1968);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1968)),
+ LocalDateFromTime(SetUTCFullYear(0,1968)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1969);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1969)),
+ LocalDateFromTime(SetUTCFullYear(0,1969)) );
+*/
+}
+function addNewTestCase( t, d, DateString ) {
+ var DateCase = new Date( t );
+ DateCase.setDate( d );
+
+ var UTCDate = UTCDateFromTime(SetDate(t, d));
+ var LocalDate=LocalDateFromTime(SetDate(t,d));
+
+ var item = testcases.length;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
+
+function SetDate( t, date ) {
+ var T = LocalTime( t );
+ var DATE = Number( date );
+ var RESULT3 = MakeDay(YearFromTime(T), MonthFromTime(T), DATE );
+ var UTC_DATE = UTC( MakeDate(RESULT3, TimeWithinDay(T)) );
+ return ( TimeClip(UTC_DATE) );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.33-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.33-1.js
new file mode 100644
index 0000000..017d43e
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.33-1.js
@@ -0,0 +1,156 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+ /**
+ File Name: 15.9.5.33-1.js
+ ECMA Section: 15.9.5.33 Date.prototype.setUTCDate(date)
+ Description:
+ 1. Let t be this time value.
+ 2. Call ToNumber(date).
+ 3. Compute MakeDay(YearFromTime(t), MonthFromTime(t), Result(2)).
+ 4. Compute MakeDate(Result(3), TimeWithinDay(t)).
+ 5. Set the [[Value]] property of the this value to TimeClip(Result(4)).
+ 6. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "15.9.5.33-1";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Date.prototype.setUTCDate(date) ");
+
+ getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
+function getTestCases() {
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCDate(31);TDATE",
+ UTCDateFromTime(SetUTCDate(0,31)),
+ LocalDateFromTime(SetUTCDate(0,31)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCDate(1);TDATE",
+ UTCDateFromTime(SetUTCDate(0,1)),
+ LocalDateFromTime(SetUTCDate(0,1)) );
+
+ addNewTestCase( "TDATE = new Date(86400000);(TDATE).setUTCDate(1);TDATE",
+ UTCDateFromTime(SetUTCDate(86400000,1)),
+ LocalDateFromTime(SetUTCDate(86400000,1)) );
+/*
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1972);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1972)),
+ LocalDateFromTime(SetUTCFullYear(0,1972)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1968);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1968)),
+ LocalDateFromTime(SetUTCFullYear(0,1968)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1969);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1969)),
+ LocalDateFromTime(SetUTCFullYear(0,1969)) );
+*/
+}
+function addNewTestCase( DateString, UTCDate, LocalDate) {
+ DateCase = eval( DateString );
+
+ var item = testcases.length;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
+function SetUTCDate( t, date ) {
+ var T = t;
+ var DATE = Number( date );
+ var RESULT3 = MakeDay(YearFromTime(T), MonthFromTime(T), DATE );
+ return ( TimeClip(MakeDate(RESULT3, TimeWithinDay(t))) );
+}
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.34-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.34-1.js
new file mode 100644
index 0000000..e042ab9
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.34-1.js
@@ -0,0 +1,220 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.34-1.js
+ ECMA Section: 15.9.5.34 Date.prototype.setMonth(mon [, date ] )
+ Description:
+ If date is not specified, this behaves as if date were specified with the
+ value getDate( ).
+
+ 1. Let t be the result of LocalTime(this time value).
+ 2. Call ToNumber(date).
+ 3. If date is not specified, compute DateFromTime(t); otherwise, call ToNumber(date).
+ 4. Compute MakeDay(YearFromTime(t), Result(2), Result(3)).
+ 5. Compute UTC(MakeDate(Result(4), TimeWithinDay(t))).
+ 6. Set the [[Value]] property of the this value to TimeClip(Result(5)).
+ 7. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "15.9.5.34-1";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Date.prototype.setMonth(mon [, date ] )");
+
+ var now = (new Date()).valueOf();
+
+ getFunctionCases();
+ getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
+function getFunctionCases() {
+ // some tests for all functions
+ testcases[testcases.length] = new TestCase(
+ SECTION,
+ "Date.prototype.setMonth.length",
+ 2,
+ Date.prototype.setMonth.length );
+
+ testcases[testcases.length] = new TestCase(
+ SECTION,
+ "typeof Date.prototype.setMonth",
+ "function",
+ typeof Date.prototype.setMonth );
+
+
+/*
+
+ testcases[testcases.length] = new TestCase(
+ SECTION,
+ "delete Date.prototype.setMonth",
+ false,
+ delete Date.prototype.setMonth );
+*/
+
+}
+
+
+function getTestCases() {
+ // regression test for http://scopus.mcom.com/bugsplat/show_bug.cgi?id=112404
+ d = new Date(0);
+ d.setMonth(1,1,1,1,1,1);
+
+ addNewTestCase(
+ "TDATE = new Date(0); TDATE.setMonth(1,1,1,1,1,1); TDATE",
+ UTCDateFromTime(SetMonth(0,1,1)),
+ LocalDateFromTime(SetMonth(0,1,1)) );
+
+
+ // whatever today is
+
+ addNewTestCase( "TDATE = new Date(now); (TDATE).setMonth(11,31); TDATE",
+ UTCDateFromTime(SetMonth(now,11,31)),
+ LocalDateFromTime(SetMonth(now,11,31)) );
+
+ // 1970
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setMonth(0,1);TDATE",
+ UTCDateFromTime(SetMonth(0,0,1)),
+ LocalDateFromTime(SetMonth(0,0,1)) );
+
+ addNewTestCase( "TDATE = new Date("+TIME_1900+"); "+
+ "(TDATE).setMonth(11,31); TDATE",
+ UTCDateFromTime( SetMonth(TIME_1900,11,31) ),
+ LocalDateFromTime( SetMonth(TIME_1900,11,31) ) );
+
+
+
+
+/*
+ addNewTestCase( "TDATE = new Date(28800000);(TDATE).setMonth(11,23,59,999);TDATE",
+ UTCDateFromTime(SetMonth(28800000,11,23,59,999)),
+ LocalDateFromTime(SetMonth(28800000,11,23,59,999)) );
+
+ addNewTestCase( "TDATE = new Date(28800000);(TDATE).setMonth(99,99);TDATE",
+ UTCDateFromTime(SetMonth(28800000,99,99)),
+ LocalDateFromTime(SetMonth(28800000,99,99)) );
+
+ addNewTestCase( "TDATE = new Date(28800000);(TDATE).setMonth(11);TDATE",
+ UTCDateFromTime(SetMonth(28800000,11,0)),
+ LocalDateFromTime(SetMonth(28800000,11,0)) );
+
+ addNewTestCase( "TDATE = new Date(28800000);(TDATE).setMonth(-11);TDATE",
+ UTCDateFromTime(SetMonth(28800000,-11)),
+ LocalDateFromTime(SetMonth(28800000,-11)) );
+
+ // 1900
+
+// addNewTestCase( "TDATE = new Date(); (TDATE).setMonth(11,31); TDATE;"
+*/
+
+}
+function addNewTestCase( DateString, UTCDate, LocalDate) {
+ DateCase = eval( DateString );
+
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
+function SetMonth( t, mon, date ) {
+ var TIME = LocalTime(t);
+ var MONTH = Number( mon );
+ var DATE = ( date == void 0 ) ? DateFromTime(TIME) : Number( date );
+ var DAY = MakeDay( YearFromTime(TIME), MONTH, DATE );
+ return ( TimeClip (UTC(MakeDate( DAY, TimeWithinDay(TIME) ))) );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.35-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.35-1.js
new file mode 100644
index 0000000..242c0d8
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.35-1.js
@@ -0,0 +1,143 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+ /**
+ File Name: 15.9.5.35-1.js
+ ECMA Section: 15.9.5.35 Date.prototype.setUTCMonth(mon [,date])
+ Description:
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "15.9.5.35-1";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Date.prototype.setUTCMonth(mon [,date] ) ");
+
+ getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
+function getTestCases() {
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCMonth(0);TDATE",
+ UTCDateFromTime(SetUTCMonth(0,0)),
+ LocalDateFromTime(SetUTCMonth(0,0)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCMonth(11);TDATE",
+ UTCDateFromTime(SetUTCMonth(0,11)),
+ LocalDateFromTime(SetUTCMonth(0,11)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCMonth(3,4);TDATE",
+ UTCDateFromTime(SetUTCMonth(0,3,4)),
+ LocalDateFromTime(SetUTCMonth(0,3,4)) );
+
+}
+
+function addNewTestCase( DateString, UTCDate, LocalDate) {
+ DateCase = eval( DateString );
+
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
+function SetUTCMonth( t, month, date ) {
+ var T = t;
+ var MONTH = Number( month );
+ var DATE = ( date == void 0) ? DateFromTime(T) : Number( date );
+
+ var RESULT4 = MakeDay(YearFromTime(T), MONTH, DATE );
+ var RESULT5 = MakeDate( RESULT4, TimeWithinDay(T));
+
+ return ( TimeClip(RESULT5) );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-1.js
new file mode 100644
index 0000000..f046829
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-1.js
@@ -0,0 +1,245 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.36-1.js
+ ECMA Section: 15.9.5.36 Date.prototype.setFullYear(year [, mon [, date ]] )
+ Description:
+
+ If mon is not specified, this behaves as if mon were specified with the
+ value getMonth( ). If date is not specified, this behaves as if date were
+ specified with the value getDate( ).
+
+ 1. Let t be the result of LocalTime(this time value); but if this time
+ value is NaN, let t be +0.
+ 2. Call ToNumber(year).
+ 3. If mon is not specified, compute MonthFromTime(t); otherwise, call
+ ToNumber(mon).
+ 4. If date is not specified, compute DateFromTime(t); otherwise, call
+ ToNumber(date).
+ 5. Compute MakeDay(Result(2), Result(3), Result(4)).
+ 6. Compute UTC(MakeDate(Result(5), TimeWithinDay(t))).
+ 7. Set the [[Value]] property of the this value to TimeClip(Result(6)).
+ 8. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+ Added test cases for Year 2000 Compatilibity Testing.
+
+*/
+ var SECTION = "15.9.5.36-1";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Date.prototype.setFullYear(year [, mon [, date ]] )");
+
+ getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCases() {
+
+ // 1969
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1969);TDATE",
+ UTCDateFromTime(SetFullYear(0,1969)),
+ LocalDateFromTime(SetFullYear(0,1969)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1969,11);TDATE",
+ UTCDateFromTime(SetFullYear(0,1969,11)),
+ LocalDateFromTime(SetFullYear(0,1969,11)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1969,11,31);TDATE",
+ UTCDateFromTime(SetFullYear(0,1969,11,31)),
+ LocalDateFromTime(SetFullYear(0,1969,11,31)) );
+/*
+ // 1970
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1970);TDATE",
+ UTCDateFromTime(SetFullYear(0,1970)),
+ LocalDateFromTime(SetFullYear(0,1970)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1970,0);TDATE",
+ UTCDateFromTime(SetFullYear(0,1970,0)),
+ LocalDateFromTime(SetFullYear(0,1970,0)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1970,0,1);TDATE",
+ UTCDateFromTime(SetFullYear(0,1970,0,1)),
+ LocalDateFromTime(SetFullYear(0,1970,0,1)) );
+ // 1971
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1971);TDATE",
+ UTCDateFromTime(SetFullYear(0,1971)),
+ LocalDateFromTime(SetFullYear(0,1971)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1971,0);TDATE",
+ UTCDateFromTime(SetFullYear(0,1971,0)),
+ LocalDateFromTime(SetFullYear(0,1971,0)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1971,0,1);TDATE",
+ UTCDateFromTime(SetFullYear(0,1971,0,1)),
+ LocalDateFromTime(SetFullYear(0,1971,0,1)) );
+
+ // 1999
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1999);TDATE",
+ UTCDateFromTime(SetFullYear(0,1999)),
+ LocalDateFromTime(SetFullYear(0,1999)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1999,11);TDATE",
+ UTCDateFromTime(SetFullYear(0,1999,11)),
+ LocalDateFromTime(SetFullYear(0,1999,11)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1999,11,31);TDATE",
+ UTCDateFromTime(SetFullYear(0,1999,11,31)),
+ LocalDateFromTime(SetFullYear(0,1999,11,31)) );
+
+ // 2000
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000)),
+ LocalDateFromTime(SetFullYear(0,2000)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,0);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000,0)),
+ LocalDateFromTime(SetFullYear(0,2000,0)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,0,1);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000,0,1)),
+ LocalDateFromTime(SetFullYear(0,2000,0,1)) );
+
+ // feb 29, 2000
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000)),
+ LocalDateFromTime(SetFullYear(0,2000)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,1);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000,1)),
+ LocalDateFromTime(SetFullYear(0,2000,1)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,1,29);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000,1,29)),
+ LocalDateFromTime(SetFullYear(0,2000,1,29)) );
+
+ // Jan 1, 2005
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005);TDATE",
+ UTCDateFromTime(SetFullYear(0,2005)),
+ LocalDateFromTime(SetFullYear(0,2005)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0);TDATE",
+ UTCDateFromTime(SetFullYear(0,2005,0)),
+ LocalDateFromTime(SetFullYear(0,2005,0)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0,1);TDATE",
+ UTCDateFromTime(SetFullYear(0,2005,0,1)),
+ LocalDateFromTime(SetFullYear(0,2005,0,1)) );
+
+*/
+}
+function addNewTestCase( DateString, UTCDate, LocalDate) {
+ DateCase = eval( DateString );
+
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
+function SetFullYear( t, year, mon, date ) {
+ var T = ( isNaN(t) ) ? 0 : LocalTime(t) ;
+ var YEAR = Number( year );
+ var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon );
+ var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date );
+
+ var DAY = MakeDay( YEAR, MONTH, DATE );
+ var UTC_DATE = UTC(MakeDate( DAY, TimeWithinDay(T)));
+
+ return ( TimeClip(UTC_DATE) );
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-2.js
new file mode 100644
index 0000000..1e207ed
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-2.js
@@ -0,0 +1,231 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.36-1.js
+ ECMA Section: 15.9.5.36 Date.prototype.setFullYear(year [, mon [, date ]] )
+ Description:
+
+ If mon is not specified, this behaves as if mon were specified with the
+ value getMonth( ). If date is not specified, this behaves as if date were
+ specified with the value getDate( ).
+
+ 1. Let t be the result of LocalTime(this time value); but if this time
+ value is NaN, let t be +0.
+ 2. Call ToNumber(year).
+ 3. If mon is not specified, compute MonthFromTime(t); otherwise, call
+ ToNumber(mon).
+ 4. If date is not specified, compute DateFromTime(t); otherwise, call
+ ToNumber(date).
+ 5. Compute MakeDay(Result(2), Result(3), Result(4)).
+ 6. Compute UTC(MakeDate(Result(5), TimeWithinDay(t))).
+ 7. Set the [[Value]] property of the this value to TimeClip(Result(6)).
+ 8. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+ Added test cases for Year 2000 Compatilibity Testing.
+
+*/
+ var SECTION = "15.9.5.36-2";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Date.prototype.setFullYear(year [, mon [, date ]] )");
+
+ getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCases() {
+ // 1970
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1970);TDATE",
+ UTCDateFromTime(SetFullYear(0,1970)),
+ LocalDateFromTime(SetFullYear(0,1970)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1970,0);TDATE",
+ UTCDateFromTime(SetFullYear(0,1970,0)),
+ LocalDateFromTime(SetFullYear(0,1970,0)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1970,0,1);TDATE",
+ UTCDateFromTime(SetFullYear(0,1970,0,1)),
+ LocalDateFromTime(SetFullYear(0,1970,0,1)) );
+/*
+ // 1971
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1971);TDATE",
+ UTCDateFromTime(SetFullYear(0,1971)),
+ LocalDateFromTime(SetFullYear(0,1971)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1971,0);TDATE",
+ UTCDateFromTime(SetFullYear(0,1971,0)),
+ LocalDateFromTime(SetFullYear(0,1971,0)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1971,0,1);TDATE",
+ UTCDateFromTime(SetFullYear(0,1971,0,1)),
+ LocalDateFromTime(SetFullYear(0,1971,0,1)) );
+
+ // 1999
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1999);TDATE",
+ UTCDateFromTime(SetFullYear(0,1999)),
+ LocalDateFromTime(SetFullYear(0,1999)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1999,11);TDATE",
+ UTCDateFromTime(SetFullYear(0,1999,11)),
+ LocalDateFromTime(SetFullYear(0,1999,11)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1999,11,31);TDATE",
+ UTCDateFromTime(SetFullYear(0,1999,11,31)),
+ LocalDateFromTime(SetFullYear(0,1999,11,31)) );
+
+ // 2000
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000)),
+ LocalDateFromTime(SetFullYear(0,2000)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,0);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000,0)),
+ LocalDateFromTime(SetFullYear(0,2000,0)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,0,1);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000,0,1)),
+ LocalDateFromTime(SetFullYear(0,2000,0,1)) );
+
+ // feb 29, 2000
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000)),
+ LocalDateFromTime(SetFullYear(0,2000)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,1);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000,1)),
+ LocalDateFromTime(SetFullYear(0,2000,1)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,1,29);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000,1,29)),
+ LocalDateFromTime(SetFullYear(0,2000,1,29)) );
+
+ // Jan 1, 2005
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005);TDATE",
+ UTCDateFromTime(SetFullYear(0,2005)),
+ LocalDateFromTime(SetFullYear(0,2005)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0);TDATE",
+ UTCDateFromTime(SetFullYear(0,2005,0)),
+ LocalDateFromTime(SetFullYear(0,2005,0)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0,1);TDATE",
+ UTCDateFromTime(SetFullYear(0,2005,0,1)),
+ LocalDateFromTime(SetFullYear(0,2005,0,1)) );
+
+*/
+}
+function addNewTestCase( DateString, UTCDate, LocalDate) {
+ DateCase = eval( DateString );
+
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
+function SetFullYear( t, year, mon, date ) {
+ var T = ( isNaN(t) ) ? 0 : LocalTime(t) ;
+ var YEAR = Number( year );
+ var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon );
+ var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date );
+
+ var DAY = MakeDay( YEAR, MONTH, DATE );
+ var UTC_DATE = UTC(MakeDate( DAY, TimeWithinDay(T)));
+
+ return ( TimeClip(UTC_DATE) );
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-3.js
new file mode 100644
index 0000000..c1e9c81
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-3.js
@@ -0,0 +1,218 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.36-1.js
+ ECMA Section: 15.9.5.36 Date.prototype.setFullYear(year [, mon [, date ]] )
+ Description:
+
+ If mon is not specified, this behaves as if mon were specified with the
+ value getMonth( ). If date is not specified, this behaves as if date were
+ specified with the value getDate( ).
+
+ 1. Let t be the result of LocalTime(this time value); but if this time
+ value is NaN, let t be +0.
+ 2. Call ToNumber(year).
+ 3. If mon is not specified, compute MonthFromTime(t); otherwise, call
+ ToNumber(mon).
+ 4. If date is not specified, compute DateFromTime(t); otherwise, call
+ ToNumber(date).
+ 5. Compute MakeDay(Result(2), Result(3), Result(4)).
+ 6. Compute UTC(MakeDate(Result(5), TimeWithinDay(t))).
+ 7. Set the [[Value]] property of the this value to TimeClip(Result(6)).
+ 8. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+ Added test cases for Year 2000 Compatilibity Testing.
+
+*/
+ var SECTION = "15.9.5.36-1";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Date.prototype.setFullYear(year [, mon [, date ]] )");
+
+ getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCases() {
+ // 1971
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1971);TDATE",
+ UTCDateFromTime(SetFullYear(0,1971)),
+ LocalDateFromTime(SetFullYear(0,1971)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1971,0);TDATE",
+ UTCDateFromTime(SetFullYear(0,1971,0)),
+ LocalDateFromTime(SetFullYear(0,1971,0)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1971,0,1);TDATE",
+ UTCDateFromTime(SetFullYear(0,1971,0,1)),
+ LocalDateFromTime(SetFullYear(0,1971,0,1)) );
+
+/*
+ // 1999
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1999);TDATE",
+ UTCDateFromTime(SetFullYear(0,1999)),
+ LocalDateFromTime(SetFullYear(0,1999)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1999,11);TDATE",
+ UTCDateFromTime(SetFullYear(0,1999,11)),
+ LocalDateFromTime(SetFullYear(0,1999,11)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1999,11,31);TDATE",
+ UTCDateFromTime(SetFullYear(0,1999,11,31)),
+ LocalDateFromTime(SetFullYear(0,1999,11,31)) );
+
+ // 2000
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000)),
+ LocalDateFromTime(SetFullYear(0,2000)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,0);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000,0)),
+ LocalDateFromTime(SetFullYear(0,2000,0)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,0,1);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000,0,1)),
+ LocalDateFromTime(SetFullYear(0,2000,0,1)) );
+
+ // feb 29, 2000
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000)),
+ LocalDateFromTime(SetFullYear(0,2000)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,1);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000,1)),
+ LocalDateFromTime(SetFullYear(0,2000,1)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,1,29);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000,1,29)),
+ LocalDateFromTime(SetFullYear(0,2000,1,29)) );
+
+ // Jan 1, 2005
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005);TDATE",
+ UTCDateFromTime(SetFullYear(0,2005)),
+ LocalDateFromTime(SetFullYear(0,2005)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0);TDATE",
+ UTCDateFromTime(SetFullYear(0,2005,0)),
+ LocalDateFromTime(SetFullYear(0,2005,0)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0,1);TDATE",
+ UTCDateFromTime(SetFullYear(0,2005,0,1)),
+ LocalDateFromTime(SetFullYear(0,2005,0,1)) );
+
+*/
+}
+function addNewTestCase( DateString, UTCDate, LocalDate) {
+ DateCase = eval( DateString );
+
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
+function SetFullYear( t, year, mon, date ) {
+ var T = ( isNaN(t) ) ? 0 : LocalTime(t) ;
+ var YEAR = Number( year );
+ var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon );
+ var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date );
+
+ var DAY = MakeDay( YEAR, MONTH, DATE );
+ var UTC_DATE = UTC(MakeDate( DAY, TimeWithinDay(T)));
+
+ return ( TimeClip(UTC_DATE) );
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-4.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-4.js
new file mode 100644
index 0000000..4d7f08b0
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-4.js
@@ -0,0 +1,205 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.36-1.js
+ ECMA Section: 15.9.5.36 Date.prototype.setFullYear(year [, mon [, date ]] )
+ Description:
+
+ If mon is not specified, this behaves as if mon were specified with the
+ value getMonth( ). If date is not specified, this behaves as if date were
+ specified with the value getDate( ).
+
+ 1. Let t be the result of LocalTime(this time value); but if this time
+ value is NaN, let t be +0.
+ 2. Call ToNumber(year).
+ 3. If mon is not specified, compute MonthFromTime(t); otherwise, call
+ ToNumber(mon).
+ 4. If date is not specified, compute DateFromTime(t); otherwise, call
+ ToNumber(date).
+ 5. Compute MakeDay(Result(2), Result(3), Result(4)).
+ 6. Compute UTC(MakeDate(Result(5), TimeWithinDay(t))).
+ 7. Set the [[Value]] property of the this value to TimeClip(Result(6)).
+ 8. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+ Added test cases for Year 2000 Compatilibity Testing.
+
+*/
+ var SECTION = "15.9.5.36-1";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Date.prototype.setFullYear(year [, mon [, date ]] )");
+
+ getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCases() {
+ // 1999
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1999);TDATE",
+ UTCDateFromTime(SetFullYear(0,1999)),
+ LocalDateFromTime(SetFullYear(0,1999)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1999,11);TDATE",
+ UTCDateFromTime(SetFullYear(0,1999,11)),
+ LocalDateFromTime(SetFullYear(0,1999,11)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1999,11,31);TDATE",
+ UTCDateFromTime(SetFullYear(0,1999,11,31)),
+ LocalDateFromTime(SetFullYear(0,1999,11,31)) );
+
+/*
+ // 2000
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000)),
+ LocalDateFromTime(SetFullYear(0,2000)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,0);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000,0)),
+ LocalDateFromTime(SetFullYear(0,2000,0)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,0,1);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000,0,1)),
+ LocalDateFromTime(SetFullYear(0,2000,0,1)) );
+
+ // feb 29, 2000
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000)),
+ LocalDateFromTime(SetFullYear(0,2000)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,1);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000,1)),
+ LocalDateFromTime(SetFullYear(0,2000,1)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,1,29);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000,1,29)),
+ LocalDateFromTime(SetFullYear(0,2000,1,29)) );
+
+ // Jan 1, 2005
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005);TDATE",
+ UTCDateFromTime(SetFullYear(0,2005)),
+ LocalDateFromTime(SetFullYear(0,2005)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0);TDATE",
+ UTCDateFromTime(SetFullYear(0,2005,0)),
+ LocalDateFromTime(SetFullYear(0,2005,0)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0,1);TDATE",
+ UTCDateFromTime(SetFullYear(0,2005,0,1)),
+ LocalDateFromTime(SetFullYear(0,2005,0,1)) );
+
+*/
+}
+function addNewTestCase( DateString, UTCDate, LocalDate) {
+ DateCase = eval( DateString );
+
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
+function SetFullYear( t, year, mon, date ) {
+ var T = ( isNaN(t) ) ? 0 : LocalTime(t) ;
+ var YEAR = Number( year );
+ var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon );
+ var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date );
+
+ var DAY = MakeDay( YEAR, MONTH, DATE );
+ var UTC_DATE = UTC(MakeDate( DAY, TimeWithinDay(T)));
+
+ return ( TimeClip(UTC_DATE) );
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-5.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-5.js
new file mode 100644
index 0000000..41dc143
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-5.js
@@ -0,0 +1,192 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.36-1.js
+ ECMA Section: 15.9.5.36 Date.prototype.setFullYear(year [, mon [, date ]] )
+ Description:
+
+ If mon is not specified, this behaves as if mon were specified with the
+ value getMonth( ). If date is not specified, this behaves as if date were
+ specified with the value getDate( ).
+
+ 1. Let t be the result of LocalTime(this time value); but if this time
+ value is NaN, let t be +0.
+ 2. Call ToNumber(year).
+ 3. If mon is not specified, compute MonthFromTime(t); otherwise, call
+ ToNumber(mon).
+ 4. If date is not specified, compute DateFromTime(t); otherwise, call
+ ToNumber(date).
+ 5. Compute MakeDay(Result(2), Result(3), Result(4)).
+ 6. Compute UTC(MakeDate(Result(5), TimeWithinDay(t))).
+ 7. Set the [[Value]] property of the this value to TimeClip(Result(6)).
+ 8. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+ Added test cases for Year 2000 Compatilibity Testing.
+
+*/
+ var SECTION = "15.9.5.36-1";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Date.prototype.setFullYear(year [, mon [, date ]] )");
+
+ getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCases() {
+ // 2000
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000)),
+ LocalDateFromTime(SetFullYear(0,2000)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,0);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000,0)),
+ LocalDateFromTime(SetFullYear(0,2000,0)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,0,1);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000,0,1)),
+ LocalDateFromTime(SetFullYear(0,2000,0,1)) );
+
+/*
+ // feb 29, 2000
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000)),
+ LocalDateFromTime(SetFullYear(0,2000)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,1);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000,1)),
+ LocalDateFromTime(SetFullYear(0,2000,1)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,1,29);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000,1,29)),
+ LocalDateFromTime(SetFullYear(0,2000,1,29)) );
+
+ // Jan 1, 2005
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005);TDATE",
+ UTCDateFromTime(SetFullYear(0,2005)),
+ LocalDateFromTime(SetFullYear(0,2005)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0);TDATE",
+ UTCDateFromTime(SetFullYear(0,2005,0)),
+ LocalDateFromTime(SetFullYear(0,2005,0)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0,1);TDATE",
+ UTCDateFromTime(SetFullYear(0,2005,0,1)),
+ LocalDateFromTime(SetFullYear(0,2005,0,1)) );
+
+*/
+}
+function addNewTestCase( DateString, UTCDate, LocalDate) {
+ DateCase = eval( DateString );
+
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
+function SetFullYear( t, year, mon, date ) {
+ var T = ( isNaN(t) ) ? 0 : LocalTime(t) ;
+ var YEAR = Number( year );
+ var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon );
+ var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date );
+
+ var DAY = MakeDay( YEAR, MONTH, DATE );
+ var UTC_DATE = UTC(MakeDate( DAY, TimeWithinDay(T)));
+
+ return ( TimeClip(UTC_DATE) );
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-6.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-6.js
new file mode 100644
index 0000000..8bed8d2
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-6.js
@@ -0,0 +1,179 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.36-1.js
+ ECMA Section: 15.9.5.36 Date.prototype.setFullYear(year [, mon [, date ]] )
+ Description:
+
+ If mon is not specified, this behaves as if mon were specified with the
+ value getMonth( ). If date is not specified, this behaves as if date were
+ specified with the value getDate( ).
+
+ 1. Let t be the result of LocalTime(this time value); but if this time
+ value is NaN, let t be +0.
+ 2. Call ToNumber(year).
+ 3. If mon is not specified, compute MonthFromTime(t); otherwise, call
+ ToNumber(mon).
+ 4. If date is not specified, compute DateFromTime(t); otherwise, call
+ ToNumber(date).
+ 5. Compute MakeDay(Result(2), Result(3), Result(4)).
+ 6. Compute UTC(MakeDate(Result(5), TimeWithinDay(t))).
+ 7. Set the [[Value]] property of the this value to TimeClip(Result(6)).
+ 8. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+ Added test cases for Year 2000 Compatilibity Testing.
+
+*/
+ var SECTION = "15.9.5.36-1";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Date.prototype.setFullYear(year [, mon [, date ]] )");
+
+ getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCases() {
+ // feb 29, 2000
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000)),
+ LocalDateFromTime(SetFullYear(0,2000)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,1);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000,1)),
+ LocalDateFromTime(SetFullYear(0,2000,1)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,1,29);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000,1,29)),
+ LocalDateFromTime(SetFullYear(0,2000,1,29)) );
+
+/*
+ // Jan 1, 2005
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005);TDATE",
+ UTCDateFromTime(SetFullYear(0,2005)),
+ LocalDateFromTime(SetFullYear(0,2005)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0);TDATE",
+ UTCDateFromTime(SetFullYear(0,2005,0)),
+ LocalDateFromTime(SetFullYear(0,2005,0)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0,1);TDATE",
+ UTCDateFromTime(SetFullYear(0,2005,0,1)),
+ LocalDateFromTime(SetFullYear(0,2005,0,1)) );
+
+*/
+}
+function addNewTestCase( DateString, UTCDate, LocalDate) {
+ DateCase = eval( DateString );
+
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
+function SetFullYear( t, year, mon, date ) {
+ var T = ( isNaN(t) ) ? 0 : LocalTime(t) ;
+ var YEAR = Number( year );
+ var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon );
+ var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date );
+
+ var DAY = MakeDay( YEAR, MONTH, DATE );
+ var UTC_DATE = UTC(MakeDate( DAY, TimeWithinDay(T)));
+
+ return ( TimeClip(UTC_DATE) );
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-7.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-7.js
new file mode 100644
index 0000000..8520844
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-7.js
@@ -0,0 +1,164 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.36-1.js
+ ECMA Section: 15.9.5.36 Date.prototype.setFullYear(year [, mon [, date ]] )
+ Description:
+
+ If mon is not specified, this behaves as if mon were specified with the
+ value getMonth( ). If date is not specified, this behaves as if date were
+ specified with the value getDate( ).
+
+ 1. Let t be the result of LocalTime(this time value); but if this time
+ value is NaN, let t be +0.
+ 2. Call ToNumber(year).
+ 3. If mon is not specified, compute MonthFromTime(t); otherwise, call
+ ToNumber(mon).
+ 4. If date is not specified, compute DateFromTime(t); otherwise, call
+ ToNumber(date).
+ 5. Compute MakeDay(Result(2), Result(3), Result(4)).
+ 6. Compute UTC(MakeDate(Result(5), TimeWithinDay(t))).
+ 7. Set the [[Value]] property of the this value to TimeClip(Result(6)).
+ 8. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+ Added test cases for Year 2000 Compatilibity Testing.
+
+*/
+ var SECTION = "15.9.5.36-1";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Date.prototype.setFullYear(year [, mon [, date ]] )");
+
+ getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCases() {
+ // Jan 1, 2005
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005);TDATE",
+ UTCDateFromTime(SetFullYear(0,2005)),
+ LocalDateFromTime(SetFullYear(0,2005)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0);TDATE",
+ UTCDateFromTime(SetFullYear(0,2005,0)),
+ LocalDateFromTime(SetFullYear(0,2005,0)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0,1);TDATE",
+ UTCDateFromTime(SetFullYear(0,2005,0,1)),
+ LocalDateFromTime(SetFullYear(0,2005,0,1)) );
+
+}
+function addNewTestCase( DateString, UTCDate, LocalDate) {
+ DateCase = eval( DateString );
+
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
+function SetFullYear( t, year, mon, date ) {
+ var T = ( isNaN(t) ) ? 0 : LocalTime(t) ;
+ var YEAR = Number( year );
+ var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon );
+ var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date );
+
+ var DAY = MakeDay( YEAR, MONTH, DATE );
+ var UTC_DATE = UTC(MakeDate( DAY, TimeWithinDay(T)));
+
+ return ( TimeClip(UTC_DATE) );
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.37-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.37-1.js
new file mode 100644
index 0000000..9eaf49d
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.37-1.js
@@ -0,0 +1,235 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+ /**
+ File Name: 15.9.5.37-1.js
+ ECMA Section: 15.9.5.37 Date.prototype.setUTCFullYear(year [, mon [, date ]] )
+ Description:
+
+ If mon is not specified, this behaves as if mon were specified with the
+ value getUTCMonth( ). If date is not specified, this behaves as if date
+ were specified with the value getUTCDate( ).
+
+ 1. Let t be this time value; but if this time value is NaN, let t be +0.
+ 2. Call ToNumber(year).
+ 3. If mon is not specified, compute MonthFromTime(t); otherwise, call
+ ToNumber(mon).
+ 4. If date is not specified, compute DateFromTime(t); otherwise, call
+ ToNumber(date).
+ 5. Compute MakeDay(Result(2), Result(3), Result(4)).
+ 6. Compute MakeDate(Result(5), TimeWithinDay(t)).
+ 7. Set the [[Value]] property of the this value to TimeClip(Result(6)).
+ 8. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+ Added some Year 2000 test cases.
+*/
+ var SECTION = "15.9.5.37-1";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Date.prototype.setUTCFullYear(year [, mon [, date ]] )");
+
+ getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
+function getTestCases() {
+
+ // Dates around 1970
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1970);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1970)),
+ LocalDateFromTime(SetUTCFullYear(0,1970)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1971);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1971)),
+ LocalDateFromTime(SetUTCFullYear(0,1971)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1972);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1972)),
+ LocalDateFromTime(SetUTCFullYear(0,1972)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1968);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1968)),
+ LocalDateFromTime(SetUTCFullYear(0,1968)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1969);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1969)),
+ LocalDateFromTime(SetUTCFullYear(0,1969)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1969);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1969)),
+ LocalDateFromTime(SetUTCFullYear(0,1969)) );
+/*
+ // Dates around 2000
+
+ addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2000);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,2000)),
+ LocalDateFromTime(SetUTCFullYear(0,2000)) );
+
+ addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2001);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,2001)),
+ LocalDateFromTime(SetUTCFullYear(0,2001)) );
+
+ addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1999);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1999)),
+ LocalDateFromTime(SetUTCFullYear(0,1999)) );
+
+ // Dates around 29 February 2000
+
+ var UTC_FEB_29_1972 = TIME_1970 + TimeInYear(1970) + TimeInYear(1971) +
+ 31*msPerDay + 28*msPerDay;
+
+ var PST_FEB_29_1972 = UTC_FEB_29_1972 - TZ_DIFF * msPerHour;
+
+ addNewTestCase( "TDATE = new Date("+UTC_FEB_29_1972+"); "+
+ "TDATE.setUTCFullYear(2000);TDATE",
+ UTCDateFromTime(SetUTCFullYear(UTC_FEB_29_1972,2000)),
+ LocalDateFromTime(SetUTCFullYear(UTC_FEB_29_1972,2000)) );
+
+ addNewTestCase( "TDATE = new Date("+PST_FEB_29_1972+"); "+
+ "TDATE.setUTCFullYear(2000);TDATE",
+ UTCDateFromTime(SetUTCFullYear(PST_FEB_29_1972,2000)),
+ LocalDateFromTime(SetUTCFullYear(PST_FEB_29_1972,2000)) );
+
+ // Dates around 2005
+
+ addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2005);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,2005)),
+ LocalDateFromTime(SetUTCFullYear(0,2005)) );
+
+ addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2004);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,2004)),
+ LocalDateFromTime(SetUTCFullYear(0,2004)) );
+
+ addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2006);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,2006)),
+ LocalDateFromTime(SetUTCFullYear(0,2006)) );
+
+
+ // Dates around 1900
+ addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1900);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1900)),
+ LocalDateFromTime(SetUTCFullYear(0,1900)) );
+
+ addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1899);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1899)),
+ LocalDateFromTime(SetUTCFullYear(0,1899)) );
+
+ addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1901);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1901)),
+ LocalDateFromTime(SetUTCFullYear(0,1901)) );
+
+*/
+}
+function addNewTestCase( DateString, UTCDate, LocalDate) {
+ DateCase = eval( DateString );
+
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
+function SetUTCFullYear( t, year, mon, date ) {
+ var T = ( t != t ) ? 0 : t;
+ var YEAR = Number(year);
+ var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon );
+ var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date );
+ var DAY = MakeDay( YEAR, MONTH, DATE );
+
+ return ( TimeClip(MakeDate(DAY, TimeWithinDay(T))) );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.37-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.37-2.js
new file mode 100644
index 0000000..ffb8fda
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.37-2.js
@@ -0,0 +1,209 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+ /**
+ File Name: 15.9.5.37-1.js
+ ECMA Section: 15.9.5.37 Date.prototype.setUTCFullYear(year [, mon [, date ]] )
+ Description:
+
+ If mon is not specified, this behaves as if mon were specified with the
+ value getUTCMonth( ). If date is not specified, this behaves as if date
+ were specified with the value getUTCDate( ).
+
+ 1. Let t be this time value; but if this time value is NaN, let t be +0.
+ 2. Call ToNumber(year).
+ 3. If mon is not specified, compute MonthFromTime(t); otherwise, call
+ ToNumber(mon).
+ 4. If date is not specified, compute DateFromTime(t); otherwise, call
+ ToNumber(date).
+ 5. Compute MakeDay(Result(2), Result(3), Result(4)).
+ 6. Compute MakeDate(Result(5), TimeWithinDay(t)).
+ 7. Set the [[Value]] property of the this value to TimeClip(Result(6)).
+ 8. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+ Added some Year 2000 test cases.
+*/
+ var SECTION = "15.9.5.37-1";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Date.prototype.setUTCFullYear(year [, mon [, date ]] )");
+
+ getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
+function getTestCases() {
+
+ // Dates around 2000
+
+ addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2000);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,2000)),
+ LocalDateFromTime(SetUTCFullYear(0,2000)) );
+
+ addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2001);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,2001)),
+ LocalDateFromTime(SetUTCFullYear(0,2001)) );
+
+ addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1999);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1999)),
+ LocalDateFromTime(SetUTCFullYear(0,1999)) );
+/*
+ // Dates around 29 February 2000
+
+ var UTC_FEB_29_1972 = TIME_1970 + TimeInYear(1970) + TimeInYear(1971) +
+ 31*msPerDay + 28*msPerDay;
+
+ var PST_FEB_29_1972 = UTC_FEB_29_1972 - TZ_DIFF * msPerHour;
+
+ addNewTestCase( "TDATE = new Date("+UTC_FEB_29_1972+"); "+
+ "TDATE.setUTCFullYear(2000);TDATE",
+ UTCDateFromTime(SetUTCFullYear(UTC_FEB_29_1972,2000)),
+ LocalDateFromTime(SetUTCFullYear(UTC_FEB_29_1972,2000)) );
+
+ addNewTestCase( "TDATE = new Date("+PST_FEB_29_1972+"); "+
+ "TDATE.setUTCFullYear(2000);TDATE",
+ UTCDateFromTime(SetUTCFullYear(PST_FEB_29_1972,2000)),
+ LocalDateFromTime(SetUTCFullYear(PST_FEB_29_1972,2000)) );
+
+ // Dates around 2005
+
+ addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2005);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,2005)),
+ LocalDateFromTime(SetUTCFullYear(0,2005)) );
+
+ addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2004);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,2004)),
+ LocalDateFromTime(SetUTCFullYear(0,2004)) );
+
+ addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2006);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,2006)),
+ LocalDateFromTime(SetUTCFullYear(0,2006)) );
+
+
+ // Dates around 1900
+ addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1900);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1900)),
+ LocalDateFromTime(SetUTCFullYear(0,1900)) );
+
+ addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1899);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1899)),
+ LocalDateFromTime(SetUTCFullYear(0,1899)) );
+
+ addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1901);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1901)),
+ LocalDateFromTime(SetUTCFullYear(0,1901)) );
+
+*/
+}
+function addNewTestCase( DateString, UTCDate, LocalDate) {
+ DateCase = eval( DateString );
+
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
+function SetUTCFullYear( t, year, mon, date ) {
+ var T = ( t != t ) ? 0 : t;
+ var YEAR = Number(year);
+ var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon );
+ var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date );
+ var DAY = MakeDay( YEAR, MONTH, DATE );
+
+ return ( TimeClip(MakeDate(DAY, TimeWithinDay(T))) );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.37-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.37-3.js
new file mode 100644
index 0000000..136ec89
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.37-3.js
@@ -0,0 +1,195 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+ /**
+ File Name: 15.9.5.37-1.js
+ ECMA Section: 15.9.5.37 Date.prototype.setUTCFullYear(year [, mon [, date ]] )
+ Description:
+
+ If mon is not specified, this behaves as if mon were specified with the
+ value getUTCMonth( ). If date is not specified, this behaves as if date
+ were specified with the value getUTCDate( ).
+
+ 1. Let t be this time value; but if this time value is NaN, let t be +0.
+ 2. Call ToNumber(year).
+ 3. If mon is not specified, compute MonthFromTime(t); otherwise, call
+ ToNumber(mon).
+ 4. If date is not specified, compute DateFromTime(t); otherwise, call
+ ToNumber(date).
+ 5. Compute MakeDay(Result(2), Result(3), Result(4)).
+ 6. Compute MakeDate(Result(5), TimeWithinDay(t)).
+ 7. Set the [[Value]] property of the this value to TimeClip(Result(6)).
+ 8. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+ Added some Year 2000 test cases.
+*/
+ var SECTION = "15.9.5.37-1";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Date.prototype.setUTCFullYear(year [, mon [, date ]] )");
+
+ getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
+function getTestCases() {
+
+ // Dates around 29 February 2000
+
+ var UTC_FEB_29_1972 = TIME_1970 + TimeInYear(1970) + TimeInYear(1971) +
+ 31*msPerDay + 28*msPerDay;
+
+ var PST_FEB_29_1972 = UTC_FEB_29_1972 - TZ_DIFF * msPerHour;
+
+ addNewTestCase( "TDATE = new Date("+UTC_FEB_29_1972+"); "+
+ "TDATE.setUTCFullYear(2000);TDATE",
+ UTCDateFromTime(SetUTCFullYear(UTC_FEB_29_1972,2000)),
+ LocalDateFromTime(SetUTCFullYear(UTC_FEB_29_1972,2000)) );
+
+ addNewTestCase( "TDATE = new Date("+PST_FEB_29_1972+"); "+
+ "TDATE.setUTCFullYear(2000);TDATE",
+ UTCDateFromTime(SetUTCFullYear(PST_FEB_29_1972,2000)),
+ LocalDateFromTime(SetUTCFullYear(PST_FEB_29_1972,2000)) );
+/*
+ // Dates around 2005
+
+ addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2005);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,2005)),
+ LocalDateFromTime(SetUTCFullYear(0,2005)) );
+
+ addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2004);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,2004)),
+ LocalDateFromTime(SetUTCFullYear(0,2004)) );
+
+ addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2006);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,2006)),
+ LocalDateFromTime(SetUTCFullYear(0,2006)) );
+
+
+ // Dates around 1900
+ addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1900);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1900)),
+ LocalDateFromTime(SetUTCFullYear(0,1900)) );
+
+ addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1899);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1899)),
+ LocalDateFromTime(SetUTCFullYear(0,1899)) );
+
+ addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1901);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1901)),
+ LocalDateFromTime(SetUTCFullYear(0,1901)) );
+
+*/
+}
+function addNewTestCase( DateString, UTCDate, LocalDate) {
+ DateCase = eval( DateString );
+
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
+function SetUTCFullYear( t, year, mon, date ) {
+ var T = ( t != t ) ? 0 : t;
+ var YEAR = Number(year);
+ var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon );
+ var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date );
+ var DAY = MakeDay( YEAR, MONTH, DATE );
+
+ return ( TimeClip(MakeDate(DAY, TimeWithinDay(T))) );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.37-4.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.37-4.js
new file mode 100644
index 0000000..c7876d1
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.37-4.js
@@ -0,0 +1,177 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+ /**
+ File Name: 15.9.5.37-1.js
+ ECMA Section: 15.9.5.37 Date.prototype.setUTCFullYear(year [, mon [, date ]] )
+ Description:
+
+ If mon is not specified, this behaves as if mon were specified with the
+ value getUTCMonth( ). If date is not specified, this behaves as if date
+ were specified with the value getUTCDate( ).
+
+ 1. Let t be this time value; but if this time value is NaN, let t be +0.
+ 2. Call ToNumber(year).
+ 3. If mon is not specified, compute MonthFromTime(t); otherwise, call
+ ToNumber(mon).
+ 4. If date is not specified, compute DateFromTime(t); otherwise, call
+ ToNumber(date).
+ 5. Compute MakeDay(Result(2), Result(3), Result(4)).
+ 6. Compute MakeDate(Result(5), TimeWithinDay(t)).
+ 7. Set the [[Value]] property of the this value to TimeClip(Result(6)).
+ 8. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+ Added some Year 2000 test cases.
+*/
+ var SECTION = "15.9.5.37-1";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Date.prototype.setUTCFullYear(year [, mon [, date ]] )");
+
+ getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
+function getTestCases() {
+ // Dates around 2005
+
+ addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2005);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,2005)),
+ LocalDateFromTime(SetUTCFullYear(0,2005)) );
+
+ addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2004);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,2004)),
+ LocalDateFromTime(SetUTCFullYear(0,2004)) );
+
+ addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2006);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,2006)),
+ LocalDateFromTime(SetUTCFullYear(0,2006)) );
+
+/*
+ // Dates around 1900
+ addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1900);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1900)),
+ LocalDateFromTime(SetUTCFullYear(0,1900)) );
+
+ addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1899);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1899)),
+ LocalDateFromTime(SetUTCFullYear(0,1899)) );
+
+ addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1901);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1901)),
+ LocalDateFromTime(SetUTCFullYear(0,1901)) );
+
+*/
+}
+function addNewTestCase( DateString, UTCDate, LocalDate) {
+ DateCase = eval( DateString );
+
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
+function SetUTCFullYear( t, year, mon, date ) {
+ var T = ( t != t ) ? 0 : t;
+ var YEAR = Number(year);
+ var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon );
+ var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date );
+ var DAY = MakeDay( YEAR, MONTH, DATE );
+
+ return ( TimeClip(MakeDate(DAY, TimeWithinDay(T))) );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.37-5.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.37-5.js
new file mode 100644
index 0000000..cee31ed
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.37-5.js
@@ -0,0 +1,160 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+ /**
+ File Name: 15.9.5.37-1.js
+ ECMA Section: 15.9.5.37 Date.prototype.setUTCFullYear(year [, mon [, date ]] )
+ Description:
+
+ If mon is not specified, this behaves as if mon were specified with the
+ value getUTCMonth( ). If date is not specified, this behaves as if date
+ were specified with the value getUTCDate( ).
+
+ 1. Let t be this time value; but if this time value is NaN, let t be +0.
+ 2. Call ToNumber(year).
+ 3. If mon is not specified, compute MonthFromTime(t); otherwise, call
+ ToNumber(mon).
+ 4. If date is not specified, compute DateFromTime(t); otherwise, call
+ ToNumber(date).
+ 5. Compute MakeDay(Result(2), Result(3), Result(4)).
+ 6. Compute MakeDate(Result(5), TimeWithinDay(t)).
+ 7. Set the [[Value]] property of the this value to TimeClip(Result(6)).
+ 8. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+ Added some Year 2000 test cases.
+*/
+ var SECTION = "15.9.5.37-1";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Date.prototype.setUTCFullYear(year [, mon [, date ]] )");
+
+ getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
+function getTestCases() {
+ // Dates around 1900
+ addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1900);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1900)),
+ LocalDateFromTime(SetUTCFullYear(0,1900)) );
+
+ addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1899);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1899)),
+ LocalDateFromTime(SetUTCFullYear(0,1899)) );
+
+ addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1901);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1901)),
+ LocalDateFromTime(SetUTCFullYear(0,1901)) );
+}
+function addNewTestCase( DateString, UTCDate, LocalDate) {
+ DateCase = eval( DateString );
+
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
+function SetUTCFullYear( t, year, mon, date ) {
+ var T = ( t != t ) ? 0 : t;
+ var YEAR = Number(year);
+ var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon );
+ var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date );
+ var DAY = MakeDay( YEAR, MONTH, DATE );
+
+ return ( TimeClip(MakeDate(DAY, TimeWithinDay(T))) );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.4-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.4-1.js
new file mode 100644
index 0000000..81c3740
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.4-1.js
@@ -0,0 +1,96 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.4-1.js
+ ECMA Section: 15.9.5.4-1 Date.prototype.getTime
+ Description:
+
+ 1. If the this value is not an object whose [[Class]] property is "Date",
+ generate a runtime error.
+ 2. Return this time value.
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "15.9.5.4-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getTime";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+ var now = (new Date()).valueOf();
+ var UTC_29_FEB_2000 = TIME_2000 + 31*msPerDay + 28*msPerDay;
+ var UTC_1_JAN_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ addTestCase( now );
+ addTestCase( TIME_1970 );
+ addTestCase( TIME_1900 );
+ addTestCase( TIME_2000 );
+ addTestCase( UTC_29_FEB_2000 );
+ addTestCase( UTC_1_JAN_2005 );
+
+ test();
+
+function addTestCase( t ) {
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+").getTime()",
+ t,
+ (new Date(t)).getTime() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t+1)+").getTime()",
+ t+1,
+ (new Date(t+1)).getTime() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t-1)+").getTime()",
+ t-1,
+ (new Date(t-1)).getTime() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t-TZ_ADJUST)+").getTime()",
+ t-TZ_ADJUST,
+ (new Date(t-TZ_ADJUST)).getTime() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t+TZ_ADJUST)+").getTime()",
+ t+TZ_ADJUST,
+ (new Date(t+TZ_ADJUST)).getTime() );
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.4-2-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.4-2-n.js
new file mode 100644
index 0000000..c90559a
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.4-2-n.js
@@ -0,0 +1,67 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.4-2-n.js
+ ECMA Section: 15.9.5.4-1 Date.prototype.getTime
+ Description:
+
+ 1. If the this value is not an object whose [[Class]] property is "Date",
+ generate a runtime error.
+ 2. Return this time value.
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+
+ var SECTION = "15.9.5.4-2-n";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getTime";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var MYDATE = new MyDate( TIME_2000 );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "MYDATE.getTime()",
+ "error",
+ MYDATE.getTime() );
+
+function MyDate( value ) {
+ this.value = value;
+ this.getTime = Date.prototype.getTime;
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.5.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.5.js
new file mode 100644
index 0000000..5660c4c
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.5.js
@@ -0,0 +1,123 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.5.js
+ ECMA Section: 15.9.5.5
+ Description: Date.prototype.getYear
+
+ This function is specified here for backwards compatibility only. The
+ function getFullYear is much to be preferred for nearly all purposes,
+ because it avoids the "year 2000 problem."
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return YearFromTime(LocalTime(t)) 1900.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.5";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getYear()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ addTestCase( now );
+ addTestCase( TIME_YEAR_0 );
+ addTestCase( TIME_1970 );
+ addTestCase( TIME_1900 );
+ addTestCase( TIME_2000 );
+ addTestCase( UTC_FEB_29_2000 );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getYear()",
+ NaN,
+ (new Date(NaN)).getYear() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getYear.length",
+ 0,
+ Date.prototype.getYear.length );
+
+ test();
+function addTestCase( t ) {
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getYear()",
+ GetYear(YearFromTime(LocalTime(t))),
+ (new Date(t)).getYear() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t+1)+")).getYear()",
+ GetYear(YearFromTime(LocalTime(t+1))),
+ (new Date(t+1)).getYear() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t-1)+")).getYear()",
+ GetYear(YearFromTime(LocalTime(t-1))),
+ (new Date(t-1)).getYear() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t-TZ_ADJUST)+")).getYear()",
+ GetYear(YearFromTime(LocalTime(t-TZ_ADJUST))),
+ (new Date(t-TZ_ADJUST)).getYear() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t+TZ_ADJUST)+")).getYear()",
+ GetYear(YearFromTime(LocalTime(t+TZ_ADJUST))),
+ (new Date(t+TZ_ADJUST)).getYear() );
+}
+function GetYear( year ) {
+/*
+ if ( year >= 1900 && year < 2000 ) {
+ return year - 1900;
+ } else {
+ return year;
+ }
+*/
+ return year - 1900;
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.6.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.6.js
new file mode 100644
index 0000000..5a9cf38
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.6.js
@@ -0,0 +1,114 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.6.js
+ ECMA Section: 15.9.5.6
+ Description: Date.prototype.getFullYear
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return YearFromTime(LocalTime(t)).
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.6";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getFullYear()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ addTestCase( now );
+ addTestCase( TIME_YEAR_0 );
+ addTestCase( TIME_1970 );
+ addTestCase( TIME_1900 );
+ addTestCase( TIME_2000 );
+ addTestCase( UTC_FEB_29_2000 );
+ addTestCase( UTC_JAN_1_2005 );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getFullYear()",
+ NaN,
+ (new Date(NaN)).getFullYear() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getFullYear.length",
+ 0,
+ Date.prototype.getFullYear.length );
+
+ test();
+function addTestCase( t ) {
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getFullYear()",
+ YearFromTime(LocalTime(t)),
+ (new Date(t)).getFullYear() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t+1)+")).getFullYear()",
+ YearFromTime(LocalTime(t+1)),
+ (new Date(t+1)).getFullYear() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t-1)+")).getFullYear()",
+ YearFromTime(LocalTime(t-1)),
+ (new Date(t-1)).getFullYear() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t-TZ_ADJUST)+")).getFullYear()",
+ YearFromTime(LocalTime(t-TZ_ADJUST)),
+ (new Date(t-TZ_ADJUST)).getFullYear() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t+TZ_ADJUST)+")).getFullYear()",
+ YearFromTime(LocalTime(t+TZ_ADJUST)),
+ (new Date(t+TZ_ADJUST)).getFullYear() );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.7.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.7.js
new file mode 100644
index 0000000..8a7f5c0
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.7.js
@@ -0,0 +1,114 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.7.js
+ ECMA Section: 15.9.5.7
+ Description: Date.prototype.getUTCFullYear
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return YearFromTime(t).
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.7";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getUTCFullYear()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ addTestCase( now );
+ addTestCase( TIME_YEAR_0 );
+ addTestCase( TIME_1970 );
+ addTestCase( TIME_1900 );
+ addTestCase( TIME_2000 );
+ addTestCase( UTC_FEB_29_2000 );
+ addTestCase( UTC_JAN_1_2005 );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getUTCFullYear()",
+ NaN,
+ (new Date(NaN)).getUTCFullYear() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getUTCFullYear.length",
+ 0,
+ Date.prototype.getUTCFullYear.length );
+
+ test();
+function addTestCase( t ) {
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getUTCFullYear()",
+ YearFromTime(t),
+ (new Date(t)).getUTCFullYear() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t+1)+")).getUTCFullYear()",
+ YearFromTime(t+1),
+ (new Date(t+1)).getUTCFullYear() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t-1)+")).getUTCFullYear()",
+ YearFromTime(t-1),
+ (new Date(t-1)).getUTCFullYear() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t-TZ_ADJUST)+")).getUTCFullYear()",
+ YearFromTime(t-TZ_ADJUST),
+ (new Date(t-TZ_ADJUST)).getUTCFullYear() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t+TZ_ADJUST)+")).getUTCFullYear()",
+ YearFromTime(t+TZ_ADJUST),
+ (new Date(t+TZ_ADJUST)).getUTCFullYear() );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.8.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.8.js
new file mode 100644
index 0000000..038eda9
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.8.js
@@ -0,0 +1,120 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.8.js
+ ECMA Section: 15.9.5.8
+ Description: Date.prototype.getMonth
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return MonthFromTime(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.8";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getMonth()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ addTestCase( now );
+ addTestCase( TIME_YEAR_0 );
+ addTestCase( TIME_1970 );
+ addTestCase( TIME_1900 );
+ addTestCase( TIME_2000 );
+ addTestCase( UTC_FEB_29_2000 );
+ addTestCase( UTC_JAN_1_2005 );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getMonth()",
+ NaN,
+ (new Date(NaN)).getMonth() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getMonth.length",
+ 0,
+ Date.prototype.getMonth.length );
+ test();
+function addTestCase( t ) {
+ for ( var m = 0; m < 12; m++ ) {
+
+ t += TimeInMonth(m);
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getMonth()",
+ MonthFromTime(LocalTime(t)),
+ (new Date(t)).getMonth() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t+1)+")).getMonth()",
+ MonthFromTime(LocalTime(t+1)),
+ (new Date(t+1)).getMonth() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t-1)+")).getMonth()",
+ MonthFromTime(LocalTime(t-1)),
+ (new Date(t-1)).getMonth() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t-TZ_ADJUST)+")).getMonth()",
+ MonthFromTime(LocalTime(t-TZ_ADJUST)),
+ (new Date(t-TZ_ADJUST)).getMonth() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t+TZ_ADJUST)+")).getMonth()",
+ MonthFromTime(LocalTime(t+TZ_ADJUST)),
+ (new Date(t+TZ_ADJUST)).getMonth() );
+
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.9.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.9.js
new file mode 100644
index 0000000..9fda4ea
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.9.js
@@ -0,0 +1,120 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.9.js
+ ECMA Section: 15.9.5.9
+ Description: Date.prototype.getUTCMonth
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return MonthFromTime(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.8";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getUTCMonth()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ addTestCase( now );
+ addTestCase( TIME_YEAR_0 );
+ addTestCase( TIME_1970 );
+ addTestCase( TIME_1900 );
+ addTestCase( TIME_2000 );
+ addTestCase( UTC_FEB_29_2000 );
+ addTestCase( UTC_JAN_1_2005 );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getUTCMonth()",
+ NaN,
+ (new Date(NaN)).getUTCMonth() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getUTCMonth.length",
+ 0,
+ Date.prototype.getUTCMonth.length );
+ test();
+function addTestCase( t ) {
+ for ( var m = 0; m < 12; m++ ) {
+
+ t += TimeInMonth(m);
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getUTCMonth()",
+ MonthFromTime(t),
+ (new Date(t)).getUTCMonth() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t+1)+")).getUTCMonth()",
+ MonthFromTime(t+1),
+ (new Date(t+1)).getUTCMonth() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t-1)+")).getUTCMonth()",
+ MonthFromTime(t-1),
+ (new Date(t-1)).getUTCMonth() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t-TZ_ADJUST)+")).getUTCMonth()",
+ MonthFromTime(t-TZ_ADJUST),
+ (new Date(t-TZ_ADJUST)).getUTCMonth() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t+TZ_ADJUST)+")).getUTCMonth()",
+ MonthFromTime(t+TZ_ADJUST),
+ (new Date(t+TZ_ADJUST)).getUTCMonth() );
+
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.js b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.js
new file mode 100644
index 0000000..d7bd303
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.js
@@ -0,0 +1,81 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.js
+ ECMA Section: 15.9.5 Properties of the Date prototype object
+ Description:
+
+ The Date prototype object is itself a Date object (its [[Class]] is
+ "Date") whose value is NaN.
+
+ The value of the internal [[Prototype]] property of the Date prototype
+ object is the Object prototype object (15.2.3.1).
+
+ In following descriptions of functions that are properties of the Date
+ prototype object, the phrase "this Date object" refers to the object that
+ is the this value for the invocation of the function; it is an error if
+ this does not refer to an object for which the value of the internal
+ [[Class]] property is "Date". Also, the phrase "this time value" refers
+ to the number value for the time represented by this Date object, that is,
+ the value of the internal [[Value]] property of this Date object.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Properties of the Date Prototype Object";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ Date.prototype.getClass = Object.prototype.toString;
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getClass",
+ "[object Date]",
+ Date.prototype.getClass() );
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.valueOf()",
+ NaN,
+ Date.prototype.valueOf() );
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.__proto__ == Object.prototype",
+ true,
+ Date.prototype.__proto__ == Object.prototype );
+ test();
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.3-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.3-1.js
new file mode 100644
index 0000000..f827cc7
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.3-1.js
@@ -0,0 +1,107 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 10.1.3-1.js
+ ECMA Section: 10.1.3
+ Description:
+
+ For each formal parameter, as defined in the FormalParameterList, create
+ a property of the variable object whose name is the Identifier and whose
+ attributes are determined by the type of code. The values of the
+ parameters are supplied by the caller. If the caller supplies fewer
+ parameter values than there are formal parameters, the extra formal
+ parameters have value undefined. If two or more formal parameters share
+ the same name, hence the same property, the corresponding property is
+ given the value that was supplied for the last parameter with this name.
+ If the value of this last parameter was not supplied by the caller,
+ the value of the corresponding property is undefined.
+
+
+ http://scopus.mcom.com/bugsplat/show_bug.cgi?id=104191
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "10.1.3-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Variable Instantiation: Formal Parameters";
+ var BUGNUMBER="104191";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var myfun1 = new Function( "a", "a", "return a" );
+ var myfun2 = new Function( "a", "b", "a", "return a" );
+
+ function myfun3(a, b, a) {
+ return a;
+ }
+
+ // myfun1, myfun2, myfun3 tostring
+
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ String(myfun2) +"; myfun2(2,4,8)",
+ 8,
+ myfun2(2,4,8) );
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "myfun2(2,4)",
+ void 0,
+ myfun2(2,4));
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ String(myfun3) +"; myfun3(2,4,8)",
+ 8,
+ myfun3(2,4,8) );
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "myfun3(2,4)",
+ void 0,
+ myfun3(2,4) );
+
+
+
+
+
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.3.js b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.3.js
new file mode 100644
index 0000000..be75451
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.3.js
@@ -0,0 +1,160 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 10.1.3.js
+ ECMA Section: 10.1.3.js Variable Instantiation
+ Description:
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+
+var SECTION = "10.1.3";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Variable instantiation";
+var BUGNUMBER = "20256";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var testcases = getTestCases();
+
+test();
+
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ // overriding a variable or function name with a function should succeed
+ array[item++] =
+ new TestCase(SECTION,
+ "function t() { return \"first\" };" +
+ "function t() { return \"second\" };t() ",
+ "second",
+ eval("function t() { return \"first\" };" +
+ "function t() { return \"second\" };t()"));
+
+ array[item++] =
+ new TestCase(SECTION,
+ "var t; function t(){}; typeof(t)",
+ "function",
+ eval("var t; function t(){}; typeof(t)"));
+
+
+ // formal parameter tests
+ array[item++] =
+ new TestCase(SECTION,
+ "function t1(a,b) { return b; }; t1( 4 );",
+ void 0,
+ eval("function t1(a,b) { return b; }; t1( 4 );") );
+ array[item++] =
+ new TestCase(SECTION,
+ "function t1(a,b) { return a; }; t1(4);",
+ 4,
+ eval("function t1(a,b) { return a; }; t1(4)"));
+ array[item++] =
+ new TestCase(SECTION,
+ "function t1(a,b) { return a; }; t1();",
+ void 0,
+ eval("function t1(a,b) { return a; }; t1()"));
+ array[item++] =
+ new TestCase(SECTION,
+ "function t1(a,b) { return a; }; t1(1,2,4);",
+ 1,
+ eval("function t1(a,b) { return a; }; t1(1,2,4)"));
+/*
+ array[item++] =
+ new TestCase(SECTION, "function t1(a,a) { return a; }; t1( 4 );",
+ void 0,
+ eval("function t1(a,a) { return a; }; t1( 4 )"));
+ array[item++] =
+ new TestCase(SECTION,
+ "function t1(a,a) { return a; }; t1( 1,2 );",
+ 2,
+ eval("function t1(a,a) { return a; }; t1( 1,2 )"));
+*/
+ // variable declarations
+ array[item++] =
+ new TestCase(SECTION,
+ "function t1(a,b) { return a; }; t1( false, true );",
+ false,
+ eval("function t1(a,b) { return a; }; t1( false, true );"));
+ array[item++] =
+ new TestCase(SECTION,
+ "function t1(a,b) { return b; }; t1( false, true );",
+ true,
+ eval("function t1(a,b) { return b; }; t1( false, true );"));
+ array[item++] =
+ new TestCase(SECTION,
+ "function t1(a,b) { return a+b; }; t1( 4, 2 );",
+ 6,
+ eval("function t1(a,b) { return a+b; }; t1( 4, 2 );"));
+ array[item++] =
+ new TestCase(SECTION,
+ "function t1(a,b) { return a+b; }; t1( 4 );",
+ Number.NaN,
+ eval("function t1(a,b) { return a+b; }; t1( 4 );"));
+
+ // overriding a function name with a variable should fail
+ array[item++] =
+ new TestCase(SECTION,
+ "function t() { return 'function' };" +
+ "var t = 'variable'; typeof(t)",
+ "string",
+ eval("function t() { return 'function' };" +
+ "var t = 'variable'; typeof(t)"));
+
+ // function as a constructor
+ array[item++] =
+ new TestCase(SECTION,
+ "function t1(a,b) { var a = b; return a; } t1(1,3);",
+ 3,
+ eval("function t1(a, b){ var a = b; return a;}; t1(1,3)"));
+ array[item++] =
+ new TestCase(SECTION,
+ "function t2(a,b) { this.a = b; } x = new t2(1,3); x.a",
+ 3,
+ eval("function t2(a,b) { this.a = b; };" +
+ "x = new t2(1,3); x.a"));
+ array[item++] =
+ new TestCase(SECTION,
+ "function t2(a,b) { this.a = a; } x = new t2(1,3); x.a",
+ 1,
+ eval("function t2(a,b) { this.a = a; };" +
+ "x = new t2(1,3); x.a"));
+ array[item++] =
+ new TestCase(SECTION,
+ "function t2(a,b) { this.a = b; this.b = a; } " +
+ "x = new t2(1,3);x.a;",
+ 3,
+ eval("function t2(a,b) { this.a = b; this.b = a; };" +
+ "x = new t2(1,3);x.a;"));
+ array[item++] =
+ new TestCase(SECTION,
+ "function t2(a,b) { this.a = b; this.b = a; }" +
+ "x = new t2(1,3);x.b;",
+ 1,
+ eval("function t2(a,b) { this.a = b; this.b = a; };" +
+ "x = new t2(1,3);x.b;") );
+
+ return (array);
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.4-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.4-1.js
new file mode 100644
index 0000000..6390960
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.4-1.js
@@ -0,0 +1,100 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 10.1.4-1.js
+ ECMA Section: 10.1.4 Scope Chain and Identifier Resolution
+ Description:
+ Every execution context has associated with it a scope chain. This is
+ logically a list of objects that are searched when binding an Identifier.
+ When control enters an execution context, the scope chain is created and
+ is populated with an initial set of objects, depending on the type of
+ code. When control leaves the execution context, the scope chain is
+ destroyed.
+
+ During execution, the scope chain of the execution context is affected
+ only by WithStatement. When execution enters a with block, the object
+ specified in the with statement is added to the front of the scope chain.
+ When execution leaves a with block, whether normally or via a break or
+ continue statement, the object is removed from the scope chain. The object
+ being removed will always be the first object in the scope chain.
+
+ During execution, the syntactic production PrimaryExpression : Identifier
+ is evaluated using the following algorithm:
+
+ 1. Get the next object in the scope chain. If there isn't one, go to step 5.
+ 2. Call the [[HasProperty]] method of Result(l), passing the Identifier as
+ the property.
+ 3. If Result(2) is true, return a value of type Reference whose base object
+ is Result(l) and whose property name is the Identifier.
+ 4. Go to step 1.
+ 5. Return a value of type Reference whose base object is null and whose
+ property name is the Identifier.
+ The result of binding an identifier is always a value of type Reference with
+ its member name component equal to the identifier string.
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "10.1.4-1";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Scope Chain and Identifier Resolution");
+
+ var testcases = getTestCases();
+
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+
+ var MYOBJECT = new MyObject();
+ var INPUT = 2;
+ testcases[tc].description += "( " + INPUT +" )" ;
+
+ with ( MYOBJECT ) {
+ testcases[tc].actual = eval( INPUT );
+ testcases[tc].expect = Math.pow(INPUT,2);
+ }
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( "SECTION", "with MyObject, eval should return square of " );
+
+ return ( array );
+}
+
+function MyObject() {
+ this.eval = new Function( "x", "return(Math.pow(Number(x),2))" );
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.4-10.js b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.4-10.js
new file mode 100644
index 0000000..6966acf
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.4-10.js
@@ -0,0 +1,94 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 10.1.4-10.js
+ ECMA Section: 10.1.4 Scope Chain and Identifier Resolution
+ Description:
+ Every execution context has associated with it a scope chain. This is
+ logically a list of objects that are searched when binding an Identifier.
+ When control enters an execution context, the scope chain is created and
+ is populated with an initial set of objects, depending on the type of
+ code. When control leaves the execution context, the scope chain is
+ destroyed.
+
+ During execution, the scope chain of the execution context is affected
+ only by WithStatement. When execution enters a with block, the object
+ specified in the with statement is added to the front of the scope chain.
+ When execution leaves a with block, whether normally or via a break or
+ continue statement, the object is removed from the scope chain. The object
+ being removed will always be the first object in the scope chain.
+
+ During execution, the syntactic production PrimaryExpression : Identifier
+ is evaluated using the following algorithm:
+
+ 1. Get the next object in the scope chain. If there isn't one, go to step 5.
+ 2. Call the [[HasProperty]] method of Result(l), passing the Identifier as
+ the property.
+ 3. If Result(2) is true, return a value of type Reference whose base object
+ is Result(l) and whose property name is the Identifier.
+ 4. Go to step 1.
+ 5. Return a value of type Reference whose base object is null and whose
+ property name is the Identifier.
+ The result of binding an identifier is always a value of type Reference with
+ its member name component equal to the identifier string.
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "10.1.4-10";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Scope Chain and Identifier Resolution");
+
+ var testcases = getTestCases();
+
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ var VALUE = 12345;
+ var MYOBJECT = new Number( VALUE );
+
+ with ( MYOBJECT ) {
+ testcases[tc].actual = toString();
+ testcases[tc].expect = String(VALUE);
+ }
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( "SECTION", "MYOBJECT.toString()" );
+
+ return ( array );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.4-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.4-2.js
new file mode 100644
index 0000000..b42697a
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.4-2.js
@@ -0,0 +1,102 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 10.1.4-1.js
+ ECMA Section: 10.1.4 Scope Chain and Identifier Resolution
+ Description:
+ Every execution context has associated with it a scope chain. This is
+ logically a list of objects that are searched when binding an Identifier.
+ When control enters an execution context, the scope chain is created and
+ is populated with an initial set of objects, depending on the type of
+ code. When control leaves the execution context, the scope chain is
+ destroyed.
+
+ During execution, the scope chain of the execution context is affected
+ only by WithStatement. When execution enters a with block, the object
+ specified in the with statement is added to the front of the scope chain.
+ When execution leaves a with block, whether normally or via a break or
+ continue statement, the object is removed from the scope chain. The object
+ being removed will always be the first object in the scope chain.
+
+ During execution, the syntactic production PrimaryExpression : Identifier
+ is evaluated using the following algorithm:
+
+ 1. Get the next object in the scope chain. If there isn't one, go to step 5.
+ 2. Call the [[HasProperty]] method of Result(l), passing the Identifier as
+ the property.
+ 3. If Result(2) is true, return a value of type Reference whose base object
+ is Result(l) and whose property name is the Identifier.
+ 4. Go to step 1.
+ 5. Return a value of type Reference whose base object is null and whose
+ property name is the Identifier.
+ The result of binding an identifier is always a value of type Reference with
+ its member name component equal to the identifier string.
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "10.1.4-2";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Scope Chain and Identifier Resolution");
+
+ var testcases = getTestCases();
+
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+
+ var MYOBJECT = new MyObject();
+ var INPUT = 2;
+ testcases[tc].description += "( "+INPUT +" )" ;
+
+ with ( this ) {
+ with ( MYOBJECT ) {
+ testcases[tc].actual = eval( INPUT );
+ testcases[tc].expect = Math.pow(INPUT,2);
+ }
+ }
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( "SECTION", "with MyObject, eval should return square of " );
+
+ return ( array );
+}
+
+function MyObject() {
+ this.eval = new Function( "x", "return(Math.pow(Number(x),2))" );
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.4-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.4-3.js
new file mode 100644
index 0000000..54980af
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.4-3.js
@@ -0,0 +1,98 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 10.1.4-1.js
+ ECMA Section: 10.1.4 Scope Chain and Identifier Resolution
+ Description:
+ Every execution context has associated with it a scope chain. This is
+ logically a list of objects that are searched when binding an Identifier.
+ When control enters an execution context, the scope chain is created and
+ is populated with an initial set of objects, depending on the type of
+ code. When control leaves the execution context, the scope chain is
+ destroyed.
+
+ During execution, the scope chain of the execution context is affected
+ only by WithStatement. When execution enters a with block, the object
+ specified in the with statement is added to the front of the scope chain.
+ When execution leaves a with block, whether normally or via a break or
+ continue statement, the object is removed from the scope chain. The object
+ being removed will always be the first object in the scope chain.
+
+ During execution, the syntactic production PrimaryExpression : Identifier
+ is evaluated using the following algorithm:
+
+ 1. Get the next object in the scope chain. If there isn't one, go to step 5.
+ 2. Call the [[HasProperty]] method of Result(l), passing the Identifier as
+ the property.
+ 3. If Result(2) is true, return a value of type Reference whose base object
+ is Result(l) and whose property name is the Identifier.
+ 4. Go to step 1.
+ 5. Return a value of type Reference whose base object is null and whose
+ property name is the Identifier.
+ The result of binding an identifier is always a value of type Reference with
+ its member name component equal to the identifier string.
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "10.1.4-3";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Scope Chain and Identifier Resolution");
+
+ var testcases = getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+
+ var MYOBJECT = new MyObject();
+ var INPUT = 2;
+ testcases[tc].description += ( INPUT +"" );
+
+ with ( MYOBJECT ) {
+ eval( INPUT );
+ }
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( "SECTION", "with MyObject, eval should be [object Global].eval " );
+
+ return ( array );
+}
+
+function MyObject() {
+ this.eval = new Function( "x", "return(Math.pow(Number(x),2))" );
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.4-4.js b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.4-4.js
new file mode 100644
index 0000000..88f8241
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.4-4.js
@@ -0,0 +1,101 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 10.1.4-1.js
+ ECMA Section: 10.1.4 Scope Chain and Identifier Resolution
+ Description:
+ Every execution context has associated with it a scope chain. This is
+ logically a list of objects that are searched when binding an Identifier.
+ When control enters an execution context, the scope chain is created and
+ is populated with an initial set of objects, depending on the type of
+ code. When control leaves the execution context, the scope chain is
+ destroyed.
+
+ During execution, the scope chain of the execution context is affected
+ only by WithStatement. When execution enters a with block, the object
+ specified in the with statement is added to the front of the scope chain.
+ When execution leaves a with block, whether normally or via a break or
+ continue statement, the object is removed from the scope chain. The object
+ being removed will always be the first object in the scope chain.
+
+ During execution, the syntactic production PrimaryExpression : Identifier
+ is evaluated using the following algorithm:
+
+ 1. Get the next object in the scope chain. If there isn't one, go to step 5.
+ 2. Call the [[HasProperty]] method of Result(l), passing the Identifier as
+ the property.
+ 3. If Result(2) is true, return a value of type Reference whose base object
+ is Result(l) and whose property name is the Identifier.
+ 4. Go to step 1.
+ 5. Return a value of type Reference whose base object is null and whose
+ property name is the Identifier.
+ The result of binding an identifier is always a value of type Reference with
+ its member name component equal to the identifier string.
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "10.1.4-1";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Scope Chain and Identifier Resolution");
+
+ var testcases = getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+
+ var MYOBJECT = new MyObject();
+ var INPUT = 2;
+ testcases[tc].description += ( INPUT +"" );
+
+ with ( MYOBJECT ) {
+ eval( INPUT );
+ }
+
+ testcases[tc].actual = eval( INPUT );
+ testcases[tc].expect = INPUT;
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( "SECTION", "with MyObject, eval should be [object Global].eval " );
+
+ return ( array );
+}
+
+function MyObject() {
+ this.eval = new Function( "x", "return(Math.pow(Number(x),2))" );
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.4-5.js b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.4-5.js
new file mode 100644
index 0000000..f03d120
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.4-5.js
@@ -0,0 +1,101 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 10.1.4-1.js
+ ECMA Section: 10.1.4 Scope Chain and Identifier Resolution
+ Description:
+ Every execution context has associated with it a scope chain. This is
+ logically a list of objects that are searched when binding an Identifier.
+ When control enters an execution context, the scope chain is created and
+ is populated with an initial set of objects, depending on the type of
+ code. When control leaves the execution context, the scope chain is
+ destroyed.
+
+ During execution, the scope chain of the execution context is affected
+ only by WithStatement. When execution enters a with block, the object
+ specified in the with statement is added to the front of the scope chain.
+ When execution leaves a with block, whether normally or via a break or
+ continue statement, the object is removed from the scope chain. The object
+ being removed will always be the first object in the scope chain.
+
+ During execution, the syntactic production PrimaryExpression : Identifier
+ is evaluated using the following algorithm:
+
+ 1. Get the next object in the scope chain. If there isn't one, go to step 5.
+ 2. Call the [[HasProperty]] method of Result(l), passing the Identifier as
+ the property.
+ 3. If Result(2) is true, return a value of type Reference whose base object
+ is Result(l) and whose property name is the Identifier.
+ 4. Go to step 1.
+ 5. Return a value of type Reference whose base object is null and whose
+ property name is the Identifier.
+ The result of binding an identifier is always a value of type Reference with
+ its member name component equal to the identifier string.
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "10.1.4-1";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Scope Chain and Identifier Resolution");
+
+ var testcases = getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+
+ var MYOBJECT = new MyObject();
+ var INPUT = 2;
+ testcases[tc].description += ( INPUT +"" );
+
+ with ( MYOBJECT ) {
+ eval = null;
+ }
+
+ testcases[tc].actual = eval( INPUT );
+ testcases[tc].expect = INPUT;
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( "SECTION", "with MyObject, eval should be [object Global].eval " );
+
+ return ( array );
+}
+
+function MyObject() {
+ this.eval = new Function( "x", "return(Math.pow(Number(x),2))" );
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.4-6.js b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.4-6.js
new file mode 100644
index 0000000..def668a
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.4-6.js
@@ -0,0 +1,83 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 10.1.4-1.js
+ ECMA Section: 10.1.4 Scope Chain and Identifier Resolution
+ Description:
+ Every execution context has associated with it a scope chain. This is
+ logically a list of objects that are searched when binding an Identifier.
+ When control enters an execution context, the scope chain is created and
+ is populated with an initial set of objects, depending on the type of
+ code. When control leaves the execution context, the scope chain is
+ destroyed.
+
+ During execution, the scope chain of the execution context is affected
+ only by WithStatement. When execution enters a with block, the object
+ specified in the with statement is added to the front of the scope chain.
+ When execution leaves a with block, whether normally or via a break or
+ continue statement, the object is removed from the scope chain. The object
+ being removed will always be the first object in the scope chain.
+
+ During execution, the syntactic production PrimaryExpression : Identifier
+ is evaluated using the following algorithm:
+
+ 1. Get the next object in the scope chain. If there isn't one, go to step 5.
+ 2. Call the [[HasProperty]] method of Result(l), passing the Identifier as
+ the property.
+ 3. If Result(2) is true, return a value of type Reference whose base object
+ is Result(l) and whose property name is the Identifier.
+ 4. Go to step 1.
+ 5. Return a value of type Reference whose base object is null and whose
+ property name is the Identifier.
+ The result of binding an identifier is always a value of type Reference with
+ its member name component equal to the identifier string.
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "10.1.4-1";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Scope Chain and Identifier Resolution");
+
+ getTestCases();
+ test();
+
+function getTestCases() {
+ testcases[0] = new TestCase( "SECTION",
+ "with MyObject, eval should be [object Global].eval " );
+
+ var MYOBJECT = new MyObject();
+ var INPUT = 2;
+ testcases[0].description += ( INPUT +"" );
+
+ with ( MYOBJECT ) {
+ ;
+ }
+ testcases[0].actual = eval( INPUT );
+ testcases[0].expect = INPUT;
+
+}
+
+function MyObject() {
+ this.eval = new Function( "x", "return(Math.pow(Number(x),2))" );
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.4-7.js b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.4-7.js
new file mode 100644
index 0000000..7f900b5
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.4-7.js
@@ -0,0 +1,100 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 10.1.4-1.js
+ ECMA Section: 10.1.4 Scope Chain and Identifier Resolution
+ Description:
+ Every execution context has associated with it a scope chain. This is
+ logically a list of objects that are searched when binding an Identifier.
+ When control enters an execution context, the scope chain is created and
+ is populated with an initial set of objects, depending on the type of
+ code. When control leaves the execution context, the scope chain is
+ destroyed.
+
+ During execution, the scope chain of the execution context is affected
+ only by WithStatement. When execution enters a with block, the object
+ specified in the with statement is added to the front of the scope chain.
+ When execution leaves a with block, whether normally or via a break or
+ continue statement, the object is removed from the scope chain. The object
+ being removed will always be the first object in the scope chain.
+
+ During execution, the syntactic production PrimaryExpression : Identifier
+ is evaluated using the following algorithm:
+
+ 1. Get the next object in the scope chain. If there isn't one, go to step 5.
+ 2. Call the [[HasProperty]] method of Result(l), passing the Identifier as
+ the property.
+ 3. If Result(2) is true, return a value of type Reference whose base object
+ is Result(l) and whose property name is the Identifier.
+ 4. Go to step 1.
+ 5. Return a value of type Reference whose base object is null and whose
+ property name is the Identifier.
+ The result of binding an identifier is always a value of type Reference with
+ its member name component equal to the identifier string.
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "10.1.4-7";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Scope Chain and Identifier Resolution");
+
+ var testcases = getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+
+ var MYOBJECT = new MyObject();
+ var INPUT = 2;
+ testcases[tc].description += ( INPUT +"" );
+
+ with ( MYOBJECT ) {
+ delete( eval );
+ testcases[tc].actual = eval( INPUT );
+ testcases[tc].expect = INPUT;
+ }
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( "SECTION", "with MyObject, eval should be [object Global].eval " );
+
+ return ( array );
+}
+
+function MyObject() {
+ this.eval = new Function( "x", "return(Math.pow(Number(x),2))" );
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.4-8.js b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.4-8.js
new file mode 100644
index 0000000..288f0ed
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.4-8.js
@@ -0,0 +1,101 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 10.1.4-1.js
+ ECMA Section: 10.1.4 Scope Chain and Identifier Resolution
+ Description:
+ Every execution context has associated with it a scope chain. This is
+ logically a list of objects that are searched when binding an Identifier.
+ When control enters an execution context, the scope chain is created and
+ is populated with an initial set of objects, depending on the type of
+ code. When control leaves the execution context, the scope chain is
+ destroyed.
+
+ During execution, the scope chain of the execution context is affected
+ only by WithStatement. When execution enters a with block, the object
+ specified in the with statement is added to the front of the scope chain.
+ When execution leaves a with block, whether normally or via a break or
+ continue statement, the object is removed from the scope chain. The object
+ being removed will always be the first object in the scope chain.
+
+ During execution, the syntactic production PrimaryExpression : Identifier
+ is evaluated using the following algorithm:
+
+ 1. Get the next object in the scope chain. If there isn't one, go to step 5.
+ 2. Call the [[HasProperty]] method of Result(l), passing the Identifier as
+ the property.
+ 3. If Result(2) is true, return a value of type Reference whose base object
+ is Result(l) and whose property name is the Identifier.
+ 4. Go to step 1.
+ 5. Return a value of type Reference whose base object is null and whose
+ property name is the Identifier.
+ The result of binding an identifier is always a value of type Reference with
+ its member name component equal to the identifier string.
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "10.1.4-1";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Scope Chain and Identifier Resolution");
+
+ var testcases = getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+
+ var MYOBJECT = new MyObject();
+ var INPUT = 2;
+ testcases[tc].description += ( INPUT +"" );
+
+ with ( MYOBJECT ) {
+ eval = new Function ( "x", "return(Math.pow(Number(x),3))" );
+
+ testcases[tc].actual = eval( INPUT );
+ testcases[tc].expect = Math.pow(INPUT,3);
+ }
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( "SECTION", "with MyObject, eval should cube INPUT: " );
+
+ return ( array );
+}
+
+function MyObject() {
+ this.eval = new Function( "x", "return(Math.pow(Number(x),2))" );
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.4-9.js b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.4-9.js
new file mode 100644
index 0000000..ec72ecd
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.4-9.js
@@ -0,0 +1,98 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 10.1.4-9.js
+ ECMA Section: 10.1.4 Scope Chain and Identifier Resolution
+ Description:
+ Every execution context has associated with it a scope chain. This is
+ logically a list of objects that are searched when binding an Identifier.
+ When control enters an execution context, the scope chain is created and
+ is populated with an initial set of objects, depending on the type of
+ code. When control leaves the execution context, the scope chain is
+ destroyed.
+
+ During execution, the scope chain of the execution context is affected
+ only by WithStatement. When execution enters a with block, the object
+ specified in the with statement is added to the front of the scope chain.
+ When execution leaves a with block, whether normally or via a break or
+ continue statement, the object is removed from the scope chain. The object
+ being removed will always be the first object in the scope chain.
+
+ During execution, the syntactic production PrimaryExpression : Identifier
+ is evaluated using the following algorithm:
+
+ 1. Get the next object in the scope chain. If there isn't one, go to step 5.
+ 2. Call the [[HasProperty]] method of Result(l), passing the Identifier as
+ the property.
+ 3. If Result(2) is true, return a value of type Reference whose base object
+ is Result(l) and whose property name is the Identifier.
+ 4. Go to step 1.
+ 5. Return a value of type Reference whose base object is null and whose
+ property name is the Identifier.
+ The result of binding an identifier is always a value of type Reference with
+ its member name component equal to the identifier string.
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "10.1.4-9";
+ var VERSION = "ECMA_2";
+ startTest();
+
+ var testcases = getTestCases();
+
+ writeHeaderToLog( SECTION + " Scope Chain and Identifier Resolution");
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+
+ var MYOBJECT = new MyObject();
+ var RESULT = "hello";
+
+ with ( MYOBJECT ) {
+ NEW_PROPERTY = RESULT;
+ }
+ testcases[tc].actual = NEW_PROPERTY;
+ testcases[tc].expect = RESULT;
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "NEW_PROPERTY = " );
+
+ return ( array );
+}
+function MyObject( n ) {
+ this.__proto__ = Number.prototype;
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.5-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.5-1.js
new file mode 100644
index 0000000..0cfb7c3
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.5-1.js
@@ -0,0 +1,118 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 10.1.5-1.js
+ ECMA Section: 10.1.5 Global Object
+ Description:
+ There is a unique global object which is created before control enters
+ any execution context. Initially the global object has the following
+ properties:
+
+ Built-in objects such as Math, String, Date, parseInt, etc. These have
+ attributes { DontEnum }.
+
+ Additional host defined properties. This may include a property whose
+ value is the global object itself, for example window in HTML.
+
+ As control enters execution contexts, and as ECMAScript code is executed,
+ additional properties may be added to the global object and the initial
+ properties may be changed.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "10.5.1-1";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Global Ojbect");
+
+ var testcases = getTestCases();
+
+ if ( Object == null ) {
+ testcases[0].reason += " Object == null" ;
+ }
+ if ( Function == null ) {
+ testcases[0].reason += " Function == null";
+ }
+ if ( String == null ) {
+ testcases[0].reason += " String == null";
+ }
+ if ( Array == null ) {
+ testcases[0].reason += " Array == null";
+ }
+ if ( Number == null ) {
+ testcases[0].reason += " Function == null";
+ }
+ if ( Math == null ) {
+ testcases[0].reason += " Math == null";
+ }
+ if ( Boolean == null ) {
+ testcases[0].reason += " Boolean == null";
+ }
+ if ( Date == null ) {
+ testcases[0].reason += " Date == null";
+ }
+/*
+ if ( NaN == null ) {
+ testcases[0].reason += " NaN == null";
+ }
+ if ( Infinity == null ) {
+ testcases[0].reason += " Infinity == null";
+ }
+*/
+ if ( eval == null ) {
+ testcases[0].reason += " eval == null";
+ }
+ if ( parseInt == null ) {
+ testcases[0].reason += " parseInt == null";
+ }
+
+ if ( testcases[0].reason != "" ) {
+ testcases[0].actual = "fail";
+ } else {
+ testcases[0].actual = "pass";
+ }
+ testcases[0].expect = "pass";
+
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( "SECTION", "Global Code check" );
+
+ return ( array );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.5-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.5-2.js
new file mode 100644
index 0000000..a09c1ae
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.5-2.js
@@ -0,0 +1,101 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+ /**
+ File Name: 10.1.5-2.js
+ ECMA Section: 10.1.5 Global Object
+ Description:
+ There is a unique global object which is created before control enters
+ any execution context. Initially the global object has the following
+ properties:
+
+ Built-in objects such as Math, String, Date, parseInt, etc. These have
+ attributes { DontEnum }.
+
+ Additional host defined properties. This may include a property whose
+ value is the global object itself, for example window in HTML.
+
+ As control enters execution contexts, and as ECMAScript code is executed,
+ additional properties may be added to the global object and the initial
+ properties may be changed.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "10.5.1-2";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Global Ojbect");
+
+ var testcases = getTestCases();
+
+ var EVAL_STRING = 'if ( Object == null ) { testcases[0].reason += " Object == null" ; }' +
+ 'if ( Function == null ) { testcases[0].reason += " Function == null"; }' +
+ 'if ( String == null ) { testcases[0].reason += " String == null"; }' +
+ 'if ( Array == null ) { testcases[0].reason += " Array == null"; }' +
+ 'if ( Number == null ) { testcases[0].reason += " Function == null";}' +
+ 'if ( Math == null ) { testcases[0].reason += " Math == null"; }' +
+ 'if ( Boolean == null ) { testcases[0].reason += " Boolean == null"; }' +
+ 'if ( Date == null ) { testcases[0].reason += " Date == null"; }' +
+ 'if ( eval == null ) { testcases[0].reason += " eval == null"; }' +
+ 'if ( parseInt == null ) { testcases[0].reason += " parseInt == null"; }' ;
+
+ eval( EVAL_STRING );
+
+/*
+ if ( NaN == null ) {
+ testcases[0].reason += " NaN == null";
+ }
+ if ( Infinity == null ) {
+ testcases[0].reason += " Infinity == null";
+ }
+*/
+
+ if ( testcases[0].reason != "" ) {
+ testcases[0].actual = "fail";
+ } else {
+ testcases[0].actual = "pass";
+ }
+ testcases[0].expect = "pass";
+
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual + " "+
+ testcases[tc].reason );
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( "SECTION", "Eval Code check" );
+
+ return ( array );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.5-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.5-3.js
new file mode 100644
index 0000000..7b0f85f
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.5-3.js
@@ -0,0 +1,119 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 10.1.5-3.js
+ ECMA Section: 10.1.5 Global Object
+ Description:
+ There is a unique global object which is created before control enters
+ any execution context. Initially the global object has the following
+ properties:
+
+ Built-in objects such as Math, String, Date, parseInt, etc. These have
+ attributes { DontEnum }.
+
+ Additional host defined properties. This may include a property whose
+ value is the global object itself, for example window in HTML.
+
+ As control enters execution contexts, and as ECMAScript code is executed,
+ additional properties may be added to the global object and the initial
+ properties may be changed.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "10.5.1-3";
+ var VERSION = "ECMA_1";
+ startTest();
+ writeHeaderToLog( SECTION + " Global Ojbect");
+
+ var testcases = getTestCases();
+
+ test();
+
+function test() {
+ if ( Object == null ) {
+ testcases[0].reason += " Object == null" ;
+ }
+ if ( Function == null ) {
+ testcases[0].reason += " Function == null";
+ }
+ if ( String == null ) {
+ testcases[0].reason += " String == null";
+ }
+ if ( Array == null ) {
+ testcases[0].reason += " Array == null";
+ }
+ if ( Number == null ) {
+ testcases[0].reason += " Function == null";
+ }
+ if ( Math == null ) {
+ testcases[0].reason += " Math == null";
+ }
+ if ( Boolean == null ) {
+ testcases[0].reason += " Boolean == null";
+ }
+ if ( Date == null ) {
+ testcases[0].reason += " Date == null";
+ }
+/*
+ if ( NaN == null ) {
+ testcases[0].reason += " NaN == null";
+ }
+ if ( Infinity == null ) {
+ testcases[0].reason += " Infinity == null";
+ }
+*/
+ if ( eval == null ) {
+ testcases[0].reason += " eval == null";
+ }
+ if ( parseInt == null ) {
+ testcases[0].reason += " parseInt == null";
+ }
+
+ if ( testcases[0].reason != "" ) {
+ testcases[0].actual = "fail";
+ } else {
+ testcases[0].actual = "pass";
+ }
+ testcases[0].expect = "pass";
+
+ for ( tc=0; tc < testcases.length; tc++ ) {
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( "SECTION", "Function Code check" );
+
+ return ( array );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.5-4.js b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.5-4.js
new file mode 100644
index 0000000..2954346
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.5-4.js
@@ -0,0 +1,94 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 10.1.5-4.js
+ ECMA Section: 10.1.5 Global Object
+ Description:
+ There is a unique global object which is created before control enters
+ any execution context. Initially the global object has the following
+ properties:
+
+ Built-in objects such as Math, String, Date, parseInt, etc. These have
+ attributes { DontEnum }.
+
+ Additional host defined properties. This may include a property whose
+ value is the global object itself, for example window in HTML.
+
+ As control enters execution contexts, and as ECMAScript code is executed,
+ additional properties may be added to the global object and the initial
+ properties may be changed.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "10.5.1-4";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Global Ojbect");
+
+ var testcases = getTestCases();
+
+ var EVAL_STRING = 'if ( Object == null ) { testcases[0].reason += " Object == null" ; }' +
+ 'if ( Function == null ) { testcases[0].reason += " Function == null"; }' +
+ 'if ( String == null ) { testcases[0].reason += " String == null"; }' +
+ 'if ( Array == null ) { testcases[0].reason += " Array == null"; }' +
+ 'if ( Number == null ) { testcases[0].reason += " Function == null";}' +
+ 'if ( Math == null ) { testcases[0].reason += " Math == null"; }' +
+ 'if ( Boolean == null ) { testcases[0].reason += " Boolean == null"; }' +
+ 'if ( Date == null ) { testcases[0].reason += " Date == null"; }' +
+ 'if ( eval == null ) { testcases[0].reason += " eval == null"; }' +
+ 'if ( parseInt == null ) { testcases[0].reason += " parseInt == null"; }' ;
+
+ var NEW_FUNCTION = new Function( EVAL_STRING );
+
+ if ( testcases[0].reason != "" ) {
+ testcases[0].actual = "fail";
+ } else {
+ testcases[0].actual = "pass";
+ }
+ testcases[0].expect = "pass";
+
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual + " "+
+ testcases[tc].reason );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( "SECTION", "Anonymous Code check" );
+
+ return ( array );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.6.js b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.6.js
new file mode 100644
index 0000000..8224cb2
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.6.js
@@ -0,0 +1,124 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 10.1.6
+ ECMA Section: Activation Object
+ Description:
+
+ If the function object being invoked has an arguments property, let x be
+ the value of that property; the activation object is also given an internal
+ property [[OldArguments]] whose initial value is x; otherwise, an arguments
+ property is created for the function object but the activation object is
+ not given an [[OldArguments]] property. Next, arguments object described
+ below (the same one stored in the arguments property of the activation
+ object) is used as the new value of the arguments property of the function
+ object. This new value is installed even if the arguments property already
+ exists and has the ReadOnly attribute (as it will for native Function
+ objects). (These actions are taken to provide compatibility with a form of
+ program syntax that is now discouraged: to access the arguments object for
+ function f within the body of f by using the expression f.arguments.
+ The recommended way to access the arguments object for function f within
+ the body of f is simply to refer to the variable arguments.)
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "10.1.6";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Activation Object";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var arguments = "FAILED!";
+
+ var ARG_STRING = "value of the argument property";
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new TestObject(0,1,2,3,4,5)).length",
+ 6,
+ (new TestObject(0,1,2,3,4,5)).length );
+
+ for ( i = 0; i < 6; i++ ) {
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new TestObject(0,1,2,3,4,5))["+i+"]",
+ i,
+ (new TestObject(0,1,2,3,4,5))[i]);
+ }
+
+
+ // The current object already has an arguments property.
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new AnotherTestObject(1,2,3)).arguments",
+ ARG_STRING,
+ (new AnotherTestObject(1,2,3)).arguments );
+
+ // The function invoked with [[Call]]
+
+ testcases[tc++] = new TestCase( SECTION,
+ "TestFunction(1,2,3)",
+ ARG_STRING,
+ TestFunction() + '' );
+
+
+ test();
+
+
+
+function Prototype() {
+ this.arguments = ARG_STRING;
+}
+function TestObject() {
+ this.__proto__ = new Prototype();
+ return arguments;
+}
+function AnotherTestObject() {
+ this.__proto__ = new Prototype();
+ return this;
+}
+function TestFunction() {
+ arguments = ARG_STRING;
+ return arguments;
+}
+function AnotherTestFunction() {
+ this.__proto__ = new Prototype();
+ return this;
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.8-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.8-1.js
new file mode 100644
index 0000000..28b403f
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.8-1.js
@@ -0,0 +1,132 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 10.1.8
+ ECMA Section: Arguments Object
+ Description:
+
+ When control enters an execution context for declared function code,
+ anonymous code, or implementation-supplied code, an arguments object is
+ created and initialized as follows:
+
+ The [[Prototype]] of the arguments object is to the original Object
+ prototype object, the one that is the initial value of Object.prototype
+ (section 15.2.3.1).
+
+ A property is created with name callee and property attributes {DontEnum}.
+ The initial value of this property is the function object being executed.
+ This allows anonymous functions to be recursive.
+
+ A property is created with name length and property attributes {DontEnum}.
+ The initial value of this property is the number of actual parameter values
+ supplied by the caller.
+
+ For each non-negative integer, iarg, less than the value of the length
+ property, a property is created with name ToString(iarg) and property
+ attributes { DontEnum }. The initial value of this property is the value
+ of the corresponding actual parameter supplied by the caller. The first
+ actual parameter value corresponds to iarg = 0, the second to iarg = 1 and
+ so on. In the case when iarg is less than the number of formal parameters
+ for the function object, this property shares its value with the
+ corresponding property of the activation object. This means that changing
+ this property changes the corresponding property of the activation object
+ and vice versa. The value sharing mechanism depends on the implementation.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "10.1.8";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Arguments Object";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var ARG_STRING = "value of the argument property";
+
+ testcases[tc++] = new TestCase( SECTION,
+ "GetCallee()",
+ GetCallee,
+ GetCallee() );
+
+ var LIMIT = 100;
+
+ for ( var i = 0, args = "" ; i < LIMIT; i++ ) {
+ args += String(i) + ( i+1 < LIMIT ? "," : "" );
+
+ }
+
+ var LENGTH = eval( "GetLength("+ args +")" );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "GetLength("+args+")",
+ 100,
+ LENGTH );
+
+ var ARGUMENTS = eval( "GetArguments( " +args+")" );
+
+ for ( var i = 0; i < 100; i++ ) {
+ testcases[tc++] = new TestCase( SECTION,
+ "GetArguments("+args+")["+i+"]",
+ i,
+ ARGUMENTS[i] );
+ }
+
+ test();
+
+function TestFunction() {
+ var arg_proto = arguments.__proto__;
+}
+function GetCallee() {
+ var c = arguments.callee;
+ return c;
+}
+function GetArguments() {
+ var a = arguments;
+ return a;
+}
+function GetLength() {
+ var l = arguments.length;
+ return l;
+}
+
+function AnotherTestFunction() {
+ this.__proto__ = new Prototype();
+ return this;
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.8-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.8-2.js
new file mode 100644
index 0000000..b4ff578
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.1.8-2.js
@@ -0,0 +1,117 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 10.1.8-2
+ ECMA Section: Arguments Object
+ Description:
+
+ When control enters an execution context for declared function code,
+ anonymous code, or implementation-supplied code, an arguments object is
+ created and initialized as follows:
+
+ The [[Prototype]] of the arguments object is to the original Object
+ prototype object, the one that is the initial value of Object.prototype
+ (section 15.2.3.1).
+
+ A property is created with name callee and property attributes {DontEnum}.
+ The initial value of this property is the function object being executed.
+ This allows anonymous functions to be recursive.
+
+ A property is created with name length and property attributes {DontEnum}.
+ The initial value of this property is the number of actual parameter values
+ supplied by the caller.
+
+ For each non-negative integer, iarg, less than the value of the length
+ property, a property is created with name ToString(iarg) and property
+ attributes { DontEnum }. The initial value of this property is the value
+ of the corresponding actual parameter supplied by the caller. The first
+ actual parameter value corresponds to iarg = 0, the second to iarg = 1 and
+ so on. In the case when iarg is less than the number of formal parameters
+ for the function object, this property shares its value with the
+ corresponding property of the activation object. This means that changing
+ this property changes the corresponding property of the activation object
+ and vice versa. The value sharing mechanism depends on the implementation.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "10.1.8-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Arguments Object";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+// Tests for anonymous functions
+
+ var GetCallee = new Function( "var c = arguments.callee; return c" );
+ var GetArguments = new Function( "var a = arguments; return a" );
+ var GetLength = new Function( "var l = arguments.length; return l" );
+
+ var ARG_STRING = "value of the argument property";
+
+ testcases[tc++] = new TestCase( SECTION,
+ "GetCallee()",
+ GetCallee,
+ GetCallee() );
+
+ var LIMIT = 100;
+
+ for ( var i = 0, args = "" ; i < LIMIT; i++ ) {
+ args += String(i) + ( i+1 < LIMIT ? "," : "" );
+
+ }
+
+ var LENGTH = eval( "GetLength("+ args +")" );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "GetLength("+args+")",
+ 100,
+ LENGTH );
+
+ var ARGUMENTS = eval( "GetArguments( " +args+")" );
+
+ for ( var i = 0; i < 100; i++ ) {
+ testcases[tc++] = new TestCase( SECTION,
+ "GetArguments("+args+")["+i+"]",
+ i,
+ ARGUMENTS[i] );
+ }
+
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.2.1.js b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.2.1.js
new file mode 100644
index 0000000..5e5737b
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.2.1.js
@@ -0,0 +1,82 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 10.2.1.js
+ ECMA Section: 10.2.1 Global Code
+ Description:
+
+ The scope chain is created and initialized to contain the global object and
+ no others.
+
+ Variable instantiation is performed using the global object as the variable
+ object and using empty property attributes.
+
+ The this value is the global object.
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "10.2.1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Global Code";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var THIS = this;
+
+ testcases[tc++] = new TestCase( SECTION,
+ "this +''",
+ GLOBAL,
+ THIS + "" );
+
+ var GLOBAL_PROPERTIES = new Array();
+ var i = 0;
+
+ for ( p in this ) {
+ GLOBAL_PROPERTIES[i++] = p;
+ }
+
+ for ( i = 0; i < GLOBAL_PROPERTIES.length; i++ ) {
+ testcases[tc++] = new TestCase( SECTION,
+ GLOBAL_PROPERTIES[i] +" == void 0",
+ false,
+ eval("GLOBAL_PROPERTIES["+i+"] == void 0"));
+ }
+
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.2.2-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.2.2-1.js
new file mode 100644
index 0000000..db03ad6
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.2.2-1.js
@@ -0,0 +1,119 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 10.2.2-1.js
+ ECMA Section: 10.2.2 Eval Code
+ Description:
+
+ When control enters an execution context for eval code, the previous
+ active execution context, referred to as the calling context, is used to
+ determine the scope chain, the variable object, and the this value. If
+ there is no calling context, then initializing the scope chain, variable
+ instantiation, and determination of the this value are performed just as
+ for global code.
+
+ The scope chain is initialized to contain the same objects, in the same
+ order, as the calling context's scope chain. This includes objects added
+ to the calling context's scope chain by WithStatement.
+
+ Variable instantiation is performed using the calling context's variable
+ object and using empty property attributes.
+
+ The this value is the same as the this value of the calling context.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "10.2.2-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Eval Code";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var THIS = eval("this");
+
+ testcases[tc++] = new TestCase( SECTION,
+ "this +''",
+ GLOBAL,
+ THIS + "" );
+
+ var GLOBAL_PROPERTIES = new Array();
+ var i = 0;
+
+ for ( p in THIS ) {
+ GLOBAL_PROPERTIES[i++] = p;
+ }
+
+ for ( i = 0; i < GLOBAL_PROPERTIES.length; i++ ) {
+ testcases[tc++] = new TestCase( SECTION,
+ GLOBAL_PROPERTIES[i] +" == THIS["+GLOBAL_PROPERTIES[i]+"]",
+ true,
+ eval(GLOBAL_PROPERTIES[i]) == eval( "THIS[GLOBAL_PROPERTIES[i]]") );
+ }
+
+ // this in eval statements is the same as this value of the calling context
+
+ var RESULT = THIS == this;
+
+ testcases[tc++] = new TestCase( SECTION,
+ "eval( 'this == THIS' )",
+ true,
+ RESULT );
+
+ var RESULT = THIS +'';
+
+ testcases[tc++] = new TestCase( SECTION,
+ "eval( 'this + \"\"' )",
+ GLOBAL,
+ RESULT );
+
+
+ testcases[tc++] = new TestCase( SECTION,
+ "eval( 'this == THIS' )",
+ true,
+ eval( "this == THIS" ) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "eval( 'this + \"\"' )",
+ GLOBAL,
+ eval( "this +''") );
+
+
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.2.2-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.2.2-2.js
new file mode 100644
index 0000000..c73feff
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.2.2-2.js
@@ -0,0 +1,105 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 10.2.2-2.js
+ ECMA Section: 10.2.2 Eval Code
+ Description:
+
+ When control enters an execution context for eval code, the previous
+ active execution context, referred to as the calling context, is used to
+ determine the scope chain, the variable object, and the this value. If
+ there is no calling context, then initializing the scope chain, variable
+ instantiation, and determination of the this value are performed just as
+ for global code.
+
+ The scope chain is initialized to contain the same objects, in the same
+ order, as the calling context's scope chain. This includes objects added
+ to the calling context's scope chain by WithStatement.
+
+ Variable instantiation is performed using the calling context's variable
+ object and using empty property attributes.
+
+ The this value is the same as the this value of the calling context.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "10.2.2-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Eval Code";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ // Test Objects
+
+ var OBJECT = new MyObject( "hello" );
+ var GLOBAL_PROPERTIES = new Array();
+ var i = 0;
+
+ for ( p in this ) {
+ GLOBAL_PROPERTIES[i++] = p;
+ }
+
+ with ( OBJECT ) {
+ var THIS = this;
+ testcases[tc++] = new TestCase( SECTION, "eval( 'this == THIS' )", true, eval("this == THIS") );
+ testcases[tc++] = new TestCase( SECTION, "this in a with() block", GLOBAL, this+"" );
+ testcases[tc++] = new TestCase( SECTION, "new MyObject('hello').value", "hello", value );
+ testcases[tc++] = new TestCase( SECTION, "eval(new MyObject('hello').value)", "hello", eval("value") );
+ testcases[tc++] = new TestCase( SECTION, "new MyObject('hello').getClass()", "[object Object]", getClass() );
+ testcases[tc++] = new TestCase( SECTION, "eval(new MyObject('hello').getClass())", "[object Object]", eval("getClass()") );
+ testcases[tc++] = new TestCase( SECTION, "eval(new MyObject('hello').toString())", "hello", eval("toString()") );
+ testcases[tc++] = new TestCase( SECTION, "eval('getClass') == Object.prototype.toString", true, eval("getClass") == Object.prototype.toString );
+
+ for ( i = 0; i < GLOBAL_PROPERTIES.length; i++ ) {
+ testcases[tc++] = new TestCase( SECTION, GLOBAL_PROPERTIES[i] +
+ " == THIS["+GLOBAL_PROPERTIES[i]+"]", true,
+ eval(GLOBAL_PROPERTIES[i]) == eval( "THIS[GLOBAL_PROPERTIES[i]]") );
+ }
+
+ }
+
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function MyObject( value ) {
+ this.value = value;
+ this.getClass = Object.prototype.toString;
+ this.toString = new Function( "return this.value+''" );
+ return this;
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.2.3-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.2.3-1.js
new file mode 100644
index 0000000..be1a00f
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.2.3-1.js
@@ -0,0 +1,83 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 10.2.3-1.js
+ ECMA Section: 10.2.3 Function and Anonymous Code
+ Description:
+
+ The scope chain is initialized to contain the activation object followed
+ by the global object. Variable instantiation is performed using the
+ activation by the global object. Variable instantiation is performed using
+ the activation object as the variable object and using property attributes
+ { DontDelete }. The caller provides the this value. If the this value
+ provided by the caller is not an object (including the case where it is
+ null), then the this value is the global object.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "10.2.3-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Eval Code";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var o = new MyObject("hello")
+
+ testcases[tc++] = new TestCase( SECTION,
+ "var o = new MyObject('hello'); o.THIS == x",
+ true,
+ o.THIS == o );
+
+ var o = MyFunction();
+
+ testcases[tc++] = new TestCase( SECTION,
+ "var o = MyFunction(); o == this",
+ true,
+ o == this );
+
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
+function MyFunction( value ) {
+ return this;
+}
+function MyObject( value ) {
+ this.THIS = this;
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.2.3-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.2.3-2.js
new file mode 100644
index 0000000..084d72f
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/ExecutionContexts/10.2.3-2.js
@@ -0,0 +1,89 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 10.2.3-2.js
+ ECMA Section: 10.2.3 Function and Anonymous Code
+ Description:
+
+ The scope chain is initialized to contain the activation object followed
+ by the global object. Variable instantiation is performed using the
+ activation by the global object. Variable instantiation is performed using
+ the activation object as the variable object and using property attributes
+ { DontDelete }. The caller provides the this value. If the this value
+ provided by the caller is not an object (including the case where it is
+ null), then the this value is the global object.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "10.2.3-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Function and Anonymous Code";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var o = new MyObject("hello")
+
+ testcases[tc++] = new TestCase( SECTION,
+ "MyFunction(\"PASSED!\")",
+ "PASSED!",
+ MyFunction("PASSED!") );
+
+ var o = MyFunction();
+
+ testcases[tc++] = new TestCase( SECTION,
+ "MyOtherFunction(true);",
+ false,
+ MyOtherFunction(true) );
+
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
+function MyFunction( value ) {
+ var x = value;
+ delete x;
+ return x;
+}
+function MyOtherFunction(value) {
+ var x = value;
+ return delete x;
+}
+function MyObject( value ) {
+ this.THIS = this;
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.1.1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.1.1.js
new file mode 100644
index 0000000..5801961
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.1.1.js
@@ -0,0 +1,135 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 11.1.1.js
+ ECMA Section: 11.1.1 The this keyword
+ Description:
+
+ The this keyword evaluates to the this value of the execution context.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "11.1.1";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " The this keyword");
+
+ var testcases = new Array();
+ var item = 0;
+
+ var GLOBAL_OBJECT = this.toString();
+
+ // this in global code and eval(this) in global code should return the global object.
+
+ testcases[item++] = new TestCase( SECTION,
+ "Global Code: this.toString()",
+ GLOBAL_OBJECT,
+ this.toString() );
+
+ testcases[item++] = new TestCase( SECTION,
+ "Global Code: eval('this.toString()')",
+ GLOBAL_OBJECT,
+ eval('this.toString()') );
+
+ // this in anonymous code called as a function should return the global object.
+
+ testcases[item++] = new TestCase( SECTION,
+ "Anonymous Code: var MYFUNC = new Function('return this.toString()'); MYFUNC()",
+ GLOBAL_OBJECT,
+ eval("var MYFUNC = new Function('return this.toString()'); MYFUNC()") );
+
+ // eval( this ) in anonymous code called as a function should return that function's activation object
+
+ testcases[item++] = new TestCase( SECTION,
+ "Anonymous Code: var MYFUNC = new Function('return (eval(\"this.toString()\")'); (MYFUNC()).toString()",
+ GLOBAL_OBJECT,
+ eval("var MYFUNC = new Function('return eval(\"this.toString()\")'); (MYFUNC()).toString()") );
+
+ // this and eval( this ) in anonymous code called as a constructor should return the object
+
+ testcases[item++] = new TestCase( SECTION,
+ "Anonymous Code: var MYFUNC = new Function('this.THIS = this'); ((new MYFUNC()).THIS).toString()",
+ "[object Object]",
+ eval("var MYFUNC = new Function('this.THIS = this'); ((new MYFUNC()).THIS).toString()") );
+
+ testcases[item++] = new TestCase( SECTION,
+ "Anonymous Code: var MYFUNC = new Function('this.THIS = this'); var FUN1 = new MYFUNC(); FUN1.THIS == FUN1",
+ true,
+ eval("var MYFUNC = new Function('this.THIS = this'); var FUN1 = new MYFUNC(); FUN1.THIS == FUN1") );
+
+ testcases[item++] = new TestCase( SECTION,
+ "Anonymous Code: var MYFUNC = new Function('this.THIS = eval(\"this\")'); ((new MYFUNC().THIS).toString()",
+ "[object Object]",
+ eval("var MYFUNC = new Function('this.THIS = eval(\"this\")'); ((new MYFUNC()).THIS).toString()") );
+
+ testcases[item++] = new TestCase( SECTION,
+ "Anonymous Code: var MYFUNC = new Function('this.THIS = eval(\"this\")'); var FUN1 = new MYFUNC(); FUN1.THIS == FUN1",
+ true,
+ eval("var MYFUNC = new Function('this.THIS = eval(\"this\")'); var FUN1 = new MYFUNC(); FUN1.THIS == FUN1") );
+
+ // this and eval(this) in function code called as a function should return the global object.
+ testcases[item++] = new TestCase( SECTION,
+ "Function Code: ReturnThis()",
+ GLOBAL_OBJECT,
+ ReturnThis() );
+
+ testcases[item++] = new TestCase( SECTION,
+ "Function Code: ReturnEvalThis()",
+ GLOBAL_OBJECT,
+ ReturnEvalThis() );
+
+ // this and eval(this) in function code called as a contructor should return the object.
+ testcases[item++] = new TestCase( SECTION,
+ "var MYOBJECT = new ReturnThis(); MYOBJECT.toString()",
+ "[object Object]",
+ eval("var MYOBJECT = new ReturnThis(); MYOBJECT.toString()") );
+
+ testcases[item++] = new TestCase( SECTION,
+ "var MYOBJECT = new ReturnEvalThis(); MYOBJECT.toString()",
+ "[object Object]",
+ eval("var MYOBJECT = new ReturnEvalThis(); MYOBJECT.toString()") );
+
+
+
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function ReturnThis() {
+ return this.toString();
+}
+function ReturnEvalThis() {
+ return( eval("this.toString()") );
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.10-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.10-1.js
new file mode 100644
index 0000000..c5f6911
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.10-1.js
@@ -0,0 +1,270 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 11.10-1.js
+ ECMA Section: 11.10-1 Binary Bitwise Operators: &
+ Description:
+ Semantics
+
+ The production A : A @ B, where @ is one of the bitwise operators in the
+ productions &, ^, | , is evaluated as follows:
+
+ 1. Evaluate A.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate B.
+ 4. Call GetValue(Result(3)).
+ 5. Call ToInt32(Result(2)).
+ 6. Call ToInt32(Result(4)).
+ 7. Apply the bitwise operator @ to Result(5) and Result(6). The result is
+ a signed 32 bit integer.
+ 8. Return Result(7).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "11.10-1";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ var testcases = getTestCases();
+
+ writeHeaderToLog( SECTION + " Binary Bitwise Operators: &");
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ var shiftexp = 0;
+ var addexp = 0;
+
+// for ( shiftpow = 0; shiftpow < 33; shiftpow++ ) {
+ for ( shiftpow = 0; shiftpow < 1; shiftpow++ ) {
+ shiftexp += Math.pow( 2, shiftpow );
+
+ for ( addpow = 0; addpow < 33; addpow++ ) {
+ addexp += Math.pow(2, addpow);
+
+ array[item++] = new TestCase( SECTION,
+ shiftexp + " & " + addexp,
+ And( shiftexp, addexp ),
+ shiftexp & addexp );
+ }
+ }
+
+ return ( array );
+}
+function ToInteger( n ) {
+ n = Number( n );
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ if ( n != n ) {
+ return 0;
+ }
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY ) {
+ return n;
+ }
+ return ( sign * Math.floor(Math.abs(n)) );
+}
+function ToInt32( n ) {
+ n = Number( n );
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
+ return 0;
+ }
+
+ n = (sign * Math.floor( Math.abs(n) )) % Math.pow(2,32);
+ n = ( n >= Math.pow(2,31) ) ? n - Math.pow(2,32) : n;
+
+ return ( n );
+}
+function ToUint32( n ) {
+ n = Number( n );
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
+ return 0;
+ }
+ n = sign * Math.floor( Math.abs(n) )
+
+ n = n % Math.pow(2,32);
+
+ if ( n < 0 ){
+ n += Math.pow(2,32);
+ }
+
+ return ( n );
+}
+function ToUint16( n ) {
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
+ return 0;
+ }
+
+ n = ( sign * Math.floor( Math.abs(n) ) ) % Math.pow(2,16);
+
+ if (n <0) {
+ n += Math.pow(2,16);
+ }
+
+ return ( n );
+}
+function Mask( b, n ) {
+ b = ToUint32BitString( b );
+ b = b.substring( b.length - n );
+ b = ToUint32Decimal( b );
+ return ( b );
+}
+function ToUint32BitString( n ) {
+ var b = "";
+ for ( p = 31; p >=0; p-- ) {
+ if ( n >= Math.pow(2,p) ) {
+ b += "1";
+ n -= Math.pow(2,p);
+ } else {
+ b += "0";
+ }
+ }
+ return b;
+}
+function ToInt32BitString( n ) {
+ var b = "";
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ b += ( sign == 1 ) ? "0" : "1";
+
+ for ( p = 30; p >=0; p-- ) {
+ if ( (sign == 1 ) ? sign * n >= Math.pow(2,p) : sign * n > Math.pow(2,p) ) {
+ b += ( sign == 1 ) ? "1" : "0";
+ n -= sign * Math.pow( 2, p );
+ } else {
+ b += ( sign == 1 ) ? "0" : "1";
+ }
+ }
+
+ return b;
+}
+function ToInt32Decimal( bin ) {
+ var r = 0;
+ var sign;
+
+ if ( Number(bin.charAt(0)) == 0 ) {
+ sign = 1;
+ r = 0;
+ } else {
+ sign = -1;
+ r = -(Math.pow(2,31));
+ }
+
+ for ( var j = 0; j < 31; j++ ) {
+ r += Math.pow( 2, j ) * Number(bin.charAt(31-j));
+ }
+
+ return r;
+}
+function ToUint32Decimal( bin ) {
+ var r = 0;
+
+
+ for ( l = bin.length; l < 32; l++ ) {
+ bin = "0" + bin;
+ }
+
+ for ( j = 0; j < 31; j++ ) {
+ r += Math.pow( 2, j ) * Number(bin.charAt(31-j));
+
+ }
+
+ return r;
+}
+function And( s, a ) {
+ s = ToInt32( s );
+ a = ToInt32( a );
+
+ var bs = ToInt32BitString( s );
+ var ba = ToInt32BitString( a );
+
+ var result = "";
+
+ for ( var bit = 0; bit < bs.length; bit++ ) {
+ if ( bs.charAt(bit) == "1" && ba.charAt(bit) == "1" ) {
+ result += "1";
+ } else {
+ result += "0";
+ }
+ }
+ return ToInt32Decimal(result);
+}
+function Xor( s, a ) {
+ s = ToInt32( s );
+ a = ToInt32( a );
+
+ var bs = ToInt32BitString( s );
+ var ba = ToInt32BitString( a );
+
+ var result = "";
+
+ for ( var bit = 0; bit < bs.length; bit++ ) {
+ if ( (bs.charAt(bit) == "1" && ba.charAt(bit) == "0") ||
+ (bs.charAt(bit) == "0" && ba.charAt(bit) == "1")
+ ) {
+ result += "1";
+ } else {
+ result += "0";
+ }
+ }
+
+ return ToInt32Decimal(result);
+}
+function Or( s, a ) {
+ s = ToInt32( s );
+ a = ToInt32( a );
+
+ var bs = ToInt32BitString( s );
+ var ba = ToInt32BitString( a );
+
+ var result = "";
+
+ for ( var bit = 0; bit < bs.length; bit++ ) {
+ if ( bs.charAt(bit) == "1" || ba.charAt(bit) == "1" ) {
+ result += "1";
+ } else {
+ result += "0";
+ }
+ }
+
+ return ToInt32Decimal(result);
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.10-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.10-2.js
new file mode 100644
index 0000000..fc2e10e
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.10-2.js
@@ -0,0 +1,269 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 11.10-2.js
+ ECMA Section: 11.10-2 Binary Bitwise Operators: |
+ Description:
+ Semantics
+
+ The production A : A @ B, where @ is one of the bitwise operators in the
+ productions &, ^, | , is evaluated as follows:
+
+ 1. Evaluate A.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate B.
+ 4. Call GetValue(Result(3)).
+ 5. Call ToInt32(Result(2)).
+ 6. Call ToInt32(Result(4)).
+ 7. Apply the bitwise operator @ to Result(5) and Result(6). The result is
+ a signed 32 bit integer.
+ 8. Return Result(7).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "11.10-2";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ var testcases = getTestCases();
+
+ writeHeaderToLog( SECTION + " Binary Bitwise Operators: |");
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ var shiftexp = 0;
+ var addexp = 0;
+
+ for ( shiftpow = 0; shiftpow < 33; shiftpow++ ) {
+ shiftexp += Math.pow( 2, shiftpow );
+
+ for ( addpow = 0; addpow < 33; addpow++ ) {
+ addexp += Math.pow(2, addpow);
+
+ array[item++] = new TestCase( SECTION,
+ shiftexp + " | " + addexp,
+ Or( shiftexp, addexp ),
+ shiftexp | addexp );
+ }
+ }
+
+ return ( array );
+}
+function ToInteger( n ) {
+ n = Number( n );
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ if ( n != n ) {
+ return 0;
+ }
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY ) {
+ return n;
+ }
+ return ( sign * Math.floor(Math.abs(n)) );
+}
+function ToInt32( n ) {
+ n = Number( n );
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
+ return 0;
+ }
+
+ n = (sign * Math.floor( Math.abs(n) )) % Math.pow(2,32);
+ n = ( n >= Math.pow(2,31) ) ? n - Math.pow(2,32) : n;
+
+ return ( n );
+}
+function ToUint32( n ) {
+ n = Number( n );
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
+ return 0;
+ }
+ n = sign * Math.floor( Math.abs(n) )
+
+ n = n % Math.pow(2,32);
+
+ if ( n < 0 ){
+ n += Math.pow(2,32);
+ }
+
+ return ( n );
+}
+function ToUint16( n ) {
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
+ return 0;
+ }
+
+ n = ( sign * Math.floor( Math.abs(n) ) ) % Math.pow(2,16);
+
+ if (n <0) {
+ n += Math.pow(2,16);
+ }
+
+ return ( n );
+}
+function Mask( b, n ) {
+ b = ToUint32BitString( b );
+ b = b.substring( b.length - n );
+ b = ToUint32Decimal( b );
+ return ( b );
+}
+function ToUint32BitString( n ) {
+ var b = "";
+ for ( p = 31; p >=0; p-- ) {
+ if ( n >= Math.pow(2,p) ) {
+ b += "1";
+ n -= Math.pow(2,p);
+ } else {
+ b += "0";
+ }
+ }
+ return b;
+}
+function ToInt32BitString( n ) {
+ var b = "";
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ b += ( sign == 1 ) ? "0" : "1";
+
+ for ( p = 30; p >=0; p-- ) {
+ if ( (sign == 1 ) ? sign * n >= Math.pow(2,p) : sign * n > Math.pow(2,p) ) {
+ b += ( sign == 1 ) ? "1" : "0";
+ n -= sign * Math.pow( 2, p );
+ } else {
+ b += ( sign == 1 ) ? "0" : "1";
+ }
+ }
+
+ return b;
+}
+function ToInt32Decimal( bin ) {
+ var r = 0;
+ var sign;
+
+ if ( Number(bin.charAt(0)) == 0 ) {
+ sign = 1;
+ r = 0;
+ } else {
+ sign = -1;
+ r = -(Math.pow(2,31));
+ }
+
+ for ( var j = 0; j < 31; j++ ) {
+ r += Math.pow( 2, j ) * Number(bin.charAt(31-j));
+ }
+
+ return r;
+}
+function ToUint32Decimal( bin ) {
+ var r = 0;
+
+
+ for ( l = bin.length; l < 32; l++ ) {
+ bin = "0" + bin;
+ }
+
+ for ( j = 0; j < 31; j++ ) {
+ r += Math.pow( 2, j ) * Number(bin.charAt(31-j));
+
+ }
+
+ return r;
+}
+function And( s, a ) {
+ s = ToInt32( s );
+ a = ToInt32( a );
+
+ var bs = ToInt32BitString( s );
+ var ba = ToInt32BitString( a );
+
+ var result = "";
+
+ for ( var bit = 0; bit < bs.length; bit++ ) {
+ if ( bs.charAt(bit) == "1" && ba.charAt(bit) == "1" ) {
+ result += "1";
+ } else {
+ result += "0";
+ }
+ }
+ return ToInt32Decimal(result);
+}
+function Xor( s, a ) {
+ s = ToInt32( s );
+ a = ToInt32( a );
+
+ var bs = ToInt32BitString( s );
+ var ba = ToInt32BitString( a );
+
+ var result = "";
+
+ for ( var bit = 0; bit < bs.length; bit++ ) {
+ if ( (bs.charAt(bit) == "1" && ba.charAt(bit) == "0") ||
+ (bs.charAt(bit) == "0" && ba.charAt(bit) == "1")
+ ) {
+ result += "1";
+ } else {
+ result += "0";
+ }
+ }
+
+ return ToInt32Decimal(result);
+}
+function Or( s, a ) {
+ s = ToInt32( s );
+ a = ToInt32( a );
+
+ var bs = ToInt32BitString( s );
+ var ba = ToInt32BitString( a );
+
+ var result = "";
+
+ for ( var bit = 0; bit < bs.length; bit++ ) {
+ if ( bs.charAt(bit) == "1" || ba.charAt(bit) == "1" ) {
+ result += "1";
+ } else {
+ result += "0";
+ }
+ }
+
+ return ToInt32Decimal(result);
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.10-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.10-3.js
new file mode 100644
index 0000000..0d55357
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.10-3.js
@@ -0,0 +1,268 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 11.10-3.js
+ ECMA Section: 11.10-3 Binary Bitwise Operators: ^
+ Description:
+ Semantics
+
+ The production A : A @ B, where @ is one of the bitwise operators in the
+ productions &, ^, | , is evaluated as follows:
+
+ 1. Evaluate A.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate B.
+ 4. Call GetValue(Result(3)).
+ 5. Call ToInt32(Result(2)).
+ 6. Call ToInt32(Result(4)).
+ 7. Apply the bitwise operator @ to Result(5) and Result(6). The result is
+ a signed 32 bit integer.
+ 8. Return Result(7).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "11.10-3";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ var testcases = getTestCases();
+
+ writeHeaderToLog( SECTION + " Binary Bitwise Operators: ^");
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ var shiftexp = 0;
+ var addexp = 0;
+
+ for ( shiftpow = 0; shiftpow < 33; shiftpow++ ) {
+ shiftexp += Math.pow( 2, shiftpow );
+
+ for ( addpow = 0; addpow < 33; addpow++ ) {
+ addexp += Math.pow(2, addpow);
+
+ array[item++] = new TestCase( SECTION,
+ shiftexp + " ^ " + addexp,
+ Xor( shiftexp, addexp ),
+ shiftexp ^ addexp );
+ }
+ }
+
+ return ( array );
+}
+function ToInteger( n ) {
+ n = Number( n );
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ if ( n != n ) {
+ return 0;
+ }
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY ) {
+ return n;
+ }
+ return ( sign * Math.floor(Math.abs(n)) );
+}
+function ToInt32( n ) {
+ n = Number( n );
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
+ return 0;
+ }
+
+ n = (sign * Math.floor( Math.abs(n) )) % Math.pow(2,32);
+ n = ( n >= Math.pow(2,31) ) ? n - Math.pow(2,32) : n;
+
+ return ( n );
+}
+function ToUint32( n ) {
+ n = Number( n );
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
+ return 0;
+ }
+ n = sign * Math.floor( Math.abs(n) )
+
+ n = n % Math.pow(2,32);
+
+ if ( n < 0 ){
+ n += Math.pow(2,32);
+ }
+
+ return ( n );
+}
+function ToUint16( n ) {
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
+ return 0;
+ }
+
+ n = ( sign * Math.floor( Math.abs(n) ) ) % Math.pow(2,16);
+
+ if (n <0) {
+ n += Math.pow(2,16);
+ }
+
+ return ( n );
+}
+function Mask( b, n ) {
+ b = ToUint32BitString( b );
+ b = b.substring( b.length - n );
+ b = ToUint32Decimal( b );
+ return ( b );
+}
+function ToUint32BitString( n ) {
+ var b = "";
+ for ( p = 31; p >=0; p-- ) {
+ if ( n >= Math.pow(2,p) ) {
+ b += "1";
+ n -= Math.pow(2,p);
+ } else {
+ b += "0";
+ }
+ }
+ return b;
+}
+function ToInt32BitString( n ) {
+ var b = "";
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ b += ( sign == 1 ) ? "0" : "1";
+
+ for ( p = 30; p >=0; p-- ) {
+ if ( (sign == 1 ) ? sign * n >= Math.pow(2,p) : sign * n > Math.pow(2,p) ) {
+ b += ( sign == 1 ) ? "1" : "0";
+ n -= sign * Math.pow( 2, p );
+ } else {
+ b += ( sign == 1 ) ? "0" : "1";
+ }
+ }
+
+ return b;
+}
+function ToInt32Decimal( bin ) {
+ var r = 0;
+ var sign;
+
+ if ( Number(bin.charAt(0)) == 0 ) {
+ sign = 1;
+ r = 0;
+ } else {
+ sign = -1;
+ r = -(Math.pow(2,31));
+ }
+
+ for ( var j = 0; j < 31; j++ ) {
+ r += Math.pow( 2, j ) * Number(bin.charAt(31-j));
+ }
+
+ return r;
+}
+function ToUint32Decimal( bin ) {
+ var r = 0;
+
+ for ( l = bin.length; l < 32; l++ ) {
+ bin = "0" + bin;
+ }
+
+ for ( j = 0; j < 31; j++ ) {
+ r += Math.pow( 2, j ) * Number(bin.charAt(31-j));
+
+ }
+
+ return r;
+}
+function And( s, a ) {
+ s = ToInt32( s );
+ a = ToInt32( a );
+
+ var bs = ToInt32BitString( s );
+ var ba = ToInt32BitString( a );
+
+ var result = "";
+
+ for ( var bit = 0; bit < bs.length; bit++ ) {
+ if ( bs.charAt(bit) == "1" && ba.charAt(bit) == "1" ) {
+ result += "1";
+ } else {
+ result += "0";
+ }
+ }
+ return ToInt32Decimal(result);
+}
+function Xor( s, a ) {
+ s = ToInt32( s );
+ a = ToInt32( a );
+
+ var bs = ToInt32BitString( s );
+ var ba = ToInt32BitString( a );
+
+ var result = "";
+
+ for ( var bit = 0; bit < bs.length; bit++ ) {
+ if ( (bs.charAt(bit) == "1" && ba.charAt(bit) == "0") ||
+ (bs.charAt(bit) == "0" && ba.charAt(bit) == "1")
+ ) {
+ result += "1";
+ } else {
+ result += "0";
+ }
+ }
+
+ return ToInt32Decimal(result);
+}
+function Or( s, a ) {
+ s = ToInt32( s );
+ a = ToInt32( a );
+
+ var bs = ToInt32BitString( s );
+ var ba = ToInt32BitString( a );
+
+ var result = "";
+
+ for ( var bit = 0; bit < bs.length; bit++ ) {
+ if ( bs.charAt(bit) == "1" || ba.charAt(bit) == "1" ) {
+ result += "1";
+ } else {
+ result += "0";
+ }
+ }
+
+ return ToInt32Decimal(result);
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.12-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.12-1.js
new file mode 100644
index 0000000..ae0a263
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.12-1.js
@@ -0,0 +1,86 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 11.12.js
+ ECMA Section: 11.12 Conditional Operator
+ Description:
+ Logi
+
+ calORExpression ? AssignmentExpression : AssignmentExpression
+
+ Semantics
+
+ The production ConditionalExpression :
+ LogicalORExpression ? AssignmentExpression : AssignmentExpression
+ is evaluated as follows:
+
+ 1. Evaluate LogicalORExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Call ToBoolean(Result(2)).
+ 4. If Result(3) is false, go to step 8.
+ 5. Evaluate the first AssignmentExpression.
+ 6. Call GetValue(Result(5)).
+ 7. Return Result(6).
+ 8. Evaluate the second AssignmentExpression.
+ 9. Call GetValue(Result(8)).
+ 10. Return Result(9).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "11.12";
+ var VERSION = "ECMA_1";
+ startTest();
+ var testcases = getTestCases();
+
+ writeHeaderToLog( SECTION + " Conditional operator( ? : )");
+ test();
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "true ? 'PASSED' : 'FAILED'", "PASSED", (true?"PASSED":"FAILED"));
+ array[item++] = new TestCase( SECTION, "false ? 'FAILED' : 'PASSED'", "PASSED", (false?"FAILED":"PASSED"));
+
+ array[item++] = new TestCase( SECTION, "1 ? 'PASSED' : 'FAILED'", "PASSED", (true?"PASSED":"FAILED"));
+ array[item++] = new TestCase( SECTION, "0 ? 'FAILED' : 'PASSED'", "PASSED", (false?"FAILED":"PASSED"));
+ array[item++] = new TestCase( SECTION, "-1 ? 'PASSED' : 'FAILED'", "PASSED", (true?"PASSED":"FAILED"));
+
+ array[item++] = new TestCase( SECTION, "NaN ? 'FAILED' : 'PASSED'", "PASSED", (Number.NaN?"FAILED":"PASSED"));
+
+ array[item++] = new TestCase( SECTION, "var VAR = true ? , : 'FAILED'", "PASSED", (VAR = true ? "PASSED" : "FAILED") );
+
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.12-2-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.12-2-n.js
new file mode 100644
index 0000000..05e42dc
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.12-2-n.js
@@ -0,0 +1,71 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 11.12-2-n.js
+ ECMA Section: 11.12
+ Description:
+
+ The grammar for a ConditionalExpression in ECMAScript is a little bit
+ different from that in C and Java, which each allow the second
+ subexpression to be an Expression but restrict the third expression to
+ be a ConditionalExpression. The motivation for this difference in
+ ECMAScript is to allow an assignment expression to be governed by either
+ arm of a conditional and to eliminate the confusing and fairly useless
+ case of a comma expression as the center expression.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "11.12-2-n";
+ var VERSION = "ECMA_1";
+ startTest();
+ writeHeaderToLog( SECTION + " Conditional operator ( ? : )");
+
+ var testcases = new Array();
+
+ // the following expression should be an error in JS.
+
+ testcases[tc] = new TestCase( SECTION,
+ "var MYVAR = true ? 'EXPR1', 'EXPR2' : 'EXPR3'; MYVAR",
+ "error",
+ "var MYVAR = true ? 'EXPR1', 'EXPR2' : 'EXPR3'; MYVAR" );
+
+ // get around parse time error by putting expression in an eval statement
+
+ testcases[tc].actual = eval ( testcases[tc].actual );
+
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.12-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.12-3.js
new file mode 100644
index 0000000..eb79c16
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.12-3.js
@@ -0,0 +1,71 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 11.12-3.js
+ ECMA Section: 11.12
+ Description:
+
+ The grammar for a ConditionalExpression in ECMAScript is a little bit
+ different from that in C and Java, which each allow the second
+ subexpression to be an Expression but restrict the third expression to
+ be a ConditionalExpression. The motivation for this difference in
+ ECMAScript is to allow an assignment expression to be governed by either
+ arm of a conditional and to eliminate the confusing and fairly useless
+ case of a comma expression as the center expression.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "11.12-3";
+ var VERSION = "ECMA_1";
+ startTest();
+ writeHeaderToLog( SECTION + " Conditional operator ( ? : )");
+
+ var testcases = new Array();
+
+ // the following expression should NOT be an error in JS.
+
+ testcases[tc] = new TestCase( SECTION,
+ "var MYVAR = true ? ('FAIL1', 'PASSED') : 'FAIL2'; MYVAR",
+ "PASSED",
+ "var MYVAR = true ? ('FAIL1', 'PASSED') : 'FAIL2'; MYVAR" );
+
+ // get around potential parse time error by putting expression in an eval statement
+
+ testcases[tc].actual = eval ( testcases[tc].actual );
+
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.12-4.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.12-4.js
new file mode 100644
index 0000000..017cf4b
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.12-4.js
@@ -0,0 +1,71 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 11.12-4.js
+ ECMA Section: 11.12
+ Description:
+
+ The grammar for a ConditionalExpression in ECMAScript is a little bit
+ different from that in C and Java, which each allow the second
+ subexpression to be an Expression but restrict the third expression to
+ be a ConditionalExpression. The motivation for this difference in
+ ECMAScript is to allow an assignment expression to be governed by either
+ arm of a conditional and to eliminate the confusing and fairly useless
+ case of a comma expression as the center expression.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "11.12-4";
+ var VERSION = "ECMA_1";
+ startTest();
+ writeHeaderToLog( SECTION + " Conditional operator ( ? : )");
+
+ var testcases = new Array();
+
+ // the following expression should NOT be an error in JS.
+
+ testcases[tc] = new TestCase( SECTION,
+ "true ? MYVAR1 = 'PASSED' : MYVAR1 = 'FAILED'; MYVAR1",
+ "PASSED",
+ "true ? MYVAR1 = 'PASSED' : MYVAR1 = 'FAILED'; MYVAR1" );
+
+ // get around potential parse time error by putting expression in an eval statement
+
+ testcases[tc].actual = eval ( testcases[tc].actual );
+
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.13.1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.13.1.js
new file mode 100644
index 0000000..537ec28
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.13.1.js
@@ -0,0 +1,70 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+ /**
+ File Name: 11.13.1.js
+ ECMA Section: 11.13.1 Simple assignment
+ Description:
+
+ 11.13.1 Simple Assignment ( = )
+
+ The production AssignmentExpression :
+ LeftHandSideExpression = AssignmentExpression is evaluated as follows:
+
+ 1. Evaluate LeftHandSideExpression.
+ 2. Evaluate AssignmentExpression.
+ 3. Call GetValue(Result(2)).
+ 4. Call PutValue(Result(1), Result(3)).
+ 5. Return Result(3).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "11.13.1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var testcases = getTestCases();
+
+ writeHeaderToLog( SECTION + " Simple Assignment ( = )");
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "SOMEVAR = true", true, SOMEVAR = true );
+
+
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.13.2-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.13.2-1.js
new file mode 100644
index 0000000..721fb19
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.13.2-1.js
@@ -0,0 +1,122 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+ /**
+ File Name: 11.13.2-1.js
+ ECMA Section: 11.13.2 Compound Assignment: *=
+ Description:
+
+ *= /= %= += -= <<= >>= >>>= &= ^= |=
+
+ 11.13.2 Compound assignment ( op= )
+
+ The production AssignmentExpression :
+ LeftHandSideExpression @ = AssignmentExpression, where @ represents one of
+ the operators indicated above, is evaluated as follows:
+
+ 1. Evaluate LeftHandSideExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate AssignmentExpression.
+ 4. Call GetValue(Result(3)).
+ 5. Apply operator @ to Result(2) and Result(4).
+ 6. Call PutValue(Result(1), Result(5)).
+ 7. Return Result(5).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "11.13.2-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var testcases = getTestCases();
+
+ writeHeaderToLog( SECTION + " Compound Assignment: *=");
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ // NaN cases
+
+ array[item++] = new TestCase( SECTION, "VAR1 = NaN; VAR2=1; VAR1 *= VAR2", Number.NaN, eval("VAR1 = Number.NaN; VAR2=1; VAR1 *= VAR2") );
+ array[item++] = new TestCase( SECTION, "VAR1 = NaN; VAR2=1; VAR1 *= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NaN; VAR2=1; VAR1 *= VAR2; VAR1") );
+
+ // number cases
+ array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2=1; VAR1 *= VAR2", 0, eval("VAR1 = 0; VAR2=1; VAR1 *= VAR2") );
+ array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2=1; VAR1 *= VAR2;VAR1", 0, eval("VAR1 = 0; VAR2=1; VAR1 *= VAR2;VAR1") );
+
+ array[item++] = new TestCase( SECTION, "VAR1 = 0xFF; VAR2 = 0xA, VAR1 *= VAR2", 2550, eval("VAR1 = 0XFF; VAR2 = 0XA, VAR1 *= VAR2") );
+
+ // special multiplication cases
+
+ array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= Infinity; VAR1 *= VAR2", Number.NaN, eval("VAR1 = 0; VAR2 = Number.POSITIVE_INFINITY; VAR1 *= VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= Infinity; VAR1 *= VAR2", Number.NaN, eval("VAR1 = -0; VAR2 = Number.POSITIVE_INFINITY; VAR1 *= VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= -Infinity; VAR1 *= VAR2", Number.NaN, eval("VAR1 = -0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 *= VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= -Infinity; VAR1 *= VAR2", Number.NaN, eval("VAR1 = 0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 *= VAR2; VAR1") );
+
+ array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= Infinity; VAR2 *= VAR1", Number.NaN, eval("VAR1 = 0; VAR2 = Number.POSITIVE_INFINITY; VAR2 *= VAR1; VAR2") );
+ array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= Infinity; VAR2 *= VAR1", Number.NaN, eval("VAR1 = -0; VAR2 = Number.POSITIVE_INFINITY; VAR2 *= VAR1; VAR2") );
+ array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= -Infinity; VAR2 *= VAR1", Number.NaN, eval("VAR1 = -0; VAR2 = Number.NEGATIVE_INFINITY; VAR2 *= VAR1; VAR2") );
+ array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= -Infinity; VAR2 *= VAR1", Number.NaN, eval("VAR1 = 0; VAR2 = Number.NEGATIVE_INFINITY; VAR2 *= VAR1; VAR2") );
+
+ array[item++] = new TestCase( SECTION, "VAR1 = Infinity; VAR2= Infinity; VAR1 *= VAR2", Number.POSITIVE_INFINITY, eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 *= VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 = Infinity; VAR2= -Infinity; VAR1 *= VAR2", Number.NEGATIVE_INFINITY, eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 *= VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 =-Infinity; VAR2= Infinity; VAR1 *= VAR2", Number.NEGATIVE_INFINITY, eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 *= VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 =-Infinity; VAR2=-Infinity; VAR1 *= VAR2", Number.POSITIVE_INFINITY, eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 *= VAR2; VAR1") );
+
+ // string cases
+ array[item++] = new TestCase( SECTION, "VAR1 = 10; VAR2 = '255', VAR1 *= VAR2", 2550, eval("VAR1 = 10; VAR2 = '255', VAR1 *= VAR2") );
+ array[item++] = new TestCase( SECTION, "VAR1 = '255'; VAR2 = 10, VAR1 *= VAR2", 2550, eval("VAR1 = '255'; VAR2 = 10, VAR1 *= VAR2") );
+
+ array[item++] = new TestCase( SECTION, "VAR1 = 10; VAR2 = '0XFF', VAR1 *= VAR2", 2550, eval("VAR1 = 10; VAR2 = '0XFF', VAR1 *= VAR2") );
+ array[item++] = new TestCase( SECTION, "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 *= VAR2", 2550, eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 *= VAR2") );
+
+ array[item++] = new TestCase( SECTION, "VAR1 = '10'; VAR2 = '255', VAR1 *= VAR2", 2550, eval("VAR1 = '10'; VAR2 = '255', VAR1 *= VAR2") );
+ array[item++] = new TestCase( SECTION, "VAR1 = '10'; VAR2 = '0XFF', VAR1 *= VAR2", 2550, eval("VAR1 = '10'; VAR2 = '0XFF', VAR1 *= VAR2") );
+ array[item++] = new TestCase( SECTION, "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 *= VAR2", 2550, eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 *= VAR2") );
+
+ // boolean cases
+ array[item++] = new TestCase( SECTION, "VAR1 = true; VAR2 = false; VAR1 *= VAR2", 0, eval("VAR1 = true; VAR2 = false; VAR1 *= VAR2") );
+ array[item++] = new TestCase( SECTION, "VAR1 = true; VAR2 = true; VAR1 *= VAR2", 1, eval("VAR1 = true; VAR2 = true; VAR1 *= VAR2") );
+
+ // object cases
+ array[item++] = new TestCase( SECTION, "VAR1 = new Boolean(true); VAR2 = 10; VAR1 *= VAR2;VAR1", 10, eval("VAR1 = new Boolean(true); VAR2 = 10; VAR1 *= VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 = new Number(11); VAR2 = 10; VAR1 *= VAR2; VAR1", 110, eval("VAR1 = new Number(11); VAR2 = 10; VAR1 *= VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 = new Number(11); VAR2 = new Number(10); VAR1 *= VAR2", 110, eval("VAR1 = new Number(11); VAR2 = new Number(10); VAR1 *= VAR2") );
+ array[item++] = new TestCase( SECTION, "VAR1 = new String('15'); VAR2 = new String('0xF'); VAR1 *= VAR2", 225, eval("VAR1 = String('15'); VAR2 = new String('0xF'); VAR1 *= VAR2") );
+
+
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.13.2-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.13.2-2.js
new file mode 100644
index 0000000..5838acf
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.13.2-2.js
@@ -0,0 +1,136 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+ /**
+ File Name: 11.13.2-2js
+ ECMA Section: 11.13.2 Compound Assignment: /=
+ Description:
+
+ *= /= %= += -= <<= >>= >>>= &= ^= |=
+
+ 11.13.2 Compound assignment ( op= )
+
+ The production AssignmentExpression :
+ LeftHandSideExpression @ = AssignmentExpression, where @ represents one of
+ the operators indicated above, is evaluated as follows:
+
+ 1. Evaluate LeftHandSideExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate AssignmentExpression.
+ 4. Call GetValue(Result(3)).
+ 5. Apply operator @ to Result(2) and Result(4).
+ 6. Call PutValue(Result(1), Result(5)).
+ 7. Return Result(5).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "11.13.2-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var testcases = getTestCases();
+
+ writeHeaderToLog( SECTION + " Compound Assignment: /=");
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ // NaN cases
+
+ array[item++] = new TestCase( SECTION, "VAR1 = NaN; VAR2=1; VAR1 /= VAR2", Number.NaN, eval("VAR1 = Number.NaN; VAR2=1; VAR1 /= VAR2") );
+ array[item++] = new TestCase( SECTION, "VAR1 = NaN; VAR2=1; VAR1 /= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NaN; VAR2=1; VAR1 /= VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 = NaN; VAR2=0; VAR1 /= VAR2", Number.NaN, eval("VAR1 = Number.NaN; VAR2=0; VAR1 /= VAR2") );
+ array[item++] = new TestCase( SECTION, "VAR1 = NaN; VAR2=0; VAR1 /= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NaN; VAR2=0; VAR1 /= VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2=NaN; VAR1 /= VAR2", Number.NaN, eval("VAR1 = 0; VAR2=Number.NaN; VAR1 /= VAR2") );
+ array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2=NaN; VAR1 /= VAR2; VAR1", Number.NaN, eval("VAR1 = 0; VAR2=Number.NaN; VAR1 /= VAR2; VAR1") );
+
+ // number cases
+ array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2=1; VAR1 /= VAR2", 0, eval("VAR1 = 0; VAR2=1; VAR1 /= VAR2") );
+ array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2=1; VAR1 /= VAR2;VAR1", 0, eval("VAR1 = 0; VAR2=1; VAR1 /= VAR2;VAR1") );
+
+ array[item++] = new TestCase( SECTION, "VAR1 = 0xFF; VAR2 = 0xA, VAR1 /= VAR2", 25.5, eval("VAR1 = 0XFF; VAR2 = 0XA, VAR1 /= VAR2") );
+
+ // special division cases
+
+ array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= Infinity; VAR1 /= VAR2", 0, eval("VAR1 = 0; VAR2 = Number.POSITIVE_INFINITY; VAR1 /= VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= Infinity; VAR1 /= VAR2", 0, eval("VAR1 = -0; VAR2 = Number.POSITIVE_INFINITY; VAR1 /= VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= -Infinity; VAR1 /= VAR2", 0, eval("VAR1 = -0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 /= VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= -Infinity; VAR1 /= VAR2", 0, eval("VAR1 = 0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 /= VAR2; VAR1") );
+
+ array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= Infinity; VAR2 /= VAR1", Number.POSITIVE_INFINITY, eval("VAR1 = 0; VAR2 = Number.POSITIVE_INFINITY; VAR2 /= VAR1; VAR2") );
+ array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= Infinity; VAR2 /= VAR1", Number.NEGATIVE_INFINITY, eval("VAR1 = -0; VAR2 = Number.POSITIVE_INFINITY; VAR2 /= VAR1; VAR2") );
+ array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= -Infinity; VAR2 /= VAR1", Number.POSITIVE_INFINITY, eval("VAR1 = -0; VAR2 = Number.NEGATIVE_INFINITY; VAR2 /= VAR1; VAR2") );
+ array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= -Infinity; VAR2 /= VAR1", Number.NEGATIVE_INFINITY, eval("VAR1 = 0; VAR2 = Number.NEGATIVE_INFINITY; VAR2 /= VAR1; VAR2") );
+
+ array[item++] = new TestCase( SECTION, "VAR1 = Infinity; VAR2= Infinity; VAR1 /= VAR2", Number.NaN, eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 /= VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 = Infinity; VAR2= -Infinity; VAR1 /= VAR2", Number.NaN, eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 /= VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 =-Infinity; VAR2= Infinity; VAR1 /= VAR2", Number.NaN, eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 /= VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 =-Infinity; VAR2=-Infinity; VAR1 /= VAR2", Number.NaN, eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 /= VAR2; VAR1") );
+
+ array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= 0; VAR1 /= VAR2", Number.NaN, eval("VAR1 = 0; VAR2 = 0; VAR1 /= VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= -0; VAR1 /= VAR2", Number.NaN, eval("VAR1 = 0; VAR2 = -0; VAR1 /= VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= 0; VAR1 /= VAR2", Number.NaN, eval("VAR1 = -0; VAR2 = 0; VAR1 /= VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= -0; VAR1 /= VAR2", Number.NaN, eval("VAR1 = -0; VAR2 = -0; VAR1 /= VAR2; VAR1") );
+
+ array[item++] = new TestCase( SECTION, "VAR1 = 1; VAR2= 0; VAR1 /= VAR2", Number.POSITIVE_INFINITY, eval("VAR1 = 1; VAR2 = 0; VAR1 /= VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 = 1; VAR2= -0; VAR1 /= VAR2", Number.NEGATIVE_INFINITY, eval("VAR1 = 1; VAR2 = -0; VAR1 /= VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 = -1; VAR2= 0; VAR1 /= VAR2", Number.NEGATIVE_INFINITY, eval("VAR1 = -1; VAR2 = 0; VAR1 /= VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 = -1; VAR2= -0; VAR1 /= VAR2", Number.POSITIVE_INFINITY, eval("VAR1 = -1; VAR2 = -0; VAR1 /= VAR2; VAR1") );
+
+ // string cases
+ array[item++] = new TestCase( SECTION, "VAR1 = 1000; VAR2 = '10', VAR1 /= VAR2; VAR1", 100, eval("VAR1 = 1000; VAR2 = '10', VAR1 /= VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 = '1000'; VAR2 = 10, VAR1 /= VAR2; VAR1", 100, eval("VAR1 = '1000'; VAR2 = 10, VAR1 /= VAR2; VAR1") );
+/*
+ array[item++] = new TestCase( SECTION, "VAR1 = 10; VAR2 = '0XFF', VAR1 /= VAR2", 2550, eval("VAR1 = 10; VAR2 = '0XFF', VAR1 /= VAR2") );
+ array[item++] = new TestCase( SECTION, "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 /= VAR2", 2550, eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 /= VAR2") );
+
+ array[item++] = new TestCase( SECTION, "VAR1 = '10'; VAR2 = '255', VAR1 /= VAR2", 2550, eval("VAR1 = '10'; VAR2 = '255', VAR1 /= VAR2") );
+ array[item++] = new TestCase( SECTION, "VAR1 = '10'; VAR2 = '0XFF', VAR1 /= VAR2", 2550, eval("VAR1 = '10'; VAR2 = '0XFF', VAR1 /= VAR2") );
+ array[item++] = new TestCase( SECTION, "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 /= VAR2", 2550, eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 /= VAR2") );
+
+ // boolean cases
+ array[item++] = new TestCase( SECTION, "VAR1 = true; VAR2 = false; VAR1 /= VAR2", 0, eval("VAR1 = true; VAR2 = false; VAR1 /= VAR2") );
+ array[item++] = new TestCase( SECTION, "VAR1 = true; VAR2 = true; VAR1 /= VAR2", 1, eval("VAR1 = true; VAR2 = true; VAR1 /= VAR2") );
+
+ // object cases
+ array[item++] = new TestCase( SECTION, "VAR1 = new Boolean(true); VAR2 = 10; VAR1 /= VAR2;VAR1", 10, eval("VAR1 = new Boolean(true); VAR2 = 10; VAR1 /= VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 = new Number(11); VAR2 = 10; VAR1 /= VAR2; VAR1", 110, eval("VAR1 = new Number(11); VAR2 = 10; VAR1 /= VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 = new Number(11); VAR2 = new Number(10); VAR1 /= VAR2", 110, eval("VAR1 = new Number(11); VAR2 = new Number(10); VAR1 /= VAR2") );
+ array[item++] = new TestCase( SECTION, "VAR1 = new String('15'); VAR2 = new String('0xF'); VAR1 /= VAR2", 255, eval("VAR1 = String('15'); VAR2 = new String('0xF'); VAR1 /= VAR2") );
+
+*/
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.13.2-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.13.2-3.js
new file mode 100644
index 0000000..cf151db
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.13.2-3.js
@@ -0,0 +1,149 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+ /**
+ File Name: 11.13.2-4.js
+ ECMA Section: 11.13.2 Compound Assignment: %=
+ Description:
+
+ *= /= %= += -= <<= >>= >>>= &= ^= |=
+
+ 11.13.2 Compound assignment ( op= )
+
+ The production AssignmentExpression :
+ LeftHandSideExpression @ = AssignmentExpression, where @ represents one of
+ the operators indicated above, is evaluated as follows:
+
+ 1. Evaluate LeftHandSideExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate AssignmentExpression.
+ 4. Call GetValue(Result(3)).
+ 5. Apply operator @ to Result(2) and Result(4).
+ 6. Call PutValue(Result(1), Result(5)).
+ 7. Return Result(5).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "11.13.2-3";
+ var VERSION = "ECMA_1";
+ startTest();
+ var testcases = getTestCases();
+
+ writeHeaderToLog( SECTION + " Compound Assignment: +=");
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ // If either operand is NaN, result is NaN
+
+ array[item++] = new TestCase( SECTION, "VAR1 = NaN; VAR2=1; VAR1 %= VAR2", Number.NaN, eval("VAR1 = Number.NaN; VAR2=1; VAR1 %= VAR2") );
+ array[item++] = new TestCase( SECTION, "VAR1 = NaN; VAR2=1; VAR1 %= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NaN; VAR2=1; VAR1 %= VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 = NaN; VAR2=0; VAR1 %= VAR2", Number.NaN, eval("VAR1 = Number.NaN; VAR2=0; VAR1 %= VAR2") );
+ array[item++] = new TestCase( SECTION, "VAR1 = NaN; VAR2=0; VAR1 %= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NaN; VAR2=0; VAR1 %= VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2=NaN; VAR1 %= VAR2", Number.NaN, eval("VAR1 = 0; VAR2=Number.NaN; VAR1 %= VAR2") );
+ array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2=NaN; VAR1 %= VAR2; VAR1", Number.NaN, eval("VAR1 = 0; VAR2=Number.NaN; VAR1 %= VAR2; VAR1") );
+
+ // if the dividend is infinity or the divisor is zero or both, the result is NaN
+
+ array[item++] = new TestCase( SECTION, "VAR1 = Infinity; VAR2= Infinity; VAR1 %= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 %= VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 = Infinity; VAR2= -Infinity; VAR1 %= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 %= VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 =-Infinity; VAR2= Infinity; VAR1 %= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 %= VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 =-Infinity; VAR2=-Infinity; VAR1 %= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 %= VAR2; VAR1") );
+
+ array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= Infinity; VAR2 %= VAR1", Number.NaN, eval("VAR1 = 0; VAR2 = Number.POSITIVE_INFINITY; VAR2 %= VAR1; VAR2") );
+ array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= Infinity; VAR2 %= VAR1", Number.NaN, eval("VAR1 = -0; VAR2 = Number.POSITIVE_INFINITY; VAR2 %= VAR1; VAR2") );
+ array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= -Infinity; VAR2 %= VAR1", Number.NaN, eval("VAR1 = -0; VAR2 = Number.NEGATIVE_INFINITY; VAR2 %= VAR1; VAR2") );
+ array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= -Infinity; VAR2 %= VAR1", Number.NaN, eval("VAR1 = 0; VAR2 = Number.NEGATIVE_INFINITY; VAR2 %= VAR1; VAR2") );
+
+ array[item++] = new TestCase( SECTION, "VAR1 = 1; VAR2= Infinity; VAR2 %= VAR1", Number.NaN, eval("VAR1 = 1; VAR2 = Number.POSITIVE_INFINITY; VAR2 %= VAR1; VAR2") );
+ array[item++] = new TestCase( SECTION, "VAR1 = -1; VAR2= Infinity; VAR2 %= VAR1", Number.NaN, eval("VAR1 = -1; VAR2 = Number.POSITIVE_INFINITY; VAR2 %= VAR1; VAR2") );
+ array[item++] = new TestCase( SECTION, "VAR1 = -1; VAR2= -Infinity; VAR2 %= VAR1", Number.NaN, eval("VAR1 = -1; VAR2 = Number.NEGATIVE_INFINITY; VAR2 %= VAR1; VAR2") );
+ array[item++] = new TestCase( SECTION, "VAR1 = 1; VAR2= -Infinity; VAR2 %= VAR1", Number.NaN, eval("VAR1 = 1; VAR2 = Number.NEGATIVE_INFINITY; VAR2 %= VAR1; VAR2") );
+
+ array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= 0; VAR1 %= VAR2", Number.NaN, eval("VAR1 = 0; VAR2 = 0; VAR1 %= VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= -0; VAR1 %= VAR2", Number.NaN, eval("VAR1 = 0; VAR2 = -0; VAR1 %= VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= 0; VAR1 %= VAR2", Number.NaN, eval("VAR1 = -0; VAR2 = 0; VAR1 %= VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= -0; VAR1 %= VAR2", Number.NaN, eval("VAR1 = -0; VAR2 = -0; VAR1 %= VAR2; VAR1") );
+
+ array[item++] = new TestCase( SECTION, "VAR1 = 1; VAR2= 0; VAR1 %= VAR2", Number.NaN, eval("VAR1 = 1; VAR2 = 0; VAR1 %= VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 = 1; VAR2= -0; VAR1 %= VAR2", Number.NaN, eval("VAR1 = 1; VAR2 = -0; VAR1 %= VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 = -1; VAR2= 0; VAR1 %= VAR2", Number.NaN, eval("VAR1 = -1; VAR2 = 0; VAR1 %= VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 = -1; VAR2= -0; VAR1 %= VAR2", Number.NaN, eval("VAR1 = -1; VAR2 = -0; VAR1 %= VAR2; VAR1") );
+
+ // if the dividend is finite and the divisor is an infinity, the result equals the dividend.
+
+ array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= Infinity; VAR1 %= VAR2;VAR1", 0, eval("VAR1 = 0; VAR2 = Number.POSITIVE_INFINITY; VAR1 %= VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= Infinity; VAR1 %= VAR2;VAR1", -0, eval("VAR1 = -0; VAR2 = Number.POSITIVE_INFINITY; VAR1 %= VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= -Infinity; VAR1 %= VAR2;VAR1", -0, eval("VAR1 = -0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 %= VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= -Infinity; VAR1 %= VAR2;VAR1", 0, eval("VAR1 = 0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 %= VAR2; VAR1") );
+
+ array[item++] = new TestCase( SECTION, "VAR1 = 1; VAR2= Infinity; VAR1 %= VAR2;VAR1", 1, eval("VAR1 = 1; VAR2 = Number.POSITIVE_INFINITY; VAR1 %= VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 = -1; VAR2= Infinity; VAR1 %= VAR2;VAR1", -1, eval("VAR1 = -1; VAR2 = Number.POSITIVE_INFINITY; VAR1 %= VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 = -1; VAR2= -Infinity; VAR1 %= VAR2;VAR1", -1, eval("VAR1 = -1; VAR2 = Number.NEGATIVE_INFINITY; VAR1 %= VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 = 1; VAR2= -Infinity; VAR1 %= VAR2;VAR1", 1, eval("VAR1 = 1; VAR2 = Number.NEGATIVE_INFINITY; VAR1 %= VAR2; VAR1") );
+
+ // if the dividend is a zero and the divisor is finite, the result is the same as the dividend
+
+ array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= 1; VAR1 %= VAR2; VAR1", 0, eval("VAR1 = 0; VAR2 = 1; VAR1 %= VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= 1; VAR1 %= VAR2; VAR1", -0, eval("VAR1 = -0; VAR2 = 1; VAR1 %= VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= -1; VAR1 %= VAR2; VAR1", -0, eval("VAR1 = -0; VAR2 = -1; VAR1 %= VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= -1; VAR1 %= VAR2; VAR1", 0, eval("VAR1 = 0; VAR2 = -1; VAR1 %= VAR2; VAR1") );
+
+ // string cases
+ array[item++] = new TestCase( SECTION, "VAR1 = 1000; VAR2 = '10', VAR1 %= VAR2; VAR1", 0, eval("VAR1 = 1000; VAR2 = '10', VAR1 %= VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 = '1000'; VAR2 = 10, VAR1 %= VAR2; VAR1", 0, eval("VAR1 = '1000'; VAR2 = 10, VAR1 %= VAR2; VAR1") );
+/*
+ array[item++] = new TestCase( SECTION, "VAR1 = 10; VAR2 = '0XFF', VAR1 %= VAR2", 2550, eval("VAR1 = 10; VAR2 = '0XFF', VAR1 %= VAR2") );
+ array[item++] = new TestCase( SECTION, "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 %= VAR2", 2550, eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 %= VAR2") );
+
+ array[item++] = new TestCase( SECTION, "VAR1 = '10'; VAR2 = '255', VAR1 %= VAR2", 2550, eval("VAR1 = '10'; VAR2 = '255', VAR1 %= VAR2") );
+ array[item++] = new TestCase( SECTION, "VAR1 = '10'; VAR2 = '0XFF', VAR1 %= VAR2", 2550, eval("VAR1 = '10'; VAR2 = '0XFF', VAR1 %= VAR2") );
+ array[item++] = new TestCase( SECTION, "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 %= VAR2", 2550, eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 %= VAR2") );
+
+ // boolean cases
+ array[item++] = new TestCase( SECTION, "VAR1 = true; VAR2 = false; VAR1 %= VAR2", 0, eval("VAR1 = true; VAR2 = false; VAR1 %= VAR2") );
+ array[item++] = new TestCase( SECTION, "VAR1 = true; VAR2 = true; VAR1 %= VAR2", 1, eval("VAR1 = true; VAR2 = true; VAR1 %= VAR2") );
+
+ // object cases
+ array[item++] = new TestCase( SECTION, "VAR1 = new Boolean(true); VAR2 = 10; VAR1 %= VAR2;VAR1", 10, eval("VAR1 = new Boolean(true); VAR2 = 10; VAR1 %= VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 = new Number(11); VAR2 = 10; VAR1 %= VAR2; VAR1", 110, eval("VAR1 = new Number(11); VAR2 = 10; VAR1 %= VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 = new Number(11); VAR2 = new Number(10); VAR1 %= VAR2", 110, eval("VAR1 = new Number(11); VAR2 = new Number(10); VAR1 %= VAR2") );
+ array[item++] = new TestCase( SECTION, "VAR1 = new String('15'); VAR2 = new String('0xF'); VAR1 %= VAR2", 255, eval("VAR1 = String('15'); VAR2 = new String('0xF'); VAR1 %= VAR2") );
+
+*/
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason %= ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.13.2-4.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.13.2-4.js
new file mode 100644
index 0000000..edf79a7
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.13.2-4.js
@@ -0,0 +1,137 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+ /**
+ File Name: 11.13.2-4.js
+ ECMA Section: 11.13.2 Compound Assignment:+=
+ Description:
+
+ *= /= %= += -= <<= >>= >>>= &= ^= |=
+
+ 11.13.2 Compound assignment ( op= )
+
+ The production AssignmentExpression :
+ LeftHandSideExpression @ = AssignmentExpression, where @ represents one of
+ the operators indicated above, is evaluated as follows:
+
+ 1. Evaluate LeftHandSideExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate AssignmentExpression.
+ 4. Call GetValue(Result(3)).
+ 5. Apply operator @ to Result(2) and Result(4).
+ 6. Call PutValue(Result(1), Result(5)).
+ 7. Return Result(5).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "11.13.2-4";
+ var VERSION = "ECMA_1";
+ startTest();
+ var testcases = getTestCases();
+
+ writeHeaderToLog( SECTION + " Compound Assignment: +=");
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ // If either operand is NaN, result is NaN
+
+ array[item++] = new TestCase( SECTION, "VAR1 = NaN; VAR2=1; VAR1 += VAR2", Number.NaN, eval("VAR1 = Number.NaN; VAR2=1; VAR1 += VAR2") );
+ array[item++] = new TestCase( SECTION, "VAR1 = NaN; VAR2=1; VAR1 += VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NaN; VAR2=1; VAR1 += VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 = NaN; VAR2=0; VAR1 += VAR2", Number.NaN, eval("VAR1 = Number.NaN; VAR2=0; VAR1 += VAR2") );
+ array[item++] = new TestCase( SECTION, "VAR1 = NaN; VAR2=0; VAR1 += VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NaN; VAR2=0; VAR1 += VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2=NaN; VAR1 += VAR2", Number.NaN, eval("VAR1 = 0; VAR2=Number.NaN; VAR1 += VAR2") );
+ array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2=NaN; VAR1 += VAR2; VAR1", Number.NaN, eval("VAR1 = 0; VAR2=Number.NaN; VAR1 += VAR2; VAR1") );
+
+ // the sum of two Infinities the same sign is the infinity of that sign
+ // the sum of two Infinities of opposite sign is NaN
+
+ array[item++] = new TestCase( SECTION, "VAR1 = Infinity; VAR2= Infinity; VAR1 += VAR2; VAR1", Number.POSITIVE_INFINITY, eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 += VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 = Infinity; VAR2= -Infinity; VAR1 += VAR2; VAR1", Number.NaN, eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 += VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 =-Infinity; VAR2= Infinity; VAR1 += VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 += VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 =-Infinity; VAR2=-Infinity; VAR1 += VAR2; VAR1", Number.NEGATIVE_INFINITY, eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 += VAR2; VAR1") );
+
+ // the sum of an infinity and a finite value is equal to the infinite operand
+
+ array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= Infinity; VAR1 += VAR2;VAR1", Number.POSITIVE_INFINITY, eval("VAR1 = 0; VAR2 = Number.POSITIVE_INFINITY; VAR1 += VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= Infinity; VAR1 += VAR2;VAR1", Number.POSITIVE_INFINITY, eval("VAR1 = -0; VAR2 = Number.POSITIVE_INFINITY; VAR1 += VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= -Infinity; VAR1 += VAR2;VAR1", Number.NEGATIVE_INFINITY, eval("VAR1 = -0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 += VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= -Infinity; VAR1 += VAR2;VAR1", Number.NEGATIVE_INFINITY, eval("VAR1 = 0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 += VAR2; VAR1") );
+
+ // the sum of two negative zeros is -0. the sum of two positive zeros, or of two zeros of opposite sign, is +0
+
+ array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= 0; VAR1 += VAR2", 0, eval("VAR1 = 0; VAR2 = 0; VAR1 += VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= -0; VAR1 += VAR2", 0, eval("VAR1 = 0; VAR2 = -0; VAR1 += VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= 0; VAR1 += VAR2", 0, eval("VAR1 = -0; VAR2 = 0; VAR1 += VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= -0; VAR1 += VAR2", -0, eval("VAR1 = -0; VAR2 = -0; VAR1 += VAR2; VAR1") );
+
+ // the sum of a zero and a nonzero finite value is eqal to the nonzero operand
+
+ array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= 1; VAR2 += VAR1; VAR2", 1, eval("VAR1 = 0; VAR2 = 1; VAR2 += VAR1; VAR2") );
+ array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= 1; VAR2 += VAR1; VAR2", 1, eval("VAR1 = -0; VAR2 = 1; VAR2 += VAR1; VAR2") );
+ array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= -1; VAR2 += VAR1; VAR2", -1, eval("VAR1 = -0; VAR2 = -1; VAR2 += VAR1; VAR2") );
+ array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= -1; VAR2 += VAR1; VAR2", -1, eval("VAR1 = 0; VAR2 = -1; VAR2 += VAR1; VAR2") );
+
+ // the sum of a zero and a nozero finite value is equal to the nonzero operand.
+ array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2=1; VAR1 += VAR2", 1, eval("VAR1 = 0; VAR2=1; VAR1 += VAR2") );
+ array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2=1; VAR1 += VAR2;VAR1", 1, eval("VAR1 = 0; VAR2=1; VAR1 += VAR2;VAR1") );
+
+ // the sum of two nonzero finite values of the same magnitude and opposite sign is +0
+ array[item++] = new TestCase( SECTION, "VAR1 = Number.MAX_VALUE; VAR2= -Number.MAX_VALUE; VAR1 += VAR2; VAR1", 0, eval("VAR1 = Number.MAX_VALUE; VAR2= -Number.MAX_VALUE; VAR1 += VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 = Number.MIN_VALUE; VAR2= -Number.MIN_VALUE; VAR1 += VAR2; VAR1", 0, eval("VAR1 = Number.MIN_VALUE; VAR2= -Number.MIN_VALUE; VAR1 += VAR2; VAR1") );
+
+/*
+ array[item++] = new TestCase( SECTION, "VAR1 = 10; VAR2 = '0XFF', VAR1 += VAR2", 2550, eval("VAR1 = 10; VAR2 = '0XFF', VAR1 += VAR2") );
+ array[item++] = new TestCase( SECTION, "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 += VAR2", 2550, eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 += VAR2") );
+
+ array[item++] = new TestCase( SECTION, "VAR1 = '10'; VAR2 = '255', VAR1 += VAR2", 2550, eval("VAR1 = '10'; VAR2 = '255', VAR1 += VAR2") );
+ array[item++] = new TestCase( SECTION, "VAR1 = '10'; VAR2 = '0XFF', VAR1 += VAR2", 2550, eval("VAR1 = '10'; VAR2 = '0XFF', VAR1 += VAR2") );
+ array[item++] = new TestCase( SECTION, "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 += VAR2", 2550, eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 += VAR2") );
+
+ // boolean cases
+ array[item++] = new TestCase( SECTION, "VAR1 = true; VAR2 = false; VAR1 += VAR2", 0, eval("VAR1 = true; VAR2 = false; VAR1 += VAR2") );
+ array[item++] = new TestCase( SECTION, "VAR1 = true; VAR2 = true; VAR1 += VAR2", 1, eval("VAR1 = true; VAR2 = true; VAR1 += VAR2") );
+
+ // object cases
+ array[item++] = new TestCase( SECTION, "VAR1 = new Boolean(true); VAR2 = 10; VAR1 += VAR2;VAR1", 10, eval("VAR1 = new Boolean(true); VAR2 = 10; VAR1 += VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 = new Number(11); VAR2 = 10; VAR1 += VAR2; VAR1", 110, eval("VAR1 = new Number(11); VAR2 = 10; VAR1 += VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 = new Number(11); VAR2 = new Number(10); VAR1 += VAR2", 110, eval("VAR1 = new Number(11); VAR2 = new Number(10); VAR1 += VAR2") );
+ array[item++] = new TestCase( SECTION, "VAR1 = new String('15'); VAR2 = new String('0xF'); VAR1 += VAR2", 255, eval("VAR1 = String('15'); VAR2 = new String('0xF'); VAR1 += VAR2") );
+
+*/
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.13.2-5.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.13.2-5.js
new file mode 100644
index 0000000..6923bef
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.13.2-5.js
@@ -0,0 +1,137 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+ /**
+ File Name: 11.13.2-5.js
+ ECMA Section: 11.13.2 Compound Assignment: -=
+ Description:
+
+ *= /= %= -= -= <<= >>= >>>= &= ^= |=
+
+ 11.13.2 Compound assignment ( op= )
+
+ The production AssignmentExpression :
+ LeftHandSideExpression @ = AssignmentExpression, where @ represents one of
+ the operators indicated above, is evaluated as follows:
+
+ 1. Evaluate LeftHandSideExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate AssignmentExpression.
+ 4. Call GetValue(Result(3)).
+ 5. Apply operator @ to Result(2) and Result(4).
+ 6. Call PutValue(Result(1), Result(5)).
+ 7. Return Result(5).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "11.13.2-5";
+ var VERSION = "ECMA_1";
+ startTest();
+ var testcases = getTestCases();
+
+ writeHeaderToLog( SECTION + " Compound Assignment: -=");
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ // If either operand is NaN, result is NaN
+
+ array[item++] = new TestCase( SECTION, "VAR1 = NaN; VAR2=1; VAR1 -= VAR2", Number.NaN, eval("VAR1 = Number.NaN; VAR2=1; VAR1 -= VAR2") );
+ array[item++] = new TestCase( SECTION, "VAR1 = NaN; VAR2=1; VAR1 -= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NaN; VAR2=1; VAR1 -= VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 = NaN; VAR2=0; VAR1 -= VAR2", Number.NaN, eval("VAR1 = Number.NaN; VAR2=0; VAR1 -= VAR2") );
+ array[item++] = new TestCase( SECTION, "VAR1 = NaN; VAR2=0; VAR1 -= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NaN; VAR2=0; VAR1 -= VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2=NaN; VAR1 -= VAR2", Number.NaN, eval("VAR1 = 0; VAR2=Number.NaN; VAR1 -= VAR2") );
+ array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2=NaN; VAR1 -= VAR2; VAR1", Number.NaN, eval("VAR1 = 0; VAR2=Number.NaN; VAR1 -= VAR2; VAR1") );
+
+ // the sum of two Infinities the same sign is the infinity of that sign
+ // the sum of two Infinities of opposite sign is NaN
+
+ array[item++] = new TestCase( SECTION, "VAR1 = Infinity; VAR2= Infinity; VAR1 -= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 -= VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 = Infinity; VAR2= -Infinity; VAR1 -= VAR2; VAR1", Number.POSITIVE_INFINITY, eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 -= VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 =-Infinity; VAR2= Infinity; VAR1 -= VAR2; VAR1", Number.NEGATIVE_INFINITY, eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 -= VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 =-Infinity; VAR2=-Infinity; VAR1 -= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 -= VAR2; VAR1") );
+
+ // the sum of an infinity and a finite value is equal to the infinite operand
+
+ array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= Infinity; VAR1 -= VAR2;VAR1", Number.NEGATIVE_INFINITY, eval("VAR1 = 0; VAR2 = Number.POSITIVE_INFINITY; VAR1 -= VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= Infinity; VAR1 -= VAR2;VAR1", Number.NEGATIVE_INFINITY, eval("VAR1 = -0; VAR2 = Number.POSITIVE_INFINITY; VAR1 -= VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= -Infinity; VAR1 -= VAR2;VAR1", Number.POSITIVE_INFINITY, eval("VAR1 = 0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 -= VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= -Infinity; VAR1 -= VAR2;VAR1", Number.POSITIVE_INFINITY, eval("VAR1 = -0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 -= VAR2; VAR1") );
+
+ // the sum of two negative zeros is -0. the sum of two positive zeros, or of two zeros of opposite sign, is +0
+
+ array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= -0; VAR1 -= VAR2", 0, eval("VAR1 = 0; VAR2 = 0; VAR1 -= VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= 0; VAR1 -= VAR2", 0, eval("VAR1 = 0; VAR2 = -0; VAR1 -= VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= -0; VAR1 -= VAR2", 0, eval("VAR1 = -0; VAR2 = 0; VAR1 -= VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= 0; VAR1 -= VAR2", -0, eval("VAR1 = -0; VAR2 = -0; VAR1 -= VAR2; VAR1") );
+
+ // the sum of a zero and a nonzero finite value is eqal to the nonzero operand
+
+ array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= -1; VAR1 -= VAR2; VAR1", 1, eval("VAR1 = 0; VAR2 = -1; VAR1 -= VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= -1; VAR1 -= VAR2; VAR1", 1, eval("VAR1 = -0; VAR2 = -1; VAR1 -= VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= 1; VAR1 -= VAR2; VAR1", -1, eval("VAR1 = -0; VAR2 = 1; VAR1 -= VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= 1; VAR1 -= VAR2; VAR1", -1, eval("VAR1 = 0; VAR2 = 1; VAR1 -= VAR2; VAR1") );
+
+ // the sum of a zero and a nozero finite value is equal to the nonzero operand.
+ array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2=-1; VAR1 -= VAR2", 1, eval("VAR1 = 0; VAR2=-1; VAR1 -= VAR2;VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2=-1; VAR1 -= VAR2;VAR1", 1, eval("VAR1 = 0; VAR2=-1; VAR1 -= VAR2;VAR1") );
+
+ // the sum of two nonzero finite values of the same magnitude and opposite sign is +0
+ array[item++] = new TestCase( SECTION, "VAR1 = Number.MAX_VALUE; VAR2= Number.MAX_VALUE; VAR1 -= VAR2; VAR1", 0, eval("VAR1 = Number.MAX_VALUE; VAR2= Number.MAX_VALUE; VAR1 -= VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 = Number.MIN_VALUE; VAR2= Number.MIN_VALUE; VAR1 -= VAR2; VAR1", 0, eval("VAR1 = Number.MIN_VALUE; VAR2= Number.MIN_VALUE; VAR1 -= VAR2; VAR1") );
+
+/*
+ array[item++] = new TestCase( SECTION, "VAR1 = 10; VAR2 = '0XFF', VAR1 -= VAR2", 2550, eval("VAR1 = 10; VAR2 = '0XFF', VAR1 -= VAR2") );
+ array[item++] = new TestCase( SECTION, "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 -= VAR2", 2550, eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 -= VAR2") );
+
+ array[item++] = new TestCase( SECTION, "VAR1 = '10'; VAR2 = '255', VAR1 -= VAR2", 2550, eval("VAR1 = '10'; VAR2 = '255', VAR1 -= VAR2") );
+ array[item++] = new TestCase( SECTION, "VAR1 = '10'; VAR2 = '0XFF', VAR1 -= VAR2", 2550, eval("VAR1 = '10'; VAR2 = '0XFF', VAR1 -= VAR2") );
+ array[item++] = new TestCase( SECTION, "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 -= VAR2", 2550, eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 -= VAR2") );
+
+ // boolean cases
+ array[item++] = new TestCase( SECTION, "VAR1 = true; VAR2 = false; VAR1 -= VAR2", 0, eval("VAR1 = true; VAR2 = false; VAR1 -= VAR2") );
+ array[item++] = new TestCase( SECTION, "VAR1 = true; VAR2 = true; VAR1 -= VAR2", 1, eval("VAR1 = true; VAR2 = true; VAR1 -= VAR2") );
+
+ // object cases
+ array[item++] = new TestCase( SECTION, "VAR1 = new Boolean(true); VAR2 = 10; VAR1 -= VAR2;VAR1", 10, eval("VAR1 = new Boolean(true); VAR2 = 10; VAR1 -= VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 = new Number(11); VAR2 = 10; VAR1 -= VAR2; VAR1", 110, eval("VAR1 = new Number(11); VAR2 = 10; VAR1 -= VAR2; VAR1") );
+ array[item++] = new TestCase( SECTION, "VAR1 = new Number(11); VAR2 = new Number(10); VAR1 -= VAR2", 110, eval("VAR1 = new Number(11); VAR2 = new Number(10); VAR1 -= VAR2") );
+ array[item++] = new TestCase( SECTION, "VAR1 = new String('15'); VAR2 = new String('0xF'); VAR1 -= VAR2", 255, eval("VAR1 = String('15'); VAR2 = new String('0xF'); VAR1 -= VAR2") );
+
+*/
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason -= ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.13.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.13.js
new file mode 100644
index 0000000..73b4d19
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.13.js
@@ -0,0 +1,86 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+ /**
+ File Name: 11.12.js
+ ECMA Section: 11.12 Conditional Operator
+ Description:
+ Logi
+
+ calORExpression ? AssignmentExpression : AssignmentExpression
+
+ Semantics
+
+ The production ConditionalExpression :
+ LogicalORExpression ? AssignmentExpression : AssignmentExpression
+ is evaluated as follows:
+
+ 1. Evaluate LogicalORExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Call ToBoolean(Result(2)).
+ 4. If Result(3) is false, go to step 8.
+ 5. Evaluate the first AssignmentExpression.
+ 6. Call GetValue(Result(5)).
+ 7. Return Result(6).
+ 8. Evaluate the second AssignmentExpression.
+ 9. Call GetValue(Result(8)).
+ 10. Return Result(9).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "11.12";
+ var VERSION = "ECMA_1";
+ startTest();
+ var testcases = getTestCases();
+
+ writeHeaderToLog( SECTION + " Conditional operator( ? : )");
+ test();
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "true ? 'PASSED' : 'FAILED'", "PASSED", (true?"PASSED":"FAILED"));
+ array[item++] = new TestCase( SECTION, "false ? 'FAILED' : 'PASSED'", "PASSED", (false?"FAILED":"PASSED"));
+
+ array[item++] = new TestCase( SECTION, "1 ? 'PASSED' : 'FAILED'", "PASSED", (true?"PASSED":"FAILED"));
+ array[item++] = new TestCase( SECTION, "0 ? 'FAILED' : 'PASSED'", "PASSED", (false?"FAILED":"PASSED"));
+ array[item++] = new TestCase( SECTION, "-1 ? 'PASSED' : 'FAILED'", "PASSED", (true?"PASSED":"FAILED"));
+
+ array[item++] = new TestCase( SECTION, "NaN ? 'FAILED' : 'PASSED'", "PASSED", (Number.NaN?"FAILED":"PASSED"));
+
+ array[item++] = new TestCase( SECTION, "var VAR = true ? , : 'FAILED'", "PASSED", (VAR = true ? "PASSED" : "FAILED") );
+
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.14-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.14-1.js
new file mode 100644
index 0000000..bd3e8f1
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.14-1.js
@@ -0,0 +1,73 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 11.14-1.js
+ ECMA Section: 11.14 Comma operator (,)
+ Description:
+ Expression :
+
+ AssignmentExpression
+ Expression , AssignmentExpression
+
+ Semantics
+
+ The production Expression : Expression , AssignmentExpression is evaluated as follows:
+
+ 1. Evaluate Expression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate AssignmentExpression.
+ 4. Call GetValue(Result(3)).
+ 5. Return Result(4).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "11.14-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var testcases = getTestCases();
+
+ writeHeaderToLog( SECTION + " Comma operator (,)");
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "true, false", false, eval("true, false") );
+ array[item++] = new TestCase( SECTION, "VAR1=true, VAR2=false", false, eval("VAR1=true, VAR2=false") );
+ array[item++] = new TestCase( SECTION, "VAR1=true, VAR2=false;VAR1", true, eval("VAR1=true, VAR2=false; VAR1") );
+ return ( array );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.1-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.1-1.js
new file mode 100644
index 0000000..6144c9a
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.1-1.js
@@ -0,0 +1,268 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 11.2.1-1.js
+ ECMA Section: 11.2.1 Property Accessors
+ Description:
+
+ Properties are accessed by name, using either the dot notation:
+ MemberExpression . Identifier
+ CallExpression . Identifier
+
+ or the bracket notation: MemberExpression [ Expression ]
+ CallExpression [ Expression ]
+
+ The dot notation is explained by the following syntactic conversion:
+ MemberExpression . Identifier
+ is identical in its behavior to
+ MemberExpression [ <identifier-string> ]
+ and similarly
+ CallExpression . Identifier
+ is identical in its behavior to
+ CallExpression [ <identifier-string> ]
+ where <identifier-string> is a string literal containing the same sequence
+ of characters as the Identifier.
+
+ The production MemberExpression : MemberExpression [ Expression ] is
+ evaluated as follows:
+
+ 1. Evaluate MemberExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate Expression.
+ 4. Call GetValue(Result(3)).
+ 5. Call ToObject(Result(2)).
+ 6. Call ToString(Result(4)).
+ 7. Return a value of type Reference whose base object is Result(5) and
+ whose property name is Result(6).
+
+ The production CallExpression : CallExpression [ Expression ] is evaluated
+ in exactly the same manner, except that the contained CallExpression is
+ evaluated in step 1.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "11.2.1-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Property Accessors";
+ writeHeaderToLog( SECTION + " "+TITLE );
+
+ var testcases = new Array();
+
+ // go through all Native Function objects, methods, and properties and get their typeof.
+
+ var PROPERTY = new Array();
+ var p = 0;
+
+ // properties and functions of the global object
+
+ PROPERTY[p++] = new Property( "this", "NaN", "number" );
+ PROPERTY[p++] = new Property( "this", "Infinity", "number" );
+ PROPERTY[p++] = new Property( "this", "eval", "function" );
+ PROPERTY[p++] = new Property( "this", "parseInt", "function" );
+ PROPERTY[p++] = new Property( "this", "parseFloat", "function" );
+ PROPERTY[p++] = new Property( "this", "escape", "function" );
+ PROPERTY[p++] = new Property( "this", "unescape", "function" );
+ PROPERTY[p++] = new Property( "this", "isNaN", "function" );
+ PROPERTY[p++] = new Property( "this", "isFinite", "function" );
+ PROPERTY[p++] = new Property( "this", "Object", "function" );
+ PROPERTY[p++] = new Property( "this", "Number", "function" );
+ PROPERTY[p++] = new Property( "this", "Function", "function" );
+ PROPERTY[p++] = new Property( "this", "Array", "function" );
+ PROPERTY[p++] = new Property( "this", "String", "function" );
+ PROPERTY[p++] = new Property( "this", "Boolean", "function" );
+ PROPERTY[p++] = new Property( "this", "Date", "function" );
+ PROPERTY[p++] = new Property( "this", "Math", "object" );
+
+ // properties and methods of Object objects
+
+ PROPERTY[p++] = new Property( "Object", "prototype", "object" );
+ PROPERTY[p++] = new Property( "Object", "toString", "function" );
+ PROPERTY[p++] = new Property( "Object", "valueOf", "function" );
+ PROPERTY[p++] = new Property( "Object", "constructor", "function" );
+
+ // properties of the Function object
+
+ PROPERTY[p++] = new Property( "Function", "prototype", "function" );
+ PROPERTY[p++] = new Property( "Function.prototype", "toString", "function" );
+ PROPERTY[p++] = new Property( "Function.prototype", "length", "number" );
+ PROPERTY[p++] = new Property( "Function.prototype", "valueOf", "function" );
+
+ Function.prototype.myProperty = "hi";
+
+ PROPERTY[p++] = new Property( "Function.prototype", "myProperty", "string" );
+
+ // properties of the Array object
+ PROPERTY[p++] = new Property( "Array", "prototype", "object" );
+ PROPERTY[p++] = new Property( "Array", "length", "number" );
+ PROPERTY[p++] = new Property( "Array.prototype", "constructor", "function" );
+ PROPERTY[p++] = new Property( "Array.prototype", "toString", "function" );
+ PROPERTY[p++] = new Property( "Array.prototype", "join", "function" );
+ PROPERTY[p++] = new Property( "Array.prototype", "reverse", "function" );
+ PROPERTY[p++] = new Property( "Array.prototype", "sort", "function" );
+
+ // properties of the String object
+ PROPERTY[p++] = new Property( "String", "prototype", "object" );
+ PROPERTY[p++] = new Property( "String", "fromCharCode", "function" );
+ PROPERTY[p++] = new Property( "String.prototype", "toString", "function" );
+ PROPERTY[p++] = new Property( "String.prototype", "constructor", "function" );
+ PROPERTY[p++] = new Property( "String.prototype", "valueOf", "function" );
+ PROPERTY[p++] = new Property( "String.prototype", "charAt", "function" );
+ PROPERTY[p++] = new Property( "String.prototype", "charCodeAt", "function" );
+ PROPERTY[p++] = new Property( "String.prototype", "indexOf", "function" );
+ PROPERTY[p++] = new Property( "String.prototype", "lastIndexOf", "function" );
+ PROPERTY[p++] = new Property( "String.prototype", "split", "function" );
+ PROPERTY[p++] = new Property( "String.prototype", "substring", "function" );
+ PROPERTY[p++] = new Property( "String.prototype", "toLowerCase", "function" );
+ PROPERTY[p++] = new Property( "String.prototype", "toUpperCase", "function" );
+ PROPERTY[p++] = new Property( "String.prototype", "length", "number" );
+
+ // properties of the Boolean object
+ PROPERTY[p++] = new Property( "Boolean", "prototype", "object" );
+ PROPERTY[p++] = new Property( "Boolean", "constructor", "function" );
+ PROPERTY[p++] = new Property( "Boolean.prototype", "valueOf", "function" );
+ PROPERTY[p++] = new Property( "Boolean.prototype", "toString", "function" );
+
+ // properties of the Number object
+
+ PROPERTY[p++] = new Property( "Number", "MAX_VALUE", "number" );
+ PROPERTY[p++] = new Property( "Number", "MIN_VALUE", "number" );
+ PROPERTY[p++] = new Property( "Number", "NaN", "number" );
+ PROPERTY[p++] = new Property( "Number", "NEGATIVE_INFINITY", "number" );
+ PROPERTY[p++] = new Property( "Number", "POSITIVE_INFINITY", "number" );
+ PROPERTY[p++] = new Property( "Number.prototype", "toString", "function" );
+ PROPERTY[p++] = new Property( "Number.prototype", "constructor", "function" );
+ PROPERTY[p++] = new Property( "Number.prototype", "valueOf", "function" );
+
+ // properties of the Math Object.
+ PROPERTY[p++] = new Property( "Math", "E", "number" );
+ PROPERTY[p++] = new Property( "Math", "LN10", "number" );
+ PROPERTY[p++] = new Property( "Math", "LN2", "number" );
+ PROPERTY[p++] = new Property( "Math", "LOG2E", "number" );
+ PROPERTY[p++] = new Property( "Math", "LOG10E", "number" );
+ PROPERTY[p++] = new Property( "Math", "PI", "number" );
+ PROPERTY[p++] = new Property( "Math", "SQRT1_2", "number" );
+ PROPERTY[p++] = new Property( "Math", "SQRT2", "number" );
+ PROPERTY[p++] = new Property( "Math", "abs", "function" );
+ PROPERTY[p++] = new Property( "Math", "acos", "function" );
+ PROPERTY[p++] = new Property( "Math", "asin", "function" );
+ PROPERTY[p++] = new Property( "Math", "atan", "function" );
+ PROPERTY[p++] = new Property( "Math", "atan2", "function" );
+ PROPERTY[p++] = new Property( "Math", "ceil", "function" );
+ PROPERTY[p++] = new Property( "Math", "cos", "function" );
+ PROPERTY[p++] = new Property( "Math", "exp", "function" );
+ PROPERTY[p++] = new Property( "Math", "floor", "function" );
+ PROPERTY[p++] = new Property( "Math", "log", "function" );
+ PROPERTY[p++] = new Property( "Math", "max", "function" );
+ PROPERTY[p++] = new Property( "Math", "min", "function" );
+ PROPERTY[p++] = new Property( "Math", "pow", "function" );
+ PROPERTY[p++] = new Property( "Math", "random", "function" );
+ PROPERTY[p++] = new Property( "Math", "round", "function" );
+ PROPERTY[p++] = new Property( "Math", "sin", "function" );
+ PROPERTY[p++] = new Property( "Math", "sqrt", "function" );
+ PROPERTY[p++] = new Property( "Math", "tan", "function" );
+
+ // properties of the Date object
+ PROPERTY[p++] = new Property( "Date", "parse", "function" );
+ PROPERTY[p++] = new Property( "Date", "prototype", "object" );
+ PROPERTY[p++] = new Property( "Date", "UTC", "function" );
+ PROPERTY[p++] = new Property( "Date.prototype", "constructor", "function" );
+ PROPERTY[p++] = new Property( "Date.prototype", "toString", "function" );
+ PROPERTY[p++] = new Property( "Date.prototype", "valueOf", "function" );
+ PROPERTY[p++] = new Property( "Date.prototype", "getTime", "function" );
+ PROPERTY[p++] = new Property( "Date.prototype", "getYear", "function" );
+ PROPERTY[p++] = new Property( "Date.prototype", "getFullYear", "function" );
+ PROPERTY[p++] = new Property( "Date.prototype", "getUTCFullYear", "function" );
+ PROPERTY[p++] = new Property( "Date.prototype", "getMonth", "function" );
+ PROPERTY[p++] = new Property( "Date.prototype", "getUTCMonth", "function" );
+ PROPERTY[p++] = new Property( "Date.prototype", "getDate", "function" );
+ PROPERTY[p++] = new Property( "Date.prototype", "getUTCDate", "function" );
+ PROPERTY[p++] = new Property( "Date.prototype", "getDay", "function" );
+ PROPERTY[p++] = new Property( "Date.prototype", "getUTCDay", "function" );
+ PROPERTY[p++] = new Property( "Date.prototype", "getHours", "function" );
+ PROPERTY[p++] = new Property( "Date.prototype", "getUTCHours", "function" );
+ PROPERTY[p++] = new Property( "Date.prototype", "getMinutes", "function" );
+ PROPERTY[p++] = new Property( "Date.prototype", "getUTCMinutes", "function" );
+ PROPERTY[p++] = new Property( "Date.prototype", "getSeconds", "function" );
+ PROPERTY[p++] = new Property( "Date.prototype", "getUTCSeconds", "function" );
+ PROPERTY[p++] = new Property( "Date.prototype", "getMilliseconds","function" );
+ PROPERTY[p++] = new Property( "Date.prototype", "getUTCMilliseconds", "function" );
+ PROPERTY[p++] = new Property( "Date.prototype", "setTime", "function" );
+ PROPERTY[p++] = new Property( "Date.prototype", "setMilliseconds","function" );
+ PROPERTY[p++] = new Property( "Date.prototype", "setUTCMilliseconds", "function" );
+ PROPERTY[p++] = new Property( "Date.prototype", "setSeconds", "function" );
+ PROPERTY[p++] = new Property( "Date.prototype", "setUTCSeconds", "function" );
+ PROPERTY[p++] = new Property( "Date.prototype", "setMinutes", "function" );
+ PROPERTY[p++] = new Property( "Date.prototype", "setUTCMinutes", "function" );
+ PROPERTY[p++] = new Property( "Date.prototype", "setHours", "function" );
+ PROPERTY[p++] = new Property( "Date.prototype", "setUTCHours", "function" );
+ PROPERTY[p++] = new Property( "Date.prototype", "setDate", "function" );
+ PROPERTY[p++] = new Property( "Date.prototype", "setUTCDate", "function" );
+ PROPERTY[p++] = new Property( "Date.prototype", "setMonth", "function" );
+ PROPERTY[p++] = new Property( "Date.prototype", "setUTCMonth", "function" );
+ PROPERTY[p++] = new Property( "Date.prototype", "setFullYear", "function" );
+ PROPERTY[p++] = new Property( "Date.prototype", "setUTCFullYear", "function" );
+ PROPERTY[p++] = new Property( "Date.prototype", "setYear", "function" );
+ PROPERTY[p++] = new Property( "Date.prototype", "toLocaleString", "function" );
+ PROPERTY[p++] = new Property( "Date.prototype", "toUTCString", "function" );
+ PROPERTY[p++] = new Property( "Date.prototype", "toGMTString", "function" );
+
+ for ( var i = 0, RESULT; i < PROPERTY.length; i++ ) {
+ RESULT = eval("typeof " + PROPERTY[i].object + "." + PROPERTY[i].name );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "typeof " + PROPERTY[i].object + "." + PROPERTY[i].name,
+ PROPERTY[i].type,
+ RESULT );
+
+ RESULT = eval("typeof " + PROPERTY[i].object + "['" + PROPERTY[i].name +"']");
+
+ testcases[tc++] = new TestCase( SECTION,
+ "typeof " + PROPERTY[i].object + "['" + PROPERTY[i].name +"']",
+ PROPERTY[i].type,
+ RESULT );
+ }
+
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function MyObject( arg0, arg1, arg2, arg3, arg4 ) {
+ this.name = arg0;
+}
+function Property( object, name, type ) {
+ this.object = object;
+ this.name = name;
+ this.type = type;
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.1-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.1-2.js
new file mode 100644
index 0000000..fa3056b
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.1-2.js
@@ -0,0 +1,124 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 11.2.1-2.js
+ ECMA Section: 11.2.1 Property Accessors
+ Description:
+
+ Properties are accessed by name, using either the dot notation:
+ MemberExpression . Identifier
+ CallExpression . Identifier
+
+ or the bracket notation: MemberExpression [ Expression ]
+ CallExpression [ Expression ]
+
+ The dot notation is explained by the following syntactic conversion:
+ MemberExpression . Identifier
+ is identical in its behavior to
+ MemberExpression [ <identifier-string> ]
+ and similarly
+ CallExpression . Identifier
+ is identical in its behavior to
+ CallExpression [ <identifier-string> ]
+ where <identifier-string> is a string literal containing the same sequence
+ of characters as the Identifier.
+
+ The production MemberExpression : MemberExpression [ Expression ] is
+ evaluated as follows:
+
+ 1. Evaluate MemberExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate Expression.
+ 4. Call GetValue(Result(3)).
+ 5. Call ToObject(Result(2)).
+ 6. Call ToString(Result(4)).
+ 7. Return a value of type Reference whose base object is Result(5) and
+ whose property name is Result(6).
+
+ The production CallExpression : CallExpression [ Expression ] is evaluated
+ in exactly the same manner, except that the contained CallExpression is
+ evaluated in step 1.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "11.2.1-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Property Accessors";
+ writeHeaderToLog( SECTION + " "+TITLE );
+
+ var testcases = new Array();
+
+ // go through all Native Function objects, methods, and properties and get their typeof.
+
+ var PROPERTY = new Array();
+ var p = 0;
+
+ // try to access properties of primitive types
+
+ PROPERTY[p++] = new Property( "\"hi\"", "hi", "hi", NaN );
+ PROPERTY[p++] = new Property( NaN, NaN, "NaN", NaN );
+// PROPERTY[p++] = new Property( 3, 3, "3", 3 );
+ PROPERTY[p++] = new Property( true, true, "true", 1 );
+ PROPERTY[p++] = new Property( false, false, "false", 0 );
+
+ for ( var i = 0, RESULT; i < PROPERTY.length; i++ ) {
+ testcases[tc++] = new TestCase( SECTION,
+ PROPERTY[i].object + ".valueOf()",
+ PROPERTY[i].value,
+ eval( PROPERTY[i].object+ ".valueOf()" ) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ PROPERTY[i].object + ".toString()",
+ PROPERTY[i].string,
+ eval( PROPERTY[i].object+ ".toString()" ) );
+
+ }
+
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function MyObject( value ) {
+ this.value = value;
+ this.stringValue = value +"";
+ this.numberValue = Number(value);
+ return this;
+}
+function Property( object, value, string, number ) {
+ this.object = object;
+ this.string = String(value);
+ this.number = Number(value);
+ this.value = value;
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.1-3-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.1-3-n.js
new file mode 100644
index 0000000..f84bb28
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.1-3-n.js
@@ -0,0 +1,120 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 11.2.1-2.js
+ ECMA Section: 11.2.1 Property Accessors
+ Description:
+
+ Properties are accessed by name, using either the dot notation:
+ MemberExpression . Identifier
+ CallExpression . Identifier
+
+ or the bracket notation: MemberExpression [ Expression ]
+ CallExpression [ Expression ]
+
+ The dot notation is explained by the following syntactic conversion:
+ MemberExpression . Identifier
+ is identical in its behavior to
+ MemberExpression [ <identifier-string> ]
+ and similarly
+ CallExpression . Identifier
+ is identical in its behavior to
+ CallExpression [ <identifier-string> ]
+ where <identifier-string> is a string literal containing the same sequence
+ of characters as the Identifier.
+
+ The production MemberExpression : MemberExpression [ Expression ] is
+ evaluated as follows:
+
+ 1. Evaluate MemberExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate Expression.
+ 4. Call GetValue(Result(3)).
+ 5. Call ToObject(Result(2)).
+ 6. Call ToString(Result(4)).
+ 7. Return a value of type Reference whose base object is Result(5) and
+ whose property name is Result(6).
+
+ The production CallExpression : CallExpression [ Expression ] is evaluated
+ in exactly the same manner, except that the contained CallExpression is
+ evaluated in step 1.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "11.2.1-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Property Accessors";
+ writeHeaderToLog( SECTION + " "+TITLE );
+
+ var testcases = new Array();
+
+ // go through all Native Function objects, methods, and properties and get their typeof.
+
+ var PROPERTY = new Array();
+ var p = 0;
+
+ // try to access properties of primitive types
+
+ PROPERTY[p++] = new Property( "undefined", void 0, "undefined", NaN );
+
+ for ( var i = 0, RESULT; i < PROPERTY.length; i++ ) {
+ testcases[tc++] = new TestCase( SECTION,
+ PROPERTY[i].object + ".valueOf()",
+ PROPERTY[i].value,
+ eval( PROPERTY[i].object+ ".valueOf()" ) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ PROPERTY[i].object + ".toString()",
+ PROPERTY[i].string,
+ eval( PROPERTY[i].object+ ".toString()" ) );
+
+ }
+
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function MyObject( value ) {
+ this.value = value;
+ this.stringValue = value +"";
+ this.numberValue = Number(value);
+ return this;
+}
+function Property( object, value, string, number ) {
+ this.object = object;
+ this.string = String(value);
+ this.number = Number(value);
+ this.value = value;
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.1-4-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.1-4-n.js
new file mode 100644
index 0000000..0127253
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.1-4-n.js
@@ -0,0 +1,120 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 11.2.1-4-n.js
+ ECMA Section: 11.2.1 Property Accessors
+ Description:
+
+ Properties are accessed by name, using either the dot notation:
+ MemberExpression . Identifier
+ CallExpression . Identifier
+
+ or the bracket notation: MemberExpression [ Expression ]
+ CallExpression [ Expression ]
+
+ The dot notation is explained by the following syntactic conversion:
+ MemberExpression . Identifier
+ is identical in its behavior to
+ MemberExpression [ <identifier-string> ]
+ and similarly
+ CallExpression . Identifier
+ is identical in its behavior to
+ CallExpression [ <identifier-string> ]
+ where <identifier-string> is a string literal containing the same sequence
+ of characters as the Identifier.
+
+ The production MemberExpression : MemberExpression [ Expression ] is
+ evaluated as follows:
+
+ 1. Evaluate MemberExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate Expression.
+ 4. Call GetValue(Result(3)).
+ 5. Call ToObject(Result(2)).
+ 6. Call ToString(Result(4)).
+ 7. Return a value of type Reference whose base object is Result(5) and
+ whose property name is Result(6).
+
+ The production CallExpression : CallExpression [ Expression ] is evaluated
+ in exactly the same manner, except that the contained CallExpression is
+ evaluated in step 1.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "11.2.1-4-n";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Property Accessors";
+ writeHeaderToLog( SECTION + " "+TITLE );
+
+ var testcases = new Array();
+
+ // go through all Native Function objects, methods, and properties and get their typeof.
+
+ var PROPERTY = new Array();
+ var p = 0;
+
+ // try to access properties of primitive types
+
+ PROPERTY[p++] = new Property( "null", null, "null", 0 );
+
+ for ( var i = 0, RESULT; i < PROPERTY.length; i++ ) {
+ testcases[tc++] = new TestCase( SECTION,
+ PROPERTY[i].object + ".valueOf()",
+ PROPERTY[i].value,
+ eval( PROPERTY[i].object+ ".valueOf()" ) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ PROPERTY[i].object + ".toString()",
+ PROPERTY[i].string,
+ eval( PROPERTY[i].object+ ".toString()" ) );
+
+ }
+
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function MyObject( value ) {
+ this.value = value;
+ this.stringValue = value +"";
+ this.numberValue = Number(value);
+ return this;
+}
+function Property( object, value, string, number ) {
+ this.object = object;
+ this.string = String(value);
+ this.number = Number(value);
+ this.value = value;
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.1-5.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.1-5.js
new file mode 100644
index 0000000..0cb19c9
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.1-5.js
@@ -0,0 +1,124 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 11.2.1-5.js
+ ECMA Section: 11.2.1 Property Accessors
+ Description:
+
+ Properties are accessed by name, using either the dot notation:
+ MemberExpression . Identifier
+ CallExpression . Identifier
+
+ or the bracket notation: MemberExpression [ Expression ]
+ CallExpression [ Expression ]
+
+ The dot notation is explained by the following syntactic conversion:
+ MemberExpression . Identifier
+ is identical in its behavior to
+ MemberExpression [ <identifier-string> ]
+ and similarly
+ CallExpression . Identifier
+ is identical in its behavior to
+ CallExpression [ <identifier-string> ]
+ where <identifier-string> is a string literal containing the same sequence
+ of characters as the Identifier.
+
+ The production MemberExpression : MemberExpression [ Expression ] is
+ evaluated as follows:
+
+ 1. Evaluate MemberExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate Expression.
+ 4. Call GetValue(Result(3)).
+ 5. Call ToObject(Result(2)).
+ 6. Call ToString(Result(4)).
+ 7. Return a value of type Reference whose base object is Result(5) and
+ whose property name is Result(6).
+
+ The production CallExpression : CallExpression [ Expression ] is evaluated
+ in exactly the same manner, except that the contained CallExpression is
+ evaluated in step 1.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "11.2.1-5";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Property Accessors";
+ writeHeaderToLog( SECTION + " "+TITLE );
+
+ var testcases = new Array();
+
+ // go through all Native Function objects, methods, and properties and get their typeof.
+
+ var PROPERTY = new Array();
+ var p = 0;
+
+ // try to access properties of primitive types
+
+ PROPERTY[p++] = new Property( new String("hi"), "hi", "hi", NaN );
+ PROPERTY[p++] = new Property( new Number(NaN), NaN, "NaN", NaN );
+ PROPERTY[p++] = new Property( new Number(3), 3, "3", 3 );
+ PROPERTY[p++] = new Property( new Boolean(true), true, "true", 1 );
+ PROPERTY[p++] = new Property( new Boolean(false), false, "false", 0 );
+
+ for ( var i = 0, RESULT; i < PROPERTY.length; i++ ) {
+ testcases[tc++] = new TestCase( SECTION,
+ PROPERTY[i].object + ".valueOf()",
+ PROPERTY[i].value,
+ eval( "PROPERTY[i].object.valueOf()" ) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ PROPERTY[i].object + ".toString()",
+ PROPERTY[i].string,
+ eval( "PROPERTY[i].object.toString()" ) );
+
+ }
+
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function MyObject( value ) {
+ this.value = value;
+ this.stringValue = value +"";
+ this.numberValue = Number(value);
+ return this;
+}
+function Property( object, value, string, number ) {
+ this.object = object;
+ this.string = String(value);
+ this.number = Number(value);
+ this.value = value;
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-1-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-1-n.js
new file mode 100644
index 0000000..db73cad
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-1-n.js
@@ -0,0 +1,98 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 11.2.2-1.js
+ ECMA Section: 11.2.2. The new operator
+ Description:
+
+ MemberExpression:
+ PrimaryExpression
+ MemberExpression[Expression]
+ MemberExpression.Identifier
+ new MemberExpression Arguments
+
+ new NewExpression
+
+ The production NewExpression : new NewExpression is evaluated as follows:
+
+ 1. Evaluate NewExpression.
+ 2. Call GetValue(Result(1)).
+ 3. If Type(Result(2)) is not Object, generate a runtime error.
+ 4. If Result(2) does not implement the internal [[Construct]] method,
+ generate a runtime error.
+ 5. Call the [[Construct]] method on Result(2), providing no arguments
+ (that is, an empty list of arguments).
+ 6. If Type(Result(5)) is not Object, generate a runtime error.
+ 7. Return Result(5).
+
+ The production MemberExpression : new MemberExpression Arguments is evaluated as follows:
+
+ 1. Evaluate MemberExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate Arguments, producing an internal list of argument values
+ (section 0).
+ 4. If Type(Result(2)) is not Object, generate a runtime error.
+ 5. If Result(2) does not implement the internal [[Construct]] method,
+ generate a runtime error.
+ 6. Call the [[Construct]] method on Result(2), providing the list
+ Result(3) as the argument values.
+ 7. If Type(Result(6)) is not Object, generate a runtime error.
+ 8 .Return Result(6).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "11.2.2-1-n.js";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "The new operator";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+
+ var OBJECT = new Object();
+
+ testcases[tc++] = new TestCase( SECTION,
+ "OBJECT = new Object; var o = new OBJECT()",
+ "error",
+ o = new OBJECT() );
+ test();
+
+function TestFunction() {
+ return arguments;
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-1.js
new file mode 100644
index 0000000..48c2e6a
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-1.js
@@ -0,0 +1,99 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 11.2.2-1.js
+ ECMA Section: 11.2.2. The new operator
+ Description:
+
+ MemberExpression:
+ PrimaryExpression
+ MemberExpression[Expression]
+ MemberExpression.Identifier
+ new MemberExpression Arguments
+
+ new NewExpression
+
+ The production NewExpression : new NewExpression is evaluated as follows:
+
+ 1. Evaluate NewExpression.
+ 2. Call GetValue(Result(1)).
+ 3. If Type(Result(2)) is not Object, generate a runtime error.
+ 4. If Result(2) does not implement the internal [[Construct]] method,
+ generate a runtime error.
+ 5. Call the [[Construct]] method on Result(2), providing no arguments
+ (that is, an empty list of arguments).
+ 6. If Type(Result(5)) is not Object, generate a runtime error.
+ 7. Return Result(5).
+
+ The production MemberExpression : new MemberExpression Arguments is evaluated as follows:
+
+ 1. Evaluate MemberExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate Arguments, producing an internal list of argument values
+ (section 0).
+ 4. If Type(Result(2)) is not Object, generate a runtime error.
+ 5. If Result(2) does not implement the internal [[Construct]] method,
+ generate a runtime error.
+ 6. Call the [[Construct]] method on Result(2), providing the list
+ Result(3) as the argument values.
+ 7. If Type(Result(6)) is not Object, generate a runtime error.
+ 8 .Return Result(6).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "11.2.2-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "The new operator";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new TestFunction(0,1,2,3,4,5)).length",
+ 6,
+ (new TestFunction(0,1,2,3,4,5)).length );
+
+
+
+ test();
+
+function TestFunction() {
+ return arguments;
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-10-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-10-n.js
new file mode 100644
index 0000000..619554d
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-10-n.js
@@ -0,0 +1,96 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 11.2.2-9-n.js
+ ECMA Section: 11.2.2. The new operator
+ Description:
+
+ MemberExpression:
+ PrimaryExpression
+ MemberExpression[Expression]
+ MemberExpression.Identifier
+ new MemberExpression Arguments
+
+ new NewExpression
+
+ The production NewExpression : new NewExpression is evaluated as follows:
+
+ 1. Evaluate NewExpression.
+ 2. Call GetValue(Result(1)).
+ 3. If Type(Result(2)) is not Object, generate a runtime error.
+ 4. If Result(2) does not implement the internal [[Construct]] method,
+ generate a runtime error.
+ 5. Call the [[Construct]] method on Result(2), providing no arguments
+ (that is, an empty list of arguments).
+ 6. If Type(Result(5)) is not Object, generate a runtime error.
+ 7. Return Result(5).
+
+ The production MemberExpression : new MemberExpression Arguments is evaluated as follows:
+
+ 1. Evaluate MemberExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate Arguments, producing an internal list of argument values
+ (section 0).
+ 4. If Type(Result(2)) is not Object, generate a runtime error.
+ 5. If Result(2) does not implement the internal [[Construct]] method,
+ generate a runtime error.
+ 6. Call the [[Construct]] method on Result(2), providing the list
+ Result(3) as the argument values.
+ 7. If Type(Result(6)) is not Object, generate a runtime error.
+ 8 .Return Result(6).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "11.2.2-9-n.js";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "The new operator";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+
+ testcases[tc++] = new TestCase( SECTION,
+ "var m = new Math()",
+ "error",
+ m = new Math() );
+ test();
+
+function TestFunction() {
+ return arguments;
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-11.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-11.js
new file mode 100644
index 0000000..a6f7364
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-11.js
@@ -0,0 +1,99 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 11.2.2-9-n.js
+ ECMA Section: 11.2.2. The new operator
+ Description:
+
+ MemberExpression:
+ PrimaryExpression
+ MemberExpression[Expression]
+ MemberExpression.Identifier
+ new MemberExpression Arguments
+
+ new NewExpression
+
+ The production NewExpression : new NewExpression is evaluated as follows:
+
+ 1. Evaluate NewExpression.
+ 2. Call GetValue(Result(1)).
+ 3. If Type(Result(2)) is not Object, generate a runtime error.
+ 4. If Result(2) does not implement the internal [[Construct]] method,
+ generate a runtime error.
+ 5. Call the [[Construct]] method on Result(2), providing no arguments
+ (that is, an empty list of arguments).
+ 6. If Type(Result(5)) is not Object, generate a runtime error.
+ 7. Return Result(5).
+
+ The production MemberExpression : new MemberExpression Arguments is evaluated as follows:
+
+ 1. Evaluate MemberExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate Arguments, producing an internal list of argument values
+ (section 0).
+ 4. If Type(Result(2)) is not Object, generate a runtime error.
+ 5. If Result(2) does not implement the internal [[Construct]] method,
+ generate a runtime error.
+ 6. Call the [[Construct]] method on Result(2), providing the list
+ Result(3) as the argument values.
+ 7. If Type(Result(6)) is not Object, generate a runtime error.
+ 8 Return Result(6).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "11.2.2-9-n.js";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "The new operator";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var FUNCTION = new Function();
+
+ testcases[tc++] = new TestCase( SECTION,
+ "var FUNCTION = new Function(); f = new FUNCTION(); typeof f",
+ "object",
+ eval("var FUNCTION = new Function(); f = new FUNCTION(); typeof f") );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "var FUNCTION = new Function('return this'); f = new FUNCTION(); typeof f",
+ "object",
+ eval("var FUNCTION = new Function('return this'); f = new FUNCTION(); typeof f") );
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-2-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-2-n.js
new file mode 100644
index 0000000..4e74cd4
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-2-n.js
@@ -0,0 +1,98 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 11.2.2-2.js
+ ECMA Section: 11.2.2. The new operator
+ Description:
+
+ MemberExpression:
+ PrimaryExpression
+ MemberExpression[Expression]
+ MemberExpression.Identifier
+ new MemberExpression Arguments
+
+ new NewExpression
+
+ The production NewExpression : new NewExpression is evaluated as follows:
+
+ 1. Evaluate NewExpression.
+ 2. Call GetValue(Result(1)).
+ 3. If Type(Result(2)) is not Object, generate a runtime error.
+ 4. If Result(2) does not implement the internal [[Construct]] method,
+ generate a runtime error.
+ 5. Call the [[Construct]] method on Result(2), providing no arguments
+ (that is, an empty list of arguments).
+ 6. If Type(Result(5)) is not Object, generate a runtime error.
+ 7. Return Result(5).
+
+ The production MemberExpression : new MemberExpression Arguments is evaluated as follows:
+
+ 1. Evaluate MemberExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate Arguments, producing an internal list of argument values
+ (section 0).
+ 4. If Type(Result(2)) is not Object, generate a runtime error.
+ 5. If Result(2) does not implement the internal [[Construct]] method,
+ generate a runtime error.
+ 6. Call the [[Construct]] method on Result(2), providing the list
+ Result(3) as the argument values.
+ 7. If Type(Result(6)) is not Object, generate a runtime error.
+ 8 .Return Result(6).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "11.2.2-2-n.js";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "The new operator";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+
+ var UNDEFINED = void 0;
+
+ testcases[tc++] = new TestCase( SECTION,
+ "UNDEFINED = void 0; var o = new UNDEFINED()",
+ "error",
+ o = new UNDEFINED() );
+ test();
+
+function TestFunction() {
+ return arguments;
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-3-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-3-n.js
new file mode 100644
index 0000000..2c6b509
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-3-n.js
@@ -0,0 +1,98 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 11.2.2-3-n.js
+ ECMA Section: 11.2.2. The new operator
+ Description:
+
+ MemberExpression:
+ PrimaryExpression
+ MemberExpression[Expression]
+ MemberExpression.Identifier
+ new MemberExpression Arguments
+
+ new NewExpression
+
+ The production NewExpression : new NewExpression is evaluated as follows:
+
+ 1. Evaluate NewExpression.
+ 2. Call GetValue(Result(1)).
+ 3. If Type(Result(2)) is not Object, generate a runtime error.
+ 4. If Result(2) does not implement the internal [[Construct]] method,
+ generate a runtime error.
+ 5. Call the [[Construct]] method on Result(2), providing no arguments
+ (that is, an empty list of arguments).
+ 6. If Type(Result(5)) is not Object, generate a runtime error.
+ 7. Return Result(5).
+
+ The production MemberExpression : new MemberExpression Arguments is evaluated as follows:
+
+ 1. Evaluate MemberExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate Arguments, producing an internal list of argument values
+ (section 0).
+ 4. If Type(Result(2)) is not Object, generate a runtime error.
+ 5. If Result(2) does not implement the internal [[Construct]] method,
+ generate a runtime error.
+ 6. Call the [[Construct]] method on Result(2), providing the list
+ Result(3) as the argument values.
+ 7. If Type(Result(6)) is not Object, generate a runtime error.
+ 8 .Return Result(6).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "11.2.2-3-n.js";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "The new operator";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+
+ var NULL = null;
+
+ testcases[tc++] = new TestCase( SECTION,
+ "NULL = null; var o = new NULL()",
+ "error",
+ o = new NULL() );
+ test();
+
+function TestFunction() {
+ return arguments;
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-4-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-4-n.js
new file mode 100644
index 0000000..a9e5f4a
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-4-n.js
@@ -0,0 +1,98 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 11.2.2-4-n.js
+ ECMA Section: 11.2.2. The new operator
+ Description:
+
+ MemberExpression:
+ PrimaryExpression
+ MemberExpression[Expression]
+ MemberExpression.Identifier
+ new MemberExpression Arguments
+
+ new NewExpression
+
+ The production NewExpression : new NewExpression is evaluated as follows:
+
+ 1. Evaluate NewExpression.
+ 2. Call GetValue(Result(1)).
+ 3. If Type(Result(2)) is not Object, generate a runtime error.
+ 4. If Result(2) does not implement the internal [[Construct]] method,
+ generate a runtime error.
+ 5. Call the [[Construct]] method on Result(2), providing no arguments
+ (that is, an empty list of arguments).
+ 6. If Type(Result(5)) is not Object, generate a runtime error.
+ 7. Return Result(5).
+
+ The production MemberExpression : new MemberExpression Arguments is evaluated as follows:
+
+ 1. Evaluate MemberExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate Arguments, producing an internal list of argument values
+ (section 0).
+ 4. If Type(Result(2)) is not Object, generate a runtime error.
+ 5. If Result(2) does not implement the internal [[Construct]] method,
+ generate a runtime error.
+ 6. Call the [[Construct]] method on Result(2), providing the list
+ Result(3) as the argument values.
+ 7. If Type(Result(6)) is not Object, generate a runtime error.
+ 8 .Return Result(6).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "11.2.2-4-n.js";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "The new operator";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+
+ var STRING = "";
+
+ testcases[tc++] = new TestCase( SECTION,
+ "STRING = '', var s = new STRING()",
+ "error",
+ s = new STRING() );
+ test();
+
+function TestFunction() {
+ return arguments;
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-5-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-5-n.js
new file mode 100644
index 0000000..304f1d3
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-5-n.js
@@ -0,0 +1,98 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 11.2.2-5-n.js
+ ECMA Section: 11.2.2. The new operator
+ Description:
+
+ MemberExpression:
+ PrimaryExpression
+ MemberExpression[Expression]
+ MemberExpression.Identifier
+ new MemberExpression Arguments
+
+ new NewExpression
+
+ The production NewExpression : new NewExpression is evaluated as follows:
+
+ 1. Evaluate NewExpression.
+ 2. Call GetValue(Result(1)).
+ 3. If Type(Result(2)) is not Object, generate a runtime error.
+ 4. If Result(2) does not implement the internal [[Construct]] method,
+ generate a runtime error.
+ 5. Call the [[Construct]] method on Result(2), providing no arguments
+ (that is, an empty list of arguments).
+ 6. If Type(Result(5)) is not Object, generate a runtime error.
+ 7. Return Result(5).
+
+ The production MemberExpression : new MemberExpression Arguments is evaluated as follows:
+
+ 1. Evaluate MemberExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate Arguments, producing an internal list of argument values
+ (section 0).
+ 4. If Type(Result(2)) is not Object, generate a runtime error.
+ 5. If Result(2) does not implement the internal [[Construct]] method,
+ generate a runtime error.
+ 6. Call the [[Construct]] method on Result(2), providing the list
+ Result(3) as the argument values.
+ 7. If Type(Result(6)) is not Object, generate a runtime error.
+ 8 .Return Result(6).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "11.2.2-5-n.js";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "The new operator";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+
+ var NUMBER = 0;
+
+ testcases[tc++] = new TestCase( SECTION,
+ "NUMBER=0, var n = new NUMBER()",
+ "error",
+ n = new NUMBER() );
+ test();
+
+function TestFunction() {
+ return arguments;
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-6-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-6-n.js
new file mode 100644
index 0000000..fd24e4f
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-6-n.js
@@ -0,0 +1,81 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 11.2.2-6-n.js
+ ECMA Section: 11.2.2. The new operator
+ Description:
+
+ MemberExpression:
+ PrimaryExpression
+ MemberExpression[Expression]
+ MemberExpression.Identifier
+ new MemberExpression Arguments
+
+ new NewExpression
+
+ The production NewExpression : new NewExpression is evaluated as follows:
+
+ 1. Evaluate NewExpression.
+ 2. Call GetValue(Result(1)).
+ 3. If Type(Result(2)) is not Object, generate a runtime error.
+ 4. If Result(2) does not implement the internal [[Construct]] method,
+ generate a runtime error.
+ 5. Call the [[Construct]] method on Result(2), providing no arguments
+ (that is, an empty list of arguments).
+ 6. If Type(Result(5)) is not Object, generate a runtime error.
+ 7. Return Result(5).
+
+ The production MemberExpression : new MemberExpression Arguments is evaluated as follows:
+
+ 1. Evaluate MemberExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate Arguments, producing an internal list of argument values
+ (section 0).
+ 4. If Type(Result(2)) is not Object, generate a runtime error.
+ 5. If Result(2) does not implement the internal [[Construct]] method,
+ generate a runtime error.
+ 6. Call the [[Construct]] method on Result(2), providing the list
+ Result(3) as the argument values.
+ 7. If Type(Result(6)) is not Object, generate a runtime error.
+ 8 .Return Result(6).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "11.2.2-6-n.js";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "The new operator";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var BOOLEAN = true;
+
+ testcases[tc++] = new TestCase( SECTION,
+ "BOOLEAN = true; var b = new BOOLEAN()",
+ "error",
+ b = new BOOLEAN() );
+ test();
+
+function TestFunction() {
+ return arguments;
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-7-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-7-n.js
new file mode 100644
index 0000000..4a54726
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-7-n.js
@@ -0,0 +1,98 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 11.2.2-6-n.js
+ ECMA Section: 11.2.2. The new operator
+ Description:
+
+ MemberExpression:
+ PrimaryExpression
+ MemberExpression[Expression]
+ MemberExpression.Identifier
+ new MemberExpression Arguments
+
+ new NewExpression
+
+ The production NewExpression : new NewExpression is evaluated as follows:
+
+ 1. Evaluate NewExpression.
+ 2. Call GetValue(Result(1)).
+ 3. If Type(Result(2)) is not Object, generate a runtime error.
+ 4. If Result(2) does not implement the internal [[Construct]] method,
+ generate a runtime error.
+ 5. Call the [[Construct]] method on Result(2), providing no arguments
+ (that is, an empty list of arguments).
+ 6. If Type(Result(5)) is not Object, generate a runtime error.
+ 7. Return Result(5).
+
+ The production MemberExpression : new MemberExpression Arguments is evaluated as follows:
+
+ 1. Evaluate MemberExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate Arguments, producing an internal list of argument values
+ (section 0).
+ 4. If Type(Result(2)) is not Object, generate a runtime error.
+ 5. If Result(2) does not implement the internal [[Construct]] method,
+ generate a runtime error.
+ 6. Call the [[Construct]] method on Result(2), providing the list
+ Result(3) as the argument values.
+ 7. If Type(Result(6)) is not Object, generate a runtime error.
+ 8 .Return Result(6).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "11.2.2-6-n.js";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "The new operator";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+
+ var STRING = new String("hi");
+
+ testcases[tc++] = new TestCase( SECTION,
+ "var STRING = new String('hi'); var s = new STRING()",
+ "error",
+ s = new STRING() );
+ test();
+
+function TestFunction() {
+ return arguments;
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-8-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-8-n.js
new file mode 100644
index 0000000..eb58ff5
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-8-n.js
@@ -0,0 +1,98 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 11.2.2-8-n.js
+ ECMA Section: 11.2.2. The new operator
+ Description:
+
+ MemberExpression:
+ PrimaryExpression
+ MemberExpression[Expression]
+ MemberExpression.Identifier
+ new MemberExpression Arguments
+
+ new NewExpression
+
+ The production NewExpression : new NewExpression is evaluated as follows:
+
+ 1. Evaluate NewExpression.
+ 2. Call GetValue(Result(1)).
+ 3. If Type(Result(2)) is not Object, generate a runtime error.
+ 4. If Result(2) does not implement the internal [[Construct]] method,
+ generate a runtime error.
+ 5. Call the [[Construct]] method on Result(2), providing no arguments
+ (that is, an empty list of arguments).
+ 6. If Type(Result(5)) is not Object, generate a runtime error.
+ 7. Return Result(5).
+
+ The production MemberExpression : new MemberExpression Arguments is evaluated as follows:
+
+ 1. Evaluate MemberExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate Arguments, producing an internal list of argument values
+ (section 0).
+ 4. If Type(Result(2)) is not Object, generate a runtime error.
+ 5. If Result(2) does not implement the internal [[Construct]] method,
+ generate a runtime error.
+ 6. Call the [[Construct]] method on Result(2), providing the list
+ Result(3) as the argument values.
+ 7. If Type(Result(6)) is not Object, generate a runtime error.
+ 8 .Return Result(6).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "11.2.2-8-n.js";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "The new operator";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+
+ var NUMBER = new Number(1);
+
+ testcases[tc++] = new TestCase( SECTION,
+ "var NUMBER = new Number(1); var n = new NUMBER()",
+ "error",
+ n = new NUMBER() );
+ test();
+
+function TestFunction() {
+ return arguments;
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-9-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-9-n.js
new file mode 100644
index 0000000..56199cf
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.2-9-n.js
@@ -0,0 +1,98 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 11.2.2-9-n.js
+ ECMA Section: 11.2.2. The new operator
+ Description:
+
+ MemberExpression:
+ PrimaryExpression
+ MemberExpression[Expression]
+ MemberExpression.Identifier
+ new MemberExpression Arguments
+
+ new NewExpression
+
+ The production NewExpression : new NewExpression is evaluated as follows:
+
+ 1. Evaluate NewExpression.
+ 2. Call GetValue(Result(1)).
+ 3. If Type(Result(2)) is not Object, generate a runtime error.
+ 4. If Result(2) does not implement the internal [[Construct]] method,
+ generate a runtime error.
+ 5. Call the [[Construct]] method on Result(2), providing no arguments
+ (that is, an empty list of arguments).
+ 6. If Type(Result(5)) is not Object, generate a runtime error.
+ 7. Return Result(5).
+
+ The production MemberExpression : new MemberExpression Arguments is evaluated as follows:
+
+ 1. Evaluate MemberExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate Arguments, producing an internal list of argument values
+ (section 0).
+ 4. If Type(Result(2)) is not Object, generate a runtime error.
+ 5. If Result(2) does not implement the internal [[Construct]] method,
+ generate a runtime error.
+ 6. Call the [[Construct]] method on Result(2), providing the list
+ Result(3) as the argument values.
+ 7. If Type(Result(6)) is not Object, generate a runtime error.
+ 8 .Return Result(6).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "11.2.2-9-n.js";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "The new operator";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+
+ var BOOLEAN = new Boolean();
+
+ testcases[tc++] = new TestCase( SECTION,
+ "var BOOLEAN = new Boolean(); var b = new BOOLEAN()",
+ "error",
+ b = new BOOLEAN() );
+ test();
+
+function TestFunction() {
+ return arguments;
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.3-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.3-1.js
new file mode 100644
index 0000000..7653900
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.3-1.js
@@ -0,0 +1,121 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 11.2.3-1.js
+ ECMA Section: 11.2.3. Function Calls
+ Description:
+
+ The production CallExpression : MemberExpression Arguments is evaluated as
+ follows:
+
+ 1.Evaluate MemberExpression.
+ 2.Evaluate Arguments, producing an internal list of argument values
+ (section 0).
+ 3.Call GetValue(Result(1)).
+ 4.If Type(Result(3)) is not Object, generate a runtime error.
+ 5.If Result(3) does not implement the internal [[Call]] method, generate a
+ runtime error.
+ 6.If Type(Result(1)) is Reference, Result(6) is GetBase(Result(1)). Otherwise,
+ Result(6) is null.
+ 7.If Result(6) is an activation object, Result(7) is null. Otherwise, Result(7) is
+ the same as Result(6).
+ 8.Call the [[Call]] method on Result(3), providing Result(7) as the this value
+ and providing the list Result(2) as the argument values.
+ 9.Return Result(8).
+
+ The production CallExpression : CallExpression Arguments is evaluated in
+ exactly the same manner, except that the contained CallExpression is
+ evaluated in step 1.
+
+ Note: Result(8) will never be of type Reference if Result(3) is a native
+ ECMAScript object. Whether calling a host object can return a value of
+ type Reference is implementation-dependent.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "11.2.3-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Function Calls";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+/* this.eval() is no longer legal syntax.
+ // MemberExpression : this
+
+ testcases[tc++] = new TestCase( SECTION,
+ "this.eval()",
+ void 0,
+ this.eval() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "this.eval('NaN')",
+ NaN,
+ this.eval("NaN") );
+*/
+ // MemberExpression: Identifier
+
+ var OBJECT = true;
+
+ testcases[tc++] = new TestCase( SECTION,
+ "OBJECT.toString()",
+ "true",
+ OBJECT.toString() );
+
+ // MemberExpression[ Expression]
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Array())['length'].valueOf()",
+ 0,
+ (new Array())["length"].valueOf() );
+
+ // MemberExpression . Identifier
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Array()).length.valueOf()",
+ 0,
+ (new Array()).length.valueOf() );
+ // new MemberExpression Arguments
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Array(20))['length'].valueOf()",
+ 20,
+ (new Array(20))["length"].valueOf() );
+
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.3-2-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.3-2-n.js
new file mode 100644
index 0000000..e5ba65c
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.3-2-n.js
@@ -0,0 +1,90 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 11.2.3-2-n.js
+ ECMA Section: 11.2.3. Function Calls
+ Description:
+
+ The production CallExpression : MemberExpression Arguments is evaluated as
+ follows:
+
+ 1.Evaluate MemberExpression.
+ 2.Evaluate Arguments, producing an internal list of argument values
+ (section 0).
+ 3.Call GetValue(Result(1)).
+ 4.If Type(Result(3)) is not Object, generate a runtime error.
+ 5.If Result(3) does not implement the internal [[Call]] method, generate a
+ runtime error.
+ 6.If Type(Result(1)) is Reference, Result(6) is GetBase(Result(1)). Otherwise,
+ Result(6) is null.
+ 7.If Result(6) is an activation object, Result(7) is null. Otherwise, Result(7) is
+ the same as Result(6).
+ 8.Call the [[Call]] method on Result(3), providing Result(7) as the this value
+ and providing the list Result(2) as the argument values.
+ 9.Return Result(8).
+
+ The production CallExpression : CallExpression Arguments is evaluated in
+ exactly the same manner, except that the contained CallExpression is
+ evaluated in step 1.
+
+ Note: Result(8) will never be of type Reference if Result(3) is a native
+ ECMAScript object. Whether calling a host object can return a value of
+ type Reference is implementation-dependent.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "11.2.3-2-n.js";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Function Calls";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ testcases[tc++] = new TestCase( SECTION,
+ "3.valueOf()",
+ 3,
+ 3.valueOf() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(3).valueOf()",
+ 3,
+ (3).valueOf() );
+
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.3-3-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.3-3-n.js
new file mode 100644
index 0000000..da58907
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.3-3-n.js
@@ -0,0 +1,81 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 11.2.3-3-n.js
+ ECMA Section: 11.2.3. Function Calls
+ Description:
+
+ The production CallExpression : MemberExpression Arguments is evaluated as
+ follows:
+
+ 1.Evaluate MemberExpression.
+ 2.Evaluate Arguments, producing an internal list of argument values
+ (section 0).
+ 3.Call GetValue(Result(1)).
+ 4.If Type(Result(3)) is not Object, generate a runtime error.
+ 5.If Result(3) does not implement the internal [[Call]] method, generate a
+ runtime error.
+ 6.If Type(Result(1)) is Reference, Result(6) is GetBase(Result(1)). Otherwise,
+ Result(6) is null.
+ 7.If Result(6) is an activation object, Result(7) is null. Otherwise, Result(7) is
+ the same as Result(6).
+ 8.Call the [[Call]] method on Result(3), providing Result(7) as the this value
+ and providing the list Result(2) as the argument values.
+ 9.Return Result(8).
+
+ The production CallExpression : CallExpression Arguments is evaluated in
+ exactly the same manner, except that the contained CallExpression is
+ evaluated in step 1.
+
+ Note: Result(8) will never be of type Reference if Result(3) is a native
+ ECMAScript object. Whether calling a host object can return a value of
+ type Reference is implementation-dependent.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "11.2.3-3-n.js";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Function Calls";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ testcases[tc++] = new TestCase( SECTION, "(void 0).valueOf()", "error", (void 0).valueOf() );
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.3-4-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.3-4-n.js
new file mode 100644
index 0000000..eed49b2
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.3-4-n.js
@@ -0,0 +1,81 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 11.2.3-4-n.js
+ ECMA Section: 11.2.3. Function Calls
+ Description:
+
+ The production CallExpression : MemberExpression Arguments is evaluated as
+ follows:
+
+ 1.Evaluate MemberExpression.
+ 2.Evaluate Arguments, producing an internal list of argument values
+ (section 0).
+ 3.Call GetValue(Result(1)).
+ 4.If Type(Result(3)) is not Object, generate a runtime error.
+ 5.If Result(3) does not implement the internal [[Call]] method, generate a
+ runtime error.
+ 6.If Type(Result(1)) is Reference, Result(6) is GetBase(Result(1)). Otherwise,
+ Result(6) is null.
+ 7.If Result(6) is an activation object, Result(7) is null. Otherwise, Result(7) is
+ the same as Result(6).
+ 8.Call the [[Call]] method on Result(3), providing Result(7) as the this value
+ and providing the list Result(2) as the argument values.
+ 9.Return Result(8).
+
+ The production CallExpression : CallExpression Arguments is evaluated in
+ exactly the same manner, except that the contained CallExpression is
+ evaluated in step 1.
+
+ Note: Result(8) will never be of type Reference if Result(3) is a native
+ ECMAScript object. Whether calling a host object can return a value of
+ type Reference is implementation-dependent.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "11.2.3-4-n.js";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Function Calls";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ testcases[tc++] = new TestCase( SECTION, "null.valueOf()", "error", null.valueOf() );
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.3-5.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.3-5.js
new file mode 100644
index 0000000..77a0f6c
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.2.3-5.js
@@ -0,0 +1,81 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 11.2.3-5-n.js
+ ECMA Section: 11.2.3. Function Calls
+ Description:
+
+ The production CallExpression : MemberExpression Arguments is evaluated as
+ follows:
+
+ 1. Evaluate MemberExpression.
+ 2. Evaluate Arguments, producing an internal list of argument values
+ (section 0).
+ 3. Call GetValue(Result(1)).
+ 4. If Type(Result(3)) is not Object, generate a runtime error.
+ 5. If Result(3) does not implement the internal [[Call]] method, generate a
+ runtime error.
+ 6. If Type(Result(1)) is Reference, Result(6) is GetBase(Result(1)). Otherwise,
+ Result(6) is null.
+ 7. If Result(6) is an activation object, Result(7) is null. Otherwise, Result(7) is
+ the same as Result(6).
+ 8. Call the [[Call]] method on Result(3), providing Result(7) as the this value
+ and providing the list Result(2) as the argument values.
+ 9. Return Result(8).
+
+ The production CallExpression : CallExpression Arguments is evaluated in
+ exactly the same manner, except that the contained CallExpression is
+ evaluated in step 1.
+
+ Note: Result(8) will never be of type Reference if Result(3) is a native
+ ECMAScript object. Whether calling a host object can return a value of
+ type Reference is implementation-dependent.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "11.2.3-5";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Function Calls";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ testcases[tc++] = new TestCase( SECTION, "true.valueOf()", true, true.valueOf() );
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.3.1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.3.1.js
new file mode 100644
index 0000000..0e1e8aa
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.3.1.js
@@ -0,0 +1,154 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 11.3.1.js
+ ECMA Section: 11.3.1 Postfix increment operator
+ Description:
+ The production MemberExpression : MemberExpression ++ is evaluated as
+ follows:
+
+ 1. Evaluate MemberExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Call ToNumber(Result(2)).
+ 4. Add the value 1 to Result(3), using the same rules as for the +
+ operator (section 0).
+ 5. Call PutValue(Result(1), Result(4)).
+ 6. Return Result(3).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "11.3.1";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Postfix increment operator");
+
+ testcases = getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ // special numbers
+ array[item++] = new TestCase( SECTION, "var MYVAR; MYVAR++", NaN, eval("var MYVAR; MYVAR++") );
+ array[item++] = new TestCase( SECTION, "var MYVAR= void 0; MYVAR++", NaN, eval("var MYVAR=void 0; MYVAR++") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=null; MYVAR++", 0, eval("var MYVAR=null; MYVAR++") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=true; MYVAR++", 1, eval("var MYVAR=true; MYVAR++") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=false; MYVAR++", 0, eval("var MYVAR=false; MYVAR++") );
+
+ // verify return value
+
+ array[item++] = new TestCase( SECTION, "var MYVAR=Number.POSITIVE_INFINITY;MYVAR++", Number.POSITIVE_INFINITY, eval("var MYVAR=Number.POSITIVE_INFINITY;MYVAR++") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=Number.NEGATIVE_INFINITY;MYVAR++", Number.NEGATIVE_INFINITY, eval("var MYVAR=Number.NEGATIVE_INFINITY;MYVAR++") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=Number.NaN;MYVAR++", Number.NaN, eval("var MYVAR=Number.NaN;MYVAR++") );
+
+ // verify value of variable
+
+ array[item++] = new TestCase( SECTION, "var MYVAR=Number.POSITIVE_INFINITY;MYVAR++;MYVAR", Number.POSITIVE_INFINITY, eval("var MYVAR=Number.POSITIVE_INFINITY;MYVAR++;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=Number.NEGATIVE_INFINITY;MYVAR++;MYVAR", Number.NEGATIVE_INFINITY, eval("var MYVAR=Number.NEGATIVE_INFINITY;MYVAR++;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=Number.NaN;MYVAR++;MYVAR", Number.NaN, eval("var MYVAR=Number.NaN;MYVAR++;MYVAR") );
+
+ // number primitives
+ array[item++] = new TestCase( SECTION, "var MYVAR=0;MYVAR++", 0, eval("var MYVAR=0;MYVAR++") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=0.2345;MYVAR++", 0.2345, eval("var MYVAR=0.2345;MYVAR++") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=-0.2345;MYVAR++", -0.2345, eval("var MYVAR=-0.2345;MYVAR++") );
+
+ // verify value of variable
+
+ array[item++] = new TestCase( SECTION, "var MYVAR=0;MYVAR++;MYVAR", 1, eval("var MYVAR=0;MYVAR++;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=0.2345;MYVAR++;MYVAR", 1.2345, eval("var MYVAR=0.2345;MYVAR++;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=-0.2345;MYVAR++;MYVAR", 0.7655, eval("var MYVAR=-0.2345;MYVAR++;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=0;MYVAR++;MYVAR", 1, eval("var MYVAR=0;MYVAR++;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=0;MYVAR++;MYVAR", 1, eval("var MYVAR=0;MYVAR++;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=0;MYVAR++;MYVAR", 1, eval("var MYVAR=0;MYVAR++;MYVAR") );
+
+ // boolean values
+ // verify return value
+
+ array[item++] = new TestCase( SECTION, "var MYVAR=true;MYVAR++", 1, eval("var MYVAR=true;MYVAR++") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=false;MYVAR++", 0, eval("var MYVAR=false;MYVAR++") );
+ // verify value of variable
+
+ array[item++] = new TestCase( SECTION, "var MYVAR=true;MYVAR++;MYVAR", 2, eval("var MYVAR=true;MYVAR++;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=false;MYVAR++;MYVAR", 1, eval("var MYVAR=false;MYVAR++;MYVAR") );
+
+ // boolean objects
+ // verify return value
+
+ array[item++] = new TestCase( SECTION, "var MYVAR=new Boolean(true);MYVAR++", 1, eval("var MYVAR=true;MYVAR++") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=new Boolean(false);MYVAR++", 0, eval("var MYVAR=false;MYVAR++") );
+ // verify value of variable
+
+ array[item++] = new TestCase( SECTION, "var MYVAR=new Boolean(true);MYVAR++;MYVAR", 2, eval("var MYVAR=new Boolean(true);MYVAR++;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=new Boolean(false);MYVAR++;MYVAR", 1, eval("var MYVAR=new Boolean(false);MYVAR++;MYVAR") );
+
+ // string primitives
+ array[item++] = new TestCase( SECTION, "var MYVAR='string';MYVAR++", Number.NaN, eval("var MYVAR='string';MYVAR++") );
+ array[item++] = new TestCase( SECTION, "var MYVAR='12345';MYVAR++", 12345, eval("var MYVAR='12345';MYVAR++") );
+ array[item++] = new TestCase( SECTION, "var MYVAR='-12345';MYVAR++", -12345, eval("var MYVAR='-12345';MYVAR++") );
+ array[item++] = new TestCase( SECTION, "var MYVAR='0Xf';MYVAR++", 15, eval("var MYVAR='0Xf';MYVAR++") );
+ array[item++] = new TestCase( SECTION, "var MYVAR='077';MYVAR++", 77, eval("var MYVAR='077';MYVAR++") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=''; MYVAR++", 0, eval("var MYVAR='';MYVAR++") );
+
+ // verify value of variable
+
+ array[item++] = new TestCase( SECTION, "var MYVAR='string';MYVAR++;MYVAR", Number.NaN, eval("var MYVAR='string';MYVAR++;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR='12345';MYVAR++;MYVAR", 12346, eval("var MYVAR='12345';MYVAR++;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR='-12345';MYVAR++;MYVAR", -12344, eval("var MYVAR='-12345';MYVAR++;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR='0xf';MYVAR++;MYVAR", 16, eval("var MYVAR='0xf';MYVAR++;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR='077';MYVAR++;MYVAR", 78, eval("var MYVAR='077';MYVAR++;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR='';MYVAR++;MYVAR", 1, eval("var MYVAR='';MYVAR++;MYVAR") );
+
+ // string objects
+ array[item++] = new TestCase( SECTION, "var MYVAR=new String('string');MYVAR++", Number.NaN, eval("var MYVAR=new String('string');MYVAR++") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=new String('12345');MYVAR++", 12345, eval("var MYVAR=new String('12345');MYVAR++") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=new String('-12345');MYVAR++", -12345, eval("var MYVAR=new String('-12345');MYVAR++") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=new String('0Xf');MYVAR++", 15, eval("var MYVAR=new String('0Xf');MYVAR++") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=new String('077');MYVAR++", 77, eval("var MYVAR=new String('077');MYVAR++") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=new String(''); MYVAR++", 0, eval("var MYVAR=new String('');MYVAR++") );
+
+ // verify value of variable
+
+ array[item++] = new TestCase( SECTION, "var MYVAR=new String('string');MYVAR++;MYVAR", Number.NaN, eval("var MYVAR=new String('string');MYVAR++;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=new String('12345');MYVAR++;MYVAR", 12346, eval("var MYVAR=new String('12345');MYVAR++;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=new String('-12345');MYVAR++;MYVAR", -12344, eval("var MYVAR=new String('-12345');MYVAR++;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=new String('0xf');MYVAR++;MYVAR", 16, eval("var MYVAR=new String('0xf');MYVAR++;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=new String('077');MYVAR++;MYVAR", 78, eval("var MYVAR=new String('077');MYVAR++;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=new String('');MYVAR++;MYVAR", 1, eval("var MYVAR=new String('');MYVAR++;MYVAR") );
+
+ return ( array );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.3.2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.3.2.js
new file mode 100644
index 0000000..1042f85
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.3.2.js
@@ -0,0 +1,154 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 11.3.2.js
+ ECMA Section: 11.3.2 Postfix decrement operator
+ Description:
+
+ 11.3.2 Postfix decrement operator
+
+ The production MemberExpression : MemberExpression -- is evaluated as follows:
+ 1. Evaluate MemberExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Call ToNumber(Result(2)).
+ 4. Subtract the value 1 from Result(3), using the same rules as for the -
+ operator (section 0).
+ 5. Call PutValue(Result(1), Result(4)).
+ 6. Return Result(3).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "11.3.2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var testcases = getTestCases();
+
+ writeHeaderToLog( SECTION + " Postfix decrement operator");
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ // special numbers
+ array[item++] = new TestCase( SECTION, "var MYVAR; MYVAR--", NaN, eval("var MYVAR; MYVAR--") );
+ array[item++] = new TestCase( SECTION, "var MYVAR= void 0; MYVAR--", NaN, eval("var MYVAR=void 0; MYVAR--") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=null; MYVAR--", 0, eval("var MYVAR=null; MYVAR--") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=true; MYVAR--", 1, eval("var MYVAR=true; MYVAR--") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=false; MYVAR--", 0, eval("var MYVAR=false; MYVAR--") );
+
+ // verify return value
+
+ array[item++] = new TestCase( SECTION, "var MYVAR=Number.POSITIVE_INFINITY;MYVAR--", Number.POSITIVE_INFINITY, eval("var MYVAR=Number.POSITIVE_INFINITY;MYVAR--") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=Number.NEGATIVE_INFINITY;MYVAR--", Number.NEGATIVE_INFINITY, eval("var MYVAR=Number.NEGATIVE_INFINITY;MYVAR--") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=Number.NaN;MYVAR--", Number.NaN, eval("var MYVAR=Number.NaN;MYVAR--") );
+
+ // verify value of variable
+
+ array[item++] = new TestCase( SECTION, "var MYVAR=Number.POSITIVE_INFINITY;MYVAR--;MYVAR", Number.POSITIVE_INFINITY, eval("var MYVAR=Number.POSITIVE_INFINITY;MYVAR--;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=Number.NEGATIVE_INFINITY;MYVAR--;MYVAR", Number.NEGATIVE_INFINITY, eval("var MYVAR=Number.NEGATIVE_INFINITY;MYVAR--;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=Number.NaN;MYVAR--;MYVAR", Number.NaN, eval("var MYVAR=Number.NaN;MYVAR--;MYVAR") );
+
+ // number primitives
+ array[item++] = new TestCase( SECTION, "var MYVAR=0;MYVAR--", 0, eval("var MYVAR=0;MYVAR--") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=0.2345;MYVAR--", 0.2345, eval("var MYVAR=0.2345;MYVAR--") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=-0.2345;MYVAR--", -0.2345, eval("var MYVAR=-0.2345;MYVAR--") );
+
+ // verify value of variable
+
+ array[item++] = new TestCase( SECTION, "var MYVAR=0;MYVAR--;MYVAR", -1, eval("var MYVAR=0;MYVAR--;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=0.2345;MYVAR--;MYVAR", -0.7655, eval("var MYVAR=0.2345;MYVAR--;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=-0.2345;MYVAR--;MYVAR", -1.2345, eval("var MYVAR=-0.2345;MYVAR--;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=0;MYVAR--;MYVAR", -1, eval("var MYVAR=0;MYVAR--;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=0;MYVAR--;MYVAR", -1, eval("var MYVAR=0;MYVAR--;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=0;MYVAR--;MYVAR", -1, eval("var MYVAR=0;MYVAR--;MYVAR") );
+
+ // boolean values
+ // verify return value
+
+ array[item++] = new TestCase( SECTION, "var MYVAR=true;MYVAR--", 1, eval("var MYVAR=true;MYVAR--") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=false;MYVAR--", 0, eval("var MYVAR=false;MYVAR--") );
+ // verify value of variable
+
+ array[item++] = new TestCase( SECTION, "var MYVAR=true;MYVAR--;MYVAR", 0, eval("var MYVAR=true;MYVAR--;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=false;MYVAR--;MYVAR", -1, eval("var MYVAR=false;MYVAR--;MYVAR") );
+
+ // boolean objects
+ // verify return value
+
+ array[item++] = new TestCase( SECTION, "var MYVAR=new Boolean(true);MYVAR--", 1, eval("var MYVAR=true;MYVAR--") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=new Boolean(false);MYVAR--", 0, eval("var MYVAR=false;MYVAR--") );
+ // verify value of variable
+
+ array[item++] = new TestCase( SECTION, "var MYVAR=new Boolean(true);MYVAR--;MYVAR", 0, eval("var MYVAR=new Boolean(true);MYVAR--;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=new Boolean(false);MYVAR--;MYVAR", -1, eval("var MYVAR=new Boolean(false);MYVAR--;MYVAR") );
+
+ // string primitives
+ array[item++] = new TestCase( SECTION, "var MYVAR='string';MYVAR--", Number.NaN, eval("var MYVAR='string';MYVAR--") );
+ array[item++] = new TestCase( SECTION, "var MYVAR='12345';MYVAR--", 12345, eval("var MYVAR='12345';MYVAR--") );
+ array[item++] = new TestCase( SECTION, "var MYVAR='-12345';MYVAR--", -12345, eval("var MYVAR='-12345';MYVAR--") );
+ array[item++] = new TestCase( SECTION, "var MYVAR='0Xf';MYVAR--", 15, eval("var MYVAR='0Xf';MYVAR--") );
+ array[item++] = new TestCase( SECTION, "var MYVAR='077';MYVAR--", 77, eval("var MYVAR='077';MYVAR--") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=''; MYVAR--", 0, eval("var MYVAR='';MYVAR--") );
+
+ // verify value of variable
+
+ array[item++] = new TestCase( SECTION, "var MYVAR='string';MYVAR--;MYVAR", Number.NaN, eval("var MYVAR='string';MYVAR--;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR='12345';MYVAR--;MYVAR", 12344, eval("var MYVAR='12345';MYVAR--;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR='-12345';MYVAR--;MYVAR", -12346, eval("var MYVAR='-12345';MYVAR--;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR='0xf';MYVAR--;MYVAR", 14, eval("var MYVAR='0xf';MYVAR--;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR='077';MYVAR--;MYVAR", 76, eval("var MYVAR='077';MYVAR--;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR='';MYVAR--;MYVAR", -1, eval("var MYVAR='';MYVAR--;MYVAR") );
+
+ // string objects
+ array[item++] = new TestCase( SECTION, "var MYVAR=new String('string');MYVAR--", Number.NaN, eval("var MYVAR=new String('string');MYVAR--") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=new String('12345');MYVAR--", 12345, eval("var MYVAR=new String('12345');MYVAR--") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=new String('-12345');MYVAR--", -12345, eval("var MYVAR=new String('-12345');MYVAR--") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=new String('0Xf');MYVAR--", 15, eval("var MYVAR=new String('0Xf');MYVAR--") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=new String('077');MYVAR--", 77, eval("var MYVAR=new String('077');MYVAR--") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=new String(''); MYVAR--", 0, eval("var MYVAR=new String('');MYVAR--") );
+
+ // verify value of variable
+
+ array[item++] = new TestCase( SECTION, "var MYVAR=new String('string');MYVAR--;MYVAR", Number.NaN, eval("var MYVAR=new String('string');MYVAR--;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=new String('12345');MYVAR--;MYVAR", 12344, eval("var MYVAR=new String('12345');MYVAR--;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=new String('-12345');MYVAR--;MYVAR", -12346, eval("var MYVAR=new String('-12345');MYVAR--;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=new String('0xf');MYVAR--;MYVAR", 14, eval("var MYVAR=new String('0xf');MYVAR--;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=new String('077');MYVAR--;MYVAR", 76, eval("var MYVAR=new String('077');MYVAR--;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=new String('');MYVAR--;MYVAR", -1, eval("var MYVAR=new String('');MYVAR--;MYVAR") );
+
+ return ( array );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.4.1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.4.1.js
new file mode 100644
index 0000000..766b786
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.4.1.js
@@ -0,0 +1,95 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 11.4.1.js
+ ECMA Section: 11.4.1 the Delete Operator
+ Description: returns true if the property could be deleted
+ returns false if it could not be deleted
+ Author: christine@netscape.com
+ Date: 7 july 1997
+
+*/
+
+
+ var SECTION = "11.4.1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "The delete operator";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+// array[item++] = new TestCase( SECTION, "x=[9,8,7];delete(x[2]);x.length", 2, eval("x=[9,8,7];delete(x[2]);x.length") );
+// array[item++] = new TestCase( SECTION, "x=[9,8,7];delete(x[2]);x.toString()", "9,8", eval("x=[9,8,7];delete(x[2]);x.toString()") );
+ array[item++] = new TestCase( SECTION, "x=new Date();delete x;typeof(x)", "undefined", eval("x=new Date();delete x;typeof(x)") );
+
+// array[item++] = new TestCase( SECTION, "delete(x=new Date())", true, delete(x=new Date()) );
+// array[item++] = new TestCase( SECTION, "delete('string primitive')", true, delete("string primitive") );
+// array[item++] = new TestCase( SECTION, "delete(new String( 'string object' ) )", true, delete(new String("string object")) );
+// array[item++] = new TestCase( SECTION, "delete(new Number(12345) )", true, delete(new Number(12345)) );
+ array[item++] = new TestCase( SECTION, "delete(Math.PI)", false, delete(Math.PI) );
+// array[item++] = new TestCase( SECTION, "delete(null)", true, delete(null) );
+// array[item++] = new TestCase( SECTION, "delete(void(0))", true, delete(void(0)) );
+
+ // variables declared with the var statement are not deletable.
+
+ var abc;
+ array[item++] = new TestCase( SECTION, "var abc; delete(abc)", false, delete abc );
+
+ array[item++] = new TestCase( SECTION,
+ "var OB = new MyObject(); for ( p in OB ) { delete p }",
+ true,
+ eval("var OB = new MyObject(); for ( p in OB ) { delete p }") );
+ return ( array );
+}
+
+function test() {
+ for ( tc = 0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "
+
+ }
+ stopTest();
+ return ( testcases );
+}
+
+function MyObject() {
+ this.prop1 = true;
+ this.prop2 = false;
+ this.prop3 = null
+ this.prop4 = void 0;
+ this.prop5 = "hi";
+ this.prop6 = 42;
+ this.prop7 = new Date();
+ this.prop8 = Math.PI;
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.4.2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.4.2.js
new file mode 100644
index 0000000..c889ec6
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.4.2.js
@@ -0,0 +1,85 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 11.4.2.js
+ ECMA Section: 11.4.2 the Void Operator
+ Description: always returns undefined (?)
+ Author: christine@netscape.com
+ Date: 7 july 1997
+
+*/
+ var SECTION = "11.4.2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "The void operator";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "void(new String('string object'))", void 0, void(new String( 'string object' )) );
+ array[item++] = new TestCase( SECTION, "void('string primitive')", void 0, void("string primitive") );
+ array[item++] = new TestCase( SECTION, "void(Number.NaN)", void 0, void(Number.NaN) );
+ array[item++] = new TestCase( SECTION, "void(Number.POSITIVE_INFINITY)", void 0, void(Number.POSITIVE_INFINITY) );
+ array[item++] = new TestCase( SECTION, "void(1)", void 0, void(1) );
+ array[item++] = new TestCase( SECTION, "void(0)", void 0, void(0) );
+ array[item++] = new TestCase( SECTION, "void(-1)", void 0, void(-1) );
+ array[item++] = new TestCase( SECTION, "void(Number.NEGATIVE_INFINITY)", void 0, void(Number.NEGATIVE_INFINITY) );
+ array[item++] = new TestCase( SECTION, "void(Math.PI)", void 0, void(Math.PI) );
+ array[item++] = new TestCase( SECTION, "void(true)", void 0, void(true) );
+ array[item++] = new TestCase( SECTION, "void(false)", void 0, void(false) );
+ array[item++] = new TestCase( SECTION, "void(null)", void 0, void(null) );
+ array[item++] = new TestCase( SECTION, "void new String('string object')", void 0, void new String( 'string object' ) );
+ array[item++] = new TestCase( SECTION, "void 'string primitive'", void 0, void "string primitive" );
+ array[item++] = new TestCase( SECTION, "void Number.NaN", void 0, void Number.NaN );
+ array[item++] = new TestCase( SECTION, "void Number.POSITIVE_INFINITY", void 0, void Number.POSITIVE_INFINITY );
+ array[item++] = new TestCase( SECTION, "void 1", void 0, void 1 );
+ array[item++] = new TestCase( SECTION, "void 0", void 0, void 0 );
+ array[item++] = new TestCase( SECTION, "void -1", void 0, void -1 );
+ array[item++] = new TestCase( SECTION, "void Number.NEGATIVE_INFINITY", void 0, void Number.NEGATIVE_INFINITY );
+ array[item++] = new TestCase( SECTION, "void Math.PI", void 0, void Math.PI );
+ array[item++] = new TestCase( SECTION, "void true", void 0, void true );
+ array[item++] = new TestCase( SECTION, "void false", void 0, void false );
+ array[item++] = new TestCase( SECTION, "void null", void 0, void null );
+
+// array[item++] = new TestCase( SECTION, "void()", void 0, void() );
+
+ return ( array );
+}
+
+function test() {
+ for ( i = 0; i < testcases.length; i++ ) {
+ testcases[i].passed = writeTestCaseResult(
+ testcases[i].expect,
+ testcases[i].actual,
+ testcases[i].description +" = "+ testcases[i].actual );
+ testcases[i].reason += ( testcases[i].passed ) ? "" : "wrong value "
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.4.3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.4.3.js
new file mode 100644
index 0000000..eccfa0d
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.4.3.js
@@ -0,0 +1,109 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: typeof_1.js
+ ECMA Section: 11.4.3 typeof operator
+ Description: typeof evaluates unary expressions:
+ undefined "undefined"
+ null "object"
+ Boolean "boolean"
+ Number "number"
+ String "string"
+ Object "object" [native, doesn't implement Call]
+ Object "function" [native, implements [Call]]
+ Object implementation dependent
+ [not sure how to test this]
+ Author: christine@netscape.com
+ Date: june 30, 1997
+
+*/
+
+ var SECTION = "11.4.3";
+
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = " The typeof operator";
+
+ var testcases = new Array();
+
+
+ testcases[testcases.length] = new TestCase( SECTION, "typeof(void(0))", "undefined", typeof(void(0)) );
+ testcases[testcases.length] = new TestCase( SECTION, "typeof(null)", "object", typeof(null) );
+ testcases[testcases.length] = new TestCase( SECTION, "typeof(true)", "boolean", typeof(true) );
+ testcases[testcases.length] = new TestCase( SECTION, "typeof(false)", "boolean", typeof(false) );
+ testcases[testcases.length] = new TestCase( SECTION, "typeof(new Boolean())", "object", typeof(new Boolean()) );
+ testcases[testcases.length] = new TestCase( SECTION, "typeof(new Boolean(true))", "object", typeof(new Boolean(true)) );
+ testcases[testcases.length] = new TestCase( SECTION, "typeof(Boolean())", "boolean", typeof(Boolean()) );
+ testcases[testcases.length] = new TestCase( SECTION, "typeof(Boolean(false))", "boolean", typeof(Boolean(false)) );
+ testcases[testcases.length] = new TestCase( SECTION, "typeof(Boolean(true))", "boolean", typeof(Boolean(true)) );
+ testcases[testcases.length] = new TestCase( SECTION, "typeof(NaN)", "number", typeof(Number.NaN) );
+ testcases[testcases.length] = new TestCase( SECTION, "typeof(Infinity)", "number", typeof(Number.POSITIVE_INFINITY) );
+ testcases[testcases.length] = new TestCase( SECTION, "typeof(-Infinity)", "number", typeof(Number.NEGATIVE_INFINITY) );
+ testcases[testcases.length] = new TestCase( SECTION, "typeof(Math.PI)", "number", typeof(Math.PI) );
+ testcases[testcases.length] = new TestCase( SECTION, "typeof(0)", "number", typeof(0) );
+ testcases[testcases.length] = new TestCase( SECTION, "typeof(1)", "number", typeof(1) );
+ testcases[testcases.length] = new TestCase( SECTION, "typeof(-1)", "number", typeof(-1) );
+ testcases[testcases.length] = new TestCase( SECTION, "typeof('0')", "string", typeof("0") );
+ testcases[testcases.length] = new TestCase( SECTION, "typeof(Number())", "number", typeof(Number()) );
+ testcases[testcases.length] = new TestCase( SECTION, "typeof(Number(0))", "number", typeof(Number(0)) );
+ testcases[testcases.length] = new TestCase( SECTION, "typeof(Number(1))", "number", typeof(Number(1)) );
+ testcases[testcases.length] = new TestCase( SECTION, "typeof(Nubmer(-1))", "number", typeof(Number(-1)) );
+ testcases[testcases.length] = new TestCase( SECTION, "typeof(new Number())", "object", typeof(new Number()) );
+ testcases[testcases.length] = new TestCase( SECTION, "typeof(new Number(0))", "object", typeof(new Number(0)) );
+ testcases[testcases.length] = new TestCase( SECTION, "typeof(new Number(1))", "object", typeof(new Number(1)) );
+
+ // Math does not implement [[Construct]] or [[Call]] so its type is object.
+
+ testcases[testcases.length] = new TestCase( SECTION, "typeof(Math)", "object", typeof(Math) );
+
+ testcases[testcases.length] = new TestCase( SECTION, "typeof(Number.prototype.toString)", "function", typeof(Number.prototype.toString) );
+
+ testcases[testcases.length] = new TestCase( SECTION, "typeof('a string')", "string", typeof("a string") );
+ testcases[testcases.length] = new TestCase( SECTION, "typeof('')", "string", typeof("") );
+ testcases[testcases.length] = new TestCase( SECTION, "typeof(new Date())", "object", typeof(new Date()) );
+ testcases[testcases.length] = new TestCase( SECTION, "typeof(new Array(1,2,3))", "object", typeof(new Array(1,2,3)) );
+ testcases[testcases.length] = new TestCase( SECTION, "typeof(new String('string object'))", "object", typeof(new String("string object")) );
+ testcases[testcases.length] = new TestCase( SECTION, "typeof(String('string primitive'))", "string", typeof(String("string primitive")) );
+ testcases[testcases.length] = new TestCase( SECTION, "typeof(['array', 'of', 'strings'])", "object", typeof(["array", "of", "strings"]) );
+ testcases[testcases.length] = new TestCase( SECTION, "typeof(new Function())", "function", typeof( new Function() ) );
+ testcases[testcases.length] = new TestCase( SECTION, "typeof(parseInt)", "function", typeof( parseInt ) );
+ testcases[testcases.length] = new TestCase( SECTION, "typeof(test)", "function", typeof( test ) );
+ testcases[testcases.length] = new TestCase( SECTION, "typeof(String.fromCharCode)", "function", typeof( String.fromCharCode ) );
+
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+ test();
+
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.4.4.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.4.4.js
new file mode 100644
index 0000000..7a7a547
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.4.4.js
@@ -0,0 +1,156 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 11.4.4.js
+ ECMA Section: 11.4.4 Prefix increment operator
+ Description:
+ The production UnaryExpression : ++ UnaryExpression is evaluated as
+ follows:
+
+ 1. Evaluate UnaryExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Call ToNumber(Result(2)).
+ 4. Add the value 1 to Result(3), using the same rules as for the +
+ operator (section 11.6.3).
+ 5. Call PutValue(Result(1), Result(4)).
+ 6. Return Result(4).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "11.4.4";
+ var VERSION = "ECMA_1";
+ startTest();
+ var testcases = getTestCases();
+
+ writeHeaderToLog( SECTION + " Prefix increment operator");
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ // special case: var is not defined
+
+ array[item++] = new TestCase( SECTION, "var MYVAR; ++MYVAR", NaN, eval("var MYVAR; ++MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR= void 0; ++MYVAR", NaN, eval("var MYVAR=void 0; ++MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=null; ++MYVAR", 1, eval("var MYVAR=null; ++MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=true; ++MYVAR", 2, eval("var MYVAR=true; ++MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=false; ++MYVAR", 1, eval("var MYVAR=false; ++MYVAR") );
+
+ // special numbers
+ // verify return value
+
+ array[item++] = new TestCase( SECTION, "var MYVAR=Number.POSITIVE_INFINITY;++MYVAR", Number.POSITIVE_INFINITY, eval("var MYVAR=Number.POSITIVE_INFINITY;++MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=Number.NEGATIVE_INFINITY;++MYVAR", Number.NEGATIVE_INFINITY, eval("var MYVAR=Number.NEGATIVE_INFINITY;++MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=Number.NaN;++MYVAR", Number.NaN, eval("var MYVAR=Number.NaN;++MYVAR") );
+
+ // verify value of variable
+
+ array[item++] = new TestCase( SECTION, "var MYVAR=Number.POSITIVE_INFINITY;++MYVAR;MYVAR", Number.POSITIVE_INFINITY, eval("var MYVAR=Number.POSITIVE_INFINITY;++MYVAR;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=Number.NEGATIVE_INFINITY;++MYVAR;MYVAR", Number.NEGATIVE_INFINITY, eval("var MYVAR=Number.NEGATIVE_INFINITY;++MYVAR;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=Number.NaN;++MYVAR;MYVAR", Number.NaN, eval("var MYVAR=Number.NaN;++MYVAR;MYVAR") );
+
+
+ // number primitives
+ array[item++] = new TestCase( SECTION, "var MYVAR=0;++MYVAR", 1, eval("var MYVAR=0;++MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=0.2345;++MYVAR", 1.2345, eval("var MYVAR=0.2345;++MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=-0.2345;++MYVAR", 0.7655, eval("var MYVAR=-0.2345;++MYVAR") );
+
+ // verify value of variable
+
+ array[item++] = new TestCase( SECTION, "var MYVAR=0;++MYVAR;MYVAR", 1, eval("var MYVAR=0;++MYVAR;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=0.2345;++MYVAR;MYVAR", 1.2345, eval("var MYVAR=0.2345;++MYVAR;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=-0.2345;++MYVAR;MYVAR", 0.7655, eval("var MYVAR=-0.2345;++MYVAR;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=0;++MYVAR;MYVAR", 1, eval("var MYVAR=0;++MYVAR;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=0;++MYVAR;MYVAR", 1, eval("var MYVAR=0;++MYVAR;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=0;++MYVAR;MYVAR", 1, eval("var MYVAR=0;++MYVAR;MYVAR") );
+
+ // boolean values
+ // verify return value
+
+ array[item++] = new TestCase( SECTION, "var MYVAR=true;++MYVAR", 2, eval("var MYVAR=true;++MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=false;++MYVAR", 1, eval("var MYVAR=false;++MYVAR") );
+ // verify value of variable
+
+ array[item++] = new TestCase( SECTION, "var MYVAR=true;++MYVAR;MYVAR", 2, eval("var MYVAR=true;++MYVAR;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=false;++MYVAR;MYVAR", 1, eval("var MYVAR=false;++MYVAR;MYVAR") );
+
+ // boolean objects
+ // verify return value
+
+ array[item++] = new TestCase( SECTION, "var MYVAR=new Boolean(true);++MYVAR", 2, eval("var MYVAR=true;++MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=new Boolean(false);++MYVAR", 1, eval("var MYVAR=false;++MYVAR") );
+ // verify value of variable
+
+ array[item++] = new TestCase( SECTION, "var MYVAR=new Boolean(true);++MYVAR;MYVAR", 2, eval("var MYVAR=new Boolean(true);++MYVAR;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=new Boolean(false);++MYVAR;MYVAR", 1, eval("var MYVAR=new Boolean(false);++MYVAR;MYVAR") );
+
+ // string primitives
+ array[item++] = new TestCase( SECTION, "var MYVAR='string';++MYVAR", Number.NaN, eval("var MYVAR='string';++MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR='12345';++MYVAR", 12346, eval("var MYVAR='12345';++MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR='-12345';++MYVAR", -12344, eval("var MYVAR='-12345';++MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR='0Xf';++MYVAR", 16, eval("var MYVAR='0Xf';++MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR='077';++MYVAR", 78, eval("var MYVAR='077';++MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=''; ++MYVAR", 1, eval("var MYVAR='';++MYVAR") );
+
+ // verify value of variable
+
+ array[item++] = new TestCase( SECTION, "var MYVAR='string';++MYVAR;MYVAR", Number.NaN, eval("var MYVAR='string';++MYVAR;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR='12345';++MYVAR;MYVAR", 12346, eval("var MYVAR='12345';++MYVAR;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR='-12345';++MYVAR;MYVAR", -12344, eval("var MYVAR='-12345';++MYVAR;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR='0xf';++MYVAR;MYVAR", 16, eval("var MYVAR='0xf';++MYVAR;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR='077';++MYVAR;MYVAR", 78, eval("var MYVAR='077';++MYVAR;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR='';++MYVAR;MYVAR", 1, eval("var MYVAR='';++MYVAR;MYVAR") );
+
+ // string objects
+ array[item++] = new TestCase( SECTION, "var MYVAR=new String('string');++MYVAR", Number.NaN, eval("var MYVAR=new String('string');++MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=new String('12345');++MYVAR", 12346, eval("var MYVAR=new String('12345');++MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=new String('-12345');++MYVAR", -12344, eval("var MYVAR=new String('-12345');++MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=new String('0Xf');++MYVAR", 16, eval("var MYVAR=new String('0Xf');++MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=new String('077');++MYVAR", 78, eval("var MYVAR=new String('077');++MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=new String(''); ++MYVAR", 1, eval("var MYVAR=new String('');++MYVAR") );
+
+ // verify value of variable
+
+ array[item++] = new TestCase( SECTION, "var MYVAR=new String('string');++MYVAR;MYVAR", Number.NaN, eval("var MYVAR=new String('string');++MYVAR;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=new String('12345');++MYVAR;MYVAR", 12346, eval("var MYVAR=new String('12345');++MYVAR;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=new String('-12345');++MYVAR;MYVAR", -12344, eval("var MYVAR=new String('-12345');++MYVAR;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=new String('0xf');++MYVAR;MYVAR", 16, eval("var MYVAR=new String('0xf');++MYVAR;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=new String('077');++MYVAR;MYVAR", 78, eval("var MYVAR=new String('077');++MYVAR;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=new String('');++MYVAR;MYVAR", 1, eval("var MYVAR=new String('');++MYVAR;MYVAR") );
+
+ return ( array );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.4.5.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.4.5.js
new file mode 100644
index 0000000..d82ac60
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.4.5.js
@@ -0,0 +1,154 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 11.4.5.js
+ ECMA Section: 11.4.5 Prefix decrement operator
+ Description:
+
+ The production UnaryExpression : -- UnaryExpression is evaluated as follows:
+
+ 1.Evaluate UnaryExpression.
+ 2.Call GetValue(Result(1)).
+ 3.Call ToNumber(Result(2)).
+ 4.Subtract the value 1 from Result(3), using the same rules as for the - operator (section 11.6.3).
+ 5.Call PutValue(Result(1), Result(4)).
+
+ 1.Return Result(4).
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "11.4.5";
+ var VERSION = "ECMA_1";
+ startTest();
+ var testcases = getTestCases();
+
+ writeHeaderToLog( SECTION + " Prefix decrement operator");
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ //
+ array[item++] = new TestCase( SECTION, "var MYVAR; --MYVAR", NaN, eval("var MYVAR; --MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR= void 0; --MYVAR", NaN, eval("var MYVAR=void 0; --MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=null; --MYVAR", -1, eval("var MYVAR=null; --MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=true; --MYVAR", 0, eval("var MYVAR=true; --MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=false; --MYVAR", -1, eval("var MYVAR=false; --MYVAR") );
+
+ // special numbers
+ // verify return value
+
+ array[item++] = new TestCase( SECTION, "var MYVAR=Number.POSITIVE_INFINITY;--MYVAR", Number.POSITIVE_INFINITY, eval("var MYVAR=Number.POSITIVE_INFINITY;--MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=Number.NEGATIVE_INFINITY;--MYVAR", Number.NEGATIVE_INFINITY, eval("var MYVAR=Number.NEGATIVE_INFINITY;--MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=Number.NaN;--MYVAR", Number.NaN, eval("var MYVAR=Number.NaN;--MYVAR") );
+
+ // verify value of variable
+
+ array[item++] = new TestCase( SECTION, "var MYVAR=Number.POSITIVE_INFINITY;--MYVAR;MYVAR", Number.POSITIVE_INFINITY, eval("var MYVAR=Number.POSITIVE_INFINITY;--MYVAR;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=Number.NEGATIVE_INFINITY;--MYVAR;MYVAR", Number.NEGATIVE_INFINITY, eval("var MYVAR=Number.NEGATIVE_INFINITY;--MYVAR;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=Number.NaN;--MYVAR;MYVAR", Number.NaN, eval("var MYVAR=Number.NaN;--MYVAR;MYVAR") );
+
+
+ // number primitives
+ array[item++] = new TestCase( SECTION, "var MYVAR=0;--MYVAR", -1, eval("var MYVAR=0;--MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=0.2345;--MYVAR", -0.7655, eval("var MYVAR=0.2345;--MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=-0.2345;--MYVAR", -1.2345, eval("var MYVAR=-0.2345;--MYVAR") );
+
+ // verify value of variable
+
+ array[item++] = new TestCase( SECTION, "var MYVAR=0;--MYVAR;MYVAR", -1, eval("var MYVAR=0;--MYVAR;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=0.2345;--MYVAR;MYVAR", -0.7655, eval("var MYVAR=0.2345;--MYVAR;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=-0.2345;--MYVAR;MYVAR", -1.2345, eval("var MYVAR=-0.2345;--MYVAR;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=0;--MYVAR;MYVAR", -1, eval("var MYVAR=0;--MYVAR;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=0;--MYVAR;MYVAR", -1, eval("var MYVAR=0;--MYVAR;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=0;--MYVAR;MYVAR", -1, eval("var MYVAR=0;--MYVAR;MYVAR") );
+
+ // boolean values
+ // verify return value
+
+ array[item++] = new TestCase( SECTION, "var MYVAR=true;--MYVAR", 0, eval("var MYVAR=true;--MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=false;--MYVAR", -1, eval("var MYVAR=false;--MYVAR") );
+ // verify value of variable
+
+ array[item++] = new TestCase( SECTION, "var MYVAR=true;--MYVAR;MYVAR", 0, eval("var MYVAR=true;--MYVAR;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=false;--MYVAR;MYVAR", -1, eval("var MYVAR=false;--MYVAR;MYVAR") );
+
+ // boolean objects
+ // verify return value
+
+ array[item++] = new TestCase( SECTION, "var MYVAR=new Boolean(true);--MYVAR", 0, eval("var MYVAR=true;--MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=new Boolean(false);--MYVAR", -1, eval("var MYVAR=false;--MYVAR") );
+ // verify value of variable
+
+ array[item++] = new TestCase( SECTION, "var MYVAR=new Boolean(true);--MYVAR;MYVAR", 0, eval("var MYVAR=new Boolean(true);--MYVAR;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=new Boolean(false);--MYVAR;MYVAR", -1, eval("var MYVAR=new Boolean(false);--MYVAR;MYVAR") );
+
+ // string primitives
+ array[item++] = new TestCase( SECTION, "var MYVAR='string';--MYVAR", Number.NaN, eval("var MYVAR='string';--MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR='12345';--MYVAR", 12344, eval("var MYVAR='12345';--MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR='-12345';--MYVAR", -12346, eval("var MYVAR='-12345';--MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR='0Xf';--MYVAR", 14, eval("var MYVAR='0Xf';--MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR='077';--MYVAR", 76, eval("var MYVAR='077';--MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=''; --MYVAR", -1, eval("var MYVAR='';--MYVAR") );
+
+ // verify value of variable
+
+ array[item++] = new TestCase( SECTION, "var MYVAR='string';--MYVAR;MYVAR", Number.NaN, eval("var MYVAR='string';--MYVAR;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR='12345';--MYVAR;MYVAR", 12344, eval("var MYVAR='12345';--MYVAR;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR='-12345';--MYVAR;MYVAR", -12346, eval("var MYVAR='-12345';--MYVAR;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR='0xf';--MYVAR;MYVAR", 14, eval("var MYVAR='0xf';--MYVAR;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR='077';--MYVAR;MYVAR", 76, eval("var MYVAR='077';--MYVAR;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR='';--MYVAR;MYVAR", -1, eval("var MYVAR='';--MYVAR;MYVAR") );
+
+ // string objects
+ array[item++] = new TestCase( SECTION, "var MYVAR=new String('string');--MYVAR", Number.NaN, eval("var MYVAR=new String('string');--MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=new String('12345');--MYVAR", 12344, eval("var MYVAR=new String('12345');--MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=new String('-12345');--MYVAR", -12346, eval("var MYVAR=new String('-12345');--MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=new String('0Xf');--MYVAR", 14, eval("var MYVAR=new String('0Xf');--MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=new String('077');--MYVAR", 76, eval("var MYVAR=new String('077');--MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=new String(''); --MYVAR", -1, eval("var MYVAR=new String('');--MYVAR") );
+
+ // verify value of variable
+
+ array[item++] = new TestCase( SECTION, "var MYVAR=new String('string');--MYVAR;MYVAR", Number.NaN, eval("var MYVAR=new String('string');--MYVAR;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=new String('12345');--MYVAR;MYVAR", 12344, eval("var MYVAR=new String('12345');--MYVAR;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=new String('-12345');--MYVAR;MYVAR", -12346, eval("var MYVAR=new String('-12345');--MYVAR;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=new String('0xf');--MYVAR;MYVAR", 14, eval("var MYVAR=new String('0xf');--MYVAR;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=new String('077');--MYVAR;MYVAR", 76, eval("var MYVAR=new String('077');--MYVAR;MYVAR") );
+ array[item++] = new TestCase( SECTION, "var MYVAR=new String('');--MYVAR;MYVAR", -1, eval("var MYVAR=new String('');--MYVAR;MYVAR") );
+
+ return ( array );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.4.6.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.4.6.js
new file mode 100644
index 0000000..31d9551
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.4.6.js
@@ -0,0 +1,299 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 11.4.6.js
+ ECMA Section: 11.4.6 Unary + Operator
+ Description: convert operand to Number type
+ Author: christine@netscape.com
+ Date: 7 july 1997
+*/
+
+ var SECTION = "11.4.6";
+ var VERSION = "ECMA_1";
+ startTest();
+ var testcases = getTestCases();
+ var BUGNUMBER="77391";
+
+ writeHeaderToLog( SECTION + " Unary + operator");
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION, "+('')", 0, +("") );
+ array[item++] = new TestCase( SECTION, "+(' ')", 0, +(" ") );
+ array[item++] = new TestCase( SECTION, "+(\\t)", 0, +("\t") );
+ array[item++] = new TestCase( SECTION, "+(\\n)", 0, +("\n") );
+ array[item++] = new TestCase( SECTION, "+(\\r)", 0, +("\r") );
+ array[item++] = new TestCase( SECTION, "+(\\f)", 0, +("\f") );
+
+ array[item++] = new TestCase( SECTION, "+(String.fromCharCode(0x0009)", 0, +(String.fromCharCode(0x0009)) );
+ array[item++] = new TestCase( SECTION, "+(String.fromCharCode(0x0020)", 0, +(String.fromCharCode(0x0020)) );
+ array[item++] = new TestCase( SECTION, "+(String.fromCharCode(0x000C)", 0, +(String.fromCharCode(0x000C)) );
+ array[item++] = new TestCase( SECTION, "+(String.fromCharCode(0x000B)", 0, +(String.fromCharCode(0x000B)) );
+ array[item++] = new TestCase( SECTION, "+(String.fromCharCode(0x000D)", 0, +(String.fromCharCode(0x000D)) );
+ array[item++] = new TestCase( SECTION, "+(String.fromCharCode(0x000A)", 0, +(String.fromCharCode(0x000A)) );
+
+ // a StringNumericLiteral may be preceeded or followed by whitespace and/or
+ // line terminators
+
+ array[item++] = new TestCase( SECTION, "+( ' ' + 999 )", 999, +( ' '+999) );
+ array[item++] = new TestCase( SECTION, "+( '\\n' + 999 )", 999, +( '\n' +999) );
+ array[item++] = new TestCase( SECTION, "+( '\\r' + 999 )", 999, +( '\r' +999) );
+ array[item++] = new TestCase( SECTION, "+( '\\t' + 999 )", 999, +( '\t' +999) );
+ array[item++] = new TestCase( SECTION, "+( '\\f' + 999 )", 999, +( '\f' +999) );
+
+ array[item++] = new TestCase( SECTION, "+( 999 + ' ' )", 999, +( 999+' ') );
+ array[item++] = new TestCase( SECTION, "+( 999 + '\\n' )", 999, +( 999+'\n' ) );
+ array[item++] = new TestCase( SECTION, "+( 999 + '\\r' )", 999, +( 999+'\r' ) );
+ array[item++] = new TestCase( SECTION, "+( 999 + '\\t' )", 999, +( 999+'\t' ) );
+ array[item++] = new TestCase( SECTION, "+( 999 + '\\f' )", 999, +( 999+'\f' ) );
+
+ array[item++] = new TestCase( SECTION, "+( '\\n' + 999 + '\\n' )", 999, +( '\n' +999+'\n' ) );
+ array[item++] = new TestCase( SECTION, "+( '\\r' + 999 + '\\r' )", 999, +( '\r' +999+'\r' ) );
+ array[item++] = new TestCase( SECTION, "+( '\\t' + 999 + '\\t' )", 999, +( '\t' +999+'\t' ) );
+ array[item++] = new TestCase( SECTION, "+( '\\f' + 999 + '\\f' )", 999, +( '\f' +999+'\f' ) );
+
+ array[item++] = new TestCase( SECTION, "+( ' ' + '999' )", 999, +( ' '+'999') );
+ array[item++] = new TestCase( SECTION, "+( '\\n' + '999' )", 999, +( '\n' +'999') );
+ array[item++] = new TestCase( SECTION, "+( '\\r' + '999' )", 999, +( '\r' +'999') );
+ array[item++] = new TestCase( SECTION, "+( '\\t' + '999' )", 999, +( '\t' +'999') );
+ array[item++] = new TestCase( SECTION, "+( '\\f' + '999' )", 999, +( '\f' +'999') );
+
+ array[item++] = new TestCase( SECTION, "+( '999' + ' ' )", 999, +( '999'+' ') );
+ array[item++] = new TestCase( SECTION, "+( '999' + '\\n' )", 999, +( '999'+'\n' ) );
+ array[item++] = new TestCase( SECTION, "+( '999' + '\\r' )", 999, +( '999'+'\r' ) );
+ array[item++] = new TestCase( SECTION, "+( '999' + '\\t' )", 999, +( '999'+'\t' ) );
+ array[item++] = new TestCase( SECTION, "+( '999' + '\\f' )", 999, +( '999'+'\f' ) );
+
+ array[item++] = new TestCase( SECTION, "+( '\\n' + '999' + '\\n' )", 999, +( '\n' +'999'+'\n' ) );
+ array[item++] = new TestCase( SECTION, "+( '\\r' + '999' + '\\r' )", 999, +( '\r' +'999'+'\r' ) );
+ array[item++] = new TestCase( SECTION, "+( '\\t' + '999' + '\\t' )", 999, +( '\t' +'999'+'\t' ) );
+ array[item++] = new TestCase( SECTION, "+( '\\f' + '999' + '\\f' )", 999, +( '\f' +'999'+'\f' ) );
+
+ array[item++] = new TestCase( SECTION, "+( String.fromCharCode(0x0009) + '99' )", 99, +( String.fromCharCode(0x0009) + '99' ) );
+ array[item++] = new TestCase( SECTION, "+( String.fromCharCode(0x0020) + '99' )", 99, +( String.fromCharCode(0x0020) + '99' ) );
+ array[item++] = new TestCase( SECTION, "+( String.fromCharCode(0x000C) + '99' )", 99, +( String.fromCharCode(0x000C) + '99' ) );
+ array[item++] = new TestCase( SECTION, "+( String.fromCharCode(0x000B) + '99' )", 99, +( String.fromCharCode(0x000B) + '99' ) );
+ array[item++] = new TestCase( SECTION, "+( String.fromCharCode(0x000D) + '99' )", 99, +( String.fromCharCode(0x000D) + '99' ) );
+ array[item++] = new TestCase( SECTION, "+( String.fromCharCode(0x000A) + '99' )", 99, +( String.fromCharCode(0x000A) + '99' ) );
+
+ array[item++] = new TestCase( SECTION, "+( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x0009)", 99, +( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x0009)) );
+ array[item++] = new TestCase( SECTION, "+( String.fromCharCode(0x0020) + '99' + String.fromCharCode(0x0020)", 99, +( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x0020)) );
+ array[item++] = new TestCase( SECTION, "+( String.fromCharCode(0x000C) + '99' + String.fromCharCode(0x000C)", 99, +( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x000C)) );
+ array[item++] = new TestCase( SECTION, "+( String.fromCharCode(0x000D) + '99' + String.fromCharCode(0x000D)", 99, +( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x000D)) );
+ array[item++] = new TestCase( SECTION, "+( String.fromCharCode(0x000B) + '99' + String.fromCharCode(0x000B)", 99, +( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x000B)) );
+ array[item++] = new TestCase( SECTION, "+( String.fromCharCode(0x000A) + '99' + String.fromCharCode(0x000A)", 99, +( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x000A)) );
+
+ array[item++] = new TestCase( SECTION, "+( '99' + String.fromCharCode(0x0009)", 99, +( '99' + String.fromCharCode(0x0009)) );
+ array[item++] = new TestCase( SECTION, "+( '99' + String.fromCharCode(0x0020)", 99, +( '99' + String.fromCharCode(0x0020)) );
+ array[item++] = new TestCase( SECTION, "+( '99' + String.fromCharCode(0x000C)", 99, +( '99' + String.fromCharCode(0x000C)) );
+ array[item++] = new TestCase( SECTION, "+( '99' + String.fromCharCode(0x000D)", 99, +( '99' + String.fromCharCode(0x000D)) );
+ array[item++] = new TestCase( SECTION, "+( '99' + String.fromCharCode(0x000B)", 99, +( '99' + String.fromCharCode(0x000B)) );
+ array[item++] = new TestCase( SECTION, "+( '99' + String.fromCharCode(0x000A)", 99, +( '99' + String.fromCharCode(0x000A)) );
+
+ array[item++] = new TestCase( SECTION, "+( String.fromCharCode(0x0009) + 99 )", 99, +( String.fromCharCode(0x0009) + 99 ) );
+ array[item++] = new TestCase( SECTION, "+( String.fromCharCode(0x0020) + 99 )", 99, +( String.fromCharCode(0x0020) + 99 ) );
+ array[item++] = new TestCase( SECTION, "+( String.fromCharCode(0x000C) + 99 )", 99, +( String.fromCharCode(0x000C) + 99 ) );
+ array[item++] = new TestCase( SECTION, "+( String.fromCharCode(0x000B) + 99 )", 99, +( String.fromCharCode(0x000B) + 99 ) );
+ array[item++] = new TestCase( SECTION, "+( String.fromCharCode(0x000D) + 99 )", 99, +( String.fromCharCode(0x000D) + 99 ) );
+ array[item++] = new TestCase( SECTION, "+( String.fromCharCode(0x000A) + 99 )", 99, +( String.fromCharCode(0x000A) + 99 ) );
+
+ array[item++] = new TestCase( SECTION, "+( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x0009)", 99, +( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x0009)) );
+ array[item++] = new TestCase( SECTION, "+( String.fromCharCode(0x0020) + 99 + String.fromCharCode(0x0020)", 99, +( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x0020)) );
+ array[item++] = new TestCase( SECTION, "+( String.fromCharCode(0x000C) + 99 + String.fromCharCode(0x000C)", 99, +( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x000C)) );
+ array[item++] = new TestCase( SECTION, "+( String.fromCharCode(0x000D) + 99 + String.fromCharCode(0x000D)", 99, +( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x000D)) );
+ array[item++] = new TestCase( SECTION, "+( String.fromCharCode(0x000B) + 99 + String.fromCharCode(0x000B)", 99, +( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x000B)) );
+ array[item++] = new TestCase( SECTION, "+( String.fromCharCode(0x000A) + 99 + String.fromCharCode(0x000A)", 99, +( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x000A)) );
+
+ array[item++] = new TestCase( SECTION, "+( 99 + String.fromCharCode(0x0009)", 99, +( 99 + String.fromCharCode(0x0009)) );
+ array[item++] = new TestCase( SECTION, "+( 99 + String.fromCharCode(0x0020)", 99, +( 99 + String.fromCharCode(0x0020)) );
+ array[item++] = new TestCase( SECTION, "+( 99 + String.fromCharCode(0x000C)", 99, +( 99 + String.fromCharCode(0x000C)) );
+ array[item++] = new TestCase( SECTION, "+( 99 + String.fromCharCode(0x000D)", 99, +( 99 + String.fromCharCode(0x000D)) );
+ array[item++] = new TestCase( SECTION, "+( 99 + String.fromCharCode(0x000B)", 99, +( 99 + String.fromCharCode(0x000B)) );
+ array[item++] = new TestCase( SECTION, "+( 99 + String.fromCharCode(0x000A)", 99, +( 99 + String.fromCharCode(0x000A)) );
+
+
+ // StrNumericLiteral:::StrDecimalLiteral:::Infinity
+
+ array[item++] = new TestCase( SECTION, "+('Infinity')", Math.pow(10,10000), +("Infinity") );
+ array[item++] = new TestCase( SECTION, "+('-Infinity')", -Math.pow(10,10000), +("-Infinity") );
+ array[item++] = new TestCase( SECTION, "+('+Infinity')", Math.pow(10,10000), +("+Infinity") );
+
+ // StrNumericLiteral::: StrDecimalLiteral ::: DecimalDigits . DecimalDigits opt ExponentPart opt
+
+ array[item++] = new TestCase( SECTION, "+('0')", 0, +("0") );
+ array[item++] = new TestCase( SECTION, "+('-0')", -0, +("-0") );
+ array[item++] = new TestCase( SECTION, "+('+0')", 0, +("+0") );
+
+ array[item++] = new TestCase( SECTION, "+('1')", 1, +("1") );
+ array[item++] = new TestCase( SECTION, "+('-1')", -1, +("-1") );
+ array[item++] = new TestCase( SECTION, "+('+1')", 1, +("+1") );
+
+ array[item++] = new TestCase( SECTION, "+('2')", 2, +("2") );
+ array[item++] = new TestCase( SECTION, "+('-2')", -2, +("-2") );
+ array[item++] = new TestCase( SECTION, "+('+2')", 2, +("+2") );
+
+ array[item++] = new TestCase( SECTION, "+('3')", 3, +("3") );
+ array[item++] = new TestCase( SECTION, "+('-3')", -3, +("-3") );
+ array[item++] = new TestCase( SECTION, "+('+3')", 3, +("+3") );
+
+ array[item++] = new TestCase( SECTION, "+('4')", 4, +("4") );
+ array[item++] = new TestCase( SECTION, "+('-4')", -4, +("-4") );
+ array[item++] = new TestCase( SECTION, "+('+4')", 4, +("+4") );
+
+ array[item++] = new TestCase( SECTION, "+('5')", 5, +("5") );
+ array[item++] = new TestCase( SECTION, "+('-5')", -5, +("-5") );
+ array[item++] = new TestCase( SECTION, "+('+5')", 5, +("+5") );
+
+ array[item++] = new TestCase( SECTION, "+('6')", 6, +("6") );
+ array[item++] = new TestCase( SECTION, "+('-6')", -6, +("-6") );
+ array[item++] = new TestCase( SECTION, "+('+6')", 6, +("+6") );
+
+ array[item++] = new TestCase( SECTION, "+('7')", 7, +("7") );
+ array[item++] = new TestCase( SECTION, "+('-7')", -7, +("-7") );
+ array[item++] = new TestCase( SECTION, "+('+7')", 7, +("+7") );
+
+ array[item++] = new TestCase( SECTION, "+('8')", 8, +("8") );
+ array[item++] = new TestCase( SECTION, "+('-8')", -8, +("-8") );
+ array[item++] = new TestCase( SECTION, "+('+8')", 8, +("+8") );
+
+ array[item++] = new TestCase( SECTION, "+('9')", 9, +("9") );
+ array[item++] = new TestCase( SECTION, "+('-9')", -9, +("-9") );
+ array[item++] = new TestCase( SECTION, "+('+9')", 9, +("+9") );
+
+ array[item++] = new TestCase( SECTION, "+('3.14159')", 3.14159, +("3.14159") );
+ array[item++] = new TestCase( SECTION, "+('-3.14159')", -3.14159, +("-3.14159") );
+ array[item++] = new TestCase( SECTION, "+('+3.14159')", 3.14159, +("+3.14159") );
+
+ array[item++] = new TestCase( SECTION, "+('3.')", 3, +("3.") );
+ array[item++] = new TestCase( SECTION, "+('-3.')", -3, +("-3.") );
+ array[item++] = new TestCase( SECTION, "+('+3.')", 3, +("+3.") );
+
+ array[item++] = new TestCase( SECTION, "+('3.e1')", 30, +("3.e1") );
+ array[item++] = new TestCase( SECTION, "+('-3.e1')", -30, +("-3.e1") );
+ array[item++] = new TestCase( SECTION, "+('+3.e1')", 30, +("+3.e1") );
+
+ array[item++] = new TestCase( SECTION, "+('3.e+1')", 30, +("3.e+1") );
+ array[item++] = new TestCase( SECTION, "+('-3.e+1')", -30, +("-3.e+1") );
+ array[item++] = new TestCase( SECTION, "+('+3.e+1')", 30, +("+3.e+1") );
+
+ array[item++] = new TestCase( SECTION, "+('3.e-1')", .30, +("3.e-1") );
+ array[item++] = new TestCase( SECTION, "+('-3.e-1')", -.30, +("-3.e-1") );
+ array[item++] = new TestCase( SECTION, "+('+3.e-1')", .30, +("+3.e-1") );
+
+ // StrDecimalLiteral::: .DecimalDigits ExponentPart opt
+
+ array[item++] = new TestCase( SECTION, "+('.00001')", 0.00001, +(".00001") );
+ array[item++] = new TestCase( SECTION, "+('+.00001')", 0.00001, +("+.00001") );
+ array[item++] = new TestCase( SECTION, "+('-0.0001')", -0.00001, +("-.00001") );
+
+ array[item++] = new TestCase( SECTION, "+('.01e2')", 1, +(".01e2") );
+ array[item++] = new TestCase( SECTION, "+('+.01e2')", 1, +("+.01e2") );
+ array[item++] = new TestCase( SECTION, "+('-.01e2')", -1, +("-.01e2") );
+
+ array[item++] = new TestCase( SECTION, "+('.01e+2')", 1, +(".01e+2") );
+ array[item++] = new TestCase( SECTION, "+('+.01e+2')", 1, +("+.01e+2") );
+ array[item++] = new TestCase( SECTION, "+('-.01e+2')", -1, +("-.01e+2") );
+
+ array[item++] = new TestCase( SECTION, "+('.01e-2')", 0.0001, +(".01e-2") );
+ array[item++] = new TestCase( SECTION, "+('+.01e-2')", 0.0001, +("+.01e-2") );
+ array[item++] = new TestCase( SECTION, "+('-.01e-2')", -0.0001, +("-.01e-2") );
+
+ // StrDecimalLiteral::: DecimalDigits ExponentPart opt
+
+ array[item++] = new TestCase( SECTION, "+('1234e5')", 123400000, +("1234e5") );
+ array[item++] = new TestCase( SECTION, "+('+1234e5')", 123400000, +("+1234e5") );
+ array[item++] = new TestCase( SECTION, "+('-1234e5')", -123400000, +("-1234e5") );
+
+ array[item++] = new TestCase( SECTION, "+('1234e+5')", 123400000, +("1234e+5") );
+ array[item++] = new TestCase( SECTION, "+('+1234e+5')", 123400000, +("+1234e+5") );
+ array[item++] = new TestCase( SECTION, "+('-1234e+5')", -123400000, +("-1234e+5") );
+
+ array[item++] = new TestCase( SECTION, "+('1234e-5')", 0.01234, +("1234e-5") );
+ array[item++] = new TestCase( SECTION, "+('+1234e-5')", 0.01234, +("+1234e-5") );
+ array[item++] = new TestCase( SECTION, "+('-1234e-5')", -0.01234, +("-1234e-5") );
+
+ // StrNumericLiteral::: HexIntegerLiteral
+
+ array[item++] = new TestCase( SECTION, "+('0x0')", 0, +("0x0"));
+ array[item++] = new TestCase( SECTION, "+('0x1')", 1, +("0x1"));
+ array[item++] = new TestCase( SECTION, "+('0x2')", 2, +("0x2"));
+ array[item++] = new TestCase( SECTION, "+('0x3')", 3, +("0x3"));
+ array[item++] = new TestCase( SECTION, "+('0x4')", 4, +("0x4"));
+ array[item++] = new TestCase( SECTION, "+('0x5')", 5, +("0x5"));
+ array[item++] = new TestCase( SECTION, "+('0x6')", 6, +("0x6"));
+ array[item++] = new TestCase( SECTION, "+('0x7')", 7, +("0x7"));
+ array[item++] = new TestCase( SECTION, "+('0x8')", 8, +("0x8"));
+ array[item++] = new TestCase( SECTION, "+('0x9')", 9, +("0x9"));
+ array[item++] = new TestCase( SECTION, "+('0xa')", 10, +("0xa"));
+ array[item++] = new TestCase( SECTION, "+('0xb')", 11, +("0xb"));
+ array[item++] = new TestCase( SECTION, "+('0xc')", 12, +("0xc"));
+ array[item++] = new TestCase( SECTION, "+('0xd')", 13, +("0xd"));
+ array[item++] = new TestCase( SECTION, "+('0xe')", 14, +("0xe"));
+ array[item++] = new TestCase( SECTION, "+('0xf')", 15, +("0xf"));
+ array[item++] = new TestCase( SECTION, "+('0xA')", 10, +("0xA"));
+ array[item++] = new TestCase( SECTION, "+('0xB')", 11, +("0xB"));
+ array[item++] = new TestCase( SECTION, "+('0xC')", 12, +("0xC"));
+ array[item++] = new TestCase( SECTION, "+('0xD')", 13, +("0xD"));
+ array[item++] = new TestCase( SECTION, "+('0xE')", 14, +("0xE"));
+ array[item++] = new TestCase( SECTION, "+('0xF')", 15, +("0xF"));
+
+ array[item++] = new TestCase( SECTION, "+('0X0')", 0, +("0X0"));
+ array[item++] = new TestCase( SECTION, "+('0X1')", 1, +("0X1"));
+ array[item++] = new TestCase( SECTION, "+('0X2')", 2, +("0X2"));
+ array[item++] = new TestCase( SECTION, "+('0X3')", 3, +("0X3"));
+ array[item++] = new TestCase( SECTION, "+('0X4')", 4, +("0X4"));
+ array[item++] = new TestCase( SECTION, "+('0X5')", 5, +("0X5"));
+ array[item++] = new TestCase( SECTION, "+('0X6')", 6, +("0X6"));
+ array[item++] = new TestCase( SECTION, "+('0X7')", 7, +("0X7"));
+ array[item++] = new TestCase( SECTION, "+('0X8')", 8, +("0X8"));
+ array[item++] = new TestCase( SECTION, "+('0X9')", 9, +("0X9"));
+ array[item++] = new TestCase( SECTION, "+('0Xa')", 10, +("0Xa"));
+ array[item++] = new TestCase( SECTION, "+('0Xb')", 11, +("0Xb"));
+ array[item++] = new TestCase( SECTION, "+('0Xc')", 12, +("0Xc"));
+ array[item++] = new TestCase( SECTION, "+('0Xd')", 13, +("0Xd"));
+ array[item++] = new TestCase( SECTION, "+('0Xe')", 14, +("0Xe"));
+ array[item++] = new TestCase( SECTION, "+('0Xf')", 15, +("0Xf"));
+ array[item++] = new TestCase( SECTION, "+('0XA')", 10, +("0XA"));
+ array[item++] = new TestCase( SECTION, "+('0XB')", 11, +("0XB"));
+ array[item++] = new TestCase( SECTION, "+('0XC')", 12, +("0XC"));
+ array[item++] = new TestCase( SECTION, "+('0XD')", 13, +("0XD"));
+ array[item++] = new TestCase( SECTION, "+('0XE')", 14, +("0XE"));
+ array[item++] = new TestCase( SECTION, "+('0XF')", 15, +("0XF"));
+
+ return array;
+
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.4.8.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.4.8.js
new file mode 100644
index 0000000..491167f
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.4.8.js
@@ -0,0 +1,215 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+ /**
+ File Name: 11.4.8.js
+ ECMA Section: 11.4.8 Bitwise NOT Operator
+ Description: flip bits up to 32 bits
+ no special cases
+ Author: christine@netscape.com
+ Date: 7 july 1997
+
+ Data File Fields:
+ VALUE value passed as an argument to the ~ operator
+ E_RESULT expected return value of ~ VALUE;
+
+ Static variables:
+ none
+
+*/
+
+ var SECTION = "11.4.8";
+ var VERSION = "ECMA_1";
+ startTest();
+ var testcases = getTestCases();
+
+ writeHeaderToLog( SECTION + " Bitwise Not operator");
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ for ( var i = 0; i < 35; i++ ) {
+ var p = Math.pow(2,i);
+
+ array[item++] = new TestCase( SECTION, "~"+p, Not(p), ~p );
+
+ }
+ for ( i = 0; i < 35; i++ ) {
+ var p = -Math.pow(2,i);
+
+ array[item++] = new TestCase( SECTION, "~"+p, Not(p), ~p );
+
+ }
+
+ return ( array );
+}
+function ToInteger( n ) {
+ n = Number( n );
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ if ( n != n ) {
+ return 0;
+ }
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY ) {
+ return n;
+ }
+ return ( sign * Math.floor(Math.abs(n)) );
+}
+function ToInt32( n ) {
+ n = Number( n );
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
+ return 0;
+ }
+
+ n = (sign * Math.floor( Math.abs(n) )) % Math.pow(2,32);
+ n = ( n >= Math.pow(2,31) ) ? n - Math.pow(2,32) : n;
+
+ return ( n );
+}
+function ToUint32( n ) {
+ n = Number( n );
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
+ return 0;
+ }
+ n = sign * Math.floor( Math.abs(n) )
+
+ n = n % Math.pow(2,32);
+
+ if ( n < 0 ){
+ n += Math.pow(2,32);
+ }
+
+ return ( n );
+}
+function ToUint16( n ) {
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
+ return 0;
+ }
+
+ n = ( sign * Math.floor( Math.abs(n) ) ) % Math.pow(2,16);
+
+ if (n <0) {
+ n += Math.pow(2,16);
+ }
+
+ return ( n );
+}
+function Mask( b, n ) {
+ b = ToUint32BitString( b );
+ b = b.substring( b.length - n );
+ b = ToUint32Decimal( b );
+ return ( b );
+}
+function ToUint32BitString( n ) {
+ var b = "";
+ for ( p = 31; p >=0; p-- ) {
+ if ( n >= Math.pow(2,p) ) {
+ b += "1";
+ n -= Math.pow(2,p);
+ } else {
+ b += "0";
+ }
+ }
+ return b;
+}
+function ToInt32BitString( n ) {
+ var b = "";
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ b += ( sign == 1 ) ? "0" : "1";
+
+ for ( p = 30; p >=0; p-- ) {
+ if ( (sign == 1 ) ? sign * n >= Math.pow(2,p) : sign * n > Math.pow(2,p) ) {
+ b += ( sign == 1 ) ? "1" : "0";
+ n -= sign * Math.pow( 2, p );
+ } else {
+ b += ( sign == 1 ) ? "0" : "1";
+ }
+ }
+
+ return b;
+}
+function ToInt32Decimal( bin ) {
+ var r = 0;
+ var sign;
+
+ if ( Number(bin.charAt(0)) == 0 ) {
+ sign = 1;
+ r = 0;
+ } else {
+ sign = -1;
+ r = -(Math.pow(2,31));
+ }
+
+ for ( var j = 0; j < 31; j++ ) {
+ r += Math.pow( 2, j ) * Number(bin.charAt(31-j));
+ }
+
+ return r;
+}
+function ToUint32Decimal( bin ) {
+ var r = 0;
+
+ for ( l = bin.length; l < 32; l++ ) {
+ bin = "0" + bin;
+ }
+
+ for ( j = 0; j < 31; j++ ) {
+ r += Math.pow( 2, j ) * Number(bin.charAt(31-j));
+ }
+
+ return r;
+}
+function Not( n ) {
+ n = ToInt32(n);
+ n = ToInt32BitString(n);
+
+ r = ""
+
+ for( var l = 0; l < n.length; l++ ) {
+ r += ( n.charAt(l) == "0" ) ? "1" : "0";
+ }
+
+ n = ToInt32Decimal(r);
+
+ return n;
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.4.9.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.4.9.js
new file mode 100644
index 0000000..90ef06d
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.4.9.js
@@ -0,0 +1,90 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 11.4.9.js
+ ECMA Section: 11.4.9 Logical NOT Operator (!)
+ Description: if the ToBoolean( VALUE ) result is true, return
+ true. else return false.
+ Author: christine@netscape.com
+ Date: 7 july 1997
+
+ Static variables:
+ none
+*/
+ var SECTION = "11.4.9";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Logical NOT operator (!)";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+// version("130")
+
+ var testcases = new Array();
+
+ testcases[tc++] = new TestCase( SECTION, "!(null)", true, !(null) );
+ testcases[tc++] = new TestCase( SECTION, "!(var x)", true, !(eval("var x")) );
+ testcases[tc++] = new TestCase( SECTION, "!(void 0)", true, !(void 0) );
+
+ testcases[tc++] = new TestCase( SECTION, "!(false)", true, !(false) );
+ testcases[tc++] = new TestCase( SECTION, "!(true)", false, !(true) );
+ testcases[tc++] = new TestCase( SECTION, "!()", true, !(eval()) );
+ testcases[tc++] = new TestCase( SECTION, "!(0)", true, !(0) );
+ testcases[tc++] = new TestCase( SECTION, "!(-0)", true, !(-0) );
+ testcases[tc++] = new TestCase( SECTION, "!(NaN)", true, !(Number.NaN) );
+ testcases[tc++] = new TestCase( SECTION, "!(Infinity)", false, !(Number.POSITIVE_INFINITY) );
+ testcases[tc++] = new TestCase( SECTION, "!(-Infinity)", false, !(Number.NEGATIVE_INFINITY) );
+ testcases[tc++] = new TestCase( SECTION, "!(Math.PI)", false, !(Math.PI) );
+ testcases[tc++] = new TestCase( SECTION, "!(1)", false, !(1) );
+ testcases[tc++] = new TestCase( SECTION, "!(-1)", false, !(-1) );
+ testcases[tc++] = new TestCase( SECTION, "!('')", true, !("") );
+ testcases[tc++] = new TestCase( SECTION, "!('\t')", false, !("\t") );
+ testcases[tc++] = new TestCase( SECTION, "!('0')", false, !("0") );
+ testcases[tc++] = new TestCase( SECTION, "!('string')", false, !("string") );
+ testcases[tc++] = new TestCase( SECTION, "!(new String(''))", false, !(new String("")) );
+ testcases[tc++] = new TestCase( SECTION, "!(new String('string'))", false, !(new String("string")) );
+ testcases[tc++] = new TestCase( SECTION, "!(new String())", false, !(new String()) );
+ testcases[tc++] = new TestCase( SECTION, "!(new Boolean(true))", false, !(new Boolean(true)) );
+ testcases[tc++] = new TestCase( SECTION, "!(new Boolean(false))", false, !(new Boolean(false)) );
+ testcases[tc++] = new TestCase( SECTION, "!(new Array())", false, !(new Array()) );
+ testcases[tc++] = new TestCase( SECTION, "!(new Array(1,2,3)", false, !(new Array(1,2,3)) );
+ testcases[tc++] = new TestCase( SECTION, "!(new Number())", false, !(new Number()) );
+ testcases[tc++] = new TestCase( SECTION, "!(new Number(0))", false, !(new Number(0)) );
+ testcases[tc++] = new TestCase( SECTION, "!(new Number(NaN))", false, !(new Number(Number.NaN)) );
+ testcases[tc++] = new TestCase( SECTION, "!(new Number(Infinity))", false, !(new Number(Number.POSITIVE_INFINITY)) );
+
+ test();
+
+function test() {
+ for ( tc = 0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "
+ }
+ stopTest();
+
+ // all tests must return a boolean value
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.5.1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.5.1.js
new file mode 100644
index 0000000..67c0a8a
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.5.1.js
@@ -0,0 +1,115 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 11.5.1.js
+ ECMA Section: 11.5.1 Applying the * operator
+ Description:
+
+ 11.5.1 Applying the * operator
+
+ The * operator performs multiplication, producing the product of its
+ operands. Multiplication is commutative. Multiplication is not always
+ associative in ECMAScript, because of finite precision.
+
+ The result of a floating-point multiplication is governed by the rules
+ of IEEE 754 double-precision arithmetic:
+
+ If either operand is NaN, the result is NaN.
+ The sign of the result is positive if both operands have the same sign,
+ negative if the operands have different signs.
+ Multiplication of an infinity by a zero results in NaN.
+ Multiplication of an infinity by an infinity results in an infinity.
+ The sign is determined by the rule already stated above.
+ Multiplication of an infinity by a finite non-zero value results in a
+ signed infinity. The sign is determined by the rule already stated above.
+ In the remaining cases, where neither an infinity or NaN is involved, the
+ product is computed and rounded to the nearest representable value using IEEE
+ 754 round-to-nearest mode. If the magnitude is too large to represent,
+ the result is then an infinity of appropriate sign. If the magnitude is
+ oo small to represent, the result is then a zero
+ of appropriate sign. The ECMAScript language requires support of gradual
+ underflow as defined by IEEE 754.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "11.5.1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var testcases = getTestCases();
+
+ writeHeaderToLog( SECTION + " Applying the * operator");
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "Number.NaN * Number.NaN", Number.NaN, Number.NaN * Number.NaN );
+ array[item++] = new TestCase( SECTION, "Number.NaN * 1", Number.NaN, Number.NaN * 1 );
+ array[item++] = new TestCase( SECTION, "1 * Number.NaN", Number.NaN, 1 * Number.NaN );
+
+ array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY * 0", Number.NaN, Number.POSITIVE_INFINITY * 0 );
+ array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY * 0", Number.NaN, Number.NEGATIVE_INFINITY * 0 );
+ array[item++] = new TestCase( SECTION, "0 * Number.POSITIVE_INFINITY", Number.NaN, 0 * Number.POSITIVE_INFINITY );
+ array[item++] = new TestCase( SECTION, "0 * Number.NEGATIVE_INFINITY", Number.NaN, 0 * Number.NEGATIVE_INFINITY );
+
+ array[item++] = new TestCase( SECTION, "-0 * Number.POSITIVE_INFINITY", Number.NaN, -0 * Number.POSITIVE_INFINITY );
+ array[item++] = new TestCase( SECTION, "-0 * Number.NEGATIVE_INFINITY", Number.NaN, -0 * Number.NEGATIVE_INFINITY );
+ array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY * -0", Number.NaN, Number.POSITIVE_INFINITY * -0 );
+ array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY * -0", Number.NaN, Number.NEGATIVE_INFINITY * -0 );
+
+ array[item++] = new TestCase( SECTION, "0 * -0", -0, 0 * -0 );
+ array[item++] = new TestCase( SECTION, "-0 * 0", -0, -0 * 0 );
+ array[item++] = new TestCase( SECTION, "-0 * -0", 0, -0 * -0 );
+ array[item++] = new TestCase( SECTION, "0 * 0", 0, 0 * 0 );
+
+ array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY * Number.NEGATIVE_INFINITY", Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY * Number.NEGATIVE_INFINITY );
+ array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY * Number.NEGATIVE_INFINITY", Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY * Number.NEGATIVE_INFINITY );
+ array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY * Number.POSITIVE_INFINITY", Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY * Number.POSITIVE_INFINITY );
+ array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY * Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY * Number.POSITIVE_INFINITY );
+
+ array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY * 1 ", Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY * 1 );
+ array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY * -1 ", Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY * -1 );
+ array[item++] = new TestCase( SECTION, "1 * Number.NEGATIVE_INFINITY", Number.NEGATIVE_INFINITY, 1 * Number.NEGATIVE_INFINITY );
+ array[item++] = new TestCase( SECTION, "-1 * Number.NEGATIVE_INFINITY", Number.POSITIVE_INFINITY, -1 * Number.NEGATIVE_INFINITY );
+
+ array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY * 1 ", Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY * 1 );
+ array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY * -1 ", Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY * -1 );
+ array[item++] = new TestCase( SECTION, "1 * Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY, 1 * Number.POSITIVE_INFINITY );
+ array[item++] = new TestCase( SECTION, "-1 * Number.POSITIVE_INFINITY", Number.NEGATIVE_INFINITY, -1 * Number.POSITIVE_INFINITY );
+
+ return ( array );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.5.2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.5.2.js
new file mode 100644
index 0000000..c681a35
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.5.2.js
@@ -0,0 +1,154 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 11.5.2.js
+ ECMA Section: 11.5.2 Applying the / operator
+ Description:
+
+ The / operator performs division, producing the quotient of its operands.
+ The left operand is the dividend and the right operand is the divisor.
+ ECMAScript does not perform integer division. The operands and result of all
+ division operations are double-precision floating-point numbers.
+ The result of division is determined by the specification of IEEE 754 arithmetic:
+
+ If either operand is NaN, the result is NaN.
+ The sign of the result is positive if both operands have the same sign, negative if the operands have different
+ signs.
+ Division of an infinity by an infinity results in NaN.
+ Division of an infinity by a zero results in an infinity. The sign is determined by the rule already stated above.
+ Division of an infinity by a non-zero finite value results in a signed infinity. The sign is determined by the rule
+ already stated above.
+ Division of a finite value by an infinity results in zero. The sign is determined by the rule already stated above.
+ Division of a zero by a zero results in NaN; division of zero by any other finite value results in zero, with the sign
+ determined by the rule already stated above.
+ Division of a non-zero finite value by a zero results in a signed infinity. The sign is determined by the rule
+ already stated above.
+ In the remaining cases, where neither an infinity, nor a zero, nor NaN is involved, the quotient is computed and
+ rounded to the nearest representable value using IEEE 754 round-to-nearest mode. If the magnitude is too
+ large to represent, we say the operation overflows; the result is then an infinity of appropriate sign. If the
+ magnitude is too small to represent, we say the operation underflows and the result is a zero of the appropriate
+ sign. The ECMAScript language requires support of gradual underflow as defined by IEEE 754.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "11.5.2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var testcases = getTestCases();
+ var BUGNUMBER="111202";
+
+ writeHeaderToLog( SECTION + " Applying the / operator");
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ // if either operand is NaN, the result is NaN.
+
+ array[item++] = new TestCase( SECTION, "Number.NaN / Number.NaN", Number.NaN, Number.NaN / Number.NaN );
+ array[item++] = new TestCase( SECTION, "Number.NaN / 1", Number.NaN, Number.NaN / 1 );
+ array[item++] = new TestCase( SECTION, "1 / Number.NaN", Number.NaN, 1 / Number.NaN );
+
+ array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY / Number.NaN", Number.NaN, Number.POSITIVE_INFINITY / Number.NaN );
+ array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY / Number.NaN", Number.NaN, Number.NEGATIVE_INFINITY / Number.NaN );
+
+ // Division of an infinity by an infinity results in NaN.
+
+ array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY / Number.NEGATIVE_INFINITY", Number.NaN, Number.NEGATIVE_INFINITY / Number.NEGATIVE_INFINITY );
+ array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY / Number.NEGATIVE_INFINITY", Number.NaN, Number.POSITIVE_INFINITY / Number.NEGATIVE_INFINITY );
+ array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY / Number.POSITIVE_INFINITY", Number.NaN, Number.NEGATIVE_INFINITY / Number.POSITIVE_INFINITY );
+ array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY / Number.POSITIVE_INFINITY", Number.NaN, Number.POSITIVE_INFINITY / Number.POSITIVE_INFINITY );
+
+ // Division of an infinity by a zero results in an infinity.
+
+ array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY / 0", Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY / 0 );
+ array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY / 0", Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY / 0 );
+ array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY / -0", Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY / -0 );
+ array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY / -0", Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY / -0 );
+
+ // Division of an infinity by a non-zero finite value results in a signed infinity.
+
+ array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY / 1 ", Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY / 1 );
+ array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY / -1 ", Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY / -1 );
+ array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY / 1 ", Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY / 1 );
+ array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY / -1 ", Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY / -1 );
+
+ array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY / Number.MAX_VALUE ", Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY / Number.MAX_VALUE );
+ array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY / -Number.MAX_VALUE ", Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY / -Number.MAX_VALUE );
+ array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY / Number.MAX_VALUE ", Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY / Number.MAX_VALUE );
+ array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY / -Number.MAX_VALUE ", Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY / -Number.MAX_VALUE );
+
+ // Division of a finite value by an infinity results in zero.
+
+ array[item++] = new TestCase( SECTION, "1 / Number.NEGATIVE_INFINITY", -0, 1 / Number.NEGATIVE_INFINITY );
+ array[item++] = new TestCase( SECTION, "1 / Number.POSITIVE_INFINITY", 0, 1 / Number.POSITIVE_INFINITY );
+ array[item++] = new TestCase( SECTION, "-1 / Number.POSITIVE_INFINITY", -0, -1 / Number.POSITIVE_INFINITY );
+ array[item++] = new TestCase( SECTION, "-1 / Number.NEGATIVE_INFINITY", 0, -1 / Number.NEGATIVE_INFINITY );
+
+ array[item++] = new TestCase( SECTION, "Number.MAX_VALUE / Number.NEGATIVE_INFINITY", -0, Number.MAX_VALUE / Number.NEGATIVE_INFINITY );
+ array[item++] = new TestCase( SECTION, "Number.MAX_VALUE / Number.POSITIVE_INFINITY", 0, Number.MAX_VALUE / Number.POSITIVE_INFINITY );
+ array[item++] = new TestCase( SECTION, "-Number.MAX_VALUE / Number.POSITIVE_INFINITY", -0, -Number.MAX_VALUE / Number.POSITIVE_INFINITY );
+ array[item++] = new TestCase( SECTION, "-Number.MAX_VALUE / Number.NEGATIVE_INFINITY", 0, -Number.MAX_VALUE / Number.NEGATIVE_INFINITY );
+
+ // Division of a zero by a zero results in NaN
+
+ array[item++] = new TestCase( SECTION, "0 / -0", Number.NaN, 0 / -0 );
+ array[item++] = new TestCase( SECTION, "-0 / 0", Number.NaN, -0 / 0 );
+ array[item++] = new TestCase( SECTION, "-0 / -0", Number.NaN, -0 / -0 );
+ array[item++] = new TestCase( SECTION, "0 / 0", Number.NaN, 0 / 0 );
+
+ // division of zero by any other finite value results in zero
+
+ array[item++] = new TestCase( SECTION, "0 / 1", 0, 0 / 1 );
+ array[item++] = new TestCase( SECTION, "0 / -1", -0, 0 / -1 );
+ array[item++] = new TestCase( SECTION, "-0 / 1", -0, -0 / 1 );
+ array[item++] = new TestCase( SECTION, "-0 / -1", 0, -0 / -1 );
+
+ // Division of a non-zero finite value by a zero results in a signed infinity.
+
+ array[item++] = new TestCase( SECTION, "1 / 0", Number.POSITIVE_INFINITY, 1/0 );
+ array[item++] = new TestCase( SECTION, "1 / -0", Number.NEGATIVE_INFINITY, 1/-0 );
+ array[item++] = new TestCase( SECTION, "-1 / 0", Number.NEGATIVE_INFINITY, -1/0 );
+ array[item++] = new TestCase( SECTION, "-1 / -0", Number.POSITIVE_INFINITY, -1/-0 );
+
+ array[item++] = new TestCase( SECTION, "0 / Number.POSITIVE_INFINITY", 0, 0 / Number.POSITIVE_INFINITY );
+ array[item++] = new TestCase( SECTION, "0 / Number.NEGATIVE_INFINITY", -0, 0 / Number.NEGATIVE_INFINITY );
+ array[item++] = new TestCase( SECTION, "-0 / Number.POSITIVE_INFINITY", -0, -0 / Number.POSITIVE_INFINITY );
+ array[item++] = new TestCase( SECTION, "-0 / Number.NEGATIVE_INFINITY", 0, -0 / Number.NEGATIVE_INFINITY );
+
+ return ( array );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.5.3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.5.3.js
new file mode 100644
index 0000000..8b9722c
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.5.3.js
@@ -0,0 +1,160 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 11.5.3.js
+ ECMA Section: 11.5.3 Applying the % operator
+ Description:
+
+ The binary % operator is said to yield the remainder of its operands from
+ an implied division; the left operand is the dividend and the right operand
+ is the divisor. In C and C++, the remainder operator accepts only integral
+ operands, but in ECMAScript, it also accepts floating-point operands.
+
+ The result of a floating-point remainder operation as computed by the %
+ operator is not the same as the "remainder" operation defined by IEEE 754.
+ The IEEE 754 "remainder" operation computes the remainder from a rounding
+ division, not a truncating division, and so its behavior is not analogous
+ to that of the usual integer remainder operator. Instead the ECMAScript
+ language defines % on floating-point operations to behave in a manner
+ analogous to that of the Java integer remainder operator; this may be
+ compared with the C library function fmod.
+
+ The result of a ECMAScript floating-point remainder operation is determined by the rules of IEEE arithmetic:
+
+ If either operand is NaN, the result is NaN.
+ The sign of the result equals the sign of the dividend.
+ If the dividend is an infinity, or the divisor is a zero, or both, the result is NaN.
+ If the dividend is finite and the divisor is an infinity, the result equals the dividend.
+ If the dividend is a zero and the divisor is finite, the result is the same as the dividend.
+ In the remaining cases, where neither an infinity, nor a zero, nor NaN is involved, the floating-point remainder r
+ from a dividend n and a divisor d is defined by the mathematical relation r = n (d * q) where q is an integer that
+ is negative only if n/d is negative and positive only if n/d is positive, and whose magnitude is as large as
+ possible without exceeding the magnitude of the true mathematical quotient of n and d.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "11.5.3";
+ var VERSION = "ECMA_1";
+ startTest();
+ var testcases = getTestCases();
+ var BUGNUMBER="111202";
+
+ writeHeaderToLog( SECTION + " Applying the % operator");
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ // if either operand is NaN, the result is NaN.
+
+ array[item++] = new TestCase( SECTION, "Number.NaN % Number.NaN", Number.NaN, Number.NaN % Number.NaN );
+ array[item++] = new TestCase( SECTION, "Number.NaN % 1", Number.NaN, Number.NaN % 1 );
+ array[item++] = new TestCase( SECTION, "1 % Number.NaN", Number.NaN, 1 % Number.NaN );
+
+ array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY % Number.NaN", Number.NaN, Number.POSITIVE_INFINITY % Number.NaN );
+ array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY % Number.NaN", Number.NaN, Number.NEGATIVE_INFINITY % Number.NaN );
+
+ // If the dividend is an infinity, or the divisor is a zero, or both, the result is NaN.
+ // dividend is an infinity
+
+ array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY % Number.NEGATIVE_INFINITY", Number.NaN, Number.NEGATIVE_INFINITY % Number.NEGATIVE_INFINITY );
+ array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY % Number.NEGATIVE_INFINITY", Number.NaN, Number.POSITIVE_INFINITY % Number.NEGATIVE_INFINITY );
+ array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY % Number.POSITIVE_INFINITY", Number.NaN, Number.NEGATIVE_INFINITY % Number.POSITIVE_INFINITY );
+ array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY % Number.POSITIVE_INFINITY", Number.NaN, Number.POSITIVE_INFINITY % Number.POSITIVE_INFINITY );
+
+ array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY % 0", Number.NaN, Number.POSITIVE_INFINITY % 0 );
+ array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY % 0", Number.NaN, Number.NEGATIVE_INFINITY % 0 );
+ array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY % -0", Number.NaN, Number.POSITIVE_INFINITY % -0 );
+ array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY % -0", Number.NaN, Number.NEGATIVE_INFINITY % -0 );
+
+ array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY % 1 ", Number.NaN, Number.NEGATIVE_INFINITY % 1 );
+ array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY % -1 ", Number.NaN, Number.NEGATIVE_INFINITY % -1 );
+ array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY % 1 ", Number.NaN, Number.POSITIVE_INFINITY % 1 );
+ array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY % -1 ", Number.NaN, Number.POSITIVE_INFINITY % -1 );
+
+ array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY % Number.MAX_VALUE ", Number.NaN, Number.NEGATIVE_INFINITY % Number.MAX_VALUE );
+ array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY % -Number.MAX_VALUE ", Number.NaN, Number.NEGATIVE_INFINITY % -Number.MAX_VALUE );
+ array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY % Number.MAX_VALUE ", Number.NaN, Number.POSITIVE_INFINITY % Number.MAX_VALUE );
+ array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY % -Number.MAX_VALUE ", Number.NaN, Number.POSITIVE_INFINITY % -Number.MAX_VALUE );
+
+ // divisor is 0
+ array[item++] = new TestCase( SECTION, "0 % -0", Number.NaN, 0 % -0 );
+ array[item++] = new TestCase( SECTION, "-0 % 0", Number.NaN, -0 % 0 );
+ array[item++] = new TestCase( SECTION, "-0 % -0", Number.NaN, -0 % -0 );
+ array[item++] = new TestCase( SECTION, "0 % 0", Number.NaN, 0 % 0 );
+
+ array[item++] = new TestCase( SECTION, "1 % 0", Number.NaN, 1%0 );
+ array[item++] = new TestCase( SECTION, "1 % -0", Number.NaN, 1%-0 );
+ array[item++] = new TestCase( SECTION, "-1 % 0", Number.NaN, -1%0 );
+ array[item++] = new TestCase( SECTION, "-1 % -0", Number.NaN, -1%-0 );
+
+ array[item++] = new TestCase( SECTION, "Number.MAX_VALUE % 0", Number.NaN, Number.MAX_VALUE%0 );
+ array[item++] = new TestCase( SECTION, "Number.MAX_VALUE % -0", Number.NaN, Number.MAX_VALUE%-0 );
+ array[item++] = new TestCase( SECTION, "-Number.MAX_VALUE % 0", Number.NaN, -Number.MAX_VALUE%0 );
+ array[item++] = new TestCase( SECTION, "-Number.MAX_VALUE % -0", Number.NaN, -Number.MAX_VALUE%-0 );
+
+ // If the dividend is finite and the divisor is an infinity, the result equals the dividend.
+
+ array[item++] = new TestCase( SECTION, "1 % Number.NEGATIVE_INFINITY", 1, 1 % Number.NEGATIVE_INFINITY );
+ array[item++] = new TestCase( SECTION, "1 % Number.POSITIVE_INFINITY", 1, 1 % Number.POSITIVE_INFINITY );
+ array[item++] = new TestCase( SECTION, "-1 % Number.POSITIVE_INFINITY", -1, -1 % Number.POSITIVE_INFINITY );
+ array[item++] = new TestCase( SECTION, "-1 % Number.NEGATIVE_INFINITY", -1, -1 % Number.NEGATIVE_INFINITY );
+
+ array[item++] = new TestCase( SECTION, "Number.MAX_VALUE % Number.NEGATIVE_INFINITY", Number.MAX_VALUE, Number.MAX_VALUE % Number.NEGATIVE_INFINITY );
+ array[item++] = new TestCase( SECTION, "Number.MAX_VALUE % Number.POSITIVE_INFINITY", Number.MAX_VALUE, Number.MAX_VALUE % Number.POSITIVE_INFINITY );
+ array[item++] = new TestCase( SECTION, "-Number.MAX_VALUE % Number.POSITIVE_INFINITY", -Number.MAX_VALUE, -Number.MAX_VALUE % Number.POSITIVE_INFINITY );
+ array[item++] = new TestCase( SECTION, "-Number.MAX_VALUE % Number.NEGATIVE_INFINITY", -Number.MAX_VALUE, -Number.MAX_VALUE % Number.NEGATIVE_INFINITY );
+
+ array[item++] = new TestCase( SECTION, "0 % Number.POSITIVE_INFINITY", 0, 0 % Number.POSITIVE_INFINITY );
+ array[item++] = new TestCase( SECTION, "0 % Number.NEGATIVE_INFINITY", 0, 0 % Number.NEGATIVE_INFINITY );
+ array[item++] = new TestCase( SECTION, "-0 % Number.POSITIVE_INFINITY", -0, -0 % Number.POSITIVE_INFINITY );
+ array[item++] = new TestCase( SECTION, "-0 % Number.NEGATIVE_INFINITY", -0, -0 % Number.NEGATIVE_INFINITY );
+
+ // If the dividend is a zero and the divisor is finite, the result is the same as the dividend.
+
+ array[item++] = new TestCase( SECTION, "0 % 1", 0, 0 % 1 );
+ array[item++] = new TestCase( SECTION, "0 % -1", -0, 0 % -1 );
+ array[item++] = new TestCase( SECTION, "-0 % 1", -0, -0 % 1 );
+ array[item++] = new TestCase( SECTION, "-0 % -1", 0, -0 % -1 );
+
+// In the remaining cases, where neither an infinity, nor a zero, nor NaN is involved, the floating-point remainder r
+// from a dividend n and a divisor d is defined by the mathematical relation r = n (d * q) where q is an integer that
+// is negative only if n/d is negative and positive only if n/d is positive, and whose magnitude is as large as
+// possible without exceeding the magnitude of the true mathematical quotient of n and d.
+
+ return ( array );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.6.1-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.6.1-1.js
new file mode 100644
index 0000000..58e5edc
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.6.1-1.js
@@ -0,0 +1,211 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 11.6.1-1.js
+ ECMA Section: 11.6.1 The addition operator ( + )
+ Description:
+
+ The addition operator either performs string concatenation or numeric
+ addition.
+
+ The production AdditiveExpression : AdditiveExpression + MultiplicativeExpression
+ is evaluated as follows:
+
+ 1. Evaluate AdditiveExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate MultiplicativeExpression.
+ 4. Call GetValue(Result(3)).
+ 5. Call ToPrimitive(Result(2)).
+ 6. Call ToPrimitive(Result(4)).
+ 7. If Type(Result(5)) is String or Type(Result(6)) is String, go to step 12.
+ (Note that this step differs from step 3 in the algorithm for comparison
+ for the relational operators in using or instead of and.)
+ 8. Call ToNumber(Result(5)).
+ 9. Call ToNumber(Result(6)).
+ 10. Apply the addition operation to Result(8) and Result(9). See the discussion below (11.6.3).
+ 11. Return Result(10).
+ 12. Call ToString(Result(5)).
+ 13. Call ToString(Result(6)).
+ 14. Concatenate Result(12) followed by Result(13).
+ 15. Return Result(14).
+
+ Note that no hint is provided in the calls to ToPrimitive in steps 5 and 6.
+ All native ECMAScript objects except Date objects handle the absence of a
+ hint as if the hint Number were given; Date objects handle the absence of a
+ hint as if the hint String were given. Host objects may handle the absence
+ of a hint in some other manner.
+
+ This test does not cover cases where the Additive or Mulplicative expression
+ ToPrimitive is string.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "11.6.1-1";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ var testcases = getTestCases();
+
+ writeHeaderToLog( SECTION + " The Addition operator ( + )");
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ // tests for boolean primitive, boolean object, Object object, a "MyObject" whose value is
+ // a boolean primitive and a boolean object, and "MyValuelessObject", where the value is
+ // set in the object's prototype, not the object itself.
+
+ array[item++] = new TestCase( SECTION,
+ "var EXP_1 = true; var EXP_2 = false; EXP_1 + EXP_2",
+ 1,
+ eval("var EXP_1 = true; var EXP_2 = false; EXP_1 + EXP_2") );
+
+ array[item++] = new TestCase( SECTION,
+ "var EXP_1 = new Boolean(true); var EXP_2 = new Boolean(false); EXP_1 + EXP_2",
+ 1,
+ eval("var EXP_1 = new Boolean(true); var EXP_2 = new Boolean(false); EXP_1 + EXP_2") );
+
+ array[item++] = new TestCase( SECTION,
+ "var EXP_1 = new Object(true); var EXP_2 = new Object(false); EXP_1 + EXP_2",
+ 1,
+ eval("var EXP_1 = new Object(true); var EXP_2 = new Object(false); EXP_1 + EXP_2") );
+
+ array[item++] = new TestCase( SECTION,
+ "var EXP_1 = new Object(new Boolean(true)); var EXP_2 = new Object(new Boolean(false)); EXP_1 + EXP_2",
+ 1,
+ eval("var EXP_1 = new Object(new Boolean(true)); var EXP_2 = new Object(new Boolean(false)); EXP_1 + EXP_2") );
+
+ array[item++] = new TestCase( SECTION,
+ "var EXP_1 = new MyObject(true); var EXP_2 = new MyObject(false); EXP_1 + EXP_2",
+ 1,
+ eval("var EXP_1 = new MyObject(true); var EXP_2 = new MyObject(false); EXP_1 + EXP_2") );
+
+ array[item++] = new TestCase( SECTION,
+ "var EXP_1 = new MyObject(new Boolean(true)); var EXP_2 = new MyObject(new Boolean(false)); EXP_1 + EXP_2",
+ "[object Object][object Object]",
+ eval("var EXP_1 = new MyObject(new Boolean(true)); var EXP_2 = new MyObject(new Boolean(false)); EXP_1 + EXP_2") );
+
+ array[item++] = new TestCase( SECTION,
+ "var EXP_1 = new MyValuelessObject(true); var EXP_2 = new MyValuelessObject(false); EXP_1 + EXP_2",
+ 1,
+ eval("var EXP_1 = new MyValuelessObject(true); var EXP_2 = new MyValuelessObject(false); EXP_1 + EXP_2") );
+
+ array[item++] = new TestCase( SECTION,
+ "var EXP_1 = new MyValuelessObject(new Boolean(true)); var EXP_2 = new MyValuelessObject(new Boolean(false)); EXP_1 + EXP_2",
+ "truefalse",
+ eval("var EXP_1 = new MyValuelessObject(new Boolean(true)); var EXP_2 = new MyValuelessObject(new Boolean(false)); EXP_1 + EXP_2") );
+
+ // tests for number primitive, number object, Object object, a "MyObject" whose value is
+ // a number primitive and a number object, and "MyValuelessObject", where the value is
+ // set in the object's prototype, not the object itself.
+
+ array[item++] = new TestCase( SECTION,
+ "var EXP_1 = 100; var EXP_2 = -1; EXP_1 + EXP_2",
+ 99,
+ eval("var EXP_1 = 100; var EXP_2 = -1; EXP_1 + EXP_2") );
+
+ array[item++] = new TestCase( SECTION,
+ "var EXP_1 = new Number(100); var EXP_2 = new Number(-1); EXP_1 + EXP_2",
+ 99,
+ eval("var EXP_1 = new Number(100); var EXP_2 = new Number(-1); EXP_1 + EXP_2") );
+
+ array[item++] = new TestCase( SECTION,
+ "var EXP_1 = new Object(100); var EXP_2 = new Object(-1); EXP_1 + EXP_2",
+ 99,
+ eval("var EXP_1 = new Object(100); var EXP_2 = new Object(-1); EXP_1 + EXP_2") );
+
+ array[item++] = new TestCase( SECTION,
+ "var EXP_1 = new Object(new Number(100)); var EXP_2 = new Object(new Number(-1)); EXP_1 + EXP_2",
+ 99,
+ eval("var EXP_1 = new Object(new Number(100)); var EXP_2 = new Object(new Number(-1)); EXP_1 + EXP_2") );
+
+ array[item++] = new TestCase( SECTION,
+ "var EXP_1 = new MyObject(100); var EXP_2 = new MyObject(-1); EXP_1 + EXP_2",
+ 99,
+ eval("var EXP_1 = new MyObject(100); var EXP_2 = new MyObject(-1); EXP_1 + EXP_2") );
+
+ array[item++] = new TestCase( SECTION,
+ "var EXP_1 = new MyObject(new Number(100)); var EXP_2 = new MyObject(new Number(-1)); EXP_1 + EXP_2",
+ "[object Object][object Object]",
+ eval("var EXP_1 = new MyObject(new Number(100)); var EXP_2 = new MyObject(new Number(-1)); EXP_1 + EXP_2") );
+
+
+ array[item++] = new TestCase( SECTION,
+ "var EXP_1 = new MyValuelessObject(100); var EXP_2 = new MyValuelessObject(-1); EXP_1 + EXP_2",
+ 99,
+ eval("var EXP_1 = new MyValuelessObject(100); var EXP_2 = new MyValuelessObject(-1); EXP_1 + EXP_2") );
+
+ array[item++] = new TestCase( SECTION,
+ "var EXP_1 = new MyValuelessObject(new Number(100)); var EXP_2 = new MyValuelessObject(new Number(-1)); EXP_1 + EXP_2",
+ "100-1",
+ eval("var EXP_1 = new MyValuelessObject(new Number(100)); var EXP_2 = new MyValuelessObject(new Number(-1)); EXP_1 + EXP_2") );
+
+ array[item++] = new TestCase( SECTION,
+ "var EXP_1 = new MyValuelessObject( new MyValuelessObject( new Boolean(true) ) ); EXP_1 + EXP_1",
+ "truetrue",
+ eval("var EXP_1 = new MyValuelessObject( new MyValuelessObject( new Boolean(true) ) ); EXP_1 + EXP_1") );
+
+ return ( array );
+}
+
+
+function MyProtoValuelessObject() {
+ this.valueOf = new Function ( "" );
+ this.__proto__ = null;
+}
+
+function MyProtolessObject( value ) {
+ this.valueOf = new Function( "return this.value" );
+ this.__proto__ = null;
+ this.value = value;
+}
+
+function MyValuelessObject(value) {
+ this.__proto__ = new MyPrototypeObject(value);
+}
+function MyPrototypeObject(value) {
+ this.valueOf = new Function( "return this.value;" );
+ this.toString = new Function( "return (this.value + '');" );
+ this.value = value;
+}
+
+function MyObject( value ) {
+ this.valueOf = new Function( "return this.value" );
+ this.value = value;
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.6.1-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.6.1-2.js
new file mode 100644
index 0000000..400ec71
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.6.1-2.js
@@ -0,0 +1,203 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 11.6.1-2.js
+ ECMA Section: 11.6.1 The addition operator ( + )
+ Description:
+
+ The addition operator either performs string concatenation or numeric
+ addition.
+
+ The production AdditiveExpression : AdditiveExpression + MultiplicativeExpression
+ is evaluated as follows:
+
+ 1. Evaluate AdditiveExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate MultiplicativeExpression.
+ 4. Call GetValue(Result(3)).
+ 5. Call ToPrimitive(Result(2)).
+ 6. Call ToPrimitive(Result(4)).
+ 7. If Type(Result(5)) is String or Type(Result(6)) is String, go to step 12.
+ (Note that this step differs from step 3 in the algorithm for comparison
+ for the relational operators in using or instead of and.)
+ 8. Call ToNumber(Result(5)).
+ 9. Call ToNumber(Result(6)).
+ 10. Apply the addition operation to Result(8) and Result(9). See the discussion below (11.6.3).
+ 11. Return Result(10).
+ 12. Call ToString(Result(5)).
+ 13. Call ToString(Result(6)).
+ 14. Concatenate Result(12) followed by Result(13).
+ 15. Return Result(14).
+
+ Note that no hint is provided in the calls to ToPrimitive in steps 5 and 6.
+ All native ECMAScript objects except Date objects handle the absence of a
+ hint as if the hint Number were given; Date objects handle the absence of a
+ hint as if the hint String were given. Host objects may handle the absence
+ of a hint in some other manner.
+
+ This test does only covers cases where the Additive or Mulplicative expression
+ ToPrimitive is a string.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "11.6.1-2";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ var testcases = getTestCases();
+
+ writeHeaderToLog( SECTION + " The Addition operator ( + )");
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ // tests for boolean primitive, boolean object, Object object, a "MyObject" whose value is
+ // a boolean primitive and a boolean object, and "MyValuelessObject", where the value is
+ // set in the object's prototype, not the object itself.
+
+ array[item++] = new TestCase( SECTION,
+ "var EXP_1 = 'string'; var EXP_2 = false; EXP_1 + EXP_2",
+ "stringfalse",
+ eval("var EXP_1 = 'string'; var EXP_2 = false; EXP_1 + EXP_2") );
+
+ array[item++] = new TestCase( SECTION,
+ "var EXP_1 = true; var EXP_2 = 'string'; EXP_1 + EXP_2",
+ "truestring",
+ eval("var EXP_1 = true; var EXP_2 = 'string'; EXP_1 + EXP_2") );
+
+ array[item++] = new TestCase( SECTION,
+ "var EXP_1 = new Boolean(true); var EXP_2 = new String('string'); EXP_1 + EXP_2",
+ "truestring",
+ eval("var EXP_1 = new Boolean(true); var EXP_2 = new String('string'); EXP_1 + EXP_2") );
+
+ array[item++] = new TestCase( SECTION,
+ "var EXP_1 = new Object(true); var EXP_2 = new Object('string'); EXP_1 + EXP_2",
+ "truestring",
+ eval("var EXP_1 = new Object(true); var EXP_2 = new Object('string'); EXP_1 + EXP_2") );
+
+ array[item++] = new TestCase( SECTION,
+ "var EXP_1 = new Object(new String('string')); var EXP_2 = new Object(new Boolean(false)); EXP_1 + EXP_2",
+ "stringfalse",
+ eval("var EXP_1 = new Object(new String('string')); var EXP_2 = new Object(new Boolean(false)); EXP_1 + EXP_2") );
+
+ array[item++] = new TestCase( SECTION,
+ "var EXP_1 = new MyObject(true); var EXP_2 = new MyObject('string'); EXP_1 + EXP_2",
+ "truestring",
+ eval("var EXP_1 = new MyObject(true); var EXP_2 = new MyObject('string'); EXP_1 + EXP_2") );
+
+ array[item++] = new TestCase( SECTION,
+ "var EXP_1 = new MyObject(new String('string')); var EXP_2 = new MyObject(new Boolean(false)); EXP_1 + EXP_2",
+ "[object Object][object Object]",
+ eval("var EXP_1 = new MyObject(new String('string')); var EXP_2 = new MyObject(new Boolean(false)); EXP_1 + EXP_2") );
+
+ array[item++] = new TestCase( SECTION,
+ "var EXP_1 = new MyValuelessObject('string'); var EXP_2 = new MyValuelessObject(false); EXP_1 + EXP_2",
+ "stringfalse",
+ eval("var EXP_1 = new MyValuelessObject('string'); var EXP_2 = new MyValuelessObject(false); EXP_1 + EXP_2") );
+
+ array[item++] = new TestCase( SECTION,
+ "var EXP_1 = new MyValuelessObject(new String('string')); var EXP_2 = new MyValuelessObject(new Boolean(false)); EXP_1 + EXP_2",
+ "stringfalse",
+ eval("var EXP_1 = new MyValuelessObject(new String('string')); var EXP_2 = new MyValuelessObject(new Boolean(false)); EXP_1 + EXP_2") );
+
+ // tests for number primitive, number object, Object object, a "MyObject" whose value is
+ // a number primitive and a number object, and "MyValuelessObject", where the value is
+ // set in the object's prototype, not the object itself.
+
+ array[item++] = new TestCase( SECTION,
+ "var EXP_1 = 100; var EXP_2 = 'string'; EXP_1 + EXP_2",
+ "100string",
+ eval("var EXP_1 = 100; var EXP_2 = 'string'; EXP_1 + EXP_2") );
+
+ array[item++] = new TestCase( SECTION,
+ "var EXP_1 = new String('string'); var EXP_2 = new Number(-1); EXP_1 + EXP_2",
+ "string-1",
+ eval("var EXP_1 = new String('string'); var EXP_2 = new Number(-1); EXP_1 + EXP_2") );
+
+ array[item++] = new TestCase( SECTION,
+ "var EXP_1 = new Object(100); var EXP_2 = new Object('string'); EXP_1 + EXP_2",
+ "100string",
+ eval("var EXP_1 = new Object(100); var EXP_2 = new Object('string'); EXP_1 + EXP_2") );
+
+ array[item++] = new TestCase( SECTION,
+ "var EXP_1 = new Object(new String('string')); var EXP_2 = new Object(new Number(-1)); EXP_1 + EXP_2",
+ "string-1",
+ eval("var EXP_1 = new Object(new String('string')); var EXP_2 = new Object(new Number(-1)); EXP_1 + EXP_2") );
+
+ array[item++] = new TestCase( SECTION,
+ "var EXP_1 = new MyObject(100); var EXP_2 = new MyObject('string'); EXP_1 + EXP_2",
+ "100string",
+ eval("var EXP_1 = new MyObject(100); var EXP_2 = new MyObject('string'); EXP_1 + EXP_2") );
+
+ array[item++] = new TestCase( SECTION,
+ "var EXP_1 = new MyObject(new String('string')); var EXP_2 = new MyObject(new Number(-1)); EXP_1 + EXP_2",
+ "[object Object][object Object]",
+ eval("var EXP_1 = new MyObject(new String('string')); var EXP_2 = new MyObject(new Number(-1)); EXP_1 + EXP_2") );
+
+ array[item++] = new TestCase( SECTION,
+ "var EXP_1 = new MyValuelessObject(100); var EXP_2 = new MyValuelessObject('string'); EXP_1 + EXP_2",
+ "100string",
+ eval("var EXP_1 = new MyValuelessObject(100); var EXP_2 = new MyValuelessObject('string'); EXP_1 + EXP_2") );
+
+ array[item++] = new TestCase( SECTION,
+ "var EXP_1 = new MyValuelessObject(new String('string')); var EXP_2 = new MyValuelessObject(new Number(-1)); EXP_1 + EXP_2",
+ "string-1",
+ eval("var EXP_1 = new MyValuelessObject(new String('string')); var EXP_2 = new MyValuelessObject(new Number(-1)); EXP_1 + EXP_2") );
+ return ( array );
+}
+function MyProtoValuelessObject() {
+ this.valueOf = new Function ( "" );
+ this.__proto__ = null;
+}
+function MyProtolessObject( value ) {
+ this.valueOf = new Function( "return this.value" );
+ this.__proto__ = null;
+ this.value = value;
+}
+function MyValuelessObject(value) {
+ this.__proto__ = new MyPrototypeObject(value);
+}
+function MyPrototypeObject(value) {
+ this.valueOf = new Function( "return this.value;" );
+ this.toString = new Function( "return (this.value + '');" );
+ this.value = value;
+}
+function MyObject( value ) {
+ this.valueOf = new Function( "return this.value" );
+ this.value = value;
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.6.1-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.6.1-3.js
new file mode 100644
index 0000000..a5fdc88
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.6.1-3.js
@@ -0,0 +1,181 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 11.6.1-3.js
+ ECMA Section: 11.6.1 The addition operator ( + )
+ Description:
+
+ The addition operator either performs string concatenation or numeric
+ addition.
+
+ The production AdditiveExpression : AdditiveExpression + MultiplicativeExpression
+ is evaluated as follows:
+
+ 1. Evaluate AdditiveExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate MultiplicativeExpression.
+ 4. Call GetValue(Result(3)).
+ 5. Call ToPrimitive(Result(2)).
+ 6. Call ToPrimitive(Result(4)).
+ 7. If Type(Result(5)) is String or Type(Result(6)) is String, go to step 12.
+ (Note that this step differs from step 3 in the algorithm for comparison
+ for the relational operators in using or instead of and.)
+ 8. Call ToNumber(Result(5)).
+ 9. Call ToNumber(Result(6)).
+ 10. Apply the addition operation to Result(8) and Result(9). See the discussion below (11.6.3).
+ 11. Return Result(10).
+ 12. Call ToString(Result(5)).
+ 13. Call ToString(Result(6)).
+ 14. Concatenate Result(12) followed by Result(13).
+ 15. Return Result(14).
+
+ Note that no hint is provided in the calls to ToPrimitive in steps 5 and 6.
+ All native ECMAScript objects except Date objects handle the absence of a
+ hint as if the hint Number were given; Date objects handle the absence of a
+ hint as if the hint String were given. Host objects may handle the absence
+ of a hint in some other manner.
+
+ This test does only covers cases where the Additive or Mulplicative expression
+ is a Date.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "11.6.1-3";
+ var VERSION = "ECMA_1";
+ startTest();
+ var testcases = getTestCases();
+
+ writeHeaderToLog( SECTION + " The Addition operator ( + )");
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ // tests for boolean primitive, boolean object, Object object, a "MyObject" whose value is
+ // a boolean primitive and a boolean object, and "MyValuelessObject", where the value is
+ // set in the object's prototype, not the object itself.
+
+ var DATE1 = new Date();
+
+ array[item++] = new TestCase( SECTION,
+ "var DATE1 = new Date(); DATE1 + DATE1",
+ DATE1.toString() + DATE1.toString(),
+ DATE1 + DATE1 );
+
+ array[item++] = new TestCase( SECTION,
+ "var DATE1 = new Date(); DATE1 + 0",
+ DATE1.toString() + 0,
+ DATE1 + 0 );
+
+ array[item++] = new TestCase( SECTION,
+ "var DATE1 = new Date(); DATE1 + new Number(0)",
+ DATE1.toString() + 0,
+ DATE1 + new Number(0) );
+
+ array[item++] = new TestCase( SECTION,
+ "var DATE1 = new Date(); DATE1 + true",
+ DATE1.toString() + "true",
+ DATE1 + true );
+
+ array[item++] = new TestCase( SECTION,
+ "var DATE1 = new Date(); DATE1 + new Boolean(true)",
+ DATE1.toString() + "true",
+ DATE1 + new Boolean(true) );
+
+ array[item++] = new TestCase( SECTION,
+ "var DATE1 = new Date(); DATE1 + new Boolean(true)",
+ DATE1.toString() + "true",
+ DATE1 + new Boolean(true) );
+
+ var MYOB1 = new MyObject( DATE1 );
+ var MYOB2 = new MyValuelessObject( DATE1 );
+ var MYOB3 = new MyProtolessObject( DATE1 );
+ var MYOB4 = new MyProtoValuelessObject( DATE1 );
+
+ array[item++] = new TestCase( SECTION,
+ "MYOB1 = new MyObject(DATE1); MYOB1 + new Number(1)",
+ "[object Object]1",
+ MYOB1 + new Number(1) );
+
+ array[item++] = new TestCase( SECTION,
+ "MYOB1 = new MyObject(DATE1); MYOB1 + 1",
+ "[object Object]1",
+ MYOB1 + 1 );
+
+ array[item++] = new TestCase( SECTION,
+ "MYOB2 = new MyValuelessObject(DATE1); MYOB3 + 'string'",
+ DATE1.toString() + "string",
+ MYOB2 + 'string' );
+
+ array[item++] = new TestCase( SECTION,
+ "MYOB2 = new MyValuelessObject(DATE1); MYOB3 + new String('string')",
+ DATE1.toString() + "string",
+ MYOB2 + new String('string') );
+/*
+ array[item++] = new TestCase( SECTION,
+ "MYOB3 = new MyProtolessObject(DATE1); MYOB3 + new Boolean(true)",
+ DATE1.toString() + "true",
+ MYOB3 + new Boolean(true) );
+*/
+ array[item++] = new TestCase( SECTION,
+ "MYOB1 = new MyObject(DATE1); MYOB1 + true",
+ "[object Object]true",
+ MYOB1 + true );
+
+ return ( array );
+}
+function MyProtoValuelessObject() {
+ this.valueOf = new Function ( "" );
+ this.__proto__ = null;
+}
+function MyProtolessObject( value ) {
+ this.valueOf = new Function( "return this.value" );
+ this.__proto__ = null;
+ this.value = value;
+}
+function MyValuelessObject(value) {
+ this.__proto__ = new MyPrototypeObject(value);
+}
+function MyPrototypeObject(value) {
+ this.valueOf = new Function( "return this.value;" );
+ this.toString = new Function( "return (this.value + '');" );
+ this.value = value;
+}
+function MyObject( value ) {
+ this.valueOf = new Function( "return this.value" );
+ this.value = value;
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.6.2-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.6.2-1.js
new file mode 100644
index 0000000..3c1bd91
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.6.2-1.js
@@ -0,0 +1,199 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 11.6.2-1.js
+ ECMA Section: 11.6.2 The Subtraction operator ( - )
+ Description:
+
+ The production AdditiveExpression : AdditiveExpression -
+ MultiplicativeExpression is evaluated as follows:
+
+ 1. Evaluate AdditiveExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate MultiplicativeExpression.
+ 4. Call GetValue(Result(3)).
+ 5. Call ToNumber(Result(2)).
+ 6. Call ToNumber(Result(4)).
+ 7. Apply the subtraction operation to Result(5) and Result(6). See the
+ discussion below (11.6.3).
+ 8. Return Result(7).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "11.6.2-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var testcases = getTestCases();
+
+ writeHeaderToLog( SECTION + " The subtraction operator ( - )");
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ // tests for boolean primitive, boolean object, Object object, a "MyObject" whose value is
+ // a boolean primitive and a boolean object, and "MyValuelessObject", where the value is
+ // set in the object's prototype, not the object itself.
+
+ array[item++] = new TestCase( SECTION,
+ "var EXP_1 = true; var EXP_2 = false; EXP_1 - EXP_2",
+ 1,
+ eval("var EXP_1 = true; var EXP_2 = false; EXP_1 - EXP_2") );
+
+ array[item++] = new TestCase( SECTION,
+ "var EXP_1 = new Boolean(true); var EXP_2 = new Boolean(false); EXP_1 - EXP_2",
+ 1,
+ eval("var EXP_1 = new Boolean(true); var EXP_2 = new Boolean(false); EXP_1 - EXP_2") );
+
+ array[item++] = new TestCase( SECTION,
+ "var EXP_1 = new Object(true); var EXP_2 = new Object(false); EXP_1 - EXP_2",
+ 1,
+ eval("var EXP_1 = new Object(true); var EXP_2 = new Object(false); EXP_1 - EXP_2") );
+
+ array[item++] = new TestCase( SECTION,
+ "var EXP_1 = new Object(new Boolean(true)); var EXP_2 = new Object(new Boolean(false)); EXP_1 - EXP_2",
+ 1,
+ eval("var EXP_1 = new Object(new Boolean(true)); var EXP_2 = new Object(new Boolean(false)); EXP_1 - EXP_2") );
+
+ array[item++] = new TestCase( SECTION,
+ "var EXP_1 = new MyObject(true); var EXP_2 = new MyObject(false); EXP_1 - EXP_2",
+ 1,
+ eval("var EXP_1 = new MyObject(true); var EXP_2 = new MyObject(false); EXP_1 - EXP_2") );
+
+ array[item++] = new TestCase( SECTION,
+ "var EXP_1 = new MyObject(new Boolean(true)); var EXP_2 = new MyObject(new Boolean(false)); EXP_1 - EXP_2",
+ Number.NaN,
+ eval("var EXP_1 = new MyObject(new Boolean(true)); var EXP_2 = new MyObject(new Boolean(false)); EXP_1 - EXP_2") );
+
+ array[item++] = new TestCase( SECTION,
+ "var EXP_1 = new MyOtherObject(new Boolean(true)); var EXP_2 = new MyOtherObject(new Boolean(false)); EXP_1 - EXP_2",
+ Number.NaN,
+ eval("var EXP_1 = new MyOtherObject(new Boolean(true)); var EXP_2 = new MyOtherObject(new Boolean(false)); EXP_1 - EXP_2") );
+
+ array[item++] = new TestCase( SECTION,
+ "var EXP_1 = new MyValuelessObject(true); var EXP_2 = new MyValuelessObject(false); EXP_1 - EXP_2",
+ 1,
+ eval("var EXP_1 = new MyValuelessObject(true); var EXP_2 = new MyValuelessObject(false); EXP_1 - EXP_2") );
+
+ array[item++] = new TestCase( SECTION,
+ "var EXP_1 = new MyValuelessObject(new Boolean(true)); var EXP_2 = new MyValuelessObject(new Boolean(false)); EXP_1 - EXP_2",
+ Number.NaN,
+ eval("var EXP_1 = new MyValuelessObject(new Boolean(true)); var EXP_2 = new MyValuelessObject(new Boolean(false)); EXP_1 - EXP_2") );
+
+ // tests for number primitive, number object, Object object, a "MyObject" whose value is
+ // a number primitive and a number object, and "MyValuelessObject", where the value is
+ // set in the object's prototype, not the object itself.
+
+ array[item++] = new TestCase( SECTION,
+ "var EXP_1 = 100; var EXP_2 = 1; EXP_1 - EXP_2",
+ 99,
+ eval("var EXP_1 = 100; var EXP_2 = 1; EXP_1 - EXP_2") );
+
+ array[item++] = new TestCase( SECTION,
+ "var EXP_1 = new Number(100); var EXP_2 = new Number(1); EXP_1 - EXP_2",
+ 99,
+ eval("var EXP_1 = new Number(100); var EXP_2 = new Number(1); EXP_1 - EXP_2") );
+
+ array[item++] = new TestCase( SECTION,
+ "var EXP_1 = new Object(100); var EXP_2 = new Object(1); EXP_1 - EXP_2",
+ 99,
+ eval("var EXP_1 = new Object(100); var EXP_2 = new Object(1); EXP_1 - EXP_2") );
+
+ array[item++] = new TestCase( SECTION,
+ "var EXP_1 = new Object(new Number(100)); var EXP_2 = new Object(new Number(1)); EXP_1 - EXP_2",
+ 99,
+ eval("var EXP_1 = new Object(new Number(100)); var EXP_2 = new Object(new Number(1)); EXP_1 - EXP_2") );
+
+ array[item++] = new TestCase( SECTION,
+ "var EXP_1 = new MyObject(100); var EXP_2 = new MyObject(1); EXP_1 - EXP_2",
+ 99,
+ eval("var EXP_1 = new MyObject(100); var EXP_2 = new MyObject(1); EXP_1 - EXP_2") );
+
+ array[item++] = new TestCase( SECTION,
+ "var EXP_1 = new MyObject(new Number(100)); var EXP_2 = new MyObject(new Number(1)); EXP_1 - EXP_2",
+ Number.NaN,
+ eval("var EXP_1 = new MyObject(new Number(100)); var EXP_2 = new MyObject(new Number(1)); EXP_1 - EXP_2") );
+
+ array[item++] = new TestCase( SECTION,
+ "var EXP_1 = new MyOtherObject(new Number(100)); var EXP_2 = new MyOtherObject(new Number(1)); EXP_1 - EXP_2",
+ 99,
+ eval("var EXP_1 = new MyOtherObject(new Number(100)); var EXP_2 = new MyOtherObject(new Number(1)); EXP_1 - EXP_2") );
+
+ array[item++] = new TestCase( SECTION,
+ "var EXP_1 = new MyValuelessObject(100); var EXP_2 = new MyValuelessObject(1); EXP_1 - EXP_2",
+ 99,
+ eval("var EXP_1 = new MyValuelessObject(100); var EXP_2 = new MyValuelessObject(1); EXP_1 - EXP_2") );
+/*
+ array[item++] = new TestCase( SECTION,
+ "var EXP_1 = new MyValuelessObject(new Number(100)); var EXP_2 = new MyValuelessObject(new Number(1)); EXP_1 - EXP_2",
+ Number.NaN,
+ eval("var EXP_1 = new MyValuelessObject(new Number(100)); var EXP_2 = new MyValuelessObject(new Number(1)); EXP_1 - EXP_2") );
+*/
+ // same thing with string!
+ array[item++] = new TestCase( SECTION,
+ "var EXP_1 = new MyOtherObject(new String('0xff')); var EXP_2 = new MyOtherObject(new String('1'); EXP_1 - EXP_2",
+ 254,
+ eval("var EXP_1 = new MyOtherObject(new String('0xff')); var EXP_2 = new MyOtherObject(new String('1')); EXP_1 - EXP_2") );
+
+ return ( array );
+}
+function MyProtoValuelessObject() {
+ this.valueOf = new Function ( "" );
+ this.__proto__ = null;
+}
+function MyProtolessObject( value ) {
+ this.valueOf = new Function( "return this.value" );
+ this.__proto__ = null;
+ this.value = value;
+}
+function MyValuelessObject(value) {
+ this.__proto__ = new MyPrototypeObject(value);
+}
+function MyPrototypeObject(value) {
+ this.valueOf = new Function( "return this.value;" );
+ this.toString = new Function( "return (this.value + '');" );
+ this.value = value;
+}
+function MyObject( value ) {
+ this.valueOf = new Function( "return this.value" );
+ this.value = value;
+}
+function MyOtherObject( value ) {
+ this.valueOf = new Function( "return this.value" );
+ this.toString = new Function ( "return this.value + ''" );
+ this.value = value;
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.6.3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.6.3.js
new file mode 100644
index 0000000..91af1b7
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.6.3.js
@@ -0,0 +1,116 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 11.6.3.js
+ ECMA Section: 11.6.3 Applying the additive operators
+ (+, -) to numbers
+ Description:
+ The + operator performs addition when applied to two operands of numeric
+ type, producing the sum of the operands. The - operator performs
+ subtraction, producing the difference of two numeric operands.
+
+ Addition is a commutative operation, but not always associative.
+
+ The result of an addition is determined using the rules of IEEE 754
+ double-precision arithmetic:
+
+ If either operand is NaN, the result is NaN.
+ The sum of two infinities of opposite sign is NaN.
+ The sum of two infinities of the same sign is the infinity of that sign.
+ The sum of an infinity and a finite value is equal to the infinite operand.
+ The sum of two negative zeros is 0. The sum of two positive zeros, or of
+ two zeros of opposite sign, is +0.
+ The sum of a zero and a nonzero finite value is equal to the nonzero
+ operand.
+ The sum of two nonzero finite values of the same magnitude and opposite
+ sign is +0.
+ In the remaining cases, where neither an infinity, nor a zero, nor NaN is
+ involved, and the operands have the same sign or have different
+ magnitudes, the sum is computed and rounded to the nearest
+ representable value using IEEE 754 round-to-nearest mode. If the
+ magnitude is too large to represent, the operation overflows and
+ the result is then an infinity of appropriate sign. The ECMAScript
+ language requires support of gradual underflow as defined by IEEE 754.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "11.6.3";
+ var VERSION = "ECMA_1";
+ startTest();
+ var testcases = getTestCases();
+
+ writeHeaderToLog( SECTION + " Applying the additive operators (+,-) to numbers");
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "Number.NaN + 1", Number.NaN, Number.NaN + 1 );
+ array[item++] = new TestCase( SECTION, "1 + Number.NaN", Number.NaN, 1 + Number.NaN );
+
+ array[item++] = new TestCase( SECTION, "Number.NaN - 1", Number.NaN, Number.NaN - 1 );
+ array[item++] = new TestCase( SECTION, "1 - Number.NaN", Number.NaN, 1 - Number.NaN );
+
+ array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY + Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY + Number.POSITIVE_INFINITY);
+ array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY + Number.NEGATIVE_INFINITY", Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY + Number.NEGATIVE_INFINITY);
+
+ array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY + Number.NEGATIVE_INFINITY", Number.NaN, Number.POSITIVE_INFINITY + Number.NEGATIVE_INFINITY);
+ array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY + Number.POSITIVE_INFINITY", Number.NaN, Number.NEGATIVE_INFINITY + Number.POSITIVE_INFINITY);
+
+ array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY - Number.POSITIVE_INFINITY", Number.NaN, Number.POSITIVE_INFINITY - Number.POSITIVE_INFINITY);
+ array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY - Number.NEGATIVE_INFINITY", Number.NaN, Number.NEGATIVE_INFINITY - Number.NEGATIVE_INFINITY);
+
+ array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY - Number.NEGATIVE_INFINITY", Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY - Number.NEGATIVE_INFINITY);
+ array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY - Number.POSITIVE_INFINITY", Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY - Number.POSITIVE_INFINITY);
+
+ array[item++] = new TestCase( SECTION, "-0 + -0", -0, -0 + -0 );
+ array[item++] = new TestCase( SECTION, "-0 - 0", -0, -0 - 0 );
+
+ array[item++] = new TestCase( SECTION, "0 + 0", 0, 0 + 0 );
+ array[item++] = new TestCase( SECTION, "0 + -0", 0, 0 + -0 );
+ array[item++] = new TestCase( SECTION, "0 - -0", 0, 0 - -0 );
+ array[item++] = new TestCase( SECTION, "0 - 0", 0, 0 - 0 );
+ array[item++] = new TestCase( SECTION, "-0 - -0", 0, -0 - -0 );
+ array[item++] = new TestCase( SECTION, "-0 + 0", 0, -0 + 0 );
+
+ array[item++] = new TestCase( SECTION, "Number.MAX_VALUE - Number.MAX_VALUE", 0, Number.MAX_VALUE - Number.MAX_VALUE );
+ array[item++] = new TestCase( SECTION, "1/Number.MAX_VALUE - 1/Number.MAX_VALUE", 0, 1/Number.MAX_VALUE - 1/Number.MAX_VALUE );
+
+ array[item++] = new TestCase( SECTION, "Number.MIN_VALUE - Number.MIN_VALUE", 0, Number.MIN_VALUE - Number.MIN_VALUE );
+
+ return ( array );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.7.1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.7.1.js
new file mode 100644
index 0000000..23e2ab5
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.7.1.js
@@ -0,0 +1,229 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 11.7.1.js
+ ECMA Section: 11.7.1 The Left Shift Operator ( << )
+ Description:
+ Performs a bitwise left shift operation on the left argument by the amount
+ specified by the right argument.
+
+ The production ShiftExpression : ShiftExpression << AdditiveExpression is
+ evaluated as follows:
+
+ 1. Evaluate ShiftExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate AdditiveExpression.
+ 4. Call GetValue(Result(3)).
+ 5. Call ToInt32(Result(2)).
+ 6. Call ToUint32(Result(4)).
+ 7. Mask out all but the least significant 5 bits of Result(6), that is,
+ compute Result(6) & 0x1F.
+ 8. Left shift Result(5) by Result(7) bits. The result is a signed 32 bit
+ integer.
+ 9. Return Result(8).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "11.7.1";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ var testcases = getTestCases();
+
+ writeHeaderToLog( SECTION + " The left shift operator ( << )");
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ for ( power = 0; power < 33; power++ ) {
+ shiftexp = Math.pow( 2, power );
+
+ for ( addexp = 0; addexp < 33; addexp++ ) {
+ array[item++] = new TestCase( SECTION,
+ shiftexp + " << " + addexp,
+ LeftShift( shiftexp, addexp ),
+ shiftexp << addexp );
+ }
+ }
+
+ return ( array );
+}
+function ToInteger( n ) {
+ n = Number( n );
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ if ( n != n ) {
+ return 0;
+ }
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY ) {
+ return n;
+ }
+ return ( sign * Math.floor(Math.abs(n)) );
+}
+function ToInt32( n ) {
+ n = Number( n );
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
+ return 0;
+ }
+
+ n = (sign * Math.floor( Math.abs(n) )) % Math.pow(2,32);
+ n = ( n >= Math.pow(2,31) ) ? n - Math.pow(2,32) : n;
+
+ return ( n );
+}
+function ToUint32( n ) {
+ n = Number( n );
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
+ return 0;
+ }
+ n = sign * Math.floor( Math.abs(n) )
+
+ n = n % Math.pow(2,32);
+
+ if ( n < 0 ){
+ n += Math.pow(2,32);
+ }
+
+ return ( n );
+}
+function ToUint16( n ) {
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
+ return 0;
+ }
+
+ n = ( sign * Math.floor( Math.abs(n) ) ) % Math.pow(2,16);
+
+ if (n <0) {
+ n += Math.pow(2,16);
+ }
+
+ return ( n );
+}
+function Mask( b, n ) {
+ b = ToUint32BitString( b );
+ b = b.substring( b.length - n );
+ b = ToUint32Decimal( b );
+ return ( b );
+}
+function ToUint32BitString( n ) {
+ var b = "";
+ for ( p = 31; p >=0; p-- ) {
+ if ( n >= Math.pow(2,p) ) {
+ b += "1";
+ n -= Math.pow(2,p);
+ } else {
+ b += "0";
+ }
+ }
+ return b;
+}
+function ToInt32BitString( n ) {
+ var b = "";
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ b += ( sign == 1 ) ? "0" : "1";
+
+ for ( p = 30; p >=0; p-- ) {
+ if ( (sign == 1 ) ? sign * n >= Math.pow(2,p) : sign * n > Math.pow(2,p) ) {
+ b += ( sign == 1 ) ? "1" : "0";
+ n -= sign * Math.pow( 2, p );
+ } else {
+ b += ( sign == 1 ) ? "0" : "1";
+ }
+ }
+
+ return b;
+}
+function ToInt32Decimal( bin ) {
+ var r = 0;
+ var sign;
+
+ if ( Number(bin.charAt(0)) == 0 ) {
+ sign = 1;
+ r = 0;
+ } else {
+ sign = -1;
+ r = -(Math.pow(2,31));
+ }
+
+ for ( var j = 0; j < 31; j++ ) {
+ r += Math.pow( 2, j ) * Number(bin.charAt(31-j));
+ }
+
+ return r;
+}
+function ToUint32Decimal( bin ) {
+ var r = 0;
+
+
+ for ( l = bin.length; l < 32; l++ ) {
+ bin = "0" + bin;
+ }
+
+ for ( j = 0; j < 31; j++ ) {
+ r += Math.pow( 2, j ) * Number(bin.charAt(31-j));
+
+ }
+
+ return r;
+}
+function LeftShift( s, a ) {
+ var shift = ToInt32( s );
+ var add = ToUint32( a );
+ add = Mask( add, 5 );
+ var exp = LShift( shift, add );
+
+ return ( exp );
+}
+function LShift( s, a ) {
+ s = ToInt32BitString( s );
+
+ for ( var z = 0; z < a; z++ ) {
+ s += "0";
+ }
+
+ s = s.substring( a, s.length);
+
+ return ToInt32(ToInt32Decimal(s));
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.7.2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.7.2.js
new file mode 100644
index 0000000..b2761cf
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.7.2.js
@@ -0,0 +1,246 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 11.7.2.js
+ ECMA Section: 11.7.2 The signed right shift operator ( >> )
+ Description:
+ Performs a sign-filling bitwise right shift operation on the left argument
+ by the amount specified by the right argument.
+
+ The production ShiftExpression : ShiftExpression >> AdditiveExpression is
+ evaluated as follows:
+
+ 1. Evaluate ShiftExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate AdditiveExpression.
+ 4. Call GetValue(Result(3)).
+ 5. Call ToInt32(Result(2)).
+ 6. Call ToUint32(Result(4)).
+ 7. Mask out all but the least significant 5 bits of Result(6), that is,
+ compute Result(6) & 0x1F.
+ 8. Perform sign-extending right shift of Result(5) by Result(7) bits. The
+ most significant bit is propagated. The result is a signed 32 bit
+ integer.
+ 9. Return Result(8).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "11.7.2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var testcases = getTestCases();
+
+ writeHeaderToLog( SECTION + " The signed right shift operator ( >> )");
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ var power = 0;
+ var addexp = 0;
+
+ for ( power = 0; power <= 32; power++ ) {
+ shiftexp = Math.pow( 2, power );
+
+ for ( addexp = 0; addexp <= 32; addexp++ ) {
+ array[item++] = new TestCase( SECTION,
+ shiftexp + " >> " + addexp,
+ SignedRightShift( shiftexp, addexp ),
+ shiftexp >> addexp );
+ }
+ }
+
+ for ( power = 0; power <= 32; power++ ) {
+ shiftexp = -Math.pow( 2, power );
+
+ for ( addexp = 0; addexp <= 32; addexp++ ) {
+ array[item++] = new TestCase( SECTION,
+ shiftexp + " >> " + addexp,
+ SignedRightShift( shiftexp, addexp ),
+ shiftexp >> addexp );
+ }
+ }
+
+ return ( array );
+}
+
+function ToInteger( n ) {
+ n = Number( n );
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ if ( n != n ) {
+ return 0;
+ }
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY ) {
+ return n;
+ }
+ return ( sign * Math.floor(Math.abs(n)) );
+}
+function ToInt32( n ) {
+ n = Number( n );
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
+ return 0;
+ }
+
+ n = (sign * Math.floor( Math.abs(n) )) % Math.pow(2,32);
+ n = ( n >= Math.pow(2,31) ) ? n - Math.pow(2,32) : n;
+
+ return ( n );
+}
+function ToUint32( n ) {
+ n = Number( n );
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
+ return 0;
+ }
+ n = sign * Math.floor( Math.abs(n) )
+
+ n = n % Math.pow(2,32);
+
+ if ( n < 0 ){
+ n += Math.pow(2,32);
+ }
+
+ return ( n );
+}
+function ToUint16( n ) {
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
+ return 0;
+ }
+
+ n = ( sign * Math.floor( Math.abs(n) ) ) % Math.pow(2,16);
+
+ if (n <0) {
+ n += Math.pow(2,16);
+ }
+
+ return ( n );
+}
+function Mask( b, n ) {
+ b = ToUint32BitString( b );
+ b = b.substring( b.length - n );
+ b = ToUint32Decimal( b );
+ return ( b );
+}
+function ToUint32BitString( n ) {
+ var b = "";
+ for ( p = 31; p >=0; p-- ) {
+ if ( n >= Math.pow(2,p) ) {
+ b += "1";
+ n -= Math.pow(2,p);
+ } else {
+ b += "0";
+ }
+ }
+ return b;
+}
+function ToInt32BitString( n ) {
+ var b = "";
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ b += ( sign == 1 ) ? "0" : "1";
+
+ for ( p = 30; p >=0; p-- ) {
+ if ( (sign == 1 ) ? sign * n >= Math.pow(2,p) : sign * n > Math.pow(2,p) ) {
+ b += ( sign == 1 ) ? "1" : "0";
+ n -= sign * Math.pow( 2, p );
+ } else {
+ b += ( sign == 1 ) ? "0" : "1";
+ }
+ }
+
+ return b;
+}
+function ToInt32Decimal( bin ) {
+ var r = 0;
+ var sign;
+
+ if ( Number(bin.charAt(0)) == 0 ) {
+ sign = 1;
+ r = 0;
+ } else {
+ sign = -1;
+ r = -(Math.pow(2,31));
+ }
+
+ for ( var j = 0; j < 31; j++ ) {
+ r += Math.pow( 2, j ) * Number(bin.charAt(31-j));
+ }
+
+ return r;
+}
+function ToUint32Decimal( bin ) {
+ var r = 0;
+
+ for ( l = bin.length; l < 32; l++ ) {
+ bin = "0" + bin;
+ }
+
+ for ( j = 0; j < 31; j++ ) {
+ r += Math.pow( 2, j ) * Number(bin.charAt(31-j));
+ }
+
+ return r;
+}
+function SignedRightShift( s, a ) {
+ s = ToInt32( s );
+ a = ToUint32( a );
+ a = Mask( a, 5 );
+ return ( SignedRShift( s, a ) );
+}
+function SignedRShift( s, a ) {
+ s = ToInt32BitString( s );
+
+ var firstbit = s.substring(0,1);
+
+ s = s.substring( 1, s.length );
+
+ for ( var z = 0; z < a; z++ ) {
+ s = firstbit + s;
+ }
+
+ s = s.substring( 0, s.length - a);
+
+ s = firstbit +s;
+
+
+ return ToInt32(ToInt32Decimal(s));
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.7.3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.7.3.js
new file mode 100644
index 0000000..9c963e1
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.7.3.js
@@ -0,0 +1,230 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 11.7.3.js
+ ECMA Section: 11.7.3 The unsigned right shift operator ( >>> )
+ Description:
+ 11.7.3 The unsigned right shift operator ( >>> )
+ Performs a zero-filling bitwise right shift operation on the left argument
+ by the amount specified by the right argument.
+
+ The production ShiftExpression : ShiftExpression >>> AdditiveExpression is
+ evaluated as follows:
+
+ 1. Evaluate ShiftExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate AdditiveExpression.
+ 4. Call GetValue(Result(3)).
+ 5. Call ToUint32(Result(2)).
+ 6. Call ToUint32(Result(4)).
+ 7. Mask out all but the least significant 5 bits of Result(6), that is,
+ compute Result(6) & 0x1F.
+ 8. Perform zero-filling right shift of Result(5) by Result(7) bits.
+ Vacated bits are filled with zero. The result is an unsigned 32 bit
+ integer.
+ 9. Return Result(8).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "11.7.3";
+ var VERSION = "ECMA_1";
+ startTest();
+ var testcases = getTestCases();
+
+ writeHeaderToLog( SECTION + " The unsigned right shift operator ( >>> )");
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ var addexp = 0;
+ var power = 0;
+
+ for ( power = 0; power <= 32; power++ ) {
+ shiftexp = Math.pow( 2, power );
+
+ for ( addexp = 0; addexp <= 32; addexp++ ) {
+ array[item++] = new TestCase( SECTION,
+ shiftexp + " >>> " + addexp,
+ UnsignedRightShift( shiftexp, addexp ),
+ shiftexp >>> addexp );
+ }
+ }
+
+ return ( array );
+}
+
+function ToInteger( n ) {
+ n = Number( n );
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ if ( n != n ) {
+ return 0;
+ }
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY ) {
+ return n;
+ }
+ return ( sign * Math.floor(Math.abs(n)) );
+}
+function ToInt32( n ) {
+ n = Number( n );
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
+ return 0;
+ }
+
+ n = (sign * Math.floor( Math.abs(n) )) % Math.pow(2,32);
+ n = ( n >= Math.pow(2,31) ) ? n - Math.pow(2,32) : n;
+
+ return ( n );
+}
+function ToUint32( n ) {
+ n = Number( n );
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
+ return 0;
+ }
+ n = sign * Math.floor( Math.abs(n) )
+
+ n = n % Math.pow(2,32);
+
+ if ( n < 0 ){
+ n += Math.pow(2,32);
+ }
+
+ return ( n );
+}
+function ToUint16( n ) {
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
+ return 0;
+ }
+
+ n = ( sign * Math.floor( Math.abs(n) ) ) % Math.pow(2,16);
+
+ if (n <0) {
+ n += Math.pow(2,16);
+ }
+
+ return ( n );
+}
+function Mask( b, n ) {
+ b = ToUint32BitString( b );
+ b = b.substring( b.length - n );
+ b = ToUint32Decimal( b );
+ return ( b );
+}
+function ToUint32BitString( n ) {
+ var b = "";
+ for ( p = 31; p >=0; p-- ) {
+ if ( n >= Math.pow(2,p) ) {
+ b += "1";
+ n -= Math.pow(2,p);
+ } else {
+ b += "0";
+ }
+ }
+ return b;
+}
+function ToInt32BitString( n ) {
+ var b = "";
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ b += ( sign == 1 ) ? "0" : "1";
+
+ for ( p = 30; p >=0; p-- ) {
+ if ( (sign == 1 ) ? sign * n >= Math.pow(2,p) : sign * n > Math.pow(2,p) ) {
+ b += ( sign == 1 ) ? "1" : "0";
+ n -= sign * Math.pow( 2, p );
+ } else {
+ b += ( sign == 1 ) ? "0" : "1";
+ }
+ }
+
+ return b;
+}
+function ToInt32Decimal( bin ) {
+ var r = 0;
+ var sign;
+
+ if ( Number(bin.charAt(0)) == 0 ) {
+ sign = 1;
+ r = 0;
+ } else {
+ sign = -1;
+ r = -(Math.pow(2,31));
+ }
+
+ for ( var j = 0; j < 31; j++ ) {
+ r += Math.pow( 2, j ) * Number(bin.charAt(31-j));
+ }
+
+ return r;
+}
+function ToUint32Decimal( bin ) {
+ var r = 0;
+
+
+ for ( l = bin.length; l < 32; l++ ) {
+ bin = "0" + bin;
+ }
+
+ for ( j = 0; j < 32; j++ ) {
+ r += Math.pow( 2, j ) * Number(bin.charAt(31-j));
+
+ }
+
+ return r;
+}
+function RShift( s, a ) {
+ s = ToUint32BitString( s );
+ for ( z = 0; z < a; z++ ) {
+ s = "0" + s;
+ }
+ s = s.substring( 0, s.length - a );
+
+ return ToUint32Decimal(s);
+}
+function UnsignedRightShift( s, a ) {
+ s = ToUint32( s );
+ a = ToUint32( a );
+ a = Mask( a, 5 );
+ return ( RShift( s, a ) );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.8.1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.8.1.js
new file mode 100644
index 0000000..db2c701
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.8.1.js
@@ -0,0 +1,121 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 11.8.1.js
+ ECMA Section: 11.8.1 The less-than operator ( < )
+ Description:
+
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "11.8.1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var testcases = getTestCases();
+
+ writeHeaderToLog( SECTION + " The less-than operator ( < )");
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "true < false", false, true < false );
+ array[item++] = new TestCase( SECTION, "false < true", true, false < true );
+ array[item++] = new TestCase( SECTION, "false < false", false, false < false );
+ array[item++] = new TestCase( SECTION, "true < true", false, true < true );
+
+ array[item++] = new TestCase( SECTION, "new Boolean(true) < new Boolean(true)", false, new Boolean(true) < new Boolean(true) );
+ array[item++] = new TestCase( SECTION, "new Boolean(true) < new Boolean(false)", false, new Boolean(true) < new Boolean(false) );
+ array[item++] = new TestCase( SECTION, "new Boolean(false) < new Boolean(true)", true, new Boolean(false) < new Boolean(true) );
+ array[item++] = new TestCase( SECTION, "new Boolean(false) < new Boolean(false)", false, new Boolean(false) < new Boolean(false) );
+
+ array[item++] = new TestCase( SECTION, "new MyObject(Infinity) < new MyObject(Infinity)", false, new MyObject( Number.POSITIVE_INFINITY ) < new MyObject( Number.POSITIVE_INFINITY) );
+ array[item++] = new TestCase( SECTION, "new MyObject(-Infinity) < new MyObject(Infinity)", true, new MyObject( Number.NEGATIVE_INFINITY ) < new MyObject( Number.POSITIVE_INFINITY) );
+ array[item++] = new TestCase( SECTION, "new MyObject(-Infinity) < new MyObject(-Infinity)", false, new MyObject( Number.NEGATIVE_INFINITY ) < new MyObject( Number.NEGATIVE_INFINITY) );
+
+ array[item++] = new TestCase( SECTION, "new MyValueObject(false) < new MyValueObject(true)", true, new MyValueObject(false) < new MyValueObject(true) );
+ array[item++] = new TestCase( SECTION, "new MyValueObject(true) < new MyValueObject(true)", false, new MyValueObject(true) < new MyValueObject(true) );
+ array[item++] = new TestCase( SECTION, "new MyValueObject(false) < new MyValueObject(false)", false, new MyValueObject(false) < new MyValueObject(false) );
+
+ array[item++] = new TestCase( SECTION, "new MyStringObject(false) < new MyStringObject(true)", true, new MyStringObject(false) < new MyStringObject(true) );
+ array[item++] = new TestCase( SECTION, "new MyStringObject(true) < new MyStringObject(true)", false, new MyStringObject(true) < new MyStringObject(true) );
+ array[item++] = new TestCase( SECTION, "new MyStringObject(false) < new MyStringObject(false)", false, new MyStringObject(false) < new MyStringObject(false) );
+
+ array[item++] = new TestCase( SECTION, "Number.NaN < Number.NaN", false, Number.NaN < Number.NaN );
+ array[item++] = new TestCase( SECTION, "0 < Number.NaN", false, 0 < Number.NaN );
+ array[item++] = new TestCase( SECTION, "Number.NaN < 0", false, Number.NaN < 0 );
+
+ array[item++] = new TestCase( SECTION, "0 < -0", false, 0 < -0 );
+ array[item++] = new TestCase( SECTION, "-0 < 0", false, -0 < 0 );
+
+ array[item++] = new TestCase( SECTION, "Infinity < 0", false, Number.POSITIVE_INFINITY < 0 );
+ array[item++] = new TestCase( SECTION, "Infinity < Number.MAX_VALUE", false, Number.POSITIVE_INFINITY < Number.MAX_VALUE );
+ array[item++] = new TestCase( SECTION, "Infinity < Infinity", false, Number.POSITIVE_INFINITY < Number.POSITIVE_INFINITY );
+
+ array[item++] = new TestCase( SECTION, "0 < Infinity", true, 0 < Number.POSITIVE_INFINITY );
+ array[item++] = new TestCase( SECTION, "Number.MAX_VALUE < Infinity", true, Number.MAX_VALUE < Number.POSITIVE_INFINITY );
+
+ array[item++] = new TestCase( SECTION, "0 < -Infinity", false, 0 < Number.NEGATIVE_INFINITY );
+ array[item++] = new TestCase( SECTION, "Number.MAX_VALUE < -Infinity", false, Number.MAX_VALUE < Number.NEGATIVE_INFINITY );
+ array[item++] = new TestCase( SECTION, "-Infinity < -Infinity", false, Number.NEGATIVE_INFINITY < Number.NEGATIVE_INFINITY );
+
+ array[item++] = new TestCase( SECTION, "-Infinity < 0", true, Number.NEGATIVE_INFINITY < 0 );
+ array[item++] = new TestCase( SECTION, "-Infinity < -Number.MAX_VALUE", true, Number.NEGATIVE_INFINITY < -Number.MAX_VALUE );
+ array[item++] = new TestCase( SECTION, "-Infinity < Number.MIN_VALUE", true, Number.NEGATIVE_INFINITY < Number.MIN_VALUE );
+
+ array[item++] = new TestCase( SECTION, "'string' < 'string'", false, 'string' < 'string' );
+ array[item++] = new TestCase( SECTION, "'astring' < 'string'", true, 'astring' < 'string' );
+ array[item++] = new TestCase( SECTION, "'strings' < 'stringy'", true, 'strings' < 'stringy' );
+ array[item++] = new TestCase( SECTION, "'strings' < 'stringier'", false, 'strings' < 'stringier' );
+ array[item++] = new TestCase( SECTION, "'string' < 'astring'", false, 'string' < 'astring' );
+ array[item++] = new TestCase( SECTION, "'string' < 'strings'", true, 'string' < 'strings' );
+
+ return ( array );
+}
+function MyObject(value) {
+ this.value = value;
+ this.valueOf = new Function( "return this.value" );
+ this.toString = new Function( "return this.value +''" );
+}
+function MyValueObject(value) {
+ this.value = value;
+ this.valueOf = new Function( "return this.value" );
+}
+function MyStringObject(value) {
+ this.value = value;
+ this.toString = new Function( "return this.value +''" );
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.8.2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.8.2.js
new file mode 100644
index 0000000..962c33e
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.8.2.js
@@ -0,0 +1,122 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 11.8.2.js
+ ECMA Section: 11.8.2 The greater-than operator ( > )
+ Description:
+
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "11.8.2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var testcases = getTestCases();
+
+ writeHeaderToLog( SECTION + " The greater-than operator ( > )");
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "true > false", true, true > false );
+ array[item++] = new TestCase( SECTION, "false > true", false, false > true );
+ array[item++] = new TestCase( SECTION, "false > false", false, false > false );
+ array[item++] = new TestCase( SECTION, "true > true", false, true > true );
+
+ array[item++] = new TestCase( SECTION, "new Boolean(true) > new Boolean(true)", false, new Boolean(true) > new Boolean(true) );
+ array[item++] = new TestCase( SECTION, "new Boolean(true) > new Boolean(false)", true, new Boolean(true) > new Boolean(false) );
+ array[item++] = new TestCase( SECTION, "new Boolean(false) > new Boolean(true)", false, new Boolean(false) > new Boolean(true) );
+ array[item++] = new TestCase( SECTION, "new Boolean(false) > new Boolean(false)", false, new Boolean(false) > new Boolean(false) );
+
+ array[item++] = new TestCase( SECTION, "new MyObject(Infinity) > new MyObject(Infinity)", false, new MyObject( Number.POSITIVE_INFINITY ) > new MyObject( Number.POSITIVE_INFINITY) );
+ array[item++] = new TestCase( SECTION, "new MyObject(-Infinity) > new MyObject(Infinity)", false, new MyObject( Number.NEGATIVE_INFINITY ) > new MyObject( Number.POSITIVE_INFINITY) );
+ array[item++] = new TestCase( SECTION, "new MyObject(-Infinity) > new MyObject(-Infinity)", false, new MyObject( Number.NEGATIVE_INFINITY ) > new MyObject( Number.NEGATIVE_INFINITY) );
+
+ array[item++] = new TestCase( SECTION, "new MyValueObject(false) > new MyValueObject(true)", false, new MyValueObject(false) > new MyValueObject(true) );
+ array[item++] = new TestCase( SECTION, "new MyValueObject(true) > new MyValueObject(true)", false, new MyValueObject(true) > new MyValueObject(true) );
+ array[item++] = new TestCase( SECTION, "new MyValueObject(false) > new MyValueObject(false)", false, new MyValueObject(false) > new MyValueObject(false) );
+
+ array[item++] = new TestCase( SECTION, "new MyStringObject(false) > new MyStringObject(true)", false, new MyStringObject(false) > new MyStringObject(true) );
+ array[item++] = new TestCase( SECTION, "new MyStringObject(true) > new MyStringObject(true)", false, new MyStringObject(true) > new MyStringObject(true) );
+ array[item++] = new TestCase( SECTION, "new MyStringObject(false) > new MyStringObject(false)", false, new MyStringObject(false) > new MyStringObject(false) );
+
+ array[item++] = new TestCase( SECTION, "Number.NaN > Number.NaN", false, Number.NaN > Number.NaN );
+ array[item++] = new TestCase( SECTION, "0 > Number.NaN", false, 0 > Number.NaN );
+ array[item++] = new TestCase( SECTION, "Number.NaN > 0", false, Number.NaN > 0 );
+
+ array[item++] = new TestCase( SECTION, "0 > -0", false, 0 > -0 );
+ array[item++] = new TestCase( SECTION, "-0 > 0", false, -0 > 0 );
+
+ array[item++] = new TestCase( SECTION, "Infinity > 0", true, Number.POSITIVE_INFINITY > 0 );
+ array[item++] = new TestCase( SECTION, "Infinity > Number.MAX_VALUE", true, Number.POSITIVE_INFINITY > Number.MAX_VALUE );
+ array[item++] = new TestCase( SECTION, "Infinity > Infinity", false, Number.POSITIVE_INFINITY > Number.POSITIVE_INFINITY );
+
+ array[item++] = new TestCase( SECTION, "0 > Infinity", false, 0 > Number.POSITIVE_INFINITY );
+ array[item++] = new TestCase( SECTION, "Number.MAX_VALUE > Infinity", false, Number.MAX_VALUE > Number.POSITIVE_INFINITY );
+
+ array[item++] = new TestCase( SECTION, "0 > -Infinity", true, 0 > Number.NEGATIVE_INFINITY );
+ array[item++] = new TestCase( SECTION, "Number.MAX_VALUE > -Infinity", true, Number.MAX_VALUE > Number.NEGATIVE_INFINITY );
+ array[item++] = new TestCase( SECTION, "-Infinity > -Infinity", false, Number.NEGATIVE_INFINITY > Number.NEGATIVE_INFINITY );
+
+ array[item++] = new TestCase( SECTION, "-Infinity > 0", false, Number.NEGATIVE_INFINITY > 0 );
+ array[item++] = new TestCase( SECTION, "-Infinity > -Number.MAX_VALUE", false, Number.NEGATIVE_INFINITY > -Number.MAX_VALUE );
+ array[item++] = new TestCase( SECTION, "-Infinity > Number.MIN_VALUE", false, Number.NEGATIVE_INFINITY > Number.MIN_VALUE );
+
+ array[item++] = new TestCase( SECTION, "'string' > 'string'", false, 'string' > 'string' );
+ array[item++] = new TestCase( SECTION, "'astring' > 'string'", false, 'astring' > 'string' );
+ array[item++] = new TestCase( SECTION, "'strings' > 'stringy'", false, 'strings' > 'stringy' );
+ array[item++] = new TestCase( SECTION, "'strings' > 'stringier'", true, 'strings' > 'stringier' );
+ array[item++] = new TestCase( SECTION, "'string' > 'astring'", true, 'string' > 'astring' );
+ array[item++] = new TestCase( SECTION, "'string' > 'strings'", false, 'string' > 'strings' );
+
+
+ return ( array );
+}
+function MyObject(value) {
+ this.value = value;
+ this.valueOf = new Function( "return this.value" );
+ this.toString = new Function( "return this.value +''" );
+}
+function MyValueObject(value) {
+ this.value = value;
+ this.valueOf = new Function( "return this.value" );
+}
+function MyStringObject(value) {
+ this.value = value;
+ this.toString = new Function( "return this.value +''" );
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.8.3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.8.3.js
new file mode 100644
index 0000000..5da73d6
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.8.3.js
@@ -0,0 +1,120 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 11.8.3.js
+ ECMA Section: 11.8.3 The less-than-or-equal operator ( <= )
+ Description:
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "11.8.1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var testcases = getTestCases();
+
+ writeHeaderToLog( SECTION + " The less-than-or-equal operator ( <= )");
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "true <= false", false, true <= false );
+ array[item++] = new TestCase( SECTION, "false <= true", true, false <= true );
+ array[item++] = new TestCase( SECTION, "false <= false", true, false <= false );
+ array[item++] = new TestCase( SECTION, "true <= true", true, true <= true );
+
+ array[item++] = new TestCase( SECTION, "new Boolean(true) <= new Boolean(true)", true, new Boolean(true) <= new Boolean(true) );
+ array[item++] = new TestCase( SECTION, "new Boolean(true) <= new Boolean(false)", false, new Boolean(true) <= new Boolean(false) );
+ array[item++] = new TestCase( SECTION, "new Boolean(false) <= new Boolean(true)", true, new Boolean(false) <= new Boolean(true) );
+ array[item++] = new TestCase( SECTION, "new Boolean(false) <= new Boolean(false)", true, new Boolean(false) <= new Boolean(false) );
+
+ array[item++] = new TestCase( SECTION, "new MyObject(Infinity) <= new MyObject(Infinity)", true, new MyObject( Number.POSITIVE_INFINITY ) <= new MyObject( Number.POSITIVE_INFINITY) );
+ array[item++] = new TestCase( SECTION, "new MyObject(-Infinity) <= new MyObject(Infinity)", true, new MyObject( Number.NEGATIVE_INFINITY ) <= new MyObject( Number.POSITIVE_INFINITY) );
+ array[item++] = new TestCase( SECTION, "new MyObject(-Infinity) <= new MyObject(-Infinity)", true, new MyObject( Number.NEGATIVE_INFINITY ) <= new MyObject( Number.NEGATIVE_INFINITY) );
+
+ array[item++] = new TestCase( SECTION, "new MyValueObject(false) <= new MyValueObject(true)", true, new MyValueObject(false) <= new MyValueObject(true) );
+ array[item++] = new TestCase( SECTION, "new MyValueObject(true) <= new MyValueObject(true)", true, new MyValueObject(true) <= new MyValueObject(true) );
+ array[item++] = new TestCase( SECTION, "new MyValueObject(false) <= new MyValueObject(false)", true, new MyValueObject(false) <= new MyValueObject(false) );
+
+ array[item++] = new TestCase( SECTION, "new MyStringObject(false) <= new MyStringObject(true)", true, new MyStringObject(false) <= new MyStringObject(true) );
+ array[item++] = new TestCase( SECTION, "new MyStringObject(true) <= new MyStringObject(true)", true, new MyStringObject(true) <= new MyStringObject(true) );
+ array[item++] = new TestCase( SECTION, "new MyStringObject(false) <= new MyStringObject(false)", true, new MyStringObject(false) <= new MyStringObject(false) );
+
+ array[item++] = new TestCase( SECTION, "Number.NaN <= Number.NaN", false, Number.NaN <= Number.NaN );
+ array[item++] = new TestCase( SECTION, "0 <= Number.NaN", false, 0 <= Number.NaN );
+ array[item++] = new TestCase( SECTION, "Number.NaN <= 0", false, Number.NaN <= 0 );
+
+ array[item++] = new TestCase( SECTION, "0 <= -0", true, 0 <= -0 );
+ array[item++] = new TestCase( SECTION, "-0 <= 0", true, -0 <= 0 );
+
+ array[item++] = new TestCase( SECTION, "Infinity <= 0", false, Number.POSITIVE_INFINITY <= 0 );
+ array[item++] = new TestCase( SECTION, "Infinity <= Number.MAX_VALUE", false, Number.POSITIVE_INFINITY <= Number.MAX_VALUE );
+ array[item++] = new TestCase( SECTION, "Infinity <= Infinity", true, Number.POSITIVE_INFINITY <= Number.POSITIVE_INFINITY );
+
+ array[item++] = new TestCase( SECTION, "0 <= Infinity", true, 0 <= Number.POSITIVE_INFINITY );
+ array[item++] = new TestCase( SECTION, "Number.MAX_VALUE <= Infinity", true, Number.MAX_VALUE <= Number.POSITIVE_INFINITY );
+
+ array[item++] = new TestCase( SECTION, "0 <= -Infinity", false, 0 <= Number.NEGATIVE_INFINITY );
+ array[item++] = new TestCase( SECTION, "Number.MAX_VALUE <= -Infinity", false, Number.MAX_VALUE <= Number.NEGATIVE_INFINITY );
+ array[item++] = new TestCase( SECTION, "-Infinity <= -Infinity", true, Number.NEGATIVE_INFINITY <= Number.NEGATIVE_INFINITY );
+
+ array[item++] = new TestCase( SECTION, "-Infinity <= 0", true, Number.NEGATIVE_INFINITY <= 0 );
+ array[item++] = new TestCase( SECTION, "-Infinity <= -Number.MAX_VALUE", true, Number.NEGATIVE_INFINITY <= -Number.MAX_VALUE );
+ array[item++] = new TestCase( SECTION, "-Infinity <= Number.MIN_VALUE", true, Number.NEGATIVE_INFINITY <= Number.MIN_VALUE );
+
+ array[item++] = new TestCase( SECTION, "'string' <= 'string'", true, 'string' <= 'string' );
+ array[item++] = new TestCase( SECTION, "'astring' <= 'string'", true, 'astring' <= 'string' );
+ array[item++] = new TestCase( SECTION, "'strings' <= 'stringy'", true, 'strings' <= 'stringy' );
+ array[item++] = new TestCase( SECTION, "'strings' <= 'stringier'", false, 'strings' <= 'stringier' );
+ array[item++] = new TestCase( SECTION, "'string' <= 'astring'", false, 'string' <= 'astring' );
+ array[item++] = new TestCase( SECTION, "'string' <= 'strings'", true, 'string' <= 'strings' );
+
+ return ( array );
+}
+function MyObject(value) {
+ this.value = value;
+ this.valueOf = new Function( "return this.value" );
+ this.toString = new Function( "return this.value +''" );
+}
+function MyValueObject(value) {
+ this.value = value;
+ this.valueOf = new Function( "return this.value" );
+}
+function MyStringObject(value) {
+ this.value = value;
+ this.toString = new Function( "return this.value +''" );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.8.4.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.8.4.js
new file mode 100644
index 0000000..7e25b05
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.8.4.js
@@ -0,0 +1,122 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 11.8.4.js
+ ECMA Section: 11.8.4 The greater-than-or-equal operator ( >= )
+ Description:
+
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "11.8.4";
+ var VERSION = "ECMA_1";
+ startTest();
+ var testcases = getTestCases();
+
+ writeHeaderToLog( SECTION + " The greater-than-or-equal operator ( >= )");
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "true >= false", true, true >= false );
+ array[item++] = new TestCase( SECTION, "false >= true", false, false >= true );
+ array[item++] = new TestCase( SECTION, "false >= false", true, false >= false );
+ array[item++] = new TestCase( SECTION, "true >= true", true, true >= true );
+
+ array[item++] = new TestCase( SECTION, "new Boolean(true) >= new Boolean(true)", true, new Boolean(true) >= new Boolean(true) );
+ array[item++] = new TestCase( SECTION, "new Boolean(true) >= new Boolean(false)", true, new Boolean(true) >= new Boolean(false) );
+ array[item++] = new TestCase( SECTION, "new Boolean(false) >= new Boolean(true)", false, new Boolean(false) >= new Boolean(true) );
+ array[item++] = new TestCase( SECTION, "new Boolean(false) >= new Boolean(false)", true, new Boolean(false) >= new Boolean(false) );
+
+ array[item++] = new TestCase( SECTION, "new MyObject(Infinity) >= new MyObject(Infinity)", true, new MyObject( Number.POSITIVE_INFINITY ) >= new MyObject( Number.POSITIVE_INFINITY) );
+ array[item++] = new TestCase( SECTION, "new MyObject(-Infinity) >= new MyObject(Infinity)", false, new MyObject( Number.NEGATIVE_INFINITY ) >= new MyObject( Number.POSITIVE_INFINITY) );
+ array[item++] = new TestCase( SECTION, "new MyObject(-Infinity) >= new MyObject(-Infinity)", true, new MyObject( Number.NEGATIVE_INFINITY ) >= new MyObject( Number.NEGATIVE_INFINITY) );
+
+ array[item++] = new TestCase( SECTION, "new MyValueObject(false) >= new MyValueObject(true)", false, new MyValueObject(false) >= new MyValueObject(true) );
+ array[item++] = new TestCase( SECTION, "new MyValueObject(true) >= new MyValueObject(true)", true, new MyValueObject(true) >= new MyValueObject(true) );
+ array[item++] = new TestCase( SECTION, "new MyValueObject(false) >= new MyValueObject(false)", true, new MyValueObject(false) >= new MyValueObject(false) );
+
+ array[item++] = new TestCase( SECTION, "new MyStringObject(false) >= new MyStringObject(true)", false, new MyStringObject(false) >= new MyStringObject(true) );
+ array[item++] = new TestCase( SECTION, "new MyStringObject(true) >= new MyStringObject(true)", true, new MyStringObject(true) >= new MyStringObject(true) );
+ array[item++] = new TestCase( SECTION, "new MyStringObject(false) >= new MyStringObject(false)", true, new MyStringObject(false) >= new MyStringObject(false) );
+
+ array[item++] = new TestCase( SECTION, "Number.NaN >= Number.NaN", false, Number.NaN >= Number.NaN );
+ array[item++] = new TestCase( SECTION, "0 >= Number.NaN", false, 0 >= Number.NaN );
+ array[item++] = new TestCase( SECTION, "Number.NaN >= 0", false, Number.NaN >= 0 );
+
+ array[item++] = new TestCase( SECTION, "0 >= -0", true, 0 >= -0 );
+ array[item++] = new TestCase( SECTION, "-0 >= 0", true, -0 >= 0 );
+
+ array[item++] = new TestCase( SECTION, "Infinity >= 0", true, Number.POSITIVE_INFINITY >= 0 );
+ array[item++] = new TestCase( SECTION, "Infinity >= Number.MAX_VALUE", true, Number.POSITIVE_INFINITY >= Number.MAX_VALUE );
+ array[item++] = new TestCase( SECTION, "Infinity >= Infinity", true, Number.POSITIVE_INFINITY >= Number.POSITIVE_INFINITY );
+
+ array[item++] = new TestCase( SECTION, "0 >= Infinity", false, 0 >= Number.POSITIVE_INFINITY );
+ array[item++] = new TestCase( SECTION, "Number.MAX_VALUE >= Infinity", false, Number.MAX_VALUE >= Number.POSITIVE_INFINITY );
+
+ array[item++] = new TestCase( SECTION, "0 >= -Infinity", true, 0 >= Number.NEGATIVE_INFINITY );
+ array[item++] = new TestCase( SECTION, "Number.MAX_VALUE >= -Infinity", true, Number.MAX_VALUE >= Number.NEGATIVE_INFINITY );
+ array[item++] = new TestCase( SECTION, "-Infinity >= -Infinity", true, Number.NEGATIVE_INFINITY >= Number.NEGATIVE_INFINITY );
+
+ array[item++] = new TestCase( SECTION, "-Infinity >= 0", false, Number.NEGATIVE_INFINITY >= 0 );
+ array[item++] = new TestCase( SECTION, "-Infinity >= -Number.MAX_VALUE", false, Number.NEGATIVE_INFINITY >= -Number.MAX_VALUE );
+ array[item++] = new TestCase( SECTION, "-Infinity >= Number.MIN_VALUE", false, Number.NEGATIVE_INFINITY >= Number.MIN_VALUE );
+
+ array[item++] = new TestCase( SECTION, "'string' > 'string'", false, 'string' > 'string' );
+ array[item++] = new TestCase( SECTION, "'astring' > 'string'", false, 'astring' > 'string' );
+ array[item++] = new TestCase( SECTION, "'strings' > 'stringy'", false, 'strings' > 'stringy' );
+ array[item++] = new TestCase( SECTION, "'strings' > 'stringier'", true, 'strings' > 'stringier' );
+ array[item++] = new TestCase( SECTION, "'string' > 'astring'", true, 'string' > 'astring' );
+ array[item++] = new TestCase( SECTION, "'string' > 'strings'", false, 'string' > 'strings' );
+
+
+ return ( array );
+}
+function MyObject(value) {
+ this.value = value;
+ this.valueOf = new Function( "return this.value" );
+ this.toString = new Function( "return this.value +''" );
+}
+function MyValueObject(value) {
+ this.value = value;
+ this.valueOf = new Function( "return this.value" );
+}
+function MyStringObject(value) {
+ this.value = value;
+ this.toString = new Function( "return this.value +''" );
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.9.1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.9.1.js
new file mode 100644
index 0000000..b64df9a
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.9.1.js
@@ -0,0 +1,162 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 11.9.1.js
+ ECMA Section: 11.9.1 The equals operator ( == )
+ Description:
+
+ The production EqualityExpression:
+ EqualityExpression == RelationalExpression is evaluated as follows:
+
+ 1. Evaluate EqualityExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate RelationalExpression.
+ 4. Call GetValue(Result(3)).
+ 5. Perform the comparison Result(4) == Result(2). (See section 11.9.3)
+ 6. Return Result(5).
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "11.9.1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var BUGNUMBER="77391";
+
+
+ var testcases = getTestCases();
+
+ writeHeaderToLog( SECTION + " The equals operator ( == )");
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ // type x and type y are the same. if type x is undefined or null, return true
+
+ array[item++] = new TestCase( SECTION, "void 0 = void 0", true, void 0 == void 0 );
+ array[item++] = new TestCase( SECTION, "null == null", true, null == null );
+
+ // if x is NaN, return false. if y is NaN, return false.
+
+ array[item++] = new TestCase( SECTION, "NaN == NaN", false, Number.NaN == Number.NaN );
+ array[item++] = new TestCase( SECTION, "NaN == 0", false, Number.NaN == 0 );
+ array[item++] = new TestCase( SECTION, "0 == NaN", false, 0 == Number.NaN );
+ array[item++] = new TestCase( SECTION, "NaN == Infinity", false, Number.NaN == Number.POSITIVE_INFINITY );
+ array[item++] = new TestCase( SECTION, "Infinity == NaN", false, Number.POSITIVE_INFINITY == Number.NaN );
+
+ // if x is the same number value as y, return true.
+
+ array[item++] = new TestCase( SECTION, "Number.MAX_VALUE == Number.MAX_VALUE", true, Number.MAX_VALUE == Number.MAX_VALUE );
+ array[item++] = new TestCase( SECTION, "Number.MIN_VALUE == Number.MIN_VALUE", true, Number.MIN_VALUE == Number.MIN_VALUE );
+ array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY == Number.POSITIVE_INFINITY", true, Number.POSITIVE_INFINITY == Number.POSITIVE_INFINITY );
+ array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY == Number.NEGATIVE_INFINITY", true, Number.NEGATIVE_INFINITY == Number.NEGATIVE_INFINITY );
+
+ // if xis 0 and y is -0, return true. if x is -0 and y is 0, return true.
+
+ array[item++] = new TestCase( SECTION, "0 == 0", true, 0 == 0 );
+ array[item++] = new TestCase( SECTION, "0 == -0", true, 0 == -0 );
+ array[item++] = new TestCase( SECTION, "-0 == 0", true, -0 == 0 );
+ array[item++] = new TestCase( SECTION, "-0 == -0", true, -0 == -0 );
+
+ // return false.
+
+ array[item++] = new TestCase( SECTION, "0.9 == 1", false, 0.9 == 1 );
+ array[item++] = new TestCase( SECTION, "0.999999 == 1", false, 0.999999 == 1 );
+ array[item++] = new TestCase( SECTION, "0.9999999999 == 1", false, 0.9999999999 == 1 );
+ array[item++] = new TestCase( SECTION, "0.9999999999999 == 1", false, 0.9999999999999 == 1 );
+
+ // type x and type y are the same type, but not numbers.
+
+
+ // x and y are strings. return true if x and y are exactly the same sequence of characters.
+ // otherwise, return false.
+
+ array[item++] = new TestCase( SECTION, "'hello' == 'hello'", true, "hello" == "hello" );
+
+ // x and y are booleans. return true if both are true or both are false.
+
+ array[item++] = new TestCase( SECTION, "true == true", true, true == true );
+ array[item++] = new TestCase( SECTION, "false == false", true, false == false );
+ array[item++] = new TestCase( SECTION, "true == false", false, true == false );
+ array[item++] = new TestCase( SECTION, "false == true", false, false == true );
+
+ // return true if x and y refer to the same object. otherwise return false.
+
+ array[item++] = new TestCase( SECTION, "new MyObject(true) == new MyObject(true)", false, new MyObject(true) == new MyObject(true) );
+ array[item++] = new TestCase( SECTION, "new Boolean(true) == new Boolean(true)", false, new Boolean(true) == new Boolean(true) );
+ array[item++] = new TestCase( SECTION, "new Boolean(false) == new Boolean(false)", false, new Boolean(false) == new Boolean(false) );
+
+
+ array[item++] = new TestCase( SECTION, "x = new MyObject(true); y = x; z = x; z == y", true, eval("x = new MyObject(true); y = x; z = x; z == y") );
+ array[item++] = new TestCase( SECTION, "x = new MyObject(false); y = x; z = x; z == y", true, eval("x = new MyObject(false); y = x; z = x; z == y") );
+ array[item++] = new TestCase( SECTION, "x = new Boolean(true); y = x; z = x; z == y", true, eval("x = new Boolean(true); y = x; z = x; z == y") );
+ array[item++] = new TestCase( SECTION, "x = new Boolean(false); y = x; z = x; z == y", true, eval("x = new Boolean(false); y = x; z = x; z == y") );
+
+ array[item++] = new TestCase( SECTION, "new Boolean(true) == new Boolean(true)", false, new Boolean(true) == new Boolean(true) );
+ array[item++] = new TestCase( SECTION, "new Boolean(false) == new Boolean(false)", false, new Boolean(false) == new Boolean(false) );
+
+ // if x is null and y is undefined, return true. if x is undefined and y is null return true.
+
+ array[item++] = new TestCase( SECTION, "null == void 0", true, null == void 0 );
+ array[item++] = new TestCase( SECTION, "void 0 == null", true, void 0 == null );
+
+ // if type(x) is Number and type(y) is string, return the result of the comparison x == ToNumber(y).
+
+ array[item++] = new TestCase( SECTION, "1 == '1'", true, 1 == '1' );
+ array[item++] = new TestCase( SECTION, "255 == '0xff'", true, 255 == '0xff' );
+ array[item++] = new TestCase( SECTION, "0 == '\r'", true, 0 == "\r" );
+ array[item++] = new TestCase( SECTION, "1e19 == '1e19'", true, 1e19 == "1e19" );
+
+
+ array[item++] = new TestCase( SECTION, "new Boolean(true) == true", true, true == new Boolean(true) );
+ array[item++] = new TestCase( SECTION, "new MyObject(true) == true", true, true == new MyObject(true) );
+
+ array[item++] = new TestCase( SECTION, "new Boolean(false) == false", true, new Boolean(false) == false );
+ array[item++] = new TestCase( SECTION, "new MyObject(false) == false", true, new MyObject(false) == false );
+
+ array[item++] = new TestCase( SECTION, "true == new Boolean(true)", true, true == new Boolean(true) );
+ array[item++] = new TestCase( SECTION, "true == new MyObject(true)", true, true == new MyObject(true) );
+
+ array[item++] = new TestCase( SECTION, "false == new Boolean(false)", true, false == new Boolean(false) );
+ array[item++] = new TestCase( SECTION, "false == new MyObject(false)", true, false == new MyObject(false) );
+
+ return ( array );
+}
+
+function MyObject( value ) {
+ this.value = value;
+ this.valueOf = new Function( "return this.value" );
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.9.2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.9.2.js
new file mode 100644
index 0000000..9eb4bfc
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.9.2.js
@@ -0,0 +1,161 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 11.9.2.js
+ ECMA Section: 11.9.2 The equals operator ( == )
+ Description:
+
+ The production EqualityExpression:
+ EqualityExpression == RelationalExpression is evaluated as follows:
+
+ 1. Evaluate EqualityExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate RelationalExpression.
+ 4. Call GetValue(Result(3)).
+ 5. Perform the comparison Result(4) == Result(2). (See section 11.9.3)
+ 6. Return Result(5).
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "11.9.2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var BUGNUMBER="77391";
+
+ var testcases = getTestCases();
+
+ writeHeaderToLog( SECTION + " The equals operator ( == )");
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ // type x and type y are the same. if type x is undefined or null, return true
+
+ array[item++] = new TestCase( SECTION, "void 0 == void 0", false, void 0 != void 0 );
+ array[item++] = new TestCase( SECTION, "null == null", false, null != null );
+
+ // if x is NaN, return false. if y is NaN, return false.
+
+ array[item++] = new TestCase( SECTION, "NaN != NaN", true, Number.NaN != Number.NaN );
+ array[item++] = new TestCase( SECTION, "NaN != 0", true, Number.NaN != 0 );
+ array[item++] = new TestCase( SECTION, "0 != NaN", true, 0 != Number.NaN );
+ array[item++] = new TestCase( SECTION, "NaN != Infinity", true, Number.NaN != Number.POSITIVE_INFINITY );
+ array[item++] = new TestCase( SECTION, "Infinity != NaN", true, Number.POSITIVE_INFINITY != Number.NaN );
+
+ // if x is the same number value as y, return true.
+
+ array[item++] = new TestCase( SECTION, "Number.MAX_VALUE != Number.MAX_VALUE", false, Number.MAX_VALUE != Number.MAX_VALUE );
+ array[item++] = new TestCase( SECTION, "Number.MIN_VALUE != Number.MIN_VALUE", false, Number.MIN_VALUE != Number.MIN_VALUE );
+ array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY != Number.POSITIVE_INFINITY", false, Number.POSITIVE_INFINITY != Number.POSITIVE_INFINITY );
+ array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY != Number.NEGATIVE_INFINITY", false, Number.NEGATIVE_INFINITY != Number.NEGATIVE_INFINITY );
+
+ // if xis 0 and y is -0, return true. if x is -0 and y is 0, return true.
+
+ array[item++] = new TestCase( SECTION, "0 != 0", false, 0 != 0 );
+ array[item++] = new TestCase( SECTION, "0 != -0", false, 0 != -0 );
+ array[item++] = new TestCase( SECTION, "-0 != 0", false, -0 != 0 );
+ array[item++] = new TestCase( SECTION, "-0 != -0", false, -0 != -0 );
+
+ // return false.
+
+ array[item++] = new TestCase( SECTION, "0.9 != 1", true, 0.9 != 1 );
+ array[item++] = new TestCase( SECTION, "0.999999 != 1", true, 0.999999 != 1 );
+ array[item++] = new TestCase( SECTION, "0.9999999999 != 1", true, 0.9999999999 != 1 );
+ array[item++] = new TestCase( SECTION, "0.9999999999999 != 1", true, 0.9999999999999 != 1 );
+
+ // type x and type y are the same type, but not numbers.
+
+
+ // x and y are strings. return true if x and y are exactly the same sequence of characters.
+ // otherwise, return false.
+
+ array[item++] = new TestCase( SECTION, "'hello' != 'hello'", false, "hello" != "hello" );
+
+ // x and y are booleans. return true if both are true or both are false.
+
+ array[item++] = new TestCase( SECTION, "true != true", false, true != true );
+ array[item++] = new TestCase( SECTION, "false != false", false, false != false );
+ array[item++] = new TestCase( SECTION, "true != false", true, true != false );
+ array[item++] = new TestCase( SECTION, "false != true", true, false != true );
+
+ // return true if x and y refer to the same object. otherwise return false.
+
+ array[item++] = new TestCase( SECTION, "new MyObject(true) != new MyObject(true)", true, new MyObject(true) != new MyObject(true) );
+ array[item++] = new TestCase( SECTION, "new Boolean(true) != new Boolean(true)", true, new Boolean(true) != new Boolean(true) );
+ array[item++] = new TestCase( SECTION, "new Boolean(false) != new Boolean(false)", true, new Boolean(false) != new Boolean(false) );
+
+
+ array[item++] = new TestCase( SECTION, "x = new MyObject(true); y = x; z = x; z != y", false, eval("x = new MyObject(true); y = x; z = x; z != y") );
+ array[item++] = new TestCase( SECTION, "x = new MyObject(false); y = x; z = x; z != y", false, eval("x = new MyObject(false); y = x; z = x; z != y") );
+ array[item++] = new TestCase( SECTION, "x = new Boolean(true); y = x; z = x; z != y", false, eval("x = new Boolean(true); y = x; z = x; z != y") );
+ array[item++] = new TestCase( SECTION, "x = new Boolean(false); y = x; z = x; z != y", false, eval("x = new Boolean(false); y = x; z = x; z != y") );
+
+ array[item++] = new TestCase( SECTION, "new Boolean(true) != new Boolean(true)", true, new Boolean(true) != new Boolean(true) );
+ array[item++] = new TestCase( SECTION, "new Boolean(false) != new Boolean(false)", true, new Boolean(false) != new Boolean(false) );
+
+ // if x is null and y is undefined, return true. if x is undefined and y is null return true.
+
+ array[item++] = new TestCase( SECTION, "null != void 0", false, null != void 0 );
+ array[item++] = new TestCase( SECTION, "void 0 != null", false, void 0 != null );
+
+ // if type(x) is Number and type(y) is string, return the result of the comparison x != ToNumber(y).
+
+ array[item++] = new TestCase( SECTION, "1 != '1'", false, 1 != '1' );
+ array[item++] = new TestCase( SECTION, "255 != '0xff'", false, 255 != '0xff' );
+ array[item++] = new TestCase( SECTION, "0 != '\r'", false, 0 != "\r" );
+ array[item++] = new TestCase( SECTION, "1e19 != '1e19'", false, 1e19 != "1e19" );
+
+
+ array[item++] = new TestCase( SECTION, "new Boolean(true) != true", false, true != new Boolean(true) );
+ array[item++] = new TestCase( SECTION, "new MyObject(true) != true", false, true != new MyObject(true) );
+
+ array[item++] = new TestCase( SECTION, "new Boolean(false) != false", false, new Boolean(false) != false );
+ array[item++] = new TestCase( SECTION, "new MyObject(false) != false", false, new MyObject(false) != false );
+
+ array[item++] = new TestCase( SECTION, "true != new Boolean(true)", false, true != new Boolean(true) );
+ array[item++] = new TestCase( SECTION, "true != new MyObject(true)", false, true != new MyObject(true) );
+
+ array[item++] = new TestCase( SECTION, "false != new Boolean(false)", false, false != new Boolean(false) );
+ array[item++] = new TestCase( SECTION, "false != new MyObject(false)", false, false != new MyObject(false) );
+
+ return ( array );
+}
+
+function MyObject( value ) {
+ this.value = value;
+ this.valueOf = new Function( "return this.value" );
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.9.3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.9.3.js
new file mode 100644
index 0000000..134060b
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Expressions/11.9.3.js
@@ -0,0 +1,161 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 11.9.3.js
+ ECMA Section: 11.9.3 The equals operator ( == )
+ Description:
+
+ The production EqualityExpression:
+ EqualityExpression == RelationalExpression is evaluated as follows:
+
+ 1. Evaluate EqualityExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate RelationalExpression.
+ 4. Call GetValue(Result(3)).
+ 5. Perform the comparison Result(4) == Result(2). (See section 11.9.3)
+ 6. Return Result(5).
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "11.9.3";
+ var VERSION = "ECMA_1";
+ startTest();
+ var BUGNUMBER="77391";
+
+ var testcases = getTestCases();
+
+ writeHeaderToLog( SECTION + " The equals operator ( == )");
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ // type x and type y are the same. if type x is undefined or null, return true
+
+ array[item++] = new TestCase( SECTION, "void 0 = void 0", true, void 0 == void 0 );
+ array[item++] = new TestCase( SECTION, "null == null", true, null == null );
+
+ // if x is NaN, return false. if y is NaN, return false.
+
+ array[item++] = new TestCase( SECTION, "NaN == NaN", false, Number.NaN == Number.NaN );
+ array[item++] = new TestCase( SECTION, "NaN == 0", false, Number.NaN == 0 );
+ array[item++] = new TestCase( SECTION, "0 == NaN", false, 0 == Number.NaN );
+ array[item++] = new TestCase( SECTION, "NaN == Infinity", false, Number.NaN == Number.POSITIVE_INFINITY );
+ array[item++] = new TestCase( SECTION, "Infinity == NaN", false, Number.POSITIVE_INFINITY == Number.NaN );
+
+ // if x is the same number value as y, return true.
+
+ array[item++] = new TestCase( SECTION, "Number.MAX_VALUE == Number.MAX_VALUE", true, Number.MAX_VALUE == Number.MAX_VALUE );
+ array[item++] = new TestCase( SECTION, "Number.MIN_VALUE == Number.MIN_VALUE", true, Number.MIN_VALUE == Number.MIN_VALUE );
+ array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY == Number.POSITIVE_INFINITY", true, Number.POSITIVE_INFINITY == Number.POSITIVE_INFINITY );
+ array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY == Number.NEGATIVE_INFINITY", true, Number.NEGATIVE_INFINITY == Number.NEGATIVE_INFINITY );
+
+ // if xis 0 and y is -0, return true. if x is -0 and y is 0, return true.
+
+ array[item++] = new TestCase( SECTION, "0 == 0", true, 0 == 0 );
+ array[item++] = new TestCase( SECTION, "0 == -0", true, 0 == -0 );
+ array[item++] = new TestCase( SECTION, "-0 == 0", true, -0 == 0 );
+ array[item++] = new TestCase( SECTION, "-0 == -0", true, -0 == -0 );
+
+ // return false.
+
+ array[item++] = new TestCase( SECTION, "0.9 == 1", false, 0.9 == 1 );
+ array[item++] = new TestCase( SECTION, "0.999999 == 1", false, 0.999999 == 1 );
+ array[item++] = new TestCase( SECTION, "0.9999999999 == 1", false, 0.9999999999 == 1 );
+ array[item++] = new TestCase( SECTION, "0.9999999999999 == 1", false, 0.9999999999999 == 1 );
+
+ // type x and type y are the same type, but not numbers.
+
+
+ // x and y are strings. return true if x and y are exactly the same sequence of characters.
+ // otherwise, return false.
+
+ array[item++] = new TestCase( SECTION, "'hello' == 'hello'", true, "hello" == "hello" );
+
+ // x and y are booleans. return true if both are true or both are false.
+
+ array[item++] = new TestCase( SECTION, "true == true", true, true == true );
+ array[item++] = new TestCase( SECTION, "false == false", true, false == false );
+ array[item++] = new TestCase( SECTION, "true == false", false, true == false );
+ array[item++] = new TestCase( SECTION, "false == true", false, false == true );
+
+ // return true if x and y refer to the same object. otherwise return false.
+
+ array[item++] = new TestCase( SECTION, "new MyObject(true) == new MyObject(true)", false, new MyObject(true) == new MyObject(true) );
+ array[item++] = new TestCase( SECTION, "new Boolean(true) == new Boolean(true)", false, new Boolean(true) == new Boolean(true) );
+ array[item++] = new TestCase( SECTION, "new Boolean(false) == new Boolean(false)", false, new Boolean(false) == new Boolean(false) );
+
+
+ array[item++] = new TestCase( SECTION, "x = new MyObject(true); y = x; z = x; z == y", true, eval("x = new MyObject(true); y = x; z = x; z == y") );
+ array[item++] = new TestCase( SECTION, "x = new MyObject(false); y = x; z = x; z == y", true, eval("x = new MyObject(false); y = x; z = x; z == y") );
+ array[item++] = new TestCase( SECTION, "x = new Boolean(true); y = x; z = x; z == y", true, eval("x = new Boolean(true); y = x; z = x; z == y") );
+ array[item++] = new TestCase( SECTION, "x = new Boolean(false); y = x; z = x; z == y", true, eval("x = new Boolean(false); y = x; z = x; z == y") );
+
+ array[item++] = new TestCase( SECTION, "new Boolean(true) == new Boolean(true)", false, new Boolean(true) == new Boolean(true) );
+ array[item++] = new TestCase( SECTION, "new Boolean(false) == new Boolean(false)", false, new Boolean(false) == new Boolean(false) );
+
+ // if x is null and y is undefined, return true. if x is undefined and y is null return true.
+
+ array[item++] = new TestCase( SECTION, "null == void 0", true, null == void 0 );
+ array[item++] = new TestCase( SECTION, "void 0 == null", true, void 0 == null );
+
+ // if type(x) is Number and type(y) is string, return the result of the comparison x == ToNumber(y).
+
+ array[item++] = new TestCase( SECTION, "1 == '1'", true, 1 == '1' );
+ array[item++] = new TestCase( SECTION, "255 == '0xff'", true, 255 == '0xff' );
+ array[item++] = new TestCase( SECTION, "0 == '\r'", true, 0 == "\r" );
+ array[item++] = new TestCase( SECTION, "1e19 == '1e19'", true, 1e19 == "1e19" );
+
+
+ array[item++] = new TestCase( SECTION, "new Boolean(true) == true", true, true == new Boolean(true) );
+ array[item++] = new TestCase( SECTION, "new MyObject(true) == true", true, true == new MyObject(true) );
+
+ array[item++] = new TestCase( SECTION, "new Boolean(false) == false", true, new Boolean(false) == false );
+ array[item++] = new TestCase( SECTION, "new MyObject(false) == false", true, new MyObject(false) == false );
+
+ array[item++] = new TestCase( SECTION, "true == new Boolean(true)", true, true == new Boolean(true) );
+ array[item++] = new TestCase( SECTION, "true == new MyObject(true)", true, true == new MyObject(true) );
+
+ array[item++] = new TestCase( SECTION, "false == new Boolean(false)", true, false == new Boolean(false) );
+ array[item++] = new TestCase( SECTION, "false == new MyObject(false)", true, false == new MyObject(false) );
+
+ return ( array );
+}
+
+function MyObject( value ) {
+ this.value = value;
+ this.valueOf = new Function( "return this.value" );
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.1.1-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.1.1-1.js
new file mode 100644
index 0000000..c20dd37
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.1.1-1.js
@@ -0,0 +1,90 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.3.1.1.js
+ ECMA Section: 15.3.1.1 The Function Constructor Called as a Function
+
+ Description:
+ When the Function function is called with some arguments p1, p2, . . . , pn, body
+ (where n might be 0, that is, there are no "p" arguments, and where body might
+ also not be provided), the following steps are taken:
+
+ 1. Create and return a new Function object exactly if the function constructor had
+ been called with the same arguments (15.3.2.1).
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+ var SECTION = "15.3.1.1-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "The Function Constructor Called as a Function";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var MyObject = Function( "value", "this.value = value; this.valueOf = Function( 'return this.value' ); this.toString = Function( 'return String(this.value);' )" );
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ var myfunc = Function();
+ myfunc.toString = Object.prototype.toString;
+
+// not going to test toString here since it is implementation dependent.
+// array[item++] = new TestCase( SECTION, "myfunc.toString()", "function anonymous() { }", myfunc.toString() );
+
+ myfunc.toString = Object.prototype.toString;
+ array[item++] = new TestCase( SECTION,
+ "myfunc = Function(); myfunc.toString = Object.prototype.toString; myfunc.toString()",
+ "[object Function]",
+ myfunc.toString() );
+ array[item++] = new TestCase( SECTION, "myfunc.length", 0, myfunc.length );
+ array[item++] = new TestCase( SECTION, "myfunc.prototype.toString()", "[object Object]", myfunc.prototype.toString() );
+ array[item++] = new TestCase( SECTION, "myfunc.prototype.constructor", myfunc, myfunc.prototype.constructor );
+ array[item++] = new TestCase( SECTION, "myfunc.arguments", null, myfunc.arguments );
+ array[item++] = new TestCase( SECTION, "var OBJ = new MyObject(true); OBJ.valueOf()", true, eval("var OBJ = new MyObject(true); OBJ.valueOf()") );
+ array[item++] = new TestCase( SECTION, "OBJ.toString()", "true", OBJ.toString() );
+ array[item++] = new TestCase( SECTION, "OBJ.toString = Object.prototype.toString; OBJ.toString()", "[object Object]", eval("OBJ.toString = Object.prototype.toString; OBJ.toString()") );
+ array[item++] = new TestCase( SECTION, "MyObject.toString = Object.prototype.toString; MyObject.toString()", "[object Function]", eval("MyObject.toString = Object.prototype.toString; MyObject.toString()") );
+ array[item++] = new TestCase( SECTION, "MyObject.__proto__ == Function.prototype", true, MyObject.__proto__ == Function.prototype );
+ array[item++] = new TestCase( SECTION, "MyObject.length", 1, MyObject.length );
+ array[item++] = new TestCase( SECTION, "MyObject.prototype.constructor", MyObject, MyObject.prototype.constructor );
+ array[item++] = new TestCase( SECTION, "MyObject.arguments", null, MyObject.arguments );
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.1.1-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.1.1-2.js
new file mode 100644
index 0000000..ce6994e
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.1.1-2.js
@@ -0,0 +1,118 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.3.1.1-2.js
+ ECMA Section: 15.3.1.1 The Function Constructor Called as a Function
+ Function(p1, p2, ..., pn, body )
+
+ Description:
+ When the Function function is called with some arguments p1, p2, . . . , pn,
+ body (where n might be 0, that is, there are no "p" arguments, and where body
+ might also not be provided), the following steps are taken:
+
+ 1. Create and return a new Function object exactly if the function constructor
+ had been called with the same arguments (15.3.2.1).
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+ var SECTION = "15.3.1.1-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "The Function Constructor Called as a Function";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ var myfunc1 = Function("a","b","c", "return a+b+c" );
+ var myfunc2 = Function("a, b, c", "return a+b+c" );
+ var myfunc3 = Function("a,b", "c", "return a+b+c" );
+
+ myfunc1.toString = Object.prototype.toString;
+ myfunc2.toString = Object.prototype.toString;
+ myfunc3.toString = Object.prototype.toString;
+
+ array[item++] = new TestCase( SECTION, "myfunc1 = Function('a','b','c'); myfunc.toString = Object.prototype.toString; myfunc.toString()",
+ "[object Function]",
+ myfunc1.toString() );
+
+ array[item++] = new TestCase( SECTION, "myfunc1.length", 3, myfunc1.length );
+ array[item++] = new TestCase( SECTION, "myfunc1.prototype.toString()", "[object Object]", myfunc1.prototype.toString() );
+
+ array[item++] = new TestCase( SECTION, "myfunc1.prototype.constructor", myfunc1, myfunc1.prototype.constructor );
+ array[item++] = new TestCase( SECTION, "myfunc1.arguments", null, myfunc1.arguments );
+ array[item++] = new TestCase( SECTION, "myfunc1(1,2,3)", 6, myfunc1(1,2,3) );
+ array[item++] = new TestCase( SECTION, "var MYPROPS = ''; for ( var p in myfunc1.prototype ) { MYPROPS += p; }; MYPROPS",
+ "",
+ eval("var MYPROPS = ''; for ( var p in myfunc1.prototype ) { MYPROPS += p; }; MYPROPS") );
+
+ array[item++] = new TestCase( SECTION, "myfunc2 = Function('a','b','c'); myfunc.toString = Object.prototype.toString; myfunc.toString()",
+ "[object Function]",
+ myfunc2.toString() );
+ array[item++] = new TestCase( SECTION, "myfunc2.__proto__", Function.prototype, myfunc2.__proto__ );
+ array[item++] = new TestCase( SECTION, "myfunc2.length", 3, myfunc2.length );
+ array[item++] = new TestCase( SECTION, "myfunc2.prototype.toString()", "[object Object]", myfunc2.prototype.toString() );
+
+ array[item++] = new TestCase( SECTION, "myfunc2.prototype.constructor", myfunc2, myfunc2.prototype.constructor );
+ array[item++] = new TestCase( SECTION, "myfunc2.arguments", null, myfunc2.arguments );
+ array[item++] = new TestCase( SECTION, "myfunc2( 1000, 200, 30 )", 1230, myfunc2(1000,200,30) );
+ array[item++] = new TestCase( SECTION, "var MYPROPS = ''; for ( var p in myfunc2.prototype ) { MYPROPS += p; }; MYPROPS",
+ "",
+ eval("var MYPROPS = ''; for ( var p in myfunc2.prototype ) { MYPROPS += p; }; MYPROPS") );
+
+ array[item++] = new TestCase( SECTION, "myfunc3 = Function('a','b','c'); myfunc.toString = Object.prototype.toString; myfunc.toString()",
+ "[object Function]",
+ myfunc3.toString() );
+ array[item++] = new TestCase( SECTION, "myfunc3.__proto__", Function.prototype, myfunc3.__proto__ );
+ array[item++] = new TestCase( SECTION, "myfunc3.length", 3, myfunc3.length );
+ array[item++] = new TestCase( SECTION, "myfunc3.prototype.toString()", "[object Object]", myfunc3.prototype.toString() );
+ array[item++] = new TestCase( SECTION, "myfunc3.prototype.valueOf() +''", "[object Object]", myfunc3.prototype.valueOf() +'' );
+ array[item++] = new TestCase( SECTION, "myfunc3.prototype.constructor", myfunc3, myfunc3.prototype.constructor );
+ array[item++] = new TestCase( SECTION, "myfunc3.arguments", null, myfunc3.arguments );
+ array[item++] = new TestCase( SECTION, "myfunc3(-100,100,NaN)", Number.NaN, myfunc3(-100,100,NaN) );
+
+ array[item++] = new TestCase( SECTION, "var MYPROPS = ''; for ( var p in myfunc3.prototype ) { MYPROPS += p; }; MYPROPS",
+ "",
+ eval("var MYPROPS = ''; for ( var p in myfunc3.prototype ) { MYPROPS += p; }; MYPROPS") );
+
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.1.1-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.1.1-3.js
new file mode 100644
index 0000000..459a6bf
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.1.1-3.js
@@ -0,0 +1,96 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.3.1.1-3.js
+ ECMA Section: 15.3.1.1 The Function Constructor Called as a Function
+
+ new Function(p1, p2, ..., pn, body )
+
+ Description: The last argument specifies the body (executable code)
+ of a function; any preceeding arguments sepcify formal
+ parameters.
+
+ See the text for description of this section.
+
+ This test examples from the specification.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+ var SECTION = "15.3.1.1-3";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "The Function Constructor Called as a Function";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+
+ var testcases = new Array();
+
+ var args = "";
+
+ for ( var i = 0; i < 2000; i++ ) {
+ args += "arg"+i;
+ if ( i != 1999 ) {
+ args += ",";
+ }
+ }
+
+ var s = "";
+
+ for ( var i = 0; i < 2000; i++ ) {
+ s += ".0005";
+ if ( i != 1999 ) {
+ s += ",";
+ }
+ }
+
+ MyFunc = Function( args, "var r=0; for (var i = 0; i < MyFunc.length; i++ ) { if ( eval('arg'+i) == void 0) break; else r += eval('arg'+i); }; return r");
+ MyObject = Function( args, "for (var i = 0; i < MyFunc.length; i++ ) { if ( eval('arg'+i) == void 0) break; eval('this.arg'+i +'=arg'+i); };");
+
+ var MY_OB = eval( "MyFunc("+ s +")" );
+
+ testcases[testcases.length] = new TestCase( SECTION, "MyFunc.length", 2000, MyFunc.length );
+ testcases[testcases.length] = new TestCase( SECTION, "var MY_OB = eval('MyFunc(s)')", 1, MY_OB );
+ testcases[testcases.length] = new TestCase( SECTION, "var MY_OB = eval('MyFunc(s)')", 1, eval("var MY_OB = MyFunc("+s+"); MY_OB") );
+
+ testcases[testcases.length] = new TestCase( SECTION, "MyObject.length", 2000, MyObject.length );
+
+ testcases[testcases.length] = new TestCase( SECTION, "FUN1 = Function( 'a','b','c', 'return FUN1.length' ); FUN1.length", 3, eval("FUN1 = Function( 'a','b','c', 'return FUN1.length' ); FUN1.length") );
+ testcases[testcases.length] = new TestCase( SECTION, "FUN1 = Function( 'a','b','c', 'return FUN1.length' ); FUN1()", 3, eval("FUN1 = Function( 'a','b','c', 'return FUN1.length' ); FUN1()") );
+ testcases[testcases.length] = new TestCase( SECTION, "FUN1 = Function( 'a','b','c', 'return FUN1.length' ); FUN1(1,2,3,4,5)", 3, eval("FUN1 = Function( 'a','b','c', 'return FUN1.length' ); FUN1(1,2,3,4,5)") );
+
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.2.1-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.2.1-1.js
new file mode 100644
index 0000000..ec1b86b
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.2.1-1.js
@@ -0,0 +1,94 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.3.2.1.js
+ ECMA Section: 15.3.2.1 The Function Constructor
+ new Function(p1, p2, ..., pn, body )
+
+ Description: The last argument specifies the body (executable code)
+ of a function; any preceeding arguments sepcify formal
+ parameters.
+
+ See the text for description of this section.
+
+ This test examples from the specification.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+ var SECTION = "15.3.2.1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "The Function Constructor";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var MyObject = new Function( "value", "this.value = value; this.valueOf = new Function( 'return this.value' ); this.toString = new Function( 'return String(this.value);' )" );
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ var myfunc = new Function();
+
+// not going to test toString here since it is implementation dependent.
+// array[item++] = new TestCase( SECTION, "myfunc.toString()", "function anonymous() { }", myfunc.toString() );
+
+ myfunc.toString = Object.prototype.toString;
+
+ array[item++] = new TestCase( SECTION, "myfunc = new Function(); myfunc.toString = Object.prototype.toString; myfunc.toString()",
+ "[object Function]",
+ myfunc.toString() );
+ array[item++] = new TestCase( SECTION, "myfunc.length", 0, myfunc.length );
+ array[item++] = new TestCase( SECTION, "myfunc.prototype.toString()", "[object Object]", myfunc.prototype.toString() );
+
+ array[item++] = new TestCase( SECTION, "myfunc.prototype.constructor", myfunc, myfunc.prototype.constructor );
+ array[item++] = new TestCase( SECTION, "myfunc.arguments", null, myfunc.arguments );
+
+ array[item++] = new TestCase( SECTION, "var OBJ = new MyObject(true); OBJ.valueOf()", true, eval("var OBJ = new MyObject(true); OBJ.valueOf()") );
+ array[item++] = new TestCase( SECTION, "OBJ.toString()", "true", OBJ.toString() );
+ array[item++] = new TestCase( SECTION, "OBJ.toString = Object.prototype.toString; OBJ.toString()", "[object Object]", eval("OBJ.toString = Object.prototype.toString; OBJ.toString()") );
+ array[item++] = new TestCase( SECTION, "MyObject.toString = Object.prototype.toString; MyObject.toString()", "[object Function]", eval("MyObject.toString = Object.prototype.toString; MyObject.toString()") );
+
+ array[item++] = new TestCase( SECTION, "MyObject.__proto__ == Function.prototype", true, MyObject.__proto__ == Function.prototype );
+ array[item++] = new TestCase( SECTION, "MyObject.length", 1, MyObject.length );
+ array[item++] = new TestCase( SECTION, "MyObject.prototype.constructor", MyObject, MyObject.prototype.constructor );
+ array[item++] = new TestCase( SECTION, "MyObject.arguments", null, MyObject.arguments );
+
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.2.1-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.2.1-2.js
new file mode 100644
index 0000000..b8f403c
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.2.1-2.js
@@ -0,0 +1,111 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.3.2.1.js
+ ECMA Section: 15.3.2.1 The Function Constructor
+ new Function(p1, p2, ..., pn, body )
+
+ Description:
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+ var SECTION = "15.3.2.1-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "The Function Constructor";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ var myfunc1 = new Function("a","b","c", "return a+b+c" );
+ var myfunc2 = new Function("a, b, c", "return a+b+c" );
+ var myfunc3 = new Function("a,b", "c", "return a+b+c" );
+
+ myfunc1.toString = Object.prototype.toString;
+ myfunc2.toString = Object.prototype.toString;
+ myfunc3.toString = Object.prototype.toString;
+
+ array[item++] = new TestCase( SECTION, "myfunc1 = new Function('a','b','c'); myfunc.toString = Object.prototype.toString; myfunc.toString()",
+ "[object Function]",
+ myfunc1.toString() );
+
+ array[item++] = new TestCase( SECTION, "myfunc1.length", 3, myfunc1.length );
+ array[item++] = new TestCase( SECTION, "myfunc1.prototype.toString()", "[object Object]", myfunc1.prototype.toString() );
+
+ array[item++] = new TestCase( SECTION, "myfunc1.prototype.constructor", myfunc1, myfunc1.prototype.constructor );
+ array[item++] = new TestCase( SECTION, "myfunc1.arguments", null, myfunc1.arguments );
+ array[item++] = new TestCase( SECTION, "myfunc1(1,2,3)", 6, myfunc1(1,2,3) );
+ array[item++] = new TestCase( SECTION, "var MYPROPS = ''; for ( var p in myfunc1.prototype ) { MYPROPS += p; }; MYPROPS",
+ "",
+ eval("var MYPROPS = ''; for ( var p in myfunc1.prototype ) { MYPROPS += p; }; MYPROPS") );
+
+ array[item++] = new TestCase( SECTION, "myfunc2 = new Function('a','b','c'); myfunc.toString = Object.prototype.toString; myfunc.toString()",
+ "[object Function]",
+ myfunc2.toString() );
+ array[item++] = new TestCase( SECTION, "myfunc2.__proto__", Function.prototype, myfunc2.__proto__ );
+ array[item++] = new TestCase( SECTION, "myfunc2.length", 3, myfunc2.length );
+ array[item++] = new TestCase( SECTION, "myfunc2.prototype.toString()", "[object Object]", myfunc2.prototype.toString() );
+
+ array[item++] = new TestCase( SECTION, "myfunc2.prototype.constructor", myfunc2, myfunc2.prototype.constructor );
+ array[item++] = new TestCase( SECTION, "myfunc2.arguments", null, myfunc2.arguments );
+ array[item++] = new TestCase( SECTION, "myfunc2( 1000, 200, 30 )", 1230, myfunc2(1000,200,30) );
+ array[item++] = new TestCase( SECTION, "var MYPROPS = ''; for ( var p in myfunc2.prototype ) { MYPROPS += p; }; MYPROPS",
+ "",
+ eval("var MYPROPS = ''; for ( var p in myfunc2.prototype ) { MYPROPS += p; }; MYPROPS") );
+
+ array[item++] = new TestCase( SECTION, "myfunc3 = new Function('a','b','c'); myfunc.toString = Object.prototype.toString; myfunc.toString()",
+ "[object Function]",
+ myfunc3.toString() );
+ array[item++] = new TestCase( SECTION, "myfunc3.__proto__", Function.prototype, myfunc3.__proto__ );
+ array[item++] = new TestCase( SECTION, "myfunc3.length", 3, myfunc3.length );
+ array[item++] = new TestCase( SECTION, "myfunc3.prototype.toString()", "[object Object]", myfunc3.prototype.toString() );
+ array[item++] = new TestCase( SECTION, "myfunc3.prototype.valueOf() +''", "[object Object]", myfunc3.prototype.valueOf() +'' );
+ array[item++] = new TestCase( SECTION, "myfunc3.prototype.constructor", myfunc3, myfunc3.prototype.constructor );
+ array[item++] = new TestCase( SECTION, "myfunc3.arguments", null, myfunc3.arguments );
+ array[item++] = new TestCase( SECTION, "myfunc3(-100,100,NaN)", Number.NaN, myfunc3(-100,100,NaN) );
+
+ array[item++] = new TestCase( SECTION, "var MYPROPS = ''; for ( var p in myfunc3.prototype ) { MYPROPS += p; }; MYPROPS",
+ "",
+ eval("var MYPROPS = ''; for ( var p in myfunc3.prototype ) { MYPROPS += p; }; MYPROPS") );
+
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.2.1-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.2.1-3.js
new file mode 100644
index 0000000..76c5e2f
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.2.1-3.js
@@ -0,0 +1,96 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.3.2.1-3.js
+ ECMA Section: 15.3.2.1 The Function Constructor
+ new Function(p1, p2, ..., pn, body )
+
+ Description: The last argument specifies the body (executable code)
+ of a function; any preceeding arguments sepcify formal
+ parameters.
+
+ See the text for description of this section.
+
+ This test examples from the specification.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+ var SECTION = "15.3.2.1-3";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "The Function Constructor";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ var args = "";
+
+ for ( var i = 0; i < 2000; i++ ) {
+ args += "arg"+i;
+ if ( i != 1999 ) {
+ args += ",";
+ }
+ }
+
+ var s = "";
+
+ for ( var i = 0; i < 2000; i++ ) {
+ s += ".0005";
+ if ( i != 1999 ) {
+ s += ",";
+ }
+ }
+
+ MyFunc = new Function( args, "var r=0; for (var i = 0; i < MyFunc.length; i++ ) { if ( eval('arg'+i) == void 0) break; else r += eval('arg'+i); }; return r");
+ MyObject = new Function( args, "for (var i = 0; i < MyFunc.length; i++ ) { if ( eval('arg'+i) == void 0) break; eval('this.arg'+i +'=arg'+i); };");
+
+ array[item++] = new TestCase( SECTION, "MyFunc.length", 2000, MyFunc.length );
+ array[item++] = new TestCase( SECTION, "var MY_OB = eval('MyFunc(s)')", 1, eval("var MY_OB = MyFunc("+s+"); MY_OB") );
+
+ array[item++] = new TestCase( SECTION, "MyObject.length", 2000, MyObject.length );
+
+ array[item++] = new TestCase( SECTION, "FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1.length", 3, eval("FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1.length") );
+ array[item++] = new TestCase( SECTION, "FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1()", 3, eval("FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1()") );
+ array[item++] = new TestCase( SECTION, "FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1(1,2,3,4,5)", 3, eval("FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1(1,2,3,4,5)") );
+
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.3.1-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.3.1-1.js
new file mode 100644
index 0000000..4442e27
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.3.1-1.js
@@ -0,0 +1,62 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.3.3.1-1.js
+ ECMA Section: 15.3.3.1 Properties of the Function Constructor
+ Function.prototype
+
+ Description: The initial value of Function.prototype is the built-in
+ Function prototype object.
+
+ This property shall have the attributes [DontEnum |
+ DontDelete | ReadOnly]
+
+ This test the value of Function.prototype.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+ var SECTION = "15.3.3.1-1";
+ var VERSION = "ECMA_2";
+ startTest();
+ var TITLE = "Function.prototype";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+ testcases[tc++] = new TestCase( SECTION, "Function.prototype == Function.proto", true, Function.__proto__ == Function.prototype );
+
+ test();
+
+function test() {
+ for (tc=0 ; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.3.1-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.3.1-2.js
new file mode 100644
index 0000000..e39abbf
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.3.1-2.js
@@ -0,0 +1,70 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.3.3.1-2.js
+ ECMA Section: 15.3.3.1 Properties of the Function Constructor
+ Function.prototype
+
+ Description: The initial value of Function.prototype is the built-in
+ Function prototype object.
+
+ This property shall have the attributes [DontEnum |
+ DontDelete | ReadOnly]
+
+ This test the DontEnum property of Function.prototype.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+ var SECTION = "15.3.3.1-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Function.prototype";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION,
+ "var str='';for (prop in Function ) str += prop; str;",
+ "",
+ eval("var str='';for (prop in Function) str += prop; str;")
+ );
+ return ( array );
+}
+function test( array ) {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.3.1-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.3.1-3.js
new file mode 100644
index 0000000..b95752c
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.3.1-3.js
@@ -0,0 +1,79 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.3.3.1-3.js
+ ECMA Section: 15.3.3.1 Properties of the Function Constructor
+ Function.prototype
+
+ Description: The initial value of Function.prototype is the built-in
+ Function prototype object.
+
+ This property shall have the attributes [DontEnum |
+ DontDelete | ReadOnly]
+
+ This test the DontDelete property of Function.prototype.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+ var SECTION = "15.3.3.1-3";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Function.prototype";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ var FUN_PROTO = Function.prototype;
+
+ array[item++] = new TestCase( SECTION,
+ "delete Function.prototype",
+ false,
+ delete Function.prototype
+ );
+
+ array[item++] = new TestCase( SECTION,
+ "delete Function.prototype; Function.prototype",
+ FUN_PROTO,
+ eval("delete Function.prototype; Function.prototype")
+ );
+ return ( array );
+}
+function test( array ) {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.3.1-4.js b/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.3.1-4.js
new file mode 100644
index 0000000..5b4e811
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.3.1-4.js
@@ -0,0 +1,70 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.3.3.1-4.js
+ ECMA Section: 15.3.3.1 Properties of the Function Constructor
+ Function.prototype
+
+ Description: The initial value of Function.prototype is the built-in
+ Function prototype object.
+
+ This property shall have the attributes [DontEnum |
+ DontDelete | ReadOnly]
+
+ This test the ReadOnly property of Function.prototype.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+ var SECTION = "15.3.3.1-4";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Function.prototype";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION,
+ "Function.prototype = null; Function.prototype",
+ Function.prototype,
+ eval("Function.prototype = null; Function.prototype")
+ );
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.3.2.js b/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.3.2.js
new file mode 100644
index 0000000..821f93e
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.3.2.js
@@ -0,0 +1,60 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.3.3.2.js
+ ECMA Section: 15.3.3.2 Properties of the Function Constructor
+ Function.length
+
+ Description: The length property is 1.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+
+ var SECTION = "15.3.3.2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Function.length";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION, "Function.length", 1, Function.length );
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.4-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.4-1.js
new file mode 100644
index 0000000..d919d41
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.4-1.js
@@ -0,0 +1,80 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.3.4-1.js
+ ECMA Section: 15.3.4 Properties of the Function Prototype Object
+
+ Description: The Function prototype object is itself a Function
+ object ( its [[Class]] is "Function") that, when
+ invoked, accepts any arguments and returns undefined.
+
+ The value of the internal [[Prototype]] property
+ object is the Object prototype object.
+
+ It is a function with an "empty body"; if it is
+ invoked, it merely returns undefined.
+
+ The Function prototype object does not have a valueOf
+ property of its own; however it inherits the valueOf
+ property from the Object prototype Object.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+
+ var SECTION = "15.3.4-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Properties of the Function Prototype Object";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION,
+ "var myfunc = Function.prototype; myfunc.toString = Object.prototype.toString; myfunc.toString()",
+ "[object Function]",
+ eval("var myfunc = Function.prototype; myfunc.toString = Object.prototype.toString; myfunc.toString()"));
+
+
+// array[item++] = new TestCase( SECTION, "Function.prototype.__proto__", Object.prototype, Function.prototype.__proto__ );
+ array[item++] = new TestCase( SECTION, "Function.prototype.valueOf", Object.prototype.valueOf, Function.prototype.valueOf );
+ array[item++] = new TestCase( SECTION, "Function.prototype()", (void 0), Function.prototype() );
+ array[item++] = new TestCase( SECTION, "Function.prototype(1,true,false,'string', new Date(),null)", (void 0), Function.prototype(1,true,false,'string', new Date(),null) );
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.4.1.js b/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.4.1.js
new file mode 100644
index 0000000..ce75a14
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.4.1.js
@@ -0,0 +1,62 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.3.4.1.js
+ ECMA Section: 15.3.4.1 Function.prototype.constructor
+
+ Description: The initial value of Function.prototype.constructor
+ is the built-in Function constructor.
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+
+ var SECTION = "15.3.4.1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Function.prototype.constructor";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "Function.prototype.constructor", Function, Function.prototype.constructor );
+
+ return ( array );
+}
+function test( array ) {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.4.js b/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.4.js
new file mode 100644
index 0000000..df519d2
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.4.js
@@ -0,0 +1,79 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.3.4.js
+ ECMA Section: 15.3.4 Properties of the Function Prototype Object
+
+ Description: The Function prototype object is itself a Function
+ object ( its [[Class]] is "Function") that, when
+ invoked, accepts any arguments and returns undefined.
+
+ The value of the internal [[Prototype]] property
+ object is the Object prototype object.
+
+ It is a function with an "empty body"; if it is
+ invoked, it merely returns undefined.
+
+ The Function prototype object does not have a valueOf
+ property of its own; however it inherits the valueOf
+ property from the Object prototype Object.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+ var SECTION = "15.3.4";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Properties of the Function Prototype Object";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION,
+ "var myfunc = Function.prototype; myfunc.toString = Object.prototype.toString; myfunc.toString()",
+ "[object Function]",
+ eval("var myfunc = Function.prototype; myfunc.toString = Object.prototype.toString; myfunc.toString()"));
+
+
+// array[item++] = new TestCase( SECTION, "Function.prototype.__proto__", Object.prototype, Function.prototype.__proto__ );
+ array[item++] = new TestCase( SECTION, "Function.prototype.valueOf", Object.prototype.valueOf, Function.prototype.valueOf );
+ array[item++] = new TestCase( SECTION, "Function.prototype()", (void 0), Function.prototype() );
+ array[item++] = new TestCase( SECTION, "Function.prototype(1,true,false,'string', new Date(),null)", (void 0), Function.prototype(1,true,false,'string', new Date(),null) );
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.5-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.5-1.js
new file mode 100644
index 0000000..1e63370
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.5-1.js
@@ -0,0 +1,118 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.3.5-1.js
+ ECMA Section: 15.3.5 Properties of Function Instances
+ new Function(p1, p2, ..., pn, body )
+
+ Description:
+
+ 15.3.5.1 length
+
+ The value of the length property is usually an integer that indicates
+ the "typical" number of arguments expected by the function. However,
+ the language permits the function to be invoked with some other number
+ of arguments. The behavior of a function when invoked on a number of
+ arguments other than the number specified by its length property depends
+ on the function.
+
+ 15.3.5.2 prototype
+ The value of the prototype property is used to initialize the internal [[
+ Prototype]] property of a newly created object before the Function object
+ is invoked as a constructor for that newly created object.
+
+ 15.3.5.3 arguments
+
+ The value of the arguments property is normally null if there is no
+ outstanding invocation of the function in progress (that is, the function has been called
+ but has not yet returned). When a non-internal Function object (15.3.2.1) is invoked, its
+ arguments property is "dynamically bound" to a newly created object that contains the
+ arguments on which it was invoked (see 10.1.6 and 10.1.8). Note that the use of this
+ property is discouraged; it is provided principally for compatibility with existing old code.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+
+ var SECTION = "15.3.5-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Properties of Function Instances";
+
+ writeHeaderToLog( SECTION + " "+TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ var args = "";
+
+ for ( var i = 0; i < 2000; i++ ) {
+ args += "arg"+i;
+ if ( i != 1999 ) {
+ args += ",";
+ }
+ }
+
+ var s = "";
+
+ for ( var i = 0; i < 2000; i++ ) {
+ s += ".0005";
+ if ( i != 1999 ) {
+ s += ",";
+ }
+ }
+
+ MyFunc = new Function( args, "var r=0; for (var i = 0; i < MyFunc.length; i++ ) { if ( eval('arg'+i) == void 0) break; else r += eval('arg'+i); }; return r");
+ MyObject = new Function( args, "for (var i = 0; i < MyFunc.length; i++ ) { if ( eval('arg'+i) == void 0) break; eval('this.arg'+i +'=arg'+i); };");
+
+
+ array[item++] = new TestCase( SECTION, "MyFunc.length", 2000, MyFunc.length );
+ array[item++] = new TestCase( SECTION, "var MY_OB = eval('MyFunc(s)')", 1, eval("var MY_OB = MyFunc("+s+"); MY_OB") );
+ array[item++] = new TestCase( SECTION, "MyFunc.prototype.toString()", "[object Object]", MyFunc.prototype.toString() );
+ array[item++] = new TestCase( SECTION, "typeof MyFunc.prototype", "object", typeof MyFunc.prototype );
+
+
+ array[item++] = new TestCase( SECTION, "MyObject.length", 2000, MyObject.length );
+
+ array[item++] = new TestCase( SECTION, "FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1.length", 3, eval("FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1.length") );
+ array[item++] = new TestCase( SECTION, "FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1()", 3, eval("FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1()") );
+ array[item++] = new TestCase( SECTION, "FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1(1,2,3,4,5)", 3, eval("FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1(1,2,3,4,5)") );
+
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.5-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.5-2.js
new file mode 100644
index 0000000..fe24e32
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.5-2.js
@@ -0,0 +1,92 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.3.5-1.js
+ ECMA Section: 15.3.5 Properties of Function Instances
+ new Function(p1, p2, ..., pn, body )
+
+ Description:
+
+ 15.3.5.1 length
+
+ The value of the length property is usually an integer that indicates
+ the "typical" number of arguments expected by the function. However,
+ the language permits the function to be invoked with some other number
+ of arguments. The behavior of a function when invoked on a number of
+ arguments other than the number specified by its length property depends
+ on the function.
+
+ 15.3.5.2 prototype
+ The value of the prototype property is used to initialize the internal [[
+ Prototype]] property of a newly created object before the Function object
+ is invoked as a constructor for that newly created object.
+
+ 15.3.5.3 arguments
+
+ The value of the arguments property is normally null if there is no
+ outstanding invocation of the function in progress (that is, the function has been called
+ but has not yet returned). When a non-internal Function object (15.3.2.1) is invoked, its
+ arguments property is "dynamically bound" to a newly created object that contains the
+ arguments on which it was invoked (see 10.1.6 and 10.1.8). Note that the use of this
+ property is discouraged; it is provided principally for compatibility with existing old code.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+
+ var SECTION = "15.3.5-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Properties of Function Instances";
+
+ writeHeaderToLog( SECTION + " "+TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ var MyObject = new Function( 'a', 'b', 'c', 'this.a = a; this.b = b; this.c = c; this.value = a+b+c; this.valueOf = new Function( "return this.value" )' );
+
+ array[item++] = new TestCase( SECTION, "MyObject.length", 3, MyObject.length );
+ array[item++] = new TestCase( SECTION, "typeof MyObject.prototype", "object", typeof MyObject.prototype );
+ array[item++] = new TestCase( SECTION, "typeof MyObject.prototype.constructor", "function", typeof MyObject.prototype.constructor );
+ array[item++] = new TestCase( SECTION, "MyObject.arguments", null, MyObject.arguments );
+
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.5.1.js b/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.5.1.js
new file mode 100644
index 0000000..3da3b0e
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.5.1.js
@@ -0,0 +1,80 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.3.5.1.js
+ ECMA Section: Function.length
+ Description:
+
+ The value of the length property is usually an integer that indicates the
+ "typical" number of arguments expected by the function. However, the
+ language permits the function to be invoked with some other number of
+ arguments. The behavior of a function when invoked on a number of arguments
+ other than the number specified by its length property depends on the function.
+
+ this test needs a 1.2 version check.
+
+ http://scopus.mcom.com/bugsplat/show_bug.cgi?id=104204
+
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.3.5.1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Function.length";
+ var BUGNUMBER="104204";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var f = new Function( "a","b", "c", "return f.length");
+
+ testcases[tc++] = new TestCase( SECTION,
+ 'var f = new Function( "a","b", "c", "return f.length"); f()',
+ 3,
+ f() );
+
+
+ testcases[tc++] = new TestCase( SECTION,
+ 'var f = new Function( "a","b", "c", "return f.length"); f(1,2,3,4,5)',
+ 3,
+ f(1,2,3,4,5) );
+
+
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.5.3.js b/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.5.3.js
new file mode 100644
index 0000000..eaf6dbe
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/FunctionObjects/15.3.5.3.js
@@ -0,0 +1,75 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.3.5.3.js
+ ECMA Section: Function.arguments
+ Description:
+
+ The value of the arguments property is normally null if there is no
+ outstanding invocation of the function in progress (that is, the
+ function has been called but has not yet returned). When a non-internal
+ Function object (15.3.2.1) is invoked, its arguments property is
+ "dynamically bound" to a newly created object that contains the arguments
+ on which it was invoked (see 10.1.6 and 10.1.8). Note that the use of this
+ property is discouraged; it is provided principally for compatibility
+ with existing old code.
+
+ See sections 10.1.6 and 10.1.8 for more extensive tests.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.3.5.3";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Function.arguments";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array =new Array();
+ var item = 0;
+
+ var MYFUNCTION = new Function( "return this.arguments" );
+
+
+ array[item++] = new TestCase( SECTION, "var MYFUNCTION = new Function( 'return this.arguments' ); MYFUNCTION.arguments", null, MYFUNCTION.arguments );
+
+ return array;
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1-1-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1-1-n.js
new file mode 100644
index 0000000..906b0b4
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1-1-n.js
@@ -0,0 +1,65 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.1-1-n.js
+ ECMA Section: The global object
+ Description:
+
+ The global object does not have a [[Construct]] property; it is not
+ possible to use the global object as a constructor with the new operator.
+
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.1-1-n";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "The Global Object";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ testcases[tc] = new TestCase( SECTION,
+ "var MY_GLOBAL = new this()",
+ "error",
+ "var MY_GLOBAL = new this()" );
+
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval(testcases[tc].actual);
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1-2-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1-2-n.js
new file mode 100644
index 0000000..327c685
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1-2-n.js
@@ -0,0 +1,63 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.1-2-n.js
+ ECMA Section: The global object
+ Description:
+
+ The global object does not have a [[Call]] property; it is not possible
+ to invoke the global object as a function.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.1-2-n";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "The Global Object";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ testcases[tc] = new TestCase( SECTION,
+ "var MY_GLOBAL = this()",
+ "error",
+ "var MY_GLOBAL = this()" );
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval(testcases[tc].actual);
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.1.1.js b/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.1.1.js
new file mode 100644
index 0000000..4310a51
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.1.1.js
@@ -0,0 +1,65 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.1.1.1.js
+ ECMA Section: 15.1.1.1 NaN
+
+ Description: The initial value of NaN is NaN.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+ var SECTION = "15.1.1.1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "NaN";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[array.length] = new TestCase( SECTION, "NaN", Number.NaN, NaN );
+ array[array.length] = new TestCase( SECTION, "this.NaN", Number.NaN, this.NaN );
+ array[array.length] = new TestCase( SECTION, "typeof NaN", "number", typeof NaN );
+
+ return ( array );
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.1.2.js b/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.1.2.js
new file mode 100644
index 0000000..35324d6
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.1.2.js
@@ -0,0 +1,66 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.1.1.2.js
+ ECMA Section: 15.1.1.2 Infinity
+
+ Description: The initial value of Infinity is +Infinity.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+ var SECTION = "15.1.1.2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Infinity";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "Infinity", Number.POSITIVE_INFINITY, Infinity );
+ array[item++] = new TestCase( SECTION, "this.Infinity", Number.POSITIVE_INFINITY, this.Infinity );
+ array[item++] = new TestCase( SECTION, "typeof Infinity", "number", typeof Infinity );
+
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+
+ }
+
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.1-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.1-1.js
new file mode 100644
index 0000000..d4f38a7
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.1-1.js
@@ -0,0 +1,91 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.1.2.1-1.js
+ ECMA Section: 15.1.2.1 eval(x)
+
+ if x is not a string object, return x.
+ Description:
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+ var SECTION = "15.1.2.1-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "eval(x)";
+
+ var BUGNUMBER = "111199";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "eval.length", 1, eval.length );
+ array[item++] = new TestCase( SECTION, "delete eval.length", false, delete eval.length );
+ array[item++] = new TestCase( SECTION, "var PROPS = ''; for ( p in eval ) { PROPS += p }; PROPS", "", eval("var PROPS = ''; for ( p in eval ) { PROPS += p }; PROPS") );
+ array[item++] = new TestCase( SECTION, "eval.length = null; eval.length", 1, eval( "eval.length = null; eval.length") );
+// array[item++] = new TestCase( SECTION, "eval.__proto__", Function.prototype, eval.__proto__ );
+
+ // test cases where argument is not a string. should return the argument.
+
+ array[item++] = new TestCase( SECTION, "eval()", void 0, eval() );
+ array[item++] = new TestCase( SECTION, "eval(void 0)", void 0, eval( void 0) );
+ array[item++] = new TestCase( SECTION, "eval(null)", null, eval( null ) );
+ array[item++] = new TestCase( SECTION, "eval(true)", true, eval( true ) );
+ array[item++] = new TestCase( SECTION, "eval(false)", false, eval( false ) );
+
+ array[item++] = new TestCase( SECTION, "typeof eval(new String('Infinity/-0')", "object", typeof eval(new String('Infinity/-0')) );
+
+ array[item++] = new TestCase( SECTION, "eval([1,2,3,4,5,6])", "1,2,3,4,5,6", ""+eval([1,2,3,4,5,6]) );
+ array[item++] = new TestCase( SECTION, "eval(new Array(0,1,2,3)", "1,2,3", ""+ eval(new Array(1,2,3)) );
+ array[item++] = new TestCase( SECTION, "eval(1)", 1, eval(1) );
+ array[item++] = new TestCase( SECTION, "eval(0)", 0, eval(0) );
+ array[item++] = new TestCase( SECTION, "eval(-1)", -1, eval(-1) );
+ array[item++] = new TestCase( SECTION, "eval(Number.NaN)", Number.NaN, eval(Number.NaN) );
+ array[item++] = new TestCase( SECTION, "eval(Number.MIN_VALUE)", 5e-308, eval(Number.MIN_VALUE) );
+ array[item++] = new TestCase( SECTION, "eval(-Number.MIN_VALUE)", -5e-308, eval(-Number.MIN_VALUE) );
+ array[item++] = new TestCase( SECTION, "eval(Number.POSITIVE_INFINITY)", Number.POSITIVE_INFINITY, eval(Number.POSITIVE_INFINITY) );
+ array[item++] = new TestCase( SECTION, "eval(Number.NEGATIVE_INFINITY)", Number.NEGATIVE_INFINITY, eval(Number.NEGATIVE_INFINITY) );
+ array[item++] = new TestCase( SECTION, "eval( 4294967296 )", 4294967296, eval(4294967296) );
+ array[item++] = new TestCase( SECTION, "eval( 2147483648 )", 2147483648, eval(2147483648) );
+
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.1-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.1-2.js
new file mode 100644
index 0000000..203cd4d
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.1-2.js
@@ -0,0 +1,66 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.1.2.1-2.js
+ ECMA Section: 15.1.2.1 eval(x)
+
+ Parse x as an ECMAScript Program. If the parse fails,
+ generate a runtime error. Evaluate the program. If
+ result is "Normal completion after value V", return
+ the value V. Else, return undefined.
+ Description:
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+ var SECTION = "15.1.2.1-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "eval(x)";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[0] = new TestCase( SECTION,
+ "d = new Date(0); with (d) { x = getUTCMonth() +'/'+ getUTCDate() +'/'+ getUTCFullYear(); } x",
+ "0/1/1970",
+ eval( "d = new Date(0); with (d) { x = getUTCMonth() +'/'+ getUTCDate() +'/'+ getUTCFullYear(); } x" )
+ );
+ return ( array );
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.2-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.2-1.js
new file mode 100644
index 0000000..422109d
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.2-1.js
@@ -0,0 +1,291 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.1.2.2-1.js
+ ECMA Section: 15.1.2.2 Function properties of the global object
+ parseInt( string, radix )
+
+ Description:
+
+ The parseInt function produces an integer value dictated by intepretation
+ of the contents of the string argument according to the specified radix.
+
+ When the parseInt function is called, the following steps are taken:
+
+ 1. Call ToString(string).
+ 2. Compute a substring of Result(1) consisting of the leftmost character
+ that is not a StrWhiteSpaceChar and all characters to the right of
+ that character. (In other words, remove leading whitespace.)
+ 3. Let sign be 1.
+ 4. If Result(2) is not empty and the first character of Result(2) is a
+ minus sign -, let sign be -1.
+ 5. If Result(2) is not empty and the first character of Result(2) is a
+ plus sign + or a minus sign -, then Result(5) is the substring of
+ Result(2) produced by removing the first character; otherwise, Result(5)
+ is Result(2).
+ 6. If the radix argument is not supplied, go to step 12.
+ 7. Call ToInt32(radix).
+ 8. If Result(7) is zero, go to step 12; otherwise, if Result(7) < 2 or
+ Result(7) > 36, return NaN.
+ 9. Let R be Result(7).
+ 10. If R = 16 and the length of Result(5) is at least 2 and the first two
+ characters of Result(5) are either "0x" or "0X", let S be the substring
+ of Result(5) consisting of all but the first two characters; otherwise,
+ let S be Result(5).
+ 11. Go to step 22.
+ 12. If Result(5) is empty or the first character of Result(5) is not 0,
+ go to step 20.
+ 13. If the length of Result(5) is at least 2 and the second character of
+ Result(5) is x or X, go to step 17.
+ 14. Let R be 8.
+ 15. Let S be Result(5).
+ 16. Go to step 22.
+ 17. Let R be 16.
+ 18. Let S be the substring of Result(5) consisting of all but the first
+ two characters.
+ 19. Go to step 22.
+ 20. Let R be 10.
+ 21. Let S be Result(5).
+ 22. If S contains any character that is not a radix-R digit, then let Z be
+ the substring of S consisting of all characters to the left of the
+ leftmost such character; otherwise, let Z be S.
+ 23. If Z is empty, return NaN.
+ 24. Compute the mathematical integer value that is represented by Z in
+ radix-R notation. (But if R is 10 and Z contains more than 20
+ significant digits, every digit after the 20th may be replaced by a 0
+ digit, at the option of the implementation; and if R is not 2, 4, 8,
+ 10, 16, or 32, then Result(24) may be an implementation-dependent
+ approximation to the mathematical integer value that is represented
+ by Z in radix-R notation.)
+ 25. Compute the number value for Result(24).
+ 26. Return sign Result(25).
+
+ Note that parseInt may interpret only a leading portion of the string as
+ an integer value; it ignores any characters that cannot be interpreted as
+ part of the notation of an integer, and no indication is given that any
+ such characters were ignored.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+ var SECTION = "15.1.2.2-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "parseInt(string, radix)";
+ var BUGNUMBER="111199";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ var HEX_STRING = "0x0";
+ var HEX_VALUE = 0;
+
+ array[item++] = new TestCase( SECTION, "parseInt.length", 2, parseInt.length );
+ array[item++] = new TestCase( SECTION, "parseInt.length = 0; parseInt.length", 2, eval("parseInt.length = 0; parseInt.length") );
+ array[item++] = new TestCase( SECTION, "var PROPS=''; for ( var p in parseInt ) { PROPS += p; }; PROPS", "", eval("var PROPS=''; for ( var p in parseInt ) { PROPS += p; }; PROPS") );
+ array[item++] = new TestCase( SECTION, "delete parseInt.length", false, delete parseInt.length );
+ array[item++] = new TestCase( SECTION, "delete parseInt.length; parseInt.length", 2, eval("delete parseInt.length; parseInt.length") );
+ array[item++] = new TestCase( SECTION, "parseInt.length = null; parseInt.length", 2, eval("parseInt.length = null; parseInt.length") );
+
+ array[item++] = new TestCase( SECTION, "parseInt()", NaN, parseInt() );
+ array[item++] = new TestCase( SECTION, "parseInt('')", NaN, parseInt("") );
+ array[item++] = new TestCase( SECTION, "parseInt('','')", NaN, parseInt("","") );
+ array[item++] = new TestCase( SECTION,
+ "parseInt(\" 0xabcdef ",
+ 11259375,
+ parseInt( " 0xabcdef " ));
+
+ array[item++] = new TestCase( SECTION,
+ "parseInt(\" 0XABCDEF ",
+ 11259375,
+ parseInt( " 0XABCDEF " ) );
+
+ array[item++] = new TestCase( SECTION,
+ "parseInt( 0xabcdef )",
+ 11259375,
+ parseInt( "0xabcdef") );
+
+ array[item++] = new TestCase( SECTION,
+ "parseInt( 0XABCDEF )",
+ 11259375,
+ parseInt( "0XABCDEF") );
+
+ for ( HEX_STRING = "0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) {
+ array[item++] = new TestCase( SECTION, "parseInt("+HEX_STRING+")", HEX_VALUE, parseInt(HEX_STRING) );
+ HEX_VALUE += Math.pow(16,POWER)*15;
+ }
+ for ( HEX_STRING = "0X0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) {
+ array[item++] = new TestCase( SECTION, "parseInt("+HEX_STRING+")", HEX_VALUE, parseInt(HEX_STRING) );
+ HEX_VALUE += Math.pow(16,POWER)*15;
+ }
+ for ( HEX_STRING = "0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) {
+ array[item++] = new TestCase( SECTION, "parseInt("+HEX_STRING+",16)", HEX_VALUE, parseInt(HEX_STRING,16) );
+ HEX_VALUE += Math.pow(16,POWER)*15;
+ }
+ for ( HEX_STRING = "0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) {
+ array[item++] = new TestCase( SECTION, "parseInt("+HEX_STRING+",16)", HEX_VALUE, parseInt(HEX_STRING,16) );
+ HEX_VALUE += Math.pow(16,POWER)*15;
+ }
+ for ( HEX_STRING = "0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) {
+ array[item++] = new TestCase( SECTION, "parseInt("+HEX_STRING+",null)", HEX_VALUE, parseInt(HEX_STRING,null) );
+ HEX_VALUE += Math.pow(16,POWER)*15;
+ }
+ for ( HEX_STRING = "0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) {
+ array[item++] = new TestCase( SECTION, "parseInt("+HEX_STRING+", void 0)", HEX_VALUE, parseInt(HEX_STRING, void 0) );
+ HEX_VALUE += Math.pow(16,POWER)*15;
+ }
+
+ // a few tests with spaces
+
+ for ( var space = " ", HEX_STRING = "0x0", HEX_VALUE = 0, POWER = 0;
+ POWER < 15;
+ POWER++, HEX_STRING = HEX_STRING +"f", space += " ")
+ {
+ array[item++] = new TestCase( SECTION, "parseInt("+space+HEX_STRING+space+", void 0)", HEX_VALUE, parseInt(space+HEX_STRING+space, void 0) );
+ HEX_VALUE += Math.pow(16,POWER)*15;
+ }
+
+ // a few tests with negative numbers
+ for ( HEX_STRING = "-0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) {
+ array[item++] = new TestCase( SECTION, "parseInt("+HEX_STRING+")", HEX_VALUE, parseInt(HEX_STRING) );
+ HEX_VALUE -= Math.pow(16,POWER)*15;
+ }
+
+ // we should stop parsing when we get to a value that is not a numeric literal for the type we expect
+
+ for ( HEX_STRING = "0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) {
+ array[item++] = new TestCase( SECTION, "parseInt("+HEX_STRING+"g,16)", HEX_VALUE, parseInt(HEX_STRING+"g",16) );
+ HEX_VALUE += Math.pow(16,POWER)*15;
+ }
+ for ( HEX_STRING = "0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) {
+ array[item++] = new TestCase( SECTION, "parseInt("+HEX_STRING+"g,16)", HEX_VALUE, parseInt(HEX_STRING+"G",16) );
+ HEX_VALUE += Math.pow(16,POWER)*15;
+ }
+
+ for ( HEX_STRING = "-0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) {
+ array[item++] = new TestCase( SECTION, "parseInt("+HEX_STRING+")", HEX_VALUE, parseInt(HEX_STRING) );
+ HEX_VALUE -= Math.pow(16,POWER)*15;
+ }
+ for ( HEX_STRING = "-0X0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) {
+ array[item++] = new TestCase( SECTION, "parseInt("+HEX_STRING+")", HEX_VALUE, parseInt(HEX_STRING) );
+ HEX_VALUE -= Math.pow(16,POWER)*15;
+ }
+ for ( HEX_STRING = "-0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) {
+ array[item++] = new TestCase( SECTION, "parseInt("+HEX_STRING+",16)", HEX_VALUE, parseInt(HEX_STRING,16) );
+ HEX_VALUE -= Math.pow(16,POWER)*15;
+ }
+ for ( HEX_STRING = "-0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) {
+ array[item++] = new TestCase( SECTION, "parseInt("+HEX_STRING+",16)", HEX_VALUE, parseInt(HEX_STRING,16) );
+ HEX_VALUE -= Math.pow(16,POWER)*15;
+ }
+
+ // let us do some octal tests. numbers that start with 0 and do not provid a radix should
+ // default to using "0" as a radix.
+
+ var OCT_STRING = "0";
+ var OCT_VALUE = 0;
+
+ for ( OCT_STRING = "0", OCT_VALUE = 0, POWER = 0; POWER < 15; POWER++, OCT_STRING = OCT_STRING +"7" ) {
+ array[item++] = new TestCase( SECTION, "parseInt("+OCT_STRING+")", OCT_VALUE, parseInt(OCT_STRING) );
+ OCT_VALUE += Math.pow(8,POWER)*7;
+ }
+
+ for ( OCT_STRING = "-0", OCT_VALUE = 0, POWER = 0; POWER < 15; POWER++, OCT_STRING = OCT_STRING +"7" ) {
+ array[item++] = new TestCase( SECTION, "parseInt("+OCT_STRING+")", OCT_VALUE, parseInt(OCT_STRING) );
+ OCT_VALUE -= Math.pow(8,POWER)*7;
+ }
+
+ // should get the same results as above if we provid the radix of 8 (or 010)
+
+ for ( OCT_STRING = "0", OCT_VALUE = 0, POWER = 0; POWER < 15; POWER++, OCT_STRING = OCT_STRING +"7" ) {
+ array[item++] = new TestCase( SECTION, "parseInt("+OCT_STRING+",8)", OCT_VALUE, parseInt(OCT_STRING,8) );
+ OCT_VALUE += Math.pow(8,POWER)*7;
+ }
+ for ( OCT_STRING = "-0", OCT_VALUE = 0, POWER = 0; POWER < 15; POWER++, OCT_STRING = OCT_STRING +"7" ) {
+ array[item++] = new TestCase( SECTION, "parseInt("+OCT_STRING+",010)", OCT_VALUE, parseInt(OCT_STRING,010) );
+ OCT_VALUE -= Math.pow(8,POWER)*7;
+ }
+
+ // we shall stop parsing digits when we get one that isn't a numeric literal of the type we think
+ // it should be.
+ for ( OCT_STRING = "0", OCT_VALUE = 0, POWER = 0; POWER < 15; POWER++, OCT_STRING = OCT_STRING +"7" ) {
+ array[item++] = new TestCase( SECTION, "parseInt("+OCT_STRING+"8,8)", OCT_VALUE, parseInt(OCT_STRING+"8",8) );
+ OCT_VALUE += Math.pow(8,POWER)*7;
+ }
+ for ( OCT_STRING = "-0", OCT_VALUE = 0, POWER = 0; POWER < 15; POWER++, OCT_STRING = OCT_STRING +"7" ) {
+ array[item++] = new TestCase( SECTION, "parseInt("+OCT_STRING+"8,010)", OCT_VALUE, parseInt(OCT_STRING+"8",010) );
+ OCT_VALUE -= Math.pow(8,POWER)*7;
+ }
+
+ array[item++] = new TestCase( SECTION, "parseInt( '0x' )", NaN, parseInt("0x") );
+ array[item++] = new TestCase( SECTION, "parseInt( '0X' )", NaN, parseInt("0X") );
+
+ array[item++] = new TestCase( SECTION, "parseInt( '11111111112222222222' )", 11111111112222222222, parseInt("11111111112222222222") );
+ array[item++] = new TestCase( SECTION, "parseInt( '111111111122222222223' )", 111111111122222222220, parseInt("111111111122222222223") );
+ array[item++] = new TestCase( SECTION, "parseInt( '11111111112222222222',10 )", 11111111112222222222, parseInt("11111111112222222222",10) );
+ array[item++] = new TestCase( SECTION, "parseInt( '111111111122222222223',10 )", 111111111122222222220, parseInt("111111111122222222223",10) );
+
+ array[item++] = new TestCase( SECTION, "parseInt( '01234567890', -1 )", Number.NaN, parseInt("01234567890",-1) );
+ array[item++] = new TestCase( SECTION, "parseInt( '01234567890', 0 )", Number.NaN, parseInt("01234567890",1) );
+ array[item++] = new TestCase( SECTION, "parseInt( '01234567890', 1 )", Number.NaN, parseInt("01234567890",1) );
+ array[item++] = new TestCase( SECTION, "parseInt( '01234567890', 2 )", 1, parseInt("01234567890",2) );
+ array[item++] = new TestCase( SECTION, "parseInt( '01234567890', 3 )", 5, parseInt("01234567890",3) );
+ array[item++] = new TestCase( SECTION, "parseInt( '01234567890', 4 )", 27, parseInt("01234567890",4) );
+ array[item++] = new TestCase( SECTION, "parseInt( '01234567890', 5 )", 194, parseInt("01234567890",5) );
+ array[item++] = new TestCase( SECTION, "parseInt( '01234567890', 6 )", 1865, parseInt("01234567890",6) );
+ array[item++] = new TestCase( SECTION, "parseInt( '01234567890', 7 )", 22875, parseInt("01234567890",7) );
+ array[item++] = new TestCase( SECTION, "parseInt( '01234567890', 8 )", 342391, parseInt("01234567890",8) );
+ array[item++] = new TestCase( SECTION, "parseInt( '01234567890', 9 )", 6053444, parseInt("01234567890",9) );
+ array[item++] = new TestCase( SECTION, "parseInt( '01234567890', 10 )", 1234567890, parseInt("01234567890",10) );
+
+ // need more test cases with hex radix
+
+ array[item++] = new TestCase( SECTION, "parseInt( '1234567890', '0xa')", 1234567890, parseInt("1234567890","0xa") );
+
+ array[item++] = new TestCase( SECTION, "parseInt( '012345', 11 )", 17715, parseInt("012345",11) );
+
+ array[item++] = new TestCase( SECTION, "parseInt( '012345', 35 )", 1590195, parseInt("012345",35) );
+ array[item++] = new TestCase( SECTION, "parseInt( '012345', 36 )", 1776965, parseInt("012345",36) );
+ array[item++] = new TestCase( SECTION, "parseInt( '012345', 37 )", Number.NaN, parseInt("012345",37) );
+
+ return ( array );
+}
+function test( array ) {
+ for ( tc=0 ; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.2-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.2-2.js
new file mode 100644
index 0000000..27d31be
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.2-2.js
@@ -0,0 +1,232 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.1.2.2-1.js
+ ECMA Section: 15.1.2.2 Function properties of the global object
+ parseInt( string, radix )
+
+ Description: parseInt test cases written by waldemar, and documented in
+ http://scopus.mcom.com/bugsplat/show_bug.cgi?id=123874.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+var SECTION = "15.1.2.2-2";
+var VERSION = "ECMA_1";
+ startTest();
+var TITLE = "parseInt(string, radix)";
+var BUGNUMBER="123874";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var testcases = new Array();
+
+testcases[tc++] = new TestCase( SECTION,
+ 'parseInt("000000100000000100100011010001010110011110001001101010111100",2)',
+ 9027215253084860,
+ parseInt("000000100000000100100011010001010110011110001001101010111100",2) );
+
+testcases[tc++] = new TestCase( SECTION,
+ 'parseInt("000000100000000100100011010001010110011110001001101010111101",2)',
+ 9027215253084860,
+ parseInt("000000100000000100100011010001010110011110001001101010111101",2));
+
+testcases[tc++] = new TestCase( SECTION,
+ 'parseInt("000000100000000100100011010001010110011110001001101010111111",2)',
+ 9027215253084864,
+ parseInt("000000100000000100100011010001010110011110001001101010111111",2) );
+
+testcases[tc++] = new TestCase( SECTION,
+ 'parseInt("0000001000000001001000110100010101100111100010011010101111010",2)',
+ 18054430506169720,
+ parseInt("0000001000000001001000110100010101100111100010011010101111010",2) );
+
+testcases[tc++] = new TestCase( SECTION,
+ 'parseInt("0000001000000001001000110100010101100111100010011010101111011",2)',
+ 18054430506169724,
+ parseInt("0000001000000001001000110100010101100111100010011010101111011",2));
+
+testcases[tc++] = new TestCase( SECTION,
+ 'parseInt("0000001000000001001000110100010101100111100010011010101111100",2)',
+ 18054430506169724,
+ parseInt("0000001000000001001000110100010101100111100010011010101111100",2) );
+
+testcases[tc++] = new TestCase( SECTION,
+ 'parseInt("0000001000000001001000110100010101100111100010011010101111110",2)',
+ 18054430506169728,
+ parseInt("0000001000000001001000110100010101100111100010011010101111110",2) );
+
+testcases[tc++] = new TestCase( SECTION,
+ 'parseInt("yz",35)',
+ 34,
+ parseInt("yz",35) );
+
+testcases[tc++] = new TestCase( SECTION,
+ 'parseInt("yz",36)',
+ 1259,
+ parseInt("yz",36) );
+
+testcases[tc++] = new TestCase( SECTION,
+ 'parseInt("yz",37)',
+ NaN,
+ parseInt("yz",37) );
+
+testcases[tc++] = new TestCase( SECTION,
+ 'parseInt("+77")',
+ 77,
+ parseInt("+77") );
+
+testcases[tc++] = new TestCase( SECTION,
+ 'parseInt("-77",9)',
+ -70,
+ parseInt("-77",9) );
+
+testcases[tc++] = new TestCase( SECTION,
+ 'parseInt("\u20001234\u2000")',
+ 1234,
+ parseInt("\u20001234\u2000") );
+
+testcases[tc++] = new TestCase( SECTION,
+ 'parseInt("123456789012345678")',
+ 123456789012345680,
+ parseInt("123456789012345678") );
+
+testcases[tc++] = new TestCase( SECTION,
+ 'parseInt("9",8)',
+ NaN,
+ parseInt("9",8) );
+
+testcases[tc++] = new TestCase( SECTION,
+ 'parseInt("1e2")',
+ 1,
+ parseInt("1e2") );
+
+testcases[tc++] = new TestCase( SECTION,
+ 'parseInt("1.9999999999999999999")',
+ 1,
+ parseInt("1.9999999999999999999") );
+
+testcases[tc++] = new TestCase( SECTION,
+ 'parseInt("0x10")',
+ 16,
+ parseInt("0x10") );
+
+testcases[tc++] = new TestCase( SECTION,
+ 'parseInt("0x10",10)',
+ 0,
+ parseInt("0x10",10));
+
+testcases[tc++] = new TestCase( SECTION,
+ 'parseInt("0022")',
+ 18,
+ parseInt("0022"));
+
+testcases[tc++] = new TestCase( SECTION,
+ 'parseInt("0022",10)',
+ 22,
+ parseInt("0022",10) );
+
+testcases[tc++] = new TestCase( SECTION,
+ 'parseInt("0x1000000000000080")',
+ 1152921504606847000,
+ parseInt("0x1000000000000080") );
+
+testcases[tc++] = new TestCase( SECTION,
+ 'parseInt("0x1000000000000081")',
+ 1152921504606847200,
+ parseInt("0x1000000000000081") );
+
+s =
+"0xFFFFFFFFFFFFF80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
+
+s += "0000000000000000000000000000000000000";
+
+testcases[tc++] = new TestCase( SECTION,
+ "s = " + s +"; -s",
+ -1.7976931348623157e+308,
+ -s );
+
+s =
+"0xFFFFFFFFFFFFF80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000";
+s += "0000000000000000000000000000000000001";
+
+testcases[tc++] = new TestCase( SECTION,
+ "s = " + s +"; -s",
+ -1.7976931348623157e+308,
+ -s );
+
+
+s = "0xFFFFFFFFFFFFFC0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000";
+
+s += "0000000000000000000000000000000000000"
+
+
+testcases[tc++] = new TestCase( SECTION,
+ "s = " + s + "; -s",
+ -Infinity,
+ -s );
+
+s = "0xFFFFFFFFFFFFFB0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000";
+s += "0000000000000000000000000000000000001";
+
+testcases[tc++] = new TestCase( SECTION,
+ "s = " + s + "; -s",
+ -1.7976931348623157e+308,
+ -s );
+
+s += "0"
+
+testcases[tc++] = new TestCase( SECTION,
+ "s = " + s + "; -s",
+ -Infinity,
+ -s );
+
+testcases[tc++] = new TestCase( SECTION,
+ 'parseInt(s)',
+ Infinity,
+ parseInt(s) );
+
+testcases[tc++] = new TestCase( SECTION,
+ 'parseInt(s,32)',
+ 0,
+ parseInt(s,32) );
+
+testcases[tc++] = new TestCase( SECTION,
+ 'parseInt(s,36)',
+ Infinity,
+ parseInt(s,36));
+
+test();
+
+function test( array ) {
+ for ( tc=0 ; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.3-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.3-1.js
new file mode 100644
index 0000000..0efec6b
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.3-1.js
@@ -0,0 +1,444 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.1.2.3.js
+ ECMA Section: 15.1.2.3 Function properties of the global object:
+ parseFloat( string )
+
+ Description: The parseFloat function produces a number value dictated
+ by the interpretation of the contents of the string
+ argument defined as a decimal literal.
+
+ When the parseFloat function is called, the following
+ steps are taken:
+
+ 1. Call ToString( string ).
+ 2. Remove leading whitespace Result(1).
+ 3. If neither Result(2) nor any prefix of Result(2)
+ satisfies the syntax of a StrDecimalLiteral,
+ return NaN.
+ 4. Compute the longest prefix of Result(2) which might
+ be Resusult(2) itself, that satisfies the syntax of
+ a StrDecimalLiteral
+ 5. Return the number value for the MV of Result(4).
+
+ Note that parseFloate may interpret only a leading
+ portion of the string as a number value; it ignores any
+ characters that cannot be interpreted as part of the
+ notation of a decimal literal, and no indication is given
+ that such characters were ignored.
+
+ StrDecimalLiteral::
+ Infinity
+ DecimalDigits.DecimalDigits opt ExponentPart opt
+ .DecimalDigits ExponentPart opt
+ DecimalDigits ExponentPart opt
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+
+ var SECTION = "15.1.2.3-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "parseFloat(string)";
+ var BUGNUMBER= "77391";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+
+ test();
+
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "parseFloat.length", 1, parseFloat.length );
+
+ array[item++] = new TestCase( SECTION, "parseFloat.length = null; parseFloat.length", 1, eval("parseFloat.length = null; parseFloat.length") );
+ array[item++] = new TestCase( SECTION, "delete parseFloat.length", false, delete parseFloat.length );
+ array[item++] = new TestCase( SECTION, "delete parseFloat.length; parseFloat.length", 1, eval("delete parseFloat.length; parseFloat.length") );
+ array[item++] = new TestCase( SECTION, "var MYPROPS=''; for ( var p in parseFloat ) { MYPROPS += p }; MYPROPS", "", eval("var MYPROPS=''; for ( var p in parseFloat ) { MYPROPS += p }; MYPROPS") );
+
+ array[item++] = new TestCase( SECTION, "parseFloat()", Number.NaN, parseFloat() );
+ array[item++] = new TestCase( SECTION, "parseFloat('')", Number.NaN, parseFloat('') );
+
+ array[item++] = new TestCase( SECTION, "parseFloat(' ')", Number.NaN, parseFloat(' ') );
+ array[item++] = new TestCase( SECTION, "parseFloat(true)", Number.NaN, parseFloat(true) );
+ array[item++] = new TestCase( SECTION, "parseFloat(false)", Number.NaN, parseFloat(false) );
+ array[item++] = new TestCase( SECTION, "parseFloat('string')", Number.NaN, parseFloat("string") );
+
+ array[item++] = new TestCase( SECTION, "parseFloat(' Infinity')", Infinity, parseFloat("Infinity") );
+ array[item++] = new TestCase( SECTION, "parseFloat(' Infinity ')", Infinity, parseFloat(' Infinity ') );
+
+ array[item++] = new TestCase( SECTION, "parseFloat('Infinity')", Infinity, parseFloat("Infinity") );
+ array[item++] = new TestCase( SECTION, "parseFloat(Infinity)", Infinity, parseFloat(Infinity) );
+
+
+ array[item++] = new TestCase( SECTION, "parseFloat(' +Infinity')", +Infinity, parseFloat("+Infinity") );
+ array[item++] = new TestCase( SECTION, "parseFloat(' -Infinity ')", -Infinity, parseFloat(' -Infinity ') );
+
+ array[item++] = new TestCase( SECTION, "parseFloat('+Infinity')", +Infinity, parseFloat("+Infinity") );
+ array[item++] = new TestCase( SECTION, "parseFloat(-Infinity)", -Infinity, parseFloat(-Infinity) );
+
+ array[item++] = new TestCase( SECTION, "parseFloat('0')", 0, parseFloat("0") );
+ array[item++] = new TestCase( SECTION, "parseFloat('-0')", -0, parseFloat("-0") );
+ array[item++] = new TestCase( SECTION, "parseFloat('+0')", 0, parseFloat("+0") );
+
+ array[item++] = new TestCase( SECTION, "parseFloat('1')", 1, parseFloat("1") );
+ array[item++] = new TestCase( SECTION, "parseFloat('-1')", -1, parseFloat("-1") );
+ array[item++] = new TestCase( SECTION, "parseFloat('+1')", 1, parseFloat("+1") );
+
+ array[item++] = new TestCase( SECTION, "parseFloat('2')", 2, parseFloat("2") );
+ array[item++] = new TestCase( SECTION, "parseFloat('-2')", -2, parseFloat("-2") );
+ array[item++] = new TestCase( SECTION, "parseFloat('+2')", 2, parseFloat("+2") );
+
+ array[item++] = new TestCase( SECTION, "parseFloat('3')", 3, parseFloat("3") );
+ array[item++] = new TestCase( SECTION, "parseFloat('-3')", -3, parseFloat("-3") );
+ array[item++] = new TestCase( SECTION, "parseFloat('+3')", 3, parseFloat("+3") );
+
+ array[item++] = new TestCase( SECTION, "parseFloat('4')", 4, parseFloat("4") );
+ array[item++] = new TestCase( SECTION, "parseFloat('-4')", -4, parseFloat("-4") );
+ array[item++] = new TestCase( SECTION, "parseFloat('+4')", 4, parseFloat("+4") );
+
+ array[item++] = new TestCase( SECTION, "parseFloat('5')", 5, parseFloat("5") );
+ array[item++] = new TestCase( SECTION, "parseFloat('-5')", -5, parseFloat("-5") );
+ array[item++] = new TestCase( SECTION, "parseFloat('+5')", 5, parseFloat("+5") );
+
+ array[item++] = new TestCase( SECTION, "parseFloat('6')", 6, parseFloat("6") );
+ array[item++] = new TestCase( SECTION, "parseFloat('-6')", -6, parseFloat("-6") );
+ array[item++] = new TestCase( SECTION, "parseFloat('+6')", 6, parseFloat("+6") );
+
+ array[item++] = new TestCase( SECTION, "parseFloat('7')", 7, parseFloat("7") );
+ array[item++] = new TestCase( SECTION, "parseFloat('-7')", -7, parseFloat("-7") );
+ array[item++] = new TestCase( SECTION, "parseFloat('+7')", 7, parseFloat("+7") );
+
+ array[item++] = new TestCase( SECTION, "parseFloat('8')", 8, parseFloat("8") );
+ array[item++] = new TestCase( SECTION, "parseFloat('-8')", -8, parseFloat("-8") );
+ array[item++] = new TestCase( SECTION, "parseFloat('+8')", 8, parseFloat("+8") );
+
+ array[item++] = new TestCase( SECTION, "parseFloat('9')", 9, parseFloat("9") );
+ array[item++] = new TestCase( SECTION, "parseFloat('-9')", -9, parseFloat("-9") );
+ array[item++] = new TestCase( SECTION, "parseFloat('+9')", 9, parseFloat("+9") );
+
+ array[item++] = new TestCase( SECTION, "parseFloat('3.14159')", 3.14159, parseFloat("3.14159") );
+ array[item++] = new TestCase( SECTION, "parseFloat('-3.14159')", -3.14159, parseFloat("-3.14159") );
+ array[item++] = new TestCase( SECTION, "parseFloat('+3.14159')", 3.14159, parseFloat("+3.14159") );
+
+ array[item++] = new TestCase( SECTION, "parseFloat('3.')", 3, parseFloat("3.") );
+ array[item++] = new TestCase( SECTION, "parseFloat('-3.')", -3, parseFloat("-3.") );
+ array[item++] = new TestCase( SECTION, "parseFloat('+3.')", 3, parseFloat("+3.") );
+
+ array[item++] = new TestCase( SECTION, "parseFloat('3.e1')", 30, parseFloat("3.e1") );
+ array[item++] = new TestCase( SECTION, "parseFloat('-3.e1')", -30, parseFloat("-3.e1") );
+ array[item++] = new TestCase( SECTION, "parseFloat('+3.e1')", 30, parseFloat("+3.e1") );
+
+ array[item++] = new TestCase( SECTION, "parseFloat('3.e+1')", 30, parseFloat("3.e+1") );
+ array[item++] = new TestCase( SECTION, "parseFloat('-3.e+1')", -30, parseFloat("-3.e+1") );
+ array[item++] = new TestCase( SECTION, "parseFloat('+3.e+1')", 30, parseFloat("+3.e+1") );
+
+ array[item++] = new TestCase( SECTION, "parseFloat('3.e-1')", .30, parseFloat("3.e-1") );
+ array[item++] = new TestCase( SECTION, "parseFloat('-3.e-1')", -.30, parseFloat("-3.e-1") );
+ array[item++] = new TestCase( SECTION, "parseFloat('+3.e-1')", .30, parseFloat("+3.e-1") );
+
+ // StrDecimalLiteral::: .DecimalDigits ExponentPart opt
+
+ array[item++] = new TestCase( SECTION, "parseFloat('.00001')", 0.00001, parseFloat(".00001") );
+ array[item++] = new TestCase( SECTION, "parseFloat('+.00001')", 0.00001, parseFloat("+.00001") );
+ array[item++] = new TestCase( SECTION, "parseFloat('-0.0001')", -0.00001, parseFloat("-.00001") );
+
+ array[item++] = new TestCase( SECTION, "parseFloat('.01e2')", 1, parseFloat(".01e2") );
+ array[item++] = new TestCase( SECTION, "parseFloat('+.01e2')", 1, parseFloat("+.01e2") );
+ array[item++] = new TestCase( SECTION, "parseFloat('-.01e2')", -1, parseFloat("-.01e2") );
+
+ array[item++] = new TestCase( SECTION, "parseFloat('.01e+2')", 1, parseFloat(".01e+2") );
+ array[item++] = new TestCase( SECTION, "parseFloat('+.01e+2')", 1, parseFloat("+.01e+2") );
+ array[item++] = new TestCase( SECTION, "parseFloat('-.01e+2')", -1, parseFloat("-.01e+2") );
+
+ array[item++] = new TestCase( SECTION, "parseFloat('.01e-2')", 0.0001, parseFloat(".01e-2") );
+ array[item++] = new TestCase( SECTION, "parseFloat('+.01e-2')", 0.0001, parseFloat("+.01e-2") );
+ array[item++] = new TestCase( SECTION, "parseFloat('-.01e-2')", -0.0001, parseFloat("-.01e-2") );
+
+ // StrDecimalLiteral::: DecimalDigits ExponentPart opt
+
+ array[item++] = new TestCase( SECTION, "parseFloat('1234e5')", 123400000, parseFloat("1234e5") );
+ array[item++] = new TestCase( SECTION, "parseFloat('+1234e5')", 123400000, parseFloat("+1234e5") );
+ array[item++] = new TestCase( SECTION, "parseFloat('-1234e5')", -123400000, parseFloat("-1234e5") );
+
+ array[item++] = new TestCase( SECTION, "parseFloat('1234e+5')", 123400000, parseFloat("1234e+5") );
+ array[item++] = new TestCase( SECTION, "parseFloat('+1234e+5')", 123400000, parseFloat("+1234e+5") );
+ array[item++] = new TestCase( SECTION, "parseFloat('-1234e+5')", -123400000, parseFloat("-1234e+5") );
+
+ array[item++] = new TestCase( SECTION, "parseFloat('1234e-5')", 0.01234, parseFloat("1234e-5") );
+ array[item++] = new TestCase( SECTION, "parseFloat('+1234e-5')", 0.01234, parseFloat("+1234e-5") );
+ array[item++] = new TestCase( SECTION, "parseFloat('-1234e-5')", -0.01234, parseFloat("-1234e-5") );
+
+
+ array[item++] = new TestCase( SECTION, "parseFloat(0)", 0, parseFloat(0) );
+ array[item++] = new TestCase( SECTION, "parseFloat(-0)", -0, parseFloat(-0) );
+
+ array[item++] = new TestCase( SECTION, "parseFloat(1)", 1, parseFloat(1) );
+ array[item++] = new TestCase( SECTION, "parseFloat(-1)", -1, parseFloat(-1) );
+
+ array[item++] = new TestCase( SECTION, "parseFloat(2)", 2, parseFloat(2) );
+ array[item++] = new TestCase( SECTION, "parseFloat(-2)", -2, parseFloat(-2) );
+
+ array[item++] = new TestCase( SECTION, "parseFloat(3)", 3, parseFloat(3) );
+ array[item++] = new TestCase( SECTION, "parseFloat(-3)", -3, parseFloat(-3) );
+
+ array[item++] = new TestCase( SECTION, "parseFloat(4)", 4, parseFloat(4) );
+ array[item++] = new TestCase( SECTION, "parseFloat(-4)", -4, parseFloat(-4) );
+
+ array[item++] = new TestCase( SECTION, "parseFloat(5)", 5, parseFloat(5) );
+ array[item++] = new TestCase( SECTION, "parseFloat(-5)", -5, parseFloat(-5) );
+
+ array[item++] = new TestCase( SECTION, "parseFloat(6)", 6, parseFloat(6) );
+ array[item++] = new TestCase( SECTION, "parseFloat(-6)", -6, parseFloat(-6) );
+
+ array[item++] = new TestCase( SECTION, "parseFloat(7)", 7, parseFloat(7) );
+ array[item++] = new TestCase( SECTION, "parseFloat(-7)", -7, parseFloat(-7) );
+
+ array[item++] = new TestCase( SECTION, "parseFloat(8)", 8, parseFloat(8) );
+ array[item++] = new TestCase( SECTION, "parseFloat(-8)", -8, parseFloat(-8) );
+
+ array[item++] = new TestCase( SECTION, "parseFloat(9)", 9, parseFloat(9) );
+ array[item++] = new TestCase( SECTION, "parseFloat(-9)", -9, parseFloat(-9) );
+
+ array[item++] = new TestCase( SECTION, "parseFloat(3.14159)", 3.14159, parseFloat(3.14159) );
+ array[item++] = new TestCase( SECTION, "parseFloat(-3.14159)", -3.14159, parseFloat(-3.14159) );
+
+ array[item++] = new TestCase( SECTION, "parseFloat(3.)", 3, parseFloat(3.) );
+ array[item++] = new TestCase( SECTION, "parseFloat(-3.)", -3, parseFloat(-3.) );
+
+ array[item++] = new TestCase( SECTION, "parseFloat(3.e1)", 30, parseFloat(3.e1) );
+ array[item++] = new TestCase( SECTION, "parseFloat(-3.e1)", -30, parseFloat(-3.e1) );
+
+ array[item++] = new TestCase( SECTION, "parseFloat(3.e+1)", 30, parseFloat(3.e+1) );
+ array[item++] = new TestCase( SECTION, "parseFloat(-3.e+1)", -30, parseFloat(-3.e+1) );
+
+ array[item++] = new TestCase( SECTION, "parseFloat(3.e-1)", .30, parseFloat(3.e-1) );
+ array[item++] = new TestCase( SECTION, "parseFloat(-3.e-1)", -.30, parseFloat(-3.e-1) );
+
+
+ array[item++] = new TestCase( SECTION, "parseFloat(3.E1)", 30, parseFloat(3.E1) );
+ array[item++] = new TestCase( SECTION, "parseFloat(-3.E1)", -30, parseFloat(-3.E1) );
+
+ array[item++] = new TestCase( SECTION, "parseFloat(3.E+1)", 30, parseFloat(3.E+1) );
+ array[item++] = new TestCase( SECTION, "parseFloat(-3.E+1)", -30, parseFloat(-3.E+1) );
+
+ array[item++] = new TestCase( SECTION, "parseFloat(3.E-1)", .30, parseFloat(3.E-1) );
+ array[item++] = new TestCase( SECTION, "parseFloat(-3.E-1)", -.30, parseFloat(-3.E-1) );
+
+ // StrDecimalLiteral::: .DecimalDigits ExponentPart opt
+
+ array[item++] = new TestCase( SECTION, "parseFloat(.00001)", 0.00001, parseFloat(.00001) );
+ array[item++] = new TestCase( SECTION, "parseFloat(-0.0001)", -0.00001, parseFloat(-.00001) );
+
+ array[item++] = new TestCase( SECTION, "parseFloat(.01e2)", 1, parseFloat(.01e2) );
+ array[item++] = new TestCase( SECTION, "parseFloat(-.01e2)", -1, parseFloat(-.01e2) );
+
+ array[item++] = new TestCase( SECTION, "parseFloat(.01e+2)", 1, parseFloat(.01e+2) );
+ array[item++] = new TestCase( SECTION, "parseFloat(-.01e+2)", -1, parseFloat(-.01e+2) );
+
+ array[item++] = new TestCase( SECTION, "parseFloat(.01e-2)", 0.0001, parseFloat(.01e-2) );
+ array[item++] = new TestCase( SECTION, "parseFloat(-.01e-2)", -0.0001, parseFloat(-.01e-2) );
+
+ // StrDecimalLiteral::: DecimalDigits ExponentPart opt
+
+ array[item++] = new TestCase( SECTION, "parseFloat(1234e5)", 123400000, parseFloat(1234e5) );
+ array[item++] = new TestCase( SECTION, "parseFloat(-1234e5)", -123400000, parseFloat(-1234e5) );
+
+ array[item++] = new TestCase( SECTION, "parseFloat(1234e+5)", 123400000, parseFloat(1234e+5) );
+ array[item++] = new TestCase( SECTION, "parseFloat(-1234e+5)", -123400000, parseFloat(-1234e+5) );
+
+ array[item++] = new TestCase( SECTION, "parseFloat(1234e-5)", 0.01234, parseFloat(1234e-5) );
+ array[item++] = new TestCase( SECTION, "parseFloat(-1234e-5)", -0.01234, parseFloat(-1234e-5) );
+
+ // hex cases should all return 0 (0 is the longest string that satisfies a StringDecimalLiteral)
+
+ array[item++] = new TestCase( SECTION, "parseFloat('0x0')", 0, parseFloat("0x0"));
+ array[item++] = new TestCase( SECTION, "parseFloat('0x1')", 0, parseFloat("0x1"));
+ array[item++] = new TestCase( SECTION, "parseFloat('0x2')", 0, parseFloat("0x2"));
+ array[item++] = new TestCase( SECTION, "parseFloat('0x3')", 0, parseFloat("0x3"));
+ array[item++] = new TestCase( SECTION, "parseFloat('0x4')", 0, parseFloat("0x4"));
+ array[item++] = new TestCase( SECTION, "parseFloat('0x5')", 0, parseFloat("0x5"));
+ array[item++] = new TestCase( SECTION, "parseFloat('0x6')", 0, parseFloat("0x6"));
+ array[item++] = new TestCase( SECTION, "parseFloat('0x7')", 0, parseFloat("0x7"));
+ array[item++] = new TestCase( SECTION, "parseFloat('0x8')", 0, parseFloat("0x8"));
+ array[item++] = new TestCase( SECTION, "parseFloat('0x9')", 0, parseFloat("0x9"));
+ array[item++] = new TestCase( SECTION, "parseFloat('0xa')", 0, parseFloat("0xa"));
+ array[item++] = new TestCase( SECTION, "parseFloat('0xb')", 0, parseFloat("0xb"));
+ array[item++] = new TestCase( SECTION, "parseFloat('0xc')", 0, parseFloat("0xc"));
+ array[item++] = new TestCase( SECTION, "parseFloat('0xd')", 0, parseFloat("0xd"));
+ array[item++] = new TestCase( SECTION, "parseFloat('0xe')", 0, parseFloat("0xe"));
+ array[item++] = new TestCase( SECTION, "parseFloat('0xf')", 0, parseFloat("0xf"));
+ array[item++] = new TestCase( SECTION, "parseFloat('0xA')", 0, parseFloat("0xA"));
+ array[item++] = new TestCase( SECTION, "parseFloat('0xB')", 0, parseFloat("0xB"));
+ array[item++] = new TestCase( SECTION, "parseFloat('0xC')", 0, parseFloat("0xC"));
+ array[item++] = new TestCase( SECTION, "parseFloat('0xD')", 0, parseFloat("0xD"));
+ array[item++] = new TestCase( SECTION, "parseFloat('0xE')", 0, parseFloat("0xE"));
+ array[item++] = new TestCase( SECTION, "parseFloat('0xF')", 0, parseFloat("0xF"));
+
+ array[item++] = new TestCase( SECTION, "parseFloat('0X0')", 0, parseFloat("0X0"));
+ array[item++] = new TestCase( SECTION, "parseFloat('0X1')", 0, parseFloat("0X1"));
+ array[item++] = new TestCase( SECTION, "parseFloat('0X2')", 0, parseFloat("0X2"));
+ array[item++] = new TestCase( SECTION, "parseFloat('0X3')", 0, parseFloat("0X3"));
+ array[item++] = new TestCase( SECTION, "parseFloat('0X4')", 0, parseFloat("0X4"));
+ array[item++] = new TestCase( SECTION, "parseFloat('0X5')", 0, parseFloat("0X5"));
+ array[item++] = new TestCase( SECTION, "parseFloat('0X6')", 0, parseFloat("0X6"));
+ array[item++] = new TestCase( SECTION, "parseFloat('0X7')", 0, parseFloat("0X7"));
+ array[item++] = new TestCase( SECTION, "parseFloat('0X8')", 0, parseFloat("0X8"));
+ array[item++] = new TestCase( SECTION, "parseFloat('0X9')", 0, parseFloat("0X9"));
+ array[item++] = new TestCase( SECTION, "parseFloat('0Xa')", 0, parseFloat("0Xa"));
+ array[item++] = new TestCase( SECTION, "parseFloat('0Xb')", 0, parseFloat("0Xb"));
+ array[item++] = new TestCase( SECTION, "parseFloat('0Xc')", 0, parseFloat("0Xc"));
+ array[item++] = new TestCase( SECTION, "parseFloat('0Xd')", 0, parseFloat("0Xd"));
+ array[item++] = new TestCase( SECTION, "parseFloat('0Xe')", 0, parseFloat("0Xe"));
+ array[item++] = new TestCase( SECTION, "parseFloat('0Xf')", 0, parseFloat("0Xf"));
+ array[item++] = new TestCase( SECTION, "parseFloat('0XA')", 0, parseFloat("0XA"));
+ array[item++] = new TestCase( SECTION, "parseFloat('0XB')", 0, parseFloat("0XB"));
+ array[item++] = new TestCase( SECTION, "parseFloat('0XC')", 0, parseFloat("0XC"));
+ array[item++] = new TestCase( SECTION, "parseFloat('0XD')", 0, parseFloat("0XD"));
+ array[item++] = new TestCase( SECTION, "parseFloat('0XE')", 0, parseFloat("0XE"));
+ array[item++] = new TestCase( SECTION, "parseFloat('0XF')", 0, parseFloat("0XF"));
+ array[item++] = new TestCase( SECTION, "parseFloat(' 0XF ')", 0, parseFloat(" 0XF "));
+
+ // hex literals should still succeed
+
+ array[item++] = new TestCase( SECTION, "parseFloat(0x0)", 0, parseFloat(0x0));
+ array[item++] = new TestCase( SECTION, "parseFloat(0x1)", 1, parseFloat(0x1));
+ array[item++] = new TestCase( SECTION, "parseFloat(0x2)", 2, parseFloat(0x2));
+ array[item++] = new TestCase( SECTION, "parseFloat(0x3)", 3, parseFloat(0x3));
+ array[item++] = new TestCase( SECTION, "parseFloat(0x4)", 4, parseFloat(0x4));
+ array[item++] = new TestCase( SECTION, "parseFloat(0x5)", 5, parseFloat(0x5));
+ array[item++] = new TestCase( SECTION, "parseFloat(0x6)", 6, parseFloat(0x6));
+ array[item++] = new TestCase( SECTION, "parseFloat(0x7)", 7, parseFloat(0x7));
+ array[item++] = new TestCase( SECTION, "parseFloat(0x8)", 8, parseFloat(0x8));
+ array[item++] = new TestCase( SECTION, "parseFloat(0x9)", 9, parseFloat(0x9));
+ array[item++] = new TestCase( SECTION, "parseFloat(0xa)", 10, parseFloat(0xa));
+ array[item++] = new TestCase( SECTION, "parseFloat(0xb)", 11, parseFloat(0xb));
+ array[item++] = new TestCase( SECTION, "parseFloat(0xc)", 12, parseFloat(0xc));
+ array[item++] = new TestCase( SECTION, "parseFloat(0xd)", 13, parseFloat(0xd));
+ array[item++] = new TestCase( SECTION, "parseFloat(0xe)", 14, parseFloat(0xe));
+ array[item++] = new TestCase( SECTION, "parseFloat(0xf)", 15, parseFloat(0xf));
+ array[item++] = new TestCase( SECTION, "parseFloat(0xA)", 10, parseFloat(0xA));
+ array[item++] = new TestCase( SECTION, "parseFloat(0xB)", 11, parseFloat(0xB));
+ array[item++] = new TestCase( SECTION, "parseFloat(0xC)", 12, parseFloat(0xC));
+ array[item++] = new TestCase( SECTION, "parseFloat(0xD)", 13, parseFloat(0xD));
+ array[item++] = new TestCase( SECTION, "parseFloat(0xE)", 14, parseFloat(0xE));
+ array[item++] = new TestCase( SECTION, "parseFloat(0xF)", 15, parseFloat(0xF));
+
+ array[item++] = new TestCase( SECTION, "parseFloat(0X0)", 0, parseFloat(0X0));
+ array[item++] = new TestCase( SECTION, "parseFloat(0X1)", 1, parseFloat(0X1));
+ array[item++] = new TestCase( SECTION, "parseFloat(0X2)", 2, parseFloat(0X2));
+ array[item++] = new TestCase( SECTION, "parseFloat(0X3)", 3, parseFloat(0X3));
+ array[item++] = new TestCase( SECTION, "parseFloat(0X4)", 4, parseFloat(0X4));
+ array[item++] = new TestCase( SECTION, "parseFloat(0X5)", 5, parseFloat(0X5));
+ array[item++] = new TestCase( SECTION, "parseFloat(0X6)", 6, parseFloat(0X6));
+ array[item++] = new TestCase( SECTION, "parseFloat(0X7)", 7, parseFloat(0X7));
+ array[item++] = new TestCase( SECTION, "parseFloat(0X8)", 8, parseFloat(0X8));
+ array[item++] = new TestCase( SECTION, "parseFloat(0X9)", 9, parseFloat(0X9));
+ array[item++] = new TestCase( SECTION, "parseFloat(0Xa)", 10, parseFloat(0Xa));
+ array[item++] = new TestCase( SECTION, "parseFloat(0Xb)", 11, parseFloat(0Xb));
+ array[item++] = new TestCase( SECTION, "parseFloat(0Xc)", 12, parseFloat(0Xc));
+ array[item++] = new TestCase( SECTION, "parseFloat(0Xd)", 13, parseFloat(0Xd));
+ array[item++] = new TestCase( SECTION, "parseFloat(0Xe)", 14, parseFloat(0Xe));
+ array[item++] = new TestCase( SECTION, "parseFloat(0Xf)", 15, parseFloat(0Xf));
+ array[item++] = new TestCase( SECTION, "parseFloat(0XA)", 10, parseFloat(0XA));
+ array[item++] = new TestCase( SECTION, "parseFloat(0XB)", 11, parseFloat(0XB));
+ array[item++] = new TestCase( SECTION, "parseFloat(0XC)", 12, parseFloat(0XC));
+ array[item++] = new TestCase( SECTION, "parseFloat(0XD)", 13, parseFloat(0XD));
+ array[item++] = new TestCase( SECTION, "parseFloat(0XE)", 14, parseFloat(0XE));
+ array[item++] = new TestCase( SECTION, "parseFloat(0XF)", 15, parseFloat(0XF));
+
+
+ // A StringNumericLiteral may not use octal notation
+
+ array[item++] = new TestCase( SECTION, "parseFloat('00')", 0, parseFloat("00"));
+ array[item++] = new TestCase( SECTION, "parseFloat('01')", 1, parseFloat("01"));
+ array[item++] = new TestCase( SECTION, "parseFloat('02')", 2, parseFloat("02"));
+ array[item++] = new TestCase( SECTION, "parseFloat('03')", 3, parseFloat("03"));
+ array[item++] = new TestCase( SECTION, "parseFloat('04')", 4, parseFloat("04"));
+ array[item++] = new TestCase( SECTION, "parseFloat('05')", 5, parseFloat("05"));
+ array[item++] = new TestCase( SECTION, "parseFloat('06')", 6, parseFloat("06"));
+ array[item++] = new TestCase( SECTION, "parseFloat('07')", 7, parseFloat("07"));
+ array[item++] = new TestCase( SECTION, "parseFloat('010')", 10, parseFloat("010"));
+ array[item++] = new TestCase( SECTION, "parseFloat('011')", 11, parseFloat("011"));
+
+ // A StringNumericLIteral may have any number of leading 0 digits
+
+ array[item++] = new TestCase( SECTION, "parseFloat('001')", 1, parseFloat("001"));
+ array[item++] = new TestCase( SECTION, "parseFloat('0001')", 1, parseFloat("0001"));
+ array[item++] = new TestCase( SECTION, "parseFloat(' 0001 ')", 1, parseFloat(" 0001 "));
+
+ // an octal numeric literal should be treated as an octal
+
+ array[item++] = new TestCase( SECTION, "parseFloat(00)", 0, parseFloat(00));
+ array[item++] = new TestCase( SECTION, "parseFloat(01)", 1, parseFloat(01));
+ array[item++] = new TestCase( SECTION, "parseFloat(02)", 2, parseFloat(02));
+ array[item++] = new TestCase( SECTION, "parseFloat(03)", 3, parseFloat(03));
+ array[item++] = new TestCase( SECTION, "parseFloat(04)", 4, parseFloat(04));
+ array[item++] = new TestCase( SECTION, "parseFloat(05)", 5, parseFloat(05));
+ array[item++] = new TestCase( SECTION, "parseFloat(06)", 6, parseFloat(06));
+ array[item++] = new TestCase( SECTION, "parseFloat(07)", 7, parseFloat(07));
+ array[item++] = new TestCase( SECTION, "parseFloat(010)", 8, parseFloat(010));
+ array[item++] = new TestCase( SECTION, "parseFloat(011)", 9, parseFloat(011));
+
+ // A StringNumericLIteral may have any number of leading 0 digits
+
+ array[item++] = new TestCase( SECTION, "parseFloat(001)", 1, parseFloat(001));
+ array[item++] = new TestCase( SECTION, "parseFloat(0001)", 1, parseFloat(0001));
+
+ // make sure it's reflexive
+ array[item++] = new TestCase( SECTION, "parseFloat(Math.PI)", Math.PI, parseFloat(Math.PI));
+ array[item++] = new TestCase( SECTION, "parseFloat(Math.LN2)", Math.LN2, parseFloat(Math.LN2));
+ array[item++] = new TestCase( SECTION, "parseFloat(Math.LN10)", Math.LN10, parseFloat(Math.LN10));
+ array[item++] = new TestCase( SECTION, "parseFloat(Math.LOG2E)", Math.LOG2E, parseFloat(Math.LOG2E));
+ array[item++] = new TestCase( SECTION, "parseFloat(Math.LOG10E)", Math.LOG10E, parseFloat(Math.LOG10E));
+ array[item++] = new TestCase( SECTION, "parseFloat(Math.SQRT2)", Math.SQRT2, parseFloat(Math.SQRT2));
+ array[item++] = new TestCase( SECTION, "parseFloat(Math.SQRT1_2)", Math.SQRT1_2, parseFloat(Math.SQRT1_2));
+
+ array[item++] = new TestCase( SECTION, "parseFloat(Math.PI+'')", Math.PI, parseFloat(Math.PI+''));
+ array[item++] = new TestCase( SECTION, "parseFloat(Math.LN2+'')", Math.LN2, parseFloat(Math.LN2+''));
+ array[item++] = new TestCase( SECTION, "parseFloat(Math.LN10+'')", Math.LN10, parseFloat(Math.LN10+''));
+ array[item++] = new TestCase( SECTION, "parseFloat(Math.LOG2E+'')", Math.LOG2E, parseFloat(Math.LOG2E+''));
+ array[item++] = new TestCase( SECTION, "parseFloat(Math.LOG10E+'')", Math.LOG10E, parseFloat(Math.LOG10E+''));
+ array[item++] = new TestCase( SECTION, "parseFloat(Math.SQRT2+'')", Math.SQRT2, parseFloat(Math.SQRT2+''));
+ array[item++] = new TestCase( SECTION, "parseFloat(Math.SQRT1_2+'')", Math.SQRT1_2, parseFloat(Math.SQRT1_2+''));
+
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.3-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.3-2.js
new file mode 100644
index 0000000..c3905c0
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.3-2.js
@@ -0,0 +1,295 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.1.2.3-2.js
+ ECMA Section: 15.1.2.3 Function properties of the global object:
+ parseFloat( string )
+
+ Description: The parseFloat function produces a number value dictated
+ by the interpretation of the contents of the string
+ argument defined as a decimal literal.
+
+ When the parseFloat function is called, the following
+ steps are taken:
+
+ 1. Call ToString( string ).
+ 2. Remove leading whitespace Result(1).
+ 3. If neither Result(2) nor any prefix of Result(2)
+ satisfies the syntax of a StrDecimalLiteral,
+ return NaN.
+ 4. Compute the longest prefix of Result(2) which might
+ be Resusult(2) itself, that satisfies the syntax of
+ a StrDecimalLiteral
+ 5. Return the number value for the MV of Result(4).
+
+ Note that parseFloate may interpret only a leading
+ portion of the string as a number value; it ignores any
+ characters that cannot be interpreted as part of the
+ notation of a decimal literal, and no indication is given
+ that such characters were ignored.
+
+ StrDecimalLiteral::
+ Infinity
+ DecimalDigits.DecimalDigits opt ExponentPart opt
+ .DecimalDigits ExponentPart opt
+ DecimalDigits ExponentPart opt
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+ var SECTION = "15.1.2.3-2";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ var BUGNUMBER = "77391";
+
+ var testcases = getTestCases();
+
+ writeHeaderToLog( SECTION + " parseFloat(string)");
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "parseFloat(true)", Number.NaN, parseFloat(true) );
+ array[item++] = new TestCase( SECTION, "parseFloat(false)", Number.NaN, parseFloat(false) );
+ array[item++] = new TestCase( SECTION, "parseFloat('string')", Number.NaN, parseFloat("string") );
+
+ array[item++] = new TestCase( SECTION, "parseFloat(' Infinity')", Number.POSITIVE_INFINITY, parseFloat("Infinity") );
+// array[item++] = new TestCase( SECTION, "parseFloat(Infinity)", Number.POSITIVE_INFINITY, parseFloat(Infinity) );
+
+ array[item++] = new TestCase( SECTION, "parseFloat(' 0')", 0, parseFloat(" 0") );
+ array[item++] = new TestCase( SECTION, "parseFloat(' -0')", -0, parseFloat(" -0") );
+ array[item++] = new TestCase( SECTION, "parseFloat(' +0')", 0, parseFloat(" +0") );
+
+ array[item++] = new TestCase( SECTION, "parseFloat(' 1')", 1, parseFloat(" 1") );
+ array[item++] = new TestCase( SECTION, "parseFloat(' -1')", -1, parseFloat(" -1") );
+ array[item++] = new TestCase( SECTION, "parseFloat(' +1')", 1, parseFloat(" +1") );
+
+ array[item++] = new TestCase( SECTION, "parseFloat(' 2')", 2, parseFloat(" 2") );
+ array[item++] = new TestCase( SECTION, "parseFloat(' -2')", -2, parseFloat(" -2") );
+ array[item++] = new TestCase( SECTION, "parseFloat(' +2')", 2, parseFloat(" +2") );
+
+ array[item++] = new TestCase( SECTION, "parseFloat(' 3')", 3, parseFloat(" 3") );
+ array[item++] = new TestCase( SECTION, "parseFloat(' -3')", -3, parseFloat(" -3") );
+ array[item++] = new TestCase( SECTION, "parseFloat(' +3')", 3, parseFloat(" +3") );
+
+ array[item++] = new TestCase( SECTION, "parseFloat(' 4')", 4, parseFloat(" 4") );
+ array[item++] = new TestCase( SECTION, "parseFloat(' -4')", -4, parseFloat(" -4") );
+ array[item++] = new TestCase( SECTION, "parseFloat(' +4')", 4, parseFloat(" +4") );
+
+ array[item++] = new TestCase( SECTION, "parseFloat(' 5')", 5, parseFloat(" 5") );
+ array[item++] = new TestCase( SECTION, "parseFloat(' -5')", -5, parseFloat(" -5") );
+ array[item++] = new TestCase( SECTION, "parseFloat(' +5')", 5, parseFloat(" +5") );
+
+ array[item++] = new TestCase( SECTION, "parseFloat(' 6')", 6, parseFloat(" 6") );
+ array[item++] = new TestCase( SECTION, "parseFloat(' -6')", -6, parseFloat(" -6") );
+ array[item++] = new TestCase( SECTION, "parseFloat(' +6')", 6, parseFloat(" +6") );
+
+ array[item++] = new TestCase( SECTION, "parseFloat(' 7')", 7, parseFloat(" 7") );
+ array[item++] = new TestCase( SECTION, "parseFloat(' -7')", -7, parseFloat(" -7") );
+ array[item++] = new TestCase( SECTION, "parseFloat(' +7')", 7, parseFloat(" +7") );
+
+ array[item++] = new TestCase( SECTION, "parseFloat(' 8')", 8, parseFloat(" 8") );
+ array[item++] = new TestCase( SECTION, "parseFloat(' -8')", -8, parseFloat(" -8") );
+ array[item++] = new TestCase( SECTION, "parseFloat(' +8')", 8, parseFloat(" +8") );
+
+ array[item++] = new TestCase( SECTION, "parseFloat(' 9')", 9, parseFloat(" 9") );
+ array[item++] = new TestCase( SECTION, "parseFloat(' -9')", -9, parseFloat(" -9") );
+ array[item++] = new TestCase( SECTION, "parseFloat(' +9')", 9, parseFloat(" +9") );
+
+ array[item++] = new TestCase( SECTION, "parseFloat(' 3.14159')", 3.14159, parseFloat(" 3.14159") );
+ array[item++] = new TestCase( SECTION, "parseFloat(' -3.14159')", -3.14159, parseFloat(" -3.14159") );
+ array[item++] = new TestCase( SECTION, "parseFloat(' +3.14159')", 3.14159, parseFloat(" +3.14159") );
+
+ array[item++] = new TestCase( SECTION, "parseFloat(' 3.')", 3, parseFloat(" 3.") );
+ array[item++] = new TestCase( SECTION, "parseFloat(' -3.')", -3, parseFloat(" -3.") );
+ array[item++] = new TestCase( SECTION, "parseFloat(' +3.')", 3, parseFloat(" +3.") );
+
+ array[item++] = new TestCase( SECTION, "parseFloat(' 3.e1')", 30, parseFloat(" 3.e1") );
+ array[item++] = new TestCase( SECTION, "parseFloat(' -3.e1')", -30, parseFloat(" -3.e1") );
+ array[item++] = new TestCase( SECTION, "parseFloat(' +3.e1')", 30, parseFloat(" +3.e1") );
+
+ array[item++] = new TestCase( SECTION, "parseFloat(' 3.e+1')", 30, parseFloat(" 3.e+1") );
+ array[item++] = new TestCase( SECTION, "parseFloat(' -3.e+1')", -30, parseFloat(" -3.e+1") );
+ array[item++] = new TestCase( SECTION, "parseFloat(' +3.e+1')", 30, parseFloat(" +3.e+1") );
+
+ array[item++] = new TestCase( SECTION, "parseFloat(' 3.e-1')", .30, parseFloat(" 3.e-1") );
+ array[item++] = new TestCase( SECTION, "parseFloat(' -3.e-1')", -.30, parseFloat(" -3.e-1") );
+ array[item++] = new TestCase( SECTION, "parseFloat(' +3.e-1')", .30, parseFloat(" +3.e-1") );
+
+ // StrDecimalLiteral::: .DecimalDigits ExponentPart opt
+
+ array[item++] = new TestCase( SECTION, "parseFloat(' .00001')", 0.00001, parseFloat(" .00001") );
+ array[item++] = new TestCase( SECTION, "parseFloat(' +.00001')", 0.00001, parseFloat(" +.00001") );
+ array[item++] = new TestCase( SECTION, "parseFloat(' -0.0001')", -0.00001, parseFloat(" -.00001") );
+
+ array[item++] = new TestCase( SECTION, "parseFloat(' .01e2')", 1, parseFloat(" .01e2") );
+ array[item++] = new TestCase( SECTION, "parseFloat(' +.01e2')", 1, parseFloat(" +.01e2") );
+ array[item++] = new TestCase( SECTION, "parseFloat(' -.01e2')", -1, parseFloat(" -.01e2") );
+
+ array[item++] = new TestCase( SECTION, "parseFloat(' .01e+2')", 1, parseFloat(" .01e+2") );
+ array[item++] = new TestCase( SECTION, "parseFloat(' +.01e+2')", 1, parseFloat(" +.01e+2") );
+ array[item++] = new TestCase( SECTION, "parseFloat(' -.01e+2')", -1, parseFloat(" -.01e+2") );
+
+ array[item++] = new TestCase( SECTION, "parseFloat(' .01e-2')", 0.0001, parseFloat(" .01e-2") );
+ array[item++] = new TestCase( SECTION, "parseFloat(' +.01e-2')", 0.0001, parseFloat(" +.01e-2") );
+ array[item++] = new TestCase( SECTION, "parseFloat(' -.01e-2')", -0.0001, parseFloat(" -.01e-2") );
+
+ // StrDecimalLiteral::: DecimalDigits ExponentPart opt
+
+ array[item++] = new TestCase( SECTION, "parseFloat(' 1234e5')", 123400000, parseFloat(" 1234e5") );
+ array[item++] = new TestCase( SECTION, "parseFloat(' +1234e5')", 123400000, parseFloat(" +1234e5") );
+ array[item++] = new TestCase( SECTION, "parseFloat(' -1234e5')", -123400000, parseFloat(" -1234e5") );
+
+ array[item++] = new TestCase( SECTION, "parseFloat(' 1234e+5')", 123400000, parseFloat(" 1234e+5") );
+ array[item++] = new TestCase( SECTION, "parseFloat(' +1234e+5')", 123400000, parseFloat(" +1234e+5") );
+ array[item++] = new TestCase( SECTION, "parseFloat(' -1234e+5')", -123400000, parseFloat(" -1234e+5") );
+
+ array[item++] = new TestCase( SECTION, "parseFloat(' 1234e-5')", 0.01234, parseFloat(" 1234e-5") );
+ array[item++] = new TestCase( SECTION, "parseFloat(' +1234e-5')", 0.01234, parseFloat(" +1234e-5") );
+ array[item++] = new TestCase( SECTION, "parseFloat(' -1234e-5')", -0.01234, parseFloat(" -1234e-5") );
+
+
+ array[item++] = new TestCase( SECTION, "parseFloat(' .01E2')", 1, parseFloat(" .01E2") );
+ array[item++] = new TestCase( SECTION, "parseFloat(' +.01E2')", 1, parseFloat(" +.01E2") );
+ array[item++] = new TestCase( SECTION, "parseFloat(' -.01E2')", -1, parseFloat(" -.01E2") );
+
+ array[item++] = new TestCase( SECTION, "parseFloat(' .01E+2')", 1, parseFloat(" .01E+2") );
+ array[item++] = new TestCase( SECTION, "parseFloat(' +.01E+2')", 1, parseFloat(" +.01E+2") );
+ array[item++] = new TestCase( SECTION, "parseFloat(' -.01E+2')", -1, parseFloat(" -.01E+2") );
+
+ array[item++] = new TestCase( SECTION, "parseFloat(' .01E-2')", 0.0001, parseFloat(" .01E-2") );
+ array[item++] = new TestCase( SECTION, "parseFloat(' +.01E-2')", 0.0001, parseFloat(" +.01E-2") );
+ array[item++] = new TestCase( SECTION, "parseFloat(' -.01E-2')", -0.0001, parseFloat(" -.01E-2") );
+
+ // StrDecimalLiteral::: DecimalDigits ExponentPart opt
+ array[item++] = new TestCase( SECTION, "parseFloat(' 1234E5')", 123400000, parseFloat(" 1234E5") );
+ array[item++] = new TestCase( SECTION, "parseFloat(' +1234E5')", 123400000, parseFloat(" +1234E5") );
+ array[item++] = new TestCase( SECTION, "parseFloat(' -1234E5')", -123400000, parseFloat(" -1234E5") );
+
+ array[item++] = new TestCase( SECTION, "parseFloat(' 1234E+5')", 123400000, parseFloat(" 1234E+5") );
+ array[item++] = new TestCase( SECTION, "parseFloat(' +1234E+5')", 123400000, parseFloat(" +1234E+5") );
+ array[item++] = new TestCase( SECTION, "parseFloat(' -1234E+5')", -123400000, parseFloat(" -1234E+5") );
+
+ array[item++] = new TestCase( SECTION, "parseFloat(' 1234E-5')", 0.01234, parseFloat(" 1234E-5") );
+ array[item++] = new TestCase( SECTION, "parseFloat(' +1234E-5')", 0.01234, parseFloat(" +1234E-5") );
+ array[item++] = new TestCase( SECTION, "parseFloat(' -1234E-5')", -0.01234, parseFloat(" -1234E-5") );
+
+
+ // hex cases should all return NaN
+
+ array[item++] = new TestCase( SECTION, "parseFloat(' 0x0')", 0, parseFloat(" 0x0"));
+ array[item++] = new TestCase( SECTION, "parseFloat(' 0x1')", 0, parseFloat(" 0x1"));
+ array[item++] = new TestCase( SECTION, "parseFloat(' 0x2')", 0, parseFloat(" 0x2"));
+ array[item++] = new TestCase( SECTION, "parseFloat(' 0x3')", 0, parseFloat(" 0x3"));
+ array[item++] = new TestCase( SECTION, "parseFloat(' 0x4')", 0, parseFloat(" 0x4"));
+ array[item++] = new TestCase( SECTION, "parseFloat(' 0x5')", 0, parseFloat(" 0x5"));
+ array[item++] = new TestCase( SECTION, "parseFloat(' 0x6')", 0, parseFloat(" 0x6"));
+ array[item++] = new TestCase( SECTION, "parseFloat(' 0x7')", 0, parseFloat(" 0x7"));
+ array[item++] = new TestCase( SECTION, "parseFloat(' 0x8')", 0, parseFloat(" 0x8"));
+ array[item++] = new TestCase( SECTION, "parseFloat(' 0x9')", 0, parseFloat(" 0x9"));
+ array[item++] = new TestCase( SECTION, "parseFloat(' 0xa')", 0, parseFloat(" 0xa"));
+ array[item++] = new TestCase( SECTION, "parseFloat(' 0xb')", 0, parseFloat(" 0xb"));
+ array[item++] = new TestCase( SECTION, "parseFloat(' 0xc')", 0, parseFloat(" 0xc"));
+ array[item++] = new TestCase( SECTION, "parseFloat(' 0xd')", 0, parseFloat(" 0xd"));
+ array[item++] = new TestCase( SECTION, "parseFloat(' 0xe')", 0, parseFloat(" 0xe"));
+ array[item++] = new TestCase( SECTION, "parseFloat(' 0xf')", 0, parseFloat(" 0xf"));
+ array[item++] = new TestCase( SECTION, "parseFloat(' 0xA')", 0, parseFloat(" 0xA"));
+ array[item++] = new TestCase( SECTION, "parseFloat(' 0xB')", 0, parseFloat(" 0xB"));
+ array[item++] = new TestCase( SECTION, "parseFloat(' 0xC')", 0, parseFloat(" 0xC"));
+ array[item++] = new TestCase( SECTION, "parseFloat(' 0xD')", 0, parseFloat(" 0xD"));
+ array[item++] = new TestCase( SECTION, "parseFloat(' 0xE')", 0, parseFloat(" 0xE"));
+ array[item++] = new TestCase( SECTION, "parseFloat(' 0xF')", 0, parseFloat(" 0xF"));
+
+ array[item++] = new TestCase( SECTION, "parseFloat(' 0X0')", 0, parseFloat(" 0X0"));
+ array[item++] = new TestCase( SECTION, "parseFloat(' 0X1')", 0, parseFloat(" 0X1"));
+ array[item++] = new TestCase( SECTION, "parseFloat(' 0X2')", 0, parseFloat(" 0X2"));
+ array[item++] = new TestCase( SECTION, "parseFloat(' 0X3')", 0, parseFloat(" 0X3"));
+ array[item++] = new TestCase( SECTION, "parseFloat(' 0X4')", 0, parseFloat(" 0X4"));
+ array[item++] = new TestCase( SECTION, "parseFloat(' 0X5')", 0, parseFloat(" 0X5"));
+ array[item++] = new TestCase( SECTION, "parseFloat(' 0X6')", 0, parseFloat(" 0X6"));
+ array[item++] = new TestCase( SECTION, "parseFloat(' 0X7')", 0, parseFloat(" 0X7"));
+ array[item++] = new TestCase( SECTION, "parseFloat(' 0X8')", 0, parseFloat(" 0X8"));
+ array[item++] = new TestCase( SECTION, "parseFloat(' 0X9')", 0, parseFloat(" 0X9"));
+ array[item++] = new TestCase( SECTION, "parseFloat(' 0Xa')", 0, parseFloat(" 0Xa"));
+ array[item++] = new TestCase( SECTION, "parseFloat(' 0Xb')", 0, parseFloat(" 0Xb"));
+ array[item++] = new TestCase( SECTION, "parseFloat(' 0Xc')", 0, parseFloat(" 0Xc"));
+ array[item++] = new TestCase( SECTION, "parseFloat(' 0Xd')", 0, parseFloat(" 0Xd"));
+ array[item++] = new TestCase( SECTION, "parseFloat(' 0Xe')", 0, parseFloat(" 0Xe"));
+ array[item++] = new TestCase( SECTION, "parseFloat(' 0Xf')", 0, parseFloat(" 0Xf"));
+ array[item++] = new TestCase( SECTION, "parseFloat(' 0XA')", 0, parseFloat(" 0XA"));
+ array[item++] = new TestCase( SECTION, "parseFloat(' 0XB')", 0, parseFloat(" 0XB"));
+ array[item++] = new TestCase( SECTION, "parseFloat(' 0XC')", 0, parseFloat(" 0XC"));
+ array[item++] = new TestCase( SECTION, "parseFloat(' 0XD')", 0, parseFloat(" 0XD"));
+ array[item++] = new TestCase( SECTION, "parseFloat(' 0XE')", 0, parseFloat(" 0XE"));
+ array[item++] = new TestCase( SECTION, "parseFloat(' 0XF')", 0, parseFloat(" 0XF"));
+
+ // A StringNumericLiteral may not use octal notation
+
+ array[item++] = new TestCase( SECTION, "parseFloat(' 00')", 0, parseFloat(" 00"));
+ array[item++] = new TestCase( SECTION, "parseFloat(' 01')", 1, parseFloat(" 01"));
+ array[item++] = new TestCase( SECTION, "parseFloat(' 02')", 2, parseFloat(" 02"));
+ array[item++] = new TestCase( SECTION, "parseFloat(' 03')", 3, parseFloat(" 03"));
+ array[item++] = new TestCase( SECTION, "parseFloat(' 04')", 4, parseFloat(" 04"));
+ array[item++] = new TestCase( SECTION, "parseFloat(' 05')", 5, parseFloat(" 05"));
+ array[item++] = new TestCase( SECTION, "parseFloat(' 06')", 6, parseFloat(" 06"));
+ array[item++] = new TestCase( SECTION, "parseFloat(' 07')", 7, parseFloat(" 07"));
+ array[item++] = new TestCase( SECTION, "parseFloat(' 010')", 10, parseFloat(" 010"));
+ array[item++] = new TestCase( SECTION, "parseFloat(' 011')", 11, parseFloat(" 011"));
+
+ // A StringNumericLIteral may have any number of leading 0 digits
+
+ array[item++] = new TestCase( SECTION, "parseFloat(' 001')", 1, parseFloat(" 001"));
+ array[item++] = new TestCase( SECTION, "parseFloat(' 0001')", 1, parseFloat(" 0001"));
+
+ // A StringNumericLIteral may have any number of leading 0 digits
+
+ array[item++] = new TestCase( SECTION, "parseFloat(001)", 1, parseFloat(001));
+ array[item++] = new TestCase( SECTION, "parseFloat(0001)", 1, parseFloat(0001));
+
+ // make sure it' s reflexive
+ array[item++] = new TestCase( SECTION, "parseFloat( ' ' +Math.PI+' ')", Math.PI, parseFloat( ' ' +Math.PI+' '));
+ array[item++] = new TestCase( SECTION, "parseFloat( ' ' +Math.LN2+' ')", Math.LN2, parseFloat( ' ' +Math.LN2+' '));
+ array[item++] = new TestCase( SECTION, "parseFloat( ' ' +Math.LN10+' ')", Math.LN10, parseFloat( ' ' +Math.LN10+' '));
+ array[item++] = new TestCase( SECTION, "parseFloat( ' ' +Math.LOG2E+' ')", Math.LOG2E, parseFloat( ' ' +Math.LOG2E+' '));
+ array[item++] = new TestCase( SECTION, "parseFloat( ' ' +Math.LOG10E+' ')", Math.LOG10E, parseFloat( ' ' +Math.LOG10E+' '));
+ array[item++] = new TestCase( SECTION, "parseFloat( ' ' +Math.SQRT2+' ')", Math.SQRT2, parseFloat( ' ' +Math.SQRT2+' '));
+ array[item++] = new TestCase( SECTION, "parseFloat( ' ' +Math.SQRT1_2+' ')", Math.SQRT1_2, parseFloat( ' ' +Math.SQRT1_2+' '));
+
+
+ return ( array );
+}
+function test( array ) {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.4.js b/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.4.js
new file mode 100644
index 0000000..386f3a6
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.4.js
@@ -0,0 +1,206 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.1.2.4.js
+ ECMA Section: 15.1.2.4 Function properties of the global object
+ escape( string )
+
+ Description:
+ The escape function computes a new version of a string value in which
+ certain characters have been replaced by a hexadecimal escape sequence.
+ The result thus contains no special characters that might have special
+ meaning within a URL.
+
+ For characters whose Unicode encoding is 0xFF or less, a two-digit
+ escape sequence of the form %xx is used in accordance with RFC1738.
+ For characters whose Unicode encoding is greater than 0xFF, a four-
+ digit escape sequence of the form %uxxxx is used.
+
+ When the escape function is called with one argument string, the
+ following steps are taken:
+
+ 1. Call ToString(string).
+ 2. Compute the number of characters in Result(1).
+ 3. Let R be the empty string.
+ 4. Let k be 0.
+ 5. If k equals Result(2), return R.
+ 6. Get the character at position k within Result(1).
+ 7. If Result(6) is one of the 69 nonblank ASCII characters
+ ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz
+ 0123456789 @*_+-./, go to step 14.
+ 8. Compute the 16-bit unsigned integer that is the Unicode character
+ encoding of Result(6).
+ 9. If Result(8), is less than 256, go to step 12.
+ 10. Let S be a string containing six characters "%uwxyz" where wxyz are
+ four hexadecimal digits encoding the value of Result(8).
+ 11. Go to step 15.
+ 12. Let S be a string containing three characters "%xy" where xy are two
+ hexadecimal digits encoding the value of Result(8).
+ 13. Go to step 15.
+ 14. Let S be a string containing the single character Result(6).
+ 15. Let R be a new string value computed by concatenating the previous value
+ of R and S.
+ 16. Increase k by 1.
+ 17. Go to step 5.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+ var SECTION = "15.1.2.4";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "escape(string)";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "escape.length", 1, escape.length );
+ array[item++] = new TestCase( SECTION, "escape.length = null; escape.length", 1, eval("escape.length = null; escape.length") );
+ array[item++] = new TestCase( SECTION, "delete escape.length", false, delete escape.length );
+ array[item++] = new TestCase( SECTION, "delete escape.length; escape.length", 1, eval("delete escape.length; escape.length") );
+ array[item++] = new TestCase( SECTION, "var MYPROPS=''; for ( var p in escape ) { MYPROPS+= p}; MYPROPS", "", eval("var MYPROPS=''; for ( var p in escape ) { MYPROPS+= p}; MYPROPS") );
+
+ array[item++] = new TestCase( SECTION, "escape()", "undefined", escape() );
+ array[item++] = new TestCase( SECTION, "escape('')", "", escape('') );
+ array[item++] = new TestCase( SECTION, "escape( null )", "null", escape(null) );
+ array[item++] = new TestCase( SECTION, "escape( void 0 )", "undefined", escape(void 0) );
+ array[item++] = new TestCase( SECTION, "escape( true )", "true", escape( true ) );
+ array[item++] = new TestCase( SECTION, "escape( false )", "false", escape( false ) );
+
+ array[item++] = new TestCase( SECTION, "escape( new Boolean(true) )", "true", escape(new Boolean(true)) );
+ array[item++] = new TestCase( SECTION, "escape( new Boolean(false) )", "false", escape(new Boolean(false)) );
+
+ array[item++] = new TestCase( SECTION, "escape( Number.NaN )", "NaN", escape(Number.NaN) );
+ array[item++] = new TestCase( SECTION, "escape( -0 )", "0", escape( -0 ) );
+ array[item++] = new TestCase( SECTION, "escape( 'Infinity' )", "Infinity", escape( "Infinity" ) );
+ array[item++] = new TestCase( SECTION, "escape( Number.POSITIVE_INFINITY )", "Infinity", escape( Number.POSITIVE_INFINITY ) );
+ array[item++] = new TestCase( SECTION, "escape( Number.NEGATIVE_INFINITY )", "-Infinity", escape( Number.NEGATIVE_INFINITY ) );
+
+ var ASCII_TEST_STRING = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789@*_+-./";
+
+ array[item++] = new TestCase( SECTION, "escape( " +ASCII_TEST_STRING+" )", ASCII_TEST_STRING, escape( ASCII_TEST_STRING ) );
+
+ // ASCII value less than
+
+ for ( var CHARCODE = 0; CHARCODE < 32; CHARCODE++ ) {
+ array[item++] = new TestCase( SECTION,
+ "escape(String.fromCharCode("+CHARCODE+"))",
+ "%"+ToHexString(CHARCODE),
+ escape(String.fromCharCode(CHARCODE)) );
+ }
+ for ( var CHARCODE = 128; CHARCODE < 256; CHARCODE++ ) {
+ array[item++] = new TestCase( SECTION,
+ "escape(String.fromCharCode("+CHARCODE+"))",
+ "%"+ToHexString(CHARCODE),
+ escape(String.fromCharCode(CHARCODE)) );
+ }
+
+ for ( var CHARCODE = 256; CHARCODE < 1024; CHARCODE++ ) {
+ array[item++] = new TestCase( SECTION,
+ "escape(String.fromCharCode("+CHARCODE+"))",
+ "%u"+ ToUnicodeString(CHARCODE),
+ escape(String.fromCharCode(CHARCODE)) );
+ }
+ for ( var CHARCODE = 65500; CHARCODE < 65536; CHARCODE++ ) {
+ array[item++] = new TestCase( SECTION,
+ "escape(String.fromCharCode("+CHARCODE+"))",
+ "%u"+ ToUnicodeString(CHARCODE),
+ escape(String.fromCharCode(CHARCODE)) );
+ }
+
+ return ( array );
+}
+
+function ToUnicodeString( n ) {
+ var string = ToHexString(n);
+
+ for ( var PAD = (4 - string.length ); PAD > 0; PAD-- ) {
+ string = "0" + string;
+ }
+
+ return string;
+}
+function ToHexString( n ) {
+ var hex = new Array();
+
+ for ( var mag = 1; Math.pow(16,mag) <= n ; mag++ ) {
+ ;
+ }
+
+ for ( index = 0, mag -= 1; mag > 0; index++, mag-- ) {
+ hex[index] = Math.floor( n / Math.pow(16,mag) );
+ n -= Math.pow(16,mag) * Math.floor( n/Math.pow(16,mag) );
+ }
+
+ hex[hex.length] = n % 16;
+
+ var string ="";
+
+ for ( var index = 0 ; index < hex.length ; index++ ) {
+ switch ( hex[index] ) {
+ case 10:
+ string += "A";
+ break;
+ case 11:
+ string += "B";
+ break;
+ case 12:
+ string += "C";
+ break;
+ case 13:
+ string += "D";
+ break;
+ case 14:
+ string += "E";
+ break;
+ case 15:
+ string += "F";
+ break;
+ default:
+ string += hex[index];
+ }
+ }
+
+ if ( string.length == 1 ) {
+ string = "0" + string;
+ }
+ return string;
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.5-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.5-1.js
new file mode 100644
index 0000000..da1a6f9
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.5-1.js
@@ -0,0 +1,207 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.1.2.5-1.js
+ ECMA Section: 15.1.2.5 Function properties of the global object
+ unescape( string )
+
+ Description:
+ The unescape function computes a new version of a string value in which
+ each escape sequences of the sort that might be introduced by the escape
+ function is replaced with the character that it represents.
+
+ When the unescape function is called with one argument string, the
+ following steps are taken:
+
+ 1. Call ToString(string).
+ 2. Compute the number of characters in Result(1).
+ 3. Let R be the empty string.
+ 4. Let k be 0.
+ 5. If k equals Result(2), return R.
+ 6. Let c be the character at position k within Result(1).
+ 7. If c is not %, go to step 18.
+ 8. If k is greater than Result(2)-6, go to step 14.
+ 9. If the character at position k+1 within result(1) is not u, go to step
+ 14.
+ 10. If the four characters at positions k+2, k+3, k+4, and k+5 within
+ Result(1) are not all hexadecimal digits, go to step 14.
+ 11. Let c be the character whose Unicode encoding is the integer represented
+ by the four hexadecimal digits at positions k+2, k+3, k+4, and k+5
+ within Result(1).
+ 12. Increase k by 5.
+ 13. Go to step 18.
+ 14. If k is greater than Result(2)-3, go to step 18.
+ 15. If the two characters at positions k+1 and k+2 within Result(1) are not
+ both hexadecimal digits, go to step 18.
+ 16. Let c be the character whose Unicode encoding is the integer represented
+ by two zeroes plus the two hexadecimal digits at positions k+1 and k+2
+ within Result(1).
+ 17. Increase k by 2.
+ 18. Let R be a new string value computed by concatenating the previous value
+ of R and c.
+ 19. Increase k by 1.
+ 20. Go to step 5.
+ Author: christine@netscape.com
+ Date: 28 october 1997
+*/
+
+ var SECTION = "15.1.2.5-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "unescape(string)";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "unescape.length", 1, unescape.length );
+ array[item++] = new TestCase( SECTION, "unescape.length = null; unescape.length", 1, eval("unescape.length=null; unescape.length") );
+ array[item++] = new TestCase( SECTION, "delete unescape.length", false, delete unescape.length );
+ array[item++] = new TestCase( SECTION, "delete unescape.length; unescape.length", 1, eval("delete unescape.length; unescape.length") );
+ array[item++] = new TestCase( SECTION, "var MYPROPS=''; for ( var p in unescape ) { MYPROPS+= p }; MYPROPS", "", eval("var MYPROPS=''; for ( var p in unescape ) { MYPROPS+= p }; MYPROPS") );
+
+ array[item++] = new TestCase( SECTION, "unescape()", "undefined", unescape() );
+ array[item++] = new TestCase( SECTION, "unescape('')", "", unescape('') );
+ array[item++] = new TestCase( SECTION, "unescape( null )", "null", unescape(null) );
+ array[item++] = new TestCase( SECTION, "unescape( void 0 )", "undefined", unescape(void 0) );
+ array[item++] = new TestCase( SECTION, "unescape( true )", "true", unescape( true ) );
+ array[item++] = new TestCase( SECTION, "unescape( false )", "false", unescape( false ) );
+
+ array[item++] = new TestCase( SECTION, "unescape( new Boolean(true) )", "true", unescape(new Boolean(true)) );
+ array[item++] = new TestCase( SECTION, "unescape( new Boolean(false) )", "false", unescape(new Boolean(false)) );
+
+ array[item++] = new TestCase( SECTION, "unescape( Number.NaN )", "NaN", unescape(Number.NaN) );
+ array[item++] = new TestCase( SECTION, "unescape( -0 )", "0", unescape( -0 ) );
+ array[item++] = new TestCase( SECTION, "unescape( 'Infinity' )", "Infinity", unescape( "Infinity" ) );
+ array[item++] = new TestCase( SECTION, "unescape( Number.POSITIVE_INFINITY )", "Infinity", unescape( Number.POSITIVE_INFINITY ) );
+ array[item++] = new TestCase( SECTION, "unescape( Number.NEGATIVE_INFINITY )", "-Infinity", unescape( Number.NEGATIVE_INFINITY ) );
+
+ var ASCII_TEST_STRING = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789@*_+-./";
+
+ array[item++] = new TestCase( SECTION, "unescape( " +ASCII_TEST_STRING+" )", ASCII_TEST_STRING, unescape( ASCII_TEST_STRING ) );
+
+ // escaped chars with ascii values less than 256
+
+ for ( var CHARCODE = 0; CHARCODE < 256; CHARCODE++ ) {
+ array[item++] = new TestCase( SECTION,
+ "unescape( %"+ ToHexString(CHARCODE)+" )",
+ String.fromCharCode(CHARCODE),
+ unescape( "%" + ToHexString(CHARCODE) ) );
+ }
+
+ // unicode chars represented by two hex digits
+ for ( var CHARCODE = 0; CHARCODE < 256; CHARCODE++ ) {
+ array[item++] = new TestCase( SECTION,
+ "unescape( %u"+ ToHexString(CHARCODE)+" )",
+ "%u"+ToHexString(CHARCODE),
+ unescape( "%u" + ToHexString(CHARCODE) ) );
+ }
+/*
+ for ( var CHARCODE = 0; CHARCODE < 256; CHARCODE++ ) {
+ array[item++] = new TestCase( SECTION,
+ "unescape( %u"+ ToUnicodeString(CHARCODE)+" )",
+ String.fromCharCode(CHARCODE),
+ unescape( "%u" + ToUnicodeString(CHARCODE) ) );
+ }
+ for ( var CHARCODE = 256; CHARCODE < 65536; CHARCODE+= 333 ) {
+ array[item++] = new TestCase( SECTION,
+ "unescape( %u"+ ToUnicodeString(CHARCODE)+" )",
+ String.fromCharCode(CHARCODE),
+ unescape( "%u" + ToUnicodeString(CHARCODE) ) );
+ }
+*/
+ return ( array );
+}
+
+function ToUnicodeString( n ) {
+ var string = ToHexString(n);
+
+ for ( var PAD = (4 - string.length ); PAD > 0; PAD-- ) {
+ string = "0" + string;
+ }
+
+ return string;
+}
+function ToHexString( n ) {
+ var hex = new Array();
+
+ for ( var mag = 1; Math.pow(16,mag) <= n ; mag++ ) {
+ ;
+ }
+
+ for ( index = 0, mag -= 1; mag > 0; index++, mag-- ) {
+ hex[index] = Math.floor( n / Math.pow(16,mag) );
+ n -= Math.pow(16,mag) * Math.floor( n/Math.pow(16,mag) );
+ }
+
+ hex[hex.length] = n % 16;
+
+ var string ="";
+
+ for ( var index = 0 ; index < hex.length ; index++ ) {
+ switch ( hex[index] ) {
+ case 10:
+ string += "A";
+ break;
+ case 11:
+ string += "B";
+ break;
+ case 12:
+ string += "C";
+ break;
+ case 13:
+ string += "D";
+ break;
+ case 14:
+ string += "E";
+ break;
+ case 15:
+ string += "F";
+ break;
+ default:
+ string += hex[index];
+ }
+ }
+
+ if ( string.length == 1 ) {
+ string = "0" + string;
+ }
+ return string;
+}
+function test( array ) {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.5-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.5-2.js
new file mode 100644
index 0000000..d8fc253
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.5-2.js
@@ -0,0 +1,184 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.1.2.5-2.js
+ ECMA Section: 15.1.2.5 Function properties of the global object
+ unescape( string )
+ Description:
+
+ This tests the cases where there are fewer than 4 characters following "%u",
+ or fewer than 2 characters following "%" or "%u".
+
+ The unescape function computes a new version of a string value in which
+ each escape sequences of the sort that might be introduced by the escape
+ function is replaced with the character that it represents.
+
+ When the unescape function is called with one argument string, the
+ following steps are taken:
+
+ 1. Call ToString(string).
+ 2. Compute the number of characters in Result(1).
+ 3. Let R be the empty string.
+ 4. Let k be 0.
+ 5. If k equals Result(2), return R.
+ 6. Let c be the character at position k within Result(1).
+ 7. If c is not %, go to step 18.
+ 8. If k is greater than Result(2)-6, go to step 14.
+ 9. If the character at position k+1 within result(1) is not u, go to step
+ 14.
+ 10. If the four characters at positions k+2, k+3, k+4, and k+5 within
+ Result(1) are not all hexadecimal digits, go to step 14.
+ 11. Let c be the character whose Unicode encoding is the integer represented
+ by the four hexadecimal digits at positions k+2, k+3, k+4, and k+5
+ within Result(1).
+ 12. Increase k by 5.
+ 13. Go to step 18.
+ 14. If k is greater than Result(2)-3, go to step 18.
+ 15. If the two characters at positions k+1 and k+2 within Result(1) are not
+ both hexadecimal digits, go to step 18.
+ 16. Let c be the character whose Unicode encoding is the integer represented
+ by two zeroes plus the two hexadecimal digits at positions k+1 and k+2
+ within Result(1).
+ 17. Increase k by 2.
+ 18. Let R be a new string value computed by concatenating the previous value
+ of R and c.
+ 19. Increase k by 1.
+ 20. Go to step 5.
+ Author: christine@netscape.com
+ Date: 28 october 1997
+*/
+
+ var SECTION = "15.1.2.5-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "unescape(string)";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ // since there is only one character following "%", no conversion should occur.
+
+ for ( var CHARCODE = 0; CHARCODE < 256; CHARCODE += 16 ) {
+ array[item++] = new TestCase( SECTION,
+ "unescape( %"+ (ToHexString(CHARCODE)).substring(0,1) +" )",
+ "%"+(ToHexString(CHARCODE)).substring(0,1),
+ unescape( "%" + (ToHexString(CHARCODE)).substring(0,1) ) );
+ }
+
+ // since there is only one character following "%u", no conversion should occur.
+
+ for ( var CHARCODE = 0; CHARCODE < 256; CHARCODE +=16 ) {
+ array[item++] = new TestCase( SECTION,
+ "unescape( %u"+ (ToHexString(CHARCODE)).substring(0,1) +" )",
+ "%u"+(ToHexString(CHARCODE)).substring(0,1),
+ unescape( "%u" + (ToHexString(CHARCODE)).substring(0,1) ) );
+ }
+
+
+ // three char unicode string. no conversion should occur
+
+ for ( var CHARCODE = 1024; CHARCODE < 65536; CHARCODE+= 1234 ) {
+ array[item++] = new TestCase
+ ( SECTION,
+ "unescape( %u"+ (ToUnicodeString(CHARCODE)).substring(0,3)+ " )",
+
+ "%u"+(ToUnicodeString(CHARCODE)).substring(0,3),
+ unescape( "%u"+(ToUnicodeString(CHARCODE)).substring(0,3) )
+ );
+ }
+
+ return ( array );
+}
+
+function ToUnicodeString( n ) {
+ var string = ToHexString(n);
+
+ for ( var PAD = (4 - string.length ); PAD > 0; PAD-- ) {
+ string = "0" + string;
+ }
+
+ return string;
+}
+function ToHexString( n ) {
+ var hex = new Array();
+
+ for ( var mag = 1; Math.pow(16,mag) <= n ; mag++ ) {
+ ;
+ }
+
+ for ( index = 0, mag -= 1; mag > 0; index++, mag-- ) {
+ hex[index] = Math.floor( n / Math.pow(16,mag) );
+ n -= Math.pow(16,mag) * Math.floor( n/Math.pow(16,mag) );
+ }
+
+ hex[hex.length] = n % 16;
+
+ var string ="";
+
+ for ( var index = 0 ; index < hex.length ; index++ ) {
+ switch ( hex[index] ) {
+ case 10:
+ string += "A";
+ break;
+ case 11:
+ string += "B";
+ break;
+ case 12:
+ string += "C";
+ break;
+ case 13:
+ string += "D";
+ break;
+ case 14:
+ string += "E";
+ break;
+ case 15:
+ string += "F";
+ break;
+ default:
+ string += hex[index];
+ }
+ }
+
+ if ( string.length == 1 ) {
+ string = "0" + string;
+ }
+ return string;
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.5-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.5-3.js
new file mode 100644
index 0000000..9fa83f3
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.5-3.js
@@ -0,0 +1,207 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.1.2.5-3.js
+ ECMA Section: 15.1.2.5 Function properties of the global object
+ unescape( string )
+
+ Description:
+ This tests the cases where one of the four characters following "%u" is
+ not a hexidecimal character, or one of the two characters following "%"
+ or "%u" is not a hexidecimal character.
+
+ The unescape function computes a new version of a string value in which
+ each escape sequences of the sort that might be introduced by the escape
+ function is replaced with the character that it represents.
+
+ When the unescape function is called with one argument string, the
+ following steps are taken:
+
+ 1. Call ToString(string).
+ 2. Compute the number of characters in Result(1).
+ 3. Let R be the empty string.
+ 4. Let k be 0.
+ 5. If k equals Result(2), return R.
+ 6. Let c be the character at position k within Result(1).
+ 7. If c is not %, go to step 18.
+ 8. If k is greater than Result(2)-6, go to step 14.
+ 9. If the character at position k+1 within result(1) is not u, go to step
+ 14.
+ 10. If the four characters at positions k+2, k+3, k+4, and k+5 within
+ Result(1) are not all hexadecimal digits, go to step 14.
+ 11. Let c be the character whose Unicode encoding is the integer represented
+ by the four hexadecimal digits at positions k+2, k+3, k+4, and k+5
+ within Result(1).
+ 12. Increase k by 5.
+ 13. Go to step 18.
+ 14. If k is greater than Result(2)-3, go to step 18.
+ 15. If the two characters at positions k+1 and k+2 within Result(1) are not
+ both hexadecimal digits, go to step 18.
+ 16. Let c be the character whose Unicode encoding is the integer represented
+ by two zeroes plus the two hexadecimal digits at positions k+1 and k+2
+ within Result(1).
+ 17. Increase k by 2.
+ 18. Let R be a new string value computed by concatenating the previous value
+ of R and c.
+ 19. Increase k by 1.
+ 20. Go to step 5.
+ Author: christine@netscape.com
+ Date: 28 october 1997
+*/
+
+
+ var SECTION = "15.1.2.5-3";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "unescape(string)";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ for ( var CHARCODE = 0, NONHEXCHARCODE = 0; CHARCODE < 256; CHARCODE++, NONHEXCHARCODE++ ) {
+ NONHEXCHARCODE = getNextNonHexCharCode( NONHEXCHARCODE );
+
+ array[item++] = new TestCase( SECTION,
+ "unescape( %"+ (ToHexString(CHARCODE)).substring(0,1) +
+ String.fromCharCode( NONHEXCHARCODE ) +" )" +
+ "[where last character is String.fromCharCode("+NONHEXCHARCODE+")]",
+ "%"+(ToHexString(CHARCODE)).substring(0,1)+
+ String.fromCharCode( NONHEXCHARCODE ),
+ unescape( "%" + (ToHexString(CHARCODE)).substring(0,1)+
+ String.fromCharCode( NONHEXCHARCODE ) ) );
+ }
+ for ( var CHARCODE = 0, NONHEXCHARCODE = 0; CHARCODE < 256; CHARCODE++, NONHEXCHARCODE++ ) {
+ NONHEXCHARCODE = getNextNonHexCharCode( NONHEXCHARCODE );
+
+ array[item++] = new TestCase( SECTION,
+ "unescape( %u"+ (ToHexString(CHARCODE)).substring(0,1) +
+ String.fromCharCode( NONHEXCHARCODE ) +" )" +
+ "[where last character is String.fromCharCode("+NONHEXCHARCODE+")]",
+ "%u"+(ToHexString(CHARCODE)).substring(0,1)+
+ String.fromCharCode( NONHEXCHARCODE ),
+ unescape( "%u" + (ToHexString(CHARCODE)).substring(0,1)+
+ String.fromCharCode( NONHEXCHARCODE ) ) );
+ }
+
+ for ( var CHARCODE = 0, NONHEXCHARCODE = 0 ; CHARCODE < 65536; CHARCODE+= 54321, NONHEXCHARCODE++ ) {
+ NONHEXCHARCODE = getNextNonHexCharCode( NONHEXCHARCODE );
+
+ array[item++] = new TestCase( SECTION,
+ "unescape( %u"+ (ToUnicodeString(CHARCODE)).substring(0,3) +
+ String.fromCharCode( NONHEXCHARCODE ) +" )" +
+ "[where last character is String.fromCharCode("+NONHEXCHARCODE+")]",
+
+ String.fromCharCode(eval("0x"+ (ToUnicodeString(CHARCODE)).substring(0,2))) +
+ (ToUnicodeString(CHARCODE)).substring(2,3) +
+ String.fromCharCode( NONHEXCHARCODE ),
+
+ unescape( "%" + (ToUnicodeString(CHARCODE)).substring(0,3)+
+ String.fromCharCode( NONHEXCHARCODE ) ) );
+ }
+
+ return ( array );
+}
+function getNextNonHexCharCode( n ) {
+ for ( ; n < Math.pow(2,16); n++ ) {
+ if ( ( n == 43 || n == 45 || n == 46 || n == 47 ||
+ (n >= 71 && n <= 90) || (n >= 103 && n <= 122) ||
+ n == 64 || n == 95 ) ) {
+ break;
+ } else {
+ n = ( n > 122 ) ? 0 : n;
+ }
+ }
+ return n;
+}
+function ToUnicodeString( n ) {
+ var string = ToHexString(n);
+
+ for ( var PAD = (4 - string.length ); PAD > 0; PAD-- ) {
+ string = "0" + string;
+ }
+
+ return string;
+}
+function ToHexString( n ) {
+ var hex = new Array();
+
+ for ( var mag = 1; Math.pow(16,mag) <= n ; mag++ ) {
+ ;
+ }
+
+ for ( index = 0, mag -= 1; mag > 0; index++, mag-- ) {
+ hex[index] = Math.floor( n / Math.pow(16,mag) );
+ n -= Math.pow(16,mag) * Math.floor( n/Math.pow(16,mag) );
+ }
+
+ hex[hex.length] = n % 16;
+
+ var string ="";
+
+ for ( var index = 0 ; index < hex.length ; index++ ) {
+ switch ( hex[index] ) {
+ case 10:
+ string += "A";
+ break;
+ case 11:
+ string += "B";
+ break;
+ case 12:
+ string += "C";
+ break;
+ case 13:
+ string += "D";
+ break;
+ case 14:
+ string += "E";
+ break;
+ case 15:
+ string += "F";
+ break;
+ default:
+ string += hex[index];
+ }
+ }
+
+ if ( string.length == 1 ) {
+ string = "0" + string;
+ }
+ return string;
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.6.js b/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.6.js
new file mode 100644
index 0000000..053dab4
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.6.js
@@ -0,0 +1,127 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.1.2.6.js
+ ECMA Section: 15.1.2.6 isNaN( x )
+
+ Description: Applies ToNumber to its argument, then returns true if
+ the result isNaN and otherwise returns false.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+ var SECTION = "15.1.2.6";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "isNaN( x )";
+
+ var BUGNUMBER = "77391";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+
+ test();
+
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "isNaN.length", 1, isNaN.length );
+ array[item++] = new TestCase( SECTION, "var MYPROPS=''; for ( var p in isNaN ) { MYPROPS+= p }; MYPROPS", "", eval("var MYPROPS=''; for ( var p in isNaN ) { MYPROPS+= p }; MYPROPS") );
+ array[item++] = new TestCase( SECTION, "isNaN.length = null; isNaN.length", 1, eval("isNaN.length=null; isNaN.length") );
+ array[item++] = new TestCase( SECTION, "delete isNaN.length", false, delete isNaN.length );
+ array[item++] = new TestCase( SECTION, "delete isNaN.length; isNaN.length", 1, eval("delete isNaN.length; isNaN.length") );
+
+// array[item++] = new TestCase( SECTION, "isNaN.__proto__", Function.prototype, isNaN.__proto__ );
+
+ array[item++] = new TestCase( SECTION, "isNaN()", true, isNaN() );
+ array[item++] = new TestCase( SECTION, "isNaN( null )", false, isNaN(null) );
+ array[item++] = new TestCase( SECTION, "isNaN( void 0 )", true, isNaN(void 0) );
+ array[item++] = new TestCase( SECTION, "isNaN( true )", false, isNaN(true) );
+ array[item++] = new TestCase( SECTION, "isNaN( false)", false, isNaN(false) );
+ array[item++] = new TestCase( SECTION, "isNaN( ' ' )", false, isNaN( " " ) );
+
+ array[item++] = new TestCase( SECTION, "isNaN( 0 )", false, isNaN(0) );
+ array[item++] = new TestCase( SECTION, "isNaN( 1 )", false, isNaN(1) );
+ array[item++] = new TestCase( SECTION, "isNaN( 2 )", false, isNaN(2) );
+ array[item++] = new TestCase( SECTION, "isNaN( 3 )", false, isNaN(3) );
+ array[item++] = new TestCase( SECTION, "isNaN( 4 )", false, isNaN(4) );
+ array[item++] = new TestCase( SECTION, "isNaN( 5 )", false, isNaN(5) );
+ array[item++] = new TestCase( SECTION, "isNaN( 6 )", false, isNaN(6) );
+ array[item++] = new TestCase( SECTION, "isNaN( 7 )", false, isNaN(7) );
+ array[item++] = new TestCase( SECTION, "isNaN( 8 )", false, isNaN(8) );
+ array[item++] = new TestCase( SECTION, "isNaN( 9 )", false, isNaN(9) );
+
+ array[item++] = new TestCase( SECTION, "isNaN( '0' )", false, isNaN('0') );
+ array[item++] = new TestCase( SECTION, "isNaN( '1' )", false, isNaN('1') );
+ array[item++] = new TestCase( SECTION, "isNaN( '2' )", false, isNaN('2') );
+ array[item++] = new TestCase( SECTION, "isNaN( '3' )", false, isNaN('3') );
+ array[item++] = new TestCase( SECTION, "isNaN( '4' )", false, isNaN('4') );
+ array[item++] = new TestCase( SECTION, "isNaN( '5' )", false, isNaN('5') );
+ array[item++] = new TestCase( SECTION, "isNaN( '6' )", false, isNaN('6') );
+ array[item++] = new TestCase( SECTION, "isNaN( '7' )", false, isNaN('7') );
+ array[item++] = new TestCase( SECTION, "isNaN( '8' )", false, isNaN('8') );
+ array[item++] = new TestCase( SECTION, "isNaN( '9' )", false, isNaN('9') );
+
+
+ array[item++] = new TestCase( SECTION, "isNaN( 0x0a )", false, isNaN( 0x0a ) );
+ array[item++] = new TestCase( SECTION, "isNaN( 0xaa )", false, isNaN( 0xaa ) );
+ array[item++] = new TestCase( SECTION, "isNaN( 0x0A )", false, isNaN( 0x0A ) );
+ array[item++] = new TestCase( SECTION, "isNaN( 0xAA )", false, isNaN( 0xAA ) );
+
+ array[item++] = new TestCase( SECTION, "isNaN( '0x0a' )", false, isNaN( "0x0a" ) );
+ array[item++] = new TestCase( SECTION, "isNaN( '0xaa' )", false, isNaN( "0xaa" ) );
+ array[item++] = new TestCase( SECTION, "isNaN( '0x0A' )", false, isNaN( "0x0A" ) );
+ array[item++] = new TestCase( SECTION, "isNaN( '0xAA' )", false, isNaN( "0xAA" ) );
+
+ array[item++] = new TestCase( SECTION, "isNaN( 077 )", false, isNaN( 077 ) );
+ array[item++] = new TestCase( SECTION, "isNaN( '077' )", false, isNaN( "077" ) );
+
+
+ array[item++] = new TestCase( SECTION, "isNaN( Number.NaN )", true, isNaN(Number.NaN) );
+ array[item++] = new TestCase( SECTION, "isNaN( Number.POSITIVE_INFINITY )", false, isNaN(Number.POSITIVE_INFINITY) );
+ array[item++] = new TestCase( SECTION, "isNaN( Number.NEGATIVE_INFINITY )", false, isNaN(Number.NEGATIVE_INFINITY) );
+ array[item++] = new TestCase( SECTION, "isNaN( Number.MAX_VALUE )", false, isNaN(Number.MAX_VALUE) );
+ array[item++] = new TestCase( SECTION, "isNaN( Number.MIN_VALUE )", false, isNaN(Number.MIN_VALUE) );
+
+ array[item++] = new TestCase( SECTION, "isNaN( NaN )", true, isNaN(NaN) );
+ array[item++] = new TestCase( SECTION, "isNaN( Infinity )", false, isNaN(Infinity) );
+
+ array[item++] = new TestCase( SECTION, "isNaN( 'Infinity' )", false, isNaN("Infinity") );
+ array[item++] = new TestCase( SECTION, "isNaN( '-Infinity' )", false, isNaN("-Infinity") );
+
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.7.js b/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.7.js
new file mode 100644
index 0000000..df384fa
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/GlobalObject/15.1.2.7.js
@@ -0,0 +1,131 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.1.2.7.js
+ ECMA Section: 15.1.2.7 isFinite(number)
+
+ Description: Applies ToNumber to its argument, then returns false if
+ the result is NaN, Infinity, or -Infinity, and otherwise
+ returns true.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+ var SECTION = "15.1.2.7";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "isFinite( x )";
+
+ var BUGNUMBER= "77391";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "isFinite.length", 1, isFinite.length );
+ array[item++] = new TestCase( SECTION, "isFinite.length = null; isFinite.length", 1, eval("isFinite.length=null; isFinite.length") );
+ array[item++] = new TestCase( SECTION, "delete isFinite.length", false, delete isFinite.length );
+ array[item++] = new TestCase( SECTION, "delete isFinite.length; isFinite.length", 1, eval("delete isFinite.length; isFinite.length") );
+ array[item++] = new TestCase( SECTION, "var MYPROPS=''; for ( p in isFinite ) { MYPROPS+= p }; MYPROPS", "", eval("var MYPROPS=''; for ( p in isFinite ) { MYPROPS += p }; MYPROPS") );
+
+ array[item++] = new TestCase( SECTION, "isFinite()", false, isFinite() );
+ array[item++] = new TestCase( SECTION, "isFinite( null )", true, isFinite(null) );
+ array[item++] = new TestCase( SECTION, "isFinite( void 0 )", false, isFinite(void 0) );
+ array[item++] = new TestCase( SECTION, "isFinite( false )", true, isFinite(false) );
+ array[item++] = new TestCase( SECTION, "isFinite( true)", true, isFinite(true) );
+ array[item++] = new TestCase( SECTION, "isFinite( ' ' )", true, isFinite( " " ) );
+
+ array[item++] = new TestCase( SECTION, "isFinite( new Boolean(true) )", true, isFinite(new Boolean(true)) );
+ array[item++] = new TestCase( SECTION, "isFinite( new Boolean(false) )", true, isFinite(new Boolean(false)) );
+
+ array[item++] = new TestCase( SECTION, "isFinite( 0 )", true, isFinite(0) );
+ array[item++] = new TestCase( SECTION, "isFinite( 1 )", true, isFinite(1) );
+ array[item++] = new TestCase( SECTION, "isFinite( 2 )", true, isFinite(2) );
+ array[item++] = new TestCase( SECTION, "isFinite( 3 )", true, isFinite(3) );
+ array[item++] = new TestCase( SECTION, "isFinite( 4 )", true, isFinite(4) );
+ array[item++] = new TestCase( SECTION, "isFinite( 5 )", true, isFinite(5) );
+ array[item++] = new TestCase( SECTION, "isFinite( 6 )", true, isFinite(6) );
+ array[item++] = new TestCase( SECTION, "isFinite( 7 )", true, isFinite(7) );
+ array[item++] = new TestCase( SECTION, "isFinite( 8 )", true, isFinite(8) );
+ array[item++] = new TestCase( SECTION, "isFinite( 9 )", true, isFinite(9) );
+
+ array[item++] = new TestCase( SECTION, "isFinite( '0' )", true, isFinite('0') );
+ array[item++] = new TestCase( SECTION, "isFinite( '1' )", true, isFinite('1') );
+ array[item++] = new TestCase( SECTION, "isFinite( '2' )", true, isFinite('2') );
+ array[item++] = new TestCase( SECTION, "isFinite( '3' )", true, isFinite('3') );
+ array[item++] = new TestCase( SECTION, "isFinite( '4' )", true, isFinite('4') );
+ array[item++] = new TestCase( SECTION, "isFinite( '5' )", true, isFinite('5') );
+ array[item++] = new TestCase( SECTION, "isFinite( '6' )", true, isFinite('6') );
+ array[item++] = new TestCase( SECTION, "isFinite( '7' )", true, isFinite('7') );
+ array[item++] = new TestCase( SECTION, "isFinite( '8' )", true, isFinite('8') );
+ array[item++] = new TestCase( SECTION, "isFinite( '9' )", true, isFinite('9') );
+
+ array[item++] = new TestCase( SECTION, "isFinite( 0x0a )", true, isFinite( 0x0a ) );
+ array[item++] = new TestCase( SECTION, "isFinite( 0xaa )", true, isFinite( 0xaa ) );
+ array[item++] = new TestCase( SECTION, "isFinite( 0x0A )", true, isFinite( 0x0A ) );
+ array[item++] = new TestCase( SECTION, "isFinite( 0xAA )", true, isFinite( 0xAA ) );
+
+ array[item++] = new TestCase( SECTION, "isFinite( '0x0a' )", true, isFinite( "0x0a" ) );
+ array[item++] = new TestCase( SECTION, "isFinite( '0xaa' )", true, isFinite( "0xaa" ) );
+ array[item++] = new TestCase( SECTION, "isFinite( '0x0A' )", true, isFinite( "0x0A" ) );
+ array[item++] = new TestCase( SECTION, "isFinite( '0xAA' )", true, isFinite( "0xAA" ) );
+
+ array[item++] = new TestCase( SECTION, "isFinite( 077 )", true, isFinite( 077 ) );
+ array[item++] = new TestCase( SECTION, "isFinite( '077' )", true, isFinite( "077" ) );
+
+ array[item++] = new TestCase( SECTION, "isFinite( new String('Infinity') )", false, isFinite(new String("Infinity")) );
+ array[item++] = new TestCase( SECTION, "isFinite( new String('-Infinity') )", false, isFinite(new String("-Infinity")) );
+
+ array[item++] = new TestCase( SECTION, "isFinite( 'Infinity' )", false, isFinite("Infinity") );
+ array[item++] = new TestCase( SECTION, "isFinite( '-Infinity' )", false, isFinite("-Infinity") );
+ array[item++] = new TestCase( SECTION, "isFinite( Number.POSITIVE_INFINITY )", false, isFinite(Number.POSITIVE_INFINITY) );
+ array[item++] = new TestCase( SECTION, "isFinite( Number.NEGATIVE_INFINITY )", false, isFinite(Number.NEGATIVE_INFINITY) );
+ array[item++] = new TestCase( SECTION, "isFinite( Number.NaN )", false, isFinite(Number.NaN) );
+
+ array[item++] = new TestCase( SECTION, "isFinite( Infinity )", false, isFinite(Infinity) );
+ array[item++] = new TestCase( SECTION, "isFinite( -Infinity )", false, isFinite(-Infinity) );
+ array[item++] = new TestCase( SECTION, "isFinite( NaN )", false, isFinite(NaN) );
+
+
+ array[item++] = new TestCase( SECTION, "isFinite( Number.MAX_VALUE )", true, isFinite(Number.MAX_VALUE) );
+ array[item++] = new TestCase( SECTION, "isFinite( Number.MIN_VALUE )", true, isFinite(Number.MIN_VALUE) );
+
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.1-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.1-1.js
new file mode 100644
index 0000000..d801063
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.1-1.js
@@ -0,0 +1,86 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 7.1-1.js
+ ECMA Section: 7.1 White Space
+ Description: - readability
+ - separate tokens
+ - otherwise should be insignificant
+ - in strings, white space characters are significant
+ - cannot appear within any other kind of token
+
+ white space characters are:
+ unicode name formal name string representation
+ \u0009 tab <TAB> \t
+ \u000B veritical tab <VT> \v
+ \U000C form feed <FF> \f
+ \u0020 space <SP> " "
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+
+ var SECTION = "7.1-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "White Space";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ // whitespace between var keyword and identifier
+
+ array[item++] = new TestCase( SECTION, 'var'+'\t'+'MYVAR1=10;MYVAR1', 10, eval('var'+'\t'+'MYVAR1=10;MYVAR1') );
+ array[item++] = new TestCase( SECTION, 'var'+'\f'+'MYVAR2=10;MYVAR2', 10, eval('var'+'\f'+'MYVAR2=10;MYVAR2') );
+ array[item++] = new TestCase( SECTION, 'var'+'\v'+'MYVAR2=10;MYVAR2', 10, eval('var'+'\v'+'MYVAR2=10;MYVAR2') );
+ array[item++] = new TestCase( SECTION, 'var'+'\ '+'MYVAR2=10;MYVAR2', 10, eval('var'+'\ '+'MYVAR2=10;MYVAR2') );
+
+ // use whitespace between tokens object name, dot operator, and object property
+
+ array[item++] = new TestCase( SECTION,
+ "var a = new Array(12345); a\t\v\f .\\u0009\\000B\\u000C\\u0020length",
+ 12345,
+ eval("var a = new Array(12345); a\t\v\f .\u0009\u0020\u000C\u000Blength") );
+
+
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.1-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.1-2.js
new file mode 100644
index 0000000..04da3c9
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.1-2.js
@@ -0,0 +1,74 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 7.1-2.js
+ ECMA Section: 7.1 White Space
+ Description: - readability
+ - separate tokens
+ - otherwise should be insignificant
+ - in strings, white space characters are significant
+ - cannot appear within any other kind of token
+
+ white space characters are:
+ unicode name formal name string representation
+ \u0009 tab <TAB> \t
+ \u000B veritical tab <VT> ??
+ \U000C form feed <FF> \f
+ \u0020 space <SP> " "
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+
+ var SECTION = "7.1-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "White Space";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION, "'var'+'\u000B'+'MYVAR1=10;MYVAR1'", 10, eval('var'+'\u000B'+'MYVAR1=10;MYVAR1') );
+ array[item++] = new TestCase( SECTION, "'var'+'\u0009'+'MYVAR2=10;MYVAR2'", 10, eval('var'+'\u0009'+'MYVAR2=10;MYVAR2') );
+ array[item++] = new TestCase( SECTION, "'var'+'\u000C'+'MYVAR3=10;MYVAR3'", 10, eval('var'+'\u000C'+'MYVAR3=10;MYVAR3') );
+ array[item++] = new TestCase( SECTION, "'var'+'\u0020'+'MYVAR4=10;MYVAR4'", 10, eval('var'+'\u0020'+'MYVAR4=10;MYVAR4') );
+
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.1-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.1-3.js
new file mode 100644
index 0000000..c9c6ae1
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.1-3.js
@@ -0,0 +1,92 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 7.1-3.js
+ ECMA Section: 7.1 White Space
+ Description: - readability
+ - separate tokens
+ - otherwise should be insignificant
+ - in strings, white space characters are significant
+ - cannot appear within any other kind of token
+
+ white space characters are:
+ unicode name formal name string representation
+ \u0009 tab <TAB> \t
+ \u000B veritical tab <VT> ??
+ \U000C form feed <FF> \f
+ \u0020 space <SP> " "
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+
+ var SECTION = "7.1-3";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "White Space";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION, "'var'+'\u000B'+'MYVAR1=10;MYVAR1'", 10, eval('var'+'\u000B'+'MYVAR1=10;MYVAR1') );
+ array[item++] = new TestCase( SECTION, "'var'+'\u0009'+'MYVAR2=10;MYVAR2'", 10, eval('var'+'\u0009'+'MYVAR2=10;MYVAR2') );
+ array[item++] = new TestCase( SECTION, "'var'+'\u000C'+'MYVAR3=10;MYVAR3'", 10, eval('var'+'\u000C'+'MYVAR3=10;MYVAR3') );
+ array[item++] = new TestCase( SECTION, "'var'+'\u0020'+'MYVAR4=10;MYVAR4'", 10, eval('var'+'\u0020'+'MYVAR4=10;MYVAR4') );
+
+ // +<white space>+ should be interpreted as the unary + operator twice, not as a post or prefix increment operator
+
+ array[item++] = new TestCase( SECTION,
+ "var VAR = 12345; + + VAR",
+ 12345,
+ eval("var VAR = 12345; + + VAR") );
+
+ array[item++] = new TestCase( SECTION,
+ "var VAR = 12345;VAR+ + VAR",
+ 24690,
+ eval("var VAR = 12345;VAR+ +VAR") );
+ array[item++] = new TestCase( SECTION,
+ "var VAR = 12345;VAR - - VAR",
+ 24690,
+ eval("var VAR = 12345;VAR- -VAR") );
+
+
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.2-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.2-1.js
new file mode 100644
index 0000000..4936984
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.2-1.js
@@ -0,0 +1,75 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 7.2-1.js
+ ECMA Section: 7.2 Line Terminators
+ Description: - readability
+ - separate tokens
+ - may occur between any two tokens
+ - cannot occur within any token, not even a string
+ - affect the process of automatic semicolon insertion.
+
+ white space characters are:
+ unicode name formal name string representation
+ \u000A line feed <LF> \n
+ \u000D carriage return <CR> \r
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+ var SECTION = "7.2-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Line Terminators";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "var a\nb = 5; ab=10;ab;", 10, eval("var a\nb = 5; ab=10;ab") );
+ array[item++] = new TestCase( SECTION, "var a\nb = 5; ab=10;b;", 5, eval("var a\nb = 5; ab=10;b") );
+ array[item++] = new TestCase( SECTION, "var a\rb = 5; ab=10;ab;", 10, eval("var a\rb = 5; ab=10;ab") );
+ array[item++] = new TestCase( SECTION, "var a\rb = 5; ab=10;b;", 5, eval("var a\rb = 5; ab=10;b") );
+ array[item++] = new TestCase( SECTION, "var a\r\nb = 5; ab=10;ab;", 10, eval("var a\r\nb = 5; ab=10;ab") );
+ array[item++] = new TestCase( SECTION, "var a\r\nb = 5; ab=10;b;", 5, eval("var a\r\nb = 5; ab=10;b") );
+
+ return ( array );
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.2-2-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.2-2-n.js
new file mode 100644
index 0000000..268fc56
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.2-2-n.js
@@ -0,0 +1,80 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 7.2.js
+ ECMA Section: 7.2 Line Terminators
+ Description: - readability
+ - separate tokens
+ - may occur between any two tokens
+ - cannot occur within any token, not even a string
+ - affect the process of automatic semicolon insertion.
+
+ white space characters are:
+ unicode name formal name string representation
+ \u000A line feed <LF> \n
+ \u000D carriage return <CR> \r
+
+ this test uses onerror to capture line numbers. because
+ we use on error, we can only have one test case per file.
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+ var SECTION = "7.2-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Line Terminators";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function test() {
+ // this is line 29
+ a = "\r\r\r\nb";
+ eval( a );
+
+ // if we get this far, the test failed.
+ testcases[tc].passed = writeTestCaseResult(
+ "failure on line" + testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[0].passed = false;
+
+ testcases[tc].reason = "test should have caused runtime error ";
+
+ stopTest();
+
+ return ( testcases );
+}
+
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[0] = new TestCase( "7.2", "<cr>a", "error", "");
+
+ return ( array );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.2-3-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.2-3-n.js
new file mode 100644
index 0000000..ff3753d
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.2-3-n.js
@@ -0,0 +1,83 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 7.2-3.js
+ ECMA Section: 7.2 Line Terminators
+ Description: - readability
+ - separate tokens
+ - may occur between any two tokens
+ - cannot occur within any token, not even a string
+ - affect the process of automatic semicolon insertion.
+
+ white space characters are:
+ unicode name formal name string representation
+ \u000A line feed <LF> \n
+ \u000D carriage return <CR> \r
+
+ this test uses onerror to capture line numbers. because
+ we use on error, we can only have one test case per file.
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+ var SECTION = "7.2-3";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Line Terminators";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function test() {
+
+ // this is line 27
+
+ a = "\r\nb";
+ eval( a );
+
+ // if we get this far, the test failed.
+ testcases[tc].passed = writeTestCaseResult(
+ "failure on line" + testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[0].passed = false;
+
+ testcases[tc].reason = "test should have caused runtime error ";
+
+ stopTest();
+ return ( testcases );
+}
+
+
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[0] = new TestCase( "7.2", "<cr>a", "error", "");
+
+ return ( array );
+}
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.2-4-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.2-4-n.js
new file mode 100644
index 0000000..0f98b9b
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.2-4-n.js
@@ -0,0 +1,82 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 7.2.js
+ ECMA Section: 7.2 Line Terminators
+ Description: - readability
+ - separate tokens
+ - may occur between any two tokens
+ - cannot occur within any token, not even a string
+ - affect the process of automatic semicolon insertion.
+
+ white space characters are:
+ unicode name formal name string representation
+ \u000A line feed <LF> \n
+ \u000D carriage return <CR> \r
+
+ this test uses onerror to capture line numbers. because
+ we use on error, we can only have one test case per file.
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+ var SECTION = "7.2-6";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Line Terminators";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function test() {
+ // this is line 33
+
+ a = "\nb";
+ eval( a );
+
+ // if we get this far, the test failed.
+ testcases[tc].passed = writeTestCaseResult(
+ "failure on line" + testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[0].passed = false;
+
+ testcases[tc].reason = "test should have caused runtime error ";
+
+ stopTest();
+
+ return ( testcases );
+}
+
+
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[0] = new TestCase( "7.2", "a = \\nb", "error", "");
+
+ return ( array );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.2-5-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.2-5-n.js
new file mode 100644
index 0000000..b226a98
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.2-5-n.js
@@ -0,0 +1,85 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 7.2.js
+ ECMA Section: 7.2 Line Terminators
+ Description: - readability
+ - separate tokens
+ - may occur between any two tokens
+ - cannot occur within any token, not even a string
+ - affect the process of automatic semicolon insertion.
+
+ white space characters are:
+ unicode name formal name string representation
+ \u000A line feed <LF> \n
+ \u000D carriage return <CR> \r
+
+ this test uses onerror to capture line numbers. because
+ we use on error, we can only have one test case per file.
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+ var SECTION = "7.2-5";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Line Terminators";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+
+function test() {
+ // this is line 27
+
+ a = "\rb";
+ eval( a );
+
+ // if we get this far, the test failed.
+ testcases[tc].passed = writeTestCaseResult(
+ "failure on line" + testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[tc].passed = false;
+
+ testcases[tc].reason = "test should have caused runtime error ";
+
+ passed = false;
+ stopTest();
+
+ // all tests must return a boolean value
+ return ( testcases );
+}
+
+
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[0] = new TestCase( "7.2", "<cr>a", "error", "");
+
+ return ( array );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.2-6.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.2-6.js
new file mode 100644
index 0000000..70cff7e
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.2-6.js
@@ -0,0 +1,70 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 7.2-6.js
+ ECMA Section: 7.2 Line Terminators
+ Description: - readability
+ - separate tokens
+ - may occur between any two tokens
+ - cannot occur within any token, not even a string
+ - affect the process of automatic semicolon insertion.
+
+ white space characters are:
+ unicode name formal name string representation
+ \u000A line feed <LF> \n
+ \u000D carriage return <CR> \r
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+ var SECTION = "7.2-6";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Line Terminators";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "var a\u000Ab = 5; ab=10;ab;", 10, eval("var a\nb = 5; ab=10;ab") );
+ array[item++] = new TestCase( SECTION, "var a\u000Db = 5; ab=10;b;", 5, eval("var a\nb = 5; ab=10;b") );
+ return ( array );
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-1.js
new file mode 100644
index 0000000..ff94a3c
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-1.js
@@ -0,0 +1,79 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 7.3-1.js
+ ECMA Section: 7.3 Comments
+ Description:
+
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var SECTION = "7.3-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Comments";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item] = new TestCase( SECTION,
+ "a comment with a line terminator string, and text following",
+ "pass",
+ "pass");
+
+ // "\u000A" array[item].actual = "fail";
+
+ item++;
+
+ array[item] = new TestCase( SECTION,
+ "// test \\n array[item].actual = \"pass\"",
+ "pass",
+ "" );
+
+ var x = "// test \n array[item].actual = 'pass'"
+
+ array[0].actual = eval(x);
+
+ return ( array );
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +": "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : " ignored chars after line terminator of single-line comment";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-10.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-10.js
new file mode 100644
index 0000000..ed4a5b3
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-10.js
@@ -0,0 +1,67 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 7.3-10.js
+ ECMA Section: 7.3 Comments
+ Description:
+
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var SECTION = "7.3-10";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Comments";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION,
+ "code following multiline comment",
+ "pass",
+ "fail");
+ return ( array );
+}
+function test() {
+
+ /*//*/testcases[tc].actual="pass";
+
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +": "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : " ignored chars after line terminator of single-line comment";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-11.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-11.js
new file mode 100644
index 0000000..8b6773a
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-11.js
@@ -0,0 +1,66 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 7.3-11.js
+ ECMA Section: 7.3 Comments
+ Description:
+
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var SECTION = "7.3-11";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Comments";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION,
+ "code following multiline comment",
+ "pass",
+ "pass");
+ return ( array );
+}
+function test() {
+
+ ////testcases[tc].actual="fail";
+
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +": "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : " ignored chars after line terminator of single-line comment";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-12.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-12.js
new file mode 100644
index 0000000..fede098
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-12.js
@@ -0,0 +1,66 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 7.3-12.js
+ ECMA Section: 7.3 Comments
+ Description:
+
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var SECTION = "7.3-12";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Comments";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION,
+ "code following multiline comment",
+ "pass",
+ "pass");
+ return ( array );
+}
+function test() {
+
+ /*testcases[tc].actual="fail";**/
+
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +": "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : " ignored chars after line terminator of single-line comment";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-13-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-13-n.js
new file mode 100644
index 0000000..92394e6
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-13-n.js
@@ -0,0 +1,66 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 7.3-13-n.js
+ ECMA Section: 7.3 Comments
+ Description:
+
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var SECTION = "7.3-13-n";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Comments";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION,
+ "nested comment",
+ "error",
+ "pass");
+ return ( array );
+}
+function test() {
+
+ /*/*testcases[tc].actual="fail";*/*/
+
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +": "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : " ignored chars after line terminator of single-line comment";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-2.js
new file mode 100644
index 0000000..8eca512
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-2.js
@@ -0,0 +1,67 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 7.3-2.js
+ ECMA Section: 7.3 Comments
+ Description:
+
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var SECTION = "7.3-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Comments";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION,
+ "a comment with a carriage return, and text following",
+ "pass",
+ "pass");
+ return ( array );
+}
+function test() {
+
+ // "\u000D" testcases[tc].actual = "fail";
+
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +": "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : " ignored chars after line terminator of single-line comment";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-3.js
new file mode 100644
index 0000000..1bcd561
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-3.js
@@ -0,0 +1,67 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 7.3-3.js
+ ECMA Section: 7.3 Comments
+ Description:
+
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var SECTION = "7.3-3";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Comments";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION,
+ "source text directly following a single-line comment",
+ "pass",
+ "fail");
+ return ( array );
+}
+function test() {
+
+ // a comment string
+ testcases[tc].actual = "pass";
+
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +": "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : " ignored chars after line terminator of single-line comment";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-4.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-4.js
new file mode 100644
index 0000000..7ac82c7
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-4.js
@@ -0,0 +1,67 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 7.3-4.js
+ ECMA Section: 7.3 Comments
+ Description:
+
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var SECTION = "7.3-4";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Comments";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION,
+ "multiline comment ",
+ "pass",
+ "pass");
+ return ( array );
+}
+function test() {
+
+ /*testcases[tc].actual = "fail";*/
+
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +": "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : " ignored chars after line terminator of single-line comment";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-5.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-5.js
new file mode 100644
index 0000000..2ce6844
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-5.js
@@ -0,0 +1,66 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 7.3-5.js
+ ECMA Section: 7.3 Comments
+ Description:
+
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var SECTION = "7.3-5";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Comments";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION,
+ "a comment with a carriage return, and text following",
+ "pass",
+ "pass");
+ return ( array );
+}
+function test() {
+
+ // "\u000A" testcases[tc].actual = "fail";
+
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +": "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : " ignored chars after line terminator of single-line comment";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-6.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-6.js
new file mode 100644
index 0000000..d010817
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-6.js
@@ -0,0 +1,68 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 7.3-6.js
+ ECMA Section: 7.3 Comments
+ Description:
+
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var SECTION = "7.3-6";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Comments";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION,
+ "comment with multiple asterisks",
+ "pass",
+ "fail");
+ return ( array );
+}
+function test() {
+
+ /*
+ ***/testcases[tc].actual="pass";
+
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +": "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : " ignored chars after line terminator of single-line comment";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-7.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-7.js
new file mode 100644
index 0000000..8bdf623
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-7.js
@@ -0,0 +1,68 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 7.3-7.js
+ ECMA Section: 7.3 Comments
+ Description:
+
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var SECTION = "7.3-7";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Comments";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION,
+ "single line comment following multiline comment",
+ "pass",
+ "pass");
+ return ( array );
+}
+function test() {
+
+ /*
+ ***///testcases[tc].actual="fail";
+
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +": "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : " ignored chars after line terminator of single-line comment";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-8.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-8.js
new file mode 100644
index 0000000..6d686cf
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-8.js
@@ -0,0 +1,67 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 7.3-7.js
+ ECMA Section: 7.3 Comments
+ Description:
+
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var SECTION = "7.3-8";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Comments";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION,
+ "code following multiline comment",
+ "pass",
+ "fail");
+ return ( array );
+}
+function test() {
+
+ /**/testcases[tc].actual="pass";
+
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +": "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : " ignored chars after line terminator of single-line comment";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-9.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-9.js
new file mode 100644
index 0000000..701e115
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.3-9.js
@@ -0,0 +1,66 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 7.3-9.js
+ ECMA Section: 7.3 Comments
+ Description:
+
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var SECTION = "7.3-9";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Comments";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION,
+ "code following multiline comment",
+ "pass",
+ "fail");
+ return ( array );
+}
+function test() {
+
+ /*/*/testcases[tc].actual="pass";
+
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +": "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : " ignored chars after line terminator of single-line comment";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.1-1-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.1-1-n.js
new file mode 100644
index 0000000..37b1c4e
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.1-1-n.js
@@ -0,0 +1,71 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 7.4.1-1-n.js
+ ECMA Section: 7.4.1
+
+ Description:
+
+ Reserved words cannot be used as identifiers.
+
+ ReservedWord ::
+ Keyword
+ FutureReservedWord
+ NullLiteral
+ BooleanLiteral
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var SECTION = "7.4.1-1-n";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Keywords";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION, "var null = true", "error", "var null = true" );
+ return ( array );
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.1-2-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.1-2-n.js
new file mode 100644
index 0000000..f85891b
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.1-2-n.js
@@ -0,0 +1,70 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 7.4.1-2.js
+ ECMA Section: 7.4.1
+
+ Description:
+
+ Reserved words cannot be used as identifiers.
+
+ ReservedWord ::
+ Keyword
+ FutureReservedWord
+ NullLiteral
+ BooleanLiteral
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var SECTION = "7.4.1-2-n";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Keywords";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION, "var true = false", "error", "var true = false" );
+ return ( array );
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.1-3-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.1-3-n.js
new file mode 100644
index 0000000..a05480a
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.1-3-n.js
@@ -0,0 +1,70 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 7.4.1-3-n.js
+ ECMA Section: 7.4.1
+
+ Description:
+
+ Reserved words cannot be used as identifiers.
+
+ ReservedWord ::
+ Keyword
+ FutureReservedWord
+ NullLiteral
+ BooleanLiteral
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var SECTION = "7.4.1-3-n";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Keywords";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION, "var false = true", "error", "var false = true" );
+ return ( array );
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-1-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-1-n.js
new file mode 100644
index 0000000..43d0425
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-1-n.js
@@ -0,0 +1,76 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 7.4.2-1.js
+ ECMA Section: 7.4.2
+
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
+
+ Syntax
+
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
+
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var SECTION = "7.4.2-1-n";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Keywords";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION, "var break = true", "error", "var break = true" );
+ return ( array );
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-10-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-10-n.js
new file mode 100644
index 0000000..0ad19db
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-10-n.js
@@ -0,0 +1,76 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 7.4.2-10.js
+ ECMA Section: 7.4.2
+
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
+
+ Syntax
+
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
+
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var SECTION = "7.4.1-10-n";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Keywords";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION, "var if = true", "error", "var if = true" );
+ return ( array );
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-11-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-11-n.js
new file mode 100644
index 0000000..e8a0f80
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-11-n.js
@@ -0,0 +1,76 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 7.4.2-11-n.js
+ ECMA Section: 7.4.2
+
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
+
+ Syntax
+
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
+
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var SECTION = "7.4.1-11-n";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Keywords";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION, "var this = true", "error", "var this = true" );
+ return ( array );
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-12-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-12-n.js
new file mode 100644
index 0000000..ffc3350
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-12-n.js
@@ -0,0 +1,77 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 7.4.2-12-n.js
+ ECMA Section: 7.4.2
+
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
+
+ Syntax
+
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
+
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var SECTION = "7.4.1-12-n";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Keywords";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION, "var while = true", "error", "var while = true" );
+ return ( array );
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-13-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-13-n.js
new file mode 100644
index 0000000..78320b2
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-13-n.js
@@ -0,0 +1,76 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 7.4.2-13-n.js
+ ECMA Section: 7.4.2
+
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
+
+ Syntax
+
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
+
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var SECTION = "7.4.1-13-n";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Keywords";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION, "var else = true", "error", "var else = true" );
+ return ( array );
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-14-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-14-n.js
new file mode 100644
index 0000000..4b8bb0f
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-14-n.js
@@ -0,0 +1,76 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 7.4.2-14-n.js
+ ECMA Section: 7.4.2
+
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
+
+ Syntax
+
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
+
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var SECTION = "7.4.1-14-n";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Keywords";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION, "var in = true", "error", "var in = true" );
+ return ( array );
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-15-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-15-n.js
new file mode 100644
index 0000000..d84f9d7
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-15-n.js
@@ -0,0 +1,77 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 7.4.2-15-n.js
+ ECMA Section: 7.4.2
+
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
+
+ Syntax
+
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
+
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var SECTION = "7.4.1-15-n";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Keywords";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION, "var typeof = true", "error", "var typeof = true" );
+ return ( array );
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-16-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-16-n.js
new file mode 100644
index 0000000..8293eee
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-16-n.js
@@ -0,0 +1,76 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 7.4.2-16-n.js
+ ECMA Section: 7.4.2
+
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
+
+ Syntax
+
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
+
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var SECTION = "7.4.1-16-n";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Keywords";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION, "var with = true", "error", "var with = true" );
+ return ( array );
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-2-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-2-n.js
new file mode 100644
index 0000000..2b799b1
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-2-n.js
@@ -0,0 +1,75 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 7.4.2-2-n.js
+ ECMA Section: 7.4.2
+
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
+
+ Syntax
+
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
+
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var SECTION = "7.4.1-2-n";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Keywords";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION, "var for = true", "error", "var for = true" );
+ return ( array );
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-3-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-3-n.js
new file mode 100644
index 0000000..3b5feb0
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-3-n.js
@@ -0,0 +1,75 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 7.4.2-3-n.js
+ ECMA Section: 7.4.2
+
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
+
+ Syntax
+
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
+
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var SECTION = "7.4.2-3-n";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Keywords";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION, "var new = true", "error", "var new = true" );
+ return ( array );
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-4-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-4-n.js
new file mode 100644
index 0000000..13faf32
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-4-n.js
@@ -0,0 +1,76 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 7.4.2-4-n.js
+ ECMA Section: 7.4.2
+
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
+
+ Syntax
+
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
+
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var SECTION = "7.4.2-4-n";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Keywords";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION, "var var = true", "error", "var var = true" );
+ return ( array );
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-5-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-5-n.js
new file mode 100644
index 0000000..004249b
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-5-n.js
@@ -0,0 +1,76 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 7.4.2-5-n.js
+ ECMA Section: 7.4.2
+
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
+
+ Syntax
+
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
+
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var SECTION = "7.4.2-5-n";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Keywords";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION, "var continue = true", "error", "var continue = true" );
+ return ( array );
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-6-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-6-n.js
new file mode 100644
index 0000000..3b830f8
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-6-n.js
@@ -0,0 +1,76 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 7.4.2-6.js
+ ECMA Section: 7.4.2
+
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
+
+ Syntax
+
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
+
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var SECTION = "7.4.2-6-n";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Keywords";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION, "var function = true", "error", "var function = true" );
+ return ( array );
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-7-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-7-n.js
new file mode 100644
index 0000000..c84ca9d
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-7-n.js
@@ -0,0 +1,73 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 7.4.2-7-n.js
+ ECMA Section: 7.4.2
+
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
+
+ Syntax
+
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
+
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var SECTION = "7.4.2-7";
+ var VERSION = "ECMA_1";
+ startTest();
+ var testcases = getTestCases();
+ writeHeaderToLog( SECTION + " Keywords");
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION, "var return = true", "error", "var return = true" );
+ return ( array );
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-8-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-8-n.js
new file mode 100644
index 0000000..f2397bb
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-8-n.js
@@ -0,0 +1,73 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 7.4.2-8-n.js
+ ECMA Section: 7.4.2
+
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
+
+ Syntax
+
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
+
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var SECTION = "7.4.2-8";
+ var VERSION = "ECMA_1";
+ startTest();
+ var testcases = getTestCases();
+ writeHeaderToLog( SECTION + " Keywords");
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION, "var void = true", "error", "var void = true" );
+ return ( array );
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-9-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-9-n.js
new file mode 100644
index 0000000..5b5a288
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.2-9-n.js
@@ -0,0 +1,76 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 7.4.2-9-n.js
+ ECMA Section: 7.4.2
+
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
+
+ Syntax
+
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
+
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var SECTION = "7.4.1-9-n";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Keywords";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION, "var delete = true", "error", "var delete = true" );
+ return ( array );
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-1-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-1-n.js
new file mode 100644
index 0000000..5a626a4
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-1-n.js
@@ -0,0 +1,71 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 7.4.3-1-n.js
+ ECMA Section: 7.4.3
+
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
+
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "7.4.3-1-n";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Future Reserved Words";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION, "var case = true", "error", "var case = true" );
+ return ( array );
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-10-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-10-n.js
new file mode 100644
index 0000000..84d6cf3
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-10-n.js
@@ -0,0 +1,71 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 7.4.3-10-n.js
+ ECMA Section: 7.4.3
+
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
+
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "7.4.3-10-n";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Future Reserved Words";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION, "var do = true", "error", "var do = true" );
+ return ( array );
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-11-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-11-n.js
new file mode 100644
index 0000000..b850584
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-11-n.js
@@ -0,0 +1,70 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 7.4.3-11-n.js
+ ECMA Section: 7.4.3
+
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
+
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "7.4.3-11-n";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Future Reserved Words";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION, "var finally = true", "error", "var finally = true" );
+ return ( array );
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-12-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-12-n.js
new file mode 100644
index 0000000..7dfe3cc
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-12-n.js
@@ -0,0 +1,72 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 7.4.3-12-n.js
+ ECMA Section: 7.4.3
+
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
+
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "7.4.3-12-n";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Future Reserved Words";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION, "var throw = true", "error", "var throw = true" );
+ return ( array );
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-13-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-13-n.js
new file mode 100644
index 0000000..ede44c1
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-13-n.js
@@ -0,0 +1,72 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 7.4.3-13-n.js
+ ECMA Section: 7.4.3
+
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
+
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "7.4.3-13-n";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Future Reserved Words";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION, "var const = true", "error", "var const = true" );
+ return ( array );
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-14-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-14-n.js
new file mode 100644
index 0000000..31b6794
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-14-n.js
@@ -0,0 +1,70 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 7.4.3-14-n.js
+ ECMA Section: 7.4.3
+
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
+
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "7.4.3-14-n";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Future Reserved Words";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION, "var enum = true", "error", "var enum = true" );
+ return ( array );
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-15-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-15-n.js
new file mode 100644
index 0000000..dfda054
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-15-n.js
@@ -0,0 +1,72 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 7.4.3-15-n.js
+ ECMA Section: 7.4.3
+
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
+
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "7.4.3-15-n";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Future Reserved Words";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION, "var import = true", "error", "var import = true" );
+ return ( array );
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-16-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-16-n.js
new file mode 100644
index 0000000..cf61635
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-16-n.js
@@ -0,0 +1,69 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: lexical-023.js
+ Corresponds To: 7.4.3-16-n.js
+ ECMA Section: 7.4.3
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
+
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "lexical-023.js";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Future Reserved Words";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ try = true;
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "try = true" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
+
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-2-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-2-n.js
new file mode 100644
index 0000000..46da571
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-2-n.js
@@ -0,0 +1,72 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 7.4.3-2-n.js
+ ECMA Section: 7.4.3
+
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
+
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "7.4.3-2-n";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Future Reserved Words";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION, "var debugger = true", "error", "var debugger = true" );
+ return ( array );
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-3-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-3-n.js
new file mode 100644
index 0000000..bfdbe3b
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-3-n.js
@@ -0,0 +1,72 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 7.4.3-3-n.js
+ ECMA Section: 7.4.3
+
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
+
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "7.4.3-3-n";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Future Reserved Words";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION, "var export = true", "error", "var export = true" );
+ return ( array );
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-4-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-4-n.js
new file mode 100644
index 0000000..11b97c9
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-4-n.js
@@ -0,0 +1,72 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 7.4.3-4-n.js
+ ECMA Section: 7.4.3
+
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
+
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "7.4.3-4-n";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Future Reserved Words";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION, "var super = true", "error", "var super = true" );
+ return ( array );
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-5-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-5-n.js
new file mode 100644
index 0000000..8acbbcd
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-5-n.js
@@ -0,0 +1,70 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 7.4.3-5-n.js
+ ECMA Section: 7.4.3
+
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
+
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "7.4.3-5-n";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Future Reserved Words";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION, "var catch = true", "error", "var catch = true" );
+ return ( array );
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-6-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-6-n.js
new file mode 100644
index 0000000..d5ea75e
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-6-n.js
@@ -0,0 +1,70 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 7.4.3-6-n.js
+ ECMA Section: 7.4.3
+
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
+
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "7.4.3-6-n";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Future Reserved Words";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION, "var default = true", "error", "var default = true" );
+ return ( array );
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-7-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-7-n.js
new file mode 100644
index 0000000..93cf4cd
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-7-n.js
@@ -0,0 +1,70 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 7.4.3-7-n.js
+ ECMA Section: 7.4.3
+
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
+
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "7.4.3-7-n";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Future Reserved Words";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION, "var extends = true", "error", "var extends = true" );
+ return ( array );
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-8-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-8-n.js
new file mode 100644
index 0000000..7d09f0c
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-8-n.js
@@ -0,0 +1,70 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 7.4.3-8-n.js
+ ECMA Section: 7.4.3
+
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
+
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "7.4.3-9-n";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Future Reserved Words";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION, "var switch = true", "error", "var switch = true" );
+ return ( array );
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-9-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-9-n.js
new file mode 100644
index 0000000..f0e71f9
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.4.3-9-n.js
@@ -0,0 +1,70 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 7.4.3-9-n.js
+ ECMA Section: 7.4.3
+
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
+
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "7.4.3-9-n";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Future Reserved Words";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION, "var class = true", "error", "var class = true" );
+ return ( array );
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.5-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.5-1.js
new file mode 100644
index 0000000..ef1b257
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.5-1.js
@@ -0,0 +1,65 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 7.5-1.js
+ ECMA Section: 7.5 Identifiers
+ Description: Identifiers are of unlimited length
+ - can contain letters, a decimal digit, _, or $
+ - the first character cannot be a decimal digit
+ - identifiers are case sensitive
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+ var SECTION = "7.5-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Identifiers";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "var $123 = 5", 5, eval("var $123 = 5;$123") );
+ array[item++] = new TestCase( SECTION, "var _123 = 5", 5, eval("var _123 = 5;_123") );
+
+ return ( array );
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +": "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : " ignored chars after line terminator of single-line comment";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.5-10-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.5-10-n.js
new file mode 100644
index 0000000..b1bb872
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.5-10-n.js
@@ -0,0 +1,70 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 7.5-9-n.js
+ ECMA Section: 7.5 Identifiers
+ Description: Identifiers are of unlimited length
+ - can contain letters, a decimal digit, _, or $
+ - the first character cannot be a decimal digit
+ - identifiers are case sensitive
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+ var SECTION = "7.5-9-n";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Identifiers";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item] = new TestCase( SECTION, "var 123=\"hi\"", "error", "" );
+
+ 123 = "hi";
+
+ array[item] = 123;
+
+ return ( array );
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +": "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : " ignored chars after line terminator of single-line comment";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.5-2-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.5-2-n.js
new file mode 100644
index 0000000..b8a161d
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.5-2-n.js
@@ -0,0 +1,65 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 7.5-2-n.js
+ ECMA Section: 7.5 Identifiers
+ Description: Identifiers are of unlimited length
+ - can contain letters, a decimal digit, _, or $
+ - the first character cannot be a decimal digit
+ - identifiers are case sensitive
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+ var SECTION = "7.5-2-n";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Identifiers";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "var 0abc", "error", "var 0abc" );
+ return ( array );
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +": "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : " ignored chars after line terminator of single-line comment";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.5-3-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.5-3-n.js
new file mode 100644
index 0000000..0d0aa84
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.5-3-n.js
@@ -0,0 +1,65 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 7.5-2.js
+ ECMA Section: 7.5 Identifiers
+ Description: Identifiers are of unlimited length
+ - can contain letters, a decimal digit, _, or $
+ - the first character cannot be a decimal digit
+ - identifiers are case sensitive
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+ var SECTION = "7.5-3-n";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Identifiers";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "var 0abc", "error", "var 1abc" );
+ return ( array );
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +": "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : " ignored chars after line terminator of single-line comment";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.5-4-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.5-4-n.js
new file mode 100644
index 0000000..8a21a77
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.5-4-n.js
@@ -0,0 +1,65 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 7.5-4-n.js
+ ECMA Section: 7.5 Identifiers
+ Description: Identifiers are of unlimited length
+ - can contain letters, a decimal digit, _, or $
+ - the first character cannot be a decimal digit
+ - identifiers are case sensitive
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+ var SECTION = "7.5-4-n";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Identifiers";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "var 0abc", "error", "var 2abc" );
+ return ( array );
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +": "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : " ignored chars after line terminator of single-line comment";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.5-5-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.5-5-n.js
new file mode 100644
index 0000000..7a17f16
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.5-5-n.js
@@ -0,0 +1,65 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 7.5-5-n.js
+ ECMA Section: 7.5 Identifiers
+ Description: Identifiers are of unlimited length
+ - can contain letters, a decimal digit, _, or $
+ - the first character cannot be a decimal digit
+ - identifiers are case sensitive
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+ var SECTION = "7.5-5-n";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Identifiers";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "var 0abc", "error", "var 3abc" );
+ return ( array );
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +": "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : " ignored chars after line terminator of single-line comment";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.5-6.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.5-6.js
new file mode 100644
index 0000000..8b19307
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.5-6.js
@@ -0,0 +1,65 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 7.5-6.js
+ ECMA Section: 7.5 Identifiers
+ Description: Identifiers are of unlimited length
+ - can contain letters, a decimal digit, _, or $
+ - the first character cannot be a decimal digit
+ - identifiers are case sensitive
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+ var SECTION = "7.5-6";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Identifiers";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "var _0abc = 5", 5, "var _0abc = 5; _0abc" );
+ return ( array );
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +": "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : " ignored chars after line terminator of single-line comment";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.5-7.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.5-7.js
new file mode 100644
index 0000000..7ade939
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.5-7.js
@@ -0,0 +1,65 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 7.5-7.js
+ ECMA Section: 7.5 Identifiers
+ Description: Identifiers are of unlimited length
+ - can contain letters, a decimal digit, _, or $
+ - the first character cannot be a decimal digit
+ - identifiers are case sensitive
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+ var SECTION = "7.5-7";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Identifiers";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "var $0abc = 5", 5, "var $0abc = 5; $0abc" );
+ return ( array );
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +": "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : " ignored chars after line terminator of single-line comment";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.5-8-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.5-8-n.js
new file mode 100644
index 0000000..f17e071
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.5-8-n.js
@@ -0,0 +1,65 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 7.5-8-n.js
+ ECMA Section: 7.5 Identifiers
+ Description: Identifiers are of unlimited length
+ - can contain letters, a decimal digit, _, or $
+ - the first character cannot be a decimal digit
+ - identifiers are case sensitive
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+ var SECTION = "7.5-8-n";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Identifiers";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "var @0abc = 5", "error", "var @0abc = 5; @0abc" );
+ return ( array );
+}
+
+function test() {s
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +": "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : " ignored chars after line terminator of single-line comment";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.5-9-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.5-9-n.js
new file mode 100644
index 0000000..8ef78d6
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.5-9-n.js
@@ -0,0 +1,70 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 7.5-9-n.js
+ ECMA Section: 7.5 Identifiers
+ Description: Identifiers are of unlimited length
+ - can contain letters, a decimal digit, _, or $
+ - the first character cannot be a decimal digit
+ - identifiers are case sensitive
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+ var SECTION = "7.5-9-n";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Identifiers";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item] = new TestCase( SECTION, "var 123=\"hi\"", "error", "" );
+
+ var 123 = "hi";
+
+ array[item] = 123;
+
+ return ( array );
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +": "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : " ignored chars after line terminator of single-line comment";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.6.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.6.js
new file mode 100644
index 0000000..68b66be
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.6.js
@@ -0,0 +1,309 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 7.6.js
+ ECMA Section: Punctuators
+ Description:
+
+ This tests verifies that all ECMA punctutors are recognized as a
+ token separator, but does not attempt to verify the functionality
+ of any punctuator.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "7.6";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Punctuators";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ // ==
+ testcases[tc++] = new TestCase( SECTION,
+ "var c,d;c==d",
+ true,
+ eval("var c,d;c==d") );
+
+ // =
+
+ testcases[tc++] = new TestCase( SECTION,
+ "var a=true;a",
+ true,
+ eval("var a=true;a") );
+
+ // >
+ testcases[tc++] = new TestCase( SECTION,
+ "var a=true,b=false;a>b",
+ true,
+ eval("var a=true,b=false;a>b") );
+
+ // <
+ testcases[tc++] = new TestCase( SECTION,
+ "var a=true,b=false;a<b",
+ false,
+ eval("var a=true,b=false;a<b") );
+
+ // <=
+ testcases[tc++] = new TestCase( SECTION,
+ "var a=0xFFFF,b=0X0FFF;a<=b",
+ false,
+ eval("var a=0xFFFF,b=0X0FFF;a<=b") );
+
+ // >=
+ testcases[tc++] = new TestCase( SECTION,
+ "var a=0xFFFF,b=0XFFFE;a>=b",
+ true,
+ eval("var a=0xFFFF,b=0XFFFE;a>=b") );
+
+ // !=
+ testcases[tc++] = new TestCase( SECTION,
+ "var a=true,b=false;a!=b",
+ true,
+ eval("var a=true,b=false;a!=b") );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "var a=false,b=false;a!=b",
+ false,
+ eval("var a=false,b=false;a!=b") );
+ // ,
+ testcases[tc++] = new TestCase( SECTION,
+ "var a=true,b=false;a,b",
+ false,
+ eval("var a=true,b=false;a,b") );
+ // !
+ testcases[tc++] = new TestCase( SECTION,
+ "var a=true,b=false;!a",
+ false,
+ eval("var a=true,b=false;!a") );
+
+ // ~
+ testcases[tc++] = new TestCase( SECTION,
+ "var a=true;~a",
+ -2,
+ eval("var a=true;~a") );
+ // ?
+ testcases[tc++] = new TestCase( SECTION,
+ "var a=true; (a ? 'PASS' : '')",
+ "PASS",
+ eval("var a=true; (a ? 'PASS' : '')") );
+
+ // :
+
+ testcases[tc++] = new TestCase( SECTION,
+ "var a=false; (a ? 'FAIL' : 'PASS')",
+ "PASS",
+ eval("var a=false; (a ? 'FAIL' : 'PASS')") );
+ // .
+
+ testcases[tc++] = new TestCase( SECTION,
+ "var a=Number;a.NaN",
+ NaN,
+ eval("var a=Number;a.NaN") );
+
+ // &&
+ testcases[tc++] = new TestCase( SECTION,
+ "var a=true,b=true;if(a&&b)'PASS';else'FAIL'",
+ "PASS",
+ eval("var a=true,b=true;if(a&&b)'PASS';else'FAIL'") );
+
+ // ||
+ testcases[tc++] = new TestCase( SECTION,
+ "var a=false,b=false;if(a||b)'FAIL';else'PASS'",
+ "PASS",
+ eval("var a=false,b=false;if(a||b)'FAIL';else'PASS'") );
+ // ++
+ testcases[tc++] = new TestCase( SECTION,
+ "var a=false,b=false;++a",
+ 1,
+ eval("var a=false,b=false;++a") );
+ // --
+ testcases[tc++] = new TestCase( SECTION,
+ "var a=true,b=false--a",
+ 0,
+ eval("var a=true,b=false;--a") );
+ // +
+
+ testcases[tc++] = new TestCase( SECTION,
+ "var a=true,b=true;a+b",
+ 2,
+ eval("var a=true,b=true;a+b") );
+ // -
+ testcases[tc++] = new TestCase( SECTION,
+ "var a=true,b=true;a-b",
+ 0,
+ eval("var a=true,b=true;a-b") );
+ // *
+ testcases[tc++] = new TestCase( SECTION,
+ "var a=true,b=true;a*b",
+ 1,
+ eval("var a=true,b=true;a*b") );
+ // /
+ testcases[tc++] = new TestCase( SECTION,
+ "var a=true,b=true;a/b",
+ 1,
+ eval("var a=true,b=true;a/b") );
+ // &
+ testcases[tc++] = new TestCase( SECTION,
+ "var a=3,b=2;a&b",
+ 2,
+ eval("var a=3,b=2;a&b") );
+ // |
+ testcases[tc++] = new TestCase( SECTION,
+ "var a=4,b=3;a|b",
+ 7,
+ eval("var a=4,b=3;a|b") );
+
+ // |
+ testcases[tc++] = new TestCase( SECTION,
+ "var a=4,b=3;a^b",
+ 7,
+ eval("var a=4,b=3;a^b") );
+
+ // %
+ testcases[tc++] = new TestCase( SECTION,
+ "var a=4,b=3;a|b",
+ 1,
+ eval("var a=4,b=3;a%b") );
+
+ // <<
+ testcases[tc++] = new TestCase( SECTION,
+ "var a=4,b=3;a<<b",
+ 32,
+ eval("var a=4,b=3;a<<b") );
+
+ // >>
+ testcases[tc++] = new TestCase( SECTION,
+ "var a=4,b=1;a>>b",
+ 2,
+ eval("var a=4,b=1;a>>b") );
+
+ // >>>
+ testcases[tc++] = new TestCase( SECTION,
+ "var a=1,b=1;a>>>b",
+ 0,
+ eval("var a=1,b=1;a>>>b") );
+ // +=
+ testcases[tc++] = new TestCase( SECTION,
+ "var a=4,b=3;a+=b;a",
+ 7,
+ eval("var a=4,b=3;a+=b;a") );
+
+ // -=
+ testcases[tc++] = new TestCase( SECTION,
+ "var a=4,b=3;a-=b;a",
+ 1,
+ eval("var a=4,b=3;a-=b;a") );
+ // *=
+ testcases[tc++] = new TestCase( SECTION,
+ "var a=4,b=3;a*=b;a",
+ 12,
+ eval("var a=4,b=3;a*=b;a") );
+ // +=
+ testcases[tc++] = new TestCase( SECTION,
+ "var a=4,b=3;a+=b;a",
+ 7,
+ eval("var a=4,b=3;a+=b;a") );
+ // /=
+ testcases[tc++] = new TestCase( SECTION,
+ "var a=12,b=3;a/=b;a",
+ 4,
+ eval("var a=12,b=3;a/=b;a") );
+
+ // &=
+ testcases[tc++] = new TestCase( SECTION,
+ "var a=4,b=5;a&=b;a",
+ 4,
+ eval("var a=4,b=5;a&=b;a") );
+
+ // |=
+ testcases[tc++] = new TestCase( SECTION,
+ "var a=4,b=5;a&=b;a",
+ 5,
+ eval("var a=4,b=5;a|=b;a") );
+ // ^=
+ testcases[tc++] = new TestCase( SECTION,
+ "var a=4,b=5;a^=b;a",
+ 1,
+ eval("var a=4,b=5;a^=b;a") );
+ // %=
+ testcases[tc++] = new TestCase( SECTION,
+ "var a=12,b=5;a%=b;a",
+ 2,
+ eval("var a=12,b=5;a%=b;a") );
+ // <<=
+ testcases[tc++] = new TestCase( SECTION,
+ "var a=4,b=3;a<<=b;a",
+ 32,
+ eval("var a=4,b=3;a<<=b;a") );
+
+ // >>
+ testcases[tc++] = new TestCase( SECTION,
+ "var a=4,b=1;a>>=b;a",
+ 2,
+ eval("var a=4,b=1;a>>=b;a") );
+
+ // >>>
+ testcases[tc++] = new TestCase( SECTION,
+ "var a=1,b=1;a>>>=b;a",
+ 0,
+ eval("var a=1,b=1;a>>>=b;a") );
+
+ // ()
+ testcases[tc++] = new TestCase( SECTION,
+ "var a=4,b=3;(a)",
+ 4,
+ eval("var a=4,b=3;(a)") );
+ // {}
+ testcases[tc++] = new TestCase( SECTION,
+ "var a=4,b=3;{b}",
+ 3,
+ eval("var a=4,b=3;{b}") );
+
+ // []
+ testcases[tc++] = new TestCase( SECTION,
+ "var a=new Array('hi');a[0]",
+ "hi",
+ eval("var a=new Array('hi');a[0]") );
+ // []
+ testcases[tc++] = new TestCase( SECTION,
+ ";",
+ void 0,
+ eval(";") );
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.7.1.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.7.1.js
new file mode 100644
index 0000000..a939e51
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.7.1.js
@@ -0,0 +1,72 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 7.7.1.js
+ ECMA Section: 7.7.1 Null Literals
+
+ Description: NullLiteral::
+ null
+
+
+ The value of the null literal null is the sole value
+ of the Null type, namely null.
+
+ Author: christine@netscape.com
+ Date: 21 october 1997
+*/
+ var SECTION = "7.7.1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Null Literals";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "null", null, null);
+
+ return ( array );
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = testcases[tc].actual;
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+
+ stopTest();
+
+ // all tests must return the test array
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.7.2.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.7.2.js
new file mode 100644
index 0000000..1202df3
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.7.2.js
@@ -0,0 +1,75 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 7.7.2.js
+ ECMA Section: 7.7.2 Boolean Literals
+
+ Description: BooleanLiteral::
+ true
+ false
+
+ The value of the Boolean literal true is a value of the
+ Boolean type, namely true.
+
+ The value of the Boolean literal false is a value of the
+ Boolean type, namely false.
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+ var SECTION = "7.7.2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Boolean Literals";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ // StringLiteral:: "" and ''
+
+ array[item++] = new TestCase( SECTION, "true", Boolean(true), true );
+ array[item++] = new TestCase( SECTION, "false", Boolean(false), false );
+
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = testcases[tc].actual;
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+
+ stopTest();
+ }
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.7.3-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.7.3-1.js
new file mode 100644
index 0000000..91becca
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.7.3-1.js
@@ -0,0 +1,197 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 7.7.3-1.js
+ ECMA Section: 7.7.3 Numeric Literals
+
+ Description: A numeric literal stands for a value of the Number type
+ This value is determined in two steps: first a
+ mathematical value (MV) is derived from the literal;
+ second, this mathematical value is rounded, ideally
+ using IEEE 754 round-to-nearest mode, to a reprentable
+ value of of the number type.
+
+ These test cases came from Waldemar.
+
+ Author: christine@netscape.com
+ Date: 12 June 1998
+*/
+
+var SECTION = "7.7.3-1";
+var VERSION = "ECMA_1";
+ startTest();
+var TITLE = "Numeric Literals";
+var BUGNUMBER="122877";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var testcases = new Array();
+
+
+testcases[tc++] = new TestCase( SECTION,
+ "0x12345678",
+ 305419896,
+ 0x12345678 );
+
+testcases[tc++] = new TestCase( SECTION,
+ "0x80000000",
+ 2147483648,
+ 0x80000000 );
+
+testcases[tc++] = new TestCase( SECTION,
+ "0xffffffff",
+ 4294967295,
+ 0xffffffff );
+
+testcases[tc++] = new TestCase( SECTION,
+ "0x100000000",
+ 4294967296,
+ 0x100000000 );
+
+testcases[tc++] = new TestCase( SECTION,
+ "077777777777777777",
+ 2251799813685247,
+ 077777777777777777 );
+
+testcases[tc++] = new TestCase( SECTION,
+ "077777777777777776",
+ 2251799813685246,
+ 077777777777777776 );
+
+testcases[tc++] = new TestCase( SECTION,
+ "0x1fffffffffffff",
+ 9007199254740991,
+ 0x1fffffffffffff );
+
+testcases[tc++] = new TestCase( SECTION,
+ "0x20000000000000",
+ 9007199254740992,
+ 0x20000000000000 );
+
+testcases[tc++] = new TestCase( SECTION,
+ "0x20123456789abc",
+ 9027215253084860,
+ 0x20123456789abc );
+
+testcases[tc++] = new TestCase( SECTION,
+ "0x20123456789abd",
+ 9027215253084860,
+ 0x20123456789abd );
+
+testcases[tc++] = new TestCase( SECTION,
+ "0x20123456789abe",
+ 9027215253084862,
+ 0x20123456789abe );
+
+testcases[tc++] = new TestCase( SECTION,
+ "0x20123456789abf",
+ 9027215253084864,
+ 0x20123456789abf );
+
+testcases[tc++] = new TestCase( SECTION,
+ "0x1000000000000080",
+ 1152921504606847000,
+ 0x1000000000000080 );
+
+testcases[tc++] = new TestCase( SECTION,
+ "0x1000000000000081",
+ 1152921504606847200,
+ 0x1000000000000081 );
+
+testcases[tc++] = new TestCase( SECTION,
+ "0x1000000000000100",
+ 1152921504606847200,
+ 0x1000000000000100 );
+
+testcases[tc++] = new TestCase( SECTION,
+ "0x100000000000017f",
+ 1152921504606847200,
+ 0x100000000000017f );
+
+testcases[tc++] = new TestCase( SECTION,
+ "0x1000000000000180",
+ 1152921504606847500,
+ 0x1000000000000180 );
+
+testcases[tc++] = new TestCase( SECTION,
+ "0x1000000000000181",
+ 1152921504606847500,
+ 0x1000000000000181 );
+
+testcases[tc++] = new TestCase( SECTION,
+ "0x10000000000001f0",
+ 1152921504606847500,
+ 0x10000000000001f0 );
+
+testcases[tc++] = new TestCase( SECTION,
+ "0x1000000000000200",
+ 1152921504606847500,
+ 0x1000000000000200 );
+
+testcases[tc++] = new TestCase( SECTION,
+ "0x100000000000027f",
+ 1152921504606847500,
+ 0x100000000000027f );
+
+testcases[tc++] = new TestCase( SECTION,
+ "0x1000000000000280",
+ 1152921504606847500,
+ 0x1000000000000280 );
+
+testcases[tc++] = new TestCase( SECTION,
+ "0x1000000000000281",
+ 1152921504606847700,
+ 0x1000000000000281 );
+
+testcases[tc++] = new TestCase( SECTION,
+ "0x10000000000002ff",
+ 1152921504606847700,
+ 0x10000000000002ff );
+
+testcases[tc++] = new TestCase( SECTION,
+ "0x1000000000000300",
+ 1152921504606847700,
+ 0x1000000000000300 );
+
+testcases[tc++] = new TestCase( SECTION,
+ "0x10000000000000000",
+ 18446744073709552000,
+ 0x10000000000000000 );
+
+test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = testcases[tc].actual;
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+
+ }
+
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.7.3-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.7.3-2.js
new file mode 100644
index 0000000..b6e750c
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.7.3-2.js
@@ -0,0 +1,93 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 7.7.3-2.js
+ ECMA Section: 7.7.3 Numeric Literals
+
+ Description:
+
+ This is a regression test for
+ http://scopus.mcom.com/bugsplat/show_bug.cgi?id=122884
+
+ Waldemar's comments:
+
+ A numeric literal that starts with either '08' or '09' is interpreted as a
+ decimal literal; it should be an error instead. (Strictly speaking, according
+ to ECMA v1 such literals should be interpreted as two integers -- a zero
+ followed by a decimal number whose first digit is 8 or 9, but this is a bug in
+ ECMA that will be fixed in v2. In any case, there is no place in the grammar
+ where two consecutive numbers would be legal.)
+
+ Author: christine@netscape.com
+ Date: 15 june 1998
+
+*/
+ var SECTION = "7.7.3-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Numeric Literals";
+ var BUGNUMBER="122884";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ testcases[tc++] = new TestCase( SECTION,
+ "9",
+ 9,
+ 9 );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "09",
+ 9,
+ 09 );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "099",
+ 99,
+ 099 );
+
+
+ testcases[tc++] = new TestCase( SECTION,
+ "077",
+ 63,
+ 077 );
+
+ test();
+
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = testcases[tc].actual;
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+
+ }
+
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.7.3.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.7.3.js
new file mode 100644
index 0000000..7d47a40
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.7.3.js
@@ -0,0 +1,337 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 7.7.3.js
+ ECMA Section: 7.7.3 Numeric Literals
+
+ Description: A numeric literal stands for a value of the Number type
+ This value is determined in two steps: first a
+ mathematical value (MV) is derived from the literal;
+ second, this mathematical value is rounded, ideally
+ using IEEE 754 round-to-nearest mode, to a reprentable
+ value of of the number type.
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+ var SECTION = "7.7.3";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Numeric Literals";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "0", 0, 0 );
+ array[item++] = new TestCase( SECTION, "1", 1, 1 );
+ array[item++] = new TestCase( SECTION, "2", 2, 2 );
+ array[item++] = new TestCase( SECTION, "3", 3, 3 );
+ array[item++] = new TestCase( SECTION, "4", 4, 4 );
+ array[item++] = new TestCase( SECTION, "5", 5, 5 );
+ array[item++] = new TestCase( SECTION, "6", 6, 6 );
+ array[item++] = new TestCase( SECTION, "7", 7, 7 );
+ array[item++] = new TestCase( SECTION, "8", 8, 8 );
+ array[item++] = new TestCase( SECTION, "9", 9, 9 );
+
+ array[item++] = new TestCase( SECTION, "0.", 0, 0. );
+ array[item++] = new TestCase( SECTION, "1.", 1, 1. );
+ array[item++] = new TestCase( SECTION, "2.", 2, 2. );
+ array[item++] = new TestCase( SECTION, "3.", 3, 3. );
+ array[item++] = new TestCase( SECTION, "4.", 4, 4. );
+
+ array[item++] = new TestCase( SECTION, "0.e0", 0, 0.e0 );
+ array[item++] = new TestCase( SECTION, "1.e1", 10, 1.e1 );
+ array[item++] = new TestCase( SECTION, "2.e2", 200, 2.e2 );
+ array[item++] = new TestCase( SECTION, "3.e3", 3000, 3.e3 );
+ array[item++] = new TestCase( SECTION, "4.e4", 40000, 4.e4 );
+
+ array[item++] = new TestCase( SECTION, "0.1e0", .1, 0.1e0 );
+ array[item++] = new TestCase( SECTION, "1.1e1", 11, 1.1e1 );
+ array[item++] = new TestCase( SECTION, "2.2e2", 220, 2.2e2 );
+ array[item++] = new TestCase( SECTION, "3.3e3", 3300, 3.3e3 );
+ array[item++] = new TestCase( SECTION, "4.4e4", 44000, 4.4e4 );
+
+ array[item++] = new TestCase( SECTION, ".1e0", .1, .1e0 );
+ array[item++] = new TestCase( SECTION, ".1e1", 1, .1e1 );
+ array[item++] = new TestCase( SECTION, ".2e2", 20, .2e2 );
+ array[item++] = new TestCase( SECTION, ".3e3", 300, .3e3 );
+ array[item++] = new TestCase( SECTION, ".4e4", 4000, .4e4 );
+
+ array[item++] = new TestCase( SECTION, "0e0", 0, 0e0 );
+ array[item++] = new TestCase( SECTION, "1e1", 10, 1e1 );
+ array[item++] = new TestCase( SECTION, "2e2", 200, 2e2 );
+ array[item++] = new TestCase( SECTION, "3e3", 3000, 3e3 );
+ array[item++] = new TestCase( SECTION, "4e4", 40000, 4e4 );
+
+ array[item++] = new TestCase( SECTION, "0e0", 0, 0e0 );
+ array[item++] = new TestCase( SECTION, "1e1", 10, 1e1 );
+ array[item++] = new TestCase( SECTION, "2e2", 200, 2e2 );
+ array[item++] = new TestCase( SECTION, "3e3", 3000, 3e3 );
+ array[item++] = new TestCase( SECTION, "4e4", 40000, 4e4 );
+
+ array[item++] = new TestCase( SECTION, "0E0", 0, 0E0 );
+ array[item++] = new TestCase( SECTION, "1E1", 10, 1E1 );
+ array[item++] = new TestCase( SECTION, "2E2", 200, 2E2 );
+ array[item++] = new TestCase( SECTION, "3E3", 3000, 3E3 );
+ array[item++] = new TestCase( SECTION, "4E4", 40000, 4E4 );
+
+ array[item++] = new TestCase( SECTION, "1.e-1", 0.1, 1.e-1 );
+ array[item++] = new TestCase( SECTION, "2.e-2", 0.02, 2.e-2 );
+ array[item++] = new TestCase( SECTION, "3.e-3", 0.003, 3.e-3 );
+ array[item++] = new TestCase( SECTION, "4.e-4", 0.0004, 4.e-4 );
+
+ array[item++] = new TestCase( SECTION, "0.1e-0", .1, 0.1e-0 );
+ array[item++] = new TestCase( SECTION, "1.1e-1", 0.11, 1.1e-1 );
+ array[item++] = new TestCase( SECTION, "2.2e-2", .022, 2.2e-2 );
+ array[item++] = new TestCase( SECTION, "3.3e-3", .0033, 3.3e-3 );
+ array[item++] = new TestCase( SECTION, "4.4e-4", .00044, 4.4e-4 );
+
+ array[item++] = new TestCase( SECTION, ".1e-0", .1, .1e-0 );
+ array[item++] = new TestCase( SECTION, ".1e-1", .01, .1e-1 );
+ array[item++] = new TestCase( SECTION, ".2e-2", .002, .2e-2 );
+ array[item++] = new TestCase( SECTION, ".3e-3", .0003, .3e-3 );
+ array[item++] = new TestCase( SECTION, ".4e-4", .00004, .4e-4 );
+
+ array[item++] = new TestCase( SECTION, "1.e+1", 10, 1.e+1 );
+ array[item++] = new TestCase( SECTION, "2.e+2", 200, 2.e+2 );
+ array[item++] = new TestCase( SECTION, "3.e+3", 3000, 3.e+3 );
+ array[item++] = new TestCase( SECTION, "4.e+4", 40000, 4.e+4 );
+
+ array[item++] = new TestCase( SECTION, "0.1e+0", .1, 0.1e+0 );
+ array[item++] = new TestCase( SECTION, "1.1e+1", 11, 1.1e+1 );
+ array[item++] = new TestCase( SECTION, "2.2e+2", 220, 2.2e+2 );
+ array[item++] = new TestCase( SECTION, "3.3e+3", 3300, 3.3e+3 );
+ array[item++] = new TestCase( SECTION, "4.4e+4", 44000, 4.4e+4 );
+
+ array[item++] = new TestCase( SECTION, ".1e+0", .1, .1e+0 );
+ array[item++] = new TestCase( SECTION, ".1e+1", 1, .1e+1 );
+ array[item++] = new TestCase( SECTION, ".2e+2", 20, .2e+2 );
+ array[item++] = new TestCase( SECTION, ".3e+3", 300, .3e+3 );
+ array[item++] = new TestCase( SECTION, ".4e+4", 4000, .4e+4 );
+
+ array[item++] = new TestCase( SECTION, "0x0", 0, 0x0 );
+ array[item++] = new TestCase( SECTION, "0x1", 1, 0x1 );
+ array[item++] = new TestCase( SECTION, "0x2", 2, 0x2 );
+ array[item++] = new TestCase( SECTION, "0x3", 3, 0x3 );
+ array[item++] = new TestCase( SECTION, "0x4", 4, 0x4 );
+ array[item++] = new TestCase( SECTION, "0x5", 5, 0x5 );
+ array[item++] = new TestCase( SECTION, "0x6", 6, 0x6 );
+ array[item++] = new TestCase( SECTION, "0x7", 7, 0x7 );
+ array[item++] = new TestCase( SECTION, "0x8", 8, 0x8 );
+ array[item++] = new TestCase( SECTION, "0x9", 9, 0x9 );
+ array[item++] = new TestCase( SECTION, "0xa", 10, 0xa );
+ array[item++] = new TestCase( SECTION, "0xb", 11, 0xb );
+ array[item++] = new TestCase( SECTION, "0xc", 12, 0xc );
+ array[item++] = new TestCase( SECTION, "0xd", 13, 0xd );
+ array[item++] = new TestCase( SECTION, "0xe", 14, 0xe );
+ array[item++] = new TestCase( SECTION, "0xf", 15, 0xf );
+
+ array[item++] = new TestCase( SECTION, "0X0", 0, 0X0 );
+ array[item++] = new TestCase( SECTION, "0X1", 1, 0X1 );
+ array[item++] = new TestCase( SECTION, "0X2", 2, 0X2 );
+ array[item++] = new TestCase( SECTION, "0X3", 3, 0X3 );
+ array[item++] = new TestCase( SECTION, "0X4", 4, 0X4 );
+ array[item++] = new TestCase( SECTION, "0X5", 5, 0X5 );
+ array[item++] = new TestCase( SECTION, "0X6", 6, 0X6 );
+ array[item++] = new TestCase( SECTION, "0X7", 7, 0X7 );
+ array[item++] = new TestCase( SECTION, "0X8", 8, 0X8 );
+ array[item++] = new TestCase( SECTION, "0X9", 9, 0X9 );
+ array[item++] = new TestCase( SECTION, "0Xa", 10, 0Xa );
+ array[item++] = new TestCase( SECTION, "0Xb", 11, 0Xb );
+ array[item++] = new TestCase( SECTION, "0Xc", 12, 0Xc );
+ array[item++] = new TestCase( SECTION, "0Xd", 13, 0Xd );
+ array[item++] = new TestCase( SECTION, "0Xe", 14, 0Xe );
+ array[item++] = new TestCase( SECTION, "0Xf", 15, 0Xf );
+
+ array[item++] = new TestCase( SECTION, "0x0", 0, 0x0 );
+ array[item++] = new TestCase( SECTION, "0x1", 1, 0x1 );
+ array[item++] = new TestCase( SECTION, "0x2", 2, 0x2 );
+ array[item++] = new TestCase( SECTION, "0x3", 3, 0x3 );
+ array[item++] = new TestCase( SECTION, "0x4", 4, 0x4 );
+ array[item++] = new TestCase( SECTION, "0x5", 5, 0x5 );
+ array[item++] = new TestCase( SECTION, "0x6", 6, 0x6 );
+ array[item++] = new TestCase( SECTION, "0x7", 7, 0x7 );
+ array[item++] = new TestCase( SECTION, "0x8", 8, 0x8 );
+ array[item++] = new TestCase( SECTION, "0x9", 9, 0x9 );
+ array[item++] = new TestCase( SECTION, "0xA", 10, 0xA );
+ array[item++] = new TestCase( SECTION, "0xB", 11, 0xB );
+ array[item++] = new TestCase( SECTION, "0xC", 12, 0xC );
+ array[item++] = new TestCase( SECTION, "0xD", 13, 0xD );
+ array[item++] = new TestCase( SECTION, "0xE", 14, 0xE );
+ array[item++] = new TestCase( SECTION, "0xF", 15, 0xF );
+
+ array[item++] = new TestCase( SECTION, "0X0", 0, 0X0 );
+ array[item++] = new TestCase( SECTION, "0X1", 1, 0X1 );
+ array[item++] = new TestCase( SECTION, "0X2", 2, 0X2 );
+ array[item++] = new TestCase( SECTION, "0X3", 3, 0X3 );
+ array[item++] = new TestCase( SECTION, "0X4", 4, 0X4 );
+ array[item++] = new TestCase( SECTION, "0X5", 5, 0X5 );
+ array[item++] = new TestCase( SECTION, "0X6", 6, 0X6 );
+ array[item++] = new TestCase( SECTION, "0X7", 7, 0X7 );
+ array[item++] = new TestCase( SECTION, "0X8", 8, 0X8 );
+ array[item++] = new TestCase( SECTION, "0X9", 9, 0X9 );
+ array[item++] = new TestCase( SECTION, "0XA", 10, 0XA );
+ array[item++] = new TestCase( SECTION, "0XB", 11, 0XB );
+ array[item++] = new TestCase( SECTION, "0XC", 12, 0XC );
+ array[item++] = new TestCase( SECTION, "0XD", 13, 0XD );
+ array[item++] = new TestCase( SECTION, "0XE", 14, 0XE );
+ array[item++] = new TestCase( SECTION, "0XF", 15, 0XF );
+
+
+ array[item++] = new TestCase( SECTION, "00", 0, 00 );
+ array[item++] = new TestCase( SECTION, "01", 1, 01 );
+ array[item++] = new TestCase( SECTION, "02", 2, 02 );
+ array[item++] = new TestCase( SECTION, "03", 3, 03 );
+ array[item++] = new TestCase( SECTION, "04", 4, 04 );
+ array[item++] = new TestCase( SECTION, "05", 5, 05 );
+ array[item++] = new TestCase( SECTION, "06", 6, 06 );
+ array[item++] = new TestCase( SECTION, "07", 7, 07 );
+
+ array[item++] = new TestCase( SECTION, "000", 0, 000 );
+ array[item++] = new TestCase( SECTION, "011", 9, 011 );
+ array[item++] = new TestCase( SECTION, "022", 18, 022 );
+ array[item++] = new TestCase( SECTION, "033", 27, 033 );
+ array[item++] = new TestCase( SECTION, "044", 36, 044 );
+ array[item++] = new TestCase( SECTION, "055", 45, 055 );
+ array[item++] = new TestCase( SECTION, "066", 54, 066 );
+ array[item++] = new TestCase( SECTION, "077", 63, 077 );
+
+ array[item++] = new TestCase( SECTION, "0.00000000001", 0.00000000001, 0.00000000001 );
+ array[item++] = new TestCase( SECTION, "0.00000000001e-2", 0.0000000000001, 0.00000000001e-2 );
+
+
+ array[item++] = new TestCase( SECTION,
+ "123456789012345671.9999",
+ "123456789012345660",
+ 123456789012345671.9999 +"");
+ array[item++] = new TestCase( SECTION,
+ "123456789012345672",
+ "123456789012345660",
+ 123456789012345672 +"");
+
+ array[item++] = new TestCase( SECTION,
+ "123456789012345672.000000000000000000000000000",
+ "123456789012345660",
+ 123456789012345672.000000000000000000000000000 +"");
+
+ array[item++] = new TestCase( SECTION,
+ "123456789012345672.01",
+ "123456789012345680",
+ 123456789012345672.01 +"");
+
+ array[item++] = new TestCase( SECTION,
+ "123456789012345672.000000000000000000000000001+'' == 123456789012345680 || 123456789012345660",
+ true,
+ ( 123456789012345672.00000000000000000000000000 +"" == 1234567890 * 100000000 + 12345680 )
+ ||
+ ( 123456789012345672.00000000000000000000000000 +"" == 1234567890 * 100000000 + 12345660) );
+
+ array[item++] = new TestCase( SECTION,
+ "123456789012345673",
+ "123456789012345680",
+ 123456789012345673 +"" );
+
+ array[item++] = new TestCase( SECTION,
+ "-123456789012345671.9999",
+ "-123456789012345660",
+ -123456789012345671.9999 +"" );
+
+ array[item++] = new TestCase( SECTION,
+ "-123456789012345672",
+ "-123456789012345660",
+ -123456789012345672+"");
+
+ array[item++] = new TestCase( SECTION,
+ "-123456789012345672.000000000000000000000000000",
+ "-123456789012345660",
+ -123456789012345672.000000000000000000000000000 +"");
+
+ array[item++] = new TestCase( SECTION,
+ "-123456789012345672.01",
+ "-123456789012345680",
+ -123456789012345672.01 +"" );
+
+ array[item++] = new TestCase( SECTION,
+ "-123456789012345672.000000000000000000000000001 == -123456789012345680 or -123456789012345660",
+ true,
+ (-123456789012345672.000000000000000000000000001 +"" == -1234567890 * 100000000 -12345680)
+ ||
+ (-123456789012345672.000000000000000000000000001 +"" == -1234567890 * 100000000 -12345660));
+
+ array[item++] = new TestCase( SECTION,
+ -123456789012345673,
+ "-123456789012345680",
+ -123456789012345673 +"");
+
+ array[item++] = new TestCase( SECTION,
+ "12345678901234567890",
+ "12345678901234567000",
+ 12345678901234567890 +"" );
+
+
+/*
+ array[item++] = new TestCase( SECTION, "12345678901234567", "12345678901234567", 12345678901234567+"" );
+ array[item++] = new TestCase( SECTION, "123456789012345678", "123456789012345678", 123456789012345678+"" );
+ array[item++] = new TestCase( SECTION, "1234567890123456789", "1234567890123456789", 1234567890123456789+"" );
+ array[item++] = new TestCase( SECTION, "12345678901234567890", "12345678901234567890", 12345678901234567890+"" );
+ array[item++] = new TestCase( SECTION, "123456789012345678900", "123456789012345678900", 123456789012345678900+"" );
+ array[item++] = new TestCase( SECTION, "1234567890123456789000", "1234567890123456789000", 1234567890123456789000+"" );
+*/
+ array[item++] = new TestCase( SECTION, "0x1", 1, 0x1 );
+ array[item++] = new TestCase( SECTION, "0x10", 16, 0x10 );
+ array[item++] = new TestCase( SECTION, "0x100", 256, 0x100 );
+ array[item++] = new TestCase( SECTION, "0x1000", 4096, 0x1000 );
+ array[item++] = new TestCase( SECTION, "0x10000", 65536, 0x10000 );
+ array[item++] = new TestCase( SECTION, "0x100000", 1048576, 0x100000 );
+ array[item++] = new TestCase( SECTION, "0x1000000", 16777216, 0x1000000 );
+ array[item++] = new TestCase( SECTION, "0x10000000", 268435456, 0x10000000 );
+/*
+ array[item++] = new TestCase( SECTION, "0x100000000", 4294967296, 0x100000000 );
+ array[item++] = new TestCase( SECTION, "0x1000000000", 68719476736, 0x1000000000 );
+ array[item++] = new TestCase( SECTION, "0x10000000000", 1099511627776, 0x10000000000 );
+*/
+ return ( array );
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = testcases[tc].actual;
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+
+ }
+
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.7.4.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.7.4.js
new file mode 100644
index 0000000..769b819
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.7.4.js
@@ -0,0 +1,275 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 7.7.4.js
+ ECMA Section: 7.7.4 String Literals
+
+ Description: A string literal is zero or more characters enclosed in
+ single or double quotes. Each character may be
+ represented by an escape sequence.
+
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+ var SECTION = "7.7.4";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "String Literals";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ // StringLiteral:: "" and ''
+
+ array[item++] = new TestCase( SECTION, "\"\"", "", "" );
+ array[item++] = new TestCase( SECTION, "\'\'", "", '' );
+
+ // DoubleStringCharacters:: DoubleStringCharacter :: EscapeSequence :: CharacterEscapeSequence
+ array[item++] = new TestCase( SECTION, "\\\"", String.fromCharCode(0x0022), "\"" );
+ array[item++] = new TestCase( SECTION, "\\\'", String.fromCharCode(0x0027), "\'" );
+ array[item++] = new TestCase( SECTION, "\\", String.fromCharCode(0x005C), "\\" );
+ array[item++] = new TestCase( SECTION, "\\b", String.fromCharCode(0x0008), "\b" );
+ array[item++] = new TestCase( SECTION, "\\f", String.fromCharCode(0x000C), "\f" );
+ array[item++] = new TestCase( SECTION, "\\n", String.fromCharCode(0x000A), "\n" );
+ array[item++] = new TestCase( SECTION, "\\r", String.fromCharCode(0x000D), "\r" );
+ array[item++] = new TestCase( SECTION, "\\t", String.fromCharCode(0x0009), "\t" );
+ array[item++] = new TestCase( SECTION, "\\v", String.fromCharCode(0x000B), "\v" );
+
+ // DoubleStringCharacters:DoubleStringCharacter::EscapeSequence::OctalEscapeSequence
+
+ array[item++] = new TestCase( SECTION, "\\00", String.fromCharCode(0x0000), "\00" );
+ array[item++] = new TestCase( SECTION, "\\01", String.fromCharCode(0x0001), "\01" );
+ array[item++] = new TestCase( SECTION, "\\02", String.fromCharCode(0x0002), "\02" );
+ array[item++] = new TestCase( SECTION, "\\03", String.fromCharCode(0x0003), "\03" );
+ array[item++] = new TestCase( SECTION, "\\04", String.fromCharCode(0x0004), "\04" );
+ array[item++] = new TestCase( SECTION, "\\05", String.fromCharCode(0x0005), "\05" );
+ array[item++] = new TestCase( SECTION, "\\06", String.fromCharCode(0x0006), "\06" );
+ array[item++] = new TestCase( SECTION, "\\07", String.fromCharCode(0x0007), "\07" );
+
+ array[item++] = new TestCase( SECTION, "\\010", String.fromCharCode(0x0008), "\010" );
+ array[item++] = new TestCase( SECTION, "\\011", String.fromCharCode(0x0009), "\011" );
+ array[item++] = new TestCase( SECTION, "\\012", String.fromCharCode(0x000A), "\012" );
+ array[item++] = new TestCase( SECTION, "\\013", String.fromCharCode(0x000B), "\013" );
+ array[item++] = new TestCase( SECTION, "\\014", String.fromCharCode(0x000C), "\014" );
+ array[item++] = new TestCase( SECTION, "\\015", String.fromCharCode(0x000D), "\015" );
+ array[item++] = new TestCase( SECTION, "\\016", String.fromCharCode(0x000E), "\016" );
+ array[item++] = new TestCase( SECTION, "\\017", String.fromCharCode(0x000F), "\017" );
+ array[item++] = new TestCase( SECTION, "\\020", String.fromCharCode(0x0010), "\020" );
+ array[item++] = new TestCase( SECTION, "\\042", String.fromCharCode(0x0022), "\042" );
+
+ array[item++] = new TestCase( SECTION, "\\0", String.fromCharCode(0x0000), "\0" );
+ array[item++] = new TestCase( SECTION, "\\1", String.fromCharCode(0x0001), "\1" );
+ array[item++] = new TestCase( SECTION, "\\2", String.fromCharCode(0x0002), "\2" );
+ array[item++] = new TestCase( SECTION, "\\3", String.fromCharCode(0x0003), "\3" );
+ array[item++] = new TestCase( SECTION, "\\4", String.fromCharCode(0x0004), "\4" );
+ array[item++] = new TestCase( SECTION, "\\5", String.fromCharCode(0x0005), "\5" );
+ array[item++] = new TestCase( SECTION, "\\6", String.fromCharCode(0x0006), "\6" );
+ array[item++] = new TestCase( SECTION, "\\7", String.fromCharCode(0x0007), "\7" );
+
+ array[item++] = new TestCase( SECTION, "\\10", String.fromCharCode(0x0008), "\10" );
+ array[item++] = new TestCase( SECTION, "\\11", String.fromCharCode(0x0009), "\11" );
+ array[item++] = new TestCase( SECTION, "\\12", String.fromCharCode(0x000A), "\12" );
+ array[item++] = new TestCase( SECTION, "\\13", String.fromCharCode(0x000B), "\13" );
+ array[item++] = new TestCase( SECTION, "\\14", String.fromCharCode(0x000C), "\14" );
+ array[item++] = new TestCase( SECTION, "\\15", String.fromCharCode(0x000D), "\15" );
+ array[item++] = new TestCase( SECTION, "\\16", String.fromCharCode(0x000E), "\16" );
+ array[item++] = new TestCase( SECTION, "\\17", String.fromCharCode(0x000F), "\17" );
+ array[item++] = new TestCase( SECTION, "\\20", String.fromCharCode(0x0010), "\20" );
+ array[item++] = new TestCase( SECTION, "\\42", String.fromCharCode(0x0022), "\42" );
+
+ array[item++] = new TestCase( SECTION, "\\000", String.fromCharCode(0), "\000" );
+ array[item++] = new TestCase( SECTION, "\\111", String.fromCharCode(73), "\111" );
+ array[item++] = new TestCase( SECTION, "\\222", String.fromCharCode(146), "\222" );
+ array[item++] = new TestCase( SECTION, "\\333", String.fromCharCode(219), "\333" );
+
+// following line commented out as it causes a compile time error
+// array[item++] = new TestCase( SECTION, "\\444", "444", "\444" );
+
+ // DoubleStringCharacters:DoubleStringCharacter::EscapeSequence::HexEscapeSequence
+/*
+ array[item++] = new TestCase( SECTION, "\\x0", String.fromCharCode(0), "\x0" );
+ array[item++] = new TestCase( SECTION, "\\x1", String.fromCharCode(1), "\x1" );
+ array[item++] = new TestCase( SECTION, "\\x2", String.fromCharCode(2), "\x2" );
+ array[item++] = new TestCase( SECTION, "\\x3", String.fromCharCode(3), "\x3" );
+ array[item++] = new TestCase( SECTION, "\\x4", String.fromCharCode(4), "\x4" );
+ array[item++] = new TestCase( SECTION, "\\x5", String.fromCharCode(5), "\x5" );
+ array[item++] = new TestCase( SECTION, "\\x6", String.fromCharCode(6), "\x6" );
+ array[item++] = new TestCase( SECTION, "\\x7", String.fromCharCode(7), "\x7" );
+ array[item++] = new TestCase( SECTION, "\\x8", String.fromCharCode(8), "\x8" );
+ array[item++] = new TestCase( SECTION, "\\x9", String.fromCharCode(9), "\x9" );
+ array[item++] = new TestCase( SECTION, "\\xA", String.fromCharCode(10), "\xA" );
+ array[item++] = new TestCase( SECTION, "\\xB", String.fromCharCode(11), "\xB" );
+ array[item++] = new TestCase( SECTION, "\\xC", String.fromCharCode(12), "\xC" );
+ array[item++] = new TestCase( SECTION, "\\xD", String.fromCharCode(13), "\xD" );
+ array[item++] = new TestCase( SECTION, "\\xE", String.fromCharCode(14), "\xE" );
+ array[item++] = new TestCase( SECTION, "\\xF", String.fromCharCode(15), "\xF" );
+
+*/
+ array[item++] = new TestCase( SECTION, "\\xF0", String.fromCharCode(240), "\xF0" );
+ array[item++] = new TestCase( SECTION, "\\xE1", String.fromCharCode(225), "\xE1" );
+ array[item++] = new TestCase( SECTION, "\\xD2", String.fromCharCode(210), "\xD2" );
+ array[item++] = new TestCase( SECTION, "\\xC3", String.fromCharCode(195), "\xC3" );
+ array[item++] = new TestCase( SECTION, "\\xB4", String.fromCharCode(180), "\xB4" );
+ array[item++] = new TestCase( SECTION, "\\xA5", String.fromCharCode(165), "\xA5" );
+ array[item++] = new TestCase( SECTION, "\\x96", String.fromCharCode(150), "\x96" );
+ array[item++] = new TestCase( SECTION, "\\x87", String.fromCharCode(135), "\x87" );
+ array[item++] = new TestCase( SECTION, "\\x78", String.fromCharCode(120), "\x78" );
+ array[item++] = new TestCase( SECTION, "\\x69", String.fromCharCode(105), "\x69" );
+ array[item++] = new TestCase( SECTION, "\\x5A", String.fromCharCode(90), "\x5A" );
+ array[item++] = new TestCase( SECTION, "\\x4B", String.fromCharCode(75), "\x4B" );
+ array[item++] = new TestCase( SECTION, "\\x3C", String.fromCharCode(60), "\x3C" );
+ array[item++] = new TestCase( SECTION, "\\x2D", String.fromCharCode(45), "\x2D" );
+ array[item++] = new TestCase( SECTION, "\\x1E", String.fromCharCode(30), "\x1E" );
+ array[item++] = new TestCase( SECTION, "\\x0F", String.fromCharCode(15), "\x0F" );
+
+ // string literals only take up to two hext digits. therefore, the third character in this string
+ // should be interpreted as a StringCharacter and not part of the HextEscapeSequence
+
+ array[item++] = new TestCase( SECTION, "\\xF0F", String.fromCharCode(240)+"F", "\xF0F" );
+ array[item++] = new TestCase( SECTION, "\\xE1E", String.fromCharCode(225)+"E", "\xE1E" );
+ array[item++] = new TestCase( SECTION, "\\xD2D", String.fromCharCode(210)+"D", "\xD2D" );
+ array[item++] = new TestCase( SECTION, "\\xC3C", String.fromCharCode(195)+"C", "\xC3C" );
+ array[item++] = new TestCase( SECTION, "\\xB4B", String.fromCharCode(180)+"B", "\xB4B" );
+ array[item++] = new TestCase( SECTION, "\\xA5A", String.fromCharCode(165)+"A", "\xA5A" );
+ array[item++] = new TestCase( SECTION, "\\x969", String.fromCharCode(150)+"9", "\x969" );
+ array[item++] = new TestCase( SECTION, "\\x878", String.fromCharCode(135)+"8", "\x878" );
+ array[item++] = new TestCase( SECTION, "\\x787", String.fromCharCode(120)+"7", "\x787" );
+ array[item++] = new TestCase( SECTION, "\\x696", String.fromCharCode(105)+"6", "\x696" );
+ array[item++] = new TestCase( SECTION, "\\x5A5", String.fromCharCode(90)+"5", "\x5A5" );
+ array[item++] = new TestCase( SECTION, "\\x4B4", String.fromCharCode(75)+"4", "\x4B4" );
+ array[item++] = new TestCase( SECTION, "\\x3C3", String.fromCharCode(60)+"3", "\x3C3" );
+ array[item++] = new TestCase( SECTION, "\\x2D2", String.fromCharCode(45)+"2", "\x2D2" );
+ array[item++] = new TestCase( SECTION, "\\x1E1", String.fromCharCode(30)+"1", "\x1E1" );
+ array[item++] = new TestCase( SECTION, "\\x0F0", String.fromCharCode(15)+"0", "\x0F0" );
+
+ // G is out of hex range
+
+ array[item++] = new TestCase( SECTION, "\\xG", "xG", "\xG" );
+ array[item++] = new TestCase( SECTION, "\\xCG", "xCG", "\xCG" );
+
+ // DoubleStringCharacter::EscapeSequence::CharacterEscapeSequence::\ NonEscapeCharacter
+ array[item++] = new TestCase( SECTION, "\\a", "a", "\a" );
+ array[item++] = new TestCase( SECTION, "\\c", "c", "\c" );
+ array[item++] = new TestCase( SECTION, "\\d", "d", "\d" );
+ array[item++] = new TestCase( SECTION, "\\e", "e", "\e" );
+ array[item++] = new TestCase( SECTION, "\\g", "g", "\g" );
+ array[item++] = new TestCase( SECTION, "\\h", "h", "\h" );
+ array[item++] = new TestCase( SECTION, "\\i", "i", "\i" );
+ array[item++] = new TestCase( SECTION, "\\j", "j", "\j" );
+ array[item++] = new TestCase( SECTION, "\\k", "k", "\k" );
+ array[item++] = new TestCase( SECTION, "\\l", "l", "\l" );
+ array[item++] = new TestCase( SECTION, "\\m", "m", "\m" );
+ array[item++] = new TestCase( SECTION, "\\o", "o", "\o" );
+ array[item++] = new TestCase( SECTION, "\\p", "p", "\p" );
+ array[item++] = new TestCase( SECTION, "\\q", "q", "\q" );
+ array[item++] = new TestCase( SECTION, "\\s", "s", "\s" );
+ array[item++] = new TestCase( SECTION, "\\u", "u", "\u" );
+
+ array[item++] = new TestCase( SECTION, "\\w", "w", "\w" );
+ array[item++] = new TestCase( SECTION, "\\x", "x", "\x" );
+ array[item++] = new TestCase( SECTION, "\\y", "y", "\y" );
+ array[item++] = new TestCase( SECTION, "\\z", "z", "\z" );
+ array[item++] = new TestCase( SECTION, "\\9", "9", "\9" );
+
+ array[item++] = new TestCase( SECTION, "\\A", "A", "\A" );
+ array[item++] = new TestCase( SECTION, "\\B", "B", "\B" );
+ array[item++] = new TestCase( SECTION, "\\C", "C", "\C" );
+ array[item++] = new TestCase( SECTION, "\\D", "D", "\D" );
+ array[item++] = new TestCase( SECTION, "\\E", "E", "\E" );
+ array[item++] = new TestCase( SECTION, "\\F", "F", "\F" );
+ array[item++] = new TestCase( SECTION, "\\G", "G", "\G" );
+ array[item++] = new TestCase( SECTION, "\\H", "H", "\H" );
+ array[item++] = new TestCase( SECTION, "\\I", "I", "\I" );
+ array[item++] = new TestCase( SECTION, "\\J", "J", "\J" );
+ array[item++] = new TestCase( SECTION, "\\K", "K", "\K" );
+ array[item++] = new TestCase( SECTION, "\\L", "L", "\L" );
+ array[item++] = new TestCase( SECTION, "\\M", "M", "\M" );
+ array[item++] = new TestCase( SECTION, "\\N", "N", "\N" );
+ array[item++] = new TestCase( SECTION, "\\O", "O", "\O" );
+ array[item++] = new TestCase( SECTION, "\\P", "P", "\P" );
+ array[item++] = new TestCase( SECTION, "\\Q", "Q", "\Q" );
+ array[item++] = new TestCase( SECTION, "\\R", "R", "\R" );
+ array[item++] = new TestCase( SECTION, "\\S", "S", "\S" );
+ array[item++] = new TestCase( SECTION, "\\T", "T", "\T" );
+ array[item++] = new TestCase( SECTION, "\\U", "U", "\U" );
+ array[item++] = new TestCase( SECTION, "\\V", "V", "\V" );
+ array[item++] = new TestCase( SECTION, "\\W", "W", "\W" );
+ array[item++] = new TestCase( SECTION, "\\X", "X", "\X" );
+ array[item++] = new TestCase( SECTION, "\\Y", "Y", "\Y" );
+ array[item++] = new TestCase( SECTION, "\\Z", "Z", "\Z" );
+
+ // DoubleStringCharacter::EscapeSequence::UnicodeEscapeSequence
+
+ array[item++] = new TestCase( SECTION, "\\u0020", " ", "\u0020" );
+ array[item++] = new TestCase( SECTION, "\\u0021", "!", "\u0021" );
+ array[item++] = new TestCase( SECTION, "\\u0022", "\"", "\u0022" );
+ array[item++] = new TestCase( SECTION, "\\u0023", "#", "\u0023" );
+ array[item++] = new TestCase( SECTION, "\\u0024", "$", "\u0024" );
+ array[item++] = new TestCase( SECTION, "\\u0025", "%", "\u0025" );
+ array[item++] = new TestCase( SECTION, "\\u0026", "&", "\u0026" );
+ array[item++] = new TestCase( SECTION, "\\u0027", "'", "\u0027" );
+ array[item++] = new TestCase( SECTION, "\\u0028", "(", "\u0028" );
+ array[item++] = new TestCase( SECTION, "\\u0029", ")", "\u0029" );
+ array[item++] = new TestCase( SECTION, "\\u002A", "*", "\u002A" );
+ array[item++] = new TestCase( SECTION, "\\u002B", "+", "\u002B" );
+ array[item++] = new TestCase( SECTION, "\\u002C", ",", "\u002C" );
+ array[item++] = new TestCase( SECTION, "\\u002D", "-", "\u002D" );
+ array[item++] = new TestCase( SECTION, "\\u002E", ".", "\u002E" );
+ array[item++] = new TestCase( SECTION, "\\u002F", "/", "\u002F" );
+ array[item++] = new TestCase( SECTION, "\\u0030", "0", "\u0030" );
+ array[item++] = new TestCase( SECTION, "\\u0031", "1", "\u0031" );
+ array[item++] = new TestCase( SECTION, "\\u0032", "2", "\u0032" );
+ array[item++] = new TestCase( SECTION, "\\u0033", "3", "\u0033" );
+ array[item++] = new TestCase( SECTION, "\\u0034", "4", "\u0034" );
+ array[item++] = new TestCase( SECTION, "\\u0035", "5", "\u0035" );
+ array[item++] = new TestCase( SECTION, "\\u0036", "6", "\u0036" );
+ array[item++] = new TestCase( SECTION, "\\u0037", "7", "\u0037" );
+ array[item++] = new TestCase( SECTION, "\\u0038", "8", "\u0038" );
+ array[item++] = new TestCase( SECTION, "\\u0039", "9", "\u0039" );
+
+
+ return ( array );
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = testcases[tc].actual;
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.8.2-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.8.2-n.js
new file mode 100644
index 0000000..82bd7c4
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/LexicalConventions/7.8.2-n.js
@@ -0,0 +1,48 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 7.8.2.js
+ ECMA Section: 7.8.2 Examples of Automatic Semicolon Insertion
+ Description: compare some specific examples of the automatic
+ insertion rules in the EMCA specification.
+ Author: christine@netscape.com
+ Date: 15 september 1997
+*/
+
+ var SECTION="7.8.2";
+ var VERSION="ECMA_1"
+ startTest();
+ writeHeaderToLog(SECTION+" "+"Examples of Semicolon Insertion");
+
+ testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+// array[item++] = new TestCase( "7.8.2", "{ 1 \n 2 } 3", 3, "{ 1 \n 2 } 3" );
+ array[item++] = new TestCase( "7.8.2", "{ 1 2 } 3", "error", eval("{1 2 } 3") );
+
+ return ( array );
+}
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8-1.js
new file mode 100644
index 0000000..8b08eb6
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8-1.js
@@ -0,0 +1,84 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.8-1.js
+ ECMA Section: 15.8 The Math Object
+
+ Description:
+
+ The Math object is merely a single object that has some named properties,
+ some of which are functions.
+
+ The value of the internal [[Prototype]] property of the Math object is the
+ Object prototype object (15.2.3.1).
+
+ The Math object does not have a [[Construct]] property; it is not possible
+ to use the Math object as a constructor with the new operator.
+
+ The Math object does not have a [[Call]] property; it is not possible to
+ invoke the Math object as a function.
+
+ Recall that, in this specification, the phrase "the number value for x" has
+ a technical meaning defined in section 8.5.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+
+ var SECTION = "15.8-1";
+ var VERSION = "ECMA_2";
+ startTest();
+ var TITLE = "The Math Object";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION,
+ "Math.__proto__ == Object.prototype",
+ true,
+ Math.__proto__ == Object.prototype );
+
+ array[item++] = new TestCase( SECTION,
+ "Math.__proto__",
+ Object.prototype,
+ Math.__proto__ );
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8-2-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8-2-n.js
new file mode 100644
index 0000000..2bf41c0
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8-2-n.js
@@ -0,0 +1,83 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.8-2.js
+ ECMA Section: 15.8 The Math Object
+
+ Description:
+
+ The Math object is merely a single object that has some named properties,
+ some of which are functions.
+
+ The value of the internal [[Prototype]] property of the Math object is the
+ Object prototype object (15.2.3.1).
+
+ The Math object does not have a [[Construct]] property; it is not possible
+ to use the Math object as a constructor with the new operator.
+
+ The Math object does not have a [[Call]] property; it is not possible to
+ invoke the Math object as a function.
+
+ Recall that, in this specification, the phrase "the number value for x" has
+ a technical meaning defined in section 8.5.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+
+ var SECTION = "15.8-2-n";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "The Math Object";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION,
+ "MYMATH = new Math()",
+ "error",
+ "MYMATH = new Math()" );
+
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += "Math does not have the [Construct] property";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8-3-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8-3-n.js
new file mode 100644
index 0000000..4896f48
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8-3-n.js
@@ -0,0 +1,81 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.8-3.js
+ ECMA Section: 15.8 The Math Object
+
+ Description:
+
+ The Math object is merely a single object that has some named properties,
+ some of which are functions.
+
+ The value of the internal [[Prototype]] property of the Math object is the
+ Object prototype object (15.2.3.1).
+
+ The Math object does not have a [[Construct]] property; it is not possible
+ to use the Math object as a constructor with the new operator.
+
+ The Math object does not have a [[Call]] property; it is not possible to
+ invoke the Math object as a function.
+
+ Recall that, in this specification, the phrase "the number value for x" has
+ a technical meaning defined in section 8.5.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var SECTION = "15.8-3-n";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "The Math Object";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION,
+ "MYMATH = Math()",
+ "error",
+ "MYMATH = Math()" );
+
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += "Math does not have the [Call] property";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.1-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.1-1.js
new file mode 100644
index 0000000..f22fdca
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.1-1.js
@@ -0,0 +1,62 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.8.1.1-1.js
+ ECMA Section: 15.8.1.1.js
+ Description: All value properties of the Math object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the ReadOnly attribute of Math.E
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+ var SECTION = "15.8.1.1-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Math.E";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION, "Math.E = 0; Math.E", 2.7182818284590452354, ("Math.E=0;Math.E") );
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "Math.E should be read-only ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.1-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.1-2.js
new file mode 100644
index 0000000..2aea4ff
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.1-2.js
@@ -0,0 +1,65 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.8.1.1-2.js
+ ECMA Section: 15.8.1.1.js
+ Description: All value properties of the Math object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the DontDelete attribute of Math.E
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+ var SECTION = "15.8.1.1-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Math.E";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ var MATH_E = 2.7182818284590452354
+ array[item++] = new TestCase( SECTION, "delete(Math.E)", false, "delete Math.E" );
+ array[item++] = new TestCase( SECTION, "delete(Math.E); Math.E", MATH_E, "delete Math.E; Math.E" );
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "should not be able to delete property";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.2-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.2-1.js
new file mode 100644
index 0000000..a9d8c0d
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.2-1.js
@@ -0,0 +1,62 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.8.1.2-1.js
+ ECMA Section: 15.8.2.js
+ Description: All value properties of the Math object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the ReadOnly attribute of Math.LN10
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+ var SECTION = "15.8.1.2-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Math.LN10";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION, "Math.LN10=0; Math.LN10", 2.302585092994046, "Math.LN10=0; Math.LN10" );
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "property should be read-only ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.2-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.2-2.js
new file mode 100644
index 0000000..2774177
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.2-2.js
@@ -0,0 +1,63 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.8.1.2-1.js
+ ECMA Section: 15.8.2.js
+ Description: All value properties of the Math object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the DontDelete attribute of Math.LN10
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+ var SECTION = "15.8.1.2-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Math.LN10";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION, "delete( Math.LN10 ); Math.LN10", 2.302585092994046, "delete(Math.LN10); Math.LN10" );
+ array[item++] = new TestCase( SECTION, "delete( Math.LN10 ); ", false, "delete(Math.LN10)" );
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "property should be read-only ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.3-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.3-1.js
new file mode 100644
index 0000000..d8354ad
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.3-1.js
@@ -0,0 +1,63 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.8.1.3-1.js
+ ECMA Section: 15.8.1.3.js
+ Description: All value properties of the Math object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the ReadOnly attribute of Math.LN2
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+ var SECTION = "15.8.1.3-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Math.LN2";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION, "Math.LN2=0; Math.LN2", 0.6931471805599453, ("Math.LN2=0; Math.LN2") );
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "property should be read-only ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.3-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.3-2.js
new file mode 100644
index 0000000..a26ef79
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.3-2.js
@@ -0,0 +1,69 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.8.1.3-3.js
+ ECMA Section: 15.8.1.3.js
+ Description: All value properties of the Math object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the DontDelete attribute of Math.LN2
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+ var SECTION = "15.8.1.3-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Math.LN2";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ var MATH_LN2 = 0.6931471805599453;
+
+ array[item++] = new TestCase( SECTION, "delete(Math.LN2)", false, "delete(Math.LN2)" );
+ array[item++] = new TestCase( SECTION, "delete(Math.LN2); Math.LN2", MATH_LN2, "delete(Math.LN2); Math.LN2" );
+
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "property should be read-only ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.4-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.4-1.js
new file mode 100644
index 0000000..82e2fea
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.4-1.js
@@ -0,0 +1,64 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.8.1.4-1.js
+ ECMA Section: 15.8.1.4.js
+ Description: All value properties of the Math object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the ReadOnly attribute of Math.LOG2E
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+ var SECTION = "15.8.1.4-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Math.LOG2E";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION, "Math.L0G2E=0; Math.LOG2E", 1.4426950408889634, ("Math.LOG2E=0; Math.LOG2E") );
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "property should be read-only ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.4-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.4-2.js
new file mode 100644
index 0000000..9208b46
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.4-2.js
@@ -0,0 +1,65 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.8.1.4-2.js
+ ECMA Section: 15.8.1.4.js
+ Description: All value properties of the Math object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the DontDelete attribute of Math.LOG2E
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+ var SECTION = "15.8.1.4-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Math.LOG2E";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION, "delete(Math.L0G2E);Math.LOG2E", 1.4426950408889634, "delete(Math.LOG2E);Math.LOG2E" );
+ array[item++] = new TestCase( SECTION, "delete(Math.L0G2E)", false, "delete(Math.LOG2E)" );
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "property should be read-only ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.5-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.5-1.js
new file mode 100644
index 0000000..1ad5000
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.5-1.js
@@ -0,0 +1,67 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.8.1.5-1.js
+ ECMA Section: 15.8.1.5.js
+ Description: All value properties of the Math object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the ReadOnly attribute of Math.LOG10E
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+
+ var SECTION = "15.8.1.5-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Math.LOG10E";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION, "Math.LOG10E=0; Math.LOG10E", 0.4342944819032518, ("Math.LOG10E=0; Math.LOG10E") );
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "property should be read-only ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.5-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.5-2.js
new file mode 100644
index 0000000..7b204e7
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.5-2.js
@@ -0,0 +1,66 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.8.1.5-2.js
+ ECMA Section: 15.8.1.5.js
+ Description: All value properties of the Math object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the DontDelete attribute of Math.LOG10E
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+ var SECTION = "15.8.1.5-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Math.LOG10E";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION, "delete Math.LOG10E; Math.LOG10E", 0.4342944819032518, "delete Math.LOG10E; Math.LOG10E" );
+ array[item++] = new TestCase( SECTION, "delete Math.LOG10E", false, "delete Math.LOG10E" );
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "property should be read-only ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.6-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.6-1.js
new file mode 100644
index 0000000..4a998cc
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.6-1.js
@@ -0,0 +1,63 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.8.1.6-1.js
+ ECMA Section: 15.8.1.6.js
+ Description: All value properties of the Math object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the ReadOnly attribute of Math.PI
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+ var SECTION = "15.8.1.6-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Math.PI";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION, "Math.PI=0; Math.PI", 3.1415926535897923846, "Math.PI=0; Math.PI" );
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "property should be read-only ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.6-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.6-2.js
new file mode 100644
index 0000000..3a0fb1f
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.6-2.js
@@ -0,0 +1,64 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.8.1.6-2.js
+ ECMA Section: 15.8.1.6.js
+ Description: All value properties of the Math object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the DontDelete attribute of Math.PI
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+ var SECTION = "15.8.1.6-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Math.PI";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION, "delete Math.PI; Math.PI", 3.1415926535897923846, "delete Math.PI; Math.PI" );
+ array[item++] = new TestCase( SECTION, "delete Math.PI; Math.PI", false, "delete Math.PI" );
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "property should be read-only ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.7-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.7-1.js
new file mode 100644
index 0000000..9eeb6d7
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.7-1.js
@@ -0,0 +1,64 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.8.1.7-1.js
+ ECMA Section: 15.8.1.7.js
+ Description: All value properties of the Math object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the ReadOnly attribute of Math.SQRT1_2
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+ var SECTION = "15.8.1.7-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Math.SQRT1_2";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION, "Math.SQRT1_2=0; Math.SQRT1_2", 0.7071067811865476, "Math.SQRT1_2=0; Math.SQRT1_2" );
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "property should be read-only ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.7-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.7-2.js
new file mode 100644
index 0000000..85dd054
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.7-2.js
@@ -0,0 +1,64 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.8.1.7-2.js
+ ECMA Section: 15.8.1.7.js
+ Description: All value properties of the Math object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the DontDelete attribute of Math.SQRT1_2
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+ var SECTION = "15.8.1.7-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Math.SQRT1_2";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION, "delete Math.SQRT1_2; Math.SQRT1_2", 0.7071067811865476, "delete Math.SQRT1_2; Math.SQRT1_2" );
+ array[item++] = new TestCase( SECTION, "delete Math.SQRT1_2", false, "delete Math.SQRT1_2" );
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "property should be read-only ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.8-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.8-1.js
new file mode 100644
index 0000000..1b3615d
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.8-1.js
@@ -0,0 +1,64 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.8.1.8-1.js
+ ECMA Section: 15.8.1.8.js
+ Description: All value properties of the Math object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the ReadOnly attribute of Math.SQRT2
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+ var SECTION = "15.8.1.8-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Math.SQRT2";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION, "Math.SQRT2=0; Math.SQRT2", 1.4142135623730951, ("Math.SQRT2=0; Math.SQRT2") );
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "property should be read-only ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.8-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.8-2.js
new file mode 100644
index 0000000..25634dd
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.8-2.js
@@ -0,0 +1,63 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.8.1.8-2.js
+ ECMA Section: 15.8.1.8.js
+ Description: All value properties of the Math object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the DontDelete attribute of Math.SQRT2
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+ var SECTION = "15.8.1.8-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Math.SQRT2";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION, "delete Math.SQRT2; Math.SQRT2", 1.4142135623730951, "delete Math.SQRT2; Math.SQRT2" );
+ array[item++] = new TestCase( SECTION, "delete Math.SQRT2", false, "delete Math.SQRT2" );
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "property should be read-only ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.8-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.8-3.js
new file mode 100644
index 0000000..d1df188
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.8-3.js
@@ -0,0 +1,61 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.8.1.8-3.js
+ ECMA Section: 15.8.1.8.js
+ Description: All value properties of the Math object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the DontDelete attribute of Math.SQRT2
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+ var SECTION = "15.8.1.8-3";
+ var VERSION = "ECMA_1";
+ startTest();
+ var testcases = getTestCases();
+
+ writeHeaderToLog( SECTION + " Math.SQRT2: DontDelete");
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION, "delete Math.SQRT2", false, ("delete Math.SQRT2") );
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "property should be read-only ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.js
new file mode 100644
index 0000000..a0fdf26
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.js
@@ -0,0 +1,86 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.8.1.js
+ ECMA Section: 15.8.1.js Value Properties of the Math Object
+ 15.8.1.1 E
+ 15.8.1.2 LN10
+ 15.8.1.3 LN2
+ 15.8.1.4 LOG2E
+ 15.8.1.5 LOG10E
+ 15.8.1.6 PI
+ 15.8.1.7 SQRT1_2
+ 15.8.1.8 SQRT2
+ Description: verify the values of some math constants
+ Author: christine@netscape.com
+ Date: 7 july 1997
+
+*/
+ var SECTION = "15.8.1"
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Value Properties of the Math Object";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( "15.8.1.1", "Math.E", 2.7182818284590452354, Math.E );
+ array[item++] = new TestCase( "15.8.1.1", "typeof Math.E", "number", typeof Math.E );
+ array[item++] = new TestCase( "15.8.1.2", "Math.LN10", 2.302585092994046, Math.LN10 );
+ array[item++] = new TestCase( "15.8.1.2", "typeof Math.LN10", "number", typeof Math.LN10 );
+ array[item++] = new TestCase( "15.8.1.3", "Math.LN2", 0.6931471805599453, Math.LN2 );
+ array[item++] = new TestCase( "15.8.1.3", "typeof Math.LN2", "number", typeof Math.LN2 );
+ array[item++] = new TestCase( "15.8.1.4", "Math.LOG2E", 1.4426950408889634, Math.LOG2E );
+ array[item++] = new TestCase( "15.8.1.4", "typeof Math.LOG2E", "number", typeof Math.LOG2E );
+ array[item++] = new TestCase( "15.8.1.5", "Math.LOG10E", 0.4342944819032518, Math.LOG10E);
+ array[item++] = new TestCase( "15.8.1.5", "typeof Math.LOG10E", "number", typeof Math.LOG10E);
+ array[item++] = new TestCase( "15.8.1.6", "Math.PI", 3.14159265358979323846, Math.PI );
+ array[item++] = new TestCase( "15.8.1.6", "typeof Math.PI", "number", typeof Math.PI );
+ array[item++] = new TestCase( "15.8.1.7", "Math.SQRT1_2", 0.7071067811865476, Math.SQRT1_2);
+ array[item++] = new TestCase( "15.8.1.7", "typeof Math.SQRT1_2", "number", typeof Math.SQRT1_2);
+ array[item++] = new TestCase( "15.8.1.8", "Math.SQRT2", 1.4142135623730951, Math.SQRT2 );
+ array[item++] = new TestCase( "15.8.1.8", "typeof Math.SQRT2", "number", typeof Math.SQRT2 );
+
+ array[item++] = new TestCase( SECTION, "var MATHPROPS='';for( p in Math ){ MATHPROPS +=p; };MATHPROPS",
+ "",
+ eval("var MATHPROPS='';for( p in Math ){ MATHPROPS +=p; };MATHPROPS") );
+
+ return ( array );
+}
+
+function test() {
+ for ( i = 0; i < testcases.length; i++ ) {
+ testcases[i].passed = writeTestCaseResult(
+ testcases[i].expect,
+ testcases[i].actual,
+ testcases[i].description +" = "+ testcases[i].actual );
+ testcases[i].reason += ( testcases[i].passed ) ? "" : "wrong value "
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.1.js
new file mode 100644
index 0000000..4f0ba21
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.1.js
@@ -0,0 +1,103 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.8.2.1.js
+ ECMA Section: 15.8.2.1 abs( x )
+ Description: return the absolute value of the argument,
+ which should be the magnitude of the argument
+ with a positive sign.
+ - if x is NaN, return NaN
+ - if x is -0, result is +0
+ - if x is -Infinity, result is +Infinity
+ Author: christine@netscape.com
+ Date: 7 july 1997
+*/
+ var SECTION = "15.8.2.1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Math.abs()";
+ var BUGNUMBER = "77391";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "Math.abs.length", 1, Math.abs.length );
+
+ array[item++] = new TestCase( SECTION, "Math.abs()", Number.NaN, Math.abs() );
+ array[item++] = new TestCase( SECTION, "Math.abs( void 0 )", Number.NaN, Math.abs(void 0) );
+ array[item++] = new TestCase( SECTION, "Math.abs( null )", 0, Math.abs(null) );
+ array[item++] = new TestCase( SECTION, "Math.abs( true )", 1, Math.abs(true) );
+ array[item++] = new TestCase( SECTION, "Math.abs( false )", 0, Math.abs(false) );
+ array[item++] = new TestCase( SECTION, "Math.abs( string primitive)", Number.NaN, Math.abs("a string primitive") );
+ array[item++] = new TestCase( SECTION, "Math.abs( string object )", Number.NaN, Math.abs(new String( 'a String object' )) );
+ array[item++] = new TestCase( SECTION, "Math.abs( Number.NaN )", Number.NaN, Math.abs(Number.NaN) );
+
+ array[item++] = new TestCase( SECTION, "Math.abs(0)", 0, Math.abs( 0 ) );
+ array[item++] = new TestCase( SECTION, "Math.abs( -0 )", 0, Math.abs(-0) );
+ array[item++] = new TestCase( SECTION, "Infinity/Math.abs(-0)", Infinity, Infinity/Math.abs(-0) );
+
+ array[item++] = new TestCase( SECTION, "Math.abs( -Infinity )", Number.POSITIVE_INFINITY, Math.abs( Number.NEGATIVE_INFINITY ) );
+ array[item++] = new TestCase( SECTION, "Math.abs( Infinity )", Number.POSITIVE_INFINITY, Math.abs( Number.POSITIVE_INFINITY ) );
+ array[item++] = new TestCase( SECTION, "Math.abs( - MAX_VALUE )", Number.MAX_VALUE, Math.abs( - Number.MAX_VALUE ) );
+ array[item++] = new TestCase( SECTION, "Math.abs( - MIN_VALUE )", Number.MIN_VALUE, Math.abs( -Number.MIN_VALUE ) );
+ array[item++] = new TestCase( SECTION, "Math.abs( MAX_VALUE )", Number.MAX_VALUE, Math.abs( Number.MAX_VALUE ) );
+ array[item++] = new TestCase( SECTION, "Math.abs( MIN_VALUE )", Number.MIN_VALUE, Math.abs( Number.MIN_VALUE ) );
+
+ array[item++] = new TestCase( SECTION, "Math.abs( -1 )", 1, Math.abs( -1 ) );
+ array[item++] = new TestCase( SECTION, "Math.abs( new Number( -1 ) )", 1, Math.abs( new Number(-1) ) );
+ array[item++] = new TestCase( SECTION, "Math.abs( 1 )", 1, Math.abs( 1 ) );
+ array[item++] = new TestCase( SECTION, "Math.abs( Math.PI )", Math.PI, Math.abs( Math.PI ) );
+ array[item++] = new TestCase( SECTION, "Math.abs( -Math.PI )", Math.PI, Math.abs( -Math.PI ) );
+ array[item++] = new TestCase( SECTION, "Math.abs(-1/100000000)", 1/100000000, Math.abs(-1/100000000) );
+ array[item++] = new TestCase( SECTION, "Math.abs(-Math.pow(2,32))", Math.pow(2,32), Math.abs(-Math.pow(2,32)) );
+ array[item++] = new TestCase( SECTION, "Math.abs(Math.pow(2,32))", Math.pow(2,32), Math.abs(Math.pow(2,32)) );
+ array[item++] = new TestCase( SECTION, "Math.abs( -0xfff )", 4095, Math.abs( -0xfff ) );
+ array[item++] = new TestCase( SECTION, "Math.abs( -0777 )", 511, Math.abs(-0777 ) );
+
+ array[item++] = new TestCase( SECTION, "Math.abs('-1e-1')", 0.1, Math.abs('-1e-1') );
+ array[item++] = new TestCase( SECTION, "Math.abs('0xff')", 255, Math.abs('0xff') );
+ array[item++] = new TestCase( SECTION, "Math.abs('077')", 77, Math.abs('077') );
+ array[item++] = new TestCase( SECTION, "Math.abs( 'Infinity' )", Infinity, Math.abs('Infinity') );
+ array[item++] = new TestCase( SECTION, "Math.abs( '-Infinity' )", Infinity, Math.abs('-Infinity') );
+
+ return ( array );
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.10.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.10.js
new file mode 100644
index 0000000..24b6cb8
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.10.js
@@ -0,0 +1,86 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.8.2.10.js
+ ECMA Section: 15.8.2.10 Math.log(x)
+ Description: return an approximiation to the natural logarithm of
+ the argument.
+ special cases:
+ - if arg is NaN result is NaN
+ - if arg is <0 result is NaN
+ - if arg is 0 or -0 result is -Infinity
+ - if arg is 1 result is 0
+ - if arg is Infinity result is Infinity
+ Author: christine@netscape.com
+ Date: 7 july 1997
+*/
+
+ var SECTION = "15.8.2.10";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Math.log(x)";
+ var BUGNUMBER = "77391";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "Math.log.length", 1, Math.log.length );
+
+ array[item++] = new TestCase( SECTION, "Math.log()", Number.NaN, Math.log() );
+ array[item++] = new TestCase( SECTION, "Math.log(void 0)", Number.NaN, Math.log(void 0) );
+ array[item++] = new TestCase( SECTION, "Math.log(null)", Number.NEGATIVE_INFINITY, Math.log(null) );
+ array[item++] = new TestCase( SECTION, "Math.log(true)", 0, Math.log(true) );
+ array[item++] = new TestCase( SECTION, "Math.log(false)", -Infinity, Math.log(false) );
+ array[item++] = new TestCase( SECTION, "Math.log('0')", -Infinity, Math.log('0') );
+ array[item++] = new TestCase( SECTION, "Math.log('1')", 0, Math.log('1') );
+ array[item++] = new TestCase( SECTION, "Math.log('Infinity')", Infinity, Math.log("Infinity") );
+
+ array[item++] = new TestCase( SECTION, "Math.log(NaN)", Number.NaN, Math.log(Number.NaN) );
+ array[item++] = new TestCase( SECTION, "Math.log(-0.0000001)", Number.NaN, Math.log(-0.000001) );
+ array[item++] = new TestCase( SECTION, "Math.log(-1)", Number.NaN, Math.log(-1) );
+ array[item++] = new TestCase( SECTION, "Math.log(0)", Number.NEGATIVE_INFINITY, Math.log(0) );
+ array[item++] = new TestCase( SECTION, "Math.log(-0)", Number.NEGATIVE_INFINITY, Math.log(-0));
+ array[item++] = new TestCase( SECTION, "Math.log(1)", 0, Math.log(1) );
+ array[item++] = new TestCase( SECTION, "Math.log(Infinity)", Number.POSITIVE_INFINITY, Math.log(Number.POSITIVE_INFINITY) );
+ array[item++] = new TestCase( SECTION, "Math.log(-Infinity)", Number.NaN, Math.log(Number.NEGATIVE_INFINITY) );
+
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.11.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.11.js
new file mode 100644
index 0000000..4be499c
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.11.js
@@ -0,0 +1,98 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.8.2.11.js
+ ECMA Section: 15.8.2.11 Math.max(x, y)
+ Description: return the smaller of the two arguments.
+ special cases:
+ - if x is NaN or y is NaN return NaN
+ - if x < y return x
+ - if y > x return y
+ - if x is +0 and y is +0 return +0
+ - if x is +0 and y is -0 return -0
+ - if x is -0 and y is +0 return -0
+ - if x is -0 and y is -0 return -0
+ Author: christine@netscape.com
+ Date: 7 july 1997
+*/
+
+ var SECTION = "15.8.2.11";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Math.max(x, y)";
+ var BUGNUMBER="76439";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "Math.max.length", 2, Math.max.length );
+
+ array[item++] = new TestCase( SECTION, "Math.max()", -Infinity, Math.max() );
+ array[item++] = new TestCase( SECTION, "Math.max(void 0, 1)", Number.NaN, Math.max( void 0, 1 ) );
+ array[item++] = new TestCase( SECTION, "Math.max(void 0, void 0)", Number.NaN, Math.max( void 0, void 0 ) );
+ array[item++] = new TestCase( SECTION, "Math.max(null, 1)", 1, Math.max( null, 1 ) );
+ array[item++] = new TestCase( SECTION, "Math.max(-1, null)", 0, Math.max( -1, null ) );
+ array[item++] = new TestCase( SECTION, "Math.max(true, false)", 1, Math.max(true,false) );
+
+ array[item++] = new TestCase( SECTION, "Math.max('-99','99')", 99, Math.max( "-99","99") );
+
+ array[item++] = new TestCase( SECTION, "Math.max(NaN, Infinity)", Number.NaN, Math.max(Number.NaN,Number.POSITIVE_INFINITY) );
+ array[item++] = new TestCase( SECTION, "Math.max(NaN, 0)", Number.NaN, Math.max(Number.NaN, 0) );
+ array[item++] = new TestCase( SECTION, "Math.max('a string', 0)", Number.NaN, Math.max("a string", 0) );
+ array[item++] = new TestCase( SECTION, "Math.max(NaN, 1)", Number.NaN, Math.max(Number.NaN,1) );
+ array[item++] = new TestCase( SECTION, "Math.max('a string',Infinity)", Number.NaN, Math.max("a string", Number.POSITIVE_INFINITY) );
+ array[item++] = new TestCase( SECTION, "Math.max(Infinity, NaN)", Number.NaN, Math.max( Number.POSITIVE_INFINITY, Number.NaN) );
+ array[item++] = new TestCase( SECTION, "Math.max(NaN, NaN)", Number.NaN, Math.max(Number.NaN, Number.NaN) );
+ array[item++] = new TestCase( SECTION, "Math.max(0,NaN)", Number.NaN, Math.max(0,Number.NaN) );
+ array[item++] = new TestCase( SECTION, "Math.max(1, NaN)", Number.NaN, Math.max(1, Number.NaN) );
+ array[item++] = new TestCase( SECTION, "Math.max(0,0)", 0, Math.max(0,0) );
+ array[item++] = new TestCase( SECTION, "Math.max(0,-0)", 0, Math.max(0,-0) );
+ array[item++] = new TestCase( SECTION, "Math.max(-0,0)", 0, Math.max(-0,0) );
+ array[item++] = new TestCase( SECTION, "Math.max(-0,-0)", -0, Math.max(-0,-0) );
+ array[item++] = new TestCase( SECTION, "Infinity/Math.max(-0,-0)", -Infinity, Infinity/Math.max(-0,-0) );
+ array[item++] = new TestCase( SECTION, "Math.max(Infinity, Number.MAX_VALUE)", Number.POSITIVE_INFINITY, Math.max(Number.POSITIVE_INFINITY, Number.MAX_VALUE) );
+ array[item++] = new TestCase( SECTION, "Math.max(Infinity, Infinity)", Number.POSITIVE_INFINITY, Math.max(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY) );
+ array[item++] = new TestCase( SECTION, "Math.max(-Infinity,-Infinity)", Number.NEGATIVE_INFINITY, Math.max(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY) );
+ array[item++] = new TestCase( SECTION, "Math.max(1,.99999999999999)", 1, Math.max(1,.99999999999999) );
+ array[item++] = new TestCase( SECTION, "Math.max(-1,-.99999999999999)", -.99999999999999, Math.max(-1,-.99999999999999) );
+
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.12.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.12.js
new file mode 100644
index 0000000..0706e0b
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.12.js
@@ -0,0 +1,96 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.8.2.12.js
+ ECMA Section: 15.8.2.12 Math.min(x, y)
+ Description: return the smaller of the two arguments.
+ special cases:
+ - if x is NaN or y is NaN return NaN
+ - if x < y return x
+ - if y > x return y
+ - if x is +0 and y is +0 return +0
+ - if x is +0 and y is -0 return -0
+ - if x is -0 and y is +0 return -0
+ - if x is -0 and y is -0 return -0
+ Author: christine@netscape.com
+ Date: 7 july 1997
+*/
+
+
+ var SECTION = "15.8.2.12";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Math.min(x, y)";
+ var BUGNUMBER="76439";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "Math.min.length", 2, Math.min.length );
+
+ array[item++] = new TestCase( SECTION, "Math.min()", Infinity, Math.min() );
+ array[item++] = new TestCase( SECTION, "Math.min(void 0, 1)", Number.NaN, Math.min( void 0, 1 ) );
+ array[item++] = new TestCase( SECTION, "Math.min(void 0, void 0)", Number.NaN, Math.min( void 0, void 0 ) );
+ array[item++] = new TestCase( SECTION, "Math.min(null, 1)", 0, Math.min( null, 1 ) );
+ array[item++] = new TestCase( SECTION, "Math.min(-1, null)", -1, Math.min( -1, null ) );
+ array[item++] = new TestCase( SECTION, "Math.min(true, false)", 0, Math.min(true,false) );
+
+ array[item++] = new TestCase( SECTION, "Math.min('-99','99')", -99, Math.min( "-99","99") );
+
+ array[item++] = new TestCase( SECTION, "Math.min(NaN,0)", Number.NaN, Math.min(Number.NaN,0) );
+ array[item++] = new TestCase( SECTION, "Math.min(NaN,1)", Number.NaN, Math.min(Number.NaN,1) );
+ array[item++] = new TestCase( SECTION, "Math.min(NaN,-1)", Number.NaN, Math.min(Number.NaN,-1) );
+ array[item++] = new TestCase( SECTION, "Math.min(0,NaN)", Number.NaN, Math.min(0,Number.NaN) );
+ array[item++] = new TestCase( SECTION, "Math.min(1,NaN)", Number.NaN, Math.min(1,Number.NaN) );
+ array[item++] = new TestCase( SECTION, "Math.min(-1,NaN)", Number.NaN, Math.min(-1,Number.NaN) );
+ array[item++] = new TestCase( SECTION, "Math.min(NaN,NaN)", Number.NaN, Math.min(Number.NaN,Number.NaN) );
+ array[item++] = new TestCase( SECTION, "Math.min(1,1.0000000001)", 1, Math.min(1,1.0000000001) );
+ array[item++] = new TestCase( SECTION, "Math.min(1.0000000001,1)", 1, Math.min(1.0000000001,1) );
+ array[item++] = new TestCase( SECTION, "Math.min(0,0)", 0, Math.min(0,0) );
+ array[item++] = new TestCase( SECTION, "Math.min(0,-0)", -0, Math.min(0,-0) );
+ array[item++] = new TestCase( SECTION, "Math.min(-0,-0)", -0, Math.min(-0,-0) );
+
+ array[item++] = new TestCase( SECTION, "Infinity/Math.min(0,-0)", -Infinity, Infinity/Math.min(0,-0) );
+ array[item++] = new TestCase( SECTION, "Infinity/Math.min(-0,-0)", -Infinity, Infinity/Math.min(-0,-0) );
+
+
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.13.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.13.js
new file mode 100644
index 0000000..4744eb0
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.13.js
@@ -0,0 +1,132 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.8.2.13.js
+ ECMA Section: 15.8.2.13 Math.pow(x, y)
+ Description: return an approximation to the result of x
+ to the power of y. there are many special cases;
+ refer to the spec.
+ Author: christine@netscape.com
+ Date: 9 july 1997
+*/
+
+ var SECTION = "15.8.2.13";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Math.pow(x, y)";
+ var BUGNUMBER="77141";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "Math.pow.length", 2, Math.pow.length );
+
+ array[item++] = new TestCase( SECTION, "Math.pow()", Number.NaN, Math.pow() );
+ array[item++] = new TestCase( SECTION, "Math.pow(null, null)", 1, Math.pow(null,null) );
+ array[item++] = new TestCase( SECTION, "Math.pow(void 0, void 0)", Number.NaN, Math.pow(void 0, void 0));
+ array[item++] = new TestCase( SECTION, "Math.pow(true, false)", 1, Math.pow(true, false) );
+ array[item++] = new TestCase( SECTION, "Math.pow(false,true)", 0, Math.pow(false,true) );
+ array[item++] = new TestCase( SECTION, "Math.pow('2','32')", 4294967296, Math.pow('2','32') );
+
+ array[item++] = new TestCase( SECTION, "Math.pow(1,NaN)", Number.NaN, Math.pow(1,Number.NaN) );
+ array[item++] = new TestCase( SECTION, "Math.pow(0,NaN)", Number.NaN, Math.pow(0,Number.NaN) );
+ array[item++] = new TestCase( SECTION, "Math.pow(NaN,0)", 1, Math.pow(Number.NaN,0) );
+ array[item++] = new TestCase( SECTION, "Math.pow(NaN,-0)", 1, Math.pow(Number.NaN,-0) );
+ array[item++] = new TestCase( SECTION, "Math.pow(NaN,1)", Number.NaN, Math.pow(Number.NaN, 1) );
+ array[item++] = new TestCase( SECTION, "Math.pow(NaN,.5)", Number.NaN, Math.pow(Number.NaN, .5) );
+ array[item++] = new TestCase( SECTION, "Math.pow(1.00000001, Infinity)", Number.POSITIVE_INFINITY, Math.pow(1.00000001, Number.POSITIVE_INFINITY) );
+ array[item++] = new TestCase( SECTION, "Math.pow(1.00000001, -Infinity)", 0, Math.pow(1.00000001, Number.NEGATIVE_INFINITY) );
+ array[item++] = new TestCase( SECTION, "Math.pow(-1.00000001, Infinity)", Number.POSITIVE_INFINITY, Math.pow(-1.00000001,Number.POSITIVE_INFINITY) );
+ array[item++] = new TestCase( SECTION, "Math.pow(-1.00000001, -Infinity)", 0, Math.pow(-1.00000001,Number.NEGATIVE_INFINITY) );
+ array[item++] = new TestCase( SECTION, "Math.pow(1, Infinity)", Number.NaN, Math.pow(1, Number.POSITIVE_INFINITY) );
+ array[item++] = new TestCase( SECTION, "Math.pow(1, -Infinity)", Number.NaN, Math.pow(1, Number.NEGATIVE_INFINITY) );
+ array[item++] = new TestCase( SECTION, "Math.pow(-1, Infinity)", Number.NaN, Math.pow(-1, Number.POSITIVE_INFINITY) );
+ array[item++] = new TestCase( SECTION, "Math.pow(-1, -Infinity)", Number.NaN, Math.pow(-1, Number.NEGATIVE_INFINITY) );
+ array[item++] = new TestCase( SECTION, "Math.pow(.0000000009, Infinity)", 0, Math.pow(.0000000009, Number.POSITIVE_INFINITY) );
+ array[item++] = new TestCase( SECTION, "Math.pow(-.0000000009, Infinity)", 0, Math.pow(-.0000000009, Number.POSITIVE_INFINITY) );
+ array[item++] = new TestCase( SECTION, "Math.pow(.0000000009, -Infinity)", Number.POSITIVE_INFINITY, Math.pow(-.0000000009, Number.NEGATIVE_INFINITY) );
+ array[item++] = new TestCase( SECTION, "Math.pow(Infinity, .00000000001)", Number.POSITIVE_INFINITY, Math.pow(Number.POSITIVE_INFINITY,.00000000001) );
+ array[item++] = new TestCase( SECTION, "Math.pow(Infinity, 1)", Number.POSITIVE_INFINITY, Math.pow(Number.POSITIVE_INFINITY, 1) );
+ array[item++] = new TestCase( SECTION, "Math.pow(Infinity, -.00000000001)",0, Math.pow(Number.POSITIVE_INFINITY, -.00000000001) );
+ array[item++] = new TestCase( SECTION, "Math.pow(Infinity, -1)", 0, Math.pow(Number.POSITIVE_INFINITY, -1) );
+ array[item++] = new TestCase( SECTION, "Math.pow(-Infinity, 1)", Number.NEGATIVE_INFINITY, Math.pow(Number.NEGATIVE_INFINITY, 1) );
+ array[item++] = new TestCase( SECTION, "Math.pow(-Infinity, 333)", Number.NEGATIVE_INFINITY, Math.pow(Number.NEGATIVE_INFINITY, 333) );
+ array[item++] = new TestCase( SECTION, "Math.pow(Infinity, 2)", Number.POSITIVE_INFINITY, Math.pow(Number.POSITIVE_INFINITY, 2) );
+ array[item++] = new TestCase( SECTION, "Math.pow(-Infinity, 666)", Number.POSITIVE_INFINITY, Math.pow(Number.NEGATIVE_INFINITY, 666) );
+ array[item++] = new TestCase( SECTION, "Math.pow(-Infinity, 0.5)", Number.POSITIVE_INFINITY, Math.pow(Number.NEGATIVE_INFINITY, 0.5) );
+ array[item++] = new TestCase( SECTION, "Math.pow(-Infinity, Infinity)", Number.POSITIVE_INFINITY, Math.pow(Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY) );
+
+ array[item++] = new TestCase( SECTION, "Math.pow(-Infinity, -1)", -0, Math.pow(Number.NEGATIVE_INFINITY, -1) );
+ array[item++] = new TestCase( SECTION, "Infinity/Math.pow(-Infinity, -1)", -Infinity, Infinity/Math.pow(Number.NEGATIVE_INFINITY, -1) );
+
+ array[item++] = new TestCase( SECTION, "Math.pow(-Infinity, -3)", -0, Math.pow(Number.NEGATIVE_INFINITY, -3) );
+ array[item++] = new TestCase( SECTION, "Math.pow(-Infinity, -2)", 0, Math.pow(Number.NEGATIVE_INFINITY, -2) );
+ array[item++] = new TestCase( SECTION, "Math.pow(-Infinity, -0.5)", 0, Math.pow(Number.NEGATIVE_INFINITY,-0.5) );
+ array[item++] = new TestCase( SECTION, "Math.pow(-Infinity, -Infinity)", 0, Math.pow(Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY) );
+ array[item++] = new TestCase( SECTION, "Math.pow(0, 1)", 0, Math.pow(0,1) );
+ array[item++] = new TestCase( SECTION, "Math.pow(0, 0)", 1, Math.pow(0,0) );
+ array[item++] = new TestCase( SECTION, "Math.pow(1, 0)", 1, Math.pow(1,0) );
+ array[item++] = new TestCase( SECTION, "Math.pow(-1, 0)", 1, Math.pow(-1,0) );
+ array[item++] = new TestCase( SECTION, "Math.pow(0, 0.5)", 0, Math.pow(0,0.5) );
+ array[item++] = new TestCase( SECTION, "Math.pow(0, 1000)", 0, Math.pow(0,1000) );
+ array[item++] = new TestCase( SECTION, "Math.pow(0, Infinity)", 0, Math.pow(0, Number.POSITIVE_INFINITY) );
+ array[item++] = new TestCase( SECTION, "Math.pow(0, -1)", Number.POSITIVE_INFINITY, Math.pow(0, -1) );
+ array[item++] = new TestCase( SECTION, "Math.pow(0, -0.5)", Number.POSITIVE_INFINITY, Math.pow(0, -0.5) );
+ array[item++] = new TestCase( SECTION, "Math.pow(0, -1000)", Number.POSITIVE_INFINITY, Math.pow(0, -1000) );
+ array[item++] = new TestCase( SECTION, "Math.pow(0, -Infinity)", Number.POSITIVE_INFINITY, Math.pow(0, Number.NEGATIVE_INFINITY) );
+ array[item++] = new TestCase( SECTION, "Math.pow(-0, 1)", -0, Math.pow(-0, 1) );
+ array[item++] = new TestCase( SECTION, "Math.pow(-0, 3)", -0, Math.pow(-0,3) );
+
+ array[item++] = new TestCase( SECTION, "Infinity/Math.pow(-0, 1)", -Infinity, Infinity/Math.pow(-0, 1) );
+ array[item++] = new TestCase( SECTION, "Infinity/Math.pow(-0, 3)", -Infinity, Infinity/Math.pow(-0,3) );
+
+ array[item++] = new TestCase( SECTION, "Math.pow(-0, 2)", 0, Math.pow(-0,2) );
+ array[item++] = new TestCase( SECTION, "Math.pow(-0, Infinity)", 0, Math.pow(-0, Number.POSITIVE_INFINITY) );
+ array[item++] = new TestCase( SECTION, "Math.pow(-0, -1)", Number.NEGATIVE_INFINITY, Math.pow(-0, -1) );
+ array[item++] = new TestCase( SECTION, "Math.pow(-0, -10001)", Number.NEGATIVE_INFINITY, Math.pow(-0, -10001) );
+ array[item++] = new TestCase( SECTION, "Math.pow(-0, -2)", Number.POSITIVE_INFINITY, Math.pow(-0, -2) );
+ array[item++] = new TestCase( SECTION, "Math.pow(-0, 0.5)", 0, Math.pow(-0, 0.5) );
+ array[item++] = new TestCase( SECTION, "Math.pow(-0, Infinity)", 0, Math.pow(-0, Number.POSITIVE_INFINITY) );
+ array[item++] = new TestCase( SECTION, "Math.pow(-1, 0.5)", Number.NaN, Math.pow(-1, 0.5) );
+ array[item++] = new TestCase( SECTION, "Math.pow(-1, NaN)", Number.NaN, Math.pow(-1, Number.NaN) );
+ array[item++] = new TestCase( SECTION, "Math.pow(-1, -0.5)", Number.NaN, Math.pow(-1, -0.5) );
+
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.14.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.14.js
new file mode 100644
index 0000000..e5ed1fb
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.14.js
@@ -0,0 +1,83 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.8.2.14.js
+ ECMA Section: 15.8.2.14 Math.random()
+ returns a number value x with a positive sign
+ with 1 > x >= 0 with approximately uniform
+ distribution over that range, using an
+ implementation-dependent algorithm or strategy.
+ This function takes no arguments.
+
+ Description:
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+ var SECTION = "15.8.2.14";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Math.random()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ for ( item = 0; item < 100; item++ ) {
+ array[item] = new TestCase( SECTION, "Math.random()", "pass", null );
+ }
+
+ return ( array );
+}
+function getRandom( caseno ) {
+ testcases[caseno].reason = Math.random();
+ testcases[caseno].actual = "pass";
+
+ if ( ! ( testcases[caseno].reason >= 0) ) {
+ testcases[caseno].actual = "fail";
+ }
+
+ if ( ! (testcases[caseno].reason < 1) ) {
+ testcases[caseno].actual = "fail";
+ }
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ getRandom( tc );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.15.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.15.js
new file mode 100644
index 0000000..ca8cc94
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.15.js
@@ -0,0 +1,113 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.8.2.15.js
+ ECMA Section: 15.8.2.15 Math.round(x)
+ Description: return the greatest number value that is closest to the
+ argument and is an integer. if two integers are equally
+ close to the argument. then the result is the number value
+ that is closer to Infinity. if the argument is an integer,
+ return the argument.
+ special cases:
+ - if x is NaN return NaN
+ - if x = +0 return +0
+ - if x = -0 return -0
+ - if x = Infinity return Infinity
+ - if x = -Infinity return -Infinity
+ - if 0 < x < 0.5 return 0
+ - if -0.5 <= x < 0 return -0
+ example:
+ Math.round( 3.5 ) == 4
+ Math.round( -3.5 ) == 3
+ also:
+ - Math.round(x) == Math.floor( x + 0.5 )
+ except if x = -0. in that case, Math.round(x) = -0
+
+ and Math.floor( x+0.5 ) = +0
+
+
+ Author: christine@netscape.com
+ Date: 7 july 1997
+*/
+
+ var SECTION = "15.8.2.15";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Math.round(x)";
+ var BUGNUMBER="331411";
+
+ var EXCLUDE = "true";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "Math.round.length", 1, Math.round.length );
+
+ array[item++] = new TestCase( SECTION, "Math.round()", Number.NaN, Math.round() );
+ array[item++] = new TestCase( SECTION, "Math.round(null)", 0, Math.round(0) );
+ array[item++] = new TestCase( SECTION, "Math.round(void 0)", Number.NaN, Math.round(void 0) );
+ array[item++] = new TestCase( SECTION, "Math.round(true)", 1, Math.round(true) );
+ array[item++] = new TestCase( SECTION, "Math.round(false)", 0, Math.round(false) );
+ array[item++] = new TestCase( SECTION, "Math.round('.99999')", 1, Math.round('.99999') );
+ array[item++] = new TestCase( SECTION, "Math.round('12345e-2')", 123, Math.round('12345e-2') );
+
+ array[item++] = new TestCase( SECTION, "Math.round(NaN)", Number.NaN, Math.round(Number.NaN) );
+ array[item++] = new TestCase( SECTION, "Math.round(0)", 0, Math.round(0) );
+ array[item++] = new TestCase( SECTION, "Math.round(-0)", -0, Math.round(-0));
+ array[item++] = new TestCase( SECTION, "Infinity/Math.round(-0)", -Infinity, Infinity/Math.round(-0) );
+
+ array[item++] = new TestCase( SECTION, "Math.round(Infinity)", Number.POSITIVE_INFINITY, Math.round(Number.POSITIVE_INFINITY));
+ array[item++] = new TestCase( SECTION, "Math.round(-Infinity)",Number.NEGATIVE_INFINITY, Math.round(Number.NEGATIVE_INFINITY));
+ array[item++] = new TestCase( SECTION, "Math.round(0.49)", 0, Math.round(0.49));
+ array[item++] = new TestCase( SECTION, "Math.round(0.5)", 1, Math.round(0.5));
+ array[item++] = new TestCase( SECTION, "Math.round(0.51)", 1, Math.round(0.51));
+
+ array[item++] = new TestCase( SECTION, "Math.round(-0.49)", -0, Math.round(-0.49));
+ array[item++] = new TestCase( SECTION, "Math.round(-0.5)", -0, Math.round(-0.5));
+ array[item++] = new TestCase( SECTION, "Infinity/Math.round(-0.49)", -Infinity, Infinity/Math.round(-0.49));
+ array[item++] = new TestCase( SECTION, "Infinity/Math.round(-0.5)", -Infinity, Infinity/Math.round(-0.5));
+
+ array[item++] = new TestCase( SECTION, "Math.round(-0.51)", -1, Math.round(-0.51));
+ array[item++] = new TestCase( SECTION, "Math.round(3.5)", 4, Math.round(3.5));
+ array[item++] = new TestCase( SECTION, "Math.round(-3.5)", -3, Math.round(-3));
+
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.16.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.16.js
new file mode 100644
index 0000000..b144d9b
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.16.js
@@ -0,0 +1,78 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.8.2.16.js
+ ECMA Section: 15.8.2.16 sin( x )
+ Description: return an approximation to the sine of the
+ argument. argument is expressed in radians
+ Author: christine@netscape.com
+ Date: 7 july 1997
+
+*/
+ var SECTION = "15.8.2.16";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Math.sin(x)";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "Math.sin.length", 1, Math.sin.length );
+
+ array[item++] = new TestCase( SECTION, "Math.sin()", Number.NaN, Math.sin() );
+ array[item++] = new TestCase( SECTION, "Math.sin(null)", 0, Math.sin(null) );
+ array[item++] = new TestCase( SECTION, "Math.sin(void 0)", Number.NaN, Math.sin(void 0) );
+ array[item++] = new TestCase( SECTION, "Math.sin(false)", 0, Math.sin(false) );
+ array[item++] = new TestCase( SECTION, "Math.sin('2.356194490192')", 0.7071067811865, Math.sin('2.356194490192') );
+
+ array[item++] = new TestCase( SECTION, "Math.sin(NaN)", Number.NaN, Math.sin(Number.NaN) );
+ array[item++] = new TestCase( SECTION, "Math.sin(0)", 0, Math.sin(0) );
+ array[item++] = new TestCase( SECTION, "Math.sin(-0)", -0, Math.sin(-0));
+ array[item++] = new TestCase( SECTION, "Math.sin(Infinity)", Number.NaN, Math.sin(Number.POSITIVE_INFINITY));
+ array[item++] = new TestCase( SECTION, "Math.sin(-Infinity)", Number.NaN, Math.sin(Number.NEGATIVE_INFINITY));
+ array[item++] = new TestCase( SECTION, "Math.sin(0.7853981633974)", 0.7071067811865, Math.sin(0.7853981633974));
+ array[item++] = new TestCase( SECTION, "Math.sin(1.570796326795)", 1, Math.sin(1.570796326795));
+ array[item++] = new TestCase( SECTION, "Math.sin(2.356194490192)", 0.7071067811865, Math.sin(2.356194490192));
+ array[item++] = new TestCase( SECTION, "Math.sin(3.14159265359)", 0, Math.sin(3.14159265359));
+
+ return ( array );
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.17.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.17.js
new file mode 100644
index 0000000..16859ed
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.17.js
@@ -0,0 +1,99 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.8.2.17.js
+ ECMA Section: 15.8.2.17 Math.sqrt(x)
+ Description: return an approximation to the squareroot of the argument.
+ special cases:
+ - if x is NaN return NaN
+ - if x < 0 return NaN
+ - if x == 0 return 0
+ - if x == -0 return -0
+ - if x == Infinity return Infinity
+ Author: christine@netscape.com
+ Date: 7 july 1997
+*/
+
+ var SECTION = "15.8.2.17";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Math.sqrt(x)";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "Math.sqrt.length", 1, Math.sqrt.length );
+
+ array[item++] = new TestCase( SECTION, "Math.sqrt()", Number.NaN, Math.sqrt() );
+ array[item++] = new TestCase( SECTION, "Math.sqrt(void 0)", Number.NaN, Math.sqrt(void 0) );
+ array[item++] = new TestCase( SECTION, "Math.sqrt(null)", 0, Math.sqrt(null) );
+ array[item++] = new TestCase( SECTION, "Math.sqrt(true)", 1, Math.sqrt(1) );
+ array[item++] = new TestCase( SECTION, "Math.sqrt(false)", 0, Math.sqrt(false) );
+ array[item++] = new TestCase( SECTION, "Math.sqrt('225')", 15, Math.sqrt('225') );
+
+ array[item++] = new TestCase( SECTION, "Math.sqrt(NaN)", Number.NaN, Math.sqrt(Number.NaN) );
+ array[item++] = new TestCase( SECTION, "Math.sqrt(-Infinity)", Number.NaN, Math.sqrt(Number.NEGATIVE_INFINITY));
+ array[item++] = new TestCase( SECTION, "Math.sqrt(-1)", Number.NaN, Math.sqrt(-1));
+ array[item++] = new TestCase( SECTION, "Math.sqrt(-0.5)", Number.NaN, Math.sqrt(-0.5));
+ array[item++] = new TestCase( SECTION, "Math.sqrt(0)", 0, Math.sqrt(0));
+ array[item++] = new TestCase( SECTION, "Math.sqrt(-0)", -0, Math.sqrt(-0));
+ array[item++] = new TestCase( SECTION, "Infinity/Math.sqrt(-0)", -Infinity, Infinity/Math.sqrt(-0) );
+ array[item++] = new TestCase( SECTION, "Math.sqrt(Infinity)", Number.POSITIVE_INFINITY, Math.sqrt(Number.POSITIVE_INFINITY));
+ array[item++] = new TestCase( SECTION, "Math.sqrt(1)", 1, Math.sqrt(1));
+ array[item++] = new TestCase( SECTION, "Math.sqrt(2)", Math.SQRT2, Math.sqrt(2));
+ array[item++] = new TestCase( SECTION, "Math.sqrt(0.5)", Math.SQRT1_2, Math.sqrt(0.5));
+ array[item++] = new TestCase( SECTION, "Math.sqrt(4)", 2, Math.sqrt(4));
+ array[item++] = new TestCase( SECTION, "Math.sqrt(9)", 3, Math.sqrt(9));
+ array[item++] = new TestCase( SECTION, "Math.sqrt(16)", 4, Math.sqrt(16));
+ array[item++] = new TestCase( SECTION, "Math.sqrt(25)", 5, Math.sqrt(25));
+ array[item++] = new TestCase( SECTION, "Math.sqrt(36)", 6, Math.sqrt(36));
+ array[item++] = new TestCase( SECTION, "Math.sqrt(49)", 7, Math.sqrt(49));
+ array[item++] = new TestCase( SECTION, "Math.sqrt(64)", 8, Math.sqrt(64));
+ array[item++] = new TestCase( SECTION, "Math.sqrt(256)", 16, Math.sqrt(256));
+ array[item++] = new TestCase( SECTION, "Math.sqrt(10000)", 100, Math.sqrt(10000));
+ array[item++] = new TestCase( SECTION, "Math.sqrt(65536)", 256, Math.sqrt(65536));
+ array[item++] = new TestCase( SECTION, "Math.sqrt(0.09)", 0.3, Math.sqrt(0.09));
+ array[item++] = new TestCase( SECTION, "Math.sqrt(0.01)", 0.1, Math.sqrt(0.01));
+ array[item++] = new TestCase( SECTION, "Math.sqrt(0.00000001)",0.0001, Math.sqrt(0.00000001));
+
+ return ( array );
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.18.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.18.js
new file mode 100644
index 0000000..f745dd7
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.18.js
@@ -0,0 +1,98 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.8.2.18.js
+ ECMA Section: 15.8.2.18 tan( x )
+ Description: return an approximation to the tan of the
+ argument. argument is expressed in radians
+ special cases:
+ - if x is NaN result is NaN
+ - if x is 0 result is 0
+ - if x is -0 result is -0
+ - if x is Infinity or -Infinity result is NaN
+ Author: christine@netscape.com
+ Date: 7 july 1997
+*/
+
+ var SECTION = "15.8.2.18";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Math.tan(x)";
+ var EXCLUDE = "true";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "Math.tan.length", 1, Math.tan.length );
+
+ array[item++] = new TestCase( SECTION, "Math.tan()", Number.NaN, Math.tan() );
+ array[item++] = new TestCase( SECTION, "Math.tan(void 0)", Number.NaN, Math.tan(void 0));
+ array[item++] = new TestCase( SECTION, "Math.tan(null)", 0, Math.tan(null) );
+ array[item++] = new TestCase( SECTION, "Math.tan(false)", 0, Math.tan(false) );
+
+ array[item++] = new TestCase( SECTION, "Math.tan(NaN)", Number.NaN, Math.tan(Number.NaN) );
+ array[item++] = new TestCase( SECTION, "Math.tan(0)", 0, Math.tan(0));
+ array[item++] = new TestCase( SECTION, "Math.tan(-0)", -0, Math.tan(-0));
+ array[item++] = new TestCase( SECTION, "Math.tan(Infinity)", Number.NaN, Math.tan(Number.POSITIVE_INFINITY));
+ array[item++] = new TestCase( SECTION, "Math.tan(-Infinity)", Number.NaN, Math.tan(Number.NEGATIVE_INFINITY));
+ array[item++] = new TestCase( SECTION, "Math.tan(Math.PI/4)", 1, Math.tan(Math.PI/4));
+ array[item++] = new TestCase( SECTION, "Math.tan(3*Math.PI/4)", -1, Math.tan(3*Math.PI/4));
+ array[item++] = new TestCase( SECTION, "Math.tan(Math.PI)", -0, Math.tan(Math.PI));
+ array[item++] = new TestCase( SECTION, "Math.tan(5*Math.PI/4)", 1, Math.tan(5*Math.PI/4));
+ array[item++] = new TestCase( SECTION, "Math.tan(7*Math.PI/4)", -1, Math.tan(7*Math.PI/4));
+ array[item++] = new TestCase( SECTION, "Infinity/Math.tan(-0)", -Infinity, Infinity/Math.tan(-0) );
+
+/*
+ Arctan (x) ~ PI/2 - 1/x for large x. For x = 1.6x10^16, 1/x is about the last binary digit of double precision PI/2.
+ That is to say, perturbing PI/2 by this much is about the smallest rounding error possible.
+
+ This suggests that the answer Christine is getting and a real Infinity are "adjacent" results from the tangent function. I
+ suspect that tan (PI/2 + one ulp) is a negative result about the same size as tan (PI/2) and that this pair are the closest
+ results to infinity that the algorithm can deliver.
+
+ In any case, my call is that the answer we're seeing is "right". I suggest the test pass on any result this size or larger.
+ = C =
+*/
+ array[item++] = new TestCase( SECTION, "Math.tan(3*Math.PI/2) >= 5443000000000000", true, Math.tan(3*Math.PI/2) >= 5443000000000000 );
+ array[item++] = new TestCase( SECTION, "Math.tan(Math.PI/2) >= 5443000000000000", true, Math.tan(Math.PI/2) >= 5443000000000000 );
+
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.2.js
new file mode 100644
index 0000000..4a6f11e
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.2.js
@@ -0,0 +1,86 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.8.2.2.js
+ ECMA Section: 15.8.2.2 acos( x )
+ Description: return an approximation to the arc cosine of the
+ argument. the result is expressed in radians and
+ range is from +0 to +PI. special cases:
+ - if x is NaN, return NaN
+ - if x > 1, the result is NaN
+ - if x < -1, the result is NaN
+ - if x == 1, the result is +0
+ Author: christine@netscape.com
+ Date: 7 july 1997
+*/
+ var SECTION = "15.8.2.2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Math.acos()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "Math.acos.length", 1, Math.acos.length );
+
+ array[item++] = new TestCase( SECTION, "Math.acos(void 0)", Number.NaN, Math.acos(void 0) );
+ array[item++] = new TestCase( SECTION, "Math.acos()", Number.NaN, Math.acos() );
+ array[item++] = new TestCase( SECTION, "Math.acos(null)", Math.PI/2, Math.acos(null) );
+ array[item++] = new TestCase( SECTION, "Math.acos(NaN)", Number.NaN, Math.acos(Number.NaN) );
+
+ array[item++] = new TestCase( SECTION, "Math.acos(a string)", Number.NaN, Math.acos("a string") );
+ array[item++] = new TestCase( SECTION, "Math.acos('0')", Math.PI/2, Math.acos('0') );
+ array[item++] = new TestCase( SECTION, "Math.acos('1')", 0, Math.acos('1') );
+ array[item++] = new TestCase( SECTION, "Math.acos('-1')", Math.PI, Math.acos('-1') );
+
+ array[item++] = new TestCase( SECTION, "Math.acos(1.00000001)", Number.NaN, Math.acos(1.00000001) );
+ array[item++] = new TestCase( SECTION, "Math.acos(11.00000001)", Number.NaN, Math.acos(-1.00000001) );
+ array[item++] = new TestCase( SECTION, "Math.acos(1)", 0, Math.acos(1) );
+ array[item++] = new TestCase( SECTION, "Math.acos(-1)", Math.PI, Math.acos(-1) );
+ array[item++] = new TestCase( SECTION, "Math.acos(0)", Math.PI/2, Math.acos(0) );
+ array[item++] = new TestCase( SECTION, "Math.acos(-0)", Math.PI/2, Math.acos(-0) );
+ array[item++] = new TestCase( SECTION, "Math.acos(Math.SQRT1_2)", Math.PI/4, Math.acos(Math.SQRT1_2));
+ array[item++] = new TestCase( SECTION, "Math.acos(-Math.SQRT1_2)", Math.PI/4*3, Math.acos(-Math.SQRT1_2));
+ array[item++] = new TestCase( SECTION, "Math.acos(0.9999619230642)", Math.PI/360, Math.acos(0.9999619230642));
+
+ return ( array );
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.3.js
new file mode 100644
index 0000000..2a00e93
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.3.js
@@ -0,0 +1,90 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.8.2.3.js
+ ECMA Section: 15.8.2.3 asin( x )
+ Description: return an approximation to the arc sine of the
+ argument. the result is expressed in radians and
+ range is from -PI/2 to +PI/2. special cases:
+ - if x is NaN, the result is NaN
+ - if x > 1, the result is NaN
+ - if x < -1, the result is NaN
+ - if x == +0, the result is +0
+ - if x == -0, the result is -0
+ Author: christine@netscape.com
+ Date: 7 july 1997
+
+*/
+ var SECTION = "15.8.2.3";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Math.asin()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "Math.asin()", Number.NaN, Math.asin() );
+ array[item++] = new TestCase( SECTION, "Math.asin(void 0)", Number.NaN, Math.asin(void 0) );
+ array[item++] = new TestCase( SECTION, "Math.asin(null)", 0, Math.asin(null) );
+ array[item++] = new TestCase( SECTION, "Math.asin(NaN)", Number.NaN, Math.asin(Number.NaN) );
+
+ array[item++] = new TestCase( SECTION, "Math.asin('string')", Number.NaN, Math.asin("string") );
+ array[item++] = new TestCase( SECTION, "Math.asin('0')", 0, Math.asin("0") );
+ array[item++] = new TestCase( SECTION, "Math.asin('1')", Math.PI/2, Math.asin("1") );
+ array[item++] = new TestCase( SECTION, "Math.asin('-1')", -Math.PI/2, Math.asin("-1") );
+ array[item++] = new TestCase( SECTION, "Math.asin(Math.SQRT1_2+'')", Math.PI/4, Math.asin(Math.SQRT1_2+'') );
+ array[item++] = new TestCase( SECTION, "Math.asin(-Math.SQRT1_2+'')", -Math.PI/4, Math.asin(-Math.SQRT1_2+'') );
+
+ array[item++] = new TestCase( SECTION, "Math.asin(1.000001)", Number.NaN, Math.asin(1.000001) );
+ array[item++] = new TestCase( SECTION, "Math.asin(-1.000001)", Number.NaN, Math.asin(-1.000001) );
+ array[item++] = new TestCase( SECTION, "Math.asin(0)", 0, Math.asin(0) );
+ array[item++] = new TestCase( SECTION, "Math.asin(-0)", -0, Math.asin(-0) );
+
+ array[item++] = new TestCase( SECTION, "Infinity/Math.asin(-0)", -Infinity, Infinity/Math.asin(-0) );
+
+ array[item++] = new TestCase( SECTION, "Math.asin(1)", Math.PI/2, Math.asin(1) );
+ array[item++] = new TestCase( SECTION, "Math.asin(-1)", -Math.PI/2, Math.asin(-1) );
+ array[item++] = new TestCase( SECTION, "Math.asin(Math.SQRT1_2))", Math.PI/4, Math.asin(Math.SQRT1_2) );
+ array[item++] = new TestCase( SECTION, "Math.asin(-Math.SQRT1_2))", -Math.PI/4, Math.asin(-Math.SQRT1_2));
+
+ return ( array );
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.4.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.4.js
new file mode 100644
index 0000000..3711331
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.4.js
@@ -0,0 +1,88 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+ /**
+ File Name: 15.8.2.4.js
+ ECMA Section: 15.8.2.4 atan( x )
+ Description: return an approximation to the arc tangent of the
+ argument. the result is expressed in radians and
+ range is from -PI/2 to +PI/2. special cases:
+ - if x is NaN, the result is NaN
+ - if x == +0, the result is +0
+ - if x == -0, the result is -0
+ - if x == +Infinity, the result is approximately +PI/2
+ - if x == -Infinity, the result is approximately -PI/2
+ Author: christine@netscape.com
+ Date: 7 july 1997
+
+*/
+
+ var SECTION = "15.8.2.4";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Math.atan()";
+ var BUGNUMBER="77391";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "Math.atan.length", 1, Math.atan.length );
+
+ array[item++] = new TestCase( SECTION, "Math.atan()", Number.NaN, Math.atan() );
+ array[item++] = new TestCase( SECTION, "Math.atan(void 0)", Number.NaN, Math.atan(void 0) );
+ array[item++] = new TestCase( SECTION, "Math.atan(null)", 0, Math.atan(null) );
+ array[item++] = new TestCase( SECTION, "Math.atan(NaN)", Number.NaN, Math.atan(Number.NaN) );
+
+ array[item++] = new TestCase( SECTION, "Math.atan('a string')", Number.NaN, Math.atan("a string") );
+ array[item++] = new TestCase( SECTION, "Math.atan('0')", 0, Math.atan('0') );
+ array[item++] = new TestCase( SECTION, "Math.atan('1')", Math.PI/4, Math.atan('1') );
+ array[item++] = new TestCase( SECTION, "Math.atan('-1')", -Math.PI/4, Math.atan('-1') );
+ array[item++] = new TestCase( SECTION, "Math.atan('Infinity)", Math.PI/2, Math.atan('Infinity') );
+ array[item++] = new TestCase( SECTION, "Math.atan('-Infinity)", -Math.PI/2, Math.atan('-Infinity') );
+
+ array[item++] = new TestCase( SECTION, "Math.atan(0)", 0, Math.atan(0) );
+ array[item++] = new TestCase( SECTION, "Math.atan(-0)", -0, Math.atan(-0) );
+ array[item++] = new TestCase( SECTION, "Infinity/Math.atan(-0)", -Infinity, Infinity/Math.atan(-0) );
+ array[item++] = new TestCase( SECTION, "Math.atan(Infinity)", Math.PI/2, Math.atan(Number.POSITIVE_INFINITY) );
+ array[item++] = new TestCase( SECTION, "Math.atan(-Infinity)", -Math.PI/2, Math.atan(Number.NEGATIVE_INFINITY) );
+ array[item++] = new TestCase( SECTION, "Math.atan(1)", Math.PI/4, Math.atan(1) );
+ array[item++] = new TestCase( SECTION, "Math.atan(-1)", -Math.PI/4, Math.atan(-1) );
+ return array;
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.5.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.5.js
new file mode 100644
index 0000000..d1eeead
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.5.js
@@ -0,0 +1,105 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.8.2.5.js
+ ECMA Section: 15.8.2.5 atan2( y, x )
+ Description:
+
+ Author: christine@netscape.com
+ Date: 7 july 1997
+
+*/
+ var SECTION = "15.8.2.5";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Math.atan2(x,y)";
+ var BUGNUMBER="76111";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "Math.atan2.length", 2, Math.atan2.length );
+
+ array[item++] = new TestCase( SECTION, "Math.atan2(NaN, 0)", Number.NaN, Math.atan2(Number.NaN,0) );
+ array[item++] = new TestCase( SECTION, "Math.atan2(null, null)", 0, Math.atan2(null, null) );
+ array[item++] = new TestCase( SECTION, "Math.atan2(void 0, void 0)", Number.NaN, Math.atan2(void 0, void 0) );
+ array[item++] = new TestCase( SECTION, "Math.atan2()", Number.NaN, Math.atan2() );
+
+ array[item++] = new TestCase( SECTION, "Math.atan2(0, NaN)", Number.NaN, Math.atan2(0,Number.NaN) );
+ array[item++] = new TestCase( SECTION, "Math.atan2(1, 0)", Math.PI/2, Math.atan2(1,0) );
+ array[item++] = new TestCase( SECTION, "Math.atan2(1,-0)", Math.PI/2, Math.atan2(1,-0) );
+ array[item++] = new TestCase( SECTION, "Math.atan2(0,0.001)", 0, Math.atan2(0,0.001) );
+ array[item++] = new TestCase( SECTION, "Math.atan2(0,0)", 0, Math.atan2(0,0) );
+ array[item++] = new TestCase( SECTION, "Math.atan2(0, -0)", Math.PI, Math.atan2(0,-0) );
+ array[item++] = new TestCase( SECTION, "Math.atan2(0, -1)", Math.PI, Math.atan2(0, -1) );
+
+ array[item++] = new TestCase( SECTION, "Math.atan2(-0, 1)", -0, Math.atan2(-0, 1) );
+ array[item++] = new TestCase( SECTION, "Infinity/Math.atan2(-0, 1)", -Infinity, Infinity/Math.atan2(-0,1) );
+
+ array[item++] = new TestCase( SECTION, "Math.atan2(-0, 0)", -0, Math.atan2(-0,0) );
+ array[item++] = new TestCase( SECTION, "Math.atan2(-0, -0)", -Math.PI, Math.atan2(-0, -0) );
+ array[item++] = new TestCase( SECTION, "Math.atan2(-0, -1)", -Math.PI, Math.atan2(-0, -1) );
+ array[item++] = new TestCase( SECTION, "Math.atan2(-1, 0)", -Math.PI/2, Math.atan2(-1, 0) );
+ array[item++] = new TestCase( SECTION, "Math.atan2(-1, -0)", -Math.PI/2, Math.atan2(-1, -0) );
+ array[item++] = new TestCase( SECTION, "Math.atan2(1, Infinity)", 0, Math.atan2(1, Number.POSITIVE_INFINITY) );
+ array[item++] = new TestCase( SECTION, "Math.atan2(1,-Infinity)", Math.PI, Math.atan2(1, Number.NEGATIVE_INFINITY) );
+
+ array[item++] = new TestCase( SECTION, "Math.atan2(-1, Infinity)", -0, Math.atan2(-1,Number.POSITIVE_INFINITY) );
+ array[item++] = new TestCase( SECTION, "Infinity/Math.atan2(-1, Infinity)", -Infinity, Infinity/Math.atan2(-1,Infinity) );
+
+ array[item++] = new TestCase( SECTION, "Math.atan2(-1,-Infinity)", -Math.PI, Math.atan2(-1,Number.NEGATIVE_INFINITY) );
+ array[item++] = new TestCase( SECTION, "Math.atan2(Infinity, 0)", Math.PI/2, Math.atan2(Number.POSITIVE_INFINITY, 0) );
+ array[item++] = new TestCase( SECTION, "Math.atan2(Infinity, 1)", Math.PI/2, Math.atan2(Number.POSITIVE_INFINITY, 1) );
+ array[item++] = new TestCase( SECTION, "Math.atan2(Infinity,-1)", Math.PI/2, Math.atan2(Number.POSITIVE_INFINITY,-1) );
+ array[item++] = new TestCase( SECTION, "Math.atan2(Infinity,-0)", Math.PI/2, Math.atan2(Number.POSITIVE_INFINITY,-0) );
+ array[item++] = new TestCase( SECTION, "Math.atan2(-Infinity, 0)", -Math.PI/2, Math.atan2(Number.NEGATIVE_INFINITY, 0) );
+ array[item++] = new TestCase( SECTION, "Math.atan2(-Infinity,-0)", -Math.PI/2, Math.atan2(Number.NEGATIVE_INFINITY,-0) );
+ array[item++] = new TestCase( SECTION, "Math.atan2(-Infinity, 1)", -Math.PI/2, Math.atan2(Number.NEGATIVE_INFINITY, 1) );
+ array[item++] = new TestCase( SECTION, "Math.atan2(-Infinity, -1)", -Math.PI/2, Math.atan2(Number.NEGATIVE_INFINITY,-1) );
+ array[item++] = new TestCase( SECTION, "Math.atan2(Infinity, Infinity)", Math.PI/4, Math.atan2(Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY) );
+ array[item++] = new TestCase( SECTION, "Math.atan2(Infinity, -Infinity)", 3*Math.PI/4, Math.atan2(Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY) );
+ array[item++] = new TestCase( SECTION, "Math.atan2(-Infinity, Infinity)", -Math.PI/4, Math.atan2(Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY) );
+ array[item++] = new TestCase( SECTION, "Math.atan2(-Infinity, -Infinity)", -3*Math.PI/4, Math.atan2(Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY) );
+ array[item++] = new TestCase( SECTION, "Math.atan2(-1, 1)", -Math.PI/4, Math.atan2( -1, 1) );
+
+ return array;
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.6.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.6.js
new file mode 100644
index 0000000..738bfe4
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.6.js
@@ -0,0 +1,108 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.8.2.6.js
+ ECMA Section: 15.8.2.6 Math.ceil(x)
+ Description: return the smallest number value that is not less than the
+ argument and is equal to a mathematical integer. if the
+ number is already an integer, return the number itself.
+ special cases:
+ - if x is NaN return NaN
+ - if x = +0 return +0
+ - if x = 0 return -0
+ - if x = Infinity return Infinity
+ - if x = -Infinity return -Infinity
+ - if ( -1 < x < 0 ) return -0
+ also:
+ - the value of Math.ceil(x) == -Math.ceil(-x)
+ Author: christine@netscape.com
+ Date: 7 july 1997
+*/
+ var SECTION = "15.8.2.6";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Math.ceil(x)";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "Math.ceil.length", 1, Math.ceil.length );
+
+ array[item++] = new TestCase( SECTION, "Math.ceil(NaN)", Number.NaN, Math.ceil(Number.NaN) );
+ array[item++] = new TestCase( SECTION, "Math.ceil(null)", 0, Math.ceil(null) );
+ array[item++] = new TestCase( SECTION, "Math.ceil()", Number.NaN, Math.ceil() );
+ array[item++] = new TestCase( SECTION, "Math.ceil(void 0)", Number.NaN, Math.ceil(void 0) );
+
+ array[item++] = new TestCase( SECTION, "Math.ceil('0')", 0, Math.ceil('0') );
+ array[item++] = new TestCase( SECTION, "Math.ceil('-0')", -0, Math.ceil('-0') );
+ array[item++] = new TestCase( SECTION, "Infinity/Math.ceil('0')", Infinity, Infinity/Math.ceil('0'));
+ array[item++] = new TestCase( SECTION, "Infinity/Math.ceil('-0')", -Infinity, Infinity/Math.ceil('-0'));
+
+ array[item++] = new TestCase( SECTION, "Math.ceil(0)", 0, Math.ceil(0) );
+ array[item++] = new TestCase( SECTION, "Math.ceil(-0)", -0, Math.ceil(-0) );
+ array[item++] = new TestCase( SECTION, "Infinity/Math.ceil(0)", Infinity, Infinity/Math.ceil(0));
+ array[item++] = new TestCase( SECTION, "Infinity/Math.ceil(-0)", -Infinity, Infinity/Math.ceil(-0));
+
+ array[item++] = new TestCase( SECTION, "Math.ceil(Infinity)", Number.POSITIVE_INFINITY, Math.ceil(Number.POSITIVE_INFINITY) );
+ array[item++] = new TestCase( SECTION, "Math.ceil(-Infinity)", Number.NEGATIVE_INFINITY, Math.ceil(Number.NEGATIVE_INFINITY) );
+ array[item++] = new TestCase( SECTION, "Math.ceil(-Number.MIN_VALUE)", -0, Math.ceil(-Number.MIN_VALUE) );
+ array[item++] = new TestCase( SECTION, "Infinity/Math.ceil(-Number.MIN_VALUE)", -Infinity, Infinity/Math.ceil(-Number.MIN_VALUE) );
+ array[item++] = new TestCase( SECTION, "Math.ceil(1)", 1, Math.ceil(1) );
+ array[item++] = new TestCase( SECTION, "Math.ceil(-1)", -1, Math.ceil(-1) );
+ array[item++] = new TestCase( SECTION, "Math.ceil(-0.9)", -0, Math.ceil(-0.9) );
+ array[item++] = new TestCase( SECTION, "Infinity/Math.ceil(-0.9)", -Infinity, Infinity/Math.ceil(-0.9) );
+ array[item++] = new TestCase( SECTION, "Math.ceil(0.9 )", 1, Math.ceil( 0.9) );
+ array[item++] = new TestCase( SECTION, "Math.ceil(-1.1)", -1, Math.ceil( -1.1));
+ array[item++] = new TestCase( SECTION, "Math.ceil( 1.1)", 2, Math.ceil( 1.1));
+
+ array[item++] = new TestCase( SECTION, "Math.ceil(Infinity)", -Math.floor(-Infinity), Math.ceil(Number.POSITIVE_INFINITY) );
+ array[item++] = new TestCase( SECTION, "Math.ceil(-Infinity)", -Math.floor(Infinity), Math.ceil(Number.NEGATIVE_INFINITY) );
+ array[item++] = new TestCase( SECTION, "Math.ceil(-Number.MIN_VALUE)", -Math.floor(Number.MIN_VALUE), Math.ceil(-Number.MIN_VALUE) );
+ array[item++] = new TestCase( SECTION, "Math.ceil(1)", -Math.floor(-1), Math.ceil(1) );
+ array[item++] = new TestCase( SECTION, "Math.ceil(-1)", -Math.floor(1), Math.ceil(-1) );
+ array[item++] = new TestCase( SECTION, "Math.ceil(-0.9)", -Math.floor(0.9), Math.ceil(-0.9) );
+ array[item++] = new TestCase( SECTION, "Math.ceil(0.9 )", -Math.floor(-0.9), Math.ceil( 0.9) );
+ array[item++] = new TestCase( SECTION, "Math.ceil(-1.1)", -Math.floor(1.1), Math.ceil( -1.1));
+ array[item++] = new TestCase( SECTION, "Math.ceil( 1.1)", -Math.floor(-1.1), Math.ceil( 1.1));
+
+ return ( array );
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.7.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.7.js
new file mode 100644
index 0000000..6b7dcfe
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.7.js
@@ -0,0 +1,111 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.8.2.7.js
+ ECMA Section: 15.8.2.7 cos( x )
+ Description: return an approximation to the cosine of the
+ argument. argument is expressed in radians
+ Author: christine@netscape.com
+ Date: 7 july 1997
+
+*/
+
+ var SECTION = "15.8.2.7";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Math.cos(x)";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "Math.cos.length", 1, Math.cos.length );
+
+ array[item++] = new TestCase( SECTION, "Math.cos()", Number.NaN, Math.cos() );
+ array[item++] = new TestCase( SECTION, "Math.cos(void 0)", Number.NaN, Math.cos(void 0) );
+ array[item++] = new TestCase( SECTION, "Math.cos(false)", 1, Math.cos(false) );
+ array[item++] = new TestCase( SECTION, "Math.cos(null)", 1, Math.cos(null) );
+
+ array[item++] = new TestCase( SECTION, "Math.cos('0')", 1, Math.cos('0') );
+ array[item++] = new TestCase( SECTION, "Math.cos('Infinity')", Number.NaN, Math.cos("Infinity") );
+ array[item++] = new TestCase( SECTION, "Math.cos('3.14159265359')", -1, Math.cos('3.14159265359') );
+
+ array[item++] = new TestCase( SECTION, "Math.cos(NaN)", Number.NaN, Math.cos(Number.NaN) );
+ array[item++] = new TestCase( SECTION, "Math.cos(0)", 1, Math.cos(0) );
+ array[item++] = new TestCase( SECTION, "Math.cos(-0)", 1, Math.cos(-0) );
+ array[item++] = new TestCase( SECTION, "Math.cos(Infinity)", Number.NaN, Math.cos(Number.POSITIVE_INFINITY) );
+ array[item++] = new TestCase( SECTION, "Math.cos(-Infinity)", Number.NaN, Math.cos(Number.NEGATIVE_INFINITY) );
+ array[item++] = new TestCase( SECTION, "Math.cos(0.7853981633974)", 0.7071067811865, Math.cos(0.7853981633974) );
+ array[item++] = new TestCase( SECTION, "Math.cos(1.570796326795)", 0, Math.cos(1.570796326795) );
+ array[item++] = new TestCase( SECTION, "Math.cos(2.356194490192)", -0.7071067811865, Math.cos(2.356194490192) );
+ array[item++] = new TestCase( SECTION, "Math.cos(3.14159265359)", -1, Math.cos(3.14159265359) );
+ array[item++] = new TestCase( SECTION, "Math.cos(3.926990816987)", -0.7071067811865, Math.cos(3.926990816987) );
+ array[item++] = new TestCase( SECTION, "Math.cos(4.712388980385)", 0, Math.cos(4.712388980385) );
+ array[item++] = new TestCase( SECTION, "Math.cos(5.497787143782)", 0.7071067811865, Math.cos(5.497787143782) );
+ array[item++] = new TestCase( SECTION, "Math.cos(Math.PI*2)", 1, Math.cos(Math.PI*2) );
+ array[item++] = new TestCase( SECTION, "Math.cos(Math.PI/4)", Math.SQRT2/2, Math.cos(Math.PI/4) );
+ array[item++] = new TestCase( SECTION, "Math.cos(Math.PI/2)", 0, Math.cos(Math.PI/2) );
+ array[item++] = new TestCase( SECTION, "Math.cos(3*Math.PI/4)", -Math.SQRT2/2, Math.cos(3*Math.PI/4) );
+ array[item++] = new TestCase( SECTION, "Math.cos(Math.PI)", -1, Math.cos(Math.PI) );
+ array[item++] = new TestCase( SECTION, "Math.cos(5*Math.PI/4)", -Math.SQRT2/2, Math.cos(5*Math.PI/4) );
+ array[item++] = new TestCase( SECTION, "Math.cos(3*Math.PI/2)", 0, Math.cos(3*Math.PI/2) );
+ array[item++] = new TestCase( SECTION, "Math.cos(7*Math.PI/4)", Math.SQRT2/2, Math.cos(7*Math.PI/4) );
+ array[item++] = new TestCase( SECTION, "Math.cos(Math.PI*2)", 1, Math.cos(2*Math.PI) );
+ array[item++] = new TestCase( SECTION, "Math.cos(-0.7853981633974)", 0.7071067811865, Math.cos(-0.7853981633974) );
+ array[item++] = new TestCase( SECTION, "Math.cos(-1.570796326795)", 0, Math.cos(-1.570796326795) );
+ array[item++] = new TestCase( SECTION, "Math.cos(-2.3561944901920)", -.7071067811865, Math.cos(2.3561944901920) );
+ array[item++] = new TestCase( SECTION, "Math.cos(-3.14159265359)", -1, Math.cos(3.14159265359) );
+ array[item++] = new TestCase( SECTION, "Math.cos(-3.926990816987)", -0.7071067811865, Math.cos(3.926990816987) );
+ array[item++] = new TestCase( SECTION, "Math.cos(-4.712388980385)", 0, Math.cos(4.712388980385) );
+ array[item++] = new TestCase( SECTION, "Math.cos(-5.497787143782)", 0.7071067811865, Math.cos(5.497787143782) );
+ array[item++] = new TestCase( SECTION, "Math.cos(-6.28318530718)", 1, Math.cos(6.28318530718) );
+ array[item++] = new TestCase( SECTION, "Math.cos(-Math.PI/4)", Math.SQRT2/2, Math.cos(-Math.PI/4) );
+ array[item++] = new TestCase( SECTION, "Math.cos(-Math.PI/2)", 0, Math.cos(-Math.PI/2) );
+ array[item++] = new TestCase( SECTION, "Math.cos(-3*Math.PI/4)", -Math.SQRT2/2, Math.cos(-3*Math.PI/4) );
+ array[item++] = new TestCase( SECTION, "Math.cos(-Math.PI)", -1, Math.cos(-Math.PI) );
+ array[item++] = new TestCase( SECTION, "Math.cos(-5*Math.PI/4)", -Math.SQRT2/2, Math.cos(-5*Math.PI/4) );
+ array[item++] = new TestCase( SECTION, "Math.cos(-3*Math.PI/2)", 0, Math.cos(-3*Math.PI/2) );
+ array[item++] = new TestCase( SECTION, "Math.cos(-7*Math.PI/4)", Math.SQRT2/2, Math.cos(-7*Math.PI/4) );
+ array[item++] = new TestCase( SECTION, "Math.cos(-Math.PI*2)", 1, Math.cos(-Math.PI*2) );
+
+ return ( array );
+}
+
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.8.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.8.js
new file mode 100644
index 0000000..c0a4924
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.8.js
@@ -0,0 +1,84 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.8.2.8.js
+ ECMA Section: 15.8.2.8 Math.exp(x)
+ Description: return an approximation to the exponential function of
+ the argument (e raised to the power of the argument)
+ special cases:
+ - if x is NaN return NaN
+ - if x is 0 return 1
+ - if x is -0 return 1
+ - if x is Infinity return Infinity
+ - if x is -Infinity return 0
+ Author: christine@netscape.com
+ Date: 7 july 1997
+*/
+
+
+ var SECTION = "15.8.2.8";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Math.exp(x)";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "Math.exp.length", 1, Math.exp.length );
+
+ array[item++] = new TestCase( SECTION, "Math.exp()", Number.NaN, Math.exp() );
+ array[item++] = new TestCase( SECTION, "Math.exp(null)", 1, Math.exp(null) );
+ array[item++] = new TestCase( SECTION, "Math.exp(void 0)", Number.NaN, Math.exp(void 0) );
+ array[item++] = new TestCase( SECTION, "Math.exp(1)", Math.E, Math.exp(1) );
+ array[item++] = new TestCase( SECTION, "Math.exp(true)", Math.E, Math.exp(true) );
+ array[item++] = new TestCase( SECTION, "Math.exp(false)", 1, Math.exp(false) );
+
+ array[item++] = new TestCase( SECTION, "Math.exp('1')", Math.E, Math.exp('1') );
+ array[item++] = new TestCase( SECTION, "Math.exp('0')", 1, Math.exp('0') );
+
+ array[item++] = new TestCase( SECTION, "Math.exp(NaN)", Number.NaN, Math.exp(Number.NaN) );
+ array[item++] = new TestCase( SECTION, "Math.exp(0)", 1, Math.exp(0) );
+ array[item++] = new TestCase( SECTION, "Math.exp(-0)", 1, Math.exp(-0) );
+ array[item++] = new TestCase( SECTION, "Math.exp(Infinity)", Number.POSITIVE_INFINITY, Math.exp(Number.POSITIVE_INFINITY) );
+ array[item++] = new TestCase( SECTION, "Math.exp(-Infinity)", 0, Math.exp(Number.NEGATIVE_INFINITY) );
+
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.9.js b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.9.js
new file mode 100644
index 0000000..c1ea987
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.9.js
@@ -0,0 +1,105 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.8.2.9.js
+ ECMA Section: 15.8.2.9 Math.floor(x)
+ Description: return the greatest number value that is not greater
+ than the argument and is equal to a mathematical integer.
+ if the number is already an integer, return the number
+ itself. special cases:
+ - if x is NaN return NaN
+ - if x = +0 return +0
+ - if x = -0 return -0
+ - if x = Infinity return Infinity
+ - if x = -Infinity return -Infinity
+ - if ( -1 < x < 0 ) return -0
+ also:
+ - the value of Math.floor(x) == -Math.ceil(-x)
+ Author: christine@netscape.com
+ Date: 7 july 1997
+*/
+
+ var SECTION = "15.8.2.9";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Math.floor(x)";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "Math.floor.length", 1, Math.floor.length );
+
+ array[item++] = new TestCase( SECTION, "Math.floor()", Number.NaN, Math.floor() );
+ array[item++] = new TestCase( SECTION, "Math.floor(void 0)", Number.NaN, Math.floor(void 0) );
+ array[item++] = new TestCase( SECTION, "Math.floor(null)", 0, Math.floor(null) );
+ array[item++] = new TestCase( SECTION, "Math.floor(true)", 1, Math.floor(true) );
+ array[item++] = new TestCase( SECTION, "Math.floor(false)", 0, Math.floor(false) );
+
+ array[item++] = new TestCase( SECTION, "Math.floor('1.1')", 1, Math.floor("1.1") );
+ array[item++] = new TestCase( SECTION, "Math.floor('-1.1')", -2, Math.floor("-1.1") );
+ array[item++] = new TestCase( SECTION, "Math.floor('0.1')", 0, Math.floor("0.1") );
+ array[item++] = new TestCase( SECTION, "Math.floor('-0.1')", -1, Math.floor("-0.1") );
+
+ array[item++] = new TestCase( SECTION, "Math.floor(NaN)", Number.NaN, Math.floor(Number.NaN) );
+ array[item++] = new TestCase( SECTION, "Math.floor(NaN)==-Math.ceil(-NaN)", false, Math.floor(Number.NaN) == -Math.ceil(-Number.NaN) );
+
+ array[item++] = new TestCase( SECTION, "Math.floor(0)", 0, Math.floor(0) );
+ array[item++] = new TestCase( SECTION, "Math.floor(0)==-Math.ceil(-0)", true, Math.floor(0) == -Math.ceil(-0) );
+
+ array[item++] = new TestCase( SECTION, "Math.floor(-0)", -0, Math.floor(-0) );
+ array[item++] = new TestCase( SECTION, "Infinity/Math.floor(-0)", -Infinity, Infinity/Math.floor(-0) );
+ array[item++] = new TestCase( SECTION, "Math.floor(-0)==-Math.ceil(0)", true, Math.floor(-0)== -Math.ceil(0) );
+
+ array[item++] = new TestCase( SECTION, "Math.floor(Infinity)", Number.POSITIVE_INFINITY, Math.floor(Number.POSITIVE_INFINITY) );
+ array[item++] = new TestCase( SECTION, "Math.floor(Infinity)==-Math.ceil(-Infinity)", true, Math.floor(Number.POSITIVE_INFINITY) == -Math.ceil(Number.NEGATIVE_INFINITY) );
+
+ array[item++] = new TestCase( SECTION, "Math.floor(-Infinity)", Number.NEGATIVE_INFINITY, Math.floor(Number.NEGATIVE_INFINITY) );
+ array[item++] = new TestCase( SECTION, "Math.floor(-Infinity)==-Math.ceil(Infinity)", true, Math.floor(Number.NEGATIVE_INFINITY) == -Math.ceil(Number.POSITIVE_INFINITY) );
+
+ array[item++] = new TestCase( SECTION, "Math.floor(0.0000001)", 0, Math.floor(0.0000001) );
+ array[item++] = new TestCase( SECTION, "Math.floor(0.0000001)==-Math.ceil(0.0000001)", true, Math.floor(0.0000001)==-Math.ceil(-0.0000001) );
+
+ array[item++] = new TestCase( SECTION, "Math.floor(-0.0000001)", -1, Math.floor(-0.0000001) );
+ array[item++] = new TestCase( SECTION, "Math.floor(0.0000001)==-Math.ceil(0.0000001)", true, Math.floor(-0.0000001)==-Math.ceil(0.0000001) );
+
+ return ( array );
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/NativeObjects/15-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/NativeObjects/15-1.js
new file mode 100644
index 0000000..cecdd90
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/NativeObjects/15-1.js
@@ -0,0 +1,95 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.js
+ ECMA Section: 15 Native ECMAScript Objects
+ Description: Every built-in prototype object has the Object prototype
+ object, which is the value of the expression
+ Object.prototype (15.2.3.1) as the value of its internal
+ [[Prototype]] property, except the Object prototype
+ object itself.
+
+ Every native object associated with a program-created
+ function also has the Object prototype object as the
+ value of its internal [[Prototype]] property.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+ var SECTION = "15-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Native ECMAScript Objects";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+/*
+ array[item++] = new TestCase( SECTION, "Function.prototype.__proto__", Object.prototype, Function.prototype.__proto__ );
+ array[item++] = new TestCase( SECTION, "Array.prototype.__proto__", Object.prototype, Array.prototype.__proto__ );
+ array[item++] = new TestCase( SECTION, "String.prototype.__proto__", Object.prototype, String.prototype.__proto__ );
+ array[item++] = new TestCase( SECTION, "Boolean.prototype.__proto__", Object.prototype, Boolean.prototype.__proto__ );
+ array[item++] = new TestCase( SECTION, "Number.prototype.__proto__", Object.prototype, Number.prototype.__proto__ );
+// array[item++] = new TestCase( SECTION, "Math.prototype.__proto__", Object.prototype, Math.prototype.__proto__ );
+ array[item++] = new TestCase( SECTION, "Date.prototype.__proto__", Object.prototype, Date.prototype.__proto__ );
+ array[item++] = new TestCase( SECTION, "TestCase.prototype.__proto__", Object.prototype, TestCase.prototype.__proto__ );
+
+ array[item++] = new TestCase( SECTION, "MyObject.prototype.__proto__", Object.prototype, MyObject.prototype.__proto__ );
+*/
+ array[item++] = new TestCase( SECTION, "Function.prototype.__proto__ == Object.prototype", true, Function.prototype.__proto__ == Object.prototype );
+ array[item++] = new TestCase( SECTION, "Array.prototype.__proto__ == Object.prototype", true, Array.prototype.__proto__ == Object.prototype );
+ array[item++] = new TestCase( SECTION, "String.prototype.__proto__ == Object.prototype", true, String.prototype.__proto__ == Object.prototype );
+ array[item++] = new TestCase( SECTION, "Boolean.prototype.__proto__ == Object.prototype", true, Boolean.prototype.__proto__ == Object.prototype );
+ array[item++] = new TestCase( SECTION, "Number.prototype.__proto__ == Object.prototype", true, Number.prototype.__proto__ == Object.prototype );
+// array[item++] = new TestCase( SECTION, "Math.prototype.__proto__ == Object.prototype", true, Math.prototype.__proto__ == Object.prototype );
+ array[item++] = new TestCase( SECTION, "Date.prototype.__proto__ == Object.prototype", true, Date.prototype.__proto__ == Object.prototype );
+ array[item++] = new TestCase( SECTION, "TestCase.prototype.__proto__ == Object.prototype", true, TestCase.prototype.__proto__ == Object.prototype );
+
+ array[item++] = new TestCase( SECTION, "MyObject.prototype.__proto__ == Object.prototype", true, MyObject.prototype.__proto__ == Object.prototype );
+
+
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+
+ stopTest();
+ return ( testcases );
+}
+
+function MyObject( value ) {
+ this.value = value;
+ this.valueOf = new Function( "return this.value" );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/NativeObjects/15-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/NativeObjects/15-2.js
new file mode 100644
index 0000000..612e1b4
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/NativeObjects/15-2.js
@@ -0,0 +1,78 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15-2.js
+ ECMA Section: 15 Native ECMAScript Objects
+
+ Description: Every built-in function and every built-in constructor
+ has the Function prototype object, which is the value of
+ the expression Function.prototype as the value of its
+ internal [[Prototype]] property, except the Function
+ prototype object itself.
+
+ That is, the __proto__ property of builtin functions and
+ constructors should be the Function.prototype object.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+ var SECTION = "15-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Native ECMAScript Objects";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "Object.__proto__", Function.prototype, Object.__proto__ );
+ array[item++] = new TestCase( SECTION, "Array.__proto__", Function.prototype, Array.__proto__ );
+ array[item++] = new TestCase( SECTION, "String.__proto__", Function.prototype, String.__proto__ );
+ array[item++] = new TestCase( SECTION, "Boolean.__proto__", Function.prototype, Boolean.__proto__ );
+ array[item++] = new TestCase( SECTION, "Number.__proto__", Function.prototype, Number.__proto__ );
+ array[item++] = new TestCase( SECTION, "Date.__proto__", Function.prototype, Date.__proto__ );
+ array[item++] = new TestCase( SECTION, "TestCase.__proto__", Function.prototype, TestCase.__proto__ );
+
+ array[item++] = new TestCase( SECTION, "eval.__proto__", Function.prototype, eval.__proto__ );
+ array[item++] = new TestCase( SECTION, "Math.pow.__proto__", Function.prototype, Math.pow.__proto__ );
+ array[item++] = new TestCase( SECTION, "String.prototype.indexOf.__proto__", Function.prototype, String.prototype.indexOf.__proto__ );
+
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.1.js
new file mode 100644
index 0000000..102912d
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.1.js
@@ -0,0 +1,90 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.7.1.js
+ ECMA Section: 15.7.1 The Number Constructor Called as a Function
+ 15.7.1.1
+ 15.7.1.2
+
+ Description: When Number is called as a function rather than as a
+ constructor, it performs a type conversion.
+ 15.7.1.1 Return a number value (not a Number object)
+ computed by ToNumber( value )
+ 15.7.1.2 Number() returns 0.
+
+ need to add more test cases. see the testcases for
+ TypeConversion ToNumber.
+
+ Author: christine@netscape.com
+ Date: 29 september 1997
+*/
+
+ var SECTION = "15.7.1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "The Number Constructor Called as a Function";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase(SECTION, "Number()", 0, Number() );
+ array[item++] = new TestCase(SECTION, "Number(void 0)", Number.NaN, Number(void 0) );
+ array[item++] = new TestCase(SECTION, "Number(null)", 0, Number(null) );
+ array[item++] = new TestCase(SECTION, "Number()", 0, Number() );
+ array[item++] = new TestCase(SECTION, "Number(new Number())", 0, Number( new Number() ) );
+ array[item++] = new TestCase(SECTION, "Number(0)", 0, Number(0) );
+ array[item++] = new TestCase(SECTION, "Number(1)", 1, Number(1) );
+ array[item++] = new TestCase(SECTION, "Number(-1)", -1, Number(-1) );
+ array[item++] = new TestCase(SECTION, "Number(NaN)", Number.NaN, Number( Number.NaN ) );
+ array[item++] = new TestCase(SECTION, "Number('string')", Number.NaN, Number( "string") );
+ array[item++] = new TestCase(SECTION, "Number(new String())", 0, Number( new String() ) );
+ array[item++] = new TestCase(SECTION, "Number('')", 0, Number( "" ) );
+ array[item++] = new TestCase(SECTION, "Number(Infinity)", Number.POSITIVE_INFINITY, Number("Infinity") );
+
+ array[item++] = new TestCase(SECTION, "Number(new MyObject(100))", 100, Number(new MyObject(100)) );
+
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function MyObject( value ) {
+ this.value = value;
+ this.valueOf = new Function( "return this.value" );
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.2.js
new file mode 100644
index 0000000..6e3982b
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.2.js
@@ -0,0 +1,173 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.7.2.js
+ ECMA Section: 15.7.2 The Number Constructor
+ 15.7.2.1
+ 15.7.2.2
+
+ Description: 15.7.2 When Number is called as part of a new
+ expression, it is a constructor: it initializes
+ the newly created object.
+
+ 15.7.2.1 The [[Prototype]] property of the newly
+ constructed object is set to othe original Number
+ prototype object, the one that is the initial value
+ of Number.prototype(0). The [[Class]] property is
+ set to "Number". The [[Value]] property of the
+ newly constructed object is set to ToNumber(value)
+
+ 15.7.2.2 new Number(). same as in 15.7.2.1, except
+ the [[Value]] property is set to +0.
+
+ need to add more test cases. see the testcases for
+ TypeConversion ToNumber.
+
+ Author: christine@netscape.com
+ Date: 29 september 1997
+*/
+
+ var SECTION = "15.7.2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "The Number Constructor";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ // To verify that the object's prototype is the Number.prototype, check to see if the object's
+ // constructor property is the same as Number.prototype.constructor.
+
+ array[item++] = new TestCase(SECTION, "(new Number()).constructor", Number.prototype.constructor, (new Number()).constructor );
+
+ array[item++] = new TestCase(SECTION, "typeof (new Number())", "object", typeof (new Number()) );
+ array[item++] = new TestCase(SECTION, "(new Number()).valueOf()", 0, (new Number()).valueOf() );
+ array[item++] = new TestCase(SECTION,
+ "NUMB = new Number();NUMB.toString=Object.prototype.toString;NUMB.toString()",
+ "[object Number]",
+ eval("NUMB = new Number();NUMB.toString=Object.prototype.toString;NUMB.toString()") );
+
+ array[item++] = new TestCase(SECTION, "(new Number(0)).constructor", Number.prototype.constructor, (new Number(0)).constructor );
+ array[item++] = new TestCase(SECTION, "typeof (new Number(0))", "object", typeof (new Number(0)) );
+ array[item++] = new TestCase(SECTION, "(new Number(0)).valueOf()", 0, (new Number(0)).valueOf() );
+ array[item++] = new TestCase(SECTION,
+ "NUMB = new Number(0);NUMB.toString=Object.prototype.toString;NUMB.toString()",
+ "[object Number]",
+ eval("NUMB = new Number(0);NUMB.toString=Object.prototype.toString;NUMB.toString()") );
+
+ array[item++] = new TestCase(SECTION, "(new Number(1)).constructor", Number.prototype.constructor, (new Number(1)).constructor );
+ array[item++] = new TestCase(SECTION, "typeof (new Number(1))", "object", typeof (new Number(1)) );
+ array[item++] = new TestCase(SECTION, "(new Number(1)).valueOf()", 1, (new Number(1)).valueOf() );
+ array[item++] = new TestCase(SECTION,
+ "NUMB = new Number(1);NUMB.toString=Object.prototype.toString;NUMB.toString()",
+ "[object Number]",
+ eval("NUMB = new Number(1);NUMB.toString=Object.prototype.toString;NUMB.toString()") );
+
+ array[item++] = new TestCase(SECTION, "(new Number(-1)).constructor", Number.prototype.constructor, (new Number(-1)).constructor );
+ array[item++] = new TestCase(SECTION, "typeof (new Number(-1))", "object", typeof (new Number(-1)) );
+ array[item++] = new TestCase(SECTION, "(new Number(-1)).valueOf()", -1, (new Number(-1)).valueOf() );
+ array[item++] = new TestCase(SECTION,
+ "NUMB = new Number(-1);NUMB.toString=Object.prototype.toString;NUMB.toString()",
+ "[object Number]",
+ eval("NUMB = new Number(-1);NUMB.toString=Object.prototype.toString;NUMB.toString()") );
+
+ array[item++] = new TestCase(SECTION, "(new Number(Number.NaN)).constructor", Number.prototype.constructor, (new Number(Number.NaN)).constructor );
+ array[item++] = new TestCase(SECTION, "typeof (new Number(Number.NaN))", "object", typeof (new Number(Number.NaN)) );
+ array[item++] = new TestCase(SECTION, "(new Number(Number.NaN)).valueOf()", Number.NaN, (new Number(Number.NaN)).valueOf() );
+ array[item++] = new TestCase(SECTION,
+ "NUMB = new Number(Number.NaN);NUMB.toString=Object.prototype.toString;NUMB.toString()",
+ "[object Number]",
+ eval("NUMB = new Number(Number.NaN);NUMB.toString=Object.prototype.toString;NUMB.toString()") );
+
+ array[item++] = new TestCase(SECTION, "(new Number('string')).constructor", Number.prototype.constructor, (new Number('string')).constructor );
+ array[item++] = new TestCase(SECTION, "typeof (new Number('string'))", "object", typeof (new Number('string')) );
+ array[item++] = new TestCase(SECTION, "(new Number('string')).valueOf()", Number.NaN, (new Number('string')).valueOf() );
+ array[item++] = new TestCase(SECTION,
+ "NUMB = new Number('string');NUMB.toString=Object.prototype.toString;NUMB.toString()",
+ "[object Number]",
+ eval("NUMB = new Number('string');NUMB.toString=Object.prototype.toString;NUMB.toString()") );
+
+ array[item++] = new TestCase(SECTION, "(new Number(new String())).constructor", Number.prototype.constructor, (new Number(new String())).constructor );
+ array[item++] = new TestCase(SECTION, "typeof (new Number(new String()))", "object", typeof (new Number(new String())) );
+ array[item++] = new TestCase(SECTION, "(new Number(new String())).valueOf()", 0, (new Number(new String())).valueOf() );
+ array[item++] = new TestCase(SECTION,
+ "NUMB = new Number(new String());NUMB.toString=Object.prototype.toString;NUMB.toString()",
+ "[object Number]",
+ eval("NUMB = new Number(new String());NUMB.toString=Object.prototype.toString;NUMB.toString()") );
+
+ array[item++] = new TestCase(SECTION, "(new Number('')).constructor", Number.prototype.constructor, (new Number('')).constructor );
+ array[item++] = new TestCase(SECTION, "typeof (new Number(''))", "object", typeof (new Number('')) );
+ array[item++] = new TestCase(SECTION, "(new Number('')).valueOf()", 0, (new Number('')).valueOf() );
+ array[item++] = new TestCase(SECTION,
+ "NUMB = new Number('');NUMB.toString=Object.prototype.toString;NUMB.toString()",
+ "[object Number]",
+ eval("NUMB = new Number('');NUMB.toString=Object.prototype.toString;NUMB.toString()") );
+
+ array[item++] = new TestCase(SECTION, "(new Number(Number.POSITIVE_INFINITY)).constructor", Number.prototype.constructor, (new Number(Number.POSITIVE_INFINITY)).constructor );
+ array[item++] = new TestCase(SECTION, "typeof (new Number(Number.POSITIVE_INFINITY))", "object", typeof (new Number(Number.POSITIVE_INFINITY)) );
+ array[item++] = new TestCase(SECTION, "(new Number(Number.POSITIVE_INFINITY)).valueOf()", Number.POSITIVE_INFINITY, (new Number(Number.POSITIVE_INFINITY)).valueOf() );
+ array[item++] = new TestCase(SECTION,
+ "NUMB = new Number(Number.POSITIVE_INFINITY);NUMB.toString=Object.prototype.toString;NUMB.toString()",
+ "[object Number]",
+ eval("NUMB = new Number(Number.POSITIVE_INFINITY);NUMB.toString=Object.prototype.toString;NUMB.toString()") );
+
+ array[item++] = new TestCase(SECTION, "(new Number(Number.NEGATIVE_INFINITY)).constructor", Number.prototype.constructor, (new Number(Number.NEGATIVE_INFINITY)).constructor );
+ array[item++] = new TestCase(SECTION, "typeof (new Number(Number.NEGATIVE_INFINITY))", "object", typeof (new Number(Number.NEGATIVE_INFINITY)) );
+ array[item++] = new TestCase(SECTION, "(new Number(Number.NEGATIVE_INFINITY)).valueOf()", Number.NEGATIVE_INFINITY, (new Number(Number.NEGATIVE_INFINITY)).valueOf() );
+ array[item++] = new TestCase(SECTION,
+ "NUMB = new Number(Number.NEGATIVE_INFINITY);NUMB.toString=Object.prototype.toString;NUMB.toString()",
+ "[object Number]",
+ eval("NUMB = new Number(Number.NEGATIVE_INFINITY);NUMB.toString=Object.prototype.toString;NUMB.toString()") );
+
+
+ array[item++] = new TestCase(SECTION, "(new Number()).constructor", Number.prototype.constructor, (new Number()).constructor );
+ array[item++] = new TestCase(SECTION, "typeof (new Number())", "object", typeof (new Number()) );
+ array[item++] = new TestCase(SECTION, "(new Number()).valueOf()", 0, (new Number()).valueOf() );
+ array[item++] = new TestCase(SECTION,
+ "NUMB = new Number();NUMB.toString=Object.prototype.toString;NUMB.toString()",
+ "[object Number]",
+ eval("NUMB = new Number();NUMB.toString=Object.prototype.toString;NUMB.toString()") );
+
+ return ( array );
+}
+
+
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.1-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.1-1.js
new file mode 100644
index 0000000..71aea75
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.1-1.js
@@ -0,0 +1,68 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.7.3.1-2.js
+ ECMA Section: 15.7.3.1 Number.prototype
+ Description: All value properties of the Number object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the DontDelete attribute of Number.prototype
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+
+var SECTION = "15.7.3.1-1";
+var VERSION = "ECMA_1";
+ startTest();
+var TITLE = "Number.prototype";
+
+writeHeaderToLog( SECTION +" "+ TITLE);
+
+var testcases = getTestCases();
+test();
+
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase(SECTION, "var NUM_PROT = Number.prototype; delete( Number.prototype ); NUM_PROT == Number.prototype", true, "var NUM_PROT = Number.prototype; delete( Number.prototype ); NUM_PROT == Number.prototype" );
+ array[item++] = new TestCase(SECTION, "delete( Number.prototype )", false, "delete( Number.prototype )" );
+
+ return ( array );
+}
+
+function test() {
+ for ( tc = 0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "delete should not be allowed ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.1-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.1-2.js
new file mode 100644
index 0000000..dbce0e1
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.1-2.js
@@ -0,0 +1,75 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.7.3.1-2.js
+ ECMA Section: 15.7.3.1 Number.prototype
+ Description: All value properties of the Number object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the ReadOnly attribute of Number.prototype
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+
+ var SECTION = "15.7.3.1-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Number.prototype";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION,
+ "var NUM_PROT = Number.prototype; Number.prototype = null; Number.prototype == NUM_PROT",
+ true,
+ eval("var NUM_PROT = Number.prototype; Number.prototype = null; Number.prototype == NUM_PROT") );
+
+ array[item++] = new TestCase( SECTION,
+ "Number.prototype=0; Number.prototype",
+ Number.prototype,
+ eval("Number.prototype=0; Number.prototype") );
+
+ return ( array );
+}
+
+function test() {
+ for ( tc = 0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "delete should not be allowed ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.1-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.1-3.js
new file mode 100644
index 0000000..34bd2ff
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.1-3.js
@@ -0,0 +1,70 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.7.3.1-4.js
+ ECMA Section: 15.7.3.1 Number.prototype
+ Description: All value properties of the Number object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the DontEnum attribute of Number.prototype
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+ var VERSION = "ECMA_1";
+ startTest();
+ var SECTION = "15.7.3.1-3";
+ var TITLE = "Number.prototype";
+
+ writeHeaderToLog( SECTION + " Number.prototype: DontEnum Attribute");
+
+ var testcases = getTestCases();
+
+ test( testcases );
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase(
+ SECTION,
+ "var string = ''; for ( prop in Number ) { string += ( prop == 'prototype' ) ? prop: '' } string;",
+ "",
+ eval("var string = ''; for ( prop in Number ) { string += ( prop == 'prototype' ) ? prop : '' } string;")
+ );
+
+ return ( array );
+}
+
+function test() {
+ for ( tc = 0; tc < testcases.length; tc++ ) {
+ writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += "property should not be enumerated ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.2-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.2-1.js
new file mode 100644
index 0000000..51d679a
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.2-1.js
@@ -0,0 +1,63 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.7.3.2-1.js
+ ECMA Section: 15.7.3.2 Number.MAX_VALUE
+ Description: All value properties of the Number object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the value of MAX_VALUE
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+ var SECTION = "15.7.3.2-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Number.MAX_VALUE";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test( testcases );
+
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "Number.MAX_VALUE", 1.7976931348623157e308, Number.MAX_VALUE );
+
+
+ return ( array );
+}
+function test() {
+ for ( tc = 0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.2-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.2-2.js
new file mode 100644
index 0000000..b5f57c9
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.2-2.js
@@ -0,0 +1,64 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.7.3.2-2.js
+ ECMA Section: 15.7.3.2 Number.MAX_VALUE
+ Description: All value properties of the Number object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the DontDelete attribute of Number.MAX_VALUE
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+ var SECTION = "15.7.3.2-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Number.MAX_VALUE: DontDelete Attribute";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test( testcases );
+
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "delete( Number.MAX_VALUE ); Number.MAX_VALUE", 1.7976931348623157e308, "delete( Number.MAX_VALUE );Number.MAX_VALUE" );
+ array[item++] = new TestCase( SECTION, "delete( Number.MAX_VALUE )", false, "delete( Number.MAX_VALUE )" );
+
+ return ( array );
+}
+function test() {
+ for ( tc = 0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.2-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.2-3.js
new file mode 100644
index 0000000..c8040cd
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.2-3.js
@@ -0,0 +1,66 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.7.3.2-3.js
+ ECMA Section: 15.7.3.2 Number.MAX_VALUE
+ Description: All value properties of the Number object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the ReadOnly attribute of Number.MAX_VALUE
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+ var SECTION = "15.7.3.2-3";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Number.MAX_VALUE";
+
+ writeHeaderToLog( SECTION + " "+ TITLE );
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ var MAX_VAL = 1.7976931348623157e308;
+
+ array[item++] = new TestCase( SECTION,
+ "Number.MAX_VALUE=0; Number.MAX_VALUE",
+ MAX_VAL,
+ eval("Number.MAX_VALUE=0; Number.MAX_VALUE") );
+ return ( array );
+}
+function test() {
+ for ( tc = 0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "delete should not be allowed ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.2-4.js b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.2-4.js
new file mode 100644
index 0000000..846a3c1
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.2-4.js
@@ -0,0 +1,66 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.7.3.2-4.js
+ ECMA Section: 15.7.3.2 Number.MAX_VALUE
+ Description: All value properties of the Number object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the DontEnum attribute of Number.MAX_VALUE
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+ var SECTION = "15.7.3.2-4";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Number.MAX_VALUE: DontEnum Attribute";
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test( testcases );
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase(
+ SECTION,
+ "var string = ''; for ( prop in Number ) { string += ( prop == 'MAX_VALUE' ) ? prop : '' } string;",
+ "",
+ eval("var string = ''; for ( prop in Number ) { string += ( prop == 'MAX_VALUE' ) ? prop : '' } string;")
+ );
+
+ return ( array );
+}
+function test( testcases ) {
+ for ( tc = 0; tc < testcases.length; tc++ ) {
+ writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += "property should not be enumerated ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.3-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.3-1.js
new file mode 100644
index 0000000..f912583
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.3-1.js
@@ -0,0 +1,64 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.7.3.3-1.js
+ ECMA Section: 15.7.3.3 Number.MIN_VALUE
+ Description: All value properties of the Number object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the value of Number.MIN_VALUE
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+
+ var SECTION = "15.7.3.3-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Number.MIN_VALUE";
+
+ writeHeaderToLog( SECTION + " "+ TITLE );
+
+ var testcases = getTestCases();
+ test( testcases );
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ var MIN_VAL = 5e-324;
+
+ array[item++] = new TestCase( SECTION, "Number.MIN_VALUE", MIN_VAL, Number.MIN_VALUE );
+ return ( array );
+}
+function test() {
+ for ( tc = 0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "delete should not be allowed "
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.3-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.3-2.js
new file mode 100644
index 0000000..fdcfb0a
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.3-2.js
@@ -0,0 +1,66 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.7.3.3-2.js
+ ECMA Section: 15.7.3.3 Number.MIN_VALUE
+ Description: All value properties of the Number object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the DontDelete attribute of Number.MIN_VALUE
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+
+ var SECTION = "15.7.3.3-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Number.MIN_VALUE";
+
+ writeHeaderToLog( SECTION + " "+ TITLE );
+
+ var testcases = getTestCases();
+ test( testcases );
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ var MIN_VAL = 5e-324;
+
+ array[item++] = new TestCase( SECTION, "delete( Number.MIN_VALUE )", false, "delete( Number.MIN_VALUE )" );
+ array[item++] = new TestCase( SECTION, "delete( Number.MIN_VALUE ); Number.MIN_VALUE", MIN_VAL, "delete( Number.MIN_VALUE );Number.MIN_VALUE" );
+ return ( array );
+}
+function test() {
+ for ( tc = 0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "delete should not be allowed "
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.3-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.3-3.js
new file mode 100644
index 0000000..f1c4380
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.3-3.js
@@ -0,0 +1,67 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.7.3.3-3.js
+ ECMA Section: 15.7.3.3 Number.MIN_VALUE
+ Description: All value properties of the Number object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the ReadOnly attribute of Number.MIN_VALUE
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+ var SECTION = "15.7.3.3-3";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Number.MIN_VALUE: ReadOnly Attribute";
+
+ writeHeaderToLog( SECTION + " "+TITLE );
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase(
+ SECTION,
+ "Number.MIN_VALUE=0; Number.MIN_VALUE",
+ Number.MIN_VALUE,
+ "Number.MIN_VALUE=0; Number.MIN_VALUE" );
+ return ( array );
+}
+function test() {
+ for ( tc = 0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += "property should be readonly ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.3-4.js b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.3-4.js
new file mode 100644
index 0000000..7b3fa19
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.3-4.js
@@ -0,0 +1,69 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.7.3.3-4.js
+ ECMA Section: 15.7.3.3 Number.MIN_VALUE
+ Description: All value properties of the Number object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the DontEnum attribute of Number.MIN_VALUE
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+
+ var SECTION = "15.7.3.3-4";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Number.MIN_VALUE: DontEnum Attribute");
+
+ var testcases = getTestCases();
+ test( testcases );
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase(
+ SECTION,
+ "var string = ''; for ( prop in Number ) { string += ( prop == 'MIN_VALUE' ) ? prop : '' } string;",
+ "",
+ eval("var string = ''; for ( prop in Number ) { string += ( prop == 'MIN_VALUE' ) ? prop : '' } string;")
+ );
+
+ return ( array );
+}
+
+function test() {
+ for ( tc = 0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += "property should not be enumerated ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.4-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.4-1.js
new file mode 100644
index 0000000..2ff39f6
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.4-1.js
@@ -0,0 +1,63 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.7.3.4-1.js
+ ECMA Section: 15.7.3.4 Number.NaN
+ Description: All value properties of the Number object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the value of Number.NaN
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+
+ var SECTION = "15.7.3.4-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Number.NaN";
+
+ writeHeaderToLog( SECTION + " "+ TITLE );
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase(SECTION, "NaN", NaN, Number.NaN );
+ return ( array );
+}
+function test() {
+ for ( tc = 0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "delete should not be allowed "
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.4-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.4-2.js
new file mode 100644
index 0000000..96535f1
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.4-2.js
@@ -0,0 +1,67 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.7.3.4-2.js
+ ECMA Section: 15.7.3.4 Number.NaN
+ Description: All value properties of the Number object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the DontDelete attribute of Number.NaN
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+
+ var SECTION = "15.7.3.4-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Number.NaN";
+
+ writeHeaderToLog( SECTION + " "+ TITLE );
+
+ var testcases = getTestCases();
+ test();
+
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase(SECTION, "delete( Number.NaN ); Number.NaN", NaN, "delete( Number.NaN );Number.NaN" );
+ array[item++] = new TestCase( SECTION, "delete( Number.NaN )", false, "delete( Number.NaN )" );
+
+ return ( array );
+}
+function test() {
+ for ( tc = 0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "delete should not be allowed ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.4-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.4-3.js
new file mode 100644
index 0000000..3f13a2f
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.4-3.js
@@ -0,0 +1,71 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.7.3.4-3.js
+ ECMA Section: 15.7.3.4 Number.NaN
+ Description: All value properties of the Number object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the ReadOnly attribute of Number.NaN
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+ var SECTION = "15.7.3.4-3";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Number.NaN";
+
+ writeHeaderToLog( SECTION + " "+ TITLE );
+
+ var testcases = getTestCases();
+ test();
+
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase(
+ SECTION,
+ "Number.NaN=0; Number.NaN",
+ Number.NaN,
+ "Number.NaN=0; Number.NaN" );
+
+ return ( array );
+}
+
+function test() {
+ for ( tc = 0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[tc].reason += "property should be readonly ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.4-4.js b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.4-4.js
new file mode 100644
index 0000000..33b1667
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.4-4.js
@@ -0,0 +1,71 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.7.3.4-4.js
+ ECMA Section: 15.7.3.4 Number.NaN
+ Description: All value properties of the Number object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the DontEnum attribute of Number.NaN
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+ var SECTION = "15.7.3.4-4";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Number.NaN";
+
+ writeHeaderToLog( SECTION + " " + TITLE);
+
+ var testcases = getTestCases();
+ test( testcases );
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase(
+ SECTION,
+ "var string = ''; for ( prop in Number ) { string += ( prop == 'NaN' ) ? prop : '' } string;",
+ "",
+ eval("var string = ''; for ( prop in Number ) { string += ( prop == 'NaN' ) ? prop : '' } string;")
+ );
+
+ return ( array );
+}
+
+function test( testcases ) {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += "property should not be enumerated ";
+ passed = false;
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.5-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.5-1.js
new file mode 100644
index 0000000..1ca04eb
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.5-1.js
@@ -0,0 +1,61 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.7.3.5-1.js
+ ECMA Section: 15.7.3.5 Number.NEGATIVE_INFINITY
+ Description: All value properties of the Number object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the value of Number.NEGATIVE_INFINITY
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+ var SECTION = "15.7.3.5-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Number.NEGATIVE_INFINITY";
+
+ writeHeaderToLog( SECTION + " "+TITLE);
+
+ var testcases = getTestCases();
+ test( testcases );
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase(SECTION, "Number.NEGATIVE_INFINITY", -Infinity, Number.NEGATIVE_INFINITY );
+
+ return ( array );
+}
+function test() {
+ for ( tc = 0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.5-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.5-2.js
new file mode 100644
index 0000000..2291552
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.5-2.js
@@ -0,0 +1,72 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.7.3.5-2.js
+ ECMA Section: 15.7.3.5 Number.NEGATIVE_INFINITY
+ Description: All value properties of the Number object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the DontDelete attribute of Number.NEGATIVE_INFINITY
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+ var SECTION = "15.7.3.5-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Number.NEGATIVE_INFINITY";
+
+ writeHeaderToLog( SECTION + " "+TITLE);
+
+ var testcases = getTestCases();
+ test( testcases );
+
+
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION,
+ "delete( Number.NEGATIVE_INFINITY )",
+ false,
+ "delete( Number.NEGATIVE_INFINITY )" );
+
+ array[item++] = new TestCase( SECTION,
+ "delete( Number.NEGATIVE_INFINITY ); Number.NEGATIVE_INFINITY",
+ -Infinity,
+ "delete( Number.NEGATIVE_INFINITY );Number.NEGATIVE_INFINITY" );
+ return ( array );
+}
+function test( testcases ) {
+ for ( tc = 0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "delete should not be allowed "
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.5-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.5-3.js
new file mode 100644
index 0000000..c14fcf8
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.5-3.js
@@ -0,0 +1,67 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.7.3.5-3.js
+ ECMA Section: 15.7.3.5 Number.NEGATIVE_INFINITY
+ Description: All value properties of the Number object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the ReadOnly attribute of Number.NEGATIVE_INFINITY
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+ var SECTION = "15.7.3.5-3";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Number.NEGATIVE_INFINITY";
+
+ writeHeaderToLog( SECTION + " "+TITLE);
+
+ var testcases = getTestCases();
+ test( testcases );
+
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase(
+ SECTION,
+ "Number.NEGATIVE_INFINITY=0; Number.NEGATIVE_INFINITY",
+ -Infinity,
+ "Number.NEGATIVE_INFINITY=0; Number.NEGATIVE_INFINITY" );
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[tc].reason += "property should be readonly ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.5-4.js b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.5-4.js
new file mode 100644
index 0000000..fd3fd4e
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.5-4.js
@@ -0,0 +1,68 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.7.3.5-4.js
+ ECMA Section: 15.7.3.5 Number.NEGATIVE_INFINITY
+ Description: All value properties of the Number object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the DontEnum attribute of Number.NEGATIVE_INFINITY
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+ var SECTION = "15.7.3.5-4";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Number.NEGATIVE_INFINITY";
+
+ writeHeaderToLog( SECTION + " "+TITLE);
+
+ var testcases = getTestCases();
+ test( testcases );
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase(
+ SECTION,
+ "var string = ''; for ( prop in Number ) { string += ( prop == 'NEGATIVE_INFINITY' ) ? prop : '' } string;",
+ "",
+ eval("var string = ''; for ( prop in Number ) { string += ( prop == 'NEGATIVE_INFINITY' ) ? prop : '' } string;")
+ );
+ return ( array );
+}
+
+function test( testcases ) {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[tc].reason += "property should not be enumerated ";
+
+ }
+ stopTest();
+ return ( testcases );
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.6-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.6-1.js
new file mode 100644
index 0000000..a14b35e
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.6-1.js
@@ -0,0 +1,60 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.7.3.6-1.js
+ ECMA Section: 15.7.3.6 Number.POSITIVE_INFINITY
+ Description: All value properties of the Number object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the value of Number.POSITIVE_INFINITY
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+ var SECTION = "15.7.3.6-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Number.POSITIVE_INFINITY";
+
+ writeHeaderToLog( SECTION + " "+TITLE);
+
+ var testcases = getTestCases();
+ test( testcases );
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY", Infinity, Number.POSITIVE_INFINITY );
+ return ( array );
+}
+function test() {
+ for ( tc = 0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.6-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.6-2.js
new file mode 100644
index 0000000..573648b
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.6-2.js
@@ -0,0 +1,64 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.7.3.6-2.js
+ ECMA Section: 15.7.3.6 Number.POSITIVE_INFINITY
+ Description: All value properties of the Number object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the DontDelete attribute of Number.POSITIVE_INFINITY
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+ var SECTION = "15.7.3.6-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Number.POSITIVE_INFINITY";
+
+ writeHeaderToLog( SECTION + " "+TITLE);
+
+ var testcases = getTestCases();
+ test( testcases );
+
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase(SECTION, "delete( Number.POSITIVE_INFINITY )", false, "delete( Number.POSITIVE_INFINITY )" );
+ array[item++] = new TestCase(SECTION, "delete( Number.POSITIVE_INFINITY ); Number.POSITIVE_INFINITY", Infinity, "delete( Number.POSITIVE_INFINITY );Number.POSITIVE_INFINITY" );
+ return ( array );
+}
+
+function test( testcases ) {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "delete should not be allowed "
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.6-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.6-3.js
new file mode 100644
index 0000000..c4c5973
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.6-3.js
@@ -0,0 +1,68 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.7.3.6-3.js
+ ECMA Section: 15.7.3.6 Number.POSITIVE_INFINITY
+ Description: All value properties of the Number object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the ReadOnly attribute of Number.POSITIVE_INFINITY
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+ var SECTION = "15.7.3.6-3";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Number.POSITIVE_INFINITY";
+
+ writeHeaderToLog( SECTION + " "+TITLE);
+
+ var testcases = getTestCases();
+ test( testcases );
+
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase(
+ SECTION,
+ "Number.POSITIVE_INFINITY=0; Number.POSITIVE_INFINITY",
+ Number.POSITIVE_INFINITY,
+ "Number.POSITIVE_INFINITY=0; Number.POSITIVE_INFINITY" );
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[tc].reason += "property should be readonly ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.6-4.js b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.6-4.js
new file mode 100644
index 0000000..25b2b4f
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.6-4.js
@@ -0,0 +1,66 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.7.3.6-4.js
+ ECMA Section: 15.7.3.6 Number.POSITIVE_INFINITY
+ Description: All value properties of the Number object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the DontEnum attribute of Number.POSITIVE_INFINITY
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+ var SECTION = "15.7.3.6-4";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Number.POSITIVE_INFINITY";
+
+ writeHeaderToLog( SECTION + " "+TITLE);
+
+ var testcases = getTestCases();
+ test( testcases );
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase(
+ SECTION,
+ "var string = ''; for ( prop in Number ) { string += ( prop == 'POSITIVE_INFINITY' ) ? prop : '' } string;",
+ "",
+ eval("var string = ''; for ( prop in Number ) { string += ( prop == 'POSITIVE_INFINITY' ) ? prop : '' } string;")
+ );
+
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+ testcases[tc].reason += "property should not be enumerated ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.js
new file mode 100644
index 0000000..c832cfc
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.3.js
@@ -0,0 +1,68 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.7.3.js
+ 15.7.3 Properties of the Number Constructor
+
+ Description: The value of the internal [[Prototype]] property
+ of the Number constructor is the Function prototype
+ object. The Number constructor also has the internal
+ [[Call]] and [[Construct]] properties, and the length
+ property.
+
+ Other properties are in subsequent tests.
+
+ Author: christine@netscape.com
+ Date: 29 september 1997
+*/
+
+ var SECTION = "15.7.3";
+ var VERSION = "ECMA_2";
+ startTest();
+ var TITLE = "Properties of the Number Constructor";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase(SECTION, "Number.__proto__", Function.prototype, Number.__proto__ );
+ array[item++] = new TestCase(SECTION, "Number.length", 1, Number.length );
+
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.4-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.4-1.js
new file mode 100644
index 0000000..8d7c79d
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.4-1.js
@@ -0,0 +1,63 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.7.4-1.js
+ ECMA Section: 15.7.4.1 Properties of the Number Prototype Object
+ Description:
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+
+ var SECTION = "15.7.4-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ writeHeaderToLog( SECTION + "Properties of the Number prototype object");
+
+ var testcases = getTestCases();
+
+ test();
+
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase(SECTION, "Number.prototype.valueOf()", 0, Number.prototype.valueOf() );
+ array[item++] = new TestCase(SECTION, "typeof(Number.prototype)", "object", typeof(Number.prototype) );
+ array[item++] = new TestCase(SECTION, "Number.prototype.constructor == Number", true, Number.prototype.constructor == Number );
+// array[item++] = new TestCase(SECTION, "Number.prototype == Number.__proto__", true, Number.prototype == Number.__proto__ );
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.4.1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.4.1.js
new file mode 100644
index 0000000..789e71c
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.4.1.js
@@ -0,0 +1,64 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.7.4.1.js
+ ECMA Section: 15.7.4.1.1 Number.prototype.constructor
+
+ Number.prototype.constructor is the built-in Number constructor.
+
+ Description:
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+ var SECTION = "15.7.4.1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Number.prototype.constructor";
+
+ writeHeaderToLog( SECTION + " "+TITLE);
+
+ var testcases = getTestCases();
+ test( testcases );
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION,
+ "Number.prototype.constructor",
+ Number,
+ Number.prototype.constructor );
+ return ( array );
+}
+
+function test() {
+ for ( tc = 0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.4.2-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.4.2-1.js
new file mode 100644
index 0000000..f41b698
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.4.2-1.js
@@ -0,0 +1,80 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.7.4.2.js
+ ECMA Section: 15.7.4.2.1 Number.prototype.toString()
+ Description:
+ If the radix is the number 10 or not supplied, then this number value is
+ given as an argument to the ToString operator; the resulting string value
+ is returned.
+
+ If the radix is supplied and is an integer from 2 to 36, but not 10, the
+ result is a string, the choice of which is implementation dependent.
+
+ The toString function is not generic; it generates a runtime error if its
+ this value is not a Number object. Therefore it cannot be transferred to
+ other kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+ var SECTION = "15.7.4.2-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var testcases = getTestCases();
+
+ writeHeaderToLog( SECTION + " Number.prototype.toString()");
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+// the following two lines cause navigator to crash -- cmb 9/16/97
+ array[item++] = new TestCase(SECTION, "Number.prototype.toString()", "0", "Number.prototype.toString()" );
+ array[item++] = new TestCase(SECTION, "typeof(Number.prototype.toString())", "string", "typeof(Number.prototype.toString())" );
+
+ array[item++] = new TestCase(SECTION, "s = Number.prototype.toString; o = new Number(); o.toString = s; o.toString()", "0", "s = Number.prototype.toString; o = new Number(); o.toString = s; o.toString()" );
+ array[item++] = new TestCase(SECTION, "s = Number.prototype.toString; o = new Number(1); o.toString = s; o.toString()", "1", "s = Number.prototype.toString; o = new Number(1); o.toString = s; o.toString()" );
+ array[item++] = new TestCase(SECTION, "s = Number.prototype.toString; o = new Number(-1); o.toString = s; o.toString()", "-1", "s = Number.prototype.toString; o = new Number(-1); o.toString = s; o.toString()" );
+
+ array[item++] = new TestCase(SECTION, "var MYNUM = new Number(255); MYNUM.toString(10)", "255", "var MYNUM = new Number(255); MYNUM.toString(10)" );
+ array[item++] = new TestCase(SECTION, "var MYNUM = new Number(Number.NaN); MYNUM.toString(10)", "NaN", "var MYNUM = new Number(Number.NaN); MYNUM.toString(10)" );
+ array[item++] = new TestCase(SECTION, "var MYNUM = new Number(Infinity); MYNUM.toString(10)", "Infinity", "var MYNUM = new Number(Infinity); MYNUM.toString(10)" );
+ array[item++] = new TestCase(SECTION, "var MYNUM = new Number(-Infinity); MYNUM.toString(10)", "-Infinity", "var MYNUM = new Number(-Infinity); MYNUM.toString(10)" );
+
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual= eval(testcases[tc].actual );
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.4.2-2-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.4.2-2-n.js
new file mode 100644
index 0000000..2aa035a
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.4.2-2-n.js
@@ -0,0 +1,70 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.7.4.2-2-n.js
+ ECMA Section: 15.7.4.2.1 Number.prototype.toString()
+ Description:
+ If the radix is the number 10 or not supplied, then this number value is
+ given as an argument to the ToString operator; the resulting string value
+ is returned.
+
+ If the radix is supplied and is an integer from 2 to 36, but not 10, the
+ result is a string, the choice of which is implementation dependent.
+
+ The toString function is not generic; it generates a runtime error if its
+ this value is not a Number object. Therefore it cannot be transferred to
+ other kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+ var SECTION = "15.7.4.2-2-n";
+ var VERSION = "ECMA_1";
+ startTest();
+ var testcases = getTestCases();
+
+ writeHeaderToLog( SECTION + " Number.prototype.toString()");
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase(SECTION, "o = new Object(); o.toString = Number.prototype.toString; o.toString()", "error", "o = new Object(); o.toString = Number.prototype.toString; o.toString()" );
+// array[item++] = new TestCase(SECTION, "o = new String(); o.toString = Number.prototype.toString; o.toString()", "error", "o = new String(); o.toString = Number.prototype.toString; o.toString()" );
+// array[item++] = new TestCase(SECTION, "o = 3; o.toString = Number.prototype.toString; o.toString()", "error", "o = 3; o.toString = Number.prototype.toString; o.toString()" );
+
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.4.2-3-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.4.2-3-n.js
new file mode 100644
index 0000000..8e73acb
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.4.2-3-n.js
@@ -0,0 +1,68 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.7.4.2-3-n.js
+ ECMA Section: 15.7.4.2.1 Number.prototype.toString()
+ Description:
+ If the radix is the number 10 or not supplied, then this number value is
+ given as an argument to the ToString operator; the resulting string value
+ is returned.
+
+ If the radix is supplied and is an integer from 2 to 36, but not 10, the
+ result is a string, the choice of which is implementation dependent.
+
+ The toString function is not generic; it generates a runtime error if its
+ this value is not a Number object. Therefore it cannot be transferred to
+ other kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+ var SECTION = "15.7.4.2-3-n";
+ var VERSION = "ECMA_1";
+ startTest();
+ var testcases = getTestCases();
+
+ writeHeaderToLog( SECTION + " Number.prototype.toString()");
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase(SECTION, "o = new String(); o.toString = Number.prototype.toString; o.toString()", "error", "o = new String(); o.toString = Number.prototype.toString; o.toString()" );
+
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.4.2-4.js b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.4.2-4.js
new file mode 100644
index 0000000..4896ba9
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.4.2-4.js
@@ -0,0 +1,68 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.7.4.2-4.js
+ ECMA Section: 15.7.4.2.1 Number.prototype.toString()
+ Description:
+ If the radix is the number 10 or not supplied, then this number value is
+ given as an argument to the ToString operator; the resulting string value
+ is returned.
+
+ If the radix is supplied and is an integer from 2 to 36, but not 10, the
+ result is a string, the choice of which is implementation dependent.
+
+ The toString function is not generic; it generates a runtime error if its
+ this value is not a Number object. Therefore it cannot be transferred to
+ other kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+ var SECTION = "15.7.4.2-4";
+ var VERSION = "ECMA_1";
+ startTest();
+ var testcases = getTestCases();
+
+ writeHeaderToLog( SECTION + " Number.prototype.toString()");
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase(SECTION, "o = 3; o.toString = Number.prototype.toString; o.toString()", "3", "o = 3; o.toString = Number.prototype.toString; o.toString()" );
+
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.4.3-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.4.3-1.js
new file mode 100644
index 0000000..341b347
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.4.3-1.js
@@ -0,0 +1,72 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.7.4.3-1.js
+ ECMA Section: 15.7.4.3.1 Number.prototype.valueOf()
+ Description:
+ Returns this number value.
+
+ The valueOf function is not generic; it generates a runtime error if its
+ this value is not a Number object. Therefore it cannot be transferred to
+ other kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+ var SECTION = "15.7.4.3-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var testcases = getTestCases();
+
+ writeHeaderToLog( SECTION + " Number.prototype.valueOf()");
+ test();
+
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+// the following two line causes navigator to crash -- cmb 9/16/97
+ array[item++] = new TestCase("15.7.4.1", "Number.prototype.valueOf()", 0, "Number.prototype.valueOf()" );
+
+ array[item++] = new TestCase("15.7.4.1", "(new Number(1)).valueOf()", 1, "(new Number(1)).valueOf()" );
+ array[item++] = new TestCase("15.7.4.1", "(new Number(-1)).valueOf()", -1, "(new Number(-1)).valueOf()" );
+ array[item++] = new TestCase("15.7.4.1", "(new Number(0)).valueOf()", 0, "(new Number(0)).valueOf()" );
+ array[item++] = new TestCase("15.7.4.1", "(new Number(Number.POSITIVE_INFINITY)).valueOf()", Number.POSITIVE_INFINITY, "(new Number(Number.POSITIVE_INFINITY)).valueOf()" );
+ array[item++] = new TestCase("15.7.4.1", "(new Number(Number.NaN)).valueOf()", Number.NaN, "(new Number(Number.NaN)).valueOf()" );
+ array[item++] = new TestCase("15.7.4.1", "(new Number()).valueOf()", 0, "(new Number()).valueOf()" );
+
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.4.3-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.4.3-2.js
new file mode 100644
index 0000000..6b81da6
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.4.3-2.js
@@ -0,0 +1,63 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.7.4.3-2.js
+ ECMA Section: 15.7.4.3.1 Number.prototype.valueOf()
+ Description:
+ Returns this number value.
+
+ The valueOf function is not generic; it generates a runtime error if its
+ this value is not a Number object. Therefore it cannot be transferred to
+ other kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+ var SECTION = "15.7.4.3-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var testcases = getTestCases();
+
+ writeHeaderToLog( SECTION + " Number.prototype.valueOf()");
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase(SECTION, "v = Number.prototype.valueOf; num = 3; num.valueOf = v; num.valueOf()", 3, "v = Number.prototype.valueOf; num = 3; num.valueOf = v; num.valueOf()" );
+
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.4.3-3-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.4.3-3-n.js
new file mode 100644
index 0000000..8905f25
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.4.3-3-n.js
@@ -0,0 +1,66 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.7.4.3-3.js
+ ECMA Section: 15.7.4.3.1 Number.prototype.valueOf()
+ Description:
+ Returns this number value.
+
+ The valueOf function is not generic; it generates a runtime error if its
+ this value is not a Number object. Therefore it cannot be transferred to
+ other kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+ var SECTION = "15.7.4.3-3-n";
+ var VERSION = "ECMA_1";
+ startTest();
+ var testcases = getTestCases();
+
+ writeHeaderToLog( SECTION + " Number.prototype.valueOf()");
+ test();
+
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+// array[item++] = new TestCase("15.7.4.1", "v = Number.prototype.valueOf; num = 3; num.valueOf = v; num.valueOf()", "error", "v = Number.prototype.valueOf; num = 3; num.valueOf = v; num.valueOf()" );
+ array[item++] = new TestCase("15.7.4.1", "v = Number.prototype.valueOf; o = new String('Infinity'); o.valueOf = v; o.valueOf()", "error", "v = Number.prototype.valueOf; o = new String('Infinity'); o.valueOf = v; o.valueOf()" );
+// array[item++] = new TestCase("15.7.4.1", "v = Number.prototype.valueOf; o = new Object(); o.valueOf = v; o.valueOf()", "error", "v = Number.prototype.valueOf; o = new Object(); o.valueOf = v; o.valueOf()" );
+
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.4.js b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.4.js
new file mode 100644
index 0000000..fd62ad5
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Number/15.7.4.js
@@ -0,0 +1,86 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.7.4.js
+ ECMA Section: 15.7.4
+
+ Description:
+
+ The Number prototype object is itself a Number object (its [[Class]] is
+ "Number") whose value is +0.
+
+ The value of the internal [[Prototype]] property of the Number prototype
+ object is the Object prototype object (15.2.3.1).
+
+ In following descriptions of functions that are properties of the Number
+ prototype object, the phrase "this Number object" refers to the object
+ that is the this value for the invocation of the function; it is an error
+ if this does not refer to an object for which the value of the internal
+ [[Class]] property is "Number". Also, the phrase "this number value" refers
+ to the number value represented by this Number object, that is, the value
+ of the internal [[Value]] property of this Number object.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "15.7.4";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Properties of the Number Prototype Object";
+
+ writeHeaderToLog( SECTION + " "+TITLE);
+
+ var testcases = getTestCases();
+ test( testcases );
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION,
+ "Number.prototype.toString=Object.prototype.toString;Number.prototype.toString()",
+ "[object Number]",
+ eval("Number.prototype.toString=Object.prototype.toString;Number.prototype.toString()") );
+ array[item++] = new TestCase( SECTION, "typeof Number.prototype", "object", typeof Number.prototype );
+ array[item++] = new TestCase( SECTION, "Number.prototype.valueOf()", 0, Number.prototype.valueOf() );
+
+
+// The __proto__ property cannot be used in ECMA_1 tests.
+// array[item++] = new TestCase( SECTION, "Number.prototype.__proto__", Object.prototype, Number.prototype.__proto__ );
+// array[item++] = new TestCase( SECTION, "Number.prototype.__proto__ == Object.prototype", true, Number.prototype.__proto__ == Object.prototype );
+
+
+ return ( array );
+}
+function test( ) {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+
+ }
+
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.1.1.js b/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.1.1.js
new file mode 100644
index 0000000..cbc1783
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.1.1.js
@@ -0,0 +1,151 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.2.1.1.js
+ ECMA Section: 15.2.1.1 The Object Constructor Called as a Function:
+ Object(value)
+ Description: When Object is called as a function rather than as a
+ constructor, the following steps are taken:
+
+ 1. If value is null or undefined, create and return a
+ new object with no properties other than internal
+ properties exactly as if the object constructor
+ had been called on that same value (15.2.2.1).
+ 2. Return ToObject (value), whose rules are:
+
+ undefined generate a runtime error
+ null generate a runtime error
+ boolean create a new Boolean object whose default
+ value is the value of the boolean.
+ number Create a new Number object whose default
+ value is the value of the number.
+ string Create a new String object whose default
+ value is the value of the string.
+ object Return the input argument (no conversion).
+
+ Author: christine@netscape.com
+ Date: 17 july 1997
+*/
+
+ var SECTION = "15.2.1.1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Object( value )";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ var NULL_OBJECT = Object(null);
+
+ array[item++] = new TestCase( SECTION, "Object(null).valueOf()", NULL_OBJECT, (NULL_OBJECT).valueOf() );
+ array[item++] = new TestCase( SECTION, "typeof Object(null)", "object", typeof (Object(null)) );
+ array[item++] = new TestCase( SECTION, "Object(null).__proto__", Object.prototype, (Object(null)).__proto__ );
+
+ var UNDEFINED_OBJECT = Object( void 0 );
+
+ array[item++] = new TestCase( SECTION, "Object(void 0).valueOf()", UNDEFINED_OBJECT, (UNDEFINED_OBJECT).valueOf() );
+ array[item++] = new TestCase( SECTION, "typeof Object(void 0)", "object", typeof (Object(void 0)) );
+ array[item++] = new TestCase( SECTION, "Object(void 0).__proto__", Object.prototype, (Object(void 0)).__proto__ );
+
+ array[item++] = new TestCase( SECTION, "Object(true).valueOf()", true, (Object(true)).valueOf() );
+ array[item++] = new TestCase( SECTION, "typeof Object(true)", "object", typeof Object(true) );
+ array[item++] = new TestCase( SECTION, "var MYOB = Object(true); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Boolean]", eval("var MYOB = Object(true); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+
+ array[item++] = new TestCase( SECTION, "Object(false).valueOf()", false, (Object(false)).valueOf() );
+ array[item++] = new TestCase( SECTION, "typeof Object(false)", "object", typeof Object(false) );
+ array[item++] = new TestCase( SECTION, "var MYOB = Object(false); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Boolean]", eval("var MYOB = Object(false); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+
+ array[item++] = new TestCase( SECTION, "Object(0).valueOf()", 0, (Object(0)).valueOf() );
+ array[item++] = new TestCase( SECTION, "typeof Object(0)", "object", typeof Object(0) );
+ array[item++] = new TestCase( SECTION, "var MYOB = Object(0); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("var MYOB = Object(0); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+
+ array[item++] = new TestCase( SECTION, "Object(-0).valueOf()", -0, (Object(-0)).valueOf() );
+ array[item++] = new TestCase( SECTION, "typeof Object(-0)", "object", typeof Object(-0) );
+ array[item++] = new TestCase( SECTION, "var MYOB = Object(-0); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("var MYOB = Object(-0); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+
+ array[item++] = new TestCase( SECTION, "Object(1).valueOf()", 1, (Object(1)).valueOf() );
+ array[item++] = new TestCase( SECTION, "typeof Object(1)", "object", typeof Object(1) );
+ array[item++] = new TestCase( SECTION, "var MYOB = Object(1); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("var MYOB = Object(1); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+
+ array[item++] = new TestCase( SECTION, "Object(-1).valueOf()", -1, (Object(-1)).valueOf() );
+ array[item++] = new TestCase( SECTION, "typeof Object(-1)", "object", typeof Object(-1) );
+ array[item++] = new TestCase( SECTION, "var MYOB = Object(-1); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("var MYOB = Object(-1); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+
+ array[item++] = new TestCase( SECTION, "Object(Number.MAX_VALUE).valueOf()", 1.7976931348623157e308, (Object(Number.MAX_VALUE)).valueOf() );
+ array[item++] = new TestCase( SECTION, "typeof Object(Number.MAX_VALUE)", "object", typeof Object(Number.MAX_VALUE) );
+ array[item++] = new TestCase( SECTION, "var MYOB = Object(Number.MAX_VALUE); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("var MYOB = Object(Number.MAX_VALUE); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+
+ array[item++] = new TestCase( SECTION, "Object(Number.MIN_VALUE).valueOf()", 5e-324, (Object(Number.MIN_VALUE)).valueOf() );
+ array[item++] = new TestCase( SECTION, "typeof Object(Number.MIN_VALUE)", "object", typeof Object(Number.MIN_VALUE) );
+ array[item++] = new TestCase( SECTION, "var MYOB = Object(Number.MIN_VALUE); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("var MYOB = Object(Number.MIN_VALUE); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+
+ array[item++] = new TestCase( SECTION, "Object(Number.POSITIVE_INFINITY).valueOf()", Number.POSITIVE_INFINITY, (Object(Number.POSITIVE_INFINITY)).valueOf() );
+ array[item++] = new TestCase( SECTION, "typeof Object(Number.POSITIVE_INFINITY)", "object", typeof Object(Number.POSITIVE_INFINITY) );
+ array[item++] = new TestCase( SECTION, "var MYOB = Object(Number.POSITIVE_INFINITY); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("var MYOB = Object(Number.POSITIVE_INFINITY); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+
+ array[item++] = new TestCase( SECTION, "Object(Number.NEGATIVE_INFINITY).valueOf()", Number.NEGATIVE_INFINITY, (Object(Number.NEGATIVE_INFINITY)).valueOf() );
+ array[item++] = new TestCase( SECTION, "typeof Object(Number.NEGATIVE_INFINITY)", "object", typeof Object(Number.NEGATIVE_INFINITY) );
+ array[item++] = new TestCase( SECTION, "var MYOB = Object(Number.NEGATIVE_INFINITY); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("var MYOB = Object(Number.NEGATIVE_INFINITY); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+
+ array[item++] = new TestCase( SECTION, "Object(Number.NaN).valueOf()", Number.NaN, (Object(Number.NaN)).valueOf() );
+ array[item++] = new TestCase( SECTION, "typeof Object(Number.NaN)", "object", typeof Object(Number.NaN) );
+ array[item++] = new TestCase( SECTION, "var MYOB = Object(Number.NaN); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("var MYOB = Object(Number.NaN); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+
+ array[item++] = new TestCase( SECTION, "Object('a string').valueOf()", "a string", (Object("a string")).valueOf() );
+ array[item++] = new TestCase( SECTION, "typeof Object('a string')", "object", typeof (Object("a string")) );
+ array[item++] = new TestCase( SECTION, "var MYOB = Object('a string'); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object String]", eval("var MYOB = Object('a string'); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+
+ array[item++] = new TestCase( SECTION, "Object('').valueOf()", "", (Object("")).valueOf() );
+ array[item++] = new TestCase( SECTION, "typeof Object('')", "object", typeof (Object("")) );
+ array[item++] = new TestCase( SECTION, "var MYOB = Object(''); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object String]", eval("var MYOB = Object(''); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+
+ array[item++] = new TestCase( SECTION, "Object('\\r\\t\\b\\n\\v\\f').valueOf()", "\r\t\b\n\v\f", (Object("\r\t\b\n\v\f")).valueOf() );
+ array[item++] = new TestCase( SECTION, "typeof Object('\\r\\t\\b\\n\\v\\f')", "object", typeof (Object("\\r\\t\\b\\n\\v\\f")) );
+ array[item++] = new TestCase( SECTION, "var MYOB = Object('\\r\\t\\b\\n\\v\\f'); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object String]", eval("var MYOB = Object('\\r\\t\\b\\n\\v\\f'); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+
+ array[item++] = new TestCase( SECTION, "Object( '\\\'\\\"\\' ).valueOf()", "\'\"\\", (Object("\'\"\\")).valueOf() );
+ array[item++] = new TestCase( SECTION, "typeof Object( '\\\'\\\"\\' )", "object", typeof Object("\'\"\\") );
+// array[item++] = new TestCase( SECTION, "var MYOB = Object( '\\\'\\\"\\' ); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object String]", eval("var MYOB = Object( '\\\'\\\"\\' ); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+
+ return ( array );
+}
+
+function test() {
+ for ( tc = 0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason +=
+ ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.1.2.js b/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.1.2.js
new file mode 100644
index 0000000..6a619b6
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.1.2.js
@@ -0,0 +1,85 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.2.1.2.js
+ ECMA Section: 15.2.1.2 The Object Constructor Called as a Function:
+ Object(value)
+ Description: When Object is called as a function rather than as a
+ constructor, the following steps are taken:
+
+ 1. If value is null or undefined, create and return a
+ new object with no proerties other than internal
+ properties exactly as if the object constructor
+ had been called on that same value (15.2.2.1).
+ 2. Return ToObject (value), whose rules are:
+
+ undefined generate a runtime error
+ null generate a runtime error
+ boolean create a new Boolean object whose default
+ value is the value of the boolean.
+ number Create a new Number object whose default
+ value is the value of the number.
+ string Create a new String object whose default
+ value is the value of the string.
+ object Return the input argument (no conversion).
+
+ Author: christine@netscape.com
+ Date: 17 july 1997
+*/
+
+ var SECTION = "15.2.1.2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Object()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ var MYOB = Object();
+
+ array[item++] = new TestCase( SECTION, "var MYOB = Object(); MYOB.valueOf()", MYOB, MYOB.valueOf() );
+ array[item++] = new TestCase( SECTION, "typeof Object()", "object", typeof (Object(null)) );
+ array[item++] = new TestCase( SECTION, "var MYOB = Object(); MYOB.toString()", "[object Object]", eval("var MYOB = Object(); MYOB.toString()") );
+
+ return ( array );
+}
+
+function test() {
+ for ( tc = 0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason +=
+ ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.2.1.js b/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.2.1.js
new file mode 100644
index 0000000..cf04ce4
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.2.1.js
@@ -0,0 +1,139 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.2.2.1.js
+ ECMA Section: 15.2.2.1 The Object Constructor: new Object( value )
+
+ 1.If the type of the value is not Object, go to step 4.
+ 2.If the value is a native ECMAScript object, do not create a new object; simply return value.
+ 3.If the value is a host object, then actions are taken and a result is returned in an
+ implementation-dependent manner that may depend on the host object.
+ 4.If the type of the value is String, return ToObject(value).
+ 5.If the type of the value is Boolean, return ToObject(value).
+ 6.If the type of the value is Number, return ToObject(value).
+ 7.(The type of the value must be Null or Undefined.) Create a new native ECMAScript object.
+ The [[Prototype]] property of the newly constructed object is set to the Object prototype object.
+ The [[Class]] property of the newly constructed object is set to "Object".
+ The newly constructed object has no [[Value]] property.
+ Return the newly created native object.
+
+ Description: This does not test cases where the object is a host object.
+ Author: christine@netscape.com
+ Date: 7 october 1997
+*/
+
+ var SECTION = "15.2.2.1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "new Object( value )";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "typeof new Object(null)", "object", typeof new Object(null) );
+ array[item++] = new TestCase( SECTION, "MYOB = new Object(null); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Object]", eval("MYOB = new Object(null); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+
+ array[item++] = new TestCase( SECTION, "typeof new Object(void 0)", "object", typeof new Object(void 0) );
+ array[item++] = new TestCase( SECTION, "MYOB = new Object(new Object(void 0)); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Object]", eval("MYOB = new Object(new Object(void 0)); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+
+ array[item++] = new TestCase( SECTION, "typeof new Object('string')", "object", typeof new Object('string') );
+ array[item++] = new TestCase( SECTION, "MYOB = (new Object('string'); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object String]", eval("MYOB = new Object('string'); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+ array[item++] = new TestCase( SECTION, "(new Object('string').valueOf()", "string", (new Object('string')).valueOf() );
+
+ array[item++] = new TestCase( SECTION, "typeof new Object('')", "object", typeof new Object('') );
+ array[item++] = new TestCase( SECTION, "MYOB = (new Object(''); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object String]", eval("MYOB = new Object(''); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+ array[item++] = new TestCase( SECTION, "(new Object('').valueOf()", "", (new Object('')).valueOf() );
+
+ array[item++] = new TestCase( SECTION, "typeof new Object(Number.NaN)", "object", typeof new Object(Number.NaN) );
+ array[item++] = new TestCase( SECTION, "MYOB = (new Object(Number.NaN); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("MYOB = new Object(Number.NaN); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+ array[item++] = new TestCase( SECTION, "(new Object(Number.NaN).valueOf()", Number.NaN, (new Object(Number.NaN)).valueOf() );
+
+ array[item++] = new TestCase( SECTION, "typeof new Object(0)", "object", typeof new Object(0) );
+ array[item++] = new TestCase( SECTION, "MYOB = (new Object(0); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("MYOB = new Object(0); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+ array[item++] = new TestCase( SECTION, "(new Object(0).valueOf()", 0, (new Object(0)).valueOf() );
+
+ array[item++] = new TestCase( SECTION, "typeof new Object(-0)", "object", typeof new Object(-0) );
+ array[item++] = new TestCase( SECTION, "MYOB = (new Object(-0); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("MYOB = new Object(-0); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+ array[item++] = new TestCase( SECTION, "(new Object(-0).valueOf()", -0, (new Object(-0)).valueOf() );
+
+ array[item++] = new TestCase( SECTION, "typeof new Object(1)", "object", typeof new Object(1) );
+ array[item++] = new TestCase( SECTION, "MYOB = (new Object(1); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("MYOB = new Object(1); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+ array[item++] = new TestCase( SECTION, "(new Object(1).valueOf()", 1, (new Object(1)).valueOf() );
+
+ array[item++] = new TestCase( SECTION, "typeof new Object(-1)", "object", typeof new Object(-1) );
+ array[item++] = new TestCase( SECTION, "MYOB = (new Object(-1); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("MYOB = new Object(-1); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+ array[item++] = new TestCase( SECTION, "(new Object(-1).valueOf()", -1, (new Object(-1)).valueOf() );
+
+ array[item++] = new TestCase( SECTION, "typeof new Object(true)", "object", typeof new Object(true) );
+ array[item++] = new TestCase( SECTION, "MYOB = (new Object(true); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Boolean]", eval("MYOB = new Object(true); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+ array[item++] = new TestCase( SECTION, "(new Object(true).valueOf()", true, (new Object(true)).valueOf() );
+
+ array[item++] = new TestCase( SECTION, "typeof new Object(false)", "object", typeof new Object(false) );
+ array[item++] = new TestCase( SECTION, "MYOB = (new Object(false); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Boolean]", eval("MYOB = new Object(false); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+ array[item++] = new TestCase( SECTION, "(new Object(false).valueOf()", false, (new Object(false)).valueOf() );
+
+ array[item++] = new TestCase( SECTION, "typeof new Object(Boolean())", "object", typeof new Object(Boolean()) );
+ array[item++] = new TestCase( SECTION, "MYOB = (new Object(Boolean()); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Boolean]", eval("MYOB = new Object(Boolean()); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+ array[item++] = new TestCase( SECTION, "(new Object(Boolean()).valueOf()", Boolean(), (new Object(Boolean())).valueOf() );
+
+
+ var myglobal = this;
+ var myobject = new Object( "my new object" );
+ var myarray = new Array();
+ var myboolean = new Boolean();
+ var mynumber = new Number();
+ var mystring = new String();
+ var myobject = new Object();
+ var myfunction = new Function( "x", "return x");
+ var mymath = Math;
+
+ array[item++] = new TestCase( SECTION, "myglobal = new Object( this )", myglobal, new Object(this) );
+ array[item++] = new TestCase( SECTION, "myobject = new Object('my new object'); new Object(myobject)", myobject, new Object(myobject) );
+ array[item++] = new TestCase( SECTION, "myarray = new Array(); new Object(myarray)", myarray, new Object(myarray) );
+ array[item++] = new TestCase( SECTION, "myboolean = new Boolean(); new Object(myboolean)", myboolean, new Object(myboolean) );
+ array[item++] = new TestCase( SECTION, "mynumber = new Number(); new Object(mynumber)", mynumber, new Object(mynumber) );
+ array[item++] = new TestCase( SECTION, "mystring = new String9); new Object(mystring)", mystring, new Object(mystring) );
+ array[item++] = new TestCase( SECTION, "myobject = new Object(); new Object(mynobject)", myobject, new Object(myobject) );
+ array[item++] = new TestCase( SECTION, "myfunction = new Function(); new Object(myfunction)", myfunction, new Object(myfunction) );
+ array[item++] = new TestCase( SECTION, "mymath = Math; new Object(mymath)", mymath, new Object(mymath) );
+
+ return ( array );
+}
+function test() {
+ for (tc = 0 ; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+
+ }
+
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.2.2.js b/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.2.2.js
new file mode 100644
index 0000000..eddedfa
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.2.2.js
@@ -0,0 +1,81 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.2.2.2.js
+ ECMA Section: 15.2.2.2 new Object()
+ Description:
+
+ When the Object constructor is called with no argument, the following
+ step is taken:
+
+ 1. Create a new native ECMAScript object.
+ The [[Prototype]] property of the newly constructed object is set to
+ the Object prototype object.
+
+ The [[Class]] property of the newly constructed object is set
+ to "Object".
+
+ The newly constructed object has no [[Value]] property.
+
+ Return the newly created native object.
+
+ Author: christine@netscape.com
+ Date: 7 october 1997
+*/
+ var SECTION = "15.2.2.2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "new Object()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "typeof new Object()", "object", typeof new Object() );
+ array[item++] = new TestCase( SECTION, "Object.prototype.toString()", "[object Object]", Object.prototype.toString() );
+ array[item++] = new TestCase( SECTION, "(new Object()).toString()", "[object Object]", (new Object()).toString() );
+
+ return ( array );
+}
+function test() {
+ for ( tc = 0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
+function MyObject( value ) {
+ this.value = value;
+ this.valueOf = new Function( "return this.value" );
+ this.toString = new Function( "return this.value+''" );
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.3-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.3-1.js
new file mode 100644
index 0000000..06f50ce
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.3-1.js
@@ -0,0 +1,65 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.2.3-1.js
+ ECMA Section: 15.2.3 Properties of the Object Constructor
+
+ Description: The value of the internal [[Prototype]] property of the
+ Object constructor is the Function prototype object.
+
+ Besides the call and construct propreties and the length
+ property, the Object constructor has properties described
+ in 15.2.3.1.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+ var SECTION = "15.2.3";
+ var VERSION = "ECMA_2";
+ startTest();
+ var testcases = getTestCases();
+
+ writeHeaderToLog( SECTION + " Properties of the Object Constructor");
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "Object.__proto__", Function.prototype, Object.__proto__ );
+ array[item++] = new TestCase( SECTION, "Object.length", 1, Object.length );
+
+ return ( array );
+}
+function test( array ) {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.3.1-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.3.1-1.js
new file mode 100644
index 0000000..ee0539a
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.3.1-1.js
@@ -0,0 +1,68 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.2.3.1-1.js
+ ECMA Section: 15.2.3.1 Object.prototype
+
+ Description: The initial value of Object.prototype is the built-in
+ Object prototype object.
+
+ This property shall have the attributes [ DontEnum,
+ DontDelete ReadOnly ]
+
+ This tests the [DontEnum] property of Object.prototype
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+ var SECTION = "15.2.3.1-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Object.prototype";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION, "var str = '';for ( p in Object ) { str += p; }; str",
+ "",
+ eval( "var str = ''; for ( p in Object ) { str += p; }; str" )
+ );
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.3.1-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.3.1-2.js
new file mode 100644
index 0000000..fc2c735
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.3.1-2.js
@@ -0,0 +1,70 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.2.3.1-2.js
+ ECMA Section: 15.2.3.1 Object.prototype
+
+ Description: The initial value of Object.prototype is the built-in
+ Object prototype object.
+
+ This property shall have the attributes [ DontEnum,
+ DontDelete ReadOnly ]
+
+ This tests the [DontDelete] property of Object.prototype
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+
+ var SECTION = "15.2.3.1-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Object.prototype";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION, "delete( Object.prototype )",
+ false,
+ "delete( Object.prototype )"
+ );
+ return ( array );
+}
+function test( array ) {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.3.1-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.3.1-3.js
new file mode 100644
index 0000000..eb3a79d
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.3.1-3.js
@@ -0,0 +1,69 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.2.3.1-3.js
+ ECMA Section: 15.2.3.1 Object.prototype
+
+ Description: The initial value of Object.prototype is the built-in
+ Object prototype object.
+
+ This property shall have the attributes [ DontEnum,
+ DontDelete ReadOnly ]
+
+ This tests the [ReadOnly] property of Object.prototype
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+
+ var SECTION = "15.2.3.1-3";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Object.prototype";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION, "Object.prototype = null; Object.prototype",
+ Object.prototype,
+ "Object.prototype = null; Object.prototype"
+ );
+ return ( array );
+}
+function test( array ) {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.3.1-4.js b/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.3.1-4.js
new file mode 100644
index 0000000..8a39d7e
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.3.1-4.js
@@ -0,0 +1,70 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.2.3.1-4.js
+ ECMA Section: 15.2.3.1 Object.prototype
+
+ Description: The initial value of Object.prototype is the built-in
+ Object prototype object.
+
+ This property shall have the attributes [ DontEnum,
+ DontDelete ReadOnly ]
+
+ This tests the [DontDelete] property of Object.prototype
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+
+ var SECTION = "15.2.3.1-4";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Object.prototype";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION, "delete( Object.prototype ); Object.prototype",
+ Object.prototype,
+ "delete(Object.prototype); Object.prototype"
+ );
+ return ( array );
+}
+function test( array ) {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval(testcases[tc].actual);
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.3.js b/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.3.js
new file mode 100644
index 0000000..152add9
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.3.js
@@ -0,0 +1,68 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.2.3.js
+ ECMA Section: 15.2.3 Properties of the Object Constructor
+
+ Description: The value of the internal [[Prototype]] property of the
+ Object constructor is the Function prototype object.
+
+ Besides the call and construct propreties and the length
+ property, the Object constructor has properties described
+ in 15.2.3.1.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+
+ var SECTION = "15.2.3";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Properties of the Object Constructor";
+
+ writeHeaderToLog( SECTION + " " + TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+// array[item++] = new TestCase( SECTION, "Object.__proto__", Function.prototype, Object.__proto__ );
+ array[item++] = new TestCase( SECTION, "Object.length", 1, Object.length );
+
+ return ( array );
+}
+function test( array ) {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval( testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.4.1.js b/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.4.1.js
new file mode 100644
index 0000000..61f2898
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.4.1.js
@@ -0,0 +1,63 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.2.4.1.js
+ ECMA Section: 15.2.4 Object.prototype.constructor
+
+ Description: The initial value of the Object.prototype.constructor
+ is the built-in Object constructor.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+ var SECTION = "15.2.4.1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Object.prototype.constructor";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION, "Object.prototype.constructor",
+ Object,
+ Object.prototype.constructor
+ );
+ return ( array );
+}
+function test( array ) {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.4.2.js b/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.4.2.js
new file mode 100644
index 0000000..40eca1b
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.4.2.js
@@ -0,0 +1,128 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.2.4.2.js
+ ECMA Section: 15.2.4.2 Object.prototype.toString()
+
+ Description: When the toString method is called, the following
+ steps are taken:
+ 1. Get the [[Class]] property of this object
+ 2. Call ToString( Result(1) )
+ 3. Compute a string value by concatenating the three
+ strings "[object " + Result(2) + "]"
+ 4. Return Result(3).
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+ var SECTION = "15.2.4.2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Object.prototype.toString()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "(new Object()).toString()", "[object Object]", (new Object()).toString() );
+
+ array[item++] = new TestCase( SECTION, "myvar = this; myvar.toString = Object.prototype.toString; myvar.toString()",
+ GLOBAL,
+ eval("myvar = this; myvar.toString = Object.prototype.toString; myvar.toString()") );
+
+ array[item++] = new TestCase( SECTION, "myvar = MyObject; myvar.toString = Object.prototype.toString; myvar.toString()",
+ "[object Function]",
+ eval("myvar = MyObject; myvar.toString = Object.prototype.toString; myvar.toString()") );
+
+ array[item++] = new TestCase( SECTION, "myvar = new MyObject( true ); myvar.toString = Object.prototype.toString; myvar.toString()",
+ '[object Object]',
+ eval("myvar = new MyObject( true ); myvar.toString = Object.prototype.toString; myvar.toString()") );
+
+ array[item++] = new TestCase( SECTION, "myvar = new Number(0); myvar.toString = Object.prototype.toString; myvar.toString()",
+ "[object Number]",
+ eval("myvar = new Number(0); myvar.toString = Object.prototype.toString; myvar.toString()") );
+
+ array[item++] = new TestCase( SECTION, "myvar = new String(''); myvar.toString = Object.prototype.toString; myvar.toString()",
+ "[object String]",
+ eval("myvar = new String(''); myvar.toString = Object.prototype.toString; myvar.toString()") );
+
+ array[item++] = new TestCase( SECTION, "myvar = Math; myvar.toString = Object.prototype.toString; myvar.toString()",
+ "[object Math]",
+ eval("myvar = Math; myvar.toString = Object.prototype.toString; myvar.toString()") );
+
+ array[item++] = new TestCase( SECTION, "myvar = new Function(); myvar.toString = Object.prototype.toString; myvar.toString()",
+ "[object Function]",
+ eval("myvar = new Function(); myvar.toString = Object.prototype.toString; myvar.toString()") );
+
+ array[item++] = new TestCase( SECTION, "myvar = new Array(); myvar.toString = Object.prototype.toString; myvar.toString()",
+ "[object Array]",
+ eval("myvar = new Array(); myvar.toString = Object.prototype.toString; myvar.toString()") );
+
+ array[item++] = new TestCase( SECTION, "myvar = new Boolean(); myvar.toString = Object.prototype.toString; myvar.toString()",
+ "[object Boolean]",
+ eval("myvar = new Boolean(); myvar.toString = Object.prototype.toString; myvar.toString()") );
+
+ array[item++] = new TestCase( SECTION, "myvar = new Date(); myvar.toString = Object.prototype.toString; myvar.toString()",
+ "[object Date]",
+ eval("myvar = new Date(); myvar.toString = Object.prototype.toString; myvar.toString()") );
+
+ array[item++] = new TestCase( SECTION, "var MYVAR = new Object( this ); MYVAR.toString()",
+ GLOBAL,
+ eval("var MYVAR = new Object( this ); MYVAR.toString()") );
+
+ array[item++] = new TestCase( SECTION, "var MYVAR = new Object(); MYVAR.toString()",
+ "[object Object]",
+ eval("var MYVAR = new Object(); MYVAR.toString()") );
+
+ array[item++] = new TestCase( SECTION, "var MYVAR = new Object(void 0); MYVAR.toString()",
+ "[object Object]",
+ eval("var MYVAR = new Object(void 0); MYVAR.toString()") );
+
+ array[item++] = new TestCase( SECTION, "var MYVAR = new Object(null); MYVAR.toString()",
+ "[object Object]",
+ eval("var MYVAR = new Object(null); MYVAR.toString()") );
+
+ return ( array );
+}
+function test( array ) {
+ for ( tc=0 ; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
+function MyObject( value ) {
+ this.value = new Function( "return this.value" );
+ this.toString = new Function ( "return this.value+''");
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.4.3.js b/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.4.3.js
new file mode 100644
index 0000000..1daf04a
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.4.3.js
@@ -0,0 +1,115 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.2.4.3.js
+ ECMA Section: 15.2.4.3 Object.prototype.valueOf()
+
+ Description: As a rule, the valueOf method for an object simply
+ returns the object; but if the object is a "wrapper"
+ for a host object, as may perhaps be created by the
+ Object constructor, then the contained host object
+ should be returned.
+
+ This only covers native objects.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+ var SECTION = "15.2.4.3";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Object.prototype.valueOf()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ var myarray = new Array();
+ myarray.valueOf = Object.prototype.valueOf;
+ var myboolean = new Boolean();
+ myboolean.valueOf = Object.prototype.valueOf;
+ var myfunction = new Function();
+ myfunction.valueOf = Object.prototype.valueOf;
+ var myobject = new Object();
+ myobject.valueOf = Object.prototype.valueOf;
+ var mymath = Math;
+ mymath.valueOf = Object.prototype.valueOf;
+ var mydate = new Date();
+ mydate.valueOf = Object.prototype.valueOf;
+ var mynumber = new Number();
+ mynumber.valueOf = Object.prototype.valueOf;
+ var mystring = new String();
+ mystring.valueOf = Object.prototype.valueOf;
+
+ array[item++] = new TestCase( SECTION, "Object.prototype.valueOf.length", 0, Object.prototype.valueOf.length );
+
+ array[item++] = new TestCase( SECTION,
+ "myarray = new Array(); myarray.valueOf = Object.prototype.valueOf; myarray.valueOf()",
+ myarray,
+ myarray.valueOf() );
+ array[item++] = new TestCase( SECTION,
+ "myboolean = new Boolean(); myboolean.valueOf = Object.prototype.valueOf; myboolean.valueOf()",
+ myboolean,
+ myboolean.valueOf() );
+ array[item++] = new TestCase( SECTION,
+ "myfunction = new Function(); myfunction.valueOf = Object.prototype.valueOf; myfunction.valueOf()",
+ myfunction,
+ myfunction.valueOf() );
+ array[item++] = new TestCase( SECTION,
+ "myobject = new Object(); myobject.valueOf = Object.prototype.valueOf; myobject.valueOf()",
+ myobject,
+ myobject.valueOf() );
+ array[item++] = new TestCase( SECTION,
+ "mymath = Math; mymath.valueOf = Object.prototype.valueOf; mymath.valueOf()",
+ mymath,
+ mymath.valueOf() );
+ array[item++] = new TestCase( SECTION,
+ "mynumber = new Number(); mynumber.valueOf = Object.prototype.valueOf; mynumber.valueOf()",
+ mynumber,
+ mynumber.valueOf() );
+ array[item++] = new TestCase( SECTION,
+ "mystring = new String(); mystring.valueOf = Object.prototype.valueOf; mystring.valueOf()",
+ mystring,
+ mystring.valueOf() );
+ array[item++] = new TestCase( SECTION,
+ "mydate = new Date(); mydate.valueOf = Object.prototype.valueOf; mydate.valueOf()",
+ mydate,
+ mydate.valueOf() );
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.4.js b/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.4.js
new file mode 100644
index 0000000..5a018c0
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/ObjectObjects/15.2.4.js
@@ -0,0 +1,60 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.2.4.js
+ ECMA Section: 15.2.4 Properties of the Object prototype object
+
+ Description: The value of the internal [[Prototype]] property of
+ the Object prototype object is null
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+
+ var SECTION = "15.2.4";
+ var VERSION = "ECMA_2";
+ startTest();
+ var TITLE = "Properties of the Object.prototype object";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+ testcases[tc++] = new TestCase( SECTION, "Object.prototype.__proto__",
+ null,
+ Object.prototype.__proto__
+ );
+
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/SourceText/6-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/SourceText/6-1.js
new file mode 100644
index 0000000..759402b
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/SourceText/6-1.js
@@ -0,0 +1,124 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 6-1.js
+ ECMA Section: Source Text
+ Description:
+
+ ECMAScript source text is represented as a sequence of characters
+ representable using the Unicode version 2.0 character encoding.
+
+ SourceCharacter ::
+ any Unicode character
+
+ However, it is possible to represent every ECMAScript program using
+ only ASCII characters (which are equivalent to the first 128 Unicode
+ characters). Non-ASCII Unicode characters may appear only within comments
+ and string literals. In string literals, any Unicode character may also be
+ expressed as a Unicode escape sequence consisting of six ASCII characters,
+ namely \u plus four hexadecimal digits. Within a comment, such an escape
+ sequence is effectively ignored as part of the comment. Within a string
+ literal, the Unicode escape sequence contributes one character to the string
+ value of the literal.
+
+ Note that ECMAScript differs from the Java programming language in the
+ behavior of Unicode escape sequences. In a Java program, if the Unicode escape
+ sequence \u000A, for example, occurs within a single-line comment, it is
+ interpreted as a line terminator (Unicode character 000A is line feed) and
+ therefore the next character is not part of the comment. Similarly, if the
+ Unicode escape sequence \u000A occurs within a string literal in a Java
+ program, it is likewise interpreted as a line terminator, which is not
+ allowed within a string literal-one must write \n instead of \u000A to
+ cause a line feed to be part of the string value of a string literal. In
+ an ECMAScript program, a Unicode escape sequence occurring within a comment
+ is never interpreted and therefore cannot contribute to termination of the
+ comment. Similarly, a Unicode escape sequence occurring within a string literal
+ in an ECMAScript program always contributes a character to the string value of
+ the literal and is never interpreted as a line terminator or as a quote mark
+ that might terminate the string literal.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "6-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Source Text";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ testcases[tc] = new TestCase( SECTION,
+ "// the following character should not be interpreted as a line terminator in a comment: \u000A",
+ 'PASSED',
+ "PASSED" );
+
+ // \u000A testcases[tc].actual = "FAILED!";
+
+ tc++;
+
+ testcases[tc] = new TestCase( SECTION,
+ "// the following character should not be interpreted as a line terminator in a comment: \\n 'FAILED'",
+ 'PASSED',
+ 'PASSED' );
+
+ // the following character should noy be interpreted as a line terminator: \\n testcases[tc].actual = "FAILED"
+
+ tc++;
+
+ testcases[tc] = new TestCase( SECTION,
+ "// the following character should not be interpreted as a line terminator in a comment: \\u000A 'FAILED'",
+ 'PASSED',
+ 'PASSED' )
+
+ // the following character should not be interpreted as a line terminator: \u000A testcases[tc].actual = "FAILED"
+
+ testcases[tc++] = new TestCase( SECTION,
+ "// the following character should not be interpreted as a line terminator in a comment: \n 'PASSED'",
+ 'PASSED',
+ 'PASSED' )
+ // the following character should not be interpreted as a line terminator: \n testcases[tc].actual = 'FAILED'
+
+ testcases[tc] = new TestCase( SECTION,
+ "// the following character should not be interpreted as a line terminator in a comment: u000D",
+ 'PASSED',
+ 'PASSED' )
+
+ // the following character should not be interpreted as a line terminator: \u000D testcases[tc].actual = "FAILED"
+
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/SourceText/6-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/SourceText/6-2.js
new file mode 100644
index 0000000..9e7c7f9
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/SourceText/6-2.js
@@ -0,0 +1,129 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 6-1.js
+ ECMA Section: Source Text
+ Description:
+
+ ECMAScript source text is represented as a sequence of characters
+ representable using the Unicode version 2.0 character encoding.
+
+ SourceCharacter ::
+ any Unicode character
+
+ However, it is possible to represent every ECMAScript program using
+ only ASCII characters (which are equivalent to the first 128 Unicode
+ characters). Non-ASCII Unicode characters may appear only within comments
+ and string literals. In string literals, any Unicode character may also be
+ expressed as a Unicode escape sequence consisting of six ASCII characters,
+ namely \u plus four hexadecimal digits. Within a comment, such an escape
+ sequence is effectively ignored as part of the comment. Within a string
+ literal, the Unicode escape sequence contributes one character to the string
+ value of the literal.
+
+ Note that ECMAScript differs from the Java programming language in the
+ behavior of Unicode escape sequences. In a Java program, if the Unicode escape
+ sequence \u000A, for example, occurs within a single-line comment, it is
+ interpreted as a line terminator (Unicode character 000A is line feed) and
+ therefore the next character is not part of the comment. Similarly, if the
+ Unicode escape sequence \u000A occurs within a string literal in a Java
+ program, it is likewise interpreted as a line terminator, which is not
+ allowed within a string literal-one must write \n instead of \u000A to
+ cause a line feed to be part of the string value of a string literal. In
+ an ECMAScript program, a Unicode escape sequence occurring within a comment
+ is never interpreted and therefore cannot contribute to termination of the
+ comment. Similarly, a Unicode escape sequence occurring within a string literal
+ in an ECMAScript program always contributes a character to the string value of
+ the literal and is never interpreted as a line terminator or as a quote mark
+ that might terminate the string literal.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "6-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Source Text";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ // encoded quotes should not end a quote
+
+ testcases[tc++]= new TestCase( SECTION,
+ "var s = 'PAS\\u0022SED'; s",
+ "PAS\"SED",
+ eval("var s = 'PAS\\u0022SED'; s") );
+
+ testcases[tc++]= new TestCase( SECTION,
+ 'var s = "PAS\\u0022SED"; s',
+ "PAS\"SED",
+ eval('var s = "PAS\\u0022SED"; s') );
+
+
+ testcases[tc++]= new TestCase( SECTION,
+ "var s = 'PAS\\u0027SED'; s",
+ "PAS\'SED",
+ eval("var s = 'PAS\\u0027SED'; s") );
+
+
+ testcases[tc++]= new TestCase( SECTION,
+ 'var s = "PAS\\u0027SED"; s',
+ "PAS\'SED",
+ eval('var s = "PAS\\u0027SED"; s') );
+
+ testcases[tc] = new TestCase( SECTION,
+ 'var s="PAS\\u0027SED"; s',
+ "PAS\'SED",
+ "" )
+ var s = "PAS\u0027SED";
+
+ testcases[tc].actual = s;
+
+ tc++;
+
+ testcases[tc]= new TestCase( SECTION,
+ 'var s = "PAS\\u0027SED"; s',
+ "PAS\"SED",
+ "" );
+ var s = "PAS\u0022SED";
+
+ testcases[tc].actual = s;
+
+
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.10-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.10-1.js
new file mode 100644
index 0000000..cf33b0a
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.10-1.js
@@ -0,0 +1,151 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 12.10-1.js
+ ECMA Section: 12.10 The with statement
+ Description:
+ WithStatement :
+ with ( Expression ) Statement
+
+ The with statement adds a computed object to the front of the scope chain
+ of the current execution context, then executes a statement with this
+ augmented scope chain, then restores the scope chain.
+
+ Semantics
+
+ The production WithStatement : with ( Expression ) Statement is evaluated
+ as follows:
+ 1. Evaluate Expression.
+ 2. Call GetValue(Result(1)).
+ 3. Call ToObject(Result(2)).
+ 4. Add Result(3) to the front of the scope chain.
+ 5. Evaluate Statement using the augmented scope chain from step 4.
+ 6. Remove Result(3) from the front of the scope chain.
+ 7. Return Result(5).
+
+ Discussion
+ Note that no matter how control leaves the embedded Statement, whether
+ normally or by some form of abrupt completion, the scope chain is always
+ restored to its former state.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "12.10-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "The with statment";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ // although the scope chain changes, the this value is immutable for a given
+ // execution context.
+
+ array[item++] = new TestCase( SECTION,
+ "with( new Number() ) { this +'' }",
+ "[object global]",
+ eval("with( new Number() ) { this +'' }") );
+
+ // the object's functions and properties should override those of the
+ // global object.
+
+ array[item++] = new TestCase(
+ SECTION,
+ "var MYOB = new WithObject(true); with (MYOB) { parseInt() }",
+ true,
+ eval("var MYOB = new WithObject(true); with (MYOB) { parseInt() }") );
+
+ array[item++] = new TestCase(
+ SECTION,
+ "var MYOB = new WithObject(false); with (MYOB) { NaN }",
+ false,
+ eval("var MYOB = new WithObject(false); with (MYOB) { NaN }") );
+
+ array[item++] = new TestCase(
+ SECTION,
+ "var MYOB = new WithObject(NaN); with (MYOB) { Infinity }",
+ Number.NaN,
+ eval("var MYOB = new WithObject(NaN); with (MYOB) { Infinity }") );
+
+ array[item++] = new TestCase(
+ SECTION,
+ "var MYOB = new WithObject(false); with (MYOB) { }; Infinity",
+ Number.POSITIVE_INFINITY,
+ eval("var MYOB = new WithObject(false); with (MYOB) { }; Infinity") );
+
+
+ array[item++] = new TestCase(
+ SECTION,
+ "var MYOB = new WithObject(0); with (MYOB) { delete Infinity; Infinity }",
+ Number.POSITIVE_INFINITY,
+ eval("var MYOB = new WithObject(0); with (MYOB) { delete Infinity; Infinity }") );
+
+ // let us leave the with block via a break.
+
+ array[item++] = new TestCase(
+ SECTION,
+ "var MYOB = new WithObject(0); while (true) { with (MYOB) { Infinity; break; } } Infinity",
+ Number.POSITIVE_INFINITY,
+ eval("var MYOB = new WithObject(0); while (true) { with (MYOB) { Infinity; break; } } Infinity") );
+
+ return ( array );
+}
+function WithObject( value ) {
+ this.prop1 = 1;
+ this.prop2 = new Boolean(true);
+ this.prop3 = "a string";
+ this.value = value;
+
+ // now we will override global functions
+
+ this.parseInt = new Function( "return this.value" );
+ this.NaN = value;
+ this.Infinity = value;
+ this.unescape = new Function( "return this.value" );
+ this.escape = new Function( "return this.value" );
+ this.eval = new Function( "return this.value" );
+ this.parseFloat = new Function( "return this.value" );
+ this.isNaN = new Function( "return this.value" );
+ this.isFinite = new Function( "return this.value" );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.10.js b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.10.js
new file mode 100644
index 0000000..08e8ebc
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.10.js
@@ -0,0 +1,64 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 12.10-1.js
+ ECMA Section: 12.10 The with statement
+ Description:
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+ var SECTION = "12.10-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "The with statement";
+
+ var testcases = getTestCases();
+
+ writeHeaderToLog( SECTION +" "+ TITLE);
+
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION,
+ "var x; with (7) x = valueOf(); typeof x;",
+ "number",
+ eval("var x; with(7) x = valueOf(); typeof x;") );
+ return ( array );
+}
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.2-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.2-1.js
new file mode 100644
index 0000000..44f64b8
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.2-1.js
@@ -0,0 +1,70 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 12.2-1.js
+ ECMA Section: The variable statement
+ Description:
+
+ If the variable statement occurs inside a FunctionDeclaration, the
+ variables are defined with function-local scope in that function, as
+ described in section 10.1.3. Otherwise, they are defined with global
+ scope, that is, they are created as members of the global object, as
+ described in section 0. Variables are created when the execution scope
+ is entered. A Block does not define a new execution scope. Only Program and
+ FunctionDeclaration produce a new scope. Variables are initialized to the
+ undefined value when created. A variable with an Initializer is assigned
+ the value of its AssignmentExpression when the VariableStatement is executed,
+ not when the variable is created.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "12.2-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "The variable statement";
+
+ writeHeaderToLog( SECTION +" "+ TITLE);
+
+ var testcases = new Array();
+
+ testcases[tc] = new TestCase( "SECTION",
+ "var x = 3; function f() { var a = x; var x = 23; return a; }; f()",
+ void 0,
+ eval("var x = 3; function f() { var a = x; var x = 23; return a; }; f()") );
+
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.5-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.5-1.js
new file mode 100644
index 0000000..b0fe400
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.5-1.js
@@ -0,0 +1,98 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 12.5-1.js
+ ECMA Section: The if statement
+ Description:
+
+ The production IfStatement : if ( Expression ) Statement else Statement
+ is evaluated as follows:
+
+ 1.Evaluate Expression.
+ 2.Call GetValue(Result(1)).
+ 3.Call ToBoolean(Result(2)).
+ 4.If Result(3) is false, go to step 7.
+ 5.Evaluate the first Statement.
+ 6.Return Result(5).
+ 7.Evaluate the second Statement.
+ 8.Return Result(7).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+
+ var SECTION = "12.5-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "The if statment";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+
+ var testcases = new Array();
+
+ testcases[tc++] = new TestCase( SECTION,
+ "var MYVAR; if ( true ) MYVAR='PASSED'; else MYVAR= 'FAILED';",
+ "PASSED",
+ eval("var MYVAR; if ( true ) MYVAR='PASSED'; else MYVAR= 'FAILED';") );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "var MYVAR; if ( false ) MYVAR='FAILED'; else MYVAR= 'PASSED';",
+ "PASSED",
+ eval("var MYVAR; if ( false ) MYVAR='FAILED'; else MYVAR= 'PASSED';") );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "var MYVAR; if ( new Boolean(true) ) MYVAR='PASSED'; else MYVAR= 'FAILED';",
+ "PASSED",
+ eval("var MYVAR; if ( new Boolean(true) ) MYVAR='PASSED'; else MYVAR= 'FAILED';") );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "var MYVAR; if ( new Boolean(false) ) MYVAR='PASSED'; else MYVAR= 'FAILED';",
+ "PASSED",
+ eval("var MYVAR; if ( new Boolean(false) ) MYVAR='PASSED'; else MYVAR= 'FAILED';") );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "var MYVAR; if ( 1 ) MYVAR='PASSED'; else MYVAR= 'FAILED';",
+ "PASSED",
+ eval("var MYVAR; if ( 1 ) MYVAR='PASSED'; else MYVAR= 'FAILED';") );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "var MYVAR; if ( 0 ) MYVAR='FAILED'; else MYVAR= 'PASSED';",
+ "PASSED",
+ eval("var MYVAR; if ( 0 ) MYVAR='FAILED'; else MYVAR= 'PASSED';") );
+
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.5-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.5-2.js
new file mode 100644
index 0000000..9b30bfd
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.5-2.js
@@ -0,0 +1,96 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 12.5-2.js
+ ECMA Section: The if statement
+ Description:
+
+ The production IfStatement : if ( Expression ) Statement else Statement
+ is evaluated as follows:
+
+ 1.Evaluate Expression.
+ 2.Call GetValue(Result(1)).
+ 3.Call ToBoolean(Result(2)).
+ 4.If Result(3) is false, go to step 7.
+ 5.Evaluate the first Statement.
+ 6.Return Result(5).
+ 7.Evaluate the second Statement.
+ 8.Return Result(7).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "12.5-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "The if statement" ;
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ testcases[tc++] = new TestCase( SECTION,
+ "var MYVAR; if ( true ) MYVAR='PASSED'; MYVAR",
+ "PASSED",
+ eval("var MYVAR; if ( true ) MYVAR='PASSED'; MYVAR") );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "var MYVAR; if ( false ) MYVAR='FAILED'; MYVAR;",
+ "PASSED",
+ eval("var MYVAR=\"PASSED\"; if ( false ) MYVAR='FAILED'; MYVAR;") );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "var MYVAR; if ( new Boolean(true) ) MYVAR='PASSED'; MYVAR",
+ "PASSED",
+ eval("var MYVAR; if ( new Boolean(true) ) MYVAR='PASSED'; MYVAR") );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "var MYVAR; if ( new Boolean(false) ) MYVAR='PASSED'; MYVAR",
+ "PASSED",
+ eval("var MYVAR; if ( new Boolean(false) ) MYVAR='PASSED'; MYVAR") );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "var MYVAR; if ( 1 ) MYVAR='PASSED'; MYVAR",
+ "PASSED",
+ eval("var MYVAR; if ( 1 ) MYVAR='PASSED'; MYVAR") );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "var MYVAR; if ( 0 ) MYVAR='FAILED'; MYVAR;",
+ "PASSED",
+ eval("var MYVAR=\"PASSED\"; if ( 0 ) MYVAR='FAILED'; MYVAR;") );
+
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.1-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.1-1.js
new file mode 100644
index 0000000..0b43603
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.1-1.js
@@ -0,0 +1,68 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 12.6.1-1.js
+ ECMA Section: The while statement
+ Description:
+
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "12.6.1-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "The While statement";
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ testcases[tc++] = new TestCase( SECTION,
+ "var MYVAR = 0; while( MYVAR++ < 100) { if ( MYVAR < 100 ) break; } MYVAR ",
+ 1,
+ eval("var MYVAR = 0; while( MYVAR++ < 100) { if ( MYVAR < 100 ) break; } MYVAR "));
+
+ testcases[tc++] = new TestCase( SECTION,
+ "var MYVAR = 0; while( MYVAR++ < 100) { if ( MYVAR < 100 ) continue; else break; } MYVAR ",
+ 100,
+ eval("var MYVAR = 0; while( MYVAR++ < 100) { if ( MYVAR < 100 ) continue; else break; } MYVAR "));
+
+ testcases[tc++] = new TestCase( SECTION,
+ "function MYFUN( arg1 ) { while ( arg1++ < 100 ) { if ( arg1 < 100 ) return arg1; } }; MYFUN(1)",
+ 2,
+ eval("function MYFUN( arg1 ) { while ( arg1++ < 100 ) { if ( arg1 < 100 ) return arg1; } }; MYFUN(1)"));
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.2-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.2-1.js
new file mode 100644
index 0000000..387cf14
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.2-1.js
@@ -0,0 +1,75 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 12.6.2-1.js
+ ECMA Section: 12.6.2 The for Statement
+
+ 1. first expression is not present.
+ 2. second expression is not present
+ 3. third expression is not present
+
+
+ Author: christine@netscape.com
+ Date: 15 september 1997
+*/
+
+ var SECTION = "12.6.2-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "The for statment";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new getTestCases();
+
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ array[0] = new TestCase( "12.6.2-1", "for statement", 99, "" );
+ return ( array );
+}
+
+function testprogram() {
+ myVar = 0;
+
+ for ( ; ; ) {
+ if ( ++myVar == 99 )
+ break;
+ }
+
+ return myVar;
+}
+function test() {
+ testcases[0].actual = testprogram();
+
+ testcases[0].passed = writeTestCaseResult(
+ testcases[0].expect,
+ testcases[0].actual,
+ testcases[0].description +" = "+ testcases[0].actual );
+
+ testcases[0].reason += ( testcases[0].passed ) ? "" : "wrong value ";
+
+ stopTest();
+
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.2-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.2-2.js
new file mode 100644
index 0000000..788a5d0
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.2-2.js
@@ -0,0 +1,76 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 12.6.2-2.js
+ ECMA Section: 12.6.2 The for Statement
+
+ 1. first expression is not present.
+ 2. second expression is not present
+ 3. third expression is present
+
+
+ Author: christine@netscape.com
+ Date: 15 september 1997
+*/
+ var SECTION = "12.6.2-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "The for statment";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ array[0] = new TestCase( SECTION, "for statement", 99, "" );
+ return ( array );
+}
+
+function testprogram() {
+ myVar = 0;
+
+ for ( ; ; myVar++ ) {
+ if ( myVar < 99 ) {
+ continue;
+ } else {
+ break;
+ }
+ }
+
+ return myVar;
+}
+function test() {
+ testcases[0].actual = testprogram();
+
+ testcases[0].passed = writeTestCaseResult(
+ testcases[0].expect,
+ testcases[0].actual,
+ testcases[0].description +" = "+ testcases[0].actual );
+
+ testcases[0].reason += ( testcases[0].passed ) ? "" : "wrong value ";
+
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.2-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.2-3.js
new file mode 100644
index 0000000..706f224
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.2-3.js
@@ -0,0 +1,67 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 12.6.2-3.js
+ ECMA Section: 12.6.2 The for Statement
+
+ 1. first expression is not present.
+ 2. second expression is present
+ 3. third expression is present
+
+
+ Author: christine@netscape.com
+ Date: 15 september 1997
+*/
+ var SECTION = "12.6.2-3";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "The for statment";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+ testcases[0] = new TestCase( SECTION, "for statement", 100, "" );
+
+ test();
+
+function testprogram() {
+ myVar = 0;
+
+ for ( ; myVar < 100 ; myVar++ ) {
+ continue;
+ }
+
+ return myVar;
+}
+function test() {
+ testcases[0].actual = testprogram();
+
+ testcases[0].passed = writeTestCaseResult(
+ testcases[0].expect,
+ testcases[0].actual,
+ testcases[0].description +" = "+ testcases[0].actual );
+
+ testcases[0].reason += ( testcases[0].passed ) ? "" : "wrong value ";
+ stopTest();
+
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.2-4.js b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.2-4.js
new file mode 100644
index 0000000..887dea4
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.2-4.js
@@ -0,0 +1,66 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 12.6.2-4.js
+ ECMA Section: 12.6.2 The for Statement
+
+ 1. first expression is not present.
+ 2. second expression is present
+ 3. third expression is present
+
+
+ Author: christine@netscape.com
+ Date: 15 september 1997
+*/
+
+ var SECTION = "12.6.2-4";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "The for statment";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ testcases[testcases.length] = new TestCase( SECTION,
+ "for statement", 100, testprogram() );
+
+ test();
+
+function testprogram() {
+ myVar = 0;
+
+ for ( ; myVar < 100 ; myVar++ ) {
+ }
+
+ return myVar;
+}
+function test() {
+ testcases[0].passed = writeTestCaseResult(
+ testcases[0].expect,
+ testcases[0].actual,
+ testcases[0].description +" = "+ testcases[0].actual );
+
+ testcases[0].reason += ( testcases[0].passed ) ? "" : "wrong value ";
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.2-5.js b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.2-5.js
new file mode 100644
index 0000000..3404ecf
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.2-5.js
@@ -0,0 +1,71 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 12.6.2-5.js
+ ECMA Section: 12.6.2 The for Statement
+
+ 1. first expression is not present.
+ 2. second expression is present
+ 3. third expression is present
+
+
+ Author: christine@netscape.com
+ Date: 15 september 1997
+*/
+ var SECTION = "12.6.2-5";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "The for statment";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ array[0] = new TestCase( SECTION, "for statement", 99, "" );
+ return ( array );
+}
+
+function testprogram() {
+ myVar = 0;
+
+ for ( ; myVar < 100 ; myVar++ ) {
+ if (myVar == 99)
+ break;
+ }
+
+ return myVar;
+}
+function test() {
+ testcases[0].actual = testprogram();
+ testcases[0].passed = writeTestCaseResult(
+ testcases[0].expect,
+ testcases[0].actual,
+ testcases[0].description +" = "+ testcases[0].actual );
+
+ testcases[0].reason += ( testcases[0].passed ) ? "" : "wrong value ";
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.2-6.js b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.2-6.js
new file mode 100644
index 0000000..1ed50d8
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.2-6.js
@@ -0,0 +1,75 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 12.6.2-6.js
+ ECMA Section: 12.6.2 The for Statement
+
+ 1. first expression is present.
+ 2. second expression is not present
+ 3. third expression is present
+
+
+ Author: christine@netscape.com
+ Date: 15 september 1997
+*/
+ var SECTION = "12.6.2-6";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "The for statment";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ array[0] = new TestCase( "12.6.2-6", "for statement", 256, "" );
+ return ( array );
+}
+
+function testprogram() {
+ var myVar;
+
+ for ( myVar=2; ; myVar *= myVar ) {
+
+ if (myVar > 100)
+ break;
+ continue;
+ }
+
+ return myVar;
+}
+function test() {
+ testcases[0].actual = testprogram();
+
+ testcases[0].passed = writeTestCaseResult(
+ testcases[0].expect,
+ testcases[0].actual,
+ testcases[0].description +" = "+ testcases[0].actual );
+
+ testcases[0].reason += ( testcases[0].passed ) ? "" : "wrong value ";
+
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.2-7.js b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.2-7.js
new file mode 100644
index 0000000..ec9f246
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.2-7.js
@@ -0,0 +1,72 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 12.6.2-7.js
+ ECMA Section: 12.6.2 The for Statement
+
+ 1. first expression is present.
+ 2. second expression is not present
+ 3. third expression is present
+
+
+ Author: christine@netscape.com
+ Date: 15 september 1997
+*/
+ var SECTION = "12.6.2-7";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "The for statment";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ array[0] = new TestCase( SECTION, "for statement", 256, "" );
+ return ( array );
+}
+
+function testprogram() {
+ var myVar;
+
+ for ( myVar=2; myVar < 100 ; myVar *= myVar ) {
+
+ continue;
+ }
+
+ return myVar;
+}
+function test() {
+ testcases[0].actual = testprogram();
+
+ testcases[0].passed = writeTestCaseResult(
+ testcases[0].expect,
+ testcases[0].actual,
+ testcases[0].description +" = "+ testcases[0].actual );
+
+ testcases[0].reason += ( testcases[0].passed ) ? "" : "wrong value ";
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.2-8.js b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.2-8.js
new file mode 100644
index 0000000..ecabc06
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.2-8.js
@@ -0,0 +1,69 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 12.6.2-8.js
+ ECMA Section: 12.6.2 The for Statement
+
+ 1. first expression is present.
+ 2. second expression is present
+ 3. third expression is present
+
+
+ Author: christine@netscape.com
+ Date: 15 september 1997
+*/
+ var SECTION = "12.6.2-8";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "The for statment";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ array[0] = new TestCase( SECTION, "for statement", 256, "" );
+ return ( array );
+}
+function testprogram() {
+ var myVar;
+
+ for ( myVar=2; myVar < 256; myVar *= myVar ) {
+ }
+
+ return myVar;
+}
+function test() {
+ testcases[0].actual = testprogram();
+
+ testcases[0].passed = writeTestCaseResult(
+ testcases[0].expect,
+ testcases[0].actual,
+ testcases[0].description +" = "+ testcases[0].actual );
+
+ testcases[0].reason += ( testcases[0].passed ) ? "" : "wrong value ";
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.2-9-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.2-9-n.js
new file mode 100644
index 0000000..ef7c12e
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.2-9-n.js
@@ -0,0 +1,65 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 12.6.2-9-n.js
+ ECMA Section: 12.6.2 The for Statement
+
+ 1. first expression is not present.
+ 2. second expression is not present
+ 3. third expression is not present
+
+
+ Author: christine@netscape.com
+ Date: 15 september 1997
+*/
+
+
+ var SECTION = "12.6.2-9-n";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "The for statment";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ testcases[testcases.length] = new TestCase( SECTION,
+ "for (i)",
+ "error",
+ "" );
+
+ for (i) {
+ }
+
+ test();
+
+function test() {
+ testcases[0].passed = writeTestCaseResult(
+ testcases[0].expect,
+ testcases[0].actual,
+ testcases[0].description +" = "+ testcases[0].actual );
+
+ testcases[0].reason += ( testcases[0].passed ) ? "" : "wrong value ";
+
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-1.js
new file mode 100644
index 0000000..9b2aa2b
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-1.js
@@ -0,0 +1,71 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 12.6.3-1.js
+ ECMA Section: 12.6.3 The for...in Statement
+ Description:
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+
+ var SECTION = "12.6.3-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "The for..in statment";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION,
+ "var x; Number.prototype.foo = 34; for ( j in 7 ) x = j; x",
+ "foo",
+ eval("var x; Number.prototype.foo = 34; for ( j in 7 ){x = j;} x") );
+
+ return ( array );
+}
+
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function MyObject(a, b, c, d, e) {
+
+
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-10.js b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-10.js
new file mode 100644
index 0000000..f2f042b
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-10.js
@@ -0,0 +1,112 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 12.6.3-10.js
+ ECMA Section: 12.6.3 The for...in Statement
+ Description:
+ The production IterationStatement : for ( LeftHandSideExpression in Expression )
+ Statement is evaluated as follows:
+
+ 1. Evaluate the Expression.
+ 2. Call GetValue(Result(1)).
+ 3. Call ToObject(Result(2)).
+ 4. Let C be "normal completion".
+ 5. Get the name of the next property of Result(3) that doesn't have the
+ DontEnum attribute. If there is no such property, go to step 14.
+ 6. Evaluate the LeftHandSideExpression (it may be evaluated repeatedly).
+ 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ):
+ 1. If Type(V) is not Reference, generate a runtime error.
+ 2. Call GetBase(V).
+ 3. If Result(2) is null, go to step 6.
+ 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V)
+ for the property name and W for the value.
+ 5. Return.
+ 6. Call the [[Put]] method for the global object, passing
+ GetPropertyName(V) for the property name and W for the value.
+ 7. Return.
+ 8. Evaluate Statement.
+ 9. If Result(8) is a value completion, change C to be "normal completion
+ after value V" where V is the value carried by Result(8).
+ 10. If Result(8) is a break completion, go to step 14.
+ 11. If Result(8) is a continue completion, go to step 5.
+ 12. If Result(8) is a return completion, return Result(8).
+ 13. Go to step 5.
+ 14. Return C.
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+ var SECTION = "12.6.3-10";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "The for..in statment";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ // for ( LeftHandSideExpression in Expression )
+ // LeftHandSideExpression:NewExpression:MemberExpression
+
+ var count = 0;
+ function f() { count++; return new Array("h","e","l","l","o"); }
+
+ var result = "";
+ for ( p in f() ) { result += f()[p] };
+
+ testcases[testcases.length] = new TestCase( SECTION,
+ "count = 0; result = \"\"; "+
+ "function f() { count++; return new Array(\"h\",\"e\",\"l\",\"l\",\"o\"); }"+
+ "for ( p in f() ) { result += f()[p] }; count",
+ 6,
+ count );
+
+ testcases[testcases.length] = new TestCase( SECTION,
+ "result",
+ "hello",
+ result );
+
+ // LeftHandSideExpression:NewExpression:MemberExpression [ Expression ]
+ // LeftHandSideExpression:NewExpression:MemberExpression . Identifier
+ // LeftHandSideExpression:NewExpression:new MemberExpression Arguments
+ // LeftHandSideExpression:NewExpression:PrimaryExpression:( Expression )
+ // LeftHandSideExpression:CallExpression:MemberExpression Arguments
+ // LeftHandSideExpression:CallExpression Arguments
+ // LeftHandSideExpression:CallExpression [ Expression ]
+ // LeftHandSideExpression:CallExpression . Identifier
+
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-11.js b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-11.js
new file mode 100644
index 0000000..579845a
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-11.js
@@ -0,0 +1,93 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 12.6.3-11.js
+ ECMA Section: 12.6.3 The for...in Statement
+ Description:
+ The production IterationStatement : for ( LeftHandSideExpression in Expression )
+ Statement is evaluated as follows:
+
+ 1. Evaluate the Expression.
+ 2. Call GetValue(Result(1)).
+ 3. Call ToObject(Result(2)).
+ 4. Let C be "normal completion".
+ 5. Get the name of the next property of Result(3) that doesn't have the
+ DontEnum attribute. If there is no such property, go to step 14.
+ 6. Evaluate the LeftHandSideExpression (it may be evaluated repeatedly).
+ 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ):
+ 1. If Type(V) is not Reference, generate a runtime error.
+ 2. Call GetBase(V).
+ 3. If Result(2) is null, go to step 6.
+ 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V)
+ for the property name and W for the value.
+ 5. Return.
+ 6. Call the [[Put]] method for the global object, passing
+ GetPropertyName(V) for the property name and W for the value.
+ 7. Return.
+ 8. Evaluate Statement.
+ 9. If Result(8) is a value completion, change C to be "normal completion
+ after value V" where V is the value carried by Result(8).
+ 10. If Result(8) is a break completion, go to step 14.
+ 11. If Result(8) is a continue completion, go to step 5.
+ 12. If Result(8) is a return completion, return Result(8).
+ 13. Go to step 5.
+ 14. Return C.
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+ var SECTION = "12.6.3-11";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "The for..in statment";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+// 5. Get the name of the next property of Result(3) that doesn't have the
+// DontEnum attribute. If there is no such property, go to step 14.
+
+ var result = "";
+
+ for ( p in Number ) { result += String(p) };
+
+ testcases[testcases.length] = new TestCase( SECTION,
+ "result = \"\"; for ( p in Number ) { result += String(p) };",
+ "",
+ result );
+
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-12.js b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-12.js
new file mode 100644
index 0000000..b5c4b18
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-12.js
@@ -0,0 +1,100 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 12.6.3-12.js
+ ECMA Section: 12.6.3 The for...in Statement
+ Description:
+
+ This is a regression test for http://bugzilla.mozilla.org/show_bug.cgi?id=9802.
+
+ The production IterationStatement : for ( LeftHandSideExpression in Expression )
+ Statement is evaluated as follows:
+
+ 1. Evaluate the Expression.
+ 2. Call GetValue(Result(1)).
+ 3. Call ToObject(Result(2)).
+ 4. Let C be "normal completion".
+ 5. Get the name of the next property of Result(3) that doesn't have the
+ DontEnum attribute. If there is no such property, go to step 14.
+ 6. Evaluate the LeftHandSideExpression (it may be evaluated repeatedly).
+ 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ):
+ 1. If Type(V) is not Reference, generate a runtime error.
+ 2. Call GetBase(V).
+ 3. If Result(2) is null, go to step 6.
+ 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V)
+ for the property name and W for the value.
+ 5. Return.
+ 6. Call the [[Put]] method for the global object, passing
+ GetPropertyName(V) for the property name and W for the value.
+ 7. Return.
+ 8. Evaluate Statement.
+ 9. If Result(8) is a value completion, change C to be "normal completion
+ after value V" where V is the value carried by Result(8).
+ 10. If Result(8) is a break completion, go to step 14.
+ 11. If Result(8) is a continue completion, go to step 5.
+ 12. If Result(8) is a return completion, return Result(8).
+ 13. Go to step 5.
+ 14. Return C.
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+ var SECTION = "12.6.3-12";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "The for..in statment";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var result = "PASSED";
+
+ for ( aVar in this ) {
+ if (aVar == "aVar") {
+ result = "FAILED"
+ }
+ };
+
+ testcases[testcases.length] = new TestCase(
+ SECTION,
+ "var result=''; for ( aVar in this ) { " +
+ "if (aVar == 'aVar') {return a failure}; result",
+ "PASSED",
+ result );
+
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-19.js b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-19.js
new file mode 100644
index 0000000..4f386d8
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-19.js
@@ -0,0 +1,114 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 12.6.3-1.js
+ ECMA Section: 12.6.3 The for...in Statement
+ Description:
+ The production IterationStatement : for ( LeftHandSideExpression in Expression )
+ Statement is evaluated as follows:
+
+ 1. Evaluate the Expression.
+ 2. Call GetValue(Result(1)).
+ 3. Call ToObject(Result(2)).
+ 4. Let C be "normal completion".
+ 5. Get the name of the next property of Result(3) that doesn't have the
+ DontEnum attribute. If there is no such property, go to step 14.
+ 6. Evaluate the LeftHandSideExpression (it may be evaluated repeatedly).
+ 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ):
+ 1. If Type(V) is not Reference, generate a runtime error.
+ 2. Call GetBase(V).
+ 3. If Result(2) is null, go to step 6.
+ 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V)
+ for the property name and W for the value.
+ 5. Return.
+ 6. Call the [[Put]] method for the global object, passing
+ GetPropertyName(V) for the property name and W for the value.
+ 7. Return.
+ 8. Evaluate Statement.
+ 9. If Result(8) is a value completion, change C to be "normal completion
+ after value V" where V is the value carried by Result(8).
+ 10. If Result(8) is a break completion, go to step 14.
+ 11. If Result(8) is a continue completion, go to step 5.
+ 12. If Result(8) is a return completion, return Result(8).
+ 13. Go to step 5.
+ 14. Return C.
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+ var SECTION = "12.6.3-4";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "The for..in statment";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ // for ( LeftHandSideExpression in Expression )
+ // LeftHandSideExpression:NewExpression:MemberExpression
+
+ var count = 0;
+ function f() { count++; return new Array("h","e","l","l","o"); }
+
+ var result = "";
+ for ( p in f() ) { result += f()[p] };
+
+ testcases[testcases.length] = new TestCase( SECTION,
+ "count = 0; result = \"\"; "+
+ "function f() { count++; return new Array(\"h\",\"e\",\"l\",\"l\",\"o\"); }"+
+ "for ( p in f() ) { result += f()[p] }; count",
+ 6,
+ count );
+
+ testcases[testcases.length] = new TestCase( SECTION,
+ "result",
+ "hello",
+ result );
+
+
+
+ // LeftHandSideExpression:NewExpression:MemberExpression [ Expression ]
+ // LeftHandSideExpression:NewExpression:MemberExpression . Identifier
+ // LeftHandSideExpression:NewExpression:new MemberExpression Arguments
+ // LeftHandSideExpression:NewExpression:PrimaryExpression:( Expression )
+ // LeftHandSideExpression:CallExpression:MemberExpression Arguments
+ // LeftHandSideExpression:CallExpression Arguments
+ // LeftHandSideExpression:CallExpression [ Expression ]
+ // LeftHandSideExpression:CallExpression . Identifier
+
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-2.js
new file mode 100644
index 0000000..f025a09
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-2.js
@@ -0,0 +1,66 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 12.6.3-2.js
+ ECMA Section: 12.6.3 The for...in Statement
+ Description: Check the Boolean Object
+
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+
+ var SECTION = "12.6.3-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "The for..in statment";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION,
+ "Boolean.prototype.foo = 34; for ( j in Boolean ) Boolean[j]",
+ 34,
+ eval("Boolean.prototype.foo = 34; for ( j in Boolean ) Boolean[j] ") );
+
+ return ( array );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-3.js
new file mode 100644
index 0000000..32cce34
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-3.js
@@ -0,0 +1,70 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 12.6.3-3.js
+ ECMA Section: for..in loops
+ Description:
+
+ This verifies the fix to
+ http://scopus.mcom.com/bugsplat/show_bug.cgi?id=112156
+ for..in should take general lvalue for first argument
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "12.6.3-3";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "The for..in statment";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+
+ var o = {};
+
+ var result = "";
+
+ for ( o.a in [1,2,3] ) { result += String( [1,2,3][o.a] ); }
+
+ testcases[testcases.length] = new TestCase( SECTION,
+ "for ( o.a in [1,2,3] ) { result += String( [1,2,3][o.a] ); } result",
+ "123",
+ result );
+
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-4.js b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-4.js
new file mode 100644
index 0000000..d0876b6
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-4.js
@@ -0,0 +1,193 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 12.6.3-1.js
+ ECMA Section: 12.6.3 The for...in Statement
+ Description:
+ The production IterationStatement : for ( LeftHandSideExpression in Expression )
+ Statement is evaluated as follows:
+
+ 1. Evaluate the Expression.
+ 2. Call GetValue(Result(1)).
+ 3. Call ToObject(Result(2)).
+ 4. Let C be "normal completion".
+ 5. Get the name of the next property of Result(3) that doesn't have the
+ DontEnum attribute. If there is no such property, go to step 14.
+ 6. Evaluate the LeftHandSideExpression (it may be evaluated repeatedly).
+ 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ):
+ 1. If Type(V) is not Reference, generate a runtime error.
+ 2. Call GetBase(V).
+ 3. If Result(2) is null, go to step 6.
+ 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V)
+ for the property name and W for the value.
+ 5. Return.
+ 6. Call the [[Put]] method for the global object, passing
+ GetPropertyName(V) for the property name and W for the value.
+ 7. Return.
+ 8. Evaluate Statement.
+ 9. If Result(8) is a value completion, change C to be "normal completion
+ after value V" where V is the value carried by Result(8).
+ 10. If Result(8) is a break completion, go to step 14.
+ 11. If Result(8) is a continue completion, go to step 5.
+ 12. If Result(8) is a return completion, return Result(8).
+ 13. Go to step 5.
+ 14. Return C.
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+ var SECTION = "12.6.3-4";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "The for..in statment";
+ var BUGNUMBER="http://scopus.mcom.com/bugsplat/show_bug.cgi?id=344855";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ // for ( LeftHandSideExpression in Expression )
+ // LeftHandSideExpression:NewExpression:MemberExpression
+
+ var o = new MyObject();
+ var result = 0;
+
+ for ( MyObject in o ) {
+ result += o[MyObject];
+ }
+
+ testcases[testcases.length] = new TestCase( SECTION,
+ "for ( MyObject in o ) { result += o[MyObject] }",
+ 6,
+ result );
+
+ var result = 0;
+
+ for ( value in o ) {
+ result += o[value];
+ }
+
+ testcases[testcases.length] = new TestCase( SECTION,
+ "for ( value in o ) { result += o[value]",
+ 6,
+ result );
+
+ var value = "value";
+ var result = 0;
+ for ( value in o ) {
+ result += o[value];
+ }
+
+ testcases[testcases.length] = new TestCase( SECTION,
+ "value = \"value\"; for ( value in o ) { result += o[value]",
+ 6,
+ result );
+
+ var value = 0;
+ var result = 0;
+ for ( value in o ) {
+ result += o[value];
+ }
+
+ testcases[testcases.length] = new TestCase( SECTION,
+ "value = 0; for ( value in o ) { result += o[value]",
+ 6,
+ result );
+
+ // this causes a segv
+
+ var ob = { 0:"hello" };
+ var result = 0;
+ for ( ob[0] in o ) {
+ result += o[ob[0]];
+ }
+ testcases[testcases.length] = new TestCase( SECTION,
+ "ob = { 0:\"hello\" }; for ( ob[0] in o ) { result += o[ob[0]]",
+ 6,
+ result );
+
+ var result = 0;
+ for ( ob["0"] in o ) {
+ result += o[ob["0"]];
+ }
+ testcases[testcases.length] = new TestCase( SECTION,
+ "value = 0; for ( ob[\"0\"] in o ) { result += o[o[\"0\"]]",
+ 6,
+ result );
+
+ var result = 0;
+ var ob = { value:"hello" };
+ for ( ob[value] in o ) {
+ result += o[ob[value]];
+ }
+ testcases[testcases.length] = new TestCase( SECTION,
+ "ob = { 0:\"hello\" }; for ( ob[value] in o ) { result += o[ob[value]]",
+ 6,
+ result );
+
+ var result = 0;
+ for ( ob["value"] in o ) {
+ result += o[ob["value"]];
+ }
+ testcases[testcases.length] = new TestCase( SECTION,
+ "value = 0; for ( ob[\"value\"] in o ) { result += o[ob[\"value\"]]",
+ 6,
+ result );
+
+ var result = 0;
+ for ( ob.value in o ) {
+ result += o[ob.value];
+ }
+ testcases[testcases.length] = new TestCase( SECTION,
+ "value = 0; for ( ob.value in o ) { result += o[ob.value]",
+ 6,
+ result );
+
+ // LeftHandSideExpression:NewExpression:MemberExpression [ Expression ]
+ // LeftHandSideExpression:NewExpression:MemberExpression . Identifier
+ // LeftHandSideExpression:NewExpression:new MemberExpression Arguments
+ // LeftHandSideExpression:NewExpression:PrimaryExpression:( Expression )
+ // LeftHandSideExpression:CallExpression:MemberExpression Arguments
+ // LeftHandSideExpression:CallExpression Arguments
+ // LeftHandSideExpression:CallExpression [ Expression ]
+ // LeftHandSideExpression:CallExpression . Identifier
+
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function MyObject() {
+ this.value = 2;
+ this[0] = 4;
+ return this;
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-5-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-5-n.js
new file mode 100644
index 0000000..1fb4ce5
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-5-n.js
@@ -0,0 +1,102 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 12.6.3-1.js
+ ECMA Section: 12.6.3 The for...in Statement
+ Description:
+ The production IterationStatement : for ( LeftHandSideExpression in Expression )
+ Statement is evaluated as follows:
+
+ 1. Evaluate the Expression.
+ 2. Call GetValue(Result(1)).
+ 3. Call ToObject(Result(2)).
+ 4. Let C be "normal completion".
+ 5. Get the name of the next property of Result(3) that doesn't have the
+ DontEnum attribute. If there is no such property, go to step 14.
+ 6. Evaluate the LeftHandSideExpression ( it may be evaluated repeatedly).
+ 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ):
+ 1. If Type(V) is not Reference, generate a runtime error.
+ 2. Call GetBase(V).
+ 3. If Result(2) is null, go to step 6.
+ 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V)
+ for the property name and W for the value.
+ 5. Return.
+ 6. Call the [[Put]] method for the global object, passing
+ GetPropertyName(V) for the property name and W for the value.
+ 7. Return.
+ 8. Evaluate Statement.
+ 9. If Result(8) is a value completion, change C to be "normal completion
+ after value V" where V is the value carried by Result(8).
+ 10. If Result(8) is a break completion, go to step 14.
+ 11. If Result(8) is a continue completion, go to step 5.
+ 12. If Result(8) is a return completion, return Result(8).
+ 13. Go to step 5.
+ 14. Return C.
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+ var SECTION = "12.6.3-4";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "The for..in statment";
+ var error = err;
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ // for ( LeftHandSideExpression in Expression )
+ // LeftHandSideExpression:NewExpression:MemberExpression
+
+ testcases[testcases.length] = new TestCase( SECTION,
+ "more than one member expression",
+ "error",
+ "" );
+
+ var o = new MyObject();
+ var result = 0;
+
+ for ( var i, p in this) {
+ result += this[p];
+ }
+
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function MyObject() {
+ this.value = 2;
+ this[0] = 4;
+ return this;
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-6-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-6-n.js
new file mode 100644
index 0000000..bd6bb1b
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-6-n.js
@@ -0,0 +1,102 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 12.6.3-1.js
+ ECMA Section: 12.6.3 The for...in Statement
+ Description:
+ The production IterationStatement : for ( LeftHandSideExpression in Expression )
+ Statement is evaluated as follows:
+
+ 1. Evaluate the Expression.
+ 2. Call GetValue(Result(1)).
+ 3. Call ToObject(Result(2)).
+ 4. Let C be "normal completion".
+ 5. Get the name of the next property of Result(3) that doesn't have the
+ DontEnum attribute. If there is no such property, go to step 14.
+ 6. Evaluate the LeftHandSideExpression ( it may be evaluated repeatedly).
+ 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ):
+ 1. If Type(V) is not Reference, generate a runtime error.
+ 2. Call GetBase(V).
+ 3. If Result(2) is null, go to step 6.
+ 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V)
+ for the property name and W for the value.
+ 5. Return.
+ 6. Call the [[Put]] method for the global object, passing
+ GetPropertyName(V) for the property name and W for the value.
+ 7. Return.
+ 8. Evaluate Statement.
+ 9. If Result(8) is a value completion, change C to be "normal completion
+ after value V" where V is the value carried by Result(8).
+ 10. If Result(8) is a break completion, go to step 14.
+ 11. If Result(8) is a continue completion, go to step 5.
+ 12. If Result(8) is a return completion, return Result(8).
+ 13. Go to step 5.
+ 14. Return C.
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+ var SECTION = "12.6.3-4";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "The for..in statment";
+ var error = err;
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ // for ( LeftHandSideExpression in Expression )
+ // LeftHandSideExpression:NewExpression:MemberExpression
+
+ testcases[testcases.length] = new TestCase( SECTION,
+ "bad left-hand side expression",
+ "error",
+ "" );
+
+ var o = new MyObject();
+ var result = 0;
+
+ for ( this in o) {
+ result += this[p];
+ }
+
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function MyObject() {
+ this.value = 2;
+ this[0] = 4;
+ return this;
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-7-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-7-n.js
new file mode 100644
index 0000000..5dfad13
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-7-n.js
@@ -0,0 +1,102 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 12.6.3-1.js
+ ECMA Section: 12.6.3 The for...in Statement
+ Description:
+ The production IterationStatement : for ( LeftHandSideExpression in Expression )
+ Statement is evaluated as follows:
+
+ 1. Evaluate the Expression.
+ 2. Call GetValue(Result(1)).
+ 3. Call ToObject(Result(2)).
+ 4. Let C be "normal completion".
+ 5. Get the name of the next property of Result(3) that doesn't have the
+ DontEnum attribute. If there is no such property, go to step 14.
+ 6. Evaluate the LeftHandSideExpression ( it may be evaluated repeatedly).
+ 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ):
+ 1. If Type(V) is not Reference, generate a runtime error.
+ 2. Call GetBase(V).
+ 3. If Result(2) is null, go to step 6.
+ 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V)
+ for the property name and W for the value.
+ 5. Return.
+ 6. Call the [[Put]] method for the global object, passing
+ GetPropertyName(V) for the property name and W for the value.
+ 7. Return.
+ 8. Evaluate Statement.
+ 9. If Result(8) is a value completion, change C to be "normal completion
+ after value V" where V is the value carried by Result(8).
+ 10. If Result(8) is a break completion, go to step 14.
+ 11. If Result(8) is a continue completion, go to step 5.
+ 12. If Result(8) is a return completion, return Result(8).
+ 13. Go to step 5.
+ 14. Return C.
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+ var SECTION = "12.6.3-4";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "The for..in statment";
+ var error = err;
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ // for ( LeftHandSideExpression in Expression )
+ // LeftHandSideExpression:NewExpression:MemberExpression
+
+ testcases[testcases.length] = new TestCase( SECTION,
+ "bad left-hand side expression",
+ "error",
+ "" );
+
+ var o = new MyObject();
+ var result = 0;
+
+ for ( "a" in o) {
+ result += this[p];
+ }
+
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function MyObject() {
+ this.value = 2;
+ this[0] = 4;
+ return this;
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-8-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-8-n.js
new file mode 100644
index 0000000..ac93487
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-8-n.js
@@ -0,0 +1,102 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 12.6.3-8-n.js
+ ECMA Section: 12.6.3 The for...in Statement
+ Description:
+ The production IterationStatement : for ( LeftHandSideExpression in Expression )
+ Statement is evaluated as follows:
+
+ 1. Evaluate the Expression.
+ 2. Call GetValue(Result(1)).
+ 3. Call ToObject(Result(2)).
+ 4. Let C be "normal completion".
+ 5. Get the name of the next property of Result(3) that doesn't have the
+ DontEnum attribute. If there is no such property, go to step 14.
+ 6. Evaluate the LeftHandSideExpression ( it may be evaluated repeatedly).
+ 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ):
+ 1. If Type(V) is not Reference, generate a runtime error.
+ 2. Call GetBase(V).
+ 3. If Result(2) is null, go to step 6.
+ 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V)
+ for the property name and W for the value.
+ 5. Return.
+ 6. Call the [[Put]] method for the global object, passing
+ GetPropertyName(V) for the property name and W for the value.
+ 7. Return.
+ 8. Evaluate Statement.
+ 9. If Result(8) is a value completion, change C to be "normal completion
+ after value V" where V is the value carried by Result(8).
+ 10. If Result(8) is a break completion, go to step 14.
+ 11. If Result(8) is a continue completion, go to step 5.
+ 12. If Result(8) is a return completion, return Result(8).
+ 13. Go to step 5.
+ 14. Return C.
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+ var SECTION = "12.6.3-4";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "The for..in statment";
+ var error = err;
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ // for ( LeftHandSideExpression in Expression )
+ // LeftHandSideExpression:NewExpression:MemberExpression
+
+ testcases[testcases.length] = new TestCase( SECTION,
+ "bad left-hand side expression",
+ "error",
+ "" );
+
+ var o = new MyObject();
+ var result = 0;
+
+ for ( 1 in o) {
+ result += this[p];
+ }
+
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function MyObject() {
+ this.value = 2;
+ this[0] = 4;
+ return this;
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-9-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-9-n.js
new file mode 100644
index 0000000..06000a4
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.6.3-9-n.js
@@ -0,0 +1,102 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 12.6.3-9-n.js
+ ECMA Section: 12.6.3 The for...in Statement
+ Description:
+ The production IterationStatement : for ( LeftHandSideExpression in Expression )
+ Statement is evaluated as follows:
+
+ 1. Evaluate the Expression.
+ 2. Call GetValue(Result(1)).
+ 3. Call ToObject(Result(2)).
+ 4. Let C be "normal completion".
+ 5. Get the name of the next property of Result(3) that doesn't have the
+ DontEnum attribute. If there is no such property, go to step 14.
+ 6. Evaluate the LeftHandSideExpression ( it may be evaluated repeatedly).
+ 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ):
+ 1. If Type(V) is not Reference, generate a runtime error.
+ 2. Call GetBase(V).
+ 3. If Result(2) is null, go to step 6.
+ 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V)
+ for the property name and W for the value.
+ 5. Return.
+ 6. Call the [[Put]] method for the global object, passing
+ GetPropertyName(V) for the property name and W for the value.
+ 7. Return.
+ 8. Evaluate Statement.
+ 9. If Result(8) is a value completion, change C to be "normal completion
+ after value V" where V is the value carried by Result(8).
+ 10. If Result(8) is a break completion, go to step 14.
+ 11. If Result(8) is a continue completion, go to step 5.
+ 12. If Result(8) is a return completion, return Result(8).
+ 13. Go to step 5.
+ 14. Return C.
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+ var SECTION = "12.6.3-9-n";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "The for..in statment";
+ var error = err;
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ // for ( LeftHandSideExpression in Expression )
+ // LeftHandSideExpression:NewExpression:MemberExpression
+
+ testcases[testcases.length] = new TestCase( SECTION,
+ "object is not defined",
+ "error",
+ "" );
+
+ var o = new MyObject();
+ var result = 0;
+
+ for ( var o in foo) {
+ result += this[o];
+ }
+
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function MyObject() {
+ this.value = 2;
+ this[0] = 4;
+ return this;
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.7-1-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.7-1-n.js
new file mode 100644
index 0000000..b9b13e8
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.7-1-n.js
@@ -0,0 +1,67 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 12.7-1-n.js
+ ECMA Section: 12.7 The continue statement
+ Description:
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "12.7.1-n";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "The continue statment";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+
+ testcases[tc].actual = eval( testcases[tc].actual );
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION,
+ "continue",
+ "error",
+ "continue" );
+
+ return ( array );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.8-1-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.8-1-n.js
new file mode 100644
index 0000000..9594a73
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.8-1-n.js
@@ -0,0 +1,69 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 12.8-1-n.js
+ ECMA Section: 12.8 The break statement
+ Description:
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "12.8-1-n";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "The break in statment";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+
+ testcases[tc].actual = eval( testcases[tc].actual );
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION,
+ "break",
+ "error",
+ "break" );
+
+ return ( array );
+}
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.9-1-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.9-1-n.js
new file mode 100644
index 0000000..c0383c2
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Statements/12.9-1-n.js
@@ -0,0 +1,64 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 12.9-1-n.js
+ ECMA Section: 12.9 The return statement
+ Description:
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "12.9-1-n";
+ var VERSION = "ECMA_1";
+ startTest();
+ var testcases = getTestCases();
+
+ writeHeaderToLog( SECTION + " The return statement");
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+
+ testcases[tc].actual = eval( testcases[tc].actual );
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION,
+ "return",
+ "error",
+ "return" );
+
+ return ( array );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.1.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.1.js
new file mode 100644
index 0000000..7971afe
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.1.js
@@ -0,0 +1,137 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.5.1.js
+ ECMA Section: 15.5.1 The String Constructor called as a Function
+ 15.5.1.1 String(value)
+ 15.5.1.2 String()
+
+ Description:
+ When String is called as a function rather than as
+ a constructor, it performs a type conversion.
+ - String(value) returns a string value (not a String
+ object) computed by ToString(value)
+ - String() returns the empty string ""
+
+ Author: christine@netscape.com
+ Date: 1 october 1997
+*/
+
+ var SECTION = "15.5.1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "The String Constructor Called as a Function";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "String('string primitive')", "string primitive", String('string primitive') );
+ array[item++] = new TestCase( SECTION, "String(void 0)", "undefined", String( void 0) );
+ array[item++] = new TestCase( SECTION, "String(null)", "null", String( null ) );
+ array[item++] = new TestCase( SECTION, "String(true)", "true", String( true) );
+ array[item++] = new TestCase( SECTION, "String(false)", "false", String( false ) );
+ array[item++] = new TestCase( SECTION, "String(Boolean(true))", "true", String(Boolean(true)) );
+ array[item++] = new TestCase( SECTION, "String(Boolean(false))", "false", String(Boolean(false)) );
+ array[item++] = new TestCase( SECTION, "String(Boolean())", "false", String(Boolean(false)) );
+ array[item++] = new TestCase( SECTION, "String(new Array())", "", String( new Array()) );
+ array[item++] = new TestCase( SECTION, "String(new Array(1,2,3))", "1,2,3", String( new Array(1,2,3)) );
+
+
+ array[item++] = new TestCase( SECTION, "String( Number.NaN )", "NaN", String( Number.NaN ) );
+ array[item++] = new TestCase( SECTION, "String( 0 )", "0", String( 0 ) );
+ array[item++] = new TestCase( SECTION, "String( -0 )", "0", String( -0 ) );
+ array[item++] = new TestCase( SECTION, "String( Number.POSITIVE_INFINITY )", "Infinity", String( Number.POSITIVE_INFINITY ) );
+ array[item++] = new TestCase( SECTION, "String( Number.NEGATIVE_INFINITY )", "-Infinity", String( Number.NEGATIVE_INFINITY ) );
+ array[item++] = new TestCase( SECTION, "String( -1 )", "-1", String( -1 ) );
+
+ // cases in step 6: integers 1e21 > x >= 1 or -1 >= x > -1e21
+
+ array[item++] = new TestCase( SECTION, "String( 1 )", "1", String( 1 ) );
+ array[item++] = new TestCase( SECTION, "String( 10 )", "10", String( 10 ) );
+ array[item++] = new TestCase( SECTION, "String( 100 )", "100", String( 100 ) );
+ array[item++] = new TestCase( SECTION, "String( 1000 )", "1000", String( 1000 ) );
+ array[item++] = new TestCase( SECTION, "String( 10000 )", "10000", String( 10000 ) );
+ array[item++] = new TestCase( SECTION, "String( 10000000000 )", "10000000000", String( 10000000000 ) );
+ array[item++] = new TestCase( SECTION, "String( 10000000000000000000 )", "10000000000000000000", String( 10000000000000000000 ) );
+ array[item++] = new TestCase( SECTION, "String( 100000000000000000000 )","100000000000000000000",String( 100000000000000000000 ) );
+
+ array[item++] = new TestCase( SECTION, "String( 12345 )", "12345", String( 12345 ) );
+ array[item++] = new TestCase( SECTION, "String( 1234567890 )", "1234567890", String( 1234567890 ) );
+
+ array[item++] = new TestCase( SECTION, "String( -1 )", "-1", String( -1 ) );
+ array[item++] = new TestCase( SECTION, "String( -10 )", "-10", String( -10 ) );
+ array[item++] = new TestCase( SECTION, "String( -100 )", "-100", String( -100 ) );
+ array[item++] = new TestCase( SECTION, "String( -1000 )", "-1000", String( -1000 ) );
+ array[item++] = new TestCase( SECTION, "String( -1000000000 )", "-1000000000", String( -1000000000 ) );
+ array[item++] = new TestCase( SECTION, "String( -1000000000000000 )", "-1000000000000000", String( -1000000000000000 ) );
+ array[item++] = new TestCase( SECTION, "String( -100000000000000000000 )", "-100000000000000000000", String( -100000000000000000000 ) );
+ array[item++] = new TestCase( SECTION, "String( -1000000000000000000000 )", "-1e+21", String( -1000000000000000000000 ) );
+
+ array[item++] = new TestCase( SECTION, "String( -12345 )", "-12345", String( -12345 ) );
+ array[item++] = new TestCase( SECTION, "String( -1234567890 )", "-1234567890", String( -1234567890 ) );
+
+ // cases in step 7: numbers with a fractional component, 1e21> x >1 or -1 > x > -1e21,
+ array[item++] = new TestCase( SECTION, "String( 1.0000001 )", "1.0000001", String( 1.0000001 ) );
+
+
+ // cases in step 8: fractions between 1 > x > -1, exclusive of 0 and -0
+
+ // cases in step 9: numbers with 1 significant digit >= 1e+21 or <= 1e-6
+
+ array[item++] = new TestCase( SECTION, "String( 1000000000000000000000 )", "1e+21", String( 1000000000000000000000 ) );
+ array[item++] = new TestCase( SECTION, "String( 10000000000000000000000 )", "1e+22", String( 10000000000000000000000 ) );
+
+ // cases in step 10: numbers with more than 1 significant digit >= 1e+21 or <= 1e-6
+ array[item++] = new TestCase( SECTION, "String( 1.2345 )", "1.2345", String( 1.2345));
+ array[item++] = new TestCase( SECTION, "String( 1.234567890 )", "1.23456789", String( 1.234567890 ));
+
+ array[item++] = new TestCase( SECTION, "String( .12345 )", "0.12345", String(.12345 ) );
+ array[item++] = new TestCase( SECTION, "String( .012345 )", "0.012345", String(.012345) );
+ array[item++] = new TestCase( SECTION, "String( .0012345 )", "0.0012345", String(.0012345) );
+ array[item++] = new TestCase( SECTION, "String( .00012345 )", "0.00012345", String(.00012345) );
+ array[item++] = new TestCase( SECTION, "String( .000012345 )", "0.000012345", String(.000012345) );
+ array[item++] = new TestCase( SECTION, "String( .0000012345 )", "0.0000012345", String(.0000012345) );
+ array[item++] = new TestCase( SECTION, "String( .00000012345 )", "1.2345e-7", String(.00000012345));
+
+ array[item++] = new TestCase( "15.5.2", "String()", "", String() );
+
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.2.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.2.js
new file mode 100644
index 0000000..59daad0
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.2.js
@@ -0,0 +1,112 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.5.2.js
+ ECMA Section: 15.5.2 The String Constructor
+ 15.5.2.1 new String(value)
+ 15.5.2.2 new String()
+
+ Description: When String is called as part of a new expression, it
+ is a constructor; it initializes the newly constructed
+ object.
+
+ - The prototype property of the newly constructed
+ object is set to the original String prototype object,
+ the one that is the intial value of String.prototype
+ - The internal [[Class]] property of the object is "String"
+ - The value of the object is ToString(value).
+ - If no value is specified, its value is the empty string.
+
+ Author: christine@netscape.com
+ Date: 1 october 1997
+*/
+
+ var SECTION = "15.5.2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "The String Constructor";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "typeof new String('string primitive')", "object", typeof new String('string primitive') );
+ array[item++] = new TestCase( SECTION, "var TESTSTRING = new String('string primitive'); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()", "[object String]", eval("var TESTSTRING = new String('string primitive'); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()") );
+ array[item++] = new TestCase( SECTION, "(new String('string primitive')).valueOf()", 'string primitive', (new String('string primitive')).valueOf() );
+ array[item++] = new TestCase( SECTION, "(new String('string primitive')).substring", String.prototype.substring, (new String('string primitive')).substring );
+
+ array[item++] = new TestCase( SECTION, "typeof new String(void 0)", "object", typeof new String(void 0) );
+ array[item++] = new TestCase( SECTION, "var TESTSTRING = new String(void 0); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()", "[object String]", eval("var TESTSTRING = new String(void 0); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()") );
+ array[item++] = new TestCase( SECTION, "(new String(void 0)).valueOf()", "undefined", (new String(void 0)).valueOf() );
+ array[item++] = new TestCase( SECTION, "(new String(void 0)).toString", String.prototype.toString, (new String(void 0)).toString );
+
+ array[item++] = new TestCase( SECTION, "typeof new String(null)", "object", typeof new String(null) );
+ array[item++] = new TestCase( SECTION, "var TESTSTRING = new String(null); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()", "[object String]", eval("var TESTSTRING = new String(null); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()") );
+ array[item++] = new TestCase( SECTION, "(new String(null)).valueOf()", "null", (new String(null)).valueOf() );
+ array[item++] = new TestCase( SECTION, "(new String(null)).valueOf", String.prototype.valueOf, (new String(null)).valueOf );
+
+ array[item++] = new TestCase( SECTION, "typeof new String(true)", "object", typeof new String(true) );
+ array[item++] = new TestCase( SECTION, "var TESTSTRING = new String(true); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()", "[object String]", eval("var TESTSTRING = new String(true); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()") );
+ array[item++] = new TestCase( SECTION, "(new String(true)).valueOf()", "true", (new String(true)).valueOf() );
+ array[item++] = new TestCase( SECTION, "(new String(true)).charAt", String.prototype.charAt, (new String(true)).charAt );
+
+ array[item++] = new TestCase( SECTION, "typeof new String(false)", "object", typeof new String(false) );
+ array[item++] = new TestCase( SECTION, "var TESTSTRING = new String(false); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()", "[object String]", eval("var TESTSTRING = new String(false); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()") );
+ array[item++] = new TestCase( SECTION, "(new String(false)).valueOf()", "false", (new String(false)).valueOf() );
+ array[item++] = new TestCase( SECTION, "(new String(false)).charCodeAt", String.prototype.charCodeAt, (new String(false)).charCodeAt );
+
+ array[item++] = new TestCase( SECTION, "typeof new String(new Boolean(true))", "object", typeof new String(new Boolean(true)) );
+ array[item++] = new TestCase( SECTION, "var TESTSTRING = new String(new Boolean(true)); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()", "[object String]", eval("var TESTSTRING = new String(new Boolean(true)); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()") );
+ array[item++] = new TestCase( SECTION, "(new String(new Boolean(true))).valueOf()", "true", (new String(new Boolean(true))).valueOf() );
+ array[item++] = new TestCase( SECTION, "(new String(new Boolean(true))).indexOf", String.prototype.indexOf, (new String(new Boolean(true))).indexOf );
+
+ array[item++] = new TestCase( SECTION, "typeof new String()", "object", typeof new String() );
+ array[item++] = new TestCase( SECTION, "var TESTSTRING = new String(); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()", "[object String]", eval("var TESTSTRING = new String(); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()") );
+ array[item++] = new TestCase( SECTION, "(new String()).valueOf()", '', (new String()).valueOf() );
+ array[item++] = new TestCase( SECTION, "(new String()).lastIndexOf", String.prototype.lastIndexOf, (new String()).lastIndexOf );
+
+ array[item++] = new TestCase( SECTION, "typeof new String('')", "object", typeof new String('') );
+ array[item++] = new TestCase( SECTION, "var TESTSTRING = new String(''); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()", "[object String]", eval("var TESTSTRING = new String(''); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()") );
+ array[item++] = new TestCase( SECTION, "(new String('')).valueOf()", '', (new String('')).valueOf() );
+ array[item++] = new TestCase( SECTION, "(new String('')).split", String.prototype.split, (new String('')).split );
+
+ return ( array );
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.3.1-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.3.1-1.js
new file mode 100644
index 0000000..af15536
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.3.1-1.js
@@ -0,0 +1,73 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.5.3.1-1.js
+ ECMA Section: 15.5.3.1 Properties of the String Constructor
+
+ Description: The initial value of String.prototype is the built-in
+ String prototype object.
+
+ This property shall have the attributes [ DontEnum,
+ DontDelete, ReadOnly]
+
+ This tests the DontEnum attribute.
+
+ Author: christine@netscape.com
+ Date: 1 october 1997
+*/
+
+ var SECTION = "15.5.3.1-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Properties of the String Constructor";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "String.prototype.length", 0, String.prototype.length );
+
+ array[item++] = new TestCase( SECTION,
+ "var str='';for ( p in String ) { if ( p == 'prototype' ) str += p; } str",
+ "",
+ eval("var str='';for ( p in String ) { if ( p == 'prototype' ) str += p; } str") );
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.3.1-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.3.1-2.js
new file mode 100644
index 0000000..d4d7fa3
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.3.1-2.js
@@ -0,0 +1,70 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.5.3.1-2.js
+ ECMA Section: 15.5.3.1 Properties of the String Constructor
+
+ Description: The initial value of String.prototype is the built-in
+ String prototype object.
+
+ This property shall have the attributes [ DontEnum,
+ DontDelete, ReadOnly]
+
+ This tests the ReadOnly attribute.
+
+ Author: christine@netscape.com
+ Date: 1 october 1997
+*/
+
+ var SECTION = "15.5.3.1-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Properties of the String Constructor";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION,
+ "String.prototype=null;String.prototype",
+ String.prototype,
+ eval("String.prototype=null;String.prototype") );
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.3.1-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.3.1-3.js
new file mode 100644
index 0000000..01da54a
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.3.1-3.js
@@ -0,0 +1,67 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.5.3.1-3.js
+ ECMA Section: 15.5.3.1 Properties of the String Constructor
+
+ Description: The initial value of String.prototype is the built-in
+ String prototype object.
+
+ This property shall have the attributes [ DontEnum,
+ DontDelete, ReadOnly]
+
+ This tests the DontDelete attribute.
+
+ Author: christine@netscape.com
+ Date: 1 october 1997
+*/
+
+ var SECTION = "15.5.3.1-3";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Properties of the String Constructor";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "delete( String.prototype )", false, eval("delete ( String.prototype )") );
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.3.1-4.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.3.1-4.js
new file mode 100644
index 0000000..fbaea31
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.3.1-4.js
@@ -0,0 +1,68 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.5.3.1-4.js
+ ECMA Section: 15.5.3.1 Properties of the String Constructor
+
+ Description: The initial value of String.prototype is the built-in
+ String prototype object.
+
+ This property shall have the attributes [ DontEnum,
+ DontDelete, ReadOnly]
+
+ This tests the DontDelete attribute.
+
+ Author: christine@netscape.com
+ Date: 1 october 1997
+*/
+
+ var SECTION = "15.5.3.1-4";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Properties of the String Constructor";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "delete( String.prototype );String.prototype", String.prototype, eval("delete ( String.prototype );String.prototype") );
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.3.2-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.3.2-1.js
new file mode 100644
index 0000000..f5fb16d
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.3.2-1.js
@@ -0,0 +1,195 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.5.3.2-1.js
+ ECMA Section: 15.5.3.2 String.fromCharCode( char0, char1, ... )
+ Description: Return a string value containing as many characters
+ as the number of arguments. Each argument specifies
+ one character of the resulting string, with the first
+ argument specifying the first character, and so on,
+ from left to right. An argument is converted to a
+ character by applying the operation ToUint16 and
+ regarding the resulting 16bit integeras the Unicode
+ encoding of a character. If no arguments are supplied,
+ the result is the empty string.
+
+ This test covers Basic Latin (range U+0020 - U+007F)
+
+ Author: christine@netscape.com
+ Date: 2 october 1997
+*/
+
+ var SECTION = "15.5.3.2-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "String.fromCharCode()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "typeof String.fromCharCode", "function", typeof String.fromCharCode );
+ array[item++] = new TestCase( SECTION, "typeof String.prototype.fromCharCode", "undefined", typeof String.prototype.fromCharCode );
+ array[item++] = new TestCase( SECTION, "var x = new String(); typeof x.fromCharCode", "undefined", eval("var x = new String(); typeof x.fromCharCode") );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode.length", 1, String.fromCharCode.length );
+
+ array[item++] = new TestCase( SECTION, "String.fromCharCode()", "", String.fromCharCode() );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0020)", " ", String.fromCharCode(0x0020) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0021)", "!", String.fromCharCode(0x0021) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0022)", "\"", String.fromCharCode(0x0022) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0023)", "#", String.fromCharCode(0x0023) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0024)", "$", String.fromCharCode(0x0024) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0025)", "%", String.fromCharCode(0x0025) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0026)", "&", String.fromCharCode(0x0026) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0027)", "\'", String.fromCharCode(0x0027) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0028)", "(", String.fromCharCode(0x0028) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0029)", ")", String.fromCharCode(0x0029) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x002A)", "*", String.fromCharCode(0x002A) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x002B)", "+", String.fromCharCode(0x002B) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x002C)", ",", String.fromCharCode(0x002C) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x002D)", "-", String.fromCharCode(0x002D) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x002E)", ".", String.fromCharCode(0x002E) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x002F)", "/", String.fromCharCode(0x002F) );
+
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0030)", "0", String.fromCharCode(0x0030) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0031)", "1", String.fromCharCode(0x0031) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0032)", "2", String.fromCharCode(0x0032) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0033)", "3", String.fromCharCode(0x0033) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0034)", "4", String.fromCharCode(0x0034) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0035)", "5", String.fromCharCode(0x0035) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0036)", "6", String.fromCharCode(0x0036) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0037)", "7", String.fromCharCode(0x0037) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0038)", "8", String.fromCharCode(0x0038) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0039)", "9", String.fromCharCode(0x0039) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x003A)", ":", String.fromCharCode(0x003A) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x003B)", ";", String.fromCharCode(0x003B) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x003C)", "<", String.fromCharCode(0x003C) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x003D)", "=", String.fromCharCode(0x003D) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x003E)", ">", String.fromCharCode(0x003E) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x003F)", "?", String.fromCharCode(0x003F) );
+
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0040)", "@", String.fromCharCode(0x0040) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0041)", "A", String.fromCharCode(0x0041) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0042)", "B", String.fromCharCode(0x0042) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0043)", "C", String.fromCharCode(0x0043) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0044)", "D", String.fromCharCode(0x0044) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0045)", "E", String.fromCharCode(0x0045) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0046)", "F", String.fromCharCode(0x0046) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0047)", "G", String.fromCharCode(0x0047) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0048)", "H", String.fromCharCode(0x0048) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0049)", "I", String.fromCharCode(0x0049) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x004A)", "J", String.fromCharCode(0x004A) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x004B)", "K", String.fromCharCode(0x004B) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x004C)", "L", String.fromCharCode(0x004C) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x004D)", "M", String.fromCharCode(0x004D) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x004E)", "N", String.fromCharCode(0x004E) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x004F)", "O", String.fromCharCode(0x004F) );
+
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0040)", "@", String.fromCharCode(0x0040) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0041)", "A", String.fromCharCode(0x0041) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0042)", "B", String.fromCharCode(0x0042) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0043)", "C", String.fromCharCode(0x0043) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0044)", "D", String.fromCharCode(0x0044) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0045)", "E", String.fromCharCode(0x0045) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0046)", "F", String.fromCharCode(0x0046) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0047)", "G", String.fromCharCode(0x0047) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0048)", "H", String.fromCharCode(0x0048) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0049)", "I", String.fromCharCode(0x0049) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x004A)", "J", String.fromCharCode(0x004A) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x004B)", "K", String.fromCharCode(0x004B) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x004C)", "L", String.fromCharCode(0x004C) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x004D)", "M", String.fromCharCode(0x004D) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x004E)", "N", String.fromCharCode(0x004E) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x004F)", "O", String.fromCharCode(0x004F) );
+
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0050)", "P", String.fromCharCode(0x0050) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0051)", "Q", String.fromCharCode(0x0051) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0052)", "R", String.fromCharCode(0x0052) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0053)", "S", String.fromCharCode(0x0053) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0054)", "T", String.fromCharCode(0x0054) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0055)", "U", String.fromCharCode(0x0055) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0056)", "V", String.fromCharCode(0x0056) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0057)", "W", String.fromCharCode(0x0057) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0058)", "X", String.fromCharCode(0x0058) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0059)", "Y", String.fromCharCode(0x0059) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x005A)", "Z", String.fromCharCode(0x005A) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x005B)", "[", String.fromCharCode(0x005B) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x005C)", "\\", String.fromCharCode(0x005C) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x005D)", "]", String.fromCharCode(0x005D) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x005E)", "^", String.fromCharCode(0x005E) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x005F)", "_", String.fromCharCode(0x005F) );
+
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0060)", "`", String.fromCharCode(0x0060) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0061)", "a", String.fromCharCode(0x0061) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0062)", "b", String.fromCharCode(0x0062) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0063)", "c", String.fromCharCode(0x0063) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0064)", "d", String.fromCharCode(0x0064) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0065)", "e", String.fromCharCode(0x0065) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0066)", "f", String.fromCharCode(0x0066) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0067)", "g", String.fromCharCode(0x0067) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0068)", "h", String.fromCharCode(0x0068) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0069)", "i", String.fromCharCode(0x0069) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x006A)", "j", String.fromCharCode(0x006A) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x006B)", "k", String.fromCharCode(0x006B) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x006C)", "l", String.fromCharCode(0x006C) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x006D)", "m", String.fromCharCode(0x006D) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x006E)", "n", String.fromCharCode(0x006E) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x006F)", "o", String.fromCharCode(0x006F) );
+
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0070)", "p", String.fromCharCode(0x0070) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0071)", "q", String.fromCharCode(0x0071) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0072)", "r", String.fromCharCode(0x0072) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0073)", "s", String.fromCharCode(0x0073) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0074)", "t", String.fromCharCode(0x0074) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0075)", "u", String.fromCharCode(0x0075) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0076)", "v", String.fromCharCode(0x0076) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0077)", "w", String.fromCharCode(0x0077) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0078)", "x", String.fromCharCode(0x0078) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0079)", "y", String.fromCharCode(0x0079) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x007A)", "z", String.fromCharCode(0x007A) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x007B)", "{", String.fromCharCode(0x007B) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x007C)", "|", String.fromCharCode(0x007C) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x007D)", "}", String.fromCharCode(0x007D) );
+ array[item++] = new TestCase( SECTION, "String.fromCharCode(0x007E)", "~", String.fromCharCode(0x007E) );
+// array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0020, 0x007F)", "", String.fromCharCode(0x0040, 0x007F) );
+
+ return array;
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.3.2-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.3.2-2.js
new file mode 100644
index 0000000..4ff3693
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.3.2-2.js
@@ -0,0 +1,80 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.5.3.2-2.js
+ ECMA Section: 15.5.3.2 String.fromCharCode( char0, char1, ... )
+ Description: Return a string value containing as many characters
+ as the number of arguments. Each argument specifies
+ one character of the resulting string, with the first
+ argument specifying the first character, and so on,
+ from left to right. An argument is converted to a
+ character by applying the operation ToUint16 and
+ regarding the resulting 16bit integeras the Unicode
+ encoding of a character. If no arguments are supplied,
+ the result is the empty string.
+
+ This tests String.fromCharCode with multiple arguments.
+
+ Author: christine@netscape.com
+ Date: 2 october 1997
+*/
+
+ var SECTION = "15.5.3.2-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "String.fromCharCode()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION,
+ "var MYSTRING = String.fromCharCode(eval(\"var args=''; for ( i = 0x0020; i < 0x007f; i++ ) { args += ( i == 0x007e ) ? i : i + ', '; } args;\")); MYSTRING",
+ " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~",
+ eval( "var MYSTRING = String.fromCharCode(" + eval("var args=''; for ( i = 0x0020; i < 0x007f; i++ ) { args += ( i == 0x007e ) ? i : i + ', '; } args;") +"); MYSTRING" ));
+
+ array[item++] = new TestCase( SECTION,
+ "MYSTRING.length",
+ 0x007f - 0x0020,
+ MYSTRING.length );
+ return array;
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.3.2-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.3.2-3.js
new file mode 100644
index 0000000..e6b515e
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.3.2-3.js
@@ -0,0 +1,122 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.5.3.2-1.js
+ ECMA Section: 15.5.3.2 String.fromCharCode( char0, char1, ... )
+ Description: Return a string value containing as many characters
+ as the number of arguments. Each argument specifies
+ one character of the resulting string, with the first
+ argument specifying the first character, and so on,
+ from left to right. An argument is converted to a
+ character by applying the operation ToUint16 and
+ regarding the resulting 16bit integeras the Unicode
+ encoding of a character. If no arguments are supplied,
+ the result is the empty string.
+
+ This test covers Basic Latin (range U+0020 - U+007F)
+
+ Author: christine@netscape.com
+ Date: 2 october 1997
+*/
+
+ var SECTION = "15.5.3.2-3";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "String.fromCharCode()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ for ( CHARCODE = 0; CHARCODE < 256; CHARCODE++ ) {
+ array[item++] = new TestCase( SECTION,
+ "(String.fromCharCode(" + CHARCODE +")).charCodeAt(0)",
+ ToUint16(CHARCODE),
+ (String.fromCharCode(CHARCODE)).charCodeAt(0)
+ );
+ }
+ for ( CHARCODE = 256; CHARCODE < 65536; CHARCODE+=333 ) {
+ array[item++] = new TestCase( SECTION,
+ "(String.fromCharCode(" + CHARCODE +")).charCodeAt(0)",
+ ToUint16(CHARCODE),
+ (String.fromCharCode(CHARCODE)).charCodeAt(0)
+ );
+ }
+ for ( CHARCODE = 65535; CHARCODE < 65538; CHARCODE++ ) {
+ array[item++] = new TestCase( SECTION,
+ "(String.fromCharCode(" + CHARCODE +")).charCodeAt(0)",
+ ToUint16(CHARCODE),
+ (String.fromCharCode(CHARCODE)).charCodeAt(0)
+ );
+ }
+ for ( CHARCODE = Math.pow(2,32)-1; CHARCODE < Math.pow(2,32)+1; CHARCODE++ ) {
+ array[item++] = new TestCase( SECTION,
+ "(String.fromCharCode(" + CHARCODE +")).charCodeAt(0)",
+ ToUint16(CHARCODE),
+ (String.fromCharCode(CHARCODE)).charCodeAt(0)
+ );
+ }
+ for ( CHARCODE = 0; CHARCODE > -65536; CHARCODE-=3333 ) {
+ array[item++] = new TestCase( SECTION,
+ "(String.fromCharCode(" + CHARCODE +")).charCodeAt(0)",
+ ToUint16(CHARCODE),
+ (String.fromCharCode(CHARCODE)).charCodeAt(0)
+ );
+ }
+ array[item++] = new TestCase( SECTION, "(String.fromCharCode(65535)).charCodeAt(0)", 65535, (String.fromCharCode(65535)).charCodeAt(0) );
+ array[item++] = new TestCase( SECTION, "(String.fromCharCode(65536)).charCodeAt(0)", 0, (String.fromCharCode(65536)).charCodeAt(0) );
+ array[item++] = new TestCase( SECTION, "(String.fromCharCode(65537)).charCodeAt(0)", 1, (String.fromCharCode(65537)).charCodeAt(0) );
+
+ return array;
+}
+function ToUint16( num ) {
+ num = Number( num );
+ if ( isNaN( num ) || num == 0 || num == Number.POSITIVE_INFINITY || num == Number.NEGATIVE_INFINITY ) {
+ return 0;
+ }
+
+ var sign = ( num < 0 ) ? -1 : 1;
+
+ num = sign * Math.floor( Math.abs( num ) );
+ num = num % Math.pow(2,16);
+ num = ( num > -65536 && num < 0) ? 65536 + num : num;
+ return num;
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.3.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.3.js
new file mode 100644
index 0000000..3a1012d
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.3.js
@@ -0,0 +1,74 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.5.3.1.js
+ ECMA Section: 15.5.3 Properties of the String Constructor
+
+ Description: The value of the internal [[Prototype]] property of
+ the String constructor is the Function prototype
+ object.
+
+ In addition to the internal [[Call]] and [[Construct]]
+ properties, the String constructor also has the length
+ property, as well as properties described in 15.5.3.1
+ and 15.5.3.2.
+
+ Author: christine@netscape.com
+ Date: 1 october 1997
+*/
+
+ var SECTION = "15.5.3";
+ var VERSION = "ECMA_2";
+ startTest();
+ var passed = true;
+ writeHeaderToLog( SECTION + " Properties of the String Constructor" );
+
+ var testcases = getTestCases();
+ var tc= 0;
+
+// all tests must call a function that returns an array of TestCase objects.
+ test( testcases );
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "String.prototype", Function.prototype, String.__proto__ );
+ array[item++] = new TestCase( SECTION, "String.length", 1, String.length );
+ return ( array );
+}
+function test( array ) {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+
+ stopTest();
+
+ // all tests must return an array of TestCase objects
+ return ( testcases );
+}
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.1.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.1.js
new file mode 100644
index 0000000..393f25a
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.1.js
@@ -0,0 +1,66 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.5.4.1.js
+ ECMA Section: 15.5.4.1 String.prototype.constructor
+
+ Description:
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+ var SECTION = "15.5.4.1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "String.prototype.constructor";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "String.prototype.constructor == String", true, String.prototype.constructor == String );
+ array[item++] = new TestCase( SECTION, "var STRING = new String.prototype.constructor('hi'); STRING.getClass = Object.prototype.toString; STRING.getClass()",
+ "[object String]",
+ eval("var STRING = new String.prototype.constructor('hi'); STRING.getClass = Object.prototype.toString; STRING.getClass()") );
+ return ( array );
+}
+function test( array ) {
+ for ( ; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+
+ stopTest();
+
+ // all tests must return an array of TestCase objects
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.10-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.10-1.js
new file mode 100644
index 0000000..454afef
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.10-1.js
@@ -0,0 +1,218 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.5.4.10-1.js
+ ECMA Section: 15.5.4.10 String.prototype.substring( start, end )
+ Description:
+
+ 15.5.4.10 String.prototype.substring(start, end)
+
+ Returns a substring of the result of converting this object to a string,
+ starting from character position start and running to character position
+ end of the string. The result is a string value, not a String object.
+
+ If either argument is NaN or negative, it is replaced with zero; if either
+ argument is larger than the length of the string, it is replaced with the
+ length of the string.
+
+ If start is larger than end, they are swapped.
+
+ When the substring method is called with two arguments start and end, the
+ following steps are taken:
+
+ 1. Call ToString, giving it the this value as its argument.
+ 2. Call ToInteger(start).
+ 3. Call ToInteger (end).
+ 4. Compute the number of characters in Result(1).
+ 5. Compute min(max(Result(2), 0), Result(4)).
+ 6. Compute min(max(Result(3), 0), Result(4)).
+ 7. Compute min(Result(5), Result(6)).
+ 8. Compute max(Result(5), Result(6)).
+ 9. Return a string whose length is the difference between Result(8) and
+ Result(7), containing characters from Result(1), namely the characters
+ with indices Result(7) through Result(8)1, in ascending order.
+
+ Note that the substring function is intentionally generic; it does not require
+ that its this value be a String object. Therefore it can be transferred to other
+ kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.5.4.10-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "String.prototype.substring( start, end )";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "String.prototype.substring.length", 2, String.prototype.substring.length );
+ array[item++] = new TestCase( SECTION, "delete String.prototype.substring.length", false, delete String.prototype.substring.length );
+ array[item++] = new TestCase( SECTION, "delete String.prototype.substring.length; String.prototype.substring.length", 2, eval("delete String.prototype.substring.length; String.prototype.substring.length") );
+
+ // test cases for when substring is called with no arguments.
+
+ // this is a string object
+
+ array[item++] = new TestCase( SECTION,
+ "var s = new String('this is a string object'); typeof s.substring()",
+ "string",
+ eval("var s = new String('this is a string object'); typeof s.substring()") );
+
+ array[item++] = new TestCase( SECTION,
+ "var s = new String(''); s.substring(1,0)",
+ "",
+ eval("var s = new String(''); s.substring(1,0)") );
+
+ array[item++] = new TestCase( SECTION,
+ "var s = new String('this is a string object'); s.substring(true, false)",
+ "t",
+ eval("var s = new String('this is a string object'); s.substring(false, true)") );
+
+ array[item++] = new TestCase( SECTION,
+ "var s = new String('this is a string object'); s.substring(NaN, Infinity)",
+ "this is a string object",
+ eval("var s = new String('this is a string object'); s.substring(NaN, Infinity)") );
+
+
+ array[item++] = new TestCase( SECTION,
+ "var s = new String('this is a string object'); s.substring(Infinity, NaN)",
+ "this is a string object",
+ eval("var s = new String('this is a string object'); s.substring(Infinity, NaN)") );
+
+
+ array[item++] = new TestCase( SECTION,
+ "var s = new String('this is a string object'); s.substring(Infinity, Infinity)",
+ "",
+ eval("var s = new String('this is a string object'); s.substring(Infinity, Infinity)") );
+
+ array[item++] = new TestCase( SECTION,
+ "var s = new String('this is a string object'); s.substring(-0.01, 0)",
+ "",
+ eval("var s = new String('this is a string object'); s.substring(-0.01,0)") );
+
+
+ array[item++] = new TestCase( SECTION,
+ "var s = new String('this is a string object'); s.substring(s.length, s.length)",
+ "",
+ eval("var s = new String('this is a string object'); s.substring(s.length, s.length)") );
+
+ array[item++] = new TestCase( SECTION,
+ "var s = new String('this is a string object'); s.substring(s.length+1, 0)",
+ "this is a string object",
+ eval("var s = new String('this is a string object'); s.substring(s.length+1, 0)") );
+
+
+ array[item++] = new TestCase( SECTION,
+ "var s = new String('this is a string object'); s.substring(-Infinity, -Infinity)",
+ "",
+ eval("var s = new String('this is a string object'); s.substring(-Infinity, -Infinity)") );
+
+ // this is not a String object, start is not an integer
+
+
+ array[item++] = new TestCase( SECTION,
+ "var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring(Infinity,-Infinity)",
+ "1,2,3,4,5",
+ eval("var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring(Infinity,-Infinity)") );
+
+ array[item++] = new TestCase( SECTION,
+ "var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring(true, false)",
+ "1",
+ eval("var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring(true, false)") );
+
+ array[item++] = new TestCase( SECTION,
+ "var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring('4', '5')",
+ "3",
+ eval("var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring('4', '5')") );
+
+
+ // this is an object object
+ array[item++] = new TestCase( SECTION,
+ "var obj = new Object(); obj.substring = String.prototype.substring; obj.substring(8,0)",
+ "[object ",
+ eval("var obj = new Object(); obj.substring = String.prototype.substring; obj.substring(8,0)") );
+
+ array[item++] = new TestCase( SECTION,
+ "var obj = new Object(); obj.substring = String.prototype.substring; obj.substring(8,obj.toString().length)",
+ "Object]",
+ eval("var obj = new Object(); obj.substring = String.prototype.substring; obj.substring(8, obj.toString().length)") );
+
+ // this is a function object
+ array[item++] = new TestCase( SECTION,
+ "var obj = new Function(); obj.substring = String.prototype.substring; obj.toString = Object.prototype.toString; obj.substring(8, Infinity)",
+ "Function]",
+ eval("var obj = new Function(); obj.substring = String.prototype.substring; obj.toString = Object.prototype.toString; obj.substring(8,Infinity)") );
+ // this is a number object
+ array[item++] = new TestCase( SECTION,
+ "var obj = new Number(NaN); obj.substring = String.prototype.substring; obj.substring(Infinity, NaN)",
+ "NaN",
+ eval("var obj = new Number(NaN); obj.substring = String.prototype.substring; obj.substring(Infinity, NaN)") );
+
+ // this is the Math object
+ array[item++] = new TestCase( SECTION,
+ "var obj = Math; obj.substring = String.prototype.substring; obj.substring(Math.PI, -10)",
+ "[ob",
+ eval("var obj = Math; obj.substring = String.prototype.substring; obj.substring(Math.PI, -10)") );
+
+ // this is a Boolean object
+
+ array[item++] = new TestCase( SECTION,
+ "var obj = new Boolean(); obj.substring = String.prototype.substring; obj.substring(new Array(), new Boolean(1))",
+ "f",
+ eval("var obj = new Boolean(); obj.substring = String.prototype.substring; obj.substring(new Array(), new Boolean(1))") );
+
+ // this is a user defined object
+
+ array[item++] = new TestCase( SECTION,
+ "var obj = new MyObject( void 0 ); obj.substring(0, 100)",
+ "undefined",
+ eval( "var obj = new MyObject( void 0 ); obj.substring(0,100)") );
+
+ return array;
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function MyObject( value ) {
+ this.value = value;
+ this.substring = String.prototype.substring;
+ this.toString = new Function ( "return this.value+''" );
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.11-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.11-1.js
new file mode 100644
index 0000000..b24a9cc
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.11-1.js
@@ -0,0 +1,514 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.5.4.11-1.js
+ ECMA Section: 15.5.4.11 String.prototype.toLowerCase()
+ Description:
+
+ Returns a string equal in length to the length of the result of converting
+ this object to a string. The result is a string value, not a String object.
+
+ Every character of the result is equal to the corresponding character of the
+ string, unless that character has a Unicode 2.0 uppercase equivalent, in which
+ case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case
+ mapping shall be used, which does not depend on implementation or locale.)
+
+ Note that the toLowerCase function is intentionally generic; it does not require
+ that its this value be a String object. Therefore it can be transferred to other
+ kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.5.4.11-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "String.prototype.toLowerCase()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "String.prototype.toLowerCase.length", 0, String.prototype.toLowerCase.length );
+ array[item++] = new TestCase( SECTION, "delete String.prototype.toLowerCase.length", false, delete String.prototype.toLowerCase.length );
+ array[item++] = new TestCase( SECTION, "delete String.prototype.toLowerCase.length; String.prototype.toLowerCase.length", 0, eval("delete String.prototype.toLowerCase.length; String.prototype.toLowerCase.length") );
+
+ // Basic Latin, Latin-1 Supplement, Latin Extended A
+ for ( var i = 0; i <= 0x017f; i++ ) {
+ var U = new Unicode(i);
+/*
+ array[item++] = new TestCase( SECTION,
+ "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()",
+ String.fromCharCode(U.lower),
+ eval("var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()") );
+*/
+ array[item++] = new TestCase( SECTION,
+ "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase().charCodeAt(0)",
+ U.lower,
+ eval("var s = new String( String.fromCharCode(i) ); s.toLowerCase().charCodeAt(0)") );
+
+ }
+
+ return array;
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function MyObject( value ) {
+ this.value = value;
+ this.substring = String.prototype.substring;
+ this.toString = new Function ( "return this.value+''" );
+}
+function Unicode( c ) {
+ u = GetUnicodeValues( c );
+ this.upper = u[0];
+ this.lower = u[1]
+ return this;
+}
+function GetUnicodeValues( c ) {
+ u = new Array();
+
+ u[0] = c;
+ u[1] = c;
+
+ // upper case Basic Latin
+
+ if ( c >= 0x0041 && c <= 0x005A) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ // lower case Basic Latin
+ if ( c >= 0x0061 && c <= 0x007a ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+
+ // upper case Latin-1 Supplement
+ if ( c == 0x00B5 ) {
+ u[0] = 0x039C;
+ u[1] = c;
+ return u;
+ }
+ if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ // lower case Latin-1 Supplement
+ if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+ if ( c == 0x00FF ) {
+ u[0] = 0x0178;
+ u[1] = c;
+ return u;
+ }
+ // Latin Extended A
+ if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) {
+ // special case for capital I
+ if ( c == 0x0130 ) {
+ u[0] = c;
+ u[1] = 0x0069;
+ return u;
+ }
+ if ( c == 0x0131 ) {
+ u[0] = 0x0049;
+ u[1] = c;
+ return u;
+ }
+
+ if ( c % 2 == 0 ) {
+ // if it's even, it's a capital and the lower case is c +1
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ // if it's odd, it's a lower case and upper case is c-1
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+ if ( c == 0x0178 ) {
+ u[0] = c;
+ u[1] = 0x00FF;
+ return u;
+ }
+
+ if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) {
+ if ( c % 2 == 1 ) {
+ // if it's odd, it's a capital and the lower case is c +1
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ // if it's even, it's a lower case and upper case is c-1
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+ if ( c == 0x017F ) {
+ u[0] = 0x0053;
+ u[1] = c;
+ }
+
+ // Latin Extended B
+ // need to improve this set
+
+ if ( c >= 0x0200 && c <= 0x0217 ) {
+ if ( c % 2 == 0 ) {
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+
+ // Latin Extended Additional
+ // Range: U+1E00 to U+1EFF
+ // http://www.unicode.org/Unicode.charts/glyphless/U1E00.html
+
+ // Spacing Modifier Leters
+ // Range: U+02B0 to U+02FF
+
+ // Combining Diacritical Marks
+ // Range: U+0300 to U+036F
+
+ // skip Greek for now
+ // Greek
+ // Range: U+0370 to U+03FF
+
+ // Cyrillic
+ // Range: U+0400 to U+04FF
+
+ if ( c >= 0x0400 && c <= 0x040F) {
+ u[0] = c;
+ u[1] = c + 80;
+ return u;
+ }
+
+
+ if ( c >= 0x0410 && c <= 0x042F ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ if ( c >= 0x0430 && c<= 0x044F ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+
+ }
+ if ( c >= 0x0450 && c<= 0x045F ) {
+ u[0] = c -80;
+ u[1] = c;
+ return u;
+ }
+
+ if ( c >= 0x0460 && c <= 0x047F ) {
+ if ( c % 2 == 0 ) {
+ u[0] = c;
+ u[1] = c +1;
+ } else {
+ u[0] = c - 1;
+ u[1] = c;
+ }
+ return u;
+ }
+
+ // Armenian
+ // Range: U+0530 to U+058F
+ if ( c >= 0x0531 && c <= 0x0556 ) {
+ u[0] = c;
+ u[1] = c + 48;
+ return u;
+ }
+ if ( c >= 0x0561 && c < 0x0587 ) {
+ u[0] = c - 48;
+ u[1] = c;
+ return u;
+ }
+
+ // Hebrew
+ // Range: U+0590 to U+05FF
+
+
+ // Arabic
+ // Range: U+0600 to U+06FF
+
+ // Devanagari
+ // Range: U+0900 to U+097F
+
+
+ // Bengali
+ // Range: U+0980 to U+09FF
+
+
+ // Gurmukhi
+ // Range: U+0A00 to U+0A7F
+
+
+ // Gujarati
+ // Range: U+0A80 to U+0AFF
+
+
+ // Oriya
+ // Range: U+0B00 to U+0B7F
+ // no capital / lower case
+
+
+ // Tamil
+ // Range: U+0B80 to U+0BFF
+ // no capital / lower case
+
+
+ // Telugu
+ // Range: U+0C00 to U+0C7F
+ // no capital / lower case
+
+
+ // Kannada
+ // Range: U+0C80 to U+0CFF
+ // no capital / lower case
+
+
+ // Malayalam
+ // Range: U+0D00 to U+0D7F
+
+ // Thai
+ // Range: U+0E00 to U+0E7F
+
+
+ // Lao
+ // Range: U+0E80 to U+0EFF
+
+
+ // Tibetan
+ // Range: U+0F00 to U+0FBF
+
+ // Georgian
+ // Range: U+10A0 to U+10F0
+
+ // Hangul Jamo
+ // Range: U+1100 to U+11FF
+
+ // Greek Extended
+ // Range: U+1F00 to U+1FFF
+ // skip for now
+
+
+ // General Punctuation
+ // Range: U+2000 to U+206F
+
+ // Superscripts and Subscripts
+ // Range: U+2070 to U+209F
+
+ // Currency Symbols
+ // Range: U+20A0 to U+20CF
+
+
+ // Combining Diacritical Marks for Symbols
+ // Range: U+20D0 to U+20FF
+ // skip for now
+
+
+ // Number Forms
+ // Range: U+2150 to U+218F
+ // skip for now
+
+
+ // Arrows
+ // Range: U+2190 to U+21FF
+
+ // Mathematical Operators
+ // Range: U+2200 to U+22FF
+
+ // Miscellaneous Technical
+ // Range: U+2300 to U+23FF
+
+ // Control Pictures
+ // Range: U+2400 to U+243F
+
+ // Optical Character Recognition
+ // Range: U+2440 to U+245F
+
+ // Enclosed Alphanumerics
+ // Range: U+2460 to U+24FF
+
+ // Box Drawing
+ // Range: U+2500 to U+257F
+
+ // Block Elements
+ // Range: U+2580 to U+259F
+
+ // Geometric Shapes
+ // Range: U+25A0 to U+25FF
+
+ // Miscellaneous Symbols
+ // Range: U+2600 to U+26FF
+
+ // Dingbats
+ // Range: U+2700 to U+27BF
+
+ // CJK Symbols and Punctuation
+ // Range: U+3000 to U+303F
+
+ // Hiragana
+ // Range: U+3040 to U+309F
+
+ // Katakana
+ // Range: U+30A0 to U+30FF
+
+ // Bopomofo
+ // Range: U+3100 to U+312F
+
+ // Hangul Compatibility Jamo
+ // Range: U+3130 to U+318F
+
+ // Kanbun
+ // Range: U+3190 to U+319F
+
+
+ // Enclosed CJK Letters and Months
+ // Range: U+3200 to U+32FF
+
+ // CJK Compatibility
+ // Range: U+3300 to U+33FF
+
+ // Hangul Syllables
+ // Range: U+AC00 to U+D7A3
+
+ // High Surrogates
+ // Range: U+D800 to U+DB7F
+
+ // Private Use High Surrogates
+ // Range: U+DB80 to U+DBFF
+
+ // Low Surrogates
+ // Range: U+DC00 to U+DFFF
+
+ // Private Use Area
+ // Range: U+E000 to U+F8FF
+
+ // CJK Compatibility Ideographs
+ // Range: U+F900 to U+FAFF
+
+ // Alphabetic Presentation Forms
+ // Range: U+FB00 to U+FB4F
+
+ // Arabic Presentation Forms-A
+ // Range: U+FB50 to U+FDFF
+
+ // Combining Half Marks
+ // Range: U+FE20 to U+FE2F
+
+ // CJK Compatibility Forms
+ // Range: U+FE30 to U+FE4F
+
+ // Small Form Variants
+ // Range: U+FE50 to U+FE6F
+
+ // Arabic Presentation Forms-B
+ // Range: U+FE70 to U+FEFF
+
+ // Halfwidth and Fullwidth Forms
+ // Range: U+FF00 to U+FFEF
+
+ if ( c >= 0xFF21 && c <= 0xFF3A ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ if ( c >= 0xFF41 && c <= 0xFF5A ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+
+ // Specials
+ // Range: U+FFF0 to U+FFFF
+
+ return u;
+}
+
+function DecimalToHexString( n ) {
+ n = Number( n );
+ var h = "0x";
+
+ for ( var i = 3; i >= 0; i-- ) {
+ if ( n >= Math.pow(16, i) ){
+ var t = Math.floor( n / Math.pow(16, i));
+ n -= t * Math.pow(16, i);
+ if ( t >= 10 ) {
+ if ( t == 10 ) {
+ h += "A";
+ }
+ if ( t == 11 ) {
+ h += "B";
+ }
+ if ( t == 12 ) {
+ h += "C";
+ }
+ if ( t == 13 ) {
+ h += "D";
+ }
+ if ( t == 14 ) {
+ h += "E";
+ }
+ if ( t == 15 ) {
+ h += "F";
+ }
+ } else {
+ h += String( t );
+ }
+ } else {
+ h += "0";
+ }
+ }
+
+ return h;
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.11-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.11-2.js
new file mode 100644
index 0000000..b75f3e8
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.11-2.js
@@ -0,0 +1,633 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+/**
+ File Name: 15.5.4.11-2.js
+ ECMA Section: 15.5.4.11 String.prototype.toLowerCase()
+ Description:
+
+ Returns a string equal in length to the length of the result of converting
+ this object to a string. The result is a string value, not a String object.
+
+ Every character of the result is equal to the corresponding character of the
+ string, unless that character has a Unicode 2.0 uppercase equivalent, in which
+ case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case
+ mapping shall be used, which does not depend on implementation or locale.)
+
+ Note that the toLowerCase function is intentionally generic; it does not require
+ that its this value be a String object. Therefore it can be transferred to other
+ kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+/*
+ Safari Changes: This test differs from the mozilla tests in two significant
+ ways.
+ First, the lower case range for Georgian letters in this file is the
+ correct range according to the Unicode 5.0 standard, as opposed to the
+ Georgian caseless range that mozilla uses.
+ Secondly this test uses an array for expected results with two entries,
+ instead of a single expected result. This allows us to accept Unicode 4.0 or
+ Unicode 5.0 results as correct, as opposed to the mozilla test, which assumes
+ Unicode 5.0. This allows Safari to pass this test on OS' with different
+ Unicode standards implemented (e.g. Tiger and XP)
+*/
+ var SECTION = "15.5.4.11-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "String.prototype.toLowerCase()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ // Georgian
+ // Range: U+10A0 to U+10FF
+ for ( var i = 0x10A0; i <= 0x10FF; i++ ) {
+ var U = new Array(new Unicode( i, 4 ), new Unicode( i, 5 ));
+
+/*
+ array[item++] = new TestCase( SECTION,
+ "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()",
+ String.fromCharCode(U.lower),
+ eval("var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()") );
+*/
+ array[item++] = new TestCaseDualExpected( SECTION,
+ "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase().charCodeAt(0)",
+ U,
+ eval("var s = new String( String.fromCharCode(i) ); s.toLowerCase().charCodeAt(0)") );
+ }
+
+ return array;
+}
+
+/*
+ * TestCase constructor
+ *
+ */
+
+function TestCaseDualExpected( n, d, e, a ) {
+ this.name = n;
+ this.description = d;
+ this.expect = e;
+ this.actual = a;
+ this.passed = true;
+ this.reason = "";
+ this.bugnumber = BUGNUMBER;
+
+ this.passed = getTestCaseResultDualExpected( this.expect, this.actual );
+ if ( DEBUG ) {
+ writeLineToLog( "added " + this.description );
+ }
+}
+
+// Added so that either Unicode 4.0 or 5.0 results will be considered correct.
+function writeTestCaseResultDualExpected( expect, actual, string ) {
+ var passed = getTestCaseResultDualExpected( expect, actual );
+ writeFormattedResult( expect[1].lower, actual, string, passed );
+ return passed;
+}
+/*
+ * Added so that either Unicode 4.0 or 5.0 results will be considered correct.
+ * Compare expected result to the actual result and figure out whether
+ * the test case passed.
+ */
+function getTestCaseResultDualExpected( expect, actual ) {
+ expectedU4 = expect[0].lower;
+ expectedU5 = expect[1].lower;
+ // because ( NaN == NaN ) always returns false, need to do
+ // a special compare to see if we got the right result.
+ if ( actual != actual ) {
+ if ( typeof actual == "object" ) {
+ actual = "NaN object";
+ } else {
+ actual = "NaN number";
+ }
+ }
+
+ if ( expectedU4 != expectedU4 ) {
+ if ( typeof expectedU4 == "object" ) {
+ expectedU4 = "NaN object";
+ } else {
+ expectedU4 = "NaN number";
+ }
+ }
+ if ( expectedU5 != expectedU5 ) {
+ if ( typeof expectedU5 == "object" ) {
+ expectedU5 = "NaN object";
+ } else {
+ expectedU5 = "NaN number";
+ }
+ }
+
+ var passed = ( expectedU4 == actual || expectedU5 == actual ) ? true : false;
+
+ // if both objects are numbers
+ // need to replace w/ IEEE standard for rounding
+ if ( !passed &&
+ typeof(actual) == "number" &&
+ (typeof(expectedU4) == "number" ||
+ typeof(expectedU5) == "number")) {
+ if (( Math.abs(actual-expectedU4) < 0.0000001 ) || ( Math.abs(actual-expectedU5) < 0.0000001 )) {
+ passed = true;
+ }
+ }
+
+ // verify type is the same
+ if ( typeof(expectedU4) != typeof(actual) && typeof(expectedU5) != typeof(actual) ) {
+ passed = false;
+ }
+
+ return passed;
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResultDualExpected(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
+function MyObject( value ) {
+ this.value = value;
+ this.substring = String.prototype.substring;
+ this.toString = new Function ( "return this.value+''" );
+}
+
+function Unicode( c, version ) {
+ u = GetUnicodeValues( c, version );
+ this.upper = u[0];
+ this.lower = u[1]
+ return this;
+}
+
+function GetUnicodeValues( c, version ) {
+ u = new Array();
+
+ u[0] = c;
+ u[1] = c;
+
+ // upper case Basic Latin
+
+ if ( c >= 0x0041 && c <= 0x005A) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ // lower case Basic Latin
+ if ( c >= 0x0061 && c <= 0x007a ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+
+ // upper case Latin-1 Supplement
+ if ( c == 0x00B5 ) {
+ u[0] = c;
+ u[1] = 0x039C;
+ return u;
+ }
+ if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ // lower case Latin-1 Supplement
+ if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+ if ( c == 0x00FF ) {
+ u[0] = 0x0178;
+ u[1] = c;
+ return u;
+ }
+ // Latin Extended A
+ if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) {
+ // special case for capital I
+ if ( c == 0x0130 ) {
+ u[0] = c;
+ u[1] = 0x0069;
+ return u;
+ }
+ if ( c == 0x0131 ) {
+ u[0] = 0x0049;
+ u[1] = c;
+ return u;
+ }
+
+ if ( c % 2 == 0 ) {
+ // if it's even, it's a capital and the lower case is c +1
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ // if it's odd, it's a lower case and upper case is c-1
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+ if ( c == 0x0178 ) {
+ u[0] = c;
+ u[1] = 0x00FF;
+ return u;
+ }
+
+ if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) {
+ if ( c % 2 == 1 ) {
+ // if it's odd, it's a capital and the lower case is c +1
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ // if it's even, it's a lower case and upper case is c-1
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+ if ( c == 0x017F ) {
+ u[0] = 0x0053;
+ u[1] = c;
+ }
+
+ // Latin Extended B
+ // need to improve this set
+
+ if ( c >= 0x0200 && c <= 0x0217 ) {
+ if ( c % 2 == 0 ) {
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+
+ // Latin Extended Additional
+ // Range: U+1E00 to U+1EFF
+ // http://www.unicode.org/Unicode.charts/glyphless/U1E00.html
+
+ // Spacing Modifier Leters
+ // Range: U+02B0 to U+02FF
+
+ // Combining Diacritical Marks
+ // Range: U+0300 to U+036F
+
+ // skip Greek for now
+ // Greek
+ // Range: U+0370 to U+03FF
+
+ // Cyrillic
+ // Range: U+0400 to U+04FF
+
+ if ( c >= 0x0400 && c <= 0x040F) {
+ u[0] = c;
+ u[1] = c + 80;
+ return u;
+ }
+
+
+ if ( c >= 0x0410 && c <= 0x042F ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ if ( c >= 0x0430 && c<= 0x044F ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+
+ }
+ if ( c >= 0x0450 && c<= 0x045F ) {
+ u[0] = c -80;
+ u[1] = c;
+ return u;
+ }
+
+ if ( c >= 0x0460 && c <= 0x047F ) {
+ if ( c % 2 == 0 ) {
+ u[0] = c;
+ u[1] = c +1;
+ } else {
+ u[0] = c - 1;
+ u[1] = c;
+ }
+ return u;
+ }
+
+ // Armenian
+ // Range: U+0530 to U+058F
+ if ( c >= 0x0531 && c <= 0x0556 ) {
+ u[0] = c;
+ u[1] = c + 48;
+ return u;
+ }
+ if ( c >= 0x0561 && c < 0x0587 ) {
+ u[0] = c - 48;
+ u[1] = c;
+ return u;
+ }
+
+ // Hebrew
+ // Range: U+0590 to U+05FF
+
+
+ // Arabic
+ // Range: U+0600 to U+06FF
+
+ // Devanagari
+ // Range: U+0900 to U+097F
+
+
+ // Bengali
+ // Range: U+0980 to U+09FF
+
+
+ // Gurmukhi
+ // Range: U+0A00 to U+0A7F
+
+
+ // Gujarati
+ // Range: U+0A80 to U+0AFF
+
+
+ // Oriya
+ // Range: U+0B00 to U+0B7F
+ // no capital / lower case
+
+
+ // Tamil
+ // Range: U+0B80 to U+0BFF
+ // no capital / lower case
+
+
+ // Telugu
+ // Range: U+0C00 to U+0C7F
+ // no capital / lower case
+
+
+ // Kannada
+ // Range: U+0C80 to U+0CFF
+ // no capital / lower case
+
+
+ // Malayalam
+ // Range: U+0D00 to U+0D7F
+
+ // Thai
+ // Range: U+0E00 to U+0E7F
+
+
+ // Lao
+ // Range: U+0E80 to U+0EFF
+
+
+ // Tibetan
+ // Range: U+0F00 to U+0FBF
+
+ // Georgian
+ // Range: U+10A0 to U+10F0
+ if ( version == 5 ) {
+ if ( c >= 0x10A0 && c <= 0x10C5 ) {
+ u[0] = c;
+ u[1] = c + 7264; //48;
+ return u;
+ }
+ if ( c >= 0x2D00 && c <= 0x2D25 ) {
+ u[0] = c;
+ u[1] = c;
+ return u;
+ }
+ }
+
+ // Hangul Jamo
+ // Range: U+1100 to U+11FF
+
+ // Greek Extended
+ // Range: U+1F00 to U+1FFF
+ // skip for now
+
+
+ // General Punctuation
+ // Range: U+2000 to U+206F
+
+ // Superscripts and Subscripts
+ // Range: U+2070 to U+209F
+
+ // Currency Symbols
+ // Range: U+20A0 to U+20CF
+
+
+ // Combining Diacritical Marks for Symbols
+ // Range: U+20D0 to U+20FF
+ // skip for now
+
+
+ // Number Forms
+ // Range: U+2150 to U+218F
+ // skip for now
+
+
+ // Arrows
+ // Range: U+2190 to U+21FF
+
+ // Mathematical Operators
+ // Range: U+2200 to U+22FF
+
+ // Miscellaneous Technical
+ // Range: U+2300 to U+23FF
+
+ // Control Pictures
+ // Range: U+2400 to U+243F
+
+ // Optical Character Recognition
+ // Range: U+2440 to U+245F
+
+ // Enclosed Alphanumerics
+ // Range: U+2460 to U+24FF
+
+ // Box Drawing
+ // Range: U+2500 to U+257F
+
+ // Block Elements
+ // Range: U+2580 to U+259F
+
+ // Geometric Shapes
+ // Range: U+25A0 to U+25FF
+
+ // Miscellaneous Symbols
+ // Range: U+2600 to U+26FF
+
+ // Dingbats
+ // Range: U+2700 to U+27BF
+
+ // CJK Symbols and Punctuation
+ // Range: U+3000 to U+303F
+
+ // Hiragana
+ // Range: U+3040 to U+309F
+
+ // Katakana
+ // Range: U+30A0 to U+30FF
+
+ // Bopomofo
+ // Range: U+3100 to U+312F
+
+ // Hangul Compatibility Jamo
+ // Range: U+3130 to U+318F
+
+ // Kanbun
+ // Range: U+3190 to U+319F
+
+
+ // Enclosed CJK Letters and Months
+ // Range: U+3200 to U+32FF
+
+ // CJK Compatibility
+ // Range: U+3300 to U+33FF
+
+ // Hangul Syllables
+ // Range: U+AC00 to U+D7A3
+
+ // High Surrogates
+ // Range: U+D800 to U+DB7F
+
+ // Private Use High Surrogates
+ // Range: U+DB80 to U+DBFF
+
+ // Low Surrogates
+ // Range: U+DC00 to U+DFFF
+
+ // Private Use Area
+ // Range: U+E000 to U+F8FF
+
+ // CJK Compatibility Ideographs
+ // Range: U+F900 to U+FAFF
+
+ // Alphabetic Presentation Forms
+ // Range: U+FB00 to U+FB4F
+
+ // Arabic Presentation Forms-A
+ // Range: U+FB50 to U+FDFF
+
+ // Combining Half Marks
+ // Range: U+FE20 to U+FE2F
+
+ // CJK Compatibility Forms
+ // Range: U+FE30 to U+FE4F
+
+ // Small Form Variants
+ // Range: U+FE50 to U+FE6F
+
+ // Arabic Presentation Forms-B
+ // Range: U+FE70 to U+FEFF
+
+ // Halfwidth and Fullwidth Forms
+ // Range: U+FF00 to U+FFEF
+
+ if ( c >= 0xFF21 && c <= 0xFF3A ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ if ( c >= 0xFF41 && c <= 0xFF5A ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+
+ // Specials
+ // Range: U+FFF0 to U+FFFF
+
+ return u;
+}
+
+function DecimalToHexString( n ) {
+ n = Number( n );
+ var h = "0x";
+
+ for ( var i = 3; i >= 0; i-- ) {
+ if ( n >= Math.pow(16, i) ){
+ var t = Math.floor( n / Math.pow(16, i));
+ n -= t * Math.pow(16, i);
+ if ( t >= 10 ) {
+ if ( t == 10 ) {
+ h += "A";
+ }
+ if ( t == 11 ) {
+ h += "B";
+ }
+ if ( t == 12 ) {
+ h += "C";
+ }
+ if ( t == 13 ) {
+ h += "D";
+ }
+ if ( t == 14 ) {
+ h += "E";
+ }
+ if ( t == 15 ) {
+ h += "F";
+ }
+ } else {
+ h += String( t );
+ }
+ } else {
+ h += "0";
+ }
+ }
+
+ return h;
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.11-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.11-3.js
new file mode 100644
index 0000000..b718188
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.11-3.js
@@ -0,0 +1,509 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.5.4.11-2.js
+ ECMA Section: 15.5.4.11 String.prototype.toLowerCase()
+ Description:
+
+ Returns a string equal in length to the length of the result of converting
+ this object to a string. The result is a string value, not a String object.
+
+ Every character of the result is equal to the corresponding character of the
+ string, unless that character has a Unicode 2.0 uppercase equivalent, in which
+ case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case
+ mapping shall be used, which does not depend on implementation or locale.)
+
+ Note that the toLowerCase function is intentionally generic; it does not require
+ that its this value be a String object. Therefore it can be transferred to other
+ kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.5.4.11-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "String.prototype.toLowerCase()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ // Halfwidth and Fullwidth Forms
+ // Range: U+FF00 to U+FFEF
+ for ( var i = 0xFF00; i <= 0xFFEF; i++ ) {
+ var U = new Unicode(i);
+/*
+ array[item++] = new TestCase( SECTION,
+ "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()",
+ String.fromCharCode(U.lower),
+ eval("var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()") );
+*/
+ array[item++] = new TestCase( SECTION,
+ "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase().charCodeAt(0)",
+ U.lower,
+ eval("var s = new String( String.fromCharCode(i) ); s.toLowerCase().charCodeAt(0)") );
+ }
+
+ return array;
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function MyObject( value ) {
+ this.value = value;
+ this.substring = String.prototype.substring;
+ this.toString = new Function ( "return this.value+''" );
+}
+function Unicode( c ) {
+ u = GetUnicodeValues( c );
+ this.upper = u[0];
+ this.lower = u[1]
+ return this;
+}
+function GetUnicodeValues( c ) {
+ u = new Array();
+
+ u[0] = c;
+ u[1] = c;
+
+ // upper case Basic Latin
+
+ if ( c >= 0x0041 && c <= 0x005A) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ // lower case Basic Latin
+ if ( c >= 0x0061 && c <= 0x007a ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+
+ // upper case Latin-1 Supplement
+ if ( c == 0x00B5 ) {
+ u[0] = c;
+ u[1] = 0x039C;
+ return u;
+ }
+ if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ // lower case Latin-1 Supplement
+ if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+ if ( c == 0x00FF ) {
+ u[0] = 0x0178;
+ u[1] = c;
+ return u;
+ }
+ // Latin Extended A
+ if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) {
+ // special case for capital I
+ if ( c == 0x0130 ) {
+ u[0] = c;
+ u[1] = 0x0069;
+ return u;
+ }
+ if ( c == 0x0131 ) {
+ u[0] = 0x0049;
+ u[1] = c;
+ return u;
+ }
+
+ if ( c % 2 == 0 ) {
+ // if it's even, it's a capital and the lower case is c +1
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ // if it's odd, it's a lower case and upper case is c-1
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+ if ( c == 0x0178 ) {
+ u[0] = c;
+ u[1] = 0x00FF;
+ return u;
+ }
+
+ if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) {
+ if ( c % 2 == 1 ) {
+ // if it's odd, it's a capital and the lower case is c +1
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ // if it's even, it's a lower case and upper case is c-1
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+ if ( c == 0x017F ) {
+ u[0] = 0x0053;
+ u[1] = c;
+ }
+
+ // Latin Extended B
+ // need to improve this set
+
+ if ( c >= 0x0200 && c <= 0x0217 ) {
+ if ( c % 2 == 0 ) {
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+
+ // Latin Extended Additional
+ // Range: U+1E00 to U+1EFF
+ // http://www.unicode.org/Unicode.charts/glyphless/U1E00.html
+
+ // Spacing Modifier Leters
+ // Range: U+02B0 to U+02FF
+
+ // Combining Diacritical Marks
+ // Range: U+0300 to U+036F
+
+ // skip Greek for now
+ // Greek
+ // Range: U+0370 to U+03FF
+
+ // Cyrillic
+ // Range: U+0400 to U+04FF
+
+ if ( c >= 0x0400 && c <= 0x040F) {
+ u[0] = c;
+ u[1] = c + 80;
+ return u;
+ }
+
+
+ if ( c >= 0x0410 && c <= 0x042F ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ if ( c >= 0x0430 && c<= 0x044F ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+
+ }
+ if ( c >= 0x0450 && c<= 0x045F ) {
+ u[0] = c -80;
+ u[1] = c;
+ return u;
+ }
+
+ if ( c >= 0x0460 && c <= 0x047F ) {
+ if ( c % 2 == 0 ) {
+ u[0] = c;
+ u[1] = c +1;
+ } else {
+ u[0] = c - 1;
+ u[1] = c;
+ }
+ return u;
+ }
+
+ // Armenian
+ // Range: U+0530 to U+058F
+ if ( c >= 0x0531 && c <= 0x0556 ) {
+ u[0] = c;
+ u[1] = c + 48;
+ return u;
+ }
+ if ( c >= 0x0561 && c < 0x0587 ) {
+ u[0] = c - 48;
+ u[1] = c;
+ return u;
+ }
+
+ // Hebrew
+ // Range: U+0590 to U+05FF
+
+
+ // Arabic
+ // Range: U+0600 to U+06FF
+
+ // Devanagari
+ // Range: U+0900 to U+097F
+
+
+ // Bengali
+ // Range: U+0980 to U+09FF
+
+
+ // Gurmukhi
+ // Range: U+0A00 to U+0A7F
+
+
+ // Gujarati
+ // Range: U+0A80 to U+0AFF
+
+
+ // Oriya
+ // Range: U+0B00 to U+0B7F
+ // no capital / lower case
+
+
+ // Tamil
+ // Range: U+0B80 to U+0BFF
+ // no capital / lower case
+
+
+ // Telugu
+ // Range: U+0C00 to U+0C7F
+ // no capital / lower case
+
+
+ // Kannada
+ // Range: U+0C80 to U+0CFF
+ // no capital / lower case
+
+
+ // Malayalam
+ // Range: U+0D00 to U+0D7F
+
+ // Thai
+ // Range: U+0E00 to U+0E7F
+
+
+ // Lao
+ // Range: U+0E80 to U+0EFF
+
+
+ // Tibetan
+ // Range: U+0F00 to U+0FBF
+
+ // Georgian
+ // Range: U+10A0 to U+10F0
+
+ // Hangul Jamo
+ // Range: U+1100 to U+11FF
+
+ // Greek Extended
+ // Range: U+1F00 to U+1FFF
+ // skip for now
+
+
+ // General Punctuation
+ // Range: U+2000 to U+206F
+
+ // Superscripts and Subscripts
+ // Range: U+2070 to U+209F
+
+ // Currency Symbols
+ // Range: U+20A0 to U+20CF
+
+
+ // Combining Diacritical Marks for Symbols
+ // Range: U+20D0 to U+20FF
+ // skip for now
+
+
+ // Number Forms
+ // Range: U+2150 to U+218F
+ // skip for now
+
+
+ // Arrows
+ // Range: U+2190 to U+21FF
+
+ // Mathematical Operators
+ // Range: U+2200 to U+22FF
+
+ // Miscellaneous Technical
+ // Range: U+2300 to U+23FF
+
+ // Control Pictures
+ // Range: U+2400 to U+243F
+
+ // Optical Character Recognition
+ // Range: U+2440 to U+245F
+
+ // Enclosed Alphanumerics
+ // Range: U+2460 to U+24FF
+
+ // Box Drawing
+ // Range: U+2500 to U+257F
+
+ // Block Elements
+ // Range: U+2580 to U+259F
+
+ // Geometric Shapes
+ // Range: U+25A0 to U+25FF
+
+ // Miscellaneous Symbols
+ // Range: U+2600 to U+26FF
+
+ // Dingbats
+ // Range: U+2700 to U+27BF
+
+ // CJK Symbols and Punctuation
+ // Range: U+3000 to U+303F
+
+ // Hiragana
+ // Range: U+3040 to U+309F
+
+ // Katakana
+ // Range: U+30A0 to U+30FF
+
+ // Bopomofo
+ // Range: U+3100 to U+312F
+
+ // Hangul Compatibility Jamo
+ // Range: U+3130 to U+318F
+
+ // Kanbun
+ // Range: U+3190 to U+319F
+
+
+ // Enclosed CJK Letters and Months
+ // Range: U+3200 to U+32FF
+
+ // CJK Compatibility
+ // Range: U+3300 to U+33FF
+
+ // Hangul Syllables
+ // Range: U+AC00 to U+D7A3
+
+ // High Surrogates
+ // Range: U+D800 to U+DB7F
+
+ // Private Use High Surrogates
+ // Range: U+DB80 to U+DBFF
+
+ // Low Surrogates
+ // Range: U+DC00 to U+DFFF
+
+ // Private Use Area
+ // Range: U+E000 to U+F8FF
+
+ // CJK Compatibility Ideographs
+ // Range: U+F900 to U+FAFF
+
+ // Alphabetic Presentation Forms
+ // Range: U+FB00 to U+FB4F
+
+ // Arabic Presentation Forms-A
+ // Range: U+FB50 to U+FDFF
+
+ // Combining Half Marks
+ // Range: U+FE20 to U+FE2F
+
+ // CJK Compatibility Forms
+ // Range: U+FE30 to U+FE4F
+
+ // Small Form Variants
+ // Range: U+FE50 to U+FE6F
+
+ // Arabic Presentation Forms-B
+ // Range: U+FE70 to U+FEFF
+
+ // Halfwidth and Fullwidth Forms
+ // Range: U+FF00 to U+FFEF
+
+ if ( c >= 0xFF21 && c <= 0xFF3A ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ if ( c >= 0xFF41 && c <= 0xFF5A ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+
+ // Specials
+ // Range: U+FFF0 to U+FFFF
+
+ return u;
+}
+
+function DecimalToHexString( n ) {
+ n = Number( n );
+ var h = "0x";
+
+ for ( var i = 3; i >= 0; i-- ) {
+ if ( n >= Math.pow(16, i) ){
+ var t = Math.floor( n / Math.pow(16, i));
+ n -= t * Math.pow(16, i);
+ if ( t >= 10 ) {
+ if ( t == 10 ) {
+ h += "A";
+ }
+ if ( t == 11 ) {
+ h += "B";
+ }
+ if ( t == 12 ) {
+ h += "C";
+ }
+ if ( t == 13 ) {
+ h += "D";
+ }
+ if ( t == 14 ) {
+ h += "E";
+ }
+ if ( t == 15 ) {
+ h += "F";
+ }
+ } else {
+ h += String( t );
+ }
+ } else {
+ h += "0";
+ }
+ }
+
+ return h;
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.11-4.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.11-4.js
new file mode 100644
index 0000000..5258dc2
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.11-4.js
@@ -0,0 +1,508 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.5.4.11-2.js
+ ECMA Section: 15.5.4.11 String.prototype.toLowerCase()
+ Description:
+
+ Returns a string equal in length to the length of the result of converting
+ this object to a string. The result is a string value, not a String object.
+
+ Every character of the result is equal to the corresponding character of the
+ string, unless that character has a Unicode 2.0 uppercase equivalent, in which
+ case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case
+ mapping shall be used, which does not depend on implementation or locale.)
+
+ Note that the toLowerCase function is intentionally generic; it does not require
+ that its this value be a String object. Therefore it can be transferred to other
+ kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.5.4.11-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "String.prototype.toLowerCase()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ // Hiragana (no upper / lower case)
+ // Range: U+3040 to U+309F
+
+ for ( var i = 0x3040; i <= 0x309F; i++ ) {
+ var U = new Unicode( i );
+/*
+ array[item++] = new TestCase( SECTION,
+ "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()",
+ String.fromCharCode(U.lower),
+ eval("var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()") );
+*/
+ array[item++] = new TestCase( SECTION,
+ "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase().charCodeAt(0)",
+ U.lower,
+ eval("var s = new String( String.fromCharCode(i) ); s.toLowerCase().charCodeAt(0)") );
+ }
+
+ return array;
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function MyObject( value ) {
+ this.value = value;
+ this.substring = String.prototype.substring;
+ this.toString = new Function ( "return this.value+''" );
+}
+function Unicode( c ) {
+ this.upper = c;
+ this.lower = c;
+
+ // upper case Basic Latin
+
+ if ( c >= 0x0041 && c <= 0x005A) {
+ this.upper = c;
+ this.lower = c + 32;
+ return this;
+ }
+
+ // lower case Basic Latin
+ if ( c >= 0x0061 && c <= 0x007a ) {
+ this.upper = c - 32;
+ this.lower = c;
+ return this;
+ }
+
+ // upper case Latin-1 Supplement
+ if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) {
+ this.upper = c;
+ this.lower = c + 32;
+ return this;
+ }
+
+ // lower case Latin-1 Supplement
+ if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) {
+ this.upper = c - 32;
+ this.lower = c;
+ return this;
+ }
+ if ( c == 0x00FF ) {
+ this.upper = 0x0178;
+ this.lower = c;
+ return this;
+ }
+ // Latin Extended A
+ if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) {
+ // special case for capital I
+ if ( c == 0x0130 ) {
+ this.upper = c;
+ this.lower = 0x0069;
+ return this;
+ }
+ if ( c == 0x0131 ) {
+ this.upper = 0x0049;
+ this.lower = c;
+ return this;
+ }
+
+ if ( c % 2 == 0 ) {
+ // if it's even, it's a capital and the lower case is c +1
+ this.upper = c;
+ this.lower = c+1;
+ } else {
+ // if it's odd, it's a lower case and upper case is c-1
+ this.upper = c-1;
+ this.lower = c;
+ }
+ return this;
+ }
+ if ( c == 0x0178 ) {
+ this.upper = c;
+ this.lower = 0x00FF;
+ return this;
+ }
+
+ if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) {
+ if ( c % 2 == 1 ) {
+ // if it's odd, it's a capital and the lower case is c +1
+ this.upper = c;
+ this.lower = c+1;
+ } else {
+ // if it's even, it's a lower case and upper case is c-1
+ this.upper = c-1;
+ this.lower = c;
+ }
+ return this;
+ }
+ if ( c == 0x017F ) {
+ this.upper = 0x0053;
+ this.lower = c;
+ }
+
+ // Latin Extended B
+ // need to improve this set
+
+ if ( c >= 0x0200 && c <= 0x0217 ) {
+ if ( c % 2 == 0 ) {
+ this.upper = c;
+ this.lower = c+1;
+ } else {
+ this.upper = c-1;
+ this.lower = c;
+ }
+ return this;
+ }
+
+ // Latin Extended Additional
+ // Range: U+1E00 to U+1EFF
+ // http://www.unicode.org/Unicode.charts/glyphless/U1E00.html
+
+ // Spacing Modifier Leters
+ // Range: U+02B0 to U+02FF
+
+ // Combining Diacritical Marks
+ // Range: U+0300 to U+036F
+
+ // skip Greek for now
+ // Greek
+ // Range: U+0370 to U+03FF
+
+ // Cyrillic
+ // Range: U+0400 to U+04FF
+
+ if ( (c >= 0x0401 && c <= 0x040C) || ( c>= 0x040E && c <= 0x040F ) ) {
+ this.upper = c;
+ this.lower = c + 80;
+ return this;
+ }
+
+
+ if ( c >= 0x0410 && c <= 0x042F ) {
+ this.upper = c;
+ this.lower = c + 32;
+ return this;
+ }
+
+ if ( c >= 0x0430 && c<= 0x044F ) {
+ this.upper = c - 32;
+ this.lower = c;
+ return this;
+
+ }
+ if ( (c >= 0x0451 && c <= 0x045C) || (c >=0x045E && c<= 0x045F) ) {
+ this.upper = c -80;
+ this.lower = c;
+ return this;
+ }
+
+ if ( c >= 0x0460 && c <= 0x047F ) {
+ if ( c % 2 == 0 ) {
+ this.upper = c;
+ this.lower = c +1;
+ } else {
+ this.upper = c - 1;
+ this.lower = c;
+ }
+ return this;
+ }
+
+ // Armenian
+ // Range: U+0530 to U+058F
+ if ( c >= 0x0531 && c <= 0x0556 ) {
+ this.upper = c;
+ this.lower = c + 48;
+ return this;
+ }
+ if ( c >= 0x0561 && c < 0x0587 ) {
+ this.upper = c - 48;
+ this.lower = c;
+ return this;
+ }
+
+ // Hebrew
+ // Range: U+0590 to U+05FF
+
+
+ // Arabic
+ // Range: U+0600 to U+06FF
+
+ // Devanagari
+ // Range: U+0900 to U+097F
+
+
+ // Bengali
+ // Range: U+0980 to U+09FF
+
+
+ // Gurmukhi
+ // Range: U+0A00 to U+0A7F
+
+
+ // Gujarati
+ // Range: U+0A80 to U+0AFF
+
+
+ // Oriya
+ // Range: U+0B00 to U+0B7F
+ // no capital / lower case
+
+
+ // Tamil
+ // Range: U+0B80 to U+0BFF
+ // no capital / lower case
+
+
+ // Telugu
+ // Range: U+0C00 to U+0C7F
+ // no capital / lower case
+
+
+ // Kannada
+ // Range: U+0C80 to U+0CFF
+ // no capital / lower case
+
+
+ // Malayalam
+ // Range: U+0D00 to U+0D7F
+
+ // Thai
+ // Range: U+0E00 to U+0E7F
+
+
+ // Lao
+ // Range: U+0E80 to U+0EFF
+
+
+ // Tibetan
+ // Range: U+0F00 to U+0FBF
+
+ // Georgian
+ // Range: U+10A0 to U+10F0
+ if ( c >= 0x10A0 && c <= 0x10C5 ) {
+ this.upper = c;
+ this.lower = c + 48;
+ return this;
+ }
+ if ( c >= 0x10D0 && c <= 0x10F5 ) {
+ this.upper = c;
+ this.lower = c;
+ return this;
+ }
+
+ // Hangul Jamo
+ // Range: U+1100 to U+11FF
+
+ // Greek Extended
+ // Range: U+1F00 to U+1FFF
+ // skip for now
+
+
+ // General Punctuation
+ // Range: U+2000 to U+206F
+
+ // Superscripts and Subscripts
+ // Range: U+2070 to U+209F
+
+ // Currency Symbols
+ // Range: U+20A0 to U+20CF
+
+
+ // Combining Diacritical Marks for Symbols
+ // Range: U+20D0 to U+20FF
+ // skip for now
+
+
+ // Number Forms
+ // Range: U+2150 to U+218F
+ // skip for now
+
+
+ // Arrows
+ // Range: U+2190 to U+21FF
+
+ // Mathematical Operators
+ // Range: U+2200 to U+22FF
+
+ // Miscellaneous Technical
+ // Range: U+2300 to U+23FF
+
+ // Control Pictures
+ // Range: U+2400 to U+243F
+
+ // Optical Character Recognition
+ // Range: U+2440 to U+245F
+
+ // Enclosed Alphanumerics
+ // Range: U+2460 to U+24FF
+
+ // Box Drawing
+ // Range: U+2500 to U+257F
+
+ // Block Elements
+ // Range: U+2580 to U+259F
+
+ // Geometric Shapes
+ // Range: U+25A0 to U+25FF
+
+ // Miscellaneous Symbols
+ // Range: U+2600 to U+26FF
+
+ // Dingbats
+ // Range: U+2700 to U+27BF
+
+ // CJK Symbols and Punctuation
+ // Range: U+3000 to U+303F
+
+ // Hiragana
+ // Range: U+3040 to U+309F
+
+ // Katakana
+ // Range: U+30A0 to U+30FF
+
+ // Bopomofo
+ // Range: U+3100 to U+312F
+
+ // Hangul Compatibility Jamo
+ // Range: U+3130 to U+318F
+
+ // Kanbun
+ // Range: U+3190 to U+319F
+
+
+ // Enclosed CJK Letters and Months
+ // Range: U+3200 to U+32FF
+
+ // CJK Compatibility
+ // Range: U+3300 to U+33FF
+
+ // Hangul Syllables
+ // Range: U+AC00 to U+D7A3
+
+ // High Surrogates
+ // Range: U+D800 to U+DB7F
+
+ // Private Use High Surrogates
+ // Range: U+DB80 to U+DBFF
+
+ // Low Surrogates
+ // Range: U+DC00 to U+DFFF
+
+ // Private Use Area
+ // Range: U+E000 to U+F8FF
+
+ // CJK Compatibility Ideographs
+ // Range: U+F900 to U+FAFF
+
+ // Alphabetic Presentation Forms
+ // Range: U+FB00 to U+FB4F
+
+ // Arabic Presentation Forms-A
+ // Range: U+FB50 to U+FDFF
+
+ // Combining Half Marks
+ // Range: U+FE20 to U+FE2F
+
+ // CJK Compatibility Forms
+ // Range: U+FE30 to U+FE4F
+
+ // Small Form Variants
+ // Range: U+FE50 to U+FE6F
+
+ // Arabic Presentation Forms-B
+ // Range: U+FE70 to U+FEFF
+
+ // Halfwidth and Fullwidth Forms
+ // Range: U+FF00 to U+FFEF
+
+ if ( c >= 0xFF21 && c <= 0xFF3A ) {
+ this.upper = c;
+ this.lower = c + 32;
+ return this;
+ }
+
+ if ( c >= 0xFF41 && c <= 0xFF5A ) {
+ this.upper = c - 32;
+ this.lower = c;
+ return this;
+ }
+
+ // Specials
+ // Range: U+FFF0 to U+FFFF
+
+ return this;
+}
+
+function DecimalToHexString( n ) {
+ n = Number( n );
+ var h = "0x";
+
+ for ( var i = 3; i >= 0; i-- ) {
+ if ( n >= Math.pow(16, i) ){
+ var t = Math.floor( n / Math.pow(16, i));
+ n -= t * Math.pow(16, i);
+ if ( t >= 10 ) {
+ if ( t == 10 ) {
+ h += "A";
+ }
+ if ( t == 11 ) {
+ h += "B";
+ }
+ if ( t == 12 ) {
+ h += "C";
+ }
+ if ( t == 13 ) {
+ h += "D";
+ }
+ if ( t == 14 ) {
+ h += "E";
+ }
+ if ( t == 15 ) {
+ h += "F";
+ }
+ } else {
+ h += String( t );
+ }
+ } else {
+ h += "0";
+ }
+ }
+
+ return h;
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.11-5.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.11-5.js
new file mode 100644
index 0000000..4d42091
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.11-5.js
@@ -0,0 +1,514 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.5.4.11-5.js
+ ECMA Section: 15.5.4.11 String.prototype.toLowerCase()
+ Description:
+
+ Returns a string equal in length to the length of the result of converting
+ this object to a string. The result is a string value, not a String object.
+
+ Every character of the result is equal to the corresponding character of the
+ string, unless that character has a Unicode 2.0 uppercase equivalent, in which
+ case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case
+ mapping shall be used, which does not depend on implementation or locale.)
+
+ Note that the toLowerCase function is intentionally generic; it does not require
+ that its this value be a String object. Therefore it can be transferred to other
+ kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.5.4.11-5";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "String.prototype.toLowerCase()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "String.prototype.toLowerCase.length", 0, String.prototype.toLowerCase.length );
+ array[item++] = new TestCase( SECTION, "delete String.prototype.toLowerCase.length", false, delete String.prototype.toLowerCase.length );
+ array[item++] = new TestCase( SECTION, "delete String.prototype.toLowerCase.length; String.prototype.toLowerCase.length", 0, eval("delete String.prototype.toLowerCase.length; String.prototype.toLowerCase.length") );
+
+ // Cyrillic (part)
+ // Range: U+0400 to U+04FF
+ for ( var i = 0x0400; i <= 0x047F; i++ ) {
+ var U = new Unicode( i );
+/*
+ array[item++] = new TestCase( SECTION,
+ "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()",
+ String.fromCharCode(U.lower),
+ eval("var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()") );
+*/
+ array[item++] = new TestCase( SECTION,
+ "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase().charCodeAt(0)",
+ U.lower,
+ eval("var s = new String( String.fromCharCode(i) ); s.toLowerCase().charCodeAt(0)") );
+
+ }
+ return array;
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function MyObject( value ) {
+ this.value = value;
+ this.substring = String.prototype.substring;
+ this.toString = new Function ( "return this.value+''" );
+}
+function Unicode( c ) {
+ u = GetUnicodeValues( c );
+ this.upper = u[0];
+ this.lower = u[1]
+ return this;
+}
+function GetUnicodeValues( c ) {
+ u = new Array();
+
+ u[0] = c;
+ u[1] = c;
+
+ // upper case Basic Latin
+
+ if ( c >= 0x0041 && c <= 0x005A) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ // lower case Basic Latin
+ if ( c >= 0x0061 && c <= 0x007a ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+
+ // upper case Latin-1 Supplement
+ if ( c == 0x00B5 ) {
+ u[0] = c;
+ u[1] = 0x039C;
+ return u;
+ }
+ if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ // lower case Latin-1 Supplement
+ if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+ if ( c == 0x00FF ) {
+ u[0] = 0x0178;
+ u[1] = c;
+ return u;
+ }
+ // Latin Extended A
+ if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) {
+ // special case for capital I
+ if ( c == 0x0130 ) {
+ u[0] = c;
+ u[1] = 0x0069;
+ return u;
+ }
+ if ( c == 0x0131 ) {
+ u[0] = 0x0049;
+ u[1] = c;
+ return u;
+ }
+
+ if ( c % 2 == 0 ) {
+ // if it's even, it's a capital and the lower case is c +1
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ // if it's odd, it's a lower case and upper case is c-1
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+ if ( c == 0x0178 ) {
+ u[0] = c;
+ u[1] = 0x00FF;
+ return u;
+ }
+
+ if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) {
+ if ( c % 2 == 1 ) {
+ // if it's odd, it's a capital and the lower case is c +1
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ // if it's even, it's a lower case and upper case is c-1
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+ if ( c == 0x017F ) {
+ u[0] = 0x0053;
+ u[1] = c;
+ }
+
+ // Latin Extended B
+ // need to improve this set
+
+ if ( c >= 0x0200 && c <= 0x0217 ) {
+ if ( c % 2 == 0 ) {
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+
+ // Latin Extended Additional
+ // Range: U+1E00 to U+1EFF
+ // http://www.unicode.org/Unicode.charts/glyphless/U1E00.html
+
+ // Spacing Modifier Leters
+ // Range: U+02B0 to U+02FF
+
+ // Combining Diacritical Marks
+ // Range: U+0300 to U+036F
+
+ // skip Greek for now
+ // Greek
+ // Range: U+0370 to U+03FF
+
+ // Cyrillic
+ // Range: U+0400 to U+04FF
+
+ if ( c >= 0x0400 && c <= 0x040F) {
+ u[0] = c;
+ u[1] = c + 80;
+ return u;
+ }
+
+
+ if ( c >= 0x0410 && c <= 0x042F ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ if ( c >= 0x0430 && c<= 0x044F ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+
+ }
+ if ( c >= 0x0450 && c<= 0x045F ) {
+ u[0] = c -80;
+ u[1] = c;
+ return u;
+ }
+
+ if ( c >= 0x0460 && c <= 0x047F ) {
+ if ( c % 2 == 0 ) {
+ u[0] = c;
+ u[1] = c +1;
+ } else {
+ u[0] = c - 1;
+ u[1] = c;
+ }
+ return u;
+ }
+
+ // Armenian
+ // Range: U+0530 to U+058F
+ if ( c >= 0x0531 && c <= 0x0556 ) {
+ u[0] = c;
+ u[1] = c + 48;
+ return u;
+ }
+ if ( c >= 0x0561 && c < 0x0587 ) {
+ u[0] = c - 48;
+ u[1] = c;
+ return u;
+ }
+
+ // Hebrew
+ // Range: U+0590 to U+05FF
+
+
+ // Arabic
+ // Range: U+0600 to U+06FF
+
+ // Devanagari
+ // Range: U+0900 to U+097F
+
+
+ // Bengali
+ // Range: U+0980 to U+09FF
+
+
+ // Gurmukhi
+ // Range: U+0A00 to U+0A7F
+
+
+ // Gujarati
+ // Range: U+0A80 to U+0AFF
+
+
+ // Oriya
+ // Range: U+0B00 to U+0B7F
+ // no capital / lower case
+
+
+ // Tamil
+ // Range: U+0B80 to U+0BFF
+ // no capital / lower case
+
+
+ // Telugu
+ // Range: U+0C00 to U+0C7F
+ // no capital / lower case
+
+
+ // Kannada
+ // Range: U+0C80 to U+0CFF
+ // no capital / lower case
+
+
+ // Malayalam
+ // Range: U+0D00 to U+0D7F
+
+ // Thai
+ // Range: U+0E00 to U+0E7F
+
+
+ // Lao
+ // Range: U+0E80 to U+0EFF
+
+
+ // Tibetan
+ // Range: U+0F00 to U+0FBF
+
+ // Georgian
+ // Range: U+10A0 to U+10F0
+
+ // Hangul Jamo
+ // Range: U+1100 to U+11FF
+
+ // Greek Extended
+ // Range: U+1F00 to U+1FFF
+ // skip for now
+
+
+ // General Punctuation
+ // Range: U+2000 to U+206F
+
+ // Superscripts and Subscripts
+ // Range: U+2070 to U+209F
+
+ // Currency Symbols
+ // Range: U+20A0 to U+20CF
+
+
+ // Combining Diacritical Marks for Symbols
+ // Range: U+20D0 to U+20FF
+ // skip for now
+
+
+ // Number Forms
+ // Range: U+2150 to U+218F
+ // skip for now
+
+
+ // Arrows
+ // Range: U+2190 to U+21FF
+
+ // Mathematical Operators
+ // Range: U+2200 to U+22FF
+
+ // Miscellaneous Technical
+ // Range: U+2300 to U+23FF
+
+ // Control Pictures
+ // Range: U+2400 to U+243F
+
+ // Optical Character Recognition
+ // Range: U+2440 to U+245F
+
+ // Enclosed Alphanumerics
+ // Range: U+2460 to U+24FF
+
+ // Box Drawing
+ // Range: U+2500 to U+257F
+
+ // Block Elements
+ // Range: U+2580 to U+259F
+
+ // Geometric Shapes
+ // Range: U+25A0 to U+25FF
+
+ // Miscellaneous Symbols
+ // Range: U+2600 to U+26FF
+
+ // Dingbats
+ // Range: U+2700 to U+27BF
+
+ // CJK Symbols and Punctuation
+ // Range: U+3000 to U+303F
+
+ // Hiragana
+ // Range: U+3040 to U+309F
+
+ // Katakana
+ // Range: U+30A0 to U+30FF
+
+ // Bopomofo
+ // Range: U+3100 to U+312F
+
+ // Hangul Compatibility Jamo
+ // Range: U+3130 to U+318F
+
+ // Kanbun
+ // Range: U+3190 to U+319F
+
+
+ // Enclosed CJK Letters and Months
+ // Range: U+3200 to U+32FF
+
+ // CJK Compatibility
+ // Range: U+3300 to U+33FF
+
+ // Hangul Syllables
+ // Range: U+AC00 to U+D7A3
+
+ // High Surrogates
+ // Range: U+D800 to U+DB7F
+
+ // Private Use High Surrogates
+ // Range: U+DB80 to U+DBFF
+
+ // Low Surrogates
+ // Range: U+DC00 to U+DFFF
+
+ // Private Use Area
+ // Range: U+E000 to U+F8FF
+
+ // CJK Compatibility Ideographs
+ // Range: U+F900 to U+FAFF
+
+ // Alphabetic Presentation Forms
+ // Range: U+FB00 to U+FB4F
+
+ // Arabic Presentation Forms-A
+ // Range: U+FB50 to U+FDFF
+
+ // Combining Half Marks
+ // Range: U+FE20 to U+FE2F
+
+ // CJK Compatibility Forms
+ // Range: U+FE30 to U+FE4F
+
+ // Small Form Variants
+ // Range: U+FE50 to U+FE6F
+
+ // Arabic Presentation Forms-B
+ // Range: U+FE70 to U+FEFF
+
+ // Halfwidth and Fullwidth Forms
+ // Range: U+FF00 to U+FFEF
+
+ if ( c >= 0xFF21 && c <= 0xFF3A ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ if ( c >= 0xFF41 && c <= 0xFF5A ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+
+ // Specials
+ // Range: U+FFF0 to U+FFFF
+
+ return u;
+}
+
+function DecimalToHexString( n ) {
+ n = Number( n );
+ var h = "0x";
+
+ for ( var i = 3; i >= 0; i-- ) {
+ if ( n >= Math.pow(16, i) ){
+ var t = Math.floor( n / Math.pow(16, i));
+ n -= t * Math.pow(16, i);
+ if ( t >= 10 ) {
+ if ( t == 10 ) {
+ h += "A";
+ }
+ if ( t == 11 ) {
+ h += "B";
+ }
+ if ( t == 12 ) {
+ h += "C";
+ }
+ if ( t == 13 ) {
+ h += "D";
+ }
+ if ( t == 14 ) {
+ h += "E";
+ }
+ if ( t == 15 ) {
+ h += "F";
+ }
+ } else {
+ h += String( t );
+ }
+ } else {
+ h += "0";
+ }
+ }
+
+ return h;
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.11-6.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.11-6.js
new file mode 100644
index 0000000..a3282f6
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.11-6.js
@@ -0,0 +1,511 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.5.4.11-6.js
+ ECMA Section: 15.5.4.11 String.prototype.toLowerCase()
+ Description:
+
+ Returns a string equal in length to the length of the result of converting
+ this object to a string. The result is a string value, not a String object.
+
+ Every character of the result is equal to the corresponding character of the
+ string, unless that character has a Unicode 2.0 uppercase equivalent, in which
+ case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case
+ mapping shall be used, which does not depend on implementation or locale.)
+
+ Note that the toLowerCase function is intentionally generic; it does not require
+ that its this value be a String object. Therefore it can be transferred to other
+ kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.5.4.11-6";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "String.prototype.toLowerCase()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ // Armenian
+ // Range: U+0530 to U+058F
+ for ( var i = 0x0530; i <= 0x058F; i++ ) {
+
+ var U = new Unicode( i );
+/*
+ array[item++] = new TestCase( SECTION,
+ "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()",
+ String.fromCharCode(U.lower),
+ eval("var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()") );
+*/
+ array[item++] = new TestCase( SECTION,
+ "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase().charCodeAt(0)",
+ U.lower,
+ eval("var s = new String( String.fromCharCode(i) ); s.toLowerCase().charCodeAt(0)") );
+
+ }
+ return array;
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function MyObject( value ) {
+ this.value = value;
+ this.substring = String.prototype.substring;
+ this.toString = new Function ( "return this.value+''" );
+}
+function Unicode( c ) {
+ u = GetUnicodeValues( c );
+ this.upper = u[0];
+ this.lower = u[1]
+ return this;
+}
+function GetUnicodeValues( c ) {
+ u = new Array();
+
+ u[0] = c;
+ u[1] = c;
+
+ // upper case Basic Latin
+
+ if ( c >= 0x0041 && c <= 0x005A) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ // lower case Basic Latin
+ if ( c >= 0x0061 && c <= 0x007a ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+
+ // upper case Latin-1 Supplement
+ if ( c == 0x00B5 ) {
+ u[0] = c;
+ u[1] = 0x039C;
+ return u;
+ }
+ if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ // lower case Latin-1 Supplement
+ if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+ if ( c == 0x00FF ) {
+ u[0] = 0x0178;
+ u[1] = c;
+ return u;
+ }
+ // Latin Extended A
+ if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) {
+ // special case for capital I
+ if ( c == 0x0130 ) {
+ u[0] = c;
+ u[1] = 0x0069;
+ return u;
+ }
+ if ( c == 0x0131 ) {
+ u[0] = 0x0049;
+ u[1] = c;
+ return u;
+ }
+
+ if ( c % 2 == 0 ) {
+ // if it's even, it's a capital and the lower case is c +1
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ // if it's odd, it's a lower case and upper case is c-1
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+ if ( c == 0x0178 ) {
+ u[0] = c;
+ u[1] = 0x00FF;
+ return u;
+ }
+
+ if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) {
+ if ( c % 2 == 1 ) {
+ // if it's odd, it's a capital and the lower case is c +1
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ // if it's even, it's a lower case and upper case is c-1
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+ if ( c == 0x017F ) {
+ u[0] = 0x0053;
+ u[1] = c;
+ }
+
+ // Latin Extended B
+ // need to improve this set
+
+ if ( c >= 0x0200 && c <= 0x0217 ) {
+ if ( c % 2 == 0 ) {
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+
+ // Latin Extended Additional
+ // Range: U+1E00 to U+1EFF
+ // http://www.unicode.org/Unicode.charts/glyphless/U1E00.html
+
+ // Spacing Modifier Leters
+ // Range: U+02B0 to U+02FF
+
+ // Combining Diacritical Marks
+ // Range: U+0300 to U+036F
+
+ // skip Greek for now
+ // Greek
+ // Range: U+0370 to U+03FF
+
+ // Cyrillic
+ // Range: U+0400 to U+04FF
+
+ if ( c >= 0x0400 && c <= 0x040F) {
+ u[0] = c;
+ u[1] = c + 80;
+ return u;
+ }
+
+
+ if ( c >= 0x0410 && c <= 0x042F ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ if ( c >= 0x0430 && c<= 0x044F ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+
+ }
+ if ( c >= 0x0450 && c<= 0x045F ) {
+ u[0] = c -80;
+ u[1] = c;
+ return u;
+ }
+
+ if ( c >= 0x0460 && c <= 0x047F ) {
+ if ( c % 2 == 0 ) {
+ u[0] = c;
+ u[1] = c +1;
+ } else {
+ u[0] = c - 1;
+ u[1] = c;
+ }
+ return u;
+ }
+
+ // Armenian
+ // Range: U+0530 to U+058F
+ if ( c >= 0x0531 && c <= 0x0556 ) {
+ u[0] = c;
+ u[1] = c + 48;
+ return u;
+ }
+ if ( c >= 0x0561 && c < 0x0587 ) {
+ u[0] = c - 48;
+ u[1] = c;
+ return u;
+ }
+
+ // Hebrew
+ // Range: U+0590 to U+05FF
+
+
+ // Arabic
+ // Range: U+0600 to U+06FF
+
+ // Devanagari
+ // Range: U+0900 to U+097F
+
+
+ // Bengali
+ // Range: U+0980 to U+09FF
+
+
+ // Gurmukhi
+ // Range: U+0A00 to U+0A7F
+
+
+ // Gujarati
+ // Range: U+0A80 to U+0AFF
+
+
+ // Oriya
+ // Range: U+0B00 to U+0B7F
+ // no capital / lower case
+
+
+ // Tamil
+ // Range: U+0B80 to U+0BFF
+ // no capital / lower case
+
+
+ // Telugu
+ // Range: U+0C00 to U+0C7F
+ // no capital / lower case
+
+
+ // Kannada
+ // Range: U+0C80 to U+0CFF
+ // no capital / lower case
+
+
+ // Malayalam
+ // Range: U+0D00 to U+0D7F
+
+ // Thai
+ // Range: U+0E00 to U+0E7F
+
+
+ // Lao
+ // Range: U+0E80 to U+0EFF
+
+
+ // Tibetan
+ // Range: U+0F00 to U+0FBF
+
+ // Georgian
+ // Range: U+10A0 to U+10F0
+
+ // Hangul Jamo
+ // Range: U+1100 to U+11FF
+
+ // Greek Extended
+ // Range: U+1F00 to U+1FFF
+ // skip for now
+
+
+ // General Punctuation
+ // Range: U+2000 to U+206F
+
+ // Superscripts and Subscripts
+ // Range: U+2070 to U+209F
+
+ // Currency Symbols
+ // Range: U+20A0 to U+20CF
+
+
+ // Combining Diacritical Marks for Symbols
+ // Range: U+20D0 to U+20FF
+ // skip for now
+
+
+ // Number Forms
+ // Range: U+2150 to U+218F
+ // skip for now
+
+
+ // Arrows
+ // Range: U+2190 to U+21FF
+
+ // Mathematical Operators
+ // Range: U+2200 to U+22FF
+
+ // Miscellaneous Technical
+ // Range: U+2300 to U+23FF
+
+ // Control Pictures
+ // Range: U+2400 to U+243F
+
+ // Optical Character Recognition
+ // Range: U+2440 to U+245F
+
+ // Enclosed Alphanumerics
+ // Range: U+2460 to U+24FF
+
+ // Box Drawing
+ // Range: U+2500 to U+257F
+
+ // Block Elements
+ // Range: U+2580 to U+259F
+
+ // Geometric Shapes
+ // Range: U+25A0 to U+25FF
+
+ // Miscellaneous Symbols
+ // Range: U+2600 to U+26FF
+
+ // Dingbats
+ // Range: U+2700 to U+27BF
+
+ // CJK Symbols and Punctuation
+ // Range: U+3000 to U+303F
+
+ // Hiragana
+ // Range: U+3040 to U+309F
+
+ // Katakana
+ // Range: U+30A0 to U+30FF
+
+ // Bopomofo
+ // Range: U+3100 to U+312F
+
+ // Hangul Compatibility Jamo
+ // Range: U+3130 to U+318F
+
+ // Kanbun
+ // Range: U+3190 to U+319F
+
+
+ // Enclosed CJK Letters and Months
+ // Range: U+3200 to U+32FF
+
+ // CJK Compatibility
+ // Range: U+3300 to U+33FF
+
+ // Hangul Syllables
+ // Range: U+AC00 to U+D7A3
+
+ // High Surrogates
+ // Range: U+D800 to U+DB7F
+
+ // Private Use High Surrogates
+ // Range: U+DB80 to U+DBFF
+
+ // Low Surrogates
+ // Range: U+DC00 to U+DFFF
+
+ // Private Use Area
+ // Range: U+E000 to U+F8FF
+
+ // CJK Compatibility Ideographs
+ // Range: U+F900 to U+FAFF
+
+ // Alphabetic Presentation Forms
+ // Range: U+FB00 to U+FB4F
+
+ // Arabic Presentation Forms-A
+ // Range: U+FB50 to U+FDFF
+
+ // Combining Half Marks
+ // Range: U+FE20 to U+FE2F
+
+ // CJK Compatibility Forms
+ // Range: U+FE30 to U+FE4F
+
+ // Small Form Variants
+ // Range: U+FE50 to U+FE6F
+
+ // Arabic Presentation Forms-B
+ // Range: U+FE70 to U+FEFF
+
+ // Halfwidth and Fullwidth Forms
+ // Range: U+FF00 to U+FFEF
+
+ if ( c >= 0xFF21 && c <= 0xFF3A ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ if ( c >= 0xFF41 && c <= 0xFF5A ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+
+ // Specials
+ // Range: U+FFF0 to U+FFFF
+
+ return u;
+}
+
+function DecimalToHexString( n ) {
+ n = Number( n );
+ var h = "0x";
+
+ for ( var i = 3; i >= 0; i-- ) {
+ if ( n >= Math.pow(16, i) ){
+ var t = Math.floor( n / Math.pow(16, i));
+ n -= t * Math.pow(16, i);
+ if ( t >= 10 ) {
+ if ( t == 10 ) {
+ h += "A";
+ }
+ if ( t == 11 ) {
+ h += "B";
+ }
+ if ( t == 12 ) {
+ h += "C";
+ }
+ if ( t == 13 ) {
+ h += "D";
+ }
+ if ( t == 14 ) {
+ h += "E";
+ }
+ if ( t == 15 ) {
+ h += "F";
+ }
+ } else {
+ h += String( t );
+ }
+ } else {
+ h += "0";
+ }
+ }
+
+ return h;
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.12-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.12-1.js
new file mode 100644
index 0000000..fb8f0df
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.12-1.js
@@ -0,0 +1,527 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.5.4.12-1.js
+ ECMA Section: 15.5.4.12 String.prototype.toUpperCase()
+ Description:
+
+ Returns a string equal in length to the length of the result of converting
+ this object to a string. The result is a string value, not a String object.
+
+ Every character of the result is equal to the corresponding character of the
+ string, unless that character has a Unicode 2.0 uppercase equivalent, in which
+ case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case
+ mapping shall be used, which does not depend on implementation or locale.)
+
+ Note that the toUpperCase function is intentionally generic; it does not require
+ that its this value be a String object. Therefore it can be transferred to other
+ kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.5.4.12-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "String.prototype.toUpperCase()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "String.prototype.toUpperCase.length", 0, String.prototype.toUpperCase.length );
+ array[item++] = new TestCase( SECTION, "delete String.prototype.toUpperCase.length", false, delete String.prototype.toUpperCase.length );
+ array[item++] = new TestCase( SECTION, "delete String.prototype.toupperCase.length; String.prototype.toupperCase.length", 0, eval("delete String.prototype.toUpperCase.length; String.prototype.toUpperCase.length") );
+
+ // Basic Latin, Latin-1 Supplement, Latin Extended A
+ for ( var i = 0; i <= 0x017f; i++ ) {
+ var U = new Unicode( i );
+
+ // XXX DF fails in java
+
+ if ( i == 0x00DF ) {
+ continue;
+ }
+
+
+ array[item++] = new TestCase( SECTION,
+ "var s = new String( String.fromCharCode("+i+") ); s.toUpperCase().charCodeAt(0)",
+ U.upper,
+ eval("var s = new String( String.fromCharCode(i) ); s.toUpperCase().charCodeAt(0)") );
+ }
+
+ return array;
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function MyObject( value ) {
+ this.value = value;
+ this.substring = String.prototype.substring;
+ this.toString = new Function ( "return this.value+''" );
+}
+function Unicode( c ) {
+ u = GetUnicodeValues( c );
+ this.upper = u[0];
+ this.lower = u[1]
+ return this;
+}
+function GetUnicodeValues( c ) {
+ u = new Array();
+
+ u[0] = c;
+ u[1] = c;
+
+ // upper case Basic Latin
+
+ if ( c >= 0x0041 && c <= 0x005A) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ // lower case Basic Latin
+ if ( c >= 0x0061 && c <= 0x007a ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+
+ // upper case Latin-1 Supplement
+ if ( c == 0x00B5 ) {
+ u[0] = 0x039C;
+ u[1] = c;
+ return u;
+ }
+ if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ // lower case Latin-1 Supplement
+ if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+ if ( c == 0x00FF ) {
+ u[0] = 0x0178;
+ u[1] = c;
+ return u;
+ }
+ // Latin Extended A
+ if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) {
+ // special case for capital I
+ if ( c == 0x0130 ) {
+ u[0] = c;
+ u[1] = 0x0069;
+ return u;
+ }
+ if ( c == 0x0131 ) {
+ u[0] = 0x0049;
+ u[1] = c;
+ return u;
+ }
+
+ if ( c % 2 == 0 ) {
+ // if it's even, it's a capital and the lower case is c +1
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ // if it's odd, it's a lower case and upper case is c-1
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+ if ( c == 0x0178 ) {
+ u[0] = c;
+ u[1] = 0x00FF;
+ return u;
+ }
+
+ // LATIN SMALL LETTER N PRECEDED BY APOSTROPHE, uppercase takes two code points
+ if (c == 0x0149) {
+ u[0] = 0x02bc;
+ u[1] = c;
+ return u;
+ }
+
+ if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) {
+ if ( c % 2 == 1 ) {
+ // if it's odd, it's a capital and the lower case is c +1
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ // if it's even, it's a lower case and upper case is c-1
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+ if ( c == 0x017F ) {
+ u[0] = 0x0053;
+ u[1] = c;
+ }
+
+ // Latin Extended B
+ // need to improve this set
+
+ if ( c >= 0x0200 && c <= 0x0217 ) {
+ if ( c % 2 == 0 ) {
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+
+ // Latin Extended Additional
+ // Range: U+1E00 to U+1EFF
+ // http://www.unicode.org/Unicode.charts/glyphless/U1E00.html
+
+ // Spacing Modifier Leters
+ // Range: U+02B0 to U+02FF
+
+ // Combining Diacritical Marks
+ // Range: U+0300 to U+036F
+
+ // skip Greek for now
+ // Greek
+ // Range: U+0370 to U+03FF
+
+ // Cyrillic
+ // Range: U+0400 to U+04FF
+
+ if ( c >= 0x0400 && c <= 0x040F) {
+ u[0] = c;
+ u[1] = c + 80;
+ return u;
+ }
+
+
+ if ( c >= 0x0410 && c <= 0x042F ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ if ( c >= 0x0430 && c<= 0x044F ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+
+ }
+ if ( c >= 0x0450 && c<= 0x045F ) {
+ u[0] = c -80;
+ u[1] = c;
+ return u;
+ }
+
+ if ( c >= 0x0460 && c <= 0x047F ) {
+ if ( c % 2 == 0 ) {
+ u[0] = c;
+ u[1] = c +1;
+ } else {
+ u[0] = c - 1;
+ u[1] = c;
+ }
+ return u;
+ }
+
+ // Armenian
+ // Range: U+0530 to U+058F
+ if ( c >= 0x0531 && c <= 0x0556 ) {
+ u[0] = c;
+ u[1] = c + 48;
+ return u;
+ }
+ if ( c >= 0x0561 && c < 0x0587 ) {
+ u[0] = c - 48;
+ u[1] = c;
+ return u;
+ }
+ if (c == 0x0587) {
+ u[0] = 0x0535;
+ u[1] = c;
+ return u;
+ }
+
+ // Hebrew
+ // Range: U+0590 to U+05FF
+
+
+ // Arabic
+ // Range: U+0600 to U+06FF
+
+ // Devanagari
+ // Range: U+0900 to U+097F
+
+
+ // Bengali
+ // Range: U+0980 to U+09FF
+
+
+ // Gurmukhi
+ // Range: U+0A00 to U+0A7F
+
+
+ // Gujarati
+ // Range: U+0A80 to U+0AFF
+
+
+ // Oriya
+ // Range: U+0B00 to U+0B7F
+ // no capital / lower case
+
+
+ // Tamil
+ // Range: U+0B80 to U+0BFF
+ // no capital / lower case
+
+
+ // Telugu
+ // Range: U+0C00 to U+0C7F
+ // no capital / lower case
+
+
+ // Kannada
+ // Range: U+0C80 to U+0CFF
+ // no capital / lower case
+
+
+ // Malayalam
+ // Range: U+0D00 to U+0D7F
+
+ // Thai
+ // Range: U+0E00 to U+0E7F
+
+
+ // Lao
+ // Range: U+0E80 to U+0EFF
+
+
+ // Tibetan
+ // Range: U+0F00 to U+0FBF
+
+ // Georgian
+ // Range: U+10A0 to U+10F0
+
+ // Hangul Jamo
+ // Range: U+1100 to U+11FF
+
+ // Greek Extended
+ // Range: U+1F00 to U+1FFF
+ // skip for now
+
+
+ // General Punctuation
+ // Range: U+2000 to U+206F
+
+ // Superscripts and Subscripts
+ // Range: U+2070 to U+209F
+
+ // Currency Symbols
+ // Range: U+20A0 to U+20CF
+
+
+ // Combining Diacritical Marks for Symbols
+ // Range: U+20D0 to U+20FF
+ // skip for now
+
+
+ // Number Forms
+ // Range: U+2150 to U+218F
+ // skip for now
+
+
+ // Arrows
+ // Range: U+2190 to U+21FF
+
+ // Mathematical Operators
+ // Range: U+2200 to U+22FF
+
+ // Miscellaneous Technical
+ // Range: U+2300 to U+23FF
+
+ // Control Pictures
+ // Range: U+2400 to U+243F
+
+ // Optical Character Recognition
+ // Range: U+2440 to U+245F
+
+ // Enclosed Alphanumerics
+ // Range: U+2460 to U+24FF
+
+ // Box Drawing
+ // Range: U+2500 to U+257F
+
+ // Block Elements
+ // Range: U+2580 to U+259F
+
+ // Geometric Shapes
+ // Range: U+25A0 to U+25FF
+
+ // Miscellaneous Symbols
+ // Range: U+2600 to U+26FF
+
+ // Dingbats
+ // Range: U+2700 to U+27BF
+
+ // CJK Symbols and Punctuation
+ // Range: U+3000 to U+303F
+
+ // Hiragana
+ // Range: U+3040 to U+309F
+
+ // Katakana
+ // Range: U+30A0 to U+30FF
+
+ // Bopomofo
+ // Range: U+3100 to U+312F
+
+ // Hangul Compatibility Jamo
+ // Range: U+3130 to U+318F
+
+ // Kanbun
+ // Range: U+3190 to U+319F
+
+
+ // Enclosed CJK Letters and Months
+ // Range: U+3200 to U+32FF
+
+ // CJK Compatibility
+ // Range: U+3300 to U+33FF
+
+ // Hangul Syllables
+ // Range: U+AC00 to U+D7A3
+
+ // High Surrogates
+ // Range: U+D800 to U+DB7F
+
+ // Private Use High Surrogates
+ // Range: U+DB80 to U+DBFF
+
+ // Low Surrogates
+ // Range: U+DC00 to U+DFFF
+
+ // Private Use Area
+ // Range: U+E000 to U+F8FF
+
+ // CJK Compatibility Ideographs
+ // Range: U+F900 to U+FAFF
+
+ // Alphabetic Presentation Forms
+ // Range: U+FB00 to U+FB4F
+
+ // Arabic Presentation Forms-A
+ // Range: U+FB50 to U+FDFF
+
+ // Combining Half Marks
+ // Range: U+FE20 to U+FE2F
+
+ // CJK Compatibility Forms
+ // Range: U+FE30 to U+FE4F
+
+ // Small Form Variants
+ // Range: U+FE50 to U+FE6F
+
+ // Arabic Presentation Forms-B
+ // Range: U+FE70 to U+FEFF
+
+ // Halfwidth and Fullwidth Forms
+ // Range: U+FF00 to U+FFEF
+
+ if ( c >= 0xFF21 && c <= 0xFF3A ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ if ( c >= 0xFF41 && c <= 0xFF5A ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+
+ // Specials
+ // Range: U+FFF0 to U+FFFF
+
+ return u;
+}
+
+function DecimalToHexString( n ) {
+ n = Number( n );
+ var h = "0x";
+
+ for ( var i = 3; i >= 0; i-- ) {
+ if ( n >= Math.pow(16, i) ){
+ var t = Math.floor( n / Math.pow(16, i));
+ n -= t * Math.pow(16, i);
+ if ( t >= 10 ) {
+ if ( t == 10 ) {
+ h += "A";
+ }
+ if ( t == 11 ) {
+ h += "B";
+ }
+ if ( t == 12 ) {
+ h += "C";
+ }
+ if ( t == 13 ) {
+ h += "D";
+ }
+ if ( t == 14 ) {
+ h += "E";
+ }
+ if ( t == 15 ) {
+ h += "F";
+ }
+ } else {
+ h += String( t );
+ }
+ } else {
+ h += "0";
+ }
+ }
+
+ return h;
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.12-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.12-2.js
new file mode 100644
index 0000000..2d8c694
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.12-2.js
@@ -0,0 +1,514 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.5.4.12-2.js
+ ECMA Section: 15.5.4.12 String.prototype.toUpperCase()
+ Description:
+
+ Returns a string equal in length to the length of the result of converting
+ this object to a string. The result is a string value, not a String object.
+
+ Every character of the result is equal to the corresponding character of the
+ string, unless that character has a Unicode 2.0 uppercase equivalent, in which
+ case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case
+ mapping shall be used, which does not depend on implementation or locale.)
+
+ Note that the toUpperCase function is intentionally generic; it does not require
+ that its this value be a String object. Therefore it can be transferred to other
+ kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.5.4.12-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "String.prototype.toUpperCase()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ var TEST_STRING = "";
+ var EXPECT_STRING = "";
+
+ // basic latin test
+
+ for ( var i = 0; i < 0x007A; i++ ) {
+ var u = new Unicode(i);
+ TEST_STRING += String.fromCharCode(i);
+ EXPECT_STRING += String.fromCharCode( u.upper );
+ }
+
+ // don't print out the value of the strings since they contain control
+ // characters that break the driver
+ var isEqual = EXPECT_STRING == (new String( TEST_STRING )).toUpperCase();
+
+ array[item++] = new TestCase( SECTION,
+ "isEqual",
+ true,
+ isEqual);
+ return array;
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function MyObject( value ) {
+ this.value = value;
+ this.substring = String.prototype.substring;
+ this.toString = new Function ( "return this.value+''" );
+}
+function Unicode( c ) {
+ u = GetUnicodeValues( c );
+ this.upper = u[0];
+ this.lower = u[1]
+ return this;
+}
+function GetUnicodeValues( c ) {
+ u = new Array();
+
+ u[0] = c;
+ u[1] = c;
+
+ // upper case Basic Latin
+
+ if ( c >= 0x0041 && c <= 0x005A) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ // lower case Basic Latin
+ if ( c >= 0x0061 && c <= 0x007a ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+
+ // upper case Latin-1 Supplement
+ if ( c == 0x00B5 ) {
+ u[0] = 0x039C;
+ u[1] = c;
+ return u;
+ }
+ if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ // lower case Latin-1 Supplement
+ if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+ if ( c == 0x00FF ) {
+ u[0] = 0x0178;
+ u[1] = c;
+ return u;
+ }
+ // Latin Extended A
+ if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) {
+ // special case for capital I
+ if ( c == 0x0130 ) {
+ u[0] = c;
+ u[1] = 0x0069;
+ return u;
+ }
+ if ( c == 0x0131 ) {
+ u[0] = 0x0049;
+ u[1] = c;
+ return u;
+ }
+
+ if ( c % 2 == 0 ) {
+ // if it's even, it's a capital and the lower case is c +1
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ // if it's odd, it's a lower case and upper case is c-1
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+ if ( c == 0x0178 ) {
+ u[0] = c;
+ u[1] = 0x00FF;
+ return u;
+ }
+
+ if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) {
+ if ( c % 2 == 1 ) {
+ // if it's odd, it's a capital and the lower case is c +1
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ // if it's even, it's a lower case and upper case is c-1
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+ if ( c == 0x017F ) {
+ u[0] = 0x0053;
+ u[1] = c;
+ }
+
+ // Latin Extended B
+ // need to improve this set
+
+ if ( c >= 0x0200 && c <= 0x0217 ) {
+ if ( c % 2 == 0 ) {
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+
+ // Latin Extended Additional
+ // Range: U+1E00 to U+1EFF
+ // http://www.unicode.org/Unicode.charts/glyphless/U1E00.html
+
+ // Spacing Modifier Leters
+ // Range: U+02B0 to U+02FF
+
+ // Combining Diacritical Marks
+ // Range: U+0300 to U+036F
+
+ // skip Greek for now
+ // Greek
+ // Range: U+0370 to U+03FF
+
+ // Cyrillic
+ // Range: U+0400 to U+04FF
+
+ if ( c >= 0x0400 && c <= 0x040F) {
+ u[0] = c;
+ u[1] = c + 80;
+ return u;
+ }
+
+
+ if ( c >= 0x0410 && c <= 0x042F ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ if ( c >= 0x0430 && c<= 0x044F ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+
+ }
+ if ( c >= 0x0450 && c<= 0x045F ) {
+ u[0] = c -80;
+ u[1] = c;
+ return u;
+ }
+
+ if ( c >= 0x0460 && c <= 0x047F ) {
+ if ( c % 2 == 0 ) {
+ u[0] = c;
+ u[1] = c +1;
+ } else {
+ u[0] = c - 1;
+ u[1] = c;
+ }
+ return u;
+ }
+
+ // Armenian
+ // Range: U+0530 to U+058F
+ if ( c >= 0x0531 && c <= 0x0556 ) {
+ u[0] = c;
+ u[1] = c + 48;
+ return u;
+ }
+ if ( c >= 0x0561 && c < 0x0587 ) {
+ u[0] = c - 48;
+ u[1] = c;
+ return u;
+ }
+
+ // Hebrew
+ // Range: U+0590 to U+05FF
+
+
+ // Arabic
+ // Range: U+0600 to U+06FF
+
+ // Devanagari
+ // Range: U+0900 to U+097F
+
+
+ // Bengali
+ // Range: U+0980 to U+09FF
+
+
+ // Gurmukhi
+ // Range: U+0A00 to U+0A7F
+
+
+ // Gujarati
+ // Range: U+0A80 to U+0AFF
+
+
+ // Oriya
+ // Range: U+0B00 to U+0B7F
+ // no capital / lower case
+
+
+ // Tamil
+ // Range: U+0B80 to U+0BFF
+ // no capital / lower case
+
+
+ // Telugu
+ // Range: U+0C00 to U+0C7F
+ // no capital / lower case
+
+
+ // Kannada
+ // Range: U+0C80 to U+0CFF
+ // no capital / lower case
+
+
+ // Malayalam
+ // Range: U+0D00 to U+0D7F
+
+ // Thai
+ // Range: U+0E00 to U+0E7F
+
+
+ // Lao
+ // Range: U+0E80 to U+0EFF
+
+
+ // Tibetan
+ // Range: U+0F00 to U+0FBF
+
+ // Georgian
+ // Range: U+10A0 to U+10F0
+
+ // Hangul Jamo
+ // Range: U+1100 to U+11FF
+
+ // Greek Extended
+ // Range: U+1F00 to U+1FFF
+ // skip for now
+
+
+ // General Punctuation
+ // Range: U+2000 to U+206F
+
+ // Superscripts and Subscripts
+ // Range: U+2070 to U+209F
+
+ // Currency Symbols
+ // Range: U+20A0 to U+20CF
+
+
+ // Combining Diacritical Marks for Symbols
+ // Range: U+20D0 to U+20FF
+ // skip for now
+
+
+ // Number Forms
+ // Range: U+2150 to U+218F
+ // skip for now
+
+
+ // Arrows
+ // Range: U+2190 to U+21FF
+
+ // Mathematical Operators
+ // Range: U+2200 to U+22FF
+
+ // Miscellaneous Technical
+ // Range: U+2300 to U+23FF
+
+ // Control Pictures
+ // Range: U+2400 to U+243F
+
+ // Optical Character Recognition
+ // Range: U+2440 to U+245F
+
+ // Enclosed Alphanumerics
+ // Range: U+2460 to U+24FF
+
+ // Box Drawing
+ // Range: U+2500 to U+257F
+
+ // Block Elements
+ // Range: U+2580 to U+259F
+
+ // Geometric Shapes
+ // Range: U+25A0 to U+25FF
+
+ // Miscellaneous Symbols
+ // Range: U+2600 to U+26FF
+
+ // Dingbats
+ // Range: U+2700 to U+27BF
+
+ // CJK Symbols and Punctuation
+ // Range: U+3000 to U+303F
+
+ // Hiragana
+ // Range: U+3040 to U+309F
+
+ // Katakana
+ // Range: U+30A0 to U+30FF
+
+ // Bopomofo
+ // Range: U+3100 to U+312F
+
+ // Hangul Compatibility Jamo
+ // Range: U+3130 to U+318F
+
+ // Kanbun
+ // Range: U+3190 to U+319F
+
+
+ // Enclosed CJK Letters and Months
+ // Range: U+3200 to U+32FF
+
+ // CJK Compatibility
+ // Range: U+3300 to U+33FF
+
+ // Hangul Syllables
+ // Range: U+AC00 to U+D7A3
+
+ // High Surrogates
+ // Range: U+D800 to U+DB7F
+
+ // Private Use High Surrogates
+ // Range: U+DB80 to U+DBFF
+
+ // Low Surrogates
+ // Range: U+DC00 to U+DFFF
+
+ // Private Use Area
+ // Range: U+E000 to U+F8FF
+
+ // CJK Compatibility Ideographs
+ // Range: U+F900 to U+FAFF
+
+ // Alphabetic Presentation Forms
+ // Range: U+FB00 to U+FB4F
+
+ // Arabic Presentation Forms-A
+ // Range: U+FB50 to U+FDFF
+
+ // Combining Half Marks
+ // Range: U+FE20 to U+FE2F
+
+ // CJK Compatibility Forms
+ // Range: U+FE30 to U+FE4F
+
+ // Small Form Variants
+ // Range: U+FE50 to U+FE6F
+
+ // Arabic Presentation Forms-B
+ // Range: U+FE70 to U+FEFF
+
+ // Halfwidth and Fullwidth Forms
+ // Range: U+FF00 to U+FFEF
+
+ if ( c >= 0xFF21 && c <= 0xFF3A ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ if ( c >= 0xFF41 && c <= 0xFF5A ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+
+ // Specials
+ // Range: U+FFF0 to U+FFFF
+
+ return u;
+}
+
+function DecimalToHexString( n ) {
+ n = Number( n );
+ var h = "0x";
+
+ for ( var i = 3; i >= 0; i-- ) {
+ if ( n >= Math.pow(16, i) ){
+ var t = Math.floor( n / Math.pow(16, i));
+ n -= t * Math.pow(16, i);
+ if ( t >= 10 ) {
+ if ( t == 10 ) {
+ h += "A";
+ }
+ if ( t == 11 ) {
+ h += "B";
+ }
+ if ( t == 12 ) {
+ h += "C";
+ }
+ if ( t == 13 ) {
+ h += "D";
+ }
+ if ( t == 14 ) {
+ h += "E";
+ }
+ if ( t == 15 ) {
+ h += "F";
+ }
+ } else {
+ h += String( t );
+ }
+ } else {
+ h += "0";
+ }
+ }
+
+ return h;
+}
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.12-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.12-3.js
new file mode 100644
index 0000000..1561db5
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.12-3.js
@@ -0,0 +1,556 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.5.4.12-3.js
+ ECMA Section: 15.5.4.12 String.prototype.toUpperCase()
+ Description:
+
+ Returns a string equal in length to the length of the result of converting
+ this object to a string. The result is a string value, not a String object.
+
+ Every character of the result is equal to the corresponding character of the
+ string, unless that character has a Unicode 2.0 uppercase equivalent, in which
+ case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case
+ mapping shall be used, which does not depend on implementation or locale.)
+
+ Note that the toUpperCase function is intentionally generic; it does not require
+ that its this value be a String object. Therefore it can be transferred to other
+ kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.5.4.12-3";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "String.prototype.toUpperCase()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ // Georgian
+ // Range: U+10A0 to U+10FF
+ for ( var i = 0x10A0; i <= 0x10FF; i++ ) {
+ var U = new Unicode( i );
+/*
+ array[item++] = new TestCase( SECTION,
+ "var s = new String( String.fromCharCode("+i+") ); s.toUpperCase()",
+ String.fromCharCode(U.upper),
+ eval("var s = new String( String.fromCharCode("+i+") ); s.toUpperCase()") );
+*/
+ array[item++] = new TestCase( SECTION,
+ "var s = new String( String.fromCharCode("+i+") ); s.toUpperCase().charCodeAt(0)",
+ U.upper,
+ eval("var s = new String( String.fromCharCode(i) ); s.toUpperCase().charCodeAt(0)") );
+
+ }
+
+ // Halfwidth and Fullwidth Forms
+ // Range: U+FF00 to U+FFEF
+ for ( var i = 0xFF00; i <= 0xFFEF; i++ ) {
+ array[item++] = new TestCase( SECTION,
+ "var s = new String( String.fromCharCode("+i+") ); s.toUpperCase()",
+ eval( "var u = new Unicode( i ); String.fromCharCode(u.upper)" ),
+ eval("var s = new String( String.fromCharCode("+i+") ); s.toUpperCase()") );
+
+ array[item++] = new TestCase( SECTION,
+ "var s = new String( String.fromCharCode("+i+") ); s.toUpperCase().charCodeAt(0)",
+ eval( "var u = new Unicode( i ); u.upper" ),
+ eval("var s = new String( String.fromCharCode("+i+") ); s.toUpperCase().charCodeAt(0)") );
+ }
+
+ // Hiragana (no upper / lower case)
+ // Range: U+3040 to U+309F
+
+ for ( var i = 0x3040; i <= 0x309F; i++ ) {
+ array[item++] = new TestCase( SECTION,
+ "var s = new String( String.fromCharCode("+i+") ); s.toUpperCase()",
+ eval( "var u = new Unicode( i ); String.fromCharCode(u.upper)" ),
+ eval("var s = new String( String.fromCharCode("+i+") ); s.toUpperCase()") );
+
+ array[item++] = new TestCase( SECTION,
+ "var s = new String( String.fromCharCode("+i+") ); s.toUpperCase().charCodeAt(0)",
+ eval( "var u = new Unicode( i ); u.upper" ),
+ eval("var s = new String( String.fromCharCode("+i+") ); s.toUpperCase().charCodeAt(0)") );
+ }
+
+
+/*
+ var TEST_STRING = "";
+ var EXPECT_STRING = "";
+
+ // basic latin test
+
+ for ( var i = 0; i < 0x007A; i++ ) {
+ var u = new Unicode(i);
+ TEST_STRING += String.fromCharCode(i);
+ EXPECT_STRING += String.fromCharCode( u.upper );
+ }
+*/
+
+
+
+ return array;
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function MyObject( value ) {
+ this.value = value;
+ this.substring = String.prototype.substring;
+ this.toString = new Function ( "return this.value+''" );
+}
+function Unicode( c ) {
+ u = GetUnicodeValues( c );
+ this.upper = u[0];
+ this.lower = u[1]
+ return this;
+}
+function GetUnicodeValues( c ) {
+ u = new Array();
+
+ u[0] = c;
+ u[1] = c;
+
+ // upper case Basic Latin
+
+ if ( c >= 0x0041 && c <= 0x005A) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ // lower case Basic Latin
+ if ( c >= 0x0061 && c <= 0x007a ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+
+ // upper case Latin-1 Supplement
+ if ( c == 0x00B5 ) {
+ u[0] = 0x039C;
+ u[1] = c;
+ return u;
+ }
+ if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ // lower case Latin-1 Supplement
+ if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+ if ( c == 0x00FF ) {
+ u[0] = 0x0178;
+ u[1] = c;
+ return u;
+ }
+ // Latin Extended A
+ if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) {
+ // special case for capital I
+ if ( c == 0x0130 ) {
+ u[0] = c;
+ u[1] = 0x0069;
+ return u;
+ }
+ if ( c == 0x0131 ) {
+ u[0] = 0x0049;
+ u[1] = c;
+ return u;
+ }
+
+ if ( c % 2 == 0 ) {
+ // if it's even, it's a capital and the lower case is c +1
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ // if it's odd, it's a lower case and upper case is c-1
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+ if ( c == 0x0178 ) {
+ u[0] = c;
+ u[1] = 0x00FF;
+ return u;
+ }
+
+ if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) {
+ if ( c % 2 == 1 ) {
+ // if it's odd, it's a capital and the lower case is c +1
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ // if it's even, it's a lower case and upper case is c-1
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+ if ( c == 0x017F ) {
+ u[0] = 0x0053;
+ u[1] = c;
+ }
+
+ // Latin Extended B
+ // need to improve this set
+
+ if ( c >= 0x0200 && c <= 0x0217 ) {
+ if ( c % 2 == 0 ) {
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+
+ // Latin Extended Additional
+ // Range: U+1E00 to U+1EFF
+ // http://www.unicode.org/Unicode.charts/glyphless/U1E00.html
+
+ // Spacing Modifier Leters
+ // Range: U+02B0 to U+02FF
+
+ // Combining Diacritical Marks
+ // Range: U+0300 to U+036F
+
+ // skip Greek for now
+ // Greek
+ // Range: U+0370 to U+03FF
+
+ // Cyrillic
+ // Range: U+0400 to U+04FF
+
+ if ( c >= 0x0400 && c <= 0x040F) {
+ u[0] = c;
+ u[1] = c + 80;
+ return u;
+ }
+
+
+ if ( c >= 0x0410 && c <= 0x042F ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ if ( c >= 0x0430 && c<= 0x044F ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+
+ }
+ if ( c >= 0x0450 && c<= 0x045F ) {
+ u[0] = c -80;
+ u[1] = c;
+ return u;
+ }
+
+ if ( c >= 0x0460 && c <= 0x047F ) {
+ if ( c % 2 == 0 ) {
+ u[0] = c;
+ u[1] = c +1;
+ } else {
+ u[0] = c - 1;
+ u[1] = c;
+ }
+ return u;
+ }
+
+ // Armenian
+ // Range: U+0530 to U+058F
+ if ( c >= 0x0531 && c <= 0x0556 ) {
+ u[0] = c;
+ u[1] = c + 48;
+ return u;
+ }
+ if ( c >= 0x0561 && c < 0x0587 ) {
+ u[0] = c - 48;
+ u[1] = c;
+ return u;
+ }
+
+ // Hebrew
+ // Range: U+0590 to U+05FF
+
+
+ // Arabic
+ // Range: U+0600 to U+06FF
+
+ // Devanagari
+ // Range: U+0900 to U+097F
+
+
+ // Bengali
+ // Range: U+0980 to U+09FF
+
+
+ // Gurmukhi
+ // Range: U+0A00 to U+0A7F
+
+
+ // Gujarati
+ // Range: U+0A80 to U+0AFF
+
+
+ // Oriya
+ // Range: U+0B00 to U+0B7F
+ // no capital / lower case
+
+
+ // Tamil
+ // Range: U+0B80 to U+0BFF
+ // no capital / lower case
+
+
+ // Telugu
+ // Range: U+0C00 to U+0C7F
+ // no capital / lower case
+
+
+ // Kannada
+ // Range: U+0C80 to U+0CFF
+ // no capital / lower case
+
+
+ // Malayalam
+ // Range: U+0D00 to U+0D7F
+
+ // Thai
+ // Range: U+0E00 to U+0E7F
+
+
+ // Lao
+ // Range: U+0E80 to U+0EFF
+
+
+ // Tibetan
+ // Range: U+0F00 to U+0FBF
+
+ // Georgian
+ // Range: U+10A0 to U+10F0
+
+ // Hangul Jamo
+ // Range: U+1100 to U+11FF
+
+ // Greek Extended
+ // Range: U+1F00 to U+1FFF
+ // skip for now
+
+
+ // General Punctuation
+ // Range: U+2000 to U+206F
+
+ // Superscripts and Subscripts
+ // Range: U+2070 to U+209F
+
+ // Currency Symbols
+ // Range: U+20A0 to U+20CF
+
+
+ // Combining Diacritical Marks for Symbols
+ // Range: U+20D0 to U+20FF
+ // skip for now
+
+
+ // Number Forms
+ // Range: U+2150 to U+218F
+ // skip for now
+
+
+ // Arrows
+ // Range: U+2190 to U+21FF
+
+ // Mathematical Operators
+ // Range: U+2200 to U+22FF
+
+ // Miscellaneous Technical
+ // Range: U+2300 to U+23FF
+
+ // Control Pictures
+ // Range: U+2400 to U+243F
+
+ // Optical Character Recognition
+ // Range: U+2440 to U+245F
+
+ // Enclosed Alphanumerics
+ // Range: U+2460 to U+24FF
+
+ // Box Drawing
+ // Range: U+2500 to U+257F
+
+ // Block Elements
+ // Range: U+2580 to U+259F
+
+ // Geometric Shapes
+ // Range: U+25A0 to U+25FF
+
+ // Miscellaneous Symbols
+ // Range: U+2600 to U+26FF
+
+ // Dingbats
+ // Range: U+2700 to U+27BF
+
+ // CJK Symbols and Punctuation
+ // Range: U+3000 to U+303F
+
+ // Hiragana
+ // Range: U+3040 to U+309F
+
+ // Katakana
+ // Range: U+30A0 to U+30FF
+
+ // Bopomofo
+ // Range: U+3100 to U+312F
+
+ // Hangul Compatibility Jamo
+ // Range: U+3130 to U+318F
+
+ // Kanbun
+ // Range: U+3190 to U+319F
+
+
+ // Enclosed CJK Letters and Months
+ // Range: U+3200 to U+32FF
+
+ // CJK Compatibility
+ // Range: U+3300 to U+33FF
+
+ // Hangul Syllables
+ // Range: U+AC00 to U+D7A3
+
+ // High Surrogates
+ // Range: U+D800 to U+DB7F
+
+ // Private Use High Surrogates
+ // Range: U+DB80 to U+DBFF
+
+ // Low Surrogates
+ // Range: U+DC00 to U+DFFF
+
+ // Private Use Area
+ // Range: U+E000 to U+F8FF
+
+ // CJK Compatibility Ideographs
+ // Range: U+F900 to U+FAFF
+
+ // Alphabetic Presentation Forms
+ // Range: U+FB00 to U+FB4F
+
+ // Arabic Presentation Forms-A
+ // Range: U+FB50 to U+FDFF
+
+ // Combining Half Marks
+ // Range: U+FE20 to U+FE2F
+
+ // CJK Compatibility Forms
+ // Range: U+FE30 to U+FE4F
+
+ // Small Form Variants
+ // Range: U+FE50 to U+FE6F
+
+ // Arabic Presentation Forms-B
+ // Range: U+FE70 to U+FEFF
+
+ // Halfwidth and Fullwidth Forms
+ // Range: U+FF00 to U+FFEF
+
+ if ( c >= 0xFF21 && c <= 0xFF3A ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ if ( c >= 0xFF41 && c <= 0xFF5A ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+
+ // Specials
+ // Range: U+FFF0 to U+FFFF
+
+ return u;
+}
+
+function DecimalToHexString( n ) {
+ n = Number( n );
+ var h = "0x";
+
+ for ( var i = 3; i >= 0; i-- ) {
+ if ( n >= Math.pow(16, i) ){
+ var t = Math.floor( n / Math.pow(16, i));
+ n -= t * Math.pow(16, i);
+ if ( t >= 10 ) {
+ if ( t == 10 ) {
+ h += "A";
+ }
+ if ( t == 11 ) {
+ h += "B";
+ }
+ if ( t == 12 ) {
+ h += "C";
+ }
+ if ( t == 13 ) {
+ h += "D";
+ }
+ if ( t == 14 ) {
+ h += "E";
+ }
+ if ( t == 15 ) {
+ h += "F";
+ }
+ } else {
+ h += String( t );
+ }
+ } else {
+ h += "0";
+ }
+ }
+
+ return h;
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.12-4.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.12-4.js
new file mode 100644
index 0000000..54e365e
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.12-4.js
@@ -0,0 +1,511 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.5.4.12-1.js
+ ECMA Section: 15.5.4.12 String.prototype.toUpperCase()
+ Description:
+
+ Returns a string equal in length to the length of the result of converting
+ this object to a string. The result is a string value, not a String object.
+
+ Every character of the result is equal to the corresponding character of the
+ string, unless that character has a Unicode 2.0 uppercase equivalent, in which
+ case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case
+ mapping shall be used, which does not depend on implementation or locale.)
+
+ Note that the toUpperCase function is intentionally generic; it does not require
+ that its this value be a String object. Therefore it can be transferred to other
+ kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.5.4.12-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "String.prototype.toUpperCase()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ // Cyrillic (part)
+ // Range: U+0400 to U+04FF
+ for ( var i = 0x0400; i <= 0x047F; i++ ) {
+ var U =new Unicode( i );
+/*
+ array[item++] = new TestCase( SECTION,
+ "var s = new String( String.fromCharCode("+i+") ); s.toUpperCase()",
+ U.upper,
+ eval("var s = new String( String.fromCharCode("+i+") ); s.toUpperCase()") );
+*/
+ array[item++] = new TestCase( SECTION,
+ "var s = new String( String.fromCharCode("+i+") ); s.toUpperCase().charCodeAt(0)",
+ U.upper,
+ eval("var s = new String( String.fromCharCode(i) ); s.toUpperCase().charCodeAt(0)") );
+
+ }
+
+ return array;
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function MyObject( value ) {
+ this.value = value;
+ this.substring = String.prototype.substring;
+ this.toString = new Function ( "return this.value+''" );
+}
+function Unicode( c ) {
+ u = GetUnicodeValues( c );
+ this.upper = u[0];
+ this.lower = u[1]
+ return this;
+}
+function GetUnicodeValues( c ) {
+ u = new Array();
+
+ u[0] = c;
+ u[1] = c;
+
+ // upper case Basic Latin
+
+ if ( c >= 0x0041 && c <= 0x005A) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ // lower case Basic Latin
+ if ( c >= 0x0061 && c <= 0x007a ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+
+ // upper case Latin-1 Supplement
+ if ( c == 0x00B5 ) {
+ u[0] = 0x039C;
+ u[1] = c;
+ return u;
+ }
+ if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ // lower case Latin-1 Supplement
+ if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+ if ( c == 0x00FF ) {
+ u[0] = 0x0178;
+ u[1] = c;
+ return u;
+ }
+ // Latin Extended A
+ if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) {
+ // special case for capital I
+ if ( c == 0x0130 ) {
+ u[0] = c;
+ u[1] = 0x0069;
+ return u;
+ }
+ if ( c == 0x0131 ) {
+ u[0] = 0x0049;
+ u[1] = c;
+ return u;
+ }
+
+ if ( c % 2 == 0 ) {
+ // if it's even, it's a capital and the lower case is c +1
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ // if it's odd, it's a lower case and upper case is c-1
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+ if ( c == 0x0178 ) {
+ u[0] = c;
+ u[1] = 0x00FF;
+ return u;
+ }
+
+ if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) {
+ if ( c % 2 == 1 ) {
+ // if it's odd, it's a capital and the lower case is c +1
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ // if it's even, it's a lower case and upper case is c-1
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+ if ( c == 0x017F ) {
+ u[0] = 0x0053;
+ u[1] = c;
+ }
+
+ // Latin Extended B
+ // need to improve this set
+
+ if ( c >= 0x0200 && c <= 0x0217 ) {
+ if ( c % 2 == 0 ) {
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+
+ // Latin Extended Additional
+ // Range: U+1E00 to U+1EFF
+ // http://www.unicode.org/Unicode.charts/glyphless/U1E00.html
+
+ // Spacing Modifier Leters
+ // Range: U+02B0 to U+02FF
+
+ // Combining Diacritical Marks
+ // Range: U+0300 to U+036F
+
+ // skip Greek for now
+ // Greek
+ // Range: U+0370 to U+03FF
+
+ // Cyrillic
+ // Range: U+0400 to U+04FF
+
+ if ( c >= 0x0400 && c <= 0x040F) {
+ u[0] = c;
+ u[1] = c + 80;
+ return u;
+ }
+
+
+ if ( c >= 0x0410 && c <= 0x042F ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ if ( c >= 0x0430 && c<= 0x044F ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+
+ }
+ if ( c >= 0x0450 && c<= 0x045F ) {
+ u[0] = c -80;
+ u[1] = c;
+ return u;
+ }
+
+ if ( c >= 0x0460 && c <= 0x047F ) {
+ if ( c % 2 == 0 ) {
+ u[0] = c;
+ u[1] = c +1;
+ } else {
+ u[0] = c - 1;
+ u[1] = c;
+ }
+ return u;
+ }
+
+ // Armenian
+ // Range: U+0530 to U+058F
+ if ( c >= 0x0531 && c <= 0x0556 ) {
+ u[0] = c;
+ u[1] = c + 48;
+ return u;
+ }
+ if ( c >= 0x0561 && c < 0x0587 ) {
+ u[0] = c - 48;
+ u[1] = c;
+ return u;
+ }
+
+ // Hebrew
+ // Range: U+0590 to U+05FF
+
+
+ // Arabic
+ // Range: U+0600 to U+06FF
+
+ // Devanagari
+ // Range: U+0900 to U+097F
+
+
+ // Bengali
+ // Range: U+0980 to U+09FF
+
+
+ // Gurmukhi
+ // Range: U+0A00 to U+0A7F
+
+
+ // Gujarati
+ // Range: U+0A80 to U+0AFF
+
+
+ // Oriya
+ // Range: U+0B00 to U+0B7F
+ // no capital / lower case
+
+
+ // Tamil
+ // Range: U+0B80 to U+0BFF
+ // no capital / lower case
+
+
+ // Telugu
+ // Range: U+0C00 to U+0C7F
+ // no capital / lower case
+
+
+ // Kannada
+ // Range: U+0C80 to U+0CFF
+ // no capital / lower case
+
+
+ // Malayalam
+ // Range: U+0D00 to U+0D7F
+
+ // Thai
+ // Range: U+0E00 to U+0E7F
+
+
+ // Lao
+ // Range: U+0E80 to U+0EFF
+
+
+ // Tibetan
+ // Range: U+0F00 to U+0FBF
+
+ // Georgian
+ // Range: U+10A0 to U+10F0
+
+ // Hangul Jamo
+ // Range: U+1100 to U+11FF
+
+ // Greek Extended
+ // Range: U+1F00 to U+1FFF
+ // skip for now
+
+
+ // General Punctuation
+ // Range: U+2000 to U+206F
+
+ // Superscripts and Subscripts
+ // Range: U+2070 to U+209F
+
+ // Currency Symbols
+ // Range: U+20A0 to U+20CF
+
+
+ // Combining Diacritical Marks for Symbols
+ // Range: U+20D0 to U+20FF
+ // skip for now
+
+
+ // Number Forms
+ // Range: U+2150 to U+218F
+ // skip for now
+
+
+ // Arrows
+ // Range: U+2190 to U+21FF
+
+ // Mathematical Operators
+ // Range: U+2200 to U+22FF
+
+ // Miscellaneous Technical
+ // Range: U+2300 to U+23FF
+
+ // Control Pictures
+ // Range: U+2400 to U+243F
+
+ // Optical Character Recognition
+ // Range: U+2440 to U+245F
+
+ // Enclosed Alphanumerics
+ // Range: U+2460 to U+24FF
+
+ // Box Drawing
+ // Range: U+2500 to U+257F
+
+ // Block Elements
+ // Range: U+2580 to U+259F
+
+ // Geometric Shapes
+ // Range: U+25A0 to U+25FF
+
+ // Miscellaneous Symbols
+ // Range: U+2600 to U+26FF
+
+ // Dingbats
+ // Range: U+2700 to U+27BF
+
+ // CJK Symbols and Punctuation
+ // Range: U+3000 to U+303F
+
+ // Hiragana
+ // Range: U+3040 to U+309F
+
+ // Katakana
+ // Range: U+30A0 to U+30FF
+
+ // Bopomofo
+ // Range: U+3100 to U+312F
+
+ // Hangul Compatibility Jamo
+ // Range: U+3130 to U+318F
+
+ // Kanbun
+ // Range: U+3190 to U+319F
+
+
+ // Enclosed CJK Letters and Months
+ // Range: U+3200 to U+32FF
+
+ // CJK Compatibility
+ // Range: U+3300 to U+33FF
+
+ // Hangul Syllables
+ // Range: U+AC00 to U+D7A3
+
+ // High Surrogates
+ // Range: U+D800 to U+DB7F
+
+ // Private Use High Surrogates
+ // Range: U+DB80 to U+DBFF
+
+ // Low Surrogates
+ // Range: U+DC00 to U+DFFF
+
+ // Private Use Area
+ // Range: U+E000 to U+F8FF
+
+ // CJK Compatibility Ideographs
+ // Range: U+F900 to U+FAFF
+
+ // Alphabetic Presentation Forms
+ // Range: U+FB00 to U+FB4F
+
+ // Arabic Presentation Forms-A
+ // Range: U+FB50 to U+FDFF
+
+ // Combining Half Marks
+ // Range: U+FE20 to U+FE2F
+
+ // CJK Compatibility Forms
+ // Range: U+FE30 to U+FE4F
+
+ // Small Form Variants
+ // Range: U+FE50 to U+FE6F
+
+ // Arabic Presentation Forms-B
+ // Range: U+FE70 to U+FEFF
+
+ // Halfwidth and Fullwidth Forms
+ // Range: U+FF00 to U+FFEF
+
+ if ( c >= 0xFF21 && c <= 0xFF3A ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ if ( c >= 0xFF41 && c <= 0xFF5A ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+
+ // Specials
+ // Range: U+FFF0 to U+FFFF
+
+ return u;
+}
+
+function DecimalToHexString( n ) {
+ n = Number( n );
+ var h = "0x";
+
+ for ( var i = 3; i >= 0; i-- ) {
+ if ( n >= Math.pow(16, i) ){
+ var t = Math.floor( n / Math.pow(16, i));
+ n -= t * Math.pow(16, i);
+ if ( t >= 10 ) {
+ if ( t == 10 ) {
+ h += "A";
+ }
+ if ( t == 11 ) {
+ h += "B";
+ }
+ if ( t == 12 ) {
+ h += "C";
+ }
+ if ( t == 13 ) {
+ h += "D";
+ }
+ if ( t == 14 ) {
+ h += "E";
+ }
+ if ( t == 15 ) {
+ h += "F";
+ }
+ } else {
+ h += String( t );
+ }
+ } else {
+ h += "0";
+ }
+ }
+
+ return h;
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.12-5.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.12-5.js
new file mode 100644
index 0000000..bbcfad4
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.12-5.js
@@ -0,0 +1,523 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.5.4.12-1.js
+ ECMA Section: 15.5.4.12 String.prototype.toUpperCase()
+ Description:
+
+ Returns a string equal in length to the length of the result of converting
+ this object to a string. The result is a string value, not a String object.
+
+ Every character of the result is equal to the corresponding character of the
+ string, unless that character has a Unicode 2.0 uppercase equivalent, in which
+ case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case
+ mapping shall be used, which does not depend on implementation or locale.)
+
+ Note that the toUpperCase function is intentionally generic; it does not require
+ that its this value be a String object. Therefore it can be transferred to other
+ kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.5.4.12-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "String.prototype.toUpperCase()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ // Armenian
+ // Range: U+0530 to U+058F
+ for ( var i = 0x0530; i <= 0x058F; i++ ) {
+ var U = new Unicode( i );
+/*
+ array[item++] = new TestCase( SECTION,
+ "var s = new String( String.fromCharCode("+i+") ); s.toUpperCase()",
+ String.fromCharCode(U.upper),
+ eval("var s = new String( String.fromCharCode("+i+") ); s.toUpperCase()") );
+*/
+ array[item++] = new TestCase( SECTION,
+ "var s = new String( String.fromCharCode("+i+") ); s.toUpperCase().charCodeAt(0)",
+ U.upper,
+ eval("var s = new String( String.fromCharCode(i) ); s.toUpperCase().charCodeAt(0)") );
+
+ }
+
+ return array;
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function MyObject( value ) {
+ this.value = value;
+ this.substring = String.prototype.substring;
+ this.toString = new Function ( "return this.value+''" );
+}
+function Unicode( c ) {
+ u = GetUnicodeValues( c );
+ this.upper = u[0];
+ this.lower = u[1]
+ return this;
+}
+function GetUnicodeValues( c ) {
+ u = new Array();
+
+ u[0] = c;
+ u[1] = c;
+
+ // upper case Basic Latin
+
+ if ( c >= 0x0041 && c <= 0x005A) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ // lower case Basic Latin
+ if ( c >= 0x0061 && c <= 0x007a ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+
+ // upper case Latin-1 Supplement
+ if ( c == 0x00B5 ) {
+ u[0] = 0x039C;
+ u[1] = c;
+ return u;
+ }
+ if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ // lower case Latin-1 Supplement
+ if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+ if ( c == 0x00FF ) {
+ u[0] = 0x0178;
+ u[1] = c;
+ return u;
+ }
+ // Latin Extended A
+ if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) {
+ // special case for capital I
+ if ( c == 0x0130 ) {
+ u[0] = c;
+ u[1] = 0x0069;
+ return u;
+ }
+ if ( c == 0x0131 ) {
+ u[0] = 0x0049;
+ u[1] = c;
+ return u;
+ }
+
+ if ( c % 2 == 0 ) {
+ // if it's even, it's a capital and the lower case is c +1
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ // if it's odd, it's a lower case and upper case is c-1
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+ if ( c == 0x0178 ) {
+ u[0] = c;
+ u[1] = 0x00FF;
+ return u;
+ }
+
+ // LATIN SMALL LETTER N PRECEDED BY APOSTROPHE, uppercase takes two code points
+ if (c == 0x0149) {
+ u[0] = 0x02bc;
+ u[1] = c;
+ return u;
+ }
+
+ if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) {
+ if ( c % 2 == 1 ) {
+ // if it's odd, it's a capital and the lower case is c +1
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ // if it's even, it's a lower case and upper case is c-1
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+ if ( c == 0x017F ) {
+ u[0] = 0x0053;
+ u[1] = c;
+ }
+
+ // Latin Extended B
+ // need to improve this set
+
+ if ( c >= 0x0200 && c <= 0x0217 ) {
+ if ( c % 2 == 0 ) {
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+
+ // Latin Extended Additional
+ // Range: U+1E00 to U+1EFF
+ // http://www.unicode.org/Unicode.charts/glyphless/U1E00.html
+
+ // Spacing Modifier Leters
+ // Range: U+02B0 to U+02FF
+
+ // Combining Diacritical Marks
+ // Range: U+0300 to U+036F
+
+ // skip Greek for now
+ // Greek
+ // Range: U+0370 to U+03FF
+
+ // Cyrillic
+ // Range: U+0400 to U+04FF
+
+ if ( c >= 0x0400 && c <= 0x040F) {
+ u[0] = c;
+ u[1] = c + 80;
+ return u;
+ }
+
+
+ if ( c >= 0x0410 && c <= 0x042F ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ if ( c >= 0x0430 && c<= 0x044F ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+
+ }
+ if ( c >= 0x0450 && c<= 0x045F ) {
+ u[0] = c -80;
+ u[1] = c;
+ return u;
+ }
+
+ if ( c >= 0x0460 && c <= 0x047F ) {
+ if ( c % 2 == 0 ) {
+ u[0] = c;
+ u[1] = c +1;
+ } else {
+ u[0] = c - 1;
+ u[1] = c;
+ }
+ return u;
+ }
+
+ // Armenian
+ // Range: U+0530 to U+058F
+ if ( c >= 0x0531 && c <= 0x0556 ) {
+ u[0] = c;
+ u[1] = c + 48;
+ return u;
+ }
+ if ( c >= 0x0561 && c < 0x0587 ) {
+ u[0] = c - 48;
+ u[1] = c;
+ return u;
+ }
+ if (c == 0x0587) {
+ u[0] = 0x0535;
+ u[1] = c;
+ return u;
+ }
+
+ // Hebrew
+ // Range: U+0590 to U+05FF
+
+
+ // Arabic
+ // Range: U+0600 to U+06FF
+
+ // Devanagari
+ // Range: U+0900 to U+097F
+
+
+ // Bengali
+ // Range: U+0980 to U+09FF
+
+
+ // Gurmukhi
+ // Range: U+0A00 to U+0A7F
+
+
+ // Gujarati
+ // Range: U+0A80 to U+0AFF
+
+
+ // Oriya
+ // Range: U+0B00 to U+0B7F
+ // no capital / lower case
+
+
+ // Tamil
+ // Range: U+0B80 to U+0BFF
+ // no capital / lower case
+
+
+ // Telugu
+ // Range: U+0C00 to U+0C7F
+ // no capital / lower case
+
+
+ // Kannada
+ // Range: U+0C80 to U+0CFF
+ // no capital / lower case
+
+
+ // Malayalam
+ // Range: U+0D00 to U+0D7F
+
+ // Thai
+ // Range: U+0E00 to U+0E7F
+
+
+ // Lao
+ // Range: U+0E80 to U+0EFF
+
+
+ // Tibetan
+ // Range: U+0F00 to U+0FBF
+
+ // Georgian
+ // Range: U+10A0 to U+10F0
+
+ // Hangul Jamo
+ // Range: U+1100 to U+11FF
+
+ // Greek Extended
+ // Range: U+1F00 to U+1FFF
+ // skip for now
+
+
+ // General Punctuation
+ // Range: U+2000 to U+206F
+
+ // Superscripts and Subscripts
+ // Range: U+2070 to U+209F
+
+ // Currency Symbols
+ // Range: U+20A0 to U+20CF
+
+
+ // Combining Diacritical Marks for Symbols
+ // Range: U+20D0 to U+20FF
+ // skip for now
+
+
+ // Number Forms
+ // Range: U+2150 to U+218F
+ // skip for now
+
+
+ // Arrows
+ // Range: U+2190 to U+21FF
+
+ // Mathematical Operators
+ // Range: U+2200 to U+22FF
+
+ // Miscellaneous Technical
+ // Range: U+2300 to U+23FF
+
+ // Control Pictures
+ // Range: U+2400 to U+243F
+
+ // Optical Character Recognition
+ // Range: U+2440 to U+245F
+
+ // Enclosed Alphanumerics
+ // Range: U+2460 to U+24FF
+
+ // Box Drawing
+ // Range: U+2500 to U+257F
+
+ // Block Elements
+ // Range: U+2580 to U+259F
+
+ // Geometric Shapes
+ // Range: U+25A0 to U+25FF
+
+ // Miscellaneous Symbols
+ // Range: U+2600 to U+26FF
+
+ // Dingbats
+ // Range: U+2700 to U+27BF
+
+ // CJK Symbols and Punctuation
+ // Range: U+3000 to U+303F
+
+ // Hiragana
+ // Range: U+3040 to U+309F
+
+ // Katakana
+ // Range: U+30A0 to U+30FF
+
+ // Bopomofo
+ // Range: U+3100 to U+312F
+
+ // Hangul Compatibility Jamo
+ // Range: U+3130 to U+318F
+
+ // Kanbun
+ // Range: U+3190 to U+319F
+
+
+ // Enclosed CJK Letters and Months
+ // Range: U+3200 to U+32FF
+
+ // CJK Compatibility
+ // Range: U+3300 to U+33FF
+
+ // Hangul Syllables
+ // Range: U+AC00 to U+D7A3
+
+ // High Surrogates
+ // Range: U+D800 to U+DB7F
+
+ // Private Use High Surrogates
+ // Range: U+DB80 to U+DBFF
+
+ // Low Surrogates
+ // Range: U+DC00 to U+DFFF
+
+ // Private Use Area
+ // Range: U+E000 to U+F8FF
+
+ // CJK Compatibility Ideographs
+ // Range: U+F900 to U+FAFF
+
+ // Alphabetic Presentation Forms
+ // Range: U+FB00 to U+FB4F
+
+ // Arabic Presentation Forms-A
+ // Range: U+FB50 to U+FDFF
+
+ // Combining Half Marks
+ // Range: U+FE20 to U+FE2F
+
+ // CJK Compatibility Forms
+ // Range: U+FE30 to U+FE4F
+
+ // Small Form Variants
+ // Range: U+FE50 to U+FE6F
+
+ // Arabic Presentation Forms-B
+ // Range: U+FE70 to U+FEFF
+
+ // Halfwidth and Fullwidth Forms
+ // Range: U+FF00 to U+FFEF
+
+ if ( c >= 0xFF21 && c <= 0xFF3A ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ if ( c >= 0xFF41 && c <= 0xFF5A ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+
+ // Specials
+ // Range: U+FFF0 to U+FFFF
+
+ return u;
+}
+
+function DecimalToHexString( n ) {
+ n = Number( n );
+ var h = "0x";
+
+ for ( var i = 3; i >= 0; i-- ) {
+ if ( n >= Math.pow(16, i) ){
+ var t = Math.floor( n / Math.pow(16, i));
+ n -= t * Math.pow(16, i);
+ if ( t >= 10 ) {
+ if ( t == 10 ) {
+ h += "A";
+ }
+ if ( t == 11 ) {
+ h += "B";
+ }
+ if ( t == 12 ) {
+ h += "C";
+ }
+ if ( t == 13 ) {
+ h += "D";
+ }
+ if ( t == 14 ) {
+ h += "E";
+ }
+ if ( t == 15 ) {
+ h += "F";
+ }
+ } else {
+ h += String( t );
+ }
+ } else {
+ h += "0";
+ }
+ }
+
+ return h;
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.2-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.2-1.js
new file mode 100644
index 0000000..3569556
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.2-1.js
@@ -0,0 +1,70 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.5.4.2-1.js
+ ECMA Section: 15.5.4.2 String.prototype.toString()
+
+ Description: Returns this string value. Note that, for a String
+ object, the toString() method happens to return the same
+ thing as the valueOf() method.
+
+ The toString function is not generic; it generates a
+ runtime error if its this value is not a String object.
+ Therefore it connot be transferred to the other kinds of
+ objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 1 october 1997
+*/
+
+ var SECTION = "15.5.4.2-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "String.prototype.toString";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION, "String.prototype.toString()", "", String.prototype.toString() );
+ array[item++] = new TestCase( SECTION, "(new String()).toString()", "", (new String()).toString() );
+ array[item++] = new TestCase( SECTION, "(new String(\"\")).toString()", "", (new String("")).toString() );
+ array[item++] = new TestCase( SECTION, "(new String( String() )).toString()","", (new String(String())).toString() );
+ array[item++] = new TestCase( SECTION, "(new String( \"h e l l o\" )).toString()", "h e l l o", (new String("h e l l o")).toString() );
+ array[item++] = new TestCase( SECTION, "(new String( 0 )).toString()", "0", (new String(0)).toString() );
+ return ( array );
+}
+function test( array ) {
+ for ( tc = 0; tc < testcases.length; tc++ ) {
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.2-2-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.2-2-n.js
new file mode 100644
index 0000000..b444bae
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.2-2-n.js
@@ -0,0 +1,74 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.5.4.2-2-n.js
+ ECMA Section: 15.5.4.2 String.prototype.toString()
+
+ Description: Returns this string value. Note that, for a String
+ object, the toString() method happens to return the same
+ thing as the valueOf() method.
+
+ The toString function is not generic; it generates a
+ runtime error if its this value is not a String object.
+ Therefore it connot be transferred to the other kinds of
+ objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 1 october 1997
+*/
+
+ var SECTION = "15.5.4.2-3-n";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "String.prototype.toString";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+
+ testcases[tc].actual = eval( testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION,
+ "var tostr=String.prototype.toString; astring=new Number(); astring.toString = tostr; astring.toString()",
+ "error",
+ "var tostr=String.prototype.toString; astring=new Number(); astring.toString = tostr; astring.toString()" );
+
+ return ( array );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.2-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.2-3.js
new file mode 100644
index 0000000..f1855e2
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.2-3.js
@@ -0,0 +1,87 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.5.4.2-3.js
+ ECMA Section: 15.5.4.2 String.prototype.toString()
+
+ Description: Returns this string value. Note that, for a String
+ object, the toString() method happens to return the same
+ thing as the valueOf() method.
+
+ The toString function is not generic; it generates a
+ runtime error if its this value is not a String object.
+ Therefore it connot be transferred to the other kinds of
+ objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 1 october 1997
+*/
+
+
+ var SECTION = "15.5.4.2-3";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "String.prototype.toString";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+
+ testcases[tc].actual = eval( testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION,
+ "var tostr=String.prototype.toString; astring=new String(); astring.toString = tostr; astring.toString()",
+ "",
+ "var tostr=String.prototype.toString; astring=new String(); astring.toString = tostr; astring.toString()" );
+ array[item++] = new TestCase( SECTION,
+ "var tostr=String.prototype.toString; astring=new String(0); astring.toString = tostr; astring.toString()",
+ "0",
+ "var tostr=String.prototype.toString; astring=new String(0); astring.toString = tostr; astring.toString()" );
+ array[item++] = new TestCase( SECTION,
+ "var tostr=String.prototype.toString; astring=new String('hello'); astring.toString = tostr; astring.toString()",
+ "hello",
+ "var tostr=String.prototype.toString; astring=new String('hello'); astring.toString = tostr; astring.toString()" );
+ array[item++] = new TestCase( SECTION,
+ "var tostr=String.prototype.toString; astring=new String(''); astring.toString = tostr; astring.toString()",
+ "",
+ "var tostr=String.prototype.toString; astring=new String(''); astring.toString = tostr; astring.toString()" );
+
+ return ( array );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.2.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.2.js
new file mode 100644
index 0000000..8779e33
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.2.js
@@ -0,0 +1,92 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.5.4.2.js
+ ECMA Section: 15.5.4.2 String.prototype.toString
+
+ Description:
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+ var SECTION = "15.5.4.2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "String.prototype.tostring";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "String.prototype.toString.__proto__", Function.prototype, String.prototype.toString.__proto__ );
+ array[item++] = new TestCase( SECTION,
+ "String.prototype.toString() == String.prototype.valueOf()",
+ true,
+ String.prototype.toString() == String.prototype.valueOf() );
+
+ array[item++] = new TestCase( SECTION, "String.prototype.toString()", "", String.prototype.toString() );
+ array[item++] = new TestCase( SECTION, "String.prototype.toString.length", 0, String.prototype.toString.length );
+
+
+ array[item++] = new TestCase( SECTION,
+ "TESTSTRING = new String();TESTSTRING.valueOf() == TESTSTRING.toString()",
+ true,
+ eval("TESTSTRING = new String();TESTSTRING.valueOf() == TESTSTRING.toString()") );
+ array[item++] = new TestCase( SECTION,
+ "TESTSTRING = new String(true);TESTSTRING.valueOf() == TESTSTRING.toString()",
+ true,
+ eval("TESTSTRING = new String(true);TESTSTRING.valueOf() == TESTSTRING.toString()") );
+ array[item++] = new TestCase( SECTION,
+ "TESTSTRING = new String(false);TESTSTRING.valueOf() == TESTSTRING.toString()",
+ true,
+ eval("TESTSTRING = new String(false);TESTSTRING.valueOf() == TESTSTRING.toString()") );
+ array[item++] = new TestCase( SECTION,
+ "TESTSTRING = new String(Math.PI);TESTSTRING.valueOf() == TESTSTRING.toString()",
+ true,
+ eval("TESTSTRING = new String(Math.PI);TESTSTRING.valueOf() == TESTSTRING.toString()") );
+ array[item++] = new TestCase( SECTION,
+ "TESTSTRING = new String();TESTSTRING.valueOf() == TESTSTRING.toString()",
+ true,
+ eval("TESTSTRING = new String();TESTSTRING.valueOf() == TESTSTRING.toString()") );
+
+ return ( array );
+}
+function test( array ) {
+ for ( ; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+
+ stopTest();
+
+ // all tests must return an array of TestCase objects
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.3-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.3-1.js
new file mode 100644
index 0000000..d55c437
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.3-1.js
@@ -0,0 +1,70 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.5.4.3-1.js
+ ECMA Section: 15.5.4.3 String.prototype.valueOf()
+
+ Description: Returns this string value.
+
+ The valueOf function is not generic; it generates a
+ runtime error if its this value is not a String object.
+ Therefore it connot be transferred to the other kinds of
+ objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 1 october 1997
+*/
+
+ var SECTION = "15.5.4.3-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "String.prototype.valueOf";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "String.prototype.valueOf.length", 0, String.prototype.valueOf.length );
+
+ array[item++] = new TestCase( SECTION, "String.prototype.valueOf()", "", String.prototype.valueOf() );
+ array[item++] = new TestCase( SECTION, "(new String()).valueOf()", "", (new String()).valueOf() );
+ array[item++] = new TestCase( SECTION, "(new String(\"\")).valueOf()", "", (new String("")).valueOf() );
+ array[item++] = new TestCase( SECTION, "(new String( String() )).valueOf()","", (new String(String())).valueOf() );
+ array[item++] = new TestCase( SECTION, "(new String( \"h e l l o\" )).valueOf()", "h e l l o", (new String("h e l l o")).valueOf() );
+ array[item++] = new TestCase( SECTION, "(new String( 0 )).valueOf()", "0", (new String(0)).valueOf() );
+ return ( array );
+}
+function test( array ) {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.3-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.3-2.js
new file mode 100644
index 0000000..21d3407
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.3-2.js
@@ -0,0 +1,89 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.5.4.3-2.js
+ ECMA Section: 15.5.4.3 String.prototype.valueOf()
+
+ Description: Returns this string value.
+
+ The valueOf function is not generic; it generates a
+ runtime error if its this value is not a String object.
+ Therefore it connot be transferred to the other kinds of
+ objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 1 october 1997
+*/
+
+
+ var SECTION = "15.5.4.3-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "String.prototype.valueOf";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval(testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION,
+ "var valof=String.prototype.valueOf; astring=new String(); astring.valueOf = valof; astring.valof()",
+ "",
+ "var valof=String.prototype.valueOf; astring=new String(); astring.valueOf = valof; astring.valueOf()" );
+ array[item++] = new TestCase( SECTION,
+ "var valof=String.prototype.valueOf; astring=new String(0); astring.valueOf = valof; astring.valof()",
+ "0",
+ "var valof=String.prototype.valueOf; astring=new String(0); astring.valueOf = valof; astring.valueOf()" );
+ array[item++] = new TestCase( SECTION,
+ "var valof=String.prototype.valueOf; astring=new String('hello'); astring.valueOf = valof; astring.valof()",
+ "hello",
+ "var valof=String.prototype.valueOf; astring=new String('hello'); astring.valueOf = valof; astring.valueOf()" );
+ array[item++] = new TestCase( SECTION,
+ "var valof=String.prototype.valueOf; astring=new String(''); astring.valueOf = valof; astring.valof()",
+ "",
+ "var valof=String.prototype.valueOf; astring=new String(''); astring.valueOf = valof; astring.valueOf()" );
+/*
+ array[item++] = new TestCase( SECTION,
+ "var valof=String.prototype.valueOf; astring=new Number(); astring.valueOf = valof; astring.valof()",
+ "error",
+ "var valof=String.prototype.valueOf; astring=new Number(); astring.valueOf = valof; astring.valueOf()" );
+*/
+ return ( array );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.3-3-n.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.3-3-n.js
new file mode 100644
index 0000000..f7c420a
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.3-3-n.js
@@ -0,0 +1,72 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.5.4.3-3-n.js
+ ECMA Section: 15.5.4.3 String.prototype.valueOf()
+
+ Description: Returns this string value.
+
+ The valueOf function is not generic; it generates a
+ runtime error if its this value is not a String object.
+ Therefore it connot be transferred to the other kinds of
+ objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 1 october 1997
+*/
+
+
+ var SECTION = "15.5.4.3-3-n";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "String.prototype.valueOf";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].actual = eval(testcases[tc].actual );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION,
+ "var valof=String.prototype.valueOf; astring=new Number(); astring.valueOf = valof; astring.valof()",
+ "error",
+ "var valof=String.prototype.valueOf; astring=new Number(); astring.valueOf = valof; astring.valueOf()" );
+
+ return ( array );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.4-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.4-1.js
new file mode 100644
index 0000000..e0dc042
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.4-1.js
@@ -0,0 +1,87 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.5.4.4-1.js
+ ECMA Section: 15.5.4.4 String.prototype.charAt(pos)
+ Description: Returns a string containing the character at position
+ pos in the string. If there is no character at that
+ string, the result is the empty string. The result is
+ a string value, not a String object.
+
+ When the charAt method is called with one argument,
+ pos, the following steps are taken:
+ 1. Call ToString, with this value as its argument
+ 2. Call ToInteger pos
+
+ In this test, this is a String, pos is an integer, and
+ all pos are in range.
+
+ Author: christine@netscape.com
+ Date: 2 october 1997
+*/
+ var SECTION = "15.5.4.4-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "String.prototype.charAt";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var TEST_STRING = new String( " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" );
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ for ( i = 0x0020; i < 0x007e; i++, item++) {
+ array[item] = new TestCase( SECTION,
+ "TEST_STRING.charAt("+item+")",
+ String.fromCharCode( i ),
+ TEST_STRING.charAt( item ) );
+ }
+ for ( i = 0x0020; i < 0x007e; i++, item++) {
+ array[item] = new TestCase( SECTION,
+ "TEST_STRING.charAt("+item+") == TEST_STRING.substring( "+item +", "+ (item+1) + ")",
+ true,
+ TEST_STRING.charAt( item ) == TEST_STRING.substring( item, item+1 )
+ );
+ }
+ array[item++] = new TestCase( SECTION, "String.prototype.charAt.length", 1, String.prototype.charAt.length );
+
+ return array;
+}
+function test() {
+ writeLineToLog( "TEST_STRING = new String(\" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\")" );
+ for ( tc = 0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "
+ }
+ stopTest();
+
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.4-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.4-2.js
new file mode 100644
index 0000000..0ca8fb2
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.4-2.js
@@ -0,0 +1,141 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.5.4.4-1.js
+ ECMA Section: 15.5.4.4 String.prototype.charAt(pos)
+ Description: Returns a string containing the character at position
+ pos in the string. If there is no character at that
+ string, the result is the empty string. The result is
+ a string value, not a String object.
+
+ When the charAt method is called with one argument,
+ pos, the following steps are taken:
+ 1. Call ToString, with this value as its argument
+ 2. Call ToInteger pos
+ 3. Compute the number of characters in Result(1)
+ 4. If Result(2) is less than 0 is or not less than
+ Result(3), return the empty string
+ 5. Return a string of length 1 containing one character
+ from result (1), the character at position Result(2).
+
+ Note that the charAt function is intentionally generic;
+ it does not require that its this value be a String
+ object. Therefore it can be transferred to other kinds
+ of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 2 october 1997
+*/
+ var SECTION = "15.5.4.4-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "String.prototype.charAt";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION, "x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(0)", "t", eval("x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(0)") );
+ array[item++] = new TestCase( SECTION, "x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(1)", "r", eval("x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(1)") );
+ array[item++] = new TestCase( SECTION, "x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(2)", "u", eval("x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(2)") );
+ array[item++] = new TestCase( SECTION, "x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(3)", "e", eval("x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(3)") );
+ array[item++] = new TestCase( SECTION, "x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(4)", "", eval("x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(4)") );
+ array[item++] = new TestCase( SECTION, "x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(-1)", "", eval("x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(-1)") );
+
+ array[item++] = new TestCase( SECTION, "x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(true)", "r", eval("x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(true)") );
+ array[item++] = new TestCase( SECTION, "x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(false)", "t", eval("x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(false)") );
+
+ array[item++] = new TestCase( SECTION, "x = new String(); x.charAt(0)", "", eval("x=new String();x.charAt(0)") );
+ array[item++] = new TestCase( SECTION, "x = new String(); x.charAt(1)", "", eval("x=new String();x.charAt(1)") );
+ array[item++] = new TestCase( SECTION, "x = new String(); x.charAt(-1)", "", eval("x=new String();x.charAt(-1)") );
+
+ array[item++] = new TestCase( SECTION, "x = new String(); x.charAt(NaN)", "", eval("x=new String();x.charAt(Number.NaN)") );
+ array[item++] = new TestCase( SECTION, "x = new String(); x.charAt(Number.POSITIVE_INFINITY)", "", eval("x=new String();x.charAt(Number.POSITIVE_INFINITY)") );
+ array[item++] = new TestCase( SECTION, "x = new String(); x.charAt(Number.NEGATIVE_INFINITY)", "", eval("x=new String();x.charAt(Number.NEGATIVE_INFINITY)") );
+
+ array[item++] = new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(0)", "1", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(0)") );
+ array[item++] = new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(1)", "2", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(1)") );
+ array[item++] = new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(2)", "3", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(2)") );
+ array[item++] = new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(3)", "4", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(3)") );
+ array[item++] = new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(4)", "5", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(4)") );
+ array[item++] = new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(5)", "6", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(5)") );
+ array[item++] = new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(6)", "7", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(6)") );
+ array[item++] = new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(7)", "8", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(7)") );
+ array[item++] = new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(8)", "9", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(8)") );
+ array[item++] = new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(9)", "0", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(9)") );
+ array[item++] = new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(10)", "", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(10)") );
+
+ array[item++] = new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(Math.PI)", "4", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(Math.PI)") );
+
+ // MyOtherObject.toString will return "[object Object]
+
+ array[item++] = new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(0)", "[", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(0)") );
+ array[item++] = new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(1)", "o", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(1)") );
+ array[item++] = new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(2)", "b", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(2)") );
+ array[item++] = new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(3)", "j", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(3)") );
+ array[item++] = new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(4)", "e", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(4)") );
+ array[item++] = new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(5)", "c", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(5)") );
+ array[item++] = new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(6)", "t", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(6)") );
+ array[item++] = new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(7)", " ", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(7)") );
+ array[item++] = new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(8)", "O", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(8)") );
+ array[item++] = new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(9)", "b", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(9)") );
+ array[item++] = new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(10)", "j", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(10)") );
+ array[item++] = new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(11)", "e", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(11)") );
+ array[item++] = new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(12)", "c", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(12)") );
+ array[item++] = new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(13)", "t", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(13)") );
+ array[item++] = new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(14)", "]", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(14)") );
+
+ return (array );
+}
+
+function test() {
+ for ( tc = 0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed )
+ ? ""
+ : "wrong value "
+ }
+
+ stopTest();
+ return ( testcases );
+}
+
+function MyObject( value ) {
+ this.value = value;
+ this.valueOf = new Function( "return this.value;" );
+ this.toString = new Function( "return this.value +''" );
+ this.charAt = String.prototype.charAt;
+}
+function MyOtherObject(value) {
+ this.value = value;
+ this.valueOf = new Function( "return this.value;" );
+ this.charAt = String.prototype.charAt;
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.4-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.4-3.js
new file mode 100644
index 0000000..7de6788
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.4-3.js
@@ -0,0 +1,117 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.5.4.4-3.js
+ ECMA Section: 15.5.4.4 String.prototype.charAt(pos)
+ Description: Returns a string containing the character at position
+ pos in the string. If there is no character at that
+ string, the result is the empty string. The result is
+ a string value, not a String object.
+
+ When the charAt method is called with one argument,
+ pos, the following steps are taken:
+ 1. Call ToString, with this value as its argument
+ 2. Call ToInteger pos
+ 3. Compute the number of characters in Result(1)
+ 4. If Result(2) is less than 0 is or not less than
+ Result(3), return the empty string
+ 5. Return a string of length 1 containing one character
+ from result (1), the character at position Result(2).
+
+ Note that the charAt function is intentionally generic;
+ it does not require that its this value be a String
+ object. Therefore it can be transferred to other kinds
+ of objects for use as a method.
+
+ This tests assiging charAt to a user-defined function.
+
+ Author: christine@netscape.com
+ Date: 2 october 1997
+*/
+ var SECTION = "15.5.4.4-3";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "String.prototype.charAt";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function MyObject (v) {
+ this.value = v;
+ this.toString = new Function( "return this.value +'';" );
+ this.valueOf = new Function( "return this.value" );
+ this.charAt = String.prototype.charAt;
+}
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ var foo = new MyObject('hello');
+
+
+ array[item++] = new TestCase( SECTION, "var foo = new MyObject('hello'); ", "h", foo.charAt(0) );
+ array[item++] = new TestCase( SECTION, "var foo = new MyObject('hello'); ", "e", foo.charAt(1) );
+ array[item++] = new TestCase( SECTION, "var foo = new MyObject('hello'); ", "l", foo.charAt(2) );
+ array[item++] = new TestCase( SECTION, "var foo = new MyObject('hello'); ", "l", foo.charAt(3) );
+ array[item++] = new TestCase( SECTION, "var foo = new MyObject('hello'); ", "o", foo.charAt(4) );
+ array[item++] = new TestCase( SECTION, "var foo = new MyObject('hello'); ", "", foo.charAt(-1) );
+ array[item++] = new TestCase( SECTION, "var foo = new MyObject('hello'); ", "", foo.charAt(5) );
+
+ var boo = new MyObject(true);
+
+ array[item++] = new TestCase( SECTION, "var boo = new MyObject(true); ", "t", boo.charAt(0) );
+ array[item++] = new TestCase( SECTION, "var boo = new MyObject(true); ", "r", boo.charAt(1) );
+ array[item++] = new TestCase( SECTION, "var boo = new MyObject(true); ", "u", boo.charAt(2) );
+ array[item++] = new TestCase( SECTION, "var boo = new MyObject(true); ", "e", boo.charAt(3) );
+
+ var noo = new MyObject( Math.PI );
+
+ array[item++] = new TestCase( SECTION, "var noo = new MyObject(Math.PI); ", "3", noo.charAt(0) );
+ array[item++] = new TestCase( SECTION, "var noo = new MyObject(Math.PI); ", ".", noo.charAt(1) );
+ array[item++] = new TestCase( SECTION, "var noo = new MyObject(Math.PI); ", "1", noo.charAt(2) );
+ array[item++] = new TestCase( SECTION, "var noo = new MyObject(Math.PI); ", "4", noo.charAt(3) );
+ array[item++] = new TestCase( SECTION, "var noo = new MyObject(Math.PI); ", "1", noo.charAt(4) );
+ array[item++] = new TestCase( SECTION, "var noo = new MyObject(Math.PI); ", "5", noo.charAt(5) );
+ array[item++] = new TestCase( SECTION, "var noo = new MyObject(Math.PI); ", "9", noo.charAt(6) );
+
+ return array;
+}
+
+function test() {
+ for ( tc = 0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed )
+ ? ""
+ : "wrong value "
+ }
+ stopTest();
+
+ // all tests must return a boolean value
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.4-4.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.4-4.js
new file mode 100644
index 0000000..69ee2e5
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.4-4.js
@@ -0,0 +1,159 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.5.4.4-4.js
+ ECMA Section: 15.5.4.4 String.prototype.charAt(pos)
+ Description: Returns a string containing the character at position
+ pos in the string. If there is no character at that
+ string, the result is the empty string. The result is
+ a string value, not a String object.
+
+ When the charAt method is called with one argument,
+ pos, the following steps are taken:
+ 1. Call ToString, with this value as its argument
+ 2. Call ToInteger pos
+ 3. Compute the number of characters in Result(1)
+ 4. If Result(2) is less than 0 is or not less than
+ Result(3), return the empty string
+ 5. Return a string of length 1 containing one character
+ from result (1), the character at position Result(2).
+
+ Note that the charAt function is intentionally generic;
+ it does not require that its this value be a String
+ object. Therefore it can be transferred to other kinds
+ of objects for use as a method.
+
+ This tests assiging charAt to primitive types..
+
+ Author: christine@netscape.com
+ Date: 2 october 1997
+*/
+ var SECTION = "15.5.4.4-4";
+ var VERSION = "ECMA_2";
+ startTest();
+ var TITLE = "String.prototype.charAt";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+/*
+ array[item++] = new TestCase( SECTION, "x = null; x.__proto.charAt = String.prototype.charAt; x.charAt(0)", "n", eval("x=null; x.__proto__.charAt = String.prototype.charAt; x.charAt(0)") );
+ array[item++] = new TestCase( SECTION, "x = null; x.__proto.charAt = String.prototype.charAt; x.charAt(1)", "u", eval("x=null; x.__proto__.charAt = String.prototype.charAt; x.charAt(1)") );
+ array[item++] = new TestCase( SECTION, "x = null; x.__proto.charAt = String.prototype.charAt; x.charAt(2)", "l", eval("x=null; x.__proto__.charAt = String.prototype.charAt; x.charAt(2)") );
+ array[item++] = new TestCase( SECTION, "x = null; x.__proto.charAt = String.prototype.charAt; x.charAt(3)", "l", eval("x=null; x.__proto__.charAt = String.prototype.charAt; x.charAt(3)") );
+
+ array[item++] = new TestCase( SECTION, "x = undefined; x.__proto.charAt = String.prototype.charAt; x.charAt(0)", "u", eval("x=undefined; x.__proto__.charAt = String.prototype.charAt; x.charAt(0)") );
+ array[item++] = new TestCase( SECTION, "x = undefined; x.__proto.charAt = String.prototype.charAt; x.charAt(1)", "n", eval("x=undefined; x.__proto__.charAt = String.prototype.charAt; x.charAt(1)") );
+ array[item++] = new TestCase( SECTION, "x = undefined; x.__proto.charAt = String.prototype.charAt; x.charAt(2)", "d", eval("x=undefined; x.__proto__.charAt = String.prototype.charAt; x.charAt(2)") );
+ array[item++] = new TestCase( SECTION, "x = undefined; x.__proto.charAt = String.prototype.charAt; x.charAt(3)", "e", eval("x=undefined; x.__proto__.charAt = String.prototype.charAt; x.charAt(3)") );
+*/
+ array[item++] = new TestCase( SECTION, "x = false; x.__proto.charAt = String.prototype.charAt; x.charAt(0)", "f", eval("x=false; x.__proto__.charAt = String.prototype.charAt; x.charAt(0)") );
+ array[item++] = new TestCase( SECTION, "x = false; x.__proto.charAt = String.prototype.charAt; x.charAt(1)", "a", eval("x=false; x.__proto__.charAt = String.prototype.charAt; x.charAt(1)") );
+ array[item++] = new TestCase( SECTION, "x = false; x.__proto.charAt = String.prototype.charAt; x.charAt(2)", "l", eval("x=false; x.__proto__.charAt = String.prototype.charAt; x.charAt(2)") );
+ array[item++] = new TestCase( SECTION, "x = false; x.__proto.charAt = String.prototype.charAt; x.charAt(3)", "s", eval("x=false; x.__proto__.charAt = String.prototype.charAt; x.charAt(3)") );
+ array[item++] = new TestCase( SECTION, "x = false; x.__proto.charAt = String.prototype.charAt; x.charAt(4)", "e", eval("x=false; x.__proto__.charAt = String.prototype.charAt; x.charAt(4)") );
+
+ array[item++] = new TestCase( SECTION, "x = true; x.__proto.charAt = String.prototype.charAt; x.charAt(0)", "t", eval("x=true; x.__proto__.charAt = String.prototype.charAt; x.charAt(0)") );
+ array[item++] = new TestCase( SECTION, "x = true; x.__proto.charAt = String.prototype.charAt; x.charAt(1)", "r", eval("x=true; x.__proto__.charAt = String.prototype.charAt; x.charAt(1)") );
+ array[item++] = new TestCase( SECTION, "x = true; x.__proto.charAt = String.prototype.charAt; x.charAt(2)", "u", eval("x=true; x.__proto__.charAt = String.prototype.charAt; x.charAt(2)") );
+ array[item++] = new TestCase( SECTION, "x = true; x.__proto.charAt = String.prototype.charAt; x.charAt(3)", "e", eval("x=true; x.__proto__.charAt = String.prototype.charAt; x.charAt(3)") );
+
+ array[item++] = new TestCase( SECTION, "x = NaN; x.__proto.charAt = String.prototype.charAt; x.charAt(0)", "N", eval("x=NaN; x.__proto__.charAt = String.prototype.charAt; x.charAt(0)") );
+ array[item++] = new TestCase( SECTION, "x = NaN; x.__proto.charAt = String.prototype.charAt; x.charAt(1)", "a", eval("x=NaN; x.__proto__.charAt = String.prototype.charAt; x.charAt(1)") );
+ array[item++] = new TestCase( SECTION, "x = NaN; x.__proto.charAt = String.prototype.charAt; x.charAt(2)", "N", eval("x=NaN; x.__proto__.charAt = String.prototype.charAt; x.charAt(2)") );
+
+ array[item++] = new TestCase( SECTION, "x = 123; x.__proto.charAt = String.prototype.charAt; x.charAt(0)", "1", eval("x=123; x.__proto__.charAt = String.prototype.charAt; x.charAt(0)") );
+ array[item++] = new TestCase( SECTION, "x = 123; x.__proto.charAt = String.prototype.charAt; x.charAt(1)", "2", eval("x=123; x.__proto__.charAt = String.prototype.charAt; x.charAt(1)") );
+ array[item++] = new TestCase( SECTION, "x = 123; x.__proto.charAt = String.prototype.charAt; x.charAt(2)", "3", eval("x=123; x.__proto__.charAt = String.prototype.charAt; x.charAt(2)") );
+
+
+ array[item++] = new TestCase( SECTION, "x = new Array(1,2,3); x.charAt = String.prototype.charAt; x.charAt(0)", "1", eval("x=new Array(1,2,3); x.charAt = String.prototype.charAt; x.charAt(0)") );
+ array[item++] = new TestCase( SECTION, "x = new Array(1,2,3); x.charAt = String.prototype.charAt; x.charAt(1)", ",", eval("x=new Array(1,2,3); x.charAt = String.prototype.charAt; x.charAt(1)") );
+ array[item++] = new TestCase( SECTION, "x = new Array(1,2,3); x.charAt = String.prototype.charAt; x.charAt(2)", "2", eval("x=new Array(1,2,3); x.charAt = String.prototype.charAt; x.charAt(2)") );
+ array[item++] = new TestCase( SECTION, "x = new Array(1,2,3); x.charAt = String.prototype.charAt; x.charAt(3)", ",", eval("x=new Array(1,2,3); x.charAt = String.prototype.charAt; x.charAt(3)") );
+ array[item++] = new TestCase( SECTION, "x = new Array(1,2,3); x.charAt = String.prototype.charAt; x.charAt(4)", "3", eval("x=new Array(1,2,3); x.charAt = String.prototype.charAt; x.charAt(4)") );
+
+ array[item++] = new TestCase( SECTION, "x = new Array(); x.charAt = String.prototype.charAt; x.charAt(0)", "", eval("x = new Array(); x.charAt = String.prototype.charAt; x.charAt(0)") );
+
+ array[item++] = new TestCase( SECTION, "x = new Number(123); x.charAt = String.prototype.charAt; x.charAt(0)", "1", eval("x=new Number(123); x.charAt = String.prototype.charAt; x.charAt(0)") );
+ array[item++] = new TestCase( SECTION, "x = new Number(123); x.charAt = String.prototype.charAt; x.charAt(1)", "2", eval("x=new Number(123); x.charAt = String.prototype.charAt; x.charAt(1)") );
+ array[item++] = new TestCase( SECTION, "x = new Number(123); x.charAt = String.prototype.charAt; x.charAt(2)", "3", eval("x=new Number(123); x.charAt = String.prototype.charAt; x.charAt(2)") );
+
+ array[item++] = new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(0)", "[", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(0)") );
+ array[item++] = new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(1)", "o", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(1)") );
+ array[item++] = new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(2)", "b", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(2)") );
+ array[item++] = new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(3)", "j", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(3)") );
+ array[item++] = new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(4)", "e", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(4)") );
+ array[item++] = new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(5)", "c", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(5)") );
+ array[item++] = new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(6)", "t", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(6)") );
+ array[item++] = new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(7)", " ", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(7)") );
+ array[item++] = new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(8)", "O", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(8)") );
+ array[item++] = new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(9)", "b", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(9)") );
+ array[item++] = new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(10)", "j", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(10)") );
+ array[item++] = new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(11)", "e", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(11)") );
+ array[item++] = new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(12)", "c", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(12)") );
+ array[item++] = new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(13)", "t", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(13)") );
+ array[item++] = new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(14)", "]", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(14)") );
+
+ array[item++] = new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(0)", "[", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(0)") );
+ array[item++] = new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(1)", "o", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(1)") );
+ array[item++] = new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(2)", "b", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(2)") );
+ array[item++] = new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(3)", "j", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(3)") );
+ array[item++] = new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(4)", "e", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(4)") );
+ array[item++] = new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(5)", "c", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(5)") );
+ array[item++] = new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(6)", "t", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(6)") );
+ array[item++] = new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(7)", " ", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(7)") );
+ array[item++] = new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(8)", "F", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(8)") );
+ array[item++] = new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(9)", "u", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(9)") );
+ array[item++] = new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(10)", "n", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(10)") );
+ array[item++] = new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(11)", "c", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(11)") );
+ array[item++] = new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(12)", "t", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(12)") );
+ array[item++] = new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(13)", "i", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(13)") );
+ array[item++] = new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(14)", "o", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(14)") );
+ array[item++] = new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(15)", "n", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(15)") );
+ array[item++] = new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(16)", "]", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(16)") );
+ array[item++] = new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(17)", "", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(17)") );
+
+
+ return array;
+}
+
+function test() {
+ for ( tc = 0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed )
+ ? ""
+ : "wrong value "
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.5-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.5-1.js
new file mode 100644
index 0000000..62d42b4
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.5-1.js
@@ -0,0 +1,89 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.5.4.5.1.js
+ ECMA Section: 15.5.4.5 String.prototype.charCodeAt(pos)
+ Description: Returns a number (a nonnegative integer less than 2^16)
+ representing the Unicode encoding of the character at
+ position pos in this string. If there is no character
+ at that position, the number is NaN.
+
+ When the charCodeAt method is called with one argument
+ pos, the following steps are taken:
+ 1. Call ToString, giving it the theis value as its
+ argument
+ 2. Call ToInteger(pos)
+ 3. Compute the number of characters in result(1).
+ 4. If Result(2) is less than 0 or is not less than
+ Result(3), return NaN.
+ 5. Return a value of Number type, of positive sign, whose
+ magnitude is the Unicode encoding of one character
+ from result 1, namely the characer at position Result
+ (2), where the first character in Result(1) is
+ considered to be at position 0.
+
+ Note that the charCodeAt funciton is intentionally
+ generic; it does not require that its this value be a
+ String object. Therefore it can be transferred to other
+ kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 2 october 1997
+*/
+ var SECTION = "15.5.4.5-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "String.prototype.charCodeAt";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var TEST_STRING = new String( " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" );
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+
+ for ( j = 0, i = 0x0020; i < 0x007e; i++, j++ ) {
+ array[j] = new TestCase( SECTION, "TEST_STRING.charCodeAt("+j+")", i, TEST_STRING.charCodeAt( j ) );
+ }
+
+ item = array.length;
+
+ array[item++] = new TestCase( SECTION, 'TEST_STRING.charCodeAt('+i+')', NaN, TEST_STRING.charCodeAt( i ) );
+ return array;
+}
+
+function test() {
+ for ( tc = 0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "
+ }
+ stopTest();
+
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.5-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.5-2.js
new file mode 100644
index 0000000..2570687
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.5-2.js
@@ -0,0 +1,128 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.5.4.5.1.js
+ ECMA Section: 15.5.4.5 String.prototype.charCodeAt(pos)
+ Description: Returns a number (a nonnegative integer less than 2^16)
+ representing the Unicode encoding of the character at
+ position pos in this string. If there is no character
+ at that position, the number is NaN.
+
+ When the charCodeAt method is called with one argument
+ pos, the following steps are taken:
+ 1. Call ToString, giving it the theis value as its
+ argument
+ 2. Call ToInteger(pos)
+ 3. Compute the number of characters in result(1).
+ 4. If Result(2) is less than 0 or is not less than
+ Result(3), return NaN.
+ 5. Return a value of Number type, of positive sign, whose
+ magnitude is the Unicode encoding of one character
+ from result 1, namely the characer at position Result
+ (2), where the first character in Result(1) is
+ considered to be at position 0.
+
+ Note that the charCodeAt funciton is intentionally
+ generic; it does not require that its this value be a
+ String object. Therefore it can be transferred to other
+ kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 2 october 1997
+*/
+ var SECTION = "15.5.4.5-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "String.prototype.charCodeAt";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var TEST_STRING = new String( " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" );
+
+ var testcases = getTestCases();
+
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ var x;
+
+ array[item++] = new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(0)", 0x0074, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(0)") );
+ array[item++] = new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(1)", 0x0072, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(1)") );
+ array[item++] = new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(2)", 0x0075, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(2)") );
+ array[item++] = new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(3)", 0x0065, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(3)") );
+ array[item++] = new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(4)", Number.NaN, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(4)") );
+ array[item++] = new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(-1)", Number.NaN, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(-1)") );
+
+ array[item++] = new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(true)", 0x0072, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(true)") );
+ array[item++] = new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(false)", 0x0074, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(false)") );
+
+ array[item++] = new TestCase( SECTION, "x = new String(); x.charCodeAt(0)", Number.NaN, eval("x=new String();x.charCodeAt(0)") );
+ array[item++] = new TestCase( SECTION, "x = new String(); x.charCodeAt(1)", Number.NaN, eval("x=new String();x.charCodeAt(1)") );
+ array[item++] = new TestCase( SECTION, "x = new String(); x.charCodeAt(-1)", Number.NaN, eval("x=new String();x.charCodeAt(-1)") );
+
+ array[item++] = new TestCase( SECTION, "x = new String(); x.charCodeAt(NaN)", Number.NaN, eval("x=new String();x.charCodeAt(Number.NaN)") );
+ array[item++] = new TestCase( SECTION, "x = new String(); x.charCodeAt(Number.POSITIVE_INFINITY)", Number.NaN, eval("x=new String();x.charCodeAt(Number.POSITIVE_INFINITY)") );
+ array[item++] = new TestCase( SECTION, "x = new String(); x.charCodeAt(Number.NEGATIVE_INFINITY)", Number.NaN, eval("x=new String();x.charCodeAt(Number.NEGATIVE_INFINITY)") );
+
+ array[item++] = new TestCase( SECTION, "x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(0)", 0x0031, eval("x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(0)") );
+ array[item++] = new TestCase( SECTION, "x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(1)", 0x002C, eval("x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(1)") );
+ array[item++] = new TestCase( SECTION, "x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(2)", 0x0032, eval("x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(2)") );
+ array[item++] = new TestCase( SECTION, "x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(3)", 0x002C, eval("x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(3)") );
+ array[item++] = new TestCase( SECTION, "x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(4)", 0x0033, eval("x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(4)") );
+ array[item++] = new TestCase( SECTION, "x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(5)", NaN, eval("x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(5)") );
+
+ array[item++] = new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(0)", 0x005B, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(0)") );
+ array[item++] = new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(1)", 0x006F, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(1)") );
+ array[item++] = new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(2)", 0x0062, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(2)") );
+ array[item++] = new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(3)", 0x006A, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(3)") );
+ array[item++] = new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(4)", 0x0065, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(4)") );
+ array[item++] = new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(5)", 0x0063, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(5)") );
+ array[item++] = new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(6)", 0x0074, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(6)") );
+
+ array[item++] = new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(7)", 0x0020, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(7)") );
+
+ array[item++] = new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(8)", 0x004F, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(8)") );
+ array[item++] = new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(9)", 0x0062, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(9)") );
+ array[item++] = new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(10)", 0x006A, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(10)") );
+
+ return (array );
+}
+
+function test() {
+ for ( tc = 0; tc < testcases.length; tc++ ) {
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed )
+ ? ""
+ : "wrong value "
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.5-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.5-3.js
new file mode 100644
index 0000000..20d380b
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.5-3.js
@@ -0,0 +1,136 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.5.4.5-3.js
+ ECMA Section: 15.5.4.5 String.prototype.charCodeAt(pos)
+ Description: Returns a number (a nonnegative integer less than 2^16)
+ representing the Unicode encoding of the character at
+ position pos in this string. If there is no character
+ at that position, the number is NaN.
+
+ When the charCodeAt method is called with one argument
+ pos, the following steps are taken:
+ 1. Call ToString, giving it the theis value as its
+ argument
+ 2. Call ToInteger(pos)
+ 3. Compute the number of characters in result(1).
+ 4. If Result(2) is less than 0 or is not less than
+ Result(3), return NaN.
+ 5. Return a value of Number type, of positive sign, whose
+ magnitude is the Unicode encoding of one character
+ from result 1, namely the characer at position Result
+ (2), where the first character in Result(1) is
+ considered to be at position 0.
+
+ Note that the charCodeAt funciton is intentionally
+ generic; it does not require that its this value be a
+ String object. Therefore it can be transferred to other
+ kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 2 october 1997
+*/
+ var SECTION = "15.5.4.5-3";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "String.prototype.charCodeAt";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var TEST_STRING = new String( " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" );
+
+ var testcases = getTestCases();
+ test();
+
+function MyObject (v) {
+ this.value = v;
+ this.toString = new Function ( "return this.value +\"\"" );
+ this.charCodeAt = String.prototype.charCodeAt;
+}
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ var foo = new MyObject('hello');
+
+ array[item++] = new TestCase( SECTION, "var foo = new MyObject('hello');foo.charCodeAt(0)", 0x0068, foo.charCodeAt(0) );
+ array[item++] = new TestCase( SECTION, "var foo = new MyObject('hello');foo.charCodeAt(1)", 0x0065, foo.charCodeAt(1) );
+ array[item++] = new TestCase( SECTION, "var foo = new MyObject('hello');foo.charCodeAt(2)", 0x006c, foo.charCodeAt(2) );
+ array[item++] = new TestCase( SECTION, "var foo = new MyObject('hello');foo.charCodeAt(3)", 0x006c, foo.charCodeAt(3) );
+ array[item++] = new TestCase( SECTION, "var foo = new MyObject('hello');foo.charCodeAt(4)", 0x006f, foo.charCodeAt(4) );
+ array[item++] = new TestCase( SECTION, "var foo = new MyObject('hello');foo.charCodeAt(-1)", Number.NaN, foo.charCodeAt(-1) );
+ array[item++] = new TestCase( SECTION, "var foo = new MyObject('hello');foo.charCodeAt(5)", Number.NaN, foo.charCodeAt(5) );
+
+ var boo = new MyObject(true);
+
+ array[item++] = new TestCase( SECTION, "var boo = new MyObject(true);boo.charCodeAt(0)", 0x0074, boo.charCodeAt(0) );
+ array[item++] = new TestCase( SECTION, "var boo = new MyObject(true);boo.charCodeAt(1)", 0x0072, boo.charCodeAt(1) );
+ array[item++] = new TestCase( SECTION, "var boo = new MyObject(true);boo.charCodeAt(2)", 0x0075, boo.charCodeAt(2) );
+ array[item++] = new TestCase( SECTION, "var boo = new MyObject(true);boo.charCodeAt(3)", 0x0065, boo.charCodeAt(3) );
+
+ var noo = new MyObject( Math.PI );
+
+ array[item++] = new TestCase( SECTION, "var noo = new MyObject(Math.PI);noo.charCodeAt(0)", 0x0033, noo.charCodeAt(0) );
+ array[item++] = new TestCase( SECTION, "var noo = new MyObject(Math.PI);noo.charCodeAt(1)", 0x002E, noo.charCodeAt(1) );
+ array[item++] = new TestCase( SECTION, "var noo = new MyObject(Math.PI);noo.charCodeAt(2)", 0x0031, noo.charCodeAt(2) );
+ array[item++] = new TestCase( SECTION, "var noo = new MyObject(Math.PI);noo.charCodeAt(3)", 0x0034, noo.charCodeAt(3) );
+ array[item++] = new TestCase( SECTION, "var noo = new MyObject(Math.PI);noo.charCodeAt(4)", 0x0031, noo.charCodeAt(4) );
+ array[item++] = new TestCase( SECTION, "var noo = new MyObject(Math.PI);noo.charCodeAt(5)", 0x0035, noo.charCodeAt(5) );
+ array[item++] = new TestCase( SECTION, "var noo = new MyObject(Math.PI);noo.charCodeAt(6)", 0x0039, noo.charCodeAt(6) );
+
+ var noo = new MyObject( null );
+
+ array[item++] = new TestCase( SECTION, "var noo = new MyObject(null);noo.charCodeAt(0)", 0x006E, noo.charCodeAt(0) );
+ array[item++] = new TestCase( SECTION, "var noo = new MyObject(null);noo.charCodeAt(1)", 0x0075, noo.charCodeAt(1) );
+ array[item++] = new TestCase( SECTION, "var noo = new MyObject(null);noo.charCodeAt(2)", 0x006C, noo.charCodeAt(2) );
+ array[item++] = new TestCase( SECTION, "var noo = new MyObject(null);noo.charCodeAt(3)", 0x006C, noo.charCodeAt(3) );
+ array[item++] = new TestCase( SECTION, "var noo = new MyObject(null);noo.charCodeAt(4)", NaN, noo.charCodeAt(4) );
+
+ var noo = new MyObject( void 0 );
+
+ array[item++] = new TestCase( SECTION, "var noo = new MyObject(void 0);noo.charCodeAt(0)", 0x0075, noo.charCodeAt(0) );
+ array[item++] = new TestCase( SECTION, "var noo = new MyObject(void 0);noo.charCodeAt(1)", 0x006E, noo.charCodeAt(1) );
+ array[item++] = new TestCase( SECTION, "var noo = new MyObject(void 0);noo.charCodeAt(2)", 0x0064, noo.charCodeAt(2) );
+ array[item++] = new TestCase( SECTION, "var noo = new MyObject(void 0);noo.charCodeAt(3)", 0x0065, noo.charCodeAt(3) );
+ array[item++] = new TestCase( SECTION, "var noo = new MyObject(void 0);noo.charCodeAt(4)", 0x0066, noo.charCodeAt(4) );
+
+ return array;
+}
+
+function test() {
+ for ( tc = 0; tc < testcases.length; tc++ ) {
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed )
+ ? ""
+ : "wrong value ";
+
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.5-4.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.5-4.js
new file mode 100644
index 0000000..cd99bc2
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.5-4.js
@@ -0,0 +1,80 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.5.4.5-4.js
+ ECMA Section: 15.5.4.5 String.prototype.charCodeAt(pos)
+
+ Description: Returns a nonnegative integer less than 2^16.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+ var VERSION = "0697";
+ startTest();
+ var SECTION = "15.5.4.5-4";
+
+ writeHeaderToLog( SECTION + " String.prototype.charCodeAt(pos)" );
+ var tc= 0;
+ var testcases = getTestCases();
+
+// all tests must call a function that returns an array of TestCase objects.
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var MAXCHARCODE = Math.pow(2,16);
+ var item=0, CHARCODE;
+
+ for ( CHARCODE=0; CHARCODE <256; CHARCODE++ ) {
+ array[item++] = new TestCase( SECTION,
+ "(String.fromCharCode("+CHARCODE+")).charCodeAt(0)",
+ CHARCODE,
+ (String.fromCharCode(CHARCODE)).charCodeAt(0) );
+ }
+ for ( CHARCODE=256; CHARCODE < 65536; CHARCODE+=999 ) {
+ array[item++] = new TestCase( SECTION,
+ "(String.fromCharCode("+CHARCODE+")).charCodeAt(0)",
+ CHARCODE,
+ (String.fromCharCode(CHARCODE)).charCodeAt(0) );
+ }
+
+ array[item++] = new TestCase( SECTION, "(String.fromCharCode(65535)).charCodeAt(0)", 65535, (String.fromCharCode(65535)).charCodeAt(0) );
+
+ return ( array );
+}
+function test() {
+ for ( tc = 0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+
+ }
+
+ stopTest();
+
+ // all tests must return an array of TestCase objects
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.5-5.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.5-5.js
new file mode 100644
index 0000000..091f5e8
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.5-5.js
@@ -0,0 +1,111 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.5.4.5.1.js
+ ECMA Section: 15.5.4.5 String.prototype.charCodeAt(pos)
+ Description: Returns a number (a nonnegative integer less than 2^16)
+ representing the Unicode encoding of the character at
+ position pos in this string. If there is no character
+ at that position, the number is NaN.
+
+ When the charCodeAt method is called with one argument
+ pos, the following steps are taken:
+ 1. Call ToString, giving it the theis value as its
+ argument
+ 2. Call ToInteger(pos)
+ 3. Compute the number of characters in result(1).
+ 4. If Result(2) is less than 0 or is not less than
+ Result(3), return NaN.
+ 5. Return a value of Number type, of positive sign, whose
+ magnitude is the Unicode encoding of one character
+ from result 1, namely the characer at position Result
+ (2), where the first character in Result(1) is
+ considered to be at position 0.
+
+ Note that the charCodeAt funciton is intentionally
+ generic; it does not require that its this value be a
+ String object. Therefore it can be transferred to other
+ kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 2 october 1997
+*/
+ var SECTION = "15.5.4.5-5";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "String.prototype.charCodeAt";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var TEST_STRING = "";
+
+ for ( var i = 0x0000; i < 255; i++ ) {
+ TEST_STRING += String.fromCharCode( i );
+ }
+
+
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+ array[item++] = new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(0)", 0x0074, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(0)") );
+ array[item++] = new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(1)", 0x0072, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(1)") );
+ array[item++] = new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(2)", 0x0075, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(2)") );
+ array[item++] = new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(3)", 0x0065, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(3)") );
+ array[item++] = new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(4)", Number.NaN, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(4)") );
+ array[item++] = new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(-1)", Number.NaN, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(-1)") );
+
+ array[item++] = new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(true)", 0x0072, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(true)") );
+ array[item++] = new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(false)", 0x0074, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(false)") );
+
+ array[item++] = new TestCase( SECTION, "x = new String(); x.charCodeAt(0)", Number.NaN, eval("x=new String();x.charCodeAt(0)") );
+ array[item++] = new TestCase( SECTION, "x = new String(); x.charCodeAt(1)", Number.NaN, eval("x=new String();x.charCodeAt(1)") );
+ array[item++] = new TestCase( SECTION, "x = new String(); x.charCodeAt(-1)", Number.NaN, eval("x=new String();x.charCodeAt(-1)") );
+
+ array[item++] = new TestCase( SECTION, "x = new String(); x.charCodeAt(NaN)", Number.NaN, eval("x=new String();x.charCodeAt(Number.NaN)") );
+ array[item++] = new TestCase( SECTION, "x = new String(); x.charCodeAt(Number.POSITIVE_INFINITY)", Number.NaN, eval("x=new String();x.charCodeAt(Number.POSITIVE_INFINITY)") );
+ array[item++] = new TestCase( SECTION, "x = new String(); x.charCodeAt(Number.NEGATIVE_INFINITY)", Number.NaN, eval("x=new String();x.charCodeAt(Number.NEGATIVE_INFINITY)") );
+
+ for ( var j = 0; j < 255; j++ ) {
+ array[item++] = new TestCase( SECTION, "TEST_STRING.charCodeAt("+j+")", j, TEST_STRING.charCodeAt(j) );
+ }
+ return (array );
+}
+
+function test() {
+ for ( tc = 0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed )
+ ? ""
+ : "wrong value "
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.5-6.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.5-6.js
new file mode 100644
index 0000000..8b7ae18
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.5-6.js
@@ -0,0 +1,97 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.5.4.5-6.js
+ ECMA Section: 15.5.4.5 String.prototype.charCodeAt(pos)
+ Description: Returns a number (a nonnegative integer less than 2^16)
+ representing the Unicode encoding of the character at
+ position pos in this string. If there is no character
+ at that position, the number is NaN.
+
+ When the charCodeAt method is called with one argument
+ pos, the following steps are taken:
+ 1. Call ToString, giving it the theis value as its
+ argument
+ 2. Call ToInteger(pos)
+ 3. Compute the number of characters in result(1).
+ 4. If Result(2) is less than 0 or is not less than
+ Result(3), return NaN.
+ 5. Return a value of Number type, of positive sign, whose
+ magnitude is the Unicode encoding of one character
+ from result 1, namely the characer at position Result
+ (2), where the first character in Result(1) is
+ considered to be at position 0.
+
+ Note that the charCodeAt funciton is intentionally
+ generic; it does not require that its this value be a
+ String object. Therefore it can be transferred to other
+ kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 2 october 1997
+*/
+ var SECTION = "15.5.4.5-6";
+ var VERSION = "ECMA_2";
+ startTest();
+ var TITLE = "String.prototype.charCodeAt";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION,
+ "var obj = true; obj.__proto__.charCodeAt = String.prototype.charCodeAt; var s = ''; for ( var i = 0; i < 4; i++ ) s+= String.fromCharCode( obj.charCodeAt(i) ); s",
+ "true",
+ eval("var obj = true; obj.__proto__.charCodeAt = String.prototype.charCodeAt; var s = ''; for ( var i = 0; i < 4; i++ ) s+= String.fromCharCode( obj.charCodeAt(i) ); s") );
+
+ array[item++] = new TestCase( SECTION,
+ "var obj = 1234; obj.__proto__.charCodeAt = String.prototype.charCodeAt; var s = ''; for ( var i = 0; i < 4; i++ ) s+= String.fromCharCode( obj.charCodeAt(i) ); s",
+ "1234",
+ eval("var obj = 1234; obj.__proto__.charCodeAt = String.prototype.charCodeAt; var s = ''; for ( var i = 0; i < 4; i++ ) s+= String.fromCharCode( obj.charCodeAt(i) ); s") );
+
+ array[item++] = new TestCase( SECTION,
+ "var obj = 'hello'; obj.__proto__.charCodeAt = String.prototype.charCodeAt; var s = ''; for ( var i = 0; i < 5; i++ ) s+= String.fromCharCode( obj.charCodeAt(i) ); s",
+ "hello",
+ eval("var obj = 'hello'; obj.__proto__.charCodeAt = String.prototype.charCodeAt; var s = ''; for ( var i = 0; i < 5; i++ ) s+= String.fromCharCode( obj.charCodeAt(i) ); s") );
+ return (array );
+}
+
+function test() {
+ for ( tc = 0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed )
+ ? ""
+ : "wrong value "
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.6-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.6-1.js
new file mode 100644
index 0000000..ab9d725
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.6-1.js
@@ -0,0 +1,158 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.5.4.6-1.js
+ ECMA Section: 15.5.4.6 String.prototype.indexOf( searchString, pos)
+ Description: If the given searchString appears as a substring of the
+ result of converting this object to a string, at one or
+ more positions that are at or to the right of the
+ specified position, then the index of the leftmost such
+ position is returned; otherwise -1 is returned. If
+ positionis undefined or not supplied, 0 is assumed, so
+ as to search all of the string.
+
+ When the indexOf method is called with two arguments,
+ searchString and pos, the following steps are taken:
+
+ 1. Call ToString, giving it the this value as its
+ argument.
+ 2. Call ToString(searchString).
+ 3. Call ToInteger(position). (If position is undefined
+ or not supplied, this step produces the value 0).
+ 4. Compute the number of characters in Result(1).
+ 5. Compute min(max(Result(3), 0), Result(4)).
+ 6. Compute the number of characters in the string that
+ is Result(2).
+ 7. Compute the smallest possible integer k not smaller
+ than Result(5) such that k+Result(6) is not greater
+ than Result(4), and for all nonnegative integers j
+ less than Result(6), the character at position k+j
+ of Result(1) is the same as the character at position
+ j of Result(2); but if there is no such integer k,
+ then compute the value -1.
+ 8. Return Result(7).
+
+ Note that the indexOf function is intentionally generic;
+ it does not require that its this value be a String object.
+ Therefore it can be transferred to other kinds of objects
+ for use as a method.
+
+ Author: christine@netscape.com
+ Date: 2 october 1997
+*/
+ var SECTION = "15.5.4.6-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "String.protoype.indexOf";
+
+ var TEST_STRING = new String( " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" );
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+
+function getTestCases() {
+ var array = new Array();
+ var j = 0;
+
+ for ( k = 0, i = 0x0020; i < 0x007e; i++, j++, k++ ) {
+ array[j] = new TestCase( SECTION,
+ "String.indexOf(" +String.fromCharCode(i)+ ", 0)",
+ k,
+ TEST_STRING.indexOf( String.fromCharCode(i), 0 ) );
+ }
+
+ for ( k = 0, i = 0x0020; i < 0x007e; i++, j++, k++ ) {
+ array[j] = new TestCase( SECTION,
+ "String.indexOf("+String.fromCharCode(i)+ ", "+ k +")",
+ k,
+ TEST_STRING.indexOf( String.fromCharCode(i), k ) );
+ }
+
+ for ( k = 0, i = 0x0020; i < 0x007e; i++, j++, k++ ) {
+ array[j] = new TestCase( SECTION,
+ "String.indexOf("+String.fromCharCode(i)+ ", "+k+1+")",
+ -1,
+ TEST_STRING.indexOf( String.fromCharCode(i), k+1 ) );
+ }
+
+ for ( k = 0, i = 0x0020; i < 0x007d; i++, j++, k++ ) {
+ array[j] = new TestCase( SECTION,
+ "String.indexOf("+(String.fromCharCode(i) +
+ String.fromCharCode(i+1)+
+ String.fromCharCode(i+2)) +", "+0+")",
+ k,
+ TEST_STRING.indexOf( (String.fromCharCode(i)+
+ String.fromCharCode(i+1)+
+ String.fromCharCode(i+2)),
+ 0 ) );
+ }
+
+ for ( k = 0, i = 0x0020; i < 0x007d; i++, j++, k++ ) {
+ array[j] = new TestCase( SECTION,
+ "String.indexOf("+(String.fromCharCode(i) +
+ String.fromCharCode(i+1)+
+ String.fromCharCode(i+2)) +", "+ k +")",
+ k,
+ TEST_STRING.indexOf( (String.fromCharCode(i)+
+ String.fromCharCode(i+1)+
+ String.fromCharCode(i+2)),
+ k ) );
+ }
+ for ( k = 0, i = 0x0020; i < 0x007d; i++, j++, k++ ) {
+ array[j] = new TestCase( SECTION,
+ "String.indexOf("+(String.fromCharCode(i) +
+ String.fromCharCode(i+1)+
+ String.fromCharCode(i+2)) +", "+ k+1 +")",
+ -1,
+ TEST_STRING.indexOf( (String.fromCharCode(i)+
+ String.fromCharCode(i+1)+
+ String.fromCharCode(i+2)),
+ k+1 ) );
+ }
+
+ array[j++] = new TestCase( SECTION, "String.indexOf(" +TEST_STRING + ", 0 )", 0, TEST_STRING.indexOf( TEST_STRING, 0 ) );
+ array[j++] = new TestCase( SECTION, "String.indexOf(" +TEST_STRING + ", 1 )", -1, TEST_STRING.indexOf( TEST_STRING, 1 ));
+
+ return array;
+}
+
+function test() {
+ writeLineToLog( "TEST_STRING = new String(\" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\")" );
+
+ for ( tc = 0; tc < testcases.length; tc++ ) {
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "
+
+ }
+ stopTest();
+
+ return ( testcases );
+}
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.6-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.6-2.js
new file mode 100644
index 0000000..6054a51
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.6-2.js
@@ -0,0 +1,259 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.5.4.6-1.js
+ ECMA Section: 15.5.4.6 String.prototype.indexOf( searchString, pos)
+ Description: If the given searchString appears as a substring of the
+ result of converting this object to a string, at one or
+ more positions that are at or to the right of the
+ specified position, then the index of the leftmost such
+ position is returned; otherwise -1 is returned. If
+ positionis undefined or not supplied, 0 is assumed, so
+ as to search all of the string.
+
+ When the indexOf method is called with two arguments,
+ searchString and pos, the following steps are taken:
+
+ 1. Call ToString, giving it the this value as its
+ argument.
+ 2. Call ToString(searchString).
+ 3. Call ToInteger(position). (If position is undefined
+ or not supplied, this step produces the value 0).
+ 4. Compute the number of characters in Result(1).
+ 5. Compute min(max(Result(3), 0), Result(4)).
+ 6. Compute the number of characters in the string that
+ is Result(2).
+ 7. Compute the smallest possible integer k not smaller
+ than Result(5) such that k+Result(6) is not greater
+ than Result(4), and for all nonnegative integers j
+ less than Result(6), the character at position k+j
+ of Result(1) is the same as the character at position
+ j of Result(2); but if there is no such integer k,
+ then compute the value -1.
+ 8. Return Result(7).
+
+ Note that the indexOf function is intentionally generic;
+ it does not require that its this value be a String object.
+ Therefore it can be transferred to other kinds of objects
+ for use as a method.
+
+ Author: christine@netscape.com, pschwartau@netscape.com
+ Date: 02 October 1997
+ Modified: 14 July 2002
+ Reason: See http://bugzilla.mozilla.org/show_bug.cgi?id=155289
+ ECMA-262 Ed.3 Section 15.5.4.7
+ The length property of the indexOf method is 1
+*
+*/
+ var SECTION = "15.5.4.6-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "String.protoype.indexOf";
+ var BUGNUMBER="105721";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+
+// the following test regresses http://scopus/bugsplat/show_bug.cgi?id=105721
+
+function f() {
+ return this;
+}
+function g() {
+ var h = f;
+ return h();
+}
+
+function MyObject (v) {
+ this.value = v;
+ this.toString = new Function ( "return this.value +\"\"");
+ this.indexOf = String.prototype.indexOf;
+}
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ // regress http://scopus/bugsplat/show_bug.cgi?id=105721
+
+ array[item++] = new TestCase( SECTION, "function f() { return this; }; function g() { var h = f; return h(); }; g().toString()", GLOBAL, g().toString() );
+
+
+ array[item++] = new TestCase( SECTION, "String.prototype.indexOf.length", 1, String.prototype.indexOf.length );
+ array[item++] = new TestCase( SECTION, "String.prototype.indexOf.length = null; String.prototype.indexOf.length", 1, eval("String.prototype.indexOf.length = null; String.prototype.indexOf.length") );
+ array[item++] = new TestCase( SECTION, "delete String.prototype.indexOf.length", false, delete String.prototype.indexOf.length );
+ array[item++] = new TestCase( SECTION, "delete String.prototype.indexOf.length; String.prototype.indexOf.length", 1, eval("delete String.prototype.indexOf.length; String.prototype.indexOf.length") );
+
+ array[item++] = new TestCase( SECTION, "var s = new String(); s.indexOf()", -1, eval("var s = new String(); s.indexOf()") );
+
+ // some Unicode tests.
+
+ // generate a test string.
+
+ var TEST_STRING = "";
+
+ for ( var u = 0x00A1; u <= 0x00FF; u++ ) {
+ TEST_STRING += String.fromCharCode( u );
+ }
+
+ for ( var u = 0x00A1, i = 0; u <= 0x00FF; u++, i++ ) {
+ array[item++] = new TestCase( SECTION,
+ "TEST_STRING.indexOf( " + String.fromCharCode(u) + " )",
+ i,
+ TEST_STRING.indexOf( String.fromCharCode(u) ) );
+ }
+ for ( var u = 0x00A1, i = 0; u <= 0x00FF; u++, i++ ) {
+ array[item++] = new TestCase( SECTION,
+ "TEST_STRING.indexOf( " + String.fromCharCode(u) + ", void 0 )",
+ i,
+ TEST_STRING.indexOf( String.fromCharCode(u), void 0 ) );
+ }
+
+
+
+ var foo = new MyObject('hello');
+
+ array[item++] = new TestCase( SECTION, "var foo = new MyObject('hello');foo.indexOf('h')", 0, foo.indexOf("h") );
+ array[item++] = new TestCase( SECTION, "var foo = new MyObject('hello');foo.indexOf('e')", 1, foo.indexOf("e") );
+ array[item++] = new TestCase( SECTION, "var foo = new MyObject('hello');foo.indexOf('l')", 2, foo.indexOf("l") );
+ array[item++] = new TestCase( SECTION, "var foo = new MyObject('hello');foo.indexOf('l')", 2, foo.indexOf("l") );
+ array[item++] = new TestCase( SECTION, "var foo = new MyObject('hello');foo.indexOf('o')", 4, foo.indexOf("o") );
+ array[item++] = new TestCase( SECTION, "var foo = new MyObject('hello');foo.indexOf('X')", -1, foo.indexOf("X") );
+ array[item++] = new TestCase( SECTION, "var foo = new MyObject('hello');foo.indexOf(5) ", -1, foo.indexOf(5) );
+
+ var boo = new MyObject(true);
+
+ array[item++] = new TestCase( SECTION, "var boo = new MyObject(true);boo.indexOf('t')", 0, boo.indexOf("t") );
+ array[item++] = new TestCase( SECTION, "var boo = new MyObject(true);boo.indexOf('r')", 1, boo.indexOf("r") );
+ array[item++] = new TestCase( SECTION, "var boo = new MyObject(true);boo.indexOf('u')", 2, boo.indexOf("u") );
+ array[item++] = new TestCase( SECTION, "var boo = new MyObject(true);boo.indexOf('e')", 3, boo.indexOf("e") );
+ array[item++] = new TestCase( SECTION, "var boo = new MyObject(true);boo.indexOf('true')", 0, boo.indexOf("true") );
+ array[item++] = new TestCase( SECTION, "var boo = new MyObject(true);boo.indexOf('rue')", 1, boo.indexOf("rue") );
+ array[item++] = new TestCase( SECTION, "var boo = new MyObject(true);boo.indexOf('ue')", 2, boo.indexOf("ue") );
+ array[item++] = new TestCase( SECTION, "var boo = new MyObject(true);boo.indexOf('oy')", -1, boo.indexOf("oy") );
+
+
+ var noo = new MyObject( Math.PI );
+ array[item++] = new TestCase( SECTION, "var noo = new MyObject(Math.PI); noo.indexOf('3') ", 0, noo.indexOf('3') );
+ array[item++] = new TestCase( SECTION, "var noo = new MyObject(Math.PI); noo.indexOf('.') ", 1, noo.indexOf('.') );
+ array[item++] = new TestCase( SECTION, "var noo = new MyObject(Math.PI); noo.indexOf('1') ", 2, noo.indexOf('1') );
+ array[item++] = new TestCase( SECTION, "var noo = new MyObject(Math.PI); noo.indexOf('4') ", 3, noo.indexOf('4') );
+ array[item++] = new TestCase( SECTION, "var noo = new MyObject(Math.PI); noo.indexOf('1') ", 2, noo.indexOf('1') );
+ array[item++] = new TestCase( SECTION, "var noo = new MyObject(Math.PI); noo.indexOf('5') ", 5, noo.indexOf('5') );
+ array[item++] = new TestCase( SECTION, "var noo = new MyObject(Math.PI); noo.indexOf('9') ", 6, noo.indexOf('9') );
+
+ array[item++] = new TestCase( SECTION,
+ "var arr = new Array('new','zoo','revue'); arr.indexOf = String.prototype.indexOf; arr.indexOf('new')",
+ 0,
+ eval("var arr = new Array('new','zoo','revue'); arr.indexOf = String.prototype.indexOf; arr.indexOf('new')") );
+
+ array[item++] = new TestCase( SECTION,
+ "var arr = new Array('new','zoo','revue'); arr.indexOf = String.prototype.indexOf; arr.indexOf(',zoo,')",
+ 3,
+ eval("var arr = new Array('new','zoo','revue'); arr.indexOf = String.prototype.indexOf; arr.indexOf(',zoo,')") );
+
+ array[item++] = new TestCase( SECTION,
+ "var obj = new Object(); obj.indexOf = String.prototype.indexOf; obj.indexOf('[object Object]')",
+ 0,
+ eval("var obj = new Object(); obj.indexOf = String.prototype.indexOf; obj.indexOf('[object Object]')") );
+
+ array[item++] = new TestCase( SECTION,
+ "var obj = new Object(); obj.indexOf = String.prototype.indexOf; obj.indexOf('bject')",
+ 2,
+ eval("var obj = new Object(); obj.indexOf = String.prototype.indexOf; obj.indexOf('bject')") );
+
+ array[item++] = new TestCase( SECTION,
+ "var f = new Object( String.prototype.indexOf ); f('"+GLOBAL+"')",
+ 0,
+ eval("var f = new Object( String.prototype.indexOf ); f('"+GLOBAL+"')") );
+
+ array[item++] = new TestCase( SECTION,
+ "var f = new Function(); f.toString = Object.prototype.toString; f.indexOf = String.prototype.indexOf; f.indexOf('[object Function]')",
+ 0,
+ eval("var f = new Function(); f.toString = Object.prototype.toString; f.indexOf = String.prototype.indexOf; f.indexOf('[object Function]')") );
+
+ array[item++] = new TestCase( SECTION,
+ "var b = new Boolean(); b.indexOf = String.prototype.indexOf; b.indexOf('true')",
+ -1,
+ eval("var b = new Boolean(); b.indexOf = String.prototype.indexOf; b.indexOf('true')") );
+
+ array[item++] = new TestCase( SECTION,
+ "var b = new Boolean(); b.indexOf = String.prototype.indexOf; b.indexOf('false', 1)",
+ -1,
+ eval("var b = new Boolean(); b.indexOf = String.prototype.indexOf; b.indexOf('false', 1)") );
+
+ array[item++] = new TestCase( SECTION,
+ "var b = new Boolean(); b.indexOf = String.prototype.indexOf; b.indexOf('false', 0)",
+ 0,
+ eval("var b = new Boolean(); b.indexOf = String.prototype.indexOf; b.indexOf('false', 0)") );
+
+ array[item++] = new TestCase( SECTION,
+ "var n = new Number(1e21); n.indexOf = String.prototype.indexOf; n.indexOf('e')",
+ 1,
+ eval("var n = new Number(1e21); n.indexOf = String.prototype.indexOf; n.indexOf('e')") );
+
+ array[item++] = new TestCase( SECTION,
+ "var n = new Number(-Infinity); n.indexOf = String.prototype.indexOf; n.indexOf('-')",
+ 0,
+ eval("var n = new Number(-Infinity); n.indexOf = String.prototype.indexOf; n.indexOf('-')") );
+
+ array[item++] = new TestCase( SECTION,
+ "var n = new Number(0xFF); n.indexOf = String.prototype.indexOf; n.indexOf('5')",
+ 1,
+ eval("var n = new Number(0xFF); n.indexOf = String.prototype.indexOf; n.indexOf('5')") );
+
+ array[item++] = new TestCase( SECTION,
+ "var m = Math; m.indexOf = String.prototype.indexOf; m.indexOf( 'Math' )",
+ 8,
+ eval("var m = Math; m.indexOf = String.prototype.indexOf; m.indexOf( 'Math' )") );
+
+ // new Date(0) has '31' or '01' at index 8 depending on whether tester is (GMT-) or (GMT+), respectively
+ array[item++] = new TestCase( SECTION,
+ "var d = new Date(0); d.indexOf = String.prototype.indexOf; d.getTimezoneOffset()>0 ? d.indexOf('31') : d.indexOf('01')",
+ 8,
+ eval("var d = new Date(0); d.indexOf = String.prototype.indexOf; d.getTimezoneOffset()>0 ? d.indexOf('31') : d.indexOf('01')") );
+
+
+ return array;
+}
+
+function test() {
+ for ( tc = 0; tc < testcases.length; tc++ ) {
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed )
+ ? ""
+ : "wrong value "
+ }
+ stopTest();
+
+ // all tests must return a boolean value
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.7-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.7-1.js
new file mode 100644
index 0000000..55d0313
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.7-1.js
@@ -0,0 +1,221 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.5.4.7-1.js
+ ECMA Section: 15.5.4.7 String.prototype.lastIndexOf( searchString, pos)
+ Description:
+
+ If the given searchString appears as a substring of the result of
+ converting this object to a string, at one or more positions that are
+ at or to the left of the specified position, then the index of the
+ rightmost such position is returned; otherwise -1 is returned. If position
+ is undefined or not supplied, the length of this string value is assumed,
+ so as to search all of the string.
+
+ When the lastIndexOf method is called with two arguments searchString and
+ position, the following steps are taken:
+
+ 1.Call ToString, giving it the this value as its argument.
+ 2.Call ToString(searchString).
+ 3.Call ToNumber(position). (If position is undefined or not supplied, this step produces the value NaN).
+ 4.If Result(3) is NaN, use +; otherwise, call ToInteger(Result(3)).
+ 5.Compute the number of characters in Result(1).
+ 6.Compute min(max(Result(4), 0), Result(5)).
+ 7.Compute the number of characters in the string that is Result(2).
+ 8.Compute the largest possible integer k not larger than Result(6) such that k+Result(7) is not greater
+ than Result(5), and for all nonnegative integers j less than Result(7), the character at position k+j of
+ Result(1) is the same as the character at position j of Result(2); but if there is no such integer k, then
+ compute the value -1.
+
+ 1.Return Result(8).
+
+ Note that the lastIndexOf function is intentionally generic; it does not require that its this value be a
+ String object. Therefore it can be transferred to other kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 2 october 1997
+*/
+ var SECTION = "15.5.4.7-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "String.protoype.lastIndexOf";
+
+ var TEST_STRING = new String( " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" );
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+
+function getTestCases() {
+ var array = new Array();
+ var j = 0;
+
+ for ( k = 0, i = 0x0021; i < 0x007e; i++, j++, k++ ) {
+ array[j] = new TestCase( SECTION,
+ "String.lastIndexOf(" +String.fromCharCode(i)+ ", 0)",
+ -1,
+ TEST_STRING.lastIndexOf( String.fromCharCode(i), 0 ) );
+ }
+
+ for ( k = 0, i = 0x0020; i < 0x007e; i++, j++, k++ ) {
+ array[j] = new TestCase( SECTION,
+ "String.lastIndexOf("+String.fromCharCode(i)+ ", "+ k +")",
+ k,
+ TEST_STRING.lastIndexOf( String.fromCharCode(i), k ) );
+ }
+
+ for ( k = 0, i = 0x0020; i < 0x007e; i++, j++, k++ ) {
+ array[j] = new TestCase( SECTION,
+ "String.lastIndexOf("+String.fromCharCode(i)+ ", "+k+1+")",
+ k,
+ TEST_STRING.lastIndexOf( String.fromCharCode(i), k+1 ) );
+ }
+
+ for ( k = 9, i = 0x0021; i < 0x007d; i++, j++, k++ ) {
+ array[j] = new TestCase( SECTION,
+
+ "String.lastIndexOf("+(String.fromCharCode(i) +
+ String.fromCharCode(i+1)+
+ String.fromCharCode(i+2)) +", "+ 0 + ")",
+ LastIndexOf( TEST_STRING, String.fromCharCode(i) +
+ String.fromCharCode(i+1)+String.fromCharCode(i+2), 0),
+ TEST_STRING.lastIndexOf( (String.fromCharCode(i)+
+ String.fromCharCode(i+1)+
+ String.fromCharCode(i+2)),
+ 0 ) );
+ }
+
+ for ( k = 0, i = 0x0020; i < 0x007d; i++, j++, k++ ) {
+ array[j] = new TestCase( SECTION,
+ "String.lastIndexOf("+(String.fromCharCode(i) +
+ String.fromCharCode(i+1)+
+ String.fromCharCode(i+2)) +", "+ k +")",
+ k,
+ TEST_STRING.lastIndexOf( (String.fromCharCode(i)+
+ String.fromCharCode(i+1)+
+ String.fromCharCode(i+2)),
+ k ) );
+ }
+ for ( k = 0, i = 0x0020; i < 0x007d; i++, j++, k++ ) {
+ array[j] = new TestCase( SECTION,
+ "String.lastIndexOf("+(String.fromCharCode(i) +
+ String.fromCharCode(i+1)+
+ String.fromCharCode(i+2)) +", "+ k+1 +")",
+ k,
+ TEST_STRING.lastIndexOf( (String.fromCharCode(i)+
+ String.fromCharCode(i+1)+
+ String.fromCharCode(i+2)),
+ k+1 ) );
+ }
+ for ( k = 0, i = 0x0020; i < 0x007d; i++, j++, k++ ) {
+ array[j] = new TestCase( SECTION,
+ "String.lastIndexOf("+
+ (String.fromCharCode(i) +
+ String.fromCharCode(i+1)+
+ String.fromCharCode(i+2)) +", "+ (k-1) +")",
+ LastIndexOf( TEST_STRING, String.fromCharCode(i) +
+ String.fromCharCode(i+1)+String.fromCharCode(i+2), k-1),
+ TEST_STRING.lastIndexOf( (String.fromCharCode(i)+
+ String.fromCharCode(i+1)+
+ String.fromCharCode(i+2)),
+ k-1 ) );
+ }
+
+ array[j++] = new TestCase( SECTION, "String.lastIndexOf(" +TEST_STRING + ", 0 )", 0, TEST_STRING.lastIndexOf( TEST_STRING, 0 ) );
+// array[j++] = new TestCase( SECTION, "String.lastIndexOf(" +TEST_STRING + ", 1 )", 0, TEST_STRING.lastIndexOf( TEST_STRING, 1 ));
+ array[j++] = new TestCase( SECTION, "String.lastIndexOf(" +TEST_STRING + ")", 0, TEST_STRING.lastIndexOf( TEST_STRING ));
+
+ return array;
+}
+
+function test() {
+ writeLineToLog( "TEST_STRING = new String(\" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\")" );
+
+ for ( tc = 0; tc < testcases.length; tc++ ) {
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "
+
+ }
+ stopTest();
+
+ return ( testcases );
+}
+
+function LastIndexOf( string, search, position ) {
+ string = String( string );
+ search = String( search );
+
+ position = Number( position )
+
+ if ( isNaN( position ) ) {
+ position = Infinity;
+ } else {
+ position = ToInteger( position );
+ }
+
+ result5= string.length;
+ result6 = Math.min(Math.max(position, 0), result5);
+ result7 = search.length;
+
+ if (result7 == 0) {
+ return Math.min(position, result5);
+ }
+
+ result8 = -1;
+
+ for ( k = 0; k <= result6; k++ ) {
+ if ( k+ result7 > result5 ) {
+ break;
+ }
+ for ( j = 0; j < result7; j++ ) {
+ if ( string.charAt(k+j) != search.charAt(j) ){
+ break;
+ } else {
+ if ( j == result7 -1 ) {
+ result8 = k;
+ }
+ }
+ }
+ }
+
+ return result8;
+}
+function ToInteger( n ) {
+ n = Number( n );
+ if ( isNaN(n) ) {
+ return 0;
+ }
+ if ( Math.abs(n) == 0 || Math.abs(n) == Infinity ) {
+ return n;
+ }
+
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ return ( sign * Math.floor(Math.abs(n)) );
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.7-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.7-2.js
new file mode 100644
index 0000000..9972c7e
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.7-2.js
@@ -0,0 +1,220 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.5.4.7-2.js
+ ECMA Section: 15.5.4.7 String.prototype.lastIndexOf( searchString, pos)
+ Description:
+
+ If the given searchString appears as a substring of the result of
+ converting this object to a string, at one or more positions that are
+ at or to the left of the specified position, then the index of the
+ rightmost such position is returned; otherwise -1 is returned. If position
+ is undefined or not supplied, the length of this string value is assumed,
+ so as to search all of the string.
+
+ When the lastIndexOf method is called with two arguments searchString and
+ position, the following steps are taken:
+
+ 1.Call ToString, giving it the this value as its argument.
+ 2.Call ToString(searchString).
+ 3.Call ToNumber(position). (If position is undefined or not supplied, this step produces the value NaN).
+ 4.If Result(3) is NaN, use +; otherwise, call ToInteger(Result(3)).
+ 5.Compute the number of characters in Result(1).
+ 6.Compute min(max(Result(4), 0), Result(5)).
+ 7.Compute the number of characters in the string that is Result(2).
+ 8.Compute the largest possible integer k not larger than Result(6) such that k+Result(7) is not greater
+ than Result(5), and for all nonnegative integers j less than Result(7), the character at position k+j of
+ Result(1) is the same as the character at position j of Result(2); but if there is no such integer k, then
+ compute the value -1.
+
+ 1.Return Result(8).
+
+ Note that the lastIndexOf function is intentionally generic; it does not require that its this value be a
+ String object. Therefore it can be transferred to other kinds of objects for use as a method.
+
+ Author: christine@netscape.com, pschwartau@netscape.com
+ Date: 02 October 1997
+ Modified: 14 July 2002
+ Reason: See http://bugzilla.mozilla.org/show_bug.cgi?id=155289
+ ECMA-262 Ed.3 Section 15.5.4.8
+ The length property of the lastIndexOf method is 1
+*
+*/
+ var SECTION = "15.5.4.7-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "String.protoype.lastIndexOf";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "String.prototype.lastIndexOf.length", 1, String.prototype.lastIndexOf.length );
+ array[item++] = new TestCase( SECTION, "delete String.prototype.lastIndexOf.length", false, delete String.prototype.lastIndexOf.length );
+ array[item++] = new TestCase( SECTION, "delete String.prototype.lastIndexOf.length; String.prototype.lastIndexOf.length", 1, eval("delete String.prototype.lastIndexOf.length; String.prototype.lastIndexOf.length" ) );
+
+ array[item++] = new TestCase( SECTION, "var s = new String(''); s.lastIndexOf('', 0)", LastIndexOf("","",0), eval("var s = new String(''); s.lastIndexOf('', 0)") );
+ array[item++] = new TestCase( SECTION, "var s = new String(''); s.lastIndexOf('')", LastIndexOf("",""), eval("var s = new String(''); s.lastIndexOf('')") );
+ array[item++] = new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('', 0)", LastIndexOf("hello","",0), eval("var s = new String('hello'); s.lastIndexOf('',0)") );
+ array[item++] = new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('')", LastIndexOf("hello",""), eval("var s = new String('hello'); s.lastIndexOf('')") );
+
+ array[item++] = new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll')", LastIndexOf("hello","ll"), eval("var s = new String('hello'); s.lastIndexOf('ll')") );
+ array[item++] = new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', 0)", LastIndexOf("hello","ll",0), eval("var s = new String('hello'); s.lastIndexOf('ll', 0)") );
+ array[item++] = new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', 1)", LastIndexOf("hello","ll",1), eval("var s = new String('hello'); s.lastIndexOf('ll', 1)") );
+ array[item++] = new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', 2)", LastIndexOf("hello","ll",2), eval("var s = new String('hello'); s.lastIndexOf('ll', 2)") );
+ array[item++] = new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', 3)", LastIndexOf("hello","ll",3), eval("var s = new String('hello'); s.lastIndexOf('ll', 3)") );
+ array[item++] = new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', 4)", LastIndexOf("hello","ll",4), eval("var s = new String('hello'); s.lastIndexOf('ll', 4)") );
+ array[item++] = new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', 5)", LastIndexOf("hello","ll",5), eval("var s = new String('hello'); s.lastIndexOf('ll', 5)") );
+ array[item++] = new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', 6)", LastIndexOf("hello","ll",6), eval("var s = new String('hello'); s.lastIndexOf('ll', 6)") );
+
+ array[item++] = new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', 1.5)", LastIndexOf('hello','ll', 1.5), eval("var s = new String('hello'); s.lastIndexOf('ll', 1.5)") );
+ array[item++] = new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', 2.5)", LastIndexOf('hello','ll', 2.5), eval("var s = new String('hello'); s.lastIndexOf('ll', 2.5)") );
+ array[item++] = new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', -1)", LastIndexOf('hello','ll', -1), eval("var s = new String('hello'); s.lastIndexOf('ll', -1)") );
+ array[item++] = new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', -1.5)",LastIndexOf('hello','ll', -1.5), eval("var s = new String('hello'); s.lastIndexOf('ll', -1.5)") );
+
+ array[item++] = new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', -Infinity)", LastIndexOf("hello","ll",-Infinity), eval("var s = new String('hello'); s.lastIndexOf('ll', -Infinity)") );
+ array[item++] = new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', Infinity)", LastIndexOf("hello","ll",Infinity), eval("var s = new String('hello'); s.lastIndexOf('ll', Infinity)") );
+ array[item++] = new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', NaN)", LastIndexOf("hello","ll",NaN), eval("var s = new String('hello'); s.lastIndexOf('ll', NaN)") );
+ array[item++] = new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', -0)", LastIndexOf("hello","ll",-0), eval("var s = new String('hello'); s.lastIndexOf('ll', -0)") );
+ for ( var i = 0; i < ( "[object Object]" ).length; i++ ) {
+ array[item++] = new TestCase( SECTION,
+ "var o = new Object(); o.lastIndexOf = String.prototype.lastIndexOf; o.lastIndexOf('b', "+ i + ")",
+ ( i < 2 ? -1 : ( i < 9 ? 2 : 9 )) ,
+ eval("var o = new Object(); o.lastIndexOf = String.prototype.lastIndexOf; o.lastIndexOf('b', "+ i + ")") );
+ }
+ for ( var i = 0; i < 5; i ++ ) {
+ array[item++] = new TestCase( SECTION,
+ "var b = new Boolean(); b.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('l', "+ i + ")",
+ ( i < 2 ? -1 : 2 ),
+ eval("var b = new Boolean(); b.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('l', "+ i + ")") );
+ }
+ for ( var i = 0; i < 5; i ++ ) {
+ array[item++] = new TestCase( SECTION,
+ "var b = new Boolean(); b.toString = Object.prototype.toString; b.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('o', "+ i + ")",
+ ( i < 1 ? -1 : ( i < 9 ? 1 : ( i < 10 ? 9 : 10 ) ) ),
+ eval("var b = new Boolean(); b.toString = Object.prototype.toString; b.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('o', "+ i + ")") );
+ }
+ for ( var i = 0; i < 9; i++ ) {
+ array[item++] = new TestCase( SECTION,
+ "var n = new Number(Infinity); n.lastIndexOf = String.prototype.lastIndexOf; n.lastIndexOf( 'i', " + i + " )",
+ ( i < 3 ? -1 : ( i < 5 ? 3 : 5 ) ),
+ eval("var n = new Number(Infinity); n.lastIndexOf = String.prototype.lastIndexOf; n.lastIndexOf( 'i', " + i + " )") );
+ }
+ var a = new Array( "abc","def","ghi","jkl","mno","pqr","stu","vwx","yz" );
+
+ for ( var i = 0; i < (a.toString()).length; i++ ) {
+ array[item++] = new TestCase( SECTION,
+ "var a = new Array( 'abc','def','ghi','jkl','mno','pqr','stu','vwx','yz' ); a.lastIndexOf = String.prototype.lastIndexOf; a.lastIndexOf( ',mno,p', "+i+" )",
+ ( i < 15 ? -1 : 15 ),
+ eval("var a = new Array( 'abc','def','ghi','jkl','mno','pqr','stu','vwx','yz' ); a.lastIndexOf = String.prototype.lastIndexOf; a.lastIndexOf( ',mno,p', "+i+" )") );
+ }
+
+ for ( var i = 0; i < 15; i ++ ) {
+ array[item++] = new TestCase( SECTION,
+ "var m = Math; m.lastIndexOf = String.prototype.lastIndexOf; m.lastIndexOf('t', "+ i + ")",
+ ( i < 6 ? -1 : ( i < 10 ? 6 : 10 ) ),
+ eval("var m = Math; m.lastIndexOf = String.prototype.lastIndexOf; m.lastIndexOf('t', "+ i + ")") );
+ }
+/*
+ for ( var i = 0; i < 15; i++ ) {
+ array[item++] = new TestCase( SECTION,
+ "var d = new Date(); d.lastIndexOf = String.prototype.lastIndexOf; d.lastIndexOf( '0' )",
+ )
+ }
+
+*/
+ return array;
+}
+
+function test() {
+ for ( tc = 0; tc < testcases.length; tc++ ) {
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "
+ }
+ stopTest();
+
+ return ( testcases );
+}
+
+function LastIndexOf( string, search, position ) {
+ string = String( string );
+ search = String( search );
+
+ position = Number( position )
+
+ if ( isNaN( position ) ) {
+ position = Infinity;
+ } else {
+ position = ToInteger( position );
+ }
+
+ result5= string.length;
+ result6 = Math.min(Math.max(position, 0), result5);
+ result7 = search.length;
+
+ if (result7 == 0) {
+ return Math.min(position, result5);
+ }
+
+ result8 = -1;
+
+ for ( k = 0; k <= result6; k++ ) {
+ if ( k+ result7 > result5 ) {
+ break;
+ }
+ for ( j = 0; j < result7; j++ ) {
+ if ( string.charAt(k+j) != search.charAt(j) ){
+ break;
+ } else {
+ if ( j == result7 -1 ) {
+ result8 = k;
+ }
+ }
+ }
+ }
+
+ return result8;
+}
+function ToInteger( n ) {
+ n = Number( n );
+ if ( isNaN(n) ) {
+ return 0;
+ }
+ if ( Math.abs(n) == 0 || Math.abs(n) == Infinity ) {
+ return n;
+ }
+
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ return ( sign * Math.floor(Math.abs(n)) );
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.7-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.7-3.js
new file mode 100644
index 0000000..aed400c
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.7-3.js
@@ -0,0 +1,166 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.5.4.7-3.js
+ ECMA Section: 15.5.4.7 String.prototype.lastIndexOf( searchString, pos)
+ Description:
+
+ If the given searchString appears as a substring of the result of
+ converting this object to a string, at one or more positions that are
+ at or to the left of the specified position, then the index of the
+ rightmost such position is returned; otherwise -1 is returned. If position
+ is undefined or not supplied, the length of this string value is assumed,
+ so as to search all of the string.
+
+ When the lastIndexOf method is called with two arguments searchString and
+ position, the following steps are taken:
+
+ 1.Call ToString, giving it the this value as its argument.
+ 2.Call ToString(searchString).
+ 3.Call ToNumber(position). (If position is undefined or not supplied, this step produces the value NaN).
+ 4.If Result(3) is NaN, use +; otherwise, call ToInteger(Result(3)).
+ 5.Compute the number of characters in Result(1).
+ 6.Compute min(max(Result(4), 0), Result(5)).
+ 7.Compute the number of characters in the string that is Result(2).
+ 8.Compute the largest possible integer k not larger than Result(6) such that k+Result(7) is not greater
+ than Result(5), and for all nonnegative integers j less than Result(7), the character at position k+j of
+ Result(1) is the same as the character at position j of Result(2); but if there is no such integer k, then
+ compute the value -1.
+
+ 1.Return Result(8).
+
+ Note that the lastIndexOf function is intentionally generic; it does not require that its this value be a
+ String object. Therefore it can be transferred to other kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 2 october 1997
+*/
+ var SECTION = "15.5.4.7-3";
+ var VERSION = "ECMA_2";
+ startTest();
+ var TITLE = "String.protoype.lastIndexOf";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION,
+ "var b = true; b.__proto__.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('r', 0 )",
+ -1,
+ eval("var b = true; b.__proto__.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('r', 0 )") );
+
+ array[item++] = new TestCase( SECTION,
+ "var b = true; b.__proto__.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('r', 1 )",
+ 1,
+ eval("var b = true; b.__proto__.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('r', 1 )") );
+
+ array[item++] = new TestCase( SECTION,
+ "var b = true; b.__proto__.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('r', 2 )",
+ 1,
+ eval("var b = true; b.__proto__.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('r', 2 )") );
+
+ array[item++] = new TestCase( SECTION,
+ "var b = true; b.__proto__.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('r', 10 )",
+ 1,
+ eval("var b = true; b.__proto__.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('r', 10 )") );
+
+ array[item++] = new TestCase( SECTION,
+ "var b = true; b.__proto__.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('r' )",
+ 1,
+ eval("var b = true; b.__proto__.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('r' )") );
+
+ return array;
+}
+
+function test() {
+ for ( tc = 0; tc < testcases.length; tc++ ) {
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "
+ }
+ stopTest();
+
+ return ( testcases );
+}
+
+function LastIndexOf( string, search, position ) {
+ string = String( string );
+ search = String( search );
+
+ position = Number( position )
+
+ if ( isNaN( position ) ) {
+ position = Infinity;
+ } else {
+ position = ToInteger( position );
+ }
+
+ result5= string.length;
+ result6 = Math.min(Math.max(position, 0), result5);
+ result7 = search.length;
+
+ if (result7 == 0) {
+ return Math.min(position, result5);
+ }
+
+ result8 = -1;
+
+ for ( k = 0; k <= result6; k++ ) {
+ if ( k+ result7 > result5 ) {
+ break;
+ }
+ for ( j = 0; j < result7; j++ ) {
+ if ( string.charAt(k+j) != search.charAt(j) ){
+ break;
+ } else {
+ if ( j == result7 -1 ) {
+ result8 = k;
+ }
+ }
+ }
+ }
+
+ return result8;
+}
+function ToInteger( n ) {
+ n = Number( n );
+ if ( isNaN(n) ) {
+ return 0;
+ }
+ if ( Math.abs(n) == 0 || Math.abs(n) == Infinity ) {
+ return n;
+ }
+
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ return ( sign * Math.floor(Math.abs(n)) );
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.8-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.8-1.js
new file mode 100644
index 0000000..1dddd41
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.8-1.js
@@ -0,0 +1,234 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.5.4.8-1.js
+ ECMA Section: 15.5.4.8 String.prototype.split( separator )
+ Description:
+
+ Returns an Array object into which substrings of the result of converting
+ this object to a string have been stored. The substrings are determined by
+ searching from left to right for occurrences of the given separator; these
+ occurrences are not part of any substring in the returned array, but serve
+ to divide up this string value. The separator may be a string of any length.
+
+ As a special case, if the separator is the empty string, the string is split
+ up into individual characters; the length of the result array equals the
+ length of the string, and each substring contains one character.
+
+ If the separator is not supplied, then the result array contains just one
+ string, which is the string.
+
+ Author: christine@netscape.com, pschwartau@netscape.com
+ Date: 12 November 1997
+ Modified: 14 July 2002
+ Reason: See http://bugzilla.mozilla.org/show_bug.cgi?id=155289
+ ECMA-262 Ed.3 Section 15.5.4.14
+ The length property of the split method is 2
+*
+*/
+
+ var SECTION = "15.5.4.8-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "String.prototype.split";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "String.prototype.split.length", 2, String.prototype.split.length );
+ array[item++] = new TestCase( SECTION, "delete String.prototype.split.length", false, delete String.prototype.split.length );
+ array[item++] = new TestCase( SECTION, "delete String.prototype.split.length; String.prototype.split.length", 2, eval("delete String.prototype.split.length; String.prototype.split.length") );
+
+ // test cases for when split is called with no arguments.
+
+ // this is a string object
+
+ array[item++] = new TestCase( SECTION,
+ "var s = new String('this is a string object'); typeof s.split()",
+ "object",
+ eval("var s = new String('this is a string object'); typeof s.split()") );
+
+ array[item++] = new TestCase( SECTION,
+ "var s = new String('this is a string object'); Array.prototype.getClass = Object.prototype.toString; (s.split()).getClass()",
+ "[object Array]",
+ eval("var s = new String('this is a string object'); Array.prototype.getClass = Object.prototype.toString; (s.split()).getClass()") );
+
+ array[item++] = new TestCase( SECTION,
+ "var s = new String('this is a string object'); s.split().length",
+ 1,
+ eval("var s = new String('this is a string object'); s.split().length") );
+
+ array[item++] = new TestCase( SECTION,
+ "var s = new String('this is a string object'); s.split()[0]",
+ "this is a string object",
+ eval("var s = new String('this is a string object'); s.split()[0]") );
+
+ // this is an object object
+ array[item++] = new TestCase( SECTION,
+ "var obj = new Object(); obj.split = String.prototype.split; typeof obj.split()",
+ "object",
+ eval("var obj = new Object(); obj.split = String.prototype.split; typeof obj.split()") );
+
+ array[item++] = new TestCase( SECTION,
+ "var obj = new Object(); obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.getClass()",
+ "[object Array]",
+ eval("var obj = new Object(); obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.split().getClass()") );
+
+ array[item++] = new TestCase( SECTION,
+ "var obj = new Object(); obj.split = String.prototype.split; obj.split().length",
+ 1,
+ eval("var obj = new Object(); obj.split = String.prototype.split; obj.split().length") );
+
+ array[item++] = new TestCase( SECTION,
+ "var obj = new Object(); obj.split = String.prototype.split; obj.split()[0]",
+ "[object Object]",
+ eval("var obj = new Object(); obj.split = String.prototype.split; obj.split()[0]") );
+
+ // this is a function object
+ array[item++] = new TestCase( SECTION,
+ "var obj = new Function(); obj.split = String.prototype.split; typeof obj.split()",
+ "object",
+ eval("var obj = new Function(); obj.split = String.prototype.split; typeof obj.split()") );
+
+ array[item++] = new TestCase( SECTION,
+ "var obj = new Function(); obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.getClass()",
+ "[object Array]",
+ eval("var obj = new Function(); obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.split().getClass()") );
+
+ array[item++] = new TestCase( SECTION,
+ "var obj = new Function(); obj.split = String.prototype.split; obj.split().length",
+ 1,
+ eval("var obj = new Function(); obj.split = String.prototype.split; obj.split().length") );
+
+ array[item++] = new TestCase( SECTION,
+ "var obj = new Function(); obj.split = String.prototype.split; obj.toString = Object.prototype.toString; obj.split()[0]",
+ "[object Function]",
+ eval("var obj = new Function(); obj.split = String.prototype.split; obj.toString = Object.prototype.toString; obj.split()[0]") );
+
+ // this is a number object
+ array[item++] = new TestCase( SECTION,
+ "var obj = new Number(NaN); obj.split = String.prototype.split; typeof obj.split()",
+ "object",
+ eval("var obj = new Number(NaN); obj.split = String.prototype.split; typeof obj.split()") );
+
+ array[item++] = new TestCase( SECTION,
+ "var obj = new Number(Infinity); obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.getClass()",
+ "[object Array]",
+ eval("var obj = new Number(Infinity); obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.split().getClass()") );
+
+ array[item++] = new TestCase( SECTION,
+ "var obj = new Number(-1234567890); obj.split = String.prototype.split; obj.split().length",
+ 1,
+ eval("var obj = new Number(-1234567890); obj.split = String.prototype.split; obj.split().length") );
+
+ array[item++] = new TestCase( SECTION,
+ "var obj = new Number(-1e21); obj.split = String.prototype.split; obj.split()[0]",
+ "-1e+21",
+ eval("var obj = new Number(-1e21); obj.split = String.prototype.split; obj.split()[0]") );
+
+
+ // this is the Math object
+ array[item++] = new TestCase( SECTION,
+ "var obj = Math; obj.split = String.prototype.split; typeof obj.split()",
+ "object",
+ eval("var obj = Math; obj.split = String.prototype.split; typeof obj.split()") );
+
+ array[item++] = new TestCase( SECTION,
+ "var obj = Math; obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.getClass()",
+ "[object Array]",
+ eval("var obj = Math; obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.split().getClass()") );
+
+ array[item++] = new TestCase( SECTION,
+ "var obj = Math; obj.split = String.prototype.split; obj.split().length",
+ 1,
+ eval("var obj = Math; obj.split = String.prototype.split; obj.split().length") );
+
+ array[item++] = new TestCase( SECTION,
+ "var obj = Math; obj.split = String.prototype.split; obj.split()[0]",
+ "[object Math]",
+ eval("var obj = Math; obj.split = String.prototype.split; obj.split()[0]") );
+
+ // this is an array object
+ array[item++] = new TestCase( SECTION,
+ "var obj = new Array(1,2,3,4,5); obj.split = String.prototype.split; typeof obj.split()",
+ "object",
+ eval("var obj = new Array(1,2,3,4,5); obj.split = String.prototype.split; typeof obj.split()") );
+
+ array[item++] = new TestCase( SECTION,
+ "var obj = new Array(1,2,3,4,5); obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.getClass()",
+ "[object Array]",
+ eval("var obj = new Array(1,2,3,4,5); obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.split().getClass()") );
+
+ array[item++] = new TestCase( SECTION,
+ "var obj = new Array(1,2,3,4,5); obj.split = String.prototype.split; obj.split().length",
+ 1,
+ eval("var obj = new Array(1,2,3,4,5); obj.split = String.prototype.split; obj.split().length") );
+
+ array[item++] = new TestCase( SECTION,
+ "var obj = new Array(1,2,3,4,5); obj.split = String.prototype.split; obj.split()[0]",
+ "1,2,3,4,5",
+ eval("var obj = new Array(1,2,3,4,5); obj.split = String.prototype.split; obj.split()[0]") );
+
+ // this is a Boolean object
+
+ array[item++] = new TestCase( SECTION,
+ "var obj = new Boolean(); obj.split = String.prototype.split; typeof obj.split()",
+ "object",
+ eval("var obj = new Boolean(); obj.split = String.prototype.split; typeof obj.split()") );
+
+ array[item++] = new TestCase( SECTION,
+ "var obj = new Boolean(); obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.getClass()",
+ "[object Array]",
+ eval("var obj = new Boolean(); obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.split().getClass()") );
+
+ array[item++] = new TestCase( SECTION,
+ "var obj = new Boolean(); obj.split = String.prototype.split; obj.split().length",
+ 1,
+ eval("var obj = new Boolean(); obj.split = String.prototype.split; obj.split().length") );
+
+ array[item++] = new TestCase( SECTION,
+ "var obj = new Boolean(); obj.split = String.prototype.split; obj.split()[0]",
+ "false",
+ eval("var obj = new Boolean(); obj.split = String.prototype.split; obj.split()[0]") );
+
+
+ return array;
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.8-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.8-2.js
new file mode 100644
index 0000000..18e41cd
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.8-2.js
@@ -0,0 +1,248 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.5.4.8-2.js
+ ECMA Section: 15.5.4.8 String.prototype.split( separator )
+ Description:
+
+ Returns an Array object into which substrings of the result of converting
+ this object to a string have been stored. The substrings are determined by
+ searching from left to right for occurrences of the given separator; these
+ occurrences are not part of any substring in the returned array, but serve
+ to divide up this string value. The separator may be a string of any length.
+
+ As a special case, if the separator is the empty string, the string is split
+ up into individual characters; the length of the result array equals the
+ length of the string, and each substring contains one character.
+
+ If the separator is not supplied, then the result array contains just one
+ string, which is the string.
+
+ When the split method is called with one argument separator, the following steps are taken:
+
+ 1. Call ToString, giving it the this value as its argument.
+ 2. Create a new Array object of length 0 and call it A.
+ 3. If separator is not supplied, call the [[Put]] method of A with 0 and
+ Result(1) as arguments, and then return A.
+ 4. Call ToString(separator).
+ 5. Compute the number of characters in Result(1).
+ 6. Compute the number of characters in the string that is Result(4).
+ 7. Let p be 0.
+ 8. If Result(6) is zero (the separator string is empty), go to step 17.
+ 9. Compute the smallest possible integer k not smaller than p such that
+ k+Result(6) is not greater than Result(5), and for all nonnegative
+ integers j less than Result(6), the character at position k+j of
+ Result(1) is the same as the character at position j of Result(2);
+ but if there is no such integer k, then go to step 14.
+ 10. Compute a string value equal to the substring of Result(1), consisting
+ of the characters at positions p through k1, inclusive.
+ 11. Call the [[Put]] method of A with A.length and Result(10) as arguments.
+ 12. Let p be k+Result(6).
+ 13. Go to step 9.
+ 14. Compute a string value equal to the substring of Result(1), consisting
+ of the characters from position p to the end of Result(1).
+ 15. Call the [[Put]] method of A with A.length and Result(14) as arguments.
+ 16. Return A.
+ 17. If p equals Result(5), return A.
+ 18. Compute a string value equal to the substring of Result(1), consisting of
+ the single character at position p.
+ 19. Call the [[Put]] method of A with A.length and Result(18) as arguments.
+ 20. Increase p by 1.
+ 21. Go to step 17.
+
+Note that the split function is intentionally generic; it does not require that its this value be a String
+object. Therefore it can be transferred to other kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.5.4.8-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "String.prototype.split";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ // case where separator is the empty string.
+
+ var TEST_STRING = "this is a string object";
+
+ array[item++] = new TestCase( SECTION,
+ "var s = new String( "+ TEST_STRING +" ); s.split('').length",
+ TEST_STRING.length,
+ eval("var s = new String( TEST_STRING ); s.split('').length") );
+
+ for ( var i = 0; i < TEST_STRING.length; i++ ) {
+
+ array[item++] = new TestCase( SECTION,
+ "var s = new String( "+TEST_STRING+" ); s.split('')["+i+"]",
+ TEST_STRING.charAt(i),
+ eval("var s = new String( TEST_STRING ); s.split('')["+i+"]") );
+ }
+
+ // case where the value of the separator is undefined. in this case. the value of the separator
+ // should be ToString( separator ), or "undefined".
+
+ var TEST_STRING = "thisundefinedisundefinedaundefinedstringundefinedobject";
+ var EXPECT_STRING = new Array( "this", "is", "a", "string", "object" );
+
+ array[item++] = new TestCase( SECTION,
+ "var s = new String( "+ TEST_STRING +" ); s.split(void 0).length",
+ EXPECT_STRING.length,
+ eval("var s = new String( TEST_STRING ); s.split(void 0).length") );
+
+ for ( var i = 0; i < EXPECT_STRING.length; i++ ) {
+ array[item++] = new TestCase( SECTION,
+ "var s = new String( "+TEST_STRING+" ); s.split(void 0)["+i+"]",
+ EXPECT_STRING[i],
+ eval("var s = new String( TEST_STRING ); s.split(void 0)["+i+"]") );
+ }
+
+ // case where the value of the separator is null. in this case the value of the separator is "null".
+ TEST_STRING = "thisnullisnullanullstringnullobject";
+ var EXPECT_STRING = new Array( "this", "is", "a", "string", "object" );
+
+ array[item++] = new TestCase( SECTION,
+ "var s = new String( "+ TEST_STRING +" ); s.split(null).length",
+ EXPECT_STRING.length,
+ eval("var s = new String( TEST_STRING ); s.split(null).length") );
+
+ for ( var i = 0; i < EXPECT_STRING.length; i++ ) {
+ array[item++] = new TestCase( SECTION,
+ "var s = new String( "+TEST_STRING+" ); s.split(null)["+i+"]",
+ EXPECT_STRING[i],
+ eval("var s = new String( TEST_STRING ); s.split(null)["+i+"]") );
+ }
+
+ // case where the value of the separator is a boolean.
+ TEST_STRING = "thistrueistrueatruestringtrueobject";
+ var EXPECT_STRING = new Array( "this", "is", "a", "string", "object" );
+
+ array[item++] = new TestCase( SECTION,
+ "var s = new String( "+ TEST_STRING +" ); s.split(true).length",
+ EXPECT_STRING.length,
+ eval("var s = new String( TEST_STRING ); s.split(true).length") );
+
+ for ( var i = 0; i < EXPECT_STRING.length; i++ ) {
+ array[item++] = new TestCase( SECTION,
+ "var s = new String( "+TEST_STRING+" ); s.split(true)["+i+"]",
+ EXPECT_STRING[i],
+ eval("var s = new String( TEST_STRING ); s.split(true)["+i+"]") );
+ }
+
+ // case where the value of the separator is a number
+ TEST_STRING = "this123is123a123string123object";
+ var EXPECT_STRING = new Array( "this", "is", "a", "string", "object" );
+
+ array[item++] = new TestCase( SECTION,
+ "var s = new String( "+ TEST_STRING +" ); s.split(123).length",
+ EXPECT_STRING.length,
+ eval("var s = new String( TEST_STRING ); s.split(123).length") );
+
+ for ( var i = 0; i < EXPECT_STRING.length; i++ ) {
+ array[item++] = new TestCase( SECTION,
+ "var s = new String( "+TEST_STRING+" ); s.split(123)["+i+"]",
+ EXPECT_STRING[i],
+ eval("var s = new String( TEST_STRING ); s.split(123)["+i+"]") );
+ }
+
+
+ // case where the value of the separator is a number
+ TEST_STRING = "this123is123a123string123object";
+ var EXPECT_STRING = new Array( "this", "is", "a", "string", "object" );
+
+ array[item++] = new TestCase( SECTION,
+ "var s = new String( "+ TEST_STRING +" ); s.split(123).length",
+ EXPECT_STRING.length,
+ eval("var s = new String( TEST_STRING ); s.split(123).length") );
+
+ for ( var i = 0; i < EXPECT_STRING.length; i++ ) {
+ array[item++] = new TestCase( SECTION,
+ "var s = new String( "+TEST_STRING+" ); s.split(123)["+i+"]",
+ EXPECT_STRING[i],
+ eval("var s = new String( TEST_STRING ); s.split(123)["+i+"]") );
+ }
+
+ // case where the separator is not in the string
+ TEST_STRING = "this is a string";
+ EXPECT_STRING = new Array( "this is a string" );
+
+ array[item++] = new TestCase( SECTION,
+ "var s = new String( " + TEST_STRING + " ); s.split(':').length",
+ 1,
+ eval("var s = new String( TEST_STRING ); s.split(':').length") );
+
+ array[item++] = new TestCase( SECTION,
+ "var s = new String( " + TEST_STRING + " ); s.split(':')[0]",
+ TEST_STRING,
+ eval("var s = new String( TEST_STRING ); s.split(':')[0]") );
+
+ // case where part but not all of separator is in the string.
+ TEST_STRING = "this is a string";
+ EXPECT_STRING = new Array( "this is a string" );
+ array[item++] = new TestCase( SECTION,
+ "var s = new String( " + TEST_STRING + " ); s.split('strings').length",
+ 1,
+ eval("var s = new String( TEST_STRING ); s.split('strings').length") );
+
+ array[item++] = new TestCase( SECTION,
+ "var s = new String( " + TEST_STRING + " ); s.split('strings')[0]",
+ TEST_STRING,
+ eval("var s = new String( TEST_STRING ); s.split('strings')[0]") );
+
+ // case where the separator is at the end of the string
+ TEST_STRING = "this is a string";
+ EXPECT_STRING = new Array( "this is a " );
+ array[item++] = new TestCase( SECTION,
+ "var s = new String( " + TEST_STRING + " ); s.split('string').length",
+ 2,
+ eval("var s = new String( TEST_STRING ); s.split('string').length") );
+
+ for ( var i = 0; i < EXPECT_STRING.length; i++ ) {
+ array[item++] = new TestCase( SECTION,
+ "var s = new String( "+TEST_STRING+" ); s.split('string')["+i+"]",
+ EXPECT_STRING[i],
+ eval("var s = new String( TEST_STRING ); s.split('string')["+i+"]") );
+ }
+ return array;
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.8-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.8-3.js
new file mode 100644
index 0000000..d3861bb
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.8-3.js
@@ -0,0 +1,205 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.5.4.8-3.js
+ ECMA Section: 15.5.4.8 String.prototype.split( separator )
+ Description:
+
+ Returns an Array object into which substrings of the result of converting
+ this object to a string have been stored. The substrings are determined by
+ searching from left to right for occurrences of the given separator; these
+ occurrences are not part of any substring in the returned array, but serve
+ to divide up this string value. The separator may be a string of any length.
+
+ As a special case, if the separator is the empty string, the string is split
+ up into individual characters; the length of the result array equals the
+ length of the string, and each substring contains one character.
+
+ If the separator is not supplied, then the result array contains just one
+ string, which is the string.
+
+ When the split method is called with one argument separator, the following steps are taken:
+
+ 1. Call ToString, giving it the this value as its argument.
+ 2. Create a new Array object of length 0 and call it A.
+ 3. If separator is not supplied, call the [[Put]] method of A with 0 and
+ Result(1) as arguments, and then return A.
+ 4. Call ToString(separator).
+ 5. Compute the number of characters in Result(1).
+ 6. Compute the number of characters in the string that is Result(4).
+ 7. Let p be 0.
+ 8. If Result(6) is zero (the separator string is empty), go to step 17.
+ 9. Compute the smallest possible integer k not smaller than p such that
+ k+Result(6) is not greater than Result(5), and for all nonnegative
+ integers j less than Result(6), the character at position k+j of
+ Result(1) is the same as the character at position j of Result(2);
+ but if there is no such integer k, then go to step 14.
+ 10. Compute a string value equal to the substring of Result(1), consisting
+ of the characters at positions p through k1, inclusive.
+ 11. Call the [[Put]] method of A with A.length and Result(10) as arguments.
+ 12. Let p be k+Result(6).
+ 13. Go to step 9.
+ 14. Compute a string value equal to the substring of Result(1), consisting
+ of the characters from position p to the end of Result(1).
+ 15. Call the [[Put]] method of A with A.length and Result(14) as arguments.
+ 16. Return A.
+ 17. If p equals Result(5), return A.
+ 18. Compute a string value equal to the substring of Result(1), consisting of
+ the single character at position p.
+ 19. Call the [[Put]] method of A with A.length and Result(18) as arguments.
+ 20. Increase p by 1.
+ 21. Go to step 17.
+
+Note that the split function is intentionally generic; it does not require that its this value be a String
+object. Therefore it can be transferred to other kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.5.4.8-3";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "String.prototype.split";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ var TEST_STRING = "";
+ var EXPECT = new Array();
+
+ // this.toString is the empty string.
+
+ array[item++] = new TestCase( SECTION,
+ "var s = new String(); s.split().length",
+ 1,
+ eval("var s = new String(); s.split().length") );
+
+ array[item++] = new TestCase( SECTION,
+ "var s = new String(); s.split()[0]",
+ "",
+ eval("var s = new String(); s.split()[0]") );
+
+ // this.toString() is the empty string, separator is specified.
+
+ array[item++] = new TestCase( SECTION,
+ "var s = new String(); s.split('').length",
+ 0,
+ eval("var s = new String(); s.split('').length") );
+
+ array[item++] = new TestCase( SECTION,
+ "var s = new String(); s.split(' ').length",
+ 1,
+ eval("var s = new String(); s.split(' ').length") );
+
+ // this to string is " "
+ array[item++] = new TestCase( SECTION,
+ "var s = new String(' '); s.split().length",
+ 1,
+ eval("var s = new String(' '); s.split().length") );
+
+ array[item++] = new TestCase( SECTION,
+ "var s = new String(' '); s.split()[0]",
+ " ",
+ eval("var s = new String(' '); s.split()[0]") );
+
+ array[item++] = new TestCase( SECTION,
+ "var s = new String(' '); s.split('').length",
+ 1,
+ eval("var s = new String(' '); s.split('').length") );
+
+ array[item++] = new TestCase( SECTION,
+ "var s = new String(' '); s.split('')[0]",
+ " ",
+ eval("var s = new String(' '); s.split('')[0]") );
+
+ array[item++] = new TestCase( SECTION,
+ "var s = new String(' '); s.split(' ').length",
+ 2,
+ eval("var s = new String(' '); s.split(' ').length") );
+
+ array[item++] = new TestCase( SECTION,
+ "var s = new String(' '); s.split(' ')[0]",
+ "",
+ eval("var s = new String(' '); s.split(' ')[0]") );
+
+ array[item++] = new TestCase( SECTION,
+ "\"\".split(\"\").length",
+ 0,
+ ("".split("")).length );
+
+ array[item++] = new TestCase( SECTION,
+ "\"\".split(\"x\").length",
+ 1,
+ ("".split("x")).length );
+
+ array[item++] = new TestCase( SECTION,
+ "\"\".split(\"x\")[0]",
+ "",
+ ("".split("x"))[0] );
+
+ return array;
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function Split( string, separator ) {
+ string = String( string );
+
+ var A = new Array();
+
+ if ( arguments.length < 2 ) {
+ A[0] = string;
+ return A;
+ }
+
+ separator = String( separator );
+
+ var str_len = String( string ).length;
+ var sep_len = String( separator ).length;
+
+ var p = 0;
+ var k = 0;
+
+ if ( sep_len == 0 ) {
+ for ( ; p < str_len; p++ ) {
+ A[A.length] = String( string.charAt(p) );
+ }
+ }
+ return A;
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.9-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.9-1.js
new file mode 100644
index 0000000..9ae08dc
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.9-1.js
@@ -0,0 +1,202 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.5.4.9-1.js
+ ECMA Section: 15.5.4.9 String.prototype.substring( start )
+ Description:
+
+ 15.5.4.9 String.prototype.substring(start)
+
+ Returns a substring of the result of converting this object to a string,
+ starting from character position start and running to the end of the
+ string. The result is a string value, not a String object.
+
+ If the argument is NaN or negative, it is replaced with zero; if the
+ argument is larger than the length of the string, it is replaced with the
+ length of the string.
+
+ When the substring method is called with one argument start, the following
+ steps are taken:
+
+ 1.Call ToString, giving it the this value as its argument.
+ 2.Call ToInteger(start).
+ 3.Compute the number of characters in Result(1).
+ 4.Compute min(max(Result(2), 0), Result(3)).
+ 5.Return a string whose length is the difference between Result(3) and Result(4),
+ containing characters from Result(1), namely the characters with indices Result(4)
+ through Result(3)1, in ascending order.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.5.4.9-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "String.prototype.substring( start )";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "String.prototype.substring.length", 2, String.prototype.substring.length );
+ array[item++] = new TestCase( SECTION, "delete String.prototype.substring.length", false, delete String.prototype.substring.length );
+ array[item++] = new TestCase( SECTION, "delete String.prototype.substring.length; String.prototype.substring.length", 2, eval("delete String.prototype.substring.length; String.prototype.substring.length") );
+
+ // test cases for when substring is called with no arguments.
+
+ // this is a string object
+
+ array[item++] = new TestCase( SECTION,
+ "var s = new String('this is a string object'); typeof s.substring()",
+ "string",
+ eval("var s = new String('this is a string object'); typeof s.substring()") );
+
+ array[item++] = new TestCase( SECTION,
+ "var s = new String(''); s.substring()",
+ "",
+ eval("var s = new String(''); s.substring()") );
+
+
+ array[item++] = new TestCase( SECTION,
+ "var s = new String('this is a string object'); s.substring()",
+ "this is a string object",
+ eval("var s = new String('this is a string object'); s.substring()") );
+
+ array[item++] = new TestCase( SECTION,
+ "var s = new String('this is a string object'); s.substring(NaN)",
+ "this is a string object",
+ eval("var s = new String('this is a string object'); s.substring(NaN)") );
+
+
+ array[item++] = new TestCase( SECTION,
+ "var s = new String('this is a string object'); s.substring(-0.01)",
+ "this is a string object",
+ eval("var s = new String('this is a string object'); s.substring(-0.01)") );
+
+
+ array[item++] = new TestCase( SECTION,
+ "var s = new String('this is a string object'); s.substring(s.length)",
+ "",
+ eval("var s = new String('this is a string object'); s.substring(s.length)") );
+
+ array[item++] = new TestCase( SECTION,
+ "var s = new String('this is a string object'); s.substring(s.length+1)",
+ "",
+ eval("var s = new String('this is a string object'); s.substring(s.length+1)") );
+
+
+ array[item++] = new TestCase( SECTION,
+ "var s = new String('this is a string object'); s.substring(Infinity)",
+ "",
+ eval("var s = new String('this is a string object'); s.substring(Infinity)") );
+
+ array[item++] = new TestCase( SECTION,
+ "var s = new String('this is a string object'); s.substring(-Infinity)",
+ "this is a string object",
+ eval("var s = new String('this is a string object'); s.substring(-Infinity)") );
+
+ // this is not a String object, start is not an integer
+
+
+ array[item++] = new TestCase( SECTION,
+ "var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring()",
+ "1,2,3,4,5",
+ eval("var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring()") );
+
+ array[item++] = new TestCase( SECTION,
+ "var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring(true)",
+ ",2,3,4,5",
+ eval("var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring(true)") );
+
+ array[item++] = new TestCase( SECTION,
+ "var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring('4')",
+ "3,4,5",
+ eval("var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring('4')") );
+
+ array[item++] = new TestCase( SECTION,
+ "var s = new Array(); s.substring = String.prototype.substring; s.substring('4')",
+ "",
+ eval("var s = new Array(); s.substring = String.prototype.substring; s.substring('4')") );
+
+ // this is an object object
+ array[item++] = new TestCase( SECTION,
+ "var obj = new Object(); obj.substring = String.prototype.substring; obj.substring(8)",
+ "Object]",
+ eval("var obj = new Object(); obj.substring = String.prototype.substring; obj.substring(8)") );
+
+ // this is a function object
+ array[item++] = new TestCase( SECTION,
+ "var obj = new Function(); obj.substring = String.prototype.substring; obj.toString = Object.prototype.toString; obj.substring(8)",
+ "Function]",
+ eval("var obj = new Function(); obj.substring = String.prototype.substring; obj.toString = Object.prototype.toString; obj.substring(8)") );
+ // this is a number object
+ array[item++] = new TestCase( SECTION,
+ "var obj = new Number(NaN); obj.substring = String.prototype.substring; obj.substring(false)",
+ "NaN",
+ eval("var obj = new Number(NaN); obj.substring = String.prototype.substring; obj.substring(false)") );
+
+ // this is the Math object
+ array[item++] = new TestCase( SECTION,
+ "var obj = Math; obj.substring = String.prototype.substring; obj.substring(Math.PI)",
+ "ject Math]",
+ eval("var obj = Math; obj.substring = String.prototype.substring; obj.substring(Math.PI)") );
+
+ // this is a Boolean object
+
+ array[item++] = new TestCase( SECTION,
+ "var obj = new Boolean(); obj.substring = String.prototype.substring; obj.substring(new Array())",
+ "false",
+ eval("var obj = new Boolean(); obj.substring = String.prototype.substring; obj.substring(new Array())") );
+
+ // this is a user defined object
+
+ array[item++] = new TestCase( SECTION,
+ "var obj = new MyObject( null ); obj.substring(0)",
+ "null",
+ eval( "var obj = new MyObject( null ); obj.substring(0)") );
+
+ return array;
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function MyObject( value ) {
+ this.value = value;
+ this.substring = String.prototype.substring;
+ this.toString = new Function ( "return this.value+''" );
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.js
new file mode 100644
index 0000000..3456a09
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.4.js
@@ -0,0 +1,74 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.5.4.js
+ ECMA Section: 15.5.4 Properties of the String prototype object
+
+ Description:
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+ var SECTION = "15.5.4";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Properties of the String Prototype objecta";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION,
+ "String.prototype.getClass = Object.prototype.toString; String.prototype.getClass()",
+ "[object String]",
+ eval("String.prototype.getClass = Object.prototype.toString; String.prototype.getClass()") );
+
+ array[item++] = new TestCase( SECTION, "typeof String.prototype", "object", typeof String.prototype );
+ array[item++] = new TestCase( SECTION, "String.prototype.valueOf()", "", String.prototype.valueOf() );
+ array[item++] = new TestCase( SECTION, "String.prototype +''", "", String.prototype + '' );
+ array[item++] = new TestCase( SECTION, "String.prototype.length", 0, String.prototype.length );
+// array[item++] = new TestCase( SECTION, "String.prototype.__proto__", Object.prototype, String.prototype.__proto__ );
+
+
+ return ( array );
+}
+function test( array ) {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+
+ }
+
+ stopTest();
+
+ // all tests must return an array of TestCase objects
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.5.1.js b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.5.1.js
new file mode 100644
index 0000000..5f0fe29
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/String/15.5.5.1.js
@@ -0,0 +1,90 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.5.5.1
+ ECMA Section: String.length
+ Description:
+
+ The number of characters in the String value represented by this String
+ object.
+
+ Once a String object is created, this property is unchanging. It has the
+ attributes { DontEnum, DontDelete, ReadOnly }.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.5.5.1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "String.length";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION,
+ "var s = new String(); s.length",
+ 0,
+ eval("var s = new String(); s.length") );
+
+ array[item++] = new TestCase( SECTION,
+ "var s = new String(); s.length = 10; s.length",
+ 0,
+ eval("var s = new String(); s.length = 10; s.length") );
+
+ array[item++] = new TestCase( SECTION,
+ "var s = new String(); var props = ''; for ( var p in s ) { props += p; }; props",
+ "",
+ eval("var s = new String(); var props = ''; for ( var p in s ) { props += p; }; props") );
+
+ array[item++] = new TestCase( SECTION,
+ "var s = new String(); delete s.length",
+ false,
+ eval("var s = new String(); delete s.length") );
+
+ array[item++] = new TestCase( SECTION,
+ "var s = new String('hello'); delete s.length; s.length",
+ 5,
+ eval("var s = new String('hello'); delete s.length; s.length") );
+ return array;
+
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.2.js b/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.2.js
new file mode 100644
index 0000000..c0cb331
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.2.js
@@ -0,0 +1,111 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 9.2.js
+ ECMA Section: 9.2 Type Conversion: ToBoolean
+ Description: rules for converting an argument to a boolean.
+ undefined false
+ Null false
+ Boolean input argument( no conversion )
+ Number returns false for 0, -0, and NaN
+ otherwise return true
+ String return false if the string is empty
+ (length is 0) otherwise the result is
+ true
+ Object all return true
+
+ Author: christine@netscape.com
+ Date: 14 july 1997
+*/
+ var SECTION = "9.2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "ToBoolean";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ // special cases here
+
+ testcases[tc++] = new TestCase( SECTION, "Boolean()", false, Boolean() );
+ testcases[tc++] = new TestCase( SECTION, "Boolean(var x)", false, Boolean(eval("var x")) );
+ testcases[tc++] = new TestCase( SECTION, "Boolean(void 0)", false, Boolean(void 0) );
+ testcases[tc++] = new TestCase( SECTION, "Boolean(null)", false, Boolean(null) );
+ testcases[tc++] = new TestCase( SECTION, "Boolean(false)", false, Boolean(false) );
+ testcases[tc++] = new TestCase( SECTION, "Boolean(true)", true, Boolean(true) );
+ testcases[tc++] = new TestCase( SECTION, "Boolean(0)", false, Boolean(0) );
+ testcases[tc++] = new TestCase( SECTION, "Boolean(-0)", false, Boolean(-0) );
+ testcases[tc++] = new TestCase( SECTION, "Boolean(NaN)", false, Boolean(Number.NaN) );
+ testcases[tc++] = new TestCase( SECTION, "Boolean('')", false, Boolean("") );
+
+ // normal test cases here
+
+ testcases[tc++] = new TestCase( SECTION, "Boolean(Infinity)", true, Boolean(Number.POSITIVE_INFINITY) );
+ testcases[tc++] = new TestCase( SECTION, "Boolean(-Infinity)", true, Boolean(Number.NEGATIVE_INFINITY) );
+ testcases[tc++] = new TestCase( SECTION, "Boolean(Math.PI)", true, Boolean(Math.PI) );
+ testcases[tc++] = new TestCase( SECTION, "Boolean(1)", true, Boolean(1) );
+ testcases[tc++] = new TestCase( SECTION, "Boolean(-1)", true, Boolean(-1) );
+ testcases[tc++] = new TestCase( SECTION, "Boolean([tab])", true, Boolean("\t") );
+ testcases[tc++] = new TestCase( SECTION, "Boolean('0')", true, Boolean("0") );
+ testcases[tc++] = new TestCase( SECTION, "Boolean('string')", true, Boolean("string") );
+
+ // ToBoolean (object) should always return true.
+ testcases[tc++] = new TestCase( SECTION, "Boolean(new String() )", true, Boolean(new String()) );
+ testcases[tc++] = new TestCase( SECTION, "Boolean(new String('') )", true, Boolean(new String("")) );
+
+ testcases[tc++] = new TestCase( SECTION, "Boolean(new Boolean(true))", true, Boolean(new Boolean(true)) );
+ testcases[tc++] = new TestCase( SECTION, "Boolean(new Boolean(false))", true, Boolean(new Boolean(false)) );
+ testcases[tc++] = new TestCase( SECTION, "Boolean(new Boolean() )", true, Boolean(new Boolean()) );
+
+ testcases[tc++] = new TestCase( SECTION, "Boolean(new Array())", true, Boolean(new Array()) );
+
+ testcases[tc++] = new TestCase( SECTION, "Boolean(new Number())", true, Boolean(new Number()) );
+ testcases[tc++] = new TestCase( SECTION, "Boolean(new Number(-0))", true, Boolean(new Number(-0)) );
+ testcases[tc++] = new TestCase( SECTION, "Boolean(new Number(0))", true, Boolean(new Number(0)) );
+ testcases[tc++] = new TestCase( SECTION, "Boolean(new Number(NaN))", true, Boolean(new Number(Number.NaN)) );
+
+ testcases[tc++] = new TestCase( SECTION, "Boolean(new Number(-1))", true, Boolean(new Number(-1)) );
+ testcases[tc++] = new TestCase( SECTION, "Boolean(new Number(Infinity))", true, Boolean(new Number(Number.POSITIVE_INFINITY)) );
+ testcases[tc++] = new TestCase( SECTION, "Boolean(new Number(-Infinity))",true, Boolean(new Number(Number.NEGATIVE_INFINITY)) );
+
+ testcases[tc++] = new TestCase( SECTION, "Boolean(new Object())", true, Boolean(new Object()) );
+ testcases[tc++] = new TestCase( SECTION, "Boolean(new Function())", true, Boolean(new Function()) );
+ testcases[tc++] = new TestCase( SECTION, "Boolean(new Date())", true, Boolean(new Date()) );
+ testcases[tc++] = new TestCase( SECTION, "Boolean(new Date(0))", true, Boolean(new Date(0)) );
+ testcases[tc++] = new TestCase( SECTION, "Boolean(Math)", true, Boolean(Math) );
+
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.3-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.3-1.js
new file mode 100644
index 0000000..39af328
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.3-1.js
@@ -0,0 +1,96 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 9.3-1.js
+ ECMA Section: 9.3 Type Conversion: ToNumber
+ Description: rules for converting an argument to a number.
+ see 9.3.1 for cases for converting strings to numbers.
+ special cases:
+ undefined NaN
+ Null NaN
+ Boolean 1 if true; +0 if false
+ Number the argument ( no conversion )
+ String see test 9.3.1
+ Object see test 9.3-1
+
+
+ This tests ToNumber applied to the object type, except
+ if object is string. See 9.3-2 for
+ ToNumber( String object).
+
+ Author: christine@netscape.com
+ Date: 10 july 1997
+
+*/
+ var SECTION = "9.3-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TYPE = "number";
+ var testcases = getTestCases();
+
+ writeHeaderToLog( SECTION + " ToNumber");
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].passed = writeTestCaseResult(
+ TYPE,
+ typeof(testcases[tc].actual),
+ "typeof( " + testcases[tc].description +
+ " ) = " + typeof(testcases[tc].actual) )
+ ? testcases[tc].passed
+ : false;
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ // object is Number
+ array[item++] = new TestCase( SECTION, "Number(new Number())", 0, Number(new Number()) );
+ array[item++] = new TestCase( SECTION, "Number(new Number(Number.NaN))",Number.NaN, Number(new Number(Number.NaN)) );
+ array[item++] = new TestCase( SECTION, "Number(new Number(0))", 0, Number(new Number(0)) );
+ array[item++] = new TestCase( SECTION, "Number(new Number(null))", 0, Number(new Number(null)) );
+// array[item++] = new TestCase( SECTION, "Number(new Number(void 0))", Number.NaN, Number(new Number(void 0)) );
+ array[item++] = new TestCase( SECTION, "Number(new Number(true))", 1, Number(new Number(true)) );
+ array[item++] = new TestCase( SECTION, "Number(new Number(false))", 0, Number(new Number(false)) );
+
+ // object is boolean
+
+ array[item++] = new TestCase( SECTION, "Number(new Boolean(true))", 1, Number(new Boolean(true)) );
+ array[item++] = new TestCase( SECTION, "Number(new Boolean(false))", 0, Number(new Boolean(false)) );
+
+ // object is array
+ array[item++] = new TestCase( SECTION, "Number(new Array(2,4,8,16,32))", Number.NaN, Number(new Array(2,4,8,16,32)) );
+
+ return ( array );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.3.1-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.3.1-1.js
new file mode 100644
index 0000000..4cc8ce0
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.3.1-1.js
@@ -0,0 +1,323 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 9.3.1-1.js
+ ECMA Section: 9.3 Type Conversion: ToNumber
+ Description: rules for converting an argument to a number.
+ see 9.3.1 for cases for converting strings to numbers.
+ special cases:
+ undefined NaN
+ Null NaN
+ Boolean 1 if true; +0 if false
+ Number the argument ( no conversion )
+ String see test 9.3.1
+ Object see test 9.3-1
+
+
+ This tests ToNumber applied to the string type
+
+ Author: christine@netscape.com
+ Date: 10 july 1997
+
+*/
+ var SECTION = "9.3.1-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "ToNumber applied to the String type";
+ var BUGNUMBER="77391";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ // StringNumericLiteral:::StrWhiteSpace:::StrWhiteSpaceChar StrWhiteSpace:::
+ //
+ // Name Unicode Value Escape Sequence
+ // <TAB> 0X0009 \t
+ // <SP> 0X0020
+ // <FF> 0X000C \f
+ // <VT> 0X000B
+ // <CR> 0X000D \r
+ // <LF> 0X000A \n
+ array[item++] = new TestCase( SECTION, "Number('')", 0, Number("") );
+ array[item++] = new TestCase( SECTION, "Number(' ')", 0, Number(" ") );
+ array[item++] = new TestCase( SECTION, "Number(\\t)", 0, Number("\t") );
+ array[item++] = new TestCase( SECTION, "Number(\\n)", 0, Number("\n") );
+ array[item++] = new TestCase( SECTION, "Number(\\r)", 0, Number("\r") );
+ array[item++] = new TestCase( SECTION, "Number(\\f)", 0, Number("\f") );
+
+ array[item++] = new TestCase( SECTION, "Number(String.fromCharCode(0x0009)", 0, Number(String.fromCharCode(0x0009)) );
+ array[item++] = new TestCase( SECTION, "Number(String.fromCharCode(0x0020)", 0, Number(String.fromCharCode(0x0020)) );
+ array[item++] = new TestCase( SECTION, "Number(String.fromCharCode(0x000C)", 0, Number(String.fromCharCode(0x000C)) );
+ array[item++] = new TestCase( SECTION, "Number(String.fromCharCode(0x000B)", 0, Number(String.fromCharCode(0x000B)) );
+ array[item++] = new TestCase( SECTION, "Number(String.fromCharCode(0x000D)", 0, Number(String.fromCharCode(0x000D)) );
+ array[item++] = new TestCase( SECTION, "Number(String.fromCharCode(0x000A)", 0, Number(String.fromCharCode(0x000A)) );
+
+ // a StringNumericLiteral may be preceeded or followed by whitespace and/or
+ // line terminators
+
+ array[item++] = new TestCase( SECTION, "Number( ' ' + 999 )", 999, Number( ' '+999) );
+ array[item++] = new TestCase( SECTION, "Number( '\\n' + 999 )", 999, Number( '\n' +999) );
+ array[item++] = new TestCase( SECTION, "Number( '\\r' + 999 )", 999, Number( '\r' +999) );
+ array[item++] = new TestCase( SECTION, "Number( '\\t' + 999 )", 999, Number( '\t' +999) );
+ array[item++] = new TestCase( SECTION, "Number( '\\f' + 999 )", 999, Number( '\f' +999) );
+
+ array[item++] = new TestCase( SECTION, "Number( 999 + ' ' )", 999, Number( 999+' ') );
+ array[item++] = new TestCase( SECTION, "Number( 999 + '\\n' )", 999, Number( 999+'\n' ) );
+ array[item++] = new TestCase( SECTION, "Number( 999 + '\\r' )", 999, Number( 999+'\r' ) );
+ array[item++] = new TestCase( SECTION, "Number( 999 + '\\t' )", 999, Number( 999+'\t' ) );
+ array[item++] = new TestCase( SECTION, "Number( 999 + '\\f' )", 999, Number( 999+'\f' ) );
+
+ array[item++] = new TestCase( SECTION, "Number( '\\n' + 999 + '\\n' )", 999, Number( '\n' +999+'\n' ) );
+ array[item++] = new TestCase( SECTION, "Number( '\\r' + 999 + '\\r' )", 999, Number( '\r' +999+'\r' ) );
+ array[item++] = new TestCase( SECTION, "Number( '\\t' + 999 + '\\t' )", 999, Number( '\t' +999+'\t' ) );
+ array[item++] = new TestCase( SECTION, "Number( '\\f' + 999 + '\\f' )", 999, Number( '\f' +999+'\f' ) );
+
+ array[item++] = new TestCase( SECTION, "Number( ' ' + '999' )", 999, Number( ' '+'999') );
+ array[item++] = new TestCase( SECTION, "Number( '\\n' + '999' )", 999, Number( '\n' +'999') );
+ array[item++] = new TestCase( SECTION, "Number( '\\r' + '999' )", 999, Number( '\r' +'999') );
+ array[item++] = new TestCase( SECTION, "Number( '\\t' + '999' )", 999, Number( '\t' +'999') );
+ array[item++] = new TestCase( SECTION, "Number( '\\f' + '999' )", 999, Number( '\f' +'999') );
+
+ array[item++] = new TestCase( SECTION, "Number( '999' + ' ' )", 999, Number( '999'+' ') );
+ array[item++] = new TestCase( SECTION, "Number( '999' + '\\n' )", 999, Number( '999'+'\n' ) );
+ array[item++] = new TestCase( SECTION, "Number( '999' + '\\r' )", 999, Number( '999'+'\r' ) );
+ array[item++] = new TestCase( SECTION, "Number( '999' + '\\t' )", 999, Number( '999'+'\t' ) );
+ array[item++] = new TestCase( SECTION, "Number( '999' + '\\f' )", 999, Number( '999'+'\f' ) );
+
+ array[item++] = new TestCase( SECTION, "Number( '\\n' + '999' + '\\n' )", 999, Number( '\n' +'999'+'\n' ) );
+ array[item++] = new TestCase( SECTION, "Number( '\\r' + '999' + '\\r' )", 999, Number( '\r' +'999'+'\r' ) );
+ array[item++] = new TestCase( SECTION, "Number( '\\t' + '999' + '\\t' )", 999, Number( '\t' +'999'+'\t' ) );
+ array[item++] = new TestCase( SECTION, "Number( '\\f' + '999' + '\\f' )", 999, Number( '\f' +'999'+'\f' ) );
+
+ array[item++] = new TestCase( SECTION, "Number( String.fromCharCode(0x0009) + '99' )", 99, Number( String.fromCharCode(0x0009) + '99' ) );
+ array[item++] = new TestCase( SECTION, "Number( String.fromCharCode(0x0020) + '99' )", 99, Number( String.fromCharCode(0x0020) + '99' ) );
+ array[item++] = new TestCase( SECTION, "Number( String.fromCharCode(0x000C) + '99' )", 99, Number( String.fromCharCode(0x000C) + '99' ) );
+ array[item++] = new TestCase( SECTION, "Number( String.fromCharCode(0x000B) + '99' )", 99, Number( String.fromCharCode(0x000B) + '99' ) );
+ array[item++] = new TestCase( SECTION, "Number( String.fromCharCode(0x000D) + '99' )", 99, Number( String.fromCharCode(0x000D) + '99' ) );
+ array[item++] = new TestCase( SECTION, "Number( String.fromCharCode(0x000A) + '99' )", 99, Number( String.fromCharCode(0x000A) + '99' ) );
+
+ array[item++] = new TestCase( SECTION, "Number( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x0009)", 99, Number( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x0009)) );
+ array[item++] = new TestCase( SECTION, "Number( String.fromCharCode(0x0020) + '99' + String.fromCharCode(0x0020)", 99, Number( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x0020)) );
+ array[item++] = new TestCase( SECTION, "Number( String.fromCharCode(0x000C) + '99' + String.fromCharCode(0x000C)", 99, Number( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x000C)) );
+ array[item++] = new TestCase( SECTION, "Number( String.fromCharCode(0x000D) + '99' + String.fromCharCode(0x000D)", 99, Number( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x000D)) );
+ array[item++] = new TestCase( SECTION, "Number( String.fromCharCode(0x000B) + '99' + String.fromCharCode(0x000B)", 99, Number( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x000B)) );
+ array[item++] = new TestCase( SECTION, "Number( String.fromCharCode(0x000A) + '99' + String.fromCharCode(0x000A)", 99, Number( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x000A)) );
+
+ array[item++] = new TestCase( SECTION, "Number( '99' + String.fromCharCode(0x0009)", 99, Number( '99' + String.fromCharCode(0x0009)) );
+ array[item++] = new TestCase( SECTION, "Number( '99' + String.fromCharCode(0x0020)", 99, Number( '99' + String.fromCharCode(0x0020)) );
+ array[item++] = new TestCase( SECTION, "Number( '99' + String.fromCharCode(0x000C)", 99, Number( '99' + String.fromCharCode(0x000C)) );
+ array[item++] = new TestCase( SECTION, "Number( '99' + String.fromCharCode(0x000D)", 99, Number( '99' + String.fromCharCode(0x000D)) );
+ array[item++] = new TestCase( SECTION, "Number( '99' + String.fromCharCode(0x000B)", 99, Number( '99' + String.fromCharCode(0x000B)) );
+ array[item++] = new TestCase( SECTION, "Number( '99' + String.fromCharCode(0x000A)", 99, Number( '99' + String.fromCharCode(0x000A)) );
+
+ array[item++] = new TestCase( SECTION, "Number( String.fromCharCode(0x0009) + 99 )", 99, Number( String.fromCharCode(0x0009) + 99 ) );
+ array[item++] = new TestCase( SECTION, "Number( String.fromCharCode(0x0020) + 99 )", 99, Number( String.fromCharCode(0x0020) + 99 ) );
+ array[item++] = new TestCase( SECTION, "Number( String.fromCharCode(0x000C) + 99 )", 99, Number( String.fromCharCode(0x000C) + 99 ) );
+ array[item++] = new TestCase( SECTION, "Number( String.fromCharCode(0x000B) + 99 )", 99, Number( String.fromCharCode(0x000B) + 99 ) );
+ array[item++] = new TestCase( SECTION, "Number( String.fromCharCode(0x000D) + 99 )", 99, Number( String.fromCharCode(0x000D) + 99 ) );
+ array[item++] = new TestCase( SECTION, "Number( String.fromCharCode(0x000A) + 99 )", 99, Number( String.fromCharCode(0x000A) + 99 ) );
+
+ array[item++] = new TestCase( SECTION, "Number( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x0009)", 99, Number( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x0009)) );
+ array[item++] = new TestCase( SECTION, "Number( String.fromCharCode(0x0020) + 99 + String.fromCharCode(0x0020)", 99, Number( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x0020)) );
+ array[item++] = new TestCase( SECTION, "Number( String.fromCharCode(0x000C) + 99 + String.fromCharCode(0x000C)", 99, Number( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x000C)) );
+ array[item++] = new TestCase( SECTION, "Number( String.fromCharCode(0x000D) + 99 + String.fromCharCode(0x000D)", 99, Number( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x000D)) );
+ array[item++] = new TestCase( SECTION, "Number( String.fromCharCode(0x000B) + 99 + String.fromCharCode(0x000B)", 99, Number( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x000B)) );
+ array[item++] = new TestCase( SECTION, "Number( String.fromCharCode(0x000A) + 99 + String.fromCharCode(0x000A)", 99, Number( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x000A)) );
+
+ array[item++] = new TestCase( SECTION, "Number( 99 + String.fromCharCode(0x0009)", 99, Number( 99 + String.fromCharCode(0x0009)) );
+ array[item++] = new TestCase( SECTION, "Number( 99 + String.fromCharCode(0x0020)", 99, Number( 99 + String.fromCharCode(0x0020)) );
+ array[item++] = new TestCase( SECTION, "Number( 99 + String.fromCharCode(0x000C)", 99, Number( 99 + String.fromCharCode(0x000C)) );
+ array[item++] = new TestCase( SECTION, "Number( 99 + String.fromCharCode(0x000D)", 99, Number( 99 + String.fromCharCode(0x000D)) );
+ array[item++] = new TestCase( SECTION, "Number( 99 + String.fromCharCode(0x000B)", 99, Number( 99 + String.fromCharCode(0x000B)) );
+ array[item++] = new TestCase( SECTION, "Number( 99 + String.fromCharCode(0x000A)", 99, Number( 99 + String.fromCharCode(0x000A)) );
+
+
+ // StrNumericLiteral:::StrDecimalLiteral:::Infinity
+
+ array[item++] = new TestCase( SECTION, "Number('Infinity')", Math.pow(10,10000), Number("Infinity") );
+ array[item++] = new TestCase( SECTION, "Number('-Infinity')", -Math.pow(10,10000), Number("-Infinity") );
+ array[item++] = new TestCase( SECTION, "Number('+Infinity')", Math.pow(10,10000), Number("+Infinity") );
+
+ // StrNumericLiteral::: StrDecimalLiteral ::: DecimalDigits . DecimalDigits opt ExponentPart opt
+
+ array[item++] = new TestCase( SECTION, "Number('0')", 0, Number("0") );
+ array[item++] = new TestCase( SECTION, "Number('-0')", -0, Number("-0") );
+ array[item++] = new TestCase( SECTION, "Number('+0')", 0, Number("+0") );
+
+ array[item++] = new TestCase( SECTION, "Number('1')", 1, Number("1") );
+ array[item++] = new TestCase( SECTION, "Number('-1')", -1, Number("-1") );
+ array[item++] = new TestCase( SECTION, "Number('+1')", 1, Number("+1") );
+
+ array[item++] = new TestCase( SECTION, "Number('2')", 2, Number("2") );
+ array[item++] = new TestCase( SECTION, "Number('-2')", -2, Number("-2") );
+ array[item++] = new TestCase( SECTION, "Number('+2')", 2, Number("+2") );
+
+ array[item++] = new TestCase( SECTION, "Number('3')", 3, Number("3") );
+ array[item++] = new TestCase( SECTION, "Number('-3')", -3, Number("-3") );
+ array[item++] = new TestCase( SECTION, "Number('+3')", 3, Number("+3") );
+
+ array[item++] = new TestCase( SECTION, "Number('4')", 4, Number("4") );
+ array[item++] = new TestCase( SECTION, "Number('-4')", -4, Number("-4") );
+ array[item++] = new TestCase( SECTION, "Number('+4')", 4, Number("+4") );
+
+ array[item++] = new TestCase( SECTION, "Number('5')", 5, Number("5") );
+ array[item++] = new TestCase( SECTION, "Number('-5')", -5, Number("-5") );
+ array[item++] = new TestCase( SECTION, "Number('+5')", 5, Number("+5") );
+
+ array[item++] = new TestCase( SECTION, "Number('6')", 6, Number("6") );
+ array[item++] = new TestCase( SECTION, "Number('-6')", -6, Number("-6") );
+ array[item++] = new TestCase( SECTION, "Number('+6')", 6, Number("+6") );
+
+ array[item++] = new TestCase( SECTION, "Number('7')", 7, Number("7") );
+ array[item++] = new TestCase( SECTION, "Number('-7')", -7, Number("-7") );
+ array[item++] = new TestCase( SECTION, "Number('+7')", 7, Number("+7") );
+
+ array[item++] = new TestCase( SECTION, "Number('8')", 8, Number("8") );
+ array[item++] = new TestCase( SECTION, "Number('-8')", -8, Number("-8") );
+ array[item++] = new TestCase( SECTION, "Number('+8')", 8, Number("+8") );
+
+ array[item++] = new TestCase( SECTION, "Number('9')", 9, Number("9") );
+ array[item++] = new TestCase( SECTION, "Number('-9')", -9, Number("-9") );
+ array[item++] = new TestCase( SECTION, "Number('+9')", 9, Number("+9") );
+
+ array[item++] = new TestCase( SECTION, "Number('3.14159')", 3.14159, Number("3.14159") );
+ array[item++] = new TestCase( SECTION, "Number('-3.14159')", -3.14159, Number("-3.14159") );
+ array[item++] = new TestCase( SECTION, "Number('+3.14159')", 3.14159, Number("+3.14159") );
+
+ array[item++] = new TestCase( SECTION, "Number('3.')", 3, Number("3.") );
+ array[item++] = new TestCase( SECTION, "Number('-3.')", -3, Number("-3.") );
+ array[item++] = new TestCase( SECTION, "Number('+3.')", 3, Number("+3.") );
+
+ array[item++] = new TestCase( SECTION, "Number('3.e1')", 30, Number("3.e1") );
+ array[item++] = new TestCase( SECTION, "Number('-3.e1')", -30, Number("-3.e1") );
+ array[item++] = new TestCase( SECTION, "Number('+3.e1')", 30, Number("+3.e1") );
+
+ array[item++] = new TestCase( SECTION, "Number('3.e+1')", 30, Number("3.e+1") );
+ array[item++] = new TestCase( SECTION, "Number('-3.e+1')", -30, Number("-3.e+1") );
+ array[item++] = new TestCase( SECTION, "Number('+3.e+1')", 30, Number("+3.e+1") );
+
+ array[item++] = new TestCase( SECTION, "Number('3.e-1')", .30, Number("3.e-1") );
+ array[item++] = new TestCase( SECTION, "Number('-3.e-1')", -.30, Number("-3.e-1") );
+ array[item++] = new TestCase( SECTION, "Number('+3.e-1')", .30, Number("+3.e-1") );
+
+ // StrDecimalLiteral::: .DecimalDigits ExponentPart opt
+
+ array[item++] = new TestCase( SECTION, "Number('.00001')", 0.00001, Number(".00001") );
+ array[item++] = new TestCase( SECTION, "Number('+.00001')", 0.00001, Number("+.00001") );
+ array[item++] = new TestCase( SECTION, "Number('-0.0001')", -0.00001, Number("-.00001") );
+
+ array[item++] = new TestCase( SECTION, "Number('.01e2')", 1, Number(".01e2") );
+ array[item++] = new TestCase( SECTION, "Number('+.01e2')", 1, Number("+.01e2") );
+ array[item++] = new TestCase( SECTION, "Number('-.01e2')", -1, Number("-.01e2") );
+
+ array[item++] = new TestCase( SECTION, "Number('.01e+2')", 1, Number(".01e+2") );
+ array[item++] = new TestCase( SECTION, "Number('+.01e+2')", 1, Number("+.01e+2") );
+ array[item++] = new TestCase( SECTION, "Number('-.01e+2')", -1, Number("-.01e+2") );
+
+ array[item++] = new TestCase( SECTION, "Number('.01e-2')", 0.0001, Number(".01e-2") );
+ array[item++] = new TestCase( SECTION, "Number('+.01e-2')", 0.0001, Number("+.01e-2") );
+ array[item++] = new TestCase( SECTION, "Number('-.01e-2')", -0.0001, Number("-.01e-2") );
+
+ // StrDecimalLiteral::: DecimalDigits ExponentPart opt
+
+ array[item++] = new TestCase( SECTION, "Number('1234e5')", 123400000, Number("1234e5") );
+ array[item++] = new TestCase( SECTION, "Number('+1234e5')", 123400000, Number("+1234e5") );
+ array[item++] = new TestCase( SECTION, "Number('-1234e5')", -123400000, Number("-1234e5") );
+
+ array[item++] = new TestCase( SECTION, "Number('1234e+5')", 123400000, Number("1234e+5") );
+ array[item++] = new TestCase( SECTION, "Number('+1234e+5')", 123400000, Number("+1234e+5") );
+ array[item++] = new TestCase( SECTION, "Number('-1234e+5')", -123400000, Number("-1234e+5") );
+
+ array[item++] = new TestCase( SECTION, "Number('1234e-5')", 0.01234, Number("1234e-5") );
+ array[item++] = new TestCase( SECTION, "Number('+1234e-5')", 0.01234, Number("+1234e-5") );
+ array[item++] = new TestCase( SECTION, "Number('-1234e-5')", -0.01234, Number("-1234e-5") );
+
+ // StrNumericLiteral::: HexIntegerLiteral
+
+ array[item++] = new TestCase( SECTION, "Number('0x0')", 0, Number("0x0"));
+ array[item++] = new TestCase( SECTION, "Number('0x1')", 1, Number("0x1"));
+ array[item++] = new TestCase( SECTION, "Number('0x2')", 2, Number("0x2"));
+ array[item++] = new TestCase( SECTION, "Number('0x3')", 3, Number("0x3"));
+ array[item++] = new TestCase( SECTION, "Number('0x4')", 4, Number("0x4"));
+ array[item++] = new TestCase( SECTION, "Number('0x5')", 5, Number("0x5"));
+ array[item++] = new TestCase( SECTION, "Number('0x6')", 6, Number("0x6"));
+ array[item++] = new TestCase( SECTION, "Number('0x7')", 7, Number("0x7"));
+ array[item++] = new TestCase( SECTION, "Number('0x8')", 8, Number("0x8"));
+ array[item++] = new TestCase( SECTION, "Number('0x9')", 9, Number("0x9"));
+ array[item++] = new TestCase( SECTION, "Number('0xa')", 10, Number("0xa"));
+ array[item++] = new TestCase( SECTION, "Number('0xb')", 11, Number("0xb"));
+ array[item++] = new TestCase( SECTION, "Number('0xc')", 12, Number("0xc"));
+ array[item++] = new TestCase( SECTION, "Number('0xd')", 13, Number("0xd"));
+ array[item++] = new TestCase( SECTION, "Number('0xe')", 14, Number("0xe"));
+ array[item++] = new TestCase( SECTION, "Number('0xf')", 15, Number("0xf"));
+ array[item++] = new TestCase( SECTION, "Number('0xA')", 10, Number("0xA"));
+ array[item++] = new TestCase( SECTION, "Number('0xB')", 11, Number("0xB"));
+ array[item++] = new TestCase( SECTION, "Number('0xC')", 12, Number("0xC"));
+ array[item++] = new TestCase( SECTION, "Number('0xD')", 13, Number("0xD"));
+ array[item++] = new TestCase( SECTION, "Number('0xE')", 14, Number("0xE"));
+ array[item++] = new TestCase( SECTION, "Number('0xF')", 15, Number("0xF"));
+
+ array[item++] = new TestCase( SECTION, "Number('0X0')", 0, Number("0X0"));
+ array[item++] = new TestCase( SECTION, "Number('0X1')", 1, Number("0X1"));
+ array[item++] = new TestCase( SECTION, "Number('0X2')", 2, Number("0X2"));
+ array[item++] = new TestCase( SECTION, "Number('0X3')", 3, Number("0X3"));
+ array[item++] = new TestCase( SECTION, "Number('0X4')", 4, Number("0X4"));
+ array[item++] = new TestCase( SECTION, "Number('0X5')", 5, Number("0X5"));
+ array[item++] = new TestCase( SECTION, "Number('0X6')", 6, Number("0X6"));
+ array[item++] = new TestCase( SECTION, "Number('0X7')", 7, Number("0X7"));
+ array[item++] = new TestCase( SECTION, "Number('0X8')", 8, Number("0X8"));
+ array[item++] = new TestCase( SECTION, "Number('0X9')", 9, Number("0X9"));
+ array[item++] = new TestCase( SECTION, "Number('0Xa')", 10, Number("0Xa"));
+ array[item++] = new TestCase( SECTION, "Number('0Xb')", 11, Number("0Xb"));
+ array[item++] = new TestCase( SECTION, "Number('0Xc')", 12, Number("0Xc"));
+ array[item++] = new TestCase( SECTION, "Number('0Xd')", 13, Number("0Xd"));
+ array[item++] = new TestCase( SECTION, "Number('0Xe')", 14, Number("0Xe"));
+ array[item++] = new TestCase( SECTION, "Number('0Xf')", 15, Number("0Xf"));
+ array[item++] = new TestCase( SECTION, "Number('0XA')", 10, Number("0XA"));
+ array[item++] = new TestCase( SECTION, "Number('0XB')", 11, Number("0XB"));
+ array[item++] = new TestCase( SECTION, "Number('0XC')", 12, Number("0XC"));
+ array[item++] = new TestCase( SECTION, "Number('0XD')", 13, Number("0XD"));
+ array[item++] = new TestCase( SECTION, "Number('0XE')", 14, Number("0XE"));
+ array[item++] = new TestCase( SECTION, "Number('0XF')", 15, Number("0XF"));
+
+ return ( array );
+}
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.3.1-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.3.1-2.js
new file mode 100644
index 0000000..c675e57
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.3.1-2.js
@@ -0,0 +1,89 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 9.3.1-2.js
+ ECMA Section: 9.3 Type Conversion: ToNumber
+ Description: rules for converting an argument to a number.
+ see 9.3.1 for cases for converting strings to numbers.
+ special cases:
+ undefined NaN
+ Null NaN
+ Boolean 1 if true; +0 if false
+ Number the argument ( no conversion )
+ String see test 9.3.1
+ Object see test 9.3-1
+
+ This tests special cases of ToNumber(string) that are
+ not covered in 9.3.1-1.js.
+
+ Author: christine@netscape.com
+ Date: 10 july 1997
+
+*/
+ var SECTION = "9.3.1-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "ToNumber applied to the String type";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ // A StringNumericLiteral may not use octal notation
+
+ array[item++] = new TestCase( SECTION, "Number(00)", 0, Number("00"));
+ array[item++] = new TestCase( SECTION, "Number(01)", 1, Number("01"));
+ array[item++] = new TestCase( SECTION, "Number(02)", 2, Number("02"));
+ array[item++] = new TestCase( SECTION, "Number(03)", 3, Number("03"));
+ array[item++] = new TestCase( SECTION, "Number(04)", 4, Number("04"));
+ array[item++] = new TestCase( SECTION, "Number(05)", 5, Number("05"));
+ array[item++] = new TestCase( SECTION, "Number(06)", 6, Number("06"));
+ array[item++] = new TestCase( SECTION, "Number(07)", 7, Number("07"));
+ array[item++] = new TestCase( SECTION, "Number(010)", 10, Number("010"));
+ array[item++] = new TestCase( SECTION, "Number(011)", 11, Number("011"));
+
+ // A StringNumericLIteral may have any number of leading 0 digits
+
+ array[item++] = new TestCase( SECTION, "Number(001)", 1, Number("001"));
+ array[item++] = new TestCase( SECTION, "Number(0001)", 1, Number("0001"));
+
+ return ( array );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.3.1-3.js b/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.3.1-3.js
new file mode 100644
index 0000000..69407fb
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.3.1-3.js
@@ -0,0 +1,726 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 9.3.1-3.js
+ ECMA Section: 9.3 Type Conversion: ToNumber
+ Description: rules for converting an argument to a number.
+ see 9.3.1 for cases for converting strings to numbers.
+ special cases:
+ undefined NaN
+ Null NaN
+ Boolean 1 if true; +0 if false
+ Number the argument ( no conversion )
+ String see test 9.3.1
+ Object see test 9.3-1
+
+
+ Test cases provided by waldemar.
+
+
+ Author: christine@netscape.com
+ Date: 10 june 1998
+
+*/
+
+var SECTION = "9.3.1-3";
+var VERSION = "ECMA_1";
+ startTest();
+var BUGNUMBER="129087";
+
+var TITLE = "Number To String, String To Number";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var testcases = new Array();
+
+
+// test case from http://scopus.mcom.com/bugsplat/show_bug.cgi?id=312954
+var z = 0;
+
+testcases[tc++] = new TestCase(
+ SECTION,
+ "var z = 0; print(1/-z)",
+ -Infinity,
+ 1/-z );
+
+
+
+
+
+// test cases from bug http://scopus.mcom.com/bugsplat/show_bug.cgi?id=122882
+
+
+
+testcases[tc++] = new TestCase( SECTION,
+ '- -"0x80000000"',
+ 2147483648,
+ - -"0x80000000" );
+
+testcases[tc++] = new TestCase( SECTION,
+ '- -"0x100000000"',
+ 4294967296,
+ - -"0x100000000" );
+
+testcases[tc++] = new TestCase( SECTION,
+ '- "-0x123456789abcde8"',
+ 81985529216486880,
+ - "-0x123456789abcde8" );
+
+// Convert some large numbers to string
+
+
+testcases[tc++] = new TestCase( SECTION,
+ "1e2000 +''",
+ "Infinity",
+ 1e2000 +"" );
+
+testcases[tc++] = new TestCase( SECTION,
+ "1e2000",
+ Infinity,
+ 1e2000 );
+
+testcases[tc++] = new TestCase( SECTION,
+ "-1e2000 +''",
+ "-Infinity",
+ -1e2000 +"" );
+
+testcases[tc++] = new TestCase( SECTION,
+ "-\"1e2000\"",
+ -Infinity,
+ -"1e2000" );
+
+testcases[tc++] = new TestCase( SECTION,
+ "-\"-1e2000\" +''",
+ "Infinity",
+ -"-1e2000" +"" );
+
+testcases[tc++] = new TestCase( SECTION,
+ "1e-2000",
+ 0,
+ 1e-2000 );
+
+testcases[tc++] = new TestCase( SECTION,
+ "1/1e-2000",
+ Infinity,
+ 1/1e-2000 );
+
+// convert some strings to large numbers
+
+testcases[tc++] = new TestCase( SECTION,
+ "1/-1e-2000",
+ -Infinity,
+ 1/-1e-2000 );
+
+testcases[tc++] = new TestCase( SECTION,
+ "1/\"1e-2000\"",
+ Infinity,
+ 1/"1e-2000" );
+
+testcases[tc++] = new TestCase( SECTION,
+ "1/\"-1e-2000\"",
+ -Infinity,
+ 1/"-1e-2000" );
+
+testcases[tc++] = new TestCase( SECTION,
+ "parseFloat(\"1e2000\")",
+ Infinity,
+ parseFloat("1e2000") );
+
+testcases[tc++] = new TestCase( SECTION,
+ "parseFloat(\"1e-2000\")",
+ 0,
+ parseFloat("1e-2000") );
+
+testcases[tc++] = new TestCase( SECTION,
+ "1.7976931348623157E+308",
+ 1.7976931348623157e+308,
+ 1.7976931348623157E+308 );
+
+testcases[tc++] = new TestCase( SECTION,
+ "1.7976931348623158e+308",
+ 1.7976931348623157e+308,
+ 1.7976931348623158e+308 );
+
+testcases[tc++] = new TestCase( SECTION,
+ "1.7976931348623159e+308",
+ Infinity,
+ 1.7976931348623159e+308 );
+
+s =
+"17976931348623158079372897140530341507993413271003782693617377898044496829276475094664901797758720709633028641669288791094655554785194040263065748867150582068";
+
+testcases[tc++] = new TestCase( SECTION,
+ "s = " + s +"; s +="+
+"\"190890200070838367627385484581771153176447573027006985557136695962284291481986083493647529271907416844436551070434271155969950809304288017790417449779\""+
+
++"; s",
+"17976931348623158079372897140530341507993413271003782693617377898044496829276475094664901797758720709633028641669288791094655554785194040263065748867150582068190890200070838367627385484581771153176447573027006985557136695962284291481986083493647529271907416844436551070434271155969950809304288017790417449779",
+s +=
+"190890200070838367627385484581771153176447573027006985557136695962284291481986083493647529271907416844436551070434271155969950809304288017790417449779"
+);
+
+s1 = s+1;
+
+testcases[tc++] = new TestCase( SECTION,
+"s1 = s+1; s1",
+"179769313486231580793728971405303415079934132710037826936173778980444968292764750946649017977587207096330286416692887910946555547851940402630657488671505820681908902000708383676273854845817711531764475730270069855571366959622842914819860834936475292719074168444365510704342711559699508093042880177904174497791",
+s1 );
+
+/***** This answer is preferred but -Infinity is also acceptable here *****/
+
+testcases[tc++] = new TestCase( SECTION,
+"-s1 == Infinity || s1 == 1.7976931348623157e+308",
+true,
+-s1 == Infinity || s1 == 1.7976931348623157e+308 );
+
+s2 = s + 2;
+
+testcases[tc++] = new TestCase( SECTION,
+"s2 = s+2; s2",
+"179769313486231580793728971405303415079934132710037826936173778980444968292764750946649017977587207096330286416692887910946555547851940402630657488671505820681908902000708383676273854845817711531764475730270069855571366959622842914819860834936475292719074168444365510704342711559699508093042880177904174497792",
+s2 );
+
+// ***** This answer is preferred but -1.7976931348623157e+308 is also acceptable here *****
+testcases[tc++] = new TestCase( SECTION,
+"-s2 == -Infinity || -s2 == -1.7976931348623157e+308 ",
+true,
+-s2 == -Infinity || -s2 == -1.7976931348623157e+308 );
+
+s3 = s+3;
+
+testcases[tc++] = new TestCase( SECTION,
+"s3 = s+3; s3",
+"179769313486231580793728971405303415079934132710037826936173778980444968292764750946649017977587207096330286416692887910946555547851940402630657488671505820681908902000708383676273854845817711531764475730270069855571366959622842914819860834936475292719074168444365510704342711559699508093042880177904174497793",
+s3 );
+
+//***** This answer is preferred but -1.7976931348623157e+308 is also acceptable here *****
+
+testcases[tc++] = new TestCase( SECTION,
+"-s3 == -Infinity || -s3 == -1.7976931348623157e+308",
+true,
+-s3 == -Infinity || -s3 == -1.7976931348623157e+308 );
+
+
+//***** This answer is preferred but Infinity is also acceptable here *****
+
+testcases[tc++] = new TestCase( SECTION,
+"parseInt(s1,10) == 1.7976931348623157e+308 || parseInt(s1,10) == Infinity",
+true,
+parseInt(s1,10) == 1.7976931348623157e+308 || parseInt(s1,10) == Infinity );
+
+//***** This answer is preferred but 1.7976931348623157e+308 is also acceptable here *****
+testcases[tc++] = new TestCase( SECTION,
+"parseInt(s2,10) == Infinity || parseInt(s2,10) == 1.7976931348623157e+308",
+true ,
+parseInt(s2,10) == Infinity || parseInt(s2,10) == 1.7976931348623157e+308 );
+
+//***** This answer is preferred but Infinity is also acceptable here *****
+
+testcases[tc++] = new TestCase( SECTION,
+"parseInt(s1) == 1.7976931348623157e+308 || parseInt(s1) == Infinity",
+true,
+parseInt(s1) == 1.7976931348623157e+308 || parseInt(s1) == Infinity);
+
+//***** This answer is preferred but 1.7976931348623157e+308 is also acceptable here *****
+testcases[tc++] = new TestCase( SECTION,
+"parseInt(s2) == Infinity || parseInt(s2) == 1.7976931348623157e+308",
+true,
+parseInt(s2) == Infinity || parseInt(s2) == 1.7976931348623157e+308 );
+
+testcases[tc++] = new TestCase( SECTION,
+ "0x12345678",
+ 305419896,
+ 0x12345678 );
+
+testcases[tc++] = new TestCase( SECTION,
+ "0x80000000",
+ 2147483648,
+ 0x80000000 );
+
+testcases[tc++] = new TestCase( SECTION,
+ "0xffffffff",
+ 4294967295,
+ 0xffffffff );
+
+testcases[tc++] = new TestCase( SECTION,
+ "0x100000000",
+ 4294967296,
+ 0x100000000 );
+
+testcases[tc++] = new TestCase( SECTION,
+ "077777777777777777",
+ 2251799813685247,
+ 077777777777777777 );
+
+testcases[tc++] = new TestCase( SECTION,
+ "077777777777777776",
+ 2251799813685246,
+ 077777777777777776 );
+
+testcases[tc++] = new TestCase( SECTION,
+ "0x1fffffffffffff",
+ 9007199254740991,
+ 0x1fffffffffffff );
+
+testcases[tc++] = new TestCase( SECTION,
+ "0x20000000000000",
+ 9007199254740992,
+ 0x20000000000000 );
+
+testcases[tc++] = new TestCase( SECTION,
+ "0x20123456789abc",
+ 9027215253084860,
+ 0x20123456789abc );
+
+testcases[tc++] = new TestCase( SECTION,
+ "0x20123456789abd",
+ 9027215253084860,
+ 0x20123456789abd );
+
+testcases[tc++] = new TestCase( SECTION,
+ "0x20123456789abe",
+ 9027215253084862,
+ 0x20123456789abe );
+
+testcases[tc++] = new TestCase( SECTION,
+ "0x20123456789abf",
+ 9027215253084864,
+ 0x20123456789abf );
+
+/***** These test the round-to-nearest-or-even-if-equally-close rule *****/
+
+testcases[tc++] = new TestCase( SECTION,
+ "0x1000000000000080",
+ 1152921504606847000,
+ 0x1000000000000080 );
+
+testcases[tc++] = new TestCase( SECTION,
+ "0x1000000000000081",
+ 1152921504606847200,
+ 0x1000000000000081 );
+
+testcases[tc++] = new TestCase( SECTION,
+ "0x1000000000000100",
+ 1152921504606847200,
+ 0x1000000000000100 );
+testcases[tc++] = new TestCase( SECTION,
+ "0x100000000000017f",
+ 1152921504606847200,
+ 0x100000000000017f );
+
+testcases[tc++] = new TestCase( SECTION,
+ "0x1000000000000180",
+ 1152921504606847500,
+ 0x1000000000000180 );
+
+testcases[tc++] = new TestCase( SECTION,
+ "0x1000000000000181",
+ 1152921504606847500,
+ 0x1000000000000181 );
+
+testcases[tc++] = new TestCase( SECTION,
+ "0x10000000000001f0",
+ 1152921504606847500,
+ 0x10000000000001f0 );
+
+testcases[tc++] = new TestCase( SECTION,
+ "0x1000000000000200",
+ 1152921504606847500,
+ 0x1000000000000200 );
+
+testcases[tc++] = new TestCase( SECTION,
+ "0x100000000000027f",
+ 1152921504606847500,
+ 0x100000000000027f );
+
+testcases[tc++] = new TestCase( SECTION,
+ "0x1000000000000280",
+ 1152921504606847500,
+ 0x1000000000000280 );
+
+testcases[tc++] = new TestCase( SECTION,
+ "0x1000000000000281",
+ 1152921504606847700,
+ 0x1000000000000281 );
+
+testcases[tc++] = new TestCase( SECTION,
+ "0x10000000000002ff",
+ 1152921504606847700,
+ 0x10000000000002ff );
+
+testcases[tc++] = new TestCase( SECTION,
+ "0x1000000000000300",
+ 1152921504606847700,
+ 0x1000000000000300 );
+
+testcases[tc++] = new TestCase( SECTION,
+ "0x10000000000000000",
+ 18446744073709552000,
+ 0x10000000000000000 );
+
+testcases[tc++] = new TestCase( SECTION,
+"parseInt(\"000000100000000100100011010001010110011110001001101010111100\",2)",
+9027215253084860,
+parseInt("000000100000000100100011010001010110011110001001101010111100",2) );
+
+testcases[tc++] = new TestCase( SECTION,
+"parseInt(\"000000100000000100100011010001010110011110001001101010111101\",2)",
+9027215253084860,
+parseInt("000000100000000100100011010001010110011110001001101010111101",2) );
+
+testcases[tc++] = new TestCase( SECTION,
+"parseInt(\"000000100000000100100011010001010110011110001001101010111111\",2)",
+9027215253084864,
+parseInt("000000100000000100100011010001010110011110001001101010111111",2) );
+
+testcases[tc++] = new TestCase( SECTION,
+"parseInt(\"0000001000000001001000110100010101100111100010011010101111010\",2)",
+18054430506169720,
+parseInt("0000001000000001001000110100010101100111100010011010101111010",2));
+
+testcases[tc++] = new TestCase( SECTION,
+"parseInt(\"0000001000000001001000110100010101100111100010011010101111011\",2)",
+18054430506169724,
+parseInt("0000001000000001001000110100010101100111100010011010101111011",2) );
+
+testcases[tc++] = new TestCase( SECTION,
+"parseInt(\"0000001000000001001000110100010101100111100010011010101111100\",2)",
+18054430506169724,
+parseInt("0000001000000001001000110100010101100111100010011010101111100",2));
+
+testcases[tc++] = new TestCase( SECTION,
+"parseInt(\"0000001000000001001000110100010101100111100010011010101111110\",2)",
+18054430506169728,
+parseInt("0000001000000001001000110100010101100111100010011010101111110",2));
+
+testcases[tc++] = new TestCase( SECTION,
+ "parseInt(\"yz\",35)",
+ 34,
+ parseInt("yz",35) );
+
+testcases[tc++] = new TestCase( SECTION,
+ "parseInt(\"yz\",36)",
+ 1259,
+ parseInt("yz",36) );
+
+testcases[tc++] = new TestCase( SECTION,
+ "parseInt(\"yz\",37)",
+ NaN,
+ parseInt("yz",37) );
+
+testcases[tc++] = new TestCase( SECTION,
+ "parseInt(\"+77\")",
+ 77,
+ parseInt("+77") );
+
+testcases[tc++] = new TestCase( SECTION,
+ "parseInt(\"-77\",9)",
+ -70,
+ parseInt("-77",9) );
+
+testcases[tc++] = new TestCase( SECTION,
+ "parseInt(\"\\u20001234\\u2000\")",
+ 1234,
+ parseInt("\u20001234\u2000") );
+
+testcases[tc++] = new TestCase( SECTION,
+ "parseInt(\"123456789012345678\")",
+ 123456789012345680,
+ parseInt("123456789012345678") );
+
+testcases[tc++] = new TestCase( SECTION,
+ "parseInt(\"9\",8)",
+ NaN,
+ parseInt("9",8) );
+
+testcases[tc++] = new TestCase( SECTION,
+ "parseInt(\"1e2\")",
+ 1,
+ parseInt("1e2") );
+
+testcases[tc++] = new TestCase( SECTION,
+ "parseInt(\"1.9999999999999999999\")",
+ 1,
+ parseInt("1.9999999999999999999") );
+
+testcases[tc++] = new TestCase( SECTION,
+ "parseInt(\"0x10\")",
+ 16,
+ parseInt("0x10") );
+
+testcases[tc++] = new TestCase( SECTION,
+ "parseInt(\"0x10\",10)",
+ 0,
+ parseInt("0x10",10) );
+
+testcases[tc++] = new TestCase( SECTION,
+ "parseInt(\"0022\")",
+ 18,
+ parseInt("0022") );
+
+testcases[tc++] = new TestCase( SECTION,
+ "parseInt(\"0022\",10)",
+ 22,
+ parseInt("0022",10) );
+
+testcases[tc++] = new TestCase( SECTION,
+ "parseInt(\"0x1000000000000080\")",
+ 1152921504606847000,
+ parseInt("0x1000000000000080") );
+
+testcases[tc++] = new TestCase( SECTION,
+ "parseInt(\"0x1000000000000081\")",
+ 1152921504606847200,
+ parseInt("0x1000000000000081") );
+
+s =
+"0xFFFFFFFFFFFFF80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000";
+
+testcases[tc++] = new TestCase( SECTION, "s = "+
+"\"0xFFFFFFFFFFFFF80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\";"+
+"s",
+"0xFFFFFFFFFFFFF80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
+s );
+
+
+testcases[tc++] = new TestCase( SECTION, "s +="+
+"\"0000000000000000000000000000000000000\"; s",
+"0xFFFFFFFFFFFFF800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
+s += "0000000000000000000000000000000000000" );
+
+testcases[tc++] = new TestCase( SECTION, "-s",
+-1.7976931348623157e+308,
+-s );
+
+s =
+"0xFFFFFFFFFFFFF80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000";
+
+testcases[tc++] = new TestCase( SECTION, "s ="+
+"\"0xFFFFFFFFFFFFF80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\";"+
+"s",
+"0xFFFFFFFFFFFFF80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
+s );
+
+testcases[tc++] = new TestCase( SECTION,
+"s += \"0000000000000000000000000000000000001\"",
+"0xFFFFFFFFFFFFF800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001",
+s += "0000000000000000000000000000000000001" );
+
+testcases[tc++] = new TestCase( SECTION,
+"-s",
+-1.7976931348623157e+308,
+-s );
+
+s =
+"0xFFFFFFFFFFFFFC0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000";
+
+testcases[tc++] = new TestCase( SECTION,
+"s ="+
+"\"0xFFFFFFFFFFFFFC0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\";"+
+"s",
+"0xFFFFFFFFFFFFFC0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
+s );
+
+
+testcases[tc++] = new TestCase( SECTION,
+"s += \"0000000000000000000000000000000000000\"",
+"0xFFFFFFFFFFFFFC00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
+s += "0000000000000000000000000000000000000");
+
+
+testcases[tc++] = new TestCase( SECTION,
+"-s",
+-Infinity,
+-s );
+
+s =
+"0xFFFFFFFFFFFFFB0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000";
+
+testcases[tc++] = new TestCase( SECTION,
+"s = "+
+"\"0xFFFFFFFFFFFFFB0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\";s",
+"0xFFFFFFFFFFFFFB0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
+s);
+
+testcases[tc++] = new TestCase( SECTION,
+"s += \"0000000000000000000000000000000000001\"",
+"0xFFFFFFFFFFFFFB00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001",
+s += "0000000000000000000000000000000000001" );
+
+testcases[tc++] = new TestCase( SECTION,
+"-s",
+-1.7976931348623157e+308,
+-s );
+
+testcases[tc++] = new TestCase( SECTION,
+"s += \"0\"",
+"0xFFFFFFFFFFFFFB000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010",
+s += "0" );
+
+testcases[tc++] = new TestCase( SECTION,
+"-s",
+-Infinity,
+-s );
+
+testcases[tc++] = new TestCase( SECTION,
+"parseInt(s)",
+Infinity,
+parseInt(s) );
+
+testcases[tc++] = new TestCase( SECTION,
+"parseInt(s,32)",
+0,
+parseInt(s,32) );
+
+testcases[tc++] = new TestCase( SECTION,
+"parseInt(s,36)",
+Infinity,
+parseInt(s,36) );
+
+testcases[tc++] = new TestCase( SECTION,
+ "-\"\"",
+ 0,
+ -"" );
+
+testcases[tc++] = new TestCase( SECTION,
+ "-\" \"",
+ 0,
+ -" " );
+
+testcases[tc++] = new TestCase( SECTION,
+ "-\"999\"",
+ -999,
+ -"999" );
+
+testcases[tc++] = new TestCase( SECTION,
+ "-\" 999\"",
+ -999,
+ -" 999" );
+
+testcases[tc++] = new TestCase( SECTION,
+ "-\"\\t999\"",
+ -999,
+ -"\t999" );
+
+testcases[tc++] = new TestCase( SECTION,
+ "-\"013 \"",
+ -13,
+ -"013 " );
+
+testcases[tc++] = new TestCase( SECTION,
+ "-\"999\\t\"",
+ -999,
+ -"999\t" );
+
+testcases[tc++] = new TestCase( SECTION,
+ "-\"-Infinity\"",
+ Infinity,
+ -"-Infinity" );
+
+testcases[tc++] = new TestCase( SECTION,
+ "-\"-infinity\"",
+ NaN,
+ -"-infinity" );
+
+
+testcases[tc++] = new TestCase( SECTION,
+ "-\"+Infinity\"",
+ -Infinity,
+ -"+Infinity" );
+
+testcases[tc++] = new TestCase( SECTION,
+ "-\"+Infiniti\"",
+ NaN,
+ -"+Infiniti" );
+
+testcases[tc++] = new TestCase( SECTION,
+ "- -\"0x80000000\"",
+ 2147483648,
+ - -"0x80000000" );
+
+testcases[tc++] = new TestCase( SECTION,
+ "- -\"0x100000000\"",
+ 4294967296,
+ - -"0x100000000" );
+
+testcases[tc++] = new TestCase( SECTION,
+ "- \"-0x123456789abcde8\"",
+ 81985529216486880,
+ - "-0x123456789abcde8" );
+
+// the following two tests are not strictly ECMA 1.0
+
+testcases[tc++] = new TestCase( SECTION,
+ "-\"\\u20001234\\u2001\"",
+ -1234,
+ -"\u20001234\u2001" );
+
+testcases[tc++] = new TestCase( SECTION,
+ "-\"\\u20001234\\0\"",
+ NaN,
+ -"\u20001234\0" );
+
+testcases[tc++] = new TestCase( SECTION,
+ "-\"0x10\"",
+ -16,
+ -"0x10" );
+
+testcases[tc++] = new TestCase( SECTION,
+ "-\"+\"",
+ NaN,
+ -"+" );
+
+testcases[tc++] = new TestCase( SECTION,
+ "-\"-\"",
+ NaN,
+ -"-" );
+
+testcases[tc++] = new TestCase( SECTION,
+ "-\"-0-\"",
+ NaN,
+ -"-0-" );
+
+testcases[tc++] = new TestCase( SECTION,
+ "-\"1e-\"",
+ NaN,
+ -"1e-" );
+
+testcases[tc++] = new TestCase( SECTION,
+ "-\"1e-1\"",
+ -0.1,
+ -"1e-1" );
+
+test();
+
+function test(){
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.3.js b/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.3.js
new file mode 100644
index 0000000..4645692
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.3.js
@@ -0,0 +1,89 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 9.3.js
+ ECMA Section: 9.3 Type Conversion: ToNumber
+ Description: rules for converting an argument to a number.
+ see 9.3.1 for cases for converting strings to numbers.
+ special cases:
+ undefined NaN
+ Null NaN
+ Boolean 1 if true; +0 if false
+ Number the argument ( no conversion )
+ String see test 9.3.1
+ Object see test 9.3-1
+
+ For ToNumber applied to the String type, see test 9.3.1.
+ For ToNumber applied to the object type, see test 9.3-1.
+
+ Author: christine@netscape.com
+ Date: 10 july 1997
+
+*/
+ var SECTION = "9.3";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "ToNumber";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ // special cases here
+
+ array[item++] = new TestCase( SECTION, "Number()", 0, Number() );
+ array[item++] = new TestCase( SECTION, "Number(eval('var x'))", Number.NaN, Number(eval("var x")) );
+ array[item++] = new TestCase( SECTION, "Number(void 0)", Number.NaN, Number(void 0) );
+ array[item++] = new TestCase( SECTION, "Number(null)", 0, Number(null) );
+ array[item++] = new TestCase( SECTION, "Number(true)", 1, Number(true) );
+ array[item++] = new TestCase( SECTION, "Number(false)", 0, Number(false) );
+ array[item++] = new TestCase( SECTION, "Number(0)", 0, Number(0) );
+ array[item++] = new TestCase( SECTION, "Number(-0)", -0, Number(-0) );
+ array[item++] = new TestCase( SECTION, "Number(1)", 1, Number(1) );
+ array[item++] = new TestCase( SECTION, "Number(-1)", -1, Number(-1) );
+ array[item++] = new TestCase( SECTION, "Number(Number.MAX_VALUE)", 1.7976931348623157e308, Number(Number.MAX_VALUE) );
+ array[item++] = new TestCase( SECTION, "Number(Number.MIN_VALUE)", 5e-324, Number(Number.MIN_VALUE) );
+
+ array[item++] = new TestCase( SECTION, "Number(Number.NaN)", Number.NaN, Number(Number.NaN) );
+ array[item++] = new TestCase( SECTION, "Number(Number.POSITIVE_INFINITY)", Number.POSITIVE_INFINITY, Number(Number.POSITIVE_INFINITY) );
+ array[item++] = new TestCase( SECTION, "Number(Number.NEGATIVE_INFINITY)", Number.NEGATIVE_INFINITY, Number(Number.NEGATIVE_INFINITY) );
+
+ return ( array );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.4-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.4-1.js
new file mode 100644
index 0000000..4dd331d
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.4-1.js
@@ -0,0 +1,120 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 9.4-1.js
+ ECMA Section: 9.4 ToInteger
+ Description: 1. Call ToNumber on the input argument
+ 2. If Result(1) is NaN, return +0
+ 3. If Result(1) is +0, -0, Infinity, or -Infinity,
+ return Result(1).
+ 4. Compute sign(Result(1)) * floor(abs(Result(1))).
+ 5. Return Result(4).
+
+ To test ToInteger, this test uses new Date(value),
+ 15.9.3.7. The Date constructor sets the [[Value]]
+ property of the new object to TimeClip(value), which
+ uses the rules:
+
+ TimeClip(time)
+ 1. If time is not finite, return NaN
+ 2. If abs(Result(1)) > 8.64e15, return NaN
+ 3. Return an implementation dependent choice of either
+ ToInteger(Result(2)) or ToInteger(Result(2)) + (+0)
+ (Adding a positive 0 converts -0 to +0).
+
+ This tests ToInteger for values -8.64e15 > value > 8.64e15,
+ not including -0 and +0.
+
+ For additional special cases (0, +0, Infinity, -Infinity,
+ and NaN, see 9.4-2.js). For value is String, see 9.4-3.js.
+
+ Author: christine@netscape.com
+ Date: 10 july 1997
+
+*/
+ var SECTION = "9.4-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "ToInteger";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ // some special cases
+
+ array[item++] = new TestCase( SECTION, "td = new Date(Number.NaN); td.valueOf()", Number.NaN, eval("td = new Date(Number.NaN); td.valueOf()") );
+ array[item++] = new TestCase( SECTION, "td = new Date(Infinity); td.valueOf()", Number.NaN, eval("td = new Date(Number.POSITIVE_INFINITY); td.valueOf()") );
+ array[item++] = new TestCase( SECTION, "td = new Date(-Infinity); td.valueOf()", Number.NaN, eval("td = new Date(Number.NEGATIVE_INFINITY); td.valueOf()") );
+ array[item++] = new TestCase( SECTION, "td = new Date(-0); td.valueOf()", -0, eval("td = new Date(-0); td.valueOf()" ) );
+ array[item++] = new TestCase( SECTION, "td = new Date(0); td.valueOf()", 0, eval("td = new Date(0); td.valueOf()") );
+
+ // value is not an integer
+
+ array[item++] = new TestCase( SECTION, "td = new Date(3.14159); td.valueOf()", 3, eval("td = new Date(3.14159); td.valueOf()") );
+ array[item++] = new TestCase( SECTION, "td = new Date(Math.PI); td.valueOf()", 3, eval("td = new Date(Math.PI); td.valueOf()") );
+ array[item++] = new TestCase( SECTION, "td = new Date(-Math.PI);td.valueOf()", -3, eval("td = new Date(-Math.PI);td.valueOf()") );
+ array[item++] = new TestCase( SECTION, "td = new Date(3.14159e2); td.valueOf()", 314, eval("td = new Date(3.14159e2); td.valueOf()") );
+
+ array[item++] = new TestCase( SECTION, "td = new Date(.692147e1); td.valueOf()", 6, eval("td = new Date(.692147e1);td.valueOf()") );
+ array[item++] = new TestCase( SECTION, "td = new Date(-.692147e1);td.valueOf()", -6, eval("td = new Date(-.692147e1);td.valueOf()") );
+
+ // value is not a number
+
+ array[item++] = new TestCase( SECTION, "td = new Date(true); td.valueOf()", 1, eval("td = new Date(true); td.valueOf()" ) );
+ array[item++] = new TestCase( SECTION, "td = new Date(false); td.valueOf()", 0, eval("td = new Date(false); td.valueOf()") );
+
+ array[item++] = new TestCase( SECTION, "td = new Date(new Number(Math.PI)); td.valueOf()", 3, eval("td = new Date(new Number(Math.PI)); td.valueOf()") );
+ array[item++] = new TestCase( SECTION, "td = new Date(new Number(Math.PI)); td.valueOf()", 3, eval("td = new Date(new Number(Math.PI)); td.valueOf()") );
+
+ // edge cases
+ array[item++] = new TestCase( SECTION, "td = new Date(8.64e15); td.valueOf()", 8.64e15, eval("td = new Date(8.64e15); td.valueOf()") );
+ array[item++] = new TestCase( SECTION, "td = new Date(-8.64e15); td.valueOf()", -8.64e15, eval("td = new Date(-8.64e15); td.valueOf()") );
+ array[item++] = new TestCase( SECTION, "td = new Date(8.64e-15); td.valueOf()", 0, eval("td = new Date(8.64e-15); td.valueOf()") );
+ array[item++] = new TestCase( SECTION, "td = new Date(-8.64e-15); td.valueOf()", 0, eval("td = new Date(-8.64e-15); td.valueOf()") );
+
+ return ( array );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.4-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.4-2.js
new file mode 100644
index 0000000..4dd331d
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.4-2.js
@@ -0,0 +1,120 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 9.4-1.js
+ ECMA Section: 9.4 ToInteger
+ Description: 1. Call ToNumber on the input argument
+ 2. If Result(1) is NaN, return +0
+ 3. If Result(1) is +0, -0, Infinity, or -Infinity,
+ return Result(1).
+ 4. Compute sign(Result(1)) * floor(abs(Result(1))).
+ 5. Return Result(4).
+
+ To test ToInteger, this test uses new Date(value),
+ 15.9.3.7. The Date constructor sets the [[Value]]
+ property of the new object to TimeClip(value), which
+ uses the rules:
+
+ TimeClip(time)
+ 1. If time is not finite, return NaN
+ 2. If abs(Result(1)) > 8.64e15, return NaN
+ 3. Return an implementation dependent choice of either
+ ToInteger(Result(2)) or ToInteger(Result(2)) + (+0)
+ (Adding a positive 0 converts -0 to +0).
+
+ This tests ToInteger for values -8.64e15 > value > 8.64e15,
+ not including -0 and +0.
+
+ For additional special cases (0, +0, Infinity, -Infinity,
+ and NaN, see 9.4-2.js). For value is String, see 9.4-3.js.
+
+ Author: christine@netscape.com
+ Date: 10 july 1997
+
+*/
+ var SECTION = "9.4-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "ToInteger";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ // some special cases
+
+ array[item++] = new TestCase( SECTION, "td = new Date(Number.NaN); td.valueOf()", Number.NaN, eval("td = new Date(Number.NaN); td.valueOf()") );
+ array[item++] = new TestCase( SECTION, "td = new Date(Infinity); td.valueOf()", Number.NaN, eval("td = new Date(Number.POSITIVE_INFINITY); td.valueOf()") );
+ array[item++] = new TestCase( SECTION, "td = new Date(-Infinity); td.valueOf()", Number.NaN, eval("td = new Date(Number.NEGATIVE_INFINITY); td.valueOf()") );
+ array[item++] = new TestCase( SECTION, "td = new Date(-0); td.valueOf()", -0, eval("td = new Date(-0); td.valueOf()" ) );
+ array[item++] = new TestCase( SECTION, "td = new Date(0); td.valueOf()", 0, eval("td = new Date(0); td.valueOf()") );
+
+ // value is not an integer
+
+ array[item++] = new TestCase( SECTION, "td = new Date(3.14159); td.valueOf()", 3, eval("td = new Date(3.14159); td.valueOf()") );
+ array[item++] = new TestCase( SECTION, "td = new Date(Math.PI); td.valueOf()", 3, eval("td = new Date(Math.PI); td.valueOf()") );
+ array[item++] = new TestCase( SECTION, "td = new Date(-Math.PI);td.valueOf()", -3, eval("td = new Date(-Math.PI);td.valueOf()") );
+ array[item++] = new TestCase( SECTION, "td = new Date(3.14159e2); td.valueOf()", 314, eval("td = new Date(3.14159e2); td.valueOf()") );
+
+ array[item++] = new TestCase( SECTION, "td = new Date(.692147e1); td.valueOf()", 6, eval("td = new Date(.692147e1);td.valueOf()") );
+ array[item++] = new TestCase( SECTION, "td = new Date(-.692147e1);td.valueOf()", -6, eval("td = new Date(-.692147e1);td.valueOf()") );
+
+ // value is not a number
+
+ array[item++] = new TestCase( SECTION, "td = new Date(true); td.valueOf()", 1, eval("td = new Date(true); td.valueOf()" ) );
+ array[item++] = new TestCase( SECTION, "td = new Date(false); td.valueOf()", 0, eval("td = new Date(false); td.valueOf()") );
+
+ array[item++] = new TestCase( SECTION, "td = new Date(new Number(Math.PI)); td.valueOf()", 3, eval("td = new Date(new Number(Math.PI)); td.valueOf()") );
+ array[item++] = new TestCase( SECTION, "td = new Date(new Number(Math.PI)); td.valueOf()", 3, eval("td = new Date(new Number(Math.PI)); td.valueOf()") );
+
+ // edge cases
+ array[item++] = new TestCase( SECTION, "td = new Date(8.64e15); td.valueOf()", 8.64e15, eval("td = new Date(8.64e15); td.valueOf()") );
+ array[item++] = new TestCase( SECTION, "td = new Date(-8.64e15); td.valueOf()", -8.64e15, eval("td = new Date(-8.64e15); td.valueOf()") );
+ array[item++] = new TestCase( SECTION, "td = new Date(8.64e-15); td.valueOf()", 0, eval("td = new Date(8.64e-15); td.valueOf()") );
+ array[item++] = new TestCase( SECTION, "td = new Date(-8.64e-15); td.valueOf()", 0, eval("td = new Date(-8.64e-15); td.valueOf()") );
+
+ return ( array );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.5-2.js b/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.5-2.js
new file mode 100644
index 0000000..598cce7
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.5-2.js
@@ -0,0 +1,171 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 9.5-2.js
+ ECMA Section: 9.5 Type Conversion: ToInt32
+ Description: rules for converting an argument to a signed 32 bit integer
+
+ this test uses << 0 to convert the argument to a 32bit
+ integer.
+
+ The operator ToInt32 converts its argument to one of 2^32
+ integer values in the range -2^31 through 2^31 inclusive.
+ This operator functions as follows:
+
+ 1 call ToNumber on argument
+ 2 if result is NaN, 0, -0, return 0
+ 3 compute (sign (result(1)) * floor(abs(result 1)))
+ 4 compute result(3) modulo 2^32:
+ 5 if result(4) is greater than or equal to 2^31, return
+ result(5)-2^32. otherwise, return result(5)
+
+ special cases:
+ -0 returns 0
+ Infinity returns 0
+ -Infinity returns 0
+ ToInt32(ToUint32(x)) == ToInt32(x) for all values of x
+ Numbers greater than 2^31 (see step 5 above)
+ (note http://bugzilla.mozilla.org/show_bug.cgi?id=120083)
+
+ Author: christine@netscape.com
+ Date: 17 july 1997
+*/
+ var SECTION = "9.5-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var testcases = getTestCases();
+
+ writeHeaderToLog( SECTION + " ToInt32");
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function ToInt32( n ) {
+ n = Number( n );
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
+ return 0;
+ }
+
+ n = (sign * Math.floor( Math.abs(n) )) % Math.pow(2,32);
+ if ( sign == -1 ) {
+ n = ( n < -Math.pow(2,31) ) ? n + Math.pow(2,32) : n;
+ } else{
+ n = ( n >= Math.pow(2,31) ) ? n - Math.pow(2,32) : n;
+ }
+
+ return ( n );
+}
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "0 << 0", 0, 0 << 0 );
+ array[item++] = new TestCase( SECTION, "-0 << 0", 0, -0 << 0 );
+ array[item++] = new TestCase( SECTION, "Infinity << 0", 0, "Infinity" << 0 );
+ array[item++] = new TestCase( SECTION, "-Infinity << 0", 0, "-Infinity" << 0 );
+ array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY << 0", 0, Number.POSITIVE_INFINITY << 0 );
+ array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY << 0", 0, Number.NEGATIVE_INFINITY << 0 );
+ array[item++] = new TestCase( SECTION, "Number.NaN << 0", 0, Number.NaN << 0 );
+
+ array[item++] = new TestCase( SECTION, "Number.MIN_VALUE << 0", 0, Number.MIN_VALUE << 0 );
+ array[item++] = new TestCase( SECTION, "-Number.MIN_VALUE << 0", 0, -Number.MIN_VALUE << 0 );
+ array[item++] = new TestCase( SECTION, "0.1 << 0", 0, 0.1 << 0 );
+ array[item++] = new TestCase( SECTION, "-0.1 << 0", 0, -0.1 << 0 );
+ array[item++] = new TestCase( SECTION, "1 << 0", 1, 1 << 0 );
+ array[item++] = new TestCase( SECTION, "1.1 << 0", 1, 1.1 << 0 );
+ array[item++] = new TestCase( SECTION, "-1 << 0", ToInt32(-1), -1 << 0 );
+
+
+ array[item++] = new TestCase( SECTION, "2147483647 << 0", ToInt32(2147483647), 2147483647 << 0 );
+ array[item++] = new TestCase( SECTION, "2147483648 << 0", ToInt32(2147483648), 2147483648 << 0 );
+ array[item++] = new TestCase( SECTION, "2147483649 << 0", ToInt32(2147483649), 2147483649 << 0 );
+
+ array[item++] = new TestCase( SECTION, "(Math.pow(2,31)-1) << 0", ToInt32(2147483647), (Math.pow(2,31)-1) << 0 );
+ array[item++] = new TestCase( SECTION, "Math.pow(2,31) << 0", ToInt32(2147483648), Math.pow(2,31) << 0 );
+ array[item++] = new TestCase( SECTION, "(Math.pow(2,31)+1) << 0", ToInt32(2147483649), (Math.pow(2,31)+1) << 0 );
+
+ array[item++] = new TestCase( SECTION, "(Math.pow(2,32)-1) << 0", ToInt32(4294967295), (Math.pow(2,32)-1) << 0 );
+ array[item++] = new TestCase( SECTION, "(Math.pow(2,32)) << 0", ToInt32(4294967296), (Math.pow(2,32)) << 0 );
+ array[item++] = new TestCase( SECTION, "(Math.pow(2,32)+1) << 0", ToInt32(4294967297), (Math.pow(2,32)+1) << 0 );
+
+ array[item++] = new TestCase( SECTION, "4294967295 << 0", ToInt32(4294967295), 4294967295 << 0 );
+ array[item++] = new TestCase( SECTION, "4294967296 << 0", ToInt32(4294967296), 4294967296 << 0 );
+ array[item++] = new TestCase( SECTION, "4294967297 << 0", ToInt32(4294967297), 4294967297 << 0 );
+
+ array[item++] = new TestCase( SECTION, "'2147483647' << 0", ToInt32(2147483647), '2147483647' << 0 );
+ array[item++] = new TestCase( SECTION, "'2147483648' << 0", ToInt32(2147483648), '2147483648' << 0 );
+ array[item++] = new TestCase( SECTION, "'2147483649' << 0", ToInt32(2147483649), '2147483649' << 0 );
+
+ array[item++] = new TestCase( SECTION, "'4294967295' << 0", ToInt32(4294967295), '4294967295' << 0 );
+ array[item++] = new TestCase( SECTION, "'4294967296' << 0", ToInt32(4294967296), '4294967296' << 0 );
+ array[item++] = new TestCase( SECTION, "'4294967297' << 0", ToInt32(4294967297), '4294967297' << 0 );
+
+ array[item++] = new TestCase( SECTION, "-2147483647 << 0", ToInt32(-2147483647), -2147483647 << 0 );
+ array[item++] = new TestCase( SECTION, "-2147483648 << 0", ToInt32(-2147483648), -2147483648 << 0 );
+ array[item++] = new TestCase( SECTION, "-2147483649 << 0", ToInt32(-2147483649), -2147483649 << 0 );
+
+ array[item++] = new TestCase( SECTION, "-4294967295 << 0", ToInt32(-4294967295), -4294967295 << 0 );
+ array[item++] = new TestCase( SECTION, "-4294967296 << 0", ToInt32(-4294967296), -4294967296 << 0 );
+ array[item++] = new TestCase( SECTION, "-4294967297 << 0", ToInt32(-4294967297), -4294967297 << 0 );
+
+ /*
+ * Numbers between 2^31 and 2^32 will have a negative ToInt32 per ECMA (see step 5 of introduction)
+ * (These are by stevechapel@earthlink.net; cf. http://bugzilla.mozilla.org/show_bug.cgi?id=120083)
+ */
+ array[item++] = new TestCase( SECTION, "2147483648.25 << 0", ToInt32(2147483648.25), 2147483648.25 << 0 );
+ array[item++] = new TestCase( SECTION, "2147483648.5 << 0", ToInt32(2147483648.5), 2147483648.5 << 0 );
+ array[item++] = new TestCase( SECTION, "2147483648.75 << 0", ToInt32(2147483648.75), 2147483648.75 << 0 );
+ array[item++] = new TestCase( SECTION, "4294967295.25 << 0", ToInt32(4294967295.25), 4294967295.25 << 0 );
+ array[item++] = new TestCase( SECTION, "4294967295.5 << 0", ToInt32(4294967295.5), 4294967295.5 << 0 );
+ array[item++] = new TestCase( SECTION, "4294967295.75 << 0", ToInt32(4294967295.75), 4294967295.75 << 0 );
+ array[item++] = new TestCase( SECTION, "3000000000.25 << 0", ToInt32(3000000000.25), 3000000000.25 << 0 );
+ array[item++] = new TestCase( SECTION, "3000000000.5 << 0", ToInt32(3000000000.5), 3000000000.5 << 0 );
+ array[item++] = new TestCase( SECTION, "3000000000.75 << 0", ToInt32(3000000000.75), 3000000000.75 << 0 );
+
+ /*
+ * Numbers between - 2^31 and - 2^32
+ */
+ array[item++] = new TestCase( SECTION, "-2147483648.25 << 0", ToInt32(-2147483648.25), -2147483648.25 << 0 );
+ array[item++] = new TestCase( SECTION, "-2147483648.5 << 0", ToInt32(-2147483648.5), -2147483648.5 << 0 );
+ array[item++] = new TestCase( SECTION, "-2147483648.75 << 0", ToInt32(-2147483648.75), -2147483648.75 << 0 );
+ array[item++] = new TestCase( SECTION, "-4294967295.25 << 0", ToInt32(-4294967295.25), -4294967295.25 << 0 );
+ array[item++] = new TestCase( SECTION, "-4294967295.5 << 0", ToInt32(-4294967295.5), -4294967295.5 << 0 );
+ array[item++] = new TestCase( SECTION, "-4294967295.75 << 0", ToInt32(-4294967295.75), -4294967295.75 << 0 );
+ array[item++] = new TestCase( SECTION, "-3000000000.25 << 0", ToInt32(-3000000000.25), -3000000000.25 << 0 );
+ array[item++] = new TestCase( SECTION, "-3000000000.5 << 0", ToInt32(-3000000000.5), -3000000000.5 << 0 );
+ array[item++] = new TestCase( SECTION, "-3000000000.75 << 0", ToInt32(-3000000000.75), -3000000000.75 << 0 );
+
+ return ( array );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.6.js b/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.6.js
new file mode 100644
index 0000000..c4c3bff
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.6.js
@@ -0,0 +1,139 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 9.6.js
+ ECMA Section: 9.6 Type Conversion: ToUint32
+ Description: rules for converting an argument to an unsigned
+ 32 bit integer
+
+ this test uses >>> 0 to convert the argument to
+ an unsigned 32bit integer.
+
+ 1 call ToNumber on argument
+ 2 if result is NaN, 0, -0, Infinity, -Infinity
+ return 0
+ 3 compute (sign (result(1)) * floor(abs(result 1)))
+ 4 compute result(3) modulo 2^32:
+ 5 return result(4)
+
+ special cases:
+ -0 returns 0
+ Infinity returns 0
+ -Infinity returns 0
+ 0 returns 0
+ ToInt32(ToUint32(x)) == ToInt32(x) for all values of x
+ ** NEED TO DO THIS PART IN A SEPARATE TEST FILE **
+
+
+ Author: christine@netscape.com
+ Date: 17 july 1997
+*/
+
+ var SECTION = "9.6";
+ var VERSION = "ECMA_1";
+ startTest();
+ var testcases = getTestCases();
+
+ writeHeaderToLog( SECTION + " Type Conversion: ToUint32");
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
+function ToUint32( n ) {
+ n = Number( n );
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
+ return 0;
+ }
+ n = sign * Math.floor( Math.abs(n) )
+
+ n = n % Math.pow(2,32);
+
+ if ( n < 0 ){
+ n += Math.pow(2,32);
+ }
+
+ return ( n );
+}
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "0 >>> 0", 0, 0 >>> 0 );
+// array[item++] = new TestCase( SECTION, "+0 >>> 0", 0, +0 >>> 0);
+ array[item++] = new TestCase( SECTION, "-0 >>> 0", 0, -0 >>> 0 );
+ array[item++] = new TestCase( SECTION, "'Infinity' >>> 0", 0, "Infinity" >>> 0 );
+ array[item++] = new TestCase( SECTION, "'-Infinity' >>> 0", 0, "-Infinity" >>> 0);
+ array[item++] = new TestCase( SECTION, "'+Infinity' >>> 0", 0, "+Infinity" >>> 0 );
+ array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY >>> 0", 0, Number.POSITIVE_INFINITY >>> 0 );
+ array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY >>> 0", 0, Number.NEGATIVE_INFINITY >>> 0 );
+ array[item++] = new TestCase( SECTION, "Number.NaN >>> 0", 0, Number.NaN >>> 0 );
+
+ array[item++] = new TestCase( SECTION, "Number.MIN_VALUE >>> 0", 0, Number.MIN_VALUE >>> 0 );
+ array[item++] = new TestCase( SECTION, "-Number.MIN_VALUE >>> 0", 0, Number.MIN_VALUE >>> 0 );
+ array[item++] = new TestCase( SECTION, "0.1 >>> 0", 0, 0.1 >>> 0 );
+ array[item++] = new TestCase( SECTION, "-0.1 >>> 0", 0, -0.1 >>> 0 );
+ array[item++] = new TestCase( SECTION, "1 >>> 0", 1, 1 >>> 0 );
+ array[item++] = new TestCase( SECTION, "1.1 >>> 0", 1, 1.1 >>> 0 );
+
+ array[item++] = new TestCase( SECTION, "-1.1 >>> 0", ToUint32(-1.1), -1.1 >>> 0 );
+ array[item++] = new TestCase( SECTION, "-1 >>> 0", ToUint32(-1), -1 >>> 0 );
+
+ array[item++] = new TestCase( SECTION, "2147483647 >>> 0", ToUint32(2147483647), 2147483647 >>> 0 );
+ array[item++] = new TestCase( SECTION, "2147483648 >>> 0", ToUint32(2147483648), 2147483648 >>> 0 );
+ array[item++] = new TestCase( SECTION, "2147483649 >>> 0", ToUint32(2147483649), 2147483649 >>> 0 );
+
+ array[item++] = new TestCase( SECTION, "4294967295 >>> 0", ToUint32(4294967295), 4294967295 >>> 0 );
+ array[item++] = new TestCase( SECTION, "4294967296 >>> 0", ToUint32(4294967296), 4294967296 >>> 0 );
+ array[item++] = new TestCase( SECTION, "4294967297 >>> 0", ToUint32(4294967297), 4294967297 >>> 0 );
+
+ array[item++] = new TestCase( SECTION, "-2147483647 >>> 0", ToUint32(-2147483647), -2147483647 >>> 0 );
+ array[item++] = new TestCase( SECTION, "-2147483648 >>> 0", ToUint32(-2147483648), -2147483648 >>> 0 );
+ array[item++] = new TestCase( SECTION, "-2147483649 >>> 0", ToUint32(-2147483649), -2147483649 >>> 0 );
+
+ array[item++] = new TestCase( SECTION, "-4294967295 >>> 0", ToUint32(-4294967295), -4294967295 >>> 0 );
+ array[item++] = new TestCase( SECTION, "-4294967296 >>> 0", ToUint32(-4294967296), -4294967296 >>> 0 );
+ array[item++] = new TestCase( SECTION, "-4294967297 >>> 0", ToUint32(-4294967297), -4294967297 >>> 0 );
+
+ array[item++] = new TestCase( SECTION, "'2147483647' >>> 0", ToUint32(2147483647), '2147483647' >>> 0 );
+ array[item++] = new TestCase( SECTION, "'2147483648' >>> 0", ToUint32(2147483648), '2147483648' >>> 0 );
+ array[item++] = new TestCase( SECTION, "'2147483649' >>> 0", ToUint32(2147483649), '2147483649' >>> 0 );
+
+ array[item++] = new TestCase( SECTION, "'4294967295' >>> 0", ToUint32(4294967295), '4294967295' >>> 0 );
+ array[item++] = new TestCase( SECTION, "'4294967296' >>> 0", ToUint32(4294967296), '4294967296' >>> 0 );
+ array[item++] = new TestCase( SECTION, "'4294967297' >>> 0", ToUint32(4294967297), '4294967297' >>> 0 );
+
+ return ( array );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.7.js b/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.7.js
new file mode 100644
index 0000000..60322d4
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.7.js
@@ -0,0 +1,158 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 9.7.js
+ ECMA Section: 9.7 Type Conversion: ToInt16
+ Description: rules for converting an argument to an unsigned
+ 16 bit integer in the range 0 to 2^16-1.
+
+ this test uses String.prototype.fromCharCode() and
+ String.prototype.charCodeAt() to test ToInt16.
+
+ special cases:
+ -0 returns 0
+ Infinity returns 0
+ -Infinity returns 0
+ 0 returns 0
+
+ Author: christine@netscape.com
+ Date: 17 july 1997
+*/
+ var SECTION = "9.7";
+ var VERSION = "ECMA_1";
+ startTest();
+ var testcases = getTestCases();
+
+ writeHeaderToLog( SECTION + " Type Conversion: ToInt16");
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function ToInt16( num ) {
+ num = Number( num );
+ if ( isNaN( num ) || num == 0 || num == Number.POSITIVE_INFINITY || num == Number.NEGATIVE_INFINITY ) {
+ return 0;
+ }
+
+ var sign = ( num < 0 ) ? -1 : 1;
+
+ num = sign * Math.floor( Math.abs( num ) );
+
+ num = num % Math.pow(2,16);
+
+ num = ( num > -65536 && num < 0) ? 65536 + num : num;
+
+ return num;
+}
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+/*
+ array[item++] = new TestCase( "9.7", "String.fromCharCode(0).charCodeAt(0)", 0, String.fromCharCode(0).charCodeAt(0) );
+ array[item++] = new TestCase( "9.7", "String.fromCharCode(-0).charCodeAt(0)", 0, String.fromCharCode(-0).charCodeAt(0) );
+ array[item++] = new TestCase( "9.7", "String.fromCharCode(1).charCodeAt(0)", 1, String.fromCharCode(1).charCodeAt(0) );
+ array[item++] = new TestCase( "9.7", "String.fromCharCode(64).charCodeAt(0)", 64, String.fromCharCode(64).charCodeAt(0) );
+ array[item++] = new TestCase( "9.7", "String.fromCharCode(126).charCodeAt(0)", 126, String.fromCharCode(126).charCodeAt(0) );
+ array[item++] = new TestCase( "9.7", "String.fromCharCode(127).charCodeAt(0)", 127, String.fromCharCode(127).charCodeAt(0) );
+ array[item++] = new TestCase( "9.7", "String.fromCharCode(128).charCodeAt(0)", 128, String.fromCharCode(128).charCodeAt(0) );
+ array[item++] = new TestCase( "9.7", "String.fromCharCode(130).charCodeAt(0)", 130, String.fromCharCode(130).charCodeAt(0) );
+ array[item++] = new TestCase( "9.7", "String.fromCharCode(255).charCodeAt(0)", 255, String.fromCharCode(255).charCodeAt(0) );
+ array[item++] = new TestCase( "9.7", "String.fromCharCode(256).charCodeAt(0)", 256, String.fromCharCode(256).charCodeAt(0) );
+ array[item++] = new TestCase( "9.7", "String.fromCharCode(Math.pow(2,16)-1).charCodeAt(0)", 65535, String.fromCharCode(Math.pow(2,16)-1).charCodeAt(0) );
+ array[item++] = new TestCase( "9.7", "String.fromCharCode(Math.pow(2,16)).charCodeAt(0)", 0, String.fromCharCode(Math.pow(2,16)).charCodeAt(0) );
+*/
+
+
+ array[item++] = new TestCase( "9.7", "String.fromCharCode(0).charCodeAt(0)", ToInt16(0), String.fromCharCode(0).charCodeAt(0) );
+ array[item++] = new TestCase( "9.7", "String.fromCharCode(-0).charCodeAt(0)", ToInt16(0), String.fromCharCode(-0).charCodeAt(0) );
+ array[item++] = new TestCase( "9.7", "String.fromCharCode(1).charCodeAt(0)", ToInt16(1), String.fromCharCode(1).charCodeAt(0) );
+ array[item++] = new TestCase( "9.7", "String.fromCharCode(64).charCodeAt(0)", ToInt16(64), String.fromCharCode(64).charCodeAt(0) );
+ array[item++] = new TestCase( "9.7", "String.fromCharCode(126).charCodeAt(0)", ToInt16(126), String.fromCharCode(126).charCodeAt(0) );
+ array[item++] = new TestCase( "9.7", "String.fromCharCode(127).charCodeAt(0)", ToInt16(127), String.fromCharCode(127).charCodeAt(0) );
+ array[item++] = new TestCase( "9.7", "String.fromCharCode(128).charCodeAt(0)", ToInt16(128), String.fromCharCode(128).charCodeAt(0) );
+ array[item++] = new TestCase( "9.7", "String.fromCharCode(130).charCodeAt(0)", ToInt16(130), String.fromCharCode(130).charCodeAt(0) );
+ array[item++] = new TestCase( "9.7", "String.fromCharCode(255).charCodeAt(0)", ToInt16(255), String.fromCharCode(255).charCodeAt(0) );
+ array[item++] = new TestCase( "9.7", "String.fromCharCode(256).charCodeAt(0)", ToInt16(256), String.fromCharCode(256).charCodeAt(0) );
+
+ array[item++] = new TestCase( "9.7", "String.fromCharCode(Math.pow(2,16)-1).charCodeAt(0)", 65535, String.fromCharCode(Math.pow(2,16)-1).charCodeAt(0) );
+ array[item++] = new TestCase( "9.7", "String.fromCharCode(Math.pow(2,16)).charCodeAt(0)", 0, String.fromCharCode(Math.pow(2,16)).charCodeAt(0) );
+
+ array[item++] = new TestCase( "9.7", "String.fromCharCode(65535).charCodeAt(0)", ToInt16(65535), String.fromCharCode(65535).charCodeAt(0) );
+ array[item++] = new TestCase( "9.7", "String.fromCharCode(65536).charCodeAt(0)", ToInt16(65536), String.fromCharCode(65536).charCodeAt(0) );
+ array[item++] = new TestCase( "9.7", "String.fromCharCode(65537).charCodeAt(0)", ToInt16(65537), String.fromCharCode(65537).charCodeAt(0) );
+
+ array[item++] = new TestCase( "9.7", "String.fromCharCode(131071).charCodeAt(0)", ToInt16(131071), String.fromCharCode(131071).charCodeAt(0) );
+ array[item++] = new TestCase( "9.7", "String.fromCharCode(131072).charCodeAt(0)", ToInt16(131072), String.fromCharCode(131072).charCodeAt(0) );
+ array[item++] = new TestCase( "9.7", "String.fromCharCode(131073).charCodeAt(0)", ToInt16(131073), String.fromCharCode(131073).charCodeAt(0) );
+
+ array[item++] = new TestCase( "9.7", "String.fromCharCode('65535').charCodeAt(0)", 65535, String.fromCharCode("65535").charCodeAt(0) );
+ array[item++] = new TestCase( "9.7", "String.fromCharCode('65536').charCodeAt(0)", 0, String.fromCharCode("65536").charCodeAt(0) );
+
+ array[item++] = new TestCase( "9.7", "String.fromCharCode(-1).charCodeAt(0)", ToInt16(-1), String.fromCharCode(-1).charCodeAt(0) );
+ array[item++] = new TestCase( "9.7", "String.fromCharCode(-64).charCodeAt(0)", ToInt16(-64), String.fromCharCode(-64).charCodeAt(0) );
+ array[item++] = new TestCase( "9.7", "String.fromCharCode(-126).charCodeAt(0)", ToInt16(-126), String.fromCharCode(-126).charCodeAt(0) );
+ array[item++] = new TestCase( "9.7", "String.fromCharCode(-127).charCodeAt(0)", ToInt16(-127), String.fromCharCode(-127).charCodeAt(0) );
+ array[item++] = new TestCase( "9.7", "String.fromCharCode(-128).charCodeAt(0)", ToInt16(-128), String.fromCharCode(-128).charCodeAt(0) );
+ array[item++] = new TestCase( "9.7", "String.fromCharCode(-130).charCodeAt(0)", ToInt16(-130), String.fromCharCode(-130).charCodeAt(0) );
+ array[item++] = new TestCase( "9.7", "String.fromCharCode(-255).charCodeAt(0)", ToInt16(-255), String.fromCharCode(-255).charCodeAt(0) );
+ array[item++] = new TestCase( "9.7", "String.fromCharCode(-256).charCodeAt(0)", ToInt16(-256), String.fromCharCode(-256).charCodeAt(0) );
+
+ array[item++] = new TestCase( "9.7", "String.fromCharCode(-Math.pow(2,16)-1).charCodeAt(0)", 65535, String.fromCharCode(-Math.pow(2,16)-1).charCodeAt(0) );
+ array[item++] = new TestCase( "9.7", "String.fromCharCode(-Math.pow(2,16)).charCodeAt(0)", 0, String.fromCharCode(-Math.pow(2,16)).charCodeAt(0) );
+
+ array[item++] = new TestCase( "9.7", "String.fromCharCode(-65535).charCodeAt(0)", ToInt16(-65535), String.fromCharCode(-65535).charCodeAt(0) );
+ array[item++] = new TestCase( "9.7", "String.fromCharCode(-65536).charCodeAt(0)", ToInt16(-65536), String.fromCharCode(-65536).charCodeAt(0) );
+ array[item++] = new TestCase( "9.7", "String.fromCharCode(-65537).charCodeAt(0)", ToInt16(-65537), String.fromCharCode(-65537).charCodeAt(0) );
+
+ array[item++] = new TestCase( "9.7", "String.fromCharCode(-131071).charCodeAt(0)", ToInt16(-131071), String.fromCharCode(-131071).charCodeAt(0) );
+ array[item++] = new TestCase( "9.7", "String.fromCharCode(-131072).charCodeAt(0)", ToInt16(-131072), String.fromCharCode(-131072).charCodeAt(0) );
+ array[item++] = new TestCase( "9.7", "String.fromCharCode(-131073).charCodeAt(0)", ToInt16(-131073), String.fromCharCode(-131073).charCodeAt(0) );
+
+ array[item++] = new TestCase( "9.7", "String.fromCharCode('-65535').charCodeAt(0)", ToInt16(-65535), String.fromCharCode("-65535").charCodeAt(0) );
+ array[item++] = new TestCase( "9.7", "String.fromCharCode('-65536').charCodeAt(0)", ToInt16(-65536), String.fromCharCode("-65536").charCodeAt(0) );
+
+
+// array[item++] = new TestCase( "9.7", "String.fromCharCode(2147483648).charCodeAt(0)", ToInt16(2147483648), String.fromCharCode(2147483648).charCodeAt(0) );
+
+
+
+// the following test cases cause a runtime error. see: http://scopus.mcom.com/bugsplat/show_bug.cgi?id=78878
+
+// array[item++] = new TestCase( "9.7", "String.fromCharCode(Infinity).charCodeAt(0)", 0, String.fromCharCode("Infinity").charCodeAt(0) );
+// array[item++] = new TestCase( "9.7", "String.fromCharCode(-Infinity).charCodeAt(0)", 0, String.fromCharCode("-Infinity").charCodeAt(0) );
+// array[item++] = new TestCase( "9.7", "String.fromCharCode(NaN).charCodeAt(0)", 0, String.fromCharCode(Number.NaN).charCodeAt(0) );
+// array[item++] = new TestCase( "9.7", "String.fromCharCode(Number.POSITIVE_INFINITY).charCodeAt(0)", 0, String.fromCharCode(Number.POSITIVE_INFINITY).charCodeAt(0) );
+// array[item++] = new TestCase( "9.7", "String.fromCharCode(Number.NEGATIVE_INFINITY).charCodeAt(0)", 0, String.fromCharCode(Number.NEGATIVE_INFINITY).charCodeAt(0) );
+ return ( array );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.8.1.js b/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.8.1.js
new file mode 100644
index 0000000..38cbb0a
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.8.1.js
@@ -0,0 +1,166 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 9.8.1.js
+ ECMA Section: 9.8.1 ToString Applied to the Number Type
+ Description: The operator ToString convers a number m to string
+ as follows:
+
+ 1. if m is NaN, return the string "NaN"
+ 2. if m is +0 or -0, return the string "0"
+ 3. if m is less than zero, return the string
+ concatenation of the string "-" and ToString(-m).
+ 4. If m is Infinity, return the string "Infinity".
+ 5. Otherwise, let n, k, and s be integers such that
+ k >= 1, 10k1 <= s < 10k, the number value for s10nk
+ is m, and k is as small as possible. Note that k is
+ the number of digits in the decimal representation
+ of s, that s is not divisible by 10, and that the
+ least significant digit of s is not necessarily
+ uniquely determined by these criteria.
+ 6. If k <= n <= 21, return the string consisting of the
+ k digits of the decimal representation of s (in order,
+ with no leading zeroes), followed by n-k occurences
+ of the character '0'.
+ 7. If 0 < n <= 21, return the string consisting of the
+ most significant n digits of the decimal
+ representation of s, followed by a decimal point
+ '.', followed by the remaining kn digits of the
+ decimal representation of s.
+ 8. If 6 < n <= 0, return the string consisting of the
+ character '0', followed by a decimal point '.',
+ followed by n occurences of the character '0',
+ followed by the k digits of the decimal
+ representation of s.
+ 9. Otherwise, if k = 1, return the string consisting
+ of the single digit of s, followed by lowercase
+ character 'e', followed by a plus sign '+' or minus
+ sign '' according to whether n1 is positive or
+ negative, followed by the decimal representation
+ of the integer abs(n1) (with no leading zeros).
+ 10. Return the string consisting of the most significant
+ digit of the decimal representation of s, followed
+ by a decimal point '.', followed by the remaining k1
+ digits of the decimal representation of s, followed
+ by the lowercase character 'e', followed by a plus
+ sign '+' or minus sign '' according to whether n1 is
+ positive or negative, followed by the decimal
+ representation of the integer abs(n1) (with no
+ leading zeros).
+
+ Note that if x is any number value other than 0, then
+ ToNumber(ToString(x)) is exactly the same number value as x.
+
+ As noted, the least significant digit of s is not always
+ uniquely determined by the requirements listed in step 5.
+ The following specification for step 5 was considered, but
+ not adopted:
+
+ Author: christine@netscape.com
+ Date: 10 july 1997
+*/
+
+ var SECTION = "9.8.1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var testcases = getTestCases();
+
+ writeHeaderToLog( SECTION + " ToString applied to the Number type");
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "Number.NaN", "NaN", Number.NaN + "" );
+ array[item++] = new TestCase( SECTION, "0", "0", 0 + "" );
+ array[item++] = new TestCase( SECTION, "-0", "0", -0 + "" );
+ array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY", "Infinity", Number.POSITIVE_INFINITY + "" );
+ array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY", "-Infinity", Number.NEGATIVE_INFINITY + "" );
+ array[item++] = new TestCase( SECTION, "-1", "-1", -1 + "" );
+
+ // cases in step 6: integers 1e21 > x >= 1 or -1 >= x > -1e21
+
+ array[item++] = new TestCase( SECTION, "1", "1", 1 + "" );
+ array[item++] = new TestCase( SECTION, "10", "10", 10 + "" );
+ array[item++] = new TestCase( SECTION, "100", "100", 100 + "" );
+ array[item++] = new TestCase( SECTION, "1000", "1000", 1000 + "" );
+ array[item++] = new TestCase( SECTION, "10000", "10000", 10000 + "" );
+ array[item++] = new TestCase( SECTION, "10000000000", "10000000000", 10000000000 + "" );
+ array[item++] = new TestCase( SECTION, "10000000000000000000", "10000000000000000000", 10000000000000000000 + "" );
+ array[item++] = new TestCase( SECTION, "100000000000000000000","100000000000000000000",100000000000000000000 + "" );
+
+ array[item++] = new TestCase( SECTION, "12345", "12345", 12345 + "" );
+ array[item++] = new TestCase( SECTION, "1234567890", "1234567890", 1234567890 + "" );
+
+ array[item++] = new TestCase( SECTION, "-1", "-1", -1 + "" );
+ array[item++] = new TestCase( SECTION, "-10", "-10", -10 + "" );
+ array[item++] = new TestCase( SECTION, "-100", "-100", -100 + "" );
+ array[item++] = new TestCase( SECTION, "-1000", "-1000", -1000 + "" );
+ array[item++] = new TestCase( SECTION, "-1000000000", "-1000000000", -1000000000 + "" );
+ array[item++] = new TestCase( SECTION, "-1000000000000000", "-1000000000000000", -1000000000000000 + "" );
+ array[item++] = new TestCase( SECTION, "-100000000000000000000", "-100000000000000000000", -100000000000000000000 + "" );
+ array[item++] = new TestCase( SECTION, "-1000000000000000000000", "-1e+21", -1000000000000000000000 + "" );
+
+ array[item++] = new TestCase( SECTION, "-12345", "-12345", -12345 + "" );
+ array[item++] = new TestCase( SECTION, "-1234567890", "-1234567890", -1234567890 + "" );
+
+ // cases in step 7: numbers with a fractional component, 1e21> x >1 or -1 > x > -1e21,
+ array[item++] = new TestCase( SECTION, "1.0000001", "1.0000001", 1.0000001 + "" );
+
+ // cases in step 8: fractions between 1 > x > -1, exclusive of 0 and -0
+
+ // cases in step 9: numbers with 1 significant digit >= 1e+21 or <= 1e-6
+
+ array[item++] = new TestCase( SECTION, "1000000000000000000000", "1e+21", 1000000000000000000000 + "" );
+ array[item++] = new TestCase( SECTION, "10000000000000000000000", "1e+22", 10000000000000000000000 + "" );
+
+ // cases in step 10: numbers with more than 1 significant digit >= 1e+21 or <= 1e-6
+
+ array[item++] = new TestCase( SECTION, "1.2345", "1.2345", String( 1.2345));
+ array[item++] = new TestCase( SECTION, "1.234567890", "1.23456789", String( 1.234567890 ));
+
+
+ array[item++] = new TestCase( SECTION, ".12345", "0.12345", String(.12345 ) );
+ array[item++] = new TestCase( SECTION, ".012345", "0.012345", String(.012345) );
+ array[item++] = new TestCase( SECTION, ".0012345", "0.0012345", String(.0012345) );
+ array[item++] = new TestCase( SECTION, ".00012345", "0.00012345", String(.00012345) );
+ array[item++] = new TestCase( SECTION, ".000012345", "0.000012345", String(.000012345) );
+ array[item++] = new TestCase( SECTION, ".0000012345", "0.0000012345", String(.0000012345) );
+ array[item++] = new TestCase( SECTION, ".00000012345", "1.2345e-7", String(.00000012345));
+
+ array[item++] = new TestCase( SECTION, "-1e21", "-1e+21", String(-1e21) );
+ return ( array );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.9-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.9-1.js
new file mode 100644
index 0000000..0df39f3
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/TypeConversion/9.9-1.js
@@ -0,0 +1,143 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 9.9-1.js
+ ECMA Section: 9.9 Type Conversion: ToObject
+ Description:
+
+ undefined generate a runtime error
+ null generate a runtime error
+ boolean create a new Boolean object whose default
+ value is the value of the boolean.
+ number Create a new Number object whose default
+ value is the value of the number.
+ string Create a new String object whose default
+ value is the value of the string.
+ object Return the input argument (no conversion).
+ Author: christine@netscape.com
+ Date: 17 july 1997
+*/
+
+ var VERSION = "ECMA_1";
+ startTest();
+ var SECTION = "9.9-1";
+
+ writeHeaderToLog( SECTION + " Type Conversion: ToObject" );
+ var tc= 0;
+ var testcases = getTestCases();
+
+// all tests must call a function that returns an array of TestCase objects.
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "Object(true).valueOf()", true, (Object(true)).valueOf() );
+ array[item++] = new TestCase( SECTION, "typeof Object(true)", "object", typeof Object(true) );
+ array[item++] = new TestCase( SECTION, "(Object(true)).__proto__", Boolean.prototype, (Object(true)).__proto__ );
+
+ array[item++] = new TestCase( SECTION, "Object(false).valueOf()", false, (Object(false)).valueOf() );
+ array[item++] = new TestCase( SECTION, "typeof Object(false)", "object", typeof Object(false) );
+ array[item++] = new TestCase( SECTION, "(Object(true)).__proto__", Boolean.prototype, (Object(true)).__proto__ );
+
+ array[item++] = new TestCase( SECTION, "Object(0).valueOf()", 0, (Object(0)).valueOf() );
+ array[item++] = new TestCase( SECTION, "typeof Object(0)", "object", typeof Object(0) );
+ array[item++] = new TestCase( SECTION, "(Object(0)).__proto__", Number.prototype, (Object(0)).__proto__ );
+
+ array[item++] = new TestCase( SECTION, "Object(-0).valueOf()", -0, (Object(-0)).valueOf() );
+ array[item++] = new TestCase( SECTION, "typeof Object(-0)", "object", typeof Object(-0) );
+ array[item++] = new TestCase( SECTION, "(Object(-0)).__proto__", Number.prototype, (Object(-0)).__proto__ );
+
+ array[item++] = new TestCase( SECTION, "Object(1).valueOf()", 1, (Object(1)).valueOf() );
+ array[item++] = new TestCase( SECTION, "typeof Object(1)", "object", typeof Object(1) );
+ array[item++] = new TestCase( SECTION, "(Object(1)).__proto__", Number.prototype, (Object(1)).__proto__ );
+
+ array[item++] = new TestCase( SECTION, "Object(-1).valueOf()", -1, (Object(-1)).valueOf() );
+ array[item++] = new TestCase( SECTION, "typeof Object(-1)", "object", typeof Object(-1) );
+ array[item++] = new TestCase( SECTION, "(Object(-1)).__proto__", Number.prototype, (Object(-1)).__proto__ );
+
+ array[item++] = new TestCase( SECTION, "Object(Number.MAX_VALUE).valueOf()", 1.7976931348623157e308, (Object(Number.MAX_VALUE)).valueOf() );
+ array[item++] = new TestCase( SECTION, "typeof Object(Number.MAX_VALUE)", "object", typeof Object(Number.MAX_VALUE) );
+ array[item++] = new TestCase( SECTION, "(Object(Number.MAX_VALUE)).__proto__", Number.prototype, (Object(Number.MAX_VALUE)).__proto__ );
+
+ array[item++] = new TestCase( SECTION, "Object(Number.MIN_VALUE).valueOf()", 5e-324, (Object(Number.MIN_VALUE)).valueOf() );
+ array[item++] = new TestCase( SECTION, "typeof Object(Number.MIN_VALUE)", "object", typeof Object(Number.MIN_VALUE) );
+ array[item++] = new TestCase( SECTION, "(Object(Number.MIN_VALUE)).__proto__", Number.prototype, (Object(Number.MIN_VALUE)).__proto__ );
+
+ array[item++] = new TestCase( SECTION, "Object(Number.POSITIVE_INFINITY).valueOf()", Number.POSITIVE_INFINITY, (Object(Number.POSITIVE_INFINITY)).valueOf() );
+ array[item++] = new TestCase( SECTION, "typeof Object(Number.POSITIVE_INFINITY)", "object", typeof Object(Number.POSITIVE_INFINITY) );
+ array[item++] = new TestCase( SECTION, "(Object(Number.POSITIVE_INFINITY)).__proto__", Number.prototype, (Object(Number.POSITIVE_INFINITY)).__proto__ );
+
+ array[item++] = new TestCase( SECTION, "Object(Number.NEGATIVE_INFINITY).valueOf()", Number.NEGATIVE_INFINITY, (Object(Number.NEGATIVE_INFINITY)).valueOf() );
+ array[item++] = new TestCase( SECTION, "typeof Object(Number.NEGATIVE_INFINITY)", "object", typeof Object(Number.NEGATIVE_INFINITY) );
+ array[item++] = new TestCase( SECTION, "(Object(Number.NEGATIVE_INFINITY)).__proto__", Number.prototype, (Object(Number.NEGATIVE_INFINITY)).__proto__ );
+
+ array[item++] = new TestCase( SECTION, "Object(Number.NaN).valueOf()", Number.NaN, (Object(Number.NaN)).valueOf() );
+ array[item++] = new TestCase( SECTION, "typeof Object(Number.NaN)", "object", typeof Object(Number.NaN) );
+ array[item++] = new TestCase( SECTION, "(Object(Number.NaN)).__proto__", Number.prototype, (Object(Number.NaN)).__proto__ );
+
+ array[item++] = new TestCase( SECTION, "Object('a string').valueOf()", "a string", (Object("a string")).valueOf() );
+ array[item++] = new TestCase( SECTION, "typeof Object('a string')", "object", typeof (Object("a string")) );
+ array[item++] = new TestCase( SECTION, "(Object('a string')).__proto__", String.prototype, (Object("a string")).__proto__ );
+
+ array[item++] = new TestCase( SECTION, "Object('').valueOf()", "", (Object("")).valueOf() );
+ array[item++] = new TestCase( SECTION, "typeof Object('')", "object", typeof (Object("")) );
+ array[item++] = new TestCase( SECTION, "(Object('')).__proto__", String.prototype, (Object("")).__proto__ );
+
+ array[item++] = new TestCase( SECTION, "Object('\\r\\t\\b\\n\\v\\f').valueOf()", "\r\t\b\n\v\f", (Object("\r\t\b\n\v\f")).valueOf() );
+ array[item++] = new TestCase( SECTION, "typeof Object('\\r\\t\\b\\n\\v\\f')", "object", typeof (Object("\\r\\t\\b\\n\\v\\f")) );
+ array[item++] = new TestCase( SECTION, "(Object('\\r\\t\\b\\n\\v\\f')).__proto__", String.prototype, (Object("\\r\\t\\b\\n\\v\\f")).__proto__ );
+
+ array[item++] = new TestCase( SECTION, "Object( '\\\'\\\"\\' ).valueOf()", "\'\"\\", (Object("\'\"\\")).valueOf() );
+ array[item++] = new TestCase( SECTION, "typeof Object( '\\\'\\\"\\' )", "object", typeof Object("\'\"\\") );
+ array[item++] = new TestCase( SECTION, "Object( '\\\'\\\"\\' ).__proto__", String.prototype, (Object("\'\"\\")).__proto__ );
+
+ array[item++] = new TestCase( SECTION, "Object( new MyObject(true) ).valueOf()", true, eval("Object( new MyObject(true) ).valueOf()") );
+ array[item++] = new TestCase( SECTION, "typeof Object( new MyObject(true) )", "object", eval("typeof Object( new MyObject(true) )") );
+ array[item++] = new TestCase( SECTION, "(Object( new MyObject(true) )).toString()", "[object Object]", eval("(Object( new MyObject(true) )).toString()") );
+
+ return ( array );
+}
+
+function test() {
+ for ( tc = 0; tc < testcases.length; tc++ ) {
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason +=
+ ( testcases[tc].passed ) ? "" : "wrong value ";
+
+ }
+ stopTest();
+
+ // all tests must return an array of TestCase objects
+ return ( testcases );
+}
+function MyObject( value ) {
+ this.value = value;
+ this.valueOf = new Function ( "return this.value" );
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Types/8.1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Types/8.1.js
new file mode 100644
index 0000000..efc4792
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Types/8.1.js
@@ -0,0 +1,71 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 8.1.js
+ ECMA Section: The undefined type
+ Description:
+
+ The Undefined type has exactly one value, called undefined. Any variable
+ that has not been assigned a value is of type Undefined.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "8.1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "The undefined type";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ testcases[tc++] = new TestCase( SECTION,
+ "var x; typeof x",
+ "undefined",
+ eval("var x; typeof x") );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "var x; typeof x == 'undefined",
+ true,
+ eval("var x; typeof x == 'undefined'") );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "var x; x == void 0",
+ true,
+ eval("var x; x == void 0") );
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Types/8.4.js b/Source/JavaScriptCore/tests/mozilla/ecma/Types/8.4.js
new file mode 100644
index 0000000..c18f744
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Types/8.4.js
@@ -0,0 +1,125 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 8.4.js
+ ECMA Section: The String type
+ Description:
+
+ The String type is the set of all finite ordered sequences of zero or more
+ Unicode characters. Each character is regarded as occupying a position
+ within the sequence. These positions are identified by nonnegative
+ integers. The leftmost character (if any) is at position 0, the next
+ character (if any) at position 1, and so on. The length of a string is the
+ number of distinct positions within it. The empty string has length zero
+ and therefore contains no characters.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "8.4";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "The String type";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ testcases[tc++] = new TestCase( SECTION,
+ "var s = ''; s.length",
+ 0,
+ eval("var s = ''; s.length") );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "var s = ''; s.charAt(0)",
+ "",
+ eval("var s = ''; s.charAt(0)") );
+
+
+ for ( var i = 0x0041, TEST_STRING = "", EXPECT_STRING = ""; i < 0x007B; i++ ) {
+ TEST_STRING += ("\\u"+ DecimalToHexString( i ) );
+ EXPECT_STRING += String.fromCharCode(i);
+ }
+
+ testcases[tc++] = new TestCase( SECTION,
+ "var s = '" + TEST_STRING+ "'; s",
+ EXPECT_STRING,
+ eval("var s = '" + TEST_STRING+ "'; s") );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "var s = '" + TEST_STRING+ "'; s.length",
+ 0x007B-0x0041,
+ eval("var s = '" + TEST_STRING+ "'; s.length") );
+
+ test();
+function DecimalToHexString( n ) {
+ n = Number( n );
+ var h = "";
+
+ for ( var i = 3; i >= 0; i-- ) {
+ if ( n >= Math.pow(16, i) ){
+ var t = Math.floor( n / Math.pow(16, i));
+ n -= t * Math.pow(16, i);
+ if ( t >= 10 ) {
+ if ( t == 10 ) {
+ h += "A";
+ }
+ if ( t == 11 ) {
+ h += "B";
+ }
+ if ( t == 12 ) {
+ h += "C";
+ }
+ if ( t == 13 ) {
+ h += "D";
+ }
+ if ( t == 14 ) {
+ h += "E";
+ }
+ if ( t == 15 ) {
+ h += "F";
+ }
+ } else {
+ h += String( t );
+ }
+ } else {
+ h += "0";
+ }
+ }
+
+ return h;
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/Types/8.6.2.1-1.js b/Source/JavaScriptCore/tests/mozilla/ecma/Types/8.6.2.1-1.js
new file mode 100644
index 0000000..05b9400
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/Types/8.6.2.1-1.js
@@ -0,0 +1,105 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 8.6.2.1-1.js
+ ECMA Section: 8.6.2.1 Get (Value)
+ Description:
+
+ When the [[Get]] method of O is called with property name P, the following
+ steps are taken:
+
+ 1. If O doesn't have a property with name P, go to step 4.
+ 2. Get the value of the property.
+ 3. Return Result(2).
+ 4. If the [[Prototype]] of O is null, return undefined.
+ 5. Call the [[Get]] method of [[Prototype]] with property name P.
+ 6. Return Result(5).
+
+ This tests [[Get]] (Value).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "8.6.2.1-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var testcases = getTestCases();
+
+ writeHeaderToLog( SECTION + " [[Get]] (Value)");
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ array[item++] = new TestCase( SECTION, "var OBJ = new MyValuelessObject(true); OBJ.valueOf()", true, eval("var OBJ = new MyValuelessObject(true); OBJ.valueOf()") );
+// array[item++] = new TestCase( SECTION, "var OBJ = new MyProtoValuelessObject(true); OBJ + ''", "undefined", eval("var OBJ = new MyProtoValuelessObject(); OBJ + ''") );
+ array[item++] = new TestCase( SECTION, "var OBJ = new MyProtolessObject(true); OBJ.valueOf()", true, eval("var OBJ = new MyProtolessObject(true); OBJ.valueOf()") );
+ array[item++] = new TestCase( SECTION, "var OBJ = new MyObject(true); OBJ.valueOf()", true, eval("var OBJ = new MyObject(true); OBJ.valueOf()") );
+
+ array[item++] = new TestCase( SECTION, "var OBJ = new MyValuelessObject(Number.POSITIVE_INFINITY); OBJ.valueOf()", Number.POSITIVE_INFINITY, eval("var OBJ = new MyValuelessObject(Number.POSITIVE_INFINITY); OBJ.valueOf()") );
+// array[item++] = new TestCase( SECTION, "var OBJ = new MyProtoValuelessObject(Number.POSITIVE_INFINITY); OBJ + ''", "undefined", eval("var OBJ = new MyProtoValuelessObject(); OBJ + ''") );
+ array[item++] = new TestCase( SECTION, "var OBJ = new MyProtolessObject(Number.POSITIVE_INFINITY); OBJ.valueOf()", Number.POSITIVE_INFINITY, eval("var OBJ = new MyProtolessObject(Number.POSITIVE_INFINITY); OBJ.valueOf()") );
+ array[item++] = new TestCase( SECTION, "var OBJ = new MyObject(Number.POSITIVE_INFINITY); OBJ.valueOf()", Number.POSITIVE_INFINITY, eval("var OBJ = new MyObject(Number.POSITIVE_INFINITY); OBJ.valueOf()") );
+
+ array[item++] = new TestCase( SECTION, "var OBJ = new MyValuelessObject('string'); OBJ.valueOf()", 'string', eval("var OBJ = new MyValuelessObject('string'); OBJ.valueOf()") );
+// array[item++] = new TestCase( SECTION, "var OBJ = new MyProtoValuelessObject('string'); OJ + ''", "undefined", eval("var OBJ = new MyProtoValuelessObject(); OBJ + ''") );
+ array[item++] = new TestCase( SECTION, "var OBJ = new MyProtolessObject('string'); OBJ.valueOf()", 'string', eval("var OBJ = new MyProtolessObject('string'); OBJ.valueOf()") );
+ array[item++] = new TestCase( SECTION, "var OBJ = new MyObject('string'); OBJ.valueOf()", 'string', eval("var OBJ = new MyObject('string'); OBJ.valueOf()") );
+
+ return ( array );
+}
+function MyProtoValuelessObject(value) {
+ this.valueOf = new Function ( "" );
+ this.__proto__ = null;
+}
+
+function MyProtolessObject( value ) {
+ this.valueOf = new Function( "return this.value" );
+ this.__proto__ = null;
+ this.value = value;
+}
+function MyValuelessObject(value) {
+ this.__proto__ = new MyPrototypeObject(value);
+}
+function MyPrototypeObject(value) {
+ this.valueOf = new Function( "return this.value;" );
+ this.toString = new Function( "return (this.value + '');" );
+ this.value = value;
+}
+function MyObject( value ) {
+ this.valueOf = new Function( "return this.value" );
+ this.value = value;
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/browser.js b/Source/JavaScriptCore/tests/mozilla/ecma/browser.js
new file mode 100644
index 0000000..5bbdf7c
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/browser.js
@@ -0,0 +1,80 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS
+* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+* implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation. All
+* Rights Reserved.
+*
+* Contributor(s):
+*/
+
+/*
+ * JavaScript test library shared functions file for running the tests
+ * in the browser. Overrides the shell's print function with document.write
+ * and make everything HTML pretty.
+ *
+ * To run the tests in the browser, use the mkhtml.pl script to generate
+ * html pages that include the shell.js, browser.js (this file), and the
+ * test js file in script tags.
+ *
+ * The source of the page that is generated should look something like this:
+ * <script src="./../shell.js"></script>
+ * <script src="./../browser.js"></script>
+ * <script src="./mytest.js"></script>
+ */
+
+onerror = err;
+
+function startTest() {
+ if ( BUGNUMBER ) {
+ writeLineToLog ("BUGNUMBER: " + BUGNUMBER );
+ }
+
+ testcases = new Array();
+ tc = 0;
+}
+
+function writeLineToLog( string ) {
+ document.write( string + "<br>\n");
+}
+function writeHeaderToLog( string ) {
+ document.write( "<h2>" + string + "</h2>" );
+}
+function stopTest() {
+ var gc;
+ if ( gc != undefined ) {
+ gc();
+ }
+ document.write( "<hr>" );
+}
+function writeFormattedResult( expect, actual, string, passed ) {
+ var s = "<tt>"+ string ;
+ s += "<b>" ;
+ s += ( passed ) ? "<font color=#009900> &nbsp;" + PASSED
+ : "<font color=#aa0000>&nbsp;" + FAILED + expect + "</tt>";
+ writeLineToLog( s + "</font></b></tt>" );
+ return passed;
+}
+function err( msg, page, line ) {
+ writeLineToLog( "Test failed with the message: " + msg );
+
+ testcases[tc].actual = "error";
+ testcases[tc].reason = msg;
+ writeTestCaseResult( testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual +
+ ": " + testcases[tc].reason );
+ stopTest();
+ return true;
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/jsref.js b/Source/JavaScriptCore/tests/mozilla/ecma/jsref.js
new file mode 100644
index 0000000..51b5a83
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/jsref.js
@@ -0,0 +1,669 @@
+var completed = false;
+var testcases;
+var tc = 0;
+
+SECTION = "";
+VERSION = "";
+BUGNUMBER = "";
+TITLE = "";
+
+/*
+ * constant strings
+ */
+var GLOBAL = "[object global]";
+var PASSED = " PASSED!"
+var FAILED = " FAILED! expected: ";
+var DEBUG = false;
+
+TZ_DIFF = -8;
+
+var TT = "";
+var TT_ = "";
+var BR = "";
+var NBSP = " ";
+var CR = "\n";
+var FONT = "";
+var FONT_ = "";
+var FONT_RED = "";
+var FONT_GREEN = "";
+var B = "";
+var B_ = ""
+var H2 = "";
+var H2_ = "";
+var HR = "";
+var DEBUG = false;
+
+var PASSED = " PASSED!"
+var FAILED = " FAILED! expected: ";
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+/* wrapper for test cas constructor that doesn't require the SECTION
+ * argument.
+ */
+
+function AddTestCase( description, expect, actual ) {
+ testcases[tc++] = new TestCase( SECTION, description, expect, actual );
+}
+
+function TestCase( n, d, e, a ) {
+ this.name = n;
+ this.description = d;
+ this.expect = e;
+ this.actual = a;
+ this.passed = true;
+ this.reason = "";
+ this.bugnumber = BUGNUMBER;
+
+ this.passed = getTestCaseResult( this.expect, this.actual );
+ if ( DEBUG ) {
+ writeLineToLog( "added " + this.description );
+ }
+}
+
+/*
+ * Set up test environment.
+ *
+ */
+function startTest() {
+ if ( version ) {
+ // JavaScript 1.3 is supposed to be compliant ecma version 1.0
+ if ( VERSION == "ECMA_1" ) {
+ version ( "130" );
+ }
+ if ( VERSION == "JS_1.3" ) {
+ version ( "130" );
+ }
+ if ( VERSION == "JS_1.2" ) {
+ version ( "120" );
+ }
+ if ( VERSION == "JS_1.1" ) {
+ version ( "110" );
+ }
+ // for ecma version 2.0, we will leave the javascript version to
+ // the default ( for now ).
+ }
+
+ // print out bugnumber
+
+ if ( BUGNUMBER ) {
+ writeLineToLog ("BUGNUMBER: " + BUGNUMBER );
+ }
+
+ testcases = new Array();
+ tc = 0;
+}
+
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
+
+function getTestCaseResult( expect, actual ) {
+ // because ( NaN == NaN ) always returns false, need to do
+ // a special compare to see if we got the right result.
+ if ( actual != actual ) {
+ if ( typeof actual == "object" ) {
+ actual = "NaN object";
+ } else {
+ actual = "NaN number";
+ }
+ }
+ if ( expect != expect ) {
+ if ( typeof expect == "object" ) {
+ expect = "NaN object";
+ } else {
+ expect = "NaN number";
+ }
+ }
+
+ var passed = ( expect == actual ) ? true : false;
+
+ // if both objects are numbers
+ // need to replace w/ IEEE standard for rounding
+ if ( !passed
+ && typeof(actual) == "number"
+ && typeof(expect) == "number"
+ ) {
+ if ( Math.abs(actual-expect) < 0.0000001 ) {
+ passed = true;
+ }
+ }
+
+ // verify type is the same
+ if ( typeof(expect) != typeof(actual) ) {
+ passed = false;
+ }
+
+ return passed;
+}
+function writeTestCaseResult( expect, actual, string ) {
+ var passed = getTestCaseResult( expect, actual );
+ writeFormattedResult( expect, actual, string, passed );
+ return passed;
+}
+function writeFormattedResult( expect, actual, string, passed ) {
+ var s = TT + string ;
+
+ for ( k = 0;
+ k < (60 - string.length >= 0 ? 60 - string.length : 5) ;
+ k++ ) {
+ }
+
+ s += B ;
+ s += ( passed ) ? FONT_GREEN + NBSP + PASSED : FONT_RED + NBSP + FAILED + expect + TT_ ;
+
+ writeLineToLog( s + FONT_ + B_ + TT_ );
+
+ return passed;
+}
+
+function writeLineToLog( string ) {
+ print( string + BR + CR );
+}
+function writeHeaderToLog( string ) {
+ print( H2 + string + H2_ );
+}
+function stopTest()
+{
+ var sizeTag = "<#TEST CASES SIZE>";
+ var doneTag = "<#TEST CASES DONE>";
+ var beginTag = "<#TEST CASE ";
+ var endTag = ">";
+
+ print(sizeTag);
+ print(testcases.length);
+ for (tc = 0; tc < testcases.length; tc++)
+ {
+ print(beginTag + 'PASSED' + endTag);
+ print(testcases[tc].passed);
+ print(beginTag + 'NAME' + endTag);
+ print(testcases[tc].name);
+ print(beginTag + 'EXPECTED' + endTag);
+ print(testcases[tc].expect);
+ print(beginTag + 'ACTUAL' + endTag);
+ print(testcases[tc].actual);
+ print(beginTag + 'DESCRIPTION' + endTag);
+ print(testcases[tc].description);
+ print(beginTag + 'REASON' + endTag);
+ print(( testcases[tc].passed ) ? "" : "wrong value ");
+ print(beginTag + 'BUGNUMBER' + endTag);
+ print( BUGNUMBER );
+ }
+ print(doneTag);
+ print( HR );
+ gc();
+}
+function getFailedCases() {
+ for ( var i = 0; i < testcases.length; i++ ) {
+ if ( ! testcases[i].passed ) {
+ print( testcases[i].description +" = " +testcases[i].actual +" expected: "+ testcases[i].expect );
+ }
+ }
+}
+function err( msg, page, line ) {
+ testcases[tc].actual = "error";
+ testcases[tc].reason = msg;
+ writeTestCaseResult( testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual +
+ ": " + testcases[tc].reason );
+ stopTest();
+ return true;
+}
+
+/**
+ * Type Conversion functions used by Type Conversion
+ *
+ */
+
+
+
+ /*
+ * Date functions used by tests in Date suite
+ *
+ */
+var msPerDay = 86400000;
+var HoursPerDay = 24;
+var MinutesPerHour = 60;
+var SecondsPerMinute = 60;
+var msPerSecond = 1000;
+var msPerMinute = 60000; // msPerSecond * SecondsPerMinute
+var msPerHour = 3600000; // msPerMinute * MinutesPerHour
+
+var TIME_1970 = 0;
+var TIME_2000 = 946684800000;
+var TIME_1900 = -2208988800000;
+
+function Day( t ) {
+ return ( Math.floor(t/msPerDay ) );
+}
+function DaysInYear( y ) {
+ if ( y % 4 != 0 ) {
+ return 365;
+ }
+ if ( (y % 4 == 0) && (y % 100 != 0) ) {
+ return 366;
+ }
+ if ( (y % 100 == 0) && (y % 400 != 0) ) {
+ return 365;
+ }
+ if ( (y % 400 == 0) ){
+ return 366;
+ } else {
+ return "ERROR: DaysInYear(" + y + ") case not covered";
+ }
+}
+function TimeInYear( y ) {
+ return ( DaysInYear(y) * msPerDay );
+}
+function DayNumber( t ) {
+ return ( Math.floor( t / msPerDay ) );
+}
+function TimeWithinDay( t ) {
+ if ( t < 0 ) {
+ return ( (t % msPerDay) + msPerDay );
+ } else {
+ return ( t % msPerDay );
+ }
+}
+function YearNumber( t ) {
+}
+function TimeFromYear( y ) {
+ return ( msPerDay * DayFromYear(y) );
+}
+function DayFromYear( y ) {
+ return ( 365*(y-1970) +
+ Math.floor((y-1969)/4) -
+ Math.floor((y-1901)/100) +
+ Math.floor((y-1601)/400) );
+}
+function InLeapYear( t ) {
+ if ( DaysInYear(YearFromTime(t)) == 365 ) {
+ return 0;
+ }
+ if ( DaysInYear(YearFromTime(t)) == 366 ) {
+ return 1;
+ } else {
+ return "ERROR: InLeapYear("+t+") case not covered";
+ }
+}
+function YearFromTime( t ) {
+ t = Number( t );
+ var sign = ( t < 0 ) ? -1 : 1;
+ var year = ( sign < 0 ) ? 1969 : 1970;
+ for ( var timeToTimeZero = t; ; ) {
+ // subtract the current year's time from the time that's left.
+ timeToTimeZero -= sign * TimeInYear(year)
+
+ // if there's less than the current year's worth of time left, then break.
+ if ( sign < 0 ) {
+ if ( sign * timeToTimeZero <= 0 ) {
+ break;
+ } else {
+ year += sign;
+ }
+ } else {
+ if ( sign * timeToTimeZero < 0 ) {
+ break;
+ } else {
+ year += sign;
+ }
+ }
+ }
+ return ( year );
+}
+function MonthFromTime( t ) {
+ // i know i could use switch but i'd rather not until it's part of ECMA
+ var day = DayWithinYear( t );
+ var leap = InLeapYear(t);
+
+ if ( (0 <= day) && (day < 31) ) {
+ return 0;
+ }
+ if ( (31 <= day) && (day < (59+leap)) ) {
+ return 1;
+ }
+ if ( ((59+leap) <= day) && (day < (90+leap)) ) {
+ return 2;
+ }
+ if ( ((90+leap) <= day) && (day < (120+leap)) ) {
+ return 3;
+ }
+ if ( ((120+leap) <= day) && (day < (151+leap)) ) {
+ return 4;
+ }
+ if ( ((151+leap) <= day) && (day < (181+leap)) ) {
+ return 5;
+ }
+ if ( ((181+leap) <= day) && (day < (212+leap)) ) {
+ return 6;
+ }
+ if ( ((212+leap) <= day) && (day < (243+leap)) ) {
+ return 7;
+ }
+ if ( ((243+leap) <= day) && (day < (273+leap)) ) {
+ return 8;
+ }
+ if ( ((273+leap) <= day) && (day < (304+leap)) ) {
+ return 9;
+ }
+ if ( ((304+leap) <= day) && (day < (334+leap)) ) {
+ return 10;
+ }
+ if ( ((334+leap) <= day) && (day < (365+leap)) ) {
+ return 11;
+ } else {
+ return "ERROR: MonthFromTime("+t+") not known";
+ }
+}
+function DayWithinYear( t ) {
+ return( Day(t) - DayFromYear(YearFromTime(t)));
+}
+function DateFromTime( t ) {
+ var day = DayWithinYear(t);
+ var month = MonthFromTime(t);
+
+ if ( month == 0 ) {
+ return ( day + 1 );
+ }
+ if ( month == 1 ) {
+ return ( day - 30 );
+ }
+ if ( month == 2 ) {
+ return ( day - 58 - InLeapYear(t) );
+ }
+ if ( month == 3 ) {
+ return ( day - 89 - InLeapYear(t));
+ }
+ if ( month == 4 ) {
+ return ( day - 119 - InLeapYear(t));
+ }
+ if ( month == 5 ) {
+ return ( day - 150- InLeapYear(t));
+ }
+ if ( month == 6 ) {
+ return ( day - 180- InLeapYear(t));
+ }
+ if ( month == 7 ) {
+ return ( day - 211- InLeapYear(t));
+ }
+ if ( month == 8 ) {
+ return ( day - 242- InLeapYear(t));
+ }
+ if ( month == 9 ) {
+ return ( day - 272- InLeapYear(t));
+ }
+ if ( month == 10 ) {
+ return ( day - 303- InLeapYear(t));
+ }
+ if ( month == 11 ) {
+ return ( day - 333- InLeapYear(t));
+ }
+
+ return ("ERROR: DateFromTime("+t+") not known" );
+}
+function WeekDay( t ) {
+ var weekday = (Day(t)+4) % 7;
+ return( weekday < 0 ? 7 + weekday : weekday );
+}
+
+// missing daylight savins time adjustment
+
+function HourFromTime( t ) {
+ var h = Math.floor( t / msPerHour ) % HoursPerDay;
+ return ( (h<0) ? HoursPerDay + h : h );
+}
+function MinFromTime( t ) {
+ var min = Math.floor( t / msPerMinute ) % MinutesPerHour;
+ return( ( min < 0 ) ? MinutesPerHour + min : min );
+}
+function SecFromTime( t ) {
+ var sec = Math.floor( t / msPerSecond ) % SecondsPerMinute;
+ return ( (sec < 0 ) ? SecondsPerMinute + sec : sec );
+}
+function msFromTime( t ) {
+ var ms = t % msPerSecond;
+ return ( (ms < 0 ) ? msPerSecond + ms : ms );
+}
+function LocalTZA() {
+ return ( TZ_DIFF * msPerHour );
+}
+function UTC( t ) {
+ return ( t - LocalTZA() - DaylightSavingTA(t - LocalTZA()) );
+}
+function DaylightSavingTA( t ) {
+ t = t - LocalTZA();
+
+ var dst_start = GetSecondSundayInMarch(t) + 2*msPerHour;
+ var dst_end = GetFirstSundayInNovember(t)+ 2*msPerHour;
+
+ if ( t >= dst_start && t < dst_end ) {
+ return msPerHour;
+ } else {
+ return 0;
+ }
+
+ // Daylight Savings Time starts on the first Sunday in April at 2:00AM in
+ // PST. Other time zones will need to override this function.
+
+ print( new Date( UTC(dst_start + LocalTZA())) );
+
+ return UTC(dst_start + LocalTZA());
+}
+function GetFirstSundayInApril( t ) {
+ var year = YearFromTime(t);
+ var leap = InLeapYear(t);
+
+ var april = TimeFromYear(year) + TimeInMonth(0, leap) + TimeInMonth(1,leap) +
+ TimeInMonth(2,leap);
+
+ for ( var first_sunday = april; WeekDay(first_sunday) > 0;
+ first_sunday += msPerDay )
+ {
+ ;
+ }
+
+ return first_sunday;
+}
+function GetLastSundayInOctober( t ) {
+ var year = YearFromTime(t);
+ var leap = InLeapYear(t);
+
+ for ( var oct = TimeFromYear(year), m = 0; m < 9; m++ ) {
+ oct += TimeInMonth(m, leap);
+ }
+ for ( var last_sunday = oct + 30*msPerDay; WeekDay(last_sunday) > 0;
+ last_sunday -= msPerDay )
+ {
+ ;
+ }
+ return last_sunday;
+}
+
+// Added these two functions because DST rules changed for the US.
+function GetSecondSundayInMarch( t ) {
+ var year = YearFromTime(t);
+ var leap = InLeapYear(t);
+
+ var march = TimeFromYear(year) + TimeInMonth(0, leap) + TimeInMonth(1,leap);
+
+ var sundayCount = 0;
+ var flag = true;
+ for ( var second_sunday = march; flag; second_sunday += msPerDay )
+ {
+ if (WeekDay(second_sunday) == 0) {
+ if(++sundayCount == 2)
+ flag = false;
+ }
+ }
+
+ return second_sunday;
+}
+function GetFirstSundayInNovember( t ) {
+ var year = YearFromTime(t);
+ var leap = InLeapYear(t);
+
+ for ( var nov = TimeFromYear(year), m = 0; m < 10; m++ ) {
+ nov += TimeInMonth(m, leap);
+ }
+ for ( var first_sunday = nov; WeekDay(first_sunday) > 0;
+ first_sunday += msPerDay )
+ {
+ ;
+ }
+ return first_sunday;
+}
+function LocalTime( t ) {
+ return ( t + LocalTZA() + DaylightSavingTA(t) );
+}
+function MakeTime( hour, min, sec, ms ) {
+ if ( isNaN( hour ) || isNaN( min ) || isNaN( sec ) || isNaN( ms ) ) {
+ return Number.NaN;
+ }
+
+ hour = ToInteger(hour);
+ min = ToInteger( min);
+ sec = ToInteger( sec);
+ ms = ToInteger( ms );
+
+ return( (hour*msPerHour) + (min*msPerMinute) +
+ (sec*msPerSecond) + ms );
+}
+function MakeDay( year, month, date ) {
+ if ( isNaN(year) || isNaN(month) || isNaN(date) ) {
+ return Number.NaN;
+ }
+ year = ToInteger(year);
+ month = ToInteger(month);
+ date = ToInteger(date );
+
+ var sign = ( year < 1970 ) ? -1 : 1;
+ var t = ( year < 1970 ) ? 1 : 0;
+ var y = ( year < 1970 ) ? 1969 : 1970;
+
+ var result5 = year + Math.floor( month/12 );
+ var result6 = month % 12;
+
+ if ( year < 1970 ) {
+ for ( y = 1969; y >= year; y += sign ) {
+ t += sign * TimeInYear(y);
+ }
+ } else {
+ for ( y = 1970 ; y < year; y += sign ) {
+ t += sign * TimeInYear(y);
+ }
+ }
+
+ var leap = InLeapYear( t );
+
+ for ( var m = 0; m < month; m++ ) {
+ t += TimeInMonth( m, leap );
+ }
+
+ if ( YearFromTime(t) != result5 ) {
+ return Number.NaN;
+ }
+ if ( MonthFromTime(t) != result6 ) {
+ return Number.NaN;
+ }
+ if ( DateFromTime(t) != 1 ) {
+ return Number.NaN;
+ }
+
+ return ( (Day(t)) + date - 1 );
+}
+function TimeInMonth( month, leap ) {
+ // september april june november
+ // jan 0 feb 1 mar 2 apr 3 may 4 june 5 jul 6
+ // aug 7 sep 8 oct 9 nov 10 dec 11
+
+ if ( month == 3 || month == 5 || month == 8 || month == 10 ) {
+ return ( 30*msPerDay );
+ }
+
+ // all the rest
+ if ( month == 0 || month == 2 || month == 4 || month == 6 ||
+ month == 7 || month == 9 || month == 11 ) {
+ return ( 31*msPerDay );
+ }
+
+ // save february
+ return ( (leap == 0) ? 28*msPerDay : 29*msPerDay );
+}
+function MakeDate( day, time ) {
+ if ( day == Number.POSITIVE_INFINITY ||
+ day == Number.NEGATIVE_INFINITY ||
+ day == Number.NaN ) {
+ return Number.NaN;
+ }
+ if ( time == Number.POSITIVE_INFINITY ||
+ time == Number.POSITIVE_INFINITY ||
+ day == Number.NaN) {
+ return Number.NaN;
+ }
+ return ( day * msPerDay ) + time;
+}
+function TimeClip( t ) {
+ if ( isNaN( t ) ) {
+ return ( Number.NaN );
+ }
+ if ( Math.abs( t ) > 8.64e15 ) {
+ return ( Number.NaN );
+ }
+
+ return ( ToInteger( t ) );
+}
+function ToInteger( t ) {
+ t = Number( t );
+
+ if ( isNaN( t ) ){
+ return ( Number.NaN );
+ }
+ if ( t == 0 || t == -0 ||
+ t == Number.POSITIVE_INFINITY || t == Number.NEGATIVE_INFINITY ) {
+ return 0;
+ }
+
+ var sign = ( t < 0 ) ? -1 : 1;
+
+ return ( sign * Math.floor( Math.abs( t ) ) );
+}
+function Enumerate ( o ) {
+ var properties = new Array();
+ for ( p in o ) {
+ properties[ properties.length ] = new Array( p, o[p] );
+ }
+ return properties;
+}
+function AddTestCase( description, expect, actual ) {
+ testcases[tc++] = new TestCase( SECTION, description, expect, actual );
+}
+
+function getFailedCases() {
+ for ( var i = 0; i < testcases.length; i++ ) {
+ if ( ! testcases[i].passed ) {
+ print( testcases[i].description +" = " +testcases[i].actual +" expected: "+ testcases[i].expect );
+ }
+ }
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma/shell.js b/Source/JavaScriptCore/tests/mozilla/ecma/shell.js
new file mode 100644
index 0000000..1c82aed
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma/shell.js
@@ -0,0 +1,712 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/*
+ * JavaScript shared functions file for running the tests in either
+ * stand-alone JavaScript engine. To run a test, first load this file,
+ * then load the test script.
+ */
+
+var completed = false;
+var testcases;
+var tc = 0;
+
+SECTION = "";
+VERSION = "";
+BUGNUMBER = "";
+
+/*
+ * constant strings
+ */
+var GLOBAL = "[object global]";
+var PASSED = " PASSED!"
+var FAILED = " FAILED! expected: ";
+
+var DEBUG = false;
+
+
+
+/* wrapper for test cas constructor that doesn't require the SECTION
+ * argument.
+ */
+
+function AddTestCase( description, expect, actual ) {
+ testcases[tc++] = new TestCase( SECTION, description, expect, actual );
+}
+
+/*
+ * TestCase constructor
+ *
+ */
+
+function TestCase( n, d, e, a ) {
+ this.name = n;
+ this.description = d;
+ this.expect = e;
+ this.actual = a;
+ this.passed = true;
+ this.reason = "";
+ this.bugnumber = BUGNUMBER;
+
+ this.passed = getTestCaseResult( this.expect, this.actual );
+ if ( DEBUG ) {
+ writeLineToLog( "added " + this.description );
+ }
+}
+
+/*
+ * Set up test environment.
+ *
+ */
+function startTest() {
+ if ( version ) {
+ // JavaScript 1.3 is supposed to be compliant ecma version 1.0
+ if ( VERSION == "ECMA_1" ) {
+ version ( "130" );
+ }
+ if ( VERSION == "JS_1.3" ) {
+ version ( "130" );
+ }
+ if ( VERSION == "JS_1.2" ) {
+ version ( "120" );
+ }
+ if ( VERSION == "JS_1.1" ) {
+ version ( "110" );
+ }
+ // for ecma version 2.0, we will leave the javascript version to
+ // the default ( for now ).
+ }
+
+ // print out bugnumber
+
+ if ( BUGNUMBER ) {
+ writeLineToLog ("BUGNUMBER: " + BUGNUMBER );
+ }
+
+ testcases = new Array();
+ tc = 0;
+}
+
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
+/*
+ * Compare expected result to the actual result and figure out whether
+ * the test case passed.
+ */
+function getTestCaseResult( expect, actual ) {
+ // because ( NaN == NaN ) always returns false, need to do
+ // a special compare to see if we got the right result.
+ if ( actual != actual ) {
+ if ( typeof actual == "object" ) {
+ actual = "NaN object";
+ } else {
+ actual = "NaN number";
+ }
+ }
+ if ( expect != expect ) {
+ if ( typeof expect == "object" ) {
+ expect = "NaN object";
+ } else {
+ expect = "NaN number";
+ }
+ }
+
+ var passed = ( expect == actual ) ? true : false;
+
+ // if both objects are numbers
+ // need to replace w/ IEEE standard for rounding
+ if ( !passed
+ && typeof(actual) == "number"
+ && typeof(expect) == "number"
+ ) {
+ if ( Math.abs(actual-expect) < 0.0000001 ) {
+ passed = true;
+ }
+ }
+
+ // verify type is the same
+ if ( typeof(expect) != typeof(actual) ) {
+ passed = false;
+ }
+
+ return passed;
+}
+
+/*
+ * Begin printing functions. These functions use the shell's
+ * print function. When running tests in the browser, these
+ * functions, override these functions with functions that use
+ * document.write.
+ */
+
+function writeTestCaseResult( expect, actual, string ) {
+ var passed = getTestCaseResult( expect, actual );
+ writeFormattedResult( expect, actual, string, passed );
+ return passed;
+}
+function writeFormattedResult( expect, actual, string, passed ) {
+ var s = string ;
+ s += ( passed ) ? PASSED : FAILED + expect;
+ writeLineToLog( s);
+ return passed;
+}
+function writeLineToLog( string ) {
+ print( string );
+}
+function writeHeaderToLog( string ) {
+ print( string );
+}
+/* end of print functions */
+
+
+/*
+ * When running in the shell, run the garbage collector after the
+ * test has completed.
+ */
+
+function stopTest() {
+ var gc;
+ if ( gc != undefined ) {
+ gc();
+ }
+}
+
+/*
+ * Convenience function for displaying failed test cases. Useful
+ * when running tests manually.
+ *
+ */
+function getFailedCases() {
+ for ( var i = 0; i < testcases.length; i++ ) {
+ if ( ! testcases[i].passed ) {
+ print( testcases[i].description +" = " +testcases[i].actual +" expected: "+ testcases[i].expect );
+ }
+ }
+}
+ /*
+ * Date functions used by tests in Date suite
+ *
+ */
+var msPerDay = 86400000;
+var HoursPerDay = 24;
+var MinutesPerHour = 60;
+var SecondsPerMinute = 60;
+var msPerSecond = 1000;
+var msPerMinute = 60000; // msPerSecond * SecondsPerMinute
+var msPerHour = 3600000; // msPerMinute * MinutesPerHour
+var TZ_DIFF = getTimeZoneDiff(); // offset of tester's timezone from UTC
+var TZ_PST = -8; // offset of Pacific Standard Time from UTC
+var PST_DIFF = TZ_DIFF - TZ_PST; // offset of tester's timezone from PST
+var TIME_1970 = 0;
+var TIME_2000 = 946684800000;
+var TIME_1900 = -2208988800000;
+var TIME_YEAR_0 = -62167219200000;
+
+
+/*
+ * Originally, the test suite used a hard-coded value TZ_DIFF = -8.
+ * But that was only valid for testers in the Pacific Standard Time Zone!
+ * We calculate the proper number dynamically for any tester. We just
+ * have to be careful not to use a date subject to Daylight Savings Time...
+*/
+function getTimeZoneDiff()
+{
+ return -((new Date(2000, 1, 1)).getTimezoneOffset())/60;
+}
+
+
+/*
+ * Date test "ResultArrays" are hard-coded for Pacific Standard Time.
+ * We must adjust them for the tester's own timezone -
+ */
+function adjustResultArray(ResultArray, msMode)
+{
+ // If the tester's system clock is in PST, no need to continue -
+ if (!PST_DIFF) {return;}
+
+ /* The date testcases instantiate Date objects in two different ways:
+ *
+ * millisecond mode: e.g. dt = new Date(10000000);
+ * year-month-day mode: dt = new Date(2000, 5, 1, ...);
+ *
+ * In the first case, the date is measured from Time 0 in Greenwich (i.e. UTC).
+ * In the second case, it is measured with reference to the tester's local timezone.
+ *
+ * In the first case we must correct those values expected for local measurements,
+ * like dt.getHours() etc. No correction is necessary for dt.getUTCHours() etc.
+ *
+ * In the second case, it is exactly the other way around -
+ */
+ if (msMode)
+ {
+ // The hard-coded UTC milliseconds from Time 0 derives from a UTC date.
+ // Shift to the right by the offset between UTC and the tester.
+ var t = ResultArray[TIME] + TZ_DIFF*msPerHour;
+
+ // Use our date arithmetic functions to determine the local hour, day, etc.
+ ResultArray[HOURS] = HourFromTime(t);
+ ResultArray[DAY] = WeekDay(t);
+ ResultArray[DATE] = DateFromTime(t);
+ ResultArray[MONTH] = MonthFromTime(t);
+ ResultArray[YEAR] = YearFromTime(t);
+ }
+ else
+ {
+ // The hard-coded UTC milliseconds from Time 0 derives from a PST date.
+ // Shift to the left by the offset between PST and the tester.
+ var t = ResultArray[TIME] - PST_DIFF*msPerHour;
+
+ // Use our date arithmetic functions to determine the UTC hour, day, etc.
+ ResultArray[TIME] = t;
+ ResultArray[UTC_HOURS] = HourFromTime(t);
+ ResultArray[UTC_DAY] = WeekDay(t);
+ ResultArray[UTC_DATE] = DateFromTime(t);
+ ResultArray[UTC_MONTH] = MonthFromTime(t);
+ ResultArray[UTC_YEAR] = YearFromTime(t);
+ }
+}
+
+
+function Day( t ) {
+ return ( Math.floor(t/msPerDay ) );
+}
+function DaysInYear( y ) {
+ if ( y % 4 != 0 ) {
+ return 365;
+ }
+ if ( (y % 4 == 0) && (y % 100 != 0) ) {
+ return 366;
+ }
+ if ( (y % 100 == 0) && (y % 400 != 0) ) {
+ return 365;
+ }
+ if ( (y % 400 == 0) ){
+ return 366;
+ } else {
+ return "ERROR: DaysInYear(" + y + ") case not covered";
+ }
+}
+function TimeInYear( y ) {
+ return ( DaysInYear(y) * msPerDay );
+}
+function DayNumber( t ) {
+ return ( Math.floor( t / msPerDay ) );
+}
+function TimeWithinDay( t ) {
+ if ( t < 0 ) {
+ return ( (t % msPerDay) + msPerDay );
+ } else {
+ return ( t % msPerDay );
+ }
+}
+function YearNumber( t ) {
+}
+function TimeFromYear( y ) {
+ return ( msPerDay * DayFromYear(y) );
+}
+function DayFromYear( y ) {
+ return ( 365*(y-1970) +
+ Math.floor((y-1969)/4) -
+ Math.floor((y-1901)/100) +
+ Math.floor((y-1601)/400) );
+}
+function InLeapYear( t ) {
+ if ( DaysInYear(YearFromTime(t)) == 365 ) {
+ return 0;
+ }
+ if ( DaysInYear(YearFromTime(t)) == 366 ) {
+ return 1;
+ } else {
+ return "ERROR: InLeapYear("+ t + ") case not covered";
+ }
+}
+function YearFromTime( t ) {
+ t = Number( t );
+ var sign = ( t < 0 ) ? -1 : 1;
+ var year = ( sign < 0 ) ? 1969 : 1970;
+ for ( var timeToTimeZero = t; ; ) {
+ // subtract the current year's time from the time that's left.
+ timeToTimeZero -= sign * TimeInYear(year)
+
+ // if there's less than the current year's worth of time left, then break.
+ if ( sign < 0 ) {
+ if ( sign * timeToTimeZero <= 0 ) {
+ break;
+ } else {
+ year += sign;
+ }
+ } else {
+ if ( sign * timeToTimeZero < 0 ) {
+ break;
+ } else {
+ year += sign;
+ }
+ }
+ }
+ return ( year );
+}
+function MonthFromTime( t ) {
+ // i know i could use switch but i'd rather not until it's part of ECMA
+ var day = DayWithinYear( t );
+ var leap = InLeapYear(t);
+
+ if ( (0 <= day) && (day < 31) ) {
+ return 0;
+ }
+ if ( (31 <= day) && (day < (59+leap)) ) {
+ return 1;
+ }
+ if ( ((59+leap) <= day) && (day < (90+leap)) ) {
+ return 2;
+ }
+ if ( ((90+leap) <= day) && (day < (120+leap)) ) {
+ return 3;
+ }
+ if ( ((120+leap) <= day) && (day < (151+leap)) ) {
+ return 4;
+ }
+ if ( ((151+leap) <= day) && (day < (181+leap)) ) {
+ return 5;
+ }
+ if ( ((181+leap) <= day) && (day < (212+leap)) ) {
+ return 6;
+ }
+ if ( ((212+leap) <= day) && (day < (243+leap)) ) {
+ return 7;
+ }
+ if ( ((243+leap) <= day) && (day < (273+leap)) ) {
+ return 8;
+ }
+ if ( ((273+leap) <= day) && (day < (304+leap)) ) {
+ return 9;
+ }
+ if ( ((304+leap) <= day) && (day < (334+leap)) ) {
+ return 10;
+ }
+ if ( ((334+leap) <= day) && (day < (365+leap)) ) {
+ return 11;
+ } else {
+ return "ERROR: MonthFromTime("+t+") not known";
+ }
+}
+function DayWithinYear( t ) {
+ return( Day(t) - DayFromYear(YearFromTime(t)));
+}
+function DateFromTime( t ) {
+ var day = DayWithinYear(t);
+ var month = MonthFromTime(t);
+
+ if ( month == 0 ) {
+ return ( day + 1 );
+ }
+ if ( month == 1 ) {
+ return ( day - 30 );
+ }
+ if ( month == 2 ) {
+ return ( day - 58 - InLeapYear(t) );
+ }
+ if ( month == 3 ) {
+ return ( day - 89 - InLeapYear(t));
+ }
+ if ( month == 4 ) {
+ return ( day - 119 - InLeapYear(t));
+ }
+ if ( month == 5 ) {
+ return ( day - 150- InLeapYear(t));
+ }
+ if ( month == 6 ) {
+ return ( day - 180- InLeapYear(t));
+ }
+ if ( month == 7 ) {
+ return ( day - 211- InLeapYear(t));
+ }
+ if ( month == 8 ) {
+ return ( day - 242- InLeapYear(t));
+ }
+ if ( month == 9 ) {
+ return ( day - 272- InLeapYear(t));
+ }
+ if ( month == 10 ) {
+ return ( day - 303- InLeapYear(t));
+ }
+ if ( month == 11 ) {
+ return ( day - 333- InLeapYear(t));
+ }
+
+ return ("ERROR: DateFromTime("+t+") not known" );
+}
+function WeekDay( t ) {
+ var weekday = (Day(t)+4) % 7;
+ return( weekday < 0 ? 7 + weekday : weekday );
+}
+
+// missing daylight savins time adjustment
+
+function HourFromTime( t ) {
+ var h = Math.floor( t / msPerHour ) % HoursPerDay;
+ return ( (h<0) ? HoursPerDay + h : h );
+}
+function MinFromTime( t ) {
+ var min = Math.floor( t / msPerMinute ) % MinutesPerHour;
+ return( ( min < 0 ) ? MinutesPerHour + min : min );
+}
+function SecFromTime( t ) {
+ var sec = Math.floor( t / msPerSecond ) % SecondsPerMinute;
+ return ( (sec < 0 ) ? SecondsPerMinute + sec : sec );
+}
+function msFromTime( t ) {
+ var ms = t % msPerSecond;
+ return ( (ms < 0 ) ? msPerSecond + ms : ms );
+}
+function LocalTZA() {
+ return ( TZ_DIFF * msPerHour );
+}
+function UTC( t ) {
+ return ( t - LocalTZA() - DaylightSavingTA(t - LocalTZA()) );
+}
+
+function DaylightSavingTA( t ) {
+ t = t - LocalTZA();
+
+ var dst_start = GetSecondSundayInMarch(t) + 2*msPerHour;
+ var dst_end = GetFirstSundayInNovember(t)+ 2*msPerHour;
+
+ if ( t >= dst_start && t < dst_end ) {
+ return msPerHour;
+ } else {
+ return 0;
+ }
+
+ // Daylight Savings Time starts on the first Sunday in April at 2:00AM in
+ // PST. Other time zones will need to override this function.
+
+ print( new Date( UTC(dst_start + LocalTZA())) );
+
+ return UTC(dst_start + LocalTZA());
+}
+
+function GetFirstSundayInApril( t ) {
+ var year = YearFromTime(t);
+ var leap = InLeapYear(t);
+
+ var april = TimeFromYear(year) + TimeInMonth(0, leap) + TimeInMonth(1,leap) +
+ TimeInMonth(2,leap);
+
+ for ( var first_sunday = april; WeekDay(first_sunday) > 0;
+ first_sunday += msPerDay )
+ {
+ ;
+ }
+
+ return first_sunday;
+}
+function GetLastSundayInOctober( t ) {
+ var year = YearFromTime(t);
+ var leap = InLeapYear(t);
+
+ for ( var oct = TimeFromYear(year), m = 0; m < 9; m++ ) {
+ oct += TimeInMonth(m, leap);
+ }
+ for ( var last_sunday = oct + 30*msPerDay; WeekDay(last_sunday) > 0;
+ last_sunday -= msPerDay )
+ {
+ ;
+ }
+ return last_sunday;
+}
+
+// Added these two functions because DST rules changed for the US.
+function GetSecondSundayInMarch( t ) {
+ var year = YearFromTime(t);
+ var leap = InLeapYear(t);
+
+ var march = TimeFromYear(year) + TimeInMonth(0, leap) + TimeInMonth(1,leap);
+
+ var sundayCount = 0;
+ var flag = true;
+ for ( var second_sunday = march; flag; second_sunday += msPerDay )
+ {
+ if (WeekDay(second_sunday) == 0) {
+ if(++sundayCount == 2)
+ flag = false;
+ }
+ }
+
+ return second_sunday;
+}
+function GetFirstSundayInNovember( t ) {
+ var year = YearFromTime(t);
+ var leap = InLeapYear(t);
+
+ for ( var nov = TimeFromYear(year), m = 0; m < 10; m++ ) {
+ nov += TimeInMonth(m, leap);
+ }
+ for ( var first_sunday = nov; WeekDay(first_sunday) > 0;
+ first_sunday += msPerDay )
+ {
+ ;
+ }
+ return first_sunday;
+}
+function LocalTime( t ) {
+ return ( t + LocalTZA() + DaylightSavingTA(t) );
+}
+function MakeTime( hour, min, sec, ms ) {
+ if ( isNaN( hour ) || isNaN( min ) || isNaN( sec ) || isNaN( ms ) ) {
+ return Number.NaN;
+ }
+
+ hour = ToInteger(hour);
+ min = ToInteger( min);
+ sec = ToInteger( sec);
+ ms = ToInteger( ms );
+
+ return( (hour*msPerHour) + (min*msPerMinute) +
+ (sec*msPerSecond) + ms );
+}
+function MakeDay( year, month, date ) {
+ if ( isNaN(year) || isNaN(month) || isNaN(date) ) {
+ return Number.NaN;
+ }
+ year = ToInteger(year);
+ month = ToInteger(month);
+ date = ToInteger(date );
+
+ var sign = ( year < 1970 ) ? -1 : 1;
+ var t = ( year < 1970 ) ? 1 : 0;
+ var y = ( year < 1970 ) ? 1969 : 1970;
+
+ var result5 = year + Math.floor( month/12 );
+ var result6 = month % 12;
+
+ if ( year < 1970 ) {
+ for ( y = 1969; y >= year; y += sign ) {
+ t += sign * TimeInYear(y);
+ }
+ } else {
+ for ( y = 1970 ; y < year; y += sign ) {
+ t += sign * TimeInYear(y);
+ }
+ }
+
+ var leap = InLeapYear( t );
+
+ for ( var m = 0; m < month; m++ ) {
+ t += TimeInMonth( m, leap );
+ }
+
+ if ( YearFromTime(t) != result5 ) {
+ return Number.NaN;
+ }
+ if ( MonthFromTime(t) != result6 ) {
+ return Number.NaN;
+ }
+ if ( DateFromTime(t) != 1 ) {
+ return Number.NaN;
+ }
+
+ return ( (Day(t)) + date - 1 );
+}
+function TimeInMonth( month, leap ) {
+ // september april june november
+ // jan 0 feb 1 mar 2 apr 3 may 4 june 5 jul 6
+ // aug 7 sep 8 oct 9 nov 10 dec 11
+
+ if ( month == 3 || month == 5 || month == 8 || month == 10 ) {
+ return ( 30*msPerDay );
+ }
+
+ // all the rest
+ if ( month == 0 || month == 2 || month == 4 || month == 6 ||
+ month == 7 || month == 9 || month == 11 ) {
+ return ( 31*msPerDay );
+ }
+
+ // save february
+ return ( (leap == 0) ? 28*msPerDay : 29*msPerDay );
+}
+function MakeDate( day, time ) {
+ if ( day == Number.POSITIVE_INFINITY ||
+ day == Number.NEGATIVE_INFINITY ||
+ day == Number.NaN ) {
+ return Number.NaN;
+ }
+ if ( time == Number.POSITIVE_INFINITY ||
+ time == Number.POSITIVE_INFINITY ||
+ day == Number.NaN) {
+ return Number.NaN;
+ }
+ return ( day * msPerDay ) + time;
+}
+function TimeClip( t ) {
+ if ( isNaN( t ) ) {
+ return ( Number.NaN );
+ }
+ if ( Math.abs( t ) > 8.64e15 ) {
+ return ( Number.NaN );
+ }
+
+ return ( ToInteger( t ) );
+}
+function ToInteger( t ) {
+ t = Number( t );
+
+ if ( isNaN( t ) ){
+ return ( Number.NaN );
+ }
+ if ( t == 0 || t == -0 ||
+ t == Number.POSITIVE_INFINITY || t == Number.NEGATIVE_INFINITY ) {
+ return 0;
+ }
+
+ var sign = ( t < 0 ) ? -1 : 1;
+
+ return ( sign * Math.floor( Math.abs( t ) ) );
+}
+function Enumerate ( o ) {
+ var p;
+ for ( p in o ) {
+ print( p +": " + o[p] );
+ }
+}
+
+/* these functions are useful for running tests manually in Rhino */
+
+function GetContext() {
+ return Packages.com.netscape.javascript.Context.getCurrentContext();
+}
+function OptLevel( i ) {
+ i = Number(i);
+ var cx = GetContext();
+ cx.setOptimizationLevel(i);
+}
+/* end of Rhino functions */
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/boolean-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/boolean-001.js
new file mode 100644
index 0000000..1645ad4
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/boolean-001.js
@@ -0,0 +1,43 @@
+/**
+ File Name: boolean-001.js
+ Description: Corresponds to ecma/Boolean/15.6.4.2-4-n.js
+
+ The toString function is not generic; it generates
+ a runtime error if its this value is not a Boolean
+ object. Therefore it cannot be transferred to other
+ kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: june 27, 1997
+*/
+ var SECTION = "boolean-001.js";
+ var VERSION = "JS1_4";
+ var TITLE = "Boolean.prototype.toString()";
+ startTest();
+ writeHeaderToLog( SECTION +" "+ TITLE );
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var exception = "No exception thrown";
+ var result = "Failed";
+
+ var TO_STRING = Boolean.prototype.toString;
+
+ try {
+ var s = new String("Not a Boolean");
+ s.toString = TO_STRING;
+ s.toString();
+ } catch ( e ) {
+ result = "Passed!";
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "Assigning Boolean.prototype.toString to a String object "+
+ "(threw " +exception +")",
+ "Passed!",
+ result );
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/boolean-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/boolean-002.js
new file mode 100644
index 0000000..be31b99
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/boolean-002.js
@@ -0,0 +1,47 @@
+/**
+ File Name: boolean-001.js
+ Description: Corresponds to ecma/Boolean/15.6.4.3-4-n.js
+
+ 15.6.4.3 Boolean.prototype.valueOf()
+ Returns this boolean value.
+
+ The valueOf function is not generic; it generates
+ a runtime error if its this value is not a Boolean
+ object. Therefore it cannot be transferred to other
+ kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 09 september 1998
+*/
+ var SECTION = "boolean-002.js";
+ var VERSION = "JS1_4";
+ var TITLE = "Boolean.prototype.valueOf()";
+ startTest();
+ writeHeaderToLog( SECTION +" "+ TITLE );
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var exception = "No exception thrown";
+ var result = "Failed";
+
+ var VALUE_OF = Boolean.prototype.valueOf;
+
+ try {
+ var s = new String("Not a Boolean");
+ s.valueOf = VALUE_0F;
+ s.valueOf();
+ } catch ( e ) {
+ result = "Passed!";
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "Assigning Boolean.prototype.valueOf to a String object "+
+ "(threw " +exception +")",
+ "Passed!",
+ result );
+
+ test();
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/date-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/date-001.js
new file mode 100644
index 0000000..60ef3a4
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/date-001.js
@@ -0,0 +1,57 @@
+/**
+ File Name: date-001.js
+ Corresponds To: 15.9.5.2-2.js
+ ECMA Section: 15.9.5.2 Date.prototype.toString
+ Description:
+ This function returns a string value. The contents of the string are
+ implementation dependent, but are intended to represent the Date in a
+ convenient, human-readable form in the current time zone.
+
+ The toString function is not generic; it generates a runtime error if its
+ this value is not a Date object. Therefore it cannot be transferred to
+ other kinds of objects for use as a method.
+
+
+ This verifies that calling toString on an object that is not a string
+ generates a runtime error.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "date-001";
+ var VERSION = "JS1_4";
+ var TITLE = "Date.prototype.toString";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ var OBJ = new MyObject( new Date(0) );
+ result = OBJ.toString();
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "OBJECT = new MyObject( new Date(0)) ; result = OBJ.toString()" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
+
+function MyObject( value ) {
+ this.value = value;
+ this.valueOf = new Function( "return this.value" );
+ this.toString = Date.prototype.toString;
+ return this;
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/date-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/date-002.js
new file mode 100644
index 0000000..6fd5a64
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/date-002.js
@@ -0,0 +1,51 @@
+/**
+ File Name: date-002.js
+ Corresponds To: 15.9.5.23-3-n.js
+ ECMA Section: 15.9.5.23
+ Description: Date.prototype.setTime
+
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "date-002";
+ var VERSION = "JS1_4";
+ var TITLE = "Date.prototype.setTime()";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ var MYDATE = new MyDate();
+ result = MYDATE.setTime(0);
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "MYDATE = new MyDate(); MYDATE.setTime(0)" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
+
+function MyDate(value) {
+ this.value = value;
+ this.setTime = Date.prototype.setTime;
+ return this;
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/date-003.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/date-003.js
new file mode 100644
index 0000000..b675fdd
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/date-003.js
@@ -0,0 +1,53 @@
+/**
+ File Name: date-003.js
+ Corresponds To 15.9.5.3-1.js
+ ECMA Section: 15.9.5.3-1 Date.prototype.valueOf
+ Description:
+
+ The valueOf function returns a number, which is this time value.
+
+ The valueOf function is not generic; it generates a runtime error if
+ its this value is not a Date object. Therefore it cannot be transferred
+ to other kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "date-003";
+ var VERSION = "JS1_4";
+ var TITLE = "Date.prototype.valueOf";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ var OBJ = new MyObject( new Date(0) );
+ result = OBJ.valueOf();
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "OBJ = new MyObject( new Date(0)); OBJ.valueOf()" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
+
+function MyObject( value ) {
+ this.value = value;
+ this.valueOf = Date.prototype.valueOf;
+// The following line causes an infinte loop
+// this.toString = new Function( "return this+\"\";");
+ return this;
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/date-004.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/date-004.js
new file mode 100644
index 0000000..fc2e419
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/date-004.js
@@ -0,0 +1,47 @@
+/**
+ File Name: date-004.js
+ Corresponds To: 15.9.5.4-2-n.js
+ ECMA Section: 15.9.5.4-1 Date.prototype.getTime
+ Description:
+
+ 1. If the this value is not an object whose [[Class]] property is "Date",
+ generate a runtime error.
+ 2. Return this time value.
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "date-004";
+ var VERSION = "JS1_4";
+ var TITLE = "Date.prototype.getTime";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ var MYDATE = new MyDate();
+ result = MYDATE.getTime();
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "MYDATE = new MyDate(); MYDATE.getTime()" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
+
+function MyDate( value ) {
+ this.value = value;
+ this.getTime = Date.prototype.getTime;
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-001.js
new file mode 100644
index 0000000..eeeaa86
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-001.js
@@ -0,0 +1,42 @@
+/**
+ * File Name: exception-001
+ * ECMA Section:
+ * Description: Tests for JavaScript Standard Exceptions
+ *
+ * Call error.
+ *
+ * Author: christine@netscape.com
+ * Date: 31 August 1998
+ */
+ var SECTION = "exception-001";
+ var VERSION = "js1_4";
+ var TITLE = "Tests for JavaScript Standard Exceptions: CallError";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ Call_1();
+
+ test();
+
+ function Call_1() {
+ result = "failed: no exception thrown";
+ exception = null;
+
+ try {
+ Math();
+ } catch ( e ) {
+ result = "passed: threw exception",
+ exception = e.toString();
+ } finally {
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "Math() [ exception is " + exception +" ]",
+ "passed: threw exception",
+ result );
+ }
+ }
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-002.js
new file mode 100644
index 0000000..680fcbf
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-002.js
@@ -0,0 +1,42 @@
+/**
+ * File Name: exception-002
+ * ECMA Section:
+ * Description: Tests for JavaScript Standard Exceptions
+ *
+ * Construct error.
+ *
+ * Author: christine@netscape.com
+ * Date: 31 August 1998
+ */
+ var SECTION = "exception-002";
+ var VERSION = "js1_4";
+ var TITLE = "Tests for JavaScript Standard Exceptions: ConstructError";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ Construct_1();
+
+ test();
+
+ function Construct_1() {
+ result = "failed: no exception thrown";
+ exception = null;
+
+ try {
+ result = new Math();
+ } catch ( e ) {
+ result = "passed: threw exception",
+ exception = e.toString();
+ } finally {
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "new Math() [ exception is " + exception +" ]",
+ "passed: threw exception",
+ result );
+ }
+ }
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-003.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-003.js
new file mode 100644
index 0000000..d073fbc
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-003.js
@@ -0,0 +1,46 @@
+/**
+ * File Name: exception-003
+ * ECMA Section:
+ * Description: Tests for JavaScript Standard Exceptions
+ *
+ * Target error.
+ *
+ * Author: christine@netscape.com
+ * Date: 31 August 1998
+ */
+ var SECTION = "exception-003";
+ var VERSION = "js1_4";
+ var TITLE = "Tests for JavaScript Standard Exceptions: TargetError";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ Target_1();
+
+ test();
+
+ function Target_1() {
+ result = "failed: no exception thrown";
+ exception = null;
+
+ try {
+ string = new String("hi");
+ string.toString = Boolean.prototype.toString;
+ string.toString();
+ } catch ( e ) {
+ result = "passed: threw exception",
+ exception = e.toString();
+ } finally {
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "string = new String(\"hi\");"+
+ "string.toString = Boolean.prototype.toString" +
+ "string.toString() [ exception is " + exception +" ]",
+ "passed: threw exception",
+ result );
+ }
+ }
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-004.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-004.js
new file mode 100644
index 0000000..1fde959
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-004.js
@@ -0,0 +1,42 @@
+/**
+ * File Name: exception-004
+ * ECMA Section:
+ * Description: Tests for JavaScript Standard Exceptions
+ *
+ * ToObject error.
+ *
+ * Author: christine@netscape.com
+ * Date: 31 August 1998
+ */
+ var SECTION = "exception-004";
+ var VERSION = "js1_4";
+ var TITLE = "Tests for JavaScript Standard Exceptions: ToObjectError";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ ToObject_1();
+
+ test();
+
+ function ToObject_1() {
+ result = "failed: no exception thrown";
+ exception = null;
+
+ try {
+ result = foo["bar"];
+ } catch ( e ) {
+ result = "passed: threw exception",
+ exception = e.toString();
+ } finally {
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "foo[\"bar\"] [ exception is " + exception +" ]",
+ "passed: threw exception",
+ result );
+ }
+ }
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-005.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-005.js
new file mode 100644
index 0000000..2fbb984
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-005.js
@@ -0,0 +1,42 @@
+/**
+ * File Name: exception-005
+ * ECMA Section:
+ * Description: Tests for JavaScript Standard Exceptions
+ *
+ * ToObject error.
+ *
+ * Author: christine@netscape.com
+ * Date: 31 August 1998
+ */
+ var SECTION = "exception-005";
+ var VERSION = "js1_4";
+ var TITLE = "Tests for JavaScript Standard Exceptions: ToObjectError";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ ToObject_1();
+
+ test();
+
+ function ToObject_1() {
+ result = "failed: no exception thrown";
+ exception = null;
+
+ try {
+ result = foo["bar"];
+ } catch ( e ) {
+ result = "passed: threw exception",
+ exception = e.toString();
+ } finally {
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "foo[\"bar\"] [ exception is " + exception +" ]",
+ "passed: threw exception",
+ result );
+ }
+ }
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-006.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-006.js
new file mode 100644
index 0000000..583e976
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-006.js
@@ -0,0 +1,53 @@
+/**
+ * File Name: exception-006
+ * ECMA Section:
+ * Description: Tests for JavaScript Standard Exceptions
+ *
+ * ToPrimitive error.
+ *
+ * Author: christine@netscape.com
+ * Date: 31 August 1998
+ */
+ var SECTION = "exception-006";
+ var VERSION = "js1_4";
+ var TITLE = "Tests for JavaScript Standard Exceptions: TypeError";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ ToPrimitive_1();
+
+ test();
+
+
+ /**
+ * Getting the [[DefaultValue]] of any instances of MyObject
+ * should result in a runtime error in ToPrimitive.
+ */
+
+ function MyObject() {
+ this.toString = void 0;
+ this.valueOf = void 0;
+ }
+
+ function ToPrimitive_1() {
+ result = "failed: no exception thrown";
+ exception = null;
+
+ try {
+ result = new MyObject() + new MyObject();
+ } catch ( e ) {
+ result = "passed: threw exception",
+ exception = e.toString();
+ } finally {
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "new MyObject() + new MyObject() [ exception is " + exception +" ]",
+ "passed: threw exception",
+ result );
+ }
+ }
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-007.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-007.js
new file mode 100644
index 0000000..e26a40e
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-007.js
@@ -0,0 +1,54 @@
+/**
+ * File Name: exception-007
+ * ECMA Section:
+ * Description: Tests for JavaScript Standard Exceptions
+ *
+ * DefaultValue error.
+ *
+ * Author: christine@netscape.com
+ * Date: 31 August 1998
+ */
+ var SECTION = "exception-007";
+ var VERSION = "js1_4";
+ var TITLE = "Tests for JavaScript Standard Exceptions: TypeError";
+ var BUGNUMBER="318250";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ DefaultValue_1();
+
+ test();
+
+
+ /**
+ * Getting the [[DefaultValue]] of any instances of MyObject
+ * should result in a runtime error in ToPrimitive.
+ */
+
+ function MyObject() {
+ this.toString = void 0;
+ this.valueOf = new Object();
+ }
+
+ function DefaultValue_1() {
+ result = "failed: no exception thrown";
+ exception = null;
+
+ try {
+ result = new MyObject() + new MyObject();
+ } catch ( e ) {
+ result = "passed: threw exception",
+ exception = e.toString();
+ } finally {
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "new MyObject() + new MyObject() [ exception is " + exception +" ]",
+ "passed: threw exception",
+ result );
+ }
+ }
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-008.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-008.js
new file mode 100644
index 0000000..797f125
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-008.js
@@ -0,0 +1,41 @@
+/**
+ * File Name: exception-008
+ * ECMA Section:
+ * Description: Tests for JavaScript Standard Exceptions
+ *
+ * SyntaxError.
+ *
+ * Author: christine@netscape.com
+ * Date: 31 August 1998
+ */
+ var SECTION = "exception-008";
+ var VERSION = "js1_4";
+ var TITLE = "Tests for JavaScript Standard Exceptions: SyntaxError";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ Syntax_1();
+
+ test();
+
+ function Syntax_1() {
+ result = "failed: no exception thrown";
+ exception = null;
+
+ try {
+ result = eval("continue;");
+ } catch ( e ) {
+ result = "passed: threw exception",
+ exception = e.toString();
+ } finally {
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "eval(\"continue\") [ exception is " + exception +" ]",
+ "passed: threw exception",
+ result );
+ }
+ }
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-009.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-009.js
new file mode 100644
index 0000000..b153532
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-009.js
@@ -0,0 +1,50 @@
+/**
+ * File Name: exception-009
+ * ECMA Section:
+ * Description: Tests for JavaScript Standard Exceptions
+ *
+ * Regression test for nested try blocks.
+ *
+ * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=312964
+ *
+ * Author: christine@netscape.com
+ * Date: 31 August 1998
+ */
+ var SECTION = "exception-009";
+ var VERSION = "JS1_4";
+ var TITLE = "Tests for JavaScript Standard Exceptions: SyntaxError";
+ var BUGNUMBER= "312964";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ try {
+ expect = "passed: no exception thrown";
+ result = expect;
+ Nested_1();
+ } catch ( e ) {
+ result = "failed: threw " + e;
+ } finally {
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "nested try",
+ expect,
+ result );
+ }
+
+
+ test();
+
+ function Nested_1() {
+ try {
+ try {
+ } catch (a) {
+ } finally {
+ }
+ } catch (b) {
+ } finally {
+ }
+ }
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-010-n.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-010-n.js
new file mode 100644
index 0000000..3b4ec82
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-010-n.js
@@ -0,0 +1,36 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ * Rob Ginda rginda@netscape.com
+ */
+
+test();
+
+function test()
+{
+ print ("Null throw test.");
+ print ("BUGNUMBER: 21799");
+
+ throw null;
+
+ print ("FAILED!: Should have exited with uncaught exception.");
+
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-011-n.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-011-n.js
new file mode 100644
index 0000000..9088420
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/exception-011-n.js
@@ -0,0 +1,35 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ * Rob Ginda rginda@netscape.com
+ */
+
+test();
+
+function test()
+{
+ print ("Undefined throw test.");
+
+ throw (void 0);
+
+ print ("FAILED!: Should have exited with uncaught exception.");
+
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-001.js
new file mode 100644
index 0000000..b1baf6f
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-001.js
@@ -0,0 +1,47 @@
+/**
+ File Name: expression-001.js
+ Corresponds to: ecma/Expressions/11.12-2-n.js
+ ECMA Section: 11.12
+ Description:
+
+ The grammar for a ConditionalExpression in ECMAScript is a little bit
+ different from that in C and Java, which each allow the second
+ subexpression to be an Expression but restrict the third expression to
+ be a ConditionalExpression. The motivation for this difference in
+ ECMAScript is to allow an assignment expression to be governed by either
+ arm of a conditional and to eliminate the confusing and fairly useless
+ case of a comma expression as the center expression.
+
+ Author: christine@netscape.com
+ Date: 09 september 1998
+*/
+ var SECTION = "expression-001";
+ var VERSION = "JS1_4";
+ var TITLE = "Conditional operator ( ? : )"
+ startTest();
+ writeHeaderToLog( SECTION + " " + TITLE );
+
+ var tc = 0;
+ var testcases = new Array();
+
+ // the following expression should be an error in JS.
+
+ var result = "Failed"
+ var exception = "No exception was thrown";
+
+ try {
+ eval("var MY_VAR = true ? \"EXPR1\", \"EXPR2\" : \"EXPR3\"");
+ } catch ( e ) {
+ result = "Passed";
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "comma expression in a conditional statement "+
+ "(threw "+ exception +")",
+ "Passed",
+ result );
+
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-002.js
new file mode 100644
index 0000000..1a73ebe
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-002.js
@@ -0,0 +1,57 @@
+/**
+ File Name: expressions-002.js
+ Corresponds to: ecma/Expressions/11.2.1-3-n.js
+ ECMA Section: 11.2.1 Property Accessors
+ Description:
+
+ Try to access properties of an object whose value is undefined.
+
+ Author: christine@netscape.com
+ Date: 09 september 1998
+*/
+ var SECTION = "expressions-002.js";
+ var VERSION = "JS1_4";
+ var TITLE = "Property Accessors";
+ writeHeaderToLog( SECTION + " "+TITLE );
+
+ startTest();
+
+ var tc = 0;
+ var testcases = new Array();
+
+ // go through all Native Function objects, methods, and properties and get their typeof.
+
+ var PROPERTY = new Array();
+ var p = 0;
+
+ // try to access properties of primitive types
+
+ OBJECT = new Property( "undefined", void 0, "undefined", NaN );
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ result = OBJECT.value.valueOf();
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "Get the value of an object whose value is undefined "+
+ "(threw " + exception +")",
+ expect,
+ result );
+
+ test();
+
+function Property( object, value, string, number ) {
+ this.object = object;
+ this.string = String(value);
+ this.number = Number(value);
+ this.valueOf = value;
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-003.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-003.js
new file mode 100644
index 0000000..30b5369
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-003.js
@@ -0,0 +1,52 @@
+/**
+ File Name: expressions-003.js
+ Corresponds to: ecma/Expressions/11.2.1-3-n.js
+ ECMA Section: 11.2.1 Property Accessors
+ Description:
+
+ Try to access properties of an object whose value is undefined.
+
+ Author: christine@netscape.com
+ Date: 09 september 1998
+*/
+ var SECTION = "expressions-003.js";
+ var VERSION = "JS1_4";
+ var TITLE = "Property Accessors";
+ writeHeaderToLog( SECTION + " "+TITLE );
+
+ startTest();
+
+ var tc = 0;
+ var testcases = new Array();
+
+ // try to access properties of primitive types
+
+ OBJECT = new Property( "undefined", void 0, "undefined", NaN );
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ result = OBJECT.value.toString();
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "Get the toString value of an object whose value is undefined "+
+ "(threw " + exception +")",
+ expect,
+ result );
+
+ test();
+
+function Property( object, value, string, number ) {
+ this.object = object;
+ this.string = String(value);
+ this.number = Number(value);
+ this.value = value;
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-004.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-004.js
new file mode 100644
index 0000000..0ce3864
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-004.js
@@ -0,0 +1,46 @@
+/**
+ File Name: expression-004.js
+ Corresponds To: 11.2.1-4-n.js
+ ECMA Section: 11.2.1 Property Accessors
+ Description:
+
+ Author: christine@netscape.com
+ Date: 09 september 1998
+*/
+ var SECTION = "expression-004";
+ var VERSION = "JS1_4";
+ var TITLE = "Property Accessors";
+ writeHeaderToLog( SECTION + " "+TITLE );
+ startTest();
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var OBJECT = new Property( "null", null, "null", 0 );
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ result = OBJECT.value.toString();
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "Get the toString value of an object whose value is null "+
+ "(threw " + exception +")",
+ expect,
+ result );
+
+ test();
+
+function Property( object, value, string, number ) {
+ this.object = object;
+ this.string = String(value);
+ this.number = Number(value);
+ this.value = value;
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-005.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-005.js
new file mode 100644
index 0000000..df69144
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-005.js
@@ -0,0 +1,38 @@
+/**
+ File Name: expression-005.js
+ Corresponds To: 11.2.2-10-n.js
+ ECMA Section: 11.2.2. The new operator
+ Description:
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "expression-005";
+ var VERSION = "JS1_4";
+ var TITLE = "The new operator";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var result = "Failed";
+ var expect = "Passed";
+ var exception = "No exception thrown";
+
+ try {
+ result = new Math();
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "result= new Math() (threw " + exception + ")",
+ expect,
+ result );
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-006.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-006.js
new file mode 100644
index 0000000..1bf0798
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-006.js
@@ -0,0 +1,43 @@
+/**
+ File Name: expression-006.js
+ Corresponds to: 11.2.2-1-n.js
+ ECMA Section: 11.2.2. The new operator
+ Description:
+
+ http://scopus/bugsplat/show_bug.cgi?id=327765
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "expression-006.js";
+ var VERSION = "JS1_4";
+ var TITLE = "The new operator";
+ var BUGNUMBER="327765";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ var OBJECT = new Object();
+ result = new OBJECT();
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "OBJECT = new Object; result = new OBJECT()" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-007.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-007.js
new file mode 100644
index 0000000..988109b
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-007.js
@@ -0,0 +1,41 @@
+/**
+ File Name: expression-007.js
+ Corresponds To: 11.2.2-2-n.js
+ ECMA Section: 11.2.2. The new operator
+ Description:
+
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "expression-007";
+ var VERSION = "JS1_4";
+ var TITLE = "The new operator";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ UNDEFINED = void 0;
+ result = new UNDEFINED();
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "UNDEFINED = void 0; result = new UNDEFINED()" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-008.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-008.js
new file mode 100644
index 0000000..caa8912
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-008.js
@@ -0,0 +1,38 @@
+/**
+ File Name: expression-008
+ Corresponds To: 11.2.2-3-n.js
+ ECMA Section: 11.2.2. The new operator
+ Description:
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "expression-008";
+ var VERSION = "JS1_4";
+ var TITLE = "The new operator";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var NULL = null;
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ result = new NULL();
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "NULL = null; result = new NULL()" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-009.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-009.js
new file mode 100644
index 0000000..2aa63b6
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-009.js
@@ -0,0 +1,39 @@
+/**
+ File Name: expression-009
+ Corresponds to: ecma/Expressions/11.2.2-4-n.js
+ ECMA Section: 11.2.2. The new operator
+ Description:
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "expression-009";
+ var VERSION = "JS1_4";
+ var TITLE = "The new operator";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var STRING = "";
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ result = new STRING();
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "STRING = ''; result = new STRING()" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test(); \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-010.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-010.js
new file mode 100644
index 0000000..bb21aba
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-010.js
@@ -0,0 +1,40 @@
+/**
+ File Name: expression-010.js
+ Corresponds To: 11.2.2-5-n.js
+ ECMA Section: 11.2.2. The new operator
+ Description:
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "expression-010";
+ var VERSION = "JS1_4";
+ var TITLE = "The new operator";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var NUMBER = 0;
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ result = new NUMBER();
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "NUMBER=0, result = new NUMBER()" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-011.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-011.js
new file mode 100644
index 0000000..71c601a
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-011.js
@@ -0,0 +1,40 @@
+/**
+ File Name: expression-011.js
+ Corresponds To: ecma/Expressions/11.2.2-6-n.js
+ ECMA Section: 11.2.2. The new operator
+ Description:
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "expression-011";
+ var VERSION = "JS1_4";
+ var TITLE = "The new operator";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var BOOLEAN = true;
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ var OBJECT = new BOOLEAN();
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "BOOLEAN = true; result = new BOOLEAN()" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-012.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-012.js
new file mode 100644
index 0000000..31eb099
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-012.js
@@ -0,0 +1,41 @@
+/**
+ File Name: expression-012.js
+ Corresponds To: ecma/Expressions/11.2.2-6-n.js
+ ECMA Section: 11.2.2. The new operator
+ Description:
+ http://scopus/bugsplat/show_bug.cgi?id=327765
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "expression-012";
+ var VERSION = "JS1_4";
+ var TITLE = "The new operator";
+ var BUGNUMBER= "327765";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var STRING = new String("hi");
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ result = new STRING();
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "STRING = new String(\"hi\"); result = new STRING()" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-013.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-013.js
new file mode 100644
index 0000000..cc75a77
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-013.js
@@ -0,0 +1,41 @@
+/**
+ File Name: expression-013.js
+ Corresponds To: ecma/Expressions/11.2.2-8-n.js
+ ECMA Section: 11.2.2. The new operator
+ Description:
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "expression-013";
+ var VERSION = "JS1_4";
+ var TITLE = "The new operator";
+ var BUGNUMBER= "327765";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var NUMBER = new Number(1);
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ result = new NUMBER();
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "NUMBER = new Number(1); result = new NUMBER()" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-014.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-014.js
new file mode 100644
index 0000000..4a09cd1
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-014.js
@@ -0,0 +1,43 @@
+/**
+ File Name: expression-014.js
+ Corresponds To: ecma/Expressions/11.2.2-9-n.js
+ ECMA Section: 11.2.2. The new operator
+ Description:
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "expression-014.js";
+ var VERSION = "ECMA_1";
+ var TITLE = "The new operator";
+ var BUGNUMBER= "327765";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var BOOLEAN = new Boolean();
+
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ result = new BOOLEAN();
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "BOOLEAN = new Boolean(); result = new BOOLEAN()" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-015.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-015.js
new file mode 100644
index 0000000..09577fc
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-015.js
@@ -0,0 +1,37 @@
+/**
+ File Name: expression-015.js
+ Corresponds To: ecma/Expressions/11.2.3-2-n.js
+ ECMA Section: 11.2.3. Function Calls
+ Description:
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "expression-015";
+ var VERSION = "JS1_4";
+ var TITLE = "Function Calls";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ eval("result = 3.valueOf();");
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "3.valueOf()" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-016.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-016.js
new file mode 100644
index 0000000..4a55110
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-016.js
@@ -0,0 +1,37 @@
+/**
+ File Name: expression-016.js
+ Corresponds To: ecma/Expressions/11.2.3-3-n.js
+ ECMA Section: 11.2.3. Function Calls
+ Description:
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "expression-016";
+ var VERSION = "JS1_4";
+ var TITLE = "Function Calls";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ result = (void 0).valueOf();
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "(void 0).valueOf()" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-017.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-017.js
new file mode 100644
index 0000000..949cf3f
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-017.js
@@ -0,0 +1,37 @@
+/**
+ File Name: expression-07.js
+ Corresponds To: ecma/Expressions/11.2.3-4-n.js
+ ECMA Section: 11.2.3. Function Calls
+ Description:
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "expression-017";
+ var VERSION = "JS1_4";
+ var TITLE = "Function Calls";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ result = nullvalueOf();
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "null.valueOf()" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-019.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-019.js
new file mode 100644
index 0000000..0ef02cb
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/expression-019.js
@@ -0,0 +1,41 @@
+/**
+ File Name: expression-019.js
+ Corresponds To: 11.2.2-7-n.js
+ ECMA Section: 11.2.2. The new operator
+ Description:
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "expression-019";
+ var VERSION = "JS1_4";
+ var TITLE = "The new operator";
+ var BUGNUMBER= "327765";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ var STRING = new String("hi");
+ result = new STRING();
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "var STRING = new String(\"hi\"); result = new STRING();" +
+ " (threw " + exception + ")",
+ expect,
+ result );
+
+ test();
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/function-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/function-001.js
new file mode 100644
index 0000000..3cbd19e
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/function-001.js
@@ -0,0 +1,64 @@
+/**
+ * File Name: boolean-001.js
+ * Description:
+ *
+ * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=99232
+ *
+ * eval("function f(){}function g(){}") at top level is an error for JS1.2
+ * and above (missing ; between named function expressions), but declares f
+ * and g as functions below 1.2.
+ *
+ * Fails to produce error regardless of version:
+ * js> version(100)
+ * 120
+ * js> eval("function f(){}function g(){}")
+ * js> version(120);
+ * 100
+ * js> eval("function f(){}function g(){}")
+ * js>
+ * Author: christine@netscape.com
+ * Date: 11 August 1998
+ */
+ var SECTION = "function-001.js";
+ var VERSION = "JS_12";
+ var TITLE = "functions not separated by semicolons are errors in version 120 and higher";
+ var BUGNUMBER="10278";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var result = "fail";
+ var exception = "no exception thrown";
+
+ try {
+ eval("function f(){}function g(){}");
+ } catch ( e ) {
+ result = "pass"
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "eval(\"function f(){}function g(){}\") (threw "+exception,
+ "pass",
+ result );
+
+ test();
+
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/global-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/global-001.js
new file mode 100644
index 0000000..3b1bd98
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/global-001.js
@@ -0,0 +1,43 @@
+/**
+ File Name: global-001
+ Corresponds To: ecma/GlobalObject/15.1-1-n.js
+ ECMA Section: The global object
+ Description:
+
+ The global object does not have a [[Construct]] property; it is not
+ possible to use the global object as a constructor with the new operator.
+
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "global-001";
+ var VERSION = "ECMA_1";
+ var TITLE = "The Global Object";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ result = new this();
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "result = new this()" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/global-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/global-002.js
new file mode 100644
index 0000000..2453c29
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/global-002.js
@@ -0,0 +1,43 @@
+/**
+ File Name: global-002
+ Corresponds To: ecma/GlobalObject/15.1-2-n.js
+ ECMA Section: The global object
+ Description:
+
+ The global object does not have a [[Construct]] property; it is not
+ possible to use the global object as a constructor with the new operator.
+
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "global-002";
+ var VERSION = "JS1_4";
+ var TITLE = "The Global Object";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ result = this();
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "result = this()" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-001.js
new file mode 100644
index 0000000..528a573
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-001.js
@@ -0,0 +1,49 @@
+/**
+ File Name: lexical-001.js
+ CorrespondsTo: ecma/LexicalConventions/7.2.js
+ ECMA Section: 7.2 Line Terminators
+ Description: - readability
+ - separate tokens
+ - may occur between any two tokens
+ - cannot occur within any token, not even a string
+ - affect the process of automatic semicolon insertion.
+
+ white space characters are:
+ unicode name formal name string representation
+ \u000A line feed <LF> \n
+ \u000D carriage return <CR> \r
+
+ this test uses onerror to capture line numbers. because
+ we use on error, we can only have one test case per file.
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+ var SECTION = "lexical-001";
+ var VERSION = "JS1_4";
+ var TITLE = "Line Terminators";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ result = eval("\r\n\expect");
+ } catch ( e ) {
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "OBJECT = new Object; result = new OBJECT()" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-002.js
new file mode 100644
index 0000000..b1521c2
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-002.js
@@ -0,0 +1,49 @@
+/**
+ File Name: lexical-002.js
+ Corresponds To: ecma/LexicalConventions/7.2-3-n.js
+ ECMA Section: 7.2 Line Terminators
+ Description: - readability
+ - separate tokens
+ - may occur between any two tokens
+ - cannot occur within any token, not even a string
+ - affect the process of automatic semicolon insertion.
+
+ white space characters are:
+ unicode name formal name string representation
+ \u000A line feed <LF> \n
+ \u000D carriage return <CR> \r
+
+ this test uses onerror to capture line numbers. because
+ we use on error, we can only have one test case per file.
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+ var SECTION = "lexical-002";
+ var VERSION = "JS1_4";
+ var TITLE = "Line Terminators";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ result = eval("\r\n\expect");
+ } catch ( e ) {
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "result=eval(\"\r\nexpect\")" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-003.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-003.js
new file mode 100644
index 0000000..a622d12
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-003.js
@@ -0,0 +1,41 @@
+/**
+ File Name: lexical-003.js
+ Corresponds To: 7.3-13-n.js
+ ECMA Section: 7.3 Comments
+ Description:
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var SECTION = "lexical-003.js";
+ var VERSION = "JS1_4";
+ var TITLE = "Comments";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ eval("/*\n/* nested comment */\n*/\n");
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "/*/*nested comment*/ */" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-004.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-004.js
new file mode 100644
index 0000000..6475838
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-004.js
@@ -0,0 +1,49 @@
+/**
+ File Name: lexical-004.js
+ Corresponds To: ecma/LexicalExpressions/7.4.1-1-n.js
+ ECMA Section: 7.4.1
+
+ Description:
+
+ Reserved words cannot be used as identifiers.
+
+ ReservedWord ::
+ Keyword
+ FutureReservedWord
+ NullLiteral
+ BooleanLiteral
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var SECTION = "lexical-004";
+ var VERSION = "JS1_4";
+ var TITLE = "Keywords";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ eval("var null = true;");
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "var null = true" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-005.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-005.js
new file mode 100644
index 0000000..a9cdd6b
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-005.js
@@ -0,0 +1,50 @@
+/**
+ File Name: lexical-005.js
+ Corresponds To: 7.4.1-2.js
+ ECMA Section: 7.4.1
+
+ Description:
+
+ Reserved words cannot be used as identifiers.
+
+ ReservedWord ::
+ Keyword
+ FutureReservedWord
+ NullLiteral
+ BooleanLiteral
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var SECTION = "lexical-005";
+ var VERSION = "JS1_4";
+ var TITLE = "Keywords";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ eval("true = false;");
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "true = false" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-006.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-006.js
new file mode 100644
index 0000000..89c45f3
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-006.js
@@ -0,0 +1,55 @@
+/**
+ File Name: lexical-006.js
+ Corresponds To: 7.4.2-1.js
+ ECMA Section: 7.4.2
+
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
+
+ Syntax
+
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
+
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var SECTION = "lexical-006";
+ var VERSION = "JS1_4";
+ var TITLE = "Keywords";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ eval("break = new Object();");
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "break = new Object()" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-007.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-007.js
new file mode 100644
index 0000000..d34afe4
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-007.js
@@ -0,0 +1,48 @@
+/**
+ File Name: lexical-005.js
+ Corresponds To: 7.4.1-3-n.js
+ ECMA Section: 7.4.1
+
+ Description:
+
+ Reserved words cannot be used as identifiers.
+
+ ReservedWord ::
+ Keyword
+ FutureReservedWord
+ NullLiteral
+ BooleanLiteral
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "lexical-005";
+ var VERSION = "JS1_4";
+ var TITLE = "Keywords";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ eval("false = true;");
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "false = true" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-008.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-008.js
new file mode 100644
index 0000000..f819eae
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-008.js
@@ -0,0 +1,50 @@
+/**
+ File Name: lexical-008.js
+ Corresponds To: 7.4.3-1-n.js
+ ECMA Section: 7.4.3
+
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
+
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "lexical-008.js";
+ var VERSION = "JS1_4";
+ var TITLE = "Future Reserved Words";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ eval("case = true;");
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "case = true" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
+
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-009.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-009.js
new file mode 100644
index 0000000..39fc71a
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-009.js
@@ -0,0 +1,49 @@
+/**
+ File Name: lexical-009
+ Corresponds To: 7.4.3-2-n.js
+ ECMA Section: 7.4.3
+
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
+
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "lexical-009";
+ var VERSION = "ECMA_1";
+ var TITLE = "Future Reserved Words";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+ var tc = 0;
+ var testcases = new Array();
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ eval("debugger = true;");
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "debugger = true" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
+
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-010.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-010.js
new file mode 100644
index 0000000..9e9f664
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-010.js
@@ -0,0 +1,48 @@
+/**
+ File Name: lexical-010.js
+ Corresponds To: 7.4.3-3-n.js
+ ECMA Section: 7.4.3
+
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
+
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "lexical-010";
+ var VERSION = "ECMA_1";
+ var TITLE = "Future Reserved Words";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ eval("export = true;");
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "export = true" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-011.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-011.js
new file mode 100644
index 0000000..1c054f2
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-011.js
@@ -0,0 +1,50 @@
+/**
+ File Name: lexical-011.js
+ Corresponds To: 7.4.3-4-n.js
+ ECMA Section: 7.4.3
+
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
+
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "lexical-011";
+ var VERSION = "JS1_4";
+ var TITLE = "Future Reserved Words";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ eval("super = true;");
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "super = true" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
+
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-012.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-012.js
new file mode 100644
index 0000000..e4579fd
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-012.js
@@ -0,0 +1,50 @@
+/**
+ File Name: lexical-012.js
+ Corresponds To: 7.4.3-5-n.js
+ ECMA Section: 7.4.3
+
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
+
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "lexical-012";
+ var VERSION = "JS1_4";
+ var TITLE = "Future Reserved Words";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ eval("catch = true;");
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "catch = true" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
+
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-013.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-013.js
new file mode 100644
index 0000000..699d06a
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-013.js
@@ -0,0 +1,49 @@
+/**
+ File Name: lexical-013.js
+ Corresponds To: 7.4.3-6-n.js
+ ECMA Section: 7.4.3
+
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
+
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "lexical-013";
+ var VERSION = "JS1_4";
+ var TITLE = "Future Reserved Words";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+ var tc = 0;
+ var testcases = new Array();
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ eval("default = true;");
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "default = true" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
+
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-014.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-014.js
new file mode 100644
index 0000000..41b12ff
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-014.js
@@ -0,0 +1,50 @@
+/**
+ File Name: lexical-014.js
+ Corresponds To: 7.4.3-7-n.js
+ ECMA Section: 7.4.3
+
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
+
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "lexical-014.js";
+ var VERSION = "JS1_4";
+ var TITLE = "Future Reserved Words";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ eval("extends = true;");
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "extends = true" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
+
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-015.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-015.js
new file mode 100644
index 0000000..7cbcc04
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-015.js
@@ -0,0 +1,50 @@
+/**
+ File Name: lexical-015.js
+ Corresponds To: 7.4.3-8-n.js
+ ECMA Section: 7.4.3
+
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
+
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "lexical-015";
+ var VERSION = "JS1_4";
+ var TITLE = "Future Reserved Words";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ eval("switch = true;");
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "switch = true" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
+
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-016.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-016.js
new file mode 100644
index 0000000..8126550
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-016.js
@@ -0,0 +1,48 @@
+/**
+ File Name: lexical-016
+ Corresponds To: 7.4.3-9-n.js
+ ECMA Section: 7.4.3
+
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
+
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "lexical-016";
+ var VERSION = "JS1_4";
+ var TITLE = "Future Reserved Words";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ eval("class = true;");
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "class = true" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-017.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-017.js
new file mode 100644
index 0000000..96849b7
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-017.js
@@ -0,0 +1,50 @@
+/**
+ File Name: lexical-017.js
+ Corresponds To: 7.4.3-10-n.js
+ ECMA Section: 7.4.3
+
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
+
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "lexical-017";
+ var VERSION = "JS1_4";
+ var TITLE = "Future Reserved Words";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+ var tc = 0;
+ var testcases = new Array();
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ eval("do = true;");
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "do = true" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
+
+
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-018.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-018.js
new file mode 100644
index 0000000..5d46c5f
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-018.js
@@ -0,0 +1,50 @@
+/**
+ File Name: lexical-018
+ Corresponds To: 7.4.3-11-n.js
+ ECMA Section: 7.4.3
+
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
+
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "lexical-018";
+ var VERSION = "JS1_4";
+ var TITLE = "Future Reserved Words";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ eval("finally = true;");
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "finally = true" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
+
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-019.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-019.js
new file mode 100644
index 0000000..9f01fc0
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-019.js
@@ -0,0 +1,50 @@
+/**
+ File Name: lexical-019.js
+ Corresponds To: 7.4.3-12-n.js
+ ECMA Section: 7.4.3
+
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
+
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "lexical-019";
+ var VERSION = "JS1_4";
+ var TITLE = "Future Reserved Words";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ eval("throw = true;");
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "throw = true" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
+
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-020.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-020.js
new file mode 100644
index 0000000..362a3d5
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-020.js
@@ -0,0 +1,50 @@
+/**
+ File Name: lexical-020.js
+ Corresponds To 7.4.3-13-n.js
+ ECMA Section: 7.4.3
+
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
+
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "lexical-020";
+ var VERSION = "JS1_4";
+ var TITLE = "Future Reserved Words";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ eval("const = true;");
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "const = true" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
+
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-021.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-021.js
new file mode 100644
index 0000000..9fb3ede
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-021.js
@@ -0,0 +1,50 @@
+/**
+ File Name: lexical-021.js
+ Corresponds To: 7.4.3-14-n.js
+ ECMA Section: 7.4.3
+
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
+
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "lexical-021.js";
+ var VERSION = "ECMA_1";
+ var TITLE = "Future Reserved Words";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ eval("enum = true;");
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "enum = true" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
+
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-022.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-022.js
new file mode 100644
index 0000000..54f256a
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-022.js
@@ -0,0 +1,50 @@
+/**
+ File Name: lexical-022
+ Corresponds To 7.4.3-15-n.js
+ ECMA Section: 7.4.3
+
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
+
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "lexical-022.js";
+ var VERSION = "ECMA_1";
+ var TITLE = "Future Reserved Words";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ eval("import = true;");
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "import = true" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
+
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-023.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-023.js
new file mode 100644
index 0000000..0715a3d
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-023.js
@@ -0,0 +1,49 @@
+/**
+ File Name: lexical-023.js
+ Corresponds To: 7.4.3-16-n.js
+ ECMA Section: 7.4.3
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
+
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "lexical-023.js";
+ var VERSION = "ECMA_1";
+ var TITLE = "Future Reserved Words";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ eval("try = true;");
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "try = true" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
+
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-024.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-024.js
new file mode 100644
index 0000000..d731791
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-024.js
@@ -0,0 +1,56 @@
+/**
+ File Name: lexical-024
+ Corresponds To: 7.4.2-1-n.js
+ ECMA Section: 7.4.2
+
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
+
+ Syntax
+
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
+
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var SECTION = "lexical-024";
+ var VERSION = "JS1_4";
+ var TITLE = "Keywords";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ eval("var break;");
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "var break" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
+
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-025.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-025.js
new file mode 100644
index 0000000..16a44d6
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-025.js
@@ -0,0 +1,56 @@
+/**
+ File Name: lexical-025.js
+ Corresponds To 7.4.2-2-n.js
+ ECMA Section: 7.4.2
+
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
+
+ Syntax
+
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
+
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var SECTION = "lexical-025";
+ var VERSION = "JS1_4";
+ var TITLE = "Keywords";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ eval("var for;");
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "var for" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
+
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-026.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-026.js
new file mode 100644
index 0000000..73aea73
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-026.js
@@ -0,0 +1,56 @@
+/**
+ File Name: lexical-026.js
+ Corresponds To: 7.4.2-3-n.js
+ ECMA Section: 7.4.2
+
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
+
+ Syntax
+
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
+
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var SECTION = "lexical-026";
+ var VERSION = "JS1_4";
+ var TITLE = "Keywords";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ eval("var new;");
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "var new" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
+
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-027.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-027.js
new file mode 100644
index 0000000..b8f8593
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-027.js
@@ -0,0 +1,58 @@
+/**
+ File Name: lexical-027.js
+ Corresponds To: 7.4.2-4-n.js
+ ECMA Section: 7.4.2
+
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
+
+ Syntax
+
+ var
+
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
+
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var SECTION = "lexical-027";
+ var VERSION = "JS1_4";
+ var TITLE = "Keywords";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ eval("var var;");
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "var var" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
+
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-028.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-028.js
new file mode 100644
index 0000000..a985527
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-028.js
@@ -0,0 +1,56 @@
+/**
+ File Name: lexical-028.js
+ Corresponds To: 7.4.2-5-n.js
+ ECMA Section: 7.4.2
+
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
+
+ Syntax
+
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
+
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var SECTION = "lexical-028";
+ var VERSION = "JS1_4";
+ var TITLE = "Keywords";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ eval("var continue=true;");
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "var continue=true" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
+
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-029.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-029.js
new file mode 100644
index 0000000..0b38cbe
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-029.js
@@ -0,0 +1,56 @@
+/**
+ File Name: lexical-029.js
+ Corresponds To: 7.4.2-6.js
+ ECMA Section: 7.4.2
+
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
+
+ Syntax
+
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
+
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var SECTION = "lexical-029";
+ var VERSION = "JS1_4";
+ var TITLE = "Keywords";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ eval("var function = true;");
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "var function = true" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
+
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-030.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-030.js
new file mode 100644
index 0000000..bc85472
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-030.js
@@ -0,0 +1,56 @@
+/**
+ File Name: lexical-030.js
+ Corresponds To: 7.4.2-7-n.js
+ ECMA Section: 7.4.2
+
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
+
+ Syntax
+
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
+
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var SECTION = "lexical-030";
+ var VERSION = "JS1_4";
+ var TITLE = "Keywords";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ eval("var return = true;");
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "var return = true" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
+
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-031.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-031.js
new file mode 100644
index 0000000..d2251ba
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-031.js
@@ -0,0 +1,56 @@
+/**
+ File Name: lexical-031.js
+ Corresponds To: 7.4.2-8-n.js
+ ECMA Section: 7.4.2
+
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
+
+ Syntax
+
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
+
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var SECTION = "lexical-031";
+ var VERSION = "JS1_4";
+ var TITLE = "Keywords";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ eval("var return;");
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "var return" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
+
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-032.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-032.js
new file mode 100644
index 0000000..5ac71cb
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-032.js
@@ -0,0 +1,56 @@
+/**
+ File Name: lexical-032.js
+ Corresponds To: 7.4.2-9-n.js
+ ECMA Section: 7.4.2
+
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
+
+ Syntax
+
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
+
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var SECTION = "lexical-032";
+ var VERSION = "JS1_4";
+ var TITLE = "Keywords";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ eval("delete = true;");
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "delete = true" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
+
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-033.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-033.js
new file mode 100644
index 0000000..2a357fe
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-033.js
@@ -0,0 +1,56 @@
+/**
+ File Name: lexical-033.js
+ Corresponds To: 7.4.2-10.js
+ ECMA Section: 7.4.2
+
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
+
+ Syntax
+
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
+
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var SECTION = "lexical-033";
+ var VERSION = "JS1_4";
+ var TITLE = "Keywords";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ eval("if = true;");
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "if = true" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
+
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-034.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-034.js
new file mode 100644
index 0000000..d6c03a2
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-034.js
@@ -0,0 +1,55 @@
+/**
+ File Name: 7.4.2-11-n.js
+ ECMA Section: 7.4.2
+
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
+
+ Syntax
+
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
+
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var SECTION = "lexical-034";
+ var VERSION = "JS1_4";
+ var TITLE = "Keywords";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ eval("this = true");
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "this = true" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
+
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-035.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-035.js
new file mode 100644
index 0000000..f5fca59
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-035.js
@@ -0,0 +1,56 @@
+/**
+ File Name: lexical-035.js
+ Correpsonds To: 7.4.2-12-n.js
+ ECMA Section: 7.4.2
+
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
+
+ Syntax
+
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
+
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var SECTION = "lexical-035";
+ var VERSION = "JS1_4";
+ var TITLE = "Keywords";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ eval("var while");
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "var while" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
+
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-036.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-036.js
new file mode 100644
index 0000000..3512c9b
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-036.js
@@ -0,0 +1,56 @@
+/**
+ File Name: lexical-036.js
+ Corresponds To: 7.4.2-13-n.js
+ ECMA Section: 7.4.2
+
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
+
+ Syntax
+
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
+
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var SECTION = "lexical-036";
+ var VERSION = "JS1_4";
+ var TITLE = "Keywords";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ eval("else = true;");
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "else = true" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
+
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-037.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-037.js
new file mode 100644
index 0000000..641c9de
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-037.js
@@ -0,0 +1,56 @@
+/**
+ File Name: lexical-037.js
+ Corresponds To: 7.4.2-14-n.js
+ ECMA Section: 7.4.2
+
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
+
+ Syntax
+
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
+
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var SECTION = "lexical-028";
+ var VERSION = "JS1_4";
+ var TITLE = "Keywords";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ eval("var in;");
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "var in" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
+
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-038.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-038.js
new file mode 100644
index 0000000..f44b6b3
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-038.js
@@ -0,0 +1,56 @@
+/**
+ File Name: lexical-038.js
+ Corresponds To: 7.4.2-15-n.js
+ ECMA Section: 7.4.2
+
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
+
+ Syntax
+
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
+
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var SECTION = "lexical-038";
+ var VERSION = "JS1_4";
+ var TITLE = "Keywords";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ eval("typeof = true;");
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "typeof = true" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
+
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-039.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-039.js
new file mode 100644
index 0000000..e40b21b
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-039.js
@@ -0,0 +1,43 @@
+/**
+ File Name: lexical-039
+ Corresponds To: 7.5-2-n.js
+ ECMA Section: 7.5 Identifiers
+ Description: Identifiers are of unlimited length
+ - can contain letters, a decimal digit, _, or $
+ - the first character cannot be a decimal digit
+ - identifiers are case sensitive
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+ var SECTION = "lexical-039";
+ var VERSION = "JS1_4";
+ var TITLE = "Identifiers";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ eval("var 0abc;");
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "var 0abc" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
+
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-040.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-040.js
new file mode 100644
index 0000000..fb306c1
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-040.js
@@ -0,0 +1,43 @@
+/**
+ File Name: lexical-040.js
+ Corresponds To: 7.5-2.js
+ ECMA Section: 7.5 Identifiers
+ Description: Identifiers are of unlimited length
+ - can contain letters, a decimal digit, _, or $
+ - the first character cannot be a decimal digit
+ - identifiers are case sensitive
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+ var SECTION = "lexical-040";
+ var VERSION = "JS1_4";
+ var TITLE = "Identifiers";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ eval("var 1abc;");
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "var 1abc" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
+
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-041.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-041.js
new file mode 100644
index 0000000..da830f8
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-041.js
@@ -0,0 +1,45 @@
+/**
+ File Name: lexical-041.js
+ Corresponds To: 7.5-8-n.js
+ ECMA Section: 7.5 Identifiers
+ Description: Identifiers are of unlimited length
+ - can contain letters, a decimal digit, _, or $
+ - the first character cannot be a decimal digit
+ - identifiers are case sensitive
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+ var SECTION = "lexical-041";
+ var VERSION = "ECMA_1";
+ var TITLE = "Identifiers";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ eval("var @abc;");
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "var @abc" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
+
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-042.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-042.js
new file mode 100644
index 0000000..88ee509
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-042.js
@@ -0,0 +1,46 @@
+/**
+ File Name: lexical-042.js
+ Corresponds To: 7.5-9-n.js
+ ECMA Section: 7.5 Identifiers
+ Description: Identifiers are of unlimited length
+ - can contain letters, a decimal digit, _, or $
+ - the first character cannot be a decimal digit
+ - identifiers are case sensitive
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+ var SECTION = "lexical-042";
+ var VERSION = "JS1_4";
+ var TITLE = "Identifiers";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ eval("var 123;");
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "var 123" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
+
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-047.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-047.js
new file mode 100644
index 0000000..b5e3548
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-047.js
@@ -0,0 +1,47 @@
+/**
+ File Name: lexical-047.js
+ Corresponds To: 7.8.1-7-n.js
+ ECMA Section: 7.8.1
+ Description:
+ Author: christine@netscape.com
+ Date: 15 september 1997
+*/
+
+ var SECTION = "lexical-047";
+ var VERSION = "JS1_4";
+ var TITLE = "for loops";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ var counter = 0;
+ eval("for ( counter = 0\n"
+ + "counter <= 1\n"
+ + "counter++ )\n"
+ + "{\n"
+ + "result += \": got to inner loop\";\n"
+ + "}\n");
+
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "line breaks within a for expression" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
+
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-048.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-048.js
new file mode 100644
index 0000000..39a0600
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-048.js
@@ -0,0 +1,41 @@
+ /**
+ File Name: lexical-048.js
+ Corresponds To: 7.8.1-1.js
+ ECMA Section: 7.8.1 Rules of Automatic Semicolon Insertion
+ Description:
+ Author: christine@netscape.com
+ Date: 15 september 1997
+*/
+
+ var SECTION = "lexical-048";
+ var VERSION = "JS1_4";
+ var TITLE = "The Rules of Automatic Semicolon Insertion";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ var counter = 0;
+ eval( "for ( counter = 0;\ncounter <= 1\ncounter++ ) {\nresult += \": got inside for loop\")");
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "line breaks within a for expression" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
+
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-049.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-049.js
new file mode 100644
index 0000000..e03cfec
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-049.js
@@ -0,0 +1,46 @@
+ /**
+ File Name: lexical-049
+ Corresponds To: 7.8.1-1.js
+ ECMA Section: 7.8.1 Rules of Automatic Semicolon Insertioin
+ Description:
+ Author: christine@netscape.com
+ Date: 15 september 1997
+*/
+ var SECTION = "lexical-049";
+ var VERSION = "JS1_4";
+ var TITLE = "The Rules of Automatic Semicolon Insertion";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ var counter = 0;
+ eval("for ( counter = 0\n"
+ + "counter <= 1;\n"
+ + "counter++ )\n"
+ + "{\n"
+ + "result += \": got inside for loop\";\n"
+ + "}\n");
+
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "line breaks within a for expression" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
+
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-050.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-050.js
new file mode 100644
index 0000000..bc871a7
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-050.js
@@ -0,0 +1,42 @@
+/**
+ File Name: lexical-050.js
+ Corresponds to: 7.8.2-1-n.js
+ ECMA Section: 7.8.2 Examples of Automatic Semicolon Insertion
+ Description: compare some specific examples of the automatic
+ insertion rules in the EMCA specification.
+ Author: christine@netscape.com
+ Date: 15 september 1997
+*/
+
+ var SECTION = "lexical-050";
+ var VERSION = "JS1_4";
+ var TITLE = "Examples of Automatic Semicolon Insertion";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ eval("{ 1 2 } 3");
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "{ 1 2 } 3" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
+
+
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-051.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-051.js
new file mode 100644
index 0000000..68e6b44
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-051.js
@@ -0,0 +1,42 @@
+/**
+ File Name: lexical-051.js
+ Corresponds to: 7.8.2-3-n.js
+ ECMA Section: 7.8.2 Examples of Automatic Semicolon Insertion
+ Description: compare some specific examples of the automatic
+ insertion rules in the EMCA specification.
+ Author: christine@netscape.com
+ Date: 15 september 1997
+*/
+
+ var SECTION = "lexical-051";
+ var VERSION = "JS1_4";
+ var TITLE = "Examples of Automatic Semicolon Insertion";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ eval("for (a; b\n) result += \": got to inner loop\";")
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "for (a; b\n)" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
+
+
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-052.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-052.js
new file mode 100644
index 0000000..49aa7c7
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-052.js
@@ -0,0 +1,44 @@
+/**
+ File Name: lexical-052.js
+ Corresponds to: 7.8.2-4-n.js
+ ECMA Section: 7.8.2 Examples of Automatic Semicolon Insertion
+ Description: compare some specific examples of the automatic
+ insertion rules in the EMCA specification.
+ Author: christine@netscape.com
+ Date: 15 september 1997
+*/
+
+ var SECTION = "lexical-052";
+ var VERSION = "JS1_4";
+ var TITLE = "Examples of Automatic Semicolon Insertion";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ MyFunction();
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "calling return indirectly" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
+
+function MyFunction() {
+ var s = "return";
+ eval(s);
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-053.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-053.js
new file mode 100644
index 0000000..6e3ae99
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-053.js
@@ -0,0 +1,42 @@
+/**
+ File Name: lexical-053.js
+ Corresponds to: 7.8.2-7-n.js
+ ECMA Section: 7.8.2 Examples of Automatic Semicolon Insertion
+ Description: compare some specific examples of the automatic
+ insertion rules in the EMCA specification.
+ Author: christine@netscape.com
+ Date: 15 september 1997
+*/
+
+ var SECTION = "lexical-053";
+ var VERSION = "JS1_4";
+ var TITLE = "Examples of Automatic Semicolon Insertion";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ a = true
+ b = false
+
+ eval('if (a > b)\nelse result += ": got to else statement"');
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "calling return indirectly" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-054.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-054.js
new file mode 100644
index 0000000..c4b9e9f
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-054.js
@@ -0,0 +1,43 @@
+/**
+ File Name: lexical-054.js
+ Corresponds to: 7.8.2-7-n.js
+ ECMA Section: 7.8.2 Examples of Automatic Semicolon Insertion
+ Description: compare some specific examples of the automatic
+ insertion rules in the EMCA specification.
+ Author: christine@netscape.com
+ Date: 15 september 1997
+*/
+
+ var SECTION = "lexical-054";
+ var VERSION = "JS1_4";
+ var TITLE = "Examples of Automatic Semicolon Insertion";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ a=0;
+ b=1;
+ c=2;
+ d=3;
+ eval("if (a > b)\nelse c = d");
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "if (a > b)\nelse c = d" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/number-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/number-001.js
new file mode 100644
index 0000000..1f45603
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/number-001.js
@@ -0,0 +1,52 @@
+/**
+ File Name: number-001
+ Corresponds To: 15.7.4.2-2-n.js
+ ECMA Section: 15.7.4.2.2 Number.prototype.toString()
+ Description:
+ If the radix is the number 10 or not supplied, then this number value is
+ given as an argument to the ToString operator; the resulting string value
+ is returned.
+
+ If the radix is supplied and is an integer from 2 to 36, but not 10, the
+ result is a string, the choice of which is implementation dependent.
+
+ The toString function is not generic; it generates a runtime error if its
+ this value is not a Number object. Therefore it cannot be transferred to
+ other kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+ var SECTION = "number-001";
+ var VERSION = "JS1_4";
+ var TITLE = "Exceptions for Number.toString()";
+
+ startTest();
+ writeHeaderToLog( SECTION + " Number.prototype.toString()");
+
+ var testcases = new Array();
+ var tc = 0;
+
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+
+ try {
+ object= new Object();
+ object.toString = Number.prototype.toString;
+ result = object.toString();
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "object = new Object(); object.toString = Number.prototype.toString; object.toString()" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/number-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/number-002.js
new file mode 100644
index 0000000..5e84ebf
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/number-002.js
@@ -0,0 +1,45 @@
+/**
+ File Name: number-002.js
+ Corresponds To: ecma/Number/15.7.4.3-2-n.js
+ ECMA Section: 15.7.4.3.1 Number.prototype.valueOf()
+ Description:
+ Returns this number value.
+
+ The valueOf function is not generic; it generates a runtime error if its
+ this value is not a Number object. Therefore it cannot be transferred to
+ other kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+ var SECTION = "number-002";
+ var VERSION = "JS1_4";
+ var TITLE = "Exceptions for Number.valueOf()";
+
+ startTest();
+ writeHeaderToLog( SECTION + " Number.prototype.valueOf()");
+
+ var testcases = new Array();
+ var tc = 0;
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ object= new Object();
+ object.toString = Number.prototype.valueOf;
+ result = object.toString();
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "object = new Object(); object.valueOf = Number.prototype.valueOf; object.valueOf()" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/number-003.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/number-003.js
new file mode 100644
index 0000000..947d3d2
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/number-003.js
@@ -0,0 +1,47 @@
+/**
+ File Name: number-003.js
+ Corresponds To: 15.7.4.3-3.js
+ ECMA Section: 15.7.4.3.1 Number.prototype.valueOf()
+ Description:
+ Returns this number value.
+
+ The valueOf function is not generic; it generates a runtime error if its
+ this value is not a Number object. Therefore it cannot be transferred to
+ other kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+ var SECTION = "number-003";
+ var VERSION = "JS1_4";
+ var TITLE = "Exceptions for Number.valueOf()";
+
+ var tc = 0;
+ var testcases = new Array();
+
+ startTest();
+ writeHeaderToLog( SECTION + " Number.prototype.valueOf()");
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ VALUE_OF = Number.prototype.valueOf;
+ OBJECT = new String("Infinity");
+ OBJECT.valueOf = VALUE_OF;
+ result = OBJECT.valueOf();
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "Assigning Number.prototype.valueOf as the valueOf of a String object " +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/statement-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/statement-001.js
new file mode 100644
index 0000000..928a04d
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/statement-001.js
@@ -0,0 +1,44 @@
+/**
+ File Name: statement-001.js
+ Corresponds To: 12.6.2-9-n.js
+ ECMA Section: 12.6.2 The for Statement
+
+ 1. first expression is not present.
+ 2. second expression is not present
+ 3. third expression is not present
+
+
+ Author: christine@netscape.com
+ Date: 15 september 1997
+*/
+
+ var SECTION = "statement-001.js";
+// var SECTION = "12.6.2-9-n";
+ var VERSION = "ECMA_1";
+ var TITLE = "The for statment";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+ var tc = 0;
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ eval("for (i) {\n}");
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "for(i) {}" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/statement-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/statement-002.js
new file mode 100644
index 0000000..83c642c
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/statement-002.js
@@ -0,0 +1,66 @@
+/**
+ File Name: statement-002.js
+ Corresponds To: 12.6.3-1.js
+ ECMA Section: 12.6.3 The for...in Statement
+ Description:
+ The production IterationStatement : for ( LeftHandSideExpression in Expression )
+ Statement is evaluated as follows:
+
+ 1. Evaluate the Expression.
+ 2. Call GetValue(Result(1)).
+ 3. Call ToObject(Result(2)).
+ 4. Let C be "normal completion".
+ 5. Get the name of the next property of Result(3) that doesn't have the
+ DontEnum attribute. If there is no such property, go to step 14.
+ 6. Evaluate the LeftHandSideExpression ( it may be evaluated repeatedly).
+ 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ):
+ 1. If Type(V) is not Reference, generate a runtime error.
+ 2. Call GetBase(V).
+ 3. If Result(2) is null, go to step 6.
+ 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V)
+ for the property name and W for the value.
+ 5. Return.
+ 6. Call the [[Put]] method for the global object, passing
+ GetPropertyName(V) for the property name and W for the value.
+ 7. Return.
+ 8. Evaluate Statement.
+ 9. If Result(8) is a value completion, change C to be "normal completion
+ after value V" where V is the value carried by Result(8).
+ 10. If Result(8) is a break completion, go to step 14.
+ 11. If Result(8) is a continue completion, go to step 5.
+ 12. If Result(8) is a return completion, return Result(8).
+ 13. Go to step 5.
+ 14. Return C.
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+ var SECTION = "statement-002";
+ var VERSION = "JS1_4";
+ var TITLE = "The for..in statment";
+
+ var testcases = new Array();
+ var tc = 0;
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ eval(" for ( var i, p in this) { result += this[p]; }");
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "more than one member expression" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/statement-003.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/statement-003.js
new file mode 100644
index 0000000..c7ffc7f
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/statement-003.js
@@ -0,0 +1,77 @@
+/**
+ File Name: statement-003
+ Corresponds To: 12.6.3-7-n.js
+ ECMA Section: 12.6.3 The for...in Statement
+ Description:
+ The production IterationStatement : for ( LeftHandSideExpression in Expression )
+ Statement is evaluated as follows:
+
+ 1. Evaluate the Expression.
+ 2. Call GetValue(Result(1)).
+ 3. Call ToObject(Result(2)).
+ 4. Let C be "normal completion".
+ 5. Get the name of the next property of Result(3) that doesn't have the
+ DontEnum attribute. If there is no such property, go to step 14.
+ 6. Evaluate the LeftHandSideExpression ( it may be evaluated repeatedly).
+ 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ):
+ 1. If Type(V) is not Reference, generate a runtime error.
+ 2. Call GetBase(V).
+ 3. If Result(2) is null, go to step 6.
+ 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V)
+ for the property name and W for the value.
+ 5. Return.
+ 6. Call the [[Put]] method for the global object, passing
+ GetPropertyName(V) for the property name and W for the value.
+ 7. Return.
+ 8. Evaluate Statement.
+ 9. If Result(8) is a value completion, change C to be "normal completion
+ after value V" where V is the value carried by Result(8).
+ 10. If Result(8) is a break completion, go to step 14.
+ 11. If Result(8) is a continue completion, go to step 5.
+ 12. If Result(8) is a return completion, return Result(8).
+ 13. Go to step 5.
+ 14. Return C.
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+ var SECTION = "statement-003";
+ var VERSION = "JS1_4";
+ var TITLE = "The for..in statment";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+ var tc = 0;
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ var o = new MyObject();
+ var result = 0;
+
+ eval("for ( this in o) {\n"
+ + "result += this[p];\n"
+ + "}\n");
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "bad left-hand side expression" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
+
+function MyObject() {
+ this.value = 2;
+ this[0] = 4;
+ return this;
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/statement-004.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/statement-004.js
new file mode 100644
index 0000000..9eee4e6
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/statement-004.js
@@ -0,0 +1,49 @@
+/**
+ File Name: statement-004.js
+ Corresponds To: 12.6.3-1.js
+ ECMA Section: 12.6.3 The for...in Statement
+ Description:
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+ var SECTION = "statement-004";
+ var VERSION = "JS1_4";
+ var TITLE = "The for..in statment";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+ var tc = 0;
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ var o = new MyObject();
+
+ eval("for ( \"a\" in o) {\n"
+ + "result += this[p];\n"
+ + "}");
+
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "bad left-hand side expression" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
+
+
+function MyObject() {
+ this.value = 2;
+ this[0] = 4;
+ return this;
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/statement-005.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/statement-005.js
new file mode 100644
index 0000000..50933b0
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/statement-005.js
@@ -0,0 +1,48 @@
+/**
+ File Name: statement-005.js
+ Corresponds To: 12.6.3-8-n.js
+ ECMA Section: 12.6.3 The for...in Statement
+ Description:
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+ var SECTION = "statement-005";
+ var VERSION = "JS1_4";
+ var TITLE = "The for..in statment";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+ var tc = 0;
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ var o = new MyObject();
+ result = 0;
+
+ eval("for (1 in o) {\n"
+ + "result += this[p];"
+ + "}\n");
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "bad left-hand side expression" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
+
+function MyObject() {
+ this.value = 2;
+ this[0] = 4;
+ return this;
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/statement-006.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/statement-006.js
new file mode 100644
index 0000000..1fe0325
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/statement-006.js
@@ -0,0 +1,48 @@
+/**
+ File Name: statement-006.js
+ Corresponds To: 12.6.3-9-n.js
+ ECMA Section: 12.6.3 The for...in Statement
+ Description:
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+ var SECTION = "statement-006";
+ var VERSION = "JS1_4";
+ var TITLE = "The for..in statment";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ var o = new MyObject();
+ var result = 0;
+ for ( var o in foo) {
+ result += this[o];
+ }
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "object is not defined" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
+
+function MyObject() {
+ this.value = 2;
+ this[0] = 4;
+ return this;
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/statement-007.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/statement-007.js
new file mode 100644
index 0000000..506578b
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/statement-007.js
@@ -0,0 +1,39 @@
+/**
+ File Name: statement-007.js
+ Corresponds To: 12.7-1-n.js
+ ECMA Section: 12.7 The continue statement
+ Description:
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "statement-007";
+ var VERSION = "JS1_4";
+ var TITLE = "The continue statment";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ eval("continue;");
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "continue outside of an iteration statement" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/statement-008.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/statement-008.js
new file mode 100644
index 0000000..e293964
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/statement-008.js
@@ -0,0 +1,39 @@
+/**
+ File Name: statement-008.js
+ Corresponds To: 12.8-1-n.js
+ ECMA Section: 12.8 The break statement
+ Description:
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "statement-008";
+ var VERSION = "JS1_4";
+ var TITLE = "The break in statment";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ eval("break;");
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "break outside of an iteration statement" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/statement-009.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/statement-009.js
new file mode 100644
index 0000000..136d3f1
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/statement-009.js
@@ -0,0 +1,38 @@
+/**
+ File Name: 12.9-1-n.js
+ ECMA Section: 12.9 The return statement
+ Description:
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "12.9-1-n";
+ var VERSION = "ECMA_1";
+ var TITLE = "The return statment";
+
+ startTest();
+ writeHeaderToLog( SECTION + " The return statement");
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ eval("return;");
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "return outside of a function" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/string-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/string-001.js
new file mode 100644
index 0000000..9ba39af
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/string-001.js
@@ -0,0 +1,50 @@
+/**
+ File Name: string-001.js
+ Corresponds To: 15.5.4.2-2-n.js
+ ECMA Section: 15.5.4.2 String.prototype.toString()
+
+ Description: Returns this string value. Note that, for a String
+ object, the toString() method happens to return the same
+ thing as the valueOf() method.
+
+ The toString function is not generic; it generates a
+ runtime error if its this value is not a String object.
+ Therefore it connot be transferred to the other kinds of
+ objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 1 october 1997
+*/
+ var SECTION = "string-001";
+ var VERSION = "JS1_4";
+ var TITLE = "String.prototype.toString";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ OBJECT = new Object();
+ OBJECT.toString = String.prototype.toString();
+ result = OBJECT.toString();
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "OBJECT = new Object; "+
+ " OBJECT.toString = String.prototype.toString; OBJECT.toString()" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/string-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/string-002.js
new file mode 100644
index 0000000..857271e
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/string-002.js
@@ -0,0 +1,49 @@
+/**
+ File Name: string-002.js
+ Corresponds To: 15.5.4.3-3-n.js
+ ECMA Section: 15.5.4.3 String.prototype.valueOf()
+
+ Description: Returns this string value.
+
+ The valueOf function is not generic; it generates a
+ runtime error if its this value is not a String object.
+ Therefore it connot be transferred to the other kinds of
+ objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 1 october 1997
+*/
+ var SECTION = "string-002";
+ var VERSION = "JS1_4";
+ var TITLE = "String.prototype.valueOf";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var result = "Failed";
+ var exception = "No exception thrown";
+ var expect = "Passed";
+
+ try {
+ var OBJECT =new Object();
+ OBJECT.valueOf = String.prototype.valueOf;
+ result = OBJECT.valueOf();
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "OBJECT = new Object; OBJECT.valueOf = String.prototype.valueOf;"+
+ "result = OBJECT.valueOf();" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+ test();
+
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Expressions/StrictEquality-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Expressions/StrictEquality-001.js
new file mode 100644
index 0000000..c3ac507
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Expressions/StrictEquality-001.js
@@ -0,0 +1,70 @@
+/**
+ * File Name: StrictEquality-001.js
+ * ECMA Section: 11.9.6.js
+ * Description:
+ *
+ * Author: christine@netscape.com
+ * Date: 4 september 1998
+ */
+ var SECTION = "StrictEquality-001 - 11.9.6";
+ var VERSION = "ECMA_2";
+ var TITLE = "The strict equality operator ( === )";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+
+ // 1. If Type(x) is different from Type(y) return false
+
+ StrictEquality( true, new Boolean(true), false );
+ StrictEquality( new Boolean(), false, false );
+ StrictEquality( "", new String(), false );
+ StrictEquality( new String("hi"), "hi", false );
+
+ // 2. If Type(x) is not Number go to step 9.
+
+ // 3. If x is NaN, return false
+ StrictEquality( NaN, NaN, false );
+ StrictEquality( NaN, 0, false );
+
+ // 4. If y is NaN, return false.
+ StrictEquality( 0, NaN, false );
+
+ // 5. if x is the same number value as y, return true
+
+ // 6. If x is +0 and y is -0, return true
+
+ // 7. If x is -0 and y is +0, return true
+
+ // 8. Return false.
+
+
+ // 9. If Type(x) is String, then return true if x and y are exactly
+ // the same sequence of characters ( same length and same characters
+ // in corresponding positions.) Otherwise return false.
+
+ // 10. If Type(x) is Boolean, return true if x and y are both true or
+ // both false. otherwise return false.
+
+
+ // Return true if x and y refer to the same object. Otherwise return
+ // false.
+
+ // Return false.
+
+
+ test();
+
+function StrictEquality( x, y, expect ) {
+ result = ( x === y );
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ x +" === " + y,
+ expect,
+ result );
+}
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Expressions/instanceof-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Expressions/instanceof-001.js
new file mode 100644
index 0000000..2e7412a
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Expressions/instanceof-001.js
@@ -0,0 +1,117 @@
+/**
+ * File Name: instanceof-001.js
+ * ECMA Section: 11.8.6
+ * Description:
+ *
+ * RelationalExpression instanceof Identifier
+ *
+ * Author: christine@netscape.com
+ * Date: 2 September 1998
+ */
+ var SECTION = "instanceof-001";
+ var VERSION = "ECMA_2";
+ var TITLE = "instanceof"
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ function InstanceOf( object_1, object_2, expect ) {
+ result = object_1 instanceof object_2;
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "(" + object_1 + ") instanceof " + object_2,
+ expect,
+ result );
+ }
+
+ function Gen3(value) {
+ this.value = value;
+ this.generation = 3;
+ this.toString = new Function ( "return \"(Gen\"+this.generation+\" instance)\"" );
+ }
+ Gen3.name = 3;
+ Gen3.__proto__.toString = new Function( "return \"(\"+this.name+\" object)\"");
+
+ function Gen2(value) {
+ this.value = value;
+ this.generation = 2;
+ }
+ Gen2.name = 2;
+ Gen2.prototype = new Gen3();
+
+ function Gen1(value) {
+ this.value = value;
+ this.generation = 1;
+ }
+ Gen1.name = 1;
+ Gen1.prototype = new Gen2();
+
+ function Gen0(value) {
+ this.value = value;
+ this.generation = 0;
+ }
+ Gen0.name = 0;
+ Gen0.prototype = new Gen1();
+
+
+ function GenA(value) {
+ this.value = value;
+ this.generation = "A";
+ this.toString = new Function ( "return \"(instance of Gen\"+this.generation+\")\"" );
+
+ }
+ GenA.prototype = new Gen0();
+ GenA.name = "A";
+
+ function GenB(value) {
+ this.value = value;
+ this.generation = "B";
+ this.toString = new Function ( "return \"(instance of Gen\"+this.generation+\")\"" );
+ }
+ GenB.name = "B"
+ GenB.prototype = void 0;
+
+ // RelationalExpression is not an object.
+
+ InstanceOf( true, Boolean, false );
+ InstanceOf( new Boolean(false), Boolean, true );
+
+ // Identifier is not a function
+
+// InstanceOf( true, true, false );
+// InstanceOf( new Boolean(true), false, false );
+
+ // Identifier is a function, prototype of Identifier is not an object
+
+// InstanceOf( new GenB(), GenB, false );
+
+ // __proto__ of RelationalExpression is null. should return false
+ genA = new GenA();
+ genA.__proto__ = null;
+
+ InstanceOf( genA, GenA, false );
+
+ // RelationalExpression.__proto__ == (but not ===) Identifier.prototype
+
+ InstanceOf( new Gen2(), Gen0, false );
+ InstanceOf( new Gen2(), Gen1, false );
+ InstanceOf( new Gen2(), Gen2, true );
+ InstanceOf( new Gen2(), Gen3, true );
+
+ // RelationalExpression.__proto__.__proto__ === Identifier.prototype
+ InstanceOf( new Gen0(), Gen0, true );
+ InstanceOf( new Gen0(), Gen1, true );
+ InstanceOf( new Gen0(), Gen2, true );
+ InstanceOf( new Gen0(), Gen3, true );
+
+ InstanceOf( new Gen0(), Object, true );
+ InstanceOf( new Gen0(), Function, false );
+
+ InstanceOf( Gen0, Function, true );
+ InstanceOf( Gen0, Object, true );
+
+ test(); \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Expressions/instanceof-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Expressions/instanceof-002.js
new file mode 100644
index 0000000..68697d0
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Expressions/instanceof-002.js
@@ -0,0 +1,124 @@
+/**
+ File Name: instanceof-002.js
+ Section:
+ Description: Determining Instance Relationships
+
+ This test is the same as js1_3/inherit/proto-002, except that it uses
+ the builtin instanceof operator rather than a user-defined function
+ called InstanceOf.
+
+ This tests Object Hierarchy and Inheritance, as described in the document
+ Object Hierarchy and Inheritance in JavaScript, last modified on 12/18/97
+ 15:19:34 on http://devedge.netscape.com/. Current URL:
+ http://devedge.netscape.com/docs/manuals/communicator/jsobj/contents.htm
+
+ This tests the syntax ObjectName.prototype = new PrototypeObject using the
+ Employee example in the document referenced above.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+// onerror = err;
+
+ var SECTION = "instanceof-002";
+ var VERSION = "ECMA_2";
+ var TITLE = "Determining Instance Relationships";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+function InstanceOf( object, constructor ) {
+ while ( object != null ) {
+ if ( object == constructor.prototype ) {
+ return true;
+ }
+ object = object.__proto__;
+ }
+ return false;
+}
+
+function Employee ( name, dept ) {
+ this.name = name || "";
+ this.dept = dept || "general";
+}
+
+function Manager () {
+ this.reports = [];
+}
+Manager.prototype = new Employee();
+
+function WorkerBee ( name, dept, projs ) {
+ this.base = Employee;
+ this.base( name, dept)
+ this.projects = projs || new Array();
+}
+WorkerBee.prototype = new Employee();
+
+function SalesPerson () {
+ this.dept = "sales";
+ this.quota = 100;
+}
+SalesPerson.prototype = new WorkerBee();
+
+function Engineer ( name, projs, machine ) {
+ this.base = WorkerBee;
+ this.base( name, "engineering", projs )
+ this.machine = machine || "";
+}
+Engineer.prototype = new WorkerBee();
+
+var pat = new Engineer()
+
+ testcases[tc++] = new TestCase( SECTION,
+ "pat.__proto__ == Engineer.prototype",
+ true,
+ pat.__proto__ == Engineer.prototype );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "pat.__proto__.__proto__ == WorkerBee.prototype",
+ true,
+ pat.__proto__.__proto__ == WorkerBee.prototype );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "pat.__proto__.__proto__.__proto__ == Employee.prototype",
+ true,
+ pat.__proto__.__proto__.__proto__ == Employee.prototype );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "pat.__proto__.__proto__.__proto__.__proto__ == Object.prototype",
+ true,
+ pat.__proto__.__proto__.__proto__.__proto__ == Object.prototype );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "pat.__proto__.__proto__.__proto__.__proto__.__proto__ == null",
+ true,
+ pat.__proto__.__proto__.__proto__.__proto__.__proto__ == null );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "pat instanceof Engineer",
+ true,
+ pat instanceof Engineer );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "pat instanceof WorkerBee )",
+ true,
+ pat instanceof WorkerBee );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "pat instanceof Employee )",
+ true,
+ pat instanceof Employee );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "pat instanceof Object )",
+ true,
+ pat instanceof Object );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "pat instanceof SalesPerson )",
+ false,
+ pat instanceof SalesPerson );
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Expressions/instanceof-003-n.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Expressions/instanceof-003-n.js
new file mode 100644
index 0000000..f48108e
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Expressions/instanceof-003-n.js
@@ -0,0 +1,93 @@
+/**
+ * File Name: instanceof-001.js
+ * ECMA Section: 11.8.6
+ * Description:
+ *
+ * RelationalExpression instanceof Identifier
+ *
+ * Author: christine@netscape.com
+ * Date: 2 September 1998
+ */
+ var SECTION = "instanceof-001";
+ var VERSION = "ECMA_2";
+ var TITLE = "instanceof"
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ function InstanceOf( object_1, object_2, expect ) {
+ result = object_1 instanceof object_2;
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "(" + object_1 + ") instanceof " + object_2,
+ expect,
+ result );
+ }
+
+ function Gen3(value) {
+ this.value = value;
+ this.generation = 3;
+ this.toString = new Function ( "return \"(Gen\"+this.generation+\" instance)\"" );
+ }
+ Gen3.name = 3;
+ Gen3.__proto__.toString = new Function( "return \"(\"+this.name+\" object)\"");
+
+ function Gen2(value) {
+ this.value = value;
+ this.generation = 2;
+ }
+ Gen2.name = 2;
+ Gen2.prototype = new Gen3();
+
+ function Gen1(value) {
+ this.value = value;
+ this.generation = 1;
+ }
+ Gen1.name = 1;
+ Gen1.prototype = new Gen2();
+
+ function Gen0(value) {
+ this.value = value;
+ this.generation = 0;
+ }
+ Gen0.name = 0;
+ Gen0.prototype = new Gen1();
+
+
+ function GenA(value) {
+ this.value = value;
+ this.generation = "A";
+ this.toString = new Function ( "return \"(instance of Gen\"+this.generation+\")\"" );
+
+ }
+ GenA.prototype = new Gen0();
+ GenA.name = "A";
+
+ function GenB(value) {
+ this.value = value;
+ this.generation = "B";
+ this.toString = new Function ( "return \"(instance of Gen\"+this.generation+\")\"" );
+ }
+ GenB.name = "B"
+ GenB.prototype = void 0;
+
+ // RelationalExpression is not an object.
+
+ InstanceOf( true, Boolean, false );
+// InstanceOf( new Boolean(false), Boolean, true );
+
+ // Identifier is not a function
+
+ InstanceOf( true, true, false );
+// InstanceOf( new Boolean(true), false, false );
+
+ // Identifier is a function, prototype of Identifier is not an object
+
+// InstanceOf( new GenB(), GenB, false );
+
+
+ test(); \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Expressions/instanceof-004-n.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Expressions/instanceof-004-n.js
new file mode 100644
index 0000000..664a553
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Expressions/instanceof-004-n.js
@@ -0,0 +1,92 @@
+/**
+ * File Name: instanceof-001.js
+ * ECMA Section: 11.8.6
+ * Description:
+ *
+ * RelationalExpression instanceof Identifier
+ *
+ * Author: christine@netscape.com
+ * Date: 2 September 1998
+ */
+ var SECTION = "instanceof-001";
+ var VERSION = "ECMA_2";
+ var TITLE = "instanceof"
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ function InstanceOf( object_1, object_2, expect ) {
+ result = object_1 instanceof object_2;
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "(" + object_1 + ") instanceof " + object_2,
+ expect,
+ result );
+ }
+
+ function Gen3(value) {
+ this.value = value;
+ this.generation = 3;
+ this.toString = new Function ( "return \"(Gen\"+this.generation+\" instance)\"" );
+ }
+ Gen3.name = 3;
+ Gen3.__proto__.toString = new Function( "return \"(\"+this.name+\" object)\"");
+
+ function Gen2(value) {
+ this.value = value;
+ this.generation = 2;
+ }
+ Gen2.name = 2;
+ Gen2.prototype = new Gen3();
+
+ function Gen1(value) {
+ this.value = value;
+ this.generation = 1;
+ }
+ Gen1.name = 1;
+ Gen1.prototype = new Gen2();
+
+ function Gen0(value) {
+ this.value = value;
+ this.generation = 0;
+ }
+ Gen0.name = 0;
+ Gen0.prototype = new Gen1();
+
+
+ function GenA(value) {
+ this.value = value;
+ this.generation = "A";
+ this.toString = new Function ( "return \"(instance of Gen\"+this.generation+\")\"" );
+
+ }
+ GenA.prototype = new Gen0();
+ GenA.name = "A";
+
+ function GenB(value) {
+ this.value = value;
+ this.generation = "B";
+ this.toString = new Function ( "return \"(instance of Gen\"+this.generation+\")\"" );
+ }
+ GenB.name = "B"
+ GenB.prototype = void 0;
+
+ // RelationalExpression is not an object.
+
+ InstanceOf( true, Boolean, false );
+ InstanceOf( new Boolean(false), Boolean, true );
+
+ // Identifier is not a function
+
+ InstanceOf( new Boolean(true), false, false );
+
+ // Identifier is a function, prototype of Identifier is not an object
+
+// InstanceOf( new GenB(), GenB, false );
+
+
+ test(); \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Expressions/instanceof-005-n.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Expressions/instanceof-005-n.js
new file mode 100644
index 0000000..c3a621d
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Expressions/instanceof-005-n.js
@@ -0,0 +1,84 @@
+/**
+ * File Name: instanceof-001.js
+ * ECMA Section: 11.8.6
+ * Description:
+ *
+ * RelationalExpression instanceof Identifier
+ *
+ * Author: christine@netscape.com
+ * Date: 2 September 1998
+ */
+ var SECTION = "instanceof-001";
+ var VERSION = "ECMA_2";
+ var TITLE = "instanceof"
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ function InstanceOf( object_1, object_2, expect ) {
+ result = object_1 instanceof object_2;
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "(" + object_1 + ") instanceof " + object_2,
+ expect,
+ result );
+ }
+
+ function Gen3(value) {
+ this.value = value;
+ this.generation = 3;
+ this.toString = new Function ( "return \"(Gen\"+this.generation+\" instance)\"" );
+ }
+ Gen3.name = 3;
+ Gen3.__proto__.toString = new Function( "return \"(\"+this.name+\" object)\"");
+
+ function Gen2(value) {
+ this.value = value;
+ this.generation = 2;
+ }
+ Gen2.name = 2;
+ Gen2.prototype = new Gen3();
+
+ function Gen1(value) {
+ this.value = value;
+ this.generation = 1;
+ }
+ Gen1.name = 1;
+ Gen1.prototype = new Gen2();
+
+ function Gen0(value) {
+ this.value = value;
+ this.generation = 0;
+ }
+ Gen0.name = 0;
+ Gen0.prototype = new Gen1();
+
+
+ function GenA(value) {
+ this.value = value;
+ this.generation = "A";
+ this.toString = new Function ( "return \"(instance of Gen\"+this.generation+\")\"" );
+
+ }
+ GenA.prototype = new Gen0();
+ GenA.name = "A";
+
+ function GenB(value) {
+ this.value = value;
+ this.generation = "B";
+ this.toString = new Function ( "return \"(instance of Gen\"+this.generation+\")\"" );
+ }
+ GenB.name = "B"
+ GenB.prototype = void 0;
+
+
+ // Identifier is a function, prototype of Identifier is not an object
+
+ InstanceOf( new GenB(), GenB, false );
+
+
+ test(); \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Expressions/instanceof-006.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Expressions/instanceof-006.js
new file mode 100644
index 0000000..f1be0b4
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Expressions/instanceof-006.js
@@ -0,0 +1,83 @@
+/**
+ * File Name: instanceof-001.js
+ * ECMA Section: 11.8.6
+ * Description:
+ *
+ * RelationalExpression instanceof Identifier
+ *
+ * Author: christine@netscape.com
+ * Date: 2 September 1998
+ */
+ var SECTION = "instanceof-001";
+ var VERSION = "ECMA_2";
+ var TITLE = "instanceof"
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ function InstanceOf( object_1, object_2, expect ) {
+ result = object_1 instanceof object_2;
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "(" + object_1 + ") instanceof " + object_2,
+ expect,
+ result );
+ }
+
+ function Gen3(value) {
+ this.value = value;
+ this.generation = 3;
+ this.toString = new Function ( "return \"(Gen\"+this.generation+\" instance)\"" );
+ }
+ Gen3.name = 3;
+ Gen3.__proto__.toString = new Function( "return \"(\"+this.name+\" object)\"");
+
+ function Gen2(value) {
+ this.value = value;
+ this.generation = 2;
+ }
+ Gen2.name = 2;
+ Gen2.prototype = new Gen3();
+
+ function Gen1(value) {
+ this.value = value;
+ this.generation = 1;
+ }
+ Gen1.name = 1;
+ Gen1.prototype = new Gen2();
+
+ function Gen0(value) {
+ this.value = value;
+ this.generation = 0;
+ }
+ Gen0.name = 0;
+ Gen0.prototype = new Gen1();
+
+
+ function GenA(value) {
+ this.value = value;
+ this.generation = "A";
+ this.toString = new Function ( "return \"(instance of Gen\"+this.generation+\")\"" );
+
+ }
+ GenA.prototype = new Gen0();
+ GenA.name = "A";
+
+ function GenB(value) {
+ this.value = value;
+ this.generation = "B";
+ this.toString = new Function ( "return \"(instance of Gen\"+this.generation+\")\"" );
+ }
+ GenB.name = "B"
+ GenB.prototype = void 0;
+
+ // RelationalExpression is not an object.
+
+// InstanceOf( true, Boolean, false );
+ InstanceOf( new Boolean(false), Boolean, true );
+
+ test(); \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/FunctionObjects/apply-001-n.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/FunctionObjects/apply-001-n.js
new file mode 100644
index 0000000..2a2bf40
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/FunctionObjects/apply-001-n.js
@@ -0,0 +1,39 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ * Rob Ginda rginda@netscape.com
+ */
+
+print ("STATUS: f.apply crash test.");
+
+print ("BUGNUMBER: 21836");
+
+function f ()
+{
+}
+
+test ();
+
+function test ()
+{
+ f.apply(2,2);
+}
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/FunctionObjects/call-1.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/FunctionObjects/call-1.js
new file mode 100644
index 0000000..9ea9074
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/FunctionObjects/call-1.js
@@ -0,0 +1,40 @@
+/**
+ File Name: call-1.js
+ Section: Function.prototype.call
+ Description:
+
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "call-1";
+ var VERSION = "ECMA_2";
+ var TITLE = "Function.prototype.call";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+
+ testcases[tc++] = new TestCase( SECTION,
+ "ToString.call( this, this )",
+ GLOBAL,
+ ToString.call( this, this ) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "ToString.call( Boolean, Boolean.prototype )",
+ "false",
+ ToString.call( Boolean, Boolean.prototype ) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "ToString.call( Boolean, Boolean.prototype.valueOf() )",
+ "false",
+ ToString.call( Boolean, Boolean.prototype.valueOf() ) );
+
+ test();
+
+function ToString( obj ) {
+ return obj +"";
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/LexicalConventions/keywords-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/LexicalConventions/keywords-001.js
new file mode 100644
index 0000000..19e930d
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/LexicalConventions/keywords-001.js
@@ -0,0 +1,31 @@
+/**
+ * File Name:
+ * ECMA Section:
+ * Description:
+ *
+ *
+ * Author: christine@netscape.com
+ * Date: 11 August 1998
+ */
+ var SECTION = "";
+ var VERSION = "ECMA_2";
+ var TITLE = "Keywords";
+
+ startTest();
+
+ var result = "failed";
+
+ try {
+ eval("super;");
+ }
+ catch (x) {
+ if (x instanceof SyntaxError)
+ result = x.name;
+ }
+
+ AddTestCase(
+ "using the expression \"super\" shouldn't cause js to crash",
+ "SyntaxError",
+ result );
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/LexicalConventions/regexp-literals-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/LexicalConventions/regexp-literals-001.js
new file mode 100644
index 0000000..6af945b
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/LexicalConventions/regexp-literals-001.js
@@ -0,0 +1,38 @@
+/**
+ * File Name: LexicalConventions/regexp-literals-001.js
+ * ECMA Section: 7.8.5
+ * Description:
+ *
+ *
+ * Author: christine@netscape.com
+ * Date: 11 August 1998
+ */
+ var SECTION = "LexicalConventions/regexp-literals-001.js";
+ var VERSION = "ECMA_2";
+ var TITLE = "Regular Expression Literals";
+
+ startTest();
+
+ // Regular Expression Literals may not be empty; // should be regarded
+ // as a comment, not a RegExp literal.
+
+ s = //;
+
+ "passed";
+
+ AddTestCase(
+ "// should be a comment, not a regular expression literal",
+ "passed",
+ String(s));
+
+ AddTestCase(
+ "// typeof object should be type of object declared on following line",
+ "passed",
+ (typeof s) == "string" ? "passed" : "failed" );
+
+ AddTestCase(
+ "// should not return an object of the type RegExp",
+ "passed",
+ (typeof s == "object") ? "failed" : "passed" );
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/LexicalConventions/regexp-literals-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/LexicalConventions/regexp-literals-002.js
new file mode 100644
index 0000000..c67184b
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/LexicalConventions/regexp-literals-002.js
@@ -0,0 +1,22 @@
+/**
+ * File Name: LexicalConventions/regexp-literals-002.js
+ * ECMA Section: 7.8.5
+ * Description: Based on ECMA 2 Draft 8 October 1999
+ *
+ * Author: christine@netscape.com
+ * Date: 19 February 1999
+ */
+ var SECTION = "LexicalConventions/regexp-literals-002.js";
+ var VERSION = "ECMA_2";
+ var TITLE = "Regular Expression Literals";
+
+ startTest();
+
+ // A regular expression literal represents an object of type RegExp.
+
+ AddTestCase(
+ "// A regular expression literal represents an object of type RegExp.",
+ "true",
+ (/x*/ instanceof RegExp).toString() );
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/constructor-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/constructor-001.js
new file mode 100644
index 0000000..be904e5
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/constructor-001.js
@@ -0,0 +1,66 @@
+/**
+ * File Name: RegExp/constructor-001.js
+ * ECMA Section: 15.7.3.3
+ * Description: Based on ECMA 2 Draft 7 February 1999
+ *
+ * Author: christine@netscape.com
+ * Date: 19 February 1999
+ */
+ var SECTION = "RegExp/constructor-001";
+ var VERSION = "ECMA_2";
+ var TITLE = "new RegExp()";
+
+ startTest();
+
+ /*
+ * for each test case, verify:
+ * - verify that [[Class]] property is RegExp
+ * - prototype property should be set to RegExp.prototype
+ * - source is set to the empty string
+ * - global property is set to false
+ * - ignoreCase property is set to false
+ * - multiline property is set to false
+ * - lastIndex property is set to 0
+ */
+
+ RegExp.prototype.getClassProperty = Object.prototype.toString;
+ var re = new RegExp();
+
+ AddTestCase(
+ "new RegExp().__proto__",
+ RegExp.prototype,
+ re.__proto__
+ );
+
+ AddTestCase(
+ "RegExp.prototype.getClassProperty = Object.prototype.toString; " +
+ "(new RegExp()).getClassProperty()",
+ "[object RegExp]",
+ re.getClassProperty() );
+
+ AddTestCase(
+ "(new RegExp()).source",
+ "",
+ re.source );
+
+ AddTestCase(
+ "(new RegExp()).global",
+ false,
+ re.global );
+
+ AddTestCase(
+ "(new RegExp()).ignoreCase",
+ false,
+ re.ignoreCase );
+
+ AddTestCase(
+ "(new RegExp()).multiline",
+ false,
+ re.multiline );
+
+ AddTestCase(
+ "(new RegExp()).lastIndex",
+ 0,
+ re.lastIndex );
+
+ test()
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/exec-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/exec-001.js
new file mode 100644
index 0000000..69edc11
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/exec-001.js
@@ -0,0 +1,34 @@
+/**
+ * File Name: RegExp/exec-001.js
+ * ECMA Section: 15.7.5.3
+ * Description: Based on ECMA 2 Draft 7 February 1999
+ *
+ * Author: christine@netscape.com
+ * Date: 19 February 1999
+ */
+ var SECTION = "RegExp/exec-001";
+ var VERSION = "ECMA_2";
+ var TITLE = "RegExp.prototype.exec(string)";
+
+ startTest();
+
+ /*
+ * for each test case, verify:
+ * - type of object returned
+ * - length of the returned array
+ * - value of lastIndex
+ * - value of index
+ * - value of input
+ * - value of the array indices
+ */
+
+ // test cases without subpatterns
+ // test cases with subpatterns
+ // global property is true
+ // global property is false
+ // test cases in which the exec returns null
+
+ testcases[0] = { expect:"PASSED", actual:"PASSED", description:"NO TESTS EXIST" };
+
+ test();
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/exec-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/exec-002.js
new file mode 100644
index 0000000..c811b61
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/exec-002.js
@@ -0,0 +1,182 @@
+/**
+ * File Name: RegExp/exec-002.js
+ * ECMA Section: 15.7.5.3
+ * Description: Based on ECMA 2 Draft 7 February 1999
+ *
+ * Test cases provided by rogerl@netscape.com
+ *
+ * Author: christine@netscape.com
+ * Date: 19 February 1999
+ */
+ var SECTION = "RegExp/exec-002";
+ var VERSION = "ECMA_2";
+ var TITLE = "RegExp.prototype.exec(string)";
+
+ startTest();
+
+ /*
+ * for each test case, verify:
+ * - type of object returned
+ * - length of the returned array
+ * - value of lastIndex
+ * - value of index
+ * - value of input
+ * - value of the array indices
+ */
+
+ AddRegExpCases(
+ /(a|d|q|)x/i,
+ "bcaDxqy",
+ 3,
+ ["Dx", "D"] );
+
+ AddRegExpCases(
+ /(a|(e|q))(x|y)/,
+ "bcaddxqy",
+ 6,
+ ["qy","q","q","y"] );
+
+
+ AddRegExpCases(
+ /a+b+d/,
+ "aabbeeaabbs",
+ 0,
+ null );
+
+ AddRegExpCases(
+ /a*b/,
+ "aaadaabaaa",
+ 4,
+ ["aab"] );
+
+ AddRegExpCases(
+ /a*b/,
+ "dddb",
+ 3,
+ ["b"] );
+
+ AddRegExpCases(
+ /a*b/,
+ "xxx",
+ 0,
+ null );
+
+ AddRegExpCases(
+ /x\d\dy/,
+ "abcx45ysss235",
+ 3,
+ ["x45y"] );
+
+ AddRegExpCases(
+ /[^abc]def[abc]+/,
+ "abxdefbb",
+ 2,
+ ["xdefbb"] );
+
+ AddRegExpCases(
+ /(a*)baa/,
+ "ccdaaabaxaabaa",
+ 9,
+ ["aabaa", "aa"] );
+
+ AddRegExpCases(
+ /(a*)baa/,
+ "aabaa",
+ 0,
+ ["aabaa", "aa"] );
+
+ AddRegExpCases(
+ /q(a|b)*q/,
+ "xxqababqyy",
+ 2,
+ ["qababq", "b"] );
+
+ AddRegExpCases(
+ /(a(.|[^d])c)*/,
+ "adcaxc",
+ 0,
+ ["adcaxc", "axc", "x"] );
+
+ AddRegExpCases(
+ /(a*)b\1/,
+ "abaaaxaabaayy",
+ 0,
+ ["aba", "a"] );
+
+ AddRegExpCases(
+ /(a*)b\1/,
+ "abaaaxaabaayy",
+ 0,
+ ["aba", "a"] );
+
+ AddRegExpCases(
+ /(a*)b\1/,
+ "cccdaaabaxaabaayy",
+ 6,
+ ["aba", "a"] );
+
+ AddRegExpCases(
+ /(a*)b\1/,
+ "cccdaaabqxaabaayy",
+ 7,
+ ["b", ""] );
+
+ AddRegExpCases(
+ /"(.|[^"\\\\])*"/,
+ 'xx\"makudonarudo\"yy',
+ 2,
+ ["\"makudonarudo\"", "o"] );
+
+ AddRegExpCases(
+ /"(.|[^"\\\\])*"/,
+ "xx\"ma\"yy",
+ 2,
+ ["\"ma\"", "a"] );
+
+ test();
+
+function AddRegExpCases(
+ regexp, pattern, index, matches_array ) {
+
+ // prevent a runtime error
+
+ if ( regexp.exec(pattern) == null || matches_array == null ) {
+ AddTestCase(
+ regexp + ".exec(" + pattern +")",
+ matches_array,
+ regexp.exec(pattern) );
+
+ return;
+ }
+ AddTestCase(
+ regexp + ".exec(" + pattern +").length",
+ matches_array.length,
+ regexp.exec(pattern).length );
+
+ AddTestCase(
+ regexp + ".exec(" + pattern +").index",
+ index,
+ regexp.exec(pattern).index );
+
+ AddTestCase(
+ regexp + ".exec(" + pattern +").input",
+ pattern,
+ regexp.exec(pattern).input );
+
+ AddTestCase(
+ regexp + ".exec(" + pattern +").toString()",
+ matches_array.toString(),
+ regexp.exec(pattern).toString() );
+/*
+ var limit = matches_array.length > regexp.exec(pattern).length
+ ? matches_array.length
+ : regexp.exec(pattern).length;
+
+ for ( var matches = 0; matches < limit; matches++ ) {
+ AddTestCase(
+ regexp + ".exec(" + pattern +")[" + matches +"]",
+ matches_array[matches],
+ regexp.exec(pattern)[matches] );
+ }
+*/
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/function-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/function-001.js
new file mode 100644
index 0000000..67c4f21
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/function-001.js
@@ -0,0 +1,66 @@
+/**
+ * File Name: RegExp/function-001.js
+ * ECMA Section: 15.7.2.1
+ * Description: Based on ECMA 2 Draft 7 February 1999
+ *
+ * Author: christine@netscape.com
+ * Date: 19 February 1999
+ */
+ var SECTION = "RegExp/function-001";
+ var VERSION = "ECMA_2";
+ var TITLE = "RegExp( pattern, flags )";
+
+ startTest();
+
+ /*
+ * for each test case, verify:
+ * - verify that [[Class]] property is RegExp
+ * - prototype property should be set to RegExp.prototype
+ * - source is set to the empty string
+ * - global property is set to false
+ * - ignoreCase property is set to false
+ * - multiline property is set to false
+ * - lastIndex property is set to 0
+ */
+
+ RegExp.prototype.getClassProperty = Object.prototype.toString;
+ var re = new RegExp();
+
+ AddTestCase(
+ "new RegExp().__proto__",
+ RegExp.prototype,
+ re.__proto__
+ );
+
+ AddTestCase(
+ "RegExp.prototype.getClassProperty = Object.prototype.toString; " +
+ "(new RegExp()).getClassProperty()",
+ "[object RegExp]",
+ re.getClassProperty() );
+
+ AddTestCase(
+ "(new RegExp()).source",
+ "",
+ re.source );
+
+ AddTestCase(
+ "(new RegExp()).global",
+ false,
+ re.global );
+
+ AddTestCase(
+ "(new RegExp()).ignoreCase",
+ false,
+ re.ignoreCase );
+
+ AddTestCase(
+ "(new RegExp()).multiline",
+ false,
+ re.multiline );
+
+ AddTestCase(
+ "(new RegExp()).lastIndex",
+ 0,
+ re.lastIndex );
+
+ test()
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/hex-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/hex-001.js
new file mode 100644
index 0000000..122d59c
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/hex-001.js
@@ -0,0 +1,63 @@
+/**
+ * File Name: RegExp/hex-001.js
+ * ECMA Section: 15.7.3.1
+ * Description: Based on ECMA 2 Draft 7 February 1999
+ * Positive test cases for constructing a RegExp object
+ * Author: christine@netscape.com
+ * Date: 19 February 1999
+ */
+ var SECTION = "RegExp/hex-001";
+ var VERSION = "ECMA_2";
+ var TITLE = "RegExp patterns that contain HexicdecimalEscapeSequences";
+
+ startTest();
+
+ // These examples come from 15.7.1, HexidecimalEscapeSequence
+
+ AddRegExpCases( new RegExp("\x41"), "new RegExp('\\x41')", "A", "A", 1, 0, ["A"] );
+ AddRegExpCases( new RegExp("\x412"),"new RegExp('\\x412')", "A2", "A2", 1, 0, ["A2"] );
+ AddRegExpCases( new RegExp("\x1g"), "new RegExp('\\x1g')", "x1g","x1g", 1, 0, ["x1g"] );
+
+ AddRegExpCases( new RegExp("A"), "new RegExp('A')", "\x41", "\\x41", 1, 0, ["A"] );
+ AddRegExpCases( new RegExp("A"), "new RegExp('A')", "\x412", "\\x412", 1, 0, ["A"] );
+ AddRegExpCases( new RegExp("^x"), "new RegExp('^x')", "x412", "x412", 1, 0, ["x"]);
+ AddRegExpCases( new RegExp("A"), "new RegExp('A')", "A2", "A2", 1, 0, ["A"] );
+
+ test();
+
+function AddRegExpCases(
+ regexp, str_regexp, pattern, str_pattern, length, index, matches_array ) {
+
+ // prevent a runtime error
+
+ if ( regexp.exec(pattern) == null || matches_array == null ) {
+ AddTestCase(
+ str_regexp + ".exec(" + pattern +")",
+ matches_array,
+ regexp.exec(pattern) );
+
+ return;
+ }
+
+ AddTestCase(
+ str_regexp + ".exec(" + str_pattern +").length",
+ length,
+ regexp.exec(pattern).length );
+
+ AddTestCase(
+ str_regexp + ".exec(" + str_pattern +").index",
+ index,
+ regexp.exec(pattern).index );
+
+ AddTestCase(
+ str_regexp + ".exec(" + str_pattern +").input",
+ pattern,
+ regexp.exec(pattern).input );
+
+ for ( var matches = 0; matches < matches_array.length; matches++ ) {
+ AddTestCase(
+ str_regexp + ".exec(" + str_pattern +")[" + matches +"]",
+ matches_array[matches],
+ regexp.exec(pattern)[matches] );
+ }
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/multiline-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/multiline-001.js
new file mode 100644
index 0000000..51a601c
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/multiline-001.js
@@ -0,0 +1,62 @@
+/**
+ * File Name: RegExp/multiline-001.js
+ * ECMA Section:
+ * Description: Based on ECMA 2 Draft 7 February 1999
+ *
+ * Date: 19 February 1999
+ */
+
+ var SECTION = "RegExp/multiline-001";
+ var VERSION = "ECMA_2";
+ var TITLE = "RegExp: multiline flag";
+ var BUGNUMBER="343901";
+
+ startTest();
+
+ var woodpeckers = "ivory-billed\ndowny\nhairy\nacorn\nyellow-bellied sapsucker\n" +
+ "northern flicker\npileated\n";
+
+ AddRegExpCases( /.*[y]$/m, woodpeckers, woodpeckers.indexOf("downy"), ["downy"] );
+
+ AddRegExpCases( /.*[d]$/m, woodpeckers, woodpeckers.indexOf("ivory-billed"), ["ivory-billed"] );
+
+ test();
+
+
+function AddRegExpCases
+ ( regexp, pattern, index, matches_array ) {
+
+ // prevent a runtime error
+
+ if ( regexp.exec(pattern) == null || matches_array == null ) {
+ AddTestCase(
+ regexp + ".exec(" + pattern +")",
+ matches_array,
+ regexp.exec(pattern) );
+
+ return;
+ }
+
+ AddTestCase(
+ regexp.toString() + ".exec(" + pattern +").length",
+ matches_array.length,
+ regexp.exec(pattern).length );
+
+ AddTestCase(
+ regexp.toString() + ".exec(" + pattern +").index",
+ index,
+ regexp.exec(pattern).index );
+
+ AddTestCase(
+ regexp + ".exec(" + pattern +").input",
+ pattern,
+ regexp.exec(pattern).input );
+
+
+ for ( var matches = 0; matches < matches_array.length; matches++ ) {
+ AddTestCase(
+ regexp + ".exec(" + pattern +")[" + matches +"]",
+ matches_array[matches],
+ regexp.exec(pattern)[matches] );
+ }
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/octal-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/octal-001.js
new file mode 100644
index 0000000..d9d0571
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/octal-001.js
@@ -0,0 +1,72 @@
+/**
+ * File Name: RegExp/octal-001.js
+ * ECMA Section: 15.7.1
+ * Description: Based on ECMA 2 Draft 7 February 1999
+ * Simple test cases for matching OctalEscapeSequences.
+ * Author: christine@netscape.com
+ * Date: 19 February 1999
+ */
+ var SECTION = "RegExp/octal-001.js";
+ var VERSION = "ECMA_2";
+ var TITLE = "RegExp patterns that contain OctalEscapeSequences";
+ var BUGNUMBER="http://scopus/bugsplat/show_bug.cgi?id=346196";
+
+ startTest();
+
+
+// backreference
+ AddRegExpCases(
+ /(.)\1/,
+ "/(.)\\1/",
+ "HI!!",
+ "HI!",
+ 2,
+ ["!!", "!"] );
+
+ test();
+
+function AddRegExpCases(
+ regexp, str_regexp, pattern, str_pattern, index, matches_array ) {
+
+ // prevent a runtime error
+
+ if ( regexp.exec(pattern) == null || matches_array == null ) {
+ AddTestCase(
+ regexp + ".exec(" + str_pattern +")",
+ matches_array,
+ regexp.exec(pattern) );
+
+ return;
+ }
+ AddTestCase(
+ str_regexp + ".exec(" + str_pattern +").length",
+ matches_array.length,
+ regexp.exec(pattern).length );
+
+ AddTestCase(
+ str_regexp + ".exec(" + str_pattern +").index",
+ index,
+ regexp.exec(pattern).index );
+
+ AddTestCase(
+ str_regexp + ".exec(" + str_pattern +").input",
+ pattern,
+ regexp.exec(pattern).input );
+
+ AddTestCase(
+ str_regexp + ".exec(" + str_pattern +").toString()",
+ matches_array.toString(),
+ regexp.exec(pattern).toString() );
+/*
+ var limit = matches_array.length > regexp.exec(pattern).length
+ ? matches_array.length
+ : regexp.exec(pattern).length;
+
+ for ( var matches = 0; matches < limit; matches++ ) {
+ AddTestCase(
+ str_regexp + ".exec(" + str_pattern +")[" + matches +"]",
+ matches_array[matches],
+ regexp.exec(pattern)[matches] );
+ }
+*/
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/octal-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/octal-002.js
new file mode 100644
index 0000000..69c8100
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/octal-002.js
@@ -0,0 +1,87 @@
+/**
+ * File Name: RegExp/octal-002.js
+ * ECMA Section: 15.7.1
+ * Description: Based on ECMA 2 Draft 7 February 1999
+ * Simple test cases for matching OctalEscapeSequences.
+ * Author: christine@netscape.com
+ * Date: 19 February 1999
+ */
+ var SECTION = "RegExp/octal-002.js";
+ var VERSION = "ECMA_2";
+ var TITLE = "RegExp patterns that contain OctalEscapeSequences";
+ var BUGNUMBER="http://scopus/bugsplat/show_bug.cgi?id=346189";
+
+ startTest();
+
+// backreference
+ AddRegExpCases(
+ /(.)(.)(.)(.)(.)(.)(.)(.)\8/,
+ "/(.)(.)(.)(.)(.)(.)(.)(.)\\8",
+ "aabbccaaabbbccc",
+ "aabbccaaabbbccc",
+ 0,
+ ["aabbccaaa", "a", "a", "b", "b", "c", "c", "a", "a"] );
+
+ AddRegExpCases(
+ /(.)(.)(.)(.)(.)(.)(.)(.)(.)\9/,
+ "/(.)(.)(.)(.)(.)(.)(.)(.)\\9",
+ "aabbccaabbcc",
+ "aabbccaabbcc",
+ 0,
+ ["aabbccaabb", "a", "a", "b", "b", "c", "c", "a", "a", "b"] );
+
+ AddRegExpCases(
+ /(.)(.)(.)(.)(.)(.)(.)(.)(.)\8/,
+ "/(.)(.)(.)(.)(.)(.)(.)(.)(.)\\8",
+ "aabbccaababcc",
+ "aabbccaababcc",
+ 0,
+ ["aabbccaaba", "a", "a", "b", "b", "c", "c", "a", "a", "b"] );
+
+ test();
+
+function AddRegExpCases(
+ regexp, str_regexp, pattern, str_pattern, index, matches_array ) {
+
+ // prevent a runtime error
+
+ if ( regexp.exec(pattern) == null || matches_array == null ) {
+ AddTestCase(
+ regexp + ".exec(" + str_pattern +")",
+ matches_array,
+ regexp.exec(pattern) );
+
+ return;
+ }
+ AddTestCase(
+ str_regexp + ".exec(" + str_pattern +").length",
+ matches_array.length,
+ regexp.exec(pattern).length );
+
+ AddTestCase(
+ str_regexp + ".exec(" + str_pattern +").index",
+ index,
+ regexp.exec(pattern).index );
+
+ AddTestCase(
+ str_regexp + ".exec(" + str_pattern +").input",
+ pattern,
+ regexp.exec(pattern).input );
+
+ AddTestCase(
+ str_regexp + ".exec(" + str_pattern +").toString()",
+ matches_array.toString(),
+ regexp.exec(pattern).toString() );
+/*
+ var limit = matches_array.length > regexp.exec(pattern).length
+ ? matches_array.length
+ : regexp.exec(pattern).length;
+
+ for ( var matches = 0; matches < limit; matches++ ) {
+ AddTestCase(
+ str_regexp + ".exec(" + str_pattern +")[" + matches +"]",
+ matches_array[matches],
+ regexp.exec(pattern)[matches] );
+ }
+*/
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/octal-003.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/octal-003.js
new file mode 100644
index 0000000..ac6de01
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/octal-003.js
@@ -0,0 +1,81 @@
+/**
+ * File Name: RegExp/octal-003.js
+ * ECMA Section: 15.7.1
+ * Description: Based on ECMA 2 Draft 7 February 1999
+ * Simple test cases for matching OctalEscapeSequences.
+ * Author: christine@netscape.com
+ * Date: 19 February 1999
+ *
+ * Revised: 02 August 2002
+ * Author: pschwartau@netscape.com
+ *
+ * WHY: the original test expected the regexp /.\011/
+ * to match 'a' + String.fromCharCode(0) + '11'
+ *
+ * This is incorrect: the string is a 4-character string consisting of
+ * the characters <'a'>, <nul>, <'1'>, <'1'>. By contrast, the \011 in the
+ * regexp should be parsed as a single token: it is the octal escape sequence
+ * for the horizontal tab character '\t' === '\u0009' === '\x09' === '\011'.
+ *
+ * So the regexp consists of 2 characters: <any-character>, <'\t'>.
+ * There is no match between the regexp and the string.
+ *
+ * See the testcase ecma_3/RegExp/octal-002.js for an elaboration.
+ *
+ */
+ var SECTION = "RegExp/octal-003.js";
+ var VERSION = "ECMA_2";
+ var TITLE = "RegExp patterns that contain OctalEscapeSequences";
+ var BUGNUMBER="http://scopus/bugsplat/show_bug.cgi?id=346132";
+
+ startTest();
+
+ AddRegExpCases( /.\011/, "/\\011/", "a" + String.fromCharCode(0) + "11", "a\\011", 0, null );
+
+ test();
+
+function AddRegExpCases(
+ regexp, str_regexp, pattern, str_pattern, index, matches_array ) {
+
+ // prevent a runtime error
+
+ if ( regexp.exec(pattern) == null || matches_array == null ) {
+ AddTestCase(
+ regexp + ".exec(" + str_pattern +")",
+ matches_array,
+ regexp.exec(pattern) );
+
+ return;
+ }
+ AddTestCase(
+ str_regexp + ".exec(" + str_pattern +").length",
+ matches_array.length,
+ regexp.exec(pattern).length );
+
+ AddTestCase(
+ str_regexp + ".exec(" + str_pattern +").index",
+ index,
+ regexp.exec(pattern).index );
+
+ AddTestCase(
+ str_regexp + ".exec(" + str_pattern +").input",
+ escape(pattern),
+ escape(regexp.exec(pattern).input) );
+
+ AddTestCase(
+ str_regexp + ".exec(" + str_pattern +").toString()",
+ matches_array.toString(),
+ escape(regexp.exec(pattern).toString()) );
+
+ var limit = matches_array.length > regexp.exec(pattern).length
+ ? matches_array.length
+ : regexp.exec(pattern).length;
+
+ for ( var matches = 0; matches < limit; matches++ ) {
+ AddTestCase(
+ str_regexp + ".exec(" + str_pattern +")[" + matches +"]",
+ matches_array[matches],
+ escape(regexp.exec(pattern)[matches]) );
+ }
+
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/properties-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/properties-001.js
new file mode 100644
index 0000000..3eb51cb
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/properties-001.js
@@ -0,0 +1,85 @@
+/**
+ * File Name: RegExp/properties-001.js
+ * ECMA Section: 15.7.6.js
+ * Description: Based on ECMA 2 Draft 7 February 1999
+ *
+ * Author: christine@netscape.com
+ * Date: 19 February 1999
+ */
+ var SECTION = "RegExp/properties-001.js";
+ var VERSION = "ECMA_2";
+ var TITLE = "Properties of RegExp Instances";
+ var BUGNUMBER ="http://scopus/bugsplat/show_bug.cgi?id=346000";
+
+ startTest();
+
+ AddRegExpCases( new RegExp, "", false, false, false, 0 );
+ AddRegExpCases( /.*/, ".*", false, false, false, 0 );
+ AddRegExpCases( /[\d]{5}/g, "[\\d]{5}", true, false, false, 0 );
+ AddRegExpCases( /[\S]?$/i, "[\\S]?$", false, true, false, 0 );
+ AddRegExpCases( /^([a-z]*)[^\w\s\f\n\r]+/m, "^([a-z]*)[^\\w\\s\\f\\n\\r]+", false, false, true, 0 );
+ AddRegExpCases( /[\D]{1,5}[\ -][\d]/gi, "[\\D]{1,5}[\\ -][\\d]", true, true, false, 0 );
+ AddRegExpCases( /[a-zA-Z0-9]*/gm, "[a-zA-Z0-9]*", true, false, true, 0 );
+ AddRegExpCases( /x|y|z/gim, "x|y|z", true, true, true, 0 );
+
+ AddRegExpCases( /\u0051/im, "\\u0051", false, true, true, 0 );
+ AddRegExpCases( /\x45/gm, "\\x45", true, false, true, 0 );
+ AddRegExpCases( /\097/gi, "\\097", true, true, false, 0 );
+
+ test();
+
+function AddRegExpCases( re, s, g, i, m, l ) {
+
+ AddTestCase( re + ".test == RegExp.prototype.test",
+ true,
+ re.test == RegExp.prototype.test );
+
+ AddTestCase( re + ".toString == RegExp.prototype.toString",
+ true,
+ re.toString == RegExp.prototype.toString );
+
+ AddTestCase( re + ".contructor == RegExp.prototype.constructor",
+ true,
+ re.constructor == RegExp.prototype.constructor );
+
+ AddTestCase( re + ".compile == RegExp.prototype.compile",
+ true,
+ re.compile == RegExp.prototype.compile );
+
+ AddTestCase( re + ".exec == RegExp.prototype.exec",
+ true,
+ re.exec == RegExp.prototype.exec );
+
+ // properties
+
+ AddTestCase( re + ".source",
+ s,
+ re.source );
+
+/*
+ * http://bugzilla.mozilla.org/show_bug.cgi?id=225550 changed
+ * the behavior of toString() and toSource() on empty regexps.
+ * So branch if |s| is the empty string -
+ */
+ var S = s? s : '(?:)';
+
+ AddTestCase( re + ".toString()",
+ "/" + S +"/" + (g?"g":"") + (i?"i":"") +(m?"m":""),
+ re.toString() );
+
+ AddTestCase( re + ".global",
+ g,
+ re.global );
+
+ AddTestCase( re + ".ignoreCase",
+ i,
+ re.ignoreCase );
+
+ AddTestCase( re + ".multiline",
+ m,
+ re.multiline);
+
+ AddTestCase( re + ".lastIndex",
+ l,
+ re.lastIndex );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/properties-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/properties-002.js
new file mode 100644
index 0000000..2496d5f
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/properties-002.js
@@ -0,0 +1,125 @@
+/**
+ * File Name: RegExp/properties-002.js
+ * ECMA Section: 15.7.6.js
+ * Description: Based on ECMA 2 Draft 7 February 1999
+ *
+ * Author: christine@netscape.com
+ * Date: 19 February 1999
+ */
+ //-----------------------------------------------------------------------------
+var SECTION = "RegExp/properties-002.js";
+var VERSION = "ECMA_2";
+var TITLE = "Properties of RegExp Instances";
+var BUGNUMBER ="http://scopus/bugsplat/show_bug.cgi?id=346032";
+// ALSO SEE http://bugzilla.mozilla.org/show_bug.cgi?id=124339
+
+
+startTest();
+
+re_1 = /\cA?/g;
+re_1.lastIndex = Math.pow(2,31);
+AddRegExpCases( re_1, "\\cA?", true, false, false, Math.pow(2,31) );
+
+re_2 = /\w*/i;
+re_2.lastIndex = Math.pow(2,32) -1;
+AddRegExpCases( re_2, "\\w*", false, true, false, Math.pow(2,32)-1 );
+
+re_3 = /\*{0,80}/m;
+re_3.lastIndex = Math.pow(2,31) -1;
+AddRegExpCases( re_3, "\\*{0,80}", false, false, true, Math.pow(2,31) -1 );
+
+re_4 = /^./gim;
+re_4.lastIndex = Math.pow(2,30) -1;
+AddRegExpCases( re_4, "^.", true, true, true, Math.pow(2,30) -1 );
+
+re_5 = /\B/;
+re_5.lastIndex = Math.pow(2,30);
+AddRegExpCases( re_5, "\\B", false, false, false, Math.pow(2,30) );
+
+/*
+ * Brendan: "need to test cases Math.pow(2,32) and greater to see
+ * whether they round-trip." Reason: thanks to the work done in
+ * http://bugzilla.mozilla.org/show_bug.cgi?id=124339, lastIndex
+ * is now stored as a double instead of a uint32 (unsigned integer).
+ *
+ * Note 2^32 -1 is the upper bound for uint32's, but doubles can go
+ * all the way up to Number.MAX_VALUE. So that's why we need cases
+ * between those two numbers.
+ *
+ */
+re_6 = /\B/;
+re_6.lastIndex = Math.pow(2,32);
+AddRegExpCases( re_6, "\\B", false, false, false, Math.pow(2,32) );
+
+re_7 = /\B/;
+re_7.lastIndex = Math.pow(2,32) + 1;
+AddRegExpCases( re_7, "\\B", false, false, false, Math.pow(2,32) + 1 );
+
+re_8 = /\B/;
+re_8.lastIndex = Math.pow(2,32) * 2;
+AddRegExpCases( re_8, "\\B", false, false, false, Math.pow(2,32) * 2 );
+
+re_9 = /\B/;
+re_9.lastIndex = Math.pow(2,40);
+AddRegExpCases( re_9, "\\B", false, false, false, Math.pow(2,40) );
+
+re_10 = /\B/;
+re_10.lastIndex = Number.MAX_VALUE;
+AddRegExpCases( re_10, "\\B", false, false, false, Number.MAX_VALUE );
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function AddRegExpCases( re, s, g, i, m, l ){
+
+ AddTestCase( re + ".test == RegExp.prototype.test",
+ true,
+ re.test == RegExp.prototype.test );
+
+ AddTestCase( re + ".toString == RegExp.prototype.toString",
+ true,
+ re.toString == RegExp.prototype.toString );
+
+ AddTestCase( re + ".contructor == RegExp.prototype.constructor",
+ true,
+ re.constructor == RegExp.prototype.constructor );
+
+ AddTestCase( re + ".compile == RegExp.prototype.compile",
+ true,
+ re.compile == RegExp.prototype.compile );
+
+ AddTestCase( re + ".exec == RegExp.prototype.exec",
+ true,
+ re.exec == RegExp.prototype.exec );
+
+ // properties
+
+ AddTestCase( re + ".source",
+ s,
+ re.source );
+
+ AddTestCase( re + ".toString()",
+ "/" + s +"/" + (g?"g":"") + (i?"i":"") +(m?"m":""),
+ re.toString() );
+
+ AddTestCase( re + ".global",
+ g,
+ re.global );
+
+ AddTestCase( re + ".ignoreCase",
+ i,
+ re.ignoreCase );
+
+ AddTestCase( re + ".multiline",
+ m,
+ re.multiline);
+
+ AddTestCase( re + ".lastIndex",
+ l,
+ re.lastIndex );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/regexp-enumerate-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/regexp-enumerate-001.js
new file mode 100644
index 0000000..9752fa1
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/regexp-enumerate-001.js
@@ -0,0 +1,98 @@
+/**
+ File Name: regexp-enumerate-001.js
+ ECMA V2 Section:
+ Description: Regression Test.
+
+ If instance Native Object have properties that are enumerable,
+ JavaScript enumerated through the properties twice. This only
+ happened if objects had been instantiated, but their properties
+ had not been enumerated. ie, the object inherited properties
+ from its prototype that are enumerated.
+
+ In the core JavaScript, this is only a problem with RegExp
+ objects, since the inherited properties of most core JavaScript
+ objects are not enumerated.
+
+ Author: christine@netscape.com, pschwartau@netscape.com
+ Date: 12 November 1997
+ Modified: 14 July 2002
+ Reason: See http://bugzilla.mozilla.org/show_bug.cgi?id=155291
+ ECMA-262 Ed.3 Sections 15.10.7.1 through 15.10.7.5
+ RegExp properties should be DontEnum
+*
+*/
+// onerror = err;
+
+ var SECTION = "regexp-enumerate-001";
+ var VERSION = "ECMA_2";
+ var TITLE = "Regression Test for Enumerating Properties";
+
+ var BUGNUMBER="339403";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ /*
+ * This test expects RegExp instances to have four enumerated properties:
+ * source, global, ignoreCase, and lastIndex
+ *
+ * 99.01.25: now they also have a multiLine instance property.
+ *
+ */
+
+
+ var r = new RegExp();
+
+ var e = new Array();
+
+ var t = new TestRegExp();
+
+ for ( p in r ) { e[e.length] = { property:p, value:r[p] }; t.addProperty( p, r[p]) };
+
+ testcases[testcases.length] = new TestCase( SECTION,
+ "r = new RegExp(); e = new Array(); "+
+ "for ( p in r ) { e[e.length] = { property:p, value:r[p] }; e.length",
+ 0,
+ e.length );
+
+ test();
+
+function TestRegExp() {
+ this.addProperty = addProperty;
+}
+function addProperty(name, value) {
+ var pass = false;
+
+ if ( eval("this."+name) != void 0 ) {
+ pass = true;
+ } else {
+ eval( "this."+ name+" = "+ false );
+ }
+
+ testcases[testcases.length] = new TestCase( SECTION,
+ "Property: " + name +" already enumerated?",
+ false,
+ pass );
+
+ if ( testcases[ testcases.length-1].passed == false ) {
+ testcases[testcases.length-1].reason = "property already enumerated";
+
+ }
+
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/regress-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/regress-001.js
new file mode 100644
index 0000000..afd45fe
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/regress-001.js
@@ -0,0 +1,39 @@
+/**
+ * File Name: RegExp/regress-001.js
+ * ECMA Section: N/A
+ * Description: Regression test case:
+ * JS regexp anchoring on empty match bug
+ * http://bugzilla.mozilla.org/show_bug.cgi?id=2157
+ *
+ * Author: christine@netscape.com
+ * Date: 19 February 1999
+ */
+ var SECTION = "RegExp/hex-001.js";
+ var VERSION = "ECMA_2";
+ var TITLE = "JS regexp anchoring on empty match bug";
+ var BUGNUMBER = "http://bugzilla.mozilla.org/show_bug.cgi?id=2157";
+
+ startTest();
+
+ AddRegExpCases( /a||b/(''),
+ "//a||b/('')",
+ 1,
+ [''] );
+
+ test();
+
+function AddRegExpCases( regexp, str_regexp, length, matches_array ) {
+
+ AddTestCase(
+ "( " + str_regexp + " ).length",
+ regexp.length,
+ regexp.length );
+
+
+ for ( var matches = 0; matches < matches_array.length; matches++ ) {
+ AddTestCase(
+ "( " + str_regexp + " )[" + matches +"]",
+ matches_array[matches],
+ regexp[matches] );
+ }
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/unicode-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/unicode-001.js
new file mode 100644
index 0000000..17d0582
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/RegExp/unicode-001.js
@@ -0,0 +1,53 @@
+/**
+ * File Name: RegExp/unicode-001.js
+ * ECMA Section: 15.7.3.1
+ * Description: Based on ECMA 2 Draft 7 February 1999
+ * Positive test cases for constructing a RegExp object
+ * Author: christine@netscape.com
+ * Date: 19 February 1999
+ */
+ var SECTION = "RegExp/unicode-001.js";
+ var VERSION = "ECMA_2";
+ var TITLE = "new RegExp( pattern, flags )";
+
+ startTest();
+
+ // These examples come from 15.7.1, UnicodeEscapeSequence
+
+ AddRegExpCases( /\u0041/, "/\\u0041/", "A", "A", 1, 0, ["A"] );
+ AddRegExpCases( /\u00412/, "/\\u00412/", "A2", "A2", 1, 0, ["A2"] );
+ AddRegExpCases( /\u00412/, "/\\u00412/", "A2", "A2", 1, 0, ["A2"] );
+ AddRegExpCases( /\u001g/, "/\\u001g/", "u001g", "u001g", 1, 0, ["u001g"] );
+
+ AddRegExpCases( /A/, "/A/", "\u0041", "\\u0041", 1, 0, ["A"] );
+ AddRegExpCases( /A/, "/A/", "\u00412", "\\u00412", 1, 0, ["A"] );
+ AddRegExpCases( /A2/, "/A2/", "\u00412", "\\u00412", 1, 0, ["A2"]);
+ AddRegExpCases( /A/, "/A/", "A2", "A2", 1, 0, ["A"] );
+
+ test();
+
+function AddRegExpCases(
+ regexp, str_regexp, pattern, str_pattern, length, index, matches_array ) {
+
+ AddTestCase(
+ str_regexp + " .exec(" + str_pattern +").length",
+ length,
+ regexp.exec(pattern).length );
+
+ AddTestCase(
+ str_regexp + " .exec(" + str_pattern +").index",
+ index,
+ regexp.exec(pattern).index );
+
+ AddTestCase(
+ str_regexp + " .exec(" + str_pattern +").input",
+ pattern,
+ regexp.exec(pattern).input );
+
+ for ( var matches = 0; matches < matches_array.length; matches++ ) {
+ AddTestCase(
+ str_regexp + " .exec(" + str_pattern +")[" + matches +"]",
+ matches_array[matches],
+ regexp.exec(pattern)[matches] );
+ }
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/dowhile-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/dowhile-001.js
new file mode 100644
index 0000000..ffd5300
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/dowhile-001.js
@@ -0,0 +1,41 @@
+/**
+ * File Name: dowhile-001
+ * ECMA Section:
+ * Description: do...while statements
+ *
+ *
+ *
+ * Author: christine@netscape.com
+ * Date: 11 August 1998
+ */
+ var SECTION = "dowhile-002";
+ var VERSION = "ECMA_2";
+ var TITLE = "do...while with a labeled continue statement";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ LabeledContinue( 0, 1 );
+ LabeledContinue( 1, 1 );
+ LabeledContinue( -1, 1 );
+ LabeledContinue( 5, 5 );
+
+ test();
+
+function LabeledContinue( limit, expect ) {
+ i = 0;
+ woohoo:
+ do {
+ i++;
+ continue woohoo;
+ } while ( i < limit );
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "do while ( " + i +" < " + limit +" )",
+ expect,
+ i );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/dowhile-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/dowhile-002.js
new file mode 100644
index 0000000..e921b49
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/dowhile-002.js
@@ -0,0 +1,68 @@
+/**
+ * File Name: dowhile-002
+ * ECMA Section:
+ * Description: do...while statements
+ *
+ * Verify that code after a labeled break is not executed. Verify that
+ * a labeled break breaks you out of the whole labeled block, and not
+ * just the current iteration statement.
+ *
+ * Author: christine@netscape.com
+ * Date: 11 August 1998
+ */
+ var SECTION = "dowhile-002";
+ var VERSION = "ECMA_2";
+ var TITLE = "do...while with a labeled continue statement";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ LabeledContinue( 0, 1 );
+ LabeledContinue( 1, 1 );
+ LabeledContinue( -1, 1 );
+ LabeledContinue( 5, 5 );
+
+ test();
+
+// The labeled statment contains statements after the labeled break.
+// Verify that the statements after the break are not executed.
+
+function LabeledContinue( limit, expect ) {
+ i = 0;
+ result1 = "pass";
+ result2 = "pass";
+
+ woohoo: {
+ do {
+ i++;
+ if ( ! (i < limit) ) {
+ break woohoo;
+ result1 = "fail: evaluated statement after a labeled break";
+ }
+ } while ( true );
+
+ result2 = "failed: broke out of loop, but not out of labeled block";
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "do while ( " + i +" < " + limit +" )",
+ expect,
+ i );
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "breaking out of a do... while loop",
+ "pass",
+ result1 );
+
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "breaking out of a labeled do...while loop",
+ "pass",
+ result2 );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/dowhile-003.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/dowhile-003.js
new file mode 100644
index 0000000..a1ca517
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/dowhile-003.js
@@ -0,0 +1,60 @@
+/**
+ * File Name: dowhile-003
+ * ECMA Section:
+ * Description: do...while statements
+ *
+ * Test do while, when the while expression is a JavaScript Number object.
+ *
+ *
+ * Author: christine@netscape.com
+ * Date: 11 August 1998
+ */
+ var SECTION = "dowhile-003";
+ var VERSION = "ECMA_2";
+ var TITLE = "do...while with a labeled continue statement";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ DoWhile( new DoWhileObject( 1, 1, 0 ));
+ DoWhile( new DoWhileObject( 1000, 1000, 0 ));
+ DoWhile( new DoWhileObject( 1001, 1001, 0 ));
+ DoWhile( new DoWhileObject( 1002, 1001, 1 ));
+ DoWhile( new DoWhileObject( -1, 1001, -1002 ));
+
+ test();
+
+function DoWhileObject( value, iterations, endvalue ) {
+ this.value = value;
+ this.iterations = iterations;
+ this.endvalue = endvalue;
+}
+
+function DoWhile( object ) {
+ var i = 0;
+
+ do {
+ object.value = --object.value;
+ i++;
+ if ( i > 1000 )
+ break;
+ } while( object.value );
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "loop iterations",
+ object.iterations,
+ i
+ );
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "object.value",
+ object.endvalue,
+ Number( object.value )
+ );
+
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/dowhile-004.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/dowhile-004.js
new file mode 100644
index 0000000..3c96fc4
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/dowhile-004.js
@@ -0,0 +1,64 @@
+/**
+ * File Name: dowhile-004
+ * ECMA Section:
+ * Description: do...while statements
+ *
+ * Test a labeled do...while. Break out of the loop with no label
+ * should break out of the loop, but not out of the label.
+ *
+ * Author: christine@netscape.com
+ * Date: 11 August 1998
+ */
+ var SECTION = "dowhile-004";
+ var VERSION = "ECMA_2";
+ var TITLE = "do...while with a labeled continue statement";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ DoWhile( 0, 1 );
+ DoWhile( 1, 1 );
+ DoWhile( -1, 1 );
+ DoWhile( 5, 5 );
+
+ test();
+
+function DoWhile( limit, expect ) {
+ i = 0;
+ result1 = "pass";
+ result2 = "failed: broke out of labeled statement unexpectedly";
+
+ foo: {
+ do {
+ i++;
+ if ( ! (i < limit) ) {
+ break;
+ result1 = "fail: evaluated statement after a labeled break";
+ }
+ } while ( true );
+
+ result2 = "pass";
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "do while ( " + i +" < " + limit +" )",
+ expect,
+ i );
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "breaking out of a do... while loop",
+ "pass",
+ result1 );
+
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "breaking out of a labeled do...while loop",
+ "pass",
+ result2 );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/dowhile-005.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/dowhile-005.js
new file mode 100644
index 0000000..ce56cb9
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/dowhile-005.js
@@ -0,0 +1,70 @@
+/**
+ * File Name: dowhile-005
+ * ECMA Section:
+ * Description: do...while statements
+ *
+ * Test a labeled do...while. Break out of the loop with no label
+ * should break out of the loop, but not out of the label.
+ *
+ * Currently causes an infinite loop in the monkey. Uncomment the
+ * print statement below and it works OK.
+ *
+ * Author: christine@netscape.com
+ * Date: 26 August 1998
+ */
+ var SECTION = "dowhile-005";
+ var VERSION = "ECMA_2";
+ var TITLE = "do...while with a labeled continue statement";
+ var BUGNUMBER = "316293";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ NestedLabel();
+
+
+ test();
+
+ function NestedLabel() {
+ i = 0;
+ result1 = "pass";
+ result2 = "fail: did not hit code after inner loop";
+ result3 = "pass";
+
+ outer: {
+ do {
+ inner: {
+// print( i );
+ break inner;
+ result1 = "fail: did break out of inner label";
+ }
+ result2 = "pass";
+ break outer;
+ print (i);
+ } while ( i++ < 100 );
+
+ }
+
+ result3 = "fail: did not break out of outer label";
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "number of loop iterations",
+ 0,
+ i );
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "break out of inner loop",
+ "pass",
+ result1 );
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "break out of outer loop",
+ "pass",
+ result2 );
+ } \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/dowhile-006.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/dowhile-006.js
new file mode 100644
index 0000000..67dce64
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/dowhile-006.js
@@ -0,0 +1,86 @@
+/**
+ * File Name: dowhile-006
+ * ECMA Section:
+ * Description: do...while statements
+ *
+ * A general do...while test.
+ *
+ * Author: christine@netscape.com
+ * Date: 26 August 1998
+ */
+ var SECTION = "dowhile-006";
+ var VERSION = "ECMA_2";
+ var TITLE = "do...while";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ DoWhile( new DoWhileObject( false, false, 10 ) );
+ DoWhile( new DoWhileObject( true, false, 2 ) );
+ DoWhile( new DoWhileObject( false, true, 3 ) );
+ DoWhile( new DoWhileObject( true, true, 4 ) );
+
+ test();
+
+function looping( object ) {
+ object.iterations--;
+
+ if ( object.iterations <= 0 ) {
+ return false;
+ } else {
+ return true;
+ }
+}
+function DoWhileObject( breakOut, breakIn, iterations, loops ) {
+ this.iterations = iterations;
+ this.loops = loops;
+ this.breakOut = breakOut;
+ this.breakIn = breakIn;
+ this.looping = looping;
+}
+function DoWhile( object ) {
+ var result1 = false;
+ var result2 = false;
+
+ outie: {
+ innie: {
+ do {
+ if ( object.breakOut )
+ break outie;
+
+ if ( object.breakIn )
+ break innie;
+
+ } while ( looping(object) );
+
+ // statements should be executed if:
+ // do...while exits normally
+ // do...while exits abruptly with no label
+
+ result1 = true;
+
+ }
+
+ // statements should be executed if:
+ // do...while breaks out with label "innie"
+ // do...while exits normally
+ // do...while does not break out with "outie"
+
+ result2 = true;
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "hit code after loop in inner loop",
+ ( object.breakIn || object.breakOut ) ? false : true ,
+ result1 );
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "hit code after loop in outer loop",
+ ( object.breakOut ) ? false : true,
+ result2 );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/dowhile-007.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/dowhile-007.js
new file mode 100644
index 0000000..849e70e
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/dowhile-007.js
@@ -0,0 +1,94 @@
+/**
+ * File Name: dowhile-007
+ * ECMA Section:
+ * Description: do...while statements
+ *
+ * A general do...while test.
+ *
+ * Author: christine@netscape.com
+ * Date: 26 August 1998
+ */
+ var SECTION = "dowhile-007";
+ var VERSION = "ECMA_2";
+ var TITLE = "do...while";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ DoWhile( new DoWhileObject( false, false, false, false ));
+ DoWhile( new DoWhileObject( true, false, false, false ));
+ DoWhile( new DoWhileObject( true, true, false, false ));
+ DoWhile( new DoWhileObject( true, true, true, false ));
+ DoWhile( new DoWhileObject( true, true, true, true ));
+ DoWhile( new DoWhileObject( false, false, false, true ));
+ DoWhile( new DoWhileObject( false, false, true, true ));
+ DoWhile( new DoWhileObject( false, true, true, true ));
+ DoWhile( new DoWhileObject( false, false, true, false ));
+
+ test();
+
+function DoWhileObject( out1, out2, out3, in1 ) {
+ this.breakOutOne = out1;
+ this.breakOutTwo = out2;
+ this.breakOutThree = out3;
+ this.breakIn = in1;
+}
+function DoWhile( object ) {
+ result1 = false;
+ result2 = false;
+ result3 = false;
+ result4 = false;
+
+ outie:
+ do {
+ if ( object.breakOutOne ) {
+ break outie;
+ }
+ result1 = true;
+
+ innie:
+ do {
+ if ( object.breakOutTwo ) {
+ break outie;
+ }
+ result2 = true;
+
+ if ( object.breakIn ) {
+ break innie;
+ }
+ result3 = true;
+
+ } while ( false );
+ if ( object.breakOutThree ) {
+ break outie;
+ }
+ result4 = true;
+ } while ( false );
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "break one: ",
+ (object.breakOutOne) ? false : true,
+ result1 );
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "break two: ",
+ (object.breakOutOne||object.breakOutTwo) ? false : true,
+ result2 );
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "break three: ",
+ (object.breakOutOne||object.breakOutTwo||object.breakIn) ? false : true,
+ result3 );
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "break four: ",
+ (object.breakOutOne||object.breakOutTwo||object.breakOutThree) ? false: true,
+ result4 );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/forin-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/forin-001.js
new file mode 100644
index 0000000..63119af
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/forin-001.js
@@ -0,0 +1,294 @@
+/**
+ * File Name: forin-001.js
+ * ECMA Section:
+ * Description: The forin-001 statement
+ *
+ * Verify that the property name is assigned to the property on the left
+ * hand side of the for...in expression.
+ *
+ * Author: christine@netscape.com
+ * Date: 28 August 1998
+ */
+ var SECTION = "forin-001";
+ var VERSION = "ECMA_2";
+ var TITLE = "The for...in statement";
+ var BUGNUMBER="330890";
+ var BUGNUMBER="http://scopus.mcom.com/bugsplat/show_bug.cgi?id=344855";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ ForIn_1( { length:4, company:"netscape", year:2000, 0:"zero" } );
+ ForIn_2( { length:4, company:"netscape", year:2000, 0:"zero" } );
+ ForIn_3( { length:4, company:"netscape", year:2000, 0:"zero" } );
+
+// ForIn_6({ length:4, company:"netscape", year:2000, 0:"zero" });
+// ForIn_7({ length:4, company:"netscape", year:2000, 0:"zero" });
+ ForIn_8({ length:4, company:"netscape", year:2000, 0:"zero" });
+
+ test();
+
+ /**
+ * Verify that the left side argument is evaluated with every iteration.
+ * Verify that the name of each property of the object is assigned to a
+ * a property.
+ *
+ */
+ function ForIn_1( object ) {
+ PropertyArray = new Array();
+ ValueArray = new Array();
+
+ for ( PropertyArray[PropertyArray.length] in object ) {
+ ValueArray[ValueArray.length] =
+ object[PropertyArray[PropertyArray.length-1]];
+ }
+
+ for ( var i = 0; i < PropertyArray.length; i++ ) {
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "object[" + PropertyArray[i] +"]",
+ object[PropertyArray[i]],
+ ValueArray[i]
+ );
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "object.length",
+ PropertyArray.length,
+ object.length );
+ }
+
+ /**
+ * Similar to ForIn_1, except it should increment the counter variable
+ * every time the left hand expression is evaluated.
+ */
+ function ForIn_2( object ) {
+ PropertyArray = new Array();
+ ValueArray = new Array();
+ var i = 0;
+
+ for ( PropertyArray[i++] in object ) {
+ ValueArray[ValueArray.length] =
+ object[PropertyArray[PropertyArray.length-1]];
+ }
+
+ for ( i = 0; i < PropertyArray.length; i++ ) {
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "object[" + PropertyArray[i] +"]",
+ object[PropertyArray[i]],
+ ValueArray[i]
+ );
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "object.length",
+ PropertyArray.length,
+ object.length );
+ }
+
+ /**
+ * Break out of a for...in loop
+ *
+ *
+ */
+ function ForIn_3( object ) {
+ var checkBreak = "pass";
+ var properties = new Array();
+ var values = new Array();
+
+ for ( properties[properties.length] in object ) {
+ values[values.length] = object[properties[properties.length-1]];
+ break;
+ checkBreak = "fail";
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "check break out of for...in",
+ "pass",
+ checkBreak );
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "properties.length",
+ 1,
+ properties.length );
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "object["+properties[0]+"]",
+ values[0],
+ object[properties[0]] );
+ }
+
+ /**
+ * Break out of a labeled for...in loop.
+ */
+ function ForIn_4( object ) {
+ var result1 = 0;
+ var result2 = 0;
+ var result3 = 0;
+ var result4 = 0;
+ var i = 0;
+ var property = new Array();
+
+ butterbean: {
+ result1++;
+
+ for ( property[i++] in object ) {
+ result2++;
+ break;
+ result4++;
+ }
+ result3++;
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "verify labeled statement is only executed once",
+ true,
+ result1 == 1 );
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "verify statements in for loop are evaluated",
+ true,
+ result2 == i );
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "verify break out of labeled for...in loop",
+ true,
+ result4 == 0 );
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "verify break out of labeled block",
+ true,
+ result3 == 0 );
+ }
+
+ /**
+ * Labeled break out of a labeled for...in loop.
+ */
+ function ForIn_5 (object) {
+ var result1 = 0;
+ var result2 = 0;
+ var result3 = 0;
+ var result4 = 0;
+ var i = 0;
+ var property = new Array();
+
+ bigredbird: {
+ result1++;
+ for ( property[i++] in object ) {
+ result2++;
+ break bigredbird;
+ result4++;
+ }
+ result3++;
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "verify labeled statement is only executed once",
+ true,
+ result1 == 1 );
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "verify statements in for loop are evaluated",
+ true,
+ result2 == i );
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "verify break out of labeled for...in loop",
+ true,
+ result4 == 0 );
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "verify break out of labeled block",
+ true,
+ result3 == 0 );
+ }
+
+ /**
+ * Labeled continue from a labeled for...in loop
+ */
+ function ForIn_7( object ) {
+ var result1 = 0;
+ var result2 = 0;
+ var result3 = 0;
+ var result4 = 0;
+ var i = 0;
+ var property = new Array();
+
+ bigredbird:
+ for ( property[i++] in object ) {
+ result2++;
+ continue bigredbird;
+ result4++;
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "verify statements in for loop are evaluated",
+ true,
+ result2 == i );
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "verify break out of labeled for...in loop",
+ true,
+ result4 == 0 );
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "verify break out of labeled block",
+ true,
+ result3 == 1 );
+ }
+
+
+ /**
+ * continue in a for...in loop
+ *
+ */
+ function ForIn_8( object ) {
+ var checkBreak = "pass";
+ var properties = new Array();
+ var values = new Array();
+
+ for ( properties[properties.length] in object ) {
+ values[values.length] = object[properties[properties.length-1]];
+ break;
+ checkBreak = "fail";
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "check break out of for...in",
+ "pass",
+ checkBreak );
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "properties.length",
+ 1,
+ properties.length );
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "object["+properties[0]+"]",
+ values[0],
+ object[properties[0]] );
+ }
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/forin-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/forin-002.js
new file mode 100644
index 0000000..1f527a9
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/forin-002.js
@@ -0,0 +1,73 @@
+/**
+ * File Name: forin-002.js
+ * ECMA Section:
+ * Description: The forin-001 statement
+ *
+ * Verify that the property name is assigned to the property on the left
+ * hand side of the for...in expression.
+ *
+ * Author: christine@netscape.com
+ * Date: 28 August 1998
+ */
+ var SECTION = "forin-002";
+ var VERSION = "ECMA_2";
+ var TITLE = "The for...in statement";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ function MyObject( value ) {
+ this.value = value;
+ this.valueOf = new Function ( "return this.value" );
+ this.toString = new Function ( "return this.value + \"\"" );
+ this.toNumber = new Function ( "return this.value + 0" );
+ this.toBoolean = new Function ( "return Boolean( this.value )" );
+ }
+
+ ForIn_1(this);
+ ForIn_2(this);
+
+ ForIn_1(new MyObject(true));
+ ForIn_2(new MyObject(new Boolean(true)));
+
+ ForIn_2(3);
+
+ test();
+
+ /**
+ * For ... In in a With Block
+ *
+ */
+ function ForIn_1( object) {
+ with ( object ) {
+ for ( property in object ) {
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "with loop in a for...in loop. ("+object+")["+property +"] == "+
+ "eval ( " + property +" )",
+ true,
+ object[property] == eval(property) );
+ }
+ }
+ }
+
+ /**
+ * With block in a For...In loop
+ *
+ */
+ function ForIn_2(object) {
+ for ( property in object ) {
+ with ( object ) {
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "with loop in a for...in loop. ("+object+")["+property +"] == "+
+ "eval ( " + property +" )",
+ true,
+ object[property] == eval(property) );
+ }
+ }
+ }
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/if-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/if-001.js
new file mode 100644
index 0000000..0da212d
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/if-001.js
@@ -0,0 +1,39 @@
+/**
+ * File Name: if-001.js
+ * ECMA Section:
+ * Description: The if statement
+ *
+ * Verify that assignment in the if expression is evaluated correctly.
+ * Verifies the fix for bug http://scopus/bugsplat/show_bug.cgi?id=148822.
+ *
+ * Author: christine@netscape.com
+ * Date: 28 August 1998
+ */
+ var SECTION = "for-001";
+ var VERSION = "ECMA_2";
+ var TITLE = "The if statement";
+ var BUGNUMBER="148822";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var a = 0;
+ var b = 0;
+ var result = "passed";
+
+ if ( a = b ) {
+ result = "failed: a = b should return 0";
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "if ( a = b ), where a and b are both equal to 0",
+ "passed",
+ result );
+
+
+ test();
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/label-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/label-001.js
new file mode 100644
index 0000000..83b51ce
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/label-001.js
@@ -0,0 +1,39 @@
+/**
+ * File Name: label-001.js
+ * ECMA Section:
+ * Description: Labeled statements
+ *
+ * Labeled break and continue within a for loop.
+ *
+ *
+ * Author: christine@netscape.com
+ * Date: 11 August 1998
+ */
+ var SECTION = "label-003";
+ var VERSION = "ECMA_2";
+ var TITLE = "Labeled statements";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ LabelTest(0, 0);
+ LabelTest(1, 1)
+ LabelTest(-1, 1000);
+ LabelTest(false, 0);
+ LabelTest(true, 1);
+
+ test();
+
+ function LabelTest( limit, expect) {
+ woo: for ( var result = 0; result < 1000; result++ ) { if (result == limit) { break woo; } else { continue woo; } };
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "break out of a labeled for loop: "+ limit,
+ expect,
+ result );
+ }
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/label-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/label-002.js
new file mode 100644
index 0000000..64b01a8
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/label-002.js
@@ -0,0 +1,53 @@
+/**
+ * File Name: label-002.js
+ * ECMA Section:
+ * Description: Labeled statements
+ *
+ * Labeled break and continue within a for-in loop.
+ *
+ *
+ * Author: christine@netscape.com
+ * Date: 11 August 1998
+ */
+ var SECTION = "label-002";
+ var VERSION = "ECMA_2";
+ var TITLE = "Labeled statements";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ LabelTest( { p1:"hi,", p2:" norris" }, "hi, norris", " norrishi," );
+ LabelTest( { 0:"zero", 1:"one" }, "zeroone", "onezero" );
+
+ LabelTest2( { p1:"hi,", p2:" norris" }, "hi,", " norris" );
+ LabelTest2( { 0:"zero", 1:"one" }, "zero", "one" );
+
+ test();
+
+ function LabelTest( object, expect1, expect2 ) {
+ result = "";
+
+ yoohoo: { for ( property in object ) { result += object[property]; }; break yoohoo };
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "yoohoo: for ( property in object ) { result += object[property]; } break yoohoo }",
+ true,
+ result == expect1 || result == expect2 );
+ }
+
+ function LabelTest2( object, expect1, expect2 ) {
+ result = "";
+
+ yoohoo: { for ( property in object ) { result += object[property]; break yoohoo } }; ;
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "yoohoo: for ( property in object ) { result += object[property]; break yoohoo }}",
+ true,
+ result == expect1 || result == expect2 );
+ }
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/switch-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/switch-001.js
new file mode 100644
index 0000000..6336518
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/switch-001.js
@@ -0,0 +1,64 @@
+/**
+ * File Name: switch-001.js
+ * ECMA Section:
+ * Description: The switch Statement
+ *
+ * A simple switch test with no abrupt completions.
+ *
+ * Author: christine@netscape.com
+ * Date: 11 August 1998
+ *
+ */
+ var SECTION = "switch-001";
+ var VERSION = "ECMA_2";
+ var TITLE = "The switch statement";
+
+ var BUGNUMBER="315767";
+
+
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ SwitchTest( 0, 126 );
+ SwitchTest( 1, 124 );
+ SwitchTest( 2, 120 );
+ SwitchTest( 3, 112 );
+ SwitchTest( 4, 64 );
+ SwitchTest( 5, 96 );
+ SwitchTest( true, 96 );
+ SwitchTest( false, 96 );
+ SwitchTest( null, 96 );
+ SwitchTest( void 0, 96 );
+ SwitchTest( "0", 96 );
+
+ test();
+
+ function SwitchTest( input, expect ) {
+ var result = 0;
+
+ switch ( input ) {
+ case 0:
+ result += 2;
+ case 1:
+ result += 4;
+ case 2:
+ result += 8;
+ case 3:
+ result += 16;
+ default:
+ result += 32;
+ case 4:
+ result +=64;
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "switch with no breaks, case expressions are numbers. input is "+
+ input,
+ expect,
+ result );
+ }
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/switch-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/switch-002.js
new file mode 100644
index 0000000..20746a8
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/switch-002.js
@@ -0,0 +1,60 @@
+/**
+ * File Name: switch-002.js
+ * ECMA Section:
+ * Description: The switch Statement
+ *
+ * A simple switch test with no abrupt completions.
+ *
+ * Author: christine@netscape.com
+ * Date: 11 August 1998
+ *
+ */
+ var SECTION = "switch-002";
+ var VERSION = "ECMA_2";
+ var TITLE = "The switch statement";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ SwitchTest( 0, 6 );
+ SwitchTest( 1, 4 );
+ SwitchTest( 2, 56 );
+ SwitchTest( 3, 48 );
+ SwitchTest( 4, 64 );
+ SwitchTest( true, 32 );
+ SwitchTest( false, 32 );
+ SwitchTest( null, 32 );
+ SwitchTest( void 0, 32 );
+ SwitchTest( "0", 32 );
+
+ test();
+
+ function SwitchTest( input, expect ) {
+ var result = 0;
+
+ switch ( input ) {
+ case 0:
+ result += 2;
+ case 1:
+ result += 4;
+ break;
+ case 2:
+ result += 8;
+ case 3:
+ result += 16;
+ default:
+ result += 32;
+ break;
+ case 4:
+ result += 64;
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "switch with no breaks: input is " + input,
+ expect,
+ result );
+ }
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/switch-003.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/switch-003.js
new file mode 100644
index 0000000..6a1389c
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/switch-003.js
@@ -0,0 +1,54 @@
+/**
+ * File Name: switch-003.js
+ * ECMA Section:
+ * Description: The switch Statement
+ *
+ * Attempt to verify that case statements are evaluated in source order
+ *
+ * Author: christine@netscape.com
+ * Date: 11 August 1998
+ *
+ */
+ var SECTION = "switch-003";
+ var VERSION = "ECMA_2";
+ var TITLE = "The switch statement";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ SwitchTest( "a", "abc" );
+ SwitchTest( "b", "bc" );
+ SwitchTest( "c", "c" );
+ SwitchTest( "d", "*abc" );
+ SwitchTest( "v", "*abc" );
+ SwitchTest( "w", "w*abc" );
+ SwitchTest( "x", "xw*abc" );
+ SwitchTest( "y", "yxw*abc" );
+ SwitchTest( "z", "zyxw*abc" );
+// SwitchTest( new java.lang.String("z"), "*abc" );
+
+ test();
+
+ function SwitchTest( input, expect ) {
+ var result = "";
+
+ switch ( input ) {
+ case "z": result += "z";
+ case "y": result += "y";
+ case "x": result += "x";
+ case "w": result += "w";
+ default: result += "*";
+ case "a": result += "a";
+ case "b": result += "b";
+ case "c": result += "c";
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "switch with no breaks: input is " + input,
+ expect,
+ result );
+ } \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/switch-004.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/switch-004.js
new file mode 100644
index 0000000..23da926
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/switch-004.js
@@ -0,0 +1,91 @@
+/**
+ * File Name: switch-003.js
+ * ECMA Section:
+ * Description: The switch Statement
+ *
+ * This uses variables and objects as case expressions in switch statements.
+ * This verifies a bunch of bugs:
+ *
+ * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=315988
+ * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=315975
+ * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=315954
+ *
+ * Author: christine@netscape.com
+ * Date: 11 August 1998
+ *
+ */
+ var SECTION = "switch-003";
+ var VERSION = "ECMA_2";
+ var TITLE = "The switch statement";
+ var BUGNUMBER= "315988";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ ONE = new Number(1);
+ ZERO = new Number(0);
+ var A = new String("A");
+ var B = new String("B");
+ TRUE = new Boolean( true );
+ FALSE = new Boolean( false );
+ UNDEFINED = void 0;
+ NULL = null;
+
+ SwitchTest( ZERO, "ZERO" );
+ SwitchTest( NULL, "NULL" );
+ SwitchTest( UNDEFINED, "UNDEFINED" );
+ SwitchTest( FALSE, "FALSE" );
+ SwitchTest( false, "false" );
+ SwitchTest( 0, "0" );
+
+ SwitchTest ( TRUE, "TRUE" );
+ SwitchTest( 1, "1" );
+ SwitchTest( ONE, "ONE" );
+ SwitchTest( true, "true" );
+
+ SwitchTest( "a", "a" );
+ SwitchTest( A, "A" );
+ SwitchTest( "b", "b" );
+ SwitchTest( B, "B" );
+
+ SwitchTest( new Boolean( true ), "default" );
+ SwitchTest( new Boolean(false ), "default" );
+ SwitchTest( new String( "A" ), "default" );
+ SwitchTest( new Number( 0 ), "default" );
+
+ test();
+
+ function SwitchTest( input, expect ) {
+ var result = "";
+
+ switch ( input ) {
+ default: result += "default"; break;
+ case "a": result += "a"; break;
+ case "b": result += "b"; break;
+ case A: result += "A"; break;
+ case B: result += "B"; break;
+ case new Boolean(true): result += "new TRUE"; break;
+ case new Boolean(false): result += "new FALSE"; break;
+ case NULL: result += "NULL"; break;
+ case UNDEFINED: result += "UNDEFINED"; break;
+ case true: result += "true"; break;
+ case false: result += "false"; break;
+ case TRUE: result += "TRUE"; break;
+ case FALSE: result += "FALSE"; break;
+ case 0: result += "0"; break;
+ case 1: result += "1"; break;
+ case new Number(0) : result += "new ZERO"; break;
+ case new Number(1) : result += "new ONE"; break;
+ case ONE: result += "ONE"; break;
+ case ZERO: result += "ZERO"; break;
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "switch with no breaks: input is " + input,
+ expect,
+ result );
+ }
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/try-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/try-001.js
new file mode 100644
index 0000000..bcd0eac
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/try-001.js
@@ -0,0 +1,82 @@
+/**
+ * File Name: try-001.js
+ * ECMA Section:
+ * Description: The try statement
+ *
+ * This test contains try, catch, and finally blocks. An exception is
+ * sometimes thrown by a function called from within the try block.
+ *
+ * This test doesn't actually make any LiveConnect calls.
+ *
+ *
+ * Author: christine@netscape.com
+ * Date: 11 August 1998
+ */
+ var SECTION = "";
+ var VERSION = "ECMA_2";
+ var TITLE = "The try statement";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var INVALID_JAVA_INTEGER_VALUE = "Invalid value for java.lang.Integer constructor";
+
+ TryNewJavaInteger( "3.14159", INVALID_JAVA_INTEGER_VALUE );
+ TryNewJavaInteger( NaN, INVALID_JAVA_INTEGER_VALUE );
+ TryNewJavaInteger( 0, 0 );
+ TryNewJavaInteger( -1, -1 );
+ TryNewJavaInteger( 1, 1 );
+ TryNewJavaInteger( Infinity, Infinity );
+
+ test();
+
+ /**
+ * Check to see if the input is valid for java.lang.Integer. If it is
+ * not valid, throw INVALID_JAVA_INTEGER_VALUE. If input is valid,
+ * return Number( v )
+ *
+ */
+
+ function newJavaInteger( v ) {
+ value = Number( v );
+ if ( Math.floor(value) != value || isNaN(value) ) {
+ throw ( INVALID_JAVA_INTEGER_VALUE );
+ } else {
+ return value;
+ }
+ }
+
+ /**
+ * Call newJavaInteger( value ) from within a try block. Catch any
+ * exception, and store it in result. Verify that we got the right
+ * return value from newJavaInteger in cases in which we do not expect
+ * exceptions, and that we got the exception in cases where an exception
+ * was expected.
+ */
+ function TryNewJavaInteger( value, expect ) {
+ var finalTest = false;
+
+ try {
+ result = newJavaInteger( value );
+ } catch ( e ) {
+ result = String( e );
+ } finally {
+ finalTest = true;
+ }
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "newJavaValue( " + value +" )",
+ expect,
+ result);
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "newJavaValue( " + value +" ) hit finally block",
+ true,
+ finalTest);
+
+ }
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/try-003.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/try-003.js
new file mode 100644
index 0000000..de1e213
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/try-003.js
@@ -0,0 +1,79 @@
+/**
+ * File Name: try-003.js
+ * ECMA Section:
+ * Description: The try statement
+ *
+ * This test has a try with no catch, and a finally.
+ *
+ * Author: christine@netscape.com
+ * Date: 11 August 1998
+ */
+ var SECTION = "try-003";
+ var VERSION = "ECMA_2";
+ var TITLE = "The try statement";
+ var BUGNUMBER="http://scopus.mcom.com/bugsplat/show_bug.cgi?id=313585";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ // Tests start here.
+
+ TrySomething( "x = \"hi\"", false );
+ TrySomething( "throw \"boo\"", true );
+ TrySomething( "throw 3", true );
+
+ test();
+
+ /**
+ * This function contains a try block with no catch block,
+ * but it does have a finally block. Try to evaluate expressions
+ * that do and do not throw exceptions.
+ */
+
+ function TrySomething( expression, throwing ) {
+ innerFinally = "FAIL: DID NOT HIT INNER FINALLY BLOCK";
+ if (throwing) {
+ outerCatch = "FAILED: NO EXCEPTION CAUGHT";
+ } else {
+ outerCatch = "PASS";
+ }
+ outerFinally = "FAIL: DID NOT HIT OUTER FINALLY BLOCK";
+
+ try {
+ try {
+ eval( expression );
+ } finally {
+ innerFinally = "PASS";
+ }
+ } catch ( e ) {
+ if (throwing) {
+ outerCatch = "PASS";
+ } else {
+ outerCatch = "FAIL: HIT OUTER CATCH BLOCK";
+ }
+ } finally {
+ outerFinally = "PASS";
+ }
+
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "eval( " + expression +" )",
+ "PASS",
+ innerFinally );
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "eval( " + expression +" )",
+ "PASS",
+ outerCatch );
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "eval( " + expression +" )",
+ "PASS",
+ outerFinally );
+
+
+ }
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/try-004.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/try-004.js
new file mode 100644
index 0000000..b36dc44
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/try-004.js
@@ -0,0 +1,51 @@
+/**
+ * File Name: try-004.js
+ * ECMA Section:
+ * Description: The try statement
+ *
+ * This test has a try with one catch block but no finally.
+ *
+ * Author: christine@netscape.com
+ * Date: 11 August 1998
+ */
+ var SECTION = "try-004";
+ var VERSION = "ECMA_2";
+ var TITLE = "The try statement";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ TryToCatch( "Math.PI", Math.PI );
+ TryToCatch( "Thrower(5)", "Caught 5" );
+ TryToCatch( "Thrower(\"some random exception\")", "Caught some random exception" );
+
+ test();
+
+ function Thrower( v ) {
+ throw "Caught " + v;
+ }
+
+ /**
+ * Evaluate a string. Catch any exceptions thrown. If no exception is
+ * expected, verify the result of the evaluation. If an exception is
+ * expected, verify that we got the right exception.
+ */
+
+ function TryToCatch( value, expect ) {
+ try {
+ result = eval( value );
+ } catch ( e ) {
+ result = e;
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "eval( " + value +" )",
+ expect,
+ result );
+ }
+
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/try-005.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/try-005.js
new file mode 100644
index 0000000..94b5beb
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/try-005.js
@@ -0,0 +1,54 @@
+/**
+ * File Name: try-005.js
+ * ECMA Section:
+ * Description: The try statement
+ *
+ * This test has a try with one catch block but no finally. Same
+ * as try-004, but the eval statement is called from a function, not
+ * directly from within the try block.
+ *
+ * Author: christine@netscape.com
+ * Date: 11 August 1998
+ */
+ var SECTION = "try-005";
+ var VERSION = "ECMA_2";
+ var TITLE = "The try statement";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ TryToCatch( "Math.PI", Math.PI );
+ TryToCatch( "Thrower(5)", "Caught 5" );
+ TryToCatch( "Thrower(\"some random exception\")", "Caught some random exception" );
+
+ test();
+
+ function Thrower( v ) {
+ throw "Caught " + v;
+ }
+ function Eval( v ) {
+ return eval( v );
+ }
+
+ /**
+ * Evaluate a string. Catch any exceptions thrown. If no exception is
+ * expected, verify the result of the evaluation. If an exception is
+ * expected, verify that we got the right exception.
+ */
+
+ function TryToCatch( value, expect ) {
+ try {
+ result = Eval( value );
+ } catch ( e ) {
+ result = e;
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "eval( " + value +" )",
+ expect,
+ result );
+ }
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/try-006.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/try-006.js
new file mode 100644
index 0000000..924f24d
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/try-006.js
@@ -0,0 +1,84 @@
+/**
+ * File Name: try-006.js
+ * ECMA Section:
+ * Description: The try statement
+ *
+ * Throw an exception from within a With block in a try block. Verify
+ * that any expected exceptions are caught.
+ *
+ * Author: christine@netscape.com
+ * Date: 11 August 1998
+ */
+ var SECTION = "try-006";
+ var VERSION = "ECMA_2";
+ var TITLE = "The try statement";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ /**
+ * This is the "check" function for test objects that will
+ * throw an exception.
+ */
+ function throwException() {
+ throw EXCEPTION_STRING +": " + this.valueOf();
+ }
+ var EXCEPTION_STRING = "Exception thrown:";
+
+ /**
+ * This is the "check" function for test objects that do not
+ * throw an exception
+ */
+ function noException() {
+ return this.valueOf();
+ }
+
+ /**
+ * Add test cases here
+ */
+ TryWith( new TryObject( "hello", throwException, true ));
+ TryWith( new TryObject( "hola", noException, false ));
+
+ /**
+ * Run the test.
+ */
+
+ test();
+
+ /**
+ * This is the object that will be the "this" in a with block.
+ */
+ function TryObject( value, fun, exception ) {
+ this.value = value;
+ this.exception = exception;
+
+ this.valueOf = new Function ( "return this.value" );
+ this.check = fun;
+ }
+
+ /**
+ * This function has the try block that has a with block within it.
+ * Test cases are added in this function. Within the with block, the
+ * object's "check" function is called. If the test object's exception
+ * property is true, we expect the result to be the exception value.
+ * If exception is false, then we expect the result to be the value of
+ * the object.
+ */
+ function TryWith( object ) {
+ try {
+ with ( object ) {
+ result = check();
+ }
+ } catch ( e ) {
+ result = e;
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "TryWith( " + object.value +" )",
+ (object.exception ? EXCEPTION_STRING +": " + object.valueOf() : object.valueOf()),
+ result );
+ }
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/try-007.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/try-007.js
new file mode 100644
index 0000000..14a960a
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/try-007.js
@@ -0,0 +1,89 @@
+/**
+ * File Name: try-007.js
+ * ECMA Section:
+ * Description: The try statement
+ *
+ * This test has a for-in statement within a try block.
+ *
+ *
+ * Author: christine@netscape.com
+ * Date: 11 August 1998
+ */
+ var SECTION = "try-007";
+ var VERSION = "ECMA_2";
+ var TITLE = "The try statement: for-in";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ /**
+ * This is the "check" function for test objects that will
+ * throw an exception.
+ */
+ function throwException() {
+ throw EXCEPTION_STRING +": " + this.valueOf();
+ }
+ var EXCEPTION_STRING = "Exception thrown:";
+
+ /**
+ * This is the "check" function for test objects that do not
+ * throw an exception
+ */
+ function noException() {
+ return this.valueOf();
+ }
+
+ /**
+ * Add test cases here
+ */
+ TryForIn( new TryObject( "hello", throwException, true ));
+ TryForIn( new TryObject( "hola", noException, false ));
+
+ /**
+ * Run the test.
+ */
+
+ test();
+
+/**
+ * This is the object that will be the "this" in a with block.
+ * The check function is either throwExeption() or noException().
+ * See above.
+ *
+ */
+function TryObject( value, fun, exception ) {
+ this.value = value;
+ this.exception = exception;
+
+ this.check = fun;
+ this.valueOf = function () { return this.value; }
+}
+
+/**
+ * This function has a for-in statement within a try block. Test cases
+ * are added after the try-catch-finally statement. Within the for-in
+ * block, call a function that can throw an exception. Verify that any
+ * exceptions are properly caught.
+ */
+
+ function TryForIn( object ) {
+ try {
+ for ( p in object ) {
+ if ( typeof object[p] == "function" ) {
+ result = object[p]();
+ }
+ }
+ } catch ( e ) {
+ result = e;
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "TryForIn( " + object+ " )",
+ (object.exception ? EXCEPTION_STRING +": " + object.value : object.value),
+ result );
+
+ }
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/try-008.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/try-008.js
new file mode 100644
index 0000000..78092b6
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/try-008.js
@@ -0,0 +1,56 @@
+/**
+ * File Name: try-008.js
+ * ECMA Section:
+ * Description: The try statement
+ *
+ * This test has a try block in a constructor.
+ *
+ *
+ * Author: christine@netscape.com
+ * Date: 11 August 1998
+ */
+ var SECTION = "try-008";
+ var VERSION = "ECMA_2";
+ var TITLE = "The try statement: try in a constructor";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ function Integer( value, exception ) {
+ try {
+ this.value = checkValue( value );
+ } catch ( e ) {
+ this.value = e.toString();
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "Integer( " + value +" )",
+ (exception ? INVALID_INTEGER_VALUE +": " + value : this.value),
+ this.value );
+ }
+
+ var INVALID_INTEGER_VALUE = "Invalid value for java.lang.Integer constructor";
+
+ function checkValue( value ) {
+ if ( Math.floor(value) != value || isNaN(value) ) {
+ throw ( INVALID_INTEGER_VALUE +": " + value );
+ } else {
+ return value;
+ }
+ }
+
+ // add test cases
+
+ new Integer( 3, false );
+ new Integer( NaN, true );
+ new Integer( 0, false );
+ new Integer( Infinity, false );
+ new Integer( -2.12, true );
+ new Integer( Math.LN2, true );
+
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/try-009.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/try-009.js
new file mode 100644
index 0000000..778e647
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/try-009.js
@@ -0,0 +1,63 @@
+/**
+ * File Name: try-009.js
+ * ECMA Section:
+ * Description: The try statement
+ *
+ * This test has a try block within a while block. Verify that an exception
+ * breaks out of the while. I don't really know why this is an interesting
+ * test case but Mike Shaver had two of these so what the hey.
+ *
+ * Author: christine@netscape.com
+ * Date: 11 August 1998
+ */
+ var SECTION = "try-009";
+ var VERSION = "ECMA_2";
+ var TITLE = "The try statement: try in a while block";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var EXCEPTION_STRING = "Exception thrown: ";
+ var NO_EXCEPTION_STRING = "No exception thrown: ";
+
+
+ TryInWhile( new TryObject( "hello", ThrowException, true ) );
+ TryInWhile( new TryObject( "aloha", NoException, false ));
+
+ test();
+
+ function TryObject( value, throwFunction, result ) {
+ this.value = value;
+ this.thrower = throwFunction;
+ this.result = result;
+ }
+ function ThrowException() {
+ throw EXCEPTION_STRING + this.value;
+ }
+ function NoException() {
+ return NO_EXCEPTION_STRING + this.value;
+ }
+ function TryInWhile( object ) {
+ result = null;
+ while ( true ) {
+ try {
+ object.thrower();
+ result = NO_EXCEPTION_STRING + object.value;
+ break;
+ } catch ( e ) {
+ result = e;
+ break;
+ }
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "( "+ object +".thrower() )",
+ (object.result
+ ? EXCEPTION_STRING + object.value :
+ NO_EXCEPTION_STRING + object.value),
+ result );
+ }
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/try-010.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/try-010.js
new file mode 100644
index 0000000..eeb7f88
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/try-010.js
@@ -0,0 +1,70 @@
+/**
+ * File Name: try-010.js
+ * ECMA Section:
+ * Description: The try statement
+ *
+ * This has a try block nested in the try block. Verify that the
+ * exception is caught by the right try block, and all finally blocks
+ * are executed.
+ *
+ * Author: christine@netscape.com
+ * Date: 11 August 1998
+ */
+ var SECTION = "try-010";
+ var VERSION = "ECMA_2";
+ var TITLE = "The try statement: try in a tryblock";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var EXCEPTION_STRING = "Exception thrown: ";
+ var NO_EXCEPTION_STRING = "No exception thrown: ";
+
+
+ NestedTry( new TryObject( "No Exceptions Thrown", NoException, NoException, 43 ) );
+ NestedTry( new TryObject( "Throw Exception in Outer Try", ThrowException, NoException, 48 ));
+ NestedTry( new TryObject( "Throw Exception in Inner Try", NoException, ThrowException, 45 ));
+ NestedTry( new TryObject( "Throw Exception in Both Trys", ThrowException, ThrowException, 48 ));
+
+ test();
+
+ function TryObject( description, tryOne, tryTwo, result ) {
+ this.description = description;
+ this.tryOne = tryOne;
+ this.tryTwo = tryTwo;
+ this.result = result;
+ }
+ function ThrowException() {
+ throw EXCEPTION_STRING + this.value;
+ }
+ function NoException() {
+ return NO_EXCEPTION_STRING + this.value;
+ }
+ function NestedTry( object ) {
+ result = 0;
+ try {
+ object.tryOne();
+ result += 1;
+ try {
+ object.tryTwo();
+ result += 2;
+ } catch ( e ) {
+ result +=4;
+ } finally {
+ result += 8;
+ }
+ } catch ( e ) {
+ result += 16;
+ } finally {
+ result += 32;
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ object.description,
+ object.result,
+ result );
+ }
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/try-012.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/try-012.js
new file mode 100644
index 0000000..f8c8e00
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/try-012.js
@@ -0,0 +1,92 @@
+/**
+ * File Name: try-012.js
+ * ECMA Section:
+ * Description: The try statement
+ *
+ * This test has a try with no catch, and a finally. This is like try-003,
+ * but throws from a finally block, not the try block.
+ *
+ * Author: christine@netscape.com
+ * Date: 11 August 1998
+ */
+ var SECTION = "try-012";
+ var VERSION = "ECMA_2";
+ var TITLE = "The try statement";
+ var BUGNUMBER="336872";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ // Tests start here.
+
+ TrySomething( "x = \"hi\"", true );
+ TrySomething( "throw \"boo\"", true );
+ TrySomething( "throw 3", true );
+
+ test();
+
+ /**
+ * This function contains a try block with no catch block,
+ * but it does have a finally block. Try to evaluate expressions
+ * that do and do not throw exceptions.
+ *
+ * The productioni TryStatement Block Finally is evaluated as follows:
+ * 1. Evaluate Block
+ * 2. Evaluate Finally
+ * 3. If Result(2).type is normal return result 1 (in the test case, result 1 has
+ * the completion type throw)
+ * 4. return result 2 (does not get hit in this case)
+ *
+ */
+
+ function TrySomething( expression, throwing ) {
+ innerFinally = "FAIL: DID NOT HIT INNER FINALLY BLOCK";
+ if (throwing) {
+ outerCatch = "FAILED: NO EXCEPTION CAUGHT";
+ } else {
+ outerCatch = "PASS";
+ }
+ outerFinally = "FAIL: DID NOT HIT OUTER FINALLY BLOCK";
+
+
+ // If the inner finally does not throw an exception, the result
+ // of the try block should be returned. (Type of inner return
+ // value should be throw if finally executes correctly
+
+ try {
+ try {
+ throw 0;
+ } finally {
+ innerFinally = "PASS";
+ eval( expression );
+ }
+ } catch ( e ) {
+ if (throwing) {
+ outerCatch = "PASS";
+ } else {
+ outerCatch = "FAIL: HIT OUTER CATCH BLOCK";
+ }
+ } finally {
+ outerFinally = "PASS";
+ }
+
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "eval( " + expression +" ): evaluated inner finally block",
+ "PASS",
+ innerFinally );
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "eval( " + expression +" ): evaluated outer catch block ",
+ "PASS",
+ outerCatch );
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "eval( " + expression +" ): evaluated outer finally block",
+ "PASS",
+ outerFinally );
+ }
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/while-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/while-001.js
new file mode 100644
index 0000000..f9c0d64
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/while-001.js
@@ -0,0 +1,39 @@
+/**
+ * File Name: while-001
+ * ECMA Section:
+ * Description: while statement
+ *
+ * Verify that the while statement is not executed if the while expression is
+ * false
+ *
+ * Author: christine@netscape.com
+ * Date: 11 August 1998
+ */
+ var SECTION = "while-001";
+ var VERSION = "ECMA_2";
+ var TITLE = "while statement";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ DoWhile();
+ test();
+
+ function DoWhile() {
+ result = "pass";
+
+ while (false) {
+ result = "fail";
+ break;
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "while statement: don't evaluate statement is expression is false",
+ "pass",
+ result );
+
+ } \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/while-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/while-002.js
new file mode 100644
index 0000000..3fda04b
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/while-002.js
@@ -0,0 +1,83 @@
+/**
+ * File Name: while-002
+ * ECMA Section:
+ * Description: while statement
+ *
+ * Verify that the while statement is not executed if the while expression is
+ * false
+ *
+ * Author: christine@netscape.com
+ * Date: 11 August 1998
+ */
+ var SECTION = "while-002";
+ var VERSION = "ECMA_2";
+ var TITLE = "while statement";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ DoWhile( new DoWhileObject(
+ "while expression is null",
+ null,
+ "result = \"fail: should not have evaluated statements in while block;break"
+ ) );
+
+ DoWhile( new DoWhileObject(
+ "while expression is undefined",
+ void 0,
+ "result = \"fail: should not have evaluated statements in while block; break"
+ ));
+
+ DoWhile( new DoWhileObject(
+ "while expression is 0",
+ 0,
+ "result = \"fail: should not have evaluated statements in while block; break;"
+ ));
+
+ DoWhile( new DoWhileObject(
+ "while expression is eval(\"\")",
+ eval(""),
+ "result = \"fail: should not have evaluated statements in while block; break"
+ ));
+
+ DoWhile( new DoWhileObject(
+ "while expression is NaN",
+ NaN,
+ "result = \"fail: should not have evaluated statements in while block; break"
+ ));
+
+ test();
+
+ function DoWhileObject( d, e, s ) {
+ this.description = d;
+ this.whileExpression = e;
+ this.statements = s;
+ }
+
+ function DoWhile( object ) {
+ result = "pass";
+
+ while ( expression = object.whileExpression ) {
+ eval( object.statements );
+ }
+
+ // verify that the while expression was evaluated
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "verify that while expression was evaluated (should be "+
+ object.whileExpression +")",
+ "pass",
+ (object.whileExpression == expression ||
+ ( isNaN(object.whileExpression) && isNaN(expression) )
+ ) ? "pass" : "fail" );
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ object.description,
+ "pass",
+ result );
+ } \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/while-003.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/while-003.js
new file mode 100644
index 0000000..0164f05
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/while-003.js
@@ -0,0 +1,84 @@
+/**
+ * File Name: while-003
+ * ECMA Section:
+ * Description: while statement
+ *
+ * The while expression evaluates to true, Statement returns abrupt completion.
+ *
+ * Author: christine@netscape.com
+ * Date: 11 August 1998
+ */
+ var SECTION = "while-003";
+ var VERSION = "ECMA_2";
+ var TITLE = "while statement";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ DoWhile( new DoWhileObject(
+ "while expression is true",
+ true,
+ "result = \"pass\";" ));
+
+ DoWhile( new DoWhileObject(
+ "while expression is 1",
+ 1,
+ "result = \"pass\";" ));
+
+ DoWhile( new DoWhileObject(
+ "while expression is new Boolean(false)",
+ new Boolean(false),
+ "result = \"pass\";" ));
+
+ DoWhile( new DoWhileObject(
+ "while expression is new Object()",
+ new Object(),
+ "result = \"pass\";" ));
+
+ DoWhile( new DoWhileObject(
+ "while expression is \"hi\"",
+ "hi",
+ "result = \"pass\";" ));
+/*
+ DoWhile( new DoWhileObject(
+ "while expression has a continue in it",
+ "true",
+ "if ( i == void 0 ) i = 0; result=\"pass\"; if ( ++i == 1 ) {continue;} else {break;} result=\"fail\";"
+ ));
+*/
+ test();
+
+ function DoWhileObject( d, e, s ) {
+ this.description = d;
+ this.whileExpression = e;
+ this.statements = s;
+ }
+
+ function DoWhile( object ) {
+ result = "fail: statements in while block were not evaluated";
+
+ while ( expression = object.whileExpression ) {
+ eval( object.statements );
+ break;
+ }
+
+ // verify that the while expression was evaluated
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "verify that while expression was evaluated (should be "+
+ object.whileExpression +")",
+ "pass",
+ (object.whileExpression == expression ||
+ ( isNaN(object.whileExpression) && isNaN(expression) )
+ ) ? "pass" : "fail" );
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ object.description,
+ "pass",
+ result );
+ } \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/while-004.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/while-004.js
new file mode 100644
index 0000000..48faeb0
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/while-004.js
@@ -0,0 +1,214 @@
+/**
+ * File Name: while-004
+ * ECMA Section:
+ * Description: while statement
+ *
+ * Author: christine@netscape.com
+ * Date: 11 August 1998
+ */
+ var SECTION = "while-004";
+ var VERSION = "ECMA_2";
+ var TITLE = "while statement";
+ var BUGNUMBER="316725";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ DoWhile_1();
+ DoWhile_2();
+ DoWhile_3();
+ DoWhile_4();
+ DoWhile_5();
+
+ test();
+
+ /**
+ * Break out of a while by calling return.
+ *
+ * Tests: 12.6.2 step 6.
+ */
+ function dowhile() {
+ result = "pass";
+
+ while (true) {
+ return result;
+ result = "fail: hit code after return statement";
+ break;
+ }
+ }
+
+ function DoWhile_1() {
+ description = "return statement in a while block";
+
+ result = dowhile();
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "DoWhile_1" + description,
+ "pass",
+ result );
+ }
+
+ /**
+ * While with a labeled continue statement. Verify that statements
+ * after the continue statement are not evaluated.
+ *
+ * Tests: 12.6.2 step 8.
+ *
+ */
+ function DoWhile_2() {
+ var description = "while with a labeled continue statement";
+ var result1 = "pass";
+ var result2 = "fail: did not execute code after loop, but inside label";
+ var i = 0;
+ var j = 0;
+
+ theloop:
+ while( i++ < 10 ) {
+ j++;
+ continue theloop;
+ result1 = "failed: hit code after continue statement";
+ }
+ result2 = "pass";
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "DoWhile_2: " +description + " - code inside the loop, before the continue should be executed ("+j+")",
+ true,
+ j == 10 );
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "DoWhile_2: " +description +" - code after labeled continue should not be executed",
+ "pass",
+ result1 );
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "DoWhile_2: " +description +" - code after loop but inside label should be executed",
+ "pass",
+ result2 );
+ }
+
+ /**
+ * While with a labeled break.
+ *
+ */
+ function DoWhile_3() {
+ var description = "while with a labeled break statement";
+ var result1 = "pass";
+ var result2 = "pass";
+ var result3 = "fail: did not get to code after label";
+
+ woohoo: {
+ while( true ) {
+ break woohoo;
+ result1 = "fail: got to code after a break";
+ }
+ result2 = "fail: got to code outside of loop but inside label";
+ }
+
+ result3 = "pass";
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "DoWhile_3: " +description +" - verify break out of loop",
+ "pass",
+ result1 );
+
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "DoWhile_3: " +description +" - verify break out of label",
+ "pass",
+ result2 );
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "DoWhile_3: " +description + " - verify correct exit from label",
+ "pass",
+ result3 );
+ }
+
+
+ /**
+ * Labled while with an unlabeled break
+ *
+ */
+ function DoWhile_4() {
+ var description = "labeled while with an unlabeled break";
+ var result1 = "pass";
+ var result2 = "pass";
+ var result3 = "fail: did not evaluate statement after label";
+
+ woohooboy: {
+ while( true ) {
+ break woohooboy;
+ result1 = "fail: got to code after the break";
+ }
+ result2 = "fail: broke out of while, but not out of label";
+ }
+ result3 = "pass";
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "DoWhile_4: " +description +" - verify break out of while loop",
+ "pass",
+ result1 );
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "DoWhile_4: " +description + " - verify break out of label",
+ "pass",
+ result2 );
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "DoWhile_4: " +description +" - verify that statements after label are evaluated",
+ "pass",
+ result3 );
+ }
+
+ /**
+ * in this case, should behave the same way as
+ *
+ *
+ */
+ function DoWhile_5() {
+ var description = "while with a labeled continue statement";
+ var result1 = "pass";
+ var result2 = "fail: did not execute code after loop, but inside label";
+ var i = 0;
+ var j = 0;
+
+ theloop: {
+ j++;
+ while( i++ < 10 ) {
+ continue;
+ result1 = "failed: hit code after continue statement";
+ }
+ result2 = "pass";
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "DoWhile_5: " +description + " - continue should not execute statements above the loop",
+ true,
+ ( j == 1 ) );
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "DoWhile_5: " +description +" - code after labeled continue should not be executed",
+ "pass",
+ result1 );
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "DoWhile_5: " +description +" - code after loop but inside label should be executed",
+ "pass",
+ result2 );
+ }
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/String/match-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/String/match-001.js
new file mode 100644
index 0000000..738264e
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/String/match-001.js
@@ -0,0 +1,100 @@
+/**
+ * File Name: String/match-001.js
+ * ECMA Section: 15.6.4.9
+ * Description: Based on ECMA 2 Draft 7 February 1999
+ *
+ * Author: christine@netscape.com
+ * Date: 19 February 1999
+ */
+
+/*
+ * String.match( regexp )
+ *
+ * If regexp is not an object of type RegExp, it is replaced with result
+ * of the expression new RegExp(regexp). Let string denote the result of
+ * converting the this value to a string. If regexp.global is false,
+ * return the result obtained by invoking RegExp.prototype.exec (see
+ * section 15.7.5.3) on regexp with string as parameter.
+ *
+ * Otherwise, set the regexp.lastIndex property to 0 and invoke
+ * RegExp.prototype.exec repeatedly until there is no match. If there is a
+ * match with an empty string (in other words, if the value of
+ * regexp.lastIndex is left unchanged) increment regexp.lastIndex by 1.
+ * The value returned is an array with the properties 0 through n-1
+ * corresponding to the first element of the result of each matching
+ * invocation of RegExp.prototype.exec.
+ *
+ * Note that the match function is intentionally generic; it does not
+ * require that its this value be a string object. Therefore, it can be
+ * transferred to other kinds of objects for use as a method.
+ */
+
+ var SECTION = "String/match-001.js";
+ var VERSION = "ECMA_2";
+ var TITLE = "String.prototype.match( regexp )";
+
+ startTest();
+
+ // the regexp argument is not a RegExp object
+ // this is not a string object
+
+ // cases in which the regexp global property is false
+
+ AddRegExpCases( 3, "3", "1234567890", 1, 2, ["3"] );
+
+ // cases in which the regexp object global property is true
+
+ AddGlobalRegExpCases( /34/g, "/34/g", "343443444", 3, ["34", "34", "34"] );
+ AddGlobalRegExpCases( /\d{1}/g, "/d{1}/g", "123456abcde7890", 10,
+ ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0"] );
+
+ AddGlobalRegExpCases( /\d{2}/g, "/d{2}/g", "123456abcde7890", 5,
+ ["12", "34", "56", "78", "90"] );
+
+ AddGlobalRegExpCases( /\D{2}/g, "/d{2}/g", "123456abcde7890", 2,
+ ["ab", "cd"] );
+
+ test();
+
+
+function AddRegExpCases(
+ regexp, str_regexp, string, length, index, matches_array ) {
+
+ AddTestCase(
+ "( " + string + " ).match(" + str_regexp +").length",
+ length,
+ string.match(regexp).length );
+
+ AddTestCase(
+ "( " + string + " ).match(" + str_regexp +").index",
+ index,
+ string.match(regexp).index );
+
+ AddTestCase(
+ "( " + string + " ).match(" + str_regexp +").input",
+ string,
+ string.match(regexp).input );
+
+ for ( var matches = 0; matches < matches_array.length; matches++ ) {
+ AddTestCase(
+ "( " + string + " ).match(" + str_regexp +")[" + matches +"]",
+ matches_array[matches],
+ string.match(regexp)[matches] );
+ }
+}
+
+function AddGlobalRegExpCases(
+ regexp, str_regexp, string, length, matches_array ) {
+
+ AddTestCase(
+ "( " + string + " ).match(" + str_regexp +").length",
+ length,
+ string.match(regexp).length );
+
+ for ( var matches = 0; matches < matches_array.length; matches++ ) {
+ AddTestCase(
+ "( " + string + " ).match(" + str_regexp +")[" + matches +"]",
+ matches_array[matches],
+ string.match(regexp)[matches] );
+ }
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/String/match-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/String/match-002.js
new file mode 100644
index 0000000..83ac2fa
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/String/match-002.js
@@ -0,0 +1,168 @@
+/**
+ * File Name: String/match-002.js
+ * ECMA Section: 15.6.4.9
+ * Description: Based on ECMA 2 Draft 7 February 1999
+ *
+ * Author: christine@netscape.com
+ * Date: 19 February 1999
+ */
+
+/*
+ * String.match( regexp )
+ *
+ * If regexp is not an object of type RegExp, it is replaced with result
+ * of the expression new RegExp(regexp). Let string denote the result of
+ * converting the this value to a string. If regexp.global is false,
+ * return the result obtained by invoking RegExp.prototype.exec (see
+ * section 15.7.5.3) on regexp with string as parameter.
+ *
+ * Otherwise, set the regexp.lastIndex property to 0 and invoke
+ * RegExp.prototype.exec repeatedly until there is no match. If there is a
+ * match with an empty string (in other words, if the value of
+ * regexp.lastIndex is left unchanged) increment regexp.lastIndex by 1.
+ * The value returned is an array with the properties 0 through n-1
+ * corresponding to the first element of the result of each matching
+ * invocation of RegExp.prototype.exec.
+ *
+ * Note that the match function is intentionally generic; it does not
+ * require that its this value be a string object. Therefore, it can be
+ * transferred to other kinds of objects for use as a method.
+ *
+ * This file tests cases in which regexp.global is false. Therefore,
+ * results should behave as regexp.exec with string passed as a parameter.
+ *
+ */
+
+ var SECTION = "String/match-002.js";
+ var VERSION = "ECMA_2";
+ var TITLE = "String.prototype.match( regexp )";
+
+ startTest();
+
+ // the regexp argument is not a RegExp object
+ // this is not a string object
+
+ AddRegExpCases( /([\d]{5})([-\ ]?[\d]{4})?$/,
+ "/([\d]{5})([-\ ]?[\d]{4})?$/",
+ "Boston, Mass. 02134",
+ 14,
+ ["02134", "02134", undefined]);
+
+ AddGlobalRegExpCases( /([\d]{5})([-\ ]?[\d]{4})?$/g,
+ "/([\d]{5})([-\ ]?[\d]{4})?$/g",
+ "Boston, Mass. 02134",
+ ["02134"]);
+
+ // set the value of lastIndex
+ re = /([\d]{5})([-\ ]?[\d]{4})?$/;
+ re.lastIndex = 0;
+
+ s = "Boston, MA 02134";
+
+ AddRegExpCases( re,
+ "re = /([\d]{5})([-\ ]?[\d]{4})?$/; re.lastIndex =0",
+ s,
+ s.lastIndexOf("0"),
+ ["02134", "02134", undefined]);
+
+
+ re.lastIndex = s.length;
+
+ AddRegExpCases( re,
+ "re = /([\d]{5})([-\ ]?[\d]{4})?$/; re.lastIndex = " +
+ s.length,
+ s,
+ s.lastIndexOf("0"),
+ ["02134", "02134", undefined] );
+
+ re.lastIndex = s.lastIndexOf("0");
+
+ AddRegExpCases( re,
+ "re = /([\d]{5})([-\ ]?[\d]{4})?$/; re.lastIndex = " +
+ s.lastIndexOf("0"),
+ s,
+ s.lastIndexOf("0"),
+ ["02134", "02134", undefined]);
+
+ re.lastIndex = s.lastIndexOf("0") + 1;
+
+ AddRegExpCases( re,
+ "re = /([\d]{5})([-\ ]?[\d]{4})?$/; re.lastIndex = " +
+ s.lastIndexOf("0") +1,
+ s,
+ s.lastIndexOf("0"),
+ ["02134", "02134", undefined]);
+
+ test();
+
+function AddRegExpCases(
+ regexp, str_regexp, string, index, matches_array ) {
+
+ // prevent a runtime error
+
+ if ( regexp.exec(string) == null || matches_array == null ) {
+ AddTestCase(
+ string + ".match(" + regexp +")",
+ matches_array,
+ string.match(regexp) );
+
+ return;
+ }
+
+ AddTestCase(
+ "( " + string + " ).match(" + str_regexp +").length",
+ matches_array.length,
+ string.match(regexp).length );
+
+ AddTestCase(
+ "( " + string + " ).match(" + str_regexp +").index",
+ index,
+ string.match(regexp).index );
+
+ AddTestCase(
+ "( " + string + " ).match(" + str_regexp +").input",
+ string,
+ string.match(regexp).input );
+
+ var limit = matches_array.length > string.match(regexp).length ?
+ matches_array.length :
+ string.match(regexp).length;
+
+ for ( var matches = 0; matches < limit; matches++ ) {
+ AddTestCase(
+ "( " + string + " ).match(" + str_regexp +")[" + matches +"]",
+ matches_array[matches],
+ string.match(regexp)[matches] );
+ }
+}
+
+function AddGlobalRegExpCases(
+ regexp, str_regexp, string, matches_array ) {
+
+ // prevent a runtime error
+
+ if ( regexp.exec(string) == null || matches_array == null ) {
+ AddTestCase(
+ regexp + ".exec(" + string +")",
+ matches_array,
+ regexp.exec(string) );
+
+ return;
+ }
+
+ AddTestCase(
+ "( " + string + " ).match(" + str_regexp +").length",
+ matches_array.length,
+ string.match(regexp).length );
+
+ var limit = matches_array.length > string.match(regexp).length ?
+ matches_array.length :
+ string.match(regexp).length;
+
+ for ( var matches = 0; matches < limit; matches++ ) {
+ AddTestCase(
+ "( " + string + " ).match(" + str_regexp +")[" + matches +"]",
+ matches_array[matches],
+ string.match(regexp)[matches] );
+ }
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/String/match-003.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/String/match-003.js
new file mode 100644
index 0000000..f63e9e2
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/String/match-003.js
@@ -0,0 +1,126 @@
+/**
+ * File Name: String/match-003.js
+ * ECMA Section: 15.6.4.9
+ * Description: Based on ECMA 2 Draft 7 February 1999
+ *
+ * Author: christine@netscape.com
+ * Date: 19 February 1999
+ */
+
+/*
+ * String.match( regexp )
+ *
+ * If regexp is not an object of type RegExp, it is replaced with result
+ * of the expression new RegExp(regexp). Let string denote the result of
+ * converting the this value to a string. If regexp.global is false,
+ * return the result obtained by invoking RegExp.prototype.exec (see
+ * section 15.7.5.3) on regexp with string as parameter.
+ *
+ * Otherwise, set the regexp.lastIndex property to 0 and invoke
+ * RegExp.prototype.exec repeatedly until there is no match. If there is a
+ * match with an empty string (in other words, if the value of
+ * regexp.lastIndex is left unchanged) increment regexp.lastIndex by 1.
+ * The value returned is an array with the properties 0 through n-1
+ * corresponding to the first element of the result of each matching
+ * invocation of RegExp.prototype.exec.
+ *
+ * Note that the match function is intentionally generic; it does not
+ * require that its this value be a string object. Therefore, it can be
+ * transferred to other kinds of objects for use as a method.
+ */
+
+ var SECTION = "String/match-003.js";
+ var VERSION = "ECMA_2";
+ var TITLE = "String.prototype.match( regexp )";
+
+ startTest();
+
+ // the regexp argument is not a RegExp object
+ // this is not a string object
+
+
+// [if regexp.global is true] set the regexp.lastIndex property to 0 and
+// invoke RegExp.prototype.exec repeatedly until there is no match. If
+// there is a match with an empty string (in other words, if the value of
+// regexp.lastIndex is left unchanged) increment regexp.lastIndex by 1.
+// The value returned is an array with the properties 0 through n-1
+// corresponding to the first element of the result of each matching invocation
+// of RegExp.prototype.exec.
+
+
+ // set the value of lastIndex
+ re = /([\d]{5})([-\ ]?[\d]{4})?$/g;
+
+
+ s = "Boston, MA 02134";
+
+ AddGlobalRegExpCases( re,
+ "re = " + re,
+ s,
+ ["02134" ]);
+
+ re.lastIndex = 0;
+
+ AddGlobalRegExpCases(
+ re,
+ "re = " + re + "; re.lastIndex = 0 ",
+ s,
+ ["02134"]);
+
+
+ re.lastIndex = s.length;
+
+ AddGlobalRegExpCases(
+ re,
+ "re = " + re + "; re.lastIndex = " + s.length,
+ s,
+ ["02134"] );
+
+ re.lastIndex = s.lastIndexOf("0");
+
+ AddGlobalRegExpCases(
+ re,
+ "re = "+ re +"; re.lastIndex = " + s.lastIndexOf("0"),
+ s,
+ ["02134"]);
+
+ re.lastIndex = s.lastIndexOf("0") + 1;
+
+ AddGlobalRegExpCases(
+ re,
+ "re = " +re+ "; re.lastIndex = " + (s.lastIndexOf("0") +1),
+ s,
+ ["02134"]);
+
+ test();
+
+function AddGlobalRegExpCases(
+ regexp, str_regexp, string, matches_array ) {
+
+ // prevent a runtime error
+
+ if ( string.match(regexp) == null || matches_array == null ) {
+ AddTestCase(
+ string + ".match(" + str_regexp +")",
+ matches_array,
+ string.match(regexp) );
+
+ return;
+ }
+
+ AddTestCase(
+ "( " + string + " ).match(" + str_regexp +").length",
+ matches_array.length,
+ string.match(regexp).length );
+
+ var limit = matches_array.length > string.match(regexp).length ?
+ matches_array.length :
+ string.match(regexp).length;
+
+ for ( var matches = 0; matches < limit; matches++ ) {
+ AddTestCase(
+ "( " + string + " ).match(" + str_regexp +")[" + matches +"]",
+ matches_array[matches],
+ string.match(regexp)[matches] );
+ }
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/String/match-004.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/String/match-004.js
new file mode 100644
index 0000000..c35d988
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/String/match-004.js
@@ -0,0 +1,167 @@
+/**
+ * File Name: String/match-004.js
+ * ECMA Section: 15.6.4.9
+ * Description: Based on ECMA 2 Draft 7 February 1999
+ *
+ * Author: christine@netscape.com
+ * Date: 19 February 1999
+ */
+
+/*
+ * String.match( regexp )
+ *
+ * If regexp is not an object of type RegExp, it is replaced with result
+ * of the expression new RegExp(regexp). Let string denote the result of
+ * converting the this value to a string. If regexp.global is false,
+ * return the result obtained by invoking RegExp.prototype.exec (see
+ * section 15.7.5.3) on regexp with string as parameter.
+ *
+ * Otherwise, set the regexp.lastIndex property to 0 and invoke
+ * RegExp.prototype.exec repeatedly until there is no match. If there is a
+ * match with an empty string (in other words, if the value of
+ * regexp.lastIndex is left unchanged) increment regexp.lastIndex by 1.
+ * The value returned is an array with the properties 0 through n-1
+ * corresponding to the first element of the result of each matching
+ * invocation of RegExp.prototype.exec.
+ *
+ * Note that the match function is intentionally generic; it does not
+ * require that its this value be a string object. Therefore, it can be
+ * transferred to other kinds of objects for use as a method.
+ *
+ *
+ * The match function should be intentionally generic, and not require
+ * this to be a string.
+ *
+ */
+
+ var SECTION = "String/match-004.js";
+ var VERSION = "ECMA_2";
+ var TITLE = "String.prototype.match( regexp )";
+
+ var BUGNUMBER="http://scopus/bugsplat/show_bug.cgi?id=345818";
+
+ startTest();
+
+ // set the value of lastIndex
+ re = /0./;
+ s = 10203040506070809000;
+
+ Number.prototype.match = String.prototype.match;
+
+ AddRegExpCases( re,
+ "re = " + re ,
+ s,
+ String(s),
+ 1,
+ ["02"]);
+
+
+ re.lastIndex = 0;
+ AddRegExpCases( re,
+ "re = " + re +" [lastIndex is " + re.lastIndex+"]",
+ s,
+ String(s),
+ 1,
+ ["02"]);
+/*
+
+ re.lastIndex = s.length;
+
+ AddRegExpCases( re,
+ "re = /([\d]{5})([-\ ]?[\d]{4})?$/; re.lastIndex = " +
+ s.length,
+ s,
+ s.lastIndexOf("0"),
+ null );
+
+ re.lastIndex = s.lastIndexOf("0");
+
+ AddRegExpCases( re,
+ "re = /([\d]{5})([-\ ]?[\d]{4})?$/; re.lastIndex = " +
+ s.lastIndexOf("0"),
+ s,
+ s.lastIndexOf("0"),
+ ["02134"]);
+
+ re.lastIndex = s.lastIndexOf("0") + 1;
+
+ AddRegExpCases( re,
+ "re = /([\d]{5})([-\ ]?[\d]{4})?$/; re.lastIndex = " +
+ s.lastIndexOf("0") +1,
+ s,
+ 0,
+ null);
+*/
+ test();
+
+function AddRegExpCases(
+ regexp, str_regexp, string, str_string, index, matches_array ) {
+
+ // prevent a runtime error
+
+ if ( regexp.exec(string) == null || matches_array == null ) {
+ AddTestCase(
+ string + ".match(" + regexp +")",
+ matches_array,
+ string.match(regexp) );
+
+ return;
+ }
+
+ AddTestCase(
+ "( " + string + " ).match(" + str_regexp +").length",
+ matches_array.length,
+ string.match(regexp).length );
+
+ AddTestCase(
+ "( " + string + " ).match(" + str_regexp +").index",
+ index,
+ string.match(regexp).index );
+
+ AddTestCase(
+ "( " + string + " ).match(" + str_regexp +").input",
+ str_string,
+ string.match(regexp).input );
+
+ var limit = matches_array.length > string.match(regexp).length ?
+ matches_array.length :
+ string.match(regexp).length;
+
+ for ( var matches = 0; matches < limit; matches++ ) {
+ AddTestCase(
+ "( " + string + " ).match(" + str_regexp +")[" + matches +"]",
+ matches_array[matches],
+ string.match(regexp)[matches] );
+ }
+}
+
+function AddGlobalRegExpCases(
+ regexp, str_regexp, string, matches_array ) {
+
+ // prevent a runtime error
+
+ if ( regexp.exec(string) == null || matches_array == null ) {
+ AddTestCase(
+ regexp + ".exec(" + string +")",
+ matches_array,
+ regexp.exec(string) );
+
+ return;
+ }
+
+ AddTestCase(
+ "( " + string + " ).match(" + str_regexp +").length",
+ matches_array.length,
+ string.match(regexp).length );
+
+ var limit = matches_array.length > string.match(regexp).length ?
+ matches_array.length :
+ string.match(regexp).length;
+
+ for ( var matches = 0; matches < limit; matches++ ) {
+ AddTestCase(
+ "( " + string + " ).match(" + str_regexp +")[" + matches +"]",
+ matches_array[matches],
+ string.match(regexp)[matches] );
+ }
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/String/replace-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/String/replace-001.js
new file mode 100644
index 0000000..5ff8dc0
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/String/replace-001.js
@@ -0,0 +1,60 @@
+/**
+ * File Name: String/replace-001.js
+ * ECMA Section: 15.6.4.10
+ * Description: Based on ECMA 2 Draft 7 February 1999
+ *
+ * Author: christine@netscape.com
+ * Date: 19 February 1999
+ */
+
+ var SECTION = "String/replace-001.js";
+ var VERSION = "ECMA_2";
+ var TITLE = "String.prototype.replace( regexp, replaceValue )";
+
+ startTest();
+
+ /*
+ * If regexp is not an object of type RegExp, it is replaced with the
+ * result of the expression new RegExp(regexp). Let string denote the
+ * result of converting the this value to a string. String is searched
+ * for the first occurrence of the regular expression pattern regexp if
+ * regexp.global is false, or all occurrences if regexp.global is true.
+ *
+ * The match is performed as in String.prototype.match, including the
+ * update of regexp.lastIndex. Let m be the number of matched
+ * parenthesized subexpressions as specified in section 15.7.5.3.
+ *
+ * If replaceValue is a function, then for each matched substring, call
+ * the function with the following m + 3 arguments. Argument 1 is the
+ * substring that matched. The next m arguments are all of the matched
+ * subexpressions. Argument m + 2 is the length of the left context, and
+ * argument m + 3 is string.
+ *
+ * The result is a string value derived from the original input by
+ * replacing each matched substring with the corresponding return value
+ * of the function call, converted to a string if need be.
+ *
+ * Otherwise, let newstring denote the result of converting replaceValue
+ * to a string. The result is a string value derived from the original
+ * input string by replacing each matched substring with a string derived
+ * from newstring by replacing characters in newstring by replacement text
+ * as specified in the following table:
+ *
+ * $& The matched substring.
+ * $‘ The portion of string that precedes the matched substring.
+ * $’ The portion of string that follows the matched substring.
+ * $+ The substring matched by the last parenthesized subexpressions in
+ * the regular expression.
+ * $n The corresponding matched parenthesized subexpression n, where n
+ * is a single digit 0-9. If there are fewer than n subexpressions, “$n
+ * is left unchanged.
+ *
+ * Note that the replace function is intentionally generic; it does not
+ * require that its this value be a string object. Therefore, it can be
+ * transferred to other kinds of objects for use as a method.
+ */
+
+
+ testcases[0] = { expect:"PASSED", actual:"PASSED", description:"NO TESTS EXIST" };
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/String/split-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/String/split-001.js
new file mode 100644
index 0000000..b2d7c9c
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/String/split-001.js
@@ -0,0 +1,106 @@
+/**
+ * File Name: String/split-001.js
+ * ECMA Section: 15.6.4.9
+ * Description: Based on ECMA 2 Draft 7 February 1999
+ *
+ * Author: christine@netscape.com
+ * Date: 19 February 1999
+ */
+
+/*
+ * Since regular expressions have been part of JavaScript since 1.2, there
+ * are already tests for regular expressions in the js1_2/regexp folder.
+ *
+ * These new tests try to supplement the existing tests, and verify that
+ * our implementation of RegExp conforms to the ECMA specification, but
+ * does not try to be as exhaustive as in previous tests.
+ *
+ * The [,limit] argument to String.split is new, and not covered in any
+ * existing tests.
+ *
+ * String.split cases are covered in ecma/String/15.5.4.8-*.js.
+ * String.split where separator is a RegExp are in
+ * js1_2/regexp/string_split.js
+ *
+ */
+
+ var SECTION = "ecma_2/String/split-001.js";
+ var VERSION = "ECMA_2";
+ var TITLE = "String.prototype.split( regexp, [,limit] )";
+
+ startTest();
+
+ // the separator is not supplied
+ // separator is undefined
+ // separator is an empty string
+
+ AddSplitCases( "splitme", "", "''", ["s", "p", "l", "i", "t", "m", "e"] );
+ AddSplitCases( "splitme", new RegExp(), "new RegExp()", ["s", "p", "l", "i", "t", "m", "e"] );
+
+ // separartor is a regexp
+ // separator regexp value global setting is set
+ // string is an empty string
+ // if separator is an empty string, split each by character
+
+ // this is not a String object
+
+ // limit is not a number
+ // limit is undefined
+ // limit is larger than 2^32-1
+ // limit is a negative number
+
+ test();
+
+function AddSplitCases( string, separator, str_sep, split_array ) {
+
+ // verify that the result of split is an object of type Array
+ AddTestCase(
+ "( " + string + " ).split(" + str_sep +").constructor == Array",
+ true,
+ string.split(separator).constructor == Array );
+
+ // check the number of items in the array
+ AddTestCase(
+ "( " + string + " ).split(" + str_sep +").length",
+ split_array.length,
+ string.split(separator).length );
+
+ // check the value of each array item
+ var limit = (split_array.length > string.split(separator).length )
+ ? split_array.length : string.split(separator).length;
+
+ for ( var matches = 0; matches < split_array.length; matches++ ) {
+ AddTestCase(
+ "( " + string + " ).split(" + str_sep +")[" + matches +"]",
+ split_array[matches],
+ string.split( separator )[matches] );
+ }
+}
+
+function AddLimitedSplitCases(
+ string, separator, str_sep, limit, str_limit, split_array ) {
+
+ // verify that the result of split is an object of type Array
+
+ AddTestCase(
+ "( " + string + " ).split(" + str_sep +", " + str_limit +
+ " ).constructor == Array",
+ true,
+ string.split(separator, limit).constructor == Array );
+
+ // check the length of the array
+
+ AddTestCase(
+ "( " + string + " ).split(" + str_sep +", " + str_limit + " ).length",
+ length,
+ string.split(separator).length );
+
+ // check the value of each array item
+
+ for ( var matches = 0; matches < split_array.length; matches++ ) {
+ AddTestCase(
+ "( " + string + " ).split(" + str_sep +", " + str_limit + " )[" + matches +"]",
+ split_array[matches],
+ string.split( separator )[matches] );
+ }
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/String/split-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/String/split-002.js
new file mode 100644
index 0000000..1007a31
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/String/split-002.js
@@ -0,0 +1,264 @@
+/**
+ * File Name: String/split-002.js
+ * ECMA Section: 15.6.4.9
+ * Description: Based on ECMA 2 Draft 7 February 1999
+ *
+ * Author: christine@netscape.com
+ * Date: 19 February 1999
+ */
+
+/*
+ * Since regular expressions have been part of JavaScript since 1.2, there
+ * are already tests for regular expressions in the js1_2/regexp folder.
+ *
+ * These new tests try to supplement the existing tests, and verify that
+ * our implementation of RegExp conforms to the ECMA specification, but
+ * does not try to be as exhaustive as in previous tests.
+ *
+ * The [,limit] argument to String.split is new, and not covered in any
+ * existing tests.
+ *
+ * String.split cases are covered in ecma/String/15.5.4.8-*.js.
+ * String.split where separator is a RegExp are in
+ * js1_2/regexp/string_split.js
+ *
+ */
+
+ var SECTION = "ecma_2/String/split-002.js";
+ var VERSION = "ECMA_2";
+ var TITLE = "String.prototype.split( regexp, [,limit] )";
+
+ startTest();
+
+ // the separator is not supplied
+ // separator is undefined
+ // separator is an empty string
+
+// AddSplitCases( "splitme", "", "''", ["s", "p", "l", "i", "t", "m", "e"] );
+// AddSplitCases( "splitme", new RegExp(), "new RegExp()", ["s", "p", "l", "i", "t", "m", "e"] );
+
+ // separator is an empty regexp
+ // separator is not supplied
+
+ CompareSplit( "hello", "ll" );
+
+ CompareSplit( "hello", "l" );
+ CompareSplit( "hello", "x" );
+ CompareSplit( "hello", "h" );
+ CompareSplit( "hello", "o" );
+ CompareSplit( "hello", "hello" );
+ CompareSplit( "hello", undefined );
+
+ CompareSplit( "hello", "");
+ CompareSplit( "hello", "hellothere" );
+
+ CompareSplit( new String("hello" ) );
+
+
+ Number.prototype.split = String.prototype.split;
+
+ CompareSplit( new Number(100111122133144155), 1 );
+ CompareSplitWithLimit(new Number(100111122133144155), 1, 1 );
+
+ CompareSplitWithLimit(new Number(100111122133144155), 1, 2 );
+ CompareSplitWithLimit(new Number(100111122133144155), 1, 0 );
+ CompareSplitWithLimit(new Number(100111122133144155), 1, 100 );
+ CompareSplitWithLimit(new Number(100111122133144155), 1, void 0 );
+ CompareSplitWithLimit(new Number(100111122133144155), 1, Math.pow(2,32)-1 );
+ CompareSplitWithLimit(new Number(100111122133144155), 1, "boo" );
+ CompareSplitWithLimit(new Number(100111122133144155), 1, -(Math.pow(2,32)-1) );
+ CompareSplitWithLimit( "hello", "l", NaN );
+ CompareSplitWithLimit( "hello", "l", 0 );
+ CompareSplitWithLimit( "hello", "l", 1 );
+ CompareSplitWithLimit( "hello", "l", 2 );
+ CompareSplitWithLimit( "hello", "l", 3 );
+ CompareSplitWithLimit( "hello", "l", 4 );
+
+
+/*
+ CompareSplitWithLimit( "hello", "ll", 0 );
+ CompareSplitWithLimit( "hello", "ll", 1 );
+ CompareSplitWithLimit( "hello", "ll", 2 );
+ CompareSplit( "", " " );
+ CompareSplit( "" );
+*/
+
+ // separartor is a regexp
+ // separator regexp value global setting is set
+ // string is an empty string
+ // if separator is an empty string, split each by character
+
+ // this is not a String object
+
+ // limit is not a number
+ // limit is undefined
+ // limit is larger than 2^32-1
+ // limit is a negative number
+
+ test();
+
+function CompareSplit( string, separator ) {
+ split_1 = string.split( separator );
+ split_2 = string_split( string, separator );
+
+ AddTestCase(
+ "( " + string +".split(" + separator + ") ).length" ,
+ split_2.length,
+ split_1.length );
+
+ var limit = split_1.length > split_2.length ?
+ split_1.length : split_2.length;
+
+ for ( var split_item = 0; split_item < limit; split_item++ ) {
+ AddTestCase(
+ string + ".split(" + separator + ")["+split_item+"]",
+ split_2[split_item],
+ split_1[split_item] );
+ }
+}
+
+function CompareSplitWithLimit( string, separator, splitlimit ) {
+ split_1 = string.split( separator, splitlimit );
+ split_2 = string_split( string, separator, splitlimit );
+
+ AddTestCase(
+ "( " + string +".split(" + separator + ", " + splitlimit+") ).length" ,
+ split_2.length,
+ split_1.length );
+
+ var limit = split_1.length > split_2.length ?
+ split_1.length : split_2.length;
+
+ for ( var split_item = 0; split_item < limit; split_item++ ) {
+ AddTestCase(
+ string + ".split(" + separator + ", " + splitlimit+")["+split_item+"]",
+ split_2[split_item],
+ split_1[split_item] );
+ }
+}
+
+function string_split ( __this, separator, limit ) {
+ var S = String(__this ); // 1
+
+ var A = new Array(); // 2
+
+ if ( limit == undefined ) { // 3
+ lim = Math.pow(2, 31 ) -1;
+ } else {
+ lim = ToUint32( limit );
+ }
+
+ var s = S.length; // 4
+ var p = 0; // 5
+
+ if ( separator == undefined ) { // 8
+ A[0] = S;
+ return A;
+ }
+
+ if ( separator.constructor == RegExp ) // 6
+ R = separator;
+ else
+ R = separator.toString();
+
+ if (lim == 0) return A; // 7
+
+ if ( separator == undefined ) { // 8
+ A[0] = S;
+ return A;
+ }
+
+ if (s == 0) { // 9
+ z = SplitMatch(R, S, 0);
+ if (z != false) return A;
+ A[0] = S;
+ return A;
+ }
+
+ var q = p; // 10
+loop:
+ while (true ) {
+
+ if ( q == s ) break; // 11
+
+ z = SplitMatch(R, S, q); // 12
+
+//print("Returned ", z);
+
+ if (z != false) { // 13
+ e = z.endIndex; // 14
+ cap = z.captures; // 14
+ if (e != p) { // 15
+//print("S = ", S, ", p = ", p, ", q = ", q);
+ T = S.slice(p, q); // 16
+//print("T = ", T);
+ A[A.length] = T; // 17
+ if (A.length == lim) return A; // 18
+ p = e; // 19
+ i = 0; // 20
+ while (true) { // 25
+ if (i == cap.length) { // 21
+ q = p; // 10
+ continue loop;
+ }
+ i = i + 1; // 22
+ A[A.length] = cap[i] // 23
+ if (A.length == lim) return A; // 24
+ }
+ }
+ }
+
+ q = q + 1; // 26
+ }
+
+ T = S.slice(p, q);
+ A[A.length] = T;
+ return A;
+}
+
+function SplitMatch(R, S, q)
+{
+ if (R.constructor == RegExp) { // 1
+ var reResult = R.match(S, q); // 8
+ if (reResult == undefined)
+ return false;
+ else {
+ a = new Array(reResult.length - 1);
+ for (var i = 1; i < reResult.length; i++)
+ a[a.length] = reResult[i];
+ return { endIndex : reResult.index + reResult[0].length, captures : cap };
+ }
+ }
+ else {
+ var r = R.length; // 2
+ s = S.length; // 3
+ if ((q + r) > s) return false; // 4
+ for (var i = 0; i < r; i++) {
+//print("S.charAt(", q + i, ") = ", S.charAt(q + i), ", R.charAt(", i, ") = ", R.charAt(i));
+ if (S.charAt(q + i) != R.charAt(i)) // 5
+ return false;
+ }
+ cap = new Array(); // 6
+ return { endIndex : q + r, captures : cap }; // 7
+ }
+}
+
+function ToUint32( n ) {
+ n = Number( n );
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ if ( Math.abs( n ) == 0
+ || Math.abs( n ) == Number.POSITIVE_INFINITY
+ || n != n) {
+ return 0;
+ }
+ n = sign * Math.floor( Math.abs(n) )
+
+ n = n % Math.pow(2,32);
+
+ if ( n < 0 ){
+ n += Math.pow(2,32);
+ }
+
+ return ( n );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/String/split-003.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/String/split-003.js
new file mode 100644
index 0000000..e2f2b92
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/String/split-003.js
@@ -0,0 +1,117 @@
+/**
+ * File Name: String/split-003.js
+ * ECMA Section: 15.6.4.9
+ * Description: Based on ECMA 2 Draft 7 February 1999
+ *
+ * Author: christine@netscape.com
+ * Date: 19 February 1999
+ */
+
+/*
+ * Since regular expressions have been part of JavaScript since 1.2, there
+ * are already tests for regular expressions in the js1_2/regexp folder.
+ *
+ * These new tests try to supplement the existing tests, and verify that
+ * our implementation of RegExp conforms to the ECMA specification, but
+ * does not try to be as exhaustive as in previous tests.
+ *
+ * The [,limit] argument to String.split is new, and not covered in any
+ * existing tests.
+ *
+ * String.split cases are covered in ecma/String/15.5.4.8-*.js.
+ * String.split where separator is a RegExp are in
+ * js1_2/regexp/string_split.js
+ *
+ */
+
+ var SECTION = "ecma_2/String/split-003.js";
+ var VERSION = "ECMA_2";
+ var TITLE = "String.prototype.split( regexp, [,limit] )";
+
+ startTest();
+
+ // separartor is a regexp
+ // separator regexp value global setting is set
+ // string is an empty string
+ // if separator is an empty string, split each by character
+
+
+ AddSplitCases( "hello", new RegExp, "new RegExp", ["h","e","l","l","o"] );
+
+ AddSplitCases( "hello", /l/, "/l/", ["he","","o"] );
+ AddLimitedSplitCases( "hello", /l/, "/l/", 0, [] );
+ AddLimitedSplitCases( "hello", /l/, "/l/", 1, ["he"] );
+ AddLimitedSplitCases( "hello", /l/, "/l/", 2, ["he",""] );
+ AddLimitedSplitCases( "hello", /l/, "/l/", 3, ["he","","o"] );
+ AddLimitedSplitCases( "hello", /l/, "/l/", 4, ["he","","o"] );
+ AddLimitedSplitCases( "hello", /l/, "/l/", void 0, ["he","","o"] );
+ AddLimitedSplitCases( "hello", /l/, "/l/", "hi", [] );
+ AddLimitedSplitCases( "hello", /l/, "/l/", undefined, ["he","","o"] );
+
+ AddSplitCases( "hello", new RegExp, "new RegExp", ["h","e","l","l","o"] );
+ AddLimitedSplitCases( "hello", new RegExp, "new RegExp", 0, [] );
+ AddLimitedSplitCases( "hello", new RegExp, "new RegExp", 1, ["h"] );
+ AddLimitedSplitCases( "hello", new RegExp, "new RegExp", 2, ["h","e"] );
+ AddLimitedSplitCases( "hello", new RegExp, "new RegExp", 3, ["h","e","l"] );
+ AddLimitedSplitCases( "hello", new RegExp, "new RegExp", 4, ["h","e","l","l"] );
+ AddLimitedSplitCases( "hello", new RegExp, "new RegExp", void 0, ["h","e","l","l","o"] );
+ AddLimitedSplitCases( "hello", new RegExp, "new RegExp", "hi", [] );
+ AddLimitedSplitCases( "hello", new RegExp, "new RegExp", undefined, ["h","e","l","l","o"] );
+
+ test();
+
+function AddSplitCases( string, separator, str_sep, split_array ) {
+ // verify that the result of split is an object of type Array
+ AddTestCase(
+ "( " + string + " ).split(" + str_sep +").constructor == Array",
+ true,
+ string.split(separator).constructor == Array );
+
+ // check the number of items in the array
+ AddTestCase(
+ "( " + string + " ).split(" + str_sep +").length",
+ split_array.length,
+ string.split(separator).length );
+
+ // check the value of each array item
+ var limit = (split_array.length > string.split(separator).length )
+ ? split_array.length : string.split(separator).length;
+
+ for ( var matches = 0; matches < split_array.length; matches++ ) {
+ AddTestCase(
+ "( " + string + " ).split(" + str_sep +")[" + matches +"]",
+ split_array[matches],
+ string.split( separator )[matches] );
+ }
+}
+
+function AddLimitedSplitCases(
+ string, separator, str_sep, limit, split_array ) {
+
+ // verify that the result of split is an object of type Array
+
+ AddTestCase(
+ "( " + string + " ).split(" + str_sep +", " + limit +
+ " ).constructor == Array",
+ true,
+ string.split(separator, limit).constructor == Array );
+
+ // check the length of the array
+
+ AddTestCase(
+ "( " + string + " ).split(" + str_sep +", " + limit + " ).length",
+ split_array.length,
+ string.split(separator, limit).length );
+
+ // check the value of each array item
+
+ var slimit = (split_array.length > string.split(separator).length )
+ ? split_array.length : string.split(separator, limit).length;
+
+ for ( var matches = 0; matches < slimit; matches++ ) {
+ AddTestCase(
+ "( " + string + " ).split(" + str_sep +", " + limit + " )[" + matches +"]",
+ split_array[matches],
+ string.split( separator, limit )[matches] );
+ }
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/browser.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/browser.js
new file mode 100644
index 0000000..ccc1bb4
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/browser.js
@@ -0,0 +1,83 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS
+* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+* implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation. All
+* Rights Reserved.
+*
+* Contributor(s):
+*/
+
+/*
+ * JavaScript test library shared functions file for running the tests
+ * in the browser. Overrides the shell's print function with document.write
+ * and make everything HTML pretty.
+ *
+ * To run the tests in the browser, use the mkhtml.pl script to generate
+ * html pages that include the shell.js, browser.js (this file), and the
+ * test js file in script tags.
+ *
+ * The source of the page that is generated should look something like this:
+ * <script src="./../shell.js"></script>
+ * <script src="./../browser.js"></script>
+ * <script src="./mytest.js"></script>
+ */
+
+onerror = err;
+
+var GLOBAL = "[object Window]";
+
+function startTest() {
+ writeHeaderToLog( SECTION + " "+ TITLE);
+ if ( BUGNUMBER ) {
+ writeLineToLog ("BUGNUMBER: " + BUGNUMBER );
+ }
+
+ testcases = new Array();
+ tc = 0;
+}
+
+function writeLineToLog( string ) {
+ document.write( string + "<br>\n");
+}
+function writeHeaderToLog( string ) {
+ document.write( "<h2>" + string + "</h2>" );
+}
+function stopTest() {
+ var gc;
+ if ( gc != undefined ) {
+ gc();
+ }
+ document.write( "<hr>" );
+}
+function writeFormattedResult( expect, actual, string, passed ) {
+ var s = "<tt>"+ string ;
+ s += "<b>" ;
+ s += ( passed ) ? "<font color=#009900> &nbsp;" + PASSED
+ : "<font color=#aa0000>&nbsp;" + FAILED + expect + "</tt>";
+ writeLineToLog( s + "</font></b></tt>" );
+ return passed;
+}
+function err( msg, page, line ) {
+ writeLineToLog( "Test failed on line " + line + " with the message: " + msg );
+
+ testcases[tc].actual = "error";
+ testcases[tc].reason = msg;
+ writeTestCaseResult( testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual +
+ ": " + testcases[tc].reason );
+ stopTest();
+ return true;
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/instanceof/instanceof-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/instanceof/instanceof-001.js
new file mode 100644
index 0000000..897c2e3
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/instanceof/instanceof-001.js
@@ -0,0 +1,31 @@
+/**
+ File Name: instanceof-1.js
+ ECMA Section:
+ Description: instanceof operator
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "";
+ var VERSION = "ECMA_2";
+ var TITLE = "instanceof operator";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var b = new Boolean();
+
+ testcases[tc++] = new TestCase( SECTION,
+ "var b = new Boolean(); b instanceof Boolean",
+ true,
+ b instanceof Boolean );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "b instanceof Object",
+ true,
+ b instanceof Object );
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/instanceof/instanceof-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/instanceof/instanceof-002.js
new file mode 100644
index 0000000..d07292d
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/instanceof/instanceof-002.js
@@ -0,0 +1,61 @@
+/**
+ File Name:
+ ECMA Section:
+ Description: Call Objects
+
+
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "";
+ var VERSION = "ECMA_2";
+ var TITLE = "The Call Constructor";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ var b = new Boolean();
+
+ testcases[tc++] = new TestCase( SECTION,
+ "var b = new Boolean(); b instanceof Boolean",
+ true,
+ b instanceof Boolean );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "b instanceof Object",
+ true,
+ b instanceof Object );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "b instanceof Array",
+ false,
+ b instanceof Array );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "true instanceof Boolean",
+ false,
+ true instanceof Boolean );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Boolean instanceof Object",
+ true,
+ Boolean instanceof Object );
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/instanceof/instanceof-003.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/instanceof/instanceof-003.js
new file mode 100644
index 0000000..c8f84ba
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/instanceof/instanceof-003.js
@@ -0,0 +1,57 @@
+/**
+ File Name: instanceof-003.js
+ ECMA Section:
+ Description: http://bugzilla.mozilla.org/show_bug.cgi?id=7635
+
+js> function Foo() {}
+js> theproto = {};
+[object Object]
+js> Foo.prototype = theproto
+[object Object]
+js> theproto instanceof Foo
+true
+
+I think this should be 'false'
+
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+
+The test case described above is correct, however the second test case in this file is not,
+'o instanceof o' should thow an exception. According to ECMA-262:
+
+ 8.6.2 Internal Properties and Methods:
+ "... only Function objects implement [[HasInstance]]"
+ 11.8.6 The instanceof operator:
+ "6.If Result(4) does not have a [[HasInstance]] method, throw a TypeError exception."
+
+{} does not implement [[HasInstance]] (since it is not a function), so passing it as the
+constructor to be tested to instanceof should result in a TypeError being thrown.
+
+*/
+ var SECTION = "instanceof-003";
+ var VERSION = "ECMA_2";
+ var TITLE = "instanceof operator";
+ var BUGNUMBER ="http://bugzilla.mozilla.org/show_bug.cgi?id=7635";
+
+ startTest();
+
+ function Foo() {};
+ theproto = {};
+ Foo.prototype = theproto;
+
+ AddTestCase(
+ "function Foo() = {}; theproto = {}; Foo.prototype = theproto; " +
+ "theproto instanceof Foo",
+ false,
+ theproto instanceof Foo );
+
+
+ AddTestCase(
+ "o = {}; o instanceof o",
+ "EXCEPTION",
+ (function(){ try { var o = {}; o instanceof o; return "no exception"; } catch (e) { return "EXCEPTION"; } } )() );
+
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/instanceof/regress-7635.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/instanceof/regress-7635.js
new file mode 100644
index 0000000..cab6ed9
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/instanceof/regress-7635.js
@@ -0,0 +1,70 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS
+* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+* implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation. All
+* Rights Reserved.
+*
+* Contributor(s):
+*/
+
+/**
+ * File Name: regress-7635.js
+ * Reference: http://bugzilla.mozilla.org/show_bug.cgi?id=7635
+ * Description: instanceof tweaks
+ * Author:
+ */
+
+var SECTION = "instanceof"; // provide a document reference (ie, ECMA section)
+var VERSION = "ECMA_2"; // Version of JavaScript or ECMA
+var TITLE = "Regression test for Bugzilla #7635"; // Provide ECMA section title or a description
+var BUGNUMBER = "http://bugzilla.mozilla.org/show_bug.cgi?id=7635"; // Provide URL to bugsplat or bugzilla report
+
+startTest(); // leave this alone
+
+/*
+ * Calls to AddTestCase here. AddTestCase is a function that is defined
+ * in shell.js and takes three arguments:
+ * - a string representation of what is being tested
+ * - the expected result
+ * - the actual result
+ *
+ * For example, a test might look like this:
+ *
+ * var zip = /[\d]{5}$/;
+ *
+ * AddTestCase(
+ * "zip = /[\d]{5}$/; \"PO Box 12345 Boston, MA 02134\".match(zip)", // description of the test
+ * "02134", // expected result
+ * "PO Box 12345 Boston, MA 02134".match(zip) ); // actual result
+ *
+ */
+
+function Foo() {}
+theproto = {};
+Foo.prototype = theproto
+theproto instanceof Foo
+
+
+AddTestCase( "function Foo() {}; theproto = {}; Foo.prototype = theproto; theproto instanceof Foo",
+ false,
+ theproto instanceof Foo );
+
+var f = new Function();
+
+AddTestCase( "var f = new Function(); f instanceof f", false, f instanceof f );
+
+
+test(); // leave this alone. this executes the test cases and
+ // displays results.
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/jsref.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/jsref.js
new file mode 100644
index 0000000..7dc729d
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/jsref.js
@@ -0,0 +1,629 @@
+var completed = false;
+var testcases;
+var tc = 0;
+
+SECTION = "";
+VERSION = "";
+BUGNUMBER = "";
+EXCLUDE = "";
+BUGNUMBER = "";
+
+
+TZ_DIFF = -8;
+
+var TT = "";
+var TT_ = "";
+var BR = "";
+var NBSP = " ";
+var CR = "\n";
+var FONT = "";
+var FONT_ = "";
+var FONT_RED = "";
+var FONT_GREEN = "";
+var B = "";
+var B_ = ""
+var H2 = "";
+var H2_ = "";
+var HR = "";
+var DEBUG = false;
+
+
+var PASSED = " PASSED!"
+var FAILED = " FAILED! expected: ";
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
+function TestCase( n, d, e, a ) {
+ this.name = n;
+ this.description = d;
+ this.expect = e;
+ this.actual = a;
+ this.passed = true;
+ this.reason = "";
+ this.bugnumber = BUGNUMBER;
+
+ this.passed = getTestCaseResult( this.expect, this.actual );
+ if ( DEBUG ) {
+ writeLineToLog( "added " + this.description );
+ }
+}
+function startTest() {
+ // JavaScript 1.3 is supposed to be compliant ecma version 1.0
+ if ( VERSION == "ECMA_1" ) {
+ version ( "130" );
+ }
+ if ( VERSION == "JS_13" ) {
+ version ( "130" );
+ }
+ if ( VERSION == "JS_12" ) {
+ version ( "120" );
+ }
+ if ( VERSION == "JS_11" ) {
+ version ( "110" );
+ }
+ // for ecma version 2.0, we will leave the javascript version to
+ // the default ( for now ).
+ writeHeaderToLog( SECTION + " "+ TITLE);
+ testcases = new Array();
+ tc = 0;
+
+}
+function getTestCaseResult( expect, actual ) {
+ // because ( NaN == NaN ) always returns false, need to do
+ // a special compare to see if we got the right result.
+ if ( actual != actual ) {
+ if ( typeof actual == "object" ) {
+ actual = "NaN object";
+ } else {
+ actual = "NaN number";
+ }
+ }
+ if ( expect != expect ) {
+ if ( typeof expect == "object" ) {
+ expect = "NaN object";
+ } else {
+ expect = "NaN number";
+ }
+ }
+
+ var passed = ( expect == actual ) ? true : false;
+
+ // if both objects are numbers
+ // need to replace w/ IEEE standard for rounding
+ if ( !passed
+ && typeof(actual) == "number"
+ && typeof(expect) == "number"
+ ) {
+ if ( Math.abs(actual-expect) < 0.0000001 ) {
+ passed = true;
+ }
+ }
+
+ // verify type is the same
+ if ( typeof(expect) != typeof(actual) ) {
+ passed = false;
+ }
+
+ return passed;
+}
+function writeTestCaseResult( expect, actual, string ) {
+ var passed = getTestCaseResult( expect, actual );
+ writeFormattedResult( expect, actual, string, passed );
+ return passed;
+}
+function writeFormattedResult( expect, actual, string, passed ) {
+ var s = TT + string ;
+
+ for ( k = 0;
+ k < (60 - string.length >= 0 ? 60 - string.length : 5) ;
+ k++ ) {
+ }
+
+ s += B ;
+ s += ( passed ) ? FONT_GREEN + NBSP + PASSED : FONT_RED + NBSP + FAILED + expect + TT_ ;
+
+ writeLineToLog( s + FONT_ + B_ + TT_ );
+
+ return passed;
+}
+
+function writeLineToLog( string ) {
+ print( string + BR + CR );
+}
+function writeHeaderToLog( string ) {
+ print( H2 + string + H2_ );
+}
+function stopTest()
+{
+ var sizeTag = "<#TEST CASES SIZE>";
+ var doneTag = "<#TEST CASES DONE>";
+ var beginTag = "<#TEST CASE ";
+ var endTag = ">";
+
+ print(sizeTag);
+ print(testcases.length);
+ for (tc = 0; tc < testcases.length; tc++)
+ {
+ print(beginTag + 'PASSED' + endTag);
+ print(testcases[tc].passed);
+ print(beginTag + 'NAME' + endTag);
+ print(testcases[tc].name);
+ print(beginTag + 'EXPECTED' + endTag);
+ print(testcases[tc].expect);
+ print(beginTag + 'ACTUAL' + endTag);
+ print(testcases[tc].actual);
+ print(beginTag + 'DESCRIPTION' + endTag);
+ print(testcases[tc].description);
+ print(beginTag + 'REASON' + endTag);
+ print(( testcases[tc].passed ) ? "" : "wrong value ");
+ print(beginTag + 'BUGNUMBER' + endTag);
+ print( BUGNUMBER );
+ }
+ print(doneTag);
+ print( HR );
+ gc();
+}
+function getFailedCases() {
+ for ( var i = 0; i < testcases.length; i++ ) {
+ if ( ! testcases[i].passed ) {
+ print( testcases[i].description +" = " +testcases[i].actual +" expected: "+ testcases[i].expect );
+ }
+ }
+}
+function err( msg, page, line ) {
+ testcases[tc].actual = "error";
+ testcases[tc].reason = msg;
+ writeTestCaseResult( testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual +
+ ": " + testcases[tc].reason );
+ stopTest();
+ return true;
+}
+
+/**
+ * Type Conversion functions used by Type Conversion
+ *
+ */
+
+
+
+ /*
+ * Date functions used by tests in Date suite
+ *
+ */
+var msPerDay = 86400000;
+var HoursPerDay = 24;
+var MinutesPerHour = 60;
+var SecondsPerMinute = 60;
+var msPerSecond = 1000;
+var msPerMinute = 60000; // msPerSecond * SecondsPerMinute
+var msPerHour = 3600000; // msPerMinute * MinutesPerHour
+
+var TIME_1970 = 0;
+var TIME_2000 = 946684800000;
+var TIME_1900 = -2208988800000;
+
+function Day( t ) {
+ return ( Math.floor(t/msPerDay ) );
+}
+function DaysInYear( y ) {
+ if ( y % 4 != 0 ) {
+ return 365;
+ }
+ if ( (y % 4 == 0) && (y % 100 != 0) ) {
+ return 366;
+ }
+ if ( (y % 100 == 0) && (y % 400 != 0) ) {
+ return 365;
+ }
+ if ( (y % 400 == 0) ){
+ return 366;
+ } else {
+ return "ERROR: DaysInYear(" + y + ") case not covered";
+ }
+}
+function TimeInYear( y ) {
+ return ( DaysInYear(y) * msPerDay );
+}
+function DayNumber( t ) {
+ return ( Math.floor( t / msPerDay ) );
+}
+function TimeWithinDay( t ) {
+ if ( t < 0 ) {
+ return ( (t % msPerDay) + msPerDay );
+ } else {
+ return ( t % msPerDay );
+ }
+}
+function YearNumber( t ) {
+}
+function TimeFromYear( y ) {
+ return ( msPerDay * DayFromYear(y) );
+}
+function DayFromYear( y ) {
+ return ( 365*(y-1970) +
+ Math.floor((y-1969)/4) -
+ Math.floor((y-1901)/100) +
+ Math.floor((y-1601)/400) );
+}
+function InLeapYear( t ) {
+ if ( DaysInYear(YearFromTime(t)) == 365 ) {
+ return 0;
+ }
+ if ( DaysInYear(YearFromTime(t)) == 366 ) {
+ return 1;
+ } else {
+ return "ERROR: InLeapYear("+t+") case not covered";
+ }
+}
+function YearFromTime( t ) {
+ t = Number( t );
+ var sign = ( t < 0 ) ? -1 : 1;
+ var year = ( sign < 0 ) ? 1969 : 1970;
+ for ( var timeToTimeZero = t; ; ) {
+ // subtract the current year's time from the time that's left.
+ timeToTimeZero -= sign * TimeInYear(year)
+
+ // if there's less than the current year's worth of time left, then break.
+ if ( sign < 0 ) {
+ if ( sign * timeToTimeZero <= 0 ) {
+ break;
+ } else {
+ year += sign;
+ }
+ } else {
+ if ( sign * timeToTimeZero < 0 ) {
+ break;
+ } else {
+ year += sign;
+ }
+ }
+ }
+ return ( year );
+}
+function MonthFromTime( t ) {
+ // i know i could use switch but i'd rather not until it's part of ECMA
+ var day = DayWithinYear( t );
+ var leap = InLeapYear(t);
+
+ if ( (0 <= day) && (day < 31) ) {
+ return 0;
+ }
+ if ( (31 <= day) && (day < (59+leap)) ) {
+ return 1;
+ }
+ if ( ((59+leap) <= day) && (day < (90+leap)) ) {
+ return 2;
+ }
+ if ( ((90+leap) <= day) && (day < (120+leap)) ) {
+ return 3;
+ }
+ if ( ((120+leap) <= day) && (day < (151+leap)) ) {
+ return 4;
+ }
+ if ( ((151+leap) <= day) && (day < (181+leap)) ) {
+ return 5;
+ }
+ if ( ((181+leap) <= day) && (day < (212+leap)) ) {
+ return 6;
+ }
+ if ( ((212+leap) <= day) && (day < (243+leap)) ) {
+ return 7;
+ }
+ if ( ((243+leap) <= day) && (day < (273+leap)) ) {
+ return 8;
+ }
+ if ( ((273+leap) <= day) && (day < (304+leap)) ) {
+ return 9;
+ }
+ if ( ((304+leap) <= day) && (day < (334+leap)) ) {
+ return 10;
+ }
+ if ( ((334+leap) <= day) && (day < (365+leap)) ) {
+ return 11;
+ } else {
+ return "ERROR: MonthFromTime("+t+") not known";
+ }
+}
+function DayWithinYear( t ) {
+ return( Day(t) - DayFromYear(YearFromTime(t)));
+}
+function DateFromTime( t ) {
+ var day = DayWithinYear(t);
+ var month = MonthFromTime(t);
+
+ if ( month == 0 ) {
+ return ( day + 1 );
+ }
+ if ( month == 1 ) {
+ return ( day - 30 );
+ }
+ if ( month == 2 ) {
+ return ( day - 58 - InLeapYear(t) );
+ }
+ if ( month == 3 ) {
+ return ( day - 89 - InLeapYear(t));
+ }
+ if ( month == 4 ) {
+ return ( day - 119 - InLeapYear(t));
+ }
+ if ( month == 5 ) {
+ return ( day - 150- InLeapYear(t));
+ }
+ if ( month == 6 ) {
+ return ( day - 180- InLeapYear(t));
+ }
+ if ( month == 7 ) {
+ return ( day - 211- InLeapYear(t));
+ }
+ if ( month == 8 ) {
+ return ( day - 242- InLeapYear(t));
+ }
+ if ( month == 9 ) {
+ return ( day - 272- InLeapYear(t));
+ }
+ if ( month == 10 ) {
+ return ( day - 303- InLeapYear(t));
+ }
+ if ( month == 11 ) {
+ return ( day - 333- InLeapYear(t));
+ }
+
+ return ("ERROR: DateFromTime("+t+") not known" );
+}
+function WeekDay( t ) {
+ var weekday = (Day(t)+4) % 7;
+ return( weekday < 0 ? 7 + weekday : weekday );
+}
+
+// missing daylight savins time adjustment
+
+function HourFromTime( t ) {
+ var h = Math.floor( t / msPerHour ) % HoursPerDay;
+ return ( (h<0) ? HoursPerDay + h : h );
+}
+function MinFromTime( t ) {
+ var min = Math.floor( t / msPerMinute ) % MinutesPerHour;
+ return( ( min < 0 ) ? MinutesPerHour + min : min );
+}
+function SecFromTime( t ) {
+ var sec = Math.floor( t / msPerSecond ) % SecondsPerMinute;
+ return ( (sec < 0 ) ? SecondsPerMinute + sec : sec );
+}
+function msFromTime( t ) {
+ var ms = t % msPerSecond;
+ return ( (ms < 0 ) ? msPerSecond + ms : ms );
+}
+function LocalTZA() {
+ return ( TZ_DIFF * msPerHour );
+}
+function UTC( t ) {
+ return ( t - LocalTZA() - DaylightSavingTA(t - LocalTZA()) );
+}
+function DaylightSavingTA( t ) {
+ t = t - LocalTZA();
+
+ var dst_start = GetSecondSundayInMarch(t) + 2*msPerHour;
+ var dst_end = GetFirstSundayInNovember(t)+ 2*msPerHour;
+
+ if ( t >= dst_start && t < dst_end ) {
+ return msPerHour;
+ } else {
+ return 0;
+ }
+
+ // Daylight Savings Time starts on the first Sunday in April at 2:00AM in
+ // PST. Other time zones will need to override this function.
+
+ print( new Date( UTC(dst_start + LocalTZA())) );
+
+ return UTC(dst_start + LocalTZA());
+}
+
+function GetFirstSundayInApril( t ) {
+ var year = YearFromTime(t);
+ var leap = InLeapYear(t);
+
+ var april = TimeFromYear(year) + TimeInMonth(0, leap) + TimeInMonth(1,leap) +
+ TimeInMonth(2,leap);
+
+ for ( var first_sunday = april; WeekDay(first_sunday) > 0;
+ first_sunday += msPerDay )
+ {
+ ;
+ }
+
+ return first_sunday;
+}
+function GetLastSundayInOctober( t ) {
+ var year = YearFromTime(t);
+ var leap = InLeapYear(t);
+
+ for ( var oct = TimeFromYear(year), m = 0; m < 9; m++ ) {
+ oct += TimeInMonth(m, leap);
+ }
+ for ( var last_sunday = oct + 30*msPerDay; WeekDay(last_sunday) > 0;
+ last_sunday -= msPerDay )
+ {
+ ;
+ }
+ return last_sunday;
+}
+
+// Added these two functions because DST rules changed for the US.
+function GetSecondSundayInMarch( t ) {
+ var year = YearFromTime(t);
+ var leap = InLeapYear(t);
+
+ var march = TimeFromYear(year) + TimeInMonth(0, leap) + TimeInMonth(1,leap);
+
+ var sundayCount = 0;
+ var flag = true;
+ for ( var second_sunday = march; flag; second_sunday += msPerDay )
+ {
+ if (WeekDay(second_sunday) == 0) {
+ if(++sundayCount == 2)
+ flag = false;
+ }
+ }
+
+ return second_sunday;
+}
+function GetFirstSundayInNovember( t ) {
+ var year = YearFromTime(t);
+ var leap = InLeapYear(t);
+
+ for ( var nov = TimeFromYear(year), m = 0; m < 10; m++ ) {
+ nov += TimeInMonth(m, leap);
+ }
+ for ( var first_sunday = nov; WeekDay(first_sunday) > 0;
+ first_sunday += msPerDay )
+ {
+ ;
+ }
+ return first_sunday;
+}
+function LocalTime( t ) {
+ return ( t + LocalTZA() + DaylightSavingTA(t) );
+}
+function MakeTime( hour, min, sec, ms ) {
+ if ( isNaN( hour ) || isNaN( min ) || isNaN( sec ) || isNaN( ms ) ) {
+ return Number.NaN;
+ }
+
+ hour = ToInteger(hour);
+ min = ToInteger( min);
+ sec = ToInteger( sec);
+ ms = ToInteger( ms );
+
+ return( (hour*msPerHour) + (min*msPerMinute) +
+ (sec*msPerSecond) + ms );
+}
+function MakeDay( year, month, date ) {
+ if ( isNaN(year) || isNaN(month) || isNaN(date) ) {
+ return Number.NaN;
+ }
+ year = ToInteger(year);
+ month = ToInteger(month);
+ date = ToInteger(date );
+
+ var sign = ( year < 1970 ) ? -1 : 1;
+ var t = ( year < 1970 ) ? 1 : 0;
+ var y = ( year < 1970 ) ? 1969 : 1970;
+
+ var result5 = year + Math.floor( month/12 );
+ var result6 = month % 12;
+
+ if ( year < 1970 ) {
+ for ( y = 1969; y >= year; y += sign ) {
+ t += sign * TimeInYear(y);
+ }
+ } else {
+ for ( y = 1970 ; y < year; y += sign ) {
+ t += sign * TimeInYear(y);
+ }
+ }
+
+ var leap = InLeapYear( t );
+
+ for ( var m = 0; m < month; m++ ) {
+ t += TimeInMonth( m, leap );
+ }
+
+ if ( YearFromTime(t) != result5 ) {
+ return Number.NaN;
+ }
+ if ( MonthFromTime(t) != result6 ) {
+ return Number.NaN;
+ }
+ if ( DateFromTime(t) != 1 ) {
+ return Number.NaN;
+ }
+
+ return ( (Day(t)) + date - 1 );
+}
+function TimeInMonth( month, leap ) {
+ // september april june november
+ // jan 0 feb 1 mar 2 apr 3 may 4 june 5 jul 6
+ // aug 7 sep 8 oct 9 nov 10 dec 11
+
+ if ( month == 3 || month == 5 || month == 8 || month == 10 ) {
+ return ( 30*msPerDay );
+ }
+
+ // all the rest
+ if ( month == 0 || month == 2 || month == 4 || month == 6 ||
+ month == 7 || month == 9 || month == 11 ) {
+ return ( 31*msPerDay );
+ }
+
+ // save february
+ return ( (leap == 0) ? 28*msPerDay : 29*msPerDay );
+}
+function MakeDate( day, time ) {
+ if ( day == Number.POSITIVE_INFINITY ||
+ day == Number.NEGATIVE_INFINITY ||
+ day == Number.NaN ) {
+ return Number.NaN;
+ }
+ if ( time == Number.POSITIVE_INFINITY ||
+ time == Number.POSITIVE_INFINITY ||
+ day == Number.NaN) {
+ return Number.NaN;
+ }
+ return ( day * msPerDay ) + time;
+}
+function TimeClip( t ) {
+ if ( isNaN( t ) ) {
+ return ( Number.NaN );
+ }
+ if ( Math.abs( t ) > 8.64e15 ) {
+ return ( Number.NaN );
+ }
+
+ return ( ToInteger( t ) );
+}
+function ToInteger( t ) {
+ t = Number( t );
+
+ if ( isNaN( t ) ){
+ return ( Number.NaN );
+ }
+ if ( t == 0 || t == -0 ||
+ t == Number.POSITIVE_INFINITY || t == Number.NEGATIVE_INFINITY ) {
+ return 0;
+ }
+
+ var sign = ( t < 0 ) ? -1 : 1;
+
+ return ( sign * Math.floor( Math.abs( t ) ) );
+}
+function Enumerate ( o ) {
+ var properties = new Array();
+ for ( p in o ) {
+ properties[ properties.length ] = new Array( p, o[p] );
+ }
+ return properties;
+}
+function AddTestCase( description, expect, actual ) {
+ testcases[tc++] = new TestCase( SECTION, description, expect, actual );
+}
+function getFailedCases() {
+ for ( var i = 0; i < testcases.length; i++ ) {
+ if ( ! testcases[i].passed ) {
+ print( testcases[i].description +" = " +testcases[i].actual +" expected: "+ testcases[i].expect );
+ }
+ }
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/shell.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/shell.js
new file mode 100644
index 0000000..eb70069
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/shell.js
@@ -0,0 +1,216 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS
+* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+* implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation. All
+* Rights Reserved.
+*
+* Contributor(s):
+*/
+
+
+/*
+ * JavaScript shared functions file for running the tests in either
+ * stand-alone JavaScript engine. To run a test, first load this file,
+ * then load the test script.
+ */
+
+var completed = false;
+var testcases;
+var tc = 0;
+
+SECTION = "";
+VERSION = "";
+BUGNUMBER="";
+
+var TZ_DIFF = getTimeZoneDiff();
+
+var DEBUG = false;
+
+var GLOBAL = "[object global]";
+var PASSED = " PASSED!"
+var FAILED = " FAILED! expected: ";
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
+function TestCase( n, d, e, a ) {
+ this.name = n;
+ this.description = d;
+ this.expect = e;
+ this.actual = a;
+ this.passed = true;
+ this.reason = "";
+ this.bugnumber = BUGNUMBER;
+
+ this.passed = getTestCaseResult( this.expect, this.actual );
+ if ( DEBUG ) {
+ writeLineToLog( "added " + this.description );
+ }
+}
+function startTest() {
+ if ( version ) {
+ // JavaScript 1.3 is supposed to be compliant ecma version 1.0
+ if ( VERSION == "ECMA_1" ) {
+ version ( 130 );
+ }
+ if ( VERSION == "JS_13" ) {
+ version ( 130 );
+ }
+ if ( VERSION == "JS_12" ) {
+ version ( 120 );
+ }
+ if ( VERSION == "JS_11" ) {
+ version ( 110 );
+ }
+ }
+
+
+ // for ecma version 2.0, we will leave the javascript version to
+ // the default ( for now ).
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+ if ( BUGNUMBER ) {
+ writeLineToLog ("BUGNUMBER: " + BUGNUMBER );
+ }
+
+ testcases = new Array();
+ tc = 0;
+}
+
+function getTestCaseResult( expect, actual ) {
+ // because ( NaN == NaN ) always returns false, need to do
+ // a special compare to see if we got the right result.
+ if ( actual != actual ) {
+ if ( typeof actual == "object" ) {
+ actual = "NaN object";
+ } else {
+ actual = "NaN number";
+ }
+ }
+ if ( expect != expect ) {
+ if ( typeof expect == "object" ) {
+ expect = "NaN object";
+ } else {
+ expect = "NaN number";
+ }
+ }
+
+ var passed = ( expect == actual ) ? true : false;
+
+ // if both objects are numbers
+ // need to replace w/ IEEE standard for rounding
+ if ( !passed
+ && typeof(actual) == "number"
+ && typeof(expect) == "number"
+ ) {
+ if ( Math.abs(actual-expect) < 0.0000001 ) {
+ passed = true;
+ }
+ }
+
+ // verify type is the same
+ if ( typeof(expect) != typeof(actual) ) {
+ passed = false;
+ }
+
+ return passed;
+}
+
+function writeTestCaseResult( expect, actual, string ) {
+ var passed = getTestCaseResult( expect, actual );
+ writeFormattedResult( expect, actual, string, passed );
+ return passed;
+}
+
+function writeFormattedResult( expect, actual, string, passed ) {
+ var s = string ;
+ s += ( passed ) ? PASSED : FAILED + expect;
+ writeLineToLog( s);
+ return passed;
+}
+
+function writeLineToLog( string ) {
+ print( string );
+}
+function writeHeaderToLog( string ) {
+ print( string );
+}
+function stopTest() {
+ var gc;
+ if ( gc != undefined ) {
+ gc();
+ }
+}
+function getFailedCases() {
+ for ( var i = 0; i < testcases.length; i++ ) {
+ if ( ! testcases[i].passed ) {
+ print( testcases[i].description +" = " +testcases[i].actual +" expected: "+ testcases[i].expect );
+ }
+ }
+}
+function err( msg, page, line ) {
+ writeLineToLog( page + " failed with error: " + msg + " on line " + line );
+ testcases[tc].actual = "error";
+ testcases[tc].reason = msg;
+ writeTestCaseResult( testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual +
+ ": " + testcases[tc].reason );
+ stopTest();
+ return true;
+}
+
+function Enumerate ( o ) {
+ var properties = new Array();
+ for ( p in o ) {
+ properties[ properties.length ] = new Array( p, o[p] );
+ }
+ return properties;
+}
+
+function getFailedCases() {
+ for ( var i = 0; i < testcases.length; i++ ) {
+ if ( ! testcases[i].passed ) {
+ writeLineToLog( testcases[i].description +" = " +testcases[i].actual +
+ " expected: "+ testcases[i].expect );
+ }
+ }
+}
+function AddTestCase( description, expect, actual ) {
+ testcases[tc++] = new TestCase( SECTION, description, expect, actual );
+}
+
+
+/*
+ * Originally, the test suite used a hard-coded value TZ_DIFF = -8.
+ * But that was only valid for testers in the Pacific Standard Time Zone!
+ * We calculate the proper number dynamically for any tester. We just
+ * have to be careful to use a date not subject to Daylight Savings Time...
+*/
+function getTimeZoneDiff()
+{
+ return -((new Date(2000, 1, 1)).getTimezoneOffset())/60;
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/template.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/template.js
new file mode 100644
index 0000000..a30cb77
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/template.js
@@ -0,0 +1,39 @@
+/*
+ * The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is Netscape
+ * Communications Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ */
+
+/**
+ * File Name: template.js
+ * Reference: ** replace with bugzilla URL or document reference **
+ * Description: ** replace with description of test **
+ * Author: ** replace with your e-mail address **
+ */
+
+ var SECTION = ""; // if ECMA test, provide section number
+ var VERSION = "ECMA_2"; // Version of JavaScript or ECMA
+ var TITLE = ""; // Provide ECMA section title or description
+ var BUGNUMBER = ""; // Provide URL to bugsplat or bugzilla report
+
+ startTest(); // leave this alone
+
+
+ /* Calls to AddTestCase here */
+
+ test(); // leave this alone
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Array/15.4.4.3-1.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Array/15.4.4.3-1.js
new file mode 100644
index 0000000..7b5fdbd
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Array/15.4.4.3-1.js
@@ -0,0 +1,66 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS
+* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+* implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation.
+* All Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+* Date: 12 Mar 2001
+*
+*
+* SUMMARY: Testing Array.prototype.toLocaleString()
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=56883
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=58031
+*
+* By ECMA3 15.4.4.3, myArray.toLocaleString() means that toLocaleString()
+* should be applied to each element of the array, and the results should be
+* concatenated with an implementation-specific delimiter. For example:
+*
+* myArray[0].toLocaleString() + ',' + myArray[1].toLocaleString() + etc.
+*
+* In this testcase toLocaleString is a user-defined property of each array element;
+* therefore it is the function that should be invoked. This function increments a
+* global variable. Therefore the end value of this variable should be myArray.length.
+*/
+//-------------------------------------------------------------------------------------------------
+var bug = 56883;
+var summary = 'Testing Array.prototype.toLocaleString() -';
+var actual = '';
+var expect = '';
+var n = 0;
+var obj = {toLocaleString: function() {n++}};
+var myArray = [obj, obj, obj];
+
+
+myArray.toLocaleString();
+actual = n;
+expect = 3; // (see explanation above)
+
+
+//-------------------------------------------------------------------------------------------------
+test();
+//-------------------------------------------------------------------------------------------------
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Array/15.4.4.4-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Array/15.4.4.4-001.js
new file mode 100644
index 0000000..6d99159
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Array/15.4.4.4-001.js
@@ -0,0 +1,148 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2002
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): george@vanous.com, igor@icesoft.no, pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 19 September 2002
+* SUMMARY: Testing Array.prototype.concat()
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=169795
+*
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 169795;
+var summary = 'Testing Array.prototype.concat()';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+var x;
+
+
+status = inSection(1);
+x = "Hello";
+actual = [].concat(x).toString();
+expect = x.toString();
+addThis();
+
+status = inSection(2);
+x = 999;
+actual = [].concat(x).toString();
+expect = x.toString();
+addThis();
+
+status = inSection(3);
+x = /Hello/g;
+actual = [].concat(x).toString();
+expect = x.toString();
+addThis();
+
+status = inSection(4);
+x = new Error("Hello");
+actual = [].concat(x).toString();
+expect = x.toString();
+addThis();
+
+status = inSection(5);
+x = function() {return "Hello";};
+actual = [].concat(x).toString();
+expect = x.toString();
+addThis();
+
+status = inSection(6);
+x = [function() {return "Hello";}];
+actual = [].concat(x).toString();
+expect = x.toString();
+addThis();
+
+status = inSection(7);
+x = [1,2,3].concat([4,5,6]);
+actual = [].concat(x).toString();
+expect = x.toString();
+addThis();
+
+status = inSection(8);
+x = eval('this');
+actual = [].concat(x).toString();
+expect = x.toString();
+addThis();
+
+/*
+ * The next two sections are by igor@icesoft.no; see
+ * http://bugzilla.mozilla.org/show_bug.cgi?id=169795#c3
+ */
+status = inSection(9);
+x={length:0};
+actual = [].concat(x).toString();
+expect = x.toString();
+addThis();
+
+status = inSection(10);
+x={length:2, 0:0, 1:1};
+actual = [].concat(x).toString();
+expect = x.toString();
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Array/regress-101488.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Array/regress-101488.js
new file mode 100644
index 0000000..73c22c9
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Array/regress-101488.js
@@ -0,0 +1,151 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS
+* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+* implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation.
+* All Rights Reserved.
+*
+* Contributor(s): igor@icesoft.no, pschwartau@netscape.com
+* Date: 24 September 2001
+*
+* SUMMARY: Try assigning arr.length = new Number(n)
+* From correspondence with Igor Bukanov <igor@icesoft.no>
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=101488
+*
+* Without the "new" keyword, assigning arr.length = Number(n) worked.
+* But with it, Rhino was giving an error "Inappropriate array length"
+* and SpiderMonkey was exiting without giving any error or return value -
+*
+* Comments on the Rhino code by igor@icesoft.no:
+*
+* jsSet_length requires that the new length value should be an instance
+* of Number. But according to Ecma 15.4.5.1, item 12-13, an error should
+* be thrown only if ToUint32(length_value) != ToNumber(length_value)
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 101488;
+var summary = 'Try assigning arr.length = new Number(n)';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+var arr = [];
+
+
+status = inSection(1);
+arr = Array();
+tryThis('arr.length = new Number(1);');
+actual = arr.length;
+expect = 1;
+addThis();
+
+status = inSection(2);
+arr = Array(5);
+tryThis('arr.length = new Number(1);');
+actual = arr.length;
+expect = 1;
+addThis();
+
+status = inSection(3);
+arr = Array();
+tryThis('arr.length = new Number(17);');
+actual = arr.length;
+expect = 17;
+addThis();
+
+status = inSection(4);
+arr = Array(5);
+tryThis('arr.length = new Number(17);');
+actual = arr.length;
+expect = 17;
+addThis();
+
+
+/*
+ * Also try the above with the "new" keyword before Array().
+ * Array() and new Array() should be equivalent, by ECMA 15.4.1.1
+ */
+status = inSection(5);
+arr = new Array();
+tryThis('arr.length = new Number(1);');
+actual = arr.length;
+expect = 1;
+addThis();
+
+status = inSection(6);
+arr = new Array(5);
+tryThis('arr.length = new Number(1);');
+actual = arr.length;
+expect = 1;
+addThis();
+
+arr = new Array();
+tryThis('arr.length = new Number(17);');
+actual = arr.length;
+expect = 17;
+addThis();
+
+status = inSection(7);
+arr = new Array(5);
+tryThis('arr.length = new Number(17);');
+actual = arr.length;
+expect = 17;
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function tryThis(s)
+{
+ try
+ {
+ eval(s);
+ }
+ catch(e)
+ {
+ // keep going
+ }
+}
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Array/regress-130451.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Array/regress-130451.js
new file mode 100644
index 0000000..7cc5051
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Array/regress-130451.js
@@ -0,0 +1,214 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2002
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): brendan@mozilla.org, pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 25 Mar 2002
+* SUMMARY: Array.prototype.sort() should not (re-)define .length
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=130451
+*
+* From the ECMA-262 Edition 3 Final spec:
+*
+* NOTE: The sort function is intentionally generic; it does not require that
+* its |this| value be an Array object. Therefore, it can be transferred to
+* other kinds of objects for use as a method. Whether the sort function can
+* be applied successfully to a host object is implementation-dependent.
+*
+* The interesting parts of this testcase are the contrasting expectations for
+* Brendan's test below, when applied to Array objects vs. non-Array objects.
+*
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 130451;
+var summary = 'Array.prototype.sort() should not (re-)define .length';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+var arr = [];
+var cmp = new Function();
+
+
+/*
+ * First: test Array.prototype.sort() on Array objects
+ */
+status = inSection(1);
+arr = [0,1,2,3];
+cmp = function(x,y) {return x-y;};
+actual = arr.sort(cmp).length;
+expect = 4;
+addThis();
+
+status = inSection(2);
+arr = [0,1,2,3];
+cmp = function(x,y) {return y-x;};
+actual = arr.sort(cmp).length;
+expect = 4;
+addThis();
+
+status = inSection(3);
+arr = [0,1,2,3];
+cmp = function(x,y) {return x-y;};
+arr.length = 1;
+actual = arr.sort(cmp).length;
+expect = 1;
+addThis();
+
+/*
+ * This test is by Brendan. Setting arr.length to
+ * 2 and then 4 should cause elements to be deleted.
+ */
+arr = [0,1,2,3];
+cmp = function(x,y) {return x-y;};
+arr.sort(cmp);
+
+status = inSection(4);
+actual = arr.join();
+expect = '0,1,2,3';
+addThis();
+
+status = inSection(5);
+actual = arr.length;
+expect = 4;
+addThis();
+
+status = inSection(6);
+arr.length = 2;
+actual = arr.join();
+expect = '0,1';
+addThis();
+
+status = inSection(7);
+arr.length = 4;
+actual = arr.join();
+expect = '0,1,,'; //<---- see how 2,3 have been lost
+addThis();
+
+
+
+/*
+ * Now test Array.prototype.sort() on non-Array objects
+ */
+status = inSection(8);
+var obj = new Object();
+obj.sort = Array.prototype.sort;
+obj.length = 4;
+obj[0] = 0;
+obj[1] = 1;
+obj[2] = 2;
+obj[3] = 3;
+cmp = function(x,y) {return x-y;};
+actual = obj.sort(cmp).length;
+expect = 4;
+addThis();
+
+
+/*
+ * Here again is Brendan's test. Unlike the array case
+ * above, the setting of obj.length to 2 and then 4
+ * should NOT cause elements to be deleted
+ */
+obj = new Object();
+obj.sort = Array.prototype.sort;
+obj.length = 4;
+obj[0] = 3;
+obj[1] = 2;
+obj[2] = 1;
+obj[3] = 0;
+cmp = function(x,y) {return x-y;};
+obj.sort(cmp); //<---- this is what triggered the buggy behavior below
+obj.join = Array.prototype.join;
+
+status = inSection(9);
+actual = obj.join();
+expect = '0,1,2,3';
+addThis();
+
+status = inSection(10);
+actual = obj.length;
+expect = 4;
+addThis();
+
+status = inSection(11);
+obj.length = 2;
+actual = obj.join();
+expect = '0,1';
+addThis();
+
+/*
+ * Before this bug was fixed, |actual| held the value '0,1,,'
+ * as in the Array-object case at top. This bug only occurred
+ * if Array.prototype.sort() had been applied to |obj|,
+ * as we have done higher up.
+ */
+status = inSection(12);
+obj.length = 4;
+actual = obj.join();
+expect = '0,1,2,3';
+addThis();
+
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Date/15.9.5.3.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Date/15.9.5.3.js
new file mode 100644
index 0000000..a68cb89
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Date/15.9.5.3.js
@@ -0,0 +1,149 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.3.js
+ ECMA Section: 15.9.5.3 Date.prototype.toDateString()
+ Description:
+ This function returns a string value. The contents of the string are
+ implementation dependent, but are intended to represent the "date"
+ portion of the Date in the current time zone in a convenient,
+ human-readable form. We can't test the content of the string,
+ but can verify that the string is parsable by Date.parse
+
+ The toDateString function is not generic; it generates a runtime error
+ if its 'this' value is not a Date object. Therefore it cannot be transferred
+ to other kinds of objects for use as a method.
+
+ Author: pschwartau@netscape.com
+ Date: 14 november 2000 (adapted from ecma/Date/15.9.5.2.js)
+*/
+
+ var SECTION = "15.9.5.3";
+ var VERSION = "ECMA_3";
+ var TITLE = "Date.prototype.toDateString()";
+
+ var status = '';
+ var actual = '';
+ var expect = '';
+
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+
+//-----------------------------------------------------------------------------------------------------
+ var testcases = new Array();
+//-----------------------------------------------------------------------------------------------------
+
+
+ // first, some generic tests -
+
+ status = "typeof (now.toDateString())";
+ actual = typeof (now.toDateString());
+ expect = "string";
+ addTestCase();
+
+ status = "Date.prototype.toDateString.length";
+ actual = Date.prototype.toDateString.length;
+ expect = 0;
+ addTestCase();
+
+ /* Date.parse is accurate to the second; valueOf() to the millisecond.
+ Here we expect them to coincide, as we expect a time of exactly midnight - */
+ status = "(Date.parse(now.toDateString()) - (midnight(now)).valueOf()) == 0";
+ actual = (Date.parse(now.toDateString()) - (midnight(now)).valueOf()) == 0;
+ expect = true;
+ addTestCase();
+
+
+
+ // 1970
+ addDateTestCase(0);
+ addDateTestCase(TZ_ADJUST);
+
+
+ // 1900
+ addDateTestCase(TIME_1900);
+ addDateTestCase(TIME_1900 - TZ_ADJUST);
+
+
+ // 2000
+ addDateTestCase(TIME_2000);
+ addDateTestCase(TIME_2000 - TZ_ADJUST);
+
+
+ // 29 Feb 2000
+ addDateTestCase(UTC_29_FEB_2000);
+ addDateTestCase(UTC_29_FEB_2000 - 1000);
+ addDateTestCase(UTC_29_FEB_2000 - TZ_ADJUST);
+
+
+ // 2005
+ addDateTestCase(UTC_1_JAN_2005);
+ addDateTestCase(UTC_1_JAN_2005 - 1000);
+ addDateTestCase(UTC_1_JAN_2005 - TZ_ADJUST);
+
+
+
+//-----------------------------------------------------------------------------------------------------
+ test();
+//-----------------------------------------------------------------------------------------------------
+
+
+function addTestCase()
+{
+ testcases[tc++] = new TestCase( SECTION, status, expect, actual);
+}
+
+
+function addDateTestCase(date_given_in_milliseconds)
+{
+ var givenDate = new Date(date_given_in_milliseconds);
+
+ status = 'Date.parse(' + givenDate + ').toDateString())';
+ actual = Date.parse(givenDate.toDateString());
+ expect = Date.parse(midnight(givenDate));
+ addTestCase();
+}
+
+
+function midnight(givenDate)
+{
+ // midnight on the given date -
+ return new Date(givenDate.getFullYear(), givenDate.getMonth(), givenDate.getDate());
+}
+
+
+function test()
+{
+ for ( tc=0; tc < testcases.length; tc++ )
+ {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description + " = " + testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return (testcases);
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Date/15.9.5.4.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Date/15.9.5.4.js
new file mode 100644
index 0000000..abff98a
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Date/15.9.5.4.js
@@ -0,0 +1,194 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.4.js
+ ECMA Section: 15.9.5.4 Date.prototype.toTimeString()
+ Description:
+ This function returns a string value. The contents of the string are
+ implementation dependent, but are intended to represent the "time"
+ portion of the Date in the current time zone in a convenient,
+ human-readable form. We test the content of the string by checking
+ that d.toDateString() + d.toTimeString() == d.toString()
+
+ Author: pschwartau@netscape.com
+ Date: 14 november 2000
+ Revised: 07 january 2002 because of a change in JS Date format:
+
+ See http://bugzilla.mozilla.org/show_bug.cgi?id=118266 (SpiderMonkey)
+ See http://bugzilla.mozilla.org/show_bug.cgi?id=118636 (Rhino)
+*/
+//-----------------------------------------------------------------------------
+ var SECTION = "15.9.5.4";
+ var VERSION = "ECMA_3";
+ var TITLE = "Date.prototype.toTimeString()";
+
+ var status = '';
+ var actual = '';
+ var expect = '';
+ var givenDate;
+ var year = '';
+ var regexp = '';
+ var reducedDateString = '';
+ var hopeThisIsTimeString = '';
+ var cnEmptyString = '';
+ var cnERR ='OOPS! FATAL ERROR: no regexp match in extractTimeString()';
+
+
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+
+//-----------------------------------------------------------------------------------------------------
+ var testcases = new Array();
+//-----------------------------------------------------------------------------------------------------
+
+
+ // first, a couple of generic tests -
+
+ status = "typeof (now.toTimeString())";
+ actual = typeof (now.toTimeString());
+ expect = "string";
+ addTestCase();
+
+ status = "Date.prototype.toTimeString.length";
+ actual = Date.prototype.toTimeString.length;
+ expect = 0;
+ addTestCase();
+
+
+
+
+ // 1970
+ addDateTestCase(0);
+ addDateTestCase(TZ_ADJUST);
+
+
+ // 1900
+ addDateTestCase(TIME_1900);
+ addDateTestCase(TIME_1900 - TZ_ADJUST);
+
+
+ // 2000
+ addDateTestCase(TIME_2000);
+ addDateTestCase(TIME_2000 - TZ_ADJUST);
+
+
+ // 29 Feb 2000
+ addDateTestCase(UTC_29_FEB_2000);
+ addDateTestCase(UTC_29_FEB_2000 - 1000);
+ addDateTestCase(UTC_29_FEB_2000 - TZ_ADJUST);
+
+
+ // Now
+ addDateTestCase( TIME_NOW);
+ addDateTestCase( TIME_NOW - TZ_ADJUST);
+
+
+ // 2005
+ addDateTestCase(UTC_1_JAN_2005);
+ addDateTestCase(UTC_1_JAN_2005 - 1000);
+ addDateTestCase(UTC_1_JAN_2005 - TZ_ADJUST);
+
+
+
+//-----------------------------------------------------------------------------------------------------
+ test();
+//-----------------------------------------------------------------------------------------------------
+
+
+function addTestCase()
+{
+ testcases[tc++] = new TestCase( SECTION, status, expect, actual);
+}
+
+
+function addDateTestCase(date_given_in_milliseconds)
+{
+ givenDate = new Date(date_given_in_milliseconds);
+
+ status = '(' + givenDate + ').toTimeString()';
+ actual = givenDate.toTimeString();
+ expect = extractTimeString(givenDate);
+ addTestCase();
+}
+
+
+/*
+ * As of 2002-01-07, the format for JavaScript dates changed.
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=118266 (SpiderMonkey)
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=118636 (Rhino)
+ *
+ * WAS: Mon Jan 07 13:40:34 GMT-0800 (Pacific Standard Time) 2002
+ * NOW: Mon Jan 07 2002 13:40:34 GMT-0800 (Pacific Standard Time)
+ *
+ * Thus, use a regexp of the form /date.toDateString()(.*)$/
+ * to capture the TimeString into the first backreference -
+ */
+function extractTimeString(date)
+{
+ regexp = new RegExp(date.toDateString() + '(.*)' + '$');
+
+ try
+ {
+ hopeThisIsTimeString = date.toString().match(regexp)[1];
+ }
+ catch(e)
+ {
+ return cnERR;
+ }
+
+ // trim any leading or trailing spaces -
+ return trimL(trimR(hopeThisIsTimeString));
+ }
+
+
+function trimL(s)
+{
+ if (!s) {return cnEmptyString;};
+ for (var i = 0; i!=s.length; i++) {if (s[i] != ' ') {break;}}
+ return s.substring(i);
+}
+
+
+function trimR(s)
+{
+ if (!s) {return cnEmptyString;};
+ for (var i = (s.length - 1); i!=-1; i--) {if (s[i] != ' ') {break;}}
+ return s.substring(0, i+1);
+}
+
+
+function test()
+{
+ for ( tc=0; tc < testcases.length; tc++ )
+ {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description + " = " + testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return (testcases);
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Date/15.9.5.5.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Date/15.9.5.5.js
new file mode 100644
index 0000000..c16002b
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Date/15.9.5.5.js
@@ -0,0 +1,94 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.5.js
+ ECMA Section: 15.9.5.5 Date.prototype.toLocaleString()
+ Description:
+ This function returns a string value. The contents of the string are
+ implementation dependent, but are intended to represent the "date"
+ portion of the Date in the current time zone in a convenient,
+ human-readable form. We can't test the content of the string,
+ but can verify that the object returned is a string.
+
+ The toLocaleString function is not generic; it generates a runtime error
+ if its 'this' value is not a Date object. Therefore it cannot be transferred
+ to other kinds of objects for use as a method.
+
+ Author: pschwartau@netscape.com
+ Date: 14 november 2000
+*/
+
+ var SECTION = "15.9.5.5";
+ var VERSION = "ECMA_3";
+ var TITLE = "Date.prototype.toLocaleString()";
+
+ var status = '';
+ var actual = '';
+ var expect = '';
+
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+
+//-----------------------------------------------------------------------------------------------------
+ var testcases = new Array();
+//-----------------------------------------------------------------------------------------------------
+
+
+ // first, some generic tests -
+
+ status = "typeof (now.toLocaleString())";
+ actual = typeof (now.toLocaleString());
+ expect = "string";
+ addTestCase();
+
+ status = "Date.prototype.toLocaleString.length";
+ actual = Date.prototype.toLocaleString.length;
+ expect = 0;
+ addTestCase();
+
+//-----------------------------------------------------------------------------------------------------
+ test();
+//-----------------------------------------------------------------------------------------------------
+
+
+function addTestCase()
+{
+ testcases[tc++] = new TestCase( SECTION, status, expect, actual);
+}
+
+
+function test()
+{
+ for ( tc=0; tc < testcases.length; tc++ )
+ {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description + " = " + testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return (testcases);
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Date/15.9.5.6.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Date/15.9.5.6.js
new file mode 100644
index 0000000..073d828
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Date/15.9.5.6.js
@@ -0,0 +1,149 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.6.js
+ ECMA Section: 15.9.5.6 Date.prototype.toLocaleDateString()
+ Description:
+ This function returns a string value. The contents of the string are
+ implementation dependent, but are intended to represent the "date"
+ portion of the Date in the current time zone in a convenient,
+ human-readable form. We can't test the content of the string,
+ but can verify that the string is parsable by Date.parse
+
+ The toLocaleDateString function is not generic; it generates a runtime error
+ if its 'this' value is not a Date object. Therefore it cannot be transferred
+ to other kinds of objects for use as a method.
+
+ Author: pschwartau@netscape.com
+ Date: 14 november 2000
+*/
+
+ var SECTION = "15.9.5.6";
+ var VERSION = "ECMA_3";
+ var TITLE = "Date.prototype.toLocaleDateString()";
+
+ var status = '';
+ var actual = '';
+ var expect = '';
+
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+
+//-----------------------------------------------------------------------------------------------------
+ var testcases = new Array();
+//-----------------------------------------------------------------------------------------------------
+
+
+ // first, some generic tests -
+
+ status = "typeof (now.toLocaleDateString())";
+ actual = typeof (now.toLocaleDateString());
+ expect = "string";
+ addTestCase();
+
+ status = "Date.prototype.toLocaleDateString.length";
+ actual = Date.prototype.toLocaleDateString.length;
+ expect = 0;
+ addTestCase();
+
+ /* Date.parse is accurate to the second; valueOf() to the millisecond.
+ Here we expect them to coincide, as we expect a time of exactly midnight - */
+ status = "(Date.parse(now.toLocaleDateString()) - (midnight(now)).valueOf()) == 0";
+ actual = (Date.parse(now.toLocaleDateString()) - (midnight(now)).valueOf()) == 0;
+ expect = true;
+ addTestCase();
+
+
+
+ // 1970
+ addDateTestCase(0);
+ addDateTestCase(TZ_ADJUST);
+
+
+ // 1900
+ addDateTestCase(TIME_1900);
+ addDateTestCase(TIME_1900 - TZ_ADJUST);
+
+
+ // 2000
+ addDateTestCase(TIME_2000);
+ addDateTestCase(TIME_2000 - TZ_ADJUST);
+
+
+ // 29 Feb 2000
+ addDateTestCase(UTC_29_FEB_2000);
+ addDateTestCase(UTC_29_FEB_2000 - 1000);
+ addDateTestCase(UTC_29_FEB_2000 - TZ_ADJUST);
+
+
+ // 2005
+ addDateTestCase(UTC_1_JAN_2005);
+ addDateTestCase(UTC_1_JAN_2005 - 1000);
+ addDateTestCase(UTC_1_JAN_2005 - TZ_ADJUST);
+
+
+
+//-----------------------------------------------------------------------------------------------------
+ test();
+//-----------------------------------------------------------------------------------------------------
+
+
+function addTestCase()
+{
+ testcases[tc++] = new TestCase( SECTION, status, expect, actual);
+}
+
+
+function addDateTestCase(date_given_in_milliseconds)
+{
+ var givenDate = new Date(date_given_in_milliseconds);
+
+ status = 'Date.parse(' + givenDate + ').toLocaleDateString())';
+ actual = Date.parse(givenDate.toLocaleDateString());
+ expect = Date.parse(midnight(givenDate));
+ addTestCase();
+}
+
+
+function midnight(givenDate)
+{
+ // midnight on the given date -
+ return new Date(givenDate.getFullYear(), givenDate.getMonth(), givenDate.getDate());
+}
+
+
+function test()
+{
+ for ( tc=0; tc < testcases.length; tc++ )
+ {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description + " = " + testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return (testcases);
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Date/15.9.5.7.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Date/15.9.5.7.js
new file mode 100644
index 0000000..14b2574
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Date/15.9.5.7.js
@@ -0,0 +1,211 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.7.js
+ ECMA Section: 15.9.5.7 Date.prototype.toLocaleTimeString()
+ Description:
+ This function returns a string value. The contents of the string are
+ implementation dependent, but are intended to represent the "time"
+ portion of the Date in the current time zone in a convenient,
+ human-readable form. We test the content of the string by checking
+ that d.toDateString() + d.toLocaleTimeString() == d.toString()
+
+ The only headache is that as of this writing the "GMT ..." portion of
+ d.toString() is NOT included in d.toLocaleTimeString() as it is in
+ d.toTimeString(). So we have to take that into account.
+
+ Author: pschwartau@netscape.com
+ Date: 14 november 2000
+ Revised: 07 january 2002 because of a change in JS Date format:
+
+ See http://bugzilla.mozilla.org/show_bug.cgi?id=118266 (SpiderMonkey)
+ See http://bugzilla.mozilla.org/show_bug.cgi?id=118636 (Rhino)
+*/
+//-----------------------------------------------------------------------------
+ var SECTION = "15.9.5.7";
+ var VERSION = "ECMA_3";
+ var TITLE = "Date.prototype.toLocaleTimeString()";
+
+ var status = '';
+ var actual = '';
+ var expect = '';
+ var givenDate;
+ var year = '';
+ var regexp = '';
+ var TimeString = '';
+ var reducedDateString = '';
+ var hopeThisIsLocaleTimeString = '';
+ var cnERR ='OOPS! FATAL ERROR: no regexp match in extractLocaleTimeString()';
+
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+
+//-----------------------------------------------------------------------------------------------------
+ var testcases = new Array();
+//-----------------------------------------------------------------------------------------------------
+
+
+ // first, a couple generic tests -
+
+ status = "typeof (now.toLocaleTimeString())";
+ actual = typeof (now.toLocaleTimeString());
+ expect = "string";
+ addTestCase();
+
+ status = "Date.prototype.toLocaleTimeString.length";
+ actual = Date.prototype.toLocaleTimeString.length;
+ expect = 0;
+ addTestCase();
+
+
+
+
+ // 1970
+ addDateTestCase(0);
+ addDateTestCase(TZ_ADJUST);
+
+
+ // 1900
+ addDateTestCase(TIME_1900);
+ addDateTestCase(TIME_1900 - TZ_ADJUST);
+
+
+ // 2000
+ addDateTestCase(TIME_2000);
+ addDateTestCase(TIME_2000 - TZ_ADJUST);
+
+
+ // 29 Feb 2000
+ addDateTestCase(UTC_29_FEB_2000);
+ addDateTestCase(UTC_29_FEB_2000 - 1000);
+ addDateTestCase(UTC_29_FEB_2000 - TZ_ADJUST);
+
+
+ // Now
+ addDateTestCase( TIME_NOW);
+ addDateTestCase( TIME_NOW - TZ_ADJUST);
+
+
+ // 2005
+ addDateTestCase(UTC_1_JAN_2005);
+ addDateTestCase(UTC_1_JAN_2005 - 1000);
+ addDateTestCase(UTC_1_JAN_2005 - TZ_ADJUST);
+
+
+
+//-----------------------------------------------------------------------------------------------------
+ test();
+//-----------------------------------------------------------------------------------------------------
+
+
+function addTestCase()
+{
+ testcases[tc++] = new TestCase( SECTION, status, expect, actual);
+}
+
+
+function addDateTestCase(date_given_in_milliseconds)
+{
+ givenDate = new Date(date_given_in_milliseconds);
+
+ status = '(' + givenDate + ').toLocaleTimeString()';
+ actual = givenDate.toLocaleTimeString();
+ expect = extractLocaleTimeString(givenDate);
+ addTestCase();
+}
+
+
+/*
+ * As of 2002-01-07, the format for JavaScript dates changed.
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=118266 (SpiderMonkey)
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=118636 (Rhino)
+ *
+ * WAS: Mon Jan 07 13:40:34 GMT-0800 (Pacific Standard Time) 2002
+ * NOW: Mon Jan 07 2002 13:40:34 GMT-0800 (Pacific Standard Time)
+ *
+ * So first, use a regexp of the form /date.toDateString()(.*)$/
+ * to capture the TimeString into the first backreference.
+ *
+ * Then remove the GMT string from TimeString (see introduction above)
+ */
+function extractLocaleTimeString(date)
+{
+ regexp = new RegExp(date.toDateString() + '(.*)' + '$');
+ try
+ {
+ TimeString = date.toString().match(regexp)[1];
+ }
+ catch(e)
+ {
+ return cnERR;
+ }
+
+ /*
+ * Now remove the GMT part of the TimeString.
+ * Guard against dates with two "GMT"s, like:
+ * Jan 01 00:00:00 GMT+0000 (GMT Standard Time)
+ */
+ regexp= /([^G]*)GMT.*/;
+ try
+ {
+ hopeThisIsLocaleTimeString = TimeString.match(regexp)[1];
+ }
+ catch(e)
+ {
+ return TimeString;
+ }
+
+ // trim any leading or trailing spaces -
+ return trimL(trimR(hopeThisIsLocaleTimeString));
+}
+
+
+function trimL(s)
+{
+ if (!s) {return cnEmptyString;};
+ for (var i = 0; i!=s.length; i++) {if (s[i] != ' ') {break;}}
+ return s.substring(i);
+}
+
+function trimR(s)
+{
+ for (var i = (s.length - 1); i!=-1; i--) {if (s[i] != ' ') {break;}}
+ return s.substring(0, i+1);
+}
+
+
+function test()
+{
+ for ( tc=0; tc < testcases.length; tc++ )
+ {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description + " = " + testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return (testcases);
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Date/shell.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Date/shell.js
new file mode 100644
index 0000000..43721a7
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Date/shell.js
@@ -0,0 +1,676 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/*
+ * JavaScript shared functions file for running the tests in either
+ * stand-alone JavaScript engine. To run a test, first load this file,
+ * then load the test script.
+ */
+
+var completed = false;
+var testcases;
+var tc = 0;
+
+SECTION = "";
+VERSION = "";
+BUGNUMBER = "";
+
+/*
+ * constant strings
+ */
+var GLOBAL = "[object global]";
+var PASSED = " PASSED!"
+var FAILED = " FAILED! expected: ";
+var DEBUG = false;
+
+
+/*
+* Wrapper for test case constructor that doesn't require the SECTION argument.
+ */
+function AddTestCase( description, expect, actual )
+{
+ testcases[tc++] = new TestCase( SECTION, description, expect, actual );
+}
+
+
+/*
+ * TestCase constructor
+*/
+function TestCase( n, d, e, a )
+{
+ this.name = n;
+ this.description = d;
+ this.expect = e;
+ this.actual = a;
+ this.passed = true;
+ this.reason = "";
+ this.bugnumber = BUGNUMBER;
+ this.passed = getTestCaseResult( this.expect, this.actual );
+ if ( DEBUG ) {writeLineToLog("added " + this.description);}
+}
+
+
+/*
+ * Set up test environment.
+*/
+function startTest()
+{
+ if ( version )
+ {
+ // JavaScript 1.3 is supposed to be compliant ECMA version 1.0
+ if (VERSION == "ECMA_1" ) {version ("130");}
+ if (VERSION == "JS_1.3" ) {version ( "130");}
+ if (VERSION == "JS_1.2" ) {version ( "120");}
+ if (VERSION == "JS_1.1" ) {version( "110");}
+
+ // for ECMA version 2.0, we will leave the JavaScript version
+ // to the default ( for now ).
+ }
+
+ // print out bugnumber
+ if ( BUGNUMBER )
+ {
+ writeLineToLog ("BUGNUMBER: " + BUGNUMBER );
+ }
+
+ testcases = new Array();
+ tc = 0;
+}
+
+
+function test()
+{
+ for ( tc=0; tc < testcases.length; tc++ )
+ {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+
+ stopTest();
+ return ( testcases );
+}
+
+
+/*
+ * Compare expected result to the actual result and figure out whether
+ * the test case passed.
+ */
+function getTestCaseResult(expect, actual )
+{
+ //because ( NaN == NaN ) always returns false, need to do
+ //a special compare to see if we got the right result.
+ if ( actual != actual )
+ {
+ if ( typeof actual == "object" ) {actual = "NaN object";}
+ else {actual = "NaN number";}
+ }
+
+ if ( expect != expect )
+ {
+ if ( typeof expect == "object" ) {expect = "NaN object";}
+ else {expect = "NaN number";}
+ }
+
+ var passed = ( expect == actual ) ? true : false;
+
+ // if both objects are numbers, need to replace w/ IEEE standard for rounding
+ if ( !passed && typeof(actual) == "number" && typeof(expect) == "number" )
+ {
+ if ( Math.abs(actual-expect) < 0.0000001 ) {passed = true;}
+ }
+
+ //verify type is the same
+ if ( typeof(expect) != typeof(actual) ) {passed = false;}
+
+ return passed;
+}
+
+
+/*
+ * Begin printing functions. These functions use the shell's print function.
+* When running tests in the browser, override these functions with functions
+* that use document.write.
+ */
+function writeTestCaseResult( expect, actual, string )
+{
+ var passed = getTestCaseResult(expect, actual );
+ writeFormattedResult( expect, actual, string, passed );
+ return passed;
+}
+
+
+function writeFormattedResult( expect, actual, string, passed )
+{
+ var s = string ;
+ s += ( passed ) ? PASSED : FAILED + expect;
+ writeLineToLog( s);
+ return passed;
+}
+
+
+function writeLineToLog( string )
+{
+ print( string );
+}
+
+
+function writeHeaderToLog( string )
+{
+ print( string );
+}
+/* End of printing functions */
+
+
+/*
+ * When running in the shell, run the garbage collector after the test has completed.
+ */
+function stopTest()
+{
+ var gc;
+ if ( gc != undefined )
+ {
+ gc();
+ }
+}
+
+
+/*
+ * Convenience function for displaying failed test cases.
+ * Useful when running tests manually.
+*/
+function getFailedCases()
+{
+ for (var i = 0; i < testcases.length; i++ )
+ {
+ if ( !testcases[i].passed )
+ {
+ print( testcases[i].description + " = " + testcases[i].actual + " expected: " + testcases[i].expect );
+ }
+ }
+}
+
+
+ /*
+ * Date constants and functions used by tests in Date suite
+*/
+var msPerDay = 86400000;
+var HoursPerDay = 24;
+var MinutesPerHour = 60;
+var SecondsPerMinute = 60;
+var msPerSecond = 1000;
+var msPerMinute = 60000; // msPerSecond * SecondsPerMinute
+var msPerHour = 3600000; // msPerMinute * MinutesPerHour
+var TZ_DIFF = getTimeZoneDiff();
+var TZ_ADJUST = TZ_DIFF * msPerHour;
+var TIME_1970 = 0;
+var TIME_2000 = 946684800000;
+var TIME_1900 = -2208988800000;
+var UTC_29_FEB_2000 = TIME_2000 + 31*msPerDay + 28*msPerDay;
+var UTC_1_JAN_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001) +
+ TimeInYear(2002) + TimeInYear(2003) + TimeInYear(2004);
+var now = new Date();
+var TIME_NOW = now.valueOf(); //valueOf() is to accurate to the millisecond
+ //Date.parse() is accurate only to the second
+
+
+
+/*
+ * Originally, the test suite used a hard-coded value TZ_DIFF = -8.
+ * But that was only valid for testers in the Pacific Standard Time Zone!
+ * We calculate the proper number dynamically for any tester. We just
+ * have to be careful to use a date not subject to Daylight Savings Time...
+*/
+function getTimeZoneDiff()
+{
+ return -((new Date(2000, 1, 1)).getTimezoneOffset())/60;
+}
+
+
+function Day( t)
+{
+ return ( Math.floor( t/msPerDay ) );
+}
+
+
+function DaysInYear( y )
+{
+ if ( y % 4 != 0 ) {return 365;}
+
+ if ( (y%4 == 0) && (y%100 != 0) ) {return 366;}
+
+ if ( (y%100 == 0) && (y%400 != 0) ) {return 365;}
+
+ if ( (y%400 == 0)){return 366;}
+ else {return "ERROR: DaysInYear(" + y + ") case not covered";}
+}
+
+
+function TimeInYear( y )
+{
+ return ( DaysInYear(y) * msPerDay );
+}
+
+
+function DayNumber( t )
+{
+ return ( Math.floor( t / msPerDay ) );
+}
+
+
+function TimeWithinDay( t )
+{
+ if ( t < 0 ) {return ( (t%msPerDay) + msPerDay );}
+ else {return ( t % msPerDay );}
+}
+
+
+function YearNumber( t )
+{
+}
+
+
+function TimeFromYear( y )
+{
+ return ( msPerDay * DayFromYear(y) );
+}
+
+
+function DayFromYear( y )
+{
+ return ( 365*(y-1970) + Math.floor((y-1969)/4) - Math.floor((y-1901)/100)
+ + Math.floor((y-1601)/400) );
+}
+
+
+function InLeapYear( t )
+{
+ if ( DaysInYear(YearFromTime(t)) == 365 ) {return 0;}
+
+ if ( DaysInYear(YearFromTime(t)) == 366 ) {return 1;}
+ else {return "ERROR: InLeapYear(" + t + ") case not covered";}
+}
+
+
+function YearFromTime( t )
+{
+ t =Number( t );
+ var sign = ( t < 0 ) ? -1 : 1;
+ var year = ( sign < 0 ) ? 1969 : 1970;
+
+ for (var timeToTimeZero = t; ; )
+ {
+ // subtract the current year's time from the time that's left.
+ timeToTimeZero -= sign * TimeInYear(year)
+
+ // if there's less than the current year's worth of time left, then break.
+ if ( sign < 0 )
+ {
+ if ( sign * timeToTimeZero <= 0 ) {break;}
+ else {year += sign;}
+ }
+ else
+ {
+ if ( sign * timeToTimeZero < 0 ) {break;}
+ else {year += sign;}
+ }
+ }
+
+ return ( year );
+}
+
+
+function MonthFromTime( t )
+{
+ var day = DayWithinYear( t );
+ var leap = InLeapYear(t);
+
+ // I know I could use switch but I'd rather not until it's part of ECMA
+ if ( (0 <= day) && (day < 31) ) {return 0;}
+ if ( (31 <= day) && (day < (59+leap) )) {return 1;}
+ if ( ((59+leap) <= day) && (day < (90+leap) )) {return 2;}
+ if ( ((90+leap) <= day) && (day < (120+leap) )) {return 3;}
+ if ( ((120+leap) <= day) && (day < (151+leap) )) {return 4;}
+ if ( ((151+leap) <= day) && (day < (181+leap) )) {return 5;}
+ if ( ((181+leap) <= day) && (day < (212+leap) )) {return 6;}
+ if ( ((212+leap) <= day) && (day < (243+leap)) ) {return 7;}
+ if ( ((243+leap) <= day) && (day < (273+leap) )) {return 8;}
+ if ( ((273+leap) <= day) && (day < (304+leap)) ) {return 9;}
+ if ( ((304+leap) <= day) && (day < (334+leap)) ) {return 10;}
+ if ( ((334+leap) <= day) && (day < (365+leap)) ) {return 11;}
+ else {return "ERROR: MonthFromTime(" + t + ") not known";}
+}
+
+
+function DayWithinYear( t )
+{
+ return(Day(t) - DayFromYear(YearFromTime(t)) );
+}
+
+
+function DateFromTime( t )
+{
+ var day = DayWithinYear(t);
+ var month = MonthFromTime(t);
+
+ if ( month == 0) {return ( day + 1 );}
+ if ( month == 1) {return ( day - 30 );}
+ if ( month == 2) {return ( day - 58 - InLeapYear(t) );}
+ if ( month == 3) {return ( day - 89 - InLeapYear(t));}
+ if ( month == 4) {return ( day - 119 - InLeapYear(t));}
+ if ( month == 5) {return ( day - 150 - InLeapYear(t));}
+ if ( month == 6) {return ( day - 180 - InLeapYear(t));}
+ if ( month == 7) {return ( day - 211 - InLeapYear(t));}
+ if ( month == 8) {return ( day - 242 - InLeapYear(t));}
+ if ( month == 9) {return ( day - 272 - InLeapYear(t));}
+ if ( month == 10) {return ( day - 303 - InLeapYear(t));}
+ if ( month == 11) {return ( day - 333 - InLeapYear(t));}
+ return ("ERROR: DateFromTime("+t+") not known" );
+}
+
+
+function WeekDay( t )
+{
+ var weekday = (Day(t)+4)%7;
+ return( weekday < 0 ? 7+weekday : weekday );
+}
+
+
+// missing daylight savings time adjustment
+
+
+function HourFromTime( t )
+{
+ var h = Math.floor( t / msPerHour )%HoursPerDay;
+ return ( (h<0) ? HoursPerDay + h : h );
+}
+
+
+function MinFromTime( t )
+{
+ var min = Math.floor( t / msPerMinute )%MinutesPerHour;
+ return( (min < 0 ) ? MinutesPerHour + min : min );
+}
+
+
+function SecFromTime( t )
+{
+ var sec = Math.floor( t / msPerSecond )%SecondsPerMinute;
+ return ( (sec < 0 ) ? SecondsPerMinute + sec : sec );
+}
+
+
+function msFromTime( t )
+{
+ var ms = t%msPerSecond;
+ return ( (ms < 0 ) ? msPerSecond + ms : ms );
+}
+
+
+function LocalTZA()
+{
+ return ( TZ_DIFF * msPerHour );
+}
+
+
+function UTC( t )
+{
+ return ( t - LocalTZA() - DaylightSavingTA(t - LocalTZA()) );
+}
+
+
+function DaylightSavingTA( t )
+{
+ t = t - LocalTZA();
+
+ var dst_start = GetSecondSundayInMarch(t) + 2*msPerHour;
+ var dst_end = GetFirstSundayInNovember(t) + 2*msPerHour;
+
+ if ( t >= dst_start && t < dst_end ) {return msPerHour;}
+ else {return 0;}
+
+ // Daylight Savings Time starts on the first Sunday in April at 2:00AM in PST.
+ // Other time zones will need to override this function.
+
+print( new Date( UTC(dst_start + LocalTZA())) );
+return UTC(dst_start + LocalTZA());
+}
+
+function GetFirstSundayInApril( t ) {
+ var year = YearFromTime(t);
+ var leap = InLeapYear(t);
+
+ var april = TimeFromYear(year) + TimeInMonth(0, leap) + TimeInMonth(1,leap) +
+ TimeInMonth(2,leap);
+
+ for ( var first_sunday = april; WeekDay(first_sunday) > 0;
+ first_sunday += msPerDay )
+ {
+ ;
+ }
+
+ return first_sunday;
+}
+function GetLastSundayInOctober( t ) {
+ var year = YearFromTime(t);
+ var leap = InLeapYear(t);
+
+ for ( var oct = TimeFromYear(year), m = 0; m < 9; m++ ) {
+ oct += TimeInMonth(m, leap);
+ }
+ for ( var last_sunday = oct + 30*msPerDay; WeekDay(last_sunday) > 0;
+ last_sunday -= msPerDay )
+ {
+ ;
+ }
+ return last_sunday;
+}
+
+// Added these two functions because DST rules changed for the US.
+function GetSecondSundayInMarch( t ) {
+ var year = YearFromTime(t);
+ var leap = InLeapYear(t);
+
+ var march = TimeFromYear(year) + TimeInMonth(0, leap) + TimeInMonth(1,leap);
+
+ var sundayCount = 0;
+ var flag = true;
+ for ( var second_sunday = march; flag; second_sunday += msPerDay )
+ {
+ if (WeekDay(second_sunday) == 0) {
+ if(++sundayCount == 2)
+ flag = false;
+ }
+ }
+
+ return second_sunday;
+}
+function GetFirstSundayInNovember( t ) {
+ var year = YearFromTime(t);
+ var leap = InLeapYear(t);
+
+ for ( var nov = TimeFromYear(year), m = 0; m < 10; m++ ) {
+ nov += TimeInMonth(m, leap);
+ }
+ for ( var first_sunday = nov; WeekDay(first_sunday) > 0;
+ first_sunday += msPerDay )
+ {
+ ;
+ }
+ return first_sunday;
+}
+
+
+function LocalTime( t )
+{
+ return ( t + LocalTZA() + DaylightSavingTA(t) );
+}
+
+
+function MakeTime( hour, min, sec, ms )
+{
+ if ( isNaN(hour) || isNaN(min) || isNaN(sec) || isNaN(ms) ){return Number.NaN;}
+
+ hour = ToInteger(hour);
+ min = ToInteger( min);
+ sec = ToInteger( sec);
+ ms = ToInteger( ms );
+
+ return( (hour*msPerHour) + (min*msPerMinute) + (sec*msPerSecond) + ms );
+}
+
+
+function MakeDay( year, month, date )
+{
+ if ( isNaN(year) || isNaN(month) || isNaN(date)) {return Number.NaN;}
+
+ year = ToInteger(year);
+ month = ToInteger(month);
+ date = ToInteger(date );
+
+ var sign = ( year < 1970 ) ? -1 : 1;
+ var t = ( year < 1970 ) ? 1 : 0;
+ var y = ( year < 1970 ) ? 1969 : 1970;
+
+ var result5 = year + Math.floor( month/12 );
+ var result6= month%12;
+
+ if ( year < 1970 )
+ {
+ for ( y = 1969; y >= year; y += sign )
+ {
+ t += sign * TimeInYear(y);
+ }
+ }
+ else
+ {
+ for ( y = 1970 ; y < year; y += sign )
+ {
+ t += sign * TimeInYear(y);
+ }
+ }
+
+ var leap = InLeapYear( t );
+
+ for ( var m = 0; m < month; m++)
+ {
+ t += TimeInMonth( m, leap );
+ }
+
+ if ( YearFromTime(t) != result5 ) {return Number.NaN;}
+ if ( MonthFromTime(t) != result6 ) {return Number.NaN;}
+ if ( DateFromTime(t) != 1 ){return Number.NaN;}
+
+ return ( (Day(t)) + date - 1 );
+}
+
+
+function TimeInMonth( month, leap )
+{
+ // Jan 0 Feb 1 Mar 2 Apr 3 May 4 June 5 Jul 6 Aug 7 Sep 8 Oct 9 Nov 10 Dec11
+
+ // April June September November
+ if ( month == 3 || month == 5 || month == 8 || month == 10 ) {return ( 30*msPerDay );}
+
+ // all the rest
+ if ( month == 0 || month == 2 || month == 4 || month == 6 ||
+ month == 7 || month == 9 || month == 11 ) {return ( 31*msPerDay );}
+
+ // save February
+ return ( (leap == 0) ? 28*msPerDay : 29*msPerDay );
+}
+
+
+function MakeDate( day, time )
+{
+ if (day == Number.POSITIVE_INFINITY ||
+ day == Number.NEGATIVE_INFINITY ||
+ day == Number.NaN )
+ {
+ return Number.NaN;
+ }
+
+ if ( time == Number.POSITIVE_INFINITY ||
+ time == Number.POSITIVE_INFINITY ||
+ day == Number.NaN)
+ {
+ return Number.NaN;
+ }
+
+ return ( day * msPerDay ) + time;
+}
+
+
+function TimeClip( t )
+{
+ if ( isNaN( t )) {return ( Number.NaN);}
+ if ( Math.abs( t ) > 8.64e15 ) {return ( Number.NaN);}
+
+ return ( ToInteger( t ) );
+}
+
+
+function ToInteger( t )
+{
+ t = Number( t );
+
+ if ( isNaN( t )) {return ( Number.NaN);}
+
+ if ( t == 0 || t == -0 ||
+ t == Number.POSITIVE_INFINITY ||
+ t == Number.NEGATIVE_INFINITY)
+ {
+ return 0;
+ }
+
+ var sign = ( t < 0 ) ? -1 : 1;
+
+ return ( sign * Math.floor( Math.abs( t ) ) );
+}
+
+
+function Enumerate( o )
+{
+ var p;
+ for ( p in o ) {print( p + ": " + o[p] );}
+}
+
+
+/* these functions are useful for running tests manually in Rhino */
+
+function GetContext()
+{
+ return Packages.com.netscape.javascript.Context.getCurrentContext();
+}
+
+
+function OptLevel( i )
+{
+ i = Number(i);
+ var cx = GetContext();
+ cx.setOptimizationLevel(i);
+}
+
+/* end of Rhino functions */
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.1.1.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.1.1.js
new file mode 100644
index 0000000..3aab137
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.1.1.js
@@ -0,0 +1,132 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2002
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): joerg.schaible@gmx.de
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 27 Nov 2002
+* SUMMARY: Ensuring normal function call of Error (ECMA-262 Ed.3 15.11.1.1).
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = '';
+var summary = 'Ensuring normal function call of Error (ECMA-262 Ed.3 15.11.1.1)';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+var EMPTY_STRING = '';
+var EXPECTED_FORMAT = 0;
+
+
+function otherScope(msg)
+{
+ return Error(msg);
+}
+
+
+status = inSection(1);
+var err1 = Error('msg1');
+actual = examineThis(err1, 'msg1');
+expect = EXPECTED_FORMAT;
+addThis();
+
+status = inSection(2);
+var err2 = otherScope('msg2');
+actual = examineThis(err2, 'msg2');
+expect = EXPECTED_FORMAT;
+addThis();
+
+status = inSection(3);
+var err3 = otherScope();
+actual = examineThis(err3, EMPTY_STRING);
+expect = EXPECTED_FORMAT;
+addThis();
+
+status = inSection(4);
+var err4 = eval("Error('msg4')");
+actual = examineThis(err4, 'msg4');
+expect = EXPECTED_FORMAT;
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+/*
+ * Searches err.toString() for err.name + ':' + err.message,
+ * with possible whitespace on each side of the colon sign.
+ *
+ * We allow for no colon in case err.message was not provided by the user.
+ * In such a case, SpiderMonkey and Rhino currently set err.message = '',
+ * as allowed for by ECMA 15.11.4.3. This makes |pattern| work in this case.
+ *
+ * If this is ever changed to a non-empty string, e.g. 'undefined',
+ * you may have to modify |pattern| to take that into account -
+ *
+ */
+function examineThis(err, msg)
+{
+ var pattern = err.name + '\\s*:?\\s*' + msg;
+ return err.toString().search(RegExp(pattern));
+}
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ for (var i = 0; i < UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.4.4-1.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.4.4-1.js
new file mode 100644
index 0000000..ca05e7e
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.4.4-1.js
@@ -0,0 +1,169 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2001
+* the Initial Developer. All Rights Reserved.
+*
+* Contributors: d-russo@ti.com, pschwartau@netscape.com, joerg.schaible@gmx.de
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 22 Jan 2002
+* SUMMARY: Testing Error.prototype.toString()
+*
+* Revised: 25 Nov 2002
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=181909
+*
+* Note that ECMA-262 3rd Edition Final, Section 15.11.4.4 states that
+* Error.prototype.toString() returns an implementation-dependent string.
+* Therefore any testcase on this property is somewhat arbitrary.
+*
+* However, d-russo@ti.com pointed out that Rhino was returning this:
+*
+* js> err = new Error()
+* undefined: undefined
+*
+* js> err = new Error("msg")
+* undefined: msg
+*
+*
+* We expect Rhino to return what SpiderMonkey currently does:
+*
+* js> err = new Error()
+* Error
+*
+* js> err = new Error("msg")
+* Error: msg
+*
+*
+* i.e. we expect err.toString() === err.name if err.message is not defined;
+* otherwise, we expect err.toString() === err.name + ': ' + err.message.
+*
+* See also ECMA 15.11.4.2, 15.11.4.3
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = '(none)';
+var summary = 'Testing Error.prototype.toString()';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+var EMPTY_STRING = '';
+var EXPECTED_FORMAT = 0;
+
+
+status = inSection(1);
+var err1 = new Error('msg1');
+actual = examineThis(err1, 'msg1');
+expect = EXPECTED_FORMAT;
+addThis();
+
+status = inSection(2);
+var err2 = new Error(err1);
+actual = examineThis(err2, err1);
+expect = EXPECTED_FORMAT;
+addThis();
+
+status = inSection(3);
+var err3 = new Error();
+actual = examineThis(err3, EMPTY_STRING);
+expect = EXPECTED_FORMAT;
+addThis();
+
+status = inSection(4);
+var err4 = new Error(EMPTY_STRING);
+actual = examineThis(err4, EMPTY_STRING);
+expect = EXPECTED_FORMAT;
+addThis();
+
+// now generate a run-time error -
+status = inSection(5);
+try
+{
+ eval('1=2');
+}
+catch(err5)
+{
+ actual = examineThis(err5, '.*');
+}
+expect = EXPECTED_FORMAT;
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+/*
+ * Searches err.toString() for err.name + ':' + err.message,
+ * with possible whitespace on each side of the colon sign.
+ *
+ * We allow for no colon in case err.message was not provided by the user.
+ * In such a case, SpiderMonkey and Rhino currently set err.message = '',
+ * as allowed for by ECMA 15.11.4.3. This makes |pattern| work in this case.
+ *
+ * If this is ever changed to a non-empty string, e.g. 'undefined',
+ * you may have to modify |pattern| to take that into account -
+ *
+ */
+function examineThis(err, msg)
+{
+ var pattern = err.name + '\\s*:?\\s*' + msg;
+ return err.toString().search(RegExp(pattern));
+}
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ for (var i = 0; i < UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.7.6-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.7.6-001.js
new file mode 100644
index 0000000..a8097f5
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.7.6-001.js
@@ -0,0 +1,125 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2003
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): igor@fastmail.fm, pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 14 April 2003
+* SUMMARY: Prototype of predefined error objects should be DontEnum
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=201989
+*
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 201989;
+var summary = 'Prototype of predefined error objects should be DontEnum';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+/*
+ * Tests that |F.prototype| is not enumerable in |F|
+ */
+function testDontEnum(F)
+{
+ var proto = F.prototype;
+
+ for (var prop in F)
+ {
+ if (F[prop] === proto)
+ return false;
+ }
+ return true;
+}
+
+
+var list = [
+ "Error",
+ "ConversionError",
+ "EvalError",
+ "RangeError",
+ "ReferenceError",
+ "SyntaxError",
+ "TypeError",
+ "URIError"
+];
+
+
+for (i in list)
+{
+ var F = this[list[i]];
+
+ // Test for |F|; e.g. Rhino defines |ConversionError| while SM does not.
+ if (F)
+ {
+ status = 'Testing DontEnum attribute of |' + list[i] + '.prototype|';
+ actual = testDontEnum(F);
+ expect = true;
+ addThis();
+ }
+}
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.7.6-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.7.6-002.js
new file mode 100644
index 0000000..f0fae24
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.7.6-002.js
@@ -0,0 +1,120 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2003
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): igor@fastmail.fm, pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 14 April 2003
+* SUMMARY: Prototype of predefined error objects should be DontDelete
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=201989
+*
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 201989;
+var summary = 'Prototype of predefined error objects should be DontDelete';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+/*
+ * Tests that |F.prototype| is DontDelete
+ */
+function testDontDelete(F)
+{
+ var orig = F.prototype;
+ delete F.prototype;
+ return F.prototype === orig;
+}
+
+
+var list = [
+ "Error",
+ "ConversionError",
+ "EvalError",
+ "RangeError",
+ "ReferenceError",
+ "SyntaxError",
+ "TypeError",
+ "URIError"
+];
+
+
+for (i in list)
+{
+ var F = this[list[i]];
+
+ // Test for |F|; e.g. Rhino defines |ConversionError| while SM does not.
+ if (F)
+ {
+ status = 'Testing DontDelete attribute of |' + list[i] + '.prototype|';
+ actual = testDontDelete(F);
+ expect = true;
+ addThis();
+ }
+}
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.7.6-003.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.7.6-003.js
new file mode 100644
index 0000000..5840427
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.7.6-003.js
@@ -0,0 +1,120 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2003
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): igor@fastmail.fm, pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 14 April 2003
+* SUMMARY: Prototype of predefined error objects should be ReadOnly
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=201989
+*
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 201989;
+var summary = 'Prototype of predefined error objects should be ReadOnly';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+/*
+ * Tests that |F.prototype| is ReadOnly
+ */
+function testReadOnly(F)
+{
+ var orig = F.prototype;
+ F.prototype = new Object();
+ return F.prototype === orig;
+}
+
+
+var list = [
+ "Error",
+ "ConversionError",
+ "EvalError",
+ "RangeError",
+ "ReferenceError",
+ "SyntaxError",
+ "TypeError",
+ "URIError"
+];
+
+
+for (i in list)
+{
+ var F = this[list[i]];
+
+ // Test for |F|; e.g. Rhino defines |ConversionError| while SM does not.
+ if (F)
+ {
+ status = 'Testing ReadOnly attribute of |' + list[i] + '.prototype|';
+ actual = testReadOnly(F);
+ expect = true;
+ addThis();
+ }
+}
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/binding-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/binding-001.js
new file mode 100644
index 0000000..72ff55e
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/binding-001.js
@@ -0,0 +1,106 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an
+* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either expressed
+* or implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation.
+* All Rights Reserved.
+*
+* Contributor(s): brendan@mozilla.org, pschwartau@netscape.com
+* Date: 2001-08-27
+*
+* SUMMARY: Testing binding of function names
+*
+* Brendan:
+*
+* "... the question is, does Rhino bind 'sum' in the global object
+* for the following test? If it does, it's buggy.
+*
+* var f = function sum(){};
+* print(sum); // should fail with 'sum is not defined' "
+*
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = '(none)';
+var summary = 'Testing binding of function names';
+var ERR_REF_YES = 'ReferenceError';
+var ERR_REF_NO = 'did NOT generate a ReferenceError';
+var statusitems = [];
+var actualvalues = [];
+var expectedvalues = [];
+var status = summary;
+var actual = ERR_REF_NO;
+var expect= ERR_REF_YES;
+
+
+try
+{
+ var f = function sum(){};
+ print(sum);
+}
+catch (e)
+{
+ status = 'Section 1 of test';
+ actual = e instanceof ReferenceError;
+ expect = true;
+ addThis();
+
+
+ /*
+ * This test is more literal, and one day may not be valid.
+ * Searching for literal string "ReferenceError" in e.toString()
+ */
+ status = 'Section 2 of test';
+ var match = e.toString().search(/ReferenceError/);
+ actual = (match > -1);
+ expect = true;
+ addThis();
+}
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = isReferenceError(actual);
+ expectedvalues[UBound] = isReferenceError(expect);
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ for (var i = 0; i < UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
+
+
+// converts a Boolean result into a textual result -
+function isReferenceError(bResult)
+{
+ return bResult? ERR_REF_YES : ERR_REF_NO;
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/regress-181654.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/regress-181654.js
new file mode 100644
index 0000000..d65efff
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/regress-181654.js
@@ -0,0 +1,150 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2002
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): joerg.schaible@gmx.de
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 23 Nov 2002
+* SUMMARY: Calling toString for an object derived from the Error class
+* results in an TypeError (Rhino only)
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=181654
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = '181654';
+var summary = 'Calling toString for an object derived from the Error class should be possible.';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+var EMPTY_STRING = '';
+var EXPECTED_FORMAT = 0;
+
+
+// derive MyError from Error
+function MyError( msg )
+{
+ this.message = msg;
+}
+MyError.prototype = new Error();
+MyError.prototype.name = "MyError";
+
+
+status = inSection(1);
+var err1 = new MyError('msg1');
+actual = examineThis(err1, 'msg1');
+expect = EXPECTED_FORMAT;
+addThis();
+
+status = inSection(2);
+var err2 = new MyError(err1);
+actual = examineThis(err2, err1);
+expect = EXPECTED_FORMAT;
+addThis();
+
+status = inSection(3);
+var err3 = new MyError();
+actual = examineThis(err3, EMPTY_STRING);
+expect = EXPECTED_FORMAT;
+addThis();
+
+status = inSection(4);
+var err4 = new MyError(EMPTY_STRING);
+actual = examineThis(err4, EMPTY_STRING);
+expect = EXPECTED_FORMAT;
+addThis();
+
+// now generate an error -
+status = inSection(5);
+try
+{
+ throw new MyError("thrown");
+}
+catch(err5)
+{
+ actual = examineThis(err5, "thrown");
+}
+expect = EXPECTED_FORMAT;
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+/*
+ * Searches err.toString() for err.name + ':' + err.message,
+ * with possible whitespace on each side of the colon sign.
+ *
+ * We allow for no colon in case err.message was not provided by the user.
+ * In such a case, SpiderMonkey and Rhino currently set err.message = '',
+ * as allowed for by ECMA 15.11.4.3. This makes |pattern| work in this case.
+ *
+ * If this is ever changed to a non-empty string, e.g. 'undefined',
+ * you may have to modify |pattern| to take that into account -
+ *
+ */
+function examineThis(err, msg)
+{
+ var pattern = err.name + '\\s*:?\\s*' + msg;
+ return err.toString().search(RegExp(pattern));
+}
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ for (var i = 0; i < UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/regress-181914.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/regress-181914.js
new file mode 100644
index 0000000..adf0b46
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/regress-181914.js
@@ -0,0 +1,189 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2002
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): joerg.schaible@gmx.de, pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 25 Nov 2002
+* SUMMARY: Calling a user-defined superconstructor
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=181914, esp. Comment 10.
+*
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = '181914';
+var summary = 'Calling a user-defined superconstructor';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+var EMPTY_STRING = '';
+var EXPECTED_FORMAT = 0;
+
+
+// make a user-defined version of the Error constructor
+function _Error(msg)
+{
+ this.message = msg;
+}
+_Error.prototype = new Error();
+_Error.prototype.name = '_Error';
+
+
+// derive MyApplyError from _Error
+function MyApplyError(msg)
+{
+ if(this instanceof MyApplyError)
+ _Error.apply(this, arguments);
+ else
+ return new MyApplyError(msg);
+}
+MyApplyError.prototype = new _Error();
+MyApplyError.prototype.name = "MyApplyError";
+
+
+// derive MyCallError from _Error
+function MyCallError(msg)
+{
+ if(this instanceof MyCallError)
+ _Error.call(this, msg);
+ else
+ return new MyCallError(msg);
+}
+MyCallError.prototype = new _Error();
+MyCallError.prototype.name = "MyCallError";
+
+
+function otherScope(msg)
+{
+ return MyApplyError(msg);
+}
+
+
+status = inSection(1);
+var err1 = new MyApplyError('msg1');
+actual = examineThis(err1, 'msg1');
+expect = EXPECTED_FORMAT;
+addThis();
+
+status = inSection(2);
+var err2 = new MyCallError('msg2');
+actual = examineThis(err2, 'msg2');
+expect = EXPECTED_FORMAT;
+addThis();
+
+status = inSection(3);
+var err3 = MyApplyError('msg3');
+actual = examineThis(err3, 'msg3');
+expect = EXPECTED_FORMAT;
+addThis();
+
+status = inSection(4);
+var err4 = MyCallError('msg4');
+actual = examineThis(err4, 'msg4');
+expect = EXPECTED_FORMAT;
+addThis();
+
+status = inSection(5);
+var err5 = otherScope('msg5');
+actual = examineThis(err5, 'msg5');
+expect = EXPECTED_FORMAT;
+addThis();
+
+status = inSection(6);
+var err6 = otherScope();
+actual = examineThis(err6, EMPTY_STRING);
+expect = EXPECTED_FORMAT;
+addThis();
+
+status = inSection(7);
+var err7 = eval("MyApplyError('msg7')");
+actual = examineThis(err7, 'msg7');
+expect = EXPECTED_FORMAT;
+addThis();
+
+status = inSection(8);
+var err8;
+try
+{
+ throw MyApplyError('msg8');
+}
+catch(e)
+{
+ if(e instanceof Error)
+ err8 = e;
+}
+actual = examineThis(err8, 'msg8');
+expect = EXPECTED_FORMAT;
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+// Searches |err.toString()| for |err.name + ':' + err.message|
+function examineThis(err, msg)
+{
+ var pattern = err.name + '\\s*:?\\s*' + msg;
+ return err.toString().search(RegExp(pattern));
+}
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ for (var i = 0; i < UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/regress-58946.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/regress-58946.js
new file mode 100644
index 0000000..e2fc798
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/regress-58946.js
@@ -0,0 +1,56 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS
+* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+* implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation. All
+* Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+*
+*
+*This test arose from Bugzilla bug 58946.
+*The bug was filed when we got the following error (see code below):
+*
+* "ReferenceError: e is not defined"
+*
+*There was no error if we replaced "return e" in the code below with "print(e)".
+*There should be no error with "return e", either -
+*/
+//-------------------------------------------------------------------------------------------------
+var bug = '58946';
+var stat = 'Testing a return statement inside a catch statement inside a function';
+
+
+test();
+
+
+function test() {
+ enterFunc ("test");
+ printBugNumber (bug);
+ printStatus (stat);
+
+
+ try
+ {
+ throw 'PASS';
+ }
+
+ catch(e)
+ {
+ return e;
+ }
+
+
+ exitFunc ("test");
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/regress-95101.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/regress-95101.js
new file mode 100644
index 0000000..59b5209
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/regress-95101.js
@@ -0,0 +1,97 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS
+* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+* implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation.
+* All Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+* Date: 13 August 2001
+*
+* SUMMARY: Invoking an undefined function should produce a ReferenceError
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=95101
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 95101;
+var summary = 'Invoking an undefined function should produce a ReferenceError';
+var msgERR_REF_YES = 'ReferenceError';
+var msgERR_REF_NO = 'did NOT generate a ReferenceError';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+try
+{
+ xxxyyyzzz();
+}
+catch (e)
+{
+ status = 'Section 1 of test';
+ actual = e instanceof ReferenceError;
+ expect = true;
+ addThis();
+
+
+ /*
+ * This test is more literal, and may one day be invalid.
+ * Searching for literal string "ReferenceError" in e.toString()
+ */
+ status = 'Section 2 of test';
+ var match = e.toString().search(/ReferenceError/);
+ actual = (match > -1);
+ expect = true;
+ addThis();
+}
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = isReferenceError(actual);
+ expectedvalues[UBound] = isReferenceError(expect);
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ for (var i = 0; i < UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
+
+
+// converts a Boolean result into a textual result -
+function isReferenceError(bResult)
+{
+ return bResult? msgERR_REF_YES : msgERR_REF_NO;
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/ExecutionContexts/10.1.3-1.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/ExecutionContexts/10.1.3-1.js
new file mode 100644
index 0000000..a29d2a4
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/ExecutionContexts/10.1.3-1.js
@@ -0,0 +1,196 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2002
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 11 Feb 2002
+* SUMMARY: Testing functions having duplicate formal parameter names
+*
+* Note: given function f(x,x,x,x) {return x;}; f(1,2,3,4) should return 4.
+* See ECMA-262 3rd Edition Final Section 10.1.3: Variable Instantiation
+*
+* Also see http://bugzilla.mozilla.org/show_bug.cgi?id=124900
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 124900;
+var summary = 'Testing functions having duplicate formal parameter names';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+function f1(x,x)
+{
+ return x;
+}
+status = inSection(1);
+actual = f1(1,2);
+expect = 2;
+addThis();
+
+
+function f2(x,x,x)
+{
+ return x*x*x;
+}
+status = inSection(2);
+actual = f2(1,2,3);
+expect = 27;
+addThis();
+
+
+function f3(x,x,x,x)
+{
+ return 'a' + x + 'b' + x + 'c' + x ;
+}
+status = inSection(3);
+actual = f3(1,2,3,4);
+expect = 'a4b4c4';
+addThis();
+
+
+/*
+ * If the value of the last duplicate parameter is not provided by
+ * the function caller, the value of this parameter is undefined
+ */
+function f4(x,a,b,x,z)
+{
+ return x;
+}
+status = inSection(4);
+actual = f4(1,2);
+expect = undefined;
+addThis();
+
+
+/*
+ * f.toString() should preserve any duplicate formal parameter names that exist
+ */
+function f5(x,x,x,x)
+{
+}
+status = inSection(5);
+actual = f5.toString().match(/\((.*)\)/)[1];
+actual = actual.replace(/\s/g, ''); // for definiteness, remove any white space
+expect = 'x,x,x,x';
+addThis();
+
+
+function f6(x,x,x,x)
+{
+ var ret = [];
+
+ for (var i=0; i<arguments.length; i++)
+ ret.push(arguments[i]);
+
+ return ret.toString();
+}
+status = inSection(6);
+actual = f6(1,2,3,4);
+expect = '1,2,3,4';
+addThis();
+
+
+/*
+ * This variation (assigning to x inside f) is from nboyd@atg.com
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=124900
+ */
+function f7(x,x,x,x)
+{
+ x = 999;
+ var ret = [];
+
+ for (var i=0; i<arguments.length; i++)
+ ret.push(arguments[i]);
+
+ return ret.toString();
+}
+status = inSection(7);
+actual = f7(1,2,3,4);
+expect = '1,2,3,999';
+addThis();
+
+
+/*
+ * Same as above, but with |var| keyword added -
+ */
+function f8(x,x,x,x)
+{
+ var x = 999;
+ var ret = [];
+
+ for (var i=0; i<arguments.length; i++)
+ ret.push(arguments[i]);
+
+ return ret.toString();
+}
+status = inSection(8);
+actual = f8(1,2,3,4);
+expect = '1,2,3,999';
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/ExecutionContexts/10.1.3-2.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/ExecutionContexts/10.1.3-2.js
new file mode 100644
index 0000000..f969ca0
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/ExecutionContexts/10.1.3-2.js
@@ -0,0 +1,157 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2002
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 11 Feb 2002
+* SUMMARY: Testing functions having duplicate formal parameter names
+*
+* SpiderMonkey was crashing on each case below if the parameters had
+* the same name. But duplicate parameter names are permitted by ECMA;
+* see ECMA-262 3rd Edition Final Section 10.1.3
+*
+* NOTE: Rhino does not have toSource() and uneval(); they are non-ECMA
+* extensions to the language. So we include a test for them at the beginning -
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = '(none)';
+var summary = 'Testing functions having duplicate formal parameter names';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+var OBJ = new Object();
+var OBJ_TYPE = OBJ.toString();
+
+/*
+ * Exit if the implementation doesn't support toSource() or uneval(),
+ * since these are non-ECMA extensions to the language -
+ */
+try
+{
+ if (!OBJ.toSource || !uneval(OBJ))
+ quit();
+}
+catch(e)
+{
+ quit();
+}
+
+
+/*
+ * OK, now begin the test. Just checking that we don't crash on these -
+ */
+function f1(x,x,x,x)
+{
+ var ret = eval(arguments.toSource());
+ return ret.toString();
+}
+status = inSection(1);
+actual = f1(1,2,3,4);
+expect = OBJ_TYPE;
+addThis();
+
+
+/*
+ * Same thing, but preface |arguments| with the function name
+ */
+function f2(x,x,x,x)
+{
+ var ret = eval(f2.arguments.toSource());
+ return ret.toString();
+}
+status = inSection(2);
+actual = f2(1,2,3,4);
+expect = OBJ_TYPE;
+addThis();
+
+
+function f3(x,x,x,x)
+{
+ var ret = eval(uneval(arguments));
+ return ret.toString();
+}
+status = inSection(3);
+actual = f3(1,2,3,4);
+expect = OBJ_TYPE;
+addThis();
+
+
+/*
+ * Same thing, but preface |arguments| with the function name
+ */
+function f4(x,x,x,x)
+{
+ var ret = eval(uneval(f4.arguments));
+ return ret.toString();
+}
+status = inSection(4);
+actual = f4(1,2,3,4);
+expect = OBJ_TYPE;
+addThis();
+
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/ExecutionContexts/10.1.3.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/ExecutionContexts/10.1.3.js
new file mode 100644
index 0000000..468589a
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/ExecutionContexts/10.1.3.js
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ * Rob Ginda rginda@netscape.com
+ */
+
+/**
+ ECMA Section: 10.1.3: Variable Instantiation
+ FunctionDeclarations are processed before VariableDeclarations, and
+ VariableDeclarations don't replace existing values with undefined
+*/
+
+test();
+
+function f()
+{
+ var x;
+
+ return typeof x;
+
+ function x()
+ {
+ return 7;
+ }
+}
+
+function test()
+{
+ enterFunc ("test");
+
+ printStatus ("ECMA Section: 10.1.3: Variable Instantiation.");
+ printBugNumber (17290);
+
+ reportCompare ("function", f(), "Declaration precedence test");
+
+ exitFunc("test");
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/ExecutionContexts/10.1.4-1.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/ExecutionContexts/10.1.4-1.js
new file mode 100644
index 0000000..f4b6f5d
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/ExecutionContexts/10.1.4-1.js
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ * Rob Ginda rginda@netscape.com
+ */
+
+/**
+ ECMA Section: 10.1.4.1 Entering An Execution Context
+ ECMA says:
+ * Global Code, Function Code
+ Variable instantiation is performed using the global object as the
+ variable object and using property attributes { DontDelete }.
+
+ * Eval Code
+ Variable instantiation is performed using the calling context's
+ variable object and using empty property attributes.
+*/
+
+test();
+
+function test()
+{
+ enterFunc ("test");
+
+ var y;
+ eval("var x = 1");
+
+ if (delete y)
+ reportFailure ("Expected *NOT* to be able to delete y");
+
+ if (typeof x == "undefined")
+ reportFailure ("x did not remain defined after eval()");
+ else if (x != 1)
+ reportFailure ("x did not retain it's value after eval()");
+
+ if (!delete x)
+ reportFailure ("Expected to be able to delete x");
+
+ exitFunc("test");
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/ExecutionContexts/regress-23346.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/ExecutionContexts/regress-23346.js
new file mode 100644
index 0000000..d831720
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/ExecutionContexts/regress-23346.js
@@ -0,0 +1,53 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ * Rob Ginda rginda@netscape.com
+ */
+
+var CALL_CALLED = "PASSED";
+
+test();
+
+function f(x)
+{
+ if (x)
+ return call();
+
+ return "FAILED!";
+}
+
+function call()
+{
+ return CALL_CALLED;
+}
+
+function test()
+{
+ enterFunc ("test");
+
+ printStatus ("ECMA Section: 10.1.3: Variable Instantiation.");
+ printBugNumber (23346);
+
+ reportCompare ("PASSED", f(true),
+ "Unqualified reference should not see Function.prototype");
+
+ exitFunc("test");
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Expressions/11.6.1-1.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Expressions/11.6.1-1.js
new file mode 100644
index 0000000..0963ef7
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Expressions/11.6.1-1.js
@@ -0,0 +1,171 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2003
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): bzbarsky@mit.edu, pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 14 Mar 2003
+* SUMMARY: Testing left-associativity of the + operator
+*
+* See ECMA-262 Ed.3, Section 11.6.1, "The Addition operator"
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=196290
+*
+* The upshot: |a + b + c| should always equal |(a + b) + c|
+*
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 196290;
+var summary = 'Testing left-associativity of the + operator';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+status = inSection(1);
+actual = 1 + 1 + 'px';
+expect = '2px';
+addThis();
+
+status = inSection(2);
+actual = 'px' + 1 + 1;
+expect = 'px11';
+addThis();
+
+status = inSection(3);
+actual = 1 + 1 + 1 + 'px';
+expect = '3px';
+addThis();
+
+status = inSection(4);
+actual = 1 + 1 + 'a' + 1 + 1 + 'b';
+expect = '2a11b';
+addThis();
+
+/*
+ * The next sections test the + operator via eval()
+ */
+status = inSection(5);
+actual = sumThese(1, 1, 'a', 1, 1, 'b');
+expect = '2a11b';
+addThis();
+
+status = inSection(6);
+actual = sumThese(new Number(1), new Number(1), 'a');
+expect = '2a';
+addThis();
+
+status = inSection(7);
+actual = sumThese('a', new Number(1), new Number(1));
+expect = 'a11';
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+/*
+ * Applies the + operator to the provided arguments via eval().
+ *
+ * Form an eval string of the form 'arg1 + arg2 + arg3', but
+ * remember to add double-quotes inside the eval string around
+ * any argument that is of string type. For example, suppose the
+ * arguments were 11, 'a', 22. Then the eval string should be
+ *
+ * arg1 + quoteThis(arg2) + arg3
+ *
+ * If we didn't put double-quotes around the string argument,
+ * we'd get this for an eval string:
+ *
+ * '11 + a + 22'
+ *
+ * If we eval() this, we get 'ReferenceError: a is not defined'.
+ * With proper quoting, we get eval('11 + "a" + 22') as desired.
+ */
+function sumThese()
+{
+ var sEval = '';
+ var arg;
+ var i;
+
+ var L = arguments.length;
+ for (i=0; i<L; i++)
+ {
+ arg = arguments[i];
+ if (typeof arg === 'string')
+ arg = quoteThis(arg);
+
+ if (i < L-1)
+ sEval += arg + ' + ';
+ else
+ sEval += arg;
+ }
+
+ return eval(sEval);
+}
+
+
+function quoteThis(x)
+{
+ return '"' + x + '"';
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Expressions/11.9.6-1.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Expressions/11.9.6-1.js
new file mode 100644
index 0000000..8153585
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Expressions/11.9.6-1.js
@@ -0,0 +1,208 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2002
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 20 Feb 2002
+* SUMMARY: Testing the comparison |undefined === null|
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=126722
+*
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 126722;
+var summary = 'Testing the comparison |undefined === null|';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+status = inSection(1);
+if (undefined === null)
+ actual = true;
+else
+ actual = false;
+expect = false;
+addThis();
+
+
+
+status = inSection(2);
+switch(true)
+{
+ case (undefined === null) :
+ actual = true;
+ break;
+
+ default:
+ actual = false;
+}
+expect = false;
+addThis();
+
+
+
+status = inSection(3);
+function f3(x)
+{
+ var res = false;
+
+ switch(true)
+ {
+ case (x === null) :
+ res = true;
+ break;
+
+ default:
+ // do nothing
+ }
+
+ return res;
+}
+
+actual = f3(undefined);
+expect = false;
+addThis();
+
+
+
+status = inSection(4);
+function f4(arr)
+{
+ var elt = '';
+ var res = false;
+
+ for (i=0; i<arr.length; i++)
+ {
+ elt = arr[i];
+
+ switch(true)
+ {
+ case (elt === null) :
+ res = true;
+ break;
+
+ default:
+ // do nothing
+ }
+ }
+
+ return res;
+}
+
+var arr = Array('a', undefined);
+actual = f4(arr);
+expect = false;
+addThis();
+
+
+
+status = inSection(5);
+function f5(arr)
+{
+ var len = arr.length;
+
+ for(var i=0; (arr[i]===undefined) && (i<len); i++)
+ ; //do nothing
+
+ return i;
+}
+
+/*
+ * An array of 5 undefined elements. Note:
+ *
+ * The return value of eval(a STATEMENT) is undefined.
+ * A non-existent PROPERTY is undefined, not a ReferenceError.
+ * No undefined element exists AFTER trailing comma at end.
+ *
+ */
+var arrUndef = [ , undefined, eval('var x = 0'), this.NOT_A_PROPERTY, , ];
+actual = f5(arrUndef);
+expect = 5;
+addThis();
+
+
+
+status = inSection(6);
+function f6(arr)
+{
+ var len = arr.length;
+
+ for(var i=0; (arr[i]===null) && (i<len); i++)
+ ; //do nothing
+
+ return i;
+}
+
+/*
+ * Use same array as above. This time we're comparing to |null|, so we expect 0
+ */
+actual = f6(arrUndef);
+expect = 0;
+addThis();
+
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/FunExpr/fe-001-n.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/FunExpr/fe-001-n.js
new file mode 100644
index 0000000..34c37e8
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/FunExpr/fe-001-n.js
@@ -0,0 +1,37 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ * Rob Ginda rginda@netscape.com
+ */
+
+test();
+
+function test()
+{
+ enterFunc ("test");
+ printStatus ("Function Expression test.");
+
+ var x = function f(){return "inner";}();
+ var y = f();
+ reportFailure ("Previous statement should have thrown a ReferenceError");
+
+ exitFunc ("test");
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/FunExpr/fe-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/FunExpr/fe-001.js
new file mode 100644
index 0000000..569a636
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/FunExpr/fe-001.js
@@ -0,0 +1,39 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ * Rob Ginda rginda@netscape.com
+ */
+
+if (1) function f() {return 1;}
+if (0) function f() {return 0;}
+
+function test()
+{
+ enterFunc ("test");
+
+ printStatus ("Function Expression Statements basic test.");
+
+ reportCompare (1, f(), "Both functions were defined.");
+
+ exitFunc ("test");
+}
+
+test();
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/FunExpr/fe-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/FunExpr/fe-002.js
new file mode 100644
index 0000000..35a9925
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/FunExpr/fe-002.js
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ * Rob Ginda rginda@netscape.com
+ */
+
+function f()
+{
+ return "outer";
+}
+
+function test()
+{
+ enterFunc ("test");
+ printStatus ("Function Expression test.");
+
+ var x = function f(){return "inner";}();
+
+ reportCompare ("outer", f(),
+ "Inner function statement should not have been called.");
+
+ exitFunc ("test");
+}
+
+test();
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/15.3.4.3-1.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/15.3.4.3-1.js
new file mode 100644
index 0000000..123b944
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/15.3.4.3-1.js
@@ -0,0 +1,205 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2002
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): igor3@apochta.com, pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 21 May 2002
+* SUMMARY: ECMA conformance of Function.prototype.apply
+*
+* Function.prototype.apply(thisArg, argArray)
+*
+* See ECMA-262 Edition 3 Final, Section 15.3.4.3
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 145791;
+var summary = 'Testing ECMA conformance of Function.prototype.apply';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+function F0(a)
+{
+ return "" + this + arguments.length;
+}
+
+function F1(a)
+{
+ return "" + this + a;
+}
+
+function F2()
+{
+ return "" + this;
+}
+
+
+
+/*
+ * Function.prototype.apply.length should return 2
+ */
+status = inSection(1);
+actual = Function.prototype.apply.length;
+expect = 2;
+addThis();
+
+
+/*
+ * When |thisArg| is not provided to the apply() method, the
+ * called function must be passed the global object as |this|
+ */
+status = inSection(2);
+actual = F0.apply();
+expect = "" + this + 0;
+addThis();
+
+
+/*
+ * If |argArray| is not provided to the apply() method, the
+ * called function should be invoked with an empty argument list
+ */
+status = inSection(3);
+actual = F0.apply("");
+expect = "" + "" + 0;
+addThis();
+
+status = inSection(4);
+actual = F0.apply(true);
+expect = "" + true + 0;
+addThis();
+
+
+/*
+ * Function.prototype.apply(x) and
+ * Function.prototype.apply(x, undefined) should return the same result
+ */
+status = inSection(5);
+actual = F1.apply(0, undefined);
+expect = F1.apply(0);
+addThis();
+
+status = inSection(6);
+actual = F1.apply("", undefined);
+expect = F1.apply("");
+addThis();
+
+status = inSection(7);
+actual = F1.apply(null, undefined);
+expect = F1.apply(null);
+addThis();
+
+status = inSection(8);
+actual = F1.apply(undefined, undefined);
+expect = F1.apply(undefined);
+addThis();
+
+
+/*
+ * Function.prototype.apply(x) and
+ * Function.prototype.apply(x, null) should return the same result
+ */
+status = inSection(9);
+actual = F1.apply(0, null);
+expect = F1.apply(0);
+addThis();
+
+status = inSection(10);
+actual = F1.apply("", null);
+expect = F1.apply("");
+addThis();
+
+status = inSection(11);
+actual = F1.apply(null, null);
+expect = F1.apply(null);
+addThis();
+
+status = inSection(12);
+actual = F1.apply(undefined, null);
+expect = F1.apply(undefined);
+addThis();
+
+
+/*
+ * Function.prototype.apply() and
+ * Function.prototype.apply(undefined) should return the same result
+ */
+status = inSection(13);
+actual = F2.apply(undefined);
+expect = F2.apply();
+addThis();
+
+
+/*
+ * Function.prototype.apply() and
+ * Function.prototype.apply(null) should return the same result
+ */
+status = inSection(14);
+actual = F2.apply(null);
+expect = F2.apply();
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/15.3.4.4-1.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/15.3.4.4-1.js
new file mode 100644
index 0000000..e9e2b64
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/15.3.4.4-1.js
@@ -0,0 +1,180 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2002
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): igor3@apochta.com, pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 21 May 2002
+* SUMMARY: ECMA conformance of Function.prototype.call
+*
+* Function.prototype.call(thisArg [,arg1 [,arg2, ...]])
+*
+* See ECMA-262 Edition 3 Final, Section 15.3.4.4
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 145791;
+var summary = 'Testing ECMA conformance of Function.prototype.call';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+function F0(a)
+{
+ return "" + this + arguments.length;
+}
+
+function F1(a)
+{
+ return "" + this + a;
+}
+
+function F2()
+{
+ return "" + this;
+}
+
+
+
+/*
+ * Function.prototype.call.length should return 1
+ */
+status = inSection(1);
+actual = Function.prototype.call.length;
+expect = 1;
+addThis();
+
+
+/*
+ * When |thisArg| is not provided to the call() method, the
+ * called function must be passed the global object as |this|
+ */
+status = inSection(2);
+actual = F0.call();
+expect = "" + this + 0;
+addThis();
+
+
+/*
+ * If [,arg1 [,arg2, ...]] are not provided to the call() method,
+ * the called function should be invoked with an empty argument list
+ */
+status = inSection(3);
+actual = F0.call("");
+expect = "" + "" + 0;
+addThis();
+
+status = inSection(4);
+actual = F0.call(true);
+expect = "" + true + 0;
+addThis();
+
+
+/*
+ * Function.prototype.call(x) and
+ * Function.prototype.call(x, undefined) should return the same result
+ */
+status = inSection(5);
+actual = F1.call(0, undefined);
+expect = F1.call(0);
+addThis();
+
+status = inSection(6);
+actual = F1.call("", undefined);
+expect = F1.call("");
+addThis();
+
+status = inSection(7);
+actual = F1.call(null, undefined);
+expect = F1.call(null);
+addThis();
+
+status = inSection(8);
+actual = F1.call(undefined, undefined);
+expect = F1.call(undefined);
+addThis();
+
+
+/*
+ * Function.prototype.call() and
+ * Function.prototype.call(undefined) should return the same result
+ */
+status = inSection(9);
+actual = F2.call(undefined);
+expect = F2.call();
+addThis();
+
+
+/*
+ * Function.prototype.call() and
+ * Function.prototype.call(null) should return the same result
+ */
+status = inSection(10);
+actual = F2.call(null);
+expect = F2.call();
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/arguments-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/arguments-001.js
new file mode 100644
index 0000000..98aca18
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/arguments-001.js
@@ -0,0 +1,148 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS
+* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+* implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation. All
+* Rights Reserved.
+*
+* Contributor(s): brendan@mozilla.org, pschwartau@netscape.com
+* Date: 07 May 2001
+*
+* SUMMARY: Testing the arguments object
+*
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=72884
+*/
+//-------------------------------------------------------------------------------------------------
+var UBound = 0;
+var bug = 72884;
+var summary = 'Testing the arguments object';
+var status = '';
+var statusitems = [ ];
+var actual = '';
+var actualvalues = [ ];
+var expect= '';
+var expectedvalues = [ ];
+var a = '';
+
+
+status = inSection(1);
+function f()
+{
+ delete arguments.length;
+ return arguments;
+}
+
+a = f();
+actual = a instanceof Object;
+expect = true;
+addThis();
+
+actual = a instanceof Array;
+expect = false;
+addThis();
+
+actual = a.length;
+expect = undefined;
+addThis();
+
+
+
+status = inSection(2);
+a = f(1,2,3);
+actual = a instanceof Object;
+expect = true;
+addThis();
+
+actual = a instanceof Array;
+expect = false;
+addThis();
+
+actual = a.length;
+expect = undefined;
+addThis();
+
+actual = a[0];
+expect = 1;
+addThis();
+
+actual = a[1];
+expect = 2;
+addThis();
+
+actual = a[2];
+expect = 3;
+addThis();
+
+
+
+status = inSection(3);
+/*
+ * Brendan:
+ *
+ * Note that only callee and length can be overridden, so deleting an indexed
+ * property and asking for it again causes it to be recreated by args_resolve:
+ *
+ * function g(){delete arguments[0]; return arguments[0]}
+ * g(42) // should this print 42?
+ *
+ * I'm not positive this violates ECMA, which allows in chapter 16 for extensions
+ * including properties (does it allow for magically reappearing properties?). The
+ * delete operator successfully deletes arguments[0] and results in true, but that
+ * is not distinguishable from the case where arguments[0] was delegated to
+ * Arguments.prototype[0], which was how the bad old code worked.
+ *
+ * I'll ponder this last detail...
+ *
+ * UPDATE: Per ECMA-262, delete on an arguments[i] should succeed
+ * and remove that property from the arguments object, leaving any get
+ * of it after the delete to evaluate to undefined.
+ */
+function g()
+{
+ delete arguments[0];
+ return arguments[0];
+}
+actual = g(42);
+expect = undefined; // not 42...
+addThis();
+
+
+
+//-------------------------------------------------------------------------------------------------
+test();
+//-------------------------------------------------------------------------------------------------
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ for (var i = 0; i < UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/call-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/call-001.js
new file mode 100644
index 0000000..f9bdf62
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/call-001.js
@@ -0,0 +1,131 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an
+* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either expressed
+* or implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation.
+* All Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+* Date: 2001-07-13
+*
+* SUMMARY: Applying Function.prototype.call to the Function object itself
+*
+*
+* ECMA-262 15.3.4.4 Function.prototype.call (thisArg [,arg1 [,arg2,…] ] )
+*
+* When applied to the Function object itself, thisArg should be ignored.
+* As explained by Waldemar (waldemar@netscape.com):
+*
+* Function.call(obj, "print(this)") is equivalent to invoking
+* Function("print(this)") with this set to obj. Now, Function("print(this)")
+* is equivalent to new Function("print(this)") (see 15.3.1.1), and the latter
+* ignores the this value that you passed it and constructs a function
+* (which we'll call F) which will print the value of the this that will be
+* passed in when F will be invoked.
+*
+* With the last set of () you're invoking F(), which means you're calling it
+* with no this value. When you don't provide a this value, it defaults to the
+* global object.
+*
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = '(none)';
+var summary = 'Applying Function.prototype.call to the Function object itself';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+var self = this; // capture a reference to the global object
+var cnOBJECT_GLOBAL = self.toString();
+var cnOBJECT_OBJECT = (new Object).toString();
+var cnHello = 'Hello';
+var cnRed = 'red';
+var objTEST = {color:cnRed};
+var f = new Function();
+var g = new Function();
+
+
+f = Function.call(self, 'return cnHello');
+g = Function.call(objTEST, 'return cnHello');
+
+status = 'Section A of test';
+actual = f();
+expect = cnHello;
+captureThis();
+
+status = 'Section B of test';
+actual = g();
+expect = cnHello;
+captureThis();
+
+
+f = Function.call(self, 'return this.toString()');
+g = Function.call(objTEST, 'return this.toString()');
+
+status = 'Section C of test';
+actual = f();
+expect = cnOBJECT_GLOBAL;
+captureThis();
+
+status = 'Section D of test';
+actual = g();
+expect = cnOBJECT_GLOBAL;
+captureThis();
+
+
+f = Function.call(self, 'return this.color');
+g = Function.call(objTEST, 'return this.color');
+
+status = 'Section E of test';
+actual = f();
+expect = undefined;
+captureThis();
+
+status = 'Section F of test';
+actual = g();
+expect = undefined;
+captureThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+function captureThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ for (var i = 0; i < UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-104584.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-104584.js
new file mode 100644
index 0000000..db984a2
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-104584.js
@@ -0,0 +1,56 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS
+* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+* implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation.
+* All Rights Reserved.
+*
+* Contributor(s): jband@netscape.com, pschwartau@netscape.com
+* Date: 14 October 2001
+*
+* SUMMARY: Regression test for Bugzilla bug 104584
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=104584
+*
+* Testing that we don't crash on this code. The idea is to
+* call F,G WITHOUT providing an argument. This caused a crash
+* on the second call to obj.toString() or print(obj) below -
+*/
+//-----------------------------------------------------------------------------
+var bug = 104584;
+var summary = "Testing that we don't crash on this code -";
+
+printBugNumber (bug);
+printStatus (summary);
+
+F();
+G();
+
+function F(obj)
+{
+ if(!obj)
+ obj = {};
+ obj.toString();
+ gc();
+ obj.toString();
+}
+
+
+function G(obj)
+{
+ if(!obj)
+ obj = {};
+ print(obj);
+ gc();
+ print(obj);
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-131964.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-131964.js
new file mode 100644
index 0000000..d90aa17
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-131964.js
@@ -0,0 +1,191 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2002
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 19 Mar 2002
+* SUMMARY: Function declarations in global or function scope are {DontDelete}.
+* Function declarations in eval scope are not {DontDelete}.
+*
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=131964
+*
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 131964;
+var summary = 'Functions defined in global or function scope are {DontDelete}';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+status = inSection(1);
+function f()
+{
+ return 'f lives!';
+}
+delete f;
+
+try
+{
+ actual = f();
+}
+catch(e)
+{
+ actual = 'f was deleted';
+}
+
+expect = 'f lives!';
+addThis();
+
+
+
+/*
+ * Try the same test in function scope -
+ */
+status = inSection(2);
+function g()
+{
+ function f()
+ {
+ return 'f lives!';
+ }
+ delete f;
+
+ try
+ {
+ actual = f();
+ }
+ catch(e)
+ {
+ actual = 'f was deleted';
+ }
+
+ expect = 'f lives!';
+ addThis();
+}
+g();
+
+
+
+/*
+ * Try the same test in eval scope - here we EXPECT the function to be deleted (?)
+ */
+status = inSection(3);
+var s = '';
+s += 'function h()';
+s += '{ ';
+s += ' return "h lives!";';
+s += '}';
+s += 'delete h;';
+
+s += 'try';
+s += '{';
+s += ' actual = h();';
+s += '}';
+s += 'catch(e)';
+s += '{';
+s += ' actual = "h was deleted";';
+s += '}';
+
+s += 'expect = "h was deleted";';
+s += 'addThis();';
+eval(s);
+
+
+/*
+ * Define the function in eval scope, but delete it in global scope -
+ */
+status = inSection(4);
+s = '';
+s += 'function k()';
+s += '{ ';
+s += ' return "k lives!";';
+s += '}';
+eval(s);
+
+delete k;
+
+try
+{
+ actual = k();
+}
+catch(e)
+{
+ actual = 'k was deleted';
+}
+
+expect = 'k was deleted';
+addThis();
+
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function wasDeleted(functionName)
+{
+ return functionName + ' was deleted...';
+}
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-137181.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-137181.js
new file mode 100644
index 0000000..1417601
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-137181.js
@@ -0,0 +1,108 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2002
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): ibukanov8@yahoo.com, pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 12 Apr 2002
+* SUMMARY: delete arguments[i] should break connection to local reference
+*
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=137181
+*
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 137181;
+var summary = 'delete arguments[i] should break connection to local reference';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+status = inSection(1);
+function f1(x)
+{
+ x = 1;
+ delete arguments[0];
+ return x;
+}
+actual = f1(0); // (bug: Rhino was returning |undefined|)
+expect = 1;
+addThis();
+
+
+status = inSection(2);
+function f2(x)
+{
+ x = 1;
+ delete arguments[0];
+ arguments[0] = -1;
+ return x;
+}
+actual = f2(0); // (bug: Rhino was returning -1)
+expect = 1;
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-193555.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-193555.js
new file mode 100644
index 0000000..cc3c1eb
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-193555.js
@@ -0,0 +1,131 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2003
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): igor@icesoft.no, pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 17 February 2003
+* SUMMARY: Testing access to function name from inside function
+*
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=193555
+*
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 193555;
+var summary = 'Testing access to function name from inside function';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+// test via function statement
+status = inSection(1);
+function f() {return f.toString();};
+actual = f();
+expect = f.toString();
+addThis();
+
+// test via function expression
+status = inSection(2);
+var x = function g() {return g.toString();};
+actual = x();
+expect = x.toString();
+addThis();
+
+// test via eval() outside function
+status = inSection(3);
+eval ('function a() {return a.toString();}');
+actual = a();
+expect = a.toString();
+addThis();
+
+status = inSection(4);
+eval ('var y = function b() {return b.toString();}');
+actual = y();
+expect = y.toString();
+addThis();
+
+// test via eval() inside function
+status = inSection(5);
+function c() {return eval('c').toString();};
+actual = c();
+expect = c.toString();
+addThis();
+
+status = inSection(6);
+var z = function d() {return eval('d').toString();};
+actual = z();
+expect = z.toString();
+addThis();
+
+// test via two evals!
+status = inSection(7);
+eval('var w = function e() {return eval("e").toString();}');
+actual = w();
+expect = w.toString();
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-49286.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-49286.js
new file mode 100644
index 0000000..5f7093a
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-49286.js
@@ -0,0 +1,116 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an
+* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either expressed
+* or implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation.
+* All Rights Reserved.
+*
+* Contributors: jlaprise@delanotech.com,pschwartau@netscape.com
+* Date: 2001-07-10
+*
+* SUMMARY: Invoking try...catch through Function.call
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=49286
+*
+* 1) Define a function with a try...catch block in it
+* 2) Invoke the function via the call method of Function
+* 3) Pass bad syntax to the try...catch block
+* 4) We should catch the error!
+*/
+//-------------------------------------------------------------------------------------------------
+var UBound = 0;
+var bug = 49286;
+var summary = 'Invoking try...catch through Function.call';
+var cnErrorCaught = 'Error caught';
+var cnErrorNotCaught = 'Error NOT caught';
+var cnGoodSyntax = '1==2';
+var cnBadSyntax = '1=2';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+var obj = new testObject();
+
+status = 'Section A of test: direct call of f';
+actual = f.call(obj);
+expect = cnErrorCaught;
+addThis();
+
+status = 'Section B of test: indirect call of f';
+actual = g.call(obj);
+expect = cnErrorCaught;
+addThis();
+
+
+
+//-----------------------------------------
+test();
+//-----------------------------------------
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
+
+
+// An object storing bad syntax as a property -
+function testObject()
+{
+ this.badSyntax = cnBadSyntax;
+ this.goodSyntax = cnGoodSyntax;
+}
+
+
+// A function wrapping a try...catch block
+function f()
+{
+ try
+ {
+ eval(this.badSyntax);
+ }
+ catch(e)
+ {
+ return cnErrorCaught;
+ }
+ return cnErrorNotCaught;
+}
+
+
+// A function wrapping a call to f -
+function g()
+{
+ return f.call(this);
+}
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-58274.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-58274.js
new file mode 100644
index 0000000..8a5c2e6
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-58274.js
@@ -0,0 +1,221 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2002
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): rogerl@netscape.com, pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 15 July 2002
+* SUMMARY: Testing functions with double-byte names
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=58274
+*
+* Here is a sample of the problem:
+*
+* js> function f\u02B1 () {}
+*
+* js> f\u02B1.toSource();
+* function f¦() {}
+*
+* js> f\u02B1.toSource().toSource();
+* (new String("function f\xB1() {}"))
+*
+*
+* See how the high-byte information (the 02) has been lost?
+* The same thing was happening with the toString() method:
+*
+* js> f\u02B1.toString();
+*
+* function f¦() {
+* }
+*
+* js> f\u02B1.toString().toSource();
+* (new String("\nfunction f\xB1() {\n}\n"))
+*
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 58274;
+var summary = 'Testing functions with double-byte names';
+var ERR = 'UNEXPECTED ERROR! \n';
+var ERR_MALFORMED_NAME = ERR + 'Could not find function name in: \n\n';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+var sEval;
+var sName;
+
+
+sEval = "function f\u02B2() {return 42;}";
+eval(sEval);
+sName = getFunctionName(f\u02B2);
+
+// Test function call -
+status = inSection(1);
+actual = f\u02B2();
+expect = 42;
+addThis();
+
+// Test both characters of function name -
+status = inSection(2);
+actual = sName[0];
+expect = sEval[9];
+addThis();
+
+status = inSection(3);
+actual = sName[1];
+expect = sEval[10];
+addThis();
+
+
+
+sEval = "function f\u02B2\u0AAA () {return 84;}";
+eval(sEval);
+sName = getFunctionName(f\u02B2\u0AAA);
+
+// Test function call -
+status = inSection(4);
+actual = f\u02B2\u0AAA();
+expect = 84;
+addThis();
+
+// Test all three characters of function name -
+status = inSection(5);
+actual = sName[0];
+expect = sEval[9];
+addThis();
+
+status = inSection(6);
+actual = sName[1];
+expect = sEval[10];
+addThis();
+
+status = inSection(7);
+actual = sName[2];
+expect = sEval[11];
+addThis();
+
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+/*
+ * Goal: test that f.toString() contains the proper function name.
+ *
+ * Note, however, f.toString() is implementation-independent. For example,
+ * it may begin with '\nfunction' instead of 'function'. Therefore we use
+ * a regexp to make sure we extract the name properly.
+ *
+ * Here we assume that f has been defined by means of a function statement,
+ * and not a function expression (where it wouldn't have to have a name).
+ *
+ * Rhino uses a Unicode representation for f.toString(); whereas
+ * SpiderMonkey uses an ASCII representation, putting escape sequences
+ * for non-ASCII characters. For example, if a function is called f\u02B1,
+ * then in Rhino the toString() method will present a 2-character Unicode
+ * string for its name, whereas SpiderMonkey will present a 7-character
+ * ASCII string for its name: the string literal 'f\u02B1'.
+ *
+ * So we force the lexer to condense the string before using it.
+ * This will give uniform results in Rhino and SpiderMonkey.
+ */
+function getFunctionName(f)
+{
+ var s = condenseStr(f.toString());
+ var re = /\s*function\s+(\S+)\s*\(/;
+ var arr = s.match(re);
+
+ if (!(arr && arr[1]))
+ return ERR_MALFORMED_NAME + s;
+ return arr[1];
+}
+
+
+/*
+ * This function is the opposite of functions like escape(), which take
+ * Unicode characters and return escape sequences for them. Here, we force
+ * the lexer to turn escape sequences back into single characters.
+ *
+ * Note we can't simply do |eval(str)|, since in practice |str| will be an
+ * identifier somewhere in the program (e.g. a function name); thus |eval(str)|
+ * would return the object that the identifier represents: not what we want.
+ *
+ * So we surround |str| lexicographically with quotes to force the lexer to
+ * evaluate it as a string. Have to strip out any linefeeds first, however -
+ */
+function condenseStr(str)
+{
+ /*
+ * You won't be able to do the next step if |str| has
+ * any carriage returns or linefeeds in it. For example:
+ *
+ * js> eval("'" + '\nHello' + "'");
+ * 1: SyntaxError: unterminated string literal:
+ * 1: '
+ * 1: ^
+ *
+ * So replace them with the empty string -
+ */
+ str = str.replace(/[\r\n]/g, '')
+ return eval("'" + str + "'");
+}
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-85880.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-85880.js
new file mode 100644
index 0000000..fea243e
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-85880.js
@@ -0,0 +1,152 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS
+* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+* implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation.
+* All Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+* Date: 2001-06-14
+*
+* SUMMARY: Regression test for Bugzilla bug 85880
+*
+* Rhino interpreted mode was nulling out the arguments object of a
+* function if it happened to call another function inside its body.
+*
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=85880
+*
+*/
+//-------------------------------------------------------------------------------------------------
+var UBound = 0;
+var bug = 85880;
+var summary = 'Arguments object of g(){f()} should not be null';
+var cnNonNull = 'Arguments != null';
+var cnNull = 'Arguments == null';
+var cnRecurse = true;
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+function f1(x)
+{
+}
+
+
+function f2()
+{
+ return f2.arguments;
+}
+status = 'Section A of test';
+actual = (f2() == null);
+expect = false;
+addThis();
+
+status = 'Section B of test';
+actual = (f2(0) == null);
+expect = false;
+addThis();
+
+
+function f3()
+{
+ f1();
+ return f3.arguments;
+}
+status = 'Section C of test';
+actual = (f3() == null);
+expect = false;
+addThis();
+
+status = 'Section D of test';
+actual = (f3(0) == null);
+expect = false;
+addThis();
+
+
+function f4()
+{
+ f1();
+ f2();
+ f3();
+ return f4.arguments;
+}
+status = 'Section E of test';
+actual = (f4() == null);
+expect = false;
+addThis();
+
+status = 'Section F of test';
+actual = (f4(0) == null);
+expect = false;
+addThis();
+
+
+function f5()
+{
+ if (cnRecurse)
+ {
+ cnRecurse = false;
+ f5();
+ }
+ return f5.arguments;
+}
+status = 'Section G of test';
+actual = (f5() == null);
+expect = false;
+addThis();
+
+status = 'Section H of test';
+actual = (f5(0) == null);
+expect = false;
+addThis();
+
+
+
+//-------------------------------------------------------------------------------------------------
+test();
+//-------------------------------------------------------------------------------------------------
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = isThisNull(actual);
+ expectedvalues[UBound] = isThisNull(expect);
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ for (var i = 0; i < UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
+
+
+function isThisNull(bool)
+{
+ return bool? cnNull : cnNonNull
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-94506.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-94506.js
new file mode 100644
index 0000000..de4a3a3
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-94506.js
@@ -0,0 +1,142 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS
+* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+* implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation. All
+* Rights Reserved.
+*
+* Contributor(s): deneen@alum.bucknell.edu, shaver@mozilla.org
+* Date: 08 August 2001
+*
+* SUMMARY: When we invoke a function, the arguments object should take
+* a back seat to any local identifier named "arguments".
+*
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=94506
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 94506;
+var summary = 'Testing functions employing identifiers named "arguments"';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+var TYPE_OBJECT = typeof new Object();
+var arguments = 5555;
+
+
+// use a parameter named "arguments"
+function F1(arguments)
+{
+ return arguments;
+}
+
+
+// use a local variable named "arguments"
+function F2()
+{
+ var arguments = 55;
+ return arguments;
+}
+
+
+// same thing in a different order. CHANGES THE RESULT!
+function F3()
+{
+ return arguments;
+ var arguments = 555;
+}
+
+
+// use the global variable above named "arguments"
+function F4()
+{
+ return arguments;
+}
+
+
+
+/*
+ * In Sections 1 and 2, expect the local identifier, not the arguments object.
+ * In Sections 3 and 4, expect the arguments object, not the the identifier.
+ */
+
+status = 'Section 1 of test';
+actual = F1(5);
+expect = 5;
+addThis();
+
+
+status = 'Section 2 of test';
+actual = F2();
+expect = 55;
+addThis();
+
+
+status = 'Section 3 of test';
+actual = typeof F3();
+expect = TYPE_OBJECT;
+addThis();
+
+
+status = 'Section 4 of test';
+actual = typeof F4();
+expect = TYPE_OBJECT;
+addThis();
+
+
+// Let's try calling F1 without providing a parameter -
+status = 'Section 5 of test';
+actual = F1();
+expect = undefined;
+addThis();
+
+
+// Let's try calling F1 with too many parameters -
+status = 'Section 6 of test';
+actual = F1(3,33,333);
+expect = 3;
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ for (var i = 0; i < UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-97921.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-97921.js
new file mode 100644
index 0000000..c982673
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-97921.js
@@ -0,0 +1,131 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS
+* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+* implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation. All
+* Rights Reserved.
+*
+* Contributor(s): georg@bioshop.de, pschwartau@netscape.com
+* Date: 10 September 2001
+*
+* SUMMARY: Testing with() statement with nested functions
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=97921
+*
+* Brendan: "The bug is peculiar to functions that have formal parameters,
+* but that are called with fewer actual arguments than the declared number
+* of formal parameters."
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 97921;
+var summary = 'Testing with() statement with nested functions';
+var cnYES = 'Inner value === outer value';
+var cnNO = "Inner value !== outer value!";
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+var outerValue = '';
+var innerValue = '';
+var useWith = '';
+
+
+function F(i)
+{
+ i = 0;
+ if(useWith) with(1){i;}
+ i++;
+
+ outerValue = i; // capture value of i in outer function
+ F1 = function() {innerValue = i;}; // capture value of i in inner function
+ F1();
+}
+
+
+status = inSection(1);
+useWith=false;
+F(); // call F without supplying the argument
+actual = innerValue === outerValue;
+expect = true;
+addThis();
+
+status = inSection(2);
+useWith=true;
+F(); // call F without supplying the argument
+actual = innerValue === outerValue;
+expect = true;
+addThis();
+
+
+function G(i)
+{
+ i = 0;
+ with (new Object()) {i=100};
+ i++;
+
+ outerValue = i; // capture value of i in outer function
+ G1 = function() {innerValue = i;}; // capture value of i in inner function
+ G1();
+}
+
+
+status = inSection(3);
+G(); // call G without supplying the argument
+actual = innerValue === 101;
+expect = true;
+addThis();
+
+status = inSection(4);
+G(); // call G without supplying the argument
+actual = innerValue === outerValue;
+expect = true;
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = areTheseEqual(actual);
+ expectedvalues[UBound] = areTheseEqual(expect);
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ for (var i = 0; i < UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
+
+
+function areTheseEqual(yes)
+{
+ return yes? cnYES : cnNO
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/scope-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/scope-001.js
new file mode 100644
index 0000000..9c4e8fa
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/scope-001.js
@@ -0,0 +1,249 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS
+* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+* implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation. All
+* Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com, rogerl@netscape.com
+* Date: 28 May 2001
+*
+* SUMMARY: Functions are scoped statically, not dynamically
+*
+* See ECMA Section 10.1.4 Scope Chain and Identifier Resolution
+* (This section defines the scope chain of an execution context)
+*
+* See ECMA Section 12.10 The with Statement
+*
+* See ECMA Section 13 Function Definition
+* (This section defines the scope chain of a function object as that
+* of the running execution context when the function was declared)
+*/
+//-------------------------------------------------------------------------------------------------
+var UBound = 0;
+var bug = '(none)';
+var summary = 'Testing that functions are scoped statically, not dynamically';
+var self = this; // capture a reference to the global object
+var status = '';
+var statusitems = [ ];
+var actual = '';
+var actualvalues = [ ];
+var expect= '';
+var expectedvalues = [ ];
+
+/*
+ * In this section the expected value is 1, not 2.
+ *
+ * Why? f captures its scope chain from when it's declared, and imposes that chain
+ * when it's executed. In other words, f's scope chain is from when it was compiled.
+ * Since f is a top-level function, this is the global object only. Hence 'a' resolves to 1.
+ */
+status = 'Section A of test';
+var a = 1;
+function f()
+{
+ return a;
+}
+var obj = {a:2};
+with (obj)
+{
+ actual = f();
+}
+expect = 1;
+addThis();
+
+
+/*
+ * In this section the expected value is 2, not 1. That is because here
+ * f's associated scope chain now includes 'obj' before the global object.
+ */
+status = 'Section B of test';
+var a = 1;
+var obj = {a:2};
+with (obj)
+{
+ function f()
+ {
+ return a;
+ }
+ actual = f();
+}
+// Mozilla result, which contradicts IE and the ECMA spec: expect = 2;
+expect = 1;
+addThis();
+
+
+/*
+ * Like Section B , except that we call f outside the with block.
+ * By the principles explained above, we still expect 2 -
+ */
+status = 'Section C of test';
+var a = 1;
+var obj = {a:2};
+with (obj)
+{
+ function f()
+ {
+ return a;
+ }
+}
+actual = f();
+// Mozilla result, which contradicts IE and the ECMA spec: expect = 2;
+expect = 1;
+addThis();
+
+
+/*
+ * Like Section C, but with one more level of indirection -
+ */
+status = 'Section D of test';
+var a = 1;
+var obj = {a:2, obj:{a:3}};
+with (obj)
+{
+ with (obj)
+ {
+ function f()
+ {
+ return a;
+ }
+ }
+}
+actual = f();
+// Mozilla result, which contradicts IE and the ECMA spec: expect = 3;
+expect = 1;
+addThis();
+
+
+/*
+ * Like Section C, but here we actually delete obj before calling f.
+ * We still expect 2 -
+ */
+status = 'Section E of test';
+var a = 1;
+var obj = {a:2};
+with (obj)
+{
+ function f()
+ {
+ return a;
+ }
+}
+delete obj;
+actual = f();
+// Mozilla result, which contradicts IE and the ECMA spec: expect = 2;
+expect = 1;
+addThis();
+
+
+/*
+ * Like Section E. Here we redefine obj and call f under with (obj) -
+ * We still expect 2 -
+ */
+status = 'Section F of test';
+var a = 1;
+var obj = {a:2};
+with (obj)
+{
+ function f()
+ {
+ return a;
+ }
+}
+delete obj;
+var obj = {a:3};
+with (obj)
+{
+ actual = f();
+}
+// Mozilla result, which contradicts IE and the ECMA spec: expect = 2; // NOT 3 !!!
+expect = 1;
+addThis();
+
+
+/*
+ * Explicitly verify that f exists at global level, even though
+ * it was defined under the with(obj) block -
+ */
+status = 'Section G of test';
+var a = 1;
+var obj = {a:2};
+with (obj)
+{
+ function f()
+ {
+ return a;
+ }
+}
+actual = String([obj.hasOwnProperty('f'), self.hasOwnProperty('f')]);
+expect = String([false, true]);
+addThis();
+
+
+/*
+ * Explicitly verify that f exists at global level, even though
+ * it was defined under the with(obj) block -
+ */
+status = 'Section H of test';
+var a = 1;
+var obj = {a:2};
+with (obj)
+{
+ function f()
+ {
+ return a;
+ }
+}
+actual = String(['f' in obj, 'f' in self]);
+expect = String([false, true]);
+addThis();
+
+
+
+//-------------------------------------------------------------------------------------------------
+test();
+//-------------------------------------------------------------------------------------------------
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+ resetTestVars();
+}
+
+
+function resetTestVars()
+{
+ delete a;
+ delete obj;
+ delete f;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ for (var i = 0; i < UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/scope-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/scope-002.js
new file mode 100644
index 0000000..8e4626e
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/scope-002.js
@@ -0,0 +1,224 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS
+* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+* implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation. All
+* Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com, rogerl@netscape.com
+* Date: 28 May 2001
+*
+* SUMMARY: Functions are scoped statically, not dynamically
+*
+* See ECMA Section 10.1.4 Scope Chain and Identifier Resolution
+* (This section defines the scope chain of an execution context)
+*
+* See ECMA Section 12.10 The with Statement
+*
+* See ECMA Section 13 Function Definition
+* (This section defines the scope chain of a function object as that
+* of the running execution context when the function was declared)
+*
+* Like scope-001.js, but using assignment var f = function expression
+* instead of a function declaration: function f() {} etc.
+*/
+//-------------------------------------------------------------------------------------------------
+var UBound = 0;
+var bug = '(none)';
+var summary = 'Testing that functions are scoped statically, not dynamically';
+var self = this; // capture a reference to the global object
+var status = '';
+var statusitems = [ ];
+var actual = '';
+var actualvalues = [ ];
+var expect= '';
+var expectedvalues = [ ];
+
+
+/*
+ * In this section the expected value is 1, not 2.
+ *
+ * Why? f captures its scope chain from when it's declared, and imposes that chain
+ * when it's executed. In other words, f's scope chain is from when it was compiled.
+ * Since f is a top-level function, this is the global object only. Hence 'a' resolves to 1.
+ */
+status = 'Section A of test';
+var a = 1;
+var f = function () {return a;};
+var obj = {a:2};
+with (obj)
+{
+ actual = f();
+}
+expect = 1;
+addThis();
+
+
+/*
+ * In this section the expected value is 2, not 1. That is because here
+ * f's associated scope chain now includes 'obj' before the global object.
+ */
+status = 'Section B of test';
+var a = 1;
+var obj = {a:2};
+with (obj)
+{
+ var f = function () {return a;};
+ actual = f();
+}
+expect = 2;
+addThis();
+
+
+/*
+ * Like Section B , except that we call f outside the with block.
+ * By the principles explained above, we still expect 2 -
+ */
+status = 'Section C of test';
+var a = 1;
+var obj = {a:2};
+with (obj)
+{
+ var f = function () {return a;};
+}
+actual = f();
+expect = 2;
+addThis();
+
+
+/*
+ * Like Section C, but with one more level of indirection -
+ */
+status = 'Section D of test';
+var a = 1;
+var obj = {a:2, obj:{a:3}};
+with (obj)
+{
+ with (obj)
+ {
+ var f = function () {return a;};
+ }
+}
+actual = f();
+expect = 3;
+addThis();
+
+
+/*
+ * Like Section C, but here we actually delete obj before calling f.
+ * We still expect 2 -
+ */
+status = 'Section E of test';
+var a = 1;
+var obj = {a:2};
+with (obj)
+{
+ var f = function () {return a;};
+}
+delete obj;
+actual = f();
+expect = 2;
+addThis();
+
+
+/*
+ * Like Section E. Here we redefine obj and call f under with (obj) -
+ * We still expect 2 -
+ */
+status = 'Section F of test';
+var a = 1;
+var obj = {a:2};
+with (obj)
+{
+ var f = function () {return a;};
+}
+delete obj;
+var obj = {a:3};
+with (obj)
+{
+ actual = f();
+}
+expect = 2; // NOT 3 !!!
+addThis();
+
+
+/*
+ * Explicitly verify that f exists at global level, even though
+ * it was defined under the with(obj) block -
+ */
+status = 'Section G of test';
+var a = 1;
+var obj = {a:2};
+with (obj)
+{
+ var f = function () {return a;};
+}
+actual = String([obj.hasOwnProperty('f'), self.hasOwnProperty('f')]);
+expect = String([false, true]);
+addThis();
+
+
+/*
+ * Explicitly verify that f exists at global level, even though
+ * it was defined under the with(obj) block -
+ */
+status = 'Section H of test';
+var a = 1;
+var obj = {a:2};
+with (obj)
+{
+ var f = function () {return a;};
+}
+actual = String(['f' in obj, 'f' in self]);
+expect = String([false, true]);
+addThis();
+
+
+
+//-------------------------------------------------------------------------------------------------
+test();
+//-------------------------------------------------------------------------------------------------
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+ resetTestVars();
+}
+
+
+function resetTestVars()
+{
+ delete a;
+ delete obj;
+ delete f;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ for (var i = 0; i < UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Number/15.7.4.5-1.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Number/15.7.4.5-1.js
new file mode 100644
index 0000000..767ee6e
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Number/15.7.4.5-1.js
@@ -0,0 +1,124 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an
+* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either expressed
+* or implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation.
+* All Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+* Date: 2001-07-15
+*
+* SUMMARY: Testing Number.prototype.toFixed(fractionDigits)
+* See EMCA 262 Edition 3 Section 15.7.4.5
+*
+* Also see http://bugzilla.mozilla.org/show_bug.cgi?id=90551
+*
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = '(none)';
+var summary = 'Testing Number.prototype.toFixed(fractionDigits)';
+var cnIsRangeError = 'instanceof RangeError';
+var cnNotRangeError = 'NOT instanceof RangeError';
+var cnNoErrorCaught = 'NO ERROR CAUGHT...';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+var testNum = 234.2040506;
+
+
+status = 'Section A of test: no error intended!';
+actual = testNum.toFixed(4);
+expect = '234.2041';
+captureThis();
+
+
+/////////////////////////// OOPS.... ///////////////////////////////
+/*************************************************************************
+ * 15.7.4.5 Number.prototype.toFixed(fractionDigits)
+ *
+ * An implementation is permitted to extend the behaviour of toFixed
+ * for values of fractionDigits less than 0 or greater than 20. In this
+ * case toFixed would not necessarily throw RangeError for such values.
+
+status = 'Section B of test: expect RangeError because fractionDigits < 0';
+actual = catchError('testNum.toFixed(-4)');
+expect = cnIsRangeError;
+captureThis();
+
+status = 'Section C of test: expect RangeError because fractionDigits > 20 ';
+actual = catchError('testNum.toFixed(21)');
+expect = cnIsRangeError;
+captureThis();
+*************************************************************************/
+
+
+status = 'Section D of test: no error intended!';
+actual = 0.00001.toFixed(2);
+expect = '0.00';
+captureThis();
+
+status = 'Section E of test: no error intended!';
+actual = 0.000000000000000000001.toFixed(20);
+expect = '0.00000000000000000000';
+captureThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+function captureThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ for (var i = 0; i < UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
+
+
+function catchError(sEval)
+{
+ try {eval(sEval);}
+ catch(e) {return isRangeError(e);}
+ return cnNoErrorCaught;
+}
+
+
+function isRangeError(obj)
+{
+ if (obj instanceof RangeError)
+ return cnIsRangeError;
+ return cnNotRangeError;
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Number/15.7.4.6-1.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Number/15.7.4.6-1.js
new file mode 100644
index 0000000..9a06f46
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Number/15.7.4.6-1.js
@@ -0,0 +1,113 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an
+* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either expressed
+* or implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation.
+* All Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+* Date: 2001-07-15
+*
+* SUMMARY: Testing Number.prototype.toExponential(fractionDigits)
+* See EMCA 262 Edition 3 Section 15.7.4.6
+*
+* Also see http://bugzilla.mozilla.org/show_bug.cgi?id=90551
+*
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = '(none)';
+var summary = 'Testing Number.prototype.toExponential(fractionDigits)';
+var cnIsRangeError = 'instanceof RangeError';
+var cnNotRangeError = 'NOT instanceof RangeError';
+var cnNoErrorCaught = 'NO ERROR CAUGHT...';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+var testNum = 77.1234;
+
+
+status = 'Section A of test: no error intended!';
+actual = testNum.toExponential(4);
+expect = '7.7123e+1';
+captureThis();
+
+
+/////////////////////////// OOPS.... ///////////////////////////////
+/*************************************************************************
+ * 15.7.4.6 Number.prototype.toExponential(fractionDigits)
+ *
+ * An implementation is permitted to extend the behaviour of toExponential
+ * for values of fractionDigits less than 0 or greater than 20. In this
+ * case toExponential would not necessarily throw RangeError for such values.
+
+status = 'Section B of test: expect RangeError because fractionDigits < 0';
+actual = catchError('testNum.toExponential(-4)');
+expect = cnIsRangeError;
+captureThis();
+
+status = 'Section C of test: expect RangeError because fractionDigits > 20 ';
+actual = catchError('testNum.toExponential(21)');
+expect = cnIsRangeError;
+captureThis();
+*************************************************************************/
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+function captureThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ for (var i = 0; i < UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
+
+
+function catchError(sEval)
+{
+ try {eval(sEval);}
+ catch(e) {return isRangeError(e);}
+ return cnNoErrorCaught;
+}
+
+
+function isRangeError(obj)
+{
+ if (obj instanceof RangeError)
+ return cnIsRangeError;
+ return cnNotRangeError;
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Number/15.7.4.7-1.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Number/15.7.4.7-1.js
new file mode 100644
index 0000000..c29c0af
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Number/15.7.4.7-1.js
@@ -0,0 +1,118 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an
+* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either expressed
+* or implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation.
+* All Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+* Date: 2001-07-15
+*
+* SUMMARY: Testing Number.prototype.toPrecision(precision)
+* See EMCA 262 Edition 3 Section 15.7.4.7
+*
+* Also see http://bugzilla.mozilla.org/show_bug.cgi?id=90551
+*
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = '(none)';
+var summary = 'Testing Number.prototype.toPrecision(precision)';
+var cnIsRangeError = 'instanceof RangeError';
+var cnNotRangeError = 'NOT instanceof RangeError';
+var cnNoErrorCaught = 'NO ERROR CAUGHT...';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+var testNum = 5.123456;
+
+
+status = 'Section A of test: no error intended!';
+actual = testNum.toPrecision(4);
+expect = '5.123';
+captureThis();
+
+
+/////////////////////////// OOPS.... ///////////////////////////////
+/*************************************************************************
+ * 15.7.4.7 Number.prototype.toPrecision(precision)
+ *
+ * An implementation is permitted to extend the behaviour of toPrecision
+ * for values of precision less than 1 or greater than 21. In this
+ * case toPrecision would not necessarily throw RangeError for such values.
+
+status = 'Section B of test: expect RangeError because precision < 1';
+actual = catchError('testNum.toPrecision(0)');
+expect = cnIsRangeError;
+captureThis();
+
+status = 'Section C of test: expect RangeError because precision < 1';
+actual = catchError('testNum.toPrecision(-4)');
+expect = cnIsRangeError;
+captureThis();
+
+status = 'Section D of test: expect RangeError because precision > 21 ';
+actual = catchError('testNum.toPrecision(22)');
+expect = cnIsRangeError;
+captureThis();
+*************************************************************************/
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+function captureThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ for (var i = 0; i < UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
+
+
+function catchError(sEval)
+{
+ try {eval(sEval);}
+ catch(e) {return isRangeError(e);}
+ return cnNoErrorCaught;
+}
+
+
+function isRangeError(obj)
+{
+ if (obj instanceof RangeError)
+ return cnIsRangeError;
+ return cnNotRangeError;
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/NumberFormatting/tostring-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/NumberFormatting/tostring-001.js
new file mode 100644
index 0000000..e99912d
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/NumberFormatting/tostring-001.js
@@ -0,0 +1,42 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ * Rob Ginda rginda@netscape.com
+ */
+
+test();
+
+function test()
+{
+ var n0 = 1e23;
+ var n1 = 5e22;
+ var n2 = 1.6e24;
+
+ printStatus ("Number formatting test.");
+ printBugNumber ("11178");
+
+ reportCompare ("1e+23", n0.toString(), "1e23 toString()");
+ reportCompare ("5e+22", n1.toString(), "5e22 toString()");
+ reportCompare ("1.6e+24", n2.toString(), "1.6e24 toString()");
+
+}
+
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/8.6.2.6-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/8.6.2.6-001.js
new file mode 100644
index 0000000..1c7ef47
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/8.6.2.6-001.js
@@ -0,0 +1,108 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2002
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 09 September 2002
+* SUMMARY: Test for TypeError on invalid default string value of object
+* See ECMA reference at http://bugzilla.mozilla.org/show_bug.cgi?id=167325
+*
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 167325;
+var summary = "Test for TypeError on invalid default string value of object";
+var TEST_PASSED = 'TypeError';
+var TEST_FAILED = 'Generated an error, but NOT a TypeError!';
+var TEST_FAILED_BADLY = 'Did not generate ANY error!!!';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+status = inSection(1);
+expect = TEST_PASSED;
+actual = TEST_FAILED_BADLY;
+/*
+ * This should generate a TypeError. See ECMA reference
+ * at http://bugzilla.mozilla.org/show_bug.cgi?id=167325
+ */
+try
+{
+ var obj = {toString: function() {return new Object();}}
+ obj == 'abc';
+}
+catch(e)
+{
+ if (e instanceof TypeError)
+ actual = TEST_PASSED;
+ else
+ actual = TEST_FAILED;
+}
+addThis();
+
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/class-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/class-001.js
new file mode 100644
index 0000000..6572995
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/class-001.js
@@ -0,0 +1,128 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS"
+* basis, WITHOUT WARRANTY OF ANY KIND, either expressed
+* or implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation. All
+* Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+* Date: 14 Mar 2001
+*
+* SUMMARY: Testing the internal [[Class]] property of objects
+* See ECMA-262 Edition 3 13-Oct-1999, Section 8.6.2
+*
+* The getJSClass() function we use is in a utility file, e.g. "shell.js".
+*/
+//-------------------------------------------------------------------------------------------------
+var i = 0;
+var UBound = 0;
+var bug = '(none)';
+var summary = 'Testing the internal [[Class]] property of objects';
+var statprefix = 'Current object is: ';
+var status = ''; var statusList = [ ];
+var actual = ''; var actualvalue = [ ];
+var expect= ''; var expectedvalue = [ ];
+
+
+status = 'the global object';
+actual = getJSClass(this);
+expect = 'global';
+addThis();
+
+status = 'new Object()';
+actual = getJSClass(new Object());
+expect = 'Object';
+addThis();
+
+status = 'new Function()';
+actual = getJSClass(new Function());
+expect = 'Function';
+addThis();
+
+status = 'new Array()';
+actual = getJSClass(new Array());
+expect = 'Array';
+addThis();
+
+status = 'new String()';
+actual = getJSClass(new String());
+expect = 'String';
+addThis();
+
+status = 'new Boolean()';
+actual = getJSClass(new Boolean());
+expect = 'Boolean';
+addThis();
+
+status = 'new Number()';
+actual = getJSClass(new Number());
+expect = 'Number';
+addThis();
+
+status = 'Math';
+actual = getJSClass(Math); // can't use 'new' with the Math object (EMCA3, 15.8)
+expect = 'Math';
+addThis();
+
+status = 'new Date()';
+actual = getJSClass(new Date());
+expect = 'Date';
+addThis();
+
+status = 'new RegExp()';
+actual = getJSClass(new RegExp());
+expect = 'RegExp';
+addThis();
+
+status = 'new Error()';
+actual = getJSClass(new Error());
+expect = 'Error';
+addThis();
+
+
+
+//---------------------------------------------------------------------------------
+test();
+//---------------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusList[UBound] = status;
+ actualvalue[UBound] = actual;
+ expectedvalue[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ for (i = 0; i < UBound; i++)
+ {
+ reportCompare(expectedvalue[i], actualvalue[i], getStatus(i));
+ }
+
+ exitFunc ('test');
+}
+
+
+function getStatus(i)
+{
+ return statprefix + statusList[i];
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/class-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/class-002.js
new file mode 100644
index 0000000..bc5a7de
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/class-002.js
@@ -0,0 +1,124 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS"
+* basis, WITHOUT WARRANTY OF ANY KIND, either expressed
+* or implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation. All
+* Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+* Date: 14 Mar 2001
+*
+* SUMMARY: Testing the [[Class]] property of native constructors.
+* See ECMA-262 Edition 3 13-Oct-1999, Section 8.6.2 re [[Class]] property.
+*
+* Same as class-001.js - but testing the constructors here, not object instances.
+* Therefore we expect the [[Class]] property to equal 'Function' in each case.
+*
+* The getJSClass() function we use is in a utility file, e.g. "shell.js"
+*/
+//-------------------------------------------------------------------------------------------------
+var i = 0;
+var UBound = 0;
+var bug = '(none)';
+var summary = 'Testing the internal [[Class]] property of native constructors';
+var statprefix = 'Current constructor is: ';
+var status = ''; var statusList = [ ];
+var actual = ''; var actualvalue = [ ];
+var expect= ''; var expectedvalue = [ ];
+
+/*
+ * We set the expect variable each time only for readability.
+ * We expect 'Function' every time; see discussion above -
+ */
+status = 'Object';
+actual = getJSClass(Object);
+expect = 'Function';
+addThis();
+
+status = 'Function';
+actual = getJSClass(Function);
+expect = 'Function';
+addThis();
+
+status = 'Array';
+actual = getJSClass(Array);
+expect = 'Function';
+addThis();
+
+status = 'String';
+actual = getJSClass(String);
+expect = 'Function';
+addThis();
+
+status = 'Boolean';
+actual = getJSClass(Boolean);
+expect = 'Function';
+addThis();
+
+status = 'Number';
+actual = getJSClass(Number);
+expect = 'Function';
+addThis();
+
+status = 'Date';
+actual = getJSClass(Date);
+expect = 'Function';
+addThis();
+
+status = 'RegExp';
+actual = getJSClass(RegExp);
+expect = 'Function';
+addThis();
+
+status = 'Error';
+actual = getJSClass(Error);
+expect = 'Function';
+addThis();
+
+
+
+//---------------------------------------------------------------------------------
+test();
+//---------------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusList[UBound] = status;
+ actualvalue[UBound] = actual;
+ expectedvalue[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ for (i = 0; i < UBound; i++)
+ {
+ reportCompare(expectedvalue[i], actualvalue[i], getStatus(i));
+ }
+
+ exitFunc ('test');
+}
+
+
+function getStatus(i)
+{
+ return statprefix + statusList[i];
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/class-003.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/class-003.js
new file mode 100644
index 0000000..012a179
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/class-003.js
@@ -0,0 +1,118 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS"
+* basis, WITHOUT WARRANTY OF ANY KIND, either expressed
+* or implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation. All
+* Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+* Date: 14 Mar 2001
+*
+* SUMMARY: Testing the [[Class]] property of native error types.
+* See ECMA-262 Edition 3, Section 8.6.2 for the [[Class]] property.
+*
+* Same as class-001.js - but testing only the native error types here.
+* See ECMA-262 Edition 3, Section 15.11.6 for a list of these types.
+*
+* ECMA expects the [[Class]] property to equal 'Error' in each case.
+* See ECMA-262 Edition 3, Sections 15.11.1.1 and 15.11.7.2 for this.
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=56868
+*
+* The getJSClass() function we use is in a utility file, e.g. "shell.js"
+*/
+//-------------------------------------------------------------------------------------------------
+var i = 0;
+var UBound = 0;
+var bug = 56868;
+var summary = 'Testing the internal [[Class]] property of native error types';
+var statprefix = 'Current object is: ';
+var status = ''; var statusList = [ ];
+var actual = ''; var actualvalue = [ ];
+var expect= ''; var expectedvalue = [ ];
+
+/*
+ * We set the expect variable each time only for readability.
+ * We expect 'Error' every time; see discussion above -
+ */
+status = 'new Error()';
+actual = getJSClass(new Error());
+expect = 'Error';
+addThis();
+
+status = 'new EvalError()';
+actual = getJSClass(new EvalError());
+expect = 'Error';
+addThis();
+
+status = 'new RangeError()';
+actual = getJSClass(new RangeError());
+expect = 'Error';
+addThis();
+
+status = 'new ReferenceError()';
+actual = getJSClass(new ReferenceError());
+expect = 'Error';
+addThis();
+
+status = 'new SyntaxError()';
+actual = getJSClass(new SyntaxError());
+expect = 'Error';
+addThis();
+
+status = 'new TypeError()';
+actual = getJSClass(new TypeError());
+expect = 'Error';
+addThis();
+
+status = 'new URIError()';
+actual = getJSClass(new URIError());
+expect = 'Error';
+addThis();
+
+
+
+//---------------------------------------------------------------------------------
+test();
+//---------------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusList[UBound] = status;
+ actualvalue[UBound] = actual;
+ expectedvalue[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ for (i = 0; i < UBound; i++)
+ {
+ reportCompare(expectedvalue[i], actualvalue[i], getStatus(i));
+ }
+
+ exitFunc ('test');
+}
+
+
+function getStatus(i)
+{
+ return statprefix + statusList[i];
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/class-004.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/class-004.js
new file mode 100644
index 0000000..6c248cb
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/class-004.js
@@ -0,0 +1,117 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS"
+* basis, WITHOUT WARRANTY OF ANY KIND, either expressed
+* or implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation. All
+* Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+* Date: 14 Mar 2001
+*
+* SUMMARY: Testing [[Class]] property of native error constructors.
+* See ECMA-262 Edition 3, Section 8.6.2 for the [[Class]] property.
+*
+* See ECMA-262 Edition 3, Section 15.11.6 for the native error types.
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=56868
+*
+* Same as class-003.js - but testing the constructors here, not object instances.
+* Therefore we expect the [[Class]] property to equal 'Function' in each case.
+*
+* The getJSClass() function we use is in a utility file, e.g. "shell.js"
+*/
+//-------------------------------------------------------------------------------------------------
+var i = 0;
+var UBound = 0;
+var bug = 56868;
+var summary = 'Testing the internal [[Class]] property of native error constructors';
+var statprefix = 'Current constructor is: ';
+var status = ''; var statusList = [ ];
+var actual = ''; var actualvalue = [ ];
+var expect= ''; var expectedvalue = [ ];
+
+/*
+ * We set the expect variable each time only for readability.
+ * We expect 'Function' every time; see discussion above -
+ */
+status = 'Error';
+actual = getJSClass(Error);
+expect = 'Function';
+addThis();
+
+status = 'EvalError';
+actual = getJSClass(EvalError);
+expect = 'Function';
+addThis();
+
+status = 'RangeError';
+actual = getJSClass(RangeError);
+expect = 'Function';
+addThis();
+
+status = 'ReferenceError';
+actual = getJSClass(ReferenceError);
+expect = 'Function';
+addThis();
+
+status = 'SyntaxError';
+actual = getJSClass(SyntaxError);
+expect = 'Function';
+addThis();
+
+status = 'TypeError';
+actual = getJSClass(TypeError);
+expect = 'Function';
+addThis();
+
+status = 'URIError';
+actual = getJSClass(URIError);
+expect = 'Function';
+addThis();
+
+
+
+//---------------------------------------------------------------------------------
+test();
+//---------------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusList[UBound] = status;
+ actualvalue[UBound] = actual;
+ expectedvalue[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ for (i = 0; i < UBound; i++)
+ {
+ reportCompare(expectedvalue[i], actualvalue[i], getStatus(i));
+ }
+
+ exitFunc ('test');
+}
+
+
+function getStatus(i)
+{
+ return statprefix + statusList[i];
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/class-005.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/class-005.js
new file mode 100644
index 0000000..dd238f9
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/class-005.js
@@ -0,0 +1,102 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS"
+* basis, WITHOUT WARRANTY OF ANY KIND, either expressed
+* or implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation. All
+* Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+* Date: 14 Mar 2001
+*
+* SUMMARY: Testing the internal [[Class]] property of user-defined types.
+* See ECMA-262 Edition 3 13-Oct-1999, Section 8.6.2 re [[Class]] property.
+*
+* Same as class-001.js - but testing user-defined types here, not native types.
+* Therefore we expect the [[Class]] property to equal 'Object' in each case -
+*
+* The getJSClass() function we use is in a utility file, e.g. "shell.js"
+*/
+//-------------------------------------------------------------------------------------------------
+var i = 0;
+var UBound = 0;
+var bug = '(none)';
+var summary = 'Testing the internal [[Class]] property of user-defined types';
+var statprefix = 'Current user-defined type is: ';
+var status = ''; var statusList = [ ];
+var actual = ''; var actualvalue = [ ];
+var expect= ''; var expectedvalue = [ ];
+
+
+Calf.prototype= new Cow();
+
+/*
+ * We set the expect variable each time only for readability.
+ * We expect 'Object' every time; see discussion above -
+ */
+status = 'new Cow()';
+actual = getJSClass(new Cow());
+expect = 'Object';
+addThis();
+
+status = 'new Calf()';
+actual = getJSClass(new Calf());
+expect = 'Object';
+addThis();
+
+
+//---------------------------------------------------------------------------------
+test();
+//---------------------------------------------------------------------------------
+
+
+function addThis()
+{
+ statusList[UBound] = status;
+ actualvalue[UBound] = actual;
+ expectedvalue[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ for (i = 0; i < UBound; i++)
+ {
+ reportCompare(expectedvalue[i], actualvalue[i], getStatus(i));
+ }
+
+ exitFunc ('test');
+}
+
+
+function getStatus(i)
+{
+ return statprefix + statusList[i];
+}
+
+
+function Cow(name)
+{
+ this.name=name;
+}
+
+
+function Calf(name)
+{
+ this.name=name;
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/regress-72773.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/regress-72773.js
new file mode 100644
index 0000000..de3f2fc
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/regress-72773.js
@@ -0,0 +1,75 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS"
+* basis, WITHOUT WARRANTY OF ANY KIND, either expressed
+* or implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation. All
+* Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+* Date: 09 May 2001
+*
+* SUMMARY: Regression test: we shouldn't crash on this code
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=72773
+*
+* See ECMA-262 Edition 3 13-Oct-1999, Section 8.6.2 re [[Class]] property.
+*
+* Same as class-001.js - but testing user-defined types here, not native types.
+* Therefore we expect the [[Class]] property to equal 'Object' in each case -
+*
+* The getJSClass() function we use is in a utility file, e.g. "shell.js"
+*/
+//-------------------------------------------------------------------------------------------------
+var bug = 72773;
+var summary = "Regression test: we shouldn't crash on this code";
+var status = '';
+var actual = '';
+var expect = '';
+var sToEval = '';
+
+/*
+ * This code should produce an error, but not a crash.
+ * 'TypeError: Function.prototype.toString called on incompatible object'
+ */
+sToEval += 'function Cow(name){this.name = name;}'
+sToEval += 'function Calf(str){this.name = str;}'
+sToEval += 'Calf.prototype = Cow;'
+sToEval += 'new Calf().toString();'
+
+status = 'Trying to catch an expected error';
+try
+{
+ eval(sToEval);
+}
+catch(e)
+{
+ actual = getJSClass(e);
+ expect = 'Error';
+}
+
+
+//----------------------------------------------------------------------------------------------
+test();
+//----------------------------------------------------------------------------------------------
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ reportCompare(expect, actual, status);
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/regress-79129-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/regress-79129-001.js
new file mode 100644
index 0000000..a5ff87c
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/regress-79129-001.js
@@ -0,0 +1,58 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS"
+* basis, WITHOUT WARRANTY OF ANY KIND, either expressed
+* or implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation.
+* All Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+* Date: 06 May 2001
+*
+* SUMMARY: Regression test: we shouldn't crash on this code
+*
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=79129
+*/
+//-------------------------------------------------------------------------------------------------
+var bug = 79129;
+var summary = "Regression test: we shouldn't crash on this code";
+
+//-------------------------------------------------------------------------------------------------
+test();
+//-------------------------------------------------------------------------------------------------
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+ tryThis();
+ exitFunc ('test');
+}
+
+
+function tryThis()
+{
+ obj={};
+ obj.a = obj.b = obj.c = 1;
+ delete obj.a;
+ delete obj.b;
+ delete obj.c;
+ obj.d = obj.e = 1;
+ obj.a=1;
+ obj.b=1;
+ obj.c=1;
+ obj.d=1;
+ obj.e=1;
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/shell.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/shell.js
new file mode 100644
index 0000000..b92ffd2
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/shell.js
@@ -0,0 +1,81 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS
+* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+* implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation. All
+* Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+* Date: 14 Mar 2001
+*
+* SUMMARY: Utility functions for testing objects -
+*
+* Suppose obj is an instance of a native type, e.g. Number.
+* Then obj.toString() invokes Number.prototype.toString().
+* We would also like to access Object.prototype.toString().
+*
+* The difference is this: suppose obj = new Number(7).
+* Invoking Number.prototype.toString() on this just returns 7.
+* Object.prototype.toString() on this returns '[object Number]'.
+*
+* The getJSType() function below will return '[object Number]' for us.
+* The getJSClass() function returns 'Number', the [[Class]] property of obj.
+* See ECMA-262 Edition 3, 13-Oct-1999, Section 8.6.2
+*/
+//-------------------------------------------------------------------------------------------------
+var cnNoObject = 'Unexpected Error!!! Parameter to this function must be an object';
+var cnNoClass = 'Unexpected Error!!! Cannot find Class property';
+var cnObjectToString = Object.prototype.toString;
+
+
+// checks that it's safe to call findType()
+function getJSType(obj)
+{
+ if (isObject(obj))
+ return findType(obj);
+ return cnNoObject;
+}
+
+
+// checks that it's safe to call findType()
+function getJSClass(obj)
+{
+ if (isObject(obj))
+ return findClass(findType(obj));
+ return cnNoObject;
+}
+
+
+function findType(obj)
+{
+ return cnObjectToString.apply(obj);
+}
+
+
+// given '[object Number]', return 'Number'
+function findClass(sType)
+{
+ var re = /^\[.*\s+(\w+)\s*\]$/;
+ var a = sType.match(re);
+
+ if (a && a[1])
+ return a[1];
+ return cnNoClass;
+}
+
+
+function isObject(obj)
+{
+ return obj instanceof Object;
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Operators/11.13.1-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Operators/11.13.1-001.js
new file mode 100644
index 0000000..89b0c05
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Operators/11.13.1-001.js
@@ -0,0 +1,147 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2003
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): brendan@mozilla.org, pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 08 May 2003
+* SUMMARY: JS should evaluate RHS before binding LHS implicit variable
+*
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=204919
+*
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 204919;
+var summary = 'JS should evaluate RHS before binding LHS implicit variable';
+var TEST_PASSED = 'ReferenceError';
+var TEST_FAILED = 'Generated an error, but NOT a ReferenceError!';
+var TEST_FAILED_BADLY = 'Did not generate ANY error!!!';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+/*
+ * global scope -
+ */
+status = inSection(1);
+try
+{
+ x = x;
+ actual = TEST_FAILED_BADLY;
+}
+catch(e)
+{
+ if (e instanceof ReferenceError)
+ actual = TEST_PASSED;
+ else
+ actual = TEST_FAILED;
+}
+expect = TEST_PASSED;
+addThis();
+
+
+/*
+ * function scope -
+ */
+status = inSection(2);
+try
+{
+ (function() {y = y;})();
+ actual = TEST_FAILED_BADLY;
+}
+catch(e)
+{
+ if (e instanceof ReferenceError)
+ actual = TEST_PASSED;
+ else
+ actual = TEST_FAILED;
+}
+expect = TEST_PASSED;
+addThis();
+
+
+/*
+ * eval scope -
+ */
+status = inSection(3);
+try
+{
+ eval('z = z');
+ actual = TEST_FAILED_BADLY;
+}
+catch(e)
+{
+ if (e instanceof ReferenceError)
+ actual = TEST_PASSED;
+ else
+ actual = TEST_FAILED;
+}
+expect = TEST_PASSED;
+addThis();
+
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Operators/11.4.1-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Operators/11.4.1-001.js
new file mode 100644
index 0000000..7edffd2
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Operators/11.4.1-001.js
@@ -0,0 +1,115 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2003
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): igor@fastmail.fm, pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 14 April 2003
+* SUMMARY: |delete x.y| should return |true| if |x| has no property |y|
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=201987
+*
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 201987;
+var summary = '|delete x.y| should return |true| if |x| has no property |y|';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+status = inSection(1);
+var x = {};
+actual = delete x.y;
+expect = true;
+addThis();
+
+status = inSection(2);
+actual = delete {}.y;
+expect = true;
+addThis();
+
+status = inSection(3);
+actual = delete "".y;
+expect = true;
+addThis();
+
+status = inSection(4);
+actual = delete /abc/.y;
+expect = true;
+addThis();
+
+status = inSection(5);
+actual = delete (new Date()).y;
+expect = true;
+addThis();
+
+status = inSection(6);
+var x = 99;
+actual = delete x.y;
+expect = true;
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.2-1.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.2-1.js
new file mode 100644
index 0000000..f35c487
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.2-1.js
@@ -0,0 +1,176 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2002
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): rogerl@netscape.com, pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 09 July 2002
+* SUMMARY: RegExp conformance test
+*
+* These testcases are derived from the examples in the ECMA-262 Ed.3 spec
+* scattered through section 15.10.2.
+*
+*/
+//-----------------------------------------------------------------------------
+var i = 0;
+var bug = '(none)';
+var summary = 'RegExp conformance test';
+var status = '';
+var statusmessages = new Array();
+var pattern = '';
+var patterns = new Array();
+var string = '';
+var strings = new Array();
+var actualmatch = '';
+var actualmatches = new Array();
+var expectedmatch = '';
+var expectedmatches = new Array();
+
+
+status = inSection(1);
+pattern = /a|ab/;
+string = 'abc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a');
+addThis();
+
+status = inSection(2);
+pattern = /((a)|(ab))((c)|(bc))/;
+string = 'abc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abc', 'a', 'a', undefined, 'bc', undefined, 'bc');
+addThis();
+
+status = inSection(3);
+pattern = /a[a-z]{2,4}/;
+string = 'abcdefghi';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abcde');
+addThis();
+
+status = inSection(4);
+pattern = /a[a-z]{2,4}?/;
+string = 'abcdefghi';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abc');
+addThis();
+
+status = inSection(5);
+pattern = /(aa|aabaac|ba|b|c)*/;
+string = 'aabaac';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aaba', 'ba');
+addThis();
+
+status = inSection(6);
+pattern = /^(a+)\1*,\1+$/;
+string = 'aaaaaaaaaa,aaaaaaaaaaaaaaa';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aaaaaaaaaa,aaaaaaaaaaaaaaa', 'aaaaa');
+addThis();
+
+status = inSection(7);
+pattern = /(z)((a+)?(b+)?(c))*/;
+string = 'zaacbbbcac';
+actualmatch = string.match(pattern);
+expectedmatch = Array('zaacbbbcac', 'z', 'ac', 'a', undefined, 'c');
+addThis();
+
+status = inSection(8);
+pattern = /(a*)*/;
+string = 'b';
+actualmatch = string.match(pattern);
+expectedmatch = Array('', undefined);
+addThis();
+
+status = inSection(9);
+pattern = /(a*)b\1+/;
+string = 'baaaac';
+actualmatch = string.match(pattern);
+expectedmatch = Array('b', '');
+addThis();
+
+status = inSection(10);
+pattern = /(?=(a+))/;
+string = 'baaabac';
+actualmatch = string.match(pattern);
+expectedmatch = Array('', 'aaa');
+addThis();
+
+status = inSection(11);
+pattern = /(?=(a+))a*b\1/;
+string = 'baaabac';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aba', 'a');
+addThis();
+
+status = inSection(12);
+pattern = /(.*?)a(?!(a+)b\2c)\2(.*)/;
+string = 'baaabaac';
+actualmatch = string.match(pattern);
+expectedmatch = Array('baaabaac', 'ba', undefined, 'abaac');
+addThis();
+
+status = inSection(13);
+pattern = /(?=(a+))/;
+string = 'baaabac';
+actualmatch = string.match(pattern);
+expectedmatch = Array('', 'aaa');
+addThis();
+
+
+
+//-------------------------------------------------------------------------------------------------
+test();
+//-------------------------------------------------------------------------------------------------
+
+
+function addThis()
+{
+ statusmessages[i] = status;
+ patterns[i] = pattern;
+ strings[i] = string;
+ actualmatches[i] = actualmatch;
+ expectedmatches[i] = expectedmatch;
+ i++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+ testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.3.1-1.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.3.1-1.js
new file mode 100644
index 0000000..b12a14c
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.3.1-1.js
@@ -0,0 +1,115 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS
+* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+* implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation. All
+* Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+* Date: 26 November 2000
+*
+*
+* SUMMARY: Passing (RegExp object, flag) to RegExp() function.
+* This test arose from Bugzilla bug 61266. The ECMA3 section is:
+*
+* 15.10.3 The RegExp Constructor Called as a Function
+*
+* 15.10.3.1 RegExp(pattern, flags)
+*
+* If pattern is an object R whose [[Class]] property is "RegExp"
+* and flags is undefined, then return R unchanged. Otherwise
+* call the RegExp constructor (section 15.10.4.1), passing it the
+* pattern and flags arguments and return the object constructed
+* by that constructor.
+*
+*
+* The current test will check the first scenario outlined above:
+*
+* "pattern" is itself a RegExp object R
+* "flags" is undefined
+*
+* The flags parameter will be undefined in the sense of not being
+* provided. We check that RegExp(R) returns R -
+*/
+//-------------------------------------------------------------------------------------------------
+var bug = '61266';
+var summary = 'Passing (RegExp object,flag) to RegExp() function';
+var statprefix = 'RegExp(new RegExp(';
+var comma = ', '; var singlequote = "'"; var closeparens = '))';
+var cnSUCCESS = 'RegExp() returned the supplied RegExp object';
+var cnFAILURE = 'RegExp() did NOT return the supplied RegExp object';
+var i = -1; var j = -1; var s = ''; var f = '';
+var obj = {};
+var status = ''; var actual = ''; var expect = '';
+var patterns = new Array();
+var flags = new Array();
+
+
+// various regular expressions to try -
+patterns[0] = '';
+patterns[1] = 'abc';
+patterns[2] = '(.*)(3-1)\s\w';
+patterns[3] = '(.*)(...)\\s\\w';
+patterns[4] = '[^A-Za-z0-9_]';
+patterns[5] = '[^\f\n\r\t\v](123.5)([4 - 8]$)';
+
+// various flags to try -
+flags[0] = 'i';
+flags[1] = 'g';
+flags[2] = 'm';
+flags[3] = undefined;
+
+
+
+//-------------------------------------------------------------------------------------------------
+test();
+//-------------------------------------------------------------------------------------------------
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ for (i in patterns)
+ {
+ s = patterns[i];
+
+ for (j in flags)
+ {
+ f = flags[j];
+ status = getStatus(s, f);
+ obj = new RegExp(s, f);
+
+ actual = (obj == RegExp(obj))? cnSUCCESS : cnFAILURE;
+ expect = cnSUCCESS;
+ reportCompare (expect, actual, status);
+ }
+ }
+
+ exitFunc ('test');
+}
+
+
+function getStatus(regexp, flag)
+{
+ return (statprefix + quote(regexp) + comma + flag + closeparens);
+}
+
+
+function quote(text)
+{
+ return (singlequote + text + singlequote);
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.3.1-2.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.3.1-2.js
new file mode 100644
index 0000000..ed309b0
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.3.1-2.js
@@ -0,0 +1,123 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS
+* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+* implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation. All
+* Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+* Date: 26 November 2000
+*
+*
+* SUMMARY: Passing (RegExp object, flag) to RegExp() function.
+* This test arose from Bugzilla bug 61266. The ECMA3 section is:
+*
+* 15.10.3 The RegExp Constructor Called as a Function
+*
+* 15.10.3.1 RegExp(pattern, flags)
+*
+* If pattern is an object R whose [[Class]] property is "RegExp"
+* and flags is undefined, then return R unchanged. Otherwise
+* call the RegExp constructor (section 15.10.4.1), passing it the
+* pattern and flags arguments and return the object constructed
+* by that constructor.
+*
+*
+* The current test will check the first scenario outlined above:
+*
+* "pattern" is itself a RegExp object R
+* "flags" is undefined
+*
+* This test is identical to test 15.10.3.1-1.js, except here we do:
+*
+* RegExp(R, undefined);
+*
+* instead of:
+*
+* RegExp(R);
+*
+*
+* We check that RegExp(R, undefined) returns R -
+*/
+//-------------------------------------------------------------------------------------------------
+var bug = '61266';
+var summary = 'Passing (RegExp object,flag) to RegExp() function';
+var statprefix = 'RegExp(new RegExp(';
+var comma = ', '; var singlequote = "'"; var closeparens = '))';
+var cnSUCCESS = 'RegExp() returned the supplied RegExp object';
+var cnFAILURE = 'RegExp() did NOT return the supplied RegExp object';
+var i = -1; var j = -1; var s = ''; var f = '';
+var obj = {};
+var status = ''; var actual = ''; var expect = '';
+var patterns = new Array();
+var flags = new Array();
+
+
+// various regular expressions to try -
+patterns[0] = '';
+patterns[1] = 'abc';
+patterns[2] = '(.*)(3-1)\s\w';
+patterns[3] = '(.*)(...)\\s\\w';
+patterns[4] = '[^A-Za-z0-9_]';
+patterns[5] = '[^\f\n\r\t\v](123.5)([4 - 8]$)';
+
+// various flags to try -
+flags[0] = 'i';
+flags[1] = 'g';
+flags[2] = 'm';
+flags[3] = undefined;
+
+
+
+//-------------------------------------------------------------------------------------------------
+test();
+//-------------------------------------------------------------------------------------------------
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ for (i in patterns)
+ {
+ s = patterns[i];
+
+ for (j in flags)
+ {
+ f = flags[j];
+ status = getStatus(s, f);
+ obj = new RegExp(s, f);
+
+ actual = (obj == RegExp(obj, undefined))? cnSUCCESS : cnFAILURE ;
+ expect = cnSUCCESS;
+ reportCompare (expect, actual, status);
+ }
+ }
+
+ exitFunc ('test');
+}
+
+
+function getStatus(regexp, flag)
+{
+ return (statprefix + quote(regexp) + comma + flag + closeparens);
+}
+
+
+function quote(text)
+{
+ return (singlequote + text + singlequote);
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.4.1-1.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.4.1-1.js
new file mode 100644
index 0000000..c122abb
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.4.1-1.js
@@ -0,0 +1,111 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS
+* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+* implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation. All
+* Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+* Date: 26 November 2000
+*
+*
+*SUMMARY: Passing a RegExp object to a RegExp() constructor.
+*This test arose from Bugzilla bug 61266. The ECMA3 section is:
+*
+* 15.10.4.1 new RegExp(pattern, flags)
+*
+* If pattern is an object R whose [[Class]] property is "RegExp" and
+* flags is undefined, then let P be the pattern used to construct R
+* and let F be the flags used to construct R. If pattern is an object R
+* whose [[Class]] property is "RegExp" and flags is not undefined,
+* then throw a TypeError exception. Otherwise, let P be the empty string
+* if pattern is undefined and ToString(pattern) otherwise, and let F be
+* the empty string if flags is undefined and ToString(flags) otherwise.
+*
+*
+*The current test will check the first scenario outlined above:
+*
+* "pattern" is itself a RegExp object R
+* "flags" is undefined
+*
+* We check that a new RegExp object obj2 defined from these parameters
+* is morally the same as the original RegExp object obj1. Of course, they
+* can't be equal as objects - so we check their enumerable properties...
+*
+* In this test, the initial RegExp object obj1 will not include a flag. The flags
+* parameter for obj2 will be undefined in the sense of not being provided.
+*/
+//-------------------------------------------------------------------------------------------------
+var bug = '61266';
+var summary = 'Passing a RegExp object to a RegExp() constructor';
+var statprefix = 'Applying RegExp() twice to pattern ';
+var statsuffix = '; testing property ';
+var singlequote = "'";
+var i = -1; var s = '';
+var obj1 = {}; var obj2 = {};
+var status = ''; var actual = ''; var expect = ''; var msg = '';
+var patterns = new Array();
+
+
+// various regular expressions to try -
+patterns[0] = '';
+patterns[1] = 'abc';
+patterns[2] = '(.*)(3-1)\s\w';
+patterns[3] = '(.*)(...)\\s\\w';
+patterns[4] = '[^A-Za-z0-9_]';
+patterns[5] = '[^\f\n\r\t\v](123.5)([4 - 8]$)';
+
+
+
+//-------------------------------------------------------------------------------------------------
+test();
+//-------------------------------------------------------------------------------------------------
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ for (i in patterns)
+ {
+ s = patterns[i];
+ status =getStatus(s);
+ obj1 = new RegExp(s);
+ obj2 = new RegExp(obj1);
+
+ for (prop in obj2)
+ {
+ msg = status + quote(prop);
+ actual = obj2[prop];
+ expect = obj1[prop];
+ reportCompare (expect, actual, msg);
+ }
+ }
+
+ exitFunc ('test');
+}
+
+
+function getStatus(regexp)
+{
+ return (statprefix + quote(regexp) + statsuffix);
+}
+
+
+function quote(text)
+{
+ return (singlequote + text + singlequote);
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.4.1-2.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.4.1-2.js
new file mode 100644
index 0000000..e8613a4
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.4.1-2.js
@@ -0,0 +1,117 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS
+* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+* implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation. All
+* Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+* Date: 26 November 2000
+*
+*
+*SUMMARY: Passing a RegExp object to a RegExp() constructor.
+*This test arose from Bugzilla bug 61266. The ECMA3 section is:
+*
+* 15.10.4.1 new RegExp(pattern, flags)
+*
+* If pattern is an object R whose [[Class]] property is "RegExp" and
+* flags is undefined, then let P be the pattern used to construct R
+* and let F be the flags used to construct R. If pattern is an object R
+* whose [[Class]] property is "RegExp" and flags is not undefined,
+* then throw a TypeError exception. Otherwise, let P be the empty string
+* if pattern is undefined and ToString(pattern) otherwise, and let F be
+* the empty string if flags is undefined and ToString(flags) otherwise.
+*
+*
+*The current test will check the first scenario outlined above:
+*
+* "pattern" is itself a RegExp object R
+* "flags" is undefined
+*
+* We check that a new RegExp object obj2 defined from these parameters
+* is morally the same as the original RegExp object obj1. Of course, they
+* can't be equal as objects - so we check their enumerable properties...
+*
+* In this test, the initial RegExp object obj1 will not include a flag. This test is
+* identical to test 15.10.4.1-1.js, except that here we use this syntax:
+*
+* obj2 = new RegExp(obj1, undefined);
+*
+* instead of:
+*
+* obj2 = new RegExp(obj1);
+*/
+//-------------------------------------------------------------------------------------------------
+var bug = '61266';
+var summary = 'Passing a RegExp object to a RegExp() constructor';
+var statprefix = 'Applying RegExp() twice to pattern ';
+var statsuffix = '; testing property ';
+var singlequote = "'";
+var i = -1; var s = '';
+var obj1 = {}; var obj2 = {};
+var status = ''; var actual = ''; var expect = ''; var msg = '';
+var patterns = new Array();
+
+
+// various regular expressions to try -
+patterns[0] = '';
+patterns[1] = 'abc';
+patterns[2] = '(.*)(3-1)\s\w';
+patterns[3] = '(.*)(...)\\s\\w';
+patterns[4] = '[^A-Za-z0-9_]';
+patterns[5] = '[^\f\n\r\t\v](123.5)([4 - 8]$)';
+
+
+
+//-------------------------------------------------------------------------------------------------
+test();
+//-------------------------------------------------------------------------------------------------
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ for (i in patterns)
+ {
+ s = patterns[i];
+ status =getStatus(s);
+ obj1 = new RegExp(s);
+ obj2 = new RegExp(obj1, undefined); // see introduction to bug
+
+ for (prop in obj2)
+ {
+ msg = status + quote(prop);
+ actual = obj2[prop];
+ expect = obj1[prop];
+ reportCompare (expect, actual, msg);
+ }
+ }
+
+ exitFunc ('test');
+}
+
+
+function getStatus(regexp)
+{
+ return (statprefix + quote(regexp) + statsuffix);
+}
+
+
+function quote(text)
+{
+ return (singlequote + text + singlequote);
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.4.1-3.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.4.1-3.js
new file mode 100644
index 0000000..03c4498
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.4.1-3.js
@@ -0,0 +1,124 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS
+* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+* implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation. All
+* Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+* Date: 26 November 2000
+*
+*
+*SUMMARY: Passing a RegExp object to a RegExp() constructor.
+*This test arose from Bugzilla bug 61266. The ECMA3 section is:
+*
+* 15.10.4.1 new RegExp(pattern, flags)
+*
+* If pattern is an object R whose [[Class]] property is "RegExp" and
+* flags is undefined, then let P be the pattern used to construct R
+* and let F be the flags used to construct R. If pattern is an object R
+* whose [[Class]] property is "RegExp" and flags is not undefined,
+* then throw a TypeError exception. Otherwise, let P be the empty string
+* if pattern is undefined and ToString(pattern) otherwise, and let F be
+* the empty string if flags is undefined and ToString(flags) otherwise.
+*
+*
+*The current test will check the first scenario outlined above:
+*
+* "pattern" is itself a RegExp object R
+* "flags" is undefined
+*
+* We check that a new RegExp object obj2 defined from these parameters
+* is morally the same as the original RegExp object obj1. Of course, they
+* can't be equal as objects - so we check their enumerable properties...
+*
+* In this test, the initial RegExp obj1 will include a flag. The flags
+* parameter for obj2 will be undefined in the sense of not being provided.
+*/
+//-------------------------------------------------------------------------------------------------
+var bug = '61266';
+var summary = 'Passing a RegExp object to a RegExp() constructor';
+var statprefix = 'Applying RegExp() twice to pattern ';
+var statmiddle = ' and flag ';
+var statsuffix = '; testing property ';
+var singlequote = "'";
+var i = -1; var j = -1; var s = '';
+var obj1 = {}; var obj2 = {};
+var status = ''; var actual = ''; var expect = ''; var msg = '';
+var patterns = new Array();
+var flags = new Array();
+
+
+// various regular expressions to try -
+patterns[0] = '';
+patterns[1] = 'abc';
+patterns[2] = '(.*)(3-1)\s\w';
+patterns[3] = '(.*)(...)\\s\\w';
+patterns[4] = '[^A-Za-z0-9_]';
+patterns[5] = '[^\f\n\r\t\v](123.5)([4 - 8]$)';
+
+// various flags to try -
+flags[0] = 'i';
+flags[1] = 'g';
+flags[2] = 'm';
+flags[3] = undefined;
+
+
+
+//-------------------------------------------------------------------------------------------------
+test();
+//-------------------------------------------------------------------------------------------------
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ for (i in patterns)
+ {
+ s = patterns[i];
+
+ for (j in flags)
+ {
+ f = flags[j];
+ status = getStatus(s, f);
+ obj1 = new RegExp(s, f);
+ obj2 = new RegExp(obj1);
+
+ for (prop in obj2)
+ {
+ msg = status + quote(prop);
+ actual = obj2[prop];
+ expect = obj1[prop];
+ reportCompare (expect, actual, msg);
+ }
+ }
+ }
+
+ exitFunc ('test');
+}
+
+
+function getStatus(regexp, flag)
+{
+ return (statprefix + quote(regexp) + statmiddle + flag + statsuffix);
+}
+
+
+function quote(text)
+{
+ return (singlequote + text + singlequote);
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.4.1-4.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.4.1-4.js
new file mode 100644
index 0000000..e767a69
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.4.1-4.js
@@ -0,0 +1,130 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS
+* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+* implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation. All
+* Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+* Date: 26 November 2000
+*
+*
+*SUMMARY: Passing a RegExp object to a RegExp() constructor.
+*This test arose from Bugzilla bug 61266. The ECMA3 section is:
+*
+* 15.10.4.1 new RegExp(pattern, flags)
+*
+* If pattern is an object R whose [[Class]] property is "RegExp" and
+* flags is undefined, then let P be the pattern used to construct R
+* and let F be the flags used to construct R. If pattern is an object R
+* whose [[Class]] property is "RegExp" and flags is not undefined,
+* then throw a TypeError exception. Otherwise, let P be the empty string
+* if pattern is undefined and ToString(pattern) otherwise, and let F be
+* the empty string if flags is undefined and ToString(flags) otherwise.
+*
+*
+*The current test will check the first scenario outlined above:
+*
+* "pattern" is itself a RegExp object R
+* "flags" is undefined
+*
+* We check that a new RegExp object obj2 defined from these parameters
+* is morally the same as the original RegExp object obj1. Of course, they
+* can't be equal as objects - so we check their enumerable properties...
+*
+* In this test, the initial RegExp object obj1 will include a flag. This test is
+* identical to test 15.10.4.1-3.js, except that here we use this syntax:
+*
+* obj2 = new RegExp(obj1, undefined);
+*
+* instead of:
+*
+* obj2 = new RegExp(obj1);
+*/
+//-------------------------------------------------------------------------------------------------
+var bug = '61266';
+var summary = 'Passing a RegExp object to a RegExp() constructor';
+var statprefix = 'Applying RegExp() twice to pattern ';
+var statmiddle = ' and flag ';
+var statsuffix = '; testing property ';
+var singlequote = "'";
+var i = -1; var j = -1; var s = '';
+var obj1 = {}; var obj2 = {};
+var status = ''; var actual = ''; var expect = ''; var msg = '';
+var patterns = new Array();
+var flags = new Array();
+
+
+// various regular expressions to try -
+patterns[0] = '';
+patterns[1] = 'abc';
+patterns[2] = '(.*)(3-1)\s\w';
+patterns[3] = '(.*)(...)\\s\\w';
+patterns[4] = '[^A-Za-z0-9_]';
+patterns[5] = '[^\f\n\r\t\v](123.5)([4 - 8]$)';
+
+// various flags to try -
+flags[0] = 'i';
+flags[1] = 'g';
+flags[2] = 'm';
+flags[3] = undefined;
+
+
+
+//-------------------------------------------------------------------------------------------------
+test();
+//-------------------------------------------------------------------------------------------------
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ for (i in patterns)
+ {
+ s = patterns[i];
+
+ for (j in flags)
+ {
+ f = flags[j];
+ status = getStatus(s, f);
+ obj1 = new RegExp(s, f);
+ obj2 = new RegExp(obj1, undefined); // see introduction to bug
+
+ for (prop in obj2)
+ {
+ msg = status + quote(prop);
+ actual = obj2[prop];
+ expect = obj1[prop];
+ reportCompare (expect, actual, msg);
+ }
+ }
+ }
+
+ exitFunc ('test');
+}
+
+
+function getStatus(regexp, flag)
+{
+ return (statprefix + quote(regexp) + statmiddle + flag + statsuffix);
+}
+
+
+function quote(text)
+{
+ return (singlequote + text + singlequote);
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.4.1-5-n.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.4.1-5-n.js
new file mode 100644
index 0000000..5868e77
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.4.1-5-n.js
@@ -0,0 +1,113 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS
+* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+* implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation. All
+* Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+* Date: 26 November 2000
+*
+*
+*SUMMARY: Passing a RegExp object to a RegExp() constructor.
+*This test arose from Bugzilla bug 61266. The ECMA3 section is:
+*
+* 15.10.4.1 new RegExp(pattern, flags)
+*
+* If pattern is an object R whose [[Class]] property is "RegExp" and
+* flags is undefined, then let P be the pattern used to construct R
+* and let F be the flags used to construct R. If pattern is an object R
+* whose [[Class]] property is "RegExp" and flags is not undefined,
+* then throw a TypeError exception. Otherwise, let P be the empty string
+* if pattern is undefined and ToString(pattern) otherwise, and let F be
+* the empty string if flags is undefined and ToString(flags) otherwise.
+*
+*
+*The current test will check the second scenario outlined above:
+*
+* "pattern" is itself a RegExp object R
+* "flags" is NOT undefined
+*
+* This should throw an exception ... we test for this.
+*
+*/
+//-------------------------------------------------------------------------------------------------
+var bug = '61266';
+var summary = 'Negative test: Passing (RegExp object, flag) to RegExp() constructor';
+var statprefix = 'Passing RegExp object on pattern ';
+var statsuffix = '; passing flag ';
+var cnFAILURE = 'Expected an exception to be thrown, but none was -';
+var singlequote = "'";
+var i = -1; var j = -1; var s = ''; var f = '';
+var obj1 = {}; var obj2 = {};
+var patterns = new Array();
+var flags = new Array();
+
+
+// various regular expressions to try -
+patterns[0] = '';
+patterns[1] = 'abc';
+patterns[2] = '(.*)(3-1)\s\w';
+patterns[3] = '(.*)(...)\\s\\w';
+patterns[4] = '[^A-Za-z0-9_]';
+patterns[5] = '[^\f\n\r\t\v](123.5)([4 - 8]$)';
+
+// various flags to try -
+flags[0] = 'i';
+flags[1] = 'g';
+flags[2] = 'm';
+
+
+
+//-------------------------------------------------------------------------------------------------
+test();
+//-------------------------------------------------------------------------------------------------
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ for (i in patterns)
+ {
+ s = patterns[i];
+
+ for (j in flags)
+ {
+ f = flags[j];
+ printStatus(getStatus(s, f));
+ obj1 = new RegExp(s, f);
+ obj2 = new RegExp(obj1, f); // this should cause an exception
+
+ // WE SHOULD NEVER REACH THIS POINT -
+ reportFailure(cnFAILURE);
+ }
+ }
+
+ exitFunc ('test');
+}
+
+
+function getStatus(regexp, flag)
+{
+ return (statprefix + quote(regexp) + statsuffix + flag);
+}
+
+
+function quote(text)
+{
+ return (singlequote + text + singlequote);
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.6.2-1.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.6.2-1.js
new file mode 100644
index 0000000..365e32d
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.6.2-1.js
@@ -0,0 +1,119 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS"
+* basis, WITHOUT WARRANTY OF ANY KIND, either expressed
+* or implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation.
+* All Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+* Date: 23 October 2001
+*
+* SUMMARY: Testing regexps with the global flag set.
+* NOT every substring fitting the given pattern will be matched.
+* The parent string is CONSUMED as successive matches are found.
+*
+* From the ECMA-262 Final spec:
+*
+* 15.10.6.2 RegExp.prototype.exec(string)
+* Performs a regular expression match of string against the regular
+* expression and returns an Array object containing the results of
+* the match, or null if the string did not match.
+*
+* The string ToString(string) is searched for an occurrence of the
+* regular expression pattern as follows:
+*
+* 1. Let S be the value of ToString(string).
+* 2. Let length be the length of S.
+* 3. Let lastIndex be the value of the lastIndex property.
+* 4. Let i be the value of ToInteger(lastIndex).
+* 5. If the global property is false, let i = 0.
+* 6. If i < 0 or i > length then set lastIndex to 0 and return null.
+* 7. Call [[Match]], giving it the arguments S and i.
+* If [[Match]] returned failure, go to step 8;
+* otherwise let r be its State result and go to step 10.
+* 8. Let i = i+1.
+* 9. Go to step 6.
+* 10. Let e be r's endIndex value.
+* 11. If the global property is true, set lastIndex to e.
+*
+* etc.
+*
+*
+* So when the global flag is set, |lastIndex| is incremented every time
+* there is a match; not from i to i+1, but from i to "endIndex" e:
+*
+* e = (index of last input character matched so far by the pattern) + 1
+*
+* Thus in the example below, the first endIndex e occurs after the
+* first match 'a b'. The next match will begin AFTER this, and so
+* will NOT be 'b c', but rather 'c d'. Similarly, 'd e' won't be matched.
+*/
+//-----------------------------------------------------------------------------
+var i = 0;
+var bug = '(none)';
+var summary = 'Testing regexps with the global flag set';
+var status = '';
+var statusmessages = new Array();
+var pattern = '';
+var patterns = new Array();
+var string = '';
+var strings = new Array();
+var actualmatch = '';
+var actualmatches = new Array();
+var expectedmatch = '';
+var expectedmatches = new Array();
+
+
+status = inSection(1);
+string = 'a b c d e';
+pattern = /\w\s\w/g;
+actualmatch = string.match(pattern);
+expectedmatch = ['a b','c d']; // see above explanation -
+addThis();
+
+
+status = inSection(2);
+string = '12345678';
+pattern = /\d\d\d/g;
+actualmatch = string.match(pattern);
+expectedmatch = ['123','456'];
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusmessages[i] = status;
+ patterns[i] = pattern;
+ strings[i] = string;
+ actualmatches[i] = actualmatch;
+ expectedmatches[i] = expectedmatch;
+ i++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+ testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.6.2-2.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.6.2-2.js
new file mode 100644
index 0000000..cce4c2c
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.6.2-2.js
@@ -0,0 +1,362 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2002
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 18 Feb 2002
+* SUMMARY: Testing re.exec(str) when re.lastIndex is < 0 or > str.length
+*
+* Case 1: If re has the global flag set, then re(str) should be null
+* Case 2: If re doesn't have this set, then re(str) should be unaffected
+*
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=76717
+*
+*
+* From the ECMA-262 Final spec:
+*
+* 15.10.6.2 RegExp.prototype.exec(string)
+* Performs a regular expression match of string against the regular
+* expression and returns an Array object containing the results of
+* the match, or null if the string did not match.
+*
+* The string ToString(string) is searched for an occurrence of the
+* regular expression pattern as follows:
+*
+* 1. Let S be the value of ToString(string).
+* 2. Let length be the length of S.
+* 3. Let lastIndex be the value of the lastIndex property.
+* 4. Let i be the value of ToInteger(lastIndex).
+* 5. If the global property is false, let i = 0.
+* 6. If i < 0 or i > length then set lastIndex to 0 and return null.
+* 7. Call [[Match]], giving it the arguments S and i.
+* If [[Match]] returned failure, go to step 8;
+* otherwise let r be its State result and go to step 10.
+* 8. Let i = i+1.
+* 9. Go to step 6.
+* 10. Let e be r's endIndex value.
+* 11. If the global property is true, set lastIndex to e.
+*
+* etc.
+*
+*
+* So:
+*
+* A. If the global flag is not set, |lastIndex| is set to 0
+* before the match is attempted; thus the match is unaffected.
+*
+* B. If the global flag IS set and re.lastIndex is >= 0 and <= str.length,
+* |lastIndex| is incremented every time there is a match; not from
+* i to i+1, but from i to "endIndex" e:
+*
+* e = (index of last input character matched so far by the pattern) + 1
+*
+* The match is then attempted from this position in the string (Step 7).
+*
+* C. When the global flag IS set and re.lastIndex is < 0 or > str.length,
+* |lastIndex| is set to 0 and the match returns null.
+*
+*
+* Note the |lastIndex| property is writeable, and may be set arbitrarily
+* by the programmer - and we will do that below.
+*
+*/
+//-----------------------------------------------------------------------------
+var i = 0;
+var bug = 76717;
+var summary = 'Testing re.exec(str) when re.lastIndex is < 0 or > str.length';
+var status = '';
+var statusmessages = new Array();
+var pattern = '';
+var patterns = new Array();
+var string = '';
+var strings = new Array();
+var actualmatch = '';
+var actualmatches = new Array();
+var expectedmatch = '';
+var expectedmatches = new Array();
+
+
+/******************************************************************************
+ *
+ * Case 1 : when the global flag is set -
+ *
+ *****************************************************************************/
+pattern = /abc/gi;
+string = 'AbcaBcabC';
+
+ status = inSection(1);
+ actualmatch = pattern.exec(string);
+ expectedmatch = Array('Abc');
+ addThis();
+
+ status = inSection(2);
+ actualmatch = pattern.exec(string);
+ expectedmatch = Array('aBc');
+ addThis();
+
+ status = inSection(3);
+ actualmatch = pattern.exec(string);
+ expectedmatch = Array('abC');
+ addThis();
+
+ /*
+ * At this point |lastIndex| is > string.length, so the match should be null -
+ */
+ status = inSection(4);
+ actualmatch = pattern.exec(string);
+ expectedmatch = null;
+ addThis();
+
+ /*
+ * Now let's set |lastIndex| to -1, so the match should again be null -
+ */
+ status = inSection(5);
+ pattern.lastIndex = -1;
+ actualmatch = pattern.exec(string);
+ expectedmatch = null;
+ addThis();
+
+ /*
+ * Now try some edge-case values. Thanks to the work done in
+ * http://bugzilla.mozilla.org/show_bug.cgi?id=124339, |lastIndex|
+ * is now stored as a double instead of a uint32 (unsigned integer).
+ *
+ * Note 2^32 -1 is the upper bound for uint32's, but doubles can go
+ * all the way up to Number.MAX_VALUE. So that's why we need cases
+ * between those two numbers.
+ */
+ status = inSection(6);
+ pattern.lastIndex = Math.pow(2,32);
+ actualmatch = pattern.exec(string);
+ expectedmatch = null;
+ addThis();
+
+ status = inSection(7);
+ pattern.lastIndex = -Math.pow(2,32);
+ actualmatch = pattern.exec(string);
+ expectedmatch = null;
+ addThis();
+
+ status = inSection(8);
+ pattern.lastIndex = Math.pow(2,32) + 1;
+ actualmatch = pattern.exec(string);
+ expectedmatch = null;
+ addThis();
+
+ status = inSection(9);
+ pattern.lastIndex = -(Math.pow(2,32) + 1);
+ actualmatch = pattern.exec(string);
+ expectedmatch = null;
+ addThis();
+
+ status = inSection(10);
+ pattern.lastIndex = Math.pow(2,32) * 2;
+ actualmatch = pattern.exec(string);
+ expectedmatch = null;
+ addThis();
+
+ status = inSection(11);
+ pattern.lastIndex = -Math.pow(2,32) * 2;
+ actualmatch = pattern.exec(string);
+ expectedmatch = null;
+ addThis();
+
+ status = inSection(12);
+ pattern.lastIndex = Math.pow(2,40);
+ actualmatch = pattern.exec(string);
+ expectedmatch = null;
+ addThis();
+
+ status = inSection(13);
+ pattern.lastIndex = -Math.pow(2,40);
+ actualmatch = pattern.exec(string);
+ expectedmatch = null;
+ addThis();
+
+ status = inSection(14);
+ pattern.lastIndex = Number.MAX_VALUE;
+ actualmatch = pattern.exec(string);
+ expectedmatch = null;
+ addThis();
+
+ status = inSection(15);
+ pattern.lastIndex = -Number.MAX_VALUE;
+ actualmatch = pattern.exec(string);
+ expectedmatch = null;
+ addThis();
+
+
+
+/******************************************************************************
+ *
+ * Case 2: repeat all the above cases WITHOUT the global flag set.
+ * According to EMCA. |lastIndex| should get set to 0 before the match.
+ *
+ * Therefore re.exec(str) should be unaffected; thus our expected values
+ * below are now DIFFERENT when |lastIndex| is < 0 or > str.length
+ *
+ *****************************************************************************/
+
+pattern = /abc/i;
+string = 'AbcaBcabC';
+
+ status = inSection(16);
+ actualmatch = pattern.exec(string);
+ expectedmatch = Array('Abc');
+ addThis();
+
+ status = inSection(17);
+ actualmatch = pattern.exec(string);
+ expectedmatch = Array('Abc'); // NOT Array('aBc') as before -
+ addThis();
+
+ status = inSection(18);
+ actualmatch = pattern.exec(string);
+ expectedmatch = Array('Abc'); // NOT Array('abC') as before -
+ addThis();
+
+ /*
+ * At this point above, |lastIndex| WAS > string.length, but not here -
+ */
+ status = inSection(19);
+ actualmatch = pattern.exec(string);
+ expectedmatch = Array('Abc') // NOT null as before -
+ addThis();
+
+ /*
+ * Now let's set |lastIndex| to -1
+ */
+ status = inSection(20);
+ pattern.lastIndex = -1;
+ actualmatch = pattern.exec(string);
+ expectedmatch = Array('Abc') // NOT null as before -
+ addThis();
+
+ /*
+ * Now try some edge-case values. Thanks to the work done in
+ * http://bugzilla.mozilla.org/show_bug.cgi?id=124339, |lastIndex|
+ * is now stored as a double instead of a uint32 (unsigned integer).
+ *
+ * Note 2^32 -1 is the upper bound for uint32's, but doubles can go
+ * all the way up to Number.MAX_VALUE. So that's why we need cases
+ * between those two numbers.
+ */
+ status = inSection(21);
+ pattern.lastIndex = Math.pow(2,32);
+ actualmatch = pattern.exec(string);
+ expectedmatch = Array('Abc') // NOT null as before -
+ addThis();
+
+ status = inSection(22);
+ pattern.lastIndex = -Math.pow(2,32);
+ actualmatch = pattern.exec(string);
+ expectedmatch = Array('Abc') // NOT null as before -
+ addThis();
+
+ status = inSection(23);
+ pattern.lastIndex = Math.pow(2,32) + 1;
+ actualmatch = pattern.exec(string);
+ expectedmatch = Array('Abc') // NOT null as before -
+ addThis();
+
+ status = inSection(24);
+ pattern.lastIndex = -(Math.pow(2,32) + 1);
+ actualmatch = pattern.exec(string);
+ expectedmatch = Array('Abc') // NOT null as before -
+ addThis();
+
+ status = inSection(25);
+ pattern.lastIndex = Math.pow(2,32) * 2;
+ actualmatch = pattern.exec(string);
+ expectedmatch = Array('Abc') // NOT null as before -
+ addThis();
+
+ status = inSection(26);
+ pattern.lastIndex = -Math.pow(2,32) * 2;
+ actualmatch = pattern.exec(string);
+ expectedmatch = Array('Abc') // NOT null as before -
+ addThis();
+
+ status = inSection(27);
+ pattern.lastIndex = Math.pow(2,40);
+ actualmatch = pattern.exec(string);
+ expectedmatch = Array('Abc') // NOT null as before -;
+ addThis();
+
+ status = inSection(28);
+ pattern.lastIndex = -Math.pow(2,40);
+ actualmatch = pattern.exec(string);
+ expectedmatch = Array('Abc') // NOT null as before -
+ addThis();
+
+ status = inSection(29);
+ pattern.lastIndex = Number.MAX_VALUE;
+ actualmatch = pattern.exec(string);
+ expectedmatch = Array('Abc') // NOT null as before -
+ addThis();
+
+ status = inSection(30);
+ pattern.lastIndex = -Number.MAX_VALUE;
+ actualmatch = pattern.exec(string);
+ expectedmatch = Array('Abc') // NOT null as before -
+ addThis();
+
+
+
+
+//-------------------------------------------------------------------------------------------------
+test();
+//-------------------------------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusmessages[i] = status;
+ patterns[i] = pattern;
+ strings[i] = string;
+ actualmatches[i] = actualmatch;
+ expectedmatches[i] = expectedmatch;
+ i++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+ testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/octal-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/octal-001.js
new file mode 100644
index 0000000..34b3e34
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/octal-001.js
@@ -0,0 +1,131 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2002
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 18 July 2002
+* SUMMARY: Testing octal sequences in regexps
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=141078
+*
+*/
+//-----------------------------------------------------------------------------
+var i = 0;
+var bug = 141078;
+var summary = 'Testing octal sequences in regexps';
+var status = '';
+var statusmessages = new Array();
+var pattern = '';
+var patterns = new Array();
+var string = '';
+var strings = new Array();
+var actualmatch = '';
+var actualmatches = new Array();
+var expectedmatch = '';
+var expectedmatches = new Array();
+
+
+status = inSection(1);
+pattern = /\240/;
+string = 'abc';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+/*
+ * In the following sections, we test the octal escape sequence '\052'.
+ * This is character code 42, representing the asterisk character '*'.
+ * The Unicode escape for it would be '\u002A', the hex escape '\x2A'.
+ */
+status = inSection(2);
+pattern = /ab\052c/;
+string = 'ab*c';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ab*c');
+addThis();
+
+status = inSection(3);
+pattern = /ab\052*c/;
+string = 'abc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abc');
+addThis();
+
+status = inSection(4);
+pattern = /ab(\052)+c/;
+string = 'ab****c';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ab****c', '*');
+addThis();
+
+status = inSection(5);
+pattern = /ab((\052)+)c/;
+string = 'ab****c';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ab****c', '****', '*');
+addThis();
+
+status = inSection(6);
+pattern = /(?:\052)c/;
+string = 'ab****c';
+actualmatch = string.match(pattern);
+expectedmatch = Array('*c');
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusmessages[i] = status;
+ patterns[i] = pattern;
+ strings[i] = string;
+ actualmatches[i] = actualmatch;
+ expectedmatches[i] = expectedmatch;
+ i++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+ testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/octal-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/octal-002.js
new file mode 100644
index 0000000..6d75e48
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/octal-002.js
@@ -0,0 +1,213 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2002
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 31 July 2002
+* SUMMARY: Testing regexps containing octal escape sequences
+* This is an elaboration of mozilla/js/tests/ecma_2/RegExp/octal-003.js
+*
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=141078
+* for a reference on octal escape sequences in regexps.
+*
+* NOTE:
+* We will use the identities '\011' === '\u0009' === '\x09' === '\t'
+*
+* The first is an octal escape sequence (\(0-3)OO; O an octal digit).
+* See ECMA-262 Edition 2, Section 7.7.4 "String Literals". These were
+* dropped in Edition 3 but we support them for backward compatibility.
+*
+* The second is a Unicode escape sequence (\uHHHH; H a hex digit).
+* Since octal 11 = hex 9, the two escapes define the same character.
+*
+* The third is a hex escape sequence (\xHH; H a hex digit).
+* Since hex 09 = hex 0009, this defines the same character.
+*
+* The fourth is the familiar escape sequence for a horizontal tab,
+* defined in the ECMA spec as having Unicode value \u0009.
+*/
+//-----------------------------------------------------------------------------
+var i = 0;
+var bug = 141078;
+var summary = 'Testing regexps containing octal escape sequences';
+var status = '';
+var statusmessages = new Array();
+var pattern = '';
+var patterns = new Array();
+var string = '';
+var strings = new Array();
+var actualmatch = '';
+var actualmatches = new Array();
+var expectedmatch = '';
+var expectedmatches = new Array();
+
+
+/*
+ * Test a string containing the null character '\0' followed by the string '11'
+ *
+ * 'a' + String.fromCharCode(0) + '11';
+ *
+ * Note we can't simply write 'a\011', because '\011' would be interpreted
+ * as the octal escape sequence for the tab character (see above).
+ *
+ * We should get no match from the regexp /.\011/, because it should be
+ * looking for the octal escape sequence \011, i.e. the tab character -
+ *
+ */
+status = inSection(1);
+pattern = /.\011/;
+string = 'a' + String.fromCharCode(0) + '11';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+
+/*
+ * Try same thing with 'xx' in place of '11'.
+ *
+ * Should get a match now, because the octal escape sequence in the regexp
+ * has been reduced from \011 to \0, and '\0' is present in the string -
+ */
+status = inSection(2);
+pattern = /.\0xx/;
+string = 'a' + String.fromCharCode(0) + 'xx';
+actualmatch = string.match(pattern);
+expectedmatch = Array(string);
+addThis();
+
+
+/*
+ * Same thing; don't use |String.fromCharCode(0)| this time.
+ * There is no ambiguity in '\0xx': it is the null character
+ * followed by two x's, no other interpretation is possible.
+ */
+status = inSection(3);
+pattern = /.\0xx/;
+string = 'a\0xx';
+actualmatch = string.match(pattern);
+expectedmatch = Array(string);
+addThis();
+
+
+/*
+ * This one should produce a match. The two-character string
+ * 'a' + '\011' is duplicated in the pattern and test string:
+ */
+status = inSection(4);
+pattern = /.\011/;
+string = 'a\011';
+actualmatch = string.match(pattern);
+expectedmatch = Array(string);
+addThis();
+
+
+/*
+ * Same as above, only now, for the second character of the string,
+ * use the Unicode escape '\u0009' instead of the octal escape '\011'
+ */
+status = inSection(5);
+pattern = /.\011/;
+string = 'a\u0009';
+actualmatch = string.match(pattern);
+expectedmatch = Array(string);
+addThis();
+
+
+/*
+ * Same as above, only now for the second character of the string,
+ * use the hex escape '\x09' instead of the octal escape '\011'
+ */
+status = inSection(6);
+pattern = /.\011/;
+string = 'a\x09';
+actualmatch = string.match(pattern);
+expectedmatch = Array(string);
+addThis();
+
+
+/*
+ * Same as above, only now for the second character of the string,
+ * use the escape '\t' instead of the octal escape '\011'
+ */
+status = inSection(7);
+pattern = /.\011/;
+string = 'a\t';
+actualmatch = string.match(pattern);
+expectedmatch = Array(string);
+addThis();
+
+
+/*
+ * Return to the string from Section 1.
+ *
+ * Unlike Section 1, use the RegExp() function to create the
+ * regexp pattern: null character followed by the string '11'.
+ *
+ * Since this is exactly what the string is, we should get a match -
+ */
+status = inSection(8);
+string = 'a' + String.fromCharCode(0) + '11';
+pattern = RegExp(string);
+actualmatch = string.match(pattern);
+expectedmatch = Array(string);
+addThis();
+
+
+
+
+//-------------------------------------------------------------------------------------------------
+test();
+//-------------------------------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusmessages[i] = status;
+ patterns[i] = pattern;
+ strings[i] = string;
+ actualmatches[i] = actualmatch;
+ expectedmatches[i] = expectedmatch;
+ i++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+ testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/perlstress-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/perlstress-001.js
new file mode 100644
index 0000000..fd544c2
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/perlstress-001.js
@@ -0,0 +1,3225 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2002
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com, rogerl@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 2002-07-07
+* SUMMARY: Testing JS RegExp engine against Perl 5 RegExp engine.
+* Adjust cnLBOUND, cnUBOUND below to restrict which sections are tested.
+*
+* This test was created by running various patterns and strings through the
+* Perl 5 RegExp engine. We saved the results below to test the JS engine.
+*
+* NOTE: ECMA/JS and Perl do differ on certain points. We have either commented
+* out such sections altogether, or modified them to fit what we expect from JS.
+*
+* EXAMPLES:
+*
+* - In JS, regexp captures (/(a) etc./) must hold |undefined| if not used.
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=123437.
+* By contrast, in Perl, unmatched captures hold the empty string.
+* We have modified such sections accordingly. Example:
+
+ pattern = /^([^a-z])|(\^)$/;
+ string = '.';
+ actualmatch = string.match(pattern);
+ //expectedmatch = Array('.', '.', ''); <<<--- Perl
+ expectedmatch = Array('.', '.', undefined); <<<--- JS
+ addThis();
+
+
+* - In JS, you can't refer to a capture before it's encountered & completed
+*
+* - Perl supports ] & ^] inside a [], ECMA does not
+*
+* - ECMA does support (?: (?= and (?! operators, but doesn't support (?< etc.
+*
+* - ECMA doesn't support (?imsx or (?-imsx
+*
+* - ECMA doesn't support (?(condition)
+*
+* - Perl has \Z has end-of-line, ECMA doesn't
+*
+* - In ECMA, ^ matches only the empty string before the first character
+*
+* - In ECMA, $ matches only the empty string at end of input (unless multiline)
+*
+* - ECMA spec says that each atom in a range must be a single character
+*
+* - ECMA doesn't support \A
+*
+* - ECMA doesn't have rules for [:
+*
+*/
+//-----------------------------------------------------------------------------
+var i = 0;
+var bug = 85721;
+var summary = 'Testing regular expression edge cases';
+var cnSingleSpace = ' ';
+var status = '';
+var statusmessages = new Array();
+var pattern = '';
+var patterns = new Array();
+var string = '';
+var strings = new Array();
+var actualmatch = '';
+var actualmatches = new Array();
+var expectedmatch = '';
+var expectedmatches = new Array();
+var cnLBOUND = 1;
+var cnUBOUND = 1000;
+
+
+status = inSection(1);
+pattern = /abc/;
+string = 'abc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abc');
+addThis();
+
+status = inSection(2);
+pattern = /abc/;
+string = 'xabcy';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abc');
+addThis();
+
+status = inSection(3);
+pattern = /abc/;
+string = 'ababc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abc');
+addThis();
+
+status = inSection(4);
+pattern = /ab*c/;
+string = 'abc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abc');
+addThis();
+
+status = inSection(5);
+pattern = /ab*bc/;
+string = 'abc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abc');
+addThis();
+
+status = inSection(6);
+pattern = /ab*bc/;
+string = 'abbc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abbc');
+addThis();
+
+status = inSection(7);
+pattern = /ab*bc/;
+string = 'abbbbc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abbbbc');
+addThis();
+
+status = inSection(8);
+pattern = /.{1}/;
+string = 'abbbbc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a');
+addThis();
+
+status = inSection(9);
+pattern = /.{3,4}/;
+string = 'abbbbc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abbb');
+addThis();
+
+status = inSection(10);
+pattern = /ab{0,}bc/;
+string = 'abbbbc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abbbbc');
+addThis();
+
+status = inSection(11);
+pattern = /ab+bc/;
+string = 'abbc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abbc');
+addThis();
+
+status = inSection(12);
+pattern = /ab+bc/;
+string = 'abbbbc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abbbbc');
+addThis();
+
+status = inSection(13);
+pattern = /ab{1,}bc/;
+string = 'abbbbc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abbbbc');
+addThis();
+
+status = inSection(14);
+pattern = /ab{1,3}bc/;
+string = 'abbbbc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abbbbc');
+addThis();
+
+status = inSection(15);
+pattern = /ab{3,4}bc/;
+string = 'abbbbc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abbbbc');
+addThis();
+
+status = inSection(16);
+pattern = /ab?bc/;
+string = 'abbc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abbc');
+addThis();
+
+status = inSection(17);
+pattern = /ab?bc/;
+string = 'abc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abc');
+addThis();
+
+status = inSection(18);
+pattern = /ab{0,1}bc/;
+string = 'abc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abc');
+addThis();
+
+status = inSection(19);
+pattern = /ab?c/;
+string = 'abc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abc');
+addThis();
+
+status = inSection(20);
+pattern = /ab{0,1}c/;
+string = 'abc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abc');
+addThis();
+
+status = inSection(21);
+pattern = /^abc$/;
+string = 'abc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abc');
+addThis();
+
+status = inSection(22);
+pattern = /^abc/;
+string = 'abcc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abc');
+addThis();
+
+status = inSection(23);
+pattern = /abc$/;
+string = 'aabc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abc');
+addThis();
+
+status = inSection(24);
+pattern = /^/;
+string = 'abc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('');
+addThis();
+
+status = inSection(25);
+pattern = /$/;
+string = 'abc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('');
+addThis();
+
+status = inSection(26);
+pattern = /a.c/;
+string = 'abc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abc');
+addThis();
+
+status = inSection(27);
+pattern = /a.c/;
+string = 'axc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('axc');
+addThis();
+
+status = inSection(28);
+pattern = /a.*c/;
+string = 'axyzc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('axyzc');
+addThis();
+
+status = inSection(29);
+pattern = /a[bc]d/;
+string = 'abd';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abd');
+addThis();
+
+status = inSection(30);
+pattern = /a[b-d]e/;
+string = 'ace';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ace');
+addThis();
+
+status = inSection(31);
+pattern = /a[b-d]/;
+string = 'aac';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ac');
+addThis();
+
+status = inSection(32);
+pattern = /a[-b]/;
+string = 'a-';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a-');
+addThis();
+
+status = inSection(33);
+pattern = /a[b-]/;
+string = 'a-';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a-');
+addThis();
+
+status = inSection(34);
+pattern = /a]/;
+string = 'a]';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a]');
+addThis();
+
+/* Perl supports ] & ^] inside a [], ECMA does not
+pattern = /a[]]b/;
+status = inSection(35);
+string = 'a]b';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a]b');
+addThis();
+*/
+
+status = inSection(36);
+pattern = /a[^bc]d/;
+string = 'aed';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aed');
+addThis();
+
+status = inSection(37);
+pattern = /a[^-b]c/;
+string = 'adc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('adc');
+addThis();
+
+/* Perl supports ] & ^] inside a [], ECMA does not
+status = inSection(38);
+pattern = /a[^]b]c/;
+string = 'adc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('adc');
+addThis();
+*/
+
+status = inSection(39);
+pattern = /\ba\b/;
+string = 'a-';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a');
+addThis();
+
+status = inSection(40);
+pattern = /\ba\b/;
+string = '-a';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a');
+addThis();
+
+status = inSection(41);
+pattern = /\ba\b/;
+string = '-a-';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a');
+addThis();
+
+status = inSection(42);
+pattern = /\By\b/;
+string = 'xy';
+actualmatch = string.match(pattern);
+expectedmatch = Array('y');
+addThis();
+
+status = inSection(43);
+pattern = /\by\B/;
+string = 'yz';
+actualmatch = string.match(pattern);
+expectedmatch = Array('y');
+addThis();
+
+status = inSection(44);
+pattern = /\By\B/;
+string = 'xyz';
+actualmatch = string.match(pattern);
+expectedmatch = Array('y');
+addThis();
+
+status = inSection(45);
+pattern = /\w/;
+string = 'a';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a');
+addThis();
+
+status = inSection(46);
+pattern = /\W/;
+string = '-';
+actualmatch = string.match(pattern);
+expectedmatch = Array('-');
+addThis();
+
+status = inSection(47);
+pattern = /a\Sb/;
+string = 'a-b';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a-b');
+addThis();
+
+status = inSection(48);
+pattern = /\d/;
+string = '1';
+actualmatch = string.match(pattern);
+expectedmatch = Array('1');
+addThis();
+
+status = inSection(49);
+pattern = /\D/;
+string = '-';
+actualmatch = string.match(pattern);
+expectedmatch = Array('-');
+addThis();
+
+status = inSection(50);
+pattern = /[\w]/;
+string = 'a';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a');
+addThis();
+
+status = inSection(51);
+pattern = /[\W]/;
+string = '-';
+actualmatch = string.match(pattern);
+expectedmatch = Array('-');
+addThis();
+
+status = inSection(52);
+pattern = /a[\S]b/;
+string = 'a-b';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a-b');
+addThis();
+
+status = inSection(53);
+pattern = /[\d]/;
+string = '1';
+actualmatch = string.match(pattern);
+expectedmatch = Array('1');
+addThis();
+
+status = inSection(54);
+pattern = /[\D]/;
+string = '-';
+actualmatch = string.match(pattern);
+expectedmatch = Array('-');
+addThis();
+
+status = inSection(55);
+pattern = /ab|cd/;
+string = 'abc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ab');
+addThis();
+
+status = inSection(56);
+pattern = /ab|cd/;
+string = 'abcd';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ab');
+addThis();
+
+status = inSection(57);
+pattern = /()ef/;
+string = 'def';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ef', '');
+addThis();
+
+status = inSection(58);
+pattern = /a\(b/;
+string = 'a(b';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a(b');
+addThis();
+
+status = inSection(59);
+pattern = /a\(*b/;
+string = 'ab';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ab');
+addThis();
+
+status = inSection(60);
+pattern = /a\(*b/;
+string = 'a((b';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a((b');
+addThis();
+
+status = inSection(61);
+pattern = /a\\b/;
+string = 'a\\b';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a\\b');
+addThis();
+
+status = inSection(62);
+pattern = /((a))/;
+string = 'abc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a', 'a', 'a');
+addThis();
+
+status = inSection(63);
+pattern = /(a)b(c)/;
+string = 'abc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abc', 'a', 'c');
+addThis();
+
+status = inSection(64);
+pattern = /a+b+c/;
+string = 'aabbabc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abc');
+addThis();
+
+status = inSection(65);
+pattern = /a{1,}b{1,}c/;
+string = 'aabbabc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abc');
+addThis();
+
+status = inSection(66);
+pattern = /a.+?c/;
+string = 'abcabc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abc');
+addThis();
+
+status = inSection(67);
+pattern = /(a+|b)*/;
+string = 'ab';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ab', 'b');
+addThis();
+
+status = inSection(68);
+pattern = /(a+|b){0,}/;
+string = 'ab';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ab', 'b');
+addThis();
+
+status = inSection(69);
+pattern = /(a+|b)+/;
+string = 'ab';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ab', 'b');
+addThis();
+
+status = inSection(70);
+pattern = /(a+|b){1,}/;
+string = 'ab';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ab', 'b');
+addThis();
+
+status = inSection(71);
+pattern = /(a+|b)?/;
+string = 'ab';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a', 'a');
+addThis();
+
+status = inSection(72);
+pattern = /(a+|b){0,1}/;
+string = 'ab';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a', 'a');
+addThis();
+
+status = inSection(73);
+pattern = /[^ab]*/;
+string = 'cde';
+actualmatch = string.match(pattern);
+expectedmatch = Array('cde');
+addThis();
+
+status = inSection(74);
+pattern = /([abc])*d/;
+string = 'abbbcd';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abbbcd', 'c');
+addThis();
+
+status = inSection(75);
+pattern = /([abc])*bcd/;
+string = 'abcd';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abcd', 'a');
+addThis();
+
+status = inSection(76);
+pattern = /a|b|c|d|e/;
+string = 'e';
+actualmatch = string.match(pattern);
+expectedmatch = Array('e');
+addThis();
+
+status = inSection(77);
+pattern = /(a|b|c|d|e)f/;
+string = 'ef';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ef', 'e');
+addThis();
+
+status = inSection(78);
+pattern = /abcd*efg/;
+string = 'abcdefg';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abcdefg');
+addThis();
+
+status = inSection(79);
+pattern = /ab*/;
+string = 'xabyabbbz';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ab');
+addThis();
+
+status = inSection(80);
+pattern = /ab*/;
+string = 'xayabbbz';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a');
+addThis();
+
+status = inSection(81);
+pattern = /(ab|cd)e/;
+string = 'abcde';
+actualmatch = string.match(pattern);
+expectedmatch = Array('cde', 'cd');
+addThis();
+
+status = inSection(82);
+pattern = /[abhgefdc]ij/;
+string = 'hij';
+actualmatch = string.match(pattern);
+expectedmatch = Array('hij');
+addThis();
+
+status = inSection(83);
+pattern = /(abc|)ef/;
+string = 'abcdef';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ef', '');
+addThis();
+
+status = inSection(84);
+pattern = /(a|b)c*d/;
+string = 'abcd';
+actualmatch = string.match(pattern);
+expectedmatch = Array('bcd', 'b');
+addThis();
+
+status = inSection(85);
+pattern = /(ab|ab*)bc/;
+string = 'abc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abc', 'a');
+addThis();
+
+status = inSection(86);
+pattern = /a([bc]*)c*/;
+string = 'abc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abc', 'bc');
+addThis();
+
+status = inSection(87);
+pattern = /a([bc]*)(c*d)/;
+string = 'abcd';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abcd', 'bc', 'd');
+addThis();
+
+status = inSection(88);
+pattern = /a([bc]+)(c*d)/;
+string = 'abcd';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abcd', 'bc', 'd');
+addThis();
+
+status = inSection(89);
+pattern = /a([bc]*)(c+d)/;
+string = 'abcd';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abcd', 'b', 'cd');
+addThis();
+
+status = inSection(90);
+pattern = /a[bcd]*dcdcde/;
+string = 'adcdcde';
+actualmatch = string.match(pattern);
+expectedmatch = Array('adcdcde');
+addThis();
+
+status = inSection(91);
+pattern = /(ab|a)b*c/;
+string = 'abc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abc', 'ab');
+addThis();
+
+status = inSection(92);
+pattern = /((a)(b)c)(d)/;
+string = 'abcd';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abcd', 'abc', 'a', 'b', 'd');
+addThis();
+
+status = inSection(93);
+pattern = /[a-zA-Z_][a-zA-Z0-9_]*/;
+string = 'alpha';
+actualmatch = string.match(pattern);
+expectedmatch = Array('alpha');
+addThis();
+
+status = inSection(94);
+pattern = /^a(bc+|b[eh])g|.h$/;
+string = 'abh';
+actualmatch = string.match(pattern);
+expectedmatch = Array('bh', undefined);
+addThis();
+
+status = inSection(95);
+pattern = /(bc+d$|ef*g.|h?i(j|k))/;
+string = 'effgz';
+actualmatch = string.match(pattern);
+expectedmatch = Array('effgz', 'effgz', undefined);
+addThis();
+
+status = inSection(96);
+pattern = /(bc+d$|ef*g.|h?i(j|k))/;
+string = 'ij';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ij', 'ij', 'j');
+addThis();
+
+status = inSection(97);
+pattern = /(bc+d$|ef*g.|h?i(j|k))/;
+string = 'reffgz';
+actualmatch = string.match(pattern);
+expectedmatch = Array('effgz', 'effgz', undefined);
+addThis();
+
+status = inSection(98);
+pattern = /((((((((((a))))))))))/;
+string = 'a';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a');
+addThis();
+
+status = inSection(99);
+pattern = /((((((((((a))))))))))\10/;
+string = 'aa';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aa', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a');
+addThis();
+
+status = inSection(100);
+pattern = /((((((((((a))))))))))/;
+string = 'a!';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a');
+addThis();
+
+status = inSection(101);
+pattern = /(((((((((a)))))))))/;
+string = 'a';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a');
+addThis();
+
+status = inSection(102);
+pattern = /(.*)c(.*)/;
+string = 'abcde';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abcde', 'ab', 'de');
+addThis();
+
+status = inSection(103);
+pattern = /abcd/;
+string = 'abcd';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abcd');
+addThis();
+
+status = inSection(104);
+pattern = /a(bc)d/;
+string = 'abcd';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abcd', 'bc');
+addThis();
+
+status = inSection(105);
+pattern = /a[-]?c/;
+string = 'ac';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ac');
+addThis();
+
+status = inSection(106);
+pattern = /(abc)\1/;
+string = 'abcabc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abcabc', 'abc');
+addThis();
+
+status = inSection(107);
+pattern = /([a-c]*)\1/;
+string = 'abcabc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abcabc', 'abc');
+addThis();
+
+status = inSection(108);
+pattern = /(a)|\1/;
+string = 'a';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a', 'a');
+addThis();
+
+status = inSection(109);
+pattern = /(([a-c])b*?\2)*/;
+string = 'ababbbcbc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ababb', 'bb', 'b');
+addThis();
+
+status = inSection(110);
+pattern = /(([a-c])b*?\2){3}/;
+string = 'ababbbcbc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ababbbcbc', 'cbc', 'c');
+addThis();
+
+/* Can't refer to a capture before it's encountered & completed
+status = inSection(111);
+pattern = /((\3|b)\2(a)x)+/;
+string = 'aaaxabaxbaaxbbax';
+actualmatch = string.match(pattern);
+expectedmatch = Array('bbax', 'bbax', 'b', 'a');
+addThis();
+
+status = inSection(112);
+pattern = /((\3|b)\2(a)){2,}/;
+string = 'bbaababbabaaaaabbaaaabba';
+actualmatch = string.match(pattern);
+expectedmatch = Array('bbaaaabba', 'bba', 'b', 'a');
+addThis();
+*/
+
+status = inSection(113);
+pattern = /abc/i;
+string = 'ABC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABC');
+addThis();
+
+status = inSection(114);
+pattern = /abc/i;
+string = 'XABCY';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABC');
+addThis();
+
+status = inSection(115);
+pattern = /abc/i;
+string = 'ABABC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABC');
+addThis();
+
+status = inSection(116);
+pattern = /ab*c/i;
+string = 'ABC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABC');
+addThis();
+
+status = inSection(117);
+pattern = /ab*bc/i;
+string = 'ABC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABC');
+addThis();
+
+status = inSection(118);
+pattern = /ab*bc/i;
+string = 'ABBC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABBC');
+addThis();
+
+status = inSection(119);
+pattern = /ab*?bc/i;
+string = 'ABBBBC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABBBBC');
+addThis();
+
+status = inSection(120);
+pattern = /ab{0,}?bc/i;
+string = 'ABBBBC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABBBBC');
+addThis();
+
+status = inSection(121);
+pattern = /ab+?bc/i;
+string = 'ABBC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABBC');
+addThis();
+
+status = inSection(122);
+pattern = /ab+bc/i;
+string = 'ABBBBC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABBBBC');
+addThis();
+
+status = inSection(123);
+pattern = /ab{1,}?bc/i;
+string = 'ABBBBC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABBBBC');
+addThis();
+
+status = inSection(124);
+pattern = /ab{1,3}?bc/i;
+string = 'ABBBBC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABBBBC');
+addThis();
+
+status = inSection(125);
+pattern = /ab{3,4}?bc/i;
+string = 'ABBBBC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABBBBC');
+addThis();
+
+status = inSection(126);
+pattern = /ab??bc/i;
+string = 'ABBC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABBC');
+addThis();
+
+status = inSection(127);
+pattern = /ab??bc/i;
+string = 'ABC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABC');
+addThis();
+
+status = inSection(128);
+pattern = /ab{0,1}?bc/i;
+string = 'ABC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABC');
+addThis();
+
+status = inSection(129);
+pattern = /ab??c/i;
+string = 'ABC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABC');
+addThis();
+
+status = inSection(130);
+pattern = /ab{0,1}?c/i;
+string = 'ABC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABC');
+addThis();
+
+status = inSection(131);
+pattern = /^abc$/i;
+string = 'ABC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABC');
+addThis();
+
+status = inSection(132);
+pattern = /^abc/i;
+string = 'ABCC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABC');
+addThis();
+
+status = inSection(133);
+pattern = /abc$/i;
+string = 'AABC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABC');
+addThis();
+
+status = inSection(134);
+pattern = /^/i;
+string = 'ABC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('');
+addThis();
+
+status = inSection(135);
+pattern = /$/i;
+string = 'ABC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('');
+addThis();
+
+status = inSection(136);
+pattern = /a.c/i;
+string = 'ABC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABC');
+addThis();
+
+status = inSection(137);
+pattern = /a.c/i;
+string = 'AXC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('AXC');
+addThis();
+
+status = inSection(138);
+pattern = /a.*?c/i;
+string = 'AXYZC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('AXYZC');
+addThis();
+
+status = inSection(139);
+pattern = /a[bc]d/i;
+string = 'ABD';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABD');
+addThis();
+
+status = inSection(140);
+pattern = /a[b-d]e/i;
+string = 'ACE';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ACE');
+addThis();
+
+status = inSection(141);
+pattern = /a[b-d]/i;
+string = 'AAC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('AC');
+addThis();
+
+status = inSection(142);
+pattern = /a[-b]/i;
+string = 'A-';
+actualmatch = string.match(pattern);
+expectedmatch = Array('A-');
+addThis();
+
+status = inSection(143);
+pattern = /a[b-]/i;
+string = 'A-';
+actualmatch = string.match(pattern);
+expectedmatch = Array('A-');
+addThis();
+
+status = inSection(144);
+pattern = /a]/i;
+string = 'A]';
+actualmatch = string.match(pattern);
+expectedmatch = Array('A]');
+addThis();
+
+/* Perl supports ] & ^] inside a [], ECMA does not
+status = inSection(145);
+pattern = /a[]]b/i;
+string = 'A]B';
+actualmatch = string.match(pattern);
+expectedmatch = Array('A]B');
+addThis();
+*/
+
+status = inSection(146);
+pattern = /a[^bc]d/i;
+string = 'AED';
+actualmatch = string.match(pattern);
+expectedmatch = Array('AED');
+addThis();
+
+status = inSection(147);
+pattern = /a[^-b]c/i;
+string = 'ADC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ADC');
+addThis();
+
+/* Perl supports ] & ^] inside a [], ECMA does not
+status = inSection(148);
+pattern = /a[^]b]c/i;
+string = 'ADC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ADC');
+addThis();
+*/
+
+status = inSection(149);
+pattern = /ab|cd/i;
+string = 'ABC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('AB');
+addThis();
+
+status = inSection(150);
+pattern = /ab|cd/i;
+string = 'ABCD';
+actualmatch = string.match(pattern);
+expectedmatch = Array('AB');
+addThis();
+
+status = inSection(151);
+pattern = /()ef/i;
+string = 'DEF';
+actualmatch = string.match(pattern);
+expectedmatch = Array('EF', '');
+addThis();
+
+status = inSection(152);
+pattern = /a\(b/i;
+string = 'A(B';
+actualmatch = string.match(pattern);
+expectedmatch = Array('A(B');
+addThis();
+
+status = inSection(153);
+pattern = /a\(*b/i;
+string = 'AB';
+actualmatch = string.match(pattern);
+expectedmatch = Array('AB');
+addThis();
+
+status = inSection(154);
+pattern = /a\(*b/i;
+string = 'A((B';
+actualmatch = string.match(pattern);
+expectedmatch = Array('A((B');
+addThis();
+
+status = inSection(155);
+pattern = /a\\b/i;
+string = 'A\\B';
+actualmatch = string.match(pattern);
+expectedmatch = Array('A\\B');
+addThis();
+
+status = inSection(156);
+pattern = /((a))/i;
+string = 'ABC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('A', 'A', 'A');
+addThis();
+
+status = inSection(157);
+pattern = /(a)b(c)/i;
+string = 'ABC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABC', 'A', 'C');
+addThis();
+
+status = inSection(158);
+pattern = /a+b+c/i;
+string = 'AABBABC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABC');
+addThis();
+
+status = inSection(159);
+pattern = /a{1,}b{1,}c/i;
+string = 'AABBABC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABC');
+addThis();
+
+status = inSection(160);
+pattern = /a.+?c/i;
+string = 'ABCABC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABC');
+addThis();
+
+status = inSection(161);
+pattern = /a.*?c/i;
+string = 'ABCABC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABC');
+addThis();
+
+status = inSection(162);
+pattern = /a.{0,5}?c/i;
+string = 'ABCABC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABC');
+addThis();
+
+status = inSection(163);
+pattern = /(a+|b)*/i;
+string = 'AB';
+actualmatch = string.match(pattern);
+expectedmatch = Array('AB', 'B');
+addThis();
+
+status = inSection(164);
+pattern = /(a+|b){0,}/i;
+string = 'AB';
+actualmatch = string.match(pattern);
+expectedmatch = Array('AB', 'B');
+addThis();
+
+status = inSection(165);
+pattern = /(a+|b)+/i;
+string = 'AB';
+actualmatch = string.match(pattern);
+expectedmatch = Array('AB', 'B');
+addThis();
+
+status = inSection(166);
+pattern = /(a+|b){1,}/i;
+string = 'AB';
+actualmatch = string.match(pattern);
+expectedmatch = Array('AB', 'B');
+addThis();
+
+status = inSection(167);
+pattern = /(a+|b)?/i;
+string = 'AB';
+actualmatch = string.match(pattern);
+expectedmatch = Array('A', 'A');
+addThis();
+
+status = inSection(168);
+pattern = /(a+|b){0,1}/i;
+string = 'AB';
+actualmatch = string.match(pattern);
+expectedmatch = Array('A', 'A');
+addThis();
+
+status = inSection(169);
+pattern = /(a+|b){0,1}?/i;
+string = 'AB';
+actualmatch = string.match(pattern);
+expectedmatch = Array('', undefined);
+addThis();
+
+status = inSection(170);
+pattern = /[^ab]*/i;
+string = 'CDE';
+actualmatch = string.match(pattern);
+expectedmatch = Array('CDE');
+addThis();
+
+status = inSection(171);
+pattern = /([abc])*d/i;
+string = 'ABBBCD';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABBBCD', 'C');
+addThis();
+
+status = inSection(172);
+pattern = /([abc])*bcd/i;
+string = 'ABCD';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABCD', 'A');
+addThis();
+
+status = inSection(173);
+pattern = /a|b|c|d|e/i;
+string = 'E';
+actualmatch = string.match(pattern);
+expectedmatch = Array('E');
+addThis();
+
+status = inSection(174);
+pattern = /(a|b|c|d|e)f/i;
+string = 'EF';
+actualmatch = string.match(pattern);
+expectedmatch = Array('EF', 'E');
+addThis();
+
+status = inSection(175);
+pattern = /abcd*efg/i;
+string = 'ABCDEFG';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABCDEFG');
+addThis();
+
+status = inSection(176);
+pattern = /ab*/i;
+string = 'XABYABBBZ';
+actualmatch = string.match(pattern);
+expectedmatch = Array('AB');
+addThis();
+
+status = inSection(177);
+pattern = /ab*/i;
+string = 'XAYABBBZ';
+actualmatch = string.match(pattern);
+expectedmatch = Array('A');
+addThis();
+
+status = inSection(178);
+pattern = /(ab|cd)e/i;
+string = 'ABCDE';
+actualmatch = string.match(pattern);
+expectedmatch = Array('CDE', 'CD');
+addThis();
+
+status = inSection(179);
+pattern = /[abhgefdc]ij/i;
+string = 'HIJ';
+actualmatch = string.match(pattern);
+expectedmatch = Array('HIJ');
+addThis();
+
+status = inSection(180);
+pattern = /(abc|)ef/i;
+string = 'ABCDEF';
+actualmatch = string.match(pattern);
+expectedmatch = Array('EF', '');
+addThis();
+
+status = inSection(181);
+pattern = /(a|b)c*d/i;
+string = 'ABCD';
+actualmatch = string.match(pattern);
+expectedmatch = Array('BCD', 'B');
+addThis();
+
+status = inSection(182);
+pattern = /(ab|ab*)bc/i;
+string = 'ABC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABC', 'A');
+addThis();
+
+status = inSection(183);
+pattern = /a([bc]*)c*/i;
+string = 'ABC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABC', 'BC');
+addThis();
+
+status = inSection(184);
+pattern = /a([bc]*)(c*d)/i;
+string = 'ABCD';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABCD', 'BC', 'D');
+addThis();
+
+status = inSection(185);
+pattern = /a([bc]+)(c*d)/i;
+string = 'ABCD';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABCD', 'BC', 'D');
+addThis();
+
+status = inSection(186);
+pattern = /a([bc]*)(c+d)/i;
+string = 'ABCD';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABCD', 'B', 'CD');
+addThis();
+
+status = inSection(187);
+pattern = /a[bcd]*dcdcde/i;
+string = 'ADCDCDE';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ADCDCDE');
+addThis();
+
+status = inSection(188);
+pattern = /(ab|a)b*c/i;
+string = 'ABC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABC', 'AB');
+addThis();
+
+status = inSection(189);
+pattern = /((a)(b)c)(d)/i;
+string = 'ABCD';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABCD', 'ABC', 'A', 'B', 'D');
+addThis();
+
+status = inSection(190);
+pattern = /[a-zA-Z_][a-zA-Z0-9_]*/i;
+string = 'ALPHA';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ALPHA');
+addThis();
+
+status = inSection(191);
+pattern = /^a(bc+|b[eh])g|.h$/i;
+string = 'ABH';
+actualmatch = string.match(pattern);
+expectedmatch = Array('BH', undefined);
+addThis();
+
+status = inSection(192);
+pattern = /(bc+d$|ef*g.|h?i(j|k))/i;
+string = 'EFFGZ';
+actualmatch = string.match(pattern);
+expectedmatch = Array('EFFGZ', 'EFFGZ', undefined);
+addThis();
+
+status = inSection(193);
+pattern = /(bc+d$|ef*g.|h?i(j|k))/i;
+string = 'IJ';
+actualmatch = string.match(pattern);
+expectedmatch = Array('IJ', 'IJ', 'J');
+addThis();
+
+status = inSection(194);
+pattern = /(bc+d$|ef*g.|h?i(j|k))/i;
+string = 'REFFGZ';
+actualmatch = string.match(pattern);
+expectedmatch = Array('EFFGZ', 'EFFGZ', undefined);
+addThis();
+
+status = inSection(195);
+pattern = /((((((((((a))))))))))/i;
+string = 'A';
+actualmatch = string.match(pattern);
+expectedmatch = Array('A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A');
+addThis();
+
+status = inSection(196);
+pattern = /((((((((((a))))))))))\10/i;
+string = 'AA';
+actualmatch = string.match(pattern);
+expectedmatch = Array('AA', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A');
+addThis();
+
+status = inSection(197);
+pattern = /((((((((((a))))))))))/i;
+string = 'A!';
+actualmatch = string.match(pattern);
+expectedmatch = Array('A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A');
+addThis();
+
+status = inSection(198);
+pattern = /(((((((((a)))))))))/i;
+string = 'A';
+actualmatch = string.match(pattern);
+expectedmatch = Array('A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A');
+addThis();
+
+status = inSection(199);
+pattern = /(?:(?:(?:(?:(?:(?:(?:(?:(?:(a))))))))))/i;
+string = 'A';
+actualmatch = string.match(pattern);
+expectedmatch = Array('A', 'A');
+addThis();
+
+status = inSection(200);
+pattern = /(?:(?:(?:(?:(?:(?:(?:(?:(?:(a|b|c))))))))))/i;
+string = 'C';
+actualmatch = string.match(pattern);
+expectedmatch = Array('C', 'C');
+addThis();
+
+status = inSection(201);
+pattern = /(.*)c(.*)/i;
+string = 'ABCDE';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABCDE', 'AB', 'DE');
+addThis();
+
+status = inSection(202);
+pattern = /abcd/i;
+string = 'ABCD';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABCD');
+addThis();
+
+status = inSection(203);
+pattern = /a(bc)d/i;
+string = 'ABCD';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABCD', 'BC');
+addThis();
+
+status = inSection(204);
+pattern = /a[-]?c/i;
+string = 'AC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('AC');
+addThis();
+
+status = inSection(205);
+pattern = /(abc)\1/i;
+string = 'ABCABC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABCABC', 'ABC');
+addThis();
+
+status = inSection(206);
+pattern = /([a-c]*)\1/i;
+string = 'ABCABC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABCABC', 'ABC');
+addThis();
+
+status = inSection(207);
+pattern = /a(?!b)./;
+string = 'abad';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ad');
+addThis();
+
+status = inSection(208);
+pattern = /a(?=d)./;
+string = 'abad';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ad');
+addThis();
+
+status = inSection(209);
+pattern = /a(?=c|d)./;
+string = 'abad';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ad');
+addThis();
+
+status = inSection(210);
+pattern = /a(?:b|c|d)(.)/;
+string = 'ace';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ace', 'e');
+addThis();
+
+status = inSection(211);
+pattern = /a(?:b|c|d)*(.)/;
+string = 'ace';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ace', 'e');
+addThis();
+
+status = inSection(212);
+pattern = /a(?:b|c|d)+?(.)/;
+string = 'ace';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ace', 'e');
+addThis();
+
+status = inSection(213);
+pattern = /a(?:b|c|d)+?(.)/;
+string = 'acdbcdbe';
+actualmatch = string.match(pattern);
+expectedmatch = Array('acd', 'd');
+addThis();
+
+status = inSection(214);
+pattern = /a(?:b|c|d)+(.)/;
+string = 'acdbcdbe';
+actualmatch = string.match(pattern);
+expectedmatch = Array('acdbcdbe', 'e');
+addThis();
+
+status = inSection(215);
+pattern = /a(?:b|c|d){2}(.)/;
+string = 'acdbcdbe';
+actualmatch = string.match(pattern);
+expectedmatch = Array('acdb', 'b');
+addThis();
+
+status = inSection(216);
+pattern = /a(?:b|c|d){4,5}(.)/;
+string = 'acdbcdbe';
+actualmatch = string.match(pattern);
+expectedmatch = Array('acdbcdb', 'b');
+addThis();
+
+status = inSection(217);
+pattern = /a(?:b|c|d){4,5}?(.)/;
+string = 'acdbcdbe';
+actualmatch = string.match(pattern);
+expectedmatch = Array('acdbcd', 'd');
+addThis();
+
+// MODIFIED - ECMA has different rules for paren contents
+status = inSection(218);
+pattern = /((foo)|(bar))*/;
+string = 'foobar';
+actualmatch = string.match(pattern);
+//expectedmatch = Array('foobar', 'bar', 'foo', 'bar');
+expectedmatch = Array('foobar', 'bar', undefined, 'bar');
+addThis();
+
+status = inSection(219);
+pattern = /a(?:b|c|d){6,7}(.)/;
+string = 'acdbcdbe';
+actualmatch = string.match(pattern);
+expectedmatch = Array('acdbcdbe', 'e');
+addThis();
+
+status = inSection(220);
+pattern = /a(?:b|c|d){6,7}?(.)/;
+string = 'acdbcdbe';
+actualmatch = string.match(pattern);
+expectedmatch = Array('acdbcdbe', 'e');
+addThis();
+
+status = inSection(221);
+pattern = /a(?:b|c|d){5,6}(.)/;
+string = 'acdbcdbe';
+actualmatch = string.match(pattern);
+expectedmatch = Array('acdbcdbe', 'e');
+addThis();
+
+status = inSection(222);
+pattern = /a(?:b|c|d){5,6}?(.)/;
+string = 'acdbcdbe';
+actualmatch = string.match(pattern);
+expectedmatch = Array('acdbcdb', 'b');
+addThis();
+
+status = inSection(223);
+pattern = /a(?:b|c|d){5,7}(.)/;
+string = 'acdbcdbe';
+actualmatch = string.match(pattern);
+expectedmatch = Array('acdbcdbe', 'e');
+addThis();
+
+status = inSection(224);
+pattern = /a(?:b|c|d){5,7}?(.)/;
+string = 'acdbcdbe';
+actualmatch = string.match(pattern);
+expectedmatch = Array('acdbcdb', 'b');
+addThis();
+
+status = inSection(225);
+pattern = /a(?:b|(c|e){1,2}?|d)+?(.)/;
+string = 'ace';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ace', 'c', 'e');
+addThis();
+
+status = inSection(226);
+pattern = /^(.+)?B/;
+string = 'AB';
+actualmatch = string.match(pattern);
+expectedmatch = Array('AB', 'A');
+addThis();
+
+/* MODIFIED - ECMA has different rules for paren contents */
+status = inSection(227);
+pattern = /^([^a-z])|(\^)$/;
+string = '.';
+actualmatch = string.match(pattern);
+//expectedmatch = Array('.', '.', '');
+expectedmatch = Array('.', '.', undefined);
+addThis();
+
+status = inSection(228);
+pattern = /^[<>]&/;
+string = '<&OUT';
+actualmatch = string.match(pattern);
+expectedmatch = Array('<&');
+addThis();
+
+/* Can't refer to a capture before it's encountered & completed
+status = inSection(229);
+pattern = /^(a\1?){4}$/;
+string = 'aaaaaaaaaa';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aaaaaaaaaa', 'aaaa');
+addThis();
+
+status = inSection(230);
+pattern = /^(a(?(1)\1)){4}$/;
+string = 'aaaaaaaaaa';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aaaaaaaaaa', 'aaaa');
+addThis();
+*/
+
+status = inSection(231);
+pattern = /((a{4})+)/;
+string = 'aaaaaaaaa';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aaaaaaaa', 'aaaaaaaa', 'aaaa');
+addThis();
+
+status = inSection(232);
+pattern = /(((aa){2})+)/;
+string = 'aaaaaaaaaa';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aaaaaaaa', 'aaaaaaaa', 'aaaa', 'aa');
+addThis();
+
+status = inSection(233);
+pattern = /(((a{2}){2})+)/;
+string = 'aaaaaaaaaa';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aaaaaaaa', 'aaaaaaaa', 'aaaa', 'aa');
+addThis();
+
+status = inSection(234);
+pattern = /(?:(f)(o)(o)|(b)(a)(r))*/;
+string = 'foobar';
+actualmatch = string.match(pattern);
+//expectedmatch = Array('foobar', 'f', 'o', 'o', 'b', 'a', 'r');
+expectedmatch = Array('foobar', undefined, undefined, undefined, 'b', 'a', 'r');
+addThis();
+
+/* ECMA supports (?: (?= and (?! but doesn't support (?< etc.
+status = inSection(235);
+pattern = /(?<=a)b/;
+string = 'ab';
+actualmatch = string.match(pattern);
+expectedmatch = Array('b');
+addThis();
+
+status = inSection(236);
+pattern = /(?<!c)b/;
+string = 'ab';
+actualmatch = string.match(pattern);
+expectedmatch = Array('b');
+addThis();
+
+status = inSection(237);
+pattern = /(?<!c)b/;
+string = 'b';
+actualmatch = string.match(pattern);
+expectedmatch = Array('b');
+addThis();
+
+status = inSection(238);
+pattern = /(?<!c)b/;
+string = 'b';
+actualmatch = string.match(pattern);
+expectedmatch = Array('b');
+addThis();
+*/
+
+status = inSection(239);
+pattern = /(?:..)*a/;
+string = 'aba';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aba');
+addThis();
+
+status = inSection(240);
+pattern = /(?:..)*?a/;
+string = 'aba';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a');
+addThis();
+
+/*
+ * MODIFIED - ECMA has different rules for paren contents. Note
+ * this regexp has two non-capturing parens, and one capturing
+ *
+ * The issue: shouldn't the match be ['ab', undefined]? Because the
+ * '\1' matches the undefined value of the second iteration of the '*'
+ * (in which the 'b' part of the '|' matches). But Perl wants ['ab','b'].
+ *
+ * Answer: waldemar@netscape.com:
+ *
+ * The correct answer is ['ab', undefined]. Perl doesn't match
+ * ECMAScript here, and I'd say that Perl is wrong in this case.
+ */
+status = inSection(241);
+pattern = /^(?:b|a(?=(.)))*\1/;
+string = 'abc';
+actualmatch = string.match(pattern);
+//expectedmatch = Array('ab', 'b');
+expectedmatch = Array('ab', undefined);
+addThis();
+
+status = inSection(242);
+pattern = /^(){3,5}/;
+string = 'abc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('', '');
+addThis();
+
+status = inSection(243);
+pattern = /^(a+)*ax/;
+string = 'aax';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aax', 'a');
+addThis();
+
+status = inSection(244);
+pattern = /^((a|b)+)*ax/;
+string = 'aax';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aax', 'a', 'a');
+addThis();
+
+status = inSection(245);
+pattern = /^((a|bc)+)*ax/;
+string = 'aax';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aax', 'a', 'a');
+addThis();
+
+/* MODIFIED - ECMA has different rules for paren contents */
+status = inSection(246);
+pattern = /(a|x)*ab/;
+string = 'cab';
+actualmatch = string.match(pattern);
+//expectedmatch = Array('ab', '');
+expectedmatch = Array('ab', undefined);
+addThis();
+
+status = inSection(247);
+pattern = /(a)*ab/;
+string = 'cab';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ab', undefined);
+addThis();
+
+/* ECMA doesn't support (?imsx or (?-imsx
+status = inSection(248);
+pattern = /(?:(?i)a)b/;
+string = 'ab';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ab');
+addThis();
+
+status = inSection(249);
+pattern = /((?i)a)b/;
+string = 'ab';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ab', 'a');
+addThis();
+
+status = inSection(250);
+pattern = /(?:(?i)a)b/;
+string = 'Ab';
+actualmatch = string.match(pattern);
+expectedmatch = Array('Ab');
+addThis();
+
+status = inSection(251);
+pattern = /((?i)a)b/;
+string = 'Ab';
+actualmatch = string.match(pattern);
+expectedmatch = Array('Ab', 'A');
+addThis();
+
+status = inSection(252);
+pattern = /(?i:a)b/;
+string = 'ab';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ab');
+addThis();
+
+status = inSection(253);
+pattern = /((?i:a))b/;
+string = 'ab';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ab', 'a');
+addThis();
+
+status = inSection(254);
+pattern = /(?i:a)b/;
+string = 'Ab';
+actualmatch = string.match(pattern);
+expectedmatch = Array('Ab');
+addThis();
+
+status = inSection(255);
+pattern = /((?i:a))b/;
+string = 'Ab';
+actualmatch = string.match(pattern);
+expectedmatch = Array('Ab', 'A');
+addThis();
+
+status = inSection(256);
+pattern = /(?:(?-i)a)b/i;
+string = 'ab';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ab');
+addThis();
+
+status = inSection(257);
+pattern = /((?-i)a)b/i;
+string = 'ab';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ab', 'a');
+addThis();
+
+status = inSection(258);
+pattern = /(?:(?-i)a)b/i;
+string = 'aB';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aB');
+addThis();
+
+status = inSection(259);
+pattern = /((?-i)a)b/i;
+string = 'aB';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aB', 'a');
+addThis();
+
+status = inSection(260);
+pattern = /(?:(?-i)a)b/i;
+string = 'aB';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aB');
+addThis();
+
+status = inSection(261);
+pattern = /((?-i)a)b/i;
+string = 'aB';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aB', 'a');
+addThis();
+
+status = inSection(262);
+pattern = /(?-i:a)b/i;
+string = 'ab';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ab');
+addThis();
+
+status = inSection(263);
+pattern = /((?-i:a))b/i;
+string = 'ab';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ab', 'a');
+addThis();
+
+status = inSection(264);
+pattern = /(?-i:a)b/i;
+string = 'aB';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aB');
+addThis();
+
+status = inSection(265);
+pattern = /((?-i:a))b/i;
+string = 'aB';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aB', 'a');
+addThis();
+
+status = inSection(266);
+pattern = /(?-i:a)b/i;
+string = 'aB';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aB');
+addThis();
+
+status = inSection(267);
+pattern = /((?-i:a))b/i;
+string = 'aB';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aB', 'a');
+addThis();
+
+status = inSection(268);
+pattern = /((?s-i:a.))b/i;
+string = 'a\nB';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a\nB', 'a\n');
+addThis();
+*/
+
+status = inSection(269);
+pattern = /(?:c|d)(?:)(?:a(?:)(?:b)(?:b(?:))(?:b(?:)(?:b)))/;
+string = 'cabbbb';
+actualmatch = string.match(pattern);
+expectedmatch = Array('cabbbb');
+addThis();
+
+status = inSection(270);
+pattern = /(?:c|d)(?:)(?:aaaaaaaa(?:)(?:bbbbbbbb)(?:bbbbbbbb(?:))(?:bbbbbbbb(?:)(?:bbbbbbbb)))/;
+string = 'caaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb';
+actualmatch = string.match(pattern);
+expectedmatch = Array('caaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb');
+addThis();
+
+status = inSection(271);
+pattern = /(ab)\d\1/i;
+string = 'Ab4ab';
+actualmatch = string.match(pattern);
+expectedmatch = Array('Ab4ab', 'Ab');
+addThis();
+
+status = inSection(272);
+pattern = /(ab)\d\1/i;
+string = 'ab4Ab';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ab4Ab', 'ab');
+addThis();
+
+status = inSection(273);
+pattern = /foo\w*\d{4}baz/;
+string = 'foobar1234baz';
+actualmatch = string.match(pattern);
+expectedmatch = Array('foobar1234baz');
+addThis();
+
+status = inSection(274);
+pattern = /x(~~)*(?:(?:F)?)?/;
+string = 'x~~';
+actualmatch = string.match(pattern);
+expectedmatch = Array('x~~', '~~');
+addThis();
+
+/* Perl supports (?# but JS doesn't
+status = inSection(275);
+pattern = /^a(?#xxx){3}c/;
+string = 'aaac';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aaac');
+addThis();
+*/
+
+/* ECMA doesn't support (?< etc
+status = inSection(276);
+pattern = /(?<![cd])[ab]/;
+string = 'dbaacb';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a');
+addThis();
+
+status = inSection(277);
+pattern = /(?<!(c|d))[ab]/;
+string = 'dbaacb';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a');
+addThis();
+
+status = inSection(278);
+pattern = /(?<!cd)[ab]/;
+string = 'cdaccb';
+actualmatch = string.match(pattern);
+expectedmatch = Array('b');
+addThis();
+
+status = inSection(279);
+pattern = /((?s)^a(.))((?m)^b$)/;
+string = 'a\nb\nc\n';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a\nb', 'a\n', '\n', 'b');
+addThis();
+
+status = inSection(280);
+pattern = /((?m)^b$)/;
+string = 'a\nb\nc\n';
+actualmatch = string.match(pattern);
+expectedmatch = Array('b', 'b');
+addThis();
+
+status = inSection(281);
+pattern = /(?m)^b/;
+string = 'a\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = Array('b');
+addThis();
+
+status = inSection(282);
+pattern = /(?m)^(b)/;
+string = 'a\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = Array('b', 'b');
+addThis();
+
+status = inSection(283);
+pattern = /((?m)^b)/;
+string = 'a\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = Array('b', 'b');
+addThis();
+
+status = inSection(284);
+pattern = /\n((?m)^b)/;
+string = 'a\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = Array('\nb', 'b');
+addThis();
+
+status = inSection(285);
+pattern = /((?s).)c(?!.)/;
+string = 'a\nb\nc\n';
+actualmatch = string.match(pattern);
+expectedmatch = Array('\nc', '\n');
+addThis();
+
+status = inSection(286);
+pattern = /((?s).)c(?!.)/;
+string = 'a\nb\nc\n';
+actualmatch = string.match(pattern);
+expectedmatch = Array('\nc', '\n');
+addThis();
+
+status = inSection(287);
+pattern = /((?s)b.)c(?!.)/;
+string = 'a\nb\nc\n';
+actualmatch = string.match(pattern);
+expectedmatch = Array('b\nc', 'b\n');
+addThis();
+
+status = inSection(288);
+pattern = /((?s)b.)c(?!.)/;
+string = 'a\nb\nc\n';
+actualmatch = string.match(pattern);
+expectedmatch = Array('b\nc', 'b\n');
+addThis();
+
+status = inSection(289);
+pattern = /((?m)^b)/;
+string = 'a\nb\nc\n';
+actualmatch = string.match(pattern);
+expectedmatch = Array('b', 'b');
+addThis();
+*/
+
+/* ECMA doesn't support (?(condition)
+status = inSection(290);
+pattern = /(?(1)b|a)/;
+string = 'a';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a');
+addThis();
+
+status = inSection(291);
+pattern = /(x)?(?(1)b|a)/;
+string = 'a';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a');
+addThis();
+
+status = inSection(292);
+pattern = /()?(?(1)b|a)/;
+string = 'a';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a');
+addThis();
+
+status = inSection(293);
+pattern = /()?(?(1)a|b)/;
+string = 'a';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a');
+addThis();
+
+status = inSection(294);
+pattern = /^(\()?blah(?(1)(\)))$/;
+string = '(blah)';
+actualmatch = string.match(pattern);
+expectedmatch = Array('(blah)', '(', ')');
+addThis();
+
+status = inSection(295);
+pattern = /^(\()?blah(?(1)(\)))$/;
+string = 'blah';
+actualmatch = string.match(pattern);
+expectedmatch = Array('blah');
+addThis();
+
+status = inSection(296);
+pattern = /^(\(+)?blah(?(1)(\)))$/;
+string = '(blah)';
+actualmatch = string.match(pattern);
+expectedmatch = Array('(blah)', '(', ')');
+addThis();
+
+status = inSection(297);
+pattern = /^(\(+)?blah(?(1)(\)))$/;
+string = 'blah';
+actualmatch = string.match(pattern);
+expectedmatch = Array('blah');
+addThis();
+
+status = inSection(298);
+pattern = /(?(?!a)b|a)/;
+string = 'a';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a');
+addThis();
+
+status = inSection(299);
+pattern = /(?(?=a)a|b)/;
+string = 'a';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a');
+addThis();
+*/
+
+status = inSection(300);
+pattern = /(?=(a+?))(\1ab)/;
+string = 'aaab';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aab', 'a', 'aab');
+addThis();
+
+status = inSection(301);
+pattern = /(\w+:)+/;
+string = 'one:';
+actualmatch = string.match(pattern);
+expectedmatch = Array('one:', 'one:');
+addThis();
+
+/* ECMA doesn't support (?< etc
+status = inSection(302);
+pattern = /$(?<=^(a))/;
+string = 'a';
+actualmatch = string.match(pattern);
+expectedmatch = Array('', 'a');
+addThis();
+*/
+
+status = inSection(303);
+pattern = /(?=(a+?))(\1ab)/;
+string = 'aaab';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aab', 'a', 'aab');
+addThis();
+
+/* MODIFIED - ECMA has different rules for paren contents */
+status = inSection(304);
+pattern = /([\w:]+::)?(\w+)$/;
+string = 'abcd';
+actualmatch = string.match(pattern);
+//expectedmatch = Array('abcd', '', 'abcd');
+expectedmatch = Array('abcd', undefined, 'abcd');
+addThis();
+
+status = inSection(305);
+pattern = /([\w:]+::)?(\w+)$/;
+string = 'xy:z:::abcd';
+actualmatch = string.match(pattern);
+expectedmatch = Array('xy:z:::abcd', 'xy:z:::', 'abcd');
+addThis();
+
+status = inSection(306);
+pattern = /^[^bcd]*(c+)/;
+string = 'aexycd';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aexyc', 'c');
+addThis();
+
+status = inSection(307);
+pattern = /(a*)b+/;
+string = 'caab';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aab', 'aa');
+addThis();
+
+/* MODIFIED - ECMA has different rules for paren contents */
+status = inSection(308);
+pattern = /([\w:]+::)?(\w+)$/;
+string = 'abcd';
+actualmatch = string.match(pattern);
+//expectedmatch = Array('abcd', '', 'abcd');
+expectedmatch = Array('abcd', undefined, 'abcd');
+addThis();
+
+status = inSection(309);
+pattern = /([\w:]+::)?(\w+)$/;
+string = 'xy:z:::abcd';
+actualmatch = string.match(pattern);
+expectedmatch = Array('xy:z:::abcd', 'xy:z:::', 'abcd');
+addThis();
+
+status = inSection(310);
+pattern = /^[^bcd]*(c+)/;
+string = 'aexycd';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aexyc', 'c');
+addThis();
+
+/* ECMA doesn't support (?>
+status = inSection(311);
+pattern = /(?>a+)b/;
+string = 'aaab';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aaab');
+addThis();
+*/
+
+status = inSection(312);
+pattern = /([[:]+)/;
+string = 'a:[b]:';
+actualmatch = string.match(pattern);
+expectedmatch = Array(':[', ':[');
+addThis();
+
+status = inSection(313);
+pattern = /([[=]+)/;
+string = 'a=[b]=';
+actualmatch = string.match(pattern);
+expectedmatch = Array('=[', '=[');
+addThis();
+
+status = inSection(314);
+pattern = /([[.]+)/;
+string = 'a.[b].';
+actualmatch = string.match(pattern);
+expectedmatch = Array('.[', '.[');
+addThis();
+
+/* ECMA doesn't have rules for [:
+status = inSection(315);
+pattern = /[a[:]b[:c]/;
+string = 'abc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abc');
+addThis();
+*/
+
+/* ECMA doesn't support (?>
+status = inSection(316);
+pattern = /((?>a+)b)/;
+string = 'aaab';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aaab', 'aaab');
+addThis();
+
+status = inSection(317);
+pattern = /(?>(a+))b/;
+string = 'aaab';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aaab', 'aaa');
+addThis();
+
+status = inSection(318);
+pattern = /((?>[^()]+)|\([^()]*\))+/;
+string = '((abc(ade)ufh()()x';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abc(ade)ufh()()x', 'x');
+addThis();
+*/
+
+/* Perl has \Z has end-of-line, ECMA doesn't
+status = inSection(319);
+pattern = /\Z/;
+string = 'a\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = Array('');
+addThis();
+
+status = inSection(320);
+pattern = /\z/;
+string = 'a\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = Array('');
+addThis();
+*/
+
+status = inSection(321);
+pattern = /$/;
+string = 'a\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = Array('');
+addThis();
+
+/* Perl has \Z has end-of-line, ECMA doesn't
+status = inSection(322);
+pattern = /\Z/;
+string = 'b\na\n';
+actualmatch = string.match(pattern);
+expectedmatch = Array('');
+addThis();
+
+status = inSection(323);
+pattern = /\z/;
+string = 'b\na\n';
+actualmatch = string.match(pattern);
+expectedmatch = Array('');
+addThis();
+*/
+
+status = inSection(324);
+pattern = /$/;
+string = 'b\na\n';
+actualmatch = string.match(pattern);
+expectedmatch = Array('');
+addThis();
+
+/* Perl has \Z has end-of-line, ECMA doesn't
+status = inSection(325);
+pattern = /\Z/;
+string = 'b\na';
+actualmatch = string.match(pattern);
+expectedmatch = Array('');
+addThis();
+
+status = inSection(326);
+pattern = /\z/;
+string = 'b\na';
+actualmatch = string.match(pattern);
+expectedmatch = Array('');
+addThis();
+*/
+
+status = inSection(327);
+pattern = /$/;
+string = 'b\na';
+actualmatch = string.match(pattern);
+expectedmatch = Array('');
+addThis();
+
+/* Perl has \Z has end-of-line, ECMA doesn't
+status = inSection(328);
+pattern = /\Z/m;
+string = 'a\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = Array('');
+addThis();
+
+status = inSection(329);
+pattern = /\z/m;
+string = 'a\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = Array('');
+addThis();
+*/
+
+status = inSection(330);
+pattern = /$/m;
+string = 'a\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = Array('');
+addThis();
+
+/* Perl has \Z has end-of-line, ECMA doesn't
+status = inSection(331);
+pattern = /\Z/m;
+string = 'b\na\n';
+actualmatch = string.match(pattern);
+expectedmatch = Array('');
+addThis();
+
+status = inSection(332);
+pattern = /\z/m;
+string = 'b\na\n';
+actualmatch = string.match(pattern);
+expectedmatch = Array('');
+addThis();
+*/
+
+status = inSection(333);
+pattern = /$/m;
+string = 'b\na\n';
+actualmatch = string.match(pattern);
+expectedmatch = Array('');
+addThis();
+
+/* Perl has \Z has end-of-line, ECMA doesn't
+status = inSection(334);
+pattern = /\Z/m;
+string = 'b\na';
+actualmatch = string.match(pattern);
+expectedmatch = Array('');
+addThis();
+
+status = inSection(335);
+pattern = /\z/m;
+string = 'b\na';
+actualmatch = string.match(pattern);
+expectedmatch = Array('');
+addThis();
+*/
+
+status = inSection(336);
+pattern = /$/m;
+string = 'b\na';
+actualmatch = string.match(pattern);
+expectedmatch = Array('');
+addThis();
+
+/* Perl has \Z has end-of-line, ECMA doesn't
+status = inSection(337);
+pattern = /a\Z/;
+string = 'b\na\n';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a');
+addThis();
+*/
+
+/* $ only matches end of input unless multiline
+status = inSection(338);
+pattern = /a$/;
+string = 'b\na\n';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a');
+addThis();
+*/
+
+/* Perl has \Z has end-of-line, ECMA doesn't
+status = inSection(339);
+pattern = /a\Z/;
+string = 'b\na';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a');
+addThis();
+
+status = inSection(340);
+pattern = /a\z/;
+string = 'b\na';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a');
+addThis();
+*/
+
+status = inSection(341);
+pattern = /a$/;
+string = 'b\na';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a');
+addThis();
+
+status = inSection(342);
+pattern = /a$/m;
+string = 'a\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a');
+addThis();
+
+/* Perl has \Z has end-of-line, ECMA doesn't
+status = inSection(343);
+pattern = /a\Z/m;
+string = 'b\na\n';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a');
+addThis();
+*/
+
+status = inSection(344);
+pattern = /a$/m;
+string = 'b\na\n';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a');
+addThis();
+
+/* Perl has \Z has end-of-line, ECMA doesn't
+status = inSection(345);
+pattern = /a\Z/m;
+string = 'b\na';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a');
+addThis();
+
+status = inSection(346);
+pattern = /a\z/m;
+string = 'b\na';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a');
+addThis();
+*/
+
+status = inSection(347);
+pattern = /a$/m;
+string = 'b\na';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a');
+addThis();
+
+/* Perl has \Z has end-of-line, ECMA doesn't
+status = inSection(348);
+pattern = /aa\Z/;
+string = 'b\naa\n';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aa');
+addThis();
+*/
+
+/* $ only matches end of input unless multiline
+status = inSection(349);
+pattern = /aa$/;
+string = 'b\naa\n';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aa');
+addThis();
+*/
+
+/* Perl has \Z has end-of-line, ECMA doesn't
+status = inSection(350);
+pattern = /aa\Z/;
+string = 'b\naa';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aa');
+addThis();
+
+status = inSection(351);
+pattern = /aa\z/;
+string = 'b\naa';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aa');
+addThis();
+*/
+
+status = inSection(352);
+pattern = /aa$/;
+string = 'b\naa';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aa');
+addThis();
+
+status = inSection(353);
+pattern = /aa$/m;
+string = 'aa\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aa');
+addThis();
+
+/* Perl has \Z has end-of-line, ECMA doesn't
+status = inSection(354);
+pattern = /aa\Z/m;
+string = 'b\naa\n';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aa');
+addThis();
+*/
+
+status = inSection(355);
+pattern = /aa$/m;
+string = 'b\naa\n';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aa');
+addThis();
+
+/* Perl has \Z has end-of-line, ECMA doesn't
+status = inSection(356);
+pattern = /aa\Z/m;
+string = 'b\naa';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aa');
+addThis();
+
+status = inSection(357);
+pattern = /aa\z/m;
+string = 'b\naa';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aa');
+addThis();
+*/
+
+status = inSection(358);
+pattern = /aa$/m;
+string = 'b\naa';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aa');
+addThis();
+
+/* Perl has \Z has end-of-line, ECMA doesn't
+status = inSection(359);
+pattern = /ab\Z/;
+string = 'b\nab\n';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ab');
+addThis();
+*/
+
+/* $ only matches end of input unless multiline
+status = inSection(360);
+pattern = /ab$/;
+string = 'b\nab\n';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ab');
+addThis();
+*/
+
+/* Perl has \Z has end-of-line, ECMA doesn't
+status = inSection(361);
+pattern = /ab\Z/;
+string = 'b\nab';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ab');
+addThis();
+
+status = inSection(362);
+pattern = /ab\z/;
+string = 'b\nab';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ab');
+addThis();
+*/
+
+status = inSection(363);
+pattern = /ab$/;
+string = 'b\nab';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ab');
+addThis();
+
+status = inSection(364);
+pattern = /ab$/m;
+string = 'ab\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ab');
+addThis();
+
+/* Perl has \Z has end-of-line, ECMA doesn't
+status = inSection(365);
+pattern = /ab\Z/m;
+string = 'b\nab\n';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ab');
+addThis();
+*/
+
+status = inSection(366);
+pattern = /ab$/m;
+string = 'b\nab\n';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ab');
+addThis();
+
+/* Perl has \Z has end-of-line, ECMA doesn't
+status = inSection(367);
+pattern = /ab\Z/m;
+string = 'b\nab';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ab');
+addThis();
+
+status = inSection(368);
+pattern = /ab\z/m;
+string = 'b\nab';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ab');
+addThis();
+*/
+
+status = inSection(369);
+pattern = /ab$/m;
+string = 'b\nab';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ab');
+addThis();
+
+/* Perl has \Z has end-of-line, ECMA doesn't
+status = inSection(370);
+pattern = /abb\Z/;
+string = 'b\nabb\n';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abb');
+addThis();
+*/
+
+/* $ only matches end of input unless multiline
+status = inSection(371);
+pattern = /abb$/;
+string = 'b\nabb\n';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abb');
+addThis();
+*/
+
+/* Perl has \Z has end-of-line, ECMA doesn't
+status = inSection(372);
+pattern = /abb\Z/;
+string = 'b\nabb';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abb');
+addThis();
+
+status = inSection(373);
+pattern = /abb\z/;
+string = 'b\nabb';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abb');
+addThis();
+*/
+
+status = inSection(374);
+pattern = /abb$/;
+string = 'b\nabb';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abb');
+addThis();
+
+status = inSection(375);
+pattern = /abb$/m;
+string = 'abb\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abb');
+addThis();
+
+/* Perl has \Z has end-of-line, ECMA doesn't
+status = inSection(376);
+pattern = /abb\Z/m;
+string = 'b\nabb\n';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abb');
+addThis();
+*/
+
+status = inSection(377);
+pattern = /abb$/m;
+string = 'b\nabb\n';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abb');
+addThis();
+
+/* Perl has \Z has end-of-line, ECMA doesn't
+status = inSection(378);
+pattern = /abb\Z/m;
+string = 'b\nabb';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abb');
+addThis();
+
+status = inSection(379);
+pattern = /abb\z/m;
+string = 'b\nabb';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abb');
+addThis();
+*/
+
+status = inSection(380);
+pattern = /abb$/m;
+string = 'b\nabb';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abb');
+addThis();
+
+status = inSection(381);
+pattern = /(^|x)(c)/;
+string = 'ca';
+actualmatch = string.match(pattern);
+expectedmatch = Array('c', '', 'c');
+addThis();
+
+status = inSection(382);
+pattern = /foo.bart/;
+string = 'foo.bart';
+actualmatch = string.match(pattern);
+expectedmatch = Array('foo.bart');
+addThis();
+
+status = inSection(383);
+pattern = /^d[x][x][x]/m;
+string = 'abcd\ndxxx';
+actualmatch = string.match(pattern);
+expectedmatch = Array('dxxx');
+addThis();
+
+status = inSection(384);
+pattern = /tt+$/;
+string = 'xxxtt';
+actualmatch = string.match(pattern);
+expectedmatch = Array('tt');
+addThis();
+
+/* ECMA spec says that each atom in a range must be a single character
+status = inSection(385);
+pattern = /([a-\d]+)/;
+string = 'za-9z';
+actualmatch = string.match(pattern);
+expectedmatch = Array('9', '9');
+addThis();
+
+status = inSection(386);
+pattern = /([\d-z]+)/;
+string = 'a0-za';
+actualmatch = string.match(pattern);
+expectedmatch = Array('0-z', '0-z');
+addThis();
+*/
+
+/* ECMA doesn't support [:
+status = inSection(387);
+pattern = /([a-[:digit:]]+)/;
+string = 'za-9z';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a-9', 'a-9');
+addThis();
+
+status = inSection(388);
+pattern = /([[:digit:]-z]+)/;
+string = '=0-z=';
+actualmatch = string.match(pattern);
+expectedmatch = Array('0-z', '0-z');
+addThis();
+
+status = inSection(389);
+pattern = /([[:digit:]-[:alpha:]]+)/;
+string = '=0-z=';
+actualmatch = string.match(pattern);
+expectedmatch = Array('0-z', '0-z');
+addThis();
+*/
+
+status = inSection(390);
+pattern = /(\d+\.\d+)/;
+string = '3.1415926';
+actualmatch = string.match(pattern);
+expectedmatch = Array('3.1415926', '3.1415926');
+addThis();
+
+status = inSection(391);
+pattern = /\.c(pp|xx|c)?$/i;
+string = 'IO.c';
+actualmatch = string.match(pattern);
+expectedmatch = Array('.c', undefined);
+addThis();
+
+status = inSection(392);
+pattern = /(\.c(pp|xx|c)?$)/i;
+string = 'IO.c';
+actualmatch = string.match(pattern);
+expectedmatch = Array('.c', '.c', undefined);
+addThis();
+
+status = inSection(393);
+pattern = /(^|a)b/;
+string = 'ab';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ab', 'a');
+addThis();
+
+status = inSection(394);
+pattern = /^([ab]*?)(b)?(c)$/;
+string = 'abac';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abac', 'aba', undefined, 'c');
+addThis();
+
+status = inSection(395);
+pattern = /^(?:.,){2}c/i;
+string = 'a,b,c';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a,b,c');
+addThis();
+
+status = inSection(396);
+pattern = /^(.,){2}c/i;
+string = 'a,b,c';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a,b,c', 'b,');
+addThis();
+
+status = inSection(397);
+pattern = /^(?:[^,]*,){2}c/;
+string = 'a,b,c';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a,b,c');
+addThis();
+
+status = inSection(398);
+pattern = /^([^,]*,){2}c/;
+string = 'a,b,c';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a,b,c', 'b,');
+addThis();
+
+status = inSection(399);
+pattern = /^([^,]*,){3}d/;
+string = 'aaa,b,c,d';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aaa,b,c,d', 'c,');
+addThis();
+
+status = inSection(400);
+pattern = /^([^,]*,){3,}d/;
+string = 'aaa,b,c,d';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aaa,b,c,d', 'c,');
+addThis();
+
+status = inSection(401);
+pattern = /^([^,]*,){0,3}d/;
+string = 'aaa,b,c,d';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aaa,b,c,d', 'c,');
+addThis();
+
+status = inSection(402);
+pattern = /^([^,]{1,3},){3}d/i;
+string = 'aaa,b,c,d';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aaa,b,c,d', 'c,');
+addThis();
+
+status = inSection(403);
+pattern = /^([^,]{1,3},){3,}d/;
+string = 'aaa,b,c,d';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aaa,b,c,d', 'c,');
+addThis();
+
+status = inSection(404);
+pattern = /^([^,]{1,3},){0,3}d/;
+string = 'aaa,b,c,d';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aaa,b,c,d', 'c,');
+addThis();
+
+status = inSection(405);
+pattern = /^([^,]{1,},){3}d/;
+string = 'aaa,b,c,d';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aaa,b,c,d', 'c,');
+addThis();
+
+status = inSection(406);
+pattern = /^([^,]{1,},){3,}d/;
+string = 'aaa,b,c,d';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aaa,b,c,d', 'c,');
+addThis();
+
+status = inSection(407);
+pattern = /^([^,]{1,},){0,3}d/;
+string = 'aaa,b,c,d';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aaa,b,c,d', 'c,');
+addThis();
+
+status = inSection(408);
+pattern = /^([^,]{0,3},){3}d/i;
+string = 'aaa,b,c,d';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aaa,b,c,d', 'c,');
+addThis();
+
+status = inSection(409);
+pattern = /^([^,]{0,3},){3,}d/;
+string = 'aaa,b,c,d';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aaa,b,c,d', 'c,');
+addThis();
+
+status = inSection(410);
+pattern = /^([^,]{0,3},){0,3}d/;
+string = 'aaa,b,c,d';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aaa,b,c,d', 'c,');
+addThis();
+
+/* ECMA doesn't support \A
+status = inSection(411);
+pattern = /(?!\A)x/m;
+string = 'a\nxb\n';
+actualmatch = string.match(pattern);
+expectedmatch = Array('\n');
+addThis();
+*/
+
+status = inSection(412);
+pattern = /^(a(b)?)+$/;
+string = 'aba';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aba', 'a', undefined);
+addThis();
+
+status = inSection(413);
+pattern = /^(aa(bb)?)+$/;
+string = 'aabbaa';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aabbaa', 'aa', undefined);
+addThis();
+
+status = inSection(414);
+pattern = /^.{9}abc.*\n/m;
+string = '123\nabcabcabcabc\n';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abcabcabcabc\n');
+addThis();
+
+status = inSection(415);
+pattern = /^(a)?a$/;
+string = 'a';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a', undefined);
+addThis();
+
+status = inSection(416);
+pattern = /^(a\1?)(a\1?)(a\2?)(a\3?)$/;
+string = 'aaaaaa';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aaaaaa', 'a', 'aa', 'a', 'aa');
+addThis();
+
+/* Can't refer to a capture before it's encountered & completed
+status = inSection(417);
+pattern = /^(a\1?){4}$/;
+string = 'aaaaaa';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aaaaaa', 'aaa');
+addThis();
+*/
+
+status = inSection(418);
+pattern = /^(0+)?(?:x(1))?/;
+string = 'x1';
+actualmatch = string.match(pattern);
+expectedmatch = Array('x1', undefined, '1');
+addThis();
+
+status = inSection(419);
+pattern = /^([0-9a-fA-F]+)(?:x([0-9a-fA-F]+)?)(?:x([0-9a-fA-F]+))?/;
+string = '012cxx0190';
+actualmatch = string.match(pattern);
+expectedmatch = Array('012cxx0190', '012c', undefined, '0190');
+addThis();
+
+status = inSection(420);
+pattern = /^(b+?|a){1,2}c/;
+string = 'bbbac';
+actualmatch = string.match(pattern);
+expectedmatch = Array('bbbac', 'a');
+addThis();
+
+status = inSection(421);
+pattern = /^(b+?|a){1,2}c/;
+string = 'bbbbac';
+actualmatch = string.match(pattern);
+expectedmatch = Array('bbbbac', 'a');
+addThis();
+
+status = inSection(422);
+pattern = /((?:aaaa|bbbb)cccc)?/;
+string = 'aaaacccc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aaaacccc', 'aaaacccc');
+addThis();
+
+status = inSection(423);
+pattern = /((?:aaaa|bbbb)cccc)?/;
+string = 'bbbbcccc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('bbbbcccc', 'bbbbcccc');
+addThis();
+
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ if(omitCurrentSection())
+ return;
+
+ statusmessages[i] = status;
+ patterns[i] = pattern;
+ strings[i] = string;
+ actualmatches[i] = actualmatch;
+ expectedmatches[i] = expectedmatch;
+ i++;
+}
+
+
+function omitCurrentSection()
+{
+ try
+ {
+ // current section number is in global status variable
+ var n = status.match(/(\d+)/)[1];
+ return ((n < cnLBOUND) || (n > cnUBOUND));
+ }
+ catch(e)
+ {
+ return false;
+ }
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+ testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/perlstress-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/perlstress-002.js
new file mode 100644
index 0000000..44cfbb5
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/perlstress-002.js
@@ -0,0 +1,1837 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2002
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com, rogerl@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 2002-07-07
+* SUMMARY: Testing JS RegExp engine against Perl 5 RegExp engine.
+* Adjust cnLBOUND, cnUBOUND below to restrict which sections are tested.
+*
+* This test was created by running various patterns and strings through the
+* Perl 5 RegExp engine. We saved the results below to test the JS engine.
+*
+* Each of the examples below is a negative test; that is, each produces a
+* null match in Perl. Thus we set |expectedmatch| = |null| in each section.
+*
+* NOTE: ECMA/JS and Perl do differ on certain points. We have either commented
+* out such sections altogether, or modified them to fit what we expect from JS.
+*
+* EXAMPLES:
+*
+* - ECMA does support (?: (?= and (?! operators, but doesn't support (?< etc.
+*
+* - ECMA doesn't support (?(condition)
+*
+*/
+//-----------------------------------------------------------------------------
+var i = 0;
+var bug = 85721;
+var summary = 'Testing regular expression edge cases';
+var cnSingleSpace = ' ';
+var status = '';
+var statusmessages = new Array();
+var pattern = '';
+var patterns = new Array();
+var string = '';
+var strings = new Array();
+var actualmatch = '';
+var actualmatches = new Array();
+var expectedmatch = '';
+var expectedmatches = new Array();
+var cnLBOUND = 0;
+var cnUBOUND = 1000;
+
+
+status = inSection(1);
+pattern = /abc/;
+string = 'xbc';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(2);
+pattern = /abc/;
+string = 'axc';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(3);
+pattern = /abc/;
+string = 'abx';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(4);
+pattern = /ab+bc/;
+string = 'abc';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(5);
+pattern = /ab+bc/;
+string = 'abq';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(6);
+pattern = /ab{1,}bc/;
+string = 'abq';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(7);
+pattern = /ab{4,5}bc/;
+string = 'abbbbc';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(8);
+pattern = /ab?bc/;
+string = 'abbbbc';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(9);
+pattern = /^abc$/;
+string = 'abcc';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(10);
+pattern = /^abc$/;
+string = 'aabc';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(11);
+pattern = /abc$/;
+string = 'aabcd';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(12);
+pattern = /a.*c/;
+string = 'axyzd';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(13);
+pattern = /a[bc]d/;
+string = 'abc';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(14);
+pattern = /a[b-d]e/;
+string = 'abd';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(15);
+pattern = /a[^bc]d/;
+string = 'abd';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(16);
+pattern = /a[^-b]c/;
+string = 'a-c';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(17);
+pattern = /a[^]b]c/;
+string = 'a]c';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(18);
+pattern = /\by\b/;
+string = 'xy';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(19);
+pattern = /\by\b/;
+string = 'yz';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(20);
+pattern = /\by\b/;
+string = 'xyz';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(21);
+pattern = /\Ba\B/;
+string = 'a-';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(22);
+pattern = /\Ba\B/;
+string = '-a';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(23);
+pattern = /\Ba\B/;
+string = '-a-';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(24);
+pattern = /\w/;
+string = '-';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(25);
+pattern = /\W/;
+string = 'a';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(26);
+pattern = /a\sb/;
+string = 'a-b';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(27);
+pattern = /\d/;
+string = '-';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(28);
+pattern = /\D/;
+string = '1';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(29);
+pattern = /[\w]/;
+string = '-';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(30);
+pattern = /[\W]/;
+string = 'a';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(31);
+pattern = /a[\s]b/;
+string = 'a-b';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(32);
+pattern = /[\d]/;
+string = '-';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(33);
+pattern = /[\D]/;
+string = '1';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(34);
+pattern = /$b/;
+string = 'b';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(35);
+pattern = /^(ab|cd)e/;
+string = 'abcde';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(36);
+pattern = /a[bcd]+dcdcde/;
+string = 'adcdcde';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(37);
+pattern = /(bc+d$|ef*g.|h?i(j|k))/;
+string = 'effg';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(38);
+pattern = /(bc+d$|ef*g.|h?i(j|k))/;
+string = 'bcdd';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(39);
+pattern = /[k]/;
+string = 'ab';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+// MODIFIED - ECMA has different rules for paren contents.
+status = inSection(40);
+pattern = /(a)|\1/;
+string = 'x';
+actualmatch = string.match(pattern);
+//expectedmatch = null;
+expectedmatch = Array("", undefined);
+addThis();
+
+// MODIFIED - ECMA has different rules for paren contents.
+status = inSection(41);
+pattern = /((\3|b)\2(a)x)+/;
+string = 'aaxabxbaxbbx';
+actualmatch = string.match(pattern);
+//expectedmatch = null;
+expectedmatch = Array("ax", "ax", "", "a");
+addThis();
+
+status = inSection(42);
+pattern = /abc/i;
+string = 'XBC';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(43);
+pattern = /abc/i;
+string = 'AXC';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(44);
+pattern = /abc/i;
+string = 'ABX';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(45);
+pattern = /ab+bc/i;
+string = 'ABC';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(46);
+pattern = /ab+bc/i;
+string = 'ABQ';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(47);
+pattern = /ab{1,}bc/i;
+string = 'ABQ';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(48);
+pattern = /ab{4,5}?bc/i;
+string = 'ABBBBC';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(49);
+pattern = /ab??bc/i;
+string = 'ABBBBC';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(50);
+pattern = /^abc$/i;
+string = 'ABCC';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(51);
+pattern = /^abc$/i;
+string = 'AABC';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(52);
+pattern = /a.*c/i;
+string = 'AXYZD';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(53);
+pattern = /a[bc]d/i;
+string = 'ABC';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(54);
+pattern = /a[b-d]e/i;
+string = 'ABD';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(55);
+pattern = /a[^bc]d/i;
+string = 'ABD';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(56);
+pattern = /a[^-b]c/i;
+string = 'A-C';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(57);
+pattern = /a[^]b]c/i;
+string = 'A]C';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(58);
+pattern = /$b/i;
+string = 'B';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(59);
+pattern = /^(ab|cd)e/i;
+string = 'ABCDE';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(60);
+pattern = /a[bcd]+dcdcde/i;
+string = 'ADCDCDE';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(61);
+pattern = /(bc+d$|ef*g.|h?i(j|k))/i;
+string = 'EFFG';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(62);
+pattern = /(bc+d$|ef*g.|h?i(j|k))/i;
+string = 'BCDD';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(63);
+pattern = /[k]/i;
+string = 'AB';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(64);
+pattern = /^(a\1?){4}$/;
+string = 'aaaaaaaaa';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(65);
+pattern = /^(a\1?){4}$/;
+string = 'aaaaaaaaaaa';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+/* ECMA doesn't support (?(
+status = inSection(66);
+pattern = /^(a(?(1)\1)){4}$/;
+string = 'aaaaaaaaa';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(67);
+pattern = /^(a(?(1)\1)){4}$/;
+string = 'aaaaaaaaaaa';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+*/
+
+/* ECMA doesn't support (?<
+status = inSection(68);
+pattern = /(?<=a)b/;
+string = 'cb';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(69);
+pattern = /(?<=a)b/;
+string = 'b';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(70);
+pattern = /(?<!c)b/;
+string = 'cb';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+*/
+
+/* ECMA doesn't support (?(condition)
+status = inSection(71);
+pattern = /(?:(?i)a)b/;
+string = 'aB';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(72);
+pattern = /((?i)a)b/;
+string = 'aB';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(73);
+pattern = /(?i:a)b/;
+string = 'aB';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(74);
+pattern = /((?i:a))b/;
+string = 'aB';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(75);
+pattern = /(?:(?-i)a)b/i;
+string = 'Ab';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(76);
+pattern = /((?-i)a)b/i;
+string = 'Ab';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(77);
+pattern = /(?:(?-i)a)b/i;
+string = 'AB';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(78);
+pattern = /((?-i)a)b/i;
+string = 'AB';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(79);
+pattern = /(?-i:a)b/i;
+string = 'Ab';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(80);
+pattern = /((?-i:a))b/i;
+string = 'Ab';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(81);
+pattern = /(?-i:a)b/i;
+string = 'AB';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(82);
+pattern = /((?-i:a))b/i;
+string = 'AB';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(83);
+pattern = /((?-i:a.))b/i;
+string = 'a\nB';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(84);
+pattern = /((?s-i:a.))b/i;
+string = 'B\nB';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+*/
+
+/* ECMA doesn't support (?<
+status = inSection(85);
+pattern = /(?<![cd])b/;
+string = 'dbcb';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(86);
+pattern = /(?<!(c|d))b/;
+string = 'dbcb';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+*/
+
+status = inSection(87);
+pattern = /^(?:a?b?)*$/;
+string = 'a--';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(88);
+pattern = /^b/;
+string = 'a\nb\nc\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(89);
+pattern = /()^b/;
+string = 'a\nb\nc\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+/* ECMA doesn't support (?(
+status = inSection(90);
+pattern = /(?(1)a|b)/;
+string = 'a';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(91);
+pattern = /(x)?(?(1)a|b)/;
+string = 'a';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(92);
+pattern = /()(?(1)b|a)/;
+string = 'a';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(93);
+pattern = /^(\()?blah(?(1)(\)))$/;
+string = 'blah)';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(94);
+pattern = /^(\()?blah(?(1)(\)))$/;
+string = '(blah';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(95);
+pattern = /^(\(+)?blah(?(1)(\)))$/;
+string = 'blah)';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(96);
+pattern = /^(\(+)?blah(?(1)(\)))$/;
+string = '(blah';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(97);
+pattern = /(?(?{0})a|b)/;
+string = 'a';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(98);
+pattern = /(?(?{1})b|a)/;
+string = 'a';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(99);
+pattern = /(?(?!a)a|b)/;
+string = 'a';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(100);
+pattern = /(?(?=a)b|a)/;
+string = 'a';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+*/
+
+status = inSection(101);
+pattern = /^(?=(a+?))\1ab/;
+string = 'aaab';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(102);
+pattern = /^(?=(a+?))\1ab/;
+string = 'aaab';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(103);
+pattern = /([\w:]+::)?(\w+)$/;
+string = 'abcd:';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(104);
+pattern = /([\w:]+::)?(\w+)$/;
+string = 'abcd:';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(105);
+pattern = /(>a+)ab/;
+string = 'aaab';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(106);
+pattern = /a\Z/;
+string = 'a\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(107);
+pattern = /a\z/;
+string = 'a\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(108);
+pattern = /a$/;
+string = 'a\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(109);
+pattern = /a\z/;
+string = 'b\na\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(110);
+pattern = /a\z/m;
+string = 'a\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(111);
+pattern = /a\z/m;
+string = 'b\na\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(112);
+pattern = /aa\Z/;
+string = 'aa\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(113);
+pattern = /aa\z/;
+string = 'aa\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(114);
+pattern = /aa$/;
+string = 'aa\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(115);
+pattern = /aa\z/;
+string = 'b\naa\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(116);
+pattern = /aa\z/m;
+string = 'aa\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(117);
+pattern = /aa\z/m;
+string = 'b\naa\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(118);
+pattern = /aa\Z/;
+string = 'ac\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(119);
+pattern = /aa\z/;
+string = 'ac\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(120);
+pattern = /aa$/;
+string = 'ac\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(121);
+pattern = /aa\Z/;
+string = 'b\nac\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(122);
+pattern = /aa\z/;
+string = 'b\nac\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(123);
+pattern = /aa$/;
+string = 'b\nac\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(124);
+pattern = /aa\Z/;
+string = 'b\nac';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(125);
+pattern = /aa\z/;
+string = 'b\nac';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(126);
+pattern = /aa$/;
+string = 'b\nac';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(127);
+pattern = /aa\Z/m;
+string = 'ac\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(128);
+pattern = /aa\z/m;
+string = 'ac\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(129);
+pattern = /aa$/m;
+string = 'ac\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(130);
+pattern = /aa\Z/m;
+string = 'b\nac\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(131);
+pattern = /aa\z/m;
+string = 'b\nac\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(132);
+pattern = /aa$/m;
+string = 'b\nac\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(133);
+pattern = /aa\Z/m;
+string = 'b\nac';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(134);
+pattern = /aa\z/m;
+string = 'b\nac';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(135);
+pattern = /aa$/m;
+string = 'b\nac';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(136);
+pattern = /aa\Z/;
+string = 'ca\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(137);
+pattern = /aa\z/;
+string = 'ca\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(138);
+pattern = /aa$/;
+string = 'ca\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(139);
+pattern = /aa\Z/;
+string = 'b\nca\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(140);
+pattern = /aa\z/;
+string = 'b\nca\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(141);
+pattern = /aa$/;
+string = 'b\nca\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(142);
+pattern = /aa\Z/;
+string = 'b\nca';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(143);
+pattern = /aa\z/;
+string = 'b\nca';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(144);
+pattern = /aa$/;
+string = 'b\nca';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(145);
+pattern = /aa\Z/m;
+string = 'ca\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(146);
+pattern = /aa\z/m;
+string = 'ca\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(147);
+pattern = /aa$/m;
+string = 'ca\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(148);
+pattern = /aa\Z/m;
+string = 'b\nca\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(149);
+pattern = /aa\z/m;
+string = 'b\nca\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(150);
+pattern = /aa$/m;
+string = 'b\nca\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(151);
+pattern = /aa\Z/m;
+string = 'b\nca';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(152);
+pattern = /aa\z/m;
+string = 'b\nca';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(153);
+pattern = /aa$/m;
+string = 'b\nca';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(154);
+pattern = /ab\Z/;
+string = 'ab\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(155);
+pattern = /ab\z/;
+string = 'ab\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(156);
+pattern = /ab$/;
+string = 'ab\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(157);
+pattern = /ab\z/;
+string = 'b\nab\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(158);
+pattern = /ab\z/m;
+string = 'ab\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(159);
+pattern = /ab\z/m;
+string = 'b\nab\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(160);
+pattern = /ab\Z/;
+string = 'ac\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(161);
+pattern = /ab\z/;
+string = 'ac\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(162);
+pattern = /ab$/;
+string = 'ac\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(163);
+pattern = /ab\Z/;
+string = 'b\nac\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(164);
+pattern = /ab\z/;
+string = 'b\nac\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(165);
+pattern = /ab$/;
+string = 'b\nac\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(166);
+pattern = /ab\Z/;
+string = 'b\nac';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(167);
+pattern = /ab\z/;
+string = 'b\nac';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(168);
+pattern = /ab$/;
+string = 'b\nac';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(169);
+pattern = /ab\Z/m;
+string = 'ac\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(170);
+pattern = /ab\z/m;
+string = 'ac\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(171);
+pattern = /ab$/m;
+string = 'ac\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(172);
+pattern = /ab\Z/m;
+string = 'b\nac\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(173);
+pattern = /ab\z/m;
+string = 'b\nac\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(174);
+pattern = /ab$/m;
+string = 'b\nac\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(175);
+pattern = /ab\Z/m;
+string = 'b\nac';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(176);
+pattern = /ab\z/m;
+string = 'b\nac';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(177);
+pattern = /ab$/m;
+string = 'b\nac';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(178);
+pattern = /ab\Z/;
+string = 'ca\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(179);
+pattern = /ab\z/;
+string = 'ca\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(180);
+pattern = /ab$/;
+string = 'ca\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(181);
+pattern = /ab\Z/;
+string = 'b\nca\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(182);
+pattern = /ab\z/;
+string = 'b\nca\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(183);
+pattern = /ab$/;
+string = 'b\nca\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(184);
+pattern = /ab\Z/;
+string = 'b\nca';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(185);
+pattern = /ab\z/;
+string = 'b\nca';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(186);
+pattern = /ab$/;
+string = 'b\nca';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(187);
+pattern = /ab\Z/m;
+string = 'ca\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(188);
+pattern = /ab\z/m;
+string = 'ca\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(189);
+pattern = /ab$/m;
+string = 'ca\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(190);
+pattern = /ab\Z/m;
+string = 'b\nca\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(191);
+pattern = /ab\z/m;
+string = 'b\nca\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(192);
+pattern = /ab$/m;
+string = 'b\nca\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(193);
+pattern = /ab\Z/m;
+string = 'b\nca';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(194);
+pattern = /ab\z/m;
+string = 'b\nca';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(195);
+pattern = /ab$/m;
+string = 'b\nca';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(196);
+pattern = /abb\Z/;
+string = 'abb\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(197);
+pattern = /abb\z/;
+string = 'abb\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(198);
+pattern = /abb$/;
+string = 'abb\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(199);
+pattern = /abb\z/;
+string = 'b\nabb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(200);
+pattern = /abb\z/m;
+string = 'abb\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(201);
+pattern = /abb\z/m;
+string = 'b\nabb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(202);
+pattern = /abb\Z/;
+string = 'ac\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(203);
+pattern = /abb\z/;
+string = 'ac\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(204);
+pattern = /abb$/;
+string = 'ac\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(205);
+pattern = /abb\Z/;
+string = 'b\nac\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(206);
+pattern = /abb\z/;
+string = 'b\nac\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(207);
+pattern = /abb$/;
+string = 'b\nac\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(208);
+pattern = /abb\Z/;
+string = 'b\nac';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(209);
+pattern = /abb\z/;
+string = 'b\nac';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(210);
+pattern = /abb$/;
+string = 'b\nac';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(211);
+pattern = /abb\Z/m;
+string = 'ac\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(212);
+pattern = /abb\z/m;
+string = 'ac\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(213);
+pattern = /abb$/m;
+string = 'ac\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(214);
+pattern = /abb\Z/m;
+string = 'b\nac\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(215);
+pattern = /abb\z/m;
+string = 'b\nac\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(216);
+pattern = /abb$/m;
+string = 'b\nac\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(217);
+pattern = /abb\Z/m;
+string = 'b\nac';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(218);
+pattern = /abb\z/m;
+string = 'b\nac';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(219);
+pattern = /abb$/m;
+string = 'b\nac';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(220);
+pattern = /abb\Z/;
+string = 'ca\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(221);
+pattern = /abb\z/;
+string = 'ca\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(222);
+pattern = /abb$/;
+string = 'ca\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(223);
+pattern = /abb\Z/;
+string = 'b\nca\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(224);
+pattern = /abb\z/;
+string = 'b\nca\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(225);
+pattern = /abb$/;
+string = 'b\nca\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(226);
+pattern = /abb\Z/;
+string = 'b\nca';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(227);
+pattern = /abb\z/;
+string = 'b\nca';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(228);
+pattern = /abb$/;
+string = 'b\nca';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(229);
+pattern = /abb\Z/m;
+string = 'ca\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(230);
+pattern = /abb\z/m;
+string = 'ca\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(231);
+pattern = /abb$/m;
+string = 'ca\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(232);
+pattern = /abb\Z/m;
+string = 'b\nca\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(233);
+pattern = /abb\z/m;
+string = 'b\nca\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(234);
+pattern = /abb$/m;
+string = 'b\nca\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(235);
+pattern = /abb\Z/m;
+string = 'b\nca';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(236);
+pattern = /abb\z/m;
+string = 'b\nca';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(237);
+pattern = /abb$/m;
+string = 'b\nca';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(238);
+pattern = /a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz/;
+string = 'x';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(239);
+pattern = /\GX.*X/;
+string = 'aaaXbX';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(240);
+pattern = /\.c(pp|xx|c)?$/i;
+string = 'Changes';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(241);
+pattern = /^([a-z]:)/;
+string = 'C:/';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(242);
+pattern = /(\w)?(abc)\1b/;
+string = 'abcab';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+/* ECMA doesn't support (?(
+status = inSection(243);
+pattern = /^(a)?(?(1)a|b)+$/;
+string = 'a';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+*/
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ if(omitCurrentSection())
+ return;
+
+ statusmessages[i] = status;
+ patterns[i] = pattern;
+ strings[i] = string;
+ actualmatches[i] = actualmatch;
+ expectedmatches[i] = expectedmatch;
+ i++;
+}
+
+
+function omitCurrentSection()
+{
+ try
+ {
+ // current section number is in global status variable
+ var n = status.match(/(\d+)/)[1];
+ return ((n < cnLBOUND) || (n > cnUBOUND));
+ }
+ catch(e)
+ {
+ return false;
+ }
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+ testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-100199.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-100199.js
new file mode 100644
index 0000000..8380499
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-100199.js
@@ -0,0 +1,286 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS"
+* basis, WITHOUT WARRANTY OF ANY KIND, either expressed
+* or implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation.
+* All Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+* Date: 17 September 2001
+*
+* SUMMARY: Regression test for Bugzilla bug 100199
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=100199
+*
+* The empty character class [] is a valid RegExp construct: the condition
+* that a given character belong to a set containing no characters. As such,
+* it can never be met and is always FALSE. Similarly, [^] is a condition
+* that matches any given character and is always TRUE.
+*
+* Neither one of these conditions should cause syntax errors in a RegExp.
+*/
+//-----------------------------------------------------------------------------
+var i = 0;
+var bug = 100199;
+var summary = '[], [^] are valid RegExp conditions. Should not cause errors -';
+var status = '';
+var statusmessages = new Array();
+var pattern = '';
+var patterns = new Array();
+var string = '';
+var strings = new Array();
+var actualmatch = '';
+var actualmatches = new Array();
+var expectedmatch = '';
+var expectedmatches = new Array();
+
+
+pattern = /[]/;
+ string = 'abc';
+ status = inSection(1);
+ actualmatch = string.match(pattern);
+ expectedmatch = null;
+ addThis();
+
+ string = '';
+ status = inSection(2);
+ actualmatch = string.match(pattern);
+ expectedmatch = null;
+ addThis();
+
+ string = '[';
+ status = inSection(3);
+ actualmatch = string.match(pattern);
+ expectedmatch = null;
+ addThis();
+
+ string = '/';
+ status = inSection(4);
+ actualmatch = string.match(pattern);
+ expectedmatch = null;
+ addThis();
+
+ string = '[';
+ status = inSection(5);
+ actualmatch = string.match(pattern);
+ expectedmatch = null;
+ addThis();
+
+ string = ']';
+ status = inSection(6);
+ actualmatch = string.match(pattern);
+ expectedmatch = null;
+ addThis();
+
+ string = '[]';
+ status = inSection(7);
+ actualmatch = string.match(pattern);
+ expectedmatch = null;
+ addThis();
+
+ string = '[ ]';
+ status = inSection(8);
+ actualmatch = string.match(pattern);
+ expectedmatch = null;
+ addThis();
+
+ string = '][';
+ status = inSection(9);
+ actualmatch = string.match(pattern);
+ expectedmatch = null;
+ addThis();
+
+
+pattern = /a[]/;
+ string = 'abc';
+ status = inSection(10);
+ actualmatch = string.match(pattern);
+ expectedmatch = null;
+ addThis();
+
+ string = '';
+ status = inSection(11);
+ actualmatch = string.match(pattern);
+ expectedmatch = null;
+ addThis();
+
+ string = 'a[';
+ status = inSection(12);
+ actualmatch = string.match(pattern);
+ expectedmatch = null;
+ addThis();
+
+ string = 'a[]';
+ status = inSection(13);
+ actualmatch = string.match(pattern);
+ expectedmatch = null;
+ addThis();
+
+ string = '[';
+ status = inSection(14);
+ actualmatch = string.match(pattern);
+ expectedmatch = null;
+ addThis();
+
+ string = ']';
+ status = inSection(15);
+ actualmatch = string.match(pattern);
+ expectedmatch = null;
+ addThis();
+
+ string = '[]';
+ status = inSection(16);
+ actualmatch = string.match(pattern);
+ expectedmatch = null;
+ addThis();
+
+ string = '[ ]';
+ status = inSection(17);
+ actualmatch = string.match(pattern);
+ expectedmatch = null;
+ addThis();
+
+ string = '][';
+ status = inSection(18);
+ actualmatch = string.match(pattern);
+ expectedmatch = null;
+ addThis();
+
+
+pattern = /[^]/;
+ string = 'abc';
+ status = inSection(19);
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('a');
+ addThis();
+
+ string = '';
+ status = inSection(20);
+ actualmatch = string.match(pattern);
+ expectedmatch = null; //there are no characters to test against the condition
+ addThis();
+
+ string = '\/';
+ status = inSection(21);
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('/');
+ addThis();
+
+ string = '\[';
+ status = inSection(22);
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('[');
+ addThis();
+
+ string = '[';
+ status = inSection(23);
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('[');
+ addThis();
+
+ string = ']';
+ status = inSection(24);
+ actualmatch = string.match(pattern);
+ expectedmatch = Array(']');
+ addThis();
+
+ string = '[]';
+ status = inSection(25);
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('[');
+ addThis();
+
+ string = '[ ]';
+ status = inSection(26);
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('[');
+ addThis();
+
+ string = '][';
+ status = inSection(27);
+ actualmatch = string.match(pattern);
+ expectedmatch = Array(']');
+ addThis();
+
+
+pattern = /a[^]/;
+ string = 'abc';
+ status = inSection(28);
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('ab');
+ addThis();
+
+ string = '';
+ status = inSection(29);
+ actualmatch = string.match(pattern);
+ expectedmatch = null; //there are no characters to test against the condition
+ addThis();
+
+ string = 'a[';
+ status = inSection(30);
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('a[');
+ addThis();
+
+ string = 'a]';
+ status = inSection(31);
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('a]');
+ addThis();
+
+ string = 'a[]';
+ status = inSection(32);
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('a[');
+ addThis();
+
+ string = 'a[ ]';
+ status = inSection(33);
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('a[');
+ addThis();
+
+ string = 'a][';
+ status = inSection(34);
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('a]');
+ addThis();
+
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusmessages[i] = status;
+ patterns[i] = pattern;
+ strings[i] = string;
+ actualmatches[i] = actualmatch;
+ expectedmatches[i] = expectedmatch;
+ i++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+ testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-103087.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-103087.js
new file mode 100644
index 0000000..8cfc662
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-103087.js
@@ -0,0 +1,155 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS"
+* basis, WITHOUT WARRANTY OF ANY KIND, either expressed
+* or implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation.
+* All Rights Reserved.
+*
+* Contributor(s): bedney@technicalpursuit.com, pschwartau@netscape.com
+* Date: 04 October 2001
+*
+* SUMMARY: Arose from Bugzilla bug 103087:
+* "The RegExp MarkupSPE in demo crashes Mozilla"
+*
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=103087
+* The SpiderMonkey shell crashed on some of these regexps.
+*
+* The reported crash was on i=24 below ('MarkupSPE' regexp)
+* I crashed on that, and also on i=43 ('XML_SPE' regexp)
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 103087;
+var summary = "Testing that we don't crash on any of these regexps -";
+var re = '';
+var lm = '';
+var lc = '';
+var rc = '';
+
+
+// the regexps are built in pieces -
+var NameStrt = "[A-Za-z_:]|[^\\x00-\\x7F]";
+var NameChar = "[A-Za-z0-9_:.-]|[^\\x00-\\x7F]";
+var Name = "(" + NameStrt + ")(" + NameChar + ")*";
+var TextSE = "[^<]+";
+var UntilHyphen = "[^-]*-";
+var Until2Hyphens = UntilHyphen + "([^-]" + UntilHyphen + ")*-";
+var CommentCE = Until2Hyphens + ">?";
+var UntilRSBs = "[^]]*]([^]]+])*]+";
+var CDATA_CE = UntilRSBs + "([^]>]" + UntilRSBs + ")*>";
+var S = "[ \\n\\t\\r]+";
+var QuoteSE = '"[^"]' + "*" + '"' + "|'[^']*'";
+var DT_IdentSE = S + Name + "(" + S + "(" + Name + "|" + QuoteSE + "))*";
+var MarkupDeclCE = "([^]\"'><]+|" + QuoteSE + ")*>";
+var S1 = "[\\n\\r\\t ]";
+var UntilQMs = "[^?]*\\?+";
+var PI_Tail = "\\?>|" + S1 + UntilQMs + "([^>?]" + UntilQMs + ")*>";
+var DT_ItemSE = "<(!(--" + Until2Hyphens + ">|[^-]" + MarkupDeclCE + ")|\\?" + Name + "(" + PI_Tail + "))|%" + Name + ";|" + S;
+var DocTypeCE = DT_IdentSE + "(" + S + ")?(\\[(" + DT_ItemSE + ")*](" + S + ")?)?>?";
+var DeclCE = "--(" + CommentCE + ")?|\\[CDATA\\[(" + CDATA_CE + ")?|DOCTYPE(" + DocTypeCE + ")?";
+var PI_CE = Name + "(" + PI_Tail + ")?";
+var EndTagCE = Name + "(" + S + ")?>?";
+var AttValSE = '"[^<"]' + "*" + '"' + "|'[^<']*'";
+var ElemTagCE = Name + "(" + S + Name + "(" + S + ")?=(" + S + ")?(" + AttValSE + "))*(" + S + ")?/?>?";
+var MarkupSPE = "<(!(" + DeclCE + ")?|\\?(" + PI_CE + ")?|/(" + EndTagCE + ")?|(" + ElemTagCE + ")?)";
+var XML_SPE = TextSE + "|" + MarkupSPE;
+var CommentRE = "<!--" + Until2Hyphens + ">";
+var CommentSPE = "<!--(" + CommentCE + ")?";
+var PI_RE = "<\\?" + Name + "(" + PI_Tail + ")";
+var Erroneous_PI_SE = "<\\?[^?]*(\\?[^>]+)*\\?>";
+var PI_SPE = "<\\?(" + PI_CE + ")?";
+var CDATA_RE = "<!\\[CDATA\\[" + CDATA_CE;
+var CDATA_SPE = "<!\\[CDATA\\[(" + CDATA_CE + ")?";
+var ElemTagSE = "<(" + NameStrt + ")([^<>\"']+|" + AttValSE + ")*>";
+var ElemTagRE = "<" + Name + "(" + S + Name + "(" + S + ")?=(" + S + ")?(" + AttValSE + "))*(" + S + ")?/?>";
+var ElemTagSPE = "<" + ElemTagCE;
+var EndTagRE = "</" + Name + "(" + S + ")?>";
+var EndTagSPE = "</(" + EndTagCE + ")?";
+var DocTypeSPE = "<!DOCTYPE(" + DocTypeCE + ")?";
+var PERef_APE = "%(" + Name + ";?)?";
+var HexPart = "x([0-9a-fA-F]+;?)?";
+var NumPart = "#([0-9]+;?|" + HexPart + ")?";
+var CGRef_APE = "&(" + Name + ";?|" + NumPart + ")?";
+var Text_PE = CGRef_APE + "|[^&]+";
+var EntityValue_PE = CGRef_APE + "|" + PERef_APE + "|[^%&]+";
+
+
+var rePatterns = new Array(AttValSE, CDATA_CE, CDATA_RE, CDATA_SPE, CGRef_APE, CommentCE, CommentRE, CommentSPE, DT_IdentSE, DT_ItemSE, DeclCE, DocTypeCE, DocTypeSPE, ElemTagCE, ElemTagRE, ElemTagSE, ElemTagSPE, EndTagCE, EndTagRE, EndTagSPE, EntityValue_PE, Erroneous_PI_SE, HexPart, MarkupDeclCE, MarkupSPE, Name, NameChar, NameStrt, NumPart, PERef_APE, PI_CE, PI_RE, PI_SPE, PI_Tail, QuoteSE, S, S1, TextSE, Text_PE, Until2Hyphens, UntilHyphen, UntilQMs, UntilRSBs, XML_SPE);
+
+
+// here's a big string to test the regexps on -
+var str = '';
+str += '<html xmlns="http://www.w3.org/1999/xhtml"' + '\n';
+str += ' xmlns:xlink="http://www.w3.org/XML/XLink/0.9">' + '\n';
+str += ' <head><title>Three Namespaces</title></head>' + '\n';
+str += ' <body>' + '\n';
+str += ' <h1 align="center">An Ellipse and a Rectangle</h1>' + '\n';
+str += ' <svg xmlns="http://www.w3.org/Graphics/SVG/SVG-19991203.dtd" ' + '\n';
+str += ' width="12cm" height="10cm">' + '\n';
+str += ' <ellipse rx="110" ry="130" />' + '\n';
+str += ' <rect x="4cm" y="1cm" width="3cm" height="6cm" />' + '\n';
+str += ' </svg>' + '\n';
+str += ' <p xlink:type="simple" xlink:href="ellipses.html">' + '\n';
+str += ' More about ellipses' + '\n';
+str += ' </p>' + '\n';
+str += ' <p xlink:type="simple" xlink:href="rectangles.html">' + '\n';
+str += ' More about rectangles' + '\n';
+str += ' </p>' + '\n';
+str += ' <hr/>' + '\n';
+str += ' <p>Last Modified February 13, 2000</p> ' + '\n';
+str += ' </body>' + '\n';
+str += '</html>';
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ for (var i=0; i<rePatterns.length; i++)
+ {
+ status = inSection(i);
+ re = new RegExp(rePatterns[i]);
+
+ // Test that we don't crash on any of these -
+ re.exec(str);
+ getResults();
+
+ // Just for the heck of it, test the current leftContext
+ re.exec(lc);
+ getResults();
+
+ // Test the current rightContext
+ re.exec(rc);
+ getResults();
+ }
+
+ exitFunc ('test');
+}
+
+
+function getResults()
+{
+ lm = RegExp.lastMatch;
+ lc = RegExp.leftContext;
+ rc = RegExp.rightContext;
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-105972.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-105972.js
new file mode 100644
index 0000000..9f0cdb5
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-105972.js
@@ -0,0 +1,136 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS"
+* basis, WITHOUT WARRANTY OF ANY KIND, either expressed
+* or implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation.
+* All Rights Reserved.
+*
+* Contributor(s): mozilla@pdavis.cx, pschwartau@netscape.com
+* Date: 22 October 2001
+*
+* SUMMARY: Regression test for Bugzilla bug 105972:
+* "/^.*?$/ will not match anything"
+*
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=105972
+*/
+//-----------------------------------------------------------------------------
+var i = 0;
+var bug = 105972;
+var summary = 'Regression test for Bugzilla bug 105972';
+var cnEmptyString = '';
+var status = '';
+var statusmessages = new Array();
+var pattern = '';
+var patterns = new Array();
+var string = '';
+var strings = new Array();
+var actualmatch = '';
+var actualmatches = new Array();
+var expectedmatch = '';
+var expectedmatches = new Array();
+
+
+/*
+ * The bug: this match was coming up null in Rhino and SpiderMonkey.
+ * It should match the whole string. The reason:
+ *
+ * The * operator is greedy, but *? is non-greedy: it will stop
+ * at the simplest match it can find. But the pattern here asks us
+ * to match till the end of the string. So the simplest match must
+ * go all the way out to the end, and *? has no choice but to do it.
+ */
+status = inSection(1);
+pattern = /^.*?$/;
+string = 'Hello World';
+actualmatch = string.match(pattern);
+expectedmatch = Array(string);
+addThis();
+
+
+/*
+ * Leave off the '$' condition - here we expect the empty string.
+ * Unlike the above pattern, we don't have to match till the end of
+ * the string, so the non-greedy operator *? doesn't try to...
+ */
+status = inSection(2);
+pattern = /^.*?/;
+string = 'Hello World';
+actualmatch = string.match(pattern);
+expectedmatch = Array(cnEmptyString);
+addThis();
+
+
+/*
+ * Try '$' combined with an 'or' operator.
+ *
+ * The operator *? will consume the string from left to right,
+ * attempting to satisfy the condition (:|$). When it hits ':',
+ * the match will stop because the operator *? is non-greedy.
+ *
+ * The submatch $1 = (:|$) will contain the ':'
+ */
+status = inSection(3);
+pattern = /^.*?(:|$)/;
+string = 'Hello: World';
+actualmatch = string.match(pattern);
+expectedmatch = Array('Hello:', ':');
+addThis();
+
+
+/*
+ * Again, '$' combined with an 'or' operator.
+ *
+ * The operator * will consume the string from left to right,
+ * attempting to satisfy the condition (:|$). When it hits ':',
+ * the match will not stop since * is greedy. The match will
+ * continue until it hits $, the end-of-string boundary.
+ *
+ * The submatch $1 = (:|$) will contain the empty string
+ * conceived to exist at the end-of-string boundary.
+ */
+status = inSection(4);
+pattern = /^.*(:|$)/;
+string = 'Hello: World';
+actualmatch = string.match(pattern);
+expectedmatch = Array(string, cnEmptyString);
+addThis();
+
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusmessages[i] = status;
+ patterns[i] = pattern;
+ strings[i] = string;
+ actualmatches[i] = actualmatch;
+ expectedmatches[i] = expectedmatch;
+ i++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+ testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-119909.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-119909.js
new file mode 100644
index 0000000..4bb2866
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-119909.js
@@ -0,0 +1,86 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2001
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): 1010mozilla@Ostermiller.com, pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 14 Jan 2002
+* SUMMARY: Shouldn't crash on regexps with many nested parentheses
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=119909
+*
+*/
+//-----------------------------------------------------------------------------
+var bug = 119909;
+var summary = "Shouldn't crash on regexps with many nested parentheses";
+var NO_BACKREFS = false;
+var DO_BACKREFS = true;
+
+
+//--------------------------------------------------
+test();
+//--------------------------------------------------
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+
+ // Changed the parameter from 500 to 200 for WebKit, because PCRE reports an error for more parentheses.
+ testThis(200, NO_BACKREFS, 'hello', 'goodbye');
+ testThis(200, DO_BACKREFS, 'hello', 'goodbye');
+
+ exitFunc('test');
+}
+
+
+/*
+ * Creates a regexp pattern like (((((((((hello)))))))))
+ * and tests str.search(), str.match(), str.replace()
+ */
+function testThis(numParens, doBackRefs, strOriginal, strReplace)
+{
+ var openParen = doBackRefs? '(' : '(?:';
+ var closeParen = ')';
+ var pattern = '';
+
+ for (var i=0; i<numParens; i++) {pattern += openParen;}
+ pattern += strOriginal;
+ for (i=0; i<numParens; i++) {pattern += closeParen;}
+ var re = new RegExp(pattern);
+
+ var res = strOriginal.search(re);
+ res = strOriginal.match(re);
+ res = strOriginal.replace(re, strReplace);
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-122076.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-122076.js
new file mode 100644
index 0000000..ed2afc3
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-122076.js
@@ -0,0 +1,103 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2002
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 12 Feb 2002
+* SUMMARY: Don't crash on invalid regexp literals / \\/ /
+*
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=122076
+* The function checkURL() below sometimes caused a compile-time error:
+*
+* SyntaxError: unterminated parenthetical (:
+*
+* However, sometimes it would cause a crash instead. The presence of
+* other functions below is merely fodder to help provoke the crash.
+* The constant |STRESS| is number of times we'll try to crash on this.
+*
+*/
+//-----------------------------------------------------------------------------
+var bug = 122076;
+var summary = "Don't crash on invalid regexp literals / \\/ /";
+var STRESS = 10;
+var sEval = '';
+
+printBugNumber(bug);
+printStatus(summary);
+
+
+sEval += 'function checkDate()'
+sEval += '{'
+sEval += 'return (this.value.search(/^[012]?\d\/[0123]?\d\/[0]\d$/) != -1);'
+sEval += '}'
+
+sEval += 'function checkDNSName()'
+sEval += '{'
+sEval += ' return (this.value.search(/^([\w\-]+\.)+([\w\-]{2,3})$/) != -1);'
+sEval += '}'
+
+sEval += 'function checkEmail()'
+sEval += '{'
+sEval += ' return (this.value.search(/^([\w\-]+\.)*[\w\-]+@([\w\-]+\.)+([\w\-]{2,3})$/) != -1);'
+sEval += '}'
+
+sEval += 'function checkHostOrIP()'
+sEval += '{'
+sEval += ' if (this.value.search(/^([\w\-]+\.)+([\w\-]{2,3})$/) == -1)'
+sEval += ' return (this.value.search(/^[1-2]?\d{1,2}\.[1-2]?\d{1,2}\.[1-2]?\d{1,2}\.[1-2]?\d{1,2}$/) != -1);'
+sEval += ' else'
+sEval += ' return true;'
+sEval += '}'
+
+sEval += 'function checkIPAddress()'
+sEval += '{'
+sEval += ' return (this.value.search(/^[1-2]?\d{1,2}\.[1-2]?\d{1,2}\.[1-2]?\d{1,2}\.[1-2]?\d{1,2}$/) != -1);'
+sEval += '}'
+
+sEval += 'function checkURL()'
+sEval += '{'
+sEval += ' return (this.value.search(/^(((https?)|(ftp)):\/\/([\-\w]+\.)+\w{2,4}(\/[%\-\w]+(\.\w{2,})?)*(([\w\-\.\?\\/\*\$+@&#;`~=%!]*)(\.\w{2,})?)*\/?)$/) != -1);'
+sEval += '}'
+
+
+for (var i=0; i<STRESS; i++)
+{
+ try
+ {
+ eval(sEval);
+ }
+ catch(e)
+ {
+ }
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-123437.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-123437.js
new file mode 100644
index 0000000..77194fe
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-123437.js
@@ -0,0 +1,107 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2002
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): waldemar, rogerl, pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 04 Feb 2002
+* SUMMARY: regexp backreferences must hold |undefined| if not used
+*
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=123437 (SpiderMonkey)
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=123439 (Rhino)
+*
+*/
+//-----------------------------------------------------------------------------
+var i = 0;
+var bug = 123437;
+var summary = 'regexp backreferences must hold |undefined| if not used';
+var status = '';
+var statusmessages = new Array();
+var pattern = '';
+var patterns = new Array();
+var string = '';
+var strings = new Array();
+var actualmatch = '';
+var actualmatches = new Array();
+var expectedmatch = '';
+var expectedmatches = new Array();
+
+
+pattern = /(a)?a/;
+string = 'a';
+status = inSection(1);
+actualmatch = string.match(pattern);
+expectedmatch = Array('a', undefined);
+addThis();
+
+pattern = /a|(b)/;
+string = 'a';
+status = inSection(2);
+actualmatch = string.match(pattern);
+expectedmatch = Array('a', undefined);
+addThis();
+
+pattern = /(a)?(a)/;
+string = 'a';
+status = inSection(3);
+actualmatch = string.match(pattern);
+expectedmatch = Array('a', undefined, 'a');
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusmessages[i] = status;
+ patterns[i] = pattern;
+ strings[i] = string;
+ actualmatches[i] = actualmatch;
+ expectedmatches[i] = expectedmatch;
+ i++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+ testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-165353.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-165353.js
new file mode 100644
index 0000000..10a235f
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-165353.js
@@ -0,0 +1,117 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2002
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): franky@pacificconnections.com, pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 31 August 2002
+* SUMMARY: RegExp conformance test
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=165353
+*
+*/
+//-----------------------------------------------------------------------------
+var i = 0;
+var bug = 165353;
+var summary = 'RegExp conformance test';
+var status = '';
+var statusmessages = new Array();
+var pattern = '';
+var patterns = new Array();
+var string = '';
+var strings = new Array();
+var actualmatch = '';
+var actualmatches = new Array();
+var expectedmatch = '';
+var expectedmatches = new Array();
+
+
+pattern = /^([a-z]+)*[a-z]$/;
+ status = inSection(1);
+ string = 'a';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('a', undefined);
+ addThis();
+
+ status = inSection(2);
+ string = 'ab';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('ab', 'a');
+ addThis();
+
+ status = inSection(3);
+ string = 'abc';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('abc', 'ab');
+ addThis();
+
+
+string = 'www.netscape.com';
+ status = inSection(4);
+ pattern = /^(([a-z]+)*[a-z]\.)+[a-z]{2,}$/;
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('www.netscape.com', 'netscape.', 'netscap');
+ addThis();
+
+ // add one more capturing parens to the previous regexp -
+ status = inSection(5);
+ pattern = /^(([a-z]+)*([a-z])\.)+[a-z]{2,}$/;
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('www.netscape.com', 'netscape.', 'netscap', 'e');
+ addThis();
+
+
+
+//-------------------------------------------------------------------------------------------------
+test();
+//-------------------------------------------------------------------------------------------------
+
+
+function addThis()
+{
+ statusmessages[i] = status;
+ patterns[i] = pattern;
+ strings[i] = string;
+ actualmatches[i] = actualmatch;
+ expectedmatches[i] = expectedmatch;
+ i++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+ testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-169497.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-169497.js
new file mode 100644
index 0000000..0069bfd
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-169497.js
@@ -0,0 +1,100 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2002
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): martin.honnen@t-online.de, pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 31 August 2002
+* SUMMARY: RegExp conformance test
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=169497
+*
+*/
+//-----------------------------------------------------------------------------
+var i = 0;
+var bug = 169497;
+var summary = 'RegExp conformance test';
+var status = '';
+var statusmessages = new Array();
+var pattern = '';
+var patterns = new Array();
+var sBody = '';
+var sHTML = '';
+var string = '';
+var strings = new Array();
+var actualmatch = '';
+var actualmatches = new Array();
+var expectedmatch = '';
+var expectedmatches = new Array();
+
+sBody += '<body onXXX="alert(event.type);">\n';
+sBody += '<p>Kibology for all<\/p>\n';
+sBody += '<p>All for Kibology<\/p>\n';
+sBody += '<\/body>';
+
+sHTML += '<html>\n';
+sHTML += sBody;
+sHTML += '\n<\/html>';
+
+status = inSection(1);
+string = sHTML;
+pattern = /<body.*>((.*\n?)*?)<\/body>/i;
+actualmatch = string.match(pattern);
+expectedmatch = Array(sBody, '\n<p>Kibology for all</p>\n<p>All for Kibology</p>\n', '<p>All for Kibology</p>\n');
+addThis();
+
+
+
+//-------------------------------------------------------------------------------------------------
+test();
+//-------------------------------------------------------------------------------------------------
+
+
+function addThis()
+{
+ statusmessages[i] = status;
+ patterns[i] = pattern;
+ strings[i] = string;
+ actualmatches[i] = actualmatch;
+ expectedmatches[i] = expectedmatch;
+ i++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+ testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-169534.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-169534.js
new file mode 100644
index 0000000..c29d11e
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-169534.js
@@ -0,0 +1,90 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2002
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 20 Sep 2002
+* SUMMARY: RegExp conformance test
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=169534
+*
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 169534;
+var summary = 'RegExp conformance test';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+status = inSection(1);
+var re = /(\|)([\w\x81-\xff ]*)(\|)([\/a-z][\w:\/\.]*\.[a-z]{3,4})(\|)/ig;
+var str = "To sign up click |here|https://www.xxxx.org/subscribe.htm|";
+actual = str.replace(re, '<a href="$4">$2</a>');
+expect = 'To sign up click <a href="https://www.xxxx.org/subscribe.htm">here</a>';
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-187133.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-187133.js
new file mode 100644
index 0000000..bffcda8
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-187133.js
@@ -0,0 +1,137 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2003
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): ji_bo@yahoo.com, pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 06 January 2003
+* SUMMARY: RegExp conformance test
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=187133
+*
+* The tests here employ the regular expression construct:
+*
+* (?!pattern)
+*
+* This is a "zero-width lookahead negative assertion".
+* From the Perl documentation:
+*
+* For example, /foo(?!bar)/ matches any occurrence
+* of 'foo' that isn't followed by 'bar'.
+*
+* It is "zero-width" means that it does not consume any characters and that
+* the parens are non-capturing. A non-null match array in the example above
+* will have only have length 1, not 2.
+*
+*/
+//-----------------------------------------------------------------------------
+var i = 0;
+var bug = 187133;
+var summary = 'RegExp conformance test';
+var status = '';
+var statusmessages = new Array();
+var pattern = '';
+var patterns = new Array();
+var string = '';
+var strings = new Array();
+var actualmatch = '';
+var actualmatches = new Array();
+var expectedmatch = '';
+var expectedmatches = new Array();
+
+
+pattern = /(\.(?!com|org)|\/)/;
+ status = inSection(1);
+ string = 'ah.info';
+ actualmatch = string.match(pattern);
+ expectedmatch = ['.', '.'];
+ addThis();
+
+ status = inSection(2);
+ string = 'ah/info';
+ actualmatch = string.match(pattern);
+ expectedmatch = ['/', '/'];
+ addThis();
+
+ status = inSection(3);
+ string = 'ah.com';
+ actualmatch = string.match(pattern);
+ expectedmatch = null;
+ addThis();
+
+
+pattern = /(?!a|b)|c/;
+ status = inSection(4);
+ string = '';
+ actualmatch = string.match(pattern);
+ expectedmatch = [''];
+ addThis();
+
+ status = inSection(5);
+ string = 'bc';
+ actualmatch = string.match(pattern);
+ expectedmatch = [''];
+ addThis();
+
+ status = inSection(6);
+ string = 'd';
+ actualmatch = string.match(pattern);
+ expectedmatch = [''];
+ addThis();
+
+
+
+
+//-------------------------------------------------------------------------------------------------
+test();
+//-------------------------------------------------------------------------------------------------
+
+
+function addThis()
+{
+ statusmessages[i] = status;
+ patterns[i] = pattern;
+ strings[i] = string;
+ actualmatches[i] = actualmatch;
+ expectedmatches[i] = expectedmatch;
+ i++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+ testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-188206.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-188206.js
new file mode 100644
index 0000000..6fae0e1
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-188206.js
@@ -0,0 +1,282 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2003
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): scole@planetweb.com, pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 21 January 2003
+* SUMMARY: Invalid use of regexp quantifiers should generate SyntaxErrors
+*
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=188206
+* and http://bugzilla.mozilla.org/show_bug.cgi?id=85721#c48 etc.
+* and http://bugzilla.mozilla.org/show_bug.cgi?id=190685
+* and http://bugzilla.mozilla.org/show_bug.cgi?id=197451
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 188206;
+var summary = 'Invalid use of regexp quantifiers should generate SyntaxErrors';
+var TEST_PASSED = 'SyntaxError';
+var TEST_FAILED = 'Generated an error, but NOT a SyntaxError!';
+var TEST_FAILED_BADLY = 'Did not generate ANY error!!!';
+var CHECK_PASSED = 'Should not generate an error';
+var CHECK_FAILED = 'Generated an error!';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+/*
+ * All the following are invalid uses of regexp quantifiers and
+ * should generate SyntaxErrors. That's what we're testing for.
+ *
+ * To allow the test to compile and run, we have to hide the errors
+ * inside eval strings, and check they are caught at run-time -
+ *
+ */
+status = inSection(1);
+testThis(' /a**/ ');
+
+status = inSection(2);
+testThis(' /a***/ ');
+
+status = inSection(3);
+testThis(' /a++/ ');
+
+status = inSection(4);
+testThis(' /a+++/ ');
+
+/*
+ * The ? quantifier, unlike * or +, may appear twice in succession.
+ * Thus we need at least three in a row to provoke a SyntaxError -
+ */
+
+status = inSection(5);
+testThis(' /a???/ ');
+
+status = inSection(6);
+testThis(' /a????/ ');
+
+
+/*
+ * Now do some weird things on the left side of the regexps -
+ */
+status = inSection(7);
+testThis(' /*a/ ');
+
+status = inSection(8);
+testThis(' /**a/ ');
+
+status = inSection(9);
+testThis(' /+a/ ');
+
+status = inSection(10);
+testThis(' /++a/ ');
+
+status = inSection(11);
+testThis(' /?a/ ');
+
+status = inSection(12);
+testThis(' /??a/ ');
+
+
+/*
+ * Misusing the {DecmalDigits} quantifier - according to ECMA,
+ * but not according to Perl.
+ *
+ * ECMA-262 Edition 3 prohibits the use of unescaped braces in
+ * regexp patterns, unless they form part of a quantifier.
+ *
+ * Hovever, Perl does not prohibit this. If not used as part
+ * of a quantifer, Perl treats braces literally.
+ *
+ * We decided to follow Perl on this for backward compatibility.
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=190685.
+ *
+ * Therefore NONE of the following ECMA violations should generate
+ * a SyntaxError. Note we use checkThis() instead of testThis().
+ */
+status = inSection(13);
+checkThis(' /a*{/ ');
+
+status = inSection(14);
+checkThis(' /a{}/ ');
+
+status = inSection(15);
+checkThis(' /{a/ ');
+
+status = inSection(16);
+checkThis(' /}a/ ');
+
+status = inSection(17);
+checkThis(' /x{abc}/ ');
+
+status = inSection(18);
+checkThis(' /{{0}/ ');
+
+status = inSection(19);
+checkThis(' /{{1}/ ');
+
+status = inSection(20);
+checkThis(' /x{{0}/ ');
+
+status = inSection(21);
+checkThis(' /x{{1}/ ');
+
+status = inSection(22);
+checkThis(' /x{{0}}/ ');
+
+status = inSection(23);
+checkThis(' /x{{1}}/ ');
+
+status = inSection(24);
+checkThis(' /x{{0}}/ ');
+
+status = inSection(25);
+checkThis(' /x{{1}}/ ');
+
+status = inSection(26);
+checkThis(' /x{{0}}/ ');
+
+status = inSection(27);
+checkThis(' /x{{1}}/ ');
+
+
+/*
+ * Misusing the {DecmalDigits} quantifier - according to BOTH ECMA and Perl.
+ *
+ * Just as with the * and + quantifiers above, can't have two {DecmalDigits}
+ * quantifiers in succession - it's a SyntaxError.
+ */
+status = inSection(28);
+testThis(' /x{1}{1}/ ');
+
+status = inSection(29);
+testThis(' /x{1,}{1}/ ');
+
+status = inSection(30);
+testThis(' /x{1,2}{1}/ ');
+
+status = inSection(31);
+testThis(' /x{1}{1,}/ ');
+
+status = inSection(32);
+testThis(' /x{1,}{1,}/ ');
+
+status = inSection(33);
+testThis(' /x{1,2}{1,}/ ');
+
+status = inSection(34);
+testThis(' /x{1}{1,2}/ ');
+
+status = inSection(35);
+testThis(' /x{1,}{1,2}/ ');
+
+status = inSection(36);
+testThis(' /x{1,2}{1,2}/ ');
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+/*
+ * Invalid syntax should generate a SyntaxError
+ */
+function testThis(sInvalidSyntax)
+{
+ expect = TEST_PASSED;
+ actual = TEST_FAILED_BADLY;
+
+ try
+ {
+ eval(sInvalidSyntax);
+ }
+ catch(e)
+ {
+ if (e instanceof SyntaxError)
+ actual = TEST_PASSED;
+ else
+ actual = TEST_FAILED;
+ }
+
+ statusitems[UBound] = status;
+ expectedvalues[UBound] = expect;
+ actualvalues[UBound] = actual;
+ UBound++;
+}
+
+
+/*
+ * Allowed syntax shouldn't generate any errors
+ */
+function checkThis(sAllowedSyntax)
+{
+ expect = CHECK_PASSED;
+ actual = CHECK_PASSED;
+
+ try
+ {
+ eval(sAllowedSyntax);
+ }
+ catch(e)
+ {
+ actual = CHECK_FAILED;
+ }
+
+ statusitems[UBound] = status;
+ expectedvalues[UBound] = expect;
+ actualvalues[UBound] = actual;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-191479.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-191479.js
new file mode 100644
index 0000000..a3d8b39
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-191479.js
@@ -0,0 +1,193 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2003
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): flying@dom.natm.ru, pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 31 January 2003
+* SUMMARY: Testing regular expressions of form /(x|y){n,}/
+*
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=191479
+*
+*/
+//-----------------------------------------------------------------------------
+var i = 0;
+var bug = 191479;
+var summary = 'Testing regular expressions of form /(x|y){n,}/';
+var status = '';
+var statusmessages = new Array();
+var pattern = '';
+var patterns = new Array();
+var string = '';
+var strings = new Array();
+var actualmatch = '';
+var actualmatches = new Array();
+var expectedmatch = '';
+var expectedmatches = new Array();
+
+
+status = inSection(1);
+string = '12 3 45';
+pattern = /(\d|\d\s){2,}/;
+actualmatch = string.match(pattern);
+expectedmatch = Array('12', '2');
+addThis();
+
+status = inSection(2);
+string = '12 3 45';
+pattern = /(\d|\d\s){4,}/;
+actualmatch = string.match(pattern);
+expectedmatch = Array(string, '5');
+addThis();
+
+status = inSection(3);
+string = '12 3 45';
+pattern = /(\d|\d\s)+/;
+actualmatch = string.match(pattern);
+expectedmatch = Array('12', '2');
+addThis();
+
+status = inSection(4);
+string = '12 3 45';
+pattern = /(\d\s?){4,}/;
+actualmatch = string.match(pattern);
+expectedmatch = Array(string, '5');
+addThis();
+
+/*
+ * Let's reverse the operands in Sections 1-3 above -
+ */
+status = inSection(5);
+string = '12 3 45';
+pattern = /(\d\s|\d){2,}/;
+actualmatch = string.match(pattern);
+expectedmatch = Array(string, '5');
+addThis();
+
+status = inSection(6);
+string = '12 3 45';
+pattern = /(\d\s|\d){4,}/;
+actualmatch = string.match(pattern);
+expectedmatch = Array(string, '5');
+addThis();
+
+status = inSection(7);
+string = '12 3 45';
+pattern = /(\d\s|\d)+/;
+actualmatch = string.match(pattern);
+expectedmatch = Array(string, '5');
+addThis();
+
+
+/*
+ * Let's take all 7 sections above and make each quantifer non-greedy.
+ *
+ * This is done by appending ? to it. It doesn't change the meaning of
+ * the quantifier, but makes it non-greedy, which affects the results -
+ */
+status = inSection(8);
+string = '12 3 45';
+pattern = /(\d|\d\s){2,}?/;
+actualmatch = string.match(pattern);
+expectedmatch = Array('12', '2');
+addThis();
+
+status = inSection(9);
+string = '12 3 45';
+pattern = /(\d|\d\s){4,}?/;
+actualmatch = string.match(pattern);
+expectedmatch = Array('12 3 4', '4');
+addThis();
+
+status = inSection(10);
+string = '12 3 45';
+pattern = /(\d|\d\s)+?/;
+actualmatch = string.match(pattern);
+expectedmatch = Array('1', '1');
+addThis();
+
+status = inSection(11);
+string = '12 3 45';
+pattern = /(\d\s?){4,}?/;
+actualmatch = string.match(pattern);
+expectedmatch = Array('12 3 4', '4');
+addThis();
+
+status = inSection(12);
+string = '12 3 45';
+pattern = /(\d\s|\d){2,}?/;
+actualmatch = string.match(pattern);
+expectedmatch = Array('12 ', '2 ');
+addThis();
+
+status = inSection(13);
+string = '12 3 45';
+pattern = /(\d\s|\d){4,}?/;
+actualmatch = string.match(pattern);
+expectedmatch = Array('12 3 4', '4');
+addThis();
+
+status = inSection(14);
+string = '12 3 45';
+pattern = /(\d\s|\d)+?/;
+actualmatch = string.match(pattern);
+expectedmatch = Array('1', '1');
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusmessages[i] = status;
+ patterns[i] = pattern;
+ strings[i] = string;
+ actualmatches[i] = actualmatch;
+ expectedmatches[i] = expectedmatch;
+ i++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+ testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-202564.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-202564.js
new file mode 100644
index 0000000..14722c3
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-202564.js
@@ -0,0 +1,96 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2003
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): drbrain-bugzilla@segment7.net, pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 18 April 2003
+* SUMMARY: Testing regexp with many backreferences
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=202564
+*
+* Note that in Section 1 below, we expect the 1st and 4th backreferences
+* to hold |undefined| instead of the empty strings one gets in Perl and IE6.
+* This is because per ECMA, regexp backreferences must hold |undefined|
+* if not used. See http://bugzilla.mozilla.org/show_bug.cgi?id=123437.
+*
+*/
+//-----------------------------------------------------------------------------
+var i = 0;
+var bug = 202564;
+var summary = 'Testing regexp with many backreferences';
+var status = '';
+var statusmessages = new Array();
+var pattern = '';
+var patterns = new Array();
+var string = '';
+var strings = new Array();
+var actualmatch = '';
+var actualmatches = new Array();
+var expectedmatch = '';
+var expectedmatches = new Array();
+
+
+status = inSection(1);
+string = 'Seattle, WA to Buckley, WA';
+pattern = /(?:(.+), )?(.+), (..) to (?:(.+), )?(.+), (..)/;
+actualmatch = string.match(pattern);
+expectedmatch = Array(string, undefined, "Seattle", "WA", undefined, "Buckley", "WA");
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusmessages[i] = status;
+ patterns[i] = pattern;
+ strings[i] = string;
+ actualmatches[i] = actualmatch;
+ expectedmatches[i] = expectedmatch;
+ i++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+ testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-209067.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-209067.js
new file mode 100644
index 0000000..ba4c1e1
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-209067.js
@@ -0,0 +1,1101 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2003
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 12 June 2003
+* SUMMARY: Testing complicated str.replace()
+*
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=209067
+*
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 209067;
+var summary = 'Testing complicated str.replace()';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+function formatHTML(h)
+{
+ // a replace function used in the succeeding lines -
+ function S(s)
+ {
+ return s.replace(/</g,'&lt;').replace(/>/g,'&gt;');
+ }
+
+ h+='\n';
+ h=h.replace(/&([^\s]+;)/g,'&lt;&amp;$1&gt;');
+ h=h.replace(new RegExp('<!-'+'-[\\s\\S]*-'+'->','g'), S);
+ h=h.replace(/"[^"]*"/g,S);
+ h=h.replace(/'[^']*'/g,S);
+
+
+ h=h.replace(/<([^>]*)>/g,
+ function(s,p)
+ {
+ if(s.match(/!doctype/i))
+ return'<span class=doctype>&lt;' + p + '&gt;</span>';
+
+ p=p.replace(/\\'/g,'\\&#39;').replace(/\\"/g,'\\&#34;').replace(/^\s/,'');
+ p=p.replace(/(\s)([^<]+)$/g,
+ function(s,p1,p2)
+ {
+ p2=p2.replace(/(=)(\s*[^"'][^\s]*)(\s|$)/g,'$1<span class=attribute-value>$2</span>$3');
+ p2=p2.replace(/("[^"]*")/g,'<span class=attribute-value>$1</span>');
+ p2=p2.replace(/('[^']*')/g,'<span class=attribute-value>$1</span>');
+ return p1 + '<span class=attribute-name>'+p2+'</span>';
+ }
+ )
+
+ return'&lt;<span class=' + (s.match(/<\s*\//)?'end-tag':'start-tag') + '>' + p + '</span>&gt;';
+ }
+ )
+
+
+ h=h.replace(/&lt;(&[^\s]+;)&gt;/g,'<span class=entity>$1</span>');
+ h=h.replace(/(&lt;!--[\s\S]*--&gt;)/g,'<span class=comment>$1</span>');
+
+
+ numer=1;
+ h=h.replace(/(.*\n)/g,
+ function(s,p)
+ {
+ return (numer++) +'. ' + p;
+ }
+ )
+
+
+ return'<span class=text>' + h + '</span>';
+}
+
+
+
+/*
+ * sanity check
+ */
+status = inSection(1);
+actual = formatHTML('abc');
+expect = '<span class=text>1. abc\n</span>';
+addThis();
+
+
+/*
+ * The real test: can we run this without crashing?
+ * We are not validating the result, just running it.
+ */
+status = inSection(2);
+var HUGE_TEST_STRING = hugeString();
+formatHTML(HUGE_TEST_STRING);
+
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
+
+
+function hugeString()
+{
+var s = '';
+
+s += '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">';
+s += '<html lang="en">';
+s += '<head>';
+s += ' <meta http-equiv="content-type" content="text/html; charset=iso-8859-1">';
+s += ' <meta http-equiv="refresh" content="1800">';
+s += ' <title>CNN.com</title>';
+s += ' <link rel="Start" href="/">';
+s += ' <link rel="Search" href="/search/">';
+s += ' <link rel="stylesheet" href="http://i.cnn.net/cnn/.element/ssi/css/1.0/main.css" type="text/css">';
+s += ' <script language="JavaScript1.2" src="http://i.cnn.net/cnn/.element/ssi/js/1.0/main.js" type="text/javascript"></script>';
+s += '<script language="JavaScript1.1" src="http://ar.atwola.com/file/adsWrapper.js"></script>';
+s += '<style type="text/css">';
+s += '<!--';
+s += '.aoltextad { text-align: justify; font-size: 12px; color: black; font-family: Georgia, sans-serif }';
+s += '-->';
+s += '</style>';
+s += '<script language="JavaScript1.1" type="text/javascript" src="http://ar.atwola.com/file/adsPopup2.js"></script>';
+s += '<script language="JavaScript">';
+s += 'document.adoffset = 0;';
+s += 'document.adPopupDomain = "www.cnn.com";';
+s += 'document.adPopupFile = "/cnn_adspaces/adsPopup2.html";';
+s += 'document.adPopupInterval = "P24";';
+s += 'document.adPopunderInterval = "P24";';
+s += 'adSetOther("&TVAR="+escape("class=us.low"));';
+s += '</script>';
+s += '';
+s += ' ';
+s += '</head>';
+s += '<body class="cnnMainPage">';
+s += '';
+s += '';
+s += '';
+s += '<a name="top_of_page"></a>';
+s += '<a href="#ContentArea"><img src="http://i.cnn.net/cnn/images/1.gif" alt="Click here to skip to main content." width="10" height="1" border="0" align="right"></a>';
+s += '<table width="770" border="0" cellpadding="0" cellspacing="0" style="speak: none">';
+s += ' <col width="229">';
+s += ' <col width="73">';
+s += ' <col width="468">';
+s += ' <tr>';
+s += ' <td colspan="3"><!--';
+s += '[[!~~ netscape hat ~~]][[table border="0" cellpadding="0" cellspacing="0" width="100%"]][[tr]][[td]][[script Language="Javascript" SRC="http://toolbar.aol.com/dashboard.twhat?dom=cnn" type="text/javascript"]][[/script]][[/td]][[/tr]][[/table]]';
+s += '';
+s += '[[div]][[img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="2" border="0"]][[/div]]';
+s += '-->';
+s += ' </td>';
+s += ' </tr>';
+s += ' <tr valign="bottom">';
+s += ' <td width="229" style="speak: normal"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/logo/cnn.gif" alt="CNN.com" width="229" height="52" border="0"></td>';
+s += ' <td width="73"></td>';
+s += ' <td width="468" align="right">';
+s += ' <!-- home/bottom.468x60 -->';
+s += '<script language="JavaScript1.1">';
+s += '<!--';
+s += 'adSetTarget("_top");';
+s += 'htmlAdWH( (new Array(93103287,93103287,93103300,93103300))[document.adoffset||0] , 468, 60);';
+s += '//-->';
+s += '</script>';
+s += '<noscript><a href="http://ar.atwola.com/link/93103287/aol" target="_top"><img src="http://ar.atwola.com/image/93103287/aol" alt="Click Here" width="468" height="60" border="0"></a></noscript> ';
+s += '';
+s += '';
+s += '';
+s += '';
+s += ' </td>';
+s += ' </tr>';
+s += ' <tr><td colspan="3"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="2"></td></tr>';
+s += ' <tr>';
+s += ' <td colspan="3">';
+s += '</td>';
+s += ' </tr>';
+s += ' <tr><td colspan="3" bgcolor="#CC0000"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="3"></td></tr>';
+s += ' <tr>';
+s += ' <td colspan="3">';
+s += '';
+s += '<table width="770" border="0" cellpadding="0" cellspacing="0">';
+s += ' <form action="http://search.cnn.com/cnn/search" method="get" onsubmit="return CNN_validateSearchForm(this);">';
+s += '<input type="hidden" name="source" value="cnn">';
+s += '<input type="hidden" name="invocationType" value="search/top">';
+s += ' <tr><td colspan="4"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="1" border="0"></td></tr>';
+s += ' <tr><td colspan="4" bgcolor="#003366"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="3" border="0"></td></tr>';
+s += ' <tr>';
+s += ' <td rowspan="2"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/searchbar/bar.search.gif" alt="SEARCH" width="110" height="27" border="0"></td>';
+s += ' <td colspan="2"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/searchbar/bar.top.bevel.gif" alt="" width="653" height="3" border="0"></td>';
+s += ' <td rowspan="2"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/searchbar/bar.right.bevel.gif" alt="" width="7" height="27" border="0"></td>';
+s += ' </tr>';
+s += ' <tr bgcolor="#B6D8E0">';
+s += ' <td><table border="0" cellpadding="0" cellspacing="0">';
+s += ' <tr>';
+s += ' <td>&nbsp;&nbsp;</td>';
+s += ' <td nowrap><span class="cnnFormTextB" style="color:#369">The Web</span></td>';
+s += ' <td><input type="radio" name="sites" value="google" checked></td>';
+s += ' <td>&nbsp;&nbsp;</td>';
+s += ' <td><span class="cnnFormTextB" style="color:#369;">CNN.com</span></td>';
+s += ' <td><input type="radio" name="sites" value="cnn"></td>';
+s += ' <td>&nbsp;&nbsp;</td>';
+s += ' <td><input type="text" name="query" class="cnnFormText" value="" title="Enter text to search for and click Search" size="35" maxlength="40" style="width: 280px"></td>';
+s += ' <td>&nbsp;<input type="Submit" value="Search" class="cnnNavButton" style="padding: 0px; margin: 0px; width: 50px"></td>';
+s += ' </tr>';
+s += ' </table></td>';
+s += ' <td align="right"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/searchbar/bar.google.gif" alt="enhanced by Google" width="137" height="24" border="0"></td>';
+s += ' </tr>';
+s += ' <tr><td colspan="4"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/searchbar/bar.bottom.bevel.gif" alt="" width="770" height="3" border="0"></td></tr>';
+s += ' </form>';
+s += '</table>';
+s += ' </td>';
+s += ' </tr>';
+s += '';
+s += '';
+s += '</table>';
+s += '';
+s += '<table width="770" border="0" cellpadding="0" cellspacing="0">';
+s += ' <col width="126" align="left" valign="top">';
+s += ' <col width="10">';
+s += ' <col width="280">';
+s += ' <col width="10">';
+s += ' <col width="344">';
+s += ' <tr valign="top">';
+s += ' <td rowspan="5" width="126" style="speak: none"><table id="cnnNavBar" width="126" bgcolor="#EEEEEE" border="0" cellpadding="0" cellspacing="0" summary="CNN.com Navigation">';
+s += ' <col width="8" align="left" valign="top">';
+s += ' <col width="118" align="left" valign="top">';
+s += ' <tr bgcolor="#CCCCCC" class="cnnNavHiliteRow"><td width="8" class="swath">&nbsp;</td>';
+s += ' <td class="cnnNavHilite" onClick="CNN_goTo("/")"><div class="cnnNavText"><a href="/">Home Page</a></div></td></tr>';
+s += ' <tr class="cnnNavRow"><td class="swath">&nbsp;</td>';
+s += ' <td class="cnnNav" onMouseOver="CNN_navBar(this,1,1)" onMouseOut="CNN_navBar(this,0,1)" onClick="CNN_navBarClick(this,1,"/WORLD/")"><div class="cnnNavText"><a href="/WORLD/">World</a></div></td></tr>';
+s += ' <tr class="cnnNavRow"><td class="swath">&nbsp;</td>';
+s += ' <td class="cnnNav" onMouseOver="CNN_navBar(this,1,1)" onMouseOut="CNN_navBar(this,0,1)" onClick="CNN_navBarClick(this,1,"/US/")"><div class="cnnNavText"><a href="/US/">U.S.</a></div></td></tr>';
+s += ' <tr class="cnnNavRow"><td class="swath">&nbsp;</td>';
+s += ' <td class="cnnNav" onMouseOver="CNN_navBar(this,1,1)" onMouseOut="CNN_navBar(this,0,1)" onClick="CNN_navBarClick(this,1,"/WEATHER/")"><div class="cnnNavText"><a href="/WEATHER/">Weather</a></div></td></tr>';
+s += ' <tr class="cnnNavRow"><td class="swath">&nbsp;</td>';
+s += ' <td class="cnnNav" onMouseOver="CNN_navBar(this,1,1)" onMouseOut="CNN_navBar(this,0,1)" onClick="CNN_navBarClick(this,1,"/money/")"><div class="cnnNavText"><a href="/money/">Business</a>&nbsp;<a href="/money/"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/nav_at_money.gif" alt="at CNN/Money" width="51" height="5" border="0"></a></div></td></tr>';
+s += ' <tr class="cnnNavRow"><td class="swath">&nbsp;</td>';
+s += ' <td class="cnnNav" onMouseOver="CNN_navBar(this,1,1)" onMouseOut="CNN_navBar(this,0,1)" onClick="CNN_navBarClick(this,1,"/cnnsi/")"><div class="cnnNavText"><a href="/si/">Sports</a>&nbsp;<a href="/si/"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/nav_at_si.gif" alt="at SI.com" width="50" height="5" border="0"></a></div></td></tr>';
+s += ' <tr class="cnnNavRow"><td class="swath">&nbsp;</td>';
+s += ' <td class="cnnNav" onMouseOver="CNN_navBar(this,1,1)" onMouseOut="CNN_navBar(this,0,1)" onClick="CNN_navBarClick(this,1,"/ALLPOLITICS/")"><div class="cnnNavText"><a href="/ALLPOLITICS/">Politics</a></div></td></tr>';
+s += ' <tr class="cnnNavRow"><td class="swath">&nbsp;</td>';
+s += ' <td class="cnnNav" onMouseOver="CNN_navBar(this,1,1)" onMouseOut="CNN_navBar(this,0,1)" onClick="CNN_navBarClick(this,1,"/LAW/")"><div class="cnnNavText"><a href="/LAW/">Law</a></div></td></tr>';
+s += ' <tr class="cnnNavRow"><td class="swath">&nbsp;</td>';
+s += ' <td class="cnnNav" onMouseOver="CNN_navBar(this,1,1)" onMouseOut="CNN_navBar(this,0,1)" onClick="CNN_navBarClick(this,1,"/TECH/")"><div class="cnnNavText"><a href="/TECH/">Technology</a></div></td></tr>';
+s += ' <tr class="cnnNavRow"><td class="swath">&nbsp;</td>';
+s += ' <td class="cnnNav" onMouseOver="CNN_navBar(this,1,1)" onMouseOut="CNN_navBar(this,0,1)" onClick="CNN_navBarClick(this,1,"/TECH/space/")"><div class="cnnNavText"><a href="/TECH/space/">Science &amp; Space</a></div></td></tr>';
+s += ' <tr class="cnnNavRow"><td class="swath">&nbsp;</td>';
+s += ' <td class="cnnNav" onMouseOver="CNN_navBar(this,1,1)" onMouseOut="CNN_navBar(this,0,1)" onClick="CNN_navBarClick(this,1,"/HEALTH/")"><div class="cnnNavText"><a href="/HEALTH/">Health</a></div></td></tr>';
+s += ' <tr class="cnnNavRow"><td class="swath">&nbsp;</td>';
+s += ' <td class="cnnNav" onMouseOver="CNN_navBar(this,1,1)" onMouseOut="CNN_navBar(this,0,1)" onClick="CNN_navBarClick(this,1,"/SHOWBIZ/")"><div class="cnnNavText"><a href="/SHOWBIZ/">Entertainment</a></div></td></tr>';
+s += ' <tr class="cnnNavRow"><td class="swath">&nbsp;</td>';
+s += ' <td class="cnnNav" onMouseOver="CNN_navBar(this,1,1)" onMouseOut="CNN_navBar(this,0,1)" onClick="CNN_navBarClick(this,1,"/TRAVEL/")"><div class="cnnNavText"><a href="/TRAVEL/">Travel</a></div></td></tr>';
+s += ' <tr class="cnnNavRow"><td class="swath">&nbsp;</td>';
+s += ' <td class="cnnNav" onMouseOver="CNN_navBar(this,1,1)" onMouseOut="CNN_navBar(this,0,1)" onClick="CNN_navBarClick(this,1,"/EDUCATION/")"><div class="cnnNavText"><a href="/EDUCATION/">Education</a></div></td></tr>';
+s += ' <tr class="cnnNavRow"><td class="swath">&nbsp;</td>';
+s += ' <td class="cnnNav" onMouseOver="CNN_navBar(this,1,1)" onMouseOut="CNN_navBar(this,0,1)" onClick="CNN_navBarClick(this,1,"/SPECIALS/")"><div class="cnnNavText"><a href="/SPECIALS/">Special Reports</a></div></td></tr>';
+s += ' <tr bgcolor="#FFFFFF"><td class="cnnNavAd" colspan="2" align="center"><!-- home/left.120x90 -->';
+s += '<script language="JavaScript1.1">';
+s += '<!--';
+s += 'adSetTarget("_top");';
+s += 'htmlAdWH( (new Array(93166917,93166917,93170132,93170132))[document.adoffset||0] , 120, 90);';
+s += '//-->';
+s += '</script><noscript><a href="http://ar.atwola.com/link/93166917/aol" target="_top"><img src="http://ar.atwola.com/image/93166917/aol" alt="Click here for our advertiser" width="120" height="90" border="0"></a></noscript></td></tr>';
+s += ' <tr bgcolor="#999999" class="cnnNavGroupRow">';
+s += ' <td colspan="2" class="cnnNavGroup"><div class="cnnNavText">SERVICES</div></td></tr>';
+s += ' <tr class="cnnNavOtherRow"><td class="swath">&nbsp;</td>';
+s += ' <td class="cnnNavOther" onMouseOver="CNN_navBar(this,1,0)" onMouseOut="CNN_navBar(this,0,0)" onClick="CNN_navBarClick(this,0,"/video/")"><div class="cnnNavText"><a href="/video/">Video</a></div></td></tr>';
+s += ' <tr class="cnnNavOtherRow"><td class="swath">&nbsp;</td>';
+s += ' <td class="cnnNavOther" onMouseOver="CNN_navBar(this,1,0)" onMouseOut="CNN_navBar(this,0,0)" onClick="CNN_navBarClick(this,0,"/EMAIL/")"><div class="cnnNavText"><a href="/EMAIL/">E-Mail Services</a></div></td></tr>';
+s += ' <tr class="cnnNavOtherRow"><td class="swath">&nbsp;</td>';
+s += ' <td class="cnnNavOther" onMouseOver="CNN_navBar(this,1,0)" onMouseOut="CNN_navBar(this,0,0)" onClick="CNN_navBarClick(this,0,"/mobile/CNNtoGO/")"><div class="cnnNavText"><a href="/mobile/CNNtoGO/">CNN To Go</a></div></td></tr>';
+s += ' <tr bgcolor="#999999" class="cnnNavGroupRow">';
+s += ' <td colspan="2" class="cnnNavGroup" style="background-color: #445B60"><div class="cnnNavText" style="color: #fff">SEARCH</div></td></tr>';
+s += ' <tr bgcolor="#CCCCCC"><td colspan="2" class="cnnNavSearch" style="background-color:#B6D8E0">';
+s += '';
+s += '<form action="http://search.cnn.com/cnn/search" method="get" name="nav_bottom_search" onSubmit="return CNN_validateSearchForm(this)" style="margin: 0px;">';
+s += ' <input type="hidden" name="sites" value="cnn">';
+s += ' <input type="hidden" name="source" value="cnn">';
+s += ' <input type="hidden" name="invocationType" value="side/bottom">';
+s += '<table width="100%" border="0" cellpadding="0" cellspacing="4">';
+s += ' <tr><td colspan="2"><table width="100%" border="0" cellpadding="0" cellspacing="0">';
+s += ' <tr>';
+s += ' <td align="left"><span class="cnnFormTextB" style="color: #369">Web</span></td>';
+s += ' <td><input type="radio" name="sites" value="google" checked></td>';
+s += ' <td align="right"><span class="cnnFormTextB" style="color: #369">CNN.com</span></td>';
+s += ' <td><input type="radio" name="sites" value="cnn"></td>';
+s += ' </tr>';
+s += ' </table></td></tr>';
+s += ' <tr><td colspan="2"><input type="text" name="query" class="cnnFormText" value="" title="Enter text to search for and click Search" size="7" maxlength="40" style="width: 100%"></td></tr>';
+s += ' <tr valign="top">';
+s += ' <td><input type="submit" value="Search" class="cnnNavButton" style="padding: 0px; margin: 0px; width: 50px"></td>';
+s += ' <td align="right"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/sect/SEARCH/nav.search.gif" alt="enhanced by Google" width="54" height="27"></td>';
+s += ' </tr>';
+s += '</table>';
+s += '';
+s += '';
+s += '';
+s += '</td></form></tr>';
+s += '</table>';
+s += '';
+s += ' </td>';
+s += ' <td rowspan="5" width="10"><a name="ContentArea"></a><img id="accessibilityPixel" src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="7" border="0"></td>';
+s += ' <td colspan="3" valign="middle">';
+s += ' <table border="0" cellpadding="0" cellspacing="0" width="100%">';
+s += ' <tr>';
+s += ' <td valign="top" nowrap><div class="cnnFinePrint" style="color: #333;padding:6px;padding-left:0px;">Updated: 05:53 p.m. EDT (2153 GMT) June 12, 2003</div></td>';
+s += ' <td align="right" nowrap class="cnnt1link"><a href="http://edition.cnn.com/">Visit International Edition</a>&nbsp;</td>';
+s += ' </tr><!--include virtual="/.element/ssi/sect/MAIN/1.0/banner.html"-->';
+s += ' </table>';
+s += ' </td>';
+s += ' </tr>';
+s += ' <tr valign="top">';
+s += ' <td rowspan="2" width="280" bgcolor="#EAEFF4">';
+s += '';
+s += '<!-- T1 -->';
+s += ' ';
+s += ' <a href="/2003/SHOWBIZ/Movies/06/12/obit.peck/index.html"><img src="http://i.cnn.net/cnn/2003/SHOWBIZ/Movies/06/12/obit.peck/top.peck.obit.jpg" alt="Oscar-winner Peck dies" width="280" height="210" border="0" hspace="0" vspace="0"></a>';
+s += '';
+s += ' <div class="cnnMainT1">';
+s += ' <h2 style="font-size:20px;"><a href="/2003/SHOWBIZ/Movies/06/12/obit.peck/index.html">Oscar-winner Peck dies</a></h2>';
+s += '<p>';
+s += 'Actor Gregory Peck, who won an Oscar for his portrayal of upstanding lawyer Atticus Finch in 1962s "To Kill a Mockingbird," has died at age 87. Peck was best known for roles of dignified statesmen and people who followed a strong code of ethics. But he also could play against type. All told, Peck was nominated for five Academy Awards.';
+s += '</p>';
+s += ' <p>';
+s += ' <b><a href="/2003/SHOWBIZ/Movies/06/12/obit.peck/index.html" class="cnnt1link">FULL STORY</a></b>';
+s += ' </p>';
+s += '';
+s += '';
+s += '';
+s += '&#8226; <span class="cnnBodyText" style="font-weight:bold;color:#333;">Video: </span><img src="http://i.cnn.net/cnn/.element/img/1.0/misc/premium.gif" alt="premium content" width="9" height="11" hspace="0" vspace="0" border="0" align="absmiddle"> <a href="javascript:LaunchVideo("/showbiz/2003/06/12/peck.obit.affl.","300k");">A leading mans leading man</a><br>';
+s += '';
+s += '';
+s += '';
+s += ' ';
+s += '&#8226; <span class="cnnBodyText" style="font-weight:bold;color:#333">Interactive: </span> <a href="javascript:CNN_openPopup("/interactive/entertainment/0306/peck.obit/frameset.exclude.html","620x430","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=620,height=430")">Gregory Peck through the years</a><br>';
+s += '';
+s += ' ';
+s += '&#8226; <a href="http://www.cnn.com/2003/SHOWBIZ/Movies/06/12/peck.filmography/index.html" target="new">Gregory Peck filmography</a><img src="http://i.cnn.net/cnn/.element/img/1.0/misc/icon.external.links.gif" alt="external link" width="20" height="13" vspace="1" hspace="4" border="0" align="top"><br>';
+s += '';
+s += ' ';
+s += '&#8226; <a href="http://www.cnn.com/2003/SHOWBIZ/Movies/06/04/heroes.villains.ap/index.html" target="new">Pecks Finch chararcter AFIs top hero</a><img src="http://i.cnn.net/cnn/.element/img/1.0/misc/icon.external.links.gif" alt="external link" width="20" height="13" vspace="1" hspace="4" border="0" align="top"><br>';
+s += ' </div>';
+s += '';
+s += '<!-- /T1 -->';
+s += ' </td>';
+s += ' ';
+s += ' <td rowspan="2" width="10"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="10" height="1"></td>';
+s += ' <td width="344">';
+s += '';
+s += '';
+s += '';
+s += '';
+s += '<!-- T2 -->';
+s += '';
+s += '<div><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/px_c00.gif" alt="" width="344" height="2"></div>';
+s += '<table width="344" border="0" cellpadding="0" cellspacing="0">';
+s += ' <tr>';
+s += ' <td width="285" class="cnnTabbedBoxHeader" style="padding-left:0px;"><span class="cnnBigPrint"><b>MORE TOP STORIES</b></span></td>';
+s += ' <td width="59" class="cnnTabbedBoxTab" align="right" bgcolor="#336699"><a href="/userpicks"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/userpicks.gif" alt=" Hot Stories " width="59" height="11" border="0"></a></td>';
+s += ' </tr>';
+s += '</table>';
+s += '<div style="padding:6px;padding-left:0px;">';
+s += '';
+s += ' ';
+s += '<div class="cnnMainNewT2">&#8226; <a href="/2003/WORLD/meast/06/12/mideast/index.html">7 dead in new Gaza strike</a>';
+s += '| <img src="http://i.cnn.net/cnn/.element/img/1.0/misc/premium.gif" alt="premium content" width="9" height="11" hspace="0" vspace="0" border="0" align="absmiddle"> <a href="javascript:LaunchVideo("/world/2003/06/11/cb.bush.roadmap.ap.","300k");">Video</a><br></div>';
+s += '';
+s += ' ';
+s += '<div class="cnnMainNewT2">&#8226; <a href="/2003/WORLD/meast/06/12/sprj.irq.main/index.html">U.S. helicopter, jet down in Iraqi raid</a>';
+s += '| <img src="http://i.cnn.net/cnn/.element/img/1.0/misc/premium.gif" alt="premium content" width="9" height="11" hspace="0" vspace="0" border="0" align="absmiddle"> <a href="javascript:LaunchVideo("/iraq/2003/06/11/bw.iraq.oil.cnn.","300k");">Video</a><br></div>';
+s += '';
+s += ' ';
+s += '<div class="cnnMainNewT2">&#8226; <a href="/2003/SHOWBIZ/TV/06/12/obit.brinkley/index.html">Television icon David Brinkley dead at 82</a><br></div>';
+s += '';
+s += ' ';
+s += '<div class="cnnMainNewT2">&#8226; <a href="/2003/LAW/06/12/peterson.case/index.html">Peterson search warrants will be made public in July</a><br></div>';
+s += '';
+s += ' ';
+s += '<div class="cnnMainNewT2">&#8226; <a href="/2003/WORLD/asiapcf/east/06/12/okinawa.rape/index.html">U.S. Marine held in new Okinawa rape case</a><br></div>';
+s += '';
+s += ' ';
+s += '<div class="cnnMainNewT2">&#8226; <a href="/2003/TECH/space/06/12/sprj.colu.bolts.ap/index.html">New threat discovered for shuttle launches</a><br></div>';
+s += '';
+s += ' ';
+s += '<div class="cnnMainNewT2">&#8226; <a href="/2003/SHOWBIZ/TV/06/12/television.sopranos.reut/index.html">"Soprano" Gandolfini shares his wealth with castmates</a><br></div>';
+s += '<!--[[div class="cnnMainNewT2"]]&#8226;&nbsp;[[b]][[span style="color:#C00;"]]CNN[[/span]]Radio:[[/b]]&nbsp;[[a href="javascript:CNN_openPopup("/audio/radio/preferences.html","radioplayer","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=200,height=124")"]]Bush on Medicare[[/a]]&nbsp;[[a href="javascript:CNN_openPopup("/audio/radio/preferences.html","radioplayer","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=200,height=124")"]][[img src="http://i.a.cnn.net/cnn/.element/img/1.0/misc/live.video.gif" alt="" width="61" height="14" vspace="0" hspace="2" align="absmiddle" border="0"]][[/a]][[img src="http://i.a.cnn.net/cnn/.element/img/1.0/misc/audio.gif" alt="" width="10" height="10" vspace="0" hspace="2" align="absmiddle"]][[br]][[/div]]--></div>';
+s += '';
+s += '<!-- /T2 -->';
+s += '<div><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="10"></div>';
+s += '';
+s += '<!--include virtual="/.element/ssi/misc/1.0/war.zone.smmap.txt"-->';
+s += '<!-- =========== CNN Radio/Video Box =========== -->';
+s += '<!-- top line --> ';
+s += '<div><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/px_ccc.gif" alt="" width="344" height="1"></div>';
+s += '<!-- /top line -->';
+s += ' <table width="344" border="0" cellpadding="0" cellspacing="0">';
+s += ' <tr valign="top">';
+s += '<!-- left-side line --> ';
+s += ' <td bgcolor="#CCCCCC" width="1"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="30" hspace="0" vspace="0" border="0"></td>';
+s += '<!-- /left-side line --> ';
+s += '<!-- CNNRadio cell -->';
+s += ' <td width="114"><div class="cnn6pxPad">';
+s += ' <span class="cnnBigPrint" style="color:#C00;font-weight:bold;">CNN</span><span class="cnnBigPrint" style="color:#000;font-weight:bold;">RADIO</span>';
+s += '<div class="cnnMainNewT2"><a href="javascript:CNN_openPopup("/audio/radio/preferences.html","radioplayer","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=200,height=124")">Listen to latest updates</a><img src="http://i.a.cnn.net/cnn/.element/img/1.0/misc/audio.gif" alt="" width="10" height="10" vspace="0" hspace="2" align="absmiddle">';
+s += '<div><img src="http://i.a.cnn.net/cnn/images/1.gif" alt="" width="1" height="5" hspace="0" vspace="0"></div>';
+s += '<!--';
+s += '[[span class="cnnFinePrint"]]sponsored by:[[/span]][[br]][[center]]';
+s += '[[!~~#include virtual="/cnn_adspaces/home/war_in_iraq/sponsor.88x31.ad"~~]]';
+s += ' [[/center]]';
+s += '-->';
+s += ' </div></td>';
+s += '<!-- /CNNRadio cell --> ';
+s += '<!-- center line --> ';
+s += ' <td bgcolor="#CCCCCC" width="1"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="1" hspace="0" vspace="0" border="0"></td>';
+s += '<!-- /center line --> ';
+s += '<!-- video cell --> ';
+s += ' <td width="227"><div class="cnn6pxPad">';
+s += '<!-- video box --> ';
+s += '<table width="215" border="0" cellpadding="0" cellspacing="0">';
+s += ' <tr valign="top">';
+s += ' <td width="144"><span class="cnnBigPrint" style="font-weight:bold;">VIDEO</span></td>';
+s += ' <td width="6"><img src="http://i.a.cnn.net/cnn/images/1.gif" alt="" width="6" height="1" hspace="0" vspace="0"></td>';
+s += ' <td width="65"><a href="/video/"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/more.video.blue.gif" alt="MORE VIDEO" width="62" height="11" hspace="0" vspace="0" border="0"></a></td></tr>';
+s += ' <tr>';
+s += ' <td width="215" colspan="3"><img src="http://i.a.cnn.net/cnn/images/1.gif" alt="" width="1" height="2" hspace="0" vspace="0"></td></tr>';
+s += ' <tr valign="top">';
+s += ' <td><div class="cnnBodyText">';
+s += ' Soldier broke dozens of hearts over e-mail<br>';
+s += ' <img src="http://i.a.cnn.net/cnn/images/icons/premium.gif" align="middle" alt="premium content" width="9" height="11" hspace="0" vspace="1" border="0">&nbsp;<a href="javascript:LaunchVideo("/offbeat/2003/06/12/ms.casanova.col.ap.","300k");" class="cnnVideoLink">PLAY VIDEO</a></div>';
+s += ' </td>';
+s += '<td width="3"><img src="http://i.a.cnn.net/cnn/images/1.gif" alt="" width="3" height="1" hspace="0" vspace="0"></td> ';
+s += ' <td width="65" align="right">';
+s += ' <a href="javascript:LaunchVideo("/offbeat/2003/06/12/ms.casanova.col.ap.","300k");"><img src="http://i.cnn.net/cnn/video/offbeat/2003/06/12/ms.casanova.col.vs.kndu.jpg" alt="" width="65" height="49" border="0" vspace="2" hspace="0"></a>';
+s += ' </td></tr>';
+s += '</table>';
+s += ' <!-- /video box --> ';
+s += ' </div></td>';
+s += '<!-- /video cell --> ';
+s += '<!-- right-side line --> ';
+s += '<td bgcolor="#CCCCCC" width="1"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="1" hspace="0" vspace="0" border="0"></td>';
+s += '<!-- /right-side line --> ';
+s += ' </tr>';
+s += ' </table>';
+s += '';
+s += '<!-- bottom line -->';
+s += '<div><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/px_ccc.gif" alt="" width="344" height="1"></div>';
+s += '<!-- /bottom line -->';
+s += '<!-- =========== /CNN Radio/Video Box =========== -->';
+s += '';
+s += '<div><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="10"></div>';
+s += '<div><img src="http://i.cnn.net/cnn/.element/img/1.0/main/px_c00.gif" alt="" width="344" height="2"></div>';
+s += '<table width="344" border="0" cellpadding="0" cellspacing="0">';
+s += ' <tr>';
+s += ' <td width="260" class="cnnTabbedBoxHeader" style="padding-left:0px;"><span class="cnnBigPrint"><b>ON THE SCENE</b></span></td>';
+s += ' <td width="84" class="cnnTabbedBoxTab" align="right" bgcolor="#336699" style="padding: 0px 3px;"><a href="/LAW/"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/superlinks/law.gif" alt="more reports" height="11" border="0" hspace="2" vspace="2" align="right"></a></td>';
+s += ' </tr>';
+s += '</table>';
+s += '';
+s += '<table width="344" border="0" cellpadding="5" cellspacing="0">';
+s += ' <tr valign="top">';
+s += ' <td style="padding-left:0px;"> <b>Jeffrey Toobin:</b> "It takes guts" for Peterson defense to subpoena judge over wiretap issue.';
+s += '<a href="/2003/LAW/06/12/otsc.toobin/index.html">Full Story</a></td>';
+s += '';
+s += '<td width="65" align="right" style="padding-left:6px;"><a href="/2003/LAW/06/12/otsc.toobin/index.html"><img src="http://i.cnn.net/cnn/2003/LAW/06/12/otsc.toobin/tz.toobin.jpg" alt="image" width="65" height="49" border="0" hspace="0" vspace="0"></a></td>';
+s += ' </tr>';
+s += '</table>';
+s += '<div><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="10"></div>';
+s += ' </td>';
+s += ' </tr>';
+s += ' <tr valign="bottom">';
+s += ' <td>';
+s += '<table width="344" border="0" cellpadding="0" cellspacing="0">';
+s += ' <tr>';
+s += ' <td width="267" nowrap style="color: #c00; padding-left: 6px"><span class="cnnBigPrint" style="vertical-align: top"><b>BUSINESS</b></span>';
+s += ' <a href="/money/"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/at_cnnmoney.gif" alt=" at CNN/Money " width="100" height="15" border="0"></a></td>';
+s += ' <td width="77" align="right"><a href="/money/"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/business.news.blue.gif" alt=" Business News " width="77" height="11" border="0"></a></td>';
+s += ' </tr>';
+s += '</table>';
+s += '';
+s += '<table width="344" bgcolor="#EEEEEE" border="0" cellpadding="0" cellspacing="0" style="border: solid 1px #ddd">';
+s += ' <tr valign="top">';
+s += ' <td>';
+s += ' <table width="100%" border="0" cellpadding="0" cellspacing="4">';
+s += ' <tr>';
+s += ' <td colspan="3"><span class="cnnMenuText"><b>STOCK/FUND QUOTES: </b></span></td>';
+s += ' </tr><form action="http://qs.money.cnn.com/tq/stockquote" method="get" style="margin: 0px;">';
+s += ' <tr>';
+s += ' <td><span class="cnnFinePrint">enter symbol</span></td>';
+s += ' <td><input type="text" name="symbols" size="7" maxlength="40" class="cnnMenuText" title="Enter stock/fund symbol or name to get a quote"></td>';
+s += ' <td><input type="submit" value="GET" class="cnnNavButton"></td>';
+s += ' </tr></form>';
+s += ' </table>';
+s += ' <table width="100%" border="0" cellpadding="0" cellspacing="4">';
+s += ' <tr valign="top">';
+s += ' <td><span class="cnnFinePrint">sponsored by:</span></td>';
+s += ' <td align="right"><!--<a href="/money/news/specials/rebuild_iraq/"><img src="http://i.a.cnn.net/cnn/2003/images/04/17/money.box.gif" ALT="" width="150" height="31" HSPACE="0" VSPACE="0" border="0" align="left"></a>--><a href="http://ar.atwola.com/link/93103306/aol"><img src="http://ar.atwola.com/image/93103306/aol" alt="Click Here" width="88" height="31" border="0" hspace="0" vspace="0"></a></td>';
+s += ' </tr>';
+s += ' </table>';
+s += ' </td>';
+s += ' <td class="cnnMainMarketBox"> <table width="100%" border="0" cellpadding="4" cellspacing="0" summary="Market data from CNNmoney">';
+s += ' <tr class="noBottomBorder">';
+s += ' <td colspan="5"><span class="cnnMainMarketCell"><span class="cnnMenuText"><b><a href="/money/markets/">MARKETS:</a></b></span> <!-- 16:30:15 -->';
+s += '';
+s += '4:30pm ET, 6/12</span></td>';
+s += ' </tr>';
+s += ' <tr class="noTopBorder">';
+s += ' <td><span class="cnnMainMarketCell"><a href="/money/markets/dow.html" title="Dow Jones Industrial Average">DJIA</a></span></td>';
+s += ' <td><img src="http://i.cnn.net/cnn/.element/img/1.0/main/arrow_up.gif" alt="" width="9" height="9"></td>';
+s += ' <td align="right" nowrap><span class="cnnMainMarketCell">+13.30</span></td>';
+s += ' <td align="right" nowrap><span class="cnnMainMarketCell">9196.50</span></td>';
+s += ' <td align="right" nowrap><span class="cnnMainMarketCell">+ 0.14%</span></td>';
+s += '';
+s += ' </tr>';
+s += ' <tr>';
+s += ' <td><span class="cnnMainMarketCell"><a href="/money/markets/nasdaq.html" title="NASDAQ">NAS</a></span></td>';
+s += ' <td><img src="http://i.cnn.net/cnn/.element/img/1.0/main/arrow_up.gif" alt="" width="9" height="9"></td>';
+s += ' <td align="right" nowrap><span class="cnnMainMarketCell">+ 7.60</span></td>';
+s += ' <td align="right" nowrap><span class="cnnMainMarketCell">1653.62</span></td>';
+s += ' <td align="right" nowrap><span class="cnnMainMarketCell">+ 0.46%</span></td>';
+s += '';
+s += ' </tr>';
+s += ' <tr class="noBottomBorder">';
+s += ' <td><span class="cnnMainMarketCell"><a href="/money/markets/sandp.html" title="S&amp;P 500">S&amp;P</a></span></td>';
+s += ' <td><img src="http://i.cnn.net/cnn/.element/img/1.0/main/arrow_up.gif" alt="" width="9" height="9"></td>';
+s += ' <td align="right" nowrap><span class="cnnMainMarketCell">+ 1.03</span></td>';
+s += ' <td align="right" nowrap><span class="cnnMainMarketCell">998.51</span></td>';
+s += ' <td align="right" nowrap><span class="cnnMainMarketCell">+ 0.10%</span></td>';
+s += '';
+s += ' </tr>';
+s += ' </table>';
+s += '</td>';
+s += ' </tr>';
+s += '</table>';
+s += '';
+s += '</td>';
+s += ' </tr>';
+s += ' <tr>';
+s += ' <td colspan="3"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="4"></td>';
+s += ' </tr>';
+s += ' <tr align="center" valign="bottom">';
+s += ' <td width="280" bgcolor="#EEEEEE"><a href="/linkto/ftn.nytimes1.html"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/ftn.280x32.ny.times.gif" width="255" height="32" alt="" border="0"></a></td>';
+s += '<td width="10"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="10" height="1"></td>';
+s += ' <td width="344" bgcolor="#EEEEEE"><a href="/linkto/ftn.bn3.html"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/ftn.345x32.breaking.news.gif" width="340" height="32" alt="" border="0"></a></td>';
+s += ' </tr>';
+s += '';
+s += '</table>';
+s += '';
+s += '';
+s += '<div><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="10"></div>';
+s += '';
+s += '';
+s += '<table width="770" border="0" cellpadding="0" cellspacing="0">';
+s += ' <col width="10">';
+s += ' <col width="483" align="left" valign="top">';
+s += ' <col width="10">';
+s += ' <col width="267" align="left" valign="top">';
+s += ' <tr valign="top">';
+s += ' <td rowspan="2"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="10" height="1"></td>';
+s += ' <td valign="top">';
+s += ' <table border="0" cellpadding="0" cellspacing="0">';
+s += ' <tr valign="top">';
+s += ' <td width="238">';
+s += ' <div><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/px_c00.gif" alt="" width="238" height="2"></div>';
+s += '';
+s += '';
+s += '';
+s += '';
+s += '';
+s += '';
+s += ' <table width="238" border="0" cellpadding="0" cellspacing="0">';
+s += ' <tr>';
+s += ' <td width="132" class="cnnTabbedBoxHeader" style="padding-left:0px;"><span class="cnnBigPrint"><b>MORE REAL TV</b></span></td>';
+s += ' <td width="106" class="cnnTabbedBoxTab" align="right" bgcolor="#336699" style="padding: 0px 3px;"><a href="/SHOWBIZ"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/entertainment.news.gif" alt="More Entertainment" border="0" width="102" height="11" hspace="2" vspace="2" align="right"></a></td>';
+s += ' </tr>';
+s += ' </table>';
+s += ' <div><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="238" height="5" vspace="0" hspace="0"></div>';
+s += ' <table width="238" border="0" cellpadding="0" cellspacing="0">';
+s += ' <tr valign="top">';
+s += ' <td><div class="cnn6pxTpad">';
+s += ' ';
+s += ' <a href="/2003/SHOWBIZ/06/11/eye.ent.voyeurs/index.html">Go ahead, follow me</a><br>';
+s += 'New reality series and the movie debut of "Idol" finalists';
+s += ' </div></td>';
+s += ' <td width="71" align="right"><a href="/2003/SHOWBIZ/06/11/eye.ent.voyeurs/index.html"><img src="http://i.a.cnn.net/cnn/2003/SHOWBIZ/06/11/eye.ent.voyeurs/tz.movies.gif" alt="Go ahead, follow me" width="65" height="49" border="0" vspace="6"></a></td>';
+s += ' </tr>';
+s += ' </table>';
+s += '';
+s += '';
+s += '';
+s += '';
+s += '';
+s += '';
+s += ' ';
+s += ' <div><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="238" height="5" vspace="0" hspace="0"></div>';
+s += '<!--include virtual="/.element/ssi/video/section_teases/topvideos_include.txt"-->';
+s += ' </td>';
+s += ' <td><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="7" height="1"></td>';
+s += ' <td width="238">';
+s += ' <div><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/px_c00.gif" alt="" width="238" height="2"></div>';
+s += '';
+s += '';
+s += '';
+s += '';
+s += '';
+s += '';
+s += ' <table width="238" border="0" cellpadding="0" cellspacing="0">';
+s += ' <tr>';
+s += ' <td width="157" class="cnnTabbedBoxHeader" style="padding-left:0px;"><span class="cnnBigPrint"><b>GIFT IDEAS</b></span></td>';
+s += ' <td width="81" class="cnnTabbedBoxTab" align="right" bgcolor="#336699" style="padding: 0px 3px;"><a href="/money"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/superlinks/business.gif" alt="Business News" border="0" width="77" height="11" hspace="2" vspace="2" align="right"></a></td>';
+s += ' </tr>';
+s += ' </table>';
+s += ' <div><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="238" height="5" vspace="0" hspace="0"></div>';
+s += ' <table width="238" border="0" cellpadding="0" cellspacing="0">';
+s += ' <tr valign="top">';
+s += ' <td><div class="cnn6pxTpad">';
+s += '';
+s += '';
+s += '<span class="cnnBodyText" style="font-weight:bold;">CNN/Money: </span> <a href="/money/2003/06/12/news/companies/fathers_day/index.htm?cnn=yes">Fathers Day</a><br>';
+s += 'Smaller is better --from digital cameras to iPod';
+s += ' </div></td>';
+s += ' <td width="71" align="right"><a href="/money/2003/06/12/news/companies/fathers_day/index.htm?cnn=yes"><img src="http://i.a.cnn.net/cnn/images/programming.boxes/tz.money.dads.day.watch.jpg" alt="Fathers Day" width="65" height="49" border="0" vspace="6"></a></td>';
+s += ' </tr>';
+s += ' </table>';
+s += ' </td>';
+s += ' </tr>';
+s += ' </table>';
+s += ' <div><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="238" height="10" vspace="0" hspace="0"></div> ';
+s += '<table width="483" border="0" cellspacing="0" cellpadding="0">';
+s += ' <tr valign="top">';
+s += ' <td rowspan="9"><br></td>';
+s += ' <td width="238"><a href="/US/"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/us.gif" alt="U.S. News: " width="238" height="15" border="0"></a><br><div class="cnnMainSections">';
+s += '';
+s += ' ';
+s += '&#8226;&nbsp;<a href="/2003/US/South/06/11/miami.rapist/index.html">Miami police link 4 rapes to serial rapist</a><br>';
+s += '';
+s += ' ';
+s += '&#8226;&nbsp;<a href="/2003/LAW/06/12/mistaken.identity.ap/index.html">Woman mistaken for fugitive jailed</a><br>';
+s += '';
+s += ' ';
+s += '&#8226;&nbsp;<a href="/2003/US/Northeast/06/12/woman.impaled.ap/index.html">Pregnant woman impaled on mic stand</a><br>';
+s += ' </div></td>';
+s += ' <td rowspan="7" width="7"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="7" height="1"></td>';
+s += ' <td width="238"><a href="/WORLD/"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/world.gif" alt="World News: " width="238" height="15" border="0"></a><br><div class="cnnMainSections">';
+s += '';
+s += ' ';
+s += '&#8226;&nbsp;<a href="/2003/WORLD/europe/06/12/nato.bases/index.html">NATO reshapes for new era</a><br>';
+s += '';
+s += ' ';
+s += '&#8226;&nbsp;<a href="/2003/WORLD/africa/06/12/congo.democratic/index.html">U.N. reviews Bunia peace force</a><br>';
+s += '';
+s += '';
+s += '';
+s += '&#8226;&nbsp;<span class="cnnBodyText" style="font-weight:bold;color:#900;">TIME.com: </span><a href="/time/magazine/article/0,9171,1101030616-457361,00.html?CNN=yes" target="new">Saddams curtain trail</a><img src="http://i.cnn.net/cnn/.element/img/1.0/misc/icon.external.links.gif" alt="external link" width="20" height="13" vspace="1" hspace="4" border="0" align="top"><br>';
+s += ' </div></td>';
+s += ' </tr><tr valign="top">';
+s += ' <td width="238"><a href="/TECH/"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/technology.gif" alt="Sci-Tech News: " width="238" height="15" border="0"></a><br><div class="cnnMainSections">';
+s += '';
+s += ' ';
+s += '&#8226;&nbsp;<a href="/2003/TECH/ptech/06/11/bus2.ptech.dvd.maker/index.html">Another reason to throw out your VCR</a><br>';
+s += '';
+s += ' ';
+s += '&#8226;&nbsp;<a href="/2003/TECH/ptech/06/12/korea.samsung.reut/index.html">Flat screen TV prices dropping</a><br>';
+s += ' </div></td>';
+s += ' <td width="238"><a href="/SHOWBIZ/"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/entertainment.gif" alt="Entertainment News: " width="238" height="15" border="0"></a><br><div class="cnnMainSections">';
+s += '';
+s += ' ';
+s += '&#8226;&nbsp;<a href="/2003/SHOWBIZ/TV/06/12/cnn.obrien/index.html">CNN hires Soledad OBrien for "AM"</a><br>';
+s += '';
+s += ' ';
+s += '&#8226;&nbsp;<a href="/2003/SHOWBIZ/TV/06/11/batchelor.troubles.ap/index.html">Dating show star let go by law firm</a><br>';
+s += ' </div></td>';
+s += ' </tr><tr valign="top">';
+s += ' <td width="238"><a href="/ALLPOLITICS/"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/politics.gif" alt="Politics News: " width="238" height="15" border="0"></a><br><div class="cnnMainSections">';
+s += '';
+s += ' ';
+s += '&#8226;&nbsp;<a href="/2003/ALLPOLITICS/06/11/schwarzenegger.ap/index.html">Schwarzenegger on California politics</a><br>';
+s += '';
+s += ' ';
+s += '&#8226;&nbsp;<a href="/2003/ALLPOLITICS/06/12/tax.credit.ap/index.html">House approves extension on child tax credit</a><br>';
+s += ' </div></td>';
+s += ' <td width="238"><a href="/LAW/"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/law.gif" alt="Law News: " width="238" height="15" border="0"></a><br><div class="cnnMainSections">';
+s += '';
+s += ' ';
+s += '&#8226;&nbsp;<a href="/2003/LAW/06/12/plaintiff.advances.ap/index.html">Court bars cash advances to plaintiffs</a><br>';
+s += '';
+s += ' ';
+s += '&#8226;&nbsp;<a href="/2003/LAW/06/11/jackson.lawsuit.ap/index.html">Lawsuit against Jackson settled</a><br>';
+s += ' </div></td>';
+s += ' </tr><tr valign="top">';
+s += ' <td width="238"><a href="/HEALTH/"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/health.gif" alt="Health News: " width="238" height="15" border="0"></a><br><div class="cnnMainSections">';
+s += '';
+s += ' ';
+s += '&#8226;&nbsp;<a href="/2003/HEALTH/06/12/monkeypox.ap/index.html">Monkeypox spreading person-to-person?</a><br>';
+s += '';
+s += ' ';
+s += '&#8226;&nbsp;<a href="/2003/HEALTH/06/12/quick.xray.ap/index.html">A full body X-ray in 13 seconds</a><br>';
+s += ' </div></td>';
+s += ' <td width="238"><a href="/TECH/space/"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/space.gif" alt="Space News: " width="238" height="15" border="0"></a><br><div class="cnnMainSections">';
+s += '';
+s += ' ';
+s += '&#8226;&nbsp;<a href="/2003/TECH/science/06/12/hydrogen.ozone.ap/index.html">Hydrogen fuel may disturb ozone layer</a><br>';
+s += '';
+s += ' ';
+s += '&#8226;&nbsp;<a href="/2003/TECH/space/06/12/sprj.colu.bolts.ap/index.html">New threat found for shuttle launches</a><br>';
+s += ' </div></td>';
+s += ' </tr><tr valign="top">';
+s += ' <td width="238"><a href="/TRAVEL/"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/travel.gif" alt="Travel News: " width="238" height="15" border="0"></a><br><div class="cnnMainSections">';
+s += '';
+s += ' ';
+s += '&#8226;&nbsp;<a href="/2003/TRAVEL/DESTINATIONS/06/12/walk.across.america.ap/index.html">Walking America from coast to coast</a><br>';
+s += '';
+s += ' ';
+s += '&#8226;&nbsp;<a href="/2003/TRAVEL/06/11/bi.airlines.executives.reut/index.html">Airline execs not seeing sunny skies yet</a><br>';
+s += ' </div></td>';
+s += ' <td width="238"><a href="/EDUCATION/"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/education.gif" alt="Education News: " width="238" height="15" border="0"></a><br><div class="cnnMainSections">';
+s += '';
+s += ' ';
+s += '&#8226;&nbsp;<a href="/2003/EDUCATION/06/12/arabs.prom.ap/index.html">Arab students seek prom balance</a><br>';
+s += '';
+s += ' ';
+s += '&#8226;&nbsp;<a href="/2003/EDUCATION/06/11/school.fundraising.ap/index.html">Public schools turn to upscale fundraising</a><br>';
+s += ' </div></td>';
+s += ' </tr><tr valign="top">';
+s += ' <td width="238"><a href="/si/index.html?cnn=yes"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/sports.gif" alt="Sports News: " width="238" height="15" border="0"></a><br><div class="cnnMainSections">';
+s += '';
+s += '&#8226;&nbsp;<a href="/cnnsi/golfonline/2003/us_open/news/2003/06/12/open_thursday_ap">Woods eyes third U.S. Open title</a><br>';
+s += '&#8226;&nbsp;<a href="/cnnsi/basketball/news/2003/06/12/jordan_ruling_ap">Judge denies Jordan&#039;s former lover $5M payoff</a><br>';
+s += ' </div></td>';
+s += ' <td width="238"><a href="/money/"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/business.gif" alt="Business News: " width="238" height="15" border="0"></a><br><div class="cnnMainSections">';
+s += '&#8226;&nbsp;<a href="/money/2003/06/12/pf/saving/duppies/index.htm">Here come the "Duppies"</a><br>';
+s += '&#8226;&nbsp;<a href="/money/2003/06/12/technology/oracle/index.htm">Oracle beats estimates</a><br>';
+s += ' </div></td>';
+s += ' </tr>';
+s += '</table>';
+s += ' </td>';
+s += ' <td><img src="http://i.cnn.net/cnn/images/1.gif" width="10" hspace="0" vspace="0" alt=""></td>';
+s += ' <td valign="top">';
+s += ' <div><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/px_c00.gif" alt="" width="267" height="2"></div>';
+s += ' ';
+s += '<table width="267" border="0" cellpadding="0" cellspacing="0">';
+s += ' <tr>';
+s += ' <td width="173" bgcolor="#003366"><div class="cnnBlueBoxHeader"><span class="cnnBigPrint"><b>WATCH CNN TV</b></span></div></td>';
+s += ' <td width="25" class="cnnBlueBoxHeader" align="right"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/misc/diagonal.gif" width="25" height="19" alt=""></td>';
+s += ' <td width="69" class="cnnBlueBoxTab" align="right" bgcolor="#336699"><a href="/CNN/Programs/"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/tv.schedule.gif" alt="On CNN TV" border="0" width="65" height="11" hspace="2" vspace="2" align="right"></a></td>';
+s += ' </tr>';
+s += '</table>';
+s += '<table width="267" bgcolor="#EEEEEE" border="0" cellpadding="4" cellspacing="0">';
+s += ' <tr valign="top">';
+s += ' <td><a href="/CNN/Programs/american.morning/"><img src="http://i.cnn.net/cnn/CNN/Programs/includes/showbox/images/2003/05/tz.hemmer.jpg" alt="American Morning, 7 a.m. ET" width="65" height="49" border="0" align="right"></a><a href="/CNN/Programs/american.morning/"><b>American Morning (7 a.m. ET):</b></a> Tomorrow, singer Carnie Wilson talks about her new book, "Im Still Hungry."';
+s += ' </td>';
+s += ' </tr>';
+s += '</table>';
+s += '';
+s += '<!--';
+s += '[[table width="267" border="0" cellpadding="0" cellspacing="0"]]';
+s += '[[tr]][[td width="173" bgcolor="#003366"]][[div class="cnnBlueBoxHeader"]][[span class="cnnBigPrint"]][[b]]WATCH CNN TV[[/b]][[/span]][[/div]][[/td]][[td width="25" class="cnnBlueBoxHeader" align="right"]][[img src="http://i.a.cnn.net/cnn/.element/img/1.0/misc/diagonal.gif" width="25" height="19" alt=""]][[/td]][[td width="69" class="cnnBlueBoxTab" align="right" bgcolor="#336699"]][[a href="/CNN/Programs/"]][[img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/tv.schedule.gif" alt="On CNN TV" border="0" width="65" height="11" hspace="2" vspace="2" align="right"]][[/a]][[/td]][[/tr]][[/table]][[table width="267" bgcolor="#EEEEEE" border="0" cellpadding="4" cellspacing="0"]][[tr valign="top"]][[td]]';
+s += '[[img src="http://i.cnn.net/cnn/2003/images/05/31/tz.bw.jpg" alt="" width="65" height="49" border="0" align="right"]]';
+s += ' ';
+s += '[[b]] CNN Presents: The Hunt for Eric Robert Rudolph (8 p.m. ET)[[/b]][[br]]Latest on his capture.';
+s += ' [[/td]]';
+s += ' [[/tr]]';
+s += ' [[/table]]';
+s += '-->';
+s += '';
+s += ' <div><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="10"></div> ';
+s += '';
+s += '';
+s += '';
+s += '';
+s += '';
+s += '';
+s += ' <div><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/px_c00.gif" alt="" width="267" height="2"></div>';
+s += ' <table width="267" border="0" cellpadding="0" cellspacing="0">';
+s += ' <tr>';
+s += ' <td width="184" bgcolor="#003366"><div class="cnnBlueBoxHeader"><span class="cnnBigPrint"><b>ANALYSIS</b></span></div></td>';
+s += ' <td width="25" class="cnnBlueBoxHeader" align="right"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/misc/diagonal.gif" width="25" height="19" alt=""></td>';
+s += ' <td width="58" class="cnnBlueBoxTab" align="right" bgcolor="#336699"><a href="/US"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/superlinks/us.gif" alt="U.S. News" border="0" width="54" height="11" hspace="2" vspace="2" align="right"></a></td>';
+s += ' </tr>';
+s += ' </table>';
+s += ' <table width="267" bgcolor="#EEEEEE" border="0" cellpadding="4" cellspacing="0">';
+s += ' <tr valign="top">';
+s += ' <td>';
+s += '<a href="/2003/US/06/12/nyt.safire/index.html"><img src="http://i.a.cnn.net/cnn/2003/US/06/12/nyt.safire/tz.stewart.jpg" alt="Fight It, Martha" width="65" height="49" border="0" align="right"></a>';
+s += '';
+s += '';
+s += '<span class="cnnBodyText" style="font-weight:bold;color:#000;">NYTimes: </span> <a href="/2003/US/06/12/nyt.safire/index.html">Fight It, Martha</a><br>';
+s += 'William Safire: I hope Martha Stewart beats this bum rap';
+s += '';
+s += '';
+s += '';
+s += '';
+s += ' </td>';
+s += ' </tr>';
+s += ' </table>';
+s += ' <div><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="10"></div>';
+s += ' <div><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/px_c00.gif" alt="" width="267" height="2"></div>';
+s += ' <table width="267" border="0" cellpadding="0" cellspacing="0">';
+s += ' <tr>';
+s += ' <td width="164" bgcolor="#003366"><div class="cnnBlueBoxHeader"><span class="cnnBigPrint"><b>OFFBEAT</b></span></div></td>';
+s += ' <td width="25" class="cnnBlueBoxHeader" align="right"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/misc/diagonal.gif" width="25" height="19" alt=""></td>';
+s += ' <td width="78" class="cnnBlueBoxTab" align="right" bgcolor="#336699"><a href="/offbeat"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/superlinks/offbeat.gif" alt="more offbeat" width="74" height="11" border="0" hspace="2" vspace="2" align="right"></a></td>';
+s += ' </tr>';
+s += ' </table>';
+s += ' <table width="267" bgcolor="#DDDDDD" border="0" cellpadding="4" cellspacing="0">';
+s += ' <tr valign="top">';
+s += ' <td>';
+s += '<a href="/2003/HEALTH/06/12/offbeat.china.sperm.ap/index.html"><img src="http://i.a.cnn.net/cnn/2003/HEALTH/06/12/offbeat.china.sperm.ap/tz.china.sperm.jpg" alt="Waiting list" width="65" height="49" border="0" align="right"></a>';
+s += ' ';
+s += ' <a href="/2003/HEALTH/06/12/offbeat.china.sperm.ap/index.html">Waiting list</a><br>';
+s += 'Chinas "smart sperm" bank needs donors';
+s += ' </td>';
+s += ' </tr>';
+s += ' </table>';
+s += ' <div><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="10"></div>';
+s += '';
+s += ' <table width="267" bgcolor="#999999" border="0" cellpadding="0" cellspacing="0">';
+s += ' <tr>';
+s += ' <td>';
+s += ' <table width="100%" border="0" cellpadding="4" cellspacing="1">';
+s += ' <tr>';
+s += ' <td bgcolor="#EEEEEE" class="cnnMainWeatherBox"><a name="weatherBox"></a>';
+s += '';
+s += '';
+s += '';
+s += '';
+s += '';
+s += '';
+s += '<table width="257" border="0" cellpadding="1" cellspacing="0">';
+s += '<form method="get" action="http://weather.cnn.com/weather/search" style="margin: 0px">';
+s += '<input type="hidden" name="mode" value="hplwp">';
+s += ' <tr>';
+s += ' <td bgcolor="#FFFFFF"><table width="255" bgcolor="#EAEFF4" border="0" cellpadding="4" cellspacing="0">';
+s += ' <tr>';
+s += ' <td colspan="2" class="cnnWEATHERrow">&nbsp;<span class="cnnBigPrint">WEATHER</span></td>';
+s += ' </tr>';
+s += ' <tr>';
+s += ' <td colspan="2" class="cnnBodyText">Get your hometown weather on the home page! <b>Enter city name or U.S. Zip Code:</b></td>';
+s += ' </tr>';
+s += ' <tr>';
+s += ' <td><input class="cnnFormText" type="text" size="12" name="wsearch" value="" style="width:100px;"></td>';
+s += ' <td><input class="cnnNavButton" type="submit" value="PERSONALIZE"></td>';
+s += ' </tr>';
+s += ' <tr>';
+s += ' <td class="cnnBodyText" colspan="2">Or <a href="javascript:CNN_openPopup("http://weather.cnn.com/weather/select.popup/content2.jsp?mode=hplwp", "weather", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=260,height=250")"><b>select location from a list</b></a></td>';
+s += ' </tr>';
+s += ' </table></td>';
+s += ' </tr>';
+s += '</form>';
+s += '</table>';
+s += '';
+s += '';
+s += '';
+s += ' </td>';
+s += ' </tr>';
+s += ' <tr>';
+s += ' <td bgcolor="#EEEEEE">';
+s += ' <table width="100%" border="0" cellpadding="0" cellspacing="2">';
+s += ' <tr>';
+s += ' <td><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/quickvote.gif" alt="Quick Vote" width="107" height="24" border="0"></td>';
+s += ' <td width="88" align="right"><!-- ad home/quickvote/sponsor.88x31 -->';
+s += '<!-- ad commented while aol investigates 3/31/03 5:40 a.m. lk -->';
+s += '<a href="http://ar.atwola.com/link/93101912/aol"><img src="http://ar.atwola.com/image/93101912/aol" alt="Click Here" width="88" height="31" border="0" hspace="0" vspace="0"></a>';
+s += '</td>';
+s += ' </tr>';
+s += ' </table>';
+s += '<table width="100%" cellspacing="0" cellpadding="1" border="0"><form target="popuppoll" method="post" action="http://polls.cnn.com/poll">';
+s += '<INPUT TYPE=HIDDEN NAME="poll_id" VALUE="3966">';
+s += '<tr><td colspan="2" align="left"><span class="cnnBodyText">Should an international peacekeeping force be sent to the Mideast?<br></span></td></tr>';
+s += '<tr valign="top">';
+s += '<td><span class="cnnBodyText">Yes</span>';
+s += '</td><td align="right"><input value="1" type="radio" name="question_1"></td></tr>';
+s += '<tr valign="top">';
+s += '<td><span class="cnnBodyText">No</span>';
+s += '</td><td align="right"><input value="2" type="radio" name="question_1"></td></tr>';
+s += '<!-- /end Question 1 -->';
+s += '<tr>';
+s += '<td colspan="2">';
+s += '<table width="100%" cellspacing="0" cellpadding="0" border="0"><tr><td><span class="cnnInterfaceLink"><nobr><a href="javascript:CNN_openPopup("/POLLSERVER/results/3966.html","popuppoll","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=510,height=400")">VIEW RESULTS</a></nobr></span></td>';
+s += '<td align="right"><input class="cnnFormButton" onclick="CNN_openPopup("","popuppoll","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=510,height=400")" value="VOTE" type="SUBMIT"></td></tr></table></td></tr>';
+s += '</form></table>';
+s += '';
+s += ' </td>';
+s += ' </tr>';
+s += '</table>';
+s += '';
+s += ' </td>';
+s += ' </tr>';
+s += ' </table>';
+s += ' <!-- /right --></td>';
+s += ' </tr>';
+s += ' <tr>';
+s += ' <td colspan="3" valign="bottom"> <img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/px_ccc.gif" alt="" width="483" height="1"> </td>';
+s += ' </tr>';
+s += '</table>';
+s += '<table width="770" border="0" cellpadding="0" cellspacing="0" summary="Links to stories from CNN partners">';
+s += ' <col width="10">';
+s += ' <col width="250" align="left" valign="top">';
+s += ' <col width="5">';
+s += ' <col width="250" align="left" valign="top">';
+s += ' <col width="5">';
+s += ' <col width="250" align="left" valign="top">';
+s += ' <tr><td colspan="6"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="2"></td></tr>';
+s += ' <tr valign="top">';
+s += ' <td rowspan="6" width="10"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="10" height="1"></td>';
+s += ' <td colspan="3"><span class="cnnMenuText" style="font-size: 12px"><b style="color: #c00">From our Partners</b></span>';
+s += ' <img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/icon_external.gif" alt=" External site icon " width="20" height="13" border="0" align="middle"></td>';
+s += ' <td colspan="2"></td>';
+s += ' </tr>';
+s += ' <tr><td colspan="5"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="2"></td></tr>';
+s += ' <tr><td colspan="5" bgcolor="#CCCCCC"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="1"></td></tr>';
+s += ' <tr><td colspan="5"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="2"></td></tr>';
+s += ' <tr valign="top">';
+s += ' <td class="cnnMainSections" width="250">';
+s += '<a href="/time/" target="new"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/partner_time.gif" alt="Time: " width="70" height="17" border="0"></a><br><div style="margin-top: 4px"> &#8226;&nbsp;<a target="new" href="/time/magazine/article/0,9171,1101030616-457387,00.html?CNN=yes">Where the Jobs Are</a><br> &#8226;&nbsp;<a target="new" href="/time/magazine/article/0,9171,1101030616-457373,00.html?CNN=yes">Of Dogs and Men</a><br> &#8226;&nbsp;<a target="new" href="/time/photoessays/gunmen/?CNN=yes">Photo Essay: Fighting the Peace</a><br></div><table border="0"><tr><td><img height="1" width="1" alt="" src="http://i.cnn.net/cnn/images/1.gif"/></td></tr><tr bgcolor="#dddddd"><td>&nbsp;&nbsp;<a target="new" href="/linkto/time.main.html">Subscribe to TIME</a>&nbsp;&nbsp;</td></tr></table> </td>';
+s += ' <td width="5"><br></td>';
+s += ' <td class="cnnMainSections" width="250">';
+s += '<a href="/cnnsi/index.html?cnn=yes"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/partner_si.gif" alt="CNNsi.com: " width="138" height="17" border="0"></a><br><div style="margin-top: 4px">';
+s += '&#8226;&nbsp;Marty Burns: <a target="new" href="/cnnsi/inside_game/marty_burns/news/2003/06/11/burns_game4/">Nets pull out all stops</a><br>';
+s += '&#8226;&nbsp;Michael Farber: <a target="new" href="/cnnsi/inside_game/michael_farber/news/2003/06/11/farber_wrapup/">Sens look good for "04</a><br>';
+s += '&#8226;&nbsp;Tim Layden: <a target="new" href="/cnnsi/inside_game/tim_layden/news/2003/06/11/layden_neuheisel/">NFL or bust for Neuheisel</a><br>';
+s += '</div>';
+s += '<table border="0"><tr><td><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="1"></td></tr><tr bgcolor="#dddddd"><td>&nbsp;&nbsp;<a href="http://subs.timeinc.net/CampaignHandler/si_cnnsi?source_id=19">Subscribe to Sports Illustrated</a>&nbsp;&nbsp;</td></tr></table>';
+s += ' </td>';
+s += ' <td width="5"><br></td>';
+s += ' <td class="cnnMainSections" width="250">';
+s += '<a href="/linkto/nyt/main.banner.html" target="new"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/partners_nyt.gif" alt="New York Times: " width="105" height="17" border="0"></a><br><div style="margin-top: 4px"> &#8226;&nbsp;<a target="new" href="/linkto/nyt/story/1.0612.html">U.S. Widens Checks at Foreign Ports</a><br> &#8226;&nbsp;<a target="new" href="/linkto/nyt/story/2.0612.html">Rumsfeld: Iran Developing Nuclear Arms</a><br> &#8226;&nbsp;<a target="new" href="/linkto/nyt/story/3.0612.html">Vandalism, "Improvements" Mar Great Wall</a><br></div><table border="0"><tr><td><img height="1" width="1" alt="" src="http://i.cnn.net/cnn/images/1.gif"/></td></tr><tr bgcolor="#dddddd"><td>&nbsp;&nbsp;<a target="new" href="/linkto/nyt.main.html">Get 50% OFF the NY Times</a>&nbsp;&nbsp;</td></tr></table> </td>';
+s += ' </tr>';
+s += '';
+s += '</table>';
+s += '<div><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="2"></div>';
+s += '';
+s += '<table width="770" border="0" cellpadding="0" cellspacing="0">';
+s += ' <tr>';
+s += ' <td width="10"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="10" height="10"></td>';
+s += ' <td width="760">';
+s += '<!-- floor -->';
+s += '';
+s += '<table width="100%" border="0" cellpadding="0" cellspacing="0"><tr><td bgcolor="#999999"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="1"></td></tr></table>';
+s += '';
+s += '<div><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="1"></div>';
+s += '';
+s += '<table width="100%" bgcolor="#DEDEDE" border="0" cellpadding="3" cellspacing="0">';
+s += ' <tr> ';
+s += ' <td><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="5" height="5"></td>';
+s += ' <td><a href="http://edition.cnn.com/" class="cnnFormTextB" onClick="clickEdLink()" style="color:#000;">International Edition</a></td>';
+s += '<form>';
+s += ' <td><select title="CNN.com is available in different languages" class="cnnMenuText" name="languages" size="1" style="font-weight: bold; vertical-align: middle" onChange="if (this.options[selectedIndex].value != "") location.href=this.options[selectedIndex].value">';
+s += ' <option value="" disabled selected>Languages</option>';
+s += ' <option value="" disabled>---------</option>';
+s += ' <option value="/cnnes/">Spanish</option>';
+s += ' <option value="http://cnn.de/">German</option>';
+s += ' <option value="http://cnnitalia.it/">Italian</option>';
+s += ' <option value="http://www.joins.com/cnn/">Korean</option>';
+s += ' <option value="http://arabic.cnn.com/">Arabic</option>';
+s += ' <option value="http://www.CNN.co.jp/">Japanese</option>';
+s += ' </select></td>';
+s += '</form>';
+s += ' <td><a href="/CNN/Programs/" class="cnnFormTextB" style="color:#000;">CNN TV</a></td>';
+s += ' <td><a href="/CNNI/" class="cnnFormTextB" style="color:#000;">CNN International</a></td>';
+s += ' <td><a href="/HLN/" class="cnnFormTextB" style="color:#000;">Headline News</a></td>';
+s += ' <td><a href="/TRANSCRIPTS/" class="cnnFormTextB" style="color:#000;">Transcripts</a></td>';
+s += ' <td><a href="/services/preferences/" title="Customize your CNN.com experience" class="cnnFormTextB" style="color:#000;">Preferences</a></td>';
+s += ' <td><a href="/INDEX/about.us/" class="cnnFormTextB" style="color:#000;">About CNN.com</a></td>';
+s += ' </tr>';
+s += '</table>';
+s += '';
+s += '<div><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="1"></div>';
+s += '';
+s += '<table width="100%" bgcolor="#EFEFEF" border="0" cellpadding="4" cellspacing="0">';
+s += ' <tr valign="top"> ';
+s += ' <td style="padding-left:10px"><div class="cnnSectCopyright">';
+s += '<b>&copy; 2003 Cable News Network LP, LLLP.</b><br>';
+s += 'An AOL Time Warner Company. All Rights Reserved.<br>';
+s += '<a href="/interactive_legal.html">Terms</a> under which this service is provided to you.<br>';
+s += 'Read our <a href="/privacy.html">privacy guidelines</a>. <a href="/feedback/">Contact us</a>.';
+s += ' </div></td>';
+s += ' <td align="right"><table border="0" cellpadding="4" cellspacing="0">';
+s += ' <tr> ';
+s += ' <td rowspan="2" align="middle"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/sect/SEARCH/dotted.line.gif" alt="" width="7" height="46"></td>';
+s += ' <td><img src="http://i.a.cnn.net/cnn/.element/img/1.0/misc/icon.external.links.gif" alt="external link" width="20" height="13"></td>';
+s += ' <td><div class="cnnSectExtSites">All external sites will open in a new browser.<br>';
+s += ' CNN.com does not endorse external sites.</div></td>';
+s += ' <td rowspan="2" align="middle"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/sect/SEARCH/dotted.line.gif" alt="" width="7" height="46"></td>';
+s += ' <td rowspan="2"><!-- home/powered_by/sponsor.88x31 -->';
+s += '<script language="JavaScript1.1">';
+s += '<!--';
+s += 'adSetTarget("_top");';
+s += 'htmlAdWH( (new Array(93103308,93103308,93103308,93103308))[document.adoffset||0] , 88, 31);';
+s += '//-->';
+s += '</script><noscript><a href="http://ar.atwola.com/link/93103308/aol" target="_top"><img src="http://ar.atwola.com/image/93103308/aol" alt="Click here for our advertiser" width="88" height="31" border="0"></a></noscript>';
+s += '</td>';
+s += ' </tr>';
+s += ' <tr valign="top"> ';
+s += ' <td><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/icon_premium.gif" alt=" Premium content icon " width="9" height="11"></td>';
+s += ' <td><span class="cnnSectExtSites">Denotes premium content.</span></td>';
+s += ' </tr>';
+s += ' </table></td>';
+s += ' </tr>';
+s += '</table>';
+s += '';
+s += '<!-- /floor --></td>';
+s += ' </tr>';
+s += '</table>';
+s += '';
+s += '';
+s += '';
+s += '<!-- popunder ad generic/popunder_launch.720x300 -->';
+s += '<script language="JavaScript1.1" type="text/javascript">';
+s += '<!--';
+s += 'if (document.adPopupFile) {';
+s += ' if (document.adPopupInterval == null) {';
+s += ' document.adPopupInterval = "0";';
+s += ' }';
+s += ' if (document.adPopunderInterval == null) {';
+s += ' document.adPopunderInterval = document.adPopupInterval;';
+s += ' }';
+s += ' if (document.adPopupDomain != null) {';
+s += ' adSetPopDm(document.adPopupDomain);';
+s += ' }';
+s += ' adSetPopupWH("93162673", "720", "300", document.adPopupFile, document.adPopunderInterval, 20, 50, -1);';
+s += '}';
+s += '// -->';
+s += '</script>';
+s += ' ';
+s += '<!-- home/bottom.eyeblaster -->';
+s += '<script language="JavaScript1.1" type="text/javascript">';
+s += '<!--';
+s += 'var MacPPC = (navigator.platform == "MacPPC") ? true : false;';
+s += 'if (!MacPPC) {';
+s += 'adSetType("J");';
+s += 'htmlAdWH( (new Array(93137910,93137910,93137910,93137910))[document.adoffset||0], 101, 1);';
+s += 'adSetType("");';
+s += '}';
+s += '// -->';
+s += '</script>';
+s += '';
+s += '<script language="JavaScript1.1" src="http://ar.atwola.com/file/adsEnd.js"></script>';
+s += '';
+s += '<img src="/cookie.crumb" alt="" width="1" height="1">';
+s += '<!--include virtual="/virtual/2002/main/survey.html"-->';
+s += '</body>';
+s += '</html>';
+
+return s;
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-209919.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-209919.js
new file mode 100644
index 0000000..e1bb76c
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-209919.js
@@ -0,0 +1,169 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2003
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): sagdjb@softwareag.com, pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 19 June 2003
+* SUMMARY: Testing regexp submatches with quantifiers
+*
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=209919
+*
+*/
+//-----------------------------------------------------------------------------
+var i = 0;
+var bug = 209919;
+var summary = 'Testing regexp submatches with quantifiers';
+var status = '';
+var statusmessages = new Array();
+var pattern = '';
+var patterns = new Array();
+var string = '';
+var strings = new Array();
+var actualmatch = '';
+var actualmatches = new Array();
+var expectedmatch = '';
+var expectedmatches = new Array();
+
+
+/*
+ * Waldemar: "ECMA-262 15.10.2.5, third algorithm, step 2.1 states that
+ * once the minimum repeat count (which is 0 for *, 1 for +, etc.) has
+ * been satisfied, an atom being repeated must not match the empty string."
+ *
+ * In this example, the minimum repeat count is 0, so the last thing the
+ * capturing parens is permitted to contain is the 'a'. It may NOT go on
+ * to capture the '' at the $ position of 'a', even though '' satifies
+ * the condition b*
+ *
+ */
+status = inSection(1);
+string = 'a';
+pattern = /(a|b*)*/;
+actualmatch = string.match(pattern);
+expectedmatch = Array(string, 'a');
+addThis();
+
+
+/*
+ * In this example, the minimum repeat count is 5, so the capturing parens
+ * captures the 'a', then goes on to capture the '' at the $ position of 'a'
+ * 4 times before it has to stop. Therefore the last thing it contains is ''.
+ */
+status = inSection(2);
+string = 'a';
+pattern = /(a|b*){5,}/;
+actualmatch = string.match(pattern);
+expectedmatch = Array(string, '');
+addThis();
+
+
+/*
+ * Reduction of the above examples to contain only the condition b*
+ * inside the capturing parens. This can be even harder to grasp!
+ *
+ * The global match is the '' at the ^ position of 'a', but the parens
+ * is NOT permitted to capture it since the minimum repeat count is 0!
+ */
+status = inSection(3);
+string = 'a';
+pattern = /(b*)*/;
+actualmatch = string.match(pattern);
+expectedmatch = Array('', undefined);
+addThis();
+
+
+/*
+ * Here we have used the + quantifier (repeat count 1) outside the parens.
+ * Therefore the parens must capture at least once before stopping, so it
+ * does capture the '' this time -
+ */
+status = inSection(4);
+string = 'a';
+pattern = /(b*)+/;
+actualmatch = string.match(pattern);
+expectedmatch = Array('', '');
+addThis();
+
+
+/*
+ * More complex examples -
+ */
+pattern = /^\-?(\d{1,}|\.{0,})*(\,\d{1,})?$/;
+
+ status = inSection(5);
+ string = '100.00';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array(string, '00', undefined);
+ addThis();
+
+ status = inSection(6);
+ string = '100,00';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array(string, '100', ',00');
+ addThis();
+
+ status = inSection(7);
+ string = '1.000,00';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array(string, '000', ',00');
+ addThis();
+
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusmessages[i] = status;
+ patterns[i] = pattern;
+ strings[i] = string;
+ actualmatches[i] = actualmatch;
+ expectedmatches[i] = expectedmatch;
+ i++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+ testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-216591.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-216591.js
new file mode 100644
index 0000000..cc86d73
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-216591.js
@@ -0,0 +1,112 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2003
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): okin7@yahoo.fr, pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 19 August 2003
+* SUMMARY: Regexp conformance test
+*
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=216591
+*
+*/
+//-----------------------------------------------------------------------------
+var i = 0;
+var bug = 216591;
+var summary = 'Regexp conformance test';
+var status = '';
+var statusmessages = new Array();
+var pattern = '';
+var patterns = new Array();
+var string = '';
+var strings = new Array();
+var actualmatch = '';
+var actualmatches = new Array();
+var expectedmatch = '';
+var expectedmatches = new Array();
+
+
+status = inSection(1);
+string = 'a {result.data.DATA} b';
+pattern = /\{(([a-z0-9\-_]+?\.)+?)([a-z0-9\-_]+?)\}/i;
+actualmatch = string.match(pattern);
+expectedmatch = Array('{result.data.DATA}', 'result.data.', 'data.', 'DATA');
+addThis();
+
+/*
+ * Add a global flag to the regexp. In Perl 5, this gives the same results as above. Compare:
+ *
+ * [ ] perl -e '"a {result.data.DATA} b" =~ /\{(([a-z0-9\-_]+?\.)+?)([a-z0-9\-_]+?)\}/i; print("$&, $1, $2, $3");'
+ * {result.data.DATA}, result.data., data., DATA
+ *
+ * [ ] perl -e '"a {result.data.DATA} b" =~ /\{(([a-z0-9\-_]+?\.)+?)([a-z0-9\-_]+?)\}/gi; print("$&, $1, $2, $3");'
+ * {result.data.DATA}, result.data., data., DATA
+ *
+ *
+ * But in JavaScript, there will no longer be any sub-captures:
+ */
+status = inSection(2);
+string = 'a {result.data.DATA} b';
+pattern = /\{(([a-z0-9\-_]+?\.)+?)([a-z0-9\-_]+?)\}/gi;
+actualmatch = string.match(pattern);
+expectedmatch = Array('{result.data.DATA}');
+addThis();
+
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusmessages[i] = status;
+ patterns[i] = pattern;
+ strings[i] = string;
+ actualmatches[i] = actualmatch;
+ expectedmatches[i] = expectedmatch;
+ i++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+ testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-220367-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-220367-001.js
new file mode 100644
index 0000000..e6a767e
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-220367-001.js
@@ -0,0 +1,99 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2003
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): igor@fastmail.fm, pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 26 September 2003
+* SUMMARY: Regexp conformance test
+*
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=220367
+*
+*/
+//-----------------------------------------------------------------------------
+var i = 0;
+var bug = 220367;
+var summary = 'Regexp conformance test';
+var status = '';
+var statusmessages = new Array();
+var pattern = '';
+var patterns = new Array();
+var string = '';
+var strings = new Array();
+var actualmatch = '';
+var actualmatches = new Array();
+var expectedmatch = '';
+var expectedmatches = new Array();
+
+
+status = inSection(1);
+string = 'a';
+pattern = /(a)|(b)/;
+actualmatch = string.match(pattern);
+expectedmatch = Array(string, 'a', undefined);
+addThis();
+
+status = inSection(2);
+string = 'b';
+pattern = /(a)|(b)/;
+actualmatch = string.match(pattern);
+expectedmatch = Array(string, undefined, 'b');
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusmessages[i] = status;
+ patterns[i] = pattern;
+ strings[i] = string;
+ actualmatches[i] = actualmatch;
+ expectedmatches[i] = expectedmatch;
+ i++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+ testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-220367-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-220367-002.js
new file mode 100644
index 0000000..62eec23
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-220367-002.js
@@ -0,0 +1,107 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2003
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): igor@fastmail.fm, pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 26 September 2003
+* SUMMARY: Regexp conformance test
+*
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=220367
+*
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 220367;
+var summary = 'Regexp conformance test';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+var re = /(a)|(b)/;
+
+re.test('a');
+ status = inSection(1);
+ actual = RegExp.$1;
+ expect = 'a';
+ addThis();
+
+ status = inSection(2);
+ actual = RegExp.$2;
+ expect = '';
+ addThis();
+
+re.test('b');
+ status = inSection(3);
+ actual = RegExp.$1;
+ expect = '';
+ addThis();
+
+ status = inSection(4);
+ actual = RegExp.$2;
+ expect = 'b';
+ addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-24712.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-24712.js
new file mode 100644
index 0000000..41c17f6
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-24712.js
@@ -0,0 +1,42 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ * Rob Ginda rginda@netscape.com
+ */
+
+test();
+
+function test()
+{
+ enterFunc ("test");
+
+ printBugNumber (24712);
+
+ var re = /([\S]+([ \t]+[\S]+)*)[ \t]*=[ \t]*[\S]+/;
+ var result = re.exec("Course_Creator = Test");
+
+ if (!result)
+ reportFailure ("exec() returned null.");
+
+ exitFunc ("test");
+
+}
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-28686.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-28686.js
new file mode 100644
index 0000000..599f613
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-28686.js
@@ -0,0 +1,39 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ * Rob Ginda rginda@netscape.com
+ */
+
+test();
+
+function test()
+{
+ enterFunc ("test");
+
+ printBugNumber (28686);
+
+ var str = 'foo "bar" baz';
+ reportCompare ('foo \\"bar\\" baz', str.replace(/([\'\"])/g, "\\$1"),
+ "str.replace failed.");
+
+ exitFunc ("test");
+
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-31316.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-31316.js
new file mode 100644
index 0000000..b68e42a
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-31316.js
@@ -0,0 +1,75 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS"
+* basis, WITHOUT WARRANTY OF ANY KIND, either expressed
+* or implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation.
+* All Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+* Date: 01 May 2001
+*
+* SUMMARY: Regression test for Bugzilla bug 31316:
+* "Rhino: Regexp matches return garbage"
+*
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=31316
+*/
+//-------------------------------------------------------------------------------------------------
+var i = 0;
+var bug = 31316;
+var summary = 'Regression test for Bugzilla bug 31316';
+var cnEmptyString = '';
+var status = '';
+var statusmessages = new Array();
+var pattern = '';
+var patterns = new Array();
+var string = '';
+var strings = new Array();
+var actualmatch = '';
+var actualmatches = new Array();
+var expectedmatch = '';
+var expectedmatches = new Array();
+
+
+status = inSection(1);
+pattern = /<([^\/<>][^<>]*[^\/])>|<([^\/<>])>/;
+string = '<p>Some<br />test</p>';
+actualmatch = string.match(pattern);
+expectedmatch = Array('<p>', undefined, 'p');
+addThis();
+
+
+//-------------------------------------------------------------------------------------------------
+test();
+//-------------------------------------------------------------------------------------------------
+
+
+function addThis()
+{
+ statusmessages[i] = status;
+ patterns[i] = pattern;
+ strings[i] = string;
+ actualmatches[i] = actualmatch;
+ expectedmatches[i] = expectedmatch;
+ i++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+ testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-57572.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-57572.js
new file mode 100644
index 0000000..de9834a
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-57572.js
@@ -0,0 +1,129 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS"
+* basis, WITHOUT WARRANTY OF ANY KIND, either expressed
+* or implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation.
+* All Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+* Date: 28 December 2000
+*
+* SUMMARY: Testing regular expressions containing the ? character.
+* Arose from Bugzilla bug 57572: "RegExp with ? matches incorrectly"
+*
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=57572
+*
+*/
+//-----------------------------------------------------------------------------
+var i = 0;
+var bug = 57572;
+var summary = 'Testing regular expressions containing "?"';
+var cnEmptyString = ''; var cnSingleSpace = ' ';
+var status = '';
+var statusmessages = new Array();
+var pattern = '';
+var patterns = new Array();
+var string = '';
+var strings = new Array();
+var actualmatch = '';
+var actualmatches = new Array();
+var expectedmatch = '';
+var expectedmatches = new Array();
+
+
+status = inSection(1);
+pattern = /(\S+)?(.*)/;
+string = 'Test this';
+actualmatch = string.match(pattern);
+expectedmatch = Array(string, 'Test', ' this'); //single space in front of 'this'
+addThis();
+
+status = inSection(2);
+pattern = /(\S+)? ?(.*)/; //single space between the ? characters
+string= 'Test this';
+actualmatch = string.match(pattern);
+expectedmatch = Array(string, 'Test', 'this'); //NO space in front of 'this'
+addThis();
+
+status = inSection(3);
+pattern = /(\S+)?(.*)/;
+string = 'Stupid phrase, with six - (short) words';
+actualmatch = string.match(pattern);
+expectedmatch = Array(string, 'Stupid', ' phrase, with six - (short) words'); //single space in front of 'phrase'
+addThis();
+
+status = inSection(4);
+pattern = /(\S+)? ?(.*)/; //single space between the ? characters
+string = 'Stupid phrase, with six - (short) words';
+actualmatch = string.match(pattern);
+expectedmatch = Array(string, 'Stupid', 'phrase, with six - (short) words'); //NO space in front of 'phrase'
+addThis();
+
+
+// let's add an extra back-reference this time - three instead of two -
+status = inSection(5);
+pattern = /(\S+)?( ?)(.*)/; //single space before second ? character
+string = 'Stupid phrase, with six - (short) words';
+actualmatch = string.match(pattern);
+expectedmatch = Array(string, 'Stupid', cnSingleSpace, 'phrase, with six - (short) words');
+addThis();
+
+status = inSection(6);
+pattern = /^(\S+)?( ?)(B+)$/; //single space before second ? character
+string = 'AAABBB';
+actualmatch = string.match(pattern);
+expectedmatch = Array(string, 'AAABB', cnEmptyString, 'B');
+addThis();
+
+status = inSection(7);
+pattern = /(\S+)?(!?)(.*)/;
+string = 'WOW !!! !!!';
+actualmatch = string.match(pattern);
+expectedmatch = Array(string, 'WOW', cnEmptyString, ' !!! !!!');
+addThis();
+
+status = inSection(8);
+pattern = /(.+)?(!?)(!+)/;
+string = 'WOW !!! !!!';
+actualmatch = string.match(pattern);
+expectedmatch = Array(string, 'WOW !!! !!', cnEmptyString, '!');
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusmessages[i] = status;
+ patterns[i] = pattern;
+ strings[i] = string;
+ actualmatches[i] = actualmatch;
+ expectedmatches[i] = expectedmatch;
+ i++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+ testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-57631.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-57631.js
new file mode 100644
index 0000000..1917ed4
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-57631.js
@@ -0,0 +1,128 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS
+* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+* implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation. All
+* Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+* Date: 26 November 2000
+*
+*
+* SUMMARY: This test arose from Bugzilla bug 57631:
+* "RegExp with invalid pattern or invalid flag causes segfault"
+*
+* Either error should throw an exception of type SyntaxError,
+* and we check to see that it does...
+*/
+//-------------------------------------------------------------------------------------------------
+var bug = '57631';
+var summary = 'Testing new RegExp(pattern,flag) with illegal pattern or flag';
+var statprefix = 'Testing for error creating illegal RegExp object on pattern ';
+var statsuffix = 'and flag ';
+var cnSUCCESS = 'SyntaxError';
+var cnFAILURE = 'not a SyntaxError';
+var singlequote = "'";
+var i = -1; var j = -1; var s = ''; var f = '';
+var obj = {};
+var status = ''; var actual = ''; var expect = ''; var msg = '';
+var legalpatterns = new Array(); var illegalpatterns = new Array();
+var legalflags = new Array(); var illegalflags = new Array();
+
+
+// valid regular expressions to try -
+legalpatterns[0] = '';
+legalpatterns[1] = 'abc';
+legalpatterns[2] = '(.*)(3-1)\s\w';
+legalpatterns[3] = '(.*)(...)\\s\\w';
+legalpatterns[4] = '[^A-Za-z0-9_]';
+legalpatterns[5] = '[^\f\n\r\t\v](123.5)([4 - 8]$)';
+
+// invalid regular expressions to try -
+illegalpatterns[0] = '()';
+illegalpatterns[1] = '(a';
+illegalpatterns[2] = '( ]';
+illegalpatterns[3] = '\d{s}';
+
+// valid flags to try -
+legalflags[0] = 'i';
+legalflags[1] = 'g';
+legalflags[2] = 'm';
+legalflags[3] = undefined;
+
+// invalid flags to try -
+illegalflags[0] = 'a';
+illegalflags[1] = 123;
+illegalflags[2] = new RegExp();
+
+
+
+//-------------------------------------------------------------------------------------------------
+test();
+//-------------------------------------------------------------------------------------------------
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ testIllegalRegExps(legalpatterns, illegalflags);
+ testIllegalRegExps(illegalpatterns, legalflags);
+ testIllegalRegExps(illegalpatterns, illegalflags);
+
+ exitFunc ('test');
+}
+
+
+// This function will only be called where all the patterns are illegal, or all the flags
+function testIllegalRegExps(patterns, flags)
+{
+ for (i in patterns)
+ {
+ s = patterns[i];
+
+ for (j in flags)
+ {
+ f = flags[j];
+ status = getStatus(s, f);
+
+ try
+ {
+ // This should cause an exception if either s or f is illegal -
+ eval('obj = new RegExp(s, f);');
+ }
+ catch(e)
+ {
+ // We expect to get a SyntaxError - test for this:
+ actual = (e instanceof SyntaxError)? cnSUCCESS : cnFAILURE;
+ expect = cnSUCCESS;
+ reportCompare(expect, actual, status);
+ }
+ }
+ }
+}
+
+
+function getStatus(regexp, flag)
+{
+ return (statprefix + quote(regexp) + statsuffix + quote(flag));
+}
+
+
+function quote(text)
+{
+ return (singlequote + text + singlequote);
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-67773.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-67773.js
new file mode 100644
index 0000000..e399050
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-67773.js
@@ -0,0 +1,190 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS"
+* basis, WITHOUT WARRANTY OF ANY KIND, either expressed
+* or implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation.
+* All Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+* Date: 06 February 2001
+*
+* SUMMARY: Arose from Bugzilla bug 67773:
+* "Regular subexpressions followed by + failing to run to completion"
+*
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=67773
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=69989
+*/
+//-------------------------------------------------------------------------------------------------
+var i = 0;
+var bug = 67773;
+var summary = 'Testing regular subexpressions followed by ? or +\n';
+var cnSingleSpace = ' ';
+var status = '';
+var statusmessages = new Array();
+var pattern = '';
+var patterns = new Array();
+var string = '';
+var strings = new Array();
+var actualmatch = '';
+var actualmatches = new Array();
+var expectedmatch = '';
+var expectedmatches = new Array();
+
+
+pattern = /^(\S+)?( ?)(B+)$/; //single space before second ? character
+ status = inSection(1);
+ string = 'AAABBB AAABBB '; //single space at middle and at end -
+ actualmatch = string.match(pattern);
+ expectedmatch = null;
+ addThis();
+
+ status = inSection(2);
+ string = 'AAABBB BBB'; //single space in the middle
+ actualmatch = string.match(pattern);
+ expectedmatch = Array(string, 'AAABBB', cnSingleSpace, 'BBB');
+ addThis();
+
+ status = inSection(3);
+ string = 'AAABBB AAABBB'; //single space in the middle
+ actualmatch = string.match(pattern);
+ expectedmatch = null;
+ addThis();
+
+
+pattern = /^(A+B)+$/;
+ status = inSection(4);
+ string = 'AABAAB';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array(string, 'AAB');
+ addThis();
+
+ status = inSection(5);
+ string = 'ABAABAAAAAAB';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array(string, 'AAAAAAB');
+ addThis();
+
+ status = inSection(6);
+ string = 'ABAABAABAB';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array(string, 'AB');
+ addThis();
+
+ status = inSection(7);
+ string = 'ABAABAABABB';
+ actualmatch = string.match(pattern);
+ expectedmatch = null; // because string doesn't match at end
+ addThis();
+
+
+pattern = /^(A+1)+$/;
+ status = inSection(8);
+ string = 'AA1AA1';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array(string, 'AA1');
+ addThis();
+
+
+pattern = /^(\w+\-)+$/;
+ status = inSection(9);
+ string = '';
+ actualmatch = string.match(pattern);
+ expectedmatch = null;
+ addThis();
+
+ status = inSection(10);
+ string = 'bla-';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array(string, string);
+ addThis();
+
+ status = inSection(11);
+ string = 'bla-bla'; // hyphen missing at end -
+ actualmatch = string.match(pattern);
+ expectedmatch = null; //because string doesn't match at end
+ addThis();
+
+ status = inSection(12);
+ string = 'bla-bla-';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array(string, 'bla-');
+ addThis();
+
+
+pattern = /^(\S+)+(A+)$/;
+ status = inSection(13);
+ string = 'asdldflkjAAA';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array(string, 'asdldflkjAA', 'A');
+ addThis();
+
+ status = inSection(14);
+ string = 'asdldflkj AAA'; // space in middle
+ actualmatch = string.match(pattern);
+ expectedmatch = null; //because of the space
+ addThis();
+
+
+pattern = /^(\S+)+(\d+)$/;
+ status = inSection(15);
+ string = 'asdldflkj122211';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array(string, 'asdldflkj12221', '1');
+ addThis();
+
+ status = inSection(16);
+ string = 'asdldflkj1111111aaa1';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array(string, 'asdldflkj1111111aaa', '1');
+ addThis();
+
+
+/*
+ * This one comes from Stephen Ostermiller.
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=69989
+ */
+pattern = /^[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)+$/;
+ status = inSection(17);
+ string = 'some.host.tld';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array(string, '.tld', '.');
+ addThis();
+
+
+
+//-------------------------------------------------------------------------------------------------
+test();
+//-------------------------------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusmessages[i] = status;
+ patterns[i] = pattern;
+ strings[i] = string;
+ actualmatches[i] = actualmatch;
+ expectedmatches[i] = expectedmatch;
+ i++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+ testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-72964.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-72964.js
new file mode 100644
index 0000000..5965313
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-72964.js
@@ -0,0 +1,100 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS"
+* basis, WITHOUT WARRANTY OF ANY KIND, either expressed
+* or implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation.
+* All Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+* Date: 2001-07-17
+*
+* SUMMARY: Regression test for Bugzilla bug 72964:
+* "String method for pattern matching failed for Chinese Simplified (GB2312)"
+*
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=72964
+*/
+//-----------------------------------------------------------------------------
+var i = 0;
+var bug = 72964;
+var summary = 'Testing regular expressions containing non-Latin1 characters';
+var cnSingleSpace = ' ';
+var status = '';
+var statusmessages = new Array();
+var pattern = '';
+var patterns = new Array();
+var string = '';
+var strings = new Array();
+var actualmatch = '';
+var actualmatches = new Array();
+var expectedmatch = '';
+var expectedmatches = new Array();
+
+
+pattern = /[\S]+/;
+ // 4 low Unicode chars = Latin1; whole string should match
+ status = inSection(1);
+ string = '\u00BF\u00CD\u00BB\u00A7';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array(string);
+ addThis();
+
+ // Now put a space in the middle; first half of string should match
+ status = inSection(2);
+ string = '\u00BF\u00CD \u00BB\u00A7';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('\u00BF\u00CD');
+ addThis();
+
+
+ // 4 high Unicode chars = non-Latin1; whole string should match
+ status = inSection(3);
+ string = '\u4e00\uac00\u4e03\u4e00';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array(string);
+ addThis();
+
+ // Now put a space in the middle; first half of string should match
+ status = inSection(4);
+ string = '\u4e00\uac00 \u4e03\u4e00';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('\u4e00\uac00');
+ addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusmessages[i] = status;
+ patterns[i] = pattern;
+ strings[i] = string;
+ actualmatches[i] = actualmatch;
+ expectedmatches[i] = expectedmatch;
+ i++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+ testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-76683.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-76683.js
new file mode 100644
index 0000000..59b95b9
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-76683.js
@@ -0,0 +1,93 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS"
+* basis, WITHOUT WARRANTY OF ANY KIND, either expressed
+* or implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation.
+* All Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+* Date: 01 May 2001
+*
+* SUMMARY: Regression test for Bugzilla bug 76683 on Rhino:
+* "RegExp regression (NullPointerException)"
+*
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=76683
+*/
+//-------------------------------------------------------------------------------------------------
+var i = 0;
+var bug = 76683;
+var summary = 'Regression test for Bugzilla bug 76683';
+var status = '';
+var statusmessages = new Array();
+var pattern = '';
+var patterns = new Array();
+var string = '';
+var strings = new Array();
+var actualmatch = '';
+var actualmatches = new Array();
+var expectedmatch = '';
+var expectedmatches = new Array();
+
+
+/*
+ * Rhino (2001-04-19) crashed on the 3rd regular expression below.
+ * It didn't matter what the string was. No problem in SpiderMonkey -
+ */
+string = 'abc';
+ status = inSection(1);
+ pattern = /(<!--([^-]|-[^-]|--[^>])*-->)|(<([\$\w:\.\-]+)((([ ][^\/>]*)?\/>)|(([ ][^>]*)?>)))/;
+ actualmatch = string.match(pattern);
+ expectedmatch = null;
+ addThis();
+
+ status = inSection(2);
+ pattern = /(<!--([^-]|-[^-]|--[^>])*-->)|(<(tagPattern)((([ ][^\/>]*)?\/>)|(([ ][^>]*)?>)))/;
+ actualmatch = string.match(pattern);
+ expectedmatch = null;
+ addThis();
+
+ // This was the one causing a Rhino crash -
+ status = inSection(3);
+ pattern = /(<!--([^-]|-[^-]|--[^>])*-->)|(<(tagPattern)((([ ][^\/>]*)?\/>)|(([ ][^>]*)?>)))|(<\/tagPattern[^>]*>)/;
+ actualmatch = string.match(pattern);
+ expectedmatch = null;
+ addThis();
+
+
+
+//-------------------------------------------------------------------------------------------------
+test();
+//-------------------------------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusmessages[i] = status;
+ patterns[i] = pattern;
+ strings[i] = string;
+ actualmatches[i] = actualmatch;
+ expectedmatches[i] = expectedmatch;
+ i++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+ testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-78156.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-78156.js
new file mode 100644
index 0000000..08947ce
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-78156.js
@@ -0,0 +1,102 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS"
+* basis, WITHOUT WARRANTY OF ANY KIND, either expressed
+* or implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation.
+* All Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+* Date: 06 February 2001
+*
+* SUMMARY: Arose from Bugzilla bug 78156:
+* "m flag of regular expression does not work with $"
+*
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=78156
+*
+* The m flag means a regular expression should search strings
+* across multiple lines, i.e. across '\n', '\r'.
+*/
+//-------------------------------------------------------------------------------------------------
+var i = 0;
+var bug = 78156;
+var summary = 'Testing regular expressions with ^, $, and the m flag -';
+var status = '';
+var statusmessages = new Array();
+var pattern = '';
+var patterns = new Array();
+var string = '';
+var strings = new Array();
+var actualmatch = '';
+var actualmatches = new Array();
+var expectedmatch = '';
+var expectedmatches = new Array();
+
+/*
+ * All patterns have an m flag; all strings are multiline.
+ * Looking for digit characters at beginning/end of lines.
+ */
+
+string = 'aaa\n789\r\nccc\r\n345';
+ status = inSection(1);
+ pattern = /^\d/gm;
+ actualmatch = string.match(pattern);
+ expectedmatch = ['7','3'];
+ addThis();
+
+ status = inSection(2);
+ pattern = /\d$/gm;
+ actualmatch = string.match(pattern);
+ expectedmatch = ['9','5'];
+ addThis();
+
+string = 'aaa\n789\r\nccc\r\nddd';
+ status = inSection(3);
+ pattern = /^\d/gm;
+ actualmatch = string.match(pattern);
+ expectedmatch = ['7'];
+ addThis();
+
+ status = inSection(4);
+ pattern = /\d$/gm;
+ actualmatch = string.match(pattern);
+ expectedmatch = ['9'];
+ addThis();
+
+
+
+//-------------------------------------------------------------------------------------------------
+test();
+//-------------------------------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusmessages[i] = status;
+ patterns[i] = pattern;
+ strings[i] = string;
+ actualmatches[i] = actualmatch;
+ expectedmatches[i] = expectedmatch;
+ i++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+ testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-85721.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-85721.js
new file mode 100644
index 0000000..41f5bc0
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-85721.js
@@ -0,0 +1,271 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2002
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): rogerl@netscape.com, pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 14 Feb 2002
+* SUMMARY: Performance: Regexp performance degraded from 4.7
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=85721
+*
+* Adjust this testcase if necessary. The FAST constant defines
+* an upper bound in milliseconds for any execution to take.
+*
+*/
+//-----------------------------------------------------------------------------
+var bug = 85721;
+var summary = 'Performance: execution of regular expression';
+var FAST = 100; // execution should be 100 ms or less to pass the test
+var MSG_FAST = 'Execution took less than ' + FAST + ' ms';
+var MSG_SLOW = 'Execution took ';
+var MSG_MS = ' ms';
+var str = '';
+var re = '';
+var status = '';
+var actual = '';
+var expect= '';
+
+printBugNumber (bug);
+printStatus (summary);
+
+
+function elapsedTime(startTime)
+{
+ return new Date() - startTime;
+}
+
+
+function isThisFast(ms)
+{
+ if (ms <= FAST)
+ return MSG_FAST;
+ return MSG_SLOW + ms + MSG_MS;
+}
+
+
+
+/*
+ * The first regexp. We'll test for performance (Section 1) and accuracy (Section 2).
+ */
+str='<sql:connection id="conn1"> <sql:url>www.m.com</sql:url> <sql:driver>drive.class</sql:driver>\n<sql:userId>foo</sql:userId> <sql:password>goo</sql:password> </sql:connection>';
+re = /<sql:connection id="([^\r\n]*?)">\s*<sql:url>\s*([^\r\n]*?)\s*<\/sql:url>\s*<sql:driver>\s*([^\r\n]*?)\s*<\/sql:driver>\s*(\s*<sql:userId>\s*([^\r\n]*?)\s*<\/sql:userId>\s*)?\s*(\s*<sql:password>\s*([^\r\n]*?)\s*<\/sql:password>\s*)?\s*<\/sql:connection>/;
+expect = Array("<sql:connection id=\"conn1\"> <sql:url>www.m.com</sql:url> <sql:driver>drive.class</sql:driver>\n<sql:userId>foo</sql:userId> <sql:password>goo</sql:password> </sql:connection>","conn1","www.m.com","drive.class","<sql:userId>foo</sql:userId> ","foo","<sql:password>goo</sql:password> ","goo");
+
+/*
+ * Check performance -
+ */
+status = inSection(1);
+var start = new Date();
+var result = re.exec(str);
+actual = elapsedTime(start);
+reportCompare(isThisFast(FAST), isThisFast(actual), status);
+
+/*
+ * Check accuracy -
+ */
+status = inSection(2);
+testRegExp([status], [re], [str], [result], [expect]);
+
+
+
+/*
+ * The second regexp (HUGE!). We'll test for performance (Section 3) and accuracy (Section 4).
+ * It comes from the O'Reilly book "Mastering Regular Expressions" by Jeffrey Friedl, Appendix B
+ */
+
+//# Some things for avoiding backslashitis later on.
+$esc = '\\\\';
+$Period = '\.';
+$space = '\040'; $tab = '\t';
+$OpenBR = '\\['; $CloseBR = '\\]';
+$OpenParen = '\\('; $CloseParen = '\\)';
+$NonASCII = '\x80-\xff'; $ctrl = '\000-\037';
+$CRlist = '\n\015'; //# note: this should really be only \015.
+// Items 19, 20, 21
+$qtext = '[^' + $esc + $NonASCII + $CRlist + '\"]'; // # for within "..."
+$dtext = '[^' + $esc + $NonASCII + $CRlist + $OpenBR + $CloseBR + ']'; // # for within [...]
+$quoted_pair = $esc + '[^' + $NonASCII + ']'; // # an escaped character
+
+//##############################################################################
+//# Items 22 and 23, comment.
+//# Impossible to do properly with a regex, I make do by allowing at most one level of nesting.
+$ctext = '[^' + $esc + $NonASCII + $CRlist + '()]';
+
+//# $Cnested matches one non-nested comment.
+//# It is unrolled, with normal of $ctext, special of $quoted_pair.
+$Cnested =
+ $OpenParen + // # (
+ $ctext + '*' + // # normal*
+ '(?:' + $quoted_pair + $ctext + '*)*' + // # (special normal*)*
+ $CloseParen; // # )
+
+
+//# $comment allows one level of nested parentheses
+//# It is unrolled, with normal of $ctext, special of ($quoted_pair|$Cnested)
+$comment =
+ $OpenParen + // # (
+ $ctext + '*' + // # normal*
+ '(?:' + // # (
+ '(?:' + $quoted_pair + '|' + $Cnested + ')' + // # special
+ $ctext + '*' + // # normal*
+ ')*' + // # )*
+ $CloseParen; // # )
+
+
+//##############################################################################
+//# $X is optional whitespace/comments.
+$X =
+ '[' + $space + $tab + ']*' + // # Nab whitespace.
+ '(?:' + $comment + '[' + $space + $tab + ']*)*'; // # If comment found, allow more spaces.
+
+
+//# Item 10: atom
+$atom_char = '[^(' + $space + '<>\@,;:\".' + $esc + $OpenBR + $CloseBR + $ctrl + $NonASCII + ']';
+$atom =
+ $atom_char + '+' + // # some number of atom characters...
+ '(?!' + $atom_char + ')'; // # ..not followed by something that could be part of an atom
+
+// # Item 11: doublequoted string, unrolled.
+$quoted_str =
+ '\"' + // # "
+ $qtext + '*' + // # normal
+ '(?:' + $quoted_pair + $qtext + '*)*' + // # ( special normal* )*
+ '\"'; // # "
+
+//# Item 7: word is an atom or quoted string
+$word =
+ '(?:' +
+ $atom + // # Atom
+ '|' + // # or
+ $quoted_str + // # Quoted string
+ ')'
+
+//# Item 12: domain-ref is just an atom
+$domain_ref = $atom;
+
+//# Item 13: domain-literal is like a quoted string, but [...] instead of "..."
+$domain_lit =
+ $OpenBR + // # [
+ '(?:' + $dtext + '|' + $quoted_pair + ')*' + // # stuff
+ $CloseBR; // # ]
+
+// # Item 9: sub-domain is a domain-ref or domain-literal
+$sub_domain =
+ '(?:' +
+ $domain_ref +
+ '|' +
+ $domain_lit +
+ ')' +
+ $X; // # optional trailing comments
+
+// # Item 6: domain is a list of subdomains separated by dots.
+$domain =
+ $sub_domain +
+ '(?:' +
+ $Period + $X + $sub_domain +
+ ')*';
+
+//# Item 8: a route. A bunch of "@ $domain" separated by commas, followed by a colon.
+$route =
+ '\@' + $X + $domain +
+ '(?:,' + $X + '\@' + $X + $domain + ')*' + // # additional domains
+ ':' +
+ $X; // # optional trailing comments
+
+//# Item 6: local-part is a bunch of $word separated by periods
+$local_part =
+ $word + $X
+ '(?:' +
+ $Period + $X + $word + $X + // # additional words
+ ')*';
+
+// # Item 2: addr-spec is local@domain
+$addr_spec =
+ $local_part + '\@' + $X + $domain;
+
+//# Item 4: route-addr is <route? addr-spec>
+$route_addr =
+ '<' + $X + // # <
+ '(?:' + $route + ')?' + // # optional route
+ $addr_spec + // # address spec
+ '>'; // # >
+
+//# Item 3: phrase........
+$phrase_ctrl = '\000-\010\012-\037'; // # like ctrl, but without tab
+
+//# Like atom-char, but without listing space, and uses phrase_ctrl.
+//# Since the class is negated, this matches the same as atom-char plus space and tab
+$phrase_char =
+ '[^()<>\@,;:\".' + $esc + $OpenBR + $CloseBR + $NonASCII + $phrase_ctrl + ']';
+
+// # We've worked it so that $word, $comment, and $quoted_str to not consume trailing $X
+// # because we take care of it manually.
+$phrase =
+ $word + // # leading word
+ $phrase_char + '*' + // # "normal" atoms and/or spaces
+ '(?:' +
+ '(?:' + $comment + '|' + $quoted_str + ')' + // # "special" comment or quoted string
+ $phrase_char + '*' + // # more "normal"
+ ')*';
+
+// ## Item #1: mailbox is an addr_spec or a phrase/route_addr
+$mailbox =
+ $X + // # optional leading comment
+ '(?:' +
+ $phrase + $route_addr + // # name and address
+ '|' + // # or
+ $addr_spec + // # address
+ ')';
+
+
+//###########################################################################
+
+
+re = new RegExp($mailbox, "g");
+str = 'Jeffy<"That Tall Guy"@ora.com (this address is no longer active)>';
+expect = Array('Jeffy<"That Tall Guy"@ora.com (this address is no longer active)>');
+
+/*
+ * Check performance -
+ */
+status = inSection(3);
+var start = new Date();
+var result = re.exec(str);
+actual = elapsedTime(start);
+reportCompare(isThisFast(FAST), isThisFast(actual), status);
+
+/*
+ * Check accuracy -
+ */
+status = inSection(4);
+testRegExp([status], [re], [str], [result], [expect]);
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-87231.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-87231.js
new file mode 100644
index 0000000..7fde4ff
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-87231.js
@@ -0,0 +1,124 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS"
+* basis, WITHOUT WARRANTY OF ANY KIND, either expressed
+* or implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation.
+* All Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+* Date: 22 June 2001
+*
+* SUMMARY: Regression test for Bugzilla bug 87231:
+* "Regular expression /(A)?(A.*)/ picks 'A' twice"
+*
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=87231
+* Key case:
+*
+* pattern = /^(A)?(A.*)$/;
+* string = 'A';
+* expectedmatch = Array('A', '', 'A');
+*
+*
+* We expect the 1st subexpression (A)? NOT to consume the single 'A'.
+* Recall that "?" means "match 0 or 1 times". Here, it should NOT do
+* greedy matching: it should match 0 times instead of 1. This allows
+* the 2nd subexpression to make the only match it can: the single 'A'.
+* Such "altruism" is the only way there can be a successful global match...
+*/
+//-------------------------------------------------------------------------------------------------
+var i = 0;
+var bug = 87231;
+var cnEmptyString = '';
+var summary = 'Testing regular expression /(A)?(A.*)/';
+var status = '';
+var statusmessages = new Array();
+var pattern = '';
+var patterns = new Array();
+var string = '';
+var strings = new Array();
+var actualmatch = '';
+var actualmatches = new Array();
+var expectedmatch = '';
+var expectedmatches = new Array();
+
+
+pattern = /^(A)?(A.*)$/;
+ status = inSection(1);
+ string = 'AAA';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('AAA', 'A', 'AA');
+ addThis();
+
+ status = inSection(2);
+ string = 'AA';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('AA', 'A', 'A');
+ addThis();
+
+ status = inSection(3);
+ string = 'A';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('A', undefined, 'A'); // 'altruistic' case: see above
+ addThis();
+
+
+pattern = /(A)?(A.*)/;
+var strL = 'zxcasd;fl\\\ ^';
+var strR = 'aaAAaaaf;lrlrzs';
+
+ status = inSection(4);
+ string = strL + 'AAA' + strR;
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('AAA' + strR, 'A', 'AA' + strR);
+ addThis();
+
+ status = inSection(5);
+ string = strL + 'AA' + strR;
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('AA' + strR, 'A', 'A' + strR);
+ addThis();
+
+ status = inSection(6);
+ string = strL + 'A' + strR;
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('A' + strR, undefined, 'A' + strR); // 'altruistic' case: see above
+ addThis();
+
+
+
+//-------------------------------------------------------------------------------------------------
+test();
+//-------------------------------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusmessages[i] = status;
+ patterns[i] = pattern;
+ strings[i] = string;
+ actualmatches[i] = actualmatch;
+ expectedmatches[i] = expectedmatch;
+ i++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+ testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-98306.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-98306.js
new file mode 100644
index 0000000..e812ebf
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-98306.js
@@ -0,0 +1,77 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS"
+* basis, WITHOUT WARRANTY OF ANY KIND, either expressed
+* or implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation.
+* All Rights Reserved.
+*
+* Contributor(s): jrgm@netscape.com, pschwartau@netscape.com
+* Date: 04 September 2001
+*
+* SUMMARY: Regression test for Bugzilla bug 98306
+* "JS parser crashes in ParseAtom for script using Regexp()"
+*
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=98306
+*/
+//-----------------------------------------------------------------------------
+var bug = 98306;
+var summary = "Testing that we don't crash on this code -";
+var cnUBOUND = 10;
+var re;
+var s;
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ s = '"Hello".match(/[/]/)';
+ tryThis(s);
+
+ s = 're = /[/';
+ tryThis(s);
+
+ s = 're = /[/]/';
+ tryThis(s);
+
+ s = 're = /[//]/';
+ tryThis(s);
+
+ exitFunc ('test');
+}
+
+
+// Try to provoke a crash -
+function tryThis(sCode)
+{
+ // sometimes more than one attempt is necessary -
+ for (var i=0; i<cnUBOUND; i++)
+ {
+ try
+ {
+ eval(sCode);
+ }
+ catch(e)
+ {
+ // do nothing; keep going -
+ }
+ }
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/shell.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/shell.js
new file mode 100644
index 0000000..8dec83c
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/shell.js
@@ -0,0 +1,230 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS"
+* basis, WITHOUT WARRANTY OF ANY KIND, either expressed
+* or implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation.
+* All Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+* Date: 07 February 2001
+*
+* Functionality common to RegExp testing -
+*/
+//-------------------------------------------------------------------------------------------------
+var MSG_PATTERN = '\nregexp = ';
+var MSG_STRING = '\nstring = ';
+var MSG_EXPECT = '\nExpect: ';
+var MSG_ACTUAL = '\nActual: ';
+var ERR_LENGTH = '\nERROR !!! match arrays have different lengths:';
+var ERR_MATCH = '\nERROR !!! regexp failed to give expected match array:';
+var ERR_NO_MATCH = '\nERROR !!! regexp FAILED to match anything !!!';
+var ERR_UNEXP_MATCH = '\nERROR !!! regexp MATCHED when we expected it to fail !!!';
+var CHAR_LBRACKET = '[';
+var CHAR_RBRACKET = ']';
+var CHAR_QT_DBL = '"';
+var CHAR_QT = "'";
+var CHAR_NL = '\n';
+var CHAR_COMMA = ',';
+var CHAR_SPACE = ' ';
+var TYPE_STRING = typeof 'abc';
+
+
+
+function testRegExp(statuses, patterns, strings, actualmatches, expectedmatches)
+{
+ var status = '';
+ var pattern = new RegExp();
+ var string = '';
+ var actualmatch = new Array();
+ var expectedmatch = new Array();
+ var state = '';
+ var lActual = -1;
+ var lExpect = -1;
+
+
+ for (var i=0; i != patterns.length; i++)
+ {
+ status = statuses[i];
+ pattern = patterns[i];
+ string = strings[i];
+ actualmatch=actualmatches[i];
+ expectedmatch=expectedmatches[i];
+ state = getState(status, pattern, string);
+
+
+ if(actualmatch)
+ {
+ if(expectedmatch)
+ {
+ // expectedmatch and actualmatch are arrays -
+ lExpect = expectedmatch.length;
+ lActual = actualmatch.length;
+
+ if (lActual != lExpect)
+ {
+ reportFailure(
+ state + ERR_LENGTH +
+ MSG_EXPECT + formatArray(expectedmatch) +
+ MSG_ACTUAL + formatArray(actualmatch) +
+ CHAR_NL
+ );
+ continue;
+ }
+
+ // OK, the arrays have same length -
+ if (formatArray(expectedmatch) != formatArray(actualmatch))
+ {
+ reportFailure(
+ state + ERR_MATCH +
+ MSG_EXPECT + formatArray(expectedmatch) +
+ MSG_ACTUAL + formatArray(actualmatch) +
+ CHAR_NL
+ );
+ }
+
+ }
+ else //expectedmatch is null - that is, we did not expect a match -
+ {
+ reportFailure(
+ state + ERR_UNEXP_MATCH +
+ MSG_EXPECT + expectedmatch +
+ MSG_ACTUAL + formatArray(actualmatch) +
+ CHAR_NL
+ );
+ }
+
+ }
+ else // actualmatch is null
+ {
+ if (expectedmatch)
+ {
+ reportFailure(
+ state + ERR_NO_MATCH +
+ MSG_EXPECT + formatArray(expectedmatch) +
+ MSG_ACTUAL + actualmatch +
+ CHAR_NL
+ );
+ }
+ else // we did not expect a match
+ {
+ // Being ultra-cautious. Presumably expectedmatch===actualmatch===null
+ reportCompare (expectedmatch, actualmatch, state);
+ }
+ }
+ }
+}
+
+
+function getState(status, pattern, string)
+{
+ /*
+ * Escape \n's, etc. to make them LITERAL in the presentation string.
+ * We don't have to worry about this in |pattern|; such escaping is
+ * done automatically by pattern.toString(), invoked implicitly below.
+ *
+ * One would like to simply do: string = string.replace(/(\s)/g, '\$1').
+ * However, the backreference $1 is not a literal string value,
+ * so this method doesn't work.
+ *
+ * Also tried string = string.replace(/(\s)/g, escape('$1'));
+ * but this just inserts the escape of the literal '$1', i.e. '%241'.
+ */
+ string = string.replace(/\n/g, '\\n');
+ string = string.replace(/\r/g, '\\r');
+ string = string.replace(/\t/g, '\\t');
+ string = string.replace(/\v/g, '\\v');
+ string = string.replace(/\f/g, '\\f');
+
+ return (status + MSG_PATTERN + pattern + MSG_STRING + singleQuote(string));
+}
+
+
+/*
+ * If available, arr.toSource() gives more detail than arr.toString()
+ *
+ * var arr = Array(1,2,'3');
+ *
+ * arr.toSource()
+ * [1, 2, "3"]
+ *
+ * arr.toString()
+ * 1,2,3
+ *
+ * But toSource() doesn't exist in Rhino, so use our own imitation, below -
+ *
+ */
+function formatArray(arr)
+{
+ try
+ {
+ return arr.toSource();
+ }
+ catch(e)
+ {
+ return toSource(arr);
+ }
+}
+
+
+/*
+ * Imitate SpiderMonkey's arr.toSource() method:
+ *
+ * a) Double-quote each array element that is of string type
+ * b) Represent |undefined| and |null| by empty strings
+ * c) Delimit elements by a comma + single space
+ * d) Do not add delimiter at the end UNLESS the last element is |undefined|
+ * e) Add square brackets to the beginning and end of the string
+ */
+function toSource(arr)
+{
+ var delim = CHAR_COMMA + CHAR_SPACE;
+ var elt = '';
+ var ret = '';
+ var len = arr.length;
+
+ for (i=0; i<len; i++)
+ {
+ elt = arr[i];
+
+ switch(true)
+ {
+ case (typeof elt === TYPE_STRING) :
+ ret += doubleQuote(elt);
+ break;
+
+ case (elt === undefined || elt === null) :
+ break; // add nothing but the delimiter, below -
+
+ default:
+ ret += elt.toString();
+ }
+
+ if ((i < len-1) || (elt === undefined))
+ ret += delim;
+ }
+
+ return CHAR_LBRACKET + ret + CHAR_RBRACKET;
+}
+
+
+function doubleQuote(text)
+{
+ return CHAR_QT_DBL + text + CHAR_QT_DBL;
+}
+
+
+function singleQuote(text)
+{
+ return CHAR_QT + text + CHAR_QT;
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-121744.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-121744.js
new file mode 100644
index 0000000..ca4653a
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-121744.js
@@ -0,0 +1,212 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2002
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 30 Jan 2002
+* Revised: 10 Apr 2002
+* Revised: 14 July 2002
+*
+* SUMMARY: JS should error on |for(i in undefined)|, |for(i in null)|
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=121744
+*
+* ECMA-262 3rd Edition Final spec says such statements should error. See:
+*
+* Section 12.6.4 The for-in Statement
+* Section 9.9 ToObject
+*
+*
+* BUT: SpiderMonkey has decided NOT to follow this; it's a bug in the spec.
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=131348
+*
+* UPDATE: Rhino has also decided not to follow the spec on this.
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=136893
+*
+
+ |--------------------------------------------------------------------|
+ | |
+ | So for now, adding an early return for this test so it won't run. |
+ | |
+ |--------------------------------------------------------------------|
+
+*
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 121744;
+var summary = 'JS should error on |for(i in undefined)|, |for(i in null)|';
+var TEST_PASSED = 'TypeError';
+var TEST_FAILED = 'Generated an error, but NOT a TypeError!';
+var TEST_FAILED_BADLY = 'Did not generate ANY error!!!';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+/*
+ * AS OF 14 JULY 2002, DON'T RUN THIS TEST IN EITHER RHINO OR SPIDERMONKEY -
+ */
+quit();
+
+
+status = inSection(1);
+expect = TEST_PASSED;
+actual = TEST_FAILED_BADLY;
+/*
+ * OK, this should generate a TypeError
+ */
+try
+{
+ for (var i in undefined)
+ {
+ print(i);
+ }
+}
+catch(e)
+{
+ if (e instanceof TypeError)
+ actual = TEST_PASSED;
+ else
+ actual = TEST_FAILED;
+}
+addThis();
+
+
+
+status = inSection(2);
+expect = TEST_PASSED;
+actual = TEST_FAILED_BADLY;
+/*
+ * OK, this should generate a TypeError
+ */
+try
+{
+ for (var i in null)
+ {
+ print(i);
+ }
+}
+catch(e)
+{
+ if (e instanceof TypeError)
+ actual = TEST_PASSED;
+ else
+ actual = TEST_FAILED;
+}
+addThis();
+
+
+
+status = inSection(3);
+expect = TEST_PASSED;
+actual = TEST_FAILED_BADLY;
+/*
+ * Variable names that cannot be looked up generate ReferenceErrors; however,
+ * property names like obj.ZZZ that cannot be looked up are set to |undefined|
+ *
+ * Therefore, this should indirectly test | for (var i in undefined) |
+ */
+try
+{
+ for (var i in this.ZZZ)
+ {
+ print(i);
+ }
+}
+catch(e)
+{
+ if(e instanceof TypeError)
+ actual = TEST_PASSED;
+ else
+ actual = TEST_FAILED;
+}
+addThis();
+
+
+
+status = inSection(4);
+expect = TEST_PASSED;
+actual = TEST_FAILED_BADLY;
+/*
+ * The result of an unsuccessful regexp match is the null value
+ * Therefore, this should indirectly test | for (var i in null) |
+ */
+try
+{
+ for (var i in 'bbb'.match(/aaa/))
+ {
+ print(i);
+ }
+}
+catch(e)
+{
+ if(e instanceof TypeError)
+ actual = TEST_PASSED;
+ else
+ actual = TEST_FAILED;
+}
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-131348.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-131348.js
new file mode 100644
index 0000000..7315373
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-131348.js
@@ -0,0 +1,179 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2002
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 10 Apr 2002
+* Revised: 14 July 2002
+*
+* SUMMARY: JS should NOT error on |for(i in undefined)|, |for(i in null)|
+*
+* ECMA-262 3rd Edition Final spec says such statements SHOULD error. See:
+*
+* Section 12.6.4 The for-in Statement
+* Section 9.9 ToObject
+*
+*
+* But SpiderMonkey has decided NOT to follow this; it's a bug in the spec.
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=131348
+*
+* Update: Rhino has also decided not to follow the spec on this
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=136893
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 131348;
+var summary = 'JS should not error on |for(i in undefined)|, |for(i in null)|';
+var TEST_PASSED = 'No error';
+var TEST_FAILED = 'An error was generated!!!';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+
+status = inSection(1);
+expect = TEST_PASSED;
+actual = TEST_PASSED;
+try
+{
+ for (var i in undefined)
+ {
+ print(i);
+ }
+}
+catch(e)
+{
+ actual = TEST_FAILED;
+}
+addThis();
+
+
+
+status = inSection(2);
+expect = TEST_PASSED;
+actual = TEST_PASSED;
+try
+{
+ for (var i in null)
+ {
+ print(i);
+ }
+}
+catch(e)
+{
+ actual = TEST_FAILED;
+}
+addThis();
+
+
+
+status = inSection(3);
+expect = TEST_PASSED;
+actual = TEST_PASSED;
+/*
+ * Variable names that cannot be looked up generate ReferenceErrors; however,
+ * property names like obj.ZZZ that cannot be looked up are set to |undefined|
+ *
+ * Therefore, this should indirectly test | for (var i in undefined) |
+ */
+try
+{
+ for (var i in this.ZZZ)
+ {
+ print(i);
+ }
+}
+catch(e)
+{
+ actual = TEST_FAILED;
+}
+addThis();
+
+
+
+status = inSection(4);
+expect = TEST_PASSED;
+actual = TEST_PASSED;
+/*
+ * The result of an unsuccessful regexp match is the null value
+ * Therefore, this should indirectly test | for (var i in null) |
+ */
+try
+{
+ for (var i in 'bbb'.match(/aaa/))
+ {
+ print(i);
+ }
+}
+catch(e)
+{
+ actual = TEST_FAILED;
+}
+addThis();
+
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-157509.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-157509.js
new file mode 100644
index 0000000..ad6bd77
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-157509.js
@@ -0,0 +1,106 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2002
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): igor3@apochta.com, pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 15 July 2002
+* SUMMARY: Testing for SyntaxError on usage of '\' in identifiers
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=157509
+*
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 157509;
+var summary = "Testing for SyntaxError on usage of '\\' in identifiers";
+var TEST_PASSED = 'SyntaxError';
+var TEST_FAILED = 'Generated an error, but NOT a SyntaxError!';
+var TEST_FAILED_BADLY = 'Did not generate ANY error!!!';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+status = inSection(1);
+expect = TEST_PASSED;
+actual = TEST_FAILED_BADLY;
+/*
+ * OK, this should generate a SyntaxError
+ */
+try
+{
+ eval('var a\\1 = 0;');
+}
+catch(e)
+{
+ if (e instanceof SyntaxError)
+ actual = TEST_PASSED;
+ else
+ actual = TEST_FAILED;
+}
+addThis();
+
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-194364.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-194364.js
new file mode 100644
index 0000000..830a6c6
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-194364.js
@@ -0,0 +1,134 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2003
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): igor@icesoft.no, pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 21 February 2003
+* SUMMARY: Testing eval statements containing conditional function expressions
+*
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=194364
+*
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 194364;
+var summary = 'Testing eval statements with conditional function expressions';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+status = inSection(1);
+actual = eval('1; function() {}');
+expect = 1;
+addThis();
+
+status = inSection(2);
+actual = eval('2; function f() {}');
+expect = 2;
+addThis();
+
+status = inSection(3);
+actual = eval('3; if (true) function() {}');
+expect = 3;
+addThis();
+
+status = inSection(4);
+actual = eval('4; if (true) function f() {}');
+expect = 4;
+addThis();
+
+status = inSection(5);
+actual = eval('5; if (false) function() {}');
+expect = 5;
+addThis();
+
+status = inSection(6);
+actual = eval('6; if (false) function f() {}');
+expect = 6;
+addThis();
+
+status = inSection(7);
+actual = eval('7; switch(true) { case true: function() {} }');
+expect = 7;
+addThis();
+
+status = inSection(8);
+actual = eval('8; switch(true) { case true: function f() {} }');
+expect = 8;
+addThis();
+
+status = inSection(9);
+actual = eval('9; switch(false) { case false: function() {} }');
+expect = 9;
+addThis();
+
+status = inSection(10);
+actual = eval('10; switch(false) { case false: function f() {} }');
+expect = 10;
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-74474-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-74474-001.js
new file mode 100644
index 0000000..d592264
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-74474-001.js
@@ -0,0 +1,118 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS"
+* basis, WITHOUT WARRANTY OF ANY KIND, either expressed
+* or implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation. All
+* Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+* Date: 01 May 2001
+*
+* SUMMARY: Regression test for Bugzilla bug 74474
+*"switch() misbehaves with duplicated labels"
+*
+* See ECMA3 Section 12.11, "The switch Statement"
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=74474
+*/
+//-------------------------------------------------------------------------------------------------
+var UBound = 0;
+var bug = 74474;
+var summary = 'Testing switch statements with duplicate labels';
+var status = '';
+var statusitems = [ ];
+var actual = '';
+var actualvalues = [ ];
+var expect= '';
+var expectedvalues = [ ];
+
+
+status = 'Section A of test: the string literal "1" as a duplicate label';
+actual = '';
+switch ('1')
+{
+ case '1':
+ actual += 'a';
+ case '1':
+ actual += 'b';
+}
+expect = 'ab';
+addThis();
+
+
+status = 'Section B of test: the numeric literal 1 as a duplicate label';
+actual = '';
+switch (1)
+{
+ case 1:
+ actual += 'a';
+ case 1:
+ actual += 'b';
+}
+expect = 'ab';
+addThis();
+
+
+status = 'Section C of test: the numeric literal 1 as a duplicate label, via a function parameter';
+tryThis(1);
+function tryThis(x)
+{
+ actual = '';
+
+ switch (x)
+ {
+ case x:
+ actual += 'a';
+ case x:
+ actual += 'b';
+ }
+}
+expect = 'ab';
+addThis();
+
+
+
+//---------------------------------------------------------------------------------
+test();
+//---------------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ for (var i = 0; i < UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], getStatus(i));
+ }
+
+ exitFunc ('test');
+}
+
+
+function getStatus(i)
+{
+ return statusitems[i];
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-74474-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-74474-002.js
new file mode 100644
index 0000000..52f8787
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-74474-002.js
@@ -0,0 +1,9076 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS"
+* basis, WITHOUT WARRANTY OF ANY KIND, either expressed
+* or implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation. All
+* Rights Reserved.
+*
+* Contributor(s): brendan@mozilla.org, pschwartau@netscape.com
+* Date: 09 May 2001
+*
+* SUMMARY: Regression test for Bugzilla bug 74474
+* "switch() misbehaves with duplicated labels"
+*
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=74474
+* See ECMA3 Section 12.11, "The switch Statement"
+*/
+//-------------------------------------------------------------------------------------------------
+var UBound = 0;
+var bug = 74474;
+var summary = 'Test of switch statement that overflows the stack-allocated bitmap';
+var status = '(No duplicated labels)';
+var statusitems = [ ];
+var actual = '';
+var actualvalues = [ ];
+var expect= '';
+var expectedvalues = [ ];
+var x = 3;
+
+
+switch (x)
+{
+ case 0:
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ case 5:
+ case 6:
+ case 7:
+ case 8:
+ case 9:
+ case 10:
+ case 11:
+ case 12:
+ case 13:
+ case 14:
+ case 15:
+ case 16:
+ case 17:
+ case 18:
+ case 19:
+ case 20:
+ case 21:
+ case 22:
+ case 23:
+ case 24:
+ case 25:
+ case 26:
+ case 27:
+ case 28:
+ case 29:
+ case 30:
+ case 31:
+ case 32:
+ case 33:
+ case 34:
+ case 35:
+ case 36:
+ case 37:
+ case 38:
+ case 39:
+ case 40:
+ case 41:
+ case 42:
+ case 43:
+ case 44:
+ case 45:
+ case 46:
+ case 47:
+ case 48:
+ case 49:
+ case 50:
+ case 51:
+ case 52:
+ case 53:
+ case 54:
+ case 55:
+ case 56:
+ case 57:
+ case 58:
+ case 59:
+ case 60:
+ case 61:
+ case 62:
+ case 63:
+ case 64:
+ case 65:
+ case 66:
+ case 67:
+ case 68:
+ case 69:
+ case 70:
+ case 71:
+ case 72:
+ case 73:
+ case 74:
+ case 75:
+ case 76:
+ case 77:
+ case 78:
+ case 79:
+ case 80:
+ case 81:
+ case 82:
+ case 83:
+ case 84:
+ case 85:
+ case 86:
+ case 87:
+ case 88:
+ case 89:
+ case 90:
+ case 91:
+ case 92:
+ case 93:
+ case 94:
+ case 95:
+ case 96:
+ case 97:
+ case 98:
+ case 99:
+ case 100:
+ case 101:
+ case 102:
+ case 103:
+ case 104:
+ case 105:
+ case 106:
+ case 107:
+ case 108:
+ case 109:
+ case 110:
+ case 111:
+ case 112:
+ case 113:
+ case 114:
+ case 115:
+ case 116:
+ case 117:
+ case 118:
+ case 119:
+ case 120:
+ case 121:
+ case 122:
+ case 123:
+ case 124:
+ case 125:
+ case 126:
+ case 127:
+ case 128:
+ case 129:
+ case 130:
+ case 131:
+ case 132:
+ case 133:
+ case 134:
+ case 135:
+ case 136:
+ case 137:
+ case 138:
+ case 139:
+ case 140:
+ case 141:
+ case 142:
+ case 143:
+ case 144:
+ case 145:
+ case 146:
+ case 147:
+ case 148:
+ case 149:
+ case 150:
+ case 151:
+ case 152:
+ case 153:
+ case 154:
+ case 155:
+ case 156:
+ case 157:
+ case 158:
+ case 159:
+ case 160:
+ case 161:
+ case 162:
+ case 163:
+ case 164:
+ case 165:
+ case 166:
+ case 167:
+ case 168:
+ case 169:
+ case 170:
+ case 171:
+ case 172:
+ case 173:
+ case 174:
+ case 175:
+ case 176:
+ case 177:
+ case 178:
+ case 179:
+ case 180:
+ case 181:
+ case 182:
+ case 183:
+ case 184:
+ case 185:
+ case 186:
+ case 187:
+ case 188:
+ case 189:
+ case 190:
+ case 191:
+ case 192:
+ case 193:
+ case 194:
+ case 195:
+ case 196:
+ case 197:
+ case 198:
+ case 199:
+ case 200:
+ case 201:
+ case 202:
+ case 203:
+ case 204:
+ case 205:
+ case 206:
+ case 207:
+ case 208:
+ case 209:
+ case 210:
+ case 211:
+ case 212:
+ case 213:
+ case 214:
+ case 215:
+ case 216:
+ case 217:
+ case 218:
+ case 219:
+ case 220:
+ case 221:
+ case 222:
+ case 223:
+ case 224:
+ case 225:
+ case 226:
+ case 227:
+ case 228:
+ case 229:
+ case 230:
+ case 231:
+ case 232:
+ case 233:
+ case 234:
+ case 235:
+ case 236:
+ case 237:
+ case 238:
+ case 239:
+ case 240:
+ case 241:
+ case 242:
+ case 243:
+ case 244:
+ case 245:
+ case 246:
+ case 247:
+ case 248:
+ case 249:
+ case 250:
+ case 251:
+ case 252:
+ case 253:
+ case 254:
+ case 255:
+ case 256:
+ case 257:
+ case 258:
+ case 259:
+ case 260:
+ case 261:
+ case 262:
+ case 263:
+ case 264:
+ case 265:
+ case 266:
+ case 267:
+ case 268:
+ case 269:
+ case 270:
+ case 271:
+ case 272:
+ case 273:
+ case 274:
+ case 275:
+ case 276:
+ case 277:
+ case 278:
+ case 279:
+ case 280:
+ case 281:
+ case 282:
+ case 283:
+ case 284:
+ case 285:
+ case 286:
+ case 287:
+ case 288:
+ case 289:
+ case 290:
+ case 291:
+ case 292:
+ case 293:
+ case 294:
+ case 295:
+ case 296:
+ case 297:
+ case 298:
+ case 299:
+ case 300:
+ case 301:
+ case 302:
+ case 303:
+ case 304:
+ case 305:
+ case 306:
+ case 307:
+ case 308:
+ case 309:
+ case 310:
+ case 311:
+ case 312:
+ case 313:
+ case 314:
+ case 315:
+ case 316:
+ case 317:
+ case 318:
+ case 319:
+ case 320:
+ case 321:
+ case 322:
+ case 323:
+ case 324:
+ case 325:
+ case 326:
+ case 327:
+ case 328:
+ case 329:
+ case 330:
+ case 331:
+ case 332:
+ case 333:
+ case 334:
+ case 335:
+ case 336:
+ case 337:
+ case 338:
+ case 339:
+ case 340:
+ case 341:
+ case 342:
+ case 343:
+ case 344:
+ case 345:
+ case 346:
+ case 347:
+ case 348:
+ case 349:
+ case 350:
+ case 351:
+ case 352:
+ case 353:
+ case 354:
+ case 355:
+ case 356:
+ case 357:
+ case 358:
+ case 359:
+ case 360:
+ case 361:
+ case 362:
+ case 363:
+ case 364:
+ case 365:
+ case 366:
+ case 367:
+ case 368:
+ case 369:
+ case 370:
+ case 371:
+ case 372:
+ case 373:
+ case 374:
+ case 375:
+ case 376:
+ case 377:
+ case 378:
+ case 379:
+ case 380:
+ case 381:
+ case 382:
+ case 383:
+ case 384:
+ case 385:
+ case 386:
+ case 387:
+ case 388:
+ case 389:
+ case 390:
+ case 391:
+ case 392:
+ case 393:
+ case 394:
+ case 395:
+ case 396:
+ case 397:
+ case 398:
+ case 399:
+ case 400:
+ case 401:
+ case 402:
+ case 403:
+ case 404:
+ case 405:
+ case 406:
+ case 407:
+ case 408:
+ case 409:
+ case 410:
+ case 411:
+ case 412:
+ case 413:
+ case 414:
+ case 415:
+ case 416:
+ case 417:
+ case 418:
+ case 419:
+ case 420:
+ case 421:
+ case 422:
+ case 423:
+ case 424:
+ case 425:
+ case 426:
+ case 427:
+ case 428:
+ case 429:
+ case 430:
+ case 431:
+ case 432:
+ case 433:
+ case 434:
+ case 435:
+ case 436:
+ case 437:
+ case 438:
+ case 439:
+ case 440:
+ case 441:
+ case 442:
+ case 443:
+ case 444:
+ case 445:
+ case 446:
+ case 447:
+ case 448:
+ case 449:
+ case 450:
+ case 451:
+ case 452:
+ case 453:
+ case 454:
+ case 455:
+ case 456:
+ case 457:
+ case 458:
+ case 459:
+ case 460:
+ case 461:
+ case 462:
+ case 463:
+ case 464:
+ case 465:
+ case 466:
+ case 467:
+ case 468:
+ case 469:
+ case 470:
+ case 471:
+ case 472:
+ case 473:
+ case 474:
+ case 475:
+ case 476:
+ case 477:
+ case 478:
+ case 479:
+ case 480:
+ case 481:
+ case 482:
+ case 483:
+ case 484:
+ case 485:
+ case 486:
+ case 487:
+ case 488:
+ case 489:
+ case 490:
+ case 491:
+ case 492:
+ case 493:
+ case 494:
+ case 495:
+ case 496:
+ case 497:
+ case 498:
+ case 499:
+ case 500:
+ case 501:
+ case 502:
+ case 503:
+ case 504:
+ case 505:
+ case 506:
+ case 507:
+ case 508:
+ case 509:
+ case 510:
+ case 511:
+ case 512:
+ case 513:
+ case 514:
+ case 515:
+ case 516:
+ case 517:
+ case 518:
+ case 519:
+ case 520:
+ case 521:
+ case 522:
+ case 523:
+ case 524:
+ case 525:
+ case 526:
+ case 527:
+ case 528:
+ case 529:
+ case 530:
+ case 531:
+ case 532:
+ case 533:
+ case 534:
+ case 535:
+ case 536:
+ case 537:
+ case 538:
+ case 539:
+ case 540:
+ case 541:
+ case 542:
+ case 543:
+ case 544:
+ case 545:
+ case 546:
+ case 547:
+ case 548:
+ case 549:
+ case 550:
+ case 551:
+ case 552:
+ case 553:
+ case 554:
+ case 555:
+ case 556:
+ case 557:
+ case 558:
+ case 559:
+ case 560:
+ case 561:
+ case 562:
+ case 563:
+ case 564:
+ case 565:
+ case 566:
+ case 567:
+ case 568:
+ case 569:
+ case 570:
+ case 571:
+ case 572:
+ case 573:
+ case 574:
+ case 575:
+ case 576:
+ case 577:
+ case 578:
+ case 579:
+ case 580:
+ case 581:
+ case 582:
+ case 583:
+ case 584:
+ case 585:
+ case 586:
+ case 587:
+ case 588:
+ case 589:
+ case 590:
+ case 591:
+ case 592:
+ case 593:
+ case 594:
+ case 595:
+ case 596:
+ case 597:
+ case 598:
+ case 599:
+ case 600:
+ case 601:
+ case 602:
+ case 603:
+ case 604:
+ case 605:
+ case 606:
+ case 607:
+ case 608:
+ case 609:
+ case 610:
+ case 611:
+ case 612:
+ case 613:
+ case 614:
+ case 615:
+ case 616:
+ case 617:
+ case 618:
+ case 619:
+ case 620:
+ case 621:
+ case 622:
+ case 623:
+ case 624:
+ case 625:
+ case 626:
+ case 627:
+ case 628:
+ case 629:
+ case 630:
+ case 631:
+ case 632:
+ case 633:
+ case 634:
+ case 635:
+ case 636:
+ case 637:
+ case 638:
+ case 639:
+ case 640:
+ case 641:
+ case 642:
+ case 643:
+ case 644:
+ case 645:
+ case 646:
+ case 647:
+ case 648:
+ case 649:
+ case 650:
+ case 651:
+ case 652:
+ case 653:
+ case 654:
+ case 655:
+ case 656:
+ case 657:
+ case 658:
+ case 659:
+ case 660:
+ case 661:
+ case 662:
+ case 663:
+ case 664:
+ case 665:
+ case 666:
+ case 667:
+ case 668:
+ case 669:
+ case 670:
+ case 671:
+ case 672:
+ case 673:
+ case 674:
+ case 675:
+ case 676:
+ case 677:
+ case 678:
+ case 679:
+ case 680:
+ case 681:
+ case 682:
+ case 683:
+ case 684:
+ case 685:
+ case 686:
+ case 687:
+ case 688:
+ case 689:
+ case 690:
+ case 691:
+ case 692:
+ case 693:
+ case 694:
+ case 695:
+ case 696:
+ case 697:
+ case 698:
+ case 699:
+ case 700:
+ case 701:
+ case 702:
+ case 703:
+ case 704:
+ case 705:
+ case 706:
+ case 707:
+ case 708:
+ case 709:
+ case 710:
+ case 711:
+ case 712:
+ case 713:
+ case 714:
+ case 715:
+ case 716:
+ case 717:
+ case 718:
+ case 719:
+ case 720:
+ case 721:
+ case 722:
+ case 723:
+ case 724:
+ case 725:
+ case 726:
+ case 727:
+ case 728:
+ case 729:
+ case 730:
+ case 731:
+ case 732:
+ case 733:
+ case 734:
+ case 735:
+ case 736:
+ case 737:
+ case 738:
+ case 739:
+ case 740:
+ case 741:
+ case 742:
+ case 743:
+ case 744:
+ case 745:
+ case 746:
+ case 747:
+ case 748:
+ case 749:
+ case 750:
+ case 751:
+ case 752:
+ case 753:
+ case 754:
+ case 755:
+ case 756:
+ case 757:
+ case 758:
+ case 759:
+ case 760:
+ case 761:
+ case 762:
+ case 763:
+ case 764:
+ case 765:
+ case 766:
+ case 767:
+ case 768:
+ case 769:
+ case 770:
+ case 771:
+ case 772:
+ case 773:
+ case 774:
+ case 775:
+ case 776:
+ case 777:
+ case 778:
+ case 779:
+ case 780:
+ case 781:
+ case 782:
+ case 783:
+ case 784:
+ case 785:
+ case 786:
+ case 787:
+ case 788:
+ case 789:
+ case 790:
+ case 791:
+ case 792:
+ case 793:
+ case 794:
+ case 795:
+ case 796:
+ case 797:
+ case 798:
+ case 799:
+ case 800:
+ case 801:
+ case 802:
+ case 803:
+ case 804:
+ case 805:
+ case 806:
+ case 807:
+ case 808:
+ case 809:
+ case 810:
+ case 811:
+ case 812:
+ case 813:
+ case 814:
+ case 815:
+ case 816:
+ case 817:
+ case 818:
+ case 819:
+ case 820:
+ case 821:
+ case 822:
+ case 823:
+ case 824:
+ case 825:
+ case 826:
+ case 827:
+ case 828:
+ case 829:
+ case 830:
+ case 831:
+ case 832:
+ case 833:
+ case 834:
+ case 835:
+ case 836:
+ case 837:
+ case 838:
+ case 839:
+ case 840:
+ case 841:
+ case 842:
+ case 843:
+ case 844:
+ case 845:
+ case 846:
+ case 847:
+ case 848:
+ case 849:
+ case 850:
+ case 851:
+ case 852:
+ case 853:
+ case 854:
+ case 855:
+ case 856:
+ case 857:
+ case 858:
+ case 859:
+ case 860:
+ case 861:
+ case 862:
+ case 863:
+ case 864:
+ case 865:
+ case 866:
+ case 867:
+ case 868:
+ case 869:
+ case 870:
+ case 871:
+ case 872:
+ case 873:
+ case 874:
+ case 875:
+ case 876:
+ case 877:
+ case 878:
+ case 879:
+ case 880:
+ case 881:
+ case 882:
+ case 883:
+ case 884:
+ case 885:
+ case 886:
+ case 887:
+ case 888:
+ case 889:
+ case 890:
+ case 891:
+ case 892:
+ case 893:
+ case 894:
+ case 895:
+ case 896:
+ case 897:
+ case 898:
+ case 899:
+ case 900:
+ case 901:
+ case 902:
+ case 903:
+ case 904:
+ case 905:
+ case 906:
+ case 907:
+ case 908:
+ case 909:
+ case 910:
+ case 911:
+ case 912:
+ case 913:
+ case 914:
+ case 915:
+ case 916:
+ case 917:
+ case 918:
+ case 919:
+ case 920:
+ case 921:
+ case 922:
+ case 923:
+ case 924:
+ case 925:
+ case 926:
+ case 927:
+ case 928:
+ case 929:
+ case 930:
+ case 931:
+ case 932:
+ case 933:
+ case 934:
+ case 935:
+ case 936:
+ case 937:
+ case 938:
+ case 939:
+ case 940:
+ case 941:
+ case 942:
+ case 943:
+ case 944:
+ case 945:
+ case 946:
+ case 947:
+ case 948:
+ case 949:
+ case 950:
+ case 951:
+ case 952:
+ case 953:
+ case 954:
+ case 955:
+ case 956:
+ case 957:
+ case 958:
+ case 959:
+ case 960:
+ case 961:
+ case 962:
+ case 963:
+ case 964:
+ case 965:
+ case 966:
+ case 967:
+ case 968:
+ case 969:
+ case 970:
+ case 971:
+ case 972:
+ case 973:
+ case 974:
+ case 975:
+ case 976:
+ case 977:
+ case 978:
+ case 979:
+ case 980:
+ case 981:
+ case 982:
+ case 983:
+ case 984:
+ case 985:
+ case 986:
+ case 987:
+ case 988:
+ case 989:
+ case 990:
+ case 991:
+ case 992:
+ case 993:
+ case 994:
+ case 995:
+ case 996:
+ case 997:
+ case 998:
+ case 999:
+ case 1000:
+ case 1001:
+ case 1002:
+ case 1003:
+ case 1004:
+ case 1005:
+ case 1006:
+ case 1007:
+ case 1008:
+ case 1009:
+ case 1010:
+ case 1011:
+ case 1012:
+ case 1013:
+ case 1014:
+ case 1015:
+ case 1016:
+ case 1017:
+ case 1018:
+ case 1019:
+ case 1020:
+ case 1021:
+ case 1022:
+ case 1023:
+ case 1024:
+ case 1025:
+ case 1026:
+ case 1027:
+ case 1028:
+ case 1029:
+ case 1030:
+ case 1031:
+ case 1032:
+ case 1033:
+ case 1034:
+ case 1035:
+ case 1036:
+ case 1037:
+ case 1038:
+ case 1039:
+ case 1040:
+ case 1041:
+ case 1042:
+ case 1043:
+ case 1044:
+ case 1045:
+ case 1046:
+ case 1047:
+ case 1048:
+ case 1049:
+ case 1050:
+ case 1051:
+ case 1052:
+ case 1053:
+ case 1054:
+ case 1055:
+ case 1056:
+ case 1057:
+ case 1058:
+ case 1059:
+ case 1060:
+ case 1061:
+ case 1062:
+ case 1063:
+ case 1064:
+ case 1065:
+ case 1066:
+ case 1067:
+ case 1068:
+ case 1069:
+ case 1070:
+ case 1071:
+ case 1072:
+ case 1073:
+ case 1074:
+ case 1075:
+ case 1076:
+ case 1077:
+ case 1078:
+ case 1079:
+ case 1080:
+ case 1081:
+ case 1082:
+ case 1083:
+ case 1084:
+ case 1085:
+ case 1086:
+ case 1087:
+ case 1088:
+ case 1089:
+ case 1090:
+ case 1091:
+ case 1092:
+ case 1093:
+ case 1094:
+ case 1095:
+ case 1096:
+ case 1097:
+ case 1098:
+ case 1099:
+ case 1100:
+ case 1101:
+ case 1102:
+ case 1103:
+ case 1104:
+ case 1105:
+ case 1106:
+ case 1107:
+ case 1108:
+ case 1109:
+ case 1110:
+ case 1111:
+ case 1112:
+ case 1113:
+ case 1114:
+ case 1115:
+ case 1116:
+ case 1117:
+ case 1118:
+ case 1119:
+ case 1120:
+ case 1121:
+ case 1122:
+ case 1123:
+ case 1124:
+ case 1125:
+ case 1126:
+ case 1127:
+ case 1128:
+ case 1129:
+ case 1130:
+ case 1131:
+ case 1132:
+ case 1133:
+ case 1134:
+ case 1135:
+ case 1136:
+ case 1137:
+ case 1138:
+ case 1139:
+ case 1140:
+ case 1141:
+ case 1142:
+ case 1143:
+ case 1144:
+ case 1145:
+ case 1146:
+ case 1147:
+ case 1148:
+ case 1149:
+ case 1150:
+ case 1151:
+ case 1152:
+ case 1153:
+ case 1154:
+ case 1155:
+ case 1156:
+ case 1157:
+ case 1158:
+ case 1159:
+ case 1160:
+ case 1161:
+ case 1162:
+ case 1163:
+ case 1164:
+ case 1165:
+ case 1166:
+ case 1167:
+ case 1168:
+ case 1169:
+ case 1170:
+ case 1171:
+ case 1172:
+ case 1173:
+ case 1174:
+ case 1175:
+ case 1176:
+ case 1177:
+ case 1178:
+ case 1179:
+ case 1180:
+ case 1181:
+ case 1182:
+ case 1183:
+ case 1184:
+ case 1185:
+ case 1186:
+ case 1187:
+ case 1188:
+ case 1189:
+ case 1190:
+ case 1191:
+ case 1192:
+ case 1193:
+ case 1194:
+ case 1195:
+ case 1196:
+ case 1197:
+ case 1198:
+ case 1199:
+ case 1200:
+ case 1201:
+ case 1202:
+ case 1203:
+ case 1204:
+ case 1205:
+ case 1206:
+ case 1207:
+ case 1208:
+ case 1209:
+ case 1210:
+ case 1211:
+ case 1212:
+ case 1213:
+ case 1214:
+ case 1215:
+ case 1216:
+ case 1217:
+ case 1218:
+ case 1219:
+ case 1220:
+ case 1221:
+ case 1222:
+ case 1223:
+ case 1224:
+ case 1225:
+ case 1226:
+ case 1227:
+ case 1228:
+ case 1229:
+ case 1230:
+ case 1231:
+ case 1232:
+ case 1233:
+ case 1234:
+ case 1235:
+ case 1236:
+ case 1237:
+ case 1238:
+ case 1239:
+ case 1240:
+ case 1241:
+ case 1242:
+ case 1243:
+ case 1244:
+ case 1245:
+ case 1246:
+ case 1247:
+ case 1248:
+ case 1249:
+ case 1250:
+ case 1251:
+ case 1252:
+ case 1253:
+ case 1254:
+ case 1255:
+ case 1256:
+ case 1257:
+ case 1258:
+ case 1259:
+ case 1260:
+ case 1261:
+ case 1262:
+ case 1263:
+ case 1264:
+ case 1265:
+ case 1266:
+ case 1267:
+ case 1268:
+ case 1269:
+ case 1270:
+ case 1271:
+ case 1272:
+ case 1273:
+ case 1274:
+ case 1275:
+ case 1276:
+ case 1277:
+ case 1278:
+ case 1279:
+ case 1280:
+ case 1281:
+ case 1282:
+ case 1283:
+ case 1284:
+ case 1285:
+ case 1286:
+ case 1287:
+ case 1288:
+ case 1289:
+ case 1290:
+ case 1291:
+ case 1292:
+ case 1293:
+ case 1294:
+ case 1295:
+ case 1296:
+ case 1297:
+ case 1298:
+ case 1299:
+ case 1300:
+ case 1301:
+ case 1302:
+ case 1303:
+ case 1304:
+ case 1305:
+ case 1306:
+ case 1307:
+ case 1308:
+ case 1309:
+ case 1310:
+ case 1311:
+ case 1312:
+ case 1313:
+ case 1314:
+ case 1315:
+ case 1316:
+ case 1317:
+ case 1318:
+ case 1319:
+ case 1320:
+ case 1321:
+ case 1322:
+ case 1323:
+ case 1324:
+ case 1325:
+ case 1326:
+ case 1327:
+ case 1328:
+ case 1329:
+ case 1330:
+ case 1331:
+ case 1332:
+ case 1333:
+ case 1334:
+ case 1335:
+ case 1336:
+ case 1337:
+ case 1338:
+ case 1339:
+ case 1340:
+ case 1341:
+ case 1342:
+ case 1343:
+ case 1344:
+ case 1345:
+ case 1346:
+ case 1347:
+ case 1348:
+ case 1349:
+ case 1350:
+ case 1351:
+ case 1352:
+ case 1353:
+ case 1354:
+ case 1355:
+ case 1356:
+ case 1357:
+ case 1358:
+ case 1359:
+ case 1360:
+ case 1361:
+ case 1362:
+ case 1363:
+ case 1364:
+ case 1365:
+ case 1366:
+ case 1367:
+ case 1368:
+ case 1369:
+ case 1370:
+ case 1371:
+ case 1372:
+ case 1373:
+ case 1374:
+ case 1375:
+ case 1376:
+ case 1377:
+ case 1378:
+ case 1379:
+ case 1380:
+ case 1381:
+ case 1382:
+ case 1383:
+ case 1384:
+ case 1385:
+ case 1386:
+ case 1387:
+ case 1388:
+ case 1389:
+ case 1390:
+ case 1391:
+ case 1392:
+ case 1393:
+ case 1394:
+ case 1395:
+ case 1396:
+ case 1397:
+ case 1398:
+ case 1399:
+ case 1400:
+ case 1401:
+ case 1402:
+ case 1403:
+ case 1404:
+ case 1405:
+ case 1406:
+ case 1407:
+ case 1408:
+ case 1409:
+ case 1410:
+ case 1411:
+ case 1412:
+ case 1413:
+ case 1414:
+ case 1415:
+ case 1416:
+ case 1417:
+ case 1418:
+ case 1419:
+ case 1420:
+ case 1421:
+ case 1422:
+ case 1423:
+ case 1424:
+ case 1425:
+ case 1426:
+ case 1427:
+ case 1428:
+ case 1429:
+ case 1430:
+ case 1431:
+ case 1432:
+ case 1433:
+ case 1434:
+ case 1435:
+ case 1436:
+ case 1437:
+ case 1438:
+ case 1439:
+ case 1440:
+ case 1441:
+ case 1442:
+ case 1443:
+ case 1444:
+ case 1445:
+ case 1446:
+ case 1447:
+ case 1448:
+ case 1449:
+ case 1450:
+ case 1451:
+ case 1452:
+ case 1453:
+ case 1454:
+ case 1455:
+ case 1456:
+ case 1457:
+ case 1458:
+ case 1459:
+ case 1460:
+ case 1461:
+ case 1462:
+ case 1463:
+ case 1464:
+ case 1465:
+ case 1466:
+ case 1467:
+ case 1468:
+ case 1469:
+ case 1470:
+ case 1471:
+ case 1472:
+ case 1473:
+ case 1474:
+ case 1475:
+ case 1476:
+ case 1477:
+ case 1478:
+ case 1479:
+ case 1480:
+ case 1481:
+ case 1482:
+ case 1483:
+ case 1484:
+ case 1485:
+ case 1486:
+ case 1487:
+ case 1488:
+ case 1489:
+ case 1490:
+ case 1491:
+ case 1492:
+ case 1493:
+ case 1494:
+ case 1495:
+ case 1496:
+ case 1497:
+ case 1498:
+ case 1499:
+ case 1500:
+ case 1501:
+ case 1502:
+ case 1503:
+ case 1504:
+ case 1505:
+ case 1506:
+ case 1507:
+ case 1508:
+ case 1509:
+ case 1510:
+ case 1511:
+ case 1512:
+ case 1513:
+ case 1514:
+ case 1515:
+ case 1516:
+ case 1517:
+ case 1518:
+ case 1519:
+ case 1520:
+ case 1521:
+ case 1522:
+ case 1523:
+ case 1524:
+ case 1525:
+ case 1526:
+ case 1527:
+ case 1528:
+ case 1529:
+ case 1530:
+ case 1531:
+ case 1532:
+ case 1533:
+ case 1534:
+ case 1535:
+ case 1536:
+ case 1537:
+ case 1538:
+ case 1539:
+ case 1540:
+ case 1541:
+ case 1542:
+ case 1543:
+ case 1544:
+ case 1545:
+ case 1546:
+ case 1547:
+ case 1548:
+ case 1549:
+ case 1550:
+ case 1551:
+ case 1552:
+ case 1553:
+ case 1554:
+ case 1555:
+ case 1556:
+ case 1557:
+ case 1558:
+ case 1559:
+ case 1560:
+ case 1561:
+ case 1562:
+ case 1563:
+ case 1564:
+ case 1565:
+ case 1566:
+ case 1567:
+ case 1568:
+ case 1569:
+ case 1570:
+ case 1571:
+ case 1572:
+ case 1573:
+ case 1574:
+ case 1575:
+ case 1576:
+ case 1577:
+ case 1578:
+ case 1579:
+ case 1580:
+ case 1581:
+ case 1582:
+ case 1583:
+ case 1584:
+ case 1585:
+ case 1586:
+ case 1587:
+ case 1588:
+ case 1589:
+ case 1590:
+ case 1591:
+ case 1592:
+ case 1593:
+ case 1594:
+ case 1595:
+ case 1596:
+ case 1597:
+ case 1598:
+ case 1599:
+ case 1600:
+ case 1601:
+ case 1602:
+ case 1603:
+ case 1604:
+ case 1605:
+ case 1606:
+ case 1607:
+ case 1608:
+ case 1609:
+ case 1610:
+ case 1611:
+ case 1612:
+ case 1613:
+ case 1614:
+ case 1615:
+ case 1616:
+ case 1617:
+ case 1618:
+ case 1619:
+ case 1620:
+ case 1621:
+ case 1622:
+ case 1623:
+ case 1624:
+ case 1625:
+ case 1626:
+ case 1627:
+ case 1628:
+ case 1629:
+ case 1630:
+ case 1631:
+ case 1632:
+ case 1633:
+ case 1634:
+ case 1635:
+ case 1636:
+ case 1637:
+ case 1638:
+ case 1639:
+ case 1640:
+ case 1641:
+ case 1642:
+ case 1643:
+ case 1644:
+ case 1645:
+ case 1646:
+ case 1647:
+ case 1648:
+ case 1649:
+ case 1650:
+ case 1651:
+ case 1652:
+ case 1653:
+ case 1654:
+ case 1655:
+ case 1656:
+ case 1657:
+ case 1658:
+ case 1659:
+ case 1660:
+ case 1661:
+ case 1662:
+ case 1663:
+ case 1664:
+ case 1665:
+ case 1666:
+ case 1667:
+ case 1668:
+ case 1669:
+ case 1670:
+ case 1671:
+ case 1672:
+ case 1673:
+ case 1674:
+ case 1675:
+ case 1676:
+ case 1677:
+ case 1678:
+ case 1679:
+ case 1680:
+ case 1681:
+ case 1682:
+ case 1683:
+ case 1684:
+ case 1685:
+ case 1686:
+ case 1687:
+ case 1688:
+ case 1689:
+ case 1690:
+ case 1691:
+ case 1692:
+ case 1693:
+ case 1694:
+ case 1695:
+ case 1696:
+ case 1697:
+ case 1698:
+ case 1699:
+ case 1700:
+ case 1701:
+ case 1702:
+ case 1703:
+ case 1704:
+ case 1705:
+ case 1706:
+ case 1707:
+ case 1708:
+ case 1709:
+ case 1710:
+ case 1711:
+ case 1712:
+ case 1713:
+ case 1714:
+ case 1715:
+ case 1716:
+ case 1717:
+ case 1718:
+ case 1719:
+ case 1720:
+ case 1721:
+ case 1722:
+ case 1723:
+ case 1724:
+ case 1725:
+ case 1726:
+ case 1727:
+ case 1728:
+ case 1729:
+ case 1730:
+ case 1731:
+ case 1732:
+ case 1733:
+ case 1734:
+ case 1735:
+ case 1736:
+ case 1737:
+ case 1738:
+ case 1739:
+ case 1740:
+ case 1741:
+ case 1742:
+ case 1743:
+ case 1744:
+ case 1745:
+ case 1746:
+ case 1747:
+ case 1748:
+ case 1749:
+ case 1750:
+ case 1751:
+ case 1752:
+ case 1753:
+ case 1754:
+ case 1755:
+ case 1756:
+ case 1757:
+ case 1758:
+ case 1759:
+ case 1760:
+ case 1761:
+ case 1762:
+ case 1763:
+ case 1764:
+ case 1765:
+ case 1766:
+ case 1767:
+ case 1768:
+ case 1769:
+ case 1770:
+ case 1771:
+ case 1772:
+ case 1773:
+ case 1774:
+ case 1775:
+ case 1776:
+ case 1777:
+ case 1778:
+ case 1779:
+ case 1780:
+ case 1781:
+ case 1782:
+ case 1783:
+ case 1784:
+ case 1785:
+ case 1786:
+ case 1787:
+ case 1788:
+ case 1789:
+ case 1790:
+ case 1791:
+ case 1792:
+ case 1793:
+ case 1794:
+ case 1795:
+ case 1796:
+ case 1797:
+ case 1798:
+ case 1799:
+ case 1800:
+ case 1801:
+ case 1802:
+ case 1803:
+ case 1804:
+ case 1805:
+ case 1806:
+ case 1807:
+ case 1808:
+ case 1809:
+ case 1810:
+ case 1811:
+ case 1812:
+ case 1813:
+ case 1814:
+ case 1815:
+ case 1816:
+ case 1817:
+ case 1818:
+ case 1819:
+ case 1820:
+ case 1821:
+ case 1822:
+ case 1823:
+ case 1824:
+ case 1825:
+ case 1826:
+ case 1827:
+ case 1828:
+ case 1829:
+ case 1830:
+ case 1831:
+ case 1832:
+ case 1833:
+ case 1834:
+ case 1835:
+ case 1836:
+ case 1837:
+ case 1838:
+ case 1839:
+ case 1840:
+ case 1841:
+ case 1842:
+ case 1843:
+ case 1844:
+ case 1845:
+ case 1846:
+ case 1847:
+ case 1848:
+ case 1849:
+ case 1850:
+ case 1851:
+ case 1852:
+ case 1853:
+ case 1854:
+ case 1855:
+ case 1856:
+ case 1857:
+ case 1858:
+ case 1859:
+ case 1860:
+ case 1861:
+ case 1862:
+ case 1863:
+ case 1864:
+ case 1865:
+ case 1866:
+ case 1867:
+ case 1868:
+ case 1869:
+ case 1870:
+ case 1871:
+ case 1872:
+ case 1873:
+ case 1874:
+ case 1875:
+ case 1876:
+ case 1877:
+ case 1878:
+ case 1879:
+ case 1880:
+ case 1881:
+ case 1882:
+ case 1883:
+ case 1884:
+ case 1885:
+ case 1886:
+ case 1887:
+ case 1888:
+ case 1889:
+ case 1890:
+ case 1891:
+ case 1892:
+ case 1893:
+ case 1894:
+ case 1895:
+ case 1896:
+ case 1897:
+ case 1898:
+ case 1899:
+ case 1900:
+ case 1901:
+ case 1902:
+ case 1903:
+ case 1904:
+ case 1905:
+ case 1906:
+ case 1907:
+ case 1908:
+ case 1909:
+ case 1910:
+ case 1911:
+ case 1912:
+ case 1913:
+ case 1914:
+ case 1915:
+ case 1916:
+ case 1917:
+ case 1918:
+ case 1919:
+ case 1920:
+ case 1921:
+ case 1922:
+ case 1923:
+ case 1924:
+ case 1925:
+ case 1926:
+ case 1927:
+ case 1928:
+ case 1929:
+ case 1930:
+ case 1931:
+ case 1932:
+ case 1933:
+ case 1934:
+ case 1935:
+ case 1936:
+ case 1937:
+ case 1938:
+ case 1939:
+ case 1940:
+ case 1941:
+ case 1942:
+ case 1943:
+ case 1944:
+ case 1945:
+ case 1946:
+ case 1947:
+ case 1948:
+ case 1949:
+ case 1950:
+ case 1951:
+ case 1952:
+ case 1953:
+ case 1954:
+ case 1955:
+ case 1956:
+ case 1957:
+ case 1958:
+ case 1959:
+ case 1960:
+ case 1961:
+ case 1962:
+ case 1963:
+ case 1964:
+ case 1965:
+ case 1966:
+ case 1967:
+ case 1968:
+ case 1969:
+ case 1970:
+ case 1971:
+ case 1972:
+ case 1973:
+ case 1974:
+ case 1975:
+ case 1976:
+ case 1977:
+ case 1978:
+ case 1979:
+ case 1980:
+ case 1981:
+ case 1982:
+ case 1983:
+ case 1984:
+ case 1985:
+ case 1986:
+ case 1987:
+ case 1988:
+ case 1989:
+ case 1990:
+ case 1991:
+ case 1992:
+ case 1993:
+ case 1994:
+ case 1995:
+ case 1996:
+ case 1997:
+ case 1998:
+ case 1999:
+ case 2000:
+ case 2001:
+ case 2002:
+ case 2003:
+ case 2004:
+ case 2005:
+ case 2006:
+ case 2007:
+ case 2008:
+ case 2009:
+ case 2010:
+ case 2011:
+ case 2012:
+ case 2013:
+ case 2014:
+ case 2015:
+ case 2016:
+ case 2017:
+ case 2018:
+ case 2019:
+ case 2020:
+ case 2021:
+ case 2022:
+ case 2023:
+ case 2024:
+ case 2025:
+ case 2026:
+ case 2027:
+ case 2028:
+ case 2029:
+ case 2030:
+ case 2031:
+ case 2032:
+ case 2033:
+ case 2034:
+ case 2035:
+ case 2036:
+ case 2037:
+ case 2038:
+ case 2039:
+ case 2040:
+ case 2041:
+ case 2042:
+ case 2043:
+ case 2044:
+ case 2045:
+ case 2046:
+ case 2047:
+ case 2048:
+ case 2049:
+ case 2050:
+ case 2051:
+ case 2052:
+ case 2053:
+ case 2054:
+ case 2055:
+ case 2056:
+ case 2057:
+ case 2058:
+ case 2059:
+ case 2060:
+ case 2061:
+ case 2062:
+ case 2063:
+ case 2064:
+ case 2065:
+ case 2066:
+ case 2067:
+ case 2068:
+ case 2069:
+ case 2070:
+ case 2071:
+ case 2072:
+ case 2073:
+ case 2074:
+ case 2075:
+ case 2076:
+ case 2077:
+ case 2078:
+ case 2079:
+ case 2080:
+ case 2081:
+ case 2082:
+ case 2083:
+ case 2084:
+ case 2085:
+ case 2086:
+ case 2087:
+ case 2088:
+ case 2089:
+ case 2090:
+ case 2091:
+ case 2092:
+ case 2093:
+ case 2094:
+ case 2095:
+ case 2096:
+ case 2097:
+ case 2098:
+ case 2099:
+ case 2100:
+ case 2101:
+ case 2102:
+ case 2103:
+ case 2104:
+ case 2105:
+ case 2106:
+ case 2107:
+ case 2108:
+ case 2109:
+ case 2110:
+ case 2111:
+ case 2112:
+ case 2113:
+ case 2114:
+ case 2115:
+ case 2116:
+ case 2117:
+ case 2118:
+ case 2119:
+ case 2120:
+ case 2121:
+ case 2122:
+ case 2123:
+ case 2124:
+ case 2125:
+ case 2126:
+ case 2127:
+ case 2128:
+ case 2129:
+ case 2130:
+ case 2131:
+ case 2132:
+ case 2133:
+ case 2134:
+ case 2135:
+ case 2136:
+ case 2137:
+ case 2138:
+ case 2139:
+ case 2140:
+ case 2141:
+ case 2142:
+ case 2143:
+ case 2144:
+ case 2145:
+ case 2146:
+ case 2147:
+ case 2148:
+ case 2149:
+ case 2150:
+ case 2151:
+ case 2152:
+ case 2153:
+ case 2154:
+ case 2155:
+ case 2156:
+ case 2157:
+ case 2158:
+ case 2159:
+ case 2160:
+ case 2161:
+ case 2162:
+ case 2163:
+ case 2164:
+ case 2165:
+ case 2166:
+ case 2167:
+ case 2168:
+ case 2169:
+ case 2170:
+ case 2171:
+ case 2172:
+ case 2173:
+ case 2174:
+ case 2175:
+ case 2176:
+ case 2177:
+ case 2178:
+ case 2179:
+ case 2180:
+ case 2181:
+ case 2182:
+ case 2183:
+ case 2184:
+ case 2185:
+ case 2186:
+ case 2187:
+ case 2188:
+ case 2189:
+ case 2190:
+ case 2191:
+ case 2192:
+ case 2193:
+ case 2194:
+ case 2195:
+ case 2196:
+ case 2197:
+ case 2198:
+ case 2199:
+ case 2200:
+ case 2201:
+ case 2202:
+ case 2203:
+ case 2204:
+ case 2205:
+ case 2206:
+ case 2207:
+ case 2208:
+ case 2209:
+ case 2210:
+ case 2211:
+ case 2212:
+ case 2213:
+ case 2214:
+ case 2215:
+ case 2216:
+ case 2217:
+ case 2218:
+ case 2219:
+ case 2220:
+ case 2221:
+ case 2222:
+ case 2223:
+ case 2224:
+ case 2225:
+ case 2226:
+ case 2227:
+ case 2228:
+ case 2229:
+ case 2230:
+ case 2231:
+ case 2232:
+ case 2233:
+ case 2234:
+ case 2235:
+ case 2236:
+ case 2237:
+ case 2238:
+ case 2239:
+ case 2240:
+ case 2241:
+ case 2242:
+ case 2243:
+ case 2244:
+ case 2245:
+ case 2246:
+ case 2247:
+ case 2248:
+ case 2249:
+ case 2250:
+ case 2251:
+ case 2252:
+ case 2253:
+ case 2254:
+ case 2255:
+ case 2256:
+ case 2257:
+ case 2258:
+ case 2259:
+ case 2260:
+ case 2261:
+ case 2262:
+ case 2263:
+ case 2264:
+ case 2265:
+ case 2266:
+ case 2267:
+ case 2268:
+ case 2269:
+ case 2270:
+ case 2271:
+ case 2272:
+ case 2273:
+ case 2274:
+ case 2275:
+ case 2276:
+ case 2277:
+ case 2278:
+ case 2279:
+ case 2280:
+ case 2281:
+ case 2282:
+ case 2283:
+ case 2284:
+ case 2285:
+ case 2286:
+ case 2287:
+ case 2288:
+ case 2289:
+ case 2290:
+ case 2291:
+ case 2292:
+ case 2293:
+ case 2294:
+ case 2295:
+ case 2296:
+ case 2297:
+ case 2298:
+ case 2299:
+ case 2300:
+ case 2301:
+ case 2302:
+ case 2303:
+ case 2304:
+ case 2305:
+ case 2306:
+ case 2307:
+ case 2308:
+ case 2309:
+ case 2310:
+ case 2311:
+ case 2312:
+ case 2313:
+ case 2314:
+ case 2315:
+ case 2316:
+ case 2317:
+ case 2318:
+ case 2319:
+ case 2320:
+ case 2321:
+ case 2322:
+ case 2323:
+ case 2324:
+ case 2325:
+ case 2326:
+ case 2327:
+ case 2328:
+ case 2329:
+ case 2330:
+ case 2331:
+ case 2332:
+ case 2333:
+ case 2334:
+ case 2335:
+ case 2336:
+ case 2337:
+ case 2338:
+ case 2339:
+ case 2340:
+ case 2341:
+ case 2342:
+ case 2343:
+ case 2344:
+ case 2345:
+ case 2346:
+ case 2347:
+ case 2348:
+ case 2349:
+ case 2350:
+ case 2351:
+ case 2352:
+ case 2353:
+ case 2354:
+ case 2355:
+ case 2356:
+ case 2357:
+ case 2358:
+ case 2359:
+ case 2360:
+ case 2361:
+ case 2362:
+ case 2363:
+ case 2364:
+ case 2365:
+ case 2366:
+ case 2367:
+ case 2368:
+ case 2369:
+ case 2370:
+ case 2371:
+ case 2372:
+ case 2373:
+ case 2374:
+ case 2375:
+ case 2376:
+ case 2377:
+ case 2378:
+ case 2379:
+ case 2380:
+ case 2381:
+ case 2382:
+ case 2383:
+ case 2384:
+ case 2385:
+ case 2386:
+ case 2387:
+ case 2388:
+ case 2389:
+ case 2390:
+ case 2391:
+ case 2392:
+ case 2393:
+ case 2394:
+ case 2395:
+ case 2396:
+ case 2397:
+ case 2398:
+ case 2399:
+ case 2400:
+ case 2401:
+ case 2402:
+ case 2403:
+ case 2404:
+ case 2405:
+ case 2406:
+ case 2407:
+ case 2408:
+ case 2409:
+ case 2410:
+ case 2411:
+ case 2412:
+ case 2413:
+ case 2414:
+ case 2415:
+ case 2416:
+ case 2417:
+ case 2418:
+ case 2419:
+ case 2420:
+ case 2421:
+ case 2422:
+ case 2423:
+ case 2424:
+ case 2425:
+ case 2426:
+ case 2427:
+ case 2428:
+ case 2429:
+ case 2430:
+ case 2431:
+ case 2432:
+ case 2433:
+ case 2434:
+ case 2435:
+ case 2436:
+ case 2437:
+ case 2438:
+ case 2439:
+ case 2440:
+ case 2441:
+ case 2442:
+ case 2443:
+ case 2444:
+ case 2445:
+ case 2446:
+ case 2447:
+ case 2448:
+ case 2449:
+ case 2450:
+ case 2451:
+ case 2452:
+ case 2453:
+ case 2454:
+ case 2455:
+ case 2456:
+ case 2457:
+ case 2458:
+ case 2459:
+ case 2460:
+ case 2461:
+ case 2462:
+ case 2463:
+ case 2464:
+ case 2465:
+ case 2466:
+ case 2467:
+ case 2468:
+ case 2469:
+ case 2470:
+ case 2471:
+ case 2472:
+ case 2473:
+ case 2474:
+ case 2475:
+ case 2476:
+ case 2477:
+ case 2478:
+ case 2479:
+ case 2480:
+ case 2481:
+ case 2482:
+ case 2483:
+ case 2484:
+ case 2485:
+ case 2486:
+ case 2487:
+ case 2488:
+ case 2489:
+ case 2490:
+ case 2491:
+ case 2492:
+ case 2493:
+ case 2494:
+ case 2495:
+ case 2496:
+ case 2497:
+ case 2498:
+ case 2499:
+ case 2500:
+ case 2501:
+ case 2502:
+ case 2503:
+ case 2504:
+ case 2505:
+ case 2506:
+ case 2507:
+ case 2508:
+ case 2509:
+ case 2510:
+ case 2511:
+ case 2512:
+ case 2513:
+ case 2514:
+ case 2515:
+ case 2516:
+ case 2517:
+ case 2518:
+ case 2519:
+ case 2520:
+ case 2521:
+ case 2522:
+ case 2523:
+ case 2524:
+ case 2525:
+ case 2526:
+ case 2527:
+ case 2528:
+ case 2529:
+ case 2530:
+ case 2531:
+ case 2532:
+ case 2533:
+ case 2534:
+ case 2535:
+ case 2536:
+ case 2537:
+ case 2538:
+ case 2539:
+ case 2540:
+ case 2541:
+ case 2542:
+ case 2543:
+ case 2544:
+ case 2545:
+ case 2546:
+ case 2547:
+ case 2548:
+ case 2549:
+ case 2550:
+ case 2551:
+ case 2552:
+ case 2553:
+ case 2554:
+ case 2555:
+ case 2556:
+ case 2557:
+ case 2558:
+ case 2559:
+ case 2560:
+ case 2561:
+ case 2562:
+ case 2563:
+ case 2564:
+ case 2565:
+ case 2566:
+ case 2567:
+ case 2568:
+ case 2569:
+ case 2570:
+ case 2571:
+ case 2572:
+ case 2573:
+ case 2574:
+ case 2575:
+ case 2576:
+ case 2577:
+ case 2578:
+ case 2579:
+ case 2580:
+ case 2581:
+ case 2582:
+ case 2583:
+ case 2584:
+ case 2585:
+ case 2586:
+ case 2587:
+ case 2588:
+ case 2589:
+ case 2590:
+ case 2591:
+ case 2592:
+ case 2593:
+ case 2594:
+ case 2595:
+ case 2596:
+ case 2597:
+ case 2598:
+ case 2599:
+ case 2600:
+ case 2601:
+ case 2602:
+ case 2603:
+ case 2604:
+ case 2605:
+ case 2606:
+ case 2607:
+ case 2608:
+ case 2609:
+ case 2610:
+ case 2611:
+ case 2612:
+ case 2613:
+ case 2614:
+ case 2615:
+ case 2616:
+ case 2617:
+ case 2618:
+ case 2619:
+ case 2620:
+ case 2621:
+ case 2622:
+ case 2623:
+ case 2624:
+ case 2625:
+ case 2626:
+ case 2627:
+ case 2628:
+ case 2629:
+ case 2630:
+ case 2631:
+ case 2632:
+ case 2633:
+ case 2634:
+ case 2635:
+ case 2636:
+ case 2637:
+ case 2638:
+ case 2639:
+ case 2640:
+ case 2641:
+ case 2642:
+ case 2643:
+ case 2644:
+ case 2645:
+ case 2646:
+ case 2647:
+ case 2648:
+ case 2649:
+ case 2650:
+ case 2651:
+ case 2652:
+ case 2653:
+ case 2654:
+ case 2655:
+ case 2656:
+ case 2657:
+ case 2658:
+ case 2659:
+ case 2660:
+ case 2661:
+ case 2662:
+ case 2663:
+ case 2664:
+ case 2665:
+ case 2666:
+ case 2667:
+ case 2668:
+ case 2669:
+ case 2670:
+ case 2671:
+ case 2672:
+ case 2673:
+ case 2674:
+ case 2675:
+ case 2676:
+ case 2677:
+ case 2678:
+ case 2679:
+ case 2680:
+ case 2681:
+ case 2682:
+ case 2683:
+ case 2684:
+ case 2685:
+ case 2686:
+ case 2687:
+ case 2688:
+ case 2689:
+ case 2690:
+ case 2691:
+ case 2692:
+ case 2693:
+ case 2694:
+ case 2695:
+ case 2696:
+ case 2697:
+ case 2698:
+ case 2699:
+ case 2700:
+ case 2701:
+ case 2702:
+ case 2703:
+ case 2704:
+ case 2705:
+ case 2706:
+ case 2707:
+ case 2708:
+ case 2709:
+ case 2710:
+ case 2711:
+ case 2712:
+ case 2713:
+ case 2714:
+ case 2715:
+ case 2716:
+ case 2717:
+ case 2718:
+ case 2719:
+ case 2720:
+ case 2721:
+ case 2722:
+ case 2723:
+ case 2724:
+ case 2725:
+ case 2726:
+ case 2727:
+ case 2728:
+ case 2729:
+ case 2730:
+ case 2731:
+ case 2732:
+ case 2733:
+ case 2734:
+ case 2735:
+ case 2736:
+ case 2737:
+ case 2738:
+ case 2739:
+ case 2740:
+ case 2741:
+ case 2742:
+ case 2743:
+ case 2744:
+ case 2745:
+ case 2746:
+ case 2747:
+ case 2748:
+ case 2749:
+ case 2750:
+ case 2751:
+ case 2752:
+ case 2753:
+ case 2754:
+ case 2755:
+ case 2756:
+ case 2757:
+ case 2758:
+ case 2759:
+ case 2760:
+ case 2761:
+ case 2762:
+ case 2763:
+ case 2764:
+ case 2765:
+ case 2766:
+ case 2767:
+ case 2768:
+ case 2769:
+ case 2770:
+ case 2771:
+ case 2772:
+ case 2773:
+ case 2774:
+ case 2775:
+ case 2776:
+ case 2777:
+ case 2778:
+ case 2779:
+ case 2780:
+ case 2781:
+ case 2782:
+ case 2783:
+ case 2784:
+ case 2785:
+ case 2786:
+ case 2787:
+ case 2788:
+ case 2789:
+ case 2790:
+ case 2791:
+ case 2792:
+ case 2793:
+ case 2794:
+ case 2795:
+ case 2796:
+ case 2797:
+ case 2798:
+ case 2799:
+ case 2800:
+ case 2801:
+ case 2802:
+ case 2803:
+ case 2804:
+ case 2805:
+ case 2806:
+ case 2807:
+ case 2808:
+ case 2809:
+ case 2810:
+ case 2811:
+ case 2812:
+ case 2813:
+ case 2814:
+ case 2815:
+ case 2816:
+ case 2817:
+ case 2818:
+ case 2819:
+ case 2820:
+ case 2821:
+ case 2822:
+ case 2823:
+ case 2824:
+ case 2825:
+ case 2826:
+ case 2827:
+ case 2828:
+ case 2829:
+ case 2830:
+ case 2831:
+ case 2832:
+ case 2833:
+ case 2834:
+ case 2835:
+ case 2836:
+ case 2837:
+ case 2838:
+ case 2839:
+ case 2840:
+ case 2841:
+ case 2842:
+ case 2843:
+ case 2844:
+ case 2845:
+ case 2846:
+ case 2847:
+ case 2848:
+ case 2849:
+ case 2850:
+ case 2851:
+ case 2852:
+ case 2853:
+ case 2854:
+ case 2855:
+ case 2856:
+ case 2857:
+ case 2858:
+ case 2859:
+ case 2860:
+ case 2861:
+ case 2862:
+ case 2863:
+ case 2864:
+ case 2865:
+ case 2866:
+ case 2867:
+ case 2868:
+ case 2869:
+ case 2870:
+ case 2871:
+ case 2872:
+ case 2873:
+ case 2874:
+ case 2875:
+ case 2876:
+ case 2877:
+ case 2878:
+ case 2879:
+ case 2880:
+ case 2881:
+ case 2882:
+ case 2883:
+ case 2884:
+ case 2885:
+ case 2886:
+ case 2887:
+ case 2888:
+ case 2889:
+ case 2890:
+ case 2891:
+ case 2892:
+ case 2893:
+ case 2894:
+ case 2895:
+ case 2896:
+ case 2897:
+ case 2898:
+ case 2899:
+ case 2900:
+ case 2901:
+ case 2902:
+ case 2903:
+ case 2904:
+ case 2905:
+ case 2906:
+ case 2907:
+ case 2908:
+ case 2909:
+ case 2910:
+ case 2911:
+ case 2912:
+ case 2913:
+ case 2914:
+ case 2915:
+ case 2916:
+ case 2917:
+ case 2918:
+ case 2919:
+ case 2920:
+ case 2921:
+ case 2922:
+ case 2923:
+ case 2924:
+ case 2925:
+ case 2926:
+ case 2927:
+ case 2928:
+ case 2929:
+ case 2930:
+ case 2931:
+ case 2932:
+ case 2933:
+ case 2934:
+ case 2935:
+ case 2936:
+ case 2937:
+ case 2938:
+ case 2939:
+ case 2940:
+ case 2941:
+ case 2942:
+ case 2943:
+ case 2944:
+ case 2945:
+ case 2946:
+ case 2947:
+ case 2948:
+ case 2949:
+ case 2950:
+ case 2951:
+ case 2952:
+ case 2953:
+ case 2954:
+ case 2955:
+ case 2956:
+ case 2957:
+ case 2958:
+ case 2959:
+ case 2960:
+ case 2961:
+ case 2962:
+ case 2963:
+ case 2964:
+ case 2965:
+ case 2966:
+ case 2967:
+ case 2968:
+ case 2969:
+ case 2970:
+ case 2971:
+ case 2972:
+ case 2973:
+ case 2974:
+ case 2975:
+ case 2976:
+ case 2977:
+ case 2978:
+ case 2979:
+ case 2980:
+ case 2981:
+ case 2982:
+ case 2983:
+ case 2984:
+ case 2985:
+ case 2986:
+ case 2987:
+ case 2988:
+ case 2989:
+ case 2990:
+ case 2991:
+ case 2992:
+ case 2993:
+ case 2994:
+ case 2995:
+ case 2996:
+ case 2997:
+ case 2998:
+ case 2999:
+ case 3000:
+ case 3001:
+ case 3002:
+ case 3003:
+ case 3004:
+ case 3005:
+ case 3006:
+ case 3007:
+ case 3008:
+ case 3009:
+ case 3010:
+ case 3011:
+ case 3012:
+ case 3013:
+ case 3014:
+ case 3015:
+ case 3016:
+ case 3017:
+ case 3018:
+ case 3019:
+ case 3020:
+ case 3021:
+ case 3022:
+ case 3023:
+ case 3024:
+ case 3025:
+ case 3026:
+ case 3027:
+ case 3028:
+ case 3029:
+ case 3030:
+ case 3031:
+ case 3032:
+ case 3033:
+ case 3034:
+ case 3035:
+ case 3036:
+ case 3037:
+ case 3038:
+ case 3039:
+ case 3040:
+ case 3041:
+ case 3042:
+ case 3043:
+ case 3044:
+ case 3045:
+ case 3046:
+ case 3047:
+ case 3048:
+ case 3049:
+ case 3050:
+ case 3051:
+ case 3052:
+ case 3053:
+ case 3054:
+ case 3055:
+ case 3056:
+ case 3057:
+ case 3058:
+ case 3059:
+ case 3060:
+ case 3061:
+ case 3062:
+ case 3063:
+ case 3064:
+ case 3065:
+ case 3066:
+ case 3067:
+ case 3068:
+ case 3069:
+ case 3070:
+ case 3071:
+ case 3072:
+ case 3073:
+ case 3074:
+ case 3075:
+ case 3076:
+ case 3077:
+ case 3078:
+ case 3079:
+ case 3080:
+ case 3081:
+ case 3082:
+ case 3083:
+ case 3084:
+ case 3085:
+ case 3086:
+ case 3087:
+ case 3088:
+ case 3089:
+ case 3090:
+ case 3091:
+ case 3092:
+ case 3093:
+ case 3094:
+ case 3095:
+ case 3096:
+ case 3097:
+ case 3098:
+ case 3099:
+ case 3100:
+ case 3101:
+ case 3102:
+ case 3103:
+ case 3104:
+ case 3105:
+ case 3106:
+ case 3107:
+ case 3108:
+ case 3109:
+ case 3110:
+ case 3111:
+ case 3112:
+ case 3113:
+ case 3114:
+ case 3115:
+ case 3116:
+ case 3117:
+ case 3118:
+ case 3119:
+ case 3120:
+ case 3121:
+ case 3122:
+ case 3123:
+ case 3124:
+ case 3125:
+ case 3126:
+ case 3127:
+ case 3128:
+ case 3129:
+ case 3130:
+ case 3131:
+ case 3132:
+ case 3133:
+ case 3134:
+ case 3135:
+ case 3136:
+ case 3137:
+ case 3138:
+ case 3139:
+ case 3140:
+ case 3141:
+ case 3142:
+ case 3143:
+ case 3144:
+ case 3145:
+ case 3146:
+ case 3147:
+ case 3148:
+ case 3149:
+ case 3150:
+ case 3151:
+ case 3152:
+ case 3153:
+ case 3154:
+ case 3155:
+ case 3156:
+ case 3157:
+ case 3158:
+ case 3159:
+ case 3160:
+ case 3161:
+ case 3162:
+ case 3163:
+ case 3164:
+ case 3165:
+ case 3166:
+ case 3167:
+ case 3168:
+ case 3169:
+ case 3170:
+ case 3171:
+ case 3172:
+ case 3173:
+ case 3174:
+ case 3175:
+ case 3176:
+ case 3177:
+ case 3178:
+ case 3179:
+ case 3180:
+ case 3181:
+ case 3182:
+ case 3183:
+ case 3184:
+ case 3185:
+ case 3186:
+ case 3187:
+ case 3188:
+ case 3189:
+ case 3190:
+ case 3191:
+ case 3192:
+ case 3193:
+ case 3194:
+ case 3195:
+ case 3196:
+ case 3197:
+ case 3198:
+ case 3199:
+ case 3200:
+ case 3201:
+ case 3202:
+ case 3203:
+ case 3204:
+ case 3205:
+ case 3206:
+ case 3207:
+ case 3208:
+ case 3209:
+ case 3210:
+ case 3211:
+ case 3212:
+ case 3213:
+ case 3214:
+ case 3215:
+ case 3216:
+ case 3217:
+ case 3218:
+ case 3219:
+ case 3220:
+ case 3221:
+ case 3222:
+ case 3223:
+ case 3224:
+ case 3225:
+ case 3226:
+ case 3227:
+ case 3228:
+ case 3229:
+ case 3230:
+ case 3231:
+ case 3232:
+ case 3233:
+ case 3234:
+ case 3235:
+ case 3236:
+ case 3237:
+ case 3238:
+ case 3239:
+ case 3240:
+ case 3241:
+ case 3242:
+ case 3243:
+ case 3244:
+ case 3245:
+ case 3246:
+ case 3247:
+ case 3248:
+ case 3249:
+ case 3250:
+ case 3251:
+ case 3252:
+ case 3253:
+ case 3254:
+ case 3255:
+ case 3256:
+ case 3257:
+ case 3258:
+ case 3259:
+ case 3260:
+ case 3261:
+ case 3262:
+ case 3263:
+ case 3264:
+ case 3265:
+ case 3266:
+ case 3267:
+ case 3268:
+ case 3269:
+ case 3270:
+ case 3271:
+ case 3272:
+ case 3273:
+ case 3274:
+ case 3275:
+ case 3276:
+ case 3277:
+ case 3278:
+ case 3279:
+ case 3280:
+ case 3281:
+ case 3282:
+ case 3283:
+ case 3284:
+ case 3285:
+ case 3286:
+ case 3287:
+ case 3288:
+ case 3289:
+ case 3290:
+ case 3291:
+ case 3292:
+ case 3293:
+ case 3294:
+ case 3295:
+ case 3296:
+ case 3297:
+ case 3298:
+ case 3299:
+ case 3300:
+ case 3301:
+ case 3302:
+ case 3303:
+ case 3304:
+ case 3305:
+ case 3306:
+ case 3307:
+ case 3308:
+ case 3309:
+ case 3310:
+ case 3311:
+ case 3312:
+ case 3313:
+ case 3314:
+ case 3315:
+ case 3316:
+ case 3317:
+ case 3318:
+ case 3319:
+ case 3320:
+ case 3321:
+ case 3322:
+ case 3323:
+ case 3324:
+ case 3325:
+ case 3326:
+ case 3327:
+ case 3328:
+ case 3329:
+ case 3330:
+ case 3331:
+ case 3332:
+ case 3333:
+ case 3334:
+ case 3335:
+ case 3336:
+ case 3337:
+ case 3338:
+ case 3339:
+ case 3340:
+ case 3341:
+ case 3342:
+ case 3343:
+ case 3344:
+ case 3345:
+ case 3346:
+ case 3347:
+ case 3348:
+ case 3349:
+ case 3350:
+ case 3351:
+ case 3352:
+ case 3353:
+ case 3354:
+ case 3355:
+ case 3356:
+ case 3357:
+ case 3358:
+ case 3359:
+ case 3360:
+ case 3361:
+ case 3362:
+ case 3363:
+ case 3364:
+ case 3365:
+ case 3366:
+ case 3367:
+ case 3368:
+ case 3369:
+ case 3370:
+ case 3371:
+ case 3372:
+ case 3373:
+ case 3374:
+ case 3375:
+ case 3376:
+ case 3377:
+ case 3378:
+ case 3379:
+ case 3380:
+ case 3381:
+ case 3382:
+ case 3383:
+ case 3384:
+ case 3385:
+ case 3386:
+ case 3387:
+ case 3388:
+ case 3389:
+ case 3390:
+ case 3391:
+ case 3392:
+ case 3393:
+ case 3394:
+ case 3395:
+ case 3396:
+ case 3397:
+ case 3398:
+ case 3399:
+ case 3400:
+ case 3401:
+ case 3402:
+ case 3403:
+ case 3404:
+ case 3405:
+ case 3406:
+ case 3407:
+ case 3408:
+ case 3409:
+ case 3410:
+ case 3411:
+ case 3412:
+ case 3413:
+ case 3414:
+ case 3415:
+ case 3416:
+ case 3417:
+ case 3418:
+ case 3419:
+ case 3420:
+ case 3421:
+ case 3422:
+ case 3423:
+ case 3424:
+ case 3425:
+ case 3426:
+ case 3427:
+ case 3428:
+ case 3429:
+ case 3430:
+ case 3431:
+ case 3432:
+ case 3433:
+ case 3434:
+ case 3435:
+ case 3436:
+ case 3437:
+ case 3438:
+ case 3439:
+ case 3440:
+ case 3441:
+ case 3442:
+ case 3443:
+ case 3444:
+ case 3445:
+ case 3446:
+ case 3447:
+ case 3448:
+ case 3449:
+ case 3450:
+ case 3451:
+ case 3452:
+ case 3453:
+ case 3454:
+ case 3455:
+ case 3456:
+ case 3457:
+ case 3458:
+ case 3459:
+ case 3460:
+ case 3461:
+ case 3462:
+ case 3463:
+ case 3464:
+ case 3465:
+ case 3466:
+ case 3467:
+ case 3468:
+ case 3469:
+ case 3470:
+ case 3471:
+ case 3472:
+ case 3473:
+ case 3474:
+ case 3475:
+ case 3476:
+ case 3477:
+ case 3478:
+ case 3479:
+ case 3480:
+ case 3481:
+ case 3482:
+ case 3483:
+ case 3484:
+ case 3485:
+ case 3486:
+ case 3487:
+ case 3488:
+ case 3489:
+ case 3490:
+ case 3491:
+ case 3492:
+ case 3493:
+ case 3494:
+ case 3495:
+ case 3496:
+ case 3497:
+ case 3498:
+ case 3499:
+ case 3500:
+ case 3501:
+ case 3502:
+ case 3503:
+ case 3504:
+ case 3505:
+ case 3506:
+ case 3507:
+ case 3508:
+ case 3509:
+ case 3510:
+ case 3511:
+ case 3512:
+ case 3513:
+ case 3514:
+ case 3515:
+ case 3516:
+ case 3517:
+ case 3518:
+ case 3519:
+ case 3520:
+ case 3521:
+ case 3522:
+ case 3523:
+ case 3524:
+ case 3525:
+ case 3526:
+ case 3527:
+ case 3528:
+ case 3529:
+ case 3530:
+ case 3531:
+ case 3532:
+ case 3533:
+ case 3534:
+ case 3535:
+ case 3536:
+ case 3537:
+ case 3538:
+ case 3539:
+ case 3540:
+ case 3541:
+ case 3542:
+ case 3543:
+ case 3544:
+ case 3545:
+ case 3546:
+ case 3547:
+ case 3548:
+ case 3549:
+ case 3550:
+ case 3551:
+ case 3552:
+ case 3553:
+ case 3554:
+ case 3555:
+ case 3556:
+ case 3557:
+ case 3558:
+ case 3559:
+ case 3560:
+ case 3561:
+ case 3562:
+ case 3563:
+ case 3564:
+ case 3565:
+ case 3566:
+ case 3567:
+ case 3568:
+ case 3569:
+ case 3570:
+ case 3571:
+ case 3572:
+ case 3573:
+ case 3574:
+ case 3575:
+ case 3576:
+ case 3577:
+ case 3578:
+ case 3579:
+ case 3580:
+ case 3581:
+ case 3582:
+ case 3583:
+ case 3584:
+ case 3585:
+ case 3586:
+ case 3587:
+ case 3588:
+ case 3589:
+ case 3590:
+ case 3591:
+ case 3592:
+ case 3593:
+ case 3594:
+ case 3595:
+ case 3596:
+ case 3597:
+ case 3598:
+ case 3599:
+ case 3600:
+ case 3601:
+ case 3602:
+ case 3603:
+ case 3604:
+ case 3605:
+ case 3606:
+ case 3607:
+ case 3608:
+ case 3609:
+ case 3610:
+ case 3611:
+ case 3612:
+ case 3613:
+ case 3614:
+ case 3615:
+ case 3616:
+ case 3617:
+ case 3618:
+ case 3619:
+ case 3620:
+ case 3621:
+ case 3622:
+ case 3623:
+ case 3624:
+ case 3625:
+ case 3626:
+ case 3627:
+ case 3628:
+ case 3629:
+ case 3630:
+ case 3631:
+ case 3632:
+ case 3633:
+ case 3634:
+ case 3635:
+ case 3636:
+ case 3637:
+ case 3638:
+ case 3639:
+ case 3640:
+ case 3641:
+ case 3642:
+ case 3643:
+ case 3644:
+ case 3645:
+ case 3646:
+ case 3647:
+ case 3648:
+ case 3649:
+ case 3650:
+ case 3651:
+ case 3652:
+ case 3653:
+ case 3654:
+ case 3655:
+ case 3656:
+ case 3657:
+ case 3658:
+ case 3659:
+ case 3660:
+ case 3661:
+ case 3662:
+ case 3663:
+ case 3664:
+ case 3665:
+ case 3666:
+ case 3667:
+ case 3668:
+ case 3669:
+ case 3670:
+ case 3671:
+ case 3672:
+ case 3673:
+ case 3674:
+ case 3675:
+ case 3676:
+ case 3677:
+ case 3678:
+ case 3679:
+ case 3680:
+ case 3681:
+ case 3682:
+ case 3683:
+ case 3684:
+ case 3685:
+ case 3686:
+ case 3687:
+ case 3688:
+ case 3689:
+ case 3690:
+ case 3691:
+ case 3692:
+ case 3693:
+ case 3694:
+ case 3695:
+ case 3696:
+ case 3697:
+ case 3698:
+ case 3699:
+ case 3700:
+ case 3701:
+ case 3702:
+ case 3703:
+ case 3704:
+ case 3705:
+ case 3706:
+ case 3707:
+ case 3708:
+ case 3709:
+ case 3710:
+ case 3711:
+ case 3712:
+ case 3713:
+ case 3714:
+ case 3715:
+ case 3716:
+ case 3717:
+ case 3718:
+ case 3719:
+ case 3720:
+ case 3721:
+ case 3722:
+ case 3723:
+ case 3724:
+ case 3725:
+ case 3726:
+ case 3727:
+ case 3728:
+ case 3729:
+ case 3730:
+ case 3731:
+ case 3732:
+ case 3733:
+ case 3734:
+ case 3735:
+ case 3736:
+ case 3737:
+ case 3738:
+ case 3739:
+ case 3740:
+ case 3741:
+ case 3742:
+ case 3743:
+ case 3744:
+ case 3745:
+ case 3746:
+ case 3747:
+ case 3748:
+ case 3749:
+ case 3750:
+ case 3751:
+ case 3752:
+ case 3753:
+ case 3754:
+ case 3755:
+ case 3756:
+ case 3757:
+ case 3758:
+ case 3759:
+ case 3760:
+ case 3761:
+ case 3762:
+ case 3763:
+ case 3764:
+ case 3765:
+ case 3766:
+ case 3767:
+ case 3768:
+ case 3769:
+ case 3770:
+ case 3771:
+ case 3772:
+ case 3773:
+ case 3774:
+ case 3775:
+ case 3776:
+ case 3777:
+ case 3778:
+ case 3779:
+ case 3780:
+ case 3781:
+ case 3782:
+ case 3783:
+ case 3784:
+ case 3785:
+ case 3786:
+ case 3787:
+ case 3788:
+ case 3789:
+ case 3790:
+ case 3791:
+ case 3792:
+ case 3793:
+ case 3794:
+ case 3795:
+ case 3796:
+ case 3797:
+ case 3798:
+ case 3799:
+ case 3800:
+ case 3801:
+ case 3802:
+ case 3803:
+ case 3804:
+ case 3805:
+ case 3806:
+ case 3807:
+ case 3808:
+ case 3809:
+ case 3810:
+ case 3811:
+ case 3812:
+ case 3813:
+ case 3814:
+ case 3815:
+ case 3816:
+ case 3817:
+ case 3818:
+ case 3819:
+ case 3820:
+ case 3821:
+ case 3822:
+ case 3823:
+ case 3824:
+ case 3825:
+ case 3826:
+ case 3827:
+ case 3828:
+ case 3829:
+ case 3830:
+ case 3831:
+ case 3832:
+ case 3833:
+ case 3834:
+ case 3835:
+ case 3836:
+ case 3837:
+ case 3838:
+ case 3839:
+ case 3840:
+ case 3841:
+ case 3842:
+ case 3843:
+ case 3844:
+ case 3845:
+ case 3846:
+ case 3847:
+ case 3848:
+ case 3849:
+ case 3850:
+ case 3851:
+ case 3852:
+ case 3853:
+ case 3854:
+ case 3855:
+ case 3856:
+ case 3857:
+ case 3858:
+ case 3859:
+ case 3860:
+ case 3861:
+ case 3862:
+ case 3863:
+ case 3864:
+ case 3865:
+ case 3866:
+ case 3867:
+ case 3868:
+ case 3869:
+ case 3870:
+ case 3871:
+ case 3872:
+ case 3873:
+ case 3874:
+ case 3875:
+ case 3876:
+ case 3877:
+ case 3878:
+ case 3879:
+ case 3880:
+ case 3881:
+ case 3882:
+ case 3883:
+ case 3884:
+ case 3885:
+ case 3886:
+ case 3887:
+ case 3888:
+ case 3889:
+ case 3890:
+ case 3891:
+ case 3892:
+ case 3893:
+ case 3894:
+ case 3895:
+ case 3896:
+ case 3897:
+ case 3898:
+ case 3899:
+ case 3900:
+ case 3901:
+ case 3902:
+ case 3903:
+ case 3904:
+ case 3905:
+ case 3906:
+ case 3907:
+ case 3908:
+ case 3909:
+ case 3910:
+ case 3911:
+ case 3912:
+ case 3913:
+ case 3914:
+ case 3915:
+ case 3916:
+ case 3917:
+ case 3918:
+ case 3919:
+ case 3920:
+ case 3921:
+ case 3922:
+ case 3923:
+ case 3924:
+ case 3925:
+ case 3926:
+ case 3927:
+ case 3928:
+ case 3929:
+ case 3930:
+ case 3931:
+ case 3932:
+ case 3933:
+ case 3934:
+ case 3935:
+ case 3936:
+ case 3937:
+ case 3938:
+ case 3939:
+ case 3940:
+ case 3941:
+ case 3942:
+ case 3943:
+ case 3944:
+ case 3945:
+ case 3946:
+ case 3947:
+ case 3948:
+ case 3949:
+ case 3950:
+ case 3951:
+ case 3952:
+ case 3953:
+ case 3954:
+ case 3955:
+ case 3956:
+ case 3957:
+ case 3958:
+ case 3959:
+ case 3960:
+ case 3961:
+ case 3962:
+ case 3963:
+ case 3964:
+ case 3965:
+ case 3966:
+ case 3967:
+ case 3968:
+ case 3969:
+ case 3970:
+ case 3971:
+ case 3972:
+ case 3973:
+ case 3974:
+ case 3975:
+ case 3976:
+ case 3977:
+ case 3978:
+ case 3979:
+ case 3980:
+ case 3981:
+ case 3982:
+ case 3983:
+ case 3984:
+ case 3985:
+ case 3986:
+ case 3987:
+ case 3988:
+ case 3989:
+ case 3990:
+ case 3991:
+ case 3992:
+ case 3993:
+ case 3994:
+ case 3995:
+ case 3996:
+ case 3997:
+ case 3998:
+ case 3999:
+ case 4000:
+ case 4001:
+ case 4002:
+ case 4003:
+ case 4004:
+ case 4005:
+ case 4006:
+ case 4007:
+ case 4008:
+ case 4009:
+ case 4010:
+ case 4011:
+ case 4012:
+ case 4013:
+ case 4014:
+ case 4015:
+ case 4016:
+ case 4017:
+ case 4018:
+ case 4019:
+ case 4020:
+ case 4021:
+ case 4022:
+ case 4023:
+ case 4024:
+ case 4025:
+ case 4026:
+ case 4027:
+ case 4028:
+ case 4029:
+ case 4030:
+ case 4031:
+ case 4032:
+ case 4033:
+ case 4034:
+ case 4035:
+ case 4036:
+ case 4037:
+ case 4038:
+ case 4039:
+ case 4040:
+ case 4041:
+ case 4042:
+ case 4043:
+ case 4044:
+ case 4045:
+ case 4046:
+ case 4047:
+ case 4048:
+ case 4049:
+ case 4050:
+ case 4051:
+ case 4052:
+ case 4053:
+ case 4054:
+ case 4055:
+ case 4056:
+ case 4057:
+ case 4058:
+ case 4059:
+ case 4060:
+ case 4061:
+ case 4062:
+ case 4063:
+ case 4064:
+ case 4065:
+ case 4066:
+ case 4067:
+ case 4068:
+ case 4069:
+ case 4070:
+ case 4071:
+ case 4072:
+ case 4073:
+ case 4074:
+ case 4075:
+ case 4076:
+ case 4077:
+ case 4078:
+ case 4079:
+ case 4080:
+ case 4081:
+ case 4082:
+ case 4083:
+ case 4084:
+ case 4085:
+ case 4086:
+ case 4087:
+ case 4088:
+ case 4089:
+ case 4090:
+ case 4091:
+ case 4092:
+ case 4093:
+ case 4094:
+ case 4095:
+ case 4096:
+ case 4097:
+ case 4098:
+ case 4099:
+ case 4100:
+ case 4101:
+ case 4102:
+ case 4103:
+ case 4104:
+ case 4105:
+ case 4106:
+ case 4107:
+ case 4108:
+ case 4109:
+ case 4110:
+ case 4111:
+ case 4112:
+ case 4113:
+ case 4114:
+ case 4115:
+ case 4116:
+ case 4117:
+ case 4118:
+ case 4119:
+ case 4120:
+ case 4121:
+ case 4122:
+ case 4123:
+ case 4124:
+ case 4125:
+ case 4126:
+ case 4127:
+ case 4128:
+ case 4129:
+ case 4130:
+ case 4131:
+ case 4132:
+ case 4133:
+ case 4134:
+ case 4135:
+ case 4136:
+ case 4137:
+ case 4138:
+ case 4139:
+ case 4140:
+ case 4141:
+ case 4142:
+ case 4143:
+ case 4144:
+ case 4145:
+ case 4146:
+ case 4147:
+ case 4148:
+ case 4149:
+ case 4150:
+ case 4151:
+ case 4152:
+ case 4153:
+ case 4154:
+ case 4155:
+ case 4156:
+ case 4157:
+ case 4158:
+ case 4159:
+ case 4160:
+ case 4161:
+ case 4162:
+ case 4163:
+ case 4164:
+ case 4165:
+ case 4166:
+ case 4167:
+ case 4168:
+ case 4169:
+ case 4170:
+ case 4171:
+ case 4172:
+ case 4173:
+ case 4174:
+ case 4175:
+ case 4176:
+ case 4177:
+ case 4178:
+ case 4179:
+ case 4180:
+ case 4181:
+ case 4182:
+ case 4183:
+ case 4184:
+ case 4185:
+ case 4186:
+ case 4187:
+ case 4188:
+ case 4189:
+ case 4190:
+ case 4191:
+ case 4192:
+ case 4193:
+ case 4194:
+ case 4195:
+ case 4196:
+ case 4197:
+ case 4198:
+ case 4199:
+ case 4200:
+ case 4201:
+ case 4202:
+ case 4203:
+ case 4204:
+ case 4205:
+ case 4206:
+ case 4207:
+ case 4208:
+ case 4209:
+ case 4210:
+ case 4211:
+ case 4212:
+ case 4213:
+ case 4214:
+ case 4215:
+ case 4216:
+ case 4217:
+ case 4218:
+ case 4219:
+ case 4220:
+ case 4221:
+ case 4222:
+ case 4223:
+ case 4224:
+ case 4225:
+ case 4226:
+ case 4227:
+ case 4228:
+ case 4229:
+ case 4230:
+ case 4231:
+ case 4232:
+ case 4233:
+ case 4234:
+ case 4235:
+ case 4236:
+ case 4237:
+ case 4238:
+ case 4239:
+ case 4240:
+ case 4241:
+ case 4242:
+ case 4243:
+ case 4244:
+ case 4245:
+ case 4246:
+ case 4247:
+ case 4248:
+ case 4249:
+ case 4250:
+ case 4251:
+ case 4252:
+ case 4253:
+ case 4254:
+ case 4255:
+ case 4256:
+ case 4257:
+ case 4258:
+ case 4259:
+ case 4260:
+ case 4261:
+ case 4262:
+ case 4263:
+ case 4264:
+ case 4265:
+ case 4266:
+ case 4267:
+ case 4268:
+ case 4269:
+ case 4270:
+ case 4271:
+ case 4272:
+ case 4273:
+ case 4274:
+ case 4275:
+ case 4276:
+ case 4277:
+ case 4278:
+ case 4279:
+ case 4280:
+ case 4281:
+ case 4282:
+ case 4283:
+ case 4284:
+ case 4285:
+ case 4286:
+ case 4287:
+ case 4288:
+ case 4289:
+ case 4290:
+ case 4291:
+ case 4292:
+ case 4293:
+ case 4294:
+ case 4295:
+ case 4296:
+ case 4297:
+ case 4298:
+ case 4299:
+ case 4300:
+ case 4301:
+ case 4302:
+ case 4303:
+ case 4304:
+ case 4305:
+ case 4306:
+ case 4307:
+ case 4308:
+ case 4309:
+ case 4310:
+ case 4311:
+ case 4312:
+ case 4313:
+ case 4314:
+ case 4315:
+ case 4316:
+ case 4317:
+ case 4318:
+ case 4319:
+ case 4320:
+ case 4321:
+ case 4322:
+ case 4323:
+ case 4324:
+ case 4325:
+ case 4326:
+ case 4327:
+ case 4328:
+ case 4329:
+ case 4330:
+ case 4331:
+ case 4332:
+ case 4333:
+ case 4334:
+ case 4335:
+ case 4336:
+ case 4337:
+ case 4338:
+ case 4339:
+ case 4340:
+ case 4341:
+ case 4342:
+ case 4343:
+ case 4344:
+ case 4345:
+ case 4346:
+ case 4347:
+ case 4348:
+ case 4349:
+ case 4350:
+ case 4351:
+ case 4352:
+ case 4353:
+ case 4354:
+ case 4355:
+ case 4356:
+ case 4357:
+ case 4358:
+ case 4359:
+ case 4360:
+ case 4361:
+ case 4362:
+ case 4363:
+ case 4364:
+ case 4365:
+ case 4366:
+ case 4367:
+ case 4368:
+ case 4369:
+ case 4370:
+ case 4371:
+ case 4372:
+ case 4373:
+ case 4374:
+ case 4375:
+ case 4376:
+ case 4377:
+ case 4378:
+ case 4379:
+ case 4380:
+ case 4381:
+ case 4382:
+ case 4383:
+ case 4384:
+ case 4385:
+ case 4386:
+ case 4387:
+ case 4388:
+ case 4389:
+ case 4390:
+ case 4391:
+ case 4392:
+ case 4393:
+ case 4394:
+ case 4395:
+ case 4396:
+ case 4397:
+ case 4398:
+ case 4399:
+ case 4400:
+ case 4401:
+ case 4402:
+ case 4403:
+ case 4404:
+ case 4405:
+ case 4406:
+ case 4407:
+ case 4408:
+ case 4409:
+ case 4410:
+ case 4411:
+ case 4412:
+ case 4413:
+ case 4414:
+ case 4415:
+ case 4416:
+ case 4417:
+ case 4418:
+ case 4419:
+ case 4420:
+ case 4421:
+ case 4422:
+ case 4423:
+ case 4424:
+ case 4425:
+ case 4426:
+ case 4427:
+ case 4428:
+ case 4429:
+ case 4430:
+ case 4431:
+ case 4432:
+ case 4433:
+ case 4434:
+ case 4435:
+ case 4436:
+ case 4437:
+ case 4438:
+ case 4439:
+ case 4440:
+ case 4441:
+ case 4442:
+ case 4443:
+ case 4444:
+ case 4445:
+ case 4446:
+ case 4447:
+ case 4448:
+ case 4449:
+ case 4450:
+ case 4451:
+ case 4452:
+ case 4453:
+ case 4454:
+ case 4455:
+ case 4456:
+ case 4457:
+ case 4458:
+ case 4459:
+ case 4460:
+ case 4461:
+ case 4462:
+ case 4463:
+ case 4464:
+ case 4465:
+ case 4466:
+ case 4467:
+ case 4468:
+ case 4469:
+ case 4470:
+ case 4471:
+ case 4472:
+ case 4473:
+ case 4474:
+ case 4475:
+ case 4476:
+ case 4477:
+ case 4478:
+ case 4479:
+ case 4480:
+ case 4481:
+ case 4482:
+ case 4483:
+ case 4484:
+ case 4485:
+ case 4486:
+ case 4487:
+ case 4488:
+ case 4489:
+ case 4490:
+ case 4491:
+ case 4492:
+ case 4493:
+ case 4494:
+ case 4495:
+ case 4496:
+ case 4497:
+ case 4498:
+ case 4499:
+ case 4500:
+ case 4501:
+ case 4502:
+ case 4503:
+ case 4504:
+ case 4505:
+ case 4506:
+ case 4507:
+ case 4508:
+ case 4509:
+ case 4510:
+ case 4511:
+ case 4512:
+ case 4513:
+ case 4514:
+ case 4515:
+ case 4516:
+ case 4517:
+ case 4518:
+ case 4519:
+ case 4520:
+ case 4521:
+ case 4522:
+ case 4523:
+ case 4524:
+ case 4525:
+ case 4526:
+ case 4527:
+ case 4528:
+ case 4529:
+ case 4530:
+ case 4531:
+ case 4532:
+ case 4533:
+ case 4534:
+ case 4535:
+ case 4536:
+ case 4537:
+ case 4538:
+ case 4539:
+ case 4540:
+ case 4541:
+ case 4542:
+ case 4543:
+ case 4544:
+ case 4545:
+ case 4546:
+ case 4547:
+ case 4548:
+ case 4549:
+ case 4550:
+ case 4551:
+ case 4552:
+ case 4553:
+ case 4554:
+ case 4555:
+ case 4556:
+ case 4557:
+ case 4558:
+ case 4559:
+ case 4560:
+ case 4561:
+ case 4562:
+ case 4563:
+ case 4564:
+ case 4565:
+ case 4566:
+ case 4567:
+ case 4568:
+ case 4569:
+ case 4570:
+ case 4571:
+ case 4572:
+ case 4573:
+ case 4574:
+ case 4575:
+ case 4576:
+ case 4577:
+ case 4578:
+ case 4579:
+ case 4580:
+ case 4581:
+ case 4582:
+ case 4583:
+ case 4584:
+ case 4585:
+ case 4586:
+ case 4587:
+ case 4588:
+ case 4589:
+ case 4590:
+ case 4591:
+ case 4592:
+ case 4593:
+ case 4594:
+ case 4595:
+ case 4596:
+ case 4597:
+ case 4598:
+ case 4599:
+ case 4600:
+ case 4601:
+ case 4602:
+ case 4603:
+ case 4604:
+ case 4605:
+ case 4606:
+ case 4607:
+ case 4608:
+ case 4609:
+ case 4610:
+ case 4611:
+ case 4612:
+ case 4613:
+ case 4614:
+ case 4615:
+ case 4616:
+ case 4617:
+ case 4618:
+ case 4619:
+ case 4620:
+ case 4621:
+ case 4622:
+ case 4623:
+ case 4624:
+ case 4625:
+ case 4626:
+ case 4627:
+ case 4628:
+ case 4629:
+ case 4630:
+ case 4631:
+ case 4632:
+ case 4633:
+ case 4634:
+ case 4635:
+ case 4636:
+ case 4637:
+ case 4638:
+ case 4639:
+ case 4640:
+ case 4641:
+ case 4642:
+ case 4643:
+ case 4644:
+ case 4645:
+ case 4646:
+ case 4647:
+ case 4648:
+ case 4649:
+ case 4650:
+ case 4651:
+ case 4652:
+ case 4653:
+ case 4654:
+ case 4655:
+ case 4656:
+ case 4657:
+ case 4658:
+ case 4659:
+ case 4660:
+ case 4661:
+ case 4662:
+ case 4663:
+ case 4664:
+ case 4665:
+ case 4666:
+ case 4667:
+ case 4668:
+ case 4669:
+ case 4670:
+ case 4671:
+ case 4672:
+ case 4673:
+ case 4674:
+ case 4675:
+ case 4676:
+ case 4677:
+ case 4678:
+ case 4679:
+ case 4680:
+ case 4681:
+ case 4682:
+ case 4683:
+ case 4684:
+ case 4685:
+ case 4686:
+ case 4687:
+ case 4688:
+ case 4689:
+ case 4690:
+ case 4691:
+ case 4692:
+ case 4693:
+ case 4694:
+ case 4695:
+ case 4696:
+ case 4697:
+ case 4698:
+ case 4699:
+ case 4700:
+ case 4701:
+ case 4702:
+ case 4703:
+ case 4704:
+ case 4705:
+ case 4706:
+ case 4707:
+ case 4708:
+ case 4709:
+ case 4710:
+ case 4711:
+ case 4712:
+ case 4713:
+ case 4714:
+ case 4715:
+ case 4716:
+ case 4717:
+ case 4718:
+ case 4719:
+ case 4720:
+ case 4721:
+ case 4722:
+ case 4723:
+ case 4724:
+ case 4725:
+ case 4726:
+ case 4727:
+ case 4728:
+ case 4729:
+ case 4730:
+ case 4731:
+ case 4732:
+ case 4733:
+ case 4734:
+ case 4735:
+ case 4736:
+ case 4737:
+ case 4738:
+ case 4739:
+ case 4740:
+ case 4741:
+ case 4742:
+ case 4743:
+ case 4744:
+ case 4745:
+ case 4746:
+ case 4747:
+ case 4748:
+ case 4749:
+ case 4750:
+ case 4751:
+ case 4752:
+ case 4753:
+ case 4754:
+ case 4755:
+ case 4756:
+ case 4757:
+ case 4758:
+ case 4759:
+ case 4760:
+ case 4761:
+ case 4762:
+ case 4763:
+ case 4764:
+ case 4765:
+ case 4766:
+ case 4767:
+ case 4768:
+ case 4769:
+ case 4770:
+ case 4771:
+ case 4772:
+ case 4773:
+ case 4774:
+ case 4775:
+ case 4776:
+ case 4777:
+ case 4778:
+ case 4779:
+ case 4780:
+ case 4781:
+ case 4782:
+ case 4783:
+ case 4784:
+ case 4785:
+ case 4786:
+ case 4787:
+ case 4788:
+ case 4789:
+ case 4790:
+ case 4791:
+ case 4792:
+ case 4793:
+ case 4794:
+ case 4795:
+ case 4796:
+ case 4797:
+ case 4798:
+ case 4799:
+ case 4800:
+ case 4801:
+ case 4802:
+ case 4803:
+ case 4804:
+ case 4805:
+ case 4806:
+ case 4807:
+ case 4808:
+ case 4809:
+ case 4810:
+ case 4811:
+ case 4812:
+ case 4813:
+ case 4814:
+ case 4815:
+ case 4816:
+ case 4817:
+ case 4818:
+ case 4819:
+ case 4820:
+ case 4821:
+ case 4822:
+ case 4823:
+ case 4824:
+ case 4825:
+ case 4826:
+ case 4827:
+ case 4828:
+ case 4829:
+ case 4830:
+ case 4831:
+ case 4832:
+ case 4833:
+ case 4834:
+ case 4835:
+ case 4836:
+ case 4837:
+ case 4838:
+ case 4839:
+ case 4840:
+ case 4841:
+ case 4842:
+ case 4843:
+ case 4844:
+ case 4845:
+ case 4846:
+ case 4847:
+ case 4848:
+ case 4849:
+ case 4850:
+ case 4851:
+ case 4852:
+ case 4853:
+ case 4854:
+ case 4855:
+ case 4856:
+ case 4857:
+ case 4858:
+ case 4859:
+ case 4860:
+ case 4861:
+ case 4862:
+ case 4863:
+ case 4864:
+ case 4865:
+ case 4866:
+ case 4867:
+ case 4868:
+ case 4869:
+ case 4870:
+ case 4871:
+ case 4872:
+ case 4873:
+ case 4874:
+ case 4875:
+ case 4876:
+ case 4877:
+ case 4878:
+ case 4879:
+ case 4880:
+ case 4881:
+ case 4882:
+ case 4883:
+ case 4884:
+ case 4885:
+ case 4886:
+ case 4887:
+ case 4888:
+ case 4889:
+ case 4890:
+ case 4891:
+ case 4892:
+ case 4893:
+ case 4894:
+ case 4895:
+ case 4896:
+ case 4897:
+ case 4898:
+ case 4899:
+ case 4900:
+ case 4901:
+ case 4902:
+ case 4903:
+ case 4904:
+ case 4905:
+ case 4906:
+ case 4907:
+ case 4908:
+ case 4909:
+ case 4910:
+ case 4911:
+ case 4912:
+ case 4913:
+ case 4914:
+ case 4915:
+ case 4916:
+ case 4917:
+ case 4918:
+ case 4919:
+ case 4920:
+ case 4921:
+ case 4922:
+ case 4923:
+ case 4924:
+ case 4925:
+ case 4926:
+ case 4927:
+ case 4928:
+ case 4929:
+ case 4930:
+ case 4931:
+ case 4932:
+ case 4933:
+ case 4934:
+ case 4935:
+ case 4936:
+ case 4937:
+ case 4938:
+ case 4939:
+ case 4940:
+ case 4941:
+ case 4942:
+ case 4943:
+ case 4944:
+ case 4945:
+ case 4946:
+ case 4947:
+ case 4948:
+ case 4949:
+ case 4950:
+ case 4951:
+ case 4952:
+ case 4953:
+ case 4954:
+ case 4955:
+ case 4956:
+ case 4957:
+ case 4958:
+ case 4959:
+ case 4960:
+ case 4961:
+ case 4962:
+ case 4963:
+ case 4964:
+ case 4965:
+ case 4966:
+ case 4967:
+ case 4968:
+ case 4969:
+ case 4970:
+ case 4971:
+ case 4972:
+ case 4973:
+ case 4974:
+ case 4975:
+ case 4976:
+ case 4977:
+ case 4978:
+ case 4979:
+ case 4980:
+ case 4981:
+ case 4982:
+ case 4983:
+ case 4984:
+ case 4985:
+ case 4986:
+ case 4987:
+ case 4988:
+ case 4989:
+ case 4990:
+ case 4991:
+ case 4992:
+ case 4993:
+ case 4994:
+ case 4995:
+ case 4996:
+ case 4997:
+ case 4998:
+ case 4999:
+ case 5000:
+ case 5001:
+ case 5002:
+ case 5003:
+ case 5004:
+ case 5005:
+ case 5006:
+ case 5007:
+ case 5008:
+ case 5009:
+ case 5010:
+ case 5011:
+ case 5012:
+ case 5013:
+ case 5014:
+ case 5015:
+ case 5016:
+ case 5017:
+ case 5018:
+ case 5019:
+ case 5020:
+ case 5021:
+ case 5022:
+ case 5023:
+ case 5024:
+ case 5025:
+ case 5026:
+ case 5027:
+ case 5028:
+ case 5029:
+ case 5030:
+ case 5031:
+ case 5032:
+ case 5033:
+ case 5034:
+ case 5035:
+ case 5036:
+ case 5037:
+ case 5038:
+ case 5039:
+ case 5040:
+ case 5041:
+ case 5042:
+ case 5043:
+ case 5044:
+ case 5045:
+ case 5046:
+ case 5047:
+ case 5048:
+ case 5049:
+ case 5050:
+ case 5051:
+ case 5052:
+ case 5053:
+ case 5054:
+ case 5055:
+ case 5056:
+ case 5057:
+ case 5058:
+ case 5059:
+ case 5060:
+ case 5061:
+ case 5062:
+ case 5063:
+ case 5064:
+ case 5065:
+ case 5066:
+ case 5067:
+ case 5068:
+ case 5069:
+ case 5070:
+ case 5071:
+ case 5072:
+ case 5073:
+ case 5074:
+ case 5075:
+ case 5076:
+ case 5077:
+ case 5078:
+ case 5079:
+ case 5080:
+ case 5081:
+ case 5082:
+ case 5083:
+ case 5084:
+ case 5085:
+ case 5086:
+ case 5087:
+ case 5088:
+ case 5089:
+ case 5090:
+ case 5091:
+ case 5092:
+ case 5093:
+ case 5094:
+ case 5095:
+ case 5096:
+ case 5097:
+ case 5098:
+ case 5099:
+ case 5100:
+ case 5101:
+ case 5102:
+ case 5103:
+ case 5104:
+ case 5105:
+ case 5106:
+ case 5107:
+ case 5108:
+ case 5109:
+ case 5110:
+ case 5111:
+ case 5112:
+ case 5113:
+ case 5114:
+ case 5115:
+ case 5116:
+ case 5117:
+ case 5118:
+ case 5119:
+ case 5120:
+ case 5121:
+ case 5122:
+ case 5123:
+ case 5124:
+ case 5125:
+ case 5126:
+ case 5127:
+ case 5128:
+ case 5129:
+ case 5130:
+ case 5131:
+ case 5132:
+ case 5133:
+ case 5134:
+ case 5135:
+ case 5136:
+ case 5137:
+ case 5138:
+ case 5139:
+ case 5140:
+ case 5141:
+ case 5142:
+ case 5143:
+ case 5144:
+ case 5145:
+ case 5146:
+ case 5147:
+ case 5148:
+ case 5149:
+ case 5150:
+ case 5151:
+ case 5152:
+ case 5153:
+ case 5154:
+ case 5155:
+ case 5156:
+ case 5157:
+ case 5158:
+ case 5159:
+ case 5160:
+ case 5161:
+ case 5162:
+ case 5163:
+ case 5164:
+ case 5165:
+ case 5166:
+ case 5167:
+ case 5168:
+ case 5169:
+ case 5170:
+ case 5171:
+ case 5172:
+ case 5173:
+ case 5174:
+ case 5175:
+ case 5176:
+ case 5177:
+ case 5178:
+ case 5179:
+ case 5180:
+ case 5181:
+ case 5182:
+ case 5183:
+ case 5184:
+ case 5185:
+ case 5186:
+ case 5187:
+ case 5188:
+ case 5189:
+ case 5190:
+ case 5191:
+ case 5192:
+ case 5193:
+ case 5194:
+ case 5195:
+ case 5196:
+ case 5197:
+ case 5198:
+ case 5199:
+ case 5200:
+ case 5201:
+ case 5202:
+ case 5203:
+ case 5204:
+ case 5205:
+ case 5206:
+ case 5207:
+ case 5208:
+ case 5209:
+ case 5210:
+ case 5211:
+ case 5212:
+ case 5213:
+ case 5214:
+ case 5215:
+ case 5216:
+ case 5217:
+ case 5218:
+ case 5219:
+ case 5220:
+ case 5221:
+ case 5222:
+ case 5223:
+ case 5224:
+ case 5225:
+ case 5226:
+ case 5227:
+ case 5228:
+ case 5229:
+ case 5230:
+ case 5231:
+ case 5232:
+ case 5233:
+ case 5234:
+ case 5235:
+ case 5236:
+ case 5237:
+ case 5238:
+ case 5239:
+ case 5240:
+ case 5241:
+ case 5242:
+ case 5243:
+ case 5244:
+ case 5245:
+ case 5246:
+ case 5247:
+ case 5248:
+ case 5249:
+ case 5250:
+ case 5251:
+ case 5252:
+ case 5253:
+ case 5254:
+ case 5255:
+ case 5256:
+ case 5257:
+ case 5258:
+ case 5259:
+ case 5260:
+ case 5261:
+ case 5262:
+ case 5263:
+ case 5264:
+ case 5265:
+ case 5266:
+ case 5267:
+ case 5268:
+ case 5269:
+ case 5270:
+ case 5271:
+ case 5272:
+ case 5273:
+ case 5274:
+ case 5275:
+ case 5276:
+ case 5277:
+ case 5278:
+ case 5279:
+ case 5280:
+ case 5281:
+ case 5282:
+ case 5283:
+ case 5284:
+ case 5285:
+ case 5286:
+ case 5287:
+ case 5288:
+ case 5289:
+ case 5290:
+ case 5291:
+ case 5292:
+ case 5293:
+ case 5294:
+ case 5295:
+ case 5296:
+ case 5297:
+ case 5298:
+ case 5299:
+ case 5300:
+ case 5301:
+ case 5302:
+ case 5303:
+ case 5304:
+ case 5305:
+ case 5306:
+ case 5307:
+ case 5308:
+ case 5309:
+ case 5310:
+ case 5311:
+ case 5312:
+ case 5313:
+ case 5314:
+ case 5315:
+ case 5316:
+ case 5317:
+ case 5318:
+ case 5319:
+ case 5320:
+ case 5321:
+ case 5322:
+ case 5323:
+ case 5324:
+ case 5325:
+ case 5326:
+ case 5327:
+ case 5328:
+ case 5329:
+ case 5330:
+ case 5331:
+ case 5332:
+ case 5333:
+ case 5334:
+ case 5335:
+ case 5336:
+ case 5337:
+ case 5338:
+ case 5339:
+ case 5340:
+ case 5341:
+ case 5342:
+ case 5343:
+ case 5344:
+ case 5345:
+ case 5346:
+ case 5347:
+ case 5348:
+ case 5349:
+ case 5350:
+ case 5351:
+ case 5352:
+ case 5353:
+ case 5354:
+ case 5355:
+ case 5356:
+ case 5357:
+ case 5358:
+ case 5359:
+ case 5360:
+ case 5361:
+ case 5362:
+ case 5363:
+ case 5364:
+ case 5365:
+ case 5366:
+ case 5367:
+ case 5368:
+ case 5369:
+ case 5370:
+ case 5371:
+ case 5372:
+ case 5373:
+ case 5374:
+ case 5375:
+ case 5376:
+ case 5377:
+ case 5378:
+ case 5379:
+ case 5380:
+ case 5381:
+ case 5382:
+ case 5383:
+ case 5384:
+ case 5385:
+ case 5386:
+ case 5387:
+ case 5388:
+ case 5389:
+ case 5390:
+ case 5391:
+ case 5392:
+ case 5393:
+ case 5394:
+ case 5395:
+ case 5396:
+ case 5397:
+ case 5398:
+ case 5399:
+ case 5400:
+ case 5401:
+ case 5402:
+ case 5403:
+ case 5404:
+ case 5405:
+ case 5406:
+ case 5407:
+ case 5408:
+ case 5409:
+ case 5410:
+ case 5411:
+ case 5412:
+ case 5413:
+ case 5414:
+ case 5415:
+ case 5416:
+ case 5417:
+ case 5418:
+ case 5419:
+ case 5420:
+ case 5421:
+ case 5422:
+ case 5423:
+ case 5424:
+ case 5425:
+ case 5426:
+ case 5427:
+ case 5428:
+ case 5429:
+ case 5430:
+ case 5431:
+ case 5432:
+ case 5433:
+ case 5434:
+ case 5435:
+ case 5436:
+ case 5437:
+ case 5438:
+ case 5439:
+ case 5440:
+ case 5441:
+ case 5442:
+ case 5443:
+ case 5444:
+ case 5445:
+ case 5446:
+ case 5447:
+ case 5448:
+ case 5449:
+ case 5450:
+ case 5451:
+ case 5452:
+ case 5453:
+ case 5454:
+ case 5455:
+ case 5456:
+ case 5457:
+ case 5458:
+ case 5459:
+ case 5460:
+ case 5461:
+ case 5462:
+ case 5463:
+ case 5464:
+ case 5465:
+ case 5466:
+ case 5467:
+ case 5468:
+ case 5469:
+ case 5470:
+ case 5471:
+ case 5472:
+ case 5473:
+ case 5474:
+ case 5475:
+ case 5476:
+ case 5477:
+ case 5478:
+ case 5479:
+ case 5480:
+ case 5481:
+ case 5482:
+ case 5483:
+ case 5484:
+ case 5485:
+ case 5486:
+ case 5487:
+ case 5488:
+ case 5489:
+ case 5490:
+ case 5491:
+ case 5492:
+ case 5493:
+ case 5494:
+ case 5495:
+ case 5496:
+ case 5497:
+ case 5498:
+ case 5499:
+ case 5500:
+ case 5501:
+ case 5502:
+ case 5503:
+ case 5504:
+ case 5505:
+ case 5506:
+ case 5507:
+ case 5508:
+ case 5509:
+ case 5510:
+ case 5511:
+ case 5512:
+ case 5513:
+ case 5514:
+ case 5515:
+ case 5516:
+ case 5517:
+ case 5518:
+ case 5519:
+ case 5520:
+ case 5521:
+ case 5522:
+ case 5523:
+ case 5524:
+ case 5525:
+ case 5526:
+ case 5527:
+ case 5528:
+ case 5529:
+ case 5530:
+ case 5531:
+ case 5532:
+ case 5533:
+ case 5534:
+ case 5535:
+ case 5536:
+ case 5537:
+ case 5538:
+ case 5539:
+ case 5540:
+ case 5541:
+ case 5542:
+ case 5543:
+ case 5544:
+ case 5545:
+ case 5546:
+ case 5547:
+ case 5548:
+ case 5549:
+ case 5550:
+ case 5551:
+ case 5552:
+ case 5553:
+ case 5554:
+ case 5555:
+ case 5556:
+ case 5557:
+ case 5558:
+ case 5559:
+ case 5560:
+ case 5561:
+ case 5562:
+ case 5563:
+ case 5564:
+ case 5565:
+ case 5566:
+ case 5567:
+ case 5568:
+ case 5569:
+ case 5570:
+ case 5571:
+ case 5572:
+ case 5573:
+ case 5574:
+ case 5575:
+ case 5576:
+ case 5577:
+ case 5578:
+ case 5579:
+ case 5580:
+ case 5581:
+ case 5582:
+ case 5583:
+ case 5584:
+ case 5585:
+ case 5586:
+ case 5587:
+ case 5588:
+ case 5589:
+ case 5590:
+ case 5591:
+ case 5592:
+ case 5593:
+ case 5594:
+ case 5595:
+ case 5596:
+ case 5597:
+ case 5598:
+ case 5599:
+ case 5600:
+ case 5601:
+ case 5602:
+ case 5603:
+ case 5604:
+ case 5605:
+ case 5606:
+ case 5607:
+ case 5608:
+ case 5609:
+ case 5610:
+ case 5611:
+ case 5612:
+ case 5613:
+ case 5614:
+ case 5615:
+ case 5616:
+ case 5617:
+ case 5618:
+ case 5619:
+ case 5620:
+ case 5621:
+ case 5622:
+ case 5623:
+ case 5624:
+ case 5625:
+ case 5626:
+ case 5627:
+ case 5628:
+ case 5629:
+ case 5630:
+ case 5631:
+ case 5632:
+ case 5633:
+ case 5634:
+ case 5635:
+ case 5636:
+ case 5637:
+ case 5638:
+ case 5639:
+ case 5640:
+ case 5641:
+ case 5642:
+ case 5643:
+ case 5644:
+ case 5645:
+ case 5646:
+ case 5647:
+ case 5648:
+ case 5649:
+ case 5650:
+ case 5651:
+ case 5652:
+ case 5653:
+ case 5654:
+ case 5655:
+ case 5656:
+ case 5657:
+ case 5658:
+ case 5659:
+ case 5660:
+ case 5661:
+ case 5662:
+ case 5663:
+ case 5664:
+ case 5665:
+ case 5666:
+ case 5667:
+ case 5668:
+ case 5669:
+ case 5670:
+ case 5671:
+ case 5672:
+ case 5673:
+ case 5674:
+ case 5675:
+ case 5676:
+ case 5677:
+ case 5678:
+ case 5679:
+ case 5680:
+ case 5681:
+ case 5682:
+ case 5683:
+ case 5684:
+ case 5685:
+ case 5686:
+ case 5687:
+ case 5688:
+ case 5689:
+ case 5690:
+ case 5691:
+ case 5692:
+ case 5693:
+ case 5694:
+ case 5695:
+ case 5696:
+ case 5697:
+ case 5698:
+ case 5699:
+ case 5700:
+ case 5701:
+ case 5702:
+ case 5703:
+ case 5704:
+ case 5705:
+ case 5706:
+ case 5707:
+ case 5708:
+ case 5709:
+ case 5710:
+ case 5711:
+ case 5712:
+ case 5713:
+ case 5714:
+ case 5715:
+ case 5716:
+ case 5717:
+ case 5718:
+ case 5719:
+ case 5720:
+ case 5721:
+ case 5722:
+ case 5723:
+ case 5724:
+ case 5725:
+ case 5726:
+ case 5727:
+ case 5728:
+ case 5729:
+ case 5730:
+ case 5731:
+ case 5732:
+ case 5733:
+ case 5734:
+ case 5735:
+ case 5736:
+ case 5737:
+ case 5738:
+ case 5739:
+ case 5740:
+ case 5741:
+ case 5742:
+ case 5743:
+ case 5744:
+ case 5745:
+ case 5746:
+ case 5747:
+ case 5748:
+ case 5749:
+ case 5750:
+ case 5751:
+ case 5752:
+ case 5753:
+ case 5754:
+ case 5755:
+ case 5756:
+ case 5757:
+ case 5758:
+ case 5759:
+ case 5760:
+ case 5761:
+ case 5762:
+ case 5763:
+ case 5764:
+ case 5765:
+ case 5766:
+ case 5767:
+ case 5768:
+ case 5769:
+ case 5770:
+ case 5771:
+ case 5772:
+ case 5773:
+ case 5774:
+ case 5775:
+ case 5776:
+ case 5777:
+ case 5778:
+ case 5779:
+ case 5780:
+ case 5781:
+ case 5782:
+ case 5783:
+ case 5784:
+ case 5785:
+ case 5786:
+ case 5787:
+ case 5788:
+ case 5789:
+ case 5790:
+ case 5791:
+ case 5792:
+ case 5793:
+ case 5794:
+ case 5795:
+ case 5796:
+ case 5797:
+ case 5798:
+ case 5799:
+ case 5800:
+ case 5801:
+ case 5802:
+ case 5803:
+ case 5804:
+ case 5805:
+ case 5806:
+ case 5807:
+ case 5808:
+ case 5809:
+ case 5810:
+ case 5811:
+ case 5812:
+ case 5813:
+ case 5814:
+ case 5815:
+ case 5816:
+ case 5817:
+ case 5818:
+ case 5819:
+ case 5820:
+ case 5821:
+ case 5822:
+ case 5823:
+ case 5824:
+ case 5825:
+ case 5826:
+ case 5827:
+ case 5828:
+ case 5829:
+ case 5830:
+ case 5831:
+ case 5832:
+ case 5833:
+ case 5834:
+ case 5835:
+ case 5836:
+ case 5837:
+ case 5838:
+ case 5839:
+ case 5840:
+ case 5841:
+ case 5842:
+ case 5843:
+ case 5844:
+ case 5845:
+ case 5846:
+ case 5847:
+ case 5848:
+ case 5849:
+ case 5850:
+ case 5851:
+ case 5852:
+ case 5853:
+ case 5854:
+ case 5855:
+ case 5856:
+ case 5857:
+ case 5858:
+ case 5859:
+ case 5860:
+ case 5861:
+ case 5862:
+ case 5863:
+ case 5864:
+ case 5865:
+ case 5866:
+ case 5867:
+ case 5868:
+ case 5869:
+ case 5870:
+ case 5871:
+ case 5872:
+ case 5873:
+ case 5874:
+ case 5875:
+ case 5876:
+ case 5877:
+ case 5878:
+ case 5879:
+ case 5880:
+ case 5881:
+ case 5882:
+ case 5883:
+ case 5884:
+ case 5885:
+ case 5886:
+ case 5887:
+ case 5888:
+ case 5889:
+ case 5890:
+ case 5891:
+ case 5892:
+ case 5893:
+ case 5894:
+ case 5895:
+ case 5896:
+ case 5897:
+ case 5898:
+ case 5899:
+ case 5900:
+ case 5901:
+ case 5902:
+ case 5903:
+ case 5904:
+ case 5905:
+ case 5906:
+ case 5907:
+ case 5908:
+ case 5909:
+ case 5910:
+ case 5911:
+ case 5912:
+ case 5913:
+ case 5914:
+ case 5915:
+ case 5916:
+ case 5917:
+ case 5918:
+ case 5919:
+ case 5920:
+ case 5921:
+ case 5922:
+ case 5923:
+ case 5924:
+ case 5925:
+ case 5926:
+ case 5927:
+ case 5928:
+ case 5929:
+ case 5930:
+ case 5931:
+ case 5932:
+ case 5933:
+ case 5934:
+ case 5935:
+ case 5936:
+ case 5937:
+ case 5938:
+ case 5939:
+ case 5940:
+ case 5941:
+ case 5942:
+ case 5943:
+ case 5944:
+ case 5945:
+ case 5946:
+ case 5947:
+ case 5948:
+ case 5949:
+ case 5950:
+ case 5951:
+ case 5952:
+ case 5953:
+ case 5954:
+ case 5955:
+ case 5956:
+ case 5957:
+ case 5958:
+ case 5959:
+ case 5960:
+ case 5961:
+ case 5962:
+ case 5963:
+ case 5964:
+ case 5965:
+ case 5966:
+ case 5967:
+ case 5968:
+ case 5969:
+ case 5970:
+ case 5971:
+ case 5972:
+ case 5973:
+ case 5974:
+ case 5975:
+ case 5976:
+ case 5977:
+ case 5978:
+ case 5979:
+ case 5980:
+ case 5981:
+ case 5982:
+ case 5983:
+ case 5984:
+ case 5985:
+ case 5986:
+ case 5987:
+ case 5988:
+ case 5989:
+ case 5990:
+ case 5991:
+ case 5992:
+ case 5993:
+ case 5994:
+ case 5995:
+ case 5996:
+ case 5997:
+ case 5998:
+ case 5999:
+ case 6000:
+ case 6001:
+ case 6002:
+ case 6003:
+ case 6004:
+ case 6005:
+ case 6006:
+ case 6007:
+ case 6008:
+ case 6009:
+ case 6010:
+ case 6011:
+ case 6012:
+ case 6013:
+ case 6014:
+ case 6015:
+ case 6016:
+ case 6017:
+ case 6018:
+ case 6019:
+ case 6020:
+ case 6021:
+ case 6022:
+ case 6023:
+ case 6024:
+ case 6025:
+ case 6026:
+ case 6027:
+ case 6028:
+ case 6029:
+ case 6030:
+ case 6031:
+ case 6032:
+ case 6033:
+ case 6034:
+ case 6035:
+ case 6036:
+ case 6037:
+ case 6038:
+ case 6039:
+ case 6040:
+ case 6041:
+ case 6042:
+ case 6043:
+ case 6044:
+ case 6045:
+ case 6046:
+ case 6047:
+ case 6048:
+ case 6049:
+ case 6050:
+ case 6051:
+ case 6052:
+ case 6053:
+ case 6054:
+ case 6055:
+ case 6056:
+ case 6057:
+ case 6058:
+ case 6059:
+ case 6060:
+ case 6061:
+ case 6062:
+ case 6063:
+ case 6064:
+ case 6065:
+ case 6066:
+ case 6067:
+ case 6068:
+ case 6069:
+ case 6070:
+ case 6071:
+ case 6072:
+ case 6073:
+ case 6074:
+ case 6075:
+ case 6076:
+ case 6077:
+ case 6078:
+ case 6079:
+ case 6080:
+ case 6081:
+ case 6082:
+ case 6083:
+ case 6084:
+ case 6085:
+ case 6086:
+ case 6087:
+ case 6088:
+ case 6089:
+ case 6090:
+ case 6091:
+ case 6092:
+ case 6093:
+ case 6094:
+ case 6095:
+ case 6096:
+ case 6097:
+ case 6098:
+ case 6099:
+ case 6100:
+ case 6101:
+ case 6102:
+ case 6103:
+ case 6104:
+ case 6105:
+ case 6106:
+ case 6107:
+ case 6108:
+ case 6109:
+ case 6110:
+ case 6111:
+ case 6112:
+ case 6113:
+ case 6114:
+ case 6115:
+ case 6116:
+ case 6117:
+ case 6118:
+ case 6119:
+ case 6120:
+ case 6121:
+ case 6122:
+ case 6123:
+ case 6124:
+ case 6125:
+ case 6126:
+ case 6127:
+ case 6128:
+ case 6129:
+ case 6130:
+ case 6131:
+ case 6132:
+ case 6133:
+ case 6134:
+ case 6135:
+ case 6136:
+ case 6137:
+ case 6138:
+ case 6139:
+ case 6140:
+ case 6141:
+ case 6142:
+ case 6143:
+ case 6144:
+ case 6145:
+ case 6146:
+ case 6147:
+ case 6148:
+ case 6149:
+ case 6150:
+ case 6151:
+ case 6152:
+ case 6153:
+ case 6154:
+ case 6155:
+ case 6156:
+ case 6157:
+ case 6158:
+ case 6159:
+ case 6160:
+ case 6161:
+ case 6162:
+ case 6163:
+ case 6164:
+ case 6165:
+ case 6166:
+ case 6167:
+ case 6168:
+ case 6169:
+ case 6170:
+ case 6171:
+ case 6172:
+ case 6173:
+ case 6174:
+ case 6175:
+ case 6176:
+ case 6177:
+ case 6178:
+ case 6179:
+ case 6180:
+ case 6181:
+ case 6182:
+ case 6183:
+ case 6184:
+ case 6185:
+ case 6186:
+ case 6187:
+ case 6188:
+ case 6189:
+ case 6190:
+ case 6191:
+ case 6192:
+ case 6193:
+ case 6194:
+ case 6195:
+ case 6196:
+ case 6197:
+ case 6198:
+ case 6199:
+ case 6200:
+ case 6201:
+ case 6202:
+ case 6203:
+ case 6204:
+ case 6205:
+ case 6206:
+ case 6207:
+ case 6208:
+ case 6209:
+ case 6210:
+ case 6211:
+ case 6212:
+ case 6213:
+ case 6214:
+ case 6215:
+ case 6216:
+ case 6217:
+ case 6218:
+ case 6219:
+ case 6220:
+ case 6221:
+ case 6222:
+ case 6223:
+ case 6224:
+ case 6225:
+ case 6226:
+ case 6227:
+ case 6228:
+ case 6229:
+ case 6230:
+ case 6231:
+ case 6232:
+ case 6233:
+ case 6234:
+ case 6235:
+ case 6236:
+ case 6237:
+ case 6238:
+ case 6239:
+ case 6240:
+ case 6241:
+ case 6242:
+ case 6243:
+ case 6244:
+ case 6245:
+ case 6246:
+ case 6247:
+ case 6248:
+ case 6249:
+ case 6250:
+ case 6251:
+ case 6252:
+ case 6253:
+ case 6254:
+ case 6255:
+ case 6256:
+ case 6257:
+ case 6258:
+ case 6259:
+ case 6260:
+ case 6261:
+ case 6262:
+ case 6263:
+ case 6264:
+ case 6265:
+ case 6266:
+ case 6267:
+ case 6268:
+ case 6269:
+ case 6270:
+ case 6271:
+ case 6272:
+ case 6273:
+ case 6274:
+ case 6275:
+ case 6276:
+ case 6277:
+ case 6278:
+ case 6279:
+ case 6280:
+ case 6281:
+ case 6282:
+ case 6283:
+ case 6284:
+ case 6285:
+ case 6286:
+ case 6287:
+ case 6288:
+ case 6289:
+ case 6290:
+ case 6291:
+ case 6292:
+ case 6293:
+ case 6294:
+ case 6295:
+ case 6296:
+ case 6297:
+ case 6298:
+ case 6299:
+ case 6300:
+ case 6301:
+ case 6302:
+ case 6303:
+ case 6304:
+ case 6305:
+ case 6306:
+ case 6307:
+ case 6308:
+ case 6309:
+ case 6310:
+ case 6311:
+ case 6312:
+ case 6313:
+ case 6314:
+ case 6315:
+ case 6316:
+ case 6317:
+ case 6318:
+ case 6319:
+ case 6320:
+ case 6321:
+ case 6322:
+ case 6323:
+ case 6324:
+ case 6325:
+ case 6326:
+ case 6327:
+ case 6328:
+ case 6329:
+ case 6330:
+ case 6331:
+ case 6332:
+ case 6333:
+ case 6334:
+ case 6335:
+ case 6336:
+ case 6337:
+ case 6338:
+ case 6339:
+ case 6340:
+ case 6341:
+ case 6342:
+ case 6343:
+ case 6344:
+ case 6345:
+ case 6346:
+ case 6347:
+ case 6348:
+ case 6349:
+ case 6350:
+ case 6351:
+ case 6352:
+ case 6353:
+ case 6354:
+ case 6355:
+ case 6356:
+ case 6357:
+ case 6358:
+ case 6359:
+ case 6360:
+ case 6361:
+ case 6362:
+ case 6363:
+ case 6364:
+ case 6365:
+ case 6366:
+ case 6367:
+ case 6368:
+ case 6369:
+ case 6370:
+ case 6371:
+ case 6372:
+ case 6373:
+ case 6374:
+ case 6375:
+ case 6376:
+ case 6377:
+ case 6378:
+ case 6379:
+ case 6380:
+ case 6381:
+ case 6382:
+ case 6383:
+ case 6384:
+ case 6385:
+ case 6386:
+ case 6387:
+ case 6388:
+ case 6389:
+ case 6390:
+ case 6391:
+ case 6392:
+ case 6393:
+ case 6394:
+ case 6395:
+ case 6396:
+ case 6397:
+ case 6398:
+ case 6399:
+ case 6400:
+ case 6401:
+ case 6402:
+ case 6403:
+ case 6404:
+ case 6405:
+ case 6406:
+ case 6407:
+ case 6408:
+ case 6409:
+ case 6410:
+ case 6411:
+ case 6412:
+ case 6413:
+ case 6414:
+ case 6415:
+ case 6416:
+ case 6417:
+ case 6418:
+ case 6419:
+ case 6420:
+ case 6421:
+ case 6422:
+ case 6423:
+ case 6424:
+ case 6425:
+ case 6426:
+ case 6427:
+ case 6428:
+ case 6429:
+ case 6430:
+ case 6431:
+ case 6432:
+ case 6433:
+ case 6434:
+ case 6435:
+ case 6436:
+ case 6437:
+ case 6438:
+ case 6439:
+ case 6440:
+ case 6441:
+ case 6442:
+ case 6443:
+ case 6444:
+ case 6445:
+ case 6446:
+ case 6447:
+ case 6448:
+ case 6449:
+ case 6450:
+ case 6451:
+ case 6452:
+ case 6453:
+ case 6454:
+ case 6455:
+ case 6456:
+ case 6457:
+ case 6458:
+ case 6459:
+ case 6460:
+ case 6461:
+ case 6462:
+ case 6463:
+ case 6464:
+ case 6465:
+ case 6466:
+ case 6467:
+ case 6468:
+ case 6469:
+ case 6470:
+ case 6471:
+ case 6472:
+ case 6473:
+ case 6474:
+ case 6475:
+ case 6476:
+ case 6477:
+ case 6478:
+ case 6479:
+ case 6480:
+ case 6481:
+ case 6482:
+ case 6483:
+ case 6484:
+ case 6485:
+ case 6486:
+ case 6487:
+ case 6488:
+ case 6489:
+ case 6490:
+ case 6491:
+ case 6492:
+ case 6493:
+ case 6494:
+ case 6495:
+ case 6496:
+ case 6497:
+ case 6498:
+ case 6499:
+ case 6500:
+ case 6501:
+ case 6502:
+ case 6503:
+ case 6504:
+ case 6505:
+ case 6506:
+ case 6507:
+ case 6508:
+ case 6509:
+ case 6510:
+ case 6511:
+ case 6512:
+ case 6513:
+ case 6514:
+ case 6515:
+ case 6516:
+ case 6517:
+ case 6518:
+ case 6519:
+ case 6520:
+ case 6521:
+ case 6522:
+ case 6523:
+ case 6524:
+ case 6525:
+ case 6526:
+ case 6527:
+ case 6528:
+ case 6529:
+ case 6530:
+ case 6531:
+ case 6532:
+ case 6533:
+ case 6534:
+ case 6535:
+ case 6536:
+ case 6537:
+ case 6538:
+ case 6539:
+ case 6540:
+ case 6541:
+ case 6542:
+ case 6543:
+ case 6544:
+ case 6545:
+ case 6546:
+ case 6547:
+ case 6548:
+ case 6549:
+ case 6550:
+ case 6551:
+ case 6552:
+ case 6553:
+ case 6554:
+ case 6555:
+ case 6556:
+ case 6557:
+ case 6558:
+ case 6559:
+ case 6560:
+ case 6561:
+ case 6562:
+ case 6563:
+ case 6564:
+ case 6565:
+ case 6566:
+ case 6567:
+ case 6568:
+ case 6569:
+ case 6570:
+ case 6571:
+ case 6572:
+ case 6573:
+ case 6574:
+ case 6575:
+ case 6576:
+ case 6577:
+ case 6578:
+ case 6579:
+ case 6580:
+ case 6581:
+ case 6582:
+ case 6583:
+ case 6584:
+ case 6585:
+ case 6586:
+ case 6587:
+ case 6588:
+ case 6589:
+ case 6590:
+ case 6591:
+ case 6592:
+ case 6593:
+ case 6594:
+ case 6595:
+ case 6596:
+ case 6597:
+ case 6598:
+ case 6599:
+ case 6600:
+ case 6601:
+ case 6602:
+ case 6603:
+ case 6604:
+ case 6605:
+ case 6606:
+ case 6607:
+ case 6608:
+ case 6609:
+ case 6610:
+ case 6611:
+ case 6612:
+ case 6613:
+ case 6614:
+ case 6615:
+ case 6616:
+ case 6617:
+ case 6618:
+ case 6619:
+ case 6620:
+ case 6621:
+ case 6622:
+ case 6623:
+ case 6624:
+ case 6625:
+ case 6626:
+ case 6627:
+ case 6628:
+ case 6629:
+ case 6630:
+ case 6631:
+ case 6632:
+ case 6633:
+ case 6634:
+ case 6635:
+ case 6636:
+ case 6637:
+ case 6638:
+ case 6639:
+ case 6640:
+ case 6641:
+ case 6642:
+ case 6643:
+ case 6644:
+ case 6645:
+ case 6646:
+ case 6647:
+ case 6648:
+ case 6649:
+ case 6650:
+ case 6651:
+ case 6652:
+ case 6653:
+ case 6654:
+ case 6655:
+ case 6656:
+ case 6657:
+ case 6658:
+ case 6659:
+ case 6660:
+ case 6661:
+ case 6662:
+ case 6663:
+ case 6664:
+ case 6665:
+ case 6666:
+ case 6667:
+ case 6668:
+ case 6669:
+ case 6670:
+ case 6671:
+ case 6672:
+ case 6673:
+ case 6674:
+ case 6675:
+ case 6676:
+ case 6677:
+ case 6678:
+ case 6679:
+ case 6680:
+ case 6681:
+ case 6682:
+ case 6683:
+ case 6684:
+ case 6685:
+ case 6686:
+ case 6687:
+ case 6688:
+ case 6689:
+ case 6690:
+ case 6691:
+ case 6692:
+ case 6693:
+ case 6694:
+ case 6695:
+ case 6696:
+ case 6697:
+ case 6698:
+ case 6699:
+ case 6700:
+ case 6701:
+ case 6702:
+ case 6703:
+ case 6704:
+ case 6705:
+ case 6706:
+ case 6707:
+ case 6708:
+ case 6709:
+ case 6710:
+ case 6711:
+ case 6712:
+ case 6713:
+ case 6714:
+ case 6715:
+ case 6716:
+ case 6717:
+ case 6718:
+ case 6719:
+ case 6720:
+ case 6721:
+ case 6722:
+ case 6723:
+ case 6724:
+ case 6725:
+ case 6726:
+ case 6727:
+ case 6728:
+ case 6729:
+ case 6730:
+ case 6731:
+ case 6732:
+ case 6733:
+ case 6734:
+ case 6735:
+ case 6736:
+ case 6737:
+ case 6738:
+ case 6739:
+ case 6740:
+ case 6741:
+ case 6742:
+ case 6743:
+ case 6744:
+ case 6745:
+ case 6746:
+ case 6747:
+ case 6748:
+ case 6749:
+ case 6750:
+ case 6751:
+ case 6752:
+ case 6753:
+ case 6754:
+ case 6755:
+ case 6756:
+ case 6757:
+ case 6758:
+ case 6759:
+ case 6760:
+ case 6761:
+ case 6762:
+ case 6763:
+ case 6764:
+ case 6765:
+ case 6766:
+ case 6767:
+ case 6768:
+ case 6769:
+ case 6770:
+ case 6771:
+ case 6772:
+ case 6773:
+ case 6774:
+ case 6775:
+ case 6776:
+ case 6777:
+ case 6778:
+ case 6779:
+ case 6780:
+ case 6781:
+ case 6782:
+ case 6783:
+ case 6784:
+ case 6785:
+ case 6786:
+ case 6787:
+ case 6788:
+ case 6789:
+ case 6790:
+ case 6791:
+ case 6792:
+ case 6793:
+ case 6794:
+ case 6795:
+ case 6796:
+ case 6797:
+ case 6798:
+ case 6799:
+ case 6800:
+ case 6801:
+ case 6802:
+ case 6803:
+ case 6804:
+ case 6805:
+ case 6806:
+ case 6807:
+ case 6808:
+ case 6809:
+ case 6810:
+ case 6811:
+ case 6812:
+ case 6813:
+ case 6814:
+ case 6815:
+ case 6816:
+ case 6817:
+ case 6818:
+ case 6819:
+ case 6820:
+ case 6821:
+ case 6822:
+ case 6823:
+ case 6824:
+ case 6825:
+ case 6826:
+ case 6827:
+ case 6828:
+ case 6829:
+ case 6830:
+ case 6831:
+ case 6832:
+ case 6833:
+ case 6834:
+ case 6835:
+ case 6836:
+ case 6837:
+ case 6838:
+ case 6839:
+ case 6840:
+ case 6841:
+ case 6842:
+ case 6843:
+ case 6844:
+ case 6845:
+ case 6846:
+ case 6847:
+ case 6848:
+ case 6849:
+ case 6850:
+ case 6851:
+ case 6852:
+ case 6853:
+ case 6854:
+ case 6855:
+ case 6856:
+ case 6857:
+ case 6858:
+ case 6859:
+ case 6860:
+ case 6861:
+ case 6862:
+ case 6863:
+ case 6864:
+ case 6865:
+ case 6866:
+ case 6867:
+ case 6868:
+ case 6869:
+ case 6870:
+ case 6871:
+ case 6872:
+ case 6873:
+ case 6874:
+ case 6875:
+ case 6876:
+ case 6877:
+ case 6878:
+ case 6879:
+ case 6880:
+ case 6881:
+ case 6882:
+ case 6883:
+ case 6884:
+ case 6885:
+ case 6886:
+ case 6887:
+ case 6888:
+ case 6889:
+ case 6890:
+ case 6891:
+ case 6892:
+ case 6893:
+ case 6894:
+ case 6895:
+ case 6896:
+ case 6897:
+ case 6898:
+ case 6899:
+ case 6900:
+ case 6901:
+ case 6902:
+ case 6903:
+ case 6904:
+ case 6905:
+ case 6906:
+ case 6907:
+ case 6908:
+ case 6909:
+ case 6910:
+ case 6911:
+ case 6912:
+ case 6913:
+ case 6914:
+ case 6915:
+ case 6916:
+ case 6917:
+ case 6918:
+ case 6919:
+ case 6920:
+ case 6921:
+ case 6922:
+ case 6923:
+ case 6924:
+ case 6925:
+ case 6926:
+ case 6927:
+ case 6928:
+ case 6929:
+ case 6930:
+ case 6931:
+ case 6932:
+ case 6933:
+ case 6934:
+ case 6935:
+ case 6936:
+ case 6937:
+ case 6938:
+ case 6939:
+ case 6940:
+ case 6941:
+ case 6942:
+ case 6943:
+ case 6944:
+ case 6945:
+ case 6946:
+ case 6947:
+ case 6948:
+ case 6949:
+ case 6950:
+ case 6951:
+ case 6952:
+ case 6953:
+ case 6954:
+ case 6955:
+ case 6956:
+ case 6957:
+ case 6958:
+ case 6959:
+ case 6960:
+ case 6961:
+ case 6962:
+ case 6963:
+ case 6964:
+ case 6965:
+ case 6966:
+ case 6967:
+ case 6968:
+ case 6969:
+ case 6970:
+ case 6971:
+ case 6972:
+ case 6973:
+ case 6974:
+ case 6975:
+ case 6976:
+ case 6977:
+ case 6978:
+ case 6979:
+ case 6980:
+ case 6981:
+ case 6982:
+ case 6983:
+ case 6984:
+ case 6985:
+ case 6986:
+ case 6987:
+ case 6988:
+ case 6989:
+ case 6990:
+ case 6991:
+ case 6992:
+ case 6993:
+ case 6994:
+ case 6995:
+ case 6996:
+ case 6997:
+ case 6998:
+ case 6999:
+ case 7000:
+ case 7001:
+ case 7002:
+ case 7003:
+ case 7004:
+ case 7005:
+ case 7006:
+ case 7007:
+ case 7008:
+ case 7009:
+ case 7010:
+ case 7011:
+ case 7012:
+ case 7013:
+ case 7014:
+ case 7015:
+ case 7016:
+ case 7017:
+ case 7018:
+ case 7019:
+ case 7020:
+ case 7021:
+ case 7022:
+ case 7023:
+ case 7024:
+ case 7025:
+ case 7026:
+ case 7027:
+ case 7028:
+ case 7029:
+ case 7030:
+ case 7031:
+ case 7032:
+ case 7033:
+ case 7034:
+ case 7035:
+ case 7036:
+ case 7037:
+ case 7038:
+ case 7039:
+ case 7040:
+ case 7041:
+ case 7042:
+ case 7043:
+ case 7044:
+ case 7045:
+ case 7046:
+ case 7047:
+ case 7048:
+ case 7049:
+ case 7050:
+ case 7051:
+ case 7052:
+ case 7053:
+ case 7054:
+ case 7055:
+ case 7056:
+ case 7057:
+ case 7058:
+ case 7059:
+ case 7060:
+ case 7061:
+ case 7062:
+ case 7063:
+ case 7064:
+ case 7065:
+ case 7066:
+ case 7067:
+ case 7068:
+ case 7069:
+ case 7070:
+ case 7071:
+ case 7072:
+ case 7073:
+ case 7074:
+ case 7075:
+ case 7076:
+ case 7077:
+ case 7078:
+ case 7079:
+ case 7080:
+ case 7081:
+ case 7082:
+ case 7083:
+ case 7084:
+ case 7085:
+ case 7086:
+ case 7087:
+ case 7088:
+ case 7089:
+ case 7090:
+ case 7091:
+ case 7092:
+ case 7093:
+ case 7094:
+ case 7095:
+ case 7096:
+ case 7097:
+ case 7098:
+ case 7099:
+ case 7100:
+ case 7101:
+ case 7102:
+ case 7103:
+ case 7104:
+ case 7105:
+ case 7106:
+ case 7107:
+ case 7108:
+ case 7109:
+ case 7110:
+ case 7111:
+ case 7112:
+ case 7113:
+ case 7114:
+ case 7115:
+ case 7116:
+ case 7117:
+ case 7118:
+ case 7119:
+ case 7120:
+ case 7121:
+ case 7122:
+ case 7123:
+ case 7124:
+ case 7125:
+ case 7126:
+ case 7127:
+ case 7128:
+ case 7129:
+ case 7130:
+ case 7131:
+ case 7132:
+ case 7133:
+ case 7134:
+ case 7135:
+ case 7136:
+ case 7137:
+ case 7138:
+ case 7139:
+ case 7140:
+ case 7141:
+ case 7142:
+ case 7143:
+ case 7144:
+ case 7145:
+ case 7146:
+ case 7147:
+ case 7148:
+ case 7149:
+ case 7150:
+ case 7151:
+ case 7152:
+ case 7153:
+ case 7154:
+ case 7155:
+ case 7156:
+ case 7157:
+ case 7158:
+ case 7159:
+ case 7160:
+ case 7161:
+ case 7162:
+ case 7163:
+ case 7164:
+ case 7165:
+ case 7166:
+ case 7167:
+ case 7168:
+ case 7169:
+ case 7170:
+ case 7171:
+ case 7172:
+ case 7173:
+ case 7174:
+ case 7175:
+ case 7176:
+ case 7177:
+ case 7178:
+ case 7179:
+ case 7180:
+ case 7181:
+ case 7182:
+ case 7183:
+ case 7184:
+ case 7185:
+ case 7186:
+ case 7187:
+ case 7188:
+ case 7189:
+ case 7190:
+ case 7191:
+ case 7192:
+ case 7193:
+ case 7194:
+ case 7195:
+ case 7196:
+ case 7197:
+ case 7198:
+ case 7199:
+ case 7200:
+ case 7201:
+ case 7202:
+ case 7203:
+ case 7204:
+ case 7205:
+ case 7206:
+ case 7207:
+ case 7208:
+ case 7209:
+ case 7210:
+ case 7211:
+ case 7212:
+ case 7213:
+ case 7214:
+ case 7215:
+ case 7216:
+ case 7217:
+ case 7218:
+ case 7219:
+ case 7220:
+ case 7221:
+ case 7222:
+ case 7223:
+ case 7224:
+ case 7225:
+ case 7226:
+ case 7227:
+ case 7228:
+ case 7229:
+ case 7230:
+ case 7231:
+ case 7232:
+ case 7233:
+ case 7234:
+ case 7235:
+ case 7236:
+ case 7237:
+ case 7238:
+ case 7239:
+ case 7240:
+ case 7241:
+ case 7242:
+ case 7243:
+ case 7244:
+ case 7245:
+ case 7246:
+ case 7247:
+ case 7248:
+ case 7249:
+ case 7250:
+ case 7251:
+ case 7252:
+ case 7253:
+ case 7254:
+ case 7255:
+ case 7256:
+ case 7257:
+ case 7258:
+ case 7259:
+ case 7260:
+ case 7261:
+ case 7262:
+ case 7263:
+ case 7264:
+ case 7265:
+ case 7266:
+ case 7267:
+ case 7268:
+ case 7269:
+ case 7270:
+ case 7271:
+ case 7272:
+ case 7273:
+ case 7274:
+ case 7275:
+ case 7276:
+ case 7277:
+ case 7278:
+ case 7279:
+ case 7280:
+ case 7281:
+ case 7282:
+ case 7283:
+ case 7284:
+ case 7285:
+ case 7286:
+ case 7287:
+ case 7288:
+ case 7289:
+ case 7290:
+ case 7291:
+ case 7292:
+ case 7293:
+ case 7294:
+ case 7295:
+ case 7296:
+ case 7297:
+ case 7298:
+ case 7299:
+ case 7300:
+ case 7301:
+ case 7302:
+ case 7303:
+ case 7304:
+ case 7305:
+ case 7306:
+ case 7307:
+ case 7308:
+ case 7309:
+ case 7310:
+ case 7311:
+ case 7312:
+ case 7313:
+ case 7314:
+ case 7315:
+ case 7316:
+ case 7317:
+ case 7318:
+ case 7319:
+ case 7320:
+ case 7321:
+ case 7322:
+ case 7323:
+ case 7324:
+ case 7325:
+ case 7326:
+ case 7327:
+ case 7328:
+ case 7329:
+ case 7330:
+ case 7331:
+ case 7332:
+ case 7333:
+ case 7334:
+ case 7335:
+ case 7336:
+ case 7337:
+ case 7338:
+ case 7339:
+ case 7340:
+ case 7341:
+ case 7342:
+ case 7343:
+ case 7344:
+ case 7345:
+ case 7346:
+ case 7347:
+ case 7348:
+ case 7349:
+ case 7350:
+ case 7351:
+ case 7352:
+ case 7353:
+ case 7354:
+ case 7355:
+ case 7356:
+ case 7357:
+ case 7358:
+ case 7359:
+ case 7360:
+ case 7361:
+ case 7362:
+ case 7363:
+ case 7364:
+ case 7365:
+ case 7366:
+ case 7367:
+ case 7368:
+ case 7369:
+ case 7370:
+ case 7371:
+ case 7372:
+ case 7373:
+ case 7374:
+ case 7375:
+ case 7376:
+ case 7377:
+ case 7378:
+ case 7379:
+ case 7380:
+ case 7381:
+ case 7382:
+ case 7383:
+ case 7384:
+ case 7385:
+ case 7386:
+ case 7387:
+ case 7388:
+ case 7389:
+ case 7390:
+ case 7391:
+ case 7392:
+ case 7393:
+ case 7394:
+ case 7395:
+ case 7396:
+ case 7397:
+ case 7398:
+ case 7399:
+ case 7400:
+ case 7401:
+ case 7402:
+ case 7403:
+ case 7404:
+ case 7405:
+ case 7406:
+ case 7407:
+ case 7408:
+ case 7409:
+ case 7410:
+ case 7411:
+ case 7412:
+ case 7413:
+ case 7414:
+ case 7415:
+ case 7416:
+ case 7417:
+ case 7418:
+ case 7419:
+ case 7420:
+ case 7421:
+ case 7422:
+ case 7423:
+ case 7424:
+ case 7425:
+ case 7426:
+ case 7427:
+ case 7428:
+ case 7429:
+ case 7430:
+ case 7431:
+ case 7432:
+ case 7433:
+ case 7434:
+ case 7435:
+ case 7436:
+ case 7437:
+ case 7438:
+ case 7439:
+ case 7440:
+ case 7441:
+ case 7442:
+ case 7443:
+ case 7444:
+ case 7445:
+ case 7446:
+ case 7447:
+ case 7448:
+ case 7449:
+ case 7450:
+ case 7451:
+ case 7452:
+ case 7453:
+ case 7454:
+ case 7455:
+ case 7456:
+ case 7457:
+ case 7458:
+ case 7459:
+ case 7460:
+ case 7461:
+ case 7462:
+ case 7463:
+ case 7464:
+ case 7465:
+ case 7466:
+ case 7467:
+ case 7468:
+ case 7469:
+ case 7470:
+ case 7471:
+ case 7472:
+ case 7473:
+ case 7474:
+ case 7475:
+ case 7476:
+ case 7477:
+ case 7478:
+ case 7479:
+ case 7480:
+ case 7481:
+ case 7482:
+ case 7483:
+ case 7484:
+ case 7485:
+ case 7486:
+ case 7487:
+ case 7488:
+ case 7489:
+ case 7490:
+ case 7491:
+ case 7492:
+ case 7493:
+ case 7494:
+ case 7495:
+ case 7496:
+ case 7497:
+ case 7498:
+ case 7499:
+ case 7500:
+ case 7501:
+ case 7502:
+ case 7503:
+ case 7504:
+ case 7505:
+ case 7506:
+ case 7507:
+ case 7508:
+ case 7509:
+ case 7510:
+ case 7511:
+ case 7512:
+ case 7513:
+ case 7514:
+ case 7515:
+ case 7516:
+ case 7517:
+ case 7518:
+ case 7519:
+ case 7520:
+ case 7521:
+ case 7522:
+ case 7523:
+ case 7524:
+ case 7525:
+ case 7526:
+ case 7527:
+ case 7528:
+ case 7529:
+ case 7530:
+ case 7531:
+ case 7532:
+ case 7533:
+ case 7534:
+ case 7535:
+ case 7536:
+ case 7537:
+ case 7538:
+ case 7539:
+ case 7540:
+ case 7541:
+ case 7542:
+ case 7543:
+ case 7544:
+ case 7545:
+ case 7546:
+ case 7547:
+ case 7548:
+ case 7549:
+ case 7550:
+ case 7551:
+ case 7552:
+ case 7553:
+ case 7554:
+ case 7555:
+ case 7556:
+ case 7557:
+ case 7558:
+ case 7559:
+ case 7560:
+ case 7561:
+ case 7562:
+ case 7563:
+ case 7564:
+ case 7565:
+ case 7566:
+ case 7567:
+ case 7568:
+ case 7569:
+ case 7570:
+ case 7571:
+ case 7572:
+ case 7573:
+ case 7574:
+ case 7575:
+ case 7576:
+ case 7577:
+ case 7578:
+ case 7579:
+ case 7580:
+ case 7581:
+ case 7582:
+ case 7583:
+ case 7584:
+ case 7585:
+ case 7586:
+ case 7587:
+ case 7588:
+ case 7589:
+ case 7590:
+ case 7591:
+ case 7592:
+ case 7593:
+ case 7594:
+ case 7595:
+ case 7596:
+ case 7597:
+ case 7598:
+ case 7599:
+ case 7600:
+ case 7601:
+ case 7602:
+ case 7603:
+ case 7604:
+ case 7605:
+ case 7606:
+ case 7607:
+ case 7608:
+ case 7609:
+ case 7610:
+ case 7611:
+ case 7612:
+ case 7613:
+ case 7614:
+ case 7615:
+ case 7616:
+ case 7617:
+ case 7618:
+ case 7619:
+ case 7620:
+ case 7621:
+ case 7622:
+ case 7623:
+ case 7624:
+ case 7625:
+ case 7626:
+ case 7627:
+ case 7628:
+ case 7629:
+ case 7630:
+ case 7631:
+ case 7632:
+ case 7633:
+ case 7634:
+ case 7635:
+ case 7636:
+ case 7637:
+ case 7638:
+ case 7639:
+ case 7640:
+ case 7641:
+ case 7642:
+ case 7643:
+ case 7644:
+ case 7645:
+ case 7646:
+ case 7647:
+ case 7648:
+ case 7649:
+ case 7650:
+ case 7651:
+ case 7652:
+ case 7653:
+ case 7654:
+ case 7655:
+ case 7656:
+ case 7657:
+ case 7658:
+ case 7659:
+ case 7660:
+ case 7661:
+ case 7662:
+ case 7663:
+ case 7664:
+ case 7665:
+ case 7666:
+ case 7667:
+ case 7668:
+ case 7669:
+ case 7670:
+ case 7671:
+ case 7672:
+ case 7673:
+ case 7674:
+ case 7675:
+ case 7676:
+ case 7677:
+ case 7678:
+ case 7679:
+ case 7680:
+ case 7681:
+ case 7682:
+ case 7683:
+ case 7684:
+ case 7685:
+ case 7686:
+ case 7687:
+ case 7688:
+ case 7689:
+ case 7690:
+ case 7691:
+ case 7692:
+ case 7693:
+ case 7694:
+ case 7695:
+ case 7696:
+ case 7697:
+ case 7698:
+ case 7699:
+ case 7700:
+ case 7701:
+ case 7702:
+ case 7703:
+ case 7704:
+ case 7705:
+ case 7706:
+ case 7707:
+ case 7708:
+ case 7709:
+ case 7710:
+ case 7711:
+ case 7712:
+ case 7713:
+ case 7714:
+ case 7715:
+ case 7716:
+ case 7717:
+ case 7718:
+ case 7719:
+ case 7720:
+ case 7721:
+ case 7722:
+ case 7723:
+ case 7724:
+ case 7725:
+ case 7726:
+ case 7727:
+ case 7728:
+ case 7729:
+ case 7730:
+ case 7731:
+ case 7732:
+ case 7733:
+ case 7734:
+ case 7735:
+ case 7736:
+ case 7737:
+ case 7738:
+ case 7739:
+ case 7740:
+ case 7741:
+ case 7742:
+ case 7743:
+ case 7744:
+ case 7745:
+ case 7746:
+ case 7747:
+ case 7748:
+ case 7749:
+ case 7750:
+ case 7751:
+ case 7752:
+ case 7753:
+ case 7754:
+ case 7755:
+ case 7756:
+ case 7757:
+ case 7758:
+ case 7759:
+ case 7760:
+ case 7761:
+ case 7762:
+ case 7763:
+ case 7764:
+ case 7765:
+ case 7766:
+ case 7767:
+ case 7768:
+ case 7769:
+ case 7770:
+ case 7771:
+ case 7772:
+ case 7773:
+ case 7774:
+ case 7775:
+ case 7776:
+ case 7777:
+ case 7778:
+ case 7779:
+ case 7780:
+ case 7781:
+ case 7782:
+ case 7783:
+ case 7784:
+ case 7785:
+ case 7786:
+ case 7787:
+ case 7788:
+ case 7789:
+ case 7790:
+ case 7791:
+ case 7792:
+ case 7793:
+ case 7794:
+ case 7795:
+ case 7796:
+ case 7797:
+ case 7798:
+ case 7799:
+ case 7800:
+ case 7801:
+ case 7802:
+ case 7803:
+ case 7804:
+ case 7805:
+ case 7806:
+ case 7807:
+ case 7808:
+ case 7809:
+ case 7810:
+ case 7811:
+ case 7812:
+ case 7813:
+ case 7814:
+ case 7815:
+ case 7816:
+ case 7817:
+ case 7818:
+ case 7819:
+ case 7820:
+ case 7821:
+ case 7822:
+ case 7823:
+ case 7824:
+ case 7825:
+ case 7826:
+ case 7827:
+ case 7828:
+ case 7829:
+ case 7830:
+ case 7831:
+ case 7832:
+ case 7833:
+ case 7834:
+ case 7835:
+ case 7836:
+ case 7837:
+ case 7838:
+ case 7839:
+ case 7840:
+ case 7841:
+ case 7842:
+ case 7843:
+ case 7844:
+ case 7845:
+ case 7846:
+ case 7847:
+ case 7848:
+ case 7849:
+ case 7850:
+ case 7851:
+ case 7852:
+ case 7853:
+ case 7854:
+ case 7855:
+ case 7856:
+ case 7857:
+ case 7858:
+ case 7859:
+ case 7860:
+ case 7861:
+ case 7862:
+ case 7863:
+ case 7864:
+ case 7865:
+ case 7866:
+ case 7867:
+ case 7868:
+ case 7869:
+ case 7870:
+ case 7871:
+ case 7872:
+ case 7873:
+ case 7874:
+ case 7875:
+ case 7876:
+ case 7877:
+ case 7878:
+ case 7879:
+ case 7880:
+ case 7881:
+ case 7882:
+ case 7883:
+ case 7884:
+ case 7885:
+ case 7886:
+ case 7887:
+ case 7888:
+ case 7889:
+ case 7890:
+ case 7891:
+ case 7892:
+ case 7893:
+ case 7894:
+ case 7895:
+ case 7896:
+ case 7897:
+ case 7898:
+ case 7899:
+ case 7900:
+ case 7901:
+ case 7902:
+ case 7903:
+ case 7904:
+ case 7905:
+ case 7906:
+ case 7907:
+ case 7908:
+ case 7909:
+ case 7910:
+ case 7911:
+ case 7912:
+ case 7913:
+ case 7914:
+ case 7915:
+ case 7916:
+ case 7917:
+ case 7918:
+ case 7919:
+ case 7920:
+ case 7921:
+ case 7922:
+ case 7923:
+ case 7924:
+ case 7925:
+ case 7926:
+ case 7927:
+ case 7928:
+ case 7929:
+ case 7930:
+ case 7931:
+ case 7932:
+ case 7933:
+ case 7934:
+ case 7935:
+ case 7936:
+ case 7937:
+ case 7938:
+ case 7939:
+ case 7940:
+ case 7941:
+ case 7942:
+ case 7943:
+ case 7944:
+ case 7945:
+ case 7946:
+ case 7947:
+ case 7948:
+ case 7949:
+ case 7950:
+ case 7951:
+ case 7952:
+ case 7953:
+ case 7954:
+ case 7955:
+ case 7956:
+ case 7957:
+ case 7958:
+ case 7959:
+ case 7960:
+ case 7961:
+ case 7962:
+ case 7963:
+ case 7964:
+ case 7965:
+ case 7966:
+ case 7967:
+ case 7968:
+ case 7969:
+ case 7970:
+ case 7971:
+ case 7972:
+ case 7973:
+ case 7974:
+ case 7975:
+ case 7976:
+ case 7977:
+ case 7978:
+ case 7979:
+ case 7980:
+ case 7981:
+ case 7982:
+ case 7983:
+ case 7984:
+ case 7985:
+ case 7986:
+ case 7987:
+ case 7988:
+ case 7989:
+ case 7990:
+ case 7991:
+ case 7992:
+ case 7993:
+ case 7994:
+ case 7995:
+ case 7996:
+ case 7997:
+ case 7998:
+ case 7999:
+ case 8000:
+ case 8001:
+ case 8002:
+ case 8003:
+ case 8004:
+ case 8005:
+ case 8006:
+ case 8007:
+ case 8008:
+ case 8009:
+ case 8010:
+ case 8011:
+ case 8012:
+ case 8013:
+ case 8014:
+ case 8015:
+ case 8016:
+ case 8017:
+ case 8018:
+ case 8019:
+ case 8020:
+ case 8021:
+ case 8022:
+ case 8023:
+ case 8024:
+ case 8025:
+ case 8026:
+ case 8027:
+ case 8028:
+ case 8029:
+ case 8030:
+ case 8031:
+ case 8032:
+ case 8033:
+ case 8034:
+ case 8035:
+ case 8036:
+ case 8037:
+ case 8038:
+ case 8039:
+ case 8040:
+ case 8041:
+ case 8042:
+ case 8043:
+ case 8044:
+ case 8045:
+ case 8046:
+ case 8047:
+ case 8048:
+ case 8049:
+ case 8050:
+ case 8051:
+ case 8052:
+ case 8053:
+ case 8054:
+ case 8055:
+ case 8056:
+ case 8057:
+ case 8058:
+ case 8059:
+ case 8060:
+ case 8061:
+ case 8062:
+ case 8063:
+ case 8064:
+ case 8065:
+ case 8066:
+ case 8067:
+ case 8068:
+ case 8069:
+ case 8070:
+ case 8071:
+ case 8072:
+ case 8073:
+ case 8074:
+ case 8075:
+ case 8076:
+ case 8077:
+ case 8078:
+ case 8079:
+ case 8080:
+ case 8081:
+ case 8082:
+ case 8083:
+ case 8084:
+ case 8085:
+ case 8086:
+ case 8087:
+ case 8088:
+ case 8089:
+ case 8090:
+ case 8091:
+ case 8092:
+ case 8093:
+ case 8094:
+ case 8095:
+ case 8096:
+ case 8097:
+ case 8098:
+ case 8099:
+ case 8100:
+ case 8101:
+ case 8102:
+ case 8103:
+ case 8104:
+ case 8105:
+ case 8106:
+ case 8107:
+ case 8108:
+ case 8109:
+ case 8110:
+ case 8111:
+ case 8112:
+ case 8113:
+ case 8114:
+ case 8115:
+ case 8116:
+ case 8117:
+ case 8118:
+ case 8119:
+ case 8120:
+ case 8121:
+ case 8122:
+ case 8123:
+ case 8124:
+ case 8125:
+ case 8126:
+ case 8127:
+ case 8128:
+ case 8129:
+ case 8130:
+ case 8131:
+ case 8132:
+ case 8133:
+ case 8134:
+ case 8135:
+ case 8136:
+ case 8137:
+ case 8138:
+ case 8139:
+ case 8140:
+ case 8141:
+ case 8142:
+ case 8143:
+ case 8144:
+ case 8145:
+ case 8146:
+ case 8147:
+ case 8148:
+ case 8149:
+ case 8150:
+ case 8151:
+ case 8152:
+ case 8153:
+ case 8154:
+ case 8155:
+ case 8156:
+ case 8157:
+ case 8158:
+ case 8159:
+ case 8160:
+ case 8161:
+ case 8162:
+ case 8163:
+ case 8164:
+ case 8165:
+ case 8166:
+ case 8167:
+ case 8168:
+ case 8169:
+ case 8170:
+ case 8171:
+ case 8172:
+ case 8173:
+ case 8174:
+ case 8175:
+ case 8176:
+ case 8177:
+ case 8178:
+ case 8179:
+ case 8180:
+ case 8181:
+ case 8182:
+ case 8183:
+ case 8184:
+ case 8185:
+ case 8186:
+ case 8187:
+ case 8188:
+ case 8189:
+ case 8190:
+ case 8191:
+ case 8192:
+ case 8193:
+ case 8194:
+ case 8195:
+ case 8196:
+ case 8197:
+ case 8198:
+ case 8199:
+ case 8200:
+ case 8201:
+ case 8202:
+ case 8203:
+ case 8204:
+ case 8205:
+ case 8206:
+ case 8207:
+ case 8208:
+ case 8209:
+ case 8210:
+ case 8211:
+ case 8212:
+ case 8213:
+ case 8214:
+ case 8215:
+ case 8216:
+ case 8217:
+ case 8218:
+ case 8219:
+ case 8220:
+ case 8221:
+ case 8222:
+ case 8223:
+ case 8224:
+ case 8225:
+ case 8226:
+ case 8227:
+ case 8228:
+ case 8229:
+ case 8230:
+ case 8231:
+ case 8232:
+ case 8233:
+ case 8234:
+ case 8235:
+ case 8236:
+ case 8237:
+ case 8238:
+ case 8239:
+ case 8240:
+ case 8241:
+ case 8242:
+ case 8243:
+ case 8244:
+ case 8245:
+ case 8246:
+ case 8247:
+ case 8248:
+ case 8249:
+ case 8250:
+ case 8251:
+ case 8252:
+ case 8253:
+ case 8254:
+ case 8255:
+ case 8256:
+ case 8257:
+ case 8258:
+ case 8259:
+ case 8260:
+ case 8261:
+ case 8262:
+ case 8263:
+ case 8264:
+ case 8265:
+ case 8266:
+ case 8267:
+ case 8268:
+ case 8269:
+ case 8270:
+ case 8271:
+ case 8272:
+ case 8273:
+ case 8274:
+ case 8275:
+ case 8276:
+ case 8277:
+ case 8278:
+ case 8279:
+ case 8280:
+ case 8281:
+ case 8282:
+ case 8283:
+ case 8284:
+ case 8285:
+ case 8286:
+ case 8287:
+ case 8288:
+ case 8289:
+ case 8290:
+ case 8291:
+ case 8292:
+ case 8293:
+ case 8294:
+ case 8295:
+ case 8296:
+ case 8297:
+ case 8298:
+ case 8299:
+ case 8300:
+ case 8301:
+ case 8302:
+ case 8303:
+ case 8304:
+ case 8305:
+ case 8306:
+ case 8307:
+ case 8308:
+ case 8309:
+ case 8310:
+ case 8311:
+ case 8312:
+ case 8313:
+ case 8314:
+ case 8315:
+ case 8316:
+ case 8317:
+ case 8318:
+ case 8319:
+ case 8320:
+ case 8321:
+ case 8322:
+ case 8323:
+ case 8324:
+ case 8325:
+ case 8326:
+ case 8327:
+ case 8328:
+ case 8329:
+ case 8330:
+ case 8331:
+ case 8332:
+ case 8333:
+ case 8334:
+ case 8335:
+ case 8336:
+ case 8337:
+ case 8338:
+ case 8339:
+ case 8340:
+ case 8341:
+ case 8342:
+ case 8343:
+ case 8344:
+ case 8345:
+ case 8346:
+ case 8347:
+ case 8348:
+ case 8349:
+ case 8350:
+ case 8351:
+ case 8352:
+ case 8353:
+ case 8354:
+ case 8355:
+ case 8356:
+ case 8357:
+ case 8358:
+ case 8359:
+ case 8360:
+ case 8361:
+ case 8362:
+ case 8363:
+ case 8364:
+ case 8365:
+ case 8366:
+ case 8367:
+ case 8368:
+ case 8369:
+ case 8370:
+ case 8371:
+ case 8372:
+ case 8373:
+ case 8374:
+ case 8375:
+ case 8376:
+ case 8377:
+ case 8378:
+ case 8379:
+ case 8380:
+ case 8381:
+ case 8382:
+ case 8383:
+ case 8384:
+ case 8385:
+ case 8386:
+ case 8387:
+ case 8388:
+ case 8389:
+ case 8390:
+ case 8391:
+ case 8392:
+ case 8393:
+ case 8394:
+ case 8395:
+ case 8396:
+ case 8397:
+ case 8398:
+ case 8399:
+ case 8400:
+ case 8401:
+ case 8402:
+ case 8403:
+ case 8404:
+ case 8405:
+ case 8406:
+ case 8407:
+ case 8408:
+ case 8409:
+ case 8410:
+ case 8411:
+ case 8412:
+ case 8413:
+ case 8414:
+ case 8415:
+ case 8416:
+ case 8417:
+ case 8418:
+ case 8419:
+ case 8420:
+ case 8421:
+ case 8422:
+ case 8423:
+ case 8424:
+ case 8425:
+ case 8426:
+ case 8427:
+ case 8428:
+ case 8429:
+ case 8430:
+ case 8431:
+ case 8432:
+ case 8433:
+ case 8434:
+ case 8435:
+ case 8436:
+ case 8437:
+ case 8438:
+ case 8439:
+ case 8440:
+ case 8441:
+ case 8442:
+ case 8443:
+ case 8444:
+ case 8445:
+ case 8446:
+ case 8447:
+ case 8448:
+ case 8449:
+ case 8450:
+ case 8451:
+ case 8452:
+ case 8453:
+ case 8454:
+ case 8455:
+ case 8456:
+ case 8457:
+ case 8458:
+ case 8459:
+ case 8460:
+ case 8461:
+ case 8462:
+ case 8463:
+ case 8464:
+ case 8465:
+ case 8466:
+ case 8467:
+ case 8468:
+ case 8469:
+ case 8470:
+ case 8471:
+ case 8472:
+ case 8473:
+ case 8474:
+ case 8475:
+ case 8476:
+ case 8477:
+ case 8478:
+ case 8479:
+ case 8480:
+ case 8481:
+ case 8482:
+ case 8483:
+ case 8484:
+ case 8485:
+ case 8486:
+ case 8487:
+ case 8488:
+ case 8489:
+ case 8490:
+ case 8491:
+ case 8492:
+ case 8493:
+ case 8494:
+ case 8495:
+ case 8496:
+ case 8497:
+ case 8498:
+ case 8499:
+ case 8500:
+ case 8501:
+ case 8502:
+ case 8503:
+ case 8504:
+ case 8505:
+ case 8506:
+ case 8507:
+ case 8508:
+ case 8509:
+ case 8510:
+ case 8511:
+ case 8512:
+ case 8513:
+ case 8514:
+ case 8515:
+ case 8516:
+ case 8517:
+ case 8518:
+ case 8519:
+ case 8520:
+ case 8521:
+ case 8522:
+ case 8523:
+ case 8524:
+ case 8525:
+ case 8526:
+ case 8527:
+ case 8528:
+ case 8529:
+ case 8530:
+ case 8531:
+ case 8532:
+ case 8533:
+ case 8534:
+ case 8535:
+ case 8536:
+ case 8537:
+ case 8538:
+ case 8539:
+ case 8540:
+ case 8541:
+ case 8542:
+ case 8543:
+ case 8544:
+ case 8545:
+ case 8546:
+ case 8547:
+ case 8548:
+ case 8549:
+ case 8550:
+ case 8551:
+ case 8552:
+ case 8553:
+ case 8554:
+ case 8555:
+ case 8556:
+ case 8557:
+ case 8558:
+ case 8559:
+ case 8560:
+ case 8561:
+ case 8562:
+ case 8563:
+ case 8564:
+ case 8565:
+ case 8566:
+ case 8567:
+ case 8568:
+ case 8569:
+ case 8570:
+ case 8571:
+ case 8572:
+ case 8573:
+ case 8574:
+ case 8575:
+ case 8576:
+ case 8577:
+ case 8578:
+ case 8579:
+ case 8580:
+ case 8581:
+ case 8582:
+ case 8583:
+ case 8584:
+ case 8585:
+ case 8586:
+ case 8587:
+ case 8588:
+ case 8589:
+ case 8590:
+ case 8591:
+ case 8592:
+ case 8593:
+ case 8594:
+ case 8595:
+ case 8596:
+ case 8597:
+ case 8598:
+ case 8599:
+ case 8600:
+ case 8601:
+ case 8602:
+ case 8603:
+ case 8604:
+ case 8605:
+ case 8606:
+ case 8607:
+ case 8608:
+ case 8609:
+ case 8610:
+ case 8611:
+ case 8612:
+ case 8613:
+ case 8614:
+ case 8615:
+ case 8616:
+ case 8617:
+ case 8618:
+ case 8619:
+ case 8620:
+ case 8621:
+ case 8622:
+ case 8623:
+ case 8624:
+ case 8625:
+ case 8626:
+ case 8627:
+ case 8628:
+ case 8629:
+ case 8630:
+ case 8631:
+ case 8632:
+ case 8633:
+ case 8634:
+ case 8635:
+ case 8636:
+ case 8637:
+ case 8638:
+ case 8639:
+ case 8640:
+ case 8641:
+ case 8642:
+ case 8643:
+ case 8644:
+ case 8645:
+ case 8646:
+ case 8647:
+ case 8648:
+ case 8649:
+ case 8650:
+ case 8651:
+ case 8652:
+ case 8653:
+ case 8654:
+ case 8655:
+ case 8656:
+ case 8657:
+ case 8658:
+ case 8659:
+ case 8660:
+ case 8661:
+ case 8662:
+ case 8663:
+ case 8664:
+ case 8665:
+ case 8666:
+ case 8667:
+ case 8668:
+ case 8669:
+ case 8670:
+ case 8671:
+ case 8672:
+ case 8673:
+ case 8674:
+ case 8675:
+ case 8676:
+ case 8677:
+ case 8678:
+ case 8679:
+ case 8680:
+ case 8681:
+ case 8682:
+ case 8683:
+ case 8684:
+ case 8685:
+ case 8686:
+ case 8687:
+ case 8688:
+ case 8689:
+ case 8690:
+ case 8691:
+ case 8692:
+ case 8693:
+ case 8694:
+ case 8695:
+ case 8696:
+ case 8697:
+ case 8698:
+ case 8699:
+ case 8700:
+ case 8701:
+ case 8702:
+ case 8703:
+ case 8704:
+ case 8705:
+ case 8706:
+ case 8707:
+ case 8708:
+ case 8709:
+ case 8710:
+ case 8711:
+ case 8712:
+ case 8713:
+ case 8714:
+ case 8715:
+ case 8716:
+ case 8717:
+ case 8718:
+ case 8719:
+ case 8720:
+ case 8721:
+ case 8722:
+ case 8723:
+ case 8724:
+ case 8725:
+ case 8726:
+ case 8727:
+ case 8728:
+ case 8729:
+ case 8730:
+ case 8731:
+ case 8732:
+ case 8733:
+ case 8734:
+ case 8735:
+ case 8736:
+ case 8737:
+ case 8738:
+ case 8739:
+ case 8740:
+ case 8741:
+ case 8742:
+ case 8743:
+ case 8744:
+ case 8745:
+ case 8746:
+ case 8747:
+ case 8748:
+ case 8749:
+ case 8750:
+ case 8751:
+ case 8752:
+ case 8753:
+ case 8754:
+ case 8755:
+ case 8756:
+ case 8757:
+ case 8758:
+ case 8759:
+ case 8760:
+ case 8761:
+ case 8762:
+ case 8763:
+ case 8764:
+ case 8765:
+ case 8766:
+ case 8767:
+ case 8768:
+ case 8769:
+ case 8770:
+ case 8771:
+ case 8772:
+ case 8773:
+ case 8774:
+ case 8775:
+ case 8776:
+ case 8777:
+ case 8778:
+ case 8779:
+ case 8780:
+ case 8781:
+ case 8782:
+ case 8783:
+ case 8784:
+ case 8785:
+ case 8786:
+ case 8787:
+ case 8788:
+ case 8789:
+ case 8790:
+ case 8791:
+ case 8792:
+ case 8793:
+ case 8794:
+ case 8795:
+ case 8796:
+ case 8797:
+ case 8798:
+ case 8799:
+ case 8800:
+ case 8801:
+ case 8802:
+ case 8803:
+ case 8804:
+ case 8805:
+ case 8806:
+ case 8807:
+ case 8808:
+ case 8809:
+ case 8810:
+ case 8811:
+ case 8812:
+ case 8813:
+ case 8814:
+ case 8815:
+ case 8816:
+ case 8817:
+ case 8818:
+ case 8819:
+ case 8820:
+ case 8821:
+ case 8822:
+ case 8823:
+ case 8824:
+ case 8825:
+ case 8826:
+ case 8827:
+ case 8828:
+ case 8829:
+ case 8830:
+ case 8831:
+ case 8832:
+ case 8833:
+ case 8834:
+ case 8835:
+ case 8836:
+ case 8837:
+ case 8838:
+ case 8839:
+ case 8840:
+ case 8841:
+ case 8842:
+ case 8843:
+ case 8844:
+ case 8845:
+ case 8846:
+ case 8847:
+ case 8848:
+ case 8849:
+ case 8850:
+ case 8851:
+ case 8852:
+ case 8853:
+ case 8854:
+ case 8855:
+ case 8856:
+ case 8857:
+ case 8858:
+ case 8859:
+ case 8860:
+ case 8861:
+ case 8862:
+ case 8863:
+ case 8864:
+ case 8865:
+ case 8866:
+ case 8867:
+ case 8868:
+ case 8869:
+ case 8870:
+ case 8871:
+ case 8872:
+ case 8873:
+ case 8874:
+ case 8875:
+ case 8876:
+ case 8877:
+ case 8878:
+ case 8879:
+ case 8880:
+ case 8881:
+ case 8882:
+ case 8883:
+ case 8884:
+ case 8885:
+ case 8886:
+ case 8887:
+ case 8888:
+ case 8889:
+ case 8890:
+ case 8891:
+ case 8892:
+ case 8893:
+ case 8894:
+ case 8895:
+ case 8896:
+ case 8897:
+ case 8898:
+ case 8899:
+ case 8900:
+ case 8901:
+ case 8902:
+ case 8903:
+ case 8904:
+ case 8905:
+ case 8906:
+ case 8907:
+ case 8908:
+ case 8909:
+ case 8910:
+ case 8911:
+ case 8912:
+ case 8913:
+ case 8914:
+ case 8915:
+ case 8916:
+ case 8917:
+ case 8918:
+ case 8919:
+ case 8920:
+ case 8921:
+ case 8922:
+ case 8923:
+ case 8924:
+ case 8925:
+ case 8926:
+ case 8927:
+ case 8928:
+ case 8929:
+ case 8930:
+ case 8931:
+ case 8932:
+ case 8933:
+ case 8934:
+ case 8935:
+ case 8936:
+ case 8937:
+ case 8938:
+ case 8939:
+ case 8940:
+ case 8941:
+ case 8942:
+ case 8943:
+ case 8944:
+ case 8945:
+ case 8946:
+ case 8947:
+ case 8948:
+ case 8949:
+ case 8950:
+ case 8951:
+ case 8952:
+ case 8953:
+ case 8954:
+ case 8955:
+ case 8956:
+ case 8957:
+ case 8958:
+ case 8959:
+ case 8960:
+ case 8961:
+ case 8962:
+ case 8963:
+ case 8964:
+ case 8965:
+ case 8966:
+ case 8967:
+ case 8968:
+ case 8969:
+ case 8970:
+ case 8971:
+ case 8972:
+ case 8973:
+ case 8974:
+ case 8975:
+ case 8976:
+ case 8977:
+ case 8978:
+ case 8979:
+ case 8980:
+ case 8981:
+ case 8982:
+ case 8983:
+ case 8984:
+ case 8985:
+ case 8986:
+ case 8987:
+ case 8988:
+ case 8989:
+ case 8990:
+ case 8991:
+ case 8992:
+ case 8993:
+ case 8994:
+ case 8995:
+ case 8996:
+ case 8997:
+ case 8998:
+ case 8999:
+ actual += 'a';
+}
+expect = 'a';
+addThis();
+
+
+
+//---------------------------------------------------------------------------------
+test();
+//---------------------------------------------------------------------------------
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ for (var i = 0; i < UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-74474-003.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-74474-003.js
new file mode 100644
index 0000000..681fb3f
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-74474-003.js
@@ -0,0 +1,9078 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS"
+* basis, WITHOUT WARRANTY OF ANY KIND, either expressed
+* or implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation. All
+* Rights Reserved.
+*
+* Contributor(s): brendan@mozilla.org, pschwartau@netscape.com
+* Date: 09 May 2001
+*
+* SUMMARY: Regression test for Bugzilla bug 74474
+* "switch() misbehaves with duplicated labels"
+*
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=74474
+* See ECMA3 Section 12.11, "The switch Statement"
+*/
+//-------------------------------------------------------------------------------------------------
+var UBound = 0;
+var bug = 74474;
+var summary = 'Test of switch statement that overflows the stack-allocated bitmap';
+var status = '(One duplicated label [8998])';
+var statusitems = [ ];
+var actual = '';
+var actualvalues = [ ];
+var expect= '';
+var expectedvalues = [ ];
+var x = 3;
+
+
+switch (x)
+{
+ case 0:
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ case 5:
+ case 6:
+ case 7:
+ case 8:
+ case 9:
+ case 10:
+ case 11:
+ case 12:
+ case 13:
+ case 14:
+ case 15:
+ case 16:
+ case 17:
+ case 18:
+ case 19:
+ case 20:
+ case 21:
+ case 22:
+ case 23:
+ case 24:
+ case 25:
+ case 26:
+ case 27:
+ case 28:
+ case 29:
+ case 30:
+ case 31:
+ case 32:
+ case 33:
+ case 34:
+ case 35:
+ case 36:
+ case 37:
+ case 38:
+ case 39:
+ case 40:
+ case 41:
+ case 42:
+ case 43:
+ case 44:
+ case 45:
+ case 46:
+ case 47:
+ case 48:
+ case 49:
+ case 50:
+ case 51:
+ case 52:
+ case 53:
+ case 54:
+ case 55:
+ case 56:
+ case 57:
+ case 58:
+ case 59:
+ case 60:
+ case 61:
+ case 62:
+ case 63:
+ case 64:
+ case 65:
+ case 66:
+ case 67:
+ case 68:
+ case 69:
+ case 70:
+ case 71:
+ case 72:
+ case 73:
+ case 74:
+ case 75:
+ case 76:
+ case 77:
+ case 78:
+ case 79:
+ case 80:
+ case 81:
+ case 82:
+ case 83:
+ case 84:
+ case 85:
+ case 86:
+ case 87:
+ case 88:
+ case 89:
+ case 90:
+ case 91:
+ case 92:
+ case 93:
+ case 94:
+ case 95:
+ case 96:
+ case 97:
+ case 98:
+ case 99:
+ case 100:
+ case 101:
+ case 102:
+ case 103:
+ case 104:
+ case 105:
+ case 106:
+ case 107:
+ case 108:
+ case 109:
+ case 110:
+ case 111:
+ case 112:
+ case 113:
+ case 114:
+ case 115:
+ case 116:
+ case 117:
+ case 118:
+ case 119:
+ case 120:
+ case 121:
+ case 122:
+ case 123:
+ case 124:
+ case 125:
+ case 126:
+ case 127:
+ case 128:
+ case 129:
+ case 130:
+ case 131:
+ case 132:
+ case 133:
+ case 134:
+ case 135:
+ case 136:
+ case 137:
+ case 138:
+ case 139:
+ case 140:
+ case 141:
+ case 142:
+ case 143:
+ case 144:
+ case 145:
+ case 146:
+ case 147:
+ case 148:
+ case 149:
+ case 150:
+ case 151:
+ case 152:
+ case 153:
+ case 154:
+ case 155:
+ case 156:
+ case 157:
+ case 158:
+ case 159:
+ case 160:
+ case 161:
+ case 162:
+ case 163:
+ case 164:
+ case 165:
+ case 166:
+ case 167:
+ case 168:
+ case 169:
+ case 170:
+ case 171:
+ case 172:
+ case 173:
+ case 174:
+ case 175:
+ case 176:
+ case 177:
+ case 178:
+ case 179:
+ case 180:
+ case 181:
+ case 182:
+ case 183:
+ case 184:
+ case 185:
+ case 186:
+ case 187:
+ case 188:
+ case 189:
+ case 190:
+ case 191:
+ case 192:
+ case 193:
+ case 194:
+ case 195:
+ case 196:
+ case 197:
+ case 198:
+ case 199:
+ case 200:
+ case 201:
+ case 202:
+ case 203:
+ case 204:
+ case 205:
+ case 206:
+ case 207:
+ case 208:
+ case 209:
+ case 210:
+ case 211:
+ case 212:
+ case 213:
+ case 214:
+ case 215:
+ case 216:
+ case 217:
+ case 218:
+ case 219:
+ case 220:
+ case 221:
+ case 222:
+ case 223:
+ case 224:
+ case 225:
+ case 226:
+ case 227:
+ case 228:
+ case 229:
+ case 230:
+ case 231:
+ case 232:
+ case 233:
+ case 234:
+ case 235:
+ case 236:
+ case 237:
+ case 238:
+ case 239:
+ case 240:
+ case 241:
+ case 242:
+ case 243:
+ case 244:
+ case 245:
+ case 246:
+ case 247:
+ case 248:
+ case 249:
+ case 250:
+ case 251:
+ case 252:
+ case 253:
+ case 254:
+ case 255:
+ case 256:
+ case 257:
+ case 258:
+ case 259:
+ case 260:
+ case 261:
+ case 262:
+ case 263:
+ case 264:
+ case 265:
+ case 266:
+ case 267:
+ case 268:
+ case 269:
+ case 270:
+ case 271:
+ case 272:
+ case 273:
+ case 274:
+ case 275:
+ case 276:
+ case 277:
+ case 278:
+ case 279:
+ case 280:
+ case 281:
+ case 282:
+ case 283:
+ case 284:
+ case 285:
+ case 286:
+ case 287:
+ case 288:
+ case 289:
+ case 290:
+ case 291:
+ case 292:
+ case 293:
+ case 294:
+ case 295:
+ case 296:
+ case 297:
+ case 298:
+ case 299:
+ case 300:
+ case 301:
+ case 302:
+ case 303:
+ case 304:
+ case 305:
+ case 306:
+ case 307:
+ case 308:
+ case 309:
+ case 310:
+ case 311:
+ case 312:
+ case 313:
+ case 314:
+ case 315:
+ case 316:
+ case 317:
+ case 318:
+ case 319:
+ case 320:
+ case 321:
+ case 322:
+ case 323:
+ case 324:
+ case 325:
+ case 326:
+ case 327:
+ case 328:
+ case 329:
+ case 330:
+ case 331:
+ case 332:
+ case 333:
+ case 334:
+ case 335:
+ case 336:
+ case 337:
+ case 338:
+ case 339:
+ case 340:
+ case 341:
+ case 342:
+ case 343:
+ case 344:
+ case 345:
+ case 346:
+ case 347:
+ case 348:
+ case 349:
+ case 350:
+ case 351:
+ case 352:
+ case 353:
+ case 354:
+ case 355:
+ case 356:
+ case 357:
+ case 358:
+ case 359:
+ case 360:
+ case 361:
+ case 362:
+ case 363:
+ case 364:
+ case 365:
+ case 366:
+ case 367:
+ case 368:
+ case 369:
+ case 370:
+ case 371:
+ case 372:
+ case 373:
+ case 374:
+ case 375:
+ case 376:
+ case 377:
+ case 378:
+ case 379:
+ case 380:
+ case 381:
+ case 382:
+ case 383:
+ case 384:
+ case 385:
+ case 386:
+ case 387:
+ case 388:
+ case 389:
+ case 390:
+ case 391:
+ case 392:
+ case 393:
+ case 394:
+ case 395:
+ case 396:
+ case 397:
+ case 398:
+ case 399:
+ case 400:
+ case 401:
+ case 402:
+ case 403:
+ case 404:
+ case 405:
+ case 406:
+ case 407:
+ case 408:
+ case 409:
+ case 410:
+ case 411:
+ case 412:
+ case 413:
+ case 414:
+ case 415:
+ case 416:
+ case 417:
+ case 418:
+ case 419:
+ case 420:
+ case 421:
+ case 422:
+ case 423:
+ case 424:
+ case 425:
+ case 426:
+ case 427:
+ case 428:
+ case 429:
+ case 430:
+ case 431:
+ case 432:
+ case 433:
+ case 434:
+ case 435:
+ case 436:
+ case 437:
+ case 438:
+ case 439:
+ case 440:
+ case 441:
+ case 442:
+ case 443:
+ case 444:
+ case 445:
+ case 446:
+ case 447:
+ case 448:
+ case 449:
+ case 450:
+ case 451:
+ case 452:
+ case 453:
+ case 454:
+ case 455:
+ case 456:
+ case 457:
+ case 458:
+ case 459:
+ case 460:
+ case 461:
+ case 462:
+ case 463:
+ case 464:
+ case 465:
+ case 466:
+ case 467:
+ case 468:
+ case 469:
+ case 470:
+ case 471:
+ case 472:
+ case 473:
+ case 474:
+ case 475:
+ case 476:
+ case 477:
+ case 478:
+ case 479:
+ case 480:
+ case 481:
+ case 482:
+ case 483:
+ case 484:
+ case 485:
+ case 486:
+ case 487:
+ case 488:
+ case 489:
+ case 490:
+ case 491:
+ case 492:
+ case 493:
+ case 494:
+ case 495:
+ case 496:
+ case 497:
+ case 498:
+ case 499:
+ case 500:
+ case 501:
+ case 502:
+ case 503:
+ case 504:
+ case 505:
+ case 506:
+ case 507:
+ case 508:
+ case 509:
+ case 510:
+ case 511:
+ case 512:
+ case 513:
+ case 514:
+ case 515:
+ case 516:
+ case 517:
+ case 518:
+ case 519:
+ case 520:
+ case 521:
+ case 522:
+ case 523:
+ case 524:
+ case 525:
+ case 526:
+ case 527:
+ case 528:
+ case 529:
+ case 530:
+ case 531:
+ case 532:
+ case 533:
+ case 534:
+ case 535:
+ case 536:
+ case 537:
+ case 538:
+ case 539:
+ case 540:
+ case 541:
+ case 542:
+ case 543:
+ case 544:
+ case 545:
+ case 546:
+ case 547:
+ case 548:
+ case 549:
+ case 550:
+ case 551:
+ case 552:
+ case 553:
+ case 554:
+ case 555:
+ case 556:
+ case 557:
+ case 558:
+ case 559:
+ case 560:
+ case 561:
+ case 562:
+ case 563:
+ case 564:
+ case 565:
+ case 566:
+ case 567:
+ case 568:
+ case 569:
+ case 570:
+ case 571:
+ case 572:
+ case 573:
+ case 574:
+ case 575:
+ case 576:
+ case 577:
+ case 578:
+ case 579:
+ case 580:
+ case 581:
+ case 582:
+ case 583:
+ case 584:
+ case 585:
+ case 586:
+ case 587:
+ case 588:
+ case 589:
+ case 590:
+ case 591:
+ case 592:
+ case 593:
+ case 594:
+ case 595:
+ case 596:
+ case 597:
+ case 598:
+ case 599:
+ case 600:
+ case 601:
+ case 602:
+ case 603:
+ case 604:
+ case 605:
+ case 606:
+ case 607:
+ case 608:
+ case 609:
+ case 610:
+ case 611:
+ case 612:
+ case 613:
+ case 614:
+ case 615:
+ case 616:
+ case 617:
+ case 618:
+ case 619:
+ case 620:
+ case 621:
+ case 622:
+ case 623:
+ case 624:
+ case 625:
+ case 626:
+ case 627:
+ case 628:
+ case 629:
+ case 630:
+ case 631:
+ case 632:
+ case 633:
+ case 634:
+ case 635:
+ case 636:
+ case 637:
+ case 638:
+ case 639:
+ case 640:
+ case 641:
+ case 642:
+ case 643:
+ case 644:
+ case 645:
+ case 646:
+ case 647:
+ case 648:
+ case 649:
+ case 650:
+ case 651:
+ case 652:
+ case 653:
+ case 654:
+ case 655:
+ case 656:
+ case 657:
+ case 658:
+ case 659:
+ case 660:
+ case 661:
+ case 662:
+ case 663:
+ case 664:
+ case 665:
+ case 666:
+ case 667:
+ case 668:
+ case 669:
+ case 670:
+ case 671:
+ case 672:
+ case 673:
+ case 674:
+ case 675:
+ case 676:
+ case 677:
+ case 678:
+ case 679:
+ case 680:
+ case 681:
+ case 682:
+ case 683:
+ case 684:
+ case 685:
+ case 686:
+ case 687:
+ case 688:
+ case 689:
+ case 690:
+ case 691:
+ case 692:
+ case 693:
+ case 694:
+ case 695:
+ case 696:
+ case 697:
+ case 698:
+ case 699:
+ case 700:
+ case 701:
+ case 702:
+ case 703:
+ case 704:
+ case 705:
+ case 706:
+ case 707:
+ case 708:
+ case 709:
+ case 710:
+ case 711:
+ case 712:
+ case 713:
+ case 714:
+ case 715:
+ case 716:
+ case 717:
+ case 718:
+ case 719:
+ case 720:
+ case 721:
+ case 722:
+ case 723:
+ case 724:
+ case 725:
+ case 726:
+ case 727:
+ case 728:
+ case 729:
+ case 730:
+ case 731:
+ case 732:
+ case 733:
+ case 734:
+ case 735:
+ case 736:
+ case 737:
+ case 738:
+ case 739:
+ case 740:
+ case 741:
+ case 742:
+ case 743:
+ case 744:
+ case 745:
+ case 746:
+ case 747:
+ case 748:
+ case 749:
+ case 750:
+ case 751:
+ case 752:
+ case 753:
+ case 754:
+ case 755:
+ case 756:
+ case 757:
+ case 758:
+ case 759:
+ case 760:
+ case 761:
+ case 762:
+ case 763:
+ case 764:
+ case 765:
+ case 766:
+ case 767:
+ case 768:
+ case 769:
+ case 770:
+ case 771:
+ case 772:
+ case 773:
+ case 774:
+ case 775:
+ case 776:
+ case 777:
+ case 778:
+ case 779:
+ case 780:
+ case 781:
+ case 782:
+ case 783:
+ case 784:
+ case 785:
+ case 786:
+ case 787:
+ case 788:
+ case 789:
+ case 790:
+ case 791:
+ case 792:
+ case 793:
+ case 794:
+ case 795:
+ case 796:
+ case 797:
+ case 798:
+ case 799:
+ case 800:
+ case 801:
+ case 802:
+ case 803:
+ case 804:
+ case 805:
+ case 806:
+ case 807:
+ case 808:
+ case 809:
+ case 810:
+ case 811:
+ case 812:
+ case 813:
+ case 814:
+ case 815:
+ case 816:
+ case 817:
+ case 818:
+ case 819:
+ case 820:
+ case 821:
+ case 822:
+ case 823:
+ case 824:
+ case 825:
+ case 826:
+ case 827:
+ case 828:
+ case 829:
+ case 830:
+ case 831:
+ case 832:
+ case 833:
+ case 834:
+ case 835:
+ case 836:
+ case 837:
+ case 838:
+ case 839:
+ case 840:
+ case 841:
+ case 842:
+ case 843:
+ case 844:
+ case 845:
+ case 846:
+ case 847:
+ case 848:
+ case 849:
+ case 850:
+ case 851:
+ case 852:
+ case 853:
+ case 854:
+ case 855:
+ case 856:
+ case 857:
+ case 858:
+ case 859:
+ case 860:
+ case 861:
+ case 862:
+ case 863:
+ case 864:
+ case 865:
+ case 866:
+ case 867:
+ case 868:
+ case 869:
+ case 870:
+ case 871:
+ case 872:
+ case 873:
+ case 874:
+ case 875:
+ case 876:
+ case 877:
+ case 878:
+ case 879:
+ case 880:
+ case 881:
+ case 882:
+ case 883:
+ case 884:
+ case 885:
+ case 886:
+ case 887:
+ case 888:
+ case 889:
+ case 890:
+ case 891:
+ case 892:
+ case 893:
+ case 894:
+ case 895:
+ case 896:
+ case 897:
+ case 898:
+ case 899:
+ case 900:
+ case 901:
+ case 902:
+ case 903:
+ case 904:
+ case 905:
+ case 906:
+ case 907:
+ case 908:
+ case 909:
+ case 910:
+ case 911:
+ case 912:
+ case 913:
+ case 914:
+ case 915:
+ case 916:
+ case 917:
+ case 918:
+ case 919:
+ case 920:
+ case 921:
+ case 922:
+ case 923:
+ case 924:
+ case 925:
+ case 926:
+ case 927:
+ case 928:
+ case 929:
+ case 930:
+ case 931:
+ case 932:
+ case 933:
+ case 934:
+ case 935:
+ case 936:
+ case 937:
+ case 938:
+ case 939:
+ case 940:
+ case 941:
+ case 942:
+ case 943:
+ case 944:
+ case 945:
+ case 946:
+ case 947:
+ case 948:
+ case 949:
+ case 950:
+ case 951:
+ case 952:
+ case 953:
+ case 954:
+ case 955:
+ case 956:
+ case 957:
+ case 958:
+ case 959:
+ case 960:
+ case 961:
+ case 962:
+ case 963:
+ case 964:
+ case 965:
+ case 966:
+ case 967:
+ case 968:
+ case 969:
+ case 970:
+ case 971:
+ case 972:
+ case 973:
+ case 974:
+ case 975:
+ case 976:
+ case 977:
+ case 978:
+ case 979:
+ case 980:
+ case 981:
+ case 982:
+ case 983:
+ case 984:
+ case 985:
+ case 986:
+ case 987:
+ case 988:
+ case 989:
+ case 990:
+ case 991:
+ case 992:
+ case 993:
+ case 994:
+ case 995:
+ case 996:
+ case 997:
+ case 998:
+ case 999:
+ case 1000:
+ case 1001:
+ case 1002:
+ case 1003:
+ case 1004:
+ case 1005:
+ case 1006:
+ case 1007:
+ case 1008:
+ case 1009:
+ case 1010:
+ case 1011:
+ case 1012:
+ case 1013:
+ case 1014:
+ case 1015:
+ case 1016:
+ case 1017:
+ case 1018:
+ case 1019:
+ case 1020:
+ case 1021:
+ case 1022:
+ case 1023:
+ case 1024:
+ case 1025:
+ case 1026:
+ case 1027:
+ case 1028:
+ case 1029:
+ case 1030:
+ case 1031:
+ case 1032:
+ case 1033:
+ case 1034:
+ case 1035:
+ case 1036:
+ case 1037:
+ case 1038:
+ case 1039:
+ case 1040:
+ case 1041:
+ case 1042:
+ case 1043:
+ case 1044:
+ case 1045:
+ case 1046:
+ case 1047:
+ case 1048:
+ case 1049:
+ case 1050:
+ case 1051:
+ case 1052:
+ case 1053:
+ case 1054:
+ case 1055:
+ case 1056:
+ case 1057:
+ case 1058:
+ case 1059:
+ case 1060:
+ case 1061:
+ case 1062:
+ case 1063:
+ case 1064:
+ case 1065:
+ case 1066:
+ case 1067:
+ case 1068:
+ case 1069:
+ case 1070:
+ case 1071:
+ case 1072:
+ case 1073:
+ case 1074:
+ case 1075:
+ case 1076:
+ case 1077:
+ case 1078:
+ case 1079:
+ case 1080:
+ case 1081:
+ case 1082:
+ case 1083:
+ case 1084:
+ case 1085:
+ case 1086:
+ case 1087:
+ case 1088:
+ case 1089:
+ case 1090:
+ case 1091:
+ case 1092:
+ case 1093:
+ case 1094:
+ case 1095:
+ case 1096:
+ case 1097:
+ case 1098:
+ case 1099:
+ case 1100:
+ case 1101:
+ case 1102:
+ case 1103:
+ case 1104:
+ case 1105:
+ case 1106:
+ case 1107:
+ case 1108:
+ case 1109:
+ case 1110:
+ case 1111:
+ case 1112:
+ case 1113:
+ case 1114:
+ case 1115:
+ case 1116:
+ case 1117:
+ case 1118:
+ case 1119:
+ case 1120:
+ case 1121:
+ case 1122:
+ case 1123:
+ case 1124:
+ case 1125:
+ case 1126:
+ case 1127:
+ case 1128:
+ case 1129:
+ case 1130:
+ case 1131:
+ case 1132:
+ case 1133:
+ case 1134:
+ case 1135:
+ case 1136:
+ case 1137:
+ case 1138:
+ case 1139:
+ case 1140:
+ case 1141:
+ case 1142:
+ case 1143:
+ case 1144:
+ case 1145:
+ case 1146:
+ case 1147:
+ case 1148:
+ case 1149:
+ case 1150:
+ case 1151:
+ case 1152:
+ case 1153:
+ case 1154:
+ case 1155:
+ case 1156:
+ case 1157:
+ case 1158:
+ case 1159:
+ case 1160:
+ case 1161:
+ case 1162:
+ case 1163:
+ case 1164:
+ case 1165:
+ case 1166:
+ case 1167:
+ case 1168:
+ case 1169:
+ case 1170:
+ case 1171:
+ case 1172:
+ case 1173:
+ case 1174:
+ case 1175:
+ case 1176:
+ case 1177:
+ case 1178:
+ case 1179:
+ case 1180:
+ case 1181:
+ case 1182:
+ case 1183:
+ case 1184:
+ case 1185:
+ case 1186:
+ case 1187:
+ case 1188:
+ case 1189:
+ case 1190:
+ case 1191:
+ case 1192:
+ case 1193:
+ case 1194:
+ case 1195:
+ case 1196:
+ case 1197:
+ case 1198:
+ case 1199:
+ case 1200:
+ case 1201:
+ case 1202:
+ case 1203:
+ case 1204:
+ case 1205:
+ case 1206:
+ case 1207:
+ case 1208:
+ case 1209:
+ case 1210:
+ case 1211:
+ case 1212:
+ case 1213:
+ case 1214:
+ case 1215:
+ case 1216:
+ case 1217:
+ case 1218:
+ case 1219:
+ case 1220:
+ case 1221:
+ case 1222:
+ case 1223:
+ case 1224:
+ case 1225:
+ case 1226:
+ case 1227:
+ case 1228:
+ case 1229:
+ case 1230:
+ case 1231:
+ case 1232:
+ case 1233:
+ case 1234:
+ case 1235:
+ case 1236:
+ case 1237:
+ case 1238:
+ case 1239:
+ case 1240:
+ case 1241:
+ case 1242:
+ case 1243:
+ case 1244:
+ case 1245:
+ case 1246:
+ case 1247:
+ case 1248:
+ case 1249:
+ case 1250:
+ case 1251:
+ case 1252:
+ case 1253:
+ case 1254:
+ case 1255:
+ case 1256:
+ case 1257:
+ case 1258:
+ case 1259:
+ case 1260:
+ case 1261:
+ case 1262:
+ case 1263:
+ case 1264:
+ case 1265:
+ case 1266:
+ case 1267:
+ case 1268:
+ case 1269:
+ case 1270:
+ case 1271:
+ case 1272:
+ case 1273:
+ case 1274:
+ case 1275:
+ case 1276:
+ case 1277:
+ case 1278:
+ case 1279:
+ case 1280:
+ case 1281:
+ case 1282:
+ case 1283:
+ case 1284:
+ case 1285:
+ case 1286:
+ case 1287:
+ case 1288:
+ case 1289:
+ case 1290:
+ case 1291:
+ case 1292:
+ case 1293:
+ case 1294:
+ case 1295:
+ case 1296:
+ case 1297:
+ case 1298:
+ case 1299:
+ case 1300:
+ case 1301:
+ case 1302:
+ case 1303:
+ case 1304:
+ case 1305:
+ case 1306:
+ case 1307:
+ case 1308:
+ case 1309:
+ case 1310:
+ case 1311:
+ case 1312:
+ case 1313:
+ case 1314:
+ case 1315:
+ case 1316:
+ case 1317:
+ case 1318:
+ case 1319:
+ case 1320:
+ case 1321:
+ case 1322:
+ case 1323:
+ case 1324:
+ case 1325:
+ case 1326:
+ case 1327:
+ case 1328:
+ case 1329:
+ case 1330:
+ case 1331:
+ case 1332:
+ case 1333:
+ case 1334:
+ case 1335:
+ case 1336:
+ case 1337:
+ case 1338:
+ case 1339:
+ case 1340:
+ case 1341:
+ case 1342:
+ case 1343:
+ case 1344:
+ case 1345:
+ case 1346:
+ case 1347:
+ case 1348:
+ case 1349:
+ case 1350:
+ case 1351:
+ case 1352:
+ case 1353:
+ case 1354:
+ case 1355:
+ case 1356:
+ case 1357:
+ case 1358:
+ case 1359:
+ case 1360:
+ case 1361:
+ case 1362:
+ case 1363:
+ case 1364:
+ case 1365:
+ case 1366:
+ case 1367:
+ case 1368:
+ case 1369:
+ case 1370:
+ case 1371:
+ case 1372:
+ case 1373:
+ case 1374:
+ case 1375:
+ case 1376:
+ case 1377:
+ case 1378:
+ case 1379:
+ case 1380:
+ case 1381:
+ case 1382:
+ case 1383:
+ case 1384:
+ case 1385:
+ case 1386:
+ case 1387:
+ case 1388:
+ case 1389:
+ case 1390:
+ case 1391:
+ case 1392:
+ case 1393:
+ case 1394:
+ case 1395:
+ case 1396:
+ case 1397:
+ case 1398:
+ case 1399:
+ case 1400:
+ case 1401:
+ case 1402:
+ case 1403:
+ case 1404:
+ case 1405:
+ case 1406:
+ case 1407:
+ case 1408:
+ case 1409:
+ case 1410:
+ case 1411:
+ case 1412:
+ case 1413:
+ case 1414:
+ case 1415:
+ case 1416:
+ case 1417:
+ case 1418:
+ case 1419:
+ case 1420:
+ case 1421:
+ case 1422:
+ case 1423:
+ case 1424:
+ case 1425:
+ case 1426:
+ case 1427:
+ case 1428:
+ case 1429:
+ case 1430:
+ case 1431:
+ case 1432:
+ case 1433:
+ case 1434:
+ case 1435:
+ case 1436:
+ case 1437:
+ case 1438:
+ case 1439:
+ case 1440:
+ case 1441:
+ case 1442:
+ case 1443:
+ case 1444:
+ case 1445:
+ case 1446:
+ case 1447:
+ case 1448:
+ case 1449:
+ case 1450:
+ case 1451:
+ case 1452:
+ case 1453:
+ case 1454:
+ case 1455:
+ case 1456:
+ case 1457:
+ case 1458:
+ case 1459:
+ case 1460:
+ case 1461:
+ case 1462:
+ case 1463:
+ case 1464:
+ case 1465:
+ case 1466:
+ case 1467:
+ case 1468:
+ case 1469:
+ case 1470:
+ case 1471:
+ case 1472:
+ case 1473:
+ case 1474:
+ case 1475:
+ case 1476:
+ case 1477:
+ case 1478:
+ case 1479:
+ case 1480:
+ case 1481:
+ case 1482:
+ case 1483:
+ case 1484:
+ case 1485:
+ case 1486:
+ case 1487:
+ case 1488:
+ case 1489:
+ case 1490:
+ case 1491:
+ case 1492:
+ case 1493:
+ case 1494:
+ case 1495:
+ case 1496:
+ case 1497:
+ case 1498:
+ case 1499:
+ case 1500:
+ case 1501:
+ case 1502:
+ case 1503:
+ case 1504:
+ case 1505:
+ case 1506:
+ case 1507:
+ case 1508:
+ case 1509:
+ case 1510:
+ case 1511:
+ case 1512:
+ case 1513:
+ case 1514:
+ case 1515:
+ case 1516:
+ case 1517:
+ case 1518:
+ case 1519:
+ case 1520:
+ case 1521:
+ case 1522:
+ case 1523:
+ case 1524:
+ case 1525:
+ case 1526:
+ case 1527:
+ case 1528:
+ case 1529:
+ case 1530:
+ case 1531:
+ case 1532:
+ case 1533:
+ case 1534:
+ case 1535:
+ case 1536:
+ case 1537:
+ case 1538:
+ case 1539:
+ case 1540:
+ case 1541:
+ case 1542:
+ case 1543:
+ case 1544:
+ case 1545:
+ case 1546:
+ case 1547:
+ case 1548:
+ case 1549:
+ case 1550:
+ case 1551:
+ case 1552:
+ case 1553:
+ case 1554:
+ case 1555:
+ case 1556:
+ case 1557:
+ case 1558:
+ case 1559:
+ case 1560:
+ case 1561:
+ case 1562:
+ case 1563:
+ case 1564:
+ case 1565:
+ case 1566:
+ case 1567:
+ case 1568:
+ case 1569:
+ case 1570:
+ case 1571:
+ case 1572:
+ case 1573:
+ case 1574:
+ case 1575:
+ case 1576:
+ case 1577:
+ case 1578:
+ case 1579:
+ case 1580:
+ case 1581:
+ case 1582:
+ case 1583:
+ case 1584:
+ case 1585:
+ case 1586:
+ case 1587:
+ case 1588:
+ case 1589:
+ case 1590:
+ case 1591:
+ case 1592:
+ case 1593:
+ case 1594:
+ case 1595:
+ case 1596:
+ case 1597:
+ case 1598:
+ case 1599:
+ case 1600:
+ case 1601:
+ case 1602:
+ case 1603:
+ case 1604:
+ case 1605:
+ case 1606:
+ case 1607:
+ case 1608:
+ case 1609:
+ case 1610:
+ case 1611:
+ case 1612:
+ case 1613:
+ case 1614:
+ case 1615:
+ case 1616:
+ case 1617:
+ case 1618:
+ case 1619:
+ case 1620:
+ case 1621:
+ case 1622:
+ case 1623:
+ case 1624:
+ case 1625:
+ case 1626:
+ case 1627:
+ case 1628:
+ case 1629:
+ case 1630:
+ case 1631:
+ case 1632:
+ case 1633:
+ case 1634:
+ case 1635:
+ case 1636:
+ case 1637:
+ case 1638:
+ case 1639:
+ case 1640:
+ case 1641:
+ case 1642:
+ case 1643:
+ case 1644:
+ case 1645:
+ case 1646:
+ case 1647:
+ case 1648:
+ case 1649:
+ case 1650:
+ case 1651:
+ case 1652:
+ case 1653:
+ case 1654:
+ case 1655:
+ case 1656:
+ case 1657:
+ case 1658:
+ case 1659:
+ case 1660:
+ case 1661:
+ case 1662:
+ case 1663:
+ case 1664:
+ case 1665:
+ case 1666:
+ case 1667:
+ case 1668:
+ case 1669:
+ case 1670:
+ case 1671:
+ case 1672:
+ case 1673:
+ case 1674:
+ case 1675:
+ case 1676:
+ case 1677:
+ case 1678:
+ case 1679:
+ case 1680:
+ case 1681:
+ case 1682:
+ case 1683:
+ case 1684:
+ case 1685:
+ case 1686:
+ case 1687:
+ case 1688:
+ case 1689:
+ case 1690:
+ case 1691:
+ case 1692:
+ case 1693:
+ case 1694:
+ case 1695:
+ case 1696:
+ case 1697:
+ case 1698:
+ case 1699:
+ case 1700:
+ case 1701:
+ case 1702:
+ case 1703:
+ case 1704:
+ case 1705:
+ case 1706:
+ case 1707:
+ case 1708:
+ case 1709:
+ case 1710:
+ case 1711:
+ case 1712:
+ case 1713:
+ case 1714:
+ case 1715:
+ case 1716:
+ case 1717:
+ case 1718:
+ case 1719:
+ case 1720:
+ case 1721:
+ case 1722:
+ case 1723:
+ case 1724:
+ case 1725:
+ case 1726:
+ case 1727:
+ case 1728:
+ case 1729:
+ case 1730:
+ case 1731:
+ case 1732:
+ case 1733:
+ case 1734:
+ case 1735:
+ case 1736:
+ case 1737:
+ case 1738:
+ case 1739:
+ case 1740:
+ case 1741:
+ case 1742:
+ case 1743:
+ case 1744:
+ case 1745:
+ case 1746:
+ case 1747:
+ case 1748:
+ case 1749:
+ case 1750:
+ case 1751:
+ case 1752:
+ case 1753:
+ case 1754:
+ case 1755:
+ case 1756:
+ case 1757:
+ case 1758:
+ case 1759:
+ case 1760:
+ case 1761:
+ case 1762:
+ case 1763:
+ case 1764:
+ case 1765:
+ case 1766:
+ case 1767:
+ case 1768:
+ case 1769:
+ case 1770:
+ case 1771:
+ case 1772:
+ case 1773:
+ case 1774:
+ case 1775:
+ case 1776:
+ case 1777:
+ case 1778:
+ case 1779:
+ case 1780:
+ case 1781:
+ case 1782:
+ case 1783:
+ case 1784:
+ case 1785:
+ case 1786:
+ case 1787:
+ case 1788:
+ case 1789:
+ case 1790:
+ case 1791:
+ case 1792:
+ case 1793:
+ case 1794:
+ case 1795:
+ case 1796:
+ case 1797:
+ case 1798:
+ case 1799:
+ case 1800:
+ case 1801:
+ case 1802:
+ case 1803:
+ case 1804:
+ case 1805:
+ case 1806:
+ case 1807:
+ case 1808:
+ case 1809:
+ case 1810:
+ case 1811:
+ case 1812:
+ case 1813:
+ case 1814:
+ case 1815:
+ case 1816:
+ case 1817:
+ case 1818:
+ case 1819:
+ case 1820:
+ case 1821:
+ case 1822:
+ case 1823:
+ case 1824:
+ case 1825:
+ case 1826:
+ case 1827:
+ case 1828:
+ case 1829:
+ case 1830:
+ case 1831:
+ case 1832:
+ case 1833:
+ case 1834:
+ case 1835:
+ case 1836:
+ case 1837:
+ case 1838:
+ case 1839:
+ case 1840:
+ case 1841:
+ case 1842:
+ case 1843:
+ case 1844:
+ case 1845:
+ case 1846:
+ case 1847:
+ case 1848:
+ case 1849:
+ case 1850:
+ case 1851:
+ case 1852:
+ case 1853:
+ case 1854:
+ case 1855:
+ case 1856:
+ case 1857:
+ case 1858:
+ case 1859:
+ case 1860:
+ case 1861:
+ case 1862:
+ case 1863:
+ case 1864:
+ case 1865:
+ case 1866:
+ case 1867:
+ case 1868:
+ case 1869:
+ case 1870:
+ case 1871:
+ case 1872:
+ case 1873:
+ case 1874:
+ case 1875:
+ case 1876:
+ case 1877:
+ case 1878:
+ case 1879:
+ case 1880:
+ case 1881:
+ case 1882:
+ case 1883:
+ case 1884:
+ case 1885:
+ case 1886:
+ case 1887:
+ case 1888:
+ case 1889:
+ case 1890:
+ case 1891:
+ case 1892:
+ case 1893:
+ case 1894:
+ case 1895:
+ case 1896:
+ case 1897:
+ case 1898:
+ case 1899:
+ case 1900:
+ case 1901:
+ case 1902:
+ case 1903:
+ case 1904:
+ case 1905:
+ case 1906:
+ case 1907:
+ case 1908:
+ case 1909:
+ case 1910:
+ case 1911:
+ case 1912:
+ case 1913:
+ case 1914:
+ case 1915:
+ case 1916:
+ case 1917:
+ case 1918:
+ case 1919:
+ case 1920:
+ case 1921:
+ case 1922:
+ case 1923:
+ case 1924:
+ case 1925:
+ case 1926:
+ case 1927:
+ case 1928:
+ case 1929:
+ case 1930:
+ case 1931:
+ case 1932:
+ case 1933:
+ case 1934:
+ case 1935:
+ case 1936:
+ case 1937:
+ case 1938:
+ case 1939:
+ case 1940:
+ case 1941:
+ case 1942:
+ case 1943:
+ case 1944:
+ case 1945:
+ case 1946:
+ case 1947:
+ case 1948:
+ case 1949:
+ case 1950:
+ case 1951:
+ case 1952:
+ case 1953:
+ case 1954:
+ case 1955:
+ case 1956:
+ case 1957:
+ case 1958:
+ case 1959:
+ case 1960:
+ case 1961:
+ case 1962:
+ case 1963:
+ case 1964:
+ case 1965:
+ case 1966:
+ case 1967:
+ case 1968:
+ case 1969:
+ case 1970:
+ case 1971:
+ case 1972:
+ case 1973:
+ case 1974:
+ case 1975:
+ case 1976:
+ case 1977:
+ case 1978:
+ case 1979:
+ case 1980:
+ case 1981:
+ case 1982:
+ case 1983:
+ case 1984:
+ case 1985:
+ case 1986:
+ case 1987:
+ case 1988:
+ case 1989:
+ case 1990:
+ case 1991:
+ case 1992:
+ case 1993:
+ case 1994:
+ case 1995:
+ case 1996:
+ case 1997:
+ case 1998:
+ case 1999:
+ case 2000:
+ case 2001:
+ case 2002:
+ case 2003:
+ case 2004:
+ case 2005:
+ case 2006:
+ case 2007:
+ case 2008:
+ case 2009:
+ case 2010:
+ case 2011:
+ case 2012:
+ case 2013:
+ case 2014:
+ case 2015:
+ case 2016:
+ case 2017:
+ case 2018:
+ case 2019:
+ case 2020:
+ case 2021:
+ case 2022:
+ case 2023:
+ case 2024:
+ case 2025:
+ case 2026:
+ case 2027:
+ case 2028:
+ case 2029:
+ case 2030:
+ case 2031:
+ case 2032:
+ case 2033:
+ case 2034:
+ case 2035:
+ case 2036:
+ case 2037:
+ case 2038:
+ case 2039:
+ case 2040:
+ case 2041:
+ case 2042:
+ case 2043:
+ case 2044:
+ case 2045:
+ case 2046:
+ case 2047:
+ case 2048:
+ case 2049:
+ case 2050:
+ case 2051:
+ case 2052:
+ case 2053:
+ case 2054:
+ case 2055:
+ case 2056:
+ case 2057:
+ case 2058:
+ case 2059:
+ case 2060:
+ case 2061:
+ case 2062:
+ case 2063:
+ case 2064:
+ case 2065:
+ case 2066:
+ case 2067:
+ case 2068:
+ case 2069:
+ case 2070:
+ case 2071:
+ case 2072:
+ case 2073:
+ case 2074:
+ case 2075:
+ case 2076:
+ case 2077:
+ case 2078:
+ case 2079:
+ case 2080:
+ case 2081:
+ case 2082:
+ case 2083:
+ case 2084:
+ case 2085:
+ case 2086:
+ case 2087:
+ case 2088:
+ case 2089:
+ case 2090:
+ case 2091:
+ case 2092:
+ case 2093:
+ case 2094:
+ case 2095:
+ case 2096:
+ case 2097:
+ case 2098:
+ case 2099:
+ case 2100:
+ case 2101:
+ case 2102:
+ case 2103:
+ case 2104:
+ case 2105:
+ case 2106:
+ case 2107:
+ case 2108:
+ case 2109:
+ case 2110:
+ case 2111:
+ case 2112:
+ case 2113:
+ case 2114:
+ case 2115:
+ case 2116:
+ case 2117:
+ case 2118:
+ case 2119:
+ case 2120:
+ case 2121:
+ case 2122:
+ case 2123:
+ case 2124:
+ case 2125:
+ case 2126:
+ case 2127:
+ case 2128:
+ case 2129:
+ case 2130:
+ case 2131:
+ case 2132:
+ case 2133:
+ case 2134:
+ case 2135:
+ case 2136:
+ case 2137:
+ case 2138:
+ case 2139:
+ case 2140:
+ case 2141:
+ case 2142:
+ case 2143:
+ case 2144:
+ case 2145:
+ case 2146:
+ case 2147:
+ case 2148:
+ case 2149:
+ case 2150:
+ case 2151:
+ case 2152:
+ case 2153:
+ case 2154:
+ case 2155:
+ case 2156:
+ case 2157:
+ case 2158:
+ case 2159:
+ case 2160:
+ case 2161:
+ case 2162:
+ case 2163:
+ case 2164:
+ case 2165:
+ case 2166:
+ case 2167:
+ case 2168:
+ case 2169:
+ case 2170:
+ case 2171:
+ case 2172:
+ case 2173:
+ case 2174:
+ case 2175:
+ case 2176:
+ case 2177:
+ case 2178:
+ case 2179:
+ case 2180:
+ case 2181:
+ case 2182:
+ case 2183:
+ case 2184:
+ case 2185:
+ case 2186:
+ case 2187:
+ case 2188:
+ case 2189:
+ case 2190:
+ case 2191:
+ case 2192:
+ case 2193:
+ case 2194:
+ case 2195:
+ case 2196:
+ case 2197:
+ case 2198:
+ case 2199:
+ case 2200:
+ case 2201:
+ case 2202:
+ case 2203:
+ case 2204:
+ case 2205:
+ case 2206:
+ case 2207:
+ case 2208:
+ case 2209:
+ case 2210:
+ case 2211:
+ case 2212:
+ case 2213:
+ case 2214:
+ case 2215:
+ case 2216:
+ case 2217:
+ case 2218:
+ case 2219:
+ case 2220:
+ case 2221:
+ case 2222:
+ case 2223:
+ case 2224:
+ case 2225:
+ case 2226:
+ case 2227:
+ case 2228:
+ case 2229:
+ case 2230:
+ case 2231:
+ case 2232:
+ case 2233:
+ case 2234:
+ case 2235:
+ case 2236:
+ case 2237:
+ case 2238:
+ case 2239:
+ case 2240:
+ case 2241:
+ case 2242:
+ case 2243:
+ case 2244:
+ case 2245:
+ case 2246:
+ case 2247:
+ case 2248:
+ case 2249:
+ case 2250:
+ case 2251:
+ case 2252:
+ case 2253:
+ case 2254:
+ case 2255:
+ case 2256:
+ case 2257:
+ case 2258:
+ case 2259:
+ case 2260:
+ case 2261:
+ case 2262:
+ case 2263:
+ case 2264:
+ case 2265:
+ case 2266:
+ case 2267:
+ case 2268:
+ case 2269:
+ case 2270:
+ case 2271:
+ case 2272:
+ case 2273:
+ case 2274:
+ case 2275:
+ case 2276:
+ case 2277:
+ case 2278:
+ case 2279:
+ case 2280:
+ case 2281:
+ case 2282:
+ case 2283:
+ case 2284:
+ case 2285:
+ case 2286:
+ case 2287:
+ case 2288:
+ case 2289:
+ case 2290:
+ case 2291:
+ case 2292:
+ case 2293:
+ case 2294:
+ case 2295:
+ case 2296:
+ case 2297:
+ case 2298:
+ case 2299:
+ case 2300:
+ case 2301:
+ case 2302:
+ case 2303:
+ case 2304:
+ case 2305:
+ case 2306:
+ case 2307:
+ case 2308:
+ case 2309:
+ case 2310:
+ case 2311:
+ case 2312:
+ case 2313:
+ case 2314:
+ case 2315:
+ case 2316:
+ case 2317:
+ case 2318:
+ case 2319:
+ case 2320:
+ case 2321:
+ case 2322:
+ case 2323:
+ case 2324:
+ case 2325:
+ case 2326:
+ case 2327:
+ case 2328:
+ case 2329:
+ case 2330:
+ case 2331:
+ case 2332:
+ case 2333:
+ case 2334:
+ case 2335:
+ case 2336:
+ case 2337:
+ case 2338:
+ case 2339:
+ case 2340:
+ case 2341:
+ case 2342:
+ case 2343:
+ case 2344:
+ case 2345:
+ case 2346:
+ case 2347:
+ case 2348:
+ case 2349:
+ case 2350:
+ case 2351:
+ case 2352:
+ case 2353:
+ case 2354:
+ case 2355:
+ case 2356:
+ case 2357:
+ case 2358:
+ case 2359:
+ case 2360:
+ case 2361:
+ case 2362:
+ case 2363:
+ case 2364:
+ case 2365:
+ case 2366:
+ case 2367:
+ case 2368:
+ case 2369:
+ case 2370:
+ case 2371:
+ case 2372:
+ case 2373:
+ case 2374:
+ case 2375:
+ case 2376:
+ case 2377:
+ case 2378:
+ case 2379:
+ case 2380:
+ case 2381:
+ case 2382:
+ case 2383:
+ case 2384:
+ case 2385:
+ case 2386:
+ case 2387:
+ case 2388:
+ case 2389:
+ case 2390:
+ case 2391:
+ case 2392:
+ case 2393:
+ case 2394:
+ case 2395:
+ case 2396:
+ case 2397:
+ case 2398:
+ case 2399:
+ case 2400:
+ case 2401:
+ case 2402:
+ case 2403:
+ case 2404:
+ case 2405:
+ case 2406:
+ case 2407:
+ case 2408:
+ case 2409:
+ case 2410:
+ case 2411:
+ case 2412:
+ case 2413:
+ case 2414:
+ case 2415:
+ case 2416:
+ case 2417:
+ case 2418:
+ case 2419:
+ case 2420:
+ case 2421:
+ case 2422:
+ case 2423:
+ case 2424:
+ case 2425:
+ case 2426:
+ case 2427:
+ case 2428:
+ case 2429:
+ case 2430:
+ case 2431:
+ case 2432:
+ case 2433:
+ case 2434:
+ case 2435:
+ case 2436:
+ case 2437:
+ case 2438:
+ case 2439:
+ case 2440:
+ case 2441:
+ case 2442:
+ case 2443:
+ case 2444:
+ case 2445:
+ case 2446:
+ case 2447:
+ case 2448:
+ case 2449:
+ case 2450:
+ case 2451:
+ case 2452:
+ case 2453:
+ case 2454:
+ case 2455:
+ case 2456:
+ case 2457:
+ case 2458:
+ case 2459:
+ case 2460:
+ case 2461:
+ case 2462:
+ case 2463:
+ case 2464:
+ case 2465:
+ case 2466:
+ case 2467:
+ case 2468:
+ case 2469:
+ case 2470:
+ case 2471:
+ case 2472:
+ case 2473:
+ case 2474:
+ case 2475:
+ case 2476:
+ case 2477:
+ case 2478:
+ case 2479:
+ case 2480:
+ case 2481:
+ case 2482:
+ case 2483:
+ case 2484:
+ case 2485:
+ case 2486:
+ case 2487:
+ case 2488:
+ case 2489:
+ case 2490:
+ case 2491:
+ case 2492:
+ case 2493:
+ case 2494:
+ case 2495:
+ case 2496:
+ case 2497:
+ case 2498:
+ case 2499:
+ case 2500:
+ case 2501:
+ case 2502:
+ case 2503:
+ case 2504:
+ case 2505:
+ case 2506:
+ case 2507:
+ case 2508:
+ case 2509:
+ case 2510:
+ case 2511:
+ case 2512:
+ case 2513:
+ case 2514:
+ case 2515:
+ case 2516:
+ case 2517:
+ case 2518:
+ case 2519:
+ case 2520:
+ case 2521:
+ case 2522:
+ case 2523:
+ case 2524:
+ case 2525:
+ case 2526:
+ case 2527:
+ case 2528:
+ case 2529:
+ case 2530:
+ case 2531:
+ case 2532:
+ case 2533:
+ case 2534:
+ case 2535:
+ case 2536:
+ case 2537:
+ case 2538:
+ case 2539:
+ case 2540:
+ case 2541:
+ case 2542:
+ case 2543:
+ case 2544:
+ case 2545:
+ case 2546:
+ case 2547:
+ case 2548:
+ case 2549:
+ case 2550:
+ case 2551:
+ case 2552:
+ case 2553:
+ case 2554:
+ case 2555:
+ case 2556:
+ case 2557:
+ case 2558:
+ case 2559:
+ case 2560:
+ case 2561:
+ case 2562:
+ case 2563:
+ case 2564:
+ case 2565:
+ case 2566:
+ case 2567:
+ case 2568:
+ case 2569:
+ case 2570:
+ case 2571:
+ case 2572:
+ case 2573:
+ case 2574:
+ case 2575:
+ case 2576:
+ case 2577:
+ case 2578:
+ case 2579:
+ case 2580:
+ case 2581:
+ case 2582:
+ case 2583:
+ case 2584:
+ case 2585:
+ case 2586:
+ case 2587:
+ case 2588:
+ case 2589:
+ case 2590:
+ case 2591:
+ case 2592:
+ case 2593:
+ case 2594:
+ case 2595:
+ case 2596:
+ case 2597:
+ case 2598:
+ case 2599:
+ case 2600:
+ case 2601:
+ case 2602:
+ case 2603:
+ case 2604:
+ case 2605:
+ case 2606:
+ case 2607:
+ case 2608:
+ case 2609:
+ case 2610:
+ case 2611:
+ case 2612:
+ case 2613:
+ case 2614:
+ case 2615:
+ case 2616:
+ case 2617:
+ case 2618:
+ case 2619:
+ case 2620:
+ case 2621:
+ case 2622:
+ case 2623:
+ case 2624:
+ case 2625:
+ case 2626:
+ case 2627:
+ case 2628:
+ case 2629:
+ case 2630:
+ case 2631:
+ case 2632:
+ case 2633:
+ case 2634:
+ case 2635:
+ case 2636:
+ case 2637:
+ case 2638:
+ case 2639:
+ case 2640:
+ case 2641:
+ case 2642:
+ case 2643:
+ case 2644:
+ case 2645:
+ case 2646:
+ case 2647:
+ case 2648:
+ case 2649:
+ case 2650:
+ case 2651:
+ case 2652:
+ case 2653:
+ case 2654:
+ case 2655:
+ case 2656:
+ case 2657:
+ case 2658:
+ case 2659:
+ case 2660:
+ case 2661:
+ case 2662:
+ case 2663:
+ case 2664:
+ case 2665:
+ case 2666:
+ case 2667:
+ case 2668:
+ case 2669:
+ case 2670:
+ case 2671:
+ case 2672:
+ case 2673:
+ case 2674:
+ case 2675:
+ case 2676:
+ case 2677:
+ case 2678:
+ case 2679:
+ case 2680:
+ case 2681:
+ case 2682:
+ case 2683:
+ case 2684:
+ case 2685:
+ case 2686:
+ case 2687:
+ case 2688:
+ case 2689:
+ case 2690:
+ case 2691:
+ case 2692:
+ case 2693:
+ case 2694:
+ case 2695:
+ case 2696:
+ case 2697:
+ case 2698:
+ case 2699:
+ case 2700:
+ case 2701:
+ case 2702:
+ case 2703:
+ case 2704:
+ case 2705:
+ case 2706:
+ case 2707:
+ case 2708:
+ case 2709:
+ case 2710:
+ case 2711:
+ case 2712:
+ case 2713:
+ case 2714:
+ case 2715:
+ case 2716:
+ case 2717:
+ case 2718:
+ case 2719:
+ case 2720:
+ case 2721:
+ case 2722:
+ case 2723:
+ case 2724:
+ case 2725:
+ case 2726:
+ case 2727:
+ case 2728:
+ case 2729:
+ case 2730:
+ case 2731:
+ case 2732:
+ case 2733:
+ case 2734:
+ case 2735:
+ case 2736:
+ case 2737:
+ case 2738:
+ case 2739:
+ case 2740:
+ case 2741:
+ case 2742:
+ case 2743:
+ case 2744:
+ case 2745:
+ case 2746:
+ case 2747:
+ case 2748:
+ case 2749:
+ case 2750:
+ case 2751:
+ case 2752:
+ case 2753:
+ case 2754:
+ case 2755:
+ case 2756:
+ case 2757:
+ case 2758:
+ case 2759:
+ case 2760:
+ case 2761:
+ case 2762:
+ case 2763:
+ case 2764:
+ case 2765:
+ case 2766:
+ case 2767:
+ case 2768:
+ case 2769:
+ case 2770:
+ case 2771:
+ case 2772:
+ case 2773:
+ case 2774:
+ case 2775:
+ case 2776:
+ case 2777:
+ case 2778:
+ case 2779:
+ case 2780:
+ case 2781:
+ case 2782:
+ case 2783:
+ case 2784:
+ case 2785:
+ case 2786:
+ case 2787:
+ case 2788:
+ case 2789:
+ case 2790:
+ case 2791:
+ case 2792:
+ case 2793:
+ case 2794:
+ case 2795:
+ case 2796:
+ case 2797:
+ case 2798:
+ case 2799:
+ case 2800:
+ case 2801:
+ case 2802:
+ case 2803:
+ case 2804:
+ case 2805:
+ case 2806:
+ case 2807:
+ case 2808:
+ case 2809:
+ case 2810:
+ case 2811:
+ case 2812:
+ case 2813:
+ case 2814:
+ case 2815:
+ case 2816:
+ case 2817:
+ case 2818:
+ case 2819:
+ case 2820:
+ case 2821:
+ case 2822:
+ case 2823:
+ case 2824:
+ case 2825:
+ case 2826:
+ case 2827:
+ case 2828:
+ case 2829:
+ case 2830:
+ case 2831:
+ case 2832:
+ case 2833:
+ case 2834:
+ case 2835:
+ case 2836:
+ case 2837:
+ case 2838:
+ case 2839:
+ case 2840:
+ case 2841:
+ case 2842:
+ case 2843:
+ case 2844:
+ case 2845:
+ case 2846:
+ case 2847:
+ case 2848:
+ case 2849:
+ case 2850:
+ case 2851:
+ case 2852:
+ case 2853:
+ case 2854:
+ case 2855:
+ case 2856:
+ case 2857:
+ case 2858:
+ case 2859:
+ case 2860:
+ case 2861:
+ case 2862:
+ case 2863:
+ case 2864:
+ case 2865:
+ case 2866:
+ case 2867:
+ case 2868:
+ case 2869:
+ case 2870:
+ case 2871:
+ case 2872:
+ case 2873:
+ case 2874:
+ case 2875:
+ case 2876:
+ case 2877:
+ case 2878:
+ case 2879:
+ case 2880:
+ case 2881:
+ case 2882:
+ case 2883:
+ case 2884:
+ case 2885:
+ case 2886:
+ case 2887:
+ case 2888:
+ case 2889:
+ case 2890:
+ case 2891:
+ case 2892:
+ case 2893:
+ case 2894:
+ case 2895:
+ case 2896:
+ case 2897:
+ case 2898:
+ case 2899:
+ case 2900:
+ case 2901:
+ case 2902:
+ case 2903:
+ case 2904:
+ case 2905:
+ case 2906:
+ case 2907:
+ case 2908:
+ case 2909:
+ case 2910:
+ case 2911:
+ case 2912:
+ case 2913:
+ case 2914:
+ case 2915:
+ case 2916:
+ case 2917:
+ case 2918:
+ case 2919:
+ case 2920:
+ case 2921:
+ case 2922:
+ case 2923:
+ case 2924:
+ case 2925:
+ case 2926:
+ case 2927:
+ case 2928:
+ case 2929:
+ case 2930:
+ case 2931:
+ case 2932:
+ case 2933:
+ case 2934:
+ case 2935:
+ case 2936:
+ case 2937:
+ case 2938:
+ case 2939:
+ case 2940:
+ case 2941:
+ case 2942:
+ case 2943:
+ case 2944:
+ case 2945:
+ case 2946:
+ case 2947:
+ case 2948:
+ case 2949:
+ case 2950:
+ case 2951:
+ case 2952:
+ case 2953:
+ case 2954:
+ case 2955:
+ case 2956:
+ case 2957:
+ case 2958:
+ case 2959:
+ case 2960:
+ case 2961:
+ case 2962:
+ case 2963:
+ case 2964:
+ case 2965:
+ case 2966:
+ case 2967:
+ case 2968:
+ case 2969:
+ case 2970:
+ case 2971:
+ case 2972:
+ case 2973:
+ case 2974:
+ case 2975:
+ case 2976:
+ case 2977:
+ case 2978:
+ case 2979:
+ case 2980:
+ case 2981:
+ case 2982:
+ case 2983:
+ case 2984:
+ case 2985:
+ case 2986:
+ case 2987:
+ case 2988:
+ case 2989:
+ case 2990:
+ case 2991:
+ case 2992:
+ case 2993:
+ case 2994:
+ case 2995:
+ case 2996:
+ case 2997:
+ case 2998:
+ case 2999:
+ case 3000:
+ case 3001:
+ case 3002:
+ case 3003:
+ case 3004:
+ case 3005:
+ case 3006:
+ case 3007:
+ case 3008:
+ case 3009:
+ case 3010:
+ case 3011:
+ case 3012:
+ case 3013:
+ case 3014:
+ case 3015:
+ case 3016:
+ case 3017:
+ case 3018:
+ case 3019:
+ case 3020:
+ case 3021:
+ case 3022:
+ case 3023:
+ case 3024:
+ case 3025:
+ case 3026:
+ case 3027:
+ case 3028:
+ case 3029:
+ case 3030:
+ case 3031:
+ case 3032:
+ case 3033:
+ case 3034:
+ case 3035:
+ case 3036:
+ case 3037:
+ case 3038:
+ case 3039:
+ case 3040:
+ case 3041:
+ case 3042:
+ case 3043:
+ case 3044:
+ case 3045:
+ case 3046:
+ case 3047:
+ case 3048:
+ case 3049:
+ case 3050:
+ case 3051:
+ case 3052:
+ case 3053:
+ case 3054:
+ case 3055:
+ case 3056:
+ case 3057:
+ case 3058:
+ case 3059:
+ case 3060:
+ case 3061:
+ case 3062:
+ case 3063:
+ case 3064:
+ case 3065:
+ case 3066:
+ case 3067:
+ case 3068:
+ case 3069:
+ case 3070:
+ case 3071:
+ case 3072:
+ case 3073:
+ case 3074:
+ case 3075:
+ case 3076:
+ case 3077:
+ case 3078:
+ case 3079:
+ case 3080:
+ case 3081:
+ case 3082:
+ case 3083:
+ case 3084:
+ case 3085:
+ case 3086:
+ case 3087:
+ case 3088:
+ case 3089:
+ case 3090:
+ case 3091:
+ case 3092:
+ case 3093:
+ case 3094:
+ case 3095:
+ case 3096:
+ case 3097:
+ case 3098:
+ case 3099:
+ case 3100:
+ case 3101:
+ case 3102:
+ case 3103:
+ case 3104:
+ case 3105:
+ case 3106:
+ case 3107:
+ case 3108:
+ case 3109:
+ case 3110:
+ case 3111:
+ case 3112:
+ case 3113:
+ case 3114:
+ case 3115:
+ case 3116:
+ case 3117:
+ case 3118:
+ case 3119:
+ case 3120:
+ case 3121:
+ case 3122:
+ case 3123:
+ case 3124:
+ case 3125:
+ case 3126:
+ case 3127:
+ case 3128:
+ case 3129:
+ case 3130:
+ case 3131:
+ case 3132:
+ case 3133:
+ case 3134:
+ case 3135:
+ case 3136:
+ case 3137:
+ case 3138:
+ case 3139:
+ case 3140:
+ case 3141:
+ case 3142:
+ case 3143:
+ case 3144:
+ case 3145:
+ case 3146:
+ case 3147:
+ case 3148:
+ case 3149:
+ case 3150:
+ case 3151:
+ case 3152:
+ case 3153:
+ case 3154:
+ case 3155:
+ case 3156:
+ case 3157:
+ case 3158:
+ case 3159:
+ case 3160:
+ case 3161:
+ case 3162:
+ case 3163:
+ case 3164:
+ case 3165:
+ case 3166:
+ case 3167:
+ case 3168:
+ case 3169:
+ case 3170:
+ case 3171:
+ case 3172:
+ case 3173:
+ case 3174:
+ case 3175:
+ case 3176:
+ case 3177:
+ case 3178:
+ case 3179:
+ case 3180:
+ case 3181:
+ case 3182:
+ case 3183:
+ case 3184:
+ case 3185:
+ case 3186:
+ case 3187:
+ case 3188:
+ case 3189:
+ case 3190:
+ case 3191:
+ case 3192:
+ case 3193:
+ case 3194:
+ case 3195:
+ case 3196:
+ case 3197:
+ case 3198:
+ case 3199:
+ case 3200:
+ case 3201:
+ case 3202:
+ case 3203:
+ case 3204:
+ case 3205:
+ case 3206:
+ case 3207:
+ case 3208:
+ case 3209:
+ case 3210:
+ case 3211:
+ case 3212:
+ case 3213:
+ case 3214:
+ case 3215:
+ case 3216:
+ case 3217:
+ case 3218:
+ case 3219:
+ case 3220:
+ case 3221:
+ case 3222:
+ case 3223:
+ case 3224:
+ case 3225:
+ case 3226:
+ case 3227:
+ case 3228:
+ case 3229:
+ case 3230:
+ case 3231:
+ case 3232:
+ case 3233:
+ case 3234:
+ case 3235:
+ case 3236:
+ case 3237:
+ case 3238:
+ case 3239:
+ case 3240:
+ case 3241:
+ case 3242:
+ case 3243:
+ case 3244:
+ case 3245:
+ case 3246:
+ case 3247:
+ case 3248:
+ case 3249:
+ case 3250:
+ case 3251:
+ case 3252:
+ case 3253:
+ case 3254:
+ case 3255:
+ case 3256:
+ case 3257:
+ case 3258:
+ case 3259:
+ case 3260:
+ case 3261:
+ case 3262:
+ case 3263:
+ case 3264:
+ case 3265:
+ case 3266:
+ case 3267:
+ case 3268:
+ case 3269:
+ case 3270:
+ case 3271:
+ case 3272:
+ case 3273:
+ case 3274:
+ case 3275:
+ case 3276:
+ case 3277:
+ case 3278:
+ case 3279:
+ case 3280:
+ case 3281:
+ case 3282:
+ case 3283:
+ case 3284:
+ case 3285:
+ case 3286:
+ case 3287:
+ case 3288:
+ case 3289:
+ case 3290:
+ case 3291:
+ case 3292:
+ case 3293:
+ case 3294:
+ case 3295:
+ case 3296:
+ case 3297:
+ case 3298:
+ case 3299:
+ case 3300:
+ case 3301:
+ case 3302:
+ case 3303:
+ case 3304:
+ case 3305:
+ case 3306:
+ case 3307:
+ case 3308:
+ case 3309:
+ case 3310:
+ case 3311:
+ case 3312:
+ case 3313:
+ case 3314:
+ case 3315:
+ case 3316:
+ case 3317:
+ case 3318:
+ case 3319:
+ case 3320:
+ case 3321:
+ case 3322:
+ case 3323:
+ case 3324:
+ case 3325:
+ case 3326:
+ case 3327:
+ case 3328:
+ case 3329:
+ case 3330:
+ case 3331:
+ case 3332:
+ case 3333:
+ case 3334:
+ case 3335:
+ case 3336:
+ case 3337:
+ case 3338:
+ case 3339:
+ case 3340:
+ case 3341:
+ case 3342:
+ case 3343:
+ case 3344:
+ case 3345:
+ case 3346:
+ case 3347:
+ case 3348:
+ case 3349:
+ case 3350:
+ case 3351:
+ case 3352:
+ case 3353:
+ case 3354:
+ case 3355:
+ case 3356:
+ case 3357:
+ case 3358:
+ case 3359:
+ case 3360:
+ case 3361:
+ case 3362:
+ case 3363:
+ case 3364:
+ case 3365:
+ case 3366:
+ case 3367:
+ case 3368:
+ case 3369:
+ case 3370:
+ case 3371:
+ case 3372:
+ case 3373:
+ case 3374:
+ case 3375:
+ case 3376:
+ case 3377:
+ case 3378:
+ case 3379:
+ case 3380:
+ case 3381:
+ case 3382:
+ case 3383:
+ case 3384:
+ case 3385:
+ case 3386:
+ case 3387:
+ case 3388:
+ case 3389:
+ case 3390:
+ case 3391:
+ case 3392:
+ case 3393:
+ case 3394:
+ case 3395:
+ case 3396:
+ case 3397:
+ case 3398:
+ case 3399:
+ case 3400:
+ case 3401:
+ case 3402:
+ case 3403:
+ case 3404:
+ case 3405:
+ case 3406:
+ case 3407:
+ case 3408:
+ case 3409:
+ case 3410:
+ case 3411:
+ case 3412:
+ case 3413:
+ case 3414:
+ case 3415:
+ case 3416:
+ case 3417:
+ case 3418:
+ case 3419:
+ case 3420:
+ case 3421:
+ case 3422:
+ case 3423:
+ case 3424:
+ case 3425:
+ case 3426:
+ case 3427:
+ case 3428:
+ case 3429:
+ case 3430:
+ case 3431:
+ case 3432:
+ case 3433:
+ case 3434:
+ case 3435:
+ case 3436:
+ case 3437:
+ case 3438:
+ case 3439:
+ case 3440:
+ case 3441:
+ case 3442:
+ case 3443:
+ case 3444:
+ case 3445:
+ case 3446:
+ case 3447:
+ case 3448:
+ case 3449:
+ case 3450:
+ case 3451:
+ case 3452:
+ case 3453:
+ case 3454:
+ case 3455:
+ case 3456:
+ case 3457:
+ case 3458:
+ case 3459:
+ case 3460:
+ case 3461:
+ case 3462:
+ case 3463:
+ case 3464:
+ case 3465:
+ case 3466:
+ case 3467:
+ case 3468:
+ case 3469:
+ case 3470:
+ case 3471:
+ case 3472:
+ case 3473:
+ case 3474:
+ case 3475:
+ case 3476:
+ case 3477:
+ case 3478:
+ case 3479:
+ case 3480:
+ case 3481:
+ case 3482:
+ case 3483:
+ case 3484:
+ case 3485:
+ case 3486:
+ case 3487:
+ case 3488:
+ case 3489:
+ case 3490:
+ case 3491:
+ case 3492:
+ case 3493:
+ case 3494:
+ case 3495:
+ case 3496:
+ case 3497:
+ case 3498:
+ case 3499:
+ case 3500:
+ case 3501:
+ case 3502:
+ case 3503:
+ case 3504:
+ case 3505:
+ case 3506:
+ case 3507:
+ case 3508:
+ case 3509:
+ case 3510:
+ case 3511:
+ case 3512:
+ case 3513:
+ case 3514:
+ case 3515:
+ case 3516:
+ case 3517:
+ case 3518:
+ case 3519:
+ case 3520:
+ case 3521:
+ case 3522:
+ case 3523:
+ case 3524:
+ case 3525:
+ case 3526:
+ case 3527:
+ case 3528:
+ case 3529:
+ case 3530:
+ case 3531:
+ case 3532:
+ case 3533:
+ case 3534:
+ case 3535:
+ case 3536:
+ case 3537:
+ case 3538:
+ case 3539:
+ case 3540:
+ case 3541:
+ case 3542:
+ case 3543:
+ case 3544:
+ case 3545:
+ case 3546:
+ case 3547:
+ case 3548:
+ case 3549:
+ case 3550:
+ case 3551:
+ case 3552:
+ case 3553:
+ case 3554:
+ case 3555:
+ case 3556:
+ case 3557:
+ case 3558:
+ case 3559:
+ case 3560:
+ case 3561:
+ case 3562:
+ case 3563:
+ case 3564:
+ case 3565:
+ case 3566:
+ case 3567:
+ case 3568:
+ case 3569:
+ case 3570:
+ case 3571:
+ case 3572:
+ case 3573:
+ case 3574:
+ case 3575:
+ case 3576:
+ case 3577:
+ case 3578:
+ case 3579:
+ case 3580:
+ case 3581:
+ case 3582:
+ case 3583:
+ case 3584:
+ case 3585:
+ case 3586:
+ case 3587:
+ case 3588:
+ case 3589:
+ case 3590:
+ case 3591:
+ case 3592:
+ case 3593:
+ case 3594:
+ case 3595:
+ case 3596:
+ case 3597:
+ case 3598:
+ case 3599:
+ case 3600:
+ case 3601:
+ case 3602:
+ case 3603:
+ case 3604:
+ case 3605:
+ case 3606:
+ case 3607:
+ case 3608:
+ case 3609:
+ case 3610:
+ case 3611:
+ case 3612:
+ case 3613:
+ case 3614:
+ case 3615:
+ case 3616:
+ case 3617:
+ case 3618:
+ case 3619:
+ case 3620:
+ case 3621:
+ case 3622:
+ case 3623:
+ case 3624:
+ case 3625:
+ case 3626:
+ case 3627:
+ case 3628:
+ case 3629:
+ case 3630:
+ case 3631:
+ case 3632:
+ case 3633:
+ case 3634:
+ case 3635:
+ case 3636:
+ case 3637:
+ case 3638:
+ case 3639:
+ case 3640:
+ case 3641:
+ case 3642:
+ case 3643:
+ case 3644:
+ case 3645:
+ case 3646:
+ case 3647:
+ case 3648:
+ case 3649:
+ case 3650:
+ case 3651:
+ case 3652:
+ case 3653:
+ case 3654:
+ case 3655:
+ case 3656:
+ case 3657:
+ case 3658:
+ case 3659:
+ case 3660:
+ case 3661:
+ case 3662:
+ case 3663:
+ case 3664:
+ case 3665:
+ case 3666:
+ case 3667:
+ case 3668:
+ case 3669:
+ case 3670:
+ case 3671:
+ case 3672:
+ case 3673:
+ case 3674:
+ case 3675:
+ case 3676:
+ case 3677:
+ case 3678:
+ case 3679:
+ case 3680:
+ case 3681:
+ case 3682:
+ case 3683:
+ case 3684:
+ case 3685:
+ case 3686:
+ case 3687:
+ case 3688:
+ case 3689:
+ case 3690:
+ case 3691:
+ case 3692:
+ case 3693:
+ case 3694:
+ case 3695:
+ case 3696:
+ case 3697:
+ case 3698:
+ case 3699:
+ case 3700:
+ case 3701:
+ case 3702:
+ case 3703:
+ case 3704:
+ case 3705:
+ case 3706:
+ case 3707:
+ case 3708:
+ case 3709:
+ case 3710:
+ case 3711:
+ case 3712:
+ case 3713:
+ case 3714:
+ case 3715:
+ case 3716:
+ case 3717:
+ case 3718:
+ case 3719:
+ case 3720:
+ case 3721:
+ case 3722:
+ case 3723:
+ case 3724:
+ case 3725:
+ case 3726:
+ case 3727:
+ case 3728:
+ case 3729:
+ case 3730:
+ case 3731:
+ case 3732:
+ case 3733:
+ case 3734:
+ case 3735:
+ case 3736:
+ case 3737:
+ case 3738:
+ case 3739:
+ case 3740:
+ case 3741:
+ case 3742:
+ case 3743:
+ case 3744:
+ case 3745:
+ case 3746:
+ case 3747:
+ case 3748:
+ case 3749:
+ case 3750:
+ case 3751:
+ case 3752:
+ case 3753:
+ case 3754:
+ case 3755:
+ case 3756:
+ case 3757:
+ case 3758:
+ case 3759:
+ case 3760:
+ case 3761:
+ case 3762:
+ case 3763:
+ case 3764:
+ case 3765:
+ case 3766:
+ case 3767:
+ case 3768:
+ case 3769:
+ case 3770:
+ case 3771:
+ case 3772:
+ case 3773:
+ case 3774:
+ case 3775:
+ case 3776:
+ case 3777:
+ case 3778:
+ case 3779:
+ case 3780:
+ case 3781:
+ case 3782:
+ case 3783:
+ case 3784:
+ case 3785:
+ case 3786:
+ case 3787:
+ case 3788:
+ case 3789:
+ case 3790:
+ case 3791:
+ case 3792:
+ case 3793:
+ case 3794:
+ case 3795:
+ case 3796:
+ case 3797:
+ case 3798:
+ case 3799:
+ case 3800:
+ case 3801:
+ case 3802:
+ case 3803:
+ case 3804:
+ case 3805:
+ case 3806:
+ case 3807:
+ case 3808:
+ case 3809:
+ case 3810:
+ case 3811:
+ case 3812:
+ case 3813:
+ case 3814:
+ case 3815:
+ case 3816:
+ case 3817:
+ case 3818:
+ case 3819:
+ case 3820:
+ case 3821:
+ case 3822:
+ case 3823:
+ case 3824:
+ case 3825:
+ case 3826:
+ case 3827:
+ case 3828:
+ case 3829:
+ case 3830:
+ case 3831:
+ case 3832:
+ case 3833:
+ case 3834:
+ case 3835:
+ case 3836:
+ case 3837:
+ case 3838:
+ case 3839:
+ case 3840:
+ case 3841:
+ case 3842:
+ case 3843:
+ case 3844:
+ case 3845:
+ case 3846:
+ case 3847:
+ case 3848:
+ case 3849:
+ case 3850:
+ case 3851:
+ case 3852:
+ case 3853:
+ case 3854:
+ case 3855:
+ case 3856:
+ case 3857:
+ case 3858:
+ case 3859:
+ case 3860:
+ case 3861:
+ case 3862:
+ case 3863:
+ case 3864:
+ case 3865:
+ case 3866:
+ case 3867:
+ case 3868:
+ case 3869:
+ case 3870:
+ case 3871:
+ case 3872:
+ case 3873:
+ case 3874:
+ case 3875:
+ case 3876:
+ case 3877:
+ case 3878:
+ case 3879:
+ case 3880:
+ case 3881:
+ case 3882:
+ case 3883:
+ case 3884:
+ case 3885:
+ case 3886:
+ case 3887:
+ case 3888:
+ case 3889:
+ case 3890:
+ case 3891:
+ case 3892:
+ case 3893:
+ case 3894:
+ case 3895:
+ case 3896:
+ case 3897:
+ case 3898:
+ case 3899:
+ case 3900:
+ case 3901:
+ case 3902:
+ case 3903:
+ case 3904:
+ case 3905:
+ case 3906:
+ case 3907:
+ case 3908:
+ case 3909:
+ case 3910:
+ case 3911:
+ case 3912:
+ case 3913:
+ case 3914:
+ case 3915:
+ case 3916:
+ case 3917:
+ case 3918:
+ case 3919:
+ case 3920:
+ case 3921:
+ case 3922:
+ case 3923:
+ case 3924:
+ case 3925:
+ case 3926:
+ case 3927:
+ case 3928:
+ case 3929:
+ case 3930:
+ case 3931:
+ case 3932:
+ case 3933:
+ case 3934:
+ case 3935:
+ case 3936:
+ case 3937:
+ case 3938:
+ case 3939:
+ case 3940:
+ case 3941:
+ case 3942:
+ case 3943:
+ case 3944:
+ case 3945:
+ case 3946:
+ case 3947:
+ case 3948:
+ case 3949:
+ case 3950:
+ case 3951:
+ case 3952:
+ case 3953:
+ case 3954:
+ case 3955:
+ case 3956:
+ case 3957:
+ case 3958:
+ case 3959:
+ case 3960:
+ case 3961:
+ case 3962:
+ case 3963:
+ case 3964:
+ case 3965:
+ case 3966:
+ case 3967:
+ case 3968:
+ case 3969:
+ case 3970:
+ case 3971:
+ case 3972:
+ case 3973:
+ case 3974:
+ case 3975:
+ case 3976:
+ case 3977:
+ case 3978:
+ case 3979:
+ case 3980:
+ case 3981:
+ case 3982:
+ case 3983:
+ case 3984:
+ case 3985:
+ case 3986:
+ case 3987:
+ case 3988:
+ case 3989:
+ case 3990:
+ case 3991:
+ case 3992:
+ case 3993:
+ case 3994:
+ case 3995:
+ case 3996:
+ case 3997:
+ case 3998:
+ case 3999:
+ case 4000:
+ case 4001:
+ case 4002:
+ case 4003:
+ case 4004:
+ case 4005:
+ case 4006:
+ case 4007:
+ case 4008:
+ case 4009:
+ case 4010:
+ case 4011:
+ case 4012:
+ case 4013:
+ case 4014:
+ case 4015:
+ case 4016:
+ case 4017:
+ case 4018:
+ case 4019:
+ case 4020:
+ case 4021:
+ case 4022:
+ case 4023:
+ case 4024:
+ case 4025:
+ case 4026:
+ case 4027:
+ case 4028:
+ case 4029:
+ case 4030:
+ case 4031:
+ case 4032:
+ case 4033:
+ case 4034:
+ case 4035:
+ case 4036:
+ case 4037:
+ case 4038:
+ case 4039:
+ case 4040:
+ case 4041:
+ case 4042:
+ case 4043:
+ case 4044:
+ case 4045:
+ case 4046:
+ case 4047:
+ case 4048:
+ case 4049:
+ case 4050:
+ case 4051:
+ case 4052:
+ case 4053:
+ case 4054:
+ case 4055:
+ case 4056:
+ case 4057:
+ case 4058:
+ case 4059:
+ case 4060:
+ case 4061:
+ case 4062:
+ case 4063:
+ case 4064:
+ case 4065:
+ case 4066:
+ case 4067:
+ case 4068:
+ case 4069:
+ case 4070:
+ case 4071:
+ case 4072:
+ case 4073:
+ case 4074:
+ case 4075:
+ case 4076:
+ case 4077:
+ case 4078:
+ case 4079:
+ case 4080:
+ case 4081:
+ case 4082:
+ case 4083:
+ case 4084:
+ case 4085:
+ case 4086:
+ case 4087:
+ case 4088:
+ case 4089:
+ case 4090:
+ case 4091:
+ case 4092:
+ case 4093:
+ case 4094:
+ case 4095:
+ case 4096:
+ case 4097:
+ case 4098:
+ case 4099:
+ case 4100:
+ case 4101:
+ case 4102:
+ case 4103:
+ case 4104:
+ case 4105:
+ case 4106:
+ case 4107:
+ case 4108:
+ case 4109:
+ case 4110:
+ case 4111:
+ case 4112:
+ case 4113:
+ case 4114:
+ case 4115:
+ case 4116:
+ case 4117:
+ case 4118:
+ case 4119:
+ case 4120:
+ case 4121:
+ case 4122:
+ case 4123:
+ case 4124:
+ case 4125:
+ case 4126:
+ case 4127:
+ case 4128:
+ case 4129:
+ case 4130:
+ case 4131:
+ case 4132:
+ case 4133:
+ case 4134:
+ case 4135:
+ case 4136:
+ case 4137:
+ case 4138:
+ case 4139:
+ case 4140:
+ case 4141:
+ case 4142:
+ case 4143:
+ case 4144:
+ case 4145:
+ case 4146:
+ case 4147:
+ case 4148:
+ case 4149:
+ case 4150:
+ case 4151:
+ case 4152:
+ case 4153:
+ case 4154:
+ case 4155:
+ case 4156:
+ case 4157:
+ case 4158:
+ case 4159:
+ case 4160:
+ case 4161:
+ case 4162:
+ case 4163:
+ case 4164:
+ case 4165:
+ case 4166:
+ case 4167:
+ case 4168:
+ case 4169:
+ case 4170:
+ case 4171:
+ case 4172:
+ case 4173:
+ case 4174:
+ case 4175:
+ case 4176:
+ case 4177:
+ case 4178:
+ case 4179:
+ case 4180:
+ case 4181:
+ case 4182:
+ case 4183:
+ case 4184:
+ case 4185:
+ case 4186:
+ case 4187:
+ case 4188:
+ case 4189:
+ case 4190:
+ case 4191:
+ case 4192:
+ case 4193:
+ case 4194:
+ case 4195:
+ case 4196:
+ case 4197:
+ case 4198:
+ case 4199:
+ case 4200:
+ case 4201:
+ case 4202:
+ case 4203:
+ case 4204:
+ case 4205:
+ case 4206:
+ case 4207:
+ case 4208:
+ case 4209:
+ case 4210:
+ case 4211:
+ case 4212:
+ case 4213:
+ case 4214:
+ case 4215:
+ case 4216:
+ case 4217:
+ case 4218:
+ case 4219:
+ case 4220:
+ case 4221:
+ case 4222:
+ case 4223:
+ case 4224:
+ case 4225:
+ case 4226:
+ case 4227:
+ case 4228:
+ case 4229:
+ case 4230:
+ case 4231:
+ case 4232:
+ case 4233:
+ case 4234:
+ case 4235:
+ case 4236:
+ case 4237:
+ case 4238:
+ case 4239:
+ case 4240:
+ case 4241:
+ case 4242:
+ case 4243:
+ case 4244:
+ case 4245:
+ case 4246:
+ case 4247:
+ case 4248:
+ case 4249:
+ case 4250:
+ case 4251:
+ case 4252:
+ case 4253:
+ case 4254:
+ case 4255:
+ case 4256:
+ case 4257:
+ case 4258:
+ case 4259:
+ case 4260:
+ case 4261:
+ case 4262:
+ case 4263:
+ case 4264:
+ case 4265:
+ case 4266:
+ case 4267:
+ case 4268:
+ case 4269:
+ case 4270:
+ case 4271:
+ case 4272:
+ case 4273:
+ case 4274:
+ case 4275:
+ case 4276:
+ case 4277:
+ case 4278:
+ case 4279:
+ case 4280:
+ case 4281:
+ case 4282:
+ case 4283:
+ case 4284:
+ case 4285:
+ case 4286:
+ case 4287:
+ case 4288:
+ case 4289:
+ case 4290:
+ case 4291:
+ case 4292:
+ case 4293:
+ case 4294:
+ case 4295:
+ case 4296:
+ case 4297:
+ case 4298:
+ case 4299:
+ case 4300:
+ case 4301:
+ case 4302:
+ case 4303:
+ case 4304:
+ case 4305:
+ case 4306:
+ case 4307:
+ case 4308:
+ case 4309:
+ case 4310:
+ case 4311:
+ case 4312:
+ case 4313:
+ case 4314:
+ case 4315:
+ case 4316:
+ case 4317:
+ case 4318:
+ case 4319:
+ case 4320:
+ case 4321:
+ case 4322:
+ case 4323:
+ case 4324:
+ case 4325:
+ case 4326:
+ case 4327:
+ case 4328:
+ case 4329:
+ case 4330:
+ case 4331:
+ case 4332:
+ case 4333:
+ case 4334:
+ case 4335:
+ case 4336:
+ case 4337:
+ case 4338:
+ case 4339:
+ case 4340:
+ case 4341:
+ case 4342:
+ case 4343:
+ case 4344:
+ case 4345:
+ case 4346:
+ case 4347:
+ case 4348:
+ case 4349:
+ case 4350:
+ case 4351:
+ case 4352:
+ case 4353:
+ case 4354:
+ case 4355:
+ case 4356:
+ case 4357:
+ case 4358:
+ case 4359:
+ case 4360:
+ case 4361:
+ case 4362:
+ case 4363:
+ case 4364:
+ case 4365:
+ case 4366:
+ case 4367:
+ case 4368:
+ case 4369:
+ case 4370:
+ case 4371:
+ case 4372:
+ case 4373:
+ case 4374:
+ case 4375:
+ case 4376:
+ case 4377:
+ case 4378:
+ case 4379:
+ case 4380:
+ case 4381:
+ case 4382:
+ case 4383:
+ case 4384:
+ case 4385:
+ case 4386:
+ case 4387:
+ case 4388:
+ case 4389:
+ case 4390:
+ case 4391:
+ case 4392:
+ case 4393:
+ case 4394:
+ case 4395:
+ case 4396:
+ case 4397:
+ case 4398:
+ case 4399:
+ case 4400:
+ case 4401:
+ case 4402:
+ case 4403:
+ case 4404:
+ case 4405:
+ case 4406:
+ case 4407:
+ case 4408:
+ case 4409:
+ case 4410:
+ case 4411:
+ case 4412:
+ case 4413:
+ case 4414:
+ case 4415:
+ case 4416:
+ case 4417:
+ case 4418:
+ case 4419:
+ case 4420:
+ case 4421:
+ case 4422:
+ case 4423:
+ case 4424:
+ case 4425:
+ case 4426:
+ case 4427:
+ case 4428:
+ case 4429:
+ case 4430:
+ case 4431:
+ case 4432:
+ case 4433:
+ case 4434:
+ case 4435:
+ case 4436:
+ case 4437:
+ case 4438:
+ case 4439:
+ case 4440:
+ case 4441:
+ case 4442:
+ case 4443:
+ case 4444:
+ case 4445:
+ case 4446:
+ case 4447:
+ case 4448:
+ case 4449:
+ case 4450:
+ case 4451:
+ case 4452:
+ case 4453:
+ case 4454:
+ case 4455:
+ case 4456:
+ case 4457:
+ case 4458:
+ case 4459:
+ case 4460:
+ case 4461:
+ case 4462:
+ case 4463:
+ case 4464:
+ case 4465:
+ case 4466:
+ case 4467:
+ case 4468:
+ case 4469:
+ case 4470:
+ case 4471:
+ case 4472:
+ case 4473:
+ case 4474:
+ case 4475:
+ case 4476:
+ case 4477:
+ case 4478:
+ case 4479:
+ case 4480:
+ case 4481:
+ case 4482:
+ case 4483:
+ case 4484:
+ case 4485:
+ case 4486:
+ case 4487:
+ case 4488:
+ case 4489:
+ case 4490:
+ case 4491:
+ case 4492:
+ case 4493:
+ case 4494:
+ case 4495:
+ case 4496:
+ case 4497:
+ case 4498:
+ case 4499:
+ case 4500:
+ case 4501:
+ case 4502:
+ case 4503:
+ case 4504:
+ case 4505:
+ case 4506:
+ case 4507:
+ case 4508:
+ case 4509:
+ case 4510:
+ case 4511:
+ case 4512:
+ case 4513:
+ case 4514:
+ case 4515:
+ case 4516:
+ case 4517:
+ case 4518:
+ case 4519:
+ case 4520:
+ case 4521:
+ case 4522:
+ case 4523:
+ case 4524:
+ case 4525:
+ case 4526:
+ case 4527:
+ case 4528:
+ case 4529:
+ case 4530:
+ case 4531:
+ case 4532:
+ case 4533:
+ case 4534:
+ case 4535:
+ case 4536:
+ case 4537:
+ case 4538:
+ case 4539:
+ case 4540:
+ case 4541:
+ case 4542:
+ case 4543:
+ case 4544:
+ case 4545:
+ case 4546:
+ case 4547:
+ case 4548:
+ case 4549:
+ case 4550:
+ case 4551:
+ case 4552:
+ case 4553:
+ case 4554:
+ case 4555:
+ case 4556:
+ case 4557:
+ case 4558:
+ case 4559:
+ case 4560:
+ case 4561:
+ case 4562:
+ case 4563:
+ case 4564:
+ case 4565:
+ case 4566:
+ case 4567:
+ case 4568:
+ case 4569:
+ case 4570:
+ case 4571:
+ case 4572:
+ case 4573:
+ case 4574:
+ case 4575:
+ case 4576:
+ case 4577:
+ case 4578:
+ case 4579:
+ case 4580:
+ case 4581:
+ case 4582:
+ case 4583:
+ case 4584:
+ case 4585:
+ case 4586:
+ case 4587:
+ case 4588:
+ case 4589:
+ case 4590:
+ case 4591:
+ case 4592:
+ case 4593:
+ case 4594:
+ case 4595:
+ case 4596:
+ case 4597:
+ case 4598:
+ case 4599:
+ case 4600:
+ case 4601:
+ case 4602:
+ case 4603:
+ case 4604:
+ case 4605:
+ case 4606:
+ case 4607:
+ case 4608:
+ case 4609:
+ case 4610:
+ case 4611:
+ case 4612:
+ case 4613:
+ case 4614:
+ case 4615:
+ case 4616:
+ case 4617:
+ case 4618:
+ case 4619:
+ case 4620:
+ case 4621:
+ case 4622:
+ case 4623:
+ case 4624:
+ case 4625:
+ case 4626:
+ case 4627:
+ case 4628:
+ case 4629:
+ case 4630:
+ case 4631:
+ case 4632:
+ case 4633:
+ case 4634:
+ case 4635:
+ case 4636:
+ case 4637:
+ case 4638:
+ case 4639:
+ case 4640:
+ case 4641:
+ case 4642:
+ case 4643:
+ case 4644:
+ case 4645:
+ case 4646:
+ case 4647:
+ case 4648:
+ case 4649:
+ case 4650:
+ case 4651:
+ case 4652:
+ case 4653:
+ case 4654:
+ case 4655:
+ case 4656:
+ case 4657:
+ case 4658:
+ case 4659:
+ case 4660:
+ case 4661:
+ case 4662:
+ case 4663:
+ case 4664:
+ case 4665:
+ case 4666:
+ case 4667:
+ case 4668:
+ case 4669:
+ case 4670:
+ case 4671:
+ case 4672:
+ case 4673:
+ case 4674:
+ case 4675:
+ case 4676:
+ case 4677:
+ case 4678:
+ case 4679:
+ case 4680:
+ case 4681:
+ case 4682:
+ case 4683:
+ case 4684:
+ case 4685:
+ case 4686:
+ case 4687:
+ case 4688:
+ case 4689:
+ case 4690:
+ case 4691:
+ case 4692:
+ case 4693:
+ case 4694:
+ case 4695:
+ case 4696:
+ case 4697:
+ case 4698:
+ case 4699:
+ case 4700:
+ case 4701:
+ case 4702:
+ case 4703:
+ case 4704:
+ case 4705:
+ case 4706:
+ case 4707:
+ case 4708:
+ case 4709:
+ case 4710:
+ case 4711:
+ case 4712:
+ case 4713:
+ case 4714:
+ case 4715:
+ case 4716:
+ case 4717:
+ case 4718:
+ case 4719:
+ case 4720:
+ case 4721:
+ case 4722:
+ case 4723:
+ case 4724:
+ case 4725:
+ case 4726:
+ case 4727:
+ case 4728:
+ case 4729:
+ case 4730:
+ case 4731:
+ case 4732:
+ case 4733:
+ case 4734:
+ case 4735:
+ case 4736:
+ case 4737:
+ case 4738:
+ case 4739:
+ case 4740:
+ case 4741:
+ case 4742:
+ case 4743:
+ case 4744:
+ case 4745:
+ case 4746:
+ case 4747:
+ case 4748:
+ case 4749:
+ case 4750:
+ case 4751:
+ case 4752:
+ case 4753:
+ case 4754:
+ case 4755:
+ case 4756:
+ case 4757:
+ case 4758:
+ case 4759:
+ case 4760:
+ case 4761:
+ case 4762:
+ case 4763:
+ case 4764:
+ case 4765:
+ case 4766:
+ case 4767:
+ case 4768:
+ case 4769:
+ case 4770:
+ case 4771:
+ case 4772:
+ case 4773:
+ case 4774:
+ case 4775:
+ case 4776:
+ case 4777:
+ case 4778:
+ case 4779:
+ case 4780:
+ case 4781:
+ case 4782:
+ case 4783:
+ case 4784:
+ case 4785:
+ case 4786:
+ case 4787:
+ case 4788:
+ case 4789:
+ case 4790:
+ case 4791:
+ case 4792:
+ case 4793:
+ case 4794:
+ case 4795:
+ case 4796:
+ case 4797:
+ case 4798:
+ case 4799:
+ case 4800:
+ case 4801:
+ case 4802:
+ case 4803:
+ case 4804:
+ case 4805:
+ case 4806:
+ case 4807:
+ case 4808:
+ case 4809:
+ case 4810:
+ case 4811:
+ case 4812:
+ case 4813:
+ case 4814:
+ case 4815:
+ case 4816:
+ case 4817:
+ case 4818:
+ case 4819:
+ case 4820:
+ case 4821:
+ case 4822:
+ case 4823:
+ case 4824:
+ case 4825:
+ case 4826:
+ case 4827:
+ case 4828:
+ case 4829:
+ case 4830:
+ case 4831:
+ case 4832:
+ case 4833:
+ case 4834:
+ case 4835:
+ case 4836:
+ case 4837:
+ case 4838:
+ case 4839:
+ case 4840:
+ case 4841:
+ case 4842:
+ case 4843:
+ case 4844:
+ case 4845:
+ case 4846:
+ case 4847:
+ case 4848:
+ case 4849:
+ case 4850:
+ case 4851:
+ case 4852:
+ case 4853:
+ case 4854:
+ case 4855:
+ case 4856:
+ case 4857:
+ case 4858:
+ case 4859:
+ case 4860:
+ case 4861:
+ case 4862:
+ case 4863:
+ case 4864:
+ case 4865:
+ case 4866:
+ case 4867:
+ case 4868:
+ case 4869:
+ case 4870:
+ case 4871:
+ case 4872:
+ case 4873:
+ case 4874:
+ case 4875:
+ case 4876:
+ case 4877:
+ case 4878:
+ case 4879:
+ case 4880:
+ case 4881:
+ case 4882:
+ case 4883:
+ case 4884:
+ case 4885:
+ case 4886:
+ case 4887:
+ case 4888:
+ case 4889:
+ case 4890:
+ case 4891:
+ case 4892:
+ case 4893:
+ case 4894:
+ case 4895:
+ case 4896:
+ case 4897:
+ case 4898:
+ case 4899:
+ case 4900:
+ case 4901:
+ case 4902:
+ case 4903:
+ case 4904:
+ case 4905:
+ case 4906:
+ case 4907:
+ case 4908:
+ case 4909:
+ case 4910:
+ case 4911:
+ case 4912:
+ case 4913:
+ case 4914:
+ case 4915:
+ case 4916:
+ case 4917:
+ case 4918:
+ case 4919:
+ case 4920:
+ case 4921:
+ case 4922:
+ case 4923:
+ case 4924:
+ case 4925:
+ case 4926:
+ case 4927:
+ case 4928:
+ case 4929:
+ case 4930:
+ case 4931:
+ case 4932:
+ case 4933:
+ case 4934:
+ case 4935:
+ case 4936:
+ case 4937:
+ case 4938:
+ case 4939:
+ case 4940:
+ case 4941:
+ case 4942:
+ case 4943:
+ case 4944:
+ case 4945:
+ case 4946:
+ case 4947:
+ case 4948:
+ case 4949:
+ case 4950:
+ case 4951:
+ case 4952:
+ case 4953:
+ case 4954:
+ case 4955:
+ case 4956:
+ case 4957:
+ case 4958:
+ case 4959:
+ case 4960:
+ case 4961:
+ case 4962:
+ case 4963:
+ case 4964:
+ case 4965:
+ case 4966:
+ case 4967:
+ case 4968:
+ case 4969:
+ case 4970:
+ case 4971:
+ case 4972:
+ case 4973:
+ case 4974:
+ case 4975:
+ case 4976:
+ case 4977:
+ case 4978:
+ case 4979:
+ case 4980:
+ case 4981:
+ case 4982:
+ case 4983:
+ case 4984:
+ case 4985:
+ case 4986:
+ case 4987:
+ case 4988:
+ case 4989:
+ case 4990:
+ case 4991:
+ case 4992:
+ case 4993:
+ case 4994:
+ case 4995:
+ case 4996:
+ case 4997:
+ case 4998:
+ case 4999:
+ case 5000:
+ case 5001:
+ case 5002:
+ case 5003:
+ case 5004:
+ case 5005:
+ case 5006:
+ case 5007:
+ case 5008:
+ case 5009:
+ case 5010:
+ case 5011:
+ case 5012:
+ case 5013:
+ case 5014:
+ case 5015:
+ case 5016:
+ case 5017:
+ case 5018:
+ case 5019:
+ case 5020:
+ case 5021:
+ case 5022:
+ case 5023:
+ case 5024:
+ case 5025:
+ case 5026:
+ case 5027:
+ case 5028:
+ case 5029:
+ case 5030:
+ case 5031:
+ case 5032:
+ case 5033:
+ case 5034:
+ case 5035:
+ case 5036:
+ case 5037:
+ case 5038:
+ case 5039:
+ case 5040:
+ case 5041:
+ case 5042:
+ case 5043:
+ case 5044:
+ case 5045:
+ case 5046:
+ case 5047:
+ case 5048:
+ case 5049:
+ case 5050:
+ case 5051:
+ case 5052:
+ case 5053:
+ case 5054:
+ case 5055:
+ case 5056:
+ case 5057:
+ case 5058:
+ case 5059:
+ case 5060:
+ case 5061:
+ case 5062:
+ case 5063:
+ case 5064:
+ case 5065:
+ case 5066:
+ case 5067:
+ case 5068:
+ case 5069:
+ case 5070:
+ case 5071:
+ case 5072:
+ case 5073:
+ case 5074:
+ case 5075:
+ case 5076:
+ case 5077:
+ case 5078:
+ case 5079:
+ case 5080:
+ case 5081:
+ case 5082:
+ case 5083:
+ case 5084:
+ case 5085:
+ case 5086:
+ case 5087:
+ case 5088:
+ case 5089:
+ case 5090:
+ case 5091:
+ case 5092:
+ case 5093:
+ case 5094:
+ case 5095:
+ case 5096:
+ case 5097:
+ case 5098:
+ case 5099:
+ case 5100:
+ case 5101:
+ case 5102:
+ case 5103:
+ case 5104:
+ case 5105:
+ case 5106:
+ case 5107:
+ case 5108:
+ case 5109:
+ case 5110:
+ case 5111:
+ case 5112:
+ case 5113:
+ case 5114:
+ case 5115:
+ case 5116:
+ case 5117:
+ case 5118:
+ case 5119:
+ case 5120:
+ case 5121:
+ case 5122:
+ case 5123:
+ case 5124:
+ case 5125:
+ case 5126:
+ case 5127:
+ case 5128:
+ case 5129:
+ case 5130:
+ case 5131:
+ case 5132:
+ case 5133:
+ case 5134:
+ case 5135:
+ case 5136:
+ case 5137:
+ case 5138:
+ case 5139:
+ case 5140:
+ case 5141:
+ case 5142:
+ case 5143:
+ case 5144:
+ case 5145:
+ case 5146:
+ case 5147:
+ case 5148:
+ case 5149:
+ case 5150:
+ case 5151:
+ case 5152:
+ case 5153:
+ case 5154:
+ case 5155:
+ case 5156:
+ case 5157:
+ case 5158:
+ case 5159:
+ case 5160:
+ case 5161:
+ case 5162:
+ case 5163:
+ case 5164:
+ case 5165:
+ case 5166:
+ case 5167:
+ case 5168:
+ case 5169:
+ case 5170:
+ case 5171:
+ case 5172:
+ case 5173:
+ case 5174:
+ case 5175:
+ case 5176:
+ case 5177:
+ case 5178:
+ case 5179:
+ case 5180:
+ case 5181:
+ case 5182:
+ case 5183:
+ case 5184:
+ case 5185:
+ case 5186:
+ case 5187:
+ case 5188:
+ case 5189:
+ case 5190:
+ case 5191:
+ case 5192:
+ case 5193:
+ case 5194:
+ case 5195:
+ case 5196:
+ case 5197:
+ case 5198:
+ case 5199:
+ case 5200:
+ case 5201:
+ case 5202:
+ case 5203:
+ case 5204:
+ case 5205:
+ case 5206:
+ case 5207:
+ case 5208:
+ case 5209:
+ case 5210:
+ case 5211:
+ case 5212:
+ case 5213:
+ case 5214:
+ case 5215:
+ case 5216:
+ case 5217:
+ case 5218:
+ case 5219:
+ case 5220:
+ case 5221:
+ case 5222:
+ case 5223:
+ case 5224:
+ case 5225:
+ case 5226:
+ case 5227:
+ case 5228:
+ case 5229:
+ case 5230:
+ case 5231:
+ case 5232:
+ case 5233:
+ case 5234:
+ case 5235:
+ case 5236:
+ case 5237:
+ case 5238:
+ case 5239:
+ case 5240:
+ case 5241:
+ case 5242:
+ case 5243:
+ case 5244:
+ case 5245:
+ case 5246:
+ case 5247:
+ case 5248:
+ case 5249:
+ case 5250:
+ case 5251:
+ case 5252:
+ case 5253:
+ case 5254:
+ case 5255:
+ case 5256:
+ case 5257:
+ case 5258:
+ case 5259:
+ case 5260:
+ case 5261:
+ case 5262:
+ case 5263:
+ case 5264:
+ case 5265:
+ case 5266:
+ case 5267:
+ case 5268:
+ case 5269:
+ case 5270:
+ case 5271:
+ case 5272:
+ case 5273:
+ case 5274:
+ case 5275:
+ case 5276:
+ case 5277:
+ case 5278:
+ case 5279:
+ case 5280:
+ case 5281:
+ case 5282:
+ case 5283:
+ case 5284:
+ case 5285:
+ case 5286:
+ case 5287:
+ case 5288:
+ case 5289:
+ case 5290:
+ case 5291:
+ case 5292:
+ case 5293:
+ case 5294:
+ case 5295:
+ case 5296:
+ case 5297:
+ case 5298:
+ case 5299:
+ case 5300:
+ case 5301:
+ case 5302:
+ case 5303:
+ case 5304:
+ case 5305:
+ case 5306:
+ case 5307:
+ case 5308:
+ case 5309:
+ case 5310:
+ case 5311:
+ case 5312:
+ case 5313:
+ case 5314:
+ case 5315:
+ case 5316:
+ case 5317:
+ case 5318:
+ case 5319:
+ case 5320:
+ case 5321:
+ case 5322:
+ case 5323:
+ case 5324:
+ case 5325:
+ case 5326:
+ case 5327:
+ case 5328:
+ case 5329:
+ case 5330:
+ case 5331:
+ case 5332:
+ case 5333:
+ case 5334:
+ case 5335:
+ case 5336:
+ case 5337:
+ case 5338:
+ case 5339:
+ case 5340:
+ case 5341:
+ case 5342:
+ case 5343:
+ case 5344:
+ case 5345:
+ case 5346:
+ case 5347:
+ case 5348:
+ case 5349:
+ case 5350:
+ case 5351:
+ case 5352:
+ case 5353:
+ case 5354:
+ case 5355:
+ case 5356:
+ case 5357:
+ case 5358:
+ case 5359:
+ case 5360:
+ case 5361:
+ case 5362:
+ case 5363:
+ case 5364:
+ case 5365:
+ case 5366:
+ case 5367:
+ case 5368:
+ case 5369:
+ case 5370:
+ case 5371:
+ case 5372:
+ case 5373:
+ case 5374:
+ case 5375:
+ case 5376:
+ case 5377:
+ case 5378:
+ case 5379:
+ case 5380:
+ case 5381:
+ case 5382:
+ case 5383:
+ case 5384:
+ case 5385:
+ case 5386:
+ case 5387:
+ case 5388:
+ case 5389:
+ case 5390:
+ case 5391:
+ case 5392:
+ case 5393:
+ case 5394:
+ case 5395:
+ case 5396:
+ case 5397:
+ case 5398:
+ case 5399:
+ case 5400:
+ case 5401:
+ case 5402:
+ case 5403:
+ case 5404:
+ case 5405:
+ case 5406:
+ case 5407:
+ case 5408:
+ case 5409:
+ case 5410:
+ case 5411:
+ case 5412:
+ case 5413:
+ case 5414:
+ case 5415:
+ case 5416:
+ case 5417:
+ case 5418:
+ case 5419:
+ case 5420:
+ case 5421:
+ case 5422:
+ case 5423:
+ case 5424:
+ case 5425:
+ case 5426:
+ case 5427:
+ case 5428:
+ case 5429:
+ case 5430:
+ case 5431:
+ case 5432:
+ case 5433:
+ case 5434:
+ case 5435:
+ case 5436:
+ case 5437:
+ case 5438:
+ case 5439:
+ case 5440:
+ case 5441:
+ case 5442:
+ case 5443:
+ case 5444:
+ case 5445:
+ case 5446:
+ case 5447:
+ case 5448:
+ case 5449:
+ case 5450:
+ case 5451:
+ case 5452:
+ case 5453:
+ case 5454:
+ case 5455:
+ case 5456:
+ case 5457:
+ case 5458:
+ case 5459:
+ case 5460:
+ case 5461:
+ case 5462:
+ case 5463:
+ case 5464:
+ case 5465:
+ case 5466:
+ case 5467:
+ case 5468:
+ case 5469:
+ case 5470:
+ case 5471:
+ case 5472:
+ case 5473:
+ case 5474:
+ case 5475:
+ case 5476:
+ case 5477:
+ case 5478:
+ case 5479:
+ case 5480:
+ case 5481:
+ case 5482:
+ case 5483:
+ case 5484:
+ case 5485:
+ case 5486:
+ case 5487:
+ case 5488:
+ case 5489:
+ case 5490:
+ case 5491:
+ case 5492:
+ case 5493:
+ case 5494:
+ case 5495:
+ case 5496:
+ case 5497:
+ case 5498:
+ case 5499:
+ case 5500:
+ case 5501:
+ case 5502:
+ case 5503:
+ case 5504:
+ case 5505:
+ case 5506:
+ case 5507:
+ case 5508:
+ case 5509:
+ case 5510:
+ case 5511:
+ case 5512:
+ case 5513:
+ case 5514:
+ case 5515:
+ case 5516:
+ case 5517:
+ case 5518:
+ case 5519:
+ case 5520:
+ case 5521:
+ case 5522:
+ case 5523:
+ case 5524:
+ case 5525:
+ case 5526:
+ case 5527:
+ case 5528:
+ case 5529:
+ case 5530:
+ case 5531:
+ case 5532:
+ case 5533:
+ case 5534:
+ case 5535:
+ case 5536:
+ case 5537:
+ case 5538:
+ case 5539:
+ case 5540:
+ case 5541:
+ case 5542:
+ case 5543:
+ case 5544:
+ case 5545:
+ case 5546:
+ case 5547:
+ case 5548:
+ case 5549:
+ case 5550:
+ case 5551:
+ case 5552:
+ case 5553:
+ case 5554:
+ case 5555:
+ case 5556:
+ case 5557:
+ case 5558:
+ case 5559:
+ case 5560:
+ case 5561:
+ case 5562:
+ case 5563:
+ case 5564:
+ case 5565:
+ case 5566:
+ case 5567:
+ case 5568:
+ case 5569:
+ case 5570:
+ case 5571:
+ case 5572:
+ case 5573:
+ case 5574:
+ case 5575:
+ case 5576:
+ case 5577:
+ case 5578:
+ case 5579:
+ case 5580:
+ case 5581:
+ case 5582:
+ case 5583:
+ case 5584:
+ case 5585:
+ case 5586:
+ case 5587:
+ case 5588:
+ case 5589:
+ case 5590:
+ case 5591:
+ case 5592:
+ case 5593:
+ case 5594:
+ case 5595:
+ case 5596:
+ case 5597:
+ case 5598:
+ case 5599:
+ case 5600:
+ case 5601:
+ case 5602:
+ case 5603:
+ case 5604:
+ case 5605:
+ case 5606:
+ case 5607:
+ case 5608:
+ case 5609:
+ case 5610:
+ case 5611:
+ case 5612:
+ case 5613:
+ case 5614:
+ case 5615:
+ case 5616:
+ case 5617:
+ case 5618:
+ case 5619:
+ case 5620:
+ case 5621:
+ case 5622:
+ case 5623:
+ case 5624:
+ case 5625:
+ case 5626:
+ case 5627:
+ case 5628:
+ case 5629:
+ case 5630:
+ case 5631:
+ case 5632:
+ case 5633:
+ case 5634:
+ case 5635:
+ case 5636:
+ case 5637:
+ case 5638:
+ case 5639:
+ case 5640:
+ case 5641:
+ case 5642:
+ case 5643:
+ case 5644:
+ case 5645:
+ case 5646:
+ case 5647:
+ case 5648:
+ case 5649:
+ case 5650:
+ case 5651:
+ case 5652:
+ case 5653:
+ case 5654:
+ case 5655:
+ case 5656:
+ case 5657:
+ case 5658:
+ case 5659:
+ case 5660:
+ case 5661:
+ case 5662:
+ case 5663:
+ case 5664:
+ case 5665:
+ case 5666:
+ case 5667:
+ case 5668:
+ case 5669:
+ case 5670:
+ case 5671:
+ case 5672:
+ case 5673:
+ case 5674:
+ case 5675:
+ case 5676:
+ case 5677:
+ case 5678:
+ case 5679:
+ case 5680:
+ case 5681:
+ case 5682:
+ case 5683:
+ case 5684:
+ case 5685:
+ case 5686:
+ case 5687:
+ case 5688:
+ case 5689:
+ case 5690:
+ case 5691:
+ case 5692:
+ case 5693:
+ case 5694:
+ case 5695:
+ case 5696:
+ case 5697:
+ case 5698:
+ case 5699:
+ case 5700:
+ case 5701:
+ case 5702:
+ case 5703:
+ case 5704:
+ case 5705:
+ case 5706:
+ case 5707:
+ case 5708:
+ case 5709:
+ case 5710:
+ case 5711:
+ case 5712:
+ case 5713:
+ case 5714:
+ case 5715:
+ case 5716:
+ case 5717:
+ case 5718:
+ case 5719:
+ case 5720:
+ case 5721:
+ case 5722:
+ case 5723:
+ case 5724:
+ case 5725:
+ case 5726:
+ case 5727:
+ case 5728:
+ case 5729:
+ case 5730:
+ case 5731:
+ case 5732:
+ case 5733:
+ case 5734:
+ case 5735:
+ case 5736:
+ case 5737:
+ case 5738:
+ case 5739:
+ case 5740:
+ case 5741:
+ case 5742:
+ case 5743:
+ case 5744:
+ case 5745:
+ case 5746:
+ case 5747:
+ case 5748:
+ case 5749:
+ case 5750:
+ case 5751:
+ case 5752:
+ case 5753:
+ case 5754:
+ case 5755:
+ case 5756:
+ case 5757:
+ case 5758:
+ case 5759:
+ case 5760:
+ case 5761:
+ case 5762:
+ case 5763:
+ case 5764:
+ case 5765:
+ case 5766:
+ case 5767:
+ case 5768:
+ case 5769:
+ case 5770:
+ case 5771:
+ case 5772:
+ case 5773:
+ case 5774:
+ case 5775:
+ case 5776:
+ case 5777:
+ case 5778:
+ case 5779:
+ case 5780:
+ case 5781:
+ case 5782:
+ case 5783:
+ case 5784:
+ case 5785:
+ case 5786:
+ case 5787:
+ case 5788:
+ case 5789:
+ case 5790:
+ case 5791:
+ case 5792:
+ case 5793:
+ case 5794:
+ case 5795:
+ case 5796:
+ case 5797:
+ case 5798:
+ case 5799:
+ case 5800:
+ case 5801:
+ case 5802:
+ case 5803:
+ case 5804:
+ case 5805:
+ case 5806:
+ case 5807:
+ case 5808:
+ case 5809:
+ case 5810:
+ case 5811:
+ case 5812:
+ case 5813:
+ case 5814:
+ case 5815:
+ case 5816:
+ case 5817:
+ case 5818:
+ case 5819:
+ case 5820:
+ case 5821:
+ case 5822:
+ case 5823:
+ case 5824:
+ case 5825:
+ case 5826:
+ case 5827:
+ case 5828:
+ case 5829:
+ case 5830:
+ case 5831:
+ case 5832:
+ case 5833:
+ case 5834:
+ case 5835:
+ case 5836:
+ case 5837:
+ case 5838:
+ case 5839:
+ case 5840:
+ case 5841:
+ case 5842:
+ case 5843:
+ case 5844:
+ case 5845:
+ case 5846:
+ case 5847:
+ case 5848:
+ case 5849:
+ case 5850:
+ case 5851:
+ case 5852:
+ case 5853:
+ case 5854:
+ case 5855:
+ case 5856:
+ case 5857:
+ case 5858:
+ case 5859:
+ case 5860:
+ case 5861:
+ case 5862:
+ case 5863:
+ case 5864:
+ case 5865:
+ case 5866:
+ case 5867:
+ case 5868:
+ case 5869:
+ case 5870:
+ case 5871:
+ case 5872:
+ case 5873:
+ case 5874:
+ case 5875:
+ case 5876:
+ case 5877:
+ case 5878:
+ case 5879:
+ case 5880:
+ case 5881:
+ case 5882:
+ case 5883:
+ case 5884:
+ case 5885:
+ case 5886:
+ case 5887:
+ case 5888:
+ case 5889:
+ case 5890:
+ case 5891:
+ case 5892:
+ case 5893:
+ case 5894:
+ case 5895:
+ case 5896:
+ case 5897:
+ case 5898:
+ case 5899:
+ case 5900:
+ case 5901:
+ case 5902:
+ case 5903:
+ case 5904:
+ case 5905:
+ case 5906:
+ case 5907:
+ case 5908:
+ case 5909:
+ case 5910:
+ case 5911:
+ case 5912:
+ case 5913:
+ case 5914:
+ case 5915:
+ case 5916:
+ case 5917:
+ case 5918:
+ case 5919:
+ case 5920:
+ case 5921:
+ case 5922:
+ case 5923:
+ case 5924:
+ case 5925:
+ case 5926:
+ case 5927:
+ case 5928:
+ case 5929:
+ case 5930:
+ case 5931:
+ case 5932:
+ case 5933:
+ case 5934:
+ case 5935:
+ case 5936:
+ case 5937:
+ case 5938:
+ case 5939:
+ case 5940:
+ case 5941:
+ case 5942:
+ case 5943:
+ case 5944:
+ case 5945:
+ case 5946:
+ case 5947:
+ case 5948:
+ case 5949:
+ case 5950:
+ case 5951:
+ case 5952:
+ case 5953:
+ case 5954:
+ case 5955:
+ case 5956:
+ case 5957:
+ case 5958:
+ case 5959:
+ case 5960:
+ case 5961:
+ case 5962:
+ case 5963:
+ case 5964:
+ case 5965:
+ case 5966:
+ case 5967:
+ case 5968:
+ case 5969:
+ case 5970:
+ case 5971:
+ case 5972:
+ case 5973:
+ case 5974:
+ case 5975:
+ case 5976:
+ case 5977:
+ case 5978:
+ case 5979:
+ case 5980:
+ case 5981:
+ case 5982:
+ case 5983:
+ case 5984:
+ case 5985:
+ case 5986:
+ case 5987:
+ case 5988:
+ case 5989:
+ case 5990:
+ case 5991:
+ case 5992:
+ case 5993:
+ case 5994:
+ case 5995:
+ case 5996:
+ case 5997:
+ case 5998:
+ case 5999:
+ case 6000:
+ case 6001:
+ case 6002:
+ case 6003:
+ case 6004:
+ case 6005:
+ case 6006:
+ case 6007:
+ case 6008:
+ case 6009:
+ case 6010:
+ case 6011:
+ case 6012:
+ case 6013:
+ case 6014:
+ case 6015:
+ case 6016:
+ case 6017:
+ case 6018:
+ case 6019:
+ case 6020:
+ case 6021:
+ case 6022:
+ case 6023:
+ case 6024:
+ case 6025:
+ case 6026:
+ case 6027:
+ case 6028:
+ case 6029:
+ case 6030:
+ case 6031:
+ case 6032:
+ case 6033:
+ case 6034:
+ case 6035:
+ case 6036:
+ case 6037:
+ case 6038:
+ case 6039:
+ case 6040:
+ case 6041:
+ case 6042:
+ case 6043:
+ case 6044:
+ case 6045:
+ case 6046:
+ case 6047:
+ case 6048:
+ case 6049:
+ case 6050:
+ case 6051:
+ case 6052:
+ case 6053:
+ case 6054:
+ case 6055:
+ case 6056:
+ case 6057:
+ case 6058:
+ case 6059:
+ case 6060:
+ case 6061:
+ case 6062:
+ case 6063:
+ case 6064:
+ case 6065:
+ case 6066:
+ case 6067:
+ case 6068:
+ case 6069:
+ case 6070:
+ case 6071:
+ case 6072:
+ case 6073:
+ case 6074:
+ case 6075:
+ case 6076:
+ case 6077:
+ case 6078:
+ case 6079:
+ case 6080:
+ case 6081:
+ case 6082:
+ case 6083:
+ case 6084:
+ case 6085:
+ case 6086:
+ case 6087:
+ case 6088:
+ case 6089:
+ case 6090:
+ case 6091:
+ case 6092:
+ case 6093:
+ case 6094:
+ case 6095:
+ case 6096:
+ case 6097:
+ case 6098:
+ case 6099:
+ case 6100:
+ case 6101:
+ case 6102:
+ case 6103:
+ case 6104:
+ case 6105:
+ case 6106:
+ case 6107:
+ case 6108:
+ case 6109:
+ case 6110:
+ case 6111:
+ case 6112:
+ case 6113:
+ case 6114:
+ case 6115:
+ case 6116:
+ case 6117:
+ case 6118:
+ case 6119:
+ case 6120:
+ case 6121:
+ case 6122:
+ case 6123:
+ case 6124:
+ case 6125:
+ case 6126:
+ case 6127:
+ case 6128:
+ case 6129:
+ case 6130:
+ case 6131:
+ case 6132:
+ case 6133:
+ case 6134:
+ case 6135:
+ case 6136:
+ case 6137:
+ case 6138:
+ case 6139:
+ case 6140:
+ case 6141:
+ case 6142:
+ case 6143:
+ case 6144:
+ case 6145:
+ case 6146:
+ case 6147:
+ case 6148:
+ case 6149:
+ case 6150:
+ case 6151:
+ case 6152:
+ case 6153:
+ case 6154:
+ case 6155:
+ case 6156:
+ case 6157:
+ case 6158:
+ case 6159:
+ case 6160:
+ case 6161:
+ case 6162:
+ case 6163:
+ case 6164:
+ case 6165:
+ case 6166:
+ case 6167:
+ case 6168:
+ case 6169:
+ case 6170:
+ case 6171:
+ case 6172:
+ case 6173:
+ case 6174:
+ case 6175:
+ case 6176:
+ case 6177:
+ case 6178:
+ case 6179:
+ case 6180:
+ case 6181:
+ case 6182:
+ case 6183:
+ case 6184:
+ case 6185:
+ case 6186:
+ case 6187:
+ case 6188:
+ case 6189:
+ case 6190:
+ case 6191:
+ case 6192:
+ case 6193:
+ case 6194:
+ case 6195:
+ case 6196:
+ case 6197:
+ case 6198:
+ case 6199:
+ case 6200:
+ case 6201:
+ case 6202:
+ case 6203:
+ case 6204:
+ case 6205:
+ case 6206:
+ case 6207:
+ case 6208:
+ case 6209:
+ case 6210:
+ case 6211:
+ case 6212:
+ case 6213:
+ case 6214:
+ case 6215:
+ case 6216:
+ case 6217:
+ case 6218:
+ case 6219:
+ case 6220:
+ case 6221:
+ case 6222:
+ case 6223:
+ case 6224:
+ case 6225:
+ case 6226:
+ case 6227:
+ case 6228:
+ case 6229:
+ case 6230:
+ case 6231:
+ case 6232:
+ case 6233:
+ case 6234:
+ case 6235:
+ case 6236:
+ case 6237:
+ case 6238:
+ case 6239:
+ case 6240:
+ case 6241:
+ case 6242:
+ case 6243:
+ case 6244:
+ case 6245:
+ case 6246:
+ case 6247:
+ case 6248:
+ case 6249:
+ case 6250:
+ case 6251:
+ case 6252:
+ case 6253:
+ case 6254:
+ case 6255:
+ case 6256:
+ case 6257:
+ case 6258:
+ case 6259:
+ case 6260:
+ case 6261:
+ case 6262:
+ case 6263:
+ case 6264:
+ case 6265:
+ case 6266:
+ case 6267:
+ case 6268:
+ case 6269:
+ case 6270:
+ case 6271:
+ case 6272:
+ case 6273:
+ case 6274:
+ case 6275:
+ case 6276:
+ case 6277:
+ case 6278:
+ case 6279:
+ case 6280:
+ case 6281:
+ case 6282:
+ case 6283:
+ case 6284:
+ case 6285:
+ case 6286:
+ case 6287:
+ case 6288:
+ case 6289:
+ case 6290:
+ case 6291:
+ case 6292:
+ case 6293:
+ case 6294:
+ case 6295:
+ case 6296:
+ case 6297:
+ case 6298:
+ case 6299:
+ case 6300:
+ case 6301:
+ case 6302:
+ case 6303:
+ case 6304:
+ case 6305:
+ case 6306:
+ case 6307:
+ case 6308:
+ case 6309:
+ case 6310:
+ case 6311:
+ case 6312:
+ case 6313:
+ case 6314:
+ case 6315:
+ case 6316:
+ case 6317:
+ case 6318:
+ case 6319:
+ case 6320:
+ case 6321:
+ case 6322:
+ case 6323:
+ case 6324:
+ case 6325:
+ case 6326:
+ case 6327:
+ case 6328:
+ case 6329:
+ case 6330:
+ case 6331:
+ case 6332:
+ case 6333:
+ case 6334:
+ case 6335:
+ case 6336:
+ case 6337:
+ case 6338:
+ case 6339:
+ case 6340:
+ case 6341:
+ case 6342:
+ case 6343:
+ case 6344:
+ case 6345:
+ case 6346:
+ case 6347:
+ case 6348:
+ case 6349:
+ case 6350:
+ case 6351:
+ case 6352:
+ case 6353:
+ case 6354:
+ case 6355:
+ case 6356:
+ case 6357:
+ case 6358:
+ case 6359:
+ case 6360:
+ case 6361:
+ case 6362:
+ case 6363:
+ case 6364:
+ case 6365:
+ case 6366:
+ case 6367:
+ case 6368:
+ case 6369:
+ case 6370:
+ case 6371:
+ case 6372:
+ case 6373:
+ case 6374:
+ case 6375:
+ case 6376:
+ case 6377:
+ case 6378:
+ case 6379:
+ case 6380:
+ case 6381:
+ case 6382:
+ case 6383:
+ case 6384:
+ case 6385:
+ case 6386:
+ case 6387:
+ case 6388:
+ case 6389:
+ case 6390:
+ case 6391:
+ case 6392:
+ case 6393:
+ case 6394:
+ case 6395:
+ case 6396:
+ case 6397:
+ case 6398:
+ case 6399:
+ case 6400:
+ case 6401:
+ case 6402:
+ case 6403:
+ case 6404:
+ case 6405:
+ case 6406:
+ case 6407:
+ case 6408:
+ case 6409:
+ case 6410:
+ case 6411:
+ case 6412:
+ case 6413:
+ case 6414:
+ case 6415:
+ case 6416:
+ case 6417:
+ case 6418:
+ case 6419:
+ case 6420:
+ case 6421:
+ case 6422:
+ case 6423:
+ case 6424:
+ case 6425:
+ case 6426:
+ case 6427:
+ case 6428:
+ case 6429:
+ case 6430:
+ case 6431:
+ case 6432:
+ case 6433:
+ case 6434:
+ case 6435:
+ case 6436:
+ case 6437:
+ case 6438:
+ case 6439:
+ case 6440:
+ case 6441:
+ case 6442:
+ case 6443:
+ case 6444:
+ case 6445:
+ case 6446:
+ case 6447:
+ case 6448:
+ case 6449:
+ case 6450:
+ case 6451:
+ case 6452:
+ case 6453:
+ case 6454:
+ case 6455:
+ case 6456:
+ case 6457:
+ case 6458:
+ case 6459:
+ case 6460:
+ case 6461:
+ case 6462:
+ case 6463:
+ case 6464:
+ case 6465:
+ case 6466:
+ case 6467:
+ case 6468:
+ case 6469:
+ case 6470:
+ case 6471:
+ case 6472:
+ case 6473:
+ case 6474:
+ case 6475:
+ case 6476:
+ case 6477:
+ case 6478:
+ case 6479:
+ case 6480:
+ case 6481:
+ case 6482:
+ case 6483:
+ case 6484:
+ case 6485:
+ case 6486:
+ case 6487:
+ case 6488:
+ case 6489:
+ case 6490:
+ case 6491:
+ case 6492:
+ case 6493:
+ case 6494:
+ case 6495:
+ case 6496:
+ case 6497:
+ case 6498:
+ case 6499:
+ case 6500:
+ case 6501:
+ case 6502:
+ case 6503:
+ case 6504:
+ case 6505:
+ case 6506:
+ case 6507:
+ case 6508:
+ case 6509:
+ case 6510:
+ case 6511:
+ case 6512:
+ case 6513:
+ case 6514:
+ case 6515:
+ case 6516:
+ case 6517:
+ case 6518:
+ case 6519:
+ case 6520:
+ case 6521:
+ case 6522:
+ case 6523:
+ case 6524:
+ case 6525:
+ case 6526:
+ case 6527:
+ case 6528:
+ case 6529:
+ case 6530:
+ case 6531:
+ case 6532:
+ case 6533:
+ case 6534:
+ case 6535:
+ case 6536:
+ case 6537:
+ case 6538:
+ case 6539:
+ case 6540:
+ case 6541:
+ case 6542:
+ case 6543:
+ case 6544:
+ case 6545:
+ case 6546:
+ case 6547:
+ case 6548:
+ case 6549:
+ case 6550:
+ case 6551:
+ case 6552:
+ case 6553:
+ case 6554:
+ case 6555:
+ case 6556:
+ case 6557:
+ case 6558:
+ case 6559:
+ case 6560:
+ case 6561:
+ case 6562:
+ case 6563:
+ case 6564:
+ case 6565:
+ case 6566:
+ case 6567:
+ case 6568:
+ case 6569:
+ case 6570:
+ case 6571:
+ case 6572:
+ case 6573:
+ case 6574:
+ case 6575:
+ case 6576:
+ case 6577:
+ case 6578:
+ case 6579:
+ case 6580:
+ case 6581:
+ case 6582:
+ case 6583:
+ case 6584:
+ case 6585:
+ case 6586:
+ case 6587:
+ case 6588:
+ case 6589:
+ case 6590:
+ case 6591:
+ case 6592:
+ case 6593:
+ case 6594:
+ case 6595:
+ case 6596:
+ case 6597:
+ case 6598:
+ case 6599:
+ case 6600:
+ case 6601:
+ case 6602:
+ case 6603:
+ case 6604:
+ case 6605:
+ case 6606:
+ case 6607:
+ case 6608:
+ case 6609:
+ case 6610:
+ case 6611:
+ case 6612:
+ case 6613:
+ case 6614:
+ case 6615:
+ case 6616:
+ case 6617:
+ case 6618:
+ case 6619:
+ case 6620:
+ case 6621:
+ case 6622:
+ case 6623:
+ case 6624:
+ case 6625:
+ case 6626:
+ case 6627:
+ case 6628:
+ case 6629:
+ case 6630:
+ case 6631:
+ case 6632:
+ case 6633:
+ case 6634:
+ case 6635:
+ case 6636:
+ case 6637:
+ case 6638:
+ case 6639:
+ case 6640:
+ case 6641:
+ case 6642:
+ case 6643:
+ case 6644:
+ case 6645:
+ case 6646:
+ case 6647:
+ case 6648:
+ case 6649:
+ case 6650:
+ case 6651:
+ case 6652:
+ case 6653:
+ case 6654:
+ case 6655:
+ case 6656:
+ case 6657:
+ case 6658:
+ case 6659:
+ case 6660:
+ case 6661:
+ case 6662:
+ case 6663:
+ case 6664:
+ case 6665:
+ case 6666:
+ case 6667:
+ case 6668:
+ case 6669:
+ case 6670:
+ case 6671:
+ case 6672:
+ case 6673:
+ case 6674:
+ case 6675:
+ case 6676:
+ case 6677:
+ case 6678:
+ case 6679:
+ case 6680:
+ case 6681:
+ case 6682:
+ case 6683:
+ case 6684:
+ case 6685:
+ case 6686:
+ case 6687:
+ case 6688:
+ case 6689:
+ case 6690:
+ case 6691:
+ case 6692:
+ case 6693:
+ case 6694:
+ case 6695:
+ case 6696:
+ case 6697:
+ case 6698:
+ case 6699:
+ case 6700:
+ case 6701:
+ case 6702:
+ case 6703:
+ case 6704:
+ case 6705:
+ case 6706:
+ case 6707:
+ case 6708:
+ case 6709:
+ case 6710:
+ case 6711:
+ case 6712:
+ case 6713:
+ case 6714:
+ case 6715:
+ case 6716:
+ case 6717:
+ case 6718:
+ case 6719:
+ case 6720:
+ case 6721:
+ case 6722:
+ case 6723:
+ case 6724:
+ case 6725:
+ case 6726:
+ case 6727:
+ case 6728:
+ case 6729:
+ case 6730:
+ case 6731:
+ case 6732:
+ case 6733:
+ case 6734:
+ case 6735:
+ case 6736:
+ case 6737:
+ case 6738:
+ case 6739:
+ case 6740:
+ case 6741:
+ case 6742:
+ case 6743:
+ case 6744:
+ case 6745:
+ case 6746:
+ case 6747:
+ case 6748:
+ case 6749:
+ case 6750:
+ case 6751:
+ case 6752:
+ case 6753:
+ case 6754:
+ case 6755:
+ case 6756:
+ case 6757:
+ case 6758:
+ case 6759:
+ case 6760:
+ case 6761:
+ case 6762:
+ case 6763:
+ case 6764:
+ case 6765:
+ case 6766:
+ case 6767:
+ case 6768:
+ case 6769:
+ case 6770:
+ case 6771:
+ case 6772:
+ case 6773:
+ case 6774:
+ case 6775:
+ case 6776:
+ case 6777:
+ case 6778:
+ case 6779:
+ case 6780:
+ case 6781:
+ case 6782:
+ case 6783:
+ case 6784:
+ case 6785:
+ case 6786:
+ case 6787:
+ case 6788:
+ case 6789:
+ case 6790:
+ case 6791:
+ case 6792:
+ case 6793:
+ case 6794:
+ case 6795:
+ case 6796:
+ case 6797:
+ case 6798:
+ case 6799:
+ case 6800:
+ case 6801:
+ case 6802:
+ case 6803:
+ case 6804:
+ case 6805:
+ case 6806:
+ case 6807:
+ case 6808:
+ case 6809:
+ case 6810:
+ case 6811:
+ case 6812:
+ case 6813:
+ case 6814:
+ case 6815:
+ case 6816:
+ case 6817:
+ case 6818:
+ case 6819:
+ case 6820:
+ case 6821:
+ case 6822:
+ case 6823:
+ case 6824:
+ case 6825:
+ case 6826:
+ case 6827:
+ case 6828:
+ case 6829:
+ case 6830:
+ case 6831:
+ case 6832:
+ case 6833:
+ case 6834:
+ case 6835:
+ case 6836:
+ case 6837:
+ case 6838:
+ case 6839:
+ case 6840:
+ case 6841:
+ case 6842:
+ case 6843:
+ case 6844:
+ case 6845:
+ case 6846:
+ case 6847:
+ case 6848:
+ case 6849:
+ case 6850:
+ case 6851:
+ case 6852:
+ case 6853:
+ case 6854:
+ case 6855:
+ case 6856:
+ case 6857:
+ case 6858:
+ case 6859:
+ case 6860:
+ case 6861:
+ case 6862:
+ case 6863:
+ case 6864:
+ case 6865:
+ case 6866:
+ case 6867:
+ case 6868:
+ case 6869:
+ case 6870:
+ case 6871:
+ case 6872:
+ case 6873:
+ case 6874:
+ case 6875:
+ case 6876:
+ case 6877:
+ case 6878:
+ case 6879:
+ case 6880:
+ case 6881:
+ case 6882:
+ case 6883:
+ case 6884:
+ case 6885:
+ case 6886:
+ case 6887:
+ case 6888:
+ case 6889:
+ case 6890:
+ case 6891:
+ case 6892:
+ case 6893:
+ case 6894:
+ case 6895:
+ case 6896:
+ case 6897:
+ case 6898:
+ case 6899:
+ case 6900:
+ case 6901:
+ case 6902:
+ case 6903:
+ case 6904:
+ case 6905:
+ case 6906:
+ case 6907:
+ case 6908:
+ case 6909:
+ case 6910:
+ case 6911:
+ case 6912:
+ case 6913:
+ case 6914:
+ case 6915:
+ case 6916:
+ case 6917:
+ case 6918:
+ case 6919:
+ case 6920:
+ case 6921:
+ case 6922:
+ case 6923:
+ case 6924:
+ case 6925:
+ case 6926:
+ case 6927:
+ case 6928:
+ case 6929:
+ case 6930:
+ case 6931:
+ case 6932:
+ case 6933:
+ case 6934:
+ case 6935:
+ case 6936:
+ case 6937:
+ case 6938:
+ case 6939:
+ case 6940:
+ case 6941:
+ case 6942:
+ case 6943:
+ case 6944:
+ case 6945:
+ case 6946:
+ case 6947:
+ case 6948:
+ case 6949:
+ case 6950:
+ case 6951:
+ case 6952:
+ case 6953:
+ case 6954:
+ case 6955:
+ case 6956:
+ case 6957:
+ case 6958:
+ case 6959:
+ case 6960:
+ case 6961:
+ case 6962:
+ case 6963:
+ case 6964:
+ case 6965:
+ case 6966:
+ case 6967:
+ case 6968:
+ case 6969:
+ case 6970:
+ case 6971:
+ case 6972:
+ case 6973:
+ case 6974:
+ case 6975:
+ case 6976:
+ case 6977:
+ case 6978:
+ case 6979:
+ case 6980:
+ case 6981:
+ case 6982:
+ case 6983:
+ case 6984:
+ case 6985:
+ case 6986:
+ case 6987:
+ case 6988:
+ case 6989:
+ case 6990:
+ case 6991:
+ case 6992:
+ case 6993:
+ case 6994:
+ case 6995:
+ case 6996:
+ case 6997:
+ case 6998:
+ case 6999:
+ case 7000:
+ case 7001:
+ case 7002:
+ case 7003:
+ case 7004:
+ case 7005:
+ case 7006:
+ case 7007:
+ case 7008:
+ case 7009:
+ case 7010:
+ case 7011:
+ case 7012:
+ case 7013:
+ case 7014:
+ case 7015:
+ case 7016:
+ case 7017:
+ case 7018:
+ case 7019:
+ case 7020:
+ case 7021:
+ case 7022:
+ case 7023:
+ case 7024:
+ case 7025:
+ case 7026:
+ case 7027:
+ case 7028:
+ case 7029:
+ case 7030:
+ case 7031:
+ case 7032:
+ case 7033:
+ case 7034:
+ case 7035:
+ case 7036:
+ case 7037:
+ case 7038:
+ case 7039:
+ case 7040:
+ case 7041:
+ case 7042:
+ case 7043:
+ case 7044:
+ case 7045:
+ case 7046:
+ case 7047:
+ case 7048:
+ case 7049:
+ case 7050:
+ case 7051:
+ case 7052:
+ case 7053:
+ case 7054:
+ case 7055:
+ case 7056:
+ case 7057:
+ case 7058:
+ case 7059:
+ case 7060:
+ case 7061:
+ case 7062:
+ case 7063:
+ case 7064:
+ case 7065:
+ case 7066:
+ case 7067:
+ case 7068:
+ case 7069:
+ case 7070:
+ case 7071:
+ case 7072:
+ case 7073:
+ case 7074:
+ case 7075:
+ case 7076:
+ case 7077:
+ case 7078:
+ case 7079:
+ case 7080:
+ case 7081:
+ case 7082:
+ case 7083:
+ case 7084:
+ case 7085:
+ case 7086:
+ case 7087:
+ case 7088:
+ case 7089:
+ case 7090:
+ case 7091:
+ case 7092:
+ case 7093:
+ case 7094:
+ case 7095:
+ case 7096:
+ case 7097:
+ case 7098:
+ case 7099:
+ case 7100:
+ case 7101:
+ case 7102:
+ case 7103:
+ case 7104:
+ case 7105:
+ case 7106:
+ case 7107:
+ case 7108:
+ case 7109:
+ case 7110:
+ case 7111:
+ case 7112:
+ case 7113:
+ case 7114:
+ case 7115:
+ case 7116:
+ case 7117:
+ case 7118:
+ case 7119:
+ case 7120:
+ case 7121:
+ case 7122:
+ case 7123:
+ case 7124:
+ case 7125:
+ case 7126:
+ case 7127:
+ case 7128:
+ case 7129:
+ case 7130:
+ case 7131:
+ case 7132:
+ case 7133:
+ case 7134:
+ case 7135:
+ case 7136:
+ case 7137:
+ case 7138:
+ case 7139:
+ case 7140:
+ case 7141:
+ case 7142:
+ case 7143:
+ case 7144:
+ case 7145:
+ case 7146:
+ case 7147:
+ case 7148:
+ case 7149:
+ case 7150:
+ case 7151:
+ case 7152:
+ case 7153:
+ case 7154:
+ case 7155:
+ case 7156:
+ case 7157:
+ case 7158:
+ case 7159:
+ case 7160:
+ case 7161:
+ case 7162:
+ case 7163:
+ case 7164:
+ case 7165:
+ case 7166:
+ case 7167:
+ case 7168:
+ case 7169:
+ case 7170:
+ case 7171:
+ case 7172:
+ case 7173:
+ case 7174:
+ case 7175:
+ case 7176:
+ case 7177:
+ case 7178:
+ case 7179:
+ case 7180:
+ case 7181:
+ case 7182:
+ case 7183:
+ case 7184:
+ case 7185:
+ case 7186:
+ case 7187:
+ case 7188:
+ case 7189:
+ case 7190:
+ case 7191:
+ case 7192:
+ case 7193:
+ case 7194:
+ case 7195:
+ case 7196:
+ case 7197:
+ case 7198:
+ case 7199:
+ case 7200:
+ case 7201:
+ case 7202:
+ case 7203:
+ case 7204:
+ case 7205:
+ case 7206:
+ case 7207:
+ case 7208:
+ case 7209:
+ case 7210:
+ case 7211:
+ case 7212:
+ case 7213:
+ case 7214:
+ case 7215:
+ case 7216:
+ case 7217:
+ case 7218:
+ case 7219:
+ case 7220:
+ case 7221:
+ case 7222:
+ case 7223:
+ case 7224:
+ case 7225:
+ case 7226:
+ case 7227:
+ case 7228:
+ case 7229:
+ case 7230:
+ case 7231:
+ case 7232:
+ case 7233:
+ case 7234:
+ case 7235:
+ case 7236:
+ case 7237:
+ case 7238:
+ case 7239:
+ case 7240:
+ case 7241:
+ case 7242:
+ case 7243:
+ case 7244:
+ case 7245:
+ case 7246:
+ case 7247:
+ case 7248:
+ case 7249:
+ case 7250:
+ case 7251:
+ case 7252:
+ case 7253:
+ case 7254:
+ case 7255:
+ case 7256:
+ case 7257:
+ case 7258:
+ case 7259:
+ case 7260:
+ case 7261:
+ case 7262:
+ case 7263:
+ case 7264:
+ case 7265:
+ case 7266:
+ case 7267:
+ case 7268:
+ case 7269:
+ case 7270:
+ case 7271:
+ case 7272:
+ case 7273:
+ case 7274:
+ case 7275:
+ case 7276:
+ case 7277:
+ case 7278:
+ case 7279:
+ case 7280:
+ case 7281:
+ case 7282:
+ case 7283:
+ case 7284:
+ case 7285:
+ case 7286:
+ case 7287:
+ case 7288:
+ case 7289:
+ case 7290:
+ case 7291:
+ case 7292:
+ case 7293:
+ case 7294:
+ case 7295:
+ case 7296:
+ case 7297:
+ case 7298:
+ case 7299:
+ case 7300:
+ case 7301:
+ case 7302:
+ case 7303:
+ case 7304:
+ case 7305:
+ case 7306:
+ case 7307:
+ case 7308:
+ case 7309:
+ case 7310:
+ case 7311:
+ case 7312:
+ case 7313:
+ case 7314:
+ case 7315:
+ case 7316:
+ case 7317:
+ case 7318:
+ case 7319:
+ case 7320:
+ case 7321:
+ case 7322:
+ case 7323:
+ case 7324:
+ case 7325:
+ case 7326:
+ case 7327:
+ case 7328:
+ case 7329:
+ case 7330:
+ case 7331:
+ case 7332:
+ case 7333:
+ case 7334:
+ case 7335:
+ case 7336:
+ case 7337:
+ case 7338:
+ case 7339:
+ case 7340:
+ case 7341:
+ case 7342:
+ case 7343:
+ case 7344:
+ case 7345:
+ case 7346:
+ case 7347:
+ case 7348:
+ case 7349:
+ case 7350:
+ case 7351:
+ case 7352:
+ case 7353:
+ case 7354:
+ case 7355:
+ case 7356:
+ case 7357:
+ case 7358:
+ case 7359:
+ case 7360:
+ case 7361:
+ case 7362:
+ case 7363:
+ case 7364:
+ case 7365:
+ case 7366:
+ case 7367:
+ case 7368:
+ case 7369:
+ case 7370:
+ case 7371:
+ case 7372:
+ case 7373:
+ case 7374:
+ case 7375:
+ case 7376:
+ case 7377:
+ case 7378:
+ case 7379:
+ case 7380:
+ case 7381:
+ case 7382:
+ case 7383:
+ case 7384:
+ case 7385:
+ case 7386:
+ case 7387:
+ case 7388:
+ case 7389:
+ case 7390:
+ case 7391:
+ case 7392:
+ case 7393:
+ case 7394:
+ case 7395:
+ case 7396:
+ case 7397:
+ case 7398:
+ case 7399:
+ case 7400:
+ case 7401:
+ case 7402:
+ case 7403:
+ case 7404:
+ case 7405:
+ case 7406:
+ case 7407:
+ case 7408:
+ case 7409:
+ case 7410:
+ case 7411:
+ case 7412:
+ case 7413:
+ case 7414:
+ case 7415:
+ case 7416:
+ case 7417:
+ case 7418:
+ case 7419:
+ case 7420:
+ case 7421:
+ case 7422:
+ case 7423:
+ case 7424:
+ case 7425:
+ case 7426:
+ case 7427:
+ case 7428:
+ case 7429:
+ case 7430:
+ case 7431:
+ case 7432:
+ case 7433:
+ case 7434:
+ case 7435:
+ case 7436:
+ case 7437:
+ case 7438:
+ case 7439:
+ case 7440:
+ case 7441:
+ case 7442:
+ case 7443:
+ case 7444:
+ case 7445:
+ case 7446:
+ case 7447:
+ case 7448:
+ case 7449:
+ case 7450:
+ case 7451:
+ case 7452:
+ case 7453:
+ case 7454:
+ case 7455:
+ case 7456:
+ case 7457:
+ case 7458:
+ case 7459:
+ case 7460:
+ case 7461:
+ case 7462:
+ case 7463:
+ case 7464:
+ case 7465:
+ case 7466:
+ case 7467:
+ case 7468:
+ case 7469:
+ case 7470:
+ case 7471:
+ case 7472:
+ case 7473:
+ case 7474:
+ case 7475:
+ case 7476:
+ case 7477:
+ case 7478:
+ case 7479:
+ case 7480:
+ case 7481:
+ case 7482:
+ case 7483:
+ case 7484:
+ case 7485:
+ case 7486:
+ case 7487:
+ case 7488:
+ case 7489:
+ case 7490:
+ case 7491:
+ case 7492:
+ case 7493:
+ case 7494:
+ case 7495:
+ case 7496:
+ case 7497:
+ case 7498:
+ case 7499:
+ case 7500:
+ case 7501:
+ case 7502:
+ case 7503:
+ case 7504:
+ case 7505:
+ case 7506:
+ case 7507:
+ case 7508:
+ case 7509:
+ case 7510:
+ case 7511:
+ case 7512:
+ case 7513:
+ case 7514:
+ case 7515:
+ case 7516:
+ case 7517:
+ case 7518:
+ case 7519:
+ case 7520:
+ case 7521:
+ case 7522:
+ case 7523:
+ case 7524:
+ case 7525:
+ case 7526:
+ case 7527:
+ case 7528:
+ case 7529:
+ case 7530:
+ case 7531:
+ case 7532:
+ case 7533:
+ case 7534:
+ case 7535:
+ case 7536:
+ case 7537:
+ case 7538:
+ case 7539:
+ case 7540:
+ case 7541:
+ case 7542:
+ case 7543:
+ case 7544:
+ case 7545:
+ case 7546:
+ case 7547:
+ case 7548:
+ case 7549:
+ case 7550:
+ case 7551:
+ case 7552:
+ case 7553:
+ case 7554:
+ case 7555:
+ case 7556:
+ case 7557:
+ case 7558:
+ case 7559:
+ case 7560:
+ case 7561:
+ case 7562:
+ case 7563:
+ case 7564:
+ case 7565:
+ case 7566:
+ case 7567:
+ case 7568:
+ case 7569:
+ case 7570:
+ case 7571:
+ case 7572:
+ case 7573:
+ case 7574:
+ case 7575:
+ case 7576:
+ case 7577:
+ case 7578:
+ case 7579:
+ case 7580:
+ case 7581:
+ case 7582:
+ case 7583:
+ case 7584:
+ case 7585:
+ case 7586:
+ case 7587:
+ case 7588:
+ case 7589:
+ case 7590:
+ case 7591:
+ case 7592:
+ case 7593:
+ case 7594:
+ case 7595:
+ case 7596:
+ case 7597:
+ case 7598:
+ case 7599:
+ case 7600:
+ case 7601:
+ case 7602:
+ case 7603:
+ case 7604:
+ case 7605:
+ case 7606:
+ case 7607:
+ case 7608:
+ case 7609:
+ case 7610:
+ case 7611:
+ case 7612:
+ case 7613:
+ case 7614:
+ case 7615:
+ case 7616:
+ case 7617:
+ case 7618:
+ case 7619:
+ case 7620:
+ case 7621:
+ case 7622:
+ case 7623:
+ case 7624:
+ case 7625:
+ case 7626:
+ case 7627:
+ case 7628:
+ case 7629:
+ case 7630:
+ case 7631:
+ case 7632:
+ case 7633:
+ case 7634:
+ case 7635:
+ case 7636:
+ case 7637:
+ case 7638:
+ case 7639:
+ case 7640:
+ case 7641:
+ case 7642:
+ case 7643:
+ case 7644:
+ case 7645:
+ case 7646:
+ case 7647:
+ case 7648:
+ case 7649:
+ case 7650:
+ case 7651:
+ case 7652:
+ case 7653:
+ case 7654:
+ case 7655:
+ case 7656:
+ case 7657:
+ case 7658:
+ case 7659:
+ case 7660:
+ case 7661:
+ case 7662:
+ case 7663:
+ case 7664:
+ case 7665:
+ case 7666:
+ case 7667:
+ case 7668:
+ case 7669:
+ case 7670:
+ case 7671:
+ case 7672:
+ case 7673:
+ case 7674:
+ case 7675:
+ case 7676:
+ case 7677:
+ case 7678:
+ case 7679:
+ case 7680:
+ case 7681:
+ case 7682:
+ case 7683:
+ case 7684:
+ case 7685:
+ case 7686:
+ case 7687:
+ case 7688:
+ case 7689:
+ case 7690:
+ case 7691:
+ case 7692:
+ case 7693:
+ case 7694:
+ case 7695:
+ case 7696:
+ case 7697:
+ case 7698:
+ case 7699:
+ case 7700:
+ case 7701:
+ case 7702:
+ case 7703:
+ case 7704:
+ case 7705:
+ case 7706:
+ case 7707:
+ case 7708:
+ case 7709:
+ case 7710:
+ case 7711:
+ case 7712:
+ case 7713:
+ case 7714:
+ case 7715:
+ case 7716:
+ case 7717:
+ case 7718:
+ case 7719:
+ case 7720:
+ case 7721:
+ case 7722:
+ case 7723:
+ case 7724:
+ case 7725:
+ case 7726:
+ case 7727:
+ case 7728:
+ case 7729:
+ case 7730:
+ case 7731:
+ case 7732:
+ case 7733:
+ case 7734:
+ case 7735:
+ case 7736:
+ case 7737:
+ case 7738:
+ case 7739:
+ case 7740:
+ case 7741:
+ case 7742:
+ case 7743:
+ case 7744:
+ case 7745:
+ case 7746:
+ case 7747:
+ case 7748:
+ case 7749:
+ case 7750:
+ case 7751:
+ case 7752:
+ case 7753:
+ case 7754:
+ case 7755:
+ case 7756:
+ case 7757:
+ case 7758:
+ case 7759:
+ case 7760:
+ case 7761:
+ case 7762:
+ case 7763:
+ case 7764:
+ case 7765:
+ case 7766:
+ case 7767:
+ case 7768:
+ case 7769:
+ case 7770:
+ case 7771:
+ case 7772:
+ case 7773:
+ case 7774:
+ case 7775:
+ case 7776:
+ case 7777:
+ case 7778:
+ case 7779:
+ case 7780:
+ case 7781:
+ case 7782:
+ case 7783:
+ case 7784:
+ case 7785:
+ case 7786:
+ case 7787:
+ case 7788:
+ case 7789:
+ case 7790:
+ case 7791:
+ case 7792:
+ case 7793:
+ case 7794:
+ case 7795:
+ case 7796:
+ case 7797:
+ case 7798:
+ case 7799:
+ case 7800:
+ case 7801:
+ case 7802:
+ case 7803:
+ case 7804:
+ case 7805:
+ case 7806:
+ case 7807:
+ case 7808:
+ case 7809:
+ case 7810:
+ case 7811:
+ case 7812:
+ case 7813:
+ case 7814:
+ case 7815:
+ case 7816:
+ case 7817:
+ case 7818:
+ case 7819:
+ case 7820:
+ case 7821:
+ case 7822:
+ case 7823:
+ case 7824:
+ case 7825:
+ case 7826:
+ case 7827:
+ case 7828:
+ case 7829:
+ case 7830:
+ case 7831:
+ case 7832:
+ case 7833:
+ case 7834:
+ case 7835:
+ case 7836:
+ case 7837:
+ case 7838:
+ case 7839:
+ case 7840:
+ case 7841:
+ case 7842:
+ case 7843:
+ case 7844:
+ case 7845:
+ case 7846:
+ case 7847:
+ case 7848:
+ case 7849:
+ case 7850:
+ case 7851:
+ case 7852:
+ case 7853:
+ case 7854:
+ case 7855:
+ case 7856:
+ case 7857:
+ case 7858:
+ case 7859:
+ case 7860:
+ case 7861:
+ case 7862:
+ case 7863:
+ case 7864:
+ case 7865:
+ case 7866:
+ case 7867:
+ case 7868:
+ case 7869:
+ case 7870:
+ case 7871:
+ case 7872:
+ case 7873:
+ case 7874:
+ case 7875:
+ case 7876:
+ case 7877:
+ case 7878:
+ case 7879:
+ case 7880:
+ case 7881:
+ case 7882:
+ case 7883:
+ case 7884:
+ case 7885:
+ case 7886:
+ case 7887:
+ case 7888:
+ case 7889:
+ case 7890:
+ case 7891:
+ case 7892:
+ case 7893:
+ case 7894:
+ case 7895:
+ case 7896:
+ case 7897:
+ case 7898:
+ case 7899:
+ case 7900:
+ case 7901:
+ case 7902:
+ case 7903:
+ case 7904:
+ case 7905:
+ case 7906:
+ case 7907:
+ case 7908:
+ case 7909:
+ case 7910:
+ case 7911:
+ case 7912:
+ case 7913:
+ case 7914:
+ case 7915:
+ case 7916:
+ case 7917:
+ case 7918:
+ case 7919:
+ case 7920:
+ case 7921:
+ case 7922:
+ case 7923:
+ case 7924:
+ case 7925:
+ case 7926:
+ case 7927:
+ case 7928:
+ case 7929:
+ case 7930:
+ case 7931:
+ case 7932:
+ case 7933:
+ case 7934:
+ case 7935:
+ case 7936:
+ case 7937:
+ case 7938:
+ case 7939:
+ case 7940:
+ case 7941:
+ case 7942:
+ case 7943:
+ case 7944:
+ case 7945:
+ case 7946:
+ case 7947:
+ case 7948:
+ case 7949:
+ case 7950:
+ case 7951:
+ case 7952:
+ case 7953:
+ case 7954:
+ case 7955:
+ case 7956:
+ case 7957:
+ case 7958:
+ case 7959:
+ case 7960:
+ case 7961:
+ case 7962:
+ case 7963:
+ case 7964:
+ case 7965:
+ case 7966:
+ case 7967:
+ case 7968:
+ case 7969:
+ case 7970:
+ case 7971:
+ case 7972:
+ case 7973:
+ case 7974:
+ case 7975:
+ case 7976:
+ case 7977:
+ case 7978:
+ case 7979:
+ case 7980:
+ case 7981:
+ case 7982:
+ case 7983:
+ case 7984:
+ case 7985:
+ case 7986:
+ case 7987:
+ case 7988:
+ case 7989:
+ case 7990:
+ case 7991:
+ case 7992:
+ case 7993:
+ case 7994:
+ case 7995:
+ case 7996:
+ case 7997:
+ case 7998:
+ case 7999:
+ case 8000:
+ case 8001:
+ case 8002:
+ case 8003:
+ case 8004:
+ case 8005:
+ case 8006:
+ case 8007:
+ case 8008:
+ case 8009:
+ case 8010:
+ case 8011:
+ case 8012:
+ case 8013:
+ case 8014:
+ case 8015:
+ case 8016:
+ case 8017:
+ case 8018:
+ case 8019:
+ case 8020:
+ case 8021:
+ case 8022:
+ case 8023:
+ case 8024:
+ case 8025:
+ case 8026:
+ case 8027:
+ case 8028:
+ case 8029:
+ case 8030:
+ case 8031:
+ case 8032:
+ case 8033:
+ case 8034:
+ case 8035:
+ case 8036:
+ case 8037:
+ case 8038:
+ case 8039:
+ case 8040:
+ case 8041:
+ case 8042:
+ case 8043:
+ case 8044:
+ case 8045:
+ case 8046:
+ case 8047:
+ case 8048:
+ case 8049:
+ case 8050:
+ case 8051:
+ case 8052:
+ case 8053:
+ case 8054:
+ case 8055:
+ case 8056:
+ case 8057:
+ case 8058:
+ case 8059:
+ case 8060:
+ case 8061:
+ case 8062:
+ case 8063:
+ case 8064:
+ case 8065:
+ case 8066:
+ case 8067:
+ case 8068:
+ case 8069:
+ case 8070:
+ case 8071:
+ case 8072:
+ case 8073:
+ case 8074:
+ case 8075:
+ case 8076:
+ case 8077:
+ case 8078:
+ case 8079:
+ case 8080:
+ case 8081:
+ case 8082:
+ case 8083:
+ case 8084:
+ case 8085:
+ case 8086:
+ case 8087:
+ case 8088:
+ case 8089:
+ case 8090:
+ case 8091:
+ case 8092:
+ case 8093:
+ case 8094:
+ case 8095:
+ case 8096:
+ case 8097:
+ case 8098:
+ case 8099:
+ case 8100:
+ case 8101:
+ case 8102:
+ case 8103:
+ case 8104:
+ case 8105:
+ case 8106:
+ case 8107:
+ case 8108:
+ case 8109:
+ case 8110:
+ case 8111:
+ case 8112:
+ case 8113:
+ case 8114:
+ case 8115:
+ case 8116:
+ case 8117:
+ case 8118:
+ case 8119:
+ case 8120:
+ case 8121:
+ case 8122:
+ case 8123:
+ case 8124:
+ case 8125:
+ case 8126:
+ case 8127:
+ case 8128:
+ case 8129:
+ case 8130:
+ case 8131:
+ case 8132:
+ case 8133:
+ case 8134:
+ case 8135:
+ case 8136:
+ case 8137:
+ case 8138:
+ case 8139:
+ case 8140:
+ case 8141:
+ case 8142:
+ case 8143:
+ case 8144:
+ case 8145:
+ case 8146:
+ case 8147:
+ case 8148:
+ case 8149:
+ case 8150:
+ case 8151:
+ case 8152:
+ case 8153:
+ case 8154:
+ case 8155:
+ case 8156:
+ case 8157:
+ case 8158:
+ case 8159:
+ case 8160:
+ case 8161:
+ case 8162:
+ case 8163:
+ case 8164:
+ case 8165:
+ case 8166:
+ case 8167:
+ case 8168:
+ case 8169:
+ case 8170:
+ case 8171:
+ case 8172:
+ case 8173:
+ case 8174:
+ case 8175:
+ case 8176:
+ case 8177:
+ case 8178:
+ case 8179:
+ case 8180:
+ case 8181:
+ case 8182:
+ case 8183:
+ case 8184:
+ case 8185:
+ case 8186:
+ case 8187:
+ case 8188:
+ case 8189:
+ case 8190:
+ case 8191:
+ case 8192:
+ case 8193:
+ case 8194:
+ case 8195:
+ case 8196:
+ case 8197:
+ case 8198:
+ case 8199:
+ case 8200:
+ case 8201:
+ case 8202:
+ case 8203:
+ case 8204:
+ case 8205:
+ case 8206:
+ case 8207:
+ case 8208:
+ case 8209:
+ case 8210:
+ case 8211:
+ case 8212:
+ case 8213:
+ case 8214:
+ case 8215:
+ case 8216:
+ case 8217:
+ case 8218:
+ case 8219:
+ case 8220:
+ case 8221:
+ case 8222:
+ case 8223:
+ case 8224:
+ case 8225:
+ case 8226:
+ case 8227:
+ case 8228:
+ case 8229:
+ case 8230:
+ case 8231:
+ case 8232:
+ case 8233:
+ case 8234:
+ case 8235:
+ case 8236:
+ case 8237:
+ case 8238:
+ case 8239:
+ case 8240:
+ case 8241:
+ case 8242:
+ case 8243:
+ case 8244:
+ case 8245:
+ case 8246:
+ case 8247:
+ case 8248:
+ case 8249:
+ case 8250:
+ case 8251:
+ case 8252:
+ case 8253:
+ case 8254:
+ case 8255:
+ case 8256:
+ case 8257:
+ case 8258:
+ case 8259:
+ case 8260:
+ case 8261:
+ case 8262:
+ case 8263:
+ case 8264:
+ case 8265:
+ case 8266:
+ case 8267:
+ case 8268:
+ case 8269:
+ case 8270:
+ case 8271:
+ case 8272:
+ case 8273:
+ case 8274:
+ case 8275:
+ case 8276:
+ case 8277:
+ case 8278:
+ case 8279:
+ case 8280:
+ case 8281:
+ case 8282:
+ case 8283:
+ case 8284:
+ case 8285:
+ case 8286:
+ case 8287:
+ case 8288:
+ case 8289:
+ case 8290:
+ case 8291:
+ case 8292:
+ case 8293:
+ case 8294:
+ case 8295:
+ case 8296:
+ case 8297:
+ case 8298:
+ case 8299:
+ case 8300:
+ case 8301:
+ case 8302:
+ case 8303:
+ case 8304:
+ case 8305:
+ case 8306:
+ case 8307:
+ case 8308:
+ case 8309:
+ case 8310:
+ case 8311:
+ case 8312:
+ case 8313:
+ case 8314:
+ case 8315:
+ case 8316:
+ case 8317:
+ case 8318:
+ case 8319:
+ case 8320:
+ case 8321:
+ case 8322:
+ case 8323:
+ case 8324:
+ case 8325:
+ case 8326:
+ case 8327:
+ case 8328:
+ case 8329:
+ case 8330:
+ case 8331:
+ case 8332:
+ case 8333:
+ case 8334:
+ case 8335:
+ case 8336:
+ case 8337:
+ case 8338:
+ case 8339:
+ case 8340:
+ case 8341:
+ case 8342:
+ case 8343:
+ case 8344:
+ case 8345:
+ case 8346:
+ case 8347:
+ case 8348:
+ case 8349:
+ case 8350:
+ case 8351:
+ case 8352:
+ case 8353:
+ case 8354:
+ case 8355:
+ case 8356:
+ case 8357:
+ case 8358:
+ case 8359:
+ case 8360:
+ case 8361:
+ case 8362:
+ case 8363:
+ case 8364:
+ case 8365:
+ case 8366:
+ case 8367:
+ case 8368:
+ case 8369:
+ case 8370:
+ case 8371:
+ case 8372:
+ case 8373:
+ case 8374:
+ case 8375:
+ case 8376:
+ case 8377:
+ case 8378:
+ case 8379:
+ case 8380:
+ case 8381:
+ case 8382:
+ case 8383:
+ case 8384:
+ case 8385:
+ case 8386:
+ case 8387:
+ case 8388:
+ case 8389:
+ case 8390:
+ case 8391:
+ case 8392:
+ case 8393:
+ case 8394:
+ case 8395:
+ case 8396:
+ case 8397:
+ case 8398:
+ case 8399:
+ case 8400:
+ case 8401:
+ case 8402:
+ case 8403:
+ case 8404:
+ case 8405:
+ case 8406:
+ case 8407:
+ case 8408:
+ case 8409:
+ case 8410:
+ case 8411:
+ case 8412:
+ case 8413:
+ case 8414:
+ case 8415:
+ case 8416:
+ case 8417:
+ case 8418:
+ case 8419:
+ case 8420:
+ case 8421:
+ case 8422:
+ case 8423:
+ case 8424:
+ case 8425:
+ case 8426:
+ case 8427:
+ case 8428:
+ case 8429:
+ case 8430:
+ case 8431:
+ case 8432:
+ case 8433:
+ case 8434:
+ case 8435:
+ case 8436:
+ case 8437:
+ case 8438:
+ case 8439:
+ case 8440:
+ case 8441:
+ case 8442:
+ case 8443:
+ case 8444:
+ case 8445:
+ case 8446:
+ case 8447:
+ case 8448:
+ case 8449:
+ case 8450:
+ case 8451:
+ case 8452:
+ case 8453:
+ case 8454:
+ case 8455:
+ case 8456:
+ case 8457:
+ case 8458:
+ case 8459:
+ case 8460:
+ case 8461:
+ case 8462:
+ case 8463:
+ case 8464:
+ case 8465:
+ case 8466:
+ case 8467:
+ case 8468:
+ case 8469:
+ case 8470:
+ case 8471:
+ case 8472:
+ case 8473:
+ case 8474:
+ case 8475:
+ case 8476:
+ case 8477:
+ case 8478:
+ case 8479:
+ case 8480:
+ case 8481:
+ case 8482:
+ case 8483:
+ case 8484:
+ case 8485:
+ case 8486:
+ case 8487:
+ case 8488:
+ case 8489:
+ case 8490:
+ case 8491:
+ case 8492:
+ case 8493:
+ case 8494:
+ case 8495:
+ case 8496:
+ case 8497:
+ case 8498:
+ case 8499:
+ case 8500:
+ case 8501:
+ case 8502:
+ case 8503:
+ case 8504:
+ case 8505:
+ case 8506:
+ case 8507:
+ case 8508:
+ case 8509:
+ case 8510:
+ case 8511:
+ case 8512:
+ case 8513:
+ case 8514:
+ case 8515:
+ case 8516:
+ case 8517:
+ case 8518:
+ case 8519:
+ case 8520:
+ case 8521:
+ case 8522:
+ case 8523:
+ case 8524:
+ case 8525:
+ case 8526:
+ case 8527:
+ case 8528:
+ case 8529:
+ case 8530:
+ case 8531:
+ case 8532:
+ case 8533:
+ case 8534:
+ case 8535:
+ case 8536:
+ case 8537:
+ case 8538:
+ case 8539:
+ case 8540:
+ case 8541:
+ case 8542:
+ case 8543:
+ case 8544:
+ case 8545:
+ case 8546:
+ case 8547:
+ case 8548:
+ case 8549:
+ case 8550:
+ case 8551:
+ case 8552:
+ case 8553:
+ case 8554:
+ case 8555:
+ case 8556:
+ case 8557:
+ case 8558:
+ case 8559:
+ case 8560:
+ case 8561:
+ case 8562:
+ case 8563:
+ case 8564:
+ case 8565:
+ case 8566:
+ case 8567:
+ case 8568:
+ case 8569:
+ case 8570:
+ case 8571:
+ case 8572:
+ case 8573:
+ case 8574:
+ case 8575:
+ case 8576:
+ case 8577:
+ case 8578:
+ case 8579:
+ case 8580:
+ case 8581:
+ case 8582:
+ case 8583:
+ case 8584:
+ case 8585:
+ case 8586:
+ case 8587:
+ case 8588:
+ case 8589:
+ case 8590:
+ case 8591:
+ case 8592:
+ case 8593:
+ case 8594:
+ case 8595:
+ case 8596:
+ case 8597:
+ case 8598:
+ case 8599:
+ case 8600:
+ case 8601:
+ case 8602:
+ case 8603:
+ case 8604:
+ case 8605:
+ case 8606:
+ case 8607:
+ case 8608:
+ case 8609:
+ case 8610:
+ case 8611:
+ case 8612:
+ case 8613:
+ case 8614:
+ case 8615:
+ case 8616:
+ case 8617:
+ case 8618:
+ case 8619:
+ case 8620:
+ case 8621:
+ case 8622:
+ case 8623:
+ case 8624:
+ case 8625:
+ case 8626:
+ case 8627:
+ case 8628:
+ case 8629:
+ case 8630:
+ case 8631:
+ case 8632:
+ case 8633:
+ case 8634:
+ case 8635:
+ case 8636:
+ case 8637:
+ case 8638:
+ case 8639:
+ case 8640:
+ case 8641:
+ case 8642:
+ case 8643:
+ case 8644:
+ case 8645:
+ case 8646:
+ case 8647:
+ case 8648:
+ case 8649:
+ case 8650:
+ case 8651:
+ case 8652:
+ case 8653:
+ case 8654:
+ case 8655:
+ case 8656:
+ case 8657:
+ case 8658:
+ case 8659:
+ case 8660:
+ case 8661:
+ case 8662:
+ case 8663:
+ case 8664:
+ case 8665:
+ case 8666:
+ case 8667:
+ case 8668:
+ case 8669:
+ case 8670:
+ case 8671:
+ case 8672:
+ case 8673:
+ case 8674:
+ case 8675:
+ case 8676:
+ case 8677:
+ case 8678:
+ case 8679:
+ case 8680:
+ case 8681:
+ case 8682:
+ case 8683:
+ case 8684:
+ case 8685:
+ case 8686:
+ case 8687:
+ case 8688:
+ case 8689:
+ case 8690:
+ case 8691:
+ case 8692:
+ case 8693:
+ case 8694:
+ case 8695:
+ case 8696:
+ case 8697:
+ case 8698:
+ case 8699:
+ case 8700:
+ case 8701:
+ case 8702:
+ case 8703:
+ case 8704:
+ case 8705:
+ case 8706:
+ case 8707:
+ case 8708:
+ case 8709:
+ case 8710:
+ case 8711:
+ case 8712:
+ case 8713:
+ case 8714:
+ case 8715:
+ case 8716:
+ case 8717:
+ case 8718:
+ case 8719:
+ case 8720:
+ case 8721:
+ case 8722:
+ case 8723:
+ case 8724:
+ case 8725:
+ case 8726:
+ case 8727:
+ case 8728:
+ case 8729:
+ case 8730:
+ case 8731:
+ case 8732:
+ case 8733:
+ case 8734:
+ case 8735:
+ case 8736:
+ case 8737:
+ case 8738:
+ case 8739:
+ case 8740:
+ case 8741:
+ case 8742:
+ case 8743:
+ case 8744:
+ case 8745:
+ case 8746:
+ case 8747:
+ case 8748:
+ case 8749:
+ case 8750:
+ case 8751:
+ case 8752:
+ case 8753:
+ case 8754:
+ case 8755:
+ case 8756:
+ case 8757:
+ case 8758:
+ case 8759:
+ case 8760:
+ case 8761:
+ case 8762:
+ case 8763:
+ case 8764:
+ case 8765:
+ case 8766:
+ case 8767:
+ case 8768:
+ case 8769:
+ case 8770:
+ case 8771:
+ case 8772:
+ case 8773:
+ case 8774:
+ case 8775:
+ case 8776:
+ case 8777:
+ case 8778:
+ case 8779:
+ case 8780:
+ case 8781:
+ case 8782:
+ case 8783:
+ case 8784:
+ case 8785:
+ case 8786:
+ case 8787:
+ case 8788:
+ case 8789:
+ case 8790:
+ case 8791:
+ case 8792:
+ case 8793:
+ case 8794:
+ case 8795:
+ case 8796:
+ case 8797:
+ case 8798:
+ case 8799:
+ case 8800:
+ case 8801:
+ case 8802:
+ case 8803:
+ case 8804:
+ case 8805:
+ case 8806:
+ case 8807:
+ case 8808:
+ case 8809:
+ case 8810:
+ case 8811:
+ case 8812:
+ case 8813:
+ case 8814:
+ case 8815:
+ case 8816:
+ case 8817:
+ case 8818:
+ case 8819:
+ case 8820:
+ case 8821:
+ case 8822:
+ case 8823:
+ case 8824:
+ case 8825:
+ case 8826:
+ case 8827:
+ case 8828:
+ case 8829:
+ case 8830:
+ case 8831:
+ case 8832:
+ case 8833:
+ case 8834:
+ case 8835:
+ case 8836:
+ case 8837:
+ case 8838:
+ case 8839:
+ case 8840:
+ case 8841:
+ case 8842:
+ case 8843:
+ case 8844:
+ case 8845:
+ case 8846:
+ case 8847:
+ case 8848:
+ case 8849:
+ case 8850:
+ case 8851:
+ case 8852:
+ case 8853:
+ case 8854:
+ case 8855:
+ case 8856:
+ case 8857:
+ case 8858:
+ case 8859:
+ case 8860:
+ case 8861:
+ case 8862:
+ case 8863:
+ case 8864:
+ case 8865:
+ case 8866:
+ case 8867:
+ case 8868:
+ case 8869:
+ case 8870:
+ case 8871:
+ case 8872:
+ case 8873:
+ case 8874:
+ case 8875:
+ case 8876:
+ case 8877:
+ case 8878:
+ case 8879:
+ case 8880:
+ case 8881:
+ case 8882:
+ case 8883:
+ case 8884:
+ case 8885:
+ case 8886:
+ case 8887:
+ case 8888:
+ case 8889:
+ case 8890:
+ case 8891:
+ case 8892:
+ case 8893:
+ case 8894:
+ case 8895:
+ case 8896:
+ case 8897:
+ case 8898:
+ case 8899:
+ case 8900:
+ case 8901:
+ case 8902:
+ case 8903:
+ case 8904:
+ case 8905:
+ case 8906:
+ case 8907:
+ case 8908:
+ case 8909:
+ case 8910:
+ case 8911:
+ case 8912:
+ case 8913:
+ case 8914:
+ case 8915:
+ case 8916:
+ case 8917:
+ case 8918:
+ case 8919:
+ case 8920:
+ case 8921:
+ case 8922:
+ case 8923:
+ case 8924:
+ case 8925:
+ case 8926:
+ case 8927:
+ case 8928:
+ case 8929:
+ case 8930:
+ case 8931:
+ case 8932:
+ case 8933:
+ case 8934:
+ case 8935:
+ case 8936:
+ case 8937:
+ case 8938:
+ case 8939:
+ case 8940:
+ case 8941:
+ case 8942:
+ case 8943:
+ case 8944:
+ case 8945:
+ case 8946:
+ case 8947:
+ case 8948:
+ case 8949:
+ case 8950:
+ case 8951:
+ case 8952:
+ case 8953:
+ case 8954:
+ case 8955:
+ case 8956:
+ case 8957:
+ case 8958:
+ case 8959:
+ case 8960:
+ case 8961:
+ case 8962:
+ case 8963:
+ case 8964:
+ case 8965:
+ case 8966:
+ case 8967:
+ case 8968:
+ case 8969:
+ case 8970:
+ case 8971:
+ case 8972:
+ case 8973:
+ case 8974:
+ case 8975:
+ case 8976:
+ case 8977:
+ case 8978:
+ case 8979:
+ case 8980:
+ case 8981:
+ case 8982:
+ case 8983:
+ case 8984:
+ case 8985:
+ case 8986:
+ case 8987:
+ case 8988:
+ case 8989:
+ case 8990:
+ case 8991:
+ case 8992:
+ case 8993:
+ case 8994:
+ case 8995:
+ case 8996:
+ case 8997:
+ case 8998:
+ case 8998: // DUPLICATE LABEL
+ actual += 'a';
+ case 8999:
+ actual += 'b';
+}
+expect = 'ab';
+addThis();
+
+
+
+//---------------------------------------------------------------------------------
+test();
+//---------------------------------------------------------------------------------
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ for (var i = 0; i < UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-83532-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-83532-001.js
new file mode 100644
index 0000000..8bde123
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-83532-001.js
@@ -0,0 +1,48 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS
+* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+* implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation. All
+* Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+* Date: 01 June 2001
+*
+* SUMMARY: Testing that we don't crash on switch case -1...
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=83532
+*
+*/
+//-------------------------------------------------------------------------------------------------
+var bug = 83532;
+var summary = "Testing that we don't crash on switch case -1";
+
+//-------------------------------------------------------------------------------------------------
+test();
+//-------------------------------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ // Just testing that we don't crash on these -
+ function f () {switch(1) {case -1:}}
+ function g(){switch(1){case (-1):}}
+ var h = function() {switch(1) {case -1:}}
+ f();
+ g();
+ h();
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-83532-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-83532-002.js
new file mode 100644
index 0000000..085eebf
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-83532-002.js
@@ -0,0 +1,51 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS
+* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+* implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation. All
+* Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+* Date: 01 June 2001
+*
+* SUMMARY: Testing that we don't crash on switch case -1...
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=83532
+*
+*/
+//-------------------------------------------------------------------------------------------------
+var bug = 83532;
+var summary = "Testing that we don't crash on switch case -1";
+var sToEval = '';
+
+//-------------------------------------------------------------------------------------------------
+test();
+//-------------------------------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ // Just testing that we don't crash on these -
+ sToEval += 'function f () {switch(1) {case -1:}};';
+ sToEval += 'function g(){switch(1){case (-1):}};';
+ sToEval += 'var h = function() {switch(1) {case -1:}};'
+ sToEval += 'f();';
+ sToEval += 'g();';
+ sToEval += 'h();';
+ eval(sToEval);
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/switch-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/switch-001.js
new file mode 100644
index 0000000..5dd8b47
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/switch-001.js
@@ -0,0 +1,122 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS"
+* basis, WITHOUT WARRANTY OF ANY KIND, either expressed
+* or implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation. All
+* Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+* Date: 07 May 2001
+*
+* SUMMARY: Testing the switch statement
+*
+* See ECMA3 Section 12.11, "The switch Statement"
+*/
+//-------------------------------------------------------------------------------------------------
+var UBound = 0;
+var bug = '(none)';
+var summary = 'Testing the switch statement';
+var cnMatch = 'Match';
+var cnNoMatch = 'NoMatch';
+var status = '';
+var statusitems = [ ];
+var actual = '';
+var actualvalues = [ ];
+var expect= '';
+var expectedvalues = [ ];
+
+
+status = 'Section A of test';
+actual = match(17, f(fInverse(17)), f, fInverse);
+expect = cnMatch;
+addThis();
+
+status = 'Section B of test';
+actual = match(17, 18, f, fInverse);
+expect = cnNoMatch;
+addThis();
+
+status = 'Section C of test';
+actual = match(1, 1, Math.exp, Math.log);
+expect = cnMatch;
+addThis();
+
+status = 'Section D of test';
+actual = match(1, 2, Math.exp, Math.log);
+expect = cnNoMatch;
+addThis();
+
+status = 'Section E of test';
+actual = match(1, 1, Math.sin, Math.cos);
+expect = cnNoMatch;
+addThis();
+
+
+
+//---------------------------------------------------------------------------------
+test();
+//---------------------------------------------------------------------------------
+
+
+
+/*
+ * If F,G are inverse functions and x==y, this should return cnMatch -
+ */
+function match(x, y, F, G)
+{
+ switch (x)
+ {
+ case F(G(y)):
+ return cnMatch;
+
+ default:
+ return cnNoMatch;
+ }
+}
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ for (var i = 0; i < UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
+
+
+function f(m)
+{
+ return 2*(m+1);
+}
+
+
+function fInverse(n)
+{
+ return (n-2)/2;
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/String/regress-104375.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/String/regress-104375.js
new file mode 100644
index 0000000..42b5ce2
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/String/regress-104375.js
@@ -0,0 +1,95 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS
+* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+* implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation.
+* All Rights Reserved.
+*
+* Contributor(s): k.mike@gmx.net, pschwartau@netscape.com
+* Date: 12 October 2001
+*
+* SUMMARY: Regression test for string.replace bug 104375
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=104375
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 104375;
+var summary = 'Testing string.replace() with backreferences';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+/*
+ * Use the regexp to replace 'uid=31' with 'uid=15'
+ *
+ * In the second parameter of string.replace() method,
+ * "$1" refers to the first backreference: 'uid='
+ */
+var str = 'uid=31';
+var re = /(uid=)(\d+)/;
+
+// try the numeric literal 15
+status = inSection(1);
+actual = str.replace (re, "$1" + 15);
+expect = 'uid=15';
+addThis();
+
+// try the string literal '15'
+status = inSection(2);
+actual = str.replace (re, "$1" + '15');
+expect = 'uid=15';
+addThis();
+
+// try a letter before the '15'
+status = inSection(3);
+actual = str.replace (re, "$1" + 'A15');
+expect = 'uid=A15';
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
+
+
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/String/regress-189898.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/String/regress-189898.js
new file mode 100644
index 0000000..e237152
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/String/regress-189898.js
@@ -0,0 +1,152 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2003
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): igor@icesoft.no, pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 21 January 2003
+* SUMMARY: Regression test for bug 189898
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=189898
+*
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 189898;
+var summary = 'Regression test for bug 189898';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+status = inSection(1);
+actual = 'XaXY'.replace('XY', '--')
+expect = 'Xa--';
+addThis();
+
+status = inSection(2);
+actual = '$a$^'.replace('$^', '--')
+expect = '$a--';
+addThis();
+
+status = inSection(3);
+actual = 'ababc'.replace('abc', '--')
+expect = 'ab--';
+addThis();
+
+status = inSection(4);
+actual = 'ababc'.replace('abc', '^$')
+expect = 'ab^$';
+addThis();
+
+
+
+/*
+ * Same as above, but providing a regexp in the first parameter
+ * to String.prototype.replace() instead of a string.
+ *
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=83293
+ * for subtleties on this issue -
+ */
+status = inSection(5);
+actual = 'XaXY'.replace(/XY/, '--')
+expect = 'Xa--';
+addThis();
+
+status = inSection(6);
+actual = 'XaXY'.replace(/XY/g, '--')
+expect = 'Xa--';
+addThis();
+
+status = inSection(7);
+actual = '$a$^'.replace(/\$\^/, '--')
+expect = '$a--';
+addThis();
+
+status = inSection(8);
+actual = '$a$^'.replace(/\$\^/g, '--')
+expect = '$a--';
+addThis();
+
+status = inSection(9);
+actual = 'ababc'.replace(/abc/, '--')
+expect = 'ab--';
+addThis();
+
+status = inSection(10);
+actual = 'ababc'.replace(/abc/g, '--')
+expect = 'ab--';
+addThis();
+
+status = inSection(11);
+actual = 'ababc'.replace(/abc/, '^$')
+expect = 'ab^$';
+addThis();
+
+status = inSection(12);
+actual = 'ababc'.replace(/abc/g, '^$')
+expect = 'ab^$';
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/String/regress-83293.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/String/regress-83293.js
new file mode 100644
index 0000000..02a7834
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/String/regress-83293.js
@@ -0,0 +1,193 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS
+* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+* implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation. All
+* Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com, jim@jibbering.com
+* Creation Date: 30 May 2001
+* Correction Date: 14 Aug 2001
+*
+* SUMMARY: Regression test for bugs 83293, 103351
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=83293
+* http://bugzilla.mozilla.org/show_bug.cgi?id=103351
+* http://bugzilla.mozilla.org/show_bug.cgi?id=92942
+*
+*
+* ******************** CORRECTION !!! *****************************
+*
+* When I originally wrote this test, I thought this was true:
+* str.replace(strA, strB) == str.replace(new RegExp(strA),strB).
+* See ECMA-262 Final Draft, 15.5.4.11 String.prototype.replace
+*
+* However, in http://bugzilla.mozilla.org/show_bug.cgi?id=83293
+* Jim Ley points out the ECMA-262 Final Edition changed on this.
+* String.prototype.replace (searchValue, replaceValue), if provided
+* a searchValue that is not a RegExp, is NO LONGER to replace it with
+*
+* new RegExp(searchValue)
+* but rather:
+* String(searchValue)
+*
+* This puts the replace() method at variance with search() and match(),
+* which continue to follow the RegExp conversion of the Final Draft.
+* It also makes most of this testcase, as originally written, invalid.
+**********************************************************************
+*/
+//-----------------------------------------------------------------------------
+var bug = 103351; // <--- (Outgrowth of original bug 83293)
+var summ_OLD = 'Testing str.replace(strA, strB) == str.replace(new RegExp(strA),strB)';
+var summ_NEW = 'Testing String.prototype.replace(x,y) when x is a string';
+var summary = summ_NEW;
+var status = '';
+var actual = '';
+var expect= '';
+var cnEmptyString = '';
+var str = 'abc';
+var strA = cnEmptyString;
+var strB = 'Z';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+/*
+ * In this test, it's important to reportCompare() each other case
+ * BEFORE the last two cases are attempted. Don't store all results
+ * in an array and reportCompare() them at the end, as we usually do.
+ *
+ * When this bug was filed, str.replace(strA, strB) would return no value
+ * whatsoever if strA == cnEmptyString, and no error, either -
+ */
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+/******************* THESE WERE INCORRECT; SEE ABOVE ************************
+ status = 'Section A of test';
+ strA = 'a';
+ actual = str.replace(strA, strB);
+ expect = str.replace(new RegExp(strA), strB);
+ reportCompare(expect, actual, status);
+
+ status = 'Section B of test';
+ strA = 'x';
+ actual = str.replace(strA, strB);
+ expect = str.replace(new RegExp(strA), strB);
+ reportCompare(expect, actual, status);
+
+ status = 'Section C of test';
+ strA = undefined;
+ actual = str.replace(strA, strB);
+ expect = str.replace(new RegExp(strA), strB);
+ reportCompare(expect, actual, status);
+
+ status = 'Section D of test';
+ strA = null;
+ actual = str.replace(strA, strB);
+ expect = str.replace(new RegExp(strA), strB);
+ reportCompare(expect, actual, status);
+
+
+ * This example is from jim@jibbering.com (see Bugzilla bug 92942)
+ * It is a variation on the example below.
+ *
+ * Namely, we are using the regexp /$/ instead of the regexp //.
+ * The regexp /$/ means we should match the "empty string" at the
+ * end-boundary of the word, instead of the one at the beginning.
+ *
+ status = 'Section E of test';
+ var strJim = 'aa$aa';
+ strA = '$';
+ actual = strJim.replace(strA, strB); // bug -> 'aaZaa'
+ expect = strJim.replace(new RegExp(strA), strB); // expect 'aa$aaZ'
+ reportCompare(expect, actual, status);
+
+
+ *
+ * Note: 'Zabc' is the result we expect for 'abc'.replace('', 'Z').
+ *
+ * The string '' is supposed to be equivalent to new RegExp('') = //.
+ * The regexp // means we should match the "empty string" conceived of
+ * at the beginning boundary of the word, before the first character.
+ *
+ status = 'Section F of test';
+ strA = cnEmptyString;
+ actual = str.replace(strA, strB);
+ expect = 'Zabc';
+ reportCompare(expect, actual, status);
+
+ status = 'Section G of test';
+ strA = cnEmptyString;
+ actual = str.replace(strA, strB);
+ expect = str.replace(new RegExp(strA), strB);
+ reportCompare(expect, actual, status);
+
+************************* END OF INCORRECT CASES ****************************/
+
+
+////////////////////////// OK, LET'S START OVER //////////////////////////////
+
+ status = 'Section 1 of test';
+ actual = 'abc'.replace('a', 'Z');
+ expect = 'Zbc';
+ reportCompare(expect, actual, status);
+
+ status = 'Section 2 of test';
+ actual = 'abc'.replace('b', 'Z');
+ expect = 'aZc';
+ reportCompare(expect, actual, status);
+
+ status = 'Section 3 of test';
+ actual = 'abc'.replace(undefined, 'Z');
+ expect = 'abc'; // String(undefined) == 'undefined'; no replacement possible
+ reportCompare(expect, actual, status);
+
+ status = 'Section 4 of test';
+ actual = 'abc'.replace(null, 'Z');
+ expect = 'abc'; // String(null) == 'null'; no replacement possible
+ reportCompare(expect, actual, status);
+
+ status = 'Section 5 of test';
+ actual = 'abc'.replace(true, 'Z');
+ expect = 'abc'; // String(true) == 'true'; no replacement possible
+ reportCompare(expect, actual, status);
+
+ status = 'Section 6 of test';
+ actual = 'abc'.replace(false, 'Z');
+ expect = 'abc'; // String(false) == 'false'; no replacement possible
+ reportCompare(expect, actual, status);
+
+ status = 'Section 7 of test';
+ actual = 'aa$aa'.replace('$', 'Z');
+ expect = 'aaZaa'; // NOT 'aa$aaZ' as in ECMA Final Draft; see above
+ reportCompare(expect, actual, status);
+
+ status = 'Section 8 of test';
+ actual = 'abc'.replace('.*', 'Z');
+ expect = 'abc'; // not 'Z' as in EMCA Final Draft
+ reportCompare(expect, actual, status);
+
+ status = 'Section 9 of test';
+ actual = 'abc'.replace('', 'Z');
+ expect = 'Zabc'; // Still expect 'Zabc' for this
+ reportCompare(expect, actual, status);
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-001-n.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-001-n.js
new file mode 100644
index 0000000..6527c16
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-001-n.js
@@ -0,0 +1,44 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ * Rob Ginda rginda@netscape.com
+ */
+
+test();
+
+function test()
+{
+ enterFunc ("test");
+
+ printStatus ("Unicode Characters 1C-1F negative test.");
+ printBugNumber (23612);
+
+ reportCompare ("error", eval ("'no'\u001C+' error'"),
+ "Unicode whitespace test (1C.)");
+ reportCompare ("error", eval ("'no'\u001D+' error'"),
+ "Unicode whitespace test (1D.)");
+ reportCompare ("error", eval ("'no'\u001E+' error'"),
+ "Unicode whitespace test (1E.)");
+ reportCompare ("error", eval ("'no'\u001F+' error'"),
+ "Unicode whitespace test (1F.)");
+
+ exitFunc ("test");
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-001.js
new file mode 100644
index 0000000..470e8bc
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-001.js
@@ -0,0 +1,38 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ * Rob Ginda rginda@netscape.com
+ */
+
+test();
+
+function test()
+{
+ enterFunc ("test");
+
+ printStatus ("Unicode format-control character (Category Cf) test.");
+ printBugNumber (23610);
+
+ reportCompare ("no error", eval('"no\u200E error"'),
+ "Unicode format-control character test (Category Cf.)");
+
+ exitFunc ("test");
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-002-n.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-002-n.js
new file mode 100644
index 0000000..9c54a26
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-002-n.js
@@ -0,0 +1,38 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ * Rob Ginda rginda@netscape.com
+ */
+
+test();
+
+function test()
+{
+ enterFunc ("test");
+
+ printStatus ("Non-character escapes in identifiers negative test.");
+ printBugNumber (23607);
+
+ reportCompare ("error", eval("\u0020 = 5"),
+ "Non-character escapes in identifiers negative test.");
+
+ exitFunc ("test");
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-002.js
new file mode 100644
index 0000000..3b05d83
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-002.js
@@ -0,0 +1,42 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ * Rob Ginda rginda@netscape.com
+ */
+
+test();
+
+function test()
+{
+ enterFunc ("test");
+
+ printStatus ("Unicode non-breaking space character test.");
+ printBugNumber (23613);
+
+ reportCompare ("no error", eval("'no'\u00A0+ ' error'"),
+ "Unicode non-breaking space character test.");
+
+ var str = "\u00A0foo";
+ reportCompare (0, str.search(/^\sfoo$/),
+ "Unicode non-breaking space character regexp test.");
+
+ exitFunc ("test");
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-003.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-003.js
new file mode 100644
index 0000000..7004cf4
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-003.js
@@ -0,0 +1,53 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ * Rob Ginda rginda@netscape.com
+ */
+
+test();
+
+function test()
+{
+ enterFunc ("test");
+
+ var \u0041 = 5;
+ var A\u03B2 = 15;
+ var c\u0061se = 25;
+
+ printStatus ("Escapes in identifiers test.");
+ printBugNumber (23608);
+ printBugNumber (23607);
+
+ reportCompare (5, eval("\u0041"),
+ "Escaped ASCII Identifier test.");
+ reportCompare (6, eval("++\u0041"),
+ "Escaped ASCII Identifier test");
+ reportCompare (15, eval("A\u03B2"),
+ "Escaped non-ASCII Identifier test");
+ reportCompare (16, eval("++A\u03B2"),
+ "Escaped non-ASCII Identifier test");
+ reportCompare (25, eval("c\\u00" + "61se"),
+ "Escaped keyword Identifier test");
+ reportCompare (26, eval("++c\\u00" + "61se"),
+ "Escaped keyword Identifier test");
+
+ exitFunc ("test");
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-004.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-004.js
new file mode 100644
index 0000000..2518124
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-004.js
@@ -0,0 +1,47 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ * Rob Ginda rginda@netscape.com
+ */
+
+test();
+
+function test()
+{
+ enterFunc ("test");
+
+ printStatus ("Unicode Characters 1C-1F with regexps test.");
+ printBugNumber (23612);
+
+ var ary = ["\u001Cfoo", "\u001Dfoo", "\u001Efoo", "\u001Ffoo"];
+
+ for (var i in ary)
+ {
+ reportCompare (0, ary[Number(i)].search(/^\Sfoo$/),
+ "Unicode characters 1C-1F in regexps, ary[" +
+ i + "] did not match \\S test (it should not.)");
+ reportCompare (-1, ary[Number(i)].search(/^\sfoo$/),
+ "Unicode characters 1C-1F in regexps, ary[" +
+ i + "] matched \\s test (it should not.)");
+ }
+
+ exitFunc ("test");
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-005.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-005.js
new file mode 100644
index 0000000..5b1be03
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-005.js
@@ -0,0 +1,271 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2002
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): rogerl@netscape.com, pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 15 July 2002
+* SUMMARY: Testing identifiers with double-byte names
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=58274
+*
+* Here is a sample of the problem:
+*
+* js> function f\u02B1 () {}
+*
+* js> f\u02B1.toSource();
+* function f¦() {}
+*
+* js> f\u02B1.toSource().toSource();
+* (new String("function f\xB1() {}"))
+*
+*
+* See how the high-byte information (the 02) has been lost?
+* The same thing was happening with the toString() method:
+*
+* js> f\u02B1.toString();
+*
+* function f¦() {
+* }
+*
+* js> f\u02B1.toString().toSource();
+* (new String("\nfunction f\xB1() {\n}\n"))
+*
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 58274;
+var summary = 'Testing identifiers with double-byte names';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+/*
+ * Define a function that uses double-byte identifiers in
+ * "every possible way"
+ *
+ * Then recover each double-byte identifier via f.toString().
+ * To make this easier, put a 'Z' token before every one.
+ *
+ * Our eval string will be:
+ *
+ * sEval = "function Z\u02b1(Z\u02b2, b) {
+ * try { Z\u02b3 : var Z\u02b4 = Z\u02b1; }
+ * catch (Z\u02b5) { for (var Z\u02b6 in Z\u02b5)
+ * {for (1; 1<0; Z\u02b7++) {new Array()[Z\u02b6] = 1;} };} }";
+ *
+ * It will be helpful to build this string in stages:
+ */
+var s0 = 'function Z';
+var s1 = '\u02b1(Z';
+var s2 = '\u02b2, b) {try { Z';
+var s3 = '\u02b3 : var Z';
+var s4 = '\u02b4 = Z';
+var s5 = '\u02b1; } catch (Z'
+var s6 = '\u02b5) { for (var Z';
+var s7 = '\u02b6 in Z';
+var s8 = '\u02b5){for (1; 1<0; Z';
+var s9 = '\u02b7++) {new Array()[Z';
+var s10 = '\u02b6] = 1;} };} }';
+
+
+/*
+ * Concatenate these and eval() to create the function Z\u02b1
+ */
+var sEval = s0 + s1 + s2 + s3 + s4 + s5 + s6 + s7 + s8 + s9 + s10;
+eval(sEval);
+
+
+/*
+ * Recover all the double-byte identifiers via Z\u02b1.toString().
+ * We'll recover the 1st one as arrID[1], the 2nd one as arrID[2],
+ * and so on ...
+ */
+var arrID = getIdentifiers(Z\u02b1);
+
+
+/*
+ * Now check that we got back what we put in -
+ */
+status = inSection(1);
+actual = arrID[1];
+expect = s1.charAt(0);
+addThis();
+
+status = inSection(2);
+actual = arrID[2];
+expect = s2.charAt(0);
+addThis();
+
+status = inSection(3);
+actual = arrID[3];
+expect = s3.charAt(0);
+addThis();
+
+status = inSection(4);
+actual = arrID[4];
+expect = s4.charAt(0);
+addThis();
+
+status = inSection(5);
+actual = arrID[5];
+expect = s5.charAt(0);
+addThis();
+
+status = inSection(6);
+actual = arrID[6];
+expect = s6.charAt(0);
+addThis();
+
+status = inSection(7);
+actual = arrID[7];
+expect = s7.charAt(0);
+addThis();
+
+status = inSection(8);
+actual = arrID[8];
+expect = s8.charAt(0);
+addThis();
+
+status = inSection(9);
+actual = arrID[9];
+expect = s9.charAt(0);
+addThis();
+
+status = inSection(10);
+actual = arrID[10];
+expect = s10.charAt(0);
+addThis();
+
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+/*
+ * Goal: recover the double-byte identifiers from f.toString()
+ * by getting the very next character after each 'Z' token.
+ *
+ * The return value will be an array |arr| indexed such that
+ * |arr[1]| is the 1st identifier, |arr[2]| the 2nd, and so on.
+ *
+ * Note, however, f.toString() is implementation-independent.
+ * For example, it may begin with '\nfunction' instead of 'function'.
+ *
+ * Rhino uses a Unicode representation for f.toString(); whereas
+ * SpiderMonkey uses an ASCII representation, putting escape sequences
+ * for non-ASCII characters. For example, if a function is called f\u02B1,
+ * then in Rhino the toString() method will present a 2-character Unicode
+ * string for its name, whereas SpiderMonkey will present a 7-character
+ * ASCII string for its name: the string literal 'f\u02B1'.
+ *
+ * So we force the lexer to condense the string before we use it.
+ * This will give uniform results in Rhino and SpiderMonkey.
+ */
+function getIdentifiers(f)
+{
+ var str = condenseStr(f.toString());
+ var arr = str.split('Z');
+
+ /*
+ * The identifiers are the 1st char of each split substring
+ * EXCEPT the first one, which is just ('\n' +) 'function '.
+ *
+ * Thus note the 1st identifier will be stored in |arr[1]|,
+ * the 2nd one in |arr[2]|, etc., making the indexing easy -
+ */
+ for (i in arr)
+ arr[i] = arr[i].charAt(0);
+ return arr;
+}
+
+
+/*
+ * This function is the opposite of a functions like escape(), which take
+ * Unicode characters and return escape sequences for them. Here, we force
+ * the lexer to turn escape sequences back into single characters.
+ *
+ * Note we can't simply do |eval(str)|, since in practice |str| will be an
+ * identifier somewhere in the program (e.g. a function name); thus |eval(str)|
+ * would return the object that the identifier represents: not what we want.
+ *
+ * So we surround |str| lexicographically with quotes to force the lexer to
+ * evaluate it as a string. Have to strip out any linefeeds first, however -
+ */
+function condenseStr(str)
+{
+ /*
+ * You won't be able to do the next step if |str| has
+ * any carriage returns or linefeeds in it. For example:
+ *
+ * js> eval("'" + '\nHello' + "'");
+ * 1: SyntaxError: unterminated string literal:
+ * 1: '
+ * 1: ^
+ *
+ * So replace them with the empty string -
+ */
+ str = str.replace(/[\r\n]/g, '')
+ return eval("'" + str + "'")
+}
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/shell.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/shell.js
new file mode 100644
index 0000000..4fde9bc
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/shell.js
@@ -0,0 +1,180 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ * Rob Ginda rginda@netscape.com
+ */
+
+var FAILED = "FAILED!: ";
+var STATUS = "STATUS: ";
+var BUGNUMBER = "BUGNUMBER: ";
+var SECT_PREFIX = 'Section ';
+var SECT_SUFFIX = ' of test -';
+var VERBOSE = false;
+var callStack = new Array();
+
+/*
+ * The test driver searches for such a phrase in the test output.
+ * If such phrase exists, it will set n as the expected exit code.
+ */
+function expectExitCode(n)
+{
+
+ print('--- NOTE: IN THIS TESTCASE, WE EXPECT EXIT CODE ' + n + ' ---');
+
+}
+
+/*
+ * Statuses current section of a test
+ */
+function inSection(x)
+{
+
+ return SECT_PREFIX + x + SECT_SUFFIX;
+
+}
+
+/*
+ * Some tests need to know if we are in Rhino as opposed to SpiderMonkey
+ */
+function inRhino()
+{
+ return (typeof defineClass == "function");
+}
+
+/*
+ * Report a failure in the 'accepted' manner
+ */
+function reportFailure (msg)
+{
+ var lines = msg.split ("\n");
+ var l;
+ var funcName = currentFunc();
+ var prefix = (funcName) ? "[reported from " + funcName + "] ": "";
+
+ for (var i=0; i<lines.length; i++)
+ print (FAILED + prefix + lines[i]);
+
+}
+
+/*
+ * Print a non-failure message.
+ */
+function printStatus (msg)
+{
+ var lines = msg.split ("\n");
+ var l;
+
+ for (var i=0; i<lines.length; i++)
+ print (STATUS + lines[i]);
+
+}
+
+/*
+ * Print a bugnumber message.
+ */
+function printBugNumber (num)
+{
+
+ print (BUGNUMBER + num);
+
+}
+
+/*
+ * Compare expected result to actual result, if they differ (in value and/or
+ * type) report a failure. If description is provided, include it in the
+ * failure report.
+ */
+function reportCompare (expected, actual, description)
+{
+ var expected_t = typeof expected;
+ var actual_t = typeof actual;
+ var output = "";
+
+ if ((VERBOSE) && (typeof description != "undefined"))
+ printStatus ("Comparing '" + description + "'");
+
+ if (expected_t != actual_t)
+ output += "Type mismatch, expected type " + expected_t +
+ ", actual type " + actual_t + "\n";
+ else if (VERBOSE)
+ printStatus ("Expected type '" + actual_t + "' matched actual " +
+ "type '" + expected_t + "'");
+
+ if (expected != actual)
+ output += "Expected value '" + expected + "', Actual value '" + actual +
+ "'\n";
+ else if (VERBOSE)
+ printStatus ("Expected value '" + actual + "' matched actual " +
+ "value '" + expected + "'");
+
+ if (output != "")
+ {
+ if (typeof description != "undefined")
+ reportFailure (description);
+ reportFailure (output);
+ }
+
+}
+
+/*
+ * Puts funcName at the top of the call stack. This stack is used to show
+ * a function-reported-from field when reporting failures.
+ */
+function enterFunc (funcName)
+{
+
+ if (!funcName.match(/\(\)$/))
+ funcName += "()";
+
+ callStack.push(funcName);
+
+}
+
+/*
+ * Pops the top funcName off the call stack. funcName is optional, and can be
+ * used to check push-pop balance.
+ */
+function exitFunc (funcName)
+{
+ var lastFunc = callStack.pop();
+
+ if (funcName)
+ {
+ if (!funcName.match(/\(\)$/))
+ funcName += "()";
+
+ if (lastFunc != funcName)
+ reportFailure ("Test driver failure, expected to exit function '" +
+ funcName + "' but '" + lastFunc + "' came off " +
+ "the stack");
+ }
+
+}
+
+/*
+ * Peeks at the top of the call stack.
+ */
+function currentFunc()
+{
+
+ return callStack[callStack.length - 1];
+
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/expected.html b/Source/JavaScriptCore/tests/mozilla/expected.html
new file mode 100644
index 0000000..785378d
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/expected.html
@@ -0,0 +1,461 @@
+<html><head>
+<title>Test results, squirrelfish</title>
+</head>
+<body bgcolor='white'>
+<a name='tippy_top'></a>
+<h2>Test results, squirrelfish</h2><br>
+<p class='results_summary'>
+Test List: All tests<br>
+Skip List: ecma/Date/15.9.2.1.js, ecma/Date/15.9.2.2-1.js, ecma/Date/15.9.2.2-2.js, ecma/Date/15.9.2.2-3.js, ecma/Date/15.9.2.2-4.js, ecma/Date/15.9.2.2-5.js, ecma/Date/15.9.2.2-6.js, ecma_3/Date/15.9.5.7.js<br>
+1127 test(s) selected, 1119 test(s) completed, 46 failures reported (4.11% failed)<br>
+Engine command line: "/home/stampho/webkit/WebKitBuild/Release/JavaScriptCore/jsc" <br>
+OS type: Linux euclides 2.6.35-gentoo-r5 #1 SMP Tue Aug 31 13:19:25 CEST 2010 i686 Intel(R) Core(TM)2 CPU 6300 @ 1.86GHz GenuineIntel GNU/Linux<br>
+Testcase execution time: 16 seconds.<br>
+Tests completed on Fri Oct 15 00:29:31 2010.<br><br>
+[ <a href='#fail_detail'>Failure Details</a> | <a href='#retest_list'>Retest List</a> | <a href='menu.html'>Test Selection Page</a> ]<br>
+<hr>
+<a name='fail_detail'></a>
+<h2>Failure Details</h2><br>
+<dl><a name='failure1'></a><dd><b>Testcase <a target='other_window' href='./ecma/TypeConversion/9.3.1-3.js'>ecma/TypeConversion/9.3.1-3.js</a> failed</b> <br>
+ [ <a href='#failure2'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br>
+<tt><br>
+Failure messages were:<br>
+- "-0x123456789abcde8" = NaN FAILED! expected: 81985529216486880<br>
+- "-0x123456789abcde8" = NaN FAILED! expected: 81985529216486880<br>
+</tt><br>
+<a name='failure2'></a><dd><b>Testcase <a target='other_window' href='./ecma_2/Exceptions/function-001.js'>ecma_2/Exceptions/function-001.js</a> failed</b> <a href='http://bugzilla.mozilla.org/show_bug.cgi?id=10278' target='other_window'>Bug Number 10278</a><br>
+ [ <a href='#failure1'>Previous Failure</a> | <a href='#failure3'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br>
+<tt><br>
+Failure messages were:<br>
+eval("function f(){}function g(){}") (threw no exception thrown = fail FAILED! expected: pass<br>
+</tt><br>
+<a name='failure3'></a><dd><b>Testcase <a target='other_window' href='./ecma_3/FunExpr/fe-001.js'>ecma_3/FunExpr/fe-001.js</a> failed</b> <br>
+ [ <a href='#failure2'>Previous Failure</a> | <a href='#failure4'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br>
+<tt>STATUS: Function Expression Statements basic test.<br>
+Failure messages were:<br>
+FAILED!: [reported from test()] Both functions were defined.<br>
+FAILED!: [reported from test()] Expected value '1', Actual value '0'<br>
+FAILED!: [reported from test()] <br>
+</tt><br>
+<a name='failure4'></a><dd><b>Testcase <a target='other_window' href='./ecma_3/Statements/regress-194364.js'>ecma_3/Statements/regress-194364.js</a> failed</b> <br>
+ [ <a href='#failure3'>Previous Failure</a> | <a href='#failure5'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br>
+<tt>Expected exit code 0, got 3<br>
+Testcase terminated with signal 0<br>
+Complete testcase output was:<br>
+Testcase produced no output!</tt><br>
+<a name='failure5'></a><dd><b>Testcase <a target='other_window' href='./ecma_3/Unicode/uc-001.js'>ecma_3/Unicode/uc-001.js</a> failed</b> <a href='http://bugzilla.mozilla.org/show_bug.cgi?id=23610' target='other_window'>Bug Number 23610</a><br>
+ [ <a href='#failure4'>Previous Failure</a> | <a href='#failure6'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br>
+<tt>STATUS: Unicode format-control character (Category Cf) test.<br>
+Failure messages were:<br>
+FAILED!: [reported from test()] Unicode format-control character test (Category Cf.)<br>
+FAILED!: [reported from test()] Expected value 'no error', Actual value 'no‎ error'<br>
+FAILED!: [reported from test()] <br>
+</tt><br>
+<a name='failure6'></a><dd><b>Testcase <a target='other_window' href='./js1_2/Objects/toString-001.js'>js1_2/Objects/toString-001.js</a> failed</b> <br>
+ [ <a href='#failure5'>Previous Failure</a> | <a href='#failure7'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br>
+<tt><br>
+Failure messages were:<br>
+var o = new Object(); o.toString() = [object Object] FAILED! expected: {}<br>
+o = {}; o.toString() = [object Object] FAILED! expected: {}<br>
+o = { name:"object", length:0, value:"hello" }; o.toString() = false FAILED! expected: true<br>
+</tt><br>
+<a name='failure7'></a><dd><b>Testcase <a target='other_window' href='./js1_2/function/Function_object.js'>js1_2/function/Function_object.js</a> failed</b> <br>
+ [ <a href='#failure6'>Previous Failure</a> | <a href='#failure8'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br>
+<tt><br>
+Failure messages were:<br>
+f.arity = undefined FAILED! expected: 3<br>
+} FAILED! expected: <br>
+</tt><br>
+<a name='failure8'></a><dd><b>Testcase <a target='other_window' href='./js1_2/function/function-001-n.js'>js1_2/function/function-001-n.js</a> failed</b> <br>
+ [ <a href='#failure7'>Previous Failure</a> | <a href='#failure9'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br>
+<tt>Expected exit code 3, got 0<br>
+Testcase terminated with signal 0<br>
+Complete testcase output was:<br>
+function-001.js functions not separated by semicolons are errors in version 120 and higher<br>
+eval("function f(){}function g(){}") = undefined FAILED! expected: error<br>
+</tt><br>
+<a name='failure9'></a><dd><b>Testcase <a target='other_window' href='./js1_2/function/tostring-1.js'>js1_2/function/tostring-1.js</a> failed</b> <br>
+ [ <a href='#failure8'>Previous Failure</a> | <a href='#failure10'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br>
+<tt><br>
+Failure messages were:<br>
+} FAILED! expected: <br>
+} FAILED! expected: <br>
+} FAILED! expected: <br>
+} FAILED! expected: <br>
+} FAILED! expected: <br>
+</tt><br>
+<a name='failure10'></a><dd><b>Testcase <a target='other_window' href='./js1_2/function/tostring-2.js'>js1_2/function/tostring-2.js</a> failed</b> <br>
+ [ <a href='#failure9'>Previous Failure</a> | <a href='#failure11'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br>
+<tt><br>
+Failure messages were:<br>
+} FAILED! expected: <br>
+} FAILED! expected: <br>
+} FAILED! expected: <br>
+} FAILED! expected: <br>
+} FAILED! expected: <br>
+} FAILED! expected: <br>
+} FAILED! expected: <br>
+} FAILED! expected: <br>
+} FAILED! expected: <br>
+</tt><br>
+<a name='failure11'></a><dd><b>Testcase <a target='other_window' href='./js1_2/operator/equality.js'>js1_2/operator/equality.js</a> failed</b> <br>
+ [ <a href='#failure10'>Previous Failure</a> | <a href='#failure12'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br>
+<tt><br>
+Failure messages were:<br>
+(new String('x') == 'x') = true FAILED! expected: false<br>
+('x' == new String('x')) = true FAILED! expected: false<br>
+</tt><br>
+<a name='failure12'></a><dd><b>Testcase <a target='other_window' href='./js1_2/regexp/RegExp_lastIndex.js'>js1_2/regexp/RegExp_lastIndex.js</a> failed</b> <br>
+ [ <a href='#failure11'>Previous Failure</a> | <a href='#failure13'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br>
+<tt><br>
+Failure messages were:<br>
+re=/x./g; re.lastIndex=4; re.exec('xyabcdxa') = xa FAILED! expected: ["xa"]<br>
+re.exec('xyabcdef') = xy FAILED! expected: ["xy"]<br>
+</tt><br>
+<a name='failure13'></a><dd><b>Testcase <a target='other_window' href='./js1_2/regexp/RegExp_multiline.js'>js1_2/regexp/RegExp_multiline.js</a> failed</b> <br>
+ [ <a href='#failure12'>Previous Failure</a> | <a href='#failure14'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br>
+<tt><br>
+Failure messages were:<br>
+(multiline == true) '123\n456'.match(/^4../) = null FAILED! expected: 456<br>
+(multiline == true) 'a11\na22\na23\na24'.match(/^a../g) = a11 FAILED! expected: a11,a22,a23,a24<br>
+(multiline == true) '123\n456'.match(/.3$/) = null FAILED! expected: 23<br>
+(multiline == true) 'a11\na22\na23\na24'.match(/a..$/g) = a24 FAILED! expected: a11,a22,a23,a24<br>
+(multiline == true) 'a11\na22\na23\na24'.match(new RegExp('a..$','g')) = a24 FAILED! expected: a11,a22,a23,a24<br>
+</tt><br>
+<a name='failure14'></a><dd><b>Testcase <a target='other_window' href='./js1_2/regexp/RegExp_multiline_as_array.js'>js1_2/regexp/RegExp_multiline_as_array.js</a> failed</b> <br>
+ [ <a href='#failure13'>Previous Failure</a> | <a href='#failure15'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br>
+<tt><br>
+Failure messages were:<br>
+(['$*'] == true) '123\n456'.match(/^4../) = null FAILED! expected: 456<br>
+(['$*'] == true) 'a11\na22\na23\na24'.match(/^a../g) = a11 FAILED! expected: a11,a22,a23,a24<br>
+(['$*'] == true) '123\n456'.match(/.3$/) = null FAILED! expected: 23<br>
+(['$*'] == true) 'a11\na22\na23\na24'.match(/a..$/g) = a24 FAILED! expected: a11,a22,a23,a24<br>
+(['$*'] == true) 'a11\na22\na23\na24'.match(new RegExp('a..$','g')) = a24 FAILED! expected: a11,a22,a23,a24<br>
+</tt><br>
+<a name='failure15'></a><dd><b>Testcase <a target='other_window' href='./js1_2/regexp/beginLine.js'>js1_2/regexp/beginLine.js</a> failed</b> <br>
+ [ <a href='#failure14'>Previous Failure</a> | <a href='#failure16'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br>
+<tt><br>
+Failure messages were:<br>
+123xyz'.match(new RegExp('^\d+')) = null FAILED! expected: 123<br>
+</tt><br>
+<a name='failure16'></a><dd><b>Testcase <a target='other_window' href='./js1_2/regexp/endLine.js'>js1_2/regexp/endLine.js</a> failed</b> <br>
+ [ <a href='#failure15'>Previous Failure</a> | <a href='#failure17'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br>
+<tt><br>
+Failure messages were:<br>
+xyz'.match(new RegExp('\d+$')) = null FAILED! expected: 890<br>
+</tt><br>
+<a name='failure17'></a><dd><b>Testcase <a target='other_window' href='./js1_2/regexp/string_split.js'>js1_2/regexp/string_split.js</a> failed</b> <br>
+ [ <a href='#failure16'>Previous Failure</a> | <a href='#failure18'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br>
+<tt><br>
+Failure messages were:<br>
+'abc'.split(/[a-z]/) = ,,, FAILED! expected: ,,<br>
+'abc'.split(/[a-z]/) = ,,, FAILED! expected: ,,<br>
+'abc'.split(new RegExp('[a-z]')) = ,,, FAILED! expected: ,,<br>
+'abc'.split(new RegExp('[a-z]')) = ,,, FAILED! expected: ,,<br>
+</tt><br>
+<a name='failure18'></a><dd><b>Testcase <a target='other_window' href='./js1_2/version120/boolean-001.js'>js1_2/version120/boolean-001.js</a> failed</b> <br>
+ [ <a href='#failure17'>Previous Failure</a> | <a href='#failure19'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br>
+<tt><br>
+Failure messages were:<br>
+new Boolean(false) = true FAILED! expected: false<br>
+</tt><br>
+<a name='failure19'></a><dd><b>Testcase <a target='other_window' href='./js1_2/version120/regress-99663.js'>js1_2/version120/regress-99663.js</a> failed</b> <br>
+ [ <a href='#failure18'>Previous Failure</a> | <a href='#failure20'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br>
+<tt>STATUS: Regression test for Bugzilla bug 99663<br>
+Failure messages were:<br>
+Section 1 of test - got Error: Can't find variable: it FAILED! expected: a "read-only" error<br>
+Section 2 of test - got Error: Can't find variable: it FAILED! expected: a "read-only" error<br>
+Section 3 of test - got Error: Can't find variable: it FAILED! expected: a "read-only" error<br>
+</tt><br>
+<a name='failure20'></a><dd><b>Testcase <a target='other_window' href='./js1_3/Script/function-001-n.js'>js1_3/Script/function-001-n.js</a> failed</b> <a href='http://bugzilla.mozilla.org/show_bug.cgi?id=10278' target='other_window'>Bug Number 10278</a><br>
+ [ <a href='#failure19'>Previous Failure</a> | <a href='#failure21'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br>
+<tt>Expected exit code 3, got 0<br>
+Testcase terminated with signal 0<br>
+Complete testcase output was:<br>
+BUGNUMBER: 10278<br>
+function-001.js functions not separated by semicolons are errors in version 120 and higher<br>
+eval("function f(){}function g(){}") = undefined FAILED! expected: error<br>
+</tt><br>
+<a name='failure21'></a><dd><b>Testcase <a target='other_window' href='./js1_3/Script/script-001.js'>js1_3/Script/script-001.js</a> failed</b> <br>
+ [ <a href='#failure20'>Previous Failure</a> | <a href='#failure22'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br>
+<tt>Expected exit code 0, got 3<br>
+Testcase terminated with signal 0<br>
+Complete testcase output was:<br>
+script-001 NativeScript<br>
+</tt><br>
+<a name='failure22'></a><dd><b>Testcase <a target='other_window' href='./js1_3/regress/function-001-n.js'>js1_3/regress/function-001-n.js</a> failed</b> <a href='http://bugzilla.mozilla.org/show_bug.cgi?id=10278' target='other_window'>Bug Number 10278</a><br>
+ [ <a href='#failure21'>Previous Failure</a> | <a href='#failure23'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br>
+<tt>Expected exit code 3, got 0<br>
+Testcase terminated with signal 0<br>
+Complete testcase output was:<br>
+BUGNUMBER: 10278<br>
+function-001.js functions not separated by semicolons are errors in version 120 and higher<br>
+eval("function f(){}function g(){}") = undefined FAILED! expected: error<br>
+</tt><br>
+<a name='failure23'></a><dd><b>Testcase <a target='other_window' href='./js1_5/Exceptions/catchguard-001.js'>js1_5/Exceptions/catchguard-001.js</a> failed</b> <br>
+ [ <a href='#failure22'>Previous Failure</a> | <a href='#failure24'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br>
+<tt>Expected exit code 0, got 3<br>
+Testcase terminated with signal 0<br>
+Complete testcase output was:<br>
+Testcase produced no output!</tt><br>
+<a name='failure24'></a><dd><b>Testcase <a target='other_window' href='./js1_5/Exceptions/catchguard-002.js'>js1_5/Exceptions/catchguard-002.js</a> failed</b> <br>
+ [ <a href='#failure23'>Previous Failure</a> | <a href='#failure25'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br>
+<tt>Expected exit code 0, got 3<br>
+Testcase terminated with signal 0<br>
+Complete testcase output was:<br>
+Testcase produced no output!</tt><br>
+<a name='failure25'></a><dd><b>Testcase <a target='other_window' href='./js1_5/Exceptions/catchguard-003.js'>js1_5/Exceptions/catchguard-003.js</a> failed</b> <br>
+ [ <a href='#failure24'>Previous Failure</a> | <a href='#failure26'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br>
+<tt>Expected exit code 0, got 3<br>
+Testcase terminated with signal 0<br>
+Complete testcase output was:<br>
+Testcase produced no output!</tt><br>
+<a name='failure26'></a><dd><b>Testcase <a target='other_window' href='./js1_5/Exceptions/errstack-001.js'>js1_5/Exceptions/errstack-001.js</a> failed</b> <br>
+ [ <a href='#failure25'>Previous Failure</a> | <a href='#failure27'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br>
+<tt>Expected exit code 0, got 3<br>
+Testcase terminated with signal 0<br>
+Complete testcase output was:<br>
+Testcase produced no output!</tt><br>
+<a name='failure27'></a><dd><b>Testcase <a target='other_window' href='./js1_5/Exceptions/regress-50447.js'>js1_5/Exceptions/regress-50447.js</a> failed</b> <a href='http://bugzilla.mozilla.org/show_bug.cgi?id=50447' target='other_window'>Bug Number 50447</a><br>
+ [ <a href='#failure26'>Previous Failure</a> | <a href='#failure28'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br>
+<tt>Expected exit code 0, got 3<br>
+Testcase terminated with signal 0<br>
+Complete testcase output was:<br>
+BUGNUMBER: 50447<br>
+STATUS: Test (non-ECMA) Error object properties fileName, lineNumber<br>
+</tt><br>
+<a name='failure28'></a><dd><b>Testcase <a target='other_window' href='./js1_5/GetSet/getset-001.js'>js1_5/GetSet/getset-001.js</a> failed</b> <br>
+ [ <a href='#failure27'>Previous Failure</a> | <a href='#failure29'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br>
+<tt>Expected exit code 0, got 3<br>
+Testcase terminated with signal 0<br>
+Complete testcase output was:<br>
+Testcase produced no output!</tt><br>
+<a name='failure29'></a><dd><b>Testcase <a target='other_window' href='./js1_5/GetSet/getset-002.js'>js1_5/GetSet/getset-002.js</a> failed</b> <br>
+ [ <a href='#failure28'>Previous Failure</a> | <a href='#failure30'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br>
+<tt>Expected exit code 0, got 3<br>
+Testcase terminated with signal 0<br>
+Complete testcase output was:<br>
+Testcase produced no output!</tt><br>
+<a name='failure30'></a><dd><b>Testcase <a target='other_window' href='./js1_5/GetSet/getset-003.js'>js1_5/GetSet/getset-003.js</a> failed</b> <br>
+ [ <a href='#failure29'>Previous Failure</a> | <a href='#failure31'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br>
+<tt>Expected exit code 0, got 3<br>
+Testcase terminated with signal 0<br>
+Complete testcase output was:<br>
+Testcase produced no output!</tt><br>
+<a name='failure31'></a><dd><b>Testcase <a target='other_window' href='./js1_5/Object/regress-90596-001.js'>js1_5/Object/regress-90596-001.js</a> failed</b> <br>
+ [ <a href='#failure30'>Previous Failure</a> | <a href='#failure32'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br>
+<tt>Expected exit code 0, got 3<br>
+Testcase terminated with signal 0<br>
+Complete testcase output was:<br>
+Testcase produced no output!</tt><br>
+<a name='failure32'></a><dd><b>Testcase <a target='other_window' href='./js1_5/Object/regress-90596-002.js'>js1_5/Object/regress-90596-002.js</a> failed</b> <br>
+ [ <a href='#failure31'>Previous Failure</a> | <a href='#failure33'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br>
+<tt>Expected exit code 0, got 3<br>
+Testcase terminated with signal 0<br>
+Complete testcase output was:<br>
+Testcase produced no output!</tt><br>
+<a name='failure33'></a><dd><b>Testcase <a target='other_window' href='./js1_5/Object/regress-96284-001.js'>js1_5/Object/regress-96284-001.js</a> failed</b> <br>
+ [ <a href='#failure32'>Previous Failure</a> | <a href='#failure34'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br>
+<tt>Expected exit code 0, got 3<br>
+Testcase terminated with signal 0<br>
+Complete testcase output was:<br>
+Testcase produced no output!</tt><br>
+<a name='failure34'></a><dd><b>Testcase <a target='other_window' href='./js1_5/Object/regress-96284-002.js'>js1_5/Object/regress-96284-002.js</a> failed</b> <br>
+ [ <a href='#failure33'>Previous Failure</a> | <a href='#failure35'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br>
+<tt>Expected exit code 0, got 3<br>
+Testcase terminated with signal 0<br>
+Complete testcase output was:<br>
+Testcase produced no output!</tt><br>
+<a name='failure35'></a><dd><b>Testcase <a target='other_window' href='./js1_5/Regress/regress-44009.js'>js1_5/Regress/regress-44009.js</a> failed</b> <a href='http://bugzilla.mozilla.org/show_bug.cgi?id=44009' target='other_window'>Bug Number 44009</a><br>
+ [ <a href='#failure34'>Previous Failure</a> | <a href='#failure36'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br>
+<tt>Expected exit code 0, got 3<br>
+Testcase terminated with signal 0<br>
+Complete testcase output was:<br>
+BUGNUMBER: 44009<br>
+STATUS: Testing that we don't crash on obj.toSource()<br>
+</tt><br>
+<a name='failure36'></a><dd><b>Testcase <a target='other_window' href='./js1_5/Regress/regress-103602.js'>js1_5/Regress/regress-103602.js</a> failed</b> <a href='http://bugzilla.mozilla.org/show_bug.cgi?id=103602' target='other_window'>Bug Number 103602</a><br>
+ [ <a href='#failure35'>Previous Failure</a> | <a href='#failure37'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br>
+<tt>STATUS: Reassignment to a const is NOT an error per ECMA<br>
+Failure messages were:<br>
+FAILED!: [reported from test()] Section 1 of test -<br>
+FAILED!: [reported from test()] Expected value '', Actual value 'Redeclaration of a const FAILED to cause an error'<br>
+FAILED!: [reported from test()] <br>
+FAILED!: [reported from test()] Section 3 of test -<br>
+FAILED!: [reported from test()] Expected value '1', Actual value '2'<br>
+FAILED!: [reported from test()] <br>
+</tt><br>
+<a name='failure37'></a><dd><b>Testcase <a target='other_window' href='./js1_5/Regress/regress-104077.js'>js1_5/Regress/regress-104077.js</a> failed</b> <br>
+ [ <a href='#failure36'>Previous Failure</a> | <a href='#failure38'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br>
+<tt>Expected exit code 0, got 3<br>
+Testcase terminated with signal 0<br>
+Complete testcase output was:<br>
+Testcase produced no output!</tt><br>
+<a name='failure38'></a><dd><b>Testcase <a target='other_window' href='./js1_5/Regress/regress-127557.js'>js1_5/Regress/regress-127557.js</a> failed</b> <br>
+ [ <a href='#failure37'>Previous Failure</a> | <a href='#failure39'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br>
+<tt>Expected exit code 0, got 3<br>
+Testcase terminated with signal 0<br>
+Complete testcase output was:<br>
+Testcase produced no output!</tt><br>
+<a name='failure39'></a><dd><b>Testcase <a target='other_window' href='./js1_5/Regress/regress-172699.js'>js1_5/Regress/regress-172699.js</a> failed</b> <br>
+ [ <a href='#failure38'>Previous Failure</a> | <a href='#failure40'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br>
+<tt>Expected exit code 0, got 3<br>
+Testcase terminated with signal 0<br>
+Complete testcase output was:<br>
+Testcase produced no output!</tt><br>
+<a name='failure40'></a><dd><b>Testcase <a target='other_window' href='./js1_5/Regress/regress-179524.js'>js1_5/Regress/regress-179524.js</a> failed</b> <a href='http://bugzilla.mozilla.org/show_bug.cgi?id=179524' target='other_window'>Bug Number 179524</a><br>
+ [ <a href='#failure39'>Previous Failure</a> | <a href='#failure41'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br>
+<tt>STATUS: Don't crash on extraneous arguments to str.match(), etc.<br>
+Failure messages were:<br>
+FAILED!: [reported from test()] Section 14 of test -<br>
+FAILED!: [reported from test()] Expected value 'A', Actual value 'a'<br>
+FAILED!: [reported from test()] <br>
+FAILED!: [reported from test()] Section 15 of test -<br>
+FAILED!: [reported from test()] Expected value 'A,a', Actual value 'a'<br>
+FAILED!: [reported from test()] <br>
+FAILED!: [reported from test()] Section 17 of test -<br>
+FAILED!: [reported from test()] Expected value 'A', Actual value 'a'<br>
+FAILED!: [reported from test()] <br>
+FAILED!: [reported from test()] Section 18 of test -<br>
+FAILED!: [reported from test()] Expected value 'A,a', Actual value 'a'<br>
+FAILED!: [reported from test()] <br>
+FAILED!: [reported from test()] Section 20 of test -<br>
+FAILED!: [reported from test()] Expected value 'SHOULD HAVE FALLEN INTO CATCH-BLOCK!', Actual value 'a'<br>
+FAILED!: [reported from test()] <br>
+FAILED!: [reported from test()] Section 22 of test -<br>
+FAILED!: [reported from test()] Expected value '0', Actual value '4'<br>
+FAILED!: [reported from test()] <br>
+FAILED!: [reported from test()] Section 23 of test -<br>
+FAILED!: [reported from test()] Expected value '0', Actual value '4'<br>
+FAILED!: [reported from test()] <br>
+FAILED!: [reported from test()] Section 25 of test -<br>
+FAILED!: [reported from test()] Expected value '0', Actual value '4'<br>
+FAILED!: [reported from test()] <br>
+FAILED!: [reported from test()] Section 26 of test -<br>
+FAILED!: [reported from test()] Expected value '0', Actual value '4'<br>
+FAILED!: [reported from test()] <br>
+FAILED!: [reported from test()] Section 28 of test -<br>
+FAILED!: [reported from test()] Type mismatch, expected type string, actual type number<br>
+FAILED!: [reported from test()] Expected value 'SHOULD HAVE FALLEN INTO CATCH-BLOCK!', Actual value '4'<br>
+FAILED!: [reported from test()] <br>
+FAILED!: [reported from test()] Section 30 of test -<br>
+FAILED!: [reported from test()] Expected value 'ZBC abc', Actual value 'ABC Zbc'<br>
+FAILED!: [reported from test()] <br>
+FAILED!: [reported from test()] Section 31 of test -<br>
+FAILED!: [reported from test()] Expected value 'ZBC Zbc', Actual value 'ABC Zbc'<br>
+FAILED!: [reported from test()] <br>
+FAILED!: [reported from test()] Section 33 of test -<br>
+FAILED!: [reported from test()] Expected value 'ZBC abc', Actual value 'ABC Zbc'<br>
+FAILED!: [reported from test()] <br>
+FAILED!: [reported from test()] Section 34 of test -<br>
+FAILED!: [reported from test()] Expected value 'ZBC Zbc', Actual value 'ABC Zbc'<br>
+FAILED!: [reported from test()] <br>
+FAILED!: [reported from test()] Section 36 of test -<br>
+FAILED!: [reported from test()] Expected value 'SHOULD HAVE FALLEN INTO CATCH-BLOCK!', Actual value 'ABC Zbc'<br>
+FAILED!: [reported from test()] <br>
+</tt><br>
+<a name='failure41'></a><dd><b>Testcase <a target='other_window' href='./js1_5/Scope/regress-220584.js'>js1_5/Scope/regress-220584.js</a> failed</b> <br>
+ [ <a href='#failure40'>Previous Failure</a> | <a href='#failure42'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br>
+<tt>Expected exit code 0, got 3<br>
+Testcase terminated with signal 0<br>
+Complete testcase output was:<br>
+Testcase produced no output!</tt><br>
+<a name='failure42'></a><dd><b>Testcase <a target='other_window' href='./js1_5/Scope/scope-001.js'>js1_5/Scope/scope-001.js</a> failed</b> <a href='http://bugzilla.mozilla.org/show_bug.cgi?id=53268' target='other_window'>Bug Number 53268</a><br>
+ [ <a href='#failure41'>Previous Failure</a> | <a href='#failure43'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br>
+<tt>STATUS: Testing scope after changing obj.__proto__<br>
+Failure messages were:<br>
+FAILED!: [reported from test()] Step 1: setting obj.__proto__ = global object<br>
+FAILED!: [reported from test()] Expected value '5', Actual value '1'<br>
+FAILED!: [reported from test()] <br>
+FAILED!: [reported from test()] Step 2: setting obj.__proto__ = null<br>
+FAILED!: [reported from test()] Type mismatch, expected type undefined, actual type number<br>
+FAILED!: [reported from test()] Expected value 'undefined', Actual value '1'<br>
+FAILED!: [reported from test()] <br>
+</tt><br>
+<a name='failure43'></a><dd><b>Testcase <a target='other_window' href='./js1_6/Regress/regress-301574.js'>js1_6/Regress/regress-301574.js</a> failed</b> <a href='http://bugzilla.mozilla.org/show_bug.cgi?id=301574' target='other_window'>Bug Number 301574</a><br>
+ [ <a href='#failure42'>Previous Failure</a> | <a href='#failure44'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br>
+<tt>STATUS: E4X should be enabled even when e4x=1 not specified<br>
+Failure messages were:<br>
+FAILED!: E4X should be enabled even when e4x=1 not specified: XML()<br>
+FAILED!: Expected value 'No error', Actual value 'error: ReferenceError: Can't find variable: XML'<br>
+FAILED!: <br>
+FAILED!: E4X should be enabled even when e4x=1 not specified: XMLList()<br>
+FAILED!: Expected value 'No error', Actual value 'error: ReferenceError: Can't find variable: XML'<br>
+FAILED!: <br>
+</tt><br>
+<a name='failure44'></a><dd><b>Testcase <a target='other_window' href='./js1_6/Regress/regress-309242.js'>js1_6/Regress/regress-309242.js</a> failed</b> <br>
+ [ <a href='#failure43'>Previous Failure</a> | <a href='#failure45'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br>
+<tt>Expected exit code 0, got 3<br>
+Testcase terminated with signal 0<br>
+Complete testcase output was:<br>
+Testcase produced no output!</tt><br>
+<a name='failure45'></a><dd><b>Testcase <a target='other_window' href='./js1_6/Regress/regress-314887.js'>js1_6/Regress/regress-314887.js</a> failed</b> <br>
+ [ <a href='#failure44'>Previous Failure</a> | <a href='#failure46'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br>
+<tt>Expected exit code 0, got 3<br>
+Testcase terminated with signal 0<br>
+Complete testcase output was:<br>
+Testcase produced no output!</tt><br>
+<a name='failure46'></a><dd><b>Testcase <a target='other_window' href='./js1_6/String/regress-306591.js'>js1_6/String/regress-306591.js</a> failed</b> <a href='http://bugzilla.mozilla.org/show_bug.cgi?id=306591' target='other_window'>Bug Number 306591</a><br>
+ [ <a href='#failure45'>Previous Failure</a> | <a href='#failure47'>Next Failure</a> | <a href='#tippy_top'>Top of Page</a> ]<br>
+<tt>Expected exit code 0, got 3<br>
+Testcase terminated with signal 0<br>
+Complete testcase output was:<br>
+BUGNUMBER: 306591<br>
+STATUS: String static methods<br>
+STATUS: See https://bugzilla.mozilla.org/show_bug.cgi?id=304828<br>
+</tt><br>
+</dl>
+[ <a href='#tippy_top'>Top of Page</a> | <a href='#fail_detail'>Top of Failures</a> ]<br>
+<hr>
+<pre>
+<a name='retest_list'></a>
+<h2>Retest List</h2><br>
+# Retest List, squirrelfish, generated Fri Oct 15 00:29:31 2010.
+# Original test base was: All tests.
+# 1119 of 1127 test(s) were completed, 46 failures reported.
+ecma/TypeConversion/9.3.1-3.js
+ecma_2/Exceptions/function-001.js
+ecma_3/FunExpr/fe-001.js
+ecma_3/Statements/regress-194364.js
+ecma_3/Unicode/uc-001.js
+js1_2/Objects/toString-001.js
+js1_2/function/Function_object.js
+js1_2/function/function-001-n.js
+js1_2/function/tostring-1.js
+js1_2/function/tostring-2.js
+js1_2/operator/equality.js
+js1_2/regexp/RegExp_lastIndex.js
+js1_2/regexp/RegExp_multiline.js
+js1_2/regexp/RegExp_multiline_as_array.js
+js1_2/regexp/beginLine.js
+js1_2/regexp/endLine.js
+js1_2/regexp/string_split.js
+js1_2/version120/boolean-001.js
+js1_2/version120/regress-99663.js
+js1_3/Script/function-001-n.js
+js1_3/Script/script-001.js
+js1_3/regress/function-001-n.js
+js1_5/Exceptions/catchguard-001.js
+js1_5/Exceptions/catchguard-002.js
+js1_5/Exceptions/catchguard-003.js
+js1_5/Exceptions/errstack-001.js
+js1_5/Exceptions/regress-50447.js
+js1_5/GetSet/getset-001.js
+js1_5/GetSet/getset-002.js
+js1_5/GetSet/getset-003.js
+js1_5/Object/regress-90596-001.js
+js1_5/Object/regress-90596-002.js
+js1_5/Object/regress-96284-001.js
+js1_5/Object/regress-96284-002.js
+js1_5/Regress/regress-44009.js
+js1_5/Regress/regress-103602.js
+js1_5/Regress/regress-104077.js
+js1_5/Regress/regress-127557.js
+js1_5/Regress/regress-172699.js
+js1_5/Regress/regress-179524.js
+js1_5/Scope/regress-220584.js
+js1_5/Scope/scope-001.js
+js1_6/Regress/regress-301574.js
+js1_6/Regress/regress-309242.js
+js1_6/Regress/regress-314887.js
+js1_6/String/regress-306591.js \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/importList.html b/Source/JavaScriptCore/tests/mozilla/importList.html
new file mode 100644
index 0000000..f9f167f
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/importList.html
@@ -0,0 +1,69 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+ <head>
+ <title>Import Test List</title>
+ <script language="JavaScript">
+ function onRadioClick (name)
+ {
+ var radio = document.forms["foo"].elements[name];
+ radio.checked = !radio.checked;
+ return false;
+ }
+
+ function doImport()
+ {
+ var lines =
+ document.forms["foo"].elements["testList"].value.split(/\r?\n/);
+ var suites = window.opener.suites;
+ var elems = window.opener.document.forms["testCases"].elements;
+
+ if (document.forms["foo"].elements["clear_all"].checked)
+ window.opener.selectNone();
+
+ for (var l in lines)
+ {
+ if (lines[l].search(/^\s$|\s*\#/) == -1)
+ {
+ var ary = lines[l].match (/(.*)\/(.*)\/(.*)/);
+
+ if (!ary)
+ if (!confirm ("Line " + lines[l] + " is confusing, " +
+ "continue with import?"))
+ return;
+ else
+ continue;
+
+ if (suites[ary[1]] && suites[ary[1]].testDirs[ary[2]] &&
+ suites[ary[1]].testDirs[ary[2]].tests[ary[3]])
+ elems[suites[ary[1]].testDirs[ary[2]].tests[ary[3]]].
+ checked = true;
+ }
+ }
+
+ window.opener.updateTotals();
+
+ window.close();
+
+ }
+ </script>
+ </head>
+
+ <body>
+
+ <form name="foo">
+ <textarea rows="25" cols="50" name="testList"></textarea><br>
+ <input type="radio" name="clear_all" checked
+ onclick="return onRadioClick('clear_all');">
+ &nbsp;Clear all selections berofe import.<br>
+ <input type="button" value="Import" onclick="doImport();">
+ <input type="button" value="Cancel" onclick="window.close();">
+ </form>
+
+ <hr>
+ <address><a href="mailto:rginda@netscape.com"></a></address>
+<!-- Created: Wed Nov 17 13:52:23 PST 1999 -->
+<!-- hhmts start -->
+Last modified: Wed Nov 17 14:18:42 PST 1999
+<!-- hhmts end -->
+ </body>
+</html>
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_1/browser.js b/Source/JavaScriptCore/tests/mozilla/js1_1/browser.js
new file mode 100644
index 0000000..5bbdf7c
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_1/browser.js
@@ -0,0 +1,80 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS
+* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+* implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation. All
+* Rights Reserved.
+*
+* Contributor(s):
+*/
+
+/*
+ * JavaScript test library shared functions file for running the tests
+ * in the browser. Overrides the shell's print function with document.write
+ * and make everything HTML pretty.
+ *
+ * To run the tests in the browser, use the mkhtml.pl script to generate
+ * html pages that include the shell.js, browser.js (this file), and the
+ * test js file in script tags.
+ *
+ * The source of the page that is generated should look something like this:
+ * <script src="./../shell.js"></script>
+ * <script src="./../browser.js"></script>
+ * <script src="./mytest.js"></script>
+ */
+
+onerror = err;
+
+function startTest() {
+ if ( BUGNUMBER ) {
+ writeLineToLog ("BUGNUMBER: " + BUGNUMBER );
+ }
+
+ testcases = new Array();
+ tc = 0;
+}
+
+function writeLineToLog( string ) {
+ document.write( string + "<br>\n");
+}
+function writeHeaderToLog( string ) {
+ document.write( "<h2>" + string + "</h2>" );
+}
+function stopTest() {
+ var gc;
+ if ( gc != undefined ) {
+ gc();
+ }
+ document.write( "<hr>" );
+}
+function writeFormattedResult( expect, actual, string, passed ) {
+ var s = "<tt>"+ string ;
+ s += "<b>" ;
+ s += ( passed ) ? "<font color=#009900> &nbsp;" + PASSED
+ : "<font color=#aa0000>&nbsp;" + FAILED + expect + "</tt>";
+ writeLineToLog( s + "</font></b></tt>" );
+ return passed;
+}
+function err( msg, page, line ) {
+ writeLineToLog( "Test failed with the message: " + msg );
+
+ testcases[tc].actual = "error";
+ testcases[tc].reason = msg;
+ writeTestCaseResult( testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual +
+ ": " + testcases[tc].reason );
+ stopTest();
+ return true;
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_1/jsref.js b/Source/JavaScriptCore/tests/mozilla/js1_1/jsref.js
new file mode 100644
index 0000000..05fcdc8
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_1/jsref.js
@@ -0,0 +1,170 @@
+var completed = false;
+var testcases;
+
+var BUGNUMBER="";
+var EXCLUDE = "";
+
+var TT = "";
+var TT_ = "";
+var BR = "";
+var NBSP = " ";
+var CR = "\n";
+var FONT = "";
+var FONT_ = "";
+var FONT_RED = "";
+var FONT_GREEN = "";
+var B = "";
+var B_ = ""
+var H2 = "";
+var H2_ = "";
+var HR = "";
+
+var PASSED = " PASSED!"
+var FAILED = " FAILED! expected: ";
+
+version( 110 );
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
+function TestCase( n, d, e, a ) {
+ this.name = n;
+ this.description = d;
+ this.expect = e;
+ this.actual = a;
+ this.passed = true;
+ this.reason = "";
+ this.bugnumber = BUGNUMBER;
+
+ this.passed = getTestCaseResult( this.expect, this.actual );
+}
+function startTest() {
+/*
+ // JavaScript 1.3 is supposed to be compliant ecma version 1.0
+ if ( VERSION == "ECMA_1" ) {
+ version ( "130" );
+ }
+ if ( VERSION == "JS_1.3" ) {
+ version ( "130" );
+ }
+ if ( VERSION == "JS_1.2" ) {
+ version ( "120" );
+ }
+ if ( VERSION == "JS_1.1" ) {
+ version ( "110" );
+ }
+ // for ecma version 2.0, we will leave the javascript version to
+ // the default ( for now ).
+*/
+}
+function getTestCaseResult( expect, actual ) {
+ // because ( NaN == NaN ) always returns false, need to do
+ // a special compare to see if we got the right result.
+ if ( actual != actual ) {
+ if ( typeof actual == "object" ) {
+ actual = "NaN object";
+ } else {
+ actual = "NaN number";
+ }
+ }
+ if ( expect != expect ) {
+ if ( typeof expect == "object" ) {
+ expect = "NaN object";
+ } else {
+ expect = "NaN number";
+ }
+ }
+
+ var passed = ( expect == actual ) ? true : false;
+
+ // if both objects are numbers, give a little leeway for rounding.
+ if ( !passed
+ && typeof(actual) == "number"
+ && typeof(expect) == "number"
+ ) {
+ if ( Math.abs(actual-expect) < 0.0000001 ) {
+ passed = true;
+ }
+ }
+
+ // verify type is the same
+ if ( typeof(expect) != typeof(actual) ) {
+ passed = false;
+ }
+
+ return passed;
+}
+function writeTestCaseResult( expect, actual, string ) {
+ var passed = getTestCaseResult( expect, actual );
+ writeFormattedResult( expect, actual, string, passed );
+ return passed;
+}
+function writeFormattedResult( expect, actual, string, passed ) {
+ var s = TT + string ;
+
+ for ( k = 0;
+ k < (60 - string.length >= 0 ? 60 - string.length : 5) ;
+ k++ ) {
+// s += NBSP;
+ }
+
+ s += B ;
+ s += ( passed ) ? FONT_GREEN + NBSP + PASSED : FONT_RED + NBSP + FAILED + expect + TT_ ;
+
+ writeLineToLog( s + FONT_ + B_ + TT_ );
+
+ return passed;
+}
+
+function writeLineToLog( string ) {
+ print( string + BR + CR );
+}
+function writeHeaderToLog( string ) {
+ print( H2 + string + H2_ );
+}
+function stopTest() {
+ var sizeTag = "<#TEST CASES SIZE>";
+ var doneTag = "<#TEST CASES DONE>";
+ var beginTag = "<#TEST CASE ";
+ var endTag = ">";
+
+ print(sizeTag);
+ print(testcases.length);
+ for (tc = 0; tc < testcases.length; tc++)
+ {
+ print(beginTag + 'PASSED' + endTag);
+ print(testcases[tc].passed);
+ print(beginTag + 'NAME' + endTag);
+ print(testcases[tc].name);
+ print(beginTag + 'EXPECTED' + endTag);
+ print(testcases[tc].expect);
+ print(beginTag + 'ACTUAL' + endTag);
+ print(testcases[tc].actual);
+ print(beginTag + 'DESCRIPTION' + endTag);
+ print(testcases[tc].description);
+ print(beginTag + 'REASON' + endTag);
+ print(( testcases[tc].passed ) ? "" : "wrong value ");
+ print(beginTag + 'BUGNUMBER' + endTag);
+ print( BUGNUMBER );
+ }
+ print(doneTag);
+ gc();
+}
+function getFailedCases() {
+ for ( var i = 0; i < testcases.length; i++ ) {
+ if ( ! testcases[i].passed ) {
+ print( testcases[i].description +" = " +testcases[i].actual +" expected: "+ testcases[i].expect );
+ }
+ }
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_1/regress/function-001.js b/Source/JavaScriptCore/tests/mozilla/js1_1/regress/function-001.js
new file mode 100644
index 0000000..2a08b31
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_1/regress/function-001.js
@@ -0,0 +1,76 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ * File Name: boolean-001.js
+ * Description:
+ *
+ * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=99232
+ *
+ * eval("function f(){}function g(){}") at top level is an error for JS1.2
+ and above (missing ; between named function expressions), but declares f
+ and g as functions below 1.2.
+ *
+ * Fails to produce error regardless of version:
+ * js> version(100)
+120
+js> eval("function f(){}function g(){}")
+js> version(120);
+100
+js> eval("function f(){}function g(){}")
+js>
+ * Author: christine@netscape.com
+ * Date: 11 August 1998
+ */
+ var SECTION = "boolean-001.js";
+ var VERSION = "JS1_1";
+ var TITLE = "functions not separated by semicolons are not errors in version 110 ";
+ var BUGNUMBER="99232";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ result = "passed";
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "eval(\"function f(){}function g(){}\")",
+ void 0,
+ eval("function f(){}function g(){}") );
+
+ test();
+
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_1/shell.js b/Source/JavaScriptCore/tests/mozilla/js1_1/shell.js
new file mode 100644
index 0000000..191e8e7
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_1/shell.js
@@ -0,0 +1,143 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS
+* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+* implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation. All
+* Rights Reserved.
+*
+* Contributor(s):
+*/
+
+var completed = false;
+var testcases;
+var tc = 0;
+
+SECTION = "";
+VERSION = "";
+BUGNUMBER = "";
+
+var GLOBAL = "[object global]";
+var PASSED = " PASSED!"
+var FAILED = " FAILED! expected: ";
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+/* wrapper for test cas constructor that doesn't require the SECTION
+ * argument.
+ */
+
+function AddTestCase( description, expect, actual ) {
+ testcases[tc++] = new TestCase( SECTION, description, expect, actual );
+}
+
+function TestCase( n, d, e, a ) {
+ this.name = n;
+ this.description = d;
+ this.expect = e;
+ this.actual = a;
+ this.passed = true;
+ this.reason = "";
+
+ this.passed = getTestCaseResult( this.expect, this.actual );
+}
+function startTest() {
+ version(110);
+
+ if ( BUGNUMBER ) {
+ writeLineToLog ("BUGNUMBER: " + BUGNUMBER );
+ }
+
+ testcases = new Array();
+ tc = 0;
+}
+function getTestCaseResult( expect, actual ) {
+ // because ( NaN == NaN ) always returns false, need to do
+ // a special compare to see if we got the right result.
+ if ( actual != actual ) {
+ if ( typeof actual == "object" ) {
+ actual = "NaN object";
+ } else {
+ actual = "NaN number";
+ }
+ }
+ if ( expect != expect ) {
+ if ( typeof expect == "object" ) {
+ expect = "NaN object";
+ } else {
+ expect = "NaN number";
+ }
+ }
+
+ var passed = ( expect == actual ) ? true : false;
+
+ // if both objects are numbers, give a little leeway for rounding.
+ if ( !passed
+ && typeof(actual) == "number"
+ && typeof(expect) == "number"
+ ) {
+ if ( Math.abs(actual-expect) < 0.0000001 ) {
+ passed = true;
+ }
+ }
+
+ // verify type is the same
+ if ( typeof(expect) != typeof(actual) ) {
+ passed = false;
+ }
+
+ return passed;
+}
+/*
+ * Begin printing functions. These functions use the shell's
+ * print function. When running tests in the browser, these
+ * functions, override these functions with functions that use
+ * document.write.
+ */
+
+function writeTestCaseResult( expect, actual, string ) {
+ var passed = getTestCaseResult( expect, actual );
+ writeFormattedResult( expect, actual, string, passed );
+ return passed;
+}
+function writeFormattedResult( expect, actual, string, passed ) {
+ var s = string ;
+ s += ( passed ) ? PASSED : FAILED + expect;
+ writeLineToLog( s);
+ return passed;
+}
+function writeLineToLog( string ) {
+ print( string );
+}
+function writeHeaderToLog( string ) {
+ print( string );
+}
+/* end of print functions */
+
+function stopTest() {
+ var gc;
+ if ( gc != undefined ) {
+ gc();
+ }
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/Array/array_split_1.js b/Source/JavaScriptCore/tests/mozilla/js1_2/Array/array_split_1.js
new file mode 100644
index 0000000..4076111
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/Array/array_split_1.js
@@ -0,0 +1,72 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: array_split_1.js
+ ECMA Section: Array.split()
+ Description:
+
+ These are tests from free perl suite.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "Free Perl";
+ var VERSION = "JS1_2";
+ var TITLE = "Array.split()";
+
+ startTest();
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+
+ testcases[tc++] = new TestCase( SECTION,
+ "('a,b,c'.split(',')).length",
+ 3,
+ ('a,b,c'.split(',')).length );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "('a,b'.split(',')).length",
+ 2,
+ ('a,b'.split(',')).length );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "('a'.split(',')).length",
+ 1,
+ ('a'.split(',')).length );
+
+/*
+ * Mozilla deviates from ECMA by never splitting an empty string by any separator
+ * string into a non-empty array (an array of length 1 that contains the empty string).
+ * But Internet Explorer does not do this, so we won't do it in JavaScriptCore either.
+ */
+ testcases[tc++] = new TestCase( SECTION,
+ "(''.split(',')).length",
+ 1,
+ (''.split(',')).length );
+
+
+
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/Array/general1.js b/Source/JavaScriptCore/tests/mozilla/js1_2/Array/general1.js
new file mode 100644
index 0000000..7762ec4
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/Array/general1.js
@@ -0,0 +1,62 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: general1.js
+ Description: 'This tests out some of the functionality on methods on the Array objects'
+
+ Author: Nick Lerissa
+ Date: Fri Feb 13 09:58:28 PST 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'String:push,unshift,shift';
+
+ writeHeaderToLog('Executing script: general1.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ var array1 = [];
+
+ array1.push(123); //array1 = [123]
+ array1.push("dog"); //array1 = [123,dog]
+ array1.push(-99); //array1 = [123,dog,-99]
+ array1.push("cat"); //array1 = [123,dog,-99,cat]
+ testcases[count++] = new TestCase( SECTION, "array1.pop()", array1.pop(),'cat');
+ //array1 = [123,dog,-99]
+ array1.push("mouse"); //array1 = [123,dog,-99,mouse]
+ testcases[count++] = new TestCase( SECTION, "array1.shift()", array1.shift(),123);
+ //array1 = [dog,-99,mouse]
+ array1.unshift(96); //array1 = [96,dog,-99,mouse]
+ testcases[count++] = new TestCase( SECTION, "state of array", String([96,"dog",-99,"mouse"]), String(array1));
+ testcases[count++] = new TestCase( SECTION, "array1.length", array1.length,4);
+ array1.shift(); //array1 = [dog,-99,mouse]
+ array1.shift(); //array1 = [-99,mouse]
+ array1.shift(); //array1 = [mouse]
+ testcases[count++] = new TestCase( SECTION, "array1.shift()", array1.shift(),"mouse");
+ testcases[count++] = new TestCase( SECTION, "array1.shift()", "undefined", String(array1.shift()));
+
+ test();
+
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/Array/general2.js b/Source/JavaScriptCore/tests/mozilla/js1_2/Array/general2.js
new file mode 100644
index 0000000..afa4529
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/Array/general2.js
@@ -0,0 +1,78 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: general2.js
+ Description: 'This tests out some of the functionality on methods on the Array objects'
+
+ Author: Nick Lerissa
+ Date: Fri Feb 13 09:58:28 PST 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'String:push,splice,concat,unshift,sort';
+
+ writeHeaderToLog('Executing script: general2.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+
+ array1 = new Array();
+ array2 = [];
+ size = 10;
+
+ // this for loop populates array1 and array2 as follows:
+ // array1 = [0,1,2,3,4,....,size - 2,size - 1]
+ // array2 = [size - 1, size - 2,...,4,3,2,1,0]
+ for (var i = 0; i < size; i++)
+ {
+ array1.push(i);
+ array2.push(size - 1 - i);
+ }
+
+ // the following for loop reverses the order of array1 so
+ // that it should be similarly ordered to array2
+ for (i = array1.length; i > 0; i--)
+ {
+ array3 = array1.slice(1,i);
+ array1.splice(1,i-1);
+ array1 = array3.concat(array1);
+ }
+
+ // the following for loop reverses the order of array1
+ // and array2
+ for (i = 0; i < size; i++)
+ {
+ array1.push(array1.shift());
+ array2.unshift(array2.pop());
+ }
+
+ testcases[count++] = new TestCase( SECTION, "Array.push,pop,shift,unshift,slice,splice", true,String(array1) == String(array2));
+ array1.sort();
+ array2.sort();
+ testcases[count++] = new TestCase( SECTION, "Array.sort", true,String(array1) == String(array2));
+
+ test();
+
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/Array/slice.js b/Source/JavaScriptCore/tests/mozilla/js1_2/Array/slice.js
new file mode 100644
index 0000000..7b9c55d
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/Array/slice.js
@@ -0,0 +1,123 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: slice.js
+ Description: 'This tests out some of the functionality on methods on the Array objects'
+
+ Author: Nick Lerissa
+ Date: Fri Feb 13 09:58:28 PST 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'String:slice';
+
+ writeHeaderToLog('Executing script: slice.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+
+ function mySlice(a, from, to)
+ {
+ var from2 = from;
+ var to2 = to;
+ var returnArray = [];
+ var i;
+
+ if (from2 < 0) from2 = a.length + from;
+ if (to2 < 0) to2 = a.length + to;
+
+ if ((to2 > from2)&&(to2 > 0)&&(from2 < a.length))
+ {
+ if (from2 < 0) from2 = 0;
+ if (to2 > a.length) to2 = a.length;
+
+ for (i = from2; i < to2; ++i) returnArray.push(a[i]);
+ }
+ return returnArray;
+ }
+
+ // This function tests the slice command on an Array
+ // passed in. The arguments passed into slice range in
+ // value from -5 to the length of the array + 4. Every
+ // combination of the two arguments is tested. The expected
+ // result of the slice(...) method is calculated and
+ // compared to the actual result from the slice(...) method.
+ // If the Arrays are not similar false is returned.
+ function exhaustiveSliceTest(testname, a)
+ {
+ var x = 0;
+ var y = 0;
+ var errorMessage;
+ var reason = "";
+ var passed = true;
+
+ for (x = -(2 + a.length); x <= (2 + a.length); x++)
+ for (y = (2 + a.length); y >= -(2 + a.length); y--)
+ {
+ var b = a.slice(x,y);
+ var c = mySlice(a,x,y);
+
+ if (String(b) != String(c))
+ {
+ errorMessage =
+ "ERROR: 'TEST FAILED' ERROR: 'TEST FAILED' ERROR: 'TEST FAILED'\n" +
+ " test: " + "a.slice(" + x + "," + y + ")\n" +
+ " a: " + String(a) + "\n" +
+ " actual result: " + String(b) + "\n" +
+ " expected result: " + String(c) + "\n";
+ writeHeaderToLog(errorMessage);
+ reason = reason + errorMessage;
+ passed = false;
+ }
+ }
+ var testCase = new TestCase(SECTION, testname, true, passed);
+ if (passed == false)
+ testCase.reason = reason;
+ return testCase;
+ }
+
+ var a = ['a','test string',456,9.34,new String("string object"),[],['h','i','j','k']];
+ var b = [1,2,3,4,5,6,7,8,9,0];
+
+ testcases[count++] = exhaustiveSliceTest("exhaustive slice test 1", a);
+ testcases[count++] = exhaustiveSliceTest("exhaustive slice test 2", b);
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
+
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/Array/splice1.js b/Source/JavaScriptCore/tests/mozilla/js1_2/Array/splice1.js
new file mode 100644
index 0000000..b2164f4
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/Array/splice1.js
@@ -0,0 +1,152 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: splice1.js
+ Description: 'Tests Array.splice(x,y) w/no var args'
+
+ Author: Nick Lerissa
+ Date: Fri Feb 13 09:58:28 PST 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'String:splice 1';
+ var BUGNUMBER="123795";
+
+ writeHeaderToLog('Executing script: splice1.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+
+ function mySplice(testArray, splicedArray, first, len, elements)
+ {
+ var removedArray = [];
+ var adjustedFirst = first;
+ var adjustedLen = len;
+
+ if (adjustedFirst < 0) adjustedFirst = testArray.length + first;
+ if (adjustedFirst < 0) adjustedFirst = 0;
+
+ if (adjustedLen < 0) adjustedLen = 0;
+
+ for (i = 0; (i < adjustedFirst)&&(i < testArray.length); ++i)
+ splicedArray.push(testArray[i]);
+
+ if (adjustedFirst < testArray.length)
+ for (i = adjustedFirst; (i < adjustedFirst + adjustedLen) &&
+ (i < testArray.length); ++i)
+ {
+ removedArray.push(testArray[i]);
+ }
+
+ for (i = 0; i < elements.length; i++) splicedArray.push(elements[i]);
+
+ for (i = adjustedFirst + adjustedLen; i < testArray.length; i++)
+ splicedArray.push(testArray[i]);
+
+ return removedArray;
+ }
+
+ function exhaustiveSpliceTest(testname, testArray)
+ {
+ var errorMessage;
+ var passed = true;
+ var reason = "";
+
+ for (var first = -(testArray.length+2); first <= 2 + testArray.length; first++)
+ {
+ var actualSpliced = [];
+ var expectedSpliced = [];
+ var actualRemoved = [];
+ var expectedRemoved = [];
+
+ for (var len = 0; len < testArray.length + 2; len++)
+ {
+ actualSpliced = [];
+ expectedSpliced = [];
+
+ for (var i = 0; i < testArray.length; ++i)
+ actualSpliced.push(testArray[i]);
+
+ actualRemoved = actualSpliced.splice(first,len);
+ expectedRemoved = mySplice(testArray,expectedSpliced,first,len,[]);
+
+ var adjustedFirst = first;
+ if (adjustedFirst < 0) adjustedFirst = testArray.length + first;
+ if (adjustedFirst < 0) adjustedFirst = 0;
+
+ if ( (String(actualSpliced) != String(expectedSpliced))
+ ||(String(actualRemoved) != String(expectedRemoved)))
+ {
+ if ( (String(actualSpliced) == String(expectedSpliced))
+ &&(String(actualRemoved) != String(expectedRemoved)) )
+ {
+ if ( (expectedRemoved.length == 1)
+ &&(String(actualRemoved) == String(expectedRemoved[0]))) continue;
+ if ( expectedRemoved.length == 0 && actualRemoved == void 0) continue;
+ }
+
+ errorMessage =
+ "ERROR: 'TEST FAILED'\n" +
+ " test: " + "a.splice(" + first + "," + len + ",-97,new String('test arg'),[],9.8)\n" +
+ " a: " + String(testArray) + "\n" +
+ " actual spliced: " + String(actualSpliced) + "\n" +
+ " expected spliced: " + String(expectedSpliced) + "\n" +
+ " actual removed: " + String(actualRemoved) + "\n" +
+ " expected removed: " + String(expectedRemoved) + "\n";
+ writeHeaderToLog(errorMessage);
+ reason = reason + errorMessage;
+ passed = false;
+ }
+ }
+ }
+ var testcase = new TestCase( SECTION, testname, true, passed);
+ if (!passed)
+ testcase.reason = reason;
+ return testcase;
+ }
+
+ var a = ['a','test string',456,9.34,new String("string object"),[],['h','i','j','k']];
+ var b = [1,2,3,4,5,6,7,8,9,0];
+
+ testcases[count++] = exhaustiveSpliceTest("exhaustive splice w/no optional args 1",a);
+ testcases[count++] = exhaustiveSpliceTest("exhaustive splice w/no optional args 1",b);
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
+
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/Array/splice2.js b/Source/JavaScriptCore/tests/mozilla/js1_2/Array/splice2.js
new file mode 100644
index 0000000..30861a5
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/Array/splice2.js
@@ -0,0 +1,150 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: splice2.js
+ Description: 'Tests Array.splice(x,y) w/4 var args'
+
+ Author: Nick Lerissa
+ Date: Fri Feb 13 09:58:28 PST 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'String:splice 2';
+ var BUGNUMBER="123795";
+
+ writeHeaderToLog('Executing script: splice2.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+
+ function mySplice(testArray, splicedArray, first, len, elements)
+ {
+ var removedArray = [];
+ var adjustedFirst = first;
+ var adjustedLen = len;
+
+ if (adjustedFirst < 0) adjustedFirst = testArray.length + first;
+ if (adjustedFirst < 0) adjustedFirst = 0;
+
+ if (adjustedLen < 0) adjustedLen = 0;
+
+ for (i = 0; (i < adjustedFirst)&&(i < testArray.length); ++i)
+ splicedArray.push(testArray[i]);
+
+ if (adjustedFirst < testArray.length)
+ for (i = adjustedFirst; (i < adjustedFirst + adjustedLen) && (i < testArray.length); ++i)
+ removedArray.push(testArray[i]);
+
+ for (i = 0; i < elements.length; i++) splicedArray.push(elements[i]);
+
+ for (i = adjustedFirst + adjustedLen; i < testArray.length; i++)
+ splicedArray.push(testArray[i]);
+
+ return removedArray;
+ }
+
+ function exhaustiveSpliceTestWithArgs(testname, testArray)
+ {
+ var passed = true;
+ var errorMessage;
+ var reason = "";
+ for (var first = -(testArray.length+2); first <= 2 + testArray.length; first++)
+ {
+ var actualSpliced = [];
+ var expectedSpliced = [];
+ var actualRemoved = [];
+ var expectedRemoved = [];
+
+ for (var len = 0; len < testArray.length + 2; len++)
+ {
+ actualSpliced = [];
+ expectedSpliced = [];
+
+ for (var i = 0; i < testArray.length; ++i)
+ actualSpliced.push(testArray[i]);
+
+ actualRemoved = actualSpliced.splice(first,len,-97,new String("test arg"),[],9.8);
+ expectedRemoved = mySplice(testArray,expectedSpliced,first,len,[-97,new String("test arg"),[],9.8]);
+
+ var adjustedFirst = first;
+ if (adjustedFirst < 0) adjustedFirst = testArray.length + first;
+ if (adjustedFirst < 0) adjustedFirst = 0;
+
+
+ if ( (String(actualSpliced) != String(expectedSpliced))
+ ||(String(actualRemoved) != String(expectedRemoved)))
+ {
+ if ( (String(actualSpliced) == String(expectedSpliced))
+ &&(String(actualRemoved) != String(expectedRemoved)) )
+ {
+
+ if ( (expectedRemoved.length == 1)
+ &&(String(actualRemoved) == String(expectedRemoved[0]))) continue;
+ if ( expectedRemoved.length == 0 && actualRemoved == void 0 ) continue;
+ }
+
+ errorMessage =
+ "ERROR: 'TEST FAILED' ERROR: 'TEST FAILED' ERROR: 'TEST FAILED'\n" +
+ " test: " + "a.splice(" + first + "," + len + ",-97,new String('test arg'),[],9.8)\n" +
+ " a: " + String(testArray) + "\n" +
+ " actual spliced: " + String(actualSpliced) + "\n" +
+ " expected spliced: " + String(expectedSpliced) + "\n" +
+ " actual removed: " + String(actualRemoved) + "\n" +
+ " expected removed: " + String(expectedRemoved);
+ reason = reason + errorMessage;
+ writeHeaderToLog(errorMessage);
+ passed = false;
+ }
+ }
+ }
+ var testcase = new TestCase(SECTION, testname, true, passed);
+ if (!passed) testcase.reason = reason;
+ return testcase;
+ }
+
+
+ var a = ['a','test string',456,9.34,new String("string object"),[],['h','i','j','k']];
+ var b = [1,2,3,4,5,6,7,8,9,0];
+
+ testcases[count++] = exhaustiveSpliceTestWithArgs("exhaustive splice w/2 optional args 1",a);
+ testcases[count++] = exhaustiveSpliceTestWithArgs("exhaustive splice w/2 optional args 2",b);
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
+
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/Array/tostring_1.js b/Source/JavaScriptCore/tests/mozilla/js1_2/Array/tostring_1.js
new file mode 100644
index 0000000..b74228e
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/Array/tostring_1.js
@@ -0,0 +1,138 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: tostring_1.js
+ ECMA Section: Array.toString()
+ Description:
+
+ This checks the ToString value of Array objects under JavaScript 1.2.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "JS1_2";
+ var VERSION = "JS1_2";
+ startTest();
+ var TITLE = "Array.toString()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var a = new Array();
+
+ var VERSION = 0;
+
+ /* This test assumes that if version() exists, it can set the JavaScript
+ * interpreter to an arbitrary version. To prevent unhandled exceptions in
+ * other tests, jsc implements version() as a stub function, but
+ * JavaScriptCore doesn't support setting the JavaScript engine's version.
+
+ * Commenting out the following lines forces the test to expect JavaScript
+ * 1.5 results.
+
+ * If JavaScriptCore changes to support versioning, this test should split
+ * into a 1.2 test in js1_2/ and a 1.5 test in js1_5/.
+ */
+
+ /*
+ if ( typeof version == "function" ) {
+ version(120);
+ VERSION = "120";
+ } else {
+ function version() { return 0; };
+ }
+ */
+
+ testcases[tc++] = new TestCase ( SECTION,
+ "var a = new Array(); a.toString()",
+ ( VERSION == "120" ? "[]" : "" ),
+ a.toString() );
+
+ a[0] = void 0;
+
+ testcases[tc++] = new TestCase ( SECTION,
+ "a[0] = void 0; a.toString()",
+ ( VERSION == "120" ? "[, ]" : "" ),
+ a.toString() );
+
+
+ testcases[tc++] = new TestCase( SECTION,
+ "a.length",
+ 1,
+ a.length );
+
+ a[1] = void 0;
+
+ testcases[tc++] = new TestCase( SECTION,
+ "a[1] = void 0; a.toString()",
+ ( VERSION == "120" ? "[, , ]" : "," ),
+ a.toString() );
+
+ a[1] = "hi";
+
+ testcases[tc++] = new TestCase( SECTION,
+ "a[1] = \"hi\"; a.toString()",
+ ( VERSION == "120" ? "[, \"hi\"]" : ",hi" ),
+ a.toString() );
+
+ a[2] = void 0;
+
+ testcases[tc++] = new TestCase( SECTION,
+ "a[2] = void 0; a.toString()",
+ ( VERSION == "120" ?"[, \"hi\", , ]":",hi,"),
+ a.toString() );
+
+ var b = new Array(1000);
+ var bstring = "";
+ for ( blen=0; blen<999; blen++) {
+ bstring += ",";
+ }
+
+
+ testcases[tc++] = new TestCase ( SECTION,
+ "var b = new Array(1000); b.toString()",
+ ( VERSION == "120" ? "[1000]" : bstring ),
+ b.toString() );
+
+
+ testcases[tc++] = new TestCase( SECTION,
+ "b.length",
+ ( VERSION == "120" ? 1 : 1000 ),
+ b.length );
+
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/Array/tostring_2.js b/Source/JavaScriptCore/tests/mozilla/js1_2/Array/tostring_2.js
new file mode 100644
index 0000000..5ed7425
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/Array/tostring_2.js
@@ -0,0 +1,96 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: tostring_2.js
+ Reference: http://scopus.mcom.com/bugsplat/show_bug.cgi?id=114564
+ Description: toString in version 120
+
+
+ Author: christine@netscape.com
+ Date: 15 June 1998
+*/
+
+ var SECTION = "Array/tostring_2.js";
+ var VERSION = "JS_12";
+ startTest();
+ var TITLE = "Array.toString";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var a = [];
+
+ var VERSION = 0;
+
+ /* This test assumes that if version() exists, it can set the JavaScript
+ * interpreter to an arbitrary version. To prevent unhandled exceptions in
+ * other tests, jsc implements version() as a stub function, but
+ * JavaScriptCore doesn't support setting the JavaScript engine's version.
+
+ * Commenting out the following lines forces the test to expect JavaScript
+ * 1.5 results.
+
+ * If JavaScriptCore changes to support versioning, this test should split
+ * into a 1.2 test in js1_2/ and a 1.5 test in js1_5/.
+ */
+
+ /*
+ if ( typeof version == "function" ) {
+ writeLineToLog("version 120");
+ version(120);
+ VERSION = "120";
+ } else {
+ function version() { return 0; };
+ }
+ */
+
+ testcases[tc++] = new TestCase ( SECTION,
+ "a.toString()",
+ ( VERSION == "120" ? "[]" : "" ),
+ a.toString() );
+
+ testcases[tc++] = new TestCase ( SECTION,
+ "String( a )",
+ ( VERSION == "120" ? "[]" : "" ),
+ String( a ) );
+
+ testcases[tc++] = new TestCase ( SECTION,
+ "a +''",
+ ( VERSION == "120" ? "[]" : "" ),
+ a+"" );
+
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/Objects/toString-001.js b/Source/JavaScriptCore/tests/mozilla/js1_2/Objects/toString-001.js
new file mode 100644
index 0000000..33976bd
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/Objects/toString-001.js
@@ -0,0 +1,117 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: toString_1.js
+ ECMA Section: Object.toString()
+ Description:
+
+ This checks the ToString value of Object objects under JavaScript 1.2.
+
+ In JavaScript 1.2, Object.toString()
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "JS1_2";
+ var VERSION = "JS1_2";
+ startTest();
+ var TITLE = "Object.toString()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var o = new Object();
+
+ testcases[testcases.length] = new TestCase( SECTION,
+ "var o = new Object(); o.toString()",
+ "{}",
+ o.toString() );
+
+ o = {};
+
+ testcases[testcases.length] = new TestCase( SECTION,
+ "o = {}; o.toString()",
+ "{}",
+ o.toString() );
+
+ o = { name:"object", length:0, value:"hello" }
+
+ testcases[testcases.length] = new TestCase( SECTION,
+ "o = { name:\"object\", length:0, value:\"hello\" }; o.toString()",
+ true,
+ checkObjectToString(o.toString(), ['name:"object"', 'length:0',
+ 'value:"hello"']));
+
+ o = { name:"object", length:0, value:"hello",
+ toString:new Function( "return this.value+''" ) }
+
+ testcases[testcases.length] = new TestCase( SECTION,
+ "o = { name:\"object\", length:0, value:\"hello\", "+
+ "toString:new Function( \"return this.value+''\" ) }; o.toString()",
+ "hello",
+ o.toString() );
+
+
+
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
+/**
+ * checkObjectToString
+ *
+ * In JS1.2, Object.prototype.toString returns a representation of the
+ * object's properties as a string. However, the order of the properties
+ * in the resulting string is not specified. This function compares the
+ * resulting string with an array of strings to make sure that the
+ * resulting string is some permutation of the strings in the array.
+ */
+function checkObjectToString(s, a) {
+ var m = /^\{(.*)\}$/(s);
+ if (!m)
+ return false; // should begin and end with curly brackets
+ var a2 = m[1].split(", ");
+ if (a.length != a2.length)
+ return false; // should be same length
+ a.sort();
+ a2.sort();
+ for (var i=0; i < a.length; i++) {
+ if (a[i] != a2[i])
+ return false; // should have identical elements
+ }
+ return true;
+}
+
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/String/charCodeAt.js b/Source/JavaScriptCore/tests/mozilla/js1_2/String/charCodeAt.js
new file mode 100644
index 0000000..ec4a7a2
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/String/charCodeAt.js
@@ -0,0 +1,71 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: charCodeAt.js
+ Description: 'This tests new String object method: charCodeAt'
+
+ Author: Nick Lerissa
+ Date: Fri Feb 13 09:58:28 PST 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'String:charCodeAt';
+
+ writeHeaderToLog('Executing script: charCodeAt.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+
+ var aString = new String("tEs5");
+
+ testcases[count++] = new TestCase( SECTION, "aString.charCodeAt(-2)", NaN, aString.charCodeAt(-2));
+ testcases[count++] = new TestCase( SECTION, "aString.charCodeAt(-1)", NaN, aString.charCodeAt(-1));
+ testcases[count++] = new TestCase( SECTION, "aString.charCodeAt( 0)", 116, aString.charCodeAt( 0));
+ testcases[count++] = new TestCase( SECTION, "aString.charCodeAt( 1)", 69, aString.charCodeAt( 1));
+ testcases[count++] = new TestCase( SECTION, "aString.charCodeAt( 2)", 115, aString.charCodeAt( 2));
+ testcases[count++] = new TestCase( SECTION, "aString.charCodeAt( 3)", 53, aString.charCodeAt( 3));
+ testcases[count++] = new TestCase( SECTION, "aString.charCodeAt( 4)", NaN, aString.charCodeAt( 4));
+ testcases[count++] = new TestCase( SECTION, "aString.charCodeAt( 5)", NaN, aString.charCodeAt( 5));
+ testcases[count++] = new TestCase( SECTION, "aString.charCodeAt( Infinity)", NaN, aString.charCodeAt( Infinity));
+ testcases[count++] = new TestCase( SECTION, "aString.charCodeAt(-Infinity)", NaN, aString.charCodeAt(-Infinity));
+ //testcases[count++] = new TestCase( SECTION, "aString.charCodeAt( )", 116, aString.charCodeAt( ));
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
+
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/String/concat.js b/Source/JavaScriptCore/tests/mozilla/js1_2/String/concat.js
new file mode 100644
index 0000000..725abb7
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/String/concat.js
@@ -0,0 +1,96 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: concat.js
+ Description: 'This tests the new String object method: concat'
+
+ Author: NickLerissa
+ Date: Fri Feb 13 09:58:28 PST 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'String:concat';
+
+ writeHeaderToLog('Executing script: concat.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+
+ var aString = new String("test string");
+ var bString = new String(" another ");
+
+ testcases[count++] = new TestCase( SECTION, "aString.concat(' more')", "test string more", aString.concat(' more').toString());
+ testcases[count++] = new TestCase( SECTION, "aString.concat(bString)", "test string another ", aString.concat(bString).toString());
+ testcases[count++] = new TestCase( SECTION, "aString ", "test string", aString.toString());
+ testcases[count++] = new TestCase( SECTION, "bString ", " another ", bString.toString());
+ testcases[count++] = new TestCase( SECTION, "aString.concat(345) ", "test string345", aString.concat(345).toString());
+ testcases[count++] = new TestCase( SECTION, "aString.concat(true) ", "test stringtrue", aString.concat(true).toString());
+ testcases[count++] = new TestCase( SECTION, "aString.concat(null) ", "test stringnull", aString.concat(null).toString());
+ /*
+ http://bugs.webkit.org/show_bug.cgi?id=11545#c3
+ According to ECMA 15.5.4.6, the argument of concat should send to ToString and
+ convert into a string value (not String object). So these arguments will be
+ convert into '' and '1,2,3' under ECMA-262v3, not the js1.2 expected '[]' and
+ '[1,2,3]'
+ */
+ //testcases[count++] = new TestCase( SECTION, "aString.concat([]) ", "test string[]", aString.concat([]).toString());
+ //testcases[count++] = new TestCase( SECTION, "aString.concat([1,2,3])", "test string[1, 2, 3]", aString.concat([1,2,3]).toString());
+
+ testcases[count++] = new TestCase( SECTION, "'abcde'.concat(' more')", "abcde more", 'abcde'.concat(' more').toString());
+ testcases[count++] = new TestCase( SECTION, "'abcde'.concat(bString)", "abcde another ", 'abcde'.concat(bString).toString());
+ testcases[count++] = new TestCase( SECTION, "'abcde' ", "abcde", 'abcde');
+ testcases[count++] = new TestCase( SECTION, "'abcde'.concat(345) ", "abcde345", 'abcde'.concat(345).toString());
+ testcases[count++] = new TestCase( SECTION, "'abcde'.concat(true) ", "abcdetrue", 'abcde'.concat(true).toString());
+ testcases[count++] = new TestCase( SECTION, "'abcde'.concat(null) ", "abcdenull", 'abcde'.concat(null).toString());
+ /*
+ http://bugs.webkit.org/show_bug.cgi?id=11545#c3
+ According to ECMA 15.5.4.6, the argument of concat should send to ToString and
+ convert into a string value (not String object). So these arguments will be
+ convert into '' and '1,2,3' under ECMA-262v3, not the js1.2 expected '[]' and
+ '[1,2,3]'
+ */
+ //testcases[count++] = new TestCase( SECTION, "'abcde'.concat([]) ", "abcde[]", 'abcde'.concat([]).toString());
+ //testcases[count++] = new TestCase( SECTION, "'abcde'.concat([1,2,3])", "abcde[1, 2, 3]", 'abcde'.concat([1,2,3]).toString());
+
+ //what should this do:
+ testcases[count++] = new TestCase( SECTION, "'abcde'.concat() ", "abcde", 'abcde'.concat().toString());
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
+
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/String/match.js b/Source/JavaScriptCore/tests/mozilla/js1_2/String/match.js
new file mode 100644
index 0000000..6c4efb4
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/String/match.js
@@ -0,0 +1,62 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: match.js
+ Description: 'This tests the new String object method: match'
+
+ Author: NickLerissa
+ Date: Fri Feb 13 09:58:28 PST 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'String:match';
+
+ writeHeaderToLog('Executing script: match.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+
+ var aString = new String("this is a test string");
+
+ testcases[count++] = new TestCase( SECTION, "aString.match(/is.*test/) ", String(["is is a test"]), String(aString.match(/is.*test/)));
+ testcases[count++] = new TestCase( SECTION, "aString.match(/s.*s/) ", String(["s is a test s"]), String(aString.match(/s.*s/)));
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
+
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/String/slice.js b/Source/JavaScriptCore/tests/mozilla/js1_2/String/slice.js
new file mode 100644
index 0000000..f0e901e
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/String/slice.js
@@ -0,0 +1,123 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: slice.js
+ Description: 'This tests the String object method: slice'
+
+ Author: Nick Lerissa
+ Date: Fri Feb 13 09:58:28 PST 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'String.slice';
+
+ writeHeaderToLog('Executing script: slice.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+
+ function myStringSlice(a, from, to)
+ {
+ var from2 = from;
+ var to2 = to;
+ var returnString = new String("");
+ var i;
+
+ if (from2 < 0) from2 = a.length + from;
+ if (to2 < 0) to2 = a.length + to;
+
+ if ((to2 > from2)&&(to2 > 0)&&(from2 < a.length))
+ {
+ if (from2 < 0) from2 = 0;
+ if (to2 > a.length) to2 = a.length;
+
+ for (i = from2; i < to2; ++i) returnString += a.charAt(i);
+ }
+ return returnString;
+ }
+
+ // This function tests the slice command on a String
+ // passed in. The arguments passed into slice range in
+ // value from -5 to the length of the array + 4. Every
+ // combination of the two arguments is tested. The expected
+ // result of the slice(...) method is calculated and
+ // compared to the actual result from the slice(...) method.
+ // If the Strings are not similar false is returned.
+ function exhaustiveStringSliceTest(testname, a)
+ {
+ var x = 0;
+ var y = 0;
+ var errorMessage;
+ var reason = "";
+ var passed = true;
+
+ for (x = -(2 + a.length); x <= (2 + a.length); x++)
+ for (y = (2 + a.length); y >= -(2 + a.length); y--)
+ {
+ var b = a.slice(x,y);
+ var c = myStringSlice(a,x,y);
+
+ if (String(b) != String(c))
+ {
+ errorMessage =
+ "ERROR: 'TEST FAILED' ERROR: 'TEST FAILED' ERROR: 'TEST FAILED'\n" +
+ " test: " + "a.slice(" + x + "," + y + ")\n" +
+ " a: " + String(a) + "\n" +
+ " actual result: " + String(b) + "\n" +
+ " expected result: " + String(c) + "\n";
+ writeHeaderToLog(errorMessage);
+ reason = reason + errorMessage;
+ passed = false;
+ }
+ }
+ var testCase = new TestCase(SECTION, testname, true, passed);
+ if (passed == false)
+ testCase.reason = reason;
+ return testCase;
+ }
+
+ var a = new String("abcdefghijklmnopqrstuvwxyz1234567890");
+ var b = new String("this is a test string");
+
+ testcases[count++] = exhaustiveStringSliceTest("exhaustive String.slice test 1", a);
+ testcases[count++] = exhaustiveStringSliceTest("exhaustive String.slice test 2", b);
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
+
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/browser.js b/Source/JavaScriptCore/tests/mozilla/js1_2/browser.js
new file mode 100644
index 0000000..8b298a0
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/browser.js
@@ -0,0 +1,83 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/*
+ * JavaScript test library shared functions file for running the tests
+ * in the browser. Overrides the shell's print function with document.write
+ * and make everything HTML pretty.
+ *
+ * To run the tests in the browser, use the mkhtml.pl script to generate
+ * html pages that include the shell.js, browser.js (this file), and the
+ * test js file in script tags.
+ *
+ * The source of the page that is generated should look something like this:
+ * <script src="./../shell.js"></script>
+ * <script src="./../browser.js"></script>
+ * <script src="./mytest.js"></script>
+ */
+
+onerror = err;
+
+var GLOBAL = "[object Window]";
+
+function startTest() {
+ writeHeaderToLog( SECTION + " "+ TITLE);
+ if ( BUGNUMBER ) {
+ writeLineToLog ("BUGNUMBER: " + BUGNUMBER );
+ }
+
+ testcases = new Array();
+ tc = 0;
+}
+
+function writeLineToLog( string ) {
+ document.write( string + "<br>\n");
+}
+function writeHeaderToLog( string ) {
+ document.write( "<h2>" + string + "</h2>" );
+}
+function stopTest() {
+ var gc;
+ if ( gc != undefined ) {
+ gc();
+ }
+ document.write( "<hr>" );
+}
+function writeFormattedResult( expect, actual, string, passed ) {
+ var s = "<tt>"+ string ;
+ s += "<b>" ;
+ s += ( passed ) ? "<font color=#009900> &nbsp;" + PASSED
+ : "<font color=#aa0000>&nbsp;" + FAILED + expect + "</tt>";
+ writeLineToLog( s + "</font></b></tt>" );
+ return passed;
+}
+function err ( msg, page, line ) {
+ writeLineToLog( "Test " + page + " failed on line " + line +" with the message: " + msg );
+
+ testcases[tc].actual = "error";
+ testcases[tc].reason = msg;
+ writeTestCaseResult( testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual +
+ ": " + testcases[tc].reason );
+ stopTest();
+ return true;
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/function/Function_object.js b/Source/JavaScriptCore/tests/mozilla/js1_2/function/Function_object.js
new file mode 100644
index 0000000..1dec16a
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/function/Function_object.js
@@ -0,0 +1,85 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: Function_object.js
+ Description: 'Testing Function objects'
+
+ Author: Nick Lerissa
+ Date: April 17, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'functions: Function_object';
+
+ writeHeaderToLog('Executing script: Function_object.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+
+ function a_test_function(a,b,c)
+ {
+ return a + b + c;
+ }
+
+ f = a_test_function;
+
+
+ testcases[count++] = new TestCase( SECTION, "f.name",
+ 'a_test_function', f.name);
+
+ testcases[count++] = new TestCase( SECTION, "f.length",
+ 3, f.length);
+
+ testcases[count++] = new TestCase( SECTION, "f.arity",
+ 3, f.arity);
+
+ testcases[count++] = new TestCase( SECTION, "f(2,3,4)",
+ 9, f(2,3,4));
+
+ var fnName = version() == 120 ? '' : 'anonymous';
+
+ testcases[count++] = new TestCase( SECTION, "(new Function()).name",
+ fnName, (new Function()).name);
+
+ testcases[count++] = new TestCase( SECTION, "(new Function()).toString()",
+ '\nfunction ' + fnName + '() {\n}\n', (new Function()).toString());
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
+
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/function/Number.js b/Source/JavaScriptCore/tests/mozilla/js1_2/function/Number.js
new file mode 100644
index 0000000..9586f78
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/function/Number.js
@@ -0,0 +1,98 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: Number.js
+ Description: 'This tests the function Number(Object)'
+
+ Author: Nick Lerissa
+ Date: Fri Feb 13 09:58:28 PST 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'functions: Number';
+ var BUGNUMBER="123435";
+
+ writeHeaderToLog('Executing script: Number.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+
+ date = new Date(2200);
+
+ testcases[count++] = new TestCase( SECTION, "Number(new Date(2200)) ",
+ 2200, (Number(date)));
+ testcases[count++] = new TestCase( SECTION, "Number(true) ",
+ 1, (Number(true)));
+ testcases[count++] = new TestCase( SECTION, "Number(false) ",
+ 0, (Number(false)));
+ testcases[count++] = new TestCase( SECTION, "Number('124') ",
+ 124, (Number('124')));
+ testcases[count++] = new TestCase( SECTION, "Number('1.23') ",
+ 1.23, (Number('1.23')));
+ testcases[count++] = new TestCase( SECTION, "Number({p:1}) ",
+ NaN, (Number({p:1})));
+ testcases[count++] = new TestCase( SECTION, "Number(null) ",
+ 0, (Number(null)));
+ testcases[count++] = new TestCase( SECTION, "Number(-45) ",
+ -45, (Number(-45)));
+
+ // http://scopus.mcom.com/bugsplat/show_bug.cgi?id=123435
+ // under js1.2, Number([1,2,3]) should return 3.
+
+ /*
+ http://bugs.webkit.org/show_bug.cgi?id=11545#c4
+ According to ECMA 9.3, when input type was Object, should call
+ ToPrimitive(input arg, hint Number) first, and than ToNumber() later. However,
+ ToPrimitive() will use [[DefaultValue]](hint) rule when input Type was Object
+ (ECMA 8.6.2.6). So the input [1,2,3] will applied [[DefaultValue]](hint) rule
+ with hint Number, and it looks like this:
+
+ toString(valuOf([1,2,3])) => toString(1,2,3) => '1,2,3'
+
+ Than ToNumber('1,2,3') results NaN based on ECMA 9.3.1: If the grammar cannot
+ interpret the string as an expansion of StringNumericLiteral, then the result
+ of ToNumber is NaN.
+ */
+
+ //testcases[count++] = new TestCase( SECTION, "Number([1,2,3]) ",
+ // 3, (Number([1,2,3])));
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
+
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/function/String.js b/Source/JavaScriptCore/tests/mozilla/js1_2/function/String.js
new file mode 100644
index 0000000..724c392
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/function/String.js
@@ -0,0 +1,99 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: String.js
+ Description: 'This tests the function String(Object)'
+
+ Author: Nick Lerissa
+ Date: Fri Feb 13 09:58:28 PST 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'functions: String';
+
+ writeHeaderToLog('Executing script: String.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+
+ testcases[count++] = new TestCase( SECTION, "String(true) ",
+ 'true', (String(true)));
+ testcases[count++] = new TestCase( SECTION, "String(false) ",
+ 'false', (String(false)));
+ testcases[count++] = new TestCase( SECTION, "String(-124) ",
+ '-124', (String(-124)));
+ testcases[count++] = new TestCase( SECTION, "String(1.23) ",
+ '1.23', (String(1.23)));
+ /*
+ http://bugs.webkit.org/show_bug.cgi?id=11545#c5
+ According to ECMA 9.8, when input type of String object argument was Object, we
+ should applied ToPrimitive(input arg, hint String) first, and later ToString().
+ And just like previous one, ToPrimitive() will use [[DefaultValue]](hint)
+ with hint String to convert the input (toString() below uses the rule in ECMA 15.2.4.2):
+
+ valueOf(toString({p:1}) => valueOf('[object Object]') => '[object Object]'
+
+ And ToString() called after ToPrimitive(), so the correct result would be:
+
+ [object Object]
+ */
+ //testcases[count++] = new TestCase( SECTION, "String({p:1}) ",
+ // '{p:1}', (String({p:1})));
+ testcases[count++] = new TestCase( SECTION, "String(null) ",
+ 'null', (String(null)));
+ /*
+ http://bugs.webkit.org/show_bug.cgi?id=11545#c5
+ According to ECMA 9.8, when input type of String object argument was Object, we
+ should applied ToPrimitive(input arg, hint String) first, and later ToString().
+ And just like previous one, ToPrimitive() will use [[DefaultValue]](hint)
+ with hint String to convert the input (toString() below uses the rule in ECMA 15.2.4.2):
+
+ valueOf(toString([1,2,3])) => valueOf('1,2,3') => '1,2,3'
+
+ And ToString() called after ToPrimitive(), so the correct result would be:
+
+ 1,2,3
+ */
+ //testcases[count++] = new TestCase( SECTION, "String([1,2,3]) ",
+ // '[1, 2, 3]', (String([1,2,3])));
+
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
+
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/function/definition-1.js b/Source/JavaScriptCore/tests/mozilla/js1_2/function/definition-1.js
new file mode 100644
index 0000000..6daea71
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/function/definition-1.js
@@ -0,0 +1,73 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: definition-1.js
+ Reference: http://scopus.mcom.com/bugsplat/show_bug.cgi?id=111284
+ Description: Regression test for declaring functions.
+
+ Author: christine@netscape.com
+ Date: 15 June 1998
+*/
+
+ var SECTION = "function/definition-1.js";
+ var VERSION = "JS_12";
+ startTest();
+ var TITLE = "Regression test for 111284";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ f1 = function() { return "passed!" }
+
+ function f2() { f3 = function() { return "passed!" }; return f3(); }
+
+ testcases[tc++] = new TestCase( SECTION,
+ 'f1 = function() { return "passed!" }; f1()',
+ "passed!",
+ f1() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ 'function f2() { f3 = function { return "passed!" }; return f3() }; f2()',
+ "passed!",
+ f2() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ 'f3()',
+ "passed!",
+ f3() );
+
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/function/function-001-n.js b/Source/JavaScriptCore/tests/mozilla/js1_2/function/function-001-n.js
new file mode 100644
index 0000000..5ae01a9
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/function/function-001-n.js
@@ -0,0 +1,74 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ * File Name: boolean-001.js
+ * Description:
+ *
+ * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=99232
+ *
+ * eval("function f(){}function g(){}") at top level is an error for JS1.2
+ * and above (missing ; between named function expressions), but declares f
+ * and g as functions below 1.2.
+ *
+ * Fails to produce error regardless of version:
+ * js> version(100)
+ * 120
+ * js> eval("function f(){}function g(){}")
+ * js> version(120);
+ * 100
+ * js> eval("function f(){}function g(){}")
+ * js>
+ * Author: christine@netscape.com
+ * Date: 11 August 1998
+ */
+ var SECTION = "function-001.js";
+ var VERSION = "JS1_1";
+ startTest();
+ var TITLE = "functions not separated by semicolons are errors in version 120 and higher";
+ var BUGNUMBER="99232";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "eval(\"function f(){}function g(){}\")",
+ "error",
+ eval("function f(){}function g(){}") );
+
+ test();
+
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/function/length.js b/Source/JavaScriptCore/tests/mozilla/js1_2/function/length.js
new file mode 100644
index 0000000..aae30d5
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/function/length.js
@@ -0,0 +1,93 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.3.5.1.js
+ ECMA Section: Function.length
+ Description:
+
+ The value of the length property is usually an integer that indicates the
+ "typical" number of arguments expected by the function. However, the
+ language permits the function to be invoked with some other number of
+ arguments. The behavior of a function when invoked on a number of arguments
+ other than the number specified by its length property depends on the function.
+
+ This checks the pre-ecma behavior Function.length.
+
+ http://scopus.mcom.com/bugsplat/show_bug.cgi?id=104204
+
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "function/length.js";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Function.length";
+ var BUGNUMBER="104204";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var f = new Function( "a","b", "c", "return f.length");
+
+ if ( version() <= 120 ) {
+
+ testcases[tc++] = new TestCase( SECTION,
+ 'var f = new Function( "a","b", "c", "return f.length"); f()',
+ 0,
+ f() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ 'var f = new Function( "a","b", "c", "return f.length"); f(1,2,3,4,5)',
+ 5,
+ f(1,2,3,4,5) );
+ } else {
+
+ testcases[tc++] = new TestCase( SECTION,
+ 'var f = new Function( "a","b", "c", "return f.length"); f()',
+ 3,
+ f() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ 'var f = new Function( "a","b", "c", "return f.length"); f(1,2,3,4,5)',
+ 3,
+ f(1,2,3,4,5) );
+
+
+ }
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/function/nesting-1.js b/Source/JavaScriptCore/tests/mozilla/js1_2/function/nesting-1.js
new file mode 100644
index 0000000..391f926
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/function/nesting-1.js
@@ -0,0 +1,61 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: nesting-1.js
+ Reference: http://scopus.mcom.com/bugsplat/show_bug.cgi?id=122040
+ Description: Regression test for a nested function
+
+ Author: christine@netscape.com
+ Date: 15 June 1998
+*/
+
+ var SECTION = "function/nesting-1.js";
+ var VERSION = "JS_12";
+ startTest();
+ var TITLE = "Regression test for 122040";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ function f(a) {function g(b) {return a+b;}; return g;}; f(7)
+
+ testcases[tc++] = new TestCase( SECTION,
+ 'function f(a) {function g(b) {return a+b;}; return g;}; typeof f(7)',
+ "function",
+ typeof f(7) );
+
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/function/nesting.js b/Source/JavaScriptCore/tests/mozilla/js1_2/function/nesting.js
new file mode 100644
index 0000000..b626da5
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/function/nesting.js
@@ -0,0 +1,83 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: nesting.js
+ Description: 'This tests the nesting of functions'
+
+ Author: Nick Lerissa
+ Date: Fri Feb 13 09:58:28 PST 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'functions: nesting';
+
+ writeHeaderToLog('Executing script: nesting.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+
+ function outer_func(x)
+ {
+ var y = "outer";
+
+ testcases[count++] = new TestCase( SECTION, "outer:x ",
+ 1111, x);
+ testcases[count++] = new TestCase( SECTION, "outer:y ",
+ 'outer', y);
+ function inner_func(x)
+ {
+ var y = "inner";
+ testcases[count++] = new TestCase( SECTION, "inner:x ",
+ 2222, x);
+ testcases[count++] = new TestCase( SECTION, "inner:y ",
+ 'inner', y);
+ };
+
+ inner_func(2222);
+ testcases[count++] = new TestCase( SECTION, "outer:x ",
+ 1111, x);
+ testcases[count++] = new TestCase( SECTION, "outer:y ",
+ 'outer', y);
+ }
+
+ outer_func(1111);
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
+
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/function/regexparg-1.js b/Source/JavaScriptCore/tests/mozilla/js1_2/function/regexparg-1.js
new file mode 100644
index 0000000..b01825c
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/function/regexparg-1.js
@@ -0,0 +1,98 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: regexparg-1.js
+ Description:
+
+ Regression test for
+ http://scopus/bugsplat/show_bug.cgi?id=122787
+ Passing a regular expression as the first constructor argument fails
+
+ Author: christine@netscape.com
+ Date: 15 June 1998
+*/
+
+ var SECTION = "JS_1.2";
+ var VERSION = "JS_1.2";
+ startTest();
+ var TITLE = "The variable statment";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ function f(x) {return x;}
+
+ x = f(/abc/);
+
+ testcases[tc++] = new TestCase( SECTION,
+ "function f(x) {return x;}; f()",
+ void 0,
+ f() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "f(\"hi\")",
+ "hi",
+ f("hi") );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "new f(/abc/) +''",
+ "/abc/",
+ new f(/abc/) +"" );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "f(/abc/)+'')",
+ "/abc/",
+ f(/abc/) +'');
+
+ testcases[tc++] = new TestCase( SECTION,
+ "typeof f(/abc/)",
+ "function",
+ typeof f(/abc/) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "typeof new f(/abc/)",
+ "function",
+ typeof new f(/abc/) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "x = new f(/abc/); x(\"hi\")",
+ null,
+ x("hi") );
+
+
+ // js> x()
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/function/regexparg-2-n.js b/Source/JavaScriptCore/tests/mozilla/js1_2/function/regexparg-2-n.js
new file mode 100644
index 0000000..e8bf951
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/function/regexparg-2-n.js
@@ -0,0 +1,66 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: regexparg-1.js
+ Description:
+
+ Regression test for
+ http://scopus/bugsplat/show_bug.cgi?id=122787
+ Passing a regular expression as the first constructor argument fails
+
+ Author: christine@netscape.com
+ Date: 15 June 1998
+*/
+
+ var SECTION = "JS_1.2";
+ var VERSION = "JS_1.2";
+ startTest();
+ var TITLE = "The variable statment";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ function f(x) {return x;}
+
+ x = f(/abc/);
+
+ testcases[tc++] = new TestCase( SECTION,
+ "function f(x) {return x;}; x = f(/abc/); x()",
+ "error",
+ x() );
+
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/function/tostring-1.js b/Source/JavaScriptCore/tests/mozilla/js1_2/function/tostring-1.js
new file mode 100644
index 0000000..d532d65
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/function/tostring-1.js
@@ -0,0 +1,143 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: tostring-1.js
+ Section: Function.toString
+ Description:
+
+ Since the behavior of Function.toString() is implementation-dependent,
+ toString tests for function are not in the ECMA suite.
+
+ Currently, an attempt to parse the toString output for some functions
+ and verify that the result is something reasonable.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "tostring-1";
+ var VERSION = "JS1_2";
+ startTest();
+ var TITLE = "Function.toString()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var tab = " ";
+
+ t1 = new TestFunction( "stub", "value", tab + "return value;" );
+
+ t2 = new TestFunction( "ToString", "object", tab+"return object + \"\";" );
+
+ t3 = new TestFunction( "Add", "a, b, c, d, e", tab +"var s = a + b + c + d + e;\n" +
+ tab + "return s;" );
+
+ t4 = new TestFunction( "noop", "value" );
+
+ t5 = new TestFunction( "anonymous", "", tab+"return \"hello!\";" );
+
+ var f = new Function( "return \"hello!\"");
+
+ testcases[tc++] = new TestCase( SECTION,
+ "stub.toString()",
+ t1.valueOf(),
+ stub.toString() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "ToString.toString()",
+ t2.valueOf(),
+ ToString.toString() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Add.toString()",
+ t3.valueOf(),
+ Add.toString() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "noop.toString()",
+ t4.toString(),
+ noop.toString() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "f.toString()",
+ t5.toString(),
+ f.toString() );
+ test();
+
+function noop( value ) {
+}
+function Add( a, b, c, d, e ) {
+ var s = a + b + c + d + e;
+ return s;
+}
+function stub( value ) {
+ return value;
+}
+function ToString( object ) {
+ return object + "";
+}
+
+function ToBoolean( value ) {
+ if ( value == 0 || value == NaN || value == false ) {
+ return false;
+ } else {
+ return true;
+ }
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
+function TestFunction( name, args, body ) {
+ if ( name == "anonymous" && version() == 120 ) {
+ name = "";
+ }
+
+ this.name = name;
+ this.arguments = args.toString();
+ this.body = body;
+
+ /* the format of Function.toString() in JavaScript 1.2 is:
+ /n
+ function name ( arguments ) {
+ body
+ }
+ */
+ this.value = "\nfunction " + (name ? name : "" )+
+ "("+args+") {\n"+ (( body ) ? body +"\n" : "") + "}\n";
+
+ this.toString = new Function( "return this.value" );
+ this.valueOf = new Function( "return this.value" );
+ return this;
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/function/tostring-2.js b/Source/JavaScriptCore/tests/mozilla/js1_2/function/tostring-2.js
new file mode 100644
index 0000000..146764d
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/function/tostring-2.js
@@ -0,0 +1,185 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: tostring-1.js
+ Section: Function.toString
+ Description:
+
+ Since the behavior of Function.toString() is implementation-dependent,
+ toString tests for function are not in the ECMA suite.
+
+ Currently, an attempt to parse the toString output for some functions
+ and verify that the result is something reasonable.
+
+ This verifies
+ http://scopus.mcom.com/bugsplat/show_bug.cgi?id=99212
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "tostring-2";
+ var VERSION = "JS1_2";
+ startTest();
+ var TITLE = "Function.toString()";
+ var BUGNUMBER="123444";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var tab = " ";
+
+
+var equals = new TestFunction( "Equals", "a, b", tab+ "return a == b;" );
+function Equals (a, b) {
+ return a == b;
+}
+
+var reallyequals = new TestFunction( "ReallyEquals", "a, b",
+ ( version() <= 120 ) ? tab +"return a == b;" : tab +"return a === b;" );
+function ReallyEquals( a, b ) {
+ return a === b;
+}
+
+var doesntequal = new TestFunction( "DoesntEqual", "a, b", tab + "return a != b;" );
+function DoesntEqual( a, b ) {
+ return a != b;
+}
+
+var reallydoesntequal = new TestFunction( "ReallyDoesntEqual", "a, b",
+ ( version() <= 120 ) ? tab +"return a != b;" : tab +"return a !== b;" );
+function ReallyDoesntEqual( a, b ) {
+ return a !== b;
+}
+
+var testor = new TestFunction( "TestOr", "a", tab+"if (a == null || a == void 0) {\n"+
+ tab +tab+"return 0;\n"+tab+"} else {\n"+tab+tab+"return a;\n"+tab+"}" );
+function TestOr( a ) {
+ if ( a == null || a == void 0 )
+ return 0;
+ else
+ return a;
+}
+
+var testand = new TestFunction( "TestAnd", "a", tab+"if (a != null && a != void 0) {\n"+
+ tab+tab+"return a;\n" + tab+ "} else {\n"+tab+tab+"return 0;\n"+tab+"}" );
+function TestAnd( a ) {
+ if ( a != null && a != void 0 )
+ return a;
+ else
+ return 0;
+}
+
+var or = new TestFunction( "Or", "a, b", tab + "return a | b;" );
+function Or( a, b ) {
+ return a | b;
+}
+
+var and = new TestFunction( "And", "a, b", tab + "return a & b;" );
+function And( a, b ) {
+ return a & b;
+}
+
+var xor = new TestFunction( "XOr", "a, b", tab + "return a ^ b;" );
+function XOr( a, b ) {
+ return a ^ b;
+}
+
+ testcases[testcases.length] = new TestCase( SECTION,
+ "Equals.toString()",
+ equals.valueOf(),
+ Equals.toString() );
+
+ testcases[testcases.length] = new TestCase( SECTION,
+ "ReallyEquals.toString()",
+ reallyequals.valueOf(),
+ ReallyEquals.toString() );
+
+ testcases[testcases.length] = new TestCase( SECTION,
+ "DoesntEqual.toString()",
+ doesntequal.valueOf(),
+ DoesntEqual.toString() );
+
+ testcases[testcases.length] = new TestCase( SECTION,
+ "ReallyDoesntEqual.toString()",
+ reallydoesntequal.valueOf(),
+ ReallyDoesntEqual.toString() );
+
+ testcases[testcases.length] = new TestCase( SECTION,
+ "TestOr.toString()",
+ testor.valueOf(),
+ TestOr.toString() );
+
+ testcases[testcases.length] = new TestCase( SECTION,
+ "TestAnd.toString()",
+ testand.valueOf(),
+ TestAnd.toString() );
+
+ testcases[testcases.length] = new TestCase( SECTION,
+ "Or.toString()",
+ or.valueOf(),
+ Or.toString() );
+
+ testcases[testcases.length] = new TestCase( SECTION,
+ "And.toString()",
+ and.valueOf(),
+ And.toString() );
+
+ testcases[testcases.length] = new TestCase( SECTION,
+ "XOr.toString()",
+ xor.valueOf(),
+ XOr.toString() );
+
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function TestFunction( name, args, body ) {
+ this.name = name;
+ this.arguments = args.toString();
+ this.body = body;
+
+ /* the format of Function.toString() in JavaScript 1.2 is:
+ /n
+ function name ( arguments ) {
+ body
+ }
+ */
+ this.value = "\nfunction " + (name ? name : "anonymous" )+
+ "("+args+") {\n"+ (( body ) ? body +"\n" : "") + "}\n";
+
+ this.toString = new Function( "return this.value" );
+ this.valueOf = new Function( "return this.value" );
+ return this;
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/jsref.js b/Source/JavaScriptCore/tests/mozilla/js1_2/jsref.js
new file mode 100644
index 0000000..3ecb4c1
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/jsref.js
@@ -0,0 +1,215 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+var completed = false;
+var testcases;
+var tc = 0;
+
+SECTION = "";
+VERSION = "";
+BUGNUMBER = "";
+EXCLUDE = "";
+
+/*
+ * constant strings
+ */
+var GLOBAL = "[object global]";
+var PASSED = " PASSED!"
+var FAILED = " FAILED! expected: ";
+
+var DEBUG = false;
+
+version("120");
+/*
+ * change this for date tests if you're not in PST
+ */
+
+TZ_DIFF = -8;
+/* wrapper for test cas constructor that doesn't require the SECTION
+ * argument.
+ */
+
+function AddTestCase( description, expect, actual ) {
+ testcases[tc++] = new TestCase( SECTION, description, expect, actual );
+}
+function TestCase( n, d, e, a ) {
+ this.name = n;
+ this.description = d;
+ this.expect = e;
+ this.actual = a;
+ this.passed = true;
+ this.reason = "";
+ this.bugnumber = BUGNUMBER;
+
+ this.passed = getTestCaseResult( this.expect, this.actual );
+}
+function startTest() {
+ version(120);
+
+ // for ecma version 2.0, we will leave the javascript version to
+ // the default ( for now ).
+ // print out bugnumber
+
+ if ( BUGNUMBER ) {
+ writeLineToLog ("BUGNUMBER: " + BUGNUMBER );
+ }
+
+ testcases = new Array();
+ tc = 0;
+
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCaseResult( expect, actual ) {
+ // because ( NaN == NaN ) always returns false, need to do
+ // a special compare to see if we got the right result.
+ if ( actual != actual ) {
+ if ( typeof actual == "object" ) {
+ actual = "NaN object";
+ } else {
+ actual = "NaN number";
+ }
+ }
+ if ( expect != expect ) {
+ if ( typeof expect == "object" ) {
+ expect = "NaN object";
+ } else {
+ expect = "NaN number";
+ }
+ }
+
+ var passed = ( expect == actual ) ? true : false;
+
+ // if both objects are numbers, give a little leeway for rounding.
+ if ( !passed
+ && typeof(actual) == "number"
+ && typeof(expect) == "number"
+ ) {
+ if ( Math.abs(actual-expect) < 0.0000001 ) {
+ passed = true;
+ }
+ }
+
+ // verify type is the same
+ if ( typeof(expect) != typeof(actual) ) {
+ passed = false;
+ }
+
+ return passed;
+}
+/*
+ * Begin printing functions. These functions use the shell's
+ * print function. When running tests in the browser, these
+ * functions, override these functions with functions that use
+ * document.write.
+ */
+
+function writeTestCaseResult( expect, actual, string ) {
+ var passed = getTestCaseResult( expect, actual );
+ writeFormattedResult( expect, actual, string, passed );
+ return passed;
+}
+function writeFormattedResult( expect, actual, string, passed ) {
+ var s = string ;
+ s += ( passed ) ? PASSED : FAILED + expect;
+ writeLineToLog( s);
+ return passed;
+}
+function writeLineToLog( string ) {
+ print( string );
+}
+function writeHeaderToLog( string ) {
+ print( string );
+}
+/* end of print functions */
+
+
+function stopTest() {
+ var sizeTag = "<#TEST CASES SIZE>";
+ var doneTag = "<#TEST CASES DONE>";
+ var beginTag = "<#TEST CASE ";
+ var endTag = ">";
+
+ print(sizeTag);
+ print(testcases.length);
+ for (tc = 0; tc < testcases.length; tc++)
+ {
+ print(beginTag + 'PASSED' + endTag);
+ print(testcases[tc].passed);
+ print(beginTag + 'NAME' + endTag);
+ print(testcases[tc].name);
+ print(beginTag + 'EXPECTED' + endTag);
+ print(testcases[tc].expect);
+ print(beginTag + 'ACTUAL' + endTag);
+ print(testcases[tc].actual);
+ print(beginTag + 'DESCRIPTION' + endTag);
+ print(testcases[tc].description);
+ print(beginTag + 'REASON' + endTag);
+ print(( testcases[tc].passed ) ? "" : "wrong value ");
+ print(beginTag + 'BUGNUMBER' + endTag);
+ print( BUGNUMBER );
+ }
+ print(doneTag);
+ gc();
+}
+
+function getFailedCases() {
+ for ( var i = 0; i < testcases.length; i++ ) {
+ if ( ! testcases[i].passed ) {
+ print( testcases[i].description +" = " +testcases[i].actual +" expected: "+ testcases[i].expect );
+ }
+ }
+}
+function err( msg, page, line ) {
+ testcases[tc].actual = "error";
+ testcases[tc].reason = msg;
+ writeTestCaseResult( testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual +
+ ": " + testcases[tc].reason );
+ stopTest();
+ return true;
+}
+function Enumerate ( o ) {
+ var p;
+ for ( p in o ) {
+ print( p +": " + o[p] );
+ }
+}
+function GetContext() {
+ return Packages.com.netscape.javascript.Context.getCurrentContext();
+}
+function OptLevel( i ) {
+ i = Number(i);
+ var cx = GetContext();
+ cx.setOptimizationLevel(i);
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/operator/equality.js b/Source/JavaScriptCore/tests/mozilla/js1_2/operator/equality.js
new file mode 100644
index 0000000..855b5a8
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/operator/equality.js
@@ -0,0 +1,72 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: equality.js
+ Description: 'This tests the operator =='
+
+ Author: Nick Lerissa
+ Date: Fri Feb 13 09:58:28 PST 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'operator "=="';
+
+ writeHeaderToLog('Executing script: equality.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+
+ // the following two tests are incorrect
+ //testcases[count++] = new TestCase( SECTION, "(new String('') == new String('')) ",
+ // true, (new String('') == new String('')));
+
+ //testcases[count++] = new TestCase( SECTION, "(new Boolean(true) == new Boolean(true)) ",
+ // true, (new Boolean(true) == new Boolean(true)));
+
+ testcases[count++] = new TestCase( SECTION, "(new String('x') == 'x') ",
+ false, (new String('x') == 'x'));
+
+ testcases[count++] = new TestCase( SECTION, "('x' == new String('x')) ",
+ false, ('x' == new String('x')));
+
+
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
+
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/operator/strictEquality.js b/Source/JavaScriptCore/tests/mozilla/js1_2/operator/strictEquality.js
new file mode 100644
index 0000000..0f8acea
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/operator/strictEquality.js
@@ -0,0 +1,92 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: strictEquality.js
+ Description: 'This tests the operator ==='
+
+ Author: Nick Lerissa
+ Date: Fri Feb 13 09:58:28 PST 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'operator "==="';
+
+ writeHeaderToLog('Executing script: strictEquality.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+
+ testcases[count++] = new TestCase( SECTION, "('8' === 8) ",
+ false, ('8' === 8));
+
+ testcases[count++] = new TestCase( SECTION, "(8 === 8) ",
+ true, (8 === 8));
+
+ testcases[count++] = new TestCase( SECTION, "(8 === true) ",
+ false, (8 === true));
+
+ testcases[count++] = new TestCase( SECTION, "(new String('') === new String('')) ",
+ false, (new String('') === new String('')));
+
+ testcases[count++] = new TestCase( SECTION, "(new Boolean(true) === new Boolean(true))",
+ false, (new Boolean(true) === new Boolean(true)));
+
+ var anObject = { one:1 , two:2 };
+
+ testcases[count++] = new TestCase( SECTION, "(anObject === anObject) ",
+ true, (anObject === anObject));
+
+ testcases[count++] = new TestCase( SECTION, "(anObject === { one:1 , two:2 }) ",
+ false, (anObject === { one:1 , two:2 }));
+
+ testcases[count++] = new TestCase( SECTION, "({ one:1 , two:2 } === anObject) ",
+ false, ({ one:1 , two:2 } === anObject));
+
+ testcases[count++] = new TestCase( SECTION, "(null === null) ",
+ true, (null === null));
+
+ testcases[count++] = new TestCase( SECTION, "(null === 0) ",
+ false, (null === 0));
+
+ testcases[count++] = new TestCase( SECTION, "(true === !false) ",
+ true, (true === !false));
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
+
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_dollar_number.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_dollar_number.js
new file mode 100644
index 0000000..58f9264
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_dollar_number.js
@@ -0,0 +1,108 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: RegExp_dollar_number.js
+ Description: 'Tests RegExps $1, ..., $9 properties'
+
+ Author: Nick Lerissa
+ Date: March 12, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: $1, ..., $9';
+ var BUGNUMBER="123802";
+
+ writeHeaderToLog('Executing script: RegExp_dollar_number.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ // 'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$1
+ 'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/);
+ testcases[count++] = new TestCase ( SECTION, "'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$1",
+ 'abcdefghi', RegExp.$1);
+
+ // 'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$2
+ testcases[count++] = new TestCase ( SECTION, "'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$2",
+ 'bcdefgh', RegExp.$2);
+
+ // 'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$3
+ testcases[count++] = new TestCase ( SECTION, "'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$3",
+ 'cdefg', RegExp.$3);
+
+ // 'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$4
+ testcases[count++] = new TestCase ( SECTION, "'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$4",
+ 'def', RegExp.$4);
+
+ // 'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$5
+ testcases[count++] = new TestCase ( SECTION, "'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$5",
+ 'e', RegExp.$5);
+
+ // 'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$6
+ testcases[count++] = new TestCase ( SECTION, "'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$6",
+ '', RegExp.$6);
+
+ var a_to_z = 'abcdefghijklmnopqrstuvwxyz';
+ var regexp1 = /(a)b(c)d(e)f(g)h(i)j(k)l(m)n(o)p(q)r(s)t(u)v(w)x(y)z/
+ // 'abcdefghijklmnopqrstuvwxyz'.match(/(a)b(c)d(e)f(g)h(i)j(k)l(m)n(o)p(q)r(s)t(u)v(w)x(y)z/); RegExp.$1
+ a_to_z.match(regexp1);
+
+ testcases[count++] = new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$1",
+ 'a', RegExp.$1);
+ testcases[count++] = new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$2",
+ 'c', RegExp.$2);
+ testcases[count++] = new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$3",
+ 'e', RegExp.$3);
+ testcases[count++] = new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$4",
+ 'g', RegExp.$4);
+ testcases[count++] = new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$5",
+ 'i', RegExp.$5);
+ testcases[count++] = new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$6",
+ 'k', RegExp.$6);
+ testcases[count++] = new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$7",
+ 'm', RegExp.$7);
+ testcases[count++] = new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$8",
+ 'o', RegExp.$8);
+ testcases[count++] = new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$9",
+ 'q', RegExp.$9);
+/*
+ testcases[count++] = new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$10",
+ 's', RegExp.$10);
+*/
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_input.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_input.js
new file mode 100644
index 0000000..01c145c
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_input.js
@@ -0,0 +1,102 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: RegExp_input.js
+ Description: 'Tests RegExps input property'
+
+ Author: Nick Lerissa
+ Date: March 13, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: input';
+
+ writeHeaderToLog('Executing script: RegExp_input.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ RegExp.input = "abcd12357efg";
+
+ // RegExp.input = "abcd12357efg"; RegExp.input
+ RegExp.input = "abcd12357efg";
+ testcases[count++] = new TestCase ( SECTION, "RegExp.input = 'abcd12357efg'; RegExp.input",
+ "abcd12357efg", RegExp.input);
+
+ // RegExp.input = "abcd12357efg"; /\d+/.exec('2345')
+ RegExp.input = "abcd12357efg";
+ testcases[count++] = new TestCase ( SECTION, "RegExp.input = 'abcd12357efg'; /\\d+/.exec('2345')",
+ String(["2345"]), String(/\d+/.exec('2345')));
+
+ // RegExp.input = "abcd12357efg"; /\d+/.exec()
+ RegExp.input = "abcd12357efg";
+ testcases[count++] = new TestCase ( SECTION, "RegExp.input = 'abcd12357efg'; /\\d+/.exec()",
+ String(["12357"]), String(/\d+/.exec()));
+
+ // RegExp.input = "abcd12357efg"; /[h-z]+/.exec()
+ RegExp.input = "abcd12357efg";
+ testcases[count++] = new TestCase ( SECTION, "RegExp.input = 'abcd12357efg'; /[h-z]+/.exec()",
+ null, /[h-z]+/.exec());
+
+ // RegExp.input = "abcd12357efg"; /\d+/.test('2345')
+ RegExp.input = "abcd12357efg";
+ testcases[count++] = new TestCase ( SECTION, "RegExp.input = 'abcd12357efg'; /\\d+/.test('2345')",
+ true, /\d+/.test('2345'));
+
+ // RegExp.input = "abcd12357efg"; /\d+/.test()
+ RegExp.input = "abcd12357efg";
+ testcases[count++] = new TestCase ( SECTION, "RegExp.input = 'abcd12357efg'; /\\d+/.test()",
+ true, /\d+/.test());
+
+ // RegExp.input = "abcd12357efg"; (new RegExp('d+')).test()
+ RegExp.input = "abcd12357efg";
+ testcases[count++] = new TestCase ( SECTION, "RegExp.input = 'abcd12357efg'; (new RegExp('d+')).test()",
+ true, (new RegExp('d+')).test());
+
+ // RegExp.input = "abcd12357efg"; /[h-z]+/.test()
+ RegExp.input = "abcd12357efg";
+ testcases[count++] = new TestCase ( SECTION, "RegExp.input = 'abcd12357efg'; /[h-z]+/.test()",
+ false, /[h-z]+/.test());
+
+ // RegExp.input = "abcd12357efg"; (new RegExp('[h-z]+')).test()
+ RegExp.input = "abcd12357efg";
+ testcases[count++] = new TestCase ( SECTION, "RegExp.input = 'abcd12357efg'; (new RegExp('[h-z]+')).test()",
+ false, (new RegExp('[h-z]+')).test());
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_input_as_array.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_input_as_array.js
new file mode 100644
index 0000000..a1ed113
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_input_as_array.js
@@ -0,0 +1,102 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: RegExp_input_as_array.js
+ Description: 'Tests RegExps $_ property (same tests as RegExp_input.js but using $_)'
+
+ Author: Nick Lerissa
+ Date: March 13, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: input';
+
+ writeHeaderToLog('Executing script: RegExp_input.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ RegExp['$_'] = "abcd12357efg";
+
+ // RegExp['$_'] = "abcd12357efg"; RegExp['$_']
+ RegExp['$_'] = "abcd12357efg";
+ testcases[count++] = new TestCase ( SECTION, "RegExp['$_'] = 'abcd12357efg'; RegExp['$_']",
+ "abcd12357efg", RegExp['$_']);
+
+ // RegExp['$_'] = "abcd12357efg"; /\d+/.exec('2345')
+ RegExp['$_'] = "abcd12357efg";
+ testcases[count++] = new TestCase ( SECTION, "RegExp['$_'] = 'abcd12357efg'; /\\d+/.exec('2345')",
+ String(["2345"]), String(/\d+/.exec('2345')));
+
+ // RegExp['$_'] = "abcd12357efg"; /\d+/.exec()
+ RegExp['$_'] = "abcd12357efg";
+ testcases[count++] = new TestCase ( SECTION, "RegExp['$_'] = 'abcd12357efg'; /\\d+/.exec()",
+ String(["12357"]), String(/\d+/.exec()));
+
+ // RegExp['$_'] = "abcd12357efg"; /[h-z]+/.exec()
+ RegExp['$_'] = "abcd12357efg";
+ testcases[count++] = new TestCase ( SECTION, "RegExp['$_'] = 'abcd12357efg'; /[h-z]+/.exec()",
+ null, /[h-z]+/.exec());
+
+ // RegExp['$_'] = "abcd12357efg"; /\d+/.test('2345')
+ RegExp['$_'] = "abcd12357efg";
+ testcases[count++] = new TestCase ( SECTION, "RegExp['$_'] = 'abcd12357efg'; /\\d+/.test('2345')",
+ true, /\d+/.test('2345'));
+
+ // RegExp['$_'] = "abcd12357efg"; /\d+/.test()
+ RegExp['$_'] = "abcd12357efg";
+ testcases[count++] = new TestCase ( SECTION, "RegExp['$_'] = 'abcd12357efg'; /\\d+/.test()",
+ true, /\d+/.test());
+
+ // RegExp['$_'] = "abcd12357efg"; /[h-z]+/.test()
+ RegExp['$_'] = "abcd12357efg";
+ testcases[count++] = new TestCase ( SECTION, "RegExp['$_'] = 'abcd12357efg'; /[h-z]+/.test()",
+ false, /[h-z]+/.test());
+
+ // RegExp['$_'] = "abcd12357efg"; (new RegExp('\d+')).test()
+ RegExp['$_'] = "abcd12357efg";
+ testcases[count++] = new TestCase ( SECTION, "RegExp['$_'] = 'abcd12357efg'; (new RegExp('\d+')).test()",
+ true, (new RegExp('\d+')).test());
+
+ // RegExp['$_'] = "abcd12357efg"; (new RegExp('[h-z]+')).test()
+ RegExp['$_'] = "abcd12357efg";
+ testcases[count++] = new TestCase ( SECTION, "RegExp['$_'] = 'abcd12357efg'; (new RegExp('[h-z]+')).test()",
+ false, (new RegExp('[h-z]+')).test());
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_lastIndex.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_lastIndex.js
new file mode 100644
index 0000000..b48836f
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_lastIndex.js
@@ -0,0 +1,83 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: RegExp_lastIndex.js
+ Description: 'Tests RegExps lastIndex property'
+
+ Author: Nick Lerissa
+ Date: March 17, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: lastIndex';
+ var BUGNUMBER="123802";
+
+ writeHeaderToLog('Executing script: RegExp_lastIndex.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ // re=/x./g; re.lastIndex=4; re.exec('xyabcdxa');
+ re=/x./g;
+ re.lastIndex=4;
+ testcases[count++] = new TestCase ( SECTION, "re=/x./g; re.lastIndex=4; re.exec('xyabcdxa')",
+ '["xa"]', String(re.exec('xyabcdxa')));
+
+ // re.lastIndex
+ testcases[count++] = new TestCase ( SECTION, "re.lastIndex",
+ 8, re.lastIndex);
+
+ // re.exec('xyabcdef');
+ testcases[count++] = new TestCase ( SECTION, "re.exec('xyabcdef')",
+ null, re.exec('xyabcdef'));
+
+ // re.lastIndex
+ testcases[count++] = new TestCase ( SECTION, "re.lastIndex",
+ 0, re.lastIndex);
+
+ // re.exec('xyabcdef');
+ testcases[count++] = new TestCase ( SECTION, "re.exec('xyabcdef')",
+ '["xy"]', String(re.exec('xyabcdef')));
+
+ // re.lastIndex=30; re.exec('123xaxbxc456');
+ re.lastIndex=30;
+ testcases[count++] = new TestCase ( SECTION, "re.lastIndex=30; re.exec('123xaxbxc456')",
+ null, re.exec('123xaxbxc456'));
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_lastMatch.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_lastMatch.js
new file mode 100644
index 0000000..2b0c72d
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_lastMatch.js
@@ -0,0 +1,85 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: RegExp_lastMatch.js
+ Description: 'Tests RegExps lastMatch property'
+
+ Author: Nick Lerissa
+ Date: March 12, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: lastMatch';
+
+ writeHeaderToLog('Executing script: RegExp_lastMatch.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ // 'foo'.match(/foo/); RegExp.lastMatch
+ 'foo'.match(/foo/);
+ testcases[count++] = new TestCase ( SECTION, "'foo'.match(/foo/); RegExp.lastMatch",
+ 'foo', RegExp.lastMatch);
+
+ // 'foo'.match(new RegExp('foo')); RegExp.lastMatch
+ 'foo'.match(new RegExp('foo'));
+ testcases[count++] = new TestCase ( SECTION, "'foo'.match(new RegExp('foo')); RegExp.lastMatch",
+ 'foo', RegExp.lastMatch);
+
+ // 'xxx'.match(/bar/); RegExp.lastMatch
+ 'xxx'.match(/bar/);
+ testcases[count++] = new TestCase ( SECTION, "'xxx'.match(/bar/); RegExp.lastMatch",
+ 'foo', RegExp.lastMatch);
+
+ // 'xxx'.match(/$/); RegExp.lastMatch
+ 'xxx'.match(/$/);
+ testcases[count++] = new TestCase ( SECTION, "'xxx'.match(/$/); RegExp.lastMatch",
+ '', RegExp.lastMatch);
+
+ // 'abcdefg'.match(/^..(cd)[a-z]+/); RegExp.lastMatch
+ 'abcdefg'.match(/^..(cd)[a-z]+/);
+ testcases[count++] = new TestCase ( SECTION, "'abcdefg'.match(/^..(cd)[a-z]+/); RegExp.lastMatch",
+ 'abcdefg', RegExp.lastMatch);
+
+ // 'abcdefgabcdefg'.match(/(a(b(c(d)e)f)g)\1/); RegExp.lastMatch
+ 'abcdefgabcdefg'.match(/(a(b(c(d)e)f)g)\1/);
+ testcases[count++] = new TestCase ( SECTION, "'abcdefgabcdefg'.match(/(a(b(c(d)e)f)g)\\1/); RegExp.lastMatch",
+ 'abcdefgabcdefg', RegExp.lastMatch);
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_lastMatch_as_array.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_lastMatch_as_array.js
new file mode 100644
index 0000000..b59b2c2
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_lastMatch_as_array.js
@@ -0,0 +1,85 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: RegExp_lastMatch_as_array.js
+ Description: 'Tests RegExps $& property (same tests as RegExp_lastMatch.js but using $&)'
+
+ Author: Nick Lerissa
+ Date: March 13, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: $&';
+
+ writeHeaderToLog('Executing script: RegExp_lastMatch_as_array.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ // 'foo'.match(/foo/); RegExp['$&']
+ 'foo'.match(/foo/);
+ testcases[count++] = new TestCase ( SECTION, "'foo'.match(/foo/); RegExp['$&']",
+ 'foo', RegExp['$&']);
+
+ // 'foo'.match(new RegExp('foo')); RegExp['$&']
+ 'foo'.match(new RegExp('foo'));
+ testcases[count++] = new TestCase ( SECTION, "'foo'.match(new RegExp('foo')); RegExp['$&']",
+ 'foo', RegExp['$&']);
+
+ // 'xxx'.match(/bar/); RegExp['$&']
+ 'xxx'.match(/bar/);
+ testcases[count++] = new TestCase ( SECTION, "'xxx'.match(/bar/); RegExp['$&']",
+ 'foo', RegExp['$&']);
+
+ // 'xxx'.match(/$/); RegExp['$&']
+ 'xxx'.match(/$/);
+ testcases[count++] = new TestCase ( SECTION, "'xxx'.match(/$/); RegExp['$&']",
+ '', RegExp['$&']);
+
+ // 'abcdefg'.match(/^..(cd)[a-z]+/); RegExp['$&']
+ 'abcdefg'.match(/^..(cd)[a-z]+/);
+ testcases[count++] = new TestCase ( SECTION, "'abcdefg'.match(/^..(cd)[a-z]+/); RegExp['$&']",
+ 'abcdefg', RegExp['$&']);
+
+ // 'abcdefgabcdefg'.match(/(a(b(c(d)e)f)g)\1/); RegExp['$&']
+ 'abcdefgabcdefg'.match(/(a(b(c(d)e)f)g)\1/);
+ testcases[count++] = new TestCase ( SECTION, "'abcdefgabcdefg'.match(/(a(b(c(d)e)f)g)\\1/); RegExp['$&']",
+ 'abcdefgabcdefg', RegExp['$&']);
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_lastParen.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_lastParen.js
new file mode 100644
index 0000000..1dd0791
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_lastParen.js
@@ -0,0 +1,100 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: RegExp_lastParen.js
+ Description: 'Tests RegExps lastParen property'
+
+ Author: Nick Lerissa
+ Date: March 12, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: lastParen';
+
+ writeHeaderToLog('Executing script: RegExp_lastParen.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ // 'abcd'.match(/(abc)d/); RegExp.lastParen
+ 'abcd'.match(/(abc)d/);
+ testcases[count++] = new TestCase ( SECTION, "'abcd'.match(/(abc)d/); RegExp.lastParen",
+ 'abc', RegExp.lastParen);
+
+ // 'abcd'.match(new RegExp('(abc)d')); RegExp.lastParen
+ 'abcd'.match(new RegExp('(abc)d'));
+ testcases[count++] = new TestCase ( SECTION, "'abcd'.match(new RegExp('(abc)d')); RegExp.lastParen",
+ 'abc', RegExp.lastParen);
+
+ // 'abcd'.match(/(bcd)e/); RegExp.lastParen
+ 'abcd'.match(/(bcd)e/);
+ testcases[count++] = new TestCase ( SECTION, "'abcd'.match(/(bcd)e/); RegExp.lastParen",
+ 'abc', RegExp.lastParen);
+
+ // 'abcdefg'.match(/(a(b(c(d)e)f)g)/); RegExp.lastParen
+ 'abcdefg'.match(/(a(b(c(d)e)f)g)/);
+ testcases[count++] = new TestCase ( SECTION, "'abcdefg'.match(/(a(b(c(d)e)f)g)/); RegExp.lastParen",
+ 'd', RegExp.lastParen);
+
+ // 'abcdefg'.match(/(a(b)c)(d(e)f)/); RegExp.lastParen
+ 'abcdefg'.match(/(a(b)c)(d(e)f)/);
+ testcases[count++] = new TestCase ( SECTION, "'abcdefg'.match(/(a(b)c)(d(e)f)/); RegExp.lastParen",
+ 'e', RegExp.lastParen);
+
+ // 'abcdefg'.match(/(^)abc/); RegExp.lastParen
+ 'abcdefg'.match(/(^)abc/);
+ testcases[count++] = new TestCase ( SECTION, "'abcdefg'.match(/(^)abc/); RegExp.lastParen",
+ '', RegExp.lastParen);
+
+ // 'abcdefg'.match(/(^a)bc/); RegExp.lastParen
+ 'abcdefg'.match(/(^a)bc/);
+ testcases[count++] = new TestCase ( SECTION, "'abcdefg'.match(/(^a)bc/); RegExp.lastParen",
+ 'a', RegExp.lastParen);
+
+ // 'abcdefg'.match(new RegExp('(^a)bc')); RegExp.lastParen
+ 'abcdefg'.match(new RegExp('(^a)bc'));
+ testcases[count++] = new TestCase ( SECTION, "'abcdefg'.match(new RegExp('(^a)bc')); RegExp.lastParen",
+ 'a', RegExp.lastParen);
+
+ // 'abcdefg'.match(/bc/); RegExp.lastParen
+ 'abcdefg'.match(/bc/);
+ testcases[count++] = new TestCase ( SECTION, "'abcdefg'.match(/bc/); RegExp.lastParen",
+ '', RegExp.lastParen);
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_lastParen_as_array.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_lastParen_as_array.js
new file mode 100644
index 0000000..d8dcd52
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_lastParen_as_array.js
@@ -0,0 +1,100 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: RegExp_lastParen_as_array.js
+ Description: 'Tests RegExps $+ property (same tests as RegExp_lastParen.js but using $+)'
+
+ Author: Nick Lerissa
+ Date: March 13, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: $+';
+
+ writeHeaderToLog('Executing script: RegExp_lastParen_as_array.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ // 'abcd'.match(/(abc)d/); RegExp['$+']
+ 'abcd'.match(/(abc)d/);
+ testcases[count++] = new TestCase ( SECTION, "'abcd'.match(/(abc)d/); RegExp['$+']",
+ 'abc', RegExp['$+']);
+
+ // 'abcd'.match(/(bcd)e/); RegExp['$+']
+ 'abcd'.match(/(bcd)e/);
+ testcases[count++] = new TestCase ( SECTION, "'abcd'.match(/(bcd)e/); RegExp['$+']",
+ 'abc', RegExp['$+']);
+
+ // 'abcdefg'.match(/(a(b(c(d)e)f)g)/); RegExp['$+']
+ 'abcdefg'.match(/(a(b(c(d)e)f)g)/);
+ testcases[count++] = new TestCase ( SECTION, "'abcdefg'.match(/(a(b(c(d)e)f)g)/); RegExp['$+']",
+ 'd', RegExp['$+']);
+
+ // 'abcdefg'.match(new RegExp('(a(b(c(d)e)f)g)')); RegExp['$+']
+ 'abcdefg'.match(new RegExp('(a(b(c(d)e)f)g)'));
+ testcases[count++] = new TestCase ( SECTION, "'abcdefg'.match(new RegExp('(a(b(c(d)e)f)g)')); RegExp['$+']",
+ 'd', RegExp['$+']);
+
+ // 'abcdefg'.match(/(a(b)c)(d(e)f)/); RegExp['$+']
+ 'abcdefg'.match(/(a(b)c)(d(e)f)/);
+ testcases[count++] = new TestCase ( SECTION, "'abcdefg'.match(/(a(b)c)(d(e)f)/); RegExp['$+']",
+ 'e', RegExp['$+']);
+
+ // 'abcdefg'.match(/(^)abc/); RegExp['$+']
+ 'abcdefg'.match(/(^)abc/);
+ testcases[count++] = new TestCase ( SECTION, "'abcdefg'.match(/(^)abc/); RegExp['$+']",
+ '', RegExp['$+']);
+
+ // 'abcdefg'.match(/(^a)bc/); RegExp['$+']
+ 'abcdefg'.match(/(^a)bc/);
+ testcases[count++] = new TestCase ( SECTION, "'abcdefg'.match(/(^a)bc/); RegExp['$+']",
+ 'a', RegExp['$+']);
+
+ // 'abcdefg'.match(new RegExp('(^a)bc')); RegExp['$+']
+ 'abcdefg'.match(new RegExp('(^a)bc'));
+ testcases[count++] = new TestCase ( SECTION, "'abcdefg'.match(new RegExp('(^a)bc')); RegExp['$+']",
+ 'a', RegExp['$+']);
+
+ // 'abcdefg'.match(/bc/); RegExp['$+']
+ 'abcdefg'.match(/bc/);
+ testcases[count++] = new TestCase ( SECTION, "'abcdefg'.match(/bc/); RegExp['$+']",
+ '', RegExp['$+']);
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_leftContext.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_leftContext.js
new file mode 100644
index 0000000..025915a
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_leftContext.js
@@ -0,0 +1,90 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: RegExp_leftContext.js
+ Description: 'Tests RegExps leftContext property'
+
+ Author: Nick Lerissa
+ Date: March 12, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: leftContext';
+
+ writeHeaderToLog('Executing script: RegExp_leftContext.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ // 'abc123xyz'.match(/123/); RegExp.leftContext
+ 'abc123xyz'.match(/123/);
+ testcases[count++] = new TestCase ( SECTION, "'abc123xyz'.match(/123/); RegExp.leftContext",
+ 'abc', RegExp.leftContext);
+
+ // 'abc123xyz'.match(/456/); RegExp.leftContext
+ 'abc123xyz'.match(/456/);
+ testcases[count++] = new TestCase ( SECTION, "'abc123xyz'.match(/456/); RegExp.leftContext",
+ 'abc', RegExp.leftContext);
+
+ // 'abc123xyz'.match(/abc123xyz/); RegExp.leftContext
+ 'abc123xyz'.match(/abc123xyz/);
+ testcases[count++] = new TestCase ( SECTION, "'abc123xyz'.match(/abc123xyz/); RegExp.leftContext",
+ '', RegExp.leftContext);
+
+ // 'xxxx'.match(/$/); RegExp.leftContext
+ 'xxxx'.match(/$/);
+ testcases[count++] = new TestCase ( SECTION, "'xxxx'.match(/$/); RegExp.leftContext",
+ 'xxxx', RegExp.leftContext);
+
+ // 'test'.match(/^/); RegExp.leftContext
+ 'test'.match(/^/);
+ testcases[count++] = new TestCase ( SECTION, "'test'.match(/^/); RegExp.leftContext",
+ '', RegExp.leftContext);
+
+ // 'xxxx'.match(new RegExp('$')); RegExp.leftContext
+ 'xxxx'.match(new RegExp('$'));
+ testcases[count++] = new TestCase ( SECTION, "'xxxx'.match(new RegExp('$')); RegExp.leftContext",
+ 'xxxx', RegExp.leftContext);
+
+ // 'test'.match(new RegExp('^')); RegExp.leftContext
+ 'test'.match(new RegExp('^'));
+ testcases[count++] = new TestCase ( SECTION, "'test'.match(new RegExp('^')); RegExp.leftContext",
+ '', RegExp.leftContext);
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_leftContext_as_array.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_leftContext_as_array.js
new file mode 100644
index 0000000..5a86b4f
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_leftContext_as_array.js
@@ -0,0 +1,90 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: RegExp_leftContext_as_array.js
+ Description: 'Tests RegExps leftContext property (same tests as RegExp_leftContext.js but using $`)'
+
+ Author: Nick Lerissa
+ Date: March 12, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: $`';
+
+ writeHeaderToLog('Executing script: RegExp_leftContext_as_array.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ // 'abc123xyz'.match(/123/); RegExp['$`']
+ 'abc123xyz'.match(/123/);
+ testcases[count++] = new TestCase ( SECTION, "'abc123xyz'.match(/123/); RegExp['$`']",
+ 'abc', RegExp['$`']);
+
+ // 'abc123xyz'.match(/456/); RegExp['$`']
+ 'abc123xyz'.match(/456/);
+ testcases[count++] = new TestCase ( SECTION, "'abc123xyz'.match(/456/); RegExp['$`']",
+ 'abc', RegExp['$`']);
+
+ // 'abc123xyz'.match(/abc123xyz/); RegExp['$`']
+ 'abc123xyz'.match(/abc123xyz/);
+ testcases[count++] = new TestCase ( SECTION, "'abc123xyz'.match(/abc123xyz/); RegExp['$`']",
+ '', RegExp['$`']);
+
+ // 'xxxx'.match(/$/); RegExp['$`']
+ 'xxxx'.match(/$/);
+ testcases[count++] = new TestCase ( SECTION, "'xxxx'.match(/$/); RegExp['$`']",
+ 'xxxx', RegExp['$`']);
+
+ // 'test'.match(/^/); RegExp['$`']
+ 'test'.match(/^/);
+ testcases[count++] = new TestCase ( SECTION, "'test'.match(/^/); RegExp['$`']",
+ '', RegExp['$`']);
+
+ // 'xxxx'.match(new RegExp('$')); RegExp['$`']
+ 'xxxx'.match(new RegExp('$'));
+ testcases[count++] = new TestCase ( SECTION, "'xxxx'.match(new RegExp('$')); RegExp['$`']",
+ 'xxxx', RegExp['$`']);
+
+ // 'test'.match(new RegExp('^')); RegExp['$`']
+ 'test'.match(new RegExp('^'));
+ testcases[count++] = new TestCase ( SECTION, "'test'.match(new RegExp('^')); RegExp['$`']",
+ '', RegExp['$`']);
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_multiline.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_multiline.js
new file mode 100644
index 0000000..be22261
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_multiline.js
@@ -0,0 +1,129 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: RegExp_multiline.js
+ Description: 'Tests RegExps multiline property'
+
+ Author: Nick Lerissa
+ Date: March 12, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: multiline';
+
+ writeHeaderToLog('Executing script: RegExp_multiline.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ // First we do a series of tests with RegExp.multiline set to false (default value)
+ // Following this we do the same tests with RegExp.multiline set true(**).
+ // RegExp.multiline
+ testcases[count++] = new TestCase ( SECTION, "RegExp.multiline",
+ false, RegExp.multiline);
+
+ // (multiline == false) '123\n456'.match(/^4../)
+ testcases[count++] = new TestCase ( SECTION, "(multiline == false) '123\\n456'.match(/^4../)",
+ null, '123\n456'.match(/^4../));
+
+ // (multiline == false) 'a11\na22\na23\na24'.match(/^a../g)
+ testcases[count++] = new TestCase ( SECTION, "(multiline == false) 'a11\\na22\\na23\\na24'.match(/^a../g)",
+ String(['a11']), String('a11\na22\na23\na24'.match(/^a../g)));
+
+ // (multiline == false) 'a11\na22'.match(/^.+^./)
+ testcases[count++] = new TestCase ( SECTION, "(multiline == false) 'a11\na22'.match(/^.+^./)",
+ null, 'a11\na22'.match(/^.+^./));
+
+ // (multiline == false) '123\n456'.match(/.3$/)
+ testcases[count++] = new TestCase ( SECTION, "(multiline == false) '123\\n456'.match(/.3$/)",
+ null, '123\n456'.match(/.3$/));
+
+ // (multiline == false) 'a11\na22\na23\na24'.match(/a..$/g)
+ testcases[count++] = new TestCase ( SECTION, "(multiline == false) 'a11\\na22\\na23\\na24'.match(/a..$/g)",
+ String(['a24']), String('a11\na22\na23\na24'.match(/a..$/g)));
+
+ // (multiline == false) 'abc\ndef'.match(/c$...$/)
+ testcases[count++] = new TestCase ( SECTION, "(multiline == false) 'abc\ndef'.match(/c$...$/)",
+ null, 'abc\ndef'.match(/c$...$/));
+
+ // (multiline == false) 'a11\na22\na23\na24'.match(new RegExp('a..$','g'))
+ testcases[count++] = new TestCase ( SECTION, "(multiline == false) 'a11\\na22\\na23\\na24'.match(new RegExp('a..$','g'))",
+ String(['a24']), String('a11\na22\na23\na24'.match(new RegExp('a..$','g'))));
+
+ // (multiline == false) 'abc\ndef'.match(new RegExp('c$...$'))
+ testcases[count++] = new TestCase ( SECTION, "(multiline == false) 'abc\ndef'.match(new RegExp('c$...$'))",
+ null, 'abc\ndef'.match(new RegExp('c$...$')));
+
+ // **Now we do the tests with RegExp.multiline set to true
+ // RegExp.multiline = true; RegExp.multiline
+ RegExp.multiline = true;
+ testcases[count++] = new TestCase ( SECTION, "RegExp.multiline = true; RegExp.multiline",
+ true, RegExp.multiline);
+
+ // (multiline == true) '123\n456'.match(/^4../)
+ testcases[count++] = new TestCase ( SECTION, "(multiline == true) '123\\n456'.match(/^4../)",
+ String(['456']), String('123\n456'.match(/^4../)));
+
+ // (multiline == true) 'a11\na22\na23\na24'.match(/^a../g)
+ testcases[count++] = new TestCase ( SECTION, "(multiline == true) 'a11\\na22\\na23\\na24'.match(/^a../g)",
+ String(['a11','a22','a23','a24']), String('a11\na22\na23\na24'.match(/^a../g)));
+
+ // (multiline == true) 'a11\na22'.match(/^.+^./)
+ //testcases[count++] = new TestCase ( SECTION, "(multiline == true) 'a11\na22'.match(/^.+^./)",
+ // String(['a11\na']), String('a11\na22'.match(/^.+^./)));
+
+ // (multiline == true) '123\n456'.match(/.3$/)
+ testcases[count++] = new TestCase ( SECTION, "(multiline == true) '123\\n456'.match(/.3$/)",
+ String(['23']), String('123\n456'.match(/.3$/)));
+
+ // (multiline == true) 'a11\na22\na23\na24'.match(/a..$/g)
+ testcases[count++] = new TestCase ( SECTION, "(multiline == true) 'a11\\na22\\na23\\na24'.match(/a..$/g)",
+ String(['a11','a22','a23','a24']), String('a11\na22\na23\na24'.match(/a..$/g)));
+
+ // (multiline == true) 'a11\na22\na23\na24'.match(new RegExp('a..$','g'))
+ testcases[count++] = new TestCase ( SECTION, "(multiline == true) 'a11\\na22\\na23\\na24'.match(new RegExp('a..$','g'))",
+ String(['a11','a22','a23','a24']), String('a11\na22\na23\na24'.match(new RegExp('a..$','g'))));
+
+ // (multiline == true) 'abc\ndef'.match(/c$....$/)
+ //testcases[count++] = new TestCase ( SECTION, "(multiline == true) 'abc\ndef'.match(/c$.+$/)",
+ // 'c\ndef', String('abc\ndef'.match(/c$.+$/)));
+
+ RegExp.multiline = false;
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_multiline_as_array.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_multiline_as_array.js
new file mode 100644
index 0000000..690653f
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_multiline_as_array.js
@@ -0,0 +1,129 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: RegExp_multiline_as_array.js
+ Description: 'Tests RegExps $* property (same tests as RegExp_multiline.js but using $*)'
+
+ Author: Nick Lerissa
+ Date: March 13, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: $*';
+
+ writeHeaderToLog('Executing script: RegExp_multiline_as_array.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ // First we do a series of tests with RegExp['$*'] set to false (default value)
+ // Following this we do the same tests with RegExp['$*'] set true(**).
+ // RegExp['$*']
+ testcases[count++] = new TestCase ( SECTION, "RegExp['$*']",
+ false, RegExp['$*']);
+
+ // (['$*'] == false) '123\n456'.match(/^4../)
+ testcases[count++] = new TestCase ( SECTION, "(['$*'] == false) '123\\n456'.match(/^4../)",
+ null, '123\n456'.match(/^4../));
+
+ // (['$*'] == false) 'a11\na22\na23\na24'.match(/^a../g)
+ testcases[count++] = new TestCase ( SECTION, "(['$*'] == false) 'a11\\na22\\na23\\na24'.match(/^a../g)",
+ String(['a11']), String('a11\na22\na23\na24'.match(/^a../g)));
+
+ // (['$*'] == false) 'a11\na22'.match(/^.+^./)
+ testcases[count++] = new TestCase ( SECTION, "(['$*'] == false) 'a11\na22'.match(/^.+^./)",
+ null, 'a11\na22'.match(/^.+^./));
+
+ // (['$*'] == false) '123\n456'.match(/.3$/)
+ testcases[count++] = new TestCase ( SECTION, "(['$*'] == false) '123\\n456'.match(/.3$/)",
+ null, '123\n456'.match(/.3$/));
+
+ // (['$*'] == false) 'a11\na22\na23\na24'.match(/a..$/g)
+ testcases[count++] = new TestCase ( SECTION, "(['$*'] == false) 'a11\\na22\\na23\\na24'.match(/a..$/g)",
+ String(['a24']), String('a11\na22\na23\na24'.match(/a..$/g)));
+
+ // (['$*'] == false) 'abc\ndef'.match(/c$...$/)
+ testcases[count++] = new TestCase ( SECTION, "(['$*'] == false) 'abc\ndef'.match(/c$...$/)",
+ null, 'abc\ndef'.match(/c$...$/));
+
+ // (['$*'] == false) 'a11\na22\na23\na24'.match(new RegExp('a..$','g'))
+ testcases[count++] = new TestCase ( SECTION, "(['$*'] == false) 'a11\\na22\\na23\\na24'.match(new RegExp('a..$','g'))",
+ String(['a24']), String('a11\na22\na23\na24'.match(new RegExp('a..$','g'))));
+
+ // (['$*'] == false) 'abc\ndef'.match(new RegExp('c$...$'))
+ testcases[count++] = new TestCase ( SECTION, "(['$*'] == false) 'abc\ndef'.match(new RegExp('c$...$'))",
+ null, 'abc\ndef'.match(new RegExp('c$...$')));
+
+ // **Now we do the tests with RegExp['$*'] set to true
+ // RegExp['$*'] = true; RegExp['$*']
+ RegExp['$*'] = true;
+ testcases[count++] = new TestCase ( SECTION, "RegExp['$*'] = true; RegExp['$*']",
+ true, RegExp['$*']);
+
+ // (['$*'] == true) '123\n456'.match(/^4../)
+ testcases[count++] = new TestCase ( SECTION, "(['$*'] == true) '123\\n456'.match(/^4../)",
+ String(['456']), String('123\n456'.match(/^4../)));
+
+ // (['$*'] == true) 'a11\na22\na23\na24'.match(/^a../g)
+ testcases[count++] = new TestCase ( SECTION, "(['$*'] == true) 'a11\\na22\\na23\\na24'.match(/^a../g)",
+ String(['a11','a22','a23','a24']), String('a11\na22\na23\na24'.match(/^a../g)));
+
+ // (['$*'] == true) 'a11\na22'.match(/^.+^./)
+ //testcases[count++] = new TestCase ( SECTION, "(['$*'] == true) 'a11\na22'.match(/^.+^./)",
+ // String(['a11\na']), String('a11\na22'.match(/^.+^./)));
+
+ // (['$*'] == true) '123\n456'.match(/.3$/)
+ testcases[count++] = new TestCase ( SECTION, "(['$*'] == true) '123\\n456'.match(/.3$/)",
+ String(['23']), String('123\n456'.match(/.3$/)));
+
+ // (['$*'] == true) 'a11\na22\na23\na24'.match(/a..$/g)
+ testcases[count++] = new TestCase ( SECTION, "(['$*'] == true) 'a11\\na22\\na23\\na24'.match(/a..$/g)",
+ String(['a11','a22','a23','a24']), String('a11\na22\na23\na24'.match(/a..$/g)));
+
+ // (['$*'] == true) 'a11\na22\na23\na24'.match(new RegExp('a..$','g'))
+ testcases[count++] = new TestCase ( SECTION, "(['$*'] == true) 'a11\\na22\\na23\\na24'.match(new RegExp('a..$','g'))",
+ String(['a11','a22','a23','a24']), String('a11\na22\na23\na24'.match(new RegExp('a..$','g'))));
+
+ // (['$*'] == true) 'abc\ndef'.match(/c$....$/)
+ //testcases[count++] = new TestCase ( SECTION, "(['$*'] == true) 'abc\ndef'.match(/c$.+$/)",
+ // 'c\ndef', String('abc\ndef'.match(/c$.+$/)));
+
+ RegExp['$*'] = false;
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_object.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_object.js
new file mode 100644
index 0000000..6bf2353
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_object.js
@@ -0,0 +1,88 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: RegExp_object.js
+ Description: 'Tests regular expressions creating RexExp Objects'
+
+ Author: Nick Lerissa
+ Date: March 10, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: object';
+
+ writeHeaderToLog('Executing script: RegExp_object.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ var SSN_pattern = new RegExp("\\d{3}-\\d{2}-\\d{4}");
+
+ // testing SSN pattern
+ testcases[count++] = new TestCase ( SECTION, "'Test SSN is 123-34-4567'.match(SSN_pattern))",
+ String(["123-34-4567"]), String('Test SSN is 123-34-4567'.match(SSN_pattern)));
+
+ // testing SSN pattern
+ testcases[count++] = new TestCase ( SECTION, "'Test SSN is 123-34-4567'.match(SSN_pattern))",
+ String(["123-34-4567"]), String('Test SSN is 123-34-4567'.match(SSN_pattern)));
+
+ var PHONE_pattern = new RegExp("\\(?(\\d{3})\\)?-?(\\d{3})-(\\d{4})");
+ // testing PHONE pattern
+ testcases[count++] = new TestCase ( SECTION, "'Our phone number is (408)345-2345.'.match(PHONE_pattern))",
+ String(["(408)345-2345","408","345","2345"]), String('Our phone number is (408)345-2345.'.match(PHONE_pattern)));
+
+ // testing PHONE pattern
+ testcases[count++] = new TestCase ( SECTION, "'The phone number is 408-345-2345!'.match(PHONE_pattern))",
+ String(["408-345-2345","408","345","2345"]), String('The phone number is 408-345-2345!'.match(PHONE_pattern)));
+
+ // testing PHONE pattern
+ testcases[count++] = new TestCase ( SECTION, "String(PHONE_pattern.toString())",
+ "/\\(?(\\d{3})\\)?-?(\\d{3})-(\\d{4})/", String(PHONE_pattern.toString()));
+
+ // testing conversion to String
+ testcases[count++] = new TestCase ( SECTION, "PHONE_pattern + ' is the string'",
+ "/\\(?(\\d{3})\\)?-?(\\d{3})-(\\d{4})/ is the string",PHONE_pattern + ' is the string');
+
+ // testing conversion to int
+ testcases[count++] = new TestCase ( SECTION, "SSN_pattern - 8",
+ NaN,SSN_pattern - 8);
+
+ var testPattern = new RegExp("(\\d+)45(\\d+)90");
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_rightContext.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_rightContext.js
new file mode 100644
index 0000000..ede5e21
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_rightContext.js
@@ -0,0 +1,90 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: RegExp_rightContext.js
+ Description: 'Tests RegExps rightContext property'
+
+ Author: Nick Lerissa
+ Date: March 12, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: rightContext';
+
+ writeHeaderToLog('Executing script: RegExp_rightContext.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ // 'abc123xyz'.match(/123/); RegExp.rightContext
+ 'abc123xyz'.match(/123/);
+ testcases[count++] = new TestCase ( SECTION, "'abc123xyz'.match(/123/); RegExp.rightContext",
+ 'xyz', RegExp.rightContext);
+
+ // 'abc123xyz'.match(/456/); RegExp.rightContext
+ 'abc123xyz'.match(/456/);
+ testcases[count++] = new TestCase ( SECTION, "'abc123xyz'.match(/456/); RegExp.rightContext",
+ 'xyz', RegExp.rightContext);
+
+ // 'abc123xyz'.match(/abc123xyz/); RegExp.rightContext
+ 'abc123xyz'.match(/abc123xyz/);
+ testcases[count++] = new TestCase ( SECTION, "'abc123xyz'.match(/abc123xyz/); RegExp.rightContext",
+ '', RegExp.rightContext);
+
+ // 'xxxx'.match(/$/); RegExp.rightContext
+ 'xxxx'.match(/$/);
+ testcases[count++] = new TestCase ( SECTION, "'xxxx'.match(/$/); RegExp.rightContext",
+ '', RegExp.rightContext);
+
+ // 'test'.match(/^/); RegExp.rightContext
+ 'test'.match(/^/);
+ testcases[count++] = new TestCase ( SECTION, "'test'.match(/^/); RegExp.rightContext",
+ 'test', RegExp.rightContext);
+
+ // 'xxxx'.match(new RegExp('$')); RegExp.rightContext
+ 'xxxx'.match(new RegExp('$'));
+ testcases[count++] = new TestCase ( SECTION, "'xxxx'.match(new RegExp('$')); RegExp.rightContext",
+ '', RegExp.rightContext);
+
+ // 'test'.match(new RegExp('^')); RegExp.rightContext
+ 'test'.match(new RegExp('^'));
+ testcases[count++] = new TestCase ( SECTION, "'test'.match(new RegExp('^')); RegExp.rightContext",
+ 'test', RegExp.rightContext);
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_rightContext_as_array.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_rightContext_as_array.js
new file mode 100644
index 0000000..e182774
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/RegExp_rightContext_as_array.js
@@ -0,0 +1,90 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: RegExp_rightContext_as_array.js
+ Description: 'Tests RegExps $\' property (same tests as RegExp_rightContext.js but using $\)'
+
+ Author: Nick Lerissa
+ Date: March 12, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: $\'';
+
+ writeHeaderToLog('Executing script: RegExp_rightContext.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ // 'abc123xyz'.match(/123/); RegExp['$\'']
+ 'abc123xyz'.match(/123/);
+ testcases[count++] = new TestCase ( SECTION, "'abc123xyz'.match(/123/); RegExp['$\'']",
+ 'xyz', RegExp['$\'']);
+
+ // 'abc123xyz'.match(/456/); RegExp['$\'']
+ 'abc123xyz'.match(/456/);
+ testcases[count++] = new TestCase ( SECTION, "'abc123xyz'.match(/456/); RegExp['$\'']",
+ 'xyz', RegExp['$\'']);
+
+ // 'abc123xyz'.match(/abc123xyz/); RegExp['$\'']
+ 'abc123xyz'.match(/abc123xyz/);
+ testcases[count++] = new TestCase ( SECTION, "'abc123xyz'.match(/abc123xyz/); RegExp['$\'']",
+ '', RegExp['$\'']);
+
+ // 'xxxx'.match(/$/); RegExp['$\'']
+ 'xxxx'.match(/$/);
+ testcases[count++] = new TestCase ( SECTION, "'xxxx'.match(/$/); RegExp['$\'']",
+ '', RegExp['$\'']);
+
+ // 'test'.match(/^/); RegExp['$\'']
+ 'test'.match(/^/);
+ testcases[count++] = new TestCase ( SECTION, "'test'.match(/^/); RegExp['$\'']",
+ 'test', RegExp['$\'']);
+
+ // 'xxxx'.match(new RegExp('$')); RegExp['$\'']
+ 'xxxx'.match(new RegExp('$'));
+ testcases[count++] = new TestCase ( SECTION, "'xxxx'.match(new RegExp('$')); RegExp['$\'']",
+ '', RegExp['$\'']);
+
+ // 'test'.match(new RegExp('^')); RegExp['$\'']
+ 'test'.match(new RegExp('^'));
+ testcases[count++] = new TestCase ( SECTION, "'test'.match(new RegExp('^')); RegExp['$\'']",
+ 'test', RegExp['$\'']);
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/alphanumeric.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/alphanumeric.js
new file mode 100644
index 0000000..36f5280
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/alphanumeric.js
@@ -0,0 +1,129 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: alphanumeric.js
+ Description: 'Tests regular expressions with \w and \W special characters'
+
+ Author: Nick Lerissa
+ Date: March 10, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: \\w and \\W';
+
+ writeHeaderToLog('Executing script: alphanumeric.js');
+ writeHeaderToLog( SECTION + " " + TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ var non_alphanumeric = "~`!@#$%^&*()-+={[}]|\\:;'<,>./?\f\n\r\t\v " + '"';
+ var alphanumeric = "_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
+
+ // be sure all alphanumerics are matched by \w
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + alphanumeric + "'.match(new RegExp('\\w+'))",
+ String([alphanumeric]), String(alphanumeric.match(new RegExp('\\w+'))));
+
+ // be sure all non-alphanumerics are matched by \W
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + non_alphanumeric + "'.match(new RegExp('\\W+'))",
+ String([non_alphanumeric]), String(non_alphanumeric.match(new RegExp('\\W+'))));
+
+ // be sure all non-alphanumerics are not matched by \w
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + non_alphanumeric + "'.match(new RegExp('\\w'))",
+ null, non_alphanumeric.match(new RegExp('\\w')));
+
+ // be sure all alphanumerics are not matched by \W
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + alphanumeric + "'.match(new RegExp('\\W'))",
+ null, alphanumeric.match(new RegExp('\\W')));
+
+ var s = non_alphanumeric + alphanumeric;
+
+ // be sure all alphanumerics are matched by \w
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + s + "'.match(new RegExp('\\w+'))",
+ String([alphanumeric]), String(s.match(new RegExp('\\w+'))));
+
+ s = alphanumeric + non_alphanumeric;
+
+ // be sure all non-alphanumerics are matched by \W
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + s + "'.match(new RegExp('\\W+'))",
+ String([non_alphanumeric]), String(s.match(new RegExp('\\W+'))));
+
+ // be sure all alphanumerics are matched by \w (using literals)
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + s + "'.match(/\w+/)",
+ String([alphanumeric]), String(s.match(/\w+/)));
+
+ s = alphanumeric + non_alphanumeric;
+
+ // be sure all non-alphanumerics are matched by \W (using literals)
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + s + "'.match(/\W+/)",
+ String([non_alphanumeric]), String(s.match(/\W+/)));
+
+ s = 'abcd*&^%$$';
+ // be sure the following test behaves consistently
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + s + "'.match(/(\w+)...(\W+)/)",
+ String([s , 'abcd' , '%$$']), String(s.match(/(\w+)...(\W+)/)));
+
+ var i;
+
+ // be sure all alphanumeric characters match individually
+ for (i = 0; i < alphanumeric.length; ++i)
+ {
+ s = '#$' + alphanumeric[i] + '%^';
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + s + "'.match(new RegExp('\\w'))",
+ String([alphanumeric[i]]), String(s.match(new RegExp('\\w'))));
+ }
+ // be sure all non_alphanumeric characters match individually
+ for (i = 0; i < non_alphanumeric.length; ++i)
+ {
+ s = 'sd' + non_alphanumeric[i] + String((i+10) * (i+10) - 2 * (i+10));
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + s + "'.match(new RegExp('\\W'))",
+ String([non_alphanumeric[i]]), String(s.match(new RegExp('\\W'))));
+ }
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/asterisk.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/asterisk.js
new file mode 100644
index 0000000..dfa8343
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/asterisk.js
@@ -0,0 +1,105 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: asterisk.js
+ Description: 'Tests regular expressions containing *'
+
+ Author: Nick Lerissa
+ Date: March 10, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: *';
+
+ writeHeaderToLog('Executing script: aterisk.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ // 'abcddddefg'.match(new RegExp('d*'))
+ testcases[count++] = new TestCase ( SECTION, "'abcddddefg'.match(new RegExp('d*'))",
+ String([""]), String('abcddddefg'.match(new RegExp('d*'))));
+
+ // 'abcddddefg'.match(new RegExp('cd*'))
+ testcases[count++] = new TestCase ( SECTION, "'abcddddefg'.match(new RegExp('cd*'))",
+ String(["cdddd"]), String('abcddddefg'.match(new RegExp('cd*'))));
+
+ // 'abcdefg'.match(new RegExp('cx*d'))
+ testcases[count++] = new TestCase ( SECTION, "'abcdefg'.match(new RegExp('cx*d'))",
+ String(["cd"]), String('abcdefg'.match(new RegExp('cx*d'))));
+
+ // 'xxxxxxx'.match(new RegExp('(x*)(x+)'))
+ testcases[count++] = new TestCase ( SECTION, "'xxxxxxx'.match(new RegExp('(x*)(x+)'))",
+ String(["xxxxxxx","xxxxxx","x"]), String('xxxxxxx'.match(new RegExp('(x*)(x+)'))));
+
+ // '1234567890'.match(new RegExp('(\\d*)(\\d+)'))
+ testcases[count++] = new TestCase ( SECTION, "'1234567890'.match(new RegExp('(\\d*)(\\d+)'))",
+ String(["1234567890","123456789","0"]),
+ String('1234567890'.match(new RegExp('(\\d*)(\\d+)'))));
+
+ // '1234567890'.match(new RegExp('(\\d*)\\d(\\d+)'))
+ testcases[count++] = new TestCase ( SECTION, "'1234567890'.match(new RegExp('(\\d*)\\d(\\d+)'))",
+ String(["1234567890","12345678","0"]),
+ String('1234567890'.match(new RegExp('(\\d*)\\d(\\d+)'))));
+
+ // 'xxxxxxx'.match(new RegExp('(x+)(x*)'))
+ testcases[count++] = new TestCase ( SECTION, "'xxxxxxx'.match(new RegExp('(x+)(x*)'))",
+ String(["xxxxxxx","xxxxxxx",""]), String('xxxxxxx'.match(new RegExp('(x+)(x*)'))));
+
+ // 'xxxxxxyyyyyy'.match(new RegExp('x*y+$'))
+ testcases[count++] = new TestCase ( SECTION, "'xxxxxxyyyyyy'.match(new RegExp('x*y+$'))",
+ String(["xxxxxxyyyyyy"]), String('xxxxxxyyyyyy'.match(new RegExp('x*y+$'))));
+
+ // 'abcdef'.match(/[\d]*[\s]*bc./)
+ testcases[count++] = new TestCase ( SECTION, "'abcdef'.match(/[\\d]*[\\s]*bc./)",
+ String(["bcd"]), String('abcdef'.match(/[\d]*[\s]*bc./)));
+
+ // 'abcdef'.match(/bc..[\d]*[\s]*/)
+ testcases[count++] = new TestCase ( SECTION, "'abcdef'.match(/bc..[\\d]*[\\s]*/)",
+ String(["bcde"]), String('abcdef'.match(/bc..[\d]*[\s]*/)));
+
+ // 'a1b2c3'.match(/.*/)
+ testcases[count++] = new TestCase ( SECTION, "'a1b2c3'.match(/.*/)",
+ String(["a1b2c3"]), String('a1b2c3'.match(/.*/)));
+
+ // 'a0.b2.c3'.match(/[xyz]*1/)
+ testcases[count++] = new TestCase ( SECTION, "'a0.b2.c3'.match(/[xyz]*1/)",
+ null, 'a0.b2.c3'.match(/[xyz]*1/));
+
+function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/backslash.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/backslash.js
new file mode 100644
index 0000000..61c5d61
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/backslash.js
@@ -0,0 +1,79 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: backslash.js
+ Description: 'Tests regular expressions containing \'
+
+ Author: Nick Lerissa
+ Date: March 10, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: \\';
+
+ writeHeaderToLog('Executing script: backslash.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ // 'abcde'.match(new RegExp('\e'))
+ testcases[count++] = new TestCase ( SECTION, "'abcde'.match(new RegExp('\e'))",
+ String(["e"]), String('abcde'.match(new RegExp('\e'))));
+
+ // 'ab\\cde'.match(new RegExp('\\\\'))
+ testcases[count++] = new TestCase ( SECTION, "'ab\\cde'.match(new RegExp('\\\\'))",
+ String(["\\"]), String('ab\\cde'.match(new RegExp('\\\\'))));
+
+ // 'ab\\cde'.match(/\\/) (using literal)
+ testcases[count++] = new TestCase ( SECTION, "'ab\\cde'.match(/\\\\/)",
+ String(["\\"]), String('ab\\cde'.match(/\\/)));
+
+ // 'before ^$*+?.()|{}[] after'.match(new RegExp('\^\$\*\+\?\.\(\)\|\{\}\[\]'))
+ testcases[count++] = new TestCase ( SECTION,
+ "'before ^$*+?.()|{}[] after'.match(new RegExp('\\^\\$\\*\\+\\?\\.\\(\\)\\|\\{\\}\\[\\]'))",
+ String(["^$*+?.()|{}[]"]),
+ String('before ^$*+?.()|{}[] after'.match(new RegExp('\\^\\$\\*\\+\\?\\.\\(\\)\\|\\{\\}\\[\\]'))));
+
+ // 'before ^$*+?.()|{}[] after'.match(/\^\$\*\+\?\.\(\)\|\{\}\[\]/) (using literal)
+ testcases[count++] = new TestCase ( SECTION,
+ "'before ^$*+?.()|{}[] after'.match(/\\^\\$\\*\\+\\?\\.\\(\\)\\|\\{\\}\\[\\]/)",
+ String(["^$*+?.()|{}[]"]),
+ String('before ^$*+?.()|{}[] after'.match(/\^\$\*\+\?\.\(\)\|\{\}\[\]/)));
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/backspace.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/backspace.js
new file mode 100644
index 0000000..bd3c064
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/backspace.js
@@ -0,0 +1,79 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: backspace.js
+ Description: 'Tests regular expressions containing [\b]'
+
+ Author: Nick Lerissa
+ Date: March 10, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: [\b]';
+
+ writeHeaderToLog('Executing script: backspace.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ // 'abc\bdef'.match(new RegExp('.[\b].'))
+ testcases[count++] = new TestCase ( SECTION, "'abc\bdef'.match(new RegExp('.[\\b].'))",
+ String(["c\bd"]), String('abc\bdef'.match(new RegExp('.[\\b].'))));
+
+ // 'abc\\bdef'.match(new RegExp('.[\b].'))
+ testcases[count++] = new TestCase ( SECTION, "'abc\\bdef'.match(new RegExp('.[\\b].'))",
+ null, 'abc\\bdef'.match(new RegExp('.[\\b].')));
+
+ // 'abc\b\b\bdef'.match(new RegExp('c[\b]{3}d'))
+ testcases[count++] = new TestCase ( SECTION, "'abc\b\b\bdef'.match(new RegExp('c[\\b]{3}d'))",
+ String(["c\b\b\bd"]), String('abc\b\b\bdef'.match(new RegExp('c[\\b]{3}d'))));
+
+ // 'abc\bdef'.match(new RegExp('[^\\[\b\\]]+'))
+ testcases[count++] = new TestCase ( SECTION, "'abc\bdef'.match(new RegExp('[^\\[\\b\\]]+'))",
+ String(["abc"]), String('abc\bdef'.match(new RegExp('[^\\[\\b\\]]+'))));
+
+ // 'abcdef'.match(new RegExp('[^\\[\b\\]]+'))
+ testcases[count++] = new TestCase ( SECTION, "'abcdef'.match(new RegExp('[^\\[\\b\\]]+'))",
+ String(["abcdef"]), String('abcdef'.match(new RegExp('[^\\[\\b\\]]+'))));
+
+ // 'abcdef'.match(/[^\[\b\]]+/)
+ testcases[count++] = new TestCase ( SECTION, "'abcdef'.match(/[^\\[\\b\\]]+/)",
+ String(["abcdef"]), String('abcdef'.match(/[^\[\b\]]+/)));
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/beginLine.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/beginLine.js
new file mode 100644
index 0000000..c5ccbdc
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/beginLine.js
@@ -0,0 +1,80 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: beginLine.js
+ Description: 'Tests regular expressions containing ^'
+
+ Author: Nick Lerissa
+ Date: March 10, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: ^';
+
+ writeHeaderToLog('Executing script: beginLine.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ // 'abcde'.match(new RegExp('^ab'))
+ testcases[count++] = new TestCase ( SECTION, "'abcde'.match(new RegExp('^ab'))",
+ String(["ab"]), String('abcde'.match(new RegExp('^ab'))));
+
+ // 'ab\ncde'.match(new RegExp('^..^e'))
+ testcases[count++] = new TestCase ( SECTION, "'ab\ncde'.match(new RegExp('^..^e'))",
+ null, 'ab\ncde'.match(new RegExp('^..^e')));
+
+ // 'yyyyy'.match(new RegExp('^xxx'))
+ testcases[count++] = new TestCase ( SECTION, "'yyyyy'.match(new RegExp('^xxx'))",
+ null, 'yyyyy'.match(new RegExp('^xxx')));
+
+ // '^^^x'.match(new RegExp('^\\^+'))
+ testcases[count++] = new TestCase ( SECTION, "'^^^x'.match(new RegExp('^\\^+'))",
+ String(['^^^']), String('^^^x'.match(new RegExp('^\\^+'))));
+
+ // '^^^x'.match(/^\^+/)
+ testcases[count++] = new TestCase ( SECTION, "'^^^x'.match(/^\\^+/)",
+ String(['^^^']), String('^^^x'.match(/^\^+/)));
+
+ RegExp.multiline = true;
+ // 'abc\n123xyz'.match(new RegExp('^\d+')) <multiline==true>
+ testcases[count++] = new TestCase ( SECTION, "'abc\n123xyz'.match(new RegExp('^\\d+'))",
+ String(['123']), String('abc\n123xyz'.match(new RegExp('^\\d+'))));
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/character_class.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/character_class.js
new file mode 100644
index 0000000..da0b59e
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/character_class.js
@@ -0,0 +1,107 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: character_class.js
+ Description: 'Tests regular expressions containing []'
+
+ Author: Nick Lerissa
+ Date: March 10, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: []';
+
+ writeHeaderToLog('Executing script: character_class.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ // 'abcde'.match(new RegExp('ab[ercst]de'))
+ testcases[count++] = new TestCase ( SECTION, "'abcde'.match(new RegExp('ab[ercst]de'))",
+ String(["abcde"]), String('abcde'.match(new RegExp('ab[ercst]de'))));
+
+ // 'abcde'.match(new RegExp('ab[erst]de'))
+ testcases[count++] = new TestCase ( SECTION, "'abcde'.match(new RegExp('ab[erst]de'))",
+ null, 'abcde'.match(new RegExp('ab[erst]de')));
+
+ // 'abcdefghijkl'.match(new RegExp('[d-h]+'))
+ testcases[count++] = new TestCase ( SECTION, "'abcdefghijkl'.match(new RegExp('[d-h]+'))",
+ String(["defgh"]), String('abcdefghijkl'.match(new RegExp('[d-h]+'))));
+
+ // 'abc6defghijkl'.match(new RegExp('[1234567].{2}'))
+ testcases[count++] = new TestCase ( SECTION, "'abc6defghijkl'.match(new RegExp('[1234567].{2}'))",
+ String(["6de"]), String('abc6defghijkl'.match(new RegExp('[1234567].{2}'))));
+
+ // '\n\n\abc324234\n'.match(new RegExp('[a-c\d]+'))
+ testcases[count++] = new TestCase ( SECTION, "'\n\n\abc324234\n'.match(new RegExp('[a-c\\d]+'))",
+ String(["abc324234"]), String('\n\n\abc324234\n'.match(new RegExp('[a-c\\d]+'))));
+
+ // 'abc'.match(new RegExp('ab[.]?c'))
+ testcases[count++] = new TestCase ( SECTION, "'abc'.match(new RegExp('ab[.]?c'))",
+ String(["abc"]), String('abc'.match(new RegExp('ab[.]?c'))));
+
+ // 'abc'.match(new RegExp('a[b]c'))
+ testcases[count++] = new TestCase ( SECTION, "'abc'.match(new RegExp('a[b]c'))",
+ String(["abc"]), String('abc'.match(new RegExp('a[b]c'))));
+
+ // 'a1b b2c c3d def f4g'.match(new RegExp('[a-z][^1-9][a-z]'))
+ testcases[count++] = new TestCase ( SECTION, "'a1b b2c c3d def f4g'.match(new RegExp('[a-z][^1-9][a-z]'))",
+ String(["def"]), String('a1b b2c c3d def f4g'.match(new RegExp('[a-z][^1-9][a-z]'))));
+
+ // '123*&$abc'.match(new RegExp('[*&$]{3}'))
+ testcases[count++] = new TestCase ( SECTION, "'123*&$abc'.match(new RegExp('[*&$]{3}'))",
+ String(["*&$"]), String('123*&$abc'.match(new RegExp('[*&$]{3}'))));
+
+ // 'abc'.match(new RegExp('a[^1-9]c'))
+ testcases[count++] = new TestCase ( SECTION, "'abc'.match(new RegExp('a[^1-9]c'))",
+ String(["abc"]), String('abc'.match(new RegExp('a[^1-9]c'))));
+
+ // 'abc'.match(new RegExp('a[^b]c'))
+ testcases[count++] = new TestCase ( SECTION, "'abc'.match(new RegExp('a[^b]c'))",
+ null, 'abc'.match(new RegExp('a[^b]c')));
+
+ // 'abc#$%def%&*@ghi)(*&'.match(new RegExp('[^a-z]{4}'))
+ testcases[count++] = new TestCase ( SECTION, "'abc#$%def%&*@ghi)(*&'.match(new RegExp('[^a-z]{4}'))",
+ String(["%&*@"]), String('abc#$%def%&*@ghi)(*&'.match(new RegExp('[^a-z]{4}'))));
+
+ // 'abc#$%def%&*@ghi)(*&'.match(/[^a-z]{4}/)
+ testcases[count++] = new TestCase ( SECTION, "'abc#$%def%&*@ghi)(*&'.match(/[^a-z]{4}/)",
+ String(["%&*@"]), String('abc#$%def%&*@ghi)(*&'.match(/[^a-z]{4}/)));
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/compile.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/compile.js
new file mode 100644
index 0000000..973fff2
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/compile.js
@@ -0,0 +1,94 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: compile.js
+ Description: 'Tests regular expressions method compile'
+
+ Author: Nick Lerissa
+ Date: March 10, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: compile';
+
+ writeHeaderToLog('Executing script: compile.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ var regularExpression = new RegExp();
+
+ regularExpression.compile("[0-9]{3}x[0-9]{4}","i");
+
+ testcases[count++] = new TestCase ( SECTION,
+ "(compile '[0-9]{3}x[0-9]{4}','i')",
+ String(["456X7890"]), String('234X456X7890'.match(regularExpression)));
+
+ testcases[count++] = new TestCase ( SECTION,
+ "source of (compile '[0-9]{3}x[0-9]{4}','i')",
+ "[0-9]{3}x[0-9]{4}", regularExpression.source);
+
+ testcases[count++] = new TestCase ( SECTION,
+ "global of (compile '[0-9]{3}x[0-9]{4}','i')",
+ false, regularExpression.global);
+
+ testcases[count++] = new TestCase ( SECTION,
+ "ignoreCase of (compile '[0-9]{3}x[0-9]{4}','i')",
+ true, regularExpression.ignoreCase);
+
+ regularExpression.compile("[0-9]{3}X[0-9]{3}","g");
+
+ testcases[count++] = new TestCase ( SECTION,
+ "(compile '[0-9]{3}X[0-9]{3}','g')",
+ String(["234X456"]), String('234X456X7890'.match(regularExpression)));
+
+ testcases[count++] = new TestCase ( SECTION,
+ "source of (compile '[0-9]{3}X[0-9]{3}','g')",
+ "[0-9]{3}X[0-9]{3}", regularExpression.source);
+
+ testcases[count++] = new TestCase ( SECTION,
+ "global of (compile '[0-9]{3}X[0-9]{3}','g')",
+ true, regularExpression.global);
+
+ testcases[count++] = new TestCase ( SECTION,
+ "ignoreCase of (compile '[0-9]{3}X[0-9]{3}','g')",
+ false, regularExpression.ignoreCase);
+
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/control_characters.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/control_characters.js
new file mode 100644
index 0000000..fb54a7f
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/control_characters.js
@@ -0,0 +1,71 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: control_characters.js
+ Description: 'Tests regular expressions containing .'
+
+ Author: Nick Lerissa
+ Date: April 8, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: .';
+ var BUGNUMBER="123802";
+
+ writeHeaderToLog('Executing script: control_characters.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ // 'àOÐ ê:i¢Ø'.match(new RegExp('.+'))
+ testcases[count++] = new TestCase ( SECTION, "'àOÐ ê:i¢Ø'.match(new RegExp('.+'))",
+ String(['àOÐ ê:i¢Ø']), String('àOÐ ê:i¢Ø'.match(new RegExp('.+'))));
+
+ // string1.match(new RegExp(string1))
+ var string1 = 'àOÐ ê:i¢Ø';
+ testcases[count++] = new TestCase ( SECTION, "string1 = " + string1 + " string1.match(string1)",
+ String([string1]), String(string1.match(string1)));
+
+ string1 = "";
+ for (var i = 0; i < 32; i++)
+ string1 += String.fromCharCode(i);
+ testcases[count++] = new TestCase ( SECTION, "string1 = " + string1 + " string1.match(string1)",
+ String([string1]), String(string1.match(string1)));
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/digit.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/digit.js
new file mode 100644
index 0000000..d476823
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/digit.js
@@ -0,0 +1,119 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: digit.js
+ Description: 'Tests regular expressions containing \d'
+
+ Author: Nick Lerissa
+ Date: March 10, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: \\d';
+
+ writeHeaderToLog('Executing script: digit.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ var non_digits = "_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\f\n\r\t\v~`!@#$%^&*()-+={[}]|\\:;'<,>./? " + '"';
+
+ var digits = "1234567890";
+
+ // be sure all digits are matched by \d
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + digits + "'.match(new RegExp('\\d+'))",
+ String([digits]), String(digits.match(new RegExp('\\d+'))));
+
+ // be sure all non-digits are matched by \D
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + non_digits + "'.match(new RegExp('\\D+'))",
+ String([non_digits]), String(non_digits.match(new RegExp('\\D+'))));
+
+ // be sure all non-digits are not matched by \d
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + non_digits + "'.match(new RegExp('\\d'))",
+ null, non_digits.match(new RegExp('\\d')));
+
+ // be sure all digits are not matched by \D
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + digits + "'.match(new RegExp('\\D'))",
+ null, digits.match(new RegExp('\\D')));
+
+ var s = non_digits + digits;
+
+ // be sure all digits are matched by \d
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + s + "'.match(new RegExp('\\d+'))",
+ String([digits]), String(s.match(new RegExp('\\d+'))));
+
+ var s = digits + non_digits;
+
+ // be sure all non-digits are matched by \D
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + s + "'.match(new RegExp('\\D+'))",
+ String([non_digits]), String(s.match(new RegExp('\\D+'))));
+
+ var i;
+
+ // be sure all digits match individually
+ for (i = 0; i < digits.length; ++i)
+ {
+ s = 'ab' + digits[i] + 'cd';
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + s + "'.match(new RegExp('\\d'))",
+ String([digits[i]]), String(s.match(new RegExp('\\d'))));
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + s + "'.match(/\\d/)",
+ String([digits[i]]), String(s.match(/\d/)));
+ }
+ // be sure all non_digits match individually
+ for (i = 0; i < non_digits.length; ++i)
+ {
+ s = '12' + non_digits[i] + '34';
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + s + "'.match(new RegExp('\\D'))",
+ String([non_digits[i]]), String(s.match(new RegExp('\\D'))));
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + s + "'.match(/\\D/)",
+ String([non_digits[i]]), String(s.match(/\D/)));
+ }
+
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/dot.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/dot.js
new file mode 100644
index 0000000..1e9bbab
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/dot.js
@@ -0,0 +1,95 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: dot.js
+ Description: 'Tests regular expressions containing .'
+
+ Author: Nick Lerissa
+ Date: March 10, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: .';
+
+ writeHeaderToLog('Executing script: dot.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ // 'abcde'.match(new RegExp('ab.de'))
+ testcases[count++] = new TestCase ( SECTION, "'abcde'.match(new RegExp('ab.de'))",
+ String(["abcde"]), String('abcde'.match(new RegExp('ab.de'))));
+
+ // 'line 1\nline 2'.match(new RegExp('.+'))
+ testcases[count++] = new TestCase ( SECTION, "'line 1\nline 2'.match(new RegExp('.+'))",
+ String(["line 1"]), String('line 1\nline 2'.match(new RegExp('.+'))));
+
+ // 'this is a test'.match(new RegExp('.*a.*'))
+ testcases[count++] = new TestCase ( SECTION, "'this is a test'.match(new RegExp('.*a.*'))",
+ String(["this is a test"]), String('this is a test'.match(new RegExp('.*a.*'))));
+
+ // 'this is a *&^%$# test'.match(new RegExp('.+'))
+ testcases[count++] = new TestCase ( SECTION, "'this is a *&^%$# test'.match(new RegExp('.+'))",
+ String(["this is a *&^%$# test"]), String('this is a *&^%$# test'.match(new RegExp('.+'))));
+
+ // '....'.match(new RegExp('.+'))
+ testcases[count++] = new TestCase ( SECTION, "'....'.match(new RegExp('.+'))",
+ String(["...."]), String('....'.match(new RegExp('.+'))));
+
+ // 'abcdefghijklmnopqrstuvwxyz'.match(new RegExp('.+'))
+ testcases[count++] = new TestCase ( SECTION, "'abcdefghijklmnopqrstuvwxyz'.match(new RegExp('.+'))",
+ String(["abcdefghijklmnopqrstuvwxyz"]), String('abcdefghijklmnopqrstuvwxyz'.match(new RegExp('.+'))));
+
+ // 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.match(new RegExp('.+'))
+ testcases[count++] = new TestCase ( SECTION, "'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.match(new RegExp('.+'))",
+ String(["ABCDEFGHIJKLMNOPQRSTUVWXYZ"]), String('ABCDEFGHIJKLMNOPQRSTUVWXYZ'.match(new RegExp('.+'))));
+
+ // '`1234567890-=~!@#$%^&*()_+'.match(new RegExp('.+'))
+ testcases[count++] = new TestCase ( SECTION, "'`1234567890-=~!@#$%^&*()_+'.match(new RegExp('.+'))",
+ String(["`1234567890-=~!@#$%^&*()_+"]), String('`1234567890-=~!@#$%^&*()_+'.match(new RegExp('.+'))));
+
+ // '|\\[{]};:"\',<>.?/'.match(new RegExp('.+'))
+ testcases[count++] = new TestCase ( SECTION, "'|\\[{]};:\"\',<>.?/'.match(new RegExp('.+'))",
+ String(["|\\[{]};:\"\',<>.?/"]), String('|\\[{]};:\"\',<>.?/'.match(new RegExp('.+'))));
+
+ // '|\\[{]};:"\',<>.?/'.match(/.+/)
+ testcases[count++] = new TestCase ( SECTION, "'|\\[{]};:\"\',<>.?/'.match(/.+/)",
+ String(["|\\[{]};:\"\',<>.?/"]), String('|\\[{]};:\"\',<>.?/'.match(/.+/)));
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/endLine.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/endLine.js
new file mode 100644
index 0000000..655d6ec
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/endLine.js
@@ -0,0 +1,80 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: endLine.js
+ Description: 'Tests regular expressions containing $'
+
+ Author: Nick Lerissa
+ Date: March 10, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: $';
+
+ writeHeaderToLog('Executing script: endLine.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ // 'abcde'.match(new RegExp('de$'))
+ testcases[count++] = new TestCase ( SECTION, "'abcde'.match(new RegExp('de$'))",
+ String(["de"]), String('abcde'.match(new RegExp('de$'))));
+
+ // 'ab\ncde'.match(new RegExp('..$e$'))
+ testcases[count++] = new TestCase ( SECTION, "'ab\ncde'.match(new RegExp('..$e$'))",
+ null, 'ab\ncde'.match(new RegExp('..$e$')));
+
+ // 'yyyyy'.match(new RegExp('xxx$'))
+ testcases[count++] = new TestCase ( SECTION, "'yyyyy'.match(new RegExp('xxx$'))",
+ null, 'yyyyy'.match(new RegExp('xxx$')));
+
+ // 'a$$$'.match(new RegExp('\\$+$'))
+ testcases[count++] = new TestCase ( SECTION, "'a$$$'.match(new RegExp('\\$+$'))",
+ String(['$$$']), String('a$$$'.match(new RegExp('\\$+$'))));
+
+ // 'a$$$'.match(/\$+$/)
+ testcases[count++] = new TestCase ( SECTION, "'a$$$'.match(/\\$+$/)",
+ String(['$$$']), String('a$$$'.match(/\$+$/)));
+
+ RegExp.multiline = true;
+ // 'abc\n123xyz890\nxyz'.match(new RegExp('\d+$')) <multiline==true>
+ testcases[count++] = new TestCase ( SECTION, "'abc\n123xyz890\nxyz'.match(new RegExp('\\d+$'))",
+ String(['890']), String('abc\n123xyz890\nxyz'.match(new RegExp('\\d+$'))));
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/everything.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/everything.js
new file mode 100644
index 0000000..1cb6acb
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/everything.js
@@ -0,0 +1,80 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: everything.js
+ Description: 'Tests regular expressions'
+
+ Author: Nick Lerissa
+ Date: March 24, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp';
+
+ writeHeaderToLog('Executing script: everything.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ // 'Sally and Fred are sure to come.'.match(/^[a-z\s]*/i)
+ testcases[count++] = new TestCase ( SECTION, "'Sally and Fred are sure to come'.match(/^[a-z\\s]*/i)",
+ String(["Sally and Fred are sure to come"]), String('Sally and Fred are sure to come'.match(/^[a-z\s]*/i)));
+
+ // 'test123W+xyz'.match(new RegExp('^[a-z]*[0-9]+[A-Z]?.(123|xyz)$'))
+ testcases[count++] = new TestCase ( SECTION, "'test123W+xyz'.match(new RegExp('^[a-z]*[0-9]+[A-Z]?.(123|xyz)$'))",
+ String(["test123W+xyz","xyz"]), String('test123W+xyz'.match(new RegExp('^[a-z]*[0-9]+[A-Z]?.(123|xyz)$'))));
+
+ // 'number one 12365 number two 9898'.match(/(\d+)\D+(\d+)/)
+ testcases[count++] = new TestCase ( SECTION, "'number one 12365 number two 9898'.match(/(\d+)\D+(\d+)/)",
+ String(["12365 number two 9898","12365","9898"]), String('number one 12365 number two 9898'.match(/(\d+)\D+(\d+)/)));
+
+ var simpleSentence = /(\s?[^\!\?\.]+[\!\?\.])+/;
+ // 'See Spot run.'.match(simpleSentence)
+ testcases[count++] = new TestCase ( SECTION, "'See Spot run.'.match(simpleSentence)",
+ String(["See Spot run.","See Spot run."]), String('See Spot run.'.match(simpleSentence)));
+
+ // 'I like it. What's up? I said NO!'.match(simpleSentence)
+ testcases[count++] = new TestCase ( SECTION, "'I like it. What's up? I said NO!'.match(simpleSentence)",
+ String(["I like it. What's up? I said NO!",' I said NO!']), String('I like it. What\'s up? I said NO!'.match(simpleSentence)));
+
+ // 'the quick brown fox jumped over the lazy dogs'.match(/((\w+)\s*)+/)
+ testcases[count++] = new TestCase ( SECTION, "'the quick brown fox jumped over the lazy dogs'.match(/((\\w+)\\s*)+/)",
+ String(['the quick brown fox jumped over the lazy dogs','dogs','dogs']),String('the quick brown fox jumped over the lazy dogs'.match(/((\w+)\s*)+/)));
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/exec.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/exec.js
new file mode 100644
index 0000000..f1a9d8b
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/exec.js
@@ -0,0 +1,77 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: exec.js
+ Description: 'Tests regular expressions exec compile'
+
+ Author: Nick Lerissa
+ Date: March 10, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: exec';
+
+ writeHeaderToLog('Executing script: exec.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ testcases[count++] = new TestCase ( SECTION,
+ "/[0-9]{3}/.exec('23 2 34 678 9 09')",
+ String(["678"]), String(/[0-9]{3}/.exec('23 2 34 678 9 09')));
+
+ testcases[count++] = new TestCase ( SECTION,
+ "/3.{4}8/.exec('23 2 34 678 9 09')",
+ String(["34 678"]), String(/3.{4}8/.exec('23 2 34 678 9 09')));
+
+ var re = new RegExp('3.{4}8');
+ testcases[count++] = new TestCase ( SECTION,
+ "re.exec('23 2 34 678 9 09')",
+ String(["34 678"]), String(re.exec('23 2 34 678 9 09')));
+
+ testcases[count++] = new TestCase ( SECTION,
+ "(/3.{4}8/.exec('23 2 34 678 9 09').length",
+ 1, (/3.{4}8/.exec('23 2 34 678 9 09')).length);
+
+ re = new RegExp('3.{4}8');
+ testcases[count++] = new TestCase ( SECTION,
+ "(re.exec('23 2 34 678 9 09').length",
+ 1, (re.exec('23 2 34 678 9 09')).length);
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/flags.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/flags.js
new file mode 100644
index 0000000..5c25c8f
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/flags.js
@@ -0,0 +1,84 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: regexp.js
+ Description: 'Tests regular expressions using flags "i" and "g"'
+
+ Author: Nick Lerissa
+ Date: March 10, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'regular expression flags with flags "i" and "g"';
+
+ writeHeaderToLog('Executing script: flags.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ // testing optional flag 'i'
+ testcases[count++] = new TestCase ( SECTION, "'aBCdEfGHijKLmno'.match(/fghijk/i)",
+ String(["fGHijK"]), String('aBCdEfGHijKLmno'.match(/fghijk/i)));
+
+ testcases[count++] = new TestCase ( SECTION, "'aBCdEfGHijKLmno'.match(new RegExp('fghijk','i'))",
+ String(["fGHijK"]), String('aBCdEfGHijKLmno'.match(new RegExp("fghijk","i"))));
+
+ // testing optional flag 'g'
+ testcases[count++] = new TestCase ( SECTION, "'xa xb xc xd xe xf'.match(/x./g)",
+ String(["xa","xb","xc","xd","xe","xf"]), String('xa xb xc xd xe xf'.match(/x./g)));
+
+ testcases[count++] = new TestCase ( SECTION, "'xa xb xc xd xe xf'.match(new RegExp('x.','g'))",
+ String(["xa","xb","xc","xd","xe","xf"]), String('xa xb xc xd xe xf'.match(new RegExp('x.','g'))));
+
+ // testing optional flags 'g' and 'i'
+ testcases[count++] = new TestCase ( SECTION, "'xa Xb xc xd Xe xf'.match(/x./gi)",
+ String(["xa","Xb","xc","xd","Xe","xf"]), String('xa Xb xc xd Xe xf'.match(/x./gi)));
+
+ testcases[count++] = new TestCase ( SECTION, "'xa Xb xc xd Xe xf'.match(new RegExp('x.','gi'))",
+ String(["xa","Xb","xc","xd","Xe","xf"]), String('xa Xb xc xd Xe xf'.match(new RegExp('x.','gi'))));
+
+ testcases[count++] = new TestCase ( SECTION, "'xa Xb xc xd Xe xf'.match(/x./ig)",
+ String(["xa","Xb","xc","xd","Xe","xf"]), String('xa Xb xc xd Xe xf'.match(/x./ig)));
+
+ testcases[count++] = new TestCase ( SECTION, "'xa Xb xc xd Xe xf'.match(new RegExp('x.','ig'))",
+ String(["xa","Xb","xc","xd","Xe","xf"]), String('xa Xb xc xd Xe xf'.match(new RegExp('x.','ig'))));
+
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
+
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/global.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/global.js
new file mode 100644
index 0000000..ce43520
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/global.js
@@ -0,0 +1,95 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: global.js
+ Description: 'Tests RegExp attribute global'
+
+ Author: Nick Lerissa
+ Date: March 13, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: global';
+
+ writeHeaderToLog('Executing script: global.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ // /xyz/g.global
+ testcases[count++] = new TestCase ( SECTION, "/xyz/g.global",
+ true, /xyz/g.global);
+
+ // /xyz/.global
+ testcases[count++] = new TestCase ( SECTION, "/xyz/.global",
+ false, /xyz/.global);
+
+ // '123 456 789'.match(/\d+/g)
+ testcases[count++] = new TestCase ( SECTION, "'123 456 789'.match(/\\d+/g)",
+ String(["123","456","789"]), String('123 456 789'.match(/\d+/g)));
+
+ // '123 456 789'.match(/(\d+)/g)
+ testcases[count++] = new TestCase ( SECTION, "'123 456 789'.match(/(\\d+)/g)",
+ String(["123","456","789"]), String('123 456 789'.match(/(\d+)/g)));
+
+ // '123 456 789'.match(/\d+/)
+ testcases[count++] = new TestCase ( SECTION, "'123 456 789'.match(/\\d+/)",
+ String(["123"]), String('123 456 789'.match(/\d+/)));
+
+ // (new RegExp('[a-z]','g')).global
+ testcases[count++] = new TestCase ( SECTION, "(new RegExp('[a-z]','g')).global",
+ true, (new RegExp('[a-z]','g')).global);
+
+ // (new RegExp('[a-z]','i')).global
+ testcases[count++] = new TestCase ( SECTION, "(new RegExp('[a-z]','i')).global",
+ false, (new RegExp('[a-z]','i')).global);
+
+ // '123 456 789'.match(new RegExp('\\d+','g'))
+ testcases[count++] = new TestCase ( SECTION, "'123 456 789'.match(new RegExp('\\\\d+','g'))",
+ String(["123","456","789"]), String('123 456 789'.match(new RegExp('\\d+','g'))));
+
+ // '123 456 789'.match(new RegExp('(\\d+)','g'))
+ testcases[count++] = new TestCase ( SECTION, "'123 456 789'.match(new RegExp('(\\\\d+)','g'))",
+ String(["123","456","789"]), String('123 456 789'.match(new RegExp('(\\d+)','g'))));
+
+ // '123 456 789'.match(new RegExp('\\d+','i'))
+ testcases[count++] = new TestCase ( SECTION, "'123 456 789'.match(new RegExp('\\\\d+','i'))",
+ String(["123"]), String('123 456 789'.match(new RegExp('\\d+','i'))));
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/hexadecimal.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/hexadecimal.js
new file mode 100644
index 0000000..8f68c9a
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/hexadecimal.js
@@ -0,0 +1,108 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: hexadecimal.js
+ Description: 'Tests regular expressions containing \<number> '
+
+ Author: Nick Lerissa
+ Date: March 10, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: \x# (hex) ';
+
+ writeHeaderToLog('Executing script: hexadecimal.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+
+ var testPattern = '\\x41\\x42\\x43\\x44\\x45\\x46\\x47\\x48\\x49\\x4A\\x4B\\x4C\\x4D\\x4E\\x4F\\x50\\x51\\x52\\x53\\x54\\x55\\x56\\x57\\x58\\x59\\x5A';
+
+ var testString = "12345ABCDEFGHIJKLMNOPQRSTUVWXYZ67890";
+
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + testString + "'.match(new RegExp('" + testPattern + "'))",
+ String(["ABCDEFGHIJKLMNOPQRSTUVWXYZ"]), String(testString.match(new RegExp(testPattern))));
+
+ testPattern = '\\x61\\x62\\x63\\x64\\x65\\x66\\x67\\x68\\x69\\x6A\\x6B\\x6C\\x6D\\x6E\\x6F\\x70\\x71\\x72\\x73\\x74\\x75\\x76\\x77\\x78\\x79\\x7A';
+
+ testString = "12345AabcdefghijklmnopqrstuvwxyzZ67890";
+
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + testString + "'.match(new RegExp('" + testPattern + "'))",
+ String(["abcdefghijklmnopqrstuvwxyz"]), String(testString.match(new RegExp(testPattern))));
+
+ testPattern = '\\x20\\x21\\x22\\x23\\x24\\x25\\x26\\x27\\x28\\x29\\x2A\\x2B\\x2C\\x2D\\x2E\\x2F\\x30\\x31\\x32\\x33';
+
+ testString = "abc !\"#$%&'()*+,-./0123ZBC";
+
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + testString + "'.match(new RegExp('" + testPattern + "'))",
+ String([" !\"#$%&'()*+,-./0123"]), String(testString.match(new RegExp(testPattern))));
+
+ testPattern = '\\x34\\x35\\x36\\x37\\x38\\x39\\x3A\\x3B\\x3C\\x3D\\x3E\\x3F\\x40';
+
+ testString = "123456789:;<=>?@ABC";
+
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + testString + "'.match(new RegExp('" + testPattern + "'))",
+ String(["456789:;<=>?@"]), String(testString.match(new RegExp(testPattern))));
+
+ testPattern = '\\x7B\\x7C\\x7D\\x7E';
+
+ testString = "1234{|}~ABC";
+
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + testString + "'.match(new RegExp('" + testPattern + "'))",
+ String(["{|}~"]), String(testString.match(new RegExp(testPattern))));
+
+ testcases[count++] = new TestCase ( SECTION,
+ "'canthisbeFOUND'.match(new RegExp('[A-\\x5A]+'))",
+ String(["FOUND"]), String('canthisbeFOUND'.match(new RegExp('[A-\\x5A]+'))));
+
+ testcases[count++] = new TestCase ( SECTION,
+ "'canthisbeFOUND'.match(new RegExp('[\\x61-\\x7A]+'))",
+ String(["canthisbe"]), String('canthisbeFOUND'.match(new RegExp('[\\x61-\\x7A]+'))));
+
+ testcases[count++] = new TestCase ( SECTION,
+ "'canthisbeFOUND'.match(/[\\x61-\\x7A]+/)",
+ String(["canthisbe"]), String('canthisbeFOUND'.match(/[\x61-\x7A]+/)));
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/ignoreCase.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/ignoreCase.js
new file mode 100644
index 0000000..fec4d2c
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/ignoreCase.js
@@ -0,0 +1,111 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: ignoreCase.js
+ Description: 'Tests RegExp attribute ignoreCase'
+
+ Author: Nick Lerissa
+ Date: March 13, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: ignoreCase';
+
+ writeHeaderToLog('Executing script: ignoreCase.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ // /xyz/i.ignoreCase
+ testcases[count++] = new TestCase ( SECTION, "/xyz/i.ignoreCase",
+ true, /xyz/i.ignoreCase);
+
+ // /xyz/.ignoreCase
+ testcases[count++] = new TestCase ( SECTION, "/xyz/.ignoreCase",
+ false, /xyz/.ignoreCase);
+
+ // 'ABC def ghi'.match(/[a-z]+/ig)
+ testcases[count++] = new TestCase ( SECTION, "'ABC def ghi'.match(/[a-z]+/ig)",
+ String(["ABC","def","ghi"]), String('ABC def ghi'.match(/[a-z]+/ig)));
+
+ // 'ABC def ghi'.match(/[a-z]+/i)
+ testcases[count++] = new TestCase ( SECTION, "'ABC def ghi'.match(/[a-z]+/i)",
+ String(["ABC"]), String('ABC def ghi'.match(/[a-z]+/i)));
+
+ // 'ABC def ghi'.match(/([a-z]+)/ig)
+ testcases[count++] = new TestCase ( SECTION, "'ABC def ghi'.match(/([a-z]+)/ig)",
+ String(["ABC","def","ghi"]), String('ABC def ghi'.match(/([a-z]+)/ig)));
+
+ // 'ABC def ghi'.match(/([a-z]+)/i)
+ testcases[count++] = new TestCase ( SECTION, "'ABC def ghi'.match(/([a-z]+)/i)",
+ String(["ABC","ABC"]), String('ABC def ghi'.match(/([a-z]+)/i)));
+
+ // 'ABC def ghi'.match(/[a-z]+/)
+ testcases[count++] = new TestCase ( SECTION, "'ABC def ghi'.match(/[a-z]+/)",
+ String(["def"]), String('ABC def ghi'.match(/[a-z]+/)));
+
+ // (new RegExp('xyz','i')).ignoreCase
+ testcases[count++] = new TestCase ( SECTION, "(new RegExp('xyz','i')).ignoreCase",
+ true, (new RegExp('xyz','i')).ignoreCase);
+
+ // (new RegExp('xyz')).ignoreCase
+ testcases[count++] = new TestCase ( SECTION, "(new RegExp('xyz')).ignoreCase",
+ false, (new RegExp('xyz')).ignoreCase);
+
+ // 'ABC def ghi'.match(new RegExp('[a-z]+','ig'))
+ testcases[count++] = new TestCase ( SECTION, "'ABC def ghi'.match(new RegExp('[a-z]+','ig'))",
+ String(["ABC","def","ghi"]), String('ABC def ghi'.match(new RegExp('[a-z]+','ig'))));
+
+ // 'ABC def ghi'.match(new RegExp('[a-z]+','i'))
+ testcases[count++] = new TestCase ( SECTION, "'ABC def ghi'.match(new RegExp('[a-z]+','i'))",
+ String(["ABC"]), String('ABC def ghi'.match(new RegExp('[a-z]+','i'))));
+
+ // 'ABC def ghi'.match(new RegExp('([a-z]+)','ig'))
+ testcases[count++] = new TestCase ( SECTION, "'ABC def ghi'.match(new RegExp('([a-z]+)','ig'))",
+ String(["ABC","def","ghi"]), String('ABC def ghi'.match(new RegExp('([a-z]+)','ig'))));
+
+ // 'ABC def ghi'.match(new RegExp('([a-z]+)','i'))
+ testcases[count++] = new TestCase ( SECTION, "'ABC def ghi'.match(new RegExp('([a-z]+)','i'))",
+ String(["ABC","ABC"]), String('ABC def ghi'.match(new RegExp('([a-z]+)','i'))));
+
+ // 'ABC def ghi'.match(new RegExp('[a-z]+'))
+ testcases[count++] = new TestCase ( SECTION, "'ABC def ghi'.match(new RegExp('[a-z]+'))",
+ String(["def"]), String('ABC def ghi'.match(new RegExp('[a-z]+'))));
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/interval.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/interval.js
new file mode 100644
index 0000000..7e80777
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/interval.js
@@ -0,0 +1,115 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: interval.js
+ Description: 'Tests regular expressions containing {}'
+
+ Author: Nick Lerissa
+ Date: March 10, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: {}';
+
+ writeHeaderToLog('Executing script: interval.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ // 'aaabbbbcccddeeeefffff'.match(new RegExp('b{2}c'))
+ testcases[count++] = new TestCase ( SECTION, "'aaabbbbcccddeeeefffff'.match(new RegExp('b{2}c'))",
+ String(["bbc"]), String('aaabbbbcccddeeeefffff'.match(new RegExp('b{2}c'))));
+
+ // 'aaabbbbcccddeeeefffff'.match(new RegExp('b{8}'))
+ testcases[count++] = new TestCase ( SECTION, "'aaabbbbcccddeeeefffff'.match(new RegExp('b{8}'))",
+ null, 'aaabbbbcccddeeeefffff'.match(new RegExp('b{8}')));
+
+ // 'aaabbbbcccddeeeefffff'.match(new RegExp('b{2,}c'))
+ testcases[count++] = new TestCase ( SECTION, "'aaabbbbcccddeeeefffff'.match(new RegExp('b{2,}c'))",
+ String(["bbbbc"]), String('aaabbbbcccddeeeefffff'.match(new RegExp('b{2,}c'))));
+
+ // 'aaabbbbcccddeeeefffff'.match(new RegExp('b{8,}c'))
+ testcases[count++] = new TestCase ( SECTION, "'aaabbbbcccddeeeefffff'.match(new RegExp('b{8,}c'))",
+ null, 'aaabbbbcccddeeeefffff'.match(new RegExp('b{8,}c')));
+
+ // 'aaabbbbcccddeeeefffff'.match(new RegExp('b{2,3}c'))
+ testcases[count++] = new TestCase ( SECTION, "'aaabbbbcccddeeeefffff'.match(new RegExp('b{2,3}c'))",
+ String(["bbbc"]), String('aaabbbbcccddeeeefffff'.match(new RegExp('b{2,3}c'))));
+
+ // 'aaabbbbcccddeeeefffff'.match(new RegExp('b{42,93}c'))
+ testcases[count++] = new TestCase ( SECTION, "'aaabbbbcccddeeeefffff'.match(new RegExp('b{42,93}c'))",
+ null, 'aaabbbbcccddeeeefffff'.match(new RegExp('b{42,93}c')));
+
+ // 'aaabbbbcccddeeeefffff'.match(new RegExp('b{0,93}c'))
+ testcases[count++] = new TestCase ( SECTION, "'aaabbbbcccddeeeefffff'.match(new RegExp('b{0,93}c'))",
+ String(["bbbbc"]), String('aaabbbbcccddeeeefffff'.match(new RegExp('b{0,93}c'))));
+
+ // 'aaabbbbcccddeeeefffff'.match(new RegExp('bx{0,93}c'))
+ testcases[count++] = new TestCase ( SECTION, "'aaabbbbcccddeeeefffff'.match(new RegExp('bx{0,93}c'))",
+ String(["bc"]), String('aaabbbbcccddeeeefffff'.match(new RegExp('bx{0,93}c'))));
+
+ // 'weirwerdf'.match(new RegExp('.{0,93}'))
+ testcases[count++] = new TestCase ( SECTION, "'weirwerdf'.match(new RegExp('.{0,93}'))",
+ String(["weirwerdf"]), String('weirwerdf'.match(new RegExp('.{0,93}'))));
+
+ // 'wqe456646dsff'.match(new RegExp('\d{1,}'))
+ testcases[count++] = new TestCase ( SECTION, "'wqe456646dsff'.match(new RegExp('\\d{1,}'))",
+ String(["456646"]), String('wqe456646dsff'.match(new RegExp('\\d{1,}'))));
+
+ // '123123'.match(new RegExp('(123){1,}'))
+ testcases[count++] = new TestCase ( SECTION, "'123123'.match(new RegExp('(123){1,}'))",
+ String(["123123","123"]), String('123123'.match(new RegExp('(123){1,}'))));
+
+ // '123123x123'.match(new RegExp('(123){1,}x\1'))
+ testcases[count++] = new TestCase ( SECTION, "'123123x123'.match(new RegExp('(123){1,}x\\1'))",
+ String(["123123x123","123"]), String('123123x123'.match(new RegExp('(123){1,}x\\1'))));
+
+ // '123123x123'.match(/(123){1,}x\1/)
+ testcases[count++] = new TestCase ( SECTION, "'123123x123'.match(/(123){1,}x\\1/)",
+ String(["123123x123","123"]), String('123123x123'.match(/(123){1,}x\1/)));
+
+ // 'xxxxxxx'.match(new RegExp('x{1,2}x{1,}'))
+ testcases[count++] = new TestCase ( SECTION, "'xxxxxxx'.match(new RegExp('x{1,2}x{1,}'))",
+ String(["xxxxxxx"]), String('xxxxxxx'.match(new RegExp('x{1,2}x{1,}'))));
+
+ // 'xxxxxxx'.match(/x{1,2}x{1,}/)
+ testcases[count++] = new TestCase ( SECTION, "'xxxxxxx'.match(/x{1,2}x{1,}/)",
+ String(["xxxxxxx"]), String('xxxxxxx'.match(/x{1,2}x{1,}/)));
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/octal.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/octal.js
new file mode 100644
index 0000000..2fe6588
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/octal.js
@@ -0,0 +1,108 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: octal.js
+ Description: 'Tests regular expressions containing \<number> '
+
+ Author: Nick Lerissa
+ Date: March 10, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: \# (octal) ';
+
+ writeHeaderToLog('Executing script: octal.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+
+ var testPattern = '\\101\\102\\103\\104\\105\\106\\107\\110\\111\\112\\113\\114\\115\\116\\117\\120\\121\\122\\123\\124\\125\\126\\127\\130\\131\\132';
+
+ var testString = "12345ABCDEFGHIJKLMNOPQRSTUVWXYZ67890";
+
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + testString + "'.match(new RegExp('" + testPattern + "'))",
+ String(["ABCDEFGHIJKLMNOPQRSTUVWXYZ"]), String(testString.match(new RegExp(testPattern))));
+
+ testPattern = '\\141\\142\\143\\144\\145\\146\\147\\150\\151\\152\\153\\154\\155\\156\\157\\160\\161\\162\\163\\164\\165\\166\\167\\170\\171\\172';
+
+ testString = "12345AabcdefghijklmnopqrstuvwxyzZ67890";
+
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + testString + "'.match(new RegExp('" + testPattern + "'))",
+ String(["abcdefghijklmnopqrstuvwxyz"]), String(testString.match(new RegExp(testPattern))));
+
+ testPattern = '\\40\\41\\42\\43\\44\\45\\46\\47\\50\\51\\52\\53\\54\\55\\56\\57\\60\\61\\62\\63';
+
+ testString = "abc !\"#$%&'()*+,-./0123ZBC";
+
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + testString + "'.match(new RegExp('" + testPattern + "'))",
+ String([" !\"#$%&'()*+,-./0123"]), String(testString.match(new RegExp(testPattern))));
+
+ testPattern = '\\64\\65\\66\\67\\70\\71\\72\\73\\74\\75\\76\\77\\100';
+
+ testString = "123456789:;<=>?@ABC";
+
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + testString + "'.match(new RegExp('" + testPattern + "'))",
+ String(["456789:;<=>?@"]), String(testString.match(new RegExp(testPattern))));
+
+ testPattern = '\\173\\174\\175\\176';
+
+ testString = "1234{|}~ABC";
+
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + testString + "'.match(new RegExp('" + testPattern + "'))",
+ String(["{|}~"]), String(testString.match(new RegExp(testPattern))));
+
+ testcases[count++] = new TestCase ( SECTION,
+ "'canthisbeFOUND'.match(new RegExp('[A-\\132]+'))",
+ String(["FOUND"]), String('canthisbeFOUND'.match(new RegExp('[A-\\132]+'))));
+
+ testcases[count++] = new TestCase ( SECTION,
+ "'canthisbeFOUND'.match(new RegExp('[\\141-\\172]+'))",
+ String(["canthisbe"]), String('canthisbeFOUND'.match(new RegExp('[\\141-\\172]+'))));
+
+ testcases[count++] = new TestCase ( SECTION,
+ "'canthisbeFOUND'.match(/[\\141-\\172]+/)",
+ String(["canthisbe"]), String('canthisbeFOUND'.match(/[\141-\172]+/)));
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/parentheses.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/parentheses.js
new file mode 100644
index 0000000..6fe1948
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/parentheses.js
@@ -0,0 +1,107 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: parentheses.js
+ Description: 'Tests regular expressions containing ()'
+
+ Author: Nick Lerissa
+ Date: March 10, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: ()';
+
+ writeHeaderToLog('Executing script: parentheses.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ // 'abc'.match(new RegExp('(abc)'))
+ testcases[count++] = new TestCase ( SECTION, "'abc'.match(new RegExp('(abc)'))",
+ String(["abc","abc"]), String('abc'.match(new RegExp('(abc)'))));
+
+ // 'abcdefg'.match(new RegExp('a(bc)d(ef)g'))
+ testcases[count++] = new TestCase ( SECTION, "'abcdefg'.match(new RegExp('a(bc)d(ef)g'))",
+ String(["abcdefg","bc","ef"]), String('abcdefg'.match(new RegExp('a(bc)d(ef)g'))));
+
+ // 'abcdefg'.match(new RegExp('(.{3})(.{4})'))
+ testcases[count++] = new TestCase ( SECTION, "'abcdefg'.match(new RegExp('(.{3})(.{4})'))",
+ String(["abcdefg","abc","defg"]), String('abcdefg'.match(new RegExp('(.{3})(.{4})'))));
+
+ // 'aabcdaabcd'.match(new RegExp('(aa)bcd\1'))
+ testcases[count++] = new TestCase ( SECTION, "'aabcdaabcd'.match(new RegExp('(aa)bcd\\1'))",
+ String(["aabcdaa","aa"]), String('aabcdaabcd'.match(new RegExp('(aa)bcd\\1'))));
+
+ // 'aabcdaabcd'.match(new RegExp('(aa).+\1'))
+ testcases[count++] = new TestCase ( SECTION, "'aabcdaabcd'.match(new RegExp('(aa).+\\1'))",
+ String(["aabcdaa","aa"]), String('aabcdaabcd'.match(new RegExp('(aa).+\\1'))));
+
+ // 'aabcdaabcd'.match(new RegExp('(.{2}).+\1'))
+ testcases[count++] = new TestCase ( SECTION, "'aabcdaabcd'.match(new RegExp('(.{2}).+\\1'))",
+ String(["aabcdaa","aa"]), String('aabcdaabcd'.match(new RegExp('(.{2}).+\\1'))));
+
+ // '123456123456'.match(new RegExp('(\d{3})(\d{3})\1\2'))
+ testcases[count++] = new TestCase ( SECTION, "'123456123456'.match(new RegExp('(\\d{3})(\\d{3})\\1\\2'))",
+ String(["123456123456","123","456"]), String('123456123456'.match(new RegExp('(\\d{3})(\\d{3})\\1\\2'))));
+
+ // 'abcdefg'.match(new RegExp('a(..(..)..)'))
+ testcases[count++] = new TestCase ( SECTION, "'abcdefg'.match(new RegExp('a(..(..)..)'))",
+ String(["abcdefg","bcdefg","de"]), String('abcdefg'.match(new RegExp('a(..(..)..)'))));
+
+ // 'abcdefg'.match(/a(..(..)..)/)
+ testcases[count++] = new TestCase ( SECTION, "'abcdefg'.match(/a(..(..)..)/)",
+ String(["abcdefg","bcdefg","de"]), String('abcdefg'.match(/a(..(..)..)/)));
+
+ // 'xabcdefg'.match(new RegExp('(a(b(c)))(d(e(f)))'))
+ testcases[count++] = new TestCase ( SECTION, "'xabcdefg'.match(new RegExp('(a(b(c)))(d(e(f)))'))",
+ String(["abcdef","abc","bc","c","def","ef","f"]), String('xabcdefg'.match(new RegExp('(a(b(c)))(d(e(f)))'))));
+
+ // 'xabcdefbcefg'.match(new RegExp('(a(b(c)))(d(e(f)))\2\5'))
+ testcases[count++] = new TestCase ( SECTION, "'xabcdefbcefg'.match(new RegExp('(a(b(c)))(d(e(f)))\\2\\5'))",
+ String(["abcdefbcef","abc","bc","c","def","ef","f"]), String('xabcdefbcefg'.match(new RegExp('(a(b(c)))(d(e(f)))\\2\\5'))));
+
+ // 'abcd'.match(new RegExp('a(.?)b\1c\1d\1'))
+ testcases[count++] = new TestCase ( SECTION, "'abcd'.match(new RegExp('a(.?)b\\1c\\1d\\1'))",
+ String(["abcd",""]), String('abcd'.match(new RegExp('a(.?)b\\1c\\1d\\1'))));
+
+ // 'abcd'.match(/a(.?)b\1c\1d\1/)
+ testcases[count++] = new TestCase ( SECTION, "'abcd'.match(/a(.?)b\\1c\\1d\\1/)",
+ String(["abcd",""]), String('abcd'.match(/a(.?)b\1c\1d\1/)));
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/plus.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/plus.js
new file mode 100644
index 0000000..f3e44ea
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/plus.js
@@ -0,0 +1,87 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: plus.js
+ Description: 'Tests regular expressions containing +'
+
+ Author: Nick Lerissa
+ Date: March 10, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: +';
+
+ writeHeaderToLog('Executing script: plus.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ // 'abcdddddefg'.match(new RegExp('d+'))
+ testcases[count++] = new TestCase ( SECTION, "'abcdddddefg'.match(new RegExp('d+'))",
+ String(["ddddd"]), String('abcdddddefg'.match(new RegExp('d+'))));
+
+ // 'abcdefg'.match(new RegExp('o+'))
+ testcases[count++] = new TestCase ( SECTION, "'abcdefg'.match(new RegExp('o+'))",
+ null, 'abcdefg'.match(new RegExp('o+')));
+
+ // 'abcdefg'.match(new RegExp('d+'))
+ testcases[count++] = new TestCase ( SECTION, "'abcdefg'.match(new RegExp('d+'))",
+ String(['d']), String('abcdefg'.match(new RegExp('d+'))));
+
+ // 'abbbbbbbc'.match(new RegExp('(b+)(b+)(b+)'))
+ testcases[count++] = new TestCase ( SECTION, "'abbbbbbbc'.match(new RegExp('(b+)(b+)(b+)'))",
+ String(["bbbbbbb","bbbbb","b","b"]), String('abbbbbbbc'.match(new RegExp('(b+)(b+)(b+)'))));
+
+ // 'abbbbbbbc'.match(new RegExp('(b+)(b*)'))
+ testcases[count++] = new TestCase ( SECTION, "'abbbbbbbc'.match(new RegExp('(b+)(b*)'))",
+ String(["bbbbbbb","bbbbbbb",""]), String('abbbbbbbc'.match(new RegExp('(b+)(b*)'))));
+
+ // 'abbbbbbbc'.match(new RegExp('b*b+'))
+ testcases[count++] = new TestCase ( SECTION, "'abbbbbbbc'.match(new RegExp('b*b+'))",
+ String(['bbbbbbb']), String('abbbbbbbc'.match(new RegExp('b*b+'))));
+
+ // 'abbbbbbbc'.match(/(b+)(b*)/)
+ testcases[count++] = new TestCase ( SECTION, "'abbbbbbbc'.match(/(b+)(b*)/)",
+ String(["bbbbbbb","bbbbbbb",""]), String('abbbbbbbc'.match(/(b+)(b*)/)));
+
+ // 'abbbbbbbc'.match(new RegExp('b*b+'))
+ testcases[count++] = new TestCase ( SECTION, "'abbbbbbbc'.match(/b*b+/)",
+ String(['bbbbbbb']), String('abbbbbbbc'.match(/b*b+/)));
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/question_mark.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/question_mark.js
new file mode 100644
index 0000000..f17cd0b
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/question_mark.js
@@ -0,0 +1,99 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: question_mark.js
+ Description: 'Tests regular expressions containing ?'
+
+ Author: Nick Lerissa
+ Date: March 10, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: ?';
+
+ writeHeaderToLog('Executing script: question_mark.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ // 'abcdef'.match(new RegExp('cd?e'))
+ testcases[count++] = new TestCase ( SECTION, "'abcdef'.match(new RegExp('cd?e'))",
+ String(["cde"]), String('abcdef'.match(new RegExp('cd?e'))));
+
+ // 'abcdef'.match(new RegExp('cdx?e'))
+ testcases[count++] = new TestCase ( SECTION, "'abcdef'.match(new RegExp('cdx?e'))",
+ String(["cde"]), String('abcdef'.match(new RegExp('cdx?e'))));
+
+ // 'pqrstuvw'.match(new RegExp('o?pqrst'))
+ testcases[count++] = new TestCase ( SECTION, "'pqrstuvw'.match(new RegExp('o?pqrst'))",
+ String(["pqrst"]), String('pqrstuvw'.match(new RegExp('o?pqrst'))));
+
+ // 'abcd'.match(new RegExp('x?y?z?'))
+ testcases[count++] = new TestCase ( SECTION, "'abcd'.match(new RegExp('x?y?z?'))",
+ String([""]), String('abcd'.match(new RegExp('x?y?z?'))));
+
+ // 'abcd'.match(new RegExp('x?ay?bz?c'))
+ testcases[count++] = new TestCase ( SECTION, "'abcd'.match(new RegExp('x?ay?bz?c'))",
+ String(["abc"]), String('abcd'.match(new RegExp('x?ay?bz?c'))));
+
+ // 'abcd'.match(/x?ay?bz?c/)
+ testcases[count++] = new TestCase ( SECTION, "'abcd'.match(/x?ay?bz?c/)",
+ String(["abc"]), String('abcd'.match(/x?ay?bz?c/)));
+
+ // 'abbbbc'.match(new RegExp('b?b?b?b'))
+ testcases[count++] = new TestCase ( SECTION, "'abbbbc'.match(new RegExp('b?b?b?b'))",
+ String(["bbbb"]), String('abbbbc'.match(new RegExp('b?b?b?b'))));
+
+ // '123az789'.match(new RegExp('ab?c?d?x?y?z'))
+ testcases[count++] = new TestCase ( SECTION, "'123az789'.match(new RegExp('ab?c?d?x?y?z'))",
+ String(["az"]), String('123az789'.match(new RegExp('ab?c?d?x?y?z'))));
+
+ // '123az789'.match(/ab?c?d?x?y?z/)
+ testcases[count++] = new TestCase ( SECTION, "'123az789'.match(/ab?c?d?x?y?z/)",
+ String(["az"]), String('123az789'.match(/ab?c?d?x?y?z/)));
+
+ // '?????'.match(new RegExp('\\??\\??\\??\\??\\??'))
+ testcases[count++] = new TestCase ( SECTION, "'?????'.match(new RegExp('\\??\\??\\??\\??\\??'))",
+ String(["?????"]), String('?????'.match(new RegExp('\\??\\??\\??\\??\\??'))));
+
+ // 'test'.match(new RegExp('.?.?.?.?.?.?.?'))
+ testcases[count++] = new TestCase ( SECTION, "'test'.match(new RegExp('.?.?.?.?.?.?.?'))",
+ String(["test"]), String('test'.match(new RegExp('.?.?.?.?.?.?.?'))));
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/regress-6359.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/regress-6359.js
new file mode 100644
index 0000000..20ac50f
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/regress-6359.js
@@ -0,0 +1,68 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS
+* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+* implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation. All
+* Rights Reserved.
+*
+* Contributor(s):
+*/
+
+/**
+ * File Name: regress-6359.js
+ * Reference: ** replace with bugzilla URL or document reference **
+ * Description: ** replace with description of test **
+ * Author: ** replace with your e-mail address **
+ */
+
+ var SECTION = "js1_2"; // provide a document reference (ie, ECMA section)
+ var VERSION = "ECMA_2"; // Version of JavaScript or ECMA
+ var TITLE = "Regression test for bugzilla # 6359"; // Provide ECMA section title or a description
+ var BUGNUMBER = "http://bugzilla.mozilla.org/show_bug.cgi?id=6359"; // Provide URL to bugsplat or bugzilla report
+
+ startTest(); // leave this alone
+
+ /*
+ * Calls to AddTestCase here. AddTestCase is a function that is defined
+ * in shell.js and takes three arguments:
+ * - a string representation of what is being tested
+ * - the expected result
+ * - the actual result
+ *
+ * For example, a test might look like this:
+ *
+ * var zip = /[\d]{5}$/;
+ *
+ * AddTestCase(
+ * "zip = /[\d]{5}$/; \"PO Box 12345 Boston, MA 02134\".match(zip)", // description of the test
+ * "02134", // expected result
+ * "PO Box 12345 Boston, MA 02134".match(zip) ); // actual result
+ *
+ */
+
+ AddTestCase( '/(a*)b\1+/("baaac").length',
+ 2,
+ /(a*)b\1+/("baaac").length );
+
+ AddTestCase( '/(a*)b\1+/("baaac")[0]',
+ "b",
+ /(a*)b\1+/("baaac")[0]);
+
+ AddTestCase( '/(a*)b\1+/("baaac")[1]',
+ "",
+ /(a*)b\1+/("baaac")[1]);
+
+
+ test(); // leave this alone. this executes the test cases and
+ // displays results.
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/regress-9141.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/regress-9141.js
new file mode 100644
index 0000000..3601bcf
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/regress-9141.js
@@ -0,0 +1,86 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS
+* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+* implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation. All
+* Rights Reserved.
+*
+* Contributor(s):
+*/
+
+/**
+ * File Name: regress-9141.js
+ * Reference: "http://bugzilla.mozilla.org/show_bug.cgi?id=9141";
+ * Description:
+ * From waldemar@netscape.com:
+ *
+ * The following page crashes the system:
+ *
+ * <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
+ * "http://www.w3.org/TR/REC-html40/loose.dtd">
+ * <HTML>
+ * <HEAD>
+ * </HEAD>
+ * <BODY>
+ * <SCRIPT type="text/javascript">
+ * var s = "x";
+ * for (var i = 0; i != 13; i++) s += s;
+ * var a = /(?:xx|x)*[slash](s);
+ * var b = /(xx|x)*[slash](s);
+ * document.write("Results = " + a.length + "," + b.length);
+ * </SCRIPT>
+ * </BODY>
+ */
+
+ var SECTION = "js1_2"; // provide a document reference (ie, ECMA section)
+ var VERSION = "ECMA_2"; // Version of JavaScript or ECMA
+ var TITLE = "Regression test for bugzilla # 9141"; // Provide ECMA section title or a description
+ var BUGNUMBER = "http://bugzilla.mozilla.org/show_bug.cgi?id=9141"; // Provide URL to bugsplat or bugzilla report
+
+ startTest(); // leave this alone
+
+ /*
+ * Calls to AddTestCase here. AddTestCase is a function that is defined
+ * in shell.js and takes three arguments:
+ * - a string representation of what is being tested
+ * - the expected result
+ * - the actual result
+ *
+ * For example, a test might look like this:
+ *
+ * var zip = /[\d]{5}$/;
+ *
+ * AddTestCase(
+ * "zip = /[\d]{5}$/; \"PO Box 12345 Boston, MA 02134\".match(zip)", // description of the test
+ * "02134", // expected result
+ * "PO Box 12345 Boston, MA 02134".match(zip) ); // actual result
+ *
+ */
+
+ var s = "x";
+ for (var i = 0; i != 13; i++) s += s;
+ var a = /(?:xx|x)*/(s);
+ var b = /(xx|x)*/(s);
+
+ AddTestCase( "var s = 'x'; for (var i = 0; i != 13; i++) s += s; " +
+ "a = /(?:xx|x)*/(s); a.length",
+ 1,
+ a.length );
+
+ AddTestCase( "var b = /(xx|x)*/(s); b.length",
+ 2,
+ b.length );
+
+ test(); // leave this alone. this executes the test cases and
+ // displays results.
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/simple_form.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/simple_form.js
new file mode 100644
index 0000000..e369c3e
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/simple_form.js
@@ -0,0 +1,90 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: simple_form.js
+ Description: 'Tests regular expressions using simple form: re(...)'
+
+ Author: Nick Lerissa
+ Date: March 19, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: simple form';
+
+ writeHeaderToLog('Executing script: simple_form.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ testcases[count++] = new TestCase ( SECTION,
+ "/[0-9]{3}/('23 2 34 678 9 09')",
+ String(["678"]), String(/[0-9]{3}/('23 2 34 678 9 09')));
+
+ testcases[count++] = new TestCase ( SECTION,
+ "/3.{4}8/('23 2 34 678 9 09')",
+ String(["34 678"]), String(/3.{4}8/('23 2 34 678 9 09')));
+
+ testcases[count++] = new TestCase ( SECTION,
+ "(/3.{4}8/('23 2 34 678 9 09').length",
+ 1, (/3.{4}8/('23 2 34 678 9 09')).length);
+
+ var re = /[0-9]{3}/;
+ testcases[count++] = new TestCase ( SECTION,
+ "re('23 2 34 678 9 09')",
+ String(["678"]), String(re('23 2 34 678 9 09')));
+
+ re = /3.{4}8/;
+ testcases[count++] = new TestCase ( SECTION,
+ "re('23 2 34 678 9 09')",
+ String(["34 678"]), String(re('23 2 34 678 9 09')));
+
+ testcases[count++] = new TestCase ( SECTION,
+ "/3.{4}8/('23 2 34 678 9 09')",
+ String(["34 678"]), String(/3.{4}8/('23 2 34 678 9 09')));
+
+ re =/3.{4}8/;
+ testcases[count++] = new TestCase ( SECTION,
+ "(re('23 2 34 678 9 09').length",
+ 1, (re('23 2 34 678 9 09')).length);
+
+ testcases[count++] = new TestCase ( SECTION,
+ "(/3.{4}8/('23 2 34 678 9 09').length",
+ 1, (/3.{4}8/('23 2 34 678 9 09')).length);
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/source.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/source.js
new file mode 100644
index 0000000..589d2b9
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/source.js
@@ -0,0 +1,87 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: source.js
+ Description: 'Tests RegExp attribute source'
+
+ Author: Nick Lerissa
+ Date: March 13, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: source';
+
+ writeHeaderToLog('Executing script: source.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ // /xyz/g.source
+ testcases[count++] = new TestCase ( SECTION, "/xyz/g.source",
+ "xyz", /xyz/g.source);
+
+ // /xyz/.source
+ testcases[count++] = new TestCase ( SECTION, "/xyz/.source",
+ "xyz", /xyz/.source);
+
+ // /abc\\def/.source
+ testcases[count++] = new TestCase ( SECTION, "/abc\\\\def/.source",
+ "abc\\\\def", /abc\\def/.source);
+
+ // /abc[\b]def/.source
+ testcases[count++] = new TestCase ( SECTION, "/abc[\\b]def/.source",
+ "abc[\\b]def", /abc[\b]def/.source);
+
+ // (new RegExp('xyz')).source
+ testcases[count++] = new TestCase ( SECTION, "(new RegExp('xyz')).source",
+ "xyz", (new RegExp('xyz')).source);
+
+ // (new RegExp('xyz','g')).source
+ testcases[count++] = new TestCase ( SECTION, "(new RegExp('xyz','g')).source",
+ "xyz", (new RegExp('xyz','g')).source);
+
+ // (new RegExp('abc\\\\def')).source
+ testcases[count++] = new TestCase ( SECTION, "(new RegExp('abc\\\\\\\\def')).source",
+ "abc\\\\def", (new RegExp('abc\\\\def')).source);
+
+ // (new RegExp('abc[\\b]def')).source
+ testcases[count++] = new TestCase ( SECTION, "(new RegExp('abc[\\\\b]def')).source",
+ "abc[\\b]def", (new RegExp('abc[\\b]def')).source);
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/special_characters.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/special_characters.js
new file mode 100644
index 0000000..8675980
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/special_characters.js
@@ -0,0 +1,157 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: special_characters.js
+ Description: 'Tests regular expressions containing special characters'
+
+ Author: Nick Lerissa
+ Date: March 10, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: special_charaters';
+
+ writeHeaderToLog('Executing script: special_characters.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ // testing backslash '\'
+ testcases[count++] = new TestCase ( SECTION, "'^abcdefghi'.match(/\^abc/)", String(["^abc"]), String('^abcdefghi'.match(/\^abc/)));
+
+ // testing beginning of line '^'
+ testcases[count++] = new TestCase ( SECTION, "'abcdefghi'.match(/^abc/)", String(["abc"]), String('abcdefghi'.match(/^abc/)));
+
+ // testing end of line '$'
+ testcases[count++] = new TestCase ( SECTION, "'abcdefghi'.match(/fghi$/)", String(["ghi"]), String('abcdefghi'.match(/ghi$/)));
+
+ // testing repeat '*'
+ testcases[count++] = new TestCase ( SECTION, "'eeeefghi'.match(/e*/)", String(["eeee"]), String('eeeefghi'.match(/e*/)));
+
+ // testing repeat 1 or more times '+'
+ testcases[count++] = new TestCase ( SECTION, "'abcdeeeefghi'.match(/e+/)", String(["eeee"]), String('abcdeeeefghi'.match(/e+/)));
+
+ // testing repeat 0 or 1 time '?'
+ testcases[count++] = new TestCase ( SECTION, "'abcdefghi'.match(/abc?de/)", String(["abcde"]), String('abcdefghi'.match(/abc?de/)));
+
+ // testing any character '.'
+ testcases[count++] = new TestCase ( SECTION, "'abcdefghi'.match(/c.e/)", String(["cde"]), String('abcdefghi'.match(/c.e/)));
+
+ // testing remembering ()
+ testcases[count++] = new TestCase ( SECTION, "'abcewirjskjdabciewjsdf'.match(/(abc).+\\1'/)",
+ String(["abcewirjskjdabc","abc"]), String('abcewirjskjdabciewjsdf'.match(/(abc).+\1/)));
+
+ // testing or match '|'
+ testcases[count++] = new TestCase ( SECTION, "'abcdefghi'.match(/xyz|def/)", String(["def"]), String('abcdefghi'.match(/xyz|def/)));
+
+ // testing repeat n {n}
+ testcases[count++] = new TestCase ( SECTION, "'abcdeeeefghi'.match(/e{3}/)", String(["eee"]), String('abcdeeeefghi'.match(/e{3}/)));
+
+ // testing min repeat n {n,}
+ testcases[count++] = new TestCase ( SECTION, "'abcdeeeefghi'.match(/e{3,}/)", String(["eeee"]), String('abcdeeeefghi'.match(/e{3,}/)));
+
+ // testing min/max repeat {min, max}
+ testcases[count++] = new TestCase ( SECTION, "'abcdeeeefghi'.match(/e{2,8}/)", String(["eeee"]), String('abcdeeeefghi'.match(/e{2,8}/)));
+
+ // testing any in set [abc...]
+ testcases[count++] = new TestCase ( SECTION, "'abcdefghi'.match(/cd[xey]fgh/)", String(["cdefgh"]), String('abcdefghi'.match(/cd[xey]fgh/)));
+
+ // testing any in set [a-z]
+ testcases[count++] = new TestCase ( SECTION, "'netscape inc'.match(/t[r-v]ca/)", String(["tsca"]), String('netscape inc'.match(/t[r-v]ca/)));
+
+ // testing any not in set [^abc...]
+ testcases[count++] = new TestCase ( SECTION, "'abcdefghi'.match(/cd[^xy]fgh/)", String(["cdefgh"]), String('abcdefghi'.match(/cd[^xy]fgh/)));
+
+ // testing any not in set [^a-z]
+ testcases[count++] = new TestCase ( SECTION, "'netscape inc'.match(/t[^a-c]ca/)", String(["tsca"]), String('netscape inc'.match(/t[^a-c]ca/)));
+
+ // testing backspace [\b]
+ testcases[count++] = new TestCase ( SECTION, "'this is b\ba test'.match(/is b[\b]a test/)",
+ String(["is b\ba test"]), String('this is b\ba test'.match(/is b[\b]a test/)));
+
+ // testing word boundary \b
+ testcases[count++] = new TestCase ( SECTION, "'today is now - day is not now'.match(/\bday.*now/)",
+ String(["day is not now"]), String('today is now - day is not now'.match(/\bday.*now/)));
+
+ // control characters???
+
+ // testing any digit \d
+ testcases[count++] = new TestCase ( SECTION, "'a dog - 1 dog'.match(/\d dog/)", String(["1 dog"]), String('a dog - 1 dog'.match(/\d dog/)));
+
+ // testing any non digit \d
+ testcases[count++] = new TestCase ( SECTION, "'a dog - 1 dog'.match(/\D dog/)", String(["a dog"]), String('a dog - 1 dog'.match(/\D dog/)));
+
+ // testing form feed '\f'
+ testcases[count++] = new TestCase ( SECTION, "'a b a\fb'.match(/a\fb/)", String(["a\fb"]), String('a b a\fb'.match(/a\fb/)));
+
+ // testing line feed '\n'
+ testcases[count++] = new TestCase ( SECTION, "'a b a\nb'.match(/a\nb/)", String(["a\nb"]), String('a b a\nb'.match(/a\nb/)));
+
+ // testing carriage return '\r'
+ testcases[count++] = new TestCase ( SECTION, "'a b a\rb'.match(/a\rb/)", String(["a\rb"]), String('a b a\rb'.match(/a\rb/)));
+
+ // testing whitespace '\s'
+ testcases[count++] = new TestCase ( SECTION, "'xa\f\n\r\t\vbz'.match(/a\s+b/)", String(["a\f\n\r\t\vb"]), String('xa\f\n\r\t\vbz'.match(/a\s+b/)));
+
+ // testing non whitespace '\S'
+ testcases[count++] = new TestCase ( SECTION, "'a\tb a b a-b'.match(/a\Sb/)", String(["a-b"]), String('a\tb a b a-b'.match(/a\Sb/)));
+
+ // testing tab '\t'
+ testcases[count++] = new TestCase ( SECTION, "'a\t\tb a b'.match(/a\t{2}/)", String(["a\t\t"]), String('a\t\tb a b'.match(/a\t{2}/)));
+
+ // testing vertical tab '\v'
+ testcases[count++] = new TestCase ( SECTION, "'a\v\vb a b'.match(/a\v{2}/)", String(["a\v\v"]), String('a\v\vb a b'.match(/a\v{2}/)));
+
+ // testing alphnumeric characters '\w'
+ testcases[count++] = new TestCase ( SECTION, "'%AZaz09_$'.match(/\w+/)", String(["AZaz09_"]), String('%AZaz09_$'.match(/\w+/)));
+
+ // testing non alphnumeric characters '\W'
+ testcases[count++] = new TestCase ( SECTION, "'azx$%#@*4534'.match(/\W+/)", String(["$%#@*"]), String('azx$%#@*4534'.match(/\W+/)));
+
+ // testing back references '\<number>'
+ testcases[count++] = new TestCase ( SECTION, "'test'.match(/(t)es\\1/)", String(["test","t"]), String('test'.match(/(t)es\1/)));
+
+ // testing hex excaping with '\'
+ testcases[count++] = new TestCase ( SECTION, "'abcdef'.match(/\x63\x64/)", String(["cd"]), String('abcdef'.match(/\x63\x64/)));
+
+ // testing oct excaping with '\'
+ testcases[count++] = new TestCase ( SECTION, "'abcdef'.match(/\\143\\144/)", String(["cd"]), String('abcdef'.match(/\143\144/)));
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
+
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/string_replace.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/string_replace.js
new file mode 100644
index 0000000..b95ddf3
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/string_replace.js
@@ -0,0 +1,80 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: string_replace.js
+ Description: 'Tests the replace method on Strings using regular expressions'
+
+ Author: Nick Lerissa
+ Date: March 11, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'String: replace';
+
+ writeHeaderToLog('Executing script: string_replace.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ // 'adddb'.replace(/ddd/,"XX")
+ testcases[count++] = new TestCase ( SECTION, "'adddb'.replace(/ddd/,'XX')",
+ "aXXb", 'adddb'.replace(/ddd/,'XX'));
+
+ // 'adddb'.replace(/eee/,"XX")
+ testcases[count++] = new TestCase ( SECTION, "'adddb'.replace(/eee/,'XX')",
+ 'adddb', 'adddb'.replace(/eee/,'XX'));
+
+ // '34 56 78b 12'.replace(new RegExp('[0-9]+b'),'**')
+ testcases[count++] = new TestCase ( SECTION, "'34 56 78b 12'.replace(new RegExp('[0-9]+b'),'**')",
+ "34 56 ** 12", '34 56 78b 12'.replace(new RegExp('[0-9]+b'),'**'));
+
+ // '34 56 78b 12'.replace(new RegExp('[0-9]+c'),'XX')
+ testcases[count++] = new TestCase ( SECTION, "'34 56 78b 12'.replace(new RegExp('[0-9]+c'),'XX')",
+ "34 56 78b 12", '34 56 78b 12'.replace(new RegExp('[0-9]+c'),'XX'));
+
+ // 'original'.replace(new RegExp(),'XX')
+ testcases[count++] = new TestCase ( SECTION, "'original'.replace(new RegExp(),'XX')",
+ "XXoriginal", 'original'.replace(new RegExp(),'XX'));
+
+ // 'qwe ert x\t\n 345654AB'.replace(new RegExp('x\s*\d+(..)$'),'****')
+ testcases[count++] = new TestCase ( SECTION, "'qwe ert x\t\n 345654AB'.replace(new RegExp('x\\s*\\d+(..)$'),'****')",
+ "qwe ert ****", 'qwe ert x\t\n 345654AB'.replace(new RegExp('x\\s*\\d+(..)$'),'****'));
+
+
+function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/string_search.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/string_search.js
new file mode 100644
index 0000000..8d229c6
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/string_search.js
@@ -0,0 +1,87 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: string_search.js
+ Description: 'Tests the search method on Strings using regular expressions'
+
+ Author: Nick Lerissa
+ Date: March 12, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'String: search';
+
+ writeHeaderToLog('Executing script: string_search.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ // 'abcdefg'.search(/d/)
+ testcases[count++] = new TestCase ( SECTION, "'abcdefg'.search(/d/)",
+ 3, 'abcdefg'.search(/d/));
+
+ // 'abcdefg'.search(/x/)
+ testcases[count++] = new TestCase ( SECTION, "'abcdefg'.search(/x/)",
+ -1, 'abcdefg'.search(/x/));
+
+ // 'abcdefg123456hijklmn'.search(/\d+/)
+ testcases[count++] = new TestCase ( SECTION, "'abcdefg123456hijklmn'.search(/\d+/)",
+ 7, 'abcdefg123456hijklmn'.search(/\d+/));
+
+ // 'abcdefg123456hijklmn'.search(new RegExp())
+ testcases[count++] = new TestCase ( SECTION, "'abcdefg123456hijklmn'.search(new RegExp())",
+ 0, 'abcdefg123456hijklmn'.search(new RegExp()));
+
+ // 'abc'.search(new RegExp('$'))
+ testcases[count++] = new TestCase ( SECTION, "'abc'.search(new RegExp('$'))",
+ 3, 'abc'.search(new RegExp('$')));
+
+ // 'abc'.search(new RegExp('^'))
+ testcases[count++] = new TestCase ( SECTION, "'abc'.search(new RegExp('^'))",
+ 0, 'abc'.search(new RegExp('^')));
+
+ // 'abc1'.search(/.\d/)
+ testcases[count++] = new TestCase ( SECTION, "'abc1'.search(/.\d/)",
+ 2, 'abc1'.search(/.\d/));
+
+ // 'abc1'.search(/\d{2}/)
+ testcases[count++] = new TestCase ( SECTION, "'abc1'.search(/\d{2}/)",
+ -1, 'abc1'.search(/\d{2}/));
+
+function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/string_split.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/string_split.js
new file mode 100644
index 0000000..f824998
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/string_split.js
@@ -0,0 +1,91 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: string_split.js
+ Description: 'Tests the split method on Strings using regular expressions'
+
+ Author: Nick Lerissa
+ Date: March 11, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'String: split';
+
+ writeHeaderToLog('Executing script: string_split.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ // 'a b c de f'.split(/\s/)
+ testcases[count++] = new TestCase ( SECTION, "'a b c de f'.split(/\s/)",
+ String(["a","b","c","de","f"]), String('a b c de f'.split(/\s/)));
+
+ // 'a b c de f'.split(/\s/,3)
+ testcases[count++] = new TestCase ( SECTION, "'a b c de f'.split(/\s/,3)",
+ String(["a","b","c"]), String('a b c de f'.split(/\s/,3)));
+
+ // 'a b c de f'.split(/X/)
+ testcases[count++] = new TestCase ( SECTION, "'a b c de f'.split(/X/)",
+ String(["a b c de f"]), String('a b c de f'.split(/X/)));
+
+ // 'dfe23iu 34 =+65--'.split(/\d+/)
+ testcases[count++] = new TestCase ( SECTION, "'dfe23iu 34 =+65--'.split(/\d+/)",
+ String(["dfe","iu "," =+","--"]), String('dfe23iu 34 =+65--'.split(/\d+/)));
+
+ // 'dfe23iu 34 =+65--'.split(new RegExp('\d+'))
+ testcases[count++] = new TestCase ( SECTION, "'dfe23iu 34 =+65--'.split(new RegExp('\\d+'))",
+ String(["dfe","iu "," =+","--"]), String('dfe23iu 34 =+65--'.split(new RegExp('\\d+'))));
+
+ // 'abc'.split(/[a-z]/)
+ testcases[count++] = new TestCase ( SECTION, "'abc'.split(/[a-z]/)",
+ String(["","",""]), String('abc'.split(/[a-z]/)));
+
+ // 'abc'.split(/[a-z]/)
+ testcases[count++] = new TestCase ( SECTION, "'abc'.split(/[a-z]/)",
+ String(["","",""]), String('abc'.split(/[a-z]/)));
+
+ // 'abc'.split(new RegExp('[a-z]'))
+ testcases[count++] = new TestCase ( SECTION, "'abc'.split(new RegExp('[a-z]'))",
+ String(["","",""]), String('abc'.split(new RegExp('[a-z]'))));
+
+ // 'abc'.split(new RegExp('[a-z]'))
+ testcases[count++] = new TestCase ( SECTION, "'abc'.split(new RegExp('[a-z]'))",
+ String(["","",""]), String('abc'.split(new RegExp('[a-z]'))));
+
+function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/test.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/test.js
new file mode 100644
index 0000000..2325af1
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/test.js
@@ -0,0 +1,87 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: test.js
+ Description: 'Tests regular expressions method compile'
+
+ Author: Nick Lerissa
+ Date: March 10, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: test';
+
+ writeHeaderToLog('Executing script: test.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ testcases[count++] = new TestCase ( SECTION,
+ "/[0-9]{3}/.test('23 2 34 678 9 09')",
+ true, /[0-9]{3}/.test('23 2 34 678 9 09'));
+
+ testcases[count++] = new TestCase ( SECTION,
+ "/[0-9]{3}/.test('23 2 34 78 9 09')",
+ false, /[0-9]{3}/.test('23 2 34 78 9 09'));
+
+ testcases[count++] = new TestCase ( SECTION,
+ "/\w+ \w+ \w+/.test('do a test')",
+ true, /\w+ \w+ \w+/.test("do a test"));
+
+ testcases[count++] = new TestCase ( SECTION,
+ "/\w+ \w+ \w+/.test('a test')",
+ false, /\w+ \w+ \w+/.test("a test"));
+
+ testcases[count++] = new TestCase ( SECTION,
+ "(new RegExp('[0-9]{3}')).test('23 2 34 678 9 09')",
+ true, (new RegExp('[0-9]{3}')).test('23 2 34 678 9 09'));
+
+ testcases[count++] = new TestCase ( SECTION,
+ "(new RegExp('[0-9]{3}')).test('23 2 34 78 9 09')",
+ false, (new RegExp('[0-9]{3}')).test('23 2 34 78 9 09'));
+
+ testcases[count++] = new TestCase ( SECTION,
+ "(new RegExp('\\\\w+ \\\\w+ \\\\w+')).test('do a test')",
+ true, (new RegExp('\\w+ \\w+ \\w+')).test("do a test"));
+
+ testcases[count++] = new TestCase ( SECTION,
+ "(new RegExp('\\\\w+ \\\\w+ \\\\w+')).test('a test')",
+ false, (new RegExp('\\w+ \\w+ \\w+')).test("a test"));
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/toString.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/toString.js
new file mode 100644
index 0000000..b08b772
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/toString.js
@@ -0,0 +1,75 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: toString.js
+ Description: 'Tests RegExp method toString'
+
+ Author: Nick Lerissa
+ Date: March 13, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: toString';
+
+ writeHeaderToLog('Executing script: toString.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ // var re = new RegExp(); re.toString()
+ var re = new RegExp();
+ testcases[count++] = new TestCase ( SECTION, "var re = new RegExp(); re.toString()",
+ '/(?:)/', re.toString());
+
+ // re = /.+/; re.toString();
+ re = /.+/;
+ testcases[count++] = new TestCase ( SECTION, "re = /.+/; re.toString()",
+ '/.+/', re.toString());
+
+ // re = /test/gi; re.toString()
+ re = /test/gi;
+ testcases[count++] = new TestCase ( SECTION, "re = /test/gi; re.toString()",
+ '/test/gi', re.toString());
+
+ // re = /test2/ig; re.toString()
+ re = /test2/ig;
+ testcases[count++] = new TestCase ( SECTION, "re = /test2/ig; re.toString()",
+ '/test2/gi', re.toString());
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/vertical_bar.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/vertical_bar.js
new file mode 100644
index 0000000..39b428a
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/vertical_bar.js
@@ -0,0 +1,95 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: vertical_bar.js
+ Description: 'Tests regular expressions containing |'
+
+ Author: Nick Lerissa
+ Date: March 10, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: |';
+
+ writeHeaderToLog('Executing script: vertical_bar.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ // 'abc'.match(new RegExp('xyz|abc'))
+ testcases[count++] = new TestCase ( SECTION, "'abc'.match(new RegExp('xyz|abc'))",
+ String(["abc"]), String('abc'.match(new RegExp('xyz|abc'))));
+
+ // 'this is a test'.match(new RegExp('quiz|exam|test|homework'))
+ testcases[count++] = new TestCase ( SECTION, "'this is a test'.match(new RegExp('quiz|exam|test|homework'))",
+ String(["test"]), String('this is a test'.match(new RegExp('quiz|exam|test|homework'))));
+
+ // 'abc'.match(new RegExp('xyz|...'))
+ testcases[count++] = new TestCase ( SECTION, "'abc'.match(new RegExp('xyz|...'))",
+ String(["abc"]), String('abc'.match(new RegExp('xyz|...'))));
+
+ // 'abc'.match(new RegExp('(.)..|abc'))
+ testcases[count++] = new TestCase ( SECTION, "'abc'.match(new RegExp('(.)..|abc'))",
+ String(["abc","a"]), String('abc'.match(new RegExp('(.)..|abc'))));
+
+ // 'color: grey'.match(new RegExp('.+: gr(a|e)y'))
+ testcases[count++] = new TestCase ( SECTION, "'color: grey'.match(new RegExp('.+: gr(a|e)y'))",
+ String(["color: grey","e"]), String('color: grey'.match(new RegExp('.+: gr(a|e)y'))));
+
+ // 'no match'.match(new RegExp('red|white|blue'))
+ testcases[count++] = new TestCase ( SECTION, "'no match'.match(new RegExp('red|white|blue'))",
+ null, 'no match'.match(new RegExp('red|white|blue')));
+
+ // 'Hi Bob'.match(new RegExp('(Rob)|(Bob)|(Robert)|(Bobby)'))
+ testcases[count++] = new TestCase ( SECTION, "'Hi Bob'.match(new RegExp('(Rob)|(Bob)|(Robert)|(Bobby)'))",
+ String(["Bob",undefined,"Bob", undefined, undefined]), String('Hi Bob'.match(new RegExp('(Rob)|(Bob)|(Robert)|(Bobby)'))));
+
+ // 'abcdef'.match(new RegExp('abc|bcd|cde|def'))
+ testcases[count++] = new TestCase ( SECTION, "'abcdef'.match(new RegExp('abc|bcd|cde|def'))",
+ String(["abc"]), String('abcdef'.match(new RegExp('abc|bcd|cde|def'))));
+
+ // 'Hi Bob'.match(/(Rob)|(Bob)|(Robert)|(Bobby)/)
+ testcases[count++] = new TestCase ( SECTION, "'Hi Bob'.match(/(Rob)|(Bob)|(Robert)|(Bobby)/)",
+ String(["Bob",undefined,"Bob", undefined, undefined]), String('Hi Bob'.match(/(Rob)|(Bob)|(Robert)|(Bobby)/)));
+
+ // 'abcdef'.match(/abc|bcd|cde|def/)
+ testcases[count++] = new TestCase ( SECTION, "'abcdef'.match(/abc|bcd|cde|def/)",
+ String(["abc"]), String('abcdef'.match(/abc|bcd|cde|def/)));
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/whitespace.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/whitespace.js
new file mode 100644
index 0000000..40c78c3
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/whitespace.js
@@ -0,0 +1,122 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: whitespace.js
+ Description: 'Tests regular expressions containing \f\n\r\t\v\s\S\ '
+
+ Author: Nick Lerissa
+ Date: March 10, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: \\f\\n\\r\\t\\v\\s\\S ';
+
+ writeHeaderToLog('Executing script: whitespace.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ var non_whitespace = "_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ~`!@#$%^&*()-+={[}]|\\:;'<,>./?1234567890" + '"';
+ var whitespace = "\f\n\r\t\v ";
+
+ // be sure all whitespace is matched by \s
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + whitespace + "'.match(new RegExp('\\s+'))",
+ String([whitespace]), String(whitespace.match(new RegExp('\\s+'))));
+
+ // be sure all non-whitespace is matched by \S
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + non_whitespace + "'.match(new RegExp('\\S+'))",
+ String([non_whitespace]), String(non_whitespace.match(new RegExp('\\S+'))));
+
+ // be sure all non-whitespace is not matched by \s
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + non_whitespace + "'.match(new RegExp('\\s'))",
+ null, non_whitespace.match(new RegExp('\\s')));
+
+ // be sure all whitespace is not matched by \S
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + whitespace + "'.match(new RegExp('\\S'))",
+ null, whitespace.match(new RegExp('\\S')));
+
+ var s = non_whitespace + whitespace;
+
+ // be sure all digits are matched by \s
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + s + "'.match(new RegExp('\\s+'))",
+ String([whitespace]), String(s.match(new RegExp('\\s+'))));
+
+ s = whitespace + non_whitespace;
+
+ // be sure all non-whitespace are matched by \S
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + s + "'.match(new RegExp('\\S+'))",
+ String([non_whitespace]), String(s.match(new RegExp('\\S+'))));
+
+ // '1233345find me345'.match(new RegExp('[a-z\\s][a-z\\s]+'))
+ testcases[count++] = new TestCase ( SECTION, "'1233345find me345'.match(new RegExp('[a-z\\s][a-z\\s]+'))",
+ String(["find me"]), String('1233345find me345'.match(new RegExp('[a-z\\s][a-z\\s]+'))));
+
+ var i;
+
+ // be sure all whitespace characters match individually
+ for (i = 0; i < whitespace.length; ++i)
+ {
+ s = 'ab' + whitespace[i] + 'cd';
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + s + "'.match(new RegExp('\\\\s'))",
+ String([whitespace[i]]), String(s.match(new RegExp('\\s'))));
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + s + "'.match(/\s/)",
+ String([whitespace[i]]), String(s.match(/\s/)));
+ }
+ // be sure all non_whitespace characters match individually
+ for (i = 0; i < non_whitespace.length; ++i)
+ {
+ s = ' ' + non_whitespace[i] + ' ';
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + s + "'.match(new RegExp('\\\\S'))",
+ String([non_whitespace[i]]), String(s.match(new RegExp('\\S'))));
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + s + "'.match(/\S/)",
+ String([non_whitespace[i]]), String(s.match(/\S/)));
+ }
+
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/word_boundary.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/word_boundary.js
new file mode 100644
index 0000000..581499c
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/word_boundary.js
@@ -0,0 +1,119 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: word_boundary.js
+ Description: 'Tests regular expressions containing \b and \B'
+
+ Author: Nick Lerissa
+ Date: March 10, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'RegExp: \\b and \\B';
+
+ writeHeaderToLog('Executing script: word_boundary.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ // 'cowboy boyish boy'.match(new RegExp('\bboy\b'))
+ testcases[count++] = new TestCase ( SECTION, "'cowboy boyish boy'.match(new RegExp('\\bboy\\b'))",
+ String(["boy"]), String('cowboy boyish boy'.match(new RegExp('\\bboy\\b'))));
+
+ var boundary_characters = "\f\n\r\t\v~`!@#$%^&*()-+={[}]|\\:;'<,>./? " + '"';
+ var non_boundary_characters = '1234567890_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
+ var s = '';
+ var i;
+
+ // testing whether all boundary characters are matched when they should be
+ for (i = 0; i < boundary_characters.length; ++i)
+ {
+ s = '123ab' + boundary_characters.charAt(i) + '123c' + boundary_characters.charAt(i);
+
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + s + "'.match(new RegExp('\\b123[a-z]\\b'))",
+ String(["123c"]), String(s.match(new RegExp('\\b123[a-z]\\b'))));
+ }
+
+ // testing whether all non-boundary characters are matched when they should be
+ for (i = 0; i < non_boundary_characters.length; ++i)
+ {
+ s = '123ab' + non_boundary_characters.charAt(i) + '123c' + non_boundary_characters.charAt(i);
+
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + s + "'.match(new RegExp('\\B123[a-z]\\B'))",
+ String(["123c"]), String(s.match(new RegExp('\\B123[a-z]\\B'))));
+ }
+
+ s = '';
+
+ // testing whether all boundary characters are not matched when they should not be
+ for (i = 0; i < boundary_characters.length; ++i)
+ {
+ s += boundary_characters[i] + "a" + i + "b";
+ }
+ s += "xa1111bx";
+
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + s + "'.match(new RegExp('\\Ba\\d+b\\B'))",
+ String(["a1111b"]), String(s.match(new RegExp('\\Ba\\d+b\\B'))));
+
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + s + "'.match(/\\Ba\\d+b\\B/)",
+ String(["a1111b"]), String(s.match(/\Ba\d+b\B/)));
+
+ s = '';
+
+ // testing whether all non-boundary characters are not matched when they should not be
+ for (i = 0; i < non_boundary_characters.length; ++i)
+ {
+ s += non_boundary_characters[i] + "a" + i + "b";
+ }
+ s += "(a1111b)";
+
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + s + "'.match(new RegExp('\\ba\\d+b\\b'))",
+ String(["a1111b"]), String(s.match(new RegExp('\\ba\\d+b\\b'))));
+
+ testcases[count++] = new TestCase ( SECTION,
+ "'" + s + "'.match(/\\ba\\d+b\\b/)",
+ String(["a1111b"]), String(s.match(/\ba\d+b\b/)));
+
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regress/regress-144834.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regress/regress-144834.js
new file mode 100644
index 0000000..cfbfc1b
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regress/regress-144834.js
@@ -0,0 +1,76 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2002
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): bzbarsky@mit.edu, pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 05 July 2002
+* SUMMARY: Testing local var having same name as switch label inside function
+*
+* The code below crashed while compiling in JS1.1 or JS1.2
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=144834
+*
+*/
+//-----------------------------------------------------------------------------
+var bug = 144834;
+var summary = 'Local var having same name as switch label inside function';
+
+print(bug);
+print(summary);
+
+
+function RedrawSched()
+{
+ var MinBound;
+
+ switch (i)
+ {
+ case MinBound :
+ }
+}
+
+
+/*
+ * Also try eval scope -
+ */
+var s = '';
+s += 'function RedrawSched()';
+s += '{';
+s += ' var MinBound;';
+s += '';
+s += ' switch (i)';
+s += ' {';
+s += ' case MinBound :';
+s += ' }';
+s += '}';
+eval(s);
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/regress/regress-7703.js b/Source/JavaScriptCore/tests/mozilla/js1_2/regress/regress-7703.js
new file mode 100644
index 0000000..7808d9b
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/regress/regress-7703.js
@@ -0,0 +1,83 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS
+* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+* implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation. All
+* Rights Reserved.
+*
+* Contributor(s):
+*/
+
+/**
+ * File Name: regress-7703.js
+ * Reference: "http://bugzilla.mozilla.org/show_bug.cgi?id=7703";
+ * Description: See the text of the bugnumber above
+ */
+
+ var SECTION = "js1_2"; // provide a document reference (ie, ECMA section)
+ var VERSION = "JS1_2"; // Version of JavaScript or ECMA
+ var TITLE = "Regression test for bugzilla # 7703"; // Provide ECMA section title or a description
+ var BUGNUMBER = "http://bugzilla.mozilla.org/show_bug.cgi?id=7703"; // Provide URL to bugsplat or bugzilla report
+
+ startTest(); // leave this alone
+
+ /*
+ * Calls to AddTestCase here. AddTestCase is a function that is defined
+ * in shell.js and takes three arguments:
+ * - a string representation of what is being tested
+ * - the expected result
+ * - the actual result
+ *
+ * For example, a test might look like this:
+ *
+ * var zip = /[\d]{5}$/;
+ *
+ * AddTestCase(
+ * "zip = /[\d]{5}$/; \"PO Box 12345 Boston, MA 02134\".match(zip)", // description of the test
+ * "02134", // expected result
+ * "PO Box 12345 Boston, MA 02134".match(zip) ); // actual result
+ *
+ */
+
+ types = [];
+ function inspect(object) {
+ for (prop in object) {
+ var x = object[prop];
+ types[types.length] = (typeof x);
+ }
+ }
+
+ var o = {a: 1, b: 2};
+ inspect(o);
+
+ AddTestCase( "inspect(o),length", 2, types.length );
+ AddTestCase( "inspect(o)[0]", "number", types[0] );
+ AddTestCase( "inspect(o)[1]", "number", types[1] );
+
+ types_2 = [];
+
+ function inspect_again(object) {
+ for (prop in object) {
+ types_2[types_2.length] = (typeof object[prop]);
+ }
+ }
+
+ inspect_again(o);
+ AddTestCase( "inspect_again(o),length", 2, types.length );
+ AddTestCase( "inspect_again(o)[0]", "number", types[0] );
+ AddTestCase( "inspect_again(o)[1]", "number", types[1] );
+
+
+ test(); // leave this alone. this executes the test cases and
+ // displays results.
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/shell.js b/Source/JavaScriptCore/tests/mozilla/js1_2/shell.js
new file mode 100644
index 0000000..ba57d61
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/shell.js
@@ -0,0 +1,147 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+var completed = false;
+var testcases;
+
+var SECTION = "";
+var VERSION = "";
+var BUGNUMBER = "";
+
+var GLOBAL = "[object global]";
+var PASSED = " PASSED!"
+var FAILED = " FAILED! expected: ";
+
+startTest();
+
+ version(120);
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+/* wrapper for test cas constructor that doesn't require the SECTION
+ * argument.
+ */
+
+function AddTestCase( description, expect, actual ) {
+ testcases[tc++] = new TestCase( SECTION, description, expect, actual );
+}
+
+
+function TestCase( n, d, e, a ) {
+ this.name = n;
+ this.description = d;
+ this.expect = e;
+ this.actual = a;
+ this.passed = true;
+ this.reason = "";
+
+ this.passed = getTestCaseResult( this.expect, this.actual );
+}
+function startTest() {
+ version(120);
+
+ if ( BUGNUMBER ) {
+ writeLineToLog ("BUGNUMBER: " + BUGNUMBER );
+ }
+
+ testcases = new Array();
+ tc = 0;
+}
+function getTestCaseResult( expect, actual ) {
+ // because ( NaN == NaN ) always returns false, need to do
+ // a special compare to see if we got the right result.
+ if ( actual != actual ) {
+ if ( typeof actual == "object" ) {
+ actual = "NaN object";
+ } else {
+ actual = "NaN number";
+ }
+ }
+ if ( expect != expect ) {
+ if ( typeof expect == "object" ) {
+ expect = "NaN object";
+ } else {
+ expect = "NaN number";
+ }
+ }
+
+ var passed = ( expect == actual ) ? true : false;
+
+ // if both objects are numbers, give a little leeway for rounding.
+ if ( !passed
+ && typeof(actual) == "number"
+ && typeof(expect) == "number"
+ ) {
+ if ( Math.abs(actual-expect) < 0.0000001 ) {
+ passed = true;
+ }
+ }
+
+ // verify type is the same
+ if ( typeof(expect) != typeof(actual) ) {
+ passed = false;
+ }
+
+ return passed;
+}
+/*
+ * Begin printing functions. These functions use the shell's
+ * print function. When running tests in the browser, these
+ * functions, override these functions with functions that use
+ * document.write.
+ */
+
+function writeTestCaseResult( expect, actual, string ) {
+ var passed = getTestCaseResult( expect, actual );
+ writeFormattedResult( expect, actual, string, passed );
+ return passed;
+}
+function writeFormattedResult( expect, actual, string, passed ) {
+ var s = string ;
+ s += ( passed ) ? PASSED : FAILED + expect;
+ writeLineToLog( s);
+ return passed;
+}
+function writeLineToLog( string ) {
+ print( string );
+}
+function writeHeaderToLog( string ) {
+ print( string );
+}
+/* end of print functions */
+
+function stopTest() {
+ var gc;
+ if ( gc != undefined ) {
+ gc();
+ }
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/statements/break.js b/Source/JavaScriptCore/tests/mozilla/js1_2/statements/break.js
new file mode 100644
index 0000000..ffe177d
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/statements/break.js
@@ -0,0 +1,162 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: break.js
+ Description: 'Tests the break statement'
+
+ Author: Nick Lerissa
+ Date: March 18, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'statements: break';
+
+ writeHeaderToLog("Executing script: break.js");
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ var i,j;
+
+ for (i = 0; i < 1000; i++)
+ {
+ if (i == 100) break;
+ }
+
+ // 'breaking out of "for" loop'
+ testcases[count++] = new TestCase ( SECTION, 'breaking out of "for" loop',
+ 100, i);
+
+ j = 2000;
+
+ out1:
+ for (i = 0; i < 1000; i++)
+ {
+ if (i == 100)
+ {
+ out2:
+ for (j = 0; j < 1000; j++)
+ {
+ if (j == 500) break out1;
+ }
+ j = 2001;
+ }
+ j = 2002;
+ }
+
+ // 'breaking out of a "for" loop with a "label"'
+ testcases[count++] = new TestCase ( SECTION, 'breaking out of a "for" loop with a "label"',
+ 500, j);
+
+ i = 0;
+
+ while (i < 1000)
+ {
+ if (i == 100) break;
+ i++;
+ }
+
+ // 'breaking out of a "while" loop'
+ testcases[count++] = new TestCase ( SECTION, 'breaking out of a "while" loop',
+ 100, i );
+
+
+ j = 2000;
+ i = 0;
+
+ out3:
+ while (i < 1000)
+ {
+ if (i == 100)
+ {
+ j = 0;
+ out4:
+ while (j < 1000)
+ {
+ if (j == 500) break out3;
+ j++;
+ }
+ j = 2001;
+ }
+ j = 2002;
+ i++;
+ }
+
+ // 'breaking out of a "while" loop with a "label"'
+ testcases[count++] = new TestCase ( SECTION, 'breaking out of a "while" loop with a "label"',
+ 500, j);
+
+ i = 0;
+
+ do
+ {
+ if (i == 100) break;
+ i++;
+ } while (i < 1000);
+
+ // 'breaking out of a "do" loop'
+ testcases[count++] = new TestCase ( SECTION, 'breaking out of a "do" loop',
+ 100, i );
+
+ j = 2000;
+ i = 0;
+
+ out5:
+ do
+ {
+ if (i == 100)
+ {
+ j = 0;
+ out6:
+ do
+ {
+ if (j == 500) break out5;
+ j++;
+ }while (j < 1000);
+ j = 2001;
+ }
+ j = 2002;
+ i++;
+ }while (i < 1000);
+
+ // 'breaking out of a "do" loop with a "label"'
+ testcases[count++] = new TestCase ( SECTION, 'breaking out of a "do" loop with a "label"',
+ 500, j);
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/statements/continue.js b/Source/JavaScriptCore/tests/mozilla/js1_2/statements/continue.js
new file mode 100644
index 0000000..e27b9df
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/statements/continue.js
@@ -0,0 +1,175 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: continue.js
+ Description: 'Tests the continue statement'
+
+ Author: Nick Lerissa
+ Date: March 18, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'statements: continue';
+
+ writeHeaderToLog("Executing script: continue.js");
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ var i,j;
+
+ j = 0;
+ for (i = 0; i < 200; i++)
+ {
+ if (i == 100)
+ continue;
+ j++;
+ }
+
+ // '"continue" in a "for" loop'
+ testcases[count++] = new TestCase ( SECTION, '"continue" in "for" loop',
+ 199, j);
+
+
+ j = 0;
+ out1:
+ for (i = 0; i < 1000; i++)
+ {
+ if (i == 100)
+ {
+ out2:
+ for (var k = 0; k < 1000; k++)
+ {
+ if (k == 500) continue out1;
+ }
+ j = 3000;
+ }
+ j++;
+ }
+
+ // '"continue" in a "for" loop with a "label"'
+ testcases[count++] = new TestCase ( SECTION, '"continue" in "for" loop with a "label"',
+ 999, j);
+
+ i = 0;
+ j = 1;
+
+ while (i != j)
+ {
+ i++;
+ if (i == 100) continue;
+ j++;
+ }
+
+ // '"continue" in a "while" loop'
+ testcases[count++] = new TestCase ( SECTION, '"continue" in a "while" loop',
+ 100, j );
+
+ j = 0;
+ i = 0;
+ out3:
+ while (i < 1000)
+ {
+ if (i == 100)
+ {
+ var k = 0;
+ out4:
+ while (k < 1000)
+ {
+ if (k == 500)
+ {
+ i++;
+ continue out3;
+ }
+ k++;
+ }
+ j = 3000;
+ }
+ j++;
+ i++;
+ }
+
+ // '"continue" in a "while" loop with a "label"'
+ testcases[count++] = new TestCase ( SECTION, '"continue" in a "while" loop with a "label"',
+ 999, j);
+
+ i = 0;
+ j = 1;
+
+ do
+ {
+ i++;
+ if (i == 100) continue;
+ j++;
+ } while (i != j);
+
+
+ // '"continue" in a "do" loop'
+ testcases[count++] = new TestCase ( SECTION, '"continue" in a "do" loop',
+ 100, j );
+
+ j = 0;
+ i = 0;
+ out5:
+ do
+ {
+ if (i == 100)
+ {
+ var k = 0;
+ out6:
+ do
+ {
+ if (k == 500)
+ {
+ i++;
+ continue out5;
+ }
+ k++;
+ }while (k < 1000);
+ j = 3000;
+ }
+ j++;
+ i++;
+ }while (i < 1000);
+
+ // '"continue" in a "do" loop with a "label"'
+ testcases[count++] = new TestCase ( SECTION, '"continue" in a "do" loop with a "label"',
+ 999, j);
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/statements/do_while.js b/Source/JavaScriptCore/tests/mozilla/js1_2/statements/do_while.js
new file mode 100644
index 0000000..d54ac78
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/statements/do_while.js
@@ -0,0 +1,68 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: do_while.js
+ Description: 'This tests the new do_while loop'
+
+ Author: Nick Lerissa
+ Date: Fri Feb 13 09:58:28 PST 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'statements: do_while';
+
+ writeHeaderToLog('Executing script: do_while.js');
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+
+ var done = false;
+ var x = 0;
+ do
+ {
+ if (x++ == 3) done = true;
+ } while (!done);
+
+ testcases[count++] = new TestCase( SECTION, "do_while ",
+ 4, x);
+
+ //load('d:/javascript/tests/output/statements/do_while.js')
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
+
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/statements/switch.js b/Source/JavaScriptCore/tests/mozilla/js1_2/statements/switch.js
new file mode 100644
index 0000000..f6678c5
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/statements/switch.js
@@ -0,0 +1,127 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: switch.js
+ Description: 'Tests the switch statement'
+
+ http://scopus.mcom.com/bugsplat/show_bug.cgi?id=323696
+
+ Author: Nick Lerissa
+ Date: March 19, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'statements: switch';
+ var BUGNUMBER="323696";
+
+ writeHeaderToLog("Executing script: switch.js");
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ var var1 = "match string";
+ var match1 = false;
+ var match2 = false;
+ var match3 = false;
+
+ switch (var1)
+ {
+ case "match string":
+ match1 = true;
+ case "bad string 1":
+ match2 = true;
+ break;
+ case "bad string 2":
+ match3 = true;
+ }
+
+ testcases[count++] = new TestCase ( SECTION, 'switch statement',
+ true, match1);
+
+ testcases[count++] = new TestCase ( SECTION, 'switch statement',
+ true, match2);
+
+ testcases[count++] = new TestCase ( SECTION, 'switch statement',
+ false, match3);
+
+ var var2 = 3;
+
+ var match1 = false;
+ var match2 = false;
+ var match3 = false;
+ var match4 = false;
+ var match5 = false;
+
+ switch (var2)
+ {
+ case 1:
+/* switch (var1)
+ {
+ case "foo":
+ match1 = true;
+ break;
+ case 3:
+ match2 = true;
+ break;
+ }*/
+ match3 = true;
+ break;
+ case 2:
+ match4 = true;
+ break;
+ case 3:
+ match5 = true;
+ break;
+ }
+ testcases[count++] = new TestCase ( SECTION, 'switch statement',
+ false, match1);
+
+ testcases[count++] = new TestCase ( SECTION, 'switch statement',
+ false, match2);
+
+ testcases[count++] = new TestCase ( SECTION, 'switch statement',
+ false, match3);
+
+ testcases[count++] = new TestCase ( SECTION, 'switch statement',
+ false, match4);
+
+ testcases[count++] = new TestCase ( SECTION, 'switch statement',
+ true, match5);
+
+ function test()
+ {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/statements/switch2.js b/Source/JavaScriptCore/tests/mozilla/js1_2/statements/switch2.js
new file mode 100644
index 0000000..5d35f8c
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/statements/switch2.js
@@ -0,0 +1,188 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ Filename: switch2.js
+ Description: 'Tests the switch statement'
+
+ http://scopus.mcom.com/bugsplat/show_bug.cgi?id=323696
+
+ Author: Norris Boyd
+ Date: July 31, 1998
+*/
+
+ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
+ var VERSION = 'no version';
+ startTest();
+ var TITLE = 'statements: switch';
+ var BUGNUMBER="323626";
+
+ writeHeaderToLog("Executing script: switch2.js");
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var count = 0;
+ var testcases = new Array();
+
+ // test defaults not at the end; regression test for a bug that
+ // nearly made it into 4.06
+ function f0(i) {
+ switch(i) {
+ default:
+ case "a":
+ case "b":
+ return "ab*"
+ case "c":
+ return "c";
+ case "d":
+ return "d";
+ }
+ return "";
+ }
+ testcases[count++] = new TestCase(SECTION, 'switch statement',
+ f0("a"), "ab*");
+
+ testcases[count++] = new TestCase(SECTION, 'switch statement',
+ f0("b"), "ab*");
+
+ testcases[count++] = new TestCase(SECTION, 'switch statement',
+ f0("*"), "ab*");
+
+ testcases[count++] = new TestCase(SECTION, 'switch statement',
+ f0("c"), "c");
+
+ testcases[count++] = new TestCase(SECTION, 'switch statement',
+ f0("d"), "d");
+
+ function f1(i) {
+ switch(i) {
+ case "a":
+ case "b":
+ default:
+ return "ab*"
+ case "c":
+ return "c";
+ case "d":
+ return "d";
+ }
+ return "";
+ }
+
+ testcases[count++] = new TestCase(SECTION, 'switch statement',
+ f1("a"), "ab*");
+
+ testcases[count++] = new TestCase(SECTION, 'switch statement',
+ f1("b"), "ab*");
+
+ testcases[count++] = new TestCase(SECTION, 'switch statement',
+ f1("*"), "ab*");
+
+ testcases[count++] = new TestCase(SECTION, 'switch statement',
+ f1("c"), "c");
+
+ testcases[count++] = new TestCase(SECTION, 'switch statement',
+ f1("d"), "d");
+
+ // Switch on integer; will use TABLESWITCH opcode in C engine
+ function f2(i) {
+ switch (i) {
+ case 0:
+ case 1:
+ return 1;
+ case 2:
+ return 2;
+ }
+ // with no default, control will fall through
+ return 3;
+ }
+
+ testcases[count++] = new TestCase(SECTION, 'switch statement',
+ f2(0), 1);
+
+ testcases[count++] = new TestCase(SECTION, 'switch statement',
+ f2(1), 1);
+
+ testcases[count++] = new TestCase(SECTION, 'switch statement',
+ f2(2), 2);
+
+ testcases[count++] = new TestCase(SECTION, 'switch statement',
+ f2(3), 3);
+
+ // empty switch: make sure expression is evaluated
+ var se = 0;
+ switch (se = 1) {
+ }
+ testcases[count++] = new TestCase(SECTION, 'switch statement',
+ se, 1);
+
+ // only default
+ se = 0;
+ switch (se) {
+ default:
+ se = 1;
+ }
+ testcases[count++] = new TestCase(SECTION, 'switch statement',
+ se, 1);
+
+ // in loop, break should only break out of switch
+ se = 0;
+ for (var i=0; i < 2; i++) {
+ switch (i) {
+ case 0:
+ case 1:
+ break;
+ }
+ se = 1;
+ }
+ testcases[count++] = new TestCase(SECTION, 'switch statement',
+ se, 1);
+
+ // test "fall through"
+ se = 0;
+ i = 0;
+ switch (i) {
+ case 0:
+ se++;
+ /* fall through */
+ case 1:
+ se++;
+ break;
+ }
+ testcases[count++] = new TestCase(SECTION, 'switch statement',
+ se, 2);
+
+ test();
+
+ // Needed: tests for evaluation time of case expressions.
+ // This issue was under debate at ECMA, so postponing for now.
+
+ function test() {
+ writeLineToLog("hi");
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+ }
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/version120/boolean-001.js b/Source/JavaScriptCore/tests/mozilla/js1_2/version120/boolean-001.js
new file mode 100644
index 0000000..55fafe4
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/version120/boolean-001.js
@@ -0,0 +1,73 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ * File Name: boolean-001.js
+ * Description:
+ *
+ * In JavaScript 1.2, new Boolean(false) evaluates to false.
+ *
+ * Author: christine@netscape.com
+ * Date: 11 August 1998
+ */
+ var SECTION = "boolean-001.js";
+ var VERSION = "JS1_2";
+ startTest();
+ var TITLE = "new Boolean(false) should evaluate to false";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ BooleanTest( "new Boolean(true)", new Boolean(true), true );
+ BooleanTest( "new Boolean(false)", new Boolean(false), false );
+ BooleanTest( "true", true, true );
+ BooleanTest( "false", false, false );
+
+ test();
+
+function BooleanTest( string, object, expect ) {
+ if ( object ) {
+ result = true;
+ } else {
+ result = false;
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ string,
+ expect,
+ result );
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/version120/regress-99663.js b/Source/JavaScriptCore/tests/mozilla/js1_2/version120/regress-99663.js
new file mode 100644
index 0000000..75131ee
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/version120/regress-99663.js
@@ -0,0 +1,172 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS
+* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+* implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation.
+* All Rights Reserved.
+*
+* Contributor(s): brendan@mozilla.org, pschwartau@netscape.com
+* Date: 09 October 2001
+*
+* SUMMARY: Regression test for Bugzilla bug 99663
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=99663
+*
+*******************************************************************************
+*******************************************************************************
+* ESSENTIAL!: this test should contain, or be loaded after, a call to
+*
+* version(120);
+*
+* Only JS version 1.2 or less has the behavior we're expecting here -
+*
+* Brendan: "The JS_SetVersion stickiness is necessary for tests such as
+* this one to work properly. I think the existing js/tests have been lucky
+* in dodging the buggy way that JS_SetVersion's effect can be undone by
+* function return."
+*
+* Note: it is the function statements for f1(), etc. that MUST be compiled
+* in JS version 1.2 or less for the test to pass -
+*
+*******************************************************************************
+*******************************************************************************
+*
+*
+* NOTE: the test uses the |it| object of SpiderMonkey; don't run it in Rhino -
+*
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 99663;
+var summary = 'Regression test for Bugzilla bug 99663';
+/*
+ * This testcase expects error messages containing
+ * the phrase 'read-only' or something similar -
+ */
+var READONLY = /read\s*-?\s*only/;
+var READONLY_TRUE = 'a "read-only" error';
+var READONLY_FALSE = 'Error: ';
+var FAILURE = 'NO ERROR WAS GENERATED!';
+var status = '';
+var actual = '';
+var expect= '';
+var statusitems = [];
+var expectedvalues = [];
+var actualvalues = [];
+
+
+/*
+ * These MUST be compiled in JS1.2 or less for the test to work - see above
+ */
+function f1()
+{
+ with (it)
+ {
+ for (rdonly in this);
+ }
+}
+
+
+function f2()
+{
+ for (it.rdonly in this);
+}
+
+
+function f3(s)
+{
+ for (it[s] in this);
+}
+
+
+
+/*
+ * Begin testing by capturing actual vs. expected values.
+ * Initialize to FAILURE; this will get reset if all goes well -
+ */
+actual = FAILURE;
+try
+{
+ f1();
+}
+catch(e)
+{
+ actual = readOnly(e.message);
+}
+expect= READONLY_TRUE;
+status = 'Section 1 of test - got ' + actual;
+addThis();
+
+
+actual = FAILURE;
+try
+{
+ f2();
+}
+catch(e)
+{
+ actual = readOnly(e.message);
+}
+expect= READONLY_TRUE;
+status = 'Section 2 of test - got ' + actual;
+addThis();
+
+
+actual = FAILURE;
+try
+{
+ f3('rdonly');
+}
+catch(e)
+{
+ actual = readOnly(e.message);
+}
+expect= READONLY_TRUE;
+status = 'Section 3 of test - got ' + actual;
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function readOnly(msg)
+{
+ if (msg.match(READONLY))
+ return READONLY_TRUE;
+ return READONLY_FALSE + msg;
+}
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ writeLineToLog ('Bug Number ' + bug);
+ writeLineToLog ('STATUS: ' + summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ writeTestCaseResult(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_2/version120/shell.js b/Source/JavaScriptCore/tests/mozilla/js1_2/version120/shell.js
new file mode 100644
index 0000000..e453344
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_2/version120/shell.js
@@ -0,0 +1,24 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS
+* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+* implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation. All
+* Rights Reserved.
+*
+* Contributor(s):
+*/
+
+/* all files in this dir need version(120) called before they are *loaded* */
+
+version(120); \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_3/Boolean/boolean-001.js b/Source/JavaScriptCore/tests/mozilla/js1_3/Boolean/boolean-001.js
new file mode 100644
index 0000000..991730d
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_3/Boolean/boolean-001.js
@@ -0,0 +1,73 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ * File Name: boolean-001.js
+ * Description:
+ *
+ * In JavaScript 1.2, new Boolean(false) evaluates to false.
+ *
+ * Author: christine@netscape.com
+ * Date: 11 August 1998
+ */
+ var SECTION = "boolean-001.js";
+ var VERSION = "JS_1.3";
+ var TITLE = "new Boolean(false) should evaluate to false";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ BooleanTest( "new Boolean(true)", new Boolean(true), true );
+ BooleanTest( "new Boolean(false)", new Boolean(false), true );
+ BooleanTest( "true", true, true );
+ BooleanTest( "false", false, false );
+
+ test();
+
+function BooleanTest( string, object, expect ) {
+ if ( object ) {
+ result = true;
+ } else {
+ result = false;
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ string,
+ expect,
+ result );
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_3/Script/delete-001.js b/Source/JavaScriptCore/tests/mozilla/js1_3/Script/delete-001.js
new file mode 100644
index 0000000..e2f4332
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_3/Script/delete-001.js
@@ -0,0 +1,79 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: delete-001.js
+ Section: regress
+ Description:
+
+ Regression test for
+ http://scopus.mcom.com/bugsplat/show_bug.cgi?id=108736
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "JS1_2";
+ var VERSION = "JS1_2";
+ var TITLE = "The variable statment";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ // delete all properties of the global object
+ // per ecma, this does not affect variables in the global object declared
+ // with var or functions
+
+ for ( p in this ) {
+ delete p;
+ }
+
+ var result ="";
+
+ for ( p in this ) {
+ result += String( p );
+ }
+
+ // not too picky here... just want to make sure we didn't crash or something
+
+ testcases[testcases.length] = new TestCase( SECTION,
+ "delete all properties of the global object",
+ "PASSED",
+ result == "" ? "FAILED" : "PASSED" );
+
+
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_3/Script/function-001-n.js b/Source/JavaScriptCore/tests/mozilla/js1_3/Script/function-001-n.js
new file mode 100644
index 0000000..5b4add0
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_3/Script/function-001-n.js
@@ -0,0 +1,74 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ * File Name: boolean-001.js
+ * Description:
+ *
+ * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=99232
+ *
+ * eval("function f(){}function g(){}") at top level is an error for JS1.2
+ * and above (missing ; between named function expressions), but declares f
+ * and g as functions below 1.2.
+ *
+ * Fails to produce error regardless of version:
+ * js> version(100)
+ * 120
+ * js> eval("function f(){}function g(){}")
+ * js> version(120);
+ * 100
+ * js> eval("function f(){}function g(){}")
+ * js>
+ * Author: christine@netscape.com
+ * Date: 11 August 1998
+ */
+ var SECTION = "function-001.js";
+ var VERSION = "JS_1.3";
+ var TITLE = "functions not separated by semicolons are errors in version 120 and higher";
+ var BUGNUMBER="10278";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "eval(\"function f(){}function g(){}\")",
+ "error",
+ eval("function f(){}function g(){}") );
+
+ test();
+
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_3/Script/function-002.js b/Source/JavaScriptCore/tests/mozilla/js1_3/Script/function-002.js
new file mode 100644
index 0000000..d3d1d85
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_3/Script/function-002.js
@@ -0,0 +1,75 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: function-002.js
+ Section:
+ Description:
+
+ http://scopus.mcom.com/bugsplat/show_bug.cgi?id=249579
+
+ function definitions in conditional statements should be allowed.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "function-002";
+ var VERSION = "JS1_3";
+ var TITLE = "Regression test for 249579";
+ var BUGNUMBER="249579";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "0?function(){}:0",
+ 0,
+ 0?function(){}:0 );
+
+
+ bar = true;
+ foo = bar ? function () { return true; } : function() { return false; };
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "bar = true; foo = bar ? function () { return true; } : function() { return false; }; foo()",
+ true,
+ foo() );
+
+
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_3/Script/in-001.js b/Source/JavaScriptCore/tests/mozilla/js1_3/Script/in-001.js
new file mode 100644
index 0000000..d9d76fe
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_3/Script/in-001.js
@@ -0,0 +1,52 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: in-001.js
+ Section:
+ Description:
+
+ http://scopus.mcom.com/bugsplat/show_bug.cgi?id=196109
+
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "in-001";
+ var VERSION = "JS1_3";
+ var TITLE = "Regression test for 196109";
+ var BUGNUMBER="196109";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ o = {};
+ o.foo = 'sil';
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "\"foo\" in o",
+ true,
+ "foo" in o );
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_3/Script/new-001.js b/Source/JavaScriptCore/tests/mozilla/js1_3/Script/new-001.js
new file mode 100644
index 0000000..2868eca
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_3/Script/new-001.js
@@ -0,0 +1,120 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: new-001.js
+ Section:
+ Description:
+
+ http://scopus.mcom.com/bugsplat/show_bug.cgi?id=76103
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "new-001";
+ var VERSION = "JS1_3";
+ var TITLE = "new-001";
+ var BUGNUMBER="31567";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ function Test_One (x) {
+ this.v = x+1;
+ return x*2
+ }
+
+ function Test_Two( x, y ) {
+ this.v = x;
+ return y;
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "Test_One(18)",
+ 36,
+ Test_One(18) );
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "new Test_One(18)",
+ "[object Object]",
+ new Test_One(18) +"" );
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "new Test_One(18).v",
+ 19,
+ new Test_One(18).v );
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "Test_Two(2,7)",
+ 7,
+ Test_Two(2,7) );
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "new Test_Two(2,7)",
+ "[object Object]",
+ new Test_Two(2,7) +"" );
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "new Test_Two(2,7).v",
+ 2,
+ new Test_Two(2,7).v );
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "new (Function)(\"x\", \"return x+3\")(5,6)",
+ 8,
+ new (Function)("x","return x+3")(5,6) );
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "new new Test_Two(String, 2).v(0123)",
+ "83",
+ new new Test_Two(String, 2).v(0123) +"");
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "new new Test_Two(String, 2).v(0123).length",
+ 2,
+ new new Test_Two(String, 2).v(0123).length );
+
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_3/Script/script-001.js b/Source/JavaScriptCore/tests/mozilla/js1_3/Script/script-001.js
new file mode 100644
index 0000000..5e7ec89
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_3/Script/script-001.js
@@ -0,0 +1,159 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: script-001.js
+ Section:
+ Description: new NativeScript object
+
+
+js> parseInt(123,"hi")
+123
+js> parseInt(123, "blah")
+123
+js> s
+js: s is not defined
+js> s = new Script
+
+undefined;
+
+
+js> s = new Script()
+
+undefined;
+
+
+js> s.getJSClass
+js> s.getJSClass = Object.prototype.toString
+function toString() {
+ [native code]
+}
+
+js> s.getJSClass()
+[object Script]
+js> s.compile( "return 3+4" )
+js: JavaScript exception: javax.javascript.EvaluatorException: "<Scr
+js> s.compile( "3+4" )
+
+3 + 4;
+
+
+js> typeof s
+function
+js> s()
+Jit failure!
+invalid opcode: 1
+Jit Pass1 Failure!
+javax/javascript/gen/c13 initScript (Ljavax/javascript/Scriptable;)V
+An internal JIT error has occurred. Please report this with .class
+jit-bugs@itools.symantec.com
+
+7
+js> s.compile("3+4")
+
+3 + 4;
+
+
+js> s()
+Jit failure!
+invalid opcode: 1
+Jit Pass1 Failure!
+javax/javascript/gen/c17 initScript (Ljavax/javascript/Scriptable;)V
+An internal JIT error has occurred. Please report this with .class
+jit-bugs@itools.symantec.com
+
+7
+js> quit()
+
+C:\src\ns_priv\js\tests\ecma>shell
+
+C:\src\ns_priv\js\tests\ecma>java -classpath c:\cafe\java\JavaScope;
+:\src\ns_priv\js\tests javax.javascript.examples.Shell
+Symantec Java! JustInTime Compiler Version 210.054 for JDK 1.1.2
+Copyright (C) 1996-97 Symantec Corporation
+
+js> s = new Script("3+4")
+
+3 + 4;
+
+
+js> s()
+7
+js> s2 = new Script();
+
+undefined;
+
+
+js> s.compile( "3+4")
+
+3 + 4;
+
+
+js> s()
+Jit failure!
+invalid opcode: 1
+Jit Pass1 Failure!
+javax/javascript/gen/c7 initScript (Ljavax/javascript/Scriptable;)V
+An internal JIT error has occurred. Please report this with .class
+jit-bugs@itools.symantec.com
+
+7
+js> quit()
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "script-001";
+ var VERSION = "JS1_3";
+ var TITLE = "NativeScript";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var s = new Script();
+ s.getJSClass = Object.prototype.toString;
+
+ testcases[tc++] = new TestCase( SECTION,
+ "var s = new Script(); typeof s",
+ "function",
+ typeof s );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "s.getJSClass()",
+ "[object Script]",
+ s.getJSClass() );
+
+ test();
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_3/Script/switch-001.js b/Source/JavaScriptCore/tests/mozilla/js1_3/Script/switch-001.js
new file mode 100644
index 0000000..b3f71d7
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_3/Script/switch-001.js
@@ -0,0 +1,80 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: switch-001.js
+ Section:
+ Description:
+
+ http://scopus.mcom.com/bugsplat/show_bug.cgi?id=315767
+
+ Verify that switches do not use strict equality in
+ versions of JavaScript < 1.4
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "switch-001";
+ var VERSION = "JS1_3";
+ var TITLE = "switch-001";
+ var BUGNUMBER="315767";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ result = "fail: did not enter switch";
+
+ switch (true) {
+ case 1:
+ result = "fail: for backwards compatibility, version 130 use strict equality";
+ break;
+ case true:
+ result = "pass";
+ break;
+ default:
+ result = "fail: evaluated default statement";
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "switch / case should use strict equality in version of JS < 1.4",
+ "pass",
+ result );
+
+
+
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_1.js b/Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_1.js
new file mode 100644
index 0000000..1d9915e
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_1.js
@@ -0,0 +1,166 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: proto_1.js
+ Section:
+ Description: new PrototypeObject
+
+ This tests Object Hierarchy and Inheritance, as described in the document
+ Object Hierarchy and Inheritance in JavaScript, last modified on 12/18/97
+ 15:19:34 on http://devedge.netscape.com/. Current URL:
+ http://devedge.netscape.com/docs/manuals/communicator/jsobj/contents.htm
+
+ This tests the syntax ObjectName.prototype = new PrototypeObject using the
+ Employee example in the document referenced above.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "proto_1";
+ var VERSION = "JS1_3";
+ var TITLE = "new PrototypeObject";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+function Employee () {
+ this.name = "";
+ this.dept = "general";
+}
+function Manager () {
+ this.reports = [];
+}
+Manager.prototype = new Employee();
+
+function WorkerBee () {
+ this.projects = new Array();
+}
+WorkerBee.prototype = new Employee();
+
+function SalesPerson () {
+ this.dept = "sales";
+ this.quota = 100;
+}
+SalesPerson.prototype = new WorkerBee();
+
+function Engineer () {
+ this.dept = "engineering";
+ this.machine = "";
+}
+Engineer.prototype = new WorkerBee();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+ var jim = new Employee();
+
+ testcases[tc++] = new TestCase( SECTION,
+ "jim = new Employee(); jim.name",
+ "",
+ jim.name );
+
+
+ testcases[tc++] = new TestCase( SECTION,
+ "jim = new Employee(); jim.dept",
+ "general",
+ jim.dept );
+
+ var sally = new Manager();
+
+ testcases[tc++] = new TestCase( SECTION,
+ "sally = new Manager(); sally.name",
+ "",
+ sally.name );
+ testcases[tc++] = new TestCase( SECTION,
+ "sally = new Manager(); sally.dept",
+ "general",
+ sally.dept );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "sally = new Manager(); sally.reports.length",
+ 0,
+ sally.reports.length );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "sally = new Manager(); typeof sally.reports",
+ "object",
+ typeof sally.reports );
+
+ var fred = new SalesPerson();
+
+ testcases[tc++] = new TestCase( SECTION,
+ "fred = new SalesPerson(); fred.name",
+ "",
+ fred.name );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "fred = new SalesPerson(); fred.dept",
+ "sales",
+ fred.dept );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "fred = new SalesPerson(); fred.quota",
+ 100,
+ fred.quota );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "fred = new SalesPerson(); fred.projects.length",
+ 0,
+ fred.projects.length );
+
+ var jane = new Engineer();
+
+ testcases[tc++] = new TestCase( SECTION,
+ "jane = new Engineer(); jane.name",
+ "",
+ jane.name );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "jane = new Engineer(); jane.dept",
+ "engineering",
+ jane.dept );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "jane = new Engineer(); jane.projects.length",
+ 0,
+ jane.projects.length );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "jane = new Engineer(); jane.machine",
+ "",
+ jane.machine );
+
+
+ test(); \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_10.js b/Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_10.js
new file mode 100644
index 0000000..e6d1b9a
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_10.js
@@ -0,0 +1,152 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: proto_10.js
+ Section:
+ Description: Determining Instance Relationships
+
+ This tests Object Hierarchy and Inheritance, as described in the document
+ Object Hierarchy and Inheritance in JavaScript, last modified on 12/18/97
+ 15:19:34 on http://devedge.netscape.com/. Current URL:
+ http://devedge.netscape.com/docs/manuals/communicator/jsobj/contents.htm
+
+ This tests the syntax ObjectName.prototype = new PrototypeObject using the
+ Employee example in the document referenced above.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "proto_10";
+ var VERSION = "JS1_3";
+ var TITLE = "Determining Instance Relationships";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+function InstanceOf( object, constructor ) {
+ while ( object != null ) {
+ if ( object == constructor.prototype ) {
+ return true;
+ }
+ object = object.__proto__;
+ }
+ return false;
+}
+function Employee ( name, dept ) {
+ this.name = name || "";
+ this.dept = dept || "general";
+}
+
+function Manager () {
+ this.reports = [];
+}
+Manager.prototype = new Employee();
+
+function WorkerBee ( name, dept, projs ) {
+ this.base = Employee;
+ this.base( name, dept)
+ this.projects = projs || new Array();
+}
+WorkerBee.prototype = new Employee();
+
+function SalesPerson () {
+ this.dept = "sales";
+ this.quota = 100;
+}
+SalesPerson.prototype = new WorkerBee();
+
+function Engineer ( name, projs, machine ) {
+ this.base = WorkerBee;
+ this.base( name, "engineering", projs )
+ this.machine = machine || "";
+}
+Engineer.prototype = new WorkerBee();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+ var pat = new Engineer()
+
+ testcases[tc++] = new TestCase( SECTION,
+ "pat.__proto__ == Engineer.prototype",
+ true,
+ pat.__proto__ == Engineer.prototype );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "pat.__proto__.__proto__ == WorkerBee.prototype",
+ true,
+ pat.__proto__.__proto__ == WorkerBee.prototype );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "pat.__proto__.__proto__.__proto__ == Employee.prototype",
+ true,
+ pat.__proto__.__proto__.__proto__ == Employee.prototype );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "pat.__proto__.__proto__.__proto__.__proto__ == Object.prototype",
+ true,
+ pat.__proto__.__proto__.__proto__.__proto__ == Object.prototype );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "pat.__proto__.__proto__.__proto__.__proto__.__proto__ == null",
+ true,
+ pat.__proto__.__proto__.__proto__.__proto__.__proto__ == null );
+
+
+ testcases[tc++] = new TestCase( SECTION,
+ "InstanceOf( pat, Engineer )",
+ true,
+ InstanceOf( pat, Engineer ) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "InstanceOf( pat, WorkerBee )",
+ true,
+ InstanceOf( pat, WorkerBee ) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "InstanceOf( pat, Employee )",
+ true,
+ InstanceOf( pat, Employee ) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "InstanceOf( pat, Object )",
+ true,
+ InstanceOf( pat, Object ) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "InstanceOf( pat, SalesPerson )",
+ false,
+ InstanceOf ( pat, SalesPerson ) );
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_11.js b/Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_11.js
new file mode 100644
index 0000000..4e92b9b
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_11.js
@@ -0,0 +1,115 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: proto_11.js
+ Section:
+ Description: Global Information in Constructors
+
+ This tests Object Hierarchy and Inheritance, as described in the document
+ Object Hierarchy and Inheritance in JavaScript, last modified on 12/18/97
+ 15:19:34 on http://devedge.netscape.com/. Current URL:
+ http://devedge.netscape.com/docs/manuals/communicator/jsobj/contents.htm
+
+ This tests the syntax ObjectName.prototype = new PrototypeObject using the
+ Employee example in the document referenced above.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "proto_11";
+ var VERSION = "JS1_3";
+ var TITLE = "Global Information in Constructors";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+ var idCounter = 1;
+
+
+function Employee ( name, dept ) {
+ this.name = name || "";
+ this.dept = dept || "general";
+ this.id = idCounter++;
+}
+function Manager () {
+ this.reports = [];
+}
+Manager.prototype = new Employee();
+
+function WorkerBee ( name, dept, projs ) {
+ this.base = Employee;
+ this.base( name, dept)
+ this.projects = projs || new Array();
+}
+WorkerBee.prototype = new Employee();
+
+function SalesPerson () {
+ this.dept = "sales";
+ this.quota = 100;
+}
+SalesPerson.prototype = new WorkerBee();
+
+function Engineer ( name, projs, machine ) {
+ this.base = WorkerBee;
+ this.base( name, "engineering", projs )
+ this.machine = machine || "";
+}
+Engineer.prototype = new WorkerBee();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+ var pat = new Employee( "Toonces, Pat", "Tech Pubs" )
+ var terry = new Employee( "O'Sherry Terry", "Marketing" );
+
+ var les = new Engineer( "Morris, Les", new Array("JavaScript"), "indy" );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "pat.id",
+ 5,
+ pat.id );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "terry.id",
+ 6,
+ terry.id );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "les.id",
+ 7,
+ les.id );
+
+
+ test();
+
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_12.js b/Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_12.js
new file mode 100644
index 0000000..93081a0
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_12.js
@@ -0,0 +1,142 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: proto_12.js
+ Section:
+ Description: new PrototypeObject
+
+ This tests Object Hierarchy and Inheritance, as described in the document
+ Object Hierarchy and Inheritance in JavaScript, last modified on 12/18/97
+ 15:19:34 on http://devedge.netscape.com/. Current URL:
+ http://devedge.netscape.com/docs/manuals/communicator/jsobj/contents.htm
+
+ No Multiple Inheritance
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "proto_12";
+ var VERSION = "JS1_3";
+ var TITLE = "No Multiple Inheritance";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+function Employee ( name, dept ) {
+ this.name = name || "";
+ this.dept = dept || "general";
+ this.id = idCounter++;
+}
+function Manager () {
+ this.reports = [];
+}
+Manager.prototype = new Employee();
+
+function WorkerBee ( name, dept, projs ) {
+ this.base = Employee;
+ this.base( name, dept)
+ this.projects = projs || new Array();
+}
+WorkerBee.prototype = new Employee();
+
+function SalesPerson () {
+ this.dept = "sales";
+ this.quota = 100;
+}
+SalesPerson.prototype = new WorkerBee();
+
+function Hobbyist( hobby ) {
+ this.hobby = hobby || "yodeling";
+}
+
+function Engineer ( name, projs, machine, hobby ) {
+ this.base1 = WorkerBee;
+ this.base1( name, "engineering", projs )
+
+ this.base2 = Hobbyist;
+ this.base2( hobby );
+
+ this.projects = projs || new Array();
+ this.machine = machine || "";
+}
+Engineer.prototype = new WorkerBee();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+ var idCounter = 1;
+
+ var les = new Engineer( "Morris, Les", new Array("JavaScript"), "indy" );
+
+ Hobbyist.prototype.equipment = [ "horn", "mountain", "goat" ];
+
+ testcases[tc++] = new TestCase( SECTION,
+ "les.name",
+ "Morris, Les",
+ les.name );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "les.dept",
+ "engineering",
+ les.dept );
+
+ Array.prototype.getClass = Object.prototype.toString;
+
+ testcases[tc++] = new TestCase( SECTION,
+ "les.projects.getClass()",
+ "[object Array]",
+ les.projects.getClass() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "les.projects[0]",
+ "JavaScript",
+ les.projects[0] );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "les.machine",
+ "indy",
+ les.machine );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "les.hobby",
+ "yodeling",
+ les.hobby );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "les.equpment",
+ void 0,
+ les.equipment );
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_2.js b/Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_2.js
new file mode 100644
index 0000000..1300ed3
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_2.js
@@ -0,0 +1,122 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: proto_2.js
+ Section:
+ Description: new PrototypeObject
+
+ This tests Object Hierarchy and Inheritance, as described in the document
+ Object Hierarchy and Inheritance in JavaScript, last modified on 12/18/97
+ 15:19:34 on http://devedge.netscape.com/. Current URL:
+ http://devedge.netscape.com/docs/manuals/communicator/jsobj/contents.htm
+
+ This tests the syntax ObjectName.prototype = new PrototypeObject using the
+ Employee example in the document referenced above.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "proto_2";
+ var VERSION = "JS1_3";
+ var TITLE = "new PrototypeObject";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+function Employee () {
+ this.name = "";
+ this.dept = "general";
+}
+function Manager () {
+ this.reports = [];
+}
+Manager.prototype = new Employee();
+
+function WorkerBee () {
+ this.projects = new Array();
+}
+
+WorkerBee.prototype = new Employee;
+
+function SalesPerson () {
+ this.dept = "sales";
+ this.quota = 100;
+}
+SalesPerson.prototype = new WorkerBee;
+
+function Engineer () {
+ this.dept = "engineering";
+ this.machine = "";
+}
+Engineer.prototype = new WorkerBee;
+
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
+ var employee = new Employee();
+ var manager = new Manager();
+ var workerbee = new WorkerBee();
+ var salesperson = new SalesPerson();
+ var engineer = new Engineer();
+
+ testcases[tc++] = new TestCase( SECTION,
+ "employee.__proto__ == Employee.prototype",
+ true,
+ employee.__proto__ == Employee.prototype );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "manager.__proto__ == Manager.prototype",
+ true,
+ manager.__proto__ == Manager.prototype );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "workerbee.__proto__ == WorkerBee.prototype",
+ true,
+ workerbee.__proto__ == WorkerBee.prototype );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "salesperson.__proto__ == SalesPerson.prototype",
+ true,
+ salesperson.__proto__ == SalesPerson.prototype );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "engineer.__proto__ == Engineer.prototype",
+ true,
+ engineer.__proto__ == Engineer.prototype );
+
+ test();
+
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_3.js b/Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_3.js
new file mode 100644
index 0000000..61fa033
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_3.js
@@ -0,0 +1,103 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: proto_3.js
+ Section:
+ Description: Adding properties to an instance
+
+ This tests Object Hierarchy and Inheritance, as described in the document
+ Object Hierarchy and Inheritance in JavaScript, last modified on 12/18/97
+ 15:19:34 on http://devedge.netscape.com/. Current URL:
+ http://devedge.netscape.com/docs/manuals/communicator/jsobj/contents.htm
+
+ This tests the syntax ObjectName.prototype = new PrototypeObject using the
+ Employee example in the document referenced above.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "proto_3";
+ var VERSION = "JS1_3";
+ var TITLE = "Adding properties to an Instance";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+function Employee () {
+ this.name = "";
+ this.dept = "general";
+}
+function Manager () {
+ this.reports = [];
+}
+Manager.prototype = new Employee();
+
+function WorkerBee () {
+ this.projects = new Array();
+}
+
+WorkerBee.prototype = new Employee();
+
+function SalesPerson () {
+ this.dept = "sales";
+ this.quota = 100;
+}
+SalesPerson.prototype = new WorkerBee();
+
+function Engineer () {
+ this.dept = "engineering";
+ this.machine = "";
+}
+Engineer.prototype = new WorkerBee();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+ var jim = new Employee();
+ var pat = new Employee();
+
+ jim.bonus = 300;
+
+ testcases[tc++] = new TestCase( SECTION,
+ "jim = new Employee(); jim.bonus = 300; jim.bonus",
+ 300,
+ jim.bonus );
+
+
+ testcases[tc++] = new TestCase( SECTION,
+ "pat = new Employee(); pat.bonus",
+ void 0,
+ pat.bonus );
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_4.js b/Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_4.js
new file mode 100644
index 0000000..2006f76
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_4.js
@@ -0,0 +1,156 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: proto_4.js
+ Section:
+ Description: new PrototypeObject
+
+ This tests Object Hierarchy and Inheritance, as described in the document
+ Object Hierarchy and Inheritance in JavaScript, last modified on 12/18/97
+ 15:19:34 on http://devedge.netscape.com/. Current URL:
+ http://devedge.netscape.com/docs/manuals/communicator/jsobj/contents.htm
+
+ This tests the syntax ObjectName.prototype = new PrototypeObject using the
+ Employee example in the document referenced above.
+
+ If you add a property to an object in the prototype chain, instances of
+ objects that derive from that prototype should inherit that property, even
+ if they were instatiated after the property was added to the prototype object.
+
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "proto_3";
+ var VERSION = "JS1_3";
+ var TITLE = "Adding properties to the prototype";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+function Employee () {
+ this.name = "";
+ this.dept = "general";
+}
+function Manager () {
+ this.reports = [];
+}
+Manager.prototype = new Employee();
+
+function WorkerBee () {
+ this.projects = new Array();
+}
+
+WorkerBee.prototype = new Employee();
+
+function SalesPerson () {
+ this.dept = "sales";
+ this.quota = 100;
+}
+SalesPerson.prototype = new WorkerBee();
+
+function Engineer () {
+ this.dept = "engineering";
+ this.machine = "";
+}
+Engineer.prototype = new WorkerBee();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
+ var jim = new Employee();
+ var terry = new Engineer();
+ var sean = new SalesPerson();
+ var wally = new Manager();
+
+ Employee.prototype.specialty = "none";
+
+ var pat = new Employee();
+ var leslie = new Engineer();
+ var bubbles = new SalesPerson();
+ var furry = new Manager();
+
+ Engineer.prototype.specialty = "code";
+
+ var chris = new Engineer();
+
+
+ testcases[tc++] = new TestCase( SECTION,
+ "jim = new Employee(); jim.specialty",
+ "none",
+ jim.specialty );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "terry = new Engineer(); terry.specialty",
+ "code",
+ terry.specialty );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "sean = new SalesPerson(); sean.specialty",
+ "none",
+ sean.specialty );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "wally = new Manager(); wally.specialty",
+ "none",
+ wally.specialty );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "furry = new Manager(); furry.specialty",
+ "none",
+ furry.specialty );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "pat = new Employee(); pat.specialty",
+ "none",
+ pat.specialty );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "leslie = new Engineer(); leslie.specialty",
+ "code",
+ leslie.specialty );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "bubbles = new SalesPerson(); bubbles.specialty",
+ "none",
+ bubbles.specialty );
+
+
+ testcases[tc++] = new TestCase( SECTION,
+ "chris = new Employee(); chris.specialty",
+ "code",
+ chris.specialty );
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_5.js b/Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_5.js
new file mode 100644
index 0000000..4c84d33
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_5.js
@@ -0,0 +1,146 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: proto_5.js
+ Section:
+ Description: Logical OR || in Constructors
+
+ This tests Object Hierarchy and Inheritance, as described in the document
+ Object Hierarchy and Inheritance in JavaScript, last modified on 12/18/97
+ 15:19:34 on http://devedge.netscape.com/. Current URL:
+ http://devedge.netscape.com/docs/manuals/communicator/jsobj/contents.htm
+
+ This tests the syntax ObjectName.prototype = new PrototypeObject using the
+ Employee example in the document referenced above.
+
+ This tests the logical OR opererator || syntax in constructors.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "proto_5";
+ var VERSION = "JS1_3";
+ var TITLE = "Logical OR || in Constructors";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+function Employee ( name, dept ) {
+ this.name = name || "";
+ this.dept = dept || "general";
+}
+function Manager () {
+ this.reports = [];
+}
+Manager.prototype = new Employee();
+
+function WorkerBee ( projs ) {
+ this.projects = projs || new Array();
+}
+WorkerBee.prototype = new Employee();
+
+function SalesPerson () {
+ this.dept = "sales";
+ this.quota = 100;
+}
+SalesPerson.prototype = new WorkerBee();
+
+function Engineer ( machine ) {
+ this.dept = "engineering";
+ this.machine = machine || "";
+}
+Engineer.prototype = new WorkerBee();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
+
+ var pat = new Engineer( "indy" );
+
+ var les = new Engineer();
+
+ testcases[tc++] = new TestCase( SECTION,
+ "var pat = new Engineer(\"indy\"); pat.name",
+ "",
+ pat.name );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "pat.dept",
+ "engineering",
+ pat.dept );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "pat.projects.length",
+ 0,
+ pat.projects.length );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "pat.machine",
+ "indy",
+ pat.machine );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "pat.__proto__ == Engineer.prototype",
+ true,
+ pat.__proto__ == Engineer.prototype );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "var les = new Engineer(); les.name",
+ "",
+ les.name );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "les.dept",
+ "engineering",
+ les.dept );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "les.projects.length",
+ 0,
+ les.projects.length );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "les.machine",
+ "",
+ les.machine );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "les.__proto__ == Engineer.prototype",
+ true,
+ les.__proto__ == Engineer.prototype );
+
+
+ test(); \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_6.js b/Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_6.js
new file mode 100644
index 0000000..15d4bdd
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_6.js
@@ -0,0 +1,171 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: proto_6.js
+ Section:
+ Description: Logical OR || in constructors
+
+ This tests Object Hierarchy and Inheritance, as described in the document
+ Object Hierarchy and Inheritance in JavaScript, last modified on 12/18/97
+ 15:19:34 on http://devedge.netscape.com/. Current URL:
+ http://devedge.netscape.com/docs/manuals/communicator/jsobj/contents.htm
+
+ This tests the syntax ObjectName.prototype = new PrototypeObject using the
+ Employee example in the document referenced above.
+
+ This tests the logical OR opererator || syntax in constructors.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "proto_6";
+ var VERSION = "JS1_3";
+ var TITLE = "Logical OR || in constructors";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+function Employee ( name, dept ) {
+ this.name = name || "";
+ this.dept = dept || "general";
+}
+function Manager () {
+ this.reports = [];
+}
+Manager.prototype = new Employee();
+
+function WorkerBee ( name, dept, projs ) {
+ this.base = Employee;
+ this.base( name, dept)
+ this.projects = projs || new Array();
+}
+
+WorkerBee.prototype = new Employee();
+
+function SalesPerson () {
+ this.dept = "sales";
+ this.quota = 100;
+}
+SalesPerson.prototype = new WorkerBee();
+
+function Engineer ( name, projs, machine ) {
+ this.base = WorkerBee;
+ this.base( name, "engineering", projs )
+ this.machine = machine || "";
+}
+Engineer.prototype = new WorkerBee();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
+ var pat = new Engineer( "Toonces, Pat",
+ ["SpiderMonkey", "Rhino"],
+ "indy" );
+
+ var les = new WorkerBee( "Morris, Les",
+ "Training",
+ ["Hippo"] )
+
+ var terry = new Employee( "Boomberi, Terry",
+ "Marketing" );
+
+ // Pat, the Engineer
+
+ testcases[tc++] = new TestCase( SECTION,
+ "pat.name",
+ "Toonces, Pat",
+ pat.name );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "pat.dept",
+ "engineering",
+ pat.dept );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "pat.projects.length",
+ 2,
+ pat.projects.length );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "pat.projects[0]",
+ "SpiderMonkey",
+ pat.projects[0] );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "pat.projects[1]",
+ "Rhino",
+ pat.projects[1] );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "pat.machine",
+ "indy",
+ pat.machine );
+
+
+ // Les, the WorkerBee
+
+ testcases[tc++] = new TestCase( SECTION,
+ "les.name",
+ "Morris, Les",
+ les.name );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "les.dept",
+ "Training",
+ les.dept );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "les.projects.length",
+ 1,
+ les.projects.length );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "les.projects[0]",
+ "Hippo",
+ les.projects[0] );
+
+ // Terry, the Employee
+ testcases[tc++] = new TestCase( SECTION,
+ "terry.name",
+ "Boomberi, Terry",
+ terry.name );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "terry.dept",
+ "Marketing",
+ terry.dept );
+ test();
+
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_7.js b/Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_7.js
new file mode 100644
index 0000000..207fa17
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_7.js
@@ -0,0 +1,125 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: proto_7.js
+ Section:
+ Description: Adding Properties to the Prototype Object
+
+ This tests Object Hierarchy and Inheritance, as described in the document
+ Object Hierarchy and Inheritance in JavaScript, last modified on 12/18/97
+ 15:19:34 on http://devedge.netscape.com/. Current URL:
+ http://devedge.netscape.com/docs/manuals/communicator/jsobj/contents.htm
+
+ This tests the syntax ObjectName.prototype = new PrototypeObject using the
+ Employee example in the document referenced above.
+
+ This tests
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "proto_6";
+ var VERSION = "JS1_3";
+ var TITLE = "Adding properties to the Prototype Object";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+function Employee ( name, dept ) {
+ this.name = name || "";
+ this.dept = dept || "general";
+}
+function WorkerBee ( name, dept, projs ) {
+ this.base = Employee;
+ this.base( name, dept)
+ this.projects = projs || new Array();
+}
+WorkerBee.prototype = new Employee();
+
+function Engineer ( name, projs, machine ) {
+ this.base = WorkerBee;
+ this.base( name, "engineering", projs )
+ this.machine = machine || "";
+}
+// Engineer.prototype = new WorkerBee();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+ var pat = new Engineer( "Toonces, Pat",
+ ["SpiderMonkey", "Rhino"],
+ "indy" );
+
+ Employee.prototype.specialty = "none";
+
+
+ // Pat, the Engineer
+
+ testcases[tc++] = new TestCase( SECTION,
+ "pat.name",
+ "Toonces, Pat",
+ pat.name );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "pat.dept",
+ "engineering",
+ pat.dept );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "pat.projects.length",
+ 2,
+ pat.projects.length );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "pat.projects[0]",
+ "SpiderMonkey",
+ pat.projects[0] );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "pat.projects[1]",
+ "Rhino",
+ pat.projects[1] );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "pat.machine",
+ "indy",
+ pat.machine );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "pat.specialty",
+ void 0,
+ pat.specialty );
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_8.js b/Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_8.js
new file mode 100644
index 0000000..fa92d70
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_8.js
@@ -0,0 +1,123 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: proto_8.js
+ Section:
+ Description: Adding Properties to the Prototype Object
+
+ This tests Object Hierarchy and Inheritance, as described in the document
+ Object Hierarchy and Inheritance in JavaScript, last modified on 12/18/97
+ 15:19:34 on http://devedge.netscape.com/. Current URL:
+ http://devedge.netscape.com/docs/manuals/communicator/jsobj/contents.htm
+
+ This tests the syntax ObjectName.prototype = new PrototypeObject using the
+ Employee example in the document referenced above.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "proto_8";
+ var VERSION = "JS1_3";
+ var TITLE = "Adding Properties to the Prototype Object";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+function Employee ( name, dept ) {
+ this.name = name || "";
+ this.dept = dept || "general";
+}
+function WorkerBee ( name, dept, projs ) {
+ this.base = Employee;
+ this.base( name, dept)
+ this.projects = projs || new Array();
+}
+WorkerBee.prototype = new Employee();
+
+function Engineer ( name, projs, machine ) {
+ this.base = WorkerBee;
+ this.base( name, "engineering", projs )
+ this.machine = machine || "";
+}
+Engineer.prototype = new WorkerBee();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+ var pat = new Engineer( "Toonces, Pat",
+ ["SpiderMonkey", "Rhino"],
+ "indy" );
+
+ Employee.prototype.specialty = "none";
+
+
+ // Pat, the Engineer
+
+ testcases[tc++] = new TestCase( SECTION,
+ "pat.name",
+ "Toonces, Pat",
+ pat.name );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "pat.dept",
+ "engineering",
+ pat.dept );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "pat.projects.length",
+ 2,
+ pat.projects.length );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "pat.projects[0]",
+ "SpiderMonkey",
+ pat.projects[0] );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "pat.projects[1]",
+ "Rhino",
+ pat.projects[1] );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "pat.machine",
+ "indy",
+ pat.machine );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "pat.specialty",
+ "none",
+ pat.specialty );
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_9.js b/Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_9.js
new file mode 100644
index 0000000..93989ca
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_3/inherit/proto_9.js
@@ -0,0 +1,101 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: proto_9.js
+ Section:
+ Description: Local versus Inherited Values
+
+ This tests Object Hierarchy and Inheritance, as described in the document
+ Object Hierarchy and Inheritance in JavaScript, last modified on 12/18/97
+ 15:19:34 on http://devedge.netscape.com/. Current URL:
+ http://devedge.netscape.com/docs/manuals/communicator/jsobj/contents.htm
+
+ This tests the syntax ObjectName.prototype = new PrototypeObject using the
+ Employee example in the document referenced above.
+
+ This tests
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "proto_9";
+ var VERSION = "JS1_3";
+ var TITLE = "Local versus Inherited Values";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+function Employee ( name, dept ) {
+ this.name = name || "";
+ this.dept = dept || "general";
+}
+function WorkerBee ( name, dept, projs ) {
+ this.projects = new Array();
+}
+WorkerBee.prototype = new Employee();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+ var pat = new WorkerBee()
+
+ Employee.prototype.specialty = "none";
+ Employee.prototype.name = "Unknown";
+
+ Array.prototype.getClass = Object.prototype.toString;
+
+ // Pat, the WorkerBee
+
+ testcases[tc++] = new TestCase( SECTION,
+ "pat.name",
+ "",
+ pat.name );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "pat.dept",
+ "general",
+ pat.dept );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "pat.projects.getClass",
+ "[object Array]",
+ pat.projects.getClass() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "pat.projects.length",
+ 0,
+ pat.projects.length );
+
+ test(); \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_3/jsref.js b/Source/JavaScriptCore/tests/mozilla/js1_3/jsref.js
new file mode 100644
index 0000000..dd611a7
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_3/jsref.js
@@ -0,0 +1,198 @@
+var completed = false;
+var testcases;
+
+SECTION = "";
+VERSION = "";
+
+BUGNUMBER ="";
+var EXCLUDE = "";
+
+TZ_DIFF = -8;
+
+var TT = "";
+var TT_ = "";
+var BR = "";
+var NBSP = " ";
+var CR = "\n";
+var FONT = "";
+var FONT_ = "";
+var FONT_RED = "";
+var FONT_GREEN = "";
+var B = "";
+var B_ = ""
+var H2 = "";
+var H2_ = "";
+var HR = "";
+var DEBUG = false;
+
+version(130);
+
+var PASSED = " PASSED!"
+var FAILED = " FAILED! expected: ";
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
+function TestCase( n, d, e, a ) {
+ this.name = n;
+ this.description = d;
+ this.expect = e;
+ this.actual = a;
+ this.passed = true;
+ this.reason = "";
+
+ this.bugnumber = BUGNUMBER;
+
+ this.passed = getTestCaseResult( this.expect, this.actual );
+ if ( DEBUG ) {
+ writeLineToLog( "added " + this.description );
+ }
+}
+function startTest() {
+ // JavaScript 1.3 is supposed to be compliant ecma version 1.0
+ if ( VERSION == "ECMA_1" ) {
+ version ( "130" );
+ }
+ if ( VERSION == "JS_1.3" ) {
+ version ( "130" );
+ }
+ if ( VERSION == "JS_1.2" ) {
+ version ( "120" );
+ }
+ if ( VERSION == "JS_1.1" ) {
+ version ( "110" );
+ }
+ // for ecma version 2.0, we will leave the javascript version to
+ // the default ( for now ).
+}
+function getTestCaseResult( expect, actual ) {
+ // because ( NaN == NaN ) always returns false, need to do
+ // a special compare to see if we got the right result.
+ if ( actual != actual ) {
+ if ( typeof actual == "object" ) {
+ actual = "NaN object";
+ } else {
+ actual = "NaN number";
+ }
+ }
+ if ( expect != expect ) {
+ if ( typeof expect == "object" ) {
+ expect = "NaN object";
+ } else {
+ expect = "NaN number";
+ }
+ }
+
+ var passed = ( expect == actual ) ? true : false;
+
+ // if both objects are numbers
+ // need to replace w/ IEEE standard for rounding
+ if ( !passed
+ && typeof(actual) == "number"
+ && typeof(expect) == "number"
+ ) {
+ if ( Math.abs(actual-expect) < 0.0000001 ) {
+ passed = true;
+ }
+ }
+
+ // verify type is the same
+ if ( typeof(expect) != typeof(actual) ) {
+ passed = false;
+ }
+
+ return passed;
+}
+function writeTestCaseResult( expect, actual, string ) {
+ var passed = getTestCaseResult( expect, actual );
+ writeFormattedResult( expect, actual, string, passed );
+ return passed;
+}
+function writeFormattedResult( expect, actual, string, passed ) {
+ var s = TT + string ;
+
+ for ( k = 0;
+ k < (60 - string.length >= 0 ? 60 - string.length : 5) ;
+ k++ ) {
+ }
+
+ s += B ;
+ s += ( passed ) ? FONT_GREEN + NBSP + PASSED : FONT_RED + NBSP + FAILED + expect + TT_ ;
+
+ writeLineToLog( s + FONT_ + B_ + TT_ );
+
+ return passed;
+}
+
+function writeLineToLog( string ) {
+ print( string + BR + CR );
+}
+function writeHeaderToLog( string ) {
+ print( H2 + string + H2_ );
+}
+function stopTest()
+{
+ var sizeTag = "<#TEST CASES SIZE>";
+ var doneTag = "<#TEST CASES DONE>";
+ var beginTag = "<#TEST CASE ";
+ var endTag = ">";
+
+ print(sizeTag);
+ print(testcases.length);
+ for (tc = 0; tc < testcases.length; tc++)
+ {
+ print(beginTag + 'PASSED' + endTag);
+ print(testcases[tc].passed);
+ print(beginTag + 'NAME' + endTag);
+ print(testcases[tc].name);
+ print(beginTag + 'EXPECTED' + endTag);
+ print(testcases[tc].expect);
+ print(beginTag + 'ACTUAL' + endTag);
+ print(testcases[tc].actual);
+ print(beginTag + 'DESCRIPTION' + endTag);
+ print(testcases[tc].description);
+ print(beginTag + 'REASON' + endTag);
+ print(( testcases[tc].passed ) ? "" : "wrong value ");
+ print(beginTag + 'BUGNUMBER' + endTag);
+ print( BUGNUMBER );
+ }
+ print(doneTag);
+
+ print( HR );
+ gc();
+}
+function getFailedCases() {
+ for ( var i = 0; i < testcases.length; i++ ) {
+ if ( ! testcases[i].passed ) {
+ print( testcases[i].description +" = " +testcases[i].actual +" expected: "+ testcases[i].expect );
+ }
+ }
+}
+function err( msg, page, line ) {
+ testcases[tc].actual = "error";
+ testcases[tc].reason = msg;
+ writeTestCaseResult( testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual +
+ ": " + testcases[tc].reason );
+ stopTest();
+ return true;
+}
+
+function Enumerate ( o ) {
+ var p;
+ for ( p in o ) {
+ writeLineToLog( p +": " + o[p] );
+ }
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_3/regress/delete-001.js b/Source/JavaScriptCore/tests/mozilla/js1_3/regress/delete-001.js
new file mode 100644
index 0000000..e2f4332
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_3/regress/delete-001.js
@@ -0,0 +1,79 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: delete-001.js
+ Section: regress
+ Description:
+
+ Regression test for
+ http://scopus.mcom.com/bugsplat/show_bug.cgi?id=108736
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "JS1_2";
+ var VERSION = "JS1_2";
+ var TITLE = "The variable statment";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ // delete all properties of the global object
+ // per ecma, this does not affect variables in the global object declared
+ // with var or functions
+
+ for ( p in this ) {
+ delete p;
+ }
+
+ var result ="";
+
+ for ( p in this ) {
+ result += String( p );
+ }
+
+ // not too picky here... just want to make sure we didn't crash or something
+
+ testcases[testcases.length] = new TestCase( SECTION,
+ "delete all properties of the global object",
+ "PASSED",
+ result == "" ? "FAILED" : "PASSED" );
+
+
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_3/regress/function-001-n.js b/Source/JavaScriptCore/tests/mozilla/js1_3/regress/function-001-n.js
new file mode 100644
index 0000000..5b4add0
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_3/regress/function-001-n.js
@@ -0,0 +1,74 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ * File Name: boolean-001.js
+ * Description:
+ *
+ * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=99232
+ *
+ * eval("function f(){}function g(){}") at top level is an error for JS1.2
+ * and above (missing ; between named function expressions), but declares f
+ * and g as functions below 1.2.
+ *
+ * Fails to produce error regardless of version:
+ * js> version(100)
+ * 120
+ * js> eval("function f(){}function g(){}")
+ * js> version(120);
+ * 100
+ * js> eval("function f(){}function g(){}")
+ * js>
+ * Author: christine@netscape.com
+ * Date: 11 August 1998
+ */
+ var SECTION = "function-001.js";
+ var VERSION = "JS_1.3";
+ var TITLE = "functions not separated by semicolons are errors in version 120 and higher";
+ var BUGNUMBER="10278";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "eval(\"function f(){}function g(){}\")",
+ "error",
+ eval("function f(){}function g(){}") );
+
+ test();
+
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_3/regress/function-002.js b/Source/JavaScriptCore/tests/mozilla/js1_3/regress/function-002.js
new file mode 100644
index 0000000..d3d1d85
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_3/regress/function-002.js
@@ -0,0 +1,75 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: function-002.js
+ Section:
+ Description:
+
+ http://scopus.mcom.com/bugsplat/show_bug.cgi?id=249579
+
+ function definitions in conditional statements should be allowed.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "function-002";
+ var VERSION = "JS1_3";
+ var TITLE = "Regression test for 249579";
+ var BUGNUMBER="249579";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "0?function(){}:0",
+ 0,
+ 0?function(){}:0 );
+
+
+ bar = true;
+ foo = bar ? function () { return true; } : function() { return false; };
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "bar = true; foo = bar ? function () { return true; } : function() { return false; }; foo()",
+ true,
+ foo() );
+
+
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_3/regress/in-001.js b/Source/JavaScriptCore/tests/mozilla/js1_3/regress/in-001.js
new file mode 100644
index 0000000..f524870
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_3/regress/in-001.js
@@ -0,0 +1,66 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: in-001.js
+ Section:
+ Description:
+
+ http://scopus.mcom.com/bugsplat/show_bug.cgi?id=196109
+
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "in-001";
+ var VERSION = "JS1_3";
+ var TITLE = "Regression test for 196109";
+ var BUGNUMBER="196109";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ o = {};
+ o.foo = 'sil';
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "\"foo\" in o",
+ true,
+ "foo" in o );
+
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_3/regress/new-001.js b/Source/JavaScriptCore/tests/mozilla/js1_3/regress/new-001.js
new file mode 100644
index 0000000..2868eca
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_3/regress/new-001.js
@@ -0,0 +1,120 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: new-001.js
+ Section:
+ Description:
+
+ http://scopus.mcom.com/bugsplat/show_bug.cgi?id=76103
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "new-001";
+ var VERSION = "JS1_3";
+ var TITLE = "new-001";
+ var BUGNUMBER="31567";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ function Test_One (x) {
+ this.v = x+1;
+ return x*2
+ }
+
+ function Test_Two( x, y ) {
+ this.v = x;
+ return y;
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "Test_One(18)",
+ 36,
+ Test_One(18) );
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "new Test_One(18)",
+ "[object Object]",
+ new Test_One(18) +"" );
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "new Test_One(18).v",
+ 19,
+ new Test_One(18).v );
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "Test_Two(2,7)",
+ 7,
+ Test_Two(2,7) );
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "new Test_Two(2,7)",
+ "[object Object]",
+ new Test_Two(2,7) +"" );
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "new Test_Two(2,7).v",
+ 2,
+ new Test_Two(2,7).v );
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "new (Function)(\"x\", \"return x+3\")(5,6)",
+ 8,
+ new (Function)("x","return x+3")(5,6) );
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "new new Test_Two(String, 2).v(0123)",
+ "83",
+ new new Test_Two(String, 2).v(0123) +"");
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "new new Test_Two(String, 2).v(0123).length",
+ 2,
+ new new Test_Two(String, 2).v(0123).length );
+
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_3/regress/switch-001.js b/Source/JavaScriptCore/tests/mozilla/js1_3/regress/switch-001.js
new file mode 100644
index 0000000..47d8a44
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_3/regress/switch-001.js
@@ -0,0 +1,80 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: switch-001.js
+ Section:
+ Description:
+
+ http://scopus.mcom.com/bugsplat/show_bug.cgi?id=315767
+
+ Verify that switches do not use strict equality in
+ versions of JavaScript < 1.4. It's now been decided that
+ we won't put in version switches, so all switches will
+ be ECMA.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "switch-001";
+ var VERSION = "JS1_3";
+ var TITLE = "switch-001";
+ var BUGNUMBER="315767";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ result = "fail: did not enter switch";
+
+ switch (true) {
+ case 1:
+ result = "fail: version 130 should force strict equality";
+ break;
+ case true:
+ result = "pass";
+ break;
+ default:
+ result = "fail: evaluated default statement";
+ }
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "switch / case should use strict equality in version of JS < 1.4",
+ "pass",
+ result );
+
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_3/shell.js b/Source/JavaScriptCore/tests/mozilla/js1_3/shell.js
new file mode 100644
index 0000000..dc0ec4e
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_3/shell.js
@@ -0,0 +1,163 @@
+var completed = false;
+var testcases;
+var tc = 0;
+
+SECTION = "";
+VERSION = "";
+BUGNUMBER = "";
+DEBUG = false;
+
+var GLOBAL = "[object global]";
+var PASSED = " PASSED!"
+var FAILED = " FAILED! expected: ";
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
+/* wrapper for test cas constructor that doesn't require the SECTION
+ * argument.
+ */
+
+function AddTestCase( description, expect, actual ) {
+ testcases[tc++] = new TestCase( SECTION, description, expect, actual );
+}
+
+function TestCase( n, d, e, a ) {
+ this.name = n;
+ this.description = d;
+ this.expect = e;
+ this.actual = a;
+ this.passed = true;
+ this.reason = "";
+ this.bugnumber = BUGNUMBER;
+
+ this.passed = getTestCaseResult( this.expect, this.actual );
+ if ( DEBUG ) {
+ writeLineToLog( "added " + this.description );
+ }
+}
+function startTest() {
+ // JavaScript 1.3 is supposed to be compliant ecma version 1.0
+ if ( VERSION == "ECMA_1" ) {
+ version ( 130 );
+ }
+ if ( VERSION == "JS_1.3" ) {
+ version ( 130 );
+ }
+ if ( VERSION == "JS_1.2" ) {
+ version ( 120 );
+ }
+ if ( VERSION == "JS_1.1" ) {
+ version ( 110 );
+ }
+ // for ecma version 2.0, we will leave the javascript version to
+ // the default ( for now ).
+
+ if ( BUGNUMBER ) {
+ writeLineToLog ("BUGNUMBER: " + BUGNUMBER );
+ }
+
+ testcases = new Array();
+ tc = 0;
+}
+function getTestCaseResult( expect, actual ) {
+ // because ( NaN == NaN ) always returns false, need to do
+ // a special compare to see if we got the right result.
+ if ( actual != actual ) {
+ if ( typeof actual == "object" ) {
+ actual = "NaN object";
+ } else {
+ actual = "NaN number";
+ }
+ }
+ if ( expect != expect ) {
+ if ( typeof expect == "object" ) {
+ expect = "NaN object";
+ } else {
+ expect = "NaN number";
+ }
+ }
+
+ var passed = ( expect == actual ) ? true : false;
+
+ // if both objects are numbers
+ // need to replace w/ IEEE standard for rounding
+ if ( !passed
+ && typeof(actual) == "number"
+ && typeof(expect) == "number"
+ ) {
+ if ( Math.abs(actual-expect) < 0.0000001 ) {
+ passed = true;
+ }
+ }
+
+ // verify type is the same
+ if ( typeof(expect) != typeof(actual) ) {
+ passed = false;
+ }
+
+ return passed;
+}
+function writeTestCaseResult( expect, actual, string ) {
+ var passed = getTestCaseResult( expect, actual );
+ writeFormattedResult( expect, actual, string, passed );
+ return passed;
+}
+function writeFormattedResult( expect, actual, string, passed ) {
+ var s = TT + string ;
+
+ for ( k = 0;
+ k < (60 - string.length >= 0 ? 60 - string.length : 5) ;
+ k++ ) {
+ }
+
+ s += B ;
+ s += ( passed ) ? FONT_GREEN + NBSP + PASSED : FONT_RED + NBSP + FAILED + expect + TT_ ;
+
+ writeLineToLog( s + FONT_ + B_ + TT_ );
+
+ return passed;
+}
+/*
+ * Begin printing functions. These functions use the shell's
+ * print function. When running tests in the browser, these
+ * functions, override these functions with functions that use
+ * document.write.
+ */
+
+function writeTestCaseResult( expect, actual, string ) {
+ var passed = getTestCaseResult( expect, actual );
+ writeFormattedResult( expect, actual, string, passed );
+ return passed;
+}
+function writeFormattedResult( expect, actual, string, passed ) {
+ var s = string ;
+ s += ( passed ) ? PASSED : FAILED + expect;
+ writeLineToLog( s);
+ return passed;
+}
+function writeLineToLog( string ) {
+ print( string );
+}
+function writeHeaderToLog( string ) {
+ print( string );
+}
+/* end of print functions */
+
+function stopTest() {
+ var gc;
+ if ( gc != undefined ) {
+ gc();
+ }
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_3/template.js b/Source/JavaScriptCore/tests/mozilla/js1_3/template.js
new file mode 100644
index 0000000..1958832
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_3/template.js
@@ -0,0 +1,44 @@
+/**
+ File Name: switch_1.js
+ Section:
+ Description:
+
+ http://scopus.mcom.com/bugsplat/show_bug.cgi?id=315767
+
+ Verify that switches do not use strict equality in
+ versions of JavaScript < 1.4
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+// onerror = err;
+
+ var SECTION = "script_1;
+ var VERSION = "JS1_3";
+ var TITLE = "NativeScript";
+ var BUGNUMBER="31567";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+
+ testcases[tc++] = new TestCase( SECTION,
+
+
+ test();
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_4/Eval/eval-001.js b/Source/JavaScriptCore/tests/mozilla/js1_4/Eval/eval-001.js
new file mode 100644
index 0000000..38f9d04
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_4/Eval/eval-001.js
@@ -0,0 +1,75 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ * File Name: eval-001.js
+ * Original Description: (SEE REVISED DESCRIPTION FURTHER BELOW)
+ *
+ * The global eval function may not be accessed indirectly and then called.
+ * This feature will continue to work in JavaScript 1.3 but will result in an
+ * error in JavaScript 1.4. This restriction is also in place for the With and
+ * Closure constructors.
+ *
+ * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=324451
+ *
+ * Author: christine@netscape.com
+ * Date: 11 August 1998
+ *
+ *
+ * REVISION: 05 February 2001
+ * Author: pschwartau@netscape.com
+ *
+ * Indirect eval IS NOT ILLEGAL per ECMA3!!! See
+ *
+ * http://bugzilla.mozilla.org/show_bug.cgi?id=38512
+ *
+ * ------- Additional Comments From Brendan Eich 2001-01-30 17:12 -------
+ * ECMA-262 Edition 3 doesn't require implementations to throw EvalError,
+ * see the short, section-less Chapter 16. It does say an implementation that
+ * doesn't throw EvalError must allow assignment to eval and indirect calls
+ * of the evalnative method.
+ *
+ */
+ var SECTION = "eval-001.js";
+ var VERSION = "JS1_4";
+ var TITLE = "Calling eval indirectly should NOT fail in version 140";
+ var BUGNUMBER="38512";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+
+ var MY_EVAL = eval;
+ var RESULT = "";
+ var EXPECT = "abcdefg";
+
+ MY_EVAL( "RESULT = EXPECT" );
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "Call eval indirectly",
+ EXPECT,
+ RESULT );
+
+ test();
+
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_4/Eval/eval-002.js b/Source/JavaScriptCore/tests/mozilla/js1_4/Eval/eval-002.js
new file mode 100644
index 0000000..159a9bd
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_4/Eval/eval-002.js
@@ -0,0 +1,80 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ * File Name: eval-002.js
+ * Description: (SEE REVISED DESCRIPTION FURTHER BELOW)
+ *
+ * The global eval function may not be accessed indirectly and then called.
+ * This feature will continue to work in JavaScript 1.3 but will result in an
+ * error in JavaScript 1.4. This restriction is also in place for the With and
+ * Closure constructors.
+ *
+ * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=324451
+ *
+ * Author: christine@netscape.com
+ * Date: 11 August 1998
+ *
+ *
+ * REVISION: 05 February 2001
+ * Author: pschwartau@netscape.com
+ *
+ * Indirect eval IS NOT ILLEGAL per ECMA3!!! See
+ *
+ * http://bugzilla.mozilla.org/show_bug.cgi?id=38512
+ *
+ * ------- Additional Comments From Brendan Eich 2001-01-30 17:12 -------
+ * ECMA-262 Edition 3 doesn't require implementations to throw EvalError,
+ * see the short, section-less Chapter 16. It does say an implementation that
+ * doesn't throw EvalError must allow assignment to eval and indirect calls
+ * of the evalnative method.
+ *
+ */
+ var SECTION = "eval-002.js";
+ var VERSION = "JS1_4";
+ var TITLE = "Calling eval indirectly should NOT fail in version 140";
+ var BUGNUMBER="38512";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var MY_EVAL = eval;
+ var RESULT = "";
+ var EXPECT = 1 + "testString"
+
+ EvalTest();
+
+ test();
+
+
+function EvalTest()
+{
+ MY_EVAL( "RESULT = EXPECT" );
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "Call eval indirectly",
+ EXPECT,
+ RESULT );
+}
+
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_4/Eval/eval-003.js b/Source/JavaScriptCore/tests/mozilla/js1_4/Eval/eval-003.js
new file mode 100644
index 0000000..5c9f1ea
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_4/Eval/eval-003.js
@@ -0,0 +1,85 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ * File Name: eval-003.js
+ * Description: (SEE REVISED DESCRIPTION FURTHER BELOW)
+ *
+ * The global eval function may not be accessed indirectly and then called.
+ * This feature will continue to work in JavaScript 1.3 but will result in an
+ * error in JavaScript 1.4. This restriction is also in place for the With and
+ * Closure constructors.
+ *
+ * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=324451
+ *
+ * Author: christine@netscape.com
+ * Date: 11 August 1998
+ *
+ *
+ * REVISION: 05 February 2001
+ * Author: pschwartau@netscape.com
+ *
+ * Indirect eval IS NOT ILLEGAL per ECMA3!!! See
+ *
+ * http://bugzilla.mozilla.org/show_bug.cgi?id=38512
+ *
+ * ------- Additional Comments From Brendan Eich 2001-01-30 17:12 -------
+ * ECMA-262 Edition 3 doesn't require implementations to throw EvalError,
+ * see the short, section-less Chapter 16. It does say an implementation that
+ * doesn't throw EvalError must allow assignment to eval and indirect calls
+ * of the evalnative method.
+ *
+ */
+ var SECTION = "eval-003.js";
+ var VERSION = "JS1_4";
+ var TITLE = "Calling eval indirectly should NOT fail in version 140";
+ var BUGNUMBER="38512";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var MY_EVAL = eval;
+ var RESULT = "";
+ var EXPECT= "";
+ var h = function f(x,y){var g = function(z){return Math.exp(z);}; return g(x+y);};
+
+
+ new EvalTest();
+
+ test();
+
+function EvalTest()
+{
+ with( this )
+ {
+ MY_EVAL( "RESULT = h(-1, 1)" );
+ EXPECT = 1; //The base e to the power (-1 + 1), i.e. the power 0, equals 1 ....
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "Call eval indirectly",
+ EXPECT,
+ RESULT );
+ }
+}
+
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_4/Functions/function-001.js b/Source/JavaScriptCore/tests/mozilla/js1_4/Functions/function-001.js
new file mode 100644
index 0000000..c1e6a3d
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_4/Functions/function-001.js
@@ -0,0 +1,106 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ * File Name: function-001.js
+ * Description:
+ *
+ * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=324455
+ *
+ * Earlier versions of JavaScript supported access to the arguments property
+ * of the function object. This property held the arguments to the function.
+ * function f() {
+ * return f.arguments[0]; // deprecated
+ * }
+ * var x = f(3); // x will be 3
+ *
+ * This feature is not a part of the final ECMA standard. Instead, scripts
+ * should simply use just "arguments":
+ *
+ * function f() {
+ * return arguments[0]; // okay
+ * }
+ *
+ * var x = f(3); // x will be 3
+ *
+ * Again, this feature was motivated by performance concerns. Access to the
+ * arguments property is not threadsafe, which is of particular concern in
+ * server environments. Also, the compiler can generate better code for
+ * functions because it can tell when the arguments are being accessed only by
+ * name and avoid setting up the arguments object.
+ *
+ * Author: christine@netscape.com
+ * Date: 11 August 1998
+ */
+ var SECTION = "function-001.js";
+ var VERSION = "JS1_4";
+ var TITLE = "Accessing the arguments property of a function object";
+ var BUGNUMBER="324455";
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "return function.arguments",
+ "P",
+ TestFunction_2("P", "A","S","S")[0] +"");
+
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "return arguments",
+ "P",
+ TestFunction_1( "P", "A", "S", "S" )[0] +"");
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "return arguments when function contains an arguments property",
+ "PASS",
+ TestFunction_3( "P", "A", "S", "S" ) +"");
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "return function.arguments when function contains an arguments property",
+ "PASS",
+ TestFunction_4( "F", "A", "I", "L" ) +"");
+
+ test();
+
+ function TestFunction_1( a, b, c, d, e ) {
+ return arguments;
+ }
+
+ function TestFunction_2( a, b, c, d, e ) {
+ return TestFunction_2.arguments;
+ }
+
+ function TestFunction_3( a, b, c, d, e ) {
+ var arguments = "PASS";
+ return arguments;
+ }
+
+ function TestFunction_4( a, b, c, d, e ) {
+ var arguments = "PASS";
+ return TestFunction_4.arguments;
+ }
+
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_4/Regress/date-001-n.js b/Source/JavaScriptCore/tests/mozilla/js1_4/Regress/date-001-n.js
new file mode 100644
index 0000000..d6f9f59
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_4/Regress/date-001-n.js
@@ -0,0 +1,55 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ * File Name: date-001-n.js
+ * Description:
+ *
+ * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=299903
+ *
+ * Author: christine@netscape.com
+ * Date: 11 August 1998
+ */
+ var SECTION = "date-001-n.js";
+ var VERSION = "JS1_4";
+ var TITLE = "Regression test case for 299903";
+ var BUGNUMBER="299903";
+
+ startTest();
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ function MyDate() {
+ this.foo = "bar";
+ }
+ MyDate.prototype = new Date();
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "function MyDate() { this.foo = \"bar\"; }; "+
+ "MyDate.prototype = new Date(); " +
+ "new MyDate().toString()",
+ "error",
+ new MyDate().toString() );
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_4/Regress/function-001.js b/Source/JavaScriptCore/tests/mozilla/js1_4/Regress/function-001.js
new file mode 100644
index 0000000..4fed009
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_4/Regress/function-001.js
@@ -0,0 +1,79 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ * File Name: function-001.js
+ * Description:
+ *
+ * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=325843
+ * js> function f(a){var a,b;}
+ *
+ * causes an an assert on a null 'sprop' in the 'Variables' function in
+ * jsparse.c This will crash non-debug build.
+ *
+ * Author: christine@netscape.com
+ * Date: 11 August 1998
+ */
+ var SECTION = "function-001.js";
+ var VERSION = "JS1_4";
+ var TITLE = "Regression test case for 325843";
+ var BUGNUMBER="3258435";
+ startTest();
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ eval("function f1 (a){ var a,b; }");
+
+ function f2( a ) { var a, b; };
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "eval(\"function f1 (a){ var a,b; }\"); "+
+ "function f2( a ) { var a, b; }; typeof f1",
+ "function",
+ typeof f1 );
+
+ // force a function decompilation
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "typeof f1.toString()",
+ "string",
+ typeof f1.toString() );
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "typeof f2",
+ "function",
+ typeof f2 );
+
+ // force a function decompilation
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "typeof f2.toString()",
+ "string",
+ typeof f2.toString() );
+
+ test();
+
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_4/Regress/function-002.js b/Source/JavaScriptCore/tests/mozilla/js1_4/Regress/function-002.js
new file mode 100644
index 0000000..0476869
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_4/Regress/function-002.js
@@ -0,0 +1,123 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ * File Name: function-002.js
+ * Description:
+ *
+ * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=330462
+ * js> function f(a){var a,b;}
+ *
+ * causes an an assert on a null 'sprop' in the 'Variables' function in
+ * jsparse.c This will crash non-debug build.
+ *
+ * Author: christine@netscape.com
+ * Date: 11 August 1998
+ * REVISED: 04 February 2001
+ * (changed the comma expressions from trivial to non-trivial)
+ * Author: pschwartau@netscape.com
+ *
+ * Brendan: "The test seemed to require something that ECMA does not
+ * guarantee, and that JS1.4 didn't either. For example, given
+ *
+ * dec2 = "function f2(){1,2}";
+ *
+ * the engine is free to decompile a function object compiled from this source,
+ * via Function.prototype.toString(), into some other string that compiles to
+ * an equivalent function. The engine now eliminates the useless comma expression
+ * 1,2, giving function f2(){}. This should be legal by the testsuite's lights."
+ *
+ */
+ var SECTION = "function-002.js";
+ var VERSION = "JS1_4";
+ var TITLE = "Regression test case for 325843";
+ var BUGNUMBER="330462";
+
+ startTest();
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ dec1 = "function f1(x,y){++x, --y}";
+ dec2 = "function f2(){var y; f1(1,2); y=new Date(); print(y.toString())}";
+
+ eval(dec1);
+ eval(dec2);
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "typeof f1",
+ "function",
+ typeof f1 );
+
+
+ // force a function decompilation
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "f1.toString() == dec1",
+ true,
+ StripSpaces(f1.toString()) == StripSpaces(dec1));
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "typeof f2",
+ "function",
+ typeof f2 );
+
+ // force a function decompilation
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "f2.toString() == dec2",
+ true,
+ StripSpaces(f2.toString()) == StripSpaces(dec2));
+
+ test();
+
+ function StripSpaces( s ) {
+ var strippedString = "";
+ for ( var currentChar = 0; currentChar < s.length; currentChar++ ) {
+ if (!IsWhiteSpace(s.charAt(currentChar))) {
+ strippedString += s.charAt(currentChar);
+ }
+ }
+ return strippedString;
+ }
+
+ function IsWhiteSpace( string ) {
+ var cc = string.charCodeAt(0);
+
+ switch (cc) {
+ case (0x0009):
+ case (0x000B):
+ case (0x000C):
+ case (0x0020):
+ case (0x000A):
+ case (0x000D):
+ case ( 59 ): // let's strip out semicolons, too
+ return true;
+ break;
+ default:
+ return false;
+ }
+ }
+
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_4/Regress/function-003.js b/Source/JavaScriptCore/tests/mozilla/js1_4/Regress/function-003.js
new file mode 100644
index 0000000..1cf1ea3
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_4/Regress/function-003.js
@@ -0,0 +1,77 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ * File Name: function-003.js
+ * Description:
+ *
+ * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=104766
+ *
+ * Author: christine@netscape.com
+ * Date: 11 August 1998
+ */
+ var SECTION = "toString-001.js";
+ var VERSION = "JS1_4";
+ var TITLE = "Regression test case for 104766";
+ var BUGNUMBER="310514";
+
+ startTest();
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "StripSpaces(Array.prototype.concat.toString()).substring(0,17)",
+ "functionconcat(){",
+ StripSpaces(Array.prototype.concat.toString()).substring(0,17));
+
+ test();
+
+ function StripSpaces( s ) {
+ for ( var currentChar = 0, strippedString="";
+ currentChar < s.length; currentChar++ )
+ {
+ if (!IsWhiteSpace(s.charAt(currentChar))) {
+ strippedString += s.charAt(currentChar);
+ }
+ }
+ return strippedString;
+ }
+
+ function IsWhiteSpace( string ) {
+ var cc = string.charCodeAt(0);
+ switch (cc) {
+ case (0x0009):
+ case (0x000B):
+ case (0x000C):
+ case (0x0020):
+ case (0x000A):
+ case (0x000D):
+ case ( 59 ): // let's strip out semicolons, too
+ return true;
+ break;
+ default:
+ return false;
+ }
+ }
+
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_4/Regress/function-004-n.js b/Source/JavaScriptCore/tests/mozilla/js1_4/Regress/function-004-n.js
new file mode 100644
index 0000000..5b94505
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_4/Regress/function-004-n.js
@@ -0,0 +1,51 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ * File Name: function-004.js
+ * Description:
+ *
+ * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=310502
+ *
+ * Author: christine@netscape.com
+ * Date: 11 August 1998
+ */
+ var SECTION = "funtion-004-n.js";
+ var VERSION = "JS1_4";
+ var TITLE = "Regression test case for 310502";
+ var BUGNUMBER="310502";
+
+ startTest();
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var o = {};
+ o.call = Function.prototype.call;
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "var o = {}; o.call = Function.prototype.call; o.call()",
+ "error",
+ o.call() );
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_4/Regress/regress-7224.js b/Source/JavaScriptCore/tests/mozilla/js1_4/Regress/regress-7224.js
new file mode 100644
index 0000000..b63ecaa
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_4/Regress/regress-7224.js
@@ -0,0 +1,72 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS
+* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+* implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation. All
+* Rights Reserved.
+*
+* Contributor(s):
+*/
+
+/**
+ * File Name: regress-7224.js
+ * Reference: js1_2
+ * Description: Remove support for the arg
+ * Author: ** replace with your e-mail address **
+ */
+
+ var SECTION = "regress"; // provide a document reference (ie, ECMA section)
+ var VERSION = "JS1_4"; // Version of JavaScript or ECMA
+ var TITLE = "Regression test for bugzilla #7224"; // Provide ECMA section title or a description
+ var BUGNUMBER = "http://bugzilla.mozilla.org/show_bug.cgi?id=7224"; // Provide URL to bugsplat or bugzilla report
+
+ startTest(); // leave this alone
+
+ /*
+ * Calls to AddTestCase here. AddTestCase is a function that is defined
+ * in shell.js and takes three arguments:
+ * - a string representation of what is being tested
+ * - the expected result
+ * - the actual result
+ *
+ * For example, a test might look like this:
+ *
+ * var zip = /[\d]{5}$/;
+ *
+ * AddTestCase(
+ * "zip = /[\d]{5}$/; \"PO Box 12345 Boston, MA 02134\".match(zip)", // description of the test
+ * "02134", // expected result
+ * "PO Box 12345 Boston, MA 02134".match(zip) ); // actual result
+ *
+ */
+
+ var f = new Function( "return arguments.caller" );
+ var o = {};
+
+ o.foo = f;
+ o.foo("a", "b", "c")
+
+
+ AddTestCase(
+ "var f = new Function( 'return arguments.caller' ); f()",
+ undefined,
+ f() );
+
+ AddTestCase(
+ "var o = {}; o.foo = f; o.foo('a')",
+ undefined,
+ o.foo('a') );
+
+ test(); // leave this alone. this executes the test cases and
+ // displays results.
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_4/Regress/toString-001-n.js b/Source/JavaScriptCore/tests/mozilla/js1_4/Regress/toString-001-n.js
new file mode 100644
index 0000000..c075373
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_4/Regress/toString-001-n.js
@@ -0,0 +1,53 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ * File Name: toString-001-n.js
+ * Description:
+ *
+ * Function.prototype.toString is not generic.
+ *
+ * Author: christine@netscape.com
+ * Date: 11 August 1998
+ */
+ var SECTION = "toString-001.js";
+ var VERSION = "JS1_4";
+ var TITLE = "Regression test case for 310514";
+ var BUGNUMBER="310514";
+
+ startTest();
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+
+ var o = {};
+ o.toString = Function.prototype.toString;
+
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "var o = {}; o.toString = Function.prototype.toString; o.toString();",
+ "error",
+ o.toString() );
+
+ test();
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_4/browser.js b/Source/JavaScriptCore/tests/mozilla/js1_4/browser.js
new file mode 100644
index 0000000..5bbdf7c
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_4/browser.js
@@ -0,0 +1,80 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS
+* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+* implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation. All
+* Rights Reserved.
+*
+* Contributor(s):
+*/
+
+/*
+ * JavaScript test library shared functions file for running the tests
+ * in the browser. Overrides the shell's print function with document.write
+ * and make everything HTML pretty.
+ *
+ * To run the tests in the browser, use the mkhtml.pl script to generate
+ * html pages that include the shell.js, browser.js (this file), and the
+ * test js file in script tags.
+ *
+ * The source of the page that is generated should look something like this:
+ * <script src="./../shell.js"></script>
+ * <script src="./../browser.js"></script>
+ * <script src="./mytest.js"></script>
+ */
+
+onerror = err;
+
+function startTest() {
+ if ( BUGNUMBER ) {
+ writeLineToLog ("BUGNUMBER: " + BUGNUMBER );
+ }
+
+ testcases = new Array();
+ tc = 0;
+}
+
+function writeLineToLog( string ) {
+ document.write( string + "<br>\n");
+}
+function writeHeaderToLog( string ) {
+ document.write( "<h2>" + string + "</h2>" );
+}
+function stopTest() {
+ var gc;
+ if ( gc != undefined ) {
+ gc();
+ }
+ document.write( "<hr>" );
+}
+function writeFormattedResult( expect, actual, string, passed ) {
+ var s = "<tt>"+ string ;
+ s += "<b>" ;
+ s += ( passed ) ? "<font color=#009900> &nbsp;" + PASSED
+ : "<font color=#aa0000>&nbsp;" + FAILED + expect + "</tt>";
+ writeLineToLog( s + "</font></b></tt>" );
+ return passed;
+}
+function err( msg, page, line ) {
+ writeLineToLog( "Test failed with the message: " + msg );
+
+ testcases[tc].actual = "error";
+ testcases[tc].reason = msg;
+ writeTestCaseResult( testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual +
+ ": " + testcases[tc].reason );
+ stopTest();
+ return true;
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_4/jsref.js b/Source/JavaScriptCore/tests/mozilla/js1_4/jsref.js
new file mode 100644
index 0000000..982d14a
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_4/jsref.js
@@ -0,0 +1,169 @@
+var completed = false;
+var testcases;
+
+var BUGNUMBER="";
+var EXCLUDE = "";
+
+var TT = "";
+var TT_ = "";
+var BR = "";
+var NBSP = " ";
+var CR = "\n";
+var FONT = "";
+var FONT_ = "";
+var FONT_RED = "";
+var FONT_GREEN = "";
+var B = "";
+var B_ = ""
+var H2 = "";
+var H2_ = "";
+var HR = "";
+
+var PASSED = " PASSED!"
+var FAILED = " FAILED! expected: ";
+
+version( 140 );
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function TestCase( n, d, e, a ) {
+ this.name = n;
+ this.description = d;
+ this.expect = e;
+ this.actual = a;
+ this.passed = true;
+ this.reason = "";
+ this.bugnumber = BUGNUMBER;
+
+ this.passed = getTestCaseResult( this.expect, this.actual );
+}
+function startTest() {
+/*
+ // JavaScript 1.3 is supposed to be compliant ecma version 1.0
+ if ( VERSION == "ECMA_1" ) {
+ version ( "130" );
+ }
+ if ( VERSION == "JS_1.3" ) {
+ version ( "130" );
+ }
+ if ( VERSION == "JS_1.2" ) {
+ version ( "120" );
+ }
+ if ( VERSION == "JS_1.1" ) {
+ version ( "110" );
+ }
+ // for ecma version 2.0, we will leave the javascript version to
+ // the default ( for now ).
+*/
+}
+function getTestCaseResult( expect, actual ) {
+ // because ( NaN == NaN ) always returns false, need to do
+ // a special compare to see if we got the right result.
+ if ( actual != actual ) {
+ if ( typeof actual == "object" ) {
+ actual = "NaN object";
+ } else {
+ actual = "NaN number";
+ }
+ }
+ if ( expect != expect ) {
+ if ( typeof expect == "object" ) {
+ expect = "NaN object";
+ } else {
+ expect = "NaN number";
+ }
+ }
+
+ var passed = ( expect == actual ) ? true : false;
+
+ // if both objects are numbers, give a little leeway for rounding.
+ if ( !passed
+ && typeof(actual) == "number"
+ && typeof(expect) == "number"
+ ) {
+ if ( Math.abs(actual-expect) < 0.0000001 ) {
+ passed = true;
+ }
+ }
+
+ // verify type is the same
+ if ( typeof(expect) != typeof(actual) ) {
+ passed = false;
+ }
+
+ return passed;
+}
+function writeTestCaseResult( expect, actual, string ) {
+ var passed = getTestCaseResult( expect, actual );
+ writeFormattedResult( expect, actual, string, passed );
+ return passed;
+}
+function writeFormattedResult( expect, actual, string, passed ) {
+ var s = TT + string ;
+
+ for ( k = 0;
+ k < (60 - string.length >= 0 ? 60 - string.length : 5) ;
+ k++ ) {
+// s += NBSP;
+ }
+
+ s += B ;
+ s += ( passed ) ? FONT_GREEN + NBSP + PASSED : FONT_RED + NBSP + FAILED + expect + TT_ ;
+
+ writeLineToLog( s + FONT_ + B_ + TT_ );
+
+ return passed;
+}
+
+function writeLineToLog( string ) {
+ print( string + BR + CR );
+}
+function writeHeaderToLog( string ) {
+ print( H2 + string + H2_ );
+}
+function stopTest() {
+ var sizeTag = "<#TEST CASES SIZE>";
+ var doneTag = "<#TEST CASES DONE>";
+ var beginTag = "<#TEST CASE ";
+ var endTag = ">";
+
+ print(sizeTag);
+ print(testcases.length);
+ for (tc = 0; tc < testcases.length; tc++)
+ {
+ print(beginTag + 'PASSED' + endTag);
+ print(testcases[tc].passed);
+ print(beginTag + 'NAME' + endTag);
+ print(testcases[tc].name);
+ print(beginTag + 'EXPECTED' + endTag);
+ print(testcases[tc].expect);
+ print(beginTag + 'ACTUAL' + endTag);
+ print(testcases[tc].actual);
+ print(beginTag + 'DESCRIPTION' + endTag);
+ print(testcases[tc].description);
+ print(beginTag + 'REASON' + endTag);
+ print(( testcases[tc].passed ) ? "" : "wrong value ");
+ print(beginTag + 'BUGNUMBER' + endTag);
+ print( BUGNUMBER );
+
+ }
+ print(doneTag);
+ gc();
+}
+function getFailedCases() {
+ for ( var i = 0; i < testcases.length; i++ ) {
+ if ( ! testcases[i].passed ) {
+ print( testcases[i].description +" = " +testcases[i].actual +" expected: "+ testcases[i].expect );
+ }
+ }
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_4/shell.js b/Source/JavaScriptCore/tests/mozilla/js1_4/shell.js
new file mode 100644
index 0000000..3afdc78
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_4/shell.js
@@ -0,0 +1,138 @@
+var completed = false;
+var testcases;
+var tc = 0;
+
+SECTION = "";
+VERSION = "";
+BUGNUMBER = "";
+
+var GLOBAL = "[object global]";
+var PASSED = " PASSED!"
+var FAILED = " FAILED! expected: ";
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+/* wrapper for test cas constructor that doesn't require the SECTION
+ * argument.
+ */
+
+function AddTestCase( description, expect, actual ) {
+ testcases[tc++] = new TestCase( SECTION, description, expect, actual );
+}
+
+function TestCase( n, d, e, a ) {
+ this.name = n;
+ this.description = d;
+ this.expect = e;
+ this.actual = a;
+ this.passed = true;
+ this.reason = "";
+
+ this.passed = getTestCaseResult( this.expect, this.actual );
+}
+function startTest() {
+/*
+ // JavaScript 1.3 is supposed to be compliant ecma version 1.0
+ if ( VERSION == "ECMA_1" ) {
+ version ( 130 );
+ }
+ if ( VERSION == "JS_1.3" ) {
+ version ( 130 );
+ }
+ if ( VERSION == "JS_1.2" ) {
+ version ( 120 );
+ }
+ if ( VERSION == "JS_1.1" ) {
+ version ( 110 );
+ }
+ // for ecma version 2.0, we will leave the javascript version to
+ // the default ( for now ).
+*/
+
+ if ( BUGNUMBER ) {
+ writeLineToLog ("BUGNUMBER: " + BUGNUMBER );
+ }
+
+ testcases = new Array();
+ tc = 0;
+}
+function getTestCaseResult( expect, actual ) {
+ // because ( NaN == NaN ) always returns false, need to do
+ // a special compare to see if we got the right result.
+ if ( actual != actual ) {
+ if ( typeof actual == "object" ) {
+ actual = "NaN object";
+ } else {
+ actual = "NaN number";
+ }
+ }
+ if ( expect != expect ) {
+ if ( typeof expect == "object" ) {
+ expect = "NaN object";
+ } else {
+ expect = "NaN number";
+ }
+ }
+
+ var passed = ( expect == actual ) ? true : false;
+
+ // if both objects are numbers, give a little leeway for rounding.
+ if ( !passed
+ && typeof(actual) == "number"
+ && typeof(expect) == "number"
+ ) {
+ if ( Math.abs(actual-expect) < 0.0000001 ) {
+ passed = true;
+ }
+ }
+
+ // verify type is the same
+ if ( typeof(expect) != typeof(actual) ) {
+ passed = false;
+ }
+
+ return passed;
+}
+/*
+ * Begin printing functions. These functions use the shell's
+ * print function. When running tests in the browser, these
+ * functions, override these functions with functions that use
+ * document.write.
+ */
+
+function writeTestCaseResult( expect, actual, string ) {
+ var passed = getTestCaseResult( expect, actual );
+ writeFormattedResult( expect, actual, string, passed );
+ return passed;
+}
+function writeFormattedResult( expect, actual, string, passed ) {
+ var s = string ;
+ s += ( passed ) ? PASSED : FAILED + expect;
+ writeLineToLog( s);
+ return passed;
+}
+function writeLineToLog( string ) {
+ print( string );
+}
+function writeHeaderToLog( string ) {
+ print( string );
+}
+/* end of print functions */
+
+function stopTest() {
+ var gc;
+ if ( gc != undefined ) {
+ gc();
+ }
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Array/array-001.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Array/array-001.js
new file mode 100644
index 0000000..fbb6440
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Array/array-001.js
@@ -0,0 +1,101 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS
+* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+* implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation.
+* All Rights Reserved.
+*
+* Contributor(s): igor@icesoft.no, pschwartau@netscape.com
+* Date: 24 September 2001
+*
+* SUMMARY: Truncating arrays that have decimal property names.
+* From correspondence with Igor Bukanov <igor@icesoft.no>:
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = '(none)';
+var summary = 'Truncating arrays that have decimal property names';
+var BIG_INDEX = 4294967290;
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+var arr = Array(BIG_INDEX);
+arr[BIG_INDEX - 1] = 'a';
+arr[BIG_INDEX - 10000] = 'b';
+arr[BIG_INDEX - 0.5] = 'c'; // not an array index - but a valid property name
+// Truncate the array -
+arr.length = BIG_INDEX - 5000;
+
+
+// Enumerate its properties with for..in
+var s = '';
+for (var i in arr)
+{
+ s += arr[i];
+}
+
+
+/*
+ * We expect s == 'cb' or 'bc' (EcmaScript does not fix the order).
+ * Note 'c' is included: for..in includes ALL enumerable properties,
+ * not just array-index properties. The bug was: Rhino gave s == ''.
+ */
+status = inSection(1);
+actual = sortThis(s);
+expect = 'bc';
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function sortThis(str)
+{
+ var chars = str.split('');
+ chars = chars.sort();
+ return chars.join('');
+}
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Array/regress-101964.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Array/regress-101964.js
new file mode 100644
index 0000000..72232f8
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Array/regress-101964.js
@@ -0,0 +1,98 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS
+* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+* implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation.
+* All Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+* Date: 27 September 2001
+*
+* SUMMARY: Performance: truncating even very large arrays should be fast!
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=101964
+*
+* Adjust this testcase if necessary. The FAST constant defines
+* an upper bound in milliseconds for any truncation to take.
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 101964;
+var summary = 'Performance: truncating even very large arrays should be fast!';
+var BIG = 10000000;
+var LITTLE = 10;
+var FAST = 50; // array truncation should be 50 ms or less to pass the test
+var MSG_FAST = 'Truncation took less than ' + FAST + ' ms';
+var MSG_SLOW = 'Truncation took ';
+var MSG_MS = ' ms';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+
+status = inSection(1);
+var arr = Array(BIG);
+var start = new Date();
+arr.length = LITTLE;
+actual = elapsedTime(start);
+expect = FAST;
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function elapsedTime(startTime)
+{
+ return new Date() - startTime;
+}
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = isThisFast(actual);
+ expectedvalues[UBound] = isThisFast(expect);
+ UBound++;
+}
+
+
+function isThisFast(ms)
+{
+ if (ms <= FAST)
+ return MSG_FAST;
+ return MSG_SLOW + ms + MSG_MS;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Array/regress-107138.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Array/regress-107138.js
new file mode 100644
index 0000000..41527df
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Array/regress-107138.js
@@ -0,0 +1,190 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS
+* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+* implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation.
+* All Rights Reserved.
+*
+* Contributor(s): morse@netscape.com, pschwartau@netscape.com
+* Date: 29 October 2001
+*
+* SUMMARY: Regression test for bug 107138
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=107138
+*
+* The bug: arr['1'] == undefined instead of arr['1'] == 'one'.
+* The bug was intermittent and did not always occur...
+*
+* The cnSTRESS constant defines how many times to repeat this test.
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var cnSTRESS = 10;
+var cnDASH = '-';
+var bug = 107138;
+var summary = 'Regression test for bug 107138';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+var arr = ['zero', 'one', 'two', 'three', 'four', 'five',
+ 'six', 'seven', 'eight', 'nine', 'ten'];
+
+
+// This bug was intermittent. Stress-test it.
+for (var j=0; j<cnSTRESS; j++)
+{
+ status = inSection(j + cnDASH + 1);
+ actual = arr[0];
+ expect = 'zero';
+ addThis();
+
+ status = inSection(j + cnDASH + 2);
+ actual = arr['0'];
+ expect = 'zero';
+ addThis();
+
+ status = inSection(j + cnDASH + 3);
+ actual = arr[1];
+ expect = 'one';
+ addThis();
+
+ status = inSection(j + cnDASH + 4);
+ actual = arr['1'];
+ expect = 'one';
+ addThis();
+
+ status = inSection(j + cnDASH + 5);
+ actual = arr[2];
+ expect = 'two';
+ addThis();
+
+ status = inSection(j + cnDASH + 6);
+ actual = arr['2'];
+ expect = 'two';
+ addThis();
+
+ status = inSection(j + cnDASH + 7);
+ actual = arr[3];
+ expect = 'three';
+ addThis();
+
+ status = inSection(j + cnDASH + 8);
+ actual = arr['3'];
+ expect = 'three';
+ addThis();
+
+ status = inSection(j + cnDASH + 9);
+ actual = arr[4];
+ expect = 'four';
+ addThis();
+
+ status = inSection(j + cnDASH + 10);
+ actual = arr['4'];
+ expect = 'four';
+ addThis();
+
+ status = inSection(j + cnDASH + 11);
+ actual = arr[5];
+ expect = 'five';
+ addThis();
+
+ status = inSection(j + cnDASH + 12);
+ actual = arr['5'];
+ expect = 'five';
+ addThis();
+
+ status = inSection(j + cnDASH + 13);
+ actual = arr[6];
+ expect = 'six';
+ addThis();
+
+ status = inSection(j + cnDASH + 14);
+ actual = arr['6'];
+ expect = 'six';
+ addThis();
+
+ status = inSection(j + cnDASH + 15);
+ actual = arr[7];
+ expect = 'seven';
+ addThis();
+
+ status = inSection(j + cnDASH + 16);
+ actual = arr['7'];
+ expect = 'seven';
+ addThis();
+
+ status = inSection(j + cnDASH + 17);
+ actual = arr[8];
+ expect = 'eight';
+ addThis();
+
+ status = inSection(j + cnDASH + 18);
+ actual = arr['8'];
+ expect = 'eight';
+ addThis();
+
+ status = inSection(j + cnDASH + 19);
+ actual = arr[9];
+ expect = 'nine';
+ addThis();
+
+ status = inSection(j + cnDASH + 20);
+ actual = arr['9'];
+ expect = 'nine';
+ addThis();
+
+ status = inSection(j + cnDASH + 21);
+ actual = arr[10];
+ expect = 'ten';
+ addThis();
+
+ status = inSection(j + cnDASH + 22);
+ actual = arr['10'];
+ expect = 'ten';
+ addThis();
+}
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Array/regress-108440.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Array/regress-108440.js
new file mode 100644
index 0000000..f3d83fb
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Array/regress-108440.js
@@ -0,0 +1,103 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2001
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com, Liorean@user.bip.net
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 30 October 2001
+* SUMMARY: Regression test for bug 108440
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=108440
+*
+* We shouldn't crash trying to add an array as an element of itself (!)
+*
+* Brendan: "...it appears that Array.prototype.toString is unsafe,
+* and what's more, ECMA-262 Edition 3 has no helpful words about
+* avoiding recursive death on a cycle."
+*/
+//-----------------------------------------------------------------------------
+var bug = 108440;
+var summary = "Shouldn't crash trying to add an array as an element of itself";
+var self = this;
+var temp = '';
+
+printBugNumber(bug);
+printStatus(summary);
+
+/*
+ * Explicit test:
+ */
+var a=[];
+temp = (a[a.length]=a);
+
+/*
+ * Implicit test (one of the properties of |self| is |a|)
+ */
+a=[];
+for(var prop in self)
+{
+ temp = prop;
+ temp = (a[a.length] = self[prop]);
+}
+
+/*
+ * Stressful explicit test
+ */
+a=[];
+for (var i=0; i<10; i++)
+{
+ a[a.length] = a;
+}
+
+/*
+ * Test toString()
+ */
+a=[];
+for (var i=0; i<10; i++)
+{
+ a[a.length] = a.toString();
+}
+
+/*
+ * Test toSource() - but Rhino doesn't have this, so try...catch it
+ */
+a=[];
+try
+{
+ for (var i=0; i<10; i++)
+ {
+ a[a.length] = a.toSource();
+ }
+}
+catch(e)
+{
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Array/regress-154338.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Array/regress-154338.js
new file mode 100644
index 0000000..ced8ef5
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Array/regress-154338.js
@@ -0,0 +1,119 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2002
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 26 June 2002
+* SUMMARY: Testing array.join() when separator is a variable, not a literal
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=154338
+*
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 154338;
+var summary = 'Test array.join() when separator is a variable, not a literal';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+/*
+ * Note that x === 'H' and y === 'ome'.
+ *
+ * Yet for some reason, using |x| or |y| as the separator
+ * in arr.join() was causing out-of-memory errors, whereas
+ * using the literals 'H', 'ome' was not -
+ *
+ */
+var x = 'Home'[0];
+var y = ('Home'.split('H'))[1];
+
+
+status = inSection(1);
+var arr = Array('a', 'b');
+actual = arr.join('H');
+expect = 'aHb';
+addThis();
+
+status = inSection(2);
+arr = Array('a', 'b');
+actual = arr.join(x);
+expect = 'aHb';
+addThis();
+
+status = inSection(3);
+arr = Array('a', 'b');
+actual = arr.join('ome');
+expect = 'aomeb';
+addThis();
+
+status = inSection(4);
+arr = Array('a', 'b');
+actual = arr.join(y);
+expect = 'aomeb';
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Array/regress-157652.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Array/regress-157652.js
new file mode 100644
index 0000000..226b871
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Array/regress-157652.js
@@ -0,0 +1,136 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2002
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): zen-parse@gmx.net, pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 16 July 2002
+* SUMMARY: Testing that Array.sort() doesn't crash on very large arrays
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=157652
+*
+* How large can a JavaScript array be?
+* ECMA-262 Ed.3 Final, Section 15.4.2.2 : new Array(len)
+*
+* This states that |len| must be a a uint32 (unsigned 32-bit integer).
+* Note the UBound for uint32's is 2^32 -1 = 0xFFFFFFFF = 4,294,967,295.
+*
+* Check:
+* js> var arr = new Array(0xFFFFFFFF)
+* js> arr.length
+* 4294967295
+*
+* js> var arr = new Array(0x100000000)
+* RangeError: invalid array length
+*
+*
+* We'll try the largest possible array first, then a couple others.
+* We're just testing that we don't crash on Array.sort().
+*
+* Try to be good about memory by nulling each array variable after it is
+* used. This will tell the garbage collector the memory is no longer needed.
+*
+* As of 2002-08-13, the JS shell runs out of memory no matter what we do,
+* when trying to sort such large arrays.
+*
+* We only want to test that we don't CRASH on the sort. So it will be OK
+* if we get the JS "out of memory" error. Note this terminates the test
+* with exit code 3. Therefore we put
+*
+* |expectExitCode(3);|
+*
+* The only problem will arise if the JS shell ever DOES have enough memory
+* to do the sort. Then this test will terminate with the normal exit code 0
+* and fail.
+*
+* Right now, I can't see any other way to do this, because "out of memory"
+* is not a catchable error: it cannot be trapped with try...catch.
+*
+*
+* FURTHER HEADACHE: Rhino can't seem to handle the largest array: it hangs.
+* So we skip this case in Rhino. Here is correspondence with Igor Bukanov.
+* He explains that Rhino isn't actually hanging; it's doing the huge sort:
+*
+* Philip Schwartau wrote:
+*
+* > Hi,
+* >
+* > I'm getting a graceful OOM message on trying to sort certain large
+* > arrays. But if the array is too big, Rhino simply hangs. Note that ECMA
+* > allows array lengths to be anything less than Math.pow(2,32), so the
+* > arrays I'm sorting are legal.
+* >
+* > Note below, I'm getting an instantaneous OOM error on arr.sort() for LEN
+* > = Math.pow(2, 30). So shouldn't I also get one for every LEN between
+* > that and Math.pow(2, 32)? For some reason, I start to hang with 100% CPU
+* > as LEN hits, say, Math.pow(2, 31) and higher. SpiderMonkey gives OOM
+* > messages for all of these. Should I file a bug on this?
+*
+* Igor Bukanov wrote:
+*
+* This is due to different sorting algorithm Rhino uses when sorting
+* arrays with length > Integer.MAX_VALUE. If length can fit Java int,
+* Rhino first copies internal spare array to a temporary buffer, and then
+* sorts it, otherwise it sorts array directly. In case of very spare
+* arrays, that Array(big_number) generates, it is rather inefficient and
+* generates OutOfMemory if length fits int. It may be worth in your case
+* to optimize sorting to take into account array spareness, but then it
+* would be a good idea to file a bug about ineficient sorting of spare
+* arrays both in case of Rhino and SpiderMonkey as SM always uses a
+* temporary buffer.
+*
+*/
+//-----------------------------------------------------------------------------
+var bug = 157652;
+var summary = "Testing that Array.sort() doesn't crash on very large arrays";
+
+printBugNumber(bug);
+printStatus(summary);
+
+// JSC doesn't run out of memory, so we don't expect an abnormal exit code
+//expectExitCode(3);
+var IN_RHINO = inRhino();
+
+if (!IN_RHINO)
+{
+ var a1=Array(0xFFFFFFFF);
+ a1.sort();
+ a1 = null;
+}
+
+var a2 = Array(0x40000000);
+a2.sort();
+a2=null;
+
+var a3=Array(0x10000000/4);
+a3.sort();
+a3=null;
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Array/regress-178722.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Array/regress-178722.js
new file mode 100644
index 0000000..994b381
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Array/regress-178722.js
@@ -0,0 +1,175 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2002
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 06 November 2002
+* SUMMARY: arr.sort() should not output |undefined| when |arr| is empty
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=178722
+*
+* ECMA-262 Ed.3: 15.4.4.11 Array.prototype.sort (comparefn)
+*
+* 1. Call the [[Get]] method of this object with argument "length".
+* 2. Call ToUint32(Result(1)).
+* 3. Perform an implementation-dependent sequence of calls to the [[Get]],
+* [[Put]], and [[Delete]] methods of this object, etc. etc.
+* 4. Return this object.
+*
+*
+* Note that sort() is done in-place on |arr|. In other words, sort() is a
+* "destructive" method rather than a "functional" method. The return value
+* of |arr.sort()| and |arr| are the same object.
+*
+* If |arr| is an empty array, the return value of |arr.sort()| should be
+* an empty array, not the value |undefined| as was occurring in bug 178722.
+*
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 178722;
+var summary = 'arr.sort() should not output |undefined| when |arr| is empty';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+var arr;
+
+
+// create empty array or pseudo-array objects in various ways
+var arr1 = Array();
+var arr2 = new Array();
+var arr3 = [];
+var arr4 = [1];
+arr4.pop();
+function f () {return arguments};
+var arr5 = f();
+arr5.__proto__ = Array.prototype;
+
+
+status = inSection(1);
+arr = arr1.sort();
+actual = arr instanceof Array && arr.length === 0 && arr === arr1;
+expect = true;
+addThis();
+
+status = inSection(2);
+arr = arr2.sort();
+actual = arr instanceof Array && arr.length === 0 && arr === arr2;
+expect = true;
+addThis();
+
+status = inSection(3);
+arr = arr3.sort();
+actual = arr instanceof Array && arr.length === 0 && arr === arr3;
+expect = true;
+addThis();
+
+status = inSection(4);
+arr = arr4.sort();
+actual = arr instanceof Array && arr.length === 0 && arr === arr4;
+expect = true;
+addThis();
+
+status = inSection(5);
+arr = arr5.sort();
+actual = arr instanceof Array && arr.length === 0 && arr === arr5;
+expect = true;
+addThis();
+
+
+// now do the same thing, with non-default sorting:
+function g() {return 1;}
+
+status = inSection('1a');
+arr = arr1.sort(g);
+actual = arr instanceof Array && arr.length === 0 && arr === arr1;
+expect = true;
+addThis();
+
+status = inSection('2a');
+arr = arr2.sort(g);
+actual = arr instanceof Array && arr.length === 0 && arr === arr2;
+expect = true;
+addThis();
+
+status = inSection('3a');
+arr = arr3.sort(g);
+actual = arr instanceof Array && arr.length === 0 && arr === arr3;
+expect = true;
+addThis();
+
+status = inSection('4a');
+arr = arr4.sort(g);
+actual = arr instanceof Array && arr.length === 0 && arr === arr4;
+expect = true;
+addThis();
+
+status = inSection('5a');
+arr = arr5.sort(g);
+actual = arr instanceof Array && arr.length === 0 && arr === arr5;
+expect = true;
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Array/regress-94257.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Array/regress-94257.js
new file mode 100644
index 0000000..28ab667
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Array/regress-94257.js
@@ -0,0 +1,99 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS
+* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+* implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation.
+* All Rights Reserved.
+*
+* Contributor(s): wtam@bigfoot.com, pschwartau@netscape.com
+* Date: 30 October 2001
+*
+* SUMMARY: Regression test for bug 94257
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=94257
+*
+* Rhino used to crash on this code; specifically, on the line
+*
+* arr[1+1] += 2;
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 94257;
+var summary = "Making sure we don't crash on this code -";
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+var arr = new Array(6);
+arr[1+1] = 1;
+arr[1+1] += 2;
+
+
+status = inSection(1);
+actual = arr[1+1];
+expect = 3;
+addThis();
+
+status = inSection(2);
+actual = arr[1+1+1];
+expect = undefined;
+addThis();
+
+status = inSection(3);
+actual = arr[1];
+expect = undefined;
+addThis();
+
+
+arr[1+2] = 'Hello';
+
+
+status = inSection(4);
+actual = arr[1+1+1];
+expect = 'Hello';
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Exceptions/catchguard-001-n.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Exceptions/catchguard-001-n.js
new file mode 100644
index 0000000..37b10ae
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Exceptions/catchguard-001-n.js
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ * Rob Ginda rginda@netscape.com
+ */
+
+test();
+
+function test()
+{
+ enterFunc ("test");
+
+ var EXCEPTION_DATA = "String exception";
+ var e;
+
+ printStatus ("Catchguard syntax negative test.");
+
+ try
+ {
+ throw EXCEPTION_DATA;
+ }
+ catch (e) /* the non-guarded catch should HAVE to appear last */
+ {
+
+ }
+ catch (e if true)
+ {
+
+ }
+ catch (e if false)
+ {
+
+ }
+
+ reportFailure ("Illegally constructed catchguard should have thrown " +
+ "an exception.");
+
+ exitFunc ("test");
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Exceptions/catchguard-001.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Exceptions/catchguard-001.js
new file mode 100644
index 0000000..e65723e
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Exceptions/catchguard-001.js
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ * Rob Ginda rginda@netscape.com
+ */
+
+test();
+
+function test()
+{
+ enterFunc ("test");
+
+ var EXCEPTION_DATA = "String exception";
+ var e = "foo";
+ var caught = false;
+
+ printStatus ("Basic catchguard test.");
+
+ try
+ {
+ throw EXCEPTION_DATA;
+ }
+ catch (e if true)
+ {
+ caught = true;
+ e = "this change should not propagate outside of this scope";
+ }
+ catch (e if false)
+ {
+ reportFailure ("Catch block (e if false) should not have executed.");
+ }
+ catch (e)
+ {
+ reportFailure ("Catch block (e) should not have executed.");
+ }
+
+ if (!caught)
+ reportFailure ("Execption was never caught.");
+
+ if (e != "foo")
+ reportFailure ("Exception data modified inside catch() scope should " +
+ "not be visible in the function scope (e = '" +
+ e + "'.)");
+
+ exitFunc ("test");
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Exceptions/catchguard-002-n.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Exceptions/catchguard-002-n.js
new file mode 100644
index 0000000..4446dd4
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Exceptions/catchguard-002-n.js
@@ -0,0 +1,46 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ * Rob Ginda rginda@netscape.com
+ */
+
+function test()
+{
+ enterFunc ("test");
+
+ var EXCEPTION_DATA = "String exception";
+ var e;
+
+ printStatus ("Catchguard var declaration negative test.");
+
+ try
+ {
+ throw EXCEPTION_DATA;
+ }
+ catch (var e)
+ {
+
+ }
+
+ reportFailure ("var in catch clause should have caused an error.");
+
+ exitFunc ("test");
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Exceptions/catchguard-002.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Exceptions/catchguard-002.js
new file mode 100644
index 0000000..4e89078
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Exceptions/catchguard-002.js
@@ -0,0 +1,60 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ * Rob Ginda rginda@netscape.com
+ */
+
+test();
+
+function test()
+{
+ enterFunc ("test");
+
+ var EXCEPTION_DATA = "String exception";
+ var e;
+ var caught = false;
+
+ printStatus ("Basic catchguard test.");
+
+ try
+ {
+ throw EXCEPTION_DATA;
+ }
+ catch (e if true)
+ {
+ caught = true;
+ }
+ catch (e if true)
+ {
+ reportFailure ("Second (e if true) catch block should not have " +
+ "executed.");
+ }
+ catch (e)
+ {
+ reportFailure ("Catch block (e) should not have executed.");
+ }
+
+ if (!caught)
+ reportFailure ("Execption was never caught.");
+
+
+ exitFunc ("test");
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Exceptions/catchguard-003-n.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Exceptions/catchguard-003-n.js
new file mode 100644
index 0000000..b5fca02
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Exceptions/catchguard-003-n.js
@@ -0,0 +1,53 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ * Rob Ginda rginda@netscape.com
+ */
+
+test();
+
+function test()
+{
+ enterFunc ("test");
+
+ var EXCEPTION_DATA = "String exception";
+ var e;
+
+ printStatus ("Catchguard syntax negative test #2.");
+
+ try
+ {
+ throw EXCEPTION_DATA;
+ }
+ catch (e)
+ {
+
+ }
+ catch (e) /* two non-guarded catch statements shoud generate an error */
+ {
+
+ }
+
+ reportFailure ("Illegally constructed catchguard should have thrown " +
+ "an exception.");
+
+ exitFunc ("test");
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Exceptions/catchguard-003.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Exceptions/catchguard-003.js
new file mode 100644
index 0000000..2cb64a6
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Exceptions/catchguard-003.js
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ * Rob Ginda rginda@netscape.com
+ */
+
+test();
+
+function test()
+{
+ enterFunc ("test");
+
+ var EXCEPTION_DATA = "String exception";
+ var e = "foo", x = "foo";
+ var caught = false;
+
+ printStatus ("Catchguard 'Common Scope' test.");
+
+ try
+ {
+ throw EXCEPTION_DATA;
+ }
+ catch (e if ((x = 1) && false))
+ {
+ reportFailure ("Catch block (e if ((x = 1) && false) should not " +
+ "have executed.");
+ }
+ catch (e if (x == 1))
+ {
+ caught = true;
+ }
+ catch (e)
+ {
+ reportFailure ("Same scope should be used across all catchguards.");
+ }
+
+ if (!caught)
+ reportFailure ("Execption was never caught.");
+
+ if (e != "foo")
+ reportFailure ("Exception data modified inside catch() scope should " +
+ "not be visible in the function scope (e ='" +
+ e + "'.)");
+
+ if (x != 1)
+ reportFailure ("Data modified in 'catchguard expression' should " +
+ "be visible in the function scope (x = '" +
+ x + "'.)");
+
+ exitFunc ("test");
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Exceptions/errstack-001.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Exceptions/errstack-001.js
new file mode 100644
index 0000000..4850d20
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Exceptions/errstack-001.js
@@ -0,0 +1,274 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2002
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): brendan@mozilla.org, pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 28 Feb 2002
+* SUMMARY: Testing that Error.stack distinguishes between:
+*
+* A) top-level calls: myFunc();
+* B) no-name function calls: function() { myFunc();} ()
+*
+* The stack frame for A) should begin with '@'
+* The stack frame for B) should begin with '()'
+*
+* This behavior was coded by Brendan during his fix for bug 127136.
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=127136#c13
+*
+* Note: our function getStackFrames(err) orders the array of stack frames
+* so that the 0th element will correspond to the highest frame, i.e. will
+* correspond to a line in top-level code. The 1st element will correspond
+* to the function that is called first, and so on...
+*
+* NOTE: At present Rhino does not have an Error.stack property. It is an
+* ECMA extension, see http://bugzilla.mozilla.org/show_bug.cgi?id=123177
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = '(none)';
+var summary = 'Testing Error.stack';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+var myErr = '';
+var stackFrames = '';
+
+
+function A(x,y)
+{
+ return B(x+1,y+1);
+}
+
+function B(x,z)
+{
+ return C(x+1,z+1);
+}
+
+function C(x,y)
+{
+ return D(x+1,y+1);
+}
+
+function D(x,z)
+{
+ try
+ {
+ throw new Error('meep!');
+ }
+ catch (e)
+ {
+ return e;
+ }
+}
+
+
+myErr = A(44,13);
+stackFrames = getStackFrames(myErr);
+ status = inSection(1);
+ actual = stackFrames[0].substring(0,1);
+ expect = '@';
+ addThis();
+
+ status = inSection(2);
+ actual = stackFrames[1].substring(0,9);
+ expect = 'A(44,13)@';
+ addThis();
+
+ status = inSection(3);
+ actual = stackFrames[2].substring(0,9);
+ expect = 'B(45,14)@';
+ addThis();
+
+ status = inSection(4);
+ actual = stackFrames[3].substring(0,9);
+ expect = 'C(46,15)@';
+ addThis();
+
+ status = inSection(5);
+ actual = stackFrames[4].substring(0,9);
+ expect = 'D(47,16)@';
+ addThis();
+
+
+
+myErr = A('44:foo','13:bar');
+stackFrames = getStackFrames(myErr);
+ status = inSection(6);
+ actual = stackFrames[0].substring(0,1);
+ expect = '@';
+ addThis();
+
+ status = inSection(7);
+ actual = stackFrames[1].substring(0,21);
+ expect = 'A("44:foo","13:bar")@';
+ addThis();
+
+ status = inSection(8);
+ actual = stackFrames[2].substring(0,23);
+ expect = 'B("44:foo1","13:bar1")@';
+ addThis();
+
+ status = inSection(9);
+ actual = stackFrames[3].substring(0,25);
+ expect = 'C("44:foo11","13:bar11")@';
+ addThis();
+
+ status = inSection(10);
+ actual = stackFrames[4].substring(0,27);
+ expect = 'D("44:foo111","13:bar111")@';;
+ addThis();
+
+
+
+/*
+ * Make the first frame occur in a function with an empty name -
+ */
+myErr = function() { return A(44,13); } ();
+stackFrames = getStackFrames(myErr);
+ status = inSection(11);
+ actual = stackFrames[0].substring(0,1);
+ expect = '@';
+ addThis();
+
+ status = inSection(12);
+ actual = stackFrames[1].substring(0,3);
+ expect = '()@';
+ addThis();
+
+ status = inSection(13);
+ actual = stackFrames[2].substring(0,9);
+ expect = 'A(44,13)@';
+ addThis();
+
+// etc. for the rest of the frames as above
+
+
+
+/*
+ * Make the first frame occur in a function with name 'anonymous' -
+ */
+var f = Function('return A(44,13);');
+myErr = f();
+stackFrames = getStackFrames(myErr);
+ status = inSection(14);
+ actual = stackFrames[0].substring(0,1);
+ expect = '@';
+ addThis();
+
+ status = inSection(15);
+ actual = stackFrames[1].substring(0,12);
+ expect = 'anonymous()@';
+ addThis();
+
+ status = inSection(16);
+ actual = stackFrames[2].substring(0,9);
+ expect = 'A(44,13)@';
+ addThis();
+
+// etc. for the rest of the frames as above
+
+
+
+/*
+ * Make a user-defined error via the Error() function -
+ */
+var message = 'Hi there!'; var fileName = 'file name'; var lineNumber = 0;
+myErr = Error(message, fileName, lineNumber);
+stackFrames = getStackFrames(myErr);
+ status = inSection(17);
+ actual = stackFrames[0].substring(0,1);
+ expect = '@';
+ addThis();
+
+
+/*
+ * Now use the |new| keyword. Re-use the same params -
+ */
+myErr = new Error(message, fileName, lineNumber);
+stackFrames = getStackFrames(myErr);
+ status = inSection(18);
+ actual = stackFrames[0].substring(0,1);
+ expect = '@';
+ addThis();
+
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+/*
+ * Split the string |err.stack| along its '\n' delimiter.
+ * As of 2002-02-28 |err.stack| ends with the delimiter, so
+ * the resulting array has an empty string as its last element.
+ *
+ * Pop that useless element off before doing anything.
+ * Then reverse the array, for convenience of indexing -
+ */
+function getStackFrames(err)
+{
+ var arr = err.stack.split('\n');
+ arr.pop();
+ return arr.reverse();
+}
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Exceptions/regress-121658.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Exceptions/regress-121658.js
new file mode 100644
index 0000000..7328749
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Exceptions/regress-121658.js
@@ -0,0 +1,152 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2002
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): timeless@mac.com,pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 24 Jan 2002
+* SUMMARY: "Too much recursion" errors should be safely caught by try...catch
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=121658
+*
+* In the cases below, we expect i>0. The bug was filed because we were getting
+* i===0; i.e. |i| did not retain the value it had at the location of the error.
+*
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 121658;
+var msg = '"Too much recursion" errors should be safely caught by try...catch';
+var TEST_PASSED = 'i retained the value it had at location of error';
+var TEST_FAILED = 'i did NOT retain this value';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+var i;
+
+
+function f()
+{
+ ++i;
+
+ // try...catch should catch the "too much recursion" error to ensue
+ try
+ {
+ f();
+ }
+ catch(e)
+ {
+ }
+}
+
+i=0;
+f();
+status = inSection(1);
+actual = (i>0);
+expect = true;
+addThis();
+
+
+
+// Now try in function scope -
+function g()
+{
+ f();
+}
+
+i=0;
+g();
+status = inSection(2);
+actual = (i>0);
+expect = true;
+addThis();
+
+
+
+// Now try in eval scope -
+var sEval = 'function h(){++i; try{h();} catch(e){}}; i=0; h();';
+eval(sEval);
+status = inSection(3);
+actual = (i>0);
+expect = true;
+addThis();
+
+
+
+// Try in eval scope and mix functions up -
+sEval = 'function a(){++i; try{h();} catch(e){}}; i=0; a();';
+eval(sEval);
+status = inSection(4);
+actual = (i>0);
+expect = true;
+addThis();
+
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = formatThis(actual);
+ expectedvalues[UBound] = formatThis(expect);
+ UBound++;
+}
+
+
+function formatThis(bool)
+{
+ return bool? TEST_PASSED : TEST_FAILED;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(msg);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Exceptions/regress-123002.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Exceptions/regress-123002.js
new file mode 100644
index 0000000..aee6893
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Exceptions/regress-123002.js
@@ -0,0 +1,129 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2002
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 01 Feb 2002
+* SUMMARY: Testing Error.length
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=123002
+*
+* NOTE: Error.length should equal the length of FormalParameterList of the
+* Error constructor. This is currently 1 in Rhino, 3 in SpiderMonkey.
+*
+* The difference is due to http://bugzilla.mozilla.org/show_bug.cgi?id=50447.
+* As a result of that bug, SpiderMonkey has extended ECMA to allow two new
+* parameters to Error constructors:
+*
+* Rhino: new Error (message)
+* SpiderMonkey: new Error (message, fileName, lineNumber)
+*
+* NOTE: since we have hard-coded the length expectations, this testcase will
+* have to be changed if the Error FormalParameterList is ever changed again.
+*
+* To do this, just change the two LENGTH constants below -
+*/
+//-----------------------------------------------------------------------------
+var LENGTH_RHINO = 1;
+var LENGTH_SPIDERMONKEY = 3;
+var UBound = 0;
+var bug = 123002;
+var summary = 'Testing Error.length';
+var QUOTE = '"';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+/*
+ * Are we in Rhino or SpiderMonkey?
+ */
+// var LENGTH_EXPECTED = inRhino()? LENGTH_RHINO : LENGTH_SPIDERMONKEY;
+// ECMA spec says length should be 1
+var LENGTH_EXPECTED = 1;
+
+/*
+ * The various NativeError objects; see ECMA-262 Edition 3, Section 15.11.6
+ */
+var errObjects = [new Error(), new EvalError(), new RangeError(),
+new ReferenceError(), new SyntaxError(), new TypeError(), new URIError()];
+
+
+for (var i in errObjects)
+{
+ var err = errObjects[i];
+ status = inSection(quoteThis(err.name));
+ actual = Error.length;
+ expect = LENGTH_EXPECTED;
+ addThis();
+}
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
+
+
+function quoteThis(text)
+{
+ return QUOTE + text + QUOTE;
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Exceptions/regress-50447.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Exceptions/regress-50447.js
new file mode 100644
index 0000000..0133e88
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Exceptions/regress-50447.js
@@ -0,0 +1,146 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS
+* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+* implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is Mozilla Communicator client code, released March
+* 31, 1998.
+*
+* The Initial Developer of the Original Code is Netscape Communications
+* Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation. All
+* Rights Reserved.
+*
+* Contributor(s): Rob Ginda rginda@netscape.com
+*
+* SUMMARY: New properties fileName, lineNumber have been added to Error objects
+* in SpiderMonkey. These are non-ECMA extensions and do not exist in Rhino.
+*
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=50447
+*/
+//-----------------------------------------------------------------------------
+var bug = 50447;
+var summary = 'Test (non-ECMA) Error object properties fileName, lineNumber';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ testRealError();
+ test1();
+ test2();
+ test3();
+ test4();
+
+ exitFunc('test');
+}
+
+
+function testRealError()
+{
+ /* throw a real error, and see what it looks like */
+ enterFunc ("testRealError");
+
+ try
+ {
+ blabla;
+ }
+ catch (e)
+ {
+ if (e.fileName.search (/-50447\.js$/i) == -1)
+ reportFailure ("expected fileName to end with '-50447.js'");
+
+ reportCompare (61, e.lineNumber,
+ "lineNumber property returned unexpected value.");
+ }
+
+ exitFunc ("testRealError");
+}
+
+
+function test1()
+{
+ /* generate an error with msg, file, and lineno properties */
+ enterFunc ("test1");
+
+ var e = new InternalError ("msg", "file", 2);
+ reportCompare ("(new InternalError(\"msg\", \"file\", 2))",
+ e.toSource(),
+ "toSource() returned unexpected result.");
+ reportCompare ("file", e.fileName,
+ "fileName property returned unexpected value.");
+ reportCompare (2, e.lineNumber,
+ "lineNumber property returned unexpected value.");
+
+ exitFunc ("test1");
+}
+
+
+function test2()
+{
+ /* generate an error with only msg property */
+ enterFunc ("test2");
+
+ var e = new InternalError ("msg");
+ reportCompare ("(new InternalError(\"msg\", \"\"))",
+ e.toSource(),
+ "toSource() returned unexpected result.");
+ reportCompare ("", e.fileName,
+ "fileName property returned unexpected value.");
+ reportCompare (0, e.lineNumber,
+ "lineNumber property returned unexpected value.");
+
+ exitFunc ("test2");
+}
+
+
+function test3()
+{
+ /* generate an error with only msg and lineNo properties */
+ enterFunc ("test3");
+
+ var e = new InternalError ("msg");
+ e.lineNumber = 10;
+ reportCompare ("(new InternalError(\"msg\", \"\", 10))",
+ e.toSource(),
+ "toSource() returned unexpected result.");
+ reportCompare ("", e.fileName,
+ "fileName property returned unexpected value.");
+ reportCompare (10, e.lineNumber,
+ "lineNumber property returned unexpected value.");
+
+ exitFunc ("test3");
+}
+
+
+function test4()
+{
+ /* generate an error with only msg and filename properties */
+ enterFunc ("test4");
+
+ var e = new InternalError ("msg", "file");
+ reportCompare ("(new InternalError(\"msg\", \"file\"))",
+ e.toSource(),
+ "toSource() returned unexpected result.");
+ reportCompare ("file", e.fileName,
+ "fileName property returned unexpected value.");
+ reportCompare (0, e.lineNumber,
+ "lineNumber property returned unexpected value.");
+
+ exitFunc ("test4");
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Expressions/regress-192288.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Expressions/regress-192288.js
new file mode 100644
index 0000000..830ec7d
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Expressions/regress-192288.js
@@ -0,0 +1,114 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2003
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): igor@icesoft.no, pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 07 February 2003
+* SUMMARY: Testing 0/0 inside functions
+*
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=192288
+*
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 192288;
+var summary = 'Testing 0/0 inside functions ';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+function f()
+{
+ return 0/0;
+}
+
+status = inSection(1);
+actual = isNaN(f());
+expect = true;
+addThis();
+
+status = inSection(2);
+actual = isNaN(f.apply(this));
+expect = true;
+addThis();
+
+status = inSection(3);
+actual = isNaN(eval("f.apply(this)"));
+expect = true;
+addThis();
+
+status = inSection(4);
+actual = isNaN(Function('return 0/0;')());
+expect = true;
+addThis();
+
+status = inSection(5);
+actual = isNaN(eval("Function('return 0/0;')()"));
+expect = true;
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Expressions/regress-96526-argsub.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Expressions/regress-96526-argsub.js
new file mode 100644
index 0000000..13806bb
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Expressions/regress-96526-argsub.js
@@ -0,0 +1,120 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2002
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): brendan@mozilla.org, pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 29 Oct 2002
+* SUMMARY: Testing "use" and "set" operations on expressions like a[i][j][k]
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=96526#c52
+*
+* Brendan: "The idea is to cover all the 'use' and 'set' (as in modify)
+* operations you can do on an expression like a[i][j][k], including variations
+* where you replace |a| with arguments (literally) and |i| with 0, 1, 2, etc.
+* (to hit the optimization for arguments[0]... that uses JSOP_ARGSUB)."
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 96526;
+var summary = 'Testing "use" and "set" ops on expressions like a[i][j][k]';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+var z='magic';
+Number.prototype.magic=42;
+
+status = inSection(1);
+actual = f(2,1,[1,2,[3,4]]);
+expect = 42;
+addThis();
+
+
+function f(j,k)
+{
+ status = inSection(2);
+ actual = formatArray(arguments[2]);
+ expect = formatArray([1,2,[3,4]]);
+ addThis();
+
+ status = inSection(3);
+ actual = formatArray(arguments[2][j]);
+ expect = formatArray([3,4]);
+ addThis();
+
+ status = inSection(4);
+ actual = arguments[2][j][k];
+ expect = 4;
+ addThis();
+
+ status = inSection(5);
+ actual = arguments[2][j][k][z];
+ expect = 42;
+ addThis();
+
+ return arguments[2][j][k][z];
+}
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Expressions/regress-96526-delelem.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Expressions/regress-96526-delelem.js
new file mode 100644
index 0000000..940bd79
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Expressions/regress-96526-delelem.js
@@ -0,0 +1,120 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2002
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): brendan@mozilla.org, pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 29 Oct 2002
+* SUMMARY: Testing "use" and "set" operations on expressions like a[i][j][k]
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=96526#c52
+*
+* Brendan: "The idea is to cover all the 'use' and 'set' (as in modify)
+* operations you can do on an expression like a[i][j][k], including variations
+* where you replace |a| with arguments (literally) and |i| with 0, 1, 2, etc.
+* (to hit the optimization for arguments[0]... that uses JSOP_ARGSUB)."
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 96526;
+var summary = 'Testing "use" and "set" ops on expressions like a[i][j][k]';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+var z='magic';
+Number.prototype.magic=42;
+f(2,1,[-1,0,[1,2,[3,4]]]);
+
+function f(j,k,a)
+{
+ status = inSection(1);
+ actual = formatArray(a[2]);
+ expect = formatArray([1,2,[3,4]]);
+ addThis();
+
+ status = inSection(2);
+ actual = formatArray(a[2][j]);
+ expect = formatArray([3,4]);
+ addThis();
+
+ status = inSection(3);
+ actual = a[2][j][k];
+ expect = 4;
+ addThis();
+
+ status = inSection(4);
+ actual = a[2][j][k][z];
+ expect = 42;
+ addThis();
+
+ delete a[2][j][k];
+
+ status = inSection(5);
+ actual = formatArray(a[2][j]);
+ expect = formatArray([3, undefined]);
+ addThis();
+}
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Expressions/regress-96526-noargsub.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Expressions/regress-96526-noargsub.js
new file mode 100644
index 0000000..33c28a3
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Expressions/regress-96526-noargsub.js
@@ -0,0 +1,120 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2002
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): brendan@mozilla.org, pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 29 Oct 2002
+* SUMMARY: Testing "use" and "set" operations on expressions like a[i][j][k]
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=96526#c52
+*
+* Brendan: "The idea is to cover all the 'use' and 'set' (as in modify)
+* operations you can do on an expression like a[i][j][k], including variations
+* where you replace |a| with arguments (literally) and |i| with 0, 1, 2, etc.
+* (to hit the optimization for arguments[0]... that uses JSOP_ARGSUB)."
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 96526;
+var summary = 'Testing "use" and "set" ops on expressions like a[i][j][k]';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+var z='magic';
+Number.prototype.magic=42;
+
+status = inSection(1);
+actual = f(2,1,[-1,0,[1,2,[3,4]]]);
+expect = 42;
+addThis();
+
+
+function f(j,k,a)
+{
+ status = inSection(2);
+ actual = formatArray(a[2]);
+ expect = formatArray([1,2,[3,4]]);
+ addThis();
+
+ status = inSection(3);
+ actual = formatArray(a[2][j]);
+ expect = formatArray([3,4]);
+ addThis();
+
+ status = inSection(4);
+ actual = a[2][j][k];
+ expect = 4;
+ addThis();
+
+ status = inSection(5);
+ actual = a[2][j][k][z];
+ expect = 42;
+ addThis();
+
+ return a[2][j][k][z];
+}
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Expressions/shell.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Expressions/shell.js
new file mode 100644
index 0000000..83cf771
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Expressions/shell.js
@@ -0,0 +1,113 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS"
+* basis, WITHOUT WARRANTY OF ANY KIND, either expressed
+* or implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation.
+* All Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+* Date: 07 February 2001
+*
+* Functionality common to Array testing -
+*/
+//-------------------------------------------------------------------------------------------------
+var CHAR_LBRACKET = '[';
+var CHAR_RBRACKET = ']';
+var CHAR_QT_DBL = '"';
+var CHAR_QT = "'";
+var CHAR_NL = '\n';
+var CHAR_COMMA = ',';
+var CHAR_SPACE = ' ';
+var TYPE_STRING = typeof 'abc';
+
+
+/*
+ * If available, arr.toSource() gives more detail than arr.toString()
+ *
+ * var arr = Array(1,2,'3');
+ *
+ * arr.toSource()
+ * [1, 2, "3"]
+ *
+ * arr.toString()
+ * 1,2,3
+ *
+ * But toSource() doesn't exist in Rhino, so use our own imitation, below -
+ *
+ */
+function formatArray(arr)
+{
+ try
+ {
+ return arr.toSource();
+ }
+ catch(e)
+ {
+ return toSource(arr);
+ }
+}
+
+
+
+/*
+ * Imitate SpiderMonkey's arr.toSource() method:
+ *
+ * a) Double-quote each array element that is of string type
+ * b) Represent |undefined| and |null| by empty strings
+ * c) Delimit elements by a comma + single space
+ * d) Do not add delimiter at the end UNLESS the last element is |undefined|
+ * e) Add square brackets to the beginning and end of the string
+ */
+function toSource(arr)
+{
+ var delim = CHAR_COMMA + CHAR_SPACE;
+ var elt = '';
+ var ret = '';
+ var len = arr.length;
+
+ for (i=0; i<len; i++)
+ {
+ elt = arr[i];
+
+ switch(true)
+ {
+ case (typeof elt === TYPE_STRING) :
+ ret += doubleQuote(elt);
+ break;
+
+ case (elt === undefined || elt === null) :
+ break; // add nothing but the delimiter, below -
+
+ default:
+ ret += elt.toString();
+ }
+
+ if ((i < len-1) || (elt === undefined))
+ ret += delim;
+ }
+
+ return CHAR_LBRACKET + ret + CHAR_RBRACKET;
+}
+
+
+function doubleQuote(text)
+{
+ return CHAR_QT_DBL + text + CHAR_QT_DBL;
+}
+
+
+function singleQuote(text)
+{
+ return CHAR_QT + text + CHAR_QT;
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/GetSet/getset-001.js b/Source/JavaScriptCore/tests/mozilla/js1_5/GetSet/getset-001.js
new file mode 100644
index 0000000..2331398
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/GetSet/getset-001.js
@@ -0,0 +1,72 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ * Rob Ginda rginda@netscape.com
+ */
+
+function TestObject ()
+{
+ /* A warm, dry place for properties and methods to live */
+}
+
+TestObject.prototype._y = "<initial y>";
+
+TestObject.prototype.y getter =
+function get_y ()
+{
+ var rv;
+
+ if (typeof this._y == "string")
+ rv = "got " + this._y;
+ else
+ rv = this._y;
+
+ return rv;
+}
+
+TestObject.prototype.y setter =
+function set_y (newVal)
+{
+ this._y = newVal;
+}
+
+test(new TestObject());
+
+function test(t)
+{
+ enterFunc ("test");
+
+ printStatus ("Basic Getter/ Setter test");
+ reportCompare ("<initial y>", t._y, "y prototype check");
+
+ reportCompare ("got <initial y>", t.y, "y getter, before set");
+
+ t.y = "new y";
+ reportCompare ("got new y", t.y, "y getter, after set");
+
+ t.y = 2;
+ reportCompare (2, t.y, "y getter, after numeric set");
+
+ var d = new Date();
+ t.y = d;
+ reportCompare (d, t.y, "y getter, after date set");
+
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/GetSet/getset-002.js b/Source/JavaScriptCore/tests/mozilla/js1_5/GetSet/getset-002.js
new file mode 100644
index 0000000..07d32ed
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/GetSet/getset-002.js
@@ -0,0 +1,68 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ * Rob Ginda rginda@netscape.com
+ */
+
+var t = {
+ _y: "<initial y>",
+
+ y getter: function get_y ()
+ {
+ var rv;
+ if (typeof this._y == "string")
+ rv = "got " + this._y;
+ else
+ rv = this._y;
+
+ return rv;
+ },
+
+ y setter: function set_y (newVal)
+ {
+ this._y = newVal;
+ }
+}
+
+
+test(t);
+
+function test(t)
+{
+ enterFunc ("test");
+
+ printStatus ("Basic Getter/ Setter test (object literal notation)");
+
+ reportCompare ("<initial y>", t._y, "y prototype check");
+
+ reportCompare ("got <initial y>", t.y, "y getter, before set");
+
+ t.y = "new y";
+ reportCompare ("got new y", t.y, "y getter, after set");
+
+ t.y = 2;
+ reportCompare (2, t.y, "y getter, after numeric set");
+
+ var d = new Date();
+ t.y = d;
+ reportCompare (d, t.y, "y getter, after date set");
+
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/GetSet/getset-003.js b/Source/JavaScriptCore/tests/mozilla/js1_5/GetSet/getset-003.js
new file mode 100644
index 0000000..952d3d7
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/GetSet/getset-003.js
@@ -0,0 +1,190 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS"
+* basis, WITHOUT WARRANTY OF ANY KIND, either expressed
+* or implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation. All
+* Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+* Date: 14 April 2001
+*
+* SUMMARY: Testing obj.prop getter/setter
+* Note: this is a non-ECMA extension to the language.
+*/
+//-------------------------------------------------------------------------------------------------
+var UBound = 0;
+var bug = '(none)';
+var summary = 'Testing obj.prop getter/setter';
+var statprefix = 'Status: ';
+var status = '';
+var statusitems = [ ];
+var actual = '';
+var actualvalues = [ ];
+var expect= '';
+var expectedvalues = [ ];
+var cnDEFAULT = 'default name';
+var cnFRED = 'Fred';
+var obj = {};
+var obj2 = {};
+var s = '';
+
+
+// SECTION1: define getter/setter directly on an object (not its prototype)
+obj = new Object();
+obj.nameSETS = 0;
+obj.nameGETS = 0;
+obj.name setter = function(newValue) {this._name=newValue; this.nameSETS++;}
+obj.name getter = function() {this.nameGETS++; return this._name;}
+
+status = 'In SECTION1 of test after 0 sets, 0 gets';
+actual = [obj.nameSETS,obj.nameGETS];
+expect = [0,0];
+addThis();
+
+s = obj.name;
+status = 'In SECTION1 of test after 0 sets, 1 get';
+actual = [obj.nameSETS,obj.nameGETS];
+expect = [0,1];
+addThis();
+
+obj.name = cnFRED;
+status = 'In SECTION1 of test after 1 set, 1 get';
+actual = [obj.nameSETS,obj.nameGETS];
+expect = [1,1];
+addThis();
+
+obj.name = obj.name;
+status = 'In SECTION1 of test after 2 sets, 2 gets';
+actual = [obj.nameSETS,obj.nameGETS];
+expect = [2,2];
+addThis();
+
+
+// SECTION2: define getter/setter in Object.prototype
+Object.prototype.nameSETS = 0;
+Object.prototype.nameGETS = 0;
+Object.prototype.name setter = function(newValue) {this._name=newValue; this.nameSETS++;}
+Object.prototype.name getter = function() {this.nameGETS++; return this._name;}
+
+obj = new Object();
+status = 'In SECTION2 of test after 0 sets, 0 gets';
+actual = [obj.nameSETS,obj.nameGETS];
+expect = [0,0];
+addThis();
+
+s = obj.name;
+status = 'In SECTION2 of test after 0 sets, 1 get';
+actual = [obj.nameSETS,obj.nameGETS];
+expect = [0,1];
+addThis();
+
+obj.name = cnFRED;
+status = 'In SECTION2 of test after 1 set, 1 get';
+actual = [obj.nameSETS,obj.nameGETS];
+expect = [1,1];
+addThis();
+
+obj.name = obj.name;
+status = 'In SECTION2 of test after 2 sets, 2 gets';
+actual = [obj.nameSETS,obj.nameGETS];
+expect = [2,2];
+addThis();
+
+
+// SECTION 3: define getter/setter in prototype of user-defined constructor
+function TestObject()
+{
+}
+TestObject.prototype.nameSETS = 0;
+TestObject.prototype.nameGETS = 0;
+TestObject.prototype.name setter = function(newValue) {this._name=newValue; this.nameSETS++;}
+TestObject.prototype.name getter = function() {this.nameGETS++; return this._name;}
+TestObject.prototype.name = cnDEFAULT;
+
+obj = new TestObject();
+status = 'In SECTION3 of test after 1 set, 0 gets'; // (we set a default value in the prototype)
+actual = [obj.nameSETS,obj.nameGETS];
+expect = [1,0];
+addThis();
+
+s = obj.name;
+status = 'In SECTION3 of test after 1 set, 1 get';
+actual = [obj.nameSETS,obj.nameGETS];
+expect = [1,1];
+addThis();
+
+obj.name = cnFRED;
+status = 'In SECTION3 of test after 2 sets, 1 get';
+actual = [obj.nameSETS,obj.nameGETS];
+expect = [2,1];
+addThis();
+
+obj.name = obj.name;
+status = 'In SECTION3 of test after 3 sets, 2 gets';
+actual = [obj.nameSETS,obj.nameGETS];
+expect = [3,2];
+addThis();
+
+obj2 = new TestObject();
+status = 'obj2 = new TestObject() after 1 set, 0 gets';
+actual = [obj2.nameSETS,obj2.nameGETS];
+expect = [1,0]; // we set a default value in the prototype -
+addThis();
+
+// Use both obj and obj2 -
+obj2.name = obj.name + obj2.name;
+ status = 'obj2 = new TestObject() after 2 sets, 1 get';
+ actual = [obj2.nameSETS,obj2.nameGETS];
+ expect = [2,1];
+ addThis();
+
+ status = 'In SECTION3 of test after 3 sets, 3 gets';
+ actual = [obj.nameSETS,obj.nameGETS];
+ expect = [3,3]; // we left off at [3,2] above -
+ addThis();
+
+
+//---------------------------------------------------------------------------------
+test();
+//---------------------------------------------------------------------------------
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual.toString();
+ expectedvalues[UBound] = expect.toString();
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ for (var i = 0; i < UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], getStatus(i));
+ }
+
+ exitFunc ('test');
+}
+
+
+function getStatus(i)
+{
+ return statprefix + statusitems[i];
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/GetSet/getset-004.js b/Source/JavaScriptCore/tests/mozilla/js1_5/GetSet/getset-004.js
new file mode 100644
index 0000000..4445e80
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/GetSet/getset-004.js
@@ -0,0 +1,190 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS"
+* basis, WITHOUT WARRANTY OF ANY KIND, either expressed
+* or implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation. All
+* Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+* Date: 14 April 2001
+*
+* SUMMARY: Testing obj.__defineSetter__(), obj.__defineGetter__()
+* Note: this is a non-ECMA language extension
+*/
+//-------------------------------------------------------------------------------------------------
+var UBound = 0;
+var bug = '(none)';
+var summary = 'Testing obj.__defineSetter__(), obj.__defineGetter__()';
+var statprefix = 'Status: ';
+var status = '';
+var statusitems = [ ];
+var actual = '';
+var actualvalues = [ ];
+var expect= '';
+var expectedvalues = [ ];
+var cnDEFAULT = 'default name';
+var cnFRED = 'Fred';
+var obj = {};
+var obj2 = {};
+var s = '';
+
+
+// SECTION1: define getter/setter directly on an object (not its prototype)
+obj = new Object();
+obj.nameSETS = 0;
+obj.nameGETS = 0;
+obj.__defineSetter__('name', function(newValue) {this._name=newValue; this.nameSETS++;});
+obj.__defineGetter__('name', function() {this.nameGETS++; return this._name;});
+
+status = 'In SECTION1 of test after 0 sets, 0 gets';
+actual = [obj.nameSETS,obj.nameGETS];
+expect = [0,0];
+addThis();
+
+s = obj.name;
+status = 'In SECTION1 of test after 0 sets, 1 get';
+actual = [obj.nameSETS,obj.nameGETS];
+expect = [0,1];
+addThis();
+
+obj.name = cnFRED;
+status = 'In SECTION1 of test after 1 set, 1 get';
+actual = [obj.nameSETS,obj.nameGETS];
+expect = [1,1];
+addThis();
+
+obj.name = obj.name;
+status = 'In SECTION1 of test after 2 sets, 2 gets';
+actual = [obj.nameSETS,obj.nameGETS];
+expect = [2,2];
+addThis();
+
+
+// SECTION2: define getter/setter in Object.prototype
+Object.prototype.nameSETS = 0;
+Object.prototype.nameGETS = 0;
+Object.prototype.__defineSetter__('name', function(newValue) {this._name=newValue; this.nameSETS++;});
+Object.prototype.__defineGetter__('name', function() {this.nameGETS++; return this._name;});
+
+obj = new Object();
+status = 'In SECTION2 of test after 0 sets, 0 gets';
+actual = [obj.nameSETS,obj.nameGETS];
+expect = [0,0];
+addThis();
+
+s = obj.name;
+status = 'In SECTION2 of test after 0 sets, 1 get';
+actual = [obj.nameSETS,obj.nameGETS];
+expect = [0,1];
+addThis();
+
+obj.name = cnFRED;
+status = 'In SECTION2 of test after 1 set, 1 get';
+actual = [obj.nameSETS,obj.nameGETS];
+expect = [1,1];
+addThis();
+
+obj.name = obj.name;
+status = 'In SECTION2 of test after 2 sets, 2 gets';
+actual = [obj.nameSETS,obj.nameGETS];
+expect = [2,2];
+addThis();
+
+
+// SECTION 3: define getter/setter in prototype of user-defined constructor
+function TestObject()
+{
+}
+TestObject.prototype.nameSETS = 0;
+TestObject.prototype.nameGETS = 0;
+TestObject.prototype.__defineSetter__('name', function(newValue) {this._name=newValue; this.nameSETS++;});
+TestObject.prototype.__defineGetter__('name', function() {this.nameGETS++; return this._name;});
+TestObject.prototype.name = cnDEFAULT;
+
+obj = new TestObject();
+status = 'In SECTION3 of test after 1 set, 0 gets'; // (we set a default value in the prototype)
+actual = [obj.nameSETS,obj.nameGETS];
+expect = [1,0];
+addThis();
+
+s = obj.name;
+status = 'In SECTION3 of test after 1 set, 1 get';
+actual = [obj.nameSETS,obj.nameGETS];
+expect = [1,1];
+addThis();
+
+obj.name = cnFRED;
+status = 'In SECTION3 of test after 2 sets, 1 get';
+actual = [obj.nameSETS,obj.nameGETS];
+expect = [2,1];
+addThis();
+
+obj.name = obj.name;
+status = 'In SECTION3 of test after 3 sets, 2 gets';
+actual = [obj.nameSETS,obj.nameGETS];
+expect = [3,2];
+addThis();
+
+obj2 = new TestObject();
+status = 'obj2 = new TestObject() after 1 set, 0 gets';
+actual = [obj2.nameSETS,obj2.nameGETS];
+expect = [1,0]; // we set a default value in the prototype -
+addThis();
+
+// Use both obj and obj2 -
+obj2.name = obj.name + obj2.name;
+ status = 'obj2 = new TestObject() after 2 sets, 1 get';
+ actual = [obj2.nameSETS,obj2.nameGETS];
+ expect = [2,1];
+ addThis();
+
+ status = 'In SECTION3 of test after 3 sets, 3 gets';
+ actual = [obj.nameSETS,obj.nameGETS];
+ expect = [3,3]; // we left off at [3,2] above -
+ addThis();
+
+
+//---------------------------------------------------------------------------------
+test();
+//---------------------------------------------------------------------------------
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual.toString();
+ expectedvalues[UBound] = expect.toString();
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ for (var i = 0; i < UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], getStatus(i));
+ }
+
+ exitFunc ('test');
+}
+
+
+function getStatus(i)
+{
+ return statprefix + statusitems[i];
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/GetSet/getset-005.js b/Source/JavaScriptCore/tests/mozilla/js1_5/GetSet/getset-005.js
new file mode 100644
index 0000000..c0e61f9
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/GetSet/getset-005.js
@@ -0,0 +1,199 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS"
+* basis, WITHOUT WARRANTY OF ANY KIND, either expressed
+* or implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation. All
+* Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+* Date: 14 April 2001
+*
+* SUMMARY: Testing obj.__defineSetter__(), obj.__defineGetter__()
+* Note: this is a non-ECMA language extension
+*
+* This test is the same as getset-004.js, except that here we
+* store the getter/setter functions in global variables.
+*/
+//-------------------------------------------------------------------------------------------------
+var UBound = 0;
+var bug = '(none)';
+var summary = 'Testing obj.__defineSetter__(), obj.__defineGetter__()';
+var statprefix = 'Status: ';
+var status = '';
+var statusitems = [ ];
+var actual = '';
+var actualvalues = [ ];
+var expect= '';
+var expectedvalues = [ ];
+var cnName = 'name';
+var cnDEFAULT = 'default name';
+var cnFRED = 'Fred';
+var obj = {};
+var obj2 = {};
+var s = '';
+
+
+// The getter/setter functions we'll use in all three sections below -
+var cnNameSetter = function(newValue) {this._name=newValue; this.nameSETS++;};
+var cnNameGetter = function() {this.nameGETS++; return this._name;};
+
+
+// SECTION1: define getter/setter directly on an object (not its prototype)
+obj = new Object();
+obj.nameSETS = 0;
+obj.nameGETS = 0;
+obj.__defineSetter__(cnName, cnNameSetter);
+obj.__defineGetter__(cnName, cnNameGetter);
+
+status = 'In SECTION1 of test after 0 sets, 0 gets';
+actual = [obj.nameSETS,obj.nameGETS];
+expect = [0,0];
+addThis();
+
+s = obj.name;
+status = 'In SECTION1 of test after 0 sets, 1 get';
+actual = [obj.nameSETS,obj.nameGETS];
+expect = [0,1];
+addThis();
+
+obj.name = cnFRED;
+status = 'In SECTION1 of test after 1 set, 1 get';
+actual = [obj.nameSETS,obj.nameGETS];
+expect = [1,1];
+addThis();
+
+obj.name = obj.name;
+status = 'In SECTION1 of test after 2 sets, 2 gets';
+actual = [obj.nameSETS,obj.nameGETS];
+expect = [2,2];
+addThis();
+
+
+// SECTION2: define getter/setter in Object.prototype
+Object.prototype.nameSETS = 0;
+Object.prototype.nameGETS = 0;
+Object.prototype.__defineSetter__(cnName, cnNameSetter);
+Object.prototype.__defineGetter__(cnName, cnNameGetter);
+
+obj = new Object();
+status = 'In SECTION2 of test after 0 sets, 0 gets';
+actual = [obj.nameSETS,obj.nameGETS];
+expect = [0,0];
+addThis();
+
+s = obj.name;
+status = 'In SECTION2 of test after 0 sets, 1 get';
+actual = [obj.nameSETS,obj.nameGETS];
+expect = [0,1];
+addThis();
+
+obj.name = cnFRED;
+status = 'In SECTION2 of test after 1 set, 1 get';
+actual = [obj.nameSETS,obj.nameGETS];
+expect = [1,1];
+addThis();
+
+obj.name = obj.name;
+status = 'In SECTION2 of test after 2 sets, 2 gets';
+actual = [obj.nameSETS,obj.nameGETS];
+expect = [2,2];
+addThis();
+
+
+// SECTION 3: define getter/setter in prototype of user-defined constructor
+function TestObject()
+{
+}
+TestObject.prototype.nameSETS = 0;
+TestObject.prototype.nameGETS = 0;
+TestObject.prototype.__defineSetter__(cnName, cnNameSetter);
+TestObject.prototype.__defineGetter__(cnName, cnNameGetter);
+TestObject.prototype.name = cnDEFAULT;
+
+obj = new TestObject();
+status = 'In SECTION3 of test after 1 set, 0 gets'; // (we set a default value in the prototype)
+actual = [obj.nameSETS,obj.nameGETS];
+expect = [1,0];
+addThis();
+
+s = obj.name;
+status = 'In SECTION3 of test after 1 set, 1 get';
+actual = [obj.nameSETS,obj.nameGETS];
+expect = [1,1];
+addThis();
+
+obj.name = cnFRED;
+status = 'In SECTION3 of test after 2 sets, 1 get';
+actual = [obj.nameSETS,obj.nameGETS];
+expect = [2,1];
+addThis();
+
+obj.name = obj.name;
+status = 'In SECTION3 of test after 3 sets, 2 gets';
+actual = [obj.nameSETS,obj.nameGETS];
+expect = [3,2];
+addThis();
+
+obj2 = new TestObject();
+status = 'obj2 = new TestObject() after 1 set, 0 gets';
+actual = [obj2.nameSETS,obj2.nameGETS];
+expect = [1,0]; // we set a default value in the prototype -
+addThis();
+
+// Use both obj and obj2 -
+obj2.name = obj.name + obj2.name;
+ status = 'obj2 = new TestObject() after 2 sets, 1 get';
+ actual = [obj2.nameSETS,obj2.nameGETS];
+ expect = [2,1];
+ addThis();
+
+ status = 'In SECTION3 of test after 3 sets, 3 gets';
+ actual = [obj.nameSETS,obj.nameGETS];
+ expect = [3,3]; // we left off at [3,2] above -
+ addThis();
+
+
+//---------------------------------------------------------------------------------
+test();
+//---------------------------------------------------------------------------------
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual.toString();
+ expectedvalues[UBound] = expect.toString();
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ for (var i = 0; i < UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], getStatus(i));
+ }
+
+ exitFunc ('test');
+}
+
+
+function getStatus(i)
+{
+ return statprefix + statusitems[i];
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/GetSet/getset-006.js b/Source/JavaScriptCore/tests/mozilla/js1_5/GetSet/getset-006.js
new file mode 100644
index 0000000..8d35bc9
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/GetSet/getset-006.js
@@ -0,0 +1,173 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS"
+* basis, WITHOUT WARRANTY OF ANY KIND, either expressed
+* or implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation. All
+* Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+* Date: 14 April 2001
+*
+* SUMMARY: Testing obj.__lookupGetter__(), obj.__lookupSetter__()
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=71992
+*
+* Brendan: "I see no need to provide more than the minimum:
+* o.__lookupGetter__('p') returns the getter function for o.p,
+* or undefined if o.p has no getter. Users can wrap and layer."
+*/
+//-------------------------------------------------------------------------------------------------
+var UBound = 0;
+var bug = 71992;
+var summary = 'Testing obj.__lookupGetter__(), obj.__lookupSetter__()';
+var statprefix = 'Status: ';
+var status = '';
+var statusitems = [ ];
+var actual = '';
+var actualvalues = [ ];
+var expect= '';
+var expectedvalues = [ ];
+var cnName = 'name';
+var cnColor = 'color';
+var cnNonExistingProp = 'ASDF_#_$%';
+var cnDEFAULT = 'default name';
+var cnFRED = 'Fred';
+var cnRED = 'red';
+var obj = {};
+var obj2 = {};
+var s;
+
+
+// The only setter and getter functions we'll use in the three sections below -
+var cnNameSetter = function(newValue) {this._name=newValue; this.nameSETS++;};
+var cnNameGetter = function() {this.nameGETS++; return this._name;};
+
+
+
+// SECTION1: define getter/setter directly on an object (not its prototype)
+obj = new Object();
+obj.nameSETS = 0;
+obj.nameGETS = 0;
+obj.__defineSetter__(cnName, cnNameSetter);
+obj.__defineGetter__(cnName, cnNameGetter);
+obj.name = cnFRED;
+obj.color = cnRED;
+
+status ='In SECTION1 of test; looking up extant getter/setter';
+actual = [obj.__lookupSetter__(cnName), obj.__lookupGetter__(cnName)];
+expect = [cnNameSetter, cnNameGetter];
+addThis();
+
+status = 'In SECTION1 of test; looking up nonexistent getter/setter';
+actual = [obj.__lookupSetter__(cnColor), obj.__lookupGetter__(cnColor)];
+expect = [undefined, undefined];
+addThis();
+
+status = 'In SECTION1 of test; looking up getter/setter on nonexistent property';
+actual = [obj.__lookupSetter__(cnNonExistingProp), obj.__lookupGetter__(cnNonExistingProp)];
+expect = [undefined, undefined];
+addThis();
+
+
+
+// SECTION2: define getter/setter in Object.prototype
+Object.prototype.nameSETS = 0;
+Object.prototype.nameGETS = 0;
+Object.prototype.__defineSetter__(cnName, cnNameSetter);
+Object.prototype.__defineGetter__(cnName, cnNameGetter);
+
+obj = new Object();
+obj.name = cnFRED;
+obj.color = cnRED;
+
+status = 'In SECTION2 of test looking up extant getter/setter';
+actual = [obj.__lookupSetter__(cnName), obj.__lookupGetter__(cnName)];
+expect = [cnNameSetter, cnNameGetter];
+addThis();
+
+status = 'In SECTION2 of test; looking up nonexistent getter/setter';
+actual = [obj.__lookupSetter__(cnColor), obj.__lookupGetter__(cnColor)];
+expect = [undefined, undefined];
+addThis();
+
+status = 'In SECTION2 of test; looking up getter/setter on nonexistent property';
+actual = [obj.__lookupSetter__(cnNonExistingProp), obj.__lookupGetter__(cnNonExistingProp)];
+expect = [undefined, undefined];
+addThis();
+
+
+
+// SECTION 3: define getter/setter in prototype of user-defined constructor
+function TestObject()
+{
+}
+TestObject.prototype.nameSETS = 0;
+TestObject.prototype.nameGETS = 0;
+TestObject.prototype.__defineSetter__(cnName, cnNameSetter);
+TestObject.prototype.__defineGetter__(cnName, cnNameGetter);
+TestObject.prototype.name = cnDEFAULT;
+
+obj = new TestObject();
+obj.name = cnFRED;
+obj.color = cnRED;
+
+status = 'In SECTION3 of test looking up extant getter/setter';
+actual = [obj.__lookupSetter__(cnName), obj.__lookupGetter__(cnName)];
+expect = [cnNameSetter, cnNameGetter];
+addThis();
+
+status = 'In SECTION3 of test; looking up non-existent getter/setter';
+actual = [obj.__lookupSetter__(cnColor), obj.__lookupGetter__(cnColor)];
+expect = [undefined, undefined];
+addThis();
+
+status = 'In SECTION3 of test; looking up getter/setter on nonexistent property';
+actual = [obj.__lookupSetter__(cnNonExistingProp), obj.__lookupGetter__(cnNonExistingProp)];
+expect = [undefined, undefined];
+addThis();
+
+
+
+//---------------------------------------------------------------------------------
+test();
+//---------------------------------------------------------------------------------
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual.toString();
+ expectedvalues[UBound] = expect.toString();
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ for (var i = 0; i < UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], getStatus(i));
+ }
+
+ exitFunc ('test');
+}
+
+
+function getStatus(i)
+{
+ return statprefix + statusitems[i];
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/LexicalConventions/lexical-001.js b/Source/JavaScriptCore/tests/mozilla/js1_5/LexicalConventions/lexical-001.js
new file mode 100644
index 0000000..42e947d
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/LexicalConventions/lexical-001.js
@@ -0,0 +1,161 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS
+* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+* implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation. All
+* Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+* 26 November 2000
+*
+*
+*SUMMARY: Testing numeric literals that begin with 0.
+*This test arose from Bugzilla bug 49233.
+*The best explanation is from jsscan.c:
+*
+* "We permit 08 and 09 as decimal numbers, which makes
+* our behaviour a superset of the ECMA numeric grammar.
+* We might not always be so permissive, so we warn about it."
+*
+*Thus an expression 010 will evaluate, as always, as an octal (to 8).
+*However, 018 will evaluate as a decimal, to 18. Even though the
+*user began the expression as an octal, he later used a non-octal
+*digit. We forgive this and assume he intended a decimal. If the
+*JavaScript "strict" option is set though, we will give a warning.
+*/
+//-------------------------------------------------------------------------------------------------
+var bug = '49233';
+var summary = 'Testing numeric literals that begin with 0';
+var statprefix = 'Testing ';
+var quote = "'";
+var status = new Array();
+var actual = new Array();
+var expect = new Array();
+
+
+status[0]=showStatus('01')
+actual[0]=01
+expect[0]=1
+
+status[1]=showStatus('07')
+actual[1]=07
+expect[1]=7
+
+status[2]=showStatus('08')
+actual[2]=08
+expect[2]=8
+
+status[3]=showStatus('09')
+actual[3]=09
+expect[3]=9
+
+status[4]=showStatus('010')
+actual[4]=010
+expect[4]=8
+
+status[5]=showStatus('017')
+actual[5]=017
+expect[5]=15
+
+status[6]=showStatus('018')
+actual[6]=018
+expect[6]=18
+
+status[7]=showStatus('019')
+actual[7]=019
+expect[7]=19
+
+status[8]=showStatus('079')
+actual[8]=079
+expect[8]=79
+
+status[9]=showStatus('0079')
+actual[9]=0079
+expect[9]=79
+
+status[10]=showStatus('099')
+actual[10]=099
+expect[10]=99
+
+status[11]=showStatus('0099')
+actual[11]=0099
+expect[11]=99
+
+status[12]=showStatus('000000000077')
+actual[12]=000000000077
+expect[12]=63
+
+status[13]=showStatus('000000000078')
+actual[13]=000000000078
+expect[13]=78
+
+status[14]=showStatus('0000000000770000')
+actual[14]=0000000000770000
+expect[14]=258048
+
+status[15]=showStatus('0000000000780000')
+actual[15]=0000000000780000
+expect[15]=780000
+
+status[16]=showStatus('0765432198')
+actual[16]=0765432198
+expect[16]=765432198
+
+status[17]=showStatus('00076543219800')
+actual[17]=00076543219800
+expect[17]=76543219800
+
+status[18]=showStatus('0000001001007')
+actual[18]=0000001001007
+expect[18]=262663
+
+status[19]=showStatus('0000001001009')
+actual[19]=0000001001009
+expect[19]=1001009
+
+status[20]=showStatus('070')
+actual[20]=070
+expect[20]=56
+
+status[21]=showStatus('080')
+actual[21]=080
+expect[21]=80
+
+
+
+//-------------------------------------------------------------------------------------------------
+test();
+//-------------------------------------------------------------------------------------------------
+
+
+function showStatus(msg)
+{
+ return (statprefix + quote + msg + quote);
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+
+ for (i=0; i !=status.length; i++)
+ {
+ reportCompare (expect[i], actual[i], status[i]);
+ }
+
+ exitFunc ('test');
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/LexicalConventions/regress-177314.js b/Source/JavaScriptCore/tests/mozilla/js1_5/LexicalConventions/regress-177314.js
new file mode 100644
index 0000000..b085dfb
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/LexicalConventions/regress-177314.js
@@ -0,0 +1,105 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2002
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 30 Oct 2002
+* SUMMARY: '\400' should lex as a 2-digit octal escape + '0'
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=177314
+*
+* Bug was that Rhino interpreted '\400' as a 3-digit octal escape. As such
+* it is invalid, since octal escapes may only run from '\0' to '\377'. But
+* the lexer should interpret this as '\40' + '0' instead, and throw no error.
+*
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 177314;
+var summary = "'\\" + "400' should lex as a 2-digit octal escape + '0'";
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+// the last valid octal escape is '\377', which should equal hex escape '\xFF'
+status = inSection(1);
+actual = '\377';
+expect = '\xFF';
+addThis();
+
+// now exercise the lexer by going one higher in the last digit
+status = inSection(2);
+actual = '\378';
+expect = '\37' + '8';
+addThis();
+
+// trickier: 400 is a valid octal number, but '\400' isn't a valid octal escape
+status = inSection(3);
+actual = '\400';
+expect = '\40' + '0';
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Object/regress-137000.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Object/regress-137000.js
new file mode 100644
index 0000000..20a8a8e
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Object/regress-137000.js
@@ -0,0 +1,235 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2002
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 03 June 2002
+* SUMMARY: Function param or local var with same name as a function property
+*
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=137000
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=138708
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=150032
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=150859
+*
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 137000;
+var summary = 'Function param or local var with same name as a function prop';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+/*
+ * Note use of 'x' both for the parameter to f,
+ * and as a property name for |f| as an object
+ */
+function f(x)
+{
+}
+
+status = inSection(1);
+f.x = 12;
+actual = f.x;
+expect = 12;
+addThis();
+
+
+
+/*
+ * A more elaborate example, using the call() method
+ * to chain constructors from child to parent.
+ *
+ * The key point is the use of the same name 'p' for both
+ * the parameter to the constructor, and as a property name
+ */
+function parentObject(p)
+{
+ this.p = 1;
+}
+
+function childObject()
+{
+ parentObject.call(this);
+}
+childObject.prototype = parentObject;
+
+status = inSection(2);
+var objParent = new parentObject();
+actual = objParent.p;
+expect = 1;
+addThis();
+
+status = inSection(3);
+var objChild = new childObject();
+actual = objChild.p;
+expect = 1;
+addThis();
+
+
+
+/*
+ * A similar set-up. Here the same name is being used for
+ * the parameter to both the Base and Child constructors,
+ */
+function Base(id)
+{
+}
+
+function Child(id)
+{
+ this.prop = id;
+}
+Child.prototype=Base;
+
+status = inSection(4);
+var c1 = new Child('child1');
+actual = c1.prop;
+expect = 'child1';
+addThis();
+
+
+
+/*
+ * Use same identifier as a property name, too -
+ */
+function BaseX(id)
+{
+}
+
+function ChildX(id)
+{
+ this.id = id;
+}
+ChildX.prototype=BaseX;
+
+status = inSection(5);
+c1 = new ChildX('child1');
+actual = c1.id;
+expect = 'child1';
+addThis();
+
+
+
+/*
+ * From http://bugzilla.mozilla.org/show_bug.cgi?id=150032
+ *
+ * Here the same name is being used both for a local variable
+ * declared in g(), and as a property name for |g| as an object
+ */
+function g()
+{
+ var propA = g.propA;
+ var propB = g.propC;
+
+ this.getVarA = function() {return propA;}
+ this.getVarB = function() {return propB;}
+}
+g.propA = 'A';
+g.propB = 'B';
+g.propC = 'C';
+var obj = new g();
+
+status = inSection(6);
+actual = obj.getVarA(); // this one was returning 'undefined'
+expect = 'A';
+addThis();
+
+status = inSection(7);
+actual = obj.getVarB(); // this one is easy; it never failed
+expect = 'C';
+addThis();
+
+
+
+/*
+ * By martin.honnen@t-online.de
+ * From http://bugzilla.mozilla.org/show_bug.cgi?id=150859
+ *
+ * Here the same name is being used for a local var in F
+ * and as a property name for |F| as an object
+ *
+ * Twist: the property is added via another function.
+ */
+function setFProperty(val)
+{
+ F.propA = val;
+}
+
+function F()
+{
+ var propA = 'Local variable in F';
+}
+
+status = inSection(8);
+setFProperty('Hello');
+actual = F.propA; // this was returning 'undefined'
+expect = 'Hello';
+addThis();
+
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Object/regress-192105.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Object/regress-192105.js
new file mode 100644
index 0000000..fa19d8c
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Object/regress-192105.js
@@ -0,0 +1,178 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2003
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): igor@icesoft.no, pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 06 February 2003
+* SUMMARY: Using |instanceof| to check if function is called as a constructor
+*
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=192105
+*
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 192105;
+var summary = 'Using |instanceof| to check if f() is called as constructor';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+/*
+ * This function is the heart of the test. It sets the result
+ * variable |actual|, which we will compare against |expect|.
+ *
+ * Note |actual| will be set to |true| or |false| according
+ * to whether or not this function is called as a constructor;
+ * i.e. whether it is called via the |new| keyword or not -
+ */
+function f()
+{
+ actual = (this instanceof f);
+}
+
+
+/*
+ * Call f as a constructor from global scope
+ */
+status = inSection(1);
+new f(); // sets |actual|
+expect = true;
+addThis();
+
+/*
+ * Now, not as a constructor
+ */
+status = inSection(2);
+f(); // sets |actual|
+expect = false;
+addThis();
+
+
+/*
+ * Call f as a constructor from function scope
+ */
+function F()
+{
+ new f();
+}
+status = inSection(3);
+F(); // sets |actual|
+expect = true;
+addThis();
+
+/*
+ * Now, not as a constructor
+ */
+function G()
+{
+ f();
+}
+status = inSection(4);
+G(); // sets |actual|
+expect = false;
+addThis();
+
+
+/*
+ * Now make F() and G() methods of an object
+ */
+var obj = {F:F, G:G};
+status = inSection(5);
+obj.F(); // sets |actual|
+expect = true;
+addThis();
+
+status = inSection(6);
+obj.G(); // sets |actual|
+expect = false;
+addThis();
+
+
+/*
+ * Now call F() and G() from yet other functions, and use eval()
+ */
+function A()
+{
+ eval('F();');
+}
+status = inSection(7);
+A(); // sets |actual|
+expect = true;
+addThis();
+
+
+function B()
+{
+ eval('G();');
+}
+status = inSection(8);
+B(); // sets |actual|
+expect = false;
+addThis();
+
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Object/regress-90596-001.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Object/regress-90596-001.js
new file mode 100644
index 0000000..3b0fad6
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Object/regress-90596-001.js
@@ -0,0 +1,278 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS
+* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+* implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation.
+* All Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+* Date: 28 August 2001
+*
+* SUMMARY: A [DontEnum] prop, if overridden, should appear in toSource().
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=90596
+*
+* NOTE: some inefficiencies in the test are made for the sake of readability.
+* Sorting properties alphabetically is done for definiteness in comparisons.
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 90596;
+var summary = 'A [DontEnum] prop, if overridden, should appear in toSource()';
+var cnCOMMA = ',';
+var cnLBRACE = '{';
+var cnRBRACE = '}';
+var cnLPAREN = '(';
+var cnRPAREN = ')';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+var obj = {};
+
+
+status = inSection(1);
+obj = {toString:9};
+actual = obj.toSource();
+expect = '({toString:9})';
+addThis();
+
+status = inSection(2);
+obj = {hasOwnProperty:"Hi"};
+actual = obj.toSource();
+expect = '({hasOwnProperty:"Hi"})';
+addThis();
+
+status = inSection(3);
+obj = {toString:9, hasOwnProperty:"Hi"};
+actual = obj.toSource();
+expect = '({toString:9, hasOwnProperty:"Hi"})';
+addThis();
+
+status = inSection(4);
+obj = {prop1:1, toString:9, hasOwnProperty:"Hi"};
+actual = obj.toSource();
+expect = '({prop1:1, toString:9, hasOwnProperty:"Hi"})';
+addThis();
+
+
+// TRY THE SAME THING IN EVAL CODE
+var s = '';
+
+status = inSection(5);
+s = 'obj = {toString:9}';
+eval(s);
+actual = obj.toSource();
+expect = '({toString:9})';
+addThis();
+
+status = inSection(6);
+s = 'obj = {hasOwnProperty:"Hi"}';
+eval(s);
+actual = obj.toSource();
+expect = '({hasOwnProperty:"Hi"})';
+addThis();
+
+status = inSection(7);
+s = 'obj = {toString:9, hasOwnProperty:"Hi"}';
+eval(s);
+actual = obj.toSource();
+expect = '({toString:9, hasOwnProperty:"Hi"})';
+addThis();
+
+status = inSection(8);
+s = 'obj = {prop1:1, toString:9, hasOwnProperty:"Hi"}';
+eval(s);
+actual = obj.toSource();
+expect = '({prop1:1, toString:9, hasOwnProperty:"Hi"})';
+addThis();
+
+
+// TRY THE SAME THING IN FUNCTION CODE
+function A()
+{
+ status = inSection(9);
+ var s = 'obj = {toString:9}';
+ eval(s);
+ actual = obj.toSource();
+ expect = '({toString:9})';
+ addThis();
+}
+A();
+
+function B()
+{
+ status = inSection(10);
+ var s = 'obj = {hasOwnProperty:"Hi"}';
+ eval(s);
+ actual = obj.toSource();
+ expect = '({hasOwnProperty:"Hi"})';
+ addThis();
+}
+B();
+
+function C()
+{
+ status = inSection(11);
+ var s = 'obj = {toString:9, hasOwnProperty:"Hi"}';
+ eval(s);
+ actual = obj.toSource();
+ expect = '({toString:9, hasOwnProperty:"Hi"})';
+ addThis();
+}
+C();
+
+function D()
+{
+ status = inSection(12);
+ var s = 'obj = {prop1:1, toString:9, hasOwnProperty:"Hi"}';
+ eval(s);
+ actual = obj.toSource();
+ expect = '({prop1:1, toString:9, hasOwnProperty:"Hi"})';
+ addThis();
+}
+D();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+/*
+ * Sort properties alphabetically -
+ */
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = sortThis(actual);
+ expectedvalues[UBound] = sortThis(expect);
+ UBound++;
+}
+
+
+/*
+ * Takes string of form '({"c", "b", "a", 2})' and returns '({"a","b","c",2})'
+ */
+function sortThis(sList)
+{
+ sList = compactThis(sList);
+ sList = stripParens(sList);
+ sList = stripBraces(sList);
+ var arr = sList.split(cnCOMMA);
+ arr = arr.sort();
+ var ret = String(arr);
+ ret = addBraces(ret);
+ ret = addParens(ret);
+ return ret;
+}
+
+
+/*
+ * Strips out any whitespace from the text -
+ */
+function compactThis(text)
+{
+ var charCode = 0;
+ var ret = '';
+
+ for (var i=0; i<text.length; i++)
+ {
+ charCode = text.charCodeAt(i);
+
+ if (!isWhiteSpace(charCode))
+ ret += text.charAt(i);
+ }
+
+ return ret;
+}
+
+
+function isWhiteSpace(charCode)
+{
+ switch (charCode)
+ {
+ case (0x0009):
+ case (0x000B):
+ case (0x000C):
+ case (0x0020):
+ case (0x000A): // '\n'
+ case (0x000D): // '\r'
+ return true;
+ break;
+
+ default:
+ return false;
+ }
+}
+
+
+/*
+ * strips off parens at beginning and end of text -
+ */
+function stripParens(text)
+{
+ // remember to escape the parens...
+ var arr = text.match(/^\((.*)\)$/);
+
+ // defend against a null match...
+ if (arr != null && arr[1] != null)
+ return arr[1];
+ return text;
+}
+
+
+/*
+ * strips off braces at beginning and end of text -
+ */
+function stripBraces(text)
+{
+ // remember to escape the braces...
+ var arr = text.match(/^\{(.*)\}$/);
+
+ // defend against a null match...
+ if (arr != null && arr[1] != null)
+ return arr[1];
+ return text;
+}
+
+
+function addBraces(text)
+{
+ return cnLBRACE + text + cnRBRACE;
+}
+
+
+function addParens(text)
+{
+ return cnLPAREN + text + cnRPAREN;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Object/regress-90596-002.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Object/regress-90596-002.js
new file mode 100644
index 0000000..0d809a2
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Object/regress-90596-002.js
@@ -0,0 +1,278 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS
+* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+* implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation.
+* All Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+* Date: 28 August 2001
+*
+* SUMMARY: A [DontEnum] prop, if overridden, should appear in uneval().
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=90596
+*
+* NOTE: some inefficiencies in the test are made for the sake of readability.
+* Sorting properties alphabetically is done for definiteness in comparisons.
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 90596;
+var summary = 'A [DontEnum] prop, if overridden, should appear in uneval()';
+var cnCOMMA = ',';
+var cnLBRACE = '{';
+var cnRBRACE = '}';
+var cnLPAREN = '(';
+var cnRPAREN = ')';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+var obj = {};
+
+
+status = inSection(1);
+obj = {toString:9};
+actual = uneval(obj);
+expect = '({toString:9})';
+addThis();
+
+status = inSection(2);
+obj = {hasOwnProperty:"Hi"};
+actual = uneval(obj);
+expect = '({hasOwnProperty:"Hi"})';
+addThis();
+
+status = inSection(3);
+obj = {toString:9, hasOwnProperty:"Hi"};
+actual = uneval(obj);
+expect = '({toString:9, hasOwnProperty:"Hi"})';
+addThis();
+
+status = inSection(4);
+obj = {prop1:1, toString:9, hasOwnProperty:"Hi"};
+actual = uneval(obj);
+expect = '({prop1:1, toString:9, hasOwnProperty:"Hi"})';
+addThis();
+
+
+// TRY THE SAME THING IN EVAL CODE
+var s = '';
+
+status = inSection(5);
+s = 'obj = {toString:9}';
+eval(s);
+actual = uneval(obj);
+expect = '({toString:9})';
+addThis();
+
+status = inSection(6);
+s = 'obj = {hasOwnProperty:"Hi"}';
+eval(s);
+actual = uneval(obj);
+expect = '({hasOwnProperty:"Hi"})';
+addThis();
+
+status = inSection(7);
+s = 'obj = {toString:9, hasOwnProperty:"Hi"}';
+eval(s);
+actual = uneval(obj);
+expect = '({toString:9, hasOwnProperty:"Hi"})';
+addThis();
+
+status = inSection(8);
+s = 'obj = {prop1:1, toString:9, hasOwnProperty:"Hi"}';
+eval(s);
+actual = uneval(obj);
+expect = '({prop1:1, toString:9, hasOwnProperty:"Hi"})';
+addThis();
+
+
+// TRY THE SAME THING IN FUNCTION CODE
+function A()
+{
+ status = inSection(9);
+ var s = 'obj = {toString:9}';
+ eval(s);
+ actual = uneval(obj);
+ expect = '({toString:9})';
+ addThis();
+}
+A();
+
+function B()
+{
+ status = inSection(10);
+ var s = 'obj = {hasOwnProperty:"Hi"}';
+ eval(s);
+ actual = uneval(obj);
+ expect = '({hasOwnProperty:"Hi"})';
+ addThis();
+}
+B();
+
+function C()
+{
+ status = inSection(11);
+ var s = 'obj = {toString:9, hasOwnProperty:"Hi"}';
+ eval(s);
+ actual = uneval(obj);
+ expect = '({toString:9, hasOwnProperty:"Hi"})';
+ addThis();
+}
+C();
+
+function D()
+{
+ status = inSection(12);
+ var s = 'obj = {prop1:1, toString:9, hasOwnProperty:"Hi"}';
+ eval(s);
+ actual = uneval(obj);
+ expect = '({prop1:1, toString:9, hasOwnProperty:"Hi"})';
+ addThis();
+}
+D();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+/*
+ * Sort properties alphabetically -
+ */
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = sortThis(actual);
+ expectedvalues[UBound] = sortThis(expect);
+ UBound++;
+}
+
+
+/*
+ * Takes string of form '({"c", "b", "a", 2})' and returns '({"a","b","c",2})'
+ */
+function sortThis(sList)
+{
+ sList = compactThis(sList);
+ sList = stripParens(sList);
+ sList = stripBraces(sList);
+ var arr = sList.split(cnCOMMA);
+ arr = arr.sort();
+ var ret = String(arr);
+ ret = addBraces(ret);
+ ret = addParens(ret);
+ return ret;
+}
+
+
+/*
+ * Strips out any whitespace from the text -
+ */
+function compactThis(text)
+{
+ var charCode = 0;
+ var ret = '';
+
+ for (var i=0; i<text.length; i++)
+ {
+ charCode = text.charCodeAt(i);
+
+ if (!isWhiteSpace(charCode))
+ ret += text.charAt(i);
+ }
+
+ return ret;
+}
+
+
+function isWhiteSpace(charCode)
+{
+ switch (charCode)
+ {
+ case (0x0009):
+ case (0x000B):
+ case (0x000C):
+ case (0x0020):
+ case (0x000A): // '\n'
+ case (0x000D): // '\r'
+ return true;
+ break;
+
+ default:
+ return false;
+ }
+}
+
+
+/*
+ * strips off parens at beginning and end of text -
+ */
+function stripParens(text)
+{
+ // remember to escape the parens...
+ var arr = text.match(/^\((.*)\)$/);
+
+ // defend against a null match...
+ if (arr != null && arr[1] != null)
+ return arr[1];
+ return text;
+}
+
+
+/*
+ * strips off braces at beginning and end of text -
+ */
+function stripBraces(text)
+{
+ // remember to escape the braces...
+ var arr = text.match(/^\{(.*)\}$/);
+
+ // defend against a null match...
+ if (arr != null && arr[1] != null)
+ return arr[1];
+ return text;
+}
+
+
+function addBraces(text)
+{
+ return cnLBRACE + text + cnRBRACE;
+}
+
+
+function addParens(text)
+{
+ return cnLPAREN + text + cnRPAREN;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Object/regress-90596-003.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Object/regress-90596-003.js
new file mode 100644
index 0000000..766fff5
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Object/regress-90596-003.js
@@ -0,0 +1,290 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS
+* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+* implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation.
+* All Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+* Date: 28 August 2001
+*
+* SUMMARY: A [DontEnum] prop, if overridden, should appear in for-in loops.
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=90596
+*
+* NOTE: some inefficiencies in the test are made for the sake of readability.
+* For example, we quote string values like "Hi" in lines like this:
+*
+* actual = enumerateThis(obj);
+* expect = '{prop:"Hi"}';
+*
+* But enumerateThis(obj) gets literal value Hi for obj.prop, not literal "Hi".
+* We take care of all these details in the compactThis(), sortThis() functions.
+* Sorting properties alphabetically is necessary for the test to work in Rhino.
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 90596;
+var summary = '[DontEnum] props (if overridden) should appear in for-in loops';
+var cnCOMMA = ',';
+var cnCOLON = ':';
+var cnLBRACE = '{';
+var cnRBRACE = '}';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+var obj = {};
+
+
+status = inSection(1);
+obj = {toString:9};
+actual = enumerateThis(obj);
+expect = '{toString:9}';
+addThis();
+
+status = inSection(2);
+obj = {hasOwnProperty:"Hi"};
+actual = enumerateThis(obj);
+expect = '{hasOwnProperty:"Hi"}';
+addThis();
+
+status = inSection(3);
+obj = {toString:9, hasOwnProperty:"Hi"};
+actual = enumerateThis(obj);
+expect = '{toString:9, hasOwnProperty:"Hi"}';
+addThis();
+
+status = inSection(4);
+obj = {prop1:1, toString:9, hasOwnProperty:"Hi"};
+actual = enumerateThis(obj);
+expect = '{prop1:1, toString:9, hasOwnProperty:"Hi"}';
+addThis();
+
+
+// TRY THE SAME THING IN EVAL CODE
+var s = '';
+
+status = inSection(5);
+s = 'obj = {toString:9}';
+eval(s);
+actual = enumerateThis(obj);
+expect = '{toString:9}';
+addThis();
+
+status = inSection(6);
+s = 'obj = {hasOwnProperty:"Hi"}';
+eval(s);
+actual = enumerateThis(obj);
+expect = '{hasOwnProperty:"Hi"}';
+addThis();
+
+status = inSection(7);
+s = 'obj = {toString:9, hasOwnProperty:"Hi"}';
+eval(s);
+actual = enumerateThis(obj);
+expect = '{toString:9, hasOwnProperty:"Hi"}';
+addThis();
+
+status = inSection(8);
+s = 'obj = {prop1:1, toString:9, hasOwnProperty:"Hi"}';
+eval(s);
+actual = enumerateThis(obj);
+expect = '{prop1:1, toString:9, hasOwnProperty:"Hi"}';
+addThis();
+
+
+// TRY THE SAME THING IN FUNCTION CODE
+function A()
+{
+ status = inSection(9);
+ var s = 'obj = {toString:9}';
+ eval(s);
+ actual = enumerateThis(obj);
+ expect = '{toString:9}';
+ addThis();
+}
+A();
+
+function B()
+{
+ status = inSection(10);
+ var s = 'obj = {hasOwnProperty:"Hi"}';
+ eval(s);
+ actual = enumerateThis(obj);
+ expect = '{hasOwnProperty:"Hi"}';
+ addThis();
+}
+B();
+
+function C()
+{
+ status = inSection(11);
+ var s = 'obj = {toString:9, hasOwnProperty:"Hi"}';
+ eval(s);
+ actual = enumerateThis(obj);
+ expect = '{toString:9, hasOwnProperty:"Hi"}';
+ addThis();
+}
+C();
+
+function D()
+{
+ status = inSection(12);
+ var s = 'obj = {prop1:1, toString:9, hasOwnProperty:"Hi"}';
+ eval(s);
+ actual = enumerateThis(obj);
+ expect = '{prop1:1, toString:9, hasOwnProperty:"Hi"}';
+ addThis();
+}
+D();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function enumerateThis(obj)
+{
+ var arr = new Array();
+
+ for (var prop in obj)
+ {
+ arr.push(prop + cnCOLON + obj[prop]);
+ }
+
+ var ret = addBraces(String(arr));
+ return ret;
+}
+
+
+function addBraces(text)
+{
+ return cnLBRACE + text + cnRBRACE;
+}
+
+
+/*
+ * Sort properties alphabetically so the test will work in Rhino
+ */
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = sortThis(actual);
+ expectedvalues[UBound] = sortThis(expect);
+ UBound++;
+}
+
+
+/*
+ * Takes a string of the form '{"c", "b", "a", 2}' and returns '{2,a,b,c}'
+ */
+function sortThis(sList)
+{
+ sList = compactThis(sList);
+ sList = stripBraces(sList);
+ var arr = sList.split(cnCOMMA);
+ arr = arr.sort();
+ var ret = String(arr);
+ ret = addBraces(ret);
+ return ret;
+}
+
+
+/*
+ * Strips out any whitespace or quotes from the text -
+ */
+function compactThis(text)
+{
+ var charCode = 0;
+ var ret = '';
+
+ for (var i=0; i<text.length; i++)
+ {
+ charCode = text.charCodeAt(i);
+
+ if (!isWhiteSpace(charCode) && !isQuote(charCode))
+ ret += text.charAt(i);
+ }
+
+ return ret;
+}
+
+
+function isWhiteSpace(charCode)
+{
+ switch (charCode)
+ {
+ case (0x0009):
+ case (0x000B):
+ case (0x000C):
+ case (0x0020):
+ case (0x000A): // '\n'
+ case (0x000D): // '\r'
+ return true;
+ break;
+
+ default:
+ return false;
+ }
+}
+
+
+function isQuote(charCode)
+{
+ switch (charCode)
+ {
+ case (0x0027): // single quote
+ case (0x0022): // double quote
+ return true;
+ break;
+
+ default:
+ return false;
+ }
+}
+
+
+/*
+ * strips off braces at beginning and end of text -
+ */
+function stripBraces(text)
+{
+ // remember to escape the braces...
+ var arr = text.match(/^\{(.*)\}$/);
+
+ // defend against a null match...
+ if (arr != null && arr[1] != null)
+ return arr[1];
+ return text;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Object/regress-96284-001.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Object/regress-96284-001.js
new file mode 100644
index 0000000..5130a03
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Object/regress-96284-001.js
@@ -0,0 +1,161 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS
+* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+* implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation.
+* All Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+* Date: 03 September 2001
+*
+* SUMMARY: Double quotes should be escaped in Error.prototype.toSource()
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=96284
+*
+* The real point here is this: we should be able to reconstruct an object
+* from its toSource() property. We'll test this on various types of objects.
+*
+* Method: define obj2 = eval(obj1.toSource()) and verify that
+* obj2.toSource() == obj1.toSource().
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 96284;
+var summary = 'Double quotes should be escaped in Error.prototype.toSource()';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+var obj1 = {};
+var obj2 = {};
+var cnTestString = '"This is a \" STUPID \" test string!!!"\\';
+
+
+// various NativeError objects -
+status = inSection(1);
+obj1 = Error(cnTestString);
+obj2 = eval(obj1.toSource());
+actual = obj2.toSource();
+expect = obj1.toSource();
+addThis();
+
+status = inSection(2);
+obj1 = EvalError(cnTestString);
+obj2 = eval(obj1.toSource());
+actual = obj2.toSource();
+expect = obj1.toSource();
+addThis();
+
+status = inSection(3);
+obj1 = RangeError(cnTestString);
+obj2 = eval(obj1.toSource());
+actual = obj2.toSource();
+expect = obj1.toSource();
+addThis();
+
+status = inSection(4);
+obj1 = ReferenceError(cnTestString);
+obj2 = eval(obj1.toSource());
+actual = obj2.toSource();
+expect = obj1.toSource();
+addThis();
+
+status = inSection(5);
+obj1 = SyntaxError(cnTestString);
+obj2 = eval(obj1.toSource());
+actual = obj2.toSource();
+expect = obj1.toSource();
+addThis();
+
+status = inSection(6);
+obj1 = TypeError(cnTestString);
+obj2 = eval(obj1.toSource());
+actual = obj2.toSource();
+expect = obj1.toSource();
+addThis();
+
+status = inSection(7);
+obj1 = URIError(cnTestString);
+obj2 = eval(obj1.toSource());
+actual = obj2.toSource();
+expect = obj1.toSource();
+addThis();
+
+
+// other types of objects -
+status = inSection(8);
+obj1 = new String(cnTestString);
+obj2 = eval(obj1.toSource());
+actual = obj2.toSource();
+expect = obj1.toSource();
+addThis();
+
+status = inSection(9);
+obj1 = {color:'red', texture:cnTestString, hasOwnProperty:42};
+obj2 = eval(obj1.toSource());
+actual = obj2.toSource();
+expect = obj1.toSource();
+addThis();
+
+status = inSection(10);
+obj1 = function(x) {function g(y){return y+1;} return g(x);};
+obj2 = eval(obj1.toSource());
+actual = obj2.toSource();
+expect = obj1.toSource();
+addThis();
+
+status = inSection(11);
+obj1 = new Number(eval('6'));
+obj2 = eval(obj1.toSource());
+actual = obj2.toSource();
+expect = obj1.toSource();
+addThis();
+
+status = inSection(12);
+obj1 = /ad;(lf)kj(2309\/\/)\/\//;
+obj2 = eval(obj1.toSource());
+actual = obj2.toSource();
+expect = obj1.toSource();
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ for (var i = 0; i < UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Object/regress-96284-002.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Object/regress-96284-002.js
new file mode 100644
index 0000000..902ba06
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Object/regress-96284-002.js
@@ -0,0 +1,161 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS
+* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+* implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation.
+* All Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+* Date: 03 September 2001
+*
+* SUMMARY: Double quotes should be escaped in uneval(new Error('""'))
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=96284
+*
+* The real point here is this: we should be able to reconstruct an object
+* obj from uneval(obj). We'll test this on various types of objects.
+*
+* Method: define obj2 = eval(uneval(obj1)) and verify that
+* obj2.toSource() == obj1.toSource().
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 96284;
+var summary = 'Double quotes should be escaped in Error.prototype.toSource()';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+var obj1 = {};
+var obj2 = {};
+var cnTestString = '"This is a \" STUPID \" test string!!!"\\';
+
+
+// various NativeError objects -
+status = inSection(1);
+obj1 = Error(cnTestString);
+obj2 = eval(uneval(obj1));
+actual = obj2.toSource();
+expect = obj1.toSource();
+addThis();
+
+status = inSection(2);
+obj1 = EvalError(cnTestString);
+obj2 = eval(uneval(obj1));
+actual = obj2.toSource();
+expect = obj1.toSource();
+addThis();
+
+status = inSection(3);
+obj1 = RangeError(cnTestString);
+obj2 = eval(uneval(obj1));
+actual = obj2.toSource();
+expect = obj1.toSource();
+addThis();
+
+status = inSection(4);
+obj1 = ReferenceError(cnTestString);
+obj2 = eval(uneval(obj1));
+actual = obj2.toSource();
+expect = obj1.toSource();
+addThis();
+
+status = inSection(5);
+obj1 = SyntaxError(cnTestString);
+obj2 = eval(uneval(obj1));
+actual = obj2.toSource();
+expect = obj1.toSource();
+addThis();
+
+status = inSection(6);
+obj1 = TypeError(cnTestString);
+obj2 = eval(uneval(obj1));
+actual = obj2.toSource();
+expect = obj1.toSource();
+addThis();
+
+status = inSection(7);
+obj1 = URIError(cnTestString);
+obj2 = eval(uneval(obj1));
+actual = obj2.toSource();
+expect = obj1.toSource();
+addThis();
+
+
+// other types of objects -
+status = inSection(8);
+obj1 = new String(cnTestString);
+obj2 = eval(uneval(obj1));
+actual = obj2.toSource();
+expect = obj1.toSource();
+addThis();
+
+status = inSection(9);
+obj1 = {color:'red', texture:cnTestString, hasOwnProperty:42};
+obj2 = eval(uneval(obj1));
+actual = obj2.toSource();
+expect = obj1.toSource();
+addThis();
+
+status = inSection(10);
+obj1 = function(x) {function g(y){return y+1;} return g(x);};
+obj2 = eval(uneval(obj1));
+actual = obj2.toSource();
+expect = obj1.toSource();
+addThis();
+
+status = inSection(11);
+obj1 = new Number(eval('6'));
+obj2 = eval(uneval(obj1));
+actual = obj2.toSource();
+expect = obj1.toSource();
+addThis();
+
+status = inSection(12);
+obj1 = /ad;(lf)kj(2309\/\/)\/\//;
+obj2 = eval(uneval(obj1));
+actual = obj2.toSource();
+expect = obj1.toSource();
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ for (var i = 0; i < UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-102725.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-102725.js
new file mode 100644
index 0000000..1316672
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-102725.js
@@ -0,0 +1,77 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS
+* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+* implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation.
+* All Rights Reserved.
+*
+* Contributor(s): dbaron@fas.harvard.edu, pschwartau@netscape.com
+* Date: 09 October 2001
+*
+* SUMMARY: Regression test for Bugzilla bug 102725
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=102725
+* "gcc -O2 problems converting numbers to strings"
+*
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 102725;
+var summary = 'Testing converting numbers to strings';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+/*
+ * Successive calls to foo.toString() were producing different answers!
+ */
+status = inSection(1);
+foo = (new Date()).getTime();
+actual = foo.toString();
+expect = foo.toString();
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-103602.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-103602.js
new file mode 100644
index 0000000..ab8113d
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-103602.js
@@ -0,0 +1,162 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2001
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 10 Jan 2002
+* SUMMARY: Reassignment to a const is NOT an error per ECMA
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=103602
+*
+* ------- Additional Comment #4 From Brendan Eich 2002-01-10 15:30 -------
+*
+* That's per ECMA (don't blame me, I fought for what Netscape always did:
+* throw an error [could be a catchable exception since 1.3]).
+* Readonly properties, when set by assignment, are not changed, but no error
+* or exception is thrown. The value of the assignment expression is the value
+* of the r.h.s.
+*
+* If you want a *strict* warning, pls change the summary of this bug to say so.
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 103602;
+var summary = 'Reassignment to a const is NOT an error per ECMA';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+var cnFAIL_1 = 'Redeclaration of a const FAILED to cause an error';
+var cnFAIL_2 = 'Reassigning to a const caused an ERROR! It should not!!!';
+var sEval = '';
+
+/*
+ * Not every implementation supports const (a non-ECMA extension)
+ * For example, Rhino does not; it would generate a complile-time error.
+ * So we have to hide this so it will be detected at run-time instead.
+ */
+try
+{
+ sEval = 'const one = 1';
+ eval(sEval);
+}
+catch(e)
+{
+ quit(); // if const is not supported, this testcase is over -
+}
+
+
+status = inSection(1);
+try
+{
+ /*
+ * Redeclaration of const should be a compile-time error.
+ * Hide so it will be detected at run-time.
+ */
+ sEval = 'const one = 2;';
+ eval(sEval);
+
+ expect = ''; // we shouldn't reach this line
+ actual = cnFAIL_1;
+ addThis();
+}
+catch(e)
+{
+ // good - we should be here.
+ actual = expect;
+ addThis();
+}
+
+
+status = inSection(2);
+try
+{
+ /*
+ * Reassignment to a const should be NOT be an error, per ECMA.
+ */
+ one = 2;
+ actual = expect; // good: no error was generated
+ addThis();
+
+ // although no error, the assignment should have been ignored -
+ status = inSection(3);
+ actual = one;
+ expect = 1;
+ addThis();
+
+ // the value of the EXPRESSION, however, is the value of the r.h.s. -
+ status = inSection(4);
+ actual = (one = 2);
+ expect = 2;
+ addThis();
+}
+
+catch(e)
+{
+ // BAD - we shouldn't be here
+ expect = '';
+ actual = cnFAIL_2;
+ addThis();
+}
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ for (var i = 0; i < UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-104077.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-104077.js
new file mode 100644
index 0000000..992028e
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-104077.js
@@ -0,0 +1,635 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2001
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): chwu@nortelnetworks.com, timeless@mac.com,
+* brendan@mozilla.org, pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 10 October 2001
+* SUMMARY: Regression test for Bugzilla bug 104077
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=104077
+* "JS crash: with/finally/return"
+*
+* Also http://bugzilla.mozilla.org/show_bug.cgi?id=120571
+* "JS crash: try/catch/continue."
+*
+* SpiderMonkey crashed on this code - it shouldn't.
+*
+* NOTE: the finally-blocks below should execute even if their try-blocks
+* have return or throw statements in them:
+*
+* ------- Additional Comment #76 From Mike Shaver 2001-12-07 01:21 -------
+* finally trumps return, and all other control-flow constructs that cause
+* program execution to jump out of the try block: throw, break, etc. Once you
+* enter a try block, you will execute the finally block after leaving the try,
+* regardless of what happens to make you leave the try.
+*
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 104077;
+var summary = "Just testing that we don't crash on with/finally/return -";
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+function addValues(obj)
+{
+ var sum;
+ with (obj)
+ {
+ try
+ {
+ sum = arg1 + arg2;
+ }
+ finally
+ {
+ return sum;
+ }
+ }
+}
+
+status = inSection(1);
+var obj = new Object();
+obj.arg1 = 1;
+obj.arg2 = 2;
+actual = addValues(obj);
+expect = 3;
+captureThis();
+
+
+
+function tryThis()
+{
+ var sum = 4 ;
+ var i = 0;
+
+ while (sum < 10)
+ {
+ try
+ {
+ sum += 1;
+ i += 1;
+ }
+ finally
+ {
+ print("In finally case of tryThis() function");
+ }
+ }
+ return i;
+}
+
+status = inSection(2);
+actual = tryThis();
+expect = 6;
+captureThis();
+
+
+
+function myTest(x)
+{
+ var obj = new Object();
+ var msg;
+
+ with (obj)
+ {
+ msg = (x != null) ? "NO" : "YES";
+ print("Is the provided argument to myTest() null? : " + msg);
+
+ try
+ {
+ throw "ZZZ";
+ }
+ catch(e)
+ {
+ print("Caught thrown exception = " + e);
+ }
+ }
+
+ return 1;
+}
+
+status = inSection(3);
+actual = myTest(null);
+expect = 1;
+captureThis();
+
+
+
+function addValues_2(obj)
+{
+ var sum = 0;
+ with (obj)
+ {
+ try
+ {
+ sum = arg1 + arg2;
+ with (arg3)
+ {
+ while (sum < 10)
+ {
+ try
+ {
+ if (sum > 5)
+ return sum;
+ sum += 1;
+ }
+ catch(e)
+ {
+ print('Caught an exception in addValues_2() function: ' + e);
+ }
+ }
+ }
+ }
+ finally
+ {
+ return sum;
+ }
+ }
+}
+
+status = inSection(4);
+obj = new Object();
+obj.arg1 = 1;
+obj.arg2 = 2;
+obj.arg3 = new Object();
+obj.arg3.a = 10;
+obj.arg3.b = 20;
+actual = addValues_2(obj);
+expect = 6;
+captureThis();
+
+
+
+status = inSection(5);
+try
+{
+ throw new A();
+}
+catch(e)
+{
+}
+finally
+{
+ try
+ {
+ throw new A();
+ }
+ catch(e)
+ {
+ }
+ finally
+ {
+ actual = 'a';
+ }
+ actual = 'b';
+}
+expect = 'b';
+captureThis();
+
+
+
+
+function testfunc(mode)
+{
+ var obj = new Object();
+ with (obj)
+ {
+ var num = 100;
+ var str = "abc" ;
+
+ if (str == null)
+ {
+ try
+ {
+ throw "authentication.0";
+ }
+ catch(e)
+ {
+ }
+ finally
+ {
+ }
+
+ return num;
+ }
+ else
+ {
+ try
+ {
+ if (mode == 0)
+ throw "authentication.0";
+ else
+ mytest();
+ }
+ catch(e)
+ {
+ }
+ finally
+ {
+ }
+
+ return num;
+ }
+ }
+}
+
+status = inSection(6);
+actual = testfunc(0);
+expect = 100;
+captureThis();
+
+status = inSection(7);
+actual = testfunc();
+expect = 100;
+captureThis();
+
+
+
+
+function entry_menu()
+{
+ var document = new Object();
+ var dialog = new Object();
+ var num = 100;
+
+ with (document)
+ {
+ with (dialog)
+ {
+ try
+ {
+ while (true)
+ {
+ return num;
+ }
+ }
+ finally
+ {
+ }
+ }
+ }
+}
+
+status = inSection(8);
+actual = entry_menu();
+expect = 100;
+captureThis();
+
+
+
+
+function addValues_3(obj)
+{
+ var sum = 0;
+
+ with (obj)
+ {
+ try
+ {
+ sum = arg1 + arg2;
+ with (arg3)
+ {
+ while (sum < 10)
+ {
+ try
+ {
+ if (sum > 5)
+ return sum;
+ sum += 1;
+ }
+ catch (e)
+ {
+ sum += 1;
+ print(e);
+ }
+ }
+ }
+ }
+ finally
+ {
+ try
+ {
+ sum +=1;
+ print("In finally block of addValues_3() function: sum = " + sum);
+ }
+ catch (e if e == 42)
+ {
+ sum +=1;
+ print('In finally catch block of addValues_3() function: sum = ' + sum + ', e = ' + e);
+ }
+ finally
+ {
+ sum +=1;
+ print("In finally finally block of addValues_3() function: sum = " + sum);
+ return sum;
+ }
+ }
+ }
+}
+
+status = inSection(9);
+obj = new Object();
+obj.arg1 = 1;
+obj.arg2 = 2;
+obj.arg3 = new Object();
+obj.arg3.a = 10;
+obj.arg3.b = 20;
+actual = addValues_3(obj);
+expect = 8;
+captureThis();
+
+
+
+
+function addValues_4(obj)
+{
+ var sum = 0;
+
+ with (obj)
+ {
+ try
+ {
+ sum = arg1 + arg2;
+ with (arg3)
+ {
+ while (sum < 10)
+ {
+ try
+ {
+ if (sum > 5)
+ return sum;
+ sum += 1;
+ }
+ catch (e)
+ {
+ sum += 1;
+ print(e);
+ }
+ }
+ }
+ }
+ finally
+ {
+ try
+ {
+ sum += 1;
+ print("In finally block of addValues_4() function: sum = " + sum);
+ }
+ catch (e if e == 42)
+ {
+ sum += 1;
+ print("In 1st finally catch block of addValues_4() function: sum = " + sum + ", e = " + e);
+ }
+ catch (e if e == 43)
+ {
+ sum += 1;
+ print("In 2nd finally catch block of addValues_4() function: sum = " + sum + ", e = " + e);
+ }
+ finally
+ {
+ sum += 1;
+ print("In finally finally block of addValues_4() function: sum = " + sum);
+ return sum;
+ }
+ }
+ }
+}
+
+status = inSection(10);
+obj = new Object();
+obj.arg1 = 1;
+obj.arg2 = 2;
+obj.arg3 = new Object();
+obj.arg3.a = 10;
+obj.arg3.b = 20;
+actual = addValues_4(obj);
+expect = 8;
+captureThis();
+
+
+
+
+function addValues_5(obj)
+{
+ var sum = 0;
+
+ with (obj)
+ {
+ try
+ {
+ sum = arg1 + arg2;
+ with (arg3)
+ {
+ while (sum < 10)
+ {
+ try
+ {
+ if (sum > 5)
+ return sum;
+ sum += 1;
+ }
+ catch (e)
+ {
+ sum += 1;
+ print(e);
+ }
+ }
+ }
+ }
+ finally
+ {
+ try
+ {
+ sum += 1;
+ print("In finally block of addValues_5() function: sum = " + sum);
+ }
+ catch (e)
+ {
+ sum += 1;
+ print("In finally catch block of addValues_5() function: sum = " + sum + ", e = " + e);
+ }
+ finally
+ {
+ sum += 1;
+ print("In finally finally block of addValues_5() function: sum = " + sum);
+ return sum;
+ }
+ }
+ }
+}
+
+status = inSection(11);
+obj = new Object();
+obj.arg1 = 1;
+obj.arg2 = 2;
+obj.arg3 = new Object();
+obj.arg3.a = 10;
+obj.arg3.b = 20;
+actual = addValues_5(obj);
+expect = 8;
+captureThis();
+
+
+
+
+function testObj(obj)
+{
+ var x = 42;
+
+ try
+ {
+ with (obj)
+ {
+ if (obj.p)
+ throw obj.p;
+ x = obj.q;
+ }
+ }
+ finally
+ {
+ print("in finally block of testObj() function");
+ return 999;
+ }
+}
+
+status = inSection(12);
+obj = {p:43};
+actual = testObj(obj);
+expect = 999;
+captureThis();
+
+
+
+/*
+ * Next two cases are from http://bugzilla.mozilla.org/show_bug.cgi?id=120571
+ */
+function a120571()
+{
+ while(0)
+ {
+ try
+ {
+ }
+ catch(e)
+ {
+ continue;
+ }
+ }
+}
+
+// this caused a crash! Test to see that it doesn't now.
+print(a120571);
+
+// Now test that we have a non-null value for a120571.toString()
+status = inSection(13);
+try
+{
+ actual = a120571.toString().match(/continue/)[0];
+}
+catch(e)
+{
+ actual = 'FAILED! Did not find "continue" in function body';
+}
+expect = 'continue';
+captureThis();
+
+
+
+
+function b()
+{
+ for(;;)
+ {
+ try
+ {
+ }
+ catch(e)
+ {
+ continue;
+ }
+ }
+}
+
+// this caused a crash!!! Test to see that it doesn't now.
+print(b);
+
+// Now test that we have a non-null value for b.toString()
+status = inSection(14);
+try
+{
+ actual = b.toString().match(/continue/)[0];
+}
+catch(e)
+{
+ actual = 'FAILED! Did not find "continue" in function body';
+}
+expect = 'continue';
+captureThis();
+
+
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function captureThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-110286.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-110286.js
new file mode 100644
index 0000000..36959c2
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-110286.js
@@ -0,0 +1,151 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2001
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 16 Nov 2001
+* SUMMARY: multiline comments containing "/*" should not be syntax errors
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=110286
+*
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 110286;
+var summary = 'Multiline comments containing "/*" should not be syntax errors';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+status = inSection(1);
+actual = eval("/* /* */3");
+expect = 3;
+addThis();
+
+status = inSection(2);
+actual = eval("3/* /* */");
+expect = 3;
+addThis();
+
+status = inSection(3);
+actual = eval("/* 3/* */");
+expect = undefined;
+addThis();
+
+status = inSection(4);
+actual = eval("/* /*3 */");
+expect = undefined;
+addThis();
+
+status = inSection(5);
+var passed = true;
+try
+{
+ eval("/* blah blah /* blah blah */");
+}
+catch(e)
+{
+ passed = false;
+}
+actual = passed;
+expect = true;
+addThis();
+
+
+status = inSection(6);
+try
+{
+ /*
+ /*A/* /* /*A/*
+ /* blah blah /*
+ /* blah blah /*
+ /* /*A/* /*A/*
+ */
+ var result = 'PASSED';
+}
+catch(e)
+{
+ var result = 'FAILED';
+}
+actual = result;
+expect = 'PASSED';
+addThis();
+
+
+status = inSection(7);
+var str = 'ABC';
+/*
+ * /*
+ * /*
+ * /*
+ * /*
+ *
+ */
+str += 'DEF';
+actual = str;
+expect = 'ABCDEF';
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ for (var i = 0; i < UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-111557.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-111557.js
new file mode 100644
index 0000000..375b906
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-111557.js
@@ -0,0 +1,10960 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2001
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 26 Nov 2001
+* SUMMARY: JS should not crash on this code
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=111557
+*
+*/
+//-----------------------------------------------------------------------------
+var bug = 111557;
+var summary = "Just seeing that we don't crash on this code -";
+
+printBugNumber(bug);
+printStatus(summary);
+
+
+/*
+ * NOTE: have defined |top| as |this| to make this a standalone JS shell test.
+ * This came from the HTML of a frame, where |top| would have its DOM meaning.
+ */
+var top = this;
+
+ top.authors = new Array();
+ top.titles = new Array();
+ var i = 0;
+
+
+ top.authors[i] = "zPROD xA.5375.";
+ top.titles[i] = "NDS Libraries for C";
+ i++;
+
+ top.authors[i] = "zFLDR xB.5375.0100.";
+ top.titles[i] = "NDS Backup Services";
+ i++;
+
+ top.authors[i] = "zFLDR xC.5375.0100.0001.";
+ top.titles[i] = "Functions";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0100.0001.0001.";
+ top.titles[i] = "NDSBackupServerData";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0100.0001.0002.";
+ top.titles[i] = "NDSFreeNameList";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0100.0001.0003.";
+ top.titles[i] = "NDSGetReplicaPartitionNames";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0100.0001.0004.";
+ top.titles[i] = "NDSIsOnlyServerInTree";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0100.0001.0005.";
+ top.titles[i] = "NDSSYSVolumeRecovery";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0100.0001.0006.";
+ top.titles[i] = "NDSVerifyServerInfo";
+ i++;
+
+ top.authors[i] = "zFLDR xC.5375.0100.0002.";
+ top.titles[i] = "Structures";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0100.0002.0001.";
+ top.titles[i] = "NAMEID_TYPE";
+ i++;
+
+ top.authors[i] = "zFLDR xC.5375.0100.0003.";
+ top.titles[i] = "Values";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0100.0003.0001.";
+ top.titles[i] = "NDS Reason Flags";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0100.0003.0002.";
+ top.titles[i] = "NDS Server Flags";
+ i++;
+
+ top.authors[i] = "zHTML xC.5375.0100.0004.";
+ top.titles[i] = "Revision History";
+ i++;
+
+ top.authors[i] = "zFLDR xB.5375.0300.";
+ top.titles[i] = "NDS Event Services";
+ i++;
+
+ top.authors[i] = "zFLDR xC.5375.0300.0001.";
+ top.titles[i] = "Concepts";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0300.0001.0001.";
+ top.titles[i] = "NDS Event Introduction";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0300.0001.0002.";
+ top.titles[i] = "NDS Event Functions";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0300.0001.0003.";
+ top.titles[i] = "NDS Event Priorities";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0300.0001.0004.";
+ top.titles[i] = "NDS Event Data Filtering";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0300.0001.0005.";
+ top.titles[i] = "NDS Event Types";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0300.0001.0006.";
+ top.titles[i] = "Global Network Monitoring";
+ i++;
+
+ top.authors[i] = "zFLDR xC.5375.0300.0002.";
+ top.titles[i] = "Tasks";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0300.0002.0001.";
+ top.titles[i] = "Monitoring NDS Events";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0300.0002.0002.";
+ top.titles[i] = "Registering for NDS Events";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0300.0002.0003.";
+ top.titles[i] = "Unregistering for NDS Events";
+ i++;
+
+ top.authors[i] = "zFLDR xC.5375.0300.0003.";
+ top.titles[i] = "Functions";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0300.0003.0001.";
+ top.titles[i] = "NWDSEConvertEntryName";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0300.0003.0002.";
+ top.titles[i] = "NWDSEGetLocalAttrID";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0300.0003.0003.";
+ top.titles[i] = "NWDSEGetLocalAttrName";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0300.0003.0004.";
+ top.titles[i] = "NWDSEGetLocalClassID";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0300.0003.0005.";
+ top.titles[i] = "NWDSEGetLocalClassName";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0300.0003.0006.";
+ top.titles[i] = "NWDSEGetLocalEntryID";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0300.0003.0007.";
+ top.titles[i] = "NWDSEGetLocalEntryName";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0300.0003.0008.";
+ top.titles[i] = "NWDSERegisterForEvent";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0300.0003.0009.";
+ top.titles[i] = "NWDSERegisterForEventWithResult";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0300.0003.0010.";
+ top.titles[i] = "NWDSEUnRegisterForEvent";
+ i++;
+
+ top.authors[i] = "zFLDR xC.5375.0300.0004.";
+ top.titles[i] = "Structures";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0300.0004.0001.";
+ top.titles[i] = "DSEACL";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0300.0004.0002.";
+ top.titles[i] = "DSEBackLink";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0300.0004.0003.";
+ top.titles[i] = "DSEBinderyObjectInfo";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0300.0004.0004.";
+ top.titles[i] = "DSEBitString";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0300.0004.0005.";
+ top.titles[i] = "DSEChangeConnState";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0300.0004.0006.";
+ top.titles[i] = "DSECIList";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0300.0004.0007.";
+ top.titles[i] = "DSEDebugInfo";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0300.0004.0008.";
+ top.titles[i] = "DSEEmailAddress";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0300.0004.0009.";
+ top.titles[i] = "DSEEntryInfo";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0300.0004.0010.";
+ top.titles[i] = "DSEEntryInfo2";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0300.0004.0011.";
+ top.titles[i] = "DSEEventData";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0300.0004.0012.";
+ top.titles[i] = "DSEFaxNumber";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0300.0004.0013.";
+ top.titles[i] = "DSEHold";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0300.0004.0014.";
+ top.titles[i] = "DSEModuleState";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0300.0004.0015.";
+ top.titles[i] = "DSENetAddress";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0300.0004.0016.";
+ top.titles[i] = "DSEOctetList";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0300.0004.0017.";
+ top.titles[i] = "DSEPath";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0300.0004.0018.";
+ top.titles[i] = "DSEReplicaPointer";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0300.0004.0019.";
+ top.titles[i] = "DSESEVInfo";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0300.0004.0020.";
+ top.titles[i] = "DSETimeStamp";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0300.0004.0021.";
+ top.titles[i] = "DSETraceInfo";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0300.0004.0022.";
+ top.titles[i] = "DSETypedName";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0300.0004.0023.";
+ top.titles[i] = "DSEVALData";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0300.0004.0024.";
+ top.titles[i] = "DSEValueInfo";
+ i++;
+
+ top.authors[i] = "zFLDR xC.5375.0300.0005.";
+ top.titles[i] = "Values";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0300.0005.0001.";
+ top.titles[i] = "Event Priorities";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0300.0005.0002.";
+ top.titles[i] = "Event Types";
+ i++;
+
+ top.authors[i] = "zHTML xC.5375.0300.0006.";
+ top.titles[i] = "Revision History";
+ i++;
+
+ top.authors[i] = "zFLDR xB.5375.0600.";
+ top.titles[i] = "NDS Technical Overview";
+ i++;
+
+ top.authors[i] = "zFLDR xC.5375.0600.0001.";
+ top.titles[i] = "NDS as the Internet Directory";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0600.0001.0001.";
+ top.titles[i] = "Requirements for Networks and the Internet";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0600.0001.0002.";
+ top.titles[i] = "NDS Compliance to X.500 Standard";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0600.0001.0003.";
+ top.titles[i] = "NDS Compliance with LDAP v3";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0600.0001.0004.";
+ top.titles[i] = "Directory Access Protocols";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0600.0001.0005.";
+ top.titles[i] = "Programming Interfaces for NDS";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0600.0001.0006.";
+ top.titles[i] = "NDS Architecture";
+ i++;
+
+ top.authors[i] = "zFLDR xC.5375.0600.0002.";
+ top.titles[i] = "NDS Objects";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0600.0002.0001.";
+ top.titles[i] = "NDS Names";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0600.0002.0002.";
+ top.titles[i] = "Types of Information Stored in NDS";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0600.0002.0003.";
+ top.titles[i] = "Retrieval of Information from NDS";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0600.0002.0004.";
+ top.titles[i] = "Tree Walking";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0600.0002.0005.";
+ top.titles[i] = "NDS Object Management";
+ i++;
+
+ top.authors[i] = "zFLDR xC.5375.0600.0003.";
+ top.titles[i] = "NDS Security";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0600.0003.0001.";
+ top.titles[i] = "Authentication";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0600.0003.0002.";
+ top.titles[i] = "Access Control Lists";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0600.0003.0003.";
+ top.titles[i] = "Inheritance";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0600.0003.0004.";
+ top.titles[i] = "NetWare File System";
+ i++;
+
+ top.authors[i] = "zFLDR xC.5375.0600.0004.";
+ top.titles[i] = "Partitions and Replicas";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0600.0004.0001.";
+ top.titles[i] = "Partitioning";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0600.0004.0002.";
+ top.titles[i] = "Replication";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0600.0004.0003.";
+ top.titles[i] = "Distributed Reference Management";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0600.0004.0004.";
+ top.titles[i] = "Partition Operations";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0600.0004.0005.";
+ top.titles[i] = "Synchronization";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0600.0004.0006.";
+ top.titles[i] = "Background Processes";
+ i++;
+
+ top.authors[i] = "zFLDR xC.5375.0600.0005.";
+ top.titles[i] = "Bindery Services";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0600.0005.0001.";
+ top.titles[i] = "NDS Bindery Context";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0600.0005.0002.";
+ top.titles[i] = "Bindery Context Path";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0600.0005.0003.";
+ top.titles[i] = "Bindery Context Eclipsing";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0600.0005.0004.";
+ top.titles[i] = "NDS Bindery Objects";
+ i++;
+
+ top.authors[i] = "zFLDR xC.5375.0600.0006.";
+ top.titles[i] = "NDS Return Values";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0600.0006.0001.";
+ top.titles[i] = "NDS Return Values from the Operating System";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0600.0006.0002.";
+ top.titles[i] = "NDS Client Return Values";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0600.0006.0003.";
+ top.titles[i] = "NDS Agent Return Values";
+ i++;
+
+ top.authors[i] = "zFLDR xC.5375.0600.0007.";
+ top.titles[i] = "Directory Services Trace Utilities";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0600.0007.0001.";
+ top.titles[i] = "Using the DSTrace NLM";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0600.0007.0002.";
+ top.titles[i] = "Using Basic SET DSTrace Commands";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0600.0007.0003.";
+ top.titles[i] = "Starting Background Processes with SET DSTrace";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0600.0007.0004.";
+ top.titles[i] = "Tuning Background Processes";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0600.0007.0005.";
+ top.titles[i] = "Enabling DSTrace Messages with SET DSTrace";
+ i++;
+
+ top.authors[i] = "zHTML xC.5375.0600.0008.";
+ top.titles[i] = "Revision History";
+ i++;
+
+ top.authors[i] = "zFLDR xB.5375.0200.";
+ top.titles[i] = "NDS Core Services";
+ i++;
+
+ top.authors[i] = "zFLDR xC.5375.0200.0001.";
+ top.titles[i] = "Programming Concepts";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0001.0001.";
+ top.titles[i] = "Context Handles";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0001.0002.";
+ top.titles[i] = "Buffer Management";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0001.0003.";
+ top.titles[i] = "Read Requests for Object Information";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0001.0004.";
+ top.titles[i] = "Search Requests";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0001.0005.";
+ top.titles[i] = "Developing in a Loosely Consistent Environment";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0001.0006.";
+ top.titles[i] = "Add Object Requests";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0001.0007.";
+ top.titles[i] = "NDS Security and Applications";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0001.0008.";
+ top.titles[i] = "Authentication of Client Applications";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0001.0009.";
+ top.titles[i] = "Multiple Tree Support";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0001.0010.";
+ top.titles[i] = "Effective Rights Function";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0001.0011.";
+ top.titles[i] = "Partition Functions";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0001.0012.";
+ top.titles[i] = "Replica Functions";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0001.0013.";
+ top.titles[i] = "Read Requests for Schema Information";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0001.0014.";
+ top.titles[i] = "Schema Extension Requests";
+ i++;
+
+ top.authors[i] = "zFLDR xC.5375.0200.0002.";
+ top.titles[i] = "Tasks";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0002.0001.";
+ top.titles[i] = "Context Handle Tasks";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0002.0002.";
+ top.titles[i] = "Buffer Tasks";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0002.0003.";
+ top.titles[i] = "Authentication and Connection Tasks";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0002.0004.";
+ top.titles[i] = "Object Tasks";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0002.0005.";
+ top.titles[i] = "Partition and Replica Tasks";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0002.0006.";
+ top.titles[i] = "Schema Tasks";
+ i++;
+
+ top.authors[i] = "zFLDR xC.5375.0200.0003.";
+ top.titles[i] = "Functions";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0001.";
+ top.titles[i] = "NWDSAbbreviateName";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0002.";
+ top.titles[i] = "NWDSAbortPartitionOperation";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0003.";
+ top.titles[i] = "NWDSAddFilterToken";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0004.";
+ top.titles[i] = "NWDSAddObject";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0005.";
+ top.titles[i] = "NWDSAddPartition (obsolete&#45;&#45;&#45;moved from .h file 11/99)";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0006.";
+ top.titles[i] = "NWDSAddReplica";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0007.";
+ top.titles[i] = "NWDSAddSecurityEquiv";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0008.";
+ top.titles[i] = "NWDSAllocBuf";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0009.";
+ top.titles[i] = "NWDSAllocFilter";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0010.";
+ top.titles[i] = "NWDSAuditGetObjectID";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0011.";
+ top.titles[i] = "NWDSAuthenticate";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0012.";
+ top.titles[i] = "NWDSAuthenticateConn";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0013.";
+ top.titles[i] = "NWDSAuthenticateConnEx";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0014.";
+ top.titles[i] = "NWDSBackupObject";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0015.";
+ top.titles[i] = "NWDSBeginClassItem";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0016.";
+ top.titles[i] = "NWDSCanDSAuthenticate";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0017.";
+ top.titles[i] = "NWDSCanonicalizeName";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0018.";
+ top.titles[i] = "NWDSChangeObjectPassword";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0019.";
+ top.titles[i] = "NWDSChangeReplicaType";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0020.";
+ top.titles[i] = "NWDSCIStringsMatch";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0021.";
+ top.titles[i] = "NWDSCloseIteration";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0022.";
+ top.titles[i] = "NWDSCompare";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0023.";
+ top.titles[i] = "NWDSComputeAttrValSize";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0024.";
+ top.titles[i] = "NWDSCreateContext (obsolete&#45;&#45;&#45;moved from .h file 6/99)";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0025.";
+ top.titles[i] = "NWDSCreateContextHandle";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0026.";
+ top.titles[i] = "NWDSDefineAttr";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0027.";
+ top.titles[i] = "NWDSDefineClass";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0028.";
+ top.titles[i] = "NWDSDelFilterToken";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0029.";
+ top.titles[i] = "NWDSDuplicateContext (obsolete 03/99)";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0030.";
+ top.titles[i] = "NWDSDuplicateContextHandle";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0031.";
+ top.titles[i] = "NWDSExtSyncList";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0032.";
+ top.titles[i] = "NWDSExtSyncRead";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0033.";
+ top.titles[i] = "NWDSExtSyncSearch";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0034.";
+ top.titles[i] = "NWDSFreeBuf";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0035.";
+ top.titles[i] = "NWDSFreeContext";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0036.";
+ top.titles[i] = "NWDSFreeFilter";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0037.";
+ top.titles[i] = "NWDSGenerateObjectKeyPair";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0038.";
+ top.titles[i] = "NWDSGetAttrCount";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0039.";
+ top.titles[i] = "NWDSGetAttrDef";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0040.";
+ top.titles[i] = "NWDSGetAttrName";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0041.";
+ top.titles[i] = "NWDSGetAttrVal";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0042.";
+ top.titles[i] = "NWDSGetAttrValFlags";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0043.";
+ top.titles[i] = "NWDSGetAttrValModTime";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0044.";
+ top.titles[i] = "NWDSGetBinderyContext";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0045.";
+ top.titles[i] = "NWDSGetClassDef";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0046.";
+ top.titles[i] = "NWDSGetClassDefCount";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0047.";
+ top.titles[i] = "NWDSGetClassItem";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0048.";
+ top.titles[i] = "NWDSGetClassItemCount";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0049.";
+ top.titles[i] = "NWDSGetContext";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0050.";
+ top.titles[i] = "NWDSGetCountByClassAndName";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0051.";
+ top.titles[i] = "NWDSGetCurrentUser";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0052.";
+ top.titles[i] = "NWDSGetDefNameContext";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0053.";
+ top.titles[i] = "NWDSGetDSIInfo";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0054.";
+ top.titles[i] = "NWDSGetDSVerInfo";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0055.";
+ top.titles[i] = "NWDSGetEffectiveRights";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0056.";
+ top.titles[i] = "NWDSGetMonitoredConnRef";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0057.";
+ top.titles[i] = "NWDSGetNDSInfo";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0058.";
+ top.titles[i] = "NWDSGetObjectCount";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0059.";
+ top.titles[i] = "NWDSGetObjectHostServerAddress";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0060.";
+ top.titles[i] = "NWDSGetObjectName";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0061.";
+ top.titles[i] = "NWDSGetObjectNameAndInfo";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0062.";
+ top.titles[i] = "NWDSGetPartitionExtInfo";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0063.";
+ top.titles[i] = "NWDSGetPartitionExtInfoPtr";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0064.";
+ top.titles[i] = "NWDSGetPartitionInfo";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0065.";
+ top.titles[i] = "NWDSGetPartitionRoot";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0066.";
+ top.titles[i] = "NWDSGetServerAddresses (obsolete 3/98)";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0067.";
+ top.titles[i] = "NWDSGetServerAddresses2";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0068.";
+ top.titles[i] = "NWDSGetServerDN";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0069.";
+ top.titles[i] = "NWDSGetServerName";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0070.";
+ top.titles[i] = "NWDSGetSyntaxCount";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0071.";
+ top.titles[i] = "NWDSGetSyntaxDef";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0072.";
+ top.titles[i] = "NWDSGetSyntaxID";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0073.";
+ top.titles[i] = "NWDSInitBuf";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0074.";
+ top.titles[i] = "NWDSInspectEntry";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0075.";
+ top.titles[i] = "NWDSJoinPartitions";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0076.";
+ top.titles[i] = "NWDSList";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0077.";
+ top.titles[i] = "NWDSListAttrsEffectiveRights";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0078.";
+ top.titles[i] = "NWDSListByClassAndName";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0079.";
+ top.titles[i] = "NWDSListContainableClasses";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0080.";
+ top.titles[i] = "NWDSListContainers";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0081.";
+ top.titles[i] = "NWDSListPartitions";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0082.";
+ top.titles[i] = "NWDSListPartitionsExtInfo";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0083.";
+ top.titles[i] = "NWDSLogin";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0084.";
+ top.titles[i] = "NWDSLoginAsServer";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0085.";
+ top.titles[i] = "NWDSLogout";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0086.";
+ top.titles[i] = "NWDSMapIDToName";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0087.";
+ top.titles[i] = "NWDSMapNameToID";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0088.";
+ top.titles[i] = "NWDSModifyClassDef";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0089.";
+ top.titles[i] = "NWDSModifyDN";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0090.";
+ top.titles[i] = "NWDSModifyObject";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0091.";
+ top.titles[i] = "NWDSModifyRDN";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0092.";
+ top.titles[i] = "NWDSMoveObject";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0093.";
+ top.titles[i] = "NWDSMutateObject";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0094.";
+ top.titles[i] = "NWDSOpenConnToNDSServer";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0095.";
+ top.titles[i] = "NWDSOpenMonitoredConn";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0096.";
+ top.titles[i] = "NWDSOpenStream";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0097.";
+ top.titles[i] = "NWDSPartitionReceiveAllUpdates";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0098.";
+ top.titles[i] = "NWDSPartitionSendAllUpdates";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0099.";
+ top.titles[i] = "NWDSPutAttrName";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0100.";
+ top.titles[i] = "NWDSPutAttrNameAndVal";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0101.";
+ top.titles[i] = "NWDSPutAttrVal";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0102.";
+ top.titles[i] = "NWDSPutChange";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0103.";
+ top.titles[i] = "NWDSPutChangeAndVal";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0104.";
+ top.titles[i] = "NWDSPutClassItem";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0105.";
+ top.titles[i] = "NWDSPutClassName";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0106.";
+ top.titles[i] = "NWDSPutFilter";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0107.";
+ top.titles[i] = "NWDSPutSyntaxName";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0108.";
+ top.titles[i] = "NWDSRead";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0109.";
+ top.titles[i] = "NWDSReadAttrDef";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0110.";
+ top.titles[i] = "NWDSReadClassDef";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0111.";
+ top.titles[i] = "NWDSReadNDSInfo";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0112.";
+ top.titles[i] = "NWDSReadObjectDSIInfo";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0113.";
+ top.titles[i] = "NWDSReadObjectInfo";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0114.";
+ top.titles[i] = "NWDSReadReferences";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0115.";
+ top.titles[i] = "NWDSReadSyntaxDef";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0116.";
+ top.titles[i] = "NWDSReadSyntaxes";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0117.";
+ top.titles[i] = "NWDSReloadDS";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0118.";
+ top.titles[i] = "NWDSRemoveAllTypes";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0119.";
+ top.titles[i] = "NWDSRemoveAttrDef";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0120.";
+ top.titles[i] = "NWDSRemoveClassDef";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0121.";
+ top.titles[i] = "NWDSRemoveObject";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0122.";
+ top.titles[i] = "NWDSRemovePartition";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0123.";
+ top.titles[i] = "NWDSRemoveReplica";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0124.";
+ top.titles[i] = "NWDSRemSecurityEquiv";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0125.";
+ top.titles[i] = "NWDSRepairTimeStamps";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0126.";
+ top.titles[i] = "NWDSReplaceAttrNameAbbrev";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0127.";
+ top.titles[i] = "NWDSResolveName";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0128.";
+ top.titles[i] = "NWDSRestoreObject";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0129.";
+ top.titles[i] = "NWDSReturnBlockOfAvailableTrees";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0130.";
+ top.titles[i] = "NWDSScanConnsForTrees";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0131.";
+ top.titles[i] = "NWDSScanForAvailableTrees";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0132.";
+ top.titles[i] = "NWDSSearch";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0133.";
+ top.titles[i] = "NWDSSetContext";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0134.";
+ top.titles[i] = "NWDSSetCurrentUser";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0135.";
+ top.titles[i] = "NWDSSetDefNameContext";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0136.";
+ top.titles[i] = "NWDSSetMonitoredConnection";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0137.";
+ top.titles[i] = "NWDSSplitPartition";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0138.";
+ top.titles[i] = "NWDSSyncPartition";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0139.";
+ top.titles[i] = "NWDSSyncReplicaToServer";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0140.";
+ top.titles[i] = "NWDSSyncSchema";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0141.";
+ top.titles[i] = "NWDSUnlockConnection";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0142.";
+ top.titles[i] = "NWDSVerifyObjectPassword";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0143.";
+ top.titles[i] = "NWDSWhoAmI";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0144.";
+ top.titles[i] = "NWGetDefaultNameContext";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0145.";
+ top.titles[i] = "NWGetFileServerUTCTime";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0146.";
+ top.titles[i] = "NWGetNumConnections";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0147.";
+ top.titles[i] = "NWGetNWNetVersion";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0148.";
+ top.titles[i] = "NWGetPreferredConnName";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0149.";
+ top.titles[i] = "NWIsDSAuthenticated";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0150.";
+ top.titles[i] = "NWIsDSServer";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0151.";
+ top.titles[i] = "NWNetInit";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0152.";
+ top.titles[i] = "NWNetTerm";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0153.";
+ top.titles[i] = "NWSetDefaultNameContext";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0003.0154.";
+ top.titles[i] = "NWSetPreferredDSTree";
+ i++;
+
+ top.authors[i] = "zFLDR xC.5375.0200.0004.";
+ top.titles[i] = "Structures";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0004.0001.";
+ top.titles[i] = "Asn1ID_T";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0004.0002.";
+ top.titles[i] = "Attr_Info_T";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0004.0003.";
+ top.titles[i] = "Back_Link_T";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0004.0004.";
+ top.titles[i] = "Bit_String_T";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0004.0005.";
+ top.titles[i] = "Buf_T";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0004.0006.";
+ top.titles[i] = "CI_List_T";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0004.0007.";
+ top.titles[i] = "Class_Info_T";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0004.0008.";
+ top.titles[i] = "EMail_Address_T";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0004.0009.";
+ top.titles[i] = "Fax_Number_T";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0004.0010.";
+ top.titles[i] = "Filter_Cursor_T";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0004.0011.";
+ top.titles[i] = "Filter_Node_T";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0004.0012.";
+ top.titles[i] = "Hold_T";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0004.0013.";
+ top.titles[i] = "NDSOSVersion_T";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0004.0014.";
+ top.titles[i] = "NDSStatsInfo_T";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0004.0015.";
+ top.titles[i] = "Net_Address_T";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0004.0016.";
+ top.titles[i] = "NWDS_TimeStamp_T";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0004.0017.";
+ top.titles[i] = "Object_ACL_T";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0004.0018.";
+ top.titles[i] = "Object_Info_T";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0004.0019.";
+ top.titles[i] = "Octet_List_T";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0004.0020.";
+ top.titles[i] = "Octet_String_T";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0004.0021.";
+ top.titles[i] = "Path_T";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0004.0022.";
+ top.titles[i] = "Replica_Pointer_T";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0004.0023.";
+ top.titles[i] = "Syntax_Info_T";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0004.0024.";
+ top.titles[i] = "TimeStamp_T";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0004.0025.";
+ top.titles[i] = "Typed_Name_T";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0004.0026.";
+ top.titles[i] = "Unknown_Attr_T";
+ i++;
+
+ top.authors[i] = "zFLDR xC.5375.0200.0005.";
+ top.titles[i] = "Values";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0005.0001.";
+ top.titles[i] = "Attribute Constraint Flags";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0005.0002.";
+ top.titles[i] = "Attribute Value Flags";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0005.0003.";
+ top.titles[i] = "Buffer Operation Types and Related Functions";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0005.0004.";
+ top.titles[i] = "Class Flags";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0005.0005.";
+ top.titles[i] = "Change Types for Modifying Objects";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0005.0006.";
+ top.titles[i] = "Context Keys and Flags";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0005.0007.";
+ top.titles[i] = "Default Context Key Values";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0005.0008.";
+ top.titles[i] = "DCK_FLAGS Bit Values";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0005.0009.";
+ top.titles[i] = "DCK_NAME_FORM Values";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0005.0010.";
+ top.titles[i] = "DCK_CONFIDENCE Bit Values";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0005.0011.";
+ top.titles[i] = "DCK_DSI_FLAGS Values";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0005.0012.";
+ top.titles[i] = "DSI_ENTRY_FLAGS Values";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0005.0013.";
+ top.titles[i] = "Filter Tokens";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0005.0014.";
+ top.titles[i] = "Information Types for Attribute Definitions";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0005.0015.";
+ top.titles[i] = "Information Types for Class Definitions";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0005.0016.";
+ top.titles[i] = "Information Types for Search and Read";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0005.0017.";
+ top.titles[i] = "Name Space Types";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0005.0018.";
+ top.titles[i] = "NDS Access Control Rights";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0005.0019.";
+ top.titles[i] = "NDS Ping Flags";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0005.0020.";
+ top.titles[i] = "DSP Replica Information Flags";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0005.0021.";
+ top.titles[i] = "Network Address Types";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0005.0022.";
+ top.titles[i] = "Scope Flags";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0005.0023.";
+ top.titles[i] = "Replica Types";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0005.0024.";
+ top.titles[i] = "Replica States";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0005.0025.";
+ top.titles[i] = "Syntax Matching Flags";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0005.0026.";
+ top.titles[i] = "Syntax IDs";
+ i++;
+
+ top.authors[i] = "zFLDR xC.5375.0200.0006.";
+ top.titles[i] = "NDS Example Code";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0006.0001.";
+ top.titles[i] = "Context Handle";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0006.0002.";
+ top.titles[i] = "Object and Attribute";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0006.0003.";
+ top.titles[i] = "Browsing and Searching";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0006.0004.";
+ top.titles[i] = "Batch Modification of Objects and Attributes";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0200.0006.0005.";
+ top.titles[i] = "Schema";
+ i++;
+
+ top.authors[i] = "zHTML xC.5375.0200.0007.";
+ top.titles[i] = "Revision History";
+ i++;
+
+ top.authors[i] = "zFLDR xB.5375.0500.";
+ top.titles[i] = "NDS Schema Reference";
+ i++;
+
+ top.authors[i] = "zFLDR xC.5375.0500.0001.";
+ top.titles[i] = "Schema Concepts";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0001.0001.";
+ top.titles[i] = "Schema Structure";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0001.0002.";
+ top.titles[i] = "Schema Components";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0001.0003.";
+ top.titles[i] = "Object Classes";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0001.0004.";
+ top.titles[i] = "Naming Attributes";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0001.0005.";
+ top.titles[i] = "Containment Classes";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0001.0006.";
+ top.titles[i] = "Super Classes";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0001.0007.";
+ top.titles[i] = "Object Class Flags";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0001.0008.";
+ top.titles[i] = "Mandatory and Optional Attributes";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0001.0009.";
+ top.titles[i] = "Default ACL Templates";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0001.0010.";
+ top.titles[i] = "Auxiliary Classes";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0001.0011.";
+ top.titles[i] = "Attribute Type Definitions";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0001.0012.";
+ top.titles[i] = "Attribute Syntax Definitions";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0001.0013.";
+ top.titles[i] = "Schema Extensions";
+ i++;
+
+ top.authors[i] = "zFLDR xC.5375.0500.0002.";
+ top.titles[i] = "Base Object Class Definitions";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0002.0001.";
+ top.titles[i] = "AFP Server";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0002.0002.";
+ top.titles[i] = "Alias";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0002.0003.";
+ top.titles[i] = "applicationEntity";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0002.0004.";
+ top.titles[i] = "applicationProcess";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0002.0005.";
+ top.titles[i] = "Audit:File Object";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0002.0006.";
+ top.titles[i] = "Bindery Object";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0002.0007.";
+ top.titles[i] = "Bindery Queue";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0002.0008.";
+ top.titles[i] = "certificationAuthority";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0002.0009.";
+ top.titles[i] = "CommExec";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0002.0010.";
+ top.titles[i] = "Computer";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0002.0011.";
+ top.titles[i] = "Country";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0002.0012.";
+ top.titles[i] = "cRLDistributionPoint";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0002.0013.";
+ top.titles[i] = "dcObject";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0002.0014.";
+ top.titles[i] = "Device";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0002.0015.";
+ top.titles[i] = "Directory Map";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0002.0016.";
+ top.titles[i] = "domain";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0002.0017.";
+ top.titles[i] = "dSA";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0002.0018.";
+ top.titles[i] = "External Entity";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0002.0019.";
+ top.titles[i] = "Group";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0002.0020.";
+ top.titles[i] = "LDAP Group";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0002.0021.";
+ top.titles[i] = "LDAP Server";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0002.0022.";
+ top.titles[i] = "List";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0002.0023.";
+ top.titles[i] = "Locality";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0002.0024.";
+ top.titles[i] = "MASV:Security Policy";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0002.0025.";
+ top.titles[i] = "Message Routing Group";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0002.0026.";
+ top.titles[i] = "Messaging Server";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0002.0027.";
+ top.titles[i] = "NCP Server";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0002.0028.";
+ top.titles[i] = "ndsLoginProperties";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0002.0029.";
+ top.titles[i] = "NDSPKI:Certificate Authority";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0002.0030.";
+ top.titles[i] = "NDSPKI:Key Material";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0002.0031.";
+ top.titles[i] = "NDSPKI:SD Key Access Partition";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0002.0032.";
+ top.titles[i] = "NDSPKI:SD Key List";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0002.0033.";
+ top.titles[i] = "NDSPKI:Trusted Root";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0002.0034.";
+ top.titles[i] = "NDSPKI:Trusted Root Object";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0002.0035.";
+ top.titles[i] = "NSCP:groupOfCertificates";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0002.0036.";
+ top.titles[i] = "NSCP:mailGroup1";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0002.0037.";
+ top.titles[i] = "NSCP:mailRecipient";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0002.0038.";
+ top.titles[i] = "NSCP:NetscapeMailServer5";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0002.0039.";
+ top.titles[i] = "NSCP:NetscapeServer5";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0002.0040.";
+ top.titles[i] = "NSCP:nginfo3";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0002.0041.";
+ top.titles[i] = "NSCP:nsLicenseUser";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0002.0042.";
+ top.titles[i] = "Organization";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0002.0043.";
+ top.titles[i] = "Organizational Person";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0002.0044.";
+ top.titles[i] = "Organizational Role";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0002.0045.";
+ top.titles[i] = "Organizational Unit";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0002.0046.";
+ top.titles[i] = "Partition";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0002.0047.";
+ top.titles[i] = "Person";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0002.0048.";
+ top.titles[i] = "pkiCA";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0002.0049.";
+ top.titles[i] = "pkiUser";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0002.0050.";
+ top.titles[i] = "Print Server";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0002.0051.";
+ top.titles[i] = "Printer";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0002.0052.";
+ top.titles[i] = "Profile";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0002.0053.";
+ top.titles[i] = "Queue";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0002.0054.";
+ top.titles[i] = "Resource";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0002.0055.";
+ top.titles[i] = "SAS:Security";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0002.0056.";
+ top.titles[i] = "SAS:Service";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0002.0057.";
+ top.titles[i] = "Server";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0002.0058.";
+ top.titles[i] = "strongAuthenticationUser";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0002.0059.";
+ top.titles[i] = "Template";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0002.0060.";
+ top.titles[i] = "Top";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0002.0061.";
+ top.titles[i] = "Tree Root";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0002.0062.";
+ top.titles[i] = "Unknown";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0002.0063.";
+ top.titles[i] = "User";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0002.0064.";
+ top.titles[i] = "userSecurityInformation";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0002.0065.";
+ top.titles[i] = "Volume";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0002.0066.";
+ top.titles[i] = "WANMAN:LAN Area";
+ i++;
+
+ top.authors[i] = "zFLDR xC.5375.0500.0003.";
+ top.titles[i] = "Novell Object Class Extensions";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0003.0001.";
+ top.titles[i] = "Entrust:CRLDistributionPoint";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0003.0002.";
+ top.titles[i] = "inetOrgPerson";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0003.0003.";
+ top.titles[i] = "NDPS Broker";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0003.0004.";
+ top.titles[i] = "NDPS Manager";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0003.0005.";
+ top.titles[i] = "NDPS Printer";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0003.0006.";
+ top.titles[i] = "NDSCat:Catalog";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0003.0007.";
+ top.titles[i] = "NDSCat:Master Catalog";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0003.0008.";
+ top.titles[i] = "NDSCat:Slave Catalog";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0003.0009.";
+ top.titles[i] = "NetSvc";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0003.0010.";
+ top.titles[i] = "NLS:License Certificate";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0003.0011.";
+ top.titles[i] = "NLS:License Server";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0003.0012.";
+ top.titles[i] = "NLS:Product Container";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0003.0013.";
+ top.titles[i] = "NSCP:groupOfUniqueNames5";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0003.0014.";
+ top.titles[i] = "NSCP:mailGroup5";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0003.0015.";
+ top.titles[i] = "NSCP:Nginfo";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0003.0016.";
+ top.titles[i] = "NSCP:Nginfo2";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0003.0017.";
+ top.titles[i] = "residentialPerson";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0003.0018.";
+ top.titles[i] = "SLP Scope Unit";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0003.0019.";
+ top.titles[i] = "SLP Directory Agent";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0003.0020.";
+ top.titles[i] = "SLP Service";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0003.0021.";
+ top.titles[i] = "SMS SMDR Class";
+ i++;
+
+ top.authors[i] = "zFLDR xC.5375.0500.0004.";
+ top.titles[i] = "Graphical View of Object Class Inheritance";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0004.0001.";
+ top.titles[i] = "Alias and Bindery Object Classes";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0004.0002.";
+ top.titles[i] = "Tree Root, domain, and Unknown";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0004.0003.";
+ top.titles[i] = "Computer, Country, Device, and Printer";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0004.0004.";
+ top.titles[i] = "List and Locality";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0004.0005.";
+ top.titles[i] = "Organizational Role and Partition";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0004.0006.";
+ top.titles[i] = "ndsLoginProperties, Organization, and Organizational Unit";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0004.0007.";
+ top.titles[i] = "ndsLoginProperties, Person, Organizational Person, and User";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0004.0008.";
+ top.titles[i] = "Directory Map, Profile, Queues, Resource, and Volume";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0004.0009.";
+ top.titles[i] = "Servers (AFP, Messaging, NCP, Print) and CommExec";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0004.0010.";
+ top.titles[i] = "External Entity, Group, and Message Routing Group";
+ i++;
+
+ top.authors[i] = "zFLDR xC.5375.0500.0005.";
+ top.titles[i] = "Base Attribute Definitions";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0001.";
+ top.titles[i] = "Aliased Object Name";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0002.";
+ top.titles[i] = "Account Balance";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0003.";
+ top.titles[i] = "ACL";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0004.";
+ top.titles[i] = "Allow Unlimited Credit";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0005.";
+ top.titles[i] = "associatedName";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0006.";
+ top.titles[i] = "attributeCertificate";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0007.";
+ top.titles[i] = "Audit:A Encryption Key";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0008.";
+ top.titles[i] = "Audit:B Encryption Key";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0009.";
+ top.titles[i] = "Audit:Contents";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0010.";
+ top.titles[i] = "Audit:Current Encryption Key";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0011.";
+ top.titles[i] = "Audit:File Link";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0012.";
+ top.titles[i] = "Audit:Link List";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0013.";
+ top.titles[i] = "Audit:Path";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0014.";
+ top.titles[i] = "Audit:Policy";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0015.";
+ top.titles[i] = "Audit:Type";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0016.";
+ top.titles[i] = "authorityRevocationList";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0017.";
+ top.titles[i] = "Authority Revocation";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0018.";
+ top.titles[i] = "AuxClass Object Class Backup";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0019.";
+ top.titles[i] = "Auxiliary Class Flag";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0020.";
+ top.titles[i] = "Back Link";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0021.";
+ top.titles[i] = "Bindery Object Restriction";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0022.";
+ top.titles[i] = "Bindery Property";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0023.";
+ top.titles[i] = "Bindery Restriction Level";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0024.";
+ top.titles[i] = "Bindery Type";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0025.";
+ top.titles[i] = "businessCategory";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0026.";
+ top.titles[i] = "";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0027.";
+ top.titles[i] = "cACertificate";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0028.";
+ top.titles[i] = "CA Private Key";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0029.";
+ top.titles[i] = "CA Public Key";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0030.";
+ top.titles[i] = "Cartridge";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0031.";
+ top.titles[i] = "certificateRevocationList";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0032.";
+ top.titles[i] = "Certificate Revocation";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0033.";
+ top.titles[i] = "Certificate Validity Interval";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0034.";
+ top.titles[i] = "crossCertificatePair";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0035.";
+ top.titles[i] = "";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0036.";
+ top.titles[i] = "Convergence";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0037.";
+ top.titles[i] = "Cross Certificate Pair";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0038.";
+ top.titles[i] = "dc";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0039.";
+ top.titles[i] = "Default Queue";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0040.";
+ top.titles[i] = "deltaRevocationList";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0041.";
+ top.titles[i] = "departmentNumber";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0042.";
+ top.titles[i] = "Description";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0043.";
+ top.titles[i] = "destinationIndicator";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0044.";
+ top.titles[i] = "Detect Intruder";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0045.";
+ top.titles[i] = "Device";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0046.";
+ top.titles[i] = "dmdName";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0047.";
+ top.titles[i] = "dn";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0048.";
+ top.titles[i] = "dnQualifier";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0049.";
+ top.titles[i] = "DS Revision";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0050.";
+ top.titles[i] = "EMail Address";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0051.";
+ top.titles[i] = "employeeType";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0052.";
+ top.titles[i] = "enhancedSearchGuide";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0053.";
+ top.titles[i] = "Equivalent To Me";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0054.";
+ top.titles[i] = "External Name";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0055.";
+ top.titles[i] = "External Synchronizer";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0056.";
+ top.titles[i] = "Facsimile Telephone Number";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0057.";
+ top.titles[i] = "Full Name";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0058.";
+ top.titles[i] = "Generational Qualifier";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0059.";
+ top.titles[i] = "generationQualifier";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0060.";
+ top.titles[i] = "";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0061.";
+ top.titles[i] = "Given Name";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0062.";
+ top.titles[i] = "";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0063.";
+ top.titles[i] = "GUID";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0064.";
+ top.titles[i] = "High Convergence Sync Interval";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0065.";
+ top.titles[i] = "Higher Privileges";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0066.";
+ top.titles[i] = "Home Directory";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0067.";
+ top.titles[i] = "Home Directory Rights";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0068.";
+ top.titles[i] = "homePhone";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0069.";
+ top.titles[i] = "homePostalAddress";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0070.";
+ top.titles[i] = "houseIdentifier";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0071.";
+ top.titles[i] = "Host Device";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0072.";
+ top.titles[i] = "Host Resource Name";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0073.";
+ top.titles[i] = "Host Server";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0074.";
+ top.titles[i] = "Inherited ACL";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0075.";
+ top.titles[i] = "Initials";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0076.";
+ top.titles[i] = "internationaliSDNNumber";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0077.";
+ top.titles[i] = "Internet EMail Address";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0078.";
+ top.titles[i] = "Intruder Attempt Reset Interval";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0079.";
+ top.titles[i] = "Intruder Lockout Reset Interval";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0080.";
+ top.titles[i] = "knowledgeInformation";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0081.";
+ top.titles[i] = "";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0082.";
+ top.titles[i] = "Language";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0083.";
+ top.titles[i] = "Last Login Time";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0084.";
+ top.titles[i] = "Last Referenced Time";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0085.";
+ top.titles[i] = "LDAP ACL v11";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0086.";
+ top.titles[i] = "LDAP Allow Clear Text Password";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0087.";
+ top.titles[i] = "LDAP Anonymous Identity";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0088.";
+ top.titles[i] = "LDAP Attribute Map v11";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0089.";
+ top.titles[i] = "LDAP Backup Log Filename";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0090.";
+ top.titles[i] = "LDAP Class Map v11";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0091.";
+ top.titles[i] = "LDAP Enable SSL";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0092.";
+ top.titles[i] = "LDAP Enable TCP";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0093.";
+ top.titles[i] = "LDAP Enable UDP";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0094.";
+ top.titles[i] = "LDAP Group";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0095.";
+ top.titles[i] = "LDAP Host Server";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0096.";
+ top.titles[i] = "LDAP Log Filename";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0097.";
+ top.titles[i] = "LDAP Log Level";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0098.";
+ top.titles[i] = "LDAP Log Size Limit";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0099.";
+ top.titles[i] = "LDAP Referral";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0100.";
+ top.titles[i] = "LDAP Screen Level";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0101.";
+ top.titles[i] = "LDAP Search Size Limit";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0102.";
+ top.titles[i] = "LDAP Search Time Limit";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0103.";
+ top.titles[i] = "LDAP Server";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0104.";
+ top.titles[i] = "LDAP Server Bind Limit";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0105.";
+ top.titles[i] = "LDAP Server Idle Timeout";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0106.";
+ top.titles[i] = "LDAP Server List";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0107.";
+ top.titles[i] = "LDAP SSL Port";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0108.";
+ top.titles[i] = "LDAP Suffix";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0109.";
+ top.titles[i] = "LDAP TCP Port";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0110.";
+ top.titles[i] = "LDAP UDP Port";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0111.";
+ top.titles[i] = "LDAP:bindCatalog";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0112.";
+ top.titles[i] = "LDAP:bindCatalogUsage";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0113.";
+ top.titles[i] = "LDAP:keyMaterialName";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0114.";
+ top.titles[i] = "LDAP:otherReferralUsage";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0115.";
+ top.titles[i] = "LDAP:searchCatalog";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0116.";
+ top.titles[i] = "LDAP:searchCatalogUsage";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0117.";
+ top.titles[i] = "LDAP:searchReferralUsage";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0118.";
+ top.titles[i] = "Locked By Intruder";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0119.";
+ top.titles[i] = "Lockout After Detection";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0120.";
+ top.titles[i] = "Login Allowed Time Map";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0121.";
+ top.titles[i] = "Login Disabled";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0122.";
+ top.titles[i] = "Login Expiration Time";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0123.";
+ top.titles[i] = "Login Grace Limit";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0124.";
+ top.titles[i] = "Login Grace Remaining";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0125.";
+ top.titles[i] = "Login Intruder Address";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0126.";
+ top.titles[i] = "Login Intruder Attempts";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0127.";
+ top.titles[i] = "Login Intruder Limit";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0128.";
+ top.titles[i] = "Login Intruder Reset Time";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0129.";
+ top.titles[i] = "Login Maximum Simultaneous";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0130.";
+ top.titles[i] = "Login Script";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0131.";
+ top.titles[i] = "Login Time";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0132.";
+ top.titles[i] = "Low Convergence Reset Time";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0133.";
+ top.titles[i] = "Low Convergence Sync Interval";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0134.";
+ top.titles[i] = "Mailbox ID";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0135.";
+ top.titles[i] = "Mailbox Location";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0136.";
+ top.titles[i] = "manager";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0137.";
+ top.titles[i] = "masvAuthorizedRange";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0138.";
+ top.titles[i] = "masvDefaultRange";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0139.";
+ top.titles[i] = "masvDomainPolicy";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0140.";
+ top.titles[i] = "masvLabel";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0141.";
+ top.titles[i] = "masvProposedLabel";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0142.";
+ top.titles[i] = "Member";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0143.";
+ top.titles[i] = "Members Of Template";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0144.";
+ top.titles[i] = "Memory";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0145.";
+ top.titles[i] = "Message Routing Group";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0146.";
+ top.titles[i] = "Message Server";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0147.";
+ top.titles[i] = "Messaging Database Location";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0148.";
+ top.titles[i] = "Messaging Server";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0149.";
+ top.titles[i] = "";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0150.";
+ top.titles[i] = "Minimum Account Balance";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0151.";
+ top.titles[i] = "mobile";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0152.";
+ top.titles[i] = "NDSPKI:Certificate Chain";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0153.";
+ top.titles[i] = "NDSPKI:Given Name";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0154.";
+ top.titles[i] = "NDSPKI:Key File";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0155.";
+ top.titles[i] = "NDSPKI:Key Material DN";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0156.";
+ top.titles[i] = "NDSPKI:Keystore";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0157.";
+ top.titles[i] = "NDSPKI:Not After";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0158.";
+ top.titles[i] = "NDSPKI:Not Before";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0159.";
+ top.titles[i] = "NDSPKI:Parent CA";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0160.";
+ top.titles[i] = "NDSPKI:Parent CA DN";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0161.";
+ top.titles[i] = "NDSPKI:Private Key";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0162.";
+ top.titles[i] = "NDSPKI:Public Key";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0163.";
+ top.titles[i] = "NDSPKI:Public Key Certificate";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0164.";
+ top.titles[i] = "NDSPKI:SD Key Cert";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0165.";
+ top.titles[i] = "NDSPKI:SD Key ID";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0166.";
+ top.titles[i] = "NDSPKI:SD Key Server DN";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0167.";
+ top.titles[i] = "NDSPKI:SD Key Struct";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0168.";
+ top.titles[i] = "NDSPKI:Subject Name";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0169.";
+ top.titles[i] = "NDSPKI:Tree CA DN";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0170.";
+ top.titles[i] = "NDSPKI:Trusted Root Certificate";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0171.";
+ top.titles[i] = "NDSPKI:userCertificateInfo";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0172.";
+ top.titles[i] = "Network Address";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0173.";
+ top.titles[i] = "Network Address Restriction";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0174.";
+ top.titles[i] = "New Object's DS Rights";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0175.";
+ top.titles[i] = "New Object's FS Rights";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0176.";
+ top.titles[i] = "New Object's Self Rights";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0177.";
+ top.titles[i] = "NNS Domain";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0178.";
+ top.titles[i] = "Notify";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0179.";
+ top.titles[i] = "NSCP:administratorContactInfo";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0180.";
+ top.titles[i] = "NSCP:adminURL";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0181.";
+ top.titles[i] = "NSCP:AmailAccessDomain";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0182.";
+ top.titles[i] = "NSCP:AmailAlternateAddress";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0183.";
+ top.titles[i] = "NSCP:AmailAutoReplyMode";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0184.";
+ top.titles[i] = "NSCP:AmailAutoReplyText";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0185.";
+ top.titles[i] = "NSCP:AmailDeliveryOption";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0186.";
+ top.titles[i] = "NSCP:AmailForwardingAddress";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0187.";
+ top.titles[i] = "NSCP:AmailHost";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0188.";
+ top.titles[i] = "NSCP:AmailMessageStore";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0189.";
+ top.titles[i] = "NSCP:AmailProgramDeliveryInfo";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0190.";
+ top.titles[i] = "NSCP:AmailQuota";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0191.";
+ top.titles[i] = "NSCP:AnsLicenseEndTime";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0192.";
+ top.titles[i] = "NSCP:AnsLicensedFor";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0193.";
+ top.titles[i] = "NSCP:AnsLicenseStartTime";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0194.";
+ top.titles[i] = "NSCP:employeeNumber";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0195.";
+ top.titles[i] = "NSCP:installationTimeStamp";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0196.";
+ top.titles[i] = "NSCP:mailRoutingAddress";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0197.";
+ top.titles[i] = "NSCP:memberCertificateDesc";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0198.";
+ top.titles[i] = "NSCP:mgrpRFC822mailmember";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0199.";
+ top.titles[i] = "NSCP:ngcomponentCIS";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0200.";
+ top.titles[i] = "NSCP:nsaclrole";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0201.";
+ top.titles[i] = "NSCP:nscreator";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0202.";
+ top.titles[i] = "NSCP:nsflags";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0203.";
+ top.titles[i] = "NSCP:nsnewsACL";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0204.";
+ top.titles[i] = "NSCP:nsprettyname";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0205.";
+ top.titles[i] = "NSCP:serverHostName";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0206.";
+ top.titles[i] = "NSCP:serverProductName";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0207.";
+ top.titles[i] = "NSCP:serverRoot";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0208.";
+ top.titles[i] = "NSCP:serverVersionNumber";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0209.";
+ top.titles[i] = "NSCP:subtreeACI";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0210.";
+ top.titles[i] = "";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0211.";
+ top.titles[i] = "Obituary";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0212.";
+ top.titles[i] = "Obituary Notify";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0213.";
+ top.titles[i] = "Object Class";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0214.";
+ top.titles[i] = "Operator";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0215.";
+ top.titles[i] = "Other GUID";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0216.";
+ top.titles[i] = "";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0217.";
+ top.titles[i] = "Owner";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0218.";
+ top.titles[i] = "Page Description Language";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0219.";
+ top.titles[i] = "pager";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0220.";
+ top.titles[i] = "Partition Control";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0221.";
+ top.titles[i] = "Partition Creation Time";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0222.";
+ top.titles[i] = "Partition Status";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0223.";
+ top.titles[i] = "Password Allow Change";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0224.";
+ top.titles[i] = "Password Expiration Interval";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0225.";
+ top.titles[i] = "Password Expiration Time";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0226.";
+ top.titles[i] = "Password Management";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0227.";
+ top.titles[i] = "Password Minimum Length";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0228.";
+ top.titles[i] = "Password Required";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0229.";
+ top.titles[i] = "Password Unique Required";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0230.";
+ top.titles[i] = "Passwords Used";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0231.";
+ top.titles[i] = "Path";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0232.";
+ top.titles[i] = "Permanent Config Parms";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0233.";
+ top.titles[i] = "Physical Delivery Office Name";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0234.";
+ top.titles[i] = "Postal Address";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0235.";
+ top.titles[i] = "Postal Code";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0236.";
+ top.titles[i] = "Postal Office Box";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0237.";
+ top.titles[i] = "Postmaster";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0238.";
+ top.titles[i] = "preferredDeliveryMethod";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0239.";
+ top.titles[i] = "presentationAddress";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0240.";
+ top.titles[i] = "Print Job Configuration";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0241.";
+ top.titles[i] = "Print Server";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0242.";
+ top.titles[i] = "Printer";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0243.";
+ top.titles[i] = "Printer Configuration";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0244.";
+ top.titles[i] = "Printer Control";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0245.";
+ top.titles[i] = "Private Key";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0246.";
+ top.titles[i] = "Profile";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0247.";
+ top.titles[i] = "Profile Membership";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0248.";
+ top.titles[i] = "protocolInformation";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0249.";
+ top.titles[i] = "Public Key";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0250.";
+ top.titles[i] = "Purge Vector";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0251.";
+ top.titles[i] = "Queue";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0252.";
+ top.titles[i] = "Queue Directory";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0253.";
+ top.titles[i] = "Received Up To";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0254.";
+ top.titles[i] = "Reference";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0255.";
+ top.titles[i] = "registeredAddress";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0256.";
+ top.titles[i] = "Replica";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0257.";
+ top.titles[i] = "Replica Up To";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0258.";
+ top.titles[i] = "Resource";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0259.";
+ top.titles[i] = "Revision";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0260.";
+ top.titles[i] = "Role Occupant";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0261.";
+ top.titles[i] = "roomNumber";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0262.";
+ top.titles[i] = "Run Setup Script";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0263.";
+ top.titles[i] = "";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0264.";
+ top.titles[i] = "";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0265.";
+ top.titles[i] = "SAP Name";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0266.";
+ top.titles[i] = "SAS:Security DN";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0267.";
+ top.titles[i] = "SAS:Service DN";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0268.";
+ top.titles[i] = "searchGuide";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0269.";
+ top.titles[i] = "searchSizeLimit";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0270.";
+ top.titles[i] = "searchTimeLimit";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0271.";
+ top.titles[i] = "Security Equals";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0272.";
+ top.titles[i] = "Security Flags";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0273.";
+ top.titles[i] = "See Also";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0274.";
+ top.titles[i] = "Serial Number";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0275.";
+ top.titles[i] = "Server";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0276.";
+ top.titles[i] = "Server Holds";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0277.";
+ top.titles[i] = "Set Password After Create";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0278.";
+ top.titles[i] = "Setup Script";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0279.";
+ top.titles[i] = "Status";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0280.";
+ top.titles[i] = "supportedAlgorithms";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0281.";
+ top.titles[i] = "supportedApplicationContext";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0282.";
+ top.titles[i] = "Supported Connections";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0283.";
+ top.titles[i] = "Supported Gateway";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0284.";
+ top.titles[i] = "Supported Services";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0285.";
+ top.titles[i] = "Supported Typefaces";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0286.";
+ top.titles[i] = "Surname";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0287.";
+ top.titles[i] = "Synchronization Tolerance";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0288.";
+ top.titles[i] = "Synchronized Up To";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0289.";
+ top.titles[i] = "";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0290.";
+ top.titles[i] = "Telephone Number";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0291.";
+ top.titles[i] = "telexNumber";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0292.";
+ top.titles[i] = "telexTerminalIdentifier";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0293.";
+ top.titles[i] = "Timezone";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0294.";
+ top.titles[i] = "Title";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0295.";
+ top.titles[i] = "Transitive Vector";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0296.";
+ top.titles[i] = "Trustees Of New Object";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0297.";
+ top.titles[i] = "Type Creator Map";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0298.";
+ top.titles[i] = "";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0299.";
+ top.titles[i] = "uniqueID";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0300.";
+ top.titles[i] = "Unknown";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0301.";
+ top.titles[i] = "Unknown Auxiliary Class";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0302.";
+ top.titles[i] = "Unknown Base Class";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0303.";
+ top.titles[i] = "Used By";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0304.";
+ top.titles[i] = "User";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0305.";
+ top.titles[i] = "userCertificate";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0306.";
+ top.titles[i] = "userPassword";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0307.";
+ top.titles[i] = "Uses";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0308.";
+ top.titles[i] = "Version";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0309.";
+ top.titles[i] = "Volume";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0310.";
+ top.titles[i] = "Volume Space Restrictions";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0311.";
+ top.titles[i] = "WANMAN:Cost";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0312.";
+ top.titles[i] = "WANMAN:Default Cost";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0313.";
+ top.titles[i] = "WANMAN:LAN Area Membership";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0314.";
+ top.titles[i] = "WANMAN:WAN Policy";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0315.";
+ top.titles[i] = "x121Address";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0005.0316.";
+ top.titles[i] = "x500UniqueIdentifier";
+ i++;
+
+ top.authors[i] = "zFLDR xC.5375.0500.0006.";
+ top.titles[i] = "Novell Attribute Extensions";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0001.";
+ top.titles[i] = "audio";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0002.";
+ top.titles[i] = "carLicense";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0003.";
+ top.titles[i] = "Client Install Candidate";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0004.";
+ top.titles[i] = "Color Supported";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0005.";
+ top.titles[i] = "Database Dir Path";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0006.";
+ top.titles[i] = "Database Volume Name";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0007.";
+ top.titles[i] = "Datapool Location";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0008.";
+ top.titles[i] = "Datapool Locations";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0009.";
+ top.titles[i] = "Delivery Methods Installed";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0010.";
+ top.titles[i] = "displayName";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0011.";
+ top.titles[i] = "Employee ID";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0012.";
+ top.titles[i] = "Entrust:AttributeCertificate";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0013.";
+ top.titles[i] = "Entrust:User";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0014.";
+ top.titles[i] = "GW API Gateway Directory Path";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0015.";
+ top.titles[i] = "GW API Gateway Directory Volume";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0016.";
+ top.titles[i] = "IPP URI";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0017.";
+ top.titles[i] = "IPP URI Security Scheme";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0018.";
+ top.titles[i] = "jpegPhoto";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0019.";
+ top.titles[i] = "labeledUri";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0020.";
+ top.titles[i] = "LDAP Class Map";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0021.";
+ top.titles[i] = "ldapPhoto";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0022.";
+ top.titles[i] = "LDAPUserCertificate";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0023.";
+ top.titles[i] = "LDAP:ARL";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0024.";
+ top.titles[i] = "LDAP:caCertificate";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0025.";
+ top.titles[i] = "LDAP:CRL";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0026.";
+ top.titles[i] = "LDAP:crossCertificatePair";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0027.";
+ top.titles[i] = "MASV:Authorized Range";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0028.";
+ top.titles[i] = "MASV:Default Range";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0029.";
+ top.titles[i] = "MASV:Domain Policy";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0030.";
+ top.titles[i] = "MASV:Label";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0031.";
+ top.titles[i] = "MASV:Proposed Label";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0032.";
+ top.titles[i] = "Maximum Speed";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0033.";
+ top.titles[i] = "Maximum Speed Units";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0034.";
+ top.titles[i] = "MHS Send Directory Path";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0035.";
+ top.titles[i] = "MHS Send Directory Volume";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0036.";
+ top.titles[i] = "NDPS Accountant Role";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0037.";
+ top.titles[i] = "NDPS Control Flags";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0038.";
+ top.titles[i] = "NDPS Database Saved Timestamp";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0039.";
+ top.titles[i] = "NDPS Database Saved Data Image";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0040.";
+ top.titles[i] = "NDPS Database Saved Index Image";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0041.";
+ top.titles[i] = "NDPS Default Printer";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0042.";
+ top.titles[i] = "NDPS Default Public Printer";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0043.";
+ top.titles[i] = "NDPS Job Configuration";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0044.";
+ top.titles[i] = "NDPS Manager Status";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0045.";
+ top.titles[i] = "NDPS Operator Role";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0046.";
+ top.titles[i] = "NDPS Printer Install List";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0047.";
+ top.titles[i] = "NDPS Printer Install Timestamp";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0048.";
+ top.titles[i] = "NDPS Printer Queue List";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0049.";
+ top.titles[i] = "NDPS Printer Siblings";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0050.";
+ top.titles[i] = "NDPS Public Printer Install List";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0051.";
+ top.titles[i] = "NDPS Replace All Client Printers";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0052.";
+ top.titles[i] = "NDPS SMTP Server";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0053.";
+ top.titles[i] = "NDPS User Role";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0054.";
+ top.titles[i] = "NDSCat:Actual All Attributes";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0055.";
+ top.titles[i] = "NDSCat:Actual Attribute Count";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0056.";
+ top.titles[i] = "NDSCat:Actual Attributes";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0057.";
+ top.titles[i] = "NDSCat:Actual Base Object";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0058.";
+ top.titles[i] = "NDSCat:Actual Catalog Size";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0059.";
+ top.titles[i] = "NDSCat:Actual End Time";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0060.";
+ top.titles[i] = "NDSCat:Actual Filter";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0061.";
+ top.titles[i] = "NDSCat:Actual Object Count";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0062.";
+ top.titles[i] = "NDSCat:Actual Return Code";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0063.";
+ top.titles[i] = "NDSCat:Actual Scope";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0064.";
+ top.titles[i] = "NDSCat:Actual Search Aliases";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0065.";
+ top.titles[i] = "NDSCat:Actual Start Time";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0066.";
+ top.titles[i] = "NDSCat:Actual Value Count";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0067.";
+ top.titles[i] = "NDSCat:All Attributes";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0068.";
+ top.titles[i] = "NDSCat:AttrDefTbl";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0069.";
+ top.titles[i] = "NDSCat:Attributes";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0070.";
+ top.titles[i] = "NDSCat:Auto Dredge";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0071.";
+ top.titles[i] = "NDSCat:Base Object";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0072.";
+ top.titles[i] = "NDSCat:CatalogDB";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0073.";
+ top.titles[i] = "NDSCat:Catalog List";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0074.";
+ top.titles[i] = "NDSCat:Dredge Interval";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0075.";
+ top.titles[i] = "NDSCat:Filter";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0076.";
+ top.titles[i] = "NDSCat:IndexDefTbl";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0077.";
+ top.titles[i] = "NDSCat:Indexes";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0078.";
+ top.titles[i] = "NDSCat:Label";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0079.";
+ top.titles[i] = "NDSCat:Log";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0080.";
+ top.titles[i] = "NDSCat:Master Catalog";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0081.";
+ top.titles[i] = "NDSCat:Max Log Size";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0082.";
+ top.titles[i] = "NDSCat:Max Retries";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0083.";
+ top.titles[i] = "NDSCat:Max Threads";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0084.";
+ top.titles[i] = "NDSCat:Retry Interval";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0085.";
+ top.titles[i] = "NDSCat:Scope";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0086.";
+ top.titles[i] = "NDSCat:Search Aliases";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0087.";
+ top.titles[i] = "NDSCat:Slave Catalog List";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0088.";
+ top.titles[i] = "NDSCat:Start Time";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0089.";
+ top.titles[i] = "NDSCat:Synch Interval";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0090.";
+ top.titles[i] = "NLS:Common Certificate";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0091.";
+ top.titles[i] = "NLS:Current Installed";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0092.";
+ top.titles[i] = "NLS:Current Peak Installed";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0093.";
+ top.titles[i] = "NLS:Current Peak Used";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0094.";
+ top.titles[i] = "NLS:Current Used";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0095.";
+ top.titles[i] = "NLS:Hourly Data Size";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0096.";
+ top.titles[i] = "NLS:License Database";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0097.";
+ top.titles[i] = "NLS:License ID";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0098.";
+ top.titles[i] = "NLS:License Service Provider";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0099.";
+ top.titles[i] = "NLS:LSP Revision";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0100.";
+ top.titles[i] = "NLS:Owner";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0101.";
+ top.titles[i] = "NLS:Peak Installed Data";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0102.";
+ top.titles[i] = "NLS:Peak Used Data";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0103.";
+ top.titles[i] = "NLS:Product";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0104.";
+ top.titles[i] = "NLS:Publisher";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0105.";
+ top.titles[i] = "NLS:Revision";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0106.";
+ top.titles[i] = "NLS:Search Type";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0107.";
+ top.titles[i] = "NLS:Summary Update Time";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0108.";
+ top.titles[i] = "NLS:Summary Version";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0109.";
+ top.titles[i] = "NLS:Transaction Database";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0110.";
+ top.titles[i] = "NLS:Transaction Log Name";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0111.";
+ top.titles[i] = "NLS:Transaction Log Size";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0112.";
+ top.titles[i] = "NLS:Version";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0113.";
+ top.titles[i] = "Notification Consumers";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0114.";
+ top.titles[i] = "Notification Profile";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0115.";
+ top.titles[i] = "Notification Service Enabled";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0116.";
+ top.titles[i] = "Notification Srvc Net Addr";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0117.";
+ top.titles[i] = "Notification Srvc Net Address";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0118.";
+ top.titles[i] = "NRD:Registry Data";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0119.";
+ top.titles[i] = "NRD:Registry Index";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0120.";
+ top.titles[i] = "NSCP:mailAccessDomain";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0121.";
+ top.titles[i] = "NSCP:mailAlternateAddress";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0122.";
+ top.titles[i] = "NSCP:mailAutoReplyMode";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0123.";
+ top.titles[i] = "NSCP:mailAutoReplyText";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0124.";
+ top.titles[i] = "NSCP:mailDeliveryOption";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0125.";
+ top.titles[i] = "NSCP:mailForwardingAddress";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0126.";
+ top.titles[i] = "NSCP:mailHost";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0127.";
+ top.titles[i] = "NSCP:mailMessageStore";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0128.";
+ top.titles[i] = "NSCP:mailProgramDeliveryInfo";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0129.";
+ top.titles[i] = "NSCP:mailQuota";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0130.";
+ top.titles[i] = "NSCP:ngComponent";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0131.";
+ top.titles[i] = "NSCP:nsLicenseEndTime";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0132.";
+ top.titles[i] = "NSCP:nsLicensedFor";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0133.";
+ top.titles[i] = "NSCP:nsLicenseStartTime";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0134.";
+ top.titles[i] = "Page Description Languages";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0135.";
+ top.titles[i] = "preferredLanguage";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0136.";
+ top.titles[i] = "Primary Notification Service";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0137.";
+ top.titles[i] = "Primary Resource Service";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0138.";
+ top.titles[i] = "Printer Agent Name";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0139.";
+ top.titles[i] = "Printer Manufacturer";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0140.";
+ top.titles[i] = "Printer Mechanism Types";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0141.";
+ top.titles[i] = "Printer Model";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0142.";
+ top.titles[i] = "Printer Status";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0143.";
+ top.titles[i] = "Printer to PA ID Mappings";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0144.";
+ top.titles[i] = "PSM Name";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0145.";
+ top.titles[i] = "Registry Advertising Name";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0146.";
+ top.titles[i] = "Registry Service Enabled";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0147.";
+ top.titles[i] = "Registry Srvc Net Addr";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0148.";
+ top.titles[i] = "Registry Srvc Net Address";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0149.";
+ top.titles[i] = "Resolution";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0150.";
+ top.titles[i] = "Resource Mgmt Srvc Net Addr";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0151.";
+ top.titles[i] = "Resource Mgmt Srvc Net Address";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0152.";
+ top.titles[i] = "Resource Mgmt Service Enabled";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0153.";
+ top.titles[i] = "Resource Mgr Database Path";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0154.";
+ top.titles[i] = "Resource Mgr Database Volume";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0155.";
+ top.titles[i] = "secretary";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0156.";
+ top.titles[i] = "Sides Supported";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0157.";
+ top.titles[i] = "SLP Attribute";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0158.";
+ top.titles[i] = "SLP Cache Limit";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0159.";
+ top.titles[i] = "SLP DA Back Link";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0160.";
+ top.titles[i] = "SLP Directory Agent DN";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0161.";
+ top.titles[i] = "SLP Language";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0162.";
+ top.titles[i] = "SLP Lifetime";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0163.";
+ top.titles[i] = "SLP Scope Name";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0164.";
+ top.titles[i] = "SLP Scope Unit DN";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0165.";
+ top.titles[i] = "SLP Start Purge Hour";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0166.";
+ top.titles[i] = "SLP Status";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0167.";
+ top.titles[i] = "SLP SU Back Link";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0168.";
+ top.titles[i] = "SLP SU Type";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0169.";
+ top.titles[i] = "SLP Type";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0170.";
+ top.titles[i] = "SLP URL";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0171.";
+ top.titles[i] = "SMS Protocol Address";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0172.";
+ top.titles[i] = "SMS Registered Service";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0173.";
+ top.titles[i] = "SU";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0174.";
+ top.titles[i] = "SvcInfo";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0175.";
+ top.titles[i] = "SvcType";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0176.";
+ top.titles[i] = "SvcTypeID";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0006.0177.";
+ top.titles[i] = "userSMIMECertificate";
+ i++;
+
+ top.authors[i] = "zFLDR xC.5375.0500.0007.";
+ top.titles[i] = "LDAP Operational Attributes";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0007.0001.";
+ top.titles[i] = "createTimeStamp";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0007.0002.";
+ top.titles[i] = "creatorsName";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0007.0003.";
+ top.titles[i] = "entryFlags";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0007.0004.";
+ top.titles[i] = "federationBoundary";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0007.0005.";
+ top.titles[i] = "localEntryID";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0007.0006.";
+ top.titles[i] = "modifiersName";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0007.0007.";
+ top.titles[i] = "modifyTimeStamp";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0007.0008.";
+ top.titles[i] = "structuralObjectClass";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0007.0009.";
+ top.titles[i] = "subordinateCount";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0007.0010.";
+ top.titles[i] = "subschemaSubentry";
+ i++;
+
+ top.authors[i] = "zFLDR xC.5375.0500.0008.";
+ top.titles[i] = "Attribute Syntax Definitions";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0008.0001.";
+ top.titles[i] = "Back Link";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0008.0002.";
+ top.titles[i] = "Boolean";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0008.0003.";
+ top.titles[i] = "Case Exact String";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0008.0004.";
+ top.titles[i] = "Case Ignore List";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0008.0005.";
+ top.titles[i] = "Case Ignore String";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0008.0006.";
+ top.titles[i] = "Class Name";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0008.0007.";
+ top.titles[i] = "Counter";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0008.0008.";
+ top.titles[i] = "Distinguished Name";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0008.0009.";
+ top.titles[i] = "EMail Address";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0008.0010.";
+ top.titles[i] = "Facsimile Telephone Number";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0008.0011.";
+ top.titles[i] = "Hold";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0008.0012.";
+ top.titles[i] = "Integer";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0008.0013.";
+ top.titles[i] = "Interval";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0008.0014.";
+ top.titles[i] = "Net Address";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0008.0015.";
+ top.titles[i] = "Numeric String";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0008.0016.";
+ top.titles[i] = "Object ACL";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0008.0017.";
+ top.titles[i] = "Octet List";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0008.0018.";
+ top.titles[i] = "Octet String";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0008.0019.";
+ top.titles[i] = "Path";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0008.0020.";
+ top.titles[i] = "Postal Address";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0008.0021.";
+ top.titles[i] = "Printable String";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0008.0022.";
+ top.titles[i] = "Replica Pointer";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0008.0023.";
+ top.titles[i] = "Stream";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0008.0024.";
+ top.titles[i] = "Telephone Number";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0008.0025.";
+ top.titles[i] = "Time";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0008.0026.";
+ top.titles[i] = "Timestamp";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0008.0027.";
+ top.titles[i] = "Typed Name";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0008.0028.";
+ top.titles[i] = "Unknown";
+ i++;
+
+ top.authors[i] = "zFLDR xC.5375.0500.0009.";
+ top.titles[i] = "Index of Classes";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0009.0001.";
+ top.titles[i] = "A through B";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0009.0002.";
+ top.titles[i] = "C through D";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0009.0003.";
+ top.titles[i] = "E through K";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0009.0004.";
+ top.titles[i] = "L through M";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0009.0005.";
+ top.titles[i] = "N";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0009.0006.";
+ top.titles[i] = "O";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0009.0007.";
+ top.titles[i] = "P through R";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0009.0008.";
+ top.titles[i] = "S";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0009.0009.";
+ top.titles[i] = "T through Z";
+ i++;
+
+ top.authors[i] = "zFLDR xC.5375.0500.0010.";
+ top.titles[i] = "Index of Attributes";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0010.0001.";
+ top.titles[i] = "A";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0010.0002.";
+ top.titles[i] = "B";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0010.0003.";
+ top.titles[i] = "C";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0010.0004.";
+ top.titles[i] = "D";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0010.0005.";
+ top.titles[i] = "E";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0010.0006.";
+ top.titles[i] = "F through G";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0010.0007.";
+ top.titles[i] = "H";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0010.0008.";
+ top.titles[i] = "I through K";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0010.0009.";
+ top.titles[i] = "L";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0010.0010.";
+ top.titles[i] = "M";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0010.0011.";
+ top.titles[i] = "N";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0010.0012.";
+ top.titles[i] = "O";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0010.0013.";
+ top.titles[i] = "P";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0010.0014.";
+ top.titles[i] = "Q";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0010.0015.";
+ top.titles[i] = "R";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0010.0016.";
+ top.titles[i] = "S";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0010.0017.";
+ top.titles[i] = "T";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0010.0018.";
+ top.titles[i] = "U";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0010.0019.";
+ top.titles[i] = "V through Z";
+ i++;
+
+ top.authors[i] = "zFLDR xC.5375.0500.0011.";
+ top.titles[i] = "Index of ASN.1 IDs";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0011.0001.";
+ top.titles[i] = "0";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0011.0002.";
+ top.titles[i] = "1";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0011.0003.";
+ top.titles[i] = "2 through 2.4";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0011.0004.";
+ top.titles[i] = "2.5 through 2.9";
+ i++;
+
+ top.authors[i] = "zFLDR xC.5375.0500.0012.";
+ top.titles[i] = "Index of LDAP Names";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0012.0001.";
+ top.titles[i] = "A through B";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0012.0002.";
+ top.titles[i] = "C";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0012.0003.";
+ top.titles[i] = "D";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0012.0004.";
+ top.titles[i] = "E through F";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0012.0005.";
+ top.titles[i] = "G";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0012.0006.";
+ top.titles[i] = "H";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0012.0007.";
+ top.titles[i] = "I through K";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0012.0008.";
+ top.titles[i] = "L";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0012.0009.";
+ top.titles[i] = "M";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0012.0010.";
+ top.titles[i] = "N";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0012.0011.";
+ top.titles[i] = "O";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0012.0012.";
+ top.titles[i] = "P";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0012.0013.";
+ top.titles[i] = "Q through R";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0012.0014.";
+ top.titles[i] = "S";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0012.0015.";
+ top.titles[i] = "T";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0500.0012.0016.";
+ top.titles[i] = "U through Z";
+ i++;
+
+ top.authors[i] = "zHTML xC.5375.0500.0013.";
+ top.titles[i] = "Revision History";
+ i++;
+
+ top.authors[i] = "zFLDR xB.5375.0400.";
+ top.titles[i] = "NDS Iterator Services";
+ i++;
+
+ top.authors[i] = "zFLDR xC.5375.0400.0001.";
+ top.titles[i] = "Concepts";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0400.0001.0001.";
+ top.titles[i] = "Iterator Objects";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0400.0001.0002.";
+ top.titles[i] = "Creation of an Iterator Object";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0400.0001.0003.";
+ top.titles[i] = "Iterator Indexes";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0400.0001.0004.";
+ top.titles[i] = "Positions of an Iterator Object";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0400.0001.0005.";
+ top.titles[i] = "Current Position Movement with Retrieval Functions";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0400.0001.0006.";
+ top.titles[i] = "Retrieval of Data";
+ i++;
+
+ top.authors[i] = "zFLDR xC.5375.0400.0002.";
+ top.titles[i] = "Tasks";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0400.0002.0001.";
+ top.titles[i] = "Creating a Search Iterator Object";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0400.0002.0002.";
+ top.titles[i] = "Retrieving and Unpacking Object and Attribute Name Data";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0400.0002.0003.";
+ top.titles[i] = "Retrieving and Unpacking Object, Attribute, and Value Data";
+ i++;
+
+ top.authors[i] = "zFLDR xC.5375.0400.0003.";
+ top.titles[i] = "Functions";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0400.0003.0001.";
+ top.titles[i] = "NWDSItrAtEOF";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0400.0003.0002.";
+ top.titles[i] = "NWDSItrAtFirst";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0400.0003.0003.";
+ top.titles[i] = "NWDSItrClone";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0400.0003.0004.";
+ top.titles[i] = "NWDSItrCount";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0400.0003.0005.";
+ top.titles[i] = "NWDSItrCreateList";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0400.0003.0006.";
+ top.titles[i] = "NWDSItrCreateSearch";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0400.0003.0007.";
+ top.titles[i] = "NWDSItrDestroy";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0400.0003.0008.";
+ top.titles[i] = "NWDSItrGetCurrent";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0400.0003.0009.";
+ top.titles[i] = "NWDSItrGetInfo";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0400.0003.0010.";
+ top.titles[i] = "NWDSItrGetNext";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0400.0003.0011.";
+ top.titles[i] = "NWDSItrGetPosition";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0400.0003.0012.";
+ top.titles[i] = "NWDSItrGetPrev";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0400.0003.0013.";
+ top.titles[i] = "NWDSItrSetPosition";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0400.0003.0014.";
+ top.titles[i] = "NWDSItrSetPositionFromIterator";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0400.0003.0015.";
+ top.titles[i] = "NWDSItrSkip";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0400.0003.0016.";
+ top.titles[i] = "NWDSItrTypeDown";
+ i++;
+
+ top.authors[i] = "zFLDR xC.5375.0400.0004.";
+ top.titles[i] = "NDS Iterator Example Code";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0400.0004.0001.";
+ top.titles[i] = "Cloning an Iterator Object: Example";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0400.0004.0002.";
+ top.titles[i] = "Counting with NDS Iterators: Example";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0400.0004.0003.";
+ top.titles[i] = "Creating and Using a List Iterator: Example";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0400.0004.0004.";
+ top.titles[i] = "Creating a Search Iterator and Displaying the Results: Example";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0400.0004.0005.";
+ top.titles[i] = "Getting Iterator Information: Example";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0400.0004.0006.";
+ top.titles[i] = "Getting and Setting the Iterator's Position: Example";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0400.0004.0007.";
+ top.titles[i] = "Listing in Reverse Order: Example";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0400.0004.0008.";
+ top.titles[i] = "Positioning the Iterator with Typedown: Example";
+ i++;
+
+ top.authors[i] = "zHTML xD.5375.0400.0004.0009.";
+ top.titles[i] = "Skipping Objects in the List: Example";
+ i++;
+
+ top.authors[i] = "zHTML xC.5375.0400.0005.";
+ top.titles[i] = "Revision History";
+ i++;
+
+
+// Morten's JavaScript Tree Menu
+// written by Morten Wang <morten@treemenu.com> (c) 1998-2000
+// This is version 2.2.6, dated 2000-03-30
+
+// The script is freely distributable
+// It may be used (and modified) as you wish, but retain this message
+// For more information about the menu visit its home page
+// http://www.treemenu.com/
+
+/******************************************************************************
+* Define the MenuItem object. *
+******************************************************************************/
+
+function MTMenuItem(text, url, target,nsearchID, icon) {
+ this.text = text;
+ this.url = url ? url : "";
+ this.target = target ? target : "";
+ this.icon = icon ? icon : "";
+ this.nsearchID = nsearchID;
+
+ this.number = MTMSubNumber++;
+ this.parent = null;
+ this.submenu = null;
+ this.expanded = false;
+ this.selected = false;
+ this.childSelected = false;
+
+ this.MTMakeSubmenu = MTMakeSubmenu;
+
+}
+
+function MTMakeSubmenu(menu) {
+ this.submenu = menu;
+ for (var i = 0; i < menu.items.length; i++)
+ {
+ menu.items[i].parent = this;
+ }
+}
+
+
+
+function getChildrenChecked(item, selected)
+{
+ if (item.submenu != null)
+ {
+ for (var x = 0; x < item.submenu.items.length; x++)
+ {
+ item.submenu.items[x].selected = selected;
+ item.submenu.items[x].childSelected = false;
+ MarkChildren(item.submenu.items[x],selected);
+ }
+ }
+}
+
+/******************************************************************************
+* Define the Menu object. *
+******************************************************************************/
+
+function MTMenu() {
+ this.items = new Array();
+ this.MTMAddItem = MTMAddItem;
+}
+
+function MTMAddItem(item) {
+ this.items[this.items.length] = item;
+}
+
+/******************************************************************************
+* Define the icon list, addIcon function and MTMIcon item. *
+******************************************************************************/
+
+function IconList() {
+ this.items = new Array();
+ this.addIcon = addIcon;
+}
+
+function addIcon(item) {
+ this.items[this.items.length] = item;
+}
+
+function MTMIcon(iconfile, match, type) {
+ this.file = iconfile;
+ this.match = match;
+ this.type = type;
+}
+
+/******************************************************************************
+* Global variables. Not to be altered unless you know what you're doing. *
+* User-configurable options are at the end of this document. *
+******************************************************************************/
+
+var MTMLoaded = false;
+var MTMLevel;
+var MTMBar = new Array();
+var MTMIndices = new Array();
+var MTMBrowser = null;
+var MTMNN3 = false;
+var MTMNN4 = false;
+var MTMIE4 = false;
+var MTMUseStyle = true;
+
+/*
+ * (For a standalone JS shell test, we will simply set these as follows:)
+ */
+MTMBrowser = true;
+MTMNN4 = true;
+
+
+var MTMClickedItem = false;
+var MTMExpansion = false;
+
+var MTMSubNumber = 1;
+var MTMTrackedItem = false;
+var MTMTrack = false;
+
+var MTMPreHREF = "";
+if(MTMIE4 || MTMNN3) {
+ MTMPreHREF += ""; // document.location.href.substring(0, document.location.href.lastIndexOf("/") +1);
+}
+
+var MTMFirstRun = true;
+var MTMCurrentTime = 0; // for checking timeout.
+var MTMUpdating = false;
+var MTMWinSize, MTMyval;
+var MTMOutputString = "";
+
+/******************************************************************************
+* Code that picks up frame names of frames in the parent frameset. *
+******************************************************************************/
+
+
+/******************************************************************************
+* Dummy function for sub-menus without URLs *
+* Thanks to Michel Plungjan for the advice. :) *
+******************************************************************************/
+
+function myVoid() { ; }
+
+/******************************************************************************
+* Functions to draw the menu. *
+******************************************************************************/
+
+function MTMSubAction(SubItem, ReturnValue) {
+
+ SubItem.expanded = (SubItem.expanded) ? false : true;
+ if(SubItem.expanded) {
+ MTMExpansion = true;
+ }
+
+ MTMClickedItem = SubItem.number;
+
+ if(MTMTrackedItem && MTMTrackedItem != SubItem.number) {
+ MTMTrackedItem = false;
+ }
+
+ if(!ReturnValue) {
+ setTimeout("MTMDisplayMenu()", 10);
+ }
+
+ return ReturnValue;
+}
+
+
+function MarkChildren(item, selected)
+{
+ if (item.submenu != null)
+ {
+ for (var x = 0; x < item.submenu.items.length; x++)
+ {
+ item.submenu.items[x].selected = selected;
+ item.submenu.items[x].childSelected = false;
+ MarkChildren(item.submenu.items[x],selected);
+ }
+ }
+
+}
+
+function isAllChildrenSelected(item)
+{
+ if (item.submenu != null)
+ {
+ for (var x = 0; x < item.submenu.items.length; x++)
+ {
+ if (!item.submenu.items[x].selected)
+ {
+ return false;
+ }
+ }
+ }
+ return true;
+}
+
+function isSomeChildrenSelected(item)
+{
+ var retValue = false;
+
+ if (item.submenu != null)
+ {
+ for (var x = 0; x < item.submenu.items.length; x++)
+ {
+ if (item.submenu.items[x].selected || item.submenu.items[x].childSelected)
+ {
+ retValue = true;
+ }
+ }
+ }
+
+ return retValue;
+}
+
+function ToggleSelected(item, ReturnValue) {
+
+ item.selected = (item.selected) ? false : true;
+ item.childSelected = false;
+
+ var currentNode = item;
+
+ while (currentNode.parent)
+ {
+ currentNode.parent.selected = isAllChildrenSelected(currentNode.parent);
+ currentNode.parent.childSelected = isSomeChildrenSelected(currentNode.parent);
+ currentNode = currentNode.parent;
+ }
+
+ MarkChildren(item,item.selected);
+
+ if(!ReturnValue) {
+ setTimeout("MTMDisplayMenu()", 10);
+ }
+
+ return ReturnValue;
+}
+
+
+function MTMStartMenu() {
+ MTMLoaded = true;
+ if(MTMFirstRun) {
+ MTMCurrentTime++;
+ if(MTMCurrentTime == MTMTimeOut) { // call MTMDisplayMenu
+ setTimeout("MTMDisplayMenu()",10);
+ } else {
+ setTimeout("MTMStartMenu()",100);
+ }
+ }
+}
+
+function MTMDisplayMenu() {
+ if(MTMBrowser && !MTMUpdating) {
+ MTMUpdating = true;
+ MTMFirstRun = false;
+
+ if(MTMTrack) { MTMTrackedItem = MTMTrackExpand(menu); }
+
+ if(MTMExpansion && MTMSubsAutoClose) { MTMCloseSubs(menu); }
+
+ MTMLevel = 0;
+ MTMDoc = parent.frames[MTMenuFrame].document
+ MTMDoc.open("text/html", "replace");
+ MTMOutputString = '<html><head>';
+ if(MTMLinkedSS) {
+ MTMOutputString += '<link rel="stylesheet" type="text/css" href="' + MTMPreHREF + MTMSSHREF + '">';
+ } else if(MTMUseStyle) {
+ MTMOutputString += '<style type="text/css">body {color:' + MTMTextColor + ';background:';
+ MTMOutputString += (MTMBackground == "") ? MTMBGColor : MTMakeBackImage(MTMBackground);
+ MTMOutputString += ';} #root {color:' + MTMRootColor + ';background:' + ((MTMBackground == "") ? MTMBGColor : 'transparent') + ';font-family:' + MTMRootFont + ';font-size:' + MTMRootCSSize + ';} ';
+ MTMOutputString += 'a {font-family:' + MTMenuFont + ';letter-spacing:-0.05em;font-weight:bold;font-size:' + MTMenuCSSize + ';text-decoration:none;color:' + MTMLinkColor + ';background:' + MTMakeBackground() + ';} ';
+ MTMOutputString += MTMakeA('pseudo', 'hover', MTMAhoverColor);
+ MTMOutputString += MTMakeA('class', 'tracked', MTMTrackColor);
+ MTMOutputString += MTMakeA('class', 'subexpanded', MTMSubExpandColor);
+ MTMOutputString += MTMakeA('class', 'subclosed', MTMSubClosedColor) + '</style>';
+ }
+
+ MTMOutputString += '</head><body ';
+ if(MTMBackground != "") {
+ MTMOutputString += 'background="' + MTMPreHREF + MTMenuImageDirectory + MTMBackground + '" ';
+ }
+ MTMOutputString += 'bgcolor="' + MTMBGColor + '" text="' + MTMTextColor + '" link="' + MTMLinkColor + '" vlink="' + MTMLinkColor + '" alink="' + MTMLinkColor + '">';
+
+ MTMOutputString += '<table border="0" cellpadding="0" cellspacing="0" width="' + MTMTableWidth + '">';
+ MTMOutputString += '<tr valign="top"><td nowrap>'; //REMOVED ROOT ICON <img src="' + MTMPreHREF + MTMenuImageDirectory + MTMRootIcon + '" align="left" border="0" vspace="0" hspace="0">';
+ if(MTMUseStyle) {
+ MTMOutputString += ''; //REMOVED ROOT CAPTION <span id="root">&nbsp;' + MTMenuText + '</span>';
+ } else {
+ MTMOutputString += ''; //REMOVED ROOT CAPTION <font size="' + MTMRootFontSize + '" face="' + MTMRootFont + '" color="' + MTMRootColor + '">' + MTMenuText + '</font>';
+ }
+ MTMDoc.writeln(MTMOutputString + '</td></tr>');
+
+ MTMListItems(menu);
+ MTMDoc.writeln('</table>');
+
+ MTMDoc.writeln('</body></html>');
+ MTMDoc.close();
+
+ if((MTMClickedItem || MTMTrackedItem) && (MTMNN4 || MTMIE4) && !MTMFirstRun) {
+ MTMItemName = "sub" + (MTMClickedItem ? MTMClickedItem : MTMTrackedItem);
+ if(document.layers && parent.frames[MTMenuFrame].scrollbars) {
+ MTMyval = parent.frames[MTMenuFrame].document.anchors[MTMItemName].y;
+ MTMWinSize = parent.frames[MTMenuFrame].innerHeight;
+ } else {
+ MTMyval = MTMGetPos(parent.frames[MTMenuFrame].document.all[MTMItemName]);
+ MTMWinSize = parent.frames[MTMenuFrame].document.body.offsetHeight;
+ }
+ if(MTMyval > (MTMWinSize - 60)) {
+ parent.frames[MTMenuFrame].scrollBy(0, parseInt(MTMyval - (MTMWinSize * 1/3)));
+ }
+ }
+
+ MTMClickedItem = false;
+ MTMExpansion = false;
+ MTMTrack = false;
+ }
+MTMUpdating = false;
+}
+
+function MTMListItems(menu) {
+ var i, isLast;
+ for (i = 0; i < menu.items.length; i++) {
+ MTMIndices[MTMLevel] = i;
+ isLast = (i == menu.items.length -1);
+ MTMDisplayItem(menu.items[i], isLast);
+
+ if (menu.items[i].submenu && menu.items[i].expanded) {
+ MTMBar[MTMLevel] = (isLast) ? false : true;
+ MTMLevel++;
+ MTMListItems(menu.items[i].submenu);
+ MTMLevel--;
+ } else {
+ MTMBar[MTMLevel] = false;
+ }
+ }
+
+}
+
+function MTMDisplayItem(item, last) {
+ var i, img, more;
+
+ var MTMfrm = "parent.frames['code']";
+ var MTMref = '.menu.items[' + MTMIndices[0] + ']';
+
+ if(item.submenu) {
+ var MTMouseOverText;
+
+ var MTMClickCmd;
+ var MTMDblClickCmd = false;
+
+
+ if(MTMLevel > 0) {
+ for(i = 1; i <= MTMLevel; i++) {
+ MTMref += ".submenu.items[" + MTMIndices[i] + "]";
+ }
+ }
+
+ if(!MTMEmulateWE && !item.expanded && (item.url != "")) {
+ MTMClickCmd = "return " + MTMfrm + ".MTMSubAction(" + MTMfrm + MTMref + ",true);";
+ } else {
+ MTMClickCmd = "return " + MTMfrm + ".MTMSubAction(" + MTMfrm + MTMref + ",false);";
+ }
+
+ if(item.url == "") {
+ MTMouseOverText = (item.text.indexOf("'") != -1) ? MTMEscapeQuotes(item.text) : item.text;
+ } else {
+ MTMouseOverText = "Expand/Collapse";
+ }
+ }
+
+ MTMOutputString = '<tr valign="top"><td nowrap>';
+ if(MTMLevel > 0) {
+ for (i = 0; i < MTMLevel; i++) {
+ MTMOutputString += (MTMBar[i]) ? MTMakeImage("menu_bar.gif") : MTMakeImage("menu_pixel.gif");
+ }
+ }
+
+ more = false;
+ if(item.submenu) {
+ if(MTMSubsGetPlus || MTMEmulateWE) {
+ more = true;
+ } else {
+ for (i = 0; i < item.submenu.items.length; i++) {
+ if (item.submenu.items[i].submenu) {
+ more = true;
+ }
+ }
+ }
+ }
+ if(!more) {
+ img = (last) ? "menu_corner.gif" : "menu_tee.gif";
+ } else {
+ if(item.expanded) {
+ img = (last) ? "menu_corner_minus.gif" : "menu_tee_minus.gif";
+ } else {
+ img = (last) ? "menu_corner_plus.gif" : "menu_tee_plus.gif";
+ }
+ if(item.url == "" || item.expanded || MTMEmulateWE) {
+ MTMOutputString += MTMakeVoid(item, MTMClickCmd, MTMouseOverText);
+ } else {
+ MTMOutputString += MTMakeLink(item, true) + ' onclick="' + MTMClickCmd + '">';
+ }
+ }
+ MTMOutputString += MTMakeImage(img);
+/////////////////////////////////////////
+
+var MTMCheckRef = '.menu.items[' + MTMIndices[0] + ']';
+if(MTMLevel > 0) {
+ for(i = 1; i <= MTMLevel; i++) {
+ MTMCheckRef += ".submenu.items[" + MTMIndices[i] + "]";
+ }
+ }
+
+MTMOutputString += MTMakeVoid(item, "return " + MTMfrm + ".ToggleSelected(" + MTMfrm + MTMCheckRef + ",false);", "Checked Status") ;
+var checkedImage = item.selected ? "checked.gif" : "uchecked.gif";
+if (!item.selected)
+{
+ checkedImage = item.childSelected ? "gchecked.gif" : "uchecked.gif";
+}
+MTMOutputString += MTMakeImage(checkedImage);
+MTMOutputString += '</a>';
+/////////////////////////////////////////////////
+
+
+ if(item.submenu) {
+ if(MTMEmulateWE && item.url != "")
+ {
+ MTMOutputString += '</a>' + MTMakeLink(item, false) + '>';
+ }
+
+ img = (item.expanded) ? "menu_folder_open.gif" : "menu_folder_closed.gif";
+
+ if(!more) {
+ if(item.url == "" || item.expanded) {
+ MTMOutputString += MTMakeVoid(item, MTMClickCmd, MTMouseOverText);
+ } else {
+ MTMOutputString += MTMakeLink(item, true) + ' onclick="' + MTMClickCmd + '">';
+ }
+ }
+ MTMOutputString += MTMakeImage(img);
+
+ } else {
+ MTMOutputString += MTMakeLink(item, true) + '>';
+ img = (item.icon != "") ? item.icon : MTMFetchIcon(item.url);
+ MTMOutputString += MTMakeImage(img);
+ }
+
+ if(item.submenu && (item.url != "") && (item.expanded && !MTMEmulateWE)) {
+ MTMOutputString += '</a>' + MTMakeLink(item, false) + '>';
+ }
+
+ if(MTMNN3 && !MTMLinkedSS) {
+ var stringColor;
+ if(item.submenu && (item.url == "") && (item.number == MTMClickedItem)) {
+ stringColor = (item.expanded) ? MTMSubExpandColor : MTMSubClosedColor;
+ } else if(MTMTrackedItem && MTMTrackedItem == item.number) {
+ stringColor = MTMTrackColor;
+ } else {
+ stringColor = MTMLinkColor;
+ }
+ MTMOutputString += '<font color="' + stringColor + '" size="' + MTMenuFontSize + '" face="' + MTMenuFont + '">';
+ }
+ MTMOutputString += '&nbsp;' + item.text + ((MTMNN3 && !MTMLinkedSS) ? '</font>' : '') + '</a>' ;
+ MTMDoc.writeln(MTMOutputString + '</td></tr>');
+}
+
+function MTMEscapeQuotes(myString) {
+ var newString = "";
+ var cur_pos = myString.indexOf("'");
+ var prev_pos = 0;
+ while (cur_pos != -1) {
+ if(cur_pos == 0) {
+ newString += "\\";
+ } else if(myString.charAt(cur_pos-1) != "\\") {
+ newString += myString.substring(prev_pos, cur_pos) + "\\";
+ } else if(myString.charAt(cur_pos-1) == "\\") {
+ newString += myString.substring(prev_pos, cur_pos);
+ }
+ prev_pos = cur_pos++;
+ cur_pos = myString.indexOf("'", cur_pos);
+ }
+ return(newString + myString.substring(prev_pos, myString.length));
+}
+
+function MTMTrackExpand(thisMenu) {
+ var i, targetPath;
+ var foundNumber = false;
+ for(i = 0; i < thisMenu.items.length; i++) {
+ if(thisMenu.items[i].url != "" && MTMTrackTarget(thisMenu.items[i].target)) {
+ targetPath = parent.frames[thisMenu.items[i].target].location.protocol + '//' + parent.frames[thisMenu.items[i].target].location.host + parent.frames[thisMenu.items[i].target].location.pathname;
+
+ if(targetPath.lastIndexOf(thisMenu.items[i].url) != -1 && (targetPath.lastIndexOf(thisMenu.items[i].url) + thisMenu.items[i].url.length) == targetPath.length) {
+ return(thisMenu.items[i].number);
+ }
+ }
+ if(thisMenu.items[i].submenu) {
+ foundNumber = MTMTrackExpand(thisMenu.items[i].submenu);
+ if(foundNumber) {
+ if(!thisMenu.items[i].expanded) {
+ thisMenu.items[i].expanded = true;
+ if(!MTMClickedItem) { MTMClickedItem = thisMenu.items[i].number; }
+ MTMExpansion = true;
+ }
+ return(foundNumber);
+ }
+ }
+ }
+return(foundNumber);
+}
+
+function MTMCloseSubs(thisMenu) {
+ var i, j;
+ var foundMatch = false;
+ for(i = 0; i < thisMenu.items.length; i++) {
+ if(thisMenu.items[i].submenu && thisMenu.items[i].expanded) {
+ if(thisMenu.items[i].number == MTMClickedItem) {
+ foundMatch = true;
+ for(j = 0; j < thisMenu.items[i].submenu.items.length; j++) {
+ if(thisMenu.items[i].submenu.items[j].expanded) {
+ thisMenu.items[i].submenu.items[j].expanded = false;
+ }
+ }
+ } else {
+ if(foundMatch) {
+ thisMenu.items[i].expanded = false;
+ } else {
+ foundMatch = MTMCloseSubs(thisMenu.items[i].submenu);
+ if(!foundMatch) {
+ thisMenu.items[i].expanded = false;
+ }
+ }
+ }
+ }
+ }
+return(foundMatch);
+}
+
+function MTMFetchIcon(testString) {
+ var i;
+ for(i = 0; i < MTMIconList.items.length; i++) {
+ if((MTMIconList.items[i].type == 'any') && (testString.indexOf(MTMIconList.items[i].match) != -1)) {
+ return(MTMIconList.items[i].file);
+ } else if((MTMIconList.items[i].type == 'pre') && (testString.indexOf(MTMIconList.items[i].match) == 0)) {
+ return(MTMIconList.items[i].file);
+ } else if((MTMIconList.items[i].type == 'post') && (testString.indexOf(MTMIconList.items[i].match) != -1)) {
+ if((testString.lastIndexOf(MTMIconList.items[i].match) + MTMIconList.items[i].match.length) == testString.length) {
+ return(MTMIconList.items[i].file);
+ }
+ }
+ }
+return("menu_link_default.gif");
+}
+
+function MTMGetPos(myObj) {
+ return(myObj.offsetTop + ((myObj.offsetParent) ? MTMGetPos(myObj.offsetParent) : 0));
+}
+
+function MTMCheckURL(myURL) {
+ var tempString = "";
+ if((myURL.indexOf("http://") == 0) || (myURL.indexOf("https://") == 0) || (myURL.indexOf("mailto:") == 0) || (myURL.indexOf("ftp://") == 0) || (myURL.indexOf("telnet:") == 0) || (myURL.indexOf("news:") == 0) || (myURL.indexOf("gopher:") == 0) || (myURL.indexOf("nntp:") == 0) || (myURL.indexOf("javascript:") == 0)) {
+ tempString += myURL;
+ } else {
+ tempString += MTMPreHREF + myURL;
+ }
+return(tempString);
+}
+
+function MTMakeVoid(thisItem, thisCmd, thisText) {
+ var tempString = "";
+ tempString += '<a name="sub' + thisItem.number + '" href="javascript:parent.frames[\'code\'].myVoid();" onclick="' + thisCmd + '" onmouseover="window.status=\'' + thisText + '\';return true;" onmouseout="window.status=\'' + window.defaultStatus.replace(/'/g,"") + '\';return true;"';
+ if(thisItem.number == MTMClickedItem) {
+ var tempClass;
+ tempClass = thisItem.expanded ? "subexpanded" : "subclosed";
+ tempString += ' class="' + tempClass + '"';
+ }
+ return(tempString + '>');
+}
+
+function MTMakeLink(thisItem, addName) {
+ var tempString = '<a';
+
+ if(MTMTrackedItem && MTMTrackedItem == thisItem.number) {
+ tempString += ' class="tracked"'
+ }
+ if(addName) {
+ tempString += ' name="sub' + thisItem.number + '"';
+ }
+ tempString += ' href="' + MTMCheckURL(thisItem.url) + '"';
+ if(thisItem.target != "") {
+ tempString += ' target="' + thisItem.target + '"';
+ }
+return tempString;
+}
+
+function MTMakeImage(thisImage) {
+ return('<img src="' + MTMPreHREF + MTMenuImageDirectory + thisImage + '" align="left" border="0" vspace="0" hspace="0" width="18" height="18">');
+}
+
+function MTMakeBackImage(thisImage) {
+ var tempString = 'transparent url("' + ((MTMPreHREF == "") ? "" : MTMPreHREF);
+ tempString += MTMenuImageDirectory + thisImage + '")'
+ return(tempString);
+}
+
+function MTMakeA(thisType, thisText, thisColor) {
+ var tempString = "";
+ tempString += 'a' + ((thisType == "pseudo") ? ':' : '.');
+ return(tempString + thisText + '{color:' + thisColor + ';background:' + MTMakeBackground() + ';}');
+}
+
+function MTMakeBackground() {
+ return((MTMBackground == "") ? MTMBGColor : 'transparent');
+}
+
+function MTMTrackTarget(thisTarget) {
+ if(thisTarget.charAt(0) == "_") {
+ return false;
+ } else {
+ for(i = 0; i < MTMFrameNames.length; i++) {
+ if(thisTarget == MTMFrameNames[i]) {
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+
+
+
+/******************************************************************************
+* User-configurable options. *
+******************************************************************************/
+
+// Menu table width, either a pixel-value (number) or a percentage value.
+var MTMTableWidth = "100%";
+
+// Name of the frame where the menu is to appear.
+var MTMenuFrame = "tocmain";
+
+// variable for determining whether a sub-menu always gets a plus-sign
+// regardless of whether it holds another sub-menu or not
+var MTMSubsGetPlus = true;
+
+
+// variable that defines whether the menu emulates the behaviour of
+// Windows Explorer
+var MTMEmulateWE = true;
+
+// Directory of menu images/icons
+var MTMenuImageDirectory = "/ndk/doc/docui2k/menu-images/";
+
+// Variables for controlling colors in the menu document.
+// Regular BODY atttributes as in HTML documents.
+var MTMBGColor = "#cc0000";
+var MTMBackground = "";
+var MTMTextColor = "white";
+
+// color for all menu items
+var MTMLinkColor = "#ffffcc";
+
+// Hover color, when the mouse is over a menu link
+var MTMAhoverColor = "#FF9933";
+
+// Foreground color for the tracking & clicked submenu item
+var MTMTrackColor ="#FF9933";
+var MTMSubExpandColor = "#ffffcc";
+var MTMSubClosedColor = "#ffffcc";
+
+// All options regarding the root text and it's icon
+var MTMRootIcon = "menu_new_root.gif";
+var MTMenuText = "Site contents:";
+var MTMRootColor = "white";
+var MTMRootFont = "Verdana";
+var MTMRootCSSize = "84%";
+var MTMRootFontSize = "-1";
+
+// Font for menu items.
+var MTMenuFont = "Verdana";
+var MTMenuCSSize = "74%";
+var MTMenuFontSize = "-1";
+
+// Variables for style sheet usage
+// 'true' means use a linked style sheet.
+var MTMLinkedSS = false;
+var MTMSSHREF = "style/menu.css";
+
+// Whether you want an open sub-menu to close automagically
+// when another sub-menu is opened. 'true' means auto-close
+var MTMSubsAutoClose = false;
+
+// This variable controls how long it will take for the menu
+// to appear if the tracking code in the content frame has
+// failed to display the menu. Number if in tenths of a second
+// (1/10) so 10 means "wait 1 second".
+var MTMTimeOut = 25;
+
+/******************************************************************************
+* User-configurable list of icons. *
+******************************************************************************/
+
+var MTMIconList = null;
+MTMIconList = new IconList();
+// examples:
+//MTMIconList.addIcon(new MTMIcon("menu_link_external.gif", "http://", "pre"));
+//MTMIconList.addIcon(new MTMIcon("menu_link_pdf.gif", ".pdf", "post"));
+
+/******************************************************************************
+* User-configurable menu. *
+******************************************************************************/
+
+
+// navigation link is an object used to store the extracted information from
+// the search request. The stored information will be used to build the
+// navigation tree.
+ function navigationLink(title,URL,level,elementIndex,levelIndex,parentIndex,author)
+ {
+ var returnArray = new Array();
+ returnArray.title = title;
+ returnArray.URL = URL;
+ returnArray.level = level;
+ returnArray.hasChild = false;
+ returnArray.elementIndex = elementIndex;
+ returnArray.parentIndex = parentIndex;
+ returnArray.levelIndex = levelIndex;
+ returnArray.author = author;
+
+ return returnArray;
+ }
+
+// Variables used for tracking state as the search iterates through the list
+// of documents returned.
+var index = 0;
+var currentLevel = 0;
+var levelParents = new Array();
+var levelIndexes = new Array();
+var navigationTree = new Array();
+var treeNodes = new Array();
+var levelIndex = 0;
+top.printList = "";
+top.printCount = 0;
+
+// asign the menu handle to the created tree
+var menu = null;
+
+
+function getNextChecked(item)
+{
+ // case that root of tree is selected
+ if ( item.parent == null && item.selected)
+ {
+ for (var i = 0 ; i < top.authors.length; i++)
+ {
+ var re = /\s$/;
+
+ if (top.titles[i].replace(re,"") == item.text.replace(re,""))
+ {
+ top.printList += (top.authors[i].length + 3) + "_" + top.authors[i].replace(/\s/g,"+") + "+en";
+ top.printCount ++;
+ }
+ }
+ }
+ else if (item.submenu != null)
+ {
+ for (var x = 0; x < item.submenu.items.length; x++)
+ {
+ if (item.submenu.items[x].selected)
+ {
+ var name = item.submenu.items[x].text;
+ for (var i = 0 ; i < top.authors.length; i++)
+ {
+ var re = /\s$/;
+ if (top.titles[i].replace(re,"") == name.replace(re,""))
+ {
+ top.printList += (top.authors[i].length + 3) + "_" + top.authors[i].replace(/\s/g,"+") + "+en";
+ top.printCount ++;
+ }
+ }
+
+ }
+ else
+ {
+ getNextChecked(item.submenu.items[x]);
+ }
+ }
+ }
+
+}
+
+// Get a URL to pass checked topics to the Print Servlet
+
+
+
+function getPrintUrl(menu)
+{
+ top.printList = "";
+ top.printCount = 0;
+
+ getNextChecked(menu.items[0]);
+ top.printList = top.printCount + "_" + top.printList;
+
+ return top.printList;
+}
+
+function setLevels()
+{
+
+ // Tracking the parent of the next node.
+ levelParents[currentLevel + 1] = index;
+
+ // levelIndex is the child index under a branch
+ if (levelIndexes[currentLevel] == null)
+ {
+ levelIndexes[currentLevel] = 0;
+ }
+ else
+ {
+ levelIndexes[currentLevel] = levelIndexes[currentLevel] + 1;
+ levelIndexes[currentLevel + 1] = -1;
+ }
+}
+
+function buildTree()
+{
+
+// Determine which nodes have children and assign the correct property
+for (var i = 0; i < navigationTree.length-1; i++)
+{
+ // see if the current node has chilren
+ var thisLevel = navigationTree[i]["level"];
+ var nextLevel = navigationTree[i+1]["level"];
+
+ if (nextLevel > thisLevel)
+ {
+ navigationTree[i]["hasChild"] = true;
+ }
+ else
+ {
+ navigationTree[i]["hasChild"] = false;
+ }
+}
+
+
+// create tree object nodes.
+for( var j = 0; j < navigationTree.length; j++)
+{
+ treeNodes[j] = null;
+ treeNodes[j] = new MTMenu();
+}
+
+
+// add all items to nodes -
+// NOTE, index to add to is the parent index + 1 for node tree offset of root=0
+for( var j3 = 0; j3 < navigationTree.length; j3++)
+{
+ if (navigationTree[j3]["parentIndex"] == null)
+ {
+ var nsearchID = navigationTree[j3]["author"];
+ treeNodes[0].MTMAddItem(new MTMenuItem(navigationTree[j3]["title"], navigationTree[j3]["URL"].replace(/http...developer.novell.com.ndk/gi,"/ndk") , "content_frame", nsearchID));
+ }
+ else
+ {
+ var nsearchID = navigationTree[j3]["author"];
+ treeNodes[navigationTree[j3]["parentIndex"] + 1 ].MTMAddItem(new MTMenuItem(navigationTree[j3]["title"], navigationTree[j3]["URL"].replace(/http...developer.novell.com.ndk/gi,"/ndk"), "content_frame",nsearchID));
+ }
+}
+
+// create submenu structure
+// NOTE: add 1 to parent nodes for root = 0 offset.
+for( var j4 = 0; j4 < navigationTree.length; j4++)
+{
+ if (navigationTree[j4]["hasChild"])
+ {
+ var pindex = null;
+ if (navigationTree[j4]["parentIndex"] == null)
+ {
+
+ pindex = 0;
+ }
+ else
+ {
+ pindex = navigationTree[j4]["parentIndex"]+1;
+ }
+
+ var lindex = navigationTree[j4]["levelIndex"];
+ // document.write('treeNodes[' + pindex +'].items['+ lindex +'].MTMakeSubmenu(treeNodes['+(j4+1)+']);<br>');
+
+ treeNodes[pindex].items[lindex].MTMakeSubmenu(treeNodes[j4+1]);
+ }
+}
+
+ menu = treeNodes[0];
+
+//expand the second item to display the sub contents on first display
+if (menu.items[0] != null )
+{
+ menu.items[0].expanded = true;
+
+}
+
+
+
+}
+
+
+
+currentLevel++;
+
+setLevels();
+var navElement = navigationLink("NDS Libraries for C ","http://developer.novell.com/ndk/doc/ndslib/treetitl.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+currentLevel++;
+
+setLevels();
+var navElement = navigationLink("NDS Backup Services ","http://developer.novell.com/ndk/doc/ndslib/dsbk_enu/data/hevgtl7k.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+currentLevel++;
+
+setLevels();
+var navElement = navigationLink("Functions ","http://developer.novell.com/ndk/doc/ndslib/dsbk_enu/data/h7qwv271.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+currentLevel++;
+
+setLevels();
+var navElement = navigationLink("NDSBackupServerData ","http://developer.novell.com/ndk/doc/ndslib/dsbk_enu/data/sdk5.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDSFreeNameList ","http://developer.novell.com/ndk/doc/ndslib/dsbk_enu/data/sdk12.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDSGetReplicaPartitionNames ","http://developer.novell.com/ndk/doc/ndslib/dsbk_enu/data/sdk19.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDSIsOnlyServerInTree ","http://developer.novell.com/ndk/doc/ndslib/dsbk_enu/data/sdk26.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDSSYSVolumeRecovery ","http://developer.novell.com/ndk/doc/ndslib/dsbk_enu/data/sdk33.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDSVerifyServerInfo ","http://developer.novell.com/ndk/doc/ndslib/dsbk_enu/data/sdk40.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+if (currentLevel > 1) currentLevel--
+
+setLevels();
+var navElement = navigationLink("Structures ","http://developer.novell.com/ndk/doc/ndslib/dsbk_enu/data/hqp7vveq.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+currentLevel++;
+
+setLevels();
+var navElement = navigationLink("NAMEID_TYPE ","http://developer.novell.com/ndk/doc/ndslib/dsbk_enu/data/sdk48.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+if (currentLevel > 1) currentLevel--
+
+setLevels();
+var navElement = navigationLink("Values ","http://developer.novell.com/ndk/doc/ndslib/dsbk_enu/data/hmmmal7s.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+currentLevel++;
+
+setLevels();
+var navElement = navigationLink("NDS Reason Flags ","http://developer.novell.com/ndk/doc/ndslib/dsbk_enu/data/h3r99io5.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDS Server Flags ","http://developer.novell.com/ndk/doc/ndslib/dsbk_enu/data/hnlckbki.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+if (currentLevel > 1) currentLevel--
+
+setLevels();
+var navElement = navigationLink("Revision History ","http://developer.novell.com/ndk/doc/ndslib/dsbk_enu/data/a5i29ah.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+if (currentLevel > 1) currentLevel--
+
+setLevels();
+var navElement = navigationLink("NDS Event Services ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/hmwiqbwd.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+currentLevel++;
+
+setLevels();
+var navElement = navigationLink("Concepts ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/hj3udfo7.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+currentLevel++;
+
+setLevels();
+var navElement = navigationLink("NDS Event Introduction ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/hmgeu8a1.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDS Event Functions ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/hxwcemsz.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDS Event Priorities ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/hux0tdup.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDS Event Data Filtering ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/ha7nqbpy.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDS Event Types ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/h741eryw.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Global Network Monitoring ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/h9alatk4.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+if (currentLevel > 1) currentLevel--
+
+setLevels();
+var navElement = navigationLink("Tasks ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/huypg52u.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+currentLevel++;
+
+setLevels();
+var navElement = navigationLink("Monitoring NDS Events ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/hhkihe7f.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Registering for NDS Events ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/h0xmzt1h.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Unregistering for NDS Events ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/hk3fvwed.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+if (currentLevel > 1) currentLevel--
+
+setLevels();
+var navElement = navigationLink("Functions ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/h7qwv271.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+currentLevel++;
+
+setLevels();
+var navElement = navigationLink("NWDSEConvertEntryName ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/sdk28.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSEGetLocalAttrID ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/sdk33.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSEGetLocalAttrName ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/sdk39.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSEGetLocalClassID ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/sdk45.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSEGetLocalClassName ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/sdk51.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSEGetLocalEntryID ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/sdk57.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSEGetLocalEntryName ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/sdk63.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSERegisterForEvent ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/sdk69.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSERegisterForEventWithResult ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/sdk75.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSEUnRegisterForEvent ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/sdk81.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+if (currentLevel > 1) currentLevel--
+
+setLevels();
+var navElement = navigationLink("Structures ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/hqp7vveq.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+currentLevel++;
+
+setLevels();
+var navElement = navigationLink("DSEACL ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/sdk88.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("DSEBackLink ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/sdk92.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("DSEBinderyObjectInfo ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/sdk96.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("DSEBitString ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/sdk100.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("DSEChangeConnState ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/sdk104.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("DSECIList ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/sdk108.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("DSEDebugInfo ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/sdk112.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("DSEEmailAddress ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/sdk116.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("DSEEntryInfo ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/sdk120.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("DSEEntryInfo2 ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/sdk124.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("DSEEventData ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/sdk128.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("DSEFaxNumber ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/sdk132.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("DSEHold ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/sdk135.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("DSEModuleState ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/sdk139.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("DSENetAddress ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/sdk143.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("DSEOctetList ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/sdk147.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("DSEPath ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/sdk151.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("DSEReplicaPointer ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/sdk155.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("DSESEVInfo ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/sdk159.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("DSETimeStamp ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/sdk163.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("DSETraceInfo ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/sdk167.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("DSETypedName ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/sdk172.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("DSEVALData ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/sdk176.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("DSEValueInfo ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/sdk179.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+if (currentLevel > 1) currentLevel--
+
+setLevels();
+var navElement = navigationLink("Values ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/hmmmal7s.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+currentLevel++;
+
+setLevels();
+var navElement = navigationLink("Event Priorities ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/hlerfllh.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Event Types ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/hiz5y84y.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+if (currentLevel > 1) currentLevel--
+
+setLevels();
+var navElement = navigationLink("Revision History ","http://developer.novell.com/ndk/doc/ndslib/dsev_enu/data/a6hw6zr.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+if (currentLevel > 1) currentLevel--
+
+setLevels();
+var navElement = navigationLink("NDS Technical Overview ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/h6tvg4z7.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+currentLevel++;
+
+setLevels();
+var navElement = navigationLink("NDS as the Internet Directory ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/h273w870.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+currentLevel++;
+
+setLevels();
+var navElement = navigationLink("Requirements for Networks and the Internet ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/a2lh37b.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDS Compliance to X.500 Standard ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/h0jj42d7.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDS Compliance with LDAP v3 ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/a2b6k5w.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Directory Access Protocols ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/a2b6k5x.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Programming Interfaces for NDS ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/h2qzzkq8.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDS Architecture ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/h6mny7fl.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+if (currentLevel > 1) currentLevel--
+
+setLevels();
+var navElement = navigationLink("NDS Objects ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/hp4dslw5.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+currentLevel++;
+
+setLevels();
+var navElement = navigationLink("NDS Names ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/h0yh1byj.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Types of Information Stored in NDS ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/hci52ynf.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Retrieval of Information from NDS ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/hwwz5mda.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Tree Walking ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/h2xhaphc.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDS Object Management ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/h3mq2rf0.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+if (currentLevel > 1) currentLevel--
+
+setLevels();
+var navElement = navigationLink("NDS Security ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/hl8x1zxc.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+currentLevel++;
+
+setLevels();
+var navElement = navigationLink("Authentication ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/hp901s8a.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Access Control Lists ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/hr8sqtoi.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Inheritance ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/hh9881ul.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NetWare File System ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/h64btfhk.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+if (currentLevel > 1) currentLevel--
+
+setLevels();
+var navElement = navigationLink("Partitions and Replicas ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/hmq60r6h.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+currentLevel++;
+
+setLevels();
+var navElement = navigationLink("Partitioning ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/hqx5hvrp.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Replication ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/hj5l8npv.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Distributed Reference Management ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/hzap47de.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Partition Operations ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/hgbpk7x9.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Synchronization ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/hsiplgn4.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Background Processes ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/hz2kcp2e.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+if (currentLevel > 1) currentLevel--
+
+setLevels();
+var navElement = navigationLink("Bindery Services ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/hwug6ytv.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+currentLevel++;
+
+setLevels();
+var navElement = navigationLink("NDS Bindery Context ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/h8dwby8o.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Bindery Context Path ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/h6y3yva6.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Bindery Context Eclipsing ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/hwcqk80m.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDS Bindery Objects ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/hq4w9le6.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+if (currentLevel > 1) currentLevel--
+
+setLevels();
+var navElement = navigationLink("NDS Return Values ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/hbjry4gt.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+currentLevel++;
+
+setLevels();
+var navElement = navigationLink("NDS Return Values from the Operating System ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/h5h16q77.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDS Client Return Values ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/he2lvhfy.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDS Agent Return Values ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/hcvwzt90.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+if (currentLevel > 1) currentLevel--
+
+setLevels();
+var navElement = navigationLink("Directory Services Trace Utilities ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/hujirj2n.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+currentLevel++;
+
+setLevels();
+var navElement = navigationLink("Using the DSTrace NLM ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/hmg1e5gn.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Using Basic SET DSTrace Commands ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/hdn0smja.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Starting Background Processes with SET DSTrace ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/h5pjd8fv.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Tuning Background Processes ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/hhv9cqpk.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Enabling DSTrace Messages with SET DSTrace ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/hcah5j8v.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+if (currentLevel > 1) currentLevel--
+
+setLevels();
+var navElement = navigationLink("Revision History ","http://developer.novell.com/ndk/doc/ndslib/dsov_enu/data/a5i29ah.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+if (currentLevel > 1) currentLevel--
+
+setLevels();
+var navElement = navigationLink("NDS Core Services ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/h2y7hdit.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+currentLevel++;
+
+setLevels();
+var navElement = navigationLink("Programming Concepts ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/h2x9gqr9.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+currentLevel++;
+
+setLevels();
+var navElement = navigationLink("Context Handles ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/huynzi7a.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Buffer Management ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/h9xiygoj.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Read Requests for Object Information ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/h7d6try4.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Search Requests ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/h11es6ae.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Developing in a Loosely Consistent Environment ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/hsaqomj7.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Add Object Requests ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/hqjws9hi.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDS Security and Applications ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/h3xwyggn.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Authentication of Client Applications ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/h0m1k6ck.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Multiple Tree Support ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/hu5a8flo.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Effective Rights Function ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/he06edkq.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Partition Functions ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/ha7fzu9h.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Replica Functions ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/hpmsr4w7.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Read Requests for Schema Information ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/h0a2o4v9.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Schema Extension Requests ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/hrgy5k6e.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+if (currentLevel > 1) currentLevel--
+
+setLevels();
+var navElement = navigationLink("Tasks ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/huypg52u.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+currentLevel++;
+
+setLevels();
+var navElement = navigationLink("Context Handle Tasks ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/hw34ixeu.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Buffer Tasks ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/hb1nkqk4.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Authentication and Connection Tasks ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/huzx6sda.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Object Tasks ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/hddp9m9i.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Partition and Replica Tasks ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/hpx2o69b.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Schema Tasks ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/hp85l75p.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+if (currentLevel > 1) currentLevel--
+
+setLevels();
+var navElement = navigationLink("Functions ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/h7qwv271.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+currentLevel++;
+
+setLevels();
+var navElement = navigationLink("NWDSAbbreviateName ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk135.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSAbortPartitionOperation ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk144.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSAddFilterToken ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk153.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSAddObject ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk162.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSAddPartition (obsolete&#45;&#45;&#45;moved from .h file 11/99) ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk171.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSAddReplica ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk180.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSAddSecurityEquiv ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk189.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSAllocBuf ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk198.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSAllocFilter ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk207.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSAuditGetObjectID ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk216.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSAuthenticate ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk225.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSAuthenticateConn ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk234.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSAuthenticateConnEx ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/a3fvxoz.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSBackupObject ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk243.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSBeginClassItem ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk252.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSCanDSAuthenticate ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk261.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSCanonicalizeName ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk270.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSChangeObjectPassword ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk279.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSChangeReplicaType ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk288.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSCIStringsMatch ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk297.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSCloseIteration ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk305.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSCompare ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk314.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSComputeAttrValSize ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk360.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSCreateContext (obsolete&#45;&#45;&#45;moved from .h file 6/99) ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk369.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSCreateContextHandle ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk371.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSDefineAttr ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk382.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSDefineClass ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk391.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSDelFilterToken ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk402.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSDuplicateContext (obsolete 03/99) ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk412.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSDuplicateContextHandle ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk423.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSExtSyncList ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk434.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSExtSyncRead ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk443.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSExtSyncSearch ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk455.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSFreeBuf ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk465.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSFreeContext ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk474.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSFreeFilter ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk491.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSGenerateObjectKeyPair ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk501.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSGetAttrCount ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk511.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSGetAttrDef ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk521.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSGetAttrName ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk530.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSGetAttrVal ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk540.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSGetAttrValFlags ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk550.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSGetAttrValModTime ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk558.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSGetBinderyContext ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk566.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSGetClassDef ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk603.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSGetClassDefCount ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk691.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSGetClassItem ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk769.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSGetClassItemCount ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk838.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSGetContext ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk919.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSGetCountByClassAndName ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk972.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSGetCurrentUser ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk1031.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSGetDefNameContext ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk1041.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSGetDSIInfo ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk1117.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSGetDSVerInfo ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk1209.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSGetEffectiveRights ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk1274.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSGetMonitoredConnRef ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk1346.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSGetNDSInfo ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk1425.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSGetObjectCount ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk1528.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSGetObjectHostServerAddress ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk1604.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSGetObjectName ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk1640.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSGetObjectNameAndInfo ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk1700.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSGetPartitionExtInfo ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk1781.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSGetPartitionExtInfoPtr ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk1830.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSGetPartitionInfo ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk1938.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSGetPartitionRoot ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2001.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSGetServerAddresses (obsolete 3/98) ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2021.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSGetServerAddresses2 ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2030.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSGetServerDN ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2039.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSGetServerName ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2047.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSGetSyntaxCount ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2056.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSGetSyntaxDef ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2065.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSGetSyntaxID ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2074.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSInitBuf ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2082.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSInspectEntry ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2091.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSJoinPartitions ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2099.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSList ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2108.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSListAttrsEffectiveRights ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2117.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSListByClassAndName ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2126.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSListContainableClasses ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2135.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSListContainers ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2144.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSListPartitions ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2153.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSListPartitionsExtInfo ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2162.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSLogin ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2171.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSLoginAsServer ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2180.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSLogout ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2187.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSMapIDToName ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2196.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSMapNameToID ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2205.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSModifyClassDef ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2214.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSModifyDN ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2223.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSModifyObject ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2232.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSModifyRDN ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2241.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSMoveObject ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2250.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSMutateObject ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/a37nkf6.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSOpenConnToNDSServer ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2259.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSOpenMonitoredConn ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2268.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSOpenStream ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2277.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSPartitionReceiveAllUpdates ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2285.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSPartitionSendAllUpdates ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2294.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSPutAttrName ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2303.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSPutAttrNameAndVal ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2312.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSPutAttrVal ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2321.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSPutChange ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2330.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSPutChangeAndVal ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2339.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSPutClassItem ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2348.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSPutClassName ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2357.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSPutFilter ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2364.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSPutSyntaxName ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2373.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSRead ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2380.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSReadAttrDef ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2389.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSReadClassDef ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2398.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSReadNDSInfo ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2407.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSReadObjectDSIInfo ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2416.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSReadObjectInfo ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2425.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSReadReferences ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2434.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSReadSyntaxDef ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2443.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSReadSyntaxes ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2451.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSReloadDS ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2459.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSRemoveAllTypes ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2467.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSRemoveAttrDef ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2475.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSRemoveClassDef ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2484.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSRemoveObject ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2493.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSRemovePartition ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2501.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSRemoveReplica ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2510.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSRemSecurityEquiv ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2519.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSRepairTimeStamps ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2528.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSReplaceAttrNameAbbrev ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2536.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSResolveName ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2544.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSRestoreObject ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2553.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSReturnBlockOfAvailableTrees ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2562.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSScanConnsForTrees ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2573.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSScanForAvailableTrees ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2582.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSSearch ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2591.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSSetContext ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2600.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSSetCurrentUser ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2609.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSSetDefNameContext ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2615.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSSetMonitoredConnection ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2624.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSSplitPartition ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2633.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSSyncPartition ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2642.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSSyncReplicaToServer ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2651.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSSyncSchema ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2660.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSUnlockConnection ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2669.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSVerifyObjectPassword ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2678.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSWhoAmI ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2687.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWGetDefaultNameContext ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2695.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWGetFileServerUTCTime ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2704.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWGetNumConnections ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2712.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWGetNWNetVersion ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2720.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWGetPreferredConnName ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2727.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWIsDSAuthenticated ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2736.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWIsDSServer ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2743.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWNetInit ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2750.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWNetTerm ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2759.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWSetDefaultNameContext ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2767.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWSetPreferredDSTree ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2776.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+if (currentLevel > 1) currentLevel--
+
+setLevels();
+var navElement = navigationLink("Structures ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/hqp7vveq.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+currentLevel++;
+
+setLevels();
+var navElement = navigationLink("Asn1ID_T ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2785.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Attr_Info_T ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2790.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Back_Link_T ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2795.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Bit_String_T ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2800.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Buf_T ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2805.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("CI_List_T ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2810.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Class_Info_T ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2815.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("EMail_Address_T ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2820.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Fax_Number_T ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2826.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Filter_Cursor_T ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2831.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Filter_Node_T ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2836.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Hold_T ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2841.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDSOSVersion_T ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2846.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDSStatsInfo_T ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2850.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Net_Address_T ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2855.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDS_TimeStamp_T ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2860.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Object_ACL_T ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2865.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Object_Info_T ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2870.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Octet_List_T ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2875.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Octet_String_T ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2880.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Path_T ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2885.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Replica_Pointer_T ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2890.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Syntax_Info_T ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2895.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("TimeStamp_T ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2900.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Typed_Name_T ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2906.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Unknown_Attr_T ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/sdk2911.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+if (currentLevel > 1) currentLevel--
+
+setLevels();
+var navElement = navigationLink("Values ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/hmmmal7s.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+currentLevel++;
+
+setLevels();
+var navElement = navigationLink("Attribute Constraint Flags ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/hudjk3k4.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Attribute Value Flags ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/h6anqw6h.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Buffer Operation Types and Related Functions ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/h8bn0lfm.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Class Flags ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/hpj620k3.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Change Types for Modifying Objects ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/hc4p686b.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Context Keys and Flags ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/h1btx3en.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Default Context Key Values ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/hlkcqs3t.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("DCK_FLAGS Bit Values ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/he1wcp92.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("DCK_NAME_FORM Values ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/hmd7uuiw.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("DCK_CONFIDENCE Bit Values ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/h7hy5yg3.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("DCK_DSI_FLAGS Values ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/huh0ri39.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("DSI_ENTRY_FLAGS Values ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/hqwiyl1u.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Filter Tokens ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/h487zxy3.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Information Types for Attribute Definitions ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/hdqx1cns.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Information Types for Class Definitions ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/hcq403ms.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Information Types for Search and Read ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/ha682lf8.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Name Space Types ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/hs6qj0yl.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDS Access Control Rights ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/h12s89uj.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDS Ping Flags ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/hf0fdqhd.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("DSP Replica Information Flags ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/hw42a7qg.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Network Address Types ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/hniuyp90.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Scope Flags ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/h6wfyyfk.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Replica Types ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/he290q86.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Replica States ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/h9br9yt1.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Syntax Matching Flags ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/hd8fn0rm.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Syntax IDs ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/hn1dsa7y.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+if (currentLevel > 1) currentLevel--
+
+setLevels();
+var navElement = navigationLink("NDS Example Code ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/hb05g04v.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+currentLevel++;
+
+setLevels();
+var navElement = navigationLink("Context Handle ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/a2sofgc.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Object and Attribute ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/a2snp6e.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Browsing and Searching ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/a2snu78.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Batch Modification of Objects and Attributes ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/a2snzot.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Schema ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/a2snqyd.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+if (currentLevel > 1) currentLevel--
+
+setLevels();
+var navElement = navigationLink("Revision History ","http://developer.novell.com/ndk/doc/ndslib/nds__enu/data/a5i29ah.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+if (currentLevel > 1) currentLevel--
+
+setLevels();
+var navElement = navigationLink("NDS Schema Reference ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/h4q1mn1i.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+currentLevel++;
+
+setLevels();
+var navElement = navigationLink("Schema Concepts ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/h282spjh.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+currentLevel++;
+
+setLevels();
+var navElement = navigationLink("Schema Structure ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/hpmkggmh.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Schema Components ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/hvt5bdoi.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Object Classes ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/hbna398k.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Naming Attributes ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/h9vf1k0r.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Containment Classes ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/hh1izaro.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Super Classes ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/hmdjysrx.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Object Class Flags ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/h6rvyaky.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Mandatory and Optional Attributes ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/h2vnta8j.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Default ACL Templates ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/hr9sm1l0.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Auxiliary Classes ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/hlh5m1af.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Attribute Type Definitions ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/hotadinr.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Attribute Syntax Definitions ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/h2m59phc.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Schema Extensions ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/he5mef3b.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+if (currentLevel > 1) currentLevel--
+
+setLevels();
+var navElement = navigationLink("Base Object Class Definitions ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/hmv2qd15.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+currentLevel++;
+
+setLevels();
+var navElement = navigationLink("AFP Server ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk75.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Alias ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk83.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("applicationEntity ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk91.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("applicationProcess ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk99.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Audit:File Object ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk107.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Bindery Object ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk115.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Bindery Queue ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk123.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("certificationAuthority ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk131.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("CommExec ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk139.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Computer ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk147.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Country ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk155.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("cRLDistributionPoint ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk163.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("dcObject ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk171.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Device ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk179.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Directory Map ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk187.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("domain ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk195.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("dSA ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk203.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("External Entity ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk219.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Group ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk227.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("LDAP Group ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a38rj6z.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("LDAP Server ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk243.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("List ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk251.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Locality ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk259.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("MASV:Security Policy ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk267.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Message Routing Group ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk275.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Messaging Server ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk283.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NCP Server ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk291.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("ndsLoginProperties ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk347.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDSPKI:Certificate Authority ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk355.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDSPKI:Key Material ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk363.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDSPKI:SD Key Access Partition ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a2okvd6.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDSPKI:SD Key List ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a2okvdx.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDSPKI:Trusted Root ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a2okvbk.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDSPKI:Trusted Root Object ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a2okvcf.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NSCP:groupOfCertificates ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk421.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NSCP:mailGroup1 ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk445.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NSCP:mailRecipient ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk466.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NSCP:NetscapeMailServer5 ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk474.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NSCP:NetscapeServer5 ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk482.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NSCP:nginfo3 ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk510.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NSCP:nsLicenseUser ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk518.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Organization ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk530.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Organizational Person ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk541.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Organizational Role ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk550.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Organizational Unit ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk561.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Partition ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk570.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Person ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk578.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("pkiCA ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk586.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("pkiUser ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk594.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Print Server ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk602.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Printer ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk610.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Profile ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk618.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Queue ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk626.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Resource ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk634.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("SAS:Security ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk642.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("SAS:Service ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk650.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Server ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk658.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("strongAuthenticationUser ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk698.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Template ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk706.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Top ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk714.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Tree Root ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk722.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Unknown ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk730.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("User ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk738.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("userSecurityInformation ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk746.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Volume ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk754.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("WANMAN:LAN Area ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk762.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+if (currentLevel > 1) currentLevel--
+
+setLevels();
+var navElement = navigationLink("Novell Object Class Extensions ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a3fh4x1.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+currentLevel++;
+
+setLevels();
+var navElement = navigationLink("Entrust:CRLDistributionPoint ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk211.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("inetOrgPerson ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk235.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDPS Broker ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk299.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDPS Manager ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk307.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDPS Printer ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk315.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDSCat:Catalog ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk323.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDSCat:Master Catalog ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk331.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDSCat:Slave Catalog ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk339.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NetSvc ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk379.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NLS:License Certificate ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk386.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NLS:License Server ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk394.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NLS:Product Container ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk412.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NSCP:groupOfUniqueNames5 ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk432.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NSCP:mailGroup5 ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk454.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NSCP:Nginfo ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk491.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NSCP:Nginfo2 ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk502.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("residentialPerson ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a3omhcl.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("SLP Scope Unit ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk666.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("SLP Directory Agent ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk674.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("SLP Service ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk682.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("SMS SMDR Class ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk690.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+if (currentLevel > 1) currentLevel--
+
+setLevels();
+var navElement = navigationLink("Graphical View of Object Class Inheritance ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/hzah4ydk.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+currentLevel++;
+
+setLevels();
+var navElement = navigationLink("Alias and Bindery Object Classes ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/hw8hr9jx.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Tree Root, domain, and Unknown ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/hu1mitlx.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Computer, Country, Device, and Printer ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/hnf7uif9.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("List and Locality ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/h48ynbap.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Organizational Role and Partition ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/hrfg9w4e.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("ndsLoginProperties, Organization, and Organizational Unit ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/hzvb48kg.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("ndsLoginProperties, Person, Organizational Person, and User ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/hknzjmiv.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Directory Map, Profile, Queues, Resource, and Volume ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/h8jovuwl.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Servers (AFP, Messaging, NCP, Print) and CommExec ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/ha47y85g.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("External Entity, Group, and Message Routing Group ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/hds3w6ie.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+if (currentLevel > 1) currentLevel--
+
+setLevels();
+var navElement = navigationLink("Base Attribute Definitions ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/hf9qbbni.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+currentLevel++;
+
+setLevels();
+var navElement = navigationLink("Aliased Object Name ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk782.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Account Balance ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk788.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("ACL ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk794.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Allow Unlimited Credit ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk800.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("associatedName ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a7bbra4.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("attributeCertificate ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk806.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Audit:A Encryption Key ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk812.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Audit:B Encryption Key ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk818.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Audit:Contents ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk824.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Audit:Current Encryption Key ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk830.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Audit:File Link ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk836.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Audit:Link List ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk842.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Audit:Path ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk848.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Audit:Policy ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk854.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Audit:Type ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk860.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("authorityRevocationList ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk866.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Authority Revocation ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk872.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("AuxClass Object Class Backup ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk878.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Auxiliary Class Flag ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk884.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Back Link ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk890.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Bindery Object Restriction ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk896.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Bindery Property ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk902.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Bindery Restriction Level ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk908.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Bindery Type ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk914.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("businessCategory ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk920.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink(" ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk932.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("cACertificate ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk938.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("CA Private Key ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk944.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("CA Public Key ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk950.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Cartridge ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk956.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("certificateRevocationList ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk962.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Certificate Revocation ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk968.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Certificate Validity Interval ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk974.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("crossCertificatePair ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk926.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink(" ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk986.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Convergence ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk998.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Cross Certificate Pair ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1004.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("dc ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1034.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Default Queue ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1040.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("deltaRevocationList ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1052.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("departmentNumber ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a3on5am.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Description ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1058.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("destinationIndicator ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1064.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Detect Intruder ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1070.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Device ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1076.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("dmdName ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1082.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("dn ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1088.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("dnQualifier ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1094.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("DS Revision ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1100.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("EMail Address ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1106.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("employeeType ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a3on9iy.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("enhancedSearchGuide ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1120.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Equivalent To Me ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1138.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("External Name ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1144.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("External Synchronizer ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1150.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Facsimile Telephone Number ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1156.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Full Name ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1162.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Generational Qualifier ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1168.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("generationQualifier ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1174.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink(" ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1180.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Given Name ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1186.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink(" ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1192.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("GUID ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1198.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("High Convergence Sync Interval ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1216.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Higher Privileges ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1222.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Home Directory ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1228.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Home Directory Rights ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1234.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("homePhone ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a3onbgn.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("homePostalAddress ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a3ondem.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("houseIdentifier ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1258.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Host Device ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1240.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Host Resource Name ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1246.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Host Server ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1252.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Inherited ACL ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1264.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Initials ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1270.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("internationaliSDNNumber ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1276.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Internet EMail Address ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1282.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Intruder Attempt Reset Interval ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1288.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Intruder Lockout Reset Interval ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1294.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("knowledgeInformation ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1312.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink(" ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1318.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Language ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1324.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Last Login Time ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1330.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Last Referenced Time ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1336.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("LDAP ACL v11 ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1342.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("LDAP Allow Clear Text Password ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1348.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("LDAP Anonymous Identity ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1354.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("LDAP Attribute Map v11 ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1360.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("LDAP Backup Log Filename ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1366.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("LDAP Class Map v11 ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1378.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("LDAP Enable SSL ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1384.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("LDAP Enable TCP ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1390.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("LDAP Enable UDP ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1396.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("LDAP Group ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1402.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("LDAP Host Server ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1408.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("LDAP Log Filename ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1414.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("LDAP Log Level ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1420.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("LDAP Log Size Limit ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1426.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("LDAP Referral ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1432.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("LDAP Screen Level ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1438.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("LDAP Search Size Limit ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1444.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("LDAP Search Time Limit ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1450.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("LDAP Server ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1456.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("LDAP Server Bind Limit ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1462.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("LDAP Server Idle Timeout ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1468.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("LDAP Server List ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1474.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("LDAP SSL Port ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1480.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("LDAP Suffix ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1486.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("LDAP TCP Port ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1492.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("LDAP UDP Port ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1498.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("LDAP:bindCatalog ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1516.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("LDAP:bindCatalogUsage ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1522.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("LDAP:keyMaterialName ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1546.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("LDAP:otherReferralUsage ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1552.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("LDAP:searchCatalog ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1558.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("LDAP:searchCatalogUsage ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1564.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("LDAP:searchReferralUsage ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1570.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Locked By Intruder ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1576.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Lockout After Detection ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1582.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Login Allowed Time Map ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1588.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Login Disabled ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1594.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Login Expiration Time ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1600.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Login Grace Limit ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1606.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Login Grace Remaining ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1612.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Login Intruder Address ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1618.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Login Intruder Attempts ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1624.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Login Intruder Limit ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1630.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Login Intruder Reset Time ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1636.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Login Maximum Simultaneous ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1642.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Login Script ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1648.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Login Time ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1654.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Low Convergence Reset Time ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1660.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Low Convergence Sync Interval ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1666.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Mailbox ID ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1672.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Mailbox Location ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1678.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("manager ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a3onljj.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("masvAuthorizedRange ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1684.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("masvDefaultRange ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1690.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("masvDomainPolicy ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1696.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("masvLabel ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1702.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("masvProposedLabel ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1708.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Member ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1726.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Members Of Template ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1732.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Memory ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1738.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Message Routing Group ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1744.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Message Server ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1750.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Messaging Database Location ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1756.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Messaging Server ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1762.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink(" ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1768.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Minimum Account Balance ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1786.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("mobile ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a3oojmc.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDSPKI:Certificate Chain ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4104.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDSPKI:Given Name ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4110.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDSPKI:Key File ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4116.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDSPKI:Key Material DN ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4122.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDSPKI:Keystore ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a2oknqe.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDSPKI:Not After ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a2oknpk.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDSPKI:Not Before ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a2oknpe.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDSPKI:Parent CA ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4128.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDSPKI:Parent CA DN ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4134.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDSPKI:Private Key ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4140.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDSPKI:Public Key ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4146.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDSPKI:Public Key Certificate ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4152.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDSPKI:SD Key Cert ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a2oknq2.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDSPKI:SD Key ID ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a2oknq8.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDSPKI:SD Key Server DN ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a2oknpq.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDSPKI:SD Key Struct ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a2oknpw.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDSPKI:Subject Name ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4158.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDSPKI:Tree CA DN ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4164.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDSPKI:Trusted Root Certificate ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a2oknp8.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDSPKI:userCertificateInfo ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a2oknp2.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Network Address ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4170.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Network Address Restriction ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4176.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("New Object's DS Rights ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4182.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("New Object's FS Rights ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4188.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("New Object's Self Rights ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4194.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NNS Domain ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4338.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Notify ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4374.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NSCP:administratorContactInfo ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4392.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NSCP:adminURL ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4398.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NSCP:AmailAccessDomain ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4404.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NSCP:AmailAlternateAddress ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4410.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NSCP:AmailAutoReplyMode ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4416.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NSCP:AmailAutoReplyText ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4422.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NSCP:AmailDeliveryOption ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4428.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NSCP:AmailForwardingAddress ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4434.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NSCP:AmailHost ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4440.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NSCP:AmailMessageStore ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4446.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NSCP:AmailProgramDeliveryInfo ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4452.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NSCP:AmailQuota ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4458.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NSCP:AnsLicenseEndTime ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4464.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NSCP:AnsLicensedFor ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4470.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NSCP:AnsLicenseStartTime ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4476.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NSCP:employeeNumber ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4482.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NSCP:installationTimeStamp ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4488.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NSCP:mailRoutingAddress ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a2ixy4e.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NSCP:memberCertificateDesc ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4554.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NSCP:mgrpRFC822mailmember ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4560.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NSCP:ngcomponentCIS ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4572.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NSCP:nsaclrole ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4578.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NSCP:nscreator ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4584.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NSCP:nsflags ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4590.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NSCP:nsnewsACL ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4614.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NSCP:nsprettyname ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4620.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NSCP:serverHostName ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4626.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NSCP:serverProductName ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4632.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NSCP:serverRoot ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4638.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NSCP:serverVersionNumber ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4644.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NSCP:subtreeACI ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4650.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink(" ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4656.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Obituary ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4662.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Obituary Notify ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4668.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Object Class ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4674.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Operator ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4680.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Other GUID ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4686.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink(" ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4692.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Owner ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4698.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Page Description Language ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4704.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("pager ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a3oojmj.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Partition Control ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4716.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Partition Creation Time ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4722.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Partition Status ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4728.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Password Allow Change ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4734.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Password Expiration Interval ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4740.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Password Expiration Time ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4746.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Password Management ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4752.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Password Minimum Length ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4758.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Password Required ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4764.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Password Unique Required ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4770.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Passwords Used ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4776.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Path ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4782.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Permanent Config Parms ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4788.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Physical Delivery Office Name ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4794.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Postal Address ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4800.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Postal Code ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4806.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Postal Office Box ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4812.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Postmaster ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4818.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("preferredDeliveryMethod ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4824.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("presentationAddress ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4830.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Print Job Configuration ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4848.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Print Server ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4854.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Printer ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4860.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Printer Configuration ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4872.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Printer Control ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4878.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Private Key ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4914.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Profile ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4920.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Profile Membership ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4926.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("protocolInformation ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4932.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Public Key ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4944.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Purge Vector ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4950.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Queue ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4956.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Queue Directory ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4962.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Received Up To ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4968.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Reference ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4974.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("registeredAddress ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4980.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Replica ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5010.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Replica Up To ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5016.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Resource ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5028.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Revision ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5064.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Role Occupant ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5070.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("roomNumber ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5076.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Run Setup Script ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5082.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink(" ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5088.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink(" ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5094.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("SAP Name ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5100.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("SAS:Security DN ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5106.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("SAS:Service DN ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5112.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("searchGuide ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5118.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("searchSizeLimit ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5124.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("searchTimeLimit ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5130.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Security Equals ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5136.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Security Flags ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5142.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("See Also ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5148.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Serial Number ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5154.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Server ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5160.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Server Holds ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5166.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Set Password After Create ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5172.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Setup Script ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5178.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Status ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5286.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("supportedAlgorithms ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5298.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("supportedApplicationContext ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5304.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Supported Connections ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5310.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Supported Gateway ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5316.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Supported Services ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5322.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Supported Typefaces ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5328.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Surname ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5334.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Synchronization Tolerance ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5358.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Synchronized Up To ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5364.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink(" ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5370.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Telephone Number ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5376.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("telexNumber ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5382.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("telexTerminalIdentifier ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5388.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Timezone ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5394.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Title ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5400.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Transitive Vector ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5406.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Trustees Of New Object ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5412.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Type Creator Map ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5418.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink(" ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5424.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("uniqueID ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5430.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Unknown ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5436.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Unknown Auxiliary Class ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5442.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Unknown Base Class ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5448.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Used By ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5454.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("User ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5460.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("userCertificate ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5466.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("userPassword ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a6m1fnz.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Uses ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5472.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Version ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5478.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Volume ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5484.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Volume Space Restrictions ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5490.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("WANMAN:Cost ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5496.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("WANMAN:Default Cost ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5502.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("WANMAN:LAN Area Membership ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5508.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("WANMAN:WAN Policy ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5514.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("x121Address ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5520.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("x500UniqueIdentifier ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5526.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+if (currentLevel > 1) currentLevel--
+
+setLevels();
+var navElement = navigationLink("Novell Attribute Extensions ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a3fh5xp.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+currentLevel++;
+
+setLevels();
+var navElement = navigationLink("audio ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a3omwno.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("carLicense ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a3on4e7.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Client Install Candidate ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk980.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Color Supported ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk992.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Database Dir Path ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1010.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Database Volume Name ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1016.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Datapool Location ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1022.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Datapool Locations ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1028.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Delivery Methods Installed ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1046.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("displayName ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a3oorbo.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Employee ID ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1114.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Entrust:AttributeCertificate ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1126.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Entrust:User ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1132.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("GW API Gateway Directory Path ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1204.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("GW API Gateway Directory Volume ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1210.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("IPP URI ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1300.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("IPP URI Security Scheme ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1306.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("jpegPhoto ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a3onfdu.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("labeledUri ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a3onkke.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("LDAP Class Map ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1372.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("ldapPhoto ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a3op8zp.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("LDAPUserCertificate ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1504.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("LDAP:ARL ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1510.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("LDAP:caCertificate ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1528.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("LDAP:CRL ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1534.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("LDAP:crossCertificatePair ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1540.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("MASV:Authorized Range ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a9j2co5.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("MASV:Default Range ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a9j2cob.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("MASV:Domain Policy ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a9j2coh.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("MASV:Label ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a9j2con.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("MASV:Proposed Label ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a9j2cot.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Maximum Speed ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1714.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Maximum Speed Units ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1720.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("MHS Send Directory Path ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1774.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("MHS Send Directory Volume ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1780.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDPS Accountant Role ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1792.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDPS Control Flags ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1798.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDPS Database Saved Timestamp ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1804.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDPS Database Saved Data Image ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1810.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDPS Database Saved Index Image ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1816.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDPS Default Printer ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1822.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDPS Default Public Printer ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1828.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDPS Job Configuration ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1834.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDPS Manager Status ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1840.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDPS Operator Role ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1846.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDPS Printer Install List ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1852.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDPS Printer Install Timestamp ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1858.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDPS Printer Queue List ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1864.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDPS Printer Siblings ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1870.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDPS Public Printer Install List ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1876.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDPS Replace All Client Printers ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1882.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDPS SMTP Server ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1888.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDPS User Role ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1894.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDSCat:Actual All Attributes ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1900.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDSCat:Actual Attribute Count ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1906.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDSCat:Actual Attributes ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1912.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDSCat:Actual Base Object ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1918.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDSCat:Actual Catalog Size ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1924.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDSCat:Actual End Time ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1930.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDSCat:Actual Filter ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1936.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDSCat:Actual Object Count ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1942.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDSCat:Actual Return Code ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1948.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDSCat:Actual Scope ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1954.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDSCat:Actual Search Aliases ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1960.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDSCat:Actual Start Time ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1966.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDSCat:Actual Value Count ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1972.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDSCat:All Attributes ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1978.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDSCat:AttrDefTbl ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1984.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDSCat:Attributes ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1990.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDSCat:Auto Dredge ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk1996.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDSCat:Base Object ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk2002.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDSCat:CatalogDB ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk2008.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDSCat:Catalog List ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk2014.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDSCat:Dredge Interval ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4008.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDSCat:Filter ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4014.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDSCat:IndexDefTbl ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4020.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDSCat:Indexes ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4026.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDSCat:Label ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4032.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDSCat:Log ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4038.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDSCat:Master Catalog ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4044.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDSCat:Max Log Size ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4050.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDSCat:Max Retries ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4056.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDSCat:Max Threads ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4062.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDSCat:Retry Interval ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4068.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDSCat:Scope ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4074.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDSCat:Search Aliases ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4080.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDSCat:Slave Catalog List ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4086.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDSCat:Start Time ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4092.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NDSCat:Synch Interval ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4098.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NLS:Common Certificate ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4200.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NLS:Current Installed ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4206.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NLS:Current Peak Installed ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4212.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NLS:Current Peak Used ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4218.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NLS:Current Used ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4224.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NLS:Hourly Data Size ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4230.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NLS:License Database ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4236.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NLS:License ID ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4242.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NLS:License Service Provider ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4248.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NLS:LSP Revision ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4254.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NLS:Owner ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4260.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NLS:Peak Installed Data ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4266.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NLS:Peak Used Data ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4272.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NLS:Product ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4278.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NLS:Publisher ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4284.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NLS:Revision ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4290.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NLS:Search Type ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4296.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NLS:Summary Update Time ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4302.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NLS:Summary Version ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4308.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NLS:Transaction Database ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4314.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NLS:Transaction Log Name ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4320.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NLS:Transaction Log Size ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4326.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NLS:Version ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4332.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Notification Consumers ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4344.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Notification Profile ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4350.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Notification Service Enabled ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4356.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Notification Srvc Net Addr ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4362.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Notification Srvc Net Address ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4368.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NRD:Registry Data ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4380.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NRD:Registry Index ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4386.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NSCP:mailAccessDomain ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4494.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NSCP:mailAlternateAddress ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4500.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NSCP:mailAutoReplyMode ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4506.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NSCP:mailAutoReplyText ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4512.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NSCP:mailDeliveryOption ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4518.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NSCP:mailForwardingAddress ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4524.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NSCP:mailHost ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4530.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NSCP:mailMessageStore ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4536.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NSCP:mailProgramDeliveryInfo ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4542.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NSCP:mailQuota ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4548.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NSCP:ngComponent ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4566.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NSCP:nsLicenseEndTime ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4596.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NSCP:nsLicensedFor ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4602.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NSCP:nsLicenseStartTime ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4608.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Page Description Languages ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4710.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("preferredLanguage ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a3oon3t.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Primary Notification Service ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4836.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Primary Resource Service ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4842.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Printer Agent Name ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4866.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Printer Manufacturer ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4884.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Printer Mechanism Types ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4890.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Printer Model ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4896.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Printer Status ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4902.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Printer to PA ID Mappings ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4908.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("PSM Name ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4938.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Registry Advertising Name ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4986.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Registry Service Enabled ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4992.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Registry Srvc Net Addr ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk4998.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Registry Srvc Net Address ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5004.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Resolution ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5022.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Resource Mgmt Srvc Net Addr ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5034.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Resource Mgmt Srvc Net Address ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5040.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Resource Mgmt Service Enabled ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5046.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Resource Mgr Database Path ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5052.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Resource Mgr Database Volume ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5058.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("secretary ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a3oon40.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Sides Supported ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5184.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("SLP Attribute ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5190.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("SLP Cache Limit ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5196.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("SLP DA Back Link ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5202.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("SLP Directory Agent DN ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5208.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("SLP Language ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5214.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("SLP Lifetime ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5220.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("SLP Scope Name ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5226.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("SLP Scope Unit DN ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5232.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("SLP Start Purge Hour ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5238.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("SLP Status ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5244.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("SLP SU Back Link ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5250.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("SLP SU Type ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5256.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("SLP Type ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5262.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("SLP URL ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5268.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("SMS Protocol Address ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5274.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("SMS Registered Service ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5280.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("SU ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5292.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("SvcInfo ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5340.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("SvcType ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5346.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("SvcTypeID ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5352.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("userSMIMECertificate ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a3oorbh.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+if (currentLevel > 1) currentLevel--
+
+setLevels();
+var navElement = navigationLink("LDAP Operational Attributes ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a7lnqjy.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+currentLevel++;
+
+setLevels();
+var navElement = navigationLink("createTimeStamp ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a6fur3q.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("creatorsName ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a6fur3f.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("entryFlags ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a6fuxcp.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("federationBoundary ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a6fzxsm.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("localEntryID ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a6fzcam.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("modifiersName ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a6fur3j.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("modifyTimeStamp ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a6fur3x.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("structuralObjectClass ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a6fuxcb.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("subordinateCount ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a6fuxci.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("subschemaSubentry ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a6fuxc4.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+if (currentLevel > 1) currentLevel--
+
+setLevels();
+var navElement = navigationLink("Attribute Syntax Definitions ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/h55cqjqs.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+currentLevel++;
+
+setLevels();
+var navElement = navigationLink("Back Link ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5533.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Boolean ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5540.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Case Exact String ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5547.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Case Ignore List ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5554.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Case Ignore String ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5561.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Class Name ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5568.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Counter ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5575.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Distinguished Name ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5582.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("EMail Address ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5589.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Facsimile Telephone Number ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5596.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Hold ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5603.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Integer ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5610.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Interval ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5617.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Net Address ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5624.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Numeric String ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5631.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Object ACL ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5638.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Octet List ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5645.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Octet String ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5652.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Path ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5659.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Postal Address ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5666.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Printable String ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5673.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Replica Pointer ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5680.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Stream ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5687.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Telephone Number ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5694.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Time ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5701.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Timestamp ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5708.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Typed Name ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5715.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Unknown ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5722.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+if (currentLevel > 1) currentLevel--
+
+setLevels();
+var navElement = navigationLink("Index of Classes ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx1.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+currentLevel++;
+
+setLevels();
+var navElement = navigationLink("A through B ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx2.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("C through D ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx3.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("E through K ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx4.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("L through M ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx5.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("N ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx6.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("O ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx7.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("P through R ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx8.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("S ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx9.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("T through Z ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx10.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+if (currentLevel > 1) currentLevel--
+
+setLevels();
+var navElement = navigationLink("Index of Attributes ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx11.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+currentLevel++;
+
+setLevels();
+var navElement = navigationLink("A ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx12.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("B ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx13.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("C ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx14.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("D ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx15.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("E ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx16.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("F through G ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx17.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("H ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx18.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("I through K ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx19.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("L ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx20.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("M ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx21.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("N ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx22.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("O ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx23.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("P ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx24.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Q ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx25.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("R ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx26.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("S ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx27.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("T ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx28.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("U ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx29.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("V through Z ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx30.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+if (currentLevel > 1) currentLevel--
+
+setLevels();
+var navElement = navigationLink("Index of ASN.1 IDs ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx31.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+currentLevel++;
+
+setLevels();
+var navElement = navigationLink("0 ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx32.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("1 ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx33.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("2 through 2.4 ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx34.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("2.5 through 2.9 ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx35.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+if (currentLevel > 1) currentLevel--
+
+setLevels();
+var navElement = navigationLink("Index of LDAP Names ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx36.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+currentLevel++;
+
+setLevels();
+var navElement = navigationLink("A through B ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx37.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("C ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx38.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("D ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx39.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("E through F ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx40.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("G ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx41.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("H ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx42.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("I through K ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx43.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("L ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx44.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("M ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx45.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("N ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx46.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("O ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx47.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("P ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx48.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Q through R ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx49.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("S ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx50.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("T ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx51.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("U through Z ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/schidx52.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+if (currentLevel > 1) currentLevel--
+
+setLevels();
+var navElement = navigationLink("Revision History ","http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/a5i29ah.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+if (currentLevel > 1) currentLevel--
+
+setLevels();
+var navElement = navigationLink("NDS Iterator Services ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/hnv8aaj7.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+currentLevel++;
+
+setLevels();
+var navElement = navigationLink("Concepts ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/hj3udfo7.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+currentLevel++;
+
+setLevels();
+var navElement = navigationLink("Iterator Objects ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/hwiuqovp.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Creation of an Iterator Object ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/hrb7xece.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Iterator Indexes ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/hqngpqag.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Positions of an Iterator Object ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/h25zhm0d.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Current Position Movement with Retrieval Functions ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/hn9jdbnd.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Retrieval of Data ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/hy7j1t07.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+if (currentLevel > 1) currentLevel--
+
+setLevels();
+var navElement = navigationLink("Tasks ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/huypg52u.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+currentLevel++;
+
+setLevels();
+var navElement = navigationLink("Creating a Search Iterator Object ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/hcyx2utx.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Retrieving and Unpacking Object and Attribute Name Data ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/h9evr0ru.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Retrieving and Unpacking Object, Attribute, and Value Data ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/htq89y7t.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+if (currentLevel > 1) currentLevel--
+
+setLevels();
+var navElement = navigationLink("Functions ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/h7qwv271.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+currentLevel++;
+
+setLevels();
+var navElement = navigationLink("NWDSItrAtEOF ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/sdk29.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSItrAtFirst ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/sdk36.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSItrClone ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/sdk43.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSItrCount ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/sdk50.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSItrCreateList ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/sdk57.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSItrCreateSearch ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/sdk64.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSItrDestroy ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/sdk71.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSItrGetCurrent ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/sdk77.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSItrGetInfo ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/sdk84.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSItrGetNext ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/sdk91.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSItrGetPosition ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/sdk98.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSItrGetPrev ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/sdk105.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSItrSetPosition ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/sdk112.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSItrSetPositionFromIterator ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/sdk119.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSItrSkip ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/sdk126.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("NWDSItrTypeDown ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/sdk133.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+if (currentLevel > 1) currentLevel--
+
+setLevels();
+var navElement = navigationLink("NDS Iterator Example Code ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/hw9m9u6o.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+currentLevel++;
+
+setLevels();
+var navElement = navigationLink("Cloning an Iterator Object: Example ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/hur66hmi.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Counting with NDS Iterators: Example ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/hgllfzfg.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Creating and Using a List Iterator: Example ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/hfnbz1tw.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Creating a Search Iterator and Displaying the Results: Example ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/hhe6xegc.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Getting Iterator Information: Example ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/hfg59w8k.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Getting and Setting the Iterator's Position: Example ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/hh03dp06.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Listing in Reverse Order: Example ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/hsj5zfs1.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Positioning the Iterator with Typedown: Example ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/hqvieqdk.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+setLevels();
+var navElement = navigationLink("Skipping Objects in the List: Example ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/ho81tg5d.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+if (currentLevel > 1) currentLevel--
+
+setLevels();
+var navElement = navigationLink("Revision History ","http://developer.novell.com/ndk/doc/ndslib/skds_enu/data/a5i29ah.html",currentLevel,index,levelIndexes[currentLevel],levelParents[currentLevel],"");
+navigationTree[index] = navElement;
+index++;
+
+if (currentLevel > 1) currentLevel--
+
+if (currentLevel > 1) currentLevel--
+
+
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-114491.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-114491.js
new file mode 100644
index 0000000..b4470ee
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-114491.js
@@ -0,0 +1,101 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2001
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): rokicki@instantis.com, pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 10 December 2001
+* SUMMARY: Regression test for bug 114491
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=114491
+*
+* Rhino crashed on this code. It should produce a syntax error, not a crash.
+* Using the () operator after a function STATEMENT is incorrect syntax.
+* Rhino correctly caught the error when there was no |if (true)|.
+* With the |if (true)|, however, Rhino crashed -
+*
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 114491;
+var summary = 'Regression test for bug 114491';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+status = inSection(1);
+actual = 'Program execution did NOT fall into catch-block';
+expect = 'Program execution fell into into catch-block';
+try
+{
+ var sEval = 'if (true) function f(){}()';
+ eval(sEval);
+}
+catch(e)
+{
+ actual = expect;
+}
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ for (var i = 0; i < UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-114493.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-114493.js
new file mode 100644
index 0000000..41e94b4
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-114493.js
@@ -0,0 +1,109 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2001
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): rokicki@instantis.com, pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 10 December 2001
+* SUMMARY: Regression test for bug 114493
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=114493
+*
+* Rhino crashed on this code. It should produce a syntax error, not a crash.
+* Note that "3"[5] === undefined, and Rhino correctly gave an error if you
+* tried to use the call operator on |undefined|:
+*
+* js> undefined();
+* js: TypeError: undefined is not a function.
+*
+* However, Rhino CRASHED if you tried to do "3"[5]().
+*
+* Rhino would NOT crash if you tried "3"[0]() or "3"[5]. Only array indices
+* that were out of bounds, followed by the call operator, would crash.
+*
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 114493;
+var summary = 'Regression test for bug 114493';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+var sEval = '';
+
+
+status = inSection(1);
+actual = 'Program execution did NOT fall into catch-block';
+expect = 'Program execution fell into into catch-block';
+try
+{
+ sEval = '"3"[5]()';
+ eval(sEval);
+}
+catch(e)
+{
+ actual = expect;
+}
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ for (var i = 0; i < UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-118849.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-118849.js
new file mode 100644
index 0000000..3d7b89a
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-118849.js
@@ -0,0 +1,181 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2001
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 08 Jan 2002
+* SUMMARY: Just testing that we don't crash on this code
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=118849
+*
+* http://developer.netscape.com:80/docs/manuals/js/core/jsref/function.htm
+* The Function constructor:
+* Function ([arg1[, arg2[, ... argN]],] functionBody)
+*
+* Parameters
+* arg1, arg2, ... argN
+* (Optional) Names to be used by the function as formal argument names.
+* Each must be a string that corresponds to a valid JavaScript identifier.
+*
+* functionBody
+* A string containing JS statements comprising the function definition.
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 118849;
+var summary = 'Should not crash if we provide Function() with bad arguments'
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+var cnFAIL_1 = 'LEGAL call to Function() caused an ERROR!!!';
+var cnFAIL_2 = 'ILLEGAL call to Function() FAILED to cause an error';
+var cnSTRING = 'ASDF';
+var cnNUMBER = 123;
+
+
+/***********************************************************/
+/**** THESE ARE LEGITMATE CALLS AND SHOULD ALL SUCCEED ***/
+/***********************************************************/
+status = inSection(1);
+actual = cnFAIL_1; // initialize to failure
+try
+{
+ Function(cnSTRING);
+ Function(cnNUMBER); // cnNUMBER is a valid functionBody
+ Function(cnSTRING,cnSTRING);
+ Function(cnSTRING,cnNUMBER);
+ Function(cnSTRING,cnSTRING,cnNUMBER);
+
+ new Function(cnSTRING);
+ new Function(cnNUMBER);
+ new Function(cnSTRING,cnSTRING);
+ new Function(cnSTRING,cnNUMBER);
+ new Function(cnSTRING,cnSTRING,cnNUMBER);
+
+ actual = expect;
+}
+catch(e)
+{
+}
+addThis();
+
+
+
+/**********************************************************/
+/*** EACH CASE THAT FOLLOWS SHOULD TRIGGER AN ERROR ***/
+/*** (BUT NOT A CRASH) ***/
+/*** NOTE WE NOW USE cnFAIL_2 INSTEAD OF cnFAIL_1 ***/
+/**********************************************************/
+status = inSection(2);
+actual = cnFAIL_2;
+try
+{
+ Function(cnNUMBER,cnNUMBER); // cnNUMBER is an invalid JS identifier name
+}
+catch(e)
+{
+ actual = expect;
+}
+addThis();
+
+
+status = inSection(3);
+actual = cnFAIL_2;
+try
+{
+ Function(cnNUMBER,cnSTRING,cnSTRING);
+}
+catch(e)
+{
+ actual = expect;
+}
+addThis();
+
+
+status = inSection(4);
+actual = cnFAIL_2;
+try
+{
+ new Function(cnNUMBER,cnNUMBER);
+}
+catch(e)
+{
+ actual = expect;
+}
+addThis();
+
+
+status = inSection(5);
+actual = cnFAIL_2;
+try
+{
+ new Function(cnNUMBER,cnSTRING,cnSTRING);
+}
+catch(e)
+{
+ actual = expect;
+}
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ for (var i = 0; i < UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-127557.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-127557.js
new file mode 100644
index 0000000..80b4e29
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-127557.js
@@ -0,0 +1,113 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2002
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): brendan@mozilla.org
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 06 Mar 2002
+* SUMMARY: Testing cloned function objects
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=127557
+*
+* Before this bug was fixed, this testcase would error when run:
+*
+* ReferenceError: h_peer is not defined
+*
+* The line |g.prototype = new Object| below is essential: this is
+* what was confusing the engine in its attempt to look up h_peer
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 127557;
+var summary = 'Testing cloned function objects';
+var cnCOMMA = ',';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+function f(x,y)
+{
+ function h()
+ {
+ return h_peer();
+ }
+ function h_peer()
+ {
+ return (x + cnCOMMA + y);
+ }
+ return h;
+}
+
+status = inSection(1);
+var g = clone(f);
+g.prototype = new Object;
+var h = g(5,6);
+actual = h();
+expect = '5,6';
+addThis();
+
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
+
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-131510-001.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-131510-001.js
new file mode 100644
index 0000000..aae857f
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-131510-001.js
@@ -0,0 +1,68 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2002
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 16 Mar 2002
+* SUMMARY: Shouldn't crash if define |var arguments| inside a function
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=131510
+*
+*/
+//-----------------------------------------------------------------------------
+var bug = 131510;
+var summary = "Shouldn't crash if define |var arguments| inside a function";
+printBugNumber(bug);
+printStatus(summary);
+
+
+function f() {var arguments;}
+f();
+
+
+/*
+ * Put same example in function scope instead of global scope
+ */
+function g() { function f() {var arguments;}; f();};
+g();
+
+
+/*
+ * Put these examples in eval scope
+ */
+var s = 'function f() {var arguments;}; f();';
+eval(s);
+
+s = 'function g() { function f() {var arguments;}; f();}; g();';
+eval(s);
+
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-140974.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-140974.js
new file mode 100644
index 0000000..a02408a
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-140974.js
@@ -0,0 +1,135 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2002
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): Martin.Honnen@t-online.de, pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 04 May 2002
+* SUMMARY: |if (false) {var x;} should create the variable x
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=140974
+*
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 140974;
+var TEST_PASSED = 'variable was created';
+var TEST_FAILED = 'variable was NOT created';
+var summary = '|if (false) {var x;}| should create the variable x';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+// -------------- THESE TWO SECTIONS TEST THE VARIABLE X --------------
+status = inSection(1);
+actual = TEST_PASSED;
+try{ X;} catch(e) {actual = TEST_FAILED}
+expect = TEST_PASSED;
+addThis();
+
+var X;
+
+status = inSection(2);
+actual = TEST_PASSED;
+try{ X;} catch(e) {actual = TEST_FAILED}
+expect = TEST_PASSED;
+addThis();
+
+
+
+// -------------- THESE TWO SECTIONS TEST THE VARIABLE Y --------------
+status = inSection(3);
+actual = TEST_PASSED;
+try{ Y;} catch(e) {actual = TEST_FAILED}
+expect = TEST_PASSED;
+addThis();
+
+if (false) {var Y;};
+
+status = inSection(4);
+actual = TEST_PASSED;
+try{ Y;} catch(e) {actual = TEST_FAILED}
+expect = TEST_PASSED;
+addThis();
+
+
+
+// -------------- THESE TWO SECTIONS TEST THE VARIABLE Z --------------
+status = inSection(5);
+actual = TEST_PASSED;
+try{ Z;} catch(e) {actual = TEST_FAILED}
+expect = TEST_PASSED;
+addThis();
+
+if (false) { for (var Z; false;){} }
+
+status = inSection(6);
+actual = TEST_PASSED;
+try{ Z;} catch(e) {actual = TEST_FAILED}
+expect = TEST_PASSED;
+addThis();
+
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-146596.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-146596.js
new file mode 100644
index 0000000..dee3700
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-146596.js
@@ -0,0 +1,154 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2002
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): jim-patterson@ncf.ca, brendan@mozilla.org,
+* pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 18 Jun 2002
+* SUMMARY: Shouldn't crash when catch parameter is "hidden" by varX
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=146596
+*
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 146596;
+var summary = "Shouldn't crash when catch parameter is 'hidden' by varX";
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+/*
+ * Just seeing we don't crash when executing this function -
+ * This example provided by jim-patterson@ncf.ca
+ *
+ * Brendan: "Jim, thanks for the testcase. But note that |var|
+ * in a JS function makes a function-scoped variable -- JS lacks
+ * block scope apart from for catch variables within catch blocks.
+ *
+ * Therefore the catch variable hides the function-local variable."
+ */
+function F()
+{
+ try
+ {
+ return "A simple exception";
+ }
+ catch(e)
+ {
+ var e = "Another exception";
+ }
+
+ return 'XYZ';
+}
+
+status = inSection(1);
+actual = F();
+expect = "A simple exception";
+addThis();
+
+
+
+/*
+ * Sanity check by Brendan: "This should output
+ *
+ * 24
+ * 42
+ * undefined
+ *
+ * and throw no uncaught exception."
+ *
+ */
+function f(obj)
+{
+ var res = [];
+
+ try
+ {
+ throw 42;
+ }
+ catch(e)
+ {
+ with(obj)
+ {
+ var e;
+ res[0] = e; // |with| binds tighter than |catch|; s/b |obj.e|
+ }
+
+ res[1] = e; // |catch| binds tighter than function scope; s/b 42
+ }
+
+ res[2] = e; // |var e| has function scope; s/b visible but contain |undefined|
+ return res;
+}
+
+status = inSection(2);
+actual = f({e:24});
+expect = [24, 42, undefined];
+addThis();
+
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual.toString();
+ expectedvalues[UBound] = expect.toString();
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-152646.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-152646.js
new file mode 100644
index 0000000..adb4374
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-152646.js
@@ -0,0 +1,121 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2002
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com, mstoltz@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 08 July 2002
+* SUMMARY: Testing expressions with large numbers of parentheses
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=152646
+*
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 152646;
+var summary = 'Testing expressions with large numbers of parentheses';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+/*
+ * Just seeing that we don't crash when compiling this assignment -
+ *
+ * We will form an eval string to set the result-variable |actual|.
+ * To get a feel for this, suppose N were 3. Then the eval string is
+ * 'actual = (((0)));' The expected value for this after eval() is 0.
+ */
+status = inSection(1);
+
+var sLeft = '((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((';
+sLeft += sLeft;
+sLeft += sLeft;
+sLeft += sLeft;
+sLeft += sLeft;
+sLeft += sLeft;
+
+var sRight = '))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))';
+sRight += sRight;
+sRight += sRight;
+sRight += sRight;
+sRight += sRight;
+
+var sEval = 'actual = ' + sLeft + '0' + sRight;
+try
+{
+ eval(sEval);
+}
+catch(e)
+{
+ /*
+ * An exception during this eval is OK, as the runtime can throw one
+ * in response to too deep recursion. We haven't crashed; good!
+ */
+ actual = 0;
+}
+expect = 0;
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-156354.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-156354.js
new file mode 100644
index 0000000..9dbd75f
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-156354.js
@@ -0,0 +1,126 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2002
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 16 September 2002
+* SUMMARY: Testing propertyIsEnumerable() on non-existent property
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=156354
+*
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 156354;
+var summary = 'Testing propertyIsEnumerable() on non-existent property';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+status = inSection(1);
+actual = this.propertyIsEnumerable('XYZ');
+expect = false;
+addThis();
+
+status = inSection(2);
+actual = this.propertyIsEnumerable('');
+expect = false;
+addThis();
+
+status = inSection(3);
+actual = this.propertyIsEnumerable(undefined);
+expect = false;
+addThis();
+
+status = inSection(4);
+actual = this.propertyIsEnumerable(null);
+expect = false;
+addThis();
+
+status = inSection(5);
+actual = this.propertyIsEnumerable('\u02b1');
+expect = false;
+addThis();
+
+
+var obj = {prop1:null};
+
+status = inSection(6);
+actual = obj.propertyIsEnumerable('prop1');
+expect = true;
+addThis();
+
+status = inSection(7);
+actual = obj.propertyIsEnumerable('prop2');
+expect = false;
+addThis();
+
+// let's try one via eval(), too -
+status = inSection(8);
+eval("actual = obj.propertyIsEnumerable('prop2')");
+expect = false;
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-159334.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-159334.js
new file mode 100644
index 0000000..c804d88
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-159334.js
@@ -0,0 +1,124 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2002
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): igor@icesoft.no, pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 31 Oct 2002
+* SUMMARY: Testing script with at least 64K of different string literals
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=159334
+*
+* Testing that script engine can handle scripts with at least 128K of different
+* string literals. The following will evaluate, via eval(), a script like this:
+*
+* f('0')
+* f('1')
+* ...
+* f('N - 1')
+*
+* where N is 0x20000
+*
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 159334;
+var summary = 'Testing script with at least 128K of different string literals';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+var N = 0x20000;
+
+// Create big string for eval recursively to avoid N*N behavior
+// on string concatenation
+var long_eval = buildEval_r(0, N);
+
+// Run it
+var test_sum = 0;
+function f(str) { test_sum += Number(str); }
+eval(long_eval);
+
+status = inSection(1);
+actual = (test_sum == N * (N - 1) / 2);
+expect = true;
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function buildEval_r(beginLine, endLine)
+{
+ var count = endLine - beginLine;
+
+ if (count == 0)
+ return "";
+
+ if (count == 1)
+ return "f('" + beginLine + "')\n";
+
+ var middle = beginLine + (count >>> 1);
+ return buildEval_r(beginLine, middle) + buildEval_r(middle, endLine);
+}
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-168347.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-168347.js
new file mode 100644
index 0000000..12fa16e
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-168347.js
@@ -0,0 +1,215 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2002
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): desale@netscape.com, pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 13 Sep 2002
+* SUMMARY: Testing F.toString()
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=168347
+*
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 168347;
+var summary = "Testing F.toString()";
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+var FtoString = '';
+var sFunc = '';
+
+sFunc += 'function F()';
+sFunc += '{';
+sFunc += ' var f = arguments.callee;';
+sFunc += ' f.i = 0;';
+sFunc += '';
+sFunc += ' try';
+sFunc += ' {';
+sFunc += ' f.i = f.i + 1;';
+sFunc += ' print("i = i+1 succeeded \ti = " + f.i);';
+sFunc += ' }';
+sFunc += ' catch(e)';
+sFunc += ' {';
+sFunc += ' print("i = i+1 failed with " + e + "\ti = " + f.i);';
+sFunc += ' }';
+sFunc += '';
+sFunc += ' try';
+sFunc += ' {';
+sFunc += ' ++f.i;';
+sFunc += ' print("++i succeeded \t\ti = " + f.i);';
+sFunc += ' }';
+sFunc += ' catch(e)';
+sFunc += ' {';
+sFunc += ' print("++i failed with " + e + "\ti = " + f.i);';
+sFunc += ' }';
+sFunc += '';
+sFunc += ' try';
+sFunc += ' {';
+sFunc += ' f.i++;';
+sFunc += ' print("i++ succeeded \t\ti = " + f.i);';
+sFunc += ' }';
+sFunc += ' catch(e)';
+sFunc += ' {';
+sFunc += ' print("i++ failed with " + e + "\ti = " + f.i);';
+sFunc += ' }';
+sFunc += '';
+sFunc += ' try';
+sFunc += ' {';
+sFunc += ' --f.i;';
+sFunc += ' print("--i succeeded \t\ti = " + f.i);';
+sFunc += ' }';
+sFunc += ' catch(e)';
+sFunc += ' {';
+sFunc += ' print("--i failed with " + e + "\ti = " + f.i);';
+sFunc += ' }';
+sFunc += '';
+sFunc += ' try';
+sFunc += ' {';
+sFunc += ' f.i--;';
+sFunc += ' print("i-- succeeded \t\ti = " + f.i);';
+sFunc += ' }';
+sFunc += ' catch(e)';
+sFunc += ' {';
+sFunc += ' print("i-- failed with " + e + "\ti = " + f.i);';
+sFunc += ' }';
+sFunc += '}';
+
+
+/*
+ * Use sFunc to define the function F. The test
+ * then rests on comparing F.toString() to sFunc.
+ */
+eval(sFunc);
+
+
+/*
+ * There are trivial whitespace differences between F.toString()
+ * and sFunc. So strip out whitespace before comparing them -
+ */
+sFunc = stripWhite(sFunc);
+FtoString = stripWhite(F.toString());
+
+
+/*
+ * Break comparison into sections to make any failures
+ * easier for the developer to track down -
+ */
+status = inSection(1);
+actual = FtoString.substring(0,100);
+expect = sFunc.substring(0,100);
+addThis();
+
+status = inSection(2);
+actual = FtoString.substring(100,200);
+expect = sFunc.substring(100,200);
+addThis();
+
+status = inSection(3);
+actual = FtoString.substring(200,300);
+expect = sFunc.substring(200,300);
+addThis();
+
+status = inSection(4);
+actual = FtoString.substring(300,400);
+expect = sFunc.substring(300,400);
+addThis();
+
+status = inSection(5);
+actual = FtoString.substring(400,500);
+expect = sFunc.substring(400,500);
+addThis();
+
+status = inSection(6);
+actual = FtoString.substring(500,600);
+expect = sFunc.substring(500,600);
+addThis();
+
+status = inSection(7);
+actual = FtoString.substring(600,700);
+expect = sFunc.substring(600,700);
+addThis();
+
+status = inSection(8);
+actual = FtoString.substring(700,800);
+expect = sFunc.substring(700,800);
+addThis();
+
+status = inSection(9);
+actual = FtoString.substring(800,900);
+expect = sFunc.substring(800,900);
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+/*
+ * Remove any whitespace characters; also
+ * any escaped tabs or escaped newlines.
+ */
+function stripWhite(str)
+{
+ var re = /\s|\\t|\\n/g;
+ return str.replace(re, '');
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-170193.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-170193.js
new file mode 100644
index 0000000..d5841bb
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-170193.js
@@ -0,0 +1,106 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2002
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): brendan@mozilla.org, pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 22 Sep 2002
+* SUMMARY: adding prop after middle-delete of function w duplicate formal args
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=170193
+*
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 170193;
+var summary = 'adding property after middle-delete of function w duplicate formal args';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+/*
+ * This sequence of steps used to cause the SpiderMonkey shell to hang -
+ */
+function f(a,a,b){}
+f.c=42;
+f.d=43;
+delete f.c; // "middle delete"
+f.e=44;
+
+status = inSection(1);
+actual = f.c;
+expect = undefined;
+addThis();
+
+status = inSection(2);
+actual = f.d;
+expect = 43;
+addThis();
+
+status = inSection(3);
+actual = f.e;
+expect = 44;
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-172699.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-172699.js
new file mode 100644
index 0000000..3a6be9f
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-172699.js
@@ -0,0 +1,94 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2002
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): rogerl@netscape.com, pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 07 Oct 2002
+* SUMMARY: UTF-8 decoder should not accept overlong sequences
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=172699
+*
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 172699;
+var summary = 'UTF-8 decoder should not accept overlong sequences';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+/*
+ * The patch for http://bugzilla.mozilla.org/show_bug.cgi?id=172699
+ * defined this value to be the result of an overlong UTF-8 sequence -
+ */
+var INVALID_CHAR = 0xFFFD;
+
+
+status = inSection(1);
+actual = decodeURI("%C0%AF").charCodeAt(0);
+expect = INVALID_CHAR;
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-179524.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-179524.js
new file mode 100644
index 0000000..31a7f30
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-179524.js
@@ -0,0 +1,363 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2002
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 11 Nov 2002
+* SUMMARY: JS shouldn't crash on extraneous args to str.match(), etc.
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=179524
+*
+* Note that when testing str.replace(), we have to be careful if the first
+* argument provided to str.replace() is not a regexp object. ECMA-262 says
+* it is NOT converted to one, unlike the case for str.match(), str.search().
+*
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=83293#c21. This means
+* we have to be careful how we test meta-characters in the first argument
+* to str.replace(), if that argument is a string -
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 179524;
+var summary = "Don't crash on extraneous arguments to str.match(), etc.";
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+str = 'ABC abc';
+var re = /z/ig;
+
+status = inSection(1);
+actual = str.match(re);
+expect = null;
+addThis();
+
+status = inSection(2);
+actual = str.match(re, 'i');
+expect = null;
+addThis();
+
+status = inSection(3);
+actual = str.match(re, 'g', '');
+expect = null;
+addThis();
+
+status = inSection(4);
+actual = str.match(re, 'z', new Object(), new Date());
+expect = null;
+addThis();
+
+
+/*
+ * Now try the same thing with str.search()
+ */
+status = inSection(5);
+actual = str.search(re);
+expect = -1;
+addThis();
+
+status = inSection(6);
+actual = str.search(re, 'i');
+expect = -1;
+addThis();
+
+status = inSection(7);
+actual = str.search(re, 'g', '');
+expect = -1;
+addThis();
+
+status = inSection(8);
+actual = str.search(re, 'z', new Object(), new Date());
+expect = -1;
+addThis();
+
+
+/*
+ * Now try the same thing with str.replace()
+ */
+status = inSection(9);
+actual = str.replace(re, 'Z');
+expect = str;
+addThis();
+
+status = inSection(10);
+actual = str.replace(re, 'Z', 'i');
+expect = str;
+addThis();
+
+status = inSection(11);
+actual = str.replace(re, 'Z', 'g', '');
+expect = str;
+addThis();
+
+status = inSection(12);
+actual = str.replace(re, 'Z', 'z', new Object(), new Date());
+expect = str;
+addThis();
+
+
+
+/*
+ * Now test the case where str.match()'s first argument is not a regexp object.
+ * In that case, JS follows ECMA-262 Ed.3 by converting the 1st argument to a
+ * regexp object using the argument as a regexp pattern, but then extends ECMA
+ * by taking any optional 2nd argument to be a regexp flag string (e.g.'ig').
+ *
+ * Reference: http://bugzilla.mozilla.org/show_bug.cgi?id=179524#c10
+ */
+status = inSection(13);
+actual = str.match('a').toString();
+expect = str.match(/a/).toString();
+addThis();
+
+status = inSection(14);
+actual = str.match('a', 'i').toString();
+expect = str.match(/a/i).toString();
+addThis();
+
+status = inSection(15);
+actual = str.match('a', 'ig').toString();
+expect = str.match(/a/ig).toString();
+addThis();
+
+status = inSection(16);
+actual = str.match('\\s', 'm').toString();
+expect = str.match(/\s/m).toString();
+addThis();
+
+
+/*
+ * Now try the previous three cases with extraneous parameters
+ */
+status = inSection(17);
+actual = str.match('a', 'i', 'g').toString();
+expect = str.match(/a/i).toString();
+addThis();
+
+status = inSection(18);
+actual = str.match('a', 'ig', new Object()).toString();
+expect = str.match(/a/ig).toString();
+addThis();
+
+status = inSection(19);
+actual = str.match('\\s', 'm', 999).toString();
+expect = str.match(/\s/m).toString();
+addThis();
+
+
+/*
+ * Try an invalid second parameter (i.e. an invalid regexp flag)
+ */
+status = inSection(20);
+try
+{
+ actual = str.match('a', 'z').toString();
+ expect = 'SHOULD HAVE FALLEN INTO CATCH-BLOCK!';
+ addThis();
+}
+catch (e)
+{
+ actual = e instanceof SyntaxError;
+ expect = true;
+ addThis();
+}
+
+
+
+/*
+ * Now test str.search() where the first argument is not a regexp object.
+ * The same considerations as above apply -
+ *
+ * Reference: http://bugzilla.mozilla.org/show_bug.cgi?id=179524#c16
+ */
+status = inSection(21);
+actual = str.search('a');
+expect = str.search(/a/);
+addThis();
+
+status = inSection(22);
+actual = str.search('a', 'i');
+expect = str.search(/a/i);
+addThis();
+
+status = inSection(23);
+actual = str.search('a', 'ig');
+expect = str.search(/a/ig);
+addThis();
+
+status = inSection(24);
+actual = str.search('\\s', 'm');
+expect = str.search(/\s/m);
+addThis();
+
+
+/*
+ * Now try the previous three cases with extraneous parameters
+ */
+status = inSection(25);
+actual = str.search('a', 'i', 'g');
+expect = str.search(/a/i);
+addThis();
+
+status = inSection(26);
+actual = str.search('a', 'ig', new Object());
+expect = str.search(/a/ig);
+addThis();
+
+status = inSection(27);
+actual = str.search('\\s', 'm', 999);
+expect = str.search(/\s/m);
+addThis();
+
+
+/*
+ * Try an invalid second parameter (i.e. an invalid regexp flag)
+ */
+status = inSection(28);
+try
+{
+ actual = str.search('a', 'z');
+ expect = 'SHOULD HAVE FALLEN INTO CATCH-BLOCK!';
+ addThis();
+}
+catch (e)
+{
+ actual = e instanceof SyntaxError;
+ expect = true;
+ addThis();
+}
+
+
+
+/*
+ * Now test str.replace() where the first argument is not a regexp object.
+ * The same considerations as above apply, EXCEPT for meta-characters.
+ * See introduction to testcase above. References:
+ *
+ * http://bugzilla.mozilla.org/show_bug.cgi?id=179524#c16
+ * http://bugzilla.mozilla.org/show_bug.cgi?id=83293#c21
+ */
+status = inSection(29);
+actual = str.replace('a', 'Z');
+expect = str.replace(/a/, 'Z');
+addThis();
+
+status = inSection(30);
+actual = str.replace('a', 'Z', 'i');
+expect = str.replace(/a/i, 'Z');
+addThis();
+
+status = inSection(31);
+actual = str.replace('a', 'Z', 'ig');
+expect = str.replace(/a/ig, 'Z');
+addThis();
+
+status = inSection(32);
+actual = str.replace('\\s', 'Z', 'm'); //<--- NO!!! No meta-characters 1st arg!
+actual = str.replace(' ', 'Z', 'm'); //<--- Have to do this instead
+expect = str.replace(/\s/m, 'Z');
+addThis();
+
+
+/*
+ * Now try the previous three cases with extraneous parameters
+ */
+status = inSection(33);
+actual = str.replace('a', 'Z', 'i', 'g');
+expect = str.replace(/a/i, 'Z');
+addThis();
+
+status = inSection(34);
+actual = str.replace('a', 'Z', 'ig', new Object());
+expect = str.replace(/a/ig, 'Z');
+addThis();
+
+status = inSection(35);
+actual = str.replace('\\s', 'Z', 'm', 999); //<--- NO meta-characters 1st arg!
+actual = str.replace(' ', 'Z', 'm', 999); //<--- Have to do this instead
+expect = str.replace(/\s/m, 'Z');
+addThis();
+
+
+/*
+ * Try an invalid third parameter (i.e. an invalid regexp flag)
+ */
+status = inSection(36);
+try
+{
+ actual = str.replace('a', 'Z', 'z');
+ expect = 'SHOULD HAVE FALLEN INTO CATCH-BLOCK!';
+ addThis();
+}
+catch (e)
+{
+ actual = e instanceof SyntaxError;
+ expect = true;
+ addThis();
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-185165.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-185165.js
new file mode 100644
index 0000000..69e0e8d
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-185165.js
@@ -0,0 +1,96 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2002
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): igor@icesoft.no, pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 13 Dec 2002
+* SUMMARY: Decompilation of "\\" should give "\\"
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=185165
+*
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 185165;
+var summary = 'Decompilation of "\\\\" should give "\\\\"';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+// Check that second decompilation of script gives the same string as first one
+var f1 = function() { return "\\"; }
+var s1 = f1.toString();
+
+var f2;
+eval("f2=" + s1);
+var s2 = f2.toString();
+
+status = inSection(1);
+actual = s2;
+expect = s1;
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-191633.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-191633.js
new file mode 100644
index 0000000..19f7906
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-191633.js
@@ -0,0 +1,102 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2003
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): igor@icesoft.no, pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 03 February 2003
+* SUMMARY: Testing script with huge number of comments
+*
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=191633
+*
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 191633;
+var summary = 'Testing script with huge number of comments';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+status = inSection(1);
+actual = false; // initialize to failure
+var s = repeat_str("//\n", 40000); // Build a string of 40000 lines of comments
+eval(s + "actual = true;");
+expect = true;
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function repeat_str(str, repeat_count)
+{
+ var arr = new Array(repeat_count);
+
+ while (repeat_count != 0)
+ arr[--repeat_count] = str;
+
+ return str.concat.apply(str, arr);
+}
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-191668.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-191668.js
new file mode 100644
index 0000000..ff1498c
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-191668.js
@@ -0,0 +1,99 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2003
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): igor@icesoft.no, pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 03 February 2003
+* SUMMARY: Testing script containing <!- at internal buffer boundary.
+* JS parser must look for HTML comment-opener <!--, but mustn't disallow <!-
+*
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=191668
+*
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 191668;
+var summary = 'Testing script containing <!- at internal buffer boundary';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+var N = 512;
+var j = 0;
+var str = 'if (0<!-0) ++j;';
+
+for (var i=0; i!=N; ++i)
+{
+ eval(str);
+ str = ' ' + str;
+}
+
+status = inSection(1);
+actual = j;
+expect = N;
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-192414.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-192414.js
new file mode 100644
index 0000000..0b9e1ce
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-192414.js
@@ -0,0 +1,117 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2003
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): igor@icesoft.com, pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 08 February 2003
+* SUMMARY: Parser recursion should check stack overflow
+*
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=192414
+*
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 192414;
+var summary = 'Parser recursion should check stack overflow';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+/*
+ * We will form an eval string to set the result-variable |actual|.
+ * To get a feel for this, suppose N were 3. Then the eval string is
+ * 'actual = (1&(1&(1&1)));' The expected value after eval() is 1.
+ */
+status = inSection(1);
+var N = 10000;
+var left = repeat_str('(1&', N);
+var right = repeat_str(')', N);
+var str = 'actual = '.concat(left, '1', right, ';');
+try
+{
+ eval(str);
+}
+catch (e)
+{
+ /*
+ * An exception during this eval is OK, as the runtime can throw one
+ * in response to too deep recursion. We haven't crashed; good!
+ */
+ actual = 1;
+}
+expect = 1;
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function repeat_str(str, repeat_count)
+{
+ var arr = new Array(--repeat_count);
+ while (repeat_count != 0)
+ arr[--repeat_count] = str;
+ return str.concat.apply(str, arr);
+}
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-192465.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-192465.js
new file mode 100644
index 0000000..188d225
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-192465.js
@@ -0,0 +1,152 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2003
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): igor@icesoft.com, pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 10 February 2003
+* SUMMARY: Object.toSource() recursion should check stack overflow
+*
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=192465
+*
+* MODIFIED: 27 February 2003
+*
+* We are adding an early return to this testcase, since it is causing
+* big problems on Linux RedHat8! For a discussion of this issue, see
+* http://bugzilla.mozilla.org/show_bug.cgi?id=174341#c24 and following.
+*
+*
+* MODIFIED: 20 March 2003
+*
+* Removed the early return and changed |N| below from 1000 to 90.
+* Note |make_deep_nest(N)| returns an object graph of length N(N+1).
+* So the graph has now been reduced from 1,001,000 to 8190.
+*
+* With this reduction, the bug still manifests on my WinNT and Linux
+* boxes (crash due to stack overflow). So the testcase is again of use
+* on those boxes. At the same time, Linux RedHat8 boxes can now run
+* the test in a reasonable amount of time.
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 192465;
+var summary = 'Object.toSource() recursion should check stack overflow';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+/*
+ * We're just testing that this script will compile and run.
+ * Set both |actual| and |expect| to a dummy value.
+ */
+status = inSection(1);
+var N = 90;
+try
+{
+ make_deep_nest(N);
+}
+catch (e)
+{
+ // An exception is OK, as the runtime can throw one in response to too deep
+ // recursion. We haven't crashed; good! Continue on to set the dummy values -
+}
+actual = 1;
+expect = 1;
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+/*
+ * EXAMPLE:
+ *
+ * If the global variable |N| is 2, then for |level| == 0, 1, 2, the return
+ * value of this function will be toSource() of these objects, respectively:
+ *
+ * {next:{next:END}}
+ * {next:{next:{next:{next:END}}}}
+ * {next:{next:{next:{next:{next:{next:END}}}}}}
+ *
+ */
+function make_deep_nest(level)
+{
+ var head = {};
+ var cursor = head;
+
+ for (var i=0; i!=N; ++i)
+ {
+ cursor.next = {};
+ cursor = cursor.next;
+ }
+
+ cursor.toSource = function()
+ {
+ if (level != 0)
+ return make_deep_nest(level - 1);
+ return "END";
+ }
+
+ return head.toSource();
+}
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-193418.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-193418.js
new file mode 100644
index 0000000..47110bb
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-193418.js
@@ -0,0 +1,99 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2003
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): igor@icesoft.no, pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 17 February 2003
+* SUMMARY: Testing empty blocks
+*
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=193418
+*
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 193418;
+var summary = 'Testing empty blocks';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+function f()
+{
+ while (0)
+ {
+ { }
+ }
+ actual = true;
+}
+
+
+status = inSection(1);
+f(); // sets |actual|
+expect = true;
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-203402.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-203402.js
new file mode 100644
index 0000000..d668201
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-203402.js
@@ -0,0 +1,90 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2003
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): igor@fastmail.fm, pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 28 April 2003
+* SUMMARY: Testing the ternary query operator
+*
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=203402
+*
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 203402;
+var summary = 'Testing the ternary query operator';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+// This used to crash the Rhino optimized shell -
+status = inSection(1);
+actual = "" + (1==0) ? "" : "";
+expect = "";
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-203841.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-203841.js
new file mode 100644
index 0000000..af35bdb
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-203841.js
@@ -0,0 +1,159 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2003
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): briang@tonic.com, igor@fastmail.fm, pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 29 April 2003
+* SUMMARY: Testing merged if-clauses
+*
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=203841
+*
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 203841;
+var summary = 'Testing merged if-clauses';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+status = inSection(1);
+var a = 0;
+var b = 0;
+var c = 0;
+if (a == 5, b == 6) { c = 1; }
+actual = c;
+expect = 0;
+addThis();
+
+status = inSection(2);
+a = 5;
+b = 0;
+c = 0;
+if (a == 5, b == 6) { c = 1; }
+actual = c;
+expect = 0;
+addThis();
+
+status = inSection(3);
+a = 5;
+b = 6;
+c = 0;
+if (a == 5, b == 6) { c = 1; }
+actual = c;
+expect = 1;
+addThis();
+
+/*
+ * Now get tricky and use the = operator inside the if-clause
+ */
+status = inSection(4);
+a = 0;
+b = 6;
+c = 0;
+if (a = 5, b == 6) { c = 1; }
+actual = c;
+expect = 1;
+addThis();
+
+status = inSection(5);
+c = 0;
+if (1, 1 == 6) { c = 1; }
+actual = c;
+expect = 0;
+addThis();
+
+
+/*
+ * Now some tests involving arrays
+ */
+var x=[];
+
+status = inSection(6); // get element case
+c = 0;
+if (x[1==2]) { c = 1; }
+actual = c;
+expect = 0;
+addThis();
+
+status = inSection(7); // set element case
+c = 0;
+if (x[1==2]=1) { c = 1; }
+actual = c;
+expect = 1;
+addThis();
+
+status = inSection(8); // delete element case
+c = 0;
+if (delete x[1==2]) { c = 1; }
+actual = c;
+expect = 1;
+addThis();
+
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-204210.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-204210.js
new file mode 100644
index 0000000..fae19b3
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-204210.js
@@ -0,0 +1,143 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2003
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): briang@tonic.com, igor@fastmail.fm, pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 29 April 2003
+* SUMMARY: eval() is not a constructor, but don't crash on |new eval();|
+*
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=204210
+*
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 204210;
+var summary = "eval() is not a constructor, but don't crash on |new eval();|";
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+printBugNumber(bug);
+printStatus(summary);
+
+/*
+ * Just testing that we don't crash on any of these constructs -
+ */
+
+
+/*
+ * global scope -
+ */
+try
+{
+ var x = new eval();
+ new eval();
+}
+catch(e)
+{
+}
+
+
+/*
+ * function scope -
+ */
+f();
+function f()
+{
+ try
+ {
+ var x = new eval();
+ new eval();
+ }
+ catch(e)
+ {
+ }
+}
+
+
+/*
+ * eval scope -
+ */
+var s = '';
+s += 'try';
+s += '{';
+s += ' var x = new eval();';
+s += ' new eval();';
+s += '}';
+s += 'catch(e)';
+s += '{';
+s += '}';
+eval(s);
+
+
+/*
+ * some combinations of scope -
+ */
+s = '';
+s += 'function g()';
+s += '{';
+s += ' try';
+s += ' {';
+s += ' var x = new eval();';
+s += ' new eval();';
+s += ' }';
+s += ' catch(e)';
+s += ' {';
+s += ' }';
+s += '}';
+s += 'g();';
+eval(s);
+
+
+function h()
+{
+ var s = '';
+ s += 'function f()';
+ s += '{';
+ s += ' try';
+ s += ' {';
+ s += ' var x = new eval();';
+ s += ' new eval();';
+ s += ' }';
+ s += ' catch(e)';
+ s += ' {';
+ s += ' }';
+ s += '}';
+ s += 'f();';
+ eval(s);
+}
+h();
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-210682.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-210682.js
new file mode 100644
index 0000000..8b915e2
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-210682.js
@@ -0,0 +1,96 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2003
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): briang@tonic.com, pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 02 July 2003
+* SUMMARY: testing line ending with |continue| and only terminated by a CR
+*
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=210682
+*
+*
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 210682;
+var summary = 'testing line ending with |continue| and only terminated by CR';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+for (i=0; i<100; i++)
+{
+ if (i%2 == 0) continue
+ this.lasti = i;
+}
+
+status = inSection(1);
+actual = lasti;
+expect = 99;
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-216320.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-216320.js
new file mode 100644
index 0000000..e555754
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-216320.js
@@ -0,0 +1,1033 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2003
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): brendan@mozilla.org, pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 09 September 2003
+* SUMMARY: Just seeing we don't crash on this code
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=216320
+*
+*/
+//-----------------------------------------------------------------------------
+var bug = 216320;
+var summary = "Just seeing we don't crash on this code";
+
+printBugNumber(bug);
+printStatus(summary);
+
+
+/* TESTCASE BEGINS HERE */
+status=0;
+ism='NO';
+scf='N';
+
+function vol(){
+if(navigator.appName!="Netscape"){ if(!window.navigator.onLine){ alert(pbc0430); return false; } }
+return true; }
+
+function vnid(formfield){
+nid=formfield.value;
+if(!nid.match(/^\s*$/)){
+nl=nid.split('/').length;
+if(nl!=2&&nl!=3){
+alert(pbc0420);
+formfield.focus();
+return false;
+}}}
+
+function vnull(formfield){
+text=formfield.value;
+if(text.match(/^\s*$/)){
+alert(pbc0425);
+formfield.focus();
+return false;
+}
+return true;
+}
+
+function vdt(formfield){
+date=formfield.value;
+//MM/DD/YYYY
+//YYYY/MM/DD
+year=date.substring(0,4);
+hy1=date.charAt(4);
+month=date.substring(5,7);
+hy2=date.charAt(7);
+day=date.substring(8,10);
+today=new Date();
+tdy=today.getDate();
+tmn=today.getMonth()+1;
+if(today.getYear()<2000)tyr=today.getYear()+1900;
+else tyr=today.getYear();
+if(date.match(/^\s*$/)) {return true; }
+
+if(hy1!="/"||hy2!="/"){
+alert(pbc0409);
+formfield.focus();
+return false;
+}
+if(month>12||day>31||month<=0||day<=0||(isNaN(month)==true)||(isNaN(day)==true)||(isNaN(year)==true)){
+alert(pbc0409);
+formfield.focus();
+return false;
+}
+
+if(((month==1||month==3||month==5||month==7||month==8||month==10||month==12)&&day>31)||(year%4==0&&month==2&&day>29)||(year%4!=0&&month==2&&day>28)||((month==4||month==6||month==9||month==11)&&day>30)){
+alert(pbc0409);
+formfield.focus();
+return false;
+}
+return true;
+}
+
+function vkdt(formfield){
+date=formfield.value;
+year=date.substring(0,4);
+hy1=date.charAt(4);
+month=date.substring(5,7);
+hy2=date.charAt(7);
+day=date.substring(8,10);
+today=new Date();
+tdy=today.getDate();
+tmn=today.getMonth()+1;
+if(today.getYear()<2000)tyr=today.getYear()+1900;
+else tyr=today.getYear();
+if(date.match(/^\s*$/)){
+alert(pbc0425);
+formfield.focus();
+return false;
+}
+if(hy1!="/"||hy2!="/"){
+alert(pbc0409);
+formfield.focus();
+return false;
+}
+
+if(month>12||day>31||month<=0||day<=0||(isNaN(month)==true)||(isNaN(day)==true)||(isNaN(year)==true)){
+alert(pbc0409);
+formfield.focus();
+return false;
+}
+
+if(((month==1||month==3||month==5||month==7||month==8||month==10||month==12)&&day>31)||(year%4==0&&month==2&&day>29)||(year%4!=0&&month==2&&day>28)||((month==4||month==6||month==9||month==11)&&day>30)){
+alert(pbc0409);
+formfield.focus();
+return false;
+}
+return true;
+}
+
+function ddif(month1,day1,year1,month2,day2,year2){
+start = new Date();
+start.setYear(year1);
+start.setMonth(month1-1);
+start.setDate(day1);
+start.setMinutes(0);
+start.setHours(0);
+start.setSeconds(0);
+end = new Date();
+end.setYear(year2);
+end.setMonth(month2-1);
+end.setDate(day2);
+end.setMinutes(0);
+end.setHours(0);
+end.setSeconds(0);
+current =(end.getTime() - start.getTime());
+days = Math.floor(current /(1000 * 60 * 60 * 24));
+return(days);
+}
+
+function vsub(form,status,ism,action){
+if(!vol()){ return false; }
+if(status<9||status==12){
+band=form.BAND.options[form.BAND.selectedIndex].value;
+if(band=="00"){
+alert(pbc0425);
+form.BAND.focus();
+return false;
+}
+}
+
+if((status>=0&&status<5)||(status==7)||(status>=5&&status<9&&ism=="YES")||(status==12&&ism=="YES")){
+if(!vnull(form.PT)) { return false; }
+adt1=form.STD;
+adt2=form.END;
+stdt=adt1.value;
+etdt=adt2.value;
+syr=stdt.substring(0,4);
+start_hy1=stdt.charAt(4);
+smon=stdt.substring(5,7);
+start_hy2=stdt.charAt(7);
+sdy=stdt.substring(8,10);
+eyr=etdt.substring(0,4);
+end_hy1=etdt.charAt(4);
+emon=etdt.substring(5,7);
+end_hy2=etdt.charAt(7);
+edy=etdt.substring(8,10);
+today=new Date();
+date=today.getDate();
+month=today.getMonth()+1;
+if(today.getYear()<2000)year=today.getYear()+1900; else year=today.getYear();
+nextYear=year+1;
+if(!vnull(form.STD)){ return false; }
+if(!vnull(form.END)){ return false; }
+if(start_hy1!="/"||start_hy2!="/"){
+alert(pbc0409);
+form.STD.focus();
+return false;
+}
+if(end_hy1!="/"||end_hy2!="/"){
+alert(pbc0409);
+form.END.focus();
+return false;
+}
+if(smon>12||sdy>31||smon<=0||sdy<=0||(isNaN(smon)==true)||(isNaN(sdy)==true)||(isNaN(syr)==true)){
+alert(pbc0409);
+form.STD.focus();
+return false;
+}
+if(emon>12||edy>31||emon<=0||edy<=0||(isNaN(emon)==true)||(isNaN(edy)==true)||(isNaN(eyr)==true)){
+alert(pbc0409);
+form.END.focus();
+return false;
+}
+if(((smon==1||smon==3||smon==5||smon==7||smon==8||smon==10||smon==12)&&sdy>31)||(syr%4==0&&smon==2&&sdy>29)||(syr%4!=0&&smon==2&&sdy>28)||((smon==4||smon==6||smon==9||smon==11)&&sdy>30)){
+alert(pbc0409);
+form.STD.focus();
+return false;
+}
+if(((emon==1||emon==3||emon==5||emon==7||emon==8||emon==10||emon==12)&&edy>31)||(eyr%4==0&&emon==2&&edy>29)||(eyr%4!=0&&emon==2&&edy>28)||((emon==4||emon==6||emon==9||emon==11)&&edy>30)){
+alert(pbc0409);
+form.END.focus();
+return false;
+}
+if ((eyr==nextYear)&&(syr==year)) {
+if ((emon>1)||(edy >31)) {
+alert(pbc0401);
+form.END.focus();
+return false;
+}
+} else {
+
+if ((syr!=eyr)){
+alert(pbc0406);
+form.STD.focus();
+return false;
+}
+if(smon>emon||(smon==emon&&sdy>=edy)){
+alert(pbc0402);
+form.STD.focus();
+return false;
+}
+if((eyr!=year)&&(eyr!=year-1)){
+alert(pbc0405);
+form.END.focus();
+return false;
+}
+}
+if(ism=='YES'&&(status==5||status==6||status==12)){
+if(ddif(month,date,year,emon,edy,eyr)>31){
+alert(pbc0421);
+form.END.focus();
+return false;
+}
+}
+if((status>2&&status<5)||(status==7)||((status>=5&&status<9||status==12)&&ism=="YES")){
+if(status!=5){
+if(!vdt(form.IRD1)){
+return false;
+}
+if(!vdt(form.IRD2)){
+return false;
+}
+if(!vdt(form.IRD3)){
+return false;
+}
+ird1=form.IRD1.value;
+ird2=form.IRD2.value;
+ird3=form.IRD3.value;
+if(((ird1==ird2)&&(!ird1.match(/^\s*$/)))||((ird1==ird3)&&(!ird1.match(/^\s*$/)))){
+alert(pbc0417);
+form.IRD1.focus();
+return false;
+}
+else if((ird2==ird3)&&(!ird2.match(/^\s*$/))){
+alert(pbc0417);
+form.IRD2.focus();
+return false;
+}
+if(!vdt(form.FRD1)){ return false;}
+}
+if(status==5){
+if(!vdt(form.IRD1)){return false;}
+if(!vdt(form.IRD2)){return false;}
+if(!vdt(form.IRD3)){return false;}
+ird1=form.IRD1.value;
+ird2=form.IRD2.value;
+ird3=form.IRD3.value;
+if(((ird1==ird2)&&(!ird1.match(/^\s*$/)))||((ird1==ird3)&&(!ird1.match(/^\s*$/)))){
+alert(pbc0417);
+form.IRD1.focus();
+return false;
+}
+else if((ird2==ird3)&&(!ird2.match(/^\s*$/))){
+alert(pbc0417);
+form.IRD2.focus();
+return false;
+}
+if(!vkdt(form.FRD1)){
+return false;
+}
+}
+}
+}
+if((status>=0&&status<2)||(status==3)||(status==7)||(status>=2&&status<9&&ism=="YES")||(status==12&&ism=="YES")){
+if(!vnull(form.WO)){
+return false;
+}
+if(!vnull(form.EO)){
+return false;
+}
+if(!vnull(form.TO)){
+return false;
+}
+}
+if((status==2||status==4)||(status>=5&&status<9&&ism=="YES")||(status==12&&ism=="YES")){
+if(!vnull(form.WR)){return false;}
+if(!vnull(form.ER)){return false;}
+if(!vnull(form.TR)){return false;}
+}
+if((status==5||status==6||status==12)&&ism=="YES"){
+if(!vkdt(form.FRD1)){return false;}
+frdt=form.FRD1.value;
+fryr=frdt.substring(0,4);
+frmn=frdt.substring(5,7);
+frdy=frdt.substring(8,10);
+if(fryr<syr||(fryr==syr&&frmn<smon)||(fryr==syr&&frmn==smon&&frdy<=sdy)){
+alert(pbc0410);
+form.FRD1.focus();
+return false;
+}
+if((status==5||status==6||status==12)&&ism=="YES"){
+isnh="";
+for(i=0; i<form.INH.length; i++){
+if(form.INH[i].checked==true){ isnh=form.INH[i].value; }
+}
+if(isnh==""){
+alert(pbc0424);
+form.INH[1].focus();
+return false;
+}
+if(isnh=="Y"){
+beh="";
+for(i=0; i<form.NHB.length; i++){
+if(form.NHB[i].checked==true){ beh=form.NHB[i].value; }
+}
+skl="";
+for(i=0; i<form.NHS.length; i++){
+if(form.NHS[i].checked==true){ skl=form.NHS[i].value; }
+}
+if(beh==""){
+alert(pbc0408);
+form.NHB[0].focus();
+return false;
+}
+if(skl==""){
+alert(pbc0426);
+form.NHS[0].focus();
+return false;
+}
+if((beh=="N"||skl=="N")&&status!=12){
+if(form.RCD[3].checked==false){
+if(confirm(pbc0455))srdb(form.RCD,"4");
+else {
+form.NHB[0].focus();
+return false;
+}}}}}
+rating="";
+if(status!=12){ for(i=0; i<form.RCD.length; i++){ if(form.RCD[i].checked==true)rating=form.RCD[i].value; } }
+else if(status==12){ rating="4"; }
+if(rating==""){
+alert(pbc0428);
+form.RCD[0].focus();
+return false;
+}
+if(rating=="4"){
+if(!vkdt(form.SID)){ return false; }
+idt=form.SID.value;
+iyr=idt.substring(0,4);
+imon=idt.substring(5,7);
+idy=idt.substring(8,10);
+frdt=form.FRD1.value;
+fryr=frdt.substring(0,4);
+frmn=frdt.substring(5,7);
+frdy=frdt.substring(8,10);
+if(iyr<eyr||(iyr==eyr&&imon<emon)||(iyr==eyr&&imon==emon&&idy<=edy)){
+alert(pbc0415);
+form.SID.focus();
+return false;
+}
+if(iyr<fryr||(iyr==fryr&&imon<frmn)||(iyr==fryr&&imon==frmn&&idy<=frdy)){
+alert(pbc0427);
+form.SID.focus();
+return false;
+}
+if(ddif(emon,edy,eyr,imon,idy,iyr)<30){
+alert(pbc0416);
+form.SID.focus();
+return false;
+}
+if(ddif(emon,edy,eyr,imon,idy,iyr)>90){
+if(!confirm(pbc0439+" "+pbc0442)){
+form.SID.focus();
+return false;
+}}} else {
+// MK/06-20-01 = If Rating Not equals to 4 blank out the sustained improve Date
+form.SID.value="";
+}
+if(!vnull(form.OAT)){ return false; }
+if(form.MSRQ.checked==true){
+if(form.NEW_SIGN_MGR_ID.value.match(/^\s*$/)){
+alert(pbc0418);
+form.NEW_SIGN_MGR_ID.focus();
+return false;
+}
+if(vnid(form.NEW_SIGN_MGR_ID)==false){ return false; }
+} else {
+if(!form.NEW_SIGN_MGR_ID.value.match(/^\s*$/)){
+alert(pbc0422);
+form.NEW_SIGN_MGR_ID.focus();
+return false;
+}
+if ( (form.TOC.value=="YES") && (form.RSRQ.checked==true) ) {
+alert(pbc0429);
+form.NEW_SEC_LINE_REV_ID.focus();
+return false;
+}
+}
+if(form.RSRQ.checked==true){
+if(form.NEW_SEC_LINE_REV_ID.value.match(/^\s*$/)){
+alert(pbc0418);
+form.NEW_SEC_LINE_REV_ID.focus();
+return false;
+}
+if(vnid(form.NEW_SEC_LINE_REV_ID)==false){ return false; }
+} else {
+if(!form.NEW_SEC_LINE_REV_ID.value.match(/^\s*$/)) {
+alert(pbc0423);
+form.NEW_SEC_LINE_REV_ID.focus();
+return false;
+}
+if ( (form.TOC.value=="YES") && (form.MSRQ.checked==true) ) {
+alert(pbc0431);
+form.NEW_SEC_LINE_REV_ID.focus();
+return false;
+}}}
+if(status!=9){
+/**for returned objectives **/
+if(status==3){
+if(conf(pbc0466) == false) return false;
+}
+
+if(ism=='NO'){
+if(status==0||status==1||status==3||status==7){
+if(conf(pbc0456) == false) return false;
+}
+
+if(status==2||status==4||status==8){
+if(conf(pbc0457) == false) return false;
+}
+} else if(ism=='YES'){
+if(status==0||status==1||status==3||status==7){
+if(conf(pbc0458) == false)return false;
+}
+if(status==2||status==4||status==8){
+if(conf(pbc0459) == false)return false;
+}
+if(status==5||status==6){
+if(form.ESRQ.checked==false){
+if(conf(pbc0460) == false)return false;
+} else {
+if(conf(pbc0461) == false)return false;
+}}}}
+if(status==9){
+if(ism=='NO'){
+if(conf(pbc0462) == false)return false;
+} else if(ism=='YES'){
+if(conf(pbc0463) == false)return false;
+} else if(ism=='REVIEWER'){
+if(conf(pbc0464) == false)return false;
+}}
+sact(action);
+if(status>=9&&status<=11){ snul(); }
+form.submit();
+return true;
+}
+
+function vsav(form,status,ism,action) {
+if(!vol()){ return false; }
+adt1=form.STD;
+adt2=form.END;
+stdt=adt1.value;
+etdt=adt2.value;
+syr=stdt.substring(0,4);
+start_hy1=stdt.charAt(4);
+smon=stdt.substring(5,7);
+start_hy2=stdt.charAt(7);
+sdy=stdt.substring(8,10);
+eyr=etdt.substring(0,4);
+end_hy1=etdt.charAt(4);
+emon=etdt.substring(5,7);
+end_hy2=etdt.charAt(7);
+edy=etdt.substring(8,10);
+today=new Date();
+date=today.getDate();
+month=today.getMonth()+1;
+if(today.getYear()<2000) year=today.getYear()+1900; else year=today.getYear();
+nextYear=year+1;
+if(!vnull(form.STD)) return false;
+if(!vnull(form.END)) return false;
+if(start_hy1!="/"||start_hy2!="/"){
+alert(pbc0409);
+form.STD.focus();
+return false;
+}
+if(end_hy1!="/"||end_hy2!="/"){
+alert(pbc0409);
+form.END.focus();
+return false;
+}
+if(smon>12||sdy>31||smon<=0||sdy<=0||(isNaN(smon)==true)||(isNaN(sdy)==true)||(isNaN(syr)==true)){
+alert(pbc0409);
+form.STD.focus();
+return false;
+}
+if(emon>12||edy>31||emon<=0||edy<=0||(isNaN(emon)==true)||(isNaN(edy)==true)||(isNaN(eyr)==true)){
+alert(pbc0409);
+form.END.focus();
+return false;
+}
+if(((smon==1||smon==3||smon==5||smon==7||smon==8||smon==10||smon==12)&&sdy>31)||(syr%4==0&&smon==2&&sdy>29)||(syr%4!=0&&smon==2&&sdy>28)||((smon==4||smon==6||smon==9||smon==11)&&sdy>30)){
+alert(pbc0409);
+form.STD.focus();
+return false;
+}
+if(((emon==1||emon==3||emon==5||emon==7||emon==8||emon==10||emon==12)&&edy>31)||(eyr%4==0&&emon==2&&edy>29)||(eyr%4!=0&&emon==2&&edy>28)||((emon==4||emon==6||emon==9||emon==11)&&edy>30)){
+alert(pbc0409);
+form.END.focus();
+return false;
+}
+if ((eyr==nextYear)&&(syr==year)) {
+if ((emon>1)||(edy >31)) {
+alert(pbc0401);
+form.END.focus();
+return false;
+}
+} else {
+if ((syr<year-1) || (syr>year)) {
+alert(pbc0407);
+form.STD.focus();
+return false;
+}
+if((eyr!=year)&&(eyr!=year-1)){
+alert(pbc0405);
+form.END.focus();
+return false;
+}
+if(smon>emon||(smon==emon&&sdy>=edy)){
+alert(pbc0403);
+form.STD.focus();
+return false;
+}
+}
+if((status>2&&status<5)||(status>=5&&status<9&&ism=="YES")||(status==12&&ism=="YES")){
+if(!vdt(form.IRD1)){return false;}
+if(!vdt(form.IRD2)){return false;}
+if(!vdt(form.IRD3)){ return false; }
+ird1=form.IRD1.value;
+ird2=form.IRD2.value;
+ird3=form.IRD3.value;
+if(((ird1==ird2)&&(!ird1.match(/^\s*$/)))||((ird1==ird3)&&(!ird1.match(/^\s*$/)))){
+alert(pbc0417);
+form.IRD1.focus();
+return false;
+}
+else if((ird2==ird3)&&(!ird2.match(/^\s*$/))){
+alert(pbc0417);
+form.IRD2.focus();
+return false;
+}
+if(!vdt(form.FRD1)){return false;}
+if(ism=="YES"){
+if(!vdt(form.FRD1)){return false;}
+}
+}
+if((status==5||status==6)&&ism=="YES"){
+rating="";
+for(i=0;i<form.RCD.length;i++){
+if(form.RCD[i].checked==true)rating=form.RCD[i].value;
+}
+isnh="";
+for(i=0; i<form.INH.length; i++){
+if(form.INH[i].checked==true){
+isnh=form.INH[i].value;
+}
+}
+if(isnh=="Y"){
+beh="";
+for(i=0; i<form.NHB.length;i++){
+if(form.NHB[i].checked==true){
+beh=form.NHB[i].value;
+}
+}
+skl="";
+for(i=0; i<form.NHS.length;i++){
+if(form.NHS[i].checked==true){
+skl=form.NHS[i].value;
+}
+}
+if((beh=="N"||skl=="N")&&rating!=""){
+if(form.RCD[3].checked==false){
+if(confirm(pbc0455))srdb(form.RCD,"4");
+else {
+form.NHB[0].focus();
+return false;
+}
+}
+}
+if(!vdt(form.SID)){ return false;}
+}
+}
+if((status==2||status==4 || status==8 || status==5 || status==6 || status==10)&&ism=='YES')
+{
+if(!confirm(pbc0436)){ return false;}
+if(form.OBJECTIVE_CHANGED.value=='Y') {
+ if(confirm(pbc0452+" "+pbc0453+" "+pbc0454)){form.MRQ.value=4; } else { form.MRQ.value=0; }
+}else if (( status==5 || status==6 || status==10) && (form.RESULTS_CHANGED.value=='Y')) {
+ if(confirm(pbc0470+" "+pbc0453+" "+pbc0454)){form.MRQ.value=8; } else { form.MRQ.value=0; }
+}
+}
+sact(action);
+if(status>=9&&status<=11){
+snul();
+}
+form.submit();
+return true;
+}
+function cft(formfield){
+nid=formfield.value;
+if(nid.match(/^\s*$/)){
+alert(pbc0419);
+formfield.focus();
+return false;
+}
+nl=nid.split('/').length;
+if(nl!=2&&nl!=3){
+alert(pbc0420);
+formfield.focus();
+return false;
+}
+return true;
+}
+function dcf(form,pbcId,cnum,sequence,status,atyp,ver){
+if(!vol()){}
+dflg=confirm("\n\n<====================== " + pbc0468 + " ======================>\n\n" + pbc0469 + "\n\n<==================================================================>");
+if(dflg==true) {
+form.ATYP.value=atyp;
+form.PID.value=pbcId;
+form.CNUM.value=cnum;
+form.SEQ.value=sequence;
+form.ST.value=status;
+form.VER.value=ver;
+form.submit();
+}
+
+}
+
+
+
+function lop(){
+//if(confirm(pbc0447+" "+pbc0451)){
+sck("timer","");
+sck("PBC_AUTH4","");
+sck("IBM004","");
+this.close();
+//}
+
+}
+
+function csrlop(){
+ top.location="logoff.jsp";
+}
+function lof(){
+csr=gck("IBM004");
+if(csr==null){ top.location="logoff.jsp"; }
+else if(csr.charAt(0)==3){ window.location="csrlogoff.jsp"; }
+else{ top.location="logoff.jsp"; }
+}
+
+function goToHome(){
+ top.location="pbcmain.jsp";
+ }
+
+function docsr(){
+sck("IBM004","1^NONE^1");
+window.location="pbcmain.jsp"
+}
+
+function ccd(){
+if(confirm(pbc0434)){
+if(navigator.appName!="Netscape"){
+if(!window.navigator.onLine){
+window.close();
+}
+else {
+window.location='pbcmain.jsp';
+}
+}
+else {
+window.location='pbcmain.jsp';
+}
+}
+}
+
+function crt(form,action){
+if(!vol()){return false;}
+band=form.BAND.options[form.BAND.selectedIndex].value;
+if(band=="00"){
+alert(pbc0425);
+form.BAND.focus();
+return false;
+}
+if(!confirm(pbc0450)){return false;}
+sact(action);
+form.submit();
+return true;
+}
+function cusat(form,action){
+if(!vol()){return false;}
+sact(action);
+form.action="unsatreq.jsp";
+form.submit();
+return true;
+}
+function cfrt(form,ism,action){
+if(!vol()){return false;}
+sact(action);
+if(ism=="NO"){
+if(confirm(pbc0449+" "+pbc0432)){
+snul();
+form.submit();
+return true;
+}
+}
+if(ism=="REVIEWER"){
+if(confirm(pbc0449+" "+pbc0448)){
+snul();
+form.submit();
+return true;
+}
+}
+if(ism=="YES"){
+if(confirm(pbc0440)){
+snul();
+form.submit();
+return true;
+}
+}
+}
+
+function cces(form){
+if(form.ESRQ.checked==true){
+if(!confirm(pbc0435+" "+pbc0443))form.ESRQ.checked=false;
+else {form.ESRQ.checked=true;}
+}
+}
+
+function ccms(form){
+if(form.MSRQ.checked==true){
+if(!confirm(pbc0441+" "+pbc0438+" "+pbc0444+" "+pbc0445))form.MSRQ.checked=false;
+else {
+form.MSRQ.checked=true;
+}
+}
+}
+
+function ccrs(form){
+if(form.RSRQ.checked==true){
+if(!confirm(pbc0441+" "+pbc0438+" "+pbc0444+" "+pbc0446))form.RSRQ.checked=false;
+else {
+form.RSRQ.checked=true;
+}
+}
+}
+
+function seo(){
+alert(pbc0412+" "+pbc0413+" "+pbc0414);
+}
+function cows(form,action){
+if(!vol()){
+return false;
+}
+if(confirm(pbc0437)){
+sact(action);
+form.submit();
+return true;
+}
+}
+
+function srdb(rdb,value) {
+for(i=0; i<rdb.length;i++) {
+if(rdb[i].value == value) {
+rdb[i].checked = true;
+return true;
+}
+}
+return true;
+}
+
+function slop(lbx,value) {
+if(lbx.options.length > 0) {
+for(i=0;i < lbx.options.length;i++) {
+if(lbx.options[i].value == value) {
+lbx.options[i].selected = true;
+return true;
+}
+}
+}
+return true;
+}
+
+function ourl(URL,WIN_NAME){
+if(!vol()){ return; }
+var emp_win;
+if(document.layers) {
+child_screenX=window.screenX+50;
+child_width=window.innerWidth-75;
+child_height=window.innerHeight-75;
+emp_win=window.open(URL,WIN_NAME,"screenX="+ child_screenX +",screenY=75,height="+ child_height +",width="+ child_width +",resizable,status,scrollbars");
+} else{
+child_width = screen.width-160;
+child_height = screen.height-200;
+emp_win=window.open(URL,WIN_NAME,"height="+ child_height +",width="+ child_width +",resizable=yes,status=no,scrollbars=yes");
+//emp_win.moveTo(110,0);
+}
+//if (URL.indexOf("pbcsitehelp")==-1) { alert("Opened new window."); }
+emp_win.focus();
+}
+
+function dnh(form){
+form.NHS[0].checked=false;
+form.NHS[1].checked=false;
+form.NHB[0].checked=false;
+form.NHB[1].checked=false;
+}
+
+function cnh(form){
+isnh="";
+for(i=0; i<form.INH.length;i++)
+{
+if(form.INH[i].checked==true){isnh=form.INH[i].value; }
+}
+if(isnh != 'Y'){
+form.NHS[0].checked=false;
+form.NHS[1].checked=false;
+form.NHB[0].checked=false;
+form.NHB[1].checked=false;
+return false;
+}
+else
+{
+ //if ((form.NHS[0].checked || form.NHS[1].checked) && (form.NHB[0].checked || form.NHB[1].checked))
+ if (form.NHS[1].checked || form.NHB[1].checked )
+ {
+ form.RCD[3].checked=true;
+ return true;
+ }
+ return false;
+}
+}
+
+function err(errMsg) {
+alert(getEncodedText(errMsg));
+}
+
+function getEncodedText(txtValue) {
+if (txtValue.match(/^\s*$/)) return txtValue;
+var txtValue1 = txtValue.replace((/&quot;/g),'"');
+var txtValue2 = txtValue1.replace((/&gt;/g),">");
+var txtValue3 = txtValue2.replace((/&lt;/g),"<");
+return txtValue3;
+}
+
+function encodeText(txtValue) {
+if (txtValue.match(/^\s*$/)) return txtValue;
+var txtValue0 = txtValue.replace((/\r\n/g),'&lf;');
+var txtValue1 = txtValue0.replace((/"/g),'&quot;');
+var txtValue2 = txtValue1.replace((/>/g),'&gt;');
+var txtValue3 = txtValue2.replace((/</g),'&lt;');
+return txtValue3;
+}
+
+
+function gck(name){
+result = null;
+mck = " " + document.cookie + ";";
+srcnm = " " + name + "=";
+scok = mck.indexOf(srcnm);
+if(scok != -1){
+scok += srcnm.length;
+eofck = mck.indexOf(";",scok);
+result = unescape(mck.substring(scok,eofck));
+}
+return(result);
+}
+
+function sck(name,value){
+ckpth="path=/;domain=.ibm.com";
+document.cookie = name + "=" + value + ";" + ckpth;
+}
+
+
+function testForCookie(){
+ sck("PBCTest","test");
+ if(gck("PBCTest") == "test") {
+ // alert("Cookie test is good");
+ return true;
+ }
+ else {
+ // alert("Cookie test is bad");
+ return false;
+ }
+ }
+
+
+function prn(form,l_status,l_ism,l_scf,l_locale){
+status = l_status;
+ism = l_ism;
+scf = l_scf;
+pwin=window.open("printvw.jsp?nls="+l_locale + "ISNEWWIN=TRUE","pwin","resizable=yes,width=560,height=400,scrollbars=yes,toolbar,screenX=5,screenY=5");
+}
+
+function gsno(form){
+unum=form.UNUM.value;
+eofsn=unum.length-3;
+cnum=unum.substring(0,eofsn);
+return(cnum);
+}
+
+function conf(msg){
+return top.confirm(msg);
+}
+
+function sact(action){
+document.PBC_FORM.ATYP.value=action;
+}
+
+function snul(){
+document.PBC_FORM.WO.value="";
+document.PBC_FORM.WR.value="";
+document.PBC_FORM.EO.value="";
+document.PBC_FORM.ER.value="";
+document.PBC_FORM.TO.value="";
+document.PBC_FORM.TR.value="";
+document.PBC_FORM.OAT.value="";
+}
+
+function gcnum(){
+unum=document.PBC_FORM.UNUM.value;
+eofsn=unum.length-3;
+cnum=unum.substring(0,eofsn);
+return(cnum);
+}
+function checkForEditPage() {
+ if(true==checkForm()){
+ if(!confirm(pbc0465)) return false;
+ }
+ return true;
+}
+
+function checkForm() {
+ var frms=document.forms["PBC_FORM"];
+ if (navigator.appName=="Netscape") {
+ if (frms==undefined) return false;
+ if (frms.IS_EDIT==undefined) return false;
+ } else {
+ if(frms==null) return false;
+ if (frms.IS_EDIT==null) return false;
+ }
+ return true;
+}
+
+
+
+function removeAnchor(link){
+link2 = link;
+indx = link.indexOf('#');
+while (indx!=-1)
+{
+link2 = link.substring(0,indx);
+indx=link2.indexOf("#");
+
+
+}
+return link2;
+}
+
+function gotoHREF(link){
+if(document.layers){
+var documentURL = removeAnchor(document.URL);
+location.href=documentURL+link;
+return true;
+
+}else{
+var documentURL = removeAnchor(document.URL);
+document.URL=documentURL+link;
+
+
+}
+
+
+}
+
+function init_resize_event(){
+}
+
+function putVal2ck()
+{
+}
+
+function setValuesFromCookie()
+{
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-31255.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-31255.js
new file mode 100644
index 0000000..e978553
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-31255.js
@@ -0,0 +1,108 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2002
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): igor@icesoft.no, pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 09 November 2002
+* SUMMARY: JS should treat --> as a single-line comment indicator.
+* Whitespace may occur before the --> on the same line.
+*
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=31255
+* and http://bugzilla.mozilla.org/show_bug.cgi?id=179366 (Rhino version)
+*
+* Note: <!--, --> are the HTML multi-line comment opener, closer.
+* JS already accepted <!-- as a single-line comment indicator.
+*
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 31255;
+var summary = 'JS should treat --> as a single-line comment indicator';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+<!-- HTML comment start is already a single-line JS comment indicator
+var x = 1; <!-- until end-of-line
+
+status = inSection(1);
+actual = (x == 1);
+expect = true;
+addThis();
+
+--> HTML comment end is JS comments until end-of-line
+ --> but only if it follows a possible whitespace after line start
+ --> so in the following --> should not be treated as comments
+if (x-->0)
+ x = 2;
+
+status = inSection(2);
+actual = (x == 2);
+expect = true;
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-39309.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-39309.js
new file mode 100644
index 0000000..9c51ce8
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-39309.js
@@ -0,0 +1,105 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2003
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 30 Sep 2003
+* SUMMARY: Testing concatenation of string + number
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=39309
+*
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 39309;
+var summary = 'Testing concatenation of string + number';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+function f(textProp, len)
+{
+ var i = 0;
+ while (++i <= len)
+ {
+ var name = textProp + i;
+ actual = name;
+ }
+}
+
+
+status = inSection(1);
+f('text', 1); // sets |actual|
+expect = 'text1';
+addThis();
+
+status = inSection(2);
+f('text', 100); // sets |actual|
+expect = 'text100';
+addThis();
+
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-44009.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-44009.js
new file mode 100644
index 0000000..51dde84
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-44009.js
@@ -0,0 +1,63 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS
+* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+* implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation. All
+* Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+* Date: 26 Feb 2001
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=44009
+*
+* SUMMARY: Testing that we don't crash on obj.toSource()
+*/
+//-------------------------------------------------------------------------------------------------
+var bug = 44009;
+var summary = "Testing that we don't crash on obj.toSource()";
+var obj1 = {};
+var sToSource = '';
+var self = this; //capture a reference to the global JS object -
+
+
+
+//-------------------------------------------------------------------------------------------------
+test();
+//-------------------------------------------------------------------------------------------------
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ var obj2 = {};
+
+ // test various objects and scopes -
+ testThis(self);
+ testThis(this);
+ testThis(obj1);
+ testThis(obj2);
+
+ exitFunc ('test');
+}
+
+
+// We're just testing that we don't crash by doing this -
+function testThis(obj)
+{
+ sToSource = obj.toSource();
+ obj.prop = obj;
+ sToSource = obj.toSource();
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-57043.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-57043.js
new file mode 100644
index 0000000..39136a9
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-57043.js
@@ -0,0 +1,88 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS
+* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+* implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation. All
+* Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+* Date: 03 December 2000
+*
+*
+* SUMMARY: This test arose from Bugzilla bug 57043:
+* "Negative integers as object properties: strange behavior!"
+*
+* We check that object properties may be indexed by signed
+* numeric literals, as in assignments like obj[-1] = 'Hello'
+*
+* NOTE: it should not matter whether we provide the literal with
+* quotes around it or not; e.g. these should be equivalent:
+*
+* obj[-1] = 'Hello'
+* obj['-1'] = 'Hello'
+*/
+//-------------------------------------------------------------------------------------------------
+var bug = 57043;
+var summary = 'Indexing object properties by signed numerical literals -'
+var statprefix = 'Adding a property to test object with an index of ';
+var statsuffix = ', testing it now -';
+var propprefix = 'This is property ';
+var obj = new Object();
+var status = ''; var actual = ''; var expect = ''; var value = '';
+
+
+// various indices to try -
+var index = Array(-5000, -507, -3, -2, -1, 0, 1, 2, 3);
+
+
+//-------------------------------------------------------------------------------------------------
+test();
+//-------------------------------------------------------------------------------------------------
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ for (j in index) {testProperty(index[j]);}
+
+ exitFunc ('test');
+}
+
+
+function testProperty(i)
+{
+ status = getStatus(i);
+
+ // try to assign a property using the given index -
+ obj[i] = value = (propprefix + i);
+
+ // try to read the property back via the index (as number) -
+ expect = value;
+ actual = obj[i];
+ reportCompare(expect, actual, status);
+
+ // try to read the property back via the index as string -
+ expect = value;
+ actual = obj[String(i)];
+ reportCompare(expect, actual, status);
+}
+
+
+function getStatus(i)
+{
+ return (statprefix + i + statsuffix);
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-68498-001.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-68498-001.js
new file mode 100644
index 0000000..3fb1764
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-68498-001.js
@@ -0,0 +1,56 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS
+* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+* implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation. All
+* Rights Reserved.
+*
+* Contributor(s): brendan@mozilla.org, pschwartau@netscape.com
+* Date: 15 Feb 2001
+*
+* SUMMARY: var self = global JS object, outside any eval, is DontDelete
+*
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=68498
+* See http://bugzilla.mozilla.org/showattachment.cgi?attach_id=25251
+*
+* Brendan:
+*
+* "Demonstrate that variable statement outside any eval creates a
+* DontDelete property of the global object"
+*/
+//-------------------------------------------------------------------------------------------------
+var bug = 68498;
+var summary ='Testing that variable statement outside any eval creates' +
+ ' a DontDelete property of the global object';
+
+
+// To be pedantic, use a variable named 'self' to capture the global object -
+var self = this;
+var actual = (delete self);
+var expect =false;
+
+
+//-------------------------------------------------------------------------------------------------
+test();
+//-------------------------------------------------------------------------------------------------
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+ reportCompare(expect, actual, summary);
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-68498-002.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-68498-002.js
new file mode 100644
index 0000000..5f30b0b
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-68498-002.js
@@ -0,0 +1,80 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS
+* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+* implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation. All
+* Rights Reserved.
+*
+* Contributor(s): brendan@mozilla.org, pschwartau@netscape.com
+* Date: 15 Feb 2001
+*
+* SUMMARY: create a Deletable local variable using eval
+*
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=68498
+* See http://bugzilla.mozilla.org/showattachment.cgi?attach_id=25251
+*
+* Brendan:
+*
+* "Demonstrate the creation of a Deletable local variable using eval"
+*/
+//-------------------------------------------------------------------------------------------------
+var bug = 68498;
+var summary = 'Creating a Deletable local variable using eval';
+var statprefix = '; currently at expect[';
+var statsuffix = '] within test -';
+var actual = [ ];
+var expect = [ ];
+
+
+// Capture a reference to the global object -
+var self = this;
+
+// This function is the heart of the test -
+function f(s) {eval(s); actual[0]=y; return delete y;}
+
+
+// Set the actual-results array. The next line will set actual[0] and actual[1] in one shot
+actual[1] = f('var y = 42');
+actual[2] = 'y' in self && y;
+
+// Set the expected-results array -
+expect[0] = 42;
+expect[1] = true;
+expect[2] = false;
+
+
+//-------------------------------------------------------------------------------------------------
+test();
+//-------------------------------------------------------------------------------------------------
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ for (var i in expect)
+ {
+ reportCompare(expect[i], actual[i], getStatus(i));
+ }
+
+ exitFunc ('test');
+}
+
+
+function getStatus(i)
+{
+ return (summary + statprefix + i + statsuffix);
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-68498-003.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-68498-003.js
new file mode 100644
index 0000000..712207b
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-68498-003.js
@@ -0,0 +1,84 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS
+* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+* implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation. All
+* Rights Reserved.
+*
+* Contributor(s): brendan@mozilla.org, pschwartau@netscape.com
+* Date: 15 Feb 2001
+*
+* SUMMARY: calling obj.eval(str)
+*
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=68498
+* See http://bugzilla.mozilla.org/showattachment.cgi?attach_id=25251
+*
+* Brendan:
+*
+* "Backward compatibility: support calling obj.eval(str), which evaluates
+* str using obj as the scope chain and variable object."
+*/
+//-------------------------------------------------------------------------------------------------
+var bug = 68498;
+var summary = 'Testing calling obj.eval(str)';
+var statprefix = '; currently at expect[';
+var statsuffix = '] within test -';
+var actual = [ ];
+var expect = [ ];
+
+
+// Capture a reference to the global object -
+var self = this;
+
+// This function is the heart of the test -
+function f(s) {self.eval(s); return y;}
+
+
+// Set the actual-results array -
+actual[0] = f('var y = 43');
+actual[1] = 'y' in self && y;
+actual[2] = delete y;
+actual[3] = 'y' in self;
+
+// Set the expected-results array -
+expect[0] = 43;
+expect[1] = 43;
+expect[2] = true;
+expect[3] = false;
+
+
+//-------------------------------------------------------------------------------------------------
+test();
+//-------------------------------------------------------------------------------------------------
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ for (var i in expect)
+ {
+ reportCompare(expect[i], actual[i], getStatus(i));
+ }
+
+ exitFunc ('test');
+}
+
+
+function getStatus(i)
+{
+ return (summary + statprefix + i + statsuffix);
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-68498-004.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-68498-004.js
new file mode 100644
index 0000000..6e60d4d
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-68498-004.js
@@ -0,0 +1,112 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS
+* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+* implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation. All
+* Rights Reserved.
+*
+* Contributor(s): brendan@mozilla.org, pschwartau@netscape.com
+* Date: 15 Feb 2001
+*
+* SUMMARY: self.eval(str) inside a function
+* NOTE: 'self' is just a variable used to capture the global JS object.
+*
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=68498
+* See http://bugzilla.mozilla.org/showattachment.cgi?attach_id=25251
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=69441 (!!!)
+*
+* Brendan:
+*
+* "ECMA-262 Edition 3, 10.1.3 requires a FunctionDeclaration parsed as part
+* of a Program by eval to create a property of eval's caller's variable object.
+* This test evals in the body of a with statement, whose scope chain *is*
+* relevant to the effect of parsing the FunctionDeclaration."
+*/
+//-------------------------------------------------------------------------------------------------
+var bug = 68498;
+var summary = 'Testing self.eval(str) inside a function';
+var statprefix = '; currently at expect[';
+var statsuffix = '] within test -';
+var sToEval='';
+var actual=[ ];
+var expect=[ ];
+
+
+// Capture a reference to the global object -
+var self = this;
+
+// You shouldn't see this global variable's value in any printout -
+var x = 'outer';
+
+// This function is the heart of the test -
+function f(o,s,x) {with(o) eval(s); return z;};
+
+// Run-time statements to pass to the eval inside f
+sToEval += 'actual[0] = typeof g;'
+sToEval += 'function g(){actual[1]=(typeof w == "undefined" || w); return x};'
+sToEval += 'actual[2] = w;'
+sToEval += 'actual[3] = typeof g;'
+sToEval += 'var z=g();'
+
+// Set the actual-results array. The next line will set actual[0] - actual[4] in one shot
+actual[4] = f({w:44}, sToEval, 'inner');
+actual[5] = 'z' in self && z;
+
+
+/* Set the expected-results array.
+*
+* Sample issue: why do we set expect[4] = 'inner'? Look at actual[4]...
+* 1. The return value of f equals z, which is not defined at compile-time
+* 2. At run-time (via with(o) eval(s) inside f), z is defined as the return value of g
+* 3. At run-time (via with(o) eval(s) inside f), g is defined to return x
+* 4. In the scope of with(o), x is undefined
+* 5. Farther up the scope chain, x can be located as an argument of f
+* 6. The value of this argument at run-time is 'inner'
+* 7. Even farther up the scope chain, the name x can be found as a global variable
+* 8. The value of this global variable is 'outer', but we should NOT have gone
+* this far up the scope chain to find x...therefore we expect 'inner'
+*/
+expect[0] = 'function';
+expect[1] = 44;
+expect[2] = 44;
+expect[3] = 'function';
+expect[4] = 'inner';
+expect[5] = false;
+
+
+
+//------------------------------------------------------------------------------------------------
+test();
+//-------------------------------------------------------------------------------------------------
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ for (var i in expect)
+ {
+ reportCompare(expect[i], actual[i], getStatus(i));
+ }
+
+ exitFunc ('test');
+}
+
+
+function getStatus(i)
+{
+ return (summary + statprefix + i + statsuffix);
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-69607.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-69607.js
new file mode 100644
index 0000000..be0ace1
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-69607.js
@@ -0,0 +1,53 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS
+* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+* implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation. All
+* Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+* Date: 21 Feb 2001
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=69607
+*
+* SUMMARY: testing that we don't crash on trivial JavaScript
+*
+*/
+//-------------------------------------------------------------------------------------------------
+var bug = 69607;
+var summary = "Testing that we don't crash on trivial JavaScript";
+var var1;
+var var2;
+var var3;
+
+printBugNumber (bug);
+printStatus (summary);
+
+/*
+ * The crash this bug reported was caused by precisely these lines
+ * placed in top-level code (i.e. not wrapped inside a function) -
+*/
+if(false)
+{
+ var1 = 0;
+}
+else
+{
+ var2 = 0;
+}
+
+if(false)
+{
+ var3 = 0;
+}
+
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-71107.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-71107.js
new file mode 100644
index 0000000..b6427bf
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-71107.js
@@ -0,0 +1,60 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS
+* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+* implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation. All
+* Rights Reserved.
+*
+* Contributor(s): shaver@mozilla.org
+* Date: 06 Mar 2001
+*
+* SUMMARY: Propagate heavyweightness back up the function-nesting
+* chain. See http://bugzilla.mozilla.org/show_bug.cgi?id=71107
+*
+*/
+//-------------------------------------------------------------------------------------------------
+var bug = 71107;
+var summary = 'Propagate heavyweightness back up the function-nesting chain...';
+
+
+//-------------------------------------------------------------------------------------------------
+test();
+//-------------------------------------------------------------------------------------------------
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ var actual = outer()()(); //call the return of calling the return of outer()
+ var expect = 5;
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
+
+
+function outer () {
+ var outer_var = 5;
+
+ function inner() {
+ function way_inner() {
+ return outer_var;
+ }
+ return way_inner;
+ }
+ return inner;
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-76054.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-76054.js
new file mode 100644
index 0000000..3d0533d
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-76054.js
@@ -0,0 +1,139 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS
+* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+* implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation. All
+* Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+* Date: 16 May 2001
+*
+* SUMMARY: Regression test for bug 76054
+*
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=76054
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=78706
+* All String HTML methods should be LOWER case -
+*/
+//-------------------------------------------------------------------------------------------------
+var UBound = 0;
+var bug = 76054;
+var summary = 'Testing that String HTML methods produce all lower-case';
+var statprefix = 'Currently testing String.';
+var status = '';
+var statusitems = [ ];
+var actual = '';
+var actualvalues = [ ];
+var expect= '';
+var expectedvalues = [ ];
+var s = 'xyz';
+
+status = 'anchor()';
+actual = s.anchor();
+expect = actual.toLowerCase();
+addThis();
+
+status = 'big()';
+actual = s.big();
+expect = actual.toLowerCase();
+addThis();
+
+status = 'blink()';
+actual = s.blink();
+expect = actual.toLowerCase();
+addThis();
+
+status = 'bold()';
+actual = s.bold();
+expect = actual.toLowerCase();
+addThis();
+
+status = 'italics()';
+actual = s.italics();
+expect = actual.toLowerCase();
+addThis();
+
+status = 'fixed()';
+actual = s.fixed();
+expect = actual.toLowerCase();
+addThis();
+
+status = 'fontcolor()';
+actual = s.fontcolor();
+expect = actual.toLowerCase();
+addThis();
+
+status = 'fontsize()';
+actual = s.fontsize();
+expect = actual.toLowerCase();
+addThis();
+
+status = 'link()';
+actual = s.link();
+expect = actual.toLowerCase();
+addThis();
+
+status = 'small()';
+actual = s.small();
+expect = actual.toLowerCase();
+addThis();
+
+status = 'strike()';
+actual = s.strike();
+expect = actual.toLowerCase();
+addThis();
+
+status = 'sub()';
+actual = s.sub();
+expect = actual.toLowerCase();
+addThis();
+
+status = 'sup()';
+actual = s.sup();
+expect = actual.toLowerCase();
+addThis();
+
+
+//-------------------------------------------------------------------------------------------------
+test();
+//-------------------------------------------------------------------------------------------------
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ for (var i = 0; i < UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], getStatus(i));
+ }
+
+ exitFunc ('test');
+}
+
+
+function getStatus(i)
+{
+ return statprefix + statusitems[i];
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-80981.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-80981.js
new file mode 100644
index 0000000..75dc052
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-80981.js
@@ -0,0 +1,3137 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2001
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): khanson@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 19 Nov 2001
+* SUMMARY: Regression test for bug 80981.
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=80981
+* "Need extended jump bytecode to avoid "script too large" errors, etc."
+*
+* Before this bug was fixed, the script below caused a run-time error because
+* its switch statement was too big. After the fix, SpiderMonkey should compile
+* this script just fine. The same fix has not been made in Rhino, however,
+* so it will continue to error there...
+*
+* If you ever run this test against an old SpiderMonkey shell to see the bug,
+* you should run it interactively: i.e. launch the JS shell manually, and load
+* the test manually. Do not run it via the test driver jsDriverl.pl. Why? -
+* before the fix for bug 97646, the JS shell would error on this script, but
+* would NOT give non-0 exit code. As a result, the test driver couldn't detect
+* the error (it looks for non-0 exit codes).
+*
+*/
+//-----------------------------------------------------------------------------
+var i2 = 3011;
+var n = new Array (i2);
+var err_num = 0;
+var i = 0;
+var j = 0;
+var k = 0;
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+function test()
+{
+ b ();
+ b4 ();
+ print('Number of errors = ' + err_num);
+}
+
+
+function b()
+{
+ b4 ();
+ b_after ();
+
+ for (i=0; i<i2; i++) {n[i] = 0;}
+ i = 0;
+
+ while (k++ <= i2)
+ {
+ switch (j = (k*73)%i2)
+ {
+ case 0: if (n[0]++ > 0) check ('a string 0'); break;
+ case 1: if (n[1]++ > 0) check ('a string 1'); break;
+ case 2: if (n[2]++ > 0) check ('a string 2'); break;
+ case 3: if (n[3]++ > 0) check ('a string 3'); break;
+ case 4: if (n[4]++ > 0) check ('a string 4'); break;
+ case 5: if (n[5]++ > 0) check ('a string 5'); break;
+ case 6: if (n[6]++ > 0) check ('a string 6'); break;
+ case 7: if (n[7]++ > 0) check ('a string 7'); break;
+ case 8: if (n[8]++ > 0) check ('a string 8'); break;
+ case 9: if (n[9]++ > 0) check ('a string 9'); break;
+ case 10: if (n[10]++ > 0) check ('a string 10'); break;
+ case 11: if (n[11]++ > 0) check ('a string 11'); break;
+ case 12: if (n[12]++ > 0) check ('a string 12'); break;
+ case 13: if (n[13]++ > 0) check ('a string 13'); break;
+ case 14: if (n[14]++ > 0) check ('a string 14'); break;
+ case 15: if (n[15]++ > 0) check ('a string 15'); break;
+ case 16: if (n[16]++ > 0) check ('a string 16'); break;
+ case 17: if (n[17]++ > 0) check ('a string 17'); break;
+ case 18: if (n[18]++ > 0) check ('a string 18'); break;
+ case 19: if (n[19]++ > 0) check ('a string 19'); break;
+ case 20: if (n[20]++ > 0) check ('a string 20'); break;
+ case 21: if (n[21]++ > 0) check ('a string 21'); break;
+ case 22: if (n[22]++ > 0) check ('a string 22'); break;
+ case 23: if (n[23]++ > 0) check ('a string 23'); break;
+ case 24: if (n[24]++ > 0) check ('a string 24'); break;
+ case 25: if (n[25]++ > 0) check ('a string 25'); break;
+ case 26: if (n[26]++ > 0) check ('a string 26'); break;
+ case 27: if (n[27]++ > 0) check ('a string 27'); break;
+ case 28: if (n[28]++ > 0) check ('a string 28'); break;
+ case 29: if (n[29]++ > 0) check ('a string 29'); break;
+ case 30: if (n[30]++ > 0) check ('a string 30'); break;
+ case 31: if (n[31]++ > 0) check ('a string 31'); break;
+ case 32: if (n[32]++ > 0) check ('a string 32'); break;
+ case 33: if (n[33]++ > 0) check ('a string 33'); break;
+ case 34: if (n[34]++ > 0) check ('a string 34'); break;
+ case 35: if (n[35]++ > 0) check ('a string 35'); break;
+ case 36: if (n[36]++ > 0) check ('a string 36'); break;
+ case 37: if (n[37]++ > 0) check ('a string 37'); break;
+ case 38: if (n[38]++ > 0) check ('a string 38'); break;
+ case 39: if (n[39]++ > 0) check ('a string 39'); break;
+ case 40: if (n[40]++ > 0) check ('a string 40'); break;
+ case 41: if (n[41]++ > 0) check ('a string 41'); break;
+ case 42: if (n[42]++ > 0) check ('a string 42'); break;
+ case 43: if (n[43]++ > 0) check ('a string 43'); break;
+ case 44: if (n[44]++ > 0) check ('a string 44'); break;
+ case 45: if (n[45]++ > 0) check ('a string 45'); break;
+ case 46: if (n[46]++ > 0) check ('a string 46'); break;
+ case 47: if (n[47]++ > 0) check ('a string 47'); break;
+ case 48: if (n[48]++ > 0) check ('a string 48'); break;
+ case 49: if (n[49]++ > 0) check ('a string 49'); break;
+ case 50: if (n[50]++ > 0) check ('a string 50'); break;
+ case 51: if (n[51]++ > 0) check ('a string 51'); break;
+ case 52: if (n[52]++ > 0) check ('a string 52'); break;
+ case 53: if (n[53]++ > 0) check ('a string 53'); break;
+ case 54: if (n[54]++ > 0) check ('a string 54'); break;
+ case 55: if (n[55]++ > 0) check ('a string 55'); break;
+ case 56: if (n[56]++ > 0) check ('a string 56'); break;
+ case 57: if (n[57]++ > 0) check ('a string 57'); break;
+ case 58: if (n[58]++ > 0) check ('a string 58'); break;
+ case 59: if (n[59]++ > 0) check ('a string 59'); break;
+ case 60: if (n[60]++ > 0) check ('a string 60'); break;
+ case 61: if (n[61]++ > 0) check ('a string 61'); break;
+ case 62: if (n[62]++ > 0) check ('a string 62'); break;
+ case 63: if (n[63]++ > 0) check ('a string 63'); break;
+ case 64: if (n[64]++ > 0) check ('a string 64'); break;
+ case 65: if (n[65]++ > 0) check ('a string 65'); break;
+ case 66: if (n[66]++ > 0) check ('a string 66'); break;
+ case 67: if (n[67]++ > 0) check ('a string 67'); break;
+ case 68: if (n[68]++ > 0) check ('a string 68'); break;
+ case 69: if (n[69]++ > 0) check ('a string 69'); break;
+ case 70: if (n[70]++ > 0) check ('a string 70'); break;
+ case 71: if (n[71]++ > 0) check ('a string 71'); break;
+ case 72: if (n[72]++ > 0) check ('a string 72'); break;
+ case 73: if (n[73]++ > 0) check ('a string 73'); break;
+ case 74: if (n[74]++ > 0) check ('a string 74'); break;
+ case 75: if (n[75]++ > 0) check ('a string 75'); break;
+ case 76: if (n[76]++ > 0) check ('a string 76'); break;
+ case 77: if (n[77]++ > 0) check ('a string 77'); break;
+ case 78: if (n[78]++ > 0) check ('a string 78'); break;
+ case 79: if (n[79]++ > 0) check ('a string 79'); break;
+ case 80: if (n[80]++ > 0) check ('a string 80'); break;
+ case 81: if (n[81]++ > 0) check ('a string 81'); break;
+ case 82: if (n[82]++ > 0) check ('a string 82'); break;
+ case 83: if (n[83]++ > 0) check ('a string 83'); break;
+ case 84: if (n[84]++ > 0) check ('a string 84'); break;
+ case 85: if (n[85]++ > 0) check ('a string 85'); break;
+ case 86: if (n[86]++ > 0) check ('a string 86'); break;
+ case 87: if (n[87]++ > 0) check ('a string 87'); break;
+ case 88: if (n[88]++ > 0) check ('a string 88'); break;
+ case 89: if (n[89]++ > 0) check ('a string 89'); break;
+ case 90: if (n[90]++ > 0) check ('a string 90'); break;
+ case 91: if (n[91]++ > 0) check ('a string 91'); break;
+ case 92: if (n[92]++ > 0) check ('a string 92'); break;
+ case 93: if (n[93]++ > 0) check ('a string 93'); break;
+ case 94: if (n[94]++ > 0) check ('a string 94'); break;
+ case 95: if (n[95]++ > 0) check ('a string 95'); break;
+ case 96: if (n[96]++ > 0) check ('a string 96'); break;
+ case 97: if (n[97]++ > 0) check ('a string 97'); break;
+ case 98: if (n[98]++ > 0) check ('a string 98'); break;
+ case 99: if (n[99]++ > 0) check ('a string 99'); break;
+ case 100: if (n[100]++ > 0) check ('a string 100'); break;
+ case 101: if (n[101]++ > 0) check ('a string 101'); break;
+ case 102: if (n[102]++ > 0) check ('a string 102'); break;
+ case 103: if (n[103]++ > 0) check ('a string 103'); break;
+ case 104: if (n[104]++ > 0) check ('a string 104'); break;
+ case 105: if (n[105]++ > 0) check ('a string 105'); break;
+ case 106: if (n[106]++ > 0) check ('a string 106'); break;
+ case 107: if (n[107]++ > 0) check ('a string 107'); break;
+ case 108: if (n[108]++ > 0) check ('a string 108'); break;
+ case 109: if (n[109]++ > 0) check ('a string 109'); break;
+ case 110: if (n[110]++ > 0) check ('a string 110'); break;
+ case 111: if (n[111]++ > 0) check ('a string 111'); break;
+ case 112: if (n[112]++ > 0) check ('a string 112'); break;
+ case 113: if (n[113]++ > 0) check ('a string 113'); break;
+ case 114: if (n[114]++ > 0) check ('a string 114'); break;
+ case 115: if (n[115]++ > 0) check ('a string 115'); break;
+ case 116: if (n[116]++ > 0) check ('a string 116'); break;
+ case 117: if (n[117]++ > 0) check ('a string 117'); break;
+ case 118: if (n[118]++ > 0) check ('a string 118'); break;
+ case 119: if (n[119]++ > 0) check ('a string 119'); break;
+ case 120: if (n[120]++ > 0) check ('a string 120'); break;
+ case 121: if (n[121]++ > 0) check ('a string 121'); break;
+ case 122: if (n[122]++ > 0) check ('a string 122'); break;
+ case 123: if (n[123]++ > 0) check ('a string 123'); break;
+ case 124: if (n[124]++ > 0) check ('a string 124'); break;
+ case 125: if (n[125]++ > 0) check ('a string 125'); break;
+ case 126: if (n[126]++ > 0) check ('a string 126'); break;
+ case 127: if (n[127]++ > 0) check ('a string 127'); break;
+ case 128: if (n[128]++ > 0) check ('a string 128'); break;
+ case 129: if (n[129]++ > 0) check ('a string 129'); break;
+ case 130: if (n[130]++ > 0) check ('a string 130'); break;
+ case 131: if (n[131]++ > 0) check ('a string 131'); break;
+ case 132: if (n[132]++ > 0) check ('a string 132'); break;
+ case 133: if (n[133]++ > 0) check ('a string 133'); break;
+ case 134: if (n[134]++ > 0) check ('a string 134'); break;
+ case 135: if (n[135]++ > 0) check ('a string 135'); break;
+ case 136: if (n[136]++ > 0) check ('a string 136'); break;
+ case 137: if (n[137]++ > 0) check ('a string 137'); break;
+ case 138: if (n[138]++ > 0) check ('a string 138'); break;
+ case 139: if (n[139]++ > 0) check ('a string 139'); break;
+ case 140: if (n[140]++ > 0) check ('a string 140'); break;
+ case 141: if (n[141]++ > 0) check ('a string 141'); break;
+ case 142: if (n[142]++ > 0) check ('a string 142'); break;
+ case 143: if (n[143]++ > 0) check ('a string 143'); break;
+ case 144: if (n[144]++ > 0) check ('a string 144'); break;
+ case 145: if (n[145]++ > 0) check ('a string 145'); break;
+ case 146: if (n[146]++ > 0) check ('a string 146'); break;
+ case 147: if (n[147]++ > 0) check ('a string 147'); break;
+ case 148: if (n[148]++ > 0) check ('a string 148'); break;
+ case 149: if (n[149]++ > 0) check ('a string 149'); break;
+ case 150: if (n[150]++ > 0) check ('a string 150'); break;
+ case 151: if (n[151]++ > 0) check ('a string 151'); break;
+ case 152: if (n[152]++ > 0) check ('a string 152'); break;
+ case 153: if (n[153]++ > 0) check ('a string 153'); break;
+ case 154: if (n[154]++ > 0) check ('a string 154'); break;
+ case 155: if (n[155]++ > 0) check ('a string 155'); break;
+ case 156: if (n[156]++ > 0) check ('a string 156'); break;
+ case 157: if (n[157]++ > 0) check ('a string 157'); break;
+ case 158: if (n[158]++ > 0) check ('a string 158'); break;
+ case 159: if (n[159]++ > 0) check ('a string 159'); break;
+ case 160: if (n[160]++ > 0) check ('a string 160'); break;
+ case 161: if (n[161]++ > 0) check ('a string 161'); break;
+ case 162: if (n[162]++ > 0) check ('a string 162'); break;
+ case 163: if (n[163]++ > 0) check ('a string 163'); break;
+ case 164: if (n[164]++ > 0) check ('a string 164'); break;
+ case 165: if (n[165]++ > 0) check ('a string 165'); break;
+ case 166: if (n[166]++ > 0) check ('a string 166'); break;
+ case 167: if (n[167]++ > 0) check ('a string 167'); break;
+ case 168: if (n[168]++ > 0) check ('a string 168'); break;
+ case 169: if (n[169]++ > 0) check ('a string 169'); break;
+ case 170: if (n[170]++ > 0) check ('a string 170'); break;
+ case 171: if (n[171]++ > 0) check ('a string 171'); break;
+ case 172: if (n[172]++ > 0) check ('a string 172'); break;
+ case 173: if (n[173]++ > 0) check ('a string 173'); break;
+ case 174: if (n[174]++ > 0) check ('a string 174'); break;
+ case 175: if (n[175]++ > 0) check ('a string 175'); break;
+ case 176: if (n[176]++ > 0) check ('a string 176'); break;
+ case 177: if (n[177]++ > 0) check ('a string 177'); break;
+ case 178: if (n[178]++ > 0) check ('a string 178'); break;
+ case 179: if (n[179]++ > 0) check ('a string 179'); break;
+ case 180: if (n[180]++ > 0) check ('a string 180'); break;
+ case 181: if (n[181]++ > 0) check ('a string 181'); break;
+ case 182: if (n[182]++ > 0) check ('a string 182'); break;
+ case 183: if (n[183]++ > 0) check ('a string 183'); break;
+ case 184: if (n[184]++ > 0) check ('a string 184'); break;
+ case 185: if (n[185]++ > 0) check ('a string 185'); break;
+ case 186: if (n[186]++ > 0) check ('a string 186'); break;
+ case 187: if (n[187]++ > 0) check ('a string 187'); break;
+ case 188: if (n[188]++ > 0) check ('a string 188'); break;
+ case 189: if (n[189]++ > 0) check ('a string 189'); break;
+ case 190: if (n[190]++ > 0) check ('a string 190'); break;
+ case 191: if (n[191]++ > 0) check ('a string 191'); break;
+ case 192: if (n[192]++ > 0) check ('a string 192'); break;
+ case 193: if (n[193]++ > 0) check ('a string 193'); break;
+ case 194: if (n[194]++ > 0) check ('a string 194'); break;
+ case 195: if (n[195]++ > 0) check ('a string 195'); break;
+ case 196: if (n[196]++ > 0) check ('a string 196'); break;
+ case 197: if (n[197]++ > 0) check ('a string 197'); break;
+ case 198: if (n[198]++ > 0) check ('a string 198'); break;
+ case 199: if (n[199]++ > 0) check ('a string 199'); break;
+ case 200: if (n[200]++ > 0) check ('a string 200'); break;
+ case 201: if (n[201]++ > 0) check ('a string 201'); break;
+ case 202: if (n[202]++ > 0) check ('a string 202'); break;
+ case 203: if (n[203]++ > 0) check ('a string 203'); break;
+ case 204: if (n[204]++ > 0) check ('a string 204'); break;
+ case 205: if (n[205]++ > 0) check ('a string 205'); break;
+ case 206: if (n[206]++ > 0) check ('a string 206'); break;
+ case 207: if (n[207]++ > 0) check ('a string 207'); break;
+ case 208: if (n[208]++ > 0) check ('a string 208'); break;
+ case 209: if (n[209]++ > 0) check ('a string 209'); break;
+ case 210: if (n[210]++ > 0) check ('a string 210'); break;
+ case 211: if (n[211]++ > 0) check ('a string 211'); break;
+ case 212: if (n[212]++ > 0) check ('a string 212'); break;
+ case 213: if (n[213]++ > 0) check ('a string 213'); break;
+ case 214: if (n[214]++ > 0) check ('a string 214'); break;
+ case 215: if (n[215]++ > 0) check ('a string 215'); break;
+ case 216: if (n[216]++ > 0) check ('a string 216'); break;
+ case 217: if (n[217]++ > 0) check ('a string 217'); break;
+ case 218: if (n[218]++ > 0) check ('a string 218'); break;
+ case 219: if (n[219]++ > 0) check ('a string 219'); break;
+ case 220: if (n[220]++ > 0) check ('a string 220'); break;
+ case 221: if (n[221]++ > 0) check ('a string 221'); break;
+ case 222: if (n[222]++ > 0) check ('a string 222'); break;
+ case 223: if (n[223]++ > 0) check ('a string 223'); break;
+ case 224: if (n[224]++ > 0) check ('a string 224'); break;
+ case 225: if (n[225]++ > 0) check ('a string 225'); break;
+ case 226: if (n[226]++ > 0) check ('a string 226'); break;
+ case 227: if (n[227]++ > 0) check ('a string 227'); break;
+ case 228: if (n[228]++ > 0) check ('a string 228'); break;
+ case 229: if (n[229]++ > 0) check ('a string 229'); break;
+ case 230: if (n[230]++ > 0) check ('a string 230'); break;
+ case 231: if (n[231]++ > 0) check ('a string 231'); break;
+ case 232: if (n[232]++ > 0) check ('a string 232'); break;
+ case 233: if (n[233]++ > 0) check ('a string 233'); break;
+ case 234: if (n[234]++ > 0) check ('a string 234'); break;
+ case 235: if (n[235]++ > 0) check ('a string 235'); break;
+ case 236: if (n[236]++ > 0) check ('a string 236'); break;
+ case 237: if (n[237]++ > 0) check ('a string 237'); break;
+ case 238: if (n[238]++ > 0) check ('a string 238'); break;
+ case 239: if (n[239]++ > 0) check ('a string 239'); break;
+ case 240: if (n[240]++ > 0) check ('a string 240'); break;
+ case 241: if (n[241]++ > 0) check ('a string 241'); break;
+ case 242: if (n[242]++ > 0) check ('a string 242'); break;
+ case 243: if (n[243]++ > 0) check ('a string 243'); break;
+ case 244: if (n[244]++ > 0) check ('a string 244'); break;
+ case 245: if (n[245]++ > 0) check ('a string 245'); break;
+ case 246: if (n[246]++ > 0) check ('a string 246'); break;
+ case 247: if (n[247]++ > 0) check ('a string 247'); break;
+ case 248: if (n[248]++ > 0) check ('a string 248'); break;
+ case 249: if (n[249]++ > 0) check ('a string 249'); break;
+ case 250: if (n[250]++ > 0) check ('a string 250'); break;
+ case 251: if (n[251]++ > 0) check ('a string 251'); break;
+ case 252: if (n[252]++ > 0) check ('a string 252'); break;
+ case 253: if (n[253]++ > 0) check ('a string 253'); break;
+ case 254: if (n[254]++ > 0) check ('a string 254'); break;
+ case 255: if (n[255]++ > 0) check ('a string 255'); break;
+ case 256: if (n[256]++ > 0) check ('a string 256'); break;
+ case 257: if (n[257]++ > 0) check ('a string 257'); break;
+ case 258: if (n[258]++ > 0) check ('a string 258'); break;
+ case 259: if (n[259]++ > 0) check ('a string 259'); break;
+ case 260: if (n[260]++ > 0) check ('a string 260'); break;
+ case 261: if (n[261]++ > 0) check ('a string 261'); break;
+ case 262: if (n[262]++ > 0) check ('a string 262'); break;
+ case 263: if (n[263]++ > 0) check ('a string 263'); break;
+ case 264: if (n[264]++ > 0) check ('a string 264'); break;
+ case 265: if (n[265]++ > 0) check ('a string 265'); break;
+ case 266: if (n[266]++ > 0) check ('a string 266'); break;
+ case 267: if (n[267]++ > 0) check ('a string 267'); break;
+ case 268: if (n[268]++ > 0) check ('a string 268'); break;
+ case 269: if (n[269]++ > 0) check ('a string 269'); break;
+ case 270: if (n[270]++ > 0) check ('a string 270'); break;
+ case 271: if (n[271]++ > 0) check ('a string 271'); break;
+ case 272: if (n[272]++ > 0) check ('a string 272'); break;
+ case 273: if (n[273]++ > 0) check ('a string 273'); break;
+ case 274: if (n[274]++ > 0) check ('a string 274'); break;
+ case 275: if (n[275]++ > 0) check ('a string 275'); break;
+ case 276: if (n[276]++ > 0) check ('a string 276'); break;
+ case 277: if (n[277]++ > 0) check ('a string 277'); break;
+ case 278: if (n[278]++ > 0) check ('a string 278'); break;
+ case 279: if (n[279]++ > 0) check ('a string 279'); break;
+ case 280: if (n[280]++ > 0) check ('a string 280'); break;
+ case 281: if (n[281]++ > 0) check ('a string 281'); break;
+ case 282: if (n[282]++ > 0) check ('a string 282'); break;
+ case 283: if (n[283]++ > 0) check ('a string 283'); break;
+ case 284: if (n[284]++ > 0) check ('a string 284'); break;
+ case 285: if (n[285]++ > 0) check ('a string 285'); break;
+ case 286: if (n[286]++ > 0) check ('a string 286'); break;
+ case 287: if (n[287]++ > 0) check ('a string 287'); break;
+ case 288: if (n[288]++ > 0) check ('a string 288'); break;
+ case 289: if (n[289]++ > 0) check ('a string 289'); break;
+ case 290: if (n[290]++ > 0) check ('a string 290'); break;
+ case 291: if (n[291]++ > 0) check ('a string 291'); break;
+ case 292: if (n[292]++ > 0) check ('a string 292'); break;
+ case 293: if (n[293]++ > 0) check ('a string 293'); break;
+ case 294: if (n[294]++ > 0) check ('a string 294'); break;
+ case 295: if (n[295]++ > 0) check ('a string 295'); break;
+ case 296: if (n[296]++ > 0) check ('a string 296'); break;
+ case 297: if (n[297]++ > 0) check ('a string 297'); break;
+ case 298: if (n[298]++ > 0) check ('a string 298'); break;
+ case 299: if (n[299]++ > 0) check ('a string 299'); break;
+ case 300: if (n[300]++ > 0) check ('a string 300'); break;
+ case 301: if (n[301]++ > 0) check ('a string 301'); break;
+ case 302: if (n[302]++ > 0) check ('a string 302'); break;
+ case 303: if (n[303]++ > 0) check ('a string 303'); break;
+ case 304: if (n[304]++ > 0) check ('a string 304'); break;
+ case 305: if (n[305]++ > 0) check ('a string 305'); break;
+ case 306: if (n[306]++ > 0) check ('a string 306'); break;
+ case 307: if (n[307]++ > 0) check ('a string 307'); break;
+ case 308: if (n[308]++ > 0) check ('a string 308'); break;
+ case 309: if (n[309]++ > 0) check ('a string 309'); break;
+ case 310: if (n[310]++ > 0) check ('a string 310'); break;
+ case 311: if (n[311]++ > 0) check ('a string 311'); break;
+ case 312: if (n[312]++ > 0) check ('a string 312'); break;
+ case 313: if (n[313]++ > 0) check ('a string 313'); break;
+ case 314: if (n[314]++ > 0) check ('a string 314'); break;
+ case 315: if (n[315]++ > 0) check ('a string 315'); break;
+ case 316: if (n[316]++ > 0) check ('a string 316'); break;
+ case 317: if (n[317]++ > 0) check ('a string 317'); break;
+ case 318: if (n[318]++ > 0) check ('a string 318'); break;
+ case 319: if (n[319]++ > 0) check ('a string 319'); break;
+ case 320: if (n[320]++ > 0) check ('a string 320'); break;
+ case 321: if (n[321]++ > 0) check ('a string 321'); break;
+ case 322: if (n[322]++ > 0) check ('a string 322'); break;
+ case 323: if (n[323]++ > 0) check ('a string 323'); break;
+ case 324: if (n[324]++ > 0) check ('a string 324'); break;
+ case 325: if (n[325]++ > 0) check ('a string 325'); break;
+ case 326: if (n[326]++ > 0) check ('a string 326'); break;
+ case 327: if (n[327]++ > 0) check ('a string 327'); break;
+ case 328: if (n[328]++ > 0) check ('a string 328'); break;
+ case 329: if (n[329]++ > 0) check ('a string 329'); break;
+ case 330: if (n[330]++ > 0) check ('a string 330'); break;
+ case 331: if (n[331]++ > 0) check ('a string 331'); break;
+ case 332: if (n[332]++ > 0) check ('a string 332'); break;
+ case 333: if (n[333]++ > 0) check ('a string 333'); break;
+ case 334: if (n[334]++ > 0) check ('a string 334'); break;
+ case 335: if (n[335]++ > 0) check ('a string 335'); break;
+ case 336: if (n[336]++ > 0) check ('a string 336'); break;
+ case 337: if (n[337]++ > 0) check ('a string 337'); break;
+ case 338: if (n[338]++ > 0) check ('a string 338'); break;
+ case 339: if (n[339]++ > 0) check ('a string 339'); break;
+ case 340: if (n[340]++ > 0) check ('a string 340'); break;
+ case 341: if (n[341]++ > 0) check ('a string 341'); break;
+ case 342: if (n[342]++ > 0) check ('a string 342'); break;
+ case 343: if (n[343]++ > 0) check ('a string 343'); break;
+ case 344: if (n[344]++ > 0) check ('a string 344'); break;
+ case 345: if (n[345]++ > 0) check ('a string 345'); break;
+ case 346: if (n[346]++ > 0) check ('a string 346'); break;
+ case 347: if (n[347]++ > 0) check ('a string 347'); break;
+ case 348: if (n[348]++ > 0) check ('a string 348'); break;
+ case 349: if (n[349]++ > 0) check ('a string 349'); break;
+ case 350: if (n[350]++ > 0) check ('a string 350'); break;
+ case 351: if (n[351]++ > 0) check ('a string 351'); break;
+ case 352: if (n[352]++ > 0) check ('a string 352'); break;
+ case 353: if (n[353]++ > 0) check ('a string 353'); break;
+ case 354: if (n[354]++ > 0) check ('a string 354'); break;
+ case 355: if (n[355]++ > 0) check ('a string 355'); break;
+ case 356: if (n[356]++ > 0) check ('a string 356'); break;
+ case 357: if (n[357]++ > 0) check ('a string 357'); break;
+ case 358: if (n[358]++ > 0) check ('a string 358'); break;
+ case 359: if (n[359]++ > 0) check ('a string 359'); break;
+ case 360: if (n[360]++ > 0) check ('a string 360'); break;
+ case 361: if (n[361]++ > 0) check ('a string 361'); break;
+ case 362: if (n[362]++ > 0) check ('a string 362'); break;
+ case 363: if (n[363]++ > 0) check ('a string 363'); break;
+ case 364: if (n[364]++ > 0) check ('a string 364'); break;
+ case 365: if (n[365]++ > 0) check ('a string 365'); break;
+ case 366: if (n[366]++ > 0) check ('a string 366'); break;
+ case 367: if (n[367]++ > 0) check ('a string 367'); break;
+ case 368: if (n[368]++ > 0) check ('a string 368'); break;
+ case 369: if (n[369]++ > 0) check ('a string 369'); break;
+ case 370: if (n[370]++ > 0) check ('a string 370'); break;
+ case 371: if (n[371]++ > 0) check ('a string 371'); break;
+ case 372: if (n[372]++ > 0) check ('a string 372'); break;
+ case 373: if (n[373]++ > 0) check ('a string 373'); break;
+ case 374: if (n[374]++ > 0) check ('a string 374'); break;
+ case 375: if (n[375]++ > 0) check ('a string 375'); break;
+ case 376: if (n[376]++ > 0) check ('a string 376'); break;
+ case 377: if (n[377]++ > 0) check ('a string 377'); break;
+ case 378: if (n[378]++ > 0) check ('a string 378'); break;
+ case 379: if (n[379]++ > 0) check ('a string 379'); break;
+ case 380: if (n[380]++ > 0) check ('a string 380'); break;
+ case 381: if (n[381]++ > 0) check ('a string 381'); break;
+ case 382: if (n[382]++ > 0) check ('a string 382'); break;
+ case 383: if (n[383]++ > 0) check ('a string 383'); break;
+ case 384: if (n[384]++ > 0) check ('a string 384'); break;
+ case 385: if (n[385]++ > 0) check ('a string 385'); break;
+ case 386: if (n[386]++ > 0) check ('a string 386'); break;
+ case 387: if (n[387]++ > 0) check ('a string 387'); break;
+ case 388: if (n[388]++ > 0) check ('a string 388'); break;
+ case 389: if (n[389]++ > 0) check ('a string 389'); break;
+ case 390: if (n[390]++ > 0) check ('a string 390'); break;
+ case 391: if (n[391]++ > 0) check ('a string 391'); break;
+ case 392: if (n[392]++ > 0) check ('a string 392'); break;
+ case 393: if (n[393]++ > 0) check ('a string 393'); break;
+ case 394: if (n[394]++ > 0) check ('a string 394'); break;
+ case 395: if (n[395]++ > 0) check ('a string 395'); break;
+ case 396: if (n[396]++ > 0) check ('a string 396'); break;
+ case 397: if (n[397]++ > 0) check ('a string 397'); break;
+ case 398: if (n[398]++ > 0) check ('a string 398'); break;
+ case 399: if (n[399]++ > 0) check ('a string 399'); break;
+ case 400: if (n[400]++ > 0) check ('a string 400'); break;
+ case 401: if (n[401]++ > 0) check ('a string 401'); break;
+ case 402: if (n[402]++ > 0) check ('a string 402'); break;
+ case 403: if (n[403]++ > 0) check ('a string 403'); break;
+ case 404: if (n[404]++ > 0) check ('a string 404'); break;
+ case 405: if (n[405]++ > 0) check ('a string 405'); break;
+ case 406: if (n[406]++ > 0) check ('a string 406'); break;
+ case 407: if (n[407]++ > 0) check ('a string 407'); break;
+ case 408: if (n[408]++ > 0) check ('a string 408'); break;
+ case 409: if (n[409]++ > 0) check ('a string 409'); break;
+ case 410: if (n[410]++ > 0) check ('a string 410'); break;
+ case 411: if (n[411]++ > 0) check ('a string 411'); break;
+ case 412: if (n[412]++ > 0) check ('a string 412'); break;
+ case 413: if (n[413]++ > 0) check ('a string 413'); break;
+ case 414: if (n[414]++ > 0) check ('a string 414'); break;
+ case 415: if (n[415]++ > 0) check ('a string 415'); break;
+ case 416: if (n[416]++ > 0) check ('a string 416'); break;
+ case 417: if (n[417]++ > 0) check ('a string 417'); break;
+ case 418: if (n[418]++ > 0) check ('a string 418'); break;
+ case 419: if (n[419]++ > 0) check ('a string 419'); break;
+ case 420: if (n[420]++ > 0) check ('a string 420'); break;
+ case 421: if (n[421]++ > 0) check ('a string 421'); break;
+ case 422: if (n[422]++ > 0) check ('a string 422'); break;
+ case 423: if (n[423]++ > 0) check ('a string 423'); break;
+ case 424: if (n[424]++ > 0) check ('a string 424'); break;
+ case 425: if (n[425]++ > 0) check ('a string 425'); break;
+ case 426: if (n[426]++ > 0) check ('a string 426'); break;
+ case 427: if (n[427]++ > 0) check ('a string 427'); break;
+ case 428: if (n[428]++ > 0) check ('a string 428'); break;
+ case 429: if (n[429]++ > 0) check ('a string 429'); break;
+ case 430: if (n[430]++ > 0) check ('a string 430'); break;
+ case 431: if (n[431]++ > 0) check ('a string 431'); break;
+ case 432: if (n[432]++ > 0) check ('a string 432'); break;
+ case 433: if (n[433]++ > 0) check ('a string 433'); break;
+ case 434: if (n[434]++ > 0) check ('a string 434'); break;
+ case 435: if (n[435]++ > 0) check ('a string 435'); break;
+ case 436: if (n[436]++ > 0) check ('a string 436'); break;
+ case 437: if (n[437]++ > 0) check ('a string 437'); break;
+ case 438: if (n[438]++ > 0) check ('a string 438'); break;
+ case 439: if (n[439]++ > 0) check ('a string 439'); break;
+ case 440: if (n[440]++ > 0) check ('a string 440'); break;
+ case 441: if (n[441]++ > 0) check ('a string 441'); break;
+ case 442: if (n[442]++ > 0) check ('a string 442'); break;
+ case 443: if (n[443]++ > 0) check ('a string 443'); break;
+ case 444: if (n[444]++ > 0) check ('a string 444'); break;
+ case 445: if (n[445]++ > 0) check ('a string 445'); break;
+ case 446: if (n[446]++ > 0) check ('a string 446'); break;
+ case 447: if (n[447]++ > 0) check ('a string 447'); break;
+ case 448: if (n[448]++ > 0) check ('a string 448'); break;
+ case 449: if (n[449]++ > 0) check ('a string 449'); break;
+ case 450: if (n[450]++ > 0) check ('a string 450'); break;
+ case 451: if (n[451]++ > 0) check ('a string 451'); break;
+ case 452: if (n[452]++ > 0) check ('a string 452'); break;
+ case 453: if (n[453]++ > 0) check ('a string 453'); break;
+ case 454: if (n[454]++ > 0) check ('a string 454'); break;
+ case 455: if (n[455]++ > 0) check ('a string 455'); break;
+ case 456: if (n[456]++ > 0) check ('a string 456'); break;
+ case 457: if (n[457]++ > 0) check ('a string 457'); break;
+ case 458: if (n[458]++ > 0) check ('a string 458'); break;
+ case 459: if (n[459]++ > 0) check ('a string 459'); break;
+ case 460: if (n[460]++ > 0) check ('a string 460'); break;
+ case 461: if (n[461]++ > 0) check ('a string 461'); break;
+ case 462: if (n[462]++ > 0) check ('a string 462'); break;
+ case 463: if (n[463]++ > 0) check ('a string 463'); break;
+ case 464: if (n[464]++ > 0) check ('a string 464'); break;
+ case 465: if (n[465]++ > 0) check ('a string 465'); break;
+ case 466: if (n[466]++ > 0) check ('a string 466'); break;
+ case 467: if (n[467]++ > 0) check ('a string 467'); break;
+ case 468: if (n[468]++ > 0) check ('a string 468'); break;
+ case 469: if (n[469]++ > 0) check ('a string 469'); break;
+ case 470: if (n[470]++ > 0) check ('a string 470'); break;
+ case 471: if (n[471]++ > 0) check ('a string 471'); break;
+ case 472: if (n[472]++ > 0) check ('a string 472'); break;
+ case 473: if (n[473]++ > 0) check ('a string 473'); break;
+ case 474: if (n[474]++ > 0) check ('a string 474'); break;
+ case 475: if (n[475]++ > 0) check ('a string 475'); break;
+ case 476: if (n[476]++ > 0) check ('a string 476'); break;
+ case 477: if (n[477]++ > 0) check ('a string 477'); break;
+ case 478: if (n[478]++ > 0) check ('a string 478'); break;
+ case 479: if (n[479]++ > 0) check ('a string 479'); break;
+ case 480: if (n[480]++ > 0) check ('a string 480'); break;
+ case 481: if (n[481]++ > 0) check ('a string 481'); break;
+ case 482: if (n[482]++ > 0) check ('a string 482'); break;
+ case 483: if (n[483]++ > 0) check ('a string 483'); break;
+ case 484: if (n[484]++ > 0) check ('a string 484'); break;
+ case 485: if (n[485]++ > 0) check ('a string 485'); break;
+ case 486: if (n[486]++ > 0) check ('a string 486'); break;
+ case 487: if (n[487]++ > 0) check ('a string 487'); break;
+ case 488: if (n[488]++ > 0) check ('a string 488'); break;
+ case 489: if (n[489]++ > 0) check ('a string 489'); break;
+ case 490: if (n[490]++ > 0) check ('a string 490'); break;
+ case 491: if (n[491]++ > 0) check ('a string 491'); break;
+ case 492: if (n[492]++ > 0) check ('a string 492'); break;
+ case 493: if (n[493]++ > 0) check ('a string 493'); break;
+ case 494: if (n[494]++ > 0) check ('a string 494'); break;
+ case 495: if (n[495]++ > 0) check ('a string 495'); break;
+ case 496: if (n[496]++ > 0) check ('a string 496'); break;
+ case 497: if (n[497]++ > 0) check ('a string 497'); break;
+ case 498: if (n[498]++ > 0) check ('a string 498'); break;
+ case 499: if (n[499]++ > 0) check ('a string 499'); break;
+ case 500: if (n[500]++ > 0) check ('a string 500'); break;
+ case 501: if (n[501]++ > 0) check ('a string 501'); break;
+ case 502: if (n[502]++ > 0) check ('a string 502'); break;
+ case 503: if (n[503]++ > 0) check ('a string 503'); break;
+ case 504: if (n[504]++ > 0) check ('a string 504'); break;
+ case 505: if (n[505]++ > 0) check ('a string 505'); break;
+ case 506: if (n[506]++ > 0) check ('a string 506'); break;
+ case 507: if (n[507]++ > 0) check ('a string 507'); break;
+ case 508: if (n[508]++ > 0) check ('a string 508'); break;
+ case 509: if (n[509]++ > 0) check ('a string 509'); break;
+ case 510: if (n[510]++ > 0) check ('a string 510'); break;
+ case 511: if (n[511]++ > 0) check ('a string 511'); break;
+ case 512: if (n[512]++ > 0) check ('a string 512'); break;
+ case 513: if (n[513]++ > 0) check ('a string 513'); break;
+ case 514: if (n[514]++ > 0) check ('a string 514'); break;
+ case 515: if (n[515]++ > 0) check ('a string 515'); break;
+ case 516: if (n[516]++ > 0) check ('a string 516'); break;
+ case 517: if (n[517]++ > 0) check ('a string 517'); break;
+ case 518: if (n[518]++ > 0) check ('a string 518'); break;
+ case 519: if (n[519]++ > 0) check ('a string 519'); break;
+ case 520: if (n[520]++ > 0) check ('a string 520'); break;
+ case 521: if (n[521]++ > 0) check ('a string 521'); break;
+ case 522: if (n[522]++ > 0) check ('a string 522'); break;
+ case 523: if (n[523]++ > 0) check ('a string 523'); break;
+ case 524: if (n[524]++ > 0) check ('a string 524'); break;
+ case 525: if (n[525]++ > 0) check ('a string 525'); break;
+ case 526: if (n[526]++ > 0) check ('a string 526'); break;
+ case 527: if (n[527]++ > 0) check ('a string 527'); break;
+ case 528: if (n[528]++ > 0) check ('a string 528'); break;
+ case 529: if (n[529]++ > 0) check ('a string 529'); break;
+ case 530: if (n[530]++ > 0) check ('a string 530'); break;
+ case 531: if (n[531]++ > 0) check ('a string 531'); break;
+ case 532: if (n[532]++ > 0) check ('a string 532'); break;
+ case 533: if (n[533]++ > 0) check ('a string 533'); break;
+ case 534: if (n[534]++ > 0) check ('a string 534'); break;
+ case 535: if (n[535]++ > 0) check ('a string 535'); break;
+ case 536: if (n[536]++ > 0) check ('a string 536'); break;
+ case 537: if (n[537]++ > 0) check ('a string 537'); break;
+ case 538: if (n[538]++ > 0) check ('a string 538'); break;
+ case 539: if (n[539]++ > 0) check ('a string 539'); break;
+ case 540: if (n[540]++ > 0) check ('a string 540'); break;
+ case 541: if (n[541]++ > 0) check ('a string 541'); break;
+ case 542: if (n[542]++ > 0) check ('a string 542'); break;
+ case 543: if (n[543]++ > 0) check ('a string 543'); break;
+ case 544: if (n[544]++ > 0) check ('a string 544'); break;
+ case 545: if (n[545]++ > 0) check ('a string 545'); break;
+ case 546: if (n[546]++ > 0) check ('a string 546'); break;
+ case 547: if (n[547]++ > 0) check ('a string 547'); break;
+ case 548: if (n[548]++ > 0) check ('a string 548'); break;
+ case 549: if (n[549]++ > 0) check ('a string 549'); break;
+ case 550: if (n[550]++ > 0) check ('a string 550'); break;
+ case 551: if (n[551]++ > 0) check ('a string 551'); break;
+ case 552: if (n[552]++ > 0) check ('a string 552'); break;
+ case 553: if (n[553]++ > 0) check ('a string 553'); break;
+ case 554: if (n[554]++ > 0) check ('a string 554'); break;
+ case 555: if (n[555]++ > 0) check ('a string 555'); break;
+ case 556: if (n[556]++ > 0) check ('a string 556'); break;
+ case 557: if (n[557]++ > 0) check ('a string 557'); break;
+ case 558: if (n[558]++ > 0) check ('a string 558'); break;
+ case 559: if (n[559]++ > 0) check ('a string 559'); break;
+ case 560: if (n[560]++ > 0) check ('a string 560'); break;
+ case 561: if (n[561]++ > 0) check ('a string 561'); break;
+ case 562: if (n[562]++ > 0) check ('a string 562'); break;
+ case 563: if (n[563]++ > 0) check ('a string 563'); break;
+ case 564: if (n[564]++ > 0) check ('a string 564'); break;
+ case 565: if (n[565]++ > 0) check ('a string 565'); break;
+ case 566: if (n[566]++ > 0) check ('a string 566'); break;
+ case 567: if (n[567]++ > 0) check ('a string 567'); break;
+ case 568: if (n[568]++ > 0) check ('a string 568'); break;
+ case 569: if (n[569]++ > 0) check ('a string 569'); break;
+ case 570: if (n[570]++ > 0) check ('a string 570'); break;
+ case 571: if (n[571]++ > 0) check ('a string 571'); break;
+ case 572: if (n[572]++ > 0) check ('a string 572'); break;
+ case 573: if (n[573]++ > 0) check ('a string 573'); break;
+ case 574: if (n[574]++ > 0) check ('a string 574'); break;
+ case 575: if (n[575]++ > 0) check ('a string 575'); break;
+ case 576: if (n[576]++ > 0) check ('a string 576'); break;
+ case 577: if (n[577]++ > 0) check ('a string 577'); break;
+ case 578: if (n[578]++ > 0) check ('a string 578'); break;
+ case 579: if (n[579]++ > 0) check ('a string 579'); break;
+ case 580: if (n[580]++ > 0) check ('a string 580'); break;
+ case 581: if (n[581]++ > 0) check ('a string 581'); break;
+ case 582: if (n[582]++ > 0) check ('a string 582'); break;
+ case 583: if (n[583]++ > 0) check ('a string 583'); break;
+ case 584: if (n[584]++ > 0) check ('a string 584'); break;
+ case 585: if (n[585]++ > 0) check ('a string 585'); break;
+ case 586: if (n[586]++ > 0) check ('a string 586'); break;
+ case 587: if (n[587]++ > 0) check ('a string 587'); break;
+ case 588: if (n[588]++ > 0) check ('a string 588'); break;
+ case 589: if (n[589]++ > 0) check ('a string 589'); break;
+ case 590: if (n[590]++ > 0) check ('a string 590'); break;
+ case 591: if (n[591]++ > 0) check ('a string 591'); break;
+ case 592: if (n[592]++ > 0) check ('a string 592'); break;
+ case 593: if (n[593]++ > 0) check ('a string 593'); break;
+ case 594: if (n[594]++ > 0) check ('a string 594'); break;
+ case 595: if (n[595]++ > 0) check ('a string 595'); break;
+ case 596: if (n[596]++ > 0) check ('a string 596'); break;
+ case 597: if (n[597]++ > 0) check ('a string 597'); break;
+ case 598: if (n[598]++ > 0) check ('a string 598'); break;
+ case 599: if (n[599]++ > 0) check ('a string 599'); break;
+ case 600: if (n[600]++ > 0) check ('a string 600'); break;
+ case 601: if (n[601]++ > 0) check ('a string 601'); break;
+ case 602: if (n[602]++ > 0) check ('a string 602'); break;
+ case 603: if (n[603]++ > 0) check ('a string 603'); break;
+ case 604: if (n[604]++ > 0) check ('a string 604'); break;
+ case 605: if (n[605]++ > 0) check ('a string 605'); break;
+ case 606: if (n[606]++ > 0) check ('a string 606'); break;
+ case 607: if (n[607]++ > 0) check ('a string 607'); break;
+ case 608: if (n[608]++ > 0) check ('a string 608'); break;
+ case 609: if (n[609]++ > 0) check ('a string 609'); break;
+ case 610: if (n[610]++ > 0) check ('a string 610'); break;
+ case 611: if (n[611]++ > 0) check ('a string 611'); break;
+ case 612: if (n[612]++ > 0) check ('a string 612'); break;
+ case 613: if (n[613]++ > 0) check ('a string 613'); break;
+ case 614: if (n[614]++ > 0) check ('a string 614'); break;
+ case 615: if (n[615]++ > 0) check ('a string 615'); break;
+ case 616: if (n[616]++ > 0) check ('a string 616'); break;
+ case 617: if (n[617]++ > 0) check ('a string 617'); break;
+ case 618: if (n[618]++ > 0) check ('a string 618'); break;
+ case 619: if (n[619]++ > 0) check ('a string 619'); break;
+ case 620: if (n[620]++ > 0) check ('a string 620'); break;
+ case 621: if (n[621]++ > 0) check ('a string 621'); break;
+ case 622: if (n[622]++ > 0) check ('a string 622'); break;
+ case 623: if (n[623]++ > 0) check ('a string 623'); break;
+ case 624: if (n[624]++ > 0) check ('a string 624'); break;
+ case 625: if (n[625]++ > 0) check ('a string 625'); break;
+ case 626: if (n[626]++ > 0) check ('a string 626'); break;
+ case 627: if (n[627]++ > 0) check ('a string 627'); break;
+ case 628: if (n[628]++ > 0) check ('a string 628'); break;
+ case 629: if (n[629]++ > 0) check ('a string 629'); break;
+ case 630: if (n[630]++ > 0) check ('a string 630'); break;
+ case 631: if (n[631]++ > 0) check ('a string 631'); break;
+ case 632: if (n[632]++ > 0) check ('a string 632'); break;
+ case 633: if (n[633]++ > 0) check ('a string 633'); break;
+ case 634: if (n[634]++ > 0) check ('a string 634'); break;
+ case 635: if (n[635]++ > 0) check ('a string 635'); break;
+ case 636: if (n[636]++ > 0) check ('a string 636'); break;
+ case 637: if (n[637]++ > 0) check ('a string 637'); break;
+ case 638: if (n[638]++ > 0) check ('a string 638'); break;
+ case 639: if (n[639]++ > 0) check ('a string 639'); break;
+ case 640: if (n[640]++ > 0) check ('a string 640'); break;
+ case 641: if (n[641]++ > 0) check ('a string 641'); break;
+ case 642: if (n[642]++ > 0) check ('a string 642'); break;
+ case 643: if (n[643]++ > 0) check ('a string 643'); break;
+ case 644: if (n[644]++ > 0) check ('a string 644'); break;
+ case 645: if (n[645]++ > 0) check ('a string 645'); break;
+ case 646: if (n[646]++ > 0) check ('a string 646'); break;
+ case 647: if (n[647]++ > 0) check ('a string 647'); break;
+ case 648: if (n[648]++ > 0) check ('a string 648'); break;
+ case 649: if (n[649]++ > 0) check ('a string 649'); break;
+ case 650: if (n[650]++ > 0) check ('a string 650'); break;
+ case 651: if (n[651]++ > 0) check ('a string 651'); break;
+ case 652: if (n[652]++ > 0) check ('a string 652'); break;
+ case 653: if (n[653]++ > 0) check ('a string 653'); break;
+ case 654: if (n[654]++ > 0) check ('a string 654'); break;
+ case 655: if (n[655]++ > 0) check ('a string 655'); break;
+ case 656: if (n[656]++ > 0) check ('a string 656'); break;
+ case 657: if (n[657]++ > 0) check ('a string 657'); break;
+ case 658: if (n[658]++ > 0) check ('a string 658'); break;
+ case 659: if (n[659]++ > 0) check ('a string 659'); break;
+ case 660: if (n[660]++ > 0) check ('a string 660'); break;
+ case 661: if (n[661]++ > 0) check ('a string 661'); break;
+ case 662: if (n[662]++ > 0) check ('a string 662'); break;
+ case 663: if (n[663]++ > 0) check ('a string 663'); break;
+ case 664: if (n[664]++ > 0) check ('a string 664'); break;
+ case 665: if (n[665]++ > 0) check ('a string 665'); break;
+ case 666: if (n[666]++ > 0) check ('a string 666'); break;
+ case 667: if (n[667]++ > 0) check ('a string 667'); break;
+ case 668: if (n[668]++ > 0) check ('a string 668'); break;
+ case 669: if (n[669]++ > 0) check ('a string 669'); break;
+ case 670: if (n[670]++ > 0) check ('a string 670'); break;
+ case 671: if (n[671]++ > 0) check ('a string 671'); break;
+ case 672: if (n[672]++ > 0) check ('a string 672'); break;
+ case 673: if (n[673]++ > 0) check ('a string 673'); break;
+ case 674: if (n[674]++ > 0) check ('a string 674'); break;
+ case 675: if (n[675]++ > 0) check ('a string 675'); break;
+ case 676: if (n[676]++ > 0) check ('a string 676'); break;
+ case 677: if (n[677]++ > 0) check ('a string 677'); break;
+ case 678: if (n[678]++ > 0) check ('a string 678'); break;
+ case 679: if (n[679]++ > 0) check ('a string 679'); break;
+ case 680: if (n[680]++ > 0) check ('a string 680'); break;
+ case 681: if (n[681]++ > 0) check ('a string 681'); break;
+ case 682: if (n[682]++ > 0) check ('a string 682'); break;
+ case 683: if (n[683]++ > 0) check ('a string 683'); break;
+ case 684: if (n[684]++ > 0) check ('a string 684'); break;
+ case 685: if (n[685]++ > 0) check ('a string 685'); break;
+ case 686: if (n[686]++ > 0) check ('a string 686'); break;
+ case 687: if (n[687]++ > 0) check ('a string 687'); break;
+ case 688: if (n[688]++ > 0) check ('a string 688'); break;
+ case 689: if (n[689]++ > 0) check ('a string 689'); break;
+ case 690: if (n[690]++ > 0) check ('a string 690'); break;
+ case 691: if (n[691]++ > 0) check ('a string 691'); break;
+ case 692: if (n[692]++ > 0) check ('a string 692'); break;
+ case 693: if (n[693]++ > 0) check ('a string 693'); break;
+ case 694: if (n[694]++ > 0) check ('a string 694'); break;
+ case 695: if (n[695]++ > 0) check ('a string 695'); break;
+ case 696: if (n[696]++ > 0) check ('a string 696'); break;
+ case 697: if (n[697]++ > 0) check ('a string 697'); break;
+ case 698: if (n[698]++ > 0) check ('a string 698'); break;
+ case 699: if (n[699]++ > 0) check ('a string 699'); break;
+ case 700: if (n[700]++ > 0) check ('a string 700'); break;
+ case 701: if (n[701]++ > 0) check ('a string 701'); break;
+ case 702: if (n[702]++ > 0) check ('a string 702'); break;
+ case 703: if (n[703]++ > 0) check ('a string 703'); break;
+ case 704: if (n[704]++ > 0) check ('a string 704'); break;
+ case 705: if (n[705]++ > 0) check ('a string 705'); break;
+ case 706: if (n[706]++ > 0) check ('a string 706'); break;
+ case 707: if (n[707]++ > 0) check ('a string 707'); break;
+ case 708: if (n[708]++ > 0) check ('a string 708'); break;
+ case 709: if (n[709]++ > 0) check ('a string 709'); break;
+ case 710: if (n[710]++ > 0) check ('a string 710'); break;
+ case 711: if (n[711]++ > 0) check ('a string 711'); break;
+ case 712: if (n[712]++ > 0) check ('a string 712'); break;
+ case 713: if (n[713]++ > 0) check ('a string 713'); break;
+ case 714: if (n[714]++ > 0) check ('a string 714'); break;
+ case 715: if (n[715]++ > 0) check ('a string 715'); break;
+ case 716: if (n[716]++ > 0) check ('a string 716'); break;
+ case 717: if (n[717]++ > 0) check ('a string 717'); break;
+ case 718: if (n[718]++ > 0) check ('a string 718'); break;
+ case 719: if (n[719]++ > 0) check ('a string 719'); break;
+ case 720: if (n[720]++ > 0) check ('a string 720'); break;
+ case 721: if (n[721]++ > 0) check ('a string 721'); break;
+ case 722: if (n[722]++ > 0) check ('a string 722'); break;
+ case 723: if (n[723]++ > 0) check ('a string 723'); break;
+ case 724: if (n[724]++ > 0) check ('a string 724'); break;
+ case 725: if (n[725]++ > 0) check ('a string 725'); break;
+ case 726: if (n[726]++ > 0) check ('a string 726'); break;
+ case 727: if (n[727]++ > 0) check ('a string 727'); break;
+ case 728: if (n[728]++ > 0) check ('a string 728'); break;
+ case 729: if (n[729]++ > 0) check ('a string 729'); break;
+ case 730: if (n[730]++ > 0) check ('a string 730'); break;
+ case 731: if (n[731]++ > 0) check ('a string 731'); break;
+ case 732: if (n[732]++ > 0) check ('a string 732'); break;
+ case 733: if (n[733]++ > 0) check ('a string 733'); break;
+ case 734: if (n[734]++ > 0) check ('a string 734'); break;
+ case 735: if (n[735]++ > 0) check ('a string 735'); break;
+ case 736: if (n[736]++ > 0) check ('a string 736'); break;
+ case 737: if (n[737]++ > 0) check ('a string 737'); break;
+ case 738: if (n[738]++ > 0) check ('a string 738'); break;
+ case 739: if (n[739]++ > 0) check ('a string 739'); break;
+ case 740: if (n[740]++ > 0) check ('a string 740'); break;
+ case 741: if (n[741]++ > 0) check ('a string 741'); break;
+ case 742: if (n[742]++ > 0) check ('a string 742'); break;
+ case 743: if (n[743]++ > 0) check ('a string 743'); break;
+ case 744: if (n[744]++ > 0) check ('a string 744'); break;
+ case 745: if (n[745]++ > 0) check ('a string 745'); break;
+ case 746: if (n[746]++ > 0) check ('a string 746'); break;
+ case 747: if (n[747]++ > 0) check ('a string 747'); break;
+ case 748: if (n[748]++ > 0) check ('a string 748'); break;
+ case 749: if (n[749]++ > 0) check ('a string 749'); break;
+ case 750: if (n[750]++ > 0) check ('a string 750'); break;
+ case 751: if (n[751]++ > 0) check ('a string 751'); break;
+ case 752: if (n[752]++ > 0) check ('a string 752'); break;
+ case 753: if (n[753]++ > 0) check ('a string 753'); break;
+ case 754: if (n[754]++ > 0) check ('a string 754'); break;
+ case 755: if (n[755]++ > 0) check ('a string 755'); break;
+ case 756: if (n[756]++ > 0) check ('a string 756'); break;
+ case 757: if (n[757]++ > 0) check ('a string 757'); break;
+ case 758: if (n[758]++ > 0) check ('a string 758'); break;
+ case 759: if (n[759]++ > 0) check ('a string 759'); break;
+ case 760: if (n[760]++ > 0) check ('a string 760'); break;
+ case 761: if (n[761]++ > 0) check ('a string 761'); break;
+ case 762: if (n[762]++ > 0) check ('a string 762'); break;
+ case 763: if (n[763]++ > 0) check ('a string 763'); break;
+ case 764: if (n[764]++ > 0) check ('a string 764'); break;
+ case 765: if (n[765]++ > 0) check ('a string 765'); break;
+ case 766: if (n[766]++ > 0) check ('a string 766'); break;
+ case 767: if (n[767]++ > 0) check ('a string 767'); break;
+ case 768: if (n[768]++ > 0) check ('a string 768'); break;
+ case 769: if (n[769]++ > 0) check ('a string 769'); break;
+ case 770: if (n[770]++ > 0) check ('a string 770'); break;
+ case 771: if (n[771]++ > 0) check ('a string 771'); break;
+ case 772: if (n[772]++ > 0) check ('a string 772'); break;
+ case 773: if (n[773]++ > 0) check ('a string 773'); break;
+ case 774: if (n[774]++ > 0) check ('a string 774'); break;
+ case 775: if (n[775]++ > 0) check ('a string 775'); break;
+ case 776: if (n[776]++ > 0) check ('a string 776'); break;
+ case 777: if (n[777]++ > 0) check ('a string 777'); break;
+ case 778: if (n[778]++ > 0) check ('a string 778'); break;
+ case 779: if (n[779]++ > 0) check ('a string 779'); break;
+ case 780: if (n[780]++ > 0) check ('a string 780'); break;
+ case 781: if (n[781]++ > 0) check ('a string 781'); break;
+ case 782: if (n[782]++ > 0) check ('a string 782'); break;
+ case 783: if (n[783]++ > 0) check ('a string 783'); break;
+ case 784: if (n[784]++ > 0) check ('a string 784'); break;
+ case 785: if (n[785]++ > 0) check ('a string 785'); break;
+ case 786: if (n[786]++ > 0) check ('a string 786'); break;
+ case 787: if (n[787]++ > 0) check ('a string 787'); break;
+ case 788: if (n[788]++ > 0) check ('a string 788'); break;
+ case 789: if (n[789]++ > 0) check ('a string 789'); break;
+ case 790: if (n[790]++ > 0) check ('a string 790'); break;
+ case 791: if (n[791]++ > 0) check ('a string 791'); break;
+ case 792: if (n[792]++ > 0) check ('a string 792'); break;
+ case 793: if (n[793]++ > 0) check ('a string 793'); break;
+ case 794: if (n[794]++ > 0) check ('a string 794'); break;
+ case 795: if (n[795]++ > 0) check ('a string 795'); break;
+ case 796: if (n[796]++ > 0) check ('a string 796'); break;
+ case 797: if (n[797]++ > 0) check ('a string 797'); break;
+ case 798: if (n[798]++ > 0) check ('a string 798'); break;
+ case 799: if (n[799]++ > 0) check ('a string 799'); break;
+ case 800: if (n[800]++ > 0) check ('a string 800'); break;
+ case 801: if (n[801]++ > 0) check ('a string 801'); break;
+ case 802: if (n[802]++ > 0) check ('a string 802'); break;
+ case 803: if (n[803]++ > 0) check ('a string 803'); break;
+ case 804: if (n[804]++ > 0) check ('a string 804'); break;
+ case 805: if (n[805]++ > 0) check ('a string 805'); break;
+ case 806: if (n[806]++ > 0) check ('a string 806'); break;
+ case 807: if (n[807]++ > 0) check ('a string 807'); break;
+ case 808: if (n[808]++ > 0) check ('a string 808'); break;
+ case 809: if (n[809]++ > 0) check ('a string 809'); break;
+ case 810: if (n[810]++ > 0) check ('a string 810'); break;
+ case 811: if (n[811]++ > 0) check ('a string 811'); break;
+ case 812: if (n[812]++ > 0) check ('a string 812'); break;
+ case 813: if (n[813]++ > 0) check ('a string 813'); break;
+ case 814: if (n[814]++ > 0) check ('a string 814'); break;
+ case 815: if (n[815]++ > 0) check ('a string 815'); break;
+ case 816: if (n[816]++ > 0) check ('a string 816'); break;
+ case 817: if (n[817]++ > 0) check ('a string 817'); break;
+ case 818: if (n[818]++ > 0) check ('a string 818'); break;
+ case 819: if (n[819]++ > 0) check ('a string 819'); break;
+ case 820: if (n[820]++ > 0) check ('a string 820'); break;
+ case 821: if (n[821]++ > 0) check ('a string 821'); break;
+ case 822: if (n[822]++ > 0) check ('a string 822'); break;
+ case 823: if (n[823]++ > 0) check ('a string 823'); break;
+ case 824: if (n[824]++ > 0) check ('a string 824'); break;
+ case 825: if (n[825]++ > 0) check ('a string 825'); break;
+ case 826: if (n[826]++ > 0) check ('a string 826'); break;
+ case 827: if (n[827]++ > 0) check ('a string 827'); break;
+ case 828: if (n[828]++ > 0) check ('a string 828'); break;
+ case 829: if (n[829]++ > 0) check ('a string 829'); break;
+ case 830: if (n[830]++ > 0) check ('a string 830'); break;
+ case 831: if (n[831]++ > 0) check ('a string 831'); break;
+ case 832: if (n[832]++ > 0) check ('a string 832'); break;
+ case 833: if (n[833]++ > 0) check ('a string 833'); break;
+ case 834: if (n[834]++ > 0) check ('a string 834'); break;
+ case 835: if (n[835]++ > 0) check ('a string 835'); break;
+ case 836: if (n[836]++ > 0) check ('a string 836'); break;
+ case 837: if (n[837]++ > 0) check ('a string 837'); break;
+ case 838: if (n[838]++ > 0) check ('a string 838'); break;
+ case 839: if (n[839]++ > 0) check ('a string 839'); break;
+ case 840: if (n[840]++ > 0) check ('a string 840'); break;
+ case 841: if (n[841]++ > 0) check ('a string 841'); break;
+ case 842: if (n[842]++ > 0) check ('a string 842'); break;
+ case 843: if (n[843]++ > 0) check ('a string 843'); break;
+ case 844: if (n[844]++ > 0) check ('a string 844'); break;
+ case 845: if (n[845]++ > 0) check ('a string 845'); break;
+ case 846: if (n[846]++ > 0) check ('a string 846'); break;
+ case 847: if (n[847]++ > 0) check ('a string 847'); break;
+ case 848: if (n[848]++ > 0) check ('a string 848'); break;
+ case 849: if (n[849]++ > 0) check ('a string 849'); break;
+ case 850: if (n[850]++ > 0) check ('a string 850'); break;
+ case 851: if (n[851]++ > 0) check ('a string 851'); break;
+ case 852: if (n[852]++ > 0) check ('a string 852'); break;
+ case 853: if (n[853]++ > 0) check ('a string 853'); break;
+ case 854: if (n[854]++ > 0) check ('a string 854'); break;
+ case 855: if (n[855]++ > 0) check ('a string 855'); break;
+ case 856: if (n[856]++ > 0) check ('a string 856'); break;
+ case 857: if (n[857]++ > 0) check ('a string 857'); break;
+ case 858: if (n[858]++ > 0) check ('a string 858'); break;
+ case 859: if (n[859]++ > 0) check ('a string 859'); break;
+ case 860: if (n[860]++ > 0) check ('a string 860'); break;
+ case 861: if (n[861]++ > 0) check ('a string 861'); break;
+ case 862: if (n[862]++ > 0) check ('a string 862'); break;
+ case 863: if (n[863]++ > 0) check ('a string 863'); break;
+ case 864: if (n[864]++ > 0) check ('a string 864'); break;
+ case 865: if (n[865]++ > 0) check ('a string 865'); break;
+ case 866: if (n[866]++ > 0) check ('a string 866'); break;
+ case 867: if (n[867]++ > 0) check ('a string 867'); break;
+ case 868: if (n[868]++ > 0) check ('a string 868'); break;
+ case 869: if (n[869]++ > 0) check ('a string 869'); break;
+ case 870: if (n[870]++ > 0) check ('a string 870'); break;
+ case 871: if (n[871]++ > 0) check ('a string 871'); break;
+ case 872: if (n[872]++ > 0) check ('a string 872'); break;
+ case 873: if (n[873]++ > 0) check ('a string 873'); break;
+ case 874: if (n[874]++ > 0) check ('a string 874'); break;
+ case 875: if (n[875]++ > 0) check ('a string 875'); break;
+ case 876: if (n[876]++ > 0) check ('a string 876'); break;
+ case 877: if (n[877]++ > 0) check ('a string 877'); break;
+ case 878: if (n[878]++ > 0) check ('a string 878'); break;
+ case 879: if (n[879]++ > 0) check ('a string 879'); break;
+ case 880: if (n[880]++ > 0) check ('a string 880'); break;
+ case 881: if (n[881]++ > 0) check ('a string 881'); break;
+ case 882: if (n[882]++ > 0) check ('a string 882'); break;
+ case 883: if (n[883]++ > 0) check ('a string 883'); break;
+ case 884: if (n[884]++ > 0) check ('a string 884'); break;
+ case 885: if (n[885]++ > 0) check ('a string 885'); break;
+ case 886: if (n[886]++ > 0) check ('a string 886'); break;
+ case 887: if (n[887]++ > 0) check ('a string 887'); break;
+ case 888: if (n[888]++ > 0) check ('a string 888'); break;
+ case 889: if (n[889]++ > 0) check ('a string 889'); break;
+ case 890: if (n[890]++ > 0) check ('a string 890'); break;
+ case 891: if (n[891]++ > 0) check ('a string 891'); break;
+ case 892: if (n[892]++ > 0) check ('a string 892'); break;
+ case 893: if (n[893]++ > 0) check ('a string 893'); break;
+ case 894: if (n[894]++ > 0) check ('a string 894'); break;
+ case 895: if (n[895]++ > 0) check ('a string 895'); break;
+ case 896: if (n[896]++ > 0) check ('a string 896'); break;
+ case 897: if (n[897]++ > 0) check ('a string 897'); break;
+ case 898: if (n[898]++ > 0) check ('a string 898'); break;
+ case 899: if (n[899]++ > 0) check ('a string 899'); break;
+ case 900: if (n[900]++ > 0) check ('a string 900'); break;
+ case 901: if (n[901]++ > 0) check ('a string 901'); break;
+ case 902: if (n[902]++ > 0) check ('a string 902'); break;
+ case 903: if (n[903]++ > 0) check ('a string 903'); break;
+ case 904: if (n[904]++ > 0) check ('a string 904'); break;
+ case 905: if (n[905]++ > 0) check ('a string 905'); break;
+ case 906: if (n[906]++ > 0) check ('a string 906'); break;
+ case 907: if (n[907]++ > 0) check ('a string 907'); break;
+ case 908: if (n[908]++ > 0) check ('a string 908'); break;
+ case 909: if (n[909]++ > 0) check ('a string 909'); break;
+ case 910: if (n[910]++ > 0) check ('a string 910'); break;
+ case 911: if (n[911]++ > 0) check ('a string 911'); break;
+ case 912: if (n[912]++ > 0) check ('a string 912'); break;
+ case 913: if (n[913]++ > 0) check ('a string 913'); break;
+ case 914: if (n[914]++ > 0) check ('a string 914'); break;
+ case 915: if (n[915]++ > 0) check ('a string 915'); break;
+ case 916: if (n[916]++ > 0) check ('a string 916'); break;
+ case 917: if (n[917]++ > 0) check ('a string 917'); break;
+ case 918: if (n[918]++ > 0) check ('a string 918'); break;
+ case 919: if (n[919]++ > 0) check ('a string 919'); break;
+ case 920: if (n[920]++ > 0) check ('a string 920'); break;
+ case 921: if (n[921]++ > 0) check ('a string 921'); break;
+ case 922: if (n[922]++ > 0) check ('a string 922'); break;
+ case 923: if (n[923]++ > 0) check ('a string 923'); break;
+ case 924: if (n[924]++ > 0) check ('a string 924'); break;
+ case 925: if (n[925]++ > 0) check ('a string 925'); break;
+ case 926: if (n[926]++ > 0) check ('a string 926'); break;
+ case 927: if (n[927]++ > 0) check ('a string 927'); break;
+ case 928: if (n[928]++ > 0) check ('a string 928'); break;
+ case 929: if (n[929]++ > 0) check ('a string 929'); break;
+ case 930: if (n[930]++ > 0) check ('a string 930'); break;
+ case 931: if (n[931]++ > 0) check ('a string 931'); break;
+ case 932: if (n[932]++ > 0) check ('a string 932'); break;
+ case 933: if (n[933]++ > 0) check ('a string 933'); break;
+ case 934: if (n[934]++ > 0) check ('a string 934'); break;
+ case 935: if (n[935]++ > 0) check ('a string 935'); break;
+ case 936: if (n[936]++ > 0) check ('a string 936'); break;
+ case 937: if (n[937]++ > 0) check ('a string 937'); break;
+ case 938: if (n[938]++ > 0) check ('a string 938'); break;
+ case 939: if (n[939]++ > 0) check ('a string 939'); break;
+ case 940: if (n[940]++ > 0) check ('a string 940'); break;
+ case 941: if (n[941]++ > 0) check ('a string 941'); break;
+ case 942: if (n[942]++ > 0) check ('a string 942'); break;
+ case 943: if (n[943]++ > 0) check ('a string 943'); break;
+ case 944: if (n[944]++ > 0) check ('a string 944'); break;
+ case 945: if (n[945]++ > 0) check ('a string 945'); break;
+ case 946: if (n[946]++ > 0) check ('a string 946'); break;
+ case 947: if (n[947]++ > 0) check ('a string 947'); break;
+ case 948: if (n[948]++ > 0) check ('a string 948'); break;
+ case 949: if (n[949]++ > 0) check ('a string 949'); break;
+ case 950: if (n[950]++ > 0) check ('a string 950'); break;
+ case 951: if (n[951]++ > 0) check ('a string 951'); break;
+ case 952: if (n[952]++ > 0) check ('a string 952'); break;
+ case 953: if (n[953]++ > 0) check ('a string 953'); break;
+ case 954: if (n[954]++ > 0) check ('a string 954'); break;
+ case 955: if (n[955]++ > 0) check ('a string 955'); break;
+ case 956: if (n[956]++ > 0) check ('a string 956'); break;
+ case 957: if (n[957]++ > 0) check ('a string 957'); break;
+ case 958: if (n[958]++ > 0) check ('a string 958'); break;
+ case 959: if (n[959]++ > 0) check ('a string 959'); break;
+ case 960: if (n[960]++ > 0) check ('a string 960'); break;
+ case 961: if (n[961]++ > 0) check ('a string 961'); break;
+ case 962: if (n[962]++ > 0) check ('a string 962'); break;
+ case 963: if (n[963]++ > 0) check ('a string 963'); break;
+ case 964: if (n[964]++ > 0) check ('a string 964'); break;
+ case 965: if (n[965]++ > 0) check ('a string 965'); break;
+ case 966: if (n[966]++ > 0) check ('a string 966'); break;
+ case 967: if (n[967]++ > 0) check ('a string 967'); break;
+ case 968: if (n[968]++ > 0) check ('a string 968'); break;
+ case 969: if (n[969]++ > 0) check ('a string 969'); break;
+ case 970: if (n[970]++ > 0) check ('a string 970'); break;
+ case 971: if (n[971]++ > 0) check ('a string 971'); break;
+ case 972: if (n[972]++ > 0) check ('a string 972'); break;
+ case 973: if (n[973]++ > 0) check ('a string 973'); break;
+ case 974: if (n[974]++ > 0) check ('a string 974'); break;
+ case 975: if (n[975]++ > 0) check ('a string 975'); break;
+ case 976: if (n[976]++ > 0) check ('a string 976'); break;
+ case 977: if (n[977]++ > 0) check ('a string 977'); break;
+ case 978: if (n[978]++ > 0) check ('a string 978'); break;
+ case 979: if (n[979]++ > 0) check ('a string 979'); break;
+ case 980: if (n[980]++ > 0) check ('a string 980'); break;
+ case 981: if (n[981]++ > 0) check ('a string 981'); break;
+ case 982: if (n[982]++ > 0) check ('a string 982'); break;
+ case 983: if (n[983]++ > 0) check ('a string 983'); break;
+ case 984: if (n[984]++ > 0) check ('a string 984'); break;
+ case 985: if (n[985]++ > 0) check ('a string 985'); break;
+ case 986: if (n[986]++ > 0) check ('a string 986'); break;
+ case 987: if (n[987]++ > 0) check ('a string 987'); break;
+ case 988: if (n[988]++ > 0) check ('a string 988'); break;
+ case 989: if (n[989]++ > 0) check ('a string 989'); break;
+ case 990: if (n[990]++ > 0) check ('a string 990'); break;
+ case 991: if (n[991]++ > 0) check ('a string 991'); break;
+ case 992: if (n[992]++ > 0) check ('a string 992'); break;
+ case 993: if (n[993]++ > 0) check ('a string 993'); break;
+ case 994: if (n[994]++ > 0) check ('a string 994'); break;
+ case 995: if (n[995]++ > 0) check ('a string 995'); break;
+ case 996: if (n[996]++ > 0) check ('a string 996'); break;
+ case 997: if (n[997]++ > 0) check ('a string 997'); break;
+ case 998: if (n[998]++ > 0) check ('a string 998'); break;
+ case 999: if (n[999]++ > 0) check ('a string 999'); break;
+ case 1000: if (n[1000]++ > 0) check ('a string 1000'); break;
+ case 1001: if (n[1001]++ > 0) check ('a string 1001'); break;
+ case 1002: if (n[1002]++ > 0) check ('a string 1002'); break;
+ case 1003: if (n[1003]++ > 0) check ('a string 1003'); break;
+ case 1004: if (n[1004]++ > 0) check ('a string 1004'); break;
+ case 1005: if (n[1005]++ > 0) check ('a string 1005'); break;
+ case 1006: if (n[1006]++ > 0) check ('a string 1006'); break;
+ case 1007: if (n[1007]++ > 0) check ('a string 1007'); break;
+ case 1008: if (n[1008]++ > 0) check ('a string 1008'); break;
+ case 1009: if (n[1009]++ > 0) check ('a string 1009'); break;
+ case 1010: if (n[1010]++ > 0) check ('a string 1010'); break;
+ case 1011: if (n[1011]++ > 0) check ('a string 1011'); break;
+ case 1012: if (n[1012]++ > 0) check ('a string 1012'); break;
+ case 1013: if (n[1013]++ > 0) check ('a string 1013'); break;
+ case 1014: if (n[1014]++ > 0) check ('a string 1014'); break;
+ case 1015: if (n[1015]++ > 0) check ('a string 1015'); break;
+ case 1016: if (n[1016]++ > 0) check ('a string 1016'); break;
+ case 1017: if (n[1017]++ > 0) check ('a string 1017'); break;
+ case 1018: if (n[1018]++ > 0) check ('a string 1018'); break;
+ case 1019: if (n[1019]++ > 0) check ('a string 1019'); break;
+ case 1020: if (n[1020]++ > 0) check ('a string 1020'); break;
+ case 1021: if (n[1021]++ > 0) check ('a string 1021'); break;
+ case 1022: if (n[1022]++ > 0) check ('a string 1022'); break;
+ case 1023: if (n[1023]++ > 0) check ('a string 1023'); break;
+ case 1024: if (n[1024]++ > 0) check ('a string 1024'); break;
+ case 1025: if (n[1025]++ > 0) check ('a string 1025'); break;
+ case 1026: if (n[1026]++ > 0) check ('a string 1026'); break;
+ case 1027: if (n[1027]++ > 0) check ('a string 1027'); break;
+ case 1028: if (n[1028]++ > 0) check ('a string 1028'); break;
+ case 1029: if (n[1029]++ > 0) check ('a string 1029'); break;
+ case 1030: if (n[1030]++ > 0) check ('a string 1030'); break;
+ case 1031: if (n[1031]++ > 0) check ('a string 1031'); break;
+ case 1032: if (n[1032]++ > 0) check ('a string 1032'); break;
+ case 1033: if (n[1033]++ > 0) check ('a string 1033'); break;
+ case 1034: if (n[1034]++ > 0) check ('a string 1034'); break;
+ case 1035: if (n[1035]++ > 0) check ('a string 1035'); break;
+ case 1036: if (n[1036]++ > 0) check ('a string 1036'); break;
+ case 1037: if (n[1037]++ > 0) check ('a string 1037'); break;
+ case 1038: if (n[1038]++ > 0) check ('a string 1038'); break;
+ case 1039: if (n[1039]++ > 0) check ('a string 1039'); break;
+ case 1040: if (n[1040]++ > 0) check ('a string 1040'); break;
+ case 1041: if (n[1041]++ > 0) check ('a string 1041'); break;
+ case 1042: if (n[1042]++ > 0) check ('a string 1042'); break;
+ case 1043: if (n[1043]++ > 0) check ('a string 1043'); break;
+ case 1044: if (n[1044]++ > 0) check ('a string 1044'); break;
+ case 1045: if (n[1045]++ > 0) check ('a string 1045'); break;
+ case 1046: if (n[1046]++ > 0) check ('a string 1046'); break;
+ case 1047: if (n[1047]++ > 0) check ('a string 1047'); break;
+ case 1048: if (n[1048]++ > 0) check ('a string 1048'); break;
+ case 1049: if (n[1049]++ > 0) check ('a string 1049'); break;
+ case 1050: if (n[1050]++ > 0) check ('a string 1050'); break;
+ case 1051: if (n[1051]++ > 0) check ('a string 1051'); break;
+ case 1052: if (n[1052]++ > 0) check ('a string 1052'); break;
+ case 1053: if (n[1053]++ > 0) check ('a string 1053'); break;
+ case 1054: if (n[1054]++ > 0) check ('a string 1054'); break;
+ case 1055: if (n[1055]++ > 0) check ('a string 1055'); break;
+ case 1056: if (n[1056]++ > 0) check ('a string 1056'); break;
+ case 1057: if (n[1057]++ > 0) check ('a string 1057'); break;
+ case 1058: if (n[1058]++ > 0) check ('a string 1058'); break;
+ case 1059: if (n[1059]++ > 0) check ('a string 1059'); break;
+ case 1060: if (n[1060]++ > 0) check ('a string 1060'); break;
+ case 1061: if (n[1061]++ > 0) check ('a string 1061'); break;
+ case 1062: if (n[1062]++ > 0) check ('a string 1062'); break;
+ case 1063: if (n[1063]++ > 0) check ('a string 1063'); break;
+ case 1064: if (n[1064]++ > 0) check ('a string 1064'); break;
+ case 1065: if (n[1065]++ > 0) check ('a string 1065'); break;
+ case 1066: if (n[1066]++ > 0) check ('a string 1066'); break;
+ case 1067: if (n[1067]++ > 0) check ('a string 1067'); break;
+ case 1068: if (n[1068]++ > 0) check ('a string 1068'); break;
+ case 1069: if (n[1069]++ > 0) check ('a string 1069'); break;
+ case 1070: if (n[1070]++ > 0) check ('a string 1070'); break;
+ case 1071: if (n[1071]++ > 0) check ('a string 1071'); break;
+ case 1072: if (n[1072]++ > 0) check ('a string 1072'); break;
+ case 1073: if (n[1073]++ > 0) check ('a string 1073'); break;
+ case 1074: if (n[1074]++ > 0) check ('a string 1074'); break;
+ case 1075: if (n[1075]++ > 0) check ('a string 1075'); break;
+ case 1076: if (n[1076]++ > 0) check ('a string 1076'); break;
+ case 1077: if (n[1077]++ > 0) check ('a string 1077'); break;
+ case 1078: if (n[1078]++ > 0) check ('a string 1078'); break;
+ case 1079: if (n[1079]++ > 0) check ('a string 1079'); break;
+ case 1080: if (n[1080]++ > 0) check ('a string 1080'); break;
+ case 1081: if (n[1081]++ > 0) check ('a string 1081'); break;
+ case 1082: if (n[1082]++ > 0) check ('a string 1082'); break;
+ case 1083: if (n[1083]++ > 0) check ('a string 1083'); break;
+ case 1084: if (n[1084]++ > 0) check ('a string 1084'); break;
+ case 1085: if (n[1085]++ > 0) check ('a string 1085'); break;
+ case 1086: if (n[1086]++ > 0) check ('a string 1086'); break;
+ case 1087: if (n[1087]++ > 0) check ('a string 1087'); break;
+ case 1088: if (n[1088]++ > 0) check ('a string 1088'); break;
+ case 1089: if (n[1089]++ > 0) check ('a string 1089'); break;
+ case 1090: if (n[1090]++ > 0) check ('a string 1090'); break;
+ case 1091: if (n[1091]++ > 0) check ('a string 1091'); break;
+ case 1092: if (n[1092]++ > 0) check ('a string 1092'); break;
+ case 1093: if (n[1093]++ > 0) check ('a string 1093'); break;
+ case 1094: if (n[1094]++ > 0) check ('a string 1094'); break;
+ case 1095: if (n[1095]++ > 0) check ('a string 1095'); break;
+ case 1096: if (n[1096]++ > 0) check ('a string 1096'); break;
+ case 1097: if (n[1097]++ > 0) check ('a string 1097'); break;
+ case 1098: if (n[1098]++ > 0) check ('a string 1098'); break;
+ case 1099: if (n[1099]++ > 0) check ('a string 1099'); break;
+ case 1100: if (n[1100]++ > 0) check ('a string 1100'); break;
+ case 1101: if (n[1101]++ > 0) check ('a string 1101'); break;
+ case 1102: if (n[1102]++ > 0) check ('a string 1102'); break;
+ case 1103: if (n[1103]++ > 0) check ('a string 1103'); break;
+ case 1104: if (n[1104]++ > 0) check ('a string 1104'); break;
+ case 1105: if (n[1105]++ > 0) check ('a string 1105'); break;
+ case 1106: if (n[1106]++ > 0) check ('a string 1106'); break;
+ case 1107: if (n[1107]++ > 0) check ('a string 1107'); break;
+ case 1108: if (n[1108]++ > 0) check ('a string 1108'); break;
+ case 1109: if (n[1109]++ > 0) check ('a string 1109'); break;
+ case 1110: if (n[1110]++ > 0) check ('a string 1110'); break;
+ case 1111: if (n[1111]++ > 0) check ('a string 1111'); break;
+ case 1112: if (n[1112]++ > 0) check ('a string 1112'); break;
+ case 1113: if (n[1113]++ > 0) check ('a string 1113'); break;
+ case 1114: if (n[1114]++ > 0) check ('a string 1114'); break;
+ case 1115: if (n[1115]++ > 0) check ('a string 1115'); break;
+ case 1116: if (n[1116]++ > 0) check ('a string 1116'); break;
+ case 1117: if (n[1117]++ > 0) check ('a string 1117'); break;
+ case 1118: if (n[1118]++ > 0) check ('a string 1118'); break;
+ case 1119: if (n[1119]++ > 0) check ('a string 1119'); break;
+ case 1120: if (n[1120]++ > 0) check ('a string 1120'); break;
+ case 1121: if (n[1121]++ > 0) check ('a string 1121'); break;
+ case 1122: if (n[1122]++ > 0) check ('a string 1122'); break;
+ case 1123: if (n[1123]++ > 0) check ('a string 1123'); break;
+ case 1124: if (n[1124]++ > 0) check ('a string 1124'); break;
+ case 1125: if (n[1125]++ > 0) check ('a string 1125'); break;
+ case 1126: if (n[1126]++ > 0) check ('a string 1126'); break;
+ case 1127: if (n[1127]++ > 0) check ('a string 1127'); break;
+ case 1128: if (n[1128]++ > 0) check ('a string 1128'); break;
+ case 1129: if (n[1129]++ > 0) check ('a string 1129'); break;
+ case 1130: if (n[1130]++ > 0) check ('a string 1130'); break;
+ case 1131: if (n[1131]++ > 0) check ('a string 1131'); break;
+ case 1132: if (n[1132]++ > 0) check ('a string 1132'); break;
+ case 1133: if (n[1133]++ > 0) check ('a string 1133'); break;
+ case 1134: if (n[1134]++ > 0) check ('a string 1134'); break;
+ case 1135: if (n[1135]++ > 0) check ('a string 1135'); break;
+ case 1136: if (n[1136]++ > 0) check ('a string 1136'); break;
+ case 1137: if (n[1137]++ > 0) check ('a string 1137'); break;
+ case 1138: if (n[1138]++ > 0) check ('a string 1138'); break;
+ case 1139: if (n[1139]++ > 0) check ('a string 1139'); break;
+ case 1140: if (n[1140]++ > 0) check ('a string 1140'); break;
+ case 1141: if (n[1141]++ > 0) check ('a string 1141'); break;
+ case 1142: if (n[1142]++ > 0) check ('a string 1142'); break;
+ case 1143: if (n[1143]++ > 0) check ('a string 1143'); break;
+ case 1144: if (n[1144]++ > 0) check ('a string 1144'); break;
+ case 1145: if (n[1145]++ > 0) check ('a string 1145'); break;
+ case 1146: if (n[1146]++ > 0) check ('a string 1146'); break;
+ case 1147: if (n[1147]++ > 0) check ('a string 1147'); break;
+ case 1148: if (n[1148]++ > 0) check ('a string 1148'); break;
+ case 1149: if (n[1149]++ > 0) check ('a string 1149'); break;
+ case 1150: if (n[1150]++ > 0) check ('a string 1150'); break;
+ case 1151: if (n[1151]++ > 0) check ('a string 1151'); break;
+ case 1152: if (n[1152]++ > 0) check ('a string 1152'); break;
+ case 1153: if (n[1153]++ > 0) check ('a string 1153'); break;
+ case 1154: if (n[1154]++ > 0) check ('a string 1154'); break;
+ case 1155: if (n[1155]++ > 0) check ('a string 1155'); break;
+ case 1156: if (n[1156]++ > 0) check ('a string 1156'); break;
+ case 1157: if (n[1157]++ > 0) check ('a string 1157'); break;
+ case 1158: if (n[1158]++ > 0) check ('a string 1158'); break;
+ case 1159: if (n[1159]++ > 0) check ('a string 1159'); break;
+ case 1160: if (n[1160]++ > 0) check ('a string 1160'); break;
+ case 1161: if (n[1161]++ > 0) check ('a string 1161'); break;
+ case 1162: if (n[1162]++ > 0) check ('a string 1162'); break;
+ case 1163: if (n[1163]++ > 0) check ('a string 1163'); break;
+ case 1164: if (n[1164]++ > 0) check ('a string 1164'); break;
+ case 1165: if (n[1165]++ > 0) check ('a string 1165'); break;
+ case 1166: if (n[1166]++ > 0) check ('a string 1166'); break;
+ case 1167: if (n[1167]++ > 0) check ('a string 1167'); break;
+ case 1168: if (n[1168]++ > 0) check ('a string 1168'); break;
+ case 1169: if (n[1169]++ > 0) check ('a string 1169'); break;
+ case 1170: if (n[1170]++ > 0) check ('a string 1170'); break;
+ case 1171: if (n[1171]++ > 0) check ('a string 1171'); break;
+ case 1172: if (n[1172]++ > 0) check ('a string 1172'); break;
+ case 1173: if (n[1173]++ > 0) check ('a string 1173'); break;
+ case 1174: if (n[1174]++ > 0) check ('a string 1174'); break;
+ case 1175: if (n[1175]++ > 0) check ('a string 1175'); break;
+ case 1176: if (n[1176]++ > 0) check ('a string 1176'); break;
+ case 1177: if (n[1177]++ > 0) check ('a string 1177'); break;
+ case 1178: if (n[1178]++ > 0) check ('a string 1178'); break;
+ case 1179: if (n[1179]++ > 0) check ('a string 1179'); break;
+ case 1180: if (n[1180]++ > 0) check ('a string 1180'); break;
+ case 1181: if (n[1181]++ > 0) check ('a string 1181'); break;
+ case 1182: if (n[1182]++ > 0) check ('a string 1182'); break;
+ case 1183: if (n[1183]++ > 0) check ('a string 1183'); break;
+ case 1184: if (n[1184]++ > 0) check ('a string 1184'); break;
+ case 1185: if (n[1185]++ > 0) check ('a string 1185'); break;
+ case 1186: if (n[1186]++ > 0) check ('a string 1186'); break;
+ case 1187: if (n[1187]++ > 0) check ('a string 1187'); break;
+ case 1188: if (n[1188]++ > 0) check ('a string 1188'); break;
+ case 1189: if (n[1189]++ > 0) check ('a string 1189'); break;
+ case 1190: if (n[1190]++ > 0) check ('a string 1190'); break;
+ case 1191: if (n[1191]++ > 0) check ('a string 1191'); break;
+ case 1192: if (n[1192]++ > 0) check ('a string 1192'); break;
+ case 1193: if (n[1193]++ > 0) check ('a string 1193'); break;
+ case 1194: if (n[1194]++ > 0) check ('a string 1194'); break;
+ case 1195: if (n[1195]++ > 0) check ('a string 1195'); break;
+ case 1196: if (n[1196]++ > 0) check ('a string 1196'); break;
+ case 1197: if (n[1197]++ > 0) check ('a string 1197'); break;
+ case 1198: if (n[1198]++ > 0) check ('a string 1198'); break;
+ case 1199: if (n[1199]++ > 0) check ('a string 1199'); break;
+ case 1200: if (n[1200]++ > 0) check ('a string 1200'); break;
+ case 1201: if (n[1201]++ > 0) check ('a string 1201'); break;
+ case 1202: if (n[1202]++ > 0) check ('a string 1202'); break;
+ case 1203: if (n[1203]++ > 0) check ('a string 1203'); break;
+ case 1204: if (n[1204]++ > 0) check ('a string 1204'); break;
+ case 1205: if (n[1205]++ > 0) check ('a string 1205'); break;
+ case 1206: if (n[1206]++ > 0) check ('a string 1206'); break;
+ case 1207: if (n[1207]++ > 0) check ('a string 1207'); break;
+ case 1208: if (n[1208]++ > 0) check ('a string 1208'); break;
+ case 1209: if (n[1209]++ > 0) check ('a string 1209'); break;
+ case 1210: if (n[1210]++ > 0) check ('a string 1210'); break;
+ case 1211: if (n[1211]++ > 0) check ('a string 1211'); break;
+ case 1212: if (n[1212]++ > 0) check ('a string 1212'); break;
+ case 1213: if (n[1213]++ > 0) check ('a string 1213'); break;
+ case 1214: if (n[1214]++ > 0) check ('a string 1214'); break;
+ case 1215: if (n[1215]++ > 0) check ('a string 1215'); break;
+ case 1216: if (n[1216]++ > 0) check ('a string 1216'); break;
+ case 1217: if (n[1217]++ > 0) check ('a string 1217'); break;
+ case 1218: if (n[1218]++ > 0) check ('a string 1218'); break;
+ case 1219: if (n[1219]++ > 0) check ('a string 1219'); break;
+ case 1220: if (n[1220]++ > 0) check ('a string 1220'); break;
+ case 1221: if (n[1221]++ > 0) check ('a string 1221'); break;
+ case 1222: if (n[1222]++ > 0) check ('a string 1222'); break;
+ case 1223: if (n[1223]++ > 0) check ('a string 1223'); break;
+ case 1224: if (n[1224]++ > 0) check ('a string 1224'); break;
+ case 1225: if (n[1225]++ > 0) check ('a string 1225'); break;
+ case 1226: if (n[1226]++ > 0) check ('a string 1226'); break;
+ case 1227: if (n[1227]++ > 0) check ('a string 1227'); break;
+ case 1228: if (n[1228]++ > 0) check ('a string 1228'); break;
+ case 1229: if (n[1229]++ > 0) check ('a string 1229'); break;
+ case 1230: if (n[1230]++ > 0) check ('a string 1230'); break;
+ case 1231: if (n[1231]++ > 0) check ('a string 1231'); break;
+ case 1232: if (n[1232]++ > 0) check ('a string 1232'); break;
+ case 1233: if (n[1233]++ > 0) check ('a string 1233'); break;
+ case 1234: if (n[1234]++ > 0) check ('a string 1234'); break;
+ case 1235: if (n[1235]++ > 0) check ('a string 1235'); break;
+ case 1236: if (n[1236]++ > 0) check ('a string 1236'); break;
+ case 1237: if (n[1237]++ > 0) check ('a string 1237'); break;
+ case 1238: if (n[1238]++ > 0) check ('a string 1238'); break;
+ case 1239: if (n[1239]++ > 0) check ('a string 1239'); break;
+ case 1240: if (n[1240]++ > 0) check ('a string 1240'); break;
+ case 1241: if (n[1241]++ > 0) check ('a string 1241'); break;
+ case 1242: if (n[1242]++ > 0) check ('a string 1242'); break;
+ case 1243: if (n[1243]++ > 0) check ('a string 1243'); break;
+ case 1244: if (n[1244]++ > 0) check ('a string 1244'); break;
+ case 1245: if (n[1245]++ > 0) check ('a string 1245'); break;
+ case 1246: if (n[1246]++ > 0) check ('a string 1246'); break;
+ case 1247: if (n[1247]++ > 0) check ('a string 1247'); break;
+ case 1248: if (n[1248]++ > 0) check ('a string 1248'); break;
+ case 1249: if (n[1249]++ > 0) check ('a string 1249'); break;
+ case 1250: if (n[1250]++ > 0) check ('a string 1250'); break;
+ case 1251: if (n[1251]++ > 0) check ('a string 1251'); break;
+ case 1252: if (n[1252]++ > 0) check ('a string 1252'); break;
+ case 1253: if (n[1253]++ > 0) check ('a string 1253'); break;
+ case 1254: if (n[1254]++ > 0) check ('a string 1254'); break;
+ case 1255: if (n[1255]++ > 0) check ('a string 1255'); break;
+ case 1256: if (n[1256]++ > 0) check ('a string 1256'); break;
+ case 1257: if (n[1257]++ > 0) check ('a string 1257'); break;
+ case 1258: if (n[1258]++ > 0) check ('a string 1258'); break;
+ case 1259: if (n[1259]++ > 0) check ('a string 1259'); break;
+ case 1260: if (n[1260]++ > 0) check ('a string 1260'); break;
+ case 1261: if (n[1261]++ > 0) check ('a string 1261'); break;
+ case 1262: if (n[1262]++ > 0) check ('a string 1262'); break;
+ case 1263: if (n[1263]++ > 0) check ('a string 1263'); break;
+ case 1264: if (n[1264]++ > 0) check ('a string 1264'); break;
+ case 1265: if (n[1265]++ > 0) check ('a string 1265'); break;
+ case 1266: if (n[1266]++ > 0) check ('a string 1266'); break;
+ case 1267: if (n[1267]++ > 0) check ('a string 1267'); break;
+ case 1268: if (n[1268]++ > 0) check ('a string 1268'); break;
+ case 1269: if (n[1269]++ > 0) check ('a string 1269'); break;
+ case 1270: if (n[1270]++ > 0) check ('a string 1270'); break;
+ case 1271: if (n[1271]++ > 0) check ('a string 1271'); break;
+ case 1272: if (n[1272]++ > 0) check ('a string 1272'); break;
+ case 1273: if (n[1273]++ > 0) check ('a string 1273'); break;
+ case 1274: if (n[1274]++ > 0) check ('a string 1274'); break;
+ case 1275: if (n[1275]++ > 0) check ('a string 1275'); break;
+ case 1276: if (n[1276]++ > 0) check ('a string 1276'); break;
+ case 1277: if (n[1277]++ > 0) check ('a string 1277'); break;
+ case 1278: if (n[1278]++ > 0) check ('a string 1278'); break;
+ case 1279: if (n[1279]++ > 0) check ('a string 1279'); break;
+ case 1280: if (n[1280]++ > 0) check ('a string 1280'); break;
+ case 1281: if (n[1281]++ > 0) check ('a string 1281'); break;
+ case 1282: if (n[1282]++ > 0) check ('a string 1282'); break;
+ case 1283: if (n[1283]++ > 0) check ('a string 1283'); break;
+ case 1284: if (n[1284]++ > 0) check ('a string 1284'); break;
+ case 1285: if (n[1285]++ > 0) check ('a string 1285'); break;
+ case 1286: if (n[1286]++ > 0) check ('a string 1286'); break;
+ case 1287: if (n[1287]++ > 0) check ('a string 1287'); break;
+ case 1288: if (n[1288]++ > 0) check ('a string 1288'); break;
+ case 1289: if (n[1289]++ > 0) check ('a string 1289'); break;
+ case 1290: if (n[1290]++ > 0) check ('a string 1290'); break;
+ case 1291: if (n[1291]++ > 0) check ('a string 1291'); break;
+ case 1292: if (n[1292]++ > 0) check ('a string 1292'); break;
+ case 1293: if (n[1293]++ > 0) check ('a string 1293'); break;
+ case 1294: if (n[1294]++ > 0) check ('a string 1294'); break;
+ case 1295: if (n[1295]++ > 0) check ('a string 1295'); break;
+ case 1296: if (n[1296]++ > 0) check ('a string 1296'); break;
+ case 1297: if (n[1297]++ > 0) check ('a string 1297'); break;
+ case 1298: if (n[1298]++ > 0) check ('a string 1298'); break;
+ case 1299: if (n[1299]++ > 0) check ('a string 1299'); break;
+ case 1300: if (n[1300]++ > 0) check ('a string 1300'); break;
+ case 1301: if (n[1301]++ > 0) check ('a string 1301'); break;
+ case 1302: if (n[1302]++ > 0) check ('a string 1302'); break;
+ case 1303: if (n[1303]++ > 0) check ('a string 1303'); break;
+ case 1304: if (n[1304]++ > 0) check ('a string 1304'); break;
+ case 1305: if (n[1305]++ > 0) check ('a string 1305'); break;
+ case 1306: if (n[1306]++ > 0) check ('a string 1306'); break;
+ case 1307: if (n[1307]++ > 0) check ('a string 1307'); break;
+ case 1308: if (n[1308]++ > 0) check ('a string 1308'); break;
+ case 1309: if (n[1309]++ > 0) check ('a string 1309'); break;
+ case 1310: if (n[1310]++ > 0) check ('a string 1310'); break;
+ case 1311: if (n[1311]++ > 0) check ('a string 1311'); break;
+ case 1312: if (n[1312]++ > 0) check ('a string 1312'); break;
+ case 1313: if (n[1313]++ > 0) check ('a string 1313'); break;
+ case 1314: if (n[1314]++ > 0) check ('a string 1314'); break;
+ case 1315: if (n[1315]++ > 0) check ('a string 1315'); break;
+ case 1316: if (n[1316]++ > 0) check ('a string 1316'); break;
+ case 1317: if (n[1317]++ > 0) check ('a string 1317'); break;
+ case 1318: if (n[1318]++ > 0) check ('a string 1318'); break;
+ case 1319: if (n[1319]++ > 0) check ('a string 1319'); break;
+ case 1320: if (n[1320]++ > 0) check ('a string 1320'); break;
+ case 1321: if (n[1321]++ > 0) check ('a string 1321'); break;
+ case 1322: if (n[1322]++ > 0) check ('a string 1322'); break;
+ case 1323: if (n[1323]++ > 0) check ('a string 1323'); break;
+ case 1324: if (n[1324]++ > 0) check ('a string 1324'); break;
+ case 1325: if (n[1325]++ > 0) check ('a string 1325'); break;
+ case 1326: if (n[1326]++ > 0) check ('a string 1326'); break;
+ case 1327: if (n[1327]++ > 0) check ('a string 1327'); break;
+ case 1328: if (n[1328]++ > 0) check ('a string 1328'); break;
+ case 1329: if (n[1329]++ > 0) check ('a string 1329'); break;
+ case 1330: if (n[1330]++ > 0) check ('a string 1330'); break;
+ case 1331: if (n[1331]++ > 0) check ('a string 1331'); break;
+ case 1332: if (n[1332]++ > 0) check ('a string 1332'); break;
+ case 1333: if (n[1333]++ > 0) check ('a string 1333'); break;
+ case 1334: if (n[1334]++ > 0) check ('a string 1334'); break;
+ case 1335: if (n[1335]++ > 0) check ('a string 1335'); break;
+ case 1336: if (n[1336]++ > 0) check ('a string 1336'); break;
+ case 1337: if (n[1337]++ > 0) check ('a string 1337'); break;
+ case 1338: if (n[1338]++ > 0) check ('a string 1338'); break;
+ case 1339: if (n[1339]++ > 0) check ('a string 1339'); break;
+ case 1340: if (n[1340]++ > 0) check ('a string 1340'); break;
+ case 1341: if (n[1341]++ > 0) check ('a string 1341'); break;
+ case 1342: if (n[1342]++ > 0) check ('a string 1342'); break;
+ case 1343: if (n[1343]++ > 0) check ('a string 1343'); break;
+ case 1344: if (n[1344]++ > 0) check ('a string 1344'); break;
+ case 1345: if (n[1345]++ > 0) check ('a string 1345'); break;
+ case 1346: if (n[1346]++ > 0) check ('a string 1346'); break;
+ case 1347: if (n[1347]++ > 0) check ('a string 1347'); break;
+ case 1348: if (n[1348]++ > 0) check ('a string 1348'); break;
+ case 1349: if (n[1349]++ > 0) check ('a string 1349'); break;
+ case 1350: if (n[1350]++ > 0) check ('a string 1350'); break;
+ case 1351: if (n[1351]++ > 0) check ('a string 1351'); break;
+ case 1352: if (n[1352]++ > 0) check ('a string 1352'); break;
+ case 1353: if (n[1353]++ > 0) check ('a string 1353'); break;
+ case 1354: if (n[1354]++ > 0) check ('a string 1354'); break;
+ case 1355: if (n[1355]++ > 0) check ('a string 1355'); break;
+ case 1356: if (n[1356]++ > 0) check ('a string 1356'); break;
+ case 1357: if (n[1357]++ > 0) check ('a string 1357'); break;
+ case 1358: if (n[1358]++ > 0) check ('a string 1358'); break;
+ case 1359: if (n[1359]++ > 0) check ('a string 1359'); break;
+ case 1360: if (n[1360]++ > 0) check ('a string 1360'); break;
+ case 1361: if (n[1361]++ > 0) check ('a string 1361'); break;
+ case 1362: if (n[1362]++ > 0) check ('a string 1362'); break;
+ case 1363: if (n[1363]++ > 0) check ('a string 1363'); break;
+ case 1364: if (n[1364]++ > 0) check ('a string 1364'); break;
+ case 1365: if (n[1365]++ > 0) check ('a string 1365'); break;
+ case 1366: if (n[1366]++ > 0) check ('a string 1366'); break;
+ case 1367: if (n[1367]++ > 0) check ('a string 1367'); break;
+ case 1368: if (n[1368]++ > 0) check ('a string 1368'); break;
+ case 1369: if (n[1369]++ > 0) check ('a string 1369'); break;
+ case 1370: if (n[1370]++ > 0) check ('a string 1370'); break;
+ case 1371: if (n[1371]++ > 0) check ('a string 1371'); break;
+ case 1372: if (n[1372]++ > 0) check ('a string 1372'); break;
+ case 1373: if (n[1373]++ > 0) check ('a string 1373'); break;
+ case 1374: if (n[1374]++ > 0) check ('a string 1374'); break;
+ case 1375: if (n[1375]++ > 0) check ('a string 1375'); break;
+ case 1376: if (n[1376]++ > 0) check ('a string 1376'); break;
+ case 1377: if (n[1377]++ > 0) check ('a string 1377'); break;
+ case 1378: if (n[1378]++ > 0) check ('a string 1378'); break;
+ case 1379: if (n[1379]++ > 0) check ('a string 1379'); break;
+ case 1380: if (n[1380]++ > 0) check ('a string 1380'); break;
+ case 1381: if (n[1381]++ > 0) check ('a string 1381'); break;
+ case 1382: if (n[1382]++ > 0) check ('a string 1382'); break;
+ case 1383: if (n[1383]++ > 0) check ('a string 1383'); break;
+ case 1384: if (n[1384]++ > 0) check ('a string 1384'); break;
+ case 1385: if (n[1385]++ > 0) check ('a string 1385'); break;
+ case 1386: if (n[1386]++ > 0) check ('a string 1386'); break;
+ case 1387: if (n[1387]++ > 0) check ('a string 1387'); break;
+ case 1388: if (n[1388]++ > 0) check ('a string 1388'); break;
+ case 1389: if (n[1389]++ > 0) check ('a string 1389'); break;
+ case 1390: if (n[1390]++ > 0) check ('a string 1390'); break;
+ case 1391: if (n[1391]++ > 0) check ('a string 1391'); break;
+ case 1392: if (n[1392]++ > 0) check ('a string 1392'); break;
+ case 1393: if (n[1393]++ > 0) check ('a string 1393'); break;
+ case 1394: if (n[1394]++ > 0) check ('a string 1394'); break;
+ case 1395: if (n[1395]++ > 0) check ('a string 1395'); break;
+ case 1396: if (n[1396]++ > 0) check ('a string 1396'); break;
+ case 1397: if (n[1397]++ > 0) check ('a string 1397'); break;
+ case 1398: if (n[1398]++ > 0) check ('a string 1398'); break;
+ case 1399: if (n[1399]++ > 0) check ('a string 1399'); break;
+ case 1400: if (n[1400]++ > 0) check ('a string 1400'); break;
+ case 1401: if (n[1401]++ > 0) check ('a string 1401'); break;
+ case 1402: if (n[1402]++ > 0) check ('a string 1402'); break;
+ case 1403: if (n[1403]++ > 0) check ('a string 1403'); break;
+ case 1404: if (n[1404]++ > 0) check ('a string 1404'); break;
+ case 1405: if (n[1405]++ > 0) check ('a string 1405'); break;
+ case 1406: if (n[1406]++ > 0) check ('a string 1406'); break;
+ case 1407: if (n[1407]++ > 0) check ('a string 1407'); break;
+ case 1408: if (n[1408]++ > 0) check ('a string 1408'); break;
+ case 1409: if (n[1409]++ > 0) check ('a string 1409'); break;
+ case 1410: if (n[1410]++ > 0) check ('a string 1410'); break;
+ case 1411: if (n[1411]++ > 0) check ('a string 1411'); break;
+ case 1412: if (n[1412]++ > 0) check ('a string 1412'); break;
+ case 1413: if (n[1413]++ > 0) check ('a string 1413'); break;
+ case 1414: if (n[1414]++ > 0) check ('a string 1414'); break;
+ case 1415: if (n[1415]++ > 0) check ('a string 1415'); break;
+ case 1416: if (n[1416]++ > 0) check ('a string 1416'); break;
+ case 1417: if (n[1417]++ > 0) check ('a string 1417'); break;
+ case 1418: if (n[1418]++ > 0) check ('a string 1418'); break;
+ case 1419: if (n[1419]++ > 0) check ('a string 1419'); break;
+ case 1420: if (n[1420]++ > 0) check ('a string 1420'); break;
+ case 1421: if (n[1421]++ > 0) check ('a string 1421'); break;
+ case 1422: if (n[1422]++ > 0) check ('a string 1422'); break;
+ case 1423: if (n[1423]++ > 0) check ('a string 1423'); break;
+ case 1424: if (n[1424]++ > 0) check ('a string 1424'); break;
+ case 1425: if (n[1425]++ > 0) check ('a string 1425'); break;
+ case 1426: if (n[1426]++ > 0) check ('a string 1426'); break;
+ case 1427: if (n[1427]++ > 0) check ('a string 1427'); break;
+ case 1428: if (n[1428]++ > 0) check ('a string 1428'); break;
+ case 1429: if (n[1429]++ > 0) check ('a string 1429'); break;
+ case 1430: if (n[1430]++ > 0) check ('a string 1430'); break;
+ case 1431: if (n[1431]++ > 0) check ('a string 1431'); break;
+ case 1432: if (n[1432]++ > 0) check ('a string 1432'); break;
+ case 1433: if (n[1433]++ > 0) check ('a string 1433'); break;
+ case 1434: if (n[1434]++ > 0) check ('a string 1434'); break;
+ case 1435: if (n[1435]++ > 0) check ('a string 1435'); break;
+ case 1436: if (n[1436]++ > 0) check ('a string 1436'); break;
+ case 1437: if (n[1437]++ > 0) check ('a string 1437'); break;
+ case 1438: if (n[1438]++ > 0) check ('a string 1438'); break;
+ case 1439: if (n[1439]++ > 0) check ('a string 1439'); break;
+ case 1440: if (n[1440]++ > 0) check ('a string 1440'); break;
+ case 1441: if (n[1441]++ > 0) check ('a string 1441'); break;
+ case 1442: if (n[1442]++ > 0) check ('a string 1442'); break;
+ case 1443: if (n[1443]++ > 0) check ('a string 1443'); break;
+ case 1444: if (n[1444]++ > 0) check ('a string 1444'); break;
+ case 1445: if (n[1445]++ > 0) check ('a string 1445'); break;
+ case 1446: if (n[1446]++ > 0) check ('a string 1446'); break;
+ case 1447: if (n[1447]++ > 0) check ('a string 1447'); break;
+ case 1448: if (n[1448]++ > 0) check ('a string 1448'); break;
+ case 1449: if (n[1449]++ > 0) check ('a string 1449'); break;
+ case 1450: if (n[1450]++ > 0) check ('a string 1450'); break;
+ case 1451: if (n[1451]++ > 0) check ('a string 1451'); break;
+ case 1452: if (n[1452]++ > 0) check ('a string 1452'); break;
+ case 1453: if (n[1453]++ > 0) check ('a string 1453'); break;
+ case 1454: if (n[1454]++ > 0) check ('a string 1454'); break;
+ case 1455: if (n[1455]++ > 0) check ('a string 1455'); break;
+ case 1456: if (n[1456]++ > 0) check ('a string 1456'); break;
+ case 1457: if (n[1457]++ > 0) check ('a string 1457'); break;
+ case 1458: if (n[1458]++ > 0) check ('a string 1458'); break;
+ case 1459: if (n[1459]++ > 0) check ('a string 1459'); break;
+ case 1460: if (n[1460]++ > 0) check ('a string 1460'); break;
+ case 1461: if (n[1461]++ > 0) check ('a string 1461'); break;
+ case 1462: if (n[1462]++ > 0) check ('a string 1462'); break;
+ case 1463: if (n[1463]++ > 0) check ('a string 1463'); break;
+ case 1464: if (n[1464]++ > 0) check ('a string 1464'); break;
+ case 1465: if (n[1465]++ > 0) check ('a string 1465'); break;
+ case 1466: if (n[1466]++ > 0) check ('a string 1466'); break;
+ case 1467: if (n[1467]++ > 0) check ('a string 1467'); break;
+ case 1468: if (n[1468]++ > 0) check ('a string 1468'); break;
+ case 1469: if (n[1469]++ > 0) check ('a string 1469'); break;
+ case 1470: if (n[1470]++ > 0) check ('a string 1470'); break;
+ case 1471: if (n[1471]++ > 0) check ('a string 1471'); break;
+ case 1472: if (n[1472]++ > 0) check ('a string 1472'); break;
+ case 1473: if (n[1473]++ > 0) check ('a string 1473'); break;
+ case 1474: if (n[1474]++ > 0) check ('a string 1474'); break;
+ case 1475: if (n[1475]++ > 0) check ('a string 1475'); break;
+ case 1476: if (n[1476]++ > 0) check ('a string 1476'); break;
+ case 1477: if (n[1477]++ > 0) check ('a string 1477'); break;
+ case 1478: if (n[1478]++ > 0) check ('a string 1478'); break;
+ case 1479: if (n[1479]++ > 0) check ('a string 1479'); break;
+ case 1480: if (n[1480]++ > 0) check ('a string 1480'); break;
+ case 1481: if (n[1481]++ > 0) check ('a string 1481'); break;
+ case 1482: if (n[1482]++ > 0) check ('a string 1482'); break;
+ case 1483: if (n[1483]++ > 0) check ('a string 1483'); break;
+ case 1484: if (n[1484]++ > 0) check ('a string 1484'); break;
+ case 1485: if (n[1485]++ > 0) check ('a string 1485'); break;
+ case 1486: if (n[1486]++ > 0) check ('a string 1486'); break;
+ case 1487: if (n[1487]++ > 0) check ('a string 1487'); break;
+ case 1488: if (n[1488]++ > 0) check ('a string 1488'); break;
+ case 1489: if (n[1489]++ > 0) check ('a string 1489'); break;
+ case 1490: if (n[1490]++ > 0) check ('a string 1490'); break;
+ case 1491: if (n[1491]++ > 0) check ('a string 1491'); break;
+ case 1492: if (n[1492]++ > 0) check ('a string 1492'); break;
+ case 1493: if (n[1493]++ > 0) check ('a string 1493'); break;
+ case 1494: if (n[1494]++ > 0) check ('a string 1494'); break;
+ case 1495: if (n[1495]++ > 0) check ('a string 1495'); break;
+ case 1496: if (n[1496]++ > 0) check ('a string 1496'); break;
+ case 1497: if (n[1497]++ > 0) check ('a string 1497'); break;
+ case 1498: if (n[1498]++ > 0) check ('a string 1498'); break;
+ case 1499: if (n[1499]++ > 0) check ('a string 1499'); break;
+ case 1500: if (n[1500]++ > 0) check ('a string 1500'); break;
+ case 1501: if (n[1501]++ > 0) check ('a string 1501'); break;
+ case 1502: if (n[1502]++ > 0) check ('a string 1502'); break;
+ case 1503: if (n[1503]++ > 0) check ('a string 1503'); break;
+ case 1504: if (n[1504]++ > 0) check ('a string 1504'); break;
+ case 1505: if (n[1505]++ > 0) check ('a string 1505'); break;
+ case 1506: if (n[1506]++ > 0) check ('a string 1506'); break;
+ case 1507: if (n[1507]++ > 0) check ('a string 1507'); break;
+ case 1508: if (n[1508]++ > 0) check ('a string 1508'); break;
+ case 1509: if (n[1509]++ > 0) check ('a string 1509'); break;
+ case 1510: if (n[1510]++ > 0) check ('a string 1510'); break;
+ case 1511: if (n[1511]++ > 0) check ('a string 1511'); break;
+ case 1512: if (n[1512]++ > 0) check ('a string 1512'); break;
+ case 1513: if (n[1513]++ > 0) check ('a string 1513'); break;
+ case 1514: if (n[1514]++ > 0) check ('a string 1514'); break;
+ case 1515: if (n[1515]++ > 0) check ('a string 1515'); break;
+ case 1516: if (n[1516]++ > 0) check ('a string 1516'); break;
+ case 1517: if (n[1517]++ > 0) check ('a string 1517'); break;
+ case 1518: if (n[1518]++ > 0) check ('a string 1518'); break;
+ case 1519: if (n[1519]++ > 0) check ('a string 1519'); break;
+ case 1520: if (n[1520]++ > 0) check ('a string 1520'); break;
+ case 1521: if (n[1521]++ > 0) check ('a string 1521'); break;
+ case 1522: if (n[1522]++ > 0) check ('a string 1522'); break;
+ case 1523: if (n[1523]++ > 0) check ('a string 1523'); break;
+ case 1524: if (n[1524]++ > 0) check ('a string 1524'); break;
+ case 1525: if (n[1525]++ > 0) check ('a string 1525'); break;
+ case 1526: if (n[1526]++ > 0) check ('a string 1526'); break;
+ case 1527: if (n[1527]++ > 0) check ('a string 1527'); break;
+ case 1528: if (n[1528]++ > 0) check ('a string 1528'); break;
+ case 1529: if (n[1529]++ > 0) check ('a string 1529'); break;
+ case 1530: if (n[1530]++ > 0) check ('a string 1530'); break;
+ case 1531: if (n[1531]++ > 0) check ('a string 1531'); break;
+ case 1532: if (n[1532]++ > 0) check ('a string 1532'); break;
+ case 1533: if (n[1533]++ > 0) check ('a string 1533'); break;
+ case 1534: if (n[1534]++ > 0) check ('a string 1534'); break;
+ case 1535: if (n[1535]++ > 0) check ('a string 1535'); break;
+ case 1536: if (n[1536]++ > 0) check ('a string 1536'); break;
+ case 1537: if (n[1537]++ > 0) check ('a string 1537'); break;
+ case 1538: if (n[1538]++ > 0) check ('a string 1538'); break;
+ case 1539: if (n[1539]++ > 0) check ('a string 1539'); break;
+ case 1540: if (n[1540]++ > 0) check ('a string 1540'); break;
+ case 1541: if (n[1541]++ > 0) check ('a string 1541'); break;
+ case 1542: if (n[1542]++ > 0) check ('a string 1542'); break;
+ case 1543: if (n[1543]++ > 0) check ('a string 1543'); break;
+ case 1544: if (n[1544]++ > 0) check ('a string 1544'); break;
+ case 1545: if (n[1545]++ > 0) check ('a string 1545'); break;
+ case 1546: if (n[1546]++ > 0) check ('a string 1546'); break;
+ case 1547: if (n[1547]++ > 0) check ('a string 1547'); break;
+ case 1548: if (n[1548]++ > 0) check ('a string 1548'); break;
+ case 1549: if (n[1549]++ > 0) check ('a string 1549'); break;
+ case 1550: if (n[1550]++ > 0) check ('a string 1550'); break;
+ case 1551: if (n[1551]++ > 0) check ('a string 1551'); break;
+ case 1552: if (n[1552]++ > 0) check ('a string 1552'); break;
+ case 1553: if (n[1553]++ > 0) check ('a string 1553'); break;
+ case 1554: if (n[1554]++ > 0) check ('a string 1554'); break;
+ case 1555: if (n[1555]++ > 0) check ('a string 1555'); break;
+ case 1556: if (n[1556]++ > 0) check ('a string 1556'); break;
+ case 1557: if (n[1557]++ > 0) check ('a string 1557'); break;
+ case 1558: if (n[1558]++ > 0) check ('a string 1558'); break;
+ case 1559: if (n[1559]++ > 0) check ('a string 1559'); break;
+ case 1560: if (n[1560]++ > 0) check ('a string 1560'); break;
+ case 1561: if (n[1561]++ > 0) check ('a string 1561'); break;
+ case 1562: if (n[1562]++ > 0) check ('a string 1562'); break;
+ case 1563: if (n[1563]++ > 0) check ('a string 1563'); break;
+ case 1564: if (n[1564]++ > 0) check ('a string 1564'); break;
+ case 1565: if (n[1565]++ > 0) check ('a string 1565'); break;
+ case 1566: if (n[1566]++ > 0) check ('a string 1566'); break;
+ case 1567: if (n[1567]++ > 0) check ('a string 1567'); break;
+ case 1568: if (n[1568]++ > 0) check ('a string 1568'); break;
+ case 1569: if (n[1569]++ > 0) check ('a string 1569'); break;
+ case 1570: if (n[1570]++ > 0) check ('a string 1570'); break;
+ case 1571: if (n[1571]++ > 0) check ('a string 1571'); break;
+ case 1572: if (n[1572]++ > 0) check ('a string 1572'); break;
+ case 1573: if (n[1573]++ > 0) check ('a string 1573'); break;
+ case 1574: if (n[1574]++ > 0) check ('a string 1574'); break;
+ case 1575: if (n[1575]++ > 0) check ('a string 1575'); break;
+ case 1576: if (n[1576]++ > 0) check ('a string 1576'); break;
+ case 1577: if (n[1577]++ > 0) check ('a string 1577'); break;
+ case 1578: if (n[1578]++ > 0) check ('a string 1578'); break;
+ case 1579: if (n[1579]++ > 0) check ('a string 1579'); break;
+ case 1580: if (n[1580]++ > 0) check ('a string 1580'); break;
+ case 1581: if (n[1581]++ > 0) check ('a string 1581'); break;
+ case 1582: if (n[1582]++ > 0) check ('a string 1582'); break;
+ case 1583: if (n[1583]++ > 0) check ('a string 1583'); break;
+ case 1584: if (n[1584]++ > 0) check ('a string 1584'); break;
+ case 1585: if (n[1585]++ > 0) check ('a string 1585'); break;
+ case 1586: if (n[1586]++ > 0) check ('a string 1586'); break;
+ case 1587: if (n[1587]++ > 0) check ('a string 1587'); break;
+ case 1588: if (n[1588]++ > 0) check ('a string 1588'); break;
+ case 1589: if (n[1589]++ > 0) check ('a string 1589'); break;
+ case 1590: if (n[1590]++ > 0) check ('a string 1590'); break;
+ case 1591: if (n[1591]++ > 0) check ('a string 1591'); break;
+ case 1592: if (n[1592]++ > 0) check ('a string 1592'); break;
+ case 1593: if (n[1593]++ > 0) check ('a string 1593'); break;
+ case 1594: if (n[1594]++ > 0) check ('a string 1594'); break;
+ case 1595: if (n[1595]++ > 0) check ('a string 1595'); break;
+ case 1596: if (n[1596]++ > 0) check ('a string 1596'); break;
+ case 1597: if (n[1597]++ > 0) check ('a string 1597'); break;
+ case 1598: if (n[1598]++ > 0) check ('a string 1598'); break;
+ case 1599: if (n[1599]++ > 0) check ('a string 1599'); break;
+ case 1600: if (n[1600]++ > 0) check ('a string 1600'); break;
+ case 1601: if (n[1601]++ > 0) check ('a string 1601'); break;
+ case 1602: if (n[1602]++ > 0) check ('a string 1602'); break;
+ case 1603: if (n[1603]++ > 0) check ('a string 1603'); break;
+ case 1604: if (n[1604]++ > 0) check ('a string 1604'); break;
+ case 1605: if (n[1605]++ > 0) check ('a string 1605'); break;
+ case 1606: if (n[1606]++ > 0) check ('a string 1606'); break;
+ case 1607: if (n[1607]++ > 0) check ('a string 1607'); break;
+ case 1608: if (n[1608]++ > 0) check ('a string 1608'); break;
+ case 1609: if (n[1609]++ > 0) check ('a string 1609'); break;
+ case 1610: if (n[1610]++ > 0) check ('a string 1610'); break;
+ case 1611: if (n[1611]++ > 0) check ('a string 1611'); break;
+ case 1612: if (n[1612]++ > 0) check ('a string 1612'); break;
+ case 1613: if (n[1613]++ > 0) check ('a string 1613'); break;
+ case 1614: if (n[1614]++ > 0) check ('a string 1614'); break;
+ case 1615: if (n[1615]++ > 0) check ('a string 1615'); break;
+ case 1616: if (n[1616]++ > 0) check ('a string 1616'); break;
+ case 1617: if (n[1617]++ > 0) check ('a string 1617'); break;
+ case 1618: if (n[1618]++ > 0) check ('a string 1618'); break;
+ case 1619: if (n[1619]++ > 0) check ('a string 1619'); break;
+ case 1620: if (n[1620]++ > 0) check ('a string 1620'); break;
+ case 1621: if (n[1621]++ > 0) check ('a string 1621'); break;
+ case 1622: if (n[1622]++ > 0) check ('a string 1622'); break;
+ case 1623: if (n[1623]++ > 0) check ('a string 1623'); break;
+ case 1624: if (n[1624]++ > 0) check ('a string 1624'); break;
+ case 1625: if (n[1625]++ > 0) check ('a string 1625'); break;
+ case 1626: if (n[1626]++ > 0) check ('a string 1626'); break;
+ case 1627: if (n[1627]++ > 0) check ('a string 1627'); break;
+ case 1628: if (n[1628]++ > 0) check ('a string 1628'); break;
+ case 1629: if (n[1629]++ > 0) check ('a string 1629'); break;
+ case 1630: if (n[1630]++ > 0) check ('a string 1630'); break;
+ case 1631: if (n[1631]++ > 0) check ('a string 1631'); break;
+ case 1632: if (n[1632]++ > 0) check ('a string 1632'); break;
+ case 1633: if (n[1633]++ > 0) check ('a string 1633'); break;
+ case 1634: if (n[1634]++ > 0) check ('a string 1634'); break;
+ case 1635: if (n[1635]++ > 0) check ('a string 1635'); break;
+ case 1636: if (n[1636]++ > 0) check ('a string 1636'); break;
+ case 1637: if (n[1637]++ > 0) check ('a string 1637'); break;
+ case 1638: if (n[1638]++ > 0) check ('a string 1638'); break;
+ case 1639: if (n[1639]++ > 0) check ('a string 1639'); break;
+ case 1640: if (n[1640]++ > 0) check ('a string 1640'); break;
+ case 1641: if (n[1641]++ > 0) check ('a string 1641'); break;
+ case 1642: if (n[1642]++ > 0) check ('a string 1642'); break;
+ case 1643: if (n[1643]++ > 0) check ('a string 1643'); break;
+ case 1644: if (n[1644]++ > 0) check ('a string 1644'); break;
+ case 1645: if (n[1645]++ > 0) check ('a string 1645'); break;
+ case 1646: if (n[1646]++ > 0) check ('a string 1646'); break;
+ case 1647: if (n[1647]++ > 0) check ('a string 1647'); break;
+ case 1648: if (n[1648]++ > 0) check ('a string 1648'); break;
+ case 1649: if (n[1649]++ > 0) check ('a string 1649'); break;
+ case 1650: if (n[1650]++ > 0) check ('a string 1650'); break;
+ case 1651: if (n[1651]++ > 0) check ('a string 1651'); break;
+ case 1652: if (n[1652]++ > 0) check ('a string 1652'); break;
+ case 1653: if (n[1653]++ > 0) check ('a string 1653'); break;
+ case 1654: if (n[1654]++ > 0) check ('a string 1654'); break;
+ case 1655: if (n[1655]++ > 0) check ('a string 1655'); break;
+ case 1656: if (n[1656]++ > 0) check ('a string 1656'); break;
+ case 1657: if (n[1657]++ > 0) check ('a string 1657'); break;
+ case 1658: if (n[1658]++ > 0) check ('a string 1658'); break;
+ case 1659: if (n[1659]++ > 0) check ('a string 1659'); break;
+ case 1660: if (n[1660]++ > 0) check ('a string 1660'); break;
+ case 1661: if (n[1661]++ > 0) check ('a string 1661'); break;
+ case 1662: if (n[1662]++ > 0) check ('a string 1662'); break;
+ case 1663: if (n[1663]++ > 0) check ('a string 1663'); break;
+ case 1664: if (n[1664]++ > 0) check ('a string 1664'); break;
+ case 1665: if (n[1665]++ > 0) check ('a string 1665'); break;
+ case 1666: if (n[1666]++ > 0) check ('a string 1666'); break;
+ case 1667: if (n[1667]++ > 0) check ('a string 1667'); break;
+ case 1668: if (n[1668]++ > 0) check ('a string 1668'); break;
+ case 1669: if (n[1669]++ > 0) check ('a string 1669'); break;
+ case 1670: if (n[1670]++ > 0) check ('a string 1670'); break;
+ case 1671: if (n[1671]++ > 0) check ('a string 1671'); break;
+ case 1672: if (n[1672]++ > 0) check ('a string 1672'); break;
+ case 1673: if (n[1673]++ > 0) check ('a string 1673'); break;
+ case 1674: if (n[1674]++ > 0) check ('a string 1674'); break;
+ case 1675: if (n[1675]++ > 0) check ('a string 1675'); break;
+ case 1676: if (n[1676]++ > 0) check ('a string 1676'); break;
+ case 1677: if (n[1677]++ > 0) check ('a string 1677'); break;
+ case 1678: if (n[1678]++ > 0) check ('a string 1678'); break;
+ case 1679: if (n[1679]++ > 0) check ('a string 1679'); break;
+ case 1680: if (n[1680]++ > 0) check ('a string 1680'); break;
+ case 1681: if (n[1681]++ > 0) check ('a string 1681'); break;
+ case 1682: if (n[1682]++ > 0) check ('a string 1682'); break;
+ case 1683: if (n[1683]++ > 0) check ('a string 1683'); break;
+ case 1684: if (n[1684]++ > 0) check ('a string 1684'); break;
+ case 1685: if (n[1685]++ > 0) check ('a string 1685'); break;
+ case 1686: if (n[1686]++ > 0) check ('a string 1686'); break;
+ case 1687: if (n[1687]++ > 0) check ('a string 1687'); break;
+ case 1688: if (n[1688]++ > 0) check ('a string 1688'); break;
+ case 1689: if (n[1689]++ > 0) check ('a string 1689'); break;
+ case 1690: if (n[1690]++ > 0) check ('a string 1690'); break;
+ case 1691: if (n[1691]++ > 0) check ('a string 1691'); break;
+ case 1692: if (n[1692]++ > 0) check ('a string 1692'); break;
+ case 1693: if (n[1693]++ > 0) check ('a string 1693'); break;
+ case 1694: if (n[1694]++ > 0) check ('a string 1694'); break;
+ case 1695: if (n[1695]++ > 0) check ('a string 1695'); break;
+ case 1696: if (n[1696]++ > 0) check ('a string 1696'); break;
+ case 1697: if (n[1697]++ > 0) check ('a string 1697'); break;
+ case 1698: if (n[1698]++ > 0) check ('a string 1698'); break;
+ case 1699: if (n[1699]++ > 0) check ('a string 1699'); break;
+ case 1700: if (n[1700]++ > 0) check ('a string 1700'); break;
+ case 1701: if (n[1701]++ > 0) check ('a string 1701'); break;
+ case 1702: if (n[1702]++ > 0) check ('a string 1702'); break;
+ case 1703: if (n[1703]++ > 0) check ('a string 1703'); break;
+ case 1704: if (n[1704]++ > 0) check ('a string 1704'); break;
+ case 1705: if (n[1705]++ > 0) check ('a string 1705'); break;
+ case 1706: if (n[1706]++ > 0) check ('a string 1706'); break;
+ case 1707: if (n[1707]++ > 0) check ('a string 1707'); break;
+ case 1708: if (n[1708]++ > 0) check ('a string 1708'); break;
+ case 1709: if (n[1709]++ > 0) check ('a string 1709'); break;
+ case 1710: if (n[1710]++ > 0) check ('a string 1710'); break;
+ case 1711: if (n[1711]++ > 0) check ('a string 1711'); break;
+ case 1712: if (n[1712]++ > 0) check ('a string 1712'); break;
+ case 1713: if (n[1713]++ > 0) check ('a string 1713'); break;
+ case 1714: if (n[1714]++ > 0) check ('a string 1714'); break;
+ case 1715: if (n[1715]++ > 0) check ('a string 1715'); break;
+ case 1716: if (n[1716]++ > 0) check ('a string 1716'); break;
+ case 1717: if (n[1717]++ > 0) check ('a string 1717'); break;
+ case 1718: if (n[1718]++ > 0) check ('a string 1718'); break;
+ case 1719: if (n[1719]++ > 0) check ('a string 1719'); break;
+ case 1720: if (n[1720]++ > 0) check ('a string 1720'); break;
+ case 1721: if (n[1721]++ > 0) check ('a string 1721'); break;
+ case 1722: if (n[1722]++ > 0) check ('a string 1722'); break;
+ case 1723: if (n[1723]++ > 0) check ('a string 1723'); break;
+ case 1724: if (n[1724]++ > 0) check ('a string 1724'); break;
+ case 1725: if (n[1725]++ > 0) check ('a string 1725'); break;
+ case 1726: if (n[1726]++ > 0) check ('a string 1726'); break;
+ case 1727: if (n[1727]++ > 0) check ('a string 1727'); break;
+ case 1728: if (n[1728]++ > 0) check ('a string 1728'); break;
+ case 1729: if (n[1729]++ > 0) check ('a string 1729'); break;
+ case 1730: if (n[1730]++ > 0) check ('a string 1730'); break;
+ case 1731: if (n[1731]++ > 0) check ('a string 1731'); break;
+ case 1732: if (n[1732]++ > 0) check ('a string 1732'); break;
+ case 1733: if (n[1733]++ > 0) check ('a string 1733'); break;
+ case 1734: if (n[1734]++ > 0) check ('a string 1734'); break;
+ case 1735: if (n[1735]++ > 0) check ('a string 1735'); break;
+ case 1736: if (n[1736]++ > 0) check ('a string 1736'); break;
+ case 1737: if (n[1737]++ > 0) check ('a string 1737'); break;
+ case 1738: if (n[1738]++ > 0) check ('a string 1738'); break;
+ case 1739: if (n[1739]++ > 0) check ('a string 1739'); break;
+ case 1740: if (n[1740]++ > 0) check ('a string 1740'); break;
+ case 1741: if (n[1741]++ > 0) check ('a string 1741'); break;
+ case 1742: if (n[1742]++ > 0) check ('a string 1742'); break;
+ case 1743: if (n[1743]++ > 0) check ('a string 1743'); break;
+ case 1744: if (n[1744]++ > 0) check ('a string 1744'); break;
+ case 1745: if (n[1745]++ > 0) check ('a string 1745'); break;
+ case 1746: if (n[1746]++ > 0) check ('a string 1746'); break;
+ case 1747: if (n[1747]++ > 0) check ('a string 1747'); break;
+ case 1748: if (n[1748]++ > 0) check ('a string 1748'); break;
+ case 1749: if (n[1749]++ > 0) check ('a string 1749'); break;
+ case 1750: if (n[1750]++ > 0) check ('a string 1750'); break;
+ case 1751: if (n[1751]++ > 0) check ('a string 1751'); break;
+ case 1752: if (n[1752]++ > 0) check ('a string 1752'); break;
+ case 1753: if (n[1753]++ > 0) check ('a string 1753'); break;
+ case 1754: if (n[1754]++ > 0) check ('a string 1754'); break;
+ case 1755: if (n[1755]++ > 0) check ('a string 1755'); break;
+ case 1756: if (n[1756]++ > 0) check ('a string 1756'); break;
+ case 1757: if (n[1757]++ > 0) check ('a string 1757'); break;
+ case 1758: if (n[1758]++ > 0) check ('a string 1758'); break;
+ case 1759: if (n[1759]++ > 0) check ('a string 1759'); break;
+ case 1760: if (n[1760]++ > 0) check ('a string 1760'); break;
+ case 1761: if (n[1761]++ > 0) check ('a string 1761'); break;
+ case 1762: if (n[1762]++ > 0) check ('a string 1762'); break;
+ case 1763: if (n[1763]++ > 0) check ('a string 1763'); break;
+ case 1764: if (n[1764]++ > 0) check ('a string 1764'); break;
+ case 1765: if (n[1765]++ > 0) check ('a string 1765'); break;
+ case 1766: if (n[1766]++ > 0) check ('a string 1766'); break;
+ case 1767: if (n[1767]++ > 0) check ('a string 1767'); break;
+ case 1768: if (n[1768]++ > 0) check ('a string 1768'); break;
+ case 1769: if (n[1769]++ > 0) check ('a string 1769'); break;
+ case 1770: if (n[1770]++ > 0) check ('a string 1770'); break;
+ case 1771: if (n[1771]++ > 0) check ('a string 1771'); break;
+ case 1772: if (n[1772]++ > 0) check ('a string 1772'); break;
+ case 1773: if (n[1773]++ > 0) check ('a string 1773'); break;
+ case 1774: if (n[1774]++ > 0) check ('a string 1774'); break;
+ case 1775: if (n[1775]++ > 0) check ('a string 1775'); break;
+ case 1776: if (n[1776]++ > 0) check ('a string 1776'); break;
+ case 1777: if (n[1777]++ > 0) check ('a string 1777'); break;
+ case 1778: if (n[1778]++ > 0) check ('a string 1778'); break;
+ case 1779: if (n[1779]++ > 0) check ('a string 1779'); break;
+ case 1780: if (n[1780]++ > 0) check ('a string 1780'); break;
+ case 1781: if (n[1781]++ > 0) check ('a string 1781'); break;
+ case 1782: if (n[1782]++ > 0) check ('a string 1782'); break;
+ case 1783: if (n[1783]++ > 0) check ('a string 1783'); break;
+ case 1784: if (n[1784]++ > 0) check ('a string 1784'); break;
+ case 1785: if (n[1785]++ > 0) check ('a string 1785'); break;
+ case 1786: if (n[1786]++ > 0) check ('a string 1786'); break;
+ case 1787: if (n[1787]++ > 0) check ('a string 1787'); break;
+ case 1788: if (n[1788]++ > 0) check ('a string 1788'); break;
+ case 1789: if (n[1789]++ > 0) check ('a string 1789'); break;
+ case 1790: if (n[1790]++ > 0) check ('a string 1790'); break;
+ case 1791: if (n[1791]++ > 0) check ('a string 1791'); break;
+ case 1792: if (n[1792]++ > 0) check ('a string 1792'); break;
+ case 1793: if (n[1793]++ > 0) check ('a string 1793'); break;
+ case 1794: if (n[1794]++ > 0) check ('a string 1794'); break;
+ case 1795: if (n[1795]++ > 0) check ('a string 1795'); break;
+ case 1796: if (n[1796]++ > 0) check ('a string 1796'); break;
+ case 1797: if (n[1797]++ > 0) check ('a string 1797'); break;
+ case 1798: if (n[1798]++ > 0) check ('a string 1798'); break;
+ case 1799: if (n[1799]++ > 0) check ('a string 1799'); break;
+ case 1800: if (n[1800]++ > 0) check ('a string 1800'); break;
+ case 1801: if (n[1801]++ > 0) check ('a string 1801'); break;
+ case 1802: if (n[1802]++ > 0) check ('a string 1802'); break;
+ case 1803: if (n[1803]++ > 0) check ('a string 1803'); break;
+ case 1804: if (n[1804]++ > 0) check ('a string 1804'); break;
+ case 1805: if (n[1805]++ > 0) check ('a string 1805'); break;
+ case 1806: if (n[1806]++ > 0) check ('a string 1806'); break;
+ case 1807: if (n[1807]++ > 0) check ('a string 1807'); break;
+ case 1808: if (n[1808]++ > 0) check ('a string 1808'); break;
+ case 1809: if (n[1809]++ > 0) check ('a string 1809'); break;
+ case 1810: if (n[1810]++ > 0) check ('a string 1810'); break;
+ case 1811: if (n[1811]++ > 0) check ('a string 1811'); break;
+ case 1812: if (n[1812]++ > 0) check ('a string 1812'); break;
+ case 1813: if (n[1813]++ > 0) check ('a string 1813'); break;
+ case 1814: if (n[1814]++ > 0) check ('a string 1814'); break;
+ case 1815: if (n[1815]++ > 0) check ('a string 1815'); break;
+ case 1816: if (n[1816]++ > 0) check ('a string 1816'); break;
+ case 1817: if (n[1817]++ > 0) check ('a string 1817'); break;
+ case 1818: if (n[1818]++ > 0) check ('a string 1818'); break;
+ case 1819: if (n[1819]++ > 0) check ('a string 1819'); break;
+ case 1820: if (n[1820]++ > 0) check ('a string 1820'); break;
+ case 1821: if (n[1821]++ > 0) check ('a string 1821'); break;
+ case 1822: if (n[1822]++ > 0) check ('a string 1822'); break;
+ case 1823: if (n[1823]++ > 0) check ('a string 1823'); break;
+ case 1824: if (n[1824]++ > 0) check ('a string 1824'); break;
+ case 1825: if (n[1825]++ > 0) check ('a string 1825'); break;
+ case 1826: if (n[1826]++ > 0) check ('a string 1826'); break;
+ case 1827: if (n[1827]++ > 0) check ('a string 1827'); break;
+ case 1828: if (n[1828]++ > 0) check ('a string 1828'); break;
+ case 1829: if (n[1829]++ > 0) check ('a string 1829'); break;
+ case 1830: if (n[1830]++ > 0) check ('a string 1830'); break;
+ case 1831: if (n[1831]++ > 0) check ('a string 1831'); break;
+ case 1832: if (n[1832]++ > 0) check ('a string 1832'); break;
+ case 1833: if (n[1833]++ > 0) check ('a string 1833'); break;
+ case 1834: if (n[1834]++ > 0) check ('a string 1834'); break;
+ case 1835: if (n[1835]++ > 0) check ('a string 1835'); break;
+ case 1836: if (n[1836]++ > 0) check ('a string 1836'); break;
+ case 1837: if (n[1837]++ > 0) check ('a string 1837'); break;
+ case 1838: if (n[1838]++ > 0) check ('a string 1838'); break;
+ case 1839: if (n[1839]++ > 0) check ('a string 1839'); break;
+ case 1840: if (n[1840]++ > 0) check ('a string 1840'); break;
+ case 1841: if (n[1841]++ > 0) check ('a string 1841'); break;
+ case 1842: if (n[1842]++ > 0) check ('a string 1842'); break;
+ case 1843: if (n[1843]++ > 0) check ('a string 1843'); break;
+ case 1844: if (n[1844]++ > 0) check ('a string 1844'); break;
+ case 1845: if (n[1845]++ > 0) check ('a string 1845'); break;
+ case 1846: if (n[1846]++ > 0) check ('a string 1846'); break;
+ case 1847: if (n[1847]++ > 0) check ('a string 1847'); break;
+ case 1848: if (n[1848]++ > 0) check ('a string 1848'); break;
+ case 1849: if (n[1849]++ > 0) check ('a string 1849'); break;
+ case 1850: if (n[1850]++ > 0) check ('a string 1850'); break;
+ case 1851: if (n[1851]++ > 0) check ('a string 1851'); break;
+ case 1852: if (n[1852]++ > 0) check ('a string 1852'); break;
+ case 1853: if (n[1853]++ > 0) check ('a string 1853'); break;
+ case 1854: if (n[1854]++ > 0) check ('a string 1854'); break;
+ case 1855: if (n[1855]++ > 0) check ('a string 1855'); break;
+ case 1856: if (n[1856]++ > 0) check ('a string 1856'); break;
+ case 1857: if (n[1857]++ > 0) check ('a string 1857'); break;
+ case 1858: if (n[1858]++ > 0) check ('a string 1858'); break;
+ case 1859: if (n[1859]++ > 0) check ('a string 1859'); break;
+ case 1860: if (n[1860]++ > 0) check ('a string 1860'); break;
+ case 1861: if (n[1861]++ > 0) check ('a string 1861'); break;
+ case 1862: if (n[1862]++ > 0) check ('a string 1862'); break;
+ case 1863: if (n[1863]++ > 0) check ('a string 1863'); break;
+ case 1864: if (n[1864]++ > 0) check ('a string 1864'); break;
+ case 1865: if (n[1865]++ > 0) check ('a string 1865'); break;
+ case 1866: if (n[1866]++ > 0) check ('a string 1866'); break;
+ case 1867: if (n[1867]++ > 0) check ('a string 1867'); break;
+ case 1868: if (n[1868]++ > 0) check ('a string 1868'); break;
+ case 1869: if (n[1869]++ > 0) check ('a string 1869'); break;
+ case 1870: if (n[1870]++ > 0) check ('a string 1870'); break;
+ case 1871: if (n[1871]++ > 0) check ('a string 1871'); break;
+ case 1872: if (n[1872]++ > 0) check ('a string 1872'); break;
+ case 1873: if (n[1873]++ > 0) check ('a string 1873'); break;
+ case 1874: if (n[1874]++ > 0) check ('a string 1874'); break;
+ case 1875: if (n[1875]++ > 0) check ('a string 1875'); break;
+ case 1876: if (n[1876]++ > 0) check ('a string 1876'); break;
+ case 1877: if (n[1877]++ > 0) check ('a string 1877'); break;
+ case 1878: if (n[1878]++ > 0) check ('a string 1878'); break;
+ case 1879: if (n[1879]++ > 0) check ('a string 1879'); break;
+ case 1880: if (n[1880]++ > 0) check ('a string 1880'); break;
+ case 1881: if (n[1881]++ > 0) check ('a string 1881'); break;
+ case 1882: if (n[1882]++ > 0) check ('a string 1882'); break;
+ case 1883: if (n[1883]++ > 0) check ('a string 1883'); break;
+ case 1884: if (n[1884]++ > 0) check ('a string 1884'); break;
+ case 1885: if (n[1885]++ > 0) check ('a string 1885'); break;
+ case 1886: if (n[1886]++ > 0) check ('a string 1886'); break;
+ case 1887: if (n[1887]++ > 0) check ('a string 1887'); break;
+ case 1888: if (n[1888]++ > 0) check ('a string 1888'); break;
+ case 1889: if (n[1889]++ > 0) check ('a string 1889'); break;
+ case 1890: if (n[1890]++ > 0) check ('a string 1890'); break;
+ case 1891: if (n[1891]++ > 0) check ('a string 1891'); break;
+ case 1892: if (n[1892]++ > 0) check ('a string 1892'); break;
+ case 1893: if (n[1893]++ > 0) check ('a string 1893'); break;
+ case 1894: if (n[1894]++ > 0) check ('a string 1894'); break;
+ case 1895: if (n[1895]++ > 0) check ('a string 1895'); break;
+ case 1896: if (n[1896]++ > 0) check ('a string 1896'); break;
+ case 1897: if (n[1897]++ > 0) check ('a string 1897'); break;
+ case 1898: if (n[1898]++ > 0) check ('a string 1898'); break;
+ case 1899: if (n[1899]++ > 0) check ('a string 1899'); break;
+ case 1900: if (n[1900]++ > 0) check ('a string 1900'); break;
+ case 1901: if (n[1901]++ > 0) check ('a string 1901'); break;
+ case 1902: if (n[1902]++ > 0) check ('a string 1902'); break;
+ case 1903: if (n[1903]++ > 0) check ('a string 1903'); break;
+ case 1904: if (n[1904]++ > 0) check ('a string 1904'); break;
+ case 1905: if (n[1905]++ > 0) check ('a string 1905'); break;
+ case 1906: if (n[1906]++ > 0) check ('a string 1906'); break;
+ case 1907: if (n[1907]++ > 0) check ('a string 1907'); break;
+ case 1908: if (n[1908]++ > 0) check ('a string 1908'); break;
+ case 1909: if (n[1909]++ > 0) check ('a string 1909'); break;
+ case 1910: if (n[1910]++ > 0) check ('a string 1910'); break;
+ case 1911: if (n[1911]++ > 0) check ('a string 1911'); break;
+ case 1912: if (n[1912]++ > 0) check ('a string 1912'); break;
+ case 1913: if (n[1913]++ > 0) check ('a string 1913'); break;
+ case 1914: if (n[1914]++ > 0) check ('a string 1914'); break;
+ case 1915: if (n[1915]++ > 0) check ('a string 1915'); break;
+ case 1916: if (n[1916]++ > 0) check ('a string 1916'); break;
+ case 1917: if (n[1917]++ > 0) check ('a string 1917'); break;
+ case 1918: if (n[1918]++ > 0) check ('a string 1918'); break;
+ case 1919: if (n[1919]++ > 0) check ('a string 1919'); break;
+ case 1920: if (n[1920]++ > 0) check ('a string 1920'); break;
+ case 1921: if (n[1921]++ > 0) check ('a string 1921'); break;
+ case 1922: if (n[1922]++ > 0) check ('a string 1922'); break;
+ case 1923: if (n[1923]++ > 0) check ('a string 1923'); break;
+ case 1924: if (n[1924]++ > 0) check ('a string 1924'); break;
+ case 1925: if (n[1925]++ > 0) check ('a string 1925'); break;
+ case 1926: if (n[1926]++ > 0) check ('a string 1926'); break;
+ case 1927: if (n[1927]++ > 0) check ('a string 1927'); break;
+ case 1928: if (n[1928]++ > 0) check ('a string 1928'); break;
+ case 1929: if (n[1929]++ > 0) check ('a string 1929'); break;
+ case 1930: if (n[1930]++ > 0) check ('a string 1930'); break;
+ case 1931: if (n[1931]++ > 0) check ('a string 1931'); break;
+ case 1932: if (n[1932]++ > 0) check ('a string 1932'); break;
+ case 1933: if (n[1933]++ > 0) check ('a string 1933'); break;
+ case 1934: if (n[1934]++ > 0) check ('a string 1934'); break;
+ case 1935: if (n[1935]++ > 0) check ('a string 1935'); break;
+ case 1936: if (n[1936]++ > 0) check ('a string 1936'); break;
+ case 1937: if (n[1937]++ > 0) check ('a string 1937'); break;
+ case 1938: if (n[1938]++ > 0) check ('a string 1938'); break;
+ case 1939: if (n[1939]++ > 0) check ('a string 1939'); break;
+ case 1940: if (n[1940]++ > 0) check ('a string 1940'); break;
+ case 1941: if (n[1941]++ > 0) check ('a string 1941'); break;
+ case 1942: if (n[1942]++ > 0) check ('a string 1942'); break;
+ case 1943: if (n[1943]++ > 0) check ('a string 1943'); break;
+ case 1944: if (n[1944]++ > 0) check ('a string 1944'); break;
+ case 1945: if (n[1945]++ > 0) check ('a string 1945'); break;
+ case 1946: if (n[1946]++ > 0) check ('a string 1946'); break;
+ case 1947: if (n[1947]++ > 0) check ('a string 1947'); break;
+ case 1948: if (n[1948]++ > 0) check ('a string 1948'); break;
+ case 1949: if (n[1949]++ > 0) check ('a string 1949'); break;
+ case 1950: if (n[1950]++ > 0) check ('a string 1950'); break;
+ case 1951: if (n[1951]++ > 0) check ('a string 1951'); break;
+ case 1952: if (n[1952]++ > 0) check ('a string 1952'); break;
+ case 1953: if (n[1953]++ > 0) check ('a string 1953'); break;
+ case 1954: if (n[1954]++ > 0) check ('a string 1954'); break;
+ case 1955: if (n[1955]++ > 0) check ('a string 1955'); break;
+ case 1956: if (n[1956]++ > 0) check ('a string 1956'); break;
+ case 1957: if (n[1957]++ > 0) check ('a string 1957'); break;
+ case 1958: if (n[1958]++ > 0) check ('a string 1958'); break;
+ case 1959: if (n[1959]++ > 0) check ('a string 1959'); break;
+ case 1960: if (n[1960]++ > 0) check ('a string 1960'); break;
+ case 1961: if (n[1961]++ > 0) check ('a string 1961'); break;
+ case 1962: if (n[1962]++ > 0) check ('a string 1962'); break;
+ case 1963: if (n[1963]++ > 0) check ('a string 1963'); break;
+ case 1964: if (n[1964]++ > 0) check ('a string 1964'); break;
+ case 1965: if (n[1965]++ > 0) check ('a string 1965'); break;
+ case 1966: if (n[1966]++ > 0) check ('a string 1966'); break;
+ case 1967: if (n[1967]++ > 0) check ('a string 1967'); break;
+ case 1968: if (n[1968]++ > 0) check ('a string 1968'); break;
+ case 1969: if (n[1969]++ > 0) check ('a string 1969'); break;
+ case 1970: if (n[1970]++ > 0) check ('a string 1970'); break;
+ case 1971: if (n[1971]++ > 0) check ('a string 1971'); break;
+ case 1972: if (n[1972]++ > 0) check ('a string 1972'); break;
+ case 1973: if (n[1973]++ > 0) check ('a string 1973'); break;
+ case 1974: if (n[1974]++ > 0) check ('a string 1974'); break;
+ case 1975: if (n[1975]++ > 0) check ('a string 1975'); break;
+ case 1976: if (n[1976]++ > 0) check ('a string 1976'); break;
+ case 1977: if (n[1977]++ > 0) check ('a string 1977'); break;
+ case 1978: if (n[1978]++ > 0) check ('a string 1978'); break;
+ case 1979: if (n[1979]++ > 0) check ('a string 1979'); break;
+ case 1980: if (n[1980]++ > 0) check ('a string 1980'); break;
+ case 1981: if (n[1981]++ > 0) check ('a string 1981'); break;
+ case 1982: if (n[1982]++ > 0) check ('a string 1982'); break;
+ case 1983: if (n[1983]++ > 0) check ('a string 1983'); break;
+ case 1984: if (n[1984]++ > 0) check ('a string 1984'); break;
+ case 1985: if (n[1985]++ > 0) check ('a string 1985'); break;
+ case 1986: if (n[1986]++ > 0) check ('a string 1986'); break;
+ case 1987: if (n[1987]++ > 0) check ('a string 1987'); break;
+ case 1988: if (n[1988]++ > 0) check ('a string 1988'); break;
+ case 1989: if (n[1989]++ > 0) check ('a string 1989'); break;
+ case 1990: if (n[1990]++ > 0) check ('a string 1990'); break;
+ case 1991: if (n[1991]++ > 0) check ('a string 1991'); break;
+ case 1992: if (n[1992]++ > 0) check ('a string 1992'); break;
+ case 1993: if (n[1993]++ > 0) check ('a string 1993'); break;
+ case 1994: if (n[1994]++ > 0) check ('a string 1994'); break;
+ case 1995: if (n[1995]++ > 0) check ('a string 1995'); break;
+ case 1996: if (n[1996]++ > 0) check ('a string 1996'); break;
+ case 1997: if (n[1997]++ > 0) check ('a string 1997'); break;
+ case 1998: if (n[1998]++ > 0) check ('a string 1998'); break;
+ case 1999: if (n[1999]++ > 0) check ('a string 1999'); break;
+ case 2000: if (n[2000]++ > 0) check ('a string 2000'); break;
+ case 2001: if (n[2001]++ > 0) check ('a string 2001'); break;
+ case 2002: if (n[2002]++ > 0) check ('a string 2002'); break;
+ case 2003: if (n[2003]++ > 0) check ('a string 2003'); break;
+ case 2004: if (n[2004]++ > 0) check ('a string 2004'); break;
+ case 2005: if (n[2005]++ > 0) check ('a string 2005'); break;
+ case 2006: if (n[2006]++ > 0) check ('a string 2006'); break;
+ case 2007: if (n[2007]++ > 0) check ('a string 2007'); break;
+ case 2008: if (n[2008]++ > 0) check ('a string 2008'); break;
+ case 2009: if (n[2009]++ > 0) check ('a string 2009'); break;
+ case 2010: if (n[2010]++ > 0) check ('a string 2010'); break;
+ case 2011: if (n[2011]++ > 0) check ('a string 2011'); break;
+ case 2012: if (n[2012]++ > 0) check ('a string 2012'); break;
+ case 2013: if (n[2013]++ > 0) check ('a string 2013'); break;
+ case 2014: if (n[2014]++ > 0) check ('a string 2014'); break;
+ case 2015: if (n[2015]++ > 0) check ('a string 2015'); break;
+ case 2016: if (n[2016]++ > 0) check ('a string 2016'); break;
+ case 2017: if (n[2017]++ > 0) check ('a string 2017'); break;
+ case 2018: if (n[2018]++ > 0) check ('a string 2018'); break;
+ case 2019: if (n[2019]++ > 0) check ('a string 2019'); break;
+ case 2020: if (n[2020]++ > 0) check ('a string 2020'); break;
+ case 2021: if (n[2021]++ > 0) check ('a string 2021'); break;
+ case 2022: if (n[2022]++ > 0) check ('a string 2022'); break;
+ case 2023: if (n[2023]++ > 0) check ('a string 2023'); break;
+ case 2024: if (n[2024]++ > 0) check ('a string 2024'); break;
+ case 2025: if (n[2025]++ > 0) check ('a string 2025'); break;
+ case 2026: if (n[2026]++ > 0) check ('a string 2026'); break;
+ case 2027: if (n[2027]++ > 0) check ('a string 2027'); break;
+ case 2028: if (n[2028]++ > 0) check ('a string 2028'); break;
+ case 2029: if (n[2029]++ > 0) check ('a string 2029'); break;
+ case 2030: if (n[2030]++ > 0) check ('a string 2030'); break;
+ case 2031: if (n[2031]++ > 0) check ('a string 2031'); break;
+ case 2032: if (n[2032]++ > 0) check ('a string 2032'); break;
+ case 2033: if (n[2033]++ > 0) check ('a string 2033'); break;
+ case 2034: if (n[2034]++ > 0) check ('a string 2034'); break;
+ case 2035: if (n[2035]++ > 0) check ('a string 2035'); break;
+ case 2036: if (n[2036]++ > 0) check ('a string 2036'); break;
+ case 2037: if (n[2037]++ > 0) check ('a string 2037'); break;
+ case 2038: if (n[2038]++ > 0) check ('a string 2038'); break;
+ case 2039: if (n[2039]++ > 0) check ('a string 2039'); break;
+ case 2040: if (n[2040]++ > 0) check ('a string 2040'); break;
+ case 2041: if (n[2041]++ > 0) check ('a string 2041'); break;
+ case 2042: if (n[2042]++ > 0) check ('a string 2042'); break;
+ case 2043: if (n[2043]++ > 0) check ('a string 2043'); break;
+ case 2044: if (n[2044]++ > 0) check ('a string 2044'); break;
+ case 2045: if (n[2045]++ > 0) check ('a string 2045'); break;
+ case 2046: if (n[2046]++ > 0) check ('a string 2046'); break;
+ case 2047: if (n[2047]++ > 0) check ('a string 2047'); break;
+ case 2048: if (n[2048]++ > 0) check ('a string 2048'); break;
+ case 2049: if (n[2049]++ > 0) check ('a string 2049'); break;
+ case 2050: if (n[2050]++ > 0) check ('a string 2050'); break;
+ case 2051: if (n[2051]++ > 0) check ('a string 2051'); break;
+ case 2052: if (n[2052]++ > 0) check ('a string 2052'); break;
+ case 2053: if (n[2053]++ > 0) check ('a string 2053'); break;
+ case 2054: if (n[2054]++ > 0) check ('a string 2054'); break;
+ case 2055: if (n[2055]++ > 0) check ('a string 2055'); break;
+ case 2056: if (n[2056]++ > 0) check ('a string 2056'); break;
+ case 2057: if (n[2057]++ > 0) check ('a string 2057'); break;
+ case 2058: if (n[2058]++ > 0) check ('a string 2058'); break;
+ case 2059: if (n[2059]++ > 0) check ('a string 2059'); break;
+ case 2060: if (n[2060]++ > 0) check ('a string 2060'); break;
+ case 2061: if (n[2061]++ > 0) check ('a string 2061'); break;
+ case 2062: if (n[2062]++ > 0) check ('a string 2062'); break;
+ case 2063: if (n[2063]++ > 0) check ('a string 2063'); break;
+ case 2064: if (n[2064]++ > 0) check ('a string 2064'); break;
+ case 2065: if (n[2065]++ > 0) check ('a string 2065'); break;
+ case 2066: if (n[2066]++ > 0) check ('a string 2066'); break;
+ case 2067: if (n[2067]++ > 0) check ('a string 2067'); break;
+ case 2068: if (n[2068]++ > 0) check ('a string 2068'); break;
+ case 2069: if (n[2069]++ > 0) check ('a string 2069'); break;
+ case 2070: if (n[2070]++ > 0) check ('a string 2070'); break;
+ case 2071: if (n[2071]++ > 0) check ('a string 2071'); break;
+ case 2072: if (n[2072]++ > 0) check ('a string 2072'); break;
+ case 2073: if (n[2073]++ > 0) check ('a string 2073'); break;
+ case 2074: if (n[2074]++ > 0) check ('a string 2074'); break;
+ case 2075: if (n[2075]++ > 0) check ('a string 2075'); break;
+ case 2076: if (n[2076]++ > 0) check ('a string 2076'); break;
+ case 2077: if (n[2077]++ > 0) check ('a string 2077'); break;
+ case 2078: if (n[2078]++ > 0) check ('a string 2078'); break;
+ case 2079: if (n[2079]++ > 0) check ('a string 2079'); break;
+ case 2080: if (n[2080]++ > 0) check ('a string 2080'); break;
+ case 2081: if (n[2081]++ > 0) check ('a string 2081'); break;
+ case 2082: if (n[2082]++ > 0) check ('a string 2082'); break;
+ case 2083: if (n[2083]++ > 0) check ('a string 2083'); break;
+ case 2084: if (n[2084]++ > 0) check ('a string 2084'); break;
+ case 2085: if (n[2085]++ > 0) check ('a string 2085'); break;
+ case 2086: if (n[2086]++ > 0) check ('a string 2086'); break;
+ case 2087: if (n[2087]++ > 0) check ('a string 2087'); break;
+ case 2088: if (n[2088]++ > 0) check ('a string 2088'); break;
+ case 2089: if (n[2089]++ > 0) check ('a string 2089'); break;
+ case 2090: if (n[2090]++ > 0) check ('a string 2090'); break;
+ case 2091: if (n[2091]++ > 0) check ('a string 2091'); break;
+ case 2092: if (n[2092]++ > 0) check ('a string 2092'); break;
+ case 2093: if (n[2093]++ > 0) check ('a string 2093'); break;
+ case 2094: if (n[2094]++ > 0) check ('a string 2094'); break;
+ case 2095: if (n[2095]++ > 0) check ('a string 2095'); break;
+ case 2096: if (n[2096]++ > 0) check ('a string 2096'); break;
+ case 2097: if (n[2097]++ > 0) check ('a string 2097'); break;
+ case 2098: if (n[2098]++ > 0) check ('a string 2098'); break;
+ case 2099: if (n[2099]++ > 0) check ('a string 2099'); break;
+ case 2100: if (n[2100]++ > 0) check ('a string 2100'); break;
+ case 2101: if (n[2101]++ > 0) check ('a string 2101'); break;
+ case 2102: if (n[2102]++ > 0) check ('a string 2102'); break;
+ case 2103: if (n[2103]++ > 0) check ('a string 2103'); break;
+ case 2104: if (n[2104]++ > 0) check ('a string 2104'); break;
+ case 2105: if (n[2105]++ > 0) check ('a string 2105'); break;
+ case 2106: if (n[2106]++ > 0) check ('a string 2106'); break;
+ case 2107: if (n[2107]++ > 0) check ('a string 2107'); break;
+ case 2108: if (n[2108]++ > 0) check ('a string 2108'); break;
+ case 2109: if (n[2109]++ > 0) check ('a string 2109'); break;
+ case 2110: if (n[2110]++ > 0) check ('a string 2110'); break;
+ case 2111: if (n[2111]++ > 0) check ('a string 2111'); break;
+ case 2112: if (n[2112]++ > 0) check ('a string 2112'); break;
+ case 2113: if (n[2113]++ > 0) check ('a string 2113'); break;
+ case 2114: if (n[2114]++ > 0) check ('a string 2114'); break;
+ case 2115: if (n[2115]++ > 0) check ('a string 2115'); break;
+ case 2116: if (n[2116]++ > 0) check ('a string 2116'); break;
+ case 2117: if (n[2117]++ > 0) check ('a string 2117'); break;
+ case 2118: if (n[2118]++ > 0) check ('a string 2118'); break;
+ case 2119: if (n[2119]++ > 0) check ('a string 2119'); break;
+ case 2120: if (n[2120]++ > 0) check ('a string 2120'); break;
+ case 2121: if (n[2121]++ > 0) check ('a string 2121'); break;
+ case 2122: if (n[2122]++ > 0) check ('a string 2122'); break;
+ case 2123: if (n[2123]++ > 0) check ('a string 2123'); break;
+ case 2124: if (n[2124]++ > 0) check ('a string 2124'); break;
+ case 2125: if (n[2125]++ > 0) check ('a string 2125'); break;
+ case 2126: if (n[2126]++ > 0) check ('a string 2126'); break;
+ case 2127: if (n[2127]++ > 0) check ('a string 2127'); break;
+ case 2128: if (n[2128]++ > 0) check ('a string 2128'); break;
+ case 2129: if (n[2129]++ > 0) check ('a string 2129'); break;
+ case 2130: if (n[2130]++ > 0) check ('a string 2130'); break;
+ case 2131: if (n[2131]++ > 0) check ('a string 2131'); break;
+ case 2132: if (n[2132]++ > 0) check ('a string 2132'); break;
+ case 2133: if (n[2133]++ > 0) check ('a string 2133'); break;
+ case 2134: if (n[2134]++ > 0) check ('a string 2134'); break;
+ case 2135: if (n[2135]++ > 0) check ('a string 2135'); break;
+ case 2136: if (n[2136]++ > 0) check ('a string 2136'); break;
+ case 2137: if (n[2137]++ > 0) check ('a string 2137'); break;
+ case 2138: if (n[2138]++ > 0) check ('a string 2138'); break;
+ case 2139: if (n[2139]++ > 0) check ('a string 2139'); break;
+ case 2140: if (n[2140]++ > 0) check ('a string 2140'); break;
+ case 2141: if (n[2141]++ > 0) check ('a string 2141'); break;
+ case 2142: if (n[2142]++ > 0) check ('a string 2142'); break;
+ case 2143: if (n[2143]++ > 0) check ('a string 2143'); break;
+ case 2144: if (n[2144]++ > 0) check ('a string 2144'); break;
+ case 2145: if (n[2145]++ > 0) check ('a string 2145'); break;
+ case 2146: if (n[2146]++ > 0) check ('a string 2146'); break;
+ case 2147: if (n[2147]++ > 0) check ('a string 2147'); break;
+ case 2148: if (n[2148]++ > 0) check ('a string 2148'); break;
+ case 2149: if (n[2149]++ > 0) check ('a string 2149'); break;
+ case 2150: if (n[2150]++ > 0) check ('a string 2150'); break;
+ case 2151: if (n[2151]++ > 0) check ('a string 2151'); break;
+ case 2152: if (n[2152]++ > 0) check ('a string 2152'); break;
+ case 2153: if (n[2153]++ > 0) check ('a string 2153'); break;
+ case 2154: if (n[2154]++ > 0) check ('a string 2154'); break;
+ case 2155: if (n[2155]++ > 0) check ('a string 2155'); break;
+ case 2156: if (n[2156]++ > 0) check ('a string 2156'); break;
+ case 2157: if (n[2157]++ > 0) check ('a string 2157'); break;
+ case 2158: if (n[2158]++ > 0) check ('a string 2158'); break;
+ case 2159: if (n[2159]++ > 0) check ('a string 2159'); break;
+ case 2160: if (n[2160]++ > 0) check ('a string 2160'); break;
+ case 2161: if (n[2161]++ > 0) check ('a string 2161'); break;
+ case 2162: if (n[2162]++ > 0) check ('a string 2162'); break;
+ case 2163: if (n[2163]++ > 0) check ('a string 2163'); break;
+ case 2164: if (n[2164]++ > 0) check ('a string 2164'); break;
+ case 2165: if (n[2165]++ > 0) check ('a string 2165'); break;
+ case 2166: if (n[2166]++ > 0) check ('a string 2166'); break;
+ case 2167: if (n[2167]++ > 0) check ('a string 2167'); break;
+ case 2168: if (n[2168]++ > 0) check ('a string 2168'); break;
+ case 2169: if (n[2169]++ > 0) check ('a string 2169'); break;
+ case 2170: if (n[2170]++ > 0) check ('a string 2170'); break;
+ case 2171: if (n[2171]++ > 0) check ('a string 2171'); break;
+ case 2172: if (n[2172]++ > 0) check ('a string 2172'); break;
+ case 2173: if (n[2173]++ > 0) check ('a string 2173'); break;
+ case 2174: if (n[2174]++ > 0) check ('a string 2174'); break;
+ case 2175: if (n[2175]++ > 0) check ('a string 2175'); break;
+ case 2176: if (n[2176]++ > 0) check ('a string 2176'); break;
+ case 2177: if (n[2177]++ > 0) check ('a string 2177'); break;
+ case 2178: if (n[2178]++ > 0) check ('a string 2178'); break;
+ case 2179: if (n[2179]++ > 0) check ('a string 2179'); break;
+ case 2180: if (n[2180]++ > 0) check ('a string 2180'); break;
+ case 2181: if (n[2181]++ > 0) check ('a string 2181'); break;
+ case 2182: if (n[2182]++ > 0) check ('a string 2182'); break;
+ case 2183: if (n[2183]++ > 0) check ('a string 2183'); break;
+ case 2184: if (n[2184]++ > 0) check ('a string 2184'); break;
+ case 2185: if (n[2185]++ > 0) check ('a string 2185'); break;
+ case 2186: if (n[2186]++ > 0) check ('a string 2186'); break;
+ case 2187: if (n[2187]++ > 0) check ('a string 2187'); break;
+ case 2188: if (n[2188]++ > 0) check ('a string 2188'); break;
+ case 2189: if (n[2189]++ > 0) check ('a string 2189'); break;
+ case 2190: if (n[2190]++ > 0) check ('a string 2190'); break;
+ case 2191: if (n[2191]++ > 0) check ('a string 2191'); break;
+ case 2192: if (n[2192]++ > 0) check ('a string 2192'); break;
+ case 2193: if (n[2193]++ > 0) check ('a string 2193'); break;
+ case 2194: if (n[2194]++ > 0) check ('a string 2194'); break;
+ case 2195: if (n[2195]++ > 0) check ('a string 2195'); break;
+ case 2196: if (n[2196]++ > 0) check ('a string 2196'); break;
+ case 2197: if (n[2197]++ > 0) check ('a string 2197'); break;
+ case 2198: if (n[2198]++ > 0) check ('a string 2198'); break;
+ case 2199: if (n[2199]++ > 0) check ('a string 2199'); break;
+ case 2200: if (n[2200]++ > 0) check ('a string 2200'); break;
+ case 2201: if (n[2201]++ > 0) check ('a string 2201'); break;
+ case 2202: if (n[2202]++ > 0) check ('a string 2202'); break;
+ case 2203: if (n[2203]++ > 0) check ('a string 2203'); break;
+ case 2204: if (n[2204]++ > 0) check ('a string 2204'); break;
+ case 2205: if (n[2205]++ > 0) check ('a string 2205'); break;
+ case 2206: if (n[2206]++ > 0) check ('a string 2206'); break;
+ case 2207: if (n[2207]++ > 0) check ('a string 2207'); break;
+ case 2208: if (n[2208]++ > 0) check ('a string 2208'); break;
+ case 2209: if (n[2209]++ > 0) check ('a string 2209'); break;
+ case 2210: if (n[2210]++ > 0) check ('a string 2210'); break;
+ case 2211: if (n[2211]++ > 0) check ('a string 2211'); break;
+ case 2212: if (n[2212]++ > 0) check ('a string 2212'); break;
+ case 2213: if (n[2213]++ > 0) check ('a string 2213'); break;
+ case 2214: if (n[2214]++ > 0) check ('a string 2214'); break;
+ case 2215: if (n[2215]++ > 0) check ('a string 2215'); break;
+ case 2216: if (n[2216]++ > 0) check ('a string 2216'); break;
+ case 2217: if (n[2217]++ > 0) check ('a string 2217'); break;
+ case 2218: if (n[2218]++ > 0) check ('a string 2218'); break;
+ case 2219: if (n[2219]++ > 0) check ('a string 2219'); break;
+ case 2220: if (n[2220]++ > 0) check ('a string 2220'); break;
+ case 2221: if (n[2221]++ > 0) check ('a string 2221'); break;
+ case 2222: if (n[2222]++ > 0) check ('a string 2222'); break;
+ case 2223: if (n[2223]++ > 0) check ('a string 2223'); break;
+ case 2224: if (n[2224]++ > 0) check ('a string 2224'); break;
+ case 2225: if (n[2225]++ > 0) check ('a string 2225'); break;
+ case 2226: if (n[2226]++ > 0) check ('a string 2226'); break;
+ case 2227: if (n[2227]++ > 0) check ('a string 2227'); break;
+ case 2228: if (n[2228]++ > 0) check ('a string 2228'); break;
+ case 2229: if (n[2229]++ > 0) check ('a string 2229'); break;
+ case 2230: if (n[2230]++ > 0) check ('a string 2230'); break;
+ case 2231: if (n[2231]++ > 0) check ('a string 2231'); break;
+ case 2232: if (n[2232]++ > 0) check ('a string 2232'); break;
+ case 2233: if (n[2233]++ > 0) check ('a string 2233'); break;
+ case 2234: if (n[2234]++ > 0) check ('a string 2234'); break;
+ case 2235: if (n[2235]++ > 0) check ('a string 2235'); break;
+ case 2236: if (n[2236]++ > 0) check ('a string 2236'); break;
+ case 2237: if (n[2237]++ > 0) check ('a string 2237'); break;
+ case 2238: if (n[2238]++ > 0) check ('a string 2238'); break;
+ case 2239: if (n[2239]++ > 0) check ('a string 2239'); break;
+ case 2240: if (n[2240]++ > 0) check ('a string 2240'); break;
+ case 2241: if (n[2241]++ > 0) check ('a string 2241'); break;
+ case 2242: if (n[2242]++ > 0) check ('a string 2242'); break;
+ case 2243: if (n[2243]++ > 0) check ('a string 2243'); break;
+ case 2244: if (n[2244]++ > 0) check ('a string 2244'); break;
+ case 2245: if (n[2245]++ > 0) check ('a string 2245'); break;
+ case 2246: if (n[2246]++ > 0) check ('a string 2246'); break;
+ case 2247: if (n[2247]++ > 0) check ('a string 2247'); break;
+ case 2248: if (n[2248]++ > 0) check ('a string 2248'); break;
+ case 2249: if (n[2249]++ > 0) check ('a string 2249'); break;
+ case 2250: if (n[2250]++ > 0) check ('a string 2250'); break;
+ case 2251: if (n[2251]++ > 0) check ('a string 2251'); break;
+ case 2252: if (n[2252]++ > 0) check ('a string 2252'); break;
+ case 2253: if (n[2253]++ > 0) check ('a string 2253'); break;
+ case 2254: if (n[2254]++ > 0) check ('a string 2254'); break;
+ case 2255: if (n[2255]++ > 0) check ('a string 2255'); break;
+ case 2256: if (n[2256]++ > 0) check ('a string 2256'); break;
+ case 2257: if (n[2257]++ > 0) check ('a string 2257'); break;
+ case 2258: if (n[2258]++ > 0) check ('a string 2258'); break;
+ case 2259: if (n[2259]++ > 0) check ('a string 2259'); break;
+ case 2260: if (n[2260]++ > 0) check ('a string 2260'); break;
+ case 2261: if (n[2261]++ > 0) check ('a string 2261'); break;
+ case 2262: if (n[2262]++ > 0) check ('a string 2262'); break;
+ case 2263: if (n[2263]++ > 0) check ('a string 2263'); break;
+ case 2264: if (n[2264]++ > 0) check ('a string 2264'); break;
+ case 2265: if (n[2265]++ > 0) check ('a string 2265'); break;
+ case 2266: if (n[2266]++ > 0) check ('a string 2266'); break;
+ case 2267: if (n[2267]++ > 0) check ('a string 2267'); break;
+ case 2268: if (n[2268]++ > 0) check ('a string 2268'); break;
+ case 2269: if (n[2269]++ > 0) check ('a string 2269'); break;
+ case 2270: if (n[2270]++ > 0) check ('a string 2270'); break;
+ case 2271: if (n[2271]++ > 0) check ('a string 2271'); break;
+ case 2272: if (n[2272]++ > 0) check ('a string 2272'); break;
+ case 2273: if (n[2273]++ > 0) check ('a string 2273'); break;
+ case 2274: if (n[2274]++ > 0) check ('a string 2274'); break;
+ case 2275: if (n[2275]++ > 0) check ('a string 2275'); break;
+ case 2276: if (n[2276]++ > 0) check ('a string 2276'); break;
+ case 2277: if (n[2277]++ > 0) check ('a string 2277'); break;
+ case 2278: if (n[2278]++ > 0) check ('a string 2278'); break;
+ case 2279: if (n[2279]++ > 0) check ('a string 2279'); break;
+ case 2280: if (n[2280]++ > 0) check ('a string 2280'); break;
+ case 2281: if (n[2281]++ > 0) check ('a string 2281'); break;
+ case 2282: if (n[2282]++ > 0) check ('a string 2282'); break;
+ case 2283: if (n[2283]++ > 0) check ('a string 2283'); break;
+ case 2284: if (n[2284]++ > 0) check ('a string 2284'); break;
+ case 2285: if (n[2285]++ > 0) check ('a string 2285'); break;
+ case 2286: if (n[2286]++ > 0) check ('a string 2286'); break;
+ case 2287: if (n[2287]++ > 0) check ('a string 2287'); break;
+ case 2288: if (n[2288]++ > 0) check ('a string 2288'); break;
+ case 2289: if (n[2289]++ > 0) check ('a string 2289'); break;
+ case 2290: if (n[2290]++ > 0) check ('a string 2290'); break;
+ case 2291: if (n[2291]++ > 0) check ('a string 2291'); break;
+ case 2292: if (n[2292]++ > 0) check ('a string 2292'); break;
+ case 2293: if (n[2293]++ > 0) check ('a string 2293'); break;
+ case 2294: if (n[2294]++ > 0) check ('a string 2294'); break;
+ case 2295: if (n[2295]++ > 0) check ('a string 2295'); break;
+ case 2296: if (n[2296]++ > 0) check ('a string 2296'); break;
+ case 2297: if (n[2297]++ > 0) check ('a string 2297'); break;
+ case 2298: if (n[2298]++ > 0) check ('a string 2298'); break;
+ case 2299: if (n[2299]++ > 0) check ('a string 2299'); break;
+ case 2300: if (n[2300]++ > 0) check ('a string 2300'); break;
+ case 2301: if (n[2301]++ > 0) check ('a string 2301'); break;
+ case 2302: if (n[2302]++ > 0) check ('a string 2302'); break;
+ case 2303: if (n[2303]++ > 0) check ('a string 2303'); break;
+ case 2304: if (n[2304]++ > 0) check ('a string 2304'); break;
+ case 2305: if (n[2305]++ > 0) check ('a string 2305'); break;
+ case 2306: if (n[2306]++ > 0) check ('a string 2306'); break;
+ case 2307: if (n[2307]++ > 0) check ('a string 2307'); break;
+ case 2308: if (n[2308]++ > 0) check ('a string 2308'); break;
+ case 2309: if (n[2309]++ > 0) check ('a string 2309'); break;
+ case 2310: if (n[2310]++ > 0) check ('a string 2310'); break;
+ case 2311: if (n[2311]++ > 0) check ('a string 2311'); break;
+ case 2312: if (n[2312]++ > 0) check ('a string 2312'); break;
+ case 2313: if (n[2313]++ > 0) check ('a string 2313'); break;
+ case 2314: if (n[2314]++ > 0) check ('a string 2314'); break;
+ case 2315: if (n[2315]++ > 0) check ('a string 2315'); break;
+ case 2316: if (n[2316]++ > 0) check ('a string 2316'); break;
+ case 2317: if (n[2317]++ > 0) check ('a string 2317'); break;
+ case 2318: if (n[2318]++ > 0) check ('a string 2318'); break;
+ case 2319: if (n[2319]++ > 0) check ('a string 2319'); break;
+ case 2320: if (n[2320]++ > 0) check ('a string 2320'); break;
+ case 2321: if (n[2321]++ > 0) check ('a string 2321'); break;
+ case 2322: if (n[2322]++ > 0) check ('a string 2322'); break;
+ case 2323: if (n[2323]++ > 0) check ('a string 2323'); break;
+ case 2324: if (n[2324]++ > 0) check ('a string 2324'); break;
+ case 2325: if (n[2325]++ > 0) check ('a string 2325'); break;
+ case 2326: if (n[2326]++ > 0) check ('a string 2326'); break;
+ case 2327: if (n[2327]++ > 0) check ('a string 2327'); break;
+ case 2328: if (n[2328]++ > 0) check ('a string 2328'); break;
+ case 2329: if (n[2329]++ > 0) check ('a string 2329'); break;
+ case 2330: if (n[2330]++ > 0) check ('a string 2330'); break;
+ case 2331: if (n[2331]++ > 0) check ('a string 2331'); break;
+ case 2332: if (n[2332]++ > 0) check ('a string 2332'); break;
+ case 2333: if (n[2333]++ > 0) check ('a string 2333'); break;
+ case 2334: if (n[2334]++ > 0) check ('a string 2334'); break;
+ case 2335: if (n[2335]++ > 0) check ('a string 2335'); break;
+ case 2336: if (n[2336]++ > 0) check ('a string 2336'); break;
+ case 2337: if (n[2337]++ > 0) check ('a string 2337'); break;
+ case 2338: if (n[2338]++ > 0) check ('a string 2338'); break;
+ case 2339: if (n[2339]++ > 0) check ('a string 2339'); break;
+ case 2340: if (n[2340]++ > 0) check ('a string 2340'); break;
+ case 2341: if (n[2341]++ > 0) check ('a string 2341'); break;
+ case 2342: if (n[2342]++ > 0) check ('a string 2342'); break;
+ case 2343: if (n[2343]++ > 0) check ('a string 2343'); break;
+ case 2344: if (n[2344]++ > 0) check ('a string 2344'); break;
+ case 2345: if (n[2345]++ > 0) check ('a string 2345'); break;
+ case 2346: if (n[2346]++ > 0) check ('a string 2346'); break;
+ case 2347: if (n[2347]++ > 0) check ('a string 2347'); break;
+ case 2348: if (n[2348]++ > 0) check ('a string 2348'); break;
+ case 2349: if (n[2349]++ > 0) check ('a string 2349'); break;
+ case 2350: if (n[2350]++ > 0) check ('a string 2350'); break;
+ case 2351: if (n[2351]++ > 0) check ('a string 2351'); break;
+ case 2352: if (n[2352]++ > 0) check ('a string 2352'); break;
+ case 2353: if (n[2353]++ > 0) check ('a string 2353'); break;
+ case 2354: if (n[2354]++ > 0) check ('a string 2354'); break;
+ case 2355: if (n[2355]++ > 0) check ('a string 2355'); break;
+ case 2356: if (n[2356]++ > 0) check ('a string 2356'); break;
+ case 2357: if (n[2357]++ > 0) check ('a string 2357'); break;
+ case 2358: if (n[2358]++ > 0) check ('a string 2358'); break;
+ case 2359: if (n[2359]++ > 0) check ('a string 2359'); break;
+ case 2360: if (n[2360]++ > 0) check ('a string 2360'); break;
+ case 2361: if (n[2361]++ > 0) check ('a string 2361'); break;
+ case 2362: if (n[2362]++ > 0) check ('a string 2362'); break;
+ case 2363: if (n[2363]++ > 0) check ('a string 2363'); break;
+ case 2364: if (n[2364]++ > 0) check ('a string 2364'); break;
+ case 2365: if (n[2365]++ > 0) check ('a string 2365'); break;
+ case 2366: if (n[2366]++ > 0) check ('a string 2366'); break;
+ case 2367: if (n[2367]++ > 0) check ('a string 2367'); break;
+ case 2368: if (n[2368]++ > 0) check ('a string 2368'); break;
+ case 2369: if (n[2369]++ > 0) check ('a string 2369'); break;
+ case 2370: if (n[2370]++ > 0) check ('a string 2370'); break;
+ case 2371: if (n[2371]++ > 0) check ('a string 2371'); break;
+ case 2372: if (n[2372]++ > 0) check ('a string 2372'); break;
+ case 2373: if (n[2373]++ > 0) check ('a string 2373'); break;
+ case 2374: if (n[2374]++ > 0) check ('a string 2374'); break;
+ case 2375: if (n[2375]++ > 0) check ('a string 2375'); break;
+ case 2376: if (n[2376]++ > 0) check ('a string 2376'); break;
+ case 2377: if (n[2377]++ > 0) check ('a string 2377'); break;
+ case 2378: if (n[2378]++ > 0) check ('a string 2378'); break;
+ case 2379: if (n[2379]++ > 0) check ('a string 2379'); break;
+ case 2380: if (n[2380]++ > 0) check ('a string 2380'); break;
+ case 2381: if (n[2381]++ > 0) check ('a string 2381'); break;
+ case 2382: if (n[2382]++ > 0) check ('a string 2382'); break;
+ case 2383: if (n[2383]++ > 0) check ('a string 2383'); break;
+ case 2384: if (n[2384]++ > 0) check ('a string 2384'); break;
+ case 2385: if (n[2385]++ > 0) check ('a string 2385'); break;
+ case 2386: if (n[2386]++ > 0) check ('a string 2386'); break;
+ case 2387: if (n[2387]++ > 0) check ('a string 2387'); break;
+ case 2388: if (n[2388]++ > 0) check ('a string 2388'); break;
+ case 2389: if (n[2389]++ > 0) check ('a string 2389'); break;
+ case 2390: if (n[2390]++ > 0) check ('a string 2390'); break;
+ case 2391: if (n[2391]++ > 0) check ('a string 2391'); break;
+ case 2392: if (n[2392]++ > 0) check ('a string 2392'); break;
+ case 2393: if (n[2393]++ > 0) check ('a string 2393'); break;
+ case 2394: if (n[2394]++ > 0) check ('a string 2394'); break;
+ case 2395: if (n[2395]++ > 0) check ('a string 2395'); break;
+ case 2396: if (n[2396]++ > 0) check ('a string 2396'); break;
+ case 2397: if (n[2397]++ > 0) check ('a string 2397'); break;
+ case 2398: if (n[2398]++ > 0) check ('a string 2398'); break;
+ case 2399: if (n[2399]++ > 0) check ('a string 2399'); break;
+ case 2400: if (n[2400]++ > 0) check ('a string 2400'); break;
+ case 2401: if (n[2401]++ > 0) check ('a string 2401'); break;
+ case 2402: if (n[2402]++ > 0) check ('a string 2402'); break;
+ case 2403: if (n[2403]++ > 0) check ('a string 2403'); break;
+ case 2404: if (n[2404]++ > 0) check ('a string 2404'); break;
+ case 2405: if (n[2405]++ > 0) check ('a string 2405'); break;
+ case 2406: if (n[2406]++ > 0) check ('a string 2406'); break;
+ case 2407: if (n[2407]++ > 0) check ('a string 2407'); break;
+ case 2408: if (n[2408]++ > 0) check ('a string 2408'); break;
+ case 2409: if (n[2409]++ > 0) check ('a string 2409'); break;
+ case 2410: if (n[2410]++ > 0) check ('a string 2410'); break;
+ case 2411: if (n[2411]++ > 0) check ('a string 2411'); break;
+ case 2412: if (n[2412]++ > 0) check ('a string 2412'); break;
+ case 2413: if (n[2413]++ > 0) check ('a string 2413'); break;
+ case 2414: if (n[2414]++ > 0) check ('a string 2414'); break;
+ case 2415: if (n[2415]++ > 0) check ('a string 2415'); break;
+ case 2416: if (n[2416]++ > 0) check ('a string 2416'); break;
+ case 2417: if (n[2417]++ > 0) check ('a string 2417'); break;
+ case 2418: if (n[2418]++ > 0) check ('a string 2418'); break;
+ case 2419: if (n[2419]++ > 0) check ('a string 2419'); break;
+ case 2420: if (n[2420]++ > 0) check ('a string 2420'); break;
+ case 2421: if (n[2421]++ > 0) check ('a string 2421'); break;
+ case 2422: if (n[2422]++ > 0) check ('a string 2422'); break;
+ case 2423: if (n[2423]++ > 0) check ('a string 2423'); break;
+ case 2424: if (n[2424]++ > 0) check ('a string 2424'); break;
+ case 2425: if (n[2425]++ > 0) check ('a string 2425'); break;
+ case 2426: if (n[2426]++ > 0) check ('a string 2426'); break;
+ case 2427: if (n[2427]++ > 0) check ('a string 2427'); break;
+ case 2428: if (n[2428]++ > 0) check ('a string 2428'); break;
+ case 2429: if (n[2429]++ > 0) check ('a string 2429'); break;
+ case 2430: if (n[2430]++ > 0) check ('a string 2430'); break;
+ case 2431: if (n[2431]++ > 0) check ('a string 2431'); break;
+ case 2432: if (n[2432]++ > 0) check ('a string 2432'); break;
+ case 2433: if (n[2433]++ > 0) check ('a string 2433'); break;
+ case 2434: if (n[2434]++ > 0) check ('a string 2434'); break;
+ case 2435: if (n[2435]++ > 0) check ('a string 2435'); break;
+ case 2436: if (n[2436]++ > 0) check ('a string 2436'); break;
+ case 2437: if (n[2437]++ > 0) check ('a string 2437'); break;
+ case 2438: if (n[2438]++ > 0) check ('a string 2438'); break;
+ case 2439: if (n[2439]++ > 0) check ('a string 2439'); break;
+ case 2440: if (n[2440]++ > 0) check ('a string 2440'); break;
+ case 2441: if (n[2441]++ > 0) check ('a string 2441'); break;
+ case 2442: if (n[2442]++ > 0) check ('a string 2442'); break;
+ case 2443: if (n[2443]++ > 0) check ('a string 2443'); break;
+ case 2444: if (n[2444]++ > 0) check ('a string 2444'); break;
+ case 2445: if (n[2445]++ > 0) check ('a string 2445'); break;
+ case 2446: if (n[2446]++ > 0) check ('a string 2446'); break;
+ case 2447: if (n[2447]++ > 0) check ('a string 2447'); break;
+ case 2448: if (n[2448]++ > 0) check ('a string 2448'); break;
+ case 2449: if (n[2449]++ > 0) check ('a string 2449'); break;
+ case 2450: if (n[2450]++ > 0) check ('a string 2450'); break;
+ case 2451: if (n[2451]++ > 0) check ('a string 2451'); break;
+ case 2452: if (n[2452]++ > 0) check ('a string 2452'); break;
+ case 2453: if (n[2453]++ > 0) check ('a string 2453'); break;
+ case 2454: if (n[2454]++ > 0) check ('a string 2454'); break;
+ case 2455: if (n[2455]++ > 0) check ('a string 2455'); break;
+ case 2456: if (n[2456]++ > 0) check ('a string 2456'); break;
+ case 2457: if (n[2457]++ > 0) check ('a string 2457'); break;
+ case 2458: if (n[2458]++ > 0) check ('a string 2458'); break;
+ case 2459: if (n[2459]++ > 0) check ('a string 2459'); break;
+ case 2460: if (n[2460]++ > 0) check ('a string 2460'); break;
+ case 2461: if (n[2461]++ > 0) check ('a string 2461'); break;
+ case 2462: if (n[2462]++ > 0) check ('a string 2462'); break;
+ case 2463: if (n[2463]++ > 0) check ('a string 2463'); break;
+ case 2464: if (n[2464]++ > 0) check ('a string 2464'); break;
+ case 2465: if (n[2465]++ > 0) check ('a string 2465'); break;
+ case 2466: if (n[2466]++ > 0) check ('a string 2466'); break;
+ case 2467: if (n[2467]++ > 0) check ('a string 2467'); break;
+ case 2468: if (n[2468]++ > 0) check ('a string 2468'); break;
+ case 2469: if (n[2469]++ > 0) check ('a string 2469'); break;
+ case 2470: if (n[2470]++ > 0) check ('a string 2470'); break;
+ case 2471: if (n[2471]++ > 0) check ('a string 2471'); break;
+ case 2472: if (n[2472]++ > 0) check ('a string 2472'); break;
+ case 2473: if (n[2473]++ > 0) check ('a string 2473'); break;
+ case 2474: if (n[2474]++ > 0) check ('a string 2474'); break;
+ case 2475: if (n[2475]++ > 0) check ('a string 2475'); break;
+ case 2476: if (n[2476]++ > 0) check ('a string 2476'); break;
+ case 2477: if (n[2477]++ > 0) check ('a string 2477'); break;
+ case 2478: if (n[2478]++ > 0) check ('a string 2478'); break;
+ case 2479: if (n[2479]++ > 0) check ('a string 2479'); break;
+ case 2480: if (n[2480]++ > 0) check ('a string 2480'); break;
+ case 2481: if (n[2481]++ > 0) check ('a string 2481'); break;
+ case 2482: if (n[2482]++ > 0) check ('a string 2482'); break;
+ case 2483: if (n[2483]++ > 0) check ('a string 2483'); break;
+ case 2484: if (n[2484]++ > 0) check ('a string 2484'); break;
+ case 2485: if (n[2485]++ > 0) check ('a string 2485'); break;
+ case 2486: if (n[2486]++ > 0) check ('a string 2486'); break;
+ case 2487: if (n[2487]++ > 0) check ('a string 2487'); break;
+ case 2488: if (n[2488]++ > 0) check ('a string 2488'); break;
+ case 2489: if (n[2489]++ > 0) check ('a string 2489'); break;
+ case 2490: if (n[2490]++ > 0) check ('a string 2490'); break;
+ case 2491: if (n[2491]++ > 0) check ('a string 2491'); break;
+ case 2492: if (n[2492]++ > 0) check ('a string 2492'); break;
+ case 2493: if (n[2493]++ > 0) check ('a string 2493'); break;
+ case 2494: if (n[2494]++ > 0) check ('a string 2494'); break;
+ case 2495: if (n[2495]++ > 0) check ('a string 2495'); break;
+ case 2496: if (n[2496]++ > 0) check ('a string 2496'); break;
+ case 2497: if (n[2497]++ > 0) check ('a string 2497'); break;
+ case 2498: if (n[2498]++ > 0) check ('a string 2498'); break;
+ case 2499: if (n[2499]++ > 0) check ('a string 2499'); break;
+ case 2500: if (n[2500]++ > 0) check ('a string 2500'); break;
+ case 2501: if (n[2501]++ > 0) check ('a string 2501'); break;
+ case 2502: if (n[2502]++ > 0) check ('a string 2502'); break;
+ case 2503: if (n[2503]++ > 0) check ('a string 2503'); break;
+ case 2504: if (n[2504]++ > 0) check ('a string 2504'); break;
+ case 2505: if (n[2505]++ > 0) check ('a string 2505'); break;
+ case 2506: if (n[2506]++ > 0) check ('a string 2506'); break;
+ case 2507: if (n[2507]++ > 0) check ('a string 2507'); break;
+ case 2508: if (n[2508]++ > 0) check ('a string 2508'); break;
+ case 2509: if (n[2509]++ > 0) check ('a string 2509'); break;
+ case 2510: if (n[2510]++ > 0) check ('a string 2510'); break;
+ case 2511: if (n[2511]++ > 0) check ('a string 2511'); break;
+ case 2512: if (n[2512]++ > 0) check ('a string 2512'); break;
+ case 2513: if (n[2513]++ > 0) check ('a string 2513'); break;
+ case 2514: if (n[2514]++ > 0) check ('a string 2514'); break;
+ case 2515: if (n[2515]++ > 0) check ('a string 2515'); break;
+ case 2516: if (n[2516]++ > 0) check ('a string 2516'); break;
+ case 2517: if (n[2517]++ > 0) check ('a string 2517'); break;
+ case 2518: if (n[2518]++ > 0) check ('a string 2518'); break;
+ case 2519: if (n[2519]++ > 0) check ('a string 2519'); break;
+ case 2520: if (n[2520]++ > 0) check ('a string 2520'); break;
+ case 2521: if (n[2521]++ > 0) check ('a string 2521'); break;
+ case 2522: if (n[2522]++ > 0) check ('a string 2522'); break;
+ case 2523: if (n[2523]++ > 0) check ('a string 2523'); break;
+ case 2524: if (n[2524]++ > 0) check ('a string 2524'); break;
+ case 2525: if (n[2525]++ > 0) check ('a string 2525'); break;
+ case 2526: if (n[2526]++ > 0) check ('a string 2526'); break;
+ case 2527: if (n[2527]++ > 0) check ('a string 2527'); break;
+ case 2528: if (n[2528]++ > 0) check ('a string 2528'); break;
+ case 2529: if (n[2529]++ > 0) check ('a string 2529'); break;
+ case 2530: if (n[2530]++ > 0) check ('a string 2530'); break;
+ case 2531: if (n[2531]++ > 0) check ('a string 2531'); break;
+ case 2532: if (n[2532]++ > 0) check ('a string 2532'); break;
+ case 2533: if (n[2533]++ > 0) check ('a string 2533'); break;
+ case 2534: if (n[2534]++ > 0) check ('a string 2534'); break;
+ case 2535: if (n[2535]++ > 0) check ('a string 2535'); break;
+ case 2536: if (n[2536]++ > 0) check ('a string 2536'); break;
+ case 2537: if (n[2537]++ > 0) check ('a string 2537'); break;
+ case 2538: if (n[2538]++ > 0) check ('a string 2538'); break;
+ case 2539: if (n[2539]++ > 0) check ('a string 2539'); break;
+ case 2540: if (n[2540]++ > 0) check ('a string 2540'); break;
+ case 2541: if (n[2541]++ > 0) check ('a string 2541'); break;
+ case 2542: if (n[2542]++ > 0) check ('a string 2542'); break;
+ case 2543: if (n[2543]++ > 0) check ('a string 2543'); break;
+ case 2544: if (n[2544]++ > 0) check ('a string 2544'); break;
+ case 2545: if (n[2545]++ > 0) check ('a string 2545'); break;
+ case 2546: if (n[2546]++ > 0) check ('a string 2546'); break;
+ case 2547: if (n[2547]++ > 0) check ('a string 2547'); break;
+ case 2548: if (n[2548]++ > 0) check ('a string 2548'); break;
+ case 2549: if (n[2549]++ > 0) check ('a string 2549'); break;
+ case 2550: if (n[2550]++ > 0) check ('a string 2550'); break;
+ case 2551: if (n[2551]++ > 0) check ('a string 2551'); break;
+ case 2552: if (n[2552]++ > 0) check ('a string 2552'); break;
+ case 2553: if (n[2553]++ > 0) check ('a string 2553'); break;
+ case 2554: if (n[2554]++ > 0) check ('a string 2554'); break;
+ case 2555: if (n[2555]++ > 0) check ('a string 2555'); break;
+ case 2556: if (n[2556]++ > 0) check ('a string 2556'); break;
+ case 2557: if (n[2557]++ > 0) check ('a string 2557'); break;
+ case 2558: if (n[2558]++ > 0) check ('a string 2558'); break;
+ case 2559: if (n[2559]++ > 0) check ('a string 2559'); break;
+ case 2560: if (n[2560]++ > 0) check ('a string 2560'); break;
+ case 2561: if (n[2561]++ > 0) check ('a string 2561'); break;
+ case 2562: if (n[2562]++ > 0) check ('a string 2562'); break;
+ case 2563: if (n[2563]++ > 0) check ('a string 2563'); break;
+ case 2564: if (n[2564]++ > 0) check ('a string 2564'); break;
+ case 2565: if (n[2565]++ > 0) check ('a string 2565'); break;
+ case 2566: if (n[2566]++ > 0) check ('a string 2566'); break;
+ case 2567: if (n[2567]++ > 0) check ('a string 2567'); break;
+ case 2568: if (n[2568]++ > 0) check ('a string 2568'); break;
+ case 2569: if (n[2569]++ > 0) check ('a string 2569'); break;
+ case 2570: if (n[2570]++ > 0) check ('a string 2570'); break;
+ case 2571: if (n[2571]++ > 0) check ('a string 2571'); break;
+ case 2572: if (n[2572]++ > 0) check ('a string 2572'); break;
+ case 2573: if (n[2573]++ > 0) check ('a string 2573'); break;
+ case 2574: if (n[2574]++ > 0) check ('a string 2574'); break;
+ case 2575: if (n[2575]++ > 0) check ('a string 2575'); break;
+ case 2576: if (n[2576]++ > 0) check ('a string 2576'); break;
+ case 2577: if (n[2577]++ > 0) check ('a string 2577'); break;
+ case 2578: if (n[2578]++ > 0) check ('a string 2578'); break;
+ case 2579: if (n[2579]++ > 0) check ('a string 2579'); break;
+ case 2580: if (n[2580]++ > 0) check ('a string 2580'); break;
+ case 2581: if (n[2581]++ > 0) check ('a string 2581'); break;
+ case 2582: if (n[2582]++ > 0) check ('a string 2582'); break;
+ case 2583: if (n[2583]++ > 0) check ('a string 2583'); break;
+ case 2584: if (n[2584]++ > 0) check ('a string 2584'); break;
+ case 2585: if (n[2585]++ > 0) check ('a string 2585'); break;
+ case 2586: if (n[2586]++ > 0) check ('a string 2586'); break;
+ case 2587: if (n[2587]++ > 0) check ('a string 2587'); break;
+ case 2588: if (n[2588]++ > 0) check ('a string 2588'); break;
+ case 2589: if (n[2589]++ > 0) check ('a string 2589'); break;
+ case 2590: if (n[2590]++ > 0) check ('a string 2590'); break;
+ case 2591: if (n[2591]++ > 0) check ('a string 2591'); break;
+ case 2592: if (n[2592]++ > 0) check ('a string 2592'); break;
+ case 2593: if (n[2593]++ > 0) check ('a string 2593'); break;
+ case 2594: if (n[2594]++ > 0) check ('a string 2594'); break;
+ case 2595: if (n[2595]++ > 0) check ('a string 2595'); break;
+ case 2596: if (n[2596]++ > 0) check ('a string 2596'); break;
+ case 2597: if (n[2597]++ > 0) check ('a string 2597'); break;
+ case 2598: if (n[2598]++ > 0) check ('a string 2598'); break;
+ case 2599: if (n[2599]++ > 0) check ('a string 2599'); break;
+ case 2600: if (n[2600]++ > 0) check ('a string 2600'); break;
+ case 2601: if (n[2601]++ > 0) check ('a string 2601'); break;
+ case 2602: if (n[2602]++ > 0) check ('a string 2602'); break;
+ case 2603: if (n[2603]++ > 0) check ('a string 2603'); break;
+ case 2604: if (n[2604]++ > 0) check ('a string 2604'); break;
+ case 2605: if (n[2605]++ > 0) check ('a string 2605'); break;
+ case 2606: if (n[2606]++ > 0) check ('a string 2606'); break;
+ case 2607: if (n[2607]++ > 0) check ('a string 2607'); break;
+ case 2608: if (n[2608]++ > 0) check ('a string 2608'); break;
+ case 2609: if (n[2609]++ > 0) check ('a string 2609'); break;
+ case 2610: if (n[2610]++ > 0) check ('a string 2610'); break;
+ case 2611: if (n[2611]++ > 0) check ('a string 2611'); break;
+ case 2612: if (n[2612]++ > 0) check ('a string 2612'); break;
+ case 2613: if (n[2613]++ > 0) check ('a string 2613'); break;
+ case 2614: if (n[2614]++ > 0) check ('a string 2614'); break;
+ case 2615: if (n[2615]++ > 0) check ('a string 2615'); break;
+ case 2616: if (n[2616]++ > 0) check ('a string 2616'); break;
+ case 2617: if (n[2617]++ > 0) check ('a string 2617'); break;
+ case 2618: if (n[2618]++ > 0) check ('a string 2618'); break;
+ case 2619: if (n[2619]++ > 0) check ('a string 2619'); break;
+ case 2620: if (n[2620]++ > 0) check ('a string 2620'); break;
+ case 2621: if (n[2621]++ > 0) check ('a string 2621'); break;
+ case 2622: if (n[2622]++ > 0) check ('a string 2622'); break;
+ case 2623: if (n[2623]++ > 0) check ('a string 2623'); break;
+ case 2624: if (n[2624]++ > 0) check ('a string 2624'); break;
+ case 2625: if (n[2625]++ > 0) check ('a string 2625'); break;
+ case 2626: if (n[2626]++ > 0) check ('a string 2626'); break;
+ case 2627: if (n[2627]++ > 0) check ('a string 2627'); break;
+ case 2628: if (n[2628]++ > 0) check ('a string 2628'); break;
+ case 2629: if (n[2629]++ > 0) check ('a string 2629'); break;
+ case 2630: if (n[2630]++ > 0) check ('a string 2630'); break;
+ case 2631: if (n[2631]++ > 0) check ('a string 2631'); break;
+ case 2632: if (n[2632]++ > 0) check ('a string 2632'); break;
+ case 2633: if (n[2633]++ > 0) check ('a string 2633'); break;
+ case 2634: if (n[2634]++ > 0) check ('a string 2634'); break;
+ case 2635: if (n[2635]++ > 0) check ('a string 2635'); break;
+ case 2636: if (n[2636]++ > 0) check ('a string 2636'); break;
+ case 2637: if (n[2637]++ > 0) check ('a string 2637'); break;
+ case 2638: if (n[2638]++ > 0) check ('a string 2638'); break;
+ case 2639: if (n[2639]++ > 0) check ('a string 2639'); break;
+ case 2640: if (n[2640]++ > 0) check ('a string 2640'); break;
+ case 2641: if (n[2641]++ > 0) check ('a string 2641'); break;
+ case 2642: if (n[2642]++ > 0) check ('a string 2642'); break;
+ case 2643: if (n[2643]++ > 0) check ('a string 2643'); break;
+ case 2644: if (n[2644]++ > 0) check ('a string 2644'); break;
+ case 2645: if (n[2645]++ > 0) check ('a string 2645'); break;
+ case 2646: if (n[2646]++ > 0) check ('a string 2646'); break;
+ case 2647: if (n[2647]++ > 0) check ('a string 2647'); break;
+ case 2648: if (n[2648]++ > 0) check ('a string 2648'); break;
+ case 2649: if (n[2649]++ > 0) check ('a string 2649'); break;
+ case 2650: if (n[2650]++ > 0) check ('a string 2650'); break;
+ case 2651: if (n[2651]++ > 0) check ('a string 2651'); break;
+ case 2652: if (n[2652]++ > 0) check ('a string 2652'); break;
+ case 2653: if (n[2653]++ > 0) check ('a string 2653'); break;
+ case 2654: if (n[2654]++ > 0) check ('a string 2654'); break;
+ case 2655: if (n[2655]++ > 0) check ('a string 2655'); break;
+ case 2656: if (n[2656]++ > 0) check ('a string 2656'); break;
+ case 2657: if (n[2657]++ > 0) check ('a string 2657'); break;
+ case 2658: if (n[2658]++ > 0) check ('a string 2658'); break;
+ case 2659: if (n[2659]++ > 0) check ('a string 2659'); break;
+ case 2660: if (n[2660]++ > 0) check ('a string 2660'); break;
+ case 2661: if (n[2661]++ > 0) check ('a string 2661'); break;
+ case 2662: if (n[2662]++ > 0) check ('a string 2662'); break;
+ case 2663: if (n[2663]++ > 0) check ('a string 2663'); break;
+ case 2664: if (n[2664]++ > 0) check ('a string 2664'); break;
+ case 2665: if (n[2665]++ > 0) check ('a string 2665'); break;
+ case 2666: if (n[2666]++ > 0) check ('a string 2666'); break;
+ case 2667: if (n[2667]++ > 0) check ('a string 2667'); break;
+ case 2668: if (n[2668]++ > 0) check ('a string 2668'); break;
+ case 2669: if (n[2669]++ > 0) check ('a string 2669'); break;
+ case 2670: if (n[2670]++ > 0) check ('a string 2670'); break;
+ case 2671: if (n[2671]++ > 0) check ('a string 2671'); break;
+ case 2672: if (n[2672]++ > 0) check ('a string 2672'); break;
+ case 2673: if (n[2673]++ > 0) check ('a string 2673'); break;
+ case 2674: if (n[2674]++ > 0) check ('a string 2674'); break;
+ case 2675: if (n[2675]++ > 0) check ('a string 2675'); break;
+ case 2676: if (n[2676]++ > 0) check ('a string 2676'); break;
+ case 2677: if (n[2677]++ > 0) check ('a string 2677'); break;
+ case 2678: if (n[2678]++ > 0) check ('a string 2678'); break;
+ case 2679: if (n[2679]++ > 0) check ('a string 2679'); break;
+ case 2680: if (n[2680]++ > 0) check ('a string 2680'); break;
+ case 2681: if (n[2681]++ > 0) check ('a string 2681'); break;
+ case 2682: if (n[2682]++ > 0) check ('a string 2682'); break;
+ case 2683: if (n[2683]++ > 0) check ('a string 2683'); break;
+ case 2684: if (n[2684]++ > 0) check ('a string 2684'); break;
+ case 2685: if (n[2685]++ > 0) check ('a string 2685'); break;
+ case 2686: if (n[2686]++ > 0) check ('a string 2686'); break;
+ case 2687: if (n[2687]++ > 0) check ('a string 2687'); break;
+ case 2688: if (n[2688]++ > 0) check ('a string 2688'); break;
+ case 2689: if (n[2689]++ > 0) check ('a string 2689'); break;
+ case 2690: if (n[2690]++ > 0) check ('a string 2690'); break;
+ case 2691: if (n[2691]++ > 0) check ('a string 2691'); break;
+ case 2692: if (n[2692]++ > 0) check ('a string 2692'); break;
+ case 2693: if (n[2693]++ > 0) check ('a string 2693'); break;
+ case 2694: if (n[2694]++ > 0) check ('a string 2694'); break;
+ case 2695: if (n[2695]++ > 0) check ('a string 2695'); break;
+ case 2696: if (n[2696]++ > 0) check ('a string 2696'); break;
+ case 2697: if (n[2697]++ > 0) check ('a string 2697'); break;
+ case 2698: if (n[2698]++ > 0) check ('a string 2698'); break;
+ case 2699: if (n[2699]++ > 0) check ('a string 2699'); break;
+ case 2700: if (n[2700]++ > 0) check ('a string 2700'); break;
+ case 2701: if (n[2701]++ > 0) check ('a string 2701'); break;
+ case 2702: if (n[2702]++ > 0) check ('a string 2702'); break;
+ case 2703: if (n[2703]++ > 0) check ('a string 2703'); break;
+ case 2704: if (n[2704]++ > 0) check ('a string 2704'); break;
+ case 2705: if (n[2705]++ > 0) check ('a string 2705'); break;
+ case 2706: if (n[2706]++ > 0) check ('a string 2706'); break;
+ case 2707: if (n[2707]++ > 0) check ('a string 2707'); break;
+ case 2708: if (n[2708]++ > 0) check ('a string 2708'); break;
+ case 2709: if (n[2709]++ > 0) check ('a string 2709'); break;
+ case 2710: if (n[2710]++ > 0) check ('a string 2710'); break;
+ case 2711: if (n[2711]++ > 0) check ('a string 2711'); break;
+ case 2712: if (n[2712]++ > 0) check ('a string 2712'); break;
+ case 2713: if (n[2713]++ > 0) check ('a string 2713'); break;
+ case 2714: if (n[2714]++ > 0) check ('a string 2714'); break;
+ case 2715: if (n[2715]++ > 0) check ('a string 2715'); break;
+ case 2716: if (n[2716]++ > 0) check ('a string 2716'); break;
+ case 2717: if (n[2717]++ > 0) check ('a string 2717'); break;
+ case 2718: if (n[2718]++ > 0) check ('a string 2718'); break;
+ case 2719: if (n[2719]++ > 0) check ('a string 2719'); break;
+ case 2720: if (n[2720]++ > 0) check ('a string 2720'); break;
+ case 2721: if (n[2721]++ > 0) check ('a string 2721'); break;
+ case 2722: if (n[2722]++ > 0) check ('a string 2722'); break;
+ case 2723: if (n[2723]++ > 0) check ('a string 2723'); break;
+ case 2724: if (n[2724]++ > 0) check ('a string 2724'); break;
+ case 2725: if (n[2725]++ > 0) check ('a string 2725'); break;
+ case 2726: if (n[2726]++ > 0) check ('a string 2726'); break;
+ case 2727: if (n[2727]++ > 0) check ('a string 2727'); break;
+ case 2728: if (n[2728]++ > 0) check ('a string 2728'); break;
+ case 2729: if (n[2729]++ > 0) check ('a string 2729'); break;
+ case 2730: if (n[2730]++ > 0) check ('a string 2730'); break;
+ case 2731: if (n[2731]++ > 0) check ('a string 2731'); break;
+ case 2732: if (n[2732]++ > 0) check ('a string 2732'); break;
+ case 2733: if (n[2733]++ > 0) check ('a string 2733'); break;
+ case 2734: if (n[2734]++ > 0) check ('a string 2734'); break;
+ case 2735: if (n[2735]++ > 0) check ('a string 2735'); break;
+ case 2736: if (n[2736]++ > 0) check ('a string 2736'); break;
+ case 2737: if (n[2737]++ > 0) check ('a string 2737'); break;
+ case 2738: if (n[2738]++ > 0) check ('a string 2738'); break;
+ case 2739: if (n[2739]++ > 0) check ('a string 2739'); break;
+ case 2740: if (n[2740]++ > 0) check ('a string 2740'); break;
+ case 2741: if (n[2741]++ > 0) check ('a string 2741'); break;
+ case 2742: if (n[2742]++ > 0) check ('a string 2742'); break;
+ case 2743: if (n[2743]++ > 0) check ('a string 2743'); break;
+ case 2744: if (n[2744]++ > 0) check ('a string 2744'); break;
+ case 2745: if (n[2745]++ > 0) check ('a string 2745'); break;
+ case 2746: if (n[2746]++ > 0) check ('a string 2746'); break;
+ case 2747: if (n[2747]++ > 0) check ('a string 2747'); break;
+ case 2748: if (n[2748]++ > 0) check ('a string 2748'); break;
+ case 2749: if (n[2749]++ > 0) check ('a string 2749'); break;
+ case 2750: if (n[2750]++ > 0) check ('a string 2750'); break;
+ case 2751: if (n[2751]++ > 0) check ('a string 2751'); break;
+ case 2752: if (n[2752]++ > 0) check ('a string 2752'); break;
+ case 2753: if (n[2753]++ > 0) check ('a string 2753'); break;
+ case 2754: if (n[2754]++ > 0) check ('a string 2754'); break;
+ case 2755: if (n[2755]++ > 0) check ('a string 2755'); break;
+ case 2756: if (n[2756]++ > 0) check ('a string 2756'); break;
+ case 2757: if (n[2757]++ > 0) check ('a string 2757'); break;
+ case 2758: if (n[2758]++ > 0) check ('a string 2758'); break;
+ case 2759: if (n[2759]++ > 0) check ('a string 2759'); break;
+ case 2760: if (n[2760]++ > 0) check ('a string 2760'); break;
+ case 2761: if (n[2761]++ > 0) check ('a string 2761'); break;
+ case 2762: if (n[2762]++ > 0) check ('a string 2762'); break;
+ case 2763: if (n[2763]++ > 0) check ('a string 2763'); break;
+ case 2764: if (n[2764]++ > 0) check ('a string 2764'); break;
+ case 2765: if (n[2765]++ > 0) check ('a string 2765'); break;
+ case 2766: if (n[2766]++ > 0) check ('a string 2766'); break;
+ case 2767: if (n[2767]++ > 0) check ('a string 2767'); break;
+ case 2768: if (n[2768]++ > 0) check ('a string 2768'); break;
+ case 2769: if (n[2769]++ > 0) check ('a string 2769'); break;
+ case 2770: if (n[2770]++ > 0) check ('a string 2770'); break;
+ case 2771: if (n[2771]++ > 0) check ('a string 2771'); break;
+ case 2772: if (n[2772]++ > 0) check ('a string 2772'); break;
+ case 2773: if (n[2773]++ > 0) check ('a string 2773'); break;
+ case 2774: if (n[2774]++ > 0) check ('a string 2774'); break;
+ case 2775: if (n[2775]++ > 0) check ('a string 2775'); break;
+ case 2776: if (n[2776]++ > 0) check ('a string 2776'); break;
+ case 2777: if (n[2777]++ > 0) check ('a string 2777'); break;
+ case 2778: if (n[2778]++ > 0) check ('a string 2778'); break;
+ case 2779: if (n[2779]++ > 0) check ('a string 2779'); break;
+ case 2780: if (n[2780]++ > 0) check ('a string 2780'); break;
+ case 2781: if (n[2781]++ > 0) check ('a string 2781'); break;
+ case 2782: if (n[2782]++ > 0) check ('a string 2782'); break;
+ case 2783: if (n[2783]++ > 0) check ('a string 2783'); break;
+ case 2784: if (n[2784]++ > 0) check ('a string 2784'); break;
+ case 2785: if (n[2785]++ > 0) check ('a string 2785'); break;
+ case 2786: if (n[2786]++ > 0) check ('a string 2786'); break;
+ case 2787: if (n[2787]++ > 0) check ('a string 2787'); break;
+ case 2788: if (n[2788]++ > 0) check ('a string 2788'); break;
+ case 2789: if (n[2789]++ > 0) check ('a string 2789'); break;
+ case 2790: if (n[2790]++ > 0) check ('a string 2790'); break;
+ case 2791: if (n[2791]++ > 0) check ('a string 2791'); break;
+ case 2792: if (n[2792]++ > 0) check ('a string 2792'); break;
+ case 2793: if (n[2793]++ > 0) check ('a string 2793'); break;
+ case 2794: if (n[2794]++ > 0) check ('a string 2794'); break;
+ case 2795: if (n[2795]++ > 0) check ('a string 2795'); break;
+ case 2796: if (n[2796]++ > 0) check ('a string 2796'); break;
+ case 2797: if (n[2797]++ > 0) check ('a string 2797'); break;
+ case 2798: if (n[2798]++ > 0) check ('a string 2798'); break;
+ case 2799: if (n[2799]++ > 0) check ('a string 2799'); break;
+ case 2800: if (n[2800]++ > 0) check ('a string 2800'); break;
+ case 2801: if (n[2801]++ > 0) check ('a string 2801'); break;
+ case 2802: if (n[2802]++ > 0) check ('a string 2802'); break;
+ case 2803: if (n[2803]++ > 0) check ('a string 2803'); break;
+ case 2804: if (n[2804]++ > 0) check ('a string 2804'); break;
+ case 2805: if (n[2805]++ > 0) check ('a string 2805'); break;
+ case 2806: if (n[2806]++ > 0) check ('a string 2806'); break;
+ case 2807: if (n[2807]++ > 0) check ('a string 2807'); break;
+ case 2808: if (n[2808]++ > 0) check ('a string 2808'); break;
+ case 2809: if (n[2809]++ > 0) check ('a string 2809'); break;
+ case 2810: if (n[2810]++ > 0) check ('a string 2810'); break;
+ case 2811: if (n[2811]++ > 0) check ('a string 2811'); break;
+ case 2812: if (n[2812]++ > 0) check ('a string 2812'); break;
+ case 2813: if (n[2813]++ > 0) check ('a string 2813'); break;
+ case 2814: if (n[2814]++ > 0) check ('a string 2814'); break;
+ case 2815: if (n[2815]++ > 0) check ('a string 2815'); break;
+ case 2816: if (n[2816]++ > 0) check ('a string 2816'); break;
+ case 2817: if (n[2817]++ > 0) check ('a string 2817'); break;
+ case 2818: if (n[2818]++ > 0) check ('a string 2818'); break;
+ case 2819: if (n[2819]++ > 0) check ('a string 2819'); break;
+ case 2820: if (n[2820]++ > 0) check ('a string 2820'); break;
+ case 2821: if (n[2821]++ > 0) check ('a string 2821'); break;
+ case 2822: if (n[2822]++ > 0) check ('a string 2822'); break;
+ case 2823: if (n[2823]++ > 0) check ('a string 2823'); break;
+ case 2824: if (n[2824]++ > 0) check ('a string 2824'); break;
+ case 2825: if (n[2825]++ > 0) check ('a string 2825'); break;
+ case 2826: if (n[2826]++ > 0) check ('a string 2826'); break;
+ case 2827: if (n[2827]++ > 0) check ('a string 2827'); break;
+ case 2828: if (n[2828]++ > 0) check ('a string 2828'); break;
+ case 2829: if (n[2829]++ > 0) check ('a string 2829'); break;
+ case 2830: if (n[2830]++ > 0) check ('a string 2830'); break;
+ case 2831: if (n[2831]++ > 0) check ('a string 2831'); break;
+ case 2832: if (n[2832]++ > 0) check ('a string 2832'); break;
+ case 2833: if (n[2833]++ > 0) check ('a string 2833'); break;
+ case 2834: if (n[2834]++ > 0) check ('a string 2834'); break;
+ case 2835: if (n[2835]++ > 0) check ('a string 2835'); break;
+ case 2836: if (n[2836]++ > 0) check ('a string 2836'); break;
+ case 2837: if (n[2837]++ > 0) check ('a string 2837'); break;
+ case 2838: if (n[2838]++ > 0) check ('a string 2838'); break;
+ case 2839: if (n[2839]++ > 0) check ('a string 2839'); break;
+ case 2840: if (n[2840]++ > 0) check ('a string 2840'); break;
+ case 2841: if (n[2841]++ > 0) check ('a string 2841'); break;
+ case 2842: if (n[2842]++ > 0) check ('a string 2842'); break;
+ case 2843: if (n[2843]++ > 0) check ('a string 2843'); break;
+ case 2844: if (n[2844]++ > 0) check ('a string 2844'); break;
+ case 2845: if (n[2845]++ > 0) check ('a string 2845'); break;
+ case 2846: if (n[2846]++ > 0) check ('a string 2846'); break;
+ case 2847: if (n[2847]++ > 0) check ('a string 2847'); break;
+ case 2848: if (n[2848]++ > 0) check ('a string 2848'); break;
+ case 2849: if (n[2849]++ > 0) check ('a string 2849'); break;
+ case 2850: if (n[2850]++ > 0) check ('a string 2850'); break;
+ case 2851: if (n[2851]++ > 0) check ('a string 2851'); break;
+ case 2852: if (n[2852]++ > 0) check ('a string 2852'); break;
+ case 2853: if (n[2853]++ > 0) check ('a string 2853'); break;
+ case 2854: if (n[2854]++ > 0) check ('a string 2854'); break;
+ case 2855: if (n[2855]++ > 0) check ('a string 2855'); break;
+ case 2856: if (n[2856]++ > 0) check ('a string 2856'); break;
+ case 2857: if (n[2857]++ > 0) check ('a string 2857'); break;
+ case 2858: if (n[2858]++ > 0) check ('a string 2858'); break;
+ case 2859: if (n[2859]++ > 0) check ('a string 2859'); break;
+ case 2860: if (n[2860]++ > 0) check ('a string 2860'); break;
+ case 2861: if (n[2861]++ > 0) check ('a string 2861'); break;
+ case 2862: if (n[2862]++ > 0) check ('a string 2862'); break;
+ case 2863: if (n[2863]++ > 0) check ('a string 2863'); break;
+ case 2864: if (n[2864]++ > 0) check ('a string 2864'); break;
+ case 2865: if (n[2865]++ > 0) check ('a string 2865'); break;
+ case 2866: if (n[2866]++ > 0) check ('a string 2866'); break;
+ case 2867: if (n[2867]++ > 0) check ('a string 2867'); break;
+ case 2868: if (n[2868]++ > 0) check ('a string 2868'); break;
+ case 2869: if (n[2869]++ > 0) check ('a string 2869'); break;
+ case 2870: if (n[2870]++ > 0) check ('a string 2870'); break;
+ case 2871: if (n[2871]++ > 0) check ('a string 2871'); break;
+ case 2872: if (n[2872]++ > 0) check ('a string 2872'); break;
+ case 2873: if (n[2873]++ > 0) check ('a string 2873'); break;
+ case 2874: if (n[2874]++ > 0) check ('a string 2874'); break;
+ case 2875: if (n[2875]++ > 0) check ('a string 2875'); break;
+ case 2876: if (n[2876]++ > 0) check ('a string 2876'); break;
+ case 2877: if (n[2877]++ > 0) check ('a string 2877'); break;
+ case 2878: if (n[2878]++ > 0) check ('a string 2878'); break;
+ case 2879: if (n[2879]++ > 0) check ('a string 2879'); break;
+ case 2880: if (n[2880]++ > 0) check ('a string 2880'); break;
+ case 2881: if (n[2881]++ > 0) check ('a string 2881'); break;
+ case 2882: if (n[2882]++ > 0) check ('a string 2882'); break;
+ case 2883: if (n[2883]++ > 0) check ('a string 2883'); break;
+ case 2884: if (n[2884]++ > 0) check ('a string 2884'); break;
+ case 2885: if (n[2885]++ > 0) check ('a string 2885'); break;
+ case 2886: if (n[2886]++ > 0) check ('a string 2886'); break;
+ case 2887: if (n[2887]++ > 0) check ('a string 2887'); break;
+ case 2888: if (n[2888]++ > 0) check ('a string 2888'); break;
+ case 2889: if (n[2889]++ > 0) check ('a string 2889'); break;
+ case 2890: if (n[2890]++ > 0) check ('a string 2890'); break;
+ case 2891: if (n[2891]++ > 0) check ('a string 2891'); break;
+ case 2892: if (n[2892]++ > 0) check ('a string 2892'); break;
+ case 2893: if (n[2893]++ > 0) check ('a string 2893'); break;
+ case 2894: if (n[2894]++ > 0) check ('a string 2894'); break;
+ case 2895: if (n[2895]++ > 0) check ('a string 2895'); break;
+ case 2896: if (n[2896]++ > 0) check ('a string 2896'); break;
+ case 2897: if (n[2897]++ > 0) check ('a string 2897'); break;
+ case 2898: if (n[2898]++ > 0) check ('a string 2898'); break;
+ case 2899: if (n[2899]++ > 0) check ('a string 2899'); break;
+ case 2900: if (n[2900]++ > 0) check ('a string 2900'); break;
+ case 2901: if (n[2901]++ > 0) check ('a string 2901'); break;
+ case 2902: if (n[2902]++ > 0) check ('a string 2902'); break;
+ case 2903: if (n[2903]++ > 0) check ('a string 2903'); break;
+ case 2904: if (n[2904]++ > 0) check ('a string 2904'); break;
+ case 2905: if (n[2905]++ > 0) check ('a string 2905'); break;
+ case 2906: if (n[2906]++ > 0) check ('a string 2906'); break;
+ case 2907: if (n[2907]++ > 0) check ('a string 2907'); break;
+ case 2908: if (n[2908]++ > 0) check ('a string 2908'); break;
+ case 2909: if (n[2909]++ > 0) check ('a string 2909'); break;
+ case 2910: if (n[2910]++ > 0) check ('a string 2910'); break;
+ case 2911: if (n[2911]++ > 0) check ('a string 2911'); break;
+ case 2912: if (n[2912]++ > 0) check ('a string 2912'); break;
+ case 2913: if (n[2913]++ > 0) check ('a string 2913'); break;
+ case 2914: if (n[2914]++ > 0) check ('a string 2914'); break;
+ case 2915: if (n[2915]++ > 0) check ('a string 2915'); break;
+ case 2916: if (n[2916]++ > 0) check ('a string 2916'); break;
+ case 2917: if (n[2917]++ > 0) check ('a string 2917'); break;
+ case 2918: if (n[2918]++ > 0) check ('a string 2918'); break;
+ case 2919: if (n[2919]++ > 0) check ('a string 2919'); break;
+ case 2920: if (n[2920]++ > 0) check ('a string 2920'); break;
+ case 2921: if (n[2921]++ > 0) check ('a string 2921'); break;
+ case 2922: if (n[2922]++ > 0) check ('a string 2922'); break;
+ case 2923: if (n[2923]++ > 0) check ('a string 2923'); break;
+ case 2924: if (n[2924]++ > 0) check ('a string 2924'); break;
+ case 2925: if (n[2925]++ > 0) check ('a string 2925'); break;
+ case 2926: if (n[2926]++ > 0) check ('a string 2926'); break;
+ case 2927: if (n[2927]++ > 0) check ('a string 2927'); break;
+ case 2928: if (n[2928]++ > 0) check ('a string 2928'); break;
+ case 2929: if (n[2929]++ > 0) check ('a string 2929'); break;
+ case 2930: if (n[2930]++ > 0) check ('a string 2930'); break;
+ case 2931: if (n[2931]++ > 0) check ('a string 2931'); break;
+ case 2932: if (n[2932]++ > 0) check ('a string 2932'); break;
+ case 2933: if (n[2933]++ > 0) check ('a string 2933'); break;
+ case 2934: if (n[2934]++ > 0) check ('a string 2934'); break;
+ case 2935: if (n[2935]++ > 0) check ('a string 2935'); break;
+ case 2936: if (n[2936]++ > 0) check ('a string 2936'); break;
+ case 2937: if (n[2937]++ > 0) check ('a string 2937'); break;
+ case 2938: if (n[2938]++ > 0) check ('a string 2938'); break;
+ case 2939: if (n[2939]++ > 0) check ('a string 2939'); break;
+ case 2940: if (n[2940]++ > 0) check ('a string 2940'); break;
+ case 2941: if (n[2941]++ > 0) check ('a string 2941'); break;
+ case 2942: if (n[2942]++ > 0) check ('a string 2942'); break;
+ case 2943: if (n[2943]++ > 0) check ('a string 2943'); break;
+ case 2944: if (n[2944]++ > 0) check ('a string 2944'); break;
+ case 2945: if (n[2945]++ > 0) check ('a string 2945'); break;
+ case 2946: if (n[2946]++ > 0) check ('a string 2946'); break;
+ case 2947: if (n[2947]++ > 0) check ('a string 2947'); break;
+ case 2948: if (n[2948]++ > 0) check ('a string 2948'); break;
+ case 2949: if (n[2949]++ > 0) check ('a string 2949'); break;
+ case 2950: if (n[2950]++ > 0) check ('a string 2950'); break;
+ case 2951: if (n[2951]++ > 0) check ('a string 2951'); break;
+ case 2952: if (n[2952]++ > 0) check ('a string 2952'); break;
+ case 2953: if (n[2953]++ > 0) check ('a string 2953'); break;
+ case 2954: if (n[2954]++ > 0) check ('a string 2954'); break;
+ case 2955: if (n[2955]++ > 0) check ('a string 2955'); break;
+ case 2956: if (n[2956]++ > 0) check ('a string 2956'); break;
+ case 2957: if (n[2957]++ > 0) check ('a string 2957'); break;
+ case 2958: if (n[2958]++ > 0) check ('a string 2958'); break;
+ case 2959: if (n[2959]++ > 0) check ('a string 2959'); break;
+ case 2960: if (n[2960]++ > 0) check ('a string 2960'); break;
+ case 2961: if (n[2961]++ > 0) check ('a string 2961'); break;
+ case 2962: if (n[2962]++ > 0) check ('a string 2962'); break;
+ case 2963: if (n[2963]++ > 0) check ('a string 2963'); break;
+ case 2964: if (n[2964]++ > 0) check ('a string 2964'); break;
+ case 2965: if (n[2965]++ > 0) check ('a string 2965'); break;
+ case 2966: if (n[2966]++ > 0) check ('a string 2966'); break;
+ case 2967: if (n[2967]++ > 0) check ('a string 2967'); break;
+ case 2968: if (n[2968]++ > 0) check ('a string 2968'); break;
+ case 2969: if (n[2969]++ > 0) check ('a string 2969'); break;
+ case 2970: if (n[2970]++ > 0) check ('a string 2970'); break;
+ case 2971: if (n[2971]++ > 0) check ('a string 2971'); break;
+ case 2972: if (n[2972]++ > 0) check ('a string 2972'); break;
+ case 2973: if (n[2973]++ > 0) check ('a string 2973'); break;
+ case 2974: if (n[2974]++ > 0) check ('a string 2974'); break;
+ case 2975: if (n[2975]++ > 0) check ('a string 2975'); break;
+ case 2976: if (n[2976]++ > 0) check ('a string 2976'); break;
+ case 2977: if (n[2977]++ > 0) check ('a string 2977'); break;
+ case 2978: if (n[2978]++ > 0) check ('a string 2978'); break;
+ case 2979: if (n[2979]++ > 0) check ('a string 2979'); break;
+ case 2980: if (n[2980]++ > 0) check ('a string 2980'); break;
+ case 2981: if (n[2981]++ > 0) check ('a string 2981'); break;
+ case 2982: if (n[2982]++ > 0) check ('a string 2982'); break;
+ case 2983: if (n[2983]++ > 0) check ('a string 2983'); break;
+ case 2984: if (n[2984]++ > 0) check ('a string 2984'); break;
+ case 2985: if (n[2985]++ > 0) check ('a string 2985'); break;
+ case 2986: if (n[2986]++ > 0) check ('a string 2986'); break;
+ case 2987: if (n[2987]++ > 0) check ('a string 2987'); break;
+ case 2988: if (n[2988]++ > 0) check ('a string 2988'); break;
+ case 2989: if (n[2989]++ > 0) check ('a string 2989'); break;
+ case 2990: if (n[2990]++ > 0) check ('a string 2990'); break;
+ case 2991: if (n[2991]++ > 0) check ('a string 2991'); break;
+ case 2992: if (n[2992]++ > 0) check ('a string 2992'); break;
+ case 2993: if (n[2993]++ > 0) check ('a string 2993'); break;
+ case 2994: if (n[2994]++ > 0) check ('a string 2994'); break;
+ case 2995: if (n[2995]++ > 0) check ('a string 2995'); break;
+ case 2996: if (n[2996]++ > 0) check ('a string 2996'); break;
+ case 2997: if (n[2997]++ > 0) check ('a string 2997'); break;
+ case 2998: if (n[2998]++ > 0) check ('a string 2998'); break;
+ case 2999: if (n[2999]++ > 0) check ('a string 2999'); break;
+ case 3000: if (n[3000]++ > 0) check ('a string 3000'); break;
+ case 3001: if (n[3001]++ > 0) check ('a string 3001'); break;
+ case 3002: if (n[3002]++ > 0) check ('a string 3002'); break;
+ case 3003: if (n[3003]++ > 0) check ('a string 3003'); break;
+ case 3004: if (n[3004]++ > 0) check ('a string 3004'); break;
+ case 3005: if (n[3005]++ > 0) check ('a string 3005'); break;
+ case 3006: if (n[3006]++ > 0) check ('a string 3006'); break;
+ case 3007: if (n[3007]++ > 0) check ('a string 3007'); break;
+ case 3008: if (n[3008]++ > 0) check ('a string 3008'); break;
+ case 3009: if (n[3009]++ > 0) check ('a string 3009'); break;
+ default : if (n[3010]++ > 0) check ('a string 3010'); break;
+ }
+ }
+
+ b4();
+ b_after();
+}
+
+
+function check(status)
+{
+ print('k = ' + k + ' j = ' + j + ' ' + status);
+
+ for (i = 0; i < i2; i++)
+ {
+ if (n[i] != 1)
+ {
+ print('n[' + i + '] = ' + n[i]);
+ if (i != j)
+ {
+ print('Test failed');
+ err_num++;
+ break;
+ }
+ }
+ }
+}
+
+
+function b4()
+{
+ print('Visited b4');
+}
+
+
+function b_after()
+{
+ print('Visited b_after');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-82306.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-82306.js
new file mode 100644
index 0000000..6841fd5
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-82306.js
@@ -0,0 +1,59 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS
+* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+* implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation. All
+* Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com, epstein@tellme.com
+* Date: 23 May 2001
+*
+* SUMMARY: Regression test for Bugzilla bug 82306
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=82306
+*
+* This test used to crash the JS engine. This was discovered
+* by Mike Epstein <epstein@tellme.com>
+*/
+//-------------------------------------------------------------------------------------------------
+var bug = 82306;
+var summary = "Testing we don't crash on encodeURI()";
+var URI = '';
+
+
+//-------------------------------------------------------------------------------------------------
+test();
+//-------------------------------------------------------------------------------------------------
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ URI += '<?xml version="1.0"?>';
+ URI += '<zcti application="xxxx_demo">';
+ URI += '<pstn_data>';
+ URI += '<ani>650-930-xxxx</ani>';
+ URI += '<dnis>877-485-xxxx</dnis>';
+ URI += '</pstn_data>';
+ URI += '<keyvalue key="name" value="xxx"/>';
+ URI += '<keyvalue key="phone" value="6509309000"/>';
+ URI += '</zcti>';
+
+ // Just testing that we don't crash on this
+ encodeURI(URI);
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-89443.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-89443.js
new file mode 100644
index 0000000..ba4e1db
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-89443.js
@@ -0,0 +1,2130 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an
+* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either expressed
+* or implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation.
+* All Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+* Date: 2001-07-12
+*
+* SUMMARY: Regression test for bug 89443
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=89443
+*
+* Just seeing if this script will compile without stack overflow.
+*/
+//-------------------------------------------------------------------------------------------------
+var bug = 89443;
+var summary = 'Testing this script will compile without stack overflow';
+
+printBugNumber (bug);
+printStatus (summary);
+
+
+// I don't know what these functions are supposed to be; use dummies -
+function isPlainHostName()
+{
+}
+
+function dnsDomainIs()
+{
+}
+
+// Here's the big function -
+function FindProxyForURL(url, host)
+{
+
+if (isPlainHostName(host)
+|| dnsDomainIs(host, ".hennepin.lib.mn.us")
+|| dnsDomainIs(host, ".hclib.org")
+)
+ return "DIRECT";
+else if (isPlainHostName(host)
+
+// subscription database access
+
+|| dnsDomainIs(host, ".asahi.com")
+|| dnsDomainIs(host, ".2facts.com")
+|| dnsDomainIs(host, ".oclc.org")
+|| dnsDomainIs(host, ".collegesource.com")
+|| dnsDomainIs(host, ".cq.com")
+|| dnsDomainIs(host, ".grolier.com")
+|| dnsDomainIs(host, ".groveart.com")
+|| dnsDomainIs(host, ".groveopera.com")
+|| dnsDomainIs(host, ".fsonline.com")
+|| dnsDomainIs(host, ".carl.org")
+|| dnsDomainIs(host, ".newslibrary.com")
+|| dnsDomainIs(host, ".pioneerplanet.com")
+|| dnsDomainIs(host, ".startribune.com")
+|| dnsDomainIs(host, ".poemfinder.com")
+|| dnsDomainIs(host, ".umi.com")
+|| dnsDomainIs(host, ".referenceusa.com")
+|| dnsDomainIs(host, ".sirs.com")
+|| dnsDomainIs(host, ".krmediastream.com")
+|| dnsDomainIs(host, ".gale.com")
+|| dnsDomainIs(host, ".galenet.com")
+|| dnsDomainIs(host, ".galegroup.com")
+|| dnsDomainIs(host, ".facts.com")
+|| dnsDomainIs(host, ".eb.com")
+|| dnsDomainIs(host, ".worldbookonline.com")
+|| dnsDomainIs(host, ".galegroup.com")
+|| dnsDomainIs(host, ".accessscience.com")
+|| dnsDomainIs(host, ".booksinprint.com")
+|| dnsDomainIs(host, ".infolearning.com")
+|| dnsDomainIs(host, ".standardpoor.com")
+
+// image servers
+|| dnsDomainIs(host, ".akamaitech.net")
+|| dnsDomainIs(host, ".akamai.net")
+|| dnsDomainIs(host, ".yimg.com")
+|| dnsDomainIs(host, ".imgis.com")
+|| dnsDomainIs(host, ".ibsys.com")
+
+// KidsClick-linked kids search engines
+|| dnsDomainIs(host, ".edview.com")
+|| dnsDomainIs(host, ".searchopolis.com")
+|| dnsDomainIs(host, ".onekey.com")
+|| dnsDomainIs(host, ".askjeeves.com")
+
+// Non-subscription Reference Tools URLs from the RecWebSites DBData table
+ || dnsDomainIs(host, "www.cnn.com")
+ || dnsDomainIs(host, "www.emulateme.com")
+ || dnsDomainIs(host, "terraserver.microsoft.com")
+ || dnsDomainIs(host, "www.theodora.com")
+ || dnsDomainIs(host, "www.3datlas.com")
+ || dnsDomainIs(host, "www.infoplease.com")
+ || dnsDomainIs(host, "www.switchboard.com")
+ || dnsDomainIs(host, "www.bartleby.com")
+ || dnsDomainIs(host, "www.mn-politics.com")
+ || dnsDomainIs(host, "www.thesaurus.com")
+ || dnsDomainIs(host, "www.usnews.com")
+ || dnsDomainIs(host, "www.petersons.com")
+ || dnsDomainIs(host, "www.collegenet.com")
+ || dnsDomainIs(host, "www.m-w.com")
+ || dnsDomainIs(host, "clever.net")
+ || dnsDomainIs(host, "maps.expedia.com")
+ || dnsDomainIs(host, "www.CollegeEdge.com")
+ || dnsDomainIs(host, "www.homeworkcentral.com")
+ || dnsDomainIs(host, "www.studyweb.com")
+ || dnsDomainIs(host, "www.mnpro.com")
+
+// custom URLs for local and other access
+|| dnsDomainIs(host, ".dsdukes.com")
+|| dnsDomainIs(host, ".spsaints.com")
+|| dnsDomainIs(host, ".mnzoo.com")
+|| dnsDomainIs(host, ".realaudio.com")
+|| dnsDomainIs(host, ".co.hennepin.mn.us")
+|| dnsDomainIs(host, ".gov")
+|| dnsDomainIs(host, ".org")
+|| dnsDomainIs(host, ".edu")
+|| dnsDomainIs(host, ".fox29.com")
+|| dnsDomainIs(host, ".wcco.com")
+|| dnsDomainIs(host, ".kstp.com")
+|| dnsDomainIs(host, ".kmsp.com")
+|| dnsDomainIs(host, ".kare11.com")
+|| dnsDomainIs(host, ".macromedia.com")
+|| dnsDomainIs(host, ".shockwave.com")
+|| dnsDomainIs(host, ".wwf.com")
+|| dnsDomainIs(host, ".wwfsuperstars.com")
+|| dnsDomainIs(host, ".summerslam.com")
+|| dnsDomainIs(host, ".yahooligans.com")
+|| dnsDomainIs(host, ".mhoob.com")
+|| dnsDomainIs(host, "www.hmonginternet.com")
+|| dnsDomainIs(host, "www.hmongonline.com")
+|| dnsDomainIs(host, ".yahoo.com")
+|| dnsDomainIs(host, ".pokemon.com")
+|| dnsDomainIs(host, ".bet.com")
+|| dnsDomainIs(host, ".smallworld.com")
+|| dnsDomainIs(host, ".cartoonnetwork.com")
+|| dnsDomainIs(host, ".carmensandiego.com")
+|| dnsDomainIs(host, ".disney.com")
+|| dnsDomainIs(host, ".powerpuffgirls.com")
+|| dnsDomainIs(host, ".aol.com")
+
+// Smithsonian
+|| dnsDomainIs(host, "160.111.100.190")
+
+// Hotmail
+|| dnsDomainIs(host, ".passport.com")
+|| dnsDomainIs(host, ".hotmail.com")
+|| dnsDomainIs(host, "216.33.236.24")
+|| dnsDomainIs(host, "216.32.182.251")
+|| dnsDomainIs(host, ".hotmail.msn.com")
+
+// K12 schools
+|| dnsDomainIs(host, ".k12.al.us")
+|| dnsDomainIs(host, ".k12.ak.us")
+|| dnsDomainIs(host, ".k12.ar.us")
+|| dnsDomainIs(host, ".k12.az.us")
+|| dnsDomainIs(host, ".k12.ca.us")
+|| dnsDomainIs(host, ".k12.co.us")
+|| dnsDomainIs(host, ".k12.ct.us")
+|| dnsDomainIs(host, ".k12.dc.us")
+|| dnsDomainIs(host, ".k12.de.us")
+|| dnsDomainIs(host, ".k12.fl.us")
+|| dnsDomainIs(host, ".k12.ga.us")
+|| dnsDomainIs(host, ".k12.hi.us")
+|| dnsDomainIs(host, ".k12.id.us")
+|| dnsDomainIs(host, ".k12.il.us")
+|| dnsDomainIs(host, ".k12.in.us")
+|| dnsDomainIs(host, ".k12.ia.us")
+|| dnsDomainIs(host, ".k12.ks.us")
+|| dnsDomainIs(host, ".k12.ky.us")
+|| dnsDomainIs(host, ".k12.la.us")
+|| dnsDomainIs(host, ".k12.me.us")
+|| dnsDomainIs(host, ".k12.md.us")
+|| dnsDomainIs(host, ".k12.ma.us")
+|| dnsDomainIs(host, ".k12.mi.us")
+|| dnsDomainIs(host, ".k12.mn.us")
+|| dnsDomainIs(host, ".k12.ms.us")
+|| dnsDomainIs(host, ".k12.mo.us")
+|| dnsDomainIs(host, ".k12.mt.us")
+|| dnsDomainIs(host, ".k12.ne.us")
+|| dnsDomainIs(host, ".k12.nv.us")
+|| dnsDomainIs(host, ".k12.nh.us")
+|| dnsDomainIs(host, ".k12.nj.us")
+|| dnsDomainIs(host, ".k12.nm.us")
+|| dnsDomainIs(host, ".k12.ny.us")
+|| dnsDomainIs(host, ".k12.nc.us")
+|| dnsDomainIs(host, ".k12.nd.us")
+|| dnsDomainIs(host, ".k12.oh.us")
+|| dnsDomainIs(host, ".k12.ok.us")
+|| dnsDomainIs(host, ".k12.or.us")
+|| dnsDomainIs(host, ".k12.pa.us")
+|| dnsDomainIs(host, ".k12.ri.us")
+|| dnsDomainIs(host, ".k12.sc.us")
+|| dnsDomainIs(host, ".k12.sd.us")
+|| dnsDomainIs(host, ".k12.tn.us")
+|| dnsDomainIs(host, ".k12.tx.us")
+|| dnsDomainIs(host, ".k12.ut.us")
+|| dnsDomainIs(host, ".k12.vt.us")
+|| dnsDomainIs(host, ".k12.va.us")
+|| dnsDomainIs(host, ".k12.wa.us")
+|| dnsDomainIs(host, ".k12.wv.us")
+|| dnsDomainIs(host, ".k12.wi.us")
+|| dnsDomainIs(host, ".k12.wy.us")
+
+// U.S. Libraries
+|| dnsDomainIs(host, ".lib.al.us")
+|| dnsDomainIs(host, ".lib.ak.us")
+|| dnsDomainIs(host, ".lib.ar.us")
+|| dnsDomainIs(host, ".lib.az.us")
+|| dnsDomainIs(host, ".lib.ca.us")
+|| dnsDomainIs(host, ".lib.co.us")
+|| dnsDomainIs(host, ".lib.ct.us")
+|| dnsDomainIs(host, ".lib.dc.us")
+|| dnsDomainIs(host, ".lib.de.us")
+|| dnsDomainIs(host, ".lib.fl.us")
+|| dnsDomainIs(host, ".lib.ga.us")
+|| dnsDomainIs(host, ".lib.hi.us")
+|| dnsDomainIs(host, ".lib.id.us")
+|| dnsDomainIs(host, ".lib.il.us")
+|| dnsDomainIs(host, ".lib.in.us")
+|| dnsDomainIs(host, ".lib.ia.us")
+|| dnsDomainIs(host, ".lib.ks.us")
+|| dnsDomainIs(host, ".lib.ky.us")
+|| dnsDomainIs(host, ".lib.la.us")
+|| dnsDomainIs(host, ".lib.me.us")
+|| dnsDomainIs(host, ".lib.md.us")
+|| dnsDomainIs(host, ".lib.ma.us")
+|| dnsDomainIs(host, ".lib.mi.us")
+|| dnsDomainIs(host, ".lib.mn.us")
+|| dnsDomainIs(host, ".lib.ms.us")
+|| dnsDomainIs(host, ".lib.mo.us")
+|| dnsDomainIs(host, ".lib.mt.us")
+|| dnsDomainIs(host, ".lib.ne.us")
+|| dnsDomainIs(host, ".lib.nv.us")
+|| dnsDomainIs(host, ".lib.nh.us")
+|| dnsDomainIs(host, ".lib.nj.us")
+|| dnsDomainIs(host, ".lib.nm.us")
+|| dnsDomainIs(host, ".lib.ny.us")
+|| dnsDomainIs(host, ".lib.nc.us")
+|| dnsDomainIs(host, ".lib.nd.us")
+|| dnsDomainIs(host, ".lib.oh.us")
+|| dnsDomainIs(host, ".lib.ok.us")
+|| dnsDomainIs(host, ".lib.or.us")
+|| dnsDomainIs(host, ".lib.pa.us")
+|| dnsDomainIs(host, ".lib.ri.us")
+|| dnsDomainIs(host, ".lib.sc.us")
+|| dnsDomainIs(host, ".lib.sd.us")
+|| dnsDomainIs(host, ".lib.tn.us")
+|| dnsDomainIs(host, ".lib.tx.us")
+|| dnsDomainIs(host, ".lib.ut.us")
+|| dnsDomainIs(host, ".lib.vt.us")
+|| dnsDomainIs(host, ".lib.va.us")
+|| dnsDomainIs(host, ".lib.wa.us")
+|| dnsDomainIs(host, ".lib.wv.us")
+|| dnsDomainIs(host, ".lib.wi.us")
+|| dnsDomainIs(host, ".lib.wy.us")
+
+// U.S. Cities
+|| dnsDomainIs(host, ".ci.al.us")
+|| dnsDomainIs(host, ".ci.ak.us")
+|| dnsDomainIs(host, ".ci.ar.us")
+|| dnsDomainIs(host, ".ci.az.us")
+|| dnsDomainIs(host, ".ci.ca.us")
+|| dnsDomainIs(host, ".ci.co.us")
+|| dnsDomainIs(host, ".ci.ct.us")
+|| dnsDomainIs(host, ".ci.dc.us")
+|| dnsDomainIs(host, ".ci.de.us")
+|| dnsDomainIs(host, ".ci.fl.us")
+|| dnsDomainIs(host, ".ci.ga.us")
+|| dnsDomainIs(host, ".ci.hi.us")
+|| dnsDomainIs(host, ".ci.id.us")
+|| dnsDomainIs(host, ".ci.il.us")
+|| dnsDomainIs(host, ".ci.in.us")
+|| dnsDomainIs(host, ".ci.ia.us")
+|| dnsDomainIs(host, ".ci.ks.us")
+|| dnsDomainIs(host, ".ci.ky.us")
+|| dnsDomainIs(host, ".ci.la.us")
+|| dnsDomainIs(host, ".ci.me.us")
+|| dnsDomainIs(host, ".ci.md.us")
+|| dnsDomainIs(host, ".ci.ma.us")
+|| dnsDomainIs(host, ".ci.mi.us")
+|| dnsDomainIs(host, ".ci.mn.us")
+|| dnsDomainIs(host, ".ci.ms.us")
+|| dnsDomainIs(host, ".ci.mo.us")
+|| dnsDomainIs(host, ".ci.mt.us")
+|| dnsDomainIs(host, ".ci.ne.us")
+|| dnsDomainIs(host, ".ci.nv.us")
+|| dnsDomainIs(host, ".ci.nh.us")
+|| dnsDomainIs(host, ".ci.nj.us")
+|| dnsDomainIs(host, ".ci.nm.us")
+|| dnsDomainIs(host, ".ci.ny.us")
+|| dnsDomainIs(host, ".ci.nc.us")
+|| dnsDomainIs(host, ".ci.nd.us")
+|| dnsDomainIs(host, ".ci.oh.us")
+|| dnsDomainIs(host, ".ci.ok.us")
+|| dnsDomainIs(host, ".ci.or.us")
+|| dnsDomainIs(host, ".ci.pa.us")
+|| dnsDomainIs(host, ".ci.ri.us")
+|| dnsDomainIs(host, ".ci.sc.us")
+|| dnsDomainIs(host, ".ci.sd.us")
+|| dnsDomainIs(host, ".ci.tn.us")
+|| dnsDomainIs(host, ".ci.tx.us")
+|| dnsDomainIs(host, ".ci.ut.us")
+|| dnsDomainIs(host, ".ci.vt.us")
+|| dnsDomainIs(host, ".ci.va.us")
+|| dnsDomainIs(host, ".ci.wa.us")
+|| dnsDomainIs(host, ".ci.wv.us")
+|| dnsDomainIs(host, ".ci.wi.us")
+|| dnsDomainIs(host, ".ci.wy.us")
+
+// U.S. Counties
+|| dnsDomainIs(host, ".co.al.us")
+|| dnsDomainIs(host, ".co.ak.us")
+|| dnsDomainIs(host, ".co.ar.us")
+|| dnsDomainIs(host, ".co.az.us")
+|| dnsDomainIs(host, ".co.ca.us")
+|| dnsDomainIs(host, ".co.co.us")
+|| dnsDomainIs(host, ".co.ct.us")
+|| dnsDomainIs(host, ".co.dc.us")
+|| dnsDomainIs(host, ".co.de.us")
+|| dnsDomainIs(host, ".co.fl.us")
+|| dnsDomainIs(host, ".co.ga.us")
+|| dnsDomainIs(host, ".co.hi.us")
+|| dnsDomainIs(host, ".co.id.us")
+|| dnsDomainIs(host, ".co.il.us")
+|| dnsDomainIs(host, ".co.in.us")
+|| dnsDomainIs(host, ".co.ia.us")
+|| dnsDomainIs(host, ".co.ks.us")
+|| dnsDomainIs(host, ".co.ky.us")
+|| dnsDomainIs(host, ".co.la.us")
+|| dnsDomainIs(host, ".co.me.us")
+|| dnsDomainIs(host, ".co.md.us")
+|| dnsDomainIs(host, ".co.ma.us")
+|| dnsDomainIs(host, ".co.mi.us")
+|| dnsDomainIs(host, ".co.mn.us")
+|| dnsDomainIs(host, ".co.ms.us")
+|| dnsDomainIs(host, ".co.mo.us")
+|| dnsDomainIs(host, ".co.mt.us")
+|| dnsDomainIs(host, ".co.ne.us")
+|| dnsDomainIs(host, ".co.nv.us")
+|| dnsDomainIs(host, ".co.nh.us")
+|| dnsDomainIs(host, ".co.nj.us")
+|| dnsDomainIs(host, ".co.nm.us")
+|| dnsDomainIs(host, ".co.ny.us")
+|| dnsDomainIs(host, ".co.nc.us")
+|| dnsDomainIs(host, ".co.nd.us")
+|| dnsDomainIs(host, ".co.oh.us")
+|| dnsDomainIs(host, ".co.ok.us")
+|| dnsDomainIs(host, ".co.or.us")
+|| dnsDomainIs(host, ".co.pa.us")
+|| dnsDomainIs(host, ".co.ri.us")
+|| dnsDomainIs(host, ".co.sc.us")
+|| dnsDomainIs(host, ".co.sd.us")
+|| dnsDomainIs(host, ".co.tn.us")
+|| dnsDomainIs(host, ".co.tx.us")
+|| dnsDomainIs(host, ".co.ut.us")
+|| dnsDomainIs(host, ".co.vt.us")
+|| dnsDomainIs(host, ".co.va.us")
+|| dnsDomainIs(host, ".co.wa.us")
+|| dnsDomainIs(host, ".co.wv.us")
+|| dnsDomainIs(host, ".co.wi.us")
+|| dnsDomainIs(host, ".co.wy.us")
+
+// U.S. States
+|| dnsDomainIs(host, ".state.al.us")
+|| dnsDomainIs(host, ".state.ak.us")
+|| dnsDomainIs(host, ".state.ar.us")
+|| dnsDomainIs(host, ".state.az.us")
+|| dnsDomainIs(host, ".state.ca.us")
+|| dnsDomainIs(host, ".state.co.us")
+|| dnsDomainIs(host, ".state.ct.us")
+|| dnsDomainIs(host, ".state.dc.us")
+|| dnsDomainIs(host, ".state.de.us")
+|| dnsDomainIs(host, ".state.fl.us")
+|| dnsDomainIs(host, ".state.ga.us")
+|| dnsDomainIs(host, ".state.hi.us")
+|| dnsDomainIs(host, ".state.id.us")
+|| dnsDomainIs(host, ".state.il.us")
+|| dnsDomainIs(host, ".state.in.us")
+|| dnsDomainIs(host, ".state.ia.us")
+|| dnsDomainIs(host, ".state.ks.us")
+|| dnsDomainIs(host, ".state.ky.us")
+|| dnsDomainIs(host, ".state.la.us")
+|| dnsDomainIs(host, ".state.me.us")
+|| dnsDomainIs(host, ".state.md.us")
+|| dnsDomainIs(host, ".state.ma.us")
+|| dnsDomainIs(host, ".state.mi.us")
+|| dnsDomainIs(host, ".state.mn.us")
+|| dnsDomainIs(host, ".state.ms.us")
+|| dnsDomainIs(host, ".state.mo.us")
+|| dnsDomainIs(host, ".state.mt.us")
+|| dnsDomainIs(host, ".state.ne.us")
+|| dnsDomainIs(host, ".state.nv.us")
+|| dnsDomainIs(host, ".state.nh.us")
+|| dnsDomainIs(host, ".state.nj.us")
+|| dnsDomainIs(host, ".state.nm.us")
+|| dnsDomainIs(host, ".state.ny.us")
+|| dnsDomainIs(host, ".state.nc.us")
+|| dnsDomainIs(host, ".state.nd.us")
+|| dnsDomainIs(host, ".state.oh.us")
+|| dnsDomainIs(host, ".state.ok.us")
+|| dnsDomainIs(host, ".state.or.us")
+|| dnsDomainIs(host, ".state.pa.us")
+|| dnsDomainIs(host, ".state.ri.us")
+|| dnsDomainIs(host, ".state.sc.us")
+|| dnsDomainIs(host, ".state.sd.us")
+|| dnsDomainIs(host, ".state.tn.us")
+|| dnsDomainIs(host, ".state.tx.us")
+|| dnsDomainIs(host, ".state.ut.us")
+|| dnsDomainIs(host, ".state.vt.us")
+|| dnsDomainIs(host, ".state.va.us")
+|| dnsDomainIs(host, ".state.wa.us")
+|| dnsDomainIs(host, ".state.wv.us")
+|| dnsDomainIs(host, ".state.wi.us")
+|| dnsDomainIs(host, ".state.wy.us")
+
+// KidsClick URLs
+
+|| dnsDomainIs(host, "12.16.163.163")
+|| dnsDomainIs(host, "128.59.173.136")
+|| dnsDomainIs(host, "165.112.78.61")
+|| dnsDomainIs(host, "216.55.23.140")
+|| dnsDomainIs(host, "63.111.53.150")
+|| dnsDomainIs(host, "64.94.206.8")
+
+|| dnsDomainIs(host, "abc.go.com")
+|| dnsDomainIs(host, "acmepet.petsmart.com")
+|| dnsDomainIs(host, "adver-net.com")
+|| dnsDomainIs(host, "aint-it-cool-news.com")
+|| dnsDomainIs(host, "akidsheart.com")
+|| dnsDomainIs(host, "alabanza.com")
+|| dnsDomainIs(host, "allerdays.com")
+|| dnsDomainIs(host, "allgame.com")
+|| dnsDomainIs(host, "allowancenet.com")
+|| dnsDomainIs(host, "amish-heartland.com")
+|| dnsDomainIs(host, "ancienthistory.about.com")
+|| dnsDomainIs(host, "animals.about.com")
+|| dnsDomainIs(host, "antenna.nl")
+|| dnsDomainIs(host, "arcweb.sos.state.or.us")
+|| dnsDomainIs(host, "artistmummer.homestead.com")
+|| dnsDomainIs(host, "artists.vh1.com")
+|| dnsDomainIs(host, "arts.lausd.k12.ca.us")
+|| dnsDomainIs(host, "asiatravel.com")
+|| dnsDomainIs(host, "asterius.com")
+|| dnsDomainIs(host, "atlas.gc.ca")
+|| dnsDomainIs(host, "atschool.eduweb.co.uk")
+|| dnsDomainIs(host, "ayya.pd.net")
+|| dnsDomainIs(host, "babelfish.altavista.com")
+|| dnsDomainIs(host, "babylon5.warnerbros.com")
+|| dnsDomainIs(host, "banzai.neosoft.com")
+|| dnsDomainIs(host, "barneyonline.com")
+|| dnsDomainIs(host, "baroque-music.com")
+|| dnsDomainIs(host, "barsoom.msss.com")
+|| dnsDomainIs(host, "baseball-almanac.com")
+|| dnsDomainIs(host, "bcadventure.com")
+|| dnsDomainIs(host, "beadiecritters.hosting4less.com")
+|| dnsDomainIs(host, "beverlyscrafts.com")
+|| dnsDomainIs(host, "biology.about.com")
+|| dnsDomainIs(host, "birding.about.com")
+|| dnsDomainIs(host, "boatsafe.com")
+|| dnsDomainIs(host, "bombpop.com")
+|| dnsDomainIs(host, "boulter.com")
+|| dnsDomainIs(host, "bright-ideas-software.com")
+|| dnsDomainIs(host, "buckman.pps.k12.or.us")
+|| dnsDomainIs(host, "buffalobills.com")
+|| dnsDomainIs(host, "bvsd.k12.co.us")
+|| dnsDomainIs(host, "cagle.slate.msn.com")
+|| dnsDomainIs(host, "calc.entisoft.com")
+|| dnsDomainIs(host, "canada.gc.ca")
+|| dnsDomainIs(host, "candleandsoap.about.com")
+|| dnsDomainIs(host, "caselaw.lp.findlaw.com")
+|| dnsDomainIs(host, "catalog.com")
+|| dnsDomainIs(host, "catalog.socialstudies.com")
+|| dnsDomainIs(host, "cavern.com")
+|| dnsDomainIs(host, "cbs.sportsline.com")
+|| dnsDomainIs(host, "cc.matsuyama-u.ac.jp")
+|| dnsDomainIs(host, "celt.net")
+|| dnsDomainIs(host, "cgfa.kelloggcreek.com")
+|| dnsDomainIs(host, "channel4000.com")
+|| dnsDomainIs(host, "chess.delorie.com")
+|| dnsDomainIs(host, "chess.liveonthenet.com")
+|| dnsDomainIs(host, "childfun.com")
+|| dnsDomainIs(host, "christmas.com")
+|| dnsDomainIs(host, "citystar.com")
+|| dnsDomainIs(host, "claim.goldrush.com")
+|| dnsDomainIs(host, "clairerosemaryjane.com")
+|| dnsDomainIs(host, "clevermedia.com")
+|| dnsDomainIs(host, "cobblestonepub.com")
+|| dnsDomainIs(host, "codebrkr.infopages.net")
+|| dnsDomainIs(host, "colitz.com")
+|| dnsDomainIs(host, "collections.ic.gc.ca")
+|| dnsDomainIs(host, "coloquio.com")
+|| dnsDomainIs(host, "come.to")
+|| dnsDomainIs(host, "coombs.anu.edu.au")
+|| dnsDomainIs(host, "crafterscommunity.com")
+|| dnsDomainIs(host, "craftsforkids.about.com")
+|| dnsDomainIs(host, "creativity.net")
+|| dnsDomainIs(host, "cslewis.drzeus.net")
+|| dnsDomainIs(host, "cust.idl.com.au")
+|| dnsDomainIs(host, "cvs.anu.edu.au")
+|| dnsDomainIs(host, "cybersleuth-kids.com")
+|| dnsDomainIs(host, "cybertown.com")
+|| dnsDomainIs(host, "darkfish.com")
+|| dnsDomainIs(host, "datadragon.com")
+|| dnsDomainIs(host, "davesite.com")
+|| dnsDomainIs(host, "dbertens.www.cistron.nl")
+|| dnsDomainIs(host, "detnews.com")
+|| dnsDomainIs(host, "dhr.dos.state.fl.us")
+|| dnsDomainIs(host, "dialspace.dial.pipex.com")
+|| dnsDomainIs(host, "dictionaries.travlang.com")
+|| dnsDomainIs(host, "disney.go.com")
+|| dnsDomainIs(host, "disneyland.disney.go.com")
+|| dnsDomainIs(host, "district.gresham.k12.or.us")
+|| dnsDomainIs(host, "dmarie.com")
+|| dnsDomainIs(host, "dreamwater.com")
+|| dnsDomainIs(host, "duke.fuse.net")
+|| dnsDomainIs(host, "earlyamerica.com")
+|| dnsDomainIs(host, "earthsky.com")
+|| dnsDomainIs(host, "easyweb.easynet.co.uk")
+|| dnsDomainIs(host, "ecards1.bansheeweb.com")
+|| dnsDomainIs(host, "edugreen.teri.res.in")
+|| dnsDomainIs(host, "edwardlear.tripod.com")
+|| dnsDomainIs(host, "eelink.net")
+|| dnsDomainIs(host, "elizabethsings.com")
+|| dnsDomainIs(host, "enature.com")
+|| dnsDomainIs(host, "encarta.msn.com")
+|| dnsDomainIs(host, "endangeredspecie.com")
+|| dnsDomainIs(host, "enterprise.america.com")
+|| dnsDomainIs(host, "ericae.net")
+|| dnsDomainIs(host, "esl.about.com")
+|| dnsDomainIs(host, "eveander.com")
+|| dnsDomainIs(host, "exn.ca")
+|| dnsDomainIs(host, "fallscam.niagara.com")
+|| dnsDomainIs(host, "family.go.com")
+|| dnsDomainIs(host, "family2.go.com")
+|| dnsDomainIs(host, "familyeducation.com")
+|| dnsDomainIs(host, "finditquick.com")
+|| dnsDomainIs(host, "fln-bma.yazigi.com.br")
+|| dnsDomainIs(host, "fln-con.yazigi.com.br")
+|| dnsDomainIs(host, "food.epicurious.com")
+|| dnsDomainIs(host, "forums.sympatico.ca")
+|| dnsDomainIs(host, "fotw.vexillum.com")
+|| dnsDomainIs(host, "fox.nstn.ca")
+|| dnsDomainIs(host, "framingham.com")
+|| dnsDomainIs(host, "freevote.com")
+|| dnsDomainIs(host, "freeweb.pdq.net")
+|| dnsDomainIs(host, "games.yahoo.com")
+|| dnsDomainIs(host, "gardening.sierrahome.com")
+|| dnsDomainIs(host, "gardenofpraise.com")
+|| dnsDomainIs(host, "gcclearn.gcc.cc.va.us")
+|| dnsDomainIs(host, "genealogytoday.com")
+|| dnsDomainIs(host, "genesis.ne.mediaone.net")
+|| dnsDomainIs(host, "geniefind.com")
+|| dnsDomainIs(host, "geography.about.com")
+|| dnsDomainIs(host, "gf.state.wy.us")
+|| dnsDomainIs(host, "gi.grolier.com")
+|| dnsDomainIs(host, "golf.com")
+|| dnsDomainIs(host, "greatseal.com")
+|| dnsDomainIs(host, "guardians.net")
+|| dnsDomainIs(host, "hamlet.hypermart.net")
+|| dnsDomainIs(host, "happypuppy.com")
+|| dnsDomainIs(host, "harcourt.fsc.follett.com")
+|| dnsDomainIs(host, "haringkids.com")
+|| dnsDomainIs(host, "harrietmaysavitz.com")
+|| dnsDomainIs(host, "harrypotter.warnerbros.com")
+|| dnsDomainIs(host, "hca.gilead.org.il")
+|| dnsDomainIs(host, "header.future.easyspace.com")
+|| dnsDomainIs(host, "historymedren.about.com")
+|| dnsDomainIs(host, "home.att.net")
+|| dnsDomainIs(host, "home.austin.rr.com")
+|| dnsDomainIs(host, "home.capu.net")
+|| dnsDomainIs(host, "home.cfl.rr.com")
+|| dnsDomainIs(host, "home.clara.net")
+|| dnsDomainIs(host, "home.clear.net.nz")
+|| dnsDomainIs(host, "home.earthlink.net")
+|| dnsDomainIs(host, "home.eznet.net")
+|| dnsDomainIs(host, "home.flash.net")
+|| dnsDomainIs(host, "home.hiwaay.net")
+|| dnsDomainIs(host, "home.hkstar.com")
+|| dnsDomainIs(host, "home.ici.net")
+|| dnsDomainIs(host, "home.inreach.com")
+|| dnsDomainIs(host, "home.interlynx.net")
+|| dnsDomainIs(host, "home.istar.ca")
+|| dnsDomainIs(host, "home.mira.net")
+|| dnsDomainIs(host, "home.nycap.rr.com")
+|| dnsDomainIs(host, "home.online.no")
+|| dnsDomainIs(host, "home.pb.net")
+|| dnsDomainIs(host, "home2.pacific.net.sg")
+|| dnsDomainIs(host, "homearts.com")
+|| dnsDomainIs(host, "homepage.mac.com")
+|| dnsDomainIs(host, "hometown.aol.com")
+|| dnsDomainIs(host, "homiliesbyemail.com")
+|| dnsDomainIs(host, "hotei.fix.co.jp")
+|| dnsDomainIs(host, "hotwired.lycos.com")
+|| dnsDomainIs(host, "hp.vector.co.jp")
+|| dnsDomainIs(host, "hum.amu.edu.pl")
+|| dnsDomainIs(host, "i-cias.com")
+|| dnsDomainIs(host, "icatapults.freeservers.com")
+|| dnsDomainIs(host, "ind.cioe.com")
+|| dnsDomainIs(host, "info.ex.ac.uk")
+|| dnsDomainIs(host, "infocan.gc.ca")
+|| dnsDomainIs(host, "infoservice.gc.ca")
+|| dnsDomainIs(host, "interoz.com")
+|| dnsDomainIs(host, "ireland.iol.ie")
+|| dnsDomainIs(host, "is.dal.ca")
+|| dnsDomainIs(host, "itss.raytheon.com")
+|| dnsDomainIs(host, "iul.com")
+|| dnsDomainIs(host, "jameswhitcombriley.com")
+|| dnsDomainIs(host, "jellieszone.com")
+|| dnsDomainIs(host, "jordan.sportsline.com")
+|| dnsDomainIs(host, "judyanddavid.com")
+|| dnsDomainIs(host, "jurai.murdoch.edu.au")
+|| dnsDomainIs(host, "just.about.com")
+|| dnsDomainIs(host, "kayleigh.tierranet.com")
+|| dnsDomainIs(host, "kcwingwalker.tripod.com")
+|| dnsDomainIs(host, "kidexchange.about.com")
+|| dnsDomainIs(host, "kids-world.colgatepalmolive.com")
+|| dnsDomainIs(host, "kids.mysterynet.com")
+|| dnsDomainIs(host, "kids.ot.com")
+|| dnsDomainIs(host, "kidsartscrafts.about.com")
+|| dnsDomainIs(host, "kidsastronomy.about.com")
+|| dnsDomainIs(host, "kidscience.about.com")
+|| dnsDomainIs(host, "kidscience.miningco.com")
+|| dnsDomainIs(host, "kidscollecting.about.com")
+|| dnsDomainIs(host, "kidsfun.co.uk")
+|| dnsDomainIs(host, "kidsinternet.about.com")
+|| dnsDomainIs(host, "kidslangarts.about.com")
+|| dnsDomainIs(host, "kidspenpals.about.com")
+|| dnsDomainIs(host, "kitecast.com")
+|| dnsDomainIs(host, "knight.city.ba.k12.md.us")
+|| dnsDomainIs(host, "kodak.com")
+|| dnsDomainIs(host, "kwanzaa4kids.homestead.com")
+|| dnsDomainIs(host, "lagos.africaonline.com")
+|| dnsDomainIs(host, "lancearmstrong.com")
+|| dnsDomainIs(host, "landru.i-link-2.net")
+|| dnsDomainIs(host, "lang.nagoya-u.ac.jp")
+|| dnsDomainIs(host, "lascala.milano.it")
+|| dnsDomainIs(host, "latinoculture.about.com")
+|| dnsDomainIs(host, "litcal.yasuda-u.ac.jp")
+|| dnsDomainIs(host, "littlebit.com")
+|| dnsDomainIs(host, "live.edventures.com")
+|| dnsDomainIs(host, "look.net")
+|| dnsDomainIs(host, "lycoskids.infoplease.com")
+|| dnsDomainIs(host, "lynx.uio.no")
+|| dnsDomainIs(host, "macdict.dict.mq.edu.au")
+|| dnsDomainIs(host, "maori.culture.co.nz")
+|| dnsDomainIs(host, "marktwain.about.com")
+|| dnsDomainIs(host, "marktwain.miningco.com")
+|| dnsDomainIs(host, "mars2030.net")
+|| dnsDomainIs(host, "martin.parasitology.mcgill.ca")
+|| dnsDomainIs(host, "martinlutherking.8m.com")
+|| dnsDomainIs(host, "mastercollector.com")
+|| dnsDomainIs(host, "mathcentral.uregina.ca")
+|| dnsDomainIs(host, "members.aol.com")
+|| dnsDomainIs(host, "members.carol.net")
+|| dnsDomainIs(host, "members.cland.net")
+|| dnsDomainIs(host, "members.cruzio.com")
+|| dnsDomainIs(host, "members.easyspace.com")
+|| dnsDomainIs(host, "members.eisa.net.au")
+|| dnsDomainIs(host, "members.home.net")
+|| dnsDomainIs(host, "members.iinet.net.au")
+|| dnsDomainIs(host, "members.nbci.com")
+|| dnsDomainIs(host, "members.ozemail.com.au")
+|| dnsDomainIs(host, "members.surfsouth.com")
+|| dnsDomainIs(host, "members.theglobe.com")
+|| dnsDomainIs(host, "members.tripod.com")
+|| dnsDomainIs(host, "mexplaza.udg.mx")
+|| dnsDomainIs(host, "mgfx.com")
+|| dnsDomainIs(host, "microimg.com")
+|| dnsDomainIs(host, "midusa.net")
+|| dnsDomainIs(host, "mildan.com")
+|| dnsDomainIs(host, "millennianet.com")
+|| dnsDomainIs(host, "mindbreakers.e-fun.nu")
+|| dnsDomainIs(host, "missjanet.xs4all.nl")
+|| dnsDomainIs(host, "mistral.culture.fr")
+|| dnsDomainIs(host, "mobileation.com")
+|| dnsDomainIs(host, "mrshowbiz.go.com")
+|| dnsDomainIs(host, "ms.simplenet.com")
+|| dnsDomainIs(host, "museum.gov.ns.ca")
+|| dnsDomainIs(host, "music.excite.com")
+|| dnsDomainIs(host, "musicfinder.yahoo.com")
+|| dnsDomainIs(host, "my.freeway.net")
+|| dnsDomainIs(host, "mytrains.com")
+|| dnsDomainIs(host, "nativeauthors.com")
+|| dnsDomainIs(host, "nba.com")
+|| dnsDomainIs(host, "nch.ari.net")
+|| dnsDomainIs(host, "neonpeach.tripod.com")
+|| dnsDomainIs(host, "net.indra.com")
+|| dnsDomainIs(host, "ngeorgia.com")
+|| dnsDomainIs(host, "ngp.ngpc.state.ne.us")
+|| dnsDomainIs(host, "nhd.heinle.com")
+|| dnsDomainIs(host, "nick.com")
+|| dnsDomainIs(host, "normandy.eb.com")
+|| dnsDomainIs(host, "northshore.shore.net")
+|| dnsDomainIs(host, "now2000.com")
+|| dnsDomainIs(host, "npc.nunavut.ca")
+|| dnsDomainIs(host, "ns2.carib-link.net")
+|| dnsDomainIs(host, "ntl.sympatico.ca")
+|| dnsDomainIs(host, "oceanographer.navy.mil")
+|| dnsDomainIs(host, "oddens.geog.uu.nl")
+|| dnsDomainIs(host, "officialcitysites.com")
+|| dnsDomainIs(host, "oneida-nation.net")
+|| dnsDomainIs(host, "onlinegeorgia.com")
+|| dnsDomainIs(host, "originator_2.tripod.com")
+|| dnsDomainIs(host, "ortech-engr.com")
+|| dnsDomainIs(host, "osage.voorhees.k12.nj.us")
+|| dnsDomainIs(host, "osiris.sund.ac.uk")
+|| dnsDomainIs(host, "ourworld.compuserve.com")
+|| dnsDomainIs(host, "outdoorphoto.com")
+|| dnsDomainIs(host, "pages.map.com")
+|| dnsDomainIs(host, "pages.prodigy.com")
+|| dnsDomainIs(host, "pages.prodigy.net")
+|| dnsDomainIs(host, "pages.tca.net")
+|| dnsDomainIs(host, "parcsafari.qc.ca")
+|| dnsDomainIs(host, "parenthoodweb.com")
+|| dnsDomainIs(host, "pathfinder.com")
+|| dnsDomainIs(host, "people.clarityconnect.com")
+|| dnsDomainIs(host, "people.enternet.com.au")
+|| dnsDomainIs(host, "people.ne.mediaone.net")
+|| dnsDomainIs(host, "phonics.jazzles.com")
+|| dnsDomainIs(host, "pibburns.com")
+|| dnsDomainIs(host, "pilgrims.net")
+|| dnsDomainIs(host, "pinenet.com")
+|| dnsDomainIs(host, "place.scholastic.com")
+|| dnsDomainIs(host, "playground.kodak.com")
+|| dnsDomainIs(host, "politicalgraveyard.com")
+|| dnsDomainIs(host, "polk.ga.net")
+|| dnsDomainIs(host, "pompstory.home.mindspring.com")
+|| dnsDomainIs(host, "popularmechanics.com")
+|| dnsDomainIs(host, "projects.edtech.sandi.net")
+|| dnsDomainIs(host, "psyche.usno.navy.mil")
+|| dnsDomainIs(host, "pubweb.parc.xerox.com")
+|| dnsDomainIs(host, "puzzlemaker.school.discovery.com")
+|| dnsDomainIs(host, "quest.classroom.com")
+|| dnsDomainIs(host, "quilting.about.com")
+|| dnsDomainIs(host, "rabbitmoon.home.mindspring.com")
+|| dnsDomainIs(host, "radio.cbc.ca")
+|| dnsDomainIs(host, "rats2u.com")
+|| dnsDomainIs(host, "rbcm1.rbcm.gov.bc.ca")
+|| dnsDomainIs(host, "readplay.com")
+|| dnsDomainIs(host, "recipes4children.homestead.com")
+|| dnsDomainIs(host, "redsox.com")
+|| dnsDomainIs(host, "renaissance.district96.k12.il.us")
+|| dnsDomainIs(host, "rhyme.lycos.com")
+|| dnsDomainIs(host, "rhythmweb.com")
+|| dnsDomainIs(host, "riverresource.com")
+|| dnsDomainIs(host, "rockhoundingar.com")
+|| dnsDomainIs(host, "rockies.mlb.com")
+|| dnsDomainIs(host, "rosecity.net")
+|| dnsDomainIs(host, "rr-vs.informatik.uni-ulm.de")
+|| dnsDomainIs(host, "rubens.anu.edu.au")
+|| dnsDomainIs(host, "rummelplatz.uni-mannheim.de")
+|| dnsDomainIs(host, "sandbox.xerox.com")
+|| dnsDomainIs(host, "sarah.fredart.com")
+|| dnsDomainIs(host, "schmidel.com")
+|| dnsDomainIs(host, "scholastic.com")
+|| dnsDomainIs(host, "school.discovery.com")
+|| dnsDomainIs(host, "schoolcentral.com")
+|| dnsDomainIs(host, "seattletimes.nwsource.com")
+|| dnsDomainIs(host, "sericulum.com")
+|| dnsDomainIs(host, "sf.airforce.com")
+|| dnsDomainIs(host, "shop.usps.com")
+|| dnsDomainIs(host, "showcase.netins.net")
+|| dnsDomainIs(host, "sikids.com")
+|| dnsDomainIs(host, "sites.huji.ac.il")
+|| dnsDomainIs(host, "sjliving.com")
+|| dnsDomainIs(host, "skullduggery.com")
+|| dnsDomainIs(host, "skyways.lib.ks.us")
+|| dnsDomainIs(host, "snowdaymovie.nick.com")
+|| dnsDomainIs(host, "sosa21.hypermart.net")
+|| dnsDomainIs(host, "soundamerica.com")
+|| dnsDomainIs(host, "spaceboy.nasda.go.jp")
+|| dnsDomainIs(host, "sports.nfl.com")
+|| dnsDomainIs(host, "sportsillustrated.cnn.com")
+|| dnsDomainIs(host, "starwars.hasbro.com")
+|| dnsDomainIs(host, "statelibrary.dcr.state.nc.us")
+|| dnsDomainIs(host, "streetplay.com")
+|| dnsDomainIs(host, "sts.gsc.nrcan.gc.ca")
+|| dnsDomainIs(host, "sunniebunniezz.com")
+|| dnsDomainIs(host, "sunsite.nus.edu.sg")
+|| dnsDomainIs(host, "sunsite.sut.ac.jp")
+|| dnsDomainIs(host, "superm.bart.nl")
+|| dnsDomainIs(host, "surf.to")
+|| dnsDomainIs(host, "svinet2.fs.fed.us")
+|| dnsDomainIs(host, "swiminfo.com")
+|| dnsDomainIs(host, "tabletennis.about.com")
+|| dnsDomainIs(host, "teacher.scholastic.com")
+|| dnsDomainIs(host, "theforce.net")
+|| dnsDomainIs(host, "thejessicas.homestead.com")
+|| dnsDomainIs(host, "themes.editthispage.com")
+|| dnsDomainIs(host, "theory.uwinnipeg.ca")
+|| dnsDomainIs(host, "theshadowlands.net")
+|| dnsDomainIs(host, "thinks.com")
+|| dnsDomainIs(host, "thryomanes.tripod.com")
+|| dnsDomainIs(host, "time_zone.tripod.com")
+|| dnsDomainIs(host, "titania.cobuild.collins.co.uk")
+|| dnsDomainIs(host, "torre.duomo.pisa.it")
+|| dnsDomainIs(host, "touregypt.net")
+|| dnsDomainIs(host, "toycollecting.about.com")
+|| dnsDomainIs(host, "trace.ntu.ac.uk")
+|| dnsDomainIs(host, "travelwithkids.about.com")
+|| dnsDomainIs(host, "tukids.tucows.com")
+|| dnsDomainIs(host, "tv.yahoo.com")
+|| dnsDomainIs(host, "tycho.usno.navy.mil")
+|| dnsDomainIs(host, "ubl.artistdirect.com")
+|| dnsDomainIs(host, "uk-pages.net")
+|| dnsDomainIs(host, "ukraine.uazone.net")
+|| dnsDomainIs(host, "unmuseum.mus.pa.us")
+|| dnsDomainIs(host, "us.imdb.com")
+|| dnsDomainIs(host, "userpage.chemie.fu-berlin.de")
+|| dnsDomainIs(host, "userpage.fu-berlin.de")
+|| dnsDomainIs(host, "userpages.aug.com")
+|| dnsDomainIs(host, "users.aol.com")
+|| dnsDomainIs(host, "users.bigpond.net.au")
+|| dnsDomainIs(host, "users.breathemail.net")
+|| dnsDomainIs(host, "users.erols.com")
+|| dnsDomainIs(host, "users.imag.net")
+|| dnsDomainIs(host, "users.inetw.net")
+|| dnsDomainIs(host, "users.massed.net")
+|| dnsDomainIs(host, "users.skynet.be")
+|| dnsDomainIs(host, "users.uniserve.com")
+|| dnsDomainIs(host, "venus.spaceports.com")
+|| dnsDomainIs(host, "vgstrategies.about.com")
+|| dnsDomainIs(host, "victorian.fortunecity.com")
+|| dnsDomainIs(host, "vilenski.com")
+|| dnsDomainIs(host, "village.infoweb.ne.jp")
+|| dnsDomainIs(host, "virtual.finland.fi")
+|| dnsDomainIs(host, "vrml.fornax.hu")
+|| dnsDomainIs(host, "vvv.com")
+|| dnsDomainIs(host, "w1.xrefer.com")
+|| dnsDomainIs(host, "w3.one.net")
+|| dnsDomainIs(host, "w3.rz-berlin.mpg.de")
+|| dnsDomainIs(host, "w3.trib.com")
+|| dnsDomainIs(host, "wallofsound.go.com")
+|| dnsDomainIs(host, "web.aimnet.com")
+|| dnsDomainIs(host, "web.ccsd.k12.wy.us")
+|| dnsDomainIs(host, "web.cs.ualberta.ca")
+|| dnsDomainIs(host, "web.idirect.com")
+|| dnsDomainIs(host, "web.kyoto-inet.or.jp")
+|| dnsDomainIs(host, "web.macam98.ac.il")
+|| dnsDomainIs(host, "web.massvacation.com")
+|| dnsDomainIs(host, "web.one.net.au")
+|| dnsDomainIs(host, "web.qx.net")
+|| dnsDomainIs(host, "web.uvic.ca")
+|| dnsDomainIs(host, "web2.airmail.net")
+|| dnsDomainIs(host, "webcoast.com")
+|| dnsDomainIs(host, "webgames.kalisto.com")
+|| dnsDomainIs(host, "webhome.idirect.com")
+|| dnsDomainIs(host, "webpages.homestead.com")
+|| dnsDomainIs(host, "webrum.uni-mannheim.de")
+|| dnsDomainIs(host, "webusers.anet-stl.com")
+|| dnsDomainIs(host, "welcome.to")
+|| dnsDomainIs(host, "wgntv.com")
+|| dnsDomainIs(host, "whales.magna.com.au")
+|| dnsDomainIs(host, "wildheart.com")
+|| dnsDomainIs(host, "wilstar.net")
+|| dnsDomainIs(host, "winter-wonderland.com")
+|| dnsDomainIs(host, "women.com")
+|| dnsDomainIs(host, "woodrow.mpls.frb.fed.us")
+|| dnsDomainIs(host, "wordzap.com")
+|| dnsDomainIs(host, "worldkids.net")
+|| dnsDomainIs(host, "worldwideguide.net")
+|| dnsDomainIs(host, "ww3.bay.k12.fl.us")
+|| dnsDomainIs(host, "ww3.sportsline.com")
+|| dnsDomainIs(host, "www-groups.dcs.st-and.ac.uk")
+|| dnsDomainIs(host, "www-public.rz.uni-duesseldorf.de")
+|| dnsDomainIs(host, "www.1stkids.com")
+|| dnsDomainIs(host, "www.2020tech.com")
+|| dnsDomainIs(host, "www.21stcenturytoys.com")
+|| dnsDomainIs(host, "www.4adventure.com")
+|| dnsDomainIs(host, "www.50states.com")
+|| dnsDomainIs(host, "www.800padutch.com")
+|| dnsDomainIs(host, "www.88.com")
+|| dnsDomainIs(host, "www.a-better.com")
+|| dnsDomainIs(host, "www.aaa.com.au")
+|| dnsDomainIs(host, "www.aacca.com")
+|| dnsDomainIs(host, "www.aalbc.com")
+|| dnsDomainIs(host, "www.aardman.com")
+|| dnsDomainIs(host, "www.aardvarkelectric.com")
+|| dnsDomainIs(host, "www.aawc.com")
+|| dnsDomainIs(host, "www.ababmx.com")
+|| dnsDomainIs(host, "www.abbeville.com")
+|| dnsDomainIs(host, "www.abc.net.au")
+|| dnsDomainIs(host, "www.abcb.com")
+|| dnsDomainIs(host, "www.abctooncenter.com")
+|| dnsDomainIs(host, "www.about.ch")
+|| dnsDomainIs(host, "www.accessart.org.uk")
+|| dnsDomainIs(host, "www.accu.or.jp")
+|| dnsDomainIs(host, "www.accuweather.com")
+|| dnsDomainIs(host, "www.achuka.co.uk")
+|| dnsDomainIs(host, "www.acmecity.com")
+|| dnsDomainIs(host, "www.acorn-group.com")
+|| dnsDomainIs(host, "www.acs.ucalgary.ca")
+|| dnsDomainIs(host, "www.actden.com")
+|| dnsDomainIs(host, "www.actionplanet.com")
+|| dnsDomainIs(host, "www.activityvillage.co.uk")
+|| dnsDomainIs(host, "www.actwin.com")
+|| dnsDomainIs(host, "www.adequate.com")
+|| dnsDomainIs(host, "www.adidas.com")
+|| dnsDomainIs(host, "www.advent-calendars.com")
+|| dnsDomainIs(host, "www.aegis.com")
+|| dnsDomainIs(host, "www.af.mil")
+|| dnsDomainIs(host, "www.africaindex.africainfo.no")
+|| dnsDomainIs(host, "www.africam.com")
+|| dnsDomainIs(host, "www.africancrafts.com")
+|| dnsDomainIs(host, "www.aggressive.com")
+|| dnsDomainIs(host, "www.aghines.com")
+|| dnsDomainIs(host, "www.agirlsworld.com")
+|| dnsDomainIs(host, "www.agora.stm.it")
+|| dnsDomainIs(host, "www.agriculture.com")
+|| dnsDomainIs(host, "www.aikidofaq.com")
+|| dnsDomainIs(host, "www.ajkids.com")
+|| dnsDomainIs(host, "www.akfkoala.gil.com.au")
+|| dnsDomainIs(host, "www.akhlah.com")
+|| dnsDomainIs(host, "www.alabamainfo.com")
+|| dnsDomainIs(host, "www.aland.fi")
+|| dnsDomainIs(host, "www.albion.com")
+|| dnsDomainIs(host, "www.alcoholismhelp.com")
+|| dnsDomainIs(host, "www.alcottweb.com")
+|| dnsDomainIs(host, "www.alfanet.it")
+|| dnsDomainIs(host, "www.alfy.com")
+|| dnsDomainIs(host, "www.algebra-online.com")
+|| dnsDomainIs(host, "www.alienexplorer.com")
+|| dnsDomainIs(host, "www.aliensatschool.com")
+|| dnsDomainIs(host, "www.all-links.com")
+|| dnsDomainIs(host, "www.alldetroit.com")
+|| dnsDomainIs(host, "www.allexperts.com")
+|| dnsDomainIs(host, "www.allmixedup.com")
+|| dnsDomainIs(host, "www.allmusic.com")
+|| dnsDomainIs(host, "www.almanac.com")
+|| dnsDomainIs(host, "www.almaz.com")
+|| dnsDomainIs(host, "www.almondseed.com")
+|| dnsDomainIs(host, "www.aloha.com")
+|| dnsDomainIs(host, "www.aloha.net")
+|| dnsDomainIs(host, "www.altonweb.com")
+|| dnsDomainIs(host, "www.alyeska-pipe.com")
+|| dnsDomainIs(host, "www.am-wood.com")
+|| dnsDomainIs(host, "www.amazingadventure.com")
+|| dnsDomainIs(host, "www.amazon.com")
+|| dnsDomainIs(host, "www.americancheerleader.com")
+|| dnsDomainIs(host, "www.americancowboy.com")
+|| dnsDomainIs(host, "www.americangirl.com")
+|| dnsDomainIs(host, "www.americanparknetwork.com")
+|| dnsDomainIs(host, "www.americansouthwest.net")
+|| dnsDomainIs(host, "www.americanwest.com")
+|| dnsDomainIs(host, "www.ameritech.net")
+|| dnsDomainIs(host, "www.amtexpo.com")
+|| dnsDomainIs(host, "www.anbg.gov.au")
+|| dnsDomainIs(host, "www.anc.org.za")
+|| dnsDomainIs(host, "www.ancientegypt.co.uk")
+|| dnsDomainIs(host, "www.angelfire.com")
+|| dnsDomainIs(host, "www.angelsbaseball.com")
+|| dnsDomainIs(host, "www.anholt.co.uk")
+|| dnsDomainIs(host, "www.animabets.com")
+|| dnsDomainIs(host, "www.animalnetwork.com")
+|| dnsDomainIs(host, "www.animalpicturesarchive.com")
+|| dnsDomainIs(host, "www.anime-genesis.com")
+|| dnsDomainIs(host, "www.annefrank.com")
+|| dnsDomainIs(host, "www.annefrank.nl")
+|| dnsDomainIs(host, "www.annie75.com")
+|| dnsDomainIs(host, "www.antbee.com")
+|| dnsDomainIs(host, "www.antiquetools.com")
+|| dnsDomainIs(host, "www.antiquetoy.com")
+|| dnsDomainIs(host, "www.anzsbeg.org.au")
+|| dnsDomainIs(host, "www.aol.com")
+|| dnsDomainIs(host, "www.aone.com")
+|| dnsDomainIs(host, "www.aphids.com")
+|| dnsDomainIs(host, "www.apl.com")
+|| dnsDomainIs(host, "www.aplusmath.com")
+|| dnsDomainIs(host, "www.applebookshop.co.uk")
+|| dnsDomainIs(host, "www.appropriatesoftware.com")
+|| dnsDomainIs(host, "www.appukids.com")
+|| dnsDomainIs(host, "www.april-joy.com")
+|| dnsDomainIs(host, "www.arab.net")
+|| dnsDomainIs(host, "www.aracnet.com")
+|| dnsDomainIs(host, "www.arborday.com")
+|| dnsDomainIs(host, "www.arcadevillage.com")
+|| dnsDomainIs(host, "www.archiecomics.com")
+|| dnsDomainIs(host, "www.archives.state.al.us")
+|| dnsDomainIs(host, "www.arctic.ca")
+|| dnsDomainIs(host, "www.ardenjohnson.com")
+|| dnsDomainIs(host, "www.aristotle.net")
+|| dnsDomainIs(host, "www.arizhwys.com")
+|| dnsDomainIs(host, "www.arizonaguide.com")
+|| dnsDomainIs(host, "www.arlingtoncemetery.com")
+|| dnsDomainIs(host, "www.armory.com")
+|| dnsDomainIs(host, "www.armwrestling.com")
+|| dnsDomainIs(host, "www.arnprior.com")
+|| dnsDomainIs(host, "www.artabunga.com")
+|| dnsDomainIs(host, "www.artcarte.com")
+|| dnsDomainIs(host, "www.artchive.com")
+|| dnsDomainIs(host, "www.artcontest.com")
+|| dnsDomainIs(host, "www.artcyclopedia.com")
+|| dnsDomainIs(host, "www.artisandevelopers.com")
+|| dnsDomainIs(host, "www.artlex.com")
+|| dnsDomainIs(host, "www.artsandkids.com")
+|| dnsDomainIs(host, "www.artyastro.com")
+|| dnsDomainIs(host, "www.arwhead.com")
+|| dnsDomainIs(host, "www.asahi-net.or.jp")
+|| dnsDomainIs(host, "www.asap.unimelb.edu.au")
+|| dnsDomainIs(host, "www.ascpl.lib.oh.us")
+|| dnsDomainIs(host, "www.asia-art.net")
+|| dnsDomainIs(host, "www.asiabigtime.com")
+|| dnsDomainIs(host, "www.asianart.com")
+|| dnsDomainIs(host, "www.asiatour.com")
+|| dnsDomainIs(host, "www.asiaweek.com")
+|| dnsDomainIs(host, "www.askanexpert.com")
+|| dnsDomainIs(host, "www.askbasil.com")
+|| dnsDomainIs(host, "www.assa.org.au")
+|| dnsDomainIs(host, "www.ast.cam.ac.uk")
+|| dnsDomainIs(host, "www.astronomy.com")
+|| dnsDomainIs(host, "www.astros.com")
+|| dnsDomainIs(host, "www.atek.com")
+|| dnsDomainIs(host, "www.athlete.com")
+|| dnsDomainIs(host, "www.athropolis.com")
+|| dnsDomainIs(host, "www.atkielski.com")
+|| dnsDomainIs(host, "www.atlantabraves.com")
+|| dnsDomainIs(host, "www.atlantafalcons.com")
+|| dnsDomainIs(host, "www.atlantathrashers.com")
+|| dnsDomainIs(host, "www.atlanticus.com")
+|| dnsDomainIs(host, "www.atm.ch.cam.ac.uk")
+|| dnsDomainIs(host, "www.atom.co.jp")
+|| dnsDomainIs(host, "www.atomicarchive.com")
+|| dnsDomainIs(host, "www.att.com")
+|| dnsDomainIs(host, "www.audreywood.com")
+|| dnsDomainIs(host, "www.auntannie.com")
+|| dnsDomainIs(host, "www.auntie.com")
+|| dnsDomainIs(host, "www.avi-writer.com")
+|| dnsDomainIs(host, "www.awesomeclipartforkids.com")
+|| dnsDomainIs(host, "www.awhitehorse.com")
+|| dnsDomainIs(host, "www.axess.com")
+|| dnsDomainIs(host, "www.ayles.com")
+|| dnsDomainIs(host, "www.ayn.ca")
+|| dnsDomainIs(host, "www.azcardinals.com")
+|| dnsDomainIs(host, "www.azdiamondbacks.com")
+|| dnsDomainIs(host, "www.azsolarcenter.com")
+|| dnsDomainIs(host, "www.azstarnet.com")
+|| dnsDomainIs(host, "www.aztecafoods.com")
+|| dnsDomainIs(host, "www.b-witched.com")
+|| dnsDomainIs(host, "www.baberuthmuseum.com")
+|| dnsDomainIs(host, "www.backstreetboys.com")
+|| dnsDomainIs(host, "www.bagheera.com")
+|| dnsDomainIs(host, "www.bahamas.com")
+|| dnsDomainIs(host, "www.baileykids.com")
+|| dnsDomainIs(host, "www.baldeagleinfo.com")
+|| dnsDomainIs(host, "www.balloonhq.com")
+|| dnsDomainIs(host, "www.balloonzone.com")
+|| dnsDomainIs(host, "www.ballparks.com")
+|| dnsDomainIs(host, "www.balmoralsoftware.com")
+|| dnsDomainIs(host, "www.banja.com")
+|| dnsDomainIs(host, "www.banph.com")
+|| dnsDomainIs(host, "www.barbie.com")
+|| dnsDomainIs(host, "www.barkingbuddies.com")
+|| dnsDomainIs(host, "www.barnsdle.demon.co.uk")
+|| dnsDomainIs(host, "www.barrysclipart.com")
+|| dnsDomainIs(host, "www.bartleby.com")
+|| dnsDomainIs(host, "www.baseplate.com")
+|| dnsDomainIs(host, "www.batman-superman.com")
+|| dnsDomainIs(host, "www.batmanbeyond.com")
+|| dnsDomainIs(host, "www.bbc.co.uk")
+|| dnsDomainIs(host, "www.bbhighway.com")
+|| dnsDomainIs(host, "www.bboy.com")
+|| dnsDomainIs(host, "www.bcit.tec.nj.us")
+|| dnsDomainIs(host, "www.bconnex.net")
+|| dnsDomainIs(host, "www.bcpl.net")
+|| dnsDomainIs(host, "www.beach-net.com")
+|| dnsDomainIs(host, "www.beachboys.com")
+|| dnsDomainIs(host, "www.beakman.com")
+|| dnsDomainIs(host, "www.beano.co.uk")
+|| dnsDomainIs(host, "www.beans.demon.co.uk")
+|| dnsDomainIs(host, "www.beartime.com")
+|| dnsDomainIs(host, "www.bearyspecial.co.uk")
+|| dnsDomainIs(host, "www.bedtime.com")
+|| dnsDomainIs(host, "www.beingme.com")
+|| dnsDomainIs(host, "www.belizeexplorer.com")
+|| dnsDomainIs(host, "www.bell-labs.com")
+|| dnsDomainIs(host, "www.bemorecreative.com")
+|| dnsDomainIs(host, "www.bengals.com")
+|| dnsDomainIs(host, "www.benjerry.com")
+|| dnsDomainIs(host, "www.bennygoodsport.com")
+|| dnsDomainIs(host, "www.berenstainbears.com")
+|| dnsDomainIs(host, "www.beringia.com")
+|| dnsDomainIs(host, "www.beritsbest.com")
+|| dnsDomainIs(host, "www.berksweb.com")
+|| dnsDomainIs(host, "www.best.com")
+|| dnsDomainIs(host, "www.betsybyars.com")
+|| dnsDomainIs(host, "www.bfro.net")
+|| dnsDomainIs(host, "www.bgmm.com")
+|| dnsDomainIs(host, "www.bibliography.com")
+|| dnsDomainIs(host, "www.bigblue.com.au")
+|| dnsDomainIs(host, "www.bigchalk.com")
+|| dnsDomainIs(host, "www.bigidea.com")
+|| dnsDomainIs(host, "www.bigtop.com")
+|| dnsDomainIs(host, "www.bikecrawler.com")
+|| dnsDomainIs(host, "www.billboard.com")
+|| dnsDomainIs(host, "www.billybear4kids.com")
+|| dnsDomainIs(host, "www.biography.com")
+|| dnsDomainIs(host, "www.birdnature.com")
+|| dnsDomainIs(host, "www.birdsnways.com")
+|| dnsDomainIs(host, "www.birdtimes.com")
+|| dnsDomainIs(host, "www.birminghamzoo.com")
+|| dnsDomainIs(host, "www.birthdaypartyideas.com")
+|| dnsDomainIs(host, "www.bis.arachsys.com")
+|| dnsDomainIs(host, "www.bkgm.com")
+|| dnsDomainIs(host, "www.blackbaseball.com")
+|| dnsDomainIs(host, "www.blackbeardthepirate.com")
+|| dnsDomainIs(host, "www.blackbeltmag.com")
+|| dnsDomainIs(host, "www.blackfacts.com")
+|| dnsDomainIs(host, "www.blackfeetnation.com")
+|| dnsDomainIs(host, "www.blackhills-info.com")
+|| dnsDomainIs(host, "www.blackholegang.com")
+|| dnsDomainIs(host, "www.blaque.net")
+|| dnsDomainIs(host, "www.blarg.net")
+|| dnsDomainIs(host, "www.blasternaut.com")
+|| dnsDomainIs(host, "www.blizzard.com")
+|| dnsDomainIs(host, "www.blocksite.com")
+|| dnsDomainIs(host, "www.bluejackets.com")
+|| dnsDomainIs(host, "www.bluejays.ca")
+|| dnsDomainIs(host, "www.bluemountain.com")
+|| dnsDomainIs(host, "www.blupete.com")
+|| dnsDomainIs(host, "www.blyton.co.uk")
+|| dnsDomainIs(host, "www.boatnerd.com")
+|| dnsDomainIs(host, "www.boatsafe.com")
+|| dnsDomainIs(host, "www.bonus.com")
+|| dnsDomainIs(host, "www.boowakwala.com")
+|| dnsDomainIs(host, "www.bostonbruins.com")
+|| dnsDomainIs(host, "www.braceface.com")
+|| dnsDomainIs(host, "www.bracesinfo.com")
+|| dnsDomainIs(host, "www.bradkent.com")
+|| dnsDomainIs(host, "www.brainium.com")
+|| dnsDomainIs(host, "www.brainmania.com")
+|| dnsDomainIs(host, "www.brainpop.com")
+|| dnsDomainIs(host, "www.bridalcave.com")
+|| dnsDomainIs(host, "www.brightmoments.com")
+|| dnsDomainIs(host, "www.britannia.com")
+|| dnsDomainIs(host, "www.britannica.com")
+|| dnsDomainIs(host, "www.british-museum.ac.uk")
+|| dnsDomainIs(host, "www.brookes.ac.uk")
+|| dnsDomainIs(host, "www.brookfieldreader.com")
+|| dnsDomainIs(host, "www.btinternet.com")
+|| dnsDomainIs(host, "www.bubbledome.co.nz")
+|| dnsDomainIs(host, "www.buccaneers.com")
+|| dnsDomainIs(host, "www.buffy.com")
+|| dnsDomainIs(host, "www.bullying.co.uk")
+|| dnsDomainIs(host, "www.bumply.com")
+|| dnsDomainIs(host, "www.bungi.com")
+|| dnsDomainIs(host, "www.burlco.lib.nj.us")
+|| dnsDomainIs(host, "www.burlingamepezmuseum.com")
+|| dnsDomainIs(host, "www.bus.ualberta.ca")
+|| dnsDomainIs(host, "www.busprod.com")
+|| dnsDomainIs(host, "www.butlerart.com")
+|| dnsDomainIs(host, "www.butterflies.com")
+|| dnsDomainIs(host, "www.butterflyfarm.co.cr")
+|| dnsDomainIs(host, "www.bway.net")
+|| dnsDomainIs(host, "www.bydonovan.com")
+|| dnsDomainIs(host, "www.ca-mall.com")
+|| dnsDomainIs(host, "www.cabinessence.com")
+|| dnsDomainIs(host, "www.cablecarmuseum.com")
+|| dnsDomainIs(host, "www.cadbury.co.uk")
+|| dnsDomainIs(host, "www.calendarzone.com")
+|| dnsDomainIs(host, "www.calgaryflames.com")
+|| dnsDomainIs(host, "www.californiamissions.com")
+|| dnsDomainIs(host, "www.camalott.com")
+|| dnsDomainIs(host, "www.camelotintl.com")
+|| dnsDomainIs(host, "www.campbellsoup.com")
+|| dnsDomainIs(host, "www.camvista.com")
+|| dnsDomainIs(host, "www.canadiens.com")
+|| dnsDomainIs(host, "www.canals.state.ny.us")
+|| dnsDomainIs(host, "www.candlelightstories.com")
+|| dnsDomainIs(host, "www.candles-museum.com")
+|| dnsDomainIs(host, "www.candystand.com")
+|| dnsDomainIs(host, "www.caneshockey.com")
+|| dnsDomainIs(host, "www.canismajor.com")
+|| dnsDomainIs(host, "www.canucks.com")
+|| dnsDomainIs(host, "www.capecod.net")
+|| dnsDomainIs(host, "www.capital.net")
+|| dnsDomainIs(host, "www.capstonestudio.com")
+|| dnsDomainIs(host, "www.cardblvd.com")
+|| dnsDomainIs(host, "www.caro.net")
+|| dnsDomainIs(host, "www.carolhurst.com")
+|| dnsDomainIs(host, "www.carr.lib.md.us")
+|| dnsDomainIs(host, "www.cartooncorner.com")
+|| dnsDomainIs(host, "www.cartooncritters.com")
+|| dnsDomainIs(host, "www.cartoonnetwork.com")
+|| dnsDomainIs(host, "www.carvingpatterns.com")
+|| dnsDomainIs(host, "www.cashuniversity.com")
+|| dnsDomainIs(host, "www.castles-of-britain.com")
+|| dnsDomainIs(host, "www.castlewales.com")
+|| dnsDomainIs(host, "www.catholic-forum.com")
+|| dnsDomainIs(host, "www.catholic.net")
+|| dnsDomainIs(host, "www.cattle.guelph.on.ca")
+|| dnsDomainIs(host, "www.cavedive.com")
+|| dnsDomainIs(host, "www.caveofthewinds.com")
+|| dnsDomainIs(host, "www.cbc4kids.ca")
+|| dnsDomainIs(host, "www.ccer.ggl.ruu.nl")
+|| dnsDomainIs(host, "www.ccnet.com")
+|| dnsDomainIs(host, "www.celineonline.com")
+|| dnsDomainIs(host, "www.cellsalive.com")
+|| dnsDomainIs(host, "www.centuryinshoes.com")
+|| dnsDomainIs(host, "www.cfl.ca")
+|| dnsDomainIs(host, "www.channel4.com")
+|| dnsDomainIs(host, "www.channel8.net")
+|| dnsDomainIs(host, "www.chanukah99.com")
+|| dnsDomainIs(host, "www.charged.com")
+|| dnsDomainIs(host, "www.chargers.com")
+|| dnsDomainIs(host, "www.charlotte.com")
+|| dnsDomainIs(host, "www.chaseday.com")
+|| dnsDomainIs(host, "www.chateauversailles.fr")
+|| dnsDomainIs(host, "www.cheatcc.com")
+|| dnsDomainIs(host, "www.cheerleading.net")
+|| dnsDomainIs(host, "www.cheese.com")
+|| dnsDomainIs(host, "www.chem4kids.com")
+|| dnsDomainIs(host, "www.chemicool.com")
+|| dnsDomainIs(host, "www.cherbearsden.com")
+|| dnsDomainIs(host, "www.chesskids.com")
+|| dnsDomainIs(host, "www.chessvariants.com")
+|| dnsDomainIs(host, "www.cheungswingchun.com")
+|| dnsDomainIs(host, "www.chevroncars.com")
+|| dnsDomainIs(host, "www.chibi.simplenet.com")
+|| dnsDomainIs(host, "www.chicagobears.com")
+|| dnsDomainIs(host, "www.chicagoblackhawks.com")
+|| dnsDomainIs(host, "www.chickasaw.net")
+|| dnsDomainIs(host, "www.childrensmusic.co.uk")
+|| dnsDomainIs(host, "www.childrenssoftware.com")
+|| dnsDomainIs(host, "www.childrenstory.com")
+|| dnsDomainIs(host, "www.childrenwithdiabetes.com")
+|| dnsDomainIs(host, "www.chinapage.com")
+|| dnsDomainIs(host, "www.chinatoday.com")
+|| dnsDomainIs(host, "www.chinavista.com")
+|| dnsDomainIs(host, "www.chinnet.net")
+|| dnsDomainIs(host, "www.chiquita.com")
+|| dnsDomainIs(host, "www.chisox.com")
+|| dnsDomainIs(host, "www.chivalry.com")
+|| dnsDomainIs(host, "www.christiananswers.net")
+|| dnsDomainIs(host, "www.christianity.com")
+|| dnsDomainIs(host, "www.christmas.com")
+|| dnsDomainIs(host, "www.christmas98.com")
+|| dnsDomainIs(host, "www.chron.com")
+|| dnsDomainIs(host, "www.chronique.com")
+|| dnsDomainIs(host, "www.chuckecheese.com")
+|| dnsDomainIs(host, "www.chucklebait.com")
+|| dnsDomainIs(host, "www.chunkymonkey.com")
+|| dnsDomainIs(host, "www.ci.chi.il.us")
+|| dnsDomainIs(host, "www.ci.nyc.ny.us")
+|| dnsDomainIs(host, "www.ci.phoenix.az.us")
+|| dnsDomainIs(host, "www.ci.san-diego.ca.us")
+|| dnsDomainIs(host, "www.cibc.com")
+|| dnsDomainIs(host, "www.ciderpresspottery.com")
+|| dnsDomainIs(host, "www.cincinnatireds.com")
+|| dnsDomainIs(host, "www.circusparade.com")
+|| dnsDomainIs(host, "www.circusweb.com")
+|| dnsDomainIs(host, "www.cirquedusoleil.com")
+|| dnsDomainIs(host, "www.cit.state.vt.us")
+|| dnsDomainIs(host, "www.citycastles.com")
+|| dnsDomainIs(host, "www.cityu.edu.hk")
+|| dnsDomainIs(host, "www.civicmind.com")
+|| dnsDomainIs(host, "www.civil-war.net")
+|| dnsDomainIs(host, "www.civilization.ca")
+|| dnsDomainIs(host, "www.cl.cam.ac.uk")
+|| dnsDomainIs(host, "www.clantongang.com")
+|| dnsDomainIs(host, "www.clark.net")
+|| dnsDomainIs(host, "www.classicgaming.com")
+|| dnsDomainIs(host, "www.claus.com")
+|| dnsDomainIs(host, "www.clayz.com")
+|| dnsDomainIs(host, "www.clearcf.uvic.ca")
+|| dnsDomainIs(host, "www.clearlight.com")
+|| dnsDomainIs(host, "www.clemusart.com")
+|| dnsDomainIs(host, "www.clevelandbrowns.com")
+|| dnsDomainIs(host, "www.clipartcastle.com")
+|| dnsDomainIs(host, "www.clubi.ie")
+|| dnsDomainIs(host, "www.cnn.com")
+|| dnsDomainIs(host, "www.co.henrico.va.us")
+|| dnsDomainIs(host, "www.coax.net")
+|| dnsDomainIs(host, "www.cocacola.com")
+|| dnsDomainIs(host, "www.cocori.com")
+|| dnsDomainIs(host, "www.codesmiths.com")
+|| dnsDomainIs(host, "www.codetalk.fed.us")
+|| dnsDomainIs(host, "www.coin-gallery.com")
+|| dnsDomainIs(host, "www.colinthompson.com")
+|| dnsDomainIs(host, "www.collectoronline.com")
+|| dnsDomainIs(host, "www.colonialhall.com")
+|| dnsDomainIs(host, "www.coloradoavalanche.com")
+|| dnsDomainIs(host, "www.coloradorockies.com")
+|| dnsDomainIs(host, "www.colormathpink.com")
+|| dnsDomainIs(host, "www.colts.com")
+|| dnsDomainIs(host, "www.comet.net")
+|| dnsDomainIs(host, "www.cometsystems.com")
+|| dnsDomainIs(host, "www.comicbookresources.com")
+|| dnsDomainIs(host, "www.comicspage.com")
+|| dnsDomainIs(host, "www.compassnet.com")
+|| dnsDomainIs(host, "www.compleatbellairs.com")
+|| dnsDomainIs(host, "www.comptons.com")
+|| dnsDomainIs(host, "www.concentric.net")
+|| dnsDomainIs(host, "www.congogorillaforest.com")
+|| dnsDomainIs(host, "www.conjuror.com")
+|| dnsDomainIs(host, "www.conk.com")
+|| dnsDomainIs(host, "www.conservation.state.mo.us")
+|| dnsDomainIs(host, "www.contracostatimes.com")
+|| dnsDomainIs(host, "www.control.chalmers.se")
+|| dnsDomainIs(host, "www.cookierecipe.com")
+|| dnsDomainIs(host, "www.cooljapanesetoys.com")
+|| dnsDomainIs(host, "www.cooper.com")
+|| dnsDomainIs(host, "www.corpcomm.net")
+|| dnsDomainIs(host, "www.corrietenboom.com")
+|| dnsDomainIs(host, "www.corynet.com")
+|| dnsDomainIs(host, "www.corypaints.com")
+|| dnsDomainIs(host, "www.cosmosmith.com")
+|| dnsDomainIs(host, "www.countdown2000.com")
+|| dnsDomainIs(host, "www.cowboy.net")
+|| dnsDomainIs(host, "www.cowboypal.com")
+|| dnsDomainIs(host, "www.cowcreek.com")
+|| dnsDomainIs(host, "www.cowgirl.net")
+|| dnsDomainIs(host, "www.cowgirls.com")
+|| dnsDomainIs(host, "www.cp.duluth.mn.us")
+|| dnsDomainIs(host, "www.cpsweb.com")
+|| dnsDomainIs(host, "www.craftideas.com")
+|| dnsDomainIs(host, "www.craniamania.com")
+|| dnsDomainIs(host, "www.crater.lake.national-park.com")
+|| dnsDomainIs(host, "www.crayoncrawler.com")
+|| dnsDomainIs(host, "www.crazybone.com")
+|| dnsDomainIs(host, "www.crazybones.com")
+|| dnsDomainIs(host, "www.crd.ge.com")
+|| dnsDomainIs(host, "www.create4kids.com")
+|| dnsDomainIs(host, "www.creativemusic.com")
+|| dnsDomainIs(host, "www.crocodilian.com")
+|| dnsDomainIs(host, "www.crop.cri.nz")
+|| dnsDomainIs(host, "www.cruzio.com")
+|| dnsDomainIs(host, "www.crwflags.com")
+|| dnsDomainIs(host, "www.cryptograph.com")
+|| dnsDomainIs(host, "www.cryst.bbk.ac.uk")
+|| dnsDomainIs(host, "www.cs.bilkent.edu.tr")
+|| dnsDomainIs(host, "www.cs.man.ac.uk")
+|| dnsDomainIs(host, "www.cs.sfu.ca")
+|| dnsDomainIs(host, "www.cs.ubc.ca")
+|| dnsDomainIs(host, "www.csd.uu.se")
+|| dnsDomainIs(host, "www.csmonitor.com")
+|| dnsDomainIs(host, "www.csse.monash.edu.au")
+|| dnsDomainIs(host, "www.cstone.net")
+|| dnsDomainIs(host, "www.csu.edu.au")
+|| dnsDomainIs(host, "www.cubs.com")
+|| dnsDomainIs(host, "www.culture.fr")
+|| dnsDomainIs(host, "www.cultures.com")
+|| dnsDomainIs(host, "www.curtis-collection.com")
+|| dnsDomainIs(host, "www.cut-the-knot.com")
+|| dnsDomainIs(host, "www.cws-scf.ec.gc.ca")
+|| dnsDomainIs(host, "www.cyber-dyne.com")
+|| dnsDomainIs(host, "www.cyberbee.com")
+|| dnsDomainIs(host, "www.cyberbee.net")
+|| dnsDomainIs(host, "www.cybercom.net")
+|| dnsDomainIs(host, "www.cybercomm.net")
+|| dnsDomainIs(host, "www.cybercomm.nl")
+|| dnsDomainIs(host, "www.cybercorp.co.nz")
+|| dnsDomainIs(host, "www.cybercs.com")
+|| dnsDomainIs(host, "www.cybergoal.com")
+|| dnsDomainIs(host, "www.cyberkids.com")
+|| dnsDomainIs(host, "www.cyberspaceag.com")
+|| dnsDomainIs(host, "www.cyberteens.com")
+|| dnsDomainIs(host, "www.cybertours.com")
+|| dnsDomainIs(host, "www.cybiko.com")
+|| dnsDomainIs(host, "www.czweb.com")
+|| dnsDomainIs(host, "www.d91.k12.id.us")
+|| dnsDomainIs(host, "www.dailygrammar.com")
+|| dnsDomainIs(host, "www.dakidz.com")
+|| dnsDomainIs(host, "www.dalejarrettonline.com")
+|| dnsDomainIs(host, "www.dallascowboys.com")
+|| dnsDomainIs(host, "www.dallasdogndisc.com")
+|| dnsDomainIs(host, "www.dallasstars.com")
+|| dnsDomainIs(host, "www.damnyankees.com")
+|| dnsDomainIs(host, "www.danceart.com")
+|| dnsDomainIs(host, "www.daniellesplace.com")
+|| dnsDomainIs(host, "www.dare-america.com")
+|| dnsDomainIs(host, "www.darkfish.com")
+|| dnsDomainIs(host, "www.darsbydesign.com")
+|| dnsDomainIs(host, "www.datadragon.com")
+|| dnsDomainIs(host, "www.davidreilly.com")
+|| dnsDomainIs(host, "www.dccomics.com")
+|| dnsDomainIs(host, "www.dcn.davis.ca.us")
+|| dnsDomainIs(host, "www.deepseaworld.com")
+|| dnsDomainIs(host, "www.delawaretribeofindians.nsn.us")
+|| dnsDomainIs(host, "www.demon.co.uk")
+|| dnsDomainIs(host, "www.denverbroncos.com")
+|| dnsDomainIs(host, "www.denverpost.com")
+|| dnsDomainIs(host, "www.dep.state.pa.us")
+|| dnsDomainIs(host, "www.desert-fairy.com")
+|| dnsDomainIs(host, "www.desert-storm.com")
+|| dnsDomainIs(host, "www.desertusa.com")
+|| dnsDomainIs(host, "www.designltd.com")
+|| dnsDomainIs(host, "www.designsbykat.com")
+|| dnsDomainIs(host, "www.detnews.com")
+|| dnsDomainIs(host, "www.detroitlions.com")
+|| dnsDomainIs(host, "www.detroitredwings.com")
+|| dnsDomainIs(host, "www.detroittigers.com")
+|| dnsDomainIs(host, "www.deutsches-museum.de")
+|| dnsDomainIs(host, "www.devilray.com")
+|| dnsDomainIs(host, "www.dhorse.com")
+|| dnsDomainIs(host, "www.diana-ross.co.uk")
+|| dnsDomainIs(host, "www.dianarossandthesupremes.net")
+|| dnsDomainIs(host, "www.diaryproject.com")
+|| dnsDomainIs(host, "www.dickbutkus.com")
+|| dnsDomainIs(host, "www.dickshovel.com")
+|| dnsDomainIs(host, "www.dictionary.com")
+|| dnsDomainIs(host, "www.didyouknow.com")
+|| dnsDomainIs(host, "www.diegorivera.com")
+|| dnsDomainIs(host, "www.digitalcentury.com")
+|| dnsDomainIs(host, "www.digitaldog.com")
+|| dnsDomainIs(host, "www.digiweb.com")
+|| dnsDomainIs(host, "www.dimdima.com")
+|| dnsDomainIs(host, "www.dinodon.com")
+|| dnsDomainIs(host, "www.dinosauria.com")
+|| dnsDomainIs(host, "www.discovereso.com")
+|| dnsDomainIs(host, "www.discovergalapagos.com")
+|| dnsDomainIs(host, "www.discovergames.com")
+|| dnsDomainIs(host, "www.discoveringarchaeology.com")
+|| dnsDomainIs(host, "www.discoveringmontana.com")
+|| dnsDomainIs(host, "www.discoverlearning.com")
+|| dnsDomainIs(host, "www.discovery.com")
+|| dnsDomainIs(host, "www.disknet.com")
+|| dnsDomainIs(host, "www.disney.go.com")
+|| dnsDomainIs(host, "www.distinguishedwomen.com")
+|| dnsDomainIs(host, "www.dkonline.com")
+|| dnsDomainIs(host, "www.dltk-kids.com")
+|| dnsDomainIs(host, "www.dmgi.com")
+|| dnsDomainIs(host, "www.dnr.state.md.us")
+|| dnsDomainIs(host, "www.dnr.state.mi.us")
+|| dnsDomainIs(host, "www.dnr.state.wi.us")
+|| dnsDomainIs(host, "www.dodgers.com")
+|| dnsDomainIs(host, "www.dodoland.com")
+|| dnsDomainIs(host, "www.dog-play.com")
+|| dnsDomainIs(host, "www.dogbreedinfo.com")
+|| dnsDomainIs(host, "www.doginfomat.com")
+|| dnsDomainIs(host, "www.dole5aday.com")
+|| dnsDomainIs(host, "www.dollart.com")
+|| dnsDomainIs(host, "www.dolliedish.com")
+|| dnsDomainIs(host, "www.dome2000.co.uk")
+|| dnsDomainIs(host, "www.domtar.com")
+|| dnsDomainIs(host, "www.donegal.k12.pa.us")
+|| dnsDomainIs(host, "www.dorneypark.com")
+|| dnsDomainIs(host, "www.dorothyhinshawpatent.com")
+|| dnsDomainIs(host, "www.dougweb.com")
+|| dnsDomainIs(host, "www.dps.state.ak.us")
+|| dnsDomainIs(host, "www.draw3d.com")
+|| dnsDomainIs(host, "www.dreamgate.com")
+|| dnsDomainIs(host, "www.dreamkitty.com")
+|| dnsDomainIs(host, "www.dreamscape.com")
+|| dnsDomainIs(host, "www.dreamtime.net.au")
+|| dnsDomainIs(host, "www.drpeppermuseum.com")
+|| dnsDomainIs(host, "www.drscience.com")
+|| dnsDomainIs(host, "www.drseward.com")
+|| dnsDomainIs(host, "www.drtoy.com")
+|| dnsDomainIs(host, "www.dse.nl")
+|| dnsDomainIs(host, "www.dtic.mil")
+|| dnsDomainIs(host, "www.duracell.com")
+|| dnsDomainIs(host, "www.dustbunny.com")
+|| dnsDomainIs(host, "www.dynanet.com")
+|| dnsDomainIs(host, "www.eagerreaders.com")
+|| dnsDomainIs(host, "www.eaglekids.com")
+|| dnsDomainIs(host, "www.earthcalendar.net")
+|| dnsDomainIs(host, "www.earthday.net")
+|| dnsDomainIs(host, "www.earthdog.com")
+|| dnsDomainIs(host, "www.earthwatch.com")
+|| dnsDomainIs(host, "www.ease.com")
+|| dnsDomainIs(host, "www.eastasia.ws")
+|| dnsDomainIs(host, "www.easytype.com")
+|| dnsDomainIs(host, "www.eblewis.com")
+|| dnsDomainIs(host, "www.ebs.hw.ac.uk")
+|| dnsDomainIs(host, "www.eclipse.net")
+|| dnsDomainIs(host, "www.eco-pros.com")
+|| dnsDomainIs(host, "www.edbydesign.com")
+|| dnsDomainIs(host, "www.eddytheeco-dog.com")
+|| dnsDomainIs(host, "www.edgate.com")
+|| dnsDomainIs(host, "www.edmontonoilers.com")
+|| dnsDomainIs(host, "www.edu-source.com")
+|| dnsDomainIs(host, "www.edu.gov.on.ca")
+|| dnsDomainIs(host, "www.edu4kids.com")
+|| dnsDomainIs(host, "www.educ.uvic.ca")
+|| dnsDomainIs(host, "www.educate.org.uk")
+|| dnsDomainIs(host, "www.education-world.com")
+|| dnsDomainIs(host, "www.edunet.com")
+|| dnsDomainIs(host, "www.eduplace.com")
+|| dnsDomainIs(host, "www.edupuppy.com")
+|| dnsDomainIs(host, "www.eduweb.com")
+|| dnsDomainIs(host, "www.ee.ryerson.ca")
+|| dnsDomainIs(host, "www.ee.surrey.ac.uk")
+|| dnsDomainIs(host, "www.eeggs.com")
+|| dnsDomainIs(host, "www.efes.com")
+|| dnsDomainIs(host, "www.egalvao.com")
+|| dnsDomainIs(host, "www.egypt.com")
+|| dnsDomainIs(host, "www.egyptology.com")
+|| dnsDomainIs(host, "www.ehobbies.com")
+|| dnsDomainIs(host, "www.ehow.com")
+|| dnsDomainIs(host, "www.eia.brad.ac.uk")
+|| dnsDomainIs(host, "www.elbalero.gob.mx")
+|| dnsDomainIs(host, "www.eliki.com")
+|| dnsDomainIs(host, "www.elnino.com")
+|| dnsDomainIs(host, "www.elok.com")
+|| dnsDomainIs(host, "www.emf.net")
+|| dnsDomainIs(host, "www.emsphone.com")
+|| dnsDomainIs(host, "www.emulateme.com")
+|| dnsDomainIs(host, "www.en.com")
+|| dnsDomainIs(host, "www.enature.com")
+|| dnsDomainIs(host, "www.enchantedlearning.com")
+|| dnsDomainIs(host, "www.encyclopedia.com")
+|| dnsDomainIs(host, "www.endex.com")
+|| dnsDomainIs(host, "www.enjoyillinois.com")
+|| dnsDomainIs(host, "www.enn.com")
+|| dnsDomainIs(host, "www.enriqueig.com")
+|| dnsDomainIs(host, "www.enteract.com")
+|| dnsDomainIs(host, "www.epals.com")
+|| dnsDomainIs(host, "www.equine-world.co.uk")
+|| dnsDomainIs(host, "www.eric-carle.com")
+|| dnsDomainIs(host, "www.ericlindros.net")
+|| dnsDomainIs(host, "www.escape.com")
+|| dnsDomainIs(host, "www.eskimo.com")
+|| dnsDomainIs(host, "www.essentialsofmusic.com")
+|| dnsDomainIs(host, "www.etch-a-sketch.com")
+|| dnsDomainIs(host, "www.ethanallen.together.com")
+|| dnsDomainIs(host, "www.etoys.com")
+|| dnsDomainIs(host, "www.eurekascience.com")
+|| dnsDomainIs(host, "www.euronet.nl")
+|| dnsDomainIs(host, "www.everyrule.com")
+|| dnsDomainIs(host, "www.ex.ac.uk")
+|| dnsDomainIs(host, "www.excite.com")
+|| dnsDomainIs(host, "www.execpc.com")
+|| dnsDomainIs(host, "www.execulink.com")
+|| dnsDomainIs(host, "www.exn.net")
+|| dnsDomainIs(host, "www.expa.hvu.nl")
+|| dnsDomainIs(host, "www.expage.com")
+|| dnsDomainIs(host, "www.explode.to")
+|| dnsDomainIs(host, "www.explorescience.com")
+|| dnsDomainIs(host, "www.explorezone.com")
+|| dnsDomainIs(host, "www.extremescience.com")
+|| dnsDomainIs(host, "www.eyelid.co.uk")
+|| dnsDomainIs(host, "www.eyeneer.com")
+|| dnsDomainIs(host, "www.eyesofachild.com")
+|| dnsDomainIs(host, "www.eyesofglory.com")
+|| dnsDomainIs(host, "www.ezschool.com")
+|| dnsDomainIs(host, "www.f1-live.com")
+|| dnsDomainIs(host, "www.fables.co.uk")
+|| dnsDomainIs(host, "www.factmonster.com")
+|| dnsDomainIs(host, "www.fairygodmother.com")
+|| dnsDomainIs(host, "www.familybuzz.com")
+|| dnsDomainIs(host, "www.familygames.com")
+|| dnsDomainIs(host, "www.familygardening.com")
+|| dnsDomainIs(host, "www.familyinternet.com")
+|| dnsDomainIs(host, "www.familymoney.com")
+|| dnsDomainIs(host, "www.familyplay.com")
+|| dnsDomainIs(host, "www.famousbirthdays.com")
+|| dnsDomainIs(host, "www.fandom.com")
+|| dnsDomainIs(host, "www.fansites.com")
+|| dnsDomainIs(host, "www.faoschwarz.com")
+|| dnsDomainIs(host, "www.fbe.unsw.edu.au")
+|| dnsDomainIs(host, "www.fcps.k12.va.us")
+|| dnsDomainIs(host, "www.fellersartsfactory.com")
+|| dnsDomainIs(host, "www.ferrari.it")
+|| dnsDomainIs(host, "www.fertnel.com")
+|| dnsDomainIs(host, "www.fh-konstanz.de")
+|| dnsDomainIs(host, "www.fhw.gr")
+|| dnsDomainIs(host, "www.fibblesnork.com")
+|| dnsDomainIs(host, "www.fidnet.com")
+|| dnsDomainIs(host, "www.fieldhockey.com")
+|| dnsDomainIs(host, "www.fieldhockeytraining.com")
+|| dnsDomainIs(host, "www.fieler.com")
+|| dnsDomainIs(host, "www.finalfour.net")
+|| dnsDomainIs(host, "www.finifter.com")
+|| dnsDomainIs(host, "www.fireworks-safety.com")
+|| dnsDomainIs(host, "www.firstcut.com")
+|| dnsDomainIs(host, "www.firstnations.com")
+|| dnsDomainIs(host, "www.fishbc.com")
+|| dnsDomainIs(host, "www.fisher-price.com")
+|| dnsDomainIs(host, "www.fisheyeview.com")
+|| dnsDomainIs(host, "www.fishgeeks.com")
+|| dnsDomainIs(host, "www.fishindex.com")
+|| dnsDomainIs(host, "www.fitzgeraldstudio.com")
+|| dnsDomainIs(host, "www.flags.net")
+|| dnsDomainIs(host, "www.flail.com")
+|| dnsDomainIs(host, "www.flamarlins.com")
+|| dnsDomainIs(host, "www.flausa.com")
+|| dnsDomainIs(host, "www.floodlight-findings.com")
+|| dnsDomainIs(host, "www.floridahistory.com")
+|| dnsDomainIs(host, "www.floridapanthers.com")
+|| dnsDomainIs(host, "www.fng.fi")
+|| dnsDomainIs(host, "www.foodsci.uoguelph.ca")
+|| dnsDomainIs(host, "www.foremost.com")
+|| dnsDomainIs(host, "www.fortress.am")
+|| dnsDomainIs(host, "www.fortunecity.com")
+|| dnsDomainIs(host, "www.fosterclub.com")
+|| dnsDomainIs(host, "www.foundus.com")
+|| dnsDomainIs(host, "www.fourmilab.ch")
+|| dnsDomainIs(host, "www.fox.com")
+|| dnsDomainIs(host, "www.foxfamilychannel.com")
+|| dnsDomainIs(host, "www.foxhome.com")
+|| dnsDomainIs(host, "www.foxkids.com")
+|| dnsDomainIs(host, "www.franceway.com")
+|| dnsDomainIs(host, "www.fred.net")
+|| dnsDomainIs(host, "www.fredpenner.com")
+|| dnsDomainIs(host, "www.freedomknot.com")
+|| dnsDomainIs(host, "www.freejigsawpuzzles.com")
+|| dnsDomainIs(host, "www.freenet.edmonton.ab.ca")
+|| dnsDomainIs(host, "www.frii.com")
+|| dnsDomainIs(host, "www.frisbee.com")
+|| dnsDomainIs(host, "www.fritolay.com")
+|| dnsDomainIs(host, "www.frogsonice.com")
+|| dnsDomainIs(host, "www.frontiernet.net")
+|| dnsDomainIs(host, "www.fs.fed.us")
+|| dnsDomainIs(host, "www.funattic.com")
+|| dnsDomainIs(host, ".funbrain.com")
+|| dnsDomainIs(host, "www.fundango.com")
+|| dnsDomainIs(host, "www.funisland.com")
+|| dnsDomainIs(host, "www.funkandwagnalls.com")
+|| dnsDomainIs(host, "www.funorama.com")
+|| dnsDomainIs(host, "www.funschool.com")
+|| dnsDomainIs(host, "www.funster.com")
+|| dnsDomainIs(host, "www.furby.com")
+|| dnsDomainIs(host, "www.fusion.org.uk")
+|| dnsDomainIs(host, "www.futcher.com")
+|| dnsDomainIs(host, "www.futurescan.com")
+|| dnsDomainIs(host, "www.fyi.net")
+|| dnsDomainIs(host, "www.gailgibbons.com")
+|| dnsDomainIs(host, "www.galegroup.com")
+|| dnsDomainIs(host, "www.gambia.com")
+|| dnsDomainIs(host, "www.gamecabinet.com")
+|| dnsDomainIs(host, "www.gamecenter.com")
+|| dnsDomainIs(host, "www.gamefaqs.com")
+|| dnsDomainIs(host, "www.garfield.com")
+|| dnsDomainIs(host, "www.garyharbo.com")
+|| dnsDomainIs(host, "www.gatefish.com")
+|| dnsDomainIs(host, "www.gateway-va.com")
+|| dnsDomainIs(host, "www.gazillionaire.com")
+|| dnsDomainIs(host, "www.gearhead.com")
+|| dnsDomainIs(host, "www.genesplicing.com")
+|| dnsDomainIs(host, "www.genhomepage.com")
+|| dnsDomainIs(host, "www.geobop.com")
+|| dnsDomainIs(host, "www.geocities.com")
+|| dnsDomainIs(host, "www.geographia.com")
+|| dnsDomainIs(host, "www.georgeworld.com")
+|| dnsDomainIs(host, "www.georgian.net")
+|| dnsDomainIs(host, "www.german-way.com")
+|| dnsDomainIs(host, "www.germanfortravellers.com")
+|| dnsDomainIs(host, "www.germantown.k12.il.us")
+|| dnsDomainIs(host, "www.germany-tourism.de")
+|| dnsDomainIs(host, "www.getmusic.com")
+|| dnsDomainIs(host, "www.gettysburg.com")
+|| dnsDomainIs(host, "www.ghirardellisq.com")
+|| dnsDomainIs(host, "www.ghosttowngallery.com")
+|| dnsDomainIs(host, "www.ghosttownsusa.com")
+|| dnsDomainIs(host, "www.giants.com")
+|| dnsDomainIs(host, "www.gibraltar.gi")
+|| dnsDomainIs(host, "www.gigglepoetry.com")
+|| dnsDomainIs(host, "www.gilchriststudios.com")
+|| dnsDomainIs(host, "www.gillslap.freeserve.co.uk")
+|| dnsDomainIs(host, "www.gilmer.net")
+|| dnsDomainIs(host, "www.gio.gov.tw")
+|| dnsDomainIs(host, "www.girltech.com")
+|| dnsDomainIs(host, "www.girlzone.com")
+|| dnsDomainIs(host, "www.globalgang.org.uk")
+|| dnsDomainIs(host, "www.globalindex.com")
+|| dnsDomainIs(host, "www.globalinfo.com")
+|| dnsDomainIs(host, "www.gloriafan.com")
+|| dnsDomainIs(host, "www.gms.ocps.k12.fl.us")
+|| dnsDomainIs(host, "www.go-go-diggity.com")
+|| dnsDomainIs(host, "www.goals.com")
+|| dnsDomainIs(host, "www.godiva.com")
+|| dnsDomainIs(host, "www.golden-retriever.com")
+|| dnsDomainIs(host, "www.goldenbooks.com")
+|| dnsDomainIs(host, "www.goldeneggs.com.au")
+|| dnsDomainIs(host, "www.golfonline.com")
+|| dnsDomainIs(host, "www.goobo.com")
+|| dnsDomainIs(host, "www.goodearthgraphics.com")
+|| dnsDomainIs(host, "www.goodyear.com")
+|| dnsDomainIs(host, "www.gopbi.com")
+|| dnsDomainIs(host, "www.gorge.net")
+|| dnsDomainIs(host, "www.gorp.com")
+|| dnsDomainIs(host, "www.got-milk.com")
+|| dnsDomainIs(host, "www.gov.ab.ca")
+|| dnsDomainIs(host, "www.gov.nb.ca")
+|| dnsDomainIs(host, "www.grammarbook.com")
+|| dnsDomainIs(host, "www.grammarlady.com")
+|| dnsDomainIs(host, "www.grandparents-day.com")
+|| dnsDomainIs(host, "www.granthill.com")
+|| dnsDomainIs(host, "www.grayweb.com")
+|| dnsDomainIs(host, "www.greatbuildings.com")
+|| dnsDomainIs(host, "www.greatkids.com")
+|| dnsDomainIs(host, "www.greatscience.com")
+|| dnsDomainIs(host, "www.greeceny.com")
+|| dnsDomainIs(host, "www.greenkeepers.com")
+|| dnsDomainIs(host, "www.greylabyrinth.com")
+|| dnsDomainIs(host, "www.grimmy.com")
+|| dnsDomainIs(host, "www.gsrg.nmh.ac.uk")
+|| dnsDomainIs(host, "www.gti.net")
+|| dnsDomainIs(host, "www.guinnessworldrecords.com")
+|| dnsDomainIs(host, "www.guitar.net")
+|| dnsDomainIs(host, "www.guitarplaying.com")
+|| dnsDomainIs(host, "www.gumbyworld.com")
+|| dnsDomainIs(host, "www.gurlwurld.com")
+|| dnsDomainIs(host, "www.gwi.net")
+|| dnsDomainIs(host, "www.gymn-forum.com")
+|| dnsDomainIs(host, "www.gzkidzone.com")
+|| dnsDomainIs(host, "www.haemibalgassi.com")
+|| dnsDomainIs(host, "www.hairstylist.com")
+|| dnsDomainIs(host, "www.halcyon.com")
+|| dnsDomainIs(host, "www.halifax.cbc.ca")
+|| dnsDomainIs(host, "www.halloween-online.com")
+|| dnsDomainIs(host, "www.halloweenkids.com")
+|| dnsDomainIs(host, "www.halloweenmagazine.com")
+|| dnsDomainIs(host, "www.hamill.co.uk")
+|| dnsDomainIs(host, "www.hamsterdance2.com")
+|| dnsDomainIs(host, "www.hamsters.co.uk")
+|| dnsDomainIs(host, "www.hamstertours.com")
+|| dnsDomainIs(host, "www.handsonmath.com")
+|| dnsDomainIs(host, "www.handspeak.com")
+|| dnsDomainIs(host, "www.hansonline.com")
+|| dnsDomainIs(host, "www.happychild.org.uk")
+|| dnsDomainIs(host, "www.happyfamilies.com")
+|| dnsDomainIs(host, "www.happytoy.com")
+|| dnsDomainIs(host, "www.harley-davidson.com")
+|| dnsDomainIs(host, "www.harmonicalessons.com")
+|| dnsDomainIs(host, "www.harperchildrens.com")
+|| dnsDomainIs(host, "www.harvey.com")
+|| dnsDomainIs(host, "www.hasbro-interactive.com")
+|| dnsDomainIs(host, "www.haynet.net")
+|| dnsDomainIs(host, "www.hbc.com")
+|| dnsDomainIs(host, "www.hblewis.com")
+|| dnsDomainIs(host, "www.hbook.com")
+|| dnsDomainIs(host, "www.he.net")
+|| dnsDomainIs(host, "www.headbone.com")
+|| dnsDomainIs(host, "www.healthatoz.com")
+|| dnsDomainIs(host, "www.healthypet.com")
+|| dnsDomainIs(host, "www.heartfoundation.com.au")
+|| dnsDomainIs(host, "www.heatersworld.com")
+|| dnsDomainIs(host, "www.her-online.com")
+|| dnsDomainIs(host, "www.heroesofhistory.com")
+|| dnsDomainIs(host, "www.hersheypa.com")
+|| dnsDomainIs(host, "www.hersheys.com")
+|| dnsDomainIs(host, "www.hevanet.com")
+|| dnsDomainIs(host, "www.heynetwork.com")
+|| dnsDomainIs(host, "www.hgo.com")
+|| dnsDomainIs(host, "www.hhof.com")
+|| dnsDomainIs(host, "www.hideandseekpuppies.com")
+|| dnsDomainIs(host, "www.hifusion.com")
+|| dnsDomainIs(host, "www.highbridgepress.com")
+|| dnsDomainIs(host, "www.his.com")
+|| dnsDomainIs(host, "www.history.navy.mil")
+|| dnsDomainIs(host, "www.historychannel.com")
+|| dnsDomainIs(host, "www.historyhouse.com")
+|| dnsDomainIs(host, "www.historyplace.com")
+|| dnsDomainIs(host, "www.hisurf.com")
+|| dnsDomainIs(host, "www.hiyah.com")
+|| dnsDomainIs(host, "www.hmnet.com")
+|| dnsDomainIs(host, "www.hoboes.com")
+|| dnsDomainIs(host, "www.hockeydb.com")
+|| dnsDomainIs(host, "www.hohnerusa.com")
+|| dnsDomainIs(host, "www.holidaychannel.com")
+|| dnsDomainIs(host, "www.holidayfestival.com")
+|| dnsDomainIs(host, "www.holidays.net")
+|| dnsDomainIs(host, "www.hollywood.com")
+|| dnsDomainIs(host, "www.holoworld.com")
+|| dnsDomainIs(host, "www.homepagers.com")
+|| dnsDomainIs(host, "www.homeschoolzone.com")
+|| dnsDomainIs(host, "www.homestead.com")
+|| dnsDomainIs(host, "www.homeworkspot.com")
+|| dnsDomainIs(host, "www.hompro.com")
+|| dnsDomainIs(host, "www.honey.com")
+|| dnsDomainIs(host, "www.hooked.net")
+|| dnsDomainIs(host, "www.hoophall.com")
+|| dnsDomainIs(host, "www.hooverdam.com")
+|| dnsDomainIs(host, "www.hopepaul.com")
+|| dnsDomainIs(host, "www.horse-country.com")
+|| dnsDomainIs(host, "www.horsechat.com")
+|| dnsDomainIs(host, "www.horsefun.com")
+|| dnsDomainIs(host, "www.horus.ics.org.eg")
+|| dnsDomainIs(host, "www.hotbraille.com")
+|| dnsDomainIs(host, "www.hotwheels.com")
+|| dnsDomainIs(host, "www.howstuffworks.com")
+|| dnsDomainIs(host, "www.hpdigitalbookclub.com")
+|| dnsDomainIs(host, "www.hpj.com")
+|| dnsDomainIs(host, "www.hpl.hp.com")
+|| dnsDomainIs(host, "www.hpl.lib.tx.us")
+|| dnsDomainIs(host, "www.hpnetwork.f2s.com")
+|| dnsDomainIs(host, "www.hsswp.com")
+|| dnsDomainIs(host, "www.hsx.com")
+|| dnsDomainIs(host, "www.humboldt1.com")
+|| dnsDomainIs(host, "www.humongous.com")
+|| dnsDomainIs(host, "www.humph3.freeserve.co.uk")
+|| dnsDomainIs(host, "www.humphreybear.com ")
+|| dnsDomainIs(host, "www.hurricanehunters.com")
+|| dnsDomainIs(host, "www.hyperhistory.com")
+|| dnsDomainIs(host, "www.i2k.com")
+|| dnsDomainIs(host, "www.ibhof.com")
+|| dnsDomainIs(host, "www.ibiscom.com")
+|| dnsDomainIs(host, "www.ibm.com")
+|| dnsDomainIs(host, "www.icangarden.com")
+|| dnsDomainIs(host, "www.icecreamusa.com")
+|| dnsDomainIs(host, "www.icn.co.uk")
+|| dnsDomainIs(host, "www.icomm.ca")
+|| dnsDomainIs(host, "www.idfishnhunt.com")
+|| dnsDomainIs(host, "www.iditarod.com")
+|| dnsDomainIs(host, "www.iei.net")
+|| dnsDomainIs(host, "www.iemily.com")
+|| dnsDomainIs(host, "www.iir.com")
+|| dnsDomainIs(host, "www.ika.com")
+|| dnsDomainIs(host, "www.ikoala.com")
+|| dnsDomainIs(host, "www.iln.net")
+|| dnsDomainIs(host, "www.imagine5.com")
+|| dnsDomainIs(host, "www.imes.boj.or.jp")
+|| dnsDomainIs(host, "www.inch.com")
+|| dnsDomainIs(host, "www.incwell.com")
+|| dnsDomainIs(host, "www.indian-river.fl.us")
+|| dnsDomainIs(host, "www.indians.com")
+|| dnsDomainIs(host, "www.indo.com")
+|| dnsDomainIs(host, "www.indyracingleague.com")
+|| dnsDomainIs(host, "www.indyzoo.com")
+|| dnsDomainIs(host, "www.info-canada.com")
+|| dnsDomainIs(host, "www.infomagic.net")
+|| dnsDomainIs(host, "www.infoplease.com")
+|| dnsDomainIs(host, "www.infoporium.com")
+|| dnsDomainIs(host, "www.infostuff.com")
+|| dnsDomainIs(host, "www.inhandmuseum.com")
+|| dnsDomainIs(host, "www.inil.com")
+|| dnsDomainIs(host, "www.inkspot.com")
+|| dnsDomainIs(host, "www.inkyfingers.com")
+|| dnsDomainIs(host, "www.innerauto.com")
+|| dnsDomainIs(host, "www.innerbody.com")
+|| dnsDomainIs(host, "www.inqpub.com")
+|| dnsDomainIs(host, "www.insecta-inspecta.com")
+|| dnsDomainIs(host, "www.insectclopedia.com")
+|| dnsDomainIs(host, "www.inside-mexico.com")
+|| dnsDomainIs(host, "www.insiders.com")
+|| dnsDomainIs(host, "www.insteam.com")
+|| dnsDomainIs(host, "www.intel.com")
+|| dnsDomainIs(host, "www.intellicast.com")
+|| dnsDomainIs(host, "www.interads.co.uk")
+|| dnsDomainIs(host, "www.intercot.com")
+|| dnsDomainIs(host, "www.intergraffix.com")
+|| dnsDomainIs(host, "www.interknowledge.com")
+|| dnsDomainIs(host, "www.interlog.com")
+|| dnsDomainIs(host, "www.internet4kids.com")
+|| dnsDomainIs(host, "www.intersurf.com")
+|| dnsDomainIs(host, "www.inthe80s.com")
+|| dnsDomainIs(host, "www.inventorsmuseum.com")
+|| dnsDomainIs(host, "www.inwap.com")
+|| dnsDomainIs(host, "www.ioa.com")
+|| dnsDomainIs(host, "www.ionet.net")
+|| dnsDomainIs(host, "www.iowacity.com")
+|| dnsDomainIs(host, "www.ireland-now.com")
+|| dnsDomainIs(host, "www.ireland.com")
+|| dnsDomainIs(host, "www.irelandseye.com")
+|| dnsDomainIs(host, "www.irlgov.ie")
+|| dnsDomainIs(host, "www.isd.net")
+|| dnsDomainIs(host, "www.islandnet.com")
+|| dnsDomainIs(host, "www.isomedia.com")
+|| dnsDomainIs(host, "www.itftennis.com")
+|| dnsDomainIs(host, "www.itpi.dpi.state.nc.us")
+|| dnsDomainIs(host, "www.itskwanzaatime.com")
+|| dnsDomainIs(host, "www.itss.raytheon.com")
+|| dnsDomainIs(host, "www.iuma.com")
+|| dnsDomainIs(host, "www.iwaynet.net")
+|| dnsDomainIs(host, "www.iwc.com")
+|| dnsDomainIs(host, "www.iwight.gov.uk")
+|| dnsDomainIs(host, "www.ixpres.com")
+|| dnsDomainIs(host, "www.j.b.allen.btinternet.co.uk")
+|| dnsDomainIs(host, "www.jabuti.com")
+|| dnsDomainIs(host, "www.jackinthebox.com")
+|| dnsDomainIs(host, "www.jaffebros.com")
+|| dnsDomainIs(host, "www.jaguars.com")
+|| dnsDomainIs(host, "www.jamaica-gleaner.com")
+|| dnsDomainIs(host, "www.jamm.com")
+|| dnsDomainIs(host, "www.janbrett.com")
+|| dnsDomainIs(host, "www.janetstevens.com")
+|| dnsDomainIs(host, "www.japan-guide.com")
+|| dnsDomainIs(host, "www.jargon.net")
+|| dnsDomainIs(host, "www.javelinamx.com")
+|| dnsDomainIs(host, "www.jayjay.com")
+|| dnsDomainIs(host, "www.jazclass.aust.com")
+|| dnsDomainIs(host, "www.jedinet.com")
+|| dnsDomainIs(host, "www.jenniferlopez.com")
+|| dnsDomainIs(host, "www.jlpanagopoulos.com")
+|| dnsDomainIs(host, "www.jmarshall.com")
+|| dnsDomainIs(host, "www.jmccall.demon.co.uk")
+|| dnsDomainIs(host, "www.jmts.com")
+|| dnsDomainIs(host, "www.joesherlock.com")
+|| dnsDomainIs(host, "www.jorvik-viking-centre.co.uk")
+|| dnsDomainIs(host, "www.joycecarolthomas.com")
+|| dnsDomainIs(host, "www.joycone.com")
+|| dnsDomainIs(host, "www.joyrides.com")
+|| dnsDomainIs(host, "www.jps.net")
+|| dnsDomainIs(host, "www.jspub.com")
+|| dnsDomainIs(host, "www.judaica.com")
+|| dnsDomainIs(host, "www.judyblume.com")
+|| dnsDomainIs(host, "www.julen.net")
+|| dnsDomainIs(host, "www.june29.com")
+|| dnsDomainIs(host, "www.juneteenth.com")
+|| dnsDomainIs(host, "www.justuskidz.com")
+|| dnsDomainIs(host, "www.justwomen.com")
+|| dnsDomainIs(host, "www.jwindow.net")
+|| dnsDomainIs(host, "www.k9web.com")
+|| dnsDomainIs(host, "www.kaercher.de")
+|| dnsDomainIs(host, "www.kaleidoscapes.com")
+|| dnsDomainIs(host, "www.kapili.com")
+|| dnsDomainIs(host, "www.kcchiefs.com")
+|| dnsDomainIs(host, "www.kcpl.lib.mo.us")
+|| dnsDomainIs(host, "www.kcroyals.com")
+|| dnsDomainIs(host, "www.kcsd.k12.pa.us")
+|| dnsDomainIs(host, "www.kdu.com")
+|| dnsDomainIs(host, "www.kelloggs.com")
+|| dnsDomainIs(host, "www.kentuckyfriedchicken.com")
+|| dnsDomainIs(host, "www.kenyaweb.com")
+|| dnsDomainIs(host, "www.keypals.com")
+|| dnsDomainIs(host, "www.kfn.com")
+|| dnsDomainIs(host, "www.kid-at-art.com")
+|| dnsDomainIs(host, "www.kid-channel.com")
+|| dnsDomainIs(host, "www.kidallergy.com")
+|| dnsDomainIs(host, "www.kidbibs.com")
+|| dnsDomainIs(host, "www.kidcomics.com")
+|| dnsDomainIs(host, "www.kiddesafety.com")
+|| dnsDomainIs(host, "www.kiddiecampus.com")
+|| dnsDomainIs(host, "www.kididdles.com")
+|| dnsDomainIs(host, "www.kidnews.com")
+|| dnsDomainIs(host, "www.kidocracy.com")
+|| dnsDomainIs(host, "www.kidport.com")
+|| dnsDomainIs(host, "www.kids-channel.co.uk")
+|| dnsDomainIs(host, "www.kids-drawings.com")
+|| dnsDomainIs(host, "www.kids-in-mind.com")
+|| dnsDomainIs(host, "www.kids4peace.com")
+|| dnsDomainIs(host, "www.kidsandcomputers.com")
+|| dnsDomainIs(host, "www.kidsart.co.uk")
+|| dnsDomainIs(host, "www.kidsastronomy.com")
+|| dnsDomainIs(host, "www.kidsbank.com")
+|| dnsDomainIs(host, "www.kidsbookshelf.com")
+|| dnsDomainIs(host, "www.kidsclick.com")
+|| dnsDomainIs(host, "www.kidscom.com")
+|| dnsDomainIs(host, "www.kidscook.com")
+|| dnsDomainIs(host, "www.kidsdoctor.com")
+|| dnsDomainIs(host, "www.kidsdomain.com")
+|| dnsDomainIs(host, "www.kidsfarm.com")
+|| dnsDomainIs(host, "www.kidsfreeware.com")
+|| dnsDomainIs(host, "www.kidsfun.tv")
+|| dnsDomainIs(host, "www.kidsgolf.com")
+|| dnsDomainIs(host, "www.kidsgowild.com")
+|| dnsDomainIs(host, "www.kidsjokes.com")
+|| dnsDomainIs(host, "www.kidsloveamystery.com")
+|| dnsDomainIs(host, "www.kidsmoneycents.com")
+|| dnsDomainIs(host, "www.kidsnewsroom.com")
+|| dnsDomainIs(host, "www.kidsource.com")
+|| dnsDomainIs(host, "www.kidsparties.com")
+|| dnsDomainIs(host, "www.kidsplaytown.com")
+|| dnsDomainIs(host, "www.kidsreads.com")
+|| dnsDomainIs(host, "www.kidsreport.com")
+|| dnsDomainIs(host, "www.kidsrunning.com")
+|| dnsDomainIs(host, "www.kidstamps.com")
+|| dnsDomainIs(host, "www.kidsvideogames.com")
+|| dnsDomainIs(host, "www.kidsway.com")
+|| dnsDomainIs(host, "www.kidswithcancer.com")
+|| dnsDomainIs(host, "www.kidszone.ourfamily.com")
+|| dnsDomainIs(host, "www.kidzup.com")
+|| dnsDomainIs(host, "www.kinderart.com")
+|| dnsDomainIs(host, "www.kineticcity.com")
+|| dnsDomainIs(host, "www.kings.k12.ca.us")
+|| dnsDomainIs(host, "www.kiplinger.com")
+|| dnsDomainIs(host, "www.kiwirecovery.org.nz")
+|| dnsDomainIs(host, "www.klipsan.com")
+|| dnsDomainIs(host, "www.klutz.com")
+|| dnsDomainIs(host, "www.kn.pacbell.com")
+|| dnsDomainIs(host, "www.knex.com")
+|| dnsDomainIs(host, "www.knowledgeadventure.com")
+|| dnsDomainIs(host, "www.knto.or.kr")
+|| dnsDomainIs(host, "www.kodak.com")
+|| dnsDomainIs(host, "www.konica.co.jp")
+|| dnsDomainIs(host, "www.kraftfoods.com")
+|| dnsDomainIs(host, "www.kudzukids.com")
+|| dnsDomainIs(host, "www.kulichki.com")
+|| dnsDomainIs(host, "www.kuttu.com")
+|| dnsDomainIs(host, "www.kv5.com")
+|| dnsDomainIs(host, "www.kyes-world.com")
+|| dnsDomainIs(host, "www.kyohaku.go.jp")
+|| dnsDomainIs(host, "www.kyrene.k12.az.us")
+|| dnsDomainIs(host, "www.kz")
+|| dnsDomainIs(host, "www.la-hq.org.uk")
+|| dnsDomainIs(host, "www.labs.net")
+|| dnsDomainIs(host, "www.labyrinth.net.au")
+|| dnsDomainIs(host, "www.laffinthedark.com")
+|| dnsDomainIs(host, "www.lakhota.com")
+|| dnsDomainIs(host, "www.lakings.com")
+|| dnsDomainIs(host, "www.lam.mus.ca.us")
+|| dnsDomainIs(host, "www.lampstras.k12.pa.us")
+|| dnsDomainIs(host, "www.lams.losalamos.k12.nm.us")
+|| dnsDomainIs(host, "www.landofcadbury.ca")
+|| dnsDomainIs(host, "www.larry-boy.com")
+|| dnsDomainIs(host, "www.lasersite.com")
+|| dnsDomainIs(host, "www.last-word.com")
+|| dnsDomainIs(host, "www.latimes.com")
+|| dnsDomainIs(host, "www.laughon.com")
+|| dnsDomainIs(host, "www.laurasmidiheaven.com")
+|| dnsDomainIs(host, "www.lausd.k12.ca.us")
+|| dnsDomainIs(host, "www.learn2.com")
+|| dnsDomainIs(host, "www.learn2type.com")
+|| dnsDomainIs(host, "www.learnfree-hobbies.com")
+|| dnsDomainIs(host, "www.learningkingdom.com")
+|| dnsDomainIs(host, "www.learningplanet.com")
+|| dnsDomainIs(host, "www.leftjustified.com")
+|| dnsDomainIs(host, "www.legalpadjr.com")
+|| dnsDomainIs(host, "www.legendarysurfers.com")
+|| dnsDomainIs(host, "www.legends.dm.net")
+|| dnsDomainIs(host, "www.legis.state.wi.us")
+|| dnsDomainIs(host, "www.legis.state.wv.us")
+|| dnsDomainIs(host, "www.lego.com")
+|| dnsDomainIs(host, "www.leje.com")
+|| dnsDomainIs(host, "www.leonardodicaprio.com")
+|| dnsDomainIs(host, "www.lessonplanspage.com")
+|| dnsDomainIs(host, "www.letour.fr")
+|| dnsDomainIs(host, "www.levins.com")
+|| dnsDomainIs(host, "www.levistrauss.com")
+|| dnsDomainIs(host, "www.libertystatepark.com")
+|| dnsDomainIs(host, "www.libraryspot.com")
+|| dnsDomainIs(host, "www.lifelong.com")
+|| dnsDomainIs(host, "www.lighthouse.cc")
+|| dnsDomainIs(host, "www.lightlink.com")
+|| dnsDomainIs(host, "www.lightspan.com")
+|| dnsDomainIs(host, "www.lil-fingers.com")
+|| dnsDomainIs(host, "www.linc.or.jp")
+|| dnsDomainIs(host, "www.lindsaysbackyard.com")
+|| dnsDomainIs(host, "www.lindtchocolate.com")
+|| dnsDomainIs(host, "www.lineone.net")
+|| dnsDomainIs(host, "www.lionel.com")
+|| dnsDomainIs(host, "www.lisafrank.com")
+|| dnsDomainIs(host, "www.lissaexplains.com")
+|| dnsDomainIs(host, "www.literacycenter.net")
+|| dnsDomainIs(host, "www.littleartist.com")
+|| dnsDomainIs(host, "www.littlechiles.com")
+|| dnsDomainIs(host, "www.littlecritter.com")
+|| dnsDomainIs(host, "www.littlecrowtoys.com")
+|| dnsDomainIs(host, "www.littlehousebooks.com")
+|| dnsDomainIs(host, "www.littlejason.com")
+|| dnsDomainIs(host, "www.littleplanettimes.com")
+|| dnsDomainIs(host, "www.liveandlearn.com")
+|| dnsDomainIs(host, "www.loadstar.prometeus.net")
+|| dnsDomainIs(host, "www.localaccess.com")
+|| dnsDomainIs(host, "www.lochness.co.uk")
+|| dnsDomainIs(host, "www.lochness.scotland.net")
+|| dnsDomainIs(host, "www.logos.it")
+|| dnsDomainIs(host, "www.lonelyplanet.com")
+|| dnsDomainIs(host, "www.looklearnanddo.com")
+|| dnsDomainIs(host, "www.loosejocks.com")
+|| dnsDomainIs(host, "www.lost-worlds.com")
+|| dnsDomainIs(host, "www.love-story.com")
+|| dnsDomainIs(host, "www.lpga.com")
+|| dnsDomainIs(host, "www.lsjunction.com")
+|| dnsDomainIs(host, "www.lucasarts.com")
+|| dnsDomainIs(host, "www.lucent.com")
+|| dnsDomainIs(host, "www.lucie.com")
+|| dnsDomainIs(host, "www.lunaland.co.za")
+|| dnsDomainIs(host, "www.luth.se")
+|| dnsDomainIs(host, "www.lyricalworks.com")
+|| dnsDomainIs(host, "www.infoporium.com")
+|| dnsDomainIs(host, "www.infostuff.com")
+|| dnsDomainIs(host, "www.inhandmuseum.com")
+|| dnsDomainIs(host, "www.inil.com")
+|| dnsDomainIs(host, "www.inkspot.com")
+|| dnsDomainIs(host, "www.inkyfingers.com")
+|| dnsDomainIs(host, "www.innerauto.com")
+|| dnsDomainIs(host, "www.innerbody.com")
+|| dnsDomainIs(host, "www.inqpub.com")
+|| dnsDomainIs(host, "www.insecta-inspecta.com")
+|| dnsDomainIs(host, "www.insectclopedia.com")
+|| dnsDomainIs(host, "www.inside-mexico.com")
+|| dnsDomainIs(host, "www.insiders.com")
+|| dnsDomainIs(host, "www.insteam.com")
+|| dnsDomainIs(host, "www.intel.com")
+|| dnsDomainIs(host, "www.intellicast.com")
+|| dnsDomainIs(host, "www.interads.co.uk")
+|| dnsDomainIs(host, "www.intercot.com")
+|| dnsDomainIs(host, "www.intergraffix.com")
+|| dnsDomainIs(host, "www.interknowledge.com")
+|| dnsDomainIs(host, "www.interlog.com")
+|| dnsDomainIs(host, "www.internet4kids.com")
+|| dnsDomainIs(host, "www.intersurf.com")
+|| dnsDomainIs(host, "www.inthe80s.com")
+|| dnsDomainIs(host, "www.inventorsmuseum.com")
+|| dnsDomainIs(host, "www.inwap.com")
+|| dnsDomainIs(host, "www.ioa.com")
+|| dnsDomainIs(host, "www.ionet.net")
+|| dnsDomainIs(host, "www.iowacity.com")
+|| dnsDomainIs(host, "www.ireland-now.com")
+|| dnsDomainIs(host, "www.ireland.com")
+|| dnsDomainIs(host, "www.irelandseye.com")
+|| dnsDomainIs(host, "www.irlgov.ie")
+|| dnsDomainIs(host, "www.isd.net")
+|| dnsDomainIs(host, "www.islandnet.com")
+|| dnsDomainIs(host, "www.isomedia.com")
+|| dnsDomainIs(host, "www.itftennis.com")
+|| dnsDomainIs(host, "www.itpi.dpi.state.nc.us")
+|| dnsDomainIs(host, "www.itskwanzaatime.com")
+|| dnsDomainIs(host, "www.itss.raytheon.com")
+|| dnsDomainIs(host, "www.iuma.com")
+|| dnsDomainIs(host, "www.iwaynet.net")
+|| dnsDomainIs(host, "www.iwc.com")
+|| dnsDomainIs(host, "www.iwight.gov.uk")
+|| dnsDomainIs(host, "www.ixpres.com")
+|| dnsDomainIs(host, "www.j.b.allen.btinternet.co.uk")
+|| dnsDomainIs(host, "www.jabuti.com")
+|| dnsDomainIs(host, "www.jackinthebox.com")
+|| dnsDomainIs(host, "www.jaffebros.com")
+|| dnsDomainIs(host, "www.jaguars.com")
+|| dnsDomainIs(host, "www.jamaica-gleaner.com")
+|| dnsDomainIs(host, "www.jamm.com")
+|| dnsDomainIs(host, "www.janbrett.com")
+|| dnsDomainIs(host, "www.janetstevens.com")
+|| dnsDomainIs(host, "www.japan-guide.com")
+|| dnsDomainIs(host, "www.jargon.net")
+|| dnsDomainIs(host, "www.javelinamx.com")
+|| dnsDomainIs(host, "www.jayjay.com")
+|| dnsDomainIs(host, "www.jazclass.aust.com")
+
+)
+return "PROXY proxy.hclib.org:80";
+else
+return "PROXY 172.16.100.20:8080";
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-89474.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-89474.js
new file mode 100644
index 0000000..4ed9f67
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-89474.js
@@ -0,0 +1,62 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS
+* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+* implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation. All
+* Rights Reserved.
+*
+* Contributors:darren.deridder@icarusproject.com,
+* pschwartau@netscape.com
+* Date: 07 July 2001
+*
+* SUMMARY: Regression test for Bugzilla bug 89474
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=89474
+*
+* This test used to crash the JS shell. This was discovered
+* by Darren DeRidder <darren.deridder@icarusproject.com
+*/
+//-------------------------------------------------------------------------------------------------
+var bug = 89474;
+var summary = "Testing the JS shell doesn't crash on it.item()";
+var cnTest = 'it.item()';
+
+
+//-------------------------------------------------------------------------------------------------
+test();
+//-------------------------------------------------------------------------------------------------
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ tryThis(cnTest); // Just testing that we don't crash on this
+
+ exitFunc ('test');
+}
+
+
+function tryThis(sEval)
+{
+ try
+ {
+ eval(sEval);
+ }
+ catch(e)
+ {
+ // If we get here, we didn't crash.
+ }
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-90445.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-90445.js
new file mode 100644
index 0000000..d628ce9
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-90445.js
@@ -0,0 +1,306 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an
+* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either expressed
+* or implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation.
+* All Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+* Date: 2001-07-12
+*
+* SUMMARY: Regression test for bug 90445
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=90445
+*
+* Just seeing if this script will compile without crashing.
+*/
+//-------------------------------------------------------------------------------------------------
+var bug = 90445;
+var summary = 'Testing this script will compile without crashing';
+
+printBugNumber (bug);
+printStatus (summary);
+
+
+// The big function -
+function compte() {
+ var mois = getValueFromOption(document.formtest.mois);
+ var region = document.formtest.region.options.selectedIndex;
+ var confort = document.formtest.confort.options.selectedIndex;
+ var encadrement = document.formtest.encadrement.options.selectedIndex;
+ var typeVillage = document.formtest.type_village.options.selectedIndex;
+ var budget = document.formtest.budget.value;
+ var sport1 = document.formtest.sport1.options.selectedIndex;
+ var sport2 = document.formtest.sport2.options.selectedIndex;
+ var sport3 = document.formtest.sport3.options.selectedIndex;
+ var activite1 = document.formtest.activite1.options.selectedIndex;
+ var activite2 = document.formtest.activite2.options.selectedIndex;
+ var activite3 = document.formtest.activite3.options.selectedIndex;
+
+ var ret = 0;
+ var liste;
+ var taille;
+ var bl;
+ var i;
+ var j;
+ V=[
+ [1,14,19,1,3,3,3,0,[10,13,17,18,22,23,26,27,29,9],[13,17,18,20,4,5,6,7,8]],
+ [1,14,18,1,1,3,3,0,[1,11,13,22,23,26,27,28,29,3,4,9],[13,17,18,20,6]],
+ [1,14,19,1,3,4,3,0,[13,17,18,22,23,25,26,27,4,9],[11,17,12,2,20,3,21,9,6]],
+ [1,14,19,1,1,3,3,0,[1,10,13,22,23,24,25,26,27,28,4,8,9],[13,17,6,9]],
+ [1,14,18,1,3,4,3,0,[12,13,22,23,27,28,7,9],[13,17,2,20,6,7,9]],
+ [1,14,19,5,4,2,3,0,[12,13,17,18,2,21,22,23,24,26,27,28,3,5,8,9],[1,10,13,17,18,19,20,5,21,7,8,9]],
+ [1,14,20,6,2,2,3,0,[11,13,2,22,23,26,27,3,4,5,8,9],[13,17,18,20,6,9]],
+ [1,14,19,6,3,4,3,0,[10,13,2,22,23,26,27,3,4,5,8,9],[13,17,18,19,20,21,9,6,5]],
+ [1,14,19,4,2,4,3,0,[13,17,2,22,26,28,3,5,6,7,8,9],[10,13,15,17,19,2,20,3,5,6,9]],
+ [1,14,19,8,4,4,3,0,[13,2,22,26,3,28,4,5,6,8,9],[14,15,17,18,19,2,20,21,9,7]],
+ [1,15,18,6,1,4,3,0,[10,11,13,14,15,2,23,26,27,5,8,9,6],[13,17,2,20,6,9]],
+ [1,14,19,2,3,5,3,0,[10,13,17,2,22,26,27,28,3,5,6,7,8,9],[1,10,13,15,17,18,19,20,6,7,9,22]],
+ [1,15,18,6,1,3,3,0,[12,13,15,2,22,23,26,4,5,9],[13,15,6,17,2,21,9]],
+ [1,19,21,1,4,4,3,0,[11,13,18,22,23,27,28,4],[17,2,20,21,9]],
+ [1,14,19,4,3,3,3,0,[10,13,17,2,22,23,24,26,27,3,4,6,8,9],[10,13,17,19,20,3,5,6,7,9]],
+ [1,13,19,6,3,3,3,0,[11,13,15,2,22,23,26,27,28,3,4,8,9],[1,13,17,18,20,6,9,22]],
+ [1,15,19,6,1,5,3,0,[10,13,2,22,23,26,27,4,5,8,11],[10,13,17,20,5,6,9]],
+ [1,15,18,6,3,2,1,0,[10,17,21,22,23,25,26,9],[13,16,17,20,21,8,9]],
+ [1,14,19,8,2,2,3,0,[13,16,21,22,23,24,26,27,3,4,5,6,8,9],[15,17,20,3,6,9]],
+ [1,14,19,5,3,2,3,0,[10,11,13,16,17,2,21,22,23,24,26,27,3,4,8,9],[1,10,13,17,18,19,20,5,6,7,9]],
+ [1,14,19,4,4,4,3,0,[10,13,2,22,23,26,27,3,4,5,6,7,8,9],[13,14,17,19,20,21,7,9]],
+ [1,14,19,1,3,2,3,0,[10,13,22,23,26,27,28,3,4,5,6,8,9],[15,17,18,2,20,6,8,9]],
+ [1,14,19,6,1,5,3,0,[10,11,13,22,25,26,4,5,7,8,9],[10,13,17,2,20,5,6,9]],
+ [1,14,19,6,4,4,3,0,[10,13,17,18,22,23,26,27,4,9,5],[1,13,14,17,18,20,3,21,7,8,9]],
+ [1,12,20,6,3,4,2,0,[10,13,14,17,18,22,23,25,26,27,29,9],[13,14,16,17,20,3,8,7,9]],
+ [1,14,19,1,3,3,3,0,[10,11,13,17,2,22,23,26,27,29,3,4,8,9],[1,10,13,14,15,17,18,20,5,21,7,8,9,25]],
+ [1,14,20,1,2,5,3,0,[12,13,17,22,23,26,28,3,4,8,9,27],[10,13,17,18,20,5,6,9,22]],
+ [1,14,19,1,2,3,3,0,[13,17,22,23,26,27,28,29,3,4,8,19],[13,17,18,20,6,7,8,9]],
+ [1,14,18,6,1,3,3,0,[12,13,15,2,22,23,26,27,28,4,9],[13,17,6,9]],
+ [1,14,19,5,3,4,3,0,[13,2,26,27,28,3,4,5,6],[1,10,13,15,17,18,2,20,3,21,7]],
+ [1,14,18,6,3,3,3,0,[13,2,22,23,26,27,8,3,4,5,9],[1,13,17,18,19,2,20,6,8,9,22]],
+ [1,14,19,6,4,3,2,0,[10,13,17,18,22,23,25,26,27,29],[13,14,16,17,3,7,8]],
+ [1,14,18,6,3,3,3,0,[13,22,23,26,27,28,3,4,5,7,8,9],[13,17,18,2,20,3,5,6,9]],
+ [1,14,20,1,3,2,3,0,[10,13,15,17,19,2,22,23,24,26,27,3,4,8,9],[13,17,18,20,6,7,8,9]],
+ [1,14,20,6,3,1,3,0,[10,13,16,2,22,23,26,27,3,4,6,8,9],[13,17,20,5,6,9]],
+ [1,14,19,3,3,3,3,0,[10,12,13,18,21,22,23,24,26,27,29,3,4,8,9],[1,10,17,20,6,8,9]],
+ [1,14,19,2,3,1,3,0,[12,13,17,2,22,23,24,26,27,28,4,8,9,19],[1,13,17,18,19,20,6,9]],
+ [1,14,19,5,4,2,3,0,[10,11,13,17,2,21,3,22,23,24,25,26,27,5,6,8,9],[13,17,20,3,21,9]],
+ [1,14,19,6,2,3,3,0,[13,22,23,26,27,28,3,4,5,7,8,9],[13,17,18,20,5,6,9]],
+ [1,14,20,6,3,2,3,0,[10,12,13,19,2,22,23,24,25,1,26,27,28,3,4,8,9],[10,13,17,18,20,3,5,6,7,8,9]],
+ [1,14,19,5,3,4,3,0,[12,13,2,26,27,28,3,4,5,6,8,9],[10,13,17,18,2,20,3,21,7]],
+ [1,14,19,6,3,4,3,0,[13,16,22,23,26,27,28,3,5,7,8,9],[10,13,17,18,19,2,20,5,6,7,8,9]],
+ [1,14,19,6,3,2,3,0,[10,13,22,23,24,25,26,27,3,4,7,8,9],[1,13,17,20,5,21,9,23]],
+ [1,14,18,6,2,2,3,0,[11,13,2,22,23,26,27,3,4,8,9],[1,13,14,15,17,18,19,2,20,6,7,8,5]],
+ [1,14,19,6,2,3,3,0,[13,17,2,22,23,26,27,4,5,7,9],[13,14,16,17,9,22]],
+ [1,14,19,8,3,2,3,0,[13,18,22,23,24,27,28,3,4,5,8,9],[15,16,17,18,19,2,20,6,9]],
+ [1,14,19,1,3,4,2,0,[13,17,18,22,23,26,27,29,9,11,8],[13,17,20,3,21,7,8,9,6]],
+ [1,15,18,6,4,4,1,0,[13,17,22,25,27,29],[14,16,3,7,8]],
+ [1,14,18,6,3,1,3,0,[12,13,16,17,18,19,2,22,23,26,27,3,4,9],[13,17,20,3,6,9]],
+ [1,14,19,6,2,3,2,0,[13,2,22,23,26,27,9],[13,16,17,9]],
+ [1,14,19,8,3,4,3,0,[13,22,26,5,6,7,8,9],[13,15,17,18,19,2,20,6,9]],
+ [1,14,20,1,2,2,3,0,[11,13,22,23,26,27,28,29,3,4,9],[13,17,18,20,6,9]],
+ [1,14,19,6,3,2,2,0,[10,13,17,18,22,23,24,25,26,27,9],[1,13,14,16,17,20,3,6,7,8,9]],
+ [1,14,18,6,3,5,3,0,[11,13,18,22,23,26,27,4,5,2],[1,10,13,17,2,20,5,6,9,22]],
+ [1,14,19,1,3,4,2,0,[17,22,23,26,27,13],[13,16,17,18,2,20,11,6,7,8,9]],
+ [1,15,18,6,1,2,3,0,[13,15,2,22,23,26,3,4,5,6,9],[1,13,17,20,6,9,5]],
+ [1,14,20,6,3,2,3,0,[10,11,24,13,2,22,23,26,27,3,4,5,7,8,9],[1,10,13,17,18,19,2,20,5,6,7,8,9,23]],
+ [1,14,19,4,4,4,3,0,[10,13,17,18,2,22,26,27,28,3,4,5,6,8,9,23],[14,15,17,19,2,20,3,21,7,9,10]],
+ [1,14,19,5,4,3,3,0,[10,13,17,21,22,23,26,27,5,8,9],[10,13,17,18,19,2,20,21,7,9]],
+ [1,14,19,7,4,4,3,0,[13,17,2,22,23,26,27,18,28,3,4,5,7,9],[10,13,17,18,19,2,20,3,21,9]],
+ [1,12,20,6,2,2,2,0,[10,11,13,17,18,22,23,25,26,27,29,8,9],[1,13,16,17,3,6,8,9,24]],
+ [1,14,18,6,3,3,1,0,[13,16,17,22,25,26,27,9],[13,16,17,20,21,8]],
+ [1,14,19,6,2,5,3,0,[13,17,2,22,23,26,27,4,5,9],[10,13,17,2,20,5,6,9]],
+ [1,14,19,6,2,3,3,0,[1,13,17,22,23,26,27,28,4,6,9],[13,17,18,20,6,9]],
+ [1,14,19,4,3,2,3,0,[12,13,17,19,2,22,23,24,26,27,28,3,4,5,8,9],[13,15,17,19,20,21,9,5]],
+ [1,14,19,5,4,2,3,0,[10,17,2,21,22,23,24,26,27,28,3,4,6,8,9],[1,10,13,14,17,19,20,3,21,7,8,9]],
+ [1,14,19,3,4,3,3,0,[10,12,13,2,21,22,23,26,27,4,7,8,9],[1,13,17,20,6,8,9]],
+ [1,14,19,5,3,2,1,0,[13,17,19,21,22,23,24,25,26,27,8,9],[1,14,17,3,6,8,13]],
+ [1,14,19,2,3,1,3,0,[10,11,13,17,18,19,22,24,26,27,4,7,8,9],[13,17,19,20,3,6,9]],
+ [1,14,19,6,2,3,3,0,[13,2,22,23,26,27,4,5,9],[1,13,17,18,20,6,9,24]],
+ [1,14,18,6,2,2,3,0,[11,13,22,23,24,25,26,27,3,4,5,6,8,9],[1,13,17,20,3,5,6,9]],
+ [1,14,18,1,2,2,3,0,[1,11,13,15,17,2,22,23,26,27,4,9],[1,13,17,18,20,6,9]],
+ [1,14,19,2,3,4,3,0,[10,13,22,26,27,28,29,3,4,5,6,7,8,9,36],[1,13,15,17,18,19,20,5,6,7,8,9]],
+ [1,14,19,6,2,1,2,0,[13,17,21,22,26,27,3,8,9],[13,17,20,6]],
+ [1,15,18,6,4,3,1,0,[10,13,16,17,20,22,25,27],[16,17,3,6,7,8,9]],
+ [1,14,19,4,3,5,3,0,[10,11,13,17,22,24,26,27,28,3,4,5,6,7,8,9],[10,13,15,17,2,20,3,6,7,9]],
+ [1,14,20,6,3,1,2,0,[10,11,17,18,19,22,23,25,26,27,29,8,9],[1,10,13,14,16,17,3,4,6,7,8,9]],
+ [1,15,18,6,3,3,1,0,[13,16,22,26,27,9,23],[13,16,17,20,21,6]],
+ [1,15,18,1,3,4,3,0,[10,13,17,2,22,23,25,26,27,28,29,4,9,12],[13,17,18,20,6,9,5]],
+ [1,21,25,6,2,1,4,0,[30,31,34,35],[6,3]],
+ [1,21,25,6,3,4,4,0,[30,31,34,35],[6,3]],
+ [1,20,25,1,3,3,3,0,[9,10,13,17,18,22,23,26,27,29],[20,18,17,13,8,7,6,5,4]],
+ [1,21,25,6,2,5,4,0,[30,31,34,35],[6,3]],
+ [1,21,25,6,3,3,4,0,[30,31,96,79,34,35],[6,7]],
+ [1,21,25,1,3,4,3,0,[4,9,13,17,18,22,23,25,26,27],[21,20,17,12,11,9,3,2]],
+ [1,21,25,6,2,3,4,0,[30,34],[6,3]],
+ [1,22,25,1,3,4,3,0,[7,9,12,13,22,23,27,28],[20,17,13,9,7,6,2]],
+ [1,21,25,6,3,3,4,0,[30,31,34,35],[6]],
+ [1,20,25,5,4,2,3,0,[2,3,5,8,9,12,13,17,18,21,22,23,24,26,27,28],[21,20,19,18,17,13,10,9,8,7,5,1]],
+ [1,20,25,8,4,4,3,0,[2,3,4,5,6,9,13,22,26,28],[21,20,19,18,17,15,9]],
+ [1,24,25,6,2,2,3,0,[2,3,4,5,6,8,9,11,13,22,23,26,27,29],[20,18,17,13,9,8,7,6]],
+ [1,20,25,4,2,4,3,0,[2,3,5,6,7,8,9,12,13,17,22,26,28],[20,19,17,15,13,10,9,6,5,3,2]],
+ [1,20,25,2,3,5,3,0,[2,3,5,6,7,8,9,10,13,17,22,26,27,28],[20,19,18,17,13,10,9,7,6,1]],
+ [1,20,25,4,3,3,3,0,[2,3,4,6,8,9,13,17,22,23,24,26,27],[20,19,17,13,10,9,7,6,5,3]],
+ [1,20,25,1,3,2,3,0,[3,4,5,6,8,9,10,13,22,23,26,27,28],[20,18,17,15,9,8,6,2]],
+ [1,21,25,2,3,3,4,0,[30,31,34,35],[6,3,7]],
+ [1,21,25,6,3,2,4,0,[30,34],[6,3]],
+ [1,20,25,5,3,2,3,0,[8,9,10,11,13,16,17,21,22,23,24,26,27],[20,19,18,17,13,10,9,7,6,5,1]],
+ [1,20,25,2,2,5,4,0,[30,31,34],[6,3,7]],
+ [1,20,25,4,4,4,3,0,[2,3,4,5,6,8,9,10,13,22,23,26,27],[21,20,19,17,14,13,9,7]],
+ [1,24,25,6,3,3,3,0,[2,3,4,8,9,11,13,15,22,23,26,27,28],[20,18,17,13,9,6,1]],
+ [1,22,25,1,4,4,3,0,[4,11,13,18,22,23,27,28],[21,20,17,9]],
+ [1,21,25,6,2,1,4,0,[30,34,35],[6,3]],
+ [1,20,25,6,4,4,3,0,[9,10,13,17,18,22,23,26,27],[21,20,18,17,14,13,9,8,7,3,1]],
+ [1,24,25,6,3,4,2,0,[9,10,13,17,18,22,23,25,26,27,29],[20,17,16,14,13,9,8,7,3]],
+ [1,20,25,1,3,3,3,0,[2,3,4,8,9,10,11,13,17,22,23,26,27,29],[21,20,18,17,15,14,13,10,9,8,7,5,1]],
+ [1,20,25,1,2,3,3,0,[3,4,8,11,13,17,22,23,26,27,28,29],[20,18,17,13,9,8,7,6]],
+ [1,20,25,5,3,4,3,0,[2,3,4,5,6,13,26,27,28],[21,20,18,17,15,13,10,3,2,1]],
+ [1,20,25,6,4,3,2,0,[10,13,17,18,22,23,25,26,27,29],[17,16,14,13,8,7,3]],
+ [1,21,25,6,2,1,4,0,[30,34,35],[6,3]],
+ [1,21,25,1,3,2,3,0,[2,3,4,8,9,10,13,15,17,19,22,23,24,26,27],[20,18,17,13,8,9,7,6]],
+ [1,20,25,2,3,3,3,0,[11,13,2,21,22,23,24,26,27,28,29,3,4,5,8,9],[1,13,17,18,19,2,20,3,6,7,9]],
+ [1,24,25,6,3,1,3,0,[2,3,4,6,8,9,10,13,16,22,23,26,27],[20,17,13,9,6,5]],
+ [1,20,25,3,3,3,3,0,[3,4,8,9,10,12,13,18,21,22,23,24,26,27,29],[20,17,10,9,8,6,1]],
+ [1,20,25,2,3,1,3,0,[2,4,8,9,12,13,17,22,23,24,26,27,28],[20,19,18,17,13,9,6,1]],
+ [1,20,25,5,4,2,3,0,[2,3,5,6,8,9,10,11,13,17,21,22,23,24,25,26,27],[21,20,17,13,9,3]],
+ [1,24,25,6,3,2,3,0,[2,3,4,8,9,10,13,19,22,23,24,25,26,27,28],[20,18,17,13,10,9,8,7,6,5,3]],
+ [1,21,25,6,2,1,4,0,[30,31,33,34],[6]],
+ [1,20,25,8,3,2,3,0,[3,4,5,8,9,13,17,18,22,23,24,27,28],[20,19,18,17,15,9,6]],
+ [1,21,25,6,4,4,4,0,[30,31,27,10,34],[6,3,7]],
+ [1,21,25,6,4,4,4,0,[30,31,34],[6,3,7]],
+ [1,20,25,1,3,4,2,0,[9,13,17,18,22,23,26,27,29],[20,17,13,9,8,7,6,3]],
+ [1,20,25,7,4,4,3,0,[2,3,4,5,7,9,13,17,18,22,23,26,27,28],[21,20,19,18,17,13,10,9,3,2]],
+ [1,21,25,6,4,4,4,0,[30,31,34],[6,7]],
+ [1,21,25,6,3,3,4,0,[30,31,35],[6,3]],
+ [1,20,25,8,3,4,3,0,[5,6,7,8,9,13,22,26,28],[20,19,18,17,15,13,9,6,2]],
+ [1,21,25,1,2,2,3,0,[3,4,9,11,13,22,23,26,27,28,29],[20,18,17,13,9,6]],
+ [1,20,25,6,3,2,2,0,[9,10,13,17,18,22,23,25,26,27],[20,17,16,14,13,9,8,7,6,3,1]],
+ [1,24,25,6,3,2,3,0,[2,3,4,5,7,8,9,10,11,13,22,23,24,26,27],[20,19,18,17,13,10,9,8,7,6,5,2,1]],
+ [1,20,25,2,3,5,3,0,[29,24,13,4,5,22,23,16,2,28,9,10],[7,13,5,1,15,3,9,6,17]],
+ [1,20,25,4,3,2,3,0,[2,3,4,5,6,8,9,12,13,17,19,22,23,24,26,27,28],[20,19,17,13,9]],
+ [1,20,25,5,4,3,3,0,[3,4,5,8,9,10,13,17,21,22,23,26,27],[21,20,19,18,17,13,10,9,7,2]],
+ [1,20,25,4,4,4,3,0,[2,3,4,5,6,8,9,10,13,17,18,22,23,26,27,28],[21,20,19,17,15,14,9,7,3,2]],
+ [1,21,25,6,3,3,4,0,[30,31,10,34],[6,3,7]],
+ [1,20,25,6,2,3,3,0,[1,4,6,9,13,17,22,23,26,27,28],[20,18,17,13,9,6]],
+ [1,21,25,6,2,2,2,0,[8,9,10,11,13,17,18,22,23,25,26,27,29],[17,16,13,9,8,6,3,1]],
+ [1,21,25,6,3,4,4,0,[30,32,33,27,34],[6,7]],
+ [1,20,25,3,4,3,3,0,[2,4,7,8,9,10,12,13,21,22,23,26,27],[20,17,13,9,8,6,1]],
+ [1,20,25,6,2,3,3,0,[],[20,18,17,13,9,6,1]],
+ [1,20,25,2,3,1,3,0,[4,7,8,9,10,11,13,17,18,19,22,24,26,27],[20,19,17,13,9,6,3]],
+ [1,20,25,5,3,2,4,0,[30,31,96],[6,3,7]],
+ [1,20,25,2,3,4,3,0,[3,4,5,6,7,8,9,10,13,22,26,27,28,29],[20,19,18,17,13,9,8,7,6,5,1]],
+ [1,21,25,6,3,3,4,0,[30,31,27,10,34],[6,7]],
+ [1,21,25,4,3,2,3,0,[3,4,5,6,8,9,10,11,13,18,19,22,23,26,27],[20,17,13,9]],
+ [1,21,25,6,4,3,4,0,[30,31,27,10,35],[6,7]],
+ [1,21,25,6,2,2,4,0,[30,34],[6,3]],
+ [1,24,25,6,2,1,2,0,[3,8,9,13,17,21,22,26,27],[20,17,13,6]],
+ [1,20,25,4,3,5,3,0,[3,4,5,6,7,8,9,10,11,13,17,22,24,26,27,28],[20,17,15,13,10,9,7,6,3,2]],
+ [1,20,26,6,4,3,4,0,[30,31,27,10,34,35],[6,3,7]],
+ [1,21,25,6,2,3,4,0,[30,33,34],[6]],
+ [1,21,25,6,3,1,2,0,[8,9,10,11,17,18,19,22,23,25,26,27,29],[17,16,14,13,10,9,8,7,6,4,3,1]],
+ [1,21,25,6,4,4,4,0,[30,31,10,34,35],[6,7]],
+ [1,21,25,6,3,2,4,0,[30,31,33,34],[6,3]],
+ [1,21,26,6,3,5,4,0,[30,31],[6,3]],
+ [1,21,25,6,2,1,4,0,[30,34,35],[6,3]],
+ [1,21,25,6,3,3,4,0,[30,34],[6]],
+ [1,20,25,8,2,2,3,0,[3,4,5,6,8,9,13,16,21,22,23,24,26,27],[20,17,15,9,6,3]],
+ [1,20,25,5,3,4,3,0,[2,3,4,5,6,8,9,12,13,26,27,28],[21,20,18,17,13,10,3,2]],
+ [1,20,25,5,4,2,3,0,[3,4,6,8,9,10,17,21,22,23,24,26,27,28],[21,20,19,17,14,13,10,9,8,7,3,1]],
+ [1,13,19,6,2,3,3,0,[2,3,13,22,19,8,9,12,27],[9,6,17,20]],
+ [1,15,18,2,3,3,1,0,[25,24,13,16,19,8,9,10,17,22,29,23],[16,8,3,21,17,19]],
+ [1,14,19,2,3,3,3,0,[13,2,21,22,23,24,26,27,28,29,3,4,5,8,9,17],[1,13,17,18,19,2,20,3,6,7,9]],
+ [1,15,18,6,4,4,1,0,[29,16,17,22,27,10],[16,8,3,14,7]],
+ [1,14,20,6,3,4,3,0,[3,4,2,5,13,22,23,27,8,9],[20,7,8,2,9,21,17]],
+ [1,14,19,2,3,5,3,0,[29,24,13,4,5,22,23,16,2,28,9,10],[7,13,5,1,15,3,9,6,17]],
+ [1,15,18,6,3,2,1,0,[25,13,22,23,17,29,16,9],[16,21,17,20]],
+ [1,24,25,6,2,3,3,0,[],[]],
+ [1,21,25,1,2,5,3,0,[],[]],
+ [1,21,25,6,3,4,3,0,[],[]]
+ ];
+
+ var nbVillages = V.length;
+
+ for (i=0; i<nbVillages; i++) {
+ if ((((mois == 0) && (1==V[i][0])) || ((mois >= V[i][1]) && (mois <= V[i][2]))) &&
+ ((region == 0) || (region == V[i][3] )) &&
+ ((confort == 0) || (confort == V[i][4] )) &&
+ ((encadrement == 0) ||
+ ((encadrement==3)&&((V[i][5]==1)||(V[i][5]==2)||(V[i][5] == 3))) ||
+ ((encadrement==2)&&((V[i][5]==1)||(V[i][5]==2) )) ||
+ ((encadrement==1)&&(encadrement==V[i][5]) ) ||
+ ((encadrement>3)&&(encadrement==V[i][5]) )) &&
+ ((typeVillage == 0) || (typeVillage == V[i][6] )) &&
+ ((budget == 0) || (budget == V[i][7] ))) {
+
+ bl = 1;
+ if ((sport1 != 0) || (sport2 != 0) || (sport3 != 0)) {
+ bl = 0;
+ liste = V[i][8];
+ taille = liste.length;
+ for (j=0; j<taille; j++) {
+ if ((sport1 == 0) || ((sport1 != 0) && (sport1 == liste[j]))) {
+ bl = 1;
+ break;
+ }
+ }
+ if (bl == 1) {
+ bl = 0;
+ for (j=0; j<taille; j++) {
+ if ((sport2 == 0) || ((sport2 != 0) && (sport2 == liste[j]))) {
+ bl = 1;
+ break;
+ }
+ }
+ }
+ if (bl == 1) {
+ bl = 0;
+ for (j=0; j<taille; j++) {
+ if ((sport3 == 0) || ((sport3 != 0) && (sport3 == liste[j]))) {
+ bl = 1;
+ break;
+ }
+ }
+ }
+ }
+ if ((bl==1) && ((activite1 != 0) || (activite2 != 0) || (activite3 != 0))) {
+ bl = 0;
+ liste = V[i][9];
+ taille = liste.length;
+ for (j=0; j<taille; j++) {
+ if ((activite1 == 0) || ((activite1 != 0) && (activite1 == liste[j]))) {
+ bl = 1;
+ break;
+ }
+ }
+ if (bl == 1) {
+ bl = 0;
+ for (j=0; j<taille; j++) {
+ if ((activite2 == 0) || ((activite2 != 0) && (activite2 == liste[j]))) {
+ bl = 1;
+ break;
+ }
+ }
+ }
+ if (bl == 1) {
+ bl = 0;
+ for (j=0; j<taille; j++) {
+ if ((activite3 == 0) || ((activite3 != 0) && (activite3 == liste[j]))) {
+ bl = 1;
+ break;
+ }
+ }
+ }
+ }
+ if (1 == bl) {
+ ret++;
+ }
+ }
+ }
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-96128-n.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-96128-n.js
new file mode 100644
index 0000000..76987c2
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-96128-n.js
@@ -0,0 +1,64 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS
+* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+* implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation.
+* All Rights Reserved.
+*
+* Contributor(s): jband@netscape.com, pschwartau@netscape.com
+* Date: 29 Aug 2001
+*
+* SUMMARY: Negative test that JS infinite recursion protection works.
+* We expect the code here to fail (i.e. exit code 3), but NOT crash.
+*
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=96128
+*/
+//-----------------------------------------------------------------------------
+var bug = 96128;
+var summary = 'Testing that JS infinite recursion protection works';
+
+
+function objRecurse()
+{
+ /*
+ * jband:
+ *
+ * Causes a stack overflow crash in debug builds of both the browser
+ * and the shell. In the release builds this is safely caught by the
+ * "too much recursion" mechanism. If I remove the 'new' from the code below
+ * this is safely caught in both debug and release builds. The 'new' causes a
+ * lookup for the Constructor name and seems to (at least) double the number
+ * of items on the C stack for the given interpLevel depth.
+ */
+ return new objRecurse();
+}
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ // we expect this to fail (exit code 3), but NOT crash. -
+ var obj = new objRecurse();
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-96526-001.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-96526-001.js
new file mode 100644
index 0000000..8e8549b
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-96526-001.js
@@ -0,0 +1,530 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2002
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 04 Sep 2002
+* SUMMARY: Just seeing that we don't crash when compiling this script -
+*
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=96526
+*
+*/
+//-----------------------------------------------------------------------------
+printBugNumber(96526);
+printStatus("Just seeing that we don't crash when compiling this script -");
+
+
+/*
+ * Function definition with lots of branches, from http://www.newyankee.com
+ */
+function setaction(jumpto)
+{
+ if (jumpto == 0) window.location = "http://www.newyankee.com/GetYankees2.cgi?1.jpg";
+ else if (jumpto == [0]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ImageName";
+ else if (jumpto == [1]) window.location = "http://www.newyankee.com/GetYankees2.cgi?1.jpg";
+ else if (jumpto == [2]) window.location = "http://www.newyankee.com/GetYankees2.cgi?arsrferguson.jpg";
+ else if (jumpto == [3]) window.location = "http://www.newyankee.com/GetYankees2.cgi?akjamesmartin.jpg";
+ else if (jumpto == [4]) window.location = "http://www.newyankee.com/GetYankees2.cgi?aldaverackett.jpg";
+ else if (jumpto == [5]) window.location = "http://www.newyankee.com/GetYankees2.cgi?alericbrasher.jpg";
+ else if (jumpto == [6]) window.location = "http://www.newyankee.com/GetYankees2.cgi?algeorgewatkins.jpg";
+ else if (jumpto == [7]) window.location = "http://www.newyankee.com/GetYankees2.cgi?altoddcruise.jpg";
+ else if (jumpto == [8]) window.location = "http://www.newyankee.com/GetYankees2.cgi?arkevinc.jpg";
+ else if (jumpto == [9]) window.location = "http://www.newyankee.com/GetYankees2.cgi?arpaulmoore.jpg";
+ else if (jumpto == [10]) window.location = "http://www.newyankee.com/GetYankees2.cgi?auphillaird.jpg";
+ else if (jumpto == [11]) window.location = "http://www.newyankee.com/GetYankees2.cgi?azbillhensley.jpg";
+ else if (jumpto == [12]) window.location = "http://www.newyankee.com/GetYankees2.cgi?azcharleshollandjr.jpg";
+ else if (jumpto == [13]) window.location = "http://www.newyankee.com/GetYankees2.cgi?azdaveholland.jpg";
+ else if (jumpto == [14]) window.location = "http://www.newyankee.com/GetYankees2.cgi?azdavidholland.jpg";
+ else if (jumpto == [15]) window.location = "http://www.newyankee.com/GetYankees2.cgi?azdonaldvogt.jpg";
+ else if (jumpto == [16]) window.location = "http://www.newyankee.com/GetYankees2.cgi?azernestortega.jpg";
+ else if (jumpto == [17]) window.location = "http://www.newyankee.com/GetYankees2.cgi?azjeromekeller.jpg";
+ else if (jumpto == [18]) window.location = "http://www.newyankee.com/GetYankees2.cgi?azjimpegfulton.jpg";
+ else if (jumpto == [19]) window.location = "http://www.newyankee.com/GetYankees2.cgi?azjohnbelcher.jpg";
+ else if (jumpto == [20]) window.location = "http://www.newyankee.com/GetYankees2.cgi?azmikejordan.jpg";
+ else if (jumpto == [21]) window.location = "http://www.newyankee.com/GetYankees2.cgi?azrickemry.jpg";
+ else if (jumpto == [22]) window.location = "http://www.newyankee.com/GetYankees2.cgi?azstephensavage.jpg";
+ else if (jumpto == [23]) window.location = "http://www.newyankee.com/GetYankees2.cgi?azsteveferguson.jpg";
+ else if (jumpto == [24]) window.location = "http://www.newyankee.com/GetYankees2.cgi?aztjhorrall.jpg";
+ else if (jumpto == [25]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cabillmeiners.jpg";
+ else if (jumpto == [26]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cabobhadley.jpg";
+ else if (jumpto == [27]) window.location = "http://www.newyankee.com/GetYankees2.cgi?caboblennox.jpg";
+ else if (jumpto == [28]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cabryanshurtz.jpg";
+ else if (jumpto == [29]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cabyroncleveland.jpg";
+ else if (jumpto == [30]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cacesarjimenez.jpg";
+ else if (jumpto == [31]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cadalekirstine.jpg";
+ else if (jumpto == [32]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cadavidlgoeffrion.jpg";
+ else if (jumpto == [33]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cadennisnocerini.jpg";
+ else if (jumpto == [34]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cadianemason.jpg";
+ else if (jumpto == [35]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cadominicpieranunzio.jpg";
+ else if (jumpto == [36]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cadonaldmotter.jpg";
+ else if (jumpto == [37]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cadoncroner.jpg";
+ else if (jumpto == [38]) window.location = "http://www.newyankee.com/GetYankees2.cgi?caelizabethwright.jpg";
+ else if (jumpto == [39]) window.location = "http://www.newyankee.com/GetYankees2.cgi?caericlew.jpg";
+ else if (jumpto == [40]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cafrancissmith.jpg";
+ else if (jumpto == [41]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cafranklombano.jpg";
+ else if (jumpto == [42]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cajaredweaver.jpg";
+ else if (jumpto == [43]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cajerrythompson.jpg";
+ else if (jumpto == [44]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cajimjanssen";
+ else if (jumpto == [45]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cajohncopolillo.jpg";
+ else if (jumpto == [46]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cajohnmessick.jpg";
+ else if (jumpto == [47]) window.location = "http://www.newyankee.com/GetYankees2.cgi?calaynedicker.jpg";
+ else if (jumpto == [48]) window.location = "http://www.newyankee.com/GetYankees2.cgi?caleeannrucker.jpg";
+ else if (jumpto == [49]) window.location = "http://www.newyankee.com/GetYankees2.cgi?camathewsscharch.jpg";
+ else if (jumpto == [50]) window.location = "http://www.newyankee.com/GetYankees2.cgi?camikedunn.jpg";
+ else if (jumpto == [51]) window.location = "http://www.newyankee.com/GetYankees2.cgi?camikeshay.jpg";
+ else if (jumpto == [52]) window.location = "http://www.newyankee.com/GetYankees2.cgi?camikeshepherd.jpg";
+ else if (jumpto == [53]) window.location = "http://www.newyankee.com/GetYankees2.cgi?caphillipfreer.jpg";
+ else if (jumpto == [54]) window.location = "http://www.newyankee.com/GetYankees2.cgi?carandy.jpg";
+ else if (jumpto == [55]) window.location = "http://www.newyankee.com/GetYankees2.cgi?carichardwilliams.jpg";
+ else if (jumpto == [56]) window.location = "http://www.newyankee.com/GetYankees2.cgi?carickgruen.jpg";
+ else if (jumpto == [57]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cascottbartsch.jpg";
+ else if (jumpto == [58]) window.location = "http://www.newyankee.com/GetYankees2.cgi?castevestrapac.jpg";
+ else if (jumpto == [59]) window.location = "http://www.newyankee.com/GetYankees2.cgi?catimwest.jpg";
+ else if (jumpto == [60]) window.location = "http://www.newyankee.com/GetYankees2.cgi?catomrietveld.jpg";
+ else if (jumpto == [61]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cnalainpaquette.jpg";
+ else if (jumpto == [62]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cnalanhill.jpg";
+ else if (jumpto == [63]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cnalguerette.jpg";
+ else if (jumpto == [64]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cnbrianhogg.jpg";
+ else if (jumpto == [65]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cnbrucebeard.jpg";
+ else if (jumpto == [66]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cncraigdavey.jpg";
+ else if (jumpto == [67]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cndanielpattison.jpg";
+ else if (jumpto == [68]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cndenisstjean.jpg";
+ else if (jumpto == [69]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cnglenngray.jpg";
+ else if (jumpto == [70]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cnjeansebastienduguay.jpg";
+ else if (jumpto == [71]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cnjohnbritz.jpg";
+ else if (jumpto == [72]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cnkevinmclean.jpg";
+ else if (jumpto == [73]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cnmarcandrecartier.jpg";
+ else if (jumpto == [74]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cnmarcleblanc.jpg";
+ else if (jumpto == [75]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cnmatthewgiles.jpg";
+ else if (jumpto == [76]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cnmichelrauzon.jpg";
+ else if (jumpto == [77]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cnpierrelalonde.jpg";
+ else if (jumpto == [78]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cnraytyson.jpg";
+ else if (jumpto == [79]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cnrichardboucher.jpg";
+ else if (jumpto == [80]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cnrodbuike.jpg";
+ else if (jumpto == [81]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cnscottpitkeathly.jpg";
+ else if (jumpto == [82]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cnshawndavis.jpg";
+ else if (jumpto == [83]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cnstephanepelletier.jpg";
+ else if (jumpto == [84]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cntodddesroches.jpg";
+ else if (jumpto == [85]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cntonyharnum.jpg";
+ else if (jumpto == [86]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cnwayneconabree.jpg";
+ else if (jumpto == [87]) window.location = "http://www.newyankee.com/GetYankees2.cgi?codavidjbarber.jpg";
+ else if (jumpto == [88]) window.location = "http://www.newyankee.com/GetYankees2.cgi?codonrandquist.jpg";
+ else if (jumpto == [89]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cojeffpalese.jpg";
+ else if (jumpto == [90]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cojohnlowell.jpg";
+ else if (jumpto == [91]) window.location = "http://www.newyankee.com/GetYankees2.cgi?cotroytorgerson.jpg";
+ else if (jumpto == [92]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ctgerrygranatowski.jpg";
+ else if (jumpto == [93]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ctjasonklein.jpg";
+ else if (jumpto == [94]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ctkevinkiss.jpg";
+ else if (jumpto == [95]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ctmikekennedy.jpg";
+ else if (jumpto == [96]) window.location = "http://www.newyankee.com/GetYankees2.cgi?flalancanfield.jpg";
+ else if (jumpto == [97]) window.location = "http://www.newyankee.com/GetYankees2.cgi?flalbertgonzalez.jpg";
+ else if (jumpto == [98]) window.location = "http://www.newyankee.com/GetYankees2.cgi?flbruceloy.jpg";
+ else if (jumpto == [99]) window.location = "http://www.newyankee.com/GetYankees2.cgi?fldandevault.jpg";
+ else if (jumpto == [100]) window.location = "http://www.newyankee.com/GetYankees2.cgi?fldonstclair.jpg";
+ else if (jumpto == [101]) window.location = "http://www.newyankee.com/GetYankees2.cgi?flernestbonnell.jpg";
+ else if (jumpto == [102]) window.location = "http://www.newyankee.com/GetYankees2.cgi?flgeorgebarg.jpg";
+ else if (jumpto == [103]) window.location = "http://www.newyankee.com/GetYankees2.cgi?flgregslavinski.jpg";
+ else if (jumpto == [104]) window.location = "http://www.newyankee.com/GetYankees2.cgi?flgregwaters.jpg";
+ else if (jumpto == [105]) window.location = "http://www.newyankee.com/GetYankees2.cgi?flharoldmiller.jpg";
+ else if (jumpto == [106]) window.location = "http://www.newyankee.com/GetYankees2.cgi?fljackwelch.jpg";
+ else if (jumpto == [107]) window.location = "http://www.newyankee.com/GetYankees2.cgi?flmichaelostrowski.jpg";
+ else if (jumpto == [108]) window.location = "http://www.newyankee.com/GetYankees2.cgi?flpauldoman.jpg";
+ else if (jumpto == [109]) window.location = "http://www.newyankee.com/GetYankees2.cgi?flpaulsessions.jpg";
+ else if (jumpto == [110]) window.location = "http://www.newyankee.com/GetYankees2.cgi?flrandymys.jpg";
+ else if (jumpto == [111]) window.location = "http://www.newyankee.com/GetYankees2.cgi?flraysarnowski.jpg";
+ else if (jumpto == [112]) window.location = "http://www.newyankee.com/GetYankees2.cgi?flrobertcahill.jpg";
+ else if (jumpto == [113]) window.location = "http://www.newyankee.com/GetYankees2.cgi?flstevemorrison.jpg";
+ else if (jumpto == [114]) window.location = "http://www.newyankee.com/GetYankees2.cgi?flstevezellner.jpg";
+ else if (jumpto == [115]) window.location = "http://www.newyankee.com/GetYankees2.cgi?flterryjennings.jpg";
+ else if (jumpto == [116]) window.location = "http://www.newyankee.com/GetYankees2.cgi?fltimmcwilliams.jpg";
+ else if (jumpto == [117]) window.location = "http://www.newyankee.com/GetYankees2.cgi?fltomstellhorn.jpg";
+ else if (jumpto == [118]) window.location = "http://www.newyankee.com/GetYankees2.cgi?gabobkoch.jpg";
+ else if (jumpto == [119]) window.location = "http://www.newyankee.com/GetYankees2.cgi?gabrucekinney.jpg";
+ else if (jumpto == [120]) window.location = "http://www.newyankee.com/GetYankees2.cgi?gadickbesemer.jpg";
+ else if (jumpto == [121]) window.location = "http://www.newyankee.com/GetYankees2.cgi?gajackclunen.jpg";
+ else if (jumpto == [122]) window.location = "http://www.newyankee.com/GetYankees2.cgi?gajayhart.jpg";
+ else if (jumpto == [123]) window.location = "http://www.newyankee.com/GetYankees2.cgi?gajjgeller.jpg";
+ else if (jumpto == [124]) window.location = "http://www.newyankee.com/GetYankees2.cgi?gakeithlacey.jpg";
+ else if (jumpto == [125]) window.location = "http://www.newyankee.com/GetYankees2.cgi?gamargieminutello.jpg";
+ else if (jumpto == [126]) window.location = "http://www.newyankee.com/GetYankees2.cgi?gamarvinearnest.jpg";
+ else if (jumpto == [127]) window.location = "http://www.newyankee.com/GetYankees2.cgi?gamikeschwarz.jpg";
+ else if (jumpto == [128]) window.location = "http://www.newyankee.com/GetYankees2.cgi?gamikeyee.jpg";
+ else if (jumpto == [129]) window.location = "http://www.newyankee.com/GetYankees2.cgi?garickdubree.jpg";
+ else if (jumpto == [130]) window.location = "http://www.newyankee.com/GetYankees2.cgi?garobimartin.jpg";
+ else if (jumpto == [131]) window.location = "http://www.newyankee.com/GetYankees2.cgi?gastevewaddell.jpg";
+ else if (jumpto == [132]) window.location = "http://www.newyankee.com/GetYankees2.cgi?gathorwiggins.jpg";
+ else if (jumpto == [133]) window.location = "http://www.newyankee.com/GetYankees2.cgi?gawadewylie.jpg";
+ else if (jumpto == [134]) window.location = "http://www.newyankee.com/GetYankees2.cgi?gawaynerobinson.jpg";
+ else if (jumpto == [135]) window.location = "http://www.newyankee.com/GetYankees2.cgi?gepaulwestbury.jpg";
+ else if (jumpto == [136]) window.location = "http://www.newyankee.com/GetYankees2.cgi?grstewartcwolfe.jpg";
+ else if (jumpto == [137]) window.location = "http://www.newyankee.com/GetYankees2.cgi?gugregmesa.jpg";
+ else if (jumpto == [138]) window.location = "http://www.newyankee.com/GetYankees2.cgi?hibriantokunaga.jpg";
+ else if (jumpto == [139]) window.location = "http://www.newyankee.com/GetYankees2.cgi?himatthewgrady.jpg";
+ else if (jumpto == [140]) window.location = "http://www.newyankee.com/GetYankees2.cgi?iabobparnell.jpg";
+ else if (jumpto == [141]) window.location = "http://www.newyankee.com/GetYankees2.cgi?iadougleonard.jpg";
+ else if (jumpto == [142]) window.location = "http://www.newyankee.com/GetYankees2.cgi?iajayharmon.jpg";
+ else if (jumpto == [143]) window.location = "http://www.newyankee.com/GetYankees2.cgi?iajohnbevier.jpg";
+ else if (jumpto == [144]) window.location = "http://www.newyankee.com/GetYankees2.cgi?iamartywitt.jpg";
+ else if (jumpto == [145]) window.location = "http://www.newyankee.com/GetYankees2.cgi?idjasonbartschi.jpg";
+ else if (jumpto == [146]) window.location = "http://www.newyankee.com/GetYankees2.cgi?idkellyklaas.jpg";
+ else if (jumpto == [147]) window.location = "http://www.newyankee.com/GetYankees2.cgi?idmikegagnon.jpg";
+ else if (jumpto == [148]) window.location = "http://www.newyankee.com/GetYankees2.cgi?idrennieheuer.jpg";
+ else if (jumpto == [149]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ilbenshakman.jpg";
+ else if (jumpto == [150]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ilcraigstocks.jpg";
+ else if (jumpto == [151]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ildaverubini.jpg";
+ else if (jumpto == [152]) window.location = "http://www.newyankee.com/GetYankees2.cgi?iledpepin.jpg";
+ else if (jumpto == [153]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ilfredkirpec.jpg";
+ else if (jumpto == [154]) window.location = "http://www.newyankee.com/GetYankees2.cgi?iljoecreed.jpg";
+ else if (jumpto == [155]) window.location = "http://www.newyankee.com/GetYankees2.cgi?iljohnknuth.jpg";
+ else if (jumpto == [156]) window.location = "http://www.newyankee.com/GetYankees2.cgi?iljoshhill.jpg";
+ else if (jumpto == [157]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ilkeithrichard.jpg";
+ else if (jumpto == [158]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ilkrystleweber.jpg";
+ else if (jumpto == [159]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ilmattmusich.jpg";
+ else if (jumpto == [160]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ilmichaellane.jpg";
+ else if (jumpto == [161]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ilrodneyschwandt.jpg";
+ else if (jumpto == [162]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ilrogeraukerman.jpg";
+ else if (jumpto == [163]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ilscottbreeden.jpg";
+ else if (jumpto == [164]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ilscottgerami.jpg";
+ else if (jumpto == [165]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ilsteveritt.jpg";
+ else if (jumpto == [166]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ilthomasfollin.jpg";
+ else if (jumpto == [167]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ilwaynesmith.jpg";
+ else if (jumpto == [168]) window.location = "http://www.newyankee.com/GetYankees2.cgi?inallenwimberly.jpg";
+ else if (jumpto == [169]) window.location = "http://www.newyankee.com/GetYankees2.cgi?inbutchmyers.jpg";
+ else if (jumpto == [170]) window.location = "http://www.newyankee.com/GetYankees2.cgi?inderrickbentley.jpg";
+ else if (jumpto == [171]) window.location = "http://www.newyankee.com/GetYankees2.cgi?inedmeissler.jpg";
+ else if (jumpto == [172]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ingarymartin.jpg";
+ else if (jumpto == [173]) window.location = "http://www.newyankee.com/GetYankees2.cgi?injasondavis.jpg";
+ else if (jumpto == [174]) window.location = "http://www.newyankee.com/GetYankees2.cgi?injeffjones.jpg";
+ else if (jumpto == [175]) window.location = "http://www.newyankee.com/GetYankees2.cgi?injeffwilliams.jpg";
+ else if (jumpto == [176]) window.location = "http://www.newyankee.com/GetYankees2.cgi?injpreslyharrington.jpg";
+ else if (jumpto == [177]) window.location = "http://www.newyankee.com/GetYankees2.cgi?inrichardlouden.jpg";
+ else if (jumpto == [178]) window.location = "http://www.newyankee.com/GetYankees2.cgi?inronmorrell.jpg";
+ else if (jumpto == [179]) window.location = "http://www.newyankee.com/GetYankees2.cgi?insearsweaver.jpg";
+ else if (jumpto == [180]) window.location = "http://www.newyankee.com/GetYankees2.cgi?irpaullaverty.jpg";
+ else if (jumpto == [181]) window.location = "http://www.newyankee.com/GetYankees2.cgi?irseamusmcbride.jpg";
+ else if (jumpto == [182]) window.location = "http://www.newyankee.com/GetYankees2.cgi?isazrielmorag.jpg";
+ else if (jumpto == [183]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ksalankreifels.jpg";
+ else if (jumpto == [184]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ksbrianbudden.jpg";
+ else if (jumpto == [185]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ksgarypahls.jpg";
+ else if (jumpto == [186]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ksmikefarnet.jpg";
+ else if (jumpto == [187]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ksmikethomas.jpg";
+ else if (jumpto == [188]) window.location = "http://www.newyankee.com/GetYankees2.cgi?kstomzillig.jpg";
+ else if (jumpto == [189]) window.location = "http://www.newyankee.com/GetYankees2.cgi?kybillyandrews.jpg";
+ else if (jumpto == [190]) window.location = "http://www.newyankee.com/GetYankees2.cgi?kydaveryno.jpg";
+ else if (jumpto == [191]) window.location = "http://www.newyankee.com/GetYankees2.cgi?kygreglaramore.jpg";
+ else if (jumpto == [192]) window.location = "http://www.newyankee.com/GetYankees2.cgi?kywilliamanderson.jpg";
+ else if (jumpto == [193]) window.location = "http://www.newyankee.com/GetYankees2.cgi?kyzachschuyler.jpg";
+ else if (jumpto == [194]) window.location = "http://www.newyankee.com/GetYankees2.cgi?laadriankliebert.jpg";
+ else if (jumpto == [195]) window.location = "http://www.newyankee.com/GetYankees2.cgi?labarryhumphus.jpg";
+ else if (jumpto == [196]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ladennisanders.jpg";
+ else if (jumpto == [197]) window.location = "http://www.newyankee.com/GetYankees2.cgi?larichardeckert.jpg";
+ else if (jumpto == [198]) window.location = "http://www.newyankee.com/GetYankees2.cgi?laronjames.jpg";
+ else if (jumpto == [199]) window.location = "http://www.newyankee.com/GetYankees2.cgi?lasheldonstutes.jpg";
+ else if (jumpto == [200]) window.location = "http://www.newyankee.com/GetYankees2.cgi?lastephenstarbuck.jpg";
+ else if (jumpto == [201]) window.location = "http://www.newyankee.com/GetYankees2.cgi?latroyestonich.jpg";
+ else if (jumpto == [202]) window.location = "http://www.newyankee.com/GetYankees2.cgi?lavaughntrosclair.jpg";
+ else if (jumpto == [203]) window.location = "http://www.newyankee.com/GetYankees2.cgi?maalexbrown.jpg";
+ else if (jumpto == [204]) window.location = "http://www.newyankee.com/GetYankees2.cgi?maalwencl.jpg";
+ else if (jumpto == [205]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mabrentmills.jpg";
+ else if (jumpto == [206]) window.location = "http://www.newyankee.com/GetYankees2.cgi?madangodziff.jpg";
+ else if (jumpto == [207]) window.location = "http://www.newyankee.com/GetYankees2.cgi?madanielwilusz.jpg";
+ else if (jumpto == [208]) window.location = "http://www.newyankee.com/GetYankees2.cgi?madavidreis.jpg";
+ else if (jumpto == [209]) window.location = "http://www.newyankee.com/GetYankees2.cgi?madougrecko.jpg";
+ else if (jumpto == [210]) window.location = "http://www.newyankee.com/GetYankees2.cgi?majasonhaley.jpg";
+ else if (jumpto == [211]) window.location = "http://www.newyankee.com/GetYankees2.cgi?maklausjensen.jpg";
+ else if (jumpto == [212]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mamikemarland.jpg";
+ else if (jumpto == [213]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mapetersilvestre.jpg";
+ else if (jumpto == [214]) window.location = "http://www.newyankee.com/GetYankees2.cgi?maraysweeney.jpg";
+ else if (jumpto == [215]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mdallenbarnett.jpg";
+ else if (jumpto == [216]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mdcharleswasson.jpg";
+ else if (jumpto == [217]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mdedbaranowski.jpg";
+ else if (jumpto == [218]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mdfranktate.jpg";
+ else if (jumpto == [219]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mdfredschock.jpg";
+ else if (jumpto == [220]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mdianstjohn.jpg";
+ else if (jumpto == [221]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mdjordanevans.jpg";
+ else if (jumpto == [222]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mdpaulwjones.jpg";
+ else if (jumpto == [223]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mestevesandelier.jpg";
+ else if (jumpto == [224]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mewilbertrbrown.jpg";
+ else if (jumpto == [225]) window.location = "http://www.newyankee.com/GetYankees2.cgi?midavidkeller.jpg";
+ else if (jumpto == [226]) window.location = "http://www.newyankee.com/GetYankees2.cgi?migaryvandenberg.jpg";
+ else if (jumpto == [227]) window.location = "http://www.newyankee.com/GetYankees2.cgi?migeorgeberlinger.jpg";
+ else if (jumpto == [228]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mijamesstapleton.jpg";
+ else if (jumpto == [229]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mijerryhaney.jpg";
+ else if (jumpto == [230]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mijohnrybarczyk.jpg";
+ else if (jumpto == [231]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mikeithvalliere.jpg";
+ else if (jumpto == [232]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mikevinpodsiadlik.jpg";
+ else if (jumpto == [233]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mimarkandrews.jpg";
+ else if (jumpto == [234]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mimikedecaussin.jpg";
+ else if (jumpto == [235]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mimikesegorski.jpg";
+ else if (jumpto == [236]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mirobertwolgast.jpg";
+ else if (jumpto == [237]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mitimothybruner.jpg";
+ else if (jumpto == [238]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mitomweaver.jpg";
+ else if (jumpto == [239]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mnbobgontarek.jpg";
+ else if (jumpto == [240]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mnbradbuffington.jpg";
+ else if (jumpto == [241]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mndavewilson.jpg";
+ else if (jumpto == [242]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mngenerajanen.jpg";
+ else if (jumpto == [243]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mnjohnkempkes.jpg";
+ else if (jumpto == [244]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mnkevinhurbanis.jpg";
+ else if (jumpto == [245]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mnmarklansink.jpg";
+ else if (jumpto == [246]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mnpaulmayer.jpg";
+ else if (jumpto == [247]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mnpauloman.jpg";
+ else if (jumpto == [248]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mnwoodylobnitz.jpg";
+ else if (jumpto == [249]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mocurtkempf.jpg";
+ else if (jumpto == [250]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mojerryhenry.jpg";
+ else if (jumpto == [251]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mojimfinney.jpg";
+ else if (jumpto == [252]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mojimrecamper.jpg";
+ else if (jumpto == [253]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mojohntimmons.jpg";
+ else if (jumpto == [254]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mojohnvaughan.jpg";
+ else if (jumpto == [255]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mokenroberts.jpg";
+ else if (jumpto == [256]) window.location = "http://www.newyankee.com/GetYankees2.cgi?momacvoss.jpg";
+ else if (jumpto == [257]) window.location = "http://www.newyankee.com/GetYankees2.cgi?momarktemmer.jpg";
+ else if (jumpto == [258]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mopaulzerjav.jpg";
+ else if (jumpto == [259]) window.location = "http://www.newyankee.com/GetYankees2.cgi?morobtigner.jpg";
+ else if (jumpto == [260]) window.location = "http://www.newyankee.com/GetYankees2.cgi?motomantrim.jpg";
+ else if (jumpto == [261]) window.location = "http://www.newyankee.com/GetYankees2.cgi?mscharleshahn.jpg";
+ else if (jumpto == [262]) window.location = "http://www.newyankee.com/GetYankees2.cgi?msjohnjohnson.jpg";
+ else if (jumpto == [263]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ncandrelopez.jpg";
+ else if (jumpto == [264]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ncedorisak.jpg";
+ else if (jumpto == [265]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ncjimisbell.jpg";
+ else if (jumpto == [266]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ncjohnnydark.jpg";
+ else if (jumpto == [267]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nckevinebert.jpg";
+ else if (jumpto == [268]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nckevinulmer.jpg";
+ else if (jumpto == [269]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ncpeteparis.jpg";
+ else if (jumpto == [270]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ncstevelindsley.jpg";
+ else if (jumpto == [271]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nctimsmith.jpg";
+ else if (jumpto == [272]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nctonylawrence.jpg";
+ else if (jumpto == [273]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ncwyneaston.jpg";
+ else if (jumpto == [274]) window.location = "http://www.newyankee.com/GetYankees2.cgi?neberniedevlin.jpg";
+ else if (jumpto == [275]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nebrentesmoil.jpg";
+ else if (jumpto == [276]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nescottmccullough.jpg";
+ else if (jumpto == [277]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nhalantarring.jpg";
+ else if (jumpto == [278]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nhbjmolinari.jpg";
+ else if (jumpto == [279]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nhbrianmolinari.jpg";
+ else if (jumpto == [280]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nhdanhorning.jpg";
+ else if (jumpto == [281]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nhdonblackden.jpg";
+ else if (jumpto == [282]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nhjimcalandriello.jpg";
+ else if (jumpto == [283]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nhjohngunterman.jpg";
+ else if (jumpto == [284]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nhjohnmagyar.jpg";
+ else if (jumpto == [285]) window.location = "http://www.newyankee.com/GetYankees2.cgi?njbudclarity.jpg";
+ else if (jumpto == [286]) window.location = "http://www.newyankee.com/GetYankees2.cgi?njcraigjones.jpg";
+ else if (jumpto == [287]) window.location = "http://www.newyankee.com/GetYankees2.cgi?njericrowland.jpg";
+ else if (jumpto == [288]) window.location = "http://www.newyankee.com/GetYankees2.cgi?njjimsnyder.jpg";
+ else if (jumpto == [289]) window.location = "http://www.newyankee.com/GetYankees2.cgi?njlarrylevinson.jpg";
+ else if (jumpto == [290]) window.location = "http://www.newyankee.com/GetYankees2.cgi?njlouisdispensiere.jpg";
+ else if (jumpto == [291]) window.location = "http://www.newyankee.com/GetYankees2.cgi?njmarksoloff.jpg";
+ else if (jumpto == [292]) window.location = "http://www.newyankee.com/GetYankees2.cgi?njmichaelhalko.jpg";
+ else if (jumpto == [293]) window.location = "http://www.newyankee.com/GetYankees2.cgi?njmichaelmalkasian.jpg";
+ else if (jumpto == [294]) window.location = "http://www.newyankee.com/GetYankees2.cgi?njnigelmartin.jpg";
+ else if (jumpto == [295]) window.location = "http://www.newyankee.com/GetYankees2.cgi?njrjmolinari.jpg";
+ else if (jumpto == [296]) window.location = "http://www.newyankee.com/GetYankees2.cgi?njtommurasky.jpg";
+ else if (jumpto == [297]) window.location = "http://www.newyankee.com/GetYankees2.cgi?njtomputnam.jpg";
+ else if (jumpto == [298]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nmdalepage.jpg";
+ else if (jumpto == [299]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nmmikethompson.jpg";
+ else if (jumpto == [300]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nvclydekemp.jpg";
+ else if (jumpto == [301]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nvharveyklene.jpg";
+ else if (jumpto == [302]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nvlonsimons.jpg";
+ else if (jumpto == [303]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nyabeweisfelner.jpg";
+ else if (jumpto == [304]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nyanthonygiudice.jpg";
+ else if (jumpto == [305]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nyaustinpierce.jpg";
+ else if (jumpto == [306]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nybrianmonks.jpg";
+ else if (jumpto == [307]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nycharlieporter.jpg";
+ else if (jumpto == [308]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nycorneliuswoglum.jpg";
+ else if (jumpto == [309]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nydennishartwell.jpg";
+ else if (jumpto == [310]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nydennissgheerdt.jpg";
+ else if (jumpto == [311]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nygeorgepettitt.jpg";
+ else if (jumpto == [312]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nyjohndrewes.jpg";
+ else if (jumpto == [313]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nyjohnminichiello.jpg";
+ else if (jumpto == [314]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nykevinwoolever.jpg";
+ else if (jumpto == [315]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nymartyrubinstein.jpg";
+ else if (jumpto == [316]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nyraysicina.jpg";
+ else if (jumpto == [317]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nyrobbartley.jpg";
+ else if (jumpto == [318]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nyrobertkosty.jpg";
+ else if (jumpto == [319]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nystephenbagnato.jpg";
+ else if (jumpto == [320]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nystevegiamundo.jpg";
+ else if (jumpto == [321]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nystevekelly.jpg";
+ else if (jumpto == [322]) window.location = "http://www.newyankee.com/GetYankees2.cgi?nywayneadelkoph.jpg";
+ else if (jumpto == [323]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ohbriannimmo.jpg";
+ else if (jumpto == [324]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ohdavehyman.jpg";
+ else if (jumpto == [325]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ohdavidconant.jpg";
+ else if (jumpto == [326]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ohdennismantovani.jpg";
+ else if (jumpto == [327]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ohgrahambennett.jpg";
+ else if (jumpto == [328]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ohgregbrunk.jpg";
+ else if (jumpto == [329]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ohgregfilbrun.jpg";
+ else if (jumpto == [330]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ohjimreutener.jpg";
+ else if (jumpto == [331]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ohjimrike.jpg";
+ else if (jumpto == [332]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ohkeithsparks.jpg";
+ else if (jumpto == [333]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ohkevindrinan.jpg";
+ else if (jumpto == [334]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ohmichaelhaines.jpg";
+ else if (jumpto == [335]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ohmichaelsteele.jpg";
+ else if (jumpto == [336]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ohpatrickguanciale.jpg";
+ else if (jumpto == [337]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ohscottkelly.jpg";
+ else if (jumpto == [338]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ohscottthomas.jpg";
+ else if (jumpto == [339]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ohstevetuckerman.jpg";
+ else if (jumpto == [340]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ohtedfigurski.jpg";
+ else if (jumpto == [341]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ohterrydonald.jpg";
+ else if (jumpto == [342]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ohtimokeefe.jpg";
+ else if (jumpto == [343]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ohtomhaydock.jpg";
+ else if (jumpto == [344]) window.location = "http://www.newyankee.com/GetYankees2.cgi?okbillsneller.jpg";
+ else if (jumpto == [345]) window.location = "http://www.newyankee.com/GetYankees2.cgi?okbobbulick.jpg";
+ else if (jumpto == [346]) window.location = "http://www.newyankee.com/GetYankees2.cgi?okdaryljones.jpg";
+ else if (jumpto == [347]) window.location = "http://www.newyankee.com/GetYankees2.cgi?okstevetarchek.jpg";
+ else if (jumpto == [348]) window.location = "http://www.newyankee.com/GetYankees2.cgi?okwoodymcelroy.jpg";
+ else if (jumpto == [349]) window.location = "http://www.newyankee.com/GetYankees2.cgi?orcoryeells.jpg";
+ else if (jumpto == [350]) window.location = "http://www.newyankee.com/GetYankees2.cgi?oredcavasso.jpg";
+ else if (jumpto == [351]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ormarkmcculley.jpg";
+ else if (jumpto == [352]) window.location = "http://www.newyankee.com/GetYankees2.cgi?orstevekarthauser.jpg";
+ else if (jumpto == [353]) window.location = "http://www.newyankee.com/GetYankees2.cgi?paalanpalmieri.jpg";
+ else if (jumpto == [354]) window.location = "http://www.newyankee.com/GetYankees2.cgi?pachriscarr.jpg";
+ else if (jumpto == [355]) window.location = "http://www.newyankee.com/GetYankees2.cgi?padansigg.jpg";
+ else if (jumpto == [356]) window.location = "http://www.newyankee.com/GetYankees2.cgi?padavecalabretta.jpg";
+ else if (jumpto == [357]) window.location = "http://www.newyankee.com/GetYankees2.cgi?padennishoffman.jpg";
+ else if (jumpto == [358]) window.location = "http://www.newyankee.com/GetYankees2.cgi?pafrankschlipf.jpg";
+ else if (jumpto == [359]) window.location = "http://www.newyankee.com/GetYankees2.cgi?pajamesevanson.jpg";
+ else if (jumpto == [360]) window.location = "http://www.newyankee.com/GetYankees2.cgi?pajoekrol.jpg";
+ else if (jumpto == [361]) window.location = "http://www.newyankee.com/GetYankees2.cgi?pakatecrimmins.jpg";
+ else if (jumpto == [362]) window.location = "http://www.newyankee.com/GetYankees2.cgi?pamarshallkrebs.jpg";
+ else if (jumpto == [363]) window.location = "http://www.newyankee.com/GetYankees2.cgi?pascottsheaffer.jpg";
+ else if (jumpto == [364]) window.location = "http://www.newyankee.com/GetYankees2.cgi?paterrycrippen.jpg";
+ else if (jumpto == [365]) window.location = "http://www.newyankee.com/GetYankees2.cgi?patjpera.jpg";
+ else if (jumpto == [366]) window.location = "http://www.newyankee.com/GetYankees2.cgi?patoddpatterson.jpg";
+ else if (jumpto == [367]) window.location = "http://www.newyankee.com/GetYankees2.cgi?patomrehm.jpg";
+ else if (jumpto == [368]) window.location = "http://www.newyankee.com/GetYankees2.cgi?pavicschreck.jpg";
+ else if (jumpto == [369]) window.location = "http://www.newyankee.com/GetYankees2.cgi?pawilliamhowen.jpg";
+ else if (jumpto == [370]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ricarlruggieri.jpg";
+ else if (jumpto == [371]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ripetermccrea.jpg";
+ else if (jumpto == [372]) window.location = "http://www.newyankee.com/GetYankees2.cgi?scbillmovius.jpg";
+ else if (jumpto == [373]) window.location = "http://www.newyankee.com/GetYankees2.cgi?scbryanrackley.jpg";
+ else if (jumpto == [374]) window.location = "http://www.newyankee.com/GetYankees2.cgi?scchrisgoodman.jpg";
+ else if (jumpto == [375]) window.location = "http://www.newyankee.com/GetYankees2.cgi?scdarrellmunn.jpg";
+ else if (jumpto == [376]) window.location = "http://www.newyankee.com/GetYankees2.cgi?scdonsandusky.jpg";
+ else if (jumpto == [377]) window.location = "http://www.newyankee.com/GetYankees2.cgi?scscotalexander.jpg";
+ else if (jumpto == [378]) window.location = "http://www.newyankee.com/GetYankees2.cgi?sctimbajuscik.jpg";
+ else if (jumpto == [379]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ststuartcoltart.jpg";
+ else if (jumpto == [380]) window.location = "http://www.newyankee.com/GetYankees2.cgi?tnbilobautista.jpg";
+ else if (jumpto == [381]) window.location = "http://www.newyankee.com/GetYankees2.cgi?tnbrucebowman.jpg";
+ else if (jumpto == [382]) window.location = "http://www.newyankee.com/GetYankees2.cgi?tndavidchipman.jpg";
+ else if (jumpto == [383]) window.location = "http://www.newyankee.com/GetYankees2.cgi?tndavidcizunas.jpg";
+ else if (jumpto == [384]) window.location = "http://www.newyankee.com/GetYankees2.cgi?tndavidreed.jpg";
+ else if (jumpto == [385]) window.location = "http://www.newyankee.com/GetYankees2.cgi?tnhankdunkin.jpg";
+ else if (jumpto == [386]) window.location = "http://www.newyankee.com/GetYankees2.cgi?tnkenwetherington.jpg";
+ else if (jumpto == [387]) window.location = "http://www.newyankee.com/GetYankees2.cgi?tnrickgodboldt.jpg";
+ else if (jumpto == [388]) window.location = "http://www.newyankee.com/GetYankees2.cgi?tnroyowen.jpg";
+ else if (jumpto == [389]) window.location = "http://www.newyankee.com/GetYankees2.cgi?tnsteve.jpg";
+ else if (jumpto == [390]) window.location = "http://www.newyankee.com/GetYankees2.cgi?tntommymercks.jpg";
+ else if (jumpto == [391]) window.location = "http://www.newyankee.com/GetYankees2.cgi?tnwarrenmonroe.jpg";
+ else if (jumpto == [392]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txbillvanpelt.jpg";
+ else if (jumpto == [393]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txcarolynmoncivais.jpg";
+ else if (jumpto == [394]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txchucksteding.jpg";
+ else if (jumpto == [395]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txclintlafont.jpg";
+ else if (jumpto == [396]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txcurthackett.jpg";
+ else if (jumpto == [397]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txdavidmcneill.jpg";
+ else if (jumpto == [398]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txdonowen.jpg";
+ else if (jumpto == [399]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txfrankcox.jpg";
+ else if (jumpto == [400]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txglenbang.jpg";
+ else if (jumpto == [401]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txhowardlaunius.jpg";
+ else if (jumpto == [402]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txjamienorwood.jpg";
+ else if (jumpto == [403]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txjimmarkle.jpg";
+ else if (jumpto == [404]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txjimmcnamara.jpg";
+ else if (jumpto == [405]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txjoelgulker.jpg";
+ else if (jumpto == [406]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txjoeveillon.jpg";
+ else if (jumpto == [407]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txjohnburns.jpg";
+ else if (jumpto == [408]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txkeithmartin.jpg";
+ else if (jumpto == [409]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txkennymiller.jpg";
+ else if (jumpto == [410]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txkirkconstable.jpg";
+ else if (jumpto == [411]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txkylekelley.jpg";
+ else if (jumpto == [412]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txlesjones.jpg";
+ else if (jumpto == [413]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txlynnlacey.jpg";
+ else if (jumpto == [414]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txmarksimmons.jpg";
+ else if (jumpto == [415]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txmauriceharris.jpg";
+ else if (jumpto == [416]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txmichaelbrown.jpg";
+ else if (jumpto == [417]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txrichardthomas.jpg";
+ else if (jumpto == [418]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txrickent.jpg";
+ else if (jumpto == [419]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txtomlovelace.jpg";
+ else if (jumpto == [420]) window.location = "http://www.newyankee.com/GetYankees2.cgi?txvareckwalla.jpg";
+ else if (jumpto == [421]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ukbrianstainton.jpg";
+ else if (jumpto == [422]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ukdavegrimwood.jpg";
+ else if (jumpto == [423]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ukdavidevans.jpg";
+ else if (jumpto == [424]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ukgeoffbogg.jpg";
+ else if (jumpto == [425]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ukgordondale.jpg";
+ else if (jumpto == [426]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ukharborne.jpg";
+ else if (jumpto == [427]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ukjamesobrian.jpg";
+ else if (jumpto == [428]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ukjeffjones.jpg";
+ else if (jumpto == [429]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ukjohnworthington.jpg";
+ else if (jumpto == [430]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ukkeithrobinson.jpg";
+ else if (jumpto == [431]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ukkoojanzen.jpg";
+ else if (jumpto == [432]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ukleewebster.jpg";
+ else if (jumpto == [433]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ukpaultebbutt.jpg";
+ else if (jumpto == [434]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ukriaanstrydom.jpg";
+ else if (jumpto == [435]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ukrickdare.jpg";
+ else if (jumpto == [436]) window.location = "http://www.newyankee.com/GetYankees2.cgi?ukterrychadwick.jpg";
+ else if (jumpto == [437]) window.location = "http://www.newyankee.com/GetYankees2.cgi?utbobcanestrini.jpg";
+ else if (jumpto == [438]) window.location = "http://www.newyankee.com/GetYankees2.cgi?utdonthornock.jpg";
+ else if (jumpto == [439]) window.location = "http://www.newyankee.com/GetYankees2.cgi?vaartgreen.jpg";
+ else if (jumpto == [440]) window.location = "http://www.newyankee.com/GetYankees2.cgi?vabobheller.jpg";
+ else if (jumpto == [441]) window.location = "http://www.newyankee.com/GetYankees2.cgi?vaclintadkins.jpg";
+ else if (jumpto == [442]) window.location = "http://www.newyankee.com/GetYankees2.cgi?vadanieltepe.jpg";
+ else if (jumpto == [443]) window.location = "http://www.newyankee.com/GetYankees2.cgi?vadanmeier.jpg";
+ else if (jumpto == [444]) window.location = "http://www.newyankee.com/GetYankees2.cgi?vadavidminnix.jpg";
+ else if (jumpto == [445]) window.location = "http://www.newyankee.com/GetYankees2.cgi?vadavidyoho.jpg";
+ else if (jumpto == [446]) window.location = "http://www.newyankee.com/GetYankees2.cgi?vadickthornsberry.jpg";
+ else if (jumpto == [447]) window.location = "http://www.newyankee.com/GetYankees2.cgi?vamarksimonds.jpg";
+ else if (jumpto == [448]) window.location = "http://www.newyankee.com/GetYankees2.cgi?vamichaelkoch.jpg";
+ else if (jumpto == [449]) window.location = "http://www.newyankee.com/GetYankees2.cgi?vamikeperozziello.jpg";
+ else if (jumpto == [450]) window.location = "http://www.newyankee.com/GetYankees2.cgi?vamikepingrey.jpg";
+ else if (jumpto == [451]) window.location = "http://www.newyankee.com/GetYankees2.cgi?vapatrickkearney.jpg";
+ else if (jumpto == [452]) window.location = "http://www.newyankee.com/GetYankees2.cgi?vapaulstreet.jpg";
+ else if (jumpto == [453]) window.location = "http://www.newyankee.com/GetYankees2.cgi?vatonydemasi.jpg";
+ else if (jumpto == [454]) window.location = "http://www.newyankee.com/GetYankees2.cgi?vatroylong.jpg";
+ else if (jumpto == [455]) window.location = "http://www.newyankee.com/GetYankees2.cgi?vatroylong2.jpg";
+ else if (jumpto == [456]) window.location = "http://www.newyankee.com/GetYankees2.cgi?vaweslyon.jpg";
+ else if (jumpto == [457]) window.location = "http://www.newyankee.com/GetYankees2.cgi?wabryanthomas.jpg";
+ else if (jumpto == [458]) window.location = "http://www.newyankee.com/GetYankees2.cgi?wageorgebryan.jpg";
+ else if (jumpto == [459]) window.location = "http://www.newyankee.com/GetYankees2.cgi?waglennpiersall.jpg";
+ else if (jumpto == [460]) window.location = "http://www.newyankee.com/GetYankees2.cgi?wajoewanjohi.jpg";
+ else if (jumpto == [461]) window.location = "http://www.newyankee.com/GetYankees2.cgi?wajohndrapala.jpg";
+ else if (jumpto == [462]) window.location = "http://www.newyankee.com/GetYankees2.cgi?wajohnfernstrom.jpg";
+ else if (jumpto == [463]) window.location = "http://www.newyankee.com/GetYankees2.cgi?wajohnmickelson.jpg";
+ else if (jumpto == [464]) window.location = "http://www.newyankee.com/GetYankees2.cgi?wakeithjohnson.jpg";
+ else if (jumpto == [465]) window.location = "http://www.newyankee.com/GetYankees2.cgi?wamarkdenman.jpg";
+ else if (jumpto == [466]) window.location = "http://www.newyankee.com/GetYankees2.cgi?wamiketaylor.jpg";
+ else if (jumpto == [467]) window.location = "http://www.newyankee.com/GetYankees2.cgi?wascottboyd.jpg";
+ else if (jumpto == [468]) window.location = "http://www.newyankee.com/GetYankees2.cgi?wibryanschappel.jpg";
+ else if (jumpto == [469]) window.location = "http://www.newyankee.com/GetYankees2.cgi?widenniszuber.jpg";
+ else if (jumpto == [470]) window.location = "http://www.newyankee.com/GetYankees2.cgi?wigeorgebregar.jpg";
+ else if (jumpto == [471]) window.location = "http://www.newyankee.com/GetYankees2.cgi?wikevinwarren.jpg";
+ else if (jumpto == [472]) window.location = "http://www.newyankee.com/GetYankees2.cgi?wirichorde.jpg";
+ else if (jumpto == [473]) window.location = "http://www.newyankee.com/GetYankees2.cgi?wistevenricks.jpg";
+ else if (jumpto == [474]) window.location = "http://www.newyankee.com/GetYankees2.cgi?wiweswolfrom.jpg";
+ else if (jumpto == [475]) window.location = "http://www.newyankee.com/GetYankees2.cgi?wvdannorby.jpg";
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-96526-002.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-96526-002.js
new file mode 100644
index 0000000..902e062
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-96526-002.js
@@ -0,0 +1,56 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2002
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com, Georgi Guninski
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 04 Sep 2002
+* SUMMARY: Just seeing that we don't crash when compiling this script -
+*
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=96526
+*
+*/
+//-----------------------------------------------------------------------------
+printBugNumber(96526);
+printStatus("Just seeing that we don't crash when compiling this script -");
+
+
+/*
+ * Tail recursion test by Georgi Guninski
+ */
+a="[\"b\"]";
+s="g";
+for(i=0;i<20000;i++)
+ s += a;
+try {eval(s);}
+catch (e) {};
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-96526-003.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-96526-003.js
new file mode 100644
index 0000000..0cc33b9
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Regress/regress-96526-003.js
@@ -0,0 +1,4431 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2002
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 04 Sep 2002
+* SUMMARY: Just seeing that we don't crash when compiling this script -
+*
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=96526
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=133897
+*/
+//-----------------------------------------------------------------------------
+printBugNumber(96526);
+printStatus("Just seeing that we don't crash when compiling this script -");
+
+
+/*
+ * This function comes from http://bugzilla.mozilla.org/show_bug.cgi?id=133897
+ */
+function validId(IDtext)
+{
+var res = "";
+
+if(IDText.value==""){
+ print("You must enter a valid battery #")
+ return false
+}
+else if(IDText.value=="x522"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/alkaline/energizer_e2/energizer2.htm"
+ return true
+}
+else if(IDText.value=="x91"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/alkaline/energizer_e2/energizer2.htm"
+ return true
+}
+else if(IDText.value=="x92"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/alkaline/energizer_e2/energizer2.htm"
+ return true
+}
+else if(IDText.value=="x93"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/alkaline/energizer_e2/energizer2.htm"
+ return true
+}
+else if(IDText.value=="x95"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/alkaline/energizer_e2/energizer2.htm"
+ return true
+}
+else if(IDText.value=="521"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_consumeroem.htm"
+ return true
+ }
+else if(IDText.value=="522"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_consumeroem.htm"
+ return true
+ }
+else if(IDText.value=="528"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_consumeroem.htm"
+ return true
+ }
+else if(IDText.value=="529"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_consumeroem.htm"
+ return true
+ }
+else if(IDText.value=="539"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_consumeroem.htm"
+ return true
+ }
+else if(IDText.value=="e90"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_consumeroem.htm"
+ return true
+ }
+else if(IDText.value=="e91"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_consumeroem.htm"
+ return true
+ }
+else if(IDText.value=="e92"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_consumeroem.htm"
+ return true
+ }
+else if(IDText.value=="e93"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_consumeroem.htm"
+ return true
+ }
+else if(IDText.value=="e95"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_consumeroem.htm"
+ return true
+ }
+else if(IDText.value=="e96"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/alkaline/energizer_e2/energizer2.htm"
+ return true
+ }
+ else if(IDText.value=="en6"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_industrial.htm"
+ return true
+ }
+ else if(IDText.value=="en22"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_industrial.htm"
+ return true
+ }
+ else if(IDText.value=="en90"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_industrial.htm"
+ return true
+ }
+ else if(IDText.value=="en91"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_industrial.htm"
+ return true
+ }
+ else if(IDText.value=="en92"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_industrial.htm"
+ return true
+ }
+ else if(IDText.value=="en93"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_industrial.htm"
+ return true
+ }
+ else if(IDText.value=="en95"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_industrial.htm"
+ return true
+ }
+ else if(IDText.value=="en529"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_industrial.htm"
+ return true
+ }
+ else if(IDText.value=="en539"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_industrial.htm"
+ return true
+ }
+ else if(IDText.value=="en715"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_industrial.htm"
+ return true
+ }
+ else if(IDText.value=="edl4a"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_industrial.htm"
+ return true
+ }
+ else if(IDText.value=="edl4as"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_industrial.htm"
+ return true
+ }
+ else if(IDText.value=="edl4ac"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_industrial.htm"
+ return true
+ }
+ else if(IDText.value=="edl6a"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_industrial.htm"
+ return true
+ }
+else if(IDText.value=="3-0316"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_oem_only.htm"
+ return true
+ }
+else if(IDText.value=="3-0316i"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_oem_only.htm"
+ return true
+ }
+else if(IDText.value=="3-00411"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_oem_only.htm"
+ return true
+ }
+else if(IDText.value=="3-0411i"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_oem_only.htm"
+ return true
+ }
+
+else if(IDText.value=="3-312"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_oem_only.htm"
+ return true
+ }
+else if(IDText.value=="3-312i"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_oem_only.htm"
+ return true
+ }
+
+else if(IDText.value=="3-315"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_oem_only.htm"
+ return true
+ }
+
+else if(IDText.value=="3-315i"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_oem_only.htm"
+ return true
+ }
+
+else if(IDText.value=="3-315innc"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_oem_only.htm"
+ return true
+ }
+
+else if(IDText.value=="3-315iwc"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_oem_only.htm"
+ return true
+ }
+
+else if(IDText.value=="3-315wc"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_oem_only.htm"
+ return true
+ }
+
+else if(IDText.value=="3-335"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_oem_only.htm"
+ return true
+ }
+
+else if(IDText.value=="3-335i"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_oem_only.htm"
+ return true
+ }
+
+else if(IDText.value=="3-335wc"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_oem_only.htm"
+ return true
+ }
+
+else if(IDText.value=="3-335nnci"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_oem_only.htm"
+ return true
+ }
+
+else if(IDText.value=="3-350"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_oem_only.htm"
+ return true
+ }
+
+else if(IDText.value=="3-350i"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_oem_only.htm"
+ return true
+ }
+
+else if(IDText.value=="3-3501wc"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_oem_only.htm"
+ return true
+ }
+
+else if(IDText.value=="3-350wc"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_oem_only.htm"
+ return true
+ }
+
+else if(IDText.value=="3-350nnci"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_oem_only.htm"
+ return true
+ }
+
+else if(IDText.value=="3-361"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_oem_only.htm"
+ return true
+ }
+
+else if(IDText.value=="3-361i"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/alkaline/energizer/alkaline_oem_only.htm"
+ return true
+ }
+
+ else if(IDText.value=="a522"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/alkaline/eveready/value.htm"
+ return true
+ }
+ else if(IDText.value=="a91"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/alkaline/eveready/value.htm"
+ return true
+ }
+ else if(IDText.value=="a92"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/alkaline/eveready/value.htm"
+ return true
+ }
+ else if(IDText.value=="a93"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/alkaline/eveready/value.htm"
+ return true
+ }
+ else if(IDText.value=="a95"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/alkaline/eveready/value.htm"
+ return true
+ }
+
+else if(IDText.value=="510s"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/carbon_zinc/carbon_zinc_consumeroem.htm"
+ return true
+ }
+
+else if(IDText.value=="1209"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/carbon_zinc/carbon_zinc_consumeroem.htm"
+ return true
+ }
+
+else if(IDText.value=="1212"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/carbon_zinc/carbon_zinc_consumeroem.htm"
+ return true
+ }
+
+else if(IDText.value=="1215"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/carbon_zinc/carbon_zinc_consumeroem.htm"
+ return true
+ }
+
+else if(IDText.value=="1222"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/carbon_zinc/carbon_zinc_consumeroem.htm"
+ return true
+ }
+
+else if(IDText.value=="1235"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/carbon_zinc/carbon_zinc_consumeroem.htm"
+ return true
+ }
+
+else if(IDText.value=="1250"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/carbon_zinc/carbon_zinc_consumeroem.htm"
+ return true
+ }
+ else if(IDText.value=="206"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/carbon_zinc/carbon_zinc_industrial.htm"
+ return true
+ }
+
+ else if(IDText.value=="246"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/carbon_zinc/carbon_zinc_industrial.htm"
+ return true
+ }
+
+ else if(IDText.value=="266"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/carbon_zinc/carbon_zinc_industrial.htm"
+ return true
+ }
+
+ else if(IDText.value=="276"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/carbon_zinc/carbon_zinc_industrial.htm"
+ return true
+ }
+
+ else if(IDText.value=="411"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/carbon_zinc/carbon_zinc_industrial.htm"
+ return true
+ }
+
+
+ else if(IDText.value=="412"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/carbon_zinc/carbon_zinc_industrial.htm"
+ return true
+ }
+
+ else if(IDText.value=="413"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/carbon_zinc/carbon_zinc_industrial.htm"
+ return true
+ }
+
+ else if(IDText.value=="415"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/carbon_zinc/carbon_zinc_industrial.htm"
+ return true
+ }
+
+ else if(IDText.value=="416"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/carbon_zinc/carbon_zinc_industrial.htm"
+ return true
+ }
+
+ else if(IDText.value=="455"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/carbon_zinc/carbon_zinc_industrial.htm"
+ return true
+ }
+
+ else if(IDText.value=="467"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/carbon_zinc/carbon_zinc_industrial.htm"
+ return true
+ }
+
+ else if(IDText.value=="489"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/carbon_zinc/carbon_zinc_industrial.htm"
+ return true
+ }
+
+ else if(IDText.value=="493"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/carbon_zinc/carbon_zinc_industrial.htm"
+ return true
+ }
+
+ else if(IDText.value=="497"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/carbon_zinc/carbon_zinc_industrial.htm"
+ return true
+ }
+
+ else if(IDText.value=="504"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/carbon_zinc/carbon_zinc_industrial.htm"
+ return true
+ }
+
+ else if(IDText.value=="505"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/carbon_zinc/carbon_zinc_industrial.htm"
+ return true
+ }
+
+ else if(IDText.value=="711"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/carbon_zinc/carbon_zinc_industrial.htm"
+ return true
+ }
+
+ else if(IDText.value=="732"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/carbon_zinc/carbon_zinc_industrial.htm"
+ return true
+ }
+
+ else if(IDText.value=="763"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/carbon_zinc/carbon_zinc_industrial.htm"
+ return true
+ }
+
+ else if(IDText.value=="ev190"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/carbon_zinc/carbon_zinc_industrial.htm"
+ return true
+ }
+
+ else if(IDText.value=="ev115"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/carbon_zinc/carbon_zinc_industrial.htm"
+ return true
+ }
+
+ else if(IDText.value=="ev122"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/carbon_zinc/carbon_zinc_industrial.htm"
+ return true
+ }
+
+ else if(IDText.value=="ev131"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/carbon_zinc/carbon_zinc_industrial.htm"
+ return true
+ }
+
+ else if(IDText.value=="ev135"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/carbon_zinc/carbon_zinc_industrial.htm"
+ return true
+ }
+
+ else if(IDText.value=="ev150"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/carbon_zinc/carbon_zinc_industrial.htm"
+ return true
+ }
+
+ else if(IDText.value=="hs14196"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/carbon_zinc/carbon_zinc_industrial.htm"
+ return true
+ }
+
+else if(IDText.value=="2l76"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/lithium/lithium.htm"
+ return true
+ }
+else if(IDText.value=="el1cr2"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/lithium/lithium.htm"
+ return true
+ }
+else if(IDText.value=="crv3"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/lithium/lithium.htm"
+ return true
+ }
+
+else if(IDText.value=="el2cr5"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/lithium/lithium.htm"
+ return true
+ }
+
+else if(IDText.value=="el123ap"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/lithium/lithium.htm"
+ return true
+ }
+
+else if(IDText.value=="el223ap"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/lithium/lithium.htm"
+ return true
+ }
+
+else if(IDText.value=="l91"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/lithium/lithium.htm"
+ return true
+ }
+
+else if(IDText.value=="l522"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/lithium/lithium.htm"
+ return true
+ }
+
+else if(IDText.value=="l544"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/lithium/lithium.htm"
+ return true
+ }
+
+else if(IDText.value=="cr1025"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/lithium/lithiummin.htm"
+ return true
+ }
+
+else if(IDText.value=="cr1216"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/lithium/lithiummin.htm"
+ return true
+ }
+
+else if(IDText.value=="cr1220"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/lithium/lithiummin.htm"
+ return true
+ }
+
+else if(IDText.value=="cr1225"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/lithium/lithiummin.htm"
+ return true
+ }
+
+else if(IDText.value=="cr1616"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/lithium/lithiummin.htm"
+ return true
+ }
+
+else if(IDText.value=="cr1620"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/lithium/lithiummin.htm"
+ return true
+ }
+
+else if(IDText.value=="cr1632"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/lithium/lithiummin.htm"
+ return true
+ }
+
+else if(IDText.value=="cr2012"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/lithium/lithiummin.htm"
+ return true
+ }
+
+else if(IDText.value=="cr2016"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/lithium/lithiummin.htm"
+ return true
+ }
+
+else if(IDText.value=="cr2025"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/lithium/lithiummin.htm"
+ return true
+ }
+
+else if(IDText.value=="cr2032"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/lithium/lithiummin.htm"
+ return true
+ }
+
+else if(IDText.value=="cr2320"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/lithium/lithiummin.htm"
+ return true
+ }
+
+else if(IDText.value=="cr2430"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/lithium/lithiummin.htm"
+ return true
+ }
+
+else if(IDText.value=="cr2450"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/lithium/lithiummin.htm"
+ return true
+ }
+ else if(IDText.value=="186"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/manganese_dioxide/manganese_dioxide.htm"
+ return true
+ }
+
+ else if(IDText.value=="189"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/manganese_dioxide/manganese_dioxide.htm"
+ return true
+ }
+
+ else if(IDText.value=="191"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/manganese_dioxide/manganese_dioxide.htm"
+ return true
+ }
+
+ else if(IDText.value=="192"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/manganese_dioxide/manganese_dioxide.htm"
+ return true
+ }
+
+ else if(IDText.value=="193"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/manganese_dioxide/manganese_dioxide.htm"
+ return true
+ }
+
+ else if(IDText.value=="a23"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/manganese_dioxide/manganese_dioxide.htm"
+ return true
+ }
+
+ else if(IDText.value=="a27"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/manganese_dioxide/manganese_dioxide.htm"
+ return true
+ }
+
+ else if(IDText.value=="a76"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/manganese_dioxide/manganese_dioxide.htm"
+ return true
+ }
+
+ else if(IDText.value=="a544"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/manganese_dioxide/manganese_dioxide.htm"
+ return true
+ }
+
+ else if(IDText.value=="e11a"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/manganese_dioxide/manganese_dioxide.htm"
+ return true
+ }
+
+ else if(IDText.value=="e625g"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/manganese_dioxide/manganese_dioxide.htm"
+ return true
+ }
+
+else if(IDText.value=="301"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/silver/silver_oxide.htm"
+ return true
+ }
+
+else if(IDText.value=="303"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/silver/silver_oxide.htm"
+ return true
+ }
+
+else if(IDText.value=="309"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/silver/silver_oxide.htm"
+ return true
+ }
+
+else if(IDText.value=="315"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/silver/silver_oxide.htm"
+ return true
+ }
+
+else if(IDText.value=="317"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/silver/silver_oxide.htm"
+ return true
+ }
+
+else if(IDText.value=="319"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/silver/silver_oxide.htm"
+ return true
+ }
+
+else if(IDText.value=="321"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/silver/silver_oxide.htm"
+ return true
+ }
+
+else if(IDText.value=="329"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/silver/silver_oxide.htm"
+ return true
+ }
+else if(IDText.value=="333"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/silver/silver_oxide.htm"
+ return true
+ }
+else if(IDText.value=="335"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/silver/silver_oxide.htm"
+ return true
+ }
+
+else if(IDText.value=="337"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/silver/silver_oxide.htm"
+ return true
+ }
+
+else if(IDText.value=="339"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/silver/silver_oxide.htm"
+ return true
+ }
+
+else if(IDText.value=="341"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/silver/silver_oxide.htm"
+ return true
+ }
+
+else if(IDText.value=="344"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/silver/silver_oxide.htm"
+ return true
+ }
+
+else if(IDText.value=="346"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/silver/silver_oxide.htm"
+ return true
+ }
+
+else if(IDText.value=="350"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/silver/silver_oxide.htm"
+ return true
+ }
+
+else if(IDText.value=="357"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/silver/silver_oxide.htm"
+ return true
+ }
+
+else if(IDText.value=="361"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/silver/silver_oxide.htm"
+ return true
+ }
+
+else if(IDText.value=="362"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/silver/silver_oxide.htm"
+ return true
+ }
+
+else if(IDText.value=="364"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/silver/silver_oxide.htm"
+ return true
+ }
+
+else if(IDText.value=="365"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/silver/silver_oxide.htm"
+ return true
+ }
+
+else if(IDText.value=="366"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/silver/silver_oxide.htm"
+ return true
+ }
+
+else if(IDText.value=="370"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/silver/silver_oxide.htm"
+ return true
+ }
+
+else if(IDText.value=="371"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/silver/silver_oxide.htm"
+ return true
+ }
+
+else if(IDText.value=="373"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/silver/silver_oxide.htm"
+ return true
+ }
+
+else if(IDText.value=="376"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/silver/silver_oxide.htm"
+ return true
+ }
+
+else if(IDText.value=="377"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/silver/silver_oxide.htm"
+ return true
+ }
+
+else if(IDText.value=="379"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/silver/silver_oxide.htm"
+ return true
+ }
+
+else if(IDText.value=="381"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/silver/silver_oxide.htm"
+ return true
+ }
+
+else if(IDText.value=="384"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/silver/silver_oxide.htm"
+ return true
+ }
+
+else if(IDText.value=="386"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/silver/silver_oxide.htm"
+ return true
+ }
+
+else if(IDText.value=="387s"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/silver/silver_oxide.htm"
+ return true
+ }
+
+else if(IDText.value=="389"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/silver/silver_oxide.htm"
+ return true
+ }
+
+else if(IDText.value=="390"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/silver/silver_oxide.htm"
+ return true
+ }
+
+else if(IDText.value=="391"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/silver/silver_oxide.htm"
+ return true
+ }
+
+else if(IDText.value=="392"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/silver/silver_oxide.htm"
+ return true
+ }
+
+else if(IDText.value=="393"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/silver/silver_oxide.htm"
+ return true
+ }
+
+else if(IDText.value=="394"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/silver/silver_oxide.htm"
+ return true
+ }
+
+else if(IDText.value=="395"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/silver/silver_oxide.htm"
+ return true
+ }
+
+else if(IDText.value=="396"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/silver/silver_oxide.htm"
+ return true
+ }
+
+else if(IDText.value=="397"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/silver/silver_oxide.htm"
+ return true
+ }
+
+else if(IDText.value=="399"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/silver/silver_oxide.htm"
+ return true
+ }
+
+
+else if(IDText.value=="epx76"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/silver/silver_oxide.htm"
+ return true
+ }
+
+ else if(IDText.value=="ac5"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/zinc_air/zinc_air.htm"
+ return true
+ }
+
+ else if(IDText.value=="ac10/230"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/zinc_air/zinc_air.htm"
+ return true
+ }
+ else if(IDText.value=="ac10"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/zinc_air/zinc_air.htm"
+ return true
+ }
+ else if(IDText.value=="ac13"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/zinc_air/zinc_air.htm"
+ return true
+ }
+
+ else if(IDText.value=="ac146x"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/zinc_air/zinc_air.htm"
+ return true
+ }
+
+ else if(IDText.value=="ac312"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/zinc_air/zinc_air.htm"
+ return true
+ }
+
+ else if(IDText.value=="ac675"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/zinc_air/zinc_air.htm"
+ return true
+ }
+
+else if(IDText.value=="chm24"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/accessories/rechargeableaccessories_chrger.htm"
+ return true
+ }
+
+else if(IDText.value=="chm4aa"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/accessories/rechargeableaccessories_chrger.htm"
+ return true
+ }
+
+else if(IDText.value=="chsm"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/accessories/rechargeableaccessories_chrger.htm"
+ return true
+ }
+
+else if(IDText.value=="chm4fc"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/accessories/rechargeableaccessories_chrger.htm"
+ return true
+ }
+
+else if(IDText.value=="cxl1000"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/accessories/rechargeableaccessories_chrger.htm"
+ return true
+ }
+ else if(IDText.value=="nh12"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_nimh.htm"
+ return true
+ }
+ else if(IDText.value=="nh15"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_nimh.htm"
+ return true
+ }
+
+ else if(IDText.value=="nh22"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_nimh.htm"
+ return true
+ }
+
+ else if(IDText.value=="nh35"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_nimh.htm"
+ return true
+ }
+ else if(IDText.value=="nh50"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_nimh.htm"
+ return true
+ }
+
+
+else if(IDText.value=="ccm5060"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscam.htm"
+ return true
+ }
+
+else if(IDText.value=="ccm5260"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscam.htm"
+ return true
+ }
+
+else if(IDText.value=="cm1060h"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscam.htm"
+ return true
+ }
+
+else if(IDText.value=="cm1360"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscam.htm"
+ return true
+ }
+
+else if(IDText.value=="cm2560"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscam.htm"
+ return true
+ }
+
+else if(IDText.value=="cm6136"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscam.htm"
+ return true
+ }
+
+else if(IDText.value=="cv3010"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscam.htm"
+ return true
+ }
+else if(IDText.value=="cv3012"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscam.htm"
+ return true
+ }
+else if(IDText.value=="cv3112"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscam.htm"
+ return true
+ }
+
+else if(IDText.value=="erc510"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscam.htm"
+ return true
+ }
+else if(IDText.value=="erc5160"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscam.htm"
+ return true
+ }
+else if(IDText.value=="erc520"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscam.htm"
+ return true
+ }
+else if(IDText.value=="erc525"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscam.htm"
+ return true
+ }
+else if(IDText.value=="erc530"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscam.htm"
+ return true
+ }
+else if(IDText.value=="erc545"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscam.htm"
+ return true
+ }
+else if(IDText.value=="erc560"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscam.htm"
+ return true
+ }
+else if(IDText.value=="erc570"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscam.htm"
+ return true
+ }
+
+else if(IDText.value=="erc580"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscam.htm"
+ return true
+ }
+else if(IDText.value=="erc590"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscam.htm"
+ return true
+ }
+else if(IDText.value=="erc600"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscam.htm"
+ return true
+ }
+else if(IDText.value=="erc610"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscam.htm"
+ return true
+ }
+else if(IDText.value=="erc620"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscam.htm"
+ return true
+ }
+
+else if(IDText.value=="erc630"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscam.htm"
+ return true
+ }
+
+else if(IDText.value=="erc640"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscam.htm"
+ return true
+ }
+else if(IDText.value=="erc650"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscam.htm"
+ return true
+ }
+else if(IDText.value=="erc660"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscam.htm"
+ return true
+ }
+else if(IDText.value=="erc670"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscam.htm"
+ return true
+ }
+else if(IDText.value=="erc680"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscam.htm"
+ return true
+ }
+else if(IDText.value=="erc700"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscam.htm"
+ return true
+ }
+
+ else if(IDText.value=="cp2360"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscell.htm"
+ return true
+ }
+
+ else if(IDText.value=="cp3036"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscell.htm"
+ return true
+ }
+
+
+ else if(IDText.value=="cp3136"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscell.htm"
+ return true
+ }
+
+ else if(IDText.value=="cp3336"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscell.htm"
+ return true
+ }
+
+ else if(IDText.value=="cp5136"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscell.htm"
+ return true
+ }
+
+ else if(IDText.value=="cp5648"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscell.htm"
+ return true
+ }
+
+ else if(IDText.value=="cp5748"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscell.htm"
+ return true
+ }
+
+ else if(IDText.value=="cp8049"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscell.htm"
+ return true
+ }
+
+ else if(IDText.value=="cp8648"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscell.htm"
+ return true
+ }
+
+
+ else if(IDText.value=="cpv5136"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscell.htm"
+ return true
+ }
+
+
+ else if(IDText.value=="acp5036"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscell.htm"
+ return true
+ }
+
+
+ else if(IDText.value=="acp5136"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscell.htm"
+ return true
+ }
+
+
+ else if(IDText.value=="acp7160"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscell.htm"
+ return true
+ }
+ else if(IDText.value=="erw120"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscell.htm"
+ return true
+ }
+ else if(IDText.value=="erw210"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscell.htm"
+ return true
+ }
+ else if(IDText.value=="erw220"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscell.htm"
+ return true
+ }
+ else if(IDText.value=="erw230"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscell.htm"
+ return true
+ }
+ else if(IDText.value=="erw240"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscell.htm"
+ return true
+ }
+ else if(IDText.value=="erw305"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscell.htm"
+ return true
+ }
+ else if(IDText.value=="erw310"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscell.htm"
+ return true
+ }
+ else if(IDText.value=="erw320"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscell.htm"
+ return true
+ }
+ else if(IDText.value=="erw400"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscell.htm"
+ return true
+ }
+ else if(IDText.value=="erw500"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscell.htm"
+ return true
+ }
+ else if(IDText.value=="erw510"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscell.htm"
+ return true
+ }
+ else if(IDText.value=="erw520"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscell.htm"
+ return true
+ }
+ else if(IDText.value=="erw530"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscell.htm"
+ return true
+ }
+ else if(IDText.value=="erw600"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscell.htm"
+ return true
+ }
+ else if(IDText.value=="erw610"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscell.htm"
+ return true
+ }
+ else if(IDText.value=="erw700"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscell.htm"
+ return true
+ }
+ else if(IDText.value=="erw720"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscell.htm"
+ return true
+ }
+ else if(IDText.value=="erw800"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscell.htm"
+ return true
+ }
+else if(IDText.value=="erp107"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscord.htm"
+ return true
+ }
+else if(IDText.value=="erp110"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscord.htm"
+ return true
+ }
+else if(IDText.value=="erp240"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscord.htm"
+ return true
+ }
+else if(IDText.value=="erp268"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscord.htm"
+ return true
+ }
+else if(IDText.value=="erp275"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscord.htm"
+ return true
+ }
+else if(IDText.value=="erp290"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscord.htm"
+ return true
+ }
+else if(IDText.value=="erp450"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscord.htm"
+ return true
+ }
+else if(IDText.value=="erp506"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscord.htm"
+ return true
+ }
+else if(IDText.value=="erp509"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscord.htm"
+ return true
+ }
+else if(IDText.value=="erp730"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscord.htm"
+ return true
+ }
+else if(IDText.value=="erp9116"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscord.htm"
+ return true
+ }
+else if(IDText.value=="p2312"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscord.htm"
+ return true
+ }
+
+else if(IDText.value=="p2322m"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscord.htm"
+ return true
+ }
+else if(IDText.value=="p2331"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscord.htm"
+ return true
+ }
+
+else if(IDText.value=="p3201"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscord.htm"
+ return true
+ }
+
+else if(IDText.value=="p3301"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscord.htm"
+ return true
+ }
+
+else if(IDText.value=="p3302"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscord.htm"
+ return true
+ }
+
+else if(IDText.value=="p3303"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscord.htm"
+ return true
+ }
+
+else if(IDText.value=="p3306"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscord.htm"
+ return true
+ }
+
+else if(IDText.value=="p3391"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscord.htm"
+ return true
+ }
+
+else if(IDText.value=="p5256"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscord.htm"
+ return true
+ }
+else if(IDText.value=="p7300"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscord.htm"
+ return true
+ }
+
+else if(IDText.value=="p7301"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscord.htm"
+ return true
+ }
+
+else if(IDText.value=="7302"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscord.htm"
+ return true
+ }
+
+else if(IDText.value=="7310"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscord.htm"
+ return true
+ }
+
+else if(IDText.value=="p7320"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscord.htm"
+ return true
+ }
+else if(IDText.value=="p7330"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscord.htm"
+ return true
+ }
+else if(IDText.value=="p7340"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscord.htm"
+ return true
+ }
+
+else if(IDText.value=="p7350"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscord.htm"
+ return true
+ }
+
+else if(IDText.value=="p7360"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscord.htm"
+ return true
+ }
+else if(IDText.value=="p7400"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscord.htm"
+ return true
+ }
+else if(IDText.value=="p7501"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packscord.htm"
+ return true
+ }
+else if(IDText.value=="erd100"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packsdigicam.htm"
+ return true
+ }
+else if(IDText.value=="erd110"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packsdigicam.htm"
+ return true
+ }
+else if(IDText.value=="erd200"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packsdigicam.htm"
+ return true
+ }
+else if(IDText.value=="erd300"){
+ //Checks for id entry
+ res="../batteryinfo/product_offerings/rechargeable_consumer/rechargeable_consumer_packsdigicam.htm"
+ return true
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+else if(IDText.value=="164"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="201"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="216"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="226"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="228"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="311"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="314"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+
+else if(IDText.value=="313"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="323"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="325"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="333cz"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="343"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="354"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="355"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="387"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="388"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="417"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="420"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="457"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="460"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="477"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="479"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="482"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="484"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="487"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="490"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="491"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="496"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="509"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="510f"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="520"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="523"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="531"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="532"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="537"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="538"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="544"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="560"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="561"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="563"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="564"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="565"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="646"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="703"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="706"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="714"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="715"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="716"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="717"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="724"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="731"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="735"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="736"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="738"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="742"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="744"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="750"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="762s"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="773"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="778"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="781"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="812"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="815"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="835"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="850"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="904"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="912"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="915"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="935"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="950"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="1015"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="1035"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="1050"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="1150"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="1231"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="1461"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="1463"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="1562"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="1862"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="2356n"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="2709n"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="2744n"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="2745n"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="2746n"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="2780n"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="ac41e"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="cc1096"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="ccm1460"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="ccm2460"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="ccm4060a"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="ccm4060m"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="cdc100"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="ch12"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="ch15"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="ch2aa"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="ch22"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="ch35"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="ch4"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="ch50"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="cm1060"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="cm1560"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="cm2360"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="cm4160"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="cm6036"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="cm9072"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="cm9172"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="cp2360"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="cp3336"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="cp3536"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="cp3736"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="cp5036"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="cp5160"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="cp5648"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="cp5960"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="cp6072"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="cp6172"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="cp7049"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="cp7072"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="cp7148"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="cp7149"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="cp7160"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="cp7172"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="cp7248"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="cp7261"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="cp7348"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="cp7548"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="cp7661"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="cp7960"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="cp8049"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="cp8136"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="cp8160"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="cp8172"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="cp8248"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="cp8661"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="cp8748"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+
+else if(IDText.value=="cp8948"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="cp8960"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="cp9061"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="cp9148"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="cp9161"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="cp9360"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="cs3336"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="cs5036"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="cs5460"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="cs7048"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="cs7072"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="cs7148"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="cs7149"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="cs7160"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="cs7248"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="cs7261"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="cs7348"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="cs7448"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="cs7548"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="cs7661"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="cs8136"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="cs8648"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="cs9061"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="cs9148"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="cs9161"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="cv2012"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="cv2096"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="cv3010s"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="cv3012"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="cv3060"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="cv3112"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="cv3212"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="e1"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="e1n"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="e3"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="e4"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="e9"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="e12"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="e12n"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="e13e"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="e41e"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="e42"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="e42n"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="e89"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="e115"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="e115n"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="e126"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="e132"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="e132n"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="e133"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="e133n"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="e134"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="e134n"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="e135"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="e135n"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="e136"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="e137"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="e137n"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="e146x"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="e152"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="e163"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="e164"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="e164n"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="e165"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="e169"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="e177"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="e233"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="e233n"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="e235n"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="e236n"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="e286"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="e289"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="e312e"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="e340e"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="e400"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="e400n"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="e401e"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="e401n"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="e450"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="e502"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="e601"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="e625"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="e630"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="e640"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="e640n"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="e675e"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="e302157"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="e302250"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="e302358"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="e302435"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="e302462"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="e302465"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="e302478"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="e302642"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="e302651"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="e302702"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="e302904"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="e302905"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="e302908"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="e303145"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="e303236"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="e303314"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="e303394"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="e303496"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="e303996"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="ea6"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="ea6f"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="ea6ft"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="ea6st"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="en1a"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="en132a"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="en133a"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="en134a"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="en135a"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="en136a"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="en164a"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="en165a"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="en175a"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="en177a"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="en640a"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="ep175"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="ep401e"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="ep675e"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="epx1"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="epx4"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="epx13"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="epx14"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="epx23"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="epx25"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="epx27"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="epx29"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="epx30"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="epx625"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="epx640"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="epx675"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="epx825"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="ev6"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="ev9"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="ev10s"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="ev15"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="ev22"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="ev31"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="ev35"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="ev50"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="ev90"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="ev90hp"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="fcc2"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="hs6"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="hs10s"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="hs15"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="hs31"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="hs35"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="hs50"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="hs90"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="hs95"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="hs150"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="hs6571"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="if6"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="is6"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="is6t"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="p2321m"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="p2322"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="p2326m"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="p7307"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="p7507"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="qcc4"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="s13e"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="s312e"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="s41e"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="s76e"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="t35"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="t50"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="w353"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/contents/discontinued_battery_index.htm"
+ return true
+ }
+else if(IDText.value=="3251"){
+ //Checks for id entry
+ res="../datasheets/flashlights/eveready.htm"
+ return true
+ }
+else if(IDText.value=="4212"){
+ //Checks for id entry
+ res="../datasheets/flashlights/eveready.htm"
+ return true
+ }
+else if(IDText.value=="4251"){
+ //Checks for id entry
+ res="../datasheets/flashlights/eveready.htm"
+ return true
+ }
+else if(IDText.value=="5109"){
+ //Checks for id entry
+ res="../datasheets/flashlights/eveready.htm"
+ return true
+ }
+else if(IDText.value=="2251"){
+ //Checks for id entry
+ res="../datasheets/flashlights/home.htm"
+ return true
+ }
+else if(IDText.value=="e220"){
+ //Checks for id entry
+ res="../datasheets/flashlights/home.htm"
+ return true
+ }
+else if(IDText.value=="e250"){
+ //Checks for id entry
+ res="../datasheets/flashlights/home.htm"
+ return true
+ }
+else if(IDText.value=="e251"){
+ //Checks for id entry
+ res="../datasheets/flashlights/home.htm"
+ return true
+ }
+else if(IDText.value=="e251rc210"){
+ //Checks for id entry
+ res="../datasheets/flashlights/home.htm"
+ return true
+ }
+else if(IDText.value=="erg2c1"){
+ //Checks for id entry
+ res="../datasheets/flashlights/home.htm"
+ return true
+ }
+else if(IDText.value=="glo4aa1"){
+ //Checks for id entry
+ res="../datasheets/flashlights/home.htm"
+ return true
+ }
+else if(IDText.value=="rc220"){
+ //Checks for id entry
+ res="../datasheets/flashlights/home.htm"
+ return true
+ }
+else if(IDText.value=="rc250"){
+ //Checks for id entry
+ res="../datasheets/flashlights/home.htm"
+ return true
+ }
+else if(IDText.value=="x112"){
+ //Checks for id entry
+ res="../datasheets/flashlights/home.htm"
+ return true
+ }
+else if(IDText.value=="x215"){
+ //Checks for id entry
+ res="../datasheets/flashlights/home.htm"
+ return true
+ }
+else if(IDText.value=="4215"){
+ //Checks for id entry
+ res="../datasheets/flashlights/novelty.htm"
+ return true
+ }
+else if(IDText.value=="5215"){
+ //Checks for id entry
+ res="../datasheets/flashlights/novelty.htm"
+ return true
+ }
+else if(IDText.value=="6212"){
+ //Checks for id entry
+ res="../datasheets/flashlights/novelty.htm"
+ return true
+ }
+else if(IDText.value=="bas24a"){
+ //Checks for id entry
+ res="../datasheets/flashlights/novelty.htm"
+ return true
+ }
+else if(IDText.value=="db24a1"){
+ //Checks for id entry
+ res="../datasheets/flashlights/novelty.htm"
+ return true
+ }
+else if(IDText.value=="kcbg"){
+ //Checks for id entry
+ res="../datasheets/flashlights/novelty.htm"
+ return true
+ }
+else if(IDText.value=="kccl"){
+ //Checks for id entry
+ res="../datasheets/flashlights/novelty.htm"
+ return true
+ }
+else if(IDText.value=="kcdl"){
+ //Checks for id entry
+ res="../datasheets/flashlights/novelty.htm"
+ return true
+ }
+else if(IDText.value=="kcl2bu1"){
+ //Checks for id entry
+ res="../datasheets/flashlights/novelty.htm"
+ return true
+ }
+else if(IDText.value=="kcwl"){
+ //Checks for id entry
+ res="../datasheets/flashlights/novelty.htm"
+ return true
+ }
+else if(IDText.value=="ltcr"){
+ //Checks for id entry
+ res="../datasheets/flashlights/novelty.htm"
+ return true
+ }
+else if(IDText.value=="lteb"){
+ //Checks for id entry
+ res="../datasheets/flashlights/novelty.htm"
+ return true
+ }
+else if(IDText.value=="ltpt"){
+ //Checks for id entry
+ res="../datasheets/flashlights/novelty.htm"
+ return true
+ }
+else if(IDText.value=="sl240"){
+ //Checks for id entry
+ res="../datasheets/flashlights/novelty.htm"
+ return true
+ }
+else if(IDText.value=="v220"){
+ //Checks for id entry
+ res="../datasheets/flashlights/novelty.htm"
+ return true
+ }
+else if(IDText.value=="5100"){
+ //Checks for id entry
+ res="../datasheets/flashlights/outdoor.htm"
+ return true
+ }
+else if(IDText.value=="8209"){
+ //Checks for id entry
+ res="../datasheets/flashlights/outdoor.htm"
+ return true
+ }
+else if(IDText.value=="8215"){
+ //Checks for id entry
+ res="../datasheets/flashlights/outdoor.htm"
+ return true
+ }
+else if(IDText.value=="9450"){
+ //Checks for id entry
+ res="../datasheets/flashlights/outdoor.htm"
+ return true
+ }
+else if(IDText.value=="f101"){
+ //Checks for id entry
+ res="../datasheets/flashlights/outdoor.htm"
+ return true
+ }
+else if(IDText.value=="f220"){
+ //Checks for id entry
+ res="../datasheets/flashlights/outdoor.htm"
+ return true
+ }
+else if(IDText.value=="f420"){
+ //Checks for id entry
+ res="../datasheets/flashlights/outdoor.htm"
+ return true
+ }
+else if(IDText.value=="fab4dcm"){
+ //Checks for id entry
+ res="../datasheets/flashlights/outdoor.htm"
+ return true
+ }
+else if(IDText.value=="fl450"){
+ //Checks for id entry
+ res="../datasheets/flashlights/outdoor.htm"
+ return true
+ }
+else if(IDText.value=="k221"){
+ //Checks for id entry
+ res="../datasheets/flashlights/outdoor.htm"
+ return true
+ }
+else if(IDText.value=="k251"){
+ //Checks for id entry
+ res="../datasheets/flashlights/outdoor.htm"
+ return true
+ }
+else if(IDText.value=="led4aa1"){
+ //Checks for id entry
+ res="../datasheets/flashlights/outdoor.htm"
+ return true
+ }
+else if(IDText.value=="sp220"){
+ //Checks for id entry
+ res="../datasheets/flashlights/outdoor.htm"
+ return true
+ }
+else if(IDText.value=="tw420"){
+ //Checks for id entry
+ res="../datasheets/flashlights/outdoor.htm"
+ return true
+ }
+else if(IDText.value=="tw450"){
+ //Checks for id entry
+ res="../datasheets/flashlights/outdoor.htm"
+ return true
+ }
+else if(IDText.value=="wp220"){
+ //Checks for id entry
+ res="../datasheets/flashlights/outdoor.htm"
+ return true
+ }
+else if(IDText.value=="wp250"){
+ //Checks for id entry
+ res="../datasheets/flashlights/outdoor.htm"
+ return true
+ }
+else if(IDText.value=="cfl420"){
+ //Checks for id entry
+ res="../datasheets/flashlights/premium.htm"
+ return true
+ }
+else if(IDText.value=="d410"){
+ //Checks for id entry
+ res="../datasheets/flashlights/premium.htm"
+ return true
+ }
+else if(IDText.value=="d420"){
+ //Checks for id entry
+ res="../datasheets/flashlights/premium.htm"
+ return true
+ }
+else if(IDText.value=="fn450"){
+ //Checks for id entry
+ res="../datasheets/flashlights/work.htm"
+ return true
+ }
+else if(IDText.value=="in215"){
+ //Checks for id entry
+ res="../datasheets/flashlights/work.htm"
+ return true
+ }
+else if(IDText.value=="in251"){
+ //Checks for id entry
+ res="../datasheets/flashlights/work.htm"
+ return true
+ }
+else if(IDText.value=="in351"){
+ //Checks for id entry
+ res="../datasheets/flashlights/work.htm"
+ return true
+ }
+else if(IDText.value=="in421"){
+ //Checks for id entry
+ res="../datasheets/flashlights/work.htm"
+ return true
+ }
+else if(IDText.value=="k220"){
+ //Checks for id entry
+ res="../datasheets/flashlights/work.htm"
+ return true
+ }
+else if(IDText.value=="k250"){
+ //Checks for id entry
+ res="../datasheets/flashlights/work.htm"
+ return true
+ }
+else if(IDText.value=="r215"){
+ //Checks for id entry
+ res="../datasheets/flashlights/work.htm"
+ return true
+ }
+else if(IDText.value=="r250"){
+ //Checks for id entry
+ res="../datasheets/flashlights/work.htm"
+ return true
+ }
+else if(IDText.value=="r450"){
+ //Checks for id entry
+ res="../datasheets/flashlights/work.htm"
+ return true
+ }
+else if(IDText.value=="tuf4d1"){
+ //Checks for id entry
+ res="../datasheets/flashlights/work.htm"
+ return true
+ }
+else if(IDText.value=="v109"){
+ //Checks for id entry
+ res="../datasheets/flashlights/work.htm"
+ return true
+ }
+else if(IDText.value=="v115"){
+ //Checks for id entry
+ res="../datasheets/flashlights/work.htm"
+ return true
+ }
+else if(IDText.value=="v215"){
+ //Checks for id entry
+ res="../datasheets/flashlights/work.htm"
+ return true
+ }
+else if(IDText.value=="v250"){
+ //Checks for id entry
+ res="../datasheets/flashlights/work.htm"
+ return true
+ }
+else if(IDText.value=="val2dl1"){
+ //Checks for id entry
+ res="../datasheets/flashlights/work.htm"
+ return true
+ }
+
+else if(IDText.value=="459"){
+ //Checks for id entry
+ res="../datasheets/flashlights/industrial.htm"
+ return true
+ }
+else if(IDText.value=="208ind"){
+ //Checks for id entry
+ res="../datasheets/flashlights/industrial.htm"
+ return true
+ }
+else if(IDText.value=="231ind"){
+ //Checks for id entry
+ res="../datasheets/flashlights/industrial.htm"
+ return true
+ }
+else if(IDText.value=="1151"){
+ //Checks for id entry
+ res="../datasheets/flashlights/industrial.htm"
+ return true
+ }
+else if(IDText.value=="1251"){
+ //Checks for id entry
+ res="../datasheets/flashlights/industrial.htm"
+ return true
+ }
+else if(IDText.value=="1259"){
+ //Checks for id entry
+ res="../datasheets/flashlights/industrial.htm"
+ return true
+ }
+else if(IDText.value=="1351"){
+ //Checks for id entry
+ res="../datasheets/flashlights/industrial.htm"
+ return true
+ }
+else if(IDText.value=="1359"){
+ //Checks for id entry
+ res="../datasheets/flashlights/industrial.htm"
+ return true
+ }
+else if(IDText.value=="3251r"){
+ //Checks for id entry
+ res="../datasheets/flashlights/industrial.htm"
+ return true
+ }
+else if(IDText.value=="3251wh"){
+ //Checks for id entry
+ res="../datasheets/flashlights/industrial.htm"
+ return true
+ }
+else if(IDText.value=="4212wh"){
+ //Checks for id entry
+ res="../datasheets/flashlights/industrial.htm"
+ return true
+ }
+else if(IDText.value=="4250ind"){
+ //Checks for id entry
+ res="../datasheets/flashlights/industrial.htm"
+ return true
+ }
+else if(IDText.value=="5109ind"){
+ //Checks for id entry
+ res="../datasheets/flashlights/industrial.htm"
+ return true
+ }
+else if(IDText.value=="6212wh"){
+ //Checks for id entry
+ res="../datasheets/flashlights/industrial.htm"
+ return true
+ }
+else if(IDText.value=="9101ind"){
+ //Checks for id entry
+ res="../datasheets/flashlights/industrial.htm"
+ return true
+ }
+else if(IDText.value=="e250y"){
+ //Checks for id entry
+ res="../datasheets/flashlights/industrial.htm"
+ return true
+ }
+else if(IDText.value=="e251y"){
+ //Checks for id entry
+ res="../datasheets/flashlights/industrial.htm"
+ return true
+ }
+else if(IDText.value=="in220"){
+ //Checks for id entry
+ res="../datasheets/flashlights/industrial.htm"
+ return true
+ }
+else if(IDText.value=="in253"){
+ //Checks for id entry
+ res="../datasheets/flashlights/industrial.htm"
+ return true
+ }
+else if(IDText.value=="in420"){
+ //Checks for id entry
+ res="../datasheets/flashlights/industrial.htm"
+ return true
+ }
+else if(IDText.value=="in450"){
+ //Checks for id entry
+ res="../datasheets/flashlights/industrial.htm"
+ return true
+ }
+else if(IDText.value=="indwandr"){
+ //Checks for id entry
+ res="../datasheets/flashlights/industrial.htm"
+ return true
+ }
+else if(IDText.value=="indwandy"){
+ //Checks for id entry
+ res="../datasheets/flashlights/industrial.htm"
+ return true
+ }
+else if(IDText.value=="r215ind"){
+ //Checks for id entry
+ res="../datasheets/flashlights/industrial.htm"
+ return true
+ }
+else if(IDText.value=="pr2"){
+ //Checks for id entry
+ res="../datasheets/flashlights/standard.htm"
+ return true
+ }
+else if(IDText.value=="pr3"){
+ //Checks for id entry
+ res="../datasheets/flashlights/standard.htm"
+ return true
+ }
+else if(IDText.value=="pr4"){
+ //Checks for id entry
+ res="../datasheets/flashlights/standard.htm"
+ return true
+ }
+else if(IDText.value=="pr6"){
+ //Checks for id entry
+ res="../datasheets/flashlights/standard.htm"
+ return true
+ }
+else if(IDText.value=="pr7"){
+ //Checks for id entry
+ res="../datasheets/flashlights/standard.htm"
+ return true
+ }
+else if(IDText.value=="pr12"){
+ //Checks for id entry
+ res="../datasheets/flashlights/standard.htm"
+ return true
+ }
+else if(IDText.value=="pr13"){
+ //Checks for id entry
+ res="../datasheets/flashlights/standard.htm"
+ return true
+ }
+else if(IDText.value=="pr35"){
+ //Checks for id entry
+ res="../datasheets/flashlights/standard.htm"
+ return true
+ }
+else if(IDText.value=="112"){
+ //Checks for id entry
+ res="../datasheets/flashlights/standard.htm"
+ return true
+ }
+else if(IDText.value=="222"){
+ //Checks for id entry
+ res="../datasheets/flashlights/standard.htm"
+ return true
+ }
+else if(IDText.value=="243"){
+ //Checks for id entry
+ res="../datasheets/flashlights/standard.htm"
+ return true
+ }
+else if(IDText.value=="258"){
+ //Checks for id entry
+ res="../datasheets/flashlights/standard.htm"
+ return true
+ }
+else if(IDText.value=="407"){
+ //Checks for id entry
+ res="../datasheets/flashlights/standard.htm"
+ return true
+ }
+else if(IDText.value=="425"){
+ //Checks for id entry
+ res="../datasheets/flashlights/standard.htm"
+ return true
+ }
+else if(IDText.value=="1156"){
+ //Checks for id entry
+ res="../datasheets/flashlights/standard.htm"
+ return true
+ }
+else if(IDText.value=="1651"){
+ //Checks for id entry
+ res="../datasheets/flashlights/standard.htm"
+ return true
+ }
+else if(IDText.value=="kpr102"){
+ //Checks for id entry
+ res="../datasheets/flashlights/krypton.htm"
+ return true
+ }
+else if(IDText.value=="kpr103"){
+ //Checks for id entry
+ res="../datasheets/flashlights/krypton.htm"
+ return true
+ }
+else if(IDText.value=="kpr104"){
+ //Checks for id entry
+ res="../datasheets/flashlights/krypton.htm"
+ return true
+ }
+else if(IDText.value=="kpr113"){
+ //Checks for id entry
+ res="../datasheets/flashlights/krypton.htm"
+ return true
+ }
+else if(IDText.value=="kpr116"){
+ //Checks for id entry
+ res="../datasheets/flashlights/krypton.htm"
+ return true
+ }
+else if(IDText.value=="kpr802"){
+ //Checks for id entry
+ res="../datasheets/flashlights/krypton.htm"
+ return true
+ }
+else if(IDText.value=="skpr823"){
+ //Checks for id entry
+ res="../datasheets/flashlights/krypton.htm"
+ return true
+ }
+else if(IDText.value=="hpr50"){
+ //Checks for id entry
+ res="../datasheets/flashlights/halogenbulb.htm"
+ return true
+ }
+else if(IDText.value=="hpr51"){
+ //Checks for id entry
+ res="../datasheets/flashlights/halogenbulb.htm"
+ return true
+ }
+else if(IDText.value=="hpr52"){
+ //Checks for id entry
+ res="../datasheets/flashlights/halogenbulb.htm"
+ return true
+ }
+else if(IDText.value=="hpr53"){
+ //Checks for id entry
+ res="../datasheets/flashlights/halogenbulb.htm"
+ return true
+ }
+else if(IDText.value=="f4t5"){
+ //Checks for id entry
+ res="../datasheets/flashlights/fluorescent.htm"
+ return true
+ }
+else if(IDText.value=="f6t5"){
+ //Checks for id entry
+ res="../datasheets/flashlights/fluorescent.htm"
+ return true
+ }
+else if(IDText.value=="t1-1"){
+ //Checks for id entry
+ res="../datasheets/flashlights/highintensity.htm"
+ return true
+ }
+else if(IDText.value=="t1-2"){
+ //Checks for id entry
+ res="../datasheets/flashlights/highintensity.htm"
+ return true
+ }
+else if(IDText.value=="t2-2"){
+ //Checks for id entry
+ res="../datasheets/flashlights/halogenxenon.htm"
+ return true
+ }
+else if(IDText.value=="t2-3"){
+ //Checks for id entry
+ res="../datasheets/flashlights/halogenxenon.htm"
+ return true
+ }
+else if(IDText.value=="t2-4"){
+ //Checks for id entry
+ res="../datasheets/flashlights/halogenxenon.htm"
+ return true
+ }
+else if(IDText.value=="tx15-2"){
+ //Checks for id entry
+ res="../datasheets/flashlights/halogenxenon.htm"
+ return true
+ }
+else if(IDText.value=="4546ib"){
+ //Checks for id entry
+ res="../datasheets/flashlights/industrialbulb.htm"
+ return true
+ }
+else if(IDText.value=="LED"){
+ //Checks for id entry
+ res="../datasheets/flashlights/led.htm"
+ return true
+ }
+
+
+
+else if(IDText.value=="108"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/flashlights/discontinued_flashlight_index.htm"
+ return true
+ }
+else if(IDText.value=="209"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/flashlights/discontinued_flashlight_index.htm"
+ return true
+ }
+else if(IDText.value=="330"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/flashlights/discontinued_flashlight_index.htm"
+ return true
+ }
+else if(IDText.value=="330y"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/flashlights/discontinued_flashlight_index.htm"
+ return true
+ }
+else if(IDText.value=="331"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/flashlights/discontinued_flashlight_index.htm"
+ return true
+ }
+else if(IDText.value=="331y"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/flashlights/discontinued_flashlight_index.htm"
+ return true
+ }
+else if(IDText.value=="1251bk"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/flashlights/discontinued_flashlight_index.htm"
+ return true
+ }
+else if(IDText.value=="2253"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/flashlights/discontinued_flashlight_index.htm"
+ return true
+ }
+else if(IDText.value=="3233"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/flashlights/discontinued_flashlight_index.htm"
+ return true
+ }
+else if(IDText.value=="3253"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/flashlights/discontinued_flashlight_index.htm"
+ return true
+ }
+else if(IDText.value=="3415"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/flashlights/discontinued_flashlight_index.htm"
+ return true
+ }
+else if(IDText.value=="3452"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/flashlights/discontinued_flashlight_index.htm"
+ return true
+ }
+else if(IDText.value=="4220"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/flashlights/discontinued_flashlight_index.htm"
+ return true
+ }
+else if(IDText.value=="4453"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/flashlights/discontinued_flashlight_index.htm"
+ return true
+ }
+else if(IDText.value=="5154"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/flashlights/discontinued_flashlight_index.htm"
+ return true
+ }
+else if(IDText.value=="5251"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/flashlights/discontinued_flashlight_index.htm"
+ return true
+ }
+else if(IDText.value=="7369"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/flashlights/discontinued_flashlight_index.htm"
+ return true
+ }
+else if(IDText.value=="8115"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/flashlights/discontinued_flashlight_index.htm"
+ return true
+ }
+else if(IDText.value=="8415"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/flashlights/discontinued_flashlight_index.htm"
+ return true
+ }
+else if(IDText.value=="b170"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/flashlights/discontinued_flashlight_index.htm"
+ return true
+ }
+else if(IDText.value=="bkc1"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/flashlights/discontinued_flashlight_index.htm"
+ return true
+ }
+else if(IDText.value=="d620"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/flashlights/discontinued_flashlight_index.htm"
+ return true
+ }
+else if(IDText.value=="d820"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/flashlights/discontinued_flashlight_index.htm"
+ return true
+ }
+else if(IDText.value=="e100"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/flashlights/discontinued_flashlight_index.htm"
+ return true
+ }
+else if(IDText.value=="e252"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/flashlights/discontinued_flashlight_index.htm"
+ return true
+ }
+else if(IDText.value=="e350"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/flashlights/discontinued_flashlight_index.htm"
+ return true
+ }
+else if(IDText.value=="e420"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/flashlights/discontinued_flashlight_index.htm"
+ return true
+ }
+else if(IDText.value=="em290"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/flashlights/discontinued_flashlight_index.htm"
+ return true
+ }
+else if(IDText.value=="em420"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/flashlights/discontinued_flashlight_index.htm"
+ return true
+ }
+else if(IDText.value=="f100"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/flashlights/discontinued_flashlight_index.htm"
+ return true
+ }
+else if(IDText.value=="f215"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/flashlights/discontinued_flashlight_index.htm"
+ return true
+ }
+else if(IDText.value=="f250"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/flashlights/discontinued_flashlight_index.htm"
+ return true
+ }
+else if(IDText.value=="f415"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/flashlights/discontinued_flashlight_index.htm"
+ return true
+ }
+else if(IDText.value=="h100"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/flashlights/discontinued_flashlight_index.htm"
+ return true
+ }
+else if(IDText.value=="h250"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/flashlights/discontinued_flashlight_index.htm"
+ return true
+ }
+else if(IDText.value=="h350"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/flashlights/discontinued_flashlight_index.htm"
+ return true
+ }
+else if(IDText.value=="in25t"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/flashlights/discontinued_flashlight_index.htm"
+ return true
+ }
+else if(IDText.value=="kcdb"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/flashlights/discontinued_flashlight_index.htm"
+ return true
+ }
+else if(IDText.value=="kcsg"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/flashlights/discontinued_flashlight_index.htm"
+ return true
+ }
+else if(IDText.value=="kctw"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/flashlights/discontinued_flashlight_index.htm"
+ return true
+ }
+else if(IDText.value=="rc100"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/flashlights/discontinued_flashlight_index.htm"
+ return true
+ }
+else if(IDText.value=="rc251"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/flashlights/discontinued_flashlight_index.htm"
+ return true
+ }
+else if(IDText.value=="rc290"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/flashlights/discontinued_flashlight_index.htm"
+ return true
+ }
+else if(IDText.value=="t430"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/flashlights/discontinued_flashlight_index.htm"
+ return true
+ }
+else if(IDText.value=="v235"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/flashlights/discontinued_flashlight_index.htm"
+ return true
+ }
+else if(IDText.value=="x250"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/flashlights/discontinued_flashlight_index.htm"
+ return true
+ }
+else if(IDText.value=="x350"){
+ //Checks for id entry
+ print("You have entered a Discontinued Product Number")
+ res="../datasheets/flashlights/discontinued_flashlight_index.htm"
+ return true
+ }
+
+
+
+else {
+ print("You have entered an Invalid Product Number...Please try 'Select Product Group' search.")
+ return false
+ }
+
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-154693.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-154693.js
new file mode 100644
index 0000000..cb946aa
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-154693.js
@@ -0,0 +1,96 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2002
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): igor@icesoft.no; pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 26 Nov 2002
+* SUMMARY: Testing scope
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=154693
+*
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 154693;
+var summary = 'Testing scope';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+function f()
+{
+ function nested() {}
+ return nested;
+}
+var f1 = f();
+var f2 = f();
+
+status = inSection(1);
+actual = (f1 != f2);
+expect = true;
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-181834.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-181834.js
new file mode 100644
index 0000000..50e9d5e
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-181834.js
@@ -0,0 +1,178 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2002
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): felix.meschberger@day.com, pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 25 November 2002
+* SUMMARY: Testing scope
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=181834
+*
+* This bug only bit in Rhino interpreted mode, when the
+* 'compile functions with dynamic scope' feature was set.
+*
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 181834;
+var summary = 'Testing scope';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+/*
+ * If N<=0, |outer_d| just gets incremented once,
+ * so the return value should be 1 in this case.
+ *
+ * If N>0, we end up calling inner() N+1 times:
+ * inner(N), inner(N-1), ... , inner(0).
+ *
+ * Each call to inner() increments |outer_d| by 1.
+ * The last call, inner(0), returns the final value
+ * of |outer_d|, which should be N+1.
+ */
+function outer(N)
+{
+ var outer_d = 0;
+ return inner(N);
+
+ function inner(level)
+ {
+ outer_d++;
+
+ if (level > 0)
+ return inner(level - 1);
+ else
+ return outer_d;
+ }
+}
+
+
+/*
+ * This only has meaning in Rhino -
+ */
+setDynamicScope(true);
+
+/*
+ * Recompile the function |outer| via eval() in order to
+ * feel the effect of the dynamic scope mode we have set.
+ */
+var s = outer.toString();
+eval(s);
+
+status = inSection(1);
+actual = outer(-5);
+expect = 1;
+addThis();
+
+status = inSection(2);
+actual = outer(0);
+expect = 1;
+addThis();
+
+status = inSection(3);
+actual = outer(5);
+expect = 6;
+addThis();
+
+
+/*
+ * Sanity check: do same steps with the dynamic flag off
+ */
+setDynamicScope(false);
+
+/*
+ * Recompile the function |outer| via eval() in order to
+ * feel the effect of the dynamic scope mode we have set.
+ */
+eval(s);
+
+status = inSection(4);
+actual = outer(-5);
+expect = 1;
+addThis();
+
+status = inSection(5);
+actual = outer(0);
+expect = 1;
+addThis();
+
+status = inSection(6);
+actual = outer(5);
+expect = 6;
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function setDynamicScope(flag)
+{
+ if (this.Packages)
+ {
+ var cx = this.Packages.org.mozilla.javascript.Context.getCurrentContext();
+ cx.setCompileFunctionsWithDynamicScope(flag);
+ }
+}
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-184107.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-184107.js
new file mode 100644
index 0000000..23ec234
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-184107.js
@@ -0,0 +1,124 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2002
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): igor@icesoft.no, pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 09 December 2002
+* SUMMARY: with(...) { function f ...} should set f in the global scope
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=184107
+*
+* In fact, any variable defined in a with-block should be created
+* in global scope, i.e. should be a property of the global object.
+*
+* The with-block syntax allows existing local variables to be SET,
+* but does not allow new local variables to be CREATED.
+*
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=159849#c11
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 184107;
+var summary = 'with(...) { function f ...} should set f in the global scope';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+y = 1;
+var obj = {y:10};
+with (obj)
+{
+ // function statement
+ function f()
+ {
+ return y;
+ }
+
+ // function expression
+ g = function() {return y;}
+}
+
+status = inSection(1);
+actual = obj.f;
+expect = undefined;
+addThis();
+
+status = inSection(2);
+actual = f();
+// Mozilla result, which contradicts IE and the ECMA spec: expect = obj.y;
+expect = y;
+addThis();
+
+status = inSection(3);
+actual = obj.g;
+expect = undefined;
+addThis();
+
+status = inSection(4);
+actual = g();
+expect = obj.y;
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-185485.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-185485.js
new file mode 100644
index 0000000..a940b55
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-185485.js
@@ -0,0 +1,158 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2002
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): igor@icesoft.no, pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 16 Dec 2002
+* SUMMARY: Testing |with (x) {function f() {}}| when |x.f| already exists
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=185485
+*
+* The idea is this: if |x| does not already have a property named |f|,
+* a |with| statement cannot be used to define one. See, for example,
+*
+* http://bugzilla.mozilla.org/show_bug.cgi?id=159849#c11
+* http://bugzilla.mozilla.org/show_bug.cgi?id=184107
+*
+*
+* However, if |x| already has a property |f|, a |with| statement can be
+* used to modify the value it contains:
+*
+* with (x) {f = 1;}
+*
+* This should work even if we use a |var| statement, like this:
+*
+* with (x) {var f = 1;}
+*
+* However, it should NOT work if we use a |function| statement, like this:
+*
+* with (x) {function f() {}}
+*
+* Instead, this should newly define a function f in global scope.
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=185485
+*
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 185485;
+var summary = 'Testing |with (x) {function f() {}}| when |x.f| already exists';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+var x = { f:0, g:0 };
+
+with (x)
+{
+ f = 1;
+}
+status = inSection(1);
+actual = x.f;
+expect = 1;
+addThis();
+
+with (x)
+{
+ var f = 2;
+}
+status = inSection(2);
+actual = x.f;
+expect = 2;
+addThis();
+
+/*
+ * Use of a function statement under the with-block should not affect
+ * the local property |f|, but define a function |f| in global scope -
+ */
+with (x)
+{
+ function f() {}
+}
+status = inSection(3);
+actual = x.f;
+expect = 2;
+addThis();
+
+status = inSection(4);
+actual = typeof this.f;
+expect = 'function';
+addThis();
+
+
+/*
+ * Compare use of function expression instead of function statement.
+ * Note it is important that |x.g| already exists. Otherwise, this
+ * would newly define |g| in global scope -
+ */
+with (x)
+{
+ var g = function() {}
+}
+status = inSection(5);
+actual = x.g.toString();
+expect = (function () {}).toString();
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-191276.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-191276.js
new file mode 100644
index 0000000..14ff779
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-191276.js
@@ -0,0 +1,123 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2003
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): igor@icesoft.no, pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 30 January 2003
+* SUMMARY: Testing |this[name]| via Function.prototype.call(), apply()
+*
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=191276
+*
+* Igor: "This script fails when run in Rhino compiled mode, but passes in
+* interpreted mode. Note that presence of the never-called |unused_function|
+* with |f('a')| line is essential; the script works OK without it."
+*
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 191276;
+var summary = 'Testing |this[name]| via Function.prototype.call(), apply()';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+function F(name)
+{
+ return this[name];
+}
+
+function unused_function()
+{
+ F('a');
+}
+
+status = inSection(1);
+actual = F.call({a: 'aaa'}, 'a');
+expect = 'aaa';
+addThis();
+
+status = inSection(2);
+actual = F.apply({a: 'aaa'}, ['a']);
+expect = 'aaa';
+addThis();
+
+/*
+ * Try the same things with an object variable instead of a literal
+ */
+var obj = {a: 'aaa'};
+
+status = inSection(3);
+actual = F.call(obj, 'a');
+expect = 'aaa';
+addThis();
+
+status = inSection(4);
+actual = F.apply(obj, ['a']);
+expect = 'aaa';
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-192226.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-192226.js
new file mode 100644
index 0000000..b898573
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-192226.js
@@ -0,0 +1,120 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2003
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): igor@icesoft.no, pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 07 February 2003
+* SUMMARY: Testing a nested function call under |with| or |catch|
+*
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=192226
+*
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 192226;
+var summary = 'Testing a nested function call under |with| or |catch|';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+var counter = 0;
+
+
+function f()
+{
+ try
+ {
+ with (Math)
+ {
+ test0();
+ test1(sin);
+ }
+ throw 1;
+ }
+ catch (e)
+ {
+ test0();
+ test1(e);
+ }
+}
+
+function test0()
+{
+ ++counter;
+}
+
+function test1(arg)
+{
+ ++counter;
+}
+
+
+status = inSection(1);
+f(); // sets |counter|
+actual = counter;
+expect = 4;
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-202678-001.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-202678-001.js
new file mode 100644
index 0000000..51e80e2
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-202678-001.js
@@ -0,0 +1,131 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2003
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): svendtofte@svendtofte.com, pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 19 April 2003
+* SUMMARY: Testing nested function scope capture
+*
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=202678
+*
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 202678;
+var summary = 'Testing nested function scope capture';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+var self = this;
+
+
+function myFunc()
+{
+ var hidden = 'aaa';
+ insideFunc();
+
+ if (!self.runOnce)
+ {
+ var hidden = 'bbb';
+ self.outSideFunc = insideFunc;
+ self.runOnce = true;
+ }
+ else
+ {
+ var hidden = 'ccc';
+ }
+
+
+ function insideFunc()
+ {
+ actual = hidden;
+ }
+}
+
+
+
+status = inSection(1);
+myFunc(); // this sets |actual|
+expect = 'aaa';
+addThis();
+
+status = inSection(2);
+outSideFunc(); // sets |actual|
+expect = 'bbb';
+addThis();
+
+status = inSection(3);
+myFunc(); // sets |actual|
+expect = 'aaa';
+addThis();
+
+status = inSection(4);
+outSideFunc(); // sets |actual|
+expect = 'bbb'; // NOT 'ccc'
+addThis();
+
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-202678-002.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-202678-002.js
new file mode 100644
index 0000000..15a027a
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-202678-002.js
@@ -0,0 +1,132 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2003
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): svendtofte@svendtofte.com, pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 19 April 2003
+* SUMMARY: Testing nested function scope capture
+*
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=202678
+*
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 202678;
+var summary = 'Testing nested function scope capture';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+var self = this;
+
+
+function myFunc()
+{
+ var hidden = 'aaa';
+ insideFunc();
+
+ if (!self.runOnce)
+ {
+ var hidden = 'bbb';
+ self.outSideFunc = insideFunc;
+ self.runOnce = true;
+ }
+ else
+ {
+ var hidden = 'ccc';
+ self.outSideFunc = insideFunc;
+ }
+
+
+ function insideFunc()
+ {
+ actual = hidden;
+ }
+}
+
+
+
+status = inSection(1);
+myFunc(); // this sets |actual|
+expect = 'aaa';
+addThis();
+
+status = inSection(2);
+outSideFunc(); // sets |actual|
+expect = 'bbb';
+addThis();
+
+status = inSection(3);
+myFunc(); // sets |actual|
+expect = 'aaa';
+addThis();
+
+status = inSection(4);
+outSideFunc(); // sets |actual|
+expect = 'ccc';
+addThis();
+
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-208496-001.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-208496-001.js
new file mode 100644
index 0000000..61ac4cd
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-208496-001.js
@@ -0,0 +1,169 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2003
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): myngs@hotmail.com, pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 05 June 2003
+* SUMMARY: Testing |with (f)| inside the definition of |function f()|
+*
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=208496
+*
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 208496;
+var summary = 'Testing |with (f)| inside the definition of |function f()|';
+var status = '';
+var statusitems = [];
+var actual = '(TEST FAILURE)';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+/*
+ * GLOBAL SCOPE
+ */
+function f(par)
+{
+ var a = par;
+
+ with(f)
+ {
+ var b = par;
+ actual = b;
+ }
+}
+
+status = inSection(1);
+f('abc'); // this sets |actual|
+expect = 'abc';
+addThis();
+
+status = inSection(2);
+f(111 + 222); // sets |actual|
+expect = 333;
+addThis();
+
+
+/*
+ * EVAL SCOPE
+ */
+var s = '';
+s += 'function F(par)';
+s += '{';
+s += ' var a = par;';
+
+s += ' with(F)';
+s += ' {';
+s += ' var b = par;';
+s += ' actual = b;';
+s += ' }';
+s += '}';
+
+s += 'status = inSection(3);';
+s += 'F("abc");'; // sets |actual|
+s += 'expect = "abc";';
+s += 'addThis();';
+
+s += 'status = inSection(4);';
+s += 'F(111 + 222);'; // sets |actual|
+s += 'expect = 333;';
+s += 'addThis();';
+eval(s);
+
+
+/*
+ * FUNCTION SCOPE
+ */
+function g(par)
+{
+ // Add outer variables to complicate the scope chain -
+ var a = '(TEST FAILURE)';
+ var b = '(TEST FAILURE)';
+ h(par);
+
+ function h(par)
+ {
+ var a = par;
+
+ with(h)
+ {
+ var b = par;
+ actual = b;
+ }
+ }
+}
+
+status = inSection(5);
+g('abc'); // sets |actual|
+expect = 'abc';
+addThis();
+
+status = inSection(6);
+g(111 + 222); // sets |actual|
+expect = 333;
+addThis();
+
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-208496-002.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-208496-002.js
new file mode 100644
index 0000000..75ac242
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-208496-002.js
@@ -0,0 +1,161 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2003
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): myngs@hotmail.com, pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 05 June 2003
+* SUMMARY: Testing |with (f)| inside the definition of |function f()|
+*
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=208496
+*
+* In this test, we check that static function properties of
+* of |f| are read correctly from within the |with(f)| block.
+*
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 208496;
+var summary = 'Testing |with (f)| inside the definition of |function f()|';
+var STATIC_VALUE = 'read the static property';
+var status = '';
+var statusitems = [];
+var actual = '(TEST FAILURE)';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+function f(par)
+{
+ with(f)
+ {
+ actual = par;
+ }
+
+ return par;
+}
+f.par = STATIC_VALUE;
+
+
+status = inSection(1);
+f('abc'); // this sets |actual| inside |f|
+expect = STATIC_VALUE;
+addThis();
+
+// test the return: should be the dynamic value
+status = inSection(2);
+actual = f('abc');
+expect = 'abc';
+addThis();
+
+status = inSection(3);
+f(111 + 222); // sets |actual| inside |f|
+expect = STATIC_VALUE;
+addThis();
+
+// test the return: should be the dynamic value
+status = inSection(4);
+actual = f(111 + 222);
+expect = 333;
+addThis();
+
+
+/*
+ * Add a level of indirection via |x|
+ */
+function g(par)
+{
+ with(g)
+ {
+ var x = par;
+ actual = x;
+ }
+
+ return par;
+}
+g.par = STATIC_VALUE;
+
+
+status = inSection(5);
+g('abc'); // this sets |actual| inside |g|
+expect = STATIC_VALUE;
+addThis();
+
+// test the return: should be the dynamic value
+status = inSection(6);
+actual = g('abc');
+expect = 'abc';
+addThis();
+
+status = inSection(7);
+g(111 + 222); // sets |actual| inside |g|
+expect = STATIC_VALUE;
+addThis();
+
+// test the return: should be the dynamic value
+status = inSection(8);
+actual = g(111 + 222);
+expect = 333;
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-220362.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-220362.js
new file mode 100644
index 0000000..ef65023
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-220362.js
@@ -0,0 +1,111 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2003
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): hannes@helma.at, pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 27 Sep 2003
+* SUMMARY: Calling a local function from global scope
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=220362
+*
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 220362;
+var summary = 'Calling a local function from global scope';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+// creates a local function and calls it immediately
+function a()
+{
+ var x = 'A';
+ var f = function() {return x;};
+ return f();
+}
+
+// creates and returns a local function
+function b()
+{
+ var x = 'B';
+ var f = function() {return x;};
+ return f;
+}
+
+
+status = inSection(1);
+actual = a();
+expect = 'A';
+addThis();
+
+status = inSection(2);
+var f = b();
+actual = f();
+expect = 'B';
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-220584.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-220584.js
new file mode 100644
index 0000000..c0feae2
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-220584.js
@@ -0,0 +1,132 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2003
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): igor@fastmail.fm, pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 29 Sep 2003
+* SUMMARY: Testing __parent__ and __proto__ of Script object
+*
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=220584
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 220584;
+var summary = 'Testing __parent__ and __proto__ of Script object';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+var s;
+
+
+// invoke |Script| as a function
+s = Script('1;');
+
+status = inSection(1);
+actual = s instanceof Object;
+expect = true;
+addThis();
+
+status = inSection(2);
+actual = (s.__parent__ == undefined) || (s.__parent__ == null);
+expect = false;
+addThis();
+
+status = inSection(3);
+actual = (s.__proto__ == undefined) || (s.__proto__ == null);
+expect = false;
+addThis();
+
+status = inSection(4);
+actual = (s + '').length > 0;
+expect = true;
+addThis();
+
+
+// invoke |Script| as a constructor
+s = new Script('1;');
+
+status = inSection(5);
+actual = s instanceof Object;
+expect = true;
+addThis();
+
+status = inSection(6);
+actual = (s.__parent__ == undefined) || (s.__parent__ == null);
+expect = false;
+addThis();
+
+status = inSection(7);
+actual = (s.__proto__ == undefined) || (s.__proto__ == null);
+expect = false;
+addThis();
+
+status = inSection(8);
+actual = (s + '').length > 0;
+expect = true;
+addThis();
+
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-77578-001.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-77578-001.js
new file mode 100644
index 0000000..f508251
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/regress-77578-001.js
@@ -0,0 +1,154 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an
+* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either expressed
+* or implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation.
+* All Rights Reserved.
+*
+* Contributor(s): jrgm@netscape.com, pschwartau@netscape.com
+* Date: 2001-07-11
+*
+* SUMMARY: Testing eval scope inside a function.
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=77578
+*/
+//-------------------------------------------------------------------------------------------------
+var UBound = 0;
+var bug = 77578;
+var summary = 'Testing eval scope inside a function';
+var cnEquals = '=';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+// various versions of JavaScript -
+var JS_VER = [100, 110, 120, 130, 140, 150];
+
+// Note contrast with local variables i,j,k defined below -
+var i = 999;
+var j = 999;
+var k = 999;
+
+
+//--------------------------------------------------
+test();
+//--------------------------------------------------
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ // Run tests A,B,C on each version of JS and store results
+ for (var n=0; n!=JS_VER.length; n++)
+ {
+ testA(JS_VER[n]);
+ }
+ for (var n=0; n!=JS_VER.length; n++)
+ {
+ testB(JS_VER[n]);
+ }
+ for (var n=0; n!=JS_VER.length; n++)
+ {
+ testC(JS_VER[n]);
+ }
+
+
+ // Compare actual values to expected values -
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
+
+
+function testA(ver)
+{
+ // Set the version of JS to test -
+ version(ver);
+
+ // eval the test, so it compiles AFTER version() has executed -
+ var sTestScript = "";
+
+ // Define a local variable i
+ sTestScript += "status = 'Section A of test; JS ' + ver/100;";
+ sTestScript += "var i=1;";
+ sTestScript += "actual = eval('i');";
+ sTestScript += "expect = 1;";
+ sTestScript += "captureThis('i');";
+
+ eval(sTestScript);
+}
+
+
+function testB(ver)
+{
+ // Set the version of JS to test -
+ version(ver);
+
+ // eval the test, so it compiles AFTER version() has executed -
+ var sTestScript = "";
+
+ // Define a local for-loop iterator j
+ sTestScript += "status = 'Section B of test; JS ' + ver/100;";
+ sTestScript += "for(var j=1; j<2; j++)";
+ sTestScript += "{";
+ sTestScript += " actual = eval('j');";
+ sTestScript += "};";
+ sTestScript += "expect = 1;";
+ sTestScript += "captureThis('j');";
+
+ eval(sTestScript);
+}
+
+
+function testC(ver)
+{
+ // Set the version of JS to test -
+ version(ver);
+
+ // eval the test, so it compiles AFTER version() has executed -
+ var sTestScript = "";
+
+ // Define a local variable k in a try-catch block -
+ sTestScript += "status = 'Section C of test; JS ' + ver/100;";
+ sTestScript += "try";
+ sTestScript += "{";
+ sTestScript += " var k=1;";
+ sTestScript += " actual = eval('k');";
+ sTestScript += "}";
+ sTestScript += "catch(e)";
+ sTestScript += "{";
+ sTestScript += "};";
+ sTestScript += "expect = 1;";
+ sTestScript += "captureThis('k');";
+
+ eval(sTestScript);
+}
+
+
+function captureThis(varName)
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = varName + cnEquals + actual;
+ expectedvalues[UBound] = varName + cnEquals + expect;
+ UBound++;
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/scope-001.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/scope-001.js
new file mode 100644
index 0000000..7b3cb02
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/scope-001.js
@@ -0,0 +1,110 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS
+* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+* implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation. All
+* Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+*
+*
+* The idea behind bug 53268 is as follows. The item 'five' below is defined
+* as const, hence is a read-only property of the global object. So if we set
+* obj.__proto__ = this, 'five' should become a read-only propery of obj.
+*
+* If we then change obj.__proto__ to null, obj.five should initially be
+* undefined. We should be able to define obj.five to whatever we want,
+* and be able to access this value as obj.five.
+*
+* Bug 53268 was filed because obj.five could not be set or accessed after
+* obj.__proto__ had been set to the global object and then to null.
+*/
+//-----------------------------------------------------------------------------
+var bug = '53268';
+var status = 'Testing scope after changing obj.__proto__';
+var expect= '';
+var actual = '';
+var obj = {};
+const five = 5;
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+function test()
+{
+ enterFunc ("test");
+ printBugNumber (bug);
+ printStatus (status);
+
+
+ status= 'Step 1: setting obj.__proto__ = global object';
+ obj.__proto__ = this;
+
+ actual = obj.five;
+ expect=5;
+ reportCompare (expect, actual, status);
+
+ obj.five=1;
+ actual = obj.five;
+ expect=5;
+ reportCompare (expect, actual, status);
+
+
+
+ status= 'Step 2: setting obj.__proto__ = null';
+ obj.__proto__ = null;
+
+ actual = obj.five;
+ expect=undefined;
+ reportCompare (expect, actual, status);
+
+ obj.five=2;
+ actual = obj.five;
+ expect=2;
+ reportCompare (expect, actual, status);
+
+
+
+ status= 'Step 3: setting obj.__proto__ to global object again';
+ obj.__proto__ = this;
+
+ actual = obj.five;
+ expect=2; //<--- (FROM STEP 2 ABOVE)
+ reportCompare (expect, actual, status);
+
+ obj.five=3;
+ actual = obj.five;
+ expect=3;
+ reportCompare (expect, actual, status);
+
+
+
+ status= 'Step 4: setting obj.__proto__ to null again';
+ obj.__proto__ = null;
+
+ actual = obj.five;
+ expect=3; //<--- (FROM STEP 3 ABOVE)
+ reportCompare (expect, actual, status);
+
+ obj.five=4;
+ actual = obj.five;
+ expect=4;
+ reportCompare (expect, actual, status);
+
+
+ exitFunc ("test");
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/scope-002.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/scope-002.js
new file mode 100644
index 0000000..6493822
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/scope-002.js
@@ -0,0 +1,121 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an
+* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either expressed
+* or implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation.
+* All Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com, crock@veilnetworks.com
+* Date: 2001-07-02
+*
+* SUMMARY: Testing visibility of outer function from inner function.
+*
+*/
+//-------------------------------------------------------------------------------------------------
+var UBound = 0;
+var bug = '(none)';
+var summary = 'Testing visibility of outer function from inner function';
+var cnCousin = 'Fred';
+var cnColor = 'red';
+var cnMake = 'Toyota';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+// TEST 1
+function Outer()
+{
+
+ function inner()
+ {
+ Outer.cousin = cnCousin;
+ return Outer.cousin;
+ }
+
+ status = 'Section 1 of test';
+ actual = inner();
+ expect = cnCousin;
+ addThis();
+}
+
+
+Outer();
+status = 'Section 2 of test';
+actual = Outer.cousin;
+expect = cnCousin;
+addThis();
+
+
+
+// TEST 2
+function Car(make)
+{
+ this.make = make;
+ Car.prototype.paint = paint;
+
+ function paint()
+ {
+ Car.color = cnColor;
+ Car.prototype.color = Car.color;
+ }
+}
+
+
+var myCar = new Car(cnMake);
+status = 'Section 3 of test';
+actual = myCar.make;
+expect = cnMake;
+addThis();
+
+
+myCar.paint();
+status = 'Section 4 of test';
+actual = myCar.color;
+expect = cnColor;
+addThis();
+
+
+
+//--------------------------------------------------
+test();
+//--------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/scope-003.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/scope-003.js
new file mode 100644
index 0000000..0cb23df
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/scope-003.js
@@ -0,0 +1,122 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an
+* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either expressed
+* or implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation.
+* All Rights Reserved.
+*
+* Contributor(s): coliver@mminternet.com, pschwartau@netscape.com
+* Date: 2001-07-03
+*
+* SUMMARY: Testing scope with nested functions
+*
+* From correspondence with Christopher Oliver <coliver@mminternet.com>:
+*
+* > Running this test with Rhino produces the following exception:
+* >
+* > uncaught JavaScript exception: undefined: Cannot find default value for
+* > object. (line 3)
+* >
+* > This is due to a bug in org.mozilla.javascript.NativeCall which doesn't
+* > implement toString or valueOf or override getDefaultValue.
+* > However, even after I hacked in an implementation of getDefaultValue in
+* > NativeCall, Rhino still produces a different result then SpiderMonkey:
+* >
+* > [object Call]
+* > [object Object]
+* > [object Call]
+*
+* Note the results should be:
+*
+* [object global]
+* [object Object]
+* [object global]
+*
+* This is what we are checking for in this testcase -
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = '(none)';
+var summary = 'Testing scope with nested functions';
+var statprefix = 'Section ';
+var statsuffix = ' of test -';
+var self = this; // capture a reference to the global object;
+var cnGlobal = self.toString();
+var cnObject = (new Object).toString();
+var statusitems = [];
+var actualvalues = [];
+var expectedvalues = [];
+
+
+function a()
+{
+ function b()
+ {
+ capture(this.toString());
+ }
+
+ this.c = function()
+ {
+ capture(this.toString());
+ b();
+ }
+
+ b();
+}
+
+
+var obj = new a(); // captures actualvalues[0]
+obj.c(); // captures actualvalues[1], actualvalues[2]
+
+
+// The values we expect - see introduction above -
+expectedvalues[0] = cnGlobal;
+expectedvalues[1] = cnObject;
+expectedvalues[2] = cnGlobal;
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function capture(val)
+{
+ actualvalues[UBound] = val;
+ statusitems[UBound] = getStatus(UBound);
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
+
+
+function getStatus(i)
+{
+ return statprefix + i + statsuffix;
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/scope-004.js b/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/scope-004.js
new file mode 100644
index 0000000..532ed9a
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/Scope/scope-004.js
@@ -0,0 +1,204 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an
+* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either expressed
+* or implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation.
+* All Rights Reserved.
+*
+* Contributor(s): pschwartau@netscape.com
+* Date: 2001-07-16
+*
+* SUMMARY: Testing visiblity of variables from within a with block.
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=90325
+*/
+//-------------------------------------------------------------------------------------------------
+var UBound = 0;
+var bug = 90325;
+var summary = 'Testing visiblity of variables from within a with block';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+// (compare local definitions which follow) -
+var A = 'global A';
+var B = 'global B';
+var C = 'global C';
+var D = 'global D';
+
+// an object with 'C' and 'D' properties -
+var objTEST = new Object();
+objTEST.C = C;
+objTEST.D = D;
+
+
+status = 'Section 1 of test';
+with (new Object())
+{
+ actual = A;
+ expect = 'global A';
+}
+addThis();
+
+
+status = 'Section 2 of test';
+with (Function)
+{
+ actual = B;
+ expect = 'global B';
+}
+addThis();
+
+
+status = 'Section 3 of test';
+with (this)
+{
+ actual = C;
+ expect = 'global C';
+}
+addThis();
+
+
+status = 'Section 4 of test';
+localA();
+addThis();
+
+status = 'Section 5 of test';
+localB();
+addThis();
+
+status = 'Section 6 of test';
+localC();
+addThis();
+
+status = 'Section 7 of test';
+localC(new Object());
+addThis();
+
+status = 'Section 8 of test';
+localC.apply(new Object());
+addThis();
+
+status = 'Section 9 of test';
+localC.apply(new Object(), [objTEST]);
+addThis();
+
+status = 'Section 10 of test';
+localC.apply(objTEST, [objTEST]);
+addThis();
+
+status = 'Section 11 of test';
+localD(new Object());
+addThis();
+
+status = 'Section 12 of test';
+localD.apply(new Object(), [objTEST]);
+addThis();
+
+status = 'Section 13 of test';
+localD.apply(objTEST, [objTEST]);
+addThis();
+
+
+
+//-------------------------------------------------------------------------------------------------
+test();
+//-------------------------------------------------------------------------------------------------
+
+
+
+// contains a with(new Object()) block -
+function localA()
+{
+ var A = 'local A';
+
+ with(new Object())
+ {
+ actual = A;
+ expect = 'local A';
+ }
+}
+
+
+// contains a with(Number) block -
+function localB()
+{
+ var B = 'local B';
+
+ with(Number)
+ {
+ actual = B;
+ expect = 'local B';
+ }
+}
+
+
+// contains a with(this) block -
+function localC(obj)
+{
+ var C = 'local C';
+
+ with(this)
+ {
+ actual = C;
+ }
+
+ if ('C' in this)
+ expect = this.C;
+ else
+ expect = 'local C';
+}
+
+
+// contains a with(obj) block -
+function localD(obj)
+{
+ var D = 'local D';
+
+ with(obj)
+ {
+ actual = D;
+ }
+
+ if ('D' in obj)
+ expect = obj.D;
+ else
+ expect = 'local D';
+}
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ for (var i = 0; i < UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/String/regress-107771.js b/Source/JavaScriptCore/tests/mozilla/js1_5/String/regress-107771.js
new file mode 100644
index 0000000..3a0b211
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/String/regress-107771.js
@@ -0,0 +1,104 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS
+* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+* implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation.
+* All Rights Reserved.
+*
+* Contributor(s): ajvincent@hotmail.com, pschwartau@netscape.com
+* Date: 31 October 2001
+*
+* SUMMARY: Regression test for bug 107771
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=107771
+*
+* The bug: Section 1 passed, but Sections 2-5 all failed with |actual| == 12
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 107771;
+var summary = "Regression test for bug 107771";
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+var str = '';
+var k = -9999;
+
+
+status = inSection(1);
+str = "AAA//BBB/CCC/";
+k = str.lastIndexOf('/');
+actual = k;
+expect = 12;
+
+status = inSection(2);
+str = str.substring(0, k);
+k = str.lastIndexOf('/');
+actual = k;
+expect = 8;
+addThis();
+
+status = inSection(3);
+str = str.substring(0, k);
+k = str.lastIndexOf('/');
+actual = k;
+expect = 4;
+addThis();
+
+status = inSection(4);
+str = str.substring(0, k);
+k = str.lastIndexOf('/');
+actual = k;
+expect = 3;
+addThis();
+
+status = inSection(5);
+str = str.substring(0, k);
+k = str.lastIndexOf('/');
+actual = k;
+expect = -1;
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/String/regress-179068.js b/Source/JavaScriptCore/tests/mozilla/js1_5/String/regress-179068.js
new file mode 100644
index 0000000..c45f885
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/String/regress-179068.js
@@ -0,0 +1,154 @@
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: NPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Netscape Public License
+* Version 1.1 (the "License"); you may not use this file except in
+* compliance with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2002
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s): igor@icesoft.no, pschwartau@netscape.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the NPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the NPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK *****
+*
+*
+* Date: 09 November 2002
+* SUMMARY: Test that interpreter can handle string literals exceeding 64K
+* See http://bugzilla.mozilla.org/show_bug.cgi?id=179068
+*
+* Test that the interpreter can handle string literals exceeding 64K limit.
+* For that the script passes to eval() "str ='LONG_STRING_LITERAL';" where
+* LONG_STRING_LITERAL is a string with 200K chars.
+*
+* Igor Bukanov explains the technique used below:
+*
+* > Philip Schwartau wrote:
+* >...
+* > Here is the heart of the testcase:
+* >
+* > // Generate 200K long string
+* > var long_str = duplicate(LONG_STR_SEED, N);
+* > var str = "";
+* > eval("str='".concat(long_str, "';"));
+* > var test_is_ok = (str.length == LONG_STR_SEED.length * N);
+* >
+* >
+* > The testcase creates two identical strings, |long_str| and |str|. It
+* > uses eval() simply to assign the value of |long_str| to |str|. Why is
+* > it necessary to have the variable |str|, then? Why not just create
+* > |long_str| and test it? Wouldn't this be enough:
+* >
+* > // Generate 200K long string
+* > var long_str = duplicate(LONG_STR_SEED, N);
+* > var test_is_ok = (long_str.length == LONG_STR_SEED.length * N);
+* >
+* > Or do we specifically need to test eval() to exercise the interpreter?
+*
+* The reason for eval is to test string literals like in 'a string literal
+* with 100 000 characters...', Rhino deals fine with strings generated at
+* run time where lengths > 64K. Without eval it would be necessary to have
+* a test file excedding 64K which is not that polite for CVS and then a
+* special treatment for the compiled mode in Rhino should be added.
+*
+*
+* >
+* > If so, is it important to use the concat() method in the assignment, as
+* > you have done: |eval("str='".concat(long_str, "';"))|, or can we simply
+* > do |eval("str = long_str;")| ?
+*
+* The concat is a replacement for eval("str='"+long_str+"';"), but as
+* long_str is huge, this leads to constructing first a new string via
+* "str='"+long_str and then another one via ("str='"+long_str) + "';"
+* which takes time under JDK 1.1 on a something like StrongArm 200MHz.
+* Calling concat makes less copies, that is why it is used in the
+* duplicate function and this is faster then doing recursion like in the
+* test case to test that 64K different string literals can be handled.
+*
+*/
+//-----------------------------------------------------------------------------
+var UBound = 0;
+var bug = 179068;
+var summary = 'Test that interpreter can handle string literals exceeding 64K';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+var LONG_STR_SEED = "0123456789";
+var N = 20 * 1024;
+var str = "";
+
+
+// Generate 200K long string and assign it to |str| via eval()
+var long_str = duplicate(LONG_STR_SEED, N);
+eval("str='".concat(long_str, "';"));
+
+status = inSection(1);
+actual = str.length == LONG_STR_SEED.length * N
+expect = true;
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function duplicate(str, count)
+{
+ var tmp = new Array(count);
+
+ while (count != 0)
+ tmp[--count] = str;
+
+ return String.prototype.concat.apply("", tmp);
+}
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(bug);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_5/shell.js b/Source/JavaScriptCore/tests/mozilla/js1_5/shell.js
new file mode 100644
index 0000000..5f7f27d
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_5/shell.js
@@ -0,0 +1,180 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ * Rob Ginda rginda@netscape.com
+ */
+
+var FAILED = "FAILED!: ";
+var STATUS = "STATUS: ";
+var BUGNUMBER = "BUGNUMBER: ";
+var VERBOSE = false;
+var SECT_PREFIX = 'Section ';
+var SECT_SUFFIX = ' of test -';
+var callStack = new Array();
+
+/*
+ * The test driver searches for such a phrase in the test output.
+ * If such phrase exists, it will set n as the expected exit code.
+ */
+function expectExitCode(n)
+{
+
+ print('--- NOTE: IN THIS TESTCASE, WE EXPECT EXIT CODE ' + n + ' ---');
+
+}
+
+/*
+ * Statuses current section of a test
+ */
+function inSection(x)
+{
+
+ return SECT_PREFIX + x + SECT_SUFFIX;
+
+}
+
+/*
+ * Some tests need to know if we are in Rhino as opposed to SpiderMonkey
+ */
+function inRhino()
+{
+ return (typeof defineClass == "function");
+}
+
+/*
+ * Report a failure in the 'accepted' manner
+ */
+function reportFailure (msg)
+{
+ var lines = msg.split ("\n");
+ var l;
+ var funcName = currentFunc();
+ var prefix = (funcName) ? "[reported from " + funcName + "] ": "";
+
+ for (var i=0; i<lines.length; i++)
+ print (FAILED + prefix + lines[i]);
+
+}
+
+/*
+ * Print a non-failure message.
+ */
+function printStatus (msg)
+{
+ var lines = msg.split ("\n");
+ var l;
+
+ for (var i=0; i<lines.length; i++)
+ print (STATUS + lines[i]);
+
+}
+
+/*
+ * Print a bugnumber message.
+ */
+function printBugNumber (num)
+{
+
+ print (BUGNUMBER + num);
+
+}
+
+/*
+ * Compare expected result to actual result, if they differ (in value and/or
+ * type) report a failure. If description is provided, include it in the
+ * failure report.
+ */
+function reportCompare (expected, actual, description)
+{
+ var expected_t = typeof expected;
+ var actual_t = typeof actual;
+ var output = "";
+
+ if ((VERBOSE) && (typeof description != "undefined"))
+ printStatus ("Comparing '" + description + "'");
+
+ if (expected_t != actual_t)
+ output += "Type mismatch, expected type " + expected_t +
+ ", actual type " + actual_t + "\n";
+ else if (VERBOSE)
+ printStatus ("Expected type '" + actual_t + "' matched actual " +
+ "type '" + expected_t + "'");
+
+ if (expected != actual)
+ output += "Expected value '" + expected + "', Actual value '" + actual +
+ "'\n";
+ else if (VERBOSE)
+ printStatus ("Expected value '" + actual + "' matched actual " +
+ "value '" + expected + "'");
+
+ if (output != "")
+ {
+ if (typeof description != "undefined")
+ reportFailure (description);
+ reportFailure (output);
+ }
+
+}
+
+/*
+ * Puts funcName at the top of the call stack. This stack is used to show
+ * a function-reported-from field when reporting failures.
+ */
+function enterFunc (funcName)
+{
+
+ if (!funcName.match(/\(\)$/))
+ funcName += "()";
+
+ callStack.push(funcName);
+
+}
+
+/*
+ * Pops the top funcName off the call stack. funcName is optional, and can be
+ * used to check push-pop balance.
+ */
+function exitFunc (funcName)
+{
+ var lastFunc = callStack.pop();
+
+ if (funcName)
+ {
+ if (!funcName.match(/\(\)$/))
+ funcName += "()";
+
+ if (lastFunc != funcName)
+ reportFailure ("Test driver failure, expected to exit function '" +
+ funcName + "' but '" + lastFunc + "' came off " +
+ "the stack");
+ }
+
+}
+
+/*
+ * Peeks at the top of the call stack.
+ */
+function currentFunc()
+{
+
+ return callStack[callStack.length - 1];
+
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_6/Array/browser.js b/Source/JavaScriptCore/tests/mozilla/js1_6/Array/browser.js
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_6/Array/browser.js
@@ -0,0 +1 @@
+
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_6/Array/regress-290592.js b/Source/JavaScriptCore/tests/mozilla/js1_6/Array/regress-290592.js
new file mode 100644
index 0000000..a0c53ca
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_6/Array/regress-290592.js
@@ -0,0 +1,693 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2005
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Mike Shaver
+ * Bob Clary
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+//-----------------------------------------------------------------------------
+var bug = 290592;
+var summary = 'Array extras: forEach, indexOf, filter, map';
+var actual = '';
+var expect = '';
+
+printBugNumber (bug);
+printStatus (summary);
+
+// Utility functions
+
+function identity(v, index, array)
+{
+ reportCompare(v, array[index], 'identity: check callback argument consistency');
+ return v;
+}
+
+function mutate(v, index, array)
+{
+ reportCompare(v, array[index], 'mutate: check callback argument consistency');
+ if (index == 0)
+ {
+ array[1] = 'mutated';
+ delete array[2];
+ array.push('not visited');
+ }
+ return v;
+}
+
+function mutateForEach(v, index, array)
+{
+ reportCompare(v, array[index], 'mutateForEach: check callback argument consistency');
+ if (index == 0)
+ {
+ array[1] = 'mutated';
+ delete array[2];
+ array.push('not visited');
+ }
+ actual += v + ',';
+}
+
+function makeUpperCase(v, index, array)
+{
+ reportCompare(v, array[index], 'makeUpperCase: check callback argument consistency');
+ try
+ {
+ return v.toUpperCase();
+ }
+ catch(e)
+ {
+ }
+ return v;
+}
+
+
+function concat(v, index, array)
+{
+ reportCompare(v, array[index], 'concat: check callback argument consistency');
+ actual += v + ',';
+}
+
+
+function isUpperCase(v, index, array)
+{
+ reportCompare(v, array[index], 'isUpperCase: check callback argument consistency');
+ try
+ {
+ return v == v.toUpperCase();
+ }
+ catch(e)
+ {
+ }
+ return false;
+}
+
+function isString(v, index, array)
+{
+ reportCompare(v, array[index], 'isString: check callback argument consistency');
+ return typeof v == 'string';
+}
+
+
+// callback object.
+function ArrayCallback(state)
+{
+ this.state = state;
+}
+
+ArrayCallback.prototype.makeUpperCase = function (v, index, array)
+{
+ reportCompare(v, array[index], 'ArrayCallback.prototype.makeUpperCase: check callback argument consistency');
+ try
+ {
+ return this.state ? v.toUpperCase() : v.toLowerCase();
+ }
+ catch(e)
+ {
+ }
+ return v;
+};
+
+ArrayCallback.prototype.concat = function(v, index, array)
+{
+ reportCompare(v, array[index], 'ArrayCallback.prototype.concat: check callback argument consistency');
+ actual += v + ',';
+};
+
+ArrayCallback.prototype.isUpperCase = function(v, index, array)
+{
+ reportCompare(v, array[index], 'ArrayCallback.prototype.isUpperCase: check callback argument consistency');
+ try
+ {
+ return this.state ? true : (v == v.toUpperCase());
+ }
+ catch(e)
+ {
+ }
+ return false;
+};
+
+ArrayCallback.prototype.isString = function(v, index, array)
+{
+ reportCompare(v, array[index], 'ArrayCallback.prototype.isString: check callback argument consistency');
+ return this.state ? true : (typeof v == 'string');
+};
+
+function dumpError(e)
+{
+ var s = e.name + ': ' + e.message +
+ ' File: ' + e.fileName +
+ ', Line: ' + e.lineNumber +
+ ', Stack: ' + e.stack;
+ return s;
+}
+
+var obj;
+var strings = ['hello', 'Array', 'WORLD'];
+var mixed = [0, '0', 0];
+var sparsestrings = new Array();
+sparsestrings[2] = 'sparse';
+
+if ('map' in Array.prototype)
+{
+// see http://developer-test.mozilla.org/docs/Core_JavaScript_1.5_Reference:Objects:Array:map
+
+ // test Array.map
+
+ // map has 1 required argument
+ expect = 1;
+ actual = Array.prototype.map.length;
+ reportCompare(expect, actual, 'Array.prototype.map.length == 1');
+
+ // throw TypeError if no callback function specified
+ expect = 'TypeError';
+ try
+ {
+ strings.map();
+ actual = 'no error';
+ }
+ catch(e)
+ {
+ actual = e.name;
+ }
+ reportCompare(expect, actual, 'Array.map(undefined) throws TypeError');
+
+ try
+ {
+ // identity map
+ expect = 'hello,Array,WORLD';
+ actual = strings.map(identity).toString();
+ }
+ catch(e)
+ {
+ actual = dumpError(e);
+ }
+ reportCompare(expect, actual, 'Array.map: identity');
+
+
+ try
+ {
+ expect = 'hello,mutated,';
+ actual = strings.map(mutate).toString();
+ }
+ catch(e)
+ {
+ actual = dumpError(e);
+ }
+ reportCompare(expect, actual, 'Array.map: mutate');
+
+ strings = ['hello', 'Array', 'WORLD'];
+
+ try
+ {
+ // general map
+ expect = 'HELLO,ARRAY,WORLD';
+ actual = strings.map(makeUpperCase).toString();
+ }
+ catch(e)
+ {
+ actual = dumpError(e);
+ }
+ reportCompare(expect, actual, 'Array.map: uppercase');
+
+ try
+ {
+ // pass object method as map callback
+ expect = 'HELLO,ARRAY,WORLD';
+ var obj = new ArrayCallback(true);
+ actual = strings.map(obj.makeUpperCase, obj).toString();
+ }
+ catch(e)
+ {
+ actual = dumpError(e);
+ }
+ reportCompare(expect, actual, 'Array.map: uppercase with object callback');
+
+ try
+ {
+ expect = 'hello,array,world';
+ obj = new ArrayCallback(false);
+ actual = strings.map(obj.makeUpperCase, obj).toString();
+ }
+ catch(e)
+ {
+ actual = dumpError(e);
+ }
+ reportCompare(expect, actual, 'Array.map: lowercase with object callback');
+
+ try
+ {
+ // map on sparse arrays
+ expect = ',,SPARSE';
+ actual = sparsestrings.map(makeUpperCase).toString();
+ }
+ catch(e)
+ {
+ actual = dumpError(e);
+ }
+ reportCompare(expect, actual, 'Array.map: uppercase on sparse array');
+}
+
+if ('forEach' in Array.prototype)
+{
+// see http://developer-test.mozilla.org/docs/Core_JavaScript_1.5_Reference:Objects:Array:forEach
+
+ // test Array.forEach
+
+ // forEach has 1 required argument
+ expect = 1;
+ actual = Array.prototype.forEach.length;
+ reportCompare(expect, actual, 'Array.prototype.forEach.length == 1');
+
+ // throw TypeError if no callback function specified
+ expect = 'TypeError';
+ try
+ {
+ strings.forEach();
+ actual = 'no error';
+ }
+ catch(e)
+ {
+ actual = e.name;
+ }
+ reportCompare(expect, actual, 'Array.forEach(undefined) throws TypeError');
+
+ try
+ {
+ // general forEach
+ expect = 'hello,Array,WORLD,';
+ actual = '';
+ strings.forEach(concat);
+ }
+ catch(e)
+ {
+ actual = dumpError(e);
+ }
+ reportCompare(expect, actual, 'Array.forEach');
+
+ try
+ {
+ expect = 'hello,mutated,';
+ actual = '';
+ strings.forEach(mutateForEach);
+ }
+ catch(e)
+ {
+ actual = dumpError(e);
+ }
+ reportCompare(expect, actual, 'Array.forEach: mutate');
+
+ strings = ['hello', 'Array', 'WORLD'];
+
+
+
+ try
+ {
+ // pass object method as forEach callback
+ expect = 'hello,Array,WORLD,';
+ actual = '';
+ obj = new ArrayCallback(true);
+ strings.forEach(obj.concat, obj);
+ }
+ catch(e)
+ {
+ actual = dumpError(e);
+ }
+ reportCompare(expect, actual, 'Array.forEach with object callback 1');
+
+ try
+ {
+ expect = 'hello,Array,WORLD,';
+ actual = '';
+ obj = new ArrayCallback(false);
+ strings.forEach(obj.concat, obj);
+ }
+ catch(e)
+ {
+ actual = dumpError(e);
+ }
+ reportCompare(expect, actual, 'Array.forEach with object callback 2');
+
+ try
+ {
+ // test forEach on sparse arrays
+ // see https://bugzilla.mozilla.org/show_bug.cgi?id=311082
+ expect = 'sparse,';
+ actual = '';
+ sparsestrings.forEach(concat);
+ }
+ catch(e)
+ {
+ actual = dumpError(e);
+ }
+ reportCompare(expect, actual, 'Array.forEach on sparse array');
+}
+
+if ('filter' in Array.prototype)
+{
+// see http://developer-test.mozilla.org/docs/Core_JavaScript_1.5_Reference:Objects:Array:filter
+
+ // test Array.filter
+
+ // filter has 1 required argument
+ expect = 1;
+ actual = Array.prototype.filter.length;
+ reportCompare(expect, actual, 'Array.prototype.filter.length == 1');
+
+ // throw TypeError if no callback function specified
+ expect = 'TypeError';
+ try
+ {
+ strings.filter();
+ actual = 'no error';
+ }
+ catch(e)
+ {
+ actual = e.name;
+ }
+ reportCompare(expect, actual, 'Array.filter(undefined) throws TypeError');
+
+ try
+ {
+ // test general filter
+ expect = 'WORLD';
+ actual = strings.filter(isUpperCase).toString();
+ }
+ catch(e)
+ {
+ actual = dumpError(e);
+ }
+ reportCompare(expect, actual, 'Array.filter');
+
+ try
+ {
+ expect = 'WORLD';
+ obj = new ArrayCallback(false);
+ actual = strings.filter(obj.isUpperCase, obj).toString();
+ }
+ catch(e)
+ {
+ actual = dumpError(e);
+ }
+ reportCompare(expect, actual, 'Array.filter object callback 1');
+
+ try
+ {
+ expect = 'hello,Array,WORLD';
+ obj = new ArrayCallback(true);
+ actual = strings.filter(obj.isUpperCase, obj).toString();
+ }
+ catch(e)
+ {
+ actual = dumpError(e);
+ }
+ reportCompare(expect, actual, 'Array.filter object callback 2');
+}
+
+if ('every' in Array.prototype)
+{
+// see http://developer-test.mozilla.org/docs/Core_JavaScript_1.5_Reference:Objects:Array:every
+
+ // test Array.every
+
+ // every has 1 required argument
+
+ expect = 1;
+ actual = Array.prototype.every.length;
+ reportCompare(expect, actual, 'Array.prototype.every.length == 1');
+
+ // throw TypeError if no every callback function specified
+ expect = 'TypeError';
+ try
+ {
+ strings.every();
+ actual = 'no error';
+ }
+ catch(e)
+ {
+ actual = e.name;
+ }
+ reportCompare(expect, actual, 'Array.every(undefined) throws TypeError');
+
+ // test general every
+
+ try
+ {
+ expect = true;
+ actual = strings.every(isString);
+ }
+ catch(e)
+ {
+ actual = dumpError(e);
+ }
+ reportCompare(expect, actual, 'strings: every element is a string');
+
+ try
+ {
+ expect = false;
+ actual = mixed.every(isString);
+ }
+ catch(e)
+ {
+ actual = dumpError(e);
+ }
+ reportCompare(expect, actual, 'mixed: every element is a string');
+
+ try
+ {
+ // see https://bugzilla.mozilla.org/show_bug.cgi?id=311082
+ expect = true;
+ actual = sparsestrings.every(isString);
+ }
+ catch(e)
+ {
+ actual = dumpError(e);
+ }
+ reportCompare(expect, actual, 'sparsestrings: every element is a string');
+
+ // pass object method as map callback
+
+ obj = new ArrayCallback(false);
+
+ try
+ {
+ expect = true;
+ actual = strings.every(obj.isString, obj);
+ }
+ catch(e)
+ {
+ actual = dumpError(e);
+ }
+ reportCompare(expect, actual, 'strings: every element is a string, via object callback');
+
+ try
+ {
+ expect = false;
+ actual = mixed.every(obj.isString, obj);
+ }
+ catch(e)
+ {
+ actual = dumpError(e) ;
+ }
+ reportCompare(expect, actual, 'mixed: every element is a string, via object callback');
+
+ try
+ {
+ // see https://bugzilla.mozilla.org/show_bug.cgi?id=311082
+ expect = true;
+ actual = sparsestrings.every(obj.isString, obj);
+ }
+ catch(e)
+ {
+ actual = dumpError(e);
+ }
+ reportCompare(expect, actual, 'sparsestrings: every element is a string, via object callback');
+
+}
+
+if ('some' in Array.prototype)
+{
+// see http://developer-test.mozilla.org/docs/Core_JavaScript_1.5_Reference:Objects:Array:some
+
+ // test Array.some
+
+ // some has 1 required argument
+
+ expect = 1;
+ actual = Array.prototype.some.length;
+ reportCompare(expect, actual, 'Array.prototype.some.length == 1');
+
+ // throw TypeError if no some callback function specified
+ expect = 'TypeError';
+ try
+ {
+ strings.some();
+ actual = 'no error';
+ }
+ catch(e)
+ {
+ actual = e.name;
+ }
+ reportCompare(expect, actual, 'Array.some(undefined) throws TypeError');
+
+ // test general some
+
+ try
+ {
+ expect = true;
+ actual = strings.some(isString);
+ }
+ catch(e)
+ {
+ actual = dumpError(e);
+ }
+ reportCompare(expect, actual, 'strings: some element is a string');
+
+ try
+ {
+ expect = true;
+ actual = mixed.some(isString);
+ }
+ catch(e)
+ {
+ actual = dumpError(e);
+ }
+ reportCompare(expect, actual, 'mixed: some element is a string');
+
+ try
+ {
+ expect = true;
+ actual = sparsestrings.some(isString);
+ }
+ catch(e)
+ {
+ actual = dumpError(e);
+ }
+ reportCompare(expect, actual, 'sparsestrings: some element is a string');
+
+ // pass object method as map callback
+
+ obj = new ArrayCallback(false);
+
+ try
+ {
+ expect = true;
+ actual = strings.some(obj.isString, obj);
+ }
+ catch(e)
+ {
+ actual = dumpError(e);
+ }
+ reportCompare(expect, actual, 'strings: some element is a string, via object callback');
+
+ try
+ {
+ expect = true;
+ actual = mixed.some(obj.isString, obj);
+ }
+ catch(e)
+ {
+ actual = dumpError(e);
+ }
+ reportCompare(expect, actual, 'mixed: some element is a string, via object callback');
+
+ try
+ {
+ expect = true;
+ actual = sparsestrings.some(obj.isString, obj);
+ }
+ catch(e)
+ {
+ actual = dumpError(e);
+ }
+ reportCompare(expect, actual, 'sparsestrings: some element is a string, via object callback');
+
+}
+
+if ('indexOf' in Array.prototype)
+{
+// see http://developer-test.mozilla.org/docs/Core_JavaScript_1.5_Reference:Objects:Array:indexOf
+
+ // test Array.indexOf
+
+ // indexOf has 1 required argument
+
+ expect = 1;
+ actual = Array.prototype.indexOf.length;
+ reportCompare(expect, actual, 'Array.prototype.indexOf.length == 1');
+
+ // test general indexOf
+
+ try
+ {
+ expect = -1;
+ actual = mixed.indexOf('not found');
+ }
+ catch(e)
+ {
+ actual = dumpError(e);
+ }
+ reportCompare(expect, actual, 'indexOf returns -1 if value not found');
+
+ try
+ {
+ expect = 0;
+ actual = mixed.indexOf(0);
+ }
+ catch(e)
+ {
+ actual = dumpError(e);
+ }
+ reportCompare(expect, actual, 'indexOf matches using strict equality');
+
+ try
+ {
+ expect = 1;
+ actual = mixed.indexOf('0');
+ }
+ catch(e)
+ {
+ actual = dumpError(e);
+ }
+ reportCompare(expect, actual, 'indexOf matches using strict equality');
+
+ try
+ {
+ expect = 2;
+ actual = mixed.indexOf(0, 1);
+ }
+ catch(e)
+ {
+ actual = dumpError(e);
+ }
+ reportCompare(expect, actual, 'indexOf begins searching at fromIndex');
+}
+
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_6/Array/regress-304828.js b/Source/JavaScriptCore/tests/mozilla/js1_6/Array/regress-304828.js
new file mode 100644
index 0000000..5cab4a7
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_6/Array/regress-304828.js
@@ -0,0 +1,270 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2005
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+//-----------------------------------------------------------------------------
+var bug = 304828;
+var summary = 'Array Generic Methods';
+var actual = '';
+var expect = '';
+printBugNumber (bug);
+printStatus (summary);
+
+var value;
+
+// use Array methods on a String
+// join
+value = '123';
+expect = '1,2,3';
+try
+{
+ actual = Array.prototype.join.call(value);
+}
+catch(e)
+{
+ actual = e + '';
+}
+reportCompare(expect, actual, summary + ': join');
+
+// reverse
+value = '123';
+expect = '123';
+try
+{
+ actual = Array.prototype.reverse.call(value) + '';
+}
+catch(e)
+{
+ actual = e + '';
+}
+reportCompare(expect, actual, summary + ': reverse');
+
+// sort
+value = 'cba';
+expect = 'cba';
+try
+{
+ actual = Array.prototype.sort.call(value) + '';
+}
+catch(e)
+{
+ actual = e + '';
+}
+reportCompare(expect, actual, summary + ': sort');
+
+// push
+value = 'abc';
+expect = 6;
+try
+{
+ actual = Array.prototype.push.call(value, 'd', 'e', 'f');
+}
+catch(e)
+{
+ actual = e + '';
+}
+reportCompare(expect, actual, summary + ': push');
+reportCompare('abc', value, summary + ': push');
+
+// pop
+value = 'abc';
+expect = 'c';
+try
+{
+ actual = Array.prototype.pop.call(value);
+}
+catch(e)
+{
+ actual = e + '';
+}
+reportCompare(expect, actual, summary + ': pop');
+reportCompare('abc', value, summary + ': pop');
+
+// unshift
+value = 'def';
+expect = 6;
+try
+{
+ actual = Array.prototype.unshift.call(value, 'a', 'b', 'c');
+}
+catch(e)
+{
+ actual = e + '';
+}
+reportCompare(expect, actual, summary + ': unshift');
+reportCompare('def', value, summary + ': unshift');
+
+// shift
+value = 'abc';
+expect = 'a';
+try
+{
+ actual = Array.prototype.shift.call(value);
+}
+catch(e)
+{
+ actual = e + '';
+}
+reportCompare(expect, actual, summary + ': shift');
+reportCompare('abc', value, summary + ': shift');
+
+// splice
+value = 'abc';
+expect = 'b';
+try
+{
+ actual = Array.prototype.splice.call(value, 1, 1) + '';
+}
+catch(e)
+{
+ actual = e + '';
+}
+reportCompare(expect, actual, summary + ': splice');
+
+// concat
+value = 'abc';
+expect = 'abc,d,e,f';
+try
+{
+ actual = Array.prototype.concat.call(value, 'd', 'e', 'f') + '';
+}
+catch(e)
+{
+ actual = e + '';
+}
+reportCompare(expect, actual, summary + ': concat');
+
+// slice
+value = 'abc';
+expect = 'b';
+try
+{
+ actual = Array.prototype.slice.call(value, 1, 2) + '';
+}
+catch(e)
+{
+ actual = e + '';
+}
+reportCompare(expect, actual, summary + ': slice');
+
+// indexOf
+value = 'abc';
+expect = 1;
+try
+{
+ actual = Array.prototype.indexOf.call(value, 'b');
+}
+catch(e)
+{
+ actual = e + '';
+}
+reportCompare(expect, actual, summary + ': indexOf');
+
+// lastIndexOf
+value = 'abcabc';
+expect = 4;
+try
+{
+ actual = Array.prototype.lastIndexOf.call(value, 'b');
+}
+catch(e)
+{
+ actual = e + '';
+}
+reportCompare(expect, actual, summary + ': lastIndexOf');
+
+// forEach
+value = 'abc';
+expect = 'ABC';
+actual = '';
+try
+{
+ Array.prototype.forEach.call(value,
+ function (v, index, array)
+ {actual += array[index].toUpperCase();});
+}
+catch(e)
+{
+ actual = e + '';
+}
+reportCompare(expect, actual, summary + ': forEach');
+
+// map
+value = 'abc';
+expect = 'A,B,C';
+try
+{
+ actual = Array.prototype.map.call(value,
+ function (v, index, array)
+ {return v.toUpperCase();}) + '';
+}
+catch(e)
+{
+ actual = e + '';
+}
+reportCompare(expect, actual, summary + ': map');
+
+// filter
+value = '1234567890';
+expect = '2,4,6,8,0';
+try
+{
+ actual = Array.prototype.filter.call(value,
+ function (v, index, array)
+ {return array[index] % 2 == 0;}) + '';
+}
+catch(e)
+{
+ actual = e + '';
+}
+reportCompare(expect, actual, summary + ': filter');
+
+// every
+value = '1234567890';
+expect = false;
+try
+{
+ actual = Array.prototype.every.call(value,
+ function (v, index, array)
+ {return array[index] % 2 == 0;});
+}
+catch(e)
+{
+ actual = e + '';
+}
+reportCompare(expect, actual, summary + ': every');
+
+
+
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_6/Array/regress-305002.js b/Source/JavaScriptCore/tests/mozilla/js1_6/Array/regress-305002.js
new file mode 100644
index 0000000..d2c316a
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_6/Array/regress-305002.js
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2005
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Hans-Andreas Engel
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+//-----------------------------------------------------------------------------
+var bug = 305002;
+var summary = '[].every(f) == true';
+var actual = '';
+var expect = '';
+
+printBugNumber (bug);
+printStatus (summary);
+
+var notcalled = true;
+
+function callback()
+{
+ notcalled = false;
+}
+
+expect = true;
+actual = [].every(callback) && notcalled;
+
+reportCompare(expect, actual, summary);
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_6/Array/regress-310425-01.js b/Source/JavaScriptCore/tests/mozilla/js1_6/Array/regress-310425-01.js
new file mode 100644
index 0000000..64f543f
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_6/Array/regress-310425-01.js
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2005
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Igor Bukanov
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+//-----------------------------------------------------------------------------
+var bug = 310425;
+var summary = 'Array.indexOf/lastIndexOf edge cases';
+var actual = '';
+var expect = '';
+
+printBugNumber (bug);
+printStatus (summary);
+
+expect = -1;
+actual = [].lastIndexOf(undefined, -1);
+reportCompare(expect, actual, summary);
+
+expect = -1;
+actual = [].indexOf(undefined, -1);
+reportCompare(expect, actual, summary);
+
+var x = [];
+x[1 << 30] = 1;
+expect = (1 << 30);
+actual = x.lastIndexOf(1);
+reportCompare(expect, actual, summary);
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_6/Array/regress-310425-02.js b/Source/JavaScriptCore/tests/mozilla/js1_6/Array/regress-310425-02.js
new file mode 100644
index 0000000..f0309a7
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_6/Array/regress-310425-02.js
@@ -0,0 +1,48 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2005
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Igor Bukanov
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+//-----------------------------------------------------------------------------
+var bug = 310425;
+var summary = 'Array.indexOf/lastIndexOf edge cases';
+var actual = '';
+var expect = '';
+
+printBugNumber (bug);
+printStatus (summary);
+
+expect = -1;
+actual = Array(1).indexOf(1);
+reportCompare(expect, actual, summary);
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_6/Array/regress-320887.js b/Source/JavaScriptCore/tests/mozilla/js1_6/Array/regress-320887.js
new file mode 100644
index 0000000..323bc3c
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_6/Array/regress-320887.js
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2005
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Blake Kaplan
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+//-----------------------------------------------------------------------------
+var bug = 320887;
+var summary = 'var x should not throw a ReferenceError';
+var actual = 'No error';
+var expect = 'No error';
+
+printBugNumber (bug);
+printStatus (summary);
+
+try
+{
+ (function xxx() { ["var x"].map(eval); })()
+}
+catch(ex)
+{
+ actual = ex + '';
+}
+
+reportCompare(expect, actual, summary);
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_6/Array/shell.js b/Source/JavaScriptCore/tests/mozilla/js1_6/Array/shell.js
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_6/Array/shell.js
@@ -0,0 +1 @@
+
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_6/README b/Source/JavaScriptCore/tests/mozilla/js1_6/README
new file mode 100644
index 0000000..7a3c7a0
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_6/README
@@ -0,0 +1 @@
+JavaScript 1.6
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_6/Regress/browser.js b/Source/JavaScriptCore/tests/mozilla/js1_6/Regress/browser.js
new file mode 100644
index 0000000..b262fa1
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_6/Regress/browser.js
@@ -0,0 +1 @@
+// dummy file
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_6/Regress/regress-301574.js b/Source/JavaScriptCore/tests/mozilla/js1_6/Regress/regress-301574.js
new file mode 100644
index 0000000..28b1d1a
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_6/Regress/regress-301574.js
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2005
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Wladimir Palant
+ * shutdown
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+//-----------------------------------------------------------------------------
+var bug = 301574;
+var summary = 'E4X should be enabled even when e4x=1 not specified';
+var actual = 'No error';
+var expect = 'No error';
+
+printBugNumber (bug);
+printStatus (summary);
+
+try
+{
+ var xml = XML('<xml/>');
+}
+catch(e)
+{
+ actual = 'error: ' + e;
+}
+
+reportCompare(expect, actual, summary + ': XML()');
+
+try
+{
+ var xml = XML('<p>text</p>');
+}
+catch(e)
+{
+ actual = 'error: ' + e;
+}
+
+reportCompare(expect, actual, summary + ': XMLList()');
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_6/Regress/regress-309242.js b/Source/JavaScriptCore/tests/mozilla/js1_6/Regress/regress-309242.js
new file mode 100644
index 0000000..a97bede
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_6/Regress/regress-309242.js
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2005
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+//-----------------------------------------------------------------------------
+var bug = 309242;
+var summary = 'E4X should be on by default while preserving comment hack';
+var actual = '';
+var expect = '';
+
+printBugNumber (bug);
+printStatus (summary);
+
+/*
+ E4X should be available regardless of script type
+ <!-- and --> should begin comment to end of line
+ unless type=text/javascript;e4x=1
+*/
+
+expect = true;
+actual = true;
+// the next line will be ignored when e4x is not requested
+<!-- comment -->; actual = false;
+
+reportCompare(expect, actual, summary + ': &lt;!-- is comment to end of line');
+
+expect = true;
+actual = false;
+// the next line will be ignored when e4x is not requested
+<!--
+actual = true;
+// -->
+
+reportCompare(expect, actual, summary + ': comment hack works inside script');
+
+// E4X is available always
+
+var x = <foo/>;
+
+expect = 'element';
+actual = x.nodeKind();
+
+reportCompare(expect, actual, summary + ': E4X is available');
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_6/Regress/regress-311157-01.js b/Source/JavaScriptCore/tests/mozilla/js1_6/Regress/regress-311157-01.js
new file mode 100644
index 0000000..46af70c
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_6/Regress/regress-311157-01.js
@@ -0,0 +1,55 @@
+/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2005
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Brendan Eich
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var bug = 311157;
+var summary = 'Comment-hiding compromise left E4X parsing/scanning inconsistent';
+var actual = 'No Crash';
+var expect = 'No Crash';
+
+printBugNumber (bug);
+printStatus (summary);
+
+try
+{
+ eval('var x = <hi> <!-- duh -->\n there </hi>');
+}
+catch(e)
+{
+}
+
+reportCompare(expect, actual, summary);
+
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_6/Regress/regress-311157-02.js b/Source/JavaScriptCore/tests/mozilla/js1_6/Regress/regress-311157-02.js
new file mode 100644
index 0000000..a7ef464
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_6/Regress/regress-311157-02.js
@@ -0,0 +1,55 @@
+/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2005
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Brendan Eich
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var bug = 311157;
+var summary = 'Comment-hiding compromise left E4X parsing/scanning inconsistent';
+var actual = 'No Crash';
+var expect = 'No Crash';
+
+printBugNumber (bug);
+printStatus (summary);
+
+try
+{
+ eval('var x = <hi> <![CDATA[ duh ]]>\n there </hi>');
+}
+catch(e)
+{
+}
+
+reportCompare(expect, actual, summary);
+
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_6/Regress/regress-314887.js b/Source/JavaScriptCore/tests/mozilla/js1_6/Regress/regress-314887.js
new file mode 100644
index 0000000..61cb87a
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_6/Regress/regress-314887.js
@@ -0,0 +1,51 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2005
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+//-----------------------------------------------------------------------------
+var bug = 314887;
+var summary = 'Do not crash when morons embed script tags in external script files';
+var actual = 'No Crash';
+var expect = 'No Crash';
+
+printBugNumber (bug);
+printStatus (summary);
+
+<script language="JavaScript" type="text/JavaScript">
+<!--
+//-->
+</script>
+
+reportCompare(expect, actual, summary);
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_6/Regress/regress-320172.js b/Source/JavaScriptCore/tests/mozilla/js1_6/Regress/regress-320172.js
new file mode 100644
index 0000000..badd987
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_6/Regress/regress-320172.js
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2005
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): shutdown@flashmail.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+//-----------------------------------------------------------------------------
+var bug = 320172;
+var summary = 'Regression from bug 285219';
+var actual = 'No Crash';
+var expect = 'No Crash';
+
+enterFunc ('test');
+printBugNumber (bug);
+printStatus (summary);
+
+try
+{
+ (function xxx(){ ["var x"].forEach(eval); })();
+}
+catch(ex)
+{
+}
+
+printStatus('No Crash');
+reportCompare(expect, actual, summary);
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_6/Regress/shell.js b/Source/JavaScriptCore/tests/mozilla/js1_6/Regress/shell.js
new file mode 100644
index 0000000..b262fa1
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_6/Regress/shell.js
@@ -0,0 +1 @@
+// dummy file
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_6/String/browser.js b/Source/JavaScriptCore/tests/mozilla/js1_6/String/browser.js
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_6/String/browser.js
@@ -0,0 +1 @@
+
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_6/String/regress-306591.js b/Source/JavaScriptCore/tests/mozilla/js1_6/String/regress-306591.js
new file mode 100644
index 0000000..df498c3
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_6/String/regress-306591.js
@@ -0,0 +1,95 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2005
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): nanto_vi
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+//-----------------------------------------------------------------------------
+var bug = 306591;
+var summary = 'String static methods';
+var actual = '';
+var expect = '';
+
+printBugNumber (bug);
+printStatus (summary);
+printStatus ('See https://bugzilla.mozilla.org/show_bug.cgi?id=304828');
+
+expect = ['a', 'b', 'c'].toString();
+actual = String.split(new String('abc'), '').toString();
+reportCompare(expect, actual, summary +
+ " String.split(new String('abc'), '')");
+
+expect = '2';
+actual = String.substring(new Number(123), 1, 2);
+reportCompare(expect, actual, summary +
+ " String.substring(new Number(123), 1, 2)");
+
+expect = 'TRUE';
+actual = String.toUpperCase(new Boolean(true));
+reportCompare(expect, actual, summary +
+ " String.toUpperCase(new Boolean(true))");
+
+expect = 2;
+actual = String.indexOf(null, 'l');
+reportCompare(expect, actual, summary +
+ " String.indexOf(null, 'l')");
+
+expect = 2;
+actual = String.indexOf(String(null), 'l');
+reportCompare(expect, actual, summary +
+ " String.indexOf(String(null), 'l')");
+
+expect = ['a', 'b', 'c'].toString();
+actual = String.split('abc', '').toString();
+reportCompare(expect, actual, summary +
+ " String.split('abc', '')");
+
+expect = '2';
+actual = String.substring(123, 1, 2);
+reportCompare(expect, actual, summary +
+ " String.substring(123, 1, 2)");
+
+expect = 'TRUE';
+actual = String.toUpperCase(true);
+reportCompare(expect, actual, summary +
+ " String.toUpperCase(true)");
+
+expect = 2;
+actual = String.indexOf(undefined, 'd');
+reportCompare(expect, actual, summary +
+ " String.indexOf(undefined, 'd')");
+
+expect = 2;
+actual = String.indexOf(String(undefined), 'd');
+reportCompare(expect, actual, summary +
+ " String.indexOf(String(undefined), 'd')");
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_6/String/shell.js b/Source/JavaScriptCore/tests/mozilla/js1_6/String/shell.js
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_6/String/shell.js
@@ -0,0 +1 @@
+
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_6/browser.js b/Source/JavaScriptCore/tests/mozilla/js1_6/browser.js
new file mode 100644
index 0000000..c11f6c6
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_6/browser.js
@@ -0,0 +1,147 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ * JavaScript test library shared functions file for running the tests
+ * in the browser. Overrides the shell's print function with document.write
+ * and make everything HTML pretty.
+ *
+ * To run the tests in the browser, use the mkhtml.pl script to generate
+ * html pages that include the shell.js, browser.js (this file), and the
+ * test js file in script tags.
+ *
+ * The source of the page that is generated should look something like this:
+ * <script src="./../shell.js"></script>
+ * <script src="./../browser.js"></script>
+ * <script src="./mytest.js"></script>
+ */
+function writeLineToLog( string ) {
+ document.write( string + "<br>\n");
+}
+
+var testcases = new Array();
+var tc = testcases.length;
+var bug = '';
+var summary = '';
+var description = '';
+var expected = '';
+var actual = '';
+var msg = '';
+
+
+function TestCase(n, d, e, a)
+{
+ this.path = (typeof gTestPath == 'undefined') ? '' : gTestPath;
+ this.name = n;
+ this.description = d;
+ this.expect = e;
+ this.actual = a;
+ this.passed = ( e == a );
+ this.reason = '';
+ this.bugnumber = typeof(bug) != 'undefined' ? bug : '';
+ testcases[tc++] = this;
+}
+
+var gInReportCompare = false;
+
+var _reportCompare = reportCompare;
+
+reportCompare = function(expected, actual, description)
+{
+ gInReportCompare = true;
+
+ var testcase = new TestCase(gTestName, description, expected, actual);
+ testcase.passed = _reportCompare(expected, actual, description);
+
+ gInReportCompare = false;
+};
+
+var _reportFailure = reportFailure;
+reportFailure = function (msg, page, line)
+{
+ var testcase;
+
+ if (gInReportCompare)
+ {
+ testcase = testcases[tc - 1];
+ testcase.passed = false;
+ }
+ else
+ {
+ if (typeof DESCRIPTION == 'undefined')
+ {
+ DESCRIPTION = 'Unknown';
+ }
+ if (typeof EXPECTED == 'undefined')
+ {
+ EXPECTED = 'Unknown';
+ }
+ testcase = new TestCase(gTestName, DESCRIPTION, EXPECTED, "error");
+ if (document.location.href.indexOf('-n.js') != -1)
+ {
+ // negative test
+ testcase.passed = true;
+ }
+ }
+
+ testcase.reason += msg;
+
+ if (typeof(page) != 'undefined')
+ {
+ testcase.reason += ' Page: ' + page;
+ }
+ if (typeof(line) != 'undefined')
+ {
+ testcase.reason += ' Line: ' + line;
+ }
+ if (!testcase.passed)
+ {
+ _reportFailure(msg);
+ }
+
+};
+
+function gc()
+{
+}
+
+function quit()
+{
+}
+
+window.onerror = reportFailure;
+
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_6/shell.js b/Source/JavaScriptCore/tests/mozilla/js1_6/shell.js
new file mode 100644
index 0000000..a1c08c0
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_6/shell.js
@@ -0,0 +1,477 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Rob Ginda rginda@netscape.com
+ * Bob Clary bob@bclary.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var FAILED = "FAILED!: ";
+var STATUS = "STATUS: ";
+var BUGNUMBER = "BUGNUMBER: ";
+var VERBOSE = false;
+var SECT_PREFIX = 'Section ';
+var SECT_SUFFIX = ' of test -';
+var callStack = new Array();
+
+function writeLineToLog( string ) {
+ print( string + "\n");
+}
+/*
+ * The test driver searches for such a phrase in the test output.
+ * If such phrase exists, it will set n as the expected exit code.
+ */
+function expectExitCode(n)
+{
+
+ writeLineToLog('--- NOTE: IN THIS TESTCASE, WE EXPECT EXIT CODE ' + n + ' ---');
+
+}
+
+/*
+ * Statuses current section of a test
+ */
+function inSection(x)
+{
+
+ return SECT_PREFIX + x + SECT_SUFFIX;
+
+}
+
+/*
+ * Some tests need to know if we are in Rhino as opposed to SpiderMonkey
+ */
+function inRhino()
+{
+ return (typeof defineClass == "function");
+}
+
+/*
+ * Report a failure in the 'accepted' manner
+ */
+function reportFailure (msg)
+{
+ var lines = msg.split ("\n");
+ var l;
+ var funcName = currentFunc();
+ var prefix = (funcName) ? "[reported from " + funcName + "] ": "";
+
+ for (var i=0; i<lines.length; i++)
+ writeLineToLog (FAILED + prefix + lines[i]);
+
+}
+
+/*
+ * Print a non-failure message.
+ */
+function printStatus (msg)
+{
+ msg = String(msg);
+ msg = msg.toString();
+ var lines = msg.split ("\n");
+ var l;
+
+ for (var i=0; i<lines.length; i++)
+ writeLineToLog (STATUS + lines[i]);
+
+}
+
+/*
+ * Print a bugnumber message.
+ */
+function printBugNumber (num)
+{
+
+ writeLineToLog (BUGNUMBER + num);
+
+}
+
+/*
+ * Compare expected result to actual result, if they differ (in value and/or
+ * type) report a failure. If description is provided, include it in the
+ * failure report.
+ */
+function reportCompare (expected, actual, description)
+{
+ var expected_t = typeof expected;
+ var actual_t = typeof actual;
+ var output = "";
+
+ if ((VERBOSE) && (typeof description != "undefined"))
+ printStatus ("Comparing '" + description + "'");
+
+ if (expected_t != actual_t)
+ output += "Type mismatch, expected type " + expected_t +
+ ", actual type " + actual_t + "\n";
+ else if (VERBOSE)
+ printStatus ("Expected type '" + actual_t + "' matched actual " +
+ "type '" + expected_t + "'");
+
+ if (expected != actual)
+ output += "Expected value '" + expected + "', Actual value '" + actual +
+ "'\n";
+ else if (VERBOSE)
+ printStatus ("Expected value '" + actual + "' matched actual " +
+ "value '" + expected + "'");
+
+ if (output != "")
+ {
+ if (typeof description != "undefined")
+ reportFailure (description);
+ reportFailure (output);
+ }
+ return (output == ""); // true if passed
+}
+
+/*
+ * Puts funcName at the top of the call stack. This stack is used to show
+ * a function-reported-from field when reporting failures.
+ */
+function enterFunc (funcName)
+{
+
+ if (!funcName.match(/\(\)$/))
+ funcName += "()";
+
+ callStack.push(funcName);
+
+}
+
+/*
+ * Pops the top funcName off the call stack. funcName is optional, and can be
+ * used to check push-pop balance.
+ */
+function exitFunc (funcName)
+{
+ var lastFunc = callStack.pop();
+
+ if (funcName)
+ {
+ if (!funcName.match(/\(\)$/))
+ funcName += "()";
+
+ if (lastFunc != funcName)
+ reportFailure ("Test driver failure, expected to exit function '" +
+ funcName + "' but '" + lastFunc + "' came off " +
+ "the stack");
+ }
+
+}
+
+/*
+ * Peeks at the top of the call stack.
+ */
+function currentFunc()
+{
+
+ return callStack[callStack.length - 1];
+
+}
+
+/*
+ Calculate the "order" of a set of data points {X: [], Y: []}
+ by computing successive "derivatives" of the data until
+ the data is exhausted or the derivative is linear.
+*/
+function BigO(data)
+{
+ var order = 0;
+ var origLength = data.X.length;
+
+ while (data.X.length > 2)
+ {
+ var lr = new LinearRegression(data);
+ if (lr.b > 1e-6)
+ {
+ // only increase the order if the slope
+ // is "great" enough
+ order++;
+ }
+
+ if (lr.r > 0.98 || lr.Syx < 1 || lr.b < 1e-6)
+ {
+ // terminate if close to a line lr.r
+ // small error lr.Syx
+ // small slope lr.b
+ break;
+ }
+ data = dataDeriv(data);
+ }
+
+ if (2 == origLength - order)
+ {
+ order = Number.POSITIVE_INFINITY;
+ }
+ return order;
+
+ function LinearRegression(data)
+ {
+ /*
+ y = a + bx
+ for data points (Xi, Yi); 0 <= i < n
+
+ b = (n*SUM(XiYi) - SUM(Xi)*SUM(Yi))/(n*SUM(Xi*Xi) - SUM(Xi)*SUM(Xi))
+ a = (SUM(Yi) - b*SUM(Xi))/n
+ */
+ var i;
+
+ if (data.X.length != data.Y.length)
+ {
+ throw 'LinearRegression: data point length mismatch';
+ }
+ if (data.X.length < 3)
+ {
+ throw 'LinearRegression: data point length < 2';
+ }
+ var n = data.X.length;
+ var X = data.X;
+ var Y = data.Y;
+
+ this.Xavg = 0;
+ this.Yavg = 0;
+
+ var SUM_X = 0;
+ var SUM_XY = 0;
+ var SUM_XX = 0;
+ var SUM_Y = 0;
+ var SUM_YY = 0;
+
+ for (i = 0; i < n; i++)
+ {
+ SUM_X += X[i];
+ SUM_XY += X[i]*Y[i];
+ SUM_XX += X[i]*X[i];
+ SUM_Y += Y[i];
+ SUM_YY += Y[i]*Y[i];
+ }
+
+ this.b = (n * SUM_XY - SUM_X * SUM_Y)/(n * SUM_XX - SUM_X * SUM_X);
+ this.a = (SUM_Y - this.b * SUM_X)/n;
+
+ this.Xavg = SUM_X/n;
+ this.Yavg = SUM_Y/n;
+
+ var SUM_Ydiff2 = 0;
+ var SUM_Xdiff2 = 0;
+ var SUM_XdiffYdiff = 0;
+
+ for (i = 0; i < n; i++)
+ {
+ var Ydiff = Y[i] - this.Yavg;
+ var Xdiff = X[i] - this.Xavg;
+
+ SUM_Ydiff2 += Ydiff * Ydiff;
+ SUM_Xdiff2 += Xdiff * Xdiff;
+ SUM_XdiffYdiff += Xdiff * Ydiff;
+ }
+
+ var Syx2 = (SUM_Ydiff2 - Math.pow(SUM_XdiffYdiff/SUM_Xdiff2, 2))/(n - 2);
+ var r2 = Math.pow((n*SUM_XY - SUM_X * SUM_Y), 2) /
+ ((n*SUM_XX - SUM_X*SUM_X)*(n*SUM_YY-SUM_Y*SUM_Y));
+
+ this.Syx = Math.sqrt(Syx2);
+ this.r = Math.sqrt(r2);
+
+ }
+
+ function dataDeriv(data)
+ {
+ if (data.X.length != data.Y.length)
+ {
+ throw 'length mismatch';
+ }
+ var length = data.X.length;
+
+ if (length < 2)
+ {
+ throw 'length ' + length + ' must be >= 2';
+ }
+ var X = data.X;
+ var Y = data.Y;
+
+ var deriv = {X: [], Y: [] };
+
+ for (var i = 0; i < length - 1; i++)
+ {
+ deriv.X[i] = (X[i] + X[i+1])/2;
+ deriv.Y[i] = (Y[i+1] - Y[i])/(X[i+1] - X[i]);
+ }
+ return deriv;
+ }
+
+}
+
+/* JavaScriptOptions
+ encapsulate the logic for setting and retrieving the values
+ of the javascript options.
+
+ Note: in shell, options() takes an optional comma delimited list
+ of option names, toggles the values for each option and returns the
+ list of option names which were set before the call.
+ If no argument is passed to options(), it returns the current
+ options with value true.
+
+ Usage;
+
+ // create and initialize object.
+ jsOptions = new JavaScriptOptions();
+
+ // set a particular option
+ jsOptions.setOption(name, boolean);
+
+ // reset all options to their original values.
+ jsOptions.reset();
+*/
+
+function JavaScriptOptions()
+{
+ this.orig = {};
+ this.orig.strict = this.strict = false;
+ this.orig.werror = this.werror = false;
+
+ this.privileges = 'UniversalXPConnect';
+
+ if (typeof options == 'function')
+ {
+ // shell
+ var optString = options();
+ if (optString)
+ {
+ var optList = optString.split(',');
+ for (iOpt = 0; i < optList.length; iOpt++)
+ {
+ optName = optList[iOpt];
+ this[optName] = true;
+ }
+ }
+ }
+ else if (typeof document != 'undefined')
+ {
+ // browser
+ netscape.security.PrivilegeManager.enablePrivilege(this.privileges);
+
+ var preferences = Components.classes['@mozilla.org/preferences;1'];
+ if (!preferences)
+ {
+ throw 'JavaScriptOptions: unable to get @mozilla.org/preference;1';
+ }
+
+ var prefService = preferences.
+ getService(Components.interfaces.nsIPrefService);
+
+ if (!prefService)
+ {
+ throw 'JavaScriptOptions: unable to get nsIPrefService';
+ }
+
+ var pref = prefService.getBranch('');
+
+ if (!pref)
+ {
+ throw 'JavaScriptOptions: unable to get prefService branch';
+ }
+
+ try
+ {
+ this.orig.strict = this.strict =
+ pref.getBoolPref('javascript.options.strict');
+ }
+ catch(e)
+ {
+ }
+
+ try
+ {
+ this.orig.werror = this.werror =
+ pref.getBoolPref('javascript.options.werror');
+ }
+ catch(e)
+ {
+ }
+ }
+}
+
+JavaScriptOptions.prototype.setOption =
+function (optionName, optionValue)
+{
+ if (typeof options == 'function')
+ {
+ // shell
+ if (this[optionName] != optionValue)
+ {
+ options(optionName);
+ }
+ }
+ else if (typeof document != 'undefined')
+ {
+ // browser
+ netscape.security.PrivilegeManager.enablePrivilege(this.privileges);
+
+ var preferences = Components.classes['@mozilla.org/preferences;1'];
+ if (!preferences)
+ {
+ throw 'setOption: unable to get @mozilla.org/preference;1';
+ }
+
+ var prefService = preferences.
+ getService(Components.interfaces.nsIPrefService);
+
+ if (!prefService)
+ {
+ throw 'setOption: unable to get nsIPrefService';
+ }
+
+ var pref = prefService.getBranch('');
+
+ if (!pref)
+ {
+ throw 'setOption: unable to get prefService branch';
+ }
+
+ pref.setBoolPref('javascript.options.' + optionName, optionValue);
+ }
+
+ this[optionName] = optionValue;
+
+ return;
+}
+
+
+JavaScriptOptions.prototype.reset = function ()
+{
+ this.setOption('strict', this.orig.strict);
+ this.setOption('werror', this.orig.werror);
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/js1_6/template.js b/Source/JavaScriptCore/tests/mozilla/js1_6/template.js
new file mode 100644
index 0000000..dede379
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/js1_6/template.js
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2005
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+//-----------------------------------------------------------------------------
+var bug = 99999;
+var summary = '';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/jsDriver.pl b/Source/JavaScriptCore/tests/mozilla/jsDriver.pl
new file mode 100644
index 0000000..d1c18ce
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/jsDriver.pl
@@ -0,0 +1,1335 @@
+#!/usr/bin/perl
+#
+# The contents of this file are subject to the Netscape Public
+# License Version 1.1 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a copy of
+# the License at http://www.mozilla.org/NPL/
+#
+# Software distributed under the License is distributed on an "AS
+# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# rights and limitations under the License.
+#
+# The Original Code is JavaScript Core Tests.
+#
+# The Initial Developer of the Original Code is Netscape
+# Communications Corporation. Portions created by Netscape are
+# Copyright (C) 1997-1999 Netscape Communications Corporation. All
+# Rights Reserved.
+#
+# Alternatively, the contents of this file may be used under the
+# terms of the GNU Public License (the "GPL"), in which case the
+# provisions of the GPL are applicable instead of those above.
+# If you wish to allow use of your version of this file only
+# under the terms of the GPL and not to allow others to use your
+# version of this file under the NPL, indicate your decision by
+# deleting the provisions above and replace them with the notice
+# and other provisions required by the GPL. If you do not delete
+# the provisions above, a recipient may use your version of this
+# file under either the NPL or the GPL.
+#
+# Contributers:
+# Robert Ginda <rginda@netscape.com>
+#
+# Second cut at runtests.pl script originally by
+# Christine Begle (cbegle@netscape.com)
+# Branched 11/01/99
+#
+
+use strict;
+use Getopt::Mixed "nextOption";
+
+my $os_type = &get_os_type;
+my $unixish = (($os_type ne "WIN") && ($os_type ne "MAC"));
+my $path_sep = ($os_type eq "MAC") ? ":" : "/";
+my $win_sep = ($os_type eq "WIN")? &get_win_sep : "";
+my $redirect_command = ($os_type ne "MAC") ? " 2>&1" : "";
+
+# command line option defaults
+my $opt_suite_path;
+my $opt_trace = 0;
+my $opt_classpath = "";
+my $opt_rhino_opt = 0;
+my $opt_rhino_ms = 0;
+my @opt_engine_list;
+my $opt_engine_type = "";
+my $opt_engine_params = "";
+my $opt_user_output_file = 0;
+my $opt_output_file = "";
+my @opt_test_list_files;
+my @opt_neg_list_files;
+my $opt_shell_path = "";
+my $opt_java_path = "";
+my $opt_bug_url = "http://bugzilla.mozilla.org/show_bug.cgi?id=";
+my $opt_console_failures = 0;
+my $opt_lxr_url = "./"; # "http://lxr.mozilla.org/mozilla/source/js/tests/";
+my $opt_exit_munge = ($os_type ne "MAC") ? 1 : 0;
+my $opt_arch= "";
+
+# command line option definition
+my $options = "a=s arch>a b=s bugurl>b c=s classpath>c e=s engine>e f=s file>f " .
+"h help>h i j=s javapath>j k confail>k l=s list>l L=s neglist>L " .
+"o=s opt>o p=s testpath>p s=s shellpath>s t trace>t u=s lxrurl>u " .
+"x noexitmunge>x";
+
+if ($os_type eq "MAC") {
+ $opt_suite_path = `directory`;
+ $opt_suite_path =~ s/[\n\r]//g;
+ $opt_suite_path .= ":";
+} else {
+ $opt_suite_path = "./";
+}
+
+&parse_args;
+
+my $user_exit = 0;
+my ($engine_command, $html, $failures_reported, $tests_completed,
+ $exec_time_string);
+my @failed_tests;
+my @test_list = &get_test_list;
+
+if ($#test_list == -1) {
+ die ("Nothing to test.\n");
+}
+
+if ($unixish) {
+# on unix, ^C pauses the tests, and gives the user a chance to quit but
+# report on what has been done, to just quit, or to continue (the
+# interrupted test will still be skipped.)
+# windows doesn't handle the int handler they way we want it to,
+# so don't even pretend to let the user continue.
+ $SIG{INT} = 'int_handler';
+}
+
+&main;
+
+#End.
+
+sub main {
+ my $start_time;
+
+ while ($opt_engine_type = pop (@opt_engine_list)) {
+ dd ("Testing engine '$opt_engine_type'");
+
+ $engine_command = &get_engine_command;
+ $html = "";
+ @failed_tests = ();
+ $failures_reported = 0;
+ $tests_completed = 0;
+ $start_time = time;
+
+
+ &execute_tests (@test_list);
+
+ my $exec_time = (time - $start_time);
+ my $exec_hours = int($exec_time / 60 / 60);
+ $exec_time -= $exec_hours * 60 * 60;
+ my $exec_mins = int($exec_time / 60);
+ $exec_time -= $exec_mins * 60;
+ my $exec_secs = ($exec_time % 60);
+
+ if ($exec_hours > 0) {
+ $exec_time_string = "$exec_hours hours, $exec_mins minutes, " .
+ "$exec_secs seconds";
+ } elsif ($exec_mins > 0) {
+ $exec_time_string = "$exec_mins minutes, $exec_secs seconds";
+ } else {
+ $exec_time_string = "$exec_secs seconds";
+ }
+
+ if (!$opt_user_output_file) {
+ $opt_output_file = &get_tempfile_name;
+ }
+
+ &write_results;
+
+ }
+}
+
+sub execute_tests {
+ my (@test_list) = @_;
+ my ($test, $shell_command, $line, @output, $path);
+ my $file_param = " -f ";
+ my ($last_suite, $last_test_dir);
+
+# Don't run any shell.js files as tests; they are only utility files
+ @test_list = grep (!/shell\.js$/, @test_list);
+
+ &status ("Executing " . ($#test_list + 1) . " test(s).");
+ foreach $test (@test_list) {
+ my ($suite, $test_dir, $test_file) = split($path_sep, $test);
+# *-n.js is a negative test, expect exit code 3 (runtime error)
+ my $expected_exit = ($test =~ /\-n\.js$/) ? 3 : 0;
+ my ($got_exit, $exit_signal);
+ my $failure_lines;
+ my $bug_number;
+ my $status_lines;
+
+# user selected [Q]uit from ^C handler.
+ if ($user_exit) {
+ return;
+ }
+
+# Append the shell.js files to the shell_command if they're there.
+# (only check for their existance if the suite or test_dir has changed
+# since the last time we looked.)
+ if ($last_suite ne $suite || $last_test_dir ne $test_dir) {
+ $shell_command = $opt_arch . " ";
+
+ $shell_command .= &xp_path($engine_command) . " -s ";
+
+ $path = &xp_path($opt_suite_path . $suite . "/shell.js");
+ if (-f $path) {
+ $shell_command .= $file_param . $path;
+ }
+
+ $path = &xp_path($opt_suite_path . $suite . "/" .
+ $test_dir . "/shell.js");
+ if (-f $path) {
+ $shell_command .= $file_param . $path;
+ }
+
+ $last_suite = $suite;
+ $last_test_dir = $test_dir;
+ }
+
+ $path = &xp_path($opt_suite_path . $test);
+
+ print ($shell_command . $file_param . $path . "\n");
+ &dd ("executing: " . $shell_command . $file_param . $path);
+
+ open (OUTPUT, $shell_command . $file_param . $path .
+ $redirect_command . " |");
+ @output = <OUTPUT>;
+ close (OUTPUT);
+
+ @output = grep (!/js\>/, @output);
+
+ if ($opt_exit_munge == 1) {
+# signal information in the lower 8 bits, exit code above that
+ $got_exit = ($? >> 8);
+ $exit_signal = ($? & 255);
+ } else {
+# user says not to munge the exit code
+ $got_exit = $?;
+ $exit_signal = 0;
+ }
+
+ $failure_lines = "";
+ $bug_number = "";
+ $status_lines = "";
+
+ foreach $line (@output) {
+
+# watch for testcase to proclaim what exit code it expects to
+# produce (0 by default)
+ if ($line =~ /expect(ed)?\s*exit\s*code\s*\:?\s*(\d+)/i) {
+ $expected_exit = $2;
+ &dd ("Test case expects exit code $expected_exit");
+ }
+
+# watch for failures
+ if ($line =~ /failed!/i) {
+ $failure_lines .= $line;
+ }
+
+# and watch for bugnumbers
+# XXX This only allows 1 bugnumber per testfile, should be
+# XXX modified to allow for multiple.
+ if ($line =~ /bugnumber\s*\:?\s*(.*)/i) {
+ $1 =~ /(\n+)/;
+ $bug_number = $1;
+ }
+
+# and watch for status
+ if ($line =~ /status/i) {
+ $status_lines .= $line;
+ }
+
+ }
+
+ if (!@output) {
+ @output = ("Testcase produced no output!");
+ }
+
+ if ($got_exit != $expected_exit) {
+# full testcase output dumped on mismatched exit codes,
+ &report_failure ($test, "Expected exit code " .
+ "$expected_exit, got $got_exit\n" .
+ "Testcase terminated with signal $exit_signal\n" .
+ "Complete testcase output was:\n" .
+ join ("\n",@output), $bug_number);
+ } elsif ($failure_lines) {
+# only offending lines if exit codes matched
+ &report_failure ($test, "$status_lines\n".
+ "Failure messages were:\n$failure_lines",
+ $bug_number);
+ }
+
+ &dd ("exit code $got_exit, exit signal $exit_signal.");
+
+ $tests_completed++;
+ }
+}
+
+sub write_results {
+ my ($list_name, $neglist_name);
+ my $completion_date = localtime;
+ my $failure_pct = int(($failures_reported / $tests_completed) * 10000) /
+ 100;
+ &dd ("Writing output to $opt_output_file.");
+
+ if ($#opt_test_list_files == -1) {
+ $list_name = "All tests";
+ } elsif ($#opt_test_list_files < 10) {
+ $list_name = join (", ", @opt_test_list_files);
+ } else {
+ $list_name = "($#opt_test_list_files test files specified)";
+ }
+
+ if ($#opt_neg_list_files == -1) {
+ $neglist_name = "(none)";
+ } elsif ($#opt_test_list_files < 10) {
+ $neglist_name = join (", ", @opt_neg_list_files);
+ } else {
+ $neglist_name = "($#opt_neg_list_files skip files specified)";
+ }
+
+ open (OUTPUT, "> $opt_output_file") ||
+ die ("Could not create output file $opt_output_file");
+
+ print OUTPUT
+ ("<html><head>\n" .
+ "<title>Test results, $opt_engine_type</title>\n" .
+ "</head>\n" .
+ "<body bgcolor='white'>\n" .
+ "<a name='tippy_top'></a>\n" .
+ "<h2>Test results, $opt_engine_type</h2><br>\n" .
+ "<p class='results_summary'>\n" .
+ "Test List: $list_name<br>\n" .
+ "Skip List: $neglist_name<br>\n" .
+ ($#test_list + 1) . " test(s) selected, $tests_completed test(s) " .
+ "completed, $failures_reported failures reported " .
+ "($failure_pct% failed)<br>\n" .
+ "Engine command line: $engine_command<br>\n" .
+ "OS type: $os_type<br>\n");
+
+ if ($opt_engine_type =~ /^rhino/) {
+ open (JAVAOUTPUT, $opt_java_path . "java -fullversion " .
+ $redirect_command . " |");
+ print OUTPUT <JAVAOUTPUT>;
+ print OUTPUT "<BR>";
+ close (JAVAOUTPUT);
+ }
+
+ print OUTPUT
+ ("Testcase execution time: $exec_time_string.<br>\n" .
+ "Tests completed on $completion_date.<br><br>\n");
+
+ if ($failures_reported > 0) {
+ print OUTPUT
+ ("[ <a href='#fail_detail'>Failure Details</a> | " .
+ "<a href='#retest_list'>Retest List</a> | " .
+ "<a href='menu.html'>Test Selection Page</a> ]<br>\n" .
+ "<hr>\n" .
+ "<a name='fail_detail'></a>\n" .
+ "<h2>Failure Details</h2><br>\n<dl>" .
+ $html .
+ "</dl>\n[ <a href='#tippy_top'>Top of Page</a> | " .
+ "<a href='#fail_detail'>Top of Failures</a> ]<br>\n" .
+ "<hr>\n<pre>\n" .
+ "<a name='retest_list'></a>\n" .
+ "<h2>Retest List</h2><br>\n" .
+ "# Retest List, $opt_engine_type, " .
+ "generated $completion_date.\n" .
+ "# Original test base was: $list_name.\n" .
+ "# $tests_completed of " . ($#test_list + 1) .
+ " test(s) were completed, " .
+ "$failures_reported failures reported.\n" .
+ join ("\n", @failed_tests) );
+#"</pre>\n" .
+# "[ <a href='#tippy_top'>Top of Page</a> | " .
+# "<a href='#retest_list'>Top of Retest List</a> ]<br>\n");
+ } else {
+ print OUTPUT
+ ("<h1>Whoop-de-doo, nothing failed!</h1>\n");
+ }
+
+#print OUTPUT "</body>";
+
+close (OUTPUT);
+
+&status ("Wrote results to '$opt_output_file'.");
+
+if ($opt_console_failures) {
+ &status ("$failures_reported test(s) failed");
+}
+
+}
+
+sub parse_args {
+ my ($option, $value, $lastopt);
+
+ &dd ("checking command line options.");
+
+ Getopt::Mixed::init ($options);
+ $Getopt::Mixed::order = $Getopt::Mixed::RETURN_IN_ORDER;
+
+ while (($option, $value) = nextOption()) {
+
+ if ($option eq "a") {
+ &dd ("opt: running with architecture $value.");
+ $value =~ s/^ //;
+ $opt_arch = "arch -$value";
+
+ } elsif ($option eq "b") {
+ &dd ("opt: setting bugurl to '$value'.");
+ $opt_bug_url = $value;
+
+ } elsif ($option eq "c") {
+ &dd ("opt: setting classpath to '$value'.");
+ $opt_classpath = $value;
+
+ } elsif (($option eq "e") || (($option eq "") && ($lastopt eq "e"))) {
+ &dd ("opt: adding engine $value.");
+ push (@opt_engine_list, $value);
+
+ } elsif ($option eq "f") {
+ if (!$value) {
+ die ("Output file cannot be null.\n");
+ }
+ &dd ("opt: setting output file to '$value'.");
+ $opt_user_output_file = 1;
+ $opt_output_file = $value;
+
+ } elsif ($option eq "h") {
+ &usage;
+
+ } elsif ($option eq "j") {
+ if (!($value =~ /[\/\\]$/)) {
+ $value .= "/";
+ }
+ &dd ("opt: setting java path to '$value'.");
+ $opt_java_path = $value;
+
+ } elsif ($option eq "k") {
+ &dd ("opt: displaying failures on console.");
+ $opt_console_failures=1;
+
+ } elsif ($option eq "l" || (($option eq "") && ($lastopt eq "l"))) {
+ $option = "l";
+ &dd ("opt: adding test list '$value'.");
+ push (@opt_test_list_files, $value);
+
+ } elsif ($option eq "L" || (($option eq "") && ($lastopt eq "L"))) {
+ $option = "L";
+ &dd ("opt: adding negative list '$value'.");
+ push (@opt_neg_list_files, $value);
+
+ } elsif ($option eq "o") {
+ $opt_engine_params = $value;
+ &dd ("opt: setting engine params to '$opt_engine_params'.");
+
+ } elsif ($option eq "p") {
+ $opt_suite_path = $value;
+
+ if ($os_type eq "MAC") {
+ if (!($opt_suite_path =~ /\:$/)) {
+ $opt_suite_path .= ":";
+ }
+ } else {
+ if (!($opt_suite_path =~ /[\/\\]$/)) {
+ $opt_suite_path .= "/";
+ }
+ }
+
+ &dd ("opt: setting suite path to '$opt_suite_path'.");
+
+ } elsif ($option eq "s") {
+ $opt_shell_path = $value;
+ &dd ("opt: setting shell path to '$opt_shell_path'.");
+
+ } elsif ($option eq "t") {
+ &dd ("opt: tracing output. (console failures at no extra charge.)");
+ $opt_console_failures = 1;
+ $opt_trace = 1;
+
+ } elsif ($option eq "u") {
+ &dd ("opt: setting lxr url to '$value'.");
+ $opt_lxr_url = $value;
+
+ } elsif ($option eq "x") {
+ &dd ("opt: turning off exit munging.");
+ $opt_exit_munge = 0;
+
+ } else {
+ &usage;
+ }
+
+ $lastopt = $option;
+
+ }
+
+ Getopt::Mixed::cleanup();
+
+ if ($#opt_engine_list == -1) {
+ die "You must select a shell to test in.\n";
+ }
+
+}
+
+#
+# print the arguments that this script expects
+#
+sub usage {
+ print STDERR
+ ("\nusage: $0 [<options>] \n" .
+ "(-a|--arch) <arch> run with a specific architecture on mac\n" .
+ "(-b|--bugurl) Bugzilla URL.\n" .
+ " (default is $opt_bug_url)\n" .
+ "(-c|--classpath) Classpath (Rhino only.)\n" .
+ "(-e|--engine) <type> ... Specify the type of engine(s) to test.\n" .
+ " <type> is one or more of\n" .
+ " (squirrelfish|smopt|smdebug|lcopt|lcdebug|xpcshell|" .
+ "rhino|rhinoi|rhinoms|rhinomsi|rhino9|rhinoms9).\n" .
+ "(-f|--file) <file> Redirect output to file named <file>.\n" .
+ " (default is " .
+ "results-<engine-type>-<date-stamp>.html)\n" .
+ "(-h|--help) Print this message.\n" .
+ "(-j|--javapath) Location of java executable.\n" .
+ "(-k|--confail) Log failures to console (also.)\n" .
+ "(-l|--list) <file> ... List of tests to execute.\n" .
+ "(-L|--neglist) <file> ... List of tests to skip.\n" .
+ "(-o|--opt) <options> Options to pass to the JavaScript engine.\n" .
+ " (Make sure to quote them!)\n" .
+ "(-p|--testpath) <path> Root of the test suite. (default is ./)\n" .
+ "(-s|--shellpath) <path> Location of JavaScript shell.\n" .
+ "(-t|--trace) Trace script execution.\n" .
+ "(-u|--lxrurl) <url> Complete URL to tests subdirectory on lxr.\n" .
+ " (default is $opt_lxr_url)\n" .
+ "(-x|--noexitmunge) Don't do exit code munging (try this if it\n" .
+ " seems like your exit codes are turning up\n" .
+ " as exit signals.)\n");
+ exit (1);
+
+}
+
+#
+# get the shell command used to start the (either) engine
+#
+sub get_engine_command {
+
+ my $retval;
+
+ if ($opt_engine_type eq "rhino") {
+ &dd ("getting rhino engine command.");
+ $opt_rhino_opt = 0;
+ $opt_rhino_ms = 0;
+ $retval = &get_rhino_engine_command;
+ } elsif ($opt_engine_type eq "rhinoi") {
+ &dd ("getting rhinoi engine command.");
+ $opt_rhino_opt = -1;
+ $opt_rhino_ms = 0;
+ $retval = &get_rhino_engine_command;
+ } elsif ($opt_engine_type eq "rhino9") {
+ &dd ("getting rhino engine command.");
+ $opt_rhino_opt = 9;
+ $opt_rhino_ms = 0;
+ $retval = &get_rhino_engine_command;
+ } elsif ($opt_engine_type eq "rhinoms") {
+ &dd ("getting rhinoms engine command.");
+ $opt_rhino_opt = 0;
+ $opt_rhino_ms = 1;
+ $retval = &get_rhino_engine_command;
+ } elsif ($opt_engine_type eq "rhinomsi") {
+ &dd ("getting rhinomsi engine command.");
+ $opt_rhino_opt = -1;
+ $opt_rhino_ms = 1;
+ $retval = &get_rhino_engine_command;
+ } elsif ($opt_engine_type eq "rhinoms9") {
+ &dd ("getting rhinomsi engine command.");
+ $opt_rhino_opt = 9;
+ $opt_rhino_ms = 1;
+ $retval = &get_rhino_engine_command;
+ } elsif ($opt_engine_type eq "xpcshell") {
+ &dd ("getting xpcshell engine command.");
+ $retval = &get_xpc_engine_command;
+ } elsif ($opt_engine_type =~ /^lc(opt|debug)$/) {
+ &dd ("getting liveconnect engine command.");
+ $retval = &get_lc_engine_command;
+ } elsif ($opt_engine_type =~ /^sm(opt|debug)$/) {
+ &dd ("getting spidermonkey engine command.");
+ $retval = &get_sm_engine_command;
+ } elsif ($opt_engine_type =~ /^ep(opt|debug)$/) {
+ &dd ("getting epimetheus engine command.");
+ $retval = &get_ep_engine_command;
+ } elsif ($opt_engine_type eq "squirrelfish") {
+ &dd ("getting squirrelfish engine command.");
+ $retval = &get_squirrelfish_engine_command;
+ } else {
+ die ("Unknown engine type selected, '$opt_engine_type'.\n");
+ }
+
+ $retval .= " $opt_engine_params";
+
+ &dd ("got '$retval'");
+
+ return $retval;
+
+}
+
+#
+# get the shell command used to run rhino
+#
+sub get_rhino_engine_command {
+ my $retval = $opt_java_path . ($opt_rhino_ms ? "jview " : "java ");
+
+ if ($opt_shell_path) {
+ $opt_classpath = ($opt_classpath) ?
+ $opt_classpath . ":" . $opt_shell_path :
+ $opt_shell_path;
+ }
+
+ if ($opt_classpath) {
+ $retval .= ($opt_rhino_ms ? "/cp:p" : "-classpath") . " $opt_classpath ";
+ }
+
+ $retval .= "org.mozilla.javascript.tools.shell.Main";
+
+ if ($opt_rhino_opt) {
+ $retval .= " -opt $opt_rhino_opt";
+ }
+
+ return $retval;
+
+}
+
+#
+# get the shell command used to run xpcshell
+#
+sub get_xpc_engine_command {
+ my $retval;
+ my $m5_home = @ENV{"MOZILLA_FIVE_HOME"} ||
+ die ("You must set MOZILLA_FIVE_HOME to use the xpcshell" ,
+ (!$unixish) ? "." : ", also " .
+ "setting LD_LIBRARY_PATH to the same directory may get rid of " .
+ "any 'library not found' errors.\n");
+
+ if (($unixish) && (!@ENV{"LD_LIBRARY_PATH"})) {
+ print STDERR "-#- WARNING: LD_LIBRARY_PATH is not set, xpcshell may " .
+ "not be able to find the required components.\n";
+ }
+
+ if (!($m5_home =~ /[\/\\]$/)) {
+ $m5_home .= "/";
+ }
+
+ $retval = $m5_home . "xpcshell";
+
+ if ($os_type eq "WIN") {
+ $retval .= ".exe";
+ }
+
+ $retval = &xp_path($retval);
+
+ if (($os_type ne "MAC") && !(-x $retval)) {
+# mac doesn't seem to deal with -x correctly
+ die ($retval . " is not a valid executable on this system.\n");
+ }
+
+ return $retval;
+
+}
+
+#
+# get the shell command used to run squirrelfish
+#
+sub get_squirrelfish_engine_command {
+ my $retval;
+
+ if ($opt_shell_path) {
+ # FIXME: Quoting the path this way won't work with paths with quotes in
+ # them. A better fix would be to use the multi-parameter version of
+ # open(), but that doesn't work on ActiveState Perl.
+ $retval = "\"" . $opt_shell_path . "\"";
+ } else {
+ die "Please specify a full path to the squirrelfish testing engine";
+ }
+
+ return $retval;
+}
+
+#
+# get the shell command used to run spidermonkey
+#
+sub get_sm_engine_command {
+ my $retval;
+
+# Look for Makefile.ref style make first.
+# (On Windows, spidermonkey can be made by two makefiles, each putting the
+# executable in a diferent directory, under a different name.)
+
+ if ($opt_shell_path) {
+# if the user provided a path to the shell, return that.
+ $retval = $opt_shell_path;
+
+ } else {
+
+ if ($os_type eq "MAC") {
+ $retval = $opt_suite_path . ":src:macbuild:JS";
+ } else {
+ $retval = $opt_suite_path . "../src/";
+ opendir (SRC_DIR_FILES, $retval);
+ my @src_dir_files = readdir(SRC_DIR_FILES);
+ closedir (SRC_DIR_FILES);
+
+ my ($dir, $object_dir);
+ my $pattern = ($opt_engine_type eq "smdebug") ?
+ 'DBG.OBJ' : 'OPT.OBJ';
+
+# scan for the first directory matching
+# the pattern expected to hold this type (debug or opt) of engine
+ foreach $dir (@src_dir_files) {
+ if ($dir =~ $pattern) {
+ $object_dir = $dir;
+ last;
+ }
+ }
+
+ if (!$object_dir && $os_type ne "WIN") {
+ die ("Could not locate an object directory in $retval " .
+ "matching the pattern *$pattern. Have you built the " .
+ "engine?\n");
+ }
+
+ if (!(-x $retval . $object_dir . "/js.exe") && ($os_type eq "WIN")) {
+# On windows, you can build with js.mak as well as Makefile.ref
+# (Can you say WTF boys and girls? I knew you could.)
+# So, if the exe the would have been built by Makefile.ref isn't
+# here, check for the js.mak version before dying.
+ if ($opt_shell_path) {
+ $retval = $opt_shell_path;
+ if (!($retval =~ /[\/\\]$/)) {
+ $retval .= "/";
+ }
+ } else {
+ if ($opt_engine_type eq "smopt") {
+ $retval = "../src/Release/";
+ } else {
+ $retval = "../src/Debug/";
+ }
+ }
+
+ $retval .= "jsshell.exe";
+
+ } else {
+ $retval .= $object_dir . "/js";
+ if ($os_type eq "WIN") {
+ $retval .= ".exe";
+ }
+ }
+ } # mac/ not mac
+
+ $retval = &xp_path($retval);
+
+ } # (user provided a path)
+
+
+ if (($os_type ne "MAC") && !(-x $retval)) {
+# mac doesn't seem to deal with -x correctly
+ die ($retval . " is not a valid executable on this system.\n");
+ }
+
+ return $retval;
+
+}
+
+#
+# get the shell command used to run epimetheus
+#
+sub get_ep_engine_command {
+ my $retval;
+
+ if ($opt_shell_path) {
+# if the user provided a path to the shell, return that -
+ $retval = $opt_shell_path;
+
+ } else {
+ my $dir;
+ my $os;
+ my $debug;
+ my $opt;
+ my $exe;
+
+ $dir = $opt_suite_path . "../../js2/src/";
+
+ if ($os_type eq "MAC") {
+#
+# On the Mac, the debug and opt builds lie in the same directory -
+#
+ $os = "macbuild:";
+ $debug = "";
+ $opt = "";
+ $exe = "JS2";
+ } elsif ($os_type eq "WIN") {
+ $os = "winbuild/Epimetheus/";
+ $debug = "Debug/";
+ $opt = "Release/";
+ $exe = "Epimetheus.exe";
+ } else {
+ $os = "";
+ $debug = "";
+ $opt = ""; # <<<----- XXX THIS IS NOT RIGHT! CHANGE IT!
+ $exe = "epimetheus";
+ }
+
+
+ if ($opt_engine_type eq "epdebug") {
+ $retval = $dir . $os . $debug . $exe;
+ } else {
+ $retval = $dir . $os . $opt . $exe;
+ }
+
+ $retval = &xp_path($retval);
+
+ }# (user provided a path)
+
+
+ if (($os_type ne "MAC") && !(-x $retval)) {
+# mac doesn't seem to deal with -x correctly
+ die ($retval . " is not a valid executable on this system.\n");
+ }
+
+ return $retval;
+}
+
+#
+# get the shell command used to run the liveconnect shell
+#
+sub get_lc_engine_command {
+ my $retval;
+
+ if ($opt_shell_path) {
+ $retval = $opt_shell_path;
+ } else {
+ if ($os_type eq "MAC") {
+ die "Don't know how to run the lc shell on the mac yet.\n";
+ } else {
+ $retval = $opt_suite_path . "../src/liveconnect/";
+ opendir (SRC_DIR_FILES, $retval);
+ my @src_dir_files = readdir(SRC_DIR_FILES);
+ closedir (SRC_DIR_FILES);
+
+ my ($dir, $object_dir);
+ my $pattern = ($opt_engine_type eq "lcdebug") ?
+ 'DBG.OBJ' : 'OPT.OBJ';
+
+ foreach $dir (@src_dir_files) {
+ if ($dir =~ $pattern) {
+ $object_dir = $dir;
+ last;
+ }
+ }
+
+ if (!$object_dir) {
+ die ("Could not locate an object directory in $retval " .
+ "matching the pattern *$pattern. Have you built the " .
+ "engine?\n");
+ }
+
+ $retval .= $object_dir . "/";
+
+ if ($os_type eq "WIN") {
+ $retval .= "lcshell.exe";
+ } else {
+ $retval .= "lcshell";
+ }
+ } # mac/ not mac
+
+ $retval = &xp_path($retval);
+
+ } # (user provided a path)
+
+
+ if (($os_type ne "MAC") && !(-x $retval)) {
+# mac doesn't seem to deal with -x correctly
+ die ("$retval is not a valid executable on this system.\n");
+ }
+
+ return $retval;
+
+}
+
+sub get_os_type {
+
+ if ("\n" eq "\015") {
+ return "MAC";
+ }
+
+ my $uname = `uname -a`;
+
+ if ($uname =~ /WIN/) {
+ $uname = "WIN";
+ } else {
+ chop $uname;
+ }
+
+ &dd ("get_os_type returning '$uname'.");
+ return $uname;
+
+}
+
+sub get_test_list {
+ my @test_list;
+ my @neg_list;
+
+ if ($#opt_test_list_files > -1) {
+ my $list_file;
+
+ &dd ("getting test list from user specified source.");
+
+ foreach $list_file (@opt_test_list_files) {
+ push (@test_list, &expand_user_test_list($list_file));
+ }
+ } else {
+ &dd ("no list file, groveling in '$opt_suite_path'.");
+
+ @test_list = &get_default_test_list($opt_suite_path);
+ }
+
+ if ($#opt_neg_list_files > -1) {
+ my $list_file;
+ my $orig_size = $#test_list + 1;
+ my $actually_skipped;
+
+ &dd ("getting negative list from user specified source.");
+
+ foreach $list_file (@opt_neg_list_files) {
+ push (@neg_list, &expand_user_test_list($list_file));
+ }
+
+ @test_list = &subtract_arrays (\@test_list, \@neg_list);
+
+ $actually_skipped = $orig_size - ($#test_list + 1);
+
+ &dd ($actually_skipped . " of " . $orig_size .
+ " tests will be skipped.");
+ &dd ((($#neg_list + 1) - $actually_skipped) . " skip tests were " .
+ "not actually part of the test list.");
+
+
+ }
+
+ return @test_list;
+
+}
+
+#
+# reads $list_file, storing non-comment lines into an array.
+# lines in the form suite_dir/[*] or suite_dir/test_dir/[*] are expanded
+# to include all test files under the specified directory
+#
+sub expand_user_test_list {
+ my ($list_file) = @_;
+ my @retval = ();
+
+#
+# Trim off the leading path separator that begins relative paths on the Mac.
+# Each path will get concatenated with $opt_suite_path, which ends in one.
+#
+# Also note:
+#
+# We will call expand_test_list_entry(), which does pattern-matching on $list_file.
+# This will make the pattern-matching the same as it would be on Linux/Windows -
+#
+ if ($os_type eq "MAC") {
+ $list_file =~ s/^$path_sep//;
+ }
+
+ if ($list_file =~ /\.js$/ || -d $opt_suite_path . $list_file) {
+
+ push (@retval, &expand_test_list_entry($list_file));
+
+ } else {
+
+ open (TESTLIST, $list_file) ||
+ die("Error opening test list file '$list_file': $!\n");
+
+ while (<TESTLIST>) {
+ s/\r*\n*$//;
+ if (!(/\s*\#/)) {
+# It's not a comment, so process it
+ push (@retval, &expand_test_list_entry($_));
+ }
+ }
+
+ close (TESTLIST);
+
+ }
+
+ return @retval;
+
+}
+
+
+#
+# Currently expect all paths to be RELATIVE to the top-level tests directory.
+# One day, this should be improved to allow absolute paths as well -
+#
+sub expand_test_list_entry {
+ my ($entry) = @_;
+ my @retval;
+
+ if ($entry =~ /\.js$/) {
+# it's a regular entry, add it to the list
+ if (-f $opt_suite_path . $entry) {
+ push (@retval, $entry);
+ } else {
+ status ("testcase '$entry' not found.");
+ }
+ } elsif ($entry =~ /(.*$path_sep[^\*][^$path_sep]*)$path_sep?\*?$/) {
+# Entry is in the form suite_dir/test_dir[/*]
+# so iterate all tests under it
+ my $suite_and_test_dir = $1;
+ my @test_files = &get_js_files ($opt_suite_path .
+ $suite_and_test_dir);
+ my $i;
+
+ foreach $i (0 .. $#test_files) {
+ $test_files[$i] = $suite_and_test_dir . $path_sep .
+ $test_files[$i];
+ }
+
+ splice (@retval, $#retval + 1, 0, @test_files);
+
+ } elsif ($entry =~ /([^\*][^$path_sep]*)$path_sep?\*?$/) {
+# Entry is in the form suite_dir[/*]
+# so iterate all test dirs and tests under it
+ my $suite = $1;
+ my @test_dirs = &get_subdirs ($opt_suite_path . $suite);
+ my $test_dir;
+
+ foreach $test_dir (@test_dirs) {
+ my @test_files = &get_js_files ($opt_suite_path . $suite .
+ $path_sep . $test_dir);
+ my $i;
+
+ foreach $i (0 .. $#test_files) {
+ $test_files[$i] = $suite . $path_sep . $test_dir . $path_sep .
+ $test_files[$i];
+ }
+
+ splice (@retval, $#retval + 1, 0, @test_files);
+ }
+
+ } else {
+ die ("Dont know what to do with list entry '$entry'.\n");
+ }
+
+ return @retval;
+
+}
+
+#
+# Grovels through $suite_path, searching for *all* test files. Used when the
+# user doesn't supply a test list.
+#
+sub get_default_test_list {
+ my ($suite_path) = @_;
+ my @suite_list = &get_subdirs($suite_path);
+ my $suite;
+ my @retval;
+
+ foreach $suite (@suite_list) {
+ my @test_dir_list = get_subdirs ($suite_path . $suite);
+ my $test_dir;
+
+ foreach $test_dir (@test_dir_list) {
+ my @test_list = get_js_files ($suite_path . $suite . $path_sep .
+ $test_dir);
+ my $test;
+
+ foreach $test (@test_list) {
+ $retval[$#retval + 1] = $suite . $path_sep . $test_dir .
+ $path_sep . $test;
+ }
+ }
+ }
+
+ return @retval;
+
+}
+
+#
+# generate an output file name based on the date
+#
+sub get_tempfile_name {
+ my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) =
+ &get_padded_time (localtime);
+ my $rv;
+
+ if ($os_type ne "MAC") {
+ $rv = "results-" . $year . "-" . $mon . "-" . $mday . "-" . $hour .
+ $min . $sec . "-" . $opt_engine_type;
+ } else {
+ $rv = "res-" . $year . $mon . $mday . $hour . $min . $sec . "-" .
+ $opt_engine_type
+ }
+
+ return $rv . ".html";
+}
+
+sub get_padded_time {
+ my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = @_;
+
+ $mon++;
+ $mon = &zero_pad($mon);
+ $year += 1900;
+ $mday= &zero_pad($mday);
+ $sec = &zero_pad($sec);
+ $min = &zero_pad($min);
+ $hour = &zero_pad($hour);
+
+ return ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst);
+
+}
+
+sub zero_pad {
+ my ($string) = @_;
+
+ $string = ($string < 10) ? "0" . $string : $string;
+ return $string;
+}
+
+sub subtract_arrays {
+ my ($whole_ref, $part_ref) = @_;
+ my @whole = @$whole_ref;
+ my @part = @$part_ref;
+ my $line;
+
+ foreach $line (@part) {
+ @whole = grep (!/$line/, @whole);
+ }
+
+ return @whole;
+
+}
+
+#
+# Convert unix path to mac style.
+#
+sub unix_to_mac {
+ my ($path) = @_;
+ my @path_elements = split ("/", $path);
+ my $rv = "";
+ my $i;
+
+ foreach $i (0 .. $#path_elements) {
+ if ($path_elements[$i] eq ".") {
+ if (!($rv =~ /\:$/)) {
+ $rv .= ":";
+ }
+ } elsif ($path_elements[$i] eq "..") {
+ if (!($rv =~ /\:$/)) {
+ $rv .= "::";
+ } else {
+ $rv .= ":";
+ }
+ } elsif ($path_elements[$i] ne "") {
+ $rv .= $path_elements[$i] . ":";
+ }
+
+ }
+
+ $rv =~ s/\:$//;
+
+ return $rv;
+}
+
+#
+# Convert unix path to win style.
+#
+sub unix_to_win {
+ my ($path) = @_;
+
+ if ($path_sep ne $win_sep) {
+ $path =~ s/$path_sep/$win_sep/g;
+ }
+
+ return $path;
+}
+
+#
+# Windows shells require "/" or "\" as path separator.
+# Find out the one used in the current Windows shell.
+#
+sub get_win_sep {
+ my $path = $ENV{"PATH"} || $ENV{"Path"} || $ENV{"path"};
+ $path =~ /\\|\//;
+ return $&;
+}
+
+#
+# Convert unix path to correct style based on platform.
+#
+sub xp_path {
+ my ($path) = @_;
+
+ if ($os_type eq "MAC") {
+ return &unix_to_mac($path);
+ } elsif($os_type eq "WIN") {
+ return &unix_to_win($path);
+ } else {
+ return $path;
+ }
+}
+
+sub numericcmp($$)
+{
+ my ($aa, $bb) = @_;
+
+ my @a = split /(\d+)/, $aa;
+ my @b = split /(\d+)/, $bb;
+
+ while (@a && @b) {
+ my $a = shift @a;
+ my $b = shift @b;
+ return $a <=> $b if $a =~ /^\d/ && $b =~ /^\d/ && $a != $b;
+ return $a cmp $b if $a ne $b;
+ }
+
+ return @a <=> @b;
+}
+
+#
+# given a directory, return an array of all subdirectories
+#
+sub get_subdirs {
+ my ($dir) = @_;
+ my @subdirs;
+
+ if ($os_type ne "MAC") {
+ if (!($dir =~ /\/$/)) {
+ $dir = $dir . "/";
+ }
+ } else {
+ if (!($dir =~ /\:$/)) {
+ $dir = $dir . ":";
+ }
+ }
+ opendir (DIR, $dir) || die ("couldn't open directory $dir: $!");
+ my @testdir_contents = sort numericcmp readdir(DIR);
+ closedir(DIR);
+
+ foreach (@testdir_contents) {
+ if ((-d ($dir . $_)) && ($_ ne 'CVS') && ($_ ne '.') && ($_ ne '..')) {
+ @subdirs[$#subdirs + 1] = $_;
+ }
+ }
+
+ return @subdirs;
+}
+
+#
+# given a directory, return an array of all the js files that are in it.
+#
+sub get_js_files {
+ my ($test_subdir) = @_;
+ my (@js_file_array, @subdir_files);
+
+ opendir (TEST_SUBDIR, $test_subdir) || die ("couldn't open directory " .
+ "$test_subdir: $!");
+ @subdir_files = sort numericcmp readdir(TEST_SUBDIR);
+ closedir( TEST_SUBDIR );
+
+ foreach (@subdir_files) {
+ if ($_ =~ /\.js$/) {
+ $js_file_array[$#js_file_array+1] = $_;
+ }
+ }
+
+ return @js_file_array;
+}
+
+sub report_failure {
+ my ($test, $message, $bug_number) = @_;
+ my $bug_line = "";
+
+ $failures_reported++;
+
+ $message =~ s/\n+/\n/g;
+ $test =~ s/\:/\//g;
+
+ if ($opt_console_failures) {
+ if($bug_number) {
+ print STDERR ("*-* Testcase $test failed:\nBug Number $bug_number".
+ "\n$message\n");
+ } else {
+ print STDERR ("*-* Testcase $test failed:\n$message\n");
+ }
+ }
+
+ $message =~ s/\n/<br>\n/g;
+ $html .= "<a name='failure$failures_reported'></a>";
+
+ if ($bug_number) {
+ $bug_line = "<a href='$opt_bug_url$bug_number' target='other_window'>".
+ "Bug Number $bug_number</a>";
+ }
+
+ if ($opt_lxr_url) {
+ $test =~ /\/?([^\/]+\/[^\/]+\/[^\/]+)$/;
+ $test = $1;
+ $html .= "<dd><b>".
+ "Testcase <a target='other_window' href='$opt_lxr_url$test'>$1</a> " .
+ "failed</b> $bug_line<br>\n";
+ } else {
+ $html .= "<dd><b>".
+ "Testcase $test failed</b> $bug_line<br>\n";
+ }
+
+ $html .= " [ ";
+ if ($failures_reported > 1) {
+ $html .= "<a href='#failure" . ($failures_reported - 1) . "'>" .
+ "Previous Failure</a> | ";
+ }
+
+ $html .= "<a href='#failure" . ($failures_reported + 1) . "'>" .
+ "Next Failure</a> | " .
+ "<a href='#tippy_top'>Top of Page</a> ]<br>\n" .
+ "<tt>$message</tt><br>\n";
+
+ @failed_tests[$#failed_tests + 1] = $test;
+
+}
+
+sub dd {
+
+ if ($opt_trace) {
+ print ("-*- ", @_ , "\n");
+ }
+
+}
+
+sub status {
+
+ print ("-#- ", @_ , "\n");
+
+}
+
+sub int_handler {
+ my $resp;
+
+ do {
+ print ("\n*** User Break: Just [Q]uit, Quit and [R]eport, [C]ontinue ?");
+ $resp = <STDIN>;
+ } until ($resp =~ /[QqRrCc]/);
+
+ if ($resp =~ /[Qq]/) {
+ print ("User Exit. No results were generated.\n");
+ exit 1;
+ } elsif ($resp =~ /[Rr]/) {
+ $user_exit = 1;
+ }
+
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/menufoot.html b/Source/JavaScriptCore/tests/mozilla/menufoot.html
new file mode 100644
index 0000000..da7902e
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/menufoot.html
@@ -0,0 +1,8 @@
+
+ </form>
+
+ <hr>
+ <address><a href="mailto:rginda@netscape.com"></a></address>
+<!-- Created: Fri Oct 29 21:32:20 PDT 1999 -->
+ </body>
+</html>
diff --git a/Source/JavaScriptCore/tests/mozilla/menuhead.html b/Source/JavaScriptCore/tests/mozilla/menuhead.html
new file mode 100644
index 0000000..827dc43
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/menuhead.html
@@ -0,0 +1,138 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+ <head>
+ <title>Core JavaScript Tests</title>
+
+ <script language="JavaScript">
+ function selectAll (suite, testDir)
+ {
+ if (typeof suite == "undefined")
+ for (var suite in suites)
+ setAllDirs (suite, true);
+ else if (typeof testDir == "undefined")
+ setAllDirs (suite, true);
+ else
+ setAllTests (suite, testDir, true);
+ updateTotals();
+ }
+
+ function selectNone (suite, testDir)
+ {
+
+ if (typeof suite == "undefined")
+ for (var suite in suites)
+ setAllDirs (suite, false);
+ else if (typeof testDir == "undefined")
+ setAllDirs (suite, false);
+ else
+ setAllTests (suite, testDir, false);
+ updateTotals();
+ }
+
+ function setAllDirs (suite, value)
+ {
+ var dir;
+ for (dir in suites[suite].testDirs)
+ setAllTests (suite, dir, value);
+
+ }
+
+ function setAllTests (suite, testDir, value)
+ {
+ var test, radioName;
+
+ for (test in suites[suite].testDirs[testDir].tests)
+ {
+ radioName = suites[suite].testDirs[testDir].tests[test];
+ document.forms["testCases"].elements[radioName].checked = value;
+ }
+
+ }
+
+ function createList ()
+ {
+ var suite, testDir, test, radioName;
+ var elements = document.forms["testCases"].elements;
+
+ var win = window.open ("about:blank", "other_window");
+ win.document.open();
+ win.document.write ("<pre>\n");
+
+ win.document.write ("# Created " + new Date() + "\n");
+
+ for (suite in suites)
+ win.document.write ("# " + suite + ": " +
+ elements["SUMMARY_" + suite].value + "\n");
+ win.document.write ("# TOTAL: " + elements["TOTAL"].value + "\n");
+
+ for (suite in suites)
+ for (testDir in suites[suite].testDirs)
+ for (test in suites[suite].testDirs[testDir].tests)
+ {
+ radioName = suites[suite].testDirs[testDir].tests[test];
+ if (elements[radioName].checked)
+ win.document.write (suite + "/" + testDir + "/" +
+ elements[radioName].value + "\n");
+ }
+
+ win.document.close();
+
+ }
+
+ function onRadioClick (name)
+ {
+ var radio = document.forms["testCases"].elements[name];
+ radio.checked = !radio.checked;
+ setTimeout ("updateTotals();", 100);
+ return false;
+ }
+
+ function updateTotals()
+ {
+ var suite, testDir, test, radioName, selected, available, pct;
+ var totalAvailable = 0, totalSelected = 0;
+
+ var elements = document.forms["testCases"].elements;
+
+ for (suite in suites)
+ {
+ selected = available = 0;
+ for (testDir in suites[suite].testDirs)
+ for (test in suites[suite].testDirs[testDir].tests)
+ {
+ available++
+ radioName = suites[suite].testDirs[testDir].tests[test];
+ if (elements[radioName].checked)
+ selected++;
+ }
+ totalSelected += selected;
+ totalAvailable += available;
+ pct = parseInt((selected / available) * 100);
+ if (isNaN(pct))
+ pct = 0;
+
+ elements["SUMMARY_" + suite].value = selected + "/" + available +
+ " (" + pct + "%) selected";
+ }
+
+ pct = parseInt((totalSelected / totalAvailable) * 100);
+ if (isNaN(pct))
+ pct = 0;
+
+ elements["TOTAL"].value = totalSelected + "/" + totalAvailable + " (" +
+ pct + "%) selected";
+
+ }
+
+ </script>
+
+ </head>
+
+ <body bgcolor="white" onLoad="updateTotals()">
+ <a name='top_of_page'></a>
+ <h1>Core JavaScript Tests</h1>
+
+ <form name="testCases">
+ <input type='button' value='Export Test List' onClick='createList();'>
+ <input type='button' value='Import Test List'
+ onClick='window.open("importList.html", "other_window");'>
diff --git a/Source/JavaScriptCore/tests/mozilla/mkhtml.pl b/Source/JavaScriptCore/tests/mozilla/mkhtml.pl
new file mode 100644
index 0000000..99cb2c5
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/mkhtml.pl
@@ -0,0 +1,84 @@
+#!/ns/tools/bin/perl5
+
+# mkhtml.pl cruises through your $MOZ_SRC/mozilla/js/tests/ subdirectories,
+# and for any .js file it finds, creates an HTML file that includes:
+# $MOZ_SRC/mozilla/js/tests/$suite/shell.js, $
+# MOZ_SRC/mozilla/js/tests/$suite/browser.js,
+# and the test.js file.
+#
+#
+
+$moz_src = $ENV{"MOZ_SRC"} ||
+ die ("You need to set your MOZ_SRC environment variable.\n");
+
+$test_home = $moz_src ."/js/tests/";
+
+opendir (TEST_HOME, $test_home);
+@__suites = readdir (TEST_HOME);
+closedir TEST_HOME;
+
+foreach (@__suites ) {
+ if ( -d $_ && $_ !~ /\./ && $_ !~ 'CVS' ) {
+ $suites[$#suites+1] = $_;
+ }
+}
+if ( ! $ARGV[0] ) {
+ die ( "Specify a directory: ". join(" ", @suites) ."\n" );
+}
+
+$js_test_dir = $moz_src . "/js/tests/" . $ARGV[0] ."/";
+
+print "Generating html files for the tests in $js_test_dir\n";
+
+$shell_js = $js_test_dir . "shell.js";
+$browser_js = $js_test_dir . "browser.js";
+
+# cd to the test directory
+chdir $js_test_dir ||
+ die "Couldn't chdir to js_test_dir, which is $js_test_dir\n";
+
+print ( "js_test_dir is $js_test_dir\n" );
+
+# read the test directory
+opendir ( JS_TEST_DIR, $js_test_dir );
+# || die "Couldn't open js_test_dir, which is $js_test_dir\n";
+@js_test_dir_items = readdir( JS_TEST_DIR );
+# || die "Couldn't read js_test_dir, which is $js_test_dir\n";
+closedir( JS_TEST_DIR );
+
+print ("The js_test_dir_items are: " . join( ",", @js_test_dir_items ) . "\n");
+
+# figure out which of the items are directories
+foreach $js_test_subdir ( @js_test_dir_items ) {
+ if ( -d $js_test_subdir ) {
+
+ $js_test_subdir = $js_test_dir ."/" . $js_test_subdir;
+ chdir $js_test_subdir
+ || die "Couldn't chdir to js_test_subdir $js_test_subdir\n";
+ print "Just chdir'd to $js_test_subdir \n";
+
+ opendir( JS_TEST_SUBDIR, $js_test_subdir );
+ @subdir_tests = readdir( JS_TEST_SUBDIR );
+ closedir( JS_TEST_SUBDIR );
+
+ foreach ( @subdir_tests ) {
+ $js_test = $_;
+
+ if ( $_ =~ /\.js$/ ) {
+ s/\.js$/\.html/;
+ print $_ ."\n";
+ open( HTML_TEST, "> $_")
+ || die "Can't open html file $test_html\n";
+ print HTML_TEST
+ '<script src=./../shell.js></script>';
+ print HTML_TEST
+ '<script src=./../browser.js></script>';
+ print HTML_TEST
+ '<script src=./' . $js_test. '></script>';
+ close HTML_TEST;
+ }
+ }
+ }
+ chdir $js_test_dir;
+}
+
diff --git a/Source/JavaScriptCore/tests/mozilla/mklistpage.pl b/Source/JavaScriptCore/tests/mozilla/mklistpage.pl
new file mode 100644
index 0000000..9479abf
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/mklistpage.pl
@@ -0,0 +1,261 @@
+#!/usr/bin/perl
+#
+# The contents of this file are subject to the Netscape Public
+# License Version 1.1 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a copy of
+# the License at http://www.mozilla.org/NPL/
+#
+# Software distributed under the License is distributed on an "AS
+# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# rights and limitations under the License.
+#
+# The Original Code is JavaScript Core Tests.
+#
+# The Initial Developer of the Original Code is Netscape
+# Communications Corporation. Portions created by Netscape are
+# Copyright (C) 1997-1999 Netscape Communications Corporation. All
+# Rights Reserved.
+#
+# Alternatively, the contents of this file may be used under the
+# terms of the GNU Public License (the "GPL"), in which case the
+# provisions of the GPL are applicable instead of those above.
+# If you wish to allow use of your version of this file only
+# under the terms of the GPL and not to allow others to use your
+# version of this file under the NPL, indicate your decision by
+# deleting the provisions above and replace them with the notice
+# and other provisions required by the GPL. If you do not delete
+# the provisions above, a recipient may use your version of this
+# file under either the NPL or the GPL.
+#
+# Contributers:
+# Robert Ginda
+#
+# Creates the meat of a test suite manager page, requites menuhead.html and menufoot.html
+# to create the complete page. The test suite manager lets you choose a subset of tests
+# to run under the runtests2.pl script.
+#
+
+local $lxr_url = "http://lxr.mozilla.org/mozilla/source/js/tests/";
+local $suite_path = $ARGV[0] || "./";
+local $uid = 0; # radio button unique ID
+local $html = ""; # html output
+local $javascript = ""; # script output
+
+&main;
+
+print (&scriptTag($javascript) . "\n");
+print ($html);
+
+sub main {
+ local $i, @suite_list;
+
+ if (!($suite_path =~ /\/$/)) {
+ $suite_path = $suite_path . "/";
+ }
+
+ @suite_list = sort(&get_subdirs ($suite_path));
+
+ $javascript .= "suites = new Object();\n";
+
+ $html .= "<h3>Test Suites:</h3>\n";
+ $html .= "<center>\n";
+ $html .= " <input type='button' value='Select All' " .
+ "onclick='selectAll();'> ";
+ $html .= " <input type='button' value='Select None' " .
+ "onclick='selectNone();'> ";
+
+ # suite menu
+ $html .= "<table border='1'>\n";
+ foreach $suite (@suite_list) {
+ local @readme_text = ("No description available.");
+ if (open (README, $suite_path . $suite . "/README")) {
+ @readme_text = <README>;
+ close (README);
+ }
+ $html .= "<tr><td><a href='\#SUITE_$suite'>$suite</a></td>" .
+ "<td>@readme_text</td>";
+ $html .= "<td><input type='button' value='Select All' " .
+ "onclick='selectAll(\"$suite\");'> ";
+ $html .= "<input type='button' value='Select None' " .
+ "onclick='selectNone(\"$suite\");'></td>";
+ $html .= "<td><input readonly name='SUMMARY_$suite'></td>";
+ $html .= "</tr>";
+ }
+ $html .= "</table>\n";
+ $html .= "<td><input readonly name='TOTAL'></td>";
+ $html .= "</center>";
+ $html .= "<dl>\n";
+
+ foreach $i (0 .. $#suite_list) {
+ local $prev_href = ($i > 0) ? "\#SUITE_" . $suite_list[$i - 1] : "";
+ local $next_href = ($i < $#suite_list) ? "\#SUITE_" . $suite_list[$i + 1] : "";
+ &process_suite ($suite_path, $suite_list[$i], $prev_href, $next_href);
+ }
+
+ $html .= "</dl>\n";
+
+}
+
+#
+# Append detail from a 'suite' directory (eg: ecma, ecma_2, js1_1, etc.), calling
+# process_test_dir for subordinate categories.
+#
+sub process_suite {
+ local ($suite_path, $suite, $prev_href, $next_href) = @_;
+ local $i, @test_dir_list;
+
+ # suite js object
+ $javascript .= "suites[\"$suite\"] = {testDirs: {}};\n";
+
+ @test_dir_list = sort(&get_subdirs ($test_home . $suite));
+
+ # suite header
+ $html .= " <a name='SUITE_$suite'></a><hr><dt><big><big><b>$suite " .
+ "(" . ($#test_dir_list + 1) . " Sub-Categories)</b></big></big><br>\n";
+ $html .= " <input type='button' value='Select All' " .
+ "onclick='selectAll(\"$suite\");'>\n";
+ $html .= " <input type='button' value='Select None' " .
+ "onclick='selectNone(\"$suite\");'> " .
+ "[ <a href='\#top_of_page'>Top of page</a> ";
+ if ($prev_href) {
+ $html .= " | <a href='$prev_href'>Previous Suite</a> ";
+ }
+ if ($next_href) {
+ $html .= " | <a href='$next_href'>Next Suite</a> ";
+ }
+ $html .= "]\n";
+
+ $html .= " <dd>\n <dl>\n";
+
+ foreach $i (0 .. $#test_dir_list) {
+ local $prev_href = ($i > 0) ? "\#TESTDIR_" . $suite . $test_dir_list[$i - 1] :
+ "";
+ local $next_href = ($i < $#test_dir_list) ?
+ "\#TESTDIR_" . $suite . $test_dir_list[$i + 1] : "";
+ &process_test_dir ($suite_path . $suite . "/", $test_dir_list[$i], $suite,
+ $prev_href, $next_href);
+ }
+
+ $html .= " </dl>\n";
+
+}
+
+#
+# Append detail from a test directory, calling process_test for subordinate js files
+#
+sub process_test_dir {
+ local ($test_dir_path, $test_dir, $suite, $prev_href, $next_href) = @_;
+
+ @test_list = sort(&get_js_files ($test_dir_path . $test_dir));
+
+ $javascript .= "suites[\"$suite\"].testDirs[\"$test_dir\"] = {tests: {}};\n";
+
+ $html .= " <a name='TESTDIR_$suite$test_dir'></a>\n";
+ $html .= " <dt><big><b>$test_dir (" . ($#test_list + 1) .
+ " tests)</b></big><br>\n";
+ $html .= " <input type='button' value='Select All' " .
+ "onclick='selectAll(\"$suite\", \"$test_dir\");'>\n";
+ $html .= " <input type='button' value='Select None' " .
+ "onclick='selectNone(\"$suite\", \"$test_dir\");'> ";
+ $html .= "[ <a href='\#SUITE_$suite'>Top of $suite Suite</a> ";
+ if ($prev_href) {
+ $html .= "| <a href='$prev_href'>Previous Category</a> ";
+ }
+ if ($next_href) {
+ $html .= " | <a href='$next_href'>Next Category</a> ";
+ }
+ $html .= "]<br>\n";
+ $html .= " </dt>\n";
+
+ $html .= " <dl>\n";
+
+ foreach $test (@test_list) {
+ &process_test ($test_dir_path . $test_dir, $test);
+ }
+
+ $html .= " </dl>\n";
+}
+
+
+#
+# Append detail from a single JavaScript file.
+#
+sub process_test {
+ local ($test_dir_path, $test) = @_;
+ local $title = "";
+
+ $uid++;
+
+ open (TESTCASE, $test_dir_path . "/" . $test) ||
+ die ("Error opening " . $test_dir_path . "/" . $test);
+
+ while (<TESTCASE>) {
+ if (/.*TITLE\s+\=\s+\"(.*)\"/) {
+ $title = $1;
+ break;
+ }
+ }
+ close (TESTCASE);
+
+ $javascript .= "suites[\"$suite\"].testDirs[\"$test_dir\"].tests" .
+ "[\"$test\"] = \"radio$uid\"\n";
+ $html .= " <input type='radio' value='$test' name='radio$uid' ".
+ "onclick='return onRadioClick(\"radio$uid\");'>" .
+ "<a href='$lxr_url$suite/$test_dir/$test' target='other_window'>" .
+ "$test</a> $title<br>\n";
+
+}
+
+sub scriptTag {
+
+ return ("<script langugage='JavaScript'>@_</script>");
+
+}
+
+#
+# given a directory, return an array of all subdirectories
+#
+sub get_subdirs {
+ local ($dir) = @_;
+ local @subdirs;
+
+ if (!($dir =~ /\/$/)) {
+ $dir = $dir . "/";
+ }
+
+ opendir (DIR, $dir) || die ("couldn't open directory $dir: $!");
+ local @testdir_contents = readdir(DIR);
+ closedir(DIR);
+
+ foreach (@testdir_contents) {
+ if ((-d ($dir . $_)) && ($_ ne 'CVS') && ($_ ne '.') && ($_ ne '..')) {
+ @subdirs[$#subdirs + 1] = $_;
+ }
+ }
+
+ return @subdirs;
+}
+
+#
+# given a directory, return an array of all the js files that are in it.
+#
+sub get_js_files {
+ local ($test_subdir) = @_;
+ local @js_file_array;
+
+ opendir ( TEST_SUBDIR, $test_subdir) || die ("couldn't open directory " .
+ "$test_subdir: $!");
+ @subdir_files = readdir( TEST_SUBDIR );
+ closedir( TEST_SUBDIR );
+
+ foreach ( @subdir_files ) {
+ if ( $_ =~ /\.js$/ ) {
+ $js_file_array[$#js_file_array+1] = $_;
+ }
+ }
+
+ return @js_file_array;
+}
+
+
diff --git a/Source/JavaScriptCore/tests/mozilla/runtests.pl b/Source/JavaScriptCore/tests/mozilla/runtests.pl
new file mode 100644
index 0000000..f6f05fb
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/runtests.pl
@@ -0,0 +1,495 @@
+#!/tools/ns/bin/perl5
+#
+# simple script that executes JavaScript tests. you have to build the
+# stand-alone, js shell executable (which is not the same as the dll that gets
+# built for mozilla). see the readme at
+# http://lxr.mozilla.org/mozilla/source/js/src/README.html for instructions on
+# how to build the jsshell.
+#
+# this is just a quick-n-dirty script. for full reporting, you need to run
+# the test driver, which requires java and is currently not available on
+# mozilla.org.
+#
+# this test looks for an executable JavaScript shell in
+# %MOZ_SRC/mozilla/js/src/[platform]-[platform-version]-OPT.OBJ/js,
+# which is the default build location when you build using the instructions
+# at http://lxr.mozilla.org/mozilla/source/js/src/README.html
+#
+#
+# christine@netscape.com
+#
+
+&parse_args;
+&setup_env;
+&main_test_loop;
+&cleanup_env;
+
+#
+# given a main directory, assume that there is a file called 'shell.js'
+# in it. then, open all the subdirectories, and look for js files.
+# for each test.js that is found, execute the shell, and pass shell.js
+# and the test.js as file arguments. redirect all process output to a
+# file.
+#
+sub main_test_loop {
+ foreach $suite ( &get_subdirs( $test_dir )) {
+ foreach $subdir (&get_subdirs( $suite, $test_dir )) {
+ @jsfiles = &get_js_files($subdir);
+ execute_js_tests(@jsfiles);
+ }
+ }
+}
+
+#
+# given a directory, return an array of all subdirectories
+#
+sub get_subdirs{
+ local ($dir, $path) = @_;
+ local @subdirs;
+
+ local $dir_path = $path . $dir;
+ chdir $dir_path;
+
+ opendir ( DIR, ${dir_path} );
+ local @testdir_contents = readdir( DIR );
+ closedir( DIR );
+
+ foreach (@testdir_contents) {
+ if ( (-d $_) && ($_ !~ 'CVS') && ( $_ ne '.') && ($_ ne '..')) {
+ @subdirs[$#subdirs+1] = $_;
+ }
+ }
+ chdir $path;
+ return @subdirs;
+}
+
+#
+# given a directory, return an array of all the js files that are in it.
+#
+sub get_js_files {
+ ( $test_subdir ) = @_;
+ local @js_file_array;
+
+ $current_test_dir = $test_dir ."/". $suite . "/" .$test_subdir;
+ chdir $current_test_dir;
+
+ opendir ( TEST_SUBDIR, ${current_test_dir} );
+ @subdir_files = readdir( TEST_SUBDIR );
+ closedir( TOP_LEVEL_BUILD_DIR );
+
+ foreach ( @subdir_files ) {
+ if ( $_ =~ /\.js$/ ) {
+ $js_file_array[$#js_file_array+1] = $_;
+ }
+ }
+
+ return @js_file_array;
+}
+
+#
+# given an array of test.js files, execute the shell command and pass
+# the shell.js and test.js files as file arguments. redirect process
+# output to a file. if $js_verbose is set (not recommended), write all
+# testcase output to the output file. if $js_quiet is set, only write
+# failed test case information to the output file. the default setting
+# is to write a line for each test file, and whether each file passed
+# or failed.
+#
+sub execute_js_tests {
+ (@js_file_array) = @_;
+
+ $js_printed_suitename = 0;
+ if ( !$js_quiet ) {
+ &js_print_suitename;
+ }
+
+ foreach $js_test (@js_file_array) {
+ $js_printed_filename = 0;
+ $js_test_bugnumber = 0;
+ $runtime_error = "";
+
+ local $passed = -1;
+
+ # create the test command
+ $test_command =
+ $shell_command .
+ " -f $test_dir/$suite/shell.js " .
+ " -f $test_dir/$suite/$subdir/$js_test";
+
+ if ( !$js_quiet ) {
+ &js_print_filename;
+ } else {
+ print '.';
+ }
+
+ $test_path = $test_dir ."/" . $suite ."/". $test_subdir ."/". $js_test;
+
+
+ if ( !-e $test_path ) {
+ &js_print( " FAILED! file not found\n",
+ "<font color=#990000>", "</font><br>\n");
+ } else {
+ open( RUNNING_TEST, "$test_command" . ' 2>&1 |');
+
+
+ # this is where we want the tests to provide a lot more information
+ # that this script must parse so that we can
+
+ while( <RUNNING_TEST> ){
+ if ( $js_verbose && !$js_quiet ) {
+ &js_print ($_ ."\n", "", "<br>\n");
+ }
+ if ( $_ =~ /BUGNUMBER/ ) {
+ $js_test_bugnumber = $_;
+ }
+ if ( $_ =~ /PASSED/ && $passed == -1 ) {
+ $passed = 1;
+ }
+ if ( $_ =~ /FAILED/ && $_ =~ /expected/) {
+ &js_print_suitename;
+ &js_print_filename;
+ &js_print_bugnumber;
+
+ local @msg = split ( "FAILED", $_ );
+ &js_print ( $passed ? "\n" : "" );
+ &js_print( " " . $msg[0], "&nbsp;&nbsp;<tt>" );
+ &js_print( "FAILED", "<font color=#990000>", "</font>");
+ &js_print( $msg[1], "", "</tt><br>\n" );
+ $passed = 0;
+ }
+ if ( $_ =~ /$js_test/ ) {
+ $runtime_error .= $_;
+ }
+ }
+ close( RUNNING_TEST );
+
+ #
+ # figure out whether the test passed or failed. print out an
+ # appropriate level of output based on the value of $js_quiet
+ #
+ if ( $js_test =~ /-n\.js$/ ) {
+ if ( $runtime_error ) {
+ if ( !$js_quiet ) {
+ &js_print( " PASSED!\n ",
+ "<font color=#009900>&nbsp;&nbsp",
+ "</font><br>" );
+ if ( $js_errors ) {
+ &js_print( $runtime_error, "<pre>", "</pre>");
+ }
+ }
+ } else {
+ &js_print_suitename;
+ &js_print_filename;
+ &js_print_bugnumber;
+ &js_print( " FAILED! ", "&nbsp;&nbsp;<font color=#990000>",
+ "</font>");
+ &js_print( " Should have resulted in an error\n",
+ "","<br>" );
+ }
+ } else {
+ if ( $passed == 1 && !$js_quiet) {
+ &js_print( " PASSED!\n " , "&nbsp;&nbsp;<font color=#009900>",
+ "</font><br>" );
+ } else {
+ if ($passed == -1) {
+ &js_print_suitename;
+ &js_print_filename;
+ &js_print_bugnumber;
+ &js_print( " FAILED!\n " , "&nbsp;&nbsp;<font color=#990000>",
+ "</font><br>" );
+ &js_print( " Missing 'PASSED' in output\n", "","<br>" );
+ &js_print( $log, "output:<br><pre>", "</pre>" );
+ }
+ }
+
+ }
+ }
+ }
+}
+
+#
+# figure out what os we're on, the default name of the object directory
+#
+sub setup_env {
+ # MOZ_SRC must be set, so we can figure out where the
+ # JavaScript executable is
+ $moz_src = $ENV{"MOZ_SRC"}
+ || die( "You need to set your MOZ_SRC environment variable.\n" );
+ $src_dir = $moz_src . '/mozilla/js/src/';
+
+ # JS_TEST_DIR must be set so we can figure out where the tests are.
+ $test_dir = $ENV{"JS_TEST_DIR"};
+
+ # if it's not set, look for it relative to $moz_src
+ if ( !$test_dir ) {
+ $test_dir = $moz_src . '/mozilla/js/tests/';
+ }
+
+ # make sure that the test dir exists
+ if ( ! -e $test_dir ) {
+ die "The JavaScript Test Library could not be found at $test_dir.\n" .
+ "Check the tests out from /mozilla/js/tests or\n" .
+ "Set the value of your JS_TEST_DIR environment variable\n " .
+ "to the location of the test library.\n";
+ }
+
+ # make sure that the test dir ends with a trailing slash
+ $test_dir .= '/';
+
+ chdir $src_dir;
+
+ # figure out which platform we're on, and figure out where the object
+ # directory is
+
+ $machine_os = `uname -s`;
+
+ if ( $machine_os =~ /WIN/ ) {
+ $machine_os = 'WIN';
+ $object_dir = ($js_debug) ? 'Debug' : 'Release';
+ $js_exe = 'jsshell.exe';
+ } else {
+ chop $machine_os;
+ $js_exe = 'js';
+
+ # figure out what the object directory is. on all platforms,
+ # it's the directory that ends in OBJ. if $js_debug is set,
+ # look the directory that ends with or DBG.OBJ; otherwise
+ # look for the directory that ends with OPT.OBJ
+
+ opendir ( SRC_DIR_FILES, $src_dir );
+ @src_dir_files = readdir( SRC_DIR_FILES );
+ closedir ( SRC_DIR_FILES );
+
+ $object_pattern = $js_debug ? 'DBG.OBJ' : 'OPT.OBJ';
+
+ foreach (@src_dir_files) {
+ if ( $_ =~ /$object_pattern/ && $_ =~ $machine_os) {
+ $object_dir = $_;
+ }
+ }
+ }
+ if ( ! $object_dir ) {
+ die( "Couldn't find an object directory in $src_dir.\n" );
+ }
+
+ # figure out what the name of the javascript executable should be, and
+ # make sure it's there. if it's not there, give a helpful message so
+ # the user can figure out what they need to do next.
+
+
+ if ( ! $js_exe_full_path ) {
+ $shell_command = $src_dir . $object_dir .'/'. $js_exe;
+ } else {
+ $shell_command = $js_exe_full_path;
+ }
+
+ if ( !-e $shell_command ) {
+ die ("Could not find JavaScript shell executable $shell_command.\n" .
+ "Check the value of your MOZ_SRC environment variable.\n" .
+ "Currently, MOZ_SRC is set to $ENV{\"MOZ_SRC\"}\n".
+ "See the readme at http://lxr.mozilla.org/mozilla/src/js/src/ " .
+ "for instructions on building the JavaScript shell.\n" );
+ }
+
+ # set the output file name. let's base its name on the date and platform,
+ # and give it a sequence number.
+
+ if ( $get_output ) {
+ $js_output = &get_output;
+ }
+ if ($js_output) {
+ print( "Writing results to $js_output\n" );
+ chdir $test_dir;
+ open( JS_OUTPUT, "> ${js_output}" ) ||
+ die "Can't open log file $js_output\n";
+ close JS_OUTPUT;
+ }
+
+ # get the start time
+ $start_time = time;
+
+ # print out some nice stuff
+ $start_date = &get_date;
+ &js_print( "JavaScript tests started: " . $start_date, "<p><tt>", "</tt></p>" );
+
+ &js_print ("Executing all the tests under $test_dir\n against " .
+ "$shell_command\n", "<p><tt>", "</tt></p>" );
+}
+
+#
+# parse arguments. see usage for what arguments are expected.
+#
+sub parse_args {
+ $i = 0;
+ while( $i < @ARGV ){
+ if ( $ARGV[$i] eq '--threaded' ) {
+ $js_threaded = 1;
+ } elsif ( $ARGV[$i] eq '--d' ) {
+ $js_debug = 1;
+ } elsif ( $ARGV[$i] eq '--14' ) {
+ $js_version = '14';
+ } elsif ( $ARGV[$i] eq '--v' ) {
+ $js_verbose = 1;
+ } elsif ( $ARGV[$i] eq '-f' ) {
+ $js_output = $ARGV[++$i];
+ } elsif ( $ARGV[$i] eq '--o' ) {
+ $get_output = 1;
+ } elsif ($ARGV[$i] eq '--e' ) {
+ $js_errors = 1;
+ } elsif ($ARGV[$i] eq '--q' ) {
+ $js_quiet = 1;
+ } elsif ($ARGV[$i] eq '--h' ) {
+ die &usage;
+ } elsif ( $ARGV[$i] eq '-E' ) {
+ $js_exe_full_path = $ARGV[$i+1];
+ $i++;
+ } else {
+ die &usage;
+ }
+ $i++;
+ }
+
+ #
+ # if no output options are provided, show some output and write to file
+ #
+ if ( !$js_verbose && !$js_output && !$get_output ) {
+ $get_output = 1;
+ }
+}
+
+#
+# print the arguments that this script expects
+#
+sub usage {
+ die ("usage: $0\n" .
+ "--q Quiet mode -- only show information for tests that failed\n".
+ "--e Show runtime error messages for negative tests\n" .
+ "--v Verbose output -- show all test cases (not recommended)\n" .
+ "--o Send output to file whose generated name is based on date\n".
+ "--d Look for a debug JavaScript executable (default is optimized)\n" .
+ "-f <file> Redirect output to file named <file>\n"
+ );
+}
+
+#
+# if $js_output is set, print to file as well as stdout
+#
+sub js_print {
+ ($string, $start_tag, $end_tag) = @_;
+
+ if ($js_output) {
+ open( JS_OUTPUT, ">> ${js_output}" ) ||
+ die "Can't open log file $js_output\n";
+
+ print JS_OUTPUT "$start_tag $string $end_tag";
+ close JS_OUTPUT;
+ }
+ print $string;
+}
+
+#
+# close open files
+#
+sub cleanup_env {
+ # print out some nice stuff
+ $end_date = &get_date;
+ &js_print( "\nTests complete at $end_date", "<hr><tt>", "</tt>" );
+
+ # print out how long it took to complete
+ $end_time = time;
+
+ $test_seconds = ( $end_time - $start_time );
+
+ &js_print( "Start Date: $start_date\n", "<tt><br>" );
+ &js_print( "End Date: $end_date\n", "<br>" );
+ &js_print( "Test Time: $test_seconds seconds\n", "<br>" );
+
+ if ($js_output ) {
+ if ( !$js_verbose) {
+ &js_print( "Results were written to " . $js_output ."\n",
+ "<br>", "</tt>" );
+ }
+ close JS_OUTPUT;
+ }
+}
+
+
+#
+# get the current date and time
+#
+sub get_date {
+ &get_localtime;
+ $now = $year ."/". $mon ."/". $mday ." ". $hour .":".
+ $min .":". $sec ."\n";
+ return $now;
+
+}
+sub get_localtime {
+ ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) =
+ localtime;
+ $mon++;
+ $mon = &zero_pad($mon);
+ $year= ($year < 2000) ? "19" . $year : $year;
+ $mday= &zero_pad($mday);
+ $sec = &zero_pad($sec);
+ $min = &zero_pad($min);
+ $hour = &zero_pad($hour);
+}
+sub zero_pad {
+ local ($string) = @_;
+ $string = ($string < 10) ? "0" . $string : $string;
+ return $string;
+}
+
+#
+# generate an output file name based on the date
+#
+sub get_output {
+ &get_localtime;
+
+ chdir $test_dir;
+
+ $js_output = $test_dir ."/". $year .'-'. $mon .'-'. $mday ."\.1.html";
+
+ $output_file_found = 0;
+
+ while ( !$output_file_found ) {
+ if ( -e $js_output ) {
+ # get the last sequence number - everything after the dot
+ @seq_no = split( /\./, $js_output, 2 );
+ $js_output = $seq_no[0] .".". (++$seq_no[1]) . "\.html";
+ } else {
+ $output_file_found = 1;
+ }
+ }
+ return $js_output;
+}
+
+sub js_print_suitename {
+ if ( !$js_printed_suitename ) {
+ &js_print( "$suite\\$subdir\n", "<hr><font size+=1><b>",
+ "</font></b><br>" );
+ }
+ $js_printed_suitename = 1;
+}
+
+sub js_print_filename {
+ if ( !$js_printed_filename ) {
+ &js_print( "$js_test\n", "<b>", "</b><br>" );
+ $js_printed_filename = 1;
+ }
+}
+
+sub js_print_bugnumber {
+ if ( !$js_printed_bugnumber ) {
+ if ( $js_bugnumber =~ /^http/ ) {
+ &js_print( "$js_bugnumber", "<a href=$js_bugnumber>", "</a>" );
+ } else {
+ &js_print( "$js_bugnumber",
+ "<a href=http://scopus.mcom.com/bugsplat/show_bug.cgi?id=" .
+ $js_bugnumber .">",
+ "</a>" );
+ }
+ $js_printed_bugnumber = 1;
+ }
+}
diff --git a/Source/JavaScriptCore/tests/mozilla/template.js b/Source/JavaScriptCore/tests/mozilla/template.js
new file mode 100644
index 0000000..e953183
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/template.js
@@ -0,0 +1,55 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS
+* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+* implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation. All
+* Rights Reserved.
+*
+* Contributor(s):
+*/
+
+/**
+ * File Name: template.js
+ * Reference: ** replace with bugzilla URL or document reference **
+ * Description: ** replace with description of test **
+ * Author: ** replace with your e-mail address **
+ */
+
+ var SECTION = ""; // provide a document reference (ie, ECMA section)
+ var VERSION = "ECMA_2"; // Version of JavaScript or ECMA
+ var TITLE = ""; // Provide ECMA section title or a description
+ var BUGNUMBER = ""; // Provide URL to bugsplat or bugzilla report
+
+ startTest(); // leave this alone
+
+ /*
+ * Calls to AddTestCase here. AddTestCase is a function that is defined
+ * in shell.js and takes three arguments:
+ * - a string representation of what is being tested
+ * - the expected result
+ * - the actual result
+ *
+ * For example, a test might look like this:
+ *
+ * var zip = /[\d]{5}$/;
+ *
+ * AddTestCase(
+ * "zip = /[\d]{5}$/; \"PO Box 12345 Boston, MA 02134\".match(zip)", // description of the test
+ * "02134", // expected result
+ * "PO Box 12345 Boston, MA 02134".match(zip) ); // actual result
+ *
+ */
+
+ test(); // leave this alone. this executes the test cases and
+ // displays results.
diff --git a/Source/JavaScriptCore/tests/perf/bench-allocate-nonretained.js b/Source/JavaScriptCore/tests/perf/bench-allocate-nonretained.js
new file mode 100644
index 0000000..d493416
--- /dev/null
+++ b/Source/JavaScriptCore/tests/perf/bench-allocate-nonretained.js
@@ -0,0 +1,6 @@
+(function () {
+ for (var i = 0; i < 500; ++i) {
+ for (var j = 0; j < 100000; ++j)
+ var a = {};
+ }
+})();
diff --git a/Source/JavaScriptCore/tests/perf/bench-allocate-retained.js b/Source/JavaScriptCore/tests/perf/bench-allocate-retained.js
new file mode 100644
index 0000000..4e6a4bd
--- /dev/null
+++ b/Source/JavaScriptCore/tests/perf/bench-allocate-retained.js
@@ -0,0 +1,10 @@
+(function () {
+ var a = new Array(100000);
+ for (var i = 0; i < 100000; ++i)
+ a[i] = {};
+
+ for (var i = 0; i < 500; ++i) {
+ for (var j = 0; j < 100000; ++j)
+ var b = {};
+ }
+})();
diff --git a/Source/JavaScriptCore/wscript b/Source/JavaScriptCore/wscript
new file mode 100644
index 0000000..8d7f69c
--- /dev/null
+++ b/Source/JavaScriptCore/wscript
@@ -0,0 +1,84 @@
+#! /usr/bin/env python
+
+# Copyright (C) 2009 Kevin Ollivier All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# JavaScriptCore build script for the waf build system
+
+import commands
+
+from settings import *
+
+jscore_excludes = ['chartables.c', 'jsc.cpp', 'ucptable.cpp','ProfilerServer.mm', 'ExecutableAllocatorPosix.cpp']
+jscore_excludes.extend(get_excludes(jscore_dir, ['*Brew.cpp', '*CF.cpp', '*Symbian.cpp']))
+
+sources = []
+
+jscore_excludes.extend(get_excludes(jscore_dir, ['*None.cpp']))
+
+if build_port == "wx":
+ if building_on_win32:
+ jscore_excludes += ['MarkStackPosix.cpp', 'ThreadingPthreads.cpp']
+ sources += ['runtime/MarkStackWin.cpp']
+ else:
+ jscore_excludes.append('JSStringRefBSTR.cpp')
+ jscore_excludes.extend(get_excludes(jscore_dir, ['*Win.cpp']))
+
+def build(bld):
+ import Options
+
+ full_dirs = get_dirs_for_features(jscore_dir, features=[build_port], dirs=jscore_dirs)
+
+ includes = common_includes + full_dirs
+ if sys.platform.startswith('darwin'):
+ includes.append(os.path.join(jscore_dir, 'icu'))
+
+ # 1. A simple program
+ jscore = bld.new_task_gen(
+ features = 'cxx cstaticlib',
+ includes = '. .. assembler DerivedSources ForwardingHeaders ' + ' '.join(includes),
+ source = sources,
+ target = 'jscore',
+ uselib = 'WX ICU ' + get_config(),
+ uselib_local = '',
+ install_path = output_dir)
+
+ jscore.find_sources_in_dirs(full_dirs, excludes = jscore_excludes)
+
+ obj = bld.new_task_gen(
+ features = 'cxx cprogram',
+ includes = '. .. assembler DerivedSources ForwardingHeaders ' + ' '.join(includes),
+ source = 'jsc.cpp',
+ target = 'jsc',
+ uselib = 'WX ICU ' + get_config(),
+ uselib_local = 'jscore',
+ install_path = output_dir,
+ )
+
+ if building_on_win32:
+ myenv = obj.env.copy()
+ myenv.CXXFLAGS = myenv.CXXFLAGS[:]
+ myenv.CXXFLAGS.remove('/EHsc')
+ obj.env = myenv
+
+ bld.install_files(os.path.join(output_dir, 'JavaScriptCore'), 'API/*.h')
diff --git a/Source/JavaScriptCore/wtf/ASCIICType.h b/Source/JavaScriptCore/wtf/ASCIICType.h
new file mode 100644
index 0000000..c19b85a
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/ASCIICType.h
@@ -0,0 +1,179 @@
+/*
+ * Copyright (C) 2007, 2008, 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WTF_ASCIICType_h
+#define WTF_ASCIICType_h
+
+#include <wtf/Assertions.h>
+
+// The behavior of many of the functions in the <ctype.h> header is dependent
+// on the current locale. But in the WebKit project, all uses of those functions
+// are in code processing something that's not locale-specific. These equivalents
+// for some of the <ctype.h> functions are named more explicitly, not dependent
+// on the C library locale, and we should also optimize them as needed.
+
+// All functions return false or leave the character unchanged if passed a character
+// that is outside the range 0-7F. So they can be used on Unicode strings or
+// characters if the intent is to do processing only if the character is ASCII.
+
+namespace WTF {
+
+ inline bool isASCII(char c) { return !(c & ~0x7F); }
+ inline bool isASCII(unsigned short c) { return !(c & ~0x7F); }
+#if !COMPILER(MSVC) || defined(_NATIVE_WCHAR_T_DEFINED)
+ inline bool isASCII(wchar_t c) { return !(c & ~0x7F); }
+#endif
+ inline bool isASCII(int c) { return !(c & ~0x7F); }
+ inline bool isASCII(unsigned c) { return !(c & ~0x7F); }
+
+ inline bool isASCIIAlpha(char c) { return (c | 0x20) >= 'a' && (c | 0x20) <= 'z'; }
+ inline bool isASCIIAlpha(unsigned short c) { return (c | 0x20) >= 'a' && (c | 0x20) <= 'z'; }
+#if !COMPILER(MSVC) || defined(_NATIVE_WCHAR_T_DEFINED)
+ inline bool isASCIIAlpha(wchar_t c) { return (c | 0x20) >= 'a' && (c | 0x20) <= 'z'; }
+#endif
+ inline bool isASCIIAlpha(int c) { return (c | 0x20) >= 'a' && (c | 0x20) <= 'z'; }
+ inline bool isASCIIAlpha(unsigned c) { return (c | 0x20) >= 'a' && (c | 0x20) <= 'z'; }
+
+ inline bool isASCIIAlphanumeric(char c) { return (c >= '0' && c <= '9') || ((c | 0x20) >= 'a' && (c | 0x20) <= 'z'); }
+ inline bool isASCIIAlphanumeric(unsigned short c) { return (c >= '0' && c <= '9') || ((c | 0x20) >= 'a' && (c | 0x20) <= 'z'); }
+#if !COMPILER(MSVC) || defined(_NATIVE_WCHAR_T_DEFINED)
+ inline bool isASCIIAlphanumeric(wchar_t c) { return (c >= '0' && c <= '9') || ((c | 0x20) >= 'a' && (c | 0x20) <= 'z'); }
+#endif
+ inline bool isASCIIAlphanumeric(int c) { return (c >= '0' && c <= '9') || ((c | 0x20) >= 'a' && (c | 0x20) <= 'z'); }
+ inline bool isASCIIAlphanumeric(unsigned c) { return (c >= '0' && c <= '9') || ((c | 0x20) >= 'a' && (c | 0x20) <= 'z'); }
+
+ inline bool isASCIIDigit(char c) { return (c >= '0') & (c <= '9'); }
+ inline bool isASCIIDigit(unsigned short c) { return (c >= '0') & (c <= '9'); }
+#if !COMPILER(MSVC) || defined(_NATIVE_WCHAR_T_DEFINED)
+ inline bool isASCIIDigit(wchar_t c) { return (c >= '0') & (c <= '9'); }
+#endif
+ inline bool isASCIIDigit(int c) { return (c >= '0') & (c <= '9'); }
+ inline bool isASCIIDigit(unsigned c) { return (c >= '0') & (c <= '9'); }
+
+ inline bool isASCIIHexDigit(char c) { return (c >= '0' && c <= '9') || ((c | 0x20) >= 'a' && (c | 0x20) <= 'f'); }
+ inline bool isASCIIHexDigit(unsigned short c) { return (c >= '0' && c <= '9') || ((c | 0x20) >= 'a' && (c | 0x20) <= 'f'); }
+#if !COMPILER(MSVC) || defined(_NATIVE_WCHAR_T_DEFINED)
+ inline bool isASCIIHexDigit(wchar_t c) { return (c >= '0' && c <= '9') || ((c | 0x20) >= 'a' && (c | 0x20) <= 'f'); }
+#endif
+ inline bool isASCIIHexDigit(int c) { return (c >= '0' && c <= '9') || ((c | 0x20) >= 'a' && (c | 0x20) <= 'f'); }
+ inline bool isASCIIHexDigit(unsigned c) { return (c >= '0' && c <= '9') || ((c | 0x20) >= 'a' && (c | 0x20) <= 'f'); }
+
+ inline bool isASCIIOctalDigit(char c) { return (c >= '0') & (c <= '7'); }
+ inline bool isASCIIOctalDigit(unsigned short c) { return (c >= '0') & (c <= '7'); }
+#if !COMPILER(MSVC) || defined(_NATIVE_WCHAR_T_DEFINED)
+ inline bool isASCIIOctalDigit(wchar_t c) { return (c >= '0') & (c <= '7'); }
+#endif
+ inline bool isASCIIOctalDigit(int c) { return (c >= '0') & (c <= '7'); }
+ inline bool isASCIIOctalDigit(unsigned c) { return (c >= '0') & (c <= '7'); }
+
+ inline bool isASCIILower(char c) { return c >= 'a' && c <= 'z'; }
+ inline bool isASCIILower(unsigned short c) { return c >= 'a' && c <= 'z'; }
+#if !COMPILER(MSVC) || defined(_NATIVE_WCHAR_T_DEFINED)
+ inline bool isASCIILower(wchar_t c) { return c >= 'a' && c <= 'z'; }
+#endif
+ inline bool isASCIILower(int c) { return c >= 'a' && c <= 'z'; }
+ inline bool isASCIILower(unsigned c) { return c >= 'a' && c <= 'z'; }
+
+ inline bool isASCIIUpper(char c) { return c >= 'A' && c <= 'Z'; }
+ inline bool isASCIIUpper(unsigned short c) { return c >= 'A' && c <= 'Z'; }
+#if !COMPILER(MSVC) || defined(_NATIVE_WCHAR_T_DEFINED)
+ inline bool isASCIIUpper(wchar_t c) { return c >= 'A' && c <= 'Z'; }
+#endif
+ inline bool isASCIIUpper(int c) { return c >= 'A' && c <= 'Z'; }
+ inline bool isASCIIUpper(unsigned c) { return c >= 'A' && c <= 'Z'; }
+
+ /*
+ Statistics from a run of Apple's page load test for callers of isASCIISpace:
+
+ character count
+ --------- -----
+ non-spaces 689383
+ 20 space 294720
+ 0A \n 89059
+ 09 \t 28320
+ 0D \r 0
+ 0C \f 0
+ 0B \v 0
+ */
+ inline bool isASCIISpace(char c) { return c <= ' ' && (c == ' ' || (c <= 0xD && c >= 0x9)); }
+ inline bool isASCIISpace(unsigned short c) { return c <= ' ' && (c == ' ' || (c <= 0xD && c >= 0x9)); }
+#if !COMPILER(MSVC) || defined(_NATIVE_WCHAR_T_DEFINED)
+ inline bool isASCIISpace(wchar_t c) { return c <= ' ' && (c == ' ' || (c <= 0xD && c >= 0x9)); }
+#endif
+ inline bool isASCIISpace(int c) { return c <= ' ' && (c == ' ' || (c <= 0xD && c >= 0x9)); }
+ inline bool isASCIISpace(unsigned c) { return c <= ' ' && (c == ' ' || (c <= 0xD && c >= 0x9)); }
+
+ inline char toASCIILower(char c) { return c | ((c >= 'A' && c <= 'Z') << 5); }
+ inline unsigned short toASCIILower(unsigned short c) { return c | ((c >= 'A' && c <= 'Z') << 5); }
+#if !COMPILER(MSVC) || defined(_NATIVE_WCHAR_T_DEFINED)
+ inline wchar_t toASCIILower(wchar_t c) { return c | ((c >= 'A' && c <= 'Z') << 5); }
+#endif
+ inline int toASCIILower(int c) { return c | ((c >= 'A' && c <= 'Z') << 5); }
+ inline unsigned toASCIILower(unsigned c) { return c | ((c >= 'A' && c <= 'Z') << 5); }
+
+ // FIXME: Why do these need static_cast?
+ inline char toASCIIUpper(char c) { return static_cast<char>(c & ~((c >= 'a' && c <= 'z') << 5)); }
+ inline unsigned short toASCIIUpper(unsigned short c) { return static_cast<unsigned short>(c & ~((c >= 'a' && c <= 'z') << 5)); }
+#if !COMPILER(MSVC) || defined(_NATIVE_WCHAR_T_DEFINED)
+ inline wchar_t toASCIIUpper(wchar_t c) { return static_cast<wchar_t>(c & ~((c >= 'a' && c <= 'z') << 5)); }
+#endif
+ inline int toASCIIUpper(int c) { return static_cast<int>(c & ~((c >= 'a' && c <= 'z') << 5)); }
+ inline unsigned toASCIIUpper(unsigned c) { return static_cast<unsigned>(c & ~((c >= 'a' && c <= 'z') << 5)); }
+
+ inline int toASCIIHexValue(char c) { ASSERT(isASCIIHexDigit(c)); return c < 'A' ? c - '0' : (c - 'A' + 10) & 0xF; }
+ inline int toASCIIHexValue(unsigned short c) { ASSERT(isASCIIHexDigit(c)); return c < 'A' ? c - '0' : (c - 'A' + 10) & 0xF; }
+#if !COMPILER(MSVC) || defined(_NATIVE_WCHAR_T_DEFINED)
+ inline int toASCIIHexValue(wchar_t c) { ASSERT(isASCIIHexDigit(c)); return c < 'A' ? c - '0' : (c - 'A' + 10) & 0xF; }
+#endif
+ inline int toASCIIHexValue(int c) { ASSERT(isASCIIHexDigit(c)); return c < 'A' ? c - '0' : (c - 'A' + 10) & 0xF; }
+ inline int toASCIIHexValue(unsigned c) { ASSERT(isASCIIHexDigit(c)); return c < 'A' ? c - '0' : (c - 'A' + 10) & 0xF; }
+
+ inline bool isASCIIPrintable(char c) { return c >= ' ' && c <= '~'; }
+ inline bool isASCIIPrintable(unsigned short c) { return c >= ' ' && c <= '~'; }
+#if !COMPILER(MSVC) || defined(_NATIVE_WCHAR_T_DEFINED)
+ inline bool isASCIIPrintable(wchar_t c) { return c >= ' ' && c <= '~'; }
+#endif
+ inline bool isASCIIPrintable(int c) { return c >= ' ' && c <= '~'; }
+ inline bool isASCIIPrintable(unsigned c) { return c >= ' ' && c <= '~'; }
+}
+
+using WTF::isASCII;
+using WTF::isASCIIAlpha;
+using WTF::isASCIIAlphanumeric;
+using WTF::isASCIIDigit;
+using WTF::isASCIIHexDigit;
+using WTF::isASCIILower;
+using WTF::isASCIIOctalDigit;
+using WTF::isASCIIPrintable;
+using WTF::isASCIISpace;
+using WTF::isASCIIUpper;
+using WTF::toASCIIHexValue;
+using WTF::toASCIILower;
+using WTF::toASCIIUpper;
+
+#endif
diff --git a/Source/JavaScriptCore/wtf/AVLTree.h b/Source/JavaScriptCore/wtf/AVLTree.h
new file mode 100644
index 0000000..ec8a639
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/AVLTree.h
@@ -0,0 +1,960 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Based on Abstract AVL Tree Template v1.5 by Walt Karas
+ * <http://geocities.com/wkaras/gen_cpp/avl_tree.html>.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef AVL_TREE_H_
+#define AVL_TREE_H_
+
+#include "Assertions.h"
+#include <wtf/FixedArray.h>
+
+namespace WTF {
+
+// Here is the reference class for BSet.
+//
+// class BSet
+// {
+// public:
+//
+// class ANY_bitref
+// {
+// public:
+// operator bool ();
+// void operator = (bool b);
+// };
+//
+// // Does not have to initialize bits.
+// BSet();
+//
+// // Must return a valid value for index when 0 <= index < maxDepth
+// ANY_bitref operator [] (unsigned index);
+//
+// // Set all bits to 1.
+// void set();
+//
+// // Set all bits to 0.
+// void reset();
+// };
+
+template<unsigned maxDepth>
+class AVLTreeDefaultBSet {
+public:
+ bool& operator[](unsigned i) { ASSERT(i < maxDepth); return m_data[i]; }
+ void set() { for (unsigned i = 0; i < maxDepth; ++i) m_data[i] = true; }
+ void reset() { for (unsigned i = 0; i < maxDepth; ++i) m_data[i] = false; }
+
+private:
+ FixedArray<bool, maxDepth> m_data;
+};
+
+// How to determine maxDepth:
+// d Minimum number of nodes
+// 2 2
+// 3 4
+// 4 7
+// 5 12
+// 6 20
+// 7 33
+// 8 54
+// 9 88
+// 10 143
+// 11 232
+// 12 376
+// 13 609
+// 14 986
+// 15 1,596
+// 16 2,583
+// 17 4,180
+// 18 6,764
+// 19 10,945
+// 20 17,710
+// 21 28,656
+// 22 46,367
+// 23 75,024
+// 24 121,392
+// 25 196,417
+// 26 317,810
+// 27 514,228
+// 28 832,039
+// 29 1,346,268
+// 30 2,178,308
+// 31 3,524,577
+// 32 5,702,886
+// 33 9,227,464
+// 34 14,930,351
+// 35 24,157,816
+// 36 39,088,168
+// 37 63,245,985
+// 38 102,334,154
+// 39 165,580,140
+// 40 267,914,295
+// 41 433,494,436
+// 42 701,408,732
+// 43 1,134,903,169
+// 44 1,836,311,902
+// 45 2,971,215,072
+//
+// E.g., if, in a particular instantiation, the maximum number of nodes in a tree instance is 1,000,000, the maximum depth should be 28.
+// You pick 28 because MN(28) is 832,039, which is less than or equal to 1,000,000, and MN(29) is 1,346,268, which is strictly greater than 1,000,000.
+
+template <class Abstractor, unsigned maxDepth = 32, class BSet = AVLTreeDefaultBSet<maxDepth> >
+class AVLTree {
+public:
+
+ typedef typename Abstractor::key key;
+ typedef typename Abstractor::handle handle;
+ typedef typename Abstractor::size size;
+
+ enum SearchType {
+ EQUAL = 1,
+ LESS = 2,
+ GREATER = 4,
+ LESS_EQUAL = EQUAL | LESS,
+ GREATER_EQUAL = EQUAL | GREATER
+ };
+
+
+ Abstractor& abstractor() { return abs; }
+
+ inline handle insert(handle h);
+
+ inline handle search(key k, SearchType st = EQUAL);
+ inline handle search_least();
+ inline handle search_greatest();
+
+ inline handle remove(key k);
+
+ inline handle subst(handle new_node);
+
+ void purge() { abs.root = null(); }
+
+ bool is_empty() { return abs.root == null(); }
+
+ AVLTree() { abs.root = null(); }
+
+ class Iterator {
+ public:
+
+ // Initialize depth to invalid value, to indicate iterator is
+ // invalid. (Depth is zero-base.)
+ Iterator() { depth = ~0U; }
+
+ void start_iter(AVLTree &tree, key k, SearchType st = EQUAL)
+ {
+ // Mask of high bit in an int.
+ const int MASK_HIGH_BIT = (int) ~ ((~ (unsigned) 0) >> 1);
+
+ // Save the tree that we're going to iterate through in a
+ // member variable.
+ tree_ = &tree;
+
+ int cmp, target_cmp;
+ handle h = tree_->abs.root;
+ unsigned d = 0;
+
+ depth = ~0U;
+
+ if (h == null())
+ // Tree is empty.
+ return;
+
+ if (st & LESS)
+ // Key can be greater than key of starting node.
+ target_cmp = 1;
+ else if (st & GREATER)
+ // Key can be less than key of starting node.
+ target_cmp = -1;
+ else
+ // Key must be same as key of starting node.
+ target_cmp = 0;
+
+ for (;;) {
+ cmp = cmp_k_n(k, h);
+ if (cmp == 0) {
+ if (st & EQUAL) {
+ // Equal node was sought and found as starting node.
+ depth = d;
+ break;
+ }
+ cmp = -target_cmp;
+ } else if (target_cmp != 0) {
+ if (!((cmp ^ target_cmp) & MASK_HIGH_BIT)) {
+ // cmp and target_cmp are both negative or both positive.
+ depth = d;
+ }
+ }
+ h = cmp < 0 ? get_lt(h) : get_gt(h);
+ if (h == null())
+ break;
+ branch[d] = cmp > 0;
+ path_h[d++] = h;
+ }
+ }
+
+ void start_iter_least(AVLTree &tree)
+ {
+ tree_ = &tree;
+
+ handle h = tree_->abs.root;
+
+ depth = ~0U;
+
+ branch.reset();
+
+ while (h != null()) {
+ if (depth != ~0U)
+ path_h[depth] = h;
+ depth++;
+ h = get_lt(h);
+ }
+ }
+
+ void start_iter_greatest(AVLTree &tree)
+ {
+ tree_ = &tree;
+
+ handle h = tree_->abs.root;
+
+ depth = ~0U;
+
+ branch.set();
+
+ while (h != null()) {
+ if (depth != ~0U)
+ path_h[depth] = h;
+ depth++;
+ h = get_gt(h);
+ }
+ }
+
+ handle operator*()
+ {
+ if (depth == ~0U)
+ return null();
+
+ return depth == 0 ? tree_->abs.root : path_h[depth - 1];
+ }
+
+ void operator++()
+ {
+ if (depth != ~0U) {
+ handle h = get_gt(**this);
+ if (h == null()) {
+ do {
+ if (depth == 0) {
+ depth = ~0U;
+ break;
+ }
+ depth--;
+ } while (branch[depth]);
+ } else {
+ branch[depth] = true;
+ path_h[depth++] = h;
+ for (;;) {
+ h = get_lt(h);
+ if (h == null())
+ break;
+ branch[depth] = false;
+ path_h[depth++] = h;
+ }
+ }
+ }
+ }
+
+ void operator--()
+ {
+ if (depth != ~0U) {
+ handle h = get_lt(**this);
+ if (h == null())
+ do {
+ if (depth == 0) {
+ depth = ~0U;
+ break;
+ }
+ depth--;
+ } while (!branch[depth]);
+ else {
+ branch[depth] = false;
+ path_h[depth++] = h;
+ for (;;) {
+ h = get_gt(h);
+ if (h == null())
+ break;
+ branch[depth] = true;
+ path_h[depth++] = h;
+ }
+ }
+ }
+ }
+
+ void operator++(int) { ++(*this); }
+ void operator--(int) { --(*this); }
+
+ protected:
+
+ // Tree being iterated over.
+ AVLTree *tree_;
+
+ // Records a path into the tree. If branch[n] is true, indicates
+ // take greater branch from the nth node in the path, otherwise
+ // take the less branch. branch[0] gives branch from root, and
+ // so on.
+ BSet branch;
+
+ // Zero-based depth of path into tree.
+ unsigned depth;
+
+ // Handles of nodes in path from root to current node (returned by *).
+ handle path_h[maxDepth - 1];
+
+ int cmp_k_n(key k, handle h) { return tree_->abs.compare_key_node(k, h); }
+ int cmp_n_n(handle h1, handle h2) { return tree_->abs.compare_node_node(h1, h2); }
+ handle get_lt(handle h) { return tree_->abs.get_less(h); }
+ handle get_gt(handle h) { return tree_->abs.get_greater(h); }
+ handle null() { return tree_->abs.null(); }
+ };
+
+ template<typename fwd_iter>
+ bool build(fwd_iter p, size num_nodes)
+ {
+ if (num_nodes == 0) {
+ abs.root = null();
+ return true;
+ }
+
+ // Gives path to subtree being built. If branch[N] is false, branch
+ // less from the node at depth N, if true branch greater.
+ BSet branch;
+
+ // If rem[N] is true, then for the current subtree at depth N, it's
+ // greater subtree has one more node than it's less subtree.
+ BSet rem;
+
+ // Depth of root node of current subtree.
+ unsigned depth = 0;
+
+ // Number of nodes in current subtree.
+ size num_sub = num_nodes;
+
+ // The algorithm relies on a stack of nodes whose less subtree has
+ // been built, but whose right subtree has not yet been built. The
+ // stack is implemented as linked list. The nodes are linked
+ // together by having the "greater" handle of a node set to the
+ // next node in the list. "less_parent" is the handle of the first
+ // node in the list.
+ handle less_parent = null();
+
+ // h is root of current subtree, child is one of its children.
+ handle h, child;
+
+ for (;;) {
+ while (num_sub > 2) {
+ // Subtract one for root of subtree.
+ num_sub--;
+ rem[depth] = !!(num_sub & 1);
+ branch[depth++] = false;
+ num_sub >>= 1;
+ }
+
+ if (num_sub == 2) {
+ // Build a subtree with two nodes, slanting to greater.
+ // I arbitrarily chose to always have the extra node in the
+ // greater subtree when there is an odd number of nodes to
+ // split between the two subtrees.
+
+ h = *p;
+ p++;
+ child = *p;
+ p++;
+ set_lt(child, null());
+ set_gt(child, null());
+ set_bf(child, 0);
+ set_gt(h, child);
+ set_lt(h, null());
+ set_bf(h, 1);
+ } else { // num_sub == 1
+ // Build a subtree with one node.
+
+ h = *p;
+ p++;
+ set_lt(h, null());
+ set_gt(h, null());
+ set_bf(h, 0);
+ }
+
+ while (depth) {
+ depth--;
+ if (!branch[depth])
+ // We've completed a less subtree.
+ break;
+
+ // We've completed a greater subtree, so attach it to
+ // its parent (that is less than it). We pop the parent
+ // off the stack of less parents.
+ child = h;
+ h = less_parent;
+ less_parent = get_gt(h);
+ set_gt(h, child);
+ // num_sub = 2 * (num_sub - rem[depth]) + rem[depth] + 1
+ num_sub <<= 1;
+ num_sub += 1 - rem[depth];
+ if (num_sub & (num_sub - 1))
+ // num_sub is not a power of 2
+ set_bf(h, 0);
+ else
+ // num_sub is a power of 2
+ set_bf(h, 1);
+ }
+
+ if (num_sub == num_nodes)
+ // We've completed the full tree.
+ break;
+
+ // The subtree we've completed is the less subtree of the
+ // next node in the sequence.
+
+ child = h;
+ h = *p;
+ p++;
+ set_lt(h, child);
+
+ // Put h into stack of less parents.
+ set_gt(h, less_parent);
+ less_parent = h;
+
+ // Proceed to creating greater than subtree of h.
+ branch[depth] = true;
+ num_sub += rem[depth++];
+
+ } // end for (;;)
+
+ abs.root = h;
+
+ return true;
+ }
+
+protected:
+
+ friend class Iterator;
+
+ // Create a class whose sole purpose is to take advantage of
+ // the "empty member" optimization.
+ struct abs_plus_root : public Abstractor {
+ // The handle of the root element in the AVL tree.
+ handle root;
+ };
+
+ abs_plus_root abs;
+
+
+ handle get_lt(handle h) { return abs.get_less(h); }
+ void set_lt(handle h, handle lh) { abs.set_less(h, lh); }
+
+ handle get_gt(handle h) { return abs.get_greater(h); }
+ void set_gt(handle h, handle gh) { abs.set_greater(h, gh); }
+
+ int get_bf(handle h) { return abs.get_balance_factor(h); }
+ void set_bf(handle h, int bf) { abs.set_balance_factor(h, bf); }
+
+ int cmp_k_n(key k, handle h) { return abs.compare_key_node(k, h); }
+ int cmp_n_n(handle h1, handle h2) { return abs.compare_node_node(h1, h2); }
+
+ handle null() { return abs.null(); }
+
+private:
+
+ // Balances subtree, returns handle of root node of subtree
+ // after balancing.
+ handle balance(handle bal_h)
+ {
+ handle deep_h;
+
+ // Either the "greater than" or the "less than" subtree of
+ // this node has to be 2 levels deeper (or else it wouldn't
+ // need balancing).
+
+ if (get_bf(bal_h) > 0) {
+ // "Greater than" subtree is deeper.
+
+ deep_h = get_gt(bal_h);
+
+ if (get_bf(deep_h) < 0) {
+ handle old_h = bal_h;
+ bal_h = get_lt(deep_h);
+
+ set_gt(old_h, get_lt(bal_h));
+ set_lt(deep_h, get_gt(bal_h));
+ set_lt(bal_h, old_h);
+ set_gt(bal_h, deep_h);
+
+ int bf = get_bf(bal_h);
+ if (bf != 0) {
+ if (bf > 0) {
+ set_bf(old_h, -1);
+ set_bf(deep_h, 0);
+ } else {
+ set_bf(deep_h, 1);
+ set_bf(old_h, 0);
+ }
+ set_bf(bal_h, 0);
+ } else {
+ set_bf(old_h, 0);
+ set_bf(deep_h, 0);
+ }
+ } else {
+ set_gt(bal_h, get_lt(deep_h));
+ set_lt(deep_h, bal_h);
+ if (get_bf(deep_h) == 0) {
+ set_bf(deep_h, -1);
+ set_bf(bal_h, 1);
+ } else {
+ set_bf(deep_h, 0);
+ set_bf(bal_h, 0);
+ }
+ bal_h = deep_h;
+ }
+ } else {
+ // "Less than" subtree is deeper.
+
+ deep_h = get_lt(bal_h);
+
+ if (get_bf(deep_h) > 0) {
+ handle old_h = bal_h;
+ bal_h = get_gt(deep_h);
+ set_lt(old_h, get_gt(bal_h));
+ set_gt(deep_h, get_lt(bal_h));
+ set_gt(bal_h, old_h);
+ set_lt(bal_h, deep_h);
+
+ int bf = get_bf(bal_h);
+ if (bf != 0) {
+ if (bf < 0) {
+ set_bf(old_h, 1);
+ set_bf(deep_h, 0);
+ } else {
+ set_bf(deep_h, -1);
+ set_bf(old_h, 0);
+ }
+ set_bf(bal_h, 0);
+ } else {
+ set_bf(old_h, 0);
+ set_bf(deep_h, 0);
+ }
+ } else {
+ set_lt(bal_h, get_gt(deep_h));
+ set_gt(deep_h, bal_h);
+ if (get_bf(deep_h) == 0) {
+ set_bf(deep_h, 1);
+ set_bf(bal_h, -1);
+ } else {
+ set_bf(deep_h, 0);
+ set_bf(bal_h, 0);
+ }
+ bal_h = deep_h;
+ }
+ }
+
+ return bal_h;
+ }
+
+};
+
+template <class Abstractor, unsigned maxDepth, class BSet>
+inline typename AVLTree<Abstractor, maxDepth, BSet>::handle
+AVLTree<Abstractor, maxDepth, BSet>::insert(handle h)
+{
+ set_lt(h, null());
+ set_gt(h, null());
+ set_bf(h, 0);
+
+ if (abs.root == null())
+ abs.root = h;
+ else {
+ // Last unbalanced node encountered in search for insertion point.
+ handle unbal = null();
+ // Parent of last unbalanced node.
+ handle parent_unbal = null();
+ // Balance factor of last unbalanced node.
+ int unbal_bf;
+
+ // Zero-based depth in tree.
+ unsigned depth = 0, unbal_depth = 0;
+
+ // Records a path into the tree. If branch[n] is true, indicates
+ // take greater branch from the nth node in the path, otherwise
+ // take the less branch. branch[0] gives branch from root, and
+ // so on.
+ BSet branch;
+
+ handle hh = abs.root;
+ handle parent = null();
+ int cmp;
+
+ do {
+ if (get_bf(hh) != 0) {
+ unbal = hh;
+ parent_unbal = parent;
+ unbal_depth = depth;
+ }
+ cmp = cmp_n_n(h, hh);
+ if (cmp == 0)
+ // Duplicate key.
+ return hh;
+ parent = hh;
+ hh = cmp < 0 ? get_lt(hh) : get_gt(hh);
+ branch[depth++] = cmp > 0;
+ } while (hh != null());
+
+ // Add node to insert as leaf of tree.
+ if (cmp < 0)
+ set_lt(parent, h);
+ else
+ set_gt(parent, h);
+
+ depth = unbal_depth;
+
+ if (unbal == null())
+ hh = abs.root;
+ else {
+ cmp = branch[depth++] ? 1 : -1;
+ unbal_bf = get_bf(unbal);
+ if (cmp < 0)
+ unbal_bf--;
+ else // cmp > 0
+ unbal_bf++;
+ hh = cmp < 0 ? get_lt(unbal) : get_gt(unbal);
+ if ((unbal_bf != -2) && (unbal_bf != 2)) {
+ // No rebalancing of tree is necessary.
+ set_bf(unbal, unbal_bf);
+ unbal = null();
+ }
+ }
+
+ if (hh != null())
+ while (h != hh) {
+ cmp = branch[depth++] ? 1 : -1;
+ if (cmp < 0) {
+ set_bf(hh, -1);
+ hh = get_lt(hh);
+ } else { // cmp > 0
+ set_bf(hh, 1);
+ hh = get_gt(hh);
+ }
+ }
+
+ if (unbal != null()) {
+ unbal = balance(unbal);
+ if (parent_unbal == null())
+ abs.root = unbal;
+ else {
+ depth = unbal_depth - 1;
+ cmp = branch[depth] ? 1 : -1;
+ if (cmp < 0)
+ set_lt(parent_unbal, unbal);
+ else // cmp > 0
+ set_gt(parent_unbal, unbal);
+ }
+ }
+ }
+
+ return h;
+}
+
+template <class Abstractor, unsigned maxDepth, class BSet>
+inline typename AVLTree<Abstractor, maxDepth, BSet>::handle
+AVLTree<Abstractor, maxDepth, BSet>::search(key k, typename AVLTree<Abstractor, maxDepth, BSet>::SearchType st)
+{
+ const int MASK_HIGH_BIT = (int) ~ ((~ (unsigned) 0) >> 1);
+
+ int cmp, target_cmp;
+ handle match_h = null();
+ handle h = abs.root;
+
+ if (st & LESS)
+ target_cmp = 1;
+ else if (st & GREATER)
+ target_cmp = -1;
+ else
+ target_cmp = 0;
+
+ while (h != null()) {
+ cmp = cmp_k_n(k, h);
+ if (cmp == 0) {
+ if (st & EQUAL) {
+ match_h = h;
+ break;
+ }
+ cmp = -target_cmp;
+ } else if (target_cmp != 0)
+ if (!((cmp ^ target_cmp) & MASK_HIGH_BIT))
+ // cmp and target_cmp are both positive or both negative.
+ match_h = h;
+ h = cmp < 0 ? get_lt(h) : get_gt(h);
+ }
+
+ return match_h;
+}
+
+template <class Abstractor, unsigned maxDepth, class BSet>
+inline typename AVLTree<Abstractor, maxDepth, BSet>::handle
+AVLTree<Abstractor, maxDepth, BSet>::search_least()
+{
+ handle h = abs.root, parent = null();
+
+ while (h != null()) {
+ parent = h;
+ h = get_lt(h);
+ }
+
+ return parent;
+}
+
+template <class Abstractor, unsigned maxDepth, class BSet>
+inline typename AVLTree<Abstractor, maxDepth, BSet>::handle
+AVLTree<Abstractor, maxDepth, BSet>::search_greatest()
+{
+ handle h = abs.root, parent = null();
+
+ while (h != null()) {
+ parent = h;
+ h = get_gt(h);
+ }
+
+ return parent;
+}
+
+template <class Abstractor, unsigned maxDepth, class BSet>
+inline typename AVLTree<Abstractor, maxDepth, BSet>::handle
+AVLTree<Abstractor, maxDepth, BSet>::remove(key k)
+{
+ // Zero-based depth in tree.
+ unsigned depth = 0, rm_depth;
+
+ // Records a path into the tree. If branch[n] is true, indicates
+ // take greater branch from the nth node in the path, otherwise
+ // take the less branch. branch[0] gives branch from root, and
+ // so on.
+ BSet branch;
+
+ handle h = abs.root;
+ handle parent = null(), child;
+ int cmp, cmp_shortened_sub_with_path = 0;
+
+ for (;;) {
+ if (h == null())
+ // No node in tree with given key.
+ return null();
+ cmp = cmp_k_n(k, h);
+ if (cmp == 0)
+ // Found node to remove.
+ break;
+ parent = h;
+ h = cmp < 0 ? get_lt(h) : get_gt(h);
+ branch[depth++] = cmp > 0;
+ cmp_shortened_sub_with_path = cmp;
+ }
+ handle rm = h;
+ handle parent_rm = parent;
+ rm_depth = depth;
+
+ // If the node to remove is not a leaf node, we need to get a
+ // leaf node, or a node with a single leaf as its child, to put
+ // in the place of the node to remove. We will get the greatest
+ // node in the less subtree (of the node to remove), or the least
+ // node in the greater subtree. We take the leaf node from the
+ // deeper subtree, if there is one.
+
+ if (get_bf(h) < 0) {
+ child = get_lt(h);
+ branch[depth] = false;
+ cmp = -1;
+ } else {
+ child = get_gt(h);
+ branch[depth] = true;
+ cmp = 1;
+ }
+ depth++;
+
+ if (child != null()) {
+ cmp = -cmp;
+ do {
+ parent = h;
+ h = child;
+ if (cmp < 0) {
+ child = get_lt(h);
+ branch[depth] = false;
+ } else {
+ child = get_gt(h);
+ branch[depth] = true;
+ }
+ depth++;
+ } while (child != null());
+
+ if (parent == rm)
+ // Only went through do loop once. Deleted node will be replaced
+ // in the tree structure by one of its immediate children.
+ cmp_shortened_sub_with_path = -cmp;
+ else
+ cmp_shortened_sub_with_path = cmp;
+
+ // Get the handle of the opposite child, which may not be null.
+ child = cmp > 0 ? get_lt(h) : get_gt(h);
+ }
+
+ if (parent == null())
+ // There were only 1 or 2 nodes in this tree.
+ abs.root = child;
+ else if (cmp_shortened_sub_with_path < 0)
+ set_lt(parent, child);
+ else
+ set_gt(parent, child);
+
+ // "path" is the parent of the subtree being eliminated or reduced
+ // from a depth of 2 to 1. If "path" is the node to be removed, we
+ // set path to the node we're about to poke into the position of the
+ // node to be removed.
+ handle path = parent == rm ? h : parent;
+
+ if (h != rm) {
+ // Poke in the replacement for the node to be removed.
+ set_lt(h, get_lt(rm));
+ set_gt(h, get_gt(rm));
+ set_bf(h, get_bf(rm));
+ if (parent_rm == null())
+ abs.root = h;
+ else {
+ depth = rm_depth - 1;
+ if (branch[depth])
+ set_gt(parent_rm, h);
+ else
+ set_lt(parent_rm, h);
+ }
+ }
+
+ if (path != null()) {
+ // Create a temporary linked list from the parent of the path node
+ // to the root node.
+ h = abs.root;
+ parent = null();
+ depth = 0;
+ while (h != path) {
+ if (branch[depth++]) {
+ child = get_gt(h);
+ set_gt(h, parent);
+ } else {
+ child = get_lt(h);
+ set_lt(h, parent);
+ }
+ parent = h;
+ h = child;
+ }
+
+ // Climb from the path node to the root node using the linked
+ // list, restoring the tree structure and rebalancing as necessary.
+ bool reduced_depth = true;
+ int bf;
+ cmp = cmp_shortened_sub_with_path;
+ for (;;) {
+ if (reduced_depth) {
+ bf = get_bf(h);
+ if (cmp < 0)
+ bf++;
+ else // cmp > 0
+ bf--;
+ if ((bf == -2) || (bf == 2)) {
+ h = balance(h);
+ bf = get_bf(h);
+ } else
+ set_bf(h, bf);
+ reduced_depth = (bf == 0);
+ }
+ if (parent == null())
+ break;
+ child = h;
+ h = parent;
+ cmp = branch[--depth] ? 1 : -1;
+ if (cmp < 0) {
+ parent = get_lt(h);
+ set_lt(h, child);
+ } else {
+ parent = get_gt(h);
+ set_gt(h, child);
+ }
+ }
+ abs.root = h;
+ }
+
+ return rm;
+}
+
+template <class Abstractor, unsigned maxDepth, class BSet>
+inline typename AVLTree<Abstractor, maxDepth, BSet>::handle
+AVLTree<Abstractor, maxDepth, BSet>::subst(handle new_node)
+{
+ handle h = abs.root;
+ handle parent = null();
+ int cmp, last_cmp;
+
+ /* Search for node already in tree with same key. */
+ for (;;) {
+ if (h == null())
+ /* No node in tree with same key as new node. */
+ return null();
+ cmp = cmp_n_n(new_node, h);
+ if (cmp == 0)
+ /* Found the node to substitute new one for. */
+ break;
+ last_cmp = cmp;
+ parent = h;
+ h = cmp < 0 ? get_lt(h) : get_gt(h);
+ }
+
+ /* Copy tree housekeeping fields from node in tree to new node. */
+ set_lt(new_node, get_lt(h));
+ set_gt(new_node, get_gt(h));
+ set_bf(new_node, get_bf(h));
+
+ if (parent == null())
+ /* New node is also new root. */
+ abs.root = new_node;
+ else {
+ /* Make parent point to new node. */
+ if (last_cmp < 0)
+ set_lt(parent, new_node);
+ else
+ set_gt(parent, new_node);
+ }
+
+ return h;
+}
+
+}
+
+#endif
diff --git a/Source/JavaScriptCore/wtf/AlwaysInline.h b/Source/JavaScriptCore/wtf/AlwaysInline.h
new file mode 100644
index 0000000..29c35a8
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/AlwaysInline.h
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2005, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "Platform.h"
+
+#ifndef ALWAYS_INLINE
+#if COMPILER(GCC) && defined(NDEBUG) && !COMPILER(MINGW)
+#define ALWAYS_INLINE inline __attribute__((__always_inline__))
+#elif (COMPILER(MSVC) || COMPILER(RVCT)) && defined(NDEBUG)
+#define ALWAYS_INLINE __forceinline
+#else
+#define ALWAYS_INLINE inline
+#endif
+#endif
+
+#ifndef NEVER_INLINE
+#if COMPILER(GCC)
+#define NEVER_INLINE __attribute__((__noinline__))
+#elif COMPILER(RVCT)
+#define NEVER_INLINE __declspec(noinline)
+#else
+#define NEVER_INLINE
+#endif
+#endif
+
+#ifndef UNLIKELY
+#if defined(__GNUC__)
+#define UNLIKELY(x) __builtin_expect((x), 0)
+#else
+#define UNLIKELY(x) (x)
+#endif
+#endif
+
+#ifndef LIKELY
+#if defined(__GNUC__)
+#define LIKELY(x) __builtin_expect((x), 1)
+#else
+#define LIKELY(x) (x)
+#endif
+#endif
+
+#ifndef NO_RETURN
+#if COMPILER(GCC)
+#define NO_RETURN __attribute((__noreturn__))
+#elif COMPILER(MSVC) || COMPILER(RVCT)
+#define NO_RETURN __declspec(noreturn)
+#else
+#define NO_RETURN
+#endif
+#endif
+
+#ifndef NO_RETURN_WITH_VALUE
+#if !COMPILER(MSVC)
+#define NO_RETURN_WITH_VALUE NO_RETURN
+#else
+#define NO_RETURN_WITH_VALUE
+#endif
+#endif
diff --git a/Source/JavaScriptCore/wtf/Assertions.cpp b/Source/JavaScriptCore/wtf/Assertions.cpp
new file mode 100644
index 0000000..1841150
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/Assertions.cpp
@@ -0,0 +1,249 @@
+/*
+ * Copyright (C) 2003, 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2007-2009 Torch Mobile, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "Assertions.h"
+
+#include <stdio.h>
+#include <stdarg.h>
+#include <string.h>
+
+#if PLATFORM(MAC)
+#include <CoreFoundation/CFString.h>
+#endif
+
+#if COMPILER(MSVC) && !OS(WINCE) && !PLATFORM(BREWMP)
+#ifndef WINVER
+#define WINVER 0x0500
+#endif
+#ifndef _WIN32_WINNT
+#define _WIN32_WINNT 0x0500
+#endif
+#include <crtdbg.h>
+#endif
+
+#if OS(WINDOWS)
+#include <windows.h>
+#endif
+
+#if PLATFORM(BREWMP)
+#include <AEEdbg.h>
+#include <wtf/Vector.h>
+#endif
+
+extern "C" {
+
+#if PLATFORM(BREWMP)
+
+static void printLog(const Vector<char>& buffer)
+{
+ // Each call to DBGPRINTF generates at most 128 bytes of output on the Windows SDK.
+ // On Qualcomm chipset targets, DBGPRINTF() comes out the diag port (though this may change).
+ // The length of each output string is constrained even more than on the Windows SDK.
+#if COMPILER(MSVC)
+ const int printBufferSize = 128;
+#else
+ const int printBufferSize = 32;
+#endif
+
+ char printBuffer[printBufferSize + 1];
+ printBuffer[printBufferSize] = 0; // to guarantee null termination
+
+ const char* p = buffer.data();
+ const char* end = buffer.data() + buffer.size();
+ while (p < end) {
+ strncpy(printBuffer, p, printBufferSize);
+ dbg_Message(printBuffer, DBG_MSG_LEVEL_HIGH, __FILE__, __LINE__);
+ p += printBufferSize;
+ }
+}
+
+#endif
+
+WTF_ATTRIBUTE_PRINTF(1, 0)
+static void vprintf_stderr_common(const char* format, va_list args)
+{
+#if PLATFORM(MAC)
+ if (strstr(format, "%@")) {
+ CFStringRef cfFormat = CFStringCreateWithCString(NULL, format, kCFStringEncodingUTF8);
+ CFStringRef str = CFStringCreateWithFormatAndArguments(NULL, NULL, cfFormat, args);
+
+ int length = CFStringGetMaximumSizeForEncoding(CFStringGetLength(str), kCFStringEncodingUTF8);
+ char* buffer = (char*)malloc(length + 1);
+
+ CFStringGetCString(str, buffer, length, kCFStringEncodingUTF8);
+
+ fputs(buffer, stderr);
+
+ free(buffer);
+ CFRelease(str);
+ CFRelease(cfFormat);
+ } else
+#elif PLATFORM(BREWMP)
+ // When str is 0, the return value is the number of bytes needed
+ // to accept the result including null termination.
+ int size = vsnprintf(0, 0, format, args);
+ if (size > 0) {
+ Vector<char> buffer(size);
+ vsnprintf(buffer.data(), size, format, args);
+ printLog(buffer);
+ }
+
+#elif HAVE(ISDEBUGGERPRESENT)
+ if (IsDebuggerPresent()) {
+ size_t size = 1024;
+
+ do {
+ char* buffer = (char*)malloc(size);
+
+ if (buffer == NULL)
+ break;
+
+ if (_vsnprintf(buffer, size, format, args) != -1) {
+#if OS(WINCE)
+ // WinCE only supports wide chars
+ wchar_t* wideBuffer = (wchar_t*)malloc(size * sizeof(wchar_t));
+ if (wideBuffer == NULL)
+ break;
+ for (unsigned int i = 0; i < size; ++i) {
+ if (!(wideBuffer[i] = buffer[i]))
+ break;
+ }
+ OutputDebugStringW(wideBuffer);
+ free(wideBuffer);
+#else
+ OutputDebugStringA(buffer);
+#endif
+ free(buffer);
+ break;
+ }
+
+ free(buffer);
+ size *= 2;
+ } while (size > 1024);
+ }
+#endif
+#if OS(SYMBIAN)
+ vfprintf(stdout, format, args);
+#else
+ vfprintf(stderr, format, args);
+#endif
+}
+
+WTF_ATTRIBUTE_PRINTF(1, 2)
+static void printf_stderr_common(const char* format, ...)
+{
+ va_list args;
+ va_start(args, format);
+ vprintf_stderr_common(format, args);
+ va_end(args);
+}
+
+static void printCallSite(const char* file, int line, const char* function)
+{
+#if OS(WIN) && !OS(WINCE) && defined _DEBUG
+ _CrtDbgReport(_CRT_WARN, file, line, NULL, "%s\n", function);
+#else
+ printf_stderr_common("(%s:%d %s)\n", file, line, function);
+#endif
+}
+
+void WTFReportAssertionFailure(const char* file, int line, const char* function, const char* assertion)
+{
+ if (assertion)
+ printf_stderr_common("ASSERTION FAILED: %s\n", assertion);
+ else
+ printf_stderr_common("SHOULD NEVER BE REACHED\n");
+ printCallSite(file, line, function);
+}
+
+void WTFReportAssertionFailureWithMessage(const char* file, int line, const char* function, const char* assertion, const char* format, ...)
+{
+ printf_stderr_common("ASSERTION FAILED: ");
+ va_list args;
+ va_start(args, format);
+ vprintf_stderr_common(format, args);
+ va_end(args);
+ printf_stderr_common("\n%s\n", assertion);
+ printCallSite(file, line, function);
+}
+
+void WTFReportArgumentAssertionFailure(const char* file, int line, const char* function, const char* argName, const char* assertion)
+{
+ printf_stderr_common("ARGUMENT BAD: %s, %s\n", argName, assertion);
+ printCallSite(file, line, function);
+}
+
+void WTFReportFatalError(const char* file, int line, const char* function, const char* format, ...)
+{
+ printf_stderr_common("FATAL ERROR: ");
+ va_list args;
+ va_start(args, format);
+ vprintf_stderr_common(format, args);
+ va_end(args);
+ printf_stderr_common("\n");
+ printCallSite(file, line, function);
+}
+
+void WTFReportError(const char* file, int line, const char* function, const char* format, ...)
+{
+ printf_stderr_common("ERROR: ");
+ va_list args;
+ va_start(args, format);
+ vprintf_stderr_common(format, args);
+ va_end(args);
+ printf_stderr_common("\n");
+ printCallSite(file, line, function);
+}
+
+void WTFLog(WTFLogChannel* channel, const char* format, ...)
+{
+ if (channel->state != WTFLogChannelOn)
+ return;
+
+ va_list args;
+ va_start(args, format);
+ vprintf_stderr_common(format, args);
+ va_end(args);
+ if (format[strlen(format) - 1] != '\n')
+ printf_stderr_common("\n");
+}
+
+void WTFLogVerbose(const char* file, int line, const char* function, WTFLogChannel* channel, const char* format, ...)
+{
+ if (channel->state != WTFLogChannelOn)
+ return;
+
+ va_list args;
+ va_start(args, format);
+ vprintf_stderr_common(format, args);
+ va_end(args);
+ if (format[strlen(format) - 1] != '\n')
+ printf_stderr_common("\n");
+ printCallSite(file, line, function);
+}
+
+} // extern "C"
diff --git a/Source/JavaScriptCore/wtf/Assertions.h b/Source/JavaScriptCore/wtf/Assertions.h
new file mode 100644
index 0000000..3f3af72
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/Assertions.h
@@ -0,0 +1,336 @@
+/*
+ * Copyright (C) 2003, 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WTF_Assertions_h
+#define WTF_Assertions_h
+
+/*
+ no namespaces because this file has to be includable from C and Objective-C
+
+ Note, this file uses many GCC extensions, but it should be compatible with
+ C, Objective C, C++, and Objective C++.
+
+ For non-debug builds, everything is disabled by default.
+ Defining any of the symbols explicitly prevents this from having any effect.
+
+ MSVC7 note: variadic macro support was added in MSVC8, so for now we disable
+ those macros in MSVC7. For more info, see the MSDN document on variadic
+ macros here:
+
+ http://msdn2.microsoft.com/en-us/library/ms177415(VS.80).aspx
+*/
+
+#include "Platform.h"
+
+#include <stddef.h>
+
+#if !COMPILER(MSVC)
+#include <inttypes.h>
+#endif
+
+#if OS(SYMBIAN)
+#include <e32def.h>
+#include <e32debug.h>
+#endif
+
+#if PLATFORM(BREWMP)
+#include <AEEError.h>
+#include <AEEdbg.h>
+#endif
+
+#ifdef NDEBUG
+/* Disable ASSERT* macros in release mode. */
+#define ASSERTIONS_DISABLED_DEFAULT 1
+#else
+#define ASSERTIONS_DISABLED_DEFAULT 0
+#endif
+
+#if COMPILER(MSVC7_OR_LOWER) || COMPILER(WINSCW)
+#define HAVE_VARIADIC_MACRO 0
+#else
+#define HAVE_VARIADIC_MACRO 1
+#endif
+
+#ifndef ASSERT_DISABLED
+#define ASSERT_DISABLED ASSERTIONS_DISABLED_DEFAULT
+#endif
+
+#ifndef ASSERT_MSG_DISABLED
+#if HAVE(VARIADIC_MACRO)
+#define ASSERT_MSG_DISABLED ASSERTIONS_DISABLED_DEFAULT
+#else
+#define ASSERT_MSG_DISABLED 1
+#endif
+#endif
+
+#ifndef ASSERT_ARG_DISABLED
+#define ASSERT_ARG_DISABLED ASSERTIONS_DISABLED_DEFAULT
+#endif
+
+#ifndef FATAL_DISABLED
+#if HAVE(VARIADIC_MACRO)
+#define FATAL_DISABLED ASSERTIONS_DISABLED_DEFAULT
+#else
+#define FATAL_DISABLED 1
+#endif
+#endif
+
+#ifndef ERROR_DISABLED
+#if HAVE(VARIADIC_MACRO)
+#define ERROR_DISABLED ASSERTIONS_DISABLED_DEFAULT
+#else
+#define ERROR_DISABLED 1
+#endif
+#endif
+
+#ifndef LOG_DISABLED
+#if HAVE(VARIADIC_MACRO)
+#define LOG_DISABLED ASSERTIONS_DISABLED_DEFAULT
+#else
+#define LOG_DISABLED 1
+#endif
+#endif
+
+#if COMPILER(GCC)
+#define WTF_PRETTY_FUNCTION __PRETTY_FUNCTION__
+#else
+#define WTF_PRETTY_FUNCTION __FUNCTION__
+#endif
+
+/* WTF logging functions can process %@ in the format string to log a NSObject* but the printf format attribute
+ emits a warning when %@ is used in the format string. Until <rdar://problem/5195437> is resolved we can't include
+ the attribute when being used from Objective-C code in case it decides to use %@. */
+#if COMPILER(GCC) && !defined(__OBJC__)
+#define WTF_ATTRIBUTE_PRINTF(formatStringArgument, extraArguments) __attribute__((__format__(printf, formatStringArgument, extraArguments)))
+#else
+#define WTF_ATTRIBUTE_PRINTF(formatStringArgument, extraArguments)
+#endif
+
+/* These helper functions are always declared, but not necessarily always defined if the corresponding function is disabled. */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef enum { WTFLogChannelOff, WTFLogChannelOn } WTFLogChannelState;
+
+typedef struct {
+ unsigned mask;
+ const char *defaultName;
+ WTFLogChannelState state;
+} WTFLogChannel;
+
+void WTFReportAssertionFailure(const char* file, int line, const char* function, const char* assertion);
+void WTFReportAssertionFailureWithMessage(const char* file, int line, const char* function, const char* assertion, const char* format, ...) WTF_ATTRIBUTE_PRINTF(5, 6);
+void WTFReportArgumentAssertionFailure(const char* file, int line, const char* function, const char* argName, const char* assertion);
+void WTFReportFatalError(const char* file, int line, const char* function, const char* format, ...) WTF_ATTRIBUTE_PRINTF(4, 5);
+void WTFReportError(const char* file, int line, const char* function, const char* format, ...) WTF_ATTRIBUTE_PRINTF(4, 5);
+void WTFLog(WTFLogChannel* channel, const char* format, ...) WTF_ATTRIBUTE_PRINTF(2, 3);
+void WTFLogVerbose(const char* file, int line, const char* function, WTFLogChannel* channel, const char* format, ...) WTF_ATTRIBUTE_PRINTF(5, 6);
+
+#ifdef __cplusplus
+}
+#endif
+
+/* CRASH() - Raises a fatal error resulting in program termination and triggering either the debugger or the crash reporter.
+
+ Use CRASH() in response to known, unrecoverable errors like out-of-memory.
+ Macro is enabled in both debug and release mode.
+ To test for unknown errors and verify assumptions, use ASSERT instead, to avoid impacting performance in release builds.
+
+ Signals are ignored by the crash reporter on OS X so we must do better.
+*/
+#ifndef CRASH
+#if OS(SYMBIAN)
+#define CRASH() do { \
+ __DEBUGGER(); \
+ User::Panic(_L("Webkit CRASH"),0); \
+ } while(false)
+#elif PLATFORM(BREWMP)
+#define CRASH() do { \
+ dbg_Message("WebKit CRASH", DBG_MSG_LEVEL_FATAL, __FILE__, __LINE__); \
+ *(int *)(uintptr_t)0xbbadbeef = 0; \
+ ((void(*)())0)(); /* More reliable, but doesn't say BBADBEEF */ \
+} while(false)
+#else
+#define CRASH() do { \
+ *(int *)(uintptr_t)0xbbadbeef = 0; \
+ ((void(*)())0)(); /* More reliable, but doesn't say BBADBEEF */ \
+} while(false)
+#endif
+#endif
+
+/* ASSERT, ASSERT_NOT_REACHED, ASSERT_UNUSED
+
+ These macros are compiled out of release builds.
+ Expressions inside them are evaluated in debug builds only.
+*/
+
+#if OS(WINCE) && !PLATFORM(TORCHMOBILE)
+/* FIXME: We include this here only to avoid a conflict with the ASSERT macro. */
+#include <windows.h>
+#undef min
+#undef max
+#undef ERROR
+#endif
+
+#if OS(WINDOWS) || OS(SYMBIAN)
+/* FIXME: Change to use something other than ASSERT to avoid this conflict with the underlying platform */
+#undef ASSERT
+#endif
+
+#if PLATFORM(BREWMP)
+/* FIXME: We include this here only to avoid a conflict with the COMPILE_ASSERT macro. */
+#include <AEEClassIDs.h>
+
+/* FIXME: Change to use something other than COMPILE_ASSERT to avoid this conflict with the underlying platform */
+#undef COMPILE_ASSERT
+#endif
+
+#if ASSERT_DISABLED
+
+#define ASSERT(assertion) ((void)0)
+#define ASSERT_NOT_REACHED() ((void)0)
+
+#if COMPILER(INTEL) && !OS(WINDOWS) || COMPILER(RVCT)
+template<typename T>
+inline void assertUnused(T& x) { (void)x; }
+#define ASSERT_UNUSED(variable, assertion) (assertUnused(variable))
+#else
+#define ASSERT_UNUSED(variable, assertion) ((void)variable)
+#endif
+
+#else
+
+#define ASSERT(assertion) do \
+ if (!(assertion)) { \
+ WTFReportAssertionFailure(__FILE__, __LINE__, WTF_PRETTY_FUNCTION, #assertion); \
+ CRASH(); \
+ } \
+while (0)
+
+#define ASSERT_NOT_REACHED() do { \
+ WTFReportAssertionFailure(__FILE__, __LINE__, WTF_PRETTY_FUNCTION, 0); \
+ CRASH(); \
+} while (0)
+
+#define ASSERT_UNUSED(variable, assertion) ASSERT(assertion)
+
+#endif
+
+/* ASSERT_WITH_MESSAGE */
+
+#if COMPILER(MSVC7_OR_LOWER)
+#define ASSERT_WITH_MESSAGE(assertion) ((void)0)
+#elif COMPILER(WINSCW)
+#define ASSERT_WITH_MESSAGE(assertion, arg...) ((void)0)
+#elif ASSERT_MSG_DISABLED
+#define ASSERT_WITH_MESSAGE(assertion, ...) ((void)0)
+#else
+#define ASSERT_WITH_MESSAGE(assertion, ...) do \
+ if (!(assertion)) { \
+ WTFReportAssertionFailureWithMessage(__FILE__, __LINE__, WTF_PRETTY_FUNCTION, #assertion, __VA_ARGS__); \
+ CRASH(); \
+ } \
+while (0)
+#endif
+
+
+/* ASSERT_ARG */
+
+#if ASSERT_ARG_DISABLED
+
+#define ASSERT_ARG(argName, assertion) ((void)0)
+
+#else
+
+#define ASSERT_ARG(argName, assertion) do \
+ if (!(assertion)) { \
+ WTFReportArgumentAssertionFailure(__FILE__, __LINE__, WTF_PRETTY_FUNCTION, #argName, #assertion); \
+ CRASH(); \
+ } \
+while (0)
+
+#endif
+
+/* COMPILE_ASSERT */
+#ifndef COMPILE_ASSERT
+#define COMPILE_ASSERT(exp, name) typedef int dummy##name [(exp) ? 1 : -1]
+#endif
+
+/* FATAL */
+
+#if COMPILER(MSVC7_OR_LOWER)
+#define FATAL() ((void)0)
+#elif COMPILER(WINSCW)
+#define FATAL(arg...) ((void)0)
+#elif FATAL_DISABLED
+#define FATAL(...) ((void)0)
+#else
+#define FATAL(...) do { \
+ WTFReportFatalError(__FILE__, __LINE__, WTF_PRETTY_FUNCTION, __VA_ARGS__); \
+ CRASH(); \
+} while (0)
+#endif
+
+/* LOG_ERROR */
+
+#if COMPILER(MSVC7_OR_LOWER)
+#define LOG_ERROR() ((void)0)
+#elif COMPILER(WINSCW)
+#define LOG_ERROR(arg...) ((void)0)
+#elif ERROR_DISABLED
+#define LOG_ERROR(...) ((void)0)
+#else
+#define LOG_ERROR(...) WTFReportError(__FILE__, __LINE__, WTF_PRETTY_FUNCTION, __VA_ARGS__)
+#endif
+
+/* LOG */
+
+#if COMPILER(MSVC7_OR_LOWER)
+#define LOG() ((void)0)
+#elif COMPILER(WINSCW)
+#define LOG(arg...) ((void)0)
+#elif LOG_DISABLED
+#define LOG(channel, ...) ((void)0)
+#else
+#define LOG(channel, ...) WTFLog(&JOIN_LOG_CHANNEL_WITH_PREFIX(LOG_CHANNEL_PREFIX, channel), __VA_ARGS__)
+#define JOIN_LOG_CHANNEL_WITH_PREFIX(prefix, channel) JOIN_LOG_CHANNEL_WITH_PREFIX_LEVEL_2(prefix, channel)
+#define JOIN_LOG_CHANNEL_WITH_PREFIX_LEVEL_2(prefix, channel) prefix ## channel
+#endif
+
+/* LOG_VERBOSE */
+
+#if COMPILER(MSVC7_OR_LOWER)
+#define LOG_VERBOSE(channel) ((void)0)
+#elif COMPILER(WINSCW)
+#define LOG_VERBOSE(channel, arg...) ((void)0)
+#elif LOG_DISABLED
+#define LOG_VERBOSE(channel, ...) ((void)0)
+#else
+#define LOG_VERBOSE(channel, ...) WTFLogVerbose(__FILE__, __LINE__, WTF_PRETTY_FUNCTION, &JOIN_LOG_CHANNEL_WITH_PREFIX(LOG_CHANNEL_PREFIX, channel), __VA_ARGS__)
+#endif
+
+#endif /* WTF_Assertions_h */
diff --git a/Source/JavaScriptCore/wtf/Atomics.h b/Source/JavaScriptCore/wtf/Atomics.h
new file mode 100644
index 0000000..1d190a3
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/Atomics.h
@@ -0,0 +1,117 @@
+/*
+ * Copyright (C) 2007, 2008, 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2007 Justin Haygood (jhaygood@reaktix.com)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * Note: The implementations of InterlockedIncrement and InterlockedDecrement are based
+ * on atomic_increment and atomic_exchange_and_add from the Boost C++ Library. The license
+ * is virtually identical to the Apple license above but is included here for completeness.
+ *
+ * Boost Software License - Version 1.0 - August 17th, 2003
+ *
+ * Permission is hereby granted, free of charge, to any person or organization
+ * obtaining a copy of the software and accompanying documentation covered by
+ * this license (the "Software") to use, reproduce, display, distribute,
+ * execute, and transmit the Software, and to prepare derivative works of the
+ * Software, and to permit third-parties to whom the Software is furnished to
+ * do so, all subject to the following:
+ *
+ * The copyright notices in the Software and this entire statement, including
+ * the above license grant, this restriction and the following disclaimer,
+ * must be included in all copies of the Software, in whole or in part, and
+ * all derivative works of the Software, unless such copies or derivative
+ * works are solely in the form of machine-executable object code generated by
+ * a source language processor.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
+ * SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
+ * FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef Atomics_h
+#define Atomics_h
+
+#include "Platform.h"
+
+#if OS(WINDOWS)
+#include <windows.h>
+#elif OS(DARWIN)
+#include <libkern/OSAtomic.h>
+#elif OS(ANDROID)
+#include <cutils/atomic.h>
+#elif COMPILER(GCC) && !OS(SYMBIAN)
+#if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2))
+#include <ext/atomicity.h>
+#else
+#include <bits/atomicity.h>
+#endif
+#endif
+
+namespace WTF {
+
+#if OS(WINDOWS)
+#define WTF_USE_LOCKFREE_THREADSAFESHARED 1
+
+#if COMPILER(MINGW) || COMPILER(MSVC7_OR_LOWER) || OS(WINCE)
+inline int atomicIncrement(int* addend) { return InterlockedIncrement(reinterpret_cast<long*>(addend)); }
+inline int atomicDecrement(int* addend) { return InterlockedDecrement(reinterpret_cast<long*>(addend)); }
+#else
+inline int atomicIncrement(int volatile* addend) { return InterlockedIncrement(reinterpret_cast<long volatile*>(addend)); }
+inline int atomicDecrement(int volatile* addend) { return InterlockedDecrement(reinterpret_cast<long volatile*>(addend)); }
+#endif
+
+#elif OS(DARWIN)
+#define WTF_USE_LOCKFREE_THREADSAFESHARED 1
+
+inline int atomicIncrement(int volatile* addend) { return OSAtomicIncrement32Barrier(const_cast<int*>(addend)); }
+inline int atomicDecrement(int volatile* addend) { return OSAtomicDecrement32Barrier(const_cast<int*>(addend)); }
+
+#elif OS(ANDROID)
+
+inline int atomicIncrement(int volatile* addend) { return android_atomic_inc(addend); }
+inline int atomicDecrement(int volatile* addend) { return android_atomic_dec(addend); }
+
+#elif COMPILER(GCC) && !CPU(SPARC64) && !OS(SYMBIAN) // sizeof(_Atomic_word) != sizeof(int) on sparc64 gcc
+#define WTF_USE_LOCKFREE_THREADSAFESHARED 1
+
+inline int atomicIncrement(int volatile* addend) { return __gnu_cxx::__exchange_and_add(addend, 1) + 1; }
+inline int atomicDecrement(int volatile* addend) { return __gnu_cxx::__exchange_and_add(addend, -1) - 1; }
+
+#endif
+
+} // namespace WTF
+
+#if USE(LOCKFREE_THREADSAFESHARED)
+using WTF::atomicDecrement;
+using WTF::atomicIncrement;
+#endif
+
+#endif // Atomics_h
diff --git a/Source/JavaScriptCore/wtf/Bitmap.h b/Source/JavaScriptCore/wtf/Bitmap.h
new file mode 100644
index 0000000..4dd88f6
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/Bitmap.h
@@ -0,0 +1,131 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+#ifndef Bitmap_h
+#define Bitmap_h
+
+#include "FixedArray.h"
+#include "StdLibExtras.h"
+
+#include <stdint.h>
+
+namespace WTF {
+
+template<size_t size>
+class Bitmap {
+private:
+ typedef uint32_t WordType;
+
+public:
+ Bitmap();
+
+ bool get(size_t) const;
+ void set(size_t);
+ void clear(size_t);
+ void clearAll();
+ void advanceToNextFreeBit(size_t&) const;
+ size_t count(size_t = 0) const;
+ size_t isEmpty() const;
+ size_t isFull() const;
+
+private:
+ static const WordType wordSize = sizeof(WordType) * 8;
+ static const WordType words = (size + wordSize - 1) / wordSize;
+
+ // the literal '1' is of type signed int. We want to use an unsigned
+ // version of the correct size when doing the calculations because if
+ // WordType is larger than int, '1 << 31' will first be sign extended
+ // and then casted to unsigned, meaning that set(31) when WordType is
+ // a 64 bit unsigned int would give 0xffff8000
+ static const WordType one = 1;
+
+ FixedArray<WordType, words> bits;
+};
+
+template<size_t size>
+inline Bitmap<size>::Bitmap()
+{
+ clearAll();
+}
+
+template<size_t size>
+inline bool Bitmap<size>::get(size_t n) const
+{
+ return !!(bits[n / wordSize] & (one << (n % wordSize)));
+}
+
+template<size_t size>
+inline void Bitmap<size>::set(size_t n)
+{
+ bits[n / wordSize] |= (one << (n % wordSize));
+}
+
+template<size_t size>
+inline void Bitmap<size>::clear(size_t n)
+{
+ bits[n / wordSize] &= ~(one << (n % wordSize));
+}
+
+template<size_t size>
+inline void Bitmap<size>::clearAll()
+{
+ memset(bits.data(), 0, sizeof(bits));
+}
+
+template<size_t size>
+inline void Bitmap<size>::advanceToNextFreeBit(size_t& start) const
+{
+ if (!~bits[start / wordSize])
+ start = ((start / wordSize) + 1) * wordSize;
+ else
+ ++start;
+}
+
+template<size_t size>
+inline size_t Bitmap<size>::count(size_t start) const
+{
+ size_t result = 0;
+ for ( ; (start % wordSize); ++start) {
+ if (get(start))
+ ++result;
+ }
+ for (size_t i = start / wordSize; i < words; ++i)
+ result += WTF::bitCount(bits[i]);
+ return result;
+}
+
+template<size_t size>
+inline size_t Bitmap<size>::isEmpty() const
+{
+ for (size_t i = 0; i < words; ++i)
+ if (bits[i])
+ return false;
+ return true;
+}
+
+template<size_t size>
+inline size_t Bitmap<size>::isFull() const
+{
+ for (size_t i = 0; i < words; ++i)
+ if (~bits[i])
+ return false;
+ return true;
+}
+
+}
+#endif
diff --git a/Source/JavaScriptCore/wtf/BumpPointerAllocator.h b/Source/JavaScriptCore/wtf/BumpPointerAllocator.h
new file mode 100644
index 0000000..682283c
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/BumpPointerAllocator.h
@@ -0,0 +1,250 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef BumpPointerAllocator_h
+#define BumpPointerAllocator_h
+
+#include <wtf/PageAllocation.h>
+
+namespace WTF {
+
+#define MINIMUM_BUMP_POOL_SIZE 0x1000
+
+class BumpPointerPool {
+public:
+ // ensureCapacity will check whether the current pool has capacity to
+ // allocate 'size' bytes of memory If it does not, it will attempt to
+ // allocate a new pool (which will be added to this one in a chain).
+ //
+ // If allocation fails (out of memory) this method will return null.
+ // If the return value is non-null, then callers should update any
+ // references they have to this current (possibly full) BumpPointerPool
+ // to instead point to the newly returned BumpPointerPool.
+ BumpPointerPool* ensureCapacity(size_t size)
+ {
+ void* allocationEnd = static_cast<char*>(m_current) + size;
+ ASSERT(allocationEnd > m_current); // check for overflow
+ if (allocationEnd <= static_cast<void*>(this))
+ return this;
+ return ensureCapacityCrossPool(this, size);
+ }
+
+ // alloc should only be called after calling ensureCapacity; as such
+ // alloc will never fail.
+ void* alloc(size_t size)
+ {
+ void* current = m_current;
+ void* allocationEnd = static_cast<char*>(current) + size;
+ ASSERT(allocationEnd > current); // check for overflow
+ ASSERT(allocationEnd <= static_cast<void*>(this));
+ m_current = allocationEnd;
+ return current;
+ }
+
+ // The dealloc method releases memory allocated using alloc. Memory
+ // must be released in a LIFO fashion, e.g. if the client calls alloc
+ // four times, returning pointer A, B, C, D, then the only valid order
+ // in which these may be deallocaed is D, C, B, A.
+ //
+ // The client may optionally skip some deallocations. In the example
+ // above, it would be valid to only explicitly dealloc C, A (D being
+ // dealloced along with C, B along with A).
+ //
+ // If pointer was not allocated from this pool (or pools) then dealloc
+ // will CRASH(). Callers should update any references they have to
+ // this current BumpPointerPool to instead point to the returned
+ // BumpPointerPool.
+ BumpPointerPool* dealloc(void* position)
+ {
+ if ((position >= m_start) && (position <= static_cast<void*>(this))) {
+ ASSERT(position <= m_current);
+ m_current = position;
+ return this;
+ }
+ return deallocCrossPool(this, position);
+ }
+
+private:
+ // Placement operator new, returns the last 'size' bytes of allocation for use as this.
+ void* operator new(size_t size, const PageAllocation& allocation)
+ {
+ ASSERT(size < allocation.size());
+ return reinterpret_cast<char*>(reinterpret_cast<intptr_t>(allocation.base()) + allocation.size()) - size;
+ }
+
+ BumpPointerPool(const PageAllocation& allocation)
+ : m_current(allocation.base())
+ , m_start(allocation.base())
+ , m_next(0)
+ , m_previous(0)
+ , m_allocation(allocation)
+ {
+ }
+
+ static BumpPointerPool* create(size_t minimumCapacity = 0)
+ {
+ // Add size of BumpPointerPool object, check for overflow.
+ minimumCapacity += sizeof(BumpPointerPool);
+ if (minimumCapacity < sizeof(BumpPointerPool))
+ return 0;
+
+ size_t poolSize = MINIMUM_BUMP_POOL_SIZE;
+ while (poolSize < minimumCapacity) {
+ poolSize <<= 1;
+ // The following if check relies on MINIMUM_BUMP_POOL_SIZE being a power of 2!
+ ASSERT(!(MINIMUM_BUMP_POOL_SIZE & (MINIMUM_BUMP_POOL_SIZE - 1)));
+ if (!poolSize)
+ return 0;
+ }
+
+ PageAllocation allocation = PageAllocation::allocate(poolSize);
+ if (!!allocation)
+ return new(allocation) BumpPointerPool(allocation);
+ return 0;
+ }
+
+ void shrink()
+ {
+ ASSERT(!m_previous);
+ m_current = m_start;
+ while (m_next) {
+ BumpPointerPool* nextNext = m_next->m_next;
+ m_next->destroy();
+ m_next = nextNext;
+ }
+ }
+
+ void destroy()
+ {
+ m_allocation.deallocate();
+ }
+
+ static BumpPointerPool* ensureCapacityCrossPool(BumpPointerPool* previousPool, size_t size)
+ {
+ // The pool passed should not have capacity, so we'll start with the next one.
+ ASSERT(previousPool);
+ ASSERT((static_cast<char*>(previousPool->m_current) + size) > previousPool->m_current); // check for overflow
+ ASSERT((static_cast<char*>(previousPool->m_current) + size) > static_cast<void*>(previousPool));
+ BumpPointerPool* pool = previousPool->m_next;
+
+ while (true) {
+ if (!pool) {
+ // We've run to the end; allocate a new pool.
+ pool = BumpPointerPool::create(size);
+ previousPool->m_next = pool;
+ pool->m_previous = previousPool;
+ return pool;
+ }
+
+ //
+ void* current = pool->m_current;
+ void* allocationEnd = static_cast<char*>(current) + size;
+ ASSERT(allocationEnd > current); // check for overflow
+ if (allocationEnd <= static_cast<void*>(pool))
+ return pool;
+ }
+ }
+
+ static BumpPointerPool* deallocCrossPool(BumpPointerPool* pool, void* position)
+ {
+ // Should only be called if position is not in the current pool.
+ ASSERT((position < pool->m_start) || (position > static_cast<void*>(pool)));
+
+ while (true) {
+ // Unwind the current pool to the start, move back in the chain to the previous pool.
+ pool->m_current = pool->m_start;
+ pool = pool->m_previous;
+
+ // position was nowhere in the chain!
+ if (!pool)
+ CRASH();
+
+ if ((position >= pool->m_start) && (position <= static_cast<void*>(pool))) {
+ ASSERT(position <= pool->m_current);
+ pool->m_current = position;
+ return pool;
+ }
+ }
+ }
+
+ void* m_current;
+ void* m_start;
+ BumpPointerPool* m_next;
+ BumpPointerPool* m_previous;
+ PageAllocation m_allocation;
+
+ friend class BumpPointerAllocator;
+};
+
+// A BumpPointerAllocator manages a set of BumpPointerPool objects, which
+// can be used for LIFO (stack like) allocation.
+//
+// To begin allocating using this class call startAllocator(). The result
+// of this method will be null if the initial pool allocation fails, or a
+// pointer to a BumpPointerPool object that can be used to perform
+// allocations. Whilst running no memory will be released until
+// stopAllocator() is called. At this point all allocations made through
+// this allocator will be reaped, and underlying memory may be freed.
+//
+// (In practice we will still hold on to the initial pool to allow allocation
+// to be quickly restared, but aditional pools will be freed).
+//
+// This allocator is non-renetrant, it is encumbant on the clients to ensure
+// startAllocator() is not called again until stopAllocator() has been called.
+class BumpPointerAllocator {
+public:
+ BumpPointerAllocator()
+ : m_head(0)
+ {
+ }
+
+ ~BumpPointerAllocator()
+ {
+ if (m_head)
+ m_head->destroy();
+ }
+
+ BumpPointerPool* startAllocator()
+ {
+ if (!m_head)
+ m_head = BumpPointerPool::create();
+ return m_head;
+ }
+
+ void stopAllocator()
+ {
+ if (m_head)
+ m_head->shrink();
+ }
+
+private:
+ BumpPointerPool* m_head;
+};
+
+}
+
+using WTF::BumpPointerAllocator;
+
+#endif // BumpPointerAllocator_h
diff --git a/Source/JavaScriptCore/wtf/ByteArray.cpp b/Source/JavaScriptCore/wtf/ByteArray.cpp
new file mode 100644
index 0000000..910af59
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/ByteArray.cpp
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "ByteArray.h"
+#include "StdLibExtras.h"
+
+namespace WTF {
+
+PassRefPtr<ByteArray> ByteArray::create(size_t size)
+{
+ unsigned char* buffer = new unsigned char[size + OBJECT_OFFSETOF(ByteArray, m_data)];
+ ASSERT((reinterpret_cast<size_t>(buffer) & 3) == 0);
+ return adoptRef(new (buffer) ByteArray(size));
+}
+
+}
diff --git a/Source/JavaScriptCore/wtf/ByteArray.h b/Source/JavaScriptCore/wtf/ByteArray.h
new file mode 100644
index 0000000..bdec630
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/ByteArray.h
@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ByteArray_h
+#define ByteArray_h
+
+#include <limits.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/Platform.h>
+#include <wtf/RefCounted.h>
+
+namespace WTF {
+ class ByteArray : public RefCountedBase {
+ public:
+ unsigned length() const { return m_size; }
+
+ void set(unsigned index, double value)
+ {
+ if (index >= m_size)
+ return;
+ if (!(value > 0)) // Clamp NaN to 0
+ value = 0;
+ else if (value > 255)
+ value = 255;
+ m_data[index] = static_cast<unsigned char>(value + 0.5);
+ }
+
+ void set(unsigned index, unsigned char value)
+ {
+ if (index >= m_size)
+ return;
+ m_data[index] = value;
+ }
+
+ bool get(unsigned index, unsigned char& result) const
+ {
+ if (index >= m_size)
+ return false;
+ result = m_data[index];
+ return true;
+ }
+
+ unsigned char get(unsigned index) const
+ {
+ ASSERT(index < m_size);
+ return m_data[index];
+ }
+
+ unsigned char* data() { return m_data; }
+
+ void deref()
+ {
+ if (derefBase()) {
+ // We allocated with new unsigned char[] in create(),
+ // and then used placement new to construct the object.
+ this->~ByteArray();
+ delete[] reinterpret_cast<unsigned char*>(this);
+ }
+ }
+
+ static PassRefPtr<ByteArray> create(size_t size);
+
+ private:
+ ByteArray(size_t size)
+ : m_size(size)
+ {
+ }
+ size_t m_size;
+// MSVC can't handle correctly unsized array.
+// warning C4200: nonstandard extension used : zero-sized array in struct/union
+// Cannot generate copy-ctor or copy-assignment operator when UDT contains a zero-sized array
+#if COMPILER(MSVC)
+ unsigned char m_data[INT_MAX];
+#else
+ unsigned char m_data[];
+#endif
+ };
+} // namespace WTF
+
+using WTF::ByteArray;
+
+#endif
diff --git a/Source/JavaScriptCore/wtf/CMakeLists.txt b/Source/JavaScriptCore/wtf/CMakeLists.txt
new file mode 100644
index 0000000..b1931d7
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/CMakeLists.txt
@@ -0,0 +1,154 @@
+SET(WTF_HEADERS
+ ASCIICType.h
+ AVLTree.h
+ AlwaysInline.h
+ Assertions.h
+ Atomics.h
+ Bitmap.h
+ BumpPointerAllocator.h
+ ByteArray.h
+ Complex.h
+ CrossThreadRefCounted.h
+ CurrentTime.h
+ DateMath.h
+ DecimalNumber.h
+ Decoder.h
+ Deque.h
+ DisallowCType.h
+ Encoder.h
+ FastAllocBase.h
+ FastMalloc.h
+ FixedArray.h
+ Forward.h
+ GetPtr.h
+ HashCountedSet.h
+ HashFunctions.h
+ HashIterators.h
+ HashMap.h
+ HashSet.h
+ HashTable.h
+ HashTraits.h
+ ListHashSet.h
+ ListRefPtr.h
+ Locker.h
+ MD5.h
+ MainThread.h
+ MallocZoneSupport.h
+ MathExtras.h
+ MessageQueue.h
+ NonCopyingSort.h
+ Noncopyable.h
+ NotFound.h
+ NullPtr.h
+ OSAllocator.h
+ OwnArrayPtr.h
+ OwnArrayPtrCommon.h
+ OwnFastMallocPtr.h
+ OwnPtr.h
+ OwnPtrCommon.h
+ PageAllocation.h
+ PageAllocationAligned.h
+ PageBlock.h
+ PageReservation.h
+ PassOwnArrayPtr.h
+ PassOwnPtr.h
+ PassRefPtr.h
+ Platform.h
+ PossiblyNull.h
+ RandomNumber.h
+ RandomNumberSeed.h
+ RefCounted.h
+ RefCountedLeakCounter.h
+ RefPtr.h
+ RefPtrHashMap.h
+ RetainPtr.h
+ SegmentedVector.h
+ StackBounds.h
+ StaticConstructors.h
+ StdLibExtras.h
+ StringExtras.h
+ StringHasher.h
+ TCPackedCache.h
+ TCPageMap.h
+ TCSpinLock.h
+ TCSystemAlloc.h
+ ThreadIdentifierDataPthreads.h
+ ThreadSafeShared.h
+ ThreadSpecific.h
+ Threading.h
+ ThreadingPrimitives.h
+ TypeTraits.h
+ UnusedParam.h
+ VMTags.h
+ ValueCheck.h
+ Vector.h
+ VectorTraits.h
+ WTFThreadData.h
+ dtoa.h
+
+ text/AtomicString.h
+ text/AtomicStringImpl.h
+ text/CString.h
+ text/StringBuffer.h
+ text/StringHash.h
+ text/StringImpl.h
+ text/StringImplBase.h
+ text/WTFString.h
+
+ unicode/Collator.h
+ unicode/UTF8.h
+ unicode/Unicode.h
+)
+
+SET(WTF_SOURCES
+ Assertions.cpp
+ ByteArray.cpp
+ CurrentTime.cpp
+ DecimalNumber.cpp
+ FastMalloc.cpp
+ HashTable.cpp
+ MainThread.cpp
+ MD5.cpp
+ RandomNumber.cpp
+ RefCountedLeakCounter.cpp
+ StackBounds.cpp
+ StringExtras.cpp
+ Threading.cpp
+ TypeTraits.cpp
+ WTFThreadData.cpp
+ dtoa.cpp
+
+ text/AtomicString.cpp
+ text/CString.cpp
+ text/StringBuilder.cpp
+ text/StringImpl.cpp
+ text/StringStatics.cpp
+ text/WTFString.cpp
+
+ unicode/UTF8.cpp
+)
+
+SET(WTF_LIBRARIES
+)
+
+SET(WTF_PORT_FLAGS )
+INCLUDE_IF_EXISTS(${JAVASCRIPTCORE_DIR}/wtf/CMakeLists${PORT}.txt)
+
+LIST(APPEND WTF_INCLUDE_DIRECTORIES
+ "${CMAKE_BINARY_DIR}"
+)
+
+WEBKIT_WRAP_SOURCELIST(${WTF_SOURCES})
+INCLUDE_DIRECTORIES(${WTF_INCLUDE_DIRECTORIES})
+ADD_DEFINITIONS(-DBUILDING_WTF)
+ADD_LIBRARY(${WTF_LIBRARY_NAME} ${WTF_LIBRARY_TYPE} ${WTF_HEADERS} ${WTF_SOURCES})
+TARGET_LINK_LIBRARIES(${WTF_LIBRARY_NAME} ${WTF_LIBRARIES})
+
+IF (WTF_LINK_FLAGS)
+ ADD_TARGET_PROPERTIES(${WTF_LIBRARY_NAME} LINK_FLAGS "${WTF_LINK_FLAGS}")
+ENDIF ()
+
+IF (SHARED_CORE)
+ SET_TARGET_PROPERTIES(${WTF_LIBRARY_NAME} PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR})
+ INSTALL(TARGETS ${WTF_LIBRARY_NAME} DESTINATION lib)
+ENDIF ()
diff --git a/Source/JavaScriptCore/wtf/CMakeListsEfl.txt b/Source/JavaScriptCore/wtf/CMakeListsEfl.txt
new file mode 100644
index 0000000..e5d8bd7
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/CMakeListsEfl.txt
@@ -0,0 +1,46 @@
+IF (ENABLE_FAST_MALLOC)
+ LIST(APPEND WTF_SOURCES
+ TCSystemAlloc.cpp
+ )
+ELSE ()
+ ADD_DEFINITIONS(-DUSE_SYSTEM_MALLOC=1)
+ENDIF()
+
+LIST(APPEND WTF_SOURCES
+ efl/MainThreadEfl.cpp
+
+ ThreadIdentifierDataPthreads.cpp
+ ThreadingPthreads.cpp
+
+ unicode/icu/CollatorICU.cpp
+)
+
+IF (ENABLE_GLIB_SUPPORT)
+ LIST(APPEND WTF_SOURCES
+ gobject/GOwnPtr.cpp
+ gobject/GRefPtr.cpp
+ )
+
+ LIST(APPEND WTF_INCLUDE_DIRECTORIES
+ ${Glib_INCLUDE_DIRS}
+ ${JAVASCRIPTCORE_DIR}/wtf/gobject
+ )
+
+ LIST(APPEND WTF_LIBRARIES
+ ${Glib_LIBRARIES}
+ )
+ENDIF ()
+
+LIST(APPEND WTF_LIBRARIES
+ pthread
+ ${ICU_LIBRARIES}
+)
+
+LIST(APPEND WTF_LINK_FLAGS
+ ${ECORE_LDFLAGS}
+)
+
+LIST(APPEND WTF_INCLUDE_DIRECTORIES
+ ${ECORE_INCLUDE_DIRS}
+ ${JAVASCRIPTCORE_DIR}/wtf/unicode/
+)
diff --git a/Source/JavaScriptCore/wtf/CMakeListsWinCE.txt b/Source/JavaScriptCore/wtf/CMakeListsWinCE.txt
new file mode 100644
index 0000000..9c558eb
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/CMakeListsWinCE.txt
@@ -0,0 +1,27 @@
+LIST(APPEND WTF_HEADERS
+ unicode/wince/UnicodeWinCE.h
+
+ ${3RDPARTY_DIR}/ce-compat/ce_time.h
+ ${3RDPARTY_DIR}/ce-compat/ce_unicode.h
+)
+
+LIST(APPEND WTF_SOURCES
+ NullPtr.cpp
+ OSAllocatorWin.cpp
+ TCSystemAlloc.cpp
+ ThreadingWin.cpp
+ ThreadSpecificWin.cpp
+
+ unicode/CollatorDefault.cpp
+ unicode/wince/UnicodeWinCE.cpp
+
+ win/MainThreadWin.cpp
+ win/OwnPtrWin.cpp
+
+ ${3RDPARTY_DIR}/ce-compat/ce_time.c
+ ${3RDPARTY_DIR}/ce-compat/ce_unicode.cpp
+)
+
+LIST(APPEND WTF_LIBRARIES
+ mmtimer
+)
diff --git a/Source/JavaScriptCore/wtf/CONTRIBUTORS.pthreads-win32 b/Source/JavaScriptCore/wtf/CONTRIBUTORS.pthreads-win32
new file mode 100644
index 0000000..7de0f26
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/CONTRIBUTORS.pthreads-win32
@@ -0,0 +1,137 @@
+This is a copy of CONTRIBUTORS file for the Pthreads-win32 library, downloaded
+from http://sourceware.org/cgi-bin/cvsweb.cgi/~checkout~/pthreads/CONTRIBUTORS?rev=1.32&cvsroot=pthreads-win32
+
+Included here to compliment the Pthreads-win32 license header in wtf/ThreadingWin.cpp file.
+WebKit is using derived sources of ThreadCondition code from Pthreads-win32.
+
+-------------------------------------------------------------------------------
+
+Contributors (in approximate order of appearance)
+
+[See also the ChangeLog file where individuals are
+attributed in log entries. Likewise in the FAQ file.]
+
+Ben Elliston bje at cygnus dot com
+ Initiated the project;
+ setup the project infrastructure (CVS, web page, etc.);
+ early prototype routines.
+Ross Johnson rpj at callisto dot canberra dot edu dot au
+ early prototype routines;
+ ongoing project coordination/maintenance;
+ implementation of spin locks and barriers;
+ various enhancements;
+ bug fixes;
+ documentation;
+ testsuite.
+Robert Colquhoun rjc at trump dot net dot au
+ Early bug fixes.
+John E. Bossom John dot Bossom at cognos dot com
+ Contributed substantial original working implementation;
+ bug fixes;
+ ongoing guidance and standards interpretation.
+Anders Norlander anorland at hem2 dot passagen dot se
+ Early enhancements and runtime checking for supported
+ Win32 routines.
+Tor Lillqvist tml at iki dot fi
+ General enhancements;
+ early bug fixes to condition variables.
+Scott Lightner scott at curriculum dot com
+ Bug fix.
+Kevin Ruland Kevin dot Ruland at anheuser-busch dot com
+ Various bug fixes.
+Mike Russo miker at eai dot com
+ Bug fix.
+Mark E. Armstrong avail at pacbell dot net
+ Bug fixes.
+Lorin Hochstein lmh at xiphos dot ca
+ general bug fixes; bug fixes to condition variables.
+Peter Slacik Peter dot Slacik at tatramed dot sk
+ Bug fixes.
+Mumit Khan khan at xraylith dot wisc dot edu
+ Fixes to work with Mingw32.
+Milan Gardian mg at tatramed dot sk
+ Bug fixes and reports/analyses of obscure problems.
+Aurelio Medina aureliom at crt dot com
+ First implementation of read-write locks.
+Graham Dumpleton Graham dot Dumpleton at ra dot pad dot otc dot telstra dot com dot au
+ Bug fix in condition variables.
+Tristan Savatier tristan at mpegtv dot com
+ WinCE port.
+Erik Hensema erik at hensema dot xs4all dot nl
+ Bug fixes.
+Rich Peters rpeters at micro-magic dot com
+Todd Owen towen at lucidcalm dot dropbear dot id dot au
+ Bug fixes to dll loading.
+Jason Nye jnye at nbnet dot nb dot ca
+ Implementation of async cancelation.
+Fred Forester fforest at eticomm dot net
+Kevin D. Clark kclark at cabletron dot com
+David Baggett dmb at itasoftware dot com
+ Bug fixes.
+Paul Redondo paul at matchvision dot com
+Scott McCaskill scott at 3dfx dot com
+ Bug fixes.
+Jef Gearhart jgearhart at tpssys dot com
+ Bug fix.
+Arthur Kantor akantor at bexusa dot com
+ Mutex enhancements.
+Steven Reddie smr at essemer dot com dot au
+ Bug fix.
+Alexander Terekhov TEREKHOV at de dot ibm dot com
+ Re-implemented and improved read-write locks;
+ (with Louis Thomas) re-implemented and improved
+ condition variables;
+ enhancements to semaphores;
+ enhancements to mutexes;
+ new mutex implementation in 'futex' style;
+ suggested a robust implementation of pthread_once
+ similar to that implemented by V.Kliathcko;
+ system clock change handling re CV timeouts;
+ bug fixes.
+Thomas Pfaff tpfaff at gmx dot net
+ Changes to make C version usable with C++ applications;
+ re-implemented mutex routines to avoid Win32 mutexes
+ and TryEnterCriticalSection;
+ procedure to fix Mingw32 thread-safety issues.
+Franco Bez franco dot bez at gmx dot de
+ procedure to fix Mingw32 thread-safety issues.
+Louis Thomas lthomas at arbitrade dot com
+ (with Alexander Terekhov) re-implemented and improved
+ condition variables.
+David Korn dgk at research dot att dot com
+ Ported to UWIN.
+Phil Frisbie, Jr. phil at hawksoft dot com
+ Bug fix.
+Ralf Brese Ralf dot Brese at pdb4 dot siemens dot de
+ Bug fix.
+prionx at juno dot com prionx at juno dot com
+ Bug fixes.
+Max Woodbury mtew at cds dot duke dot edu
+ POSIX versioning conditionals;
+ reduced namespace pollution;
+ idea to separate routines to reduce statically
+ linked image sizes.
+Rob Fanner rfanner at stonethree dot com
+ Bug fix.
+Michael Johnson michaelj at maine dot rr dot com
+ Bug fix.
+Nicolas Barry boozai at yahoo dot com
+ Bug fixes.
+Piet van Bruggen pietvb at newbridges dot nl
+ Bug fix.
+Makoto Kato raven at oldskool dot jp
+ AMD64 port.
+Panagiotis E. Hadjidoukas peh at hpclab dot ceid dot upatras dot gr
+ Contributed the QueueUserAPCEx package which
+ makes preemptive async cancelation possible.
+Will Bryant will dot bryant at ecosm dot com
+ Borland compiler patch and makefile.
+Anuj Goyal anuj dot goyal at gmail dot com
+ Port to Digital Mars compiler.
+Gottlob Frege gottlobfrege at gmail dot com
+ re-implemented pthread_once (version 2)
+ (pthread_once cancellation added by rpj).
+Vladimir Kliatchko vladimir at kliatchko dot com
+ reimplemented pthread_once with the same form
+ as described by A.Terekhov (later version 2);
+ implementation of MCS (Mellor-Crummey/Scott) locks. \ No newline at end of file
diff --git a/Source/JavaScriptCore/wtf/Complex.h b/Source/JavaScriptCore/wtf/Complex.h
new file mode 100644
index 0000000..40fe56a
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/Complex.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WTF_Complex_h
+#define WTF_Complex_h
+
+#include <complex>
+#include <wtf/MathExtras.h>
+
+namespace WTF {
+
+typedef std::complex<double> Complex;
+
+inline Complex complexFromMagnitudePhase(double magnitude, double phase)
+{
+ return Complex(magnitude * cos(phase), magnitude * sin(phase));
+}
+
+} // namespace WTF
+
+using WTF::Complex;
+using WTF::complexFromMagnitudePhase;
+
+#endif // WTF_Complex_h
diff --git a/Source/JavaScriptCore/wtf/CrossThreadRefCounted.h b/Source/JavaScriptCore/wtf/CrossThreadRefCounted.h
new file mode 100644
index 0000000..0c0e997
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/CrossThreadRefCounted.h
@@ -0,0 +1,174 @@
+/*
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CrossThreadRefCounted_h
+#define CrossThreadRefCounted_h
+
+#include "PassRefPtr.h"
+#include "RefCounted.h"
+#include "Threading.h"
+
+namespace WTF {
+
+ // Used to allowing sharing data across classes and threads (like ThreadedSafeShared).
+ //
+ // Why not just use ThreadSafeShared?
+ // ThreadSafeShared can have a significant perf impact when used in low level classes
+ // (like UString) that get ref/deref'ed a lot. This class has the benefit of doing fast ref
+ // counts like RefPtr whenever possible, but it has the downside that you need to copy it
+ // to use it on another thread.
+ //
+ // Is this class threadsafe?
+ // While each instance of the class is not threadsafe, the copied instance is threadsafe
+ // with respect to the original and any other copies. The underlying m_data is jointly
+ // owned by the original instance and all copies.
+ template<class T>
+ class CrossThreadRefCounted : public Noncopyable {
+ public:
+ static PassRefPtr<CrossThreadRefCounted<T> > create(T* data)
+ {
+ return adoptRef(new CrossThreadRefCounted<T>(data, 0));
+ }
+
+ // Used to make an instance that can be used on another thread.
+ PassRefPtr<CrossThreadRefCounted<T> > crossThreadCopy();
+
+ void ref();
+ void deref();
+ T* release();
+
+ bool isShared() const
+ {
+ return !m_refCounter.hasOneRef() || (m_threadSafeRefCounter && !m_threadSafeRefCounter->hasOneRef());
+ }
+
+ private:
+ CrossThreadRefCounted(T* data, ThreadSafeSharedBase* threadedCounter)
+ : m_threadSafeRefCounter(threadedCounter)
+ , m_data(data)
+#ifndef NDEBUG
+ , m_threadId(0)
+#endif
+ {
+ // We use RefCountedBase in an unusual way here, so get rid of the requirement
+ // that adoptRef be called on it.
+ m_refCounter.relaxAdoptionRequirement();
+ }
+
+ ~CrossThreadRefCounted()
+ {
+ if (!m_threadSafeRefCounter)
+ delete m_data;
+ }
+
+ void threadSafeDeref();
+
+#ifndef NDEBUG
+ bool isOwnedByCurrentThread() const { return !m_threadId || m_threadId == currentThread(); }
+#endif
+
+ RefCountedBase m_refCounter;
+ ThreadSafeSharedBase* m_threadSafeRefCounter;
+ T* m_data;
+#ifndef NDEBUG
+ ThreadIdentifier m_threadId;
+#endif
+ };
+
+ template<class T>
+ void CrossThreadRefCounted<T>::ref()
+ {
+ ASSERT(isOwnedByCurrentThread());
+ m_refCounter.ref();
+#ifndef NDEBUG
+ // Store the threadId as soon as the ref count gets to 2.
+ // The class gets created with a ref count of 1 and then passed
+ // to another thread where to ref count get increased. This
+ // is a heuristic but it seems to always work and has helped
+ // find some bugs.
+ if (!m_threadId && m_refCounter.refCount() == 2)
+ m_threadId = currentThread();
+#endif
+ }
+
+ template<class T>
+ void CrossThreadRefCounted<T>::deref()
+ {
+ ASSERT(isOwnedByCurrentThread());
+ if (m_refCounter.derefBase()) {
+ threadSafeDeref();
+ delete this;
+ } else {
+#ifndef NDEBUG
+ // Clear the threadId when the ref goes to 1 because it
+ // is safe to be passed to another thread at this point.
+ if (m_threadId && m_refCounter.refCount() == 1)
+ m_threadId = 0;
+#endif
+ }
+ }
+
+ template<class T>
+ T* CrossThreadRefCounted<T>::release()
+ {
+ ASSERT(!isShared());
+
+ T* data = m_data;
+ m_data = 0;
+ return data;
+ }
+
+ template<class T>
+ PassRefPtr<CrossThreadRefCounted<T> > CrossThreadRefCounted<T>::crossThreadCopy()
+ {
+ ASSERT(isOwnedByCurrentThread());
+ if (m_threadSafeRefCounter)
+ m_threadSafeRefCounter->ref();
+ else
+ m_threadSafeRefCounter = new ThreadSafeSharedBase(2);
+
+ return adoptRef(new CrossThreadRefCounted<T>(m_data, m_threadSafeRefCounter));
+ }
+
+
+ template<class T>
+ void CrossThreadRefCounted<T>::threadSafeDeref()
+ {
+ if (m_threadSafeRefCounter && m_threadSafeRefCounter->derefBase()) {
+ delete m_threadSafeRefCounter;
+ m_threadSafeRefCounter = 0;
+ }
+ }
+} // namespace WTF
+
+using WTF::CrossThreadRefCounted;
+
+#endif // CrossThreadRefCounted_h
diff --git a/Source/JavaScriptCore/wtf/CurrentTime.cpp b/Source/JavaScriptCore/wtf/CurrentTime.cpp
new file mode 100644
index 0000000..56724cb
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/CurrentTime.cpp
@@ -0,0 +1,297 @@
+/*
+ * Copyright (C) 2006, 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2008 Google Inc. All rights reserved.
+ * Copyright (C) 2007-2009 Torch Mobile, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "CurrentTime.h"
+
+#if OS(WINDOWS)
+
+// Windows is first since we want to use hires timers, despite PLATFORM(CF)
+// being defined.
+// If defined, WIN32_LEAN_AND_MEAN disables timeBeginPeriod/timeEndPeriod.
+#undef WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#include <math.h>
+#include <stdint.h>
+#include <time.h>
+
+#if USE(QUERY_PERFORMANCE_COUNTER)
+#if OS(WINCE)
+extern "C" time_t mktime(struct tm *t);
+#else
+#include <sys/timeb.h>
+#include <sys/types.h>
+#endif
+#endif
+
+#elif PLATFORM(GTK)
+#include <glib.h>
+#elif PLATFORM(WX)
+#include <wx/datetime.h>
+#elif PLATFORM(BREWMP)
+#include <AEEStdLib.h>
+#else
+#include <sys/time.h>
+#endif
+
+#if PLATFORM(CHROMIUM)
+#error Chromium uses a different timer implementation
+#endif
+
+namespace WTF {
+
+const double msPerSecond = 1000.0;
+
+#if OS(WINDOWS)
+
+#if USE(QUERY_PERFORMANCE_COUNTER)
+
+static LARGE_INTEGER qpcFrequency;
+static bool syncedTime;
+
+static double highResUpTime()
+{
+ // We use QPC, but only after sanity checking its result, due to bugs:
+ // http://support.microsoft.com/kb/274323
+ // http://support.microsoft.com/kb/895980
+ // http://msdn.microsoft.com/en-us/library/ms644904.aspx ("...you can get different results on different processors due to bugs in the basic input/output system (BIOS) or the hardware abstraction layer (HAL)."
+
+ static LARGE_INTEGER qpcLast;
+ static DWORD tickCountLast;
+ static bool inited;
+
+ LARGE_INTEGER qpc;
+ QueryPerformanceCounter(&qpc);
+ DWORD tickCount = GetTickCount();
+
+ if (inited) {
+ __int64 qpcElapsed = ((qpc.QuadPart - qpcLast.QuadPart) * 1000) / qpcFrequency.QuadPart;
+ __int64 tickCountElapsed;
+ if (tickCount >= tickCountLast)
+ tickCountElapsed = (tickCount - tickCountLast);
+ else {
+#if COMPILER(MINGW)
+ __int64 tickCountLarge = tickCount + 0x100000000ULL;
+#else
+ __int64 tickCountLarge = tickCount + 0x100000000I64;
+#endif
+ tickCountElapsed = tickCountLarge - tickCountLast;
+ }
+
+ // force a re-sync if QueryPerformanceCounter differs from GetTickCount by more than 500ms.
+ // (500ms value is from http://support.microsoft.com/kb/274323)
+ __int64 diff = tickCountElapsed - qpcElapsed;
+ if (diff > 500 || diff < -500)
+ syncedTime = false;
+ } else
+ inited = true;
+
+ qpcLast = qpc;
+ tickCountLast = tickCount;
+
+ return (1000.0 * qpc.QuadPart) / static_cast<double>(qpcFrequency.QuadPart);
+}
+
+static double lowResUTCTime()
+{
+#if OS(WINCE)
+ SYSTEMTIME systemTime;
+ GetSystemTime(&systemTime);
+ struct tm tmtime;
+ tmtime.tm_year = systemTime.wYear - 1900;
+ tmtime.tm_mon = systemTime.wMonth - 1;
+ tmtime.tm_mday = systemTime.wDay;
+ tmtime.tm_wday = systemTime.wDayOfWeek;
+ tmtime.tm_hour = systemTime.wHour;
+ tmtime.tm_min = systemTime.wMinute;
+ tmtime.tm_sec = systemTime.wSecond;
+ time_t timet = mktime(&tmtime);
+ return timet * msPerSecond + systemTime.wMilliseconds;
+#else
+ struct _timeb timebuffer;
+ _ftime(&timebuffer);
+ return timebuffer.time * msPerSecond + timebuffer.millitm;
+#endif
+}
+
+static bool qpcAvailable()
+{
+ static bool available;
+ static bool checked;
+
+ if (checked)
+ return available;
+
+ available = QueryPerformanceFrequency(&qpcFrequency);
+ checked = true;
+ return available;
+}
+
+double currentTime()
+{
+ // Use a combination of ftime and QueryPerformanceCounter.
+ // ftime returns the information we want, but doesn't have sufficient resolution.
+ // QueryPerformanceCounter has high resolution, but is only usable to measure time intervals.
+ // To combine them, we call ftime and QueryPerformanceCounter initially. Later calls will use QueryPerformanceCounter
+ // by itself, adding the delta to the saved ftime. We periodically re-sync to correct for drift.
+ static double syncLowResUTCTime;
+ static double syncHighResUpTime;
+ static double lastUTCTime;
+
+ double lowResTime = lowResUTCTime();
+
+ if (!qpcAvailable())
+ return lowResTime / 1000.0;
+
+ double highResTime = highResUpTime();
+
+ if (!syncedTime) {
+ timeBeginPeriod(1); // increase time resolution around low-res time getter
+ syncLowResUTCTime = lowResTime = lowResUTCTime();
+ timeEndPeriod(1); // restore time resolution
+ syncHighResUpTime = highResTime;
+ syncedTime = true;
+ }
+
+ double highResElapsed = highResTime - syncHighResUpTime;
+ double utc = syncLowResUTCTime + highResElapsed;
+
+ // force a clock re-sync if we've drifted
+ double lowResElapsed = lowResTime - syncLowResUTCTime;
+ const double maximumAllowedDriftMsec = 15.625 * 2.0; // 2x the typical low-res accuracy
+ if (fabs(highResElapsed - lowResElapsed) > maximumAllowedDriftMsec)
+ syncedTime = false;
+
+ // make sure time doesn't run backwards (only correct if difference is < 2 seconds, since DST or clock changes could occur)
+ const double backwardTimeLimit = 2000.0;
+ if (utc < lastUTCTime && (lastUTCTime - utc) < backwardTimeLimit)
+ return lastUTCTime / 1000.0;
+ lastUTCTime = utc;
+ return utc / 1000.0;
+}
+
+#else
+
+static double currentSystemTime()
+{
+ FILETIME ft;
+ GetCurrentFT(&ft);
+
+ // As per Windows documentation for FILETIME, copy the resulting FILETIME structure to a
+ // ULARGE_INTEGER structure using memcpy (using memcpy instead of direct assignment can
+ // prevent alignment faults on 64-bit Windows).
+
+ ULARGE_INTEGER t;
+ memcpy(&t, &ft, sizeof(t));
+
+ // Windows file times are in 100s of nanoseconds.
+ // To convert to seconds, we have to divide by 10,000,000, which is more quickly
+ // done by multiplying by 0.0000001.
+
+ // Between January 1, 1601 and January 1, 1970, there were 369 complete years,
+ // of which 89 were leap years (1700, 1800, and 1900 were not leap years).
+ // That is a total of 134774 days, which is 11644473600 seconds.
+
+ return t.QuadPart * 0.0000001 - 11644473600.0;
+}
+
+double currentTime()
+{
+ static bool init = false;
+ static double lastTime;
+ static DWORD lastTickCount;
+ if (!init) {
+ lastTime = currentSystemTime();
+ lastTickCount = GetTickCount();
+ init = true;
+ return lastTime;
+ }
+
+ DWORD tickCountNow = GetTickCount();
+ DWORD elapsed = tickCountNow - lastTickCount;
+ double timeNow = lastTime + (double)elapsed / 1000.;
+ if (elapsed >= 0x7FFFFFFF) {
+ lastTime = timeNow;
+ lastTickCount = tickCountNow;
+ }
+ return timeNow;
+}
+
+#endif // USE(QUERY_PERFORMANCE_COUNTER)
+
+#elif PLATFORM(GTK)
+
+// Note: GTK on Windows will pick up the PLATFORM(WIN) implementation above which provides
+// better accuracy compared with Windows implementation of g_get_current_time:
+// (http://www.google.com/codesearch/p?hl=en#HHnNRjks1t0/glib-2.5.2/glib/gmain.c&q=g_get_current_time).
+// Non-Windows GTK builds could use gettimeofday() directly but for the sake of consistency lets use GTK function.
+double currentTime()
+{
+ GTimeVal now;
+ g_get_current_time(&now);
+ return static_cast<double>(now.tv_sec) + static_cast<double>(now.tv_usec / 1000000.0);
+}
+
+#elif PLATFORM(WX)
+
+double currentTime()
+{
+ wxDateTime now = wxDateTime::UNow();
+ return (double)now.GetTicks() + (double)(now.GetMillisecond() / 1000.0);
+}
+
+#elif PLATFORM(BREWMP)
+
+// GETUTCSECONDS returns the number of seconds since 1980/01/06 00:00:00 UTC,
+// and GETTIMEMS returns the number of milliseconds that have elapsed since the last
+// occurrence of 00:00:00 local time.
+// We can combine GETUTCSECONDS and GETTIMEMS to calculate the number of milliseconds
+// since 1970/01/01 00:00:00 UTC.
+double currentTime()
+{
+ // diffSeconds is the number of seconds from 1970/01/01 to 1980/01/06
+ const unsigned diffSeconds = 315964800;
+ return static_cast<double>(diffSeconds + GETUTCSECONDS() + ((GETTIMEMS() % 1000) / msPerSecond));
+}
+
+#else
+
+double currentTime()
+{
+ struct timeval now;
+ gettimeofday(&now, 0);
+ return now.tv_sec + now.tv_usec / 1000000.0;
+}
+
+#endif
+
+} // namespace WTF
diff --git a/Source/JavaScriptCore/wtf/CurrentTime.h b/Source/JavaScriptCore/wtf/CurrentTime.h
new file mode 100644
index 0000000..7119656
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/CurrentTime.h
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2008 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CurrentTime_h
+#define CurrentTime_h
+
+#include <time.h>
+
+namespace WTF {
+
+ // Returns the current UTC time in seconds, counted from January 1, 1970.
+ // Precision varies depending on platform but is usually as good or better
+ // than a millisecond.
+ double currentTime();
+
+ // Same thing, in milliseconds.
+ inline double currentTimeMS()
+ {
+ return currentTime() * 1000.0;
+ }
+
+ inline void getLocalTime(const time_t* localTime, struct tm* localTM)
+ {
+ #if COMPILER(MSVC7_OR_LOWER) || COMPILER(MINGW) || OS(WINCE)
+ *localTM = *localtime(localTime);
+ #elif COMPILER(MSVC)
+ localtime_s(localTM, localTime);
+ #else
+ localtime_r(localTime, localTM);
+ #endif
+ }
+
+} // namespace WTF
+
+using WTF::currentTime;
+using WTF::currentTimeMS;
+using WTF::getLocalTime;
+
+#endif // CurrentTime_h
+
diff --git a/Source/JavaScriptCore/wtf/DateMath.cpp b/Source/JavaScriptCore/wtf/DateMath.cpp
new file mode 100644
index 0000000..8873352
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/DateMath.cpp
@@ -0,0 +1,1154 @@
+/*
+ * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ * Copyright (C) 2007-2009 Torch Mobile, Inc.
+ * Copyright (C) 2010 &yet, LLC. (nate@andyet.net)
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Alternatively, the contents of this file may be used under the terms
+ * of either the Mozilla Public License Version 1.1, found at
+ * http://www.mozilla.org/MPL/ (the "MPL") or the GNU General Public
+ * License Version 2.0, found at http://www.fsf.org/copyleft/gpl.html
+ * (the "GPL"), in which case the provisions of the MPL or the GPL are
+ * applicable instead of those above. If you wish to allow use of your
+ * version of this file only under the terms of one of those two
+ * licenses (the MPL or the GPL) and not to allow others to use your
+ * version of this file under the LGPL, indicate your decision by
+ * deletingthe provisions above and replace them with the notice and
+ * other provisions required by the MPL or the GPL, as the case may be.
+ * If you do not delete the provisions above, a recipient may use your
+ * version of this file under any of the LGPL, the MPL or the GPL.
+
+ * Copyright 2006-2008 the V8 project authors. All rights reserved.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "DateMath.h"
+
+#include "Assertions.h"
+#include "ASCIICType.h"
+#include "CurrentTime.h"
+#include "MathExtras.h"
+#include "StdLibExtras.h"
+#include "StringExtras.h"
+
+#include <algorithm>
+#include <limits.h>
+#include <limits>
+#include <stdint.h>
+#include <time.h>
+
+
+#if HAVE(ERRNO_H)
+#include <errno.h>
+#endif
+
+#if OS(WINCE)
+extern "C" size_t strftime(char * const s, const size_t maxsize, const char * const format, const struct tm * const t);
+extern "C" struct tm * localtime(const time_t *timer);
+#endif
+
+#if HAVE(SYS_TIME_H)
+#include <sys/time.h>
+#endif
+
+#if HAVE(SYS_TIMEB_H)
+#include <sys/timeb.h>
+#endif
+
+#if USE(JSC)
+#include "CallFrame.h"
+#endif
+
+#define NaN std::numeric_limits<double>::quiet_NaN()
+
+using namespace WTF;
+
+namespace WTF {
+
+/* Constants */
+
+static const double minutesPerDay = 24.0 * 60.0;
+static const double secondsPerDay = 24.0 * 60.0 * 60.0;
+static const double secondsPerYear = 24.0 * 60.0 * 60.0 * 365.0;
+
+static const double usecPerSec = 1000000.0;
+
+static const double maxUnixTime = 2145859200.0; // 12/31/2037
+// ECMAScript asks not to support for a date of which total
+// millisecond value is larger than the following value.
+// See 15.9.1.14 of ECMA-262 5th edition.
+static const double maxECMAScriptTime = 8.64E15;
+
+// Day of year for the first day of each month, where index 0 is January, and day 0 is January 1.
+// First for non-leap years, then for leap years.
+static const int firstDayOfMonth[2][12] = {
+ {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334},
+ {0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335}
+};
+
+static inline bool isLeapYear(int year)
+{
+ if (year % 4 != 0)
+ return false;
+ if (year % 400 == 0)
+ return true;
+ if (year % 100 == 0)
+ return false;
+ return true;
+}
+
+static inline int daysInYear(int year)
+{
+ return 365 + isLeapYear(year);
+}
+
+static inline double daysFrom1970ToYear(int year)
+{
+ // The Gregorian Calendar rules for leap years:
+ // Every fourth year is a leap year. 2004, 2008, and 2012 are leap years.
+ // However, every hundredth year is not a leap year. 1900 and 2100 are not leap years.
+ // Every four hundred years, there's a leap year after all. 2000 and 2400 are leap years.
+
+ static const int leapDaysBefore1971By4Rule = 1970 / 4;
+ static const int excludedLeapDaysBefore1971By100Rule = 1970 / 100;
+ static const int leapDaysBefore1971By400Rule = 1970 / 400;
+
+ const double yearMinusOne = year - 1;
+ const double yearsToAddBy4Rule = floor(yearMinusOne / 4.0) - leapDaysBefore1971By4Rule;
+ const double yearsToExcludeBy100Rule = floor(yearMinusOne / 100.0) - excludedLeapDaysBefore1971By100Rule;
+ const double yearsToAddBy400Rule = floor(yearMinusOne / 400.0) - leapDaysBefore1971By400Rule;
+
+ return 365.0 * (year - 1970) + yearsToAddBy4Rule - yearsToExcludeBy100Rule + yearsToAddBy400Rule;
+}
+
+static inline double msToDays(double ms)
+{
+ return floor(ms / msPerDay);
+}
+
+int msToYear(double ms)
+{
+ int approxYear = static_cast<int>(floor(ms / (msPerDay * 365.2425)) + 1970);
+ double msFromApproxYearTo1970 = msPerDay * daysFrom1970ToYear(approxYear);
+ if (msFromApproxYearTo1970 > ms)
+ return approxYear - 1;
+ if (msFromApproxYearTo1970 + msPerDay * daysInYear(approxYear) <= ms)
+ return approxYear + 1;
+ return approxYear;
+}
+
+int dayInYear(double ms, int year)
+{
+ return static_cast<int>(msToDays(ms) - daysFrom1970ToYear(year));
+}
+
+static inline double msToMilliseconds(double ms)
+{
+ double result = fmod(ms, msPerDay);
+ if (result < 0)
+ result += msPerDay;
+ return result;
+}
+
+// 0: Sunday, 1: Monday, etc.
+static inline int msToWeekDay(double ms)
+{
+ int wd = (static_cast<int>(msToDays(ms)) + 4) % 7;
+ if (wd < 0)
+ wd += 7;
+ return wd;
+}
+
+static inline int msToSeconds(double ms)
+{
+ double result = fmod(floor(ms / msPerSecond), secondsPerMinute);
+ if (result < 0)
+ result += secondsPerMinute;
+ return static_cast<int>(result);
+}
+
+static inline int msToMinutes(double ms)
+{
+ double result = fmod(floor(ms / msPerMinute), minutesPerHour);
+ if (result < 0)
+ result += minutesPerHour;
+ return static_cast<int>(result);
+}
+
+static inline int msToHours(double ms)
+{
+ double result = fmod(floor(ms/msPerHour), hoursPerDay);
+ if (result < 0)
+ result += hoursPerDay;
+ return static_cast<int>(result);
+}
+
+int monthFromDayInYear(int dayInYear, bool leapYear)
+{
+ const int d = dayInYear;
+ int step;
+
+ if (d < (step = 31))
+ return 0;
+ step += (leapYear ? 29 : 28);
+ if (d < step)
+ return 1;
+ if (d < (step += 31))
+ return 2;
+ if (d < (step += 30))
+ return 3;
+ if (d < (step += 31))
+ return 4;
+ if (d < (step += 30))
+ return 5;
+ if (d < (step += 31))
+ return 6;
+ if (d < (step += 31))
+ return 7;
+ if (d < (step += 30))
+ return 8;
+ if (d < (step += 31))
+ return 9;
+ if (d < (step += 30))
+ return 10;
+ return 11;
+}
+
+static inline bool checkMonth(int dayInYear, int& startDayOfThisMonth, int& startDayOfNextMonth, int daysInThisMonth)
+{
+ startDayOfThisMonth = startDayOfNextMonth;
+ startDayOfNextMonth += daysInThisMonth;
+ return (dayInYear <= startDayOfNextMonth);
+}
+
+int dayInMonthFromDayInYear(int dayInYear, bool leapYear)
+{
+ const int d = dayInYear;
+ int step;
+ int next = 30;
+
+ if (d <= next)
+ return d + 1;
+ const int daysInFeb = (leapYear ? 29 : 28);
+ if (checkMonth(d, step, next, daysInFeb))
+ return d - step;
+ if (checkMonth(d, step, next, 31))
+ return d - step;
+ if (checkMonth(d, step, next, 30))
+ return d - step;
+ if (checkMonth(d, step, next, 31))
+ return d - step;
+ if (checkMonth(d, step, next, 30))
+ return d - step;
+ if (checkMonth(d, step, next, 31))
+ return d - step;
+ if (checkMonth(d, step, next, 31))
+ return d - step;
+ if (checkMonth(d, step, next, 30))
+ return d - step;
+ if (checkMonth(d, step, next, 31))
+ return d - step;
+ if (checkMonth(d, step, next, 30))
+ return d - step;
+ step = next;
+ return d - step;
+}
+
+static inline int monthToDayInYear(int month, bool isLeapYear)
+{
+ return firstDayOfMonth[isLeapYear][month];
+}
+
+static inline double timeToMS(double hour, double min, double sec, double ms)
+{
+ return (((hour * minutesPerHour + min) * secondsPerMinute + sec) * msPerSecond + ms);
+}
+
+double dateToDaysFrom1970(int year, int month, int day)
+{
+ year += month / 12;
+
+ month %= 12;
+ if (month < 0) {
+ month += 12;
+ --year;
+ }
+
+ double yearday = floor(daysFrom1970ToYear(year));
+ ASSERT((year >= 1970 && yearday >= 0) || (year < 1970 && yearday < 0));
+ int monthday = monthToDayInYear(month, isLeapYear(year));
+
+ return yearday + monthday + day - 1;
+}
+
+// There is a hard limit at 2038 that we currently do not have a workaround
+// for (rdar://problem/5052975).
+static inline int maximumYearForDST()
+{
+ return 2037;
+}
+
+static inline int minimumYearForDST()
+{
+ // Because of the 2038 issue (see maximumYearForDST) if the current year is
+ // greater than the max year minus 27 (2010), we want to use the max year
+ // minus 27 instead, to ensure there is a range of 28 years that all years
+ // can map to.
+ return std::min(msToYear(jsCurrentTime()), maximumYearForDST() - 27) ;
+}
+
+/*
+ * Find an equivalent year for the one given, where equivalence is deterined by
+ * the two years having the same leapness and the first day of the year, falling
+ * on the same day of the week.
+ *
+ * This function returns a year between this current year and 2037, however this
+ * function will potentially return incorrect results if the current year is after
+ * 2010, (rdar://problem/5052975), if the year passed in is before 1900 or after
+ * 2100, (rdar://problem/5055038).
+ */
+int equivalentYearForDST(int year)
+{
+ // It is ok if the cached year is not the current year as long as the rules
+ // for DST did not change between the two years; if they did the app would need
+ // to be restarted.
+ static int minYear = minimumYearForDST();
+ int maxYear = maximumYearForDST();
+
+ int difference;
+ if (year > maxYear)
+ difference = minYear - year;
+ else if (year < minYear)
+ difference = maxYear - year;
+ else
+ return year;
+
+ int quotient = difference / 28;
+ int product = (quotient) * 28;
+
+ year += product;
+ ASSERT((year >= minYear && year <= maxYear) || (product - year == static_cast<int>(NaN)));
+ return year;
+}
+
+int32_t calculateUTCOffset()
+{
+#if PLATFORM(BREWMP)
+ time_t localTime = static_cast<time_t>(currentTime());
+#else
+ time_t localTime = time(0);
+#endif
+ tm localt;
+ getLocalTime(&localTime, &localt);
+
+ // Get the difference between this time zone and UTC on the 1st of January of this year.
+ localt.tm_sec = 0;
+ localt.tm_min = 0;
+ localt.tm_hour = 0;
+ localt.tm_mday = 1;
+ localt.tm_mon = 0;
+ // Not setting localt.tm_year!
+ localt.tm_wday = 0;
+ localt.tm_yday = 0;
+ localt.tm_isdst = 0;
+#if HAVE(TM_GMTOFF)
+ localt.tm_gmtoff = 0;
+#endif
+#if HAVE(TM_ZONE)
+ localt.tm_zone = 0;
+#endif
+
+#if HAVE(TIMEGM)
+ time_t utcOffset = timegm(&localt) - mktime(&localt);
+#else
+ // Using a canned date of 01/01/2009 on platforms with weaker date-handling foo.
+ localt.tm_year = 109;
+ time_t utcOffset = 1230768000 - mktime(&localt);
+#endif
+
+ return static_cast<int32_t>(utcOffset * 1000);
+}
+
+/*
+ * Get the DST offset for the time passed in.
+ */
+static double calculateDSTOffsetSimple(double localTimeSeconds, double utcOffset)
+{
+ if (localTimeSeconds > maxUnixTime)
+ localTimeSeconds = maxUnixTime;
+ else if (localTimeSeconds < 0) // Go ahead a day to make localtime work (does not work with 0)
+ localTimeSeconds += secondsPerDay;
+
+ //input is UTC so we have to shift back to local time to determine DST thus the + getUTCOffset()
+ double offsetTime = (localTimeSeconds * msPerSecond) + utcOffset;
+
+ // Offset from UTC but doesn't include DST obviously
+ int offsetHour = msToHours(offsetTime);
+ int offsetMinute = msToMinutes(offsetTime);
+
+ // FIXME: time_t has a potential problem in 2038
+ time_t localTime = static_cast<time_t>(localTimeSeconds);
+
+ tm localTM;
+ getLocalTime(&localTime, &localTM);
+
+ double diff = ((localTM.tm_hour - offsetHour) * secondsPerHour) + ((localTM.tm_min - offsetMinute) * 60);
+
+ if (diff < 0)
+ diff += secondsPerDay;
+
+ return (diff * msPerSecond);
+}
+
+// Get the DST offset, given a time in UTC
+double calculateDSTOffset(double ms, double utcOffset)
+{
+ // On Mac OS X, the call to localtime (see calculateDSTOffsetSimple) will return historically accurate
+ // DST information (e.g. New Zealand did not have DST from 1946 to 1974) however the JavaScript
+ // standard explicitly dictates that historical information should not be considered when
+ // determining DST. For this reason we shift away from years that localtime can handle but would
+ // return historically accurate information.
+ int year = msToYear(ms);
+ int equivalentYear = equivalentYearForDST(year);
+ if (year != equivalentYear) {
+ bool leapYear = isLeapYear(year);
+ int dayInYearLocal = dayInYear(ms, year);
+ int dayInMonth = dayInMonthFromDayInYear(dayInYearLocal, leapYear);
+ int month = monthFromDayInYear(dayInYearLocal, leapYear);
+ double day = dateToDaysFrom1970(equivalentYear, month, dayInMonth);
+ ms = (day * msPerDay) + msToMilliseconds(ms);
+ }
+
+ return calculateDSTOffsetSimple(ms / msPerSecond, utcOffset);
+}
+
+void initializeDates()
+{
+#ifndef NDEBUG
+ static bool alreadyInitialized;
+ ASSERT(!alreadyInitialized);
+ alreadyInitialized = true;
+#endif
+
+ equivalentYearForDST(2000); // Need to call once to initialize a static used in this function.
+}
+
+static inline double ymdhmsToSeconds(long year, int mon, int day, int hour, int minute, double second)
+{
+ double days = (day - 32075)
+ + floor(1461 * (year + 4800.0 + (mon - 14) / 12) / 4)
+ + 367 * (mon - 2 - (mon - 14) / 12 * 12) / 12
+ - floor(3 * ((year + 4900.0 + (mon - 14) / 12) / 100) / 4)
+ - 2440588;
+ return ((days * hoursPerDay + hour) * minutesPerHour + minute) * secondsPerMinute + second;
+}
+
+// We follow the recommendation of RFC 2822 to consider all
+// obsolete time zones not listed here equivalent to "-0000".
+static const struct KnownZone {
+#if !OS(WINDOWS)
+ const
+#endif
+ char tzName[4];
+ int tzOffset;
+} known_zones[] = {
+ { "UT", 0 },
+ { "GMT", 0 },
+ { "EST", -300 },
+ { "EDT", -240 },
+ { "CST", -360 },
+ { "CDT", -300 },
+ { "MST", -420 },
+ { "MDT", -360 },
+ { "PST", -480 },
+ { "PDT", -420 }
+};
+
+inline static void skipSpacesAndComments(const char*& s)
+{
+ int nesting = 0;
+ char ch;
+ while ((ch = *s)) {
+ if (!isASCIISpace(ch)) {
+ if (ch == '(')
+ nesting++;
+ else if (ch == ')' && nesting > 0)
+ nesting--;
+ else if (nesting == 0)
+ break;
+ }
+ s++;
+ }
+}
+
+// returns 0-11 (Jan-Dec); -1 on failure
+static int findMonth(const char* monthStr)
+{
+ ASSERT(monthStr);
+ char needle[4];
+ for (int i = 0; i < 3; ++i) {
+ if (!*monthStr)
+ return -1;
+ needle[i] = static_cast<char>(toASCIILower(*monthStr++));
+ }
+ needle[3] = '\0';
+ const char *haystack = "janfebmaraprmayjunjulaugsepoctnovdec";
+ const char *str = strstr(haystack, needle);
+ if (str) {
+ int position = static_cast<int>(str - haystack);
+ if (position % 3 == 0)
+ return position / 3;
+ }
+ return -1;
+}
+
+static bool parseLong(const char* string, char** stopPosition, int base, long* result)
+{
+ *result = strtol(string, stopPosition, base);
+ // Avoid the use of errno as it is not available on Windows CE
+ if (string == *stopPosition || *result == LONG_MIN || *result == LONG_MAX)
+ return false;
+ return true;
+}
+
+double parseES5DateFromNullTerminatedCharacters(const char* dateString)
+{
+ // This parses a date of the form defined in ECMA-262-5, section 15.9.1.15
+ // (similar to RFC 3339 / ISO 8601: YYYY-MM-DDTHH:mm:ss[.sss]Z).
+ // In most cases it is intentionally strict (e.g. correct field widths, no stray whitespace).
+
+ static const long daysPerMonth[12] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
+
+ const char* currentPosition = dateString;
+ char* postParsePosition;
+
+ // This is a bit more lenient on the year string than ES5 specifies:
+ // instead of restricting to 4 digits (or 6 digits with mandatory +/-),
+ // it accepts any integer value. Consider this an implementation fallback.
+ long year;
+ if (!parseLong(currentPosition, &postParsePosition, 10, &year))
+ return NaN;
+ if (*postParsePosition != '-')
+ return NaN;
+ currentPosition = postParsePosition + 1;
+
+ long month;
+ if (!isASCIIDigit(*currentPosition))
+ return NaN;
+ if (!parseLong(currentPosition, &postParsePosition, 10, &month))
+ return NaN;
+ if (*postParsePosition != '-' || (postParsePosition - currentPosition) != 2)
+ return NaN;
+ currentPosition = postParsePosition + 1;
+
+ long day;
+ if (!isASCIIDigit(*currentPosition))
+ return NaN;
+ if (!parseLong(currentPosition, &postParsePosition, 10, &day))
+ return NaN;
+ if (*postParsePosition != 'T' || (postParsePosition - currentPosition) != 2)
+ return NaN;
+ currentPosition = postParsePosition + 1;
+
+ long hours;
+ if (!isASCIIDigit(*currentPosition))
+ return NaN;
+ if (!parseLong(currentPosition, &postParsePosition, 10, &hours))
+ return NaN;
+ if (*postParsePosition != ':' || (postParsePosition - currentPosition) != 2)
+ return NaN;
+ currentPosition = postParsePosition + 1;
+
+ long minutes;
+ if (!isASCIIDigit(*currentPosition))
+ return NaN;
+ if (!parseLong(currentPosition, &postParsePosition, 10, &minutes))
+ return NaN;
+ if (*postParsePosition != ':' || (postParsePosition - currentPosition) != 2)
+ return NaN;
+ currentPosition = postParsePosition + 1;
+
+ long intSeconds;
+ if (!isASCIIDigit(*currentPosition))
+ return NaN;
+ if (!parseLong(currentPosition, &postParsePosition, 10, &intSeconds))
+ return NaN;
+ if ((postParsePosition - currentPosition) != 2)
+ return NaN;
+
+ double seconds = intSeconds;
+ if (*postParsePosition == '.') {
+ currentPosition = postParsePosition + 1;
+
+ // In ECMA-262-5 it's a bit unclear if '.' can be present without milliseconds, but
+ // a reasonable interpretation guided by the given examples and RFC 3339 says "no".
+ // We check the next character to avoid reading +/- timezone hours after an invalid decimal.
+ if (!isASCIIDigit(*currentPosition))
+ return NaN;
+
+ // We are more lenient than ES5 by accepting more or less than 3 fraction digits.
+ long fracSeconds;
+ if (!parseLong(currentPosition, &postParsePosition, 10, &fracSeconds))
+ return NaN;
+
+ long numFracDigits = postParsePosition - currentPosition;
+ seconds += fracSeconds * pow(10.0, static_cast<double>(-numFracDigits));
+ }
+ currentPosition = postParsePosition;
+
+ // A few of these checks could be done inline above, but since many of them are interrelated
+ // we would be sacrificing readability to "optimize" the (presumably less common) failure path.
+ if (month < 1 || month > 12)
+ return NaN;
+ if (day < 1 || day > daysPerMonth[month - 1])
+ return NaN;
+ if (month == 2 && day > 28 && !isLeapYear(year))
+ return NaN;
+ if (hours < 0 || hours > 24)
+ return NaN;
+ if (hours == 24 && (minutes || seconds))
+ return NaN;
+ if (minutes < 0 || minutes > 59)
+ return NaN;
+ if (seconds < 0 || seconds >= 61)
+ return NaN;
+ if (seconds > 60) {
+ // Discard leap seconds by clamping to the end of a minute.
+ seconds = 60;
+ }
+
+ long timeZoneSeconds = 0;
+ if (*currentPosition != 'Z') {
+ bool tzNegative;
+ if (*currentPosition == '-')
+ tzNegative = true;
+ else if (*currentPosition == '+')
+ tzNegative = false;
+ else
+ return NaN;
+ currentPosition += 1;
+
+ long tzHours;
+ long tzHoursAbs;
+ long tzMinutes;
+
+ if (!isASCIIDigit(*currentPosition))
+ return NaN;
+ if (!parseLong(currentPosition, &postParsePosition, 10, &tzHours))
+ return NaN;
+ if (*postParsePosition != ':' || (postParsePosition - currentPosition) != 2)
+ return NaN;
+ tzHoursAbs = abs(tzHours);
+ currentPosition = postParsePosition + 1;
+
+ if (!isASCIIDigit(*currentPosition))
+ return NaN;
+ if (!parseLong(currentPosition, &postParsePosition, 10, &tzMinutes))
+ return NaN;
+ if ((postParsePosition - currentPosition) != 2)
+ return NaN;
+ currentPosition = postParsePosition;
+
+ if (tzHoursAbs > 24)
+ return NaN;
+ if (tzMinutes < 0 || tzMinutes > 59)
+ return NaN;
+
+ timeZoneSeconds = 60 * (tzMinutes + (60 * tzHoursAbs));
+ if (tzNegative)
+ timeZoneSeconds = -timeZoneSeconds;
+ } else {
+ currentPosition += 1;
+ }
+ if (*currentPosition)
+ return NaN;
+
+ double dateSeconds = ymdhmsToSeconds(year, month, day, hours, minutes, seconds) - timeZoneSeconds;
+ return dateSeconds * msPerSecond;
+}
+
+// Odd case where 'exec' is allowed to be 0, to accomodate a caller in WebCore.
+static double parseDateFromNullTerminatedCharacters(const char* dateString, bool& haveTZ, int& offset)
+{
+ haveTZ = false;
+ offset = 0;
+
+ // This parses a date in the form:
+ // Tuesday, 09-Nov-99 23:12:40 GMT
+ // or
+ // Sat, 01-Jan-2000 08:00:00 GMT
+ // or
+ // Sat, 01 Jan 2000 08:00:00 GMT
+ // or
+ // 01 Jan 99 22:00 +0100 (exceptions in rfc822/rfc2822)
+ // ### non RFC formats, added for Javascript:
+ // [Wednesday] January 09 1999 23:12:40 GMT
+ // [Wednesday] January 09 23:12:40 GMT 1999
+ //
+ // We ignore the weekday.
+
+ // Skip leading space
+ skipSpacesAndComments(dateString);
+
+ long month = -1;
+ const char *wordStart = dateString;
+ // Check contents of first words if not number
+ while (*dateString && !isASCIIDigit(*dateString)) {
+ if (isASCIISpace(*dateString) || *dateString == '(') {
+ if (dateString - wordStart >= 3)
+ month = findMonth(wordStart);
+ skipSpacesAndComments(dateString);
+ wordStart = dateString;
+ } else
+ dateString++;
+ }
+
+ // Missing delimiter between month and day (like "January29")?
+ if (month == -1 && wordStart != dateString)
+ month = findMonth(wordStart);
+
+ skipSpacesAndComments(dateString);
+
+ if (!*dateString)
+ return NaN;
+
+ // ' 09-Nov-99 23:12:40 GMT'
+ char* newPosStr;
+ long day;
+ if (!parseLong(dateString, &newPosStr, 10, &day))
+ return NaN;
+ dateString = newPosStr;
+
+ if (!*dateString)
+ return NaN;
+
+ if (day < 0)
+ return NaN;
+
+ long year = 0;
+ if (day > 31) {
+ // ### where is the boundary and what happens below?
+ if (*dateString != '/')
+ return NaN;
+ // looks like a YYYY/MM/DD date
+ if (!*++dateString)
+ return NaN;
+ year = day;
+ if (!parseLong(dateString, &newPosStr, 10, &month))
+ return NaN;
+ month -= 1;
+ dateString = newPosStr;
+ if (*dateString++ != '/' || !*dateString)
+ return NaN;
+ if (!parseLong(dateString, &newPosStr, 10, &day))
+ return NaN;
+ dateString = newPosStr;
+ } else if (*dateString == '/' && month == -1) {
+ dateString++;
+ // This looks like a MM/DD/YYYY date, not an RFC date.
+ month = day - 1; // 0-based
+ if (!parseLong(dateString, &newPosStr, 10, &day))
+ return NaN;
+ if (day < 1 || day > 31)
+ return NaN;
+ dateString = newPosStr;
+ if (*dateString == '/')
+ dateString++;
+ if (!*dateString)
+ return NaN;
+ } else {
+ if (*dateString == '-')
+ dateString++;
+
+ skipSpacesAndComments(dateString);
+
+ if (*dateString == ',')
+ dateString++;
+
+ if (month == -1) { // not found yet
+ month = findMonth(dateString);
+ if (month == -1)
+ return NaN;
+
+ while (*dateString && *dateString != '-' && *dateString != ',' && !isASCIISpace(*dateString))
+ dateString++;
+
+ if (!*dateString)
+ return NaN;
+
+ // '-99 23:12:40 GMT'
+ if (*dateString != '-' && *dateString != '/' && *dateString != ',' && !isASCIISpace(*dateString))
+ return NaN;
+ dateString++;
+ }
+ }
+
+ if (month < 0 || month > 11)
+ return NaN;
+
+ // '99 23:12:40 GMT'
+ if (year <= 0 && *dateString) {
+ if (!parseLong(dateString, &newPosStr, 10, &year))
+ return NaN;
+ }
+
+ // Don't fail if the time is missing.
+ long hour = 0;
+ long minute = 0;
+ long second = 0;
+ if (!*newPosStr)
+ dateString = newPosStr;
+ else {
+ // ' 23:12:40 GMT'
+ if (!(isASCIISpace(*newPosStr) || *newPosStr == ',')) {
+ if (*newPosStr != ':')
+ return NaN;
+ // There was no year; the number was the hour.
+ year = -1;
+ } else {
+ // in the normal case (we parsed the year), advance to the next number
+ dateString = ++newPosStr;
+ skipSpacesAndComments(dateString);
+ }
+
+ parseLong(dateString, &newPosStr, 10, &hour);
+ // Do not check for errno here since we want to continue
+ // even if errno was set becasue we are still looking
+ // for the timezone!
+
+ // Read a number? If not, this might be a timezone name.
+ if (newPosStr != dateString) {
+ dateString = newPosStr;
+
+ if (hour < 0 || hour > 23)
+ return NaN;
+
+ if (!*dateString)
+ return NaN;
+
+ // ':12:40 GMT'
+ if (*dateString++ != ':')
+ return NaN;
+
+ if (!parseLong(dateString, &newPosStr, 10, &minute))
+ return NaN;
+ dateString = newPosStr;
+
+ if (minute < 0 || minute > 59)
+ return NaN;
+
+ // ':40 GMT'
+ if (*dateString && *dateString != ':' && !isASCIISpace(*dateString))
+ return NaN;
+
+ // seconds are optional in rfc822 + rfc2822
+ if (*dateString ==':') {
+ dateString++;
+
+ if (!parseLong(dateString, &newPosStr, 10, &second))
+ return NaN;
+ dateString = newPosStr;
+
+ if (second < 0 || second > 59)
+ return NaN;
+ }
+
+ skipSpacesAndComments(dateString);
+
+ if (strncasecmp(dateString, "AM", 2) == 0) {
+ if (hour > 12)
+ return NaN;
+ if (hour == 12)
+ hour = 0;
+ dateString += 2;
+ skipSpacesAndComments(dateString);
+ } else if (strncasecmp(dateString, "PM", 2) == 0) {
+ if (hour > 12)
+ return NaN;
+ if (hour != 12)
+ hour += 12;
+ dateString += 2;
+ skipSpacesAndComments(dateString);
+ }
+ }
+ }
+
+ // Don't fail if the time zone is missing.
+ // Some websites omit the time zone (4275206).
+ if (*dateString) {
+ if (strncasecmp(dateString, "GMT", 3) == 0 || strncasecmp(dateString, "UTC", 3) == 0) {
+ dateString += 3;
+ haveTZ = true;
+ }
+
+ if (*dateString == '+' || *dateString == '-') {
+ long o;
+ if (!parseLong(dateString, &newPosStr, 10, &o))
+ return NaN;
+ dateString = newPosStr;
+
+ if (o < -9959 || o > 9959)
+ return NaN;
+
+ int sgn = (o < 0) ? -1 : 1;
+ o = labs(o);
+ if (*dateString != ':') {
+ offset = ((o / 100) * 60 + (o % 100)) * sgn;
+ } else { // GMT+05:00
+ long o2;
+ if (!parseLong(dateString, &newPosStr, 10, &o2))
+ return NaN;
+ dateString = newPosStr;
+ offset = (o * 60 + o2) * sgn;
+ }
+ haveTZ = true;
+ } else {
+ for (size_t i = 0; i < WTF_ARRAY_LENGTH(known_zones); ++i) {
+ if (0 == strncasecmp(dateString, known_zones[i].tzName, strlen(known_zones[i].tzName))) {
+ offset = known_zones[i].tzOffset;
+ dateString += strlen(known_zones[i].tzName);
+ haveTZ = true;
+ break;
+ }
+ }
+ }
+ }
+
+ skipSpacesAndComments(dateString);
+
+ if (*dateString && year == -1) {
+ if (!parseLong(dateString, &newPosStr, 10, &year))
+ return NaN;
+ dateString = newPosStr;
+ }
+
+ skipSpacesAndComments(dateString);
+
+ // Trailing garbage
+ if (*dateString)
+ return NaN;
+
+ // Y2K: Handle 2 digit years.
+ if (year >= 0 && year < 100) {
+ if (year < 50)
+ year += 2000;
+ else
+ year += 1900;
+ }
+
+ return ymdhmsToSeconds(year, month + 1, day, hour, minute, second) * msPerSecond;
+}
+
+double parseDateFromNullTerminatedCharacters(const char* dateString)
+{
+ bool haveTZ;
+ int offset;
+ double ms = parseDateFromNullTerminatedCharacters(dateString, haveTZ, offset);
+ if (isnan(ms))
+ return NaN;
+
+ // fall back to local timezone
+ if (!haveTZ) {
+ double utcOffset = calculateUTCOffset();
+ double dstOffset = calculateDSTOffset(ms, utcOffset);
+ offset = static_cast<int>((utcOffset + dstOffset) / msPerMinute);
+ }
+ return ms - (offset * msPerMinute);
+}
+
+double timeClip(double t)
+{
+ if (!isfinite(t))
+ return NaN;
+ if (fabs(t) > maxECMAScriptTime)
+ return NaN;
+ return trunc(t);
+}
+} // namespace WTF
+
+#if USE(JSC)
+namespace JSC {
+
+// Get the DST offset for the time passed in.
+//
+// NOTE: The implementation relies on the fact that no time zones have
+// more than one daylight savings offset change per month.
+// If this function is called with NaN it returns NaN.
+static double getDSTOffset(ExecState* exec, double ms, double utcOffset)
+{
+ DSTOffsetCache& cache = exec->globalData().dstOffsetCache;
+ double start = cache.start;
+ double end = cache.end;
+
+ if (start <= ms) {
+ // If the time fits in the cached interval, return the cached offset.
+ if (ms <= end) return cache.offset;
+
+ // Compute a possible new interval end.
+ double newEnd = end + cache.increment;
+
+ if (ms <= newEnd) {
+ double endOffset = calculateDSTOffset(newEnd, utcOffset);
+ if (cache.offset == endOffset) {
+ // If the offset at the end of the new interval still matches
+ // the offset in the cache, we grow the cached time interval
+ // and return the offset.
+ cache.end = newEnd;
+ cache.increment = msPerMonth;
+ return endOffset;
+ } else {
+ double offset = calculateDSTOffset(ms, utcOffset);
+ if (offset == endOffset) {
+ // The offset at the given time is equal to the offset at the
+ // new end of the interval, so that means that we've just skipped
+ // the point in time where the DST offset change occurred. Updated
+ // the interval to reflect this and reset the increment.
+ cache.start = ms;
+ cache.end = newEnd;
+ cache.increment = msPerMonth;
+ } else {
+ // The interval contains a DST offset change and the given time is
+ // before it. Adjust the increment to avoid a linear search for
+ // the offset change point and change the end of the interval.
+ cache.increment /= 3;
+ cache.end = ms;
+ }
+ // Update the offset in the cache and return it.
+ cache.offset = offset;
+ return offset;
+ }
+ }
+ }
+
+ // Compute the DST offset for the time and shrink the cache interval
+ // to only contain the time. This allows fast repeated DST offset
+ // computations for the same time.
+ double offset = calculateDSTOffset(ms, utcOffset);
+ cache.offset = offset;
+ cache.start = ms;
+ cache.end = ms;
+ cache.increment = msPerMonth;
+ return offset;
+}
+
+/*
+ * Get the difference in milliseconds between this time zone and UTC (GMT)
+ * NOT including DST.
+ */
+double getUTCOffset(ExecState* exec)
+{
+ double utcOffset = exec->globalData().cachedUTCOffset;
+ if (!isnan(utcOffset))
+ return utcOffset;
+ exec->globalData().cachedUTCOffset = calculateUTCOffset();
+ return exec->globalData().cachedUTCOffset;
+}
+
+double gregorianDateTimeToMS(ExecState* exec, const GregorianDateTime& t, double milliSeconds, bool inputIsUTC)
+{
+ double day = dateToDaysFrom1970(t.year + 1900, t.month, t.monthDay);
+ double ms = timeToMS(t.hour, t.minute, t.second, milliSeconds);
+ double result = (day * WTF::msPerDay) + ms;
+
+ if (!inputIsUTC) { // convert to UTC
+ double utcOffset = getUTCOffset(exec);
+ result -= utcOffset;
+ result -= getDSTOffset(exec, result, utcOffset);
+ }
+
+ return result;
+}
+
+// input is UTC
+void msToGregorianDateTime(ExecState* exec, double ms, bool outputIsUTC, GregorianDateTime& tm)
+{
+ double dstOff = 0.0;
+ double utcOff = 0.0;
+ if (!outputIsUTC) {
+ utcOff = getUTCOffset(exec);
+ dstOff = getDSTOffset(exec, ms, utcOff);
+ ms += dstOff + utcOff;
+ }
+
+ const int year = msToYear(ms);
+ tm.second = msToSeconds(ms);
+ tm.minute = msToMinutes(ms);
+ tm.hour = msToHours(ms);
+ tm.weekDay = msToWeekDay(ms);
+ tm.yearDay = dayInYear(ms, year);
+ tm.monthDay = dayInMonthFromDayInYear(tm.yearDay, isLeapYear(year));
+ tm.month = monthFromDayInYear(tm.yearDay, isLeapYear(year));
+ tm.year = year - 1900;
+ tm.isDST = dstOff != 0.0;
+ tm.utcOffset = static_cast<long>((dstOff + utcOff) / WTF::msPerSecond);
+ tm.timeZone = nullptr;
+}
+
+double parseDateFromNullTerminatedCharacters(ExecState* exec, const char* dateString)
+{
+ ASSERT(exec);
+ bool haveTZ;
+ int offset;
+ double ms = WTF::parseDateFromNullTerminatedCharacters(dateString, haveTZ, offset);
+ if (isnan(ms))
+ return NaN;
+
+ // fall back to local timezone
+ if (!haveTZ) {
+ double utcOffset = getUTCOffset(exec);
+ double dstOffset = getDSTOffset(exec, ms, utcOffset);
+ offset = static_cast<int>((utcOffset + dstOffset) / WTF::msPerMinute);
+ }
+ return ms - (offset * WTF::msPerMinute);
+}
+
+} // namespace JSC
+#endif // USE(JSC)
diff --git a/Source/JavaScriptCore/wtf/DateMath.h b/Source/JavaScriptCore/wtf/DateMath.h
new file mode 100644
index 0000000..8d0d932
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/DateMath.h
@@ -0,0 +1,231 @@
+/*
+ * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ * Copyright (C) 2010 Research In Motion Limited. All rights reserved.
+ *
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either of the GNU General Public License Version 2 or later (the "GPL"),
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ */
+
+#ifndef DateMath_h
+#define DateMath_h
+
+#include <math.h>
+#include <string.h>
+#include <time.h>
+#include <wtf/CurrentTime.h>
+#include <wtf/Noncopyable.h>
+#include <wtf/OwnArrayPtr.h>
+#include <wtf/PassOwnArrayPtr.h>
+#include <wtf/UnusedParam.h>
+
+namespace WTF {
+void initializeDates();
+int equivalentYearForDST(int year);
+
+// Not really math related, but this is currently the only shared place to put these.
+double parseES5DateFromNullTerminatedCharacters(const char* dateString);
+double parseDateFromNullTerminatedCharacters(const char* dateString);
+double timeClip(double);
+
+inline double jsCurrentTime()
+{
+ // JavaScript doesn't recognize fractions of a millisecond.
+ return floor(WTF::currentTimeMS());
+}
+
+const char * const weekdayName[7] = { "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun" };
+const char * const monthName[12] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
+
+const double hoursPerDay = 24.0;
+const double minutesPerHour = 60.0;
+const double secondsPerHour = 60.0 * 60.0;
+const double secondsPerMinute = 60.0;
+const double msPerSecond = 1000.0;
+const double msPerMinute = 60.0 * 1000.0;
+const double msPerHour = 60.0 * 60.0 * 1000.0;
+const double msPerDay = 24.0 * 60.0 * 60.0 * 1000.0;
+const double msPerMonth = 2592000000.0;
+
+// Returns the number of days from 1970-01-01 to the specified date.
+double dateToDaysFrom1970(int year, int month, int day);
+int msToYear(double ms);
+int dayInYear(double ms, int year);
+int monthFromDayInYear(int dayInYear, bool leapYear);
+int dayInMonthFromDayInYear(int dayInYear, bool leapYear);
+
+// Returns offset milliseconds for UTC and DST.
+int32_t calculateUTCOffset();
+double calculateDSTOffset(double ms, double utcOffset);
+
+} // namespace WTF
+
+using WTF::adoptArrayPtr;
+using WTF::dateToDaysFrom1970;
+using WTF::dayInMonthFromDayInYear;
+using WTF::dayInYear;
+using WTF::minutesPerHour;
+using WTF::monthFromDayInYear;
+using WTF::msPerDay;
+using WTF::msPerMinute;
+using WTF::msPerSecond;
+using WTF::msToYear;
+using WTF::secondsPerMinute;
+using WTF::parseDateFromNullTerminatedCharacters;
+using WTF::calculateUTCOffset;
+using WTF::calculateDSTOffset;
+
+#if USE(JSC)
+namespace JSC {
+class ExecState;
+struct GregorianDateTime;
+
+void msToGregorianDateTime(ExecState*, double, bool outputIsUTC, GregorianDateTime&);
+double gregorianDateTimeToMS(ExecState*, const GregorianDateTime&, double, bool inputIsUTC);
+double getUTCOffset(ExecState*);
+double parseDateFromNullTerminatedCharacters(ExecState*, const char* dateString);
+
+// Intentionally overridding the default tm of the system.
+// The members of tm differ on various operating systems.
+struct GregorianDateTime : Noncopyable {
+ GregorianDateTime()
+ : second(0)
+ , minute(0)
+ , hour(0)
+ , weekDay(0)
+ , monthDay(0)
+ , yearDay(0)
+ , month(0)
+ , year(0)
+ , isDST(0)
+ , utcOffset(0)
+ , timeZone(0)
+ {
+ }
+
+ GregorianDateTime(ExecState* exec, const tm& inTm)
+ : second(inTm.tm_sec)
+ , minute(inTm.tm_min)
+ , hour(inTm.tm_hour)
+ , weekDay(inTm.tm_wday)
+ , monthDay(inTm.tm_mday)
+ , yearDay(inTm.tm_yday)
+ , month(inTm.tm_mon)
+ , year(inTm.tm_year)
+ , isDST(inTm.tm_isdst)
+ {
+ UNUSED_PARAM(exec);
+#if HAVE(TM_GMTOFF)
+ utcOffset = static_cast<int>(inTm.tm_gmtoff);
+#else
+ utcOffset = static_cast<int>(getUTCOffset(exec) / WTF::msPerSecond + (isDST ? WTF::secondsPerHour : 0));
+#endif
+
+#if HAVE(TM_ZONE)
+ int inZoneSize = strlen(inTm.tm_zone) + 1;
+ timeZone = adoptArrayPtr(new char[inZoneSize]);
+ strncpy(timeZone.get(), inTm.tm_zone, inZoneSize);
+#else
+ timeZone = nullptr;
+#endif
+ }
+
+ operator tm() const
+ {
+ tm ret;
+ memset(&ret, 0, sizeof(ret));
+
+ ret.tm_sec = second;
+ ret.tm_min = minute;
+ ret.tm_hour = hour;
+ ret.tm_wday = weekDay;
+ ret.tm_mday = monthDay;
+ ret.tm_yday = yearDay;
+ ret.tm_mon = month;
+ ret.tm_year = year;
+ ret.tm_isdst = isDST;
+
+#if HAVE(TM_GMTOFF)
+ ret.tm_gmtoff = static_cast<long>(utcOffset);
+#endif
+#if HAVE(TM_ZONE)
+ ret.tm_zone = timeZone.get();
+#endif
+
+ return ret;
+ }
+
+ void copyFrom(const GregorianDateTime& rhs)
+ {
+ second = rhs.second;
+ minute = rhs.minute;
+ hour = rhs.hour;
+ weekDay = rhs.weekDay;
+ monthDay = rhs.monthDay;
+ yearDay = rhs.yearDay;
+ month = rhs.month;
+ year = rhs.year;
+ isDST = rhs.isDST;
+ utcOffset = rhs.utcOffset;
+ if (rhs.timeZone) {
+ int inZoneSize = strlen(rhs.timeZone.get()) + 1;
+ timeZone = adoptArrayPtr(new char[inZoneSize]);
+ strncpy(timeZone.get(), rhs.timeZone.get(), inZoneSize);
+ } else
+ timeZone = nullptr;
+ }
+
+ int second;
+ int minute;
+ int hour;
+ int weekDay;
+ int monthDay;
+ int yearDay;
+ int month;
+ int year;
+ int isDST;
+ int utcOffset;
+ OwnArrayPtr<char> timeZone;
+};
+
+static inline int gmtoffset(const GregorianDateTime& t)
+{
+ return t.utcOffset;
+}
+} // namespace JSC
+#endif // USE(JSC)
+
+#endif // DateMath_h
diff --git a/Source/JavaScriptCore/wtf/DecimalNumber.cpp b/Source/JavaScriptCore/wtf/DecimalNumber.cpp
new file mode 100644
index 0000000..70304e2
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/DecimalNumber.cpp
@@ -0,0 +1,199 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "DecimalNumber.h"
+#include <math.h>
+#include <wtf/MathExtras.h>
+#include <wtf/text/WTFString.h>
+
+namespace WTF {
+
+unsigned DecimalNumber::bufferLengthForStringDecimal() const
+{
+ unsigned length = 0;
+ // if the exponent is negative the number decimal representation is of the form:
+ // [<sign>]0.[<zeros>]<significand>
+ if (m_exponent < 0) {
+ if (m_sign)
+ ++length;
+ length += 2; // for "0."
+ length += -m_exponent - 1;
+ length += m_precision;
+ return length;
+ }
+
+ unsigned digitsBeforeDecimalPoint = m_exponent + 1;
+
+ // If the precision is <= than the number of digits to get up to the decimal
+ // point, then there is no fractional part, number is of the form:
+ // [<sign>]<significand>[<zeros>]
+ if (m_precision <= digitsBeforeDecimalPoint) {
+ if (m_sign)
+ ++length;
+ length += m_precision;
+ length += digitsBeforeDecimalPoint - m_precision;
+ return length;
+ }
+
+ // If we get here, number starts before the decimal point, and ends after it,
+ // as such is of the form:
+ // [<sign>]<significand-begin>.<significand-end>
+ if (m_sign)
+ ++length;
+ length += digitsBeforeDecimalPoint;
+ ++length; // for decimal point
+ length += m_precision - digitsBeforeDecimalPoint;
+
+ return length;
+}
+
+unsigned DecimalNumber::bufferLengthForStringExponential() const
+{
+ unsigned length = 0;
+ if (m_sign)
+ ++length;
+
+ // Add the significand
+ ++length;
+
+ if (m_precision > 1) {
+ ++length; // for decimal point
+ length += m_precision - 1;
+ }
+
+ // Add "e+" or "e-"
+ length += 2;
+
+ int exponent = (m_exponent >= 0) ? m_exponent : -m_exponent;
+
+ // Add the exponent
+ if (exponent >= 100)
+ ++length;
+ if (exponent >= 10)
+ ++length;
+ ++length;
+
+ return length;
+}
+
+unsigned DecimalNumber::toStringDecimal(UChar* buffer, unsigned bufferLength) const
+{
+ ASSERT_UNUSED(bufferLength, bufferLength >= bufferLengthForStringDecimal());
+
+ // Should always be at least one digit to add to the string!
+ ASSERT(m_precision);
+ UChar* next = buffer;
+
+ // if the exponent is negative the number decimal representation is of the form:
+ // [<sign>]0.[<zeros>]<significand>
+ if (m_exponent < 0) {
+ unsigned zeros = -m_exponent - 1;
+
+ if (m_sign)
+ *next++ = '-';
+ *next++ = '0';
+ *next++ = '.';
+ for (unsigned i = 0; i < zeros; ++i)
+ *next++ = '0';
+ for (unsigned i = 0; i < m_precision; ++i)
+ *next++ = m_significand[i];
+
+ return next - buffer;
+ }
+
+ unsigned digitsBeforeDecimalPoint = m_exponent + 1;
+
+ // If the precision is <= than the number of digits to get up to the decimal
+ // point, then there is no fractional part, number is of the form:
+ // [<sign>]<significand>[<zeros>]
+ if (m_precision <= digitsBeforeDecimalPoint) {
+ if (m_sign)
+ *next++ = '-';
+ for (unsigned i = 0; i < m_precision; ++i)
+ *next++ = m_significand[i];
+ for (unsigned i = 0; i < (digitsBeforeDecimalPoint - m_precision); ++i)
+ *next++ = '0';
+
+ return next - buffer;
+ }
+
+ // If we get here, number starts before the decimal point, and ends after it,
+ // as such is of the form:
+ // [<sign>]<significand-begin>.<significand-end>
+
+ if (m_sign)
+ *next++ = '-';
+ for (unsigned i = 0; i < digitsBeforeDecimalPoint; ++i)
+ *next++ = m_significand[i];
+ *next++ = '.';
+ for (unsigned i = digitsBeforeDecimalPoint; i < m_precision; ++i)
+ *next++ = m_significand[i];
+
+ return next - buffer;
+}
+
+unsigned DecimalNumber::toStringExponential(UChar* buffer, unsigned bufferLength) const
+{
+ ASSERT_UNUSED(bufferLength, bufferLength >= bufferLengthForStringExponential());
+
+ // Should always be at least one digit to add to the string!
+ ASSERT(m_precision);
+ UChar* next = buffer;
+
+ // Add the sign
+ if (m_sign)
+ *next++ = '-';
+
+ // Add the significand
+ *next++ = m_significand[0];
+ if (m_precision > 1) {
+ *next++ = '.';
+ for (unsigned i = 1; i < m_precision; ++i)
+ *next++ = m_significand[i];
+ }
+
+ // Add "e+" or "e-"
+ *next++ = 'e';
+ int exponent;
+ if (m_exponent >= 0) {
+ *next++ = '+';
+ exponent = m_exponent;
+ } else {
+ *next++ = '-';
+ exponent = -m_exponent;
+ }
+
+ // Add the exponent
+ if (exponent >= 100)
+ *next++ = '0' + exponent / 100;
+ if (exponent >= 10)
+ *next++ = '0' + (exponent % 100) / 10;
+ *next++ = '0' + exponent % 10;
+
+ return next - buffer;
+}
+
+} // namespace WTF
diff --git a/Source/JavaScriptCore/wtf/DecimalNumber.h b/Source/JavaScriptCore/wtf/DecimalNumber.h
new file mode 100644
index 0000000..c42f00b
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/DecimalNumber.h
@@ -0,0 +1,108 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DecimalNumber_h
+#define DecimalNumber_h
+
+#include <math.h>
+#include <wtf/dtoa.h>
+#include <wtf/MathExtras.h>
+#include <wtf/text/WTFString.h>
+
+namespace WTF {
+
+enum RoundingSignificantFiguresType { RoundingSignificantFigures };
+enum RoundingDecimalPlacesType { RoundingDecimalPlaces };
+
+class DecimalNumber {
+public:
+ DecimalNumber(double d)
+ {
+ ASSERT(!isnan(d) && !isinf(d));
+ dtoa(m_significand, d, m_sign, m_exponent, m_precision);
+
+ ASSERT(m_precision);
+ // Zero should always have exponent 0.
+ ASSERT(m_significand[0] != '0' || !m_exponent);
+ // No values other than zero should have a leading zero.
+ ASSERT(m_significand[0] != '0' || m_precision == 1);
+ // No values other than zero should have trailing zeros.
+ ASSERT(m_significand[0] == '0' || m_significand[m_precision - 1] != '0');
+ }
+
+ DecimalNumber(double d, RoundingSignificantFiguresType, unsigned significantFigures)
+ {
+ ASSERT(!isnan(d) && !isinf(d));
+ dtoaRoundSF(m_significand, d, significantFigures, m_sign, m_exponent, m_precision);
+
+ ASSERT(significantFigures && significantFigures <= sizeof(DtoaBuffer));
+ while (m_precision < significantFigures)
+ m_significand[m_precision++] = '0';
+
+ ASSERT(m_precision);
+ // Zero should always have exponent 0.
+ ASSERT(m_significand[0] != '0' || !m_exponent);
+ }
+
+ DecimalNumber(double d, RoundingDecimalPlacesType, unsigned decimalPlaces)
+ {
+ ASSERT(!isnan(d) && !isinf(d));
+ dtoaRoundDP(m_significand, d, decimalPlaces, m_sign, m_exponent, m_precision);
+
+ unsigned significantFigures = 1 + m_exponent + decimalPlaces;
+ ASSERT(significantFigures && significantFigures <= sizeof(DtoaBuffer));
+ while (m_precision < significantFigures)
+ m_significand[m_precision++] = '0';
+
+ ASSERT(m_precision);
+ // Zero should always have exponent 0.
+ ASSERT(m_significand[0] != '0' || !m_exponent);
+ }
+
+ unsigned bufferLengthForStringDecimal() const;
+ unsigned bufferLengthForStringExponential() const;
+
+ unsigned toStringDecimal(UChar* buffer, unsigned bufferLength) const;
+ unsigned toStringExponential(UChar* buffer, unsigned bufferLength) const;
+
+ bool sign() const { return m_sign; }
+ int exponent() const { return m_exponent; }
+ const char* significand() const { return m_significand; } // significand contains precision characters, is not null-terminated.
+ unsigned precision() const { return m_precision; }
+
+private:
+ bool m_sign;
+ int m_exponent;
+ DtoaBuffer m_significand;
+ unsigned m_precision;
+};
+
+} // namespace WTF
+
+using WTF::DecimalNumber;
+using WTF::RoundingSignificantFigures;
+using WTF::RoundingDecimalPlaces;
+
+#endif // DecimalNumber_h
diff --git a/Source/JavaScriptCore/wtf/Decoder.h b/Source/JavaScriptCore/wtf/Decoder.h
new file mode 100644
index 0000000..341d58d
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/Decoder.h
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef Decoder_h
+#define Decoder_h
+
+#include <wtf/Vector.h>
+
+namespace WTF {
+
+class String;
+
+class Decoder {
+protected:
+ Decoder() { }
+ virtual ~Decoder() { }
+
+public:
+ virtual bool decodeBytes(Vector<uint8_t>&) = 0;
+
+ virtual bool decodeBool(bool&) = 0;
+ virtual bool decodeUInt32(uint32_t&) = 0;
+ virtual bool decodeUInt64(uint64_t&) = 0;
+ virtual bool decodeInt32(int32_t&) = 0;
+ virtual bool decodeInt64(int64_t&) = 0;
+ virtual bool decodeFloat(float&) = 0;
+ virtual bool decodeDouble(double&) = 0;
+ virtual bool decodeString(String&) = 0;
+};
+
+} // namespace WTF
+
+using WTF::Decoder;
+
+#endif // Decoder_h
diff --git a/Source/JavaScriptCore/wtf/Deque.h b/Source/JavaScriptCore/wtf/Deque.h
new file mode 100644
index 0000000..745e0b6
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/Deque.h
@@ -0,0 +1,678 @@
+/*
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WTF_Deque_h
+#define WTF_Deque_h
+
+// FIXME: Could move what Vector and Deque share into a separate file.
+// Deque doesn't actually use Vector.
+
+#include "Vector.h"
+
+namespace WTF {
+
+ template<typename T> class DequeIteratorBase;
+ template<typename T> class DequeIterator;
+ template<typename T> class DequeConstIterator;
+ template<typename T> class DequeReverseIterator;
+ template<typename T> class DequeConstReverseIterator;
+
+ template<typename T>
+ class Deque : public FastAllocBase {
+ public:
+ typedef DequeIterator<T> iterator;
+ typedef DequeConstIterator<T> const_iterator;
+ typedef DequeReverseIterator<T> reverse_iterator;
+ typedef DequeConstReverseIterator<T> const_reverse_iterator;
+
+ Deque();
+ Deque(const Deque<T>&);
+ Deque& operator=(const Deque<T>&);
+ ~Deque();
+
+ void swap(Deque<T>&);
+
+ size_t size() const { return m_start <= m_end ? m_end - m_start : m_end + m_buffer.capacity() - m_start; }
+ bool isEmpty() const { return m_start == m_end; }
+
+ iterator begin() { return iterator(this, m_start); }
+ iterator end() { return iterator(this, m_end); }
+ const_iterator begin() const { return const_iterator(this, m_start); }
+ const_iterator end() const { return const_iterator(this, m_end); }
+ reverse_iterator rbegin() { return reverse_iterator(this, m_end); }
+ reverse_iterator rend() { return reverse_iterator(this, m_start); }
+ const_reverse_iterator rbegin() const { return const_reverse_iterator(this, m_end); }
+ const_reverse_iterator rend() const { return const_reverse_iterator(this, m_start); }
+
+ T& first() { ASSERT(m_start != m_end); return m_buffer.buffer()[m_start]; }
+ const T& first() const { ASSERT(m_start != m_end); return m_buffer.buffer()[m_start]; }
+ T takeFirst();
+
+ template<typename U> void append(const U&);
+ template<typename U> void prepend(const U&);
+ void removeFirst();
+ void remove(iterator&);
+ void remove(const_iterator&);
+
+ void clear();
+
+ template<typename Predicate>
+ iterator findIf(Predicate&);
+
+ private:
+ friend class DequeIteratorBase<T>;
+
+ typedef VectorBuffer<T, 0> Buffer;
+ typedef VectorTypeOperations<T> TypeOperations;
+ typedef DequeIteratorBase<T> IteratorBase;
+
+ void remove(size_t position);
+ void invalidateIterators();
+ void destroyAll();
+ void checkValidity() const;
+ void checkIndexValidity(size_t) const;
+ void expandCapacityIfNeeded();
+ void expandCapacity();
+
+ size_t m_start;
+ size_t m_end;
+ Buffer m_buffer;
+#ifndef NDEBUG
+ mutable IteratorBase* m_iterators;
+#endif
+ };
+
+ template<typename T>
+ class DequeIteratorBase {
+ private:
+ typedef DequeIteratorBase<T> Base;
+
+ protected:
+ DequeIteratorBase();
+ DequeIteratorBase(const Deque<T>*, size_t);
+ DequeIteratorBase(const Base&);
+ Base& operator=(const Base&);
+ ~DequeIteratorBase();
+
+ void assign(const Base& other) { *this = other; }
+
+ void increment();
+ void decrement();
+
+ T* before() const;
+ T* after() const;
+
+ bool isEqual(const Base&) const;
+
+ private:
+ void addToIteratorsList();
+ void removeFromIteratorsList();
+ void checkValidity() const;
+ void checkValidity(const Base&) const;
+
+ Deque<T>* m_deque;
+ size_t m_index;
+
+ friend class Deque<T>;
+
+#ifndef NDEBUG
+ mutable DequeIteratorBase* m_next;
+ mutable DequeIteratorBase* m_previous;
+#endif
+ };
+
+ template<typename T>
+ class DequeIterator : public DequeIteratorBase<T> {
+ private:
+ typedef DequeIteratorBase<T> Base;
+ typedef DequeIterator<T> Iterator;
+
+ public:
+ DequeIterator(Deque<T>* deque, size_t index) : Base(deque, index) { }
+
+ DequeIterator(const Iterator& other) : Base(other) { }
+ DequeIterator& operator=(const Iterator& other) { Base::assign(other); return *this; }
+
+ T& operator*() const { return *Base::after(); }
+ T* operator->() const { return Base::after(); }
+
+ bool operator==(const Iterator& other) const { return Base::isEqual(other); }
+ bool operator!=(const Iterator& other) const { return !Base::isEqual(other); }
+
+ Iterator& operator++() { Base::increment(); return *this; }
+ // postfix ++ intentionally omitted
+ Iterator& operator--() { Base::decrement(); return *this; }
+ // postfix -- intentionally omitted
+ };
+
+ template<typename T>
+ class DequeConstIterator : public DequeIteratorBase<T> {
+ private:
+ typedef DequeIteratorBase<T> Base;
+ typedef DequeConstIterator<T> Iterator;
+ typedef DequeIterator<T> NonConstIterator;
+
+ public:
+ DequeConstIterator(const Deque<T>* deque, size_t index) : Base(deque, index) { }
+
+ DequeConstIterator(const Iterator& other) : Base(other) { }
+ DequeConstIterator(const NonConstIterator& other) : Base(other) { }
+ DequeConstIterator& operator=(const Iterator& other) { Base::assign(other); return *this; }
+ DequeConstIterator& operator=(const NonConstIterator& other) { Base::assign(other); return *this; }
+
+ const T& operator*() const { return *Base::after(); }
+ const T* operator->() const { return Base::after(); }
+
+ bool operator==(const Iterator& other) const { return Base::isEqual(other); }
+ bool operator!=(const Iterator& other) const { return !Base::isEqual(other); }
+
+ Iterator& operator++() { Base::increment(); return *this; }
+ // postfix ++ intentionally omitted
+ Iterator& operator--() { Base::decrement(); return *this; }
+ // postfix -- intentionally omitted
+ };
+
+ template<typename T>
+ class DequeReverseIterator : public DequeIteratorBase<T> {
+ private:
+ typedef DequeIteratorBase<T> Base;
+ typedef DequeReverseIterator<T> Iterator;
+
+ public:
+ DequeReverseIterator(const Deque<T>* deque, size_t index) : Base(deque, index) { }
+
+ DequeReverseIterator(const Iterator& other) : Base(other) { }
+ DequeReverseIterator& operator=(const Iterator& other) { Base::assign(other); return *this; }
+
+ T& operator*() const { return *Base::before(); }
+ T* operator->() const { return Base::before(); }
+
+ bool operator==(const Iterator& other) const { return Base::isEqual(other); }
+ bool operator!=(const Iterator& other) const { return !Base::isEqual(other); }
+
+ Iterator& operator++() { Base::decrement(); return *this; }
+ // postfix ++ intentionally omitted
+ Iterator& operator--() { Base::increment(); return *this; }
+ // postfix -- intentionally omitted
+ };
+
+ template<typename T>
+ class DequeConstReverseIterator : public DequeIteratorBase<T> {
+ private:
+ typedef DequeIteratorBase<T> Base;
+ typedef DequeConstReverseIterator<T> Iterator;
+ typedef DequeReverseIterator<T> NonConstIterator;
+
+ public:
+ DequeConstReverseIterator(const Deque<T>* deque, size_t index) : Base(deque, index) { }
+
+ DequeConstReverseIterator(const Iterator& other) : Base(other) { }
+ DequeConstReverseIterator(const NonConstIterator& other) : Base(other) { }
+ DequeConstReverseIterator& operator=(const Iterator& other) { Base::assign(other); return *this; }
+ DequeConstReverseIterator& operator=(const NonConstIterator& other) { Base::assign(other); return *this; }
+
+ const T& operator*() const { return *Base::before(); }
+ const T* operator->() const { return Base::before(); }
+
+ bool operator==(const Iterator& other) const { return Base::isEqual(other); }
+ bool operator!=(const Iterator& other) const { return !Base::isEqual(other); }
+
+ Iterator& operator++() { Base::decrement(); return *this; }
+ // postfix ++ intentionally omitted
+ Iterator& operator--() { Base::increment(); return *this; }
+ // postfix -- intentionally omitted
+ };
+
+#ifdef NDEBUG
+ template<typename T> inline void Deque<T>::checkValidity() const { }
+ template<typename T> inline void Deque<T>::checkIndexValidity(size_t) const { }
+ template<typename T> inline void Deque<T>::invalidateIterators() { }
+#else
+ template<typename T>
+ void Deque<T>::checkValidity() const
+ {
+ if (!m_buffer.capacity()) {
+ ASSERT(!m_start);
+ ASSERT(!m_end);
+ } else {
+ ASSERT(m_start < m_buffer.capacity());
+ ASSERT(m_end < m_buffer.capacity());
+ }
+ }
+
+ template<typename T>
+ void Deque<T>::checkIndexValidity(size_t index) const
+ {
+ ASSERT(index <= m_buffer.capacity());
+ if (m_start <= m_end) {
+ ASSERT(index >= m_start);
+ ASSERT(index <= m_end);
+ } else {
+ ASSERT(index >= m_start || index <= m_end);
+ }
+ }
+
+ template<typename T>
+ void Deque<T>::invalidateIterators()
+ {
+ IteratorBase* next;
+ for (IteratorBase* p = m_iterators; p; p = next) {
+ next = p->m_next;
+ p->m_deque = 0;
+ p->m_next = 0;
+ p->m_previous = 0;
+ }
+ m_iterators = 0;
+ }
+#endif
+
+ template<typename T>
+ inline Deque<T>::Deque()
+ : m_start(0)
+ , m_end(0)
+#ifndef NDEBUG
+ , m_iterators(0)
+#endif
+ {
+ checkValidity();
+ }
+
+ template<typename T>
+ inline Deque<T>::Deque(const Deque<T>& other)
+ : m_start(other.m_start)
+ , m_end(other.m_end)
+ , m_buffer(other.m_buffer.capacity())
+#ifndef NDEBUG
+ , m_iterators(0)
+#endif
+ {
+ const T* otherBuffer = other.m_buffer.buffer();
+ if (m_start <= m_end)
+ TypeOperations::uninitializedCopy(otherBuffer + m_start, otherBuffer + m_end, m_buffer.buffer() + m_start);
+ else {
+ TypeOperations::uninitializedCopy(otherBuffer, otherBuffer + m_end, m_buffer.buffer());
+ TypeOperations::uninitializedCopy(otherBuffer + m_start, otherBuffer + m_buffer.capacity(), m_buffer.buffer() + m_start);
+ }
+ }
+
+ template<typename T>
+ void deleteAllValues(const Deque<T>& collection)
+ {
+ typedef typename Deque<T>::const_iterator iterator;
+ iterator end = collection.end();
+ for (iterator it = collection.begin(); it != end; ++it)
+ delete *it;
+ }
+
+ template<typename T>
+ inline Deque<T>& Deque<T>::operator=(const Deque<T>& other)
+ {
+ Deque<T> copy(other);
+ swap(copy);
+ return *this;
+ }
+
+ template<typename T>
+ inline void Deque<T>::destroyAll()
+ {
+ if (m_start <= m_end)
+ TypeOperations::destruct(m_buffer.buffer() + m_start, m_buffer.buffer() + m_end);
+ else {
+ TypeOperations::destruct(m_buffer.buffer(), m_buffer.buffer() + m_end);
+ TypeOperations::destruct(m_buffer.buffer() + m_start, m_buffer.buffer() + m_buffer.capacity());
+ }
+ }
+
+ template<typename T>
+ inline Deque<T>::~Deque()
+ {
+ checkValidity();
+ invalidateIterators();
+ destroyAll();
+ }
+
+ template<typename T>
+ inline void Deque<T>::swap(Deque<T>& other)
+ {
+ checkValidity();
+ other.checkValidity();
+ invalidateIterators();
+ std::swap(m_start, other.m_start);
+ std::swap(m_end, other.m_end);
+ m_buffer.swap(other.m_buffer);
+ checkValidity();
+ other.checkValidity();
+ }
+
+ template<typename T>
+ inline void Deque<T>::clear()
+ {
+ checkValidity();
+ invalidateIterators();
+ destroyAll();
+ m_start = 0;
+ m_end = 0;
+ checkValidity();
+ }
+
+ template<typename T>
+ template<typename Predicate>
+ inline DequeIterator<T> Deque<T>::findIf(Predicate& predicate)
+ {
+ iterator end_iterator = end();
+ for (iterator it = begin(); it != end_iterator; ++it) {
+ if (predicate(*it))
+ return it;
+ }
+ return end_iterator;
+ }
+
+ template<typename T>
+ inline void Deque<T>::expandCapacityIfNeeded()
+ {
+ if (m_start) {
+ if (m_end + 1 != m_start)
+ return;
+ } else if (m_end) {
+ if (m_end != m_buffer.capacity() - 1)
+ return;
+ } else if (m_buffer.capacity())
+ return;
+
+ expandCapacity();
+ }
+
+ template<typename T>
+ void Deque<T>::expandCapacity()
+ {
+ checkValidity();
+ size_t oldCapacity = m_buffer.capacity();
+ size_t newCapacity = max(static_cast<size_t>(16), oldCapacity + oldCapacity / 4 + 1);
+ T* oldBuffer = m_buffer.buffer();
+ m_buffer.allocateBuffer(newCapacity);
+ if (m_start <= m_end)
+ TypeOperations::move(oldBuffer + m_start, oldBuffer + m_end, m_buffer.buffer() + m_start);
+ else {
+ TypeOperations::move(oldBuffer, oldBuffer + m_end, m_buffer.buffer());
+ size_t newStart = newCapacity - (oldCapacity - m_start);
+ TypeOperations::move(oldBuffer + m_start, oldBuffer + oldCapacity, m_buffer.buffer() + newStart);
+ m_start = newStart;
+ }
+ m_buffer.deallocateBuffer(oldBuffer);
+ checkValidity();
+ }
+
+ template<typename T>
+ inline T Deque<T>::takeFirst()
+ {
+ T oldFirst = first();
+ removeFirst();
+ return oldFirst;
+ }
+
+ template<typename T> template<typename U>
+ inline void Deque<T>::append(const U& value)
+ {
+ checkValidity();
+ expandCapacityIfNeeded();
+ new (&m_buffer.buffer()[m_end]) T(value);
+ if (m_end == m_buffer.capacity() - 1)
+ m_end = 0;
+ else
+ ++m_end;
+ checkValidity();
+ }
+
+ template<typename T> template<typename U>
+ inline void Deque<T>::prepend(const U& value)
+ {
+ checkValidity();
+ expandCapacityIfNeeded();
+ if (!m_start)
+ m_start = m_buffer.capacity() - 1;
+ else
+ --m_start;
+ new (&m_buffer.buffer()[m_start]) T(value);
+ checkValidity();
+ }
+
+ template<typename T>
+ inline void Deque<T>::removeFirst()
+ {
+ checkValidity();
+ invalidateIterators();
+ ASSERT(!isEmpty());
+ TypeOperations::destruct(&m_buffer.buffer()[m_start], &m_buffer.buffer()[m_start + 1]);
+ if (m_start == m_buffer.capacity() - 1)
+ m_start = 0;
+ else
+ ++m_start;
+ checkValidity();
+ }
+
+ template<typename T>
+ inline void Deque<T>::remove(iterator& it)
+ {
+ it.checkValidity();
+ remove(it.m_index);
+ }
+
+ template<typename T>
+ inline void Deque<T>::remove(const_iterator& it)
+ {
+ it.checkValidity();
+ remove(it.m_index);
+ }
+
+ template<typename T>
+ inline void Deque<T>::remove(size_t position)
+ {
+ if (position == m_end)
+ return;
+
+ checkValidity();
+ invalidateIterators();
+
+ T* buffer = m_buffer.buffer();
+ TypeOperations::destruct(&buffer[position], &buffer[position + 1]);
+
+ // Find which segment of the circular buffer contained the remove element, and only move elements in that part.
+ if (position >= m_start) {
+ TypeOperations::moveOverlapping(buffer + m_start, buffer + position, buffer + m_start + 1);
+ m_start = (m_start + 1) % m_buffer.capacity();
+ } else {
+ TypeOperations::moveOverlapping(buffer + position + 1, buffer + m_end, buffer + position);
+ m_end = (m_end - 1 + m_buffer.capacity()) % m_buffer.capacity();
+ }
+ checkValidity();
+ }
+
+#ifdef NDEBUG
+ template<typename T> inline void DequeIteratorBase<T>::checkValidity() const { }
+ template<typename T> inline void DequeIteratorBase<T>::checkValidity(const DequeIteratorBase<T>&) const { }
+ template<typename T> inline void DequeIteratorBase<T>::addToIteratorsList() { }
+ template<typename T> inline void DequeIteratorBase<T>::removeFromIteratorsList() { }
+#else
+ template<typename T>
+ void DequeIteratorBase<T>::checkValidity() const
+ {
+ ASSERT(m_deque);
+ m_deque->checkIndexValidity(m_index);
+ }
+
+ template<typename T>
+ void DequeIteratorBase<T>::checkValidity(const Base& other) const
+ {
+ checkValidity();
+ other.checkValidity();
+ ASSERT(m_deque == other.m_deque);
+ }
+
+ template<typename T>
+ void DequeIteratorBase<T>::addToIteratorsList()
+ {
+ if (!m_deque)
+ m_next = 0;
+ else {
+ m_next = m_deque->m_iterators;
+ m_deque->m_iterators = this;
+ if (m_next)
+ m_next->m_previous = this;
+ }
+ m_previous = 0;
+ }
+
+ template<typename T>
+ void DequeIteratorBase<T>::removeFromIteratorsList()
+ {
+ if (!m_deque) {
+ ASSERT(!m_next);
+ ASSERT(!m_previous);
+ } else {
+ if (m_next) {
+ ASSERT(m_next->m_previous == this);
+ m_next->m_previous = m_previous;
+ }
+ if (m_previous) {
+ ASSERT(m_deque->m_iterators != this);
+ ASSERT(m_previous->m_next == this);
+ m_previous->m_next = m_next;
+ } else {
+ ASSERT(m_deque->m_iterators == this);
+ m_deque->m_iterators = m_next;
+ }
+ }
+ m_next = 0;
+ m_previous = 0;
+ }
+#endif
+
+ template<typename T>
+ inline DequeIteratorBase<T>::DequeIteratorBase()
+ : m_deque(0)
+ {
+ }
+
+ template<typename T>
+ inline DequeIteratorBase<T>::DequeIteratorBase(const Deque<T>* deque, size_t index)
+ : m_deque(const_cast<Deque<T>*>(deque))
+ , m_index(index)
+ {
+ addToIteratorsList();
+ checkValidity();
+ }
+
+ template<typename T>
+ inline DequeIteratorBase<T>::DequeIteratorBase(const Base& other)
+ : m_deque(other.m_deque)
+ , m_index(other.m_index)
+ {
+ addToIteratorsList();
+ checkValidity();
+ }
+
+ template<typename T>
+ inline DequeIteratorBase<T>& DequeIteratorBase<T>::operator=(const Base& other)
+ {
+ checkValidity();
+ other.checkValidity();
+ removeFromIteratorsList();
+
+ m_deque = other.m_deque;
+ m_index = other.m_index;
+ addToIteratorsList();
+ checkValidity();
+ return *this;
+ }
+
+ template<typename T>
+ inline DequeIteratorBase<T>::~DequeIteratorBase()
+ {
+#ifndef NDEBUG
+ removeFromIteratorsList();
+ m_deque = 0;
+#endif
+ }
+
+ template<typename T>
+ inline bool DequeIteratorBase<T>::isEqual(const Base& other) const
+ {
+ checkValidity(other);
+ return m_index == other.m_index;
+ }
+
+ template<typename T>
+ inline void DequeIteratorBase<T>::increment()
+ {
+ checkValidity();
+ ASSERT(m_index != m_deque->m_end);
+ ASSERT(m_deque->m_buffer.capacity());
+ if (m_index == m_deque->m_buffer.capacity() - 1)
+ m_index = 0;
+ else
+ ++m_index;
+ checkValidity();
+ }
+
+ template<typename T>
+ inline void DequeIteratorBase<T>::decrement()
+ {
+ checkValidity();
+ ASSERT(m_index != m_deque->m_start);
+ ASSERT(m_deque->m_buffer.capacity());
+ if (!m_index)
+ m_index = m_deque->m_buffer.capacity() - 1;
+ else
+ --m_index;
+ checkValidity();
+ }
+
+ template<typename T>
+ inline T* DequeIteratorBase<T>::after() const
+ {
+ checkValidity();
+ ASSERT(m_index != m_deque->m_end);
+ return &m_deque->m_buffer.buffer()[m_index];
+ }
+
+ template<typename T>
+ inline T* DequeIteratorBase<T>::before() const
+ {
+ checkValidity();
+ ASSERT(m_index != m_deque->m_start);
+ if (!m_index)
+ return &m_deque->m_buffer.buffer()[m_deque->m_buffer.capacity() - 1];
+ return &m_deque->m_buffer.buffer()[m_index - 1];
+ }
+
+} // namespace WTF
+
+using WTF::Deque;
+
+#endif // WTF_Deque_h
diff --git a/Source/JavaScriptCore/wtf/DisallowCType.h b/Source/JavaScriptCore/wtf/DisallowCType.h
new file mode 100644
index 0000000..436f7f2
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/DisallowCType.h
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WTF_DisallowCType_h
+#define WTF_DisallowCType_h
+
+// The behavior of many of the functions in the <ctype.h> header is dependent
+// on the current locale. But almost all uses of these functions are for
+// locale-independent, ASCII-specific purposes. In WebKit code we use our own
+// ASCII-specific functions instead. This header makes sure we get a compile-time
+// error if we use one of the <ctype.h> functions by accident.
+
+#include <ctype.h>
+
+#undef isalnum
+#undef isalpha
+#undef isascii
+#undef isblank
+#undef iscntrl
+#undef isdigit
+#undef isgraph
+#undef islower
+#undef isprint
+#undef ispunct
+#undef isspace
+#undef isupper
+#undef isxdigit
+#undef toascii
+#undef tolower
+#undef toupper
+
+#define isalnum isalnum_WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h
+#define isalpha isalpha_WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h
+#define isascii isascii_WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h
+#define isblank isblank_WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h
+#define iscntrl iscntrl_WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h
+#define isdigit isdigit_WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h
+#define isgraph isgraph_WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h
+#define islower islower_WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h
+#define isprint isprint_WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h
+#define ispunct ispunct_WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h
+#define isspace isspace_WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h
+#define isupper isupper_WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h
+#define isxdigit isxdigit_WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h
+#define toascii toascii_WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h
+#define tolower tolower_WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h
+#define toupper toupper_WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h
+
+#endif
diff --git a/Source/JavaScriptCore/wtf/Encoder.h b/Source/JavaScriptCore/wtf/Encoder.h
new file mode 100644
index 0000000..109b0db
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/Encoder.h
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef Encoder_h
+#define Encoder_h
+
+#include <stdint.h>
+
+namespace WTF {
+
+class String;
+
+class Encoder {
+protected:
+ Encoder() { }
+ virtual ~Encoder() { }
+
+public:
+ virtual void encodeBytes(const uint8_t*, size_t) = 0;
+
+ virtual void encodeBool(bool) = 0;
+ virtual void encodeUInt32(uint32_t) = 0;
+ virtual void encodeUInt64(uint64_t) = 0;
+ virtual void encodeInt32(int32_t) = 0;
+ virtual void encodeInt64(int64_t) = 0;
+ virtual void encodeFloat(float) = 0;
+ virtual void encodeDouble(double) = 0;
+ virtual void encodeString(const String&) = 0;
+};
+
+} // namespace WTF
+
+using WTF::Encoder;
+
+#endif // Encoder_h
diff --git a/Source/JavaScriptCore/wtf/FastAllocBase.h b/Source/JavaScriptCore/wtf/FastAllocBase.h
new file mode 100644
index 0000000..bb1825e
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/FastAllocBase.h
@@ -0,0 +1,416 @@
+/*
+ * Copyright (C) 2008, 2009 Paul Pedriana <ppedriana@ea.com>. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef FastAllocBase_h
+#define FastAllocBase_h
+
+// Provides customizable overrides of fastMalloc/fastFree and operator new/delete
+//
+// Provided functionality:
+// namespace WTF {
+// class FastAllocBase;
+//
+// T* fastNew<T>();
+// T* fastNew<T>(arg);
+// T* fastNew<T>(arg, arg);
+// T* fastNewArray<T>(count);
+// void fastDelete(T* p);
+// void fastDeleteArray(T* p);
+// void fastNonNullDelete(T* p);
+// void fastNonNullDeleteArray(T* p);
+// }
+//
+// FastDelete assumes that the underlying
+//
+// Example usage:
+// class Widget : public FastAllocBase { ... };
+//
+// char* charPtr = fastNew<char>();
+// fastDelete(charPtr);
+//
+// char* charArrayPtr = fastNewArray<char>(37);
+// fastDeleteArray(charArrayPtr);
+//
+// void** voidPtrPtr = fastNew<void*>();
+// fastDelete(voidPtrPtr);
+//
+// void** voidPtrArrayPtr = fastNewArray<void*>(37);
+// fastDeleteArray(voidPtrArrayPtr);
+//
+// POD* podPtr = fastNew<POD>();
+// fastDelete(podPtr);
+//
+// POD* podArrayPtr = fastNewArray<POD>(37);
+// fastDeleteArray(podArrayPtr);
+//
+// Object* objectPtr = fastNew<Object>();
+// fastDelete(objectPtr);
+//
+// Object* objectArrayPtr = fastNewArray<Object>(37);
+// fastDeleteArray(objectArrayPtr);
+//
+
+#include <new>
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+#include "Assertions.h"
+#include "FastMalloc.h"
+#include "TypeTraits.h"
+
+namespace WTF {
+
+#define WTF_MAKE_FAST_ALLOCATED \
+public: \
+ void* operator new(size_t, void* p) { return p; } \
+ void* operator new[](size_t, void* p) { return p; } \
+ \
+ void* operator new(size_t size) \
+ { \
+ void* p = ::WTF::fastMalloc(size); \
+ ::WTF::fastMallocMatchValidateMalloc(p, ::WTF::Internal::AllocTypeClassNew); \
+ return p; \
+ } \
+ \
+ void operator delete(void* p) \
+ { \
+ ::WTF::fastMallocMatchValidateFree(p, ::WTF::Internal::AllocTypeClassNew); \
+ ::WTF::fastFree(p); \
+ } \
+ \
+ void* operator new[](size_t size) \
+ { \
+ void* p = ::WTF::fastMalloc(size); \
+ ::WTF::fastMallocMatchValidateMalloc(p, ::WTF::Internal::AllocTypeClassNewArray); \
+ return p; \
+ } \
+ \
+ void operator delete[](void* p) \
+ { \
+ ::WTF::fastMallocMatchValidateFree(p, ::WTF::Internal::AllocTypeClassNewArray); \
+ ::WTF::fastFree(p); \
+ } \
+private:
+
+class FastAllocBase {
+ WTF_MAKE_FAST_ALLOCATED
+};
+
+ // fastNew / fastDelete
+
+ template <typename T>
+ inline T* fastNew()
+ {
+ void* p = fastMalloc(sizeof(T));
+
+ if (!p)
+ return 0;
+
+ fastMallocMatchValidateMalloc(p, Internal::AllocTypeFastNew);
+ return ::new(p) T;
+ }
+
+ template <typename T, typename Arg1>
+ inline T* fastNew(Arg1 arg1)
+ {
+ void* p = fastMalloc(sizeof(T));
+
+ if (!p)
+ return 0;
+
+ fastMallocMatchValidateMalloc(p, Internal::AllocTypeFastNew);
+ return ::new(p) T(arg1);
+ }
+
+ template <typename T, typename Arg1, typename Arg2>
+ inline T* fastNew(Arg1 arg1, Arg2 arg2)
+ {
+ void* p = fastMalloc(sizeof(T));
+
+ if (!p)
+ return 0;
+
+ fastMallocMatchValidateMalloc(p, Internal::AllocTypeFastNew);
+ return ::new(p) T(arg1, arg2);
+ }
+
+ template <typename T, typename Arg1, typename Arg2, typename Arg3>
+ inline T* fastNew(Arg1 arg1, Arg2 arg2, Arg3 arg3)
+ {
+ void* p = fastMalloc(sizeof(T));
+
+ if (!p)
+ return 0;
+
+ fastMallocMatchValidateMalloc(p, Internal::AllocTypeFastNew);
+ return ::new(p) T(arg1, arg2, arg3);
+ }
+
+ template <typename T, typename Arg1, typename Arg2, typename Arg3, typename Arg4>
+ inline T* fastNew(Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4)
+ {
+ void* p = fastMalloc(sizeof(T));
+
+ if (!p)
+ return 0;
+
+ fastMallocMatchValidateMalloc(p, Internal::AllocTypeFastNew);
+ return ::new(p) T(arg1, arg2, arg3, arg4);
+ }
+
+ template <typename T, typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5>
+ inline T* fastNew(Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4, Arg5 arg5)
+ {
+ void* p = fastMalloc(sizeof(T));
+
+ if (!p)
+ return 0;
+
+ fastMallocMatchValidateMalloc(p, Internal::AllocTypeFastNew);
+ return ::new(p) T(arg1, arg2, arg3, arg4, arg5);
+ }
+
+ namespace Internal {
+
+ // We define a union of pointer to an integer and pointer to T.
+ // When non-POD arrays are allocated we add a few leading bytes to tell what
+ // the size of the array is. We return to the user the pointer to T.
+ // The way to think of it is as if we allocate a struct like so:
+ // struct Array {
+ // AllocAlignmentInteger m_size;
+ // T m_T[array count];
+ // };
+
+ template <typename T>
+ union ArraySize {
+ AllocAlignmentInteger* size;
+ T* t;
+ };
+
+ // This is a support template for fastNewArray.
+ // This handles the case wherein T has a trivial ctor and a trivial dtor.
+ template <typename T, bool trivialCtor, bool trivialDtor>
+ struct NewArrayImpl {
+ static T* fastNewArray(size_t count)
+ {
+ T* p = static_cast<T*>(fastMalloc(sizeof(T) * count));
+ fastMallocMatchValidateMalloc(p, Internal::AllocTypeFastNewArray);
+ return p;
+ }
+ };
+
+ // This is a support template for fastNewArray.
+ // This handles the case wherein T has a non-trivial ctor and a trivial dtor.
+ template <typename T>
+ struct NewArrayImpl<T, false, true> {
+ static T* fastNewArray(size_t count)
+ {
+ T* p = static_cast<T*>(fastMalloc(sizeof(T) * count));
+
+ if (!p)
+ return 0;
+
+ fastMallocMatchValidateMalloc(p, Internal::AllocTypeFastNewArray);
+
+ for (T* pObject = p, *pObjectEnd = pObject + count; pObject != pObjectEnd; ++pObject)
+ ::new(pObject) T;
+
+ return p;
+ }
+ };
+
+ // This is a support template for fastNewArray.
+ // This handles the case wherein T has a trivial ctor and a non-trivial dtor.
+ template <typename T>
+ struct NewArrayImpl<T, true, false> {
+ static T* fastNewArray(size_t count)
+ {
+ void* p = fastMalloc(sizeof(AllocAlignmentInteger) + (sizeof(T) * count));
+ ArraySize<T> a = { static_cast<AllocAlignmentInteger*>(p) };
+
+ if (!p)
+ return 0;
+
+ fastMallocMatchValidateMalloc(p, Internal::AllocTypeFastNewArray);
+ *a.size++ = count;
+ // No need to construct the objects in this case.
+
+ return a.t;
+ }
+ };
+
+ // This is a support template for fastNewArray.
+ // This handles the case wherein T has a non-trivial ctor and a non-trivial dtor.
+ template <typename T>
+ struct NewArrayImpl<T, false, false> {
+ static T* fastNewArray(size_t count)
+ {
+ void* p = fastMalloc(sizeof(AllocAlignmentInteger) + (sizeof(T) * count));
+ ArraySize<T> a = { static_cast<AllocAlignmentInteger*>(p) };
+
+ if (!p)
+ return 0;
+
+ fastMallocMatchValidateMalloc(p, Internal::AllocTypeFastNewArray);
+ *a.size++ = count;
+
+ for (T* pT = a.t, *pTEnd = pT + count; pT != pTEnd; ++pT)
+ ::new(pT) T;
+
+ return a.t;
+ }
+ };
+ } // namespace Internal
+
+ template <typename T>
+ inline T* fastNewArray(size_t count)
+ {
+ return Internal::NewArrayImpl<T, WTF::HasTrivialConstructor<T>::value, WTF::HasTrivialDestructor<T>::value>::fastNewArray(count);
+ }
+
+ template <typename T>
+ inline void fastDelete(T* p)
+ {
+ if (!p)
+ return;
+
+ fastMallocMatchValidateFree(p, Internal::AllocTypeFastNew);
+ p->~T();
+ fastFree(p);
+ }
+
+ template <typename T>
+ inline void fastDeleteSkippingDestructor(T* p)
+ {
+ if (!p)
+ return;
+
+ fastMallocMatchValidateFree(p, Internal::AllocTypeFastNew);
+ fastFree(p);
+ }
+
+ namespace Internal {
+ // This is a support template for fastDeleteArray.
+ // This handles the case wherein T has a trivial dtor.
+ template <typename T, bool trivialDtor>
+ struct DeleteArrayImpl {
+ static void fastDeleteArray(void* p)
+ {
+ // No need to destruct the objects in this case.
+ // We expect that fastFree checks for null.
+ fastMallocMatchValidateFree(p, Internal::AllocTypeFastNewArray);
+ fastFree(p);
+ }
+ };
+
+ // This is a support template for fastDeleteArray.
+ // This handles the case wherein T has a non-trivial dtor.
+ template <typename T>
+ struct DeleteArrayImpl<T, false> {
+ static void fastDeleteArray(T* p)
+ {
+ if (!p)
+ return;
+
+ ArraySize<T> a;
+ a.t = p;
+ a.size--; // Decrement size pointer
+
+ T* pEnd = p + *a.size;
+ while (pEnd-- != p)
+ pEnd->~T();
+
+ fastMallocMatchValidateFree(a.size, Internal::AllocTypeFastNewArray);
+ fastFree(a.size);
+ }
+ };
+
+ } // namespace Internal
+
+ template <typename T>
+ void fastDeleteArray(T* p)
+ {
+ Internal::DeleteArrayImpl<T, WTF::HasTrivialDestructor<T>::value>::fastDeleteArray(p);
+ }
+
+
+ template <typename T>
+ inline void fastNonNullDelete(T* p)
+ {
+ fastMallocMatchValidateFree(p, Internal::AllocTypeFastNew);
+ p->~T();
+ fastFree(p);
+ }
+
+ namespace Internal {
+ // This is a support template for fastDeleteArray.
+ // This handles the case wherein T has a trivial dtor.
+ template <typename T, bool trivialDtor>
+ struct NonNullDeleteArrayImpl {
+ static void fastNonNullDeleteArray(void* p)
+ {
+ fastMallocMatchValidateFree(p, Internal::AllocTypeFastNewArray);
+ // No need to destruct the objects in this case.
+ fastFree(p);
+ }
+ };
+
+ // This is a support template for fastDeleteArray.
+ // This handles the case wherein T has a non-trivial dtor.
+ template <typename T>
+ struct NonNullDeleteArrayImpl<T, false> {
+ static void fastNonNullDeleteArray(T* p)
+ {
+ ArraySize<T> a;
+ a.t = p;
+ a.size--;
+
+ T* pEnd = p + *a.size;
+ while (pEnd-- != p)
+ pEnd->~T();
+
+ fastMallocMatchValidateFree(a.size, Internal::AllocTypeFastNewArray);
+ fastFree(a.size);
+ }
+ };
+
+ } // namespace Internal
+
+ template <typename T>
+ void fastNonNullDeleteArray(T* p)
+ {
+ Internal::NonNullDeleteArrayImpl<T, WTF::HasTrivialDestructor<T>::value>::fastNonNullDeleteArray(p);
+ }
+
+
+} // namespace WTF
+
+using WTF::FastAllocBase;
+using WTF::fastDeleteSkippingDestructor;
+
+#endif // FastAllocBase_h
diff --git a/Source/JavaScriptCore/wtf/FastMalloc.cpp b/Source/JavaScriptCore/wtf/FastMalloc.cpp
new file mode 100644
index 0000000..62d7def
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/FastMalloc.cpp
@@ -0,0 +1,4523 @@
+// Copyright (c) 2005, 2007, Google Inc.
+// All rights reserved.
+// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// ---
+// Author: Sanjay Ghemawat <opensource@google.com>
+//
+// A malloc that uses a per-thread cache to satisfy small malloc requests.
+// (The time for malloc/free of a small object drops from 300 ns to 50 ns.)
+//
+// See doc/tcmalloc.html for a high-level
+// description of how this malloc works.
+//
+// SYNCHRONIZATION
+// 1. The thread-specific lists are accessed without acquiring any locks.
+// This is safe because each such list is only accessed by one thread.
+// 2. We have a lock per central free-list, and hold it while manipulating
+// the central free list for a particular size.
+// 3. The central page allocator is protected by "pageheap_lock".
+// 4. The pagemap (which maps from page-number to descriptor),
+// can be read without holding any locks, and written while holding
+// the "pageheap_lock".
+// 5. To improve performance, a subset of the information one can get
+// from the pagemap is cached in a data structure, pagemap_cache_,
+// that atomically reads and writes its entries. This cache can be
+// read and written without locking.
+//
+// This multi-threaded access to the pagemap is safe for fairly
+// subtle reasons. We basically assume that when an object X is
+// allocated by thread A and deallocated by thread B, there must
+// have been appropriate synchronization in the handoff of object
+// X from thread A to thread B. The same logic applies to pagemap_cache_.
+//
+// THE PAGEID-TO-SIZECLASS CACHE
+// Hot PageID-to-sizeclass mappings are held by pagemap_cache_. If this cache
+// returns 0 for a particular PageID then that means "no information," not that
+// the sizeclass is 0. The cache may have stale information for pages that do
+// not hold the beginning of any free()'able object. Staleness is eliminated
+// in Populate() for pages with sizeclass > 0 objects, and in do_malloc() and
+// do_memalign() for all other relevant pages.
+//
+// TODO: Bias reclamation to larger addresses
+// TODO: implement mallinfo/mallopt
+// TODO: Better testing
+//
+// 9/28/2003 (new page-level allocator replaces ptmalloc2):
+// * malloc/free of small objects goes from ~300 ns to ~50 ns.
+// * allocation of a reasonably complicated struct
+// goes from about 1100 ns to about 300 ns.
+
+#include "config.h"
+#include "FastMalloc.h"
+
+#include "Assertions.h"
+#include <limits>
+#if ENABLE(JSC_MULTIPLE_THREADS)
+#include <pthread.h>
+#endif
+#include <wtf/StdLibExtras.h>
+
+#ifndef NO_TCMALLOC_SAMPLES
+#ifdef WTF_CHANGES
+#define NO_TCMALLOC_SAMPLES
+#endif
+#endif
+
+#if !(defined(USE_SYSTEM_MALLOC) && USE_SYSTEM_MALLOC) && defined(NDEBUG)
+#define FORCE_SYSTEM_MALLOC 0
+#else
+#define FORCE_SYSTEM_MALLOC 1
+#endif
+
+// Use a background thread to periodically scavenge memory to release back to the system
+// https://bugs.webkit.org/show_bug.cgi?id=27900: don't turn this on for Tiger until we have figured out why it caused a crash.
+#if defined(BUILDING_ON_TIGER)
+#define USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY 0
+#else
+#define USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY 1
+#endif
+
+#ifndef NDEBUG
+namespace WTF {
+
+#if ENABLE(JSC_MULTIPLE_THREADS)
+static pthread_key_t isForbiddenKey;
+static pthread_once_t isForbiddenKeyOnce = PTHREAD_ONCE_INIT;
+static void initializeIsForbiddenKey()
+{
+ pthread_key_create(&isForbiddenKey, 0);
+}
+
+#if !ASSERT_DISABLED
+static bool isForbidden()
+{
+ pthread_once(&isForbiddenKeyOnce, initializeIsForbiddenKey);
+ return !!pthread_getspecific(isForbiddenKey);
+}
+#endif
+
+void fastMallocForbid()
+{
+ pthread_once(&isForbiddenKeyOnce, initializeIsForbiddenKey);
+ pthread_setspecific(isForbiddenKey, &isForbiddenKey);
+}
+
+void fastMallocAllow()
+{
+ pthread_once(&isForbiddenKeyOnce, initializeIsForbiddenKey);
+ pthread_setspecific(isForbiddenKey, 0);
+}
+
+#else
+
+static bool staticIsForbidden;
+static bool isForbidden()
+{
+ return staticIsForbidden;
+}
+
+void fastMallocForbid()
+{
+ staticIsForbidden = true;
+}
+
+void fastMallocAllow()
+{
+ staticIsForbidden = false;
+}
+#endif // ENABLE(JSC_MULTIPLE_THREADS)
+
+} // namespace WTF
+#endif // NDEBUG
+
+#include <string.h>
+
+namespace WTF {
+
+#if ENABLE(FAST_MALLOC_MATCH_VALIDATION)
+
+namespace Internal {
+
+void fastMallocMatchFailed(void*)
+{
+ CRASH();
+}
+
+} // namespace Internal
+
+#endif
+
+void* fastZeroedMalloc(size_t n)
+{
+ void* result = fastMalloc(n);
+ memset(result, 0, n);
+ return result;
+}
+
+char* fastStrDup(const char* src)
+{
+ int len = strlen(src) + 1;
+ char* dup = static_cast<char*>(fastMalloc(len));
+
+ if (dup)
+ memcpy(dup, src, len);
+
+ return dup;
+}
+
+TryMallocReturnValue tryFastZeroedMalloc(size_t n)
+{
+ void* result;
+ if (!tryFastMalloc(n).getValue(result))
+ return 0;
+ memset(result, 0, n);
+ return result;
+}
+
+} // namespace WTF
+
+#if FORCE_SYSTEM_MALLOC
+
+#if PLATFORM(BREWMP)
+#include "brew/SystemMallocBrew.h"
+#endif
+
+#if OS(DARWIN)
+#include <malloc/malloc.h>
+#elif OS(WINDOWS)
+#include <malloc.h>
+#endif
+
+namespace WTF {
+
+TryMallocReturnValue tryFastMalloc(size_t n)
+{
+ ASSERT(!isForbidden());
+
+#if ENABLE(FAST_MALLOC_MATCH_VALIDATION)
+ if (std::numeric_limits<size_t>::max() - sizeof(AllocAlignmentInteger) <= n) // If overflow would occur...
+ return 0;
+
+ void* result = malloc(n + sizeof(AllocAlignmentInteger));
+ if (!result)
+ return 0;
+
+ *static_cast<AllocAlignmentInteger*>(result) = Internal::AllocTypeMalloc;
+ result = static_cast<AllocAlignmentInteger*>(result) + 1;
+
+ return result;
+#else
+ return malloc(n);
+#endif
+}
+
+void* fastMalloc(size_t n)
+{
+ ASSERT(!isForbidden());
+
+#if ENABLE(FAST_MALLOC_MATCH_VALIDATION)
+ TryMallocReturnValue returnValue = tryFastMalloc(n);
+ void* result;
+ returnValue.getValue(result);
+#else
+ void* result = malloc(n);
+#endif
+
+ if (!result) {
+#if PLATFORM(BREWMP)
+ // The behavior of malloc(0) is implementation defined.
+ // To make sure that fastMalloc never returns 0, retry with fastMalloc(1).
+ if (!n)
+ return fastMalloc(1);
+#endif
+ CRASH();
+ }
+
+ return result;
+}
+
+TryMallocReturnValue tryFastCalloc(size_t n_elements, size_t element_size)
+{
+ ASSERT(!isForbidden());
+
+#if ENABLE(FAST_MALLOC_MATCH_VALIDATION)
+ size_t totalBytes = n_elements * element_size;
+ if (n_elements > 1 && element_size && (totalBytes / element_size) != n_elements || (std::numeric_limits<size_t>::max() - sizeof(AllocAlignmentInteger) <= totalBytes))
+ return 0;
+
+ totalBytes += sizeof(AllocAlignmentInteger);
+ void* result = malloc(totalBytes);
+ if (!result)
+ return 0;
+
+ memset(result, 0, totalBytes);
+ *static_cast<AllocAlignmentInteger*>(result) = Internal::AllocTypeMalloc;
+ result = static_cast<AllocAlignmentInteger*>(result) + 1;
+ return result;
+#else
+ return calloc(n_elements, element_size);
+#endif
+}
+
+void* fastCalloc(size_t n_elements, size_t element_size)
+{
+ ASSERT(!isForbidden());
+
+#if ENABLE(FAST_MALLOC_MATCH_VALIDATION)
+ TryMallocReturnValue returnValue = tryFastCalloc(n_elements, element_size);
+ void* result;
+ returnValue.getValue(result);
+#else
+ void* result = calloc(n_elements, element_size);
+#endif
+
+ if (!result) {
+#if PLATFORM(BREWMP)
+ // If either n_elements or element_size is 0, the behavior of calloc is implementation defined.
+ // To make sure that fastCalloc never returns 0, retry with fastCalloc(1, 1).
+ if (!n_elements || !element_size)
+ return fastCalloc(1, 1);
+#endif
+ CRASH();
+ }
+
+ return result;
+}
+
+void fastFree(void* p)
+{
+ ASSERT(!isForbidden());
+
+#if ENABLE(FAST_MALLOC_MATCH_VALIDATION)
+ if (!p)
+ return;
+
+ AllocAlignmentInteger* header = Internal::fastMallocMatchValidationValue(p);
+ if (*header != Internal::AllocTypeMalloc)
+ Internal::fastMallocMatchFailed(p);
+ free(header);
+#else
+ free(p);
+#endif
+}
+
+TryMallocReturnValue tryFastRealloc(void* p, size_t n)
+{
+ ASSERT(!isForbidden());
+
+#if ENABLE(FAST_MALLOC_MATCH_VALIDATION)
+ if (p) {
+ if (std::numeric_limits<size_t>::max() - sizeof(AllocAlignmentInteger) <= n) // If overflow would occur...
+ return 0;
+ AllocAlignmentInteger* header = Internal::fastMallocMatchValidationValue(p);
+ if (*header != Internal::AllocTypeMalloc)
+ Internal::fastMallocMatchFailed(p);
+ void* result = realloc(header, n + sizeof(AllocAlignmentInteger));
+ if (!result)
+ return 0;
+
+ // This should not be needed because the value is already there:
+ // *static_cast<AllocAlignmentInteger*>(result) = Internal::AllocTypeMalloc;
+ result = static_cast<AllocAlignmentInteger*>(result) + 1;
+ return result;
+ } else {
+ return fastMalloc(n);
+ }
+#else
+ return realloc(p, n);
+#endif
+}
+
+void* fastRealloc(void* p, size_t n)
+{
+ ASSERT(!isForbidden());
+
+#if ENABLE(FAST_MALLOC_MATCH_VALIDATION)
+ TryMallocReturnValue returnValue = tryFastRealloc(p, n);
+ void* result;
+ returnValue.getValue(result);
+#else
+ void* result = realloc(p, n);
+#endif
+
+ if (!result)
+ CRASH();
+ return result;
+}
+
+void releaseFastMallocFreeMemory() { }
+
+FastMallocStatistics fastMallocStatistics()
+{
+ FastMallocStatistics statistics = { 0, 0, 0 };
+ return statistics;
+}
+
+size_t fastMallocSize(const void* p)
+{
+#if OS(DARWIN)
+ return malloc_size(p);
+#elif OS(WINDOWS) && !PLATFORM(BREWMP)
+ // Brew MP uses its own memory allocator, so _msize does not work on the Brew MP simulator.
+ return _msize(const_cast<void*>(p));
+#else
+ return 1;
+#endif
+}
+
+} // namespace WTF
+
+#if OS(DARWIN)
+// This symbol is present in the JavaScriptCore exports file even when FastMalloc is disabled.
+// It will never be used in this case, so it's type and value are less interesting than its presence.
+extern "C" const int jscore_fastmalloc_introspection = 0;
+#endif
+
+#else // FORCE_SYSTEM_MALLOC
+
+#if HAVE(STDINT_H)
+#include <stdint.h>
+#elif HAVE(INTTYPES_H)
+#include <inttypes.h>
+#else
+#include <sys/types.h>
+#endif
+
+#include "AlwaysInline.h"
+#include "Assertions.h"
+#include "TCPackedCache.h"
+#include "TCPageMap.h"
+#include "TCSpinLock.h"
+#include "TCSystemAlloc.h"
+#include <algorithm>
+#include <limits>
+#include <pthread.h>
+#include <stdarg.h>
+#include <stddef.h>
+#include <stdio.h>
+#if HAVE(ERRNO_H)
+#include <errno.h>
+#endif
+#if OS(UNIX)
+#include <unistd.h>
+#endif
+#if OS(WINDOWS)
+#ifndef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN
+#endif
+#include <windows.h>
+#endif
+
+#ifdef WTF_CHANGES
+
+#if OS(DARWIN)
+#include "MallocZoneSupport.h"
+#include <wtf/HashSet.h>
+#include <wtf/Vector.h>
+#endif
+#if HAVE(DISPATCH_H)
+#include <dispatch/dispatch.h>
+#endif
+
+
+#ifndef PRIuS
+#define PRIuS "zu"
+#endif
+
+// Calling pthread_getspecific through a global function pointer is faster than a normal
+// call to the function on Mac OS X, and it's used in performance-critical code. So we
+// use a function pointer. But that's not necessarily faster on other platforms, and we had
+// problems with this technique on Windows, so we'll do this only on Mac OS X.
+#if OS(DARWIN)
+static void* (*pthread_getspecific_function_pointer)(pthread_key_t) = pthread_getspecific;
+#define pthread_getspecific(key) pthread_getspecific_function_pointer(key)
+#endif
+
+#define DEFINE_VARIABLE(type, name, value, meaning) \
+ namespace FLAG__namespace_do_not_use_directly_use_DECLARE_##type##_instead { \
+ type FLAGS_##name(value); \
+ char FLAGS_no##name; \
+ } \
+ using FLAG__namespace_do_not_use_directly_use_DECLARE_##type##_instead::FLAGS_##name
+
+#define DEFINE_int64(name, value, meaning) \
+ DEFINE_VARIABLE(int64_t, name, value, meaning)
+
+#define DEFINE_double(name, value, meaning) \
+ DEFINE_VARIABLE(double, name, value, meaning)
+
+namespace WTF {
+
+#define malloc fastMalloc
+#define calloc fastCalloc
+#define free fastFree
+#define realloc fastRealloc
+
+#define MESSAGE LOG_ERROR
+#define CHECK_CONDITION ASSERT
+
+#if OS(DARWIN)
+struct Span;
+class TCMalloc_Central_FreeListPadded;
+class TCMalloc_PageHeap;
+class TCMalloc_ThreadCache;
+template <typename T> class PageHeapAllocator;
+
+class FastMallocZone {
+public:
+ static void init();
+
+ static kern_return_t enumerate(task_t, void*, unsigned typeMmask, vm_address_t zoneAddress, memory_reader_t, vm_range_recorder_t);
+ static size_t goodSize(malloc_zone_t*, size_t size) { return size; }
+ static boolean_t check(malloc_zone_t*) { return true; }
+ static void print(malloc_zone_t*, boolean_t) { }
+ static void log(malloc_zone_t*, void*) { }
+ static void forceLock(malloc_zone_t*) { }
+ static void forceUnlock(malloc_zone_t*) { }
+ static void statistics(malloc_zone_t*, malloc_statistics_t* stats) { memset(stats, 0, sizeof(malloc_statistics_t)); }
+
+private:
+ FastMallocZone(TCMalloc_PageHeap*, TCMalloc_ThreadCache**, TCMalloc_Central_FreeListPadded*, PageHeapAllocator<Span>*, PageHeapAllocator<TCMalloc_ThreadCache>*);
+ static size_t size(malloc_zone_t*, const void*);
+ static void* zoneMalloc(malloc_zone_t*, size_t);
+ static void* zoneCalloc(malloc_zone_t*, size_t numItems, size_t size);
+ static void zoneFree(malloc_zone_t*, void*);
+ static void* zoneRealloc(malloc_zone_t*, void*, size_t);
+ static void* zoneValloc(malloc_zone_t*, size_t) { LOG_ERROR("valloc is not supported"); return 0; }
+ static void zoneDestroy(malloc_zone_t*) { }
+
+ malloc_zone_t m_zone;
+ TCMalloc_PageHeap* m_pageHeap;
+ TCMalloc_ThreadCache** m_threadHeaps;
+ TCMalloc_Central_FreeListPadded* m_centralCaches;
+ PageHeapAllocator<Span>* m_spanAllocator;
+ PageHeapAllocator<TCMalloc_ThreadCache>* m_pageHeapAllocator;
+};
+
+#endif
+
+#endif
+
+#ifndef WTF_CHANGES
+// This #ifdef should almost never be set. Set NO_TCMALLOC_SAMPLES if
+// you're porting to a system where you really can't get a stacktrace.
+#ifdef NO_TCMALLOC_SAMPLES
+// We use #define so code compiles even if you #include stacktrace.h somehow.
+# define GetStackTrace(stack, depth, skip) (0)
+#else
+# include <google/stacktrace.h>
+#endif
+#endif
+
+// Even if we have support for thread-local storage in the compiler
+// and linker, the OS may not support it. We need to check that at
+// runtime. Right now, we have to keep a manual set of "bad" OSes.
+#if defined(HAVE_TLS)
+ static bool kernel_supports_tls = false; // be conservative
+ static inline bool KernelSupportsTLS() {
+ return kernel_supports_tls;
+ }
+# if !HAVE_DECL_UNAME // if too old for uname, probably too old for TLS
+ static void CheckIfKernelSupportsTLS() {
+ kernel_supports_tls = false;
+ }
+# else
+# include <sys/utsname.h> // DECL_UNAME checked for <sys/utsname.h> too
+ static void CheckIfKernelSupportsTLS() {
+ struct utsname buf;
+ if (uname(&buf) != 0) { // should be impossible
+ MESSAGE("uname failed assuming no TLS support (errno=%d)\n", errno);
+ kernel_supports_tls = false;
+ } else if (strcasecmp(buf.sysname, "linux") == 0) {
+ // The linux case: the first kernel to support TLS was 2.6.0
+ if (buf.release[0] < '2' && buf.release[1] == '.') // 0.x or 1.x
+ kernel_supports_tls = false;
+ else if (buf.release[0] == '2' && buf.release[1] == '.' &&
+ buf.release[2] >= '0' && buf.release[2] < '6' &&
+ buf.release[3] == '.') // 2.0 - 2.5
+ kernel_supports_tls = false;
+ else
+ kernel_supports_tls = true;
+ } else { // some other kernel, we'll be optimisitic
+ kernel_supports_tls = true;
+ }
+ // TODO(csilvers): VLOG(1) the tls status once we support RAW_VLOG
+ }
+# endif // HAVE_DECL_UNAME
+#endif // HAVE_TLS
+
+// __THROW is defined in glibc systems. It means, counter-intuitively,
+// "This function will never throw an exception." It's an optional
+// optimization tool, but we may need to use it to match glibc prototypes.
+#ifndef __THROW // I guess we're not on a glibc system
+# define __THROW // __THROW is just an optimization, so ok to make it ""
+#endif
+
+//-------------------------------------------------------------------
+// Configuration
+//-------------------------------------------------------------------
+
+// Not all possible combinations of the following parameters make
+// sense. In particular, if kMaxSize increases, you may have to
+// increase kNumClasses as well.
+static const size_t kPageShift = 12;
+static const size_t kPageSize = 1 << kPageShift;
+static const size_t kMaxSize = 8u * kPageSize;
+static const size_t kAlignShift = 3;
+static const size_t kAlignment = 1 << kAlignShift;
+static const size_t kNumClasses = 68;
+
+// Allocates a big block of memory for the pagemap once we reach more than
+// 128MB
+static const size_t kPageMapBigAllocationThreshold = 128 << 20;
+
+// Minimum number of pages to fetch from system at a time. Must be
+// significantly bigger than kPageSize to amortize system-call
+// overhead, and also to reduce external fragementation. Also, we
+// should keep this value big because various incarnations of Linux
+// have small limits on the number of mmap() regions per
+// address-space.
+static const size_t kMinSystemAlloc = 1 << (20 - kPageShift);
+
+// Number of objects to move between a per-thread list and a central
+// list in one shot. We want this to be not too small so we can
+// amortize the lock overhead for accessing the central list. Making
+// it too big may temporarily cause unnecessary memory wastage in the
+// per-thread free list until the scavenger cleans up the list.
+static int num_objects_to_move[kNumClasses];
+
+// Maximum length we allow a per-thread free-list to have before we
+// move objects from it into the corresponding central free-list. We
+// want this big to avoid locking the central free-list too often. It
+// should not hurt to make this list somewhat big because the
+// scavenging code will shrink it down when its contents are not in use.
+static const int kMaxFreeListLength = 256;
+
+// Lower and upper bounds on the per-thread cache sizes
+static const size_t kMinThreadCacheSize = kMaxSize * 2;
+static const size_t kMaxThreadCacheSize = 2 << 20;
+
+// Default bound on the total amount of thread caches
+static const size_t kDefaultOverallThreadCacheSize = 16 << 20;
+
+// For all span-lengths < kMaxPages we keep an exact-size list.
+// REQUIRED: kMaxPages >= kMinSystemAlloc;
+static const size_t kMaxPages = kMinSystemAlloc;
+
+/* The smallest prime > 2^n */
+static int primes_list[] = {
+ // Small values might cause high rates of sampling
+ // and hence commented out.
+ // 2, 5, 11, 17, 37, 67, 131, 257,
+ // 521, 1031, 2053, 4099, 8209, 16411,
+ 32771, 65537, 131101, 262147, 524309, 1048583,
+ 2097169, 4194319, 8388617, 16777259, 33554467 };
+
+// Twice the approximate gap between sampling actions.
+// I.e., we take one sample approximately once every
+// tcmalloc_sample_parameter/2
+// bytes of allocation, i.e., ~ once every 128KB.
+// Must be a prime number.
+#ifdef NO_TCMALLOC_SAMPLES
+DEFINE_int64(tcmalloc_sample_parameter, 0,
+ "Unused: code is compiled with NO_TCMALLOC_SAMPLES");
+static size_t sample_period = 0;
+#else
+DEFINE_int64(tcmalloc_sample_parameter, 262147,
+ "Twice the approximate gap between sampling actions."
+ " Must be a prime number. Otherwise will be rounded up to a "
+ " larger prime number");
+static size_t sample_period = 262147;
+#endif
+
+// Protects sample_period above
+static SpinLock sample_period_lock = SPINLOCK_INITIALIZER;
+
+// Parameters for controlling how fast memory is returned to the OS.
+
+DEFINE_double(tcmalloc_release_rate, 1,
+ "Rate at which we release unused memory to the system. "
+ "Zero means we never release memory back to the system. "
+ "Increase this flag to return memory faster; decrease it "
+ "to return memory slower. Reasonable rates are in the "
+ "range [0,10]");
+
+//-------------------------------------------------------------------
+// Mapping from size to size_class and vice versa
+//-------------------------------------------------------------------
+
+// Sizes <= 1024 have an alignment >= 8. So for such sizes we have an
+// array indexed by ceil(size/8). Sizes > 1024 have an alignment >= 128.
+// So for these larger sizes we have an array indexed by ceil(size/128).
+//
+// We flatten both logical arrays into one physical array and use
+// arithmetic to compute an appropriate index. The constants used by
+// ClassIndex() were selected to make the flattening work.
+//
+// Examples:
+// Size Expression Index
+// -------------------------------------------------------
+// 0 (0 + 7) / 8 0
+// 1 (1 + 7) / 8 1
+// ...
+// 1024 (1024 + 7) / 8 128
+// 1025 (1025 + 127 + (120<<7)) / 128 129
+// ...
+// 32768 (32768 + 127 + (120<<7)) / 128 376
+static const size_t kMaxSmallSize = 1024;
+static const int shift_amount[2] = { 3, 7 }; // For divides by 8 or 128
+static const int add_amount[2] = { 7, 127 + (120 << 7) };
+static unsigned char class_array[377];
+
+// Compute index of the class_array[] entry for a given size
+static inline int ClassIndex(size_t s) {
+ const int i = (s > kMaxSmallSize);
+ return static_cast<int>((s + add_amount[i]) >> shift_amount[i]);
+}
+
+// Mapping from size class to max size storable in that class
+static size_t class_to_size[kNumClasses];
+
+// Mapping from size class to number of pages to allocate at a time
+static size_t class_to_pages[kNumClasses];
+
+// TransferCache is used to cache transfers of num_objects_to_move[size_class]
+// back and forth between thread caches and the central cache for a given size
+// class.
+struct TCEntry {
+ void *head; // Head of chain of objects.
+ void *tail; // Tail of chain of objects.
+};
+// A central cache freelist can have anywhere from 0 to kNumTransferEntries
+// slots to put link list chains into. To keep memory usage bounded the total
+// number of TCEntries across size classes is fixed. Currently each size
+// class is initially given one TCEntry which also means that the maximum any
+// one class can have is kNumClasses.
+static const int kNumTransferEntries = kNumClasses;
+
+// Note: the following only works for "n"s that fit in 32-bits, but
+// that is fine since we only use it for small sizes.
+static inline int LgFloor(size_t n) {
+ int log = 0;
+ for (int i = 4; i >= 0; --i) {
+ int shift = (1 << i);
+ size_t x = n >> shift;
+ if (x != 0) {
+ n = x;
+ log += shift;
+ }
+ }
+ ASSERT(n == 1);
+ return log;
+}
+
+// Some very basic linked list functions for dealing with using void * as
+// storage.
+
+static inline void *SLL_Next(void *t) {
+ return *(reinterpret_cast<void**>(t));
+}
+
+static inline void SLL_SetNext(void *t, void *n) {
+ *(reinterpret_cast<void**>(t)) = n;
+}
+
+static inline void SLL_Push(void **list, void *element) {
+ SLL_SetNext(element, *list);
+ *list = element;
+}
+
+static inline void *SLL_Pop(void **list) {
+ void *result = *list;
+ *list = SLL_Next(*list);
+ return result;
+}
+
+
+// Remove N elements from a linked list to which head points. head will be
+// modified to point to the new head. start and end will point to the first
+// and last nodes of the range. Note that end will point to NULL after this
+// function is called.
+static inline void SLL_PopRange(void **head, int N, void **start, void **end) {
+ if (N == 0) {
+ *start = NULL;
+ *end = NULL;
+ return;
+ }
+
+ void *tmp = *head;
+ for (int i = 1; i < N; ++i) {
+ tmp = SLL_Next(tmp);
+ }
+
+ *start = *head;
+ *end = tmp;
+ *head = SLL_Next(tmp);
+ // Unlink range from list.
+ SLL_SetNext(tmp, NULL);
+}
+
+static inline void SLL_PushRange(void **head, void *start, void *end) {
+ if (!start) return;
+ SLL_SetNext(end, *head);
+ *head = start;
+}
+
+static inline size_t SLL_Size(void *head) {
+ int count = 0;
+ while (head) {
+ count++;
+ head = SLL_Next(head);
+ }
+ return count;
+}
+
+// Setup helper functions.
+
+static ALWAYS_INLINE size_t SizeClass(size_t size) {
+ return class_array[ClassIndex(size)];
+}
+
+// Get the byte-size for a specified class
+static ALWAYS_INLINE size_t ByteSizeForClass(size_t cl) {
+ return class_to_size[cl];
+}
+static int NumMoveSize(size_t size) {
+ if (size == 0) return 0;
+ // Use approx 64k transfers between thread and central caches.
+ int num = static_cast<int>(64.0 * 1024.0 / size);
+ if (num < 2) num = 2;
+ // Clamp well below kMaxFreeListLength to avoid ping pong between central
+ // and thread caches.
+ if (num > static_cast<int>(0.8 * kMaxFreeListLength))
+ num = static_cast<int>(0.8 * kMaxFreeListLength);
+
+ // Also, avoid bringing in too many objects into small object free
+ // lists. There are lots of such lists, and if we allow each one to
+ // fetch too many at a time, we end up having to scavenge too often
+ // (especially when there are lots of threads and each thread gets a
+ // small allowance for its thread cache).
+ //
+ // TODO: Make thread cache free list sizes dynamic so that we do not
+ // have to equally divide a fixed resource amongst lots of threads.
+ if (num > 32) num = 32;
+
+ return num;
+}
+
+// Initialize the mapping arrays
+static void InitSizeClasses() {
+ // Do some sanity checking on add_amount[]/shift_amount[]/class_array[]
+ if (ClassIndex(0) < 0) {
+ MESSAGE("Invalid class index %d for size 0\n", ClassIndex(0));
+ CRASH();
+ }
+ if (static_cast<size_t>(ClassIndex(kMaxSize)) >= sizeof(class_array)) {
+ MESSAGE("Invalid class index %d for kMaxSize\n", ClassIndex(kMaxSize));
+ CRASH();
+ }
+
+ // Compute the size classes we want to use
+ size_t sc = 1; // Next size class to assign
+ unsigned char alignshift = kAlignShift;
+ int last_lg = -1;
+ for (size_t size = kAlignment; size <= kMaxSize; size += (1 << alignshift)) {
+ int lg = LgFloor(size);
+ if (lg > last_lg) {
+ // Increase alignment every so often.
+ //
+ // Since we double the alignment every time size doubles and
+ // size >= 128, this means that space wasted due to alignment is
+ // at most 16/128 i.e., 12.5%. Plus we cap the alignment at 256
+ // bytes, so the space wasted as a percentage starts falling for
+ // sizes > 2K.
+ if ((lg >= 7) && (alignshift < 8)) {
+ alignshift++;
+ }
+ last_lg = lg;
+ }
+
+ // Allocate enough pages so leftover is less than 1/8 of total.
+ // This bounds wasted space to at most 12.5%.
+ size_t psize = kPageSize;
+ while ((psize % size) > (psize >> 3)) {
+ psize += kPageSize;
+ }
+ const size_t my_pages = psize >> kPageShift;
+
+ if (sc > 1 && my_pages == class_to_pages[sc-1]) {
+ // See if we can merge this into the previous class without
+ // increasing the fragmentation of the previous class.
+ const size_t my_objects = (my_pages << kPageShift) / size;
+ const size_t prev_objects = (class_to_pages[sc-1] << kPageShift)
+ / class_to_size[sc-1];
+ if (my_objects == prev_objects) {
+ // Adjust last class to include this size
+ class_to_size[sc-1] = size;
+ continue;
+ }
+ }
+
+ // Add new class
+ class_to_pages[sc] = my_pages;
+ class_to_size[sc] = size;
+ sc++;
+ }
+ if (sc != kNumClasses) {
+ MESSAGE("wrong number of size classes: found %" PRIuS " instead of %d\n",
+ sc, int(kNumClasses));
+ CRASH();
+ }
+
+ // Initialize the mapping arrays
+ int next_size = 0;
+ for (unsigned char c = 1; c < kNumClasses; c++) {
+ const size_t max_size_in_class = class_to_size[c];
+ for (size_t s = next_size; s <= max_size_in_class; s += kAlignment) {
+ class_array[ClassIndex(s)] = c;
+ }
+ next_size = static_cast<int>(max_size_in_class + kAlignment);
+ }
+
+ // Double-check sizes just to be safe
+ for (size_t size = 0; size <= kMaxSize; size++) {
+ const size_t sc = SizeClass(size);
+ if (sc == 0) {
+ MESSAGE("Bad size class %" PRIuS " for %" PRIuS "\n", sc, size);
+ CRASH();
+ }
+ if (sc > 1 && size <= class_to_size[sc-1]) {
+ MESSAGE("Allocating unnecessarily large class %" PRIuS " for %" PRIuS
+ "\n", sc, size);
+ CRASH();
+ }
+ if (sc >= kNumClasses) {
+ MESSAGE("Bad size class %" PRIuS " for %" PRIuS "\n", sc, size);
+ CRASH();
+ }
+ const size_t s = class_to_size[sc];
+ if (size > s) {
+ MESSAGE("Bad size %" PRIuS " for %" PRIuS " (sc = %" PRIuS ")\n", s, size, sc);
+ CRASH();
+ }
+ if (s == 0) {
+ MESSAGE("Bad size %" PRIuS " for %" PRIuS " (sc = %" PRIuS ")\n", s, size, sc);
+ CRASH();
+ }
+ }
+
+ // Initialize the num_objects_to_move array.
+ for (size_t cl = 1; cl < kNumClasses; ++cl) {
+ num_objects_to_move[cl] = NumMoveSize(ByteSizeForClass(cl));
+ }
+
+#ifndef WTF_CHANGES
+ if (false) {
+ // Dump class sizes and maximum external wastage per size class
+ for (size_t cl = 1; cl < kNumClasses; ++cl) {
+ const int alloc_size = class_to_pages[cl] << kPageShift;
+ const int alloc_objs = alloc_size / class_to_size[cl];
+ const int min_used = (class_to_size[cl-1] + 1) * alloc_objs;
+ const int max_waste = alloc_size - min_used;
+ MESSAGE("SC %3d [ %8d .. %8d ] from %8d ; %2.0f%% maxwaste\n",
+ int(cl),
+ int(class_to_size[cl-1] + 1),
+ int(class_to_size[cl]),
+ int(class_to_pages[cl] << kPageShift),
+ max_waste * 100.0 / alloc_size
+ );
+ }
+ }
+#endif
+}
+
+// -------------------------------------------------------------------------
+// Simple allocator for objects of a specified type. External locking
+// is required before accessing one of these objects.
+// -------------------------------------------------------------------------
+
+// Metadata allocator -- keeps stats about how many bytes allocated
+static uint64_t metadata_system_bytes = 0;
+static void* MetaDataAlloc(size_t bytes) {
+ void* result = TCMalloc_SystemAlloc(bytes, 0);
+ if (result != NULL) {
+ metadata_system_bytes += bytes;
+ }
+ return result;
+}
+
+template <class T>
+class PageHeapAllocator {
+ private:
+ // How much to allocate from system at a time
+ static const size_t kAllocIncrement = 32 << 10;
+
+ // Aligned size of T
+ static const size_t kAlignedSize
+ = (((sizeof(T) + kAlignment - 1) / kAlignment) * kAlignment);
+
+ // Free area from which to carve new objects
+ char* free_area_;
+ size_t free_avail_;
+
+ // Linked list of all regions allocated by this allocator
+ void* allocated_regions_;
+
+ // Free list of already carved objects
+ void* free_list_;
+
+ // Number of allocated but unfreed objects
+ int inuse_;
+
+ public:
+ void Init() {
+ ASSERT(kAlignedSize <= kAllocIncrement);
+ inuse_ = 0;
+ allocated_regions_ = 0;
+ free_area_ = NULL;
+ free_avail_ = 0;
+ free_list_ = NULL;
+ }
+
+ T* New() {
+ // Consult free list
+ void* result;
+ if (free_list_ != NULL) {
+ result = free_list_;
+ free_list_ = *(reinterpret_cast<void**>(result));
+ } else {
+ if (free_avail_ < kAlignedSize) {
+ // Need more room
+ char* new_allocation = reinterpret_cast<char*>(MetaDataAlloc(kAllocIncrement));
+ if (!new_allocation)
+ CRASH();
+
+ *reinterpret_cast_ptr<void**>(new_allocation) = allocated_regions_;
+ allocated_regions_ = new_allocation;
+ free_area_ = new_allocation + kAlignedSize;
+ free_avail_ = kAllocIncrement - kAlignedSize;
+ }
+ result = free_area_;
+ free_area_ += kAlignedSize;
+ free_avail_ -= kAlignedSize;
+ }
+ inuse_++;
+ return reinterpret_cast<T*>(result);
+ }
+
+ void Delete(T* p) {
+ *(reinterpret_cast<void**>(p)) = free_list_;
+ free_list_ = p;
+ inuse_--;
+ }
+
+ int inuse() const { return inuse_; }
+
+#if defined(WTF_CHANGES) && OS(DARWIN)
+ template <class Recorder>
+ void recordAdministrativeRegions(Recorder& recorder, const RemoteMemoryReader& reader)
+ {
+ vm_address_t adminAllocation = reinterpret_cast<vm_address_t>(allocated_regions_);
+ while (adminAllocation) {
+ recorder.recordRegion(adminAllocation, kAllocIncrement);
+ adminAllocation = *reader(reinterpret_cast<vm_address_t*>(adminAllocation));
+ }
+ }
+#endif
+};
+
+// -------------------------------------------------------------------------
+// Span - a contiguous run of pages
+// -------------------------------------------------------------------------
+
+// Type that can hold a page number
+typedef uintptr_t PageID;
+
+// Type that can hold the length of a run of pages
+typedef uintptr_t Length;
+
+static const Length kMaxValidPages = (~static_cast<Length>(0)) >> kPageShift;
+
+// Convert byte size into pages. This won't overflow, but may return
+// an unreasonably large value if bytes is huge enough.
+static inline Length pages(size_t bytes) {
+ return (bytes >> kPageShift) +
+ ((bytes & (kPageSize - 1)) > 0 ? 1 : 0);
+}
+
+// Convert a user size into the number of bytes that will actually be
+// allocated
+static size_t AllocationSize(size_t bytes) {
+ if (bytes > kMaxSize) {
+ // Large object: we allocate an integral number of pages
+ ASSERT(bytes <= (kMaxValidPages << kPageShift));
+ return pages(bytes) << kPageShift;
+ } else {
+ // Small object: find the size class to which it belongs
+ return ByteSizeForClass(SizeClass(bytes));
+ }
+}
+
+// Information kept for a span (a contiguous run of pages).
+struct Span {
+ PageID start; // Starting page number
+ Length length; // Number of pages in span
+ Span* next; // Used when in link list
+ Span* prev; // Used when in link list
+ void* objects; // Linked list of free objects
+ unsigned int free : 1; // Is the span free
+#ifndef NO_TCMALLOC_SAMPLES
+ unsigned int sample : 1; // Sampled object?
+#endif
+ unsigned int sizeclass : 8; // Size-class for small objects (or 0)
+ unsigned int refcount : 11; // Number of non-free objects
+ bool decommitted : 1;
+
+#undef SPAN_HISTORY
+#ifdef SPAN_HISTORY
+ // For debugging, we can keep a log events per span
+ int nexthistory;
+ char history[64];
+ int value[64];
+#endif
+};
+
+#define ASSERT_SPAN_COMMITTED(span) ASSERT(!span->decommitted)
+
+#ifdef SPAN_HISTORY
+void Event(Span* span, char op, int v = 0) {
+ span->history[span->nexthistory] = op;
+ span->value[span->nexthistory] = v;
+ span->nexthistory++;
+ if (span->nexthistory == sizeof(span->history)) span->nexthistory = 0;
+}
+#else
+#define Event(s,o,v) ((void) 0)
+#endif
+
+// Allocator/deallocator for spans
+static PageHeapAllocator<Span> span_allocator;
+static Span* NewSpan(PageID p, Length len) {
+ Span* result = span_allocator.New();
+ memset(result, 0, sizeof(*result));
+ result->start = p;
+ result->length = len;
+#ifdef SPAN_HISTORY
+ result->nexthistory = 0;
+#endif
+ return result;
+}
+
+static inline void DeleteSpan(Span* span) {
+#ifndef NDEBUG
+ // In debug mode, trash the contents of deleted Spans
+ memset(span, 0x3f, sizeof(*span));
+#endif
+ span_allocator.Delete(span);
+}
+
+// -------------------------------------------------------------------------
+// Doubly linked list of spans.
+// -------------------------------------------------------------------------
+
+static inline void DLL_Init(Span* list) {
+ list->next = list;
+ list->prev = list;
+}
+
+static inline void DLL_Remove(Span* span) {
+ span->prev->next = span->next;
+ span->next->prev = span->prev;
+ span->prev = NULL;
+ span->next = NULL;
+}
+
+static ALWAYS_INLINE bool DLL_IsEmpty(const Span* list) {
+ return list->next == list;
+}
+
+static int DLL_Length(const Span* list) {
+ int result = 0;
+ for (Span* s = list->next; s != list; s = s->next) {
+ result++;
+ }
+ return result;
+}
+
+#if 0 /* Not needed at the moment -- causes compiler warnings if not used */
+static void DLL_Print(const char* label, const Span* list) {
+ MESSAGE("%-10s %p:", label, list);
+ for (const Span* s = list->next; s != list; s = s->next) {
+ MESSAGE(" <%p,%u,%u>", s, s->start, s->length);
+ }
+ MESSAGE("\n");
+}
+#endif
+
+static inline void DLL_Prepend(Span* list, Span* span) {
+ ASSERT(span->next == NULL);
+ ASSERT(span->prev == NULL);
+ span->next = list->next;
+ span->prev = list;
+ list->next->prev = span;
+ list->next = span;
+}
+
+// -------------------------------------------------------------------------
+// Stack traces kept for sampled allocations
+// The following state is protected by pageheap_lock_.
+// -------------------------------------------------------------------------
+
+// size/depth are made the same size as a pointer so that some generic
+// code below can conveniently cast them back and forth to void*.
+static const int kMaxStackDepth = 31;
+struct StackTrace {
+ uintptr_t size; // Size of object
+ uintptr_t depth; // Number of PC values stored in array below
+ void* stack[kMaxStackDepth];
+};
+static PageHeapAllocator<StackTrace> stacktrace_allocator;
+static Span sampled_objects;
+
+// -------------------------------------------------------------------------
+// Map from page-id to per-page data
+// -------------------------------------------------------------------------
+
+// We use PageMap2<> for 32-bit and PageMap3<> for 64-bit machines.
+// We also use a simple one-level cache for hot PageID-to-sizeclass mappings,
+// because sometimes the sizeclass is all the information we need.
+
+// Selector class -- general selector uses 3-level map
+template <int BITS> class MapSelector {
+ public:
+ typedef TCMalloc_PageMap3<BITS-kPageShift> Type;
+ typedef PackedCache<BITS, uint64_t> CacheType;
+};
+
+#if defined(WTF_CHANGES)
+#if CPU(X86_64)
+// On all known X86-64 platforms, the upper 16 bits are always unused and therefore
+// can be excluded from the PageMap key.
+// See http://en.wikipedia.org/wiki/X86-64#Virtual_address_space_details
+
+static const size_t kBitsUnusedOn64Bit = 16;
+#else
+static const size_t kBitsUnusedOn64Bit = 0;
+#endif
+
+// A three-level map for 64-bit machines
+template <> class MapSelector<64> {
+ public:
+ typedef TCMalloc_PageMap3<64 - kPageShift - kBitsUnusedOn64Bit> Type;
+ typedef PackedCache<64, uint64_t> CacheType;
+};
+#endif
+
+// A two-level map for 32-bit machines
+template <> class MapSelector<32> {
+ public:
+ typedef TCMalloc_PageMap2<32 - kPageShift> Type;
+ typedef PackedCache<32 - kPageShift, uint16_t> CacheType;
+};
+
+// -------------------------------------------------------------------------
+// Page-level allocator
+// * Eager coalescing
+//
+// Heap for page-level allocation. We allow allocating and freeing a
+// contiguous runs of pages (called a "span").
+// -------------------------------------------------------------------------
+
+#if USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY
+// The page heap maintains a free list for spans that are no longer in use by
+// the central cache or any thread caches. We use a background thread to
+// periodically scan the free list and release a percentage of it back to the OS.
+
+// If free_committed_pages_ exceeds kMinimumFreeCommittedPageCount, the
+// background thread:
+// - wakes up
+// - pauses for kScavengeDelayInSeconds
+// - returns to the OS a percentage of the memory that remained unused during
+// that pause (kScavengePercentage * min_free_committed_pages_since_last_scavenge_)
+// The goal of this strategy is to reduce memory pressure in a timely fashion
+// while avoiding thrashing the OS allocator.
+
+// Time delay before the page heap scavenger will consider returning pages to
+// the OS.
+static const int kScavengeDelayInSeconds = 2;
+
+// Approximate percentage of free committed pages to return to the OS in one
+// scavenge.
+static const float kScavengePercentage = .5f;
+
+// number of span lists to keep spans in when memory is returned.
+static const int kMinSpanListsWithSpans = 32;
+
+// Number of free committed pages that we want to keep around. The minimum number of pages used when there
+// is 1 span in each of the first kMinSpanListsWithSpans spanlists. Currently 528 pages.
+static const size_t kMinimumFreeCommittedPageCount = kMinSpanListsWithSpans * ((1.0f+kMinSpanListsWithSpans) / 2.0f);
+
+#endif
+
+class TCMalloc_PageHeap {
+ public:
+ void init();
+
+ // Allocate a run of "n" pages. Returns zero if out of memory.
+ Span* New(Length n);
+
+ // Delete the span "[p, p+n-1]".
+ // REQUIRES: span was returned by earlier call to New() and
+ // has not yet been deleted.
+ void Delete(Span* span);
+
+ // Mark an allocated span as being used for small objects of the
+ // specified size-class.
+ // REQUIRES: span was returned by an earlier call to New()
+ // and has not yet been deleted.
+ void RegisterSizeClass(Span* span, size_t sc);
+
+ // Split an allocated span into two spans: one of length "n" pages
+ // followed by another span of length "span->length - n" pages.
+ // Modifies "*span" to point to the first span of length "n" pages.
+ // Returns a pointer to the second span.
+ //
+ // REQUIRES: "0 < n < span->length"
+ // REQUIRES: !span->free
+ // REQUIRES: span->sizeclass == 0
+ Span* Split(Span* span, Length n);
+
+ // Return the descriptor for the specified page.
+ inline Span* GetDescriptor(PageID p) const {
+ return reinterpret_cast<Span*>(pagemap_.get(p));
+ }
+
+#ifdef WTF_CHANGES
+ inline Span* GetDescriptorEnsureSafe(PageID p)
+ {
+ pagemap_.Ensure(p, 1);
+ return GetDescriptor(p);
+ }
+
+ size_t ReturnedBytes() const;
+#endif
+
+ // Dump state to stderr
+#ifndef WTF_CHANGES
+ void Dump(TCMalloc_Printer* out);
+#endif
+
+ // Return number of bytes allocated from system
+ inline uint64_t SystemBytes() const { return system_bytes_; }
+
+ // Return number of free bytes in heap
+ uint64_t FreeBytes() const {
+ return (static_cast<uint64_t>(free_pages_) << kPageShift);
+ }
+
+ bool Check();
+ bool CheckList(Span* list, Length min_pages, Length max_pages);
+
+ // Release all pages on the free list for reuse by the OS:
+ void ReleaseFreePages();
+
+ // Return 0 if we have no information, or else the correct sizeclass for p.
+ // Reads and writes to pagemap_cache_ do not require locking.
+ // The entries are 64 bits on 64-bit hardware and 16 bits on
+ // 32-bit hardware, and we don't mind raciness as long as each read of
+ // an entry yields a valid entry, not a partially updated entry.
+ size_t GetSizeClassIfCached(PageID p) const {
+ return pagemap_cache_.GetOrDefault(p, 0);
+ }
+ void CacheSizeClass(PageID p, size_t cl) const { pagemap_cache_.Put(p, cl); }
+
+ private:
+ // Pick the appropriate map and cache types based on pointer size
+ typedef MapSelector<8*sizeof(uintptr_t)>::Type PageMap;
+ typedef MapSelector<8*sizeof(uintptr_t)>::CacheType PageMapCache;
+ PageMap pagemap_;
+ mutable PageMapCache pagemap_cache_;
+
+ // We segregate spans of a given size into two circular linked
+ // lists: one for normal spans, and one for spans whose memory
+ // has been returned to the system.
+ struct SpanList {
+ Span normal;
+ Span returned;
+ };
+
+ // List of free spans of length >= kMaxPages
+ SpanList large_;
+
+ // Array mapping from span length to a doubly linked list of free spans
+ SpanList free_[kMaxPages];
+
+ // Number of pages kept in free lists
+ uintptr_t free_pages_;
+
+ // Bytes allocated from system
+ uint64_t system_bytes_;
+
+#if USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY
+ // Number of pages kept in free lists that are still committed.
+ Length free_committed_pages_;
+
+ // Minimum number of free committed pages since last scavenge. (Can be 0 if
+ // we've committed new pages since the last scavenge.)
+ Length min_free_committed_pages_since_last_scavenge_;
+#endif
+
+ bool GrowHeap(Length n);
+
+ // REQUIRES span->length >= n
+ // Remove span from its free list, and move any leftover part of
+ // span into appropriate free lists. Also update "span" to have
+ // length exactly "n" and mark it as non-free so it can be returned
+ // to the client.
+ //
+ // "released" is true iff "span" was found on a "returned" list.
+ void Carve(Span* span, Length n, bool released);
+
+ void RecordSpan(Span* span) {
+ pagemap_.set(span->start, span);
+ if (span->length > 1) {
+ pagemap_.set(span->start + span->length - 1, span);
+ }
+ }
+
+ // Allocate a large span of length == n. If successful, returns a
+ // span of exactly the specified length. Else, returns NULL.
+ Span* AllocLarge(Length n);
+
+#if !USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY
+ // Incrementally release some memory to the system.
+ // IncrementalScavenge(n) is called whenever n pages are freed.
+ void IncrementalScavenge(Length n);
+#endif
+
+ // Number of pages to deallocate before doing more scavenging
+ int64_t scavenge_counter_;
+
+ // Index of last free list we scavenged
+ size_t scavenge_index_;
+
+#if defined(WTF_CHANGES) && OS(DARWIN)
+ friend class FastMallocZone;
+#endif
+
+#if USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY
+ void initializeScavenger();
+ ALWAYS_INLINE void signalScavenger();
+ void scavenge();
+ ALWAYS_INLINE bool shouldScavenge() const;
+
+#if !HAVE(DISPATCH_H)
+ static NO_RETURN_WITH_VALUE void* runScavengerThread(void*);
+ NO_RETURN void scavengerThread();
+
+ // Keeps track of whether the background thread is actively scavenging memory every kScavengeDelayInSeconds, or
+ // it's blocked waiting for more pages to be deleted.
+ bool m_scavengeThreadActive;
+
+ pthread_mutex_t m_scavengeMutex;
+ pthread_cond_t m_scavengeCondition;
+#else // !HAVE(DISPATCH_H)
+ void periodicScavenge();
+
+ dispatch_queue_t m_scavengeQueue;
+ dispatch_source_t m_scavengeTimer;
+ bool m_scavengingScheduled;
+#endif
+
+#endif // USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY
+};
+
+void TCMalloc_PageHeap::init()
+{
+ pagemap_.init(MetaDataAlloc);
+ pagemap_cache_ = PageMapCache(0);
+ free_pages_ = 0;
+ system_bytes_ = 0;
+
+#if USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY
+ free_committed_pages_ = 0;
+ min_free_committed_pages_since_last_scavenge_ = 0;
+#endif // USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY
+
+ scavenge_counter_ = 0;
+ // Start scavenging at kMaxPages list
+ scavenge_index_ = kMaxPages-1;
+ COMPILE_ASSERT(kNumClasses <= (1 << PageMapCache::kValuebits), valuebits);
+ DLL_Init(&large_.normal);
+ DLL_Init(&large_.returned);
+ for (size_t i = 0; i < kMaxPages; i++) {
+ DLL_Init(&free_[i].normal);
+ DLL_Init(&free_[i].returned);
+ }
+
+#if USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY
+ initializeScavenger();
+#endif // USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY
+}
+
+#if USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY
+
+#if !HAVE(DISPATCH_H)
+
+void TCMalloc_PageHeap::initializeScavenger()
+{
+ // Create a non-recursive mutex.
+#if !defined(PTHREAD_MUTEX_NORMAL) || PTHREAD_MUTEX_NORMAL == PTHREAD_MUTEX_DEFAULT
+ pthread_mutex_init(&m_scavengeMutex, 0);
+#else
+ pthread_mutexattr_t attr;
+ pthread_mutexattr_init(&attr);
+ pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_NORMAL);
+
+ pthread_mutex_init(&m_scavengeMutex, &attr);
+
+ pthread_mutexattr_destroy(&attr);
+#endif
+
+ pthread_cond_init(&m_scavengeCondition, 0);
+ m_scavengeThreadActive = true;
+ pthread_t thread;
+ pthread_create(&thread, 0, runScavengerThread, this);
+}
+
+void* TCMalloc_PageHeap::runScavengerThread(void* context)
+{
+ static_cast<TCMalloc_PageHeap*>(context)->scavengerThread();
+#if COMPILER(MSVC)
+ // Without this, Visual Studio will complain that this method does not return a value.
+ return 0;
+#endif
+}
+
+ALWAYS_INLINE void TCMalloc_PageHeap::signalScavenger()
+{
+ // m_scavengeMutex should be held before accessing m_scavengeThreadActive.
+ ASSERT(pthread_mutex_trylock(m_scavengeMutex));
+ if (!m_scavengeThreadActive && shouldScavenge())
+ pthread_cond_signal(&m_scavengeCondition);
+}
+
+#else // !HAVE(DISPATCH_H)
+
+void TCMalloc_PageHeap::initializeScavenger()
+{
+ m_scavengeQueue = dispatch_queue_create("com.apple.JavaScriptCore.FastMallocSavenger", NULL);
+ m_scavengeTimer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, m_scavengeQueue);
+ dispatch_time_t startTime = dispatch_time(DISPATCH_TIME_NOW, kScavengeDelayInSeconds * NSEC_PER_SEC);
+ dispatch_source_set_timer(m_scavengeTimer, startTime, kScavengeDelayInSeconds * NSEC_PER_SEC, 1000 * NSEC_PER_USEC);
+ dispatch_source_set_event_handler(m_scavengeTimer, ^{ periodicScavenge(); });
+ m_scavengingScheduled = false;
+}
+
+ALWAYS_INLINE void TCMalloc_PageHeap::signalScavenger()
+{
+ ASSERT(IsHeld(pageheap_lock));
+ if (!m_scavengingScheduled && shouldScavenge()) {
+ m_scavengingScheduled = true;
+ dispatch_resume(m_scavengeTimer);
+ }
+}
+
+#endif
+
+void TCMalloc_PageHeap::scavenge()
+{
+ size_t pagesToRelease = min_free_committed_pages_since_last_scavenge_ * kScavengePercentage;
+ size_t targetPageCount = std::max<size_t>(kMinimumFreeCommittedPageCount, free_committed_pages_ - pagesToRelease);
+
+ while (free_committed_pages_ > targetPageCount) {
+ for (int i = kMaxPages; i > 0 && free_committed_pages_ >= targetPageCount; i--) {
+ SpanList* slist = (static_cast<size_t>(i) == kMaxPages) ? &large_ : &free_[i];
+ // If the span size is bigger than kMinSpanListsWithSpans pages return all the spans in the list, else return all but 1 span.
+ // Return only 50% of a spanlist at a time so spans of size 1 are not the only ones left.
+ size_t length = DLL_Length(&slist->normal);
+ size_t numSpansToReturn = (i > kMinSpanListsWithSpans) ? length : length / 2;
+ for (int j = 0; static_cast<size_t>(j) < numSpansToReturn && !DLL_IsEmpty(&slist->normal) && free_committed_pages_ > targetPageCount; j++) {
+ Span* s = slist->normal.prev;
+ DLL_Remove(s);
+ ASSERT(!s->decommitted);
+ if (!s->decommitted) {
+ TCMalloc_SystemRelease(reinterpret_cast<void*>(s->start << kPageShift),
+ static_cast<size_t>(s->length << kPageShift));
+ ASSERT(free_committed_pages_ >= s->length);
+ free_committed_pages_ -= s->length;
+ s->decommitted = true;
+ }
+ DLL_Prepend(&slist->returned, s);
+ }
+ }
+ }
+
+ min_free_committed_pages_since_last_scavenge_ = free_committed_pages_;
+}
+
+ALWAYS_INLINE bool TCMalloc_PageHeap::shouldScavenge() const
+{
+ return free_committed_pages_ > kMinimumFreeCommittedPageCount;
+}
+
+#endif // USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY
+
+inline Span* TCMalloc_PageHeap::New(Length n) {
+ ASSERT(Check());
+ ASSERT(n > 0);
+
+ // Find first size >= n that has a non-empty list
+ for (Length s = n; s < kMaxPages; s++) {
+ Span* ll = NULL;
+ bool released = false;
+ if (!DLL_IsEmpty(&free_[s].normal)) {
+ // Found normal span
+ ll = &free_[s].normal;
+ } else if (!DLL_IsEmpty(&free_[s].returned)) {
+ // Found returned span; reallocate it
+ ll = &free_[s].returned;
+ released = true;
+ } else {
+ // Keep looking in larger classes
+ continue;
+ }
+
+ Span* result = ll->next;
+ Carve(result, n, released);
+#if USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY
+ // The newly allocated memory is from a span that's in the normal span list (already committed). Update the
+ // free committed pages count.
+ ASSERT(free_committed_pages_ >= n);
+ free_committed_pages_ -= n;
+ if (free_committed_pages_ < min_free_committed_pages_since_last_scavenge_)
+ min_free_committed_pages_since_last_scavenge_ = free_committed_pages_;
+#endif // USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY
+ ASSERT(Check());
+ free_pages_ -= n;
+ return result;
+ }
+
+ Span* result = AllocLarge(n);
+ if (result != NULL) {
+ ASSERT_SPAN_COMMITTED(result);
+ return result;
+ }
+
+ // Grow the heap and try again
+ if (!GrowHeap(n)) {
+ ASSERT(Check());
+ return NULL;
+ }
+
+ return AllocLarge(n);
+}
+
+Span* TCMalloc_PageHeap::AllocLarge(Length n) {
+ // find the best span (closest to n in size).
+ // The following loops implements address-ordered best-fit.
+ bool from_released = false;
+ Span *best = NULL;
+
+ // Search through normal list
+ for (Span* span = large_.normal.next;
+ span != &large_.normal;
+ span = span->next) {
+ if (span->length >= n) {
+ if ((best == NULL)
+ || (span->length < best->length)
+ || ((span->length == best->length) && (span->start < best->start))) {
+ best = span;
+ from_released = false;
+ }
+ }
+ }
+
+ // Search through released list in case it has a better fit
+ for (Span* span = large_.returned.next;
+ span != &large_.returned;
+ span = span->next) {
+ if (span->length >= n) {
+ if ((best == NULL)
+ || (span->length < best->length)
+ || ((span->length == best->length) && (span->start < best->start))) {
+ best = span;
+ from_released = true;
+ }
+ }
+ }
+
+ if (best != NULL) {
+ Carve(best, n, from_released);
+#if USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY
+ // The newly allocated memory is from a span that's in the normal span list (already committed). Update the
+ // free committed pages count.
+ ASSERT(free_committed_pages_ >= n);
+ free_committed_pages_ -= n;
+ if (free_committed_pages_ < min_free_committed_pages_since_last_scavenge_)
+ min_free_committed_pages_since_last_scavenge_ = free_committed_pages_;
+#endif // USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY
+ ASSERT(Check());
+ free_pages_ -= n;
+ return best;
+ }
+ return NULL;
+}
+
+Span* TCMalloc_PageHeap::Split(Span* span, Length n) {
+ ASSERT(0 < n);
+ ASSERT(n < span->length);
+ ASSERT(!span->free);
+ ASSERT(span->sizeclass == 0);
+ Event(span, 'T', n);
+
+ const Length extra = span->length - n;
+ Span* leftover = NewSpan(span->start + n, extra);
+ Event(leftover, 'U', extra);
+ RecordSpan(leftover);
+ pagemap_.set(span->start + n - 1, span); // Update map from pageid to span
+ span->length = n;
+
+ return leftover;
+}
+
+inline void TCMalloc_PageHeap::Carve(Span* span, Length n, bool released) {
+ ASSERT(n > 0);
+ DLL_Remove(span);
+ span->free = 0;
+ Event(span, 'A', n);
+
+ if (released) {
+ // If the span chosen to carve from is decommited, commit the entire span at once to avoid committing spans 1 page at a time.
+ ASSERT(span->decommitted);
+ TCMalloc_SystemCommit(reinterpret_cast<void*>(span->start << kPageShift), static_cast<size_t>(span->length << kPageShift));
+ span->decommitted = false;
+#if USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY
+ free_committed_pages_ += span->length;
+#endif
+ }
+
+ const int extra = static_cast<int>(span->length - n);
+ ASSERT(extra >= 0);
+ if (extra > 0) {
+ Span* leftover = NewSpan(span->start + n, extra);
+ leftover->free = 1;
+ leftover->decommitted = false;
+ Event(leftover, 'S', extra);
+ RecordSpan(leftover);
+
+ // Place leftover span on appropriate free list
+ SpanList* listpair = (static_cast<size_t>(extra) < kMaxPages) ? &free_[extra] : &large_;
+ Span* dst = &listpair->normal;
+ DLL_Prepend(dst, leftover);
+
+ span->length = n;
+ pagemap_.set(span->start + n - 1, span);
+ }
+}
+
+static ALWAYS_INLINE void mergeDecommittedStates(Span* destination, Span* other)
+{
+ if (destination->decommitted && !other->decommitted) {
+ TCMalloc_SystemRelease(reinterpret_cast<void*>(other->start << kPageShift),
+ static_cast<size_t>(other->length << kPageShift));
+ } else if (other->decommitted && !destination->decommitted) {
+ TCMalloc_SystemRelease(reinterpret_cast<void*>(destination->start << kPageShift),
+ static_cast<size_t>(destination->length << kPageShift));
+ destination->decommitted = true;
+ }
+}
+
+inline void TCMalloc_PageHeap::Delete(Span* span) {
+ ASSERT(Check());
+ ASSERT(!span->free);
+ ASSERT(span->length > 0);
+ ASSERT(GetDescriptor(span->start) == span);
+ ASSERT(GetDescriptor(span->start + span->length - 1) == span);
+ span->sizeclass = 0;
+#ifndef NO_TCMALLOC_SAMPLES
+ span->sample = 0;
+#endif
+
+ // Coalesce -- we guarantee that "p" != 0, so no bounds checking
+ // necessary. We do not bother resetting the stale pagemap
+ // entries for the pieces we are merging together because we only
+ // care about the pagemap entries for the boundaries.
+#if USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY
+ // Track the total size of the neighboring free spans that are committed.
+ Length neighboringCommittedSpansLength = 0;
+#endif
+ const PageID p = span->start;
+ const Length n = span->length;
+ Span* prev = GetDescriptor(p-1);
+ if (prev != NULL && prev->free) {
+ // Merge preceding span into this span
+ ASSERT(prev->start + prev->length == p);
+ const Length len = prev->length;
+#if USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY
+ if (!prev->decommitted)
+ neighboringCommittedSpansLength += len;
+#endif
+ mergeDecommittedStates(span, prev);
+ DLL_Remove(prev);
+ DeleteSpan(prev);
+ span->start -= len;
+ span->length += len;
+ pagemap_.set(span->start, span);
+ Event(span, 'L', len);
+ }
+ Span* next = GetDescriptor(p+n);
+ if (next != NULL && next->free) {
+ // Merge next span into this span
+ ASSERT(next->start == p+n);
+ const Length len = next->length;
+#if USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY
+ if (!next->decommitted)
+ neighboringCommittedSpansLength += len;
+#endif
+ mergeDecommittedStates(span, next);
+ DLL_Remove(next);
+ DeleteSpan(next);
+ span->length += len;
+ pagemap_.set(span->start + span->length - 1, span);
+ Event(span, 'R', len);
+ }
+
+ Event(span, 'D', span->length);
+ span->free = 1;
+ if (span->decommitted) {
+ if (span->length < kMaxPages)
+ DLL_Prepend(&free_[span->length].returned, span);
+ else
+ DLL_Prepend(&large_.returned, span);
+ } else {
+ if (span->length < kMaxPages)
+ DLL_Prepend(&free_[span->length].normal, span);
+ else
+ DLL_Prepend(&large_.normal, span);
+ }
+ free_pages_ += n;
+
+#if USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY
+ if (span->decommitted) {
+ // If the merged span is decommitted, that means we decommitted any neighboring spans that were
+ // committed. Update the free committed pages count.
+ free_committed_pages_ -= neighboringCommittedSpansLength;
+ if (free_committed_pages_ < min_free_committed_pages_since_last_scavenge_)
+ min_free_committed_pages_since_last_scavenge_ = free_committed_pages_;
+ } else {
+ // If the merged span remains committed, add the deleted span's size to the free committed pages count.
+ free_committed_pages_ += n;
+ }
+
+ // Make sure the scavenge thread becomes active if we have enough freed pages to release some back to the system.
+ signalScavenger();
+#else
+ IncrementalScavenge(n);
+#endif
+
+ ASSERT(Check());
+}
+
+#if !USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY
+void TCMalloc_PageHeap::IncrementalScavenge(Length n) {
+ // Fast path; not yet time to release memory
+ scavenge_counter_ -= n;
+ if (scavenge_counter_ >= 0) return; // Not yet time to scavenge
+
+ // If there is nothing to release, wait for so many pages before
+ // scavenging again. With 4K pages, this comes to 16MB of memory.
+ static const size_t kDefaultReleaseDelay = 1 << 8;
+
+ // Find index of free list to scavenge
+ size_t index = scavenge_index_ + 1;
+ for (size_t i = 0; i < kMaxPages+1; i++) {
+ if (index > kMaxPages) index = 0;
+ SpanList* slist = (index == kMaxPages) ? &large_ : &free_[index];
+ if (!DLL_IsEmpty(&slist->normal)) {
+ // Release the last span on the normal portion of this list
+ Span* s = slist->normal.prev;
+ DLL_Remove(s);
+ TCMalloc_SystemRelease(reinterpret_cast<void*>(s->start << kPageShift),
+ static_cast<size_t>(s->length << kPageShift));
+ s->decommitted = true;
+ DLL_Prepend(&slist->returned, s);
+
+ scavenge_counter_ = std::max<size_t>(64UL, std::min<size_t>(kDefaultReleaseDelay, kDefaultReleaseDelay - (free_pages_ / kDefaultReleaseDelay)));
+
+ if (index == kMaxPages && !DLL_IsEmpty(&slist->normal))
+ scavenge_index_ = index - 1;
+ else
+ scavenge_index_ = index;
+ return;
+ }
+ index++;
+ }
+
+ // Nothing to scavenge, delay for a while
+ scavenge_counter_ = kDefaultReleaseDelay;
+}
+#endif
+
+void TCMalloc_PageHeap::RegisterSizeClass(Span* span, size_t sc) {
+ // Associate span object with all interior pages as well
+ ASSERT(!span->free);
+ ASSERT(GetDescriptor(span->start) == span);
+ ASSERT(GetDescriptor(span->start+span->length-1) == span);
+ Event(span, 'C', sc);
+ span->sizeclass = static_cast<unsigned int>(sc);
+ for (Length i = 1; i < span->length-1; i++) {
+ pagemap_.set(span->start+i, span);
+ }
+}
+
+#ifdef WTF_CHANGES
+size_t TCMalloc_PageHeap::ReturnedBytes() const {
+ size_t result = 0;
+ for (unsigned s = 0; s < kMaxPages; s++) {
+ const int r_length = DLL_Length(&free_[s].returned);
+ unsigned r_pages = s * r_length;
+ result += r_pages << kPageShift;
+ }
+
+ for (Span* s = large_.returned.next; s != &large_.returned; s = s->next)
+ result += s->length << kPageShift;
+ return result;
+}
+#endif
+
+#ifndef WTF_CHANGES
+static double PagesToMB(uint64_t pages) {
+ return (pages << kPageShift) / 1048576.0;
+}
+
+void TCMalloc_PageHeap::Dump(TCMalloc_Printer* out) {
+ int nonempty_sizes = 0;
+ for (int s = 0; s < kMaxPages; s++) {
+ if (!DLL_IsEmpty(&free_[s].normal) || !DLL_IsEmpty(&free_[s].returned)) {
+ nonempty_sizes++;
+ }
+ }
+ out->printf("------------------------------------------------\n");
+ out->printf("PageHeap: %d sizes; %6.1f MB free\n",
+ nonempty_sizes, PagesToMB(free_pages_));
+ out->printf("------------------------------------------------\n");
+ uint64_t total_normal = 0;
+ uint64_t total_returned = 0;
+ for (int s = 0; s < kMaxPages; s++) {
+ const int n_length = DLL_Length(&free_[s].normal);
+ const int r_length = DLL_Length(&free_[s].returned);
+ if (n_length + r_length > 0) {
+ uint64_t n_pages = s * n_length;
+ uint64_t r_pages = s * r_length;
+ total_normal += n_pages;
+ total_returned += r_pages;
+ out->printf("%6u pages * %6u spans ~ %6.1f MB; %6.1f MB cum"
+ "; unmapped: %6.1f MB; %6.1f MB cum\n",
+ s,
+ (n_length + r_length),
+ PagesToMB(n_pages + r_pages),
+ PagesToMB(total_normal + total_returned),
+ PagesToMB(r_pages),
+ PagesToMB(total_returned));
+ }
+ }
+
+ uint64_t n_pages = 0;
+ uint64_t r_pages = 0;
+ int n_spans = 0;
+ int r_spans = 0;
+ out->printf("Normal large spans:\n");
+ for (Span* s = large_.normal.next; s != &large_.normal; s = s->next) {
+ out->printf(" [ %6" PRIuS " pages ] %6.1f MB\n",
+ s->length, PagesToMB(s->length));
+ n_pages += s->length;
+ n_spans++;
+ }
+ out->printf("Unmapped large spans:\n");
+ for (Span* s = large_.returned.next; s != &large_.returned; s = s->next) {
+ out->printf(" [ %6" PRIuS " pages ] %6.1f MB\n",
+ s->length, PagesToMB(s->length));
+ r_pages += s->length;
+ r_spans++;
+ }
+ total_normal += n_pages;
+ total_returned += r_pages;
+ out->printf(">255 large * %6u spans ~ %6.1f MB; %6.1f MB cum"
+ "; unmapped: %6.1f MB; %6.1f MB cum\n",
+ (n_spans + r_spans),
+ PagesToMB(n_pages + r_pages),
+ PagesToMB(total_normal + total_returned),
+ PagesToMB(r_pages),
+ PagesToMB(total_returned));
+}
+#endif
+
+bool TCMalloc_PageHeap::GrowHeap(Length n) {
+ ASSERT(kMaxPages >= kMinSystemAlloc);
+ if (n > kMaxValidPages) return false;
+ Length ask = (n>kMinSystemAlloc) ? n : static_cast<Length>(kMinSystemAlloc);
+ size_t actual_size;
+ void* ptr = TCMalloc_SystemAlloc(ask << kPageShift, &actual_size, kPageSize);
+ if (ptr == NULL) {
+ if (n < ask) {
+ // Try growing just "n" pages
+ ask = n;
+ ptr = TCMalloc_SystemAlloc(ask << kPageShift, &actual_size, kPageSize);
+ }
+ if (ptr == NULL) return false;
+ }
+ ask = actual_size >> kPageShift;
+
+ uint64_t old_system_bytes = system_bytes_;
+ system_bytes_ += (ask << kPageShift);
+ const PageID p = reinterpret_cast<uintptr_t>(ptr) >> kPageShift;
+ ASSERT(p > 0);
+
+ // If we have already a lot of pages allocated, just pre allocate a bunch of
+ // memory for the page map. This prevents fragmentation by pagemap metadata
+ // when a program keeps allocating and freeing large blocks.
+
+ if (old_system_bytes < kPageMapBigAllocationThreshold
+ && system_bytes_ >= kPageMapBigAllocationThreshold) {
+ pagemap_.PreallocateMoreMemory();
+ }
+
+ // Make sure pagemap_ has entries for all of the new pages.
+ // Plus ensure one before and one after so coalescing code
+ // does not need bounds-checking.
+ if (pagemap_.Ensure(p-1, ask+2)) {
+ // Pretend the new area is allocated and then Delete() it to
+ // cause any necessary coalescing to occur.
+ //
+ // We do not adjust free_pages_ here since Delete() will do it for us.
+ Span* span = NewSpan(p, ask);
+ RecordSpan(span);
+ Delete(span);
+ ASSERT(Check());
+ return true;
+ } else {
+ // We could not allocate memory within "pagemap_"
+ // TODO: Once we can return memory to the system, return the new span
+ return false;
+ }
+}
+
+bool TCMalloc_PageHeap::Check() {
+ ASSERT(free_[0].normal.next == &free_[0].normal);
+ ASSERT(free_[0].returned.next == &free_[0].returned);
+ CheckList(&large_.normal, kMaxPages, 1000000000);
+ CheckList(&large_.returned, kMaxPages, 1000000000);
+ for (Length s = 1; s < kMaxPages; s++) {
+ CheckList(&free_[s].normal, s, s);
+ CheckList(&free_[s].returned, s, s);
+ }
+ return true;
+}
+
+#if ASSERT_DISABLED
+bool TCMalloc_PageHeap::CheckList(Span*, Length, Length) {
+ return true;
+}
+#else
+bool TCMalloc_PageHeap::CheckList(Span* list, Length min_pages, Length max_pages) {
+ for (Span* s = list->next; s != list; s = s->next) {
+ CHECK_CONDITION(s->free);
+ CHECK_CONDITION(s->length >= min_pages);
+ CHECK_CONDITION(s->length <= max_pages);
+ CHECK_CONDITION(GetDescriptor(s->start) == s);
+ CHECK_CONDITION(GetDescriptor(s->start+s->length-1) == s);
+ }
+ return true;
+}
+#endif
+
+static void ReleaseFreeList(Span* list, Span* returned) {
+ // Walk backwards through list so that when we push these
+ // spans on the "returned" list, we preserve the order.
+ while (!DLL_IsEmpty(list)) {
+ Span* s = list->prev;
+ DLL_Remove(s);
+ DLL_Prepend(returned, s);
+ TCMalloc_SystemRelease(reinterpret_cast<void*>(s->start << kPageShift),
+ static_cast<size_t>(s->length << kPageShift));
+ }
+}
+
+void TCMalloc_PageHeap::ReleaseFreePages() {
+ for (Length s = 0; s < kMaxPages; s++) {
+ ReleaseFreeList(&free_[s].normal, &free_[s].returned);
+ }
+ ReleaseFreeList(&large_.normal, &large_.returned);
+ ASSERT(Check());
+}
+
+//-------------------------------------------------------------------
+// Free list
+//-------------------------------------------------------------------
+
+class TCMalloc_ThreadCache_FreeList {
+ private:
+ void* list_; // Linked list of nodes
+ uint16_t length_; // Current length
+ uint16_t lowater_; // Low water mark for list length
+
+ public:
+ void Init() {
+ list_ = NULL;
+ length_ = 0;
+ lowater_ = 0;
+ }
+
+ // Return current length of list
+ int length() const {
+ return length_;
+ }
+
+ // Is list empty?
+ bool empty() const {
+ return list_ == NULL;
+ }
+
+ // Low-water mark management
+ int lowwatermark() const { return lowater_; }
+ void clear_lowwatermark() { lowater_ = length_; }
+
+ ALWAYS_INLINE void Push(void* ptr) {
+ SLL_Push(&list_, ptr);
+ length_++;
+ }
+
+ void PushRange(int N, void *start, void *end) {
+ SLL_PushRange(&list_, start, end);
+ length_ = length_ + static_cast<uint16_t>(N);
+ }
+
+ void PopRange(int N, void **start, void **end) {
+ SLL_PopRange(&list_, N, start, end);
+ ASSERT(length_ >= N);
+ length_ = length_ - static_cast<uint16_t>(N);
+ if (length_ < lowater_) lowater_ = length_;
+ }
+
+ ALWAYS_INLINE void* Pop() {
+ ASSERT(list_ != NULL);
+ length_--;
+ if (length_ < lowater_) lowater_ = length_;
+ return SLL_Pop(&list_);
+ }
+
+#ifdef WTF_CHANGES
+ template <class Finder, class Reader>
+ void enumerateFreeObjects(Finder& finder, const Reader& reader)
+ {
+ for (void* nextObject = list_; nextObject; nextObject = *reader(reinterpret_cast<void**>(nextObject)))
+ finder.visit(nextObject);
+ }
+#endif
+};
+
+//-------------------------------------------------------------------
+// Data kept per thread
+//-------------------------------------------------------------------
+
+class TCMalloc_ThreadCache {
+ private:
+ typedef TCMalloc_ThreadCache_FreeList FreeList;
+#if OS(WINDOWS)
+ typedef DWORD ThreadIdentifier;
+#else
+ typedef pthread_t ThreadIdentifier;
+#endif
+
+ size_t size_; // Combined size of data
+ ThreadIdentifier tid_; // Which thread owns it
+ bool in_setspecific_; // Called pthread_setspecific?
+ FreeList list_[kNumClasses]; // Array indexed by size-class
+
+ // We sample allocations, biased by the size of the allocation
+ uint32_t rnd_; // Cheap random number generator
+ size_t bytes_until_sample_; // Bytes until we sample next
+
+ // Allocate a new heap. REQUIRES: pageheap_lock is held.
+ static inline TCMalloc_ThreadCache* NewHeap(ThreadIdentifier tid);
+
+ // Use only as pthread thread-specific destructor function.
+ static void DestroyThreadCache(void* ptr);
+ public:
+ // All ThreadCache objects are kept in a linked list (for stats collection)
+ TCMalloc_ThreadCache* next_;
+ TCMalloc_ThreadCache* prev_;
+
+ void Init(ThreadIdentifier tid);
+ void Cleanup();
+
+ // Accessors (mostly just for printing stats)
+ int freelist_length(size_t cl) const { return list_[cl].length(); }
+
+ // Total byte size in cache
+ size_t Size() const { return size_; }
+
+ ALWAYS_INLINE void* Allocate(size_t size);
+ void Deallocate(void* ptr, size_t size_class);
+
+ ALWAYS_INLINE void FetchFromCentralCache(size_t cl, size_t allocationSize);
+ void ReleaseToCentralCache(size_t cl, int N);
+ void Scavenge();
+ void Print() const;
+
+ // Record allocation of "k" bytes. Return true iff allocation
+ // should be sampled
+ bool SampleAllocation(size_t k);
+
+ // Pick next sampling point
+ void PickNextSample(size_t k);
+
+ static void InitModule();
+ static void InitTSD();
+ static TCMalloc_ThreadCache* GetThreadHeap();
+ static TCMalloc_ThreadCache* GetCache();
+ static TCMalloc_ThreadCache* GetCacheIfPresent();
+ static TCMalloc_ThreadCache* CreateCacheIfNecessary();
+ static void DeleteCache(TCMalloc_ThreadCache* heap);
+ static void BecomeIdle();
+ static void RecomputeThreadCacheSize();
+
+#ifdef WTF_CHANGES
+ template <class Finder, class Reader>
+ void enumerateFreeObjects(Finder& finder, const Reader& reader)
+ {
+ for (unsigned sizeClass = 0; sizeClass < kNumClasses; sizeClass++)
+ list_[sizeClass].enumerateFreeObjects(finder, reader);
+ }
+#endif
+};
+
+//-------------------------------------------------------------------
+// Data kept per size-class in central cache
+//-------------------------------------------------------------------
+
+class TCMalloc_Central_FreeList {
+ public:
+ void Init(size_t cl);
+
+ // These methods all do internal locking.
+
+ // Insert the specified range into the central freelist. N is the number of
+ // elements in the range.
+ void InsertRange(void *start, void *end, int N);
+
+ // Returns the actual number of fetched elements into N.
+ void RemoveRange(void **start, void **end, int *N);
+
+ // Returns the number of free objects in cache.
+ size_t length() {
+ SpinLockHolder h(&lock_);
+ return counter_;
+ }
+
+ // Returns the number of free objects in the transfer cache.
+ int tc_length() {
+ SpinLockHolder h(&lock_);
+ return used_slots_ * num_objects_to_move[size_class_];
+ }
+
+#ifdef WTF_CHANGES
+ template <class Finder, class Reader>
+ void enumerateFreeObjects(Finder& finder, const Reader& reader, TCMalloc_Central_FreeList* remoteCentralFreeList)
+ {
+ for (Span* span = &empty_; span && span != &empty_; span = (span->next ? reader(span->next) : 0))
+ ASSERT(!span->objects);
+
+ ASSERT(!nonempty_.objects);
+ static const ptrdiff_t nonemptyOffset = reinterpret_cast<const char*>(&nonempty_) - reinterpret_cast<const char*>(this);
+
+ Span* remoteNonempty = reinterpret_cast<Span*>(reinterpret_cast<char*>(remoteCentralFreeList) + nonemptyOffset);
+ Span* remoteSpan = nonempty_.next;
+
+ for (Span* span = reader(remoteSpan); span && remoteSpan != remoteNonempty; remoteSpan = span->next, span = (span->next ? reader(span->next) : 0)) {
+ for (void* nextObject = span->objects; nextObject; nextObject = *reader(reinterpret_cast<void**>(nextObject)))
+ finder.visit(nextObject);
+ }
+ }
+#endif
+
+ private:
+ // REQUIRES: lock_ is held
+ // Remove object from cache and return.
+ // Return NULL if no free entries in cache.
+ void* FetchFromSpans();
+
+ // REQUIRES: lock_ is held
+ // Remove object from cache and return. Fetches
+ // from pageheap if cache is empty. Only returns
+ // NULL on allocation failure.
+ void* FetchFromSpansSafe();
+
+ // REQUIRES: lock_ is held
+ // Release a linked list of objects to spans.
+ // May temporarily release lock_.
+ void ReleaseListToSpans(void *start);
+
+ // REQUIRES: lock_ is held
+ // Release an object to spans.
+ // May temporarily release lock_.
+ ALWAYS_INLINE void ReleaseToSpans(void* object);
+
+ // REQUIRES: lock_ is held
+ // Populate cache by fetching from the page heap.
+ // May temporarily release lock_.
+ ALWAYS_INLINE void Populate();
+
+ // REQUIRES: lock is held.
+ // Tries to make room for a TCEntry. If the cache is full it will try to
+ // expand it at the cost of some other cache size. Return false if there is
+ // no space.
+ bool MakeCacheSpace();
+
+ // REQUIRES: lock_ for locked_size_class is held.
+ // Picks a "random" size class to steal TCEntry slot from. In reality it
+ // just iterates over the sizeclasses but does so without taking a lock.
+ // Returns true on success.
+ // May temporarily lock a "random" size class.
+ static ALWAYS_INLINE bool EvictRandomSizeClass(size_t locked_size_class, bool force);
+
+ // REQUIRES: lock_ is *not* held.
+ // Tries to shrink the Cache. If force is true it will relase objects to
+ // spans if it allows it to shrink the cache. Return false if it failed to
+ // shrink the cache. Decrements cache_size_ on succeess.
+ // May temporarily take lock_. If it takes lock_, the locked_size_class
+ // lock is released to the thread from holding two size class locks
+ // concurrently which could lead to a deadlock.
+ bool ShrinkCache(int locked_size_class, bool force);
+
+ // This lock protects all the data members. cached_entries and cache_size_
+ // may be looked at without holding the lock.
+ SpinLock lock_;
+
+ // We keep linked lists of empty and non-empty spans.
+ size_t size_class_; // My size class
+ Span empty_; // Dummy header for list of empty spans
+ Span nonempty_; // Dummy header for list of non-empty spans
+ size_t counter_; // Number of free objects in cache entry
+
+ // Here we reserve space for TCEntry cache slots. Since one size class can
+ // end up getting all the TCEntries quota in the system we just preallocate
+ // sufficient number of entries here.
+ TCEntry tc_slots_[kNumTransferEntries];
+
+ // Number of currently used cached entries in tc_slots_. This variable is
+ // updated under a lock but can be read without one.
+ int32_t used_slots_;
+ // The current number of slots for this size class. This is an
+ // adaptive value that is increased if there is lots of traffic
+ // on a given size class.
+ int32_t cache_size_;
+};
+
+// Pad each CentralCache object to multiple of 64 bytes
+class TCMalloc_Central_FreeListPadded : public TCMalloc_Central_FreeList {
+ private:
+ char pad_[(64 - (sizeof(TCMalloc_Central_FreeList) % 64)) % 64];
+};
+
+//-------------------------------------------------------------------
+// Global variables
+//-------------------------------------------------------------------
+
+// Central cache -- a collection of free-lists, one per size-class.
+// We have a separate lock per free-list to reduce contention.
+static TCMalloc_Central_FreeListPadded central_cache[kNumClasses];
+
+// Page-level allocator
+static SpinLock pageheap_lock = SPINLOCK_INITIALIZER;
+static AllocAlignmentInteger pageheap_memory[(sizeof(TCMalloc_PageHeap) + sizeof(AllocAlignmentInteger) - 1) / sizeof(AllocAlignmentInteger)];
+static bool phinited = false;
+
+// Avoid extra level of indirection by making "pageheap" be just an alias
+// of pageheap_memory.
+typedef union {
+ void* m_memory;
+ TCMalloc_PageHeap* m_pageHeap;
+} PageHeapUnion;
+
+static inline TCMalloc_PageHeap* getPageHeap()
+{
+ PageHeapUnion u = { &pageheap_memory[0] };
+ return u.m_pageHeap;
+}
+
+#define pageheap getPageHeap()
+
+#if USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY
+
+#if !HAVE(DISPATCH_H)
+#if OS(WINDOWS)
+static void sleep(unsigned seconds)
+{
+ ::Sleep(seconds * 1000);
+}
+#endif
+
+void TCMalloc_PageHeap::scavengerThread()
+{
+#if HAVE(PTHREAD_SETNAME_NP)
+ pthread_setname_np("JavaScriptCore: FastMalloc scavenger");
+#endif
+
+ while (1) {
+ if (!shouldScavenge()) {
+ pthread_mutex_lock(&m_scavengeMutex);
+ m_scavengeThreadActive = false;
+ // Block until there are enough free committed pages to release back to the system.
+ pthread_cond_wait(&m_scavengeCondition, &m_scavengeMutex);
+ m_scavengeThreadActive = true;
+ pthread_mutex_unlock(&m_scavengeMutex);
+ }
+ sleep(kScavengeDelayInSeconds);
+ {
+ SpinLockHolder h(&pageheap_lock);
+ pageheap->scavenge();
+ }
+ }
+}
+
+#else
+
+void TCMalloc_PageHeap::periodicScavenge()
+{
+ SpinLockHolder h(&pageheap_lock);
+ pageheap->scavenge();
+
+ if (!shouldScavenge()) {
+ m_scavengingScheduled = false;
+ dispatch_suspend(m_scavengeTimer);
+ }
+}
+#endif // HAVE(DISPATCH_H)
+
+#endif
+
+// If TLS is available, we also store a copy
+// of the per-thread object in a __thread variable
+// since __thread variables are faster to read
+// than pthread_getspecific(). We still need
+// pthread_setspecific() because __thread
+// variables provide no way to run cleanup
+// code when a thread is destroyed.
+#ifdef HAVE_TLS
+static __thread TCMalloc_ThreadCache *threadlocal_heap;
+#endif
+// Thread-specific key. Initialization here is somewhat tricky
+// because some Linux startup code invokes malloc() before it
+// is in a good enough state to handle pthread_keycreate().
+// Therefore, we use TSD keys only after tsd_inited is set to true.
+// Until then, we use a slow path to get the heap object.
+static bool tsd_inited = false;
+static pthread_key_t heap_key;
+#if OS(WINDOWS)
+DWORD tlsIndex = TLS_OUT_OF_INDEXES;
+#endif
+
+static ALWAYS_INLINE void setThreadHeap(TCMalloc_ThreadCache* heap)
+{
+ // still do pthread_setspecific when using MSVC fast TLS to
+ // benefit from the delete callback.
+ pthread_setspecific(heap_key, heap);
+#if OS(WINDOWS)
+ TlsSetValue(tlsIndex, heap);
+#endif
+}
+
+// Allocator for thread heaps
+static PageHeapAllocator<TCMalloc_ThreadCache> threadheap_allocator;
+
+// Linked list of heap objects. Protected by pageheap_lock.
+static TCMalloc_ThreadCache* thread_heaps = NULL;
+static int thread_heap_count = 0;
+
+// Overall thread cache size. Protected by pageheap_lock.
+static size_t overall_thread_cache_size = kDefaultOverallThreadCacheSize;
+
+// Global per-thread cache size. Writes are protected by
+// pageheap_lock. Reads are done without any locking, which should be
+// fine as long as size_t can be written atomically and we don't place
+// invariants between this variable and other pieces of state.
+static volatile size_t per_thread_cache_size = kMaxThreadCacheSize;
+
+//-------------------------------------------------------------------
+// Central cache implementation
+//-------------------------------------------------------------------
+
+void TCMalloc_Central_FreeList::Init(size_t cl) {
+ lock_.Init();
+ size_class_ = cl;
+ DLL_Init(&empty_);
+ DLL_Init(&nonempty_);
+ counter_ = 0;
+
+ cache_size_ = 1;
+ used_slots_ = 0;
+ ASSERT(cache_size_ <= kNumTransferEntries);
+}
+
+void TCMalloc_Central_FreeList::ReleaseListToSpans(void* start) {
+ while (start) {
+ void *next = SLL_Next(start);
+ ReleaseToSpans(start);
+ start = next;
+ }
+}
+
+ALWAYS_INLINE void TCMalloc_Central_FreeList::ReleaseToSpans(void* object) {
+ const PageID p = reinterpret_cast<uintptr_t>(object) >> kPageShift;
+ Span* span = pageheap->GetDescriptor(p);
+ ASSERT(span != NULL);
+ ASSERT(span->refcount > 0);
+
+ // If span is empty, move it to non-empty list
+ if (span->objects == NULL) {
+ DLL_Remove(span);
+ DLL_Prepend(&nonempty_, span);
+ Event(span, 'N', 0);
+ }
+
+ // The following check is expensive, so it is disabled by default
+ if (false) {
+ // Check that object does not occur in list
+ unsigned got = 0;
+ for (void* p = span->objects; p != NULL; p = *((void**) p)) {
+ ASSERT(p != object);
+ got++;
+ }
+ ASSERT(got + span->refcount ==
+ (span->length<<kPageShift)/ByteSizeForClass(span->sizeclass));
+ }
+
+ counter_++;
+ span->refcount--;
+ if (span->refcount == 0) {
+ Event(span, '#', 0);
+ counter_ -= (span->length<<kPageShift) / ByteSizeForClass(span->sizeclass);
+ DLL_Remove(span);
+
+ // Release central list lock while operating on pageheap
+ lock_.Unlock();
+ {
+ SpinLockHolder h(&pageheap_lock);
+ pageheap->Delete(span);
+ }
+ lock_.Lock();
+ } else {
+ *(reinterpret_cast<void**>(object)) = span->objects;
+ span->objects = object;
+ }
+}
+
+ALWAYS_INLINE bool TCMalloc_Central_FreeList::EvictRandomSizeClass(
+ size_t locked_size_class, bool force) {
+ static int race_counter = 0;
+ int t = race_counter++; // Updated without a lock, but who cares.
+ if (t >= static_cast<int>(kNumClasses)) {
+ while (t >= static_cast<int>(kNumClasses)) {
+ t -= kNumClasses;
+ }
+ race_counter = t;
+ }
+ ASSERT(t >= 0);
+ ASSERT(t < static_cast<int>(kNumClasses));
+ if (t == static_cast<int>(locked_size_class)) return false;
+ return central_cache[t].ShrinkCache(static_cast<int>(locked_size_class), force);
+}
+
+bool TCMalloc_Central_FreeList::MakeCacheSpace() {
+ // Is there room in the cache?
+ if (used_slots_ < cache_size_) return true;
+ // Check if we can expand this cache?
+ if (cache_size_ == kNumTransferEntries) return false;
+ // Ok, we'll try to grab an entry from some other size class.
+ if (EvictRandomSizeClass(size_class_, false) ||
+ EvictRandomSizeClass(size_class_, true)) {
+ // Succeeded in evicting, we're going to make our cache larger.
+ cache_size_++;
+ return true;
+ }
+ return false;
+}
+
+
+namespace {
+class LockInverter {
+ private:
+ SpinLock *held_, *temp_;
+ public:
+ inline explicit LockInverter(SpinLock* held, SpinLock *temp)
+ : held_(held), temp_(temp) { held_->Unlock(); temp_->Lock(); }
+ inline ~LockInverter() { temp_->Unlock(); held_->Lock(); }
+};
+}
+
+bool TCMalloc_Central_FreeList::ShrinkCache(int locked_size_class, bool force) {
+ // Start with a quick check without taking a lock.
+ if (cache_size_ == 0) return false;
+ // We don't evict from a full cache unless we are 'forcing'.
+ if (force == false && used_slots_ == cache_size_) return false;
+
+ // Grab lock, but first release the other lock held by this thread. We use
+ // the lock inverter to ensure that we never hold two size class locks
+ // concurrently. That can create a deadlock because there is no well
+ // defined nesting order.
+ LockInverter li(&central_cache[locked_size_class].lock_, &lock_);
+ ASSERT(used_slots_ <= cache_size_);
+ ASSERT(0 <= cache_size_);
+ if (cache_size_ == 0) return false;
+ if (used_slots_ == cache_size_) {
+ if (force == false) return false;
+ // ReleaseListToSpans releases the lock, so we have to make all the
+ // updates to the central list before calling it.
+ cache_size_--;
+ used_slots_--;
+ ReleaseListToSpans(tc_slots_[used_slots_].head);
+ return true;
+ }
+ cache_size_--;
+ return true;
+}
+
+void TCMalloc_Central_FreeList::InsertRange(void *start, void *end, int N) {
+ SpinLockHolder h(&lock_);
+ if (N == num_objects_to_move[size_class_] &&
+ MakeCacheSpace()) {
+ int slot = used_slots_++;
+ ASSERT(slot >=0);
+ ASSERT(slot < kNumTransferEntries);
+ TCEntry *entry = &tc_slots_[slot];
+ entry->head = start;
+ entry->tail = end;
+ return;
+ }
+ ReleaseListToSpans(start);
+}
+
+void TCMalloc_Central_FreeList::RemoveRange(void **start, void **end, int *N) {
+ int num = *N;
+ ASSERT(num > 0);
+
+ SpinLockHolder h(&lock_);
+ if (num == num_objects_to_move[size_class_] && used_slots_ > 0) {
+ int slot = --used_slots_;
+ ASSERT(slot >= 0);
+ TCEntry *entry = &tc_slots_[slot];
+ *start = entry->head;
+ *end = entry->tail;
+ return;
+ }
+
+ // TODO: Prefetch multiple TCEntries?
+ void *tail = FetchFromSpansSafe();
+ if (!tail) {
+ // We are completely out of memory.
+ *start = *end = NULL;
+ *N = 0;
+ return;
+ }
+
+ SLL_SetNext(tail, NULL);
+ void *head = tail;
+ int count = 1;
+ while (count < num) {
+ void *t = FetchFromSpans();
+ if (!t) break;
+ SLL_Push(&head, t);
+ count++;
+ }
+ *start = head;
+ *end = tail;
+ *N = count;
+}
+
+
+void* TCMalloc_Central_FreeList::FetchFromSpansSafe() {
+ void *t = FetchFromSpans();
+ if (!t) {
+ Populate();
+ t = FetchFromSpans();
+ }
+ return t;
+}
+
+void* TCMalloc_Central_FreeList::FetchFromSpans() {
+ if (DLL_IsEmpty(&nonempty_)) return NULL;
+ Span* span = nonempty_.next;
+
+ ASSERT(span->objects != NULL);
+ ASSERT_SPAN_COMMITTED(span);
+ span->refcount++;
+ void* result = span->objects;
+ span->objects = *(reinterpret_cast<void**>(result));
+ if (span->objects == NULL) {
+ // Move to empty list
+ DLL_Remove(span);
+ DLL_Prepend(&empty_, span);
+ Event(span, 'E', 0);
+ }
+ counter_--;
+ return result;
+}
+
+// Fetch memory from the system and add to the central cache freelist.
+ALWAYS_INLINE void TCMalloc_Central_FreeList::Populate() {
+ // Release central list lock while operating on pageheap
+ lock_.Unlock();
+ const size_t npages = class_to_pages[size_class_];
+
+ Span* span;
+ {
+ SpinLockHolder h(&pageheap_lock);
+ span = pageheap->New(npages);
+ if (span) pageheap->RegisterSizeClass(span, size_class_);
+ }
+ if (span == NULL) {
+#if HAVE(ERRNO_H)
+ MESSAGE("allocation failed: %d\n", errno);
+#elif OS(WINDOWS)
+ MESSAGE("allocation failed: %d\n", ::GetLastError());
+#else
+ MESSAGE("allocation failed\n");
+#endif
+ lock_.Lock();
+ return;
+ }
+ ASSERT_SPAN_COMMITTED(span);
+ ASSERT(span->length == npages);
+ // Cache sizeclass info eagerly. Locking is not necessary.
+ // (Instead of being eager, we could just replace any stale info
+ // about this span, but that seems to be no better in practice.)
+ for (size_t i = 0; i < npages; i++) {
+ pageheap->CacheSizeClass(span->start + i, size_class_);
+ }
+
+ // Split the block into pieces and add to the free-list
+ // TODO: coloring of objects to avoid cache conflicts?
+ void** tail = &span->objects;
+ char* ptr = reinterpret_cast<char*>(span->start << kPageShift);
+ char* limit = ptr + (npages << kPageShift);
+ const size_t size = ByteSizeForClass(size_class_);
+ int num = 0;
+ char* nptr;
+ while ((nptr = ptr + size) <= limit) {
+ *tail = ptr;
+ tail = reinterpret_cast_ptr<void**>(ptr);
+ ptr = nptr;
+ num++;
+ }
+ ASSERT(ptr <= limit);
+ *tail = NULL;
+ span->refcount = 0; // No sub-object in use yet
+
+ // Add span to list of non-empty spans
+ lock_.Lock();
+ DLL_Prepend(&nonempty_, span);
+ counter_ += num;
+}
+
+//-------------------------------------------------------------------
+// TCMalloc_ThreadCache implementation
+//-------------------------------------------------------------------
+
+inline bool TCMalloc_ThreadCache::SampleAllocation(size_t k) {
+ if (bytes_until_sample_ < k) {
+ PickNextSample(k);
+ return true;
+ } else {
+ bytes_until_sample_ -= k;
+ return false;
+ }
+}
+
+void TCMalloc_ThreadCache::Init(ThreadIdentifier tid) {
+ size_ = 0;
+ next_ = NULL;
+ prev_ = NULL;
+ tid_ = tid;
+ in_setspecific_ = false;
+ for (size_t cl = 0; cl < kNumClasses; ++cl) {
+ list_[cl].Init();
+ }
+
+ // Initialize RNG -- run it for a bit to get to good values
+ bytes_until_sample_ = 0;
+ rnd_ = static_cast<uint32_t>(reinterpret_cast<uintptr_t>(this));
+ for (int i = 0; i < 100; i++) {
+ PickNextSample(static_cast<size_t>(FLAGS_tcmalloc_sample_parameter * 2));
+ }
+}
+
+void TCMalloc_ThreadCache::Cleanup() {
+ // Put unused memory back into central cache
+ for (size_t cl = 0; cl < kNumClasses; ++cl) {
+ if (list_[cl].length() > 0) {
+ ReleaseToCentralCache(cl, list_[cl].length());
+ }
+ }
+}
+
+ALWAYS_INLINE void* TCMalloc_ThreadCache::Allocate(size_t size) {
+ ASSERT(size <= kMaxSize);
+ const size_t cl = SizeClass(size);
+ FreeList* list = &list_[cl];
+ size_t allocationSize = ByteSizeForClass(cl);
+ if (list->empty()) {
+ FetchFromCentralCache(cl, allocationSize);
+ if (list->empty()) return NULL;
+ }
+ size_ -= allocationSize;
+ return list->Pop();
+}
+
+inline void TCMalloc_ThreadCache::Deallocate(void* ptr, size_t cl) {
+ size_ += ByteSizeForClass(cl);
+ FreeList* list = &list_[cl];
+ list->Push(ptr);
+ // If enough data is free, put back into central cache
+ if (list->length() > kMaxFreeListLength) {
+ ReleaseToCentralCache(cl, num_objects_to_move[cl]);
+ }
+ if (size_ >= per_thread_cache_size) Scavenge();
+}
+
+// Remove some objects of class "cl" from central cache and add to thread heap
+ALWAYS_INLINE void TCMalloc_ThreadCache::FetchFromCentralCache(size_t cl, size_t allocationSize) {
+ int fetch_count = num_objects_to_move[cl];
+ void *start, *end;
+ central_cache[cl].RemoveRange(&start, &end, &fetch_count);
+ list_[cl].PushRange(fetch_count, start, end);
+ size_ += allocationSize * fetch_count;
+}
+
+// Remove some objects of class "cl" from thread heap and add to central cache
+inline void TCMalloc_ThreadCache::ReleaseToCentralCache(size_t cl, int N) {
+ ASSERT(N > 0);
+ FreeList* src = &list_[cl];
+ if (N > src->length()) N = src->length();
+ size_ -= N*ByteSizeForClass(cl);
+
+ // We return prepackaged chains of the correct size to the central cache.
+ // TODO: Use the same format internally in the thread caches?
+ int batch_size = num_objects_to_move[cl];
+ while (N > batch_size) {
+ void *tail, *head;
+ src->PopRange(batch_size, &head, &tail);
+ central_cache[cl].InsertRange(head, tail, batch_size);
+ N -= batch_size;
+ }
+ void *tail, *head;
+ src->PopRange(N, &head, &tail);
+ central_cache[cl].InsertRange(head, tail, N);
+}
+
+// Release idle memory to the central cache
+inline void TCMalloc_ThreadCache::Scavenge() {
+ // If the low-water mark for the free list is L, it means we would
+ // not have had to allocate anything from the central cache even if
+ // we had reduced the free list size by L. We aim to get closer to
+ // that situation by dropping L/2 nodes from the free list. This
+ // may not release much memory, but if so we will call scavenge again
+ // pretty soon and the low-water marks will be high on that call.
+ //int64 start = CycleClock::Now();
+
+ for (size_t cl = 0; cl < kNumClasses; cl++) {
+ FreeList* list = &list_[cl];
+ const int lowmark = list->lowwatermark();
+ if (lowmark > 0) {
+ const int drop = (lowmark > 1) ? lowmark/2 : 1;
+ ReleaseToCentralCache(cl, drop);
+ }
+ list->clear_lowwatermark();
+ }
+
+ //int64 finish = CycleClock::Now();
+ //CycleTimer ct;
+ //MESSAGE("GC: %.0f ns\n", ct.CyclesToUsec(finish-start)*1000.0);
+}
+
+void TCMalloc_ThreadCache::PickNextSample(size_t k) {
+ // Make next "random" number
+ // x^32+x^22+x^2+x^1+1 is a primitive polynomial for random numbers
+ static const uint32_t kPoly = (1 << 22) | (1 << 2) | (1 << 1) | (1 << 0);
+ uint32_t r = rnd_;
+ rnd_ = (r << 1) ^ ((static_cast<int32_t>(r) >> 31) & kPoly);
+
+ // Next point is "rnd_ % (sample_period)". I.e., average
+ // increment is "sample_period/2".
+ const int flag_value = static_cast<int>(FLAGS_tcmalloc_sample_parameter);
+ static int last_flag_value = -1;
+
+ if (flag_value != last_flag_value) {
+ SpinLockHolder h(&sample_period_lock);
+ int i;
+ for (i = 0; i < (static_cast<int>(sizeof(primes_list)/sizeof(primes_list[0])) - 1); i++) {
+ if (primes_list[i] >= flag_value) {
+ break;
+ }
+ }
+ sample_period = primes_list[i];
+ last_flag_value = flag_value;
+ }
+
+ bytes_until_sample_ += rnd_ % sample_period;
+
+ if (k > (static_cast<size_t>(-1) >> 2)) {
+ // If the user has asked for a huge allocation then it is possible
+ // for the code below to loop infinitely. Just return (note that
+ // this throws off the sampling accuracy somewhat, but a user who
+ // is allocating more than 1G of memory at a time can live with a
+ // minor inaccuracy in profiling of small allocations, and also
+ // would rather not wait for the loop below to terminate).
+ return;
+ }
+
+ while (bytes_until_sample_ < k) {
+ // Increase bytes_until_sample_ by enough average sampling periods
+ // (sample_period >> 1) to allow us to sample past the current
+ // allocation.
+ bytes_until_sample_ += (sample_period >> 1);
+ }
+
+ bytes_until_sample_ -= k;
+}
+
+void TCMalloc_ThreadCache::InitModule() {
+ // There is a slight potential race here because of double-checked
+ // locking idiom. However, as long as the program does a small
+ // allocation before switching to multi-threaded mode, we will be
+ // fine. We increase the chances of doing such a small allocation
+ // by doing one in the constructor of the module_enter_exit_hook
+ // object declared below.
+ SpinLockHolder h(&pageheap_lock);
+ if (!phinited) {
+#ifdef WTF_CHANGES
+ InitTSD();
+#endif
+ InitSizeClasses();
+ threadheap_allocator.Init();
+ span_allocator.Init();
+ span_allocator.New(); // Reduce cache conflicts
+ span_allocator.New(); // Reduce cache conflicts
+ stacktrace_allocator.Init();
+ DLL_Init(&sampled_objects);
+ for (size_t i = 0; i < kNumClasses; ++i) {
+ central_cache[i].Init(i);
+ }
+ pageheap->init();
+ phinited = 1;
+#if defined(WTF_CHANGES) && OS(DARWIN)
+ FastMallocZone::init();
+#endif
+ }
+}
+
+inline TCMalloc_ThreadCache* TCMalloc_ThreadCache::NewHeap(ThreadIdentifier tid) {
+ // Create the heap and add it to the linked list
+ TCMalloc_ThreadCache *heap = threadheap_allocator.New();
+ heap->Init(tid);
+ heap->next_ = thread_heaps;
+ heap->prev_ = NULL;
+ if (thread_heaps != NULL) thread_heaps->prev_ = heap;
+ thread_heaps = heap;
+ thread_heap_count++;
+ RecomputeThreadCacheSize();
+ return heap;
+}
+
+inline TCMalloc_ThreadCache* TCMalloc_ThreadCache::GetThreadHeap() {
+#ifdef HAVE_TLS
+ // __thread is faster, but only when the kernel supports it
+ if (KernelSupportsTLS())
+ return threadlocal_heap;
+#elif OS(WINDOWS)
+ return static_cast<TCMalloc_ThreadCache*>(TlsGetValue(tlsIndex));
+#else
+ return static_cast<TCMalloc_ThreadCache*>(pthread_getspecific(heap_key));
+#endif
+}
+
+inline TCMalloc_ThreadCache* TCMalloc_ThreadCache::GetCache() {
+ TCMalloc_ThreadCache* ptr = NULL;
+ if (!tsd_inited) {
+ InitModule();
+ } else {
+ ptr = GetThreadHeap();
+ }
+ if (ptr == NULL) ptr = CreateCacheIfNecessary();
+ return ptr;
+}
+
+// In deletion paths, we do not try to create a thread-cache. This is
+// because we may be in the thread destruction code and may have
+// already cleaned up the cache for this thread.
+inline TCMalloc_ThreadCache* TCMalloc_ThreadCache::GetCacheIfPresent() {
+ if (!tsd_inited) return NULL;
+ void* const p = GetThreadHeap();
+ return reinterpret_cast<TCMalloc_ThreadCache*>(p);
+}
+
+void TCMalloc_ThreadCache::InitTSD() {
+ ASSERT(!tsd_inited);
+ pthread_key_create(&heap_key, DestroyThreadCache);
+#if OS(WINDOWS)
+ tlsIndex = TlsAlloc();
+#endif
+ tsd_inited = true;
+
+#if !OS(WINDOWS)
+ // We may have used a fake pthread_t for the main thread. Fix it.
+ pthread_t zero;
+ memset(&zero, 0, sizeof(zero));
+#endif
+#ifndef WTF_CHANGES
+ SpinLockHolder h(&pageheap_lock);
+#else
+ ASSERT(pageheap_lock.IsHeld());
+#endif
+ for (TCMalloc_ThreadCache* h = thread_heaps; h != NULL; h = h->next_) {
+#if OS(WINDOWS)
+ if (h->tid_ == 0) {
+ h->tid_ = GetCurrentThreadId();
+ }
+#else
+ if (pthread_equal(h->tid_, zero)) {
+ h->tid_ = pthread_self();
+ }
+#endif
+ }
+}
+
+TCMalloc_ThreadCache* TCMalloc_ThreadCache::CreateCacheIfNecessary() {
+ // Initialize per-thread data if necessary
+ TCMalloc_ThreadCache* heap = NULL;
+ {
+ SpinLockHolder h(&pageheap_lock);
+
+#if OS(WINDOWS)
+ DWORD me;
+ if (!tsd_inited) {
+ me = 0;
+ } else {
+ me = GetCurrentThreadId();
+ }
+#else
+ // Early on in glibc's life, we cannot even call pthread_self()
+ pthread_t me;
+ if (!tsd_inited) {
+ memset(&me, 0, sizeof(me));
+ } else {
+ me = pthread_self();
+ }
+#endif
+
+ // This may be a recursive malloc call from pthread_setspecific()
+ // In that case, the heap for this thread has already been created
+ // and added to the linked list. So we search for that first.
+ for (TCMalloc_ThreadCache* h = thread_heaps; h != NULL; h = h->next_) {
+#if OS(WINDOWS)
+ if (h->tid_ == me) {
+#else
+ if (pthread_equal(h->tid_, me)) {
+#endif
+ heap = h;
+ break;
+ }
+ }
+
+ if (heap == NULL) heap = NewHeap(me);
+ }
+
+ // We call pthread_setspecific() outside the lock because it may
+ // call malloc() recursively. The recursive call will never get
+ // here again because it will find the already allocated heap in the
+ // linked list of heaps.
+ if (!heap->in_setspecific_ && tsd_inited) {
+ heap->in_setspecific_ = true;
+ setThreadHeap(heap);
+ }
+ return heap;
+}
+
+void TCMalloc_ThreadCache::BecomeIdle() {
+ if (!tsd_inited) return; // No caches yet
+ TCMalloc_ThreadCache* heap = GetThreadHeap();
+ if (heap == NULL) return; // No thread cache to remove
+ if (heap->in_setspecific_) return; // Do not disturb the active caller
+
+ heap->in_setspecific_ = true;
+ setThreadHeap(NULL);
+#ifdef HAVE_TLS
+ // Also update the copy in __thread
+ threadlocal_heap = NULL;
+#endif
+ heap->in_setspecific_ = false;
+ if (GetThreadHeap() == heap) {
+ // Somehow heap got reinstated by a recursive call to malloc
+ // from pthread_setspecific. We give up in this case.
+ return;
+ }
+
+ // We can now get rid of the heap
+ DeleteCache(heap);
+}
+
+void TCMalloc_ThreadCache::DestroyThreadCache(void* ptr) {
+ // Note that "ptr" cannot be NULL since pthread promises not
+ // to invoke the destructor on NULL values, but for safety,
+ // we check anyway.
+ if (ptr == NULL) return;
+#ifdef HAVE_TLS
+ // Prevent fast path of GetThreadHeap() from returning heap.
+ threadlocal_heap = NULL;
+#endif
+ DeleteCache(reinterpret_cast<TCMalloc_ThreadCache*>(ptr));
+}
+
+void TCMalloc_ThreadCache::DeleteCache(TCMalloc_ThreadCache* heap) {
+ // Remove all memory from heap
+ heap->Cleanup();
+
+ // Remove from linked list
+ SpinLockHolder h(&pageheap_lock);
+ if (heap->next_ != NULL) heap->next_->prev_ = heap->prev_;
+ if (heap->prev_ != NULL) heap->prev_->next_ = heap->next_;
+ if (thread_heaps == heap) thread_heaps = heap->next_;
+ thread_heap_count--;
+ RecomputeThreadCacheSize();
+
+ threadheap_allocator.Delete(heap);
+}
+
+void TCMalloc_ThreadCache::RecomputeThreadCacheSize() {
+ // Divide available space across threads
+ int n = thread_heap_count > 0 ? thread_heap_count : 1;
+ size_t space = overall_thread_cache_size / n;
+
+ // Limit to allowed range
+ if (space < kMinThreadCacheSize) space = kMinThreadCacheSize;
+ if (space > kMaxThreadCacheSize) space = kMaxThreadCacheSize;
+
+ per_thread_cache_size = space;
+}
+
+void TCMalloc_ThreadCache::Print() const {
+ for (size_t cl = 0; cl < kNumClasses; ++cl) {
+ MESSAGE(" %5" PRIuS " : %4d len; %4d lo\n",
+ ByteSizeForClass(cl),
+ list_[cl].length(),
+ list_[cl].lowwatermark());
+ }
+}
+
+// Extract interesting stats
+struct TCMallocStats {
+ uint64_t system_bytes; // Bytes alloced from system
+ uint64_t thread_bytes; // Bytes in thread caches
+ uint64_t central_bytes; // Bytes in central cache
+ uint64_t transfer_bytes; // Bytes in central transfer cache
+ uint64_t pageheap_bytes; // Bytes in page heap
+ uint64_t metadata_bytes; // Bytes alloced for metadata
+};
+
+#ifndef WTF_CHANGES
+// Get stats into "r". Also get per-size-class counts if class_count != NULL
+static void ExtractStats(TCMallocStats* r, uint64_t* class_count) {
+ r->central_bytes = 0;
+ r->transfer_bytes = 0;
+ for (int cl = 0; cl < kNumClasses; ++cl) {
+ const int length = central_cache[cl].length();
+ const int tc_length = central_cache[cl].tc_length();
+ r->central_bytes += static_cast<uint64_t>(ByteSizeForClass(cl)) * length;
+ r->transfer_bytes +=
+ static_cast<uint64_t>(ByteSizeForClass(cl)) * tc_length;
+ if (class_count) class_count[cl] = length + tc_length;
+ }
+
+ // Add stats from per-thread heaps
+ r->thread_bytes = 0;
+ { // scope
+ SpinLockHolder h(&pageheap_lock);
+ for (TCMalloc_ThreadCache* h = thread_heaps; h != NULL; h = h->next_) {
+ r->thread_bytes += h->Size();
+ if (class_count) {
+ for (size_t cl = 0; cl < kNumClasses; ++cl) {
+ class_count[cl] += h->freelist_length(cl);
+ }
+ }
+ }
+ }
+
+ { //scope
+ SpinLockHolder h(&pageheap_lock);
+ r->system_bytes = pageheap->SystemBytes();
+ r->metadata_bytes = metadata_system_bytes;
+ r->pageheap_bytes = pageheap->FreeBytes();
+ }
+}
+#endif
+
+#ifndef WTF_CHANGES
+// WRITE stats to "out"
+static void DumpStats(TCMalloc_Printer* out, int level) {
+ TCMallocStats stats;
+ uint64_t class_count[kNumClasses];
+ ExtractStats(&stats, (level >= 2 ? class_count : NULL));
+
+ if (level >= 2) {
+ out->printf("------------------------------------------------\n");
+ uint64_t cumulative = 0;
+ for (int cl = 0; cl < kNumClasses; ++cl) {
+ if (class_count[cl] > 0) {
+ uint64_t class_bytes = class_count[cl] * ByteSizeForClass(cl);
+ cumulative += class_bytes;
+ out->printf("class %3d [ %8" PRIuS " bytes ] : "
+ "%8" PRIu64 " objs; %5.1f MB; %5.1f cum MB\n",
+ cl, ByteSizeForClass(cl),
+ class_count[cl],
+ class_bytes / 1048576.0,
+ cumulative / 1048576.0);
+ }
+ }
+
+ SpinLockHolder h(&pageheap_lock);
+ pageheap->Dump(out);
+ }
+
+ const uint64_t bytes_in_use = stats.system_bytes
+ - stats.pageheap_bytes
+ - stats.central_bytes
+ - stats.transfer_bytes
+ - stats.thread_bytes;
+
+ out->printf("------------------------------------------------\n"
+ "MALLOC: %12" PRIu64 " Heap size\n"
+ "MALLOC: %12" PRIu64 " Bytes in use by application\n"
+ "MALLOC: %12" PRIu64 " Bytes free in page heap\n"
+ "MALLOC: %12" PRIu64 " Bytes free in central cache\n"
+ "MALLOC: %12" PRIu64 " Bytes free in transfer cache\n"
+ "MALLOC: %12" PRIu64 " Bytes free in thread caches\n"
+ "MALLOC: %12" PRIu64 " Spans in use\n"
+ "MALLOC: %12" PRIu64 " Thread heaps in use\n"
+ "MALLOC: %12" PRIu64 " Metadata allocated\n"
+ "------------------------------------------------\n",
+ stats.system_bytes,
+ bytes_in_use,
+ stats.pageheap_bytes,
+ stats.central_bytes,
+ stats.transfer_bytes,
+ stats.thread_bytes,
+ uint64_t(span_allocator.inuse()),
+ uint64_t(threadheap_allocator.inuse()),
+ stats.metadata_bytes);
+}
+
+static void PrintStats(int level) {
+ const int kBufferSize = 16 << 10;
+ char* buffer = new char[kBufferSize];
+ TCMalloc_Printer printer(buffer, kBufferSize);
+ DumpStats(&printer, level);
+ write(STDERR_FILENO, buffer, strlen(buffer));
+ delete[] buffer;
+}
+
+static void** DumpStackTraces() {
+ // Count how much space we need
+ int needed_slots = 0;
+ {
+ SpinLockHolder h(&pageheap_lock);
+ for (Span* s = sampled_objects.next; s != &sampled_objects; s = s->next) {
+ StackTrace* stack = reinterpret_cast<StackTrace*>(s->objects);
+ needed_slots += 3 + stack->depth;
+ }
+ needed_slots += 100; // Slop in case sample grows
+ needed_slots += needed_slots/8; // An extra 12.5% slop
+ }
+
+ void** result = new void*[needed_slots];
+ if (result == NULL) {
+ MESSAGE("tcmalloc: could not allocate %d slots for stack traces\n",
+ needed_slots);
+ return NULL;
+ }
+
+ SpinLockHolder h(&pageheap_lock);
+ int used_slots = 0;
+ for (Span* s = sampled_objects.next; s != &sampled_objects; s = s->next) {
+ ASSERT(used_slots < needed_slots); // Need to leave room for terminator
+ StackTrace* stack = reinterpret_cast<StackTrace*>(s->objects);
+ if (used_slots + 3 + stack->depth >= needed_slots) {
+ // No more room
+ break;
+ }
+
+ result[used_slots+0] = reinterpret_cast<void*>(static_cast<uintptr_t>(1));
+ result[used_slots+1] = reinterpret_cast<void*>(stack->size);
+ result[used_slots+2] = reinterpret_cast<void*>(stack->depth);
+ for (int d = 0; d < stack->depth; d++) {
+ result[used_slots+3+d] = stack->stack[d];
+ }
+ used_slots += 3 + stack->depth;
+ }
+ result[used_slots] = reinterpret_cast<void*>(static_cast<uintptr_t>(0));
+ return result;
+}
+#endif
+
+#ifndef WTF_CHANGES
+
+// TCMalloc's support for extra malloc interfaces
+class TCMallocImplementation : public MallocExtension {
+ public:
+ virtual void GetStats(char* buffer, int buffer_length) {
+ ASSERT(buffer_length > 0);
+ TCMalloc_Printer printer(buffer, buffer_length);
+
+ // Print level one stats unless lots of space is available
+ if (buffer_length < 10000) {
+ DumpStats(&printer, 1);
+ } else {
+ DumpStats(&printer, 2);
+ }
+ }
+
+ virtual void** ReadStackTraces() {
+ return DumpStackTraces();
+ }
+
+ virtual bool GetNumericProperty(const char* name, size_t* value) {
+ ASSERT(name != NULL);
+
+ if (strcmp(name, "generic.current_allocated_bytes") == 0) {
+ TCMallocStats stats;
+ ExtractStats(&stats, NULL);
+ *value = stats.system_bytes
+ - stats.thread_bytes
+ - stats.central_bytes
+ - stats.pageheap_bytes;
+ return true;
+ }
+
+ if (strcmp(name, "generic.heap_size") == 0) {
+ TCMallocStats stats;
+ ExtractStats(&stats, NULL);
+ *value = stats.system_bytes;
+ return true;
+ }
+
+ if (strcmp(name, "tcmalloc.slack_bytes") == 0) {
+ // We assume that bytes in the page heap are not fragmented too
+ // badly, and are therefore available for allocation.
+ SpinLockHolder l(&pageheap_lock);
+ *value = pageheap->FreeBytes();
+ return true;
+ }
+
+ if (strcmp(name, "tcmalloc.max_total_thread_cache_bytes") == 0) {
+ SpinLockHolder l(&pageheap_lock);
+ *value = overall_thread_cache_size;
+ return true;
+ }
+
+ if (strcmp(name, "tcmalloc.current_total_thread_cache_bytes") == 0) {
+ TCMallocStats stats;
+ ExtractStats(&stats, NULL);
+ *value = stats.thread_bytes;
+ return true;
+ }
+
+ return false;
+ }
+
+ virtual bool SetNumericProperty(const char* name, size_t value) {
+ ASSERT(name != NULL);
+
+ if (strcmp(name, "tcmalloc.max_total_thread_cache_bytes") == 0) {
+ // Clip the value to a reasonable range
+ if (value < kMinThreadCacheSize) value = kMinThreadCacheSize;
+ if (value > (1<<30)) value = (1<<30); // Limit to 1GB
+
+ SpinLockHolder l(&pageheap_lock);
+ overall_thread_cache_size = static_cast<size_t>(value);
+ TCMalloc_ThreadCache::RecomputeThreadCacheSize();
+ return true;
+ }
+
+ return false;
+ }
+
+ virtual void MarkThreadIdle() {
+ TCMalloc_ThreadCache::BecomeIdle();
+ }
+
+ virtual void ReleaseFreeMemory() {
+ SpinLockHolder h(&pageheap_lock);
+ pageheap->ReleaseFreePages();
+ }
+};
+#endif
+
+// The constructor allocates an object to ensure that initialization
+// runs before main(), and therefore we do not have a chance to become
+// multi-threaded before initialization. We also create the TSD key
+// here. Presumably by the time this constructor runs, glibc is in
+// good enough shape to handle pthread_key_create().
+//
+// The constructor also takes the opportunity to tell STL to use
+// tcmalloc. We want to do this early, before construct time, so
+// all user STL allocations go through tcmalloc (which works really
+// well for STL).
+//
+// The destructor prints stats when the program exits.
+class TCMallocGuard {
+ public:
+
+ TCMallocGuard() {
+#ifdef HAVE_TLS // this is true if the cc/ld/libc combo support TLS
+ // Check whether the kernel also supports TLS (needs to happen at runtime)
+ CheckIfKernelSupportsTLS();
+#endif
+#ifndef WTF_CHANGES
+#ifdef WIN32 // patch the windows VirtualAlloc, etc.
+ PatchWindowsFunctions(); // defined in windows/patch_functions.cc
+#endif
+#endif
+ free(malloc(1));
+ TCMalloc_ThreadCache::InitTSD();
+ free(malloc(1));
+#ifndef WTF_CHANGES
+ MallocExtension::Register(new TCMallocImplementation);
+#endif
+ }
+
+#ifndef WTF_CHANGES
+ ~TCMallocGuard() {
+ const char* env = getenv("MALLOCSTATS");
+ if (env != NULL) {
+ int level = atoi(env);
+ if (level < 1) level = 1;
+ PrintStats(level);
+ }
+#ifdef WIN32
+ UnpatchWindowsFunctions();
+#endif
+ }
+#endif
+};
+
+#ifndef WTF_CHANGES
+static TCMallocGuard module_enter_exit_hook;
+#endif
+
+
+//-------------------------------------------------------------------
+// Helpers for the exported routines below
+//-------------------------------------------------------------------
+
+#ifndef WTF_CHANGES
+
+static Span* DoSampledAllocation(size_t size) {
+
+ // Grab the stack trace outside the heap lock
+ StackTrace tmp;
+ tmp.depth = GetStackTrace(tmp.stack, kMaxStackDepth, 1);
+ tmp.size = size;
+
+ SpinLockHolder h(&pageheap_lock);
+ // Allocate span
+ Span *span = pageheap->New(pages(size == 0 ? 1 : size));
+ if (span == NULL) {
+ return NULL;
+ }
+
+ // Allocate stack trace
+ StackTrace *stack = stacktrace_allocator.New();
+ if (stack == NULL) {
+ // Sampling failed because of lack of memory
+ return span;
+ }
+
+ *stack = tmp;
+ span->sample = 1;
+ span->objects = stack;
+ DLL_Prepend(&sampled_objects, span);
+
+ return span;
+}
+#endif
+
+static inline bool CheckCachedSizeClass(void *ptr) {
+ PageID p = reinterpret_cast<uintptr_t>(ptr) >> kPageShift;
+ size_t cached_value = pageheap->GetSizeClassIfCached(p);
+ return cached_value == 0 ||
+ cached_value == pageheap->GetDescriptor(p)->sizeclass;
+}
+
+static inline void* CheckedMallocResult(void *result)
+{
+ ASSERT(result == 0 || CheckCachedSizeClass(result));
+ return result;
+}
+
+static inline void* SpanToMallocResult(Span *span) {
+ ASSERT_SPAN_COMMITTED(span);
+ pageheap->CacheSizeClass(span->start, 0);
+ return
+ CheckedMallocResult(reinterpret_cast<void*>(span->start << kPageShift));
+}
+
+#ifdef WTF_CHANGES
+template <bool crashOnFailure>
+#endif
+static ALWAYS_INLINE void* do_malloc(size_t size) {
+ void* ret = NULL;
+
+#ifdef WTF_CHANGES
+ ASSERT(!isForbidden());
+#endif
+
+ // The following call forces module initialization
+ TCMalloc_ThreadCache* heap = TCMalloc_ThreadCache::GetCache();
+#ifndef WTF_CHANGES
+ if ((FLAGS_tcmalloc_sample_parameter > 0) && heap->SampleAllocation(size)) {
+ Span* span = DoSampledAllocation(size);
+ if (span != NULL) {
+ ret = SpanToMallocResult(span);
+ }
+ } else
+#endif
+ if (size > kMaxSize) {
+ // Use page-level allocator
+ SpinLockHolder h(&pageheap_lock);
+ Span* span = pageheap->New(pages(size));
+ if (span != NULL) {
+ ret = SpanToMallocResult(span);
+ }
+ } else {
+ // The common case, and also the simplest. This just pops the
+ // size-appropriate freelist, afer replenishing it if it's empty.
+ ret = CheckedMallocResult(heap->Allocate(size));
+ }
+ if (!ret) {
+#ifdef WTF_CHANGES
+ if (crashOnFailure) // This branch should be optimized out by the compiler.
+ CRASH();
+#else
+ errno = ENOMEM;
+#endif
+ }
+ return ret;
+}
+
+static ALWAYS_INLINE void do_free(void* ptr) {
+ if (ptr == NULL) return;
+ ASSERT(pageheap != NULL); // Should not call free() before malloc()
+ const PageID p = reinterpret_cast<uintptr_t>(ptr) >> kPageShift;
+ Span* span = NULL;
+ size_t cl = pageheap->GetSizeClassIfCached(p);
+
+ if (cl == 0) {
+ span = pageheap->GetDescriptor(p);
+ cl = span->sizeclass;
+ pageheap->CacheSizeClass(p, cl);
+ }
+ if (cl != 0) {
+#ifndef NO_TCMALLOC_SAMPLES
+ ASSERT(!pageheap->GetDescriptor(p)->sample);
+#endif
+ TCMalloc_ThreadCache* heap = TCMalloc_ThreadCache::GetCacheIfPresent();
+ if (heap != NULL) {
+ heap->Deallocate(ptr, cl);
+ } else {
+ // Delete directly into central cache
+ SLL_SetNext(ptr, NULL);
+ central_cache[cl].InsertRange(ptr, ptr, 1);
+ }
+ } else {
+ SpinLockHolder h(&pageheap_lock);
+ ASSERT(reinterpret_cast<uintptr_t>(ptr) % kPageSize == 0);
+ ASSERT(span != NULL && span->start == p);
+#ifndef NO_TCMALLOC_SAMPLES
+ if (span->sample) {
+ DLL_Remove(span);
+ stacktrace_allocator.Delete(reinterpret_cast<StackTrace*>(span->objects));
+ span->objects = NULL;
+ }
+#endif
+ pageheap->Delete(span);
+ }
+}
+
+#ifndef WTF_CHANGES
+// For use by exported routines below that want specific alignments
+//
+// Note: this code can be slow, and can significantly fragment memory.
+// The expectation is that memalign/posix_memalign/valloc/pvalloc will
+// not be invoked very often. This requirement simplifies our
+// implementation and allows us to tune for expected allocation
+// patterns.
+static void* do_memalign(size_t align, size_t size) {
+ ASSERT((align & (align - 1)) == 0);
+ ASSERT(align > 0);
+ if (pageheap == NULL) TCMalloc_ThreadCache::InitModule();
+
+ // Allocate at least one byte to avoid boundary conditions below
+ if (size == 0) size = 1;
+
+ if (size <= kMaxSize && align < kPageSize) {
+ // Search through acceptable size classes looking for one with
+ // enough alignment. This depends on the fact that
+ // InitSizeClasses() currently produces several size classes that
+ // are aligned at powers of two. We will waste time and space if
+ // we miss in the size class array, but that is deemed acceptable
+ // since memalign() should be used rarely.
+ size_t cl = SizeClass(size);
+ while (cl < kNumClasses && ((class_to_size[cl] & (align - 1)) != 0)) {
+ cl++;
+ }
+ if (cl < kNumClasses) {
+ TCMalloc_ThreadCache* heap = TCMalloc_ThreadCache::GetCache();
+ return CheckedMallocResult(heap->Allocate(class_to_size[cl]));
+ }
+ }
+
+ // We will allocate directly from the page heap
+ SpinLockHolder h(&pageheap_lock);
+
+ if (align <= kPageSize) {
+ // Any page-level allocation will be fine
+ // TODO: We could put the rest of this page in the appropriate
+ // TODO: cache but it does not seem worth it.
+ Span* span = pageheap->New(pages(size));
+ return span == NULL ? NULL : SpanToMallocResult(span);
+ }
+
+ // Allocate extra pages and carve off an aligned portion
+ const Length alloc = pages(size + align);
+ Span* span = pageheap->New(alloc);
+ if (span == NULL) return NULL;
+
+ // Skip starting portion so that we end up aligned
+ Length skip = 0;
+ while ((((span->start+skip) << kPageShift) & (align - 1)) != 0) {
+ skip++;
+ }
+ ASSERT(skip < alloc);
+ if (skip > 0) {
+ Span* rest = pageheap->Split(span, skip);
+ pageheap->Delete(span);
+ span = rest;
+ }
+
+ // Skip trailing portion that we do not need to return
+ const Length needed = pages(size);
+ ASSERT(span->length >= needed);
+ if (span->length > needed) {
+ Span* trailer = pageheap->Split(span, needed);
+ pageheap->Delete(trailer);
+ }
+ return SpanToMallocResult(span);
+}
+#endif
+
+// Helpers for use by exported routines below:
+
+#ifndef WTF_CHANGES
+static inline void do_malloc_stats() {
+ PrintStats(1);
+}
+#endif
+
+static inline int do_mallopt(int, int) {
+ return 1; // Indicates error
+}
+
+#ifdef HAVE_STRUCT_MALLINFO // mallinfo isn't defined on freebsd, for instance
+static inline struct mallinfo do_mallinfo() {
+ TCMallocStats stats;
+ ExtractStats(&stats, NULL);
+
+ // Just some of the fields are filled in.
+ struct mallinfo info;
+ memset(&info, 0, sizeof(info));
+
+ // Unfortunately, the struct contains "int" field, so some of the
+ // size values will be truncated.
+ info.arena = static_cast<int>(stats.system_bytes);
+ info.fsmblks = static_cast<int>(stats.thread_bytes
+ + stats.central_bytes
+ + stats.transfer_bytes);
+ info.fordblks = static_cast<int>(stats.pageheap_bytes);
+ info.uordblks = static_cast<int>(stats.system_bytes
+ - stats.thread_bytes
+ - stats.central_bytes
+ - stats.transfer_bytes
+ - stats.pageheap_bytes);
+
+ return info;
+}
+#endif
+
+//-------------------------------------------------------------------
+// Exported routines
+//-------------------------------------------------------------------
+
+// CAVEAT: The code structure below ensures that MallocHook methods are always
+// called from the stack frame of the invoked allocation function.
+// heap-checker.cc depends on this to start a stack trace from
+// the call to the (de)allocation function.
+
+#ifndef WTF_CHANGES
+extern "C"
+#else
+#define do_malloc do_malloc<crashOnFailure>
+
+template <bool crashOnFailure>
+ALWAYS_INLINE void* malloc(size_t);
+
+void* fastMalloc(size_t size)
+{
+ return malloc<true>(size);
+}
+
+TryMallocReturnValue tryFastMalloc(size_t size)
+{
+ return malloc<false>(size);
+}
+
+template <bool crashOnFailure>
+ALWAYS_INLINE
+#endif
+void* malloc(size_t size) {
+#if ENABLE(FAST_MALLOC_MATCH_VALIDATION)
+ if (std::numeric_limits<size_t>::max() - sizeof(AllocAlignmentInteger) <= size) // If overflow would occur...
+ return 0;
+ size += sizeof(AllocAlignmentInteger);
+ void* result = do_malloc(size);
+ if (!result)
+ return 0;
+
+ *static_cast<AllocAlignmentInteger*>(result) = Internal::AllocTypeMalloc;
+ result = static_cast<AllocAlignmentInteger*>(result) + 1;
+#else
+ void* result = do_malloc(size);
+#endif
+
+#ifndef WTF_CHANGES
+ MallocHook::InvokeNewHook(result, size);
+#endif
+ return result;
+}
+
+#ifndef WTF_CHANGES
+extern "C"
+#endif
+void free(void* ptr) {
+#ifndef WTF_CHANGES
+ MallocHook::InvokeDeleteHook(ptr);
+#endif
+
+#if ENABLE(FAST_MALLOC_MATCH_VALIDATION)
+ if (!ptr)
+ return;
+
+ AllocAlignmentInteger* header = Internal::fastMallocMatchValidationValue(ptr);
+ if (*header != Internal::AllocTypeMalloc)
+ Internal::fastMallocMatchFailed(ptr);
+ do_free(header);
+#else
+ do_free(ptr);
+#endif
+}
+
+#ifndef WTF_CHANGES
+extern "C"
+#else
+template <bool crashOnFailure>
+ALWAYS_INLINE void* calloc(size_t, size_t);
+
+void* fastCalloc(size_t n, size_t elem_size)
+{
+ return calloc<true>(n, elem_size);
+}
+
+TryMallocReturnValue tryFastCalloc(size_t n, size_t elem_size)
+{
+ return calloc<false>(n, elem_size);
+}
+
+template <bool crashOnFailure>
+ALWAYS_INLINE
+#endif
+void* calloc(size_t n, size_t elem_size) {
+ size_t totalBytes = n * elem_size;
+
+ // Protect against overflow
+ if (n > 1 && elem_size && (totalBytes / elem_size) != n)
+ return 0;
+
+#if ENABLE(FAST_MALLOC_MATCH_VALIDATION)
+ if (std::numeric_limits<size_t>::max() - sizeof(AllocAlignmentInteger) <= totalBytes) // If overflow would occur...
+ return 0;
+
+ totalBytes += sizeof(AllocAlignmentInteger);
+ void* result = do_malloc(totalBytes);
+ if (!result)
+ return 0;
+
+ memset(result, 0, totalBytes);
+ *static_cast<AllocAlignmentInteger*>(result) = Internal::AllocTypeMalloc;
+ result = static_cast<AllocAlignmentInteger*>(result) + 1;
+#else
+ void* result = do_malloc(totalBytes);
+ if (result != NULL) {
+ memset(result, 0, totalBytes);
+ }
+#endif
+
+#ifndef WTF_CHANGES
+ MallocHook::InvokeNewHook(result, totalBytes);
+#endif
+ return result;
+}
+
+// Since cfree isn't used anywhere, we don't compile it in.
+#ifndef WTF_CHANGES
+#ifndef WTF_CHANGES
+extern "C"
+#endif
+void cfree(void* ptr) {
+#ifndef WTF_CHANGES
+ MallocHook::InvokeDeleteHook(ptr);
+#endif
+ do_free(ptr);
+}
+#endif
+
+#ifndef WTF_CHANGES
+extern "C"
+#else
+template <bool crashOnFailure>
+ALWAYS_INLINE void* realloc(void*, size_t);
+
+void* fastRealloc(void* old_ptr, size_t new_size)
+{
+ return realloc<true>(old_ptr, new_size);
+}
+
+TryMallocReturnValue tryFastRealloc(void* old_ptr, size_t new_size)
+{
+ return realloc<false>(old_ptr, new_size);
+}
+
+template <bool crashOnFailure>
+ALWAYS_INLINE
+#endif
+void* realloc(void* old_ptr, size_t new_size) {
+ if (old_ptr == NULL) {
+#if ENABLE(FAST_MALLOC_MATCH_VALIDATION)
+ void* result = malloc(new_size);
+#else
+ void* result = do_malloc(new_size);
+#ifndef WTF_CHANGES
+ MallocHook::InvokeNewHook(result, new_size);
+#endif
+#endif
+ return result;
+ }
+ if (new_size == 0) {
+#ifndef WTF_CHANGES
+ MallocHook::InvokeDeleteHook(old_ptr);
+#endif
+ free(old_ptr);
+ return NULL;
+ }
+
+#if ENABLE(FAST_MALLOC_MATCH_VALIDATION)
+ if (std::numeric_limits<size_t>::max() - sizeof(AllocAlignmentInteger) <= new_size) // If overflow would occur...
+ return 0;
+ new_size += sizeof(AllocAlignmentInteger);
+ AllocAlignmentInteger* header = Internal::fastMallocMatchValidationValue(old_ptr);
+ if (*header != Internal::AllocTypeMalloc)
+ Internal::fastMallocMatchFailed(old_ptr);
+ old_ptr = header;
+#endif
+
+ // Get the size of the old entry
+ const PageID p = reinterpret_cast<uintptr_t>(old_ptr) >> kPageShift;
+ size_t cl = pageheap->GetSizeClassIfCached(p);
+ Span *span = NULL;
+ size_t old_size;
+ if (cl == 0) {
+ span = pageheap->GetDescriptor(p);
+ cl = span->sizeclass;
+ pageheap->CacheSizeClass(p, cl);
+ }
+ if (cl != 0) {
+ old_size = ByteSizeForClass(cl);
+ } else {
+ ASSERT(span != NULL);
+ old_size = span->length << kPageShift;
+ }
+
+ // Reallocate if the new size is larger than the old size,
+ // or if the new size is significantly smaller than the old size.
+ if ((new_size > old_size) || (AllocationSize(new_size) < old_size)) {
+ // Need to reallocate
+ void* new_ptr = do_malloc(new_size);
+ if (new_ptr == NULL) {
+ return NULL;
+ }
+#ifndef WTF_CHANGES
+ MallocHook::InvokeNewHook(new_ptr, new_size);
+#endif
+ memcpy(new_ptr, old_ptr, ((old_size < new_size) ? old_size : new_size));
+#ifndef WTF_CHANGES
+ MallocHook::InvokeDeleteHook(old_ptr);
+#endif
+ // We could use a variant of do_free() that leverages the fact
+ // that we already know the sizeclass of old_ptr. The benefit
+ // would be small, so don't bother.
+ do_free(old_ptr);
+#if ENABLE(FAST_MALLOC_MATCH_VALIDATION)
+ new_ptr = static_cast<AllocAlignmentInteger*>(new_ptr) + 1;
+#endif
+ return new_ptr;
+ } else {
+#if ENABLE(FAST_MALLOC_MATCH_VALIDATION)
+ old_ptr = static_cast<AllocAlignmentInteger*>(old_ptr) + 1; // Set old_ptr back to the user pointer.
+#endif
+ return old_ptr;
+ }
+}
+
+#ifdef WTF_CHANGES
+#undef do_malloc
+#else
+
+static SpinLock set_new_handler_lock = SPINLOCK_INITIALIZER;
+
+static inline void* cpp_alloc(size_t size, bool nothrow) {
+ for (;;) {
+ void* p = do_malloc(size);
+#ifdef PREANSINEW
+ return p;
+#else
+ if (p == NULL) { // allocation failed
+ // Get the current new handler. NB: this function is not
+ // thread-safe. We make a feeble stab at making it so here, but
+ // this lock only protects against tcmalloc interfering with
+ // itself, not with other libraries calling set_new_handler.
+ std::new_handler nh;
+ {
+ SpinLockHolder h(&set_new_handler_lock);
+ nh = std::set_new_handler(0);
+ (void) std::set_new_handler(nh);
+ }
+ // If no new_handler is established, the allocation failed.
+ if (!nh) {
+ if (nothrow) return 0;
+ throw std::bad_alloc();
+ }
+ // Otherwise, try the new_handler. If it returns, retry the
+ // allocation. If it throws std::bad_alloc, fail the allocation.
+ // if it throws something else, don't interfere.
+ try {
+ (*nh)();
+ } catch (const std::bad_alloc&) {
+ if (!nothrow) throw;
+ return p;
+ }
+ } else { // allocation success
+ return p;
+ }
+#endif
+ }
+}
+
+#if ENABLE(GLOBAL_FASTMALLOC_NEW)
+
+void* operator new(size_t size) {
+ void* p = cpp_alloc(size, false);
+ // We keep this next instruction out of cpp_alloc for a reason: when
+ // it's in, and new just calls cpp_alloc, the optimizer may fold the
+ // new call into cpp_alloc, which messes up our whole section-based
+ // stacktracing (see ATTRIBUTE_SECTION, above). This ensures cpp_alloc
+ // isn't the last thing this fn calls, and prevents the folding.
+ MallocHook::InvokeNewHook(p, size);
+ return p;
+}
+
+void* operator new(size_t size, const std::nothrow_t&) __THROW {
+ void* p = cpp_alloc(size, true);
+ MallocHook::InvokeNewHook(p, size);
+ return p;
+}
+
+void operator delete(void* p) __THROW {
+ MallocHook::InvokeDeleteHook(p);
+ do_free(p);
+}
+
+void operator delete(void* p, const std::nothrow_t&) __THROW {
+ MallocHook::InvokeDeleteHook(p);
+ do_free(p);
+}
+
+void* operator new[](size_t size) {
+ void* p = cpp_alloc(size, false);
+ // We keep this next instruction out of cpp_alloc for a reason: when
+ // it's in, and new just calls cpp_alloc, the optimizer may fold the
+ // new call into cpp_alloc, which messes up our whole section-based
+ // stacktracing (see ATTRIBUTE_SECTION, above). This ensures cpp_alloc
+ // isn't the last thing this fn calls, and prevents the folding.
+ MallocHook::InvokeNewHook(p, size);
+ return p;
+}
+
+void* operator new[](size_t size, const std::nothrow_t&) __THROW {
+ void* p = cpp_alloc(size, true);
+ MallocHook::InvokeNewHook(p, size);
+ return p;
+}
+
+void operator delete[](void* p) __THROW {
+ MallocHook::InvokeDeleteHook(p);
+ do_free(p);
+}
+
+void operator delete[](void* p, const std::nothrow_t&) __THROW {
+ MallocHook::InvokeDeleteHook(p);
+ do_free(p);
+}
+
+#endif
+
+extern "C" void* memalign(size_t align, size_t size) __THROW {
+ void* result = do_memalign(align, size);
+ MallocHook::InvokeNewHook(result, size);
+ return result;
+}
+
+extern "C" int posix_memalign(void** result_ptr, size_t align, size_t size)
+ __THROW {
+ if (((align % sizeof(void*)) != 0) ||
+ ((align & (align - 1)) != 0) ||
+ (align == 0)) {
+ return EINVAL;
+ }
+
+ void* result = do_memalign(align, size);
+ MallocHook::InvokeNewHook(result, size);
+ if (result == NULL) {
+ return ENOMEM;
+ } else {
+ *result_ptr = result;
+ return 0;
+ }
+}
+
+static size_t pagesize = 0;
+
+extern "C" void* valloc(size_t size) __THROW {
+ // Allocate page-aligned object of length >= size bytes
+ if (pagesize == 0) pagesize = getpagesize();
+ void* result = do_memalign(pagesize, size);
+ MallocHook::InvokeNewHook(result, size);
+ return result;
+}
+
+extern "C" void* pvalloc(size_t size) __THROW {
+ // Round up size to a multiple of pagesize
+ if (pagesize == 0) pagesize = getpagesize();
+ size = (size + pagesize - 1) & ~(pagesize - 1);
+ void* result = do_memalign(pagesize, size);
+ MallocHook::InvokeNewHook(result, size);
+ return result;
+}
+
+extern "C" void malloc_stats(void) {
+ do_malloc_stats();
+}
+
+extern "C" int mallopt(int cmd, int value) {
+ return do_mallopt(cmd, value);
+}
+
+#ifdef HAVE_STRUCT_MALLINFO
+extern "C" struct mallinfo mallinfo(void) {
+ return do_mallinfo();
+}
+#endif
+
+//-------------------------------------------------------------------
+// Some library routines on RedHat 9 allocate memory using malloc()
+// and free it using __libc_free() (or vice-versa). Since we provide
+// our own implementations of malloc/free, we need to make sure that
+// the __libc_XXX variants (defined as part of glibc) also point to
+// the same implementations.
+//-------------------------------------------------------------------
+
+#if defined(__GLIBC__)
+extern "C" {
+#if COMPILER(GCC) && !defined(__MACH__) && defined(HAVE___ATTRIBUTE__)
+ // Potentially faster variants that use the gcc alias extension.
+ // Mach-O (Darwin) does not support weak aliases, hence the __MACH__ check.
+# define ALIAS(x) __attribute__ ((weak, alias (x)))
+ void* __libc_malloc(size_t size) ALIAS("malloc");
+ void __libc_free(void* ptr) ALIAS("free");
+ void* __libc_realloc(void* ptr, size_t size) ALIAS("realloc");
+ void* __libc_calloc(size_t n, size_t size) ALIAS("calloc");
+ void __libc_cfree(void* ptr) ALIAS("cfree");
+ void* __libc_memalign(size_t align, size_t s) ALIAS("memalign");
+ void* __libc_valloc(size_t size) ALIAS("valloc");
+ void* __libc_pvalloc(size_t size) ALIAS("pvalloc");
+ int __posix_memalign(void** r, size_t a, size_t s) ALIAS("posix_memalign");
+# undef ALIAS
+# else /* not __GNUC__ */
+ // Portable wrappers
+ void* __libc_malloc(size_t size) { return malloc(size); }
+ void __libc_free(void* ptr) { free(ptr); }
+ void* __libc_realloc(void* ptr, size_t size) { return realloc(ptr, size); }
+ void* __libc_calloc(size_t n, size_t size) { return calloc(n, size); }
+ void __libc_cfree(void* ptr) { cfree(ptr); }
+ void* __libc_memalign(size_t align, size_t s) { return memalign(align, s); }
+ void* __libc_valloc(size_t size) { return valloc(size); }
+ void* __libc_pvalloc(size_t size) { return pvalloc(size); }
+ int __posix_memalign(void** r, size_t a, size_t s) {
+ return posix_memalign(r, a, s);
+ }
+# endif /* __GNUC__ */
+}
+#endif /* __GLIBC__ */
+
+// Override __libc_memalign in libc on linux boxes specially.
+// They have a bug in libc that causes them to (very rarely) allocate
+// with __libc_memalign() yet deallocate with free() and the
+// definitions above don't catch it.
+// This function is an exception to the rule of calling MallocHook method
+// from the stack frame of the allocation function;
+// heap-checker handles this special case explicitly.
+static void *MemalignOverride(size_t align, size_t size, const void *caller)
+ __THROW {
+ void* result = do_memalign(align, size);
+ MallocHook::InvokeNewHook(result, size);
+ return result;
+}
+void *(*__memalign_hook)(size_t, size_t, const void *) = MemalignOverride;
+
+#endif
+
+#ifdef WTF_CHANGES
+void releaseFastMallocFreeMemory()
+{
+ // Flush free pages in the current thread cache back to the page heap.
+ // Low watermark mechanism in Scavenge() prevents full return on the first pass.
+ // The second pass flushes everything.
+ if (TCMalloc_ThreadCache* threadCache = TCMalloc_ThreadCache::GetCacheIfPresent()) {
+ threadCache->Scavenge();
+ threadCache->Scavenge();
+ }
+
+ SpinLockHolder h(&pageheap_lock);
+ pageheap->ReleaseFreePages();
+}
+
+FastMallocStatistics fastMallocStatistics()
+{
+ FastMallocStatistics statistics;
+
+ SpinLockHolder lockHolder(&pageheap_lock);
+ statistics.reservedVMBytes = static_cast<size_t>(pageheap->SystemBytes());
+ statistics.committedVMBytes = statistics.reservedVMBytes - pageheap->ReturnedBytes();
+
+ statistics.freeListBytes = 0;
+ for (unsigned cl = 0; cl < kNumClasses; ++cl) {
+ const int length = central_cache[cl].length();
+ const int tc_length = central_cache[cl].tc_length();
+
+ statistics.freeListBytes += ByteSizeForClass(cl) * (length + tc_length);
+ }
+ for (TCMalloc_ThreadCache* threadCache = thread_heaps; threadCache ; threadCache = threadCache->next_)
+ statistics.freeListBytes += threadCache->Size();
+
+ return statistics;
+}
+
+size_t fastMallocSize(const void* ptr)
+{
+ const PageID p = reinterpret_cast<uintptr_t>(ptr) >> kPageShift;
+ Span* span = pageheap->GetDescriptorEnsureSafe(p);
+
+ if (!span || span->free)
+ return 0;
+
+ for (void* free = span->objects; free != NULL; free = *((void**) free)) {
+ if (ptr == free)
+ return 0;
+ }
+
+ if (size_t cl = span->sizeclass)
+ return ByteSizeForClass(cl);
+
+ return span->length << kPageShift;
+}
+
+#if OS(DARWIN)
+
+class FreeObjectFinder {
+ const RemoteMemoryReader& m_reader;
+ HashSet<void*> m_freeObjects;
+
+public:
+ FreeObjectFinder(const RemoteMemoryReader& reader) : m_reader(reader) { }
+
+ void visit(void* ptr) { m_freeObjects.add(ptr); }
+ bool isFreeObject(void* ptr) const { return m_freeObjects.contains(ptr); }
+ bool isFreeObject(vm_address_t ptr) const { return isFreeObject(reinterpret_cast<void*>(ptr)); }
+ size_t freeObjectCount() const { return m_freeObjects.size(); }
+
+ void findFreeObjects(TCMalloc_ThreadCache* threadCache)
+ {
+ for (; threadCache; threadCache = (threadCache->next_ ? m_reader(threadCache->next_) : 0))
+ threadCache->enumerateFreeObjects(*this, m_reader);
+ }
+
+ void findFreeObjects(TCMalloc_Central_FreeListPadded* centralFreeList, size_t numSizes, TCMalloc_Central_FreeListPadded* remoteCentralFreeList)
+ {
+ for (unsigned i = 0; i < numSizes; i++)
+ centralFreeList[i].enumerateFreeObjects(*this, m_reader, remoteCentralFreeList + i);
+ }
+};
+
+class PageMapFreeObjectFinder {
+ const RemoteMemoryReader& m_reader;
+ FreeObjectFinder& m_freeObjectFinder;
+
+public:
+ PageMapFreeObjectFinder(const RemoteMemoryReader& reader, FreeObjectFinder& freeObjectFinder)
+ : m_reader(reader)
+ , m_freeObjectFinder(freeObjectFinder)
+ { }
+
+ int visit(void* ptr) const
+ {
+ if (!ptr)
+ return 1;
+
+ Span* span = m_reader(reinterpret_cast<Span*>(ptr));
+ if (span->free) {
+ void* ptr = reinterpret_cast<void*>(span->start << kPageShift);
+ m_freeObjectFinder.visit(ptr);
+ } else if (span->sizeclass) {
+ // Walk the free list of the small-object span, keeping track of each object seen
+ for (void* nextObject = span->objects; nextObject; nextObject = *m_reader(reinterpret_cast<void**>(nextObject)))
+ m_freeObjectFinder.visit(nextObject);
+ }
+ return span->length;
+ }
+};
+
+class PageMapMemoryUsageRecorder {
+ task_t m_task;
+ void* m_context;
+ unsigned m_typeMask;
+ vm_range_recorder_t* m_recorder;
+ const RemoteMemoryReader& m_reader;
+ const FreeObjectFinder& m_freeObjectFinder;
+
+ HashSet<void*> m_seenPointers;
+ Vector<Span*> m_coalescedSpans;
+
+public:
+ PageMapMemoryUsageRecorder(task_t task, void* context, unsigned typeMask, vm_range_recorder_t* recorder, const RemoteMemoryReader& reader, const FreeObjectFinder& freeObjectFinder)
+ : m_task(task)
+ , m_context(context)
+ , m_typeMask(typeMask)
+ , m_recorder(recorder)
+ , m_reader(reader)
+ , m_freeObjectFinder(freeObjectFinder)
+ { }
+
+ ~PageMapMemoryUsageRecorder()
+ {
+ ASSERT(!m_coalescedSpans.size());
+ }
+
+ void recordPendingRegions()
+ {
+ Span* lastSpan = m_coalescedSpans[m_coalescedSpans.size() - 1];
+ vm_range_t ptrRange = { m_coalescedSpans[0]->start << kPageShift, 0 };
+ ptrRange.size = (lastSpan->start << kPageShift) - ptrRange.address + (lastSpan->length * kPageSize);
+
+ // Mark the memory region the spans represent as a candidate for containing pointers
+ if (m_typeMask & MALLOC_PTR_REGION_RANGE_TYPE)
+ (*m_recorder)(m_task, m_context, MALLOC_PTR_REGION_RANGE_TYPE, &ptrRange, 1);
+
+ if (!(m_typeMask & MALLOC_PTR_IN_USE_RANGE_TYPE)) {
+ m_coalescedSpans.clear();
+ return;
+ }
+
+ Vector<vm_range_t, 1024> allocatedPointers;
+ for (size_t i = 0; i < m_coalescedSpans.size(); ++i) {
+ Span *theSpan = m_coalescedSpans[i];
+ if (theSpan->free)
+ continue;
+
+ vm_address_t spanStartAddress = theSpan->start << kPageShift;
+ vm_size_t spanSizeInBytes = theSpan->length * kPageSize;
+
+ if (!theSpan->sizeclass) {
+ // If it's an allocated large object span, mark it as in use
+ if (!m_freeObjectFinder.isFreeObject(spanStartAddress))
+ allocatedPointers.append((vm_range_t){spanStartAddress, spanSizeInBytes});
+ } else {
+ const size_t objectSize = ByteSizeForClass(theSpan->sizeclass);
+
+ // Mark each allocated small object within the span as in use
+ const vm_address_t endOfSpan = spanStartAddress + spanSizeInBytes;
+ for (vm_address_t object = spanStartAddress; object + objectSize <= endOfSpan; object += objectSize) {
+ if (!m_freeObjectFinder.isFreeObject(object))
+ allocatedPointers.append((vm_range_t){object, objectSize});
+ }
+ }
+ }
+
+ (*m_recorder)(m_task, m_context, MALLOC_PTR_IN_USE_RANGE_TYPE, allocatedPointers.data(), allocatedPointers.size());
+
+ m_coalescedSpans.clear();
+ }
+
+ int visit(void* ptr)
+ {
+ if (!ptr)
+ return 1;
+
+ Span* span = m_reader(reinterpret_cast<Span*>(ptr));
+ if (!span->start)
+ return 1;
+
+ if (m_seenPointers.contains(ptr))
+ return span->length;
+ m_seenPointers.add(ptr);
+
+ if (!m_coalescedSpans.size()) {
+ m_coalescedSpans.append(span);
+ return span->length;
+ }
+
+ Span* previousSpan = m_coalescedSpans[m_coalescedSpans.size() - 1];
+ vm_address_t previousSpanStartAddress = previousSpan->start << kPageShift;
+ vm_size_t previousSpanSizeInBytes = previousSpan->length * kPageSize;
+
+ // If the new span is adjacent to the previous span, do nothing for now.
+ vm_address_t spanStartAddress = span->start << kPageShift;
+ if (spanStartAddress == previousSpanStartAddress + previousSpanSizeInBytes) {
+ m_coalescedSpans.append(span);
+ return span->length;
+ }
+
+ // New span is not adjacent to previous span, so record the spans coalesced so far.
+ recordPendingRegions();
+ m_coalescedSpans.append(span);
+
+ return span->length;
+ }
+};
+
+class AdminRegionRecorder {
+ task_t m_task;
+ void* m_context;
+ unsigned m_typeMask;
+ vm_range_recorder_t* m_recorder;
+ const RemoteMemoryReader& m_reader;
+
+ Vector<vm_range_t, 1024> m_pendingRegions;
+
+public:
+ AdminRegionRecorder(task_t task, void* context, unsigned typeMask, vm_range_recorder_t* recorder, const RemoteMemoryReader& reader)
+ : m_task(task)
+ , m_context(context)
+ , m_typeMask(typeMask)
+ , m_recorder(recorder)
+ , m_reader(reader)
+ { }
+
+ void recordRegion(vm_address_t ptr, size_t size)
+ {
+ if (m_typeMask & MALLOC_ADMIN_REGION_RANGE_TYPE)
+ m_pendingRegions.append((vm_range_t){ ptr, size });
+ }
+
+ void visit(void *ptr, size_t size)
+ {
+ recordRegion(reinterpret_cast<vm_address_t>(ptr), size);
+ }
+
+ void recordPendingRegions()
+ {
+ if (m_pendingRegions.size()) {
+ (*m_recorder)(m_task, m_context, MALLOC_ADMIN_REGION_RANGE_TYPE, m_pendingRegions.data(), m_pendingRegions.size());
+ m_pendingRegions.clear();
+ }
+ }
+
+ ~AdminRegionRecorder()
+ {
+ ASSERT(!m_pendingRegions.size());
+ }
+};
+
+kern_return_t FastMallocZone::enumerate(task_t task, void* context, unsigned typeMask, vm_address_t zoneAddress, memory_reader_t reader, vm_range_recorder_t recorder)
+{
+ RemoteMemoryReader memoryReader(task, reader);
+
+ InitSizeClasses();
+
+ FastMallocZone* mzone = memoryReader(reinterpret_cast<FastMallocZone*>(zoneAddress));
+ TCMalloc_PageHeap* pageHeap = memoryReader(mzone->m_pageHeap);
+ TCMalloc_ThreadCache** threadHeapsPointer = memoryReader(mzone->m_threadHeaps);
+ TCMalloc_ThreadCache* threadHeaps = memoryReader(*threadHeapsPointer);
+
+ TCMalloc_Central_FreeListPadded* centralCaches = memoryReader(mzone->m_centralCaches, sizeof(TCMalloc_Central_FreeListPadded) * kNumClasses);
+
+ FreeObjectFinder finder(memoryReader);
+ finder.findFreeObjects(threadHeaps);
+ finder.findFreeObjects(centralCaches, kNumClasses, mzone->m_centralCaches);
+
+ TCMalloc_PageHeap::PageMap* pageMap = &pageHeap->pagemap_;
+ PageMapFreeObjectFinder pageMapFinder(memoryReader, finder);
+ pageMap->visitValues(pageMapFinder, memoryReader);
+
+ PageMapMemoryUsageRecorder usageRecorder(task, context, typeMask, recorder, memoryReader, finder);
+ pageMap->visitValues(usageRecorder, memoryReader);
+ usageRecorder.recordPendingRegions();
+
+ AdminRegionRecorder adminRegionRecorder(task, context, typeMask, recorder, memoryReader);
+ pageMap->visitAllocations(adminRegionRecorder, memoryReader);
+
+ PageHeapAllocator<Span>* spanAllocator = memoryReader(mzone->m_spanAllocator);
+ PageHeapAllocator<TCMalloc_ThreadCache>* pageHeapAllocator = memoryReader(mzone->m_pageHeapAllocator);
+
+ spanAllocator->recordAdministrativeRegions(adminRegionRecorder, memoryReader);
+ pageHeapAllocator->recordAdministrativeRegions(adminRegionRecorder, memoryReader);
+
+ adminRegionRecorder.recordPendingRegions();
+
+ return 0;
+}
+
+size_t FastMallocZone::size(malloc_zone_t*, const void*)
+{
+ return 0;
+}
+
+void* FastMallocZone::zoneMalloc(malloc_zone_t*, size_t)
+{
+ return 0;
+}
+
+void* FastMallocZone::zoneCalloc(malloc_zone_t*, size_t, size_t)
+{
+ return 0;
+}
+
+void FastMallocZone::zoneFree(malloc_zone_t*, void* ptr)
+{
+ // Due to <rdar://problem/5671357> zoneFree may be called by the system free even if the pointer
+ // is not in this zone. When this happens, the pointer being freed was not allocated by any
+ // zone so we need to print a useful error for the application developer.
+ malloc_printf("*** error for object %p: pointer being freed was not allocated\n", ptr);
+}
+
+void* FastMallocZone::zoneRealloc(malloc_zone_t*, void*, size_t)
+{
+ return 0;
+}
+
+
+#undef malloc
+#undef free
+#undef realloc
+#undef calloc
+
+extern "C" {
+malloc_introspection_t jscore_fastmalloc_introspection = { &FastMallocZone::enumerate, &FastMallocZone::goodSize, &FastMallocZone::check, &FastMallocZone::print,
+ &FastMallocZone::log, &FastMallocZone::forceLock, &FastMallocZone::forceUnlock, &FastMallocZone::statistics
+
+#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
+ , 0 // zone_locked will not be called on the zone unless it advertises itself as version five or higher.
+#endif
+#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+ , 0, 0, 0, 0 // These members will not be used unless the zone advertises itself as version seven or higher.
+#endif
+
+ };
+}
+
+FastMallocZone::FastMallocZone(TCMalloc_PageHeap* pageHeap, TCMalloc_ThreadCache** threadHeaps, TCMalloc_Central_FreeListPadded* centralCaches, PageHeapAllocator<Span>* spanAllocator, PageHeapAllocator<TCMalloc_ThreadCache>* pageHeapAllocator)
+ : m_pageHeap(pageHeap)
+ , m_threadHeaps(threadHeaps)
+ , m_centralCaches(centralCaches)
+ , m_spanAllocator(spanAllocator)
+ , m_pageHeapAllocator(pageHeapAllocator)
+{
+ memset(&m_zone, 0, sizeof(m_zone));
+ m_zone.version = 4;
+ m_zone.zone_name = "JavaScriptCore FastMalloc";
+ m_zone.size = &FastMallocZone::size;
+ m_zone.malloc = &FastMallocZone::zoneMalloc;
+ m_zone.calloc = &FastMallocZone::zoneCalloc;
+ m_zone.realloc = &FastMallocZone::zoneRealloc;
+ m_zone.free = &FastMallocZone::zoneFree;
+ m_zone.valloc = &FastMallocZone::zoneValloc;
+ m_zone.destroy = &FastMallocZone::zoneDestroy;
+ m_zone.introspect = &jscore_fastmalloc_introspection;
+ malloc_zone_register(&m_zone);
+}
+
+
+void FastMallocZone::init()
+{
+ static FastMallocZone zone(pageheap, &thread_heaps, static_cast<TCMalloc_Central_FreeListPadded*>(central_cache), &span_allocator, &threadheap_allocator);
+}
+
+#endif // OS(DARWIN)
+
+} // namespace WTF
+#endif // WTF_CHANGES
+
+#endif // FORCE_SYSTEM_MALLOC
diff --git a/Source/JavaScriptCore/wtf/FastMalloc.h b/Source/JavaScriptCore/wtf/FastMalloc.h
new file mode 100644
index 0000000..9729bc3
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/FastMalloc.h
@@ -0,0 +1,241 @@
+/*
+ * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef WTF_FastMalloc_h
+#define WTF_FastMalloc_h
+
+#include "Platform.h"
+#include "PossiblyNull.h"
+#include <stdlib.h>
+#include <new>
+
+namespace WTF {
+
+ // These functions call CRASH() if an allocation fails.
+ void* fastMalloc(size_t);
+ void* fastZeroedMalloc(size_t);
+ void* fastCalloc(size_t numElements, size_t elementSize);
+ void* fastRealloc(void*, size_t);
+ char* fastStrDup(const char*);
+ size_t fastMallocSize(const void*);
+
+ struct TryMallocReturnValue {
+ TryMallocReturnValue(void* data)
+ : m_data(data)
+ {
+ }
+ TryMallocReturnValue(const TryMallocReturnValue& source)
+ : m_data(source.m_data)
+ {
+ source.m_data = 0;
+ }
+ ~TryMallocReturnValue() { ASSERT(!m_data); }
+ template <typename T> bool getValue(T& data) WARN_UNUSED_RETURN;
+ template <typename T> operator PossiblyNull<T>()
+ {
+ T value;
+ getValue(value);
+ return PossiblyNull<T>(value);
+ }
+ private:
+ mutable void* m_data;
+ };
+
+ template <typename T> bool TryMallocReturnValue::getValue(T& data)
+ {
+ union u { void* data; T target; } res;
+ res.data = m_data;
+ data = res.target;
+ bool returnValue = !!m_data;
+ m_data = 0;
+ return returnValue;
+ }
+
+ TryMallocReturnValue tryFastMalloc(size_t n);
+ TryMallocReturnValue tryFastZeroedMalloc(size_t n);
+ TryMallocReturnValue tryFastCalloc(size_t n_elements, size_t element_size);
+ TryMallocReturnValue tryFastRealloc(void* p, size_t n);
+
+ void fastFree(void*);
+
+#ifndef NDEBUG
+ void fastMallocForbid();
+ void fastMallocAllow();
+#endif
+
+ void releaseFastMallocFreeMemory();
+
+ struct FastMallocStatistics {
+ size_t reservedVMBytes;
+ size_t committedVMBytes;
+ size_t freeListBytes;
+ };
+ FastMallocStatistics fastMallocStatistics();
+
+ // This defines a type which holds an unsigned integer and is the same
+ // size as the minimally aligned memory allocation.
+ typedef unsigned long long AllocAlignmentInteger;
+
+ namespace Internal {
+ enum AllocType { // Start with an unusual number instead of zero, because zero is common.
+ AllocTypeMalloc = 0x375d6750, // Encompasses fastMalloc, fastZeroedMalloc, fastCalloc, fastRealloc.
+ AllocTypeClassNew, // Encompasses class operator new from FastAllocBase.
+ AllocTypeClassNewArray, // Encompasses class operator new[] from FastAllocBase.
+ AllocTypeFastNew, // Encompasses fastNew.
+ AllocTypeFastNewArray, // Encompasses fastNewArray.
+ AllocTypeNew, // Encompasses global operator new.
+ AllocTypeNewArray // Encompasses global operator new[].
+ };
+ }
+
+#if ENABLE(FAST_MALLOC_MATCH_VALIDATION)
+
+ // Malloc validation is a scheme whereby a tag is attached to an
+ // allocation which identifies how it was originally allocated.
+ // This allows us to verify that the freeing operation matches the
+ // allocation operation. If memory is allocated with operator new[]
+ // but freed with free or delete, this system would detect that.
+ // In the implementation here, the tag is an integer prepended to
+ // the allocation memory which is assigned one of the AllocType
+ // enumeration values. An alternative implementation of this
+ // scheme could store the tag somewhere else or ignore it.
+ // Users of FastMalloc don't need to know or care how this tagging
+ // is implemented.
+
+ namespace Internal {
+
+ // Return the AllocType tag associated with the allocated block p.
+ inline AllocType fastMallocMatchValidationType(const void* p)
+ {
+ const AllocAlignmentInteger* type = static_cast<const AllocAlignmentInteger*>(p) - 1;
+ return static_cast<AllocType>(*type);
+ }
+
+ // Return the address of the AllocType tag associated with the allocated block p.
+ inline AllocAlignmentInteger* fastMallocMatchValidationValue(void* p)
+ {
+ return reinterpret_cast<AllocAlignmentInteger*>(static_cast<char*>(p) - sizeof(AllocAlignmentInteger));
+ }
+
+ // Set the AllocType tag to be associaged with the allocated block p.
+ inline void setFastMallocMatchValidationType(void* p, AllocType allocType)
+ {
+ AllocAlignmentInteger* type = static_cast<AllocAlignmentInteger*>(p) - 1;
+ *type = static_cast<AllocAlignmentInteger>(allocType);
+ }
+
+ // Handle a detected alloc/free mismatch. By default this calls CRASH().
+ void fastMallocMatchFailed(void* p);
+
+ } // namespace Internal
+
+ // This is a higher level function which is used by FastMalloc-using code.
+ inline void fastMallocMatchValidateMalloc(void* p, Internal::AllocType allocType)
+ {
+ if (!p)
+ return;
+
+ Internal::setFastMallocMatchValidationType(p, allocType);
+ }
+
+ // This is a higher level function which is used by FastMalloc-using code.
+ inline void fastMallocMatchValidateFree(void* p, Internal::AllocType allocType)
+ {
+ if (!p)
+ return;
+
+ if (Internal::fastMallocMatchValidationType(p) != allocType)
+ Internal::fastMallocMatchFailed(p);
+ Internal::setFastMallocMatchValidationType(p, Internal::AllocTypeMalloc); // Set it to this so that fastFree thinks it's OK.
+ }
+
+#else
+
+ inline void fastMallocMatchValidateMalloc(void*, Internal::AllocType)
+ {
+ }
+
+ inline void fastMallocMatchValidateFree(void*, Internal::AllocType)
+ {
+ }
+
+#endif
+
+} // namespace WTF
+
+using WTF::fastCalloc;
+using WTF::fastFree;
+using WTF::fastMalloc;
+using WTF::fastMallocSize;
+using WTF::fastRealloc;
+using WTF::fastStrDup;
+using WTF::fastZeroedMalloc;
+using WTF::tryFastCalloc;
+using WTF::tryFastMalloc;
+using WTF::tryFastRealloc;
+using WTF::tryFastZeroedMalloc;
+
+#ifndef NDEBUG
+using WTF::fastMallocForbid;
+using WTF::fastMallocAllow;
+#endif
+
+#if COMPILER(GCC) && OS(DARWIN)
+#define WTF_PRIVATE_INLINE __private_extern__ inline __attribute__((always_inline))
+#elif COMPILER(GCC)
+#define WTF_PRIVATE_INLINE inline __attribute__((always_inline))
+#elif COMPILER(MSVC) || COMPILER(RVCT)
+#define WTF_PRIVATE_INLINE __forceinline
+#else
+#define WTF_PRIVATE_INLINE inline
+#endif
+
+#if !defined(_CRTDBG_MAP_ALLOC) && !(defined(USE_SYSTEM_MALLOC) && USE_SYSTEM_MALLOC && !PLATFORM(BREWMP))
+
+// The nothrow functions here are actually not all that helpful, because fastMalloc will
+// call CRASH() rather than returning 0, and returning 0 is what nothrow is all about.
+// But since WebKit code never uses exceptions or nothrow at all, this is probably OK.
+// Long term we will adopt FastAllocBase.h everywhere, and and replace this with
+// debug-only code to make sure we don't use the system malloc via the default operator
+// new by accident.
+
+#if ENABLE(GLOBAL_FASTMALLOC_NEW)
+
+#if COMPILER(MSVC)
+#pragma warning(push)
+#pragma warning(disable: 4290) // Disable the C++ exception specification ignored warning.
+#endif
+WTF_PRIVATE_INLINE void* operator new(size_t size) throw (std::bad_alloc) { return fastMalloc(size); }
+WTF_PRIVATE_INLINE void* operator new(size_t size, const std::nothrow_t&) throw() { return fastMalloc(size); }
+WTF_PRIVATE_INLINE void operator delete(void* p) throw() { fastFree(p); }
+WTF_PRIVATE_INLINE void operator delete(void* p, const std::nothrow_t&) throw() { fastFree(p); }
+WTF_PRIVATE_INLINE void* operator new[](size_t size) throw (std::bad_alloc) { return fastMalloc(size); }
+WTF_PRIVATE_INLINE void* operator new[](size_t size, const std::nothrow_t&) throw() { return fastMalloc(size); }
+WTF_PRIVATE_INLINE void operator delete[](void* p) throw() { fastFree(p); }
+WTF_PRIVATE_INLINE void operator delete[](void* p, const std::nothrow_t&) throw() { fastFree(p); }
+#if COMPILER(MSVC)
+#pragma warning(pop)
+#endif
+
+#endif
+
+#endif
+
+#endif /* WTF_FastMalloc_h */
diff --git a/Source/JavaScriptCore/wtf/FixedArray.h b/Source/JavaScriptCore/wtf/FixedArray.h
new file mode 100644
index 0000000..c67d18c
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/FixedArray.h
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef FixedArray_h
+#define FixedArray_h
+
+#include <wtf/Assertions.h>
+
+namespace WTF {
+
+template <typename T, size_t Size> class FixedArray {
+public:
+ T& operator[](size_t i)
+ {
+ ASSERT(i < Size);
+ return m_data[i];
+ }
+
+ const T& operator[](size_t i) const
+ {
+ ASSERT(i < Size);
+ return m_data[i];
+ }
+
+ T* data() { return m_data; }
+ size_t size() const { return Size; }
+
+private:
+ T m_data[Size];
+};
+
+} // namespace WTF
+
+using WTF::FixedArray;
+
+#endif // FixedArray_h
diff --git a/Source/JavaScriptCore/wtf/Forward.h b/Source/JavaScriptCore/wtf/Forward.h
new file mode 100644
index 0000000..28be168
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/Forward.h
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2006, 2009, 2011 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef WTF_Forward_h
+#define WTF_Forward_h
+
+#include <stddef.h>
+
+namespace WTF {
+ template<typename T> class ListRefPtr;
+ template<typename T> class OwnArrayPtr;
+ template<typename T> class OwnPtr;
+ template<typename T> class PassOwnArrayPtr;
+ template<typename T> class PassOwnPtr;
+ template<typename T> class PassRefPtr;
+ template<typename T> class RefPtr;
+ template<typename T, size_t inlineCapacity> class Vector;
+
+ class AtomicString;
+ class AtomicStringImpl;
+ class CString;
+ class Decoder;
+ class Encoder;
+ class String;
+ class StringBuffer;
+ class StringImpl;
+}
+
+using WTF::ListRefPtr;
+using WTF::OwnArrayPtr;
+using WTF::OwnPtr;
+using WTF::PassOwnArrayPtr;
+using WTF::PassOwnPtr;
+using WTF::PassRefPtr;
+using WTF::RefPtr;
+using WTF::Vector;
+
+using WTF::AtomicString;
+using WTF::AtomicStringImpl;
+using WTF::CString;
+using WTF::Encoder;
+using WTF::Decoder;
+using WTF::String;
+using WTF::StringBuffer;
+using WTF::StringImpl;
+
+#endif // WTF_Forward_h
diff --git a/Source/JavaScriptCore/wtf/GetPtr.h b/Source/JavaScriptCore/wtf/GetPtr.h
new file mode 100644
index 0000000..25a0e6d
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/GetPtr.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef WTF_GetPtr_h
+#define WTF_GetPtr_h
+
+namespace WTF {
+
+ template <typename T> inline T* getPtr(T* p)
+ {
+ return p;
+ }
+
+} // namespace WTF
+
+#endif // WTF_GetPtr_h
diff --git a/Source/JavaScriptCore/wtf/HashCountedSet.h b/Source/JavaScriptCore/wtf/HashCountedSet.h
new file mode 100644
index 0000000..4ed75c5
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/HashCountedSet.h
@@ -0,0 +1,228 @@
+/*
+ * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef WTF_HashCountedSet_h
+#define WTF_HashCountedSet_h
+
+#include "Assertions.h"
+#include "FastAllocBase.h"
+#include "HashMap.h"
+#include "Vector.h"
+
+namespace WTF {
+
+ template<typename Value, typename HashFunctions = typename DefaultHash<Value>::Hash,
+ typename Traits = HashTraits<Value> > class HashCountedSet : public FastAllocBase {
+ private:
+ typedef HashMap<Value, unsigned, HashFunctions, Traits> ImplType;
+ public:
+ typedef Value ValueType;
+ typedef typename ImplType::iterator iterator;
+ typedef typename ImplType::const_iterator const_iterator;
+
+ HashCountedSet() {}
+
+ int size() const;
+ int capacity() const;
+ bool isEmpty() const;
+
+ // Iterators iterate over pairs of values and counts.
+ iterator begin();
+ iterator end();
+ const_iterator begin() const;
+ const_iterator end() const;
+
+ iterator find(const ValueType&);
+ const_iterator find(const ValueType&) const;
+ bool contains(const ValueType&) const;
+ unsigned count(const ValueType&) const;
+
+ // Increases the count if an equal value is already present
+ // the return value is a pair of an interator to the new value's
+ // location, and a bool that is true if an new entry was added.
+ std::pair<iterator, bool> add(const ValueType&);
+
+ // Reduces the count of the value, and removes it if count
+ // goes down to zero, returns true if the value is removed.
+ bool remove(const ValueType&);
+ bool remove(iterator);
+
+ // Removes the value, regardless of its count.
+ void removeAll(iterator);
+ void removeAll(const ValueType&);
+
+ // Clears the whole set.
+ void clear();
+
+ private:
+ ImplType m_impl;
+ };
+
+ template<typename Value, typename HashFunctions, typename Traits>
+ inline int HashCountedSet<Value, HashFunctions, Traits>::size() const
+ {
+ return m_impl.size();
+ }
+
+ template<typename Value, typename HashFunctions, typename Traits>
+ inline int HashCountedSet<Value, HashFunctions, Traits>::capacity() const
+ {
+ return m_impl.capacity();
+ }
+
+ template<typename Value, typename HashFunctions, typename Traits>
+ inline bool HashCountedSet<Value, HashFunctions, Traits>::isEmpty() const
+ {
+ return size() == 0;
+ }
+
+ template<typename Value, typename HashFunctions, typename Traits>
+ inline typename HashCountedSet<Value, HashFunctions, Traits>::iterator HashCountedSet<Value, HashFunctions, Traits>::begin()
+ {
+ return m_impl.begin();
+ }
+
+ template<typename Value, typename HashFunctions, typename Traits>
+ inline typename HashCountedSet<Value, HashFunctions, Traits>::iterator HashCountedSet<Value, HashFunctions, Traits>::end()
+ {
+ return m_impl.end();
+ }
+
+ template<typename Value, typename HashFunctions, typename Traits>
+ inline typename HashCountedSet<Value, HashFunctions, Traits>::const_iterator HashCountedSet<Value, HashFunctions, Traits>::begin() const
+ {
+ return m_impl.begin();
+ }
+
+ template<typename Value, typename HashFunctions, typename Traits>
+ inline typename HashCountedSet<Value, HashFunctions, Traits>::const_iterator HashCountedSet<Value, HashFunctions, Traits>::end() const
+ {
+ return m_impl.end();
+ }
+
+ template<typename Value, typename HashFunctions, typename Traits>
+ inline typename HashCountedSet<Value, HashFunctions, Traits>::iterator HashCountedSet<Value, HashFunctions, Traits>::find(const ValueType& value)
+ {
+ return m_impl.find(value);
+ }
+
+ template<typename Value, typename HashFunctions, typename Traits>
+ inline typename HashCountedSet<Value, HashFunctions, Traits>::const_iterator HashCountedSet<Value, HashFunctions, Traits>::find(const ValueType& value) const
+ {
+ return m_impl.find(value);
+ }
+
+ template<typename Value, typename HashFunctions, typename Traits>
+ inline bool HashCountedSet<Value, HashFunctions, Traits>::contains(const ValueType& value) const
+ {
+ return m_impl.contains(value);
+ }
+
+ template<typename Value, typename HashFunctions, typename Traits>
+ inline unsigned HashCountedSet<Value, HashFunctions, Traits>::count(const ValueType& value) const
+ {
+ return m_impl.get(value);
+ }
+
+ template<typename Value, typename HashFunctions, typename Traits>
+ inline std::pair<typename HashCountedSet<Value, HashFunctions, Traits>::iterator, bool> HashCountedSet<Value, HashFunctions, Traits>::add(const ValueType &value)
+ {
+ pair<iterator, bool> result = m_impl.add(value, 0);
+ ++result.first->second;
+ return result;
+ }
+
+ template<typename Value, typename HashFunctions, typename Traits>
+ inline bool HashCountedSet<Value, HashFunctions, Traits>::remove(const ValueType& value)
+ {
+ return remove(find(value));
+ }
+
+ template<typename Value, typename HashFunctions, typename Traits>
+ inline bool HashCountedSet<Value, HashFunctions, Traits>::remove(iterator it)
+ {
+ if (it == end())
+ return false;
+
+ unsigned oldVal = it->second;
+ ASSERT(oldVal);
+ unsigned newVal = oldVal - 1;
+ if (newVal) {
+ it->second = newVal;
+ return false;
+ }
+
+ m_impl.remove(it);
+ return true;
+ }
+
+ template<typename Value, typename HashFunctions, typename Traits>
+ inline void HashCountedSet<Value, HashFunctions, Traits>::removeAll(const ValueType& value)
+ {
+ removeAll(find(value));
+ }
+
+ template<typename Value, typename HashFunctions, typename Traits>
+ inline void HashCountedSet<Value, HashFunctions, Traits>::removeAll(iterator it)
+ {
+ if (it == end())
+ return;
+
+ m_impl.remove(it);
+ }
+
+ template<typename Value, typename HashFunctions, typename Traits>
+ inline void HashCountedSet<Value, HashFunctions, Traits>::clear()
+ {
+ m_impl.clear();
+ }
+
+ template<typename Value, typename HashFunctions, typename Traits, typename VectorType>
+ inline void copyToVector(const HashCountedSet<Value, HashFunctions, Traits>& collection, VectorType& vector)
+ {
+ typedef typename HashCountedSet<Value, HashFunctions, Traits>::const_iterator iterator;
+
+ vector.resize(collection.size());
+
+ iterator it = collection.begin();
+ iterator end = collection.end();
+ for (unsigned i = 0; it != end; ++it, ++i)
+ vector[i] = *it;
+ }
+
+ template<typename Value, typename HashFunctions, typename Traits>
+ inline void copyToVector(const HashCountedSet<Value, HashFunctions, Traits>& collection, Vector<Value>& vector)
+ {
+ typedef typename HashCountedSet<Value, HashFunctions, Traits>::const_iterator iterator;
+
+ vector.resize(collection.size());
+
+ iterator it = collection.begin();
+ iterator end = collection.end();
+ for (unsigned i = 0; it != end; ++it, ++i)
+ vector[i] = (*it).first;
+ }
+
+
+} // namespace khtml
+
+using WTF::HashCountedSet;
+
+#endif /* WTF_HashCountedSet_h */
diff --git a/Source/JavaScriptCore/wtf/HashFunctions.h b/Source/JavaScriptCore/wtf/HashFunctions.h
new file mode 100644
index 0000000..2c66a2d
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/HashFunctions.h
@@ -0,0 +1,183 @@
+/*
+ * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef WTF_HashFunctions_h
+#define WTF_HashFunctions_h
+
+#include "RefPtr.h"
+#include <stdint.h>
+
+namespace WTF {
+
+ template<size_t size> struct IntTypes;
+ template<> struct IntTypes<1> { typedef int8_t SignedType; typedef uint8_t UnsignedType; };
+ template<> struct IntTypes<2> { typedef int16_t SignedType; typedef uint16_t UnsignedType; };
+ template<> struct IntTypes<4> { typedef int32_t SignedType; typedef uint32_t UnsignedType; };
+ template<> struct IntTypes<8> { typedef int64_t SignedType; typedef uint64_t UnsignedType; };
+
+ // integer hash function
+
+ // Thomas Wang's 32 Bit Mix Function: http://www.cris.com/~Ttwang/tech/inthash.htm
+ inline unsigned intHash(uint8_t key8)
+ {
+ unsigned key = key8;
+ key += ~(key << 15);
+ key ^= (key >> 10);
+ key += (key << 3);
+ key ^= (key >> 6);
+ key += ~(key << 11);
+ key ^= (key >> 16);
+ return key;
+ }
+
+ // Thomas Wang's 32 Bit Mix Function: http://www.cris.com/~Ttwang/tech/inthash.htm
+ inline unsigned intHash(uint16_t key16)
+ {
+ unsigned key = key16;
+ key += ~(key << 15);
+ key ^= (key >> 10);
+ key += (key << 3);
+ key ^= (key >> 6);
+ key += ~(key << 11);
+ key ^= (key >> 16);
+ return key;
+ }
+
+ // Thomas Wang's 32 Bit Mix Function: http://www.cris.com/~Ttwang/tech/inthash.htm
+ inline unsigned intHash(uint32_t key)
+ {
+ key += ~(key << 15);
+ key ^= (key >> 10);
+ key += (key << 3);
+ key ^= (key >> 6);
+ key += ~(key << 11);
+ key ^= (key >> 16);
+ return key;
+ }
+
+ // Thomas Wang's 64 bit Mix Function: http://www.cris.com/~Ttwang/tech/inthash.htm
+ inline unsigned intHash(uint64_t key)
+ {
+ key += ~(key << 32);
+ key ^= (key >> 22);
+ key += ~(key << 13);
+ key ^= (key >> 8);
+ key += (key << 3);
+ key ^= (key >> 15);
+ key += ~(key << 27);
+ key ^= (key >> 31);
+ return static_cast<unsigned>(key);
+ }
+
+ template<typename T> struct IntHash {
+ static unsigned hash(T key) { return intHash(static_cast<typename IntTypes<sizeof(T)>::UnsignedType>(key)); }
+ static bool equal(T a, T b) { return a == b; }
+ static const bool safeToCompareToEmptyOrDeleted = true;
+ };
+
+ template<typename T> struct FloatHash {
+ static unsigned hash(T key)
+ {
+ union {
+ T key;
+ typename IntTypes<sizeof(T)>::UnsignedType bits;
+ } u;
+ u.key = key;
+ return intHash(u.bits);
+ }
+ static bool equal(T a, T b) { return a == b; }
+ static const bool safeToCompareToEmptyOrDeleted = true;
+ };
+
+ // pointer identity hash function
+
+ template<typename T> struct PtrHash {
+ static unsigned hash(T key)
+ {
+#if COMPILER(MSVC)
+#pragma warning(push)
+#pragma warning(disable: 4244) // work around what seems to be a bug in MSVC's conversion warnings
+#endif
+ return IntHash<uintptr_t>::hash(reinterpret_cast<uintptr_t>(key));
+#if COMPILER(MSVC)
+#pragma warning(pop)
+#endif
+ }
+ static bool equal(T a, T b) { return a == b; }
+ static const bool safeToCompareToEmptyOrDeleted = true;
+ };
+ template<typename P> struct PtrHash<RefPtr<P> > : PtrHash<P*> {
+ using PtrHash<P*>::hash;
+ static unsigned hash(const RefPtr<P>& key) { return hash(key.get()); }
+ using PtrHash<P*>::equal;
+ static bool equal(const RefPtr<P>& a, const RefPtr<P>& b) { return a == b; }
+ static bool equal(P* a, const RefPtr<P>& b) { return a == b; }
+ static bool equal(const RefPtr<P>& a, P* b) { return a == b; }
+ };
+
+ // default hash function for each type
+
+ template<typename T> struct DefaultHash;
+
+ template<typename T, typename U> struct PairHash {
+ static unsigned hash(const std::pair<T, U>& p)
+ {
+ return intHash((static_cast<uint64_t>(DefaultHash<T>::Hash::hash(p.first)) << 32 | DefaultHash<U>::Hash::hash(p.second)));
+ }
+ static bool equal(const std::pair<T, U>& a, const std::pair<T, U>& b)
+ {
+ return DefaultHash<T>::Hash::equal(a.first, b.first) && DefaultHash<U>::Hash::equal(a.second, b.second);
+ }
+ static const bool safeToCompareToEmptyOrDeleted = DefaultHash<T>::Hash::safeToCompareToEmptyOrDeleted
+ && DefaultHash<U>::Hash::safeToCompareToEmptyOrDeleted;
+ };
+
+ // make IntHash the default hash function for many integer types
+
+ template<> struct DefaultHash<short> { typedef IntHash<unsigned> Hash; };
+ template<> struct DefaultHash<unsigned short> { typedef IntHash<unsigned> Hash; };
+ template<> struct DefaultHash<int> { typedef IntHash<unsigned> Hash; };
+ template<> struct DefaultHash<unsigned> { typedef IntHash<unsigned> Hash; };
+ template<> struct DefaultHash<long> { typedef IntHash<unsigned long> Hash; };
+ template<> struct DefaultHash<unsigned long> { typedef IntHash<unsigned long> Hash; };
+ template<> struct DefaultHash<long long> { typedef IntHash<unsigned long long> Hash; };
+ template<> struct DefaultHash<unsigned long long> { typedef IntHash<unsigned long long> Hash; };
+
+#if !COMPILER(MSVC) || defined(_NATIVE_WCHAR_T_DEFINED)
+ template<> struct DefaultHash<wchar_t> { typedef IntHash<wchar_t> Hash; };
+#endif
+
+ template<> struct DefaultHash<float> { typedef FloatHash<float> Hash; };
+ template<> struct DefaultHash<double> { typedef FloatHash<double> Hash; };
+
+ // make PtrHash the default hash function for pointer types that don't specialize
+
+ template<typename P> struct DefaultHash<P*> { typedef PtrHash<P*> Hash; };
+ template<typename P> struct DefaultHash<RefPtr<P> > { typedef PtrHash<RefPtr<P> > Hash; };
+
+ template<typename T, typename U> struct DefaultHash<std::pair<T, U> > { typedef PairHash<T, U> Hash; };
+
+} // namespace WTF
+
+using WTF::DefaultHash;
+using WTF::IntHash;
+using WTF::PtrHash;
+
+#endif // WTF_HashFunctions_h
diff --git a/Source/JavaScriptCore/wtf/HashIterators.h b/Source/JavaScriptCore/wtf/HashIterators.h
new file mode 100644
index 0000000..682c83b
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/HashIterators.h
@@ -0,0 +1,216 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WTF_HashIterators_h
+#define WTF_HashIterators_h
+
+namespace WTF {
+
+ template<typename HashTableType, typename KeyType, typename MappedType> struct HashTableConstKeysIterator;
+ template<typename HashTableType, typename KeyType, typename MappedType> struct HashTableConstValuesIterator;
+ template<typename HashTableType, typename KeyType, typename MappedType> struct HashTableKeysIterator;
+ template<typename HashTableType, typename KeyType, typename MappedType> struct HashTableValuesIterator;
+
+ template<typename HashTableType, typename KeyType, typename MappedType> struct HashTableConstIteratorAdapter<HashTableType, std::pair<KeyType, MappedType> > {
+ private:
+ typedef std::pair<KeyType, MappedType> ValueType;
+ public:
+ typedef HashTableConstKeysIterator<HashTableType, KeyType, MappedType> Keys;
+ typedef HashTableConstValuesIterator<HashTableType, KeyType, MappedType> Values;
+
+ HashTableConstIteratorAdapter(const typename HashTableType::const_iterator& impl) : m_impl(impl) {}
+
+ const ValueType* get() const { return (const ValueType*)m_impl.get(); }
+ const ValueType& operator*() const { return *get(); }
+ const ValueType* operator->() const { return get(); }
+
+ HashTableConstIteratorAdapter& operator++() { ++m_impl; return *this; }
+ // postfix ++ intentionally omitted
+
+ Keys keys() { return Keys(*this); }
+ Values values() { return Values(*this); }
+
+ typename HashTableType::const_iterator m_impl;
+ };
+
+ template<typename HashTableType, typename KeyType, typename MappedType> struct HashTableIteratorAdapter<HashTableType, std::pair<KeyType, MappedType> > {
+ private:
+ typedef std::pair<KeyType, MappedType> ValueType;
+ public:
+ typedef HashTableKeysIterator<HashTableType, KeyType, MappedType> Keys;
+ typedef HashTableValuesIterator<HashTableType, KeyType, MappedType> Values;
+
+ HashTableIteratorAdapter(const typename HashTableType::iterator& impl) : m_impl(impl) {}
+
+ ValueType* get() const { return (ValueType*)m_impl.get(); }
+ ValueType& operator*() const { return *get(); }
+ ValueType* operator->() const { return get(); }
+
+ HashTableIteratorAdapter& operator++() { ++m_impl; return *this; }
+ // postfix ++ intentionally omitted
+
+ operator HashTableConstIteratorAdapter<HashTableType, ValueType>() {
+ typename HashTableType::const_iterator i = m_impl;
+ return i;
+ }
+
+ Keys keys() { return Keys(*this); }
+ Values values() { return Values(*this); }
+
+ typename HashTableType::iterator m_impl;
+ };
+
+ template<typename HashTableType, typename KeyType, typename MappedType> struct HashTableConstKeysIterator {
+ private:
+ typedef HashTableConstIteratorAdapter<HashTableType, std::pair<KeyType, MappedType> > ConstIterator;
+
+ public:
+ HashTableConstKeysIterator(const ConstIterator& impl) : m_impl(impl) {}
+
+ const KeyType* get() const { return &(m_impl.get()->first); }
+ const KeyType& operator*() const { return *get(); }
+ const KeyType* operator->() const { return get(); }
+
+ HashTableConstKeysIterator& operator++() { ++m_impl; return *this; }
+ // postfix ++ intentionally omitted
+
+ ConstIterator m_impl;
+ };
+
+ template<typename HashTableType, typename KeyType, typename MappedType> struct HashTableConstValuesIterator {
+ private:
+ typedef HashTableConstIteratorAdapter<HashTableType, std::pair<KeyType, MappedType> > ConstIterator;
+
+ public:
+ HashTableConstValuesIterator(const ConstIterator& impl) : m_impl(impl) {}
+
+ const MappedType* get() const { return &(m_impl.get()->second); }
+ const MappedType& operator*() const { return *get(); }
+ const MappedType* operator->() const { return get(); }
+
+ HashTableConstValuesIterator& operator++() { ++m_impl; return *this; }
+ // postfix ++ intentionally omitted
+
+ ConstIterator m_impl;
+ };
+
+ template<typename HashTableType, typename KeyType, typename MappedType> struct HashTableKeysIterator {
+ private:
+ typedef HashTableIteratorAdapter<HashTableType, std::pair<KeyType, MappedType> > Iterator;
+ typedef HashTableConstIteratorAdapter<HashTableType, std::pair<KeyType, MappedType> > ConstIterator;
+
+ public:
+ HashTableKeysIterator(const Iterator& impl) : m_impl(impl) {}
+
+ KeyType* get() const { return &(m_impl.get()->first); }
+ KeyType& operator*() const { return *get(); }
+ KeyType* operator->() const { return get(); }
+
+ HashTableKeysIterator& operator++() { ++m_impl; return *this; }
+ // postfix ++ intentionally omitted
+
+ operator HashTableConstKeysIterator<HashTableType, KeyType, MappedType>() {
+ ConstIterator i = m_impl;
+ return i;
+ }
+
+ Iterator m_impl;
+ };
+
+ template<typename HashTableType, typename KeyType, typename MappedType> struct HashTableValuesIterator {
+ private:
+ typedef HashTableIteratorAdapter<HashTableType, std::pair<KeyType, MappedType> > Iterator;
+ typedef HashTableConstIteratorAdapter<HashTableType, std::pair<KeyType, MappedType> > ConstIterator;
+
+ public:
+ HashTableValuesIterator(const Iterator& impl) : m_impl(impl) {}
+
+ MappedType* get() const { return &(m_impl.get()->second); }
+ MappedType& operator*() const { return *get(); }
+ MappedType* operator->() const { return get(); }
+
+ HashTableValuesIterator& operator++() { ++m_impl; return *this; }
+ // postfix ++ intentionally omitted
+
+ operator HashTableConstValuesIterator<HashTableType, KeyType, MappedType>() {
+ ConstIterator i = m_impl;
+ return i;
+ }
+
+ Iterator m_impl;
+ };
+
+ template<typename T, typename U, typename V>
+ inline bool operator==(const HashTableConstKeysIterator<T, U, V>& a, const HashTableConstKeysIterator<T, U, V>& b)
+ {
+ return a.m_impl == b.m_impl;
+ }
+
+ template<typename T, typename U, typename V>
+ inline bool operator!=(const HashTableConstKeysIterator<T, U, V>& a, const HashTableConstKeysIterator<T, U, V>& b)
+ {
+ return a.m_impl != b.m_impl;
+ }
+
+ template<typename T, typename U, typename V>
+ inline bool operator==(const HashTableConstValuesIterator<T, U, V>& a, const HashTableConstValuesIterator<T, U, V>& b)
+ {
+ return a.m_impl == b.m_impl;
+ }
+
+ template<typename T, typename U, typename V>
+ inline bool operator!=(const HashTableConstValuesIterator<T, U, V>& a, const HashTableConstValuesIterator<T, U, V>& b)
+ {
+ return a.m_impl != b.m_impl;
+ }
+
+ template<typename T, typename U, typename V>
+ inline bool operator==(const HashTableKeysIterator<T, U, V>& a, const HashTableKeysIterator<T, U, V>& b)
+ {
+ return a.m_impl == b.m_impl;
+ }
+
+ template<typename T, typename U, typename V>
+ inline bool operator!=(const HashTableKeysIterator<T, U, V>& a, const HashTableKeysIterator<T, U, V>& b)
+ {
+ return a.m_impl != b.m_impl;
+ }
+
+ template<typename T, typename U, typename V>
+ inline bool operator==(const HashTableValuesIterator<T, U, V>& a, const HashTableValuesIterator<T, U, V>& b)
+ {
+ return a.m_impl == b.m_impl;
+ }
+
+ template<typename T, typename U, typename V>
+ inline bool operator!=(const HashTableValuesIterator<T, U, V>& a, const HashTableValuesIterator<T, U, V>& b)
+ {
+ return a.m_impl != b.m_impl;
+ }
+
+
+} // namespace WTF
+
+#endif // WTF_HashIterators_h
diff --git a/Source/JavaScriptCore/wtf/HashMap.h b/Source/JavaScriptCore/wtf/HashMap.h
new file mode 100644
index 0000000..09094d1
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/HashMap.h
@@ -0,0 +1,410 @@
+/*
+ * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef WTF_HashMap_h
+#define WTF_HashMap_h
+
+#include "HashTable.h"
+
+namespace WTF {
+
+ template<typename PairType> struct PairFirstExtractor;
+
+ template<typename KeyArg, typename MappedArg, typename HashArg = typename DefaultHash<KeyArg>::Hash,
+ typename KeyTraitsArg = HashTraits<KeyArg>, typename MappedTraitsArg = HashTraits<MappedArg> >
+ class HashMap : public FastAllocBase {
+ private:
+ typedef KeyTraitsArg KeyTraits;
+ typedef MappedTraitsArg MappedTraits;
+ typedef PairHashTraits<KeyTraits, MappedTraits> ValueTraits;
+
+ public:
+ typedef typename KeyTraits::TraitType KeyType;
+ typedef typename MappedTraits::TraitType MappedType;
+ typedef typename ValueTraits::TraitType ValueType;
+
+ private:
+ typedef HashArg HashFunctions;
+
+ typedef HashTable<KeyType, ValueType, PairFirstExtractor<ValueType>,
+ HashFunctions, ValueTraits, KeyTraits> HashTableType;
+
+ public:
+ typedef HashTableIteratorAdapter<HashTableType, ValueType> iterator;
+ typedef HashTableConstIteratorAdapter<HashTableType, ValueType> const_iterator;
+
+ void swap(HashMap&);
+
+ int size() const;
+ int capacity() const;
+ bool isEmpty() const;
+
+ // iterators iterate over pairs of keys and values
+ iterator begin();
+ iterator end();
+ const_iterator begin() const;
+ const_iterator end() const;
+
+ iterator find(const KeyType&);
+ const_iterator find(const KeyType&) const;
+ bool contains(const KeyType&) const;
+ MappedType get(const KeyType&) const;
+
+ // replaces value but not key if key is already present
+ // return value is a pair of the iterator to the key location,
+ // and a boolean that's true if a new value was actually added
+ pair<iterator, bool> set(const KeyType&, const MappedType&);
+
+ // does nothing if key is already present
+ // return value is a pair of the iterator to the key location,
+ // and a boolean that's true if a new value was actually added
+ pair<iterator, bool> add(const KeyType&, const MappedType&);
+
+ void remove(const KeyType&);
+ void remove(iterator);
+ void clear();
+
+ MappedType take(const KeyType&); // efficient combination of get with remove
+
+ // An alternate version of find() that finds the object by hashing and comparing
+ // with some other type, to avoid the cost of type conversion. HashTranslator
+ // must have the following function members:
+ // static unsigned hash(const T&);
+ // static bool equal(const ValueType&, const T&);
+ template<typename T, typename HashTranslator> iterator find(const T&);
+ template<typename T, typename HashTranslator> const_iterator find(const T&) const;
+ template<typename T, typename HashTranslator> bool contains(const T&) const;
+
+ // An alternate version of add() that finds the object by hashing and comparing
+ // with some other type, to avoid the cost of type conversion if the object is already
+ // in the table. HashTranslator must have the following function members:
+ // static unsigned hash(const T&);
+ // static bool equal(const ValueType&, const T&);
+ // static translate(ValueType&, const T&, unsigned hashCode);
+ template<typename T, typename HashTranslator> pair<iterator, bool> add(const T&, const MappedType&);
+
+ void checkConsistency() const;
+
+ private:
+ pair<iterator, bool> inlineAdd(const KeyType&, const MappedType&);
+
+ HashTableType m_impl;
+ };
+
+ template<typename PairType> struct PairFirstExtractor {
+ static const typename PairType::first_type& extract(const PairType& p) { return p.first; }
+ };
+
+ template<typename ValueType, typename ValueTraits, typename HashFunctions>
+ struct HashMapTranslator {
+ typedef typename ValueType::first_type KeyType;
+ typedef typename ValueType::second_type MappedType;
+
+ static unsigned hash(const KeyType& key) { return HashFunctions::hash(key); }
+ static bool equal(const KeyType& a, const KeyType& b) { return HashFunctions::equal(a, b); }
+ static void translate(ValueType& location, const KeyType& key, const MappedType& mapped)
+ {
+ location.first = key;
+ location.second = mapped;
+ }
+ };
+
+ template<typename ValueType, typename ValueTraits, typename T, typename Translator>
+ struct HashMapTranslatorAdapter {
+ typedef typename ValueType::first_type KeyType;
+ typedef typename ValueType::second_type MappedType;
+
+ static unsigned hash(const T& key) { return Translator::hash(key); }
+ static bool equal(const KeyType& a, const T& b) { return Translator::equal(a, b); }
+ static void translate(ValueType& location, const T& key, const MappedType& mapped, unsigned hashCode)
+ {
+ Translator::translate(location.first, key, hashCode);
+ location.second = mapped;
+ }
+ };
+
+ template<typename T, typename U, typename V, typename W, typename X>
+ inline void HashMap<T, U, V, W, X>::swap(HashMap& other)
+ {
+ m_impl.swap(other.m_impl);
+ }
+
+ template<typename T, typename U, typename V, typename W, typename X>
+ inline int HashMap<T, U, V, W, X>::size() const
+ {
+ return m_impl.size();
+ }
+
+ template<typename T, typename U, typename V, typename W, typename X>
+ inline int HashMap<T, U, V, W, X>::capacity() const
+ {
+ return m_impl.capacity();
+ }
+
+ template<typename T, typename U, typename V, typename W, typename X>
+ inline bool HashMap<T, U, V, W, X>::isEmpty() const
+ {
+ return m_impl.isEmpty();
+ }
+
+ template<typename T, typename U, typename V, typename W, typename X>
+ inline typename HashMap<T, U, V, W, X>::iterator HashMap<T, U, V, W, X>::begin()
+ {
+ return m_impl.begin();
+ }
+
+ template<typename T, typename U, typename V, typename W, typename X>
+ inline typename HashMap<T, U, V, W, X>::iterator HashMap<T, U, V, W, X>::end()
+ {
+ return m_impl.end();
+ }
+
+ template<typename T, typename U, typename V, typename W, typename X>
+ inline typename HashMap<T, U, V, W, X>::const_iterator HashMap<T, U, V, W, X>::begin() const
+ {
+ return m_impl.begin();
+ }
+
+ template<typename T, typename U, typename V, typename W, typename X>
+ inline typename HashMap<T, U, V, W, X>::const_iterator HashMap<T, U, V, W, X>::end() const
+ {
+ return m_impl.end();
+ }
+
+ template<typename T, typename U, typename V, typename W, typename X>
+ inline typename HashMap<T, U, V, W, X>::iterator HashMap<T, U, V, W, X>::find(const KeyType& key)
+ {
+ return m_impl.find(key);
+ }
+
+ template<typename T, typename U, typename V, typename W, typename X>
+ inline typename HashMap<T, U, V, W, X>::const_iterator HashMap<T, U, V, W, X>::find(const KeyType& key) const
+ {
+ return m_impl.find(key);
+ }
+
+ template<typename T, typename U, typename V, typename W, typename X>
+ inline bool HashMap<T, U, V, W, X>::contains(const KeyType& key) const
+ {
+ return m_impl.contains(key);
+ }
+
+ template<typename T, typename U, typename V, typename W, typename X>
+ template<typename TYPE, typename HashTranslator>
+ inline typename HashMap<T, U, V, W, X>::iterator
+ HashMap<T, U, V, W, X>::find(const TYPE& value)
+ {
+ typedef HashMapTranslatorAdapter<ValueType, ValueTraits, TYPE, HashTranslator> Adapter;
+ return m_impl.template find<TYPE, Adapter>(value);
+ }
+
+ template<typename T, typename U, typename V, typename W, typename X>
+ template<typename TYPE, typename HashTranslator>
+ inline typename HashMap<T, U, V, W, X>::const_iterator
+ HashMap<T, U, V, W, X>::find(const TYPE& value) const
+ {
+ typedef HashMapTranslatorAdapter<ValueType, ValueTraits, TYPE, HashTranslator> Adapter;
+ return m_impl.template find<TYPE, Adapter>(value);
+ }
+
+ template<typename T, typename U, typename V, typename W, typename X>
+ template<typename TYPE, typename HashTranslator>
+ inline bool
+ HashMap<T, U, V, W, X>::contains(const TYPE& value) const
+ {
+ typedef HashMapTranslatorAdapter<ValueType, ValueTraits, TYPE, HashTranslator> Adapter;
+ return m_impl.template contains<TYPE, Adapter>(value);
+ }
+
+ template<typename T, typename U, typename V, typename W, typename X>
+ inline pair<typename HashMap<T, U, V, W, X>::iterator, bool>
+ HashMap<T, U, V, W, X>::inlineAdd(const KeyType& key, const MappedType& mapped)
+ {
+ typedef HashMapTranslator<ValueType, ValueTraits, HashFunctions> TranslatorType;
+ return m_impl.template add<KeyType, MappedType, TranslatorType>(key, mapped);
+ }
+
+ template<typename T, typename U, typename V, typename W, typename X>
+ pair<typename HashMap<T, U, V, W, X>::iterator, bool>
+ HashMap<T, U, V, W, X>::set(const KeyType& key, const MappedType& mapped)
+ {
+ pair<iterator, bool> result = inlineAdd(key, mapped);
+ if (!result.second) {
+ // add call above didn't change anything, so set the mapped value
+ result.first->second = mapped;
+ }
+ return result;
+ }
+
+ template<typename T, typename U, typename V, typename W, typename X>
+ template<typename TYPE, typename HashTranslator>
+ pair<typename HashMap<T, U, V, W, X>::iterator, bool>
+ HashMap<T, U, V, W, X>::add(const TYPE& key, const MappedType& value)
+ {
+ typedef HashMapTranslatorAdapter<ValueType, ValueTraits, TYPE, HashTranslator> Adapter;
+ return m_impl.template addPassingHashCode<TYPE, MappedType, Adapter>(key, value);
+ }
+
+ template<typename T, typename U, typename V, typename W, typename X>
+ pair<typename HashMap<T, U, V, W, X>::iterator, bool>
+ HashMap<T, U, V, W, X>::add(const KeyType& key, const MappedType& mapped)
+ {
+ return inlineAdd(key, mapped);
+ }
+
+ template<typename T, typename U, typename V, typename W, typename MappedTraits>
+ typename HashMap<T, U, V, W, MappedTraits>::MappedType
+ HashMap<T, U, V, W, MappedTraits>::get(const KeyType& key) const
+ {
+ ValueType* entry = const_cast<HashTableType&>(m_impl).lookup(key);
+ if (!entry)
+ return MappedTraits::emptyValue();
+ return entry->second;
+ }
+
+ template<typename T, typename U, typename V, typename W, typename X>
+ inline void HashMap<T, U, V, W, X>::remove(iterator it)
+ {
+ if (it.m_impl == m_impl.end())
+ return;
+ m_impl.internalCheckTableConsistency();
+ m_impl.removeWithoutEntryConsistencyCheck(it.m_impl);
+ }
+
+ template<typename T, typename U, typename V, typename W, typename X>
+ inline void HashMap<T, U, V, W, X>::remove(const KeyType& key)
+ {
+ remove(find(key));
+ }
+
+ template<typename T, typename U, typename V, typename W, typename X>
+ inline void HashMap<T, U, V, W, X>::clear()
+ {
+ m_impl.clear();
+ }
+
+ template<typename T, typename U, typename V, typename W, typename MappedTraits>
+ typename HashMap<T, U, V, W, MappedTraits>::MappedType
+ HashMap<T, U, V, W, MappedTraits>::take(const KeyType& key)
+ {
+ // This can probably be made more efficient to avoid ref/deref churn.
+ iterator it = find(key);
+ if (it == end())
+ return MappedTraits::emptyValue();
+ typename HashMap<T, U, V, W, MappedTraits>::MappedType result = it->second;
+ remove(it);
+ return result;
+ }
+
+ template<typename T, typename U, typename V, typename W, typename X>
+ inline void HashMap<T, U, V, W, X>::checkConsistency() const
+ {
+ m_impl.checkTableConsistency();
+ }
+
+
+ template<typename T, typename U, typename V, typename W, typename X>
+ bool operator==(const HashMap<T, U, V, W, X>& a, const HashMap<T, U, V, W, X>& b)
+ {
+ if (a.size() != b.size())
+ return false;
+
+ typedef typename HashMap<T, U, V, W, X>::const_iterator const_iterator;
+
+ const_iterator end = a.end();
+ const_iterator notFound = b.end();
+ for (const_iterator it = a.begin(); it != end; ++it) {
+ const_iterator bPos = b.find(it->first);
+ if (bPos == notFound || it->second != bPos->second)
+ return false;
+ }
+
+ return true;
+ }
+
+ template<typename T, typename U, typename V, typename W, typename X>
+ inline bool operator!=(const HashMap<T, U, V, W, X>& a, const HashMap<T, U, V, W, X>& b)
+ {
+ return !(a == b);
+ }
+
+ template<typename MappedType, typename HashTableType>
+ void deleteAllPairSeconds(HashTableType& collection)
+ {
+ typedef typename HashTableType::const_iterator iterator;
+ iterator end = collection.end();
+ for (iterator it = collection.begin(); it != end; ++it)
+ delete it->second;
+ }
+
+ template<typename T, typename U, typename V, typename W, typename X>
+ inline void deleteAllValues(const HashMap<T, U, V, W, X>& collection)
+ {
+ deleteAllPairSeconds<typename HashMap<T, U, V, W, X>::MappedType>(collection);
+ }
+
+ template<typename KeyType, typename HashTableType>
+ void deleteAllPairFirsts(HashTableType& collection)
+ {
+ typedef typename HashTableType::const_iterator iterator;
+ iterator end = collection.end();
+ for (iterator it = collection.begin(); it != end; ++it)
+ delete it->first;
+ }
+
+ template<typename T, typename U, typename V, typename W, typename X>
+ inline void deleteAllKeys(const HashMap<T, U, V, W, X>& collection)
+ {
+ deleteAllPairFirsts<typename HashMap<T, U, V, W, X>::KeyType>(collection);
+ }
+
+ template<typename T, typename U, typename V, typename W, typename X, typename Y>
+ inline void copyKeysToVector(const HashMap<T, U, V, W, X>& collection, Y& vector)
+ {
+ typedef typename HashMap<T, U, V, W, X>::const_iterator::Keys iterator;
+
+ vector.resize(collection.size());
+
+ iterator it = collection.begin().keys();
+ iterator end = collection.end().keys();
+ for (unsigned i = 0; it != end; ++it, ++i)
+ vector[i] = *it;
+ }
+
+ template<typename T, typename U, typename V, typename W, typename X, typename Y>
+ inline void copyValuesToVector(const HashMap<T, U, V, W, X>& collection, Y& vector)
+ {
+ typedef typename HashMap<T, U, V, W, X>::const_iterator::Values iterator;
+
+ vector.resize(collection.size());
+
+ iterator it = collection.begin().values();
+ iterator end = collection.end().values();
+ for (unsigned i = 0; it != end; ++it, ++i)
+ vector[i] = *it;
+ }
+
+} // namespace WTF
+
+using WTF::HashMap;
+
+#include "RefPtrHashMap.h"
+
+#endif /* WTF_HashMap_h */
diff --git a/Source/JavaScriptCore/wtf/HashSet.h b/Source/JavaScriptCore/wtf/HashSet.h
new file mode 100644
index 0000000..66639e4
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/HashSet.h
@@ -0,0 +1,259 @@
+/*
+ * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef WTF_HashSet_h
+#define WTF_HashSet_h
+
+#include "FastAllocBase.h"
+#include "HashTable.h"
+
+namespace WTF {
+
+ template<typename Value, typename HashFunctions, typename Traits> class HashSet;
+ template<typename Value, typename HashFunctions, typename Traits>
+ void deleteAllValues(const HashSet<Value, HashFunctions, Traits>&);
+ template<typename Value, typename HashFunctions, typename Traits>
+ void fastDeleteAllValues(const HashSet<Value, HashFunctions, Traits>&);
+
+ template<typename T> struct IdentityExtractor;
+
+ template<typename ValueArg, typename HashArg = typename DefaultHash<ValueArg>::Hash,
+ typename TraitsArg = HashTraits<ValueArg> > class HashSet : public FastAllocBase {
+ private:
+ typedef HashArg HashFunctions;
+ typedef TraitsArg ValueTraits;
+
+ public:
+ typedef typename ValueTraits::TraitType ValueType;
+
+ private:
+ typedef HashTable<ValueType, ValueType, IdentityExtractor<ValueType>,
+ HashFunctions, ValueTraits, ValueTraits> HashTableType;
+
+ public:
+ typedef HashTableConstIteratorAdapter<HashTableType, ValueType> iterator;
+ typedef HashTableConstIteratorAdapter<HashTableType, ValueType> const_iterator;
+
+ void swap(HashSet&);
+
+ int size() const;
+ int capacity() const;
+ bool isEmpty() const;
+
+ iterator begin() const;
+ iterator end() const;
+
+ iterator find(const ValueType&) const;
+ bool contains(const ValueType&) const;
+
+ // An alternate version of find() that finds the object by hashing and comparing
+ // with some other type, to avoid the cost of type conversion. HashTranslator
+ // must have the following function members:
+ // static unsigned hash(const T&);
+ // static bool equal(const ValueType&, const T&);
+ template<typename T, typename HashTranslator> iterator find(const T&) const;
+ template<typename T, typename HashTranslator> bool contains(const T&) const;
+
+ // The return value is a pair of an interator to the new value's location,
+ // and a bool that is true if an new entry was added.
+ pair<iterator, bool> add(const ValueType&);
+
+ // An alternate version of add() that finds the object by hashing and comparing
+ // with some other type, to avoid the cost of type conversion if the object is already
+ // in the table. HashTranslator must have the following function members:
+ // static unsigned hash(const T&);
+ // static bool equal(const ValueType&, const T&);
+ // static translate(ValueType&, const T&, unsigned hashCode);
+ template<typename T, typename HashTranslator> pair<iterator, bool> add(const T&);
+
+ void remove(const ValueType&);
+ void remove(iterator);
+ void clear();
+
+ private:
+ friend void deleteAllValues<>(const HashSet&);
+ friend void fastDeleteAllValues<>(const HashSet&);
+
+ HashTableType m_impl;
+ };
+
+ template<typename T> struct IdentityExtractor {
+ static const T& extract(const T& t) { return t; }
+ };
+
+ template<typename ValueType, typename ValueTraits, typename T, typename Translator>
+ struct HashSetTranslatorAdapter {
+ static unsigned hash(const T& key) { return Translator::hash(key); }
+ static bool equal(const ValueType& a, const T& b) { return Translator::equal(a, b); }
+ static void translate(ValueType& location, const T& key, const T&, unsigned hashCode)
+ {
+ Translator::translate(location, key, hashCode);
+ }
+ };
+
+ template<typename T, typename U, typename V>
+ inline void HashSet<T, U, V>::swap(HashSet& other)
+ {
+ m_impl.swap(other.m_impl);
+ }
+
+ template<typename T, typename U, typename V>
+ inline int HashSet<T, U, V>::size() const
+ {
+ return m_impl.size();
+ }
+
+ template<typename T, typename U, typename V>
+ inline int HashSet<T, U, V>::capacity() const
+ {
+ return m_impl.capacity();
+ }
+
+ template<typename T, typename U, typename V>
+ inline bool HashSet<T, U, V>::isEmpty() const
+ {
+ return m_impl.isEmpty();
+ }
+
+ template<typename T, typename U, typename V>
+ inline typename HashSet<T, U, V>::iterator HashSet<T, U, V>::begin() const
+ {
+ return m_impl.begin();
+ }
+
+ template<typename T, typename U, typename V>
+ inline typename HashSet<T, U, V>::iterator HashSet<T, U, V>::end() const
+ {
+ return m_impl.end();
+ }
+
+ template<typename T, typename U, typename V>
+ inline typename HashSet<T, U, V>::iterator HashSet<T, U, V>::find(const ValueType& value) const
+ {
+ return m_impl.find(value);
+ }
+
+ template<typename T, typename U, typename V>
+ inline bool HashSet<T, U, V>::contains(const ValueType& value) const
+ {
+ return m_impl.contains(value);
+ }
+
+ template<typename Value, typename HashFunctions, typename Traits>
+ template<typename T, typename HashTranslator>
+ typename HashSet<Value, HashFunctions, Traits>::iterator
+ inline HashSet<Value, HashFunctions, Traits>::find(const T& value) const
+ {
+ typedef HashSetTranslatorAdapter<ValueType, ValueTraits, T, HashTranslator> Adapter;
+ return m_impl.template find<T, Adapter>(value);
+ }
+
+ template<typename Value, typename HashFunctions, typename Traits>
+ template<typename T, typename HashTranslator>
+ inline bool HashSet<Value, HashFunctions, Traits>::contains(const T& value) const
+ {
+ typedef HashSetTranslatorAdapter<ValueType, ValueTraits, T, HashTranslator> Adapter;
+ return m_impl.template contains<T, Adapter>(value);
+ }
+
+ template<typename T, typename U, typename V>
+ pair<typename HashSet<T, U, V>::iterator, bool> HashSet<T, U, V>::add(const ValueType& value)
+ {
+ return m_impl.add(value);
+ }
+
+ template<typename Value, typename HashFunctions, typename Traits>
+ template<typename T, typename HashTranslator>
+ pair<typename HashSet<Value, HashFunctions, Traits>::iterator, bool>
+ HashSet<Value, HashFunctions, Traits>::add(const T& value)
+ {
+ typedef HashSetTranslatorAdapter<ValueType, ValueTraits, T, HashTranslator> Adapter;
+ return m_impl.template addPassingHashCode<T, T, Adapter>(value, value);
+ }
+
+ template<typename T, typename U, typename V>
+ inline void HashSet<T, U, V>::remove(iterator it)
+ {
+ if (it.m_impl == m_impl.end())
+ return;
+ m_impl.internalCheckTableConsistency();
+ m_impl.removeWithoutEntryConsistencyCheck(it.m_impl);
+ }
+
+ template<typename T, typename U, typename V>
+ inline void HashSet<T, U, V>::remove(const ValueType& value)
+ {
+ remove(find(value));
+ }
+
+ template<typename T, typename U, typename V>
+ inline void HashSet<T, U, V>::clear()
+ {
+ m_impl.clear();
+ }
+
+ template<typename ValueType, typename HashTableType>
+ void deleteAllValues(HashTableType& collection)
+ {
+ typedef typename HashTableType::const_iterator iterator;
+ iterator end = collection.end();
+ for (iterator it = collection.begin(); it != end; ++it)
+ delete *it;
+ }
+
+ template<typename T, typename U, typename V>
+ inline void deleteAllValues(const HashSet<T, U, V>& collection)
+ {
+ deleteAllValues<typename HashSet<T, U, V>::ValueType>(collection.m_impl);
+ }
+
+ template<typename ValueType, typename HashTableType>
+ void fastDeleteAllValues(HashTableType& collection)
+ {
+ typedef typename HashTableType::const_iterator iterator;
+ iterator end = collection.end();
+ for (iterator it = collection.begin(); it != end; ++it)
+ fastDelete(*it);
+ }
+
+ template<typename T, typename U, typename V>
+ inline void fastDeleteAllValues(const HashSet<T, U, V>& collection)
+ {
+ fastDeleteAllValues<typename HashSet<T, U, V>::ValueType>(collection.m_impl);
+ }
+
+ template<typename T, typename U, typename V, typename W>
+ inline void copyToVector(const HashSet<T, U, V>& collection, W& vector)
+ {
+ typedef typename HashSet<T, U, V>::const_iterator iterator;
+
+ vector.resize(collection.size());
+
+ iterator it = collection.begin();
+ iterator end = collection.end();
+ for (unsigned i = 0; it != end; ++it, ++i)
+ vector[i] = *it;
+ }
+
+} // namespace WTF
+
+using WTF::HashSet;
+
+#endif /* WTF_HashSet_h */
diff --git a/Source/JavaScriptCore/wtf/HashTable.cpp b/Source/JavaScriptCore/wtf/HashTable.cpp
new file mode 100644
index 0000000..71d3f86
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/HashTable.cpp
@@ -0,0 +1,69 @@
+/*
+ Copyright (C) 2005 Apple Inc. All rights reserved.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include "config.h"
+#include "HashTable.h"
+
+namespace WTF {
+
+#if DUMP_HASHTABLE_STATS
+
+int HashTableStats::numAccesses;
+int HashTableStats::numCollisions;
+int HashTableStats::collisionGraph[4096];
+int HashTableStats::maxCollisions;
+int HashTableStats::numRehashes;
+int HashTableStats::numRemoves;
+int HashTableStats::numReinserts;
+
+static HashTableStats logger;
+
+static Mutex& hashTableStatsMutex()
+{
+ AtomicallyInitializedStatic(Mutex&, mutex = *new Mutex);
+ return mutex;
+}
+
+HashTableStats::~HashTableStats()
+{
+ // Don't lock hashTableStatsMutex here because it can cause deadlocks at shutdown
+ // if any thread was killed while holding the mutex.
+ printf("\nWTF::HashTable statistics\n\n");
+ printf("%d accesses\n", numAccesses);
+ printf("%d total collisions, average %.2f probes per access\n", numCollisions, 1.0 * (numAccesses + numCollisions) / numAccesses);
+ printf("longest collision chain: %d\n", maxCollisions);
+ for (int i = 1; i <= maxCollisions; i++) {
+ printf(" %d lookups with exactly %d collisions (%.2f%% , %.2f%% with this many or more)\n", collisionGraph[i], i, 100.0 * (collisionGraph[i] - collisionGraph[i+1]) / numAccesses, 100.0 * collisionGraph[i] / numAccesses);
+ }
+ printf("%d rehashes\n", numRehashes);
+ printf("%d reinserts\n", numReinserts);
+}
+
+void HashTableStats::recordCollisionAtCount(int count)
+{
+ MutexLocker lock(hashTableStatsMutex());
+ if (count > maxCollisions)
+ maxCollisions = count;
+ numCollisions++;
+ collisionGraph[count]++;
+}
+
+#endif
+
+} // namespace WTF
diff --git a/Source/JavaScriptCore/wtf/HashTable.h b/Source/JavaScriptCore/wtf/HashTable.h
new file mode 100644
index 0000000..1c4ae6d
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/HashTable.h
@@ -0,0 +1,1179 @@
+/*
+ * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2008 David Levin <levin@chromium.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef WTF_HashTable_h
+#define WTF_HashTable_h
+
+#include "FastMalloc.h"
+#include "HashTraits.h"
+#include "ValueCheck.h"
+#include <wtf/Assertions.h>
+#include <wtf/Threading.h>
+
+namespace WTF {
+
+#define DUMP_HASHTABLE_STATS 0
+// Enables internal WTF consistency checks that are invoked automatically. Non-WTF callers can call checkTableConsistency() even if internal checks are disabled.
+#define CHECK_HASHTABLE_CONSISTENCY 0
+
+#ifdef NDEBUG
+#define CHECK_HASHTABLE_ITERATORS 0
+#define CHECK_HASHTABLE_USE_AFTER_DESTRUCTION 0
+#else
+#define CHECK_HASHTABLE_ITERATORS 1
+#define CHECK_HASHTABLE_USE_AFTER_DESTRUCTION 1
+#endif
+
+#if DUMP_HASHTABLE_STATS
+
+ struct HashTableStats {
+ ~HashTableStats();
+ // All of the variables are accessed in ~HashTableStats when the static struct is destroyed.
+
+ // The following variables are all atomically incremented when modified.
+ static int numAccesses;
+ static int numRehashes;
+ static int numRemoves;
+ static int numReinserts;
+
+ // The following variables are only modified in the recordCollisionAtCount method within a mutex.
+ static int maxCollisions;
+ static int numCollisions;
+ static int collisionGraph[4096];
+
+ static void recordCollisionAtCount(int count);
+ };
+
+#endif
+
+ template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+ class HashTable;
+ template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+ class HashTableIterator;
+ template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+ class HashTableConstIterator;
+
+ template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+ void addIterator(const HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>*,
+ HashTableConstIterator<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>*);
+
+ template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+ void removeIterator(HashTableConstIterator<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>*);
+
+#if !CHECK_HASHTABLE_ITERATORS
+
+ template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+ inline void addIterator(const HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>*,
+ HashTableConstIterator<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>*) { }
+
+ template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+ inline void removeIterator(HashTableConstIterator<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>*) { }
+
+#endif
+
+ typedef enum { HashItemKnownGood } HashItemKnownGoodTag;
+
+ template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+ class HashTableConstIterator {
+ private:
+ typedef HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits> HashTableType;
+ typedef HashTableIterator<Key, Value, Extractor, HashFunctions, Traits, KeyTraits> iterator;
+ typedef HashTableConstIterator<Key, Value, Extractor, HashFunctions, Traits, KeyTraits> const_iterator;
+ typedef Value ValueType;
+ typedef const ValueType& ReferenceType;
+ typedef const ValueType* PointerType;
+
+ friend class HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>;
+ friend class HashTableIterator<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>;
+
+ void skipEmptyBuckets()
+ {
+ while (m_position != m_endPosition && HashTableType::isEmptyOrDeletedBucket(*m_position))
+ ++m_position;
+ }
+
+ HashTableConstIterator(const HashTableType* table, PointerType position, PointerType endPosition)
+ : m_position(position), m_endPosition(endPosition)
+ {
+ addIterator(table, this);
+ skipEmptyBuckets();
+ }
+
+ HashTableConstIterator(const HashTableType* table, PointerType position, PointerType endPosition, HashItemKnownGoodTag)
+ : m_position(position), m_endPosition(endPosition)
+ {
+ addIterator(table, this);
+ }
+
+ public:
+ HashTableConstIterator()
+ {
+ addIterator(0, this);
+ }
+
+ // default copy, assignment and destructor are OK if CHECK_HASHTABLE_ITERATORS is 0
+
+#if CHECK_HASHTABLE_ITERATORS
+ ~HashTableConstIterator()
+ {
+ removeIterator(this);
+ }
+
+ HashTableConstIterator(const const_iterator& other)
+ : m_position(other.m_position), m_endPosition(other.m_endPosition)
+ {
+ addIterator(other.m_table, this);
+ }
+
+ const_iterator& operator=(const const_iterator& other)
+ {
+ m_position = other.m_position;
+ m_endPosition = other.m_endPosition;
+
+ removeIterator(this);
+ addIterator(other.m_table, this);
+
+ return *this;
+ }
+#endif
+
+ PointerType get() const
+ {
+ checkValidity();
+ return m_position;
+ }
+ ReferenceType operator*() const { return *get(); }
+ PointerType operator->() const { return get(); }
+
+ const_iterator& operator++()
+ {
+ checkValidity();
+ ASSERT(m_position != m_endPosition);
+ ++m_position;
+ skipEmptyBuckets();
+ return *this;
+ }
+
+ // postfix ++ intentionally omitted
+
+ // Comparison.
+ bool operator==(const const_iterator& other) const
+ {
+ checkValidity(other);
+ return m_position == other.m_position;
+ }
+ bool operator!=(const const_iterator& other) const
+ {
+ checkValidity(other);
+ return m_position != other.m_position;
+ }
+
+ private:
+ void checkValidity() const
+ {
+#if CHECK_HASHTABLE_ITERATORS
+ ASSERT(m_table);
+#endif
+ }
+
+
+#if CHECK_HASHTABLE_ITERATORS
+ void checkValidity(const const_iterator& other) const
+ {
+ ASSERT(m_table);
+ ASSERT_UNUSED(other, other.m_table);
+ ASSERT(m_table == other.m_table);
+ }
+#else
+ void checkValidity(const const_iterator&) const { }
+#endif
+
+ PointerType m_position;
+ PointerType m_endPosition;
+
+#if CHECK_HASHTABLE_ITERATORS
+ public:
+ // Any modifications of the m_next or m_previous of an iterator that is in a linked list of a HashTable::m_iterator,
+ // should be guarded with m_table->m_mutex.
+ mutable const HashTableType* m_table;
+ mutable const_iterator* m_next;
+ mutable const_iterator* m_previous;
+#endif
+ };
+
+ template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+ class HashTableIterator {
+ private:
+ typedef HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits> HashTableType;
+ typedef HashTableIterator<Key, Value, Extractor, HashFunctions, Traits, KeyTraits> iterator;
+ typedef HashTableConstIterator<Key, Value, Extractor, HashFunctions, Traits, KeyTraits> const_iterator;
+ typedef Value ValueType;
+ typedef ValueType& ReferenceType;
+ typedef ValueType* PointerType;
+
+ friend class HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>;
+
+ HashTableIterator(HashTableType* table, PointerType pos, PointerType end) : m_iterator(table, pos, end) { }
+ HashTableIterator(HashTableType* table, PointerType pos, PointerType end, HashItemKnownGoodTag tag) : m_iterator(table, pos, end, tag) { }
+
+ public:
+ HashTableIterator() { }
+
+ // default copy, assignment and destructor are OK
+
+ PointerType get() const { return const_cast<PointerType>(m_iterator.get()); }
+ ReferenceType operator*() const { return *get(); }
+ PointerType operator->() const { return get(); }
+
+ iterator& operator++() { ++m_iterator; return *this; }
+
+ // postfix ++ intentionally omitted
+
+ // Comparison.
+ bool operator==(const iterator& other) const { return m_iterator == other.m_iterator; }
+ bool operator!=(const iterator& other) const { return m_iterator != other.m_iterator; }
+
+ operator const_iterator() const { return m_iterator; }
+
+ private:
+ const_iterator m_iterator;
+ };
+
+ using std::swap;
+
+#if !COMPILER(MSVC)
+ // Visual C++ has a swap for pairs defined.
+
+ // swap pairs by component, in case of pair members that specialize swap
+ template<typename T, typename U> inline void swap(pair<T, U>& a, pair<T, U>& b)
+ {
+ swap(a.first, b.first);
+ swap(a.second, b.second);
+ }
+#endif
+
+ template<typename T, bool useSwap> struct Mover;
+ template<typename T> struct Mover<T, true> { static void move(T& from, T& to) { swap(from, to); } };
+ template<typename T> struct Mover<T, false> { static void move(T& from, T& to) { to = from; } };
+
+ template<typename Key, typename Value, typename HashFunctions> class IdentityHashTranslator {
+ public:
+ static unsigned hash(const Key& key) { return HashFunctions::hash(key); }
+ static bool equal(const Key& a, const Key& b) { return HashFunctions::equal(a, b); }
+ static void translate(Value& location, const Key&, const Value& value) { location = value; }
+ };
+
+ template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+ class HashTable {
+ public:
+ typedef HashTableIterator<Key, Value, Extractor, HashFunctions, Traits, KeyTraits> iterator;
+ typedef HashTableConstIterator<Key, Value, Extractor, HashFunctions, Traits, KeyTraits> const_iterator;
+ typedef Traits ValueTraits;
+ typedef Key KeyType;
+ typedef Value ValueType;
+ typedef IdentityHashTranslator<Key, Value, HashFunctions> IdentityTranslatorType;
+
+ HashTable();
+ ~HashTable()
+ {
+ invalidateIterators();
+ deallocateTable(m_table, m_tableSize);
+#if CHECK_HASHTABLE_USE_AFTER_DESTRUCTION
+ m_table = (ValueType*)(uintptr_t)0xbbadbeef;
+#endif
+ }
+
+ HashTable(const HashTable&);
+ void swap(HashTable&);
+ HashTable& operator=(const HashTable&);
+
+ iterator begin() { return makeIterator(m_table); }
+ iterator end() { return makeKnownGoodIterator(m_table + m_tableSize); }
+ const_iterator begin() const { return makeConstIterator(m_table); }
+ const_iterator end() const { return makeKnownGoodConstIterator(m_table + m_tableSize); }
+
+ int size() const { return m_keyCount; }
+ int capacity() const { return m_tableSize; }
+ bool isEmpty() const { return !m_keyCount; }
+
+ pair<iterator, bool> add(const ValueType& value) { return add<KeyType, ValueType, IdentityTranslatorType>(Extractor::extract(value), value); }
+
+ // A special version of add() that finds the object by hashing and comparing
+ // with some other type, to avoid the cost of type conversion if the object is already
+ // in the table.
+ template<typename T, typename Extra, typename HashTranslator> pair<iterator, bool> add(const T& key, const Extra&);
+ template<typename T, typename Extra, typename HashTranslator> pair<iterator, bool> addPassingHashCode(const T& key, const Extra&);
+
+ iterator find(const KeyType& key) { return find<KeyType, IdentityTranslatorType>(key); }
+ const_iterator find(const KeyType& key) const { return find<KeyType, IdentityTranslatorType>(key); }
+ bool contains(const KeyType& key) const { return contains<KeyType, IdentityTranslatorType>(key); }
+
+ template <typename T, typename HashTranslator> iterator find(const T&);
+ template <typename T, typename HashTranslator> const_iterator find(const T&) const;
+ template <typename T, typename HashTranslator> bool contains(const T&) const;
+
+ void remove(const KeyType&);
+ void remove(iterator);
+ void removeWithoutEntryConsistencyCheck(iterator);
+ void removeWithoutEntryConsistencyCheck(const_iterator);
+ void clear();
+
+ static bool isEmptyBucket(const ValueType& value) { return Extractor::extract(value) == KeyTraits::emptyValue(); }
+ static bool isDeletedBucket(const ValueType& value) { return KeyTraits::isDeletedValue(Extractor::extract(value)); }
+ static bool isEmptyOrDeletedBucket(const ValueType& value) { return isEmptyBucket(value) || isDeletedBucket(value); }
+
+ ValueType* lookup(const Key& key) { return lookup<Key, IdentityTranslatorType>(key); }
+ template<typename T, typename HashTranslator> ValueType* lookup(const T&);
+
+#if !ASSERT_DISABLED
+ void checkTableConsistency() const;
+#else
+ static void checkTableConsistency() { }
+#endif
+#if CHECK_HASHTABLE_CONSISTENCY
+ void internalCheckTableConsistency() const { checkTableConsistency(); }
+ void internalCheckTableConsistencyExceptSize() const { checkTableConsistencyExceptSize(); }
+#else
+ static void internalCheckTableConsistencyExceptSize() { }
+ static void internalCheckTableConsistency() { }
+#endif
+
+ private:
+ static ValueType* allocateTable(int size);
+ static void deallocateTable(ValueType* table, int size);
+
+ typedef pair<ValueType*, bool> LookupType;
+ typedef pair<LookupType, unsigned> FullLookupType;
+
+ LookupType lookupForWriting(const Key& key) { return lookupForWriting<Key, IdentityTranslatorType>(key); };
+ template<typename T, typename HashTranslator> FullLookupType fullLookupForWriting(const T&);
+ template<typename T, typename HashTranslator> LookupType lookupForWriting(const T&);
+
+ template<typename T, typename HashTranslator> void checkKey(const T&);
+
+ void removeAndInvalidateWithoutEntryConsistencyCheck(ValueType*);
+ void removeAndInvalidate(ValueType*);
+ void remove(ValueType*);
+
+ bool shouldExpand() const { return (m_keyCount + m_deletedCount) * m_maxLoad >= m_tableSize; }
+ bool mustRehashInPlace() const { return m_keyCount * m_minLoad < m_tableSize * 2; }
+ bool shouldShrink() const { return m_keyCount * m_minLoad < m_tableSize && m_tableSize > m_minTableSize; }
+ void expand();
+ void shrink() { rehash(m_tableSize / 2); }
+
+ void rehash(int newTableSize);
+ void reinsert(ValueType&);
+
+ static void initializeBucket(ValueType& bucket) { new (&bucket) ValueType(Traits::emptyValue()); }
+ static void deleteBucket(ValueType& bucket) { bucket.~ValueType(); Traits::constructDeletedValue(bucket); }
+
+ FullLookupType makeLookupResult(ValueType* position, bool found, unsigned hash)
+ { return FullLookupType(LookupType(position, found), hash); }
+
+ iterator makeIterator(ValueType* pos) { return iterator(this, pos, m_table + m_tableSize); }
+ const_iterator makeConstIterator(ValueType* pos) const { return const_iterator(this, pos, m_table + m_tableSize); }
+ iterator makeKnownGoodIterator(ValueType* pos) { return iterator(this, pos, m_table + m_tableSize, HashItemKnownGood); }
+ const_iterator makeKnownGoodConstIterator(ValueType* pos) const { return const_iterator(this, pos, m_table + m_tableSize, HashItemKnownGood); }
+
+#if !ASSERT_DISABLED
+ void checkTableConsistencyExceptSize() const;
+#else
+ static void checkTableConsistencyExceptSize() { }
+#endif
+
+#if CHECK_HASHTABLE_ITERATORS
+ void invalidateIterators();
+#else
+ static void invalidateIterators() { }
+#endif
+
+ static const int m_minTableSize = 64;
+ static const int m_maxLoad = 2;
+ static const int m_minLoad = 6;
+
+ ValueType* m_table;
+ int m_tableSize;
+ int m_tableSizeMask;
+ int m_keyCount;
+ int m_deletedCount;
+
+#if CHECK_HASHTABLE_ITERATORS
+ public:
+ // All access to m_iterators should be guarded with m_mutex.
+ mutable const_iterator* m_iterators;
+ mutable Mutex m_mutex;
+#endif
+ };
+
+ template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+ inline HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::HashTable()
+ : m_table(0)
+ , m_tableSize(0)
+ , m_tableSizeMask(0)
+ , m_keyCount(0)
+ , m_deletedCount(0)
+#if CHECK_HASHTABLE_ITERATORS
+ , m_iterators(0)
+#endif
+ {
+ }
+
+ static inline unsigned doubleHash(unsigned key)
+ {
+ key = ~key + (key >> 23);
+ key ^= (key << 12);
+ key ^= (key >> 7);
+ key ^= (key << 2);
+ key ^= (key >> 20);
+ return key;
+ }
+
+#if ASSERT_DISABLED
+
+ template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+ template<typename T, typename HashTranslator>
+ inline void HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::checkKey(const T&)
+ {
+ }
+
+#else
+
+ template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+ template<typename T, typename HashTranslator>
+ void HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::checkKey(const T& key)
+ {
+ if (!HashFunctions::safeToCompareToEmptyOrDeleted)
+ return;
+ ASSERT(!HashTranslator::equal(KeyTraits::emptyValue(), key));
+ ValueType deletedValue = Traits::emptyValue();
+ deletedValue.~ValueType();
+ Traits::constructDeletedValue(deletedValue);
+ ASSERT(!HashTranslator::equal(Extractor::extract(deletedValue), key));
+ new (&deletedValue) ValueType(Traits::emptyValue());
+ }
+
+#endif
+
+ template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+ template<typename T, typename HashTranslator>
+ inline Value* HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::lookup(const T& key)
+ {
+ checkKey<T, HashTranslator>(key);
+
+ int k = 0;
+ int sizeMask = m_tableSizeMask;
+ ValueType* table = m_table;
+ unsigned h = HashTranslator::hash(key);
+ int i = h & sizeMask;
+
+ if (!table)
+ return 0;
+
+#if DUMP_HASHTABLE_STATS
+ atomicIncrement(&HashTableStats::numAccesses);
+ int probeCount = 0;
+#endif
+
+ while (1) {
+ ValueType* entry = table + i;
+
+ // we count on the compiler to optimize out this branch
+ if (HashFunctions::safeToCompareToEmptyOrDeleted) {
+ if (HashTranslator::equal(Extractor::extract(*entry), key))
+ return entry;
+
+ if (isEmptyBucket(*entry))
+ return 0;
+ } else {
+ if (isEmptyBucket(*entry))
+ return 0;
+
+ if (!isDeletedBucket(*entry) && HashTranslator::equal(Extractor::extract(*entry), key))
+ return entry;
+ }
+#if DUMP_HASHTABLE_STATS
+ ++probeCount;
+ HashTableStats::recordCollisionAtCount(probeCount);
+#endif
+ if (k == 0)
+ k = 1 | doubleHash(h);
+ i = (i + k) & sizeMask;
+ }
+ }
+
+ template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+ template<typename T, typename HashTranslator>
+ inline typename HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::LookupType HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::lookupForWriting(const T& key)
+ {
+ ASSERT(m_table);
+ checkKey<T, HashTranslator>(key);
+
+ int k = 0;
+ ValueType* table = m_table;
+ int sizeMask = m_tableSizeMask;
+ unsigned h = HashTranslator::hash(key);
+ int i = h & sizeMask;
+
+#if DUMP_HASHTABLE_STATS
+ atomicIncrement(&HashTableStats::numAccesses);
+ int probeCount = 0;
+#endif
+
+ ValueType* deletedEntry = 0;
+
+ while (1) {
+ ValueType* entry = table + i;
+
+ // we count on the compiler to optimize out this branch
+ if (HashFunctions::safeToCompareToEmptyOrDeleted) {
+ if (isEmptyBucket(*entry))
+ return LookupType(deletedEntry ? deletedEntry : entry, false);
+
+ if (HashTranslator::equal(Extractor::extract(*entry), key))
+ return LookupType(entry, true);
+
+ if (isDeletedBucket(*entry))
+ deletedEntry = entry;
+ } else {
+ if (isEmptyBucket(*entry))
+ return LookupType(deletedEntry ? deletedEntry : entry, false);
+
+ if (isDeletedBucket(*entry))
+ deletedEntry = entry;
+ else if (HashTranslator::equal(Extractor::extract(*entry), key))
+ return LookupType(entry, true);
+ }
+#if DUMP_HASHTABLE_STATS
+ ++probeCount;
+ HashTableStats::recordCollisionAtCount(probeCount);
+#endif
+ if (k == 0)
+ k = 1 | doubleHash(h);
+ i = (i + k) & sizeMask;
+ }
+ }
+
+ template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+ template<typename T, typename HashTranslator>
+ inline typename HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::FullLookupType HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::fullLookupForWriting(const T& key)
+ {
+ ASSERT(m_table);
+ checkKey<T, HashTranslator>(key);
+
+ int k = 0;
+ ValueType* table = m_table;
+ int sizeMask = m_tableSizeMask;
+ unsigned h = HashTranslator::hash(key);
+ int i = h & sizeMask;
+
+#if DUMP_HASHTABLE_STATS
+ atomicIncrement(&HashTableStats::numAccesses);
+ int probeCount = 0;
+#endif
+
+ ValueType* deletedEntry = 0;
+
+ while (1) {
+ ValueType* entry = table + i;
+
+ // we count on the compiler to optimize out this branch
+ if (HashFunctions::safeToCompareToEmptyOrDeleted) {
+ if (isEmptyBucket(*entry))
+ return makeLookupResult(deletedEntry ? deletedEntry : entry, false, h);
+
+ if (HashTranslator::equal(Extractor::extract(*entry), key))
+ return makeLookupResult(entry, true, h);
+
+ if (isDeletedBucket(*entry))
+ deletedEntry = entry;
+ } else {
+ if (isEmptyBucket(*entry))
+ return makeLookupResult(deletedEntry ? deletedEntry : entry, false, h);
+
+ if (isDeletedBucket(*entry))
+ deletedEntry = entry;
+ else if (HashTranslator::equal(Extractor::extract(*entry), key))
+ return makeLookupResult(entry, true, h);
+ }
+#if DUMP_HASHTABLE_STATS
+ ++probeCount;
+ HashTableStats::recordCollisionAtCount(probeCount);
+#endif
+ if (k == 0)
+ k = 1 | doubleHash(h);
+ i = (i + k) & sizeMask;
+ }
+ }
+
+ template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+ template<typename T, typename Extra, typename HashTranslator>
+ inline pair<typename HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::iterator, bool> HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::add(const T& key, const Extra& extra)
+ {
+ checkKey<T, HashTranslator>(key);
+
+ invalidateIterators();
+
+ if (!m_table)
+ expand();
+
+ internalCheckTableConsistency();
+
+ ASSERT(m_table);
+
+ int k = 0;
+ ValueType* table = m_table;
+ int sizeMask = m_tableSizeMask;
+ unsigned h = HashTranslator::hash(key);
+ int i = h & sizeMask;
+
+#if DUMP_HASHTABLE_STATS
+ atomicIncrement(&HashTableStats::numAccesses);
+ int probeCount = 0;
+#endif
+
+ ValueType* deletedEntry = 0;
+ ValueType* entry;
+ while (1) {
+ entry = table + i;
+
+ // we count on the compiler to optimize out this branch
+ if (HashFunctions::safeToCompareToEmptyOrDeleted) {
+ if (isEmptyBucket(*entry))
+ break;
+
+ if (HashTranslator::equal(Extractor::extract(*entry), key))
+ return std::make_pair(makeKnownGoodIterator(entry), false);
+
+ if (isDeletedBucket(*entry))
+ deletedEntry = entry;
+ } else {
+ if (isEmptyBucket(*entry))
+ break;
+
+ if (isDeletedBucket(*entry))
+ deletedEntry = entry;
+ else if (HashTranslator::equal(Extractor::extract(*entry), key))
+ return std::make_pair(makeKnownGoodIterator(entry), false);
+ }
+#if DUMP_HASHTABLE_STATS
+ ++probeCount;
+ HashTableStats::recordCollisionAtCount(probeCount);
+#endif
+ if (k == 0)
+ k = 1 | doubleHash(h);
+ i = (i + k) & sizeMask;
+ }
+
+ if (deletedEntry) {
+ initializeBucket(*deletedEntry);
+ entry = deletedEntry;
+ --m_deletedCount;
+ }
+
+ HashTranslator::translate(*entry, key, extra);
+
+ ++m_keyCount;
+
+ if (shouldExpand()) {
+ // FIXME: This makes an extra copy on expand. Probably not that bad since
+ // expand is rare, but would be better to have a version of expand that can
+ // follow a pivot entry and return the new position.
+ KeyType enteredKey = Extractor::extract(*entry);
+ expand();
+ pair<iterator, bool> p = std::make_pair(find(enteredKey), true);
+ ASSERT(p.first != end());
+ return p;
+ }
+
+ internalCheckTableConsistency();
+
+ return std::make_pair(makeKnownGoodIterator(entry), true);
+ }
+
+ template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+ template<typename T, typename Extra, typename HashTranslator>
+ inline pair<typename HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::iterator, bool> HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::addPassingHashCode(const T& key, const Extra& extra)
+ {
+ checkKey<T, HashTranslator>(key);
+
+ invalidateIterators();
+
+ if (!m_table)
+ expand();
+
+ internalCheckTableConsistency();
+
+ FullLookupType lookupResult = fullLookupForWriting<T, HashTranslator>(key);
+
+ ValueType* entry = lookupResult.first.first;
+ bool found = lookupResult.first.second;
+ unsigned h = lookupResult.second;
+
+ if (found)
+ return std::make_pair(makeKnownGoodIterator(entry), false);
+
+ if (isDeletedBucket(*entry)) {
+ initializeBucket(*entry);
+ --m_deletedCount;
+ }
+
+ HashTranslator::translate(*entry, key, extra, h);
+ ++m_keyCount;
+ if (shouldExpand()) {
+ // FIXME: This makes an extra copy on expand. Probably not that bad since
+ // expand is rare, but would be better to have a version of expand that can
+ // follow a pivot entry and return the new position.
+ KeyType enteredKey = Extractor::extract(*entry);
+ expand();
+ pair<iterator, bool> p = std::make_pair(find(enteredKey), true);
+ ASSERT(p.first != end());
+ return p;
+ }
+
+ internalCheckTableConsistency();
+
+ return std::make_pair(makeKnownGoodIterator(entry), true);
+ }
+
+ template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+ inline void HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::reinsert(ValueType& entry)
+ {
+ ASSERT(m_table);
+ ASSERT(!lookupForWriting(Extractor::extract(entry)).second);
+ ASSERT(!isDeletedBucket(*(lookupForWriting(Extractor::extract(entry)).first)));
+#if DUMP_HASHTABLE_STATS
+ atomicIncrement(&HashTableStats::numReinserts);
+#endif
+
+ Mover<ValueType, Traits::needsDestruction>::move(entry, *lookupForWriting(Extractor::extract(entry)).first);
+ }
+
+ template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+ template <typename T, typename HashTranslator>
+ typename HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::iterator HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::find(const T& key)
+ {
+ if (!m_table)
+ return end();
+
+ ValueType* entry = lookup<T, HashTranslator>(key);
+ if (!entry)
+ return end();
+
+ return makeKnownGoodIterator(entry);
+ }
+
+ template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+ template <typename T, typename HashTranslator>
+ typename HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::const_iterator HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::find(const T& key) const
+ {
+ if (!m_table)
+ return end();
+
+ ValueType* entry = const_cast<HashTable*>(this)->lookup<T, HashTranslator>(key);
+ if (!entry)
+ return end();
+
+ return makeKnownGoodConstIterator(entry);
+ }
+
+ template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+ template <typename T, typename HashTranslator>
+ bool HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::contains(const T& key) const
+ {
+ if (!m_table)
+ return false;
+
+ return const_cast<HashTable*>(this)->lookup<T, HashTranslator>(key);
+ }
+
+ template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+ void HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::removeAndInvalidateWithoutEntryConsistencyCheck(ValueType* pos)
+ {
+ invalidateIterators();
+ remove(pos);
+ }
+
+ template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+ void HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::removeAndInvalidate(ValueType* pos)
+ {
+ invalidateIterators();
+ internalCheckTableConsistency();
+ remove(pos);
+ }
+
+ template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+ void HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::remove(ValueType* pos)
+ {
+#if DUMP_HASHTABLE_STATS
+ atomicIncrement(&HashTableStats::numRemoves);
+#endif
+
+ deleteBucket(*pos);
+ ++m_deletedCount;
+ --m_keyCount;
+
+ if (shouldShrink())
+ shrink();
+
+ internalCheckTableConsistency();
+ }
+
+ template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+ inline void HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::remove(iterator it)
+ {
+ if (it == end())
+ return;
+
+ removeAndInvalidate(const_cast<ValueType*>(it.m_iterator.m_position));
+ }
+
+ template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+ inline void HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::removeWithoutEntryConsistencyCheck(iterator it)
+ {
+ if (it == end())
+ return;
+
+ removeAndInvalidateWithoutEntryConsistencyCheck(const_cast<ValueType*>(it.m_iterator.m_position));
+ }
+
+ template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+ inline void HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::removeWithoutEntryConsistencyCheck(const_iterator it)
+ {
+ if (it == end())
+ return;
+
+ removeAndInvalidateWithoutEntryConsistencyCheck(const_cast<ValueType*>(it.m_position));
+ }
+
+ template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+ inline void HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::remove(const KeyType& key)
+ {
+ remove(find(key));
+ }
+
+ template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+ Value* HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::allocateTable(int size)
+ {
+ // would use a template member function with explicit specializations here, but
+ // gcc doesn't appear to support that
+ if (Traits::emptyValueIsZero)
+ return static_cast<ValueType*>(fastZeroedMalloc(size * sizeof(ValueType)));
+ ValueType* result = static_cast<ValueType*>(fastMalloc(size * sizeof(ValueType)));
+ for (int i = 0; i < size; i++)
+ initializeBucket(result[i]);
+ return result;
+ }
+
+ template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+ void HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::deallocateTable(ValueType* table, int size)
+ {
+ if (Traits::needsDestruction) {
+ for (int i = 0; i < size; ++i) {
+ if (!isDeletedBucket(table[i]))
+ table[i].~ValueType();
+ }
+ }
+ fastFree(table);
+ }
+
+ template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+ void HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::expand()
+ {
+ int newSize;
+ if (m_tableSize == 0)
+ newSize = m_minTableSize;
+ else if (mustRehashInPlace())
+ newSize = m_tableSize;
+ else
+ newSize = m_tableSize * 2;
+
+ rehash(newSize);
+ }
+
+ template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+ void HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::rehash(int newTableSize)
+ {
+ internalCheckTableConsistencyExceptSize();
+
+ int oldTableSize = m_tableSize;
+ ValueType* oldTable = m_table;
+
+#if DUMP_HASHTABLE_STATS
+ if (oldTableSize != 0)
+ atomicIncrement(&HashTableStats::numRehashes);
+#endif
+
+ m_tableSize = newTableSize;
+ m_tableSizeMask = newTableSize - 1;
+ m_table = allocateTable(newTableSize);
+
+ for (int i = 0; i != oldTableSize; ++i)
+ if (!isEmptyOrDeletedBucket(oldTable[i]))
+ reinsert(oldTable[i]);
+
+ m_deletedCount = 0;
+
+ deallocateTable(oldTable, oldTableSize);
+
+ internalCheckTableConsistency();
+ }
+
+ template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+ void HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::clear()
+ {
+ invalidateIterators();
+ deallocateTable(m_table, m_tableSize);
+ m_table = 0;
+ m_tableSize = 0;
+ m_tableSizeMask = 0;
+ m_keyCount = 0;
+ }
+
+ template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+ HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::HashTable(const HashTable& other)
+ : m_table(0)
+ , m_tableSize(0)
+ , m_tableSizeMask(0)
+ , m_keyCount(0)
+ , m_deletedCount(0)
+#if CHECK_HASHTABLE_ITERATORS
+ , m_iterators(0)
+#endif
+ {
+ // Copy the hash table the dumb way, by adding each element to the new table.
+ // It might be more efficient to copy the table slots, but it's not clear that efficiency is needed.
+ const_iterator end = other.end();
+ for (const_iterator it = other.begin(); it != end; ++it)
+ add(*it);
+ }
+
+ template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+ void HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::swap(HashTable& other)
+ {
+ invalidateIterators();
+ other.invalidateIterators();
+
+ ValueType* tmp_table = m_table;
+ m_table = other.m_table;
+ other.m_table = tmp_table;
+
+ int tmp_tableSize = m_tableSize;
+ m_tableSize = other.m_tableSize;
+ other.m_tableSize = tmp_tableSize;
+
+ int tmp_tableSizeMask = m_tableSizeMask;
+ m_tableSizeMask = other.m_tableSizeMask;
+ other.m_tableSizeMask = tmp_tableSizeMask;
+
+ int tmp_keyCount = m_keyCount;
+ m_keyCount = other.m_keyCount;
+ other.m_keyCount = tmp_keyCount;
+
+ int tmp_deletedCount = m_deletedCount;
+ m_deletedCount = other.m_deletedCount;
+ other.m_deletedCount = tmp_deletedCount;
+ }
+
+ template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+ HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>& HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::operator=(const HashTable& other)
+ {
+ HashTable tmp(other);
+ swap(tmp);
+ return *this;
+ }
+
+#if !ASSERT_DISABLED
+
+ template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+ void HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::checkTableConsistency() const
+ {
+ checkTableConsistencyExceptSize();
+ ASSERT(!m_table || !shouldExpand());
+ ASSERT(!shouldShrink());
+ }
+
+ template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+ void HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::checkTableConsistencyExceptSize() const
+ {
+ if (!m_table)
+ return;
+
+ int count = 0;
+ int deletedCount = 0;
+ for (int j = 0; j < m_tableSize; ++j) {
+ ValueType* entry = m_table + j;
+ if (isEmptyBucket(*entry))
+ continue;
+
+ if (isDeletedBucket(*entry)) {
+ ++deletedCount;
+ continue;
+ }
+
+ const_iterator it = find(Extractor::extract(*entry));
+ ASSERT(entry == it.m_position);
+ ++count;
+
+ ValueCheck<Key>::checkConsistency(it->first);
+ }
+
+ ASSERT(count == m_keyCount);
+ ASSERT(deletedCount == m_deletedCount);
+ ASSERT(m_tableSize >= m_minTableSize);
+ ASSERT(m_tableSizeMask);
+ ASSERT(m_tableSize == m_tableSizeMask + 1);
+ }
+
+#endif // ASSERT_DISABLED
+
+#if CHECK_HASHTABLE_ITERATORS
+
+ template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+ void HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::invalidateIterators()
+ {
+ MutexLocker lock(m_mutex);
+ const_iterator* next;
+ for (const_iterator* p = m_iterators; p; p = next) {
+ next = p->m_next;
+ p->m_table = 0;
+ p->m_next = 0;
+ p->m_previous = 0;
+ }
+ m_iterators = 0;
+ }
+
+ template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+ void addIterator(const HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>* table,
+ HashTableConstIterator<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>* it)
+ {
+ it->m_table = table;
+ it->m_previous = 0;
+
+ // Insert iterator at head of doubly-linked list of iterators.
+ if (!table) {
+ it->m_next = 0;
+ } else {
+ MutexLocker lock(table->m_mutex);
+ ASSERT(table->m_iterators != it);
+ it->m_next = table->m_iterators;
+ table->m_iterators = it;
+ if (it->m_next) {
+ ASSERT(!it->m_next->m_previous);
+ it->m_next->m_previous = it;
+ }
+ }
+ }
+
+ template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+ void removeIterator(HashTableConstIterator<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>* it)
+ {
+ typedef HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits> HashTableType;
+ typedef HashTableConstIterator<Key, Value, Extractor, HashFunctions, Traits, KeyTraits> const_iterator;
+
+ // Delete iterator from doubly-linked list of iterators.
+ if (!it->m_table) {
+ ASSERT(!it->m_next);
+ ASSERT(!it->m_previous);
+ } else {
+ MutexLocker lock(it->m_table->m_mutex);
+ if (it->m_next) {
+ ASSERT(it->m_next->m_previous == it);
+ it->m_next->m_previous = it->m_previous;
+ }
+ if (it->m_previous) {
+ ASSERT(it->m_table->m_iterators != it);
+ ASSERT(it->m_previous->m_next == it);
+ it->m_previous->m_next = it->m_next;
+ } else {
+ ASSERT(it->m_table->m_iterators == it);
+ it->m_table->m_iterators = it->m_next;
+ }
+ }
+
+ it->m_table = 0;
+ it->m_next = 0;
+ it->m_previous = 0;
+ }
+
+#endif // CHECK_HASHTABLE_ITERATORS
+
+ // iterator adapters
+
+ template<typename HashTableType, typename ValueType> struct HashTableConstIteratorAdapter {
+ HashTableConstIteratorAdapter(const typename HashTableType::const_iterator& impl) : m_impl(impl) {}
+
+ const ValueType* get() const { return (const ValueType*)m_impl.get(); }
+ const ValueType& operator*() const { return *get(); }
+ const ValueType* operator->() const { return get(); }
+
+ HashTableConstIteratorAdapter& operator++() { ++m_impl; return *this; }
+ // postfix ++ intentionally omitted
+
+ typename HashTableType::const_iterator m_impl;
+ };
+
+ template<typename HashTableType, typename ValueType> struct HashTableIteratorAdapter {
+ HashTableIteratorAdapter(const typename HashTableType::iterator& impl) : m_impl(impl) {}
+
+ ValueType* get() const { return (ValueType*)m_impl.get(); }
+ ValueType& operator*() const { return *get(); }
+ ValueType* operator->() const { return get(); }
+
+ HashTableIteratorAdapter& operator++() { ++m_impl; return *this; }
+ // postfix ++ intentionally omitted
+
+ operator HashTableConstIteratorAdapter<HashTableType, ValueType>() {
+ typename HashTableType::const_iterator i = m_impl;
+ return i;
+ }
+
+ typename HashTableType::iterator m_impl;
+ };
+
+ template<typename T, typename U>
+ inline bool operator==(const HashTableConstIteratorAdapter<T, U>& a, const HashTableConstIteratorAdapter<T, U>& b)
+ {
+ return a.m_impl == b.m_impl;
+ }
+
+ template<typename T, typename U>
+ inline bool operator!=(const HashTableConstIteratorAdapter<T, U>& a, const HashTableConstIteratorAdapter<T, U>& b)
+ {
+ return a.m_impl != b.m_impl;
+ }
+
+ template<typename T, typename U>
+ inline bool operator==(const HashTableIteratorAdapter<T, U>& a, const HashTableIteratorAdapter<T, U>& b)
+ {
+ return a.m_impl == b.m_impl;
+ }
+
+ template<typename T, typename U>
+ inline bool operator!=(const HashTableIteratorAdapter<T, U>& a, const HashTableIteratorAdapter<T, U>& b)
+ {
+ return a.m_impl != b.m_impl;
+ }
+
+} // namespace WTF
+
+#include "HashIterators.h"
+
+#endif // WTF_HashTable_h
diff --git a/Source/JavaScriptCore/wtf/HashTraits.h b/Source/JavaScriptCore/wtf/HashTraits.h
new file mode 100644
index 0000000..c8d40f7
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/HashTraits.h
@@ -0,0 +1,115 @@
+/*
+ * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef WTF_HashTraits_h
+#define WTF_HashTraits_h
+
+#include "HashFunctions.h"
+#include "TypeTraits.h"
+#include <utility>
+#include <limits>
+
+namespace WTF {
+
+ using std::pair;
+ using std::make_pair;
+
+ template<typename T> struct HashTraits;
+
+ template<bool isInteger, typename T> struct GenericHashTraitsBase;
+
+ template<typename T> struct GenericHashTraitsBase<false, T> {
+ static const bool emptyValueIsZero = false;
+ static const bool needsDestruction = true;
+ };
+
+ // Default integer traits disallow both 0 and -1 as keys (max value instead of -1 for unsigned).
+ template<typename T> struct GenericHashTraitsBase<true, T> {
+ static const bool emptyValueIsZero = true;
+ static const bool needsDestruction = false;
+ static void constructDeletedValue(T& slot) { slot = static_cast<T>(-1); }
+ static bool isDeletedValue(T value) { return value == static_cast<T>(-1); }
+ };
+
+ template<typename T> struct GenericHashTraits : GenericHashTraitsBase<IsInteger<T>::value, T> {
+ typedef T TraitType;
+ static T emptyValue() { return T(); }
+ };
+
+ template<typename T> struct HashTraits : GenericHashTraits<T> { };
+
+ template<typename T> struct FloatHashTraits : GenericHashTraits<T> {
+ static const bool needsDestruction = false;
+ static T emptyValue() { return std::numeric_limits<T>::infinity(); }
+ static void constructDeletedValue(T& slot) { slot = -std::numeric_limits<T>::infinity(); }
+ static bool isDeletedValue(T value) { return value == -std::numeric_limits<T>::infinity(); }
+ };
+
+ template<> struct HashTraits<float> : FloatHashTraits<float> { };
+ template<> struct HashTraits<double> : FloatHashTraits<double> { };
+
+ // Default unsigned traits disallow both 0 and max as keys -- use these traits to allow zero and disallow max - 1.
+ template<typename T> struct UnsignedWithZeroKeyHashTraits : GenericHashTraits<T> {
+ static const bool emptyValueIsZero = false;
+ static const bool needsDestruction = false;
+ static T emptyValue() { return std::numeric_limits<T>::max(); }
+ static void constructDeletedValue(T& slot) { slot = std::numeric_limits<T>::max() - 1; }
+ static bool isDeletedValue(T value) { return value == std::numeric_limits<T>::max() - 1; }
+ };
+
+ template<typename P> struct HashTraits<P*> : GenericHashTraits<P*> {
+ static const bool emptyValueIsZero = true;
+ static const bool needsDestruction = false;
+ static void constructDeletedValue(P*& slot) { slot = reinterpret_cast<P*>(-1); }
+ static bool isDeletedValue(P* value) { return value == reinterpret_cast<P*>(-1); }
+ };
+
+ template<typename P> struct HashTraits<RefPtr<P> > : GenericHashTraits<RefPtr<P> > {
+ static const bool emptyValueIsZero = true;
+ static void constructDeletedValue(RefPtr<P>& slot) { new (&slot) RefPtr<P>(HashTableDeletedValue); }
+ static bool isDeletedValue(const RefPtr<P>& value) { return value.isHashTableDeletedValue(); }
+ };
+
+ // special traits for pairs, helpful for their use in HashMap implementation
+
+ template<typename FirstTraitsArg, typename SecondTraitsArg>
+ struct PairHashTraits : GenericHashTraits<pair<typename FirstTraitsArg::TraitType, typename SecondTraitsArg::TraitType> > {
+ typedef FirstTraitsArg FirstTraits;
+ typedef SecondTraitsArg SecondTraits;
+ typedef pair<typename FirstTraits::TraitType, typename SecondTraits::TraitType> TraitType;
+
+ static const bool emptyValueIsZero = FirstTraits::emptyValueIsZero && SecondTraits::emptyValueIsZero;
+ static TraitType emptyValue() { return make_pair(FirstTraits::emptyValue(), SecondTraits::emptyValue()); }
+
+ static const bool needsDestruction = FirstTraits::needsDestruction || SecondTraits::needsDestruction;
+
+ static void constructDeletedValue(TraitType& slot) { FirstTraits::constructDeletedValue(slot.first); }
+ static bool isDeletedValue(const TraitType& value) { return FirstTraits::isDeletedValue(value.first); }
+ };
+
+ template<typename First, typename Second>
+ struct HashTraits<pair<First, Second> > : public PairHashTraits<HashTraits<First>, HashTraits<Second> > { };
+
+} // namespace WTF
+
+using WTF::HashTraits;
+using WTF::PairHashTraits;
+
+#endif // WTF_HashTraits_h
diff --git a/Source/JavaScriptCore/wtf/ListHashSet.h b/Source/JavaScriptCore/wtf/ListHashSet.h
new file mode 100644
index 0000000..e14ac45
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/ListHashSet.h
@@ -0,0 +1,617 @@
+/*
+ * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef WTF_ListHashSet_h
+#define WTF_ListHashSet_h
+
+#include "Assertions.h"
+#include "HashSet.h"
+#include "OwnPtr.h"
+#include "StdLibExtras.h"
+
+namespace WTF {
+
+ // ListHashSet: Just like HashSet, this class provides a Set
+ // interface - a collection of unique objects with O(1) insertion,
+ // removal and test for containership. However, it also has an
+ // order - iterating it will always give back values in the order
+ // in which they are added.
+
+ // In theory it would be possible to add prepend, insertAfter
+ // and an append that moves the element to the end even if already present,
+ // but unclear yet if these are needed.
+
+ template<typename Value, size_t inlineCapacity, typename HashFunctions> class ListHashSet;
+
+ template<typename T> struct IdentityExtractor;
+
+ template<typename Value, size_t inlineCapacity, typename HashFunctions>
+ void deleteAllValues(const ListHashSet<Value, inlineCapacity, HashFunctions>&);
+
+ template<typename ValueArg, size_t inlineCapacity, typename HashArg> class ListHashSetIterator;
+ template<typename ValueArg, size_t inlineCapacity, typename HashArg> class ListHashSetConstIterator;
+
+ template<typename ValueArg, size_t inlineCapacity> struct ListHashSetNode;
+ template<typename ValueArg, size_t inlineCapacity> struct ListHashSetNodeAllocator;
+ template<typename ValueArg, size_t inlineCapacity, typename HashArg> struct ListHashSetNodeHashFunctions;
+
+ template<typename ValueArg, size_t inlineCapacity = 256, typename HashArg = typename DefaultHash<ValueArg>::Hash> class ListHashSet : public FastAllocBase {
+ private:
+ typedef ListHashSetNode<ValueArg, inlineCapacity> Node;
+ typedef ListHashSetNodeAllocator<ValueArg, inlineCapacity> NodeAllocator;
+
+ typedef HashTraits<Node*> NodeTraits;
+ typedef ListHashSetNodeHashFunctions<ValueArg, inlineCapacity, HashArg> NodeHash;
+
+ typedef HashTable<Node*, Node*, IdentityExtractor<Node*>, NodeHash, NodeTraits, NodeTraits> ImplType;
+ typedef HashTableIterator<Node*, Node*, IdentityExtractor<Node*>, NodeHash, NodeTraits, NodeTraits> ImplTypeIterator;
+ typedef HashTableConstIterator<Node*, Node*, IdentityExtractor<Node*>, NodeHash, NodeTraits, NodeTraits> ImplTypeConstIterator;
+
+ typedef HashArg HashFunctions;
+
+ public:
+ typedef ValueArg ValueType;
+ typedef ListHashSetIterator<ValueType, inlineCapacity, HashArg> iterator;
+ typedef ListHashSetConstIterator<ValueType, inlineCapacity, HashArg> const_iterator;
+
+ friend class ListHashSetConstIterator<ValueType, inlineCapacity, HashArg>;
+
+ ListHashSet();
+ ListHashSet(const ListHashSet&);
+ ListHashSet& operator=(const ListHashSet&);
+ ~ListHashSet();
+
+ void swap(ListHashSet&);
+
+ int size() const;
+ int capacity() const;
+ bool isEmpty() const;
+
+ iterator begin();
+ iterator end();
+ const_iterator begin() const;
+ const_iterator end() const;
+
+ iterator find(const ValueType&);
+ const_iterator find(const ValueType&) const;
+ bool contains(const ValueType&) const;
+
+ // the return value is a pair of an iterator to the new value's location,
+ // and a bool that is true if an new entry was added
+ pair<iterator, bool> add(const ValueType&);
+
+ pair<iterator, bool> insertBefore(const ValueType& beforeValue, const ValueType& newValue);
+ pair<iterator, bool> insertBefore(iterator it, const ValueType&);
+
+ void remove(const ValueType&);
+ void remove(iterator);
+ void clear();
+
+ private:
+ void unlinkAndDelete(Node*);
+ void appendNode(Node*);
+ void insertNodeBefore(Node* beforeNode, Node* newNode);
+ void deleteAllNodes();
+ iterator makeIterator(Node*);
+ const_iterator makeConstIterator(Node*) const;
+
+ friend void deleteAllValues<>(const ListHashSet&);
+
+ ImplType m_impl;
+ Node* m_head;
+ Node* m_tail;
+ OwnPtr<NodeAllocator> m_allocator;
+ };
+
+ template<typename ValueArg, size_t inlineCapacity> struct ListHashSetNodeAllocator {
+ typedef ListHashSetNode<ValueArg, inlineCapacity> Node;
+ typedef ListHashSetNodeAllocator<ValueArg, inlineCapacity> NodeAllocator;
+
+ ListHashSetNodeAllocator()
+ : m_freeList(pool())
+ , m_isDoneWithInitialFreeList(false)
+ {
+ memset(m_pool.pool, 0, sizeof(m_pool.pool));
+ }
+
+ Node* allocate()
+ {
+ Node* result = m_freeList;
+
+ if (!result)
+ return static_cast<Node*>(fastMalloc(sizeof(Node)));
+
+ ASSERT(!result->m_isAllocated);
+
+ Node* next = result->m_next;
+ ASSERT(!next || !next->m_isAllocated);
+ if (!next && !m_isDoneWithInitialFreeList) {
+ next = result + 1;
+ if (next == pastPool()) {
+ m_isDoneWithInitialFreeList = true;
+ next = 0;
+ } else {
+ ASSERT(inPool(next));
+ ASSERT(!next->m_isAllocated);
+ }
+ }
+ m_freeList = next;
+
+ return result;
+ }
+
+ void deallocate(Node* node)
+ {
+ if (inPool(node)) {
+#ifndef NDEBUG
+ node->m_isAllocated = false;
+#endif
+ node->m_next = m_freeList;
+ m_freeList = node;
+ return;
+ }
+
+ fastFree(node);
+ }
+
+ private:
+ Node* pool() { return reinterpret_cast_ptr<Node*>(m_pool.pool); }
+ Node* pastPool() { return pool() + m_poolSize; }
+
+ bool inPool(Node* node)
+ {
+ return node >= pool() && node < pastPool();
+ }
+
+ Node* m_freeList;
+ bool m_isDoneWithInitialFreeList;
+ static const size_t m_poolSize = inlineCapacity;
+ union {
+ char pool[sizeof(Node) * m_poolSize];
+ double forAlignment;
+ } m_pool;
+ };
+
+ template<typename ValueArg, size_t inlineCapacity> struct ListHashSetNode {
+ typedef ListHashSetNodeAllocator<ValueArg, inlineCapacity> NodeAllocator;
+
+ ListHashSetNode(ValueArg value)
+ : m_value(value)
+ , m_prev(0)
+ , m_next(0)
+#ifndef NDEBUG
+ , m_isAllocated(true)
+#endif
+ {
+ }
+
+ void* operator new(size_t, NodeAllocator* allocator)
+ {
+ return allocator->allocate();
+ }
+ void destroy(NodeAllocator* allocator)
+ {
+ this->~ListHashSetNode();
+ allocator->deallocate(this);
+ }
+
+ ValueArg m_value;
+ ListHashSetNode* m_prev;
+ ListHashSetNode* m_next;
+
+#ifndef NDEBUG
+ bool m_isAllocated;
+#endif
+ };
+
+ template<typename ValueArg, size_t inlineCapacity, typename HashArg> struct ListHashSetNodeHashFunctions {
+ typedef ListHashSetNode<ValueArg, inlineCapacity> Node;
+
+ static unsigned hash(Node* const& key) { return HashArg::hash(key->m_value); }
+ static bool equal(Node* const& a, Node* const& b) { return HashArg::equal(a->m_value, b->m_value); }
+ static const bool safeToCompareToEmptyOrDeleted = false;
+ };
+
+ template<typename ValueArg, size_t inlineCapacity, typename HashArg> class ListHashSetIterator {
+ private:
+ typedef ListHashSet<ValueArg, inlineCapacity, HashArg> ListHashSetType;
+ typedef ListHashSetIterator<ValueArg, inlineCapacity, HashArg> iterator;
+ typedef ListHashSetConstIterator<ValueArg, inlineCapacity, HashArg> const_iterator;
+ typedef ListHashSetNode<ValueArg, inlineCapacity> Node;
+ typedef ValueArg ValueType;
+ typedef ValueType& ReferenceType;
+ typedef ValueType* PointerType;
+
+ friend class ListHashSet<ValueArg, inlineCapacity, HashArg>;
+
+ ListHashSetIterator(const ListHashSetType* set, Node* position) : m_iterator(set, position) { }
+
+ public:
+ ListHashSetIterator() { }
+
+ // default copy, assignment and destructor are OK
+
+ PointerType get() const { return const_cast<PointerType>(m_iterator.get()); }
+ ReferenceType operator*() const { return *get(); }
+ PointerType operator->() const { return get(); }
+
+ iterator& operator++() { ++m_iterator; return *this; }
+
+ // postfix ++ intentionally omitted
+
+ iterator& operator--() { --m_iterator; return *this; }
+
+ // postfix -- intentionally omitted
+
+ // Comparison.
+ bool operator==(const iterator& other) const { return m_iterator == other.m_iterator; }
+ bool operator!=(const iterator& other) const { return m_iterator != other.m_iterator; }
+
+ operator const_iterator() const { return m_iterator; }
+
+ private:
+ Node* node() { return m_iterator.node(); }
+
+ const_iterator m_iterator;
+ };
+
+ template<typename ValueArg, size_t inlineCapacity, typename HashArg> class ListHashSetConstIterator {
+ private:
+ typedef ListHashSet<ValueArg, inlineCapacity, HashArg> ListHashSetType;
+ typedef ListHashSetIterator<ValueArg, inlineCapacity, HashArg> iterator;
+ typedef ListHashSetConstIterator<ValueArg, inlineCapacity, HashArg> const_iterator;
+ typedef ListHashSetNode<ValueArg, inlineCapacity> Node;
+ typedef ValueArg ValueType;
+ typedef const ValueType& ReferenceType;
+ typedef const ValueType* PointerType;
+
+ friend class ListHashSet<ValueArg, inlineCapacity, HashArg>;
+ friend class ListHashSetIterator<ValueArg, inlineCapacity, HashArg>;
+
+ ListHashSetConstIterator(const ListHashSetType* set, Node* position)
+ : m_set(set)
+ , m_position(position)
+ {
+ }
+
+ public:
+ ListHashSetConstIterator()
+ {
+ }
+
+ PointerType get() const
+ {
+ return &m_position->m_value;
+ }
+ ReferenceType operator*() const { return *get(); }
+ PointerType operator->() const { return get(); }
+
+ const_iterator& operator++()
+ {
+ ASSERT(m_position != 0);
+ m_position = m_position->m_next;
+ return *this;
+ }
+
+ // postfix ++ intentionally omitted
+
+ const_iterator& operator--()
+ {
+ ASSERT(m_position != m_set->m_head);
+ if (!m_position)
+ m_position = m_set->m_tail;
+ else
+ m_position = m_position->m_prev;
+ return *this;
+ }
+
+ // postfix -- intentionally omitted
+
+ // Comparison.
+ bool operator==(const const_iterator& other) const
+ {
+ return m_position == other.m_position;
+ }
+ bool operator!=(const const_iterator& other) const
+ {
+ return m_position != other.m_position;
+ }
+
+ private:
+ Node* node() { return m_position; }
+
+ const ListHashSetType* m_set;
+ Node* m_position;
+ };
+
+
+ template<typename ValueType, size_t inlineCapacity, typename HashFunctions>
+ struct ListHashSetTranslator {
+ private:
+ typedef ListHashSetNode<ValueType, inlineCapacity> Node;
+ typedef ListHashSetNodeAllocator<ValueType, inlineCapacity> NodeAllocator;
+ public:
+ static unsigned hash(const ValueType& key) { return HashFunctions::hash(key); }
+ static bool equal(Node* const& a, const ValueType& b) { return HashFunctions::equal(a->m_value, b); }
+ static void translate(Node*& location, const ValueType& key, NodeAllocator* allocator)
+ {
+ location = new (allocator) Node(key);
+ }
+ };
+
+ template<typename T, size_t inlineCapacity, typename U>
+ inline ListHashSet<T, inlineCapacity, U>::ListHashSet()
+ : m_head(0)
+ , m_tail(0)
+ , m_allocator(new NodeAllocator)
+ {
+ }
+
+ template<typename T, size_t inlineCapacity, typename U>
+ inline ListHashSet<T, inlineCapacity, U>::ListHashSet(const ListHashSet& other)
+ : m_head(0)
+ , m_tail(0)
+ , m_allocator(new NodeAllocator)
+ {
+ const_iterator end = other.end();
+ for (const_iterator it = other.begin(); it != end; ++it)
+ add(*it);
+ }
+
+ template<typename T, size_t inlineCapacity, typename U>
+ inline ListHashSet<T, inlineCapacity, U>& ListHashSet<T, inlineCapacity, U>::operator=(const ListHashSet& other)
+ {
+ ListHashSet tmp(other);
+ swap(tmp);
+ return *this;
+ }
+
+ template<typename T, size_t inlineCapacity, typename U>
+ inline void ListHashSet<T, inlineCapacity, U>::swap(ListHashSet& other)
+ {
+ m_impl.swap(other.m_impl);
+ std::swap(m_head, other.m_head);
+ std::swap(m_tail, other.m_tail);
+ m_allocator.swap(other.m_allocator);
+ }
+
+ template<typename T, size_t inlineCapacity, typename U>
+ inline ListHashSet<T, inlineCapacity, U>::~ListHashSet()
+ {
+ deleteAllNodes();
+ }
+
+ template<typename T, size_t inlineCapacity, typename U>
+ inline int ListHashSet<T, inlineCapacity, U>::size() const
+ {
+ return m_impl.size();
+ }
+
+ template<typename T, size_t inlineCapacity, typename U>
+ inline int ListHashSet<T, inlineCapacity, U>::capacity() const
+ {
+ return m_impl.capacity();
+ }
+
+ template<typename T, size_t inlineCapacity, typename U>
+ inline bool ListHashSet<T, inlineCapacity, U>::isEmpty() const
+ {
+ return m_impl.isEmpty();
+ }
+
+ template<typename T, size_t inlineCapacity, typename U>
+ inline typename ListHashSet<T, inlineCapacity, U>::iterator ListHashSet<T, inlineCapacity, U>::begin()
+ {
+ return makeIterator(m_head);
+ }
+
+ template<typename T, size_t inlineCapacity, typename U>
+ inline typename ListHashSet<T, inlineCapacity, U>::iterator ListHashSet<T, inlineCapacity, U>::end()
+ {
+ return makeIterator(0);
+ }
+
+ template<typename T, size_t inlineCapacity, typename U>
+ inline typename ListHashSet<T, inlineCapacity, U>::const_iterator ListHashSet<T, inlineCapacity, U>::begin() const
+ {
+ return makeConstIterator(m_head);
+ }
+
+ template<typename T, size_t inlineCapacity, typename U>
+ inline typename ListHashSet<T, inlineCapacity, U>::const_iterator ListHashSet<T, inlineCapacity, U>::end() const
+ {
+ return makeConstIterator(0);
+ }
+
+ template<typename T, size_t inlineCapacity, typename U>
+ inline typename ListHashSet<T, inlineCapacity, U>::iterator ListHashSet<T, inlineCapacity, U>::find(const ValueType& value)
+ {
+ typedef ListHashSetTranslator<ValueType, inlineCapacity, HashFunctions> Translator;
+ ImplTypeIterator it = m_impl.template find<ValueType, Translator>(value);
+ if (it == m_impl.end())
+ return end();
+ return makeIterator(*it);
+ }
+
+ template<typename T, size_t inlineCapacity, typename U>
+ inline typename ListHashSet<T, inlineCapacity, U>::const_iterator ListHashSet<T, inlineCapacity, U>::find(const ValueType& value) const
+ {
+ typedef ListHashSetTranslator<ValueType, inlineCapacity, HashFunctions> Translator;
+ ImplTypeConstIterator it = m_impl.template find<ValueType, Translator>(value);
+ if (it == m_impl.end())
+ return end();
+ return makeConstIterator(*it);
+ }
+
+ template<typename T, size_t inlineCapacity, typename U>
+ inline bool ListHashSet<T, inlineCapacity, U>::contains(const ValueType& value) const
+ {
+ typedef ListHashSetTranslator<ValueType, inlineCapacity, HashFunctions> Translator;
+ return m_impl.template contains<ValueType, Translator>(value);
+ }
+
+ template<typename T, size_t inlineCapacity, typename U>
+ pair<typename ListHashSet<T, inlineCapacity, U>::iterator, bool> ListHashSet<T, inlineCapacity, U>::add(const ValueType &value)
+ {
+ typedef ListHashSetTranslator<ValueType, inlineCapacity, HashFunctions> Translator;
+ pair<typename ImplType::iterator, bool> result = m_impl.template add<ValueType, NodeAllocator*, Translator>(value, m_allocator.get());
+ if (result.second)
+ appendNode(*result.first);
+ return std::make_pair(makeIterator(*result.first), result.second);
+ }
+
+ template<typename T, size_t inlineCapacity, typename U>
+ pair<typename ListHashSet<T, inlineCapacity, U>::iterator, bool> ListHashSet<T, inlineCapacity, U>::insertBefore(iterator it, const ValueType& newValue)
+ {
+ typedef ListHashSetTranslator<ValueType, inlineCapacity, HashFunctions> Translator;
+ pair<typename ImplType::iterator, bool> result = m_impl.template add<ValueType, NodeAllocator*, Translator>(newValue, m_allocator.get());
+ if (result.second)
+ insertNodeBefore(it.node(), *result.first);
+ return std::make_pair(makeIterator(*result.first), result.second);
+
+ }
+
+ template<typename T, size_t inlineCapacity, typename U>
+ pair<typename ListHashSet<T, inlineCapacity, U>::iterator, bool> ListHashSet<T, inlineCapacity, U>::insertBefore(const ValueType& beforeValue, const ValueType& newValue)
+ {
+ return insertBefore(find(beforeValue), newValue);
+ }
+
+ template<typename T, size_t inlineCapacity, typename U>
+ inline void ListHashSet<T, inlineCapacity, U>::remove(iterator it)
+ {
+ if (it == end())
+ return;
+ m_impl.remove(it.node());
+ unlinkAndDelete(it.node());
+ }
+
+ template<typename T, size_t inlineCapacity, typename U>
+ inline void ListHashSet<T, inlineCapacity, U>::remove(const ValueType& value)
+ {
+ remove(find(value));
+ }
+
+ template<typename T, size_t inlineCapacity, typename U>
+ inline void ListHashSet<T, inlineCapacity, U>::clear()
+ {
+ deleteAllNodes();
+ m_impl.clear();
+ m_head = 0;
+ m_tail = 0;
+ }
+
+ template<typename T, size_t inlineCapacity, typename U>
+ void ListHashSet<T, inlineCapacity, U>::unlinkAndDelete(Node* node)
+ {
+ if (!node->m_prev) {
+ ASSERT(node == m_head);
+ m_head = node->m_next;
+ } else {
+ ASSERT(node != m_head);
+ node->m_prev->m_next = node->m_next;
+ }
+
+ if (!node->m_next) {
+ ASSERT(node == m_tail);
+ m_tail = node->m_prev;
+ } else {
+ ASSERT(node != m_tail);
+ node->m_next->m_prev = node->m_prev;
+ }
+
+ node->destroy(m_allocator.get());
+ }
+
+ template<typename T, size_t inlineCapacity, typename U>
+ void ListHashSet<T, inlineCapacity, U>::appendNode(Node* node)
+ {
+ node->m_prev = m_tail;
+ node->m_next = 0;
+
+ if (m_tail) {
+ ASSERT(m_head);
+ m_tail->m_next = node;
+ } else {
+ ASSERT(!m_head);
+ m_head = node;
+ }
+
+ m_tail = node;
+ }
+
+ template<typename T, size_t inlineCapacity, typename U>
+ void ListHashSet<T, inlineCapacity, U>::insertNodeBefore(Node* beforeNode, Node* newNode)
+ {
+ if (!beforeNode)
+ return appendNode(newNode);
+
+ newNode->m_next = beforeNode;
+ newNode->m_prev = beforeNode->m_prev;
+ if (beforeNode->m_prev)
+ beforeNode->m_prev->m_next = newNode;
+ beforeNode->m_prev = newNode;
+
+ if (!newNode->m_prev)
+ m_head = newNode;
+ }
+
+ template<typename T, size_t inlineCapacity, typename U>
+ void ListHashSet<T, inlineCapacity, U>::deleteAllNodes()
+ {
+ if (!m_head)
+ return;
+
+ for (Node* node = m_head, *next = m_head->m_next; node; node = next, next = node ? node->m_next : 0)
+ node->destroy(m_allocator.get());
+ }
+
+ template<typename T, size_t inlineCapacity, typename U>
+ inline ListHashSetIterator<T, inlineCapacity, U> ListHashSet<T, inlineCapacity, U>::makeIterator(Node* position)
+ {
+ return ListHashSetIterator<T, inlineCapacity, U>(this, position);
+ }
+
+ template<typename T, size_t inlineCapacity, typename U>
+ inline ListHashSetConstIterator<T, inlineCapacity, U> ListHashSet<T, inlineCapacity, U>::makeConstIterator(Node* position) const
+ {
+ return ListHashSetConstIterator<T, inlineCapacity, U>(this, position);
+ }
+
+ template<bool, typename ValueType, typename HashTableType>
+ void deleteAllValues(HashTableType& collection)
+ {
+ typedef typename HashTableType::const_iterator iterator;
+ iterator end = collection.end();
+ for (iterator it = collection.begin(); it != end; ++it)
+ delete (*it)->m_value;
+ }
+
+ template<typename T, size_t inlineCapacity, typename U>
+ inline void deleteAllValues(const ListHashSet<T, inlineCapacity, U>& collection)
+ {
+ deleteAllValues<true, typename ListHashSet<T, inlineCapacity, U>::ValueType>(collection.m_impl);
+ }
+
+} // namespace WTF
+
+using WTF::ListHashSet;
+
+#endif /* WTF_ListHashSet_h */
diff --git a/Source/JavaScriptCore/wtf/ListRefPtr.h b/Source/JavaScriptCore/wtf/ListRefPtr.h
new file mode 100644
index 0000000..8bf6447
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/ListRefPtr.h
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef WTF_ListRefPtr_h
+#define WTF_ListRefPtr_h
+
+#include <wtf/RefPtr.h>
+
+namespace WTF {
+
+ // Specialized version of RefPtr desgined for use in singly-linked lists.
+ // Derefs the list iteratively to avoid recursive derefing that can overflow the stack.
+ template <typename T> class ListRefPtr : public RefPtr<T> {
+ public:
+ ListRefPtr() : RefPtr<T>() {}
+ ListRefPtr(T* ptr) : RefPtr<T>(ptr) {}
+ ListRefPtr(const RefPtr<T>& o) : RefPtr<T>(o) {}
+ // see comment in PassRefPtr.h for why this takes const reference
+ template <typename U> ListRefPtr(const PassRefPtr<U>& o) : RefPtr<T>(o) {}
+
+ ~ListRefPtr();
+
+ ListRefPtr& operator=(T* optr) { RefPtr<T>::operator=(optr); return *this; }
+ ListRefPtr& operator=(const RefPtr<T>& o) { RefPtr<T>::operator=(o); return *this; }
+ ListRefPtr& operator=(const PassRefPtr<T>& o) { RefPtr<T>::operator=(o); return *this; }
+ template <typename U> ListRefPtr& operator=(const RefPtr<U>& o) { RefPtr<T>::operator=(o); return *this; }
+ template <typename U> ListRefPtr& operator=(const PassRefPtr<U>& o) { RefPtr<T>::operator=(o); return *this; }
+ };
+
+ // Remove inline for winscw compiler to prevent the compiler agressively resolving
+ // T::ref() in RefPtr<T>'s copy constructor. The bug is reported at:
+ // https://xdabug001.ext.nokia.com/bugzilla/show_bug.cgi?id=9812.
+ template <typename T>
+#if !COMPILER(WINSCW)
+ inline
+#endif
+ ListRefPtr<T>::~ListRefPtr()
+ {
+ RefPtr<T> reaper = this->release();
+ while (reaper && reaper->hasOneRef())
+ reaper = reaper->releaseNext(); // implicitly protects reaper->next, then derefs reaper
+ }
+
+ template <typename T> inline T* getPtr(const ListRefPtr<T>& p)
+ {
+ return p.get();
+ }
+
+} // namespace WTF
+
+using WTF::ListRefPtr;
+
+#endif // WTF_ListRefPtr_h
diff --git a/Source/JavaScriptCore/wtf/Locker.h b/Source/JavaScriptCore/wtf/Locker.h
new file mode 100644
index 0000000..41813d3
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/Locker.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef Locker_h
+#define Locker_h
+
+#include <wtf/Noncopyable.h>
+
+namespace WTF {
+
+template <typename T> class Locker : public Noncopyable {
+public:
+ Locker(T& lockable) : m_lockable(lockable) { m_lockable.lock(); }
+ ~Locker() { m_lockable.unlock(); }
+private:
+ T& m_lockable;
+};
+
+}
+
+using WTF::Locker;
+
+#endif
diff --git a/Source/JavaScriptCore/wtf/MD5.cpp b/Source/JavaScriptCore/wtf/MD5.cpp
new file mode 100644
index 0000000..c926a7b
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/MD5.cpp
@@ -0,0 +1,308 @@
+// The original file was copied from sqlite, and was in the public domain.
+// Modifications Copyright 2006 Google Inc. All Rights Reserved
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ * This code implements the MD5 message-digest algorithm.
+ * The algorithm is due to Ron Rivest. This code was
+ * written by Colin Plumb in 1993, no copyright is claimed.
+ * This code is in the public domain; do with it what you wish.
+ *
+ * Equivalent code is available from RSA Data Security, Inc.
+ * This code has been tested against that, and is equivalent,
+ * except that you don't need to include two pages of legalese
+ * with every copy.
+ *
+ * To compute the message digest of a chunk of bytes, construct an
+ * MD5 instance, call addBytes as needed on buffers full of bytes,
+ * and then call checksum, which will fill a supplied 16-byte array
+ * with the digest.
+ */
+
+#include "config.h"
+#include "MD5.h"
+
+#include "Assertions.h"
+#ifndef NDEBUG
+#include "StringExtras.h"
+#include "text/CString.h"
+#endif
+#include <wtf/StdLibExtras.h>
+
+namespace WTF {
+
+#ifdef NDEBUG
+static inline void testMD5() { }
+#else
+// MD5 test case.
+static bool isTestMD5Done;
+
+static void expectMD5(CString input, CString expected)
+{
+ MD5 md5;
+ md5.addBytes(reinterpret_cast<const uint8_t*>(input.data()), input.length());
+ Vector<uint8_t, 16> digest;
+ md5.checksum(digest);
+ char* buf = 0;
+ CString actual = CString::newUninitialized(32, buf);
+ for (size_t i = 0; i < 16; i++) {
+ snprintf(buf, 3, "%02x", digest.at(i));
+ buf += 2;
+ }
+ ASSERT_WITH_MESSAGE(actual == expected, "input:%s[%lu] actual:%s expected:%s", input.data(), static_cast<unsigned long>(input.length()), actual.data(), expected.data());
+}
+
+static void testMD5()
+{
+ if (isTestMD5Done)
+ return;
+ isTestMD5Done = true;
+
+ // MD5 Test suite from http://www.ietf.org/rfc/rfc1321.txt
+ expectMD5("", "d41d8cd98f00b204e9800998ecf8427e");
+ expectMD5("a", "0cc175b9c0f1b6a831c399e269772661");
+ expectMD5("abc", "900150983cd24fb0d6963f7d28e17f72");
+ expectMD5("message digest", "f96b697d7cb7938d525a2f31aaf161d0");
+ expectMD5("abcdefghijklmnopqrstuvwxyz", "c3fcd3d76192e4007dfb496cca67e13b");
+ expectMD5("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", "d174ab98d277d9f5a5611c2c9f419d9f");
+ expectMD5("12345678901234567890123456789012345678901234567890123456789012345678901234567890", "57edf4a22be3c955ac49da2e2107b67a");
+}
+#endif
+
+// Note: this code is harmless on little-endian machines.
+
+static void reverseBytes(uint8_t* buf, unsigned longs)
+{
+ ASSERT(longs > 0);
+ do {
+ uint32_t t = static_cast<uint32_t>(buf[3] << 8 | buf[2]) << 16 | buf[1] << 8 | buf[0];
+ ASSERT_WITH_MESSAGE(!(reinterpret_cast<uintptr_t>(buf) % sizeof(t)), "alignment error of buf");
+ *reinterpret_cast_ptr<uint32_t *>(buf) = t;
+ buf += 4;
+ } while (--longs);
+}
+
+// The four core functions.
+// F1 is originally defined as (x & y | ~x & z), but optimized somewhat: 4 bit ops -> 3 bit ops.
+#define F1(x, y, z) (z ^ (x & (y ^ z)))
+#define F2(x, y, z) F1(z, x, y)
+#define F3(x, y, z) (x ^ y ^ z)
+#define F4(x, y, z) (y ^ (x | ~z))
+
+// This is the central step in the MD5 algorithm.
+#define MD5STEP(f, w, x, y, z, data, s) \
+ (w += f(x, y, z) + data, w = w << s | w >> (32 - s), w += x)
+
+static void MD5Transform(uint32_t buf[4], const uint32_t in[16])
+{
+ uint32_t a = buf[0];
+ uint32_t b = buf[1];
+ uint32_t c = buf[2];
+ uint32_t d = buf[3];
+
+ MD5STEP(F1, a, b, c, d, in[ 0]+0xd76aa478, 7);
+ MD5STEP(F1, d, a, b, c, in[ 1]+0xe8c7b756, 12);
+ MD5STEP(F1, c, d, a, b, in[ 2]+0x242070db, 17);
+ MD5STEP(F1, b, c, d, a, in[ 3]+0xc1bdceee, 22);
+ MD5STEP(F1, a, b, c, d, in[ 4]+0xf57c0faf, 7);
+ MD5STEP(F1, d, a, b, c, in[ 5]+0x4787c62a, 12);
+ MD5STEP(F1, c, d, a, b, in[ 6]+0xa8304613, 17);
+ MD5STEP(F1, b, c, d, a, in[ 7]+0xfd469501, 22);
+ MD5STEP(F1, a, b, c, d, in[ 8]+0x698098d8, 7);
+ MD5STEP(F1, d, a, b, c, in[ 9]+0x8b44f7af, 12);
+ MD5STEP(F1, c, d, a, b, in[10]+0xffff5bb1, 17);
+ MD5STEP(F1, b, c, d, a, in[11]+0x895cd7be, 22);
+ MD5STEP(F1, a, b, c, d, in[12]+0x6b901122, 7);
+ MD5STEP(F1, d, a, b, c, in[13]+0xfd987193, 12);
+ MD5STEP(F1, c, d, a, b, in[14]+0xa679438e, 17);
+ MD5STEP(F1, b, c, d, a, in[15]+0x49b40821, 22);
+
+ MD5STEP(F2, a, b, c, d, in[ 1]+0xf61e2562, 5);
+ MD5STEP(F2, d, a, b, c, in[ 6]+0xc040b340, 9);
+ MD5STEP(F2, c, d, a, b, in[11]+0x265e5a51, 14);
+ MD5STEP(F2, b, c, d, a, in[ 0]+0xe9b6c7aa, 20);
+ MD5STEP(F2, a, b, c, d, in[ 5]+0xd62f105d, 5);
+ MD5STEP(F2, d, a, b, c, in[10]+0x02441453, 9);
+ MD5STEP(F2, c, d, a, b, in[15]+0xd8a1e681, 14);
+ MD5STEP(F2, b, c, d, a, in[ 4]+0xe7d3fbc8, 20);
+ MD5STEP(F2, a, b, c, d, in[ 9]+0x21e1cde6, 5);
+ MD5STEP(F2, d, a, b, c, in[14]+0xc33707d6, 9);
+ MD5STEP(F2, c, d, a, b, in[ 3]+0xf4d50d87, 14);
+ MD5STEP(F2, b, c, d, a, in[ 8]+0x455a14ed, 20);
+ MD5STEP(F2, a, b, c, d, in[13]+0xa9e3e905, 5);
+ MD5STEP(F2, d, a, b, c, in[ 2]+0xfcefa3f8, 9);
+ MD5STEP(F2, c, d, a, b, in[ 7]+0x676f02d9, 14);
+ MD5STEP(F2, b, c, d, a, in[12]+0x8d2a4c8a, 20);
+
+ MD5STEP(F3, a, b, c, d, in[ 5]+0xfffa3942, 4);
+ MD5STEP(F3, d, a, b, c, in[ 8]+0x8771f681, 11);
+ MD5STEP(F3, c, d, a, b, in[11]+0x6d9d6122, 16);
+ MD5STEP(F3, b, c, d, a, in[14]+0xfde5380c, 23);
+ MD5STEP(F3, a, b, c, d, in[ 1]+0xa4beea44, 4);
+ MD5STEP(F3, d, a, b, c, in[ 4]+0x4bdecfa9, 11);
+ MD5STEP(F3, c, d, a, b, in[ 7]+0xf6bb4b60, 16);
+ MD5STEP(F3, b, c, d, a, in[10]+0xbebfbc70, 23);
+ MD5STEP(F3, a, b, c, d, in[13]+0x289b7ec6, 4);
+ MD5STEP(F3, d, a, b, c, in[ 0]+0xeaa127fa, 11);
+ MD5STEP(F3, c, d, a, b, in[ 3]+0xd4ef3085, 16);
+ MD5STEP(F3, b, c, d, a, in[ 6]+0x04881d05, 23);
+ MD5STEP(F3, a, b, c, d, in[ 9]+0xd9d4d039, 4);
+ MD5STEP(F3, d, a, b, c, in[12]+0xe6db99e5, 11);
+ MD5STEP(F3, c, d, a, b, in[15]+0x1fa27cf8, 16);
+ MD5STEP(F3, b, c, d, a, in[ 2]+0xc4ac5665, 23);
+
+ MD5STEP(F4, a, b, c, d, in[ 0]+0xf4292244, 6);
+ MD5STEP(F4, d, a, b, c, in[ 7]+0x432aff97, 10);
+ MD5STEP(F4, c, d, a, b, in[14]+0xab9423a7, 15);
+ MD5STEP(F4, b, c, d, a, in[ 5]+0xfc93a039, 21);
+ MD5STEP(F4, a, b, c, d, in[12]+0x655b59c3, 6);
+ MD5STEP(F4, d, a, b, c, in[ 3]+0x8f0ccc92, 10);
+ MD5STEP(F4, c, d, a, b, in[10]+0xffeff47d, 15);
+ MD5STEP(F4, b, c, d, a, in[ 1]+0x85845dd1, 21);
+ MD5STEP(F4, a, b, c, d, in[ 8]+0x6fa87e4f, 6);
+ MD5STEP(F4, d, a, b, c, in[15]+0xfe2ce6e0, 10);
+ MD5STEP(F4, c, d, a, b, in[ 6]+0xa3014314, 15);
+ MD5STEP(F4, b, c, d, a, in[13]+0x4e0811a1, 21);
+ MD5STEP(F4, a, b, c, d, in[ 4]+0xf7537e82, 6);
+ MD5STEP(F4, d, a, b, c, in[11]+0xbd3af235, 10);
+ MD5STEP(F4, c, d, a, b, in[ 2]+0x2ad7d2bb, 15);
+ MD5STEP(F4, b, c, d, a, in[ 9]+0xeb86d391, 21);
+
+ buf[0] += a;
+ buf[1] += b;
+ buf[2] += c;
+ buf[3] += d;
+}
+
+MD5::MD5()
+{
+ testMD5();
+ m_buf[0] = 0x67452301;
+ m_buf[1] = 0xefcdab89;
+ m_buf[2] = 0x98badcfe;
+ m_buf[3] = 0x10325476;
+ m_bits[0] = 0;
+ m_bits[1] = 0;
+ memset(m_in, 0, sizeof(m_in));
+ ASSERT_WITH_MESSAGE(!(reinterpret_cast<uintptr_t>(m_in) % sizeof(uint32_t)), "alignment error of m_in");
+}
+
+void MD5::addBytes(const uint8_t* input, size_t length)
+{
+ const uint8_t* buf = input;
+
+ // Update bitcount
+ uint32_t t = m_bits[0];
+ m_bits[0] = t + (length << 3);
+ if (m_bits[0] < t)
+ m_bits[1]++; // Carry from low to high
+ m_bits[1] += length >> 29;
+
+ t = (t >> 3) & 0x3f; // Bytes already in shsInfo->data
+
+ // Handle any leading odd-sized chunks
+
+ if (t) {
+ uint8_t* p = m_in + t;
+
+ t = 64 - t;
+ if (length < t) {
+ memcpy(p, buf, length);
+ return;
+ }
+ memcpy(p, buf, t);
+ reverseBytes(m_in, 16);
+ MD5Transform(m_buf, reinterpret_cast_ptr<uint32_t*>(m_in)); // m_in is 4-byte aligned.
+ buf += t;
+ length -= t;
+ }
+
+ // Process data in 64-byte chunks
+
+ while (length >= 64) {
+ memcpy(m_in, buf, 64);
+ reverseBytes(m_in, 16);
+ MD5Transform(m_buf, reinterpret_cast_ptr<uint32_t*>(m_in)); // m_in is 4-byte aligned.
+ buf += 64;
+ length -= 64;
+ }
+
+ // Handle any remaining bytes of data.
+ memcpy(m_in, buf, length);
+}
+
+void MD5::checksum(Vector<uint8_t, 16>& digest)
+{
+ // Compute number of bytes mod 64
+ unsigned count = (m_bits[0] >> 3) & 0x3F;
+
+ // Set the first char of padding to 0x80. This is safe since there is
+ // always at least one byte free
+ uint8_t* p = m_in + count;
+ *p++ = 0x80;
+
+ // Bytes of padding needed to make 64 bytes
+ count = 64 - 1 - count;
+
+ // Pad out to 56 mod 64
+ if (count < 8) {
+ // Two lots of padding: Pad the first block to 64 bytes
+ memset(p, 0, count);
+ reverseBytes(m_in, 16);
+ MD5Transform(m_buf, reinterpret_cast_ptr<uint32_t *>(m_in)); // m_in is 4-byte aligned.
+
+ // Now fill the next block with 56 bytes
+ memset(m_in, 0, 56);
+ } else {
+ // Pad block to 56 bytes
+ memset(p, 0, count - 8);
+ }
+ reverseBytes(m_in, 14);
+
+ // Append length in bits and transform
+ // m_in is 4-byte aligned.
+ (reinterpret_cast_ptr<uint32_t*>(m_in))[14] = m_bits[0];
+ (reinterpret_cast_ptr<uint32_t*>(m_in))[15] = m_bits[1];
+
+ MD5Transform(m_buf, reinterpret_cast_ptr<uint32_t*>(m_in));
+ reverseBytes(reinterpret_cast<uint8_t*>(m_buf), 4);
+
+ // Now, m_buf contains checksum result.
+ if (!digest.isEmpty())
+ digest.clear();
+ digest.append(reinterpret_cast<uint8_t*>(m_buf), 16);
+
+ // In case it's sensitive
+ memset(m_buf, 0, sizeof(m_buf));
+ memset(m_bits, 0, sizeof(m_bits));
+ memset(m_in, 0, sizeof(m_in));
+}
+
+} // namespace WTF
diff --git a/Source/JavaScriptCore/wtf/MD5.h b/Source/JavaScriptCore/wtf/MD5.h
new file mode 100644
index 0000000..3caa810
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/MD5.h
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WTF_MD5_h
+#define WTF_MD5_h
+
+#include <wtf/Vector.h>
+
+namespace WTF {
+
+class MD5 {
+public:
+ MD5();
+
+ void addBytes(const Vector<uint8_t>& input)
+ {
+ addBytes(input.data(), input.size());
+ }
+ void addBytes(const uint8_t* input, size_t length);
+
+ // checksum has a side effect of resetting the state of the object.
+ void checksum(Vector<uint8_t, 16>&);
+
+private:
+ uint32_t m_buf[4];
+ uint32_t m_bits[2];
+ uint8_t m_in[64];
+};
+
+} // namespace WTF
+
+using WTF::MD5;
+
+#endif // WTF_MD5_h
diff --git a/Source/JavaScriptCore/wtf/MainThread.cpp b/Source/JavaScriptCore/wtf/MainThread.cpp
new file mode 100644
index 0000000..a5f2346
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/MainThread.cpp
@@ -0,0 +1,239 @@
+/*
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "MainThread.h"
+
+#include "CurrentTime.h"
+#include "Deque.h"
+#include "StdLibExtras.h"
+#include "Threading.h"
+
+#if PLATFORM(CHROMIUM)
+#error Chromium uses a different main thread implementation
+#endif
+
+namespace WTF {
+
+struct FunctionWithContext {
+ MainThreadFunction* function;
+ void* context;
+ ThreadCondition* syncFlag;
+
+ FunctionWithContext(MainThreadFunction* function = 0, void* context = 0, ThreadCondition* syncFlag = 0)
+ : function(function)
+ , context(context)
+ , syncFlag(syncFlag)
+ {
+ }
+ bool operator == (const FunctionWithContext& o)
+ {
+ return function == o.function
+ && context == o.context
+ && syncFlag == o.syncFlag;
+ }
+};
+
+class FunctionWithContextFinder {
+public:
+ FunctionWithContextFinder(const FunctionWithContext& m) : m(m) {}
+ bool operator() (FunctionWithContext& o) { return o == m; }
+ FunctionWithContext m;
+};
+
+
+typedef Deque<FunctionWithContext> FunctionQueue;
+
+static bool callbacksPaused; // This global variable is only accessed from main thread.
+#if !PLATFORM(MAC) && !PLATFORM(QT)
+static ThreadIdentifier mainThreadIdentifier;
+#endif
+
+static Mutex& mainThreadFunctionQueueMutex()
+{
+ DEFINE_STATIC_LOCAL(Mutex, staticMutex, ());
+ return staticMutex;
+}
+
+static FunctionQueue& functionQueue()
+{
+ DEFINE_STATIC_LOCAL(FunctionQueue, staticFunctionQueue, ());
+ return staticFunctionQueue;
+}
+
+
+#if !PLATFORM(MAC)
+
+void initializeMainThread()
+{
+ static bool initializedMainThread;
+ if (initializedMainThread)
+ return;
+ initializedMainThread = true;
+
+#if !PLATFORM(QT)
+ mainThreadIdentifier = currentThread();
+#endif
+
+ mainThreadFunctionQueueMutex();
+ initializeMainThreadPlatform();
+}
+
+#else
+
+static pthread_once_t initializeMainThreadKeyOnce = PTHREAD_ONCE_INIT;
+
+static void initializeMainThreadOnce()
+{
+ mainThreadFunctionQueueMutex();
+ initializeMainThreadPlatform();
+}
+
+void initializeMainThread()
+{
+ pthread_once(&initializeMainThreadKeyOnce, initializeMainThreadOnce);
+}
+
+static void initializeMainThreadToProcessMainThreadOnce()
+{
+ mainThreadFunctionQueueMutex();
+ initializeMainThreadToProcessMainThreadPlatform();
+}
+
+void initializeMainThreadToProcessMainThread()
+{
+ pthread_once(&initializeMainThreadKeyOnce, initializeMainThreadToProcessMainThreadOnce);
+}
+#endif
+
+// 0.1 sec delays in UI is approximate threshold when they become noticeable. Have a limit that's half of that.
+static const double maxRunLoopSuspensionTime = 0.05;
+
+void dispatchFunctionsFromMainThread()
+{
+ ASSERT(isMainThread());
+
+ if (callbacksPaused)
+ return;
+
+ double startTime = currentTime();
+
+ FunctionWithContext invocation;
+ while (true) {
+ {
+ MutexLocker locker(mainThreadFunctionQueueMutex());
+ if (!functionQueue().size())
+ break;
+ invocation = functionQueue().takeFirst();
+ }
+
+ invocation.function(invocation.context);
+ if (invocation.syncFlag)
+ invocation.syncFlag->signal();
+
+ // If we are running accumulated functions for too long so UI may become unresponsive, we need to
+ // yield so the user input can be processed. Otherwise user may not be able to even close the window.
+ // This code has effect only in case the scheduleDispatchFunctionsOnMainThread() is implemented in a way that
+ // allows input events to be processed before we are back here.
+ if (currentTime() - startTime > maxRunLoopSuspensionTime) {
+ scheduleDispatchFunctionsOnMainThread();
+ break;
+ }
+ }
+}
+
+void callOnMainThread(MainThreadFunction* function, void* context)
+{
+ ASSERT(function);
+ bool needToSchedule = false;
+ {
+ MutexLocker locker(mainThreadFunctionQueueMutex());
+ needToSchedule = functionQueue().size() == 0;
+ functionQueue().append(FunctionWithContext(function, context));
+ }
+ if (needToSchedule)
+ scheduleDispatchFunctionsOnMainThread();
+}
+
+void callOnMainThreadAndWait(MainThreadFunction* function, void* context)
+{
+ ASSERT(function);
+
+ if (isMainThread()) {
+ function(context);
+ return;
+ }
+
+ ThreadCondition syncFlag;
+ Mutex& functionQueueMutex = mainThreadFunctionQueueMutex();
+ MutexLocker locker(functionQueueMutex);
+ functionQueue().append(FunctionWithContext(function, context, &syncFlag));
+ if (functionQueue().size() == 1)
+ scheduleDispatchFunctionsOnMainThread();
+ syncFlag.wait(functionQueueMutex);
+}
+
+void cancelCallOnMainThread(MainThreadFunction* function, void* context)
+{
+ ASSERT(function);
+
+ MutexLocker locker(mainThreadFunctionQueueMutex());
+
+ FunctionWithContextFinder pred(FunctionWithContext(function, context));
+
+ while (true) {
+ // We must redefine 'i' each pass, because the itererator's operator=
+ // requires 'this' to be valid, and remove() invalidates all iterators
+ FunctionQueue::iterator i(functionQueue().findIf(pred));
+ if (i == functionQueue().end())
+ break;
+ functionQueue().remove(i);
+ }
+}
+
+void setMainThreadCallbacksPaused(bool paused)
+{
+ ASSERT(isMainThread());
+
+ if (callbacksPaused == paused)
+ return;
+
+ callbacksPaused = paused;
+
+ if (!callbacksPaused)
+ scheduleDispatchFunctionsOnMainThread();
+}
+
+#if !PLATFORM(MAC) && !PLATFORM(QT) && !PLATFORM(BREWMP)
+bool isMainThread()
+{
+ return currentThread() == mainThreadIdentifier;
+}
+#endif
+
+} // namespace WTF
diff --git a/Source/JavaScriptCore/wtf/MainThread.h b/Source/JavaScriptCore/wtf/MainThread.h
new file mode 100644
index 0000000..7703f3e
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/MainThread.h
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2007, 2008, 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2007 Justin Haygood (jhaygood@reaktix.com)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef MainThread_h
+#define MainThread_h
+
+#include <stdint.h>
+
+namespace WTF {
+
+typedef uint32_t ThreadIdentifier;
+typedef void MainThreadFunction(void*);
+
+// Must be called from the main thread.
+void initializeMainThread();
+
+void callOnMainThread(MainThreadFunction*, void* context);
+void callOnMainThreadAndWait(MainThreadFunction*, void* context);
+void cancelCallOnMainThread(MainThreadFunction*, void* context);
+
+void setMainThreadCallbacksPaused(bool paused);
+
+bool isMainThread();
+
+// NOTE: these functions are internal to the callOnMainThread implementation.
+void initializeMainThreadPlatform();
+void scheduleDispatchFunctionsOnMainThread();
+void dispatchFunctionsFromMainThread();
+
+#if PLATFORM(MAC)
+// This version of initializeMainThread sets up the main thread as corresponding
+// to the process's main thread, and not necessarily the thread that calls this
+// function. It should only be used as a legacy aid for Mac WebKit.
+void initializeMainThreadToProcessMainThread();
+void initializeMainThreadToProcessMainThreadPlatform();
+#endif
+
+} // namespace WTF
+
+using WTF::callOnMainThread;
+using WTF::callOnMainThreadAndWait;
+using WTF::cancelCallOnMainThread;
+using WTF::setMainThreadCallbacksPaused;
+using WTF::isMainThread;
+#endif // MainThread_h
diff --git a/Source/JavaScriptCore/wtf/MallocZoneSupport.h b/Source/JavaScriptCore/wtf/MallocZoneSupport.h
new file mode 100644
index 0000000..62df145
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/MallocZoneSupport.h
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef MallocZoneSupport_h
+#define MallocZoneSupport_h
+
+#include <malloc/malloc.h>
+
+namespace WTF {
+
+class RemoteMemoryReader {
+ task_t m_task;
+ memory_reader_t* m_reader;
+
+public:
+ RemoteMemoryReader(task_t task, memory_reader_t* reader)
+ : m_task(task)
+ , m_reader(reader)
+ { }
+
+ void* operator()(vm_address_t address, size_t size) const
+ {
+ void* output;
+ kern_return_t err = (*m_reader)(m_task, address, size, static_cast<void**>(&output));
+ ASSERT(!err);
+ if (err)
+ output = 0;
+ return output;
+ }
+
+ template <typename T>
+ T* operator()(T* address, size_t size=sizeof(T)) const
+ {
+ return static_cast<T*>((*this)(reinterpret_cast<vm_address_t>(address), size));
+ }
+};
+
+} // namespace WTF
+
+#endif // MallocZoneSupport_h
diff --git a/Source/JavaScriptCore/wtf/MathExtras.h b/Source/JavaScriptCore/wtf/MathExtras.h
new file mode 100644
index 0000000..095549e
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/MathExtras.h
@@ -0,0 +1,215 @@
+/*
+ * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WTF_MathExtras_h
+#define WTF_MathExtras_h
+
+#include <cmath>
+#include <float.h>
+#include <stdlib.h>
+
+#if OS(SOLARIS)
+#include <ieeefp.h>
+#endif
+
+#if OS(OPENBSD)
+#include <sys/types.h>
+#include <machine/ieee.h>
+#endif
+
+#if COMPILER(MSVC)
+#if OS(WINCE)
+#include <stdlib.h>
+#endif
+#include <limits>
+#endif
+
+#ifndef M_PI
+const double piDouble = 3.14159265358979323846;
+const float piFloat = 3.14159265358979323846f;
+#else
+const double piDouble = M_PI;
+const float piFloat = static_cast<float>(M_PI);
+#endif
+
+#ifndef M_PI_2
+const double piOverTwoDouble = 1.57079632679489661923;
+const float piOverTwoFloat = 1.57079632679489661923f;
+#else
+const double piOverTwoDouble = M_PI_2;
+const float piOverTwoFloat = static_cast<float>(M_PI_2);
+#endif
+
+#ifndef M_PI_4
+const double piOverFourDouble = 0.785398163397448309616;
+const float piOverFourFloat = 0.785398163397448309616f;
+#else
+const double piOverFourDouble = M_PI_4;
+const float piOverFourFloat = static_cast<float>(M_PI_4);
+#endif
+
+#if OS(DARWIN)
+
+// Work around a bug in the Mac OS X libc where ceil(-0.1) return +0.
+inline double wtf_ceil(double x) { return copysign(ceil(x), x); }
+
+#define ceil(x) wtf_ceil(x)
+
+#endif
+
+#if OS(SOLARIS)
+
+#ifndef isfinite
+inline bool isfinite(double x) { return finite(x) && !isnand(x); }
+#endif
+#ifndef isinf
+inline bool isinf(double x) { return !finite(x) && !isnand(x); }
+#endif
+#ifndef signbit
+inline bool signbit(double x) { return x < 0.0; } // FIXME: Wrong for negative 0.
+#endif
+
+#endif
+
+#if OS(OPENBSD)
+
+#ifndef isfinite
+inline bool isfinite(double x) { return finite(x); }
+#endif
+#ifndef signbit
+inline bool signbit(double x) { struct ieee_double *p = (struct ieee_double *)&x; return p->dbl_sign; }
+#endif
+
+#endif
+
+#if COMPILER(MSVC) || COMPILER(RVCT)
+
+// We must not do 'num + 0.5' or 'num - 0.5' because they can cause precision loss.
+static double round(double num)
+{
+ double integer = ceil(num);
+ if (num > 0)
+ return integer - num > 0.5 ? integer - 1.0 : integer;
+ return integer - num >= 0.5 ? integer - 1.0 : integer;
+}
+static float roundf(float num)
+{
+ float integer = ceilf(num);
+ if (num > 0)
+ return integer - num > 0.5f ? integer - 1.0f : integer;
+ return integer - num >= 0.5f ? integer - 1.0f : integer;
+}
+inline long long llround(double num) { return static_cast<long long>(round(num)); }
+inline long long llroundf(float num) { return static_cast<long long>(roundf(num)); }
+inline long lround(double num) { return static_cast<long>(round(num)); }
+inline long lroundf(float num) { return static_cast<long>(roundf(num)); }
+inline double trunc(double num) { return num > 0 ? floor(num) : ceil(num); }
+
+#endif
+
+#if COMPILER(MSVC)
+// The 64bit version of abs() is already defined in stdlib.h which comes with VC10
+#if COMPILER(MSVC9_OR_LOWER)
+inline long long abs(long long num) { return _abs64(num); }
+#endif
+
+inline bool isinf(double num) { return !_finite(num) && !_isnan(num); }
+inline bool isnan(double num) { return !!_isnan(num); }
+inline bool signbit(double num) { return _copysign(1.0, num) < 0; }
+
+inline double nextafter(double x, double y) { return _nextafter(x, y); }
+inline float nextafterf(float x, float y) { return x > y ? x - FLT_EPSILON : x + FLT_EPSILON; }
+
+inline double copysign(double x, double y) { return _copysign(x, y); }
+inline int isfinite(double x) { return _finite(x); }
+
+// MSVC's math.h does not currently supply log2.
+inline double log2(double num)
+{
+ // This constant is roughly M_LN2, which is not provided by default on Windows.
+ return log(num) / 0.693147180559945309417232121458176568;
+}
+
+// Work around a bug in Win, where atan2(+-infinity, +-infinity) yields NaN instead of specific values.
+inline double wtf_atan2(double x, double y)
+{
+ double posInf = std::numeric_limits<double>::infinity();
+ double negInf = -std::numeric_limits<double>::infinity();
+ double nan = std::numeric_limits<double>::quiet_NaN();
+
+ double result = nan;
+
+ if (x == posInf && y == posInf)
+ result = piOverFourDouble;
+ else if (x == posInf && y == negInf)
+ result = 3 * piOverFourDouble;
+ else if (x == negInf && y == posInf)
+ result = -piOverFourDouble;
+ else if (x == negInf && y == negInf)
+ result = -3 * piOverFourDouble;
+ else
+ result = ::atan2(x, y);
+
+ return result;
+}
+
+// Work around a bug in the Microsoft CRT, where fmod(x, +-infinity) yields NaN instead of x.
+inline double wtf_fmod(double x, double y) { return (!isinf(x) && isinf(y)) ? x : fmod(x, y); }
+
+// Work around a bug in the Microsoft CRT, where pow(NaN, 0) yields NaN instead of 1.
+inline double wtf_pow(double x, double y) { return y == 0 ? 1 : pow(x, y); }
+
+#define atan2(x, y) wtf_atan2(x, y)
+#define fmod(x, y) wtf_fmod(x, y)
+#define pow(x, y) wtf_pow(x, y)
+
+#endif // COMPILER(MSVC)
+
+inline double deg2rad(double d) { return d * piDouble / 180.0; }
+inline double rad2deg(double r) { return r * 180.0 / piDouble; }
+inline double deg2grad(double d) { return d * 400.0 / 360.0; }
+inline double grad2deg(double g) { return g * 360.0 / 400.0; }
+inline double turn2deg(double t) { return t * 360.0; }
+inline double deg2turn(double d) { return d / 360.0; }
+inline double rad2grad(double r) { return r * 200.0 / piDouble; }
+inline double grad2rad(double g) { return g * piDouble / 200.0; }
+
+inline float deg2rad(float d) { return d * piFloat / 180.0f; }
+inline float rad2deg(float r) { return r * 180.0f / piFloat; }
+inline float deg2grad(float d) { return d * 400.0f / 360.0f; }
+inline float grad2deg(float g) { return g * 360.0f / 400.0f; }
+inline float turn2deg(float t) { return t * 360.0f; }
+inline float deg2turn(float d) { return d / 360.0f; }
+inline float rad2grad(float r) { return r * 200.0f / piFloat; }
+inline float grad2rad(float g) { return g * piFloat / 200.0f; }
+
+#if !COMPILER(MSVC) && !COMPILER(WINSCW) && !(COMPILER(RVCT) && (OS(SYMBIAN) || PLATFORM(BREWMP)))
+using std::isfinite;
+using std::isinf;
+using std::isnan;
+using std::signbit;
+#endif
+
+#endif // #ifndef WTF_MathExtras_h
diff --git a/Source/JavaScriptCore/wtf/MessageQueue.h b/Source/JavaScriptCore/wtf/MessageQueue.h
new file mode 100644
index 0000000..14100c9
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/MessageQueue.h
@@ -0,0 +1,218 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef MessageQueue_h
+#define MessageQueue_h
+
+#include <limits>
+#include <wtf/Assertions.h>
+#include <wtf/Deque.h>
+#include <wtf/Noncopyable.h>
+#include <wtf/Threading.h>
+
+namespace WTF {
+
+ enum MessageQueueWaitResult {
+ MessageQueueTerminated, // Queue was destroyed while waiting for message.
+ MessageQueueTimeout, // Timeout was specified and it expired.
+ MessageQueueMessageReceived, // A message was successfully received and returned.
+ };
+
+ // The queue takes ownership of messages and transfer it to the new owner
+ // when messages are fetched from the queue.
+ // Essentially, MessageQueue acts as a queue of OwnPtr<DataType>.
+ template<typename DataType>
+ class MessageQueue : public Noncopyable {
+ public:
+ MessageQueue() : m_killed(false) { }
+ ~MessageQueue();
+
+ void append(PassOwnPtr<DataType>);
+ bool appendAndCheckEmpty(PassOwnPtr<DataType>);
+ void prepend(PassOwnPtr<DataType>);
+
+ PassOwnPtr<DataType> waitForMessage();
+ PassOwnPtr<DataType> tryGetMessage();
+ template<typename Predicate>
+ PassOwnPtr<DataType> waitForMessageFilteredWithTimeout(MessageQueueWaitResult&, Predicate&, double absoluteTime);
+
+ template<typename Predicate>
+ void removeIf(Predicate&);
+
+ void kill();
+ bool killed() const;
+
+ // The result of isEmpty() is only valid if no other thread is manipulating the queue at the same time.
+ bool isEmpty();
+
+ static double infiniteTime() { return std::numeric_limits<double>::max(); }
+
+ private:
+ static bool alwaysTruePredicate(DataType*) { return true; }
+
+ mutable Mutex m_mutex;
+ ThreadCondition m_condition;
+ Deque<DataType*> m_queue;
+ bool m_killed;
+ };
+
+ template<typename DataType>
+ MessageQueue<DataType>::~MessageQueue()
+ {
+ deleteAllValues(m_queue);
+ }
+
+ template<typename DataType>
+ inline void MessageQueue<DataType>::append(PassOwnPtr<DataType> message)
+ {
+ MutexLocker lock(m_mutex);
+ m_queue.append(message.leakPtr());
+ m_condition.signal();
+ }
+
+ // Returns true if the queue was empty before the item was added.
+ template<typename DataType>
+ inline bool MessageQueue<DataType>::appendAndCheckEmpty(PassOwnPtr<DataType> message)
+ {
+ MutexLocker lock(m_mutex);
+ bool wasEmpty = m_queue.isEmpty();
+ m_queue.append(message.leakPtr());
+ m_condition.signal();
+ return wasEmpty;
+ }
+
+ template<typename DataType>
+ inline void MessageQueue<DataType>::prepend(PassOwnPtr<DataType> message)
+ {
+ MutexLocker lock(m_mutex);
+ m_queue.prepend(message.leakPtr());
+ m_condition.signal();
+ }
+
+ template<typename DataType>
+ inline PassOwnPtr<DataType> MessageQueue<DataType>::waitForMessage()
+ {
+ MessageQueueWaitResult exitReason;
+ PassOwnPtr<DataType> result = waitForMessageFilteredWithTimeout(exitReason, MessageQueue<DataType>::alwaysTruePredicate, infiniteTime());
+ ASSERT(exitReason == MessageQueueTerminated || exitReason == MessageQueueMessageReceived);
+ return result;
+ }
+
+ template<typename DataType>
+ template<typename Predicate>
+ inline PassOwnPtr<DataType> MessageQueue<DataType>::waitForMessageFilteredWithTimeout(MessageQueueWaitResult& result, Predicate& predicate, double absoluteTime)
+ {
+ MutexLocker lock(m_mutex);
+ bool timedOut = false;
+
+ DequeConstIterator<DataType*> found = m_queue.end();
+ while (!m_killed && !timedOut && (found = m_queue.findIf(predicate)) == m_queue.end())
+ timedOut = !m_condition.timedWait(m_mutex, absoluteTime);
+
+ ASSERT(!timedOut || absoluteTime != infiniteTime());
+
+ if (m_killed) {
+ result = MessageQueueTerminated;
+ return 0;
+ }
+
+ if (timedOut) {
+ result = MessageQueueTimeout;
+ return 0;
+ }
+
+ ASSERT(found != m_queue.end());
+ DataType* message = *found;
+ m_queue.remove(found);
+ result = MessageQueueMessageReceived;
+ return message;
+ }
+
+ template<typename DataType>
+ inline PassOwnPtr<DataType> MessageQueue<DataType>::tryGetMessage()
+ {
+ MutexLocker lock(m_mutex);
+ if (m_killed)
+ return 0;
+ if (m_queue.isEmpty())
+ return 0;
+
+ return m_queue.takeFirst();
+ }
+
+ template<typename DataType>
+ template<typename Predicate>
+ inline void MessageQueue<DataType>::removeIf(Predicate& predicate)
+ {
+ MutexLocker lock(m_mutex);
+ // See bug 31657 for why this loop looks so weird
+ while (true) {
+ DequeConstIterator<DataType*> found = m_queue.findIf(predicate);
+ if (found == m_queue.end())
+ break;
+
+ DataType* message = *found;
+ m_queue.remove(found);
+ delete message;
+ }
+ }
+
+ template<typename DataType>
+ inline bool MessageQueue<DataType>::isEmpty()
+ {
+ MutexLocker lock(m_mutex);
+ if (m_killed)
+ return true;
+ return m_queue.isEmpty();
+ }
+
+ template<typename DataType>
+ inline void MessageQueue<DataType>::kill()
+ {
+ MutexLocker lock(m_mutex);
+ m_killed = true;
+ m_condition.broadcast();
+ }
+
+ template<typename DataType>
+ inline bool MessageQueue<DataType>::killed() const
+ {
+ MutexLocker lock(m_mutex);
+ return m_killed;
+ }
+} // namespace WTF
+
+using WTF::MessageQueue;
+// MessageQueueWaitResult enum and all its values.
+using WTF::MessageQueueWaitResult;
+using WTF::MessageQueueTerminated;
+using WTF::MessageQueueTimeout;
+using WTF::MessageQueueMessageReceived;
+
+#endif // MessageQueue_h
diff --git a/Source/JavaScriptCore/wtf/NonCopyingSort.h b/Source/JavaScriptCore/wtf/NonCopyingSort.h
new file mode 100644
index 0000000..fd611bd
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/NonCopyingSort.h
@@ -0,0 +1,89 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef WTF_NonCopyingSort_h
+#define WTF_NonCopyingSort_h
+
+namespace WTF {
+
+using std::swap;
+
+template<typename RandomAccessIterator, typename Predicate>
+inline void siftDown(RandomAccessIterator array, ptrdiff_t start, ptrdiff_t end, Predicate compareLess)
+{
+ ptrdiff_t root = start;
+
+ while (root * 2 + 1 <= end) {
+ ptrdiff_t child = root * 2 + 1;
+ if (child < end && compareLess(array[child], array[child + 1]))
+ child++;
+
+ if (compareLess(array[root], array[child])) {
+ swap(array[root], array[child]);
+ root = child;
+ } else
+ return;
+ }
+}
+
+template<typename RandomAccessIterator, typename Predicate>
+inline void heapify(RandomAccessIterator array, ptrdiff_t count, Predicate compareLess)
+{
+ ptrdiff_t start = (count - 2) / 2;
+
+ while (start >= 0) {
+ siftDown(array, start, count - 1, compareLess);
+ start--;
+ }
+}
+
+template<typename RandomAccessIterator, typename Predicate>
+void heapSort(RandomAccessIterator start, RandomAccessIterator end, Predicate compareLess)
+{
+ ptrdiff_t count = end - start;
+ heapify(start, count, compareLess);
+
+ ptrdiff_t endIndex = count - 1;
+ while (endIndex > 0) {
+ swap(start[endIndex], start[0]);
+ siftDown(start, 0, endIndex - 1, compareLess);
+ endIndex--;
+ }
+}
+
+template<typename RandomAccessIterator, typename Predicate>
+inline void nonCopyingSort(RandomAccessIterator start, RandomAccessIterator end, Predicate compareLess)
+{
+ // heapsort happens to use only swaps, not copies, but the essential thing about
+ // this function is the fact that it does not copy, not the specific algorithm
+ heapSort(start, end, compareLess);
+}
+
+} // namespace WTF
+
+using WTF::nonCopyingSort;
+
+#endif // WTF_NonCopyingSort_h
diff --git a/Source/JavaScriptCore/wtf/Noncopyable.h b/Source/JavaScriptCore/wtf/Noncopyable.h
new file mode 100644
index 0000000..285ed2e
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/Noncopyable.h
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2006, 2010 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef WTF_Noncopyable_h
+#define WTF_Noncopyable_h
+
+#ifndef __has_feature
+ #define __has_feature(x) 0
+#endif
+
+#if __has_feature(cxx_deleted_functions)
+ #define WTF_MAKE_NONCOPYABLE(ClassName) \
+ _Pragma("clang diagnostic push") \
+ _Pragma("clang diagnostic ignored \"-Wunknown-pragmas\"") \
+ _Pragma("clang diagnostic ignored \"-Wc++0x-extensions\"") \
+ private: \
+ ClassName(const ClassName&) = delete; \
+ ClassName& operator=(const ClassName&) = delete; \
+ _Pragma("clang diagnostic pop")
+#else
+ #define WTF_MAKE_NONCOPYABLE(ClassName) \
+ private: \
+ ClassName(const ClassName&); \
+ ClassName& operator=(const ClassName&)
+#endif
+
+// We don't want argument-dependent lookup to pull in everything from the WTF
+// namespace when you use Noncopyable, so put it in its own namespace.
+
+#include "FastAllocBase.h"
+
+namespace WTFNoncopyable {
+
+ class Noncopyable : public FastAllocBase {
+ Noncopyable(const Noncopyable&);
+ Noncopyable& operator=(const Noncopyable&);
+ protected:
+ Noncopyable() { }
+ ~Noncopyable() { }
+ };
+
+} // namespace WTFNoncopyable
+
+using WTFNoncopyable::Noncopyable;
+
+#endif // WTF_Noncopyable_h
diff --git a/Source/JavaScriptCore/wtf/NotFound.h b/Source/JavaScriptCore/wtf/NotFound.h
new file mode 100644
index 0000000..4263bce
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/NotFound.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef NotFound_h
+#define NotFound_h
+
+namespace WTF {
+
+ const size_t notFound = static_cast<size_t>(-1);
+
+} // namespace WTF
+
+using WTF::notFound;
+
+#endif // NotFound_h
diff --git a/Source/JavaScriptCore/wtf/NullPtr.cpp b/Source/JavaScriptCore/wtf/NullPtr.cpp
new file mode 100644
index 0000000..c4228e3
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/NullPtr.cpp
@@ -0,0 +1,35 @@
+/*
+
+Copyright (C) 2010 Apple Inc. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+#include "NullPtr.h"
+
+#include "Platform.h"
+
+#if !HAVE(NULLPTR)
+
+std::nullptr_t nullptr;
+
+#endif
diff --git a/Source/JavaScriptCore/wtf/NullPtr.h b/Source/JavaScriptCore/wtf/NullPtr.h
new file mode 100644
index 0000000..08ece56
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/NullPtr.h
@@ -0,0 +1,52 @@
+/*
+
+Copyright (C) 2010 Apple Inc. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+#ifndef NullPtr_h
+#define NullPtr_h
+
+// For compilers and standard libraries that do not yet include it, this adds the
+// nullptr_t type and nullptr object. They are defined in the same namespaces they
+// would be in compiler and library that had the support.
+
+#ifndef __has_feature
+ #define __has_feature(feature) 0
+#endif
+
+#if __has_feature(cxx_nullptr) || (defined(_MSC_VER) && _MSC_VER >= 1600)
+
+#define HAVE_NULLPTR 1
+
+#else
+
+namespace std {
+ class nullptr_t { };
+}
+
+extern std::nullptr_t nullptr;
+
+#endif
+
+#endif
diff --git a/Source/JavaScriptCore/wtf/OSAllocator.h b/Source/JavaScriptCore/wtf/OSAllocator.h
new file mode 100644
index 0000000..577a6b8
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/OSAllocator.h
@@ -0,0 +1,100 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef OSAllocator_h
+#define OSAllocator_h
+
+#include <wtf/UnusedParam.h>
+#include <wtf/VMTags.h>
+#include <wtf/VMTags.h>
+
+namespace WTF {
+
+class OSAllocator {
+public:
+ enum Usage {
+ UnknownUsage = -1,
+ FastMallocPages = VM_TAG_FOR_TCMALLOC_MEMORY,
+ JSGCHeapPages = VM_TAG_FOR_COLLECTOR_MEMORY,
+ JSVMStackPages = VM_TAG_FOR_REGISTERFILE_MEMORY,
+ JSJITCodePages = VM_TAG_FOR_EXECUTABLEALLOCATOR_MEMORY,
+ };
+
+ // These methods are symmetric; reserveUncommitted allocates VM in an uncommitted state,
+ // releaseDecommitted should be called on a region of VM allocated by a single reservation,
+ // the memory must all currently be in a decommitted state.
+ static void* reserveUncommitted(size_t, Usage = UnknownUsage, bool writable = true, bool executable = false);
+ static void releaseDecommitted(void*, size_t);
+
+ // These methods are symmetric; they commit or decommit a region of VM (uncommitted VM should
+ // never be accessed, since the OS may not have attached physical memory for these regions).
+ // Clients should only call commit on uncommitted regions and decommit on committed regions.
+ static void commit(void*, size_t, bool writable, bool executable);
+ static void decommit(void*, size_t);
+
+ // These methods are symmetric; reserveAndCommit allocates VM in an committed state,
+ // decommitAndRelease should be called on a region of VM allocated by a single reservation,
+ // the memory must all currently be in a committed state.
+ static void* reserveAndCommit(size_t, Usage = UnknownUsage, bool writable = true, bool executable = false);
+ static void decommitAndRelease(void* base, size_t size);
+
+ // These methods are akin to reserveAndCommit/decommitAndRelease, above - however rather than
+ // committing/decommitting the entire region additional parameters allow a subregion to be
+ // specified.
+ static void* reserveAndCommit(size_t reserveSize, size_t commitSize, Usage = UnknownUsage, bool writable = true, bool executable = false);
+ static void decommitAndRelease(void* releaseBase, size_t releaseSize, void* decommitBase, size_t decommitSize);
+};
+
+inline void* OSAllocator::reserveAndCommit(size_t reserveSize, size_t commitSize, Usage usage, bool writable, bool executable)
+{
+ void* base = reserveUncommitted(reserveSize, usage, writable, executable);
+ commit(base, commitSize, writable, executable);
+ return base;
+}
+
+inline void OSAllocator::decommitAndRelease(void* releaseBase, size_t releaseSize, void* decommitBase, size_t decommitSize)
+{
+ ASSERT(decommitBase >= releaseBase && (static_cast<char*>(decommitBase) + decommitSize) <= (static_cast<char*>(releaseBase) + releaseSize));
+#if OS(WINCE)
+ // On most platforms we can actually skip this final decommit; releasing the VM will
+ // implicitly decommit any physical memory in the region. This is not true on WINCE.
+ decommit(decommitBase, decommitSize);
+#else
+ UNUSED_PARAM(decommitBase);
+ UNUSED_PARAM(decommitSize);
+#endif
+ releaseDecommitted(releaseBase, releaseSize);
+}
+
+inline void OSAllocator::decommitAndRelease(void* base, size_t size)
+{
+ decommitAndRelease(base, size, base, size);
+}
+
+} // namespace WTF
+
+using WTF::OSAllocator;
+
+#endif // OSAllocator_h
diff --git a/Source/JavaScriptCore/wtf/OSAllocatorPosix.cpp b/Source/JavaScriptCore/wtf/OSAllocatorPosix.cpp
new file mode 100644
index 0000000..5546cef
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/OSAllocatorPosix.cpp
@@ -0,0 +1,121 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "OSAllocator.h"
+
+#include <errno.h>
+#include <sys/mman.h>
+#include <wtf/Assertions.h>
+#include <wtf/UnusedParam.h>
+
+namespace WTF {
+
+void* OSAllocator::reserveUncommitted(size_t bytes, Usage usage, bool writable, bool executable)
+{
+ void* result = reserveAndCommit(bytes, usage, writable, executable);
+#if HAVE(MADV_FREE_REUSE)
+ // To support the "reserve then commit" model, we have to initially decommit.
+ while (madvise(result, bytes, MADV_FREE_REUSABLE) == -1 && errno == EAGAIN) { }
+#endif
+ return result;
+}
+
+void* OSAllocator::reserveAndCommit(size_t bytes, Usage usage, bool writable, bool executable)
+{
+ // All POSIX reservations start out logically committed.
+ int protection = PROT_READ;
+ if (writable)
+ protection |= PROT_WRITE;
+ if (executable)
+ protection |= PROT_EXEC;
+
+ int flags = MAP_PRIVATE | MAP_ANON;
+
+#if OS(DARWIN) && !defined(BUILDING_ON_TIGER)
+ int fd = usage;
+#else
+ int fd = -1;
+#endif
+
+ void* result = 0;
+#if (OS(DARWIN) && CPU(X86_64))
+ if (executable) {
+ // Cook up an address to allocate at, using the following recipe:
+ // 17 bits of zero, stay in userspace kids.
+ // 26 bits of randomness for ASLR.
+ // 21 bits of zero, at least stay aligned within one level of the pagetables.
+ //
+ // But! - as a temporary workaround for some plugin problems (rdar://problem/6812854),
+ // for now instead of 2^26 bits of ASLR lets stick with 25 bits of randomization plus
+ // 2^24, which should put up somewhere in the middle of userspace (in the address range
+ // 0x200000000000 .. 0x5fffffffffff).
+ intptr_t randomLocation = 0;
+ randomLocation = arc4random() & ((1 << 25) - 1);
+ randomLocation += (1 << 24);
+ randomLocation <<= 21;
+ result = reinterpret_cast<void*>(randomLocation);
+ }
+#endif
+
+ result = mmap(result, bytes, protection, flags, fd, 0);
+ if (result == MAP_FAILED)
+ CRASH();
+ return result;
+}
+
+void OSAllocator::commit(void* address, size_t bytes, bool, bool)
+{
+#if HAVE(MADV_FREE_REUSE)
+ while (madvise(address, bytes, MADV_FREE_REUSE) == -1 && errno == EAGAIN) { }
+#else
+ // Non-MADV_FREE_REUSE reservations automatically commit on demand.
+ UNUSED_PARAM(address);
+ UNUSED_PARAM(bytes);
+#endif
+}
+
+void OSAllocator::decommit(void* address, size_t bytes)
+{
+#if HAVE(MADV_FREE_REUSE)
+ while (madvise(address, bytes, MADV_FREE_REUSABLE) == -1 && errno == EAGAIN) { }
+#elif HAVE(MADV_FREE)
+ while (madvise(address, bytes, MADV_FREE) == -1 && errno == EAGAIN) { }
+#elif HAVE(MADV_DONTNEED)
+ while (madvise(address, bytes, MADV_DONTNEED) == -1 && errno == EAGAIN) { }
+#else
+ UNUSED_PARAM(address);
+ UNUSED_PARAM(bytes);
+#endif
+}
+
+void OSAllocator::releaseDecommitted(void* address, size_t bytes)
+{
+ int result = munmap(address, bytes);
+ if (result == -1)
+ CRASH();
+}
+
+} // namespace WTF
diff --git a/Source/JavaScriptCore/wtf/OSAllocatorSymbian.cpp b/Source/JavaScriptCore/wtf/OSAllocatorSymbian.cpp
new file mode 100644
index 0000000..e746fde
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/OSAllocatorSymbian.cpp
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "OSAllocator.h"
+
+#include <wtf/FastMalloc.h>
+
+namespace WTF {
+
+void* OSAllocator::reserveUncommitted(size_t bytes, Usage, bool, bool)
+{
+ return fastMalloc(bytes);
+}
+
+void* OSAllocator::reserveAndCommit(size_t bytes, Usage, bool, bool)
+{
+ return fastMalloc(bytes);
+}
+
+void OSAllocator::commit(void*, size_t, bool, bool)
+{
+}
+
+void OSAllocator::decommit(void*, size_t)
+{
+}
+
+void OSAllocator::releaseDecommitted(void* address, size_t)
+{
+ fastFree(address);
+}
+
+} // namespace WTF
diff --git a/Source/JavaScriptCore/wtf/OSAllocatorWin.cpp b/Source/JavaScriptCore/wtf/OSAllocatorWin.cpp
new file mode 100644
index 0000000..e7beb8a
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/OSAllocatorWin.cpp
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "OSAllocator.h"
+
+#include "windows.h"
+#include <wtf/Assertions.h>
+
+namespace WTF {
+
+static inline DWORD protection(bool writable, bool executable)
+{
+ return executable ?
+ (writable ? PAGE_EXECUTE_READWRITE : PAGE_EXECUTE_READ) :
+ (writable ? PAGE_READWRITE : PAGE_READONLY);
+}
+
+void* OSAllocator::reserveUncommitted(size_t bytes, Usage, bool writable, bool executable)
+{
+ void* result = VirtualAlloc(0, bytes, MEM_RESERVE, protection(writable, executable));
+ if (!result)
+ CRASH();
+ return result;
+}
+
+void* OSAllocator::reserveAndCommit(size_t bytes, Usage, bool writable, bool executable)
+{
+ void* result = VirtualAlloc(0, bytes, MEM_RESERVE | MEM_COMMIT, protection(writable, executable));
+ if (!result)
+ CRASH();
+ return result;
+}
+
+void OSAllocator::commit(void* address, size_t bytes, bool writable, bool executable)
+{
+ void* result = VirtualAlloc(address, bytes, MEM_COMMIT, protection(writable, executable));
+ if (!result)
+ CRASH();
+}
+
+void OSAllocator::decommit(void* address, size_t bytes)
+{
+ bool result = VirtualFree(address, bytes, MEM_DECOMMIT);
+ if (!result)
+ CRASH();
+}
+
+void OSAllocator::releaseDecommitted(void* address, size_t bytes)
+{
+ // According to http://msdn.microsoft.com/en-us/library/aa366892(VS.85).aspx,
+ // dwSize must be 0 if dwFreeType is MEM_RELEASE.
+ bool result = VirtualFree(address, 0, MEM_RELEASE);
+ if (!result)
+ CRASH();
+}
+
+} // namespace WTF
diff --git a/Source/JavaScriptCore/wtf/OwnArrayPtr.h b/Source/JavaScriptCore/wtf/OwnArrayPtr.h
new file mode 100644
index 0000000..643b90b
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/OwnArrayPtr.h
@@ -0,0 +1,179 @@
+/*
+ * Copyright (C) 2006, 2010 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef WTF_OwnArrayPtr_h
+#define WTF_OwnArrayPtr_h
+
+#include "Assertions.h"
+#include "Noncopyable.h"
+#include "NullPtr.h"
+#include "OwnArrayPtrCommon.h"
+#include <algorithm>
+
+// Remove this once we make all WebKit code compatible with stricter rules about OwnArrayPtr.
+#define LOOSE_OWN_ARRAY_PTR
+
+namespace WTF {
+
+template<typename T> class PassOwnArrayPtr;
+template<typename T> PassOwnArrayPtr<T> adoptArrayPtr(T*);
+
+template <typename T> class OwnArrayPtr : public Noncopyable {
+public:
+ typedef T* PtrType;
+
+ OwnArrayPtr() : m_ptr(0) { }
+
+ // See comment in PassOwnArrayPtr.h for why this takes a const reference.
+ template<typename U> OwnArrayPtr(const PassOwnArrayPtr<U>& o);
+
+ // This copy constructor is used implicitly by gcc when it generates
+ // transients for assigning a PassOwnArrayPtr<T> object to a stack-allocated
+ // OwnArrayPtr<T> object. It should never be called explicitly and gcc
+ // should optimize away the constructor when generating code.
+ OwnArrayPtr(const OwnArrayPtr<T>&);
+
+ ~OwnArrayPtr() { deleteOwnedArrayPtr(m_ptr); }
+
+ PtrType get() const { return m_ptr; }
+
+ void clear();
+ PassOwnArrayPtr<T> release();
+ PtrType leakPtr() WARN_UNUSED_RETURN;
+
+ T& operator*() const { ASSERT(m_ptr); return *m_ptr; }
+ PtrType operator->() const { ASSERT(m_ptr); return m_ptr; }
+
+ T& operator[](std::ptrdiff_t i) const { ASSERT(m_ptr); ASSERT(i >= 0); return m_ptr[i]; }
+
+ bool operator!() const { return !m_ptr; }
+
+ // This conversion operator allows implicit conversion to bool but not to other integer types.
+#if COMPILER(WINSCW)
+ operator bool() const { return m_ptr; }
+#else
+ typedef T* OwnArrayPtr::*UnspecifiedBoolType;
+ operator UnspecifiedBoolType() const { return m_ptr ? &OwnArrayPtr::m_ptr : 0; }
+#endif
+
+ OwnArrayPtr& operator=(const PassOwnArrayPtr<T>&);
+ OwnArrayPtr& operator=(std::nullptr_t) { clear(); return *this; }
+ template<typename U> OwnArrayPtr& operator=(const PassOwnArrayPtr<U>&);
+
+ void swap(OwnArrayPtr& o) { std::swap(m_ptr, o.m_ptr); }
+
+#ifdef LOOSE_OWN_ARRAY_PTR
+ explicit OwnArrayPtr(PtrType ptr) : m_ptr(ptr) { }
+ void set(PtrType);
+#endif
+
+private:
+ PtrType m_ptr;
+};
+
+template<typename T> template<typename U> inline OwnArrayPtr<T>::OwnArrayPtr(const PassOwnArrayPtr<U>& o)
+ : m_ptr(o.leakPtr())
+{
+}
+
+template<typename T> inline void OwnArrayPtr<T>::clear()
+{
+ PtrType ptr = m_ptr;
+ m_ptr = 0;
+ deleteOwnedArrayPtr(ptr);
+}
+
+template<typename T> inline PassOwnArrayPtr<T> OwnArrayPtr<T>::release()
+{
+ PtrType ptr = m_ptr;
+ m_ptr = 0;
+ return adoptArrayPtr(ptr);
+}
+
+template<typename T> inline typename OwnArrayPtr<T>::PtrType OwnArrayPtr<T>::leakPtr()
+{
+ PtrType ptr = m_ptr;
+ m_ptr = 0;
+ return ptr;
+}
+
+#ifdef LOOSE_OWN_ARRAY_PTR
+template<typename T> inline void OwnArrayPtr<T>::set(PtrType ptr)
+{
+ ASSERT(!ptr || m_ptr != ptr);
+ PtrType oldPtr = m_ptr;
+ m_ptr = ptr;
+ deleteOwnedPtr(oldPtr);
+}
+#endif
+
+template<typename T> inline OwnArrayPtr<T>& OwnArrayPtr<T>::operator=(const PassOwnArrayPtr<T>& o)
+{
+ PtrType ptr = m_ptr;
+ m_ptr = o.leakPtr();
+ ASSERT(!ptr || m_ptr != ptr);
+ deleteOwnedArrayPtr(ptr);
+ return *this;
+}
+
+template<typename T> template<typename U> inline OwnArrayPtr<T>& OwnArrayPtr<T>::operator=(const PassOwnArrayPtr<U>& o)
+{
+ PtrType ptr = m_ptr;
+ m_ptr = o.leakPtr();
+ ASSERT(!ptr || m_ptr != ptr);
+ deleteOwnedArrayPtr(ptr);
+ return *this;
+}
+
+template <typename T> inline void swap(OwnArrayPtr<T>& a, OwnArrayPtr<T>& b)
+{
+ a.swap(b);
+}
+
+template<typename T, typename U> inline bool operator==(const OwnArrayPtr<T>& a, U* b)
+{
+ return a.get() == b;
+}
+
+template<typename T, typename U> inline bool operator==(T* a, const OwnArrayPtr<U>& b)
+{
+ return a == b.get();
+}
+
+template<typename T, typename U> inline bool operator!=(const OwnArrayPtr<T>& a, U* b)
+{
+ return a.get() != b;
+}
+
+template<typename T, typename U> inline bool operator!=(T* a, const OwnArrayPtr<U>& b)
+{
+ return a != b.get();
+}
+
+template <typename T> inline T* getPtr(const OwnArrayPtr<T>& p)
+{
+ return p.get();
+}
+
+} // namespace WTF
+
+using WTF::OwnArrayPtr;
+
+#endif // WTF_OwnArrayPtr_h
diff --git a/Source/JavaScriptCore/wtf/OwnArrayPtrCommon.h b/Source/JavaScriptCore/wtf/OwnArrayPtrCommon.h
new file mode 100644
index 0000000..0113aff
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/OwnArrayPtrCommon.h
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WTF_OwnArrayPtrCommon_h
+#define WTF_OwnArrayPtrCommon_h
+
+namespace WTF {
+
+template<typename T> inline void deleteOwnedArrayPtr(T* ptr)
+{
+ typedef char known[sizeof(T) ? 1 : -1];
+ if (sizeof(known))
+ delete [] ptr;
+}
+
+} // namespace WTF
+
+#endif // WTF_OwnArrayPtrCommon_h
diff --git a/Source/JavaScriptCore/wtf/OwnFastMallocPtr.h b/Source/JavaScriptCore/wtf/OwnFastMallocPtr.h
new file mode 100644
index 0000000..8b6cbf4
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/OwnFastMallocPtr.h
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef OwnFastMallocPtr_h
+#define OwnFastMallocPtr_h
+
+#include "FastMalloc.h"
+#include "Noncopyable.h"
+
+namespace WTF {
+
+ template<class T> class OwnFastMallocPtr : public Noncopyable {
+ public:
+ explicit OwnFastMallocPtr(T* ptr) : m_ptr(ptr)
+ {
+ }
+
+ ~OwnFastMallocPtr()
+ {
+ fastFree(const_cast<void*>(static_cast<const void*>(const_cast<const T*>(m_ptr))));
+ }
+
+ T* get() const { return m_ptr; }
+ T* release() { T* ptr = m_ptr; m_ptr = 0; return ptr; }
+
+ private:
+ T* m_ptr;
+ };
+
+} // namespace WTF
+
+using WTF::OwnFastMallocPtr;
+
+#endif // OwnFastMallocPtr_h
diff --git a/Source/JavaScriptCore/wtf/OwnPtr.h b/Source/JavaScriptCore/wtf/OwnPtr.h
new file mode 100644
index 0000000..cdc277c
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/OwnPtr.h
@@ -0,0 +1,178 @@
+/*
+ * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef WTF_OwnPtr_h
+#define WTF_OwnPtr_h
+
+#include "Assertions.h"
+#include "Noncopyable.h"
+#include "NullPtr.h"
+#include "OwnPtrCommon.h"
+#include "TypeTraits.h"
+#include <algorithm>
+#include <memory>
+
+// Remove this once we make all WebKit code compatible with stricter rules about OwnPtr.
+#define LOOSE_OWN_PTR
+
+namespace WTF {
+
+ // Unlike most of our smart pointers, OwnPtr can take either the pointer type or the pointed-to type.
+
+ template<typename T> class PassOwnPtr;
+ template<typename T> PassOwnPtr<T> adoptPtr(T*);
+
+ template<typename T> class OwnPtr : public Noncopyable {
+ public:
+ typedef typename RemovePointer<T>::Type ValueType;
+ typedef ValueType* PtrType;
+
+ OwnPtr() : m_ptr(0) { }
+
+ // See comment in PassOwnPtr.h for why this takes a const reference.
+ template<typename U> OwnPtr(const PassOwnPtr<U>& o);
+
+ // This copy constructor is used implicitly by gcc when it generates
+ // transients for assigning a PassOwnPtr<T> object to a stack-allocated
+ // OwnPtr<T> object. It should never be called explicitly and gcc
+ // should optimize away the constructor when generating code.
+ OwnPtr(const OwnPtr<ValueType>&);
+
+ ~OwnPtr() { deleteOwnedPtr(m_ptr); }
+
+ PtrType get() const { return m_ptr; }
+
+ void clear();
+ PassOwnPtr<T> release();
+ PtrType leakPtr() WARN_UNUSED_RETURN;
+
+ ValueType& operator*() const { ASSERT(m_ptr); return *m_ptr; }
+ PtrType operator->() const { ASSERT(m_ptr); return m_ptr; }
+
+ bool operator!() const { return !m_ptr; }
+
+ // This conversion operator allows implicit conversion to bool but not to other integer types.
+ typedef PtrType OwnPtr::*UnspecifiedBoolType;
+ operator UnspecifiedBoolType() const { return m_ptr ? &OwnPtr::m_ptr : 0; }
+
+ OwnPtr& operator=(const PassOwnPtr<T>&);
+ OwnPtr& operator=(std::nullptr_t) { clear(); return *this; }
+ template<typename U> OwnPtr& operator=(const PassOwnPtr<U>&);
+
+ void swap(OwnPtr& o) { std::swap(m_ptr, o.m_ptr); }
+
+#ifdef LOOSE_OWN_PTR
+ explicit OwnPtr(PtrType ptr) : m_ptr(ptr) { }
+ void set(PtrType);
+#endif
+
+ private:
+ PtrType m_ptr;
+ };
+
+ template<typename T> template<typename U> inline OwnPtr<T>::OwnPtr(const PassOwnPtr<U>& o)
+ : m_ptr(o.leakPtr())
+ {
+ }
+
+ template<typename T> inline void OwnPtr<T>::clear()
+ {
+ PtrType ptr = m_ptr;
+ m_ptr = 0;
+ deleteOwnedPtr(ptr);
+ }
+
+ template<typename T> inline PassOwnPtr<T> OwnPtr<T>::release()
+ {
+ PtrType ptr = m_ptr;
+ m_ptr = 0;
+ return adoptPtr(ptr);
+ }
+
+ template<typename T> inline typename OwnPtr<T>::PtrType OwnPtr<T>::leakPtr()
+ {
+ PtrType ptr = m_ptr;
+ m_ptr = 0;
+ return ptr;
+ }
+
+#ifdef LOOSE_OWN_PTR
+ template<typename T> inline void OwnPtr<T>::set(PtrType ptr)
+ {
+ ASSERT(!ptr || m_ptr != ptr);
+ PtrType oldPtr = m_ptr;
+ m_ptr = ptr;
+ deleteOwnedPtr(oldPtr);
+ }
+#endif
+
+ template<typename T> inline OwnPtr<T>& OwnPtr<T>::operator=(const PassOwnPtr<T>& o)
+ {
+ PtrType ptr = m_ptr;
+ m_ptr = o.leakPtr();
+ ASSERT(!ptr || m_ptr != ptr);
+ deleteOwnedPtr(ptr);
+ return *this;
+ }
+
+ template<typename T> template<typename U> inline OwnPtr<T>& OwnPtr<T>::operator=(const PassOwnPtr<U>& o)
+ {
+ PtrType ptr = m_ptr;
+ m_ptr = o.leakPtr();
+ ASSERT(!ptr || m_ptr != ptr);
+ deleteOwnedPtr(ptr);
+ return *this;
+ }
+
+ template<typename T> inline void swap(OwnPtr<T>& a, OwnPtr<T>& b)
+ {
+ a.swap(b);
+ }
+
+ template<typename T, typename U> inline bool operator==(const OwnPtr<T>& a, U* b)
+ {
+ return a.get() == b;
+ }
+
+ template<typename T, typename U> inline bool operator==(T* a, const OwnPtr<U>& b)
+ {
+ return a == b.get();
+ }
+
+ template<typename T, typename U> inline bool operator!=(const OwnPtr<T>& a, U* b)
+ {
+ return a.get() != b;
+ }
+
+ template<typename T, typename U> inline bool operator!=(T* a, const OwnPtr<U>& b)
+ {
+ return a != b.get();
+ }
+
+ template<typename T> inline typename OwnPtr<T>::PtrType getPtr(const OwnPtr<T>& p)
+ {
+ return p.get();
+ }
+
+} // namespace WTF
+
+using WTF::OwnPtr;
+
+#endif // WTF_OwnPtr_h
diff --git a/Source/JavaScriptCore/wtf/OwnPtrCommon.h b/Source/JavaScriptCore/wtf/OwnPtrCommon.h
new file mode 100644
index 0000000..19256ea
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/OwnPtrCommon.h
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2009 Torch Mobile, Inc.
+ * Copyright (C) 2010 Company 100 Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WTF_OwnPtrCommon_h
+#define WTF_OwnPtrCommon_h
+
+#if PLATFORM(WIN)
+typedef struct HBITMAP__* HBITMAP;
+typedef struct HBRUSH__* HBRUSH;
+typedef struct HDC__* HDC;
+typedef struct HFONT__* HFONT;
+typedef struct HPALETTE__* HPALETTE;
+typedef struct HPEN__* HPEN;
+typedef struct HRGN__* HRGN;
+#endif
+
+#if PLATFORM(BREWMP)
+// Forward delcarations at this point avoid the need to include BREW includes
+// in WTF headers.
+typedef struct _ISocket ISocket;
+typedef struct _IFileMgr IFileMgr;
+typedef struct _IFile IFile;
+typedef struct IBitmap IBitmap;
+typedef struct ISSL ISSL;
+typedef struct IMemGroup IMemGroup;
+typedef struct IMemSpace IMemSpace;
+#endif
+
+namespace WTF {
+
+ template <typename T> inline void deleteOwnedPtr(T* ptr)
+ {
+ typedef char known[sizeof(T) ? 1 : -1];
+ if (sizeof(known))
+ delete ptr;
+ }
+
+#if PLATFORM(WIN)
+ void deleteOwnedPtr(HBITMAP);
+ void deleteOwnedPtr(HBRUSH);
+ void deleteOwnedPtr(HDC);
+ void deleteOwnedPtr(HFONT);
+ void deleteOwnedPtr(HPALETTE);
+ void deleteOwnedPtr(HPEN);
+ void deleteOwnedPtr(HRGN);
+#endif
+
+#if PLATFORM(BREWMP)
+ void deleteOwnedPtr(IFileMgr*);
+ void deleteOwnedPtr(IFile*);
+ void deleteOwnedPtr(IBitmap*);
+ void deleteOwnedPtr(ISSL*);
+ void deleteOwnedPtr(ISocket*);
+ void deleteOwnedPtr(IMemGroup*);
+ void deleteOwnedPtr(IMemSpace*);
+#endif
+
+} // namespace WTF
+
+#endif // WTF_OwnPtrCommon_h
diff --git a/Source/JavaScriptCore/wtf/PageAllocation.h b/Source/JavaScriptCore/wtf/PageAllocation.h
new file mode 100644
index 0000000..232cd20
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/PageAllocation.h
@@ -0,0 +1,122 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef PageAllocation_h
+#define PageAllocation_h
+
+#include <wtf/Assertions.h>
+#include <wtf/OSAllocator.h>
+#include <wtf/PageBlock.h>
+#include <wtf/UnusedParam.h>
+#include <wtf/VMTags.h>
+#include <algorithm>
+
+#if OS(DARWIN)
+#include <mach/mach_init.h>
+#include <mach/vm_map.h>
+#endif
+
+#if OS(HAIKU)
+#include <OS.h>
+#endif
+
+#if OS(WINDOWS)
+#include <malloc.h>
+#include <windows.h>
+#endif
+
+#if OS(SYMBIAN)
+#include <e32hal.h>
+#include <e32std.h>
+#endif
+
+#if HAVE(ERRNO_H)
+#include <errno.h>
+#endif
+
+#if HAVE(MMAP)
+#include <sys/mman.h>
+#include <unistd.h>
+#endif
+
+namespace WTF {
+
+/*
+ PageAllocation
+
+ The PageAllocation class provides a cross-platform memory allocation interface
+ with similar capabilities to posix mmap/munmap. Memory is allocated by calling
+ PageAllocation::allocate, and deallocated by calling deallocate on the
+ PageAllocation object. The PageAllocation holds the allocation's base pointer
+ and size.
+
+ The allocate method is passed the size required (which must be a multiple of
+ the system page size, which can be accessed using PageAllocation::pageSize).
+ Callers may also optinally provide a flag indicating the usage (for use by
+ system memory usage tracking tools, where implemented), and boolean values
+ specifying the required protection (defaulting to writable, non-executable).
+*/
+
+class PageAllocation : private PageBlock {
+public:
+ PageAllocation()
+ {
+ }
+
+ using PageBlock::operator bool;
+ using PageBlock::size;
+ using PageBlock::base;
+
+ static PageAllocation allocate(size_t size, OSAllocator::Usage usage = OSAllocator::UnknownUsage, bool writable = true, bool executable = false)
+ {
+ ASSERT(isPageAligned(size));
+ return PageAllocation(OSAllocator::reserveAndCommit(size, usage, writable, executable), size);
+ }
+
+ void deallocate()
+ {
+ // Clear base & size before calling release; if this is *inside* allocation
+ // then we won't be able to clear then after deallocating the memory.
+ PageAllocation tmp;
+ std::swap(tmp, *this);
+
+ ASSERT(tmp);
+ ASSERT(!*this);
+
+ OSAllocator::decommitAndRelease(tmp.base(), tmp.size());
+ }
+
+private:
+ PageAllocation(void* base, size_t size)
+ : PageBlock(base, size)
+ {
+ }
+};
+
+} // namespace WTF
+
+using WTF::PageAllocation;
+
+#endif // PageAllocation_h
diff --git a/Source/JavaScriptCore/wtf/PageAllocationAligned.cpp b/Source/JavaScriptCore/wtf/PageAllocationAligned.cpp
new file mode 100644
index 0000000..6f54710
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/PageAllocationAligned.cpp
@@ -0,0 +1,87 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "PageAllocationAligned.h"
+
+namespace WTF {
+
+PageAllocationAligned PageAllocationAligned::allocate(size_t size, size_t alignment, OSAllocator::Usage usage, bool writable, bool executable)
+{
+ ASSERT(isPageAligned(size));
+ ASSERT(isPageAligned(alignment));
+ ASSERT(isPowerOfTwo(alignment));
+ ASSERT(size >= alignment);
+ size_t alignmentMask = alignment - 1;
+
+#if OS(DARWIN)
+ int flags = VM_FLAGS_ANYWHERE;
+ if (usage != OSAllocator::UnknownUsage)
+ flags |= usage;
+ int protection = PROT_READ;
+ if (writable)
+ protection |= PROT_WRITE;
+ if (executable)
+ protection |= PROT_EXEC;
+
+ vm_address_t address = 0;
+ vm_map(current_task(), &address, size, alignmentMask, flags, MEMORY_OBJECT_NULL, 0, FALSE, protection, PROT_READ | PROT_WRITE | PROT_EXEC, VM_INHERIT_DEFAULT);
+ return PageAllocationAligned(reinterpret_cast<void*>(address), size);
+#else
+ size_t alignmentDelta = alignment - pageSize();
+
+ // Resererve with suffcient additional VM to correctly align.
+ size_t reservationSize = size + alignmentDelta;
+ void* reservationBase = OSAllocator::reserveUncommitted(reservationSize, usage, writable, executable);
+
+ // Select an aligned region within the reservation and commit.
+ void* alignedBase = reinterpret_cast<uintptr_t>(reservationBase) & alignmentMask
+ ? reinterpret_cast<void*>((reinterpret_cast<uintptr_t>(reservationBase) & ~alignmentMask) + alignment)
+ : reservationBase;
+ OSAllocator::commit(alignedBase, size, writable, executable);
+
+ return PageAllocationAligned(alignedBase, size, reservationBase, reservationSize);
+#endif
+}
+
+void PageAllocationAligned::deallocate()
+{
+ // Clear base & size before calling release; if this is *inside* allocation
+ // then we won't be able to clear then after deallocating the memory.
+ PageAllocationAligned tmp;
+ std::swap(tmp, *this);
+
+ ASSERT(tmp);
+ ASSERT(!*this);
+
+#if OS(DARWIN)
+ vm_deallocate(current_task(), reinterpret_cast<vm_address_t>(tmp.base()), tmp.size());
+#else
+ ASSERT(tmp.m_reservation.contains(tmp.base(), tmp.size()));
+ OSAllocator::decommitAndRelease(tmp.m_reservation.base(), tmp.m_reservation.size(), tmp.base(), tmp.size());
+#endif
+}
+
+} // namespace WTF
diff --git a/Source/JavaScriptCore/wtf/PageAllocationAligned.h b/Source/JavaScriptCore/wtf/PageAllocationAligned.h
new file mode 100644
index 0000000..282c9e3
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/PageAllocationAligned.h
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef PageAllocationAligned_h
+#define PageAllocationAligned_h
+
+#include <wtf/OSAllocator.h>
+#include <wtf/PageReservation.h>
+
+namespace WTF {
+
+class PageAllocationAligned : private PageBlock {
+public:
+ PageAllocationAligned()
+ {
+ }
+
+ using PageBlock::operator bool;
+ using PageBlock::size;
+ using PageBlock::base;
+
+ static PageAllocationAligned allocate(size_t size, size_t alignment, OSAllocator::Usage usage = OSAllocator::UnknownUsage, bool writable = true, bool executable = false);
+
+ void deallocate();
+
+private:
+#if OS(DARWIN)
+ PageAllocationAligned(void* base, size_t size)
+ : PageBlock(base, size)
+ {
+ }
+#else
+ PageAllocationAligned(void* base, size_t size, void* reservationBase, size_t reservationSize)
+ : PageBlock(base, size)
+ , m_reservation(reservationBase, reservationSize)
+ {
+ }
+
+ PageBlock m_reservation;
+#endif
+};
+
+
+} // namespace WTF
+
+using WTF::PageAllocationAligned;
+
+#endif // PageAllocationAligned_h
diff --git a/Source/JavaScriptCore/wtf/PageBlock.cpp b/Source/JavaScriptCore/wtf/PageBlock.cpp
new file mode 100644
index 0000000..6fb68e5
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/PageBlock.cpp
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "PageBlock.h"
+
+#if OS(UNIX) && !OS(SYMBIAN)
+#include <unistd.h>
+#endif
+
+#if OS(WINDOWS)
+#include <malloc.h>
+#include <windows.h>
+#endif
+
+#if OS(SYMBIAN)
+#include <e32hal.h>
+#include <e32std.h>
+#endif
+
+namespace WTF {
+
+static size_t s_pageSize;
+
+#if OS(UNIX) && !OS(SYMBIAN)
+
+inline size_t systemPageSize()
+{
+ return getpagesize();
+}
+
+#elif OS(WINDOWS)
+
+inline size_t systemPageSize()
+{
+ static size_t size = 0;
+ SYSTEM_INFO system_info;
+ GetSystemInfo(&system_info);
+ size = system_info.dwPageSize;
+ return size;
+}
+
+#elif OS(SYMBIAN)
+
+inline size_t systemPageSize()
+{
+ static TInt page_size = 0;
+ UserHal::PageSizeInBytes(page_size);
+ return page_size;
+}
+
+#endif
+
+size_t pageSize()
+{
+ if (!s_pageSize)
+ s_pageSize = systemPageSize();
+ ASSERT(isPowerOfTwo(s_pageSize));
+ return s_pageSize;
+}
+
+} // namespace WTF
diff --git a/Source/JavaScriptCore/wtf/PageBlock.h b/Source/JavaScriptCore/wtf/PageBlock.h
new file mode 100644
index 0000000..07452b3
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/PageBlock.h
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef PageBlock_h
+#define PageBlock_h
+
+namespace WTF {
+
+size_t pageSize();
+inline bool isPageAligned(void* address) { return !(reinterpret_cast<intptr_t>(address) & (pageSize() - 1)); }
+inline bool isPageAligned(size_t size) { return !(size & (pageSize() - 1)); }
+inline bool isPowerOfTwo(size_t size) { return !(size & (size - 1)); }
+
+class PageBlock {
+public:
+ PageBlock();
+ PageBlock(const PageBlock&);
+ PageBlock(void*, size_t);
+
+ void* base() const { return m_base; }
+ size_t size() const { return m_size; }
+
+ operator bool() const { return !!m_base; }
+
+ bool contains(void* containedBase, size_t containedSize)
+ {
+ return containedBase >= m_base
+ && (static_cast<char*>(containedBase) + containedSize) <= (static_cast<char*>(m_base) + m_size);
+ }
+
+private:
+ void* m_base;
+ size_t m_size;
+};
+
+inline PageBlock::PageBlock()
+ : m_base(0)
+ , m_size(0)
+{
+}
+
+inline PageBlock::PageBlock(const PageBlock& other)
+ : m_base(other.m_base)
+ , m_size(other.m_size)
+{
+}
+
+inline PageBlock::PageBlock(void* base, size_t size)
+ : m_base(base)
+ , m_size(size)
+{
+}
+
+} // namespace WTF
+
+using WTF::pageSize;
+using WTF::isPageAligned;
+using WTF::isPageAligned;
+using WTF::isPowerOfTwo;
+
+#endif // PageBlock_h
diff --git a/Source/JavaScriptCore/wtf/PageReservation.h b/Source/JavaScriptCore/wtf/PageReservation.h
new file mode 100644
index 0000000..8c097a4
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/PageReservation.h
@@ -0,0 +1,141 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef PageReservation_h
+#define PageReservation_h
+
+#include <wtf/PageAllocation.h>
+
+namespace WTF {
+
+/*
+ PageReservation
+
+ Like PageAllocation, the PageReservation class provides a cross-platform memory
+ allocation interface, but with a set of capabilities more similar to that of
+ VirtualAlloc than posix mmap. PageReservation can be used to allocate virtual
+ memory without committing physical memory pages using PageReservation::reserve.
+ Following a call to reserve all memory in the region is in a decommited state,
+ in which the memory should not be used (accessing the memory may cause a fault).
+
+ Before using memory it must be committed by calling commit, which is passed start
+ and size values (both of which require system page size granularity). One the
+ committed memory is no longer needed 'decommit' may be called to return the
+ memory to its devommitted state. Commit should only be called on memory that is
+ currently decommitted, and decommit should only be called on memory regions that
+ are currently committed. All memory should be decommited before the reservation
+ is deallocated. Values in memory may not be retained accross a pair of calls if
+ the region of memory is decommitted and then committed again.
+
+ Memory protection should not be changed on decommitted memory, and if protection
+ is changed on memory while it is committed it should be returned to the orignal
+ protection before decommit is called.
+*/
+
+class PageReservation : private PageBlock {
+public:
+ PageReservation()
+ : m_writable(false)
+ , m_executable(false)
+#ifndef NDEBUG
+ , m_committed(0)
+#endif
+ {
+ }
+
+ using PageBlock::operator bool;
+ using PageBlock::base;
+ using PageBlock::size;
+
+ void commit(void* start, size_t size)
+ {
+ ASSERT(*this);
+ ASSERT(isPageAligned(start));
+ ASSERT(isPageAligned(size));
+ ASSERT(contains(start, size));
+
+#ifndef NDEBUG
+ m_committed += size;
+#endif
+ OSAllocator::commit(start, size, m_writable, m_executable);
+ }
+
+ void decommit(void* start, size_t size)
+ {
+ ASSERT(*this);
+ ASSERT(isPageAligned(start));
+ ASSERT(isPageAligned(size));
+ ASSERT(contains(start, size));
+
+#ifndef NDEBUG
+ m_committed -= size;
+#endif
+ OSAllocator::decommit(start, size);
+ }
+
+ static PageReservation reserve(size_t size, OSAllocator::Usage usage = OSAllocator::UnknownUsage, bool writable = true, bool executable = false)
+ {
+ ASSERT(isPageAligned(size));
+ return PageReservation(OSAllocator::reserveUncommitted(size, usage, writable, executable), size, writable, executable);
+ }
+
+ void deallocate()
+ {
+ ASSERT(!m_committed);
+
+ // Clear base & size before calling release; if this is *inside* allocation
+ // then we won't be able to clear then after deallocating the memory.
+ PageReservation tmp;
+ std::swap(tmp, *this);
+
+ ASSERT(tmp);
+ ASSERT(!*this);
+
+ OSAllocator::releaseDecommitted(tmp.base(), tmp.size());
+ }
+
+private:
+ PageReservation(void* base, size_t size, bool writable, bool executable)
+ : PageBlock(base, size)
+ , m_writable(writable)
+ , m_executable(executable)
+#ifndef NDEBUG
+ , m_committed(0)
+#endif
+ {
+ }
+
+ bool m_writable;
+ bool m_executable;
+#ifndef NDEBUG
+ size_t m_committed;
+#endif
+};
+
+}
+
+using WTF::PageReservation;
+
+#endif // PageReservation_h
diff --git a/Source/JavaScriptCore/wtf/PassOwnArrayPtr.h b/Source/JavaScriptCore/wtf/PassOwnArrayPtr.h
new file mode 100644
index 0000000..499e850
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/PassOwnArrayPtr.h
@@ -0,0 +1,219 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WTF_PassOwnArrayPtr_h
+#define WTF_PassOwnArrayPtr_h
+
+#include "Assertions.h"
+#include "NullPtr.h"
+#include "OwnArrayPtrCommon.h"
+#include "TypeTraits.h"
+
+// Remove this once we make all WebKit code compatible with stricter rules about PassOwnArrayPtr.
+#define LOOSE_PASS_OWN_ARRAY_PTR
+
+namespace WTF {
+
+template<typename T> class OwnArrayPtr;
+template<typename T> class PassOwnArrayPtr;
+template<typename T> PassOwnArrayPtr<T> adoptArrayPtr(T*);
+
+template<typename T> class PassOwnArrayPtr {
+public:
+ typedef T* PtrType;
+
+ PassOwnArrayPtr() : m_ptr(0) { }
+
+ // It somewhat breaks the type system to allow transfer of ownership out of
+ // a const PassOwnArrayPtr. However, it makes it much easier to work with PassOwnArrayPtr
+ // temporaries, and we don't have a need to use real const PassOwnArrayPtrs anyway.
+ PassOwnArrayPtr(const PassOwnArrayPtr& o) : m_ptr(o.leakPtr()) { }
+ template<typename U> PassOwnArrayPtr(const PassOwnArrayPtr<U>& o) : m_ptr(o.leakPtr()) { }
+
+ ~PassOwnArrayPtr() { deleteOwnedArrayPtr(m_ptr); }
+
+ PtrType get() const { return m_ptr; }
+
+ void clear();
+ PtrType leakPtr() const WARN_UNUSED_RETURN;
+
+ T& operator*() const { ASSERT(m_ptr); return *m_ptr; }
+ PtrType operator->() const { ASSERT(m_ptr); return m_ptr; }
+
+ bool operator!() const { return !m_ptr; }
+
+ // This conversion operator allows implicit conversion to bool but not to other integer types.
+#if COMPILER(WINSCW)
+ operator bool() const { return m_ptr; }
+#else
+ typedef PtrType PassOwnArrayPtr::*UnspecifiedBoolType;
+ operator UnspecifiedBoolType() const { return m_ptr ? &PassOwnArrayPtr::m_ptr : 0; }
+#endif
+
+ PassOwnArrayPtr& operator=(const PassOwnArrayPtr<T>&);
+#if !defined(LOOSE_PASS_OWN_ARRAY_PTR) || !HAVE(NULLPTR)
+ PassOwnArrayPtr& operator=(std::nullptr_t) { clear(); return *this; }
+#endif
+ template<typename U> PassOwnArrayPtr& operator=(const PassOwnArrayPtr<U>&);
+
+ template<typename U> friend PassOwnArrayPtr<U> adoptArrayPtr(U*);
+
+#ifdef LOOSE_PASS_OWN_ARRAY_PTR
+ PassOwnArrayPtr(PtrType ptr) : m_ptr(ptr) { }
+ PassOwnArrayPtr& operator=(PtrType);
+#endif
+
+private:
+#ifndef LOOSE_PASS_OWN_ARRAY_PTR
+ explicit PassOwnArrayPtr(PtrType ptr) : m_ptr(ptr) { }
+#endif
+
+ mutable PtrType m_ptr;
+};
+
+template<typename T> inline void PassOwnArrayPtr<T>::clear()
+{
+ PtrType ptr = m_ptr;
+ m_ptr = 0;
+ deleteOwnedArrayPtr(ptr);
+}
+
+template<typename T> inline typename PassOwnArrayPtr<T>::PtrType PassOwnArrayPtr<T>::leakPtr() const
+{
+ PtrType ptr = m_ptr;
+ m_ptr = 0;
+ return ptr;
+}
+
+#ifdef LOOSE_PASS_OWN_ARRAY_PTR
+template<typename T> inline PassOwnArrayPtr<T>& PassOwnArrayPtr<T>::operator=(PtrType optr)
+{
+ PtrType ptr = m_ptr;
+ m_ptr = optr;
+ ASSERT(!ptr || m_ptr != ptr);
+ if (ptr)
+ deleteOwnedArrayPtr(ptr);
+ return *this;
+}
+#endif
+
+template<typename T> inline PassOwnArrayPtr<T>& PassOwnArrayPtr<T>::operator=(const PassOwnArrayPtr<T>& optr)
+{
+ PtrType ptr = m_ptr;
+ m_ptr = optr.leakPtr();
+ ASSERT(!ptr || m_ptr != ptr);
+ if (ptr)
+ deleteOwnedArrayPtr(ptr);
+ return *this;
+}
+
+template<typename T> template<typename U> inline PassOwnArrayPtr<T>& PassOwnArrayPtr<T>::operator=(const PassOwnArrayPtr<U>& optr)
+{
+ PtrType ptr = m_ptr;
+ m_ptr = optr.leakPtr();
+ ASSERT(!ptr || m_ptr != ptr);
+ if (ptr)
+ deleteOwnedArrayPtr(ptr);
+ return *this;
+}
+
+template<typename T, typename U> inline bool operator==(const PassOwnArrayPtr<T>& a, const PassOwnArrayPtr<U>& b)
+{
+ return a.get() == b.get();
+}
+
+template<typename T, typename U> inline bool operator==(const PassOwnArrayPtr<T>& a, const OwnArrayPtr<U>& b)
+{
+ return a.get() == b.get();
+}
+
+template<typename T, typename U> inline bool operator==(const OwnArrayPtr<T>& a, const PassOwnArrayPtr<U>& b)
+{
+ return a.get() == b.get();
+}
+
+template<typename T, typename U> inline bool operator==(const PassOwnArrayPtr<T>& a, U* b)
+{
+ return a.get() == b;
+}
+
+template<typename T, typename U> inline bool operator==(T* a, const PassOwnArrayPtr<U>& b)
+{
+ return a == b.get();
+}
+
+template<typename T, typename U> inline bool operator!=(const PassOwnArrayPtr<T>& a, const PassOwnArrayPtr<U>& b)
+{
+ return a.get() != b.get();
+}
+
+template<typename T, typename U> inline bool operator!=(const PassOwnArrayPtr<T>& a, const OwnArrayPtr<U>& b)
+{
+ return a.get() != b.get();
+}
+
+template<typename T, typename U> inline bool operator!=(const OwnArrayPtr<T>& a, const PassOwnArrayPtr<U>& b)
+{
+ return a.get() != b.get();
+}
+
+template<typename T, typename U> inline bool operator!=(const PassOwnArrayPtr<T>& a, U* b)
+{
+ return a.get() != b;
+}
+
+template<typename T, typename U> inline bool operator!=(T* a, const PassOwnArrayPtr<U>& b)
+{
+ return a != b.get();
+}
+
+template<typename T> inline PassOwnArrayPtr<T> adoptArrayPtr(T* ptr)
+{
+ return PassOwnArrayPtr<T>(ptr);
+}
+
+template<typename T, typename U> inline PassOwnArrayPtr<T> static_pointer_cast(const PassOwnArrayPtr<U>& p)
+{
+ return adoptArrayPtr(static_cast<T*>(p.leakPtr()));
+}
+
+template<typename T, typename U> inline PassOwnArrayPtr<T> const_pointer_cast(const PassOwnArrayPtr<U>& p)
+{
+ return adoptArrayPtr(const_cast<T*>(p.leakPtr()));
+}
+
+template<typename T> inline T* getPtr(const PassOwnArrayPtr<T>& p)
+{
+ return p.get();
+}
+
+} // namespace WTF
+
+using WTF::PassOwnArrayPtr;
+using WTF::adoptArrayPtr;
+using WTF::const_pointer_cast;
+using WTF::static_pointer_cast;
+
+#endif // WTF_PassOwnArrayPtr_h
diff --git a/Source/JavaScriptCore/wtf/PassOwnPtr.h b/Source/JavaScriptCore/wtf/PassOwnPtr.h
new file mode 100644
index 0000000..823f8b1
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/PassOwnPtr.h
@@ -0,0 +1,218 @@
+/*
+ * Copyright (C) 2009, 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WTF_PassOwnPtr_h
+#define WTF_PassOwnPtr_h
+
+#include "Assertions.h"
+#include "NullPtr.h"
+#include "OwnPtrCommon.h"
+#include "TypeTraits.h"
+
+// Remove this once we make all WebKit code compatible with stricter rules about PassOwnPtr.
+#define LOOSE_PASS_OWN_PTR
+
+namespace WTF {
+
+ // Unlike most of our smart pointers, PassOwnPtr can take either the pointer type or the pointed-to type.
+
+ template<typename T> class OwnPtr;
+ template<typename T> class PassOwnPtr;
+ template<typename T> PassOwnPtr<T> adoptPtr(T*);
+
+ template<typename T> class PassOwnPtr {
+ public:
+ typedef typename RemovePointer<T>::Type ValueType;
+ typedef ValueType* PtrType;
+
+ PassOwnPtr() : m_ptr(0) { }
+
+ // It somewhat breaks the type system to allow transfer of ownership out of
+ // a const PassOwnPtr. However, it makes it much easier to work with PassOwnPtr
+ // temporaries, and we don't have a need to use real const PassOwnPtrs anyway.
+ PassOwnPtr(const PassOwnPtr& o) : m_ptr(o.leakPtr()) { }
+ template<typename U> PassOwnPtr(const PassOwnPtr<U>& o) : m_ptr(o.leakPtr()) { }
+
+ ~PassOwnPtr() { deleteOwnedPtr(m_ptr); }
+
+ PtrType get() const { return m_ptr; }
+
+ void clear();
+ PtrType leakPtr() const WARN_UNUSED_RETURN;
+
+ ValueType& operator*() const { ASSERT(m_ptr); return *m_ptr; }
+ PtrType operator->() const { ASSERT(m_ptr); return m_ptr; }
+
+ bool operator!() const { return !m_ptr; }
+
+ // This conversion operator allows implicit conversion to bool but not to other integer types.
+ typedef PtrType PassOwnPtr::*UnspecifiedBoolType;
+ operator UnspecifiedBoolType() const { return m_ptr ? &PassOwnPtr::m_ptr : 0; }
+
+ PassOwnPtr& operator=(const PassOwnPtr<T>&);
+#if !defined(LOOSE_PASS_OWN_PTR) || !HAVE(NULLPTR)
+ PassOwnPtr& operator=(std::nullptr_t) { clear(); return *this; }
+#endif
+ template<typename U> PassOwnPtr& operator=(const PassOwnPtr<U>&);
+
+ template<typename U> friend PassOwnPtr<U> adoptPtr(U*);
+
+#ifdef LOOSE_PASS_OWN_PTR
+ PassOwnPtr(PtrType ptr) : m_ptr(ptr) { }
+ PassOwnPtr& operator=(PtrType);
+#endif
+
+ private:
+#ifndef LOOSE_PASS_OWN_PTR
+ explicit PassOwnPtr(PtrType ptr) : m_ptr(ptr) { }
+#endif
+
+ mutable PtrType m_ptr;
+ };
+
+ template<typename T> inline void PassOwnPtr<T>::clear()
+ {
+ PtrType ptr = m_ptr;
+ m_ptr = 0;
+ deleteOwnedPtr(ptr);
+ }
+
+ template<typename T> inline typename PassOwnPtr<T>::PtrType PassOwnPtr<T>::leakPtr() const
+ {
+ PtrType ptr = m_ptr;
+ m_ptr = 0;
+ return ptr;
+ }
+
+#ifdef LOOSE_PASS_OWN_PTR
+ template<typename T> inline PassOwnPtr<T>& PassOwnPtr<T>::operator=(PtrType optr)
+ {
+ PtrType ptr = m_ptr;
+ m_ptr = optr;
+ ASSERT(!ptr || m_ptr != ptr);
+ if (ptr)
+ deleteOwnedPtr(ptr);
+ return *this;
+ }
+#endif
+
+ template<typename T> inline PassOwnPtr<T>& PassOwnPtr<T>::operator=(const PassOwnPtr<T>& optr)
+ {
+ PtrType ptr = m_ptr;
+ m_ptr = optr.leakPtr();
+ ASSERT(!ptr || m_ptr != ptr);
+ if (ptr)
+ deleteOwnedPtr(ptr);
+ return *this;
+ }
+
+ template<typename T> template<typename U> inline PassOwnPtr<T>& PassOwnPtr<T>::operator=(const PassOwnPtr<U>& optr)
+ {
+ PtrType ptr = m_ptr;
+ m_ptr = optr.leakPtr();
+ ASSERT(!ptr || m_ptr != ptr);
+ if (ptr)
+ deleteOwnedPtr(ptr);
+ return *this;
+ }
+
+ template<typename T, typename U> inline bool operator==(const PassOwnPtr<T>& a, const PassOwnPtr<U>& b)
+ {
+ return a.get() == b.get();
+ }
+
+ template<typename T, typename U> inline bool operator==(const PassOwnPtr<T>& a, const OwnPtr<U>& b)
+ {
+ return a.get() == b.get();
+ }
+
+ template<typename T, typename U> inline bool operator==(const OwnPtr<T>& a, const PassOwnPtr<U>& b)
+ {
+ return a.get() == b.get();
+ }
+
+ template<typename T, typename U> inline bool operator==(const PassOwnPtr<T>& a, U* b)
+ {
+ return a.get() == b;
+ }
+
+ template<typename T, typename U> inline bool operator==(T* a, const PassOwnPtr<U>& b)
+ {
+ return a == b.get();
+ }
+
+ template<typename T, typename U> inline bool operator!=(const PassOwnPtr<T>& a, const PassOwnPtr<U>& b)
+ {
+ return a.get() != b.get();
+ }
+
+ template<typename T, typename U> inline bool operator!=(const PassOwnPtr<T>& a, const OwnPtr<U>& b)
+ {
+ return a.get() != b.get();
+ }
+
+ template<typename T, typename U> inline bool operator!=(const OwnPtr<T>& a, const PassOwnPtr<U>& b)
+ {
+ return a.get() != b.get();
+ }
+
+ template<typename T, typename U> inline bool operator!=(const PassOwnPtr<T>& a, U* b)
+ {
+ return a.get() != b;
+ }
+
+ template<typename T, typename U> inline bool operator!=(T* a, const PassOwnPtr<U>& b)
+ {
+ return a != b.get();
+ }
+
+ template<typename T> inline PassOwnPtr<T> adoptPtr(T* ptr)
+ {
+ return PassOwnPtr<T>(ptr);
+ }
+
+ template<typename T, typename U> inline PassOwnPtr<T> static_pointer_cast(const PassOwnPtr<U>& p)
+ {
+ return adoptPtr(static_cast<T*>(p.leakPtr()));
+ }
+
+ template<typename T, typename U> inline PassOwnPtr<T> const_pointer_cast(const PassOwnPtr<U>& p)
+ {
+ return adoptPtr(const_cast<T*>(p.leakPtr()));
+ }
+
+ template<typename T> inline T* getPtr(const PassOwnPtr<T>& p)
+ {
+ return p.get();
+ }
+
+} // namespace WTF
+
+using WTF::PassOwnPtr;
+using WTF::adoptPtr;
+using WTF::const_pointer_cast;
+using WTF::static_pointer_cast;
+
+#endif // WTF_PassOwnPtr_h
diff --git a/Source/JavaScriptCore/wtf/PassRefPtr.h b/Source/JavaScriptCore/wtf/PassRefPtr.h
new file mode 100644
index 0000000..7b4af6b
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/PassRefPtr.h
@@ -0,0 +1,313 @@
+/*
+ * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef WTF_PassRefPtr_h
+#define WTF_PassRefPtr_h
+
+#include "AlwaysInline.h"
+#include "NullPtr.h"
+
+namespace WTF {
+
+ template<typename T> class RefPtr;
+ template<typename T> class PassRefPtr;
+ template<typename T> PassRefPtr<T> adoptRef(T*);
+
+ inline void adopted(const void*) { }
+
+#if !COMPILER(WINSCW)
+#if !PLATFORM(QT)
+ #define REF_DEREF_INLINE ALWAYS_INLINE
+#else
+ // Using ALWAYS_INLINE broke the Qt build. This may be a GCC bug.
+ // See https://bugs.webkit.org/show_bug.cgi?id=37253 for details.
+ #define REF_DEREF_INLINE inline
+#endif
+#else
+ // No inlining for WINSCW compiler to prevent the compiler agressively resolving
+ // T::ref() and T::deref(), which will fail compiling when PassRefPtr<T> is used as
+ // a class member or function arguments before T is defined.
+ #define REF_DEREF_INLINE
+#endif
+
+ template<typename T> REF_DEREF_INLINE void refIfNotNull(T* ptr)
+ {
+ if (LIKELY(ptr != 0))
+ ptr->ref();
+ }
+
+ template<typename T> REF_DEREF_INLINE void derefIfNotNull(T* ptr)
+ {
+ if (LIKELY(ptr != 0))
+ ptr->deref();
+ }
+
+ #undef REF_DEREF_INLINE
+
+ template<typename T> class PassRefPtr {
+ public:
+ PassRefPtr() : m_ptr(0) { }
+ PassRefPtr(T* ptr) : m_ptr(ptr) { refIfNotNull(ptr); }
+ // It somewhat breaks the type system to allow transfer of ownership out of
+ // a const PassRefPtr. However, it makes it much easier to work with PassRefPtr
+ // temporaries, and we don't have a need to use real const PassRefPtrs anyway.
+ PassRefPtr(const PassRefPtr& o) : m_ptr(o.leakRef()) { }
+ template<typename U> PassRefPtr(const PassRefPtr<U>& o) : m_ptr(o.leakRef()) { }
+
+ ALWAYS_INLINE ~PassRefPtr() { derefIfNotNull(m_ptr); }
+
+ template<typename U> PassRefPtr(const RefPtr<U>&);
+
+ T* get() const { return m_ptr; }
+
+ void clear();
+ T* leakRef() const WARN_UNUSED_RETURN;
+
+ T& operator*() const { return *m_ptr; }
+ T* operator->() const { return m_ptr; }
+
+ bool operator!() const { return !m_ptr; }
+
+ // This conversion operator allows implicit conversion to bool but not to other integer types.
+ typedef T* (PassRefPtr::*UnspecifiedBoolType);
+ operator UnspecifiedBoolType() const { return m_ptr ? &PassRefPtr::m_ptr : 0; }
+
+ PassRefPtr& operator=(T*);
+ PassRefPtr& operator=(const PassRefPtr&);
+#if !HAVE(NULLPTR)
+ PassRefPtr& operator=(std::nullptr_t) { clear(); return *this; }
+#endif
+ template<typename U> PassRefPtr& operator=(const PassRefPtr<U>&);
+ template<typename U> PassRefPtr& operator=(const RefPtr<U>&);
+
+ friend PassRefPtr adoptRef<T>(T*);
+
+ // FIXME: Remove releaseRef once we change all callers to call leakRef instead.
+ T* releaseRef() const WARN_UNUSED_RETURN { return leakRef(); }
+
+ private:
+ // adopting constructor
+ PassRefPtr(T* ptr, bool) : m_ptr(ptr) { }
+
+ mutable T* m_ptr;
+ };
+
+ // NonNullPassRefPtr: Optimized for passing non-null pointers. A NonNullPassRefPtr
+ // begins life non-null, and can only become null through a call to leakRef()
+ // or clear().
+
+ // FIXME: NonNullPassRefPtr could just inherit from PassRefPtr. However,
+ // if we use inheritance, GCC's optimizer fails to realize that destruction
+ // of a released NonNullPassRefPtr is a no-op. So, for now, just copy the
+ // most important code from PassRefPtr.
+ template<typename T> class NonNullPassRefPtr {
+ public:
+ NonNullPassRefPtr(T* ptr)
+ : m_ptr(ptr)
+ {
+ ASSERT(m_ptr);
+ m_ptr->ref();
+ }
+
+ template<typename U> NonNullPassRefPtr(const RefPtr<U>& o)
+ : m_ptr(o.get())
+ {
+ ASSERT(m_ptr);
+ m_ptr->ref();
+ }
+
+ NonNullPassRefPtr(const NonNullPassRefPtr& o)
+ : m_ptr(o.leakRef())
+ {
+ ASSERT(m_ptr);
+ }
+
+ template<typename U> NonNullPassRefPtr(const NonNullPassRefPtr<U>& o)
+ : m_ptr(o.leakRef())
+ {
+ ASSERT(m_ptr);
+ }
+
+ template<typename U> NonNullPassRefPtr(const PassRefPtr<U>& o)
+ : m_ptr(o.leakRef())
+ {
+ ASSERT(m_ptr);
+ }
+
+ ALWAYS_INLINE ~NonNullPassRefPtr() { derefIfNotNull(m_ptr); }
+
+ T* get() const { return m_ptr; }
+
+ void clear();
+ T* leakRef() const WARN_UNUSED_RETURN { T* tmp = m_ptr; m_ptr = 0; return tmp; }
+
+ T& operator*() const { return *m_ptr; }
+ T* operator->() const { return m_ptr; }
+
+ // FIXME: Remove releaseRef once we change all callers to call leakRef instead.
+ T* releaseRef() const WARN_UNUSED_RETURN { return leakRef(); }
+
+ private:
+ mutable T* m_ptr;
+ };
+
+ template<typename T> template<typename U> inline PassRefPtr<T>::PassRefPtr(const RefPtr<U>& o)
+ : m_ptr(o.get())
+ {
+ T* ptr = m_ptr;
+ refIfNotNull(ptr);
+ }
+
+ template<typename T> inline void PassRefPtr<T>::clear()
+ {
+ T* ptr = m_ptr;
+ m_ptr = 0;
+ derefIfNotNull(ptr);
+ }
+
+ template<typename T> inline T* PassRefPtr<T>::leakRef() const
+ {
+ T* ptr = m_ptr;
+ m_ptr = 0;
+ return ptr;
+ }
+
+ template<typename T> template<typename U> inline PassRefPtr<T>& PassRefPtr<T>::operator=(const RefPtr<U>& o)
+ {
+ T* optr = o.get();
+ refIfNotNull(optr);
+ T* ptr = m_ptr;
+ m_ptr = optr;
+ derefIfNotNull(ptr);
+ return *this;
+ }
+
+ template<typename T> inline PassRefPtr<T>& PassRefPtr<T>::operator=(T* optr)
+ {
+ refIfNotNull(optr);
+ T* ptr = m_ptr;
+ m_ptr = optr;
+ derefIfNotNull(ptr);
+ return *this;
+ }
+
+ template<typename T> inline PassRefPtr<T>& PassRefPtr<T>::operator=(const PassRefPtr<T>& ref)
+ {
+ T* ptr = m_ptr;
+ m_ptr = ref.leakRef();
+ derefIfNotNull(ptr);
+ return *this;
+ }
+
+ template<typename T> template<typename U> inline PassRefPtr<T>& PassRefPtr<T>::operator=(const PassRefPtr<U>& ref)
+ {
+ T* ptr = m_ptr;
+ m_ptr = ref.leakRef();
+ derefIfNotNull(ptr);
+ return *this;
+ }
+
+ template<typename T, typename U> inline bool operator==(const PassRefPtr<T>& a, const PassRefPtr<U>& b)
+ {
+ return a.get() == b.get();
+ }
+
+ template<typename T, typename U> inline bool operator==(const PassRefPtr<T>& a, const RefPtr<U>& b)
+ {
+ return a.get() == b.get();
+ }
+
+ template<typename T, typename U> inline bool operator==(const RefPtr<T>& a, const PassRefPtr<U>& b)
+ {
+ return a.get() == b.get();
+ }
+
+ template<typename T, typename U> inline bool operator==(const PassRefPtr<T>& a, U* b)
+ {
+ return a.get() == b;
+ }
+
+ template<typename T, typename U> inline bool operator==(T* a, const PassRefPtr<U>& b)
+ {
+ return a == b.get();
+ }
+
+ template<typename T, typename U> inline bool operator!=(const PassRefPtr<T>& a, const PassRefPtr<U>& b)
+ {
+ return a.get() != b.get();
+ }
+
+ template<typename T, typename U> inline bool operator!=(const PassRefPtr<T>& a, const RefPtr<U>& b)
+ {
+ return a.get() != b.get();
+ }
+
+ template<typename T, typename U> inline bool operator!=(const RefPtr<T>& a, const PassRefPtr<U>& b)
+ {
+ return a.get() != b.get();
+ }
+
+ template<typename T, typename U> inline bool operator!=(const PassRefPtr<T>& a, U* b)
+ {
+ return a.get() != b;
+ }
+
+ template<typename T, typename U> inline bool operator!=(T* a, const PassRefPtr<U>& b)
+ {
+ return a != b.get();
+ }
+
+ template<typename T> inline PassRefPtr<T> adoptRef(T* p)
+ {
+ adopted(p);
+ return PassRefPtr<T>(p, true);
+ }
+
+ template<typename T, typename U> inline PassRefPtr<T> static_pointer_cast(const PassRefPtr<U>& p)
+ {
+ return adoptRef(static_cast<T*>(p.leakRef()));
+ }
+
+ template<typename T, typename U> inline PassRefPtr<T> const_pointer_cast(const PassRefPtr<U>& p)
+ {
+ return adoptRef(const_cast<T*>(p.leakRef()));
+ }
+
+ template<typename T> inline T* getPtr(const PassRefPtr<T>& p)
+ {
+ return p.get();
+ }
+
+ template<typename T> inline void NonNullPassRefPtr<T>::clear()
+ {
+ T* ptr = m_ptr;
+ m_ptr = 0;
+ derefIfNotNull(ptr);
+ }
+
+} // namespace WTF
+
+using WTF::PassRefPtr;
+using WTF::NonNullPassRefPtr;
+using WTF::adoptRef;
+using WTF::static_pointer_cast;
+using WTF::const_pointer_cast;
+
+#endif // WTF_PassRefPtr_h
diff --git a/Source/JavaScriptCore/wtf/Platform.h b/Source/JavaScriptCore/wtf/Platform.h
new file mode 100644
index 0000000..e6175c4
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/Platform.h
@@ -0,0 +1,1149 @@
+/*
+ * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2007-2009 Torch Mobile, Inc.
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WTF_Platform_h
+#define WTF_Platform_h
+
+/* ==== PLATFORM handles OS, operating environment, graphics API, and
+ CPU. This macro will be phased out in favor of platform adaptation
+ macros, policy decision macros, and top-level port definitions. ==== */
+#define PLATFORM(WTF_FEATURE) (defined WTF_PLATFORM_##WTF_FEATURE && WTF_PLATFORM_##WTF_FEATURE)
+
+
+/* ==== Platform adaptation macros: these describe properties of the target environment. ==== */
+
+/* COMPILER() - the compiler being used to build the project */
+#define COMPILER(WTF_FEATURE) (defined WTF_COMPILER_##WTF_FEATURE && WTF_COMPILER_##WTF_FEATURE)
+/* CPU() - the target CPU architecture */
+#define CPU(WTF_FEATURE) (defined WTF_CPU_##WTF_FEATURE && WTF_CPU_##WTF_FEATURE)
+/* HAVE() - specific system features (headers, functions or similar) that are present or not */
+#define HAVE(WTF_FEATURE) (defined HAVE_##WTF_FEATURE && HAVE_##WTF_FEATURE)
+/* OS() - underlying operating system; only to be used for mandated low-level services like
+ virtual memory, not to choose a GUI toolkit */
+#define OS(WTF_FEATURE) (defined WTF_OS_##WTF_FEATURE && WTF_OS_##WTF_FEATURE)
+
+
+/* ==== Policy decision macros: these define policy choices for a particular port. ==== */
+
+/* USE() - use a particular third-party library or optional OS service */
+#define USE(WTF_FEATURE) (defined WTF_USE_##WTF_FEATURE && WTF_USE_##WTF_FEATURE)
+/* ENABLE() - turn on a specific feature of WebKit */
+#define ENABLE(WTF_FEATURE) (defined ENABLE_##WTF_FEATURE && ENABLE_##WTF_FEATURE)
+
+
+
+/* ==== COMPILER() - the compiler being used to build the project ==== */
+
+/* COMPILER(MSVC) Microsoft Visual C++ */
+/* COMPILER(MSVC7_OR_LOWER) Microsoft Visual C++ 2003 or lower*/
+/* COMPILER(MSVC9_OR_LOWER) Microsoft Visual C++ 2008 or lower*/
+#if defined(_MSC_VER)
+#define WTF_COMPILER_MSVC 1
+#if _MSC_VER < 1400
+#define WTF_COMPILER_MSVC7_OR_LOWER 1
+#elif _MSC_VER < 1600
+#define WTF_COMPILER_MSVC9_OR_LOWER 1
+#endif
+#endif
+
+/* COMPILER(RVCT) - ARM RealView Compilation Tools */
+/* COMPILER(RVCT4_OR_GREATER) - ARM RealView Compilation Tools 4.0 or greater */
+#if defined(__CC_ARM) || defined(__ARMCC__)
+#define WTF_COMPILER_RVCT 1
+#if __ARMCC_VERSION >= 400000
+#define WTF_COMPILER_RVCT4_OR_GREATER 1
+#endif
+#endif
+
+/* COMPILER(GCC) - GNU Compiler Collection */
+/* --gnu option of the RVCT compiler also defines __GNUC__ */
+#if defined(__GNUC__) && !COMPILER(RVCT)
+#define WTF_COMPILER_GCC 1
+#define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
+#define GCC_VERSION_AT_LEAST(major, minor, patch) (GCC_VERSION >= (major * 10000 + minor * 100 + patch))
+#else
+/* define this for !GCC compilers, just so we can write things like COMPILER(GCC) && GCC_VERSION_AT_LEAST(4,1,0) */
+#define GCC_VERSION_AT_LEAST(major, minor, patch) 0
+#endif
+
+/* COMPILER(MINGW) - MinGW GCC */
+/* COMPILER(MINGW64) - mingw-w64 GCC - only used as additional check to exclude mingw.org specific functions */
+#if defined(__MINGW32__)
+#define WTF_COMPILER_MINGW 1
+#include <_mingw.h> /* private MinGW header */
+ #if defined(__MINGW64_VERSION_MAJOR) /* best way to check for mingw-w64 vs mingw.org */
+ #define WTF_COMPILER_MINGW64 1
+ #endif /* __MINGW64_VERSION_MAJOR */
+#endif /* __MINGW32__ */
+
+/* COMPILER(WINSCW) - CodeWarrior for Symbian emulator */
+#if defined(__WINSCW__)
+#define WTF_COMPILER_WINSCW 1
+/* cross-compiling, it is not really windows */
+#undef WIN32
+#undef _WIN32
+#endif
+
+/* COMPILER(INTEL) - Intel C++ Compiler */
+#if defined(__INTEL_COMPILER)
+#define WTF_COMPILER_INTEL 1
+#endif
+
+/* ==== CPU() - the target CPU architecture ==== */
+
+/* This also defines CPU(BIG_ENDIAN) or CPU(MIDDLE_ENDIAN) or neither, as appropriate. */
+
+/* CPU(ALPHA) - DEC Alpha */
+#if defined(__alpha__)
+#define WTF_CPU_ALPHA 1
+#endif
+
+/* CPU(IA64) - Itanium / IA-64 */
+#if defined(__ia64__)
+#define WTF_CPU_IA64 1
+/* 32-bit mode on Itanium */
+#if !defined(__LP64__)
+#define WTF_CPU_IA64_32 1
+#endif
+#endif
+
+/* CPU(MIPS) - MIPS 32-bit */
+/* Note: Only O32 ABI is tested, so we enable it for O32 ABI for now. */
+#if (defined(mips) || defined(__mips__) || defined(MIPS) || defined(_MIPS_)) \
+ && defined(_ABIO32)
+#define WTF_CPU_MIPS 1
+#if defined(__MIPSEB__)
+#define WTF_CPU_BIG_ENDIAN 1
+#endif
+#define WTF_MIPS_PIC (defined __PIC__)
+#define WTF_MIPS_ARCH __mips
+#define WTF_MIPS_ISA(v) (defined WTF_MIPS_ARCH && WTF_MIPS_ARCH == v)
+#define WTF_MIPS_ISA_AT_LEAST(v) (defined WTF_MIPS_ARCH && WTF_MIPS_ARCH >= v)
+#define WTF_MIPS_ARCH_REV __mips_isa_rev
+#define WTF_MIPS_ISA_REV(v) (defined WTF_MIPS_ARCH_REV && WTF_MIPS_ARCH_REV == v)
+#define WTF_MIPS_DOUBLE_FLOAT (defined __mips_hard_float && !defined __mips_single_float)
+#define WTF_MIPS_FP64 (defined __mips_fpr && __mips_fpr == 64)
+/* MIPS requires allocators to use aligned memory */
+#define WTF_USE_ARENA_ALLOC_ALIGNMENT_INTEGER 1
+#endif /* MIPS */
+
+/* CPU(PPC) - PowerPC 32-bit */
+#if defined(__ppc__) \
+ || defined(__PPC__) \
+ || defined(__powerpc__) \
+ || defined(__powerpc) \
+ || defined(__POWERPC__) \
+ || defined(_M_PPC) \
+ || defined(__PPC)
+#define WTF_CPU_PPC 1
+#define WTF_CPU_BIG_ENDIAN 1
+#endif
+
+/* CPU(PPC64) - PowerPC 64-bit */
+#if defined(__ppc64__) \
+ || defined(__PPC64__)
+#define WTF_CPU_PPC64 1
+#define WTF_CPU_BIG_ENDIAN 1
+#endif
+
+/* CPU(SH4) - SuperH SH-4 */
+#if defined(__SH4__)
+#define WTF_CPU_SH4 1
+#endif
+
+/* CPU(SPARC32) - SPARC 32-bit */
+#if defined(__sparc) && !defined(__arch64__) || defined(__sparcv8)
+#define WTF_CPU_SPARC32 1
+#define WTF_CPU_BIG_ENDIAN 1
+#endif
+
+/* CPU(SPARC64) - SPARC 64-bit */
+#if defined(__sparc__) && defined(__arch64__) || defined (__sparcv9)
+#define WTF_CPU_SPARC64 1
+#define WTF_CPU_BIG_ENDIAN 1
+#endif
+
+/* CPU(SPARC) - any SPARC, true for CPU(SPARC32) and CPU(SPARC64) */
+#if CPU(SPARC32) || CPU(SPARC64)
+#define WTF_CPU_SPARC 1
+#endif
+
+/* CPU(S390X) - S390 64-bit */
+#if defined(__s390x__)
+#define WTF_CPU_S390X 1
+#define WTF_CPU_BIG_ENDIAN 1
+#endif
+
+/* CPU(S390) - S390 32-bit */
+#if defined(__s390__)
+#define WTF_CPU_S390 1
+#define WTF_CPU_BIG_ENDIAN 1
+#endif
+
+/* CPU(X86) - i386 / x86 32-bit */
+#if defined(__i386__) \
+ || defined(i386) \
+ || defined(_M_IX86) \
+ || defined(_X86_) \
+ || defined(__THW_INTEL)
+#define WTF_CPU_X86 1
+#endif
+
+/* CPU(X86_64) - AMD64 / Intel64 / x86_64 64-bit */
+#if defined(__x86_64__) \
+ || defined(_M_X64)
+#define WTF_CPU_X86_64 1
+#endif
+
+/* CPU(ARM) - ARM, any version*/
+#if defined(arm) \
+ || defined(__arm__) \
+ || defined(ARM) \
+ || defined(_ARM_)
+#define WTF_CPU_ARM 1
+
+#if defined(__ARMEB__) || (COMPILER(RVCT) && defined(__BIG_ENDIAN))
+#define WTF_CPU_BIG_ENDIAN 1
+
+#elif !defined(__ARM_EABI__) \
+ && !defined(__EABI__) \
+ && !defined(__VFP_FP__) \
+ && !defined(_WIN32_WCE) \
+ && !defined(ANDROID)
+#define WTF_CPU_MIDDLE_ENDIAN 1
+
+#endif
+
+#define WTF_ARM_ARCH_AT_LEAST(N) (CPU(ARM) && WTF_ARM_ARCH_VERSION >= N)
+
+/* Set WTF_ARM_ARCH_VERSION */
+#if defined(__ARM_ARCH_4__) \
+ || defined(__ARM_ARCH_4T__) \
+ || defined(__MARM_ARMV4__) \
+ || defined(_ARMV4I_)
+#define WTF_ARM_ARCH_VERSION 4
+
+#elif defined(__ARM_ARCH_5__) \
+ || defined(__ARM_ARCH_5T__) \
+ || defined(__MARM_ARMV5__)
+#define WTF_ARM_ARCH_VERSION 5
+
+#elif defined(__ARM_ARCH_5E__) \
+ || defined(__ARM_ARCH_5TE__) \
+ || defined(__ARM_ARCH_5TEJ__)
+#define WTF_ARM_ARCH_VERSION 5
+/*ARMv5TE requires allocators to use aligned memory*/
+#define WTF_USE_ARENA_ALLOC_ALIGNMENT_INTEGER 1
+
+#elif defined(__ARM_ARCH_6__) \
+ || defined(__ARM_ARCH_6J__) \
+ || defined(__ARM_ARCH_6K__) \
+ || defined(__ARM_ARCH_6Z__) \
+ || defined(__ARM_ARCH_6ZK__) \
+ || defined(__ARM_ARCH_6T2__) \
+ || defined(__ARMV6__)
+#define WTF_ARM_ARCH_VERSION 6
+
+#elif defined(__ARM_ARCH_7A__) \
+ || defined(__ARM_ARCH_7R__)
+#define WTF_ARM_ARCH_VERSION 7
+
+/* RVCT sets _TARGET_ARCH_ARM */
+#elif defined(__TARGET_ARCH_ARM)
+#define WTF_ARM_ARCH_VERSION __TARGET_ARCH_ARM
+
+#if defined(__TARGET_ARCH_5E) \
+ || defined(__TARGET_ARCH_5TE) \
+ || defined(__TARGET_ARCH_5TEJ)
+/*ARMv5TE requires allocators to use aligned memory*/
+#define WTF_USE_ARENA_ALLOC_ALIGNMENT_INTEGER 1
+#endif
+
+#else
+#define WTF_ARM_ARCH_VERSION 0
+
+#endif
+
+/* Set WTF_THUMB_ARCH_VERSION */
+#if defined(__ARM_ARCH_4T__)
+#define WTF_THUMB_ARCH_VERSION 1
+
+#elif defined(__ARM_ARCH_5T__) \
+ || defined(__ARM_ARCH_5TE__) \
+ || defined(__ARM_ARCH_5TEJ__)
+#define WTF_THUMB_ARCH_VERSION 2
+
+#elif defined(__ARM_ARCH_6J__) \
+ || defined(__ARM_ARCH_6K__) \
+ || defined(__ARM_ARCH_6Z__) \
+ || defined(__ARM_ARCH_6ZK__) \
+ || defined(__ARM_ARCH_6M__)
+#define WTF_THUMB_ARCH_VERSION 3
+
+#elif defined(__ARM_ARCH_6T2__) \
+ || defined(__ARM_ARCH_7__) \
+ || defined(__ARM_ARCH_7A__) \
+ || defined(__ARM_ARCH_7R__) \
+ || defined(__ARM_ARCH_7M__)
+#define WTF_THUMB_ARCH_VERSION 4
+
+/* RVCT sets __TARGET_ARCH_THUMB */
+#elif defined(__TARGET_ARCH_THUMB)
+#define WTF_THUMB_ARCH_VERSION __TARGET_ARCH_THUMB
+
+#else
+#define WTF_THUMB_ARCH_VERSION 0
+#endif
+
+
+/* CPU(ARMV5_OR_LOWER) - ARM instruction set v5 or earlier */
+/* On ARMv5 and below the natural alignment is required.
+ And there are some other differences for v5 or earlier. */
+#if !defined(ARMV5_OR_LOWER) && !WTF_ARM_ARCH_AT_LEAST(6)
+#define WTF_CPU_ARMV5_OR_LOWER 1
+#endif
+
+
+/* CPU(ARM_TRADITIONAL) - Thumb2 is not available, only traditional ARM (v4 or greater) */
+/* CPU(ARM_THUMB2) - Thumb2 instruction set is available */
+/* Only one of these will be defined. */
+#if !defined(WTF_CPU_ARM_TRADITIONAL) && !defined(WTF_CPU_ARM_THUMB2)
+# if defined(thumb2) || defined(__thumb2__) \
+ || ((defined(__thumb) || defined(__thumb__)) && WTF_THUMB_ARCH_VERSION == 4)
+# define WTF_CPU_ARM_TRADITIONAL 0
+# define WTF_CPU_ARM_THUMB2 1
+# elif WTF_ARM_ARCH_AT_LEAST(4)
+# define WTF_CPU_ARM_TRADITIONAL 1
+# define WTF_CPU_ARM_THUMB2 0
+# else
+# error "Not supported ARM architecture"
+# endif
+#elif CPU(ARM_TRADITIONAL) && CPU(ARM_THUMB2) /* Sanity Check */
+# error "Cannot use both of WTF_CPU_ARM_TRADITIONAL and WTF_CPU_ARM_THUMB2 platforms"
+#endif /* !defined(WTF_CPU_ARM_TRADITIONAL) && !defined(WTF_CPU_ARM_THUMB2) */
+
+#endif /* ARM */
+
+
+
+/* ==== OS() - underlying operating system; only to be used for mandated low-level services like
+ virtual memory, not to choose a GUI toolkit ==== */
+
+/* OS(ANDROID) - Android */
+#ifdef ANDROID
+#define WTF_OS_ANDROID 1
+#endif
+
+/* OS(AIX) - AIX */
+#ifdef _AIX
+#define WTF_OS_AIX 1
+#endif
+
+/* OS(DARWIN) - Any Darwin-based OS, including Mac OS X and iPhone OS */
+#ifdef __APPLE__
+#define WTF_OS_DARWIN 1
+
+/* FIXME: BUILDING_ON_.., and TARGETING... macros should be folded into the OS() system */
+#include <AvailabilityMacros.h>
+#if !defined(MAC_OS_X_VERSION_10_5) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5
+#define BUILDING_ON_TIGER 1
+#elif !defined(MAC_OS_X_VERSION_10_6) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6
+#define BUILDING_ON_LEOPARD 1
+#elif !defined(MAC_OS_X_VERSION_10_7) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7
+#define BUILDING_ON_SNOW_LEOPARD 1
+#endif
+#if !defined(MAC_OS_X_VERSION_10_5) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
+#define TARGETING_TIGER 1
+#elif !defined(MAC_OS_X_VERSION_10_6) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_6
+#define TARGETING_LEOPARD 1
+#elif !defined(MAC_OS_X_VERSION_10_7) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_7
+#define TARGETING_SNOW_LEOPARD 1
+#endif
+#include <TargetConditionals.h>
+
+#endif
+
+/* OS(IOS) - iOS */
+/* OS(MAC_OS_X) - Mac OS X (not including iOS) */
+#if OS(DARWIN) && ((defined(TARGET_OS_EMBEDDED) && TARGET_OS_EMBEDDED) \
+ || (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) \
+ || (defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR))
+#define WTF_OS_IOS 1
+#elif OS(DARWIN) && defined(TARGET_OS_MAC) && TARGET_OS_MAC
+#define WTF_OS_MAC_OS_X 1
+#endif
+
+/* OS(FREEBSD) - FreeBSD */
+#ifdef __FreeBSD__
+#define WTF_OS_FREEBSD 1
+#endif
+
+/* OS(HAIKU) - Haiku */
+#ifdef __HAIKU__
+#define WTF_OS_HAIKU 1
+#endif
+
+/* OS(LINUX) - Linux */
+#ifdef __linux__
+#define WTF_OS_LINUX 1
+#endif
+
+/* OS(NETBSD) - NetBSD */
+#if defined(__NetBSD__)
+#define WTF_OS_NETBSD 1
+#endif
+
+/* OS(OPENBSD) - OpenBSD */
+#ifdef __OpenBSD__
+#define WTF_OS_OPENBSD 1
+#endif
+
+/* OS(QNX) - QNX */
+#if defined(__QNXNTO__)
+#define WTF_OS_QNX 1
+#endif
+
+/* OS(SOLARIS) - Solaris */
+#if defined(sun) || defined(__sun)
+#define WTF_OS_SOLARIS 1
+#endif
+
+/* OS(WINCE) - Windows CE; note that for this platform OS(WINDOWS) is also defined */
+#if defined(_WIN32_WCE)
+#define WTF_OS_WINCE 1
+#endif
+
+/* OS(WINDOWS) - Any version of Windows */
+#if defined(WIN32) || defined(_WIN32)
+#define WTF_OS_WINDOWS 1
+#endif
+
+/* OS(SYMBIAN) - Symbian */
+#if defined (__SYMBIAN32__)
+#define WTF_OS_SYMBIAN 1
+#endif
+
+/* OS(UNIX) - Any Unix-like system */
+#if OS(AIX) \
+ || OS(ANDROID) \
+ || OS(DARWIN) \
+ || OS(FREEBSD) \
+ || OS(HAIKU) \
+ || OS(LINUX) \
+ || OS(NETBSD) \
+ || OS(OPENBSD) \
+ || OS(QNX) \
+ || OS(SOLARIS) \
+ || OS(SYMBIAN) \
+ || defined(unix) \
+ || defined(__unix) \
+ || defined(__unix__)
+#define WTF_OS_UNIX 1
+#endif
+
+/* Operating environments */
+
+/* FIXME: these are all mixes of OS, operating environment and policy choices. */
+/* PLATFORM(CHROMIUM) */
+/* PLATFORM(QT) */
+/* PLATFORM(WX) */
+/* PLATFORM(GTK) */
+/* PLATFORM(HAIKU) */
+/* PLATFORM(MAC) */
+/* PLATFORM(WIN) */
+#if defined(BUILDING_CHROMIUM__)
+#define WTF_PLATFORM_CHROMIUM 1
+#elif defined(BUILDING_QT__)
+#define WTF_PLATFORM_QT 1
+#elif defined(BUILDING_WX__)
+#define WTF_PLATFORM_WX 1
+#elif defined(BUILDING_GTK__)
+#define WTF_PLATFORM_GTK 1
+#elif defined(BUILDING_HAIKU__)
+#define WTF_PLATFORM_HAIKU 1
+#elif defined(BUILDING_BREWMP__)
+#define WTF_PLATFORM_BREWMP 1
+#if defined(AEE_SIMULATOR)
+#define WTF_PLATFORM_BREWMP_SIMULATOR 1
+#else
+#define WTF_PLATFORM_BREWMP_SIMULATOR 0
+#endif
+#undef WTF_OS_WINDOWS
+#undef WTF_PLATFORM_WIN
+#elif OS(DARWIN)
+#define WTF_PLATFORM_MAC 1
+#elif OS(WINDOWS)
+#define WTF_PLATFORM_WIN 1
+#endif
+
+/* PLATFORM(IOS) */
+/* FIXME: this is sometimes used as an OS switch and sometimes for higher-level things */
+#if (defined(TARGET_OS_EMBEDDED) && TARGET_OS_EMBEDDED) || (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE)
+#define WTF_PLATFORM_IOS 1
+#endif
+
+/* PLATFORM(IOS_SIMULATOR) */
+#if defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR
+#define WTF_PLATFORM_IOS 1
+#define WTF_PLATFORM_IOS_SIMULATOR 1
+#else
+#define WTF_PLATFORM_IOS_SIMULATOR 0
+#endif
+
+#if !defined(WTF_PLATFORM_IOS)
+#define WTF_PLATFORM_IOS 0
+#endif
+
+/* PLATFORM(ANDROID) */
+/* FIXME: this is sometimes used as an OS() switch, and other times to drive
+ policy choices */
+#if defined(ANDROID)
+#define WTF_PLATFORM_ANDROID 1
+#endif
+
+/* Graphics engines */
+
+/* PLATFORM(CG) and PLATFORM(CI) */
+#if PLATFORM(MAC) || PLATFORM(IOS)
+#define WTF_PLATFORM_CG 1
+#endif
+#if PLATFORM(MAC) && !PLATFORM(IOS)
+#define WTF_PLATFORM_CI 1
+#endif
+#if PLATFORM(MAC) || PLATFORM(IOS) || (PLATFORM(WIN) && PLATFORM(CG))
+#define WTF_PLATFORM_CA 1
+#endif
+
+/* PLATFORM(SKIA) for Win/Linux, CG/CI for Mac */
+#if PLATFORM(CHROMIUM)
+#if OS(DARWIN)
+#define WTF_PLATFORM_CG 1
+#define WTF_PLATFORM_CI 1
+#define WTF_USE_ATSUI 1
+#define WTF_USE_CORE_TEXT 1
+#define WTF_USE_ICCJPEG 1
+#else
+#define WTF_PLATFORM_SKIA 1
+#define WTF_USE_CHROMIUM_NET 1
+#endif
+#endif
+
+#if PLATFORM(BREWMP)
+#define WTF_PLATFORM_SKIA 1
+#endif
+
+#if PLATFORM(GTK)
+#define WTF_PLATFORM_CAIRO 1
+#endif
+
+
+#if OS(WINCE)
+#include <ce_time.h>
+#endif
+
+#if (PLATFORM(IOS) || PLATFORM(MAC) || PLATFORM(WIN) || (PLATFORM(QT) && OS(DARWIN) && !ENABLE(SINGLE_THREADED))) && !defined(ENABLE_JSC_MULTIPLE_THREADS)
+#define ENABLE_JSC_MULTIPLE_THREADS 1
+#endif
+
+/* On Windows, use QueryPerformanceCounter by default */
+#if OS(WINDOWS)
+#define WTF_USE_QUERY_PERFORMANCE_COUNTER 1
+#endif
+
+#if OS(WINCE) && !PLATFORM(QT)
+#define NOMINMAX /* Windows min and max conflict with standard macros */
+#define NOSHLWAPI /* shlwapi.h not available on WinCe */
+
+/* MSDN documentation says these functions are provided with uspce.lib. But we cannot find this file. */
+#define __usp10__ /* disable "usp10.h" */
+
+#define _INC_ASSERT /* disable "assert.h" */
+#define assert(x)
+
+#endif /* OS(WINCE) && !PLATFORM(QT) */
+
+#if PLATFORM(QT)
+#define WTF_USE_QT4_UNICODE 1
+#elif OS(WINCE)
+#define WTF_USE_WINCE_UNICODE 1
+#elif PLATFORM(BREWMP)
+#define WTF_USE_BREWMP_UNICODE 1
+#elif PLATFORM(GTK)
+/* The GTK+ Unicode backend is configurable */
+#else
+#define WTF_USE_ICU_UNICODE 1
+#endif
+
+#if PLATFORM(MAC) && !PLATFORM(IOS)
+#define WTF_PLATFORM_CF 1
+#define WTF_USE_PTHREADS 1
+#define HAVE_PTHREAD_RWLOCK 1
+#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_TIGER) && CPU(X86_64)
+#define WTF_USE_PLUGIN_HOST_PROCESS 1
+#endif
+#if !defined(ENABLE_JAVA_BRIDGE)
+#define ENABLE_JAVA_BRIDGE 1
+#endif
+#if !defined(ENABLE_DASHBOARD_SUPPORT)
+#define ENABLE_DASHBOARD_SUPPORT 1
+#endif
+#define HAVE_READLINE 1
+#define HAVE_RUNLOOP_TIMER 1
+#define ENABLE_FULLSCREEN_API 1
+#define ENABLE_SMOOTH_SCROLLING 1
+#endif /* PLATFORM(MAC) && !PLATFORM(IOS) */
+
+#if PLATFORM(ANDROID)
+#define ENABLE_FULLSCREEN_API 1
+#endif
+
+#if PLATFORM(MAC)
+#define WTF_USE_CARBON_SECURE_INPUT_MODE 1
+#endif
+
+#if PLATFORM(CHROMIUM) && OS(DARWIN)
+#define WTF_PLATFORM_CF 1
+#define WTF_USE_PTHREADS 1
+#define HAVE_PTHREAD_RWLOCK 1
+#define WTF_USE_CARBON_SECURE_INPUT_MODE 1
+#endif
+
+#if PLATFORM(BREWMP)
+#define ENABLE_SINGLE_THREADED 1
+#endif
+
+#if PLATFORM(QT) && OS(DARWIN)
+#define WTF_PLATFORM_CF 1
+#endif
+
+#if OS(DARWIN) && !defined(BUILDING_ON_TIGER) && !PLATFORM(GTK) && !PLATFORM(QT)
+#define ENABLE_PURGEABLE_MEMORY 1
+#endif
+
+#if PLATFORM(IOS)
+#define ENABLE_CONTEXT_MENUS 0
+#define ENABLE_DRAG_SUPPORT 0
+#define ENABLE_FTPDIR 1
+#define ENABLE_GEOLOCATION 1
+#define ENABLE_ICONDATABASE 0
+#define ENABLE_INSPECTOR 0
+#define ENABLE_JAVA_BRIDGE 0
+#define ENABLE_NETSCAPE_PLUGIN_API 0
+#define ENABLE_ORIENTATION_EVENTS 1
+#define ENABLE_REPAINT_THROTTLING 1
+#define HAVE_READLINE 1
+#define WTF_PLATFORM_CF 1
+#define WTF_USE_PTHREADS 1
+#define HAVE_PTHREAD_RWLOCK 1
+#endif
+
+#if PLATFORM(ANDROID)
+#define WTF_USE_PTHREADS 1
+#define WTF_PLATFORM_SKIA 1
+#define USE_SYSTEM_MALLOC 1
+#define ENABLE_JAVA_BRIDGE 1
+#define LOG_DISABLED 1
+/* Prevents Webkit from drawing the caret in textfields and textareas
+ This prevents unnecessary invals. */
+#define ENABLE_TEXT_CARET 1
+#define ENABLE_JAVASCRIPT_DEBUGGER 0
+#define ENABLE_ORIENTATION_EVENTS 1
+#if !defined(ENABLE_JIT) && !ENABLE(ANDROID_JSC_JIT)
+#define ENABLE_JIT 0
+#endif
+#endif
+
+#if PLATFORM(WIN) && !OS(WINCE)
+#define WTF_PLATFORM_CF 1
+#define WTF_USE_PTHREADS 0
+#endif
+
+#if PLATFORM(WX)
+#define ENABLE_ASSEMBLER 1
+#define ENABLE_GLOBAL_FASTMALLOC_NEW 0
+#if OS(DARWIN)
+#define WTF_PLATFORM_CF 1
+#ifndef BUILDING_ON_TIGER
+#define WTF_USE_CORE_TEXT 1
+#else
+#define WTF_USE_ATSUI 1
+#endif
+#endif
+#endif
+
+#if PLATFORM(GTK)
+#if HAVE(PTHREAD_H)
+#define WTF_USE_PTHREADS 1
+#define HAVE_PTHREAD_RWLOCK 1
+#endif
+#endif
+
+#if PLATFORM(HAIKU)
+#define HAVE_POSIX_MEMALIGN 1
+#define WTF_USE_CURL 1
+#define WTF_USE_PTHREADS 1
+#define HAVE_PTHREAD_RWLOCK 1
+#define USE_SYSTEM_MALLOC 1
+#define ENABLE_NETSCAPE_PLUGIN_API 0
+#endif
+
+#if PLATFORM(BREWMP)
+#define USE_SYSTEM_MALLOC 1
+#endif
+
+#if PLATFORM(BREWMP_SIMULATOR)
+#define ENABLE_JIT 0
+#endif
+
+#if !defined(HAVE_ACCESSIBILITY)
+#if PLATFORM(IOS) || PLATFORM(MAC) || PLATFORM(WIN) || PLATFORM(GTK) || PLATFORM(CHROMIUM)
+#define HAVE_ACCESSIBILITY 1
+#endif
+#endif /* !defined(HAVE_ACCESSIBILITY) */
+
+#if OS(UNIX) && !OS(SYMBIAN)
+#define HAVE_SIGNAL_H 1
+#endif
+
+#if !OS(WINDOWS) && !OS(SOLARIS) && !OS(QNX) \
+ && !OS(SYMBIAN) && !OS(HAIKU) && !OS(RVCT) \
+ && !OS(ANDROID) && !PLATFORM(BREWMP)
+#define HAVE_TM_GMTOFF 1
+#define HAVE_TM_ZONE 1
+#define HAVE_TIMEGM 1
+#endif
+
+#if OS(DARWIN)
+
+#define HAVE_ERRNO_H 1
+#define HAVE_LANGINFO_H 1
+#define HAVE_MMAP 1
+#define HAVE_MERGESORT 1
+#define HAVE_SBRK 1
+#define HAVE_STRINGS_H 1
+#define HAVE_SYS_PARAM_H 1
+#define HAVE_SYS_TIME_H 1
+#define HAVE_SYS_TIMEB_H 1
+
+#if !defined(TARGETING_TIGER) && !defined(TARGETING_LEOPARD)
+
+#define HAVE_DISPATCH_H 1
+#define HAVE_HOSTED_CORE_ANIMATION 1
+
+#if !PLATFORM(IOS)
+#define HAVE_MADV_FREE_REUSE 1
+#define HAVE_MADV_FREE 1
+#define HAVE_PTHREAD_SETNAME_NP 1
+#endif
+
+#endif
+
+#if PLATFORM(IOS)
+#define HAVE_MADV_FREE 1
+#endif
+
+#elif OS(WINDOWS)
+
+#if OS(WINCE)
+#define HAVE_ERRNO_H 0
+#else
+#define HAVE_SYS_TIMEB_H 1
+#define HAVE_ALIGNED_MALLOC 1
+#define HAVE_ISDEBUGGERPRESENT 1
+#endif
+#define HAVE_VIRTUALALLOC 1
+
+#elif OS(SYMBIAN)
+
+#define HAVE_ERRNO_H 1
+#define HAVE_MMAP 0
+#define HAVE_SBRK 1
+
+#define HAVE_SYS_TIME_H 1
+#define HAVE_STRINGS_H 1
+
+#if !COMPILER(RVCT)
+#define HAVE_SYS_PARAM_H 1
+#endif
+
+#elif PLATFORM(BREWMP)
+
+#define HAVE_ERRNO_H 1
+
+#elif OS(QNX)
+
+#define HAVE_ERRNO_H 1
+#define HAVE_MMAP 1
+#define HAVE_SBRK 1
+#define HAVE_STRINGS_H 1
+#define HAVE_SYS_PARAM_H 1
+#define HAVE_SYS_TIME_H 1
+
+#elif OS(ANDROID)
+
+#define HAVE_ERRNO_H 1
+#define HAVE_LANGINFO_H 0
+#define HAVE_MMAP 1
+#define HAVE_SBRK 1
+#define HAVE_STRINGS_H 1
+#define HAVE_SYS_PARAM_H 1
+#define HAVE_SYS_TIME_H 1
+
+#else
+
+/* FIXME: is this actually used or do other platforms generate their own config.h? */
+
+#define HAVE_ERRNO_H 1
+/* As long as Haiku doesn't have a complete support of locale this will be disabled. */
+#if !OS(HAIKU)
+#define HAVE_LANGINFO_H 1
+#endif
+#define HAVE_MMAP 1
+#define HAVE_SBRK 1
+#define HAVE_STRINGS_H 1
+#define HAVE_SYS_PARAM_H 1
+#define HAVE_SYS_TIME_H 1
+
+#endif
+
+/* ENABLE macro defaults */
+
+#if PLATFORM(QT)
+/* We must not customize the global operator new and delete for the Qt port. */
+#define ENABLE_GLOBAL_FASTMALLOC_NEW 0
+#endif
+
+/* fastMalloc match validation allows for runtime verification that
+ new is matched by delete, fastMalloc is matched by fastFree, etc. */
+#if !defined(ENABLE_FAST_MALLOC_MATCH_VALIDATION)
+#define ENABLE_FAST_MALLOC_MATCH_VALIDATION 0
+#endif
+
+#if !defined(ENABLE_ICONDATABASE)
+#define ENABLE_ICONDATABASE 1
+#endif
+
+#if !defined(ENABLE_DATABASE)
+#define ENABLE_DATABASE 1
+#endif
+
+#if !defined(ENABLE_JAVASCRIPT_DEBUGGER)
+#define ENABLE_JAVASCRIPT_DEBUGGER 1
+#endif
+
+#if !defined(ENABLE_FTPDIR)
+#define ENABLE_FTPDIR 1
+#endif
+
+#if !defined(ENABLE_CONTEXT_MENUS)
+#define ENABLE_CONTEXT_MENUS 1
+#endif
+
+#if !defined(ENABLE_DRAG_SUPPORT)
+#define ENABLE_DRAG_SUPPORT 1
+#endif
+
+#if !defined(ENABLE_DASHBOARD_SUPPORT)
+#define ENABLE_DASHBOARD_SUPPORT 0
+#endif
+
+#if !defined(ENABLE_INSPECTOR)
+#define ENABLE_INSPECTOR 1
+#endif
+
+#if !defined(ENABLE_JAVA_BRIDGE)
+#define ENABLE_JAVA_BRIDGE 0
+#endif
+
+#if !defined(ENABLE_NETSCAPE_PLUGIN_API)
+#define ENABLE_NETSCAPE_PLUGIN_API 1
+#endif
+
+#if !defined(ENABLE_NETSCAPE_PLUGIN_METADATA_CACHE)
+#define ENABLE_NETSCAPE_PLUGIN_METADATA_CACHE 0
+#endif
+
+#if !defined(ENABLE_PURGEABLE_MEMORY)
+#define ENABLE_PURGEABLE_MEMORY 0
+#endif
+
+#if !defined(WTF_USE_PLUGIN_HOST_PROCESS)
+#define WTF_USE_PLUGIN_HOST_PROCESS 0
+#endif
+
+#if !defined(ENABLE_ORIENTATION_EVENTS)
+#define ENABLE_ORIENTATION_EVENTS 0
+#endif
+
+#if !defined(ENABLE_OPCODE_STATS)
+#define ENABLE_OPCODE_STATS 0
+#endif
+
+#if !defined(ENABLE_GLOBAL_FASTMALLOC_NEW)
+#define ENABLE_GLOBAL_FASTMALLOC_NEW 1
+#endif
+
+#define ENABLE_DEBUG_WITH_BREAKPOINT 0
+#define ENABLE_SAMPLING_COUNTERS 0
+#define ENABLE_SAMPLING_FLAGS 0
+#define ENABLE_OPCODE_SAMPLING 0
+#define ENABLE_CODEBLOCK_SAMPLING 0
+#if ENABLE(CODEBLOCK_SAMPLING) && !ENABLE(OPCODE_SAMPLING)
+#error "CODEBLOCK_SAMPLING requires OPCODE_SAMPLING"
+#endif
+#if ENABLE(OPCODE_SAMPLING) || ENABLE(SAMPLING_FLAGS)
+#define ENABLE_SAMPLING_THREAD 1
+#endif
+
+#if !defined(ENABLE_GEOLOCATION)
+#define ENABLE_GEOLOCATION 0
+#endif
+
+#if !defined(ENABLE_NOTIFICATIONS)
+#define ENABLE_NOTIFICATIONS 0
+#endif
+
+#if PLATFORM(IOS)
+#define ENABLE_TEXT_CARET 0
+#endif
+
+#if !defined(ENABLE_TEXT_CARET)
+#define ENABLE_TEXT_CARET 1
+#endif
+
+#if !defined(ENABLE_COMPOSITED_FIXED_ELEMENTS)
+#define ENABLE_COMPOSITED_FIXED_ELEMENTS 0
+#endif
+
+// ENABLE_ARCHIVE is an Android addition. We need this default value to allow
+// us to build on Mac.
+// FIXME: Upstream to webkit.org.
+#if !defined(ENABLE_ARCHIVE)
+#define ENABLE_ARCHIVE 1
+#endif
+
+#if !defined(ENABLE_ON_FIRST_TEXTAREA_FOCUS_SELECT_ALL)
+#define ENABLE_ON_FIRST_TEXTAREA_FOCUS_SELECT_ALL 0
+#endif
+
+#if !defined(ENABLE_FULLSCREEN_API)
+#define ENABLE_FULLSCREEN_API 0
+#endif
+
+#if !defined(WTF_USE_JSVALUE64) && !defined(WTF_USE_JSVALUE32_64)
+#if (CPU(X86_64) && (OS(UNIX) || OS(WINDOWS))) \
+ || (CPU(IA64) && !CPU(IA64_32)) \
+ || CPU(ALPHA) \
+ || CPU(SPARC64) \
+ || CPU(S390X) \
+ || CPU(PPC64)
+#define WTF_USE_JSVALUE64 1
+#else
+#define WTF_USE_JSVALUE32_64 1
+#endif
+#endif /* !defined(WTF_USE_JSVALUE64) && !defined(WTF_USE_JSVALUE32_64) */
+
+#if !defined(ENABLE_REPAINT_THROTTLING)
+#define ENABLE_REPAINT_THROTTLING 0
+#endif
+
+/* Disable the JIT on versiond of GCC prior to 4.1 */
+#if !defined(ENABLE_JIT) && COMPILER(GCC) && !GCC_VERSION_AT_LEAST(4,1,0)
+#define ENABLE_JIT 0
+#endif
+
+/* JIT is not implemented for 64 bit on MSVC */
+#if !defined(ENABLE_JIT) && COMPILER(MSVC) && CPU(X86_64)
+#define ENABLE_JIT 0
+#endif
+
+/* The JIT is enabled by default on all x86, x64-64, ARM & MIPS platforms. */
+#if !defined(ENABLE_JIT) \
+ && (CPU(X86) || CPU(X86_64) || CPU(ARM) || CPU(MIPS)) \
+ && (OS(DARWIN) || !COMPILER(GCC) || GCC_VERSION_AT_LEAST(4,1,0)) \
+ && !OS(WINCE)
+#define ENABLE_JIT 1
+#endif
+
+/* Ensure that either the JIT or the interpreter has been enabled. */
+#if !defined(ENABLE_INTERPRETER) && !ENABLE(JIT)
+#define ENABLE_INTERPRETER 1
+#endif
+#if !(ENABLE(JIT) || ENABLE(INTERPRETER))
+#error You have to have at least one execution model enabled to build JSC
+#endif
+
+/* Configure the JIT */
+#if ENABLE(JIT)
+ #if CPU(ARM)
+ #if !defined(ENABLE_JIT_USE_SOFT_MODULO) && WTF_ARM_ARCH_AT_LEAST(5)
+ #define ENABLE_JIT_USE_SOFT_MODULO 1
+ #endif
+ #endif
+
+ #ifndef ENABLE_JIT_OPTIMIZE_CALL
+ #define ENABLE_JIT_OPTIMIZE_CALL 1
+ #endif
+ #ifndef ENABLE_JIT_OPTIMIZE_NATIVE_CALL
+ #define ENABLE_JIT_OPTIMIZE_NATIVE_CALL 1
+ #endif
+ #ifndef ENABLE_JIT_OPTIMIZE_PROPERTY_ACCESS
+ #define ENABLE_JIT_OPTIMIZE_PROPERTY_ACCESS 1
+ #endif
+ #ifndef ENABLE_JIT_OPTIMIZE_METHOD_CALLS
+ #define ENABLE_JIT_OPTIMIZE_METHOD_CALLS 1
+ #endif
+#endif
+
+#if CPU(X86) && COMPILER(MSVC)
+#define JSC_HOST_CALL __fastcall
+#elif CPU(X86) && COMPILER(GCC)
+#define JSC_HOST_CALL __attribute__ ((fastcall))
+#else
+#define JSC_HOST_CALL
+#endif
+
+/* Configure the interpreter */
+#if COMPILER(GCC) || (COMPILER(RVCT4_OR_GREATER) && defined(__GNUC__))
+#define HAVE_COMPUTED_GOTO 1
+#endif
+#if HAVE(COMPUTED_GOTO) && ENABLE(INTERPRETER)
+#define ENABLE_COMPUTED_GOTO_INTERPRETER 1
+#endif
+
+/* Regular Expression Tracing - Set to 1 to trace RegExp's in jsc. Results dumped at exit */
+#define ENABLE_REGEXP_TRACING 0
+
+/* Yet Another Regex Runtime - turned on by default for JIT enabled ports. */
+#if ENABLE(JIT) && !defined(ENABLE_YARR_JIT)
+#define ENABLE_YARR_JIT 1
+
+/* Setting this flag compares JIT results with interpreter results. */
+#define ENABLE_YARR_JIT_DEBUG 0
+#endif
+
+#if ENABLE(JIT) || ENABLE(YARR_JIT)
+#define ENABLE_ASSEMBLER 1
+#endif
+/* Setting this flag prevents the assembler from using RWX memory; this may improve
+ security but currectly comes at a significant performance cost. */
+#if PLATFORM(IOS)
+#define ENABLE_ASSEMBLER_WX_EXCLUSIVE 1
+#else
+#define ENABLE_ASSEMBLER_WX_EXCLUSIVE 0
+#endif
+
+/* Pick which allocator to use; we only need an executable allocator if the assembler is compiled in.
+ On x86-64 we use a single fixed mmap, on other platforms we mmap on demand. */
+#if ENABLE(ASSEMBLER)
+#if CPU(X86_64)
+#define ENABLE_EXECUTABLE_ALLOCATOR_FIXED 1
+#else
+#define ENABLE_EXECUTABLE_ALLOCATOR_DEMAND 1
+#endif
+#endif
+
+#if !defined(ENABLE_PAN_SCROLLING) && OS(WINDOWS)
+#define ENABLE_PAN_SCROLLING 1
+#endif
+
+#if !defined(ENABLE_SMOOTH_SCROLLING)
+#define ENABLE_SMOOTH_SCROLLING 0
+#endif
+
+/* Use the QXmlStreamReader implementation for XMLDocumentParser */
+/* Use the QXmlQuery implementation for XSLTProcessor */
+#if PLATFORM(QT)
+#define WTF_USE_QXMLSTREAM 1
+#define WTF_USE_QXMLQUERY 1
+#endif
+
+#if PLATFORM(MAC)
+/* Complex text framework */
+#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
+#define WTF_USE_ATSUI 0
+#define WTF_USE_CORE_TEXT 1
+#else
+#define WTF_USE_ATSUI 1
+#define WTF_USE_CORE_TEXT 0
+#endif
+#endif
+
+/* Accelerated compositing */
+#if PLATFORM(ANDROID) && !defined WTF_USE_ACCELERATED_COMPOSITING
+#define WTF_USE_ACCELERATED_COMPOSITING 1
+#define ENABLE_3D_RENDERING 1
+#endif
+
+#if (PLATFORM(MAC) && !defined(BUILDING_ON_TIGER)) || PLATFORM(IOS) || PLATFORM(QT) || (PLATFORM(WIN) && !OS(WINCE) &&!defined(WIN_CAIRO))
+#define WTF_USE_ACCELERATED_COMPOSITING 1
+#endif
+
+#if (PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)) || PLATFORM(IOS)
+#define WTF_USE_PROTECTION_SPACE_AUTH_CALLBACK 1
+#endif
+
+#if COMPILER(GCC)
+#define WARN_UNUSED_RETURN __attribute__ ((warn_unused_result))
+#else
+#define WARN_UNUSED_RETURN
+#endif
+
+#if !ENABLE(NETSCAPE_PLUGIN_API) || (ENABLE(NETSCAPE_PLUGIN_API) && ((OS(UNIX) && (PLATFORM(QT) || PLATFORM(WX))) || PLATFORM(GTK)))
+#define ENABLE_PLUGIN_PACKAGE_SIMPLE_HASH 1
+#endif
+
+/* Set up a define for a common error that is intended to cause a build error -- thus the space after Error. */
+#define WTF_PLATFORM_CFNETWORK Error USE_macro_should_be_used_with_CFNETWORK
+
+#define ENABLE_JSC_ZOMBIES 0
+
+/* FIXME: Eventually we should enable this for all platforms and get rid of the define. */
+#if PLATFORM(MAC) || PLATFORM(WIN) || PLATFORM(QT)
+#define WTF_USE_PLATFORM_STRATEGIES 1
+#endif
+
+#if PLATFORM(WIN)
+#define WTF_USE_CROSS_PLATFORM_CONTEXT_MENUS 1
+#endif
+
+/* Geolocation request policy. pre-emptive policy is to acquire user permission before acquiring location.
+ Client based implementations will have option to choose between pre-emptive and nonpre-emptive permission policy.
+ pre-emptive permission policy is enabled by default for all client-based implementations. */
+#if ENABLE(CLIENT_BASED_GEOLOCATION)
+#define WTF_USE_PREEMPT_GEOLOCATION_PERMISSION 1
+#endif
+
+#if CPU(ARM_THUMB2)
+#define ENABLE_BRANCH_COMPACTION 1
+#endif
+
+#if ENABLE(GLIB_SUPPORT)
+#include "GTypedefs.h"
+#endif
+
+#endif /* WTF_Platform_h */
diff --git a/Source/JavaScriptCore/wtf/PossiblyNull.h b/Source/JavaScriptCore/wtf/PossiblyNull.h
new file mode 100644
index 0000000..79c4d82
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/PossiblyNull.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef PossiblyNull_h
+#define PossiblyNull_h
+
+#include "Assertions.h"
+
+namespace WTF {
+
+template <typename T> struct PossiblyNull {
+ PossiblyNull(T data)
+ : m_data(data)
+ {
+ }
+ PossiblyNull(const PossiblyNull<T>& source)
+ : m_data(source.m_data)
+ {
+ source.m_data = 0;
+ }
+ ~PossiblyNull() { ASSERT(!m_data); }
+ bool getValue(T& out) WARN_UNUSED_RETURN;
+private:
+ mutable T m_data;
+};
+
+template <typename T> bool PossiblyNull<T>::getValue(T& out)
+{
+ out = m_data;
+ bool result = !!m_data;
+ m_data = 0;
+ return result;
+}
+
+}
+
+#endif
diff --git a/Source/JavaScriptCore/wtf/RandomNumber.cpp b/Source/JavaScriptCore/wtf/RandomNumber.cpp
new file mode 100644
index 0000000..0c45416
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/RandomNumber.cpp
@@ -0,0 +1,123 @@
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "RandomNumber.h"
+
+#include "RandomNumberSeed.h"
+
+#include <limits>
+#include <limits.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#if OS(WINCE)
+extern "C" {
+#include "wince/mt19937ar.c"
+}
+#endif
+
+#if PLATFORM(BREWMP)
+#include <AEEAppGen.h>
+#include <AEESource.h>
+#include <AEEStdLib.h>
+#include <wtf/brew/RefPtrBrew.h>
+#include <wtf/brew/ShellBrew.h>
+#endif
+
+namespace WTF {
+
+double randomNumber()
+{
+#if !ENABLE(JSC_MULTIPLE_THREADS)
+ static bool s_initialized = false;
+ if (!s_initialized) {
+ initializeRandomNumberGenerator();
+ s_initialized = true;
+ }
+#endif
+
+#if COMPILER(MSVC) && defined(_CRT_RAND_S)
+ uint32_t bits;
+ rand_s(&bits);
+ return static_cast<double>(bits) / (static_cast<double>(std::numeric_limits<uint32_t>::max()) + 1.0);
+#elif OS(DARWIN)
+ uint32_t bits = arc4random();
+ return static_cast<double>(bits) / (static_cast<double>(std::numeric_limits<uint32_t>::max()) + 1.0);
+#elif OS(UNIX)
+ uint32_t part1 = random() & (RAND_MAX - 1);
+ uint32_t part2 = random() & (RAND_MAX - 1);
+ // random only provides 31 bits
+ uint64_t fullRandom = part1;
+ fullRandom <<= 31;
+ fullRandom |= part2;
+
+ // Mask off the low 53bits
+ fullRandom &= (1LL << 53) - 1;
+ return static_cast<double>(fullRandom)/static_cast<double>(1LL << 53);
+#elif OS(WINCE)
+ return genrand_res53();
+#elif OS(WINDOWS)
+ uint32_t part1 = rand() & (RAND_MAX - 1);
+ uint32_t part2 = rand() & (RAND_MAX - 1);
+ uint32_t part3 = rand() & (RAND_MAX - 1);
+ uint32_t part4 = rand() & (RAND_MAX - 1);
+ // rand only provides 15 bits on Win32
+ uint64_t fullRandom = part1;
+ fullRandom <<= 15;
+ fullRandom |= part2;
+ fullRandom <<= 15;
+ fullRandom |= part3;
+ fullRandom <<= 15;
+ fullRandom |= part4;
+
+ // Mask off the low 53bits
+ fullRandom &= (1LL << 53) - 1;
+ return static_cast<double>(fullRandom)/static_cast<double>(1LL << 53);
+#elif PLATFORM(BREWMP)
+ uint32_t bits;
+ RefPtr<ISource> randomSource = createRefPtrInstance<ISource>(AEECLSID_RANDOM);
+ ISOURCE_Read(randomSource.get(), reinterpret_cast<char*>(&bits), 4);
+
+ return static_cast<double>(bits) / (static_cast<double>(std::numeric_limits<uint32_t>::max()) + 1.0);
+#else
+ uint32_t part1 = rand() & (RAND_MAX - 1);
+ uint32_t part2 = rand() & (RAND_MAX - 1);
+ // rand only provides 31 bits, and the low order bits of that aren't very random
+ // so we take the high 26 bits of part 1, and the high 27 bits of part2.
+ part1 >>= 5; // drop the low 5 bits
+ part2 >>= 4; // drop the low 4 bits
+ uint64_t fullRandom = part1;
+ fullRandom <<= 27;
+ fullRandom |= part2;
+
+ // Mask off the low 53bits
+ fullRandom &= (1LL << 53) - 1;
+ return static_cast<double>(fullRandom)/static_cast<double>(1LL << 53);
+#endif
+}
+
+}
diff --git a/Source/JavaScriptCore/wtf/RandomNumber.h b/Source/JavaScriptCore/wtf/RandomNumber.h
new file mode 100644
index 0000000..f2e7e8f
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/RandomNumber.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WTF_RandomNumber_h
+#define WTF_RandomNumber_h
+
+namespace WTF {
+
+ // Returns a pseudo-random number in the range [0, 1), attempts to be
+ // cryptographically secure if possible on the target platform
+ double randomNumber();
+
+}
+
+using WTF::randomNumber;
+
+#endif
diff --git a/Source/JavaScriptCore/wtf/RandomNumberSeed.h b/Source/JavaScriptCore/wtf/RandomNumberSeed.h
new file mode 100644
index 0000000..9ea7c71
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/RandomNumberSeed.h
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WTF_RandomNumberSeed_h
+#define WTF_RandomNumberSeed_h
+
+#include <stdlib.h>
+#include <time.h>
+
+#if HAVE(SYS_TIME_H)
+#include <sys/time.h>
+#endif
+
+#if OS(UNIX)
+#include <sys/types.h>
+#include <unistd.h>
+#endif
+
+#if OS(WINCE)
+extern "C" {
+void init_by_array(unsigned long init_key[],int key_length);
+}
+#endif
+
+// Internal JavaScriptCore usage only
+namespace WTF {
+
+inline void initializeRandomNumberGenerator()
+{
+#if OS(DARWIN)
+ // On Darwin we use arc4random which initialises itself.
+#elif OS(WINCE)
+ // initialize rand()
+ srand(GetTickCount());
+
+ // use rand() to initialize the real RNG
+ unsigned long initializationBuffer[4];
+ initializationBuffer[0] = (rand() << 16) | rand();
+ initializationBuffer[1] = (rand() << 16) | rand();
+ initializationBuffer[2] = (rand() << 16) | rand();
+ initializationBuffer[3] = (rand() << 16) | rand();
+ init_by_array(initializationBuffer, 4);
+#elif COMPILER(MSVC) && defined(_CRT_RAND_S)
+ // On Windows we use rand_s which initialises itself
+#elif PLATFORM(BREWMP)
+ // On Brew MP we use AEECLSID_RANDOM which initialises itself
+#elif OS(UNIX)
+ // srandomdev is not guaranteed to exist on linux so we use this poor seed, this should be improved
+ timeval time;
+ gettimeofday(&time, 0);
+ srandom(static_cast<unsigned>(time.tv_usec * getpid()));
+#else
+ srand(static_cast<unsigned>(time(0)));
+#endif
+}
+
+}
+
+#endif
diff --git a/Source/JavaScriptCore/wtf/RefCounted.h b/Source/JavaScriptCore/wtf/RefCounted.h
new file mode 100644
index 0000000..8d8b302
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/RefCounted.h
@@ -0,0 +1,169 @@
+/*
+ * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef RefCounted_h
+#define RefCounted_h
+
+#include "Assertions.h"
+#include "Noncopyable.h"
+
+namespace WTF {
+
+// This base class holds the non-template methods and attributes.
+// The RefCounted class inherits from it reducing the template bloat
+// generated by the compiler (technique called template hoisting).
+class RefCountedBase {
+public:
+ void ref()
+ {
+ ASSERT(!m_deletionHasBegun);
+ ASSERT(!m_adoptionIsRequired);
+ ++m_refCount;
+ }
+
+ bool hasOneRef() const
+ {
+ ASSERT(!m_deletionHasBegun);
+ return m_refCount == 1;
+ }
+
+ int refCount() const
+ {
+ return m_refCount;
+ }
+
+ void relaxAdoptionRequirement()
+ {
+#ifndef NDEBUG
+ ASSERT(!m_deletionHasBegun);
+ ASSERT(m_adoptionIsRequired);
+ m_adoptionIsRequired = false;
+#endif
+ }
+
+protected:
+ RefCountedBase()
+ : m_refCount(1)
+#ifndef NDEBUG
+ , m_deletionHasBegun(false)
+ , m_adoptionIsRequired(true)
+#endif
+ {
+ }
+
+ ~RefCountedBase()
+ {
+ ASSERT(m_deletionHasBegun);
+ ASSERT(!m_adoptionIsRequired);
+ }
+
+ // Returns whether the pointer should be freed or not.
+ bool derefBase()
+ {
+ ASSERT(!m_deletionHasBegun);
+ ASSERT(!m_adoptionIsRequired);
+
+ ASSERT(m_refCount > 0);
+ if (m_refCount == 1) {
+#ifndef NDEBUG
+ m_deletionHasBegun = true;
+#endif
+ return true;
+ }
+
+ --m_refCount;
+ return false;
+ }
+
+ // Helper for generating JIT code. Please do not use for non-JIT purposes.
+ int* addressOfCount()
+ {
+ return &m_refCount;
+ }
+
+#ifndef NDEBUG
+ bool deletionHasBegun() const
+ {
+ return m_deletionHasBegun;
+ }
+#endif
+
+private:
+ template<typename T> friend class CrossThreadRefCounted;
+
+#ifndef NDEBUG
+ friend void adopted(RefCountedBase*);
+#endif
+
+ int m_refCount;
+#ifndef NDEBUG
+ bool m_deletionHasBegun;
+ bool m_adoptionIsRequired;
+#endif
+};
+
+#ifndef NDEBUG
+
+inline void adopted(RefCountedBase* object)
+{
+ if (!object)
+ return;
+ ASSERT(!object->m_deletionHasBegun);
+ object->m_adoptionIsRequired = false;
+}
+
+#endif
+
+template<typename T> class RefCounted : public RefCountedBase, public Noncopyable {
+public:
+ void deref()
+ {
+ if (derefBase())
+ delete static_cast<T*>(this);
+ }
+
+protected:
+ ~RefCounted()
+ {
+ }
+};
+
+template<typename T> class RefCountedCustomAllocated : public RefCountedBase {
+ WTF_MAKE_NONCOPYABLE(RefCountedCustomAllocated);
+
+public:
+ void deref()
+ {
+ if (derefBase())
+ delete static_cast<T*>(this);
+ }
+
+protected:
+ ~RefCountedCustomAllocated()
+ {
+ }
+};
+
+} // namespace WTF
+
+using WTF::RefCounted;
+using WTF::RefCountedCustomAllocated;
+
+#endif // RefCounted_h
diff --git a/Source/JavaScriptCore/wtf/RefCountedLeakCounter.cpp b/Source/JavaScriptCore/wtf/RefCountedLeakCounter.cpp
new file mode 100644
index 0000000..80922d3
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/RefCountedLeakCounter.cpp
@@ -0,0 +1,100 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+#include "RefCountedLeakCounter.h"
+
+#include <wtf/HashCountedSet.h>
+
+namespace WTF {
+
+#ifdef NDEBUG
+
+void RefCountedLeakCounter::suppressMessages(const char*) { }
+void RefCountedLeakCounter::cancelMessageSuppression(const char*) { }
+
+RefCountedLeakCounter::RefCountedLeakCounter(const char*) { }
+RefCountedLeakCounter::~RefCountedLeakCounter() { }
+
+void RefCountedLeakCounter::increment() { }
+void RefCountedLeakCounter::decrement() { }
+
+#else
+
+#define LOG_CHANNEL_PREFIX Log
+static WTFLogChannel LogRefCountedLeaks = { 0x00000000, "", WTFLogChannelOn };
+
+typedef HashCountedSet<const char*, PtrHash<const char*> > ReasonSet;
+static ReasonSet* leakMessageSuppressionReasons;
+
+void RefCountedLeakCounter::suppressMessages(const char* reason)
+{
+ if (!leakMessageSuppressionReasons)
+ leakMessageSuppressionReasons = new ReasonSet;
+ leakMessageSuppressionReasons->add(reason);
+}
+
+void RefCountedLeakCounter::cancelMessageSuppression(const char* reason)
+{
+ ASSERT(leakMessageSuppressionReasons);
+ ASSERT(leakMessageSuppressionReasons->contains(reason));
+ leakMessageSuppressionReasons->remove(reason);
+}
+
+RefCountedLeakCounter::RefCountedLeakCounter(const char* description)
+ : m_description(description)
+{
+}
+
+RefCountedLeakCounter::~RefCountedLeakCounter()
+{
+ static bool loggedSuppressionReason;
+ if (m_count) {
+ if (!leakMessageSuppressionReasons || leakMessageSuppressionReasons->isEmpty())
+ LOG(RefCountedLeaks, "LEAK: %u %s", m_count, m_description);
+ else if (!loggedSuppressionReason) {
+ // This logs only one reason. Later we could change it so we log all the reasons.
+ LOG(RefCountedLeaks, "No leak checking done: %s", leakMessageSuppressionReasons->begin()->first);
+ loggedSuppressionReason = true;
+ }
+ }
+}
+
+void RefCountedLeakCounter::increment()
+{
+#if ENABLE(JSC_MULTIPLE_THREADS)
+ atomicIncrement(&m_count);
+#else
+ ++m_count;
+#endif
+}
+
+void RefCountedLeakCounter::decrement()
+{
+#if ENABLE(JSC_MULTIPLE_THREADS)
+ atomicDecrement(&m_count);
+#else
+ --m_count;
+#endif
+}
+
+#endif
+
+} // namespace WTF
diff --git a/Source/JavaScriptCore/wtf/RefCountedLeakCounter.h b/Source/JavaScriptCore/wtf/RefCountedLeakCounter.h
new file mode 100644
index 0000000..57cc283
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/RefCountedLeakCounter.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef RefCountedLeakCounter_h
+#define RefCountedLeakCounter_h
+
+#include "Assertions.h"
+#include "Threading.h"
+
+namespace WTF {
+
+ struct RefCountedLeakCounter {
+ static void suppressMessages(const char*);
+ static void cancelMessageSuppression(const char*);
+
+ explicit RefCountedLeakCounter(const char* description);
+ ~RefCountedLeakCounter();
+
+ void increment();
+ void decrement();
+
+#ifndef NDEBUG
+ private:
+ volatile int m_count;
+ const char* m_description;
+#endif
+ };
+
+} // namespace WTF
+
+#endif
diff --git a/Source/JavaScriptCore/wtf/RefPtr.h b/Source/JavaScriptCore/wtf/RefPtr.h
new file mode 100644
index 0000000..d57f88a
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/RefPtr.h
@@ -0,0 +1,231 @@
+/*
+ * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+// RefPtr and PassRefPtr are documented at http://webkit.org/coding/RefPtr.html
+
+#ifndef WTF_RefPtr_h
+#define WTF_RefPtr_h
+
+#include <algorithm>
+#include "FastAllocBase.h"
+#include "PassRefPtr.h"
+
+namespace WTF {
+
+ enum PlacementNewAdoptType { PlacementNewAdopt };
+
+ template<typename T> class PassRefPtr;
+ template<typename T> class NonNullPassRefPtr;
+
+ enum HashTableDeletedValueType { HashTableDeletedValue };
+
+ template<typename T> class RefPtr : public FastAllocBase {
+ public:
+ ALWAYS_INLINE RefPtr() : m_ptr(0) { }
+ ALWAYS_INLINE RefPtr(T* ptr) : m_ptr(ptr) { refIfNotNull(ptr); }
+ ALWAYS_INLINE RefPtr(const RefPtr& o) : m_ptr(o.m_ptr) { refIfNotNull(m_ptr); }
+ template<typename U> RefPtr(const RefPtr<U>& o) : m_ptr(o.get()) { refIfNotNull(m_ptr); }
+
+ // See comments in PassRefPtr.h for an explanation of why these takes const references.
+ template<typename U> RefPtr(const PassRefPtr<U>&);
+ template<typename U> RefPtr(const NonNullPassRefPtr<U>&);
+
+ // Special constructor for cases where we overwrite an object in place.
+ ALWAYS_INLINE RefPtr(PlacementNewAdoptType) { }
+
+ // Hash table deleted values, which are only constructed and never copied or destroyed.
+ RefPtr(HashTableDeletedValueType) : m_ptr(hashTableDeletedValue()) { }
+ bool isHashTableDeletedValue() const { return m_ptr == hashTableDeletedValue(); }
+
+ ALWAYS_INLINE ~RefPtr() { derefIfNotNull(m_ptr); }
+
+ T* get() const { return m_ptr; }
+
+ void clear();
+ PassRefPtr<T> release() { PassRefPtr<T> tmp = adoptRef(m_ptr); m_ptr = 0; return tmp; }
+
+ T& operator*() const { return *m_ptr; }
+ ALWAYS_INLINE T* operator->() const { return m_ptr; }
+
+ bool operator!() const { return !m_ptr; }
+
+ // This conversion operator allows implicit conversion to bool but not to other integer types.
+ typedef T* (RefPtr::*UnspecifiedBoolType);
+ operator UnspecifiedBoolType() const { return m_ptr ? &RefPtr::m_ptr : 0; }
+
+ RefPtr& operator=(const RefPtr&);
+ RefPtr& operator=(T*);
+ RefPtr& operator=(const PassRefPtr<T>&);
+ RefPtr& operator=(const NonNullPassRefPtr<T>&);
+#if !HAVE(NULLPTR)
+ RefPtr& operator=(std::nullptr_t) { clear(); return *this; }
+#endif
+ template<typename U> RefPtr& operator=(const RefPtr<U>&);
+ template<typename U> RefPtr& operator=(const PassRefPtr<U>&);
+ template<typename U> RefPtr& operator=(const NonNullPassRefPtr<U>&);
+
+ void swap(RefPtr&);
+
+ static T* hashTableDeletedValue() { return reinterpret_cast<T*>(-1); }
+
+ private:
+ T* m_ptr;
+ };
+
+ template<typename T> template<typename U> inline RefPtr<T>::RefPtr(const PassRefPtr<U>& o)
+ : m_ptr(o.leakRef())
+ {
+ }
+
+ template<typename T> template<typename U> inline RefPtr<T>::RefPtr(const NonNullPassRefPtr<U>& o)
+ : m_ptr(o.leakRef())
+ {
+ }
+
+ template<typename T> inline void RefPtr<T>::clear()
+ {
+ T* ptr = m_ptr;
+ m_ptr = 0;
+ derefIfNotNull(ptr);
+ }
+
+ template<typename T> inline RefPtr<T>& RefPtr<T>::operator=(const RefPtr<T>& o)
+ {
+ T* optr = o.get();
+ refIfNotNull(optr);
+ T* ptr = m_ptr;
+ m_ptr = optr;
+ derefIfNotNull(ptr);
+ return *this;
+ }
+
+ template<typename T> template<typename U> inline RefPtr<T>& RefPtr<T>::operator=(const RefPtr<U>& o)
+ {
+ T* optr = o.get();
+ refIfNotNull(optr);
+ T* ptr = m_ptr;
+ m_ptr = optr;
+ derefIfNotNull(ptr);
+ return *this;
+ }
+
+ template<typename T> inline RefPtr<T>& RefPtr<T>::operator=(T* optr)
+ {
+ refIfNotNull(optr);
+ T* ptr = m_ptr;
+ m_ptr = optr;
+ derefIfNotNull(ptr);
+ return *this;
+ }
+
+ template<typename T> inline RefPtr<T>& RefPtr<T>::operator=(const PassRefPtr<T>& o)
+ {
+ T* ptr = m_ptr;
+ m_ptr = o.leakRef();
+ derefIfNotNull(ptr);
+ return *this;
+ }
+
+ template<typename T> inline RefPtr<T>& RefPtr<T>::operator=(const NonNullPassRefPtr<T>& o)
+ {
+ T* ptr = m_ptr;
+ m_ptr = o.leakRef();
+ derefIfNotNull(ptr);
+ return *this;
+ }
+
+ template<typename T> template<typename U> inline RefPtr<T>& RefPtr<T>::operator=(const PassRefPtr<U>& o)
+ {
+ T* ptr = m_ptr;
+ m_ptr = o.leakRef();
+ derefIfNotNull(ptr);
+ return *this;
+ }
+
+ template<typename T> template<typename U> inline RefPtr<T>& RefPtr<T>::operator=(const NonNullPassRefPtr<U>& o)
+ {
+ T* ptr = m_ptr;
+ m_ptr = o.leakRef();
+ derefIfNotNull(ptr);
+ return *this;
+ }
+
+ template<class T> inline void RefPtr<T>::swap(RefPtr<T>& o)
+ {
+ std::swap(m_ptr, o.m_ptr);
+ }
+
+ template<class T> inline void swap(RefPtr<T>& a, RefPtr<T>& b)
+ {
+ a.swap(b);
+ }
+
+ template<typename T, typename U> inline bool operator==(const RefPtr<T>& a, const RefPtr<U>& b)
+ {
+ return a.get() == b.get();
+ }
+
+ template<typename T, typename U> inline bool operator==(const RefPtr<T>& a, U* b)
+ {
+ return a.get() == b;
+ }
+
+ template<typename T, typename U> inline bool operator==(T* a, const RefPtr<U>& b)
+ {
+ return a == b.get();
+ }
+
+ template<typename T, typename U> inline bool operator!=(const RefPtr<T>& a, const RefPtr<U>& b)
+ {
+ return a.get() != b.get();
+ }
+
+ template<typename T, typename U> inline bool operator!=(const RefPtr<T>& a, U* b)
+ {
+ return a.get() != b;
+ }
+
+ template<typename T, typename U> inline bool operator!=(T* a, const RefPtr<U>& b)
+ {
+ return a != b.get();
+ }
+
+ template<typename T, typename U> inline RefPtr<T> static_pointer_cast(const RefPtr<U>& p)
+ {
+ return RefPtr<T>(static_cast<T*>(p.get()));
+ }
+
+ template<typename T, typename U> inline RefPtr<T> const_pointer_cast(const RefPtr<U>& p)
+ {
+ return RefPtr<T>(const_cast<T*>(p.get()));
+ }
+
+ template<typename T> inline T* getPtr(const RefPtr<T>& p)
+ {
+ return p.get();
+ }
+
+} // namespace WTF
+
+using WTF::RefPtr;
+using WTF::static_pointer_cast;
+using WTF::const_pointer_cast;
+
+#endif // WTF_RefPtr_h
diff --git a/Source/JavaScriptCore/wtf/RefPtrHashMap.h b/Source/JavaScriptCore/wtf/RefPtrHashMap.h
new file mode 100644
index 0000000..7f6ebfe
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/RefPtrHashMap.h
@@ -0,0 +1,336 @@
+/*
+ * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+namespace WTF {
+
+ // This specialization is a direct copy of HashMap, with overloaded functions
+ // to allow for lookup by pointer instead of RefPtr, avoiding ref-count churn.
+
+ // FIXME: Find a better way that doesn't require an entire copy of the HashMap template.
+
+ template<typename RawKeyType, typename ValueType, typename ValueTraits, typename HashFunctions>
+ struct RefPtrHashMapRawKeyTranslator {
+ typedef typename ValueType::first_type KeyType;
+ typedef typename ValueType::second_type MappedType;
+ typedef typename ValueTraits::FirstTraits KeyTraits;
+ typedef typename ValueTraits::SecondTraits MappedTraits;
+
+ static unsigned hash(RawKeyType key) { return HashFunctions::hash(key); }
+ static bool equal(const KeyType& a, RawKeyType b) { return HashFunctions::equal(a, b); }
+ static void translate(ValueType& location, RawKeyType key, const MappedType& mapped)
+ {
+ location.first = key;
+ location.second = mapped;
+ }
+ };
+
+ template<typename T, typename MappedArg, typename HashArg, typename KeyTraitsArg, typename MappedTraitsArg>
+ class HashMap<RefPtr<T>, MappedArg, HashArg, KeyTraitsArg, MappedTraitsArg> : public FastAllocBase {
+ private:
+ typedef KeyTraitsArg KeyTraits;
+ typedef MappedTraitsArg MappedTraits;
+ typedef PairHashTraits<KeyTraits, MappedTraits> ValueTraits;
+
+ public:
+ typedef typename KeyTraits::TraitType KeyType;
+ typedef T* RawKeyType;
+ typedef typename MappedTraits::TraitType MappedType;
+ typedef typename ValueTraits::TraitType ValueType;
+
+ private:
+ typedef HashArg HashFunctions;
+
+ typedef HashTable<KeyType, ValueType, PairFirstExtractor<ValueType>,
+ HashFunctions, ValueTraits, KeyTraits> HashTableType;
+
+ typedef RefPtrHashMapRawKeyTranslator<RawKeyType, ValueType, ValueTraits, HashFunctions>
+ RawKeyTranslator;
+
+ public:
+ typedef HashTableIteratorAdapter<HashTableType, ValueType> iterator;
+ typedef HashTableConstIteratorAdapter<HashTableType, ValueType> const_iterator;
+
+ void swap(HashMap&);
+
+ int size() const;
+ int capacity() const;
+ bool isEmpty() const;
+
+ // iterators iterate over pairs of keys and values
+ iterator begin();
+ iterator end();
+ const_iterator begin() const;
+ const_iterator end() const;
+
+ iterator find(const KeyType&);
+ iterator find(RawKeyType);
+ const_iterator find(const KeyType&) const;
+ const_iterator find(RawKeyType) const;
+ bool contains(const KeyType&) const;
+ bool contains(RawKeyType) const;
+ MappedType get(const KeyType&) const;
+ MappedType get(RawKeyType) const;
+ MappedType inlineGet(RawKeyType) const;
+
+ // replaces value but not key if key is already present
+ // return value is a pair of the iterator to the key location,
+ // and a boolean that's true if a new value was actually added
+ pair<iterator, bool> set(const KeyType&, const MappedType&);
+ pair<iterator, bool> set(RawKeyType, const MappedType&);
+
+ // does nothing if key is already present
+ // return value is a pair of the iterator to the key location,
+ // and a boolean that's true if a new value was actually added
+ pair<iterator, bool> add(const KeyType&, const MappedType&);
+ pair<iterator, bool> add(RawKeyType, const MappedType&);
+
+ void remove(const KeyType&);
+ void remove(RawKeyType);
+ void remove(iterator);
+ void clear();
+
+ MappedType take(const KeyType&); // efficient combination of get with remove
+ MappedType take(RawKeyType); // efficient combination of get with remove
+
+ private:
+ pair<iterator, bool> inlineAdd(const KeyType&, const MappedType&);
+ pair<iterator, bool> inlineAdd(RawKeyType, const MappedType&);
+
+ HashTableType m_impl;
+ };
+
+ template<typename T, typename U, typename V, typename W, typename X>
+ inline void HashMap<RefPtr<T>, U, V, W, X>::swap(HashMap& other)
+ {
+ m_impl.swap(other.m_impl);
+ }
+
+ template<typename T, typename U, typename V, typename W, typename X>
+ inline int HashMap<RefPtr<T>, U, V, W, X>::size() const
+ {
+ return m_impl.size();
+ }
+
+ template<typename T, typename U, typename V, typename W, typename X>
+ inline int HashMap<RefPtr<T>, U, V, W, X>::capacity() const
+ {
+ return m_impl.capacity();
+ }
+
+ template<typename T, typename U, typename V, typename W, typename X>
+ inline bool HashMap<RefPtr<T>, U, V, W, X>::isEmpty() const
+ {
+ return m_impl.isEmpty();
+ }
+
+ template<typename T, typename U, typename V, typename W, typename X>
+ inline typename HashMap<RefPtr<T>, U, V, W, X>::iterator HashMap<RefPtr<T>, U, V, W, X>::begin()
+ {
+ return m_impl.begin();
+ }
+
+ template<typename T, typename U, typename V, typename W, typename X>
+ inline typename HashMap<RefPtr<T>, U, V, W, X>::iterator HashMap<RefPtr<T>, U, V, W, X>::end()
+ {
+ return m_impl.end();
+ }
+
+ template<typename T, typename U, typename V, typename W, typename X>
+ inline typename HashMap<RefPtr<T>, U, V, W, X>::const_iterator HashMap<RefPtr<T>, U, V, W, X>::begin() const
+ {
+ return m_impl.begin();
+ }
+
+ template<typename T, typename U, typename V, typename W, typename X>
+ inline typename HashMap<RefPtr<T>, U, V, W, X>::const_iterator HashMap<RefPtr<T>, U, V, W, X>::end() const
+ {
+ return m_impl.end();
+ }
+
+ template<typename T, typename U, typename V, typename W, typename X>
+ inline typename HashMap<RefPtr<T>, U, V, W, X>::iterator HashMap<RefPtr<T>, U, V, W, X>::find(const KeyType& key)
+ {
+ return m_impl.find(key);
+ }
+
+ template<typename T, typename U, typename V, typename W, typename X>
+ inline typename HashMap<RefPtr<T>, U, V, W, X>::iterator HashMap<RefPtr<T>, U, V, W, X>::find(RawKeyType key)
+ {
+ return m_impl.template find<RawKeyType, RawKeyTranslator>(key);
+ }
+
+ template<typename T, typename U, typename V, typename W, typename X>
+ inline typename HashMap<RefPtr<T>, U, V, W, X>::const_iterator HashMap<RefPtr<T>, U, V, W, X>::find(const KeyType& key) const
+ {
+ return m_impl.find(key);
+ }
+
+ template<typename T, typename U, typename V, typename W, typename X>
+ inline typename HashMap<RefPtr<T>, U, V, W, X>::const_iterator HashMap<RefPtr<T>, U, V, W, X>::find(RawKeyType key) const
+ {
+ return m_impl.template find<RawKeyType, RawKeyTranslator>(key);
+ }
+
+ template<typename T, typename U, typename V, typename W, typename X>
+ inline bool HashMap<RefPtr<T>, U, V, W, X>::contains(const KeyType& key) const
+ {
+ return m_impl.contains(key);
+ }
+
+ template<typename T, typename U, typename V, typename W, typename X>
+ inline bool HashMap<RefPtr<T>, U, V, W, X>::contains(RawKeyType key) const
+ {
+ return m_impl.template contains<RawKeyType, RawKeyTranslator>(key);
+ }
+
+ template<typename T, typename U, typename V, typename W, typename X>
+ inline pair<typename HashMap<RefPtr<T>, U, V, W, X>::iterator, bool>
+ HashMap<RefPtr<T>, U, V, W, X>::inlineAdd(const KeyType& key, const MappedType& mapped)
+ {
+ typedef HashMapTranslator<ValueType, ValueTraits, HashFunctions> TranslatorType;
+ return m_impl.template add<KeyType, MappedType, TranslatorType>(key, mapped);
+ }
+
+ template<typename T, typename U, typename V, typename W, typename X>
+ inline pair<typename HashMap<RefPtr<T>, U, V, W, X>::iterator, bool>
+ HashMap<RefPtr<T>, U, V, W, X>::inlineAdd(RawKeyType key, const MappedType& mapped)
+ {
+ return m_impl.template add<RawKeyType, MappedType, RawKeyTranslator>(key, mapped);
+ }
+
+ template<typename T, typename U, typename V, typename W, typename X>
+ pair<typename HashMap<RefPtr<T>, U, V, W, X>::iterator, bool>
+ HashMap<RefPtr<T>, U, V, W, X>::set(const KeyType& key, const MappedType& mapped)
+ {
+ pair<iterator, bool> result = inlineAdd(key, mapped);
+ if (!result.second) {
+ // add call above didn't change anything, so set the mapped value
+ result.first->second = mapped;
+ }
+ return result;
+ }
+
+ template<typename T, typename U, typename V, typename W, typename X>
+ pair<typename HashMap<RefPtr<T>, U, V, W, X>::iterator, bool>
+ HashMap<RefPtr<T>, U, V, W, X>::set(RawKeyType key, const MappedType& mapped)
+ {
+ pair<iterator, bool> result = inlineAdd(key, mapped);
+ if (!result.second) {
+ // add call above didn't change anything, so set the mapped value
+ result.first->second = mapped;
+ }
+ return result;
+ }
+
+ template<typename T, typename U, typename V, typename W, typename X>
+ pair<typename HashMap<RefPtr<T>, U, V, W, X>::iterator, bool>
+ HashMap<RefPtr<T>, U, V, W, X>::add(const KeyType& key, const MappedType& mapped)
+ {
+ return inlineAdd(key, mapped);
+ }
+
+ template<typename T, typename U, typename V, typename W, typename X>
+ pair<typename HashMap<RefPtr<T>, U, V, W, X>::iterator, bool>
+ HashMap<RefPtr<T>, U, V, W, X>::add(RawKeyType key, const MappedType& mapped)
+ {
+ return inlineAdd(key, mapped);
+ }
+
+ template<typename T, typename U, typename V, typename W, typename MappedTraits>
+ typename HashMap<RefPtr<T>, U, V, W, MappedTraits>::MappedType
+ HashMap<RefPtr<T>, U, V, W, MappedTraits>::get(const KeyType& key) const
+ {
+ ValueType* entry = const_cast<HashTableType&>(m_impl).lookup(key);
+ if (!entry)
+ return MappedTraits::emptyValue();
+ return entry->second;
+ }
+
+ template<typename T, typename U, typename V, typename W, typename MappedTraits>
+ typename HashMap<RefPtr<T>, U, V, W, MappedTraits>::MappedType
+ inline HashMap<RefPtr<T>, U, V, W, MappedTraits>::inlineGet(RawKeyType key) const
+ {
+ ValueType* entry = const_cast<HashTableType&>(m_impl).template lookup<RawKeyType, RawKeyTranslator>(key);
+ if (!entry)
+ return MappedTraits::emptyValue();
+ return entry->second;
+ }
+
+ template<typename T, typename U, typename V, typename W, typename MappedTraits>
+ typename HashMap<RefPtr<T>, U, V, W, MappedTraits>::MappedType
+ HashMap<RefPtr<T>, U, V, W, MappedTraits>::get(RawKeyType key) const
+ {
+ return inlineGet(key);
+ }
+
+ template<typename T, typename U, typename V, typename W, typename X>
+ inline void HashMap<RefPtr<T>, U, V, W, X>::remove(iterator it)
+ {
+ if (it.m_impl == m_impl.end())
+ return;
+ m_impl.internalCheckTableConsistency();
+ m_impl.removeWithoutEntryConsistencyCheck(it.m_impl);
+ }
+
+ template<typename T, typename U, typename V, typename W, typename X>
+ inline void HashMap<RefPtr<T>, U, V, W, X>::remove(const KeyType& key)
+ {
+ remove(find(key));
+ }
+
+ template<typename T, typename U, typename V, typename W, typename X>
+ inline void HashMap<RefPtr<T>, U, V, W, X>::remove(RawKeyType key)
+ {
+ remove(find(key));
+ }
+
+ template<typename T, typename U, typename V, typename W, typename X>
+ inline void HashMap<RefPtr<T>, U, V, W, X>::clear()
+ {
+ m_impl.clear();
+ }
+
+ template<typename T, typename U, typename V, typename W, typename MappedTraits>
+ typename HashMap<RefPtr<T>, U, V, W, MappedTraits>::MappedType
+ HashMap<RefPtr<T>, U, V, W, MappedTraits>::take(const KeyType& key)
+ {
+ // This can probably be made more efficient to avoid ref/deref churn.
+ iterator it = find(key);
+ if (it == end())
+ return MappedTraits::emptyValue();
+ typename HashMap<RefPtr<T>, U, V, W, MappedTraits>::MappedType result = it->second;
+ remove(it);
+ return result;
+ }
+
+ template<typename T, typename U, typename V, typename W, typename MappedTraits>
+ typename HashMap<RefPtr<T>, U, V, W, MappedTraits>::MappedType
+ HashMap<RefPtr<T>, U, V, W, MappedTraits>::take(RawKeyType key)
+ {
+ // This can probably be made more efficient to avoid ref/deref churn.
+ iterator it = find(key);
+ if (it == end())
+ return MappedTraits::emptyValue();
+ typename HashMap<RefPtr<T>, U, V, W, MappedTraits>::MappedType result = it->second;
+ remove(it);
+ return result;
+ }
+
+} // namespace WTF
diff --git a/Source/JavaScriptCore/wtf/RetainPtr.h b/Source/JavaScriptCore/wtf/RetainPtr.h
new file mode 100644
index 0000000..fa7c163
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/RetainPtr.h
@@ -0,0 +1,257 @@
+/*
+ * Copyright (C) 2005, 2006, 2007, 2008, 2010 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef RetainPtr_h
+#define RetainPtr_h
+
+#include "HashTraits.h"
+#include "NullPtr.h"
+#include "TypeTraits.h"
+#include <algorithm>
+#include <CoreFoundation/CoreFoundation.h>
+
+#ifdef __OBJC__
+#import <Foundation/Foundation.h>
+#endif
+
+namespace WTF {
+
+ // Unlike most most of our smart pointers, RetainPtr can take either the pointer type or the pointed-to type,
+ // so both RetainPtr<NSDictionary> and RetainPtr<CFDictionaryRef> will work.
+
+ enum AdoptCFTag { AdoptCF };
+ enum AdoptNSTag { AdoptNS };
+
+#ifdef __OBJC__
+ inline void adoptNSReference(id ptr)
+ {
+ if (ptr) {
+ CFRetain(ptr);
+ [ptr release];
+ }
+ }
+#endif
+
+ template<typename T> class RetainPtr {
+ public:
+ typedef typename RemovePointer<T>::Type ValueType;
+ typedef ValueType* PtrType;
+
+ RetainPtr() : m_ptr(0) {}
+ RetainPtr(PtrType ptr) : m_ptr(ptr) { if (ptr) CFRetain(ptr); }
+
+ RetainPtr(AdoptCFTag, PtrType ptr) : m_ptr(ptr) { }
+ RetainPtr(AdoptNSTag, PtrType ptr) : m_ptr(ptr) { adoptNSReference(ptr); }
+
+ RetainPtr(const RetainPtr& o) : m_ptr(o.m_ptr) { if (PtrType ptr = m_ptr) CFRetain(ptr); }
+
+ // Hash table deleted values, which are only constructed and never copied or destroyed.
+ RetainPtr(HashTableDeletedValueType) : m_ptr(hashTableDeletedValue()) { }
+ bool isHashTableDeletedValue() const { return m_ptr == hashTableDeletedValue(); }
+
+ ~RetainPtr() { if (PtrType ptr = m_ptr) CFRelease(ptr); }
+
+ template<typename U> RetainPtr(const RetainPtr<U>&);
+
+ PtrType get() const { return m_ptr; }
+
+ void clear();
+ PtrType leakRef() WARN_UNUSED_RETURN;
+
+ PtrType operator->() const { return m_ptr; }
+
+ bool operator!() const { return !m_ptr; }
+
+ // This conversion operator allows implicit conversion to bool but not to other integer types.
+ typedef PtrType RetainPtr::*UnspecifiedBoolType;
+ operator UnspecifiedBoolType() const { return m_ptr ? &RetainPtr::m_ptr : 0; }
+
+ RetainPtr& operator=(const RetainPtr&);
+ template<typename U> RetainPtr& operator=(const RetainPtr<U>&);
+ RetainPtr& operator=(PtrType);
+ template<typename U> RetainPtr& operator=(U*);
+#if !HAVE(NULLPTR)
+ RetainPtr& operator=(std::nullptr_t) { clear(); return *this; }
+#endif
+
+ void adoptCF(PtrType);
+ void adoptNS(PtrType);
+
+ void swap(RetainPtr&);
+
+ // FIXME: Remove releaseRef once we change all callers to call leakRef instead.
+ PtrType releaseRef() { return leakRef(); }
+
+ private:
+ static T* hashTableDeletedValue() { return reinterpret_cast<T*>(-1); }
+
+ PtrType m_ptr;
+ };
+
+ template<typename T> template<typename U> inline RetainPtr<T>::RetainPtr(const RetainPtr<U>& o)
+ : m_ptr(o.get())
+ {
+ if (PtrType ptr = m_ptr)
+ CFRetain(ptr);
+ }
+
+ template<typename T> inline void RetainPtr<T>::clear()
+ {
+ if (PtrType ptr = m_ptr) {
+ m_ptr = 0;
+ CFRelease(ptr);
+ }
+ }
+
+ template<typename T> inline typename RetainPtr<T>::PtrType RetainPtr<T>::leakRef()
+ {
+ PtrType ptr = m_ptr;
+ m_ptr = 0;
+ return ptr;
+ }
+
+ template<typename T> inline RetainPtr<T>& RetainPtr<T>::operator=(const RetainPtr<T>& o)
+ {
+ PtrType optr = o.get();
+ if (optr)
+ CFRetain(optr);
+ PtrType ptr = m_ptr;
+ m_ptr = optr;
+ if (ptr)
+ CFRelease(ptr);
+ return *this;
+ }
+
+ template<typename T> template<typename U> inline RetainPtr<T>& RetainPtr<T>::operator=(const RetainPtr<U>& o)
+ {
+ PtrType optr = o.get();
+ if (optr)
+ CFRetain(optr);
+ PtrType ptr = m_ptr;
+ m_ptr = optr;
+ if (ptr)
+ CFRelease(ptr);
+ return *this;
+ }
+
+ template<typename T> inline RetainPtr<T>& RetainPtr<T>::operator=(PtrType optr)
+ {
+ if (optr)
+ CFRetain(optr);
+ PtrType ptr = m_ptr;
+ m_ptr = optr;
+ if (ptr)
+ CFRelease(ptr);
+ return *this;
+ }
+
+ template<typename T> inline void RetainPtr<T>::adoptCF(PtrType optr)
+ {
+ PtrType ptr = m_ptr;
+ m_ptr = optr;
+ if (ptr)
+ CFRelease(ptr);
+ }
+
+ template<typename T> inline void RetainPtr<T>::adoptNS(PtrType optr)
+ {
+ adoptNSReference(optr);
+
+ PtrType ptr = m_ptr;
+ m_ptr = optr;
+ if (ptr)
+ CFRelease(ptr);
+ }
+
+ template<typename T> template<typename U> inline RetainPtr<T>& RetainPtr<T>::operator=(U* optr)
+ {
+ if (optr)
+ CFRetain(optr);
+ PtrType ptr = m_ptr;
+ m_ptr = optr;
+ if (ptr)
+ CFRelease(ptr);
+ return *this;
+ }
+
+ template<typename T> inline void RetainPtr<T>::swap(RetainPtr<T>& o)
+ {
+ std::swap(m_ptr, o.m_ptr);
+ }
+
+ template<typename T> inline void swap(RetainPtr<T>& a, RetainPtr<T>& b)
+ {
+ a.swap(b);
+ }
+
+ template<typename T, typename U> inline bool operator==(const RetainPtr<T>& a, const RetainPtr<U>& b)
+ {
+ return a.get() == b.get();
+ }
+
+ template<typename T, typename U> inline bool operator==(const RetainPtr<T>& a, U* b)
+ {
+ return a.get() == b;
+ }
+
+ template<typename T, typename U> inline bool operator==(T* a, const RetainPtr<U>& b)
+ {
+ return a == b.get();
+ }
+
+ template<typename T, typename U> inline bool operator!=(const RetainPtr<T>& a, const RetainPtr<U>& b)
+ {
+ return a.get() != b.get();
+ }
+
+ template<typename T, typename U> inline bool operator!=(const RetainPtr<T>& a, U* b)
+ {
+ return a.get() != b;
+ }
+
+ template<typename T, typename U> inline bool operator!=(T* a, const RetainPtr<U>& b)
+ {
+ return a != b.get();
+ }
+
+ template<typename P> struct HashTraits<RetainPtr<P> > : GenericHashTraits<RetainPtr<P> > {
+ static const bool emptyValueIsZero = true;
+ static void constructDeletedValue(RetainPtr<P>& slot) { new (&slot) RetainPtr<P>(HashTableDeletedValue); }
+ static bool isDeletedValue(const RetainPtr<P>& value) { return value == reinterpret_cast<P*>(-1); }
+ };
+
+ template<typename P> struct PtrHash<RetainPtr<P> > : PtrHash<P*> {
+ using PtrHash<P*>::hash;
+ static unsigned hash(const RetainPtr<P>& key) { return hash(key.get()); }
+ using PtrHash<P*>::equal;
+ static bool equal(const RetainPtr<P>& a, const RetainPtr<P>& b) { return a == b; }
+ static bool equal(P* a, const RetainPtr<P>& b) { return a == b; }
+ static bool equal(const RetainPtr<P>& a, P* b) { return a == b; }
+ };
+
+ template<typename P> struct DefaultHash<RetainPtr<P> > { typedef PtrHash<RetainPtr<P> > Hash; };
+
+} // namespace WTF
+
+using WTF::AdoptCF;
+using WTF::AdoptNS;
+using WTF::RetainPtr;
+
+#endif // WTF_RetainPtr_h
diff --git a/Source/JavaScriptCore/wtf/SegmentedVector.h b/Source/JavaScriptCore/wtf/SegmentedVector.h
new file mode 100644
index 0000000..b1cbc4d
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/SegmentedVector.h
@@ -0,0 +1,255 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SegmentedVector_h
+#define SegmentedVector_h
+
+#include <wtf/Vector.h>
+
+namespace WTF {
+
+ // An iterator for SegmentedVector. It supports only the pre ++ operator
+ template <typename T, size_t SegmentSize> class SegmentedVector;
+ template <typename T, size_t SegmentSize> class SegmentedVectorIterator {
+ private:
+ friend class SegmentedVector<T, SegmentSize>;
+ public:
+ typedef SegmentedVectorIterator<T, SegmentSize> Iterator;
+
+ ~SegmentedVectorIterator() { }
+
+ T& operator*() const { return m_vector.m_segments.at(m_segment)->at(m_index); }
+ T* operator->() const { return &m_vector.m_segments.at(m_segment)->at(m_index); }
+
+ // Only prefix ++ operator supported
+ Iterator& operator++()
+ {
+ ASSERT(m_index != SegmentSize);
+ ++m_index;
+ if (m_index >= m_vector.m_segments.at(m_segment)->size()) {
+ if (m_segment + 1 < m_vector.m_segments.size()) {
+ ASSERT(m_vector.m_segments.at(m_segment)->size() > 0);
+ ++m_segment;
+ m_index = 0;
+ } else {
+ // Points to the "end" symbol
+ m_segment = 0;
+ m_index = SegmentSize;
+ }
+ }
+ return *this;
+ }
+
+ bool operator==(const Iterator& other) const
+ {
+ return (m_index == other.m_index && m_segment = other.m_segment && &m_vector == &other.m_vector);
+ }
+
+ bool operator!=(const Iterator& other) const
+ {
+ return (m_index != other.m_index || m_segment != other.m_segment || &m_vector != &other.m_vector);
+ }
+
+ SegmentedVectorIterator& operator=(const SegmentedVectorIterator<T, SegmentSize>& other)
+ {
+ m_vector = other.m_vector;
+ m_segment = other.m_segment;
+ m_index = other.m_index;
+ return *this;
+ }
+
+ private:
+ SegmentedVectorIterator(SegmentedVector<T, SegmentSize>& vector, size_t segment, size_t index)
+ : m_vector(vector)
+ , m_segment(segment)
+ , m_index(index)
+ {
+ }
+
+ SegmentedVector<T, SegmentSize>& m_vector;
+ size_t m_segment;
+ size_t m_index;
+ };
+
+ // SegmentedVector is just like Vector, but it doesn't move the values
+ // stored in its buffer when it grows. Therefore, it is safe to keep
+ // pointers into a SegmentedVector.
+ template <typename T, size_t SegmentSize> class SegmentedVector {
+ friend class SegmentedVectorIterator<T, SegmentSize>;
+ public:
+ typedef SegmentedVectorIterator<T, SegmentSize> Iterator;
+
+ SegmentedVector()
+ : m_size(0)
+ {
+ m_segments.append(&m_inlineSegment);
+ }
+
+ ~SegmentedVector()
+ {
+ deleteAllSegments();
+ }
+
+ size_t size() const { return m_size; }
+ bool isEmpty() const { return !size(); }
+
+ T& at(size_t index)
+ {
+ if (index < SegmentSize)
+ return m_inlineSegment[index];
+ return segmentFor(index)->at(subscriptFor(index));
+ }
+
+ T& operator[](size_t index)
+ {
+ return at(index);
+ }
+
+ T& last()
+ {
+ return at(size() - 1);
+ }
+
+ template <typename U> void append(const U& value)
+ {
+ ++m_size;
+
+ if (m_size <= SegmentSize) {
+ m_inlineSegment.uncheckedAppend(value);
+ return;
+ }
+
+ if (!segmentExistsFor(m_size - 1))
+ m_segments.append(new Segment);
+ segmentFor(m_size - 1)->uncheckedAppend(value);
+ }
+
+ T& alloc()
+ {
+ append<T>(T());
+ return last();
+ }
+
+ void removeLast()
+ {
+ if (m_size <= SegmentSize)
+ m_inlineSegment.removeLast();
+ else
+ segmentFor(m_size - 1)->removeLast();
+ --m_size;
+ }
+
+ void grow(size_t size)
+ {
+ ASSERT(size > m_size);
+ ensureSegmentsFor(size);
+ m_size = size;
+ }
+
+ void clear()
+ {
+ deleteAllSegments();
+ m_segments.resize(1);
+ m_inlineSegment.clear();
+ m_size = 0;
+ }
+
+ Iterator begin()
+ {
+ return Iterator(*this, 0, m_size ? 0 : SegmentSize);
+ }
+
+ Iterator end()
+ {
+ return Iterator(*this, 0, SegmentSize);
+ }
+
+ private:
+ typedef Vector<T, SegmentSize> Segment;
+
+ void deleteAllSegments()
+ {
+ // Skip the first segment, because it's our inline segment, which was
+ // not created by new.
+ for (size_t i = 1; i < m_segments.size(); i++)
+ delete m_segments[i];
+ }
+
+ bool segmentExistsFor(size_t index)
+ {
+ return index / SegmentSize < m_segments.size();
+ }
+
+ Segment* segmentFor(size_t index)
+ {
+ return m_segments[index / SegmentSize];
+ }
+
+ size_t subscriptFor(size_t index)
+ {
+ return index % SegmentSize;
+ }
+
+ void ensureSegmentsFor(size_t size)
+ {
+ size_t segmentCount = m_size / SegmentSize;
+ if (m_size % SegmentSize)
+ ++segmentCount;
+ segmentCount = std::max<size_t>(segmentCount, 1); // We always have at least our inline segment.
+
+ size_t neededSegmentCount = size / SegmentSize;
+ if (size % SegmentSize)
+ ++neededSegmentCount;
+
+ // Fill up to N - 1 segments.
+ size_t end = neededSegmentCount - 1;
+ for (size_t i = segmentCount - 1; i < end; ++i)
+ ensureSegment(i, SegmentSize);
+
+ // Grow segment N to accomodate the remainder.
+ ensureSegment(end, subscriptFor(size - 1) + 1);
+ }
+
+ void ensureSegment(size_t segmentIndex, size_t size)
+ {
+ ASSERT(segmentIndex <= m_segments.size());
+ if (segmentIndex == m_segments.size())
+ m_segments.append(new Segment);
+ m_segments[segmentIndex]->grow(size);
+ }
+
+ size_t m_size;
+ Segment m_inlineSegment;
+ Vector<Segment*, 32> m_segments;
+ };
+
+} // namespace WTF
+
+using WTF::SegmentedVector;
+
+#endif // SegmentedVector_h
diff --git a/Source/JavaScriptCore/wtf/SizeLimits.cpp b/Source/JavaScriptCore/wtf/SizeLimits.cpp
new file mode 100644
index 0000000..4e481bb
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/SizeLimits.cpp
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#include <wtf/Assertions.h>
+#include <wtf/CrossThreadRefCounted.h>
+#include <wtf/OwnPtr.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/RefPtr.h>
+#include <wtf/Vector.h>
+
+namespace WTF {
+
+#ifndef NDEBUG
+struct StructWithIntAndTwoBools { int a; bool b; bool c; };
+static const size_t refCountedExtraDebugSize = sizeof(StructWithIntAndTwoBools) - sizeof(int);
+#else
+static const size_t refCountedExtraDebugSize = 0;
+#endif
+
+COMPILE_ASSERT(sizeof(OwnPtr<int>) == sizeof(int*), OwnPtr_should_stay_small);
+COMPILE_ASSERT(sizeof(PassRefPtr<RefCounted<int> >) == sizeof(int*), PassRefPtr_should_stay_small);
+COMPILE_ASSERT(sizeof(RefCounted<int>) == sizeof(int) + refCountedExtraDebugSize, RefCounted_should_stay_small);
+COMPILE_ASSERT(sizeof(RefCountedCustomAllocated<int>) == sizeof(int) + refCountedExtraDebugSize, RefCountedCustomAllocated_should_stay_small);
+COMPILE_ASSERT(sizeof(RefPtr<RefCounted<int> >) == sizeof(int*), RefPtr_should_stay_small);
+COMPILE_ASSERT(sizeof(Vector<int>) == 3 * sizeof(int*), Vector_should_stay_small);
+
+}
diff --git a/Source/JavaScriptCore/wtf/StackBounds.cpp b/Source/JavaScriptCore/wtf/StackBounds.cpp
new file mode 100644
index 0000000..f83695e
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/StackBounds.cpp
@@ -0,0 +1,283 @@
+/*
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#include "config.h"
+#include "StackBounds.h"
+
+#if OS(DARWIN)
+
+#include <mach/task.h>
+#include <mach/thread_act.h>
+#include <pthread.h>
+
+#elif OS(WINDOWS)
+
+#include <windows.h>
+
+#elif OS(HAIKU)
+
+#include <OS.h>
+
+#elif OS(SOLARIS)
+
+#include <thread.h>
+
+#elif OS(QNX)
+
+#include <fcntl.h>
+#include <sys/procfs.h>
+#include <stdio.h>
+#include <errno.h>
+
+#elif OS(UNIX)
+
+#include <pthread.h>
+#if HAVE(PTHREAD_NP_H)
+#include <pthread_np.h>
+#endif
+
+#endif
+
+namespace WTF {
+
+// Bug 26276 - Need a mechanism to determine stack extent
+//
+// These platforms should now be working correctly:
+// DARWIN, WINDOWS-CPU(X86), QNX, UNIX, WINCE
+// These platforms are not:
+// WINDOWS-CPU(X86_64), SOLARIS, OPENBSD, SYMBIAN, HAIKU
+//
+// FIXME: remove this! - this code unsafely guesses at stack sizes!
+#if (OS(WINDOWS) && CPU(X86_64)) || OS(SOLARIS) || OS(OPENBSD) || OS(SYMBIAN) || OS(HAIKU)
+// Based on the current limit used by the JSC parser, guess the stack size.
+static const ptrdiff_t estimatedStackSize = 128 * sizeof(void*) * 1024;
+// This method assumes the stack is growing downwards.
+static void* estimateStackBound(void* origin)
+{
+ return static_cast<char*>(origin) - estimatedStackSize;
+}
+#endif
+
+#if OS(DARWIN)
+
+void StackBounds::initialize()
+{
+ pthread_t thread = pthread_self();
+ m_origin = pthread_get_stackaddr_np(thread);
+ m_bound = static_cast<char*>(m_origin) - pthread_get_stacksize_np(thread);
+}
+
+#elif OS(QNX)
+
+void StackBounds::initialize()
+{
+ void* stackBase = 0;
+ size_t stackSize = 0;
+ pthread_t thread = pthread_self();
+
+ struct _debug_thread_info threadInfo;
+ memset(&threadInfo, 0, sizeof(threadInfo));
+ threadInfo.tid = pthread_self();
+ int fd = open("/proc/self", O_RDONLY);
+ if (fd == -1) {
+ LOG_ERROR("Unable to open /proc/self (errno: %d)", errno);
+ CRASH();
+ }
+ devctl(fd, DCMD_PROC_TIDSTATUS, &threadInfo, sizeof(threadInfo), 0);
+ close(fd);
+ stackBase = reinterpret_cast<void*>(threadInfo.stkbase);
+ stackSize = threadInfo.stksize;
+ ASSERT(stackBase);
+
+ m_bound = stackBase;
+ m_origin = static_cast<char*>(stackBase) + stackSize;
+}
+
+#elif OS(SOLARIS)
+
+void StackBounds::initialize()
+{
+ stack_t s;
+ thr_stksegment(&s);
+ m_origin = s.ss_sp;
+ m_bound = estimateStackBound(m_origin);
+}
+
+#elif OS(OPENBSD)
+
+void StackBounds::initialize()
+{
+ pthread_t thread = pthread_self();
+ stack_t stack;
+ pthread_stackseg_np(thread, &stack);
+ m_origin = stack.ss_sp;
+ m_bound = estimateStackBound(m_origin);
+}
+
+#elif OS(SYMBIAN)
+
+void StackBounds::initialize()
+{
+ TThreadStackInfo info;
+ RThread thread;
+ thread.StackInfo(info);
+ m_origin = (void*)info.iBase;
+ m_bound = estimateStackBound(m_origin);
+}
+
+#elif OS(HAIKU)
+
+void StackBounds::initialize()
+{
+ thread_info threadInfo;
+ get_thread_info(find_thread(NULL), &threadInfo);
+ m_origin = threadInfo.stack_end;
+ m_bound = estimateStackBound(m_origin);
+}
+
+#elif OS(UNIX)
+
+void StackBounds::initialize()
+{
+ void* stackBase = 0;
+ size_t stackSize = 0;
+
+ pthread_t thread = pthread_self();
+ pthread_attr_t sattr;
+ pthread_attr_init(&sattr);
+#if HAVE(PTHREAD_NP_H) || OS(NETBSD)
+ // e.g. on FreeBSD 5.4, neundorf@kde.org
+ pthread_attr_get_np(thread, &sattr);
+#else
+ // FIXME: this function is non-portable; other POSIX systems may have different np alternatives
+ pthread_getattr_np(thread, &sattr);
+#endif
+ int rc = pthread_attr_getstack(&sattr, &stackBase, &stackSize);
+ (void)rc; // FIXME: Deal with error code somehow? Seems fatal.
+ ASSERT(stackBase);
+ pthread_attr_destroy(&sattr);
+ m_bound = stackBase;
+ m_origin = static_cast<char*>(stackBase) + stackSize;
+}
+
+#elif OS(WINCE)
+
+static bool detectGrowingDownward(void* previousFrame)
+{
+ // Find the address of this stack frame by taking the address of a local variable.
+ int thisFrame;
+ return previousFrame > &thisFrame;
+}
+
+static inline bool isPageWritable(void* page)
+{
+ MEMORY_BASIC_INFORMATION memoryInformation;
+ DWORD result = VirtualQuery(page, &memoryInformation, sizeof(memoryInformation));
+
+ // return false on error, including ptr outside memory
+ if (result != sizeof(memoryInformation))
+ return false;
+
+ DWORD protect = memoryInformation.Protect & ~(PAGE_GUARD | PAGE_NOCACHE);
+ return protect == PAGE_READWRITE
+ || protect == PAGE_WRITECOPY
+ || protect == PAGE_EXECUTE_READWRITE
+ || protect == PAGE_EXECUTE_WRITECOPY;
+}
+
+static inline void* getLowerStackBound(char* currentPage, DWORD pageSize)
+{
+ while (currentPage > 0) {
+ // check for underflow
+ if (currentPage >= reinterpret_cast<char*>(pageSize))
+ currentPage -= pageSize;
+ else
+ currentPage = 0;
+
+ if (!isPageWritable(currentPage))
+ return currentPage + pageSize;
+ }
+
+ return 0;
+}
+
+static inline void* getUpperStackBound(char* currentPage, DWORD pageSize)
+{
+ do {
+ // guaranteed to complete because isPageWritable returns false at end of memory
+ currentPage += pageSize;
+ } while (isPageWritable(currentPage));
+
+ return currentPage - pageSize;
+}
+
+void StackBounds::initialize()
+{
+ // find the address of this stack frame by taking the address of a local variable
+ void* thisFrame = &thisFrame;
+ bool isGrowingDownward = detectGrowingDownward(thisFrame);
+
+ SYSTEM_INFO systemInfo;
+ GetSystemInfo(&systemInfo);
+ DWORD pageSize = systemInfo.dwPageSize;
+
+ // scan all of memory starting from this frame, and return the last writeable page found
+ char* currentPage = reinterpret_cast<char*>(reinterpret_cast<DWORD>(thisFrame) & ~(pageSize - 1));
+ void* lowerStackBound = getLowerStackBound(currentPage, pageSize);
+ void* upperStackBound = getUpperStackBound(currentPage, pageSize);
+
+ m_origin = isGrowingDownward ? upperStackBound : lowerStackBound;
+ m_bound = isGrowingDownward ? lowerStackBound : upperStackBound;
+}
+
+#elif OS(WINDOWS) && (CPU(X86) || CPU(X86_64))
+
+void StackBounds::initialize()
+{
+#if CPU(X86)
+ // Offset 0x18 from the FS segment register gives a pointer to
+ // the thread information block for the current thread.
+ NT_TIB* pTib;
+#if COMPILER(MSVC)
+ __asm {
+ MOV EAX, FS:[18h]
+ MOV pTib, EAX
+ }
+#else
+ asm ( "movl %%fs:0x18, %0\n"
+ : "=r" (pTib)
+ );
+#endif
+ // See http://en.wikipedia.org/wiki/Win32_Thread_Information_Block for more information!
+ void* pDeallocationStack = reinterpret_cast<char*>(pTib) + 0xE0C;
+ m_origin = static_cast<void*>(pTib->StackBase);
+ m_bound = *static_cast<void**>(pDeallocationStack);
+#elif CPU(X86_64)
+ PNT_TIB64 pTib = reinterpret_cast<PNT_TIB64>(NtCurrentTeb());
+ m_origin = reinterpret_cast<void*>(pTib->StackBase);
+ m_bound = estimateStackBound(m_origin);
+#endif
+}
+
+#else
+#error Need a way to get the stack bounds on this platform.
+#endif
+
+} // namespace WTF
diff --git a/Source/JavaScriptCore/wtf/StackBounds.h b/Source/JavaScriptCore/wtf/StackBounds.h
new file mode 100644
index 0000000..afce860
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/StackBounds.h
@@ -0,0 +1,114 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef StackBounds_h
+#define StackBounds_h
+
+namespace WTF {
+
+class StackBounds {
+ // recursionCheck() / recursionLimit() tests (by default)
+ // that we are at least this far from the end of the stack.
+ const static size_t s_defaultAvailabilityDelta = 4096;
+
+public:
+ StackBounds()
+ : m_origin(0)
+ , m_bound(0)
+ {
+ }
+
+ static StackBounds currentThreadStackBounds()
+ {
+ StackBounds bounds;
+ bounds.initialize();
+ bounds.checkConsistency();
+ return bounds;
+ }
+
+ void* origin() const
+ {
+ ASSERT(m_origin);
+ return m_origin;
+ }
+
+ void* current() const
+ {
+ checkConsistency();
+ void* currentPosition = &currentPosition;
+ return currentPosition;
+ }
+
+ void* recursionLimit(size_t minAvailableDelta = s_defaultAvailabilityDelta) const
+ {
+ checkConsistency();
+ return isGrowingDownward()
+ ? static_cast<char*>(m_bound) + minAvailableDelta
+ : static_cast<char*>(m_bound) - minAvailableDelta;
+ }
+
+ bool recursionCheck(size_t minAvailableDelta = s_defaultAvailabilityDelta) const
+ {
+ checkConsistency();
+ return isGrowingDownward()
+ ? current() >= recursionLimit(minAvailableDelta)
+ : current() <= recursionLimit(minAvailableDelta);
+ }
+
+private:
+ void initialize();
+
+
+ bool isGrowingDownward() const
+ {
+ ASSERT(m_origin && m_bound);
+#if OS(WINCE)
+ return m_origin > m_bound;
+#else
+ return true;
+#endif
+ }
+
+ void checkConsistency() const
+ {
+#if !ASSERT_DISABLED
+ void* currentPosition = &currentPosition;
+ ASSERT(m_origin != m_bound);
+ ASSERT(isGrowingDownward()
+ ? (currentPosition < m_origin && currentPosition > m_bound)
+ : (currentPosition > m_origin && currentPosition < m_bound));
+#endif
+ }
+
+ void* m_origin;
+ void* m_bound;
+};
+
+} // namespace WTF
+
+using WTF::StackBounds;
+
+#endif
diff --git a/Source/JavaScriptCore/wtf/StaticConstructors.h b/Source/JavaScriptCore/wtf/StaticConstructors.h
new file mode 100644
index 0000000..8b2df9d
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/StaticConstructors.h
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef StaticConstructors_h
+#define StaticConstructors_h
+
+// We need to avoid having static constructors. We achieve this
+// with two separate methods for GCC and MSVC. Both methods prevent the static
+// initializers from being registered and called on program startup. On GCC, we
+// declare the global objects with a different type that can be POD default
+// initialized by the linker/loader. On MSVC we use a special compiler feature
+// to have the CRT ignore our static initializers. The constructors will never
+// be called and the objects will be left uninitialized.
+//
+// With both of these approaches, we must define and explicitly call an init
+// routine that uses placement new to create the objects and overwrite the
+// uninitialized placeholders.
+//
+// This is not completely portable, but is what we have for now without
+// changing how a lot of code accesses these global objects.
+
+#ifdef SKIP_STATIC_CONSTRUCTORS_ON_MSVC
+// - Assume that all includes of this header want ALL of their static
+// initializers ignored. This is currently the case. This means that if
+// a .cc includes this header (or it somehow gets included), all static
+// initializers after the include will not be executed.
+// - We do this with a pragma, so that all of the static initializer pointers
+// go into our own section, and the CRT won't call them. Eventually it would
+// be nice if the section was discarded, because we don't want the pointers.
+// See: http://msdn.microsoft.com/en-us/library/7977wcck(VS.80).aspx
+#pragma warning(disable:4075)
+#pragma init_seg(".unwantedstaticinits")
+#endif
+
+#ifndef SKIP_STATIC_CONSTRUCTORS_ON_GCC
+ // Define an global in the normal way.
+#if COMPILER(MSVC7_OR_LOWER)
+#define DEFINE_GLOBAL(type, name) \
+ const type name;
+#elif COMPILER(WINSCW)
+#define DEFINE_GLOBAL(type, name, arg...) \
+ const type name;
+#else
+#define DEFINE_GLOBAL(type, name, ...) \
+ const type name;
+#endif
+
+#else
+// Define an correctly-sized array of pointers to avoid static initialization.
+// Use an array of pointers instead of an array of char in case there is some alignment issue.
+#if COMPILER(MSVC7_OR_LOWER)
+#define DEFINE_GLOBAL(type, name) \
+ void * name[(sizeof(type) + sizeof(void *) - 1) / sizeof(void *)];
+#elif COMPILER(WINSCW)
+#define DEFINE_GLOBAL(type, name, arg...) \
+ void * name[(sizeof(type) + sizeof(void *) - 1) / sizeof(void *)];
+#else
+#define DEFINE_GLOBAL(type, name, ...) \
+ void * name[(sizeof(type) + sizeof(void *) - 1) / sizeof(void *)];
+#endif
+#endif
+
+#endif // StaticConstructors_h
diff --git a/Source/JavaScriptCore/wtf/StdLibExtras.h b/Source/JavaScriptCore/wtf/StdLibExtras.h
new file mode 100644
index 0000000..4bb0076
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/StdLibExtras.h
@@ -0,0 +1,119 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WTF_StdLibExtras_h
+#define WTF_StdLibExtras_h
+
+#include <wtf/Assertions.h>
+
+// Use these to declare and define a static local variable (static T;) so that
+// it is leaked so that its destructors are not called at exit. Using this
+// macro also allows workarounds a compiler bug present in Apple's version of GCC 4.0.1.
+#ifndef DEFINE_STATIC_LOCAL
+#if COMPILER(GCC) && defined(__APPLE_CC__) && __GNUC__ == 4 && __GNUC_MINOR__ == 0 && __GNUC_PATCHLEVEL__ == 1
+#define DEFINE_STATIC_LOCAL(type, name, arguments) \
+ static type* name##Ptr = new type arguments; \
+ type& name = *name##Ptr
+#else
+#define DEFINE_STATIC_LOCAL(type, name, arguments) \
+ static type& name = *new type arguments
+#endif
+#endif
+
+// OBJECT_OFFSETOF: Like the C++ offsetof macro, but you can use it with classes.
+// The magic number 0x4000 is insignificant. We use it to avoid using NULL, since
+// NULL can cause compiler problems, especially in cases of multiple inheritance.
+#define OBJECT_OFFSETOF(class, field) (reinterpret_cast<ptrdiff_t>(&(reinterpret_cast<class*>(0x4000)->field)) - 0x4000)
+
+// STRINGIZE: Can convert any value to quoted string, even expandable macros
+#define STRINGIZE(exp) #exp
+#define STRINGIZE_VALUE_OF(exp) STRINGIZE(exp)
+
+/*
+ * The reinterpret_cast<Type1*>([pointer to Type2]) expressions - where
+ * sizeof(Type1) > sizeof(Type2) - cause the following warning on ARM with GCC:
+ * increases required alignment of target type.
+ *
+ * An implicit or an extra static_cast<void*> bypasses the warning.
+ * For more info see the following bugzilla entries:
+ * - https://bugs.webkit.org/show_bug.cgi?id=38045
+ * - http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43976
+ */
+#if (CPU(ARM) || CPU(MIPS)) && COMPILER(GCC)
+template<typename Type>
+bool isPointerTypeAlignmentOkay(Type* ptr)
+{
+ return !(reinterpret_cast<intptr_t>(ptr) % __alignof__(Type));
+}
+
+template<typename TypePtr>
+TypePtr reinterpret_cast_ptr(void* ptr)
+{
+ ASSERT(isPointerTypeAlignmentOkay(reinterpret_cast<TypePtr>(ptr)));
+ return reinterpret_cast<TypePtr>(ptr);
+}
+
+template<typename TypePtr>
+TypePtr reinterpret_cast_ptr(const void* ptr)
+{
+ ASSERT(isPointerTypeAlignmentOkay(reinterpret_cast<TypePtr>(ptr)));
+ return reinterpret_cast<TypePtr>(ptr);
+}
+#else
+#define reinterpret_cast_ptr reinterpret_cast
+#endif
+
+namespace WTF {
+
+/*
+ * C++'s idea of a reinterpret_cast lacks sufficient cojones.
+ */
+template<typename TO, typename FROM>
+inline TO bitwise_cast(FROM from)
+{
+ COMPILE_ASSERT(sizeof(TO) == sizeof(FROM), WTF_bitwise_cast_sizeof_casted_types_is_equal);
+ union {
+ FROM from;
+ TO to;
+ } u;
+ u.from = from;
+ return u.to;
+}
+
+// Returns a count of the number of bits set in 'bits'.
+inline size_t bitCount(unsigned bits)
+{
+ bits = bits - ((bits >> 1) & 0x55555555);
+ bits = (bits & 0x33333333) + ((bits >> 2) & 0x33333333);
+ return (((bits + (bits >> 4)) & 0xF0F0F0F) * 0x1010101) >> 24;
+}
+
+// Macro that returns a compile time constant with the length of an array, but gives an error if passed a non-array.
+template<typename T, size_t Size> char (&ArrayLengthHelperFunction(T (&)[Size]))[Size];
+#define WTF_ARRAY_LENGTH(array) sizeof(::WTF::ArrayLengthHelperFunction(array))
+
+} // namespace WTF
+
+#endif // WTF_StdLibExtras_h
diff --git a/Source/JavaScriptCore/wtf/StringExtras.cpp b/Source/JavaScriptCore/wtf/StringExtras.cpp
new file mode 100644
index 0000000..1b96417
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/StringExtras.cpp
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2009 Company 100, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if COMPILER(RVCT) && __ARMCC_VERSION < 400000
+
+#include "StringExtras.h"
+
+#include "ASCIICType.h"
+
+int strcasecmp(const char* s1, const char* s2)
+{
+ while (toASCIIUpper(*s1) == toASCIIUpper(*s2)) {
+ if (*s1 == '\0')
+ return 0;
+ s1++;
+ s2++;
+ }
+
+ return toASCIIUpper(*s1) - toASCIIUpper(*s2);
+}
+
+int strncasecmp(const char* s1, const char* s2, size_t len)
+{
+ while (len > 0 && toASCIIUpper(*s1) == toASCIIUpper(*s2)) {
+ if (*s1 == '\0')
+ return 0;
+ s1++;
+ s2++;
+ len--;
+ }
+
+ if (!len)
+ return 0;
+
+ return toASCIIUpper(*s1) - toASCIIUpper(*s2);
+}
+
+#endif
diff --git a/Source/JavaScriptCore/wtf/StringExtras.h b/Source/JavaScriptCore/wtf/StringExtras.h
new file mode 100644
index 0000000..473bb22
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/StringExtras.h
@@ -0,0 +1,127 @@
+/*
+ * Copyright (C) 2006, 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WTF_StringExtras_h
+#define WTF_StringExtras_h
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <string.h>
+
+#if HAVE(STRINGS_H)
+#include <strings.h>
+#endif
+
+#if COMPILER(MSVC)
+// FIXME: why a COMPILER check instead of OS? also, these should be HAVE checks
+
+inline int snprintf(char* buffer, size_t count, const char* format, ...)
+{
+ int result;
+ va_list args;
+ va_start(args, format);
+ result = _vsnprintf(buffer, count, format, args);
+ va_end(args);
+
+ // In the case where the string entirely filled the buffer, _vsnprintf will not
+ // null-terminate it, but snprintf must.
+ if (count > 0)
+ buffer[count - 1] = '\0';
+
+ return result;
+}
+
+inline double wtf_vsnprintf(char* buffer, size_t count, const char* format, va_list args)
+{
+ int result = _vsnprintf(buffer, count, format, args);
+
+ // In the case where the string entirely filled the buffer, _vsnprintf will not
+ // null-terminate it, but vsnprintf must.
+ if (count > 0)
+ buffer[count - 1] = '\0';
+
+ return result;
+}
+
+// Work around a difference in Microsoft's implementation of vsnprintf, where
+// vsnprintf does not null terminate the buffer. WebKit can rely on the null termination.
+#define vsnprintf(buffer, count, format, args) wtf_vsnprintf(buffer, count, format, args)
+
+#if OS(WINCE)
+
+inline int strnicmp(const char* string1, const char* string2, size_t count)
+{
+ return _strnicmp(string1, string2, count);
+}
+
+inline int stricmp(const char* string1, const char* string2)
+{
+ return _stricmp(string1, string2);
+}
+
+inline char* strdup(const char* strSource)
+{
+ return _strdup(strSource);
+}
+
+#endif
+
+inline int strncasecmp(const char* s1, const char* s2, size_t len)
+{
+ return _strnicmp(s1, s2, len);
+}
+
+inline int strcasecmp(const char* s1, const char* s2)
+{
+ return _stricmp(s1, s2);
+}
+
+#endif
+
+#if COMPILER(MSVC) || COMPILER(RVCT) || OS(WINDOWS) || OS(LINUX) || OS(SOLARIS)
+// FIXME: should check HAVE_STRNSTR
+
+inline char* strnstr(const char* buffer, const char* target, size_t bufferLength)
+{
+ size_t targetLength = strlen(target);
+ if (targetLength == 0)
+ return const_cast<char*>(buffer);
+ for (const char* start = buffer; *start && start + targetLength <= buffer + bufferLength; start++) {
+ if (*start == *target && strncmp(start + 1, target + 1, targetLength - 1) == 0)
+ return const_cast<char*>(start);
+ }
+ return 0;
+}
+
+#endif
+
+#if COMPILER(RVCT) && __ARMCC_VERSION < 400000
+
+int strcasecmp(const char* s1, const char* s2);
+int strncasecmp(const char* s1, const char* s2, size_t len);
+
+#endif
+
+#endif // WTF_StringExtras_h
diff --git a/Source/JavaScriptCore/wtf/StringHasher.h b/Source/JavaScriptCore/wtf/StringHasher.h
new file mode 100644
index 0000000..63ce74f
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/StringHasher.h
@@ -0,0 +1,170 @@
+/*
+ * Copyright (C) 2005, 2006, 2008, 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010 Patrick Gansterer <paroga@paroga.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+#ifndef WTF_StringHasher_h
+#define WTF_StringHasher_h
+
+#include <wtf/unicode/Unicode.h>
+
+namespace WTF {
+
+// Golden ratio - arbitrary start value to avoid mapping all 0's to all 0's
+static const unsigned stringHashingStartValue = 0x9e3779b9U;
+
+// Paul Hsieh's SuperFastHash
+// http://www.azillionmonkeys.com/qed/hash.html
+// char* data is interpreted as latin-encoded (zero extended to 16 bits).
+class StringHasher {
+public:
+ inline StringHasher()
+ : m_hash(stringHashingStartValue)
+ , m_hasPendingCharacter(false)
+ , m_pendingCharacter(0)
+ {
+ }
+
+ inline void addCharacters(UChar a, UChar b)
+ {
+ ASSERT(!m_hasPendingCharacter);
+ addCharactersToHash(a, b);
+ }
+
+ inline void addCharacter(UChar ch)
+ {
+ if (m_hasPendingCharacter) {
+ addCharactersToHash(m_pendingCharacter, ch);
+ m_hasPendingCharacter = false;
+ return;
+ }
+
+ m_pendingCharacter = ch;
+ m_hasPendingCharacter = true;
+ }
+
+ inline unsigned hash() const
+ {
+ unsigned result = m_hash;
+
+ // Handle end case.
+ if (m_hasPendingCharacter) {
+ result += m_pendingCharacter;
+ result ^= result << 11;
+ result += result >> 17;
+ }
+
+ // Force "avalanching" of final 31 bits.
+ result ^= result << 3;
+ result += result >> 5;
+ result ^= result << 2;
+ result += result >> 15;
+ result ^= result << 10;
+
+ // First bit is used in UStringImpl for m_isIdentifier.
+ result &= 0x7fffffff;
+
+ // This avoids ever returning a hash code of 0, since that is used to
+ // signal "hash not computed yet", using a value that is likely to be
+ // effectively the same as 0 when the low bits are masked.
+ if (!result)
+ return 0x40000000;
+
+ return result;
+ }
+
+ template<typename T, UChar Converter(T)> static inline unsigned createHash(const T* data, unsigned length)
+ {
+ StringHasher hasher;
+ bool rem = length & 1;
+ length >>= 1;
+
+ while (length--) {
+ hasher.addCharacters(Converter(data[0]), Converter(data[1]));
+ data += 2;
+ }
+
+ if (rem)
+ hasher.addCharacter(Converter(*data));
+
+ return hasher.hash();
+ }
+
+ template<typename T, UChar Converter(T)> static inline unsigned createHash(const T* data)
+ {
+ StringHasher hasher;
+
+ while (true) {
+ UChar b0 = Converter(*data++);
+ if (!b0)
+ break;
+ UChar b1 = Converter(*data++);
+ if (!b1) {
+ hasher.addCharacter(b0);
+ break;
+ }
+
+ hasher.addCharacters(b0, b1);
+ }
+
+ return hasher.hash();
+ }
+
+ template<typename T> static inline unsigned createHash(const T* data, unsigned length)
+ {
+ return createHash<T, defaultCoverter>(data, length);
+ }
+
+ template<typename T> static inline unsigned createHash(const T* data)
+ {
+ return createHash<T, defaultCoverter>(data);
+ }
+
+ template<size_t length> static inline unsigned createBlobHash(const void* data)
+ {
+ COMPILE_ASSERT(!(length % 4), length_must_be_a_multible_of_four);
+ return createHash<UChar>(static_cast<const UChar*>(data), length / sizeof(UChar));
+ }
+
+private:
+ static inline UChar defaultCoverter(UChar ch)
+ {
+ return ch;
+ }
+
+ static inline UChar defaultCoverter(char ch)
+ {
+ return static_cast<unsigned char>(ch);
+ }
+
+ inline void addCharactersToHash(UChar a, UChar b)
+ {
+ m_hash += a;
+ unsigned tmp = (b << 11) ^ m_hash;
+ m_hash = (m_hash << 16) ^ tmp;
+ m_hash += m_hash >> 11;
+ }
+
+ unsigned m_hash;
+ bool m_hasPendingCharacter;
+ UChar m_pendingCharacter;
+};
+
+} // namespace WTF
+
+#endif // WTF_StringHasher_h
diff --git a/Source/JavaScriptCore/wtf/TCPackedCache.h b/Source/JavaScriptCore/wtf/TCPackedCache.h
new file mode 100644
index 0000000..0464f8f
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/TCPackedCache.h
@@ -0,0 +1,234 @@
+// Copyright (c) 2007, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// ---
+// Author: Geoff Pike
+//
+// This file provides a minimal cache that can hold a <key, value> pair
+// with little if any wasted space. The types of the key and value
+// must be unsigned integral types or at least have unsigned semantics
+// for >>, casting, and similar operations.
+//
+// Synchronization is not provided. However, the cache is implemented
+// as an array of cache entries whose type is chosen at compile time.
+// If a[i] is atomic on your hardware for the chosen array type then
+// raciness will not necessarily lead to bugginess. The cache entries
+// must be large enough to hold a partial key and a value packed
+// together. The partial keys are bit strings of length
+// kKeybits - kHashbits, and the values are bit strings of length kValuebits.
+//
+// In an effort to use minimal space, every cache entry represents
+// some <key, value> pair; the class provides no way to mark a cache
+// entry as empty or uninitialized. In practice, you may want to have
+// reserved keys or values to get around this limitation. For example, in
+// tcmalloc's PageID-to-sizeclass cache, a value of 0 is used as
+// "unknown sizeclass."
+//
+// Usage Considerations
+// --------------------
+//
+// kHashbits controls the size of the cache. The best value for
+// kHashbits will of course depend on the application. Perhaps try
+// tuning the value of kHashbits by measuring different values on your
+// favorite benchmark. Also remember not to be a pig; other
+// programs that need resources may suffer if you are.
+//
+// The main uses for this class will be when performance is
+// critical and there's a convenient type to hold the cache's
+// entries. As described above, the number of bits required
+// for a cache entry is (kKeybits - kHashbits) + kValuebits. Suppose
+// kKeybits + kValuebits is 43. Then it probably makes sense to
+// chose kHashbits >= 11 so that cache entries fit in a uint32.
+//
+// On the other hand, suppose kKeybits = kValuebits = 64. Then
+// using this class may be less worthwhile. You'll probably
+// be using 128 bits for each entry anyway, so maybe just pick
+// a hash function, H, and use an array indexed by H(key):
+// void Put(K key, V value) { a_[H(key)] = pair<K, V>(key, value); }
+// V GetOrDefault(K key, V default) { const pair<K, V> &p = a_[H(key)]; ... }
+// etc.
+//
+// Further Details
+// ---------------
+//
+// For caches used only by one thread, the following is true:
+// 1. For a cache c,
+// (c.Put(key, value), c.GetOrDefault(key, 0)) == value
+// and
+// (c.Put(key, value), <...>, c.GetOrDefault(key, 0)) == value
+// if the elided code contains no c.Put calls.
+//
+// 2. Has(key) will return false if no <key, value> pair with that key
+// has ever been Put. However, a newly initialized cache will have
+// some <key, value> pairs already present. When you create a new
+// cache, you must specify an "initial value." The initialization
+// procedure is equivalent to Clear(initial_value), which is
+// equivalent to Put(k, initial_value) for all keys k from 0 to
+// 2^kHashbits - 1.
+//
+// 3. If key and key' differ then the only way Put(key, value) may
+// cause Has(key') to change is that Has(key') may change from true to
+// false. Furthermore, a Put() call that doesn't change Has(key')
+// doesn't change GetOrDefault(key', ...) either.
+//
+// Implementation details:
+//
+// This is a direct-mapped cache with 2^kHashbits entries;
+// the hash function simply takes the low bits of the key.
+// So, we don't have to store the low bits of the key in the entries.
+// Instead, an entry is the high bits of a key and a value, packed
+// together. E.g., a 20 bit key and a 7 bit value only require
+// a uint16 for each entry if kHashbits >= 11.
+//
+// Alternatives to this scheme will be added as needed.
+
+#ifndef TCMALLOC_PACKED_CACHE_INL_H__
+#define TCMALLOC_PACKED_CACHE_INL_H__
+
+#ifndef WTF_CHANGES
+#include "base/basictypes.h" // for COMPILE_ASSERT
+#include "base/logging.h" // for DCHECK
+#endif
+
+#ifndef DCHECK_EQ
+#define DCHECK_EQ(val1, val2) ASSERT((val1) == (val2))
+#endif
+
+// A safe way of doing "(1 << n) - 1" -- without worrying about overflow
+// Note this will all be resolved to a constant expression at compile-time
+#define N_ONES_(IntType, N) \
+ ( (N) == 0 ? 0 : ((static_cast<IntType>(1) << ((N)-1))-1 + \
+ (static_cast<IntType>(1) << ((N)-1))) )
+
+// The types K and V provide upper bounds on the number of valid keys
+// and values, but we explicitly require the keys to be less than
+// 2^kKeybits and the values to be less than 2^kValuebits. The size of
+// the table is controlled by kHashbits, and the type of each entry in
+// the cache is T. See also the big comment at the top of the file.
+template <int kKeybits, typename T>
+class PackedCache {
+ public:
+ typedef uintptr_t K;
+ typedef size_t V;
+ static const size_t kHashbits = 12;
+ static const size_t kValuebits = 8;
+
+ explicit PackedCache(V initial_value) {
+ COMPILE_ASSERT(kKeybits <= sizeof(K) * 8, key_size);
+ COMPILE_ASSERT(kValuebits <= sizeof(V) * 8, value_size);
+ COMPILE_ASSERT(kHashbits <= kKeybits, hash_function);
+ COMPILE_ASSERT(kKeybits - kHashbits + kValuebits <= kTbits,
+ entry_size_must_be_big_enough);
+ Clear(initial_value);
+ }
+
+ void Put(K key, V value) {
+ DCHECK_EQ(key, key & kKeyMask);
+ DCHECK_EQ(value, value & kValueMask);
+ array_[Hash(key)] = static_cast<T>(KeyToUpper(key) | value);
+ }
+
+ bool Has(K key) const {
+ DCHECK_EQ(key, key & kKeyMask);
+ return KeyMatch(array_[Hash(key)], key);
+ }
+
+ V GetOrDefault(K key, V default_value) const {
+ // As with other code in this class, we touch array_ as few times
+ // as we can. Assuming entries are read atomically (e.g., their
+ // type is uintptr_t on most hardware) then certain races are
+ // harmless.
+ DCHECK_EQ(key, key & kKeyMask);
+ T entry = array_[Hash(key)];
+ return KeyMatch(entry, key) ? EntryToValue(entry) : default_value;
+ }
+
+ void Clear(V value) {
+ DCHECK_EQ(value, value & kValueMask);
+ for (int i = 0; i < 1 << kHashbits; i++) {
+ array_[i] = static_cast<T>(value);
+ }
+ }
+
+ private:
+ // We are going to pack a value and the upper part of a key into
+ // an entry of type T. The UPPER type is for the upper part of a key,
+ // after the key has been masked and shifted for inclusion in an entry.
+ typedef T UPPER;
+
+ static V EntryToValue(T t) { return t & kValueMask; }
+
+ static UPPER EntryToUpper(T t) { return t & kUpperMask; }
+
+ // If v is a V and u is an UPPER then you can create an entry by
+ // doing u | v. kHashbits determines where in a K to find the upper
+ // part of the key, and kValuebits determines where in the entry to put
+ // it.
+ static UPPER KeyToUpper(K k) {
+ const int shift = kHashbits - kValuebits;
+ // Assume kHashbits >= kValuebits. It would be easy to lift this assumption.
+ return static_cast<T>(k >> shift) & kUpperMask;
+ }
+
+ // This is roughly the inverse of KeyToUpper(). Some of the key has been
+ // thrown away, since KeyToUpper() masks off the low bits of the key.
+ static K UpperToPartialKey(UPPER u) {
+ DCHECK_EQ(u, u & kUpperMask);
+ const int shift = kHashbits - kValuebits;
+ // Assume kHashbits >= kValuebits. It would be easy to lift this assumption.
+ return static_cast<K>(u) << shift;
+ }
+
+ static size_t Hash(K key) {
+ return static_cast<size_t>(key) & N_ONES_(size_t, kHashbits);
+ }
+
+ // Does the entry's partial key match the relevant part of the given key?
+ static bool KeyMatch(T entry, K key) {
+ return ((KeyToUpper(key) ^ entry) & kUpperMask) == 0;
+ }
+
+ static const size_t kTbits = 8 * sizeof(T);
+ static const int kUpperbits = kKeybits - kHashbits;
+
+ // For masking a K.
+ static const K kKeyMask = N_ONES_(K, kKeybits);
+
+ // For masking a T.
+ static const T kUpperMask = N_ONES_(T, kUpperbits) << kValuebits;
+
+ // For masking a V or a T.
+ static const V kValueMask = N_ONES_(V, kValuebits);
+
+ T array_[1 << kHashbits];
+};
+
+#undef N_ONES_
+
+#endif // TCMALLOC_PACKED_CACHE_INL_H__
diff --git a/Source/JavaScriptCore/wtf/TCPageMap.h b/Source/JavaScriptCore/wtf/TCPageMap.h
new file mode 100644
index 0000000..99bdc40
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/TCPageMap.h
@@ -0,0 +1,316 @@
+// Copyright (c) 2005, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// ---
+// Author: Sanjay Ghemawat <opensource@google.com>
+//
+// A data structure used by the caching malloc. It maps from page# to
+// a pointer that contains info about that page. We use two
+// representations: one for 32-bit addresses, and another for 64 bit
+// addresses. Both representations provide the same interface. The
+// first representation is implemented as a flat array, the seconds as
+// a three-level radix tree that strips away approximately 1/3rd of
+// the bits every time.
+//
+// The BITS parameter should be the number of bits required to hold
+// a page number. E.g., with 32 bit pointers and 4K pages (i.e.,
+// page offset fits in lower 12 bits), BITS == 20.
+
+#ifndef TCMALLOC_PAGEMAP_H__
+#define TCMALLOC_PAGEMAP_H__
+
+#if HAVE(STDINT_H)
+#include <stdint.h>
+#elif HAVE(INTTYPES_H)
+#include <inttypes.h>
+#else
+#include <sys/types.h>
+#endif
+
+#include <string.h>
+#include "Assertions.h"
+
+// Single-level array
+template <int BITS>
+class TCMalloc_PageMap1 {
+ private:
+ void** array_;
+
+ public:
+ typedef uintptr_t Number;
+
+ void init(void* (*allocator)(size_t)) {
+ array_ = reinterpret_cast<void**>((*allocator)(sizeof(void*) << BITS));
+ memset(array_, 0, sizeof(void*) << BITS);
+ }
+
+ // Ensure that the map contains initialized entries "x .. x+n-1".
+ // Returns true if successful, false if we could not allocate memory.
+ bool Ensure(Number, size_t) {
+ // Nothing to do since flat array was allocate at start
+ return true;
+ }
+
+ void PreallocateMoreMemory() {}
+
+ // REQUIRES "k" is in range "[0,2^BITS-1]".
+ // REQUIRES "k" has been ensured before.
+ //
+ // Return the current value for KEY. Returns "Value()" if not
+ // yet set.
+ void* get(Number k) const {
+ return array_[k];
+ }
+
+ // REQUIRES "k" is in range "[0,2^BITS-1]".
+ // REQUIRES "k" has been ensured before.
+ //
+ // Sets the value for KEY.
+ void set(Number k, void* v) {
+ array_[k] = v;
+ }
+};
+
+// Two-level radix tree
+template <int BITS>
+class TCMalloc_PageMap2 {
+ private:
+ // Put 32 entries in the root and (2^BITS)/32 entries in each leaf.
+ static const int ROOT_BITS = 5;
+ static const int ROOT_LENGTH = 1 << ROOT_BITS;
+
+ static const int LEAF_BITS = BITS - ROOT_BITS;
+ static const int LEAF_LENGTH = 1 << LEAF_BITS;
+
+ // Leaf node
+ struct Leaf {
+ void* values[LEAF_LENGTH];
+ };
+
+ Leaf* root_[ROOT_LENGTH]; // Pointers to 32 child nodes
+ void* (*allocator_)(size_t); // Memory allocator
+
+ public:
+ typedef uintptr_t Number;
+
+ void init(void* (*allocator)(size_t)) {
+ allocator_ = allocator;
+ memset(root_, 0, sizeof(root_));
+ }
+
+ void* get(Number k) const {
+ ASSERT(k >> BITS == 0);
+ const Number i1 = k >> LEAF_BITS;
+ const Number i2 = k & (LEAF_LENGTH-1);
+ return root_[i1]->values[i2];
+ }
+
+ void set(Number k, void* v) {
+ ASSERT(k >> BITS == 0);
+ const Number i1 = k >> LEAF_BITS;
+ const Number i2 = k & (LEAF_LENGTH-1);
+ root_[i1]->values[i2] = v;
+ }
+
+ bool Ensure(Number start, size_t n) {
+ for (Number key = start; key <= start + n - 1; ) {
+ const Number i1 = key >> LEAF_BITS;
+
+ // Make 2nd level node if necessary
+ if (root_[i1] == NULL) {
+ Leaf* leaf = reinterpret_cast<Leaf*>((*allocator_)(sizeof(Leaf)));
+ if (leaf == NULL) return false;
+ memset(leaf, 0, sizeof(*leaf));
+ root_[i1] = leaf;
+ }
+
+ // Advance key past whatever is covered by this leaf node
+ key = ((key >> LEAF_BITS) + 1) << LEAF_BITS;
+ }
+ return true;
+ }
+
+ void PreallocateMoreMemory() {
+ // Allocate enough to keep track of all possible pages
+ Ensure(0, 1 << BITS);
+ }
+
+#ifdef WTF_CHANGES
+ template<class Visitor, class MemoryReader>
+ void visitValues(Visitor& visitor, const MemoryReader& reader)
+ {
+ for (int i = 0; i < ROOT_LENGTH; i++) {
+ if (!root_[i])
+ continue;
+
+ Leaf* l = reader(reinterpret_cast<Leaf*>(root_[i]));
+ for (int j = 0; j < LEAF_LENGTH; j += visitor.visit(l->values[j]))
+ ;
+ }
+ }
+
+ template<class Visitor, class MemoryReader>
+ void visitAllocations(Visitor& visitor, const MemoryReader&) {
+ for (int i = 0; i < ROOT_LENGTH; i++) {
+ if (root_[i])
+ visitor.visit(root_[i], sizeof(Leaf));
+ }
+ }
+#endif
+};
+
+// Three-level radix tree
+template <int BITS>
+class TCMalloc_PageMap3 {
+ private:
+ // How many bits should we consume at each interior level
+ static const int INTERIOR_BITS = (BITS + 2) / 3; // Round-up
+ static const int INTERIOR_LENGTH = 1 << INTERIOR_BITS;
+
+ // How many bits should we consume at leaf level
+ static const int LEAF_BITS = BITS - 2*INTERIOR_BITS;
+ static const int LEAF_LENGTH = 1 << LEAF_BITS;
+
+ // Interior node
+ struct Node {
+ Node* ptrs[INTERIOR_LENGTH];
+ };
+
+ // Leaf node
+ struct Leaf {
+ void* values[LEAF_LENGTH];
+ };
+
+ Node* root_; // Root of radix tree
+ void* (*allocator_)(size_t); // Memory allocator
+
+ Node* NewNode() {
+ Node* result = reinterpret_cast<Node*>((*allocator_)(sizeof(Node)));
+ if (result != NULL) {
+ memset(result, 0, sizeof(*result));
+ }
+ return result;
+ }
+
+ public:
+ typedef uintptr_t Number;
+
+ void init(void* (*allocator)(size_t)) {
+ allocator_ = allocator;
+ root_ = NewNode();
+ }
+
+ void* get(Number k) const {
+ ASSERT(k >> BITS == 0);
+ const Number i1 = k >> (LEAF_BITS + INTERIOR_BITS);
+ const Number i2 = (k >> LEAF_BITS) & (INTERIOR_LENGTH-1);
+ const Number i3 = k & (LEAF_LENGTH-1);
+ return reinterpret_cast<Leaf*>(root_->ptrs[i1]->ptrs[i2])->values[i3];
+ }
+
+ void set(Number k, void* v) {
+ ASSERT(k >> BITS == 0);
+ const Number i1 = k >> (LEAF_BITS + INTERIOR_BITS);
+ const Number i2 = (k >> LEAF_BITS) & (INTERIOR_LENGTH-1);
+ const Number i3 = k & (LEAF_LENGTH-1);
+ reinterpret_cast<Leaf*>(root_->ptrs[i1]->ptrs[i2])->values[i3] = v;
+ }
+
+ bool Ensure(Number start, size_t n) {
+ for (Number key = start; key <= start + n - 1; ) {
+ const Number i1 = key >> (LEAF_BITS + INTERIOR_BITS);
+ const Number i2 = (key >> LEAF_BITS) & (INTERIOR_LENGTH-1);
+
+ // Make 2nd level node if necessary
+ if (root_->ptrs[i1] == NULL) {
+ Node* n = NewNode();
+ if (n == NULL) return false;
+ root_->ptrs[i1] = n;
+ }
+
+ // Make leaf node if necessary
+ if (root_->ptrs[i1]->ptrs[i2] == NULL) {
+ Leaf* leaf = reinterpret_cast<Leaf*>((*allocator_)(sizeof(Leaf)));
+ if (leaf == NULL) return false;
+ memset(leaf, 0, sizeof(*leaf));
+ root_->ptrs[i1]->ptrs[i2] = reinterpret_cast<Node*>(leaf);
+ }
+
+ // Advance key past whatever is covered by this leaf node
+ key = ((key >> LEAF_BITS) + 1) << LEAF_BITS;
+ }
+ return true;
+ }
+
+ void PreallocateMoreMemory() {
+ }
+
+#ifdef WTF_CHANGES
+ template<class Visitor, class MemoryReader>
+ void visitValues(Visitor& visitor, const MemoryReader& reader) {
+ Node* root = reader(root_);
+ for (int i = 0; i < INTERIOR_LENGTH; i++) {
+ if (!root->ptrs[i])
+ continue;
+
+ Node* n = reader(root->ptrs[i]);
+ for (int j = 0; j < INTERIOR_LENGTH; j++) {
+ if (!n->ptrs[j])
+ continue;
+
+ Leaf* l = reader(reinterpret_cast<Leaf*>(n->ptrs[j]));
+ for (int k = 0; k < LEAF_LENGTH; k += visitor.visit(l->values[k]))
+ ;
+ }
+ }
+ }
+
+ template<class Visitor, class MemoryReader>
+ void visitAllocations(Visitor& visitor, const MemoryReader& reader) {
+ visitor.visit(root_, sizeof(Node));
+
+ Node* root = reader(root_);
+ for (int i = 0; i < INTERIOR_LENGTH; i++) {
+ if (!root->ptrs[i])
+ continue;
+
+ visitor.visit(root->ptrs[i], sizeof(Node));
+ Node* n = reader(root->ptrs[i]);
+ for (int j = 0; j < INTERIOR_LENGTH; j++) {
+ if (!n->ptrs[j])
+ continue;
+
+ visitor.visit(n->ptrs[j], sizeof(Leaf));
+ }
+ }
+ }
+#endif
+};
+
+#endif // TCMALLOC_PAGEMAP_H__
diff --git a/Source/JavaScriptCore/wtf/TCSpinLock.h b/Source/JavaScriptCore/wtf/TCSpinLock.h
new file mode 100644
index 0000000..81b7d0c
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/TCSpinLock.h
@@ -0,0 +1,284 @@
+// Copyright (c) 2005, 2006, Google Inc.
+// Copyright (c) 2010, Patrick Gansterer <paroga@paroga.com>
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// ---
+// Author: Sanjay Ghemawat <opensource@google.com>
+
+#ifndef TCMALLOC_INTERNAL_SPINLOCK_H__
+#define TCMALLOC_INTERNAL_SPINLOCK_H__
+
+#if (CPU(X86) || CPU(X86_64) || CPU(PPC)) && (COMPILER(GCC) || COMPILER(MSVC))
+
+#include <time.h> /* For nanosleep() */
+
+#if HAVE(STDINT_H)
+#include <stdint.h>
+#elif HAVE(INTTYPES_H)
+#include <inttypes.h>
+#else
+#include <sys/types.h>
+#endif
+
+#if OS(WINDOWS)
+#ifndef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN
+#endif
+#include <windows.h>
+#else
+#include <sched.h> /* For sched_yield() */
+#endif
+
+static void TCMalloc_SlowLock(volatile unsigned int* lockword);
+
+// The following is a struct so that it can be initialized at compile time
+struct TCMalloc_SpinLock {
+
+ inline void Lock() {
+ int r;
+#if COMPILER(GCC)
+#if CPU(X86) || CPU(X86_64)
+ __asm__ __volatile__
+ ("xchgl %0, %1"
+ : "=r"(r), "=m"(lockword_)
+ : "0"(1), "m"(lockword_)
+ : "memory");
+#else
+ volatile unsigned int *lockword_ptr = &lockword_;
+ __asm__ __volatile__
+ ("1: lwarx %0, 0, %1\n\t"
+ "stwcx. %2, 0, %1\n\t"
+ "bne- 1b\n\t"
+ "isync"
+ : "=&r" (r), "=r" (lockword_ptr)
+ : "r" (1), "1" (lockword_ptr)
+ : "memory");
+#endif
+#elif COMPILER(MSVC)
+ __asm {
+ mov eax, this ; store &lockword_ (which is this+0) in eax
+ mov ebx, 1 ; store 1 in ebx
+ xchg [eax], ebx ; exchange lockword_ and 1
+ mov r, ebx ; store old value of lockword_ in r
+ }
+#endif
+ if (r) TCMalloc_SlowLock(&lockword_);
+ }
+
+ inline void Unlock() {
+#if COMPILER(GCC)
+#if CPU(X86) || CPU(X86_64)
+ __asm__ __volatile__
+ ("movl $0, %0"
+ : "=m"(lockword_)
+ : "m" (lockword_)
+ : "memory");
+#else
+ __asm__ __volatile__
+ ("isync\n\t"
+ "eieio\n\t"
+ "stw %1, %0"
+#if OS(DARWIN) || CPU(PPC)
+ : "=o" (lockword_)
+#else
+ : "=m" (lockword_)
+#endif
+ : "r" (0)
+ : "memory");
+#endif
+#elif COMPILER(MSVC)
+ __asm {
+ mov eax, this ; store &lockword_ (which is this+0) in eax
+ mov [eax], 0 ; set lockword_ to 0
+ }
+#endif
+ }
+ // Report if we think the lock can be held by this thread.
+ // When the lock is truly held by the invoking thread
+ // we will always return true.
+ // Indended to be used as CHECK(lock.IsHeld());
+ inline bool IsHeld() const {
+ return lockword_ != 0;
+ }
+
+ inline void Init() { lockword_ = 0; }
+
+ volatile unsigned int lockword_;
+};
+
+#define SPINLOCK_INITIALIZER { 0 }
+
+static void TCMalloc_SlowLock(volatile unsigned int* lockword) {
+// Yield immediately since fast path failed
+#if OS(WINDOWS)
+ Sleep(0);
+#else
+ sched_yield();
+#endif
+ while (true) {
+ int r;
+#if COMPILER(GCC)
+#if CPU(X86) || CPU(X86_64)
+ __asm__ __volatile__
+ ("xchgl %0, %1"
+ : "=r"(r), "=m"(*lockword)
+ : "0"(1), "m"(*lockword)
+ : "memory");
+
+#else
+ int tmp = 1;
+ __asm__ __volatile__
+ ("1: lwarx %0, 0, %1\n\t"
+ "stwcx. %2, 0, %1\n\t"
+ "bne- 1b\n\t"
+ "isync"
+ : "=&r" (r), "=r" (lockword)
+ : "r" (tmp), "1" (lockword)
+ : "memory");
+#endif
+#elif COMPILER(MSVC)
+ __asm {
+ mov eax, lockword ; assign lockword into eax
+ mov ebx, 1 ; assign 1 into ebx
+ xchg [eax], ebx ; exchange *lockword and 1
+ mov r, ebx ; store old value of *lockword in r
+ }
+#endif
+ if (!r) {
+ return;
+ }
+
+ // This code was adapted from the ptmalloc2 implementation of
+ // spinlocks which would sched_yield() upto 50 times before
+ // sleeping once for a few milliseconds. Mike Burrows suggested
+ // just doing one sched_yield() outside the loop and always
+ // sleeping after that. This change helped a great deal on the
+ // performance of spinlocks under high contention. A test program
+ // with 10 threads on a dual Xeon (four virtual processors) went
+ // from taking 30 seconds to 16 seconds.
+
+ // Sleep for a few milliseconds
+#if OS(WINDOWS)
+ Sleep(2);
+#else
+ struct timespec tm;
+ tm.tv_sec = 0;
+ tm.tv_nsec = 2000001;
+ nanosleep(&tm, NULL);
+#endif
+ }
+}
+
+#elif OS(WINDOWS)
+
+#ifndef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN
+#endif
+#include <windows.h>
+
+static void TCMalloc_SlowLock(LPLONG lockword);
+
+// The following is a struct so that it can be initialized at compile time
+struct TCMalloc_SpinLock {
+
+ inline void Lock() {
+ if (InterlockedExchange(&m_lockword, 1))
+ TCMalloc_SlowLock(&m_lockword);
+ }
+
+ inline void Unlock() {
+ InterlockedExchange(&m_lockword, 0);
+ }
+
+ inline bool IsHeld() const {
+ return m_lockword != 0;
+ }
+
+ inline void Init() { m_lockword = 0; }
+
+ LONG m_lockword;
+};
+
+#define SPINLOCK_INITIALIZER { 0 }
+
+static void TCMalloc_SlowLock(LPLONG lockword) {
+ Sleep(0); // Yield immediately since fast path failed
+ while (InterlockedExchange(lockword, 1))
+ Sleep(2);
+}
+
+#else
+
+#include <pthread.h>
+
+// Portable version
+struct TCMalloc_SpinLock {
+ pthread_mutex_t private_lock_;
+
+ inline void Init() {
+ if (pthread_mutex_init(&private_lock_, NULL) != 0) CRASH();
+ }
+ inline void Finalize() {
+ if (pthread_mutex_destroy(&private_lock_) != 0) CRASH();
+ }
+ inline void Lock() {
+ if (pthread_mutex_lock(&private_lock_) != 0) CRASH();
+ }
+ inline void Unlock() {
+ if (pthread_mutex_unlock(&private_lock_) != 0) CRASH();
+ }
+ bool IsHeld() {
+ if (pthread_mutex_trylock(&private_lock_))
+ return true;
+
+ Unlock();
+ return false;
+ }
+};
+
+#define SPINLOCK_INITIALIZER { PTHREAD_MUTEX_INITIALIZER }
+
+#endif
+
+// Corresponding locker object that arranges to acquire a spinlock for
+// the duration of a C++ scope.
+class TCMalloc_SpinLockHolder {
+ private:
+ TCMalloc_SpinLock* lock_;
+ public:
+ inline explicit TCMalloc_SpinLockHolder(TCMalloc_SpinLock* l)
+ : lock_(l) { l->Lock(); }
+ inline ~TCMalloc_SpinLockHolder() { lock_->Unlock(); }
+};
+
+// Short-hands for convenient use by tcmalloc.cc
+typedef TCMalloc_SpinLock SpinLock;
+typedef TCMalloc_SpinLockHolder SpinLockHolder;
+
+#endif // TCMALLOC_INTERNAL_SPINLOCK_H__
diff --git a/Source/JavaScriptCore/wtf/TCSystemAlloc.cpp b/Source/JavaScriptCore/wtf/TCSystemAlloc.cpp
new file mode 100644
index 0000000..0b7ecc9
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/TCSystemAlloc.cpp
@@ -0,0 +1,521 @@
+// Copyright (c) 2005, 2007, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// ---
+// Author: Sanjay Ghemawat
+
+#include "config.h"
+#include "TCSystemAlloc.h"
+
+#include <algorithm>
+#include "Assertions.h"
+#include "TCSpinLock.h"
+#include "UnusedParam.h"
+#include "VMTags.h"
+
+#if HAVE(STDINT_H)
+#include <stdint.h>
+#elif HAVE(INTTYPES_H)
+#include <inttypes.h>
+#else
+#include <sys/types.h>
+#endif
+
+#if OS(WINDOWS)
+#include "windows.h"
+#else
+#include <errno.h>
+#include <unistd.h>
+#include <sys/mman.h>
+#endif
+
+#ifndef MAP_ANONYMOUS
+#define MAP_ANONYMOUS MAP_ANON
+#endif
+
+using namespace std;
+
+// Structure for discovering alignment
+union MemoryAligner {
+ void* p;
+ double d;
+ size_t s;
+};
+
+static SpinLock spinlock = SPINLOCK_INITIALIZER;
+
+// Page size is initialized on demand
+static size_t pagesize = 0;
+
+// Configuration parameters.
+//
+// if use_devmem is true, either use_sbrk or use_mmap must also be true.
+// For 2.2 kernels, it looks like the sbrk address space (500MBish) and
+// the mmap address space (1300MBish) are disjoint, so we need both allocators
+// to get as much virtual memory as possible.
+#ifndef WTF_CHANGES
+static bool use_devmem = false;
+#endif
+
+#if HAVE(SBRK)
+static bool use_sbrk = false;
+#endif
+
+#if HAVE(MMAP)
+static bool use_mmap = true;
+#endif
+
+#if HAVE(VIRTUALALLOC)
+static bool use_VirtualAlloc = true;
+#endif
+
+// Flags to keep us from retrying allocators that failed.
+static bool devmem_failure = false;
+static bool sbrk_failure = false;
+static bool mmap_failure = false;
+static bool VirtualAlloc_failure = false;
+
+#ifndef WTF_CHANGES
+DEFINE_int32(malloc_devmem_start, 0,
+ "Physical memory starting location in MB for /dev/mem allocation."
+ " Setting this to 0 disables /dev/mem allocation");
+DEFINE_int32(malloc_devmem_limit, 0,
+ "Physical memory limit location in MB for /dev/mem allocation."
+ " Setting this to 0 means no limit.");
+#else
+static const int32_t FLAGS_malloc_devmem_start = 0;
+static const int32_t FLAGS_malloc_devmem_limit = 0;
+#endif
+
+#if HAVE(SBRK)
+
+static void* TrySbrk(size_t size, size_t *actual_size, size_t alignment) {
+ size = ((size + alignment - 1) / alignment) * alignment;
+
+ // could theoretically return the "extra" bytes here, but this
+ // is simple and correct.
+ if (actual_size)
+ *actual_size = size;
+
+ void* result = sbrk(size);
+ if (result == reinterpret_cast<void*>(-1)) {
+ sbrk_failure = true;
+ return NULL;
+ }
+
+ // Is it aligned?
+ uintptr_t ptr = reinterpret_cast<uintptr_t>(result);
+ if ((ptr & (alignment-1)) == 0) return result;
+
+ // Try to get more memory for alignment
+ size_t extra = alignment - (ptr & (alignment-1));
+ void* r2 = sbrk(extra);
+ if (reinterpret_cast<uintptr_t>(r2) == (ptr + size)) {
+ // Contiguous with previous result
+ return reinterpret_cast<void*>(ptr + extra);
+ }
+
+ // Give up and ask for "size + alignment - 1" bytes so
+ // that we can find an aligned region within it.
+ result = sbrk(size + alignment - 1);
+ if (result == reinterpret_cast<void*>(-1)) {
+ sbrk_failure = true;
+ return NULL;
+ }
+ ptr = reinterpret_cast<uintptr_t>(result);
+ if ((ptr & (alignment-1)) != 0) {
+ ptr += alignment - (ptr & (alignment-1));
+ }
+ return reinterpret_cast<void*>(ptr);
+}
+
+#endif /* HAVE(SBRK) */
+
+#if HAVE(MMAP)
+
+static void* TryMmap(size_t size, size_t *actual_size, size_t alignment) {
+ // Enforce page alignment
+ if (pagesize == 0) pagesize = getpagesize();
+ if (alignment < pagesize) alignment = pagesize;
+ size = ((size + alignment - 1) / alignment) * alignment;
+
+ // could theoretically return the "extra" bytes here, but this
+ // is simple and correct.
+ if (actual_size)
+ *actual_size = size;
+
+ // Ask for extra memory if alignment > pagesize
+ size_t extra = 0;
+ if (alignment > pagesize) {
+ extra = alignment - pagesize;
+ }
+ void* result = mmap(NULL, size + extra,
+ PROT_READ | PROT_WRITE,
+ MAP_PRIVATE|MAP_ANONYMOUS,
+ VM_TAG_FOR_TCMALLOC_MEMORY, 0);
+ if (result == reinterpret_cast<void*>(MAP_FAILED)) {
+ mmap_failure = true;
+ return NULL;
+ }
+
+ // Adjust the return memory so it is aligned
+ uintptr_t ptr = reinterpret_cast<uintptr_t>(result);
+ size_t adjust = 0;
+ if ((ptr & (alignment - 1)) != 0) {
+ adjust = alignment - (ptr & (alignment - 1));
+ }
+
+ // Return the unused memory to the system
+ if (adjust > 0) {
+ munmap(reinterpret_cast<void*>(ptr), adjust);
+ }
+ if (adjust < extra) {
+ munmap(reinterpret_cast<void*>(ptr + adjust + size), extra - adjust);
+ }
+
+ ptr += adjust;
+ return reinterpret_cast<void*>(ptr);
+}
+
+#endif /* HAVE(MMAP) */
+
+#if HAVE(VIRTUALALLOC)
+
+static void* TryVirtualAlloc(size_t size, size_t *actual_size, size_t alignment) {
+ // Enforce page alignment
+ if (pagesize == 0) {
+ SYSTEM_INFO system_info;
+ GetSystemInfo(&system_info);
+ pagesize = system_info.dwPageSize;
+ }
+
+ if (alignment < pagesize) alignment = pagesize;
+ size = ((size + alignment - 1) / alignment) * alignment;
+
+ // could theoretically return the "extra" bytes here, but this
+ // is simple and correct.
+ if (actual_size)
+ *actual_size = size;
+
+ // Ask for extra memory if alignment > pagesize
+ size_t extra = 0;
+ if (alignment > pagesize) {
+ extra = alignment - pagesize;
+ }
+ void* result = VirtualAlloc(NULL, size + extra,
+ MEM_RESERVE | MEM_COMMIT | MEM_TOP_DOWN,
+ PAGE_READWRITE);
+
+ if (result == NULL) {
+ VirtualAlloc_failure = true;
+ return NULL;
+ }
+
+ // Adjust the return memory so it is aligned
+ uintptr_t ptr = reinterpret_cast<uintptr_t>(result);
+ size_t adjust = 0;
+ if ((ptr & (alignment - 1)) != 0) {
+ adjust = alignment - (ptr & (alignment - 1));
+ }
+
+ // Return the unused memory to the system - we'd like to release but the best we can do
+ // is decommit, since Windows only lets you free the whole allocation.
+ if (adjust > 0) {
+ VirtualFree(reinterpret_cast<void*>(ptr), adjust, MEM_DECOMMIT);
+ }
+ if (adjust < extra) {
+ VirtualFree(reinterpret_cast<void*>(ptr + adjust + size), extra-adjust, MEM_DECOMMIT);
+ }
+
+ ptr += adjust;
+ return reinterpret_cast<void*>(ptr);
+}
+
+#endif /* HAVE(MMAP) */
+
+#ifndef WTF_CHANGES
+static void* TryDevMem(size_t size, size_t *actual_size, size_t alignment) {
+ static bool initialized = false;
+ static off_t physmem_base; // next physical memory address to allocate
+ static off_t physmem_limit; // maximum physical address allowed
+ static int physmem_fd; // file descriptor for /dev/mem
+
+ // Check if we should use /dev/mem allocation. Note that it may take
+ // a while to get this flag initialized, so meanwhile we fall back to
+ // the next allocator. (It looks like 7MB gets allocated before
+ // this flag gets initialized -khr.)
+ if (FLAGS_malloc_devmem_start == 0) {
+ // NOTE: not a devmem_failure - we'd like TCMalloc_SystemAlloc to
+ // try us again next time.
+ return NULL;
+ }
+
+ if (!initialized) {
+ physmem_fd = open("/dev/mem", O_RDWR);
+ if (physmem_fd < 0) {
+ devmem_failure = true;
+ return NULL;
+ }
+ physmem_base = FLAGS_malloc_devmem_start*1024LL*1024LL;
+ physmem_limit = FLAGS_malloc_devmem_limit*1024LL*1024LL;
+ initialized = true;
+ }
+
+ // Enforce page alignment
+ if (pagesize == 0) pagesize = getpagesize();
+ if (alignment < pagesize) alignment = pagesize;
+ size = ((size + alignment - 1) / alignment) * alignment;
+
+ // could theoretically return the "extra" bytes here, but this
+ // is simple and correct.
+ if (actual_size)
+ *actual_size = size;
+
+ // Ask for extra memory if alignment > pagesize
+ size_t extra = 0;
+ if (alignment > pagesize) {
+ extra = alignment - pagesize;
+ }
+
+ // check to see if we have any memory left
+ if (physmem_limit != 0 && physmem_base + size + extra > physmem_limit) {
+ devmem_failure = true;
+ return NULL;
+ }
+ void *result = mmap(0, size + extra, PROT_READ | PROT_WRITE,
+ MAP_SHARED, physmem_fd, physmem_base);
+ if (result == reinterpret_cast<void*>(MAP_FAILED)) {
+ devmem_failure = true;
+ return NULL;
+ }
+ uintptr_t ptr = reinterpret_cast<uintptr_t>(result);
+
+ // Adjust the return memory so it is aligned
+ size_t adjust = 0;
+ if ((ptr & (alignment - 1)) != 0) {
+ adjust = alignment - (ptr & (alignment - 1));
+ }
+
+ // Return the unused virtual memory to the system
+ if (adjust > 0) {
+ munmap(reinterpret_cast<void*>(ptr), adjust);
+ }
+ if (adjust < extra) {
+ munmap(reinterpret_cast<void*>(ptr + adjust + size), extra - adjust);
+ }
+
+ ptr += adjust;
+ physmem_base += adjust + size;
+
+ return reinterpret_cast<void*>(ptr);
+}
+#endif
+
+void* TCMalloc_SystemAlloc(size_t size, size_t *actual_size, size_t alignment) {
+ // Discard requests that overflow
+ if (size + alignment < size) return NULL;
+
+ SpinLockHolder lock_holder(&spinlock);
+
+ // Enforce minimum alignment
+ if (alignment < sizeof(MemoryAligner)) alignment = sizeof(MemoryAligner);
+
+ // Try twice, once avoiding allocators that failed before, and once
+ // more trying all allocators even if they failed before.
+ for (int i = 0; i < 2; i++) {
+
+#ifndef WTF_CHANGES
+ if (use_devmem && !devmem_failure) {
+ void* result = TryDevMem(size, actual_size, alignment);
+ if (result != NULL) return result;
+ }
+#endif
+
+#if HAVE(SBRK)
+ if (use_sbrk && !sbrk_failure) {
+ void* result = TrySbrk(size, actual_size, alignment);
+ if (result != NULL) return result;
+ }
+#endif
+
+#if HAVE(MMAP)
+ if (use_mmap && !mmap_failure) {
+ void* result = TryMmap(size, actual_size, alignment);
+ if (result != NULL) return result;
+ }
+#endif
+
+#if HAVE(VIRTUALALLOC)
+ if (use_VirtualAlloc && !VirtualAlloc_failure) {
+ void* result = TryVirtualAlloc(size, actual_size, alignment);
+ if (result != NULL) return result;
+ }
+#endif
+
+ // nothing worked - reset failure flags and try again
+ devmem_failure = false;
+ sbrk_failure = false;
+ mmap_failure = false;
+ VirtualAlloc_failure = false;
+ }
+ return NULL;
+}
+
+#if HAVE(MADV_FREE_REUSE)
+
+void TCMalloc_SystemRelease(void* start, size_t length)
+{
+ while (madvise(start, length, MADV_FREE_REUSABLE) == -1 && errno == EAGAIN) { }
+}
+
+#elif HAVE(MADV_FREE) || HAVE(MADV_DONTNEED)
+
+void TCMalloc_SystemRelease(void* start, size_t length)
+{
+ // MADV_FREE clears the modified bit on pages, which allows
+ // them to be discarded immediately.
+#if HAVE(MADV_FREE)
+ const int advice = MADV_FREE;
+#else
+ const int advice = MADV_DONTNEED;
+#endif
+ if (FLAGS_malloc_devmem_start) {
+ // It's not safe to use MADV_DONTNEED if we've been mapping
+ // /dev/mem for heap memory
+ return;
+ }
+ if (pagesize == 0) pagesize = getpagesize();
+ const size_t pagemask = pagesize - 1;
+
+ size_t new_start = reinterpret_cast<size_t>(start);
+ size_t end = new_start + length;
+ size_t new_end = end;
+
+ // Round up the starting address and round down the ending address
+ // to be page aligned:
+ new_start = (new_start + pagesize - 1) & ~pagemask;
+ new_end = new_end & ~pagemask;
+
+ ASSERT((new_start & pagemask) == 0);
+ ASSERT((new_end & pagemask) == 0);
+ ASSERT(new_start >= reinterpret_cast<size_t>(start));
+ ASSERT(new_end <= end);
+
+ if (new_end > new_start) {
+ // Note -- ignoring most return codes, because if this fails it
+ // doesn't matter...
+ while (madvise(reinterpret_cast<char*>(new_start), new_end - new_start,
+ advice) == -1 &&
+ errno == EAGAIN) {
+ // NOP
+ }
+ }
+}
+
+#elif HAVE(MMAP)
+
+void TCMalloc_SystemRelease(void* start, size_t length)
+{
+ void* newAddress = mmap(start, length, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, -1, 0);
+ // If the mmap failed then that's ok, we just won't return the memory to the system.
+ ASSERT_UNUSED(newAddress, newAddress == start || newAddress == reinterpret_cast<void*>(MAP_FAILED));
+}
+
+#elif HAVE(VIRTUALALLOC)
+
+void TCMalloc_SystemRelease(void* start, size_t length)
+{
+ if (VirtualFree(start, length, MEM_DECOMMIT))
+ return;
+
+ // The decommit may fail if the memory region consists of allocations
+ // from more than one call to VirtualAlloc. In this case, fall back to
+ // using VirtualQuery to retrieve the allocation boundaries and decommit
+ // them each individually.
+
+ char* ptr = static_cast<char*>(start);
+ char* end = ptr + length;
+ MEMORY_BASIC_INFORMATION info;
+ while (ptr < end) {
+ size_t resultSize = VirtualQuery(ptr, &info, sizeof(info));
+ ASSERT_UNUSED(resultSize, resultSize == sizeof(info));
+
+ size_t decommitSize = min<size_t>(info.RegionSize, end - ptr);
+ BOOL success = VirtualFree(ptr, decommitSize, MEM_DECOMMIT);
+ ASSERT_UNUSED(success, success);
+ ptr += decommitSize;
+ }
+}
+
+#else
+
+// Platforms that don't support returning memory use an empty inline version of TCMalloc_SystemRelease
+// declared in TCSystemAlloc.h
+
+#endif
+
+#if HAVE(MADV_FREE_REUSE)
+
+void TCMalloc_SystemCommit(void* start, size_t length)
+{
+ while (madvise(start, length, MADV_FREE_REUSE) == -1 && errno == EAGAIN) { }
+}
+
+#elif HAVE(VIRTUALALLOC)
+
+void TCMalloc_SystemCommit(void* start, size_t length)
+{
+ if (VirtualAlloc(start, length, MEM_COMMIT, PAGE_READWRITE) == start)
+ return;
+
+ // The commit may fail if the memory region consists of allocations
+ // from more than one call to VirtualAlloc. In this case, fall back to
+ // using VirtualQuery to retrieve the allocation boundaries and commit them
+ // each individually.
+
+ char* ptr = static_cast<char*>(start);
+ char* end = ptr + length;
+ MEMORY_BASIC_INFORMATION info;
+ while (ptr < end) {
+ size_t resultSize = VirtualQuery(ptr, &info, sizeof(info));
+ ASSERT_UNUSED(resultSize, resultSize == sizeof(info));
+
+ size_t commitSize = min<size_t>(info.RegionSize, end - ptr);
+ void* newAddress = VirtualAlloc(ptr, commitSize, MEM_COMMIT, PAGE_READWRITE);
+ ASSERT_UNUSED(newAddress, newAddress == ptr);
+ ptr += commitSize;
+ }
+}
+
+#else
+
+// Platforms that don't need to explicitly commit memory use an empty inline version of TCMalloc_SystemCommit
+// declared in TCSystemAlloc.h
+
+#endif
diff --git a/Source/JavaScriptCore/wtf/TCSystemAlloc.h b/Source/JavaScriptCore/wtf/TCSystemAlloc.h
new file mode 100644
index 0000000..1c67788
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/TCSystemAlloc.h
@@ -0,0 +1,75 @@
+// Copyright (c) 2005, 2007, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// ---
+// Author: Sanjay Ghemawat
+//
+// Routine that uses sbrk/mmap to allocate memory from the system.
+// Useful for implementing malloc.
+
+#ifndef TCMALLOC_SYSTEM_ALLOC_H__
+#define TCMALLOC_SYSTEM_ALLOC_H__
+
+// REQUIRES: "alignment" is a power of two or "0" to indicate default alignment
+//
+// Allocate and return "N" bytes of zeroed memory.
+//
+// If actual_bytes is NULL then the returned memory is exactly the
+// requested size. If actual bytes is non-NULL then the allocator
+// may optionally return more bytes than asked for (i.e. return an
+// entire "huge" page if a huge page allocator is in use).
+//
+// The returned pointer is a multiple of "alignment" if non-zero.
+//
+// Returns NULL when out of memory.
+extern void* TCMalloc_SystemAlloc(size_t bytes, size_t *actual_bytes,
+ size_t alignment = 0);
+
+// This call is a hint to the operating system that the pages
+// contained in the specified range of memory will not be used for a
+// while, and can be released for use by other processes or the OS.
+// Pages which are released in this way may be destroyed (zeroed) by
+// the OS. The benefit of this function is that it frees memory for
+// use by the system, the cost is that the pages are faulted back into
+// the address space next time they are touched, which can impact
+// performance. (Only pages fully covered by the memory region will
+// be released, partial pages will not.)
+extern void TCMalloc_SystemRelease(void* start, size_t length);
+
+extern void TCMalloc_SystemCommit(void* start, size_t length);
+
+#if !HAVE(MADV_FREE_REUSE) && !HAVE(MADV_DONTNEED) && !HAVE(MMAP) && !HAVE(VIRTUALALLOC)
+inline void TCMalloc_SystemRelease(void*, size_t) { }
+#endif
+
+#if !HAVE(VIRTUALALLOC) && !HAVE(MADV_FREE_REUSE)
+inline void TCMalloc_SystemCommit(void*, size_t) { }
+#endif
+
+#endif /* TCMALLOC_SYSTEM_ALLOC_H__ */
diff --git a/Source/JavaScriptCore/wtf/ThreadFunctionInvocation.h b/Source/JavaScriptCore/wtf/ThreadFunctionInvocation.h
new file mode 100644
index 0000000..f1e1472
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/ThreadFunctionInvocation.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ThreadFunctionInvocation_h
+#define ThreadFunctionInvocation_h
+
+namespace WTF {
+
+typedef void* (*ThreadFunction)(void* argument);
+
+struct ThreadFunctionInvocation {
+ ThreadFunctionInvocation(ThreadFunction function, void* data)
+ : function(function)
+ , data(data)
+ {
+ }
+
+ ThreadFunction function;
+ void* data;
+};
+
+} // namespace WTF
+
+#endif // ThreadFunctionInvocation_h
diff --git a/Source/JavaScriptCore/wtf/ThreadIdentifierDataPthreads.cpp b/Source/JavaScriptCore/wtf/ThreadIdentifierDataPthreads.cpp
new file mode 100644
index 0000000..042d49e
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/ThreadIdentifierDataPthreads.cpp
@@ -0,0 +1,97 @@
+/*
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if USE(PTHREADS)
+
+#include "ThreadIdentifierDataPthreads.h"
+
+#include "Threading.h"
+
+namespace WTF {
+
+pthread_key_t ThreadIdentifierData::m_key;
+
+void clearPthreadHandleForIdentifier(ThreadIdentifier);
+
+ThreadIdentifierData::~ThreadIdentifierData()
+{
+ clearPthreadHandleForIdentifier(m_identifier);
+}
+
+ThreadIdentifier ThreadIdentifierData::identifier()
+{
+ initializeKeyOnce();
+ ThreadIdentifierData* threadIdentifierData = static_cast<ThreadIdentifierData*>(pthread_getspecific(m_key));
+
+ return threadIdentifierData ? threadIdentifierData->m_identifier : 0;
+}
+
+void ThreadIdentifierData::initialize(ThreadIdentifier id)
+{
+ ASSERT(!identifier());
+
+ initializeKeyOnce();
+ pthread_setspecific(m_key, new ThreadIdentifierData(id));
+}
+
+void ThreadIdentifierData::destruct(void* data)
+{
+ ThreadIdentifierData* threadIdentifierData = static_cast<ThreadIdentifierData*>(data);
+ ASSERT(threadIdentifierData);
+
+ if (threadIdentifierData->m_isDestroyedOnce) {
+ delete threadIdentifierData;
+ return;
+ }
+
+ threadIdentifierData->m_isDestroyedOnce = true;
+ // Re-setting the value for key causes another destruct() call after all other thread-specific destructors were called.
+ pthread_setspecific(m_key, threadIdentifierData);
+}
+
+void ThreadIdentifierData::initializeKeyOnceHelper()
+{
+ if (pthread_key_create(&m_key, destruct))
+ CRASH();
+}
+
+void ThreadIdentifierData::initializeKeyOnce()
+{
+ static pthread_once_t onceControl = PTHREAD_ONCE_INIT;
+ if (pthread_once(&onceControl, initializeKeyOnceHelper))
+ CRASH();
+}
+
+} // namespace WTF
+
+#endif // USE(PTHREADS)
+
diff --git a/Source/JavaScriptCore/wtf/ThreadIdentifierDataPthreads.h b/Source/JavaScriptCore/wtf/ThreadIdentifierDataPthreads.h
new file mode 100644
index 0000000..3af87a8
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/ThreadIdentifierDataPthreads.h
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ThreadIdentifierDataPthreads_h
+#define ThreadIdentifierDataPthreads_h
+
+#include <wtf/Noncopyable.h>
+#include <wtf/Threading.h>
+
+namespace WTF {
+
+// Holds ThreadIdentifier in the thread-specific storage and employs pthreads-specific 2-pass destruction to reliably remove
+// ThreadIdentifier from threadMap. It assumes regular ThreadSpecific types don't use multiple-pass destruction.
+class ThreadIdentifierData : public Noncopyable {
+public:
+ ~ThreadIdentifierData();
+
+ // Creates and puts an instance of ThreadIdentifierData into thread-specific storage.
+ static void initialize(ThreadIdentifier identifier);
+
+ // Returns 0 if thread-specific storage was not initialized.
+ static ThreadIdentifier identifier();
+
+private:
+ ThreadIdentifierData(ThreadIdentifier identifier)
+ : m_identifier(identifier)
+ , m_isDestroyedOnce(false)
+ {
+ }
+
+ // This thread-specific destructor is called 2 times when thread terminates:
+ // - first, when all the other thread-specific destructors are called, it simply remembers it was 'destroyed once'
+ // and re-sets itself into the thread-specific slot to make Pthreads to call it again later.
+ // - second, after all thread-specific destructors were invoked, it gets called again - this time, we remove the
+ // ThreadIdentifier from the threadMap, completing the cleanup.
+ static void destruct(void* data);
+
+ static void initializeKeyOnceHelper();
+ static void initializeKeyOnce();
+
+ ThreadIdentifier m_identifier;
+ bool m_isDestroyedOnce;
+ static pthread_key_t m_key;
+};
+
+} // namespace WTF
+
+#endif // ThreadIdentifierDataPthreads_h
+
+
diff --git a/Source/JavaScriptCore/wtf/ThreadSafeShared.h b/Source/JavaScriptCore/wtf/ThreadSafeShared.h
new file mode 100644
index 0000000..33c6612
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/ThreadSafeShared.h
@@ -0,0 +1,148 @@
+/*
+ * Copyright (C) 2007, 2008, 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2007 Justin Haygood (jhaygood@reaktix.com)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * Note: The implementations of InterlockedIncrement and InterlockedDecrement are based
+ * on atomic_increment and atomic_exchange_and_add from the Boost C++ Library. The license
+ * is virtually identical to the Apple license above but is included here for completeness.
+ *
+ * Boost Software License - Version 1.0 - August 17th, 2003
+ *
+ * Permission is hereby granted, free of charge, to any person or organization
+ * obtaining a copy of the software and accompanying documentation covered by
+ * this license (the "Software") to use, reproduce, display, distribute,
+ * execute, and transmit the Software, and to prepare derivative works of the
+ * Software, and to permit third-parties to whom the Software is furnished to
+ * do so, all subject to the following:
+ *
+ * The copyright notices in the Software and this entire statement, including
+ * the above license grant, this restriction and the following disclaimer,
+ * must be included in all copies of the Software, in whole or in part, and
+ * all derivative works of the Software, unless such copies or derivative
+ * works are solely in the form of machine-executable object code generated by
+ * a source language processor.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
+ * SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
+ * FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef ThreadSafeShared_h
+#define ThreadSafeShared_h
+
+#include "Platform.h"
+
+#include <wtf/Atomics.h>
+#include <wtf/Noncopyable.h>
+#include <wtf/ThreadingPrimitives.h>
+
+namespace WTF {
+
+class ThreadSafeSharedBase : public Noncopyable {
+public:
+ ThreadSafeSharedBase(int initialRefCount = 1)
+ : m_refCount(initialRefCount)
+ {
+ }
+
+ void ref()
+ {
+#if USE(LOCKFREE_THREADSAFESHARED)
+ atomicIncrement(&m_refCount);
+#else
+ MutexLocker locker(m_mutex);
+ ++m_refCount;
+#endif
+ }
+
+ bool hasOneRef()
+ {
+ return refCount() == 1;
+ }
+
+ int refCount() const
+ {
+#if !USE(LOCKFREE_THREADSAFESHARED)
+ MutexLocker locker(m_mutex);
+#endif
+ return static_cast<int const volatile &>(m_refCount);
+ }
+
+protected:
+ // Returns whether the pointer should be freed or not.
+ bool derefBase()
+ {
+#if USE(LOCKFREE_THREADSAFESHARED)
+ if (atomicDecrement(&m_refCount) <= 0)
+ return true;
+#else
+ int refCount;
+ {
+ MutexLocker locker(m_mutex);
+ --m_refCount;
+ refCount = m_refCount;
+ }
+ if (refCount <= 0)
+ return true;
+#endif
+ return false;
+ }
+
+private:
+ template<class T>
+ friend class CrossThreadRefCounted;
+
+ int m_refCount;
+#if !USE(LOCKFREE_THREADSAFESHARED)
+ mutable Mutex m_mutex;
+#endif
+};
+
+template<class T> class ThreadSafeShared : public ThreadSafeSharedBase {
+public:
+ void deref()
+ {
+ if (derefBase())
+ delete static_cast<T*>(this);
+ }
+
+protected:
+ ThreadSafeShared()
+ {
+ }
+};
+
+} // namespace WTF
+
+using WTF::ThreadSafeShared;
+
+#endif // ThreadSafeShared_h
diff --git a/Source/JavaScriptCore/wtf/ThreadSpecific.h b/Source/JavaScriptCore/wtf/ThreadSpecific.h
new file mode 100644
index 0000000..93ed466
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/ThreadSpecific.h
@@ -0,0 +1,329 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2009 Jian Li <jianli@chromium.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* Thread local storage is implemented by using either pthread API or Windows
+ * native API. There is subtle semantic discrepancy for the cleanup function
+ * implementation as noted below:
+ * @ In pthread implementation, the destructor function will be called
+ * repeatedly if there is still non-NULL value associated with the function.
+ * @ In Windows native implementation, the destructor function will be called
+ * only once.
+ * This semantic discrepancy does not impose any problem because nowhere in
+ * WebKit the repeated call bahavior is utilized.
+ */
+
+#ifndef WTF_ThreadSpecific_h
+#define WTF_ThreadSpecific_h
+
+#include <wtf/Noncopyable.h>
+
+#if USE(PTHREADS)
+#include <pthread.h>
+#elif PLATFORM(QT)
+#include <QThreadStorage>
+#elif PLATFORM(GTK)
+#include <glib.h>
+#elif OS(WINDOWS)
+#include <windows.h>
+#endif
+
+namespace WTF {
+
+#if !USE(PTHREADS) && !PLATFORM(QT) && !PLATFORM(GTK) && OS(WINDOWS)
+// ThreadSpecificThreadExit should be called each time when a thread is detached.
+// This is done automatically for threads created with WTF::createThread.
+void ThreadSpecificThreadExit();
+#endif
+
+template<typename T> class ThreadSpecific : public Noncopyable {
+public:
+ ThreadSpecific();
+ T* operator->();
+ operator T*();
+ T& operator*();
+
+private:
+#if !USE(PTHREADS) && !PLATFORM(QT) && !PLATFORM(GTK) && OS(WINDOWS)
+ friend void ThreadSpecificThreadExit();
+#endif
+
+ // Not implemented. It's technically possible to destroy a thread specific key, but one would need
+ // to make sure that all values have been destroyed already (usually, that all threads that used it
+ // have exited). It's unlikely that any user of this call will be in that situation - and having
+ // a destructor defined can be confusing, given that it has such strong pre-requisites to work correctly.
+ ~ThreadSpecific();
+
+ T* get();
+ void set(T*);
+ void static destroy(void* ptr);
+
+#if USE(PTHREADS) || PLATFORM(QT) || PLATFORM(GTK) || OS(WINDOWS)
+ struct Data : Noncopyable {
+ Data(T* value, ThreadSpecific<T>* owner) : value(value), owner(owner) {}
+#if PLATFORM(QT)
+ ~Data() { owner->destroy(this); }
+#endif
+
+ T* value;
+ ThreadSpecific<T>* owner;
+#if !USE(PTHREADS) && !PLATFORM(QT) && !PLATFORM(GTK)
+ void (*destructor)(void*);
+#endif
+ };
+#endif
+
+#if ENABLE(SINGLE_THREADED)
+ T* m_value;
+#else
+#if USE(PTHREADS)
+ pthread_key_t m_key;
+#elif PLATFORM(QT)
+ QThreadStorage<Data*> m_key;
+#elif PLATFORM(GTK)
+ GStaticPrivate m_key;
+#elif OS(WINDOWS)
+ int m_index;
+#endif
+#endif
+};
+
+#if ENABLE(SINGLE_THREADED)
+template<typename T>
+inline ThreadSpecific<T>::ThreadSpecific()
+ : m_value(0)
+{
+}
+
+template<typename T>
+inline T* ThreadSpecific<T>::get()
+{
+ return m_value;
+}
+
+template<typename T>
+inline void ThreadSpecific<T>::set(T* ptr)
+{
+ ASSERT(!get());
+ m_value = ptr;
+}
+#else
+#if USE(PTHREADS)
+template<typename T>
+inline ThreadSpecific<T>::ThreadSpecific()
+{
+ int error = pthread_key_create(&m_key, destroy);
+ if (error)
+ CRASH();
+}
+
+template<typename T>
+inline T* ThreadSpecific<T>::get()
+{
+ Data* data = static_cast<Data*>(pthread_getspecific(m_key));
+ return data ? data->value : 0;
+}
+
+template<typename T>
+inline void ThreadSpecific<T>::set(T* ptr)
+{
+ ASSERT(!get());
+ pthread_setspecific(m_key, new Data(ptr, this));
+}
+
+#elif PLATFORM(QT)
+
+template<typename T>
+inline ThreadSpecific<T>::ThreadSpecific()
+{
+}
+
+template<typename T>
+inline T* ThreadSpecific<T>::get()
+{
+ Data* data = static_cast<Data*>(m_key.localData());
+ return data ? data->value : 0;
+}
+
+template<typename T>
+inline void ThreadSpecific<T>::set(T* ptr)
+{
+ ASSERT(!get());
+ Data* data = new Data(ptr, this);
+ m_key.setLocalData(data);
+}
+
+#elif PLATFORM(GTK)
+
+template<typename T>
+inline ThreadSpecific<T>::ThreadSpecific()
+{
+ g_static_private_init(&m_key);
+}
+
+template<typename T>
+inline T* ThreadSpecific<T>::get()
+{
+ Data* data = static_cast<Data*>(g_static_private_get(&m_key));
+ return data ? data->value : 0;
+}
+
+template<typename T>
+inline void ThreadSpecific<T>::set(T* ptr)
+{
+ ASSERT(!get());
+ Data* data = new Data(ptr, this);
+ g_static_private_set(&m_key, data, destroy);
+}
+
+#elif OS(WINDOWS)
+
+// TLS_OUT_OF_INDEXES is not defined on WinCE.
+#ifndef TLS_OUT_OF_INDEXES
+#define TLS_OUT_OF_INDEXES 0xffffffff
+#endif
+
+// The maximum number of TLS keys that can be created. For simplification, we assume that:
+// 1) Once the instance of ThreadSpecific<> is created, it will not be destructed until the program dies.
+// 2) We do not need to hold many instances of ThreadSpecific<> data. This fixed number should be far enough.
+const int kMaxTlsKeySize = 256;
+
+long& tlsKeyCount();
+DWORD* tlsKeys();
+
+template<typename T>
+inline ThreadSpecific<T>::ThreadSpecific()
+ : m_index(-1)
+{
+ DWORD tlsKey = TlsAlloc();
+ if (tlsKey == TLS_OUT_OF_INDEXES)
+ CRASH();
+
+ m_index = InterlockedIncrement(&tlsKeyCount()) - 1;
+ if (m_index >= kMaxTlsKeySize)
+ CRASH();
+ tlsKeys()[m_index] = tlsKey;
+}
+
+template<typename T>
+inline ThreadSpecific<T>::~ThreadSpecific()
+{
+ // Does not invoke destructor functions. They will be called from ThreadSpecificThreadExit when the thread is detached.
+ TlsFree(tlsKeys()[m_index]);
+}
+
+template<typename T>
+inline T* ThreadSpecific<T>::get()
+{
+ Data* data = static_cast<Data*>(TlsGetValue(tlsKeys()[m_index]));
+ return data ? data->value : 0;
+}
+
+template<typename T>
+inline void ThreadSpecific<T>::set(T* ptr)
+{
+ ASSERT(!get());
+ Data* data = new Data(ptr, this);
+ data->destructor = &ThreadSpecific<T>::destroy;
+ TlsSetValue(tlsKeys()[m_index], data);
+}
+
+#else
+#error ThreadSpecific is not implemented for this platform.
+#endif
+#endif
+
+template<typename T>
+inline void ThreadSpecific<T>::destroy(void* ptr)
+{
+#if !ENABLE(SINGLE_THREADED)
+ Data* data = static_cast<Data*>(ptr);
+
+#if USE(PTHREADS)
+ // We want get() to keep working while data destructor works, because it can be called indirectly by the destructor.
+ // Some pthreads implementations zero out the pointer before calling destroy(), so we temporarily reset it.
+ pthread_setspecific(data->owner->m_key, ptr);
+#elif PLATFORM(GTK)
+ // See comment as above
+ g_static_private_set(&data->owner->m_key, data, 0);
+#endif
+#if PLATFORM(QT)
+ // See comment as above
+ data->owner->m_key.setLocalData(data);
+#endif
+
+ data->value->~T();
+ fastFree(data->value);
+
+#if USE(PTHREADS)
+ pthread_setspecific(data->owner->m_key, 0);
+#elif PLATFORM(QT)
+ // Do nothing here
+#elif PLATFORM(GTK)
+ g_static_private_set(&data->owner->m_key, 0, 0);
+#elif OS(WINDOWS)
+ TlsSetValue(tlsKeys()[data->owner->m_index], 0);
+#else
+#error ThreadSpecific is not implemented for this platform.
+#endif
+
+#if !PLATFORM(QT)
+ delete data;
+#endif
+#endif
+}
+
+template<typename T>
+inline ThreadSpecific<T>::operator T*()
+{
+ T* ptr = static_cast<T*>(get());
+ if (!ptr) {
+ // Set up thread-specific value's memory pointer before invoking constructor, in case any function it calls
+ // needs to access the value, to avoid recursion.
+ ptr = static_cast<T*>(fastZeroedMalloc(sizeof(T)));
+ set(ptr);
+ new (ptr) T;
+ }
+ return ptr;
+}
+
+template<typename T>
+inline T* ThreadSpecific<T>::operator->()
+{
+ return operator T*();
+}
+
+template<typename T>
+inline T& ThreadSpecific<T>::operator*()
+{
+ return *operator T*();
+}
+
+}
+
+#endif
diff --git a/Source/JavaScriptCore/wtf/ThreadSpecificWin.cpp b/Source/JavaScriptCore/wtf/ThreadSpecificWin.cpp
new file mode 100644
index 0000000..f2c0cad
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/ThreadSpecificWin.cpp
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2009 Jian Li <jianli@chromium.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+
+#include "ThreadSpecific.h"
+#include <wtf/Noncopyable.h>
+
+#if USE(PTHREADS)
+#error This file should not be compiled by ports that do not use Windows native ThreadSpecific implementation.
+#endif
+
+namespace WTF {
+
+long& tlsKeyCount()
+{
+ static long count;
+ return count;
+}
+
+DWORD* tlsKeys()
+{
+ static DWORD keys[kMaxTlsKeySize];
+ return keys;
+}
+
+void ThreadSpecificThreadExit()
+{
+ for (long i = 0; i < tlsKeyCount(); i++) {
+ // The layout of ThreadSpecific<T>::Data does not depend on T. So we are safe to do the static cast to ThreadSpecific<int> in order to access its data member.
+ ThreadSpecific<int>::Data* data = static_cast<ThreadSpecific<int>::Data*>(TlsGetValue(tlsKeys()[i]));
+ if (data)
+ data->destructor(data);
+ }
+}
+
+} // namespace WTF
diff --git a/Source/JavaScriptCore/wtf/Threading.cpp b/Source/JavaScriptCore/wtf/Threading.cpp
new file mode 100644
index 0000000..49de59e
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/Threading.cpp
@@ -0,0 +1,98 @@
+/*
+ * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "Threading.h"
+
+#include <string.h>
+
+namespace WTF {
+
+struct NewThreadContext : FastAllocBase {
+ NewThreadContext(ThreadFunction entryPoint, void* data, const char* name)
+ : entryPoint(entryPoint)
+ , data(data)
+ , name(name)
+ {
+ }
+
+ ThreadFunction entryPoint;
+ void* data;
+ const char* name;
+
+ Mutex creationMutex;
+};
+
+static void* threadEntryPoint(void* contextData)
+{
+ NewThreadContext* context = reinterpret_cast<NewThreadContext*>(contextData);
+
+ // Block until our creating thread has completed any extra setup work, including
+ // establishing ThreadIdentifier.
+ {
+ MutexLocker locker(context->creationMutex);
+ }
+
+ initializeCurrentThreadInternal(context->name);
+
+ // Grab the info that we need out of the context, then deallocate it.
+ ThreadFunction entryPoint = context->entryPoint;
+ void* data = context->data;
+ delete context;
+
+ return entryPoint(data);
+}
+
+ThreadIdentifier createThread(ThreadFunction entryPoint, void* data, const char* name)
+{
+ // Visual Studio has a 31-character limit on thread names. Longer names will
+ // be truncated silently, but we'd like callers to know about the limit.
+#if !LOG_DISABLED
+ if (strlen(name) > 31)
+ LOG_ERROR("Thread name \"%s\" is longer than 31 characters and will be truncated by Visual Studio", name);
+#endif
+
+ NewThreadContext* context = new NewThreadContext(entryPoint, data, name);
+
+ // Prevent the thread body from executing until we've established the thread identifier.
+ MutexLocker locker(context->creationMutex);
+
+ return createThreadInternal(threadEntryPoint, context, name);
+}
+
+#if PLATFORM(MAC) || PLATFORM(WIN)
+
+// This function is deprecated but needs to be kept around for backward
+// compatibility. Use the 3-argument version of createThread above.
+
+ThreadIdentifier createThread(ThreadFunction entryPoint, void* data);
+
+ThreadIdentifier createThread(ThreadFunction entryPoint, void* data)
+{
+ return createThread(entryPoint, data, 0);
+}
+#endif
+
+} // namespace WTF
diff --git a/Source/JavaScriptCore/wtf/Threading.h b/Source/JavaScriptCore/wtf/Threading.h
new file mode 100644
index 0000000..044365f
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/Threading.h
@@ -0,0 +1,118 @@
+/*
+ * Copyright (C) 2007, 2008, 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2007 Justin Haygood (jhaygood@reaktix.com)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * Note: The implementations of InterlockedIncrement and InterlockedDecrement are based
+ * on atomic_increment and atomic_exchange_and_add from the Boost C++ Library. The license
+ * is virtually identical to the Apple license above but is included here for completeness.
+ *
+ * Boost Software License - Version 1.0 - August 17th, 2003
+ *
+ * Permission is hereby granted, free of charge, to any person or organization
+ * obtaining a copy of the software and accompanying documentation covered by
+ * this license (the "Software") to use, reproduce, display, distribute,
+ * execute, and transmit the Software, and to prepare derivative works of the
+ * Software, and to permit third-parties to whom the Software is furnished to
+ * do so, all subject to the following:
+ *
+ * The copyright notices in the Software and this entire statement, including
+ * the above license grant, this restriction and the following disclaimer,
+ * must be included in all copies of the Software, in whole or in part, and
+ * all derivative works of the Software, unless such copies or derivative
+ * works are solely in the form of machine-executable object code generated by
+ * a source language processor.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
+ * SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
+ * FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef Threading_h
+#define Threading_h
+
+#include "Platform.h"
+
+#include <stdint.h>
+#include <wtf/Assertions.h>
+#include <wtf/Atomics.h>
+#include <wtf/Locker.h>
+#include <wtf/MainThread.h>
+#include <wtf/Noncopyable.h>
+#include <wtf/ThreadSafeShared.h>
+#include <wtf/ThreadingPrimitives.h>
+
+// For portability, we do not use thread-safe statics natively supported by some compilers (e.g. gcc).
+#define AtomicallyInitializedStatic(T, name) \
+ WTF::lockAtomicallyInitializedStaticMutex(); \
+ static T name; \
+ WTF::unlockAtomicallyInitializedStaticMutex();
+
+namespace WTF {
+
+typedef uint32_t ThreadIdentifier;
+typedef void* (*ThreadFunction)(void* argument);
+
+// This function must be called from the main thread. It is safe to call it repeatedly.
+// Darwin is an exception to this rule: it is OK to call it from any thread, the only
+// requirement is that the calls are not reentrant.
+void initializeThreading();
+
+// Returns 0 if thread creation failed.
+// The thread name must be a literal since on some platforms it's passed in to the thread.
+ThreadIdentifier createThread(ThreadFunction, void*, const char* threadName);
+
+// Internal platform-specific createThread implementation.
+ThreadIdentifier createThreadInternal(ThreadFunction, void*, const char* threadName);
+
+// Called in the thread during initialization.
+// Helpful for platforms where the thread name must be set from within the thread.
+void initializeCurrentThreadInternal(const char* threadName);
+
+ThreadIdentifier currentThread();
+int waitForThreadCompletion(ThreadIdentifier, void**);
+void detachThread(ThreadIdentifier);
+
+void yield();
+
+void lockAtomicallyInitializedStaticMutex();
+void unlockAtomicallyInitializedStaticMutex();
+
+} // namespace WTF
+
+using WTF::ThreadIdentifier;
+using WTF::createThread;
+using WTF::currentThread;
+using WTF::detachThread;
+using WTF::waitForThreadCompletion;
+using WTF::yield;
+
+#endif // Threading_h
diff --git a/Source/JavaScriptCore/wtf/ThreadingNone.cpp b/Source/JavaScriptCore/wtf/ThreadingNone.cpp
new file mode 100644
index 0000000..2e8a259
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/ThreadingNone.cpp
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2007 Justin Haygood (jhaygood@reaktix.com)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "Threading.h"
+
+#if ENABLE(SINGLE_THREADED)
+
+namespace WTF {
+
+void initializeThreading() { }
+ThreadIdentifier createThreadInternal(ThreadFunction, void*, const char*) { return ThreadIdentifier(); }
+void initializeCurrentThreadInternal(const char*) { }
+int waitForThreadCompletion(ThreadIdentifier, void**) { return 0; }
+void detachThread(ThreadIdentifier) { }
+ThreadIdentifier currentThread() { return ThreadIdentifier(); }
+bool isMainThread() { return true; }
+
+Mutex::Mutex() { }
+Mutex::~Mutex() { }
+void Mutex::lock() { }
+bool Mutex::tryLock() { return false; }
+void Mutex::unlock() { }
+
+ThreadCondition::ThreadCondition() { }
+ThreadCondition::~ThreadCondition() { }
+void ThreadCondition::wait(Mutex&) { }
+bool ThreadCondition::timedWait(Mutex&, double) { return false; }
+void ThreadCondition::signal() { }
+void ThreadCondition::broadcast() { }
+
+void lockAtomicallyInitializedStaticMutex() { }
+void unlockAtomicallyInitializedStaticMutex() { }
+
+} // namespace WebCore
+
+#endif
diff --git a/Source/JavaScriptCore/wtf/ThreadingPrimitives.h b/Source/JavaScriptCore/wtf/ThreadingPrimitives.h
new file mode 100644
index 0000000..c11a6cb
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/ThreadingPrimitives.h
@@ -0,0 +1,155 @@
+/*
+ * Copyright (C) 2007, 2008, 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2007 Justin Haygood (jhaygood@reaktix.com)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef ThreadingPrimitives_h
+#define ThreadingPrimitives_h
+
+#include "Platform.h"
+
+#include <wtf/Assertions.h>
+#include <wtf/Locker.h>
+#include <wtf/Noncopyable.h>
+
+#if OS(WINDOWS)
+#include <windows.h>
+#endif
+
+#if USE(PTHREADS)
+#include <pthread.h>
+#elif PLATFORM(GTK)
+#include "GOwnPtr.h"
+#endif
+
+#if PLATFORM(QT)
+#include <qglobal.h>
+QT_BEGIN_NAMESPACE
+class QMutex;
+class QWaitCondition;
+QT_END_NAMESPACE
+#endif
+
+namespace WTF {
+
+#if USE(PTHREADS)
+typedef pthread_mutex_t PlatformMutex;
+#if HAVE(PTHREAD_RWLOCK)
+typedef pthread_rwlock_t PlatformReadWriteLock;
+#else
+typedef void* PlatformReadWriteLock;
+#endif
+typedef pthread_cond_t PlatformCondition;
+#elif PLATFORM(GTK)
+typedef GOwnPtr<GMutex> PlatformMutex;
+typedef void* PlatformReadWriteLock; // FIXME: Implement.
+typedef GOwnPtr<GCond> PlatformCondition;
+#elif PLATFORM(QT)
+typedef QT_PREPEND_NAMESPACE(QMutex)* PlatformMutex;
+typedef void* PlatformReadWriteLock; // FIXME: Implement.
+typedef QT_PREPEND_NAMESPACE(QWaitCondition)* PlatformCondition;
+#elif OS(WINDOWS)
+struct PlatformMutex {
+ CRITICAL_SECTION m_internalMutex;
+ size_t m_recursionCount;
+};
+typedef void* PlatformReadWriteLock; // FIXME: Implement.
+struct PlatformCondition {
+ size_t m_waitersGone;
+ size_t m_waitersBlocked;
+ size_t m_waitersToUnblock;
+ HANDLE m_blockLock;
+ HANDLE m_blockQueue;
+ HANDLE m_unblockLock;
+
+ bool timedWait(PlatformMutex&, DWORD durationMilliseconds);
+ void signal(bool unblockAll);
+};
+#else
+typedef void* PlatformMutex;
+typedef void* PlatformReadWriteLock;
+typedef void* PlatformCondition;
+#endif
+
+class Mutex : public Noncopyable {
+public:
+ Mutex();
+ ~Mutex();
+
+ void lock();
+ bool tryLock();
+ void unlock();
+
+public:
+ PlatformMutex& impl() { return m_mutex; }
+private:
+ PlatformMutex m_mutex;
+};
+
+typedef Locker<Mutex> MutexLocker;
+
+class ReadWriteLock : public Noncopyable {
+public:
+ ReadWriteLock();
+ ~ReadWriteLock();
+
+ void readLock();
+ bool tryReadLock();
+
+ void writeLock();
+ bool tryWriteLock();
+
+ void unlock();
+
+private:
+ PlatformReadWriteLock m_readWriteLock;
+};
+
+class ThreadCondition : public Noncopyable {
+public:
+ ThreadCondition();
+ ~ThreadCondition();
+
+ void wait(Mutex& mutex);
+ // Returns true if the condition was signaled before absoluteTime, false if the absoluteTime was reached or is in the past.
+ // The absoluteTime is in seconds, starting on January 1, 1970. The time is assumed to use the same time zone as WTF::currentTime().
+ bool timedWait(Mutex&, double absoluteTime);
+ void signal();
+ void broadcast();
+
+private:
+ PlatformCondition m_condition;
+};
+
+} // namespace WTF
+
+using WTF::Mutex;
+using WTF::MutexLocker;
+using WTF::ThreadCondition;
+
+#endif // ThreadingPrimitives_h
diff --git a/Source/JavaScriptCore/wtf/ThreadingPthreads.cpp b/Source/JavaScriptCore/wtf/ThreadingPthreads.cpp
new file mode 100644
index 0000000..bd4690f
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/ThreadingPthreads.cpp
@@ -0,0 +1,388 @@
+/*
+ * Copyright (C) 2007, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2007 Justin Haygood (jhaygood@reaktix.com)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "Threading.h"
+
+#if USE(PTHREADS)
+
+#include "CurrentTime.h"
+#include "HashMap.h"
+#include "MainThread.h"
+#include "RandomNumberSeed.h"
+#include "StdLibExtras.h"
+#include "ThreadIdentifierDataPthreads.h"
+#include "ThreadSpecific.h"
+#include "UnusedParam.h"
+#include <errno.h>
+
+#if !COMPILER(MSVC)
+#include <limits.h>
+#include <sched.h>
+#include <sys/time.h>
+#endif
+
+#if OS(ANDROID)
+#include "JNIUtility.h"
+#include "ThreadFunctionInvocation.h"
+#include <wtf/OwnPtr.h>
+#include <wtf/PassOwnPtr.h>
+#endif
+
+namespace WTF {
+
+typedef HashMap<ThreadIdentifier, pthread_t> ThreadMap;
+
+static Mutex* atomicallyInitializedStaticMutex;
+
+void clearPthreadHandleForIdentifier(ThreadIdentifier);
+
+static Mutex& threadMapMutex()
+{
+ DEFINE_STATIC_LOCAL(Mutex, mutex, ());
+ return mutex;
+}
+
+void initializeThreading()
+{
+ if (atomicallyInitializedStaticMutex)
+ return;
+
+ atomicallyInitializedStaticMutex = new Mutex;
+ threadMapMutex();
+ initializeRandomNumberGenerator();
+}
+
+void lockAtomicallyInitializedStaticMutex()
+{
+ ASSERT(atomicallyInitializedStaticMutex);
+ atomicallyInitializedStaticMutex->lock();
+}
+
+void unlockAtomicallyInitializedStaticMutex()
+{
+ atomicallyInitializedStaticMutex->unlock();
+}
+
+static ThreadMap& threadMap()
+{
+ DEFINE_STATIC_LOCAL(ThreadMap, map, ());
+ return map;
+}
+
+static ThreadIdentifier identifierByPthreadHandle(const pthread_t& pthreadHandle)
+{
+ MutexLocker locker(threadMapMutex());
+
+ ThreadMap::iterator i = threadMap().begin();
+ for (; i != threadMap().end(); ++i) {
+ if (pthread_equal(i->second, pthreadHandle))
+ return i->first;
+ }
+
+ return 0;
+}
+
+static ThreadIdentifier establishIdentifierForPthreadHandle(const pthread_t& pthreadHandle)
+{
+ ASSERT(!identifierByPthreadHandle(pthreadHandle));
+
+ MutexLocker locker(threadMapMutex());
+
+ static ThreadIdentifier identifierCount = 1;
+
+ threadMap().add(identifierCount, pthreadHandle);
+
+ return identifierCount++;
+}
+
+static pthread_t pthreadHandleForIdentifier(ThreadIdentifier id)
+{
+ MutexLocker locker(threadMapMutex());
+
+ return threadMap().get(id);
+}
+
+void clearPthreadHandleForIdentifier(ThreadIdentifier id)
+{
+ MutexLocker locker(threadMapMutex());
+
+ ASSERT(threadMap().contains(id));
+
+ threadMap().remove(id);
+}
+
+#if OS(ANDROID)
+static void* runThreadWithRegistration(void* arg)
+{
+ OwnPtr<ThreadFunctionInvocation> invocation = adoptPtr(static_cast<ThreadFunctionInvocation*>(arg));
+ JavaVM* vm = JSC::Bindings::getJavaVM();
+ JNIEnv* env;
+ void* ret = 0;
+ if (vm->AttachCurrentThread(&env, 0) == JNI_OK) {
+ ret = invocation->function(invocation->data);
+ vm->DetachCurrentThread();
+ }
+ return ret;
+}
+
+ThreadIdentifier createThreadInternal(ThreadFunction entryPoint, void* data, const char*)
+{
+ pthread_t threadHandle;
+
+ // On the Android platform, threads must be registered with the VM before they run.
+ OwnPtr<ThreadFunctionInvocation> invocation = adoptPtr(new ThreadFunctionInvocation(entryPoint, data));
+
+ if (pthread_create(&threadHandle, 0, runThreadWithRegistration, invocation.get())) {
+ LOG_ERROR("Failed to create pthread at entry point %p with data %p", entryPoint, data);
+ return 0;
+ }
+
+ // The thread will take ownership of invocation.
+ invocation.leakPtr();
+
+ return establishIdentifierForPthreadHandle(threadHandle);
+}
+#else
+ThreadIdentifier createThreadInternal(ThreadFunction entryPoint, void* data, const char*)
+{
+ pthread_t threadHandle;
+ if (pthread_create(&threadHandle, 0, entryPoint, data)) {
+ LOG_ERROR("Failed to create pthread at entry point %p with data %p", entryPoint, data);
+ return 0;
+ }
+
+ return establishIdentifierForPthreadHandle(threadHandle);
+}
+#endif
+
+void initializeCurrentThreadInternal(const char* threadName)
+{
+#if HAVE(PTHREAD_SETNAME_NP)
+ pthread_setname_np(threadName);
+#else
+ UNUSED_PARAM(threadName);
+#endif
+
+ ThreadIdentifier id = identifierByPthreadHandle(pthread_self());
+ ASSERT(id);
+ ThreadIdentifierData::initialize(id);
+}
+
+int waitForThreadCompletion(ThreadIdentifier threadID, void** result)
+{
+ ASSERT(threadID);
+
+ pthread_t pthreadHandle = pthreadHandleForIdentifier(threadID);
+ if (!pthreadHandle)
+ return 0;
+
+ int joinResult = pthread_join(pthreadHandle, result);
+ if (joinResult == EDEADLK)
+ LOG_ERROR("ThreadIdentifier %u was found to be deadlocked trying to quit", threadID);
+
+ return joinResult;
+}
+
+void detachThread(ThreadIdentifier threadID)
+{
+ ASSERT(threadID);
+
+ pthread_t pthreadHandle = pthreadHandleForIdentifier(threadID);
+ if (!pthreadHandle)
+ return;
+
+ pthread_detach(pthreadHandle);
+}
+
+void yield()
+{
+ sched_yield();
+}
+
+ThreadIdentifier currentThread()
+{
+ ThreadIdentifier id = ThreadIdentifierData::identifier();
+ if (id)
+ return id;
+
+ // Not a WTF-created thread, ThreadIdentifier is not established yet.
+ id = establishIdentifierForPthreadHandle(pthread_self());
+ ThreadIdentifierData::initialize(id);
+ return id;
+}
+
+Mutex::Mutex()
+{
+ pthread_mutexattr_t attr;
+ pthread_mutexattr_init(&attr);
+ pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_NORMAL);
+
+ pthread_mutex_init(&m_mutex, &attr);
+
+ pthread_mutexattr_destroy(&attr);
+}
+
+Mutex::~Mutex()
+{
+ pthread_mutex_destroy(&m_mutex);
+}
+
+void Mutex::lock()
+{
+ int result = pthread_mutex_lock(&m_mutex);
+ ASSERT_UNUSED(result, !result);
+}
+
+bool Mutex::tryLock()
+{
+ int result = pthread_mutex_trylock(&m_mutex);
+
+ if (result == 0)
+ return true;
+ if (result == EBUSY)
+ return false;
+
+ ASSERT_NOT_REACHED();
+ return false;
+}
+
+void Mutex::unlock()
+{
+ int result = pthread_mutex_unlock(&m_mutex);
+ ASSERT_UNUSED(result, !result);
+}
+
+#if HAVE(PTHREAD_RWLOCK)
+ReadWriteLock::ReadWriteLock()
+{
+ pthread_rwlock_init(&m_readWriteLock, NULL);
+}
+
+ReadWriteLock::~ReadWriteLock()
+{
+ pthread_rwlock_destroy(&m_readWriteLock);
+}
+
+void ReadWriteLock::readLock()
+{
+ int result = pthread_rwlock_rdlock(&m_readWriteLock);
+ ASSERT_UNUSED(result, !result);
+}
+
+bool ReadWriteLock::tryReadLock()
+{
+ int result = pthread_rwlock_tryrdlock(&m_readWriteLock);
+
+ if (result == 0)
+ return true;
+ if (result == EBUSY || result == EAGAIN)
+ return false;
+
+ ASSERT_NOT_REACHED();
+ return false;
+}
+
+void ReadWriteLock::writeLock()
+{
+ int result = pthread_rwlock_wrlock(&m_readWriteLock);
+ ASSERT_UNUSED(result, !result);
+}
+
+bool ReadWriteLock::tryWriteLock()
+{
+ int result = pthread_rwlock_trywrlock(&m_readWriteLock);
+
+ if (result == 0)
+ return true;
+ if (result == EBUSY || result == EAGAIN)
+ return false;
+
+ ASSERT_NOT_REACHED();
+ return false;
+}
+
+void ReadWriteLock::unlock()
+{
+ int result = pthread_rwlock_unlock(&m_readWriteLock);
+ ASSERT_UNUSED(result, !result);
+}
+#endif // HAVE(PTHREAD_RWLOCK)
+
+ThreadCondition::ThreadCondition()
+{
+ pthread_cond_init(&m_condition, NULL);
+}
+
+ThreadCondition::~ThreadCondition()
+{
+ pthread_cond_destroy(&m_condition);
+}
+
+void ThreadCondition::wait(Mutex& mutex)
+{
+ int result = pthread_cond_wait(&m_condition, &mutex.impl());
+ ASSERT_UNUSED(result, !result);
+}
+
+bool ThreadCondition::timedWait(Mutex& mutex, double absoluteTime)
+{
+ if (absoluteTime < currentTime())
+ return false;
+
+ if (absoluteTime > INT_MAX) {
+ wait(mutex);
+ return true;
+ }
+
+ int timeSeconds = static_cast<int>(absoluteTime);
+ int timeNanoseconds = static_cast<int>((absoluteTime - timeSeconds) * 1E9);
+
+ timespec targetTime;
+ targetTime.tv_sec = timeSeconds;
+ targetTime.tv_nsec = timeNanoseconds;
+
+ return pthread_cond_timedwait(&m_condition, &mutex.impl(), &targetTime) == 0;
+}
+
+void ThreadCondition::signal()
+{
+ int result = pthread_cond_signal(&m_condition);
+ ASSERT_UNUSED(result, !result);
+}
+
+void ThreadCondition::broadcast()
+{
+ int result = pthread_cond_broadcast(&m_condition);
+ ASSERT_UNUSED(result, !result);
+}
+
+} // namespace WTF
+
+#endif // USE(PTHREADS)
diff --git a/Source/JavaScriptCore/wtf/ThreadingWin.cpp b/Source/JavaScriptCore/wtf/ThreadingWin.cpp
new file mode 100644
index 0000000..00319a4
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/ThreadingWin.cpp
@@ -0,0 +1,487 @@
+/*
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ * Copyright (C) 2009 Torch Mobile, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * There are numerous academic and practical works on how to implement pthread_cond_wait/pthread_cond_signal/pthread_cond_broadcast
+ * functions on Win32. Here is one example: http://www.cs.wustl.edu/~schmidt/win32-cv-1.html which is widely credited as a 'starting point'
+ * of modern attempts. There are several more or less proven implementations, one in Boost C++ library (http://www.boost.org) and another
+ * in pthreads-win32 (http://sourceware.org/pthreads-win32/).
+ *
+ * The number of articles and discussions is the evidence of significant difficulties in implementing these primitives correctly.
+ * The brief search of revisions, ChangeLog entries, discussions in comp.programming.threads and other places clearly documents
+ * numerous pitfalls and performance problems the authors had to overcome to arrive to the suitable implementations.
+ * Optimally, WebKit would use one of those supported/tested libraries directly. To roll out our own implementation is impractical,
+ * if even for the lack of sufficient testing. However, a faithful reproduction of the code from one of the popular supported
+ * libraries seems to be a good compromise.
+ *
+ * The early Boost implementation (http://www.boxbackup.org/trac/browser/box/nick/win/lib/win32/boost_1_32_0/libs/thread/src/condition.cpp?rev=30)
+ * is identical to pthreads-win32 (http://sourceware.org/cgi-bin/cvsweb.cgi/pthreads/pthread_cond_wait.c?rev=1.10&content-type=text/x-cvsweb-markup&cvsroot=pthreads-win32).
+ * Current Boost uses yet another (although seemingly equivalent) algorithm which came from their 'thread rewrite' effort.
+ *
+ * This file includes timedWait/signal/broadcast implementations translated to WebKit coding style from the latest algorithm by
+ * Alexander Terekhov and Louis Thomas, as captured here: http://sourceware.org/cgi-bin/cvsweb.cgi/pthreads/pthread_cond_wait.c?rev=1.10&content-type=text/x-cvsweb-markup&cvsroot=pthreads-win32
+ * It replaces the implementation of their previous algorithm, also documented in the same source above.
+ * The naming and comments are left very close to original to enable easy cross-check.
+ *
+ * The corresponding Pthreads-win32 License is included below, and CONTRIBUTORS file which it refers to is added to
+ * source directory (as CONTRIBUTORS.pthreads-win32).
+ */
+
+/*
+ * Pthreads-win32 - POSIX Threads Library for Win32
+ * Copyright(C) 1998 John E. Bossom
+ * Copyright(C) 1999,2005 Pthreads-win32 contributors
+ *
+ * Contact Email: rpj@callisto.canberra.edu.au
+ *
+ * The current list of contributors is contained
+ * in the file CONTRIBUTORS included with the source
+ * code distribution. The list can also be seen at the
+ * following World Wide Web location:
+ * http://sources.redhat.com/pthreads-win32/contributors.html
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library in the file COPYING.LIB;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+#include "config.h"
+#include "Threading.h"
+
+#include "MainThread.h"
+#include "ThreadFunctionInvocation.h"
+#include <windows.h>
+#include <wtf/CurrentTime.h>
+#include <wtf/HashMap.h>
+#include <wtf/MathExtras.h>
+#include <wtf/OwnPtr.h>
+#include <wtf/PassOwnPtr.h>
+#include <wtf/RandomNumberSeed.h>
+
+#if !USE(PTHREADS) && OS(WINDOWS)
+#include "ThreadSpecific.h"
+#endif
+
+#if !OS(WINCE)
+#include <process.h>
+#endif
+
+#if HAVE(ERRNO_H)
+#include <errno.h>
+#endif
+
+namespace WTF {
+
+// MS_VC_EXCEPTION, THREADNAME_INFO, and setThreadNameInternal all come from <http://msdn.microsoft.com/en-us/library/xcb2z8hs.aspx>.
+static const DWORD MS_VC_EXCEPTION = 0x406D1388;
+
+#pragma pack(push, 8)
+typedef struct tagTHREADNAME_INFO {
+ DWORD dwType; // must be 0x1000
+ LPCSTR szName; // pointer to name (in user addr space)
+ DWORD dwThreadID; // thread ID (-1=caller thread)
+ DWORD dwFlags; // reserved for future use, must be zero
+} THREADNAME_INFO;
+#pragma pack(pop)
+
+void initializeCurrentThreadInternal(const char* szThreadName)
+{
+ THREADNAME_INFO info;
+ info.dwType = 0x1000;
+ info.szName = szThreadName;
+ info.dwThreadID = GetCurrentThreadId();
+ info.dwFlags = 0;
+
+ __try {
+ RaiseException(MS_VC_EXCEPTION, 0, sizeof(info)/sizeof(ULONG_PTR), reinterpret_cast<ULONG_PTR*>(&info));
+ } __except (EXCEPTION_CONTINUE_EXECUTION) {
+ }
+}
+
+static Mutex* atomicallyInitializedStaticMutex;
+
+void lockAtomicallyInitializedStaticMutex()
+{
+ ASSERT(atomicallyInitializedStaticMutex);
+ atomicallyInitializedStaticMutex->lock();
+}
+
+void unlockAtomicallyInitializedStaticMutex()
+{
+ atomicallyInitializedStaticMutex->unlock();
+}
+
+static Mutex& threadMapMutex()
+{
+ static Mutex mutex;
+ return mutex;
+}
+
+void initializeThreading()
+{
+ if (atomicallyInitializedStaticMutex)
+ return;
+
+ atomicallyInitializedStaticMutex = new Mutex;
+ threadMapMutex();
+ initializeRandomNumberGenerator();
+}
+
+static HashMap<DWORD, HANDLE>& threadMap()
+{
+ static HashMap<DWORD, HANDLE> map;
+ return map;
+}
+
+static void storeThreadHandleByIdentifier(DWORD threadID, HANDLE threadHandle)
+{
+ MutexLocker locker(threadMapMutex());
+ ASSERT(!threadMap().contains(threadID));
+ threadMap().add(threadID, threadHandle);
+}
+
+static HANDLE threadHandleForIdentifier(ThreadIdentifier id)
+{
+ MutexLocker locker(threadMapMutex());
+ return threadMap().get(id);
+}
+
+static void clearThreadHandleForIdentifier(ThreadIdentifier id)
+{
+ MutexLocker locker(threadMapMutex());
+ ASSERT(threadMap().contains(id));
+ threadMap().remove(id);
+}
+
+static unsigned __stdcall wtfThreadEntryPoint(void* param)
+{
+ OwnPtr<ThreadFunctionInvocation> invocation = adoptPtr(static_cast<ThreadFunctionInvocation*>(param));
+ void* result = invocation->function(invocation->data);
+
+#if !USE(PTHREADS) && OS(WINDOWS)
+ // Do the TLS cleanup.
+ ThreadSpecificThreadExit();
+#endif
+
+ return reinterpret_cast<unsigned>(result);
+}
+
+ThreadIdentifier createThreadInternal(ThreadFunction entryPoint, void* data, const char* threadName)
+{
+ unsigned threadIdentifier = 0;
+ ThreadIdentifier threadID = 0;
+ OwnPtr<ThreadFunctionInvocation> invocation = adoptPtr(new ThreadFunctionInvocation(entryPoint, data));
+#if OS(WINCE)
+ // This is safe on WINCE, since CRT is in the core and innately multithreaded.
+ // On desktop Windows, need to use _beginthreadex (not available on WinCE) if using any CRT functions
+ HANDLE threadHandle = CreateThread(0, 0, (LPTHREAD_START_ROUTINE)wtfThreadEntryPoint, invocation.get(), 0, (LPDWORD)&threadIdentifier);
+#else
+ HANDLE threadHandle = reinterpret_cast<HANDLE>(_beginthreadex(0, 0, wtfThreadEntryPoint, invocation.get(), 0, &threadIdentifier));
+#endif
+ if (!threadHandle) {
+#if OS(WINCE)
+ LOG_ERROR("Failed to create thread at entry point %p with data %p: %ld", entryPoint, data, ::GetLastError());
+#elif !HAVE(ERRNO_H)
+ LOG_ERROR("Failed to create thread at entry point %p with data %p.", entryPoint, data);
+#else
+ LOG_ERROR("Failed to create thread at entry point %p with data %p: %ld", entryPoint, data, errno);
+#endif
+ return 0;
+ }
+
+ // The thread will take ownership of invocation.
+ invocation.leakPtr();
+
+ threadID = static_cast<ThreadIdentifier>(threadIdentifier);
+ storeThreadHandleByIdentifier(threadIdentifier, threadHandle);
+
+ return threadID;
+}
+
+int waitForThreadCompletion(ThreadIdentifier threadID, void** result)
+{
+ ASSERT(threadID);
+
+ HANDLE threadHandle = threadHandleForIdentifier(threadID);
+ if (!threadHandle)
+ LOG_ERROR("ThreadIdentifier %u did not correspond to an active thread when trying to quit", threadID);
+
+ DWORD joinResult = WaitForSingleObject(threadHandle, INFINITE);
+ if (joinResult == WAIT_FAILED)
+ LOG_ERROR("ThreadIdentifier %u was found to be deadlocked trying to quit", threadID);
+
+ CloseHandle(threadHandle);
+ clearThreadHandleForIdentifier(threadID);
+
+ return joinResult;
+}
+
+void detachThread(ThreadIdentifier threadID)
+{
+ ASSERT(threadID);
+
+ HANDLE threadHandle = threadHandleForIdentifier(threadID);
+ if (threadHandle)
+ CloseHandle(threadHandle);
+ clearThreadHandleForIdentifier(threadID);
+}
+
+void yield()
+{
+ ::Sleep(1);
+}
+
+ThreadIdentifier currentThread()
+{
+ return static_cast<ThreadIdentifier>(GetCurrentThreadId());
+}
+
+Mutex::Mutex()
+{
+ m_mutex.m_recursionCount = 0;
+ InitializeCriticalSection(&m_mutex.m_internalMutex);
+}
+
+Mutex::~Mutex()
+{
+ DeleteCriticalSection(&m_mutex.m_internalMutex);
+}
+
+void Mutex::lock()
+{
+ EnterCriticalSection(&m_mutex.m_internalMutex);
+ ++m_mutex.m_recursionCount;
+}
+
+bool Mutex::tryLock()
+{
+ // This method is modeled after the behavior of pthread_mutex_trylock,
+ // which will return an error if the lock is already owned by the
+ // current thread. Since the primitive Win32 'TryEnterCriticalSection'
+ // treats this as a successful case, it changes the behavior of several
+ // tests in WebKit that check to see if the current thread already
+ // owned this mutex (see e.g., IconDatabase::getOrCreateIconRecord)
+ DWORD result = TryEnterCriticalSection(&m_mutex.m_internalMutex);
+
+ if (result != 0) { // We got the lock
+ // If this thread already had the lock, we must unlock and
+ // return false so that we mimic the behavior of POSIX's
+ // pthread_mutex_trylock:
+ if (m_mutex.m_recursionCount > 0) {
+ LeaveCriticalSection(&m_mutex.m_internalMutex);
+ return false;
+ }
+
+ ++m_mutex.m_recursionCount;
+ return true;
+ }
+
+ return false;
+}
+
+void Mutex::unlock()
+{
+ --m_mutex.m_recursionCount;
+ LeaveCriticalSection(&m_mutex.m_internalMutex);
+}
+
+bool PlatformCondition::timedWait(PlatformMutex& mutex, DWORD durationMilliseconds)
+{
+ // Enter the wait state.
+ DWORD res = WaitForSingleObject(m_blockLock, INFINITE);
+ ASSERT(res == WAIT_OBJECT_0);
+ ++m_waitersBlocked;
+ res = ReleaseSemaphore(m_blockLock, 1, 0);
+ ASSERT(res);
+
+ LeaveCriticalSection(&mutex.m_internalMutex);
+
+ // Main wait - use timeout.
+ bool timedOut = (WaitForSingleObject(m_blockQueue, durationMilliseconds) == WAIT_TIMEOUT);
+
+ res = WaitForSingleObject(m_unblockLock, INFINITE);
+ ASSERT(res == WAIT_OBJECT_0);
+
+ int signalsLeft = m_waitersToUnblock;
+
+ if (m_waitersToUnblock)
+ --m_waitersToUnblock;
+ else if (++m_waitersGone == (INT_MAX / 2)) { // timeout/canceled or spurious semaphore
+ // timeout or spurious wakeup occured, normalize the m_waitersGone count
+ // this may occur if many calls to wait with a timeout are made and
+ // no call to notify_* is made
+ res = WaitForSingleObject(m_blockLock, INFINITE);
+ ASSERT(res == WAIT_OBJECT_0);
+ m_waitersBlocked -= m_waitersGone;
+ res = ReleaseSemaphore(m_blockLock, 1, 0);
+ ASSERT(res);
+ m_waitersGone = 0;
+ }
+
+ res = ReleaseMutex(m_unblockLock);
+ ASSERT(res);
+
+ if (signalsLeft == 1) {
+ res = ReleaseSemaphore(m_blockLock, 1, 0); // Open the gate.
+ ASSERT(res);
+ }
+
+ EnterCriticalSection (&mutex.m_internalMutex);
+
+ return !timedOut;
+}
+
+void PlatformCondition::signal(bool unblockAll)
+{
+ unsigned signalsToIssue = 0;
+
+ DWORD res = WaitForSingleObject(m_unblockLock, INFINITE);
+ ASSERT(res == WAIT_OBJECT_0);
+
+ if (m_waitersToUnblock) { // the gate is already closed
+ if (!m_waitersBlocked) { // no-op
+ res = ReleaseMutex(m_unblockLock);
+ ASSERT(res);
+ return;
+ }
+
+ if (unblockAll) {
+ signalsToIssue = m_waitersBlocked;
+ m_waitersToUnblock += m_waitersBlocked;
+ m_waitersBlocked = 0;
+ } else {
+ signalsToIssue = 1;
+ ++m_waitersToUnblock;
+ --m_waitersBlocked;
+ }
+ } else if (m_waitersBlocked > m_waitersGone) {
+ res = WaitForSingleObject(m_blockLock, INFINITE); // Close the gate.
+ ASSERT(res == WAIT_OBJECT_0);
+ if (m_waitersGone != 0) {
+ m_waitersBlocked -= m_waitersGone;
+ m_waitersGone = 0;
+ }
+ if (unblockAll) {
+ signalsToIssue = m_waitersBlocked;
+ m_waitersToUnblock = m_waitersBlocked;
+ m_waitersBlocked = 0;
+ } else {
+ signalsToIssue = 1;
+ m_waitersToUnblock = 1;
+ --m_waitersBlocked;
+ }
+ } else { // No-op.
+ res = ReleaseMutex(m_unblockLock);
+ ASSERT(res);
+ return;
+ }
+
+ res = ReleaseMutex(m_unblockLock);
+ ASSERT(res);
+
+ if (signalsToIssue) {
+ res = ReleaseSemaphore(m_blockQueue, signalsToIssue, 0);
+ ASSERT(res);
+ }
+}
+
+static const long MaxSemaphoreCount = static_cast<long>(~0UL >> 1);
+
+ThreadCondition::ThreadCondition()
+{
+ m_condition.m_waitersGone = 0;
+ m_condition.m_waitersBlocked = 0;
+ m_condition.m_waitersToUnblock = 0;
+ m_condition.m_blockLock = CreateSemaphore(0, 1, 1, 0);
+ m_condition.m_blockQueue = CreateSemaphore(0, 0, MaxSemaphoreCount, 0);
+ m_condition.m_unblockLock = CreateMutex(0, 0, 0);
+
+ if (!m_condition.m_blockLock || !m_condition.m_blockQueue || !m_condition.m_unblockLock) {
+ if (m_condition.m_blockLock)
+ CloseHandle(m_condition.m_blockLock);
+ if (m_condition.m_blockQueue)
+ CloseHandle(m_condition.m_blockQueue);
+ if (m_condition.m_unblockLock)
+ CloseHandle(m_condition.m_unblockLock);
+ }
+}
+
+ThreadCondition::~ThreadCondition()
+{
+ CloseHandle(m_condition.m_blockLock);
+ CloseHandle(m_condition.m_blockQueue);
+ CloseHandle(m_condition.m_unblockLock);
+}
+
+void ThreadCondition::wait(Mutex& mutex)
+{
+ m_condition.timedWait(mutex.impl(), INFINITE);
+}
+
+bool ThreadCondition::timedWait(Mutex& mutex, double absoluteTime)
+{
+ double currentTime = WTF::currentTime();
+
+ // Time is in the past - return immediately.
+ if (absoluteTime < currentTime)
+ return false;
+
+ // Time is too far in the future (and would overflow unsigned long) - wait forever.
+ if (absoluteTime - currentTime > static_cast<double>(INT_MAX) / 1000.0) {
+ wait(mutex);
+ return true;
+ }
+
+ double intervalMilliseconds = (absoluteTime - currentTime) * 1000.0;
+ return m_condition.timedWait(mutex.impl(), static_cast<unsigned long>(intervalMilliseconds));
+}
+
+void ThreadCondition::signal()
+{
+ m_condition.signal(false); // Unblock only 1 thread.
+}
+
+void ThreadCondition::broadcast()
+{
+ m_condition.signal(true); // Unblock all threads.
+}
+
+} // namespace WTF
diff --git a/Source/JavaScriptCore/wtf/TypeTraits.cpp b/Source/JavaScriptCore/wtf/TypeTraits.cpp
new file mode 100644
index 0000000..afeaa5e
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/TypeTraits.cpp
@@ -0,0 +1,142 @@
+ /*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2009, 2010 Google Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+#include "TypeTraits.h"
+
+#include "Assertions.h"
+
+namespace WTF {
+
+COMPILE_ASSERT(IsInteger<bool>::value, WTF_IsInteger_bool_true);
+COMPILE_ASSERT(IsInteger<char>::value, WTF_IsInteger_char_true);
+COMPILE_ASSERT(IsInteger<signed char>::value, WTF_IsInteger_signed_char_true);
+COMPILE_ASSERT(IsInteger<unsigned char>::value, WTF_IsInteger_unsigned_char_true);
+COMPILE_ASSERT(IsInteger<short>::value, WTF_IsInteger_short_true);
+COMPILE_ASSERT(IsInteger<unsigned short>::value, WTF_IsInteger_unsigned_short_true);
+COMPILE_ASSERT(IsInteger<int>::value, WTF_IsInteger_int_true);
+COMPILE_ASSERT(IsInteger<unsigned int>::value, WTF_IsInteger_unsigned_int_true);
+COMPILE_ASSERT(IsInteger<long>::value, WTF_IsInteger_long_true);
+COMPILE_ASSERT(IsInteger<unsigned long>::value, WTF_IsInteger_unsigned_long_true);
+COMPILE_ASSERT(IsInteger<long long>::value, WTF_IsInteger_long_long_true);
+COMPILE_ASSERT(IsInteger<unsigned long long>::value, WTF_IsInteger_unsigned_long_long_true);
+#if !COMPILER(MSVC) || defined(_NATIVE_WCHAR_T_DEFINED)
+COMPILE_ASSERT(IsInteger<wchar_t>::value, WTF_IsInteger_wchar_t_true);
+#endif
+COMPILE_ASSERT(!IsInteger<char*>::value, WTF_IsInteger_char_pointer_false);
+COMPILE_ASSERT(!IsInteger<const char*>::value, WTF_IsInteger_const_char_pointer_false);
+COMPILE_ASSERT(!IsInteger<volatile char*>::value, WTF_IsInteger_volatile_char_pointer_false);
+COMPILE_ASSERT(!IsInteger<double>::value, WTF_IsInteger_double_false);
+COMPILE_ASSERT(!IsInteger<float>::value, WTF_IsInteger_float_false);
+
+COMPILE_ASSERT(IsFloatingPoint<float>::value, WTF_IsFloatingPoint_float_true);
+COMPILE_ASSERT(IsFloatingPoint<double>::value, WTF_IsFloatingPoint_double_true);
+COMPILE_ASSERT(IsFloatingPoint<long double>::value, WTF_IsFloatingPoint_long_double_true);
+COMPILE_ASSERT(!IsFloatingPoint<int>::value, WTF_IsFloatingPoint_int_false);
+
+COMPILE_ASSERT(IsPod<bool>::value, WTF_IsPod_bool_true);
+COMPILE_ASSERT(IsPod<char>::value, WTF_IsPod_char_true);
+COMPILE_ASSERT(IsPod<signed char>::value, WTF_IsPod_signed_char_true);
+COMPILE_ASSERT(IsPod<unsigned char>::value, WTF_IsPod_unsigned_char_true);
+COMPILE_ASSERT(IsPod<short>::value, WTF_IsPod_short_true);
+COMPILE_ASSERT(IsPod<unsigned short>::value, WTF_IsPod_unsigned_short_true);
+COMPILE_ASSERT(IsPod<int>::value, WTF_IsPod_int_true);
+COMPILE_ASSERT(IsPod<unsigned int>::value, WTF_IsPod_unsigned_int_true);
+COMPILE_ASSERT(IsPod<long>::value, WTF_IsPod_long_true);
+COMPILE_ASSERT(IsPod<unsigned long>::value, WTF_IsPod_unsigned_long_true);
+COMPILE_ASSERT(IsPod<long long>::value, WTF_IsPod_long_long_true);
+COMPILE_ASSERT(IsPod<unsigned long long>::value, WTF_IsPod_unsigned_long_long_true);
+#if !COMPILER(MSVC) || defined(_NATIVE_WCHAR_T_DEFINED)
+COMPILE_ASSERT(IsPod<wchar_t>::value, WTF_IsPod_wchar_t_true);
+#endif
+COMPILE_ASSERT(IsPod<char*>::value, WTF_IsPod_char_pointer_true);
+COMPILE_ASSERT(IsPod<const char*>::value, WTF_IsPod_const_char_pointer_true);
+COMPILE_ASSERT(IsPod<volatile char*>::value, WTF_IsPod_volatile_char_pointer_true);
+COMPILE_ASSERT(IsPod<double>::value, WTF_IsPod_double_true);
+COMPILE_ASSERT(IsPod<long double>::value, WTF_IsPod_long_double_true);
+COMPILE_ASSERT(IsPod<float>::value, WTF_IsPod_float_true);
+COMPILE_ASSERT(!IsPod<IsPod<bool> >::value, WTF_IsPod_struct_false);
+
+enum IsConvertibleToIntegerCheck { };
+COMPILE_ASSERT(IsConvertibleToInteger<IsConvertibleToIntegerCheck>::value, WTF_IsConvertibleToInteger_enum_true);
+COMPILE_ASSERT(IsConvertibleToInteger<bool>::value, WTF_IsConvertibleToInteger_bool_true);
+COMPILE_ASSERT(IsConvertibleToInteger<char>::value, WTF_IsConvertibleToInteger_char_true);
+COMPILE_ASSERT(IsConvertibleToInteger<signed char>::value, WTF_IsConvertibleToInteger_signed_char_true);
+COMPILE_ASSERT(IsConvertibleToInteger<unsigned char>::value, WTF_IsConvertibleToInteger_unsigned_char_true);
+COMPILE_ASSERT(IsConvertibleToInteger<short>::value, WTF_IsConvertibleToInteger_short_true);
+COMPILE_ASSERT(IsConvertibleToInteger<unsigned short>::value, WTF_IsConvertibleToInteger_unsigned_short_true);
+COMPILE_ASSERT(IsConvertibleToInteger<int>::value, WTF_IsConvertibleToInteger_int_true);
+COMPILE_ASSERT(IsConvertibleToInteger<unsigned int>::value, WTF_IsConvertibleToInteger_unsigned_int_true);
+COMPILE_ASSERT(IsConvertibleToInteger<long>::value, WTF_IsConvertibleToInteger_long_true);
+COMPILE_ASSERT(IsConvertibleToInteger<unsigned long>::value, WTF_IsConvertibleToInteger_unsigned_long_true);
+COMPILE_ASSERT(IsConvertibleToInteger<long long>::value, WTF_IsConvertibleToInteger_long_long_true);
+COMPILE_ASSERT(IsConvertibleToInteger<unsigned long long>::value, WTF_IsConvertibleToInteger_unsigned_long_long_true);
+#if !COMPILER(MSVC) || defined(_NATIVE_WCHAR_T_DEFINED)
+COMPILE_ASSERT(IsConvertibleToInteger<wchar_t>::value, WTF_IsConvertibleToInteger_wchar_t_true);
+#endif
+COMPILE_ASSERT(IsConvertibleToInteger<double>::value, WTF_IsConvertibleToInteger_double_true);
+COMPILE_ASSERT(IsConvertibleToInteger<long double>::value, WTF_IsConvertibleToInteger_long_double_true);
+COMPILE_ASSERT(IsConvertibleToInteger<float>::value, WTF_IsConvertibleToInteger_float_true);
+COMPILE_ASSERT(!IsConvertibleToInteger<char*>::value, WTF_IsConvertibleToInteger_char_pointer_false);
+COMPILE_ASSERT(!IsConvertibleToInteger<const char*>::value, WTF_IsConvertibleToInteger_const_char_pointer_false);
+COMPILE_ASSERT(!IsConvertibleToInteger<volatile char*>::value, WTF_IsConvertibleToInteger_volatile_char_pointer_false);
+COMPILE_ASSERT(!IsConvertibleToInteger<IsConvertibleToInteger<bool> >::value, WTF_IsConvertibleToInteger_struct_false);
+
+COMPILE_ASSERT((IsSameType<bool, bool>::value), WTF_IsSameType_bool_true);
+COMPILE_ASSERT((IsSameType<int*, int*>::value), WTF_IsSameType_int_pointer_true);
+COMPILE_ASSERT((!IsSameType<int, int*>::value), WTF_IsSameType_int_int_pointer_false);
+COMPILE_ASSERT((!IsSameType<bool, const bool>::value), WTF_IsSameType_const_change_false);
+COMPILE_ASSERT((!IsSameType<bool, volatile bool>::value), WTF_IsSameType_volatile_change_false);
+
+template <typename T>
+class TestBaseClass {
+};
+
+class TestDerivedClass : public TestBaseClass<int> {
+};
+
+COMPILE_ASSERT((IsSubclass<TestDerivedClass, TestBaseClass<int> >::value), WTF_Test_IsSubclass_Derived_From_Base);
+COMPILE_ASSERT((!IsSubclass<TestBaseClass<int>, TestDerivedClass>::value), WTF_Test_IsSubclass_Base_From_Derived);
+COMPILE_ASSERT((IsSubclassOfTemplate<TestDerivedClass, TestBaseClass>::value), WTF_Test_IsSubclassOfTemplate_Base_From_Derived);
+COMPILE_ASSERT((IsSameType<RemoveTemplate<TestBaseClass<int>, TestBaseClass>::Type, int>::value), WTF_Test_RemoveTemplate);
+COMPILE_ASSERT((IsSameType<RemoveTemplate<int, TestBaseClass>::Type, int>::value), WTF_Test_RemoveTemplate_WithoutTemplate);
+
+
+COMPILE_ASSERT((IsSameType<bool, RemoveConst<const bool>::Type>::value), WTF_test_RemoveConst_const_bool);
+COMPILE_ASSERT((!IsSameType<bool, RemoveConst<volatile bool>::Type>::value), WTF_test_RemoveConst_volatile_bool);
+
+COMPILE_ASSERT((IsSameType<bool, RemoveVolatile<bool>::Type>::value), WTF_test_RemoveVolatile_bool);
+COMPILE_ASSERT((!IsSameType<bool, RemoveVolatile<const bool>::Type>::value), WTF_test_RemoveVolatile_const_bool);
+COMPILE_ASSERT((IsSameType<bool, RemoveVolatile<volatile bool>::Type>::value), WTF_test_RemoveVolatile_volatile_bool);
+
+COMPILE_ASSERT((IsSameType<bool, RemoveConstVolatile<bool>::Type>::value), WTF_test_RemoveConstVolatile_bool);
+COMPILE_ASSERT((IsSameType<bool, RemoveConstVolatile<const bool>::Type>::value), WTF_test_RemoveConstVolatile_const_bool);
+COMPILE_ASSERT((IsSameType<bool, RemoveConstVolatile<volatile bool>::Type>::value), WTF_test_RemoveConstVolatile_volatile_bool);
+COMPILE_ASSERT((IsSameType<bool, RemoveConstVolatile<const volatile bool>::Type>::value), WTF_test_RemoveConstVolatile_const_volatile_bool);
+
+COMPILE_ASSERT((IsSameType<int, RemovePointer<int>::Type>::value), WTF_Test_RemovePointer_int);
+COMPILE_ASSERT((IsSameType<int, RemovePointer<int*>::Type>::value), WTF_Test_RemovePointer_int_pointer);
+COMPILE_ASSERT((!IsSameType<int, RemovePointer<int**>::Type>::value), WTF_Test_RemovePointer_int_pointer_pointer);
+
+COMPILE_ASSERT((IsSameType<int, RemoveReference<int>::Type>::value), WTF_Test_RemoveReference_int);
+COMPILE_ASSERT((IsSameType<int, RemoveReference<int&>::Type>::value), WTF_Test_RemoveReference_int_reference);
+
+} // namespace WTF
diff --git a/Source/JavaScriptCore/wtf/TypeTraits.h b/Source/JavaScriptCore/wtf/TypeTraits.h
new file mode 100644
index 0000000..44103cd
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/TypeTraits.h
@@ -0,0 +1,386 @@
+ /*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2009, 2010 Google Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef TypeTraits_h
+#define TypeTraits_h
+
+#include "Platform.h"
+
+#if (defined(__GLIBCXX__) && (__GLIBCXX__ >= 20070724) && defined(__GXX_EXPERIMENTAL_CXX0X__)) || (defined(_MSC_VER) && (_MSC_VER >= 1600))
+#include <type_traits>
+#endif
+
+namespace WTF {
+
+ // The following are provided in this file:
+ //
+ // IsInteger<T>::value
+ // IsPod<T>::value, see the definition for a note about its limitations
+ // IsConvertibleToInteger<T>::value
+ //
+ // IsSameType<T, U>::value
+ //
+ // RemovePointer<T>::Type
+ // RemoveReference<T>::Type
+ // RemoveConst<T>::Type
+ // RemoveVolatile<T>::Type
+ // RemoveConstVolatile<T>::Type
+ //
+ // COMPILE_ASSERT's in TypeTraits.cpp illustrate their usage and what they do.
+
+ template<typename T> struct IsInteger { static const bool value = false; };
+ template<> struct IsInteger<bool> { static const bool value = true; };
+ template<> struct IsInteger<char> { static const bool value = true; };
+ template<> struct IsInteger<signed char> { static const bool value = true; };
+ template<> struct IsInteger<unsigned char> { static const bool value = true; };
+ template<> struct IsInteger<short> { static const bool value = true; };
+ template<> struct IsInteger<unsigned short> { static const bool value = true; };
+ template<> struct IsInteger<int> { static const bool value = true; };
+ template<> struct IsInteger<unsigned int> { static const bool value = true; };
+ template<> struct IsInteger<long> { static const bool value = true; };
+ template<> struct IsInteger<unsigned long> { static const bool value = true; };
+ template<> struct IsInteger<long long> { static const bool value = true; };
+ template<> struct IsInteger<unsigned long long> { static const bool value = true; };
+#if !COMPILER(MSVC) || defined(_NATIVE_WCHAR_T_DEFINED)
+ template<> struct IsInteger<wchar_t> { static const bool value = true; };
+#endif
+
+ template<typename T> struct IsFloatingPoint { static const bool value = false; };
+ template<> struct IsFloatingPoint<float> { static const bool value = true; };
+ template<> struct IsFloatingPoint<double> { static const bool value = true; };
+ template<> struct IsFloatingPoint<long double> { static const bool value = true; };
+
+ template<typename T> struct IsArithmetic { static const bool value = IsInteger<T>::value || IsFloatingPoint<T>::value; };
+
+ // IsPod is misnamed as it doesn't cover all plain old data (pod) types.
+ // Specifically, it doesn't allow for enums or for structs.
+ template <typename T> struct IsPod { static const bool value = IsArithmetic<T>::value; };
+ template <typename P> struct IsPod<P*> { static const bool value = true; };
+
+ template<typename T> class IsConvertibleToInteger {
+ // Avoid "possible loss of data" warning when using Microsoft's C++ compiler
+ // by not converting int's to doubles.
+ template<bool performCheck, typename U> class IsConvertibleToDouble;
+ template<typename U> class IsConvertibleToDouble<false, U> {
+ public:
+ static const bool value = false;
+ };
+
+ template<typename U> class IsConvertibleToDouble<true, U> {
+ typedef char YesType;
+ struct NoType {
+ char padding[8];
+ };
+
+ static YesType floatCheck(long double);
+ static NoType floatCheck(...);
+ static T& t;
+ public:
+ static const bool value = sizeof(floatCheck(t)) == sizeof(YesType);
+ };
+
+ public:
+ static const bool value = IsInteger<T>::value || IsConvertibleToDouble<!IsInteger<T>::value, T>::value;
+ };
+
+ template <typename T, typename U> struct IsSameType {
+ static const bool value = false;
+ };
+
+ template <typename T> struct IsSameType<T, T> {
+ static const bool value = true;
+ };
+
+ template <typename T, typename U> class IsSubclass {
+ typedef char YesType;
+ struct NoType {
+ char padding[8];
+ };
+
+ static YesType subclassCheck(U*);
+ static NoType subclassCheck(...);
+ static T* t;
+ public:
+ static const bool value = sizeof(subclassCheck(t)) == sizeof(YesType);
+ };
+
+ template <typename T, template<class V> class U> class IsSubclassOfTemplate {
+ typedef char YesType;
+ struct NoType {
+ char padding[8];
+ };
+
+ template<typename W> static YesType subclassCheck(U<W>*);
+ static NoType subclassCheck(...);
+ static T* t;
+ public:
+ static const bool value = sizeof(subclassCheck(t)) == sizeof(YesType);
+ };
+
+ template <typename T, template <class V> class OuterTemplate> struct RemoveTemplate {
+ typedef T Type;
+ };
+
+ template <typename T, template <class V> class OuterTemplate> struct RemoveTemplate<OuterTemplate<T>, OuterTemplate> {
+ typedef T Type;
+ };
+
+ template <typename T> struct RemoveConst {
+ typedef T Type;
+ };
+
+ template <typename T> struct RemoveConst<const T> {
+ typedef T Type;
+ };
+
+ template <typename T> struct RemoveVolatile {
+ typedef T Type;
+ };
+
+ template <typename T> struct RemoveVolatile<volatile T> {
+ typedef T Type;
+ };
+
+ template <typename T> struct RemoveConstVolatile {
+ typedef typename RemoveVolatile<typename RemoveConst<T>::Type>::Type Type;
+ };
+
+ template <typename T> struct RemovePointer {
+ typedef T Type;
+ };
+
+ template <typename T> struct RemovePointer<T*> {
+ typedef T Type;
+ };
+
+ template <typename T> struct RemoveReference {
+ typedef T Type;
+ };
+
+ template <typename T> struct RemoveReference<T&> {
+ typedef T Type;
+ };
+
+#if (defined(__GLIBCXX__) && (__GLIBCXX__ >= 20070724) && defined(__GXX_EXPERIMENTAL_CXX0X__)) || (defined(_MSC_VER) && (_MSC_VER >= 1600))
+
+ // GCC's libstdc++ 20070724 and later supports C++ TR1 type_traits in the std namespace.
+ // VC10 (VS2010) and later support C++ TR1 type_traits in the std::tr1 namespace.
+ template<typename T> struct HasTrivialConstructor : public std::tr1::has_trivial_constructor<T> { };
+ template<typename T> struct HasTrivialDestructor : public std::tr1::has_trivial_destructor<T> { };
+
+#else
+
+ // This compiler doesn't provide type traits, so we provide basic HasTrivialConstructor
+ // and HasTrivialDestructor definitions. The definitions here include most built-in
+ // scalar types but do not include POD structs and classes. For the intended purposes of
+ // type_traits this results correct but potentially less efficient code.
+ template <typename T, T v>
+ struct IntegralConstant {
+ static const T value = v;
+ typedef T value_type;
+ typedef IntegralConstant<T, v> type;
+ };
+
+ typedef IntegralConstant<bool, true> true_type;
+ typedef IntegralConstant<bool, false> false_type;
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1400) && !defined(__INTEL_COMPILER)
+ // VC8 (VS2005) and later have built-in compiler support for HasTrivialConstructor / HasTrivialDestructor,
+ // but for some unexplained reason it doesn't work on built-in types.
+ template <typename T> struct HasTrivialConstructor : public IntegralConstant<bool, __has_trivial_constructor(T)>{ };
+ template <typename T> struct HasTrivialDestructor : public IntegralConstant<bool, __has_trivial_destructor(T)>{ };
+#else
+ template <typename T> struct HasTrivialConstructor : public false_type{ };
+ template <typename T> struct HasTrivialDestructor : public false_type{ };
+#endif
+
+ template <typename T> struct HasTrivialConstructor<T*> : public true_type{ };
+ template <typename T> struct HasTrivialDestructor<T*> : public true_type{ };
+
+ template <> struct HasTrivialConstructor<float> : public true_type{ };
+ template <> struct HasTrivialConstructor<const float> : public true_type{ };
+ template <> struct HasTrivialConstructor<volatile float> : public true_type{ };
+ template <> struct HasTrivialConstructor<const volatile float> : public true_type{ };
+
+ template <> struct HasTrivialConstructor<double> : public true_type{ };
+ template <> struct HasTrivialConstructor<const double> : public true_type{ };
+ template <> struct HasTrivialConstructor<volatile double> : public true_type{ };
+ template <> struct HasTrivialConstructor<const volatile double> : public true_type{ };
+
+ template <> struct HasTrivialConstructor<long double> : public true_type{ };
+ template <> struct HasTrivialConstructor<const long double> : public true_type{ };
+ template <> struct HasTrivialConstructor<volatile long double> : public true_type{ };
+ template <> struct HasTrivialConstructor<const volatile long double> : public true_type{ };
+
+ template <> struct HasTrivialConstructor<unsigned char> : public true_type{ };
+ template <> struct HasTrivialConstructor<const unsigned char> : public true_type{ };
+ template <> struct HasTrivialConstructor<volatile unsigned char> : public true_type{ };
+ template <> struct HasTrivialConstructor<const volatile unsigned char> : public true_type{ };
+
+ template <> struct HasTrivialConstructor<unsigned short> : public true_type{ };
+ template <> struct HasTrivialConstructor<const unsigned short> : public true_type{ };
+ template <> struct HasTrivialConstructor<volatile unsigned short> : public true_type{ };
+ template <> struct HasTrivialConstructor<const volatile unsigned short> : public true_type{ };
+
+ template <> struct HasTrivialConstructor<unsigned int> : public true_type{ };
+ template <> struct HasTrivialConstructor<const unsigned int> : public true_type{ };
+ template <> struct HasTrivialConstructor<volatile unsigned int> : public true_type{ };
+ template <> struct HasTrivialConstructor<const volatile unsigned int> : public true_type{ };
+
+ template <> struct HasTrivialConstructor<unsigned long> : public true_type{ };
+ template <> struct HasTrivialConstructor<const unsigned long> : public true_type{ };
+ template <> struct HasTrivialConstructor<volatile unsigned long> : public true_type{ };
+ template <> struct HasTrivialConstructor<const volatile unsigned long> : public true_type{ };
+
+ template <> struct HasTrivialConstructor<unsigned long long> : public true_type{ };
+ template <> struct HasTrivialConstructor<const unsigned long long> : public true_type{ };
+ template <> struct HasTrivialConstructor<volatile unsigned long long> : public true_type{ };
+ template <> struct HasTrivialConstructor<const volatile unsigned long long> : public true_type{ };
+
+ template <> struct HasTrivialConstructor<signed char> : public true_type{ };
+ template <> struct HasTrivialConstructor<const signed char> : public true_type{ };
+ template <> struct HasTrivialConstructor<volatile signed char> : public true_type{ };
+ template <> struct HasTrivialConstructor<const volatile signed char> : public true_type{ };
+
+ template <> struct HasTrivialConstructor<signed short> : public true_type{ };
+ template <> struct HasTrivialConstructor<const signed short> : public true_type{ };
+ template <> struct HasTrivialConstructor<volatile signed short> : public true_type{ };
+ template <> struct HasTrivialConstructor<const volatile signed short> : public true_type{ };
+
+ template <> struct HasTrivialConstructor<signed int> : public true_type{ };
+ template <> struct HasTrivialConstructor<const signed int> : public true_type{ };
+ template <> struct HasTrivialConstructor<volatile signed int> : public true_type{ };
+ template <> struct HasTrivialConstructor<const volatile signed int> : public true_type{ };
+
+ template <> struct HasTrivialConstructor<signed long> : public true_type{ };
+ template <> struct HasTrivialConstructor<const signed long> : public true_type{ };
+ template <> struct HasTrivialConstructor<volatile signed long> : public true_type{ };
+ template <> struct HasTrivialConstructor<const volatile signed long> : public true_type{ };
+
+ template <> struct HasTrivialConstructor<signed long long> : public true_type{ };
+ template <> struct HasTrivialConstructor<const signed long long> : public true_type{ };
+ template <> struct HasTrivialConstructor<volatile signed long long> : public true_type{ };
+ template <> struct HasTrivialConstructor<const volatile signed long long> : public true_type{ };
+
+ template <> struct HasTrivialConstructor<bool> : public true_type{ };
+ template <> struct HasTrivialConstructor<const bool> : public true_type{ };
+ template <> struct HasTrivialConstructor<volatile bool> : public true_type{ };
+ template <> struct HasTrivialConstructor<const volatile bool> : public true_type{ };
+
+ template <> struct HasTrivialConstructor<char> : public true_type{ };
+ template <> struct HasTrivialConstructor<const char> : public true_type{ };
+ template <> struct HasTrivialConstructor<volatile char> : public true_type{ };
+ template <> struct HasTrivialConstructor<const volatile char> : public true_type{ };
+
+ #if !defined(_MSC_VER) || defined(_NATIVE_WCHAR_T_DEFINED)
+ template <> struct HasTrivialConstructor<wchar_t> : public true_type{ };
+ template <> struct HasTrivialConstructor<const wchar_t> : public true_type{ };
+ template <> struct HasTrivialConstructor<volatile wchar_t> : public true_type{ };
+ template <> struct HasTrivialConstructor<const volatile wchar_t> : public true_type{ };
+ #endif
+
+ template <> struct HasTrivialDestructor<float> : public true_type{ };
+ template <> struct HasTrivialDestructor<const float> : public true_type{ };
+ template <> struct HasTrivialDestructor<volatile float> : public true_type{ };
+ template <> struct HasTrivialDestructor<const volatile float> : public true_type{ };
+
+ template <> struct HasTrivialDestructor<double> : public true_type{ };
+ template <> struct HasTrivialDestructor<const double> : public true_type{ };
+ template <> struct HasTrivialDestructor<volatile double> : public true_type{ };
+ template <> struct HasTrivialDestructor<const volatile double> : public true_type{ };
+
+ template <> struct HasTrivialDestructor<long double> : public true_type{ };
+ template <> struct HasTrivialDestructor<const long double> : public true_type{ };
+ template <> struct HasTrivialDestructor<volatile long double> : public true_type{ };
+ template <> struct HasTrivialDestructor<const volatile long double> : public true_type{ };
+
+ template <> struct HasTrivialDestructor<unsigned char> : public true_type{ };
+ template <> struct HasTrivialDestructor<const unsigned char> : public true_type{ };
+ template <> struct HasTrivialDestructor<volatile unsigned char> : public true_type{ };
+ template <> struct HasTrivialDestructor<const volatile unsigned char> : public true_type{ };
+
+ template <> struct HasTrivialDestructor<unsigned short> : public true_type{ };
+ template <> struct HasTrivialDestructor<const unsigned short> : public true_type{ };
+ template <> struct HasTrivialDestructor<volatile unsigned short> : public true_type{ };
+ template <> struct HasTrivialDestructor<const volatile unsigned short> : public true_type{ };
+
+ template <> struct HasTrivialDestructor<unsigned int> : public true_type{ };
+ template <> struct HasTrivialDestructor<const unsigned int> : public true_type{ };
+ template <> struct HasTrivialDestructor<volatile unsigned int> : public true_type{ };
+ template <> struct HasTrivialDestructor<const volatile unsigned int> : public true_type{ };
+
+ template <> struct HasTrivialDestructor<unsigned long> : public true_type{ };
+ template <> struct HasTrivialDestructor<const unsigned long> : public true_type{ };
+ template <> struct HasTrivialDestructor<volatile unsigned long> : public true_type{ };
+ template <> struct HasTrivialDestructor<const volatile unsigned long> : public true_type{ };
+
+ template <> struct HasTrivialDestructor<unsigned long long> : public true_type{ };
+ template <> struct HasTrivialDestructor<const unsigned long long> : public true_type{ };
+ template <> struct HasTrivialDestructor<volatile unsigned long long> : public true_type{ };
+ template <> struct HasTrivialDestructor<const volatile unsigned long long> : public true_type{ };
+
+ template <> struct HasTrivialDestructor<signed char> : public true_type{ };
+ template <> struct HasTrivialDestructor<const signed char> : public true_type{ };
+ template <> struct HasTrivialDestructor<volatile signed char> : public true_type{ };
+ template <> struct HasTrivialDestructor<const volatile signed char> : public true_type{ };
+
+ template <> struct HasTrivialDestructor<signed short> : public true_type{ };
+ template <> struct HasTrivialDestructor<const signed short> : public true_type{ };
+ template <> struct HasTrivialDestructor<volatile signed short> : public true_type{ };
+ template <> struct HasTrivialDestructor<const volatile signed short> : public true_type{ };
+
+ template <> struct HasTrivialDestructor<signed int> : public true_type{ };
+ template <> struct HasTrivialDestructor<const signed int> : public true_type{ };
+ template <> struct HasTrivialDestructor<volatile signed int> : public true_type{ };
+ template <> struct HasTrivialDestructor<const volatile signed int> : public true_type{ };
+
+ template <> struct HasTrivialDestructor<signed long> : public true_type{ };
+ template <> struct HasTrivialDestructor<const signed long> : public true_type{ };
+ template <> struct HasTrivialDestructor<volatile signed long> : public true_type{ };
+ template <> struct HasTrivialDestructor<const volatile signed long> : public true_type{ };
+
+ template <> struct HasTrivialDestructor<signed long long> : public true_type{ };
+ template <> struct HasTrivialDestructor<const signed long long> : public true_type{ };
+ template <> struct HasTrivialDestructor<volatile signed long long> : public true_type{ };
+ template <> struct HasTrivialDestructor<const volatile signed long long> : public true_type{ };
+
+ template <> struct HasTrivialDestructor<bool> : public true_type{ };
+ template <> struct HasTrivialDestructor<const bool> : public true_type{ };
+ template <> struct HasTrivialDestructor<volatile bool> : public true_type{ };
+ template <> struct HasTrivialDestructor<const volatile bool> : public true_type{ };
+
+ template <> struct HasTrivialDestructor<char> : public true_type{ };
+ template <> struct HasTrivialDestructor<const char> : public true_type{ };
+ template <> struct HasTrivialDestructor<volatile char> : public true_type{ };
+ template <> struct HasTrivialDestructor<const volatile char> : public true_type{ };
+
+ #if !defined(_MSC_VER) || defined(_NATIVE_WCHAR_T_DEFINED)
+ template <> struct HasTrivialDestructor<wchar_t> : public true_type{ };
+ template <> struct HasTrivialDestructor<const wchar_t> : public true_type{ };
+ template <> struct HasTrivialDestructor<volatile wchar_t> : public true_type{ };
+ template <> struct HasTrivialDestructor<const volatile wchar_t> : public true_type{ };
+ #endif
+
+#endif // __GLIBCXX__, etc.
+
+} // namespace WTF
+
+#endif // TypeTraits_h
diff --git a/Source/JavaScriptCore/wtf/UnusedParam.h b/Source/JavaScriptCore/wtf/UnusedParam.h
new file mode 100644
index 0000000..6ff6fd8
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/UnusedParam.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef WTF_UnusedParam_h
+#define WTF_UnusedParam_h
+
+/* don't use this for C++, it should only be used in plain C files or
+ ObjC methods, where leaving off the parameter name is not allowed. */
+
+#include "Platform.h"
+
+#if COMPILER(INTEL) && !OS(WINDOWS) || COMPILER(RVCT)
+template<typename T>
+inline void unusedParam(T& x) { (void)x; }
+#define UNUSED_PARAM(variable) unusedParam(variable)
+#else
+#define UNUSED_PARAM(variable) (void)variable
+#endif
+
+#endif /* WTF_UnusedParam_h */
diff --git a/Source/JavaScriptCore/wtf/VMTags.h b/Source/JavaScriptCore/wtf/VMTags.h
new file mode 100644
index 0000000..6600050
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/VMTags.h
@@ -0,0 +1,90 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef VMTags_h
+#define VMTags_h
+
+// On Mac OS X, the VM subsystem allows tagging memory requested from mmap and vm_map
+// in order to aid tools that inspect system memory use.
+#if OS(DARWIN)
+
+#include <mach/vm_statistics.h>
+
+#if !defined(TARGETING_TIGER)
+
+#if defined(VM_MEMORY_TCMALLOC)
+#define VM_TAG_FOR_TCMALLOC_MEMORY VM_MAKE_TAG(VM_MEMORY_TCMALLOC)
+#else
+#define VM_TAG_FOR_TCMALLOC_MEMORY VM_MAKE_TAG(53)
+#endif // defined(VM_MEMORY_TCMALLOC)
+
+#if defined(VM_MEMORY_JAVASCRIPT_JIT_EXECUTABLE_ALLOCATOR)
+#define VM_TAG_FOR_EXECUTABLEALLOCATOR_MEMORY VM_MAKE_TAG(VM_MEMORY_JAVASCRIPT_JIT_EXECUTABLE_ALLOCATOR)
+#else
+#define VM_TAG_FOR_EXECUTABLEALLOCATOR_MEMORY VM_MAKE_TAG(64)
+#endif // defined(VM_MEMORY_JAVASCRIPT_JIT_EXECUTABLE_ALLOCATOR)
+
+#if defined(VM_MEMORY_JAVASCRIPT_JIT_REGISTER_FILE)
+#define VM_TAG_FOR_REGISTERFILE_MEMORY VM_MAKE_TAG(VM_MEMORY_JAVASCRIPT_JIT_REGISTER_FILE)
+#else
+#define VM_TAG_FOR_REGISTERFILE_MEMORY VM_MAKE_TAG(65)
+#endif // defined(VM_MEMORY_JAVASCRIPT_JIT_REGISTER_FILE)
+
+#else // !defined(TARGETING_TIGER)
+
+// mmap on Tiger fails with tags that work on Leopard, so fall
+// back to Tiger-compatible tags (that also work on Leopard)
+// when targeting Tiger.
+#define VM_TAG_FOR_TCMALLOC_MEMORY -1
+#define VM_TAG_FOR_EXECUTABLEALLOCATOR_MEMORY -1
+#define VM_TAG_FOR_REGISTERFILE_MEMORY -1
+
+#endif // !defined(TARGETING_TIGER)
+
+// Tags for vm_map and vm_allocate work on both Tiger and Leopard.
+
+#if defined(VM_MEMORY_JAVASCRIPT_CORE)
+#define VM_TAG_FOR_COLLECTOR_MEMORY VM_MAKE_TAG(VM_MEMORY_JAVASCRIPT_CORE)
+#else
+#define VM_TAG_FOR_COLLECTOR_MEMORY VM_MAKE_TAG(63)
+#endif // defined(VM_MEMORY_JAVASCRIPT_CORE)
+
+#if defined(VM_MEMORY_WEBCORE_PURGEABLE_BUFFERS)
+#define VM_TAG_FOR_WEBCORE_PURGEABLE_MEMORY VM_MAKE_TAG(VM_MEMORY_WEBCORE_PURGEABLE_BUFFERS)
+#else
+#define VM_TAG_FOR_WEBCORE_PURGEABLE_MEMORY VM_MAKE_TAG(69)
+#endif // defined(VM_MEMORY_WEBCORE_PURGEABLE_BUFFERS)
+
+#else // OS(DARWIN)
+
+#define VM_TAG_FOR_TCMALLOC_MEMORY -1
+#define VM_TAG_FOR_COLLECTOR_MEMORY -1
+#define VM_TAG_FOR_EXECUTABLEALLOCATOR_MEMORY -1
+#define VM_TAG_FOR_REGISTERFILE_MEMORY -1
+#define VM_TAG_FOR_WEBCORE_PURGEABLE_MEMORY -1
+
+#endif // OS(DARWIN)
+
+#endif // VMTags_h
diff --git a/Source/JavaScriptCore/wtf/ValueCheck.h b/Source/JavaScriptCore/wtf/ValueCheck.h
new file mode 100644
index 0000000..2a86eb0
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/ValueCheck.h
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ValueCheck_h
+#define ValueCheck_h
+
+#include <wtf/FastMalloc.h>
+
+namespace WTF {
+
+template<typename T> struct ValueCheck {
+ typedef T TraitType;
+ static void checkConsistency(const T&) { }
+};
+
+#if !ASSERT_DISABLED
+template<typename P> struct ValueCheck<P*> {
+ typedef P* TraitType;
+ static void checkConsistency(const P* p)
+ {
+ if (!p)
+ return;
+ ASSERT(fastMallocSize(p));
+ ValueCheck<P>::checkConsistency(*p);
+ }
+};
+#endif
+
+}
+
+#endif // ValueCheck_h
diff --git a/Source/JavaScriptCore/wtf/Vector.h b/Source/JavaScriptCore/wtf/Vector.h
new file mode 100644
index 0000000..f73793f
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/Vector.h
@@ -0,0 +1,1157 @@
+/*
+ * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef WTF_Vector_h
+#define WTF_Vector_h
+
+#include "FastAllocBase.h"
+#include "Noncopyable.h"
+#include "NotFound.h"
+#include "StdLibExtras.h"
+#include "ValueCheck.h"
+#include "VectorTraits.h"
+#include <limits>
+#include <utility>
+
+#if PLATFORM(QT)
+#include <QDataStream>
+#endif
+
+namespace WTF {
+
+ using std::min;
+ using std::max;
+
+ // WTF_ALIGN_OF / WTF_ALIGNED
+ #if COMPILER(GCC) || COMPILER(MINGW) || COMPILER(RVCT) || COMPILER(WINSCW)
+ #define WTF_ALIGN_OF(type) __alignof__(type)
+ #define WTF_ALIGNED(variable_type, variable, n) variable_type variable __attribute__((__aligned__(n)))
+ #elif COMPILER(MSVC)
+ #define WTF_ALIGN_OF(type) __alignof(type)
+ #define WTF_ALIGNED(variable_type, variable, n) __declspec(align(n)) variable_type variable
+ #else
+ #error WTF_ALIGN macros need alignment control.
+ #endif
+
+ #if COMPILER(GCC) && !COMPILER(INTEL) && (((__GNUC__ * 100) + __GNUC_MINOR__) >= 303)
+ typedef char __attribute__((__may_alias__)) AlignedBufferChar;
+ #else
+ typedef char AlignedBufferChar;
+ #endif
+
+ template <size_t size, size_t alignment> struct AlignedBuffer;
+ template <size_t size> struct AlignedBuffer<size, 1> { AlignedBufferChar buffer[size]; };
+ template <size_t size> struct AlignedBuffer<size, 2> { WTF_ALIGNED(AlignedBufferChar, buffer[size], 2); };
+ template <size_t size> struct AlignedBuffer<size, 4> { WTF_ALIGNED(AlignedBufferChar, buffer[size], 4); };
+ template <size_t size> struct AlignedBuffer<size, 8> { WTF_ALIGNED(AlignedBufferChar, buffer[size], 8); };
+ template <size_t size> struct AlignedBuffer<size, 16> { WTF_ALIGNED(AlignedBufferChar, buffer[size], 16); };
+ template <size_t size> struct AlignedBuffer<size, 32> { WTF_ALIGNED(AlignedBufferChar, buffer[size], 32); };
+ template <size_t size> struct AlignedBuffer<size, 64> { WTF_ALIGNED(AlignedBufferChar, buffer[size], 64); };
+
+ template <size_t size, size_t alignment>
+ void swap(AlignedBuffer<size, alignment>& a, AlignedBuffer<size, alignment>& b)
+ {
+ for (size_t i = 0; i < size; ++i)
+ std::swap(a.buffer[i], b.buffer[i]);
+ }
+
+ template <bool needsDestruction, typename T>
+ struct VectorDestructor;
+
+ template<typename T>
+ struct VectorDestructor<false, T>
+ {
+ static void destruct(T*, T*) {}
+ };
+
+ template<typename T>
+ struct VectorDestructor<true, T>
+ {
+ static void destruct(T* begin, T* end)
+ {
+ for (T* cur = begin; cur != end; ++cur)
+ cur->~T();
+ }
+ };
+
+ template <bool needsInitialization, bool canInitializeWithMemset, typename T>
+ struct VectorInitializer;
+
+ template<bool ignore, typename T>
+ struct VectorInitializer<false, ignore, T>
+ {
+ static void initialize(T*, T*) {}
+ };
+
+ template<typename T>
+ struct VectorInitializer<true, false, T>
+ {
+ static void initialize(T* begin, T* end)
+ {
+ for (T* cur = begin; cur != end; ++cur)
+ new (cur) T;
+ }
+ };
+
+ template<typename T>
+ struct VectorInitializer<true, true, T>
+ {
+ static void initialize(T* begin, T* end)
+ {
+ memset(begin, 0, reinterpret_cast<char*>(end) - reinterpret_cast<char*>(begin));
+ }
+ };
+
+ template <bool canMoveWithMemcpy, typename T>
+ struct VectorMover;
+
+ template<typename T>
+ struct VectorMover<false, T>
+ {
+ static void move(const T* src, const T* srcEnd, T* dst)
+ {
+ while (src != srcEnd) {
+ new (dst) T(*src);
+ src->~T();
+ ++dst;
+ ++src;
+ }
+ }
+ static void moveOverlapping(const T* src, const T* srcEnd, T* dst)
+ {
+ if (src > dst)
+ move(src, srcEnd, dst);
+ else {
+ T* dstEnd = dst + (srcEnd - src);
+ while (src != srcEnd) {
+ --srcEnd;
+ --dstEnd;
+ new (dstEnd) T(*srcEnd);
+ srcEnd->~T();
+ }
+ }
+ }
+ };
+
+ template<typename T>
+ struct VectorMover<true, T>
+ {
+ static void move(const T* src, const T* srcEnd, T* dst)
+ {
+ memcpy(dst, src, reinterpret_cast<const char*>(srcEnd) - reinterpret_cast<const char*>(src));
+ }
+ static void moveOverlapping(const T* src, const T* srcEnd, T* dst)
+ {
+ memmove(dst, src, reinterpret_cast<const char*>(srcEnd) - reinterpret_cast<const char*>(src));
+ }
+ };
+
+ template <bool canCopyWithMemcpy, typename T>
+ struct VectorCopier;
+
+ template<typename T>
+ struct VectorCopier<false, T>
+ {
+ static void uninitializedCopy(const T* src, const T* srcEnd, T* dst)
+ {
+ while (src != srcEnd) {
+ new (dst) T(*src);
+ ++dst;
+ ++src;
+ }
+ }
+ };
+
+ template<typename T>
+ struct VectorCopier<true, T>
+ {
+ static void uninitializedCopy(const T* src, const T* srcEnd, T* dst)
+ {
+ memcpy(dst, src, reinterpret_cast<const char*>(srcEnd) - reinterpret_cast<const char*>(src));
+ }
+ };
+
+ template <bool canFillWithMemset, typename T>
+ struct VectorFiller;
+
+ template<typename T>
+ struct VectorFiller<false, T>
+ {
+ static void uninitializedFill(T* dst, T* dstEnd, const T& val)
+ {
+ while (dst != dstEnd) {
+ new (dst) T(val);
+ ++dst;
+ }
+ }
+ };
+
+ template<typename T>
+ struct VectorFiller<true, T>
+ {
+ static void uninitializedFill(T* dst, T* dstEnd, const T& val)
+ {
+ ASSERT(sizeof(T) == sizeof(char));
+ memset(dst, val, dstEnd - dst);
+ }
+ };
+
+ template<bool canCompareWithMemcmp, typename T>
+ struct VectorComparer;
+
+ template<typename T>
+ struct VectorComparer<false, T>
+ {
+ static bool compare(const T* a, const T* b, size_t size)
+ {
+ for (size_t i = 0; i < size; ++i)
+ if (a[i] != b[i])
+ return false;
+ return true;
+ }
+ };
+
+ template<typename T>
+ struct VectorComparer<true, T>
+ {
+ static bool compare(const T* a, const T* b, size_t size)
+ {
+ return memcmp(a, b, sizeof(T) * size) == 0;
+ }
+ };
+
+ template<typename T>
+ struct VectorTypeOperations
+ {
+ static void destruct(T* begin, T* end)
+ {
+ VectorDestructor<VectorTraits<T>::needsDestruction, T>::destruct(begin, end);
+ }
+
+ static void initialize(T* begin, T* end)
+ {
+ VectorInitializer<VectorTraits<T>::needsInitialization, VectorTraits<T>::canInitializeWithMemset, T>::initialize(begin, end);
+ }
+
+ static void move(const T* src, const T* srcEnd, T* dst)
+ {
+ VectorMover<VectorTraits<T>::canMoveWithMemcpy, T>::move(src, srcEnd, dst);
+ }
+
+ static void moveOverlapping(const T* src, const T* srcEnd, T* dst)
+ {
+ VectorMover<VectorTraits<T>::canMoveWithMemcpy, T>::moveOverlapping(src, srcEnd, dst);
+ }
+
+ static void uninitializedCopy(const T* src, const T* srcEnd, T* dst)
+ {
+ VectorCopier<VectorTraits<T>::canCopyWithMemcpy, T>::uninitializedCopy(src, srcEnd, dst);
+ }
+
+ static void uninitializedFill(T* dst, T* dstEnd, const T& val)
+ {
+ VectorFiller<VectorTraits<T>::canFillWithMemset, T>::uninitializedFill(dst, dstEnd, val);
+ }
+
+ static bool compare(const T* a, const T* b, size_t size)
+ {
+ return VectorComparer<VectorTraits<T>::canCompareWithMemcmp, T>::compare(a, b, size);
+ }
+ };
+
+ template<typename T>
+ class VectorBufferBase : public Noncopyable {
+ public:
+ void allocateBuffer(size_t newCapacity)
+ {
+ m_capacity = newCapacity;
+ if (newCapacity > std::numeric_limits<size_t>::max() / sizeof(T))
+ CRASH();
+ m_buffer = static_cast<T*>(fastMalloc(newCapacity * sizeof(T)));
+ }
+
+ bool tryAllocateBuffer(size_t newCapacity)
+ {
+ if (newCapacity > std::numeric_limits<size_t>::max() / sizeof(T))
+ return false;
+
+ T* newBuffer;
+ if (tryFastMalloc(newCapacity * sizeof(T)).getValue(newBuffer)) {
+ m_capacity = newCapacity;
+ m_buffer = newBuffer;
+ return true;
+ }
+ return false;
+ }
+
+ void deallocateBuffer(T* bufferToDeallocate)
+ {
+ if (m_buffer == bufferToDeallocate) {
+ m_buffer = 0;
+ m_capacity = 0;
+ }
+ fastFree(bufferToDeallocate);
+ }
+
+ T* buffer() { return m_buffer; }
+ const T* buffer() const { return m_buffer; }
+ T** bufferSlot() { return &m_buffer; }
+ size_t capacity() const { return m_capacity; }
+
+ T* releaseBuffer()
+ {
+ T* buffer = m_buffer;
+ m_buffer = 0;
+ m_capacity = 0;
+ return buffer;
+ }
+
+ protected:
+ VectorBufferBase()
+ : m_buffer(0)
+ , m_capacity(0)
+ {
+ }
+
+ VectorBufferBase(T* buffer, size_t capacity)
+ : m_buffer(buffer)
+ , m_capacity(capacity)
+ {
+ }
+
+ ~VectorBufferBase()
+ {
+ // FIXME: It would be nice to find a way to ASSERT that m_buffer hasn't leaked here.
+ }
+
+ T* m_buffer;
+ size_t m_capacity;
+ };
+
+ template<typename T, size_t inlineCapacity>
+ class VectorBuffer;
+
+ template<typename T>
+ class VectorBuffer<T, 0> : private VectorBufferBase<T> {
+ private:
+ typedef VectorBufferBase<T> Base;
+ public:
+ VectorBuffer()
+ {
+ }
+
+ VectorBuffer(size_t capacity)
+ {
+ allocateBuffer(capacity);
+ }
+
+ ~VectorBuffer()
+ {
+ deallocateBuffer(buffer());
+ }
+
+ void swap(VectorBuffer<T, 0>& other)
+ {
+ std::swap(m_buffer, other.m_buffer);
+ std::swap(m_capacity, other.m_capacity);
+ }
+
+ void restoreInlineBufferIfNeeded() { }
+
+ using Base::allocateBuffer;
+ using Base::tryAllocateBuffer;
+ using Base::deallocateBuffer;
+
+ using Base::buffer;
+ using Base::bufferSlot;
+ using Base::capacity;
+
+ using Base::releaseBuffer;
+ private:
+ using Base::m_buffer;
+ using Base::m_capacity;
+ };
+
+ template<typename T, size_t inlineCapacity>
+ class VectorBuffer : private VectorBufferBase<T> {
+ private:
+ typedef VectorBufferBase<T> Base;
+ public:
+ VectorBuffer()
+ : Base(inlineBuffer(), inlineCapacity)
+ {
+ }
+
+ VectorBuffer(size_t capacity)
+ : Base(inlineBuffer(), inlineCapacity)
+ {
+ if (capacity > inlineCapacity)
+ Base::allocateBuffer(capacity);
+ }
+
+ ~VectorBuffer()
+ {
+ deallocateBuffer(buffer());
+ }
+
+ void allocateBuffer(size_t newCapacity)
+ {
+ if (newCapacity > inlineCapacity)
+ Base::allocateBuffer(newCapacity);
+ else {
+ m_buffer = inlineBuffer();
+ m_capacity = inlineCapacity;
+ }
+ }
+
+ bool tryAllocateBuffer(size_t newCapacity)
+ {
+ if (newCapacity > inlineCapacity)
+ return Base::tryAllocateBuffer(newCapacity);
+ m_buffer = inlineBuffer();
+ m_capacity = inlineCapacity;
+ return true;
+ }
+
+ void deallocateBuffer(T* bufferToDeallocate)
+ {
+ if (bufferToDeallocate == inlineBuffer())
+ return;
+ Base::deallocateBuffer(bufferToDeallocate);
+ }
+
+ void swap(VectorBuffer<T, inlineCapacity>& other)
+ {
+ if (buffer() == inlineBuffer() && other.buffer() == other.inlineBuffer()) {
+ WTF::swap(m_inlineBuffer, other.m_inlineBuffer);
+ std::swap(m_capacity, other.m_capacity);
+ } else if (buffer() == inlineBuffer()) {
+ m_buffer = other.m_buffer;
+ other.m_buffer = other.inlineBuffer();
+ WTF::swap(m_inlineBuffer, other.m_inlineBuffer);
+ std::swap(m_capacity, other.m_capacity);
+ } else if (other.buffer() == other.inlineBuffer()) {
+ other.m_buffer = m_buffer;
+ m_buffer = inlineBuffer();
+ WTF::swap(m_inlineBuffer, other.m_inlineBuffer);
+ std::swap(m_capacity, other.m_capacity);
+ } else {
+ std::swap(m_buffer, other.m_buffer);
+ std::swap(m_capacity, other.m_capacity);
+ }
+ }
+
+ void restoreInlineBufferIfNeeded()
+ {
+ if (m_buffer)
+ return;
+ m_buffer = inlineBuffer();
+ m_capacity = inlineCapacity;
+ }
+
+ using Base::buffer;
+ using Base::bufferSlot;
+ using Base::capacity;
+
+ T* releaseBuffer()
+ {
+ if (buffer() == inlineBuffer())
+ return 0;
+ return Base::releaseBuffer();
+ }
+
+ private:
+ using Base::m_buffer;
+ using Base::m_capacity;
+
+ static const size_t m_inlineBufferSize = inlineCapacity * sizeof(T);
+ T* inlineBuffer() { return reinterpret_cast_ptr<T*>(m_inlineBuffer.buffer); }
+
+ AlignedBuffer<m_inlineBufferSize, WTF_ALIGN_OF(T)> m_inlineBuffer;
+ };
+
+ template<typename T, size_t inlineCapacity = 0>
+ class Vector : public FastAllocBase {
+ private:
+ typedef VectorBuffer<T, inlineCapacity> Buffer;
+ typedef VectorTypeOperations<T> TypeOperations;
+
+ public:
+ typedef T ValueType;
+
+ typedef T* iterator;
+ typedef const T* const_iterator;
+
+ Vector()
+ : m_size(0)
+ {
+ }
+
+ explicit Vector(size_t size)
+ : m_size(size)
+ , m_buffer(size)
+ {
+ if (begin())
+ TypeOperations::initialize(begin(), end());
+ }
+
+ ~Vector()
+ {
+ if (m_size) shrink(0);
+ }
+
+ Vector(const Vector&);
+ template<size_t otherCapacity>
+ Vector(const Vector<T, otherCapacity>&);
+
+ Vector& operator=(const Vector&);
+ template<size_t otherCapacity>
+ Vector& operator=(const Vector<T, otherCapacity>&);
+
+ size_t size() const { return m_size; }
+ size_t capacity() const { return m_buffer.capacity(); }
+ bool isEmpty() const { return !size(); }
+
+ T& at(size_t i)
+ {
+ ASSERT(i < size());
+ return m_buffer.buffer()[i];
+ }
+ const T& at(size_t i) const
+ {
+ ASSERT(i < size());
+ return m_buffer.buffer()[i];
+ }
+
+ T& operator[](size_t i) { return at(i); }
+ const T& operator[](size_t i) const { return at(i); }
+
+ T* data() { return m_buffer.buffer(); }
+ const T* data() const { return m_buffer.buffer(); }
+ T** dataSlot() { return m_buffer.bufferSlot(); }
+
+ iterator begin() { return data(); }
+ iterator end() { return begin() + m_size; }
+ const_iterator begin() const { return data(); }
+ const_iterator end() const { return begin() + m_size; }
+
+ T& first() { return at(0); }
+ const T& first() const { return at(0); }
+ T& last() { return at(size() - 1); }
+ const T& last() const { return at(size() - 1); }
+
+ template<typename U> size_t find(const U&) const;
+ template<typename U> size_t reverseFind(const U&) const;
+
+ void shrink(size_t size);
+ void grow(size_t size);
+ void resize(size_t size);
+ void reserveCapacity(size_t newCapacity);
+ bool tryReserveCapacity(size_t newCapacity);
+ void reserveInitialCapacity(size_t initialCapacity);
+ void shrinkCapacity(size_t newCapacity);
+ void shrinkToFit() { shrinkCapacity(size()); }
+
+ void clear() { shrinkCapacity(0); }
+
+ template<typename U> void append(const U*, size_t);
+ template<typename U> void append(const U&);
+ template<typename U> void uncheckedAppend(const U& val);
+ template<size_t otherCapacity> void append(const Vector<T, otherCapacity>&);
+ template<typename U> bool tryAppend(const U*, size_t);
+
+ template<typename U> void insert(size_t position, const U*, size_t);
+ template<typename U> void insert(size_t position, const U&);
+ template<typename U, size_t c> void insert(size_t position, const Vector<U, c>&);
+
+ template<typename U> void prepend(const U*, size_t);
+ template<typename U> void prepend(const U&);
+ template<typename U, size_t c> void prepend(const Vector<U, c>&);
+
+ void remove(size_t position);
+ void remove(size_t position, size_t length);
+
+ void removeLast()
+ {
+ ASSERT(!isEmpty());
+ shrink(size() - 1);
+ }
+
+ Vector(size_t size, const T& val)
+ : m_size(size)
+ , m_buffer(size)
+ {
+ if (begin())
+ TypeOperations::uninitializedFill(begin(), end(), val);
+ }
+
+ void fill(const T&, size_t);
+ void fill(const T& val) { fill(val, size()); }
+
+ template<typename Iterator> void appendRange(Iterator start, Iterator end);
+
+ T* releaseBuffer();
+
+ void swap(Vector<T, inlineCapacity>& other)
+ {
+ std::swap(m_size, other.m_size);
+ m_buffer.swap(other.m_buffer);
+ }
+
+ void checkConsistency();
+
+ private:
+ void expandCapacity(size_t newMinCapacity);
+ const T* expandCapacity(size_t newMinCapacity, const T*);
+ bool tryExpandCapacity(size_t newMinCapacity);
+ const T* tryExpandCapacity(size_t newMinCapacity, const T*);
+ template<typename U> U* expandCapacity(size_t newMinCapacity, U*);
+
+ size_t m_size;
+ Buffer m_buffer;
+ };
+
+#if PLATFORM(QT)
+ template<typename T>
+ QDataStream& operator<<(QDataStream& stream, const Vector<T>& data)
+ {
+ stream << qint64(data.size());
+ foreach (const T& i, data)
+ stream << i;
+ return stream;
+ }
+
+ template<typename T>
+ QDataStream& operator>>(QDataStream& stream, Vector<T>& data)
+ {
+ data.clear();
+ qint64 count;
+ T item;
+ stream >> count;
+ data.reserveCapacity(count);
+ for (qint64 i = 0; i < count; ++i) {
+ stream >> item;
+ data.append(item);
+ }
+ return stream;
+ }
+#endif
+
+ template<typename T, size_t inlineCapacity>
+ Vector<T, inlineCapacity>::Vector(const Vector& other)
+ : m_size(other.size())
+ , m_buffer(other.capacity())
+ {
+ if (begin())
+ TypeOperations::uninitializedCopy(other.begin(), other.end(), begin());
+ }
+
+ template<typename T, size_t inlineCapacity>
+ template<size_t otherCapacity>
+ Vector<T, inlineCapacity>::Vector(const Vector<T, otherCapacity>& other)
+ : m_size(other.size())
+ , m_buffer(other.capacity())
+ {
+ if (begin())
+ TypeOperations::uninitializedCopy(other.begin(), other.end(), begin());
+ }
+
+ template<typename T, size_t inlineCapacity>
+ Vector<T, inlineCapacity>& Vector<T, inlineCapacity>::operator=(const Vector<T, inlineCapacity>& other)
+ {
+ if (&other == this)
+ return *this;
+
+ if (size() > other.size())
+ shrink(other.size());
+ else if (other.size() > capacity()) {
+ clear();
+ reserveCapacity(other.size());
+ if (!begin())
+ return *this;
+ }
+
+// Works around an assert in VS2010. See https://connect.microsoft.com/VisualStudio/feedback/details/558044/std-copy-should-not-check-dest-when-first-last
+#if COMPILER(MSVC) && defined(_ITERATOR_DEBUG_LEVEL) && _ITERATOR_DEBUG_LEVEL
+ if (!begin())
+ return *this;
+#endif
+
+ std::copy(other.begin(), other.begin() + size(), begin());
+ TypeOperations::uninitializedCopy(other.begin() + size(), other.end(), end());
+ m_size = other.size();
+
+ return *this;
+ }
+
+ inline bool typelessPointersAreEqual(const void* a, const void* b) { return a == b; }
+
+ template<typename T, size_t inlineCapacity>
+ template<size_t otherCapacity>
+ Vector<T, inlineCapacity>& Vector<T, inlineCapacity>::operator=(const Vector<T, otherCapacity>& other)
+ {
+ // If the inline capacities match, we should call the more specific
+ // template. If the inline capacities don't match, the two objects
+ // shouldn't be allocated the same address.
+ ASSERT(!typelessPointersAreEqual(&other, this));
+
+ if (size() > other.size())
+ shrink(other.size());
+ else if (other.size() > capacity()) {
+ clear();
+ reserveCapacity(other.size());
+ if (!begin())
+ return *this;
+ }
+
+// Works around an assert in VS2010. See https://connect.microsoft.com/VisualStudio/feedback/details/558044/std-copy-should-not-check-dest-when-first-last
+#if COMPILER(MSVC) && defined(_ITERATOR_DEBUG_LEVEL) && _ITERATOR_DEBUG_LEVEL
+ if (!begin())
+ return *this;
+#endif
+
+ std::copy(other.begin(), other.begin() + size(), begin());
+ TypeOperations::uninitializedCopy(other.begin() + size(), other.end(), end());
+ m_size = other.size();
+
+ return *this;
+ }
+
+ template<typename T, size_t inlineCapacity>
+ template<typename U>
+ size_t Vector<T, inlineCapacity>::find(const U& value) const
+ {
+ for (size_t i = 0; i < size(); ++i) {
+ if (at(i) == value)
+ return i;
+ }
+ return notFound;
+ }
+
+ template<typename T, size_t inlineCapacity>
+ template<typename U>
+ size_t Vector<T, inlineCapacity>::reverseFind(const U& value) const
+ {
+ for (size_t i = 1; i <= size(); ++i) {
+ const size_t index = size() - i;
+ if (at(index) == value)
+ return index;
+ }
+ return notFound;
+ }
+
+ template<typename T, size_t inlineCapacity>
+ void Vector<T, inlineCapacity>::fill(const T& val, size_t newSize)
+ {
+ if (size() > newSize)
+ shrink(newSize);
+ else if (newSize > capacity()) {
+ clear();
+ reserveCapacity(newSize);
+ if (!begin())
+ return;
+ }
+
+ std::fill(begin(), end(), val);
+ TypeOperations::uninitializedFill(end(), begin() + newSize, val);
+ m_size = newSize;
+ }
+
+ template<typename T, size_t inlineCapacity>
+ template<typename Iterator>
+ void Vector<T, inlineCapacity>::appendRange(Iterator start, Iterator end)
+ {
+ for (Iterator it = start; it != end; ++it)
+ append(*it);
+ }
+
+ template<typename T, size_t inlineCapacity>
+ void Vector<T, inlineCapacity>::expandCapacity(size_t newMinCapacity)
+ {
+ reserveCapacity(max(newMinCapacity, max(static_cast<size_t>(16), capacity() + capacity() / 4 + 1)));
+ }
+
+ template<typename T, size_t inlineCapacity>
+ const T* Vector<T, inlineCapacity>::expandCapacity(size_t newMinCapacity, const T* ptr)
+ {
+ if (ptr < begin() || ptr >= end()) {
+ expandCapacity(newMinCapacity);
+ return ptr;
+ }
+ size_t index = ptr - begin();
+ expandCapacity(newMinCapacity);
+ return begin() + index;
+ }
+
+ template<typename T, size_t inlineCapacity>
+ bool Vector<T, inlineCapacity>::tryExpandCapacity(size_t newMinCapacity)
+ {
+ return tryReserveCapacity(max(newMinCapacity, max(static_cast<size_t>(16), capacity() + capacity() / 4 + 1)));
+ }
+
+ template<typename T, size_t inlineCapacity>
+ const T* Vector<T, inlineCapacity>::tryExpandCapacity(size_t newMinCapacity, const T* ptr)
+ {
+ if (ptr < begin() || ptr >= end()) {
+ if (!tryExpandCapacity(newMinCapacity))
+ return 0;
+ return ptr;
+ }
+ size_t index = ptr - begin();
+ if (!tryExpandCapacity(newMinCapacity))
+ return 0;
+ return begin() + index;
+ }
+
+ template<typename T, size_t inlineCapacity> template<typename U>
+ inline U* Vector<T, inlineCapacity>::expandCapacity(size_t newMinCapacity, U* ptr)
+ {
+ expandCapacity(newMinCapacity);
+ return ptr;
+ }
+
+ template<typename T, size_t inlineCapacity>
+ inline void Vector<T, inlineCapacity>::resize(size_t size)
+ {
+ if (size <= m_size)
+ TypeOperations::destruct(begin() + size, end());
+ else {
+ if (size > capacity())
+ expandCapacity(size);
+ if (begin())
+ TypeOperations::initialize(end(), begin() + size);
+ }
+
+ m_size = size;
+ }
+
+ template<typename T, size_t inlineCapacity>
+ void Vector<T, inlineCapacity>::shrink(size_t size)
+ {
+ ASSERT(size <= m_size);
+ TypeOperations::destruct(begin() + size, end());
+ m_size = size;
+ }
+
+ template<typename T, size_t inlineCapacity>
+ void Vector<T, inlineCapacity>::grow(size_t size)
+ {
+ ASSERT(size >= m_size);
+ if (size > capacity())
+ expandCapacity(size);
+ if (begin())
+ TypeOperations::initialize(end(), begin() + size);
+ m_size = size;
+ }
+
+ template<typename T, size_t inlineCapacity>
+ void Vector<T, inlineCapacity>::reserveCapacity(size_t newCapacity)
+ {
+ if (newCapacity <= capacity())
+ return;
+ T* oldBuffer = begin();
+ T* oldEnd = end();
+ m_buffer.allocateBuffer(newCapacity);
+ if (begin())
+ TypeOperations::move(oldBuffer, oldEnd, begin());
+ m_buffer.deallocateBuffer(oldBuffer);
+ }
+
+ template<typename T, size_t inlineCapacity>
+ bool Vector<T, inlineCapacity>::tryReserveCapacity(size_t newCapacity)
+ {
+ if (newCapacity <= capacity())
+ return true;
+ T* oldBuffer = begin();
+ T* oldEnd = end();
+ if (!m_buffer.tryAllocateBuffer(newCapacity))
+ return false;
+ ASSERT(begin());
+ TypeOperations::move(oldBuffer, oldEnd, begin());
+ m_buffer.deallocateBuffer(oldBuffer);
+ return true;
+ }
+
+ template<typename T, size_t inlineCapacity>
+ inline void Vector<T, inlineCapacity>::reserveInitialCapacity(size_t initialCapacity)
+ {
+ ASSERT(!m_size);
+ ASSERT(capacity() == inlineCapacity);
+ if (initialCapacity > inlineCapacity)
+ m_buffer.allocateBuffer(initialCapacity);
+ }
+
+ template<typename T, size_t inlineCapacity>
+ void Vector<T, inlineCapacity>::shrinkCapacity(size_t newCapacity)
+ {
+ if (newCapacity >= capacity())
+ return;
+
+ if (newCapacity < size())
+ shrink(newCapacity);
+
+ T* oldBuffer = begin();
+ if (newCapacity > 0) {
+ T* oldEnd = end();
+ m_buffer.allocateBuffer(newCapacity);
+ if (begin() != oldBuffer)
+ TypeOperations::move(oldBuffer, oldEnd, begin());
+ }
+
+ m_buffer.deallocateBuffer(oldBuffer);
+ m_buffer.restoreInlineBufferIfNeeded();
+ }
+
+ // Templatizing these is better than just letting the conversion happen implicitly,
+ // because for instance it allows a PassRefPtr to be appended to a RefPtr vector
+ // without refcount thrash.
+
+ template<typename T, size_t inlineCapacity> template<typename U>
+ void Vector<T, inlineCapacity>::append(const U* data, size_t dataSize)
+ {
+ size_t newSize = m_size + dataSize;
+ if (newSize > capacity()) {
+ data = expandCapacity(newSize, data);
+ if (!begin())
+ return;
+ }
+ if (newSize < m_size)
+ CRASH();
+ T* dest = end();
+ for (size_t i = 0; i < dataSize; ++i)
+ new (&dest[i]) T(data[i]);
+ m_size = newSize;
+ }
+
+ template<typename T, size_t inlineCapacity> template<typename U>
+ bool Vector<T, inlineCapacity>::tryAppend(const U* data, size_t dataSize)
+ {
+ size_t newSize = m_size + dataSize;
+ if (newSize > capacity()) {
+ data = tryExpandCapacity(newSize, data);
+ if (!data)
+ return false;
+ ASSERT(begin());
+ }
+ if (newSize < m_size)
+ return false;
+ T* dest = end();
+ for (size_t i = 0; i < dataSize; ++i)
+ new (&dest[i]) T(data[i]);
+ m_size = newSize;
+ return true;
+ }
+
+ template<typename T, size_t inlineCapacity> template<typename U>
+ ALWAYS_INLINE void Vector<T, inlineCapacity>::append(const U& val)
+ {
+ const U* ptr = &val;
+ if (size() == capacity()) {
+ ptr = expandCapacity(size() + 1, ptr);
+ if (!begin())
+ return;
+ }
+
+#if COMPILER(MSVC7_OR_LOWER)
+ // FIXME: MSVC7 generates compilation errors when trying to assign
+ // a pointer to a Vector of its base class (i.e. can't downcast). So far
+ // I've been unable to determine any logical reason for this, so I can
+ // only assume it is a bug with the compiler. Casting is a bad solution,
+ // however, because it subverts implicit conversions, so a better
+ // one is needed.
+ new (end()) T(static_cast<T>(*ptr));
+#else
+ new (end()) T(*ptr);
+#endif
+ ++m_size;
+ }
+
+ // This version of append saves a branch in the case where you know that the
+ // vector's capacity is large enough for the append to succeed.
+
+ template<typename T, size_t inlineCapacity> template<typename U>
+ inline void Vector<T, inlineCapacity>::uncheckedAppend(const U& val)
+ {
+ ASSERT(size() < capacity());
+ const U* ptr = &val;
+ new (end()) T(*ptr);
+ ++m_size;
+ }
+
+ // This method should not be called append, a better name would be appendElements.
+ // It could also be eliminated entirely, and call sites could just use
+ // appendRange(val.begin(), val.end()).
+ template<typename T, size_t inlineCapacity> template<size_t otherCapacity>
+ inline void Vector<T, inlineCapacity>::append(const Vector<T, otherCapacity>& val)
+ {
+ append(val.begin(), val.size());
+ }
+
+ template<typename T, size_t inlineCapacity> template<typename U>
+ void Vector<T, inlineCapacity>::insert(size_t position, const U* data, size_t dataSize)
+ {
+ ASSERT(position <= size());
+ size_t newSize = m_size + dataSize;
+ if (newSize > capacity()) {
+ data = expandCapacity(newSize, data);
+ if (!begin())
+ return;
+ }
+ if (newSize < m_size)
+ CRASH();
+ T* spot = begin() + position;
+ TypeOperations::moveOverlapping(spot, end(), spot + dataSize);
+ for (size_t i = 0; i < dataSize; ++i)
+ new (&spot[i]) T(data[i]);
+ m_size = newSize;
+ }
+
+ template<typename T, size_t inlineCapacity> template<typename U>
+ inline void Vector<T, inlineCapacity>::insert(size_t position, const U& val)
+ {
+ ASSERT(position <= size());
+ const U* data = &val;
+ if (size() == capacity()) {
+ data = expandCapacity(size() + 1, data);
+ if (!begin())
+ return;
+ }
+ T* spot = begin() + position;
+ TypeOperations::moveOverlapping(spot, end(), spot + 1);
+ new (spot) T(*data);
+ ++m_size;
+ }
+
+ template<typename T, size_t inlineCapacity> template<typename U, size_t c>
+ inline void Vector<T, inlineCapacity>::insert(size_t position, const Vector<U, c>& val)
+ {
+ insert(position, val.begin(), val.size());
+ }
+
+ template<typename T, size_t inlineCapacity> template<typename U>
+ void Vector<T, inlineCapacity>::prepend(const U* data, size_t dataSize)
+ {
+ insert(0, data, dataSize);
+ }
+
+ template<typename T, size_t inlineCapacity> template<typename U>
+ inline void Vector<T, inlineCapacity>::prepend(const U& val)
+ {
+ insert(0, val);
+ }
+
+ template<typename T, size_t inlineCapacity> template<typename U, size_t c>
+ inline void Vector<T, inlineCapacity>::prepend(const Vector<U, c>& val)
+ {
+ insert(0, val.begin(), val.size());
+ }
+
+ template<typename T, size_t inlineCapacity>
+ inline void Vector<T, inlineCapacity>::remove(size_t position)
+ {
+ ASSERT(position < size());
+ T* spot = begin() + position;
+ spot->~T();
+ TypeOperations::moveOverlapping(spot + 1, end(), spot);
+ --m_size;
+ }
+
+ template<typename T, size_t inlineCapacity>
+ inline void Vector<T, inlineCapacity>::remove(size_t position, size_t length)
+ {
+ ASSERT(position < size());
+ ASSERT(position + length <= size());
+ T* beginSpot = begin() + position;
+ T* endSpot = beginSpot + length;
+ TypeOperations::destruct(beginSpot, endSpot);
+ TypeOperations::moveOverlapping(endSpot, end(), beginSpot);
+ m_size -= length;
+ }
+
+ template<typename T, size_t inlineCapacity>
+ inline T* Vector<T, inlineCapacity>::releaseBuffer()
+ {
+ T* buffer = m_buffer.releaseBuffer();
+ if (inlineCapacity && !buffer && m_size) {
+ // If the vector had some data, but no buffer to release,
+ // that means it was using the inline buffer. In that case,
+ // we create a brand new buffer so the caller always gets one.
+ size_t bytes = m_size * sizeof(T);
+ buffer = static_cast<T*>(fastMalloc(bytes));
+ memcpy(buffer, data(), bytes);
+ }
+ m_size = 0;
+ return buffer;
+ }
+
+ template<typename T, size_t inlineCapacity>
+ inline void Vector<T, inlineCapacity>::checkConsistency()
+ {
+#if !ASSERT_DISABLED
+ for (size_t i = 0; i < size(); ++i)
+ ValueCheck<T>::checkConsistency(at(i));
+#endif
+ }
+
+ template<typename T, size_t inlineCapacity>
+ void deleteAllValues(const Vector<T, inlineCapacity>& collection)
+ {
+ typedef typename Vector<T, inlineCapacity>::const_iterator iterator;
+ iterator end = collection.end();
+ for (iterator it = collection.begin(); it != end; ++it)
+ delete *it;
+ }
+
+ template<typename T, size_t inlineCapacity>
+ inline void swap(Vector<T, inlineCapacity>& a, Vector<T, inlineCapacity>& b)
+ {
+ a.swap(b);
+ }
+
+ template<typename T, size_t inlineCapacity>
+ bool operator==(const Vector<T, inlineCapacity>& a, const Vector<T, inlineCapacity>& b)
+ {
+ if (a.size() != b.size())
+ return false;
+
+ return VectorTypeOperations<T>::compare(a.data(), b.data(), a.size());
+ }
+
+ template<typename T, size_t inlineCapacity>
+ inline bool operator!=(const Vector<T, inlineCapacity>& a, const Vector<T, inlineCapacity>& b)
+ {
+ return !(a == b);
+ }
+
+#if !ASSERT_DISABLED
+ template<typename T> struct ValueCheck<Vector<T> > {
+ typedef Vector<T> TraitType;
+ static void checkConsistency(const Vector<T>& v)
+ {
+ v.checkConsistency();
+ }
+ };
+#endif
+
+} // namespace WTF
+
+using WTF::Vector;
+
+#endif // WTF_Vector_h
diff --git a/Source/JavaScriptCore/wtf/VectorTraits.h b/Source/JavaScriptCore/wtf/VectorTraits.h
new file mode 100644
index 0000000..3f33b29
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/VectorTraits.h
@@ -0,0 +1,103 @@
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef WTF_VectorTraits_h
+#define WTF_VectorTraits_h
+
+#include "OwnPtr.h"
+#include "RefPtr.h"
+#include "TypeTraits.h"
+#include <utility>
+#include <memory>
+
+using std::pair;
+
+namespace WTF {
+
+ template<bool isPod, typename T>
+ struct VectorTraitsBase;
+
+ template<typename T>
+ struct VectorTraitsBase<false, T>
+ {
+ static const bool needsDestruction = true;
+ static const bool needsInitialization = true;
+ static const bool canInitializeWithMemset = false;
+ static const bool canMoveWithMemcpy = false;
+ static const bool canCopyWithMemcpy = false;
+ static const bool canFillWithMemset = false;
+ static const bool canCompareWithMemcmp = false;
+ };
+
+ template<typename T>
+ struct VectorTraitsBase<true, T>
+ {
+ static const bool needsDestruction = false;
+ static const bool needsInitialization = false;
+ static const bool canInitializeWithMemset = false;
+ static const bool canMoveWithMemcpy = true;
+ static const bool canCopyWithMemcpy = true;
+ static const bool canFillWithMemset = sizeof(T) == sizeof(char);
+ static const bool canCompareWithMemcmp = true;
+ };
+
+ template<typename T>
+ struct VectorTraits : VectorTraitsBase<IsPod<T>::value, T> { };
+
+ struct SimpleClassVectorTraits
+ {
+ static const bool needsDestruction = true;
+ static const bool needsInitialization = true;
+ static const bool canInitializeWithMemset = true;
+ static const bool canMoveWithMemcpy = true;
+ static const bool canCopyWithMemcpy = false;
+ static const bool canFillWithMemset = false;
+ static const bool canCompareWithMemcmp = true;
+ };
+
+ // we know OwnPtr and RefPtr are simple enough that initializing to 0 and moving with memcpy
+ // (and then not destructing the original) will totally work
+ template<typename P>
+ struct VectorTraits<RefPtr<P> > : SimpleClassVectorTraits { };
+
+ template<typename P>
+ struct VectorTraits<OwnPtr<P> > : SimpleClassVectorTraits { };
+
+ template<typename First, typename Second>
+ struct VectorTraits<pair<First, Second> >
+ {
+ typedef VectorTraits<First> FirstTraits;
+ typedef VectorTraits<Second> SecondTraits;
+
+ static const bool needsDestruction = FirstTraits::needsDestruction || SecondTraits::needsDestruction;
+ static const bool needsInitialization = FirstTraits::needsInitialization || SecondTraits::needsInitialization;
+ static const bool canInitializeWithMemset = FirstTraits::canInitializeWithMemset && SecondTraits::canInitializeWithMemset;
+ static const bool canMoveWithMemcpy = FirstTraits::canMoveWithMemcpy && SecondTraits::canMoveWithMemcpy;
+ static const bool canCopyWithMemcpy = FirstTraits::canCopyWithMemcpy && SecondTraits::canCopyWithMemcpy;
+ static const bool canFillWithMemset = false;
+ static const bool canCompareWithMemcmp = FirstTraits::canCompareWithMemcmp && SecondTraits::canCompareWithMemcmp;
+ };
+
+} // namespace WTF
+
+using WTF::VectorTraits;
+using WTF::SimpleClassVectorTraits;
+
+#endif // WTF_VectorTraits_h
diff --git a/Source/JavaScriptCore/wtf/WTFThreadData.cpp b/Source/JavaScriptCore/wtf/WTFThreadData.cpp
new file mode 100644
index 0000000..84e1856
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/WTFThreadData.cpp
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2008, 2010 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#include "config.h"
+#include "WTFThreadData.h"
+
+namespace WTF {
+
+#if WTFTHREADDATA_MULTITHREADED
+ThreadSpecific<WTFThreadData>* WTFThreadData::staticData;
+#else
+WTFThreadData* WTFThreadData::staticData;
+#endif
+
+WTFThreadData::WTFThreadData()
+ : m_atomicStringTable(0)
+ , m_atomicStringTableDestructor(0)
+#if USE(JSC)
+ , m_defaultIdentifierTable(new JSC::IdentifierTable())
+ , m_currentIdentifierTable(m_defaultIdentifierTable)
+ , m_stackBounds(StackBounds::currentThreadStackBounds())
+#endif
+{
+}
+
+WTFThreadData::~WTFThreadData()
+{
+ if (m_atomicStringTableDestructor)
+ m_atomicStringTableDestructor(m_atomicStringTable);
+#if USE(JSC)
+ delete m_defaultIdentifierTable;
+#endif
+}
+
+}
diff --git a/Source/JavaScriptCore/wtf/WTFThreadData.h b/Source/JavaScriptCore/wtf/WTFThreadData.h
new file mode 100644
index 0000000..52c267a
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/WTFThreadData.h
@@ -0,0 +1,168 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef WTFThreadData_h
+#define WTFThreadData_h
+
+#include <wtf/HashMap.h>
+#include <wtf/HashSet.h>
+#include <wtf/Noncopyable.h>
+#include <wtf/StackBounds.h>
+#include <wtf/text/StringHash.h>
+
+// This was ENABLE(WORKERS) in WebCore, but this is not defined when compiling JSC.
+// However this check was not correct anyway, re this comment:
+// // FIXME: Workers are not necessarily the only feature that make per-thread global data necessary.
+// // We need to check for e.g. database objects manipulating strings on secondary threads.
+// Always enabling this is safe, and should be a better option until we can come up
+// with a better define.
+#define WTFTHREADDATA_MULTITHREADED 1
+
+#if WTFTHREADDATA_MULTITHREADED
+#include <wtf/ThreadSpecific.h>
+#include <wtf/Threading.h>
+#endif
+
+#if USE(JSC)
+// FIXME: This is a temporary layering violation while we move more string code to WTF.
+namespace JSC {
+
+typedef HashMap<const char*, RefPtr<StringImpl>, PtrHash<const char*> > LiteralIdentifierTable;
+
+class IdentifierTable : public FastAllocBase {
+public:
+ ~IdentifierTable();
+
+ std::pair<HashSet<StringImpl*>::iterator, bool> add(StringImpl* value);
+ template<typename U, typename V>
+ std::pair<HashSet<StringImpl*>::iterator, bool> add(U value);
+
+ bool remove(StringImpl* r)
+ {
+ HashSet<StringImpl*>::iterator iter = m_table.find(r);
+ if (iter == m_table.end())
+ return false;
+ m_table.remove(iter);
+ return true;
+ }
+
+ LiteralIdentifierTable& literalTable() { return m_literalTable; }
+
+private:
+ HashSet<StringImpl*> m_table;
+ LiteralIdentifierTable m_literalTable;
+};
+
+}
+#endif
+
+namespace WTF {
+
+class AtomicStringTable;
+
+typedef void (*AtomicStringTableDestructor)(AtomicStringTable*);
+
+class WTFThreadData : public Noncopyable {
+public:
+ WTFThreadData();
+ ~WTFThreadData();
+
+ AtomicStringTable* atomicStringTable()
+ {
+ return m_atomicStringTable;
+ }
+
+#if USE(JSC)
+ JSC::IdentifierTable* currentIdentifierTable()
+ {
+ return m_currentIdentifierTable;
+ }
+
+ JSC::IdentifierTable* setCurrentIdentifierTable(JSC::IdentifierTable* identifierTable)
+ {
+ JSC::IdentifierTable* oldIdentifierTable = m_currentIdentifierTable;
+ m_currentIdentifierTable = identifierTable;
+ return oldIdentifierTable;
+ }
+
+ void resetCurrentIdentifierTable()
+ {
+ m_currentIdentifierTable = m_defaultIdentifierTable;
+ }
+
+ const StackBounds& stack() const
+ {
+ return m_stackBounds;
+ }
+#endif
+
+private:
+ AtomicStringTable* m_atomicStringTable;
+ AtomicStringTableDestructor m_atomicStringTableDestructor;
+
+#if USE(JSC)
+ JSC::IdentifierTable* m_defaultIdentifierTable;
+ JSC::IdentifierTable* m_currentIdentifierTable;
+ StackBounds m_stackBounds;
+#endif
+
+#if WTFTHREADDATA_MULTITHREADED
+ static JS_EXPORTDATA ThreadSpecific<WTFThreadData>* staticData;
+#else
+ static JS_EXPORTDATA WTFThreadData* staticData;
+#endif
+ friend WTFThreadData& wtfThreadData();
+ friend class AtomicStringTable;
+};
+
+inline WTFThreadData& wtfThreadData()
+{
+#if WTFTHREADDATA_MULTITHREADED
+ // WRT WebCore:
+ // WTFThreadData is used on main thread before it could possibly be used
+ // on secondary ones, so there is no need for synchronization here.
+ // WRT JavaScriptCore:
+ // wtfThreadData() is initially called from initializeThreading(), ensuring
+ // this is initially called in a pthread_once locked context.
+ if (!WTFThreadData::staticData)
+ WTFThreadData::staticData = new ThreadSpecific<WTFThreadData>;
+ return **WTFThreadData::staticData;
+#else
+ if (!WTFThreadData::staticData) {
+ WTFThreadData::staticData = static_cast<WTFThreadData*>(fastMalloc(sizeof(WTFThreadData)));
+ // WTFThreadData constructor indirectly uses staticData, so we need to set up the memory before invoking it.
+ new (WTFThreadData::staticData) WTFThreadData;
+ }
+ return *WTFThreadData::staticData;
+#endif
+}
+
+} // namespace WTF
+
+using WTF::WTFThreadData;
+using WTF::wtfThreadData;
+
+#endif // WTFThreadData_h
diff --git a/Source/JavaScriptCore/wtf/android/AndroidThreading.h b/Source/JavaScriptCore/wtf/android/AndroidThreading.h
new file mode 100644
index 0000000..27f548c
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/android/AndroidThreading.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2009, The Android Open Source Project
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef AndroidThreading_h
+#define AndroidThreading_h
+
+namespace WTF {
+
+// An interface to the embedding layer, which provides threading support.
+class AndroidThreading {
+public:
+ static void scheduleDispatchFunctionsOnMainThread();
+};
+
+} // namespace WTF
+
+#endif // AndroidThreading_h
diff --git a/Source/JavaScriptCore/wtf/android/MainThreadAndroid.cpp b/Source/JavaScriptCore/wtf/android/MainThreadAndroid.cpp
new file mode 100644
index 0000000..5e5f7b1
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/android/MainThreadAndroid.cpp
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2009, The Android Open Source Project
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "MainThread.h"
+
+#include "AndroidThreading.h"
+
+namespace WTF {
+
+void initializeMainThreadPlatform()
+{
+}
+
+void scheduleDispatchFunctionsOnMainThread()
+{
+ AndroidThreading::scheduleDispatchFunctionsOnMainThread();
+}
+
+} // namespace WTF
diff --git a/Source/JavaScriptCore/wtf/brew/MainThreadBrew.cpp b/Source/JavaScriptCore/wtf/brew/MainThreadBrew.cpp
new file mode 100644
index 0000000..2690ea5
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/brew/MainThreadBrew.cpp
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2009 Company 100, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "MainThread.h"
+
+namespace WTF {
+
+void initializeMainThreadPlatform()
+{
+ // not implemented
+}
+
+void scheduleDispatchFunctionsOnMainThread()
+{
+ // not implemented
+}
+
+} // namespace WTF
+
diff --git a/Source/JavaScriptCore/wtf/brew/OwnPtrBrew.cpp b/Source/JavaScriptCore/wtf/brew/OwnPtrBrew.cpp
new file mode 100644
index 0000000..ce10fc3
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/brew/OwnPtrBrew.cpp
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2010 Company 100 Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "OwnPtr.h"
+
+#include <AEEBitmap.h>
+#include <AEEFile.h>
+#include <AEEIMemGroup.h>
+#include <AEEIMemSpace.h>
+#include <AEENet.h>
+#include <AEESSL.h>
+#include <AEEStdLib.h>
+
+namespace WTF {
+
+void deleteOwnedPtr(IFileMgr* ptr)
+{
+ if (ptr)
+ IFILEMGR_Release(ptr);
+}
+
+void deleteOwnedPtr(IFile* ptr)
+{
+ if (ptr)
+ IFILE_Release(ptr);
+}
+
+void deleteOwnedPtr(IBitmap* ptr)
+{
+ if (ptr)
+ IBitmap_Release(ptr);
+}
+
+void deleteOwnedPtr(ISSL* ptr)
+{
+ if (ptr)
+ ISSL_Release(ptr);
+}
+
+void deleteOwnedPtr(IMemGroup* ptr)
+{
+ if (ptr)
+ IMemGroup_Release(ptr);
+}
+
+void deleteOwnedPtr(IMemSpace* ptr)
+{
+ if (ptr)
+ IMemSpace_Release(ptr);
+}
+
+void deleteOwnedPtr(ISocket* ptr)
+{
+ if (ptr)
+ ISOCKET_Release(ptr);
+}
+
+}
diff --git a/Source/JavaScriptCore/wtf/brew/RefPtrBrew.h b/Source/JavaScriptCore/wtf/brew/RefPtrBrew.h
new file mode 100644
index 0000000..40e257b
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/brew/RefPtrBrew.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2008 Collabora Ltd.
+ * Copyright (C) 2009 Martin Robinson
+ * Copyright (C) 2010 Company 100, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef RefPtrBrew_h
+#define RefPtrBrew_h
+
+#include "RefPtr.h"
+#include <AEEIBase.h>
+
+namespace WTF {
+
+// All Brew MP classes are derived from either IBase or IQI.
+template<> void refIfNotNull(IBase* ptr)
+{
+ if (LIKELY(ptr != 0))
+ IBase_AddRef(ptr);
+}
+
+template<> void derefIfNotNull(IBase* ptr)
+{
+ if (LIKELY(ptr != 0))
+ IBase_Release(ptr);
+}
+
+template<> void refIfNotNull(IQI* ptr)
+{
+ if (LIKELY(ptr != 0))
+ IQI_AddRef(ptr);
+}
+
+template<> void derefIfNotNull(IQI* ptr)
+{
+ if (LIKELY(ptr != 0))
+ IQI_Release(ptr);
+}
+
+} // namespace WTF
+
+#endif // RefPtrBrew_h
diff --git a/Source/JavaScriptCore/wtf/brew/ShellBrew.h b/Source/JavaScriptCore/wtf/brew/ShellBrew.h
new file mode 100644
index 0000000..8047631
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/brew/ShellBrew.h
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2010 Company 100 Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ShellBrew_h
+#define ShellBrew_h
+
+#include <AEEAppGen.h>
+#include <AEEStdLib.h>
+
+#include <wtf/Assertions.h>
+#include <wtf/PassOwnPtr.h>
+#include <wtf/RefPtr.h>
+
+namespace WTF {
+
+template <typename T>
+static inline PassOwnPtr<T> createInstance(AEECLSID cls)
+{
+ T* instance = 0;
+
+ IShell* shell = reinterpret_cast<AEEApplet*>(GETAPPINSTANCE())->m_pIShell;
+ ISHELL_CreateInstance(shell, cls, reinterpret_cast<void**>(&instance));
+ ASSERT(instance);
+
+ return instance;
+}
+
+template <typename T>
+static inline RefPtr<T> createRefPtrInstance(AEECLSID cls)
+{
+ T* instance = 0;
+
+ IShell* shell = reinterpret_cast<AEEApplet*>(GETAPPINSTANCE())->m_pIShell;
+ ISHELL_CreateInstance(shell, cls, reinterpret_cast<void**>(&instance));
+ ASSERT(instance);
+
+ return adoptRef(instance);
+}
+
+} // namespace WTF
+
+using WTF::createInstance;
+using WTF::createRefPtrInstance;
+
+#endif // ShellBrew_h
diff --git a/Source/JavaScriptCore/wtf/brew/StringBrew.cpp b/Source/JavaScriptCore/wtf/brew/StringBrew.cpp
new file mode 100644
index 0000000..d8f2e59
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/brew/StringBrew.cpp
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2010 Company 100, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "PlatformString.h"
+
+#include <AEEstd.h>
+
+namespace WTF {
+
+// String conversions
+String::String(const AECHAR* string)
+{
+ // It is safe to cast AECHAR to UChar as both of them use 16 bits representation.
+ const UChar* str = reinterpret_cast<const UChar*>(string);
+ const size_t len = std_wstrlen(string);
+
+ m_impl = StringImpl::create(str, len);
+}
+
+} // namespace WTF
diff --git a/Source/JavaScriptCore/wtf/brew/SystemMallocBrew.h b/Source/JavaScriptCore/wtf/brew/SystemMallocBrew.h
new file mode 100644
index 0000000..c973b30
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/brew/SystemMallocBrew.h
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2010 Company 100, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SystemMallocBrew_h
+#define SystemMallocBrew_h
+
+#include <AEEStdLib.h>
+
+static inline void* mallocBrew(size_t n)
+{
+ // By default, memory allocated using MALLOC() is initialized
+ // to zero. This behavior can be disabled by performing a bitwise
+ // OR of the flag ALLOC_NO_ZMEM with the dwSize parameter.
+ return MALLOC(n | ALLOC_NO_ZMEM);
+}
+
+static inline void* callocBrew(size_t numElements, size_t elementSize)
+{
+ return MALLOC(numElements * elementSize);
+}
+
+static inline void freeBrew(void* p)
+{
+ return FREE(p);
+}
+
+static inline void* reallocBrew(void* p, size_t n)
+{
+ return REALLOC(p, n | ALLOC_NO_ZMEM);
+}
+
+// Use MALLOC macro instead of the standard malloc function.
+// Although RVCT provides malloc, we can't use it in BREW
+// because the loader does not initialize the base address properly.
+#define malloc(n) mallocBrew(n)
+#define calloc(n, s) callocBrew(n, s)
+#define realloc(p, n) reallocBrew(p, n)
+#define free(p) freeBrew(p)
+
+#endif // SystemMallocBrew_h
diff --git a/Source/JavaScriptCore/wtf/chromium/ChromiumThreading.h b/Source/JavaScriptCore/wtf/chromium/ChromiumThreading.h
new file mode 100644
index 0000000..3938621
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/chromium/ChromiumThreading.h
@@ -0,0 +1,44 @@
+/*
+* Copyright (C) 2009 Google Inc. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are
+* met:
+*
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above
+* copyright notice, this list of conditions and the following disclaimer
+* in the documentation and/or other materials provided with the
+* distribution.
+* * Neither the name of Google Inc. nor the names of its
+* contributors may be used to endorse or promote products derived from
+* this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef ChromiumThreading_h
+#define ChromiumThreading_h
+
+namespace WTF {
+
+// An interface to the embedding layer, which provides threading support.
+class ChromiumThreading {
+public:
+ static void callOnMainThread(void (*func)(void*), void* context);
+};
+
+} // namespace WTF
+
+#endif // ChromiumThreading_h
diff --git a/Source/JavaScriptCore/wtf/chromium/MainThreadChromium.cpp b/Source/JavaScriptCore/wtf/chromium/MainThreadChromium.cpp
new file mode 100644
index 0000000..9e6592b
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/chromium/MainThreadChromium.cpp
@@ -0,0 +1,73 @@
+/*
+* Copyright (C) 2009 Google Inc. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are
+* met:
+*
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above
+* copyright notice, this list of conditions and the following disclaimer
+* in the documentation and/or other materials provided with the
+* distribution.
+* * Neither the name of Google Inc. nor the names of its
+* contributors may be used to endorse or promote products derived from
+* this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include "config.h"
+#include "MainThread.h"
+
+#include "Assertions.h"
+#include "ChromiumThreading.h"
+#include "Threading.h"
+
+namespace WTF {
+
+static ThreadIdentifier mainThreadIdentifier;
+
+void initializeMainThread()
+{
+ static bool initializedMainThread;
+ if (initializedMainThread)
+ return;
+ initializedMainThread = true;
+
+ mainThreadIdentifier = currentThread();
+}
+
+void callOnMainThread(MainThreadFunction* function, void* context)
+{
+ ChromiumThreading::callOnMainThread(function, context);
+}
+
+void callOnMainThreadAndWait(MainThreadFunction*, void*)
+{
+ ASSERT_NOT_REACHED();
+}
+
+void setMainThreadCallbacksPaused(bool)
+{
+ ASSERT_NOT_REACHED();
+}
+
+bool isMainThread()
+{
+ return currentThread() == mainThreadIdentifier;
+}
+
+} // namespace WTF
+
diff --git a/Source/JavaScriptCore/wtf/dtoa.cpp b/Source/JavaScriptCore/wtf/dtoa.cpp
new file mode 100644
index 0000000..c89c036
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/dtoa.cpp
@@ -0,0 +1,1831 @@
+/****************************************************************
+ *
+ * The author of this software is David M. Gay.
+ *
+ * Copyright (c) 1991, 2000, 2001 by Lucent Technologies.
+ * Copyright (C) 2002, 2005, 2006, 2007, 2008, 2010 Apple Inc. All rights reserved.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose without fee is hereby granted, provided that this entire notice
+ * is included in all copies of any software which is or includes a copy
+ * or modification of this software and in all copies of the supporting
+ * documentation for such software.
+ *
+ * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
+ * WARRANTY. IN PARTICULAR, NEITHER THE AUTHOR NOR LUCENT MAKES ANY
+ * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
+ * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
+ *
+ ***************************************************************/
+
+/* Please send bug reports to David M. Gay (dmg at acm dot org,
+ * with " at " changed at "@" and " dot " changed to "."). */
+
+/* On a machine with IEEE extended-precision registers, it is
+ * necessary to specify double-precision (53-bit) rounding precision
+ * before invoking strtod or dtoa. If the machine uses (the equivalent
+ * of) Intel 80x87 arithmetic, the call
+ * _control87(PC_53, MCW_PC);
+ * does this with many compilers. Whether this or another call is
+ * appropriate depends on the compiler; for this to work, it may be
+ * necessary to #include "float.h" or another system-dependent header
+ * file.
+ */
+
+/* strtod for IEEE-arithmetic machines.
+ *
+ * This strtod returns a nearest machine number to the input decimal
+ * string (or sets errno to ERANGE). With IEEE arithmetic, ties are
+ * broken by the IEEE round-even rule. Otherwise ties are broken by
+ * biased rounding (add half and chop).
+ *
+ * Inspired loosely by William D. Clinger's paper "How to Read Floating
+ * Point Numbers Accurately" [Proc. ACM SIGPLAN '90, pp. 92-101].
+ *
+ * Modifications:
+ *
+ * 1. We only require IEEE double-precision arithmetic (not IEEE double-extended).
+ * 2. We get by with floating-point arithmetic in a case that
+ * Clinger missed -- when we're computing d * 10^n
+ * for a small integer d and the integer n is not too
+ * much larger than 22 (the maximum integer k for which
+ * we can represent 10^k exactly), we may be able to
+ * compute (d*10^k) * 10^(e-k) with just one roundoff.
+ * 3. Rather than a bit-at-a-time adjustment of the binary
+ * result in the hard case, we use floating-point
+ * arithmetic to determine the adjustment to within
+ * one bit; only in really hard cases do we need to
+ * compute a second residual.
+ * 4. Because of 3., we don't need a large table of powers of 10
+ * for ten-to-e (just some small tables, e.g. of 10^k
+ * for 0 <= k <= 22).
+ */
+
+#include "config.h"
+#include "dtoa.h"
+
+#if HAVE(ERRNO_H)
+#include <errno.h>
+#endif
+#include <float.h>
+#include <math.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <wtf/AlwaysInline.h>
+#include <wtf/Assertions.h>
+#include <wtf/DecimalNumber.h>
+#include <wtf/FastMalloc.h>
+#include <wtf/MathExtras.h>
+#include <wtf/Threading.h>
+#include <wtf/UnusedParam.h>
+#include <wtf/Vector.h>
+
+#if COMPILER(MSVC)
+#pragma warning(disable: 4244)
+#pragma warning(disable: 4245)
+#pragma warning(disable: 4554)
+#endif
+
+namespace WTF {
+
+#if ENABLE(JSC_MULTIPLE_THREADS)
+Mutex* s_dtoaP5Mutex;
+#endif
+
+typedef union {
+ double d;
+ uint32_t L[2];
+} U;
+
+#if CPU(BIG_ENDIAN) || CPU(MIDDLE_ENDIAN)
+#define word0(x) (x)->L[0]
+#define word1(x) (x)->L[1]
+#else
+#define word0(x) (x)->L[1]
+#define word1(x) (x)->L[0]
+#endif
+#define dval(x) (x)->d
+
+/* The following definition of Storeinc is appropriate for MIPS processors.
+ * An alternative that might be better on some machines is
+ * *p++ = high << 16 | low & 0xffff;
+ */
+static ALWAYS_INLINE uint32_t* storeInc(uint32_t* p, uint16_t high, uint16_t low)
+{
+ uint16_t* p16 = reinterpret_cast<uint16_t*>(p);
+#if CPU(BIG_ENDIAN)
+ p16[0] = high;
+ p16[1] = low;
+#else
+ p16[1] = high;
+ p16[0] = low;
+#endif
+ return p + 1;
+}
+
+#define Exp_shift 20
+#define Exp_shift1 20
+#define Exp_msk1 0x100000
+#define Exp_msk11 0x100000
+#define Exp_mask 0x7ff00000
+#define P 53
+#define Bias 1023
+#define Emin (-1022)
+#define Exp_1 0x3ff00000
+#define Exp_11 0x3ff00000
+#define Ebits 11
+#define Frac_mask 0xfffff
+#define Frac_mask1 0xfffff
+#define Ten_pmax 22
+#define Bletch 0x10
+#define Bndry_mask 0xfffff
+#define Bndry_mask1 0xfffff
+#define LSB 1
+#define Sign_bit 0x80000000
+#define Log2P 1
+#define Tiny0 0
+#define Tiny1 1
+#define Quick_max 14
+#define Int_max 14
+
+#define rounded_product(a, b) a *= b
+#define rounded_quotient(a, b) a /= b
+
+#define Big0 (Frac_mask1 | Exp_msk1 * (DBL_MAX_EXP + Bias - 1))
+#define Big1 0xffffffff
+
+#if CPU(PPC64) || CPU(X86_64)
+// FIXME: should we enable this on all 64-bit CPUs?
+// 64-bit emulation provided by the compiler is likely to be slower than dtoa own code on 32-bit hardware.
+#define USE_LONG_LONG
+#endif
+
+struct BigInt {
+ BigInt() : sign(0) { }
+ int sign;
+
+ void clear()
+ {
+ sign = 0;
+ m_words.clear();
+ }
+
+ size_t size() const
+ {
+ return m_words.size();
+ }
+
+ void resize(size_t s)
+ {
+ m_words.resize(s);
+ }
+
+ uint32_t* words()
+ {
+ return m_words.data();
+ }
+
+ const uint32_t* words() const
+ {
+ return m_words.data();
+ }
+
+ void append(uint32_t w)
+ {
+ m_words.append(w);
+ }
+
+ Vector<uint32_t, 16> m_words;
+};
+
+static void multadd(BigInt& b, int m, int a) /* multiply by m and add a */
+{
+#ifdef USE_LONG_LONG
+ unsigned long long carry;
+#else
+ uint32_t carry;
+#endif
+
+ int wds = b.size();
+ uint32_t* x = b.words();
+ int i = 0;
+ carry = a;
+ do {
+#ifdef USE_LONG_LONG
+ unsigned long long y = *x * (unsigned long long)m + carry;
+ carry = y >> 32;
+ *x++ = (uint32_t)y & 0xffffffffUL;
+#else
+ uint32_t xi = *x;
+ uint32_t y = (xi & 0xffff) * m + carry;
+ uint32_t z = (xi >> 16) * m + (y >> 16);
+ carry = z >> 16;
+ *x++ = (z << 16) + (y & 0xffff);
+#endif
+ } while (++i < wds);
+
+ if (carry)
+ b.append((uint32_t)carry);
+}
+
+static void s2b(BigInt& b, const char* s, int nd0, int nd, uint32_t y9)
+{
+ b.sign = 0;
+ b.resize(1);
+ b.words()[0] = y9;
+
+ int i = 9;
+ if (9 < nd0) {
+ s += 9;
+ do {
+ multadd(b, 10, *s++ - '0');
+ } while (++i < nd0);
+ s++;
+ } else
+ s += 10;
+ for (; i < nd; i++)
+ multadd(b, 10, *s++ - '0');
+}
+
+static int hi0bits(uint32_t x)
+{
+ int k = 0;
+
+ if (!(x & 0xffff0000)) {
+ k = 16;
+ x <<= 16;
+ }
+ if (!(x & 0xff000000)) {
+ k += 8;
+ x <<= 8;
+ }
+ if (!(x & 0xf0000000)) {
+ k += 4;
+ x <<= 4;
+ }
+ if (!(x & 0xc0000000)) {
+ k += 2;
+ x <<= 2;
+ }
+ if (!(x & 0x80000000)) {
+ k++;
+ if (!(x & 0x40000000))
+ return 32;
+ }
+ return k;
+}
+
+static int lo0bits(uint32_t* y)
+{
+ int k;
+ uint32_t x = *y;
+
+ if (x & 7) {
+ if (x & 1)
+ return 0;
+ if (x & 2) {
+ *y = x >> 1;
+ return 1;
+ }
+ *y = x >> 2;
+ return 2;
+ }
+ k = 0;
+ if (!(x & 0xffff)) {
+ k = 16;
+ x >>= 16;
+ }
+ if (!(x & 0xff)) {
+ k += 8;
+ x >>= 8;
+ }
+ if (!(x & 0xf)) {
+ k += 4;
+ x >>= 4;
+ }
+ if (!(x & 0x3)) {
+ k += 2;
+ x >>= 2;
+ }
+ if (!(x & 1)) {
+ k++;
+ x >>= 1;
+ if (!x)
+ return 32;
+ }
+ *y = x;
+ return k;
+}
+
+static void i2b(BigInt& b, int i)
+{
+ b.sign = 0;
+ b.resize(1);
+ b.words()[0] = i;
+}
+
+static void mult(BigInt& aRef, const BigInt& bRef)
+{
+ const BigInt* a = &aRef;
+ const BigInt* b = &bRef;
+ BigInt c;
+ int wa, wb, wc;
+ const uint32_t* x = 0;
+ const uint32_t* xa;
+ const uint32_t* xb;
+ const uint32_t* xae;
+ const uint32_t* xbe;
+ uint32_t* xc;
+ uint32_t* xc0;
+ uint32_t y;
+#ifdef USE_LONG_LONG
+ unsigned long long carry, z;
+#else
+ uint32_t carry, z;
+#endif
+
+ if (a->size() < b->size()) {
+ const BigInt* tmp = a;
+ a = b;
+ b = tmp;
+ }
+
+ wa = a->size();
+ wb = b->size();
+ wc = wa + wb;
+ c.resize(wc);
+
+ for (xc = c.words(), xa = xc + wc; xc < xa; xc++)
+ *xc = 0;
+ xa = a->words();
+ xae = xa + wa;
+ xb = b->words();
+ xbe = xb + wb;
+ xc0 = c.words();
+#ifdef USE_LONG_LONG
+ for (; xb < xbe; xc0++) {
+ if ((y = *xb++)) {
+ x = xa;
+ xc = xc0;
+ carry = 0;
+ do {
+ z = *x++ * (unsigned long long)y + *xc + carry;
+ carry = z >> 32;
+ *xc++ = (uint32_t)z & 0xffffffffUL;
+ } while (x < xae);
+ *xc = (uint32_t)carry;
+ }
+ }
+#else
+ for (; xb < xbe; xb++, xc0++) {
+ if ((y = *xb & 0xffff)) {
+ x = xa;
+ xc = xc0;
+ carry = 0;
+ do {
+ z = (*x & 0xffff) * y + (*xc & 0xffff) + carry;
+ carry = z >> 16;
+ uint32_t z2 = (*x++ >> 16) * y + (*xc >> 16) + carry;
+ carry = z2 >> 16;
+ xc = storeInc(xc, z2, z);
+ } while (x < xae);
+ *xc = carry;
+ }
+ if ((y = *xb >> 16)) {
+ x = xa;
+ xc = xc0;
+ carry = 0;
+ uint32_t z2 = *xc;
+ do {
+ z = (*x & 0xffff) * y + (*xc >> 16) + carry;
+ carry = z >> 16;
+ xc = storeInc(xc, z, z2);
+ z2 = (*x++ >> 16) * y + (*xc & 0xffff) + carry;
+ carry = z2 >> 16;
+ } while (x < xae);
+ *xc = z2;
+ }
+ }
+#endif
+ for (xc0 = c.words(), xc = xc0 + wc; wc > 0 && !*--xc; --wc) { }
+ c.resize(wc);
+ aRef = c;
+}
+
+struct P5Node : Noncopyable {
+ BigInt val;
+ P5Node* next;
+};
+
+static P5Node* p5s;
+static int p5sCount;
+
+static ALWAYS_INLINE void pow5mult(BigInt& b, int k)
+{
+ static int p05[3] = { 5, 25, 125 };
+
+ if (int i = k & 3)
+ multadd(b, p05[i - 1], 0);
+
+ if (!(k >>= 2))
+ return;
+
+#if ENABLE(JSC_MULTIPLE_THREADS)
+ s_dtoaP5Mutex->lock();
+#endif
+ P5Node* p5 = p5s;
+
+ if (!p5) {
+ /* first time */
+ p5 = new P5Node;
+ i2b(p5->val, 625);
+ p5->next = 0;
+ p5s = p5;
+ p5sCount = 1;
+ }
+
+ int p5sCountLocal = p5sCount;
+#if ENABLE(JSC_MULTIPLE_THREADS)
+ s_dtoaP5Mutex->unlock();
+#endif
+ int p5sUsed = 0;
+
+ for (;;) {
+ if (k & 1)
+ mult(b, p5->val);
+
+ if (!(k >>= 1))
+ break;
+
+ if (++p5sUsed == p5sCountLocal) {
+#if ENABLE(JSC_MULTIPLE_THREADS)
+ s_dtoaP5Mutex->lock();
+#endif
+ if (p5sUsed == p5sCount) {
+ ASSERT(!p5->next);
+ p5->next = new P5Node;
+ p5->next->next = 0;
+ p5->next->val = p5->val;
+ mult(p5->next->val, p5->next->val);
+ ++p5sCount;
+ }
+
+ p5sCountLocal = p5sCount;
+#if ENABLE(JSC_MULTIPLE_THREADS)
+ s_dtoaP5Mutex->unlock();
+#endif
+ }
+ p5 = p5->next;
+ }
+}
+
+static ALWAYS_INLINE void lshift(BigInt& b, int k)
+{
+ int n = k >> 5;
+
+ int origSize = b.size();
+ int n1 = n + origSize + 1;
+
+ if (k &= 0x1f)
+ b.resize(b.size() + n + 1);
+ else
+ b.resize(b.size() + n);
+
+ const uint32_t* srcStart = b.words();
+ uint32_t* dstStart = b.words();
+ const uint32_t* src = srcStart + origSize - 1;
+ uint32_t* dst = dstStart + n1 - 1;
+ if (k) {
+ uint32_t hiSubword = 0;
+ int s = 32 - k;
+ for (; src >= srcStart; --src) {
+ *dst-- = hiSubword | *src >> s;
+ hiSubword = *src << k;
+ }
+ *dst = hiSubword;
+ ASSERT(dst == dstStart + n);
+
+ b.resize(origSize + n + !!b.words()[n1 - 1]);
+ }
+ else {
+ do {
+ *--dst = *src--;
+ } while (src >= srcStart);
+ }
+ for (dst = dstStart + n; dst != dstStart; )
+ *--dst = 0;
+
+ ASSERT(b.size() <= 1 || b.words()[b.size() - 1]);
+}
+
+static int cmp(const BigInt& a, const BigInt& b)
+{
+ const uint32_t *xa, *xa0, *xb, *xb0;
+ int i, j;
+
+ i = a.size();
+ j = b.size();
+ ASSERT(i <= 1 || a.words()[i - 1]);
+ ASSERT(j <= 1 || b.words()[j - 1]);
+ if (i -= j)
+ return i;
+ xa0 = a.words();
+ xa = xa0 + j;
+ xb0 = b.words();
+ xb = xb0 + j;
+ for (;;) {
+ if (*--xa != *--xb)
+ return *xa < *xb ? -1 : 1;
+ if (xa <= xa0)
+ break;
+ }
+ return 0;
+}
+
+static ALWAYS_INLINE void diff(BigInt& c, const BigInt& aRef, const BigInt& bRef)
+{
+ const BigInt* a = &aRef;
+ const BigInt* b = &bRef;
+ int i, wa, wb;
+ uint32_t* xc;
+
+ i = cmp(*a, *b);
+ if (!i) {
+ c.sign = 0;
+ c.resize(1);
+ c.words()[0] = 0;
+ return;
+ }
+ if (i < 0) {
+ const BigInt* tmp = a;
+ a = b;
+ b = tmp;
+ i = 1;
+ } else
+ i = 0;
+
+ wa = a->size();
+ const uint32_t* xa = a->words();
+ const uint32_t* xae = xa + wa;
+ wb = b->size();
+ const uint32_t* xb = b->words();
+ const uint32_t* xbe = xb + wb;
+
+ c.resize(wa);
+ c.sign = i;
+ xc = c.words();
+#ifdef USE_LONG_LONG
+ unsigned long long borrow = 0;
+ do {
+ unsigned long long y = (unsigned long long)*xa++ - *xb++ - borrow;
+ borrow = y >> 32 & (uint32_t)1;
+ *xc++ = (uint32_t)y & 0xffffffffUL;
+ } while (xb < xbe);
+ while (xa < xae) {
+ unsigned long long y = *xa++ - borrow;
+ borrow = y >> 32 & (uint32_t)1;
+ *xc++ = (uint32_t)y & 0xffffffffUL;
+ }
+#else
+ uint32_t borrow = 0;
+ do {
+ uint32_t y = (*xa & 0xffff) - (*xb & 0xffff) - borrow;
+ borrow = (y & 0x10000) >> 16;
+ uint32_t z = (*xa++ >> 16) - (*xb++ >> 16) - borrow;
+ borrow = (z & 0x10000) >> 16;
+ xc = storeInc(xc, z, y);
+ } while (xb < xbe);
+ while (xa < xae) {
+ uint32_t y = (*xa & 0xffff) - borrow;
+ borrow = (y & 0x10000) >> 16;
+ uint32_t z = (*xa++ >> 16) - borrow;
+ borrow = (z & 0x10000) >> 16;
+ xc = storeInc(xc, z, y);
+ }
+#endif
+ while (!*--xc)
+ wa--;
+ c.resize(wa);
+}
+
+static double ulp(U *x)
+{
+ register int32_t L;
+ U u;
+
+ L = (word0(x) & Exp_mask) - (P - 1) * Exp_msk1;
+ word0(&u) = L;
+ word1(&u) = 0;
+ return dval(&u);
+}
+
+static double b2d(const BigInt& a, int* e)
+{
+ const uint32_t* xa;
+ const uint32_t* xa0;
+ uint32_t w;
+ uint32_t y;
+ uint32_t z;
+ int k;
+ U d;
+
+#define d0 word0(&d)
+#define d1 word1(&d)
+
+ xa0 = a.words();
+ xa = xa0 + a.size();
+ y = *--xa;
+ ASSERT(y);
+ k = hi0bits(y);
+ *e = 32 - k;
+ if (k < Ebits) {
+ d0 = Exp_1 | (y >> (Ebits - k));
+ w = xa > xa0 ? *--xa : 0;
+ d1 = (y << (32 - Ebits + k)) | (w >> (Ebits - k));
+ goto returnD;
+ }
+ z = xa > xa0 ? *--xa : 0;
+ if (k -= Ebits) {
+ d0 = Exp_1 | (y << k) | (z >> (32 - k));
+ y = xa > xa0 ? *--xa : 0;
+ d1 = (z << k) | (y >> (32 - k));
+ } else {
+ d0 = Exp_1 | y;
+ d1 = z;
+ }
+returnD:
+#undef d0
+#undef d1
+ return dval(&d);
+}
+
+static ALWAYS_INLINE void d2b(BigInt& b, U* d, int* e, int* bits)
+{
+ int de, k;
+ uint32_t* x;
+ uint32_t y, z;
+ int i;
+#define d0 word0(d)
+#define d1 word1(d)
+
+ b.sign = 0;
+ b.resize(1);
+ x = b.words();
+
+ z = d0 & Frac_mask;
+ d0 &= 0x7fffffff; /* clear sign bit, which we ignore */
+ if ((de = (int)(d0 >> Exp_shift)))
+ z |= Exp_msk1;
+ if ((y = d1)) {
+ if ((k = lo0bits(&y))) {
+ x[0] = y | (z << (32 - k));
+ z >>= k;
+ } else
+ x[0] = y;
+ if (z) {
+ b.resize(2);
+ x[1] = z;
+ }
+
+ i = b.size();
+ } else {
+ k = lo0bits(&z);
+ x[0] = z;
+ i = 1;
+ b.resize(1);
+ k += 32;
+ }
+ if (de) {
+ *e = de - Bias - (P - 1) + k;
+ *bits = P - k;
+ } else {
+ *e = de - Bias - (P - 1) + 1 + k;
+ *bits = (32 * i) - hi0bits(x[i - 1]);
+ }
+}
+#undef d0
+#undef d1
+
+static double ratio(const BigInt& a, const BigInt& b)
+{
+ U da, db;
+ int k, ka, kb;
+
+ dval(&da) = b2d(a, &ka);
+ dval(&db) = b2d(b, &kb);
+ k = ka - kb + 32 * (a.size() - b.size());
+ if (k > 0)
+ word0(&da) += k * Exp_msk1;
+ else {
+ k = -k;
+ word0(&db) += k * Exp_msk1;
+ }
+ return dval(&da) / dval(&db);
+}
+
+static const double tens[] = {
+ 1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9,
+ 1e10, 1e11, 1e12, 1e13, 1e14, 1e15, 1e16, 1e17, 1e18, 1e19,
+ 1e20, 1e21, 1e22
+};
+
+static const double bigtens[] = { 1e16, 1e32, 1e64, 1e128, 1e256 };
+static const double tinytens[] = { 1e-16, 1e-32, 1e-64, 1e-128,
+ 9007199254740992. * 9007199254740992.e-256
+ /* = 2^106 * 1e-256 */
+};
+
+/* The factor of 2^53 in tinytens[4] helps us avoid setting the underflow */
+/* flag unnecessarily. It leads to a song and dance at the end of strtod. */
+#define Scale_Bit 0x10
+#define n_bigtens 5
+
+double strtod(const char* s00, char** se)
+{
+ int scale;
+ int bb2, bb5, bbe, bd2, bd5, bbbits, bs2, c, dsign,
+ e, e1, esign, i, j, k, nd, nd0, nf, nz, nz0, sign;
+ const char *s, *s0, *s1;
+ double aadj, aadj1;
+ U aadj2, adj, rv, rv0;
+ int32_t L;
+ uint32_t y, z;
+ BigInt bb, bb1, bd, bd0, bs, delta;
+
+ sign = nz0 = nz = 0;
+ dval(&rv) = 0;
+ for (s = s00; ; s++) {
+ switch (*s) {
+ case '-':
+ sign = 1;
+ /* no break */
+ case '+':
+ if (*++s)
+ goto break2;
+ /* no break */
+ case 0:
+ goto ret0;
+ case '\t':
+ case '\n':
+ case '\v':
+ case '\f':
+ case '\r':
+ case ' ':
+ continue;
+ default:
+ goto break2;
+ }
+ }
+break2:
+ if (*s == '0') {
+ nz0 = 1;
+ while (*++s == '0') { }
+ if (!*s)
+ goto ret;
+ }
+ s0 = s;
+ y = z = 0;
+ for (nd = nf = 0; (c = *s) >= '0' && c <= '9'; nd++, s++)
+ if (nd < 9)
+ y = (10 * y) + c - '0';
+ else if (nd < 16)
+ z = (10 * z) + c - '0';
+ nd0 = nd;
+ if (c == '.') {
+ c = *++s;
+ if (!nd) {
+ for (; c == '0'; c = *++s)
+ nz++;
+ if (c > '0' && c <= '9') {
+ s0 = s;
+ nf += nz;
+ nz = 0;
+ goto haveDig;
+ }
+ goto digDone;
+ }
+ for (; c >= '0' && c <= '9'; c = *++s) {
+haveDig:
+ nz++;
+ if (c -= '0') {
+ nf += nz;
+ for (i = 1; i < nz; i++)
+ if (nd++ < 9)
+ y *= 10;
+ else if (nd <= DBL_DIG + 1)
+ z *= 10;
+ if (nd++ < 9)
+ y = (10 * y) + c;
+ else if (nd <= DBL_DIG + 1)
+ z = (10 * z) + c;
+ nz = 0;
+ }
+ }
+ }
+digDone:
+ e = 0;
+ if (c == 'e' || c == 'E') {
+ if (!nd && !nz && !nz0)
+ goto ret0;
+ s00 = s;
+ esign = 0;
+ switch (c = *++s) {
+ case '-':
+ esign = 1;
+ case '+':
+ c = *++s;
+ }
+ if (c >= '0' && c <= '9') {
+ while (c == '0')
+ c = *++s;
+ if (c > '0' && c <= '9') {
+ L = c - '0';
+ s1 = s;
+ while ((c = *++s) >= '0' && c <= '9')
+ L = (10 * L) + c - '0';
+ if (s - s1 > 8 || L > 19999)
+ /* Avoid confusion from exponents
+ * so large that e might overflow.
+ */
+ e = 19999; /* safe for 16 bit ints */
+ else
+ e = (int)L;
+ if (esign)
+ e = -e;
+ } else
+ e = 0;
+ } else
+ s = s00;
+ }
+ if (!nd) {
+ if (!nz && !nz0) {
+ret0:
+ s = s00;
+ sign = 0;
+ }
+ goto ret;
+ }
+ e1 = e -= nf;
+
+ /* Now we have nd0 digits, starting at s0, followed by a
+ * decimal point, followed by nd-nd0 digits. The number we're
+ * after is the integer represented by those digits times
+ * 10**e */
+
+ if (!nd0)
+ nd0 = nd;
+ k = nd < DBL_DIG + 1 ? nd : DBL_DIG + 1;
+ dval(&rv) = y;
+ if (k > 9)
+ dval(&rv) = tens[k - 9] * dval(&rv) + z;
+ if (nd <= DBL_DIG) {
+ if (!e)
+ goto ret;
+ if (e > 0) {
+ if (e <= Ten_pmax) {
+ /* rv = */ rounded_product(dval(&rv), tens[e]);
+ goto ret;
+ }
+ i = DBL_DIG - nd;
+ if (e <= Ten_pmax + i) {
+ /* A fancier test would sometimes let us do
+ * this for larger i values.
+ */
+ e -= i;
+ dval(&rv) *= tens[i];
+ /* rv = */ rounded_product(dval(&rv), tens[e]);
+ goto ret;
+ }
+ } else if (e >= -Ten_pmax) {
+ /* rv = */ rounded_quotient(dval(&rv), tens[-e]);
+ goto ret;
+ }
+ }
+ e1 += nd - k;
+
+ scale = 0;
+
+ /* Get starting approximation = rv * 10**e1 */
+
+ if (e1 > 0) {
+ if ((i = e1 & 15))
+ dval(&rv) *= tens[i];
+ if (e1 &= ~15) {
+ if (e1 > DBL_MAX_10_EXP) {
+ovfl:
+#if HAVE(ERRNO_H)
+ errno = ERANGE;
+#endif
+ /* Can't trust HUGE_VAL */
+ word0(&rv) = Exp_mask;
+ word1(&rv) = 0;
+ goto ret;
+ }
+ e1 >>= 4;
+ for (j = 0; e1 > 1; j++, e1 >>= 1)
+ if (e1 & 1)
+ dval(&rv) *= bigtens[j];
+ /* The last multiplication could overflow. */
+ word0(&rv) -= P * Exp_msk1;
+ dval(&rv) *= bigtens[j];
+ if ((z = word0(&rv) & Exp_mask) > Exp_msk1 * (DBL_MAX_EXP + Bias - P))
+ goto ovfl;
+ if (z > Exp_msk1 * (DBL_MAX_EXP + Bias - 1 - P)) {
+ /* set to largest number */
+ /* (Can't trust DBL_MAX) */
+ word0(&rv) = Big0;
+ word1(&rv) = Big1;
+ } else
+ word0(&rv) += P * Exp_msk1;
+ }
+ } else if (e1 < 0) {
+ e1 = -e1;
+ if ((i = e1 & 15))
+ dval(&rv) /= tens[i];
+ if (e1 >>= 4) {
+ if (e1 >= 1 << n_bigtens)
+ goto undfl;
+ if (e1 & Scale_Bit)
+ scale = 2 * P;
+ for (j = 0; e1 > 0; j++, e1 >>= 1)
+ if (e1 & 1)
+ dval(&rv) *= tinytens[j];
+ if (scale && (j = (2 * P) + 1 - ((word0(&rv) & Exp_mask) >> Exp_shift)) > 0) {
+ /* scaled rv is denormal; clear j low bits */
+ if (j >= 32) {
+ word1(&rv) = 0;
+ if (j >= 53)
+ word0(&rv) = (P + 2) * Exp_msk1;
+ else
+ word0(&rv) &= 0xffffffff << (j - 32);
+ } else
+ word1(&rv) &= 0xffffffff << j;
+ }
+ if (!dval(&rv)) {
+undfl:
+ dval(&rv) = 0.;
+#if HAVE(ERRNO_H)
+ errno = ERANGE;
+#endif
+ goto ret;
+ }
+ }
+ }
+
+ /* Now the hard part -- adjusting rv to the correct value.*/
+
+ /* Put digits into bd: true value = bd * 10^e */
+
+ s2b(bd0, s0, nd0, nd, y);
+
+ for (;;) {
+ bd = bd0;
+ d2b(bb, &rv, &bbe, &bbbits); /* rv = bb * 2^bbe */
+ i2b(bs, 1);
+
+ if (e >= 0) {
+ bb2 = bb5 = 0;
+ bd2 = bd5 = e;
+ } else {
+ bb2 = bb5 = -e;
+ bd2 = bd5 = 0;
+ }
+ if (bbe >= 0)
+ bb2 += bbe;
+ else
+ bd2 -= bbe;
+ bs2 = bb2;
+ j = bbe - scale;
+ i = j + bbbits - 1; /* logb(rv) */
+ if (i < Emin) /* denormal */
+ j += P - Emin;
+ else
+ j = P + 1 - bbbits;
+ bb2 += j;
+ bd2 += j;
+ bd2 += scale;
+ i = bb2 < bd2 ? bb2 : bd2;
+ if (i > bs2)
+ i = bs2;
+ if (i > 0) {
+ bb2 -= i;
+ bd2 -= i;
+ bs2 -= i;
+ }
+ if (bb5 > 0) {
+ pow5mult(bs, bb5);
+ mult(bb, bs);
+ }
+ if (bb2 > 0)
+ lshift(bb, bb2);
+ if (bd5 > 0)
+ pow5mult(bd, bd5);
+ if (bd2 > 0)
+ lshift(bd, bd2);
+ if (bs2 > 0)
+ lshift(bs, bs2);
+ diff(delta, bb, bd);
+ dsign = delta.sign;
+ delta.sign = 0;
+ i = cmp(delta, bs);
+
+ if (i < 0) {
+ /* Error is less than half an ulp -- check for
+ * special case of mantissa a power of two.
+ */
+ if (dsign || word1(&rv) || word0(&rv) & Bndry_mask
+ || (word0(&rv) & Exp_mask) <= (2 * P + 1) * Exp_msk1
+ ) {
+ break;
+ }
+ if (!delta.words()[0] && delta.size() <= 1) {
+ /* exact result */
+ break;
+ }
+ lshift(delta, Log2P);
+ if (cmp(delta, bs) > 0)
+ goto dropDown;
+ break;
+ }
+ if (!i) {
+ /* exactly half-way between */
+ if (dsign) {
+ if ((word0(&rv) & Bndry_mask1) == Bndry_mask1
+ && word1(&rv) == (
+ (scale && (y = word0(&rv) & Exp_mask) <= 2 * P * Exp_msk1)
+ ? (0xffffffff & (0xffffffff << (2 * P + 1 - (y >> Exp_shift)))) :
+ 0xffffffff)) {
+ /*boundary case -- increment exponent*/
+ word0(&rv) = (word0(&rv) & Exp_mask) + Exp_msk1;
+ word1(&rv) = 0;
+ dsign = 0;
+ break;
+ }
+ } else if (!(word0(&rv) & Bndry_mask) && !word1(&rv)) {
+dropDown:
+ /* boundary case -- decrement exponent */
+ if (scale) {
+ L = word0(&rv) & Exp_mask;
+ if (L <= (2 * P + 1) * Exp_msk1) {
+ if (L > (P + 2) * Exp_msk1)
+ /* round even ==> */
+ /* accept rv */
+ break;
+ /* rv = smallest denormal */
+ goto undfl;
+ }
+ }
+ L = (word0(&rv) & Exp_mask) - Exp_msk1;
+ word0(&rv) = L | Bndry_mask1;
+ word1(&rv) = 0xffffffff;
+ break;
+ }
+ if (!(word1(&rv) & LSB))
+ break;
+ if (dsign)
+ dval(&rv) += ulp(&rv);
+ else {
+ dval(&rv) -= ulp(&rv);
+ if (!dval(&rv))
+ goto undfl;
+ }
+ dsign = 1 - dsign;
+ break;
+ }
+ if ((aadj = ratio(delta, bs)) <= 2.) {
+ if (dsign)
+ aadj = aadj1 = 1.;
+ else if (word1(&rv) || word0(&rv) & Bndry_mask) {
+ if (word1(&rv) == Tiny1 && !word0(&rv))
+ goto undfl;
+ aadj = 1.;
+ aadj1 = -1.;
+ } else {
+ /* special case -- power of FLT_RADIX to be */
+ /* rounded down... */
+
+ if (aadj < 2. / FLT_RADIX)
+ aadj = 1. / FLT_RADIX;
+ else
+ aadj *= 0.5;
+ aadj1 = -aadj;
+ }
+ } else {
+ aadj *= 0.5;
+ aadj1 = dsign ? aadj : -aadj;
+ }
+ y = word0(&rv) & Exp_mask;
+
+ /* Check for overflow */
+
+ if (y == Exp_msk1 * (DBL_MAX_EXP + Bias - 1)) {
+ dval(&rv0) = dval(&rv);
+ word0(&rv) -= P * Exp_msk1;
+ adj.d = aadj1 * ulp(&rv);
+ dval(&rv) += adj.d;
+ if ((word0(&rv) & Exp_mask) >= Exp_msk1 * (DBL_MAX_EXP + Bias - P)) {
+ if (word0(&rv0) == Big0 && word1(&rv0) == Big1)
+ goto ovfl;
+ word0(&rv) = Big0;
+ word1(&rv) = Big1;
+ goto cont;
+ }
+ word0(&rv) += P * Exp_msk1;
+ } else {
+ if (scale && y <= 2 * P * Exp_msk1) {
+ if (aadj <= 0x7fffffff) {
+ if ((z = (uint32_t)aadj) <= 0)
+ z = 1;
+ aadj = z;
+ aadj1 = dsign ? aadj : -aadj;
+ }
+ dval(&aadj2) = aadj1;
+ word0(&aadj2) += (2 * P + 1) * Exp_msk1 - y;
+ aadj1 = dval(&aadj2);
+ }
+ adj.d = aadj1 * ulp(&rv);
+ dval(&rv) += adj.d;
+ }
+ z = word0(&rv) & Exp_mask;
+ if (!scale && y == z) {
+ /* Can we stop now? */
+ L = (int32_t)aadj;
+ aadj -= L;
+ /* The tolerances below are conservative. */
+ if (dsign || word1(&rv) || word0(&rv) & Bndry_mask) {
+ if (aadj < .4999999 || aadj > .5000001)
+ break;
+ } else if (aadj < .4999999 / FLT_RADIX)
+ break;
+ }
+cont:
+ {}
+ }
+ if (scale) {
+ word0(&rv0) = Exp_1 - 2 * P * Exp_msk1;
+ word1(&rv0) = 0;
+ dval(&rv) *= dval(&rv0);
+#if HAVE(ERRNO_H)
+ /* try to avoid the bug of testing an 8087 register value */
+ if (!word0(&rv) && !word1(&rv))
+ errno = ERANGE;
+#endif
+ }
+ret:
+ if (se)
+ *se = const_cast<char*>(s);
+ return sign ? -dval(&rv) : dval(&rv);
+}
+
+static ALWAYS_INLINE int quorem(BigInt& b, BigInt& S)
+{
+ size_t n;
+ uint32_t* bx;
+ uint32_t* bxe;
+ uint32_t q;
+ uint32_t* sx;
+ uint32_t* sxe;
+#ifdef USE_LONG_LONG
+ unsigned long long borrow, carry, y, ys;
+#else
+ uint32_t borrow, carry, y, ys;
+ uint32_t si, z, zs;
+#endif
+ ASSERT(b.size() <= 1 || b.words()[b.size() - 1]);
+ ASSERT(S.size() <= 1 || S.words()[S.size() - 1]);
+
+ n = S.size();
+ ASSERT_WITH_MESSAGE(b.size() <= n, "oversize b in quorem");
+ if (b.size() < n)
+ return 0;
+ sx = S.words();
+ sxe = sx + --n;
+ bx = b.words();
+ bxe = bx + n;
+ q = *bxe / (*sxe + 1); /* ensure q <= true quotient */
+ ASSERT_WITH_MESSAGE(q <= 9, "oversized quotient in quorem");
+ if (q) {
+ borrow = 0;
+ carry = 0;
+ do {
+#ifdef USE_LONG_LONG
+ ys = *sx++ * (unsigned long long)q + carry;
+ carry = ys >> 32;
+ y = *bx - (ys & 0xffffffffUL) - borrow;
+ borrow = y >> 32 & (uint32_t)1;
+ *bx++ = (uint32_t)y & 0xffffffffUL;
+#else
+ si = *sx++;
+ ys = (si & 0xffff) * q + carry;
+ zs = (si >> 16) * q + (ys >> 16);
+ carry = zs >> 16;
+ y = (*bx & 0xffff) - (ys & 0xffff) - borrow;
+ borrow = (y & 0x10000) >> 16;
+ z = (*bx >> 16) - (zs & 0xffff) - borrow;
+ borrow = (z & 0x10000) >> 16;
+ bx = storeInc(bx, z, y);
+#endif
+ } while (sx <= sxe);
+ if (!*bxe) {
+ bx = b.words();
+ while (--bxe > bx && !*bxe)
+ --n;
+ b.resize(n);
+ }
+ }
+ if (cmp(b, S) >= 0) {
+ q++;
+ borrow = 0;
+ carry = 0;
+ bx = b.words();
+ sx = S.words();
+ do {
+#ifdef USE_LONG_LONG
+ ys = *sx++ + carry;
+ carry = ys >> 32;
+ y = *bx - (ys & 0xffffffffUL) - borrow;
+ borrow = y >> 32 & (uint32_t)1;
+ *bx++ = (uint32_t)y & 0xffffffffUL;
+#else
+ si = *sx++;
+ ys = (si & 0xffff) + carry;
+ zs = (si >> 16) + (ys >> 16);
+ carry = zs >> 16;
+ y = (*bx & 0xffff) - (ys & 0xffff) - borrow;
+ borrow = (y & 0x10000) >> 16;
+ z = (*bx >> 16) - (zs & 0xffff) - borrow;
+ borrow = (z & 0x10000) >> 16;
+ bx = storeInc(bx, z, y);
+#endif
+ } while (sx <= sxe);
+ bx = b.words();
+ bxe = bx + n;
+ if (!*bxe) {
+ while (--bxe > bx && !*bxe)
+ --n;
+ b.resize(n);
+ }
+ }
+ return q;
+}
+
+/* dtoa for IEEE arithmetic (dmg): convert double to ASCII string.
+ *
+ * Inspired by "How to Print Floating-Point Numbers Accurately" by
+ * Guy L. Steele, Jr. and Jon L. White [Proc. ACM SIGPLAN '90, pp. 112-126].
+ *
+ * Modifications:
+ * 1. Rather than iterating, we use a simple numeric overestimate
+ * to determine k = floor(log10(d)). We scale relevant
+ * quantities using O(log2(k)) rather than O(k) multiplications.
+ * 2. For some modes > 2 (corresponding to ecvt and fcvt), we don't
+ * try to generate digits strictly left to right. Instead, we
+ * compute with fewer bits and propagate the carry if necessary
+ * when rounding the final digit up. This is often faster.
+ * 3. Under the assumption that input will be rounded nearest,
+ * mode 0 renders 1e23 as 1e23 rather than 9.999999999999999e22.
+ * That is, we allow equality in stopping tests when the
+ * round-nearest rule will give the same floating-point value
+ * as would satisfaction of the stopping test with strict
+ * inequality.
+ * 4. We remove common factors of powers of 2 from relevant
+ * quantities.
+ * 5. When converting floating-point integers less than 1e16,
+ * we use floating-point arithmetic rather than resorting
+ * to multiple-precision integers.
+ * 6. When asked to produce fewer than 15 digits, we first try
+ * to get by with floating-point arithmetic; we resort to
+ * multiple-precision integer arithmetic only if we cannot
+ * guarantee that the floating-point calculation has given
+ * the correctly rounded result. For k requested digits and
+ * "uniformly" distributed input, the probability is
+ * something like 10^(k-15) that we must resort to the int32_t
+ * calculation.
+ *
+ * Note: 'leftright' translates to 'generate shortest possible string'.
+ */
+template<bool roundingNone, bool roundingSignificantFigures, bool roundingDecimalPlaces, bool leftright>
+void dtoa(DtoaBuffer result, double dd, int ndigits, bool& signOut, int& exponentOut, unsigned& precisionOut)
+{
+ // Exactly one rounding mode must be specified.
+ ASSERT(roundingNone + roundingSignificantFigures + roundingDecimalPlaces == 1);
+ // roundingNone only allowed (only sensible?) with leftright set.
+ ASSERT(!roundingNone || leftright);
+
+ ASSERT(!isnan(dd) && !isinf(dd));
+
+ int bbits, b2, b5, be, dig, i, ieps, ilim = 0, ilim0, ilim1 = 0,
+ j, j1, k, k0, k_check, m2, m5, s2, s5,
+ spec_case;
+ int32_t L;
+ int denorm;
+ uint32_t x;
+ BigInt b, delta, mlo, mhi, S;
+ U d2, eps, u;
+ double ds;
+ char* s;
+ char* s0;
+
+ u.d = dd;
+
+ /* Infinity or NaN */
+ ASSERT((word0(&u) & Exp_mask) != Exp_mask);
+
+ // JavaScript toString conversion treats -0 as 0.
+ if (!dval(&u)) {
+ signOut = false;
+ exponentOut = 0;
+ precisionOut = 1;
+ result[0] = '0';
+ result[1] = '\0';
+ return;
+ }
+
+ if (word0(&u) & Sign_bit) {
+ signOut = true;
+ word0(&u) &= ~Sign_bit; // clear sign bit
+ } else
+ signOut = false;
+
+ d2b(b, &u, &be, &bbits);
+ if ((i = (int)(word0(&u) >> Exp_shift1 & (Exp_mask >> Exp_shift1)))) {
+ dval(&d2) = dval(&u);
+ word0(&d2) &= Frac_mask1;
+ word0(&d2) |= Exp_11;
+
+ /* log(x) ~=~ log(1.5) + (x-1.5)/1.5
+ * log10(x) = log(x) / log(10)
+ * ~=~ log(1.5)/log(10) + (x-1.5)/(1.5*log(10))
+ * log10(d) = (i-Bias)*log(2)/log(10) + log10(d2)
+ *
+ * This suggests computing an approximation k to log10(d) by
+ *
+ * k = (i - Bias)*0.301029995663981
+ * + ( (d2-1.5)*0.289529654602168 + 0.176091259055681 );
+ *
+ * We want k to be too large rather than too small.
+ * The error in the first-order Taylor series approximation
+ * is in our favor, so we just round up the constant enough
+ * to compensate for any error in the multiplication of
+ * (i - Bias) by 0.301029995663981; since |i - Bias| <= 1077,
+ * and 1077 * 0.30103 * 2^-52 ~=~ 7.2e-14,
+ * adding 1e-13 to the constant term more than suffices.
+ * Hence we adjust the constant term to 0.1760912590558.
+ * (We could get a more accurate k by invoking log10,
+ * but this is probably not worthwhile.)
+ */
+
+ i -= Bias;
+ denorm = 0;
+ } else {
+ /* d is denormalized */
+
+ i = bbits + be + (Bias + (P - 1) - 1);
+ x = (i > 32) ? (word0(&u) << (64 - i)) | (word1(&u) >> (i - 32))
+ : word1(&u) << (32 - i);
+ dval(&d2) = x;
+ word0(&d2) -= 31 * Exp_msk1; /* adjust exponent */
+ i -= (Bias + (P - 1) - 1) + 1;
+ denorm = 1;
+ }
+ ds = (dval(&d2) - 1.5) * 0.289529654602168 + 0.1760912590558 + (i * 0.301029995663981);
+ k = (int)ds;
+ if (ds < 0. && ds != k)
+ k--; /* want k = floor(ds) */
+ k_check = 1;
+ if (k >= 0 && k <= Ten_pmax) {
+ if (dval(&u) < tens[k])
+ k--;
+ k_check = 0;
+ }
+ j = bbits - i - 1;
+ if (j >= 0) {
+ b2 = 0;
+ s2 = j;
+ } else {
+ b2 = -j;
+ s2 = 0;
+ }
+ if (k >= 0) {
+ b5 = 0;
+ s5 = k;
+ s2 += k;
+ } else {
+ b2 -= k;
+ b5 = -k;
+ s5 = 0;
+ }
+
+ if (roundingNone) {
+ ilim = ilim1 = -1;
+ i = 18;
+ ndigits = 0;
+ }
+ if (roundingSignificantFigures) {
+ if (ndigits <= 0)
+ ndigits = 1;
+ ilim = ilim1 = i = ndigits;
+ }
+ if (roundingDecimalPlaces) {
+ i = ndigits + k + 1;
+ ilim = i;
+ ilim1 = i - 1;
+ if (i <= 0)
+ i = 1;
+ }
+
+ s = s0 = result;
+
+ if (ilim >= 0 && ilim <= Quick_max) {
+ /* Try to get by with floating-point arithmetic. */
+
+ i = 0;
+ dval(&d2) = dval(&u);
+ k0 = k;
+ ilim0 = ilim;
+ ieps = 2; /* conservative */
+ if (k > 0) {
+ ds = tens[k & 0xf];
+ j = k >> 4;
+ if (j & Bletch) {
+ /* prevent overflows */
+ j &= Bletch - 1;
+ dval(&u) /= bigtens[n_bigtens - 1];
+ ieps++;
+ }
+ for (; j; j >>= 1, i++) {
+ if (j & 1) {
+ ieps++;
+ ds *= bigtens[i];
+ }
+ }
+ dval(&u) /= ds;
+ } else if ((j1 = -k)) {
+ dval(&u) *= tens[j1 & 0xf];
+ for (j = j1 >> 4; j; j >>= 1, i++) {
+ if (j & 1) {
+ ieps++;
+ dval(&u) *= bigtens[i];
+ }
+ }
+ }
+ if (k_check && dval(&u) < 1. && ilim > 0) {
+ if (ilim1 <= 0)
+ goto fastFailed;
+ ilim = ilim1;
+ k--;
+ dval(&u) *= 10.;
+ ieps++;
+ }
+ dval(&eps) = (ieps * dval(&u)) + 7.;
+ word0(&eps) -= (P - 1) * Exp_msk1;
+ if (!ilim) {
+ S.clear();
+ mhi.clear();
+ dval(&u) -= 5.;
+ if (dval(&u) > dval(&eps))
+ goto oneDigit;
+ if (dval(&u) < -dval(&eps))
+ goto noDigits;
+ goto fastFailed;
+ }
+ if (leftright) {
+ /* Use Steele & White method of only
+ * generating digits needed.
+ */
+ dval(&eps) = (0.5 / tens[ilim - 1]) - dval(&eps);
+ for (i = 0;;) {
+ L = (long int)dval(&u);
+ dval(&u) -= L;
+ *s++ = '0' + (int)L;
+ if (dval(&u) < dval(&eps))
+ goto ret;
+ if (1. - dval(&u) < dval(&eps))
+ goto bumpUp;
+ if (++i >= ilim)
+ break;
+ dval(&eps) *= 10.;
+ dval(&u) *= 10.;
+ }
+ } else {
+ /* Generate ilim digits, then fix them up. */
+ dval(&eps) *= tens[ilim - 1];
+ for (i = 1;; i++, dval(&u) *= 10.) {
+ L = (int32_t)(dval(&u));
+ if (!(dval(&u) -= L))
+ ilim = i;
+ *s++ = '0' + (int)L;
+ if (i == ilim) {
+ if (dval(&u) > 0.5 + dval(&eps))
+ goto bumpUp;
+ if (dval(&u) < 0.5 - dval(&eps)) {
+ while (*--s == '0') { }
+ s++;
+ goto ret;
+ }
+ break;
+ }
+ }
+ }
+fastFailed:
+ s = s0;
+ dval(&u) = dval(&d2);
+ k = k0;
+ ilim = ilim0;
+ }
+
+ /* Do we have a "small" integer? */
+
+ if (be >= 0 && k <= Int_max) {
+ /* Yes. */
+ ds = tens[k];
+ if (ndigits < 0 && ilim <= 0) {
+ S.clear();
+ mhi.clear();
+ if (ilim < 0 || dval(&u) <= 5 * ds)
+ goto noDigits;
+ goto oneDigit;
+ }
+ for (i = 1;; i++, dval(&u) *= 10.) {
+ L = (int32_t)(dval(&u) / ds);
+ dval(&u) -= L * ds;
+ *s++ = '0' + (int)L;
+ if (!dval(&u)) {
+ break;
+ }
+ if (i == ilim) {
+ dval(&u) += dval(&u);
+ if (dval(&u) > ds || (dval(&u) == ds && (L & 1))) {
+bumpUp:
+ while (*--s == '9')
+ if (s == s0) {
+ k++;
+ *s = '0';
+ break;
+ }
+ ++*s++;
+ }
+ break;
+ }
+ }
+ goto ret;
+ }
+
+ m2 = b2;
+ m5 = b5;
+ mhi.clear();
+ mlo.clear();
+ if (leftright) {
+ i = denorm ? be + (Bias + (P - 1) - 1 + 1) : 1 + P - bbits;
+ b2 += i;
+ s2 += i;
+ i2b(mhi, 1);
+ }
+ if (m2 > 0 && s2 > 0) {
+ i = m2 < s2 ? m2 : s2;
+ b2 -= i;
+ m2 -= i;
+ s2 -= i;
+ }
+ if (b5 > 0) {
+ if (leftright) {
+ if (m5 > 0) {
+ pow5mult(mhi, m5);
+ mult(b, mhi);
+ }
+ if ((j = b5 - m5))
+ pow5mult(b, j);
+ } else
+ pow5mult(b, b5);
+ }
+ i2b(S, 1);
+ if (s5 > 0)
+ pow5mult(S, s5);
+
+ /* Check for special case that d is a normalized power of 2. */
+
+ spec_case = 0;
+ if ((roundingNone || leftright) && (!word1(&u) && !(word0(&u) & Bndry_mask) && word0(&u) & (Exp_mask & ~Exp_msk1))) {
+ /* The special case */
+ b2 += Log2P;
+ s2 += Log2P;
+ spec_case = 1;
+ }
+
+ /* Arrange for convenient computation of quotients:
+ * shift left if necessary so divisor has 4 leading 0 bits.
+ *
+ * Perhaps we should just compute leading 28 bits of S once
+ * and for all and pass them and a shift to quorem, so it
+ * can do shifts and ors to compute the numerator for q.
+ */
+ if ((i = ((s5 ? 32 - hi0bits(S.words()[S.size() - 1]) : 1) + s2) & 0x1f))
+ i = 32 - i;
+ if (i > 4) {
+ i -= 4;
+ b2 += i;
+ m2 += i;
+ s2 += i;
+ } else if (i < 4) {
+ i += 28;
+ b2 += i;
+ m2 += i;
+ s2 += i;
+ }
+ if (b2 > 0)
+ lshift(b, b2);
+ if (s2 > 0)
+ lshift(S, s2);
+ if (k_check) {
+ if (cmp(b, S) < 0) {
+ k--;
+ multadd(b, 10, 0); /* we botched the k estimate */
+ if (leftright)
+ multadd(mhi, 10, 0);
+ ilim = ilim1;
+ }
+ }
+ if (ilim <= 0 && roundingDecimalPlaces) {
+ if (ilim < 0)
+ goto noDigits;
+ multadd(S, 5, 0);
+ // For IEEE-754 unbiased rounding this check should be <=, such that 0.5 would flush to zero.
+ if (cmp(b, S) < 0)
+ goto noDigits;
+ goto oneDigit;
+ }
+ if (leftright) {
+ if (m2 > 0)
+ lshift(mhi, m2);
+
+ /* Compute mlo -- check for special case
+ * that d is a normalized power of 2.
+ */
+
+ mlo = mhi;
+ if (spec_case)
+ lshift(mhi, Log2P);
+
+ for (i = 1;;i++) {
+ dig = quorem(b, S) + '0';
+ /* Do we yet have the shortest decimal string
+ * that will round to d?
+ */
+ j = cmp(b, mlo);
+ diff(delta, S, mhi);
+ j1 = delta.sign ? 1 : cmp(b, delta);
+#ifdef DTOA_ROUND_BIASED
+ if (j < 0 || !j) {
+#else
+ // FIXME: ECMA-262 specifies that equidistant results round away from
+ // zero, which probably means we shouldn't be on the unbiased code path
+ // (the (word1(&u) & 1) clause is looking highly suspicious). I haven't
+ // yet understood this code well enough to make the call, but we should
+ // probably be enabling DTOA_ROUND_BIASED. I think the interesting corner
+ // case to understand is probably "Math.pow(0.5, 24).toString()".
+ // I believe this value is interesting because I think it is precisely
+ // representable in binary floating point, and its decimal representation
+ // has a single digit that Steele & White reduction can remove, with the
+ // value 5 (thus equidistant from the next numbers above and below).
+ // We produce the correct answer using either codepath, and I don't as
+ // yet understand why. :-)
+ if (!j1 && !(word1(&u) & 1)) {
+ if (dig == '9')
+ goto round9up;
+ if (j > 0)
+ dig++;
+ *s++ = dig;
+ goto ret;
+ }
+ if (j < 0 || (!j && !(word1(&u) & 1))) {
+#endif
+ if ((b.words()[0] || b.size() > 1) && (j1 > 0)) {
+ lshift(b, 1);
+ j1 = cmp(b, S);
+ // For IEEE-754 round-to-even, this check should be (j1 > 0 || (!j1 && (dig & 1))),
+ // but ECMA-262 specifies that equidistant values (e.g. (.5).toFixed()) should
+ // be rounded away from zero.
+ if (j1 >= 0) {
+ if (dig == '9')
+ goto round9up;
+ dig++;
+ }
+ }
+ *s++ = dig;
+ goto ret;
+ }
+ if (j1 > 0) {
+ if (dig == '9') { /* possible if i == 1 */
+round9up:
+ *s++ = '9';
+ goto roundoff;
+ }
+ *s++ = dig + 1;
+ goto ret;
+ }
+ *s++ = dig;
+ if (i == ilim)
+ break;
+ multadd(b, 10, 0);
+ multadd(mlo, 10, 0);
+ multadd(mhi, 10, 0);
+ }
+ } else {
+ for (i = 1;; i++) {
+ *s++ = dig = quorem(b, S) + '0';
+ if (!b.words()[0] && b.size() <= 1)
+ goto ret;
+ if (i >= ilim)
+ break;
+ multadd(b, 10, 0);
+ }
+ }
+
+ /* Round off last digit */
+
+ lshift(b, 1);
+ j = cmp(b, S);
+ // For IEEE-754 round-to-even, this check should be (j > 0 || (!j && (dig & 1))),
+ // but ECMA-262 specifies that equidistant values (e.g. (.5).toFixed()) should
+ // be rounded away from zero.
+ if (j >= 0) {
+roundoff:
+ while (*--s == '9')
+ if (s == s0) {
+ k++;
+ *s++ = '1';
+ goto ret;
+ }
+ ++*s++;
+ } else {
+ while (*--s == '0') { }
+ s++;
+ }
+ goto ret;
+noDigits:
+ exponentOut = 0;
+ precisionOut = 1;
+ result[0] = '0';
+ result[1] = '\0';
+ return;
+oneDigit:
+ *s++ = '1';
+ k++;
+ goto ret;
+ret:
+ ASSERT(s > result);
+ *s = 0;
+ exponentOut = k;
+ precisionOut = s - result;
+}
+
+void dtoa(DtoaBuffer result, double dd, bool& sign, int& exponent, unsigned& precision)
+{
+ // flags are roundingNone, leftright.
+ dtoa<true, false, false, true>(result, dd, 0, sign, exponent, precision);
+}
+
+void dtoaRoundSF(DtoaBuffer result, double dd, int ndigits, bool& sign, int& exponent, unsigned& precision)
+{
+ // flag is roundingSignificantFigures.
+ dtoa<false, true, false, false>(result, dd, ndigits, sign, exponent, precision);
+}
+
+void dtoaRoundDP(DtoaBuffer result, double dd, int ndigits, bool& sign, int& exponent, unsigned& precision)
+{
+ // flag is roundingDecimalPlaces.
+ dtoa<false, false, true, false>(result, dd, ndigits, sign, exponent, precision);
+}
+
+static ALWAYS_INLINE void copyAsciiToUTF16(UChar* next, const char* src, unsigned size)
+{
+ for (unsigned i = 0; i < size; ++i)
+ *next++ = *src++;
+}
+
+unsigned numberToString(double d, NumberToStringBuffer buffer)
+{
+ // Handle NaN and Infinity.
+ if (isnan(d) || isinf(d)) {
+ if (isnan(d)) {
+ copyAsciiToUTF16(buffer, "NaN", 3);
+ return 3;
+ }
+ if (d > 0) {
+ copyAsciiToUTF16(buffer, "Infinity", 8);
+ return 8;
+ }
+ copyAsciiToUTF16(buffer, "-Infinity", 9);
+ return 9;
+ }
+
+ // Convert to decimal with rounding.
+ DecimalNumber number(d);
+ return number.exponent() >= -6 && number.exponent() < 21
+ ? number.toStringDecimal(buffer, NumberToStringBufferLength)
+ : number.toStringExponential(buffer, NumberToStringBufferLength);
+}
+
+} // namespace WTF
diff --git a/Source/JavaScriptCore/wtf/dtoa.h b/Source/JavaScriptCore/wtf/dtoa.h
new file mode 100644
index 0000000..3924a1c
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/dtoa.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2003, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef WTF_dtoa_h
+#define WTF_dtoa_h
+
+#include <wtf/unicode/Unicode.h>
+
+namespace WTF {
+class Mutex;
+
+extern WTF::Mutex* s_dtoaP5Mutex;
+
+// s00: input string. Must not be 0 and must be terminated by 0.
+// se: *se will have the last consumed character position + 1.
+double strtod(const char* s00, char** se);
+
+typedef char DtoaBuffer[80];
+
+void dtoa(DtoaBuffer result, double dd, bool& sign, int& exponent, unsigned& precision);
+void dtoaRoundSF(DtoaBuffer result, double dd, int ndigits, bool& sign, int& exponent, unsigned& precision);
+void dtoaRoundDP(DtoaBuffer result, double dd, int ndigits, bool& sign, int& exponent, unsigned& precision);
+
+// Size = 80 for sizeof(DtoaBuffer) + some sign bits, decimal point, 'e', exponent digits.
+const unsigned NumberToStringBufferLength = 96;
+typedef UChar NumberToStringBuffer[NumberToStringBufferLength];
+unsigned numberToString(double, NumberToStringBuffer);
+
+} // namespace WTF
+
+using WTF::NumberToStringBuffer;
+using WTF::numberToString;
+
+#endif // WTF_dtoa_h
diff --git a/Source/JavaScriptCore/wtf/efl/MainThreadEfl.cpp b/Source/JavaScriptCore/wtf/efl/MainThreadEfl.cpp
new file mode 100644
index 0000000..8774d20
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/efl/MainThreadEfl.cpp
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2007 Justin Haygood (jhaygood@reaktix.com)
+ * Copyright (C) 2008 Diego Gonzalez
+ * Copyright (C) 2008 Kenneth Rohde Christiansen
+ * Copyright (C) 2009-2010 ProFUSION embedded systems
+ * Copyright (C) 2009-2010 Samsung Electronics
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "MainThread.h"
+
+#include <Ecore.h>
+
+namespace WTF {
+
+void initializeMainThreadPlatform()
+{
+}
+
+static Eina_Bool timeoutFired(void*)
+{
+ dispatchFunctionsFromMainThread();
+ return ECORE_CALLBACK_CANCEL;
+}
+
+void scheduleDispatchFunctionsOnMainThread()
+{
+ ecore_timer_add(0, timeoutFired, 0);
+}
+
+
+}
diff --git a/Source/JavaScriptCore/wtf/gobject/GOwnPtr.cpp b/Source/JavaScriptCore/wtf/gobject/GOwnPtr.cpp
new file mode 100644
index 0000000..8dcfb9e
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/gobject/GOwnPtr.cpp
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2008 Collabora Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "config.h"
+#include "GOwnPtr.h"
+
+#if ENABLE(GLIB_SUPPORT)
+
+#include <gio/gio.h>
+#include <glib.h>
+
+namespace WTF {
+
+template <> void freeOwnedGPtr<GError>(GError* ptr)
+{
+ if (ptr)
+ g_error_free(ptr);
+}
+
+template <> void freeOwnedGPtr<GList>(GList* ptr)
+{
+ g_list_free(ptr);
+}
+
+template <> void freeOwnedGPtr<GCond>(GCond* ptr)
+{
+ if (ptr)
+ g_cond_free(ptr);
+}
+
+template <> void freeOwnedGPtr<GMutex>(GMutex* ptr)
+{
+ if (ptr)
+ g_mutex_free(ptr);
+}
+
+template <> void freeOwnedGPtr<GPatternSpec>(GPatternSpec* ptr)
+{
+ if (ptr)
+ g_pattern_spec_free(ptr);
+}
+
+template <> void freeOwnedGPtr<GDir>(GDir* ptr)
+{
+ if (ptr)
+ g_dir_close(ptr);
+}
+
+template <> void freeOwnedGPtr<GFile>(GFile* ptr)
+{
+ if (ptr)
+ g_object_unref(ptr);
+}
+} // namespace WTF
+
+#endif // ENABLE(GLIB_SUPPORT)
diff --git a/Source/JavaScriptCore/wtf/gobject/GOwnPtr.h b/Source/JavaScriptCore/wtf/gobject/GOwnPtr.h
new file mode 100644
index 0000000..cec3e43
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/gobject/GOwnPtr.h
@@ -0,0 +1,143 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2008 Collabora Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef GOwnPtr_h
+#define GOwnPtr_h
+
+#if ENABLE(GLIB_SUPPORT)
+
+#include <algorithm>
+#include <wtf/Assertions.h>
+#include <wtf/Noncopyable.h>
+
+extern "C" void g_free(void*);
+
+namespace WTF {
+
+template <typename T> inline void freeOwnedGPtr(T* ptr);
+template<> void freeOwnedGPtr<GError>(GError*);
+template<> void freeOwnedGPtr<GList>(GList*);
+template<> void freeOwnedGPtr<GCond>(GCond*);
+template<> void freeOwnedGPtr<GMutex>(GMutex*);
+template<> void freeOwnedGPtr<GPatternSpec>(GPatternSpec*);
+template<> void freeOwnedGPtr<GDir>(GDir*);
+template<> void freeOwnedGPtr<GFile>(GFile*);
+
+template <typename T> class GOwnPtr : public Noncopyable {
+public:
+ explicit GOwnPtr(T* ptr = 0) : m_ptr(ptr) { }
+ ~GOwnPtr() { freeOwnedGPtr(m_ptr); }
+
+ T* get() const { return m_ptr; }
+ T* release()
+ {
+ T* ptr = m_ptr;
+ m_ptr = 0;
+ return ptr;
+ }
+
+ T*& outPtr()
+ {
+ ASSERT(!m_ptr);
+ return m_ptr;
+ }
+
+ void set(T* ptr)
+ {
+ ASSERT(!ptr || m_ptr != ptr);
+ freeOwnedGPtr(m_ptr);
+ m_ptr = ptr;
+ }
+
+ void clear()
+ {
+ T* ptr = m_ptr;
+ m_ptr = 0;
+ freeOwnedGPtr(ptr);
+ }
+
+ T& operator*() const
+ {
+ ASSERT(m_ptr);
+ return *m_ptr;
+ }
+
+ T* operator->() const
+ {
+ ASSERT(m_ptr);
+ return m_ptr;
+ }
+
+ bool operator!() const { return !m_ptr; }
+
+ // This conversion operator allows implicit conversion to bool but not to other integer types.
+ typedef T* GOwnPtr::*UnspecifiedBoolType;
+ operator UnspecifiedBoolType() const { return m_ptr ? &GOwnPtr::m_ptr : 0; }
+
+ void swap(GOwnPtr& o) { std::swap(m_ptr, o.m_ptr); }
+
+private:
+ T* m_ptr;
+};
+
+template <typename T> inline void swap(GOwnPtr<T>& a, GOwnPtr<T>& b)
+{
+ a.swap(b);
+}
+
+template <typename T, typename U> inline bool operator==(const GOwnPtr<T>& a, U* b)
+{
+ return a.get() == b;
+}
+
+template <typename T, typename U> inline bool operator==(T* a, const GOwnPtr<U>& b)
+{
+ return a == b.get();
+}
+
+template <typename T, typename U> inline bool operator!=(const GOwnPtr<T>& a, U* b)
+{
+ return a.get() != b;
+}
+
+template <typename T, typename U> inline bool operator!=(T* a, const GOwnPtr<U>& b)
+{
+ return a != b.get();
+}
+
+template <typename T> inline typename GOwnPtr<T>::PtrType getPtr(const GOwnPtr<T>& p)
+{
+ return p.get();
+}
+
+template <typename T> inline void freeOwnedGPtr(T* ptr)
+{
+ g_free(ptr);
+}
+
+} // namespace WTF
+
+using WTF::GOwnPtr;
+
+#endif // ENABLE(GLIB_SUPPORT)
+
+#endif // GOwnPtr_h
+
diff --git a/Source/JavaScriptCore/wtf/gobject/GRefPtr.cpp b/Source/JavaScriptCore/wtf/gobject/GRefPtr.cpp
new file mode 100644
index 0000000..1cd22c5
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/gobject/GRefPtr.cpp
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2009 Martin Robinson
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "config.h"
+#include "GRefPtr.h"
+
+#if ENABLE(GLIB_SUPPORT)
+
+#include <glib.h>
+
+namespace WTF {
+
+template <> GHashTable* refGPtr(GHashTable* ptr)
+{
+ if (ptr)
+ g_hash_table_ref(ptr);
+ return ptr;
+}
+
+template <> void derefGPtr(GHashTable* ptr)
+{
+ g_hash_table_unref(ptr);
+}
+
+#if GLIB_CHECK_VERSION(2, 24, 0)
+template <> GVariant* refGPtr(GVariant* ptr)
+{
+ if (ptr)
+ g_variant_ref(ptr);
+ return ptr;
+}
+
+template <> void derefGPtr(GVariant* ptr)
+{
+ g_variant_unref(ptr);
+}
+
+#else
+
+// We do this so that we can avoid including the glib.h header in GRefPtr.h.
+typedef struct _GVariant {
+ bool fake;
+} GVariant;
+
+template <> GVariant* refGPtr(GVariant* ptr)
+{
+ return ptr;
+}
+
+template <> void derefGPtr(GVariant* ptr)
+{
+}
+
+#endif
+
+template <> GSource* refGPtr(GSource* ptr)
+{
+ if (ptr)
+ g_source_ref(ptr);
+ return ptr;
+}
+
+template <> void derefGPtr(GSource* ptr)
+{
+ if (ptr)
+ g_source_unref(ptr);
+}
+
+} // namespace WTF
+
+#endif // ENABLE(GLIB_SUPPORT)
diff --git a/Source/JavaScriptCore/wtf/gobject/GRefPtr.h b/Source/JavaScriptCore/wtf/gobject/GRefPtr.h
new file mode 100644
index 0000000..10ebf07
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/gobject/GRefPtr.h
@@ -0,0 +1,229 @@
+/*
+ * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2008 Collabora Ltd.
+ * Copyright (C) 2009 Martin Robinson
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef WTF_GRefPtr_h
+#define WTF_GRefPtr_h
+
+#if ENABLE(GLIB_SUPPORT)
+
+#include "AlwaysInline.h"
+#include "GRefPtr.h"
+#include "RefPtr.h"
+#include <algorithm>
+
+extern "C" void g_object_unref(gpointer);
+extern "C" gpointer g_object_ref_sink(gpointer);
+
+namespace WTF {
+
+enum GRefPtrAdoptType { GRefPtrAdopt };
+template <typename T> inline T* refGPtr(T*);
+template <typename T> inline void derefGPtr(T*);
+template <typename T> class GRefPtr;
+template <typename T> GRefPtr<T> adoptGRef(T*);
+
+template <typename T> class GRefPtr {
+public:
+ GRefPtr() : m_ptr(0) { }
+
+ GRefPtr(T* ptr)
+ : m_ptr(ptr)
+ {
+ if (ptr)
+ refGPtr(ptr);
+ }
+
+ GRefPtr(const GRefPtr& o)
+ : m_ptr(o.m_ptr)
+ {
+ if (T* ptr = m_ptr)
+ refGPtr(ptr);
+ }
+
+ template <typename U> GRefPtr(const GRefPtr<U>& o)
+ : m_ptr(o.get())
+ {
+ if (T* ptr = m_ptr)
+ refGPtr(ptr);
+ }
+
+ ~GRefPtr()
+ {
+ if (T* ptr = m_ptr)
+ derefGPtr(ptr);
+ }
+
+ void clear()
+ {
+ T* ptr = m_ptr;
+ m_ptr = 0;
+ if (ptr)
+ derefGPtr(ptr);
+ }
+
+ T* leakRef() WARN_UNUSED_RETURN
+ {
+ T* ptr = m_ptr;
+ m_ptr = 0;
+ return ptr;
+ }
+
+ // Hash table deleted values, which are only constructed and never copied or destroyed.
+ GRefPtr(HashTableDeletedValueType) : m_ptr(hashTableDeletedValue()) { }
+ bool isHashTableDeletedValue() const { return m_ptr == hashTableDeletedValue(); }
+
+ T* get() const { return m_ptr; }
+ T& operator*() const { return *m_ptr; }
+ ALWAYS_INLINE T* operator->() const { return m_ptr; }
+
+ bool operator!() const { return !m_ptr; }
+
+ // This conversion operator allows implicit conversion to bool but not to other integer types.
+ typedef T* GRefPtr::*UnspecifiedBoolType;
+ operator UnspecifiedBoolType() const { return m_ptr ? &GRefPtr::m_ptr : 0; }
+
+ GRefPtr& operator=(const GRefPtr&);
+ GRefPtr& operator=(T*);
+ template <typename U> GRefPtr& operator=(const GRefPtr<U>&);
+
+ void swap(GRefPtr&);
+ friend GRefPtr adoptGRef<T>(T*);
+
+private:
+ static T* hashTableDeletedValue() { return reinterpret_cast<T*>(-1); }
+ // Adopting constructor.
+ GRefPtr(T* ptr, GRefPtrAdoptType) : m_ptr(ptr) {}
+
+ T* m_ptr;
+};
+
+template <typename T> inline GRefPtr<T>& GRefPtr<T>::operator=(const GRefPtr<T>& o)
+{
+ T* optr = o.get();
+ if (optr)
+ refGPtr(optr);
+ T* ptr = m_ptr;
+ m_ptr = optr;
+ if (ptr)
+ derefGPtr(ptr);
+ return *this;
+}
+
+template <typename T> inline GRefPtr<T>& GRefPtr<T>::operator=(T* optr)
+{
+ T* ptr = m_ptr;
+ if (optr)
+ refGPtr(optr);
+ m_ptr = optr;
+ if (ptr)
+ derefGPtr(ptr);
+ return *this;
+}
+
+template <class T> inline void GRefPtr<T>::swap(GRefPtr<T>& o)
+{
+ std::swap(m_ptr, o.m_ptr);
+}
+
+template <class T> inline void swap(GRefPtr<T>& a, GRefPtr<T>& b)
+{
+ a.swap(b);
+}
+
+template <typename T, typename U> inline bool operator==(const GRefPtr<T>& a, const GRefPtr<U>& b)
+{
+ return a.get() == b.get();
+}
+
+template <typename T, typename U> inline bool operator==(const GRefPtr<T>& a, U* b)
+{
+ return a.get() == b;
+}
+
+template <typename T, typename U> inline bool operator==(T* a, const GRefPtr<U>& b)
+{
+ return a == b.get();
+}
+
+template <typename T, typename U> inline bool operator!=(const GRefPtr<T>& a, const GRefPtr<U>& b)
+{
+ return a.get() != b.get();
+}
+
+template <typename T, typename U> inline bool operator!=(const GRefPtr<T>& a, U* b)
+{
+ return a.get() != b;
+}
+
+template <typename T, typename U> inline bool operator!=(T* a, const GRefPtr<U>& b)
+{
+ return a != b.get();
+}
+
+template <typename T, typename U> inline GRefPtr<T> static_pointer_cast(const GRefPtr<U>& p)
+{
+ return GRefPtr<T>(static_cast<T*>(p.get()));
+}
+
+template <typename T, typename U> inline GRefPtr<T> const_pointer_cast(const GRefPtr<U>& p)
+{
+ return GRefPtr<T>(const_cast<T*>(p.get()));
+}
+
+template <typename T> inline T* getPtr(const GRefPtr<T>& p)
+{
+ return p.get();
+}
+
+template <typename T> GRefPtr<T> adoptGRef(T* p)
+{
+ return GRefPtr<T>(p, GRefPtrAdopt);
+}
+
+template <> GHashTable* refGPtr(GHashTable* ptr);
+template <> void derefGPtr(GHashTable* ptr);
+template <> GVariant* refGPtr(GVariant* ptr);
+template <> void derefGPtr(GVariant* ptr);
+template <> GSource* refGPtr(GSource* ptr);
+template <> void derefGPtr(GSource* ptr);
+
+template <typename T> inline T* refGPtr(T* ptr)
+{
+ if (ptr)
+ g_object_ref_sink(ptr);
+ return ptr;
+}
+
+template <typename T> inline void derefGPtr(T* ptr)
+{
+ if (ptr)
+ g_object_unref(ptr);
+}
+
+} // namespace WTF
+
+using WTF::GRefPtr;
+using WTF::adoptGRef;
+
+#endif // ENABLE(GLIB_SUPPORT)
+
+#endif // WTF_GRefPtr_h
diff --git a/Source/JavaScriptCore/wtf/gobject/GTypedefs.h b/Source/JavaScriptCore/wtf/gobject/GTypedefs.h
new file mode 100644
index 0000000..f9f8f2f
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/gobject/GTypedefs.h
@@ -0,0 +1,98 @@
+/*
+ * Copyright (C) 2010 Igalia, S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef GtkTypedefs_h
+#define GtkTypedefs_h
+
+/* Vanilla C code does not seem to be able to handle forward-declaration typedefs. */
+#ifdef __cplusplus
+
+typedef char gchar;
+typedef double gdouble;
+typedef float gfloat;
+typedef int gint;
+typedef gint gboolean;
+typedef long glong;
+typedef short gshort;
+typedef unsigned char guchar;
+typedef unsigned int guint;
+typedef unsigned long gulong;
+typedef unsigned short gushort;
+typedef void* gpointer;
+
+typedef struct _GAsyncResult GAsyncResult;
+typedef struct _GCancellable GCancellable;
+typedef struct _GCharsetConverter GCharsetConverter;
+typedef struct _GCond GCond;
+typedef struct _GDir GDir;
+typedef struct _GdkAtom* GdkAtom;
+typedef struct _GdkCursor GdkCursor;
+typedef struct _GdkDragContext GdkDragContext;
+typedef struct _GdkEventConfigure GdkEventConfigure;
+typedef struct _GdkEventExpose GdkEventExpose;
+typedef struct _GdkPixbuf GdkPixbuf;
+typedef struct _GError GError;
+typedef struct _GFile GFile;
+typedef struct _GHashTable GHashTable;
+typedef struct _GInputStream GInputStream;
+typedef struct _GList GList;
+typedef struct _GMutex GMutex;
+typedef struct _GOutputStream GOutputStream;
+typedef struct _GPatternSpec GPatternSpec;
+typedef struct _GSocketClient GSocketClient;
+typedef struct _GSocketConnection GSocketConnection;
+typedef struct _GSource GSource;
+typedef struct _GVariant GVariant;
+typedef union _GdkEvent GdkEvent;
+
+#if PLATFORM(CAIRO)
+typedef struct _cairo_surface cairo_surface_t;
+#endif
+
+#if PLATFORM(GTK)
+typedef struct _GtkAction GtkAction;
+typedef struct _GtkAdjustment GtkAdjustment;
+typedef struct _GtkBorder GtkBorder;
+typedef struct _GtkClipboard GtkClipboard;
+typedef struct _GtkContainer GtkContainer;
+typedef struct _GtkIconInfo GtkIconInfo;
+typedef struct _GtkMenu GtkMenu;
+typedef struct _GtkMenuItem GtkMenuItem;
+typedef struct _GtkObject GtkObject;
+typedef struct _GtkSelectionData GtkSelectionData;
+typedef struct _GtkStyle GtkStyle;
+typedef struct _GtkTargetList GtkTargetList;
+typedef struct _GtkThemeParts GtkThemeParts;
+typedef struct _GtkWidget GtkWidget;
+typedef struct _GtkWindow GtkWindow;
+
+#ifdef GTK_API_VERSION_2
+typedef struct _GdkRectangle GdkRectangle;
+typedef struct _GdkDrawable GdkWindow;
+#else
+typedef struct _GdkWindow GdkWindow;
+typedef struct _cairo_rectangle_int cairo_rectangle_int_t;
+typedef cairo_rectangle_int_t GdkRectangle;
+typedef struct _GtkStyleContext GtkStyleContext;
+#endif
+
+#endif
+
+#endif
+#endif /* GtkTypedefs_h */
diff --git a/Source/JavaScriptCore/wtf/gtk/MainThreadGtk.cpp b/Source/JavaScriptCore/wtf/gtk/MainThreadGtk.cpp
new file mode 100644
index 0000000..7624247
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/gtk/MainThreadGtk.cpp
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2007 Justin Haygood (jhaygood@reaktix.com)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "MainThread.h"
+
+#include <glib.h>
+
+namespace WTF {
+
+void initializeMainThreadPlatform()
+{
+}
+
+static gboolean timeoutFired(gpointer)
+{
+ dispatchFunctionsFromMainThread();
+ return FALSE;
+}
+
+void scheduleDispatchFunctionsOnMainThread()
+{
+ g_timeout_add(0, timeoutFired, 0);
+}
+
+} // namespace WTF
diff --git a/Source/JavaScriptCore/wtf/gtk/ThreadingGtk.cpp b/Source/JavaScriptCore/wtf/gtk/ThreadingGtk.cpp
new file mode 100644
index 0000000..863ee81
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/gtk/ThreadingGtk.cpp
@@ -0,0 +1,248 @@
+/*
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2007 Justin Haygood (jhaygood@reaktix.com)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "Threading.h"
+
+#if !USE(PTHREADS)
+
+#include "CurrentTime.h"
+#include "HashMap.h"
+#include "MainThread.h"
+#include "RandomNumberSeed.h"
+#include <wtf/StdLibExtras.h>
+
+#include <glib.h>
+#include <limits.h>
+
+namespace WTF {
+
+typedef HashMap<ThreadIdentifier, GThread*> ThreadMap;
+
+static Mutex* atomicallyInitializedStaticMutex;
+
+static Mutex& threadMapMutex()
+{
+ DEFINE_STATIC_LOCAL(Mutex, mutex, ());
+ return mutex;
+}
+
+void initializeThreading()
+{
+ if (!g_thread_supported())
+ g_thread_init(NULL);
+ ASSERT(g_thread_supported());
+
+ if (!atomicallyInitializedStaticMutex) {
+ atomicallyInitializedStaticMutex = new Mutex;
+ threadMapMutex();
+ initializeRandomNumberGenerator();
+ }
+}
+
+void lockAtomicallyInitializedStaticMutex()
+{
+ ASSERT(atomicallyInitializedStaticMutex);
+ atomicallyInitializedStaticMutex->lock();
+}
+
+void unlockAtomicallyInitializedStaticMutex()
+{
+ atomicallyInitializedStaticMutex->unlock();
+}
+
+static ThreadMap& threadMap()
+{
+ DEFINE_STATIC_LOCAL(ThreadMap, map, ());
+ return map;
+}
+
+static ThreadIdentifier identifierByGthreadHandle(GThread*& thread)
+{
+ MutexLocker locker(threadMapMutex());
+
+ ThreadMap::iterator i = threadMap().begin();
+ for (; i != threadMap().end(); ++i) {
+ if (i->second == thread)
+ return i->first;
+ }
+
+ return 0;
+}
+
+static ThreadIdentifier establishIdentifierForThread(GThread*& thread)
+{
+ ASSERT(!identifierByGthreadHandle(thread));
+
+ MutexLocker locker(threadMapMutex());
+
+ static ThreadIdentifier identifierCount = 1;
+
+ threadMap().add(identifierCount, thread);
+
+ return identifierCount++;
+}
+
+static GThread* threadForIdentifier(ThreadIdentifier id)
+{
+ MutexLocker locker(threadMapMutex());
+
+ return threadMap().get(id);
+}
+
+static void clearThreadForIdentifier(ThreadIdentifier id)
+{
+ MutexLocker locker(threadMapMutex());
+
+ ASSERT(threadMap().contains(id));
+
+ threadMap().remove(id);
+}
+
+ThreadIdentifier createThreadInternal(ThreadFunction entryPoint, void* data, const char*)
+{
+ GThread* thread;
+ if (!(thread = g_thread_create(entryPoint, data, TRUE, 0))) {
+ LOG_ERROR("Failed to create thread at entry point %p with data %p", entryPoint, data);
+ return 0;
+ }
+
+ ThreadIdentifier threadID = establishIdentifierForThread(thread);
+ return threadID;
+}
+
+void initializeCurrentThreadInternal(const char*)
+{
+}
+
+int waitForThreadCompletion(ThreadIdentifier threadID, void** result)
+{
+ ASSERT(threadID);
+
+ GThread* thread = threadForIdentifier(threadID);
+
+ void* joinResult = g_thread_join(thread);
+ if (result)
+ *result = joinResult;
+
+ clearThreadForIdentifier(threadID);
+ return 0;
+}
+
+void detachThread(ThreadIdentifier)
+{
+}
+
+ThreadIdentifier currentThread()
+{
+ GThread* currentThread = g_thread_self();
+ if (ThreadIdentifier id = identifierByGthreadHandle(currentThread))
+ return id;
+ return establishIdentifierForThread(currentThread);
+}
+
+void yield()
+{
+ g_thread_yield();
+}
+
+Mutex::Mutex()
+ : m_mutex(g_mutex_new())
+{
+}
+
+Mutex::~Mutex()
+{
+}
+
+void Mutex::lock()
+{
+ g_mutex_lock(m_mutex.get());
+}
+
+bool Mutex::tryLock()
+{
+ return g_mutex_trylock(m_mutex.get());
+}
+
+void Mutex::unlock()
+{
+ g_mutex_unlock(m_mutex.get());
+}
+
+ThreadCondition::ThreadCondition()
+ : m_condition(g_cond_new())
+{
+}
+
+ThreadCondition::~ThreadCondition()
+{
+}
+
+void ThreadCondition::wait(Mutex& mutex)
+{
+ g_cond_wait(m_condition.get(), mutex.impl().get());
+}
+
+bool ThreadCondition::timedWait(Mutex& mutex, double absoluteTime)
+{
+ // Time is in the past - return right away.
+ if (absoluteTime < currentTime())
+ return false;
+
+ // Time is too far in the future for g_cond_timed_wait - wait forever.
+ if (absoluteTime > INT_MAX) {
+ wait(mutex);
+ return true;
+ }
+
+ int timeSeconds = static_cast<int>(absoluteTime);
+ int timeMicroseconds = static_cast<int>((absoluteTime - timeSeconds) * 1000000.0);
+
+ GTimeVal targetTime;
+ targetTime.tv_sec = timeSeconds;
+ targetTime.tv_usec = timeMicroseconds;
+
+ return g_cond_timed_wait(m_condition.get(), mutex.impl().get(), &targetTime);
+}
+
+void ThreadCondition::signal()
+{
+ g_cond_signal(m_condition.get());
+}
+
+void ThreadCondition::broadcast()
+{
+ g_cond_broadcast(m_condition.get());
+}
+
+
+}
+
+#endif // !USE(PTHREADS)
diff --git a/Source/JavaScriptCore/wtf/haiku/MainThreadHaiku.cpp b/Source/JavaScriptCore/wtf/haiku/MainThreadHaiku.cpp
new file mode 100644
index 0000000..10c4248
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/haiku/MainThreadHaiku.cpp
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2007 Kevin Ollivier
+ * Copyright (C) 2009 Maxime Simon
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "MainThread.h"
+
+#include "NotImplemented.h"
+
+namespace WTF {
+
+void initializeMainThreadPlatform()
+{
+ notImplemented();
+}
+
+void scheduleDispatchFunctionsOnMainThread()
+{
+ notImplemented();
+}
+
+} // namespace WTF
+
diff --git a/Source/JavaScriptCore/wtf/haiku/StringHaiku.cpp b/Source/JavaScriptCore/wtf/haiku/StringHaiku.cpp
new file mode 100644
index 0000000..fdf4e72
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/haiku/StringHaiku.cpp
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2007 Ryan Leavengood <leavengood@gmail.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "PlatformString.h"
+
+#include <String.h>
+#include <wtf/text/CString.h>
+
+namespace WTF {
+
+// String conversions
+String::String(const BString& string)
+{
+ if (string.Length())
+ m_impl = String::fromUTF8(string.String(), string.Length()).impl();
+ else
+ m_impl = StringImpl::empty();
+}
+
+String::operator BString() const
+{
+ BString string;
+ string.SetTo(utf8().data());
+
+ return string;
+}
+
+} // namespace WTF
diff --git a/Source/JavaScriptCore/wtf/mac/MainThreadMac.mm b/Source/JavaScriptCore/wtf/mac/MainThreadMac.mm
new file mode 100644
index 0000000..17363bc
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/mac/MainThreadMac.mm
@@ -0,0 +1,144 @@
+/*
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+#import "MainThread.h"
+
+#import <CoreFoundation/CoreFoundation.h>
+#import <Foundation/NSThread.h>
+#import <stdio.h>
+#import <wtf/Assertions.h>
+#import <wtf/Threading.h>
+
+@interface WTFMainThreadCaller : NSObject {
+}
+- (void)call;
+@end
+
+@implementation WTFMainThreadCaller
+
+- (void)call
+{
+ WTF::dispatchFunctionsFromMainThread();
+}
+
+@end // implementation WTFMainThreadCaller
+
+namespace WTF {
+
+static WTFMainThreadCaller* staticMainThreadCaller;
+static bool isTimerPosted; // This is only accessed on the 'main' thread.
+static bool mainThreadEstablishedAsPthreadMain;
+static pthread_t mainThreadPthread;
+static NSThread* mainThreadNSThread;
+
+void initializeMainThreadPlatform()
+{
+#if !defined(BUILDING_ON_TIGER)
+ ASSERT(!staticMainThreadCaller);
+ staticMainThreadCaller = [[WTFMainThreadCaller alloc] init];
+
+ mainThreadEstablishedAsPthreadMain = false;
+ mainThreadPthread = pthread_self();
+ mainThreadNSThread = [[NSThread currentThread] retain];
+#else
+ ASSERT_NOT_REACHED();
+#endif
+}
+
+void initializeMainThreadToProcessMainThreadPlatform()
+{
+ if (!pthread_main_np())
+ NSLog(@"WebKit Threading Violation - initial use of WebKit from a secondary thread.");
+
+ ASSERT(!staticMainThreadCaller);
+ staticMainThreadCaller = [[WTFMainThreadCaller alloc] init];
+
+ mainThreadEstablishedAsPthreadMain = true;
+ mainThreadPthread = 0;
+ mainThreadNSThread = nil;
+}
+
+static void timerFired(CFRunLoopTimerRef timer, void*)
+{
+ CFRelease(timer);
+ isTimerPosted = false;
+ WTF::dispatchFunctionsFromMainThread();
+}
+
+static void postTimer()
+{
+ ASSERT(isMainThread());
+
+ if (isTimerPosted)
+ return;
+
+ isTimerPosted = true;
+ CFRunLoopAddTimer(CFRunLoopGetCurrent(), CFRunLoopTimerCreate(0, 0, 0, 0, 0, timerFired, 0), kCFRunLoopCommonModes);
+}
+
+void scheduleDispatchFunctionsOnMainThread()
+{
+ ASSERT(staticMainThreadCaller);
+
+ if (isMainThread()) {
+ postTimer();
+ return;
+ }
+
+ if (mainThreadEstablishedAsPthreadMain) {
+ ASSERT(!mainThreadNSThread);
+ [staticMainThreadCaller performSelectorOnMainThread:@selector(call) withObject:nil waitUntilDone:NO];
+ return;
+ }
+
+#if !defined(BUILDING_ON_TIGER)
+ ASSERT(mainThreadNSThread);
+ [staticMainThreadCaller performSelector:@selector(call) onThread:mainThreadNSThread withObject:nil waitUntilDone:NO];
+#else
+ ASSERT_NOT_REACHED();
+#endif
+}
+
+bool isMainThread()
+{
+ if (mainThreadEstablishedAsPthreadMain) {
+ ASSERT(!mainThreadPthread);
+ return pthread_main_np();
+ }
+
+#if !defined(BUILDING_ON_TIGER)
+ ASSERT(mainThreadPthread);
+ return pthread_equal(pthread_self(), mainThreadPthread);
+#else
+ ASSERT_NOT_REACHED();
+ return false;
+#endif
+}
+
+} // namespace WTF
diff --git a/Source/JavaScriptCore/wtf/qt/MainThreadQt.cpp b/Source/JavaScriptCore/wtf/qt/MainThreadQt.cpp
new file mode 100644
index 0000000..98b6a0c
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/qt/MainThreadQt.cpp
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2007 Staikos Computing Services Inc.
+ * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "MainThread.h"
+
+#include <QtCore/QObject>
+#include <QtCore/QCoreApplication>
+#include <QThread>
+
+namespace WTF {
+
+class MainThreadInvoker : public QObject {
+ Q_OBJECT
+public:
+ MainThreadInvoker();
+
+private Q_SLOTS:
+ void dispatch();
+};
+
+MainThreadInvoker::MainThreadInvoker()
+{
+ moveToThread(QCoreApplication::instance()->thread());
+}
+
+void MainThreadInvoker::dispatch()
+{
+ dispatchFunctionsFromMainThread();
+}
+
+Q_GLOBAL_STATIC(MainThreadInvoker, webkit_main_thread_invoker)
+
+void initializeMainThreadPlatform()
+{
+}
+
+void scheduleDispatchFunctionsOnMainThread()
+{
+ QMetaObject::invokeMethod(webkit_main_thread_invoker(), "dispatch", Qt::QueuedConnection);
+}
+
+bool isMainThread()
+{
+ return QThread::currentThread() == QCoreApplication::instance()->thread();
+}
+
+} // namespace WTF
+
+#include "MainThreadQt.moc"
diff --git a/Source/JavaScriptCore/wtf/qt/StringQt.cpp b/Source/JavaScriptCore/wtf/qt/StringQt.cpp
new file mode 100644
index 0000000..16dd439
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/qt/StringQt.cpp
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#include <wtf/StdLibExtras.h>
+#include <wtf/text/WTFString.h>
+
+#include <QString>
+
+namespace WTF {
+
+// String conversions
+String::String(const QString& qstr)
+{
+ if (qstr.isNull())
+ return;
+ m_impl = StringImpl::create(reinterpret_cast_ptr<const UChar*>(qstr.constData()), qstr.length());
+}
+
+String::String(const QStringRef& ref)
+{
+ if (!ref.string())
+ return;
+ m_impl = StringImpl::create(reinterpret_cast_ptr<const UChar*>(ref.unicode()), ref.length());
+}
+
+String::operator QString() const
+{
+ return QString(reinterpret_cast<const QChar*>(characters()), length());
+}
+
+QDataStream& operator<<(QDataStream& stream, const String& str)
+{
+ // could be faster
+ stream << QString(str);
+ return stream;
+}
+
+QDataStream& operator>>(QDataStream& stream, String& str)
+{
+ // mabe not the fastest way, but really easy
+ QString tmp;
+ stream >> tmp;
+ str = tmp;
+ return stream;
+}
+
+}
+
+// vim: ts=4 sw=4 et
diff --git a/Source/JavaScriptCore/wtf/qt/ThreadingQt.cpp b/Source/JavaScriptCore/wtf/qt/ThreadingQt.cpp
new file mode 100644
index 0000000..8041dea
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/qt/ThreadingQt.cpp
@@ -0,0 +1,288 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2007 Justin Haygood (jhaygood@reaktix.com)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include "config.h"
+#include "Threading.h"
+
+#if !ENABLE(SINGLE_THREADED)
+
+#include "CurrentTime.h"
+#include "HashMap.h"
+#include "MainThread.h"
+#include "RandomNumberSeed.h"
+
+#include <QCoreApplication>
+#include <QMutex>
+#include <QThread>
+#include <QWaitCondition>
+
+namespace WTF {
+
+class ThreadPrivate : public QThread {
+public:
+ ThreadPrivate(ThreadFunction entryPoint, void* data);
+ void run();
+ void* getReturnValue() { return m_returnValue; }
+private:
+ void* m_data;
+ ThreadFunction m_entryPoint;
+ void* m_returnValue;
+};
+
+ThreadPrivate::ThreadPrivate(ThreadFunction entryPoint, void* data)
+ : m_data(data)
+ , m_entryPoint(entryPoint)
+ , m_returnValue(0)
+{
+}
+
+void ThreadPrivate::run()
+{
+ m_returnValue = m_entryPoint(m_data);
+}
+
+class ThreadMonitor : public QObject {
+ Q_OBJECT
+public:
+ static ThreadMonitor * instance()
+ {
+ static ThreadMonitor *instance = new ThreadMonitor();
+ return instance;
+ }
+
+public Q_SLOTS:
+ void threadFinished()
+ {
+ sender()->deleteLater();
+ }
+};
+
+static Mutex* atomicallyInitializedStaticMutex;
+
+static Mutex& threadMapMutex()
+{
+ static Mutex mutex;
+ return mutex;
+}
+
+static HashMap<ThreadIdentifier, QThread*>& threadMap()
+{
+ static HashMap<ThreadIdentifier, QThread*> map;
+ return map;
+}
+
+static ThreadIdentifier identifierByQthreadHandle(QThread*& thread)
+{
+ MutexLocker locker(threadMapMutex());
+
+ HashMap<ThreadIdentifier, QThread*>::iterator i = threadMap().begin();
+ for (; i != threadMap().end(); ++i) {
+ if (i->second == thread)
+ return i->first;
+ }
+
+ return 0;
+}
+
+static ThreadIdentifier establishIdentifierForThread(QThread*& thread)
+{
+ ASSERT(!identifierByQthreadHandle(thread));
+
+ MutexLocker locker(threadMapMutex());
+
+ static ThreadIdentifier identifierCount = 1;
+
+ threadMap().add(identifierCount, thread);
+
+ return identifierCount++;
+}
+
+static void clearThreadForIdentifier(ThreadIdentifier id)
+{
+ MutexLocker locker(threadMapMutex());
+
+ ASSERT(threadMap().contains(id));
+
+ threadMap().remove(id);
+}
+
+static QThread* threadForIdentifier(ThreadIdentifier id)
+{
+ MutexLocker locker(threadMapMutex());
+
+ return threadMap().get(id);
+}
+
+void initializeThreading()
+{
+ if (!atomicallyInitializedStaticMutex) {
+ atomicallyInitializedStaticMutex = new Mutex;
+ threadMapMutex();
+ initializeRandomNumberGenerator();
+ }
+}
+
+void lockAtomicallyInitializedStaticMutex()
+{
+ ASSERT(atomicallyInitializedStaticMutex);
+ atomicallyInitializedStaticMutex->lock();
+}
+
+void unlockAtomicallyInitializedStaticMutex()
+{
+ atomicallyInitializedStaticMutex->unlock();
+}
+
+ThreadIdentifier createThreadInternal(ThreadFunction entryPoint, void* data, const char*)
+{
+ ThreadPrivate* thread = new ThreadPrivate(entryPoint, data);
+ if (!thread) {
+ LOG_ERROR("Failed to create thread at entry point %p with data %p", entryPoint, data);
+ return 0;
+ }
+
+ QObject::connect(thread, SIGNAL(finished()), ThreadMonitor::instance(), SLOT(threadFinished()));
+
+ thread->start();
+
+ QThread* threadRef = static_cast<QThread*>(thread);
+
+ return establishIdentifierForThread(threadRef);
+}
+
+void initializeCurrentThreadInternal(const char*)
+{
+}
+
+int waitForThreadCompletion(ThreadIdentifier threadID, void** result)
+{
+ ASSERT(threadID);
+
+ QThread* thread = threadForIdentifier(threadID);
+
+ bool res = thread->wait();
+
+ clearThreadForIdentifier(threadID);
+ if (result)
+ *result = static_cast<ThreadPrivate*>(thread)->getReturnValue();
+
+ return !res;
+}
+
+void detachThread(ThreadIdentifier threadID)
+{
+ ASSERT(threadID);
+ clearThreadForIdentifier(threadID);
+}
+
+ThreadIdentifier currentThread()
+{
+ QThread* currentThread = QThread::currentThread();
+ if (ThreadIdentifier id = identifierByQthreadHandle(currentThread))
+ return id;
+ return establishIdentifierForThread(currentThread);
+}
+
+void yield()
+{
+ QThread::yieldCurrentThread();
+}
+
+Mutex::Mutex()
+ : m_mutex(new QMutex())
+{
+}
+
+Mutex::~Mutex()
+{
+ delete m_mutex;
+}
+
+void Mutex::lock()
+{
+ m_mutex->lock();
+}
+
+bool Mutex::tryLock()
+{
+ return m_mutex->tryLock();
+}
+
+void Mutex::unlock()
+{
+ m_mutex->unlock();
+}
+
+ThreadCondition::ThreadCondition()
+ : m_condition(new QWaitCondition())
+{
+}
+
+ThreadCondition::~ThreadCondition()
+{
+ delete m_condition;
+}
+
+void ThreadCondition::wait(Mutex& mutex)
+{
+ m_condition->wait(mutex.impl());
+}
+
+bool ThreadCondition::timedWait(Mutex& mutex, double absoluteTime)
+{
+ double currentTime = WTF::currentTime();
+
+ // Time is in the past - return immediately.
+ if (absoluteTime < currentTime)
+ return false;
+
+ // Time is too far in the future (and would overflow unsigned long) - wait forever.
+ if (absoluteTime - currentTime > static_cast<double>(INT_MAX) / 1000.0) {
+ wait(mutex);
+ return true;
+ }
+
+ double intervalMilliseconds = (absoluteTime - currentTime) * 1000.0;
+ return m_condition->wait(mutex.impl(), static_cast<unsigned long>(intervalMilliseconds));
+}
+
+void ThreadCondition::signal()
+{
+ m_condition->wakeOne();
+}
+
+void ThreadCondition::broadcast()
+{
+ m_condition->wakeAll();
+}
+
+} // namespace WebCore
+
+#include "ThreadingQt.moc"
+
+#endif
diff --git a/Source/JavaScriptCore/wtf/text/AtomicString.cpp b/Source/JavaScriptCore/wtf/text/AtomicString.cpp
new file mode 100644
index 0000000..93ad21d
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/text/AtomicString.cpp
@@ -0,0 +1,389 @@
+/*
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2010 Patrick Gansterer <paroga@paroga.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+
+#include "AtomicString.h"
+
+#include "StringHash.h"
+#include <wtf/HashSet.h>
+#include <wtf/Threading.h>
+#include <wtf/WTFThreadData.h>
+#include <wtf/unicode/UTF8.h>
+
+namespace WTF {
+
+using namespace Unicode;
+
+COMPILE_ASSERT(sizeof(AtomicString) == sizeof(String), atomic_string_and_string_must_be_same_size);
+
+class AtomicStringTable {
+public:
+ static AtomicStringTable* create()
+ {
+ AtomicStringTable* table = new AtomicStringTable;
+
+ WTFThreadData& data = wtfThreadData();
+ data.m_atomicStringTable = table;
+ data.m_atomicStringTableDestructor = AtomicStringTable::destroy;
+
+ return table;
+ }
+
+ HashSet<StringImpl*>& table()
+ {
+ return m_table;
+ }
+
+private:
+ static void destroy(AtomicStringTable* table)
+ {
+ HashSet<StringImpl*>::iterator end = table->m_table.end();
+ for (HashSet<StringImpl*>::iterator iter = table->m_table.begin(); iter != end; ++iter)
+ (*iter)->setIsAtomic(false);
+ delete table;
+ }
+
+ HashSet<StringImpl*> m_table;
+};
+
+static inline HashSet<StringImpl*>& stringTable()
+{
+ // Once possible we should make this non-lazy (constructed in WTFThreadData's constructor).
+ AtomicStringTable* table = wtfThreadData().atomicStringTable();
+ if (UNLIKELY(!table))
+ table = AtomicStringTable::create();
+ return table->table();
+}
+
+struct CStringTranslator {
+ static unsigned hash(const char* c)
+ {
+ return StringImpl::computeHash(c);
+ }
+
+ static bool equal(StringImpl* r, const char* s)
+ {
+ int length = r->length();
+ const UChar* d = r->characters();
+ for (int i = 0; i != length; ++i) {
+ unsigned char c = s[i];
+ if (d[i] != c)
+ return false;
+ }
+ return !s[length];
+ }
+
+ static void translate(StringImpl*& location, const char* const& c, unsigned hash)
+ {
+ location = StringImpl::create(c).leakRef();
+ location->setHash(hash);
+ location->setIsAtomic(true);
+ }
+};
+
+bool operator==(const AtomicString& a, const char* b)
+{
+ StringImpl* impl = a.impl();
+ if ((!impl || !impl->characters()) && !b)
+ return true;
+ if ((!impl || !impl->characters()) || !b)
+ return false;
+ return CStringTranslator::equal(impl, b);
+}
+
+PassRefPtr<StringImpl> AtomicString::add(const char* c)
+{
+ if (!c)
+ return 0;
+ if (!*c)
+ return StringImpl::empty();
+ pair<HashSet<StringImpl*>::iterator, bool> addResult = stringTable().add<const char*, CStringTranslator>(c);
+ if (!addResult.second)
+ return *addResult.first;
+ return adoptRef(*addResult.first);
+}
+
+struct UCharBuffer {
+ const UChar* s;
+ unsigned length;
+};
+
+static inline bool equal(StringImpl* string, const UChar* characters, unsigned length)
+{
+ if (string->length() != length)
+ return false;
+
+ // FIXME: perhaps we should have a more abstract macro that indicates when
+ // going 4 bytes at a time is unsafe
+#if CPU(ARM) || CPU(SH4) || CPU(MIPS)
+ const UChar* stringCharacters = string->characters();
+ for (unsigned i = 0; i != length; ++i) {
+ if (*stringCharacters++ != *characters++)
+ return false;
+ }
+ return true;
+#else
+ /* Do it 4-bytes-at-a-time on architectures where it's safe */
+
+ const uint32_t* stringCharacters = reinterpret_cast<const uint32_t*>(string->characters());
+ const uint32_t* bufferCharacters = reinterpret_cast<const uint32_t*>(characters);
+
+ unsigned halfLength = length >> 1;
+ for (unsigned i = 0; i != halfLength; ++i) {
+ if (*stringCharacters++ != *bufferCharacters++)
+ return false;
+ }
+
+ if (length & 1 && *reinterpret_cast<const uint16_t*>(stringCharacters) != *reinterpret_cast<const uint16_t*>(bufferCharacters))
+ return false;
+
+ return true;
+#endif
+}
+
+bool operator==(const AtomicString& string, const Vector<UChar>& vector)
+{
+ return string.impl() && equal(string.impl(), vector.data(), vector.size());
+}
+
+struct UCharBufferTranslator {
+ static unsigned hash(const UCharBuffer& buf)
+ {
+ return StringImpl::computeHash(buf.s, buf.length);
+ }
+
+ static bool equal(StringImpl* const& str, const UCharBuffer& buf)
+ {
+ return WTF::equal(str, buf.s, buf.length);
+ }
+
+ static void translate(StringImpl*& location, const UCharBuffer& buf, unsigned hash)
+ {
+ location = StringImpl::create(buf.s, buf.length).leakRef();
+ location->setHash(hash);
+ location->setIsAtomic(true);
+ }
+};
+
+struct HashAndCharacters {
+ unsigned hash;
+ const UChar* characters;
+ unsigned length;
+};
+
+struct HashAndCharactersTranslator {
+ static unsigned hash(const HashAndCharacters& buffer)
+ {
+ ASSERT(buffer.hash == StringImpl::computeHash(buffer.characters, buffer.length));
+ return buffer.hash;
+ }
+
+ static bool equal(StringImpl* const& string, const HashAndCharacters& buffer)
+ {
+ return WTF::equal(string, buffer.characters, buffer.length);
+ }
+
+ static void translate(StringImpl*& location, const HashAndCharacters& buffer, unsigned hash)
+ {
+ location = StringImpl::create(buffer.characters, buffer.length).leakRef();
+ location->setHash(hash);
+ location->setIsAtomic(true);
+ }
+};
+
+struct HashAndUTF8Characters {
+ unsigned hash;
+ const char* characters;
+ unsigned length;
+ unsigned utf16Length;
+};
+
+struct HashAndUTF8CharactersTranslator {
+ static unsigned hash(const HashAndUTF8Characters& buffer)
+ {
+ return buffer.hash;
+ }
+
+ static bool equal(StringImpl* const& string, const HashAndUTF8Characters& buffer)
+ {
+ if (buffer.utf16Length != string->length())
+ return false;
+
+ const UChar* stringCharacters = string->characters();
+
+ // If buffer contains only ASCII characters UTF-8 and UTF16 length are the same.
+ if (buffer.utf16Length != buffer.length)
+ return equalUTF16WithUTF8(stringCharacters, stringCharacters + string->length(), buffer.characters, buffer.characters + buffer.length);
+
+ for (unsigned i = 0; i < buffer.length; ++i) {
+ ASSERT(isASCII(buffer.characters[i]));
+ if (stringCharacters[i] != buffer.characters[i])
+ return false;
+ }
+
+ return true;
+ }
+
+ static void translate(StringImpl*& location, const HashAndUTF8Characters& buffer, unsigned hash)
+ {
+ UChar* target;
+ location = StringImpl::createUninitialized(buffer.utf16Length, target).releaseRef();
+
+ const char* source = buffer.characters;
+ if (convertUTF8ToUTF16(&source, source + buffer.length, &target, target + buffer.utf16Length) != conversionOK)
+ ASSERT_NOT_REACHED();
+
+ location->setHash(hash);
+ location->setIsAtomic(true);
+ }
+};
+
+PassRefPtr<StringImpl> AtomicString::add(const UChar* s, unsigned length)
+{
+ if (!s)
+ return 0;
+
+ if (!length)
+ return StringImpl::empty();
+
+ UCharBuffer buf = { s, length };
+ pair<HashSet<StringImpl*>::iterator, bool> addResult = stringTable().add<UCharBuffer, UCharBufferTranslator>(buf);
+
+ // If the string is newly-translated, then we need to adopt it.
+ // The boolean in the pair tells us if that is so.
+ return addResult.second ? adoptRef(*addResult.first) : *addResult.first;
+}
+
+PassRefPtr<StringImpl> AtomicString::add(const UChar* s, unsigned length, unsigned existingHash)
+{
+ ASSERT(s);
+ ASSERT(existingHash);
+
+ if (!length)
+ return StringImpl::empty();
+
+ HashAndCharacters buffer = { existingHash, s, length };
+ pair<HashSet<StringImpl*>::iterator, bool> addResult = stringTable().add<HashAndCharacters, HashAndCharactersTranslator>(buffer);
+ if (!addResult.second)
+ return *addResult.first;
+ return adoptRef(*addResult.first);
+}
+
+PassRefPtr<StringImpl> AtomicString::add(const UChar* s)
+{
+ if (!s)
+ return 0;
+
+ int length = 0;
+ while (s[length] != UChar(0))
+ length++;
+
+ if (!length)
+ return StringImpl::empty();
+
+ UCharBuffer buf = {s, length};
+ pair<HashSet<StringImpl*>::iterator, bool> addResult = stringTable().add<UCharBuffer, UCharBufferTranslator>(buf);
+
+ // If the string is newly-translated, then we need to adopt it.
+ // The boolean in the pair tells us if that is so.
+ return addResult.second ? adoptRef(*addResult.first) : *addResult.first;
+}
+
+PassRefPtr<StringImpl> AtomicString::addSlowCase(StringImpl* r)
+{
+ if (!r || r->isAtomic())
+ return r;
+
+ if (!r->length())
+ return StringImpl::empty();
+
+ StringImpl* result = *stringTable().add(r).first;
+ if (result == r)
+ r->setIsAtomic(true);
+ return result;
+}
+
+AtomicStringImpl* AtomicString::find(const UChar* s, unsigned length, unsigned existingHash)
+{
+ ASSERT(s);
+ ASSERT(existingHash);
+
+ if (!length)
+ return static_cast<AtomicStringImpl*>(StringImpl::empty());
+
+ HashAndCharacters buffer = { existingHash, s, length };
+ HashSet<StringImpl*>::iterator iterator = stringTable().find<HashAndCharacters, HashAndCharactersTranslator>(buffer);
+ if (iterator == stringTable().end())
+ return 0;
+ return static_cast<AtomicStringImpl*>(*iterator);
+}
+
+void AtomicString::remove(StringImpl* r)
+{
+ stringTable().remove(r);
+}
+
+AtomicString AtomicString::lower() const
+{
+ // Note: This is a hot function in the Dromaeo benchmark.
+ StringImpl* impl = this->impl();
+ if (UNLIKELY(!impl))
+ return *this;
+ RefPtr<StringImpl> newImpl = impl->lower();
+ if (LIKELY(newImpl == impl))
+ return *this;
+ return AtomicString(newImpl);
+}
+
+AtomicString AtomicString::fromUTF8(const char* characters, size_t length)
+{
+ if (!characters)
+ return AtomicString();
+
+ if (!length)
+ return emptyAtom;
+
+ HashAndUTF8Characters buffer;
+ buffer.characters = characters;
+ buffer.length = length;
+ buffer.hash = calculateStringHashFromUTF8(characters, characters + length, buffer.utf16Length);
+
+ if (!buffer.hash)
+ return AtomicString();
+
+ pair<HashSet<StringImpl*>::iterator, bool> addResult = stringTable().add<HashAndUTF8Characters, HashAndUTF8CharactersTranslator>(buffer);
+
+ // If the string is newly-translated, then we need to adopt it.
+ // The boolean in the pair tells us if that is so.
+ AtomicString atomicString;
+ atomicString.m_string = addResult.second ? adoptRef(*addResult.first) : *addResult.first;
+ return atomicString;
+}
+
+AtomicString AtomicString::fromUTF8(const char* characters)
+{
+ if (!characters)
+ return AtomicString();
+ return fromUTF8(characters, strlen(characters));
+}
+
+} // namespace WTF
diff --git a/Source/JavaScriptCore/wtf/text/AtomicString.h b/Source/JavaScriptCore/wtf/text/AtomicString.h
new file mode 100644
index 0000000..ab5b366
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/text/AtomicString.h
@@ -0,0 +1,185 @@
+/*
+ * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef AtomicString_h
+#define AtomicString_h
+
+#include "AtomicStringImpl.h"
+#include "WTFString.h"
+
+// Define 'NO_IMPLICIT_ATOMICSTRING' before including this header,
+// to disallow (expensive) implicit String-->AtomicString conversions.
+#ifdef NO_IMPLICIT_ATOMICSTRING
+#define ATOMICSTRING_CONVERSION explicit
+#else
+#define ATOMICSTRING_CONVERSION
+#endif
+
+namespace WTF {
+
+struct AtomicStringHash;
+
+class AtomicString {
+public:
+ static void init();
+
+ AtomicString() { }
+ AtomicString(const char* s) : m_string(add(s)) { }
+ AtomicString(const UChar* s, unsigned length) : m_string(add(s, length)) { }
+ AtomicString(const UChar* s, unsigned length, unsigned existingHash) : m_string(add(s, length, existingHash)) { }
+ AtomicString(const UChar* s) : m_string(add(s)) { }
+ ATOMICSTRING_CONVERSION AtomicString(StringImpl* imp) : m_string(add(imp)) { }
+ AtomicString(AtomicStringImpl* imp) : m_string(imp) { }
+ ATOMICSTRING_CONVERSION AtomicString(const String& s) : m_string(add(s.impl())) { }
+
+ // Hash table deleted values, which are only constructed and never copied or destroyed.
+ AtomicString(WTF::HashTableDeletedValueType) : m_string(WTF::HashTableDeletedValue) { }
+ bool isHashTableDeletedValue() const { return m_string.isHashTableDeletedValue(); }
+
+ static AtomicStringImpl* find(const UChar* s, unsigned length, unsigned existingHash);
+
+ operator const String&() const { return m_string; }
+ const String& string() const { return m_string; };
+
+ AtomicStringImpl* impl() const { return static_cast<AtomicStringImpl *>(m_string.impl()); }
+
+ const UChar* characters() const { return m_string.characters(); }
+ unsigned length() const { return m_string.length(); }
+
+ UChar operator[](unsigned int i) const { return m_string[i]; }
+
+ bool contains(UChar c) const { return m_string.contains(c); }
+ bool contains(const char* s, bool caseSensitive = true) const
+ { return m_string.contains(s, caseSensitive); }
+ bool contains(const String& s, bool caseSensitive = true) const
+ { return m_string.contains(s, caseSensitive); }
+
+ size_t find(UChar c, size_t start = 0) const { return m_string.find(c, start); }
+ size_t find(const char* s, size_t start = 0, bool caseSentitive = true) const
+ { return m_string.find(s, start, caseSentitive); }
+ size_t find(const String& s, size_t start = 0, bool caseSentitive = true) const
+ { return m_string.find(s, start, caseSentitive); }
+
+ bool startsWith(const String& s, bool caseSensitive = true) const
+ { return m_string.startsWith(s, caseSensitive); }
+ bool endsWith(const String& s, bool caseSensitive = true) const
+ { return m_string.endsWith(s, caseSensitive); }
+
+ AtomicString lower() const;
+ AtomicString upper() const { return AtomicString(impl()->upper()); }
+
+ int toInt(bool* ok = 0) const { return m_string.toInt(ok); }
+ double toDouble(bool* ok = 0) const { return m_string.toDouble(ok); }
+ float toFloat(bool* ok = 0) const { return m_string.toFloat(ok); }
+ bool percentage(int& p) const { return m_string.percentage(p); }
+
+ bool isNull() const { return m_string.isNull(); }
+ bool isEmpty() const { return m_string.isEmpty(); }
+
+ static void remove(StringImpl*);
+
+#if PLATFORM(CF)
+ AtomicString(CFStringRef s) : m_string(add(String(s).impl())) { }
+ CFStringRef createCFString() const { return m_string.createCFString(); }
+#endif
+#ifdef __OBJC__
+ AtomicString(NSString* s) : m_string(add(String(s).impl())) { }
+ operator NSString*() const { return m_string; }
+#endif
+#if PLATFORM(QT)
+ AtomicString(const QString& s) : m_string(add(String(s).impl())) { }
+ operator QString() const { return m_string; }
+#endif
+
+ // AtomicString::fromUTF8 will return a null string if
+ // the input data contains invalid UTF-8 sequences.
+ static AtomicString fromUTF8(const char*, size_t);
+ static AtomicString fromUTF8(const char*);
+
+private:
+ String m_string;
+
+ static PassRefPtr<StringImpl> add(const char*);
+ static PassRefPtr<StringImpl> add(const UChar*, unsigned length);
+ static PassRefPtr<StringImpl> add(const UChar*, unsigned length, unsigned existingHash);
+ static PassRefPtr<StringImpl> add(const UChar*);
+ ALWAYS_INLINE PassRefPtr<StringImpl> add(StringImpl* r)
+ {
+ if (!r || r->isAtomic())
+ return r;
+ return addSlowCase(r);
+ }
+ static PassRefPtr<StringImpl> addSlowCase(StringImpl*);
+};
+
+inline bool operator==(const AtomicString& a, const AtomicString& b) { return a.impl() == b.impl(); }
+bool operator==(const AtomicString& a, const char* b);
+bool operator==(const AtomicString& a, const Vector<UChar>& b);
+inline bool operator==(const AtomicString& a, const String& b) { return equal(a.impl(), b.impl()); }
+inline bool operator==(const char* a, const AtomicString& b) { return b == a; }
+inline bool operator==(const String& a, const AtomicString& b) { return equal(a.impl(), b.impl()); }
+inline bool operator==(const Vector<UChar>& a, const AtomicString& b) { return b == a; }
+
+inline bool operator!=(const AtomicString& a, const AtomicString& b) { return a.impl() != b.impl(); }
+inline bool operator!=(const AtomicString& a, const char *b) { return !(a == b); }
+inline bool operator!=(const AtomicString& a, const String& b) { return !equal(a.impl(), b.impl()); }
+inline bool operator!=(const AtomicString& a, const Vector<UChar>& b) { return !(a == b); }
+inline bool operator!=(const char* a, const AtomicString& b) { return !(b == a); }
+inline bool operator!=(const String& a, const AtomicString& b) { return !equal(a.impl(), b.impl()); }
+inline bool operator!=(const Vector<UChar>& a, const AtomicString& b) { return !(a == b); }
+
+inline bool equalIgnoringCase(const AtomicString& a, const AtomicString& b) { return equalIgnoringCase(a.impl(), b.impl()); }
+inline bool equalIgnoringCase(const AtomicString& a, const char* b) { return equalIgnoringCase(a.impl(), b); }
+inline bool equalIgnoringCase(const AtomicString& a, const String& b) { return equalIgnoringCase(a.impl(), b.impl()); }
+inline bool equalIgnoringCase(const char* a, const AtomicString& b) { return equalIgnoringCase(a, b.impl()); }
+inline bool equalIgnoringCase(const String& a, const AtomicString& b) { return equalIgnoringCase(a.impl(), b.impl()); }
+
+// Define external global variables for the commonly used atomic strings.
+// These are only usable from the main thread.
+#ifndef ATOMICSTRING_HIDE_GLOBALS
+ extern const JS_EXPORTDATA AtomicString nullAtom;
+ extern const JS_EXPORTDATA AtomicString emptyAtom;
+ extern const JS_EXPORTDATA AtomicString textAtom;
+ extern const JS_EXPORTDATA AtomicString commentAtom;
+ extern const JS_EXPORTDATA AtomicString starAtom;
+ extern const JS_EXPORTDATA AtomicString xmlAtom;
+ extern const JS_EXPORTDATA AtomicString xmlnsAtom;
+#endif
+
+ // AtomicStringHash is the default hash for AtomicString
+ template<typename T> struct DefaultHash;
+ template<> struct DefaultHash<AtomicString> {
+ typedef AtomicStringHash Hash;
+ };
+
+} // namespace WTF
+
+#ifndef ATOMICSTRING_HIDE_GLOBALS
+using WTF::AtomicString;
+using WTF::nullAtom;
+using WTF::emptyAtom;
+using WTF::textAtom;
+using WTF::commentAtom;
+using WTF::starAtom;
+using WTF::xmlAtom;
+using WTF::xmlnsAtom;
+#endif
+
+#endif // AtomicString_h
diff --git a/Source/JavaScriptCore/wtf/text/AtomicStringHash.h b/Source/JavaScriptCore/wtf/text/AtomicStringHash.h
new file mode 100644
index 0000000..f6e4ad1
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/text/AtomicStringHash.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef AtomicStringHash_h
+#define AtomicStringHash_h
+
+#include <wtf/text/AtomicString.h>
+#include <wtf/HashTraits.h>
+
+namespace WTF {
+
+ struct AtomicStringHash {
+ static unsigned hash(const AtomicString& key)
+ {
+ return key.impl()->existingHash();
+ }
+
+ static bool equal(const AtomicString& a, const AtomicString& b)
+ {
+ return a == b;
+ }
+
+ static const bool safeToCompareToEmptyOrDeleted = false;
+ };
+
+ // AtomicStringHash is the default hash for AtomicString
+ template<> struct HashTraits<WTF::AtomicString> : GenericHashTraits<WTF::AtomicString> {
+ static const bool emptyValueIsZero = true;
+ static void constructDeletedValue(WTF::AtomicString& slot) { new (&slot) WTF::AtomicString(HashTableDeletedValue); }
+ static bool isDeletedValue(const WTF::AtomicString& slot) { return slot.isHashTableDeletedValue(); }
+ };
+
+}
+
+using WTF::AtomicStringHash;
+
+#endif
diff --git a/Source/JavaScriptCore/wtf/text/AtomicStringImpl.h b/Source/JavaScriptCore/wtf/text/AtomicStringImpl.h
new file mode 100644
index 0000000..3f0c376
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/text/AtomicStringImpl.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef AtomicStringImpl_h
+#define AtomicStringImpl_h
+
+#include "StringImpl.h"
+
+namespace WTF {
+
+class AtomicStringImpl : public StringImpl
+{
+public:
+ AtomicStringImpl() : StringImpl(0) {}
+};
+
+}
+
+using WTF::AtomicStringImpl;
+
+#endif
diff --git a/Source/JavaScriptCore/wtf/text/CString.cpp b/Source/JavaScriptCore/wtf/text/CString.cpp
new file mode 100644
index 0000000..981d77a
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/text/CString.cpp
@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) 2003, 2006, 2008, 2009, 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+#include "config.h"
+#include "CString.h"
+
+using namespace std;
+
+namespace WTF {
+
+CString::CString(const char* str)
+{
+ if (!str)
+ return;
+
+ init(str, strlen(str));
+}
+
+CString::CString(const char* str, size_t length)
+{
+ init(str, length);
+}
+
+void CString::init(const char* str, size_t length)
+{
+ if (!str)
+ return;
+
+ // We need to be sure we can add 1 to length without overflowing.
+ // Since the passed-in length is the length of an actual existing
+ // string, and we know the string doesn't occupy the entire address
+ // space, we can assert here and there's no need for a runtime check.
+ ASSERT(length < numeric_limits<size_t>::max());
+
+ m_buffer = CStringBuffer::create(length + 1);
+ memcpy(m_buffer->mutableData(), str, length);
+ m_buffer->mutableData()[length] = '\0';
+}
+
+char* CString::mutableData()
+{
+ copyBufferIfNeeded();
+ if (!m_buffer)
+ return 0;
+ return m_buffer->mutableData();
+}
+
+CString CString::newUninitialized(size_t length, char*& characterBuffer)
+{
+ if (length >= numeric_limits<size_t>::max())
+ CRASH();
+
+ CString result;
+ result.m_buffer = CStringBuffer::create(length + 1);
+ char* bytes = result.m_buffer->mutableData();
+ bytes[length] = '\0';
+ characterBuffer = bytes;
+ return result;
+}
+
+void CString::copyBufferIfNeeded()
+{
+ if (!m_buffer || m_buffer->hasOneRef())
+ return;
+
+ RefPtr<CStringBuffer> buffer = m_buffer.release();
+ size_t length = buffer->length();
+ m_buffer = CStringBuffer::create(length);
+ memcpy(m_buffer->mutableData(), buffer->data(), length);
+}
+
+bool operator==(const CString& a, const CString& b)
+{
+ if (a.isNull() != b.isNull())
+ return false;
+ if (a.length() != b.length())
+ return false;
+ return !strncmp(a.data(), b.data(), min(a.length(), b.length()));
+}
+
+} // namespace WTF
diff --git a/Source/JavaScriptCore/wtf/text/CString.h b/Source/JavaScriptCore/wtf/text/CString.h
new file mode 100644
index 0000000..343a7a5
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/text/CString.h
@@ -0,0 +1,87 @@
+/*
+ * Copyright (C) 2003, 2006, 2008, 2009, 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CString_h
+#define CString_h
+
+#include "PassRefPtr.h"
+#include "RefCounted.h"
+#include "Vector.h"
+
+namespace WTF {
+
+class CStringBuffer : public RefCounted<CStringBuffer> {
+public:
+ const char* data() { return m_vector.data(); }
+ size_t length() { return m_vector.size(); }
+
+private:
+ friend class CString;
+
+ static PassRefPtr<CStringBuffer> create(size_t length) { return adoptRef(new CStringBuffer(length)); }
+ CStringBuffer(size_t length) : m_vector(length) { }
+ char* mutableData() { return m_vector.data(); }
+
+ Vector<char> m_vector;
+};
+
+// A container for a null-terminated char array supporting copy-on-write
+// assignment. The contained char array may be null.
+class CString {
+public:
+ CString() { }
+ CString(const char*);
+ CString(const char*, size_t length);
+ CString(CStringBuffer* buffer) : m_buffer(buffer) { }
+ static CString newUninitialized(size_t length, char*& characterBuffer);
+
+ const char* data() const
+ {
+ return m_buffer ? m_buffer->data() : 0;
+ }
+ char* mutableData();
+ size_t length() const
+ {
+ return m_buffer ? m_buffer->length() - 1 : 0;
+ }
+
+ bool isNull() const { return !m_buffer; }
+
+ CStringBuffer* buffer() const { return m_buffer.get(); }
+
+private:
+ void copyBufferIfNeeded();
+ void init(const char*, size_t length);
+ RefPtr<CStringBuffer> m_buffer;
+};
+
+bool operator==(const CString& a, const CString& b);
+inline bool operator!=(const CString& a, const CString& b) { return !(a == b); }
+
+} // namespace WTF
+
+using WTF::CString;
+
+#endif // CString_h
diff --git a/Source/JavaScriptCore/wtf/text/StringBuffer.h b/Source/JavaScriptCore/wtf/text/StringBuffer.h
new file mode 100644
index 0000000..a546bf3
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/text/StringBuffer.h
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2008, 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Inc. ("Apple") nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef StringBuffer_h
+#define StringBuffer_h
+
+#include <wtf/Assertions.h>
+#include <wtf/Noncopyable.h>
+#include <wtf/unicode/Unicode.h>
+#include <limits>
+
+namespace WTF {
+
+class StringBuffer : public Noncopyable {
+public:
+ explicit StringBuffer(unsigned length)
+ : m_length(length)
+ {
+ if (m_length > std::numeric_limits<unsigned>::max() / sizeof(UChar))
+ CRASH();
+ m_data = static_cast<UChar*>(fastMalloc(m_length * sizeof(UChar)));
+ }
+
+ ~StringBuffer()
+ {
+ fastFree(m_data);
+ }
+
+ void shrink(unsigned newLength)
+ {
+ ASSERT(newLength <= m_length);
+ m_length = newLength;
+ }
+
+ void resize(unsigned newLength)
+ {
+ if (newLength > m_length) {
+ if (newLength > std::numeric_limits<unsigned>::max() / sizeof(UChar))
+ CRASH();
+ m_data = static_cast<UChar*>(fastRealloc(m_data, newLength * sizeof(UChar)));
+ }
+ m_length = newLength;
+ }
+
+ unsigned length() const { return m_length; }
+ UChar* characters() { return m_data; }
+
+ UChar& operator[](unsigned i) { ASSERT(i < m_length); return m_data[i]; }
+
+ UChar* release() { UChar* data = m_data; m_data = 0; return data; }
+
+private:
+ unsigned m_length;
+ UChar* m_data;
+};
+
+} // namespace WTF
+
+using WTF::StringBuffer;
+
+#endif // StringBuffer_h
diff --git a/Source/JavaScriptCore/wtf/text/StringBuilder.cpp b/Source/JavaScriptCore/wtf/text/StringBuilder.cpp
new file mode 100644
index 0000000..dfc9ff3
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/text/StringBuilder.cpp
@@ -0,0 +1,172 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "StringBuilder.h"
+
+#include "WTFString.h"
+
+namespace WTF {
+
+void StringBuilder::reifyString()
+{
+ // Check if the string already exists.
+ if (!m_string.isNull()) {
+ ASSERT(m_string.length() == m_length);
+ return;
+ }
+
+ // Check for empty.
+ if (!m_length) {
+ m_string = StringImpl::empty();
+ return;
+ }
+
+ // Must be valid in the buffer, take a substring (unless string fills the buffer).
+ ASSERT(m_buffer && m_length <= m_buffer->length());
+ m_string = (m_length == m_buffer->length())
+ ? m_buffer.get()
+ : StringImpl::create(m_buffer, 0, m_length);
+}
+
+void StringBuilder::resize(unsigned newSize)
+{
+ // Check newSize < m_length, hence m_length > 0.
+ ASSERT(newSize <= m_length);
+ if (newSize == m_length)
+ return;
+ ASSERT(m_length);
+
+ // If there is a buffer, we only need to duplicate it if it has more than one ref.
+ if (m_buffer) {
+ if (!m_buffer->hasOneRef())
+ allocateBuffer(m_buffer->characters(), m_buffer->length());
+ m_length = newSize;
+ m_string = String();
+ return;
+ }
+
+ // Since m_length && !m_buffer, the string must be valid in m_string, and m_string.length() > 0.
+ ASSERT(!m_string.isEmpty());
+ ASSERT(m_length == m_string.length());
+ ASSERT(newSize < m_string.length());
+ m_length = newSize;
+ m_string = StringImpl::create(m_string.impl(), 0, newSize);
+}
+
+void StringBuilder::reserveCapacity(unsigned newCapacity)
+{
+ if (m_buffer) {
+ // If there is already a buffer, then grow if necessary.
+ if (newCapacity > m_buffer->length())
+ allocateBuffer(m_buffer->characters(), newCapacity);
+ } else {
+ // Grow the string, if necessary.
+ if (newCapacity > m_length)
+ allocateBuffer(m_string.characters(), newCapacity);
+ }
+}
+
+// Allocate a new buffer, copying in currentCharacters (these may come from either m_string
+// or m_buffer, neither will be reassigned until the copy has completed).
+void StringBuilder::allocateBuffer(const UChar* currentCharacters, unsigned requiredLength)
+{
+ // Copy the existing data into a new buffer, set result to point to the end of the existing data.
+ RefPtr<StringImpl> buffer = StringImpl::createUninitialized(requiredLength, m_bufferCharacters);
+ memcpy(m_bufferCharacters, currentCharacters, static_cast<size_t>(m_length) * sizeof(UChar)); // This can't overflow.
+
+ // Update the builder state.
+ m_buffer = buffer.release();
+ m_string = String();
+}
+
+// Make 'length' additional capacity be available in m_buffer, update m_string & m_length,
+// return a pointer to the newly allocated storage.
+UChar* StringBuilder::appendUninitialized(unsigned length)
+{
+ ASSERT(length);
+
+ // Calcuate the new size of the builder after appending.
+ unsigned requiredLength = length + m_length;
+ if (requiredLength < length)
+ CRASH();
+
+ if (m_buffer) {
+ // If the buffer is valid it must be at least as long as the current builder contents!
+ ASSERT(m_buffer->length() >= m_length);
+
+ // Check if the buffer already has sufficient capacity.
+ if (requiredLength <= m_buffer->length()) {
+ unsigned currentLength = m_length;
+ m_string = String();
+ m_length = requiredLength;
+ return m_bufferCharacters + currentLength;
+ }
+
+ // We need to realloc the buffer.
+ allocateBuffer(m_buffer->characters(), std::max(requiredLength, m_buffer->length() * 2));
+ } else {
+ ASSERT(m_string.length() == m_length);
+ allocateBuffer(m_string.characters(), std::max(requiredLength, requiredLength * 2));
+ }
+
+ UChar* result = m_bufferCharacters + m_length;
+ m_length = requiredLength;
+ return result;
+}
+
+void StringBuilder::append(const UChar* characters, unsigned length)
+{
+ if (!length)
+ return;
+ ASSERT(characters);
+
+ memcpy(appendUninitialized(length), characters, static_cast<size_t>(length) * 2);
+}
+
+void StringBuilder::append(const char* characters, unsigned length)
+{
+ if (!length)
+ return;
+ ASSERT(characters);
+
+ UChar* dest = appendUninitialized(length);
+ const char* end = characters + length;
+ while (characters < end)
+ *(dest++) = *(const unsigned char*)(characters++);
+}
+
+void StringBuilder::shrinkToFit()
+{
+ // If the buffer is at least 80% full, don't bother copying. Need to tune this heuristic!
+ if (m_buffer && m_buffer->length() > (m_length + (m_length >> 2))) {
+ UChar* result;
+ m_string = StringImpl::createUninitialized(m_length, result);
+ memcpy(result, m_buffer->characters(), static_cast<size_t>(m_length) * 2); // This can't overflow.
+ m_buffer = 0;
+ }
+}
+
+} // namespace WTF
diff --git a/Source/JavaScriptCore/wtf/text/StringBuilder.h b/Source/JavaScriptCore/wtf/text/StringBuilder.h
new file mode 100644
index 0000000..f10af64
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/text/StringBuilder.h
@@ -0,0 +1,139 @@
+/*
+ * Copyright (C) 2009, 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef StringBuilder_h
+#define StringBuilder_h
+
+#include <wtf/Vector.h>
+#include <wtf/text/WTFString.h>
+
+namespace WTF {
+
+class StringBuilder {
+public:
+ StringBuilder()
+ : m_length(0)
+ {
+ }
+
+ void append(const UChar*, unsigned);
+ void append(const char*, unsigned);
+
+ void append(const String& string)
+ {
+ // If we're appending to an empty string, and there is not buffer
+ // (in case reserveCapacity has been called) then just retain the
+ // string.
+ if (!m_length && !m_buffer) {
+ m_string = string;
+ m_length = string.length();
+ return;
+ }
+ append(string.characters(), string.length());
+ }
+
+ void append(const char* characters)
+ {
+ if (characters)
+ append(characters, strlen(characters));
+ }
+
+ void append(UChar c)
+ {
+ if (m_buffer && m_length < m_buffer->length() && m_string.isNull())
+ m_bufferCharacters[m_length++] = c;
+ else
+ append(&c, 1);
+ }
+
+ void append(char c)
+ {
+ if (m_buffer && m_length < m_buffer->length() && m_string.isNull())
+ m_bufferCharacters[m_length++] = (unsigned char)c;
+ else
+ append(&c, 1);
+ }
+
+ String toString()
+ {
+ if (m_string.isNull()) {
+ shrinkToFit();
+ reifyString();
+ }
+ return m_string;
+ }
+
+ String toStringPreserveCapacity()
+ {
+ if (m_string.isNull())
+ reifyString();
+ return m_string;
+ }
+
+ unsigned length() const
+ {
+ return m_length;
+ }
+
+ bool isEmpty() const { return !length(); }
+
+ void reserveCapacity(unsigned newCapacity);
+
+ void resize(unsigned newSize);
+
+ void shrinkToFit();
+
+ UChar operator[](unsigned i) const
+ {
+ ASSERT(i < m_length);
+ if (!m_string.isNull())
+ return m_string[i];
+ ASSERT(m_buffer);
+ return m_buffer->characters()[i];
+ }
+
+ void clear()
+ {
+ m_length = 0;
+ m_string = String();
+ m_buffer = 0;
+ }
+
+private:
+ void allocateBuffer(const UChar* currentCharacters, unsigned requiredLength);
+ UChar* appendUninitialized(unsigned length);
+ void reifyString();
+
+ unsigned m_length;
+ String m_string;
+ RefPtr<StringImpl> m_buffer;
+ UChar* m_bufferCharacters;
+};
+
+} // namespace WTF
+
+using WTF::StringBuilder;
+
+#endif // StringBuilder_h
diff --git a/Source/JavaScriptCore/wtf/text/StringConcatenate.h b/Source/JavaScriptCore/wtf/text/StringConcatenate.h
new file mode 100644
index 0000000..92a2d06
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/text/StringConcatenate.h
@@ -0,0 +1,493 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef StringConcatenate_h
+#define StringConcatenate_h
+
+#include <wtf/text/WTFString.h>
+
+namespace WTF {
+
+template<typename StringType>
+class StringTypeAdapter {
+};
+
+template<>
+class StringTypeAdapter<char> {
+public:
+ StringTypeAdapter<char>(char buffer)
+ : m_buffer(buffer)
+ {
+ }
+
+ unsigned length() { return 1; }
+ void writeTo(UChar* destination) { *destination = m_buffer; }
+
+private:
+ unsigned char m_buffer;
+};
+
+template<>
+class StringTypeAdapter<UChar> {
+public:
+ StringTypeAdapter<UChar>(UChar buffer)
+ : m_buffer(buffer)
+ {
+ }
+
+ unsigned length() { return 1; }
+ void writeTo(UChar* destination) { *destination = m_buffer; }
+
+private:
+ UChar m_buffer;
+};
+
+template<>
+class StringTypeAdapter<char*> {
+public:
+ StringTypeAdapter<char*>(char* buffer)
+ : m_buffer(buffer)
+ , m_length(strlen(buffer))
+ {
+ }
+
+ unsigned length() { return m_length; }
+
+ void writeTo(UChar* destination)
+ {
+ for (unsigned i = 0; i < m_length; ++i) {
+ unsigned char c = m_buffer[i];
+ destination[i] = c;
+ }
+ }
+
+private:
+ const char* m_buffer;
+ unsigned m_length;
+};
+
+template<>
+class StringTypeAdapter<const char*> {
+public:
+ StringTypeAdapter<const char*>(const char* buffer)
+ : m_buffer(buffer)
+ , m_length(strlen(buffer))
+ {
+ }
+
+ unsigned length() { return m_length; }
+
+ void writeTo(UChar* destination)
+ {
+ for (unsigned i = 0; i < m_length; ++i) {
+ unsigned char c = m_buffer[i];
+ destination[i] = c;
+ }
+ }
+
+private:
+ const char* m_buffer;
+ unsigned m_length;
+};
+
+template<>
+class StringTypeAdapter<Vector<char> > {
+public:
+ StringTypeAdapter<Vector<char> >(const Vector<char>& buffer)
+ : m_buffer(buffer)
+ {
+ }
+
+ size_t length() { return m_buffer.size(); }
+
+ void writeTo(UChar* destination)
+ {
+ for (size_t i = 0; i < m_buffer.size(); ++i) {
+ unsigned char c = m_buffer[i];
+ destination[i] = c;
+ }
+ }
+
+private:
+ const Vector<char>& m_buffer;
+};
+
+template<>
+class StringTypeAdapter<String> {
+public:
+ StringTypeAdapter<String>(const String& string)
+ : m_buffer(string)
+ {
+ }
+
+ unsigned length() { return m_buffer.length(); }
+
+ void writeTo(UChar* destination)
+ {
+ const UChar* data = m_buffer.characters();
+ unsigned length = m_buffer.length();
+ for (unsigned i = 0; i < length; ++i)
+ destination[i] = data[i];
+ }
+
+private:
+ const String& m_buffer;
+};
+
+inline void sumWithOverflow(unsigned& total, unsigned addend, bool& overflow)
+{
+ unsigned oldTotal = total;
+ total = oldTotal + addend;
+ if (total < oldTotal)
+ overflow = true;
+}
+
+template<typename StringType1, typename StringType2>
+PassRefPtr<StringImpl> tryMakeString(StringType1 string1, StringType2 string2)
+{
+ StringTypeAdapter<StringType1> adapter1(string1);
+ StringTypeAdapter<StringType2> adapter2(string2);
+
+ UChar* buffer;
+ bool overflow = false;
+ unsigned length = adapter1.length();
+ sumWithOverflow(length, adapter2.length(), overflow);
+ if (overflow)
+ return 0;
+ PassRefPtr<StringImpl> resultImpl = StringImpl::tryCreateUninitialized(length, buffer);
+ if (!resultImpl)
+ return 0;
+
+ UChar* result = buffer;
+ adapter1.writeTo(result);
+ result += adapter1.length();
+ adapter2.writeTo(result);
+
+ return resultImpl;
+}
+
+template<typename StringType1, typename StringType2, typename StringType3>
+PassRefPtr<StringImpl> tryMakeString(StringType1 string1, StringType2 string2, StringType3 string3)
+{
+ StringTypeAdapter<StringType1> adapter1(string1);
+ StringTypeAdapter<StringType2> adapter2(string2);
+ StringTypeAdapter<StringType3> adapter3(string3);
+
+ UChar* buffer = 0;
+ bool overflow = false;
+ unsigned length = adapter1.length();
+ sumWithOverflow(length, adapter2.length(), overflow);
+ sumWithOverflow(length, adapter3.length(), overflow);
+ if (overflow)
+ return 0;
+ PassRefPtr<StringImpl> resultImpl = StringImpl::tryCreateUninitialized(length, buffer);
+ if (!resultImpl)
+ return 0;
+
+ UChar* result = buffer;
+ adapter1.writeTo(result);
+ result += adapter1.length();
+ adapter2.writeTo(result);
+ result += adapter2.length();
+ adapter3.writeTo(result);
+
+ return resultImpl;
+}
+
+template<typename StringType1, typename StringType2, typename StringType3, typename StringType4>
+PassRefPtr<StringImpl> tryMakeString(StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4)
+{
+ StringTypeAdapter<StringType1> adapter1(string1);
+ StringTypeAdapter<StringType2> adapter2(string2);
+ StringTypeAdapter<StringType3> adapter3(string3);
+ StringTypeAdapter<StringType4> adapter4(string4);
+
+ UChar* buffer;
+ bool overflow = false;
+ unsigned length = adapter1.length();
+ sumWithOverflow(length, adapter2.length(), overflow);
+ sumWithOverflow(length, adapter3.length(), overflow);
+ sumWithOverflow(length, adapter4.length(), overflow);
+ if (overflow)
+ return 0;
+ PassRefPtr<StringImpl> resultImpl = StringImpl::tryCreateUninitialized(length, buffer);
+ if (!resultImpl)
+ return 0;
+
+ UChar* result = buffer;
+ adapter1.writeTo(result);
+ result += adapter1.length();
+ adapter2.writeTo(result);
+ result += adapter2.length();
+ adapter3.writeTo(result);
+ result += adapter3.length();
+ adapter4.writeTo(result);
+
+ return resultImpl;
+}
+
+template<typename StringType1, typename StringType2, typename StringType3, typename StringType4, typename StringType5>
+PassRefPtr<StringImpl> tryMakeString(StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4, StringType5 string5)
+{
+ StringTypeAdapter<StringType1> adapter1(string1);
+ StringTypeAdapter<StringType2> adapter2(string2);
+ StringTypeAdapter<StringType3> adapter3(string3);
+ StringTypeAdapter<StringType4> adapter4(string4);
+ StringTypeAdapter<StringType5> adapter5(string5);
+
+ UChar* buffer;
+ bool overflow = false;
+ unsigned length = adapter1.length();
+ sumWithOverflow(length, adapter2.length(), overflow);
+ sumWithOverflow(length, adapter3.length(), overflow);
+ sumWithOverflow(length, adapter4.length(), overflow);
+ sumWithOverflow(length, adapter5.length(), overflow);
+ if (overflow)
+ return 0;
+ PassRefPtr<StringImpl> resultImpl = StringImpl::tryCreateUninitialized(length, buffer);
+ if (!resultImpl)
+ return 0;
+
+ UChar* result = buffer;
+ adapter1.writeTo(result);
+ result += adapter1.length();
+ adapter2.writeTo(result);
+ result += adapter2.length();
+ adapter3.writeTo(result);
+ result += adapter3.length();
+ adapter4.writeTo(result);
+ result += adapter4.length();
+ adapter5.writeTo(result);
+
+ return resultImpl;
+}
+
+template<typename StringType1, typename StringType2, typename StringType3, typename StringType4, typename StringType5, typename StringType6>
+PassRefPtr<StringImpl> tryMakeString(StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4, StringType5 string5, StringType6 string6)
+{
+ StringTypeAdapter<StringType1> adapter1(string1);
+ StringTypeAdapter<StringType2> adapter2(string2);
+ StringTypeAdapter<StringType3> adapter3(string3);
+ StringTypeAdapter<StringType4> adapter4(string4);
+ StringTypeAdapter<StringType5> adapter5(string5);
+ StringTypeAdapter<StringType6> adapter6(string6);
+
+ UChar* buffer;
+ bool overflow = false;
+ unsigned length = adapter1.length();
+ sumWithOverflow(length, adapter2.length(), overflow);
+ sumWithOverflow(length, adapter3.length(), overflow);
+ sumWithOverflow(length, adapter4.length(), overflow);
+ sumWithOverflow(length, adapter5.length(), overflow);
+ sumWithOverflow(length, adapter6.length(), overflow);
+ if (overflow)
+ return 0;
+ PassRefPtr<StringImpl> resultImpl = StringImpl::tryCreateUninitialized(length, buffer);
+ if (!resultImpl)
+ return 0;
+
+ UChar* result = buffer;
+ adapter1.writeTo(result);
+ result += adapter1.length();
+ adapter2.writeTo(result);
+ result += adapter2.length();
+ adapter3.writeTo(result);
+ result += adapter3.length();
+ adapter4.writeTo(result);
+ result += adapter4.length();
+ adapter5.writeTo(result);
+ result += adapter5.length();
+ adapter6.writeTo(result);
+
+ return resultImpl;
+}
+
+template<typename StringType1, typename StringType2, typename StringType3, typename StringType4, typename StringType5, typename StringType6, typename StringType7>
+PassRefPtr<StringImpl> tryMakeString(StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4, StringType5 string5, StringType6 string6, StringType7 string7)
+{
+ StringTypeAdapter<StringType1> adapter1(string1);
+ StringTypeAdapter<StringType2> adapter2(string2);
+ StringTypeAdapter<StringType3> adapter3(string3);
+ StringTypeAdapter<StringType4> adapter4(string4);
+ StringTypeAdapter<StringType5> adapter5(string5);
+ StringTypeAdapter<StringType6> adapter6(string6);
+ StringTypeAdapter<StringType7> adapter7(string7);
+
+ UChar* buffer;
+ bool overflow = false;
+ unsigned length = adapter1.length();
+ sumWithOverflow(length, adapter2.length(), overflow);
+ sumWithOverflow(length, adapter3.length(), overflow);
+ sumWithOverflow(length, adapter4.length(), overflow);
+ sumWithOverflow(length, adapter5.length(), overflow);
+ sumWithOverflow(length, adapter6.length(), overflow);
+ sumWithOverflow(length, adapter7.length(), overflow);
+ if (overflow)
+ return 0;
+ PassRefPtr<StringImpl> resultImpl = StringImpl::tryCreateUninitialized(length, buffer);
+ if (!resultImpl)
+ return 0;
+
+ UChar* result = buffer;
+ adapter1.writeTo(result);
+ result += adapter1.length();
+ adapter2.writeTo(result);
+ result += adapter2.length();
+ adapter3.writeTo(result);
+ result += adapter3.length();
+ adapter4.writeTo(result);
+ result += adapter4.length();
+ adapter5.writeTo(result);
+ result += adapter5.length();
+ adapter6.writeTo(result);
+ result += adapter6.length();
+ adapter7.writeTo(result);
+
+ return resultImpl;
+}
+
+template<typename StringType1, typename StringType2, typename StringType3, typename StringType4, typename StringType5, typename StringType6, typename StringType7, typename StringType8>
+PassRefPtr<StringImpl> tryMakeString(StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4, StringType5 string5, StringType6 string6, StringType7 string7, StringType8 string8)
+{
+ StringTypeAdapter<StringType1> adapter1(string1);
+ StringTypeAdapter<StringType2> adapter2(string2);
+ StringTypeAdapter<StringType3> adapter3(string3);
+ StringTypeAdapter<StringType4> adapter4(string4);
+ StringTypeAdapter<StringType5> adapter5(string5);
+ StringTypeAdapter<StringType6> adapter6(string6);
+ StringTypeAdapter<StringType7> adapter7(string7);
+ StringTypeAdapter<StringType8> adapter8(string8);
+
+ UChar* buffer;
+ bool overflow = false;
+ unsigned length = adapter1.length();
+ sumWithOverflow(length, adapter2.length(), overflow);
+ sumWithOverflow(length, adapter3.length(), overflow);
+ sumWithOverflow(length, adapter4.length(), overflow);
+ sumWithOverflow(length, adapter5.length(), overflow);
+ sumWithOverflow(length, adapter6.length(), overflow);
+ sumWithOverflow(length, adapter7.length(), overflow);
+ sumWithOverflow(length, adapter8.length(), overflow);
+ if (overflow)
+ return 0;
+ PassRefPtr<StringImpl> resultImpl = StringImpl::tryCreateUninitialized(length, buffer);
+ if (!resultImpl)
+ return 0;
+
+ UChar* result = buffer;
+ adapter1.writeTo(result);
+ result += adapter1.length();
+ adapter2.writeTo(result);
+ result += adapter2.length();
+ adapter3.writeTo(result);
+ result += adapter3.length();
+ adapter4.writeTo(result);
+ result += adapter4.length();
+ adapter5.writeTo(result);
+ result += adapter5.length();
+ adapter6.writeTo(result);
+ result += adapter6.length();
+ adapter7.writeTo(result);
+ result += adapter7.length();
+ adapter8.writeTo(result);
+
+ return resultImpl;
+}
+
+// Convenience only.
+template<typename StringType1>
+String makeString(StringType1 string1)
+{
+ return String(string1);
+}
+
+template<typename StringType1, typename StringType2>
+String makeString(StringType1 string1, StringType2 string2)
+{
+ PassRefPtr<StringImpl> resultImpl = tryMakeString(string1, string2);
+ if (!resultImpl)
+ CRASH();
+ return resultImpl;
+}
+
+template<typename StringType1, typename StringType2, typename StringType3>
+String makeString(StringType1 string1, StringType2 string2, StringType3 string3)
+{
+ PassRefPtr<StringImpl> resultImpl = tryMakeString(string1, string2, string3);
+ if (!resultImpl)
+ CRASH();
+ return resultImpl;
+}
+
+template<typename StringType1, typename StringType2, typename StringType3, typename StringType4>
+String makeString(StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4)
+{
+ PassRefPtr<StringImpl> resultImpl = tryMakeString(string1, string2, string3, string4);
+ if (!resultImpl)
+ CRASH();
+ return resultImpl;
+}
+
+template<typename StringType1, typename StringType2, typename StringType3, typename StringType4, typename StringType5>
+String makeString(StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4, StringType5 string5)
+{
+ PassRefPtr<StringImpl> resultImpl = tryMakeString(string1, string2, string3, string4, string5);
+ if (!resultImpl)
+ CRASH();
+ return resultImpl;
+}
+
+template<typename StringType1, typename StringType2, typename StringType3, typename StringType4, typename StringType5, typename StringType6>
+String makeString(StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4, StringType5 string5, StringType6 string6)
+{
+ PassRefPtr<StringImpl> resultImpl = tryMakeString(string1, string2, string3, string4, string5, string6);
+ if (!resultImpl)
+ CRASH();
+ return resultImpl;
+}
+
+template<typename StringType1, typename StringType2, typename StringType3, typename StringType4, typename StringType5, typename StringType6, typename StringType7>
+String makeString(StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4, StringType5 string5, StringType6 string6, StringType7 string7)
+{
+ PassRefPtr<StringImpl> resultImpl = tryMakeString(string1, string2, string3, string4, string5, string6, string7);
+ if (!resultImpl)
+ CRASH();
+ return resultImpl;
+}
+
+template<typename StringType1, typename StringType2, typename StringType3, typename StringType4, typename StringType5, typename StringType6, typename StringType7, typename StringType8>
+String makeString(StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4, StringType5 string5, StringType6 string6, StringType7 string7, StringType8 string8)
+{
+ PassRefPtr<StringImpl> resultImpl = tryMakeString(string1, string2, string3, string4, string5, string6, string7, string8);
+ if (!resultImpl)
+ CRASH();
+ return resultImpl;
+}
+
+} // namespace WTF
+
+using WTF::makeString;
+
+#endif
diff --git a/Source/JavaScriptCore/wtf/text/StringHash.h b/Source/JavaScriptCore/wtf/text/StringHash.h
new file mode 100644
index 0000000..d7aabdb
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/text/StringHash.h
@@ -0,0 +1,194 @@
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved
+ * Copyright (C) Research In Motion Limited 2009. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef StringHash_h
+#define StringHash_h
+
+#include "AtomicString.h"
+#include "WTFString.h"
+#include <wtf/Forward.h>
+#include <wtf/HashTraits.h>
+#include <wtf/StringHasher.h>
+#include <wtf/unicode/Unicode.h>
+
+namespace WTF {
+
+ // The hash() functions on StringHash and CaseFoldingHash do not support
+ // null strings. get(), contains(), and add() on HashMap<String,..., StringHash>
+ // cause a null-pointer dereference when passed null strings.
+
+ // FIXME: We should really figure out a way to put the computeHash function that's
+ // currently a member function of StringImpl into this file so we can be a little
+ // closer to having all the nearly-identical hash functions in one place.
+
+ struct StringHash {
+ static unsigned hash(StringImpl* key) { return key->hash(); }
+ static bool equal(const StringImpl* a, const StringImpl* b)
+ {
+ if (a == b)
+ return true;
+ if (!a || !b)
+ return false;
+
+ unsigned aLength = a->length();
+ unsigned bLength = b->length();
+ if (aLength != bLength)
+ return false;
+
+ // FIXME: perhaps we should have a more abstract macro that indicates when
+ // going 4 bytes at a time is unsafe
+#if CPU(ARM) || CPU(SH4) || CPU(MIPS)
+ const UChar* aChars = a->characters();
+ const UChar* bChars = b->characters();
+ for (unsigned i = 0; i != aLength; ++i) {
+ if (*aChars++ != *bChars++)
+ return false;
+ }
+ return true;
+#else
+ /* Do it 4-bytes-at-a-time on architectures where it's safe */
+ const uint32_t* aChars = reinterpret_cast<const uint32_t*>(a->characters());
+ const uint32_t* bChars = reinterpret_cast<const uint32_t*>(b->characters());
+
+ unsigned halfLength = aLength >> 1;
+ for (unsigned i = 0; i != halfLength; ++i)
+ if (*aChars++ != *bChars++)
+ return false;
+
+ if (aLength & 1 && *reinterpret_cast<const uint16_t*>(aChars) != *reinterpret_cast<const uint16_t*>(bChars))
+ return false;
+
+ return true;
+#endif
+ }
+
+ static unsigned hash(const RefPtr<StringImpl>& key) { return key->hash(); }
+ static bool equal(const RefPtr<StringImpl>& a, const RefPtr<StringImpl>& b)
+ {
+ return equal(a.get(), b.get());
+ }
+
+ static unsigned hash(const String& key) { return key.impl()->hash(); }
+ static bool equal(const String& a, const String& b)
+ {
+ return equal(a.impl(), b.impl());
+ }
+
+ static const bool safeToCompareToEmptyOrDeleted = false;
+ };
+
+ class CaseFoldingHash {
+ public:
+ template<typename T> static inline UChar foldCase(T ch)
+ {
+ return WTF::Unicode::foldCase(ch);
+ }
+
+ static unsigned hash(const UChar* data, unsigned length)
+ {
+ return StringHasher::createHash<UChar, foldCase<UChar> >(data, length);
+ }
+
+ static unsigned hash(StringImpl* str)
+ {
+ return hash(str->characters(), str->length());
+ }
+
+ static unsigned hash(const char* data, unsigned length)
+ {
+ return StringHasher::createHash<char, foldCase<char> >(data, length);
+ }
+
+ static bool equal(const StringImpl* a, const StringImpl* b)
+ {
+ if (a == b)
+ return true;
+ if (!a || !b)
+ return false;
+ unsigned length = a->length();
+ if (length != b->length())
+ return false;
+ return WTF::Unicode::umemcasecmp(a->characters(), b->characters(), length) == 0;
+ }
+
+ static unsigned hash(const RefPtr<StringImpl>& key)
+ {
+ return hash(key.get());
+ }
+
+ static bool equal(const RefPtr<StringImpl>& a, const RefPtr<StringImpl>& b)
+ {
+ return equal(a.get(), b.get());
+ }
+
+ static unsigned hash(const String& key)
+ {
+ return hash(key.impl());
+ }
+ static unsigned hash(const AtomicString& key)
+ {
+ return hash(key.impl());
+ }
+ static bool equal(const String& a, const String& b)
+ {
+ return equal(a.impl(), b.impl());
+ }
+ static bool equal(const AtomicString& a, const AtomicString& b)
+ {
+ return (a == b) || equal(a.impl(), b.impl());
+ }
+
+ static const bool safeToCompareToEmptyOrDeleted = false;
+ };
+
+ // This hash can be used in cases where the key is a hash of a string, but we don't
+ // want to store the string. It's not really specific to string hashing, but all our
+ // current uses of it are for strings.
+ struct AlreadyHashed : IntHash<unsigned> {
+ static unsigned hash(unsigned key) { return key; }
+
+ // To use a hash value as a key for a hash table, we need to eliminate the
+ // "deleted" value, which is negative one. That could be done by changing
+ // the string hash function to never generate negative one, but this works
+ // and is still relatively efficient.
+ static unsigned avoidDeletedValue(unsigned hash)
+ {
+ ASSERT(hash);
+ unsigned newHash = hash | (!(hash + 1) << 31);
+ ASSERT(newHash);
+ ASSERT(newHash != 0xFFFFFFFF);
+ return newHash;
+ }
+ };
+
+ template<> struct HashTraits<String> : GenericHashTraits<String> {
+ static const bool emptyValueIsZero = true;
+ static void constructDeletedValue(String& slot) { new (&slot) String(HashTableDeletedValue); }
+ static bool isDeletedValue(const String& slot) { return slot.isHashTableDeletedValue(); }
+ };
+
+}
+
+using WTF::StringHash;
+using WTF::CaseFoldingHash;
+using WTF::AlreadyHashed;
+
+#endif
diff --git a/Source/JavaScriptCore/wtf/text/StringImpl.cpp b/Source/JavaScriptCore/wtf/text/StringImpl.cpp
new file mode 100644
index 0000000..c83ec42
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/text/StringImpl.cpp
@@ -0,0 +1,1073 @@
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * (C) 2001 Dirk Mueller ( mueller@kde.org )
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+#include "StringImpl.h"
+
+#include "AtomicString.h"
+#include "StringBuffer.h"
+#include "StringHash.h"
+#include <wtf/StdLibExtras.h>
+#include <wtf/WTFThreadData.h>
+
+using namespace std;
+
+namespace WTF {
+
+using namespace Unicode;
+
+static const unsigned minLengthToShare = 20;
+
+COMPILE_ASSERT(sizeof(StringImpl) == 2 * sizeof(int) + 3 * sizeof(void*), StringImpl_should_stay_small);
+
+StringImpl::~StringImpl()
+{
+ ASSERT(!isStatic());
+
+ if (isAtomic())
+ AtomicString::remove(this);
+#if USE(JSC)
+ if (isIdentifier()) {
+ if (!wtfThreadData().currentIdentifierTable()->remove(this))
+ CRASH();
+ }
+#endif
+
+ BufferOwnership ownership = bufferOwnership();
+ if (ownership != BufferInternal) {
+ if (ownership == BufferOwned) {
+ ASSERT(!m_sharedBuffer);
+ ASSERT(m_data);
+ fastFree(const_cast<UChar*>(m_data));
+ } else if (ownership == BufferSubstring) {
+ ASSERT(m_substringBuffer);
+ m_substringBuffer->deref();
+ } else {
+ ASSERT(ownership == BufferShared);
+ ASSERT(m_sharedBuffer);
+ m_sharedBuffer->deref();
+ }
+ }
+}
+
+PassRefPtr<StringImpl> StringImpl::createUninitialized(unsigned length, UChar*& data)
+{
+ if (!length) {
+ data = 0;
+ return empty();
+ }
+
+ // Allocate a single buffer large enough to contain the StringImpl
+ // struct as well as the data which it contains. This removes one
+ // heap allocation from this call.
+ if (length > ((std::numeric_limits<unsigned>::max() - sizeof(StringImpl)) / sizeof(UChar)))
+ CRASH();
+ size_t size = sizeof(StringImpl) + length * sizeof(UChar);
+ StringImpl* string = static_cast<StringImpl*>(fastMalloc(size));
+
+ data = reinterpret_cast<UChar*>(string + 1);
+ return adoptRef(new (string) StringImpl(length));
+}
+
+PassRefPtr<StringImpl> StringImpl::create(const UChar* characters, unsigned length)
+{
+ if (!characters || !length)
+ return empty();
+
+ UChar* data;
+ RefPtr<StringImpl> string = createUninitialized(length, data);
+ memcpy(data, characters, length * sizeof(UChar));
+ return string.release();
+}
+
+PassRefPtr<StringImpl> StringImpl::create(const char* characters, unsigned length)
+{
+ if (!characters || !length)
+ return empty();
+
+ UChar* data;
+ RefPtr<StringImpl> string = createUninitialized(length, data);
+ for (unsigned i = 0; i != length; ++i) {
+ unsigned char c = characters[i];
+ data[i] = c;
+ }
+ return string.release();
+}
+
+PassRefPtr<StringImpl> StringImpl::create(const char* string)
+{
+ if (!string)
+ return empty();
+ size_t length = strlen(string);
+ if (length > numeric_limits<unsigned>::max())
+ CRASH();
+ return create(string, length);
+}
+
+PassRefPtr<StringImpl> StringImpl::create(const UChar* characters, unsigned length, PassRefPtr<SharedUChar> sharedBuffer)
+{
+ ASSERT(characters);
+ ASSERT(minLengthToShare && length >= minLengthToShare);
+ return adoptRef(new StringImpl(characters, length, sharedBuffer));
+}
+
+SharedUChar* StringImpl::sharedBuffer()
+{
+ if (m_length < minLengthToShare)
+ return 0;
+ // All static strings are smaller that the minimim length to share.
+ ASSERT(!isStatic());
+
+ BufferOwnership ownership = bufferOwnership();
+
+ if (ownership == BufferInternal)
+ return 0;
+ if (ownership == BufferSubstring)
+ return m_substringBuffer->sharedBuffer();
+ if (ownership == BufferOwned) {
+ ASSERT(!m_sharedBuffer);
+ m_sharedBuffer = SharedUChar::create(new SharableUChar(m_data)).leakRef();
+ m_refCountAndFlags = (m_refCountAndFlags & ~s_refCountMaskBufferOwnership) | BufferShared;
+ }
+
+ ASSERT(bufferOwnership() == BufferShared);
+ ASSERT(m_sharedBuffer);
+ return m_sharedBuffer;
+}
+
+bool StringImpl::containsOnlyWhitespace()
+{
+ // FIXME: The definition of whitespace here includes a number of characters
+ // that are not whitespace from the point of view of RenderText; I wonder if
+ // that's a problem in practice.
+ for (unsigned i = 0; i < m_length; i++)
+ if (!isASCIISpace(m_data[i]))
+ return false;
+ return true;
+}
+
+PassRefPtr<StringImpl> StringImpl::substring(unsigned start, unsigned length)
+{
+ if (start >= m_length)
+ return empty();
+ unsigned maxLength = m_length - start;
+ if (length >= maxLength) {
+ if (!start)
+ return this;
+ length = maxLength;
+ }
+ return create(m_data + start, length);
+}
+
+UChar32 StringImpl::characterStartingAt(unsigned i)
+{
+ if (U16_IS_SINGLE(m_data[i]))
+ return m_data[i];
+ if (i + 1 < m_length && U16_IS_LEAD(m_data[i]) && U16_IS_TRAIL(m_data[i + 1]))
+ return U16_GET_SUPPLEMENTARY(m_data[i], m_data[i + 1]);
+ return 0;
+}
+
+PassRefPtr<StringImpl> StringImpl::lower()
+{
+ // Note: This is a hot function in the Dromaeo benchmark, specifically the
+ // no-op code path up through the first 'return' statement.
+
+ // First scan the string for uppercase and non-ASCII characters:
+ UChar ored = 0;
+ bool noUpper = true;
+ const UChar *end = m_data + m_length;
+ for (const UChar* chp = m_data; chp != end; chp++) {
+ if (UNLIKELY(isASCIIUpper(*chp)))
+ noUpper = false;
+ ored |= *chp;
+ }
+
+ // Nothing to do if the string is all ASCII with no uppercase.
+ if (noUpper && !(ored & ~0x7F))
+ return this;
+
+ if (m_length > static_cast<unsigned>(numeric_limits<int32_t>::max()))
+ CRASH();
+ int32_t length = m_length;
+
+ UChar* data;
+ RefPtr<StringImpl> newImpl = createUninitialized(m_length, data);
+
+ if (!(ored & ~0x7F)) {
+ // Do a faster loop for the case where all the characters are ASCII.
+ for (int i = 0; i < length; i++) {
+ UChar c = m_data[i];
+ data[i] = toASCIILower(c);
+ }
+ return newImpl;
+ }
+
+ // Do a slower implementation for cases that include non-ASCII characters.
+ bool error;
+ int32_t realLength = Unicode::toLower(data, length, m_data, m_length, &error);
+ if (!error && realLength == length)
+ return newImpl;
+ newImpl = createUninitialized(realLength, data);
+ Unicode::toLower(data, realLength, m_data, m_length, &error);
+ if (error)
+ return this;
+ return newImpl;
+}
+
+PassRefPtr<StringImpl> StringImpl::upper()
+{
+ // This function could be optimized for no-op cases the way lower() is,
+ // but in empirical testing, few actual calls to upper() are no-ops, so
+ // it wouldn't be worth the extra time for pre-scanning.
+ UChar* data;
+ RefPtr<StringImpl> newImpl = createUninitialized(m_length, data);
+
+ if (m_length > static_cast<unsigned>(numeric_limits<int32_t>::max()))
+ CRASH();
+ int32_t length = m_length;
+
+ // Do a faster loop for the case where all the characters are ASCII.
+ UChar ored = 0;
+ for (int i = 0; i < length; i++) {
+ UChar c = m_data[i];
+ ored |= c;
+ data[i] = toASCIIUpper(c);
+ }
+ if (!(ored & ~0x7F))
+ return newImpl.release();
+
+ // Do a slower implementation for cases that include non-ASCII characters.
+ bool error;
+ int32_t realLength = Unicode::toUpper(data, length, m_data, m_length, &error);
+ if (!error && realLength == length)
+ return newImpl;
+ newImpl = createUninitialized(realLength, data);
+ Unicode::toUpper(data, realLength, m_data, m_length, &error);
+ if (error)
+ return this;
+ return newImpl.release();
+}
+
+PassRefPtr<StringImpl> StringImpl::secure(UChar character, LastCharacterBehavior behavior)
+{
+ if (!m_length)
+ return this;
+
+ UChar* data;
+ RefPtr<StringImpl> newImpl = createUninitialized(m_length, data);
+ unsigned lastCharacterIndex = m_length - 1;
+ for (unsigned i = 0; i < lastCharacterIndex; ++i)
+ data[i] = character;
+ data[lastCharacterIndex] = (behavior == ObscureLastCharacter) ? character : m_data[lastCharacterIndex];
+ return newImpl.release();
+}
+
+PassRefPtr<StringImpl> StringImpl::foldCase()
+{
+ UChar* data;
+ RefPtr<StringImpl> newImpl = createUninitialized(m_length, data);
+
+ if (m_length > static_cast<unsigned>(numeric_limits<int32_t>::max()))
+ CRASH();
+ int32_t length = m_length;
+
+ // Do a faster loop for the case where all the characters are ASCII.
+ UChar ored = 0;
+ for (int32_t i = 0; i < length; i++) {
+ UChar c = m_data[i];
+ ored |= c;
+ data[i] = toASCIILower(c);
+ }
+ if (!(ored & ~0x7F))
+ return newImpl.release();
+
+ // Do a slower implementation for cases that include non-ASCII characters.
+ bool error;
+ int32_t realLength = Unicode::foldCase(data, length, m_data, m_length, &error);
+ if (!error && realLength == length)
+ return newImpl.release();
+ newImpl = createUninitialized(realLength, data);
+ Unicode::foldCase(data, realLength, m_data, m_length, &error);
+ if (error)
+ return this;
+ return newImpl.release();
+}
+
+PassRefPtr<StringImpl> StringImpl::stripWhiteSpace()
+{
+ if (!m_length)
+ return empty();
+
+ unsigned start = 0;
+ unsigned end = m_length - 1;
+
+ // skip white space from start
+ while (start <= end && isSpaceOrNewline(m_data[start]))
+ start++;
+
+ // only white space
+ if (start > end)
+ return empty();
+
+ // skip white space from end
+ while (end && isSpaceOrNewline(m_data[end]))
+ end--;
+
+ if (!start && end == m_length - 1)
+ return this;
+ return create(m_data + start, end + 1 - start);
+}
+
+PassRefPtr<StringImpl> StringImpl::removeCharacters(CharacterMatchFunctionPtr findMatch)
+{
+ const UChar* from = m_data;
+ const UChar* fromend = from + m_length;
+
+ // Assume the common case will not remove any characters
+ while (from != fromend && !findMatch(*from))
+ from++;
+ if (from == fromend)
+ return this;
+
+ StringBuffer data(m_length);
+ UChar* to = data.characters();
+ unsigned outc = from - m_data;
+
+ if (outc)
+ memcpy(to, m_data, outc * sizeof(UChar));
+
+ while (true) {
+ while (from != fromend && findMatch(*from))
+ from++;
+ while (from != fromend && !findMatch(*from))
+ to[outc++] = *from++;
+ if (from == fromend)
+ break;
+ }
+
+ data.shrink(outc);
+
+ return adopt(data);
+}
+
+PassRefPtr<StringImpl> StringImpl::simplifyWhiteSpace()
+{
+ StringBuffer data(m_length);
+
+ const UChar* from = m_data;
+ const UChar* fromend = from + m_length;
+ int outc = 0;
+ bool changedToSpace = false;
+
+ UChar* to = data.characters();
+
+ while (true) {
+ while (from != fromend && isSpaceOrNewline(*from)) {
+ if (*from != ' ')
+ changedToSpace = true;
+ from++;
+ }
+ while (from != fromend && !isSpaceOrNewline(*from))
+ to[outc++] = *from++;
+ if (from != fromend)
+ to[outc++] = ' ';
+ else
+ break;
+ }
+
+ if (outc > 0 && to[outc - 1] == ' ')
+ outc--;
+
+ if (static_cast<unsigned>(outc) == m_length && !changedToSpace)
+ return this;
+
+ data.shrink(outc);
+
+ return adopt(data);
+}
+
+int StringImpl::toIntStrict(bool* ok, int base)
+{
+ return charactersToIntStrict(m_data, m_length, ok, base);
+}
+
+unsigned StringImpl::toUIntStrict(bool* ok, int base)
+{
+ return charactersToUIntStrict(m_data, m_length, ok, base);
+}
+
+int64_t StringImpl::toInt64Strict(bool* ok, int base)
+{
+ return charactersToInt64Strict(m_data, m_length, ok, base);
+}
+
+uint64_t StringImpl::toUInt64Strict(bool* ok, int base)
+{
+ return charactersToUInt64Strict(m_data, m_length, ok, base);
+}
+
+intptr_t StringImpl::toIntPtrStrict(bool* ok, int base)
+{
+ return charactersToIntPtrStrict(m_data, m_length, ok, base);
+}
+
+int StringImpl::toInt(bool* ok)
+{
+ return charactersToInt(m_data, m_length, ok);
+}
+
+unsigned StringImpl::toUInt(bool* ok)
+{
+ return charactersToUInt(m_data, m_length, ok);
+}
+
+int64_t StringImpl::toInt64(bool* ok)
+{
+ return charactersToInt64(m_data, m_length, ok);
+}
+
+uint64_t StringImpl::toUInt64(bool* ok)
+{
+ return charactersToUInt64(m_data, m_length, ok);
+}
+
+intptr_t StringImpl::toIntPtr(bool* ok)
+{
+ return charactersToIntPtr(m_data, m_length, ok);
+}
+
+double StringImpl::toDouble(bool* ok)
+{
+ return charactersToDouble(m_data, m_length, ok);
+}
+
+float StringImpl::toFloat(bool* ok)
+{
+ return charactersToFloat(m_data, m_length, ok);
+}
+
+static bool equal(const UChar* a, const char* b, int length)
+{
+ ASSERT(length >= 0);
+ while (length--) {
+ unsigned char bc = *b++;
+ if (*a++ != bc)
+ return false;
+ }
+ return true;
+}
+
+bool equalIgnoringCase(const UChar* a, const char* b, unsigned length)
+{
+ while (length--) {
+ unsigned char bc = *b++;
+ if (foldCase(*a++) != foldCase(bc))
+ return false;
+ }
+ return true;
+}
+
+static inline bool equalIgnoringCase(const UChar* a, const UChar* b, int length)
+{
+ ASSERT(length >= 0);
+ return umemcasecmp(a, b, length) == 0;
+}
+
+int codePointCompare(const StringImpl* s1, const StringImpl* s2)
+{
+ const unsigned l1 = s1 ? s1->length() : 0;
+ const unsigned l2 = s2 ? s2->length() : 0;
+ const unsigned lmin = l1 < l2 ? l1 : l2;
+ const UChar* c1 = s1 ? s1->characters() : 0;
+ const UChar* c2 = s2 ? s2->characters() : 0;
+ unsigned pos = 0;
+ while (pos < lmin && *c1 == *c2) {
+ c1++;
+ c2++;
+ pos++;
+ }
+
+ if (pos < lmin)
+ return (c1[0] > c2[0]) ? 1 : -1;
+
+ if (l1 == l2)
+ return 0;
+
+ return (l1 > l2) ? 1 : -1;
+}
+
+size_t StringImpl::find(UChar c, unsigned start)
+{
+ return WTF::find(m_data, m_length, c, start);
+}
+
+size_t StringImpl::find(CharacterMatchFunctionPtr matchFunction, unsigned start)
+{
+ return WTF::find(m_data, m_length, matchFunction, start);
+}
+
+size_t StringImpl::find(const char* matchString, unsigned index)
+{
+ // Check for null or empty string to match against
+ if (!matchString)
+ return notFound;
+ size_t matchStringLength = strlen(matchString);
+ if (matchStringLength > numeric_limits<unsigned>::max())
+ CRASH();
+ unsigned matchLength = matchStringLength;
+ if (!matchLength)
+ return min(index, length());
+
+ // Optimization 1: fast case for strings of length 1.
+ if (matchLength == 1)
+ return WTF::find(characters(), length(), *(const unsigned char*)matchString, index);
+
+ // Check index & matchLength are in range.
+ if (index > length())
+ return notFound;
+ unsigned searchLength = length() - index;
+ if (matchLength > searchLength)
+ return notFound;
+ // delta is the number of additional times to test; delta == 0 means test only once.
+ unsigned delta = searchLength - matchLength;
+
+ const UChar* searchCharacters = characters() + index;
+ const unsigned char* matchCharacters = (const unsigned char*)matchString;
+
+ // Optimization 2: keep a running hash of the strings,
+ // only call memcmp if the hashes match.
+ unsigned searchHash = 0;
+ unsigned matchHash = 0;
+ for (unsigned i = 0; i < matchLength; ++i) {
+ searchHash += searchCharacters[i];
+ matchHash += matchCharacters[i];
+ }
+
+ unsigned i = 0;
+ // keep looping until we match
+ while (searchHash != matchHash || !equal(searchCharacters + i, matchString, matchLength)) {
+ if (i == delta)
+ return notFound;
+ searchHash += searchCharacters[i + matchLength];
+ searchHash -= searchCharacters[i];
+ ++i;
+ }
+ return index + i;
+}
+
+size_t StringImpl::findIgnoringCase(const char* matchString, unsigned index)
+{
+ // Check for null or empty string to match against
+ if (!matchString)
+ return notFound;
+ size_t matchStringLength = strlen(matchString);
+ if (matchStringLength > numeric_limits<unsigned>::max())
+ CRASH();
+ unsigned matchLength = matchStringLength;
+ if (!matchLength)
+ return min(index, length());
+
+ // Check index & matchLength are in range.
+ if (index > length())
+ return notFound;
+ unsigned searchLength = length() - index;
+ if (matchLength > searchLength)
+ return notFound;
+ // delta is the number of additional times to test; delta == 0 means test only once.
+ unsigned delta = searchLength - matchLength;
+
+ const UChar* searchCharacters = characters() + index;
+
+ unsigned i = 0;
+ // keep looping until we match
+ while (!equalIgnoringCase(searchCharacters + i, matchString, matchLength)) {
+ if (i == delta)
+ return notFound;
+ ++i;
+ }
+ return index + i;
+}
+
+size_t StringImpl::find(StringImpl* matchString, unsigned index)
+{
+ // Check for null or empty string to match against
+ if (!matchString)
+ return notFound;
+ unsigned matchLength = matchString->length();
+ if (!matchLength)
+ return min(index, length());
+
+ // Optimization 1: fast case for strings of length 1.
+ if (matchLength == 1)
+ return WTF::find(characters(), length(), matchString->characters()[0], index);
+
+ // Check index & matchLength are in range.
+ if (index > length())
+ return notFound;
+ unsigned searchLength = length() - index;
+ if (matchLength > searchLength)
+ return notFound;
+ // delta is the number of additional times to test; delta == 0 means test only once.
+ unsigned delta = searchLength - matchLength;
+
+ const UChar* searchCharacters = characters() + index;
+ const UChar* matchCharacters = matchString->characters();
+
+ // Optimization 2: keep a running hash of the strings,
+ // only call memcmp if the hashes match.
+ unsigned searchHash = 0;
+ unsigned matchHash = 0;
+ for (unsigned i = 0; i < matchLength; ++i) {
+ searchHash += searchCharacters[i];
+ matchHash += matchCharacters[i];
+ }
+
+ unsigned i = 0;
+ // keep looping until we match
+ while (searchHash != matchHash || memcmp(searchCharacters + i, matchCharacters, matchLength * sizeof(UChar))) {
+ if (i == delta)
+ return notFound;
+ searchHash += searchCharacters[i + matchLength];
+ searchHash -= searchCharacters[i];
+ ++i;
+ }
+ return index + i;
+}
+
+size_t StringImpl::findIgnoringCase(StringImpl* matchString, unsigned index)
+{
+ // Check for null or empty string to match against
+ if (!matchString)
+ return notFound;
+ unsigned matchLength = matchString->length();
+ if (!matchLength)
+ return min(index, length());
+
+ // Check index & matchLength are in range.
+ if (index > length())
+ return notFound;
+ unsigned searchLength = length() - index;
+ if (matchLength > searchLength)
+ return notFound;
+ // delta is the number of additional times to test; delta == 0 means test only once.
+ unsigned delta = searchLength - matchLength;
+
+ const UChar* searchCharacters = characters() + index;
+ const UChar* matchCharacters = matchString->characters();
+
+ unsigned i = 0;
+ // keep looping until we match
+ while (!equalIgnoringCase(searchCharacters + i, matchCharacters, matchLength)) {
+ if (i == delta)
+ return notFound;
+ ++i;
+ }
+ return index + i;
+}
+
+size_t StringImpl::reverseFind(UChar c, unsigned index)
+{
+ return WTF::reverseFind(m_data, m_length, c, index);
+}
+
+size_t StringImpl::reverseFind(StringImpl* matchString, unsigned index)
+{
+ // Check for null or empty string to match against
+ if (!matchString)
+ return notFound;
+ unsigned matchLength = matchString->length();
+ if (!matchLength)
+ return min(index, length());
+
+ // Optimization 1: fast case for strings of length 1.
+ if (matchLength == 1)
+ return WTF::reverseFind(characters(), length(), matchString->characters()[0], index);
+
+ // Check index & matchLength are in range.
+ if (matchLength > length())
+ return notFound;
+ // delta is the number of additional times to test; delta == 0 means test only once.
+ unsigned delta = min(index, length() - matchLength);
+
+ const UChar *searchCharacters = characters();
+ const UChar *matchCharacters = matchString->characters();
+
+ // Optimization 2: keep a running hash of the strings,
+ // only call memcmp if the hashes match.
+ unsigned searchHash = 0;
+ unsigned matchHash = 0;
+ for (unsigned i = 0; i < matchLength; ++i) {
+ searchHash += searchCharacters[delta + i];
+ matchHash += matchCharacters[i];
+ }
+
+ // keep looping until we match
+ while (searchHash != matchHash || memcmp(searchCharacters + delta, matchCharacters, matchLength * sizeof(UChar))) {
+ if (!delta)
+ return notFound;
+ delta--;
+ searchHash -= searchCharacters[delta + matchLength];
+ searchHash += searchCharacters[delta];
+ }
+ return delta;
+}
+
+size_t StringImpl::reverseFindIgnoringCase(StringImpl* matchString, unsigned index)
+{
+ // Check for null or empty string to match against
+ if (!matchString)
+ return notFound;
+ unsigned matchLength = matchString->length();
+ if (!matchLength)
+ return min(index, length());
+
+ // Check index & matchLength are in range.
+ if (matchLength > length())
+ return notFound;
+ // delta is the number of additional times to test; delta == 0 means test only once.
+ unsigned delta = min(index, length() - matchLength);
+
+ const UChar *searchCharacters = characters();
+ const UChar *matchCharacters = matchString->characters();
+
+ // keep looping until we match
+ while (!equalIgnoringCase(searchCharacters + delta, matchCharacters, matchLength)) {
+ if (!delta)
+ return notFound;
+ delta--;
+ }
+ return delta;
+}
+
+bool StringImpl::endsWith(StringImpl* m_data, bool caseSensitive)
+{
+ ASSERT(m_data);
+ if (m_length >= m_data->m_length) {
+ unsigned start = m_length - m_data->m_length;
+ return (caseSensitive ? find(m_data, start) : findIgnoringCase(m_data, start)) == start;
+ }
+ return false;
+}
+
+PassRefPtr<StringImpl> StringImpl::replace(UChar oldC, UChar newC)
+{
+ if (oldC == newC)
+ return this;
+ unsigned i;
+ for (i = 0; i != m_length; ++i)
+ if (m_data[i] == oldC)
+ break;
+ if (i == m_length)
+ return this;
+
+ UChar* data;
+ RefPtr<StringImpl> newImpl = createUninitialized(m_length, data);
+
+ for (i = 0; i != m_length; ++i) {
+ UChar ch = m_data[i];
+ if (ch == oldC)
+ ch = newC;
+ data[i] = ch;
+ }
+ return newImpl.release();
+}
+
+PassRefPtr<StringImpl> StringImpl::replace(unsigned position, unsigned lengthToReplace, StringImpl* str)
+{
+ position = min(position, length());
+ lengthToReplace = min(lengthToReplace, length() - position);
+ unsigned lengthToInsert = str ? str->length() : 0;
+ if (!lengthToReplace && !lengthToInsert)
+ return this;
+ UChar* data;
+
+ if ((length() - lengthToReplace) >= (numeric_limits<unsigned>::max() - lengthToInsert))
+ CRASH();
+
+ RefPtr<StringImpl> newImpl =
+ createUninitialized(length() - lengthToReplace + lengthToInsert, data);
+ memcpy(data, characters(), position * sizeof(UChar));
+ if (str)
+ memcpy(data + position, str->characters(), lengthToInsert * sizeof(UChar));
+ memcpy(data + position + lengthToInsert, characters() + position + lengthToReplace,
+ (length() - position - lengthToReplace) * sizeof(UChar));
+ return newImpl.release();
+}
+
+PassRefPtr<StringImpl> StringImpl::replace(UChar pattern, StringImpl* replacement)
+{
+ if (!replacement)
+ return this;
+
+ unsigned repStrLength = replacement->length();
+ size_t srcSegmentStart = 0;
+ unsigned matchCount = 0;
+
+ // Count the matches
+ while ((srcSegmentStart = find(pattern, srcSegmentStart)) != notFound) {
+ ++matchCount;
+ ++srcSegmentStart;
+ }
+
+ // If we have 0 matches, we don't have to do any more work
+ if (!matchCount)
+ return this;
+
+ if (repStrLength && matchCount > numeric_limits<unsigned>::max() / repStrLength)
+ CRASH();
+
+ unsigned replaceSize = matchCount * repStrLength;
+ unsigned newSize = m_length - matchCount;
+ if (newSize >= (numeric_limits<unsigned>::max() - replaceSize))
+ CRASH();
+
+ newSize += replaceSize;
+
+ UChar* data;
+ RefPtr<StringImpl> newImpl = createUninitialized(newSize, data);
+
+ // Construct the new data
+ size_t srcSegmentEnd;
+ unsigned srcSegmentLength;
+ srcSegmentStart = 0;
+ unsigned dstOffset = 0;
+
+ while ((srcSegmentEnd = find(pattern, srcSegmentStart)) != notFound) {
+ srcSegmentLength = srcSegmentEnd - srcSegmentStart;
+ memcpy(data + dstOffset, m_data + srcSegmentStart, srcSegmentLength * sizeof(UChar));
+ dstOffset += srcSegmentLength;
+ memcpy(data + dstOffset, replacement->m_data, repStrLength * sizeof(UChar));
+ dstOffset += repStrLength;
+ srcSegmentStart = srcSegmentEnd + 1;
+ }
+
+ srcSegmentLength = m_length - srcSegmentStart;
+ memcpy(data + dstOffset, m_data + srcSegmentStart, srcSegmentLength * sizeof(UChar));
+
+ ASSERT(dstOffset + srcSegmentLength == newImpl->length());
+
+ return newImpl.release();
+}
+
+PassRefPtr<StringImpl> StringImpl::replace(StringImpl* pattern, StringImpl* replacement)
+{
+ if (!pattern || !replacement)
+ return this;
+
+ unsigned patternLength = pattern->length();
+ if (!patternLength)
+ return this;
+
+ unsigned repStrLength = replacement->length();
+ size_t srcSegmentStart = 0;
+ unsigned matchCount = 0;
+
+ // Count the matches
+ while ((srcSegmentStart = find(pattern, srcSegmentStart)) != notFound) {
+ ++matchCount;
+ srcSegmentStart += patternLength;
+ }
+
+ // If we have 0 matches, we don't have to do any more work
+ if (!matchCount)
+ return this;
+
+ unsigned newSize = m_length - matchCount * patternLength;
+ if (repStrLength && matchCount > numeric_limits<unsigned>::max() / repStrLength)
+ CRASH();
+
+ if (newSize > (numeric_limits<unsigned>::max() - matchCount * repStrLength))
+ CRASH();
+
+ newSize += matchCount * repStrLength;
+
+ UChar* data;
+ RefPtr<StringImpl> newImpl = createUninitialized(newSize, data);
+
+ // Construct the new data
+ size_t srcSegmentEnd;
+ unsigned srcSegmentLength;
+ srcSegmentStart = 0;
+ unsigned dstOffset = 0;
+
+ while ((srcSegmentEnd = find(pattern, srcSegmentStart)) != notFound) {
+ srcSegmentLength = srcSegmentEnd - srcSegmentStart;
+ memcpy(data + dstOffset, m_data + srcSegmentStart, srcSegmentLength * sizeof(UChar));
+ dstOffset += srcSegmentLength;
+ memcpy(data + dstOffset, replacement->m_data, repStrLength * sizeof(UChar));
+ dstOffset += repStrLength;
+ srcSegmentStart = srcSegmentEnd + patternLength;
+ }
+
+ srcSegmentLength = m_length - srcSegmentStart;
+ memcpy(data + dstOffset, m_data + srcSegmentStart, srcSegmentLength * sizeof(UChar));
+
+ ASSERT(dstOffset + srcSegmentLength == newImpl->length());
+
+ return newImpl.release();
+}
+
+bool equal(const StringImpl* a, const StringImpl* b)
+{
+ return StringHash::equal(a, b);
+}
+
+bool equal(const StringImpl* a, const char* b)
+{
+ if (!a)
+ return !b;
+ if (!b)
+ return !a;
+
+ unsigned length = a->length();
+ const UChar* as = a->characters();
+ for (unsigned i = 0; i != length; ++i) {
+ unsigned char bc = b[i];
+ if (!bc)
+ return false;
+ if (as[i] != bc)
+ return false;
+ }
+
+ return !b[length];
+}
+
+bool equalIgnoringCase(StringImpl* a, StringImpl* b)
+{
+ return CaseFoldingHash::equal(a, b);
+}
+
+bool equalIgnoringCase(StringImpl* a, const char* b)
+{
+ if (!a)
+ return !b;
+ if (!b)
+ return !a;
+
+ unsigned length = a->length();
+ const UChar* as = a->characters();
+
+ // Do a faster loop for the case where all the characters are ASCII.
+ UChar ored = 0;
+ bool equal = true;
+ for (unsigned i = 0; i != length; ++i) {
+ char bc = b[i];
+ if (!bc)
+ return false;
+ UChar ac = as[i];
+ ored |= ac;
+ equal = equal && (toASCIILower(ac) == toASCIILower(bc));
+ }
+
+ // Do a slower implementation for cases that include non-ASCII characters.
+ if (ored & ~0x7F) {
+ equal = true;
+ for (unsigned i = 0; i != length; ++i) {
+ unsigned char bc = b[i];
+ equal = equal && (foldCase(as[i]) == foldCase(bc));
+ }
+ }
+
+ return equal && !b[length];
+}
+
+bool equalIgnoringNullity(StringImpl* a, StringImpl* b)
+{
+ if (StringHash::equal(a, b))
+ return true;
+ if (!a && b && !b->length())
+ return true;
+ if (!b && a && !a->length())
+ return true;
+
+ return false;
+}
+
+WTF::Unicode::Direction StringImpl::defaultWritingDirection()
+{
+ for (unsigned i = 0; i < m_length; ++i) {
+ WTF::Unicode::Direction charDirection = WTF::Unicode::direction(m_data[i]);
+ if (charDirection == WTF::Unicode::LeftToRight)
+ return WTF::Unicode::LeftToRight;
+ if (charDirection == WTF::Unicode::RightToLeft || charDirection == WTF::Unicode::RightToLeftArabic)
+ return WTF::Unicode::RightToLeft;
+ }
+ return WTF::Unicode::LeftToRight;
+}
+
+// This is a hot function because it's used when parsing HTML.
+PassRefPtr<StringImpl> StringImpl::createStrippingNullCharactersSlowCase(const UChar* characters, unsigned length)
+{
+ StringBuffer strippedCopy(length);
+ unsigned strippedLength = 0;
+ for (unsigned i = 0; i < length; i++) {
+ if (int c = characters[i])
+ strippedCopy[strippedLength++] = c;
+ }
+ ASSERT(strippedLength < length); // Only take the slow case when stripping.
+ strippedCopy.shrink(strippedLength);
+ return adopt(strippedCopy);
+}
+
+PassRefPtr<StringImpl> StringImpl::adopt(StringBuffer& buffer)
+{
+ unsigned length = buffer.length();
+ if (length == 0)
+ return empty();
+ return adoptRef(new StringImpl(buffer.release(), length));
+}
+
+PassRefPtr<StringImpl> StringImpl::createWithTerminatingNullCharacter(const StringImpl& string)
+{
+ // Use createUninitialized instead of 'new StringImpl' so that the string and its buffer
+ // get allocated in a single memory block.
+ UChar* data;
+ unsigned length = string.m_length;
+ if (length >= numeric_limits<unsigned>::max())
+ CRASH();
+ RefPtr<StringImpl> terminatedString = createUninitialized(length + 1, data);
+ memcpy(data, string.m_data, length * sizeof(UChar));
+ data[length] = 0;
+ terminatedString->m_length--;
+ terminatedString->m_hash = string.m_hash;
+ terminatedString->m_refCountAndFlags |= s_refCountFlagHasTerminatingNullCharacter;
+ return terminatedString.release();
+}
+
+PassRefPtr<StringImpl> StringImpl::threadsafeCopy() const
+{
+ return create(m_data, m_length);
+}
+
+PassRefPtr<StringImpl> StringImpl::crossThreadString()
+{
+ if (SharedUChar* sharedBuffer = this->sharedBuffer())
+ return adoptRef(new StringImpl(m_data, m_length, sharedBuffer->crossThreadCopy()));
+
+ // If no shared buffer is available, create a copy.
+ return threadsafeCopy();
+}
+
+} // namespace WTF
diff --git a/Source/JavaScriptCore/wtf/text/StringImpl.h b/Source/JavaScriptCore/wtf/text/StringImpl.h
new file mode 100644
index 0000000..dc1dbb2
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/text/StringImpl.h
@@ -0,0 +1,408 @@
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef StringImpl_h
+#define StringImpl_h
+
+#include <limits.h>
+#include <wtf/ASCIICType.h>
+#include <wtf/CrossThreadRefCounted.h>
+#include <wtf/Forward.h>
+#include <wtf/OwnFastMallocPtr.h>
+#include <wtf/StdLibExtras.h>
+#include <wtf/StringHasher.h>
+#include <wtf/Vector.h>
+#include <wtf/text/StringImplBase.h>
+#include <wtf/unicode/Unicode.h>
+
+#if PLATFORM(CF)
+typedef const struct __CFString * CFStringRef;
+#endif
+
+#ifdef __OBJC__
+@class NSString;
+#endif
+
+// FIXME: This is a temporary layering violation while we move string code to WTF.
+// Landing the file moves in one patch, will follow on with patches to change the namespaces.
+namespace JSC {
+struct IdentifierCStringTranslator;
+struct IdentifierUCharBufferTranslator;
+}
+
+namespace WTF {
+
+struct CStringTranslator;
+struct HashAndCharactersTranslator;
+struct HashAndUTF8CharactersTranslator;
+struct UCharBufferTranslator;
+
+enum TextCaseSensitivity { TextCaseSensitive, TextCaseInsensitive };
+
+typedef OwnFastMallocPtr<const UChar> SharableUChar;
+typedef CrossThreadRefCounted<SharableUChar> SharedUChar;
+typedef bool (*CharacterMatchFunctionPtr)(UChar);
+
+class StringImpl : public StringImplBase {
+ friend struct JSC::IdentifierCStringTranslator;
+ friend struct JSC::IdentifierUCharBufferTranslator;
+ friend struct WTF::CStringTranslator;
+ friend struct WTF::HashAndCharactersTranslator;
+ friend struct WTF::HashAndUTF8CharactersTranslator;
+ friend struct WTF::UCharBufferTranslator;
+ friend class AtomicStringImpl;
+private:
+ // Used to construct static strings, which have an special refCount that can never hit zero.
+ // This means that the static string will never be destroyed, which is important because
+ // static strings will be shared across threads & ref-counted in a non-threadsafe manner.
+ StringImpl(const UChar* characters, unsigned length, StaticStringConstructType)
+ : StringImplBase(length, ConstructStaticString)
+ , m_data(characters)
+ , m_buffer(0)
+ , m_hash(0)
+ {
+ // Ensure that the hash is computed so that AtomicStringHash can call existingHash()
+ // with impunity. The empty string is special because it is never entered into
+ // AtomicString's HashKey, but still needs to compare correctly.
+ hash();
+ }
+
+ // Create a normal string with internal storage (BufferInternal)
+ StringImpl(unsigned length)
+ : StringImplBase(length, BufferInternal)
+ , m_data(reinterpret_cast<const UChar*>(this + 1))
+ , m_buffer(0)
+ , m_hash(0)
+ {
+ ASSERT(m_data);
+ ASSERT(m_length);
+ }
+
+ // Create a StringImpl adopting ownership of the provided buffer (BufferOwned)
+ StringImpl(const UChar* characters, unsigned length)
+ : StringImplBase(length, BufferOwned)
+ , m_data(characters)
+ , m_buffer(0)
+ , m_hash(0)
+ {
+ ASSERT(m_data);
+ ASSERT(m_length);
+ }
+
+ // Used to create new strings that are a substring of an existing StringImpl (BufferSubstring)
+ StringImpl(const UChar* characters, unsigned length, PassRefPtr<StringImpl> base)
+ : StringImplBase(length, BufferSubstring)
+ , m_data(characters)
+ , m_substringBuffer(base.leakRef())
+ , m_hash(0)
+ {
+ ASSERT(m_data);
+ ASSERT(m_length);
+ ASSERT(m_substringBuffer->bufferOwnership() != BufferSubstring);
+ }
+
+ // Used to construct new strings sharing an existing SharedUChar (BufferShared)
+ StringImpl(const UChar* characters, unsigned length, PassRefPtr<SharedUChar> sharedBuffer)
+ : StringImplBase(length, BufferShared)
+ , m_data(characters)
+ , m_sharedBuffer(sharedBuffer.leakRef())
+ , m_hash(0)
+ {
+ ASSERT(m_data);
+ ASSERT(m_length);
+ }
+
+ // For use only by AtomicString's XXXTranslator helpers.
+ void setHash(unsigned hash)
+ {
+ ASSERT(!isStatic());
+ ASSERT(!m_hash);
+ ASSERT(hash == computeHash(m_data, m_length));
+ m_hash = hash;
+ }
+
+public:
+ ~StringImpl();
+
+ static PassRefPtr<StringImpl> create(const UChar*, unsigned length);
+ static PassRefPtr<StringImpl> create(const char*, unsigned length);
+ static PassRefPtr<StringImpl> create(const char*);
+ static PassRefPtr<StringImpl> create(const UChar*, unsigned length, PassRefPtr<SharedUChar> sharedBuffer);
+ static ALWAYS_INLINE PassRefPtr<StringImpl> create(PassRefPtr<StringImpl> rep, unsigned offset, unsigned length)
+ {
+ ASSERT(rep);
+ ASSERT(length <= rep->length());
+
+ if (!length)
+ return empty();
+
+ StringImpl* ownerRep = (rep->bufferOwnership() == BufferSubstring) ? rep->m_substringBuffer : rep.get();
+ return adoptRef(new StringImpl(rep->m_data + offset, length, ownerRep));
+ }
+
+ static PassRefPtr<StringImpl> createUninitialized(unsigned length, UChar*& data);
+ static ALWAYS_INLINE PassRefPtr<StringImpl> tryCreateUninitialized(unsigned length, UChar*& output)
+ {
+ if (!length) {
+ output = 0;
+ return empty();
+ }
+
+ if (length > ((std::numeric_limits<unsigned>::max() - sizeof(StringImpl)) / sizeof(UChar))) {
+ output = 0;
+ return 0;
+ }
+ StringImpl* resultImpl;
+ if (!tryFastMalloc(sizeof(UChar) * length + sizeof(StringImpl)).getValue(resultImpl)) {
+ output = 0;
+ return 0;
+ }
+ output = reinterpret_cast<UChar*>(resultImpl + 1);
+ return adoptRef(new(resultImpl) StringImpl(length));
+ }
+
+ static unsigned dataOffset() { return OBJECT_OFFSETOF(StringImpl, m_data); }
+ static PassRefPtr<StringImpl> createWithTerminatingNullCharacter(const StringImpl&);
+ static PassRefPtr<StringImpl> createStrippingNullCharacters(const UChar*, unsigned length);
+
+ template<size_t inlineCapacity>
+ static PassRefPtr<StringImpl> adopt(Vector<UChar, inlineCapacity>& vector)
+ {
+ if (size_t size = vector.size()) {
+ ASSERT(vector.data());
+ if (size > std::numeric_limits<unsigned>::max())
+ CRASH();
+ return adoptRef(new StringImpl(vector.releaseBuffer(), size));
+ }
+ return empty();
+ }
+ static PassRefPtr<StringImpl> adopt(StringBuffer&);
+
+ SharedUChar* sharedBuffer();
+ const UChar* characters() const { return m_data; }
+
+ size_t cost()
+ {
+ // For substrings, return the cost of the base string.
+ if (bufferOwnership() == BufferSubstring)
+ return m_substringBuffer->cost();
+
+ if (m_refCountAndFlags & s_refCountFlagShouldReportedCost) {
+ m_refCountAndFlags &= ~s_refCountFlagShouldReportedCost;
+ return m_length;
+ }
+ return 0;
+ }
+
+ bool isIdentifier() const { return m_refCountAndFlags & s_refCountFlagIsIdentifier; }
+ void setIsIdentifier(bool isIdentifier)
+ {
+ ASSERT(!isStatic());
+ if (isIdentifier)
+ m_refCountAndFlags |= s_refCountFlagIsIdentifier;
+ else
+ m_refCountAndFlags &= ~s_refCountFlagIsIdentifier;
+ }
+
+ bool hasTerminatingNullCharacter() const { return m_refCountAndFlags & s_refCountFlagHasTerminatingNullCharacter; }
+
+ bool isAtomic() const { return m_refCountAndFlags & s_refCountFlagIsAtomic; }
+ void setIsAtomic(bool isIdentifier)
+ {
+ ASSERT(!isStatic());
+ if (isIdentifier)
+ m_refCountAndFlags |= s_refCountFlagIsAtomic;
+ else
+ m_refCountAndFlags &= ~s_refCountFlagIsAtomic;
+ }
+
+ unsigned hash() const { if (!m_hash) m_hash = computeHash(m_data, m_length); return m_hash; }
+ unsigned existingHash() const { ASSERT(m_hash); return m_hash; }
+ static unsigned computeHash(const UChar* data, unsigned length) { return WTF::StringHasher::createHash<UChar>(data, length); }
+ static unsigned computeHash(const char* data, unsigned length) { return WTF::StringHasher::createHash<char>(data, length); }
+ static unsigned computeHash(const char* data) { return WTF::StringHasher::createHash<char>(data); }
+
+ ALWAYS_INLINE void deref() { m_refCountAndFlags -= s_refCountIncrement; if (!(m_refCountAndFlags & (s_refCountMask | s_refCountFlagStatic))) delete this; }
+ ALWAYS_INLINE bool hasOneRef() const { return (m_refCountAndFlags & (s_refCountMask | s_refCountFlagStatic)) == s_refCountIncrement; }
+
+ static StringImpl* empty();
+
+ static void copyChars(UChar* destination, const UChar* source, unsigned numCharacters)
+ {
+ if (numCharacters <= s_copyCharsInlineCutOff) {
+ for (unsigned i = 0; i < numCharacters; ++i)
+ destination[i] = source[i];
+ } else
+ memcpy(destination, source, numCharacters * sizeof(UChar));
+ }
+
+ // Returns a StringImpl suitable for use on another thread.
+ PassRefPtr<StringImpl> crossThreadString();
+ // Makes a deep copy. Helpful only if you need to use a String on another thread
+ // (use crossThreadString if the method call doesn't need to be threadsafe).
+ // Since StringImpl objects are immutable, there's no other reason to make a copy.
+ PassRefPtr<StringImpl> threadsafeCopy() const;
+
+ PassRefPtr<StringImpl> substring(unsigned pos, unsigned len = UINT_MAX);
+
+ UChar operator[](unsigned i) { ASSERT(i < m_length); return m_data[i]; }
+ UChar32 characterStartingAt(unsigned);
+
+ bool containsOnlyWhitespace();
+
+ int toIntStrict(bool* ok = 0, int base = 10);
+ unsigned toUIntStrict(bool* ok = 0, int base = 10);
+ int64_t toInt64Strict(bool* ok = 0, int base = 10);
+ uint64_t toUInt64Strict(bool* ok = 0, int base = 10);
+ intptr_t toIntPtrStrict(bool* ok = 0, int base = 10);
+
+ int toInt(bool* ok = 0); // ignores trailing garbage
+ unsigned toUInt(bool* ok = 0); // ignores trailing garbage
+ int64_t toInt64(bool* ok = 0); // ignores trailing garbage
+ uint64_t toUInt64(bool* ok = 0); // ignores trailing garbage
+ intptr_t toIntPtr(bool* ok = 0); // ignores trailing garbage
+
+ double toDouble(bool* ok = 0);
+ float toFloat(bool* ok = 0);
+
+ PassRefPtr<StringImpl> lower();
+ PassRefPtr<StringImpl> upper();
+
+ enum LastCharacterBehavior { ObscureLastCharacter, DisplayLastCharacter };
+
+ PassRefPtr<StringImpl> secure(UChar, LastCharacterBehavior = ObscureLastCharacter);
+ PassRefPtr<StringImpl> foldCase();
+
+ PassRefPtr<StringImpl> stripWhiteSpace();
+ PassRefPtr<StringImpl> simplifyWhiteSpace();
+
+ PassRefPtr<StringImpl> removeCharacters(CharacterMatchFunctionPtr);
+
+ size_t find(UChar, unsigned index = 0);
+ size_t find(CharacterMatchFunctionPtr, unsigned index = 0);
+ size_t find(const char*, unsigned index = 0);
+ size_t find(StringImpl*, unsigned index = 0);
+ size_t findIgnoringCase(const char*, unsigned index = 0);
+ size_t findIgnoringCase(StringImpl*, unsigned index = 0);
+
+ size_t reverseFind(UChar, unsigned index = UINT_MAX);
+ size_t reverseFind(StringImpl*, unsigned index = UINT_MAX);
+ size_t reverseFindIgnoringCase(StringImpl*, unsigned index = UINT_MAX);
+
+ bool startsWith(StringImpl* str, bool caseSensitive = true) { return (caseSensitive ? reverseFind(str, 0) : reverseFindIgnoringCase(str, 0)) == 0; }
+ bool endsWith(StringImpl*, bool caseSensitive = true);
+
+ PassRefPtr<StringImpl> replace(UChar, UChar);
+ PassRefPtr<StringImpl> replace(UChar, StringImpl*);
+ PassRefPtr<StringImpl> replace(StringImpl*, StringImpl*);
+ PassRefPtr<StringImpl> replace(unsigned index, unsigned len, StringImpl*);
+
+ WTF::Unicode::Direction defaultWritingDirection();
+
+#if PLATFORM(CF)
+ CFStringRef createCFString();
+#endif
+#ifdef __OBJC__
+ operator NSString*();
+#endif
+
+private:
+ // This number must be at least 2 to avoid sharing empty, null as well as 1 character strings from SmallStrings.
+ static const unsigned s_copyCharsInlineCutOff = 20;
+
+ static PassRefPtr<StringImpl> createStrippingNullCharactersSlowCase(const UChar*, unsigned length);
+
+ BufferOwnership bufferOwnership() const { return static_cast<BufferOwnership>(m_refCountAndFlags & s_refCountMaskBufferOwnership); }
+ bool isStatic() const { return m_refCountAndFlags & s_refCountFlagStatic; }
+ const UChar* m_data;
+ union {
+ void* m_buffer;
+ StringImpl* m_substringBuffer;
+ SharedUChar* m_sharedBuffer;
+ };
+ mutable unsigned m_hash;
+};
+
+bool equal(const StringImpl*, const StringImpl*);
+bool equal(const StringImpl*, const char*);
+inline bool equal(const char* a, StringImpl* b) { return equal(b, a); }
+
+bool equalIgnoringCase(StringImpl*, StringImpl*);
+bool equalIgnoringCase(StringImpl*, const char*);
+inline bool equalIgnoringCase(const char* a, StringImpl* b) { return equalIgnoringCase(b, a); }
+bool equalIgnoringCase(const UChar* a, const char* b, unsigned length);
+inline bool equalIgnoringCase(const char* a, const UChar* b, unsigned length) { return equalIgnoringCase(b, a, length); }
+
+bool equalIgnoringNullity(StringImpl*, StringImpl*);
+
+int codePointCompare(const StringImpl*, const StringImpl*);
+
+static inline bool isSpaceOrNewline(UChar c)
+{
+ // Use isASCIISpace() for basic Latin-1.
+ // This will include newlines, which aren't included in Unicode DirWS.
+ return c <= 0x7F ? WTF::isASCIISpace(c) : WTF::Unicode::direction(c) == WTF::Unicode::WhiteSpaceNeutral;
+}
+
+// This is a hot function because it's used when parsing HTML.
+inline PassRefPtr<StringImpl> StringImpl::createStrippingNullCharacters(const UChar* characters, unsigned length)
+{
+ ASSERT(characters);
+ ASSERT(length);
+
+ // Optimize for the case where there are no Null characters by quickly
+ // searching for nulls, and then using StringImpl::create, which will
+ // memcpy the whole buffer. This is faster than assigning character by
+ // character during the loop.
+
+ // Fast case.
+ int foundNull = 0;
+ for (unsigned i = 0; !foundNull && i < length; i++) {
+ int c = characters[i]; // more efficient than using UChar here (at least on Intel Mac OS)
+ foundNull |= !c;
+ }
+ if (!foundNull)
+ return StringImpl::create(characters, length);
+
+ return StringImpl::createStrippingNullCharactersSlowCase(characters, length);
+}
+
+struct StringHash;
+
+// StringHash is the default hash for StringImpl* and RefPtr<StringImpl>
+template<typename T> struct DefaultHash;
+template<> struct DefaultHash<StringImpl*> {
+ typedef StringHash Hash;
+};
+template<> struct DefaultHash<RefPtr<StringImpl> > {
+ typedef StringHash Hash;
+};
+
+}
+
+using WTF::StringImpl;
+using WTF::equal;
+using WTF::TextCaseSensitivity;
+using WTF::TextCaseSensitive;
+using WTF::TextCaseInsensitive;
+
+#endif
diff --git a/Source/JavaScriptCore/wtf/text/StringImplBase.h b/Source/JavaScriptCore/wtf/text/StringImplBase.h
new file mode 100644
index 0000000..6567672
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/text/StringImplBase.h
@@ -0,0 +1,103 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef StringImplBase_h
+#define StringImplBase_h
+
+#include <wtf/Noncopyable.h>
+#include <wtf/unicode/Unicode.h>
+
+namespace WTF {
+
+class StringImplBase : public Noncopyable {
+public:
+ bool isStringImpl() { return (m_refCountAndFlags & s_refCountInvalidForStringImpl) != s_refCountInvalidForStringImpl; }
+ unsigned length() const { return m_length; }
+ void ref() { m_refCountAndFlags += s_refCountIncrement; }
+
+protected:
+ enum BufferOwnership {
+ BufferInternal,
+ BufferOwned,
+ BufferSubstring,
+ BufferShared,
+ };
+
+ using Noncopyable::operator new;
+ void* operator new(size_t, void* inPlace) { ASSERT(inPlace); return inPlace; }
+
+ // For SmallStringStorage, which allocates an array and uses an in-place new.
+ StringImplBase() { }
+
+ StringImplBase(unsigned length, BufferOwnership ownership)
+ : m_refCountAndFlags(s_refCountIncrement | s_refCountFlagShouldReportedCost | ownership)
+ , m_length(length)
+ {
+ ASSERT(isStringImpl());
+ }
+
+ enum StaticStringConstructType { ConstructStaticString };
+ StringImplBase(unsigned length, StaticStringConstructType)
+ : m_refCountAndFlags(s_refCountFlagStatic | s_refCountFlagIsIdentifier | BufferOwned)
+ , m_length(length)
+ {
+ ASSERT(isStringImpl());
+ }
+
+ // This constructor is not used when creating StringImpl objects,
+ // and sets the flags into a state marking the object as such.
+ enum NonStringImplConstructType { ConstructNonStringImpl };
+ StringImplBase(NonStringImplConstructType)
+ : m_refCountAndFlags(s_refCountIncrement | s_refCountInvalidForStringImpl)
+ , m_length(0)
+ {
+ ASSERT(!isStringImpl());
+ }
+
+ // The bottom 7 bits hold flags, the top 25 bits hold the ref count.
+ // When dereferencing StringImpls we check for the ref count AND the
+ // static bit both being zero - static strings are never deleted.
+ static const unsigned s_refCountMask = 0xFFFFFF80;
+ static const unsigned s_refCountIncrement = 0x80;
+ static const unsigned s_refCountFlagStatic = 0x40;
+ static const unsigned s_refCountFlagHasTerminatingNullCharacter = 0x20;
+ static const unsigned s_refCountFlagIsAtomic = 0x10;
+ static const unsigned s_refCountFlagShouldReportedCost = 0x8;
+ static const unsigned s_refCountFlagIsIdentifier = 0x4;
+ static const unsigned s_refCountMaskBufferOwnership = 0x3;
+ // An invalid permutation of flags (static & shouldReportedCost - static strings do not
+ // set shouldReportedCost in the constructor, and this bit is only ever cleared, not set).
+ // Used by "ConstructNonStringImpl" constructor, above.
+ static const unsigned s_refCountInvalidForStringImpl = s_refCountFlagStatic | s_refCountFlagShouldReportedCost;
+
+ unsigned m_refCountAndFlags;
+ unsigned m_length;
+};
+
+} // namespace WTF
+
+using WTF::StringImplBase;
+
+#endif
diff --git a/Source/JavaScriptCore/wtf/text/StringStatics.cpp b/Source/JavaScriptCore/wtf/text/StringStatics.cpp
new file mode 100644
index 0000000..5654044
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/text/StringStatics.cpp
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#ifdef SKIP_STATIC_CONSTRUCTORS_ON_GCC
+#define ATOMICSTRING_HIDE_GLOBALS 1
+#endif
+
+#include "AtomicString.h"
+#include "StaticConstructors.h"
+#include "StringImpl.h"
+
+namespace WTF {
+
+StringImpl* StringImpl::empty()
+{
+ // FIXME: This works around a bug in our port of PCRE, that a regular expression
+ // run on the empty string may still perform a read from the first element, and
+ // as such we need this to be a valid pointer. No code should ever be reading
+ // from a zero length string, so this should be able to be a non-null pointer
+ // into the zero-page.
+ // Replace this with 'reinterpret_cast<UChar*>(static_cast<intptr_t>(1))' once
+ // PCRE goes away.
+ static UChar emptyUCharData = 0;
+ DEFINE_STATIC_LOCAL(StringImpl, emptyString, (&emptyUCharData, 0, ConstructStaticString));
+ return &emptyString;
+}
+
+JS_EXPORTDATA DEFINE_GLOBAL(AtomicString, nullAtom)
+JS_EXPORTDATA DEFINE_GLOBAL(AtomicString, emptyAtom, "")
+JS_EXPORTDATA DEFINE_GLOBAL(AtomicString, textAtom, "#text")
+JS_EXPORTDATA DEFINE_GLOBAL(AtomicString, commentAtom, "#comment")
+JS_EXPORTDATA DEFINE_GLOBAL(AtomicString, starAtom, "*")
+JS_EXPORTDATA DEFINE_GLOBAL(AtomicString, xmlAtom, "xml")
+JS_EXPORTDATA DEFINE_GLOBAL(AtomicString, xmlnsAtom, "xmlns")
+
+void AtomicString::init()
+{
+ static bool initialized;
+ if (!initialized) {
+ // Initialization is not thread safe, so this function must be called from the main thread first.
+ ASSERT(isMainThread());
+
+ // Use placement new to initialize the globals.
+ new ((void*)&nullAtom) AtomicString;
+ new ((void*)&emptyAtom) AtomicString("");
+ new ((void*)&textAtom) AtomicString("#text");
+ new ((void*)&commentAtom) AtomicString("#comment");
+ new ((void*)&starAtom) AtomicString("*");
+ new ((void*)&xmlAtom) AtomicString("xml");
+ new ((void*)&xmlnsAtom) AtomicString("xmlns");
+
+ initialized = true;
+ }
+}
+
+}
diff --git a/Source/JavaScriptCore/wtf/text/TextPosition.h b/Source/JavaScriptCore/wtf/text/TextPosition.h
new file mode 100644
index 0000000..9f426ea
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/text/TextPosition.h
@@ -0,0 +1,150 @@
+/*
+ * Copyright (C) 2010, Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef TextPosition_h
+#define TextPosition_h
+
+#include <wtf/Assertions.h>
+
+namespace WTF {
+
+/*
+ * Text Position
+ *
+ * TextPosition structure specifies coordinates within an text resource. It is used mostly
+ * for saving script source position.
+ *
+ * Later TextPosition0 and TextPosition1 and both number types can be merged together quite easily.
+ *
+ * 0-based and 1-based
+ *
+ * Line and column numbers could be interpreted as zero-based or 1-based. Since
+ * both practices coexist in WebKit source base, 'int' type should be replaced with
+ * a dedicated wrapper types, so that compiler helped us with this ambiguity.
+ *
+ * Here we introduce 2 types of numbers: ZeroBasedNumber and OneBasedNumber and
+ * 2 corresponding types of TextPosition structure. While only one type ought to be enough,
+ * this is done to keep transition to the new types as transparent as possible:
+ * e.g. in areas where 0-based integers are used, TextPosition0 should be introduced. This
+ * way all changes will remain trackable.
+ *
+ * Later both number types can be merged in one type quite easily.
+ *
+ * For type safety and for the future type merge it is important that all operations in API
+ * that accept or return integer have a name explicitly defining base of integer. For this reason
+ * int-receiving constructors are hidden from API.
+ */
+
+template<typename NUMBER>
+class TextPosition {
+public:
+ TextPosition(NUMBER line, NUMBER column)
+ : m_line(line)
+ , m_column(column)
+ {
+ }
+ TextPosition() {}
+
+ bool operator==(const TextPosition& other) { return m_line == other.m_line && m_column == other.m_column; }
+ bool operator!=(const TextPosition& other) { return !((*this) == other); }
+
+ // A 'minimum' value of position, used as a default value.
+ static TextPosition<NUMBER> minimumPosition() { return TextPosition<NUMBER>(NUMBER::base(), NUMBER::base()); }
+
+ // A value with line value less than a minimum; used as an impossible position.
+ static TextPosition<NUMBER> belowRangePosition() { return TextPosition<NUMBER>(NUMBER::belowBase(), NUMBER::belowBase()); }
+
+ NUMBER m_line;
+ NUMBER m_column;
+};
+
+class OneBasedNumber;
+
+// An int wrapper that always reminds you that the number should be 0-based
+class ZeroBasedNumber {
+public:
+ static ZeroBasedNumber fromZeroBasedInt(int zeroBasedInt) { return ZeroBasedNumber(zeroBasedInt); }
+
+ ZeroBasedNumber() {}
+
+ int zeroBasedInt() const { return m_value; }
+
+ OneBasedNumber convertToOneBased() const;
+
+ bool operator==(ZeroBasedNumber other) { return m_value == other.m_value; }
+ bool operator!=(ZeroBasedNumber other) { return !((*this) == other); }
+
+ static ZeroBasedNumber base() { return 0; }
+ static ZeroBasedNumber belowBase() { return -1; }
+
+private:
+ ZeroBasedNumber(int value) : m_value(value) {}
+ int m_value;
+};
+
+// An int wrapper that always reminds you that the number should be 1-based
+class OneBasedNumber {
+public:
+ static OneBasedNumber fromOneBasedInt(int oneBasedInt) { return OneBasedNumber(oneBasedInt); }
+ OneBasedNumber() {}
+
+ int oneBasedInt() const { return m_value; }
+ int convertAsZeroBasedInt() const { return m_value - 1; }
+ ZeroBasedNumber convertToZeroBased() const { return ZeroBasedNumber::fromZeroBasedInt(m_value - 1); }
+
+ bool operator==(OneBasedNumber other) { return m_value == other.m_value; }
+ bool operator!=(OneBasedNumber other) { return !((*this) == other); }
+
+ static OneBasedNumber base() { return 1; }
+ static OneBasedNumber belowBase() { return 0; }
+
+private:
+ OneBasedNumber(int value) : m_value(value) {}
+ int m_value;
+};
+
+typedef TextPosition<ZeroBasedNumber> TextPosition0;
+typedef TextPosition<OneBasedNumber> TextPosition1;
+
+inline TextPosition0 toZeroBasedTextPosition(const TextPosition1& position)
+{
+ return TextPosition0(position.m_line.convertToZeroBased(), position.m_column.convertToZeroBased());
+}
+
+inline TextPosition1 toOneBasedTextPosition(const TextPosition0& position)
+{
+ return TextPosition1(position.m_line.convertToOneBased(), position.m_column.convertToOneBased());
+}
+
+inline OneBasedNumber ZeroBasedNumber::convertToOneBased() const
+{
+ return OneBasedNumber::fromOneBasedInt(m_value + 1);
+}
+
+}
+
+using WTF::TextPosition0;
+using WTF::TextPosition1;
+
+#endif // TextPosition_h
diff --git a/Source/JavaScriptCore/wtf/text/WTFString.cpp b/Source/JavaScriptCore/wtf/text/WTFString.cpp
new file mode 100644
index 0000000..6bb74f6
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/text/WTFString.cpp
@@ -0,0 +1,1003 @@
+/*
+ * (C) 1999 Lars Knoll (knoll@kde.org)
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2007-2009 Torch Mobile, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "WTFString.h"
+
+#include <stdarg.h>
+#include <wtf/ASCIICType.h>
+#include <wtf/text/CString.h>
+#include <wtf/StringExtras.h>
+#include <wtf/Vector.h>
+#include <wtf/dtoa.h>
+#include <wtf/unicode/UTF8.h>
+#include <wtf/unicode/Unicode.h>
+
+using namespace std;
+
+namespace WTF {
+
+using namespace Unicode;
+using namespace std;
+
+// Construct a string with UTF-16 data.
+String::String(const UChar* characters, unsigned length)
+ : m_impl(characters ? StringImpl::create(characters, length) : 0)
+{
+}
+
+// Construct a string with UTF-16 data, from a null-terminated source.
+String::String(const UChar* str)
+{
+ if (!str)
+ return;
+
+ size_t len = 0;
+ while (str[len] != UChar(0))
+ len++;
+
+ if (len > numeric_limits<unsigned>::max())
+ CRASH();
+
+ m_impl = StringImpl::create(str, len);
+}
+
+// Construct a string with latin1 data.
+String::String(const char* characters, unsigned length)
+ : m_impl(characters ? StringImpl::create(characters, length) : 0)
+{
+}
+
+// Construct a string with latin1 data, from a null-terminated source.
+String::String(const char* characters)
+ : m_impl(characters ? StringImpl::create(characters) : 0)
+{
+}
+
+void String::append(const String& str)
+{
+ if (str.isEmpty())
+ return;
+
+ // FIXME: This is extremely inefficient. So much so that we might want to take this
+ // out of String's API. We can make it better by optimizing the case where exactly
+ // one String is pointing at this StringImpl, but even then it's going to require a
+ // call to fastMalloc every single time.
+ if (str.m_impl) {
+ if (m_impl) {
+ UChar* data;
+ if (str.length() > numeric_limits<unsigned>::max() - m_impl->length())
+ CRASH();
+ RefPtr<StringImpl> newImpl = StringImpl::createUninitialized(m_impl->length() + str.length(), data);
+ memcpy(data, m_impl->characters(), m_impl->length() * sizeof(UChar));
+ memcpy(data + m_impl->length(), str.characters(), str.length() * sizeof(UChar));
+ m_impl = newImpl.release();
+ } else
+ m_impl = str.m_impl;
+ }
+}
+
+void String::append(char c)
+{
+ // FIXME: This is extremely inefficient. So much so that we might want to take this
+ // out of String's API. We can make it better by optimizing the case where exactly
+ // one String is pointing at this StringImpl, but even then it's going to require a
+ // call to fastMalloc every single time.
+ if (m_impl) {
+ UChar* data;
+ if (m_impl->length() >= numeric_limits<unsigned>::max())
+ CRASH();
+ RefPtr<StringImpl> newImpl = StringImpl::createUninitialized(m_impl->length() + 1, data);
+ memcpy(data, m_impl->characters(), m_impl->length() * sizeof(UChar));
+ data[m_impl->length()] = c;
+ m_impl = newImpl.release();
+ } else
+ m_impl = StringImpl::create(&c, 1);
+}
+
+void String::append(UChar c)
+{
+ // FIXME: This is extremely inefficient. So much so that we might want to take this
+ // out of String's API. We can make it better by optimizing the case where exactly
+ // one String is pointing at this StringImpl, but even then it's going to require a
+ // call to fastMalloc every single time.
+ if (m_impl) {
+ UChar* data;
+ if (m_impl->length() >= numeric_limits<unsigned>::max())
+ CRASH();
+ RefPtr<StringImpl> newImpl = StringImpl::createUninitialized(m_impl->length() + 1, data);
+ memcpy(data, m_impl->characters(), m_impl->length() * sizeof(UChar));
+ data[m_impl->length()] = c;
+ m_impl = newImpl.release();
+ } else
+ m_impl = StringImpl::create(&c, 1);
+}
+
+String operator+(const String& a, const String& b)
+{
+ if (a.isEmpty())
+ return b;
+ if (b.isEmpty())
+ return a;
+ String c = a;
+ c += b;
+ return c;
+}
+
+String operator+(const String& s, const char* cs)
+{
+ return s + String(cs);
+}
+
+String operator+(const char* cs, const String& s)
+{
+ return String(cs) + s;
+}
+
+int codePointCompare(const String& a, const String& b)
+{
+ return codePointCompare(a.impl(), b.impl());
+}
+
+void String::insert(const String& str, unsigned pos)
+{
+ if (str.isEmpty()) {
+ if (str.isNull())
+ return;
+ if (isNull())
+ m_impl = str.impl();
+ return;
+ }
+ insert(str.characters(), str.length(), pos);
+}
+
+void String::append(const UChar* charactersToAppend, unsigned lengthToAppend)
+{
+ if (!m_impl) {
+ if (!charactersToAppend)
+ return;
+ m_impl = StringImpl::create(charactersToAppend, lengthToAppend);
+ return;
+ }
+
+ if (!lengthToAppend)
+ return;
+
+ ASSERT(charactersToAppend);
+ UChar* data;
+ if (lengthToAppend > numeric_limits<unsigned>::max() - length())
+ CRASH();
+ RefPtr<StringImpl> newImpl = StringImpl::createUninitialized(length() + lengthToAppend, data);
+ memcpy(data, characters(), length() * sizeof(UChar));
+ memcpy(data + length(), charactersToAppend, lengthToAppend * sizeof(UChar));
+ m_impl = newImpl.release();
+}
+
+void String::insert(const UChar* charactersToInsert, unsigned lengthToInsert, unsigned position)
+{
+ if (position >= length()) {
+ append(charactersToInsert, lengthToInsert);
+ return;
+ }
+
+ ASSERT(m_impl);
+
+ if (!lengthToInsert)
+ return;
+
+ ASSERT(charactersToInsert);
+ UChar* data;
+ if (lengthToInsert > numeric_limits<unsigned>::max() - length())
+ CRASH();
+ RefPtr<StringImpl> newImpl = StringImpl::createUninitialized(length() + lengthToInsert, data);
+ memcpy(data, characters(), position * sizeof(UChar));
+ memcpy(data + position, charactersToInsert, lengthToInsert * sizeof(UChar));
+ memcpy(data + position + lengthToInsert, characters() + position, (length() - position) * sizeof(UChar));
+ m_impl = newImpl.release();
+}
+
+UChar32 String::characterStartingAt(unsigned i) const
+{
+ if (!m_impl || i >= m_impl->length())
+ return 0;
+ return m_impl->characterStartingAt(i);
+}
+
+void String::truncate(unsigned position)
+{
+ if (position >= length())
+ return;
+ UChar* data;
+ RefPtr<StringImpl> newImpl = StringImpl::createUninitialized(position, data);
+ memcpy(data, characters(), position * sizeof(UChar));
+ m_impl = newImpl.release();
+}
+
+void String::remove(unsigned position, int lengthToRemove)
+{
+ if (lengthToRemove <= 0)
+ return;
+ if (position >= length())
+ return;
+ if (static_cast<unsigned>(lengthToRemove) > length() - position)
+ lengthToRemove = length() - position;
+ UChar* data;
+ RefPtr<StringImpl> newImpl = StringImpl::createUninitialized(length() - lengthToRemove, data);
+ memcpy(data, characters(), position * sizeof(UChar));
+ memcpy(data + position, characters() + position + lengthToRemove,
+ (length() - lengthToRemove - position) * sizeof(UChar));
+ m_impl = newImpl.release();
+}
+
+String String::substring(unsigned pos, unsigned len) const
+{
+ if (!m_impl)
+ return String();
+ return m_impl->substring(pos, len);
+}
+
+String String::substringSharingImpl(unsigned offset, unsigned length) const
+{
+ // FIXME: We used to check against a limit of Heap::minExtraCost / sizeof(UChar).
+
+ unsigned stringLength = this->length();
+ offset = min(offset, stringLength);
+ length = min(length, stringLength - offset);
+
+ if (!offset && length == stringLength)
+ return *this;
+ return String(StringImpl::create(m_impl, offset, length));
+}
+
+String String::lower() const
+{
+ if (!m_impl)
+ return String();
+ return m_impl->lower();
+}
+
+String String::upper() const
+{
+ if (!m_impl)
+ return String();
+ return m_impl->upper();
+}
+
+String String::stripWhiteSpace() const
+{
+ if (!m_impl)
+ return String();
+ return m_impl->stripWhiteSpace();
+}
+
+String String::simplifyWhiteSpace() const
+{
+ if (!m_impl)
+ return String();
+ return m_impl->simplifyWhiteSpace();
+}
+
+String String::removeCharacters(CharacterMatchFunctionPtr findMatch) const
+{
+ if (!m_impl)
+ return String();
+ return m_impl->removeCharacters(findMatch);
+}
+
+String String::foldCase() const
+{
+ if (!m_impl)
+ return String();
+ return m_impl->foldCase();
+}
+
+bool String::percentage(int& result) const
+{
+ if (!m_impl || !m_impl->length())
+ return false;
+
+ if ((*m_impl)[m_impl->length() - 1] != '%')
+ return false;
+
+ result = charactersToIntStrict(m_impl->characters(), m_impl->length() - 1);
+ return true;
+}
+
+const UChar* String::charactersWithNullTermination()
+{
+ if (!m_impl)
+ return 0;
+ if (m_impl->hasTerminatingNullCharacter())
+ return m_impl->characters();
+ m_impl = StringImpl::createWithTerminatingNullCharacter(*m_impl);
+ return m_impl->characters();
+}
+
+String String::format(const char *format, ...)
+{
+#if PLATFORM(QT)
+ // Use QString::vsprintf to avoid the locale dependent formatting of vsnprintf.
+ // https://bugs.webkit.org/show_bug.cgi?id=18994
+ va_list args;
+ va_start(args, format);
+
+ QString buffer;
+ buffer.vsprintf(format, args);
+
+ va_end(args);
+
+ QByteArray ba = buffer.toUtf8();
+ return StringImpl::create(ba.constData(), ba.length());
+
+#elif OS(WINCE)
+ va_list args;
+ va_start(args, format);
+
+ Vector<char, 256> buffer;
+
+ int bufferSize = 256;
+ buffer.resize(bufferSize);
+ for (;;) {
+ int written = vsnprintf(buffer.data(), bufferSize, format, args);
+ va_end(args);
+
+ if (written == 0)
+ return String("");
+ if (written > 0)
+ return StringImpl::create(buffer.data(), written);
+
+ bufferSize <<= 1;
+ buffer.resize(bufferSize);
+ va_start(args, format);
+ }
+
+#else
+ va_list args;
+ va_start(args, format);
+
+ Vector<char, 256> buffer;
+
+ // Do the format once to get the length.
+#if COMPILER(MSVC)
+ int result = _vscprintf(format, args);
+#else
+ char ch;
+ int result = vsnprintf(&ch, 1, format, args);
+ // We need to call va_end() and then va_start() again here, as the
+ // contents of args is undefined after the call to vsnprintf
+ // according to http://man.cx/snprintf(3)
+ //
+ // Not calling va_end/va_start here happens to work on lots of
+ // systems, but fails e.g. on 64bit Linux.
+ va_end(args);
+ va_start(args, format);
+#endif
+
+ if (result == 0)
+ return String("");
+ if (result < 0)
+ return String();
+ unsigned len = result;
+ buffer.grow(len + 1);
+
+ // Now do the formatting again, guaranteed to fit.
+ vsnprintf(buffer.data(), buffer.size(), format, args);
+
+ va_end(args);
+
+ return StringImpl::create(buffer.data(), len);
+#endif
+}
+
+String String::number(short n)
+{
+ return String::format("%hd", n);
+}
+
+String String::number(unsigned short n)
+{
+ return String::format("%hu", n);
+}
+
+String String::number(int n)
+{
+ return String::format("%d", n);
+}
+
+String String::number(unsigned n)
+{
+ return String::format("%u", n);
+}
+
+String String::number(long n)
+{
+ return String::format("%ld", n);
+}
+
+String String::number(unsigned long n)
+{
+ return String::format("%lu", n);
+}
+
+String String::number(long long n)
+{
+#if OS(WINDOWS) && !PLATFORM(QT)
+ return String::format("%I64i", n);
+#else
+ return String::format("%lli", n);
+#endif
+}
+
+String String::number(unsigned long long n)
+{
+#if OS(WINDOWS) && !PLATFORM(QT)
+ return String::format("%I64u", n);
+#else
+ return String::format("%llu", n);
+#endif
+}
+
+String String::number(double n)
+{
+ return String::format("%.6lg", n);
+}
+
+int String::toIntStrict(bool* ok, int base) const
+{
+ if (!m_impl) {
+ if (ok)
+ *ok = false;
+ return 0;
+ }
+ return m_impl->toIntStrict(ok, base);
+}
+
+unsigned String::toUIntStrict(bool* ok, int base) const
+{
+ if (!m_impl) {
+ if (ok)
+ *ok = false;
+ return 0;
+ }
+ return m_impl->toUIntStrict(ok, base);
+}
+
+int64_t String::toInt64Strict(bool* ok, int base) const
+{
+ if (!m_impl) {
+ if (ok)
+ *ok = false;
+ return 0;
+ }
+ return m_impl->toInt64Strict(ok, base);
+}
+
+uint64_t String::toUInt64Strict(bool* ok, int base) const
+{
+ if (!m_impl) {
+ if (ok)
+ *ok = false;
+ return 0;
+ }
+ return m_impl->toUInt64Strict(ok, base);
+}
+
+intptr_t String::toIntPtrStrict(bool* ok, int base) const
+{
+ if (!m_impl) {
+ if (ok)
+ *ok = false;
+ return 0;
+ }
+ return m_impl->toIntPtrStrict(ok, base);
+}
+
+
+int String::toInt(bool* ok) const
+{
+ if (!m_impl) {
+ if (ok)
+ *ok = false;
+ return 0;
+ }
+ return m_impl->toInt(ok);
+}
+
+unsigned String::toUInt(bool* ok) const
+{
+ if (!m_impl) {
+ if (ok)
+ *ok = false;
+ return 0;
+ }
+ return m_impl->toUInt(ok);
+}
+
+int64_t String::toInt64(bool* ok) const
+{
+ if (!m_impl) {
+ if (ok)
+ *ok = false;
+ return 0;
+ }
+ return m_impl->toInt64(ok);
+}
+
+uint64_t String::toUInt64(bool* ok) const
+{
+ if (!m_impl) {
+ if (ok)
+ *ok = false;
+ return 0;
+ }
+ return m_impl->toUInt64(ok);
+}
+
+intptr_t String::toIntPtr(bool* ok) const
+{
+ if (!m_impl) {
+ if (ok)
+ *ok = false;
+ return 0;
+ }
+ return m_impl->toIntPtr(ok);
+}
+
+double String::toDouble(bool* ok) const
+{
+ if (!m_impl) {
+ if (ok)
+ *ok = false;
+ return 0.0;
+ }
+ return m_impl->toDouble(ok);
+}
+
+float String::toFloat(bool* ok) const
+{
+ if (!m_impl) {
+ if (ok)
+ *ok = false;
+ return 0.0f;
+ }
+ return m_impl->toFloat(ok);
+}
+
+String String::threadsafeCopy() const
+{
+ if (!m_impl)
+ return String();
+ return m_impl->threadsafeCopy();
+}
+
+String String::crossThreadString() const
+{
+ if (!m_impl)
+ return String();
+ return m_impl->crossThreadString();
+}
+
+void String::split(const String& separator, bool allowEmptyEntries, Vector<String>& result) const
+{
+ result.clear();
+
+ unsigned startPos = 0;
+ size_t endPos;
+ while ((endPos = find(separator, startPos)) != notFound) {
+ if (allowEmptyEntries || startPos != endPos)
+ result.append(substring(startPos, endPos - startPos));
+ startPos = endPos + separator.length();
+ }
+ if (allowEmptyEntries || startPos != length())
+ result.append(substring(startPos));
+}
+
+void String::split(const String& separator, Vector<String>& result) const
+{
+ return split(separator, false, result);
+}
+
+void String::split(UChar separator, bool allowEmptyEntries, Vector<String>& result) const
+{
+ result.clear();
+
+ unsigned startPos = 0;
+ size_t endPos;
+ while ((endPos = find(separator, startPos)) != notFound) {
+ if (allowEmptyEntries || startPos != endPos)
+ result.append(substring(startPos, endPos - startPos));
+ startPos = endPos + 1;
+ }
+ if (allowEmptyEntries || startPos != length())
+ result.append(substring(startPos));
+}
+
+void String::split(UChar separator, Vector<String>& result) const
+{
+ return split(String(&separator, 1), false, result);
+}
+
+CString String::ascii() const
+{
+ // Basic Latin1 (ISO) encoding - Unicode characters 0..255 are
+ // preserved, characters outside of this range are converted to '?'.
+
+ unsigned length = this->length();
+ const UChar* characters = this->characters();
+
+ char* characterBuffer;
+ CString result = CString::newUninitialized(length, characterBuffer);
+
+ for (unsigned i = 0; i < length; ++i) {
+ UChar ch = characters[i];
+ characterBuffer[i] = ch && (ch < 0x20 || ch > 0x7f) ? '?' : ch;
+ }
+
+ return result;
+}
+
+CString String::latin1() const
+{
+ // Basic Latin1 (ISO) encoding - Unicode characters 0..255 are
+ // preserved, characters outside of this range are converted to '?'.
+
+ unsigned length = this->length();
+ const UChar* characters = this->characters();
+
+ char* characterBuffer;
+ CString result = CString::newUninitialized(length, characterBuffer);
+
+ for (unsigned i = 0; i < length; ++i) {
+ UChar ch = characters[i];
+ characterBuffer[i] = ch > 0xff ? '?' : ch;
+ }
+
+ return result;
+}
+
+// Helper to write a three-byte UTF-8 code point to the buffer, caller must check room is available.
+static inline void putUTF8Triple(char*& buffer, UChar ch)
+{
+ ASSERT(ch >= 0x0800);
+ *buffer++ = static_cast<char>(((ch >> 12) & 0x0F) | 0xE0);
+ *buffer++ = static_cast<char>(((ch >> 6) & 0x3F) | 0x80);
+ *buffer++ = static_cast<char>((ch & 0x3F) | 0x80);
+}
+
+CString String::utf8(bool strict) const
+{
+ unsigned length = this->length();
+ const UChar* characters = this->characters();
+
+ // Allocate a buffer big enough to hold all the characters
+ // (an individual UTF-16 UChar can only expand to 3 UTF-8 bytes).
+ // Optimization ideas, if we find this function is hot:
+ // * We could speculatively create a CStringBuffer to contain 'length'
+ // characters, and resize if necessary (i.e. if the buffer contains
+ // non-ascii characters). (Alternatively, scan the buffer first for
+ // ascii characters, so we know this will be sufficient).
+ // * We could allocate a CStringBuffer with an appropriate size to
+ // have a good chance of being able to write the string into the
+ // buffer without reallocing (say, 1.5 x length).
+ if (length > numeric_limits<unsigned>::max() / 3)
+ return CString();
+ Vector<char, 1024> bufferVector(length * 3);
+
+ char* buffer = bufferVector.data();
+ ConversionResult result = convertUTF16ToUTF8(&characters, characters + length, &buffer, buffer + bufferVector.size(), strict);
+ ASSERT(result != targetExhausted); // (length * 3) should be sufficient for any conversion
+
+ // Only produced from strict conversion.
+ if (result == sourceIllegal)
+ return CString();
+
+ // Check for an unconverted high surrogate.
+ if (result == sourceExhausted) {
+ if (strict)
+ return CString();
+ // This should be one unpaired high surrogate. Treat it the same
+ // was as an unpaired high surrogate would have been handled in
+ // the middle of a string with non-strict conversion - which is
+ // to say, simply encode it to UTF-8.
+ ASSERT((characters + 1) == (this->characters() + length));
+ ASSERT((*characters >= 0xD800) && (*characters <= 0xDBFF));
+ // There should be room left, since one UChar hasn't been converted.
+ ASSERT((buffer + 3) <= (buffer + bufferVector.size()));
+ putUTF8Triple(buffer, *characters);
+ }
+
+ return CString(bufferVector.data(), buffer - bufferVector.data());
+}
+
+String String::fromUTF8(const char* stringStart, size_t length)
+{
+ if (length > numeric_limits<unsigned>::max())
+ CRASH();
+
+ if (!stringStart)
+ return String();
+
+ // We'll use a StringImpl as a buffer; if the source string only contains ascii this should be
+ // the right length, if there are any multi-byte sequences this buffer will be too large.
+ UChar* buffer;
+ String stringBuffer(StringImpl::createUninitialized(length, buffer));
+ UChar* bufferEnd = buffer + length;
+
+ // Try converting into the buffer.
+ const char* stringCurrent = stringStart;
+ if (convertUTF8ToUTF16(&stringCurrent, stringStart + length, &buffer, bufferEnd) != conversionOK)
+ return String();
+
+ // stringBuffer is full (the input must have been all ascii) so just return it!
+ if (buffer == bufferEnd)
+ return stringBuffer;
+
+ // stringBuffer served its purpose as a buffer, copy the contents out into a new string.
+ unsigned utf16Length = buffer - stringBuffer.characters();
+ ASSERT(utf16Length < length);
+ return String(stringBuffer.characters(), utf16Length);
+}
+
+String String::fromUTF8(const char* string)
+{
+ if (!string)
+ return String();
+ return fromUTF8(string, strlen(string));
+}
+
+String String::fromUTF8WithLatin1Fallback(const char* string, size_t size)
+{
+ String utf8 = fromUTF8(string, size);
+ if (!utf8)
+ return String(string, size);
+ return utf8;
+}
+
+// String Operations
+
+static bool isCharacterAllowedInBase(UChar c, int base)
+{
+ if (c > 0x7F)
+ return false;
+ if (isASCIIDigit(c))
+ return c - '0' < base;
+ if (isASCIIAlpha(c)) {
+ if (base > 36)
+ base = 36;
+ return (c >= 'a' && c < 'a' + base - 10)
+ || (c >= 'A' && c < 'A' + base - 10);
+ }
+ return false;
+}
+
+template <typename IntegralType>
+static inline IntegralType toIntegralType(const UChar* data, size_t length, bool* ok, int base)
+{
+ static const IntegralType integralMax = numeric_limits<IntegralType>::max();
+ static const bool isSigned = numeric_limits<IntegralType>::is_signed;
+ const IntegralType maxMultiplier = integralMax / base;
+
+ IntegralType value = 0;
+ bool isOk = false;
+ bool isNegative = false;
+
+ if (!data)
+ goto bye;
+
+ // skip leading whitespace
+ while (length && isSpaceOrNewline(*data)) {
+ length--;
+ data++;
+ }
+
+ if (isSigned && length && *data == '-') {
+ length--;
+ data++;
+ isNegative = true;
+ } else if (length && *data == '+') {
+ length--;
+ data++;
+ }
+
+ if (!length || !isCharacterAllowedInBase(*data, base))
+ goto bye;
+
+ while (length && isCharacterAllowedInBase(*data, base)) {
+ length--;
+ IntegralType digitValue;
+ UChar c = *data;
+ if (isASCIIDigit(c))
+ digitValue = c - '0';
+ else if (c >= 'a')
+ digitValue = c - 'a' + 10;
+ else
+ digitValue = c - 'A' + 10;
+
+ if (value > maxMultiplier || (value == maxMultiplier && digitValue > (integralMax % base) + isNegative))
+ goto bye;
+
+ value = base * value + digitValue;
+ data++;
+ }
+
+#if COMPILER(MSVC)
+#pragma warning(push, 0)
+#pragma warning(disable:4146)
+#endif
+
+ if (isNegative)
+ value = -value;
+
+#if COMPILER(MSVC)
+#pragma warning(pop)
+#endif
+
+ // skip trailing space
+ while (length && isSpaceOrNewline(*data)) {
+ length--;
+ data++;
+ }
+
+ if (!length)
+ isOk = true;
+bye:
+ if (ok)
+ *ok = isOk;
+ return isOk ? value : 0;
+}
+
+static unsigned lengthOfCharactersAsInteger(const UChar* data, size_t length)
+{
+ size_t i = 0;
+
+ // Allow leading spaces.
+ for (; i != length; ++i) {
+ if (!isSpaceOrNewline(data[i]))
+ break;
+ }
+
+ // Allow sign.
+ if (i != length && (data[i] == '+' || data[i] == '-'))
+ ++i;
+
+ // Allow digits.
+ for (; i != length; ++i) {
+ if (!isASCIIDigit(data[i]))
+ break;
+ }
+
+ return i;
+}
+
+int charactersToIntStrict(const UChar* data, size_t length, bool* ok, int base)
+{
+ return toIntegralType<int>(data, length, ok, base);
+}
+
+unsigned charactersToUIntStrict(const UChar* data, size_t length, bool* ok, int base)
+{
+ return toIntegralType<unsigned>(data, length, ok, base);
+}
+
+int64_t charactersToInt64Strict(const UChar* data, size_t length, bool* ok, int base)
+{
+ return toIntegralType<int64_t>(data, length, ok, base);
+}
+
+uint64_t charactersToUInt64Strict(const UChar* data, size_t length, bool* ok, int base)
+{
+ return toIntegralType<uint64_t>(data, length, ok, base);
+}
+
+intptr_t charactersToIntPtrStrict(const UChar* data, size_t length, bool* ok, int base)
+{
+ return toIntegralType<intptr_t>(data, length, ok, base);
+}
+
+int charactersToInt(const UChar* data, size_t length, bool* ok)
+{
+ return toIntegralType<int>(data, lengthOfCharactersAsInteger(data, length), ok, 10);
+}
+
+unsigned charactersToUInt(const UChar* data, size_t length, bool* ok)
+{
+ return toIntegralType<unsigned>(data, lengthOfCharactersAsInteger(data, length), ok, 10);
+}
+
+int64_t charactersToInt64(const UChar* data, size_t length, bool* ok)
+{
+ return toIntegralType<int64_t>(data, lengthOfCharactersAsInteger(data, length), ok, 10);
+}
+
+uint64_t charactersToUInt64(const UChar* data, size_t length, bool* ok)
+{
+ return toIntegralType<uint64_t>(data, lengthOfCharactersAsInteger(data, length), ok, 10);
+}
+
+intptr_t charactersToIntPtr(const UChar* data, size_t length, bool* ok)
+{
+ return toIntegralType<intptr_t>(data, lengthOfCharactersAsInteger(data, length), ok, 10);
+}
+
+double charactersToDouble(const UChar* data, size_t length, bool* ok)
+{
+ if (!length) {
+ if (ok)
+ *ok = false;
+ return 0.0;
+ }
+
+ Vector<char, 256> bytes(length + 1);
+ for (unsigned i = 0; i < length; ++i)
+ bytes[i] = data[i] < 0x7F ? data[i] : '?';
+ bytes[length] = '\0';
+ char* end;
+ double val = WTF::strtod(bytes.data(), &end);
+ if (ok)
+ *ok = (end == 0 || *end == '\0');
+ return val;
+}
+
+float charactersToFloat(const UChar* data, size_t length, bool* ok)
+{
+ // FIXME: This will return ok even when the string fits into a double but not a float.
+ return static_cast<float>(charactersToDouble(data, length, ok));
+}
+
+} // namespace WTF
+
+#ifndef NDEBUG
+// For use in the debugger
+String* string(const char*);
+Vector<char> asciiDebug(StringImpl* impl);
+Vector<char> asciiDebug(String& string);
+
+String* string(const char* s)
+{
+ // leaks memory!
+ return new String(s);
+}
+
+Vector<char> asciiDebug(StringImpl* impl)
+{
+ if (!impl)
+ return asciiDebug(String("[null]").impl());
+
+ Vector<char> buffer;
+ unsigned length = impl->length();
+ const UChar* characters = impl->characters();
+
+ buffer.resize(length + 1);
+ for (unsigned i = 0; i < length; ++i) {
+ UChar ch = characters[i];
+ buffer[i] = ch && (ch < 0x20 || ch > 0x7f) ? '?' : ch;
+ }
+ buffer[length] = '\0';
+
+ return buffer;
+}
+
+Vector<char> asciiDebug(String& string)
+{
+ return asciiDebug(string.impl());
+}
+
+#endif
diff --git a/Source/JavaScriptCore/wtf/text/WTFString.h b/Source/JavaScriptCore/wtf/text/WTFString.h
new file mode 100644
index 0000000..4d853d2
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/text/WTFString.h
@@ -0,0 +1,502 @@
+/*
+ * (C) 1999 Lars Knoll (knoll@kde.org)
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef WTFString_h
+#define WTFString_h
+
+// This file would be called String.h, but that conflicts with <string.h>
+// on systems without case-sensitive file systems.
+
+#include "StringImpl.h"
+
+#ifdef __OBJC__
+#include <objc/objc.h>
+#endif
+
+#if PLATFORM(CF)
+typedef const struct __CFString * CFStringRef;
+#endif
+
+#if PLATFORM(QT)
+QT_BEGIN_NAMESPACE
+class QString;
+QT_END_NAMESPACE
+#include <QDataStream>
+#endif
+
+#if PLATFORM(WX)
+class wxString;
+#endif
+
+#if PLATFORM(HAIKU)
+class BString;
+#endif
+
+#if PLATFORM(BREWMP)
+// AECHAR is defined in AEEStdDef.h, but don't include it here to avoid conflicts.
+#ifndef _AECHAR_DEFINED
+typedef uint16 AECHAR;
+#define _AECHAR_DEFINED
+#endif
+#endif
+
+namespace WTF {
+
+class CString;
+struct StringHash;
+
+// Declarations of string operations
+
+bool charactersAreAllASCII(const UChar*, size_t);
+int charactersToIntStrict(const UChar*, size_t, bool* ok = 0, int base = 10);
+unsigned charactersToUIntStrict(const UChar*, size_t, bool* ok = 0, int base = 10);
+int64_t charactersToInt64Strict(const UChar*, size_t, bool* ok = 0, int base = 10);
+uint64_t charactersToUInt64Strict(const UChar*, size_t, bool* ok = 0, int base = 10);
+intptr_t charactersToIntPtrStrict(const UChar*, size_t, bool* ok = 0, int base = 10);
+
+int charactersToInt(const UChar*, size_t, bool* ok = 0); // ignores trailing garbage
+unsigned charactersToUInt(const UChar*, size_t, bool* ok = 0); // ignores trailing garbage
+int64_t charactersToInt64(const UChar*, size_t, bool* ok = 0); // ignores trailing garbage
+uint64_t charactersToUInt64(const UChar*, size_t, bool* ok = 0); // ignores trailing garbage
+intptr_t charactersToIntPtr(const UChar*, size_t, bool* ok = 0); // ignores trailing garbage
+
+double charactersToDouble(const UChar*, size_t, bool* ok = 0);
+float charactersToFloat(const UChar*, size_t, bool* ok = 0);
+
+template<bool isSpecialCharacter(UChar)> bool isAllSpecialCharacters(const UChar*, size_t);
+
+class String {
+public:
+ // Construct a null string, distinguishable from an empty string.
+ String() { }
+
+ // Construct a string with UTF-16 data.
+ String(const UChar* characters, unsigned length);
+
+ // Construct a string with UTF-16 data, from a null-terminated source.
+ String(const UChar*);
+
+ // Construct a string with latin1 data.
+ String(const char* characters, unsigned length);
+
+ // Construct a string with latin1 data, from a null-terminated source.
+ String(const char* characters);
+
+ // Construct a string referencing an existing StringImpl.
+ String(StringImpl* impl) : m_impl(impl) { }
+ String(PassRefPtr<StringImpl> impl) : m_impl(impl) { }
+ String(RefPtr<StringImpl> impl) : m_impl(impl) { }
+
+ // Inline the destructor.
+ ALWAYS_INLINE ~String() { }
+
+ void swap(String& o) { m_impl.swap(o.m_impl); }
+
+ static String adopt(StringBuffer& buffer) { return StringImpl::adopt(buffer); }
+ template<size_t inlineCapacity>
+ static String adopt(Vector<UChar, inlineCapacity>& vector) { return StringImpl::adopt(vector); }
+
+ bool isNull() const { return !m_impl; }
+ bool isEmpty() const { return !m_impl || !m_impl->length(); }
+
+ StringImpl* impl() const { return m_impl.get(); }
+
+ unsigned length() const
+ {
+ if (!m_impl)
+ return 0;
+ return m_impl->length();
+ }
+
+ const UChar* characters() const
+ {
+ if (!m_impl)
+ return 0;
+ return m_impl->characters();
+ }
+
+ CString ascii() const;
+ CString latin1() const;
+ CString utf8(bool strict = false) const;
+
+ UChar operator[](unsigned index) const
+ {
+ if (!m_impl || index >= m_impl->length())
+ return 0;
+ return m_impl->characters()[index];
+ }
+
+ static String number(short);
+ static String number(unsigned short);
+ static String number(int);
+ static String number(unsigned);
+ static String number(long);
+ static String number(unsigned long);
+ static String number(long long);
+ static String number(unsigned long long);
+ static String number(double);
+
+ // Find a single character or string, also with match function & latin1 forms.
+ size_t find(UChar c, unsigned start = 0) const
+ { return m_impl ? m_impl->find(c, start) : notFound; }
+ size_t find(const String& str, unsigned start = 0) const
+ { return m_impl ? m_impl->find(str.impl(), start) : notFound; }
+ size_t find(CharacterMatchFunctionPtr matchFunction, unsigned start = 0) const
+ { return m_impl ? m_impl->find(matchFunction, start) : notFound; }
+ size_t find(const char* str, unsigned start = 0) const
+ { return m_impl ? m_impl->find(str, start) : notFound; }
+
+ // Find the last instance of a single character or string.
+ size_t reverseFind(UChar c, unsigned start = UINT_MAX) const
+ { return m_impl ? m_impl->reverseFind(c, start) : notFound; }
+ size_t reverseFind(const String& str, unsigned start = UINT_MAX) const
+ { return m_impl ? m_impl->reverseFind(str.impl(), start) : notFound; }
+
+ // Case insensitive string matching.
+ size_t findIgnoringCase(const char* str, unsigned start = 0) const
+ { return m_impl ? m_impl->findIgnoringCase(str, start) : notFound; }
+ size_t findIgnoringCase(const String& str, unsigned start = 0) const
+ { return m_impl ? m_impl->findIgnoringCase(str.impl(), start) : notFound; }
+ size_t reverseFindIgnoringCase(const String& str, unsigned start = UINT_MAX) const
+ { return m_impl ? m_impl->reverseFindIgnoringCase(str.impl(), start) : notFound; }
+
+ // Wrappers for find & reverseFind adding dynamic sensitivity check.
+ size_t find(const char* str, unsigned start, bool caseSensitive) const
+ { return caseSensitive ? find(str, start) : findIgnoringCase(str, start); }
+ size_t find(const String& str, unsigned start, bool caseSensitive) const
+ { return caseSensitive ? find(str, start) : findIgnoringCase(str, start); }
+ size_t reverseFind(const String& str, unsigned start, bool caseSensitive) const
+ { return caseSensitive ? reverseFind(str, start) : reverseFindIgnoringCase(str, start); }
+
+ const UChar* charactersWithNullTermination();
+
+ UChar32 characterStartingAt(unsigned) const; // Ditto.
+
+ bool contains(UChar c) const { return find(c) != notFound; }
+ bool contains(const char* str, bool caseSensitive = true) const { return find(str, 0, caseSensitive) != notFound; }
+ bool contains(const String& str, bool caseSensitive = true) const { return find(str, 0, caseSensitive) != notFound; }
+
+ bool startsWith(const String& s, bool caseSensitive = true) const
+ { return m_impl ? m_impl->startsWith(s.impl(), caseSensitive) : s.isEmpty(); }
+ bool endsWith(const String& s, bool caseSensitive = true) const
+ { return m_impl ? m_impl->endsWith(s.impl(), caseSensitive) : s.isEmpty(); }
+
+ void append(const String&);
+ void append(char);
+ void append(UChar);
+ void append(const UChar*, unsigned length);
+ void insert(const String&, unsigned pos);
+ void insert(const UChar*, unsigned length, unsigned pos);
+
+ String& replace(UChar a, UChar b) { if (m_impl) m_impl = m_impl->replace(a, b); return *this; }
+ String& replace(UChar a, const String& b) { if (m_impl) m_impl = m_impl->replace(a, b.impl()); return *this; }
+ String& replace(const String& a, const String& b) { if (m_impl) m_impl = m_impl->replace(a.impl(), b.impl()); return *this; }
+ String& replace(unsigned index, unsigned len, const String& b) { if (m_impl) m_impl = m_impl->replace(index, len, b.impl()); return *this; }
+
+ void makeLower() { if (m_impl) m_impl = m_impl->lower(); }
+ void makeUpper() { if (m_impl) m_impl = m_impl->upper(); }
+ void makeSecure(UChar aChar) { if (m_impl) m_impl = m_impl->secure(aChar); }
+
+ void truncate(unsigned len);
+ void remove(unsigned pos, int len = 1);
+
+ String substring(unsigned pos, unsigned len = UINT_MAX) const;
+ String substringSharingImpl(unsigned pos, unsigned len = UINT_MAX) const;
+ String left(unsigned len) const { return substring(0, len); }
+ String right(unsigned len) const { return substring(length() - len, len); }
+
+ // Returns a lowercase/uppercase version of the string
+ String lower() const;
+ String upper() const;
+
+ String stripWhiteSpace() const;
+ String simplifyWhiteSpace() const;
+
+ String removeCharacters(CharacterMatchFunctionPtr) const;
+ template<bool isSpecialCharacter(UChar)> bool isAllSpecialCharacters() const;
+
+ // Return the string with case folded for case insensitive comparison.
+ String foldCase() const;
+
+#if !PLATFORM(QT)
+ static String format(const char *, ...) WTF_ATTRIBUTE_PRINTF(1, 2);
+#else
+ static String format(const char *, ...);
+#endif
+
+ // Returns an uninitialized string. The characters needs to be written
+ // into the buffer returned in data before the returned string is used.
+ // Failure to do this will have unpredictable results.
+ static String createUninitialized(unsigned length, UChar*& data) { return StringImpl::createUninitialized(length, data); }
+
+ void split(const String& separator, Vector<String>& result) const;
+ void split(const String& separator, bool allowEmptyEntries, Vector<String>& result) const;
+ void split(UChar separator, Vector<String>& result) const;
+ void split(UChar separator, bool allowEmptyEntries, Vector<String>& result) const;
+
+ int toIntStrict(bool* ok = 0, int base = 10) const;
+ unsigned toUIntStrict(bool* ok = 0, int base = 10) const;
+ int64_t toInt64Strict(bool* ok = 0, int base = 10) const;
+ uint64_t toUInt64Strict(bool* ok = 0, int base = 10) const;
+ intptr_t toIntPtrStrict(bool* ok = 0, int base = 10) const;
+
+ int toInt(bool* ok = 0) const;
+ unsigned toUInt(bool* ok = 0) const;
+ int64_t toInt64(bool* ok = 0) const;
+ uint64_t toUInt64(bool* ok = 0) const;
+ intptr_t toIntPtr(bool* ok = 0) const;
+ double toDouble(bool* ok = 0) const;
+ float toFloat(bool* ok = 0) const;
+
+ bool percentage(int& percentage) const;
+
+ // Returns a StringImpl suitable for use on another thread.
+ String crossThreadString() const;
+ // Makes a deep copy. Helpful only if you need to use a String on another thread
+ // (use crossThreadString if the method call doesn't need to be threadsafe).
+ // Since the underlying StringImpl objects are immutable, there's no other reason
+ // to ever prefer copy() over plain old assignment.
+ String threadsafeCopy() const;
+
+ // Prevent Strings from being implicitly convertable to bool as it will be ambiguous on any platform that
+ // allows implicit conversion to another pointer type (e.g., Mac allows implicit conversion to NSString*).
+ typedef struct ImplicitConversionFromWTFStringToBoolDisallowedA* (String::*UnspecifiedBoolTypeA);
+ typedef struct ImplicitConversionFromWTFStringToBoolDisallowedB* (String::*UnspecifiedBoolTypeB);
+ operator UnspecifiedBoolTypeA() const;
+ operator UnspecifiedBoolTypeB() const;
+
+#if PLATFORM(CF)
+ String(CFStringRef);
+ CFStringRef createCFString() const;
+#endif
+
+#ifdef __OBJC__
+ String(NSString*);
+
+ // This conversion maps NULL to "", which loses the meaning of NULL, but we
+ // need this mapping because AppKit crashes when passed nil NSStrings.
+ operator NSString*() const { if (!m_impl) return @""; return *m_impl; }
+#endif
+
+#if PLATFORM(QT)
+ String(const QString&);
+ String(const QStringRef&);
+ operator QString() const;
+#endif
+
+#if PLATFORM(WX)
+ String(const wxString&);
+ operator wxString() const;
+#endif
+
+#if PLATFORM(HAIKU)
+ String(const BString&);
+ operator BString() const;
+#endif
+
+#if PLATFORM(BREWMP)
+ String(const AECHAR*);
+#endif
+
+ // String::fromUTF8 will return a null string if
+ // the input data contains invalid UTF-8 sequences.
+ static String fromUTF8(const char*, size_t);
+ static String fromUTF8(const char*);
+
+ // Tries to convert the passed in string to UTF-8, but will fall back to Latin-1 if the string is not valid UTF-8.
+ static String fromUTF8WithLatin1Fallback(const char*, size_t);
+
+ // Determines the writing direction using the Unicode Bidi Algorithm rules P2 and P3.
+ WTF::Unicode::Direction defaultWritingDirection() const { return m_impl ? m_impl->defaultWritingDirection() : WTF::Unicode::LeftToRight; }
+
+ bool containsOnlyASCII() const { return charactersAreAllASCII(characters(), length()); }
+
+ // Hash table deleted values, which are only constructed and never copied or destroyed.
+ String(WTF::HashTableDeletedValueType) : m_impl(WTF::HashTableDeletedValue) { }
+ bool isHashTableDeletedValue() const { return m_impl.isHashTableDeletedValue(); }
+
+private:
+ RefPtr<StringImpl> m_impl;
+};
+
+#if PLATFORM(QT)
+QDataStream& operator<<(QDataStream& stream, const String& str);
+QDataStream& operator>>(QDataStream& stream, String& str);
+#endif
+
+String operator+(const String&, const String&);
+String operator+(const String&, const char*);
+String operator+(const char*, const String&);
+
+inline String& operator+=(String& a, const String& b) { a.append(b); return a; }
+
+inline bool operator==(const String& a, const String& b) { return equal(a.impl(), b.impl()); }
+inline bool operator==(const String& a, const char* b) { return equal(a.impl(), b); }
+inline bool operator==(const char* a, const String& b) { return equal(a, b.impl()); }
+
+inline bool operator!=(const String& a, const String& b) { return !equal(a.impl(), b.impl()); }
+inline bool operator!=(const String& a, const char* b) { return !equal(a.impl(), b); }
+inline bool operator!=(const char* a, const String& b) { return !equal(a, b.impl()); }
+
+inline bool equalIgnoringCase(const String& a, const String& b) { return equalIgnoringCase(a.impl(), b.impl()); }
+inline bool equalIgnoringCase(const String& a, const char* b) { return equalIgnoringCase(a.impl(), b); }
+inline bool equalIgnoringCase(const char* a, const String& b) { return equalIgnoringCase(a, b.impl()); }
+
+inline bool equalPossiblyIgnoringCase(const String& a, const String& b, bool ignoreCase)
+{
+ return ignoreCase ? equalIgnoringCase(a, b) : (a == b);
+}
+
+inline bool equalIgnoringNullity(const String& a, const String& b) { return equalIgnoringNullity(a.impl(), b.impl()); }
+
+inline bool operator!(const String& str) { return str.isNull(); }
+
+inline void swap(String& a, String& b) { a.swap(b); }
+
+// Definitions of string operations
+
+#ifdef __OBJC__
+// This is for situations in WebKit where the long standing behavior has been
+// "nil if empty", so we try to maintain longstanding behavior for the sake of
+// entrenched clients
+inline NSString* nsStringNilIfEmpty(const String& str) { return str.isEmpty() ? nil : (NSString*)str; }
+#endif
+
+inline bool charactersAreAllASCII(const UChar* characters, size_t length)
+{
+ UChar ored = 0;
+ for (size_t i = 0; i < length; ++i)
+ ored |= characters[i];
+ return !(ored & 0xFF80);
+}
+
+int codePointCompare(const String&, const String&);
+
+inline size_t find(const UChar* characters, unsigned length, UChar matchCharacter, unsigned index = 0)
+{
+ while (index < length) {
+ if (characters[index] == matchCharacter)
+ return index;
+ ++index;
+ }
+ return notFound;
+}
+
+inline size_t find(const UChar* characters, unsigned length, CharacterMatchFunctionPtr matchFunction, unsigned index = 0)
+{
+ while (index < length) {
+ if (matchFunction(characters[index]))
+ return index;
+ ++index;
+ }
+ return notFound;
+}
+
+inline size_t reverseFind(const UChar* characters, unsigned length, UChar matchCharacter, unsigned index = UINT_MAX)
+{
+ if (!length)
+ return notFound;
+ if (index >= length)
+ index = length - 1;
+ while (characters[index] != matchCharacter) {
+ if (!index--)
+ return notFound;
+ }
+ return index;
+}
+
+inline void append(Vector<UChar>& vector, const String& string)
+{
+ vector.append(string.characters(), string.length());
+}
+
+inline void appendNumber(Vector<UChar>& vector, unsigned char number)
+{
+ int numberLength = number > 99 ? 3 : (number > 9 ? 2 : 1);
+ size_t vectorSize = vector.size();
+ vector.grow(vectorSize + numberLength);
+
+ switch (numberLength) {
+ case 3:
+ vector[vectorSize + 2] = number % 10 + '0';
+ number /= 10;
+
+ case 2:
+ vector[vectorSize + 1] = number % 10 + '0';
+ number /= 10;
+
+ case 1:
+ vector[vectorSize] = number % 10 + '0';
+ }
+}
+
+template<bool isSpecialCharacter(UChar)> inline bool isAllSpecialCharacters(const UChar* characters, size_t length)
+{
+ for (size_t i = 0; i < length; ++i) {
+ if (!isSpecialCharacter(characters[i]))
+ return false;
+ }
+ return true;
+}
+
+template<bool isSpecialCharacter(UChar)> inline bool String::isAllSpecialCharacters() const
+{
+ return WTF::isAllSpecialCharacters<isSpecialCharacter>(characters(), length());
+}
+
+// StringHash is the default hash for String
+template<typename T> struct DefaultHash;
+template<> struct DefaultHash<String> {
+ typedef StringHash Hash;
+};
+
+template <> struct VectorTraits<String> : SimpleClassVectorTraits
+{
+ static const bool canInitializeWithMemset = true;
+};
+
+}
+
+using WTF::CString;
+using WTF::String;
+using WTF::append;
+using WTF::appendNumber;
+using WTF::charactersAreAllASCII;
+using WTF::charactersToIntStrict;
+using WTF::charactersToUIntStrict;
+using WTF::charactersToInt64Strict;
+using WTF::charactersToUInt64Strict;
+using WTF::charactersToIntPtrStrict;
+using WTF::charactersToInt;
+using WTF::charactersToUInt;
+using WTF::charactersToInt64;
+using WTF::charactersToUInt64;
+using WTF::charactersToIntPtr;
+using WTF::charactersToDouble;
+using WTF::charactersToFloat;
+using WTF::equal;
+using WTF::equalIgnoringCase;
+using WTF::find;
+using WTF::isAllSpecialCharacters;
+using WTF::isSpaceOrNewline;
+using WTF::reverseFind;
+
+#endif
diff --git a/Source/JavaScriptCore/wtf/unicode/Collator.h b/Source/JavaScriptCore/wtf/unicode/Collator.h
new file mode 100644
index 0000000..fe6a809
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/unicode/Collator.h
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WTF_Collator_h
+#define WTF_Collator_h
+
+#include <wtf/Noncopyable.h>
+#include <wtf/PassOwnPtr.h>
+#include <wtf/unicode/Unicode.h>
+
+#if USE(ICU_UNICODE) && !UCONFIG_NO_COLLATION
+struct UCollator;
+#endif
+
+namespace WTF {
+
+ class Collator : public Noncopyable {
+ public:
+ enum Result { Equal = 0, Greater = 1, Less = -1 };
+
+ Collator(const char* locale); // Parsing is lenient; e.g. language identifiers (such as "en-US") are accepted, too.
+ ~Collator();
+ void setOrderLowerFirst(bool);
+
+ static PassOwnPtr<Collator> userDefault();
+
+ Result collate(const ::UChar*, size_t, const ::UChar*, size_t) const;
+
+ private:
+#if USE(ICU_UNICODE) && !UCONFIG_NO_COLLATION
+ void createCollator() const;
+ void releaseCollator();
+ mutable UCollator* m_collator;
+#endif
+ char* m_locale;
+ bool m_lowerFirst;
+ };
+}
+
+using WTF::Collator;
+
+#endif
diff --git a/Source/JavaScriptCore/wtf/unicode/CollatorDefault.cpp b/Source/JavaScriptCore/wtf/unicode/CollatorDefault.cpp
new file mode 100644
index 0000000..4e05432
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/unicode/CollatorDefault.cpp
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "Collator.h"
+
+#if !USE(ICU_UNICODE) || UCONFIG_NO_COLLATION
+
+namespace WTF {
+
+Collator::Collator(const char*)
+{
+}
+
+Collator::~Collator()
+{
+}
+
+void Collator::setOrderLowerFirst(bool)
+{
+}
+
+PassOwnPtr<Collator> Collator::userDefault()
+{
+ return new Collator(0);
+}
+
+// A default implementation for platforms that lack Unicode-aware collation.
+Collator::Result Collator::collate(const UChar* lhs, size_t lhsLength, const UChar* rhs, size_t rhsLength) const
+{
+ int lmin = lhsLength < rhsLength ? lhsLength : rhsLength;
+ int l = 0;
+ while (l < lmin && *lhs == *rhs) {
+ lhs++;
+ rhs++;
+ l++;
+ }
+
+ if (l < lmin)
+ return (*lhs > *rhs) ? Greater : Less;
+
+ if (lhsLength == rhsLength)
+ return Equal;
+
+ return (lhsLength > rhsLength) ? Greater : Less;
+}
+
+}
+
+#endif
diff --git a/Source/JavaScriptCore/wtf/unicode/UTF8.cpp b/Source/JavaScriptCore/wtf/unicode/UTF8.cpp
new file mode 100644
index 0000000..dc24ed5
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/unicode/UTF8.cpp
@@ -0,0 +1,401 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2010 Patrick Gansterer <paroga@paroga.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "UTF8.h"
+#include <wtf/StringHasher.h>
+
+#include "ASCIICType.h"
+
+namespace WTF {
+namespace Unicode {
+
+// FIXME: Use definition from CharacterNames.h.
+static const UChar replacementCharacter = 0xFFFD;
+
+inline int inlineUTF8SequenceLengthNonASCII(char b0)
+{
+ if ((b0 & 0xC0) != 0xC0)
+ return 0;
+ if ((b0 & 0xE0) == 0xC0)
+ return 2;
+ if ((b0 & 0xF0) == 0xE0)
+ return 3;
+ if ((b0 & 0xF8) == 0xF0)
+ return 4;
+ return 0;
+}
+
+inline int inlineUTF8SequenceLength(char b0)
+{
+ return isASCII(b0) ? 1 : inlineUTF8SequenceLengthNonASCII(b0);
+}
+
+int UTF8SequenceLength(char b0)
+{
+ return isASCII(b0) ? 1 : inlineUTF8SequenceLengthNonASCII(b0);
+}
+
+int decodeUTF8Sequence(const char* sequence)
+{
+ // Handle 0-byte sequences (never valid).
+ const unsigned char b0 = sequence[0];
+ const int length = inlineUTF8SequenceLength(b0);
+ if (length == 0)
+ return -1;
+
+ // Handle 1-byte sequences (plain ASCII).
+ const unsigned char b1 = sequence[1];
+ if (length == 1) {
+ if (b1)
+ return -1;
+ return b0;
+ }
+
+ // Handle 2-byte sequences.
+ if ((b1 & 0xC0) != 0x80)
+ return -1;
+ const unsigned char b2 = sequence[2];
+ if (length == 2) {
+ if (b2)
+ return -1;
+ const int c = ((b0 & 0x1F) << 6) | (b1 & 0x3F);
+ if (c < 0x80)
+ return -1;
+ return c;
+ }
+
+ // Handle 3-byte sequences.
+ if ((b2 & 0xC0) != 0x80)
+ return -1;
+ const unsigned char b3 = sequence[3];
+ if (length == 3) {
+ if (b3)
+ return -1;
+ const int c = ((b0 & 0xF) << 12) | ((b1 & 0x3F) << 6) | (b2 & 0x3F);
+ if (c < 0x800)
+ return -1;
+ // UTF-16 surrogates should never appear in UTF-8 data.
+ if (c >= 0xD800 && c <= 0xDFFF)
+ return -1;
+ return c;
+ }
+
+ // Handle 4-byte sequences.
+ if ((b3 & 0xC0) != 0x80)
+ return -1;
+ const unsigned char b4 = sequence[4];
+ if (length == 4) {
+ if (b4)
+ return -1;
+ const int c = ((b0 & 0x7) << 18) | ((b1 & 0x3F) << 12) | ((b2 & 0x3F) << 6) | (b3 & 0x3F);
+ if (c < 0x10000 || c > 0x10FFFF)
+ return -1;
+ return c;
+ }
+
+ return -1;
+}
+
+// Once the bits are split out into bytes of UTF-8, this is a mask OR-ed
+// into the first byte, depending on how many bytes follow. There are
+// as many entries in this table as there are UTF-8 sequence types.
+// (I.e., one byte sequence, two byte... etc.). Remember that sequencs
+// for *legal* UTF-8 will be 4 or fewer bytes total.
+static const unsigned char firstByteMark[7] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC };
+
+ConversionResult convertUTF16ToUTF8(
+ const UChar** sourceStart, const UChar* sourceEnd,
+ char** targetStart, char* targetEnd, bool strict)
+{
+ ConversionResult result = conversionOK;
+ const UChar* source = *sourceStart;
+ char* target = *targetStart;
+ while (source < sourceEnd) {
+ UChar32 ch;
+ unsigned short bytesToWrite = 0;
+ const UChar32 byteMask = 0xBF;
+ const UChar32 byteMark = 0x80;
+ const UChar* oldSource = source; // In case we have to back up because of target overflow.
+ ch = static_cast<unsigned short>(*source++);
+ // If we have a surrogate pair, convert to UChar32 first.
+ if (ch >= 0xD800 && ch <= 0xDBFF) {
+ // If the 16 bits following the high surrogate are in the source buffer...
+ if (source < sourceEnd) {
+ UChar32 ch2 = static_cast<unsigned short>(*source);
+ // If it's a low surrogate, convert to UChar32.
+ if (ch2 >= 0xDC00 && ch2 <= 0xDFFF) {
+ ch = ((ch - 0xD800) << 10) + (ch2 - 0xDC00) + 0x0010000;
+ ++source;
+ } else if (strict) { // it's an unpaired high surrogate
+ --source; // return to the illegal value itself
+ result = sourceIllegal;
+ break;
+ }
+ } else { // We don't have the 16 bits following the high surrogate.
+ --source; // return to the high surrogate
+ result = sourceExhausted;
+ break;
+ }
+ } else if (strict) {
+ // UTF-16 surrogate values are illegal in UTF-32
+ if (ch >= 0xDC00 && ch <= 0xDFFF) {
+ --source; // return to the illegal value itself
+ result = sourceIllegal;
+ break;
+ }
+ }
+ // Figure out how many bytes the result will require
+ if (ch < (UChar32)0x80) {
+ bytesToWrite = 1;
+ } else if (ch < (UChar32)0x800) {
+ bytesToWrite = 2;
+ } else if (ch < (UChar32)0x10000) {
+ bytesToWrite = 3;
+ } else if (ch < (UChar32)0x110000) {
+ bytesToWrite = 4;
+ } else {
+ bytesToWrite = 3;
+ ch = replacementCharacter;
+ }
+
+ target += bytesToWrite;
+ if (target > targetEnd) {
+ source = oldSource; // Back up source pointer!
+ target -= bytesToWrite;
+ result = targetExhausted;
+ break;
+ }
+ switch (bytesToWrite) { // note: everything falls through.
+ case 4: *--target = (char)((ch | byteMark) & byteMask); ch >>= 6;
+ case 3: *--target = (char)((ch | byteMark) & byteMask); ch >>= 6;
+ case 2: *--target = (char)((ch | byteMark) & byteMask); ch >>= 6;
+ case 1: *--target = (char)(ch | firstByteMark[bytesToWrite]);
+ }
+ target += bytesToWrite;
+ }
+ *sourceStart = source;
+ *targetStart = target;
+ return result;
+}
+
+// This must be called with the length pre-determined by the first byte.
+// If presented with a length > 4, this returns false. The Unicode
+// definition of UTF-8 goes up to 4-byte sequences.
+static bool isLegalUTF8(const unsigned char* source, int length)
+{
+ unsigned char a;
+ const unsigned char* srcptr = source + length;
+ switch (length) {
+ default: return false;
+ // Everything else falls through when "true"...
+ case 4: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return false;
+ case 3: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return false;
+ case 2: if ((a = (*--srcptr)) > 0xBF) return false;
+
+ switch (*source) {
+ // no fall-through in this inner switch
+ case 0xE0: if (a < 0xA0) return false; break;
+ case 0xED: if (a > 0x9F) return false; break;
+ case 0xF0: if (a < 0x90) return false; break;
+ case 0xF4: if (a > 0x8F) return false; break;
+ default: if (a < 0x80) return false;
+ }
+
+ case 1: if (*source >= 0x80 && *source < 0xC2) return false;
+ }
+ if (*source > 0xF4)
+ return false;
+ return true;
+}
+
+// Magic values subtracted from a buffer value during UTF8 conversion.
+// This table contains as many values as there might be trailing bytes
+// in a UTF-8 sequence.
+static const UChar32 offsetsFromUTF8[6] = { 0x00000000UL, 0x00003080UL, 0x000E2080UL,
+ 0x03C82080UL, 0xFA082080UL, 0x82082080UL };
+
+static inline UChar32 readUTF8Sequence(const char*& sequence, unsigned length)
+{
+ UChar32 character = 0;
+
+ // The cases all fall through.
+ switch (length) {
+ case 6: character += static_cast<unsigned char>(*sequence++); character <<= 6;
+ case 5: character += static_cast<unsigned char>(*sequence++); character <<= 6;
+ case 4: character += static_cast<unsigned char>(*sequence++); character <<= 6;
+ case 3: character += static_cast<unsigned char>(*sequence++); character <<= 6;
+ case 2: character += static_cast<unsigned char>(*sequence++); character <<= 6;
+ case 1: character += static_cast<unsigned char>(*sequence++);
+ }
+
+ return character - offsetsFromUTF8[length - 1];
+}
+
+ConversionResult convertUTF8ToUTF16(
+ const char** sourceStart, const char* sourceEnd,
+ UChar** targetStart, UChar* targetEnd, bool strict)
+{
+ ConversionResult result = conversionOK;
+ const char* source = *sourceStart;
+ UChar* target = *targetStart;
+ while (source < sourceEnd) {
+ int utf8SequenceLength = inlineUTF8SequenceLength(*source);
+ if (sourceEnd - source < utf8SequenceLength) {
+ result = sourceExhausted;
+ break;
+ }
+ // Do this check whether lenient or strict
+ if (!isLegalUTF8(reinterpret_cast<const unsigned char*>(source), utf8SequenceLength)) {
+ result = sourceIllegal;
+ break;
+ }
+
+ UChar32 character = readUTF8Sequence(source, utf8SequenceLength);
+
+ if (target >= targetEnd) {
+ source -= utf8SequenceLength; // Back up source pointer!
+ result = targetExhausted;
+ break;
+ }
+
+ if (U_IS_BMP(character)) {
+ // UTF-16 surrogate values are illegal in UTF-32
+ if (U_IS_SURROGATE(character)) {
+ if (strict) {
+ source -= utf8SequenceLength; // return to the illegal value itself
+ result = sourceIllegal;
+ break;
+ } else
+ *target++ = replacementCharacter;
+ } else
+ *target++ = character; // normal case
+ } else if (U_IS_SUPPLEMENTARY(character)) {
+ // target is a character in range 0xFFFF - 0x10FFFF
+ if (target + 1 >= targetEnd) {
+ source -= utf8SequenceLength; // Back up source pointer!
+ result = targetExhausted;
+ break;
+ }
+ *target++ = U16_LEAD(character);
+ *target++ = U16_TRAIL(character);
+ } else {
+ if (strict) {
+ source -= utf8SequenceLength; // return to the start
+ result = sourceIllegal;
+ break; // Bail out; shouldn't continue
+ } else
+ *target++ = replacementCharacter;
+ }
+ }
+ *sourceStart = source;
+ *targetStart = target;
+ return result;
+}
+
+unsigned calculateStringHashFromUTF8(const char* data, const char* dataEnd, unsigned& utf16Length)
+{
+ if (!data)
+ return 0;
+
+ WTF::StringHasher stringHasher;
+ utf16Length = 0;
+
+ while (data < dataEnd) {
+ if (isASCII(*data)) {
+ stringHasher.addCharacter(*data++);
+ utf16Length++;
+ continue;
+ }
+
+ int utf8SequenceLength = inlineUTF8SequenceLengthNonASCII(*data);
+
+ if (dataEnd - data < utf8SequenceLength)
+ return false;
+
+ if (!isLegalUTF8(reinterpret_cast<const unsigned char*>(data), utf8SequenceLength))
+ return 0;
+
+ UChar32 character = readUTF8Sequence(data, utf8SequenceLength);
+ ASSERT(!isASCII(character));
+
+ if (U_IS_BMP(character)) {
+ // UTF-16 surrogate values are illegal in UTF-32
+ if (U_IS_SURROGATE(character))
+ return 0;
+ stringHasher.addCharacter(static_cast<UChar>(character)); // normal case
+ utf16Length++;
+ } else if (U_IS_SUPPLEMENTARY(character)) {
+ stringHasher.addCharacters(static_cast<UChar>(U16_LEAD(character)),
+ static_cast<UChar>(U16_TRAIL(character)));
+ utf16Length += 2;
+ } else
+ return 0;
+ }
+
+ return stringHasher.hash();
+}
+
+bool equalUTF16WithUTF8(const UChar* a, const UChar* aEnd, const char* b, const char* bEnd)
+{
+ while (b < bEnd) {
+ if (isASCII(*b)) {
+ if (*a++ != *b++)
+ return false;
+ continue;
+ }
+
+ int utf8SequenceLength = inlineUTF8SequenceLengthNonASCII(*b);
+
+ if (bEnd - b < utf8SequenceLength)
+ return false;
+
+ if (!isLegalUTF8(reinterpret_cast<const unsigned char*>(b), utf8SequenceLength))
+ return 0;
+
+ UChar32 character = readUTF8Sequence(b, utf8SequenceLength);
+ ASSERT(!isASCII(character));
+
+ if (U_IS_BMP(character)) {
+ // UTF-16 surrogate values are illegal in UTF-32
+ if (U_IS_SURROGATE(character))
+ return false;
+ if (*a++ != character)
+ return false;
+ } else if (U_IS_SUPPLEMENTARY(character)) {
+ if (*a++ != U16_LEAD(character))
+ return false;
+ if (*a++ != U16_TRAIL(character))
+ return false;
+ } else
+ return false;
+ }
+
+ return a == aEnd;
+}
+
+} // namespace Unicode
+} // namespace WTF
diff --git a/Source/JavaScriptCore/wtf/unicode/UTF8.h b/Source/JavaScriptCore/wtf/unicode/UTF8.h
new file mode 100644
index 0000000..1f4baca
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/unicode/UTF8.h
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WTF_UTF8_h
+#define WTF_UTF8_h
+
+#include "Unicode.h"
+
+namespace WTF {
+namespace Unicode {
+
+ // Given a first byte, gives the length of the UTF-8 sequence it begins.
+ // Returns 0 for bytes that are not legal starts of UTF-8 sequences.
+ // Only allows sequences of up to 4 bytes, since that works for all Unicode characters (U-00000000 to U-0010FFFF).
+ int UTF8SequenceLength(char);
+
+ // Takes a null-terminated C-style string with a UTF-8 sequence in it and converts it to a character.
+ // Only allows Unicode characters (U-00000000 to U-0010FFFF).
+ // Returns -1 if the sequence is not valid (including presence of extra bytes).
+ int decodeUTF8Sequence(const char*);
+
+ typedef enum {
+ conversionOK, // conversion successful
+ sourceExhausted, // partial character in source, but hit end
+ targetExhausted, // insuff. room in target for conversion
+ sourceIllegal // source sequence is illegal/malformed
+ } ConversionResult;
+
+ // These conversion functions take a "strict" argument. When this
+ // flag is set to strict, both irregular sequences and isolated surrogates
+ // will cause an error. When the flag is set to lenient, both irregular
+ // sequences and isolated surrogates are converted.
+ //
+ // Whether the flag is strict or lenient, all illegal sequences will cause
+ // an error return. This includes sequences such as: <F4 90 80 80>, <C0 80>,
+ // or <A0> in UTF-8, and values above 0x10FFFF in UTF-32. Conformant code
+ // must check for illegal sequences.
+ //
+ // When the flag is set to lenient, characters over 0x10FFFF are converted
+ // to the replacement character; otherwise (when the flag is set to strict)
+ // they constitute an error.
+
+ ConversionResult convertUTF8ToUTF16(
+ const char** sourceStart, const char* sourceEnd,
+ UChar** targetStart, UChar* targetEnd, bool strict = true);
+
+ ConversionResult convertUTF16ToUTF8(
+ const UChar** sourceStart, const UChar* sourceEnd,
+ char** targetStart, char* targetEnd, bool strict = true);
+
+ unsigned calculateStringHashFromUTF8(const char* data, const char* dataEnd, unsigned& utf16Length);
+
+ bool equalUTF16WithUTF8(const UChar* a, const UChar* aEnd, const char* b, const char* bEnd);
+
+} // namespace Unicode
+} // namespace WTF
+
+#endif // WTF_UTF8_h
diff --git a/Source/JavaScriptCore/wtf/unicode/Unicode.h b/Source/JavaScriptCore/wtf/unicode/Unicode.h
new file mode 100644
index 0000000..50524b1
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/unicode/Unicode.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2006 George Staikos <staikos@kde.org>
+ * Copyright (C) 2006, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2007-2009 Torch Mobile, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef WTF_UNICODE_H
+#define WTF_UNICODE_H
+
+#include <wtf/Assertions.h>
+
+#if USE(QT4_UNICODE)
+#include "qt4/UnicodeQt4.h"
+#elif USE(ICU_UNICODE)
+#include <wtf/unicode/icu/UnicodeIcu.h>
+#elif USE(GLIB_UNICODE)
+#include <wtf/unicode/glib/UnicodeGLib.h>
+#elif USE(WINCE_UNICODE)
+#include <wtf/unicode/wince/UnicodeWinCE.h>
+#elif USE(BREWMP_UNICODE)
+#include <wtf/unicode/brew/UnicodeBrew.h>
+#else
+#error "Unknown Unicode implementation"
+#endif
+
+COMPILE_ASSERT(sizeof(UChar) == 2, UCharIsTwoBytes);
+
+#endif // WTF_UNICODE_H
diff --git a/Source/JavaScriptCore/wtf/unicode/UnicodeMacrosFromICU.h b/Source/JavaScriptCore/wtf/unicode/UnicodeMacrosFromICU.h
new file mode 100644
index 0000000..8959912
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/unicode/UnicodeMacrosFromICU.h
@@ -0,0 +1,100 @@
+/*
+ * Copyright (C) 1999-2004, International Business Machines Corporation and others. All Rights Reserved.
+ * Copyright (C) 2006 George Staikos <staikos@kde.org>
+ * Copyright (C) 2006 Alexey Proskuryakov <ap@nypop.com>
+ * Copyright (C) 2007 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2008 Jürg Billeter <j@bitron.ch>
+ * Copyright (C) 2008 Dominik Röttsches <dominik.roettsches@access-company.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef UnicodeMacrosFromICU_h
+#define UnicodeMacrosFromICU_h
+
+// some defines from ICU
+
+#define U_IS_BMP(c) ((UChar32)(c)<=0xffff)
+#define U16_IS_LEAD(c) (((c)&0xfffffc00)==0xd800)
+#define U16_IS_TRAIL(c) (((c)&0xfffffc00)==0xdc00)
+#define U16_SURROGATE_OFFSET ((0xd800<<10UL)+0xdc00-0x10000)
+#define U16_GET_SUPPLEMENTARY(lead, trail) \
+ (((UChar32)(lead)<<10UL)+(UChar32)(trail)-U16_SURROGATE_OFFSET)
+
+#define U16_LEAD(supplementary) (UChar)(((supplementary)>>10)+0xd7c0)
+#define U16_TRAIL(supplementary) (UChar)(((supplementary)&0x3ff)|0xdc00)
+#define U16_LENGTH(c) ((uint32_t)(c) <= 0xffff ? 1 : 2)
+
+#define U_IS_SUPPLEMENTARY(c) ((UChar32)((c)-0x10000)<=0xfffff)
+#define U_IS_SURROGATE(c) (((c)&0xfffff800)==0xd800)
+#define U16_IS_SINGLE(c) !U_IS_SURROGATE(c)
+#define U16_IS_SURROGATE(c) U_IS_SURROGATE(c)
+#define U16_IS_SURROGATE_LEAD(c) (((c)&0x400)==0)
+
+#define U16_GET(s, start, i, length, c) { \
+ (c)=(s)[i]; \
+ if(U16_IS_SURROGATE(c)) { \
+ uint16_t __c2; \
+ if(U16_IS_SURROGATE_LEAD(c)) { \
+ if((i)+1<(length) && U16_IS_TRAIL(__c2=(s)[(i)+1])) { \
+ (c)=U16_GET_SUPPLEMENTARY((c), __c2); \
+ } \
+ } else { \
+ if((i)-1>=(start) && U16_IS_LEAD(__c2=(s)[(i)-1])) { \
+ (c)=U16_GET_SUPPLEMENTARY(__c2, (c)); \
+ } \
+ } \
+ } \
+}
+
+#define U16_PREV(s, start, i, c) { \
+ (c)=(s)[--(i)]; \
+ if(U16_IS_TRAIL(c)) { \
+ uint16_t __c2; \
+ if((i)>(start) && U16_IS_LEAD(__c2=(s)[(i)-1])) { \
+ --(i); \
+ (c)=U16_GET_SUPPLEMENTARY(__c2, (c)); \
+ } \
+ } \
+}
+
+#define U16_BACK_1(s, start, i) { \
+ if(U16_IS_TRAIL((s)[--(i)]) && (i)>(start) && U16_IS_LEAD((s)[(i)-1])) { \
+ --(i); \
+ } \
+}
+
+#define U16_NEXT(s, i, length, c) { \
+ (c)=(s)[(i)++]; \
+ if(U16_IS_LEAD(c)) { \
+ uint16_t __c2; \
+ if((i)<(length) && U16_IS_TRAIL(__c2=(s)[(i)])) { \
+ ++(i); \
+ (c)=U16_GET_SUPPLEMENTARY((c), __c2); \
+ } \
+ } \
+}
+
+#define U16_FWD_1(s, i, length) { \
+ if(U16_IS_LEAD((s)[(i)++]) && (i)<(length) && U16_IS_TRAIL((s)[i])) { \
+ ++(i); \
+ } \
+}
+
+#define U_MASK(x) ((uint32_t)1<<(x))
+
+#endif
diff --git a/Source/JavaScriptCore/wtf/unicode/brew/UnicodeBrew.cpp b/Source/JavaScriptCore/wtf/unicode/brew/UnicodeBrew.cpp
new file mode 100644
index 0000000..8367f17
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/unicode/brew/UnicodeBrew.cpp
@@ -0,0 +1,181 @@
+/*
+ * Copyright (C) 2006 George Staikos <staikos@kde.org>
+ * Copyright (C) 2006 Alexey Proskuryakov <ap@nypop.com>
+ * Copyright (C) 2007-2009 Torch Mobile, Inc.
+ * Copyright (C) 2010 Company 100, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "UnicodeBrew.h"
+
+#include <wchar.h>
+#include <wctype.h>
+
+namespace WTF {
+namespace Unicode {
+
+UChar toLower(UChar c)
+{
+ return towlower(c);
+}
+
+UChar toUpper(UChar c)
+{
+ return towupper(c);
+}
+
+UChar foldCase(UChar c)
+{
+ return towlower(c);
+}
+
+bool isPrintableChar(UChar c)
+{
+ return !!iswprint(c);
+}
+
+bool isUpper(UChar c)
+{
+ return !!iswupper(c);
+}
+
+bool isLower(UChar c)
+{
+ return !!iswlower(c);
+}
+
+bool isDigit(UChar c)
+{
+ return !!iswdigit(c);
+}
+
+bool isPunct(UChar c)
+{
+ return !!iswpunct(c);
+}
+
+bool isAlphanumeric(UChar c)
+{
+ return !!iswalnum(c);
+}
+
+int toLower(UChar* result, int resultLength, const UChar* source, int sourceLength, bool* isError)
+{
+ const UChar* sourceIterator = source;
+ const UChar* sourceEnd = source + sourceLength;
+ UChar* resultIterator = result;
+ UChar* resultEnd = result + resultLength;
+
+ if (sourceLength <= resultLength) {
+ while (sourceIterator < sourceEnd)
+ *resultIterator++ = towlower(*sourceIterator++);
+ } else {
+ while (resultIterator < resultEnd)
+ *resultIterator++ = towlower(*sourceIterator++);
+ }
+
+ int remainingCharacters = sourceIterator < sourceEnd ? sourceEnd - sourceIterator : 0;
+ *isError = !!remainingCharacters;
+ if (resultIterator < resultEnd)
+ *resultIterator = 0;
+
+ return (resultIterator - result) + remainingCharacters;
+}
+
+int toUpper(UChar* result, int resultLength, const UChar* source, int sourceLength, bool* isError)
+{
+ const UChar* sourceIterator = source;
+ const UChar* sourceEnd = source + sourceLength;
+ UChar* resultIterator = result;
+ UChar* resultEnd = result + resultLength;
+
+ if (sourceLength <= resultLength) {
+ while (sourceIterator < sourceEnd)
+ *resultIterator++ = towupper(*sourceIterator++);
+ } else {
+ while (resultIterator < resultEnd)
+ *resultIterator++ = towupper(*sourceIterator++);
+ }
+
+ int remainingCharacters = sourceIterator < sourceEnd ? sourceEnd - sourceIterator : 0;
+ *isError = !!remainingCharacters;
+ if (resultIterator < resultEnd)
+ *resultIterator = 0;
+
+ return (resultIterator - result) + remainingCharacters;
+}
+
+int foldCase(UChar* result, int resultLength, const UChar* source, int sourceLength, bool* isError)
+{
+ *isError = false;
+ if (resultLength < sourceLength) {
+ *isError = true;
+ return sourceLength;
+ }
+ for (int i = 0; i < sourceLength; ++i)
+ result[i] = foldCase(source[i]);
+ return sourceLength;
+}
+
+UChar toTitleCase(UChar c)
+{
+ return towupper(c);
+}
+
+Direction direction(UChar32 c)
+{
+ return static_cast<Direction>(ICU::direction(c));
+}
+
+CharCategory category(unsigned int c)
+{
+ return static_cast<CharCategory>(TO_MASK((int8_t) ICU::category(c)));
+}
+
+DecompositionType decompositionType(UChar32 c)
+{
+ return static_cast<DecompositionType>(ICU::decompositionType(c));
+}
+
+unsigned char combiningClass(UChar32 c)
+{
+ return ICU::combiningClass(c);
+}
+
+UChar mirroredChar(UChar32 c)
+{
+ return ICU::mirroredChar(c);
+}
+
+int digitValue(UChar c)
+{
+ return ICU::digitValue(c);
+}
+
+bool isSpace(UChar c)
+{
+ return !!iswspace(c);
+}
+
+bool isLetter(UChar c)
+{
+ return !!iswalpha(c);
+}
+
+} // namespace Unicode
+} // namespace WTF
diff --git a/Source/JavaScriptCore/wtf/unicode/brew/UnicodeBrew.h b/Source/JavaScriptCore/wtf/unicode/brew/UnicodeBrew.h
new file mode 100644
index 0000000..1d7576f
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/unicode/brew/UnicodeBrew.h
@@ -0,0 +1,194 @@
+/*
+ * Copyright (C) 2006 George Staikos <staikos@kde.org>
+ * Copyright (C) 2006 Alexey Proskuryakov <ap@nypop.com>
+ * Copyright (C) 2007 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2007-2009 Torch Mobile, Inc.
+ * Copyright (C) 2010 Company 100, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef UnicodeBrew_h
+#define UnicodeBrew_h
+
+#include "UnicodeFromICU.h"
+#include "UnicodeMacrosFromICU.h"
+
+namespace WTF {
+namespace Unicode {
+
+enum Direction {
+ LeftToRight = ICU::U_LEFT_TO_RIGHT,
+ RightToLeft = ICU::U_RIGHT_TO_LEFT,
+ EuropeanNumber = ICU::U_EUROPEAN_NUMBER,
+ EuropeanNumberSeparator = ICU::U_EUROPEAN_NUMBER_SEPARATOR,
+ EuropeanNumberTerminator = ICU::U_EUROPEAN_NUMBER_TERMINATOR,
+ ArabicNumber = ICU::U_ARABIC_NUMBER,
+ CommonNumberSeparator = ICU::U_COMMON_NUMBER_SEPARATOR,
+ BlockSeparator = ICU::U_BLOCK_SEPARATOR,
+ SegmentSeparator = ICU::U_SEGMENT_SEPARATOR,
+ WhiteSpaceNeutral = ICU::U_WHITE_SPACE_NEUTRAL,
+ OtherNeutral = ICU::U_OTHER_NEUTRAL,
+ LeftToRightEmbedding = ICU::U_LEFT_TO_RIGHT_EMBEDDING,
+ LeftToRightOverride = ICU::U_LEFT_TO_RIGHT_OVERRIDE,
+ RightToLeftArabic = ICU::U_RIGHT_TO_LEFT_ARABIC,
+ RightToLeftEmbedding = ICU::U_RIGHT_TO_LEFT_EMBEDDING,
+ RightToLeftOverride = ICU::U_RIGHT_TO_LEFT_OVERRIDE,
+ PopDirectionalFormat = ICU::U_POP_DIRECTIONAL_FORMAT,
+ NonSpacingMark = ICU::U_DIR_NON_SPACING_MARK,
+ BoundaryNeutral = ICU::U_BOUNDARY_NEUTRAL
+};
+
+enum DecompositionType {
+ DecompositionNone = ICU::U_DT_NONE,
+ DecompositionCanonical = ICU::U_DT_CANONICAL,
+ DecompositionCompat = ICU::U_DT_COMPAT,
+ DecompositionCircle = ICU::U_DT_CIRCLE,
+ DecompositionFinal = ICU::U_DT_FINAL,
+ DecompositionFont = ICU::U_DT_FONT,
+ DecompositionFraction = ICU::U_DT_FRACTION,
+ DecompositionInitial = ICU::U_DT_INITIAL,
+ DecompositionIsolated = ICU::U_DT_ISOLATED,
+ DecompositionMedial = ICU::U_DT_MEDIAL,
+ DecompositionNarrow = ICU::U_DT_NARROW,
+ DecompositionNoBreak = ICU::U_DT_NOBREAK,
+ DecompositionSmall = ICU::U_DT_SMALL,
+ DecompositionSquare = ICU::U_DT_SQUARE,
+ DecompositionSub = ICU::U_DT_SUB,
+ DecompositionSuper = ICU::U_DT_SUPER,
+ DecompositionVertical = ICU::U_DT_VERTICAL,
+ DecompositionWide = ICU::U_DT_WIDE,
+};
+
+enum CharCategory {
+ NoCategory = 0,
+ Other_NotAssigned = TO_MASK(ICU::U_GENERAL_OTHER_TYPES),
+ Letter_Uppercase = TO_MASK(ICU::U_UPPERCASE_LETTER),
+ Letter_Lowercase = TO_MASK(ICU::U_LOWERCASE_LETTER),
+ Letter_Titlecase = TO_MASK(ICU::U_TITLECASE_LETTER),
+ Letter_Modifier = TO_MASK(ICU::U_MODIFIER_LETTER),
+ Letter_Other = TO_MASK(ICU::U_OTHER_LETTER),
+
+ Mark_NonSpacing = TO_MASK(ICU::U_NON_SPACING_MARK),
+ Mark_Enclosing = TO_MASK(ICU::U_ENCLOSING_MARK),
+ Mark_SpacingCombining = TO_MASK(ICU::U_COMBINING_SPACING_MARK),
+
+ Number_DecimalDigit = TO_MASK(ICU::U_DECIMAL_DIGIT_NUMBER),
+ Number_Letter = TO_MASK(ICU::U_LETTER_NUMBER),
+ Number_Other = TO_MASK(ICU::U_OTHER_NUMBER),
+
+ Separator_Space = TO_MASK(ICU::U_SPACE_SEPARATOR),
+ Separator_Line = TO_MASK(ICU::U_LINE_SEPARATOR),
+ Separator_Paragraph = TO_MASK(ICU::U_PARAGRAPH_SEPARATOR),
+
+ Other_Control = TO_MASK(ICU::U_CONTROL_CHAR),
+ Other_Format = TO_MASK(ICU::U_FORMAT_CHAR),
+ Other_PrivateUse = TO_MASK(ICU::U_PRIVATE_USE_CHAR),
+ Other_Surrogate = TO_MASK(ICU::U_SURROGATE),
+
+ Punctuation_Dash = TO_MASK(ICU::U_DASH_PUNCTUATION),
+ Punctuation_Open = TO_MASK(ICU::U_START_PUNCTUATION),
+ Punctuation_Close = TO_MASK(ICU::U_END_PUNCTUATION),
+ Punctuation_Connector = TO_MASK(ICU::U_CONNECTOR_PUNCTUATION),
+ Punctuation_Other = TO_MASK(ICU::U_OTHER_PUNCTUATION),
+
+ Symbol_Math = TO_MASK(ICU::U_MATH_SYMBOL),
+ Symbol_Currency = TO_MASK(ICU::U_CURRENCY_SYMBOL),
+ Symbol_Modifier = TO_MASK(ICU::U_MODIFIER_SYMBOL),
+ Symbol_Other = TO_MASK(ICU::U_OTHER_SYMBOL),
+
+ Punctuation_InitialQuote = TO_MASK(ICU::U_INITIAL_PUNCTUATION),
+ Punctuation_FinalQuote = TO_MASK(ICU::U_FINAL_PUNCTUATION)
+};
+
+UChar foldCase(UChar);
+
+int foldCase(UChar* result, int resultLength, const UChar* source, int sourceLength, bool* isError);
+
+int toLower(UChar* result, int resultLength, const UChar* source, int sourceLength, bool* isError);
+
+UChar toUpper(UChar);
+UChar toLower(UChar);
+
+bool isUpper(UChar);
+
+int toUpper(UChar* result, int resultLength, const UChar* source, int sourceLength, bool* isError);
+
+UChar toTitleCase(UChar);
+
+inline bool isArabicChar(UChar32 c)
+{
+ return c >= 0x0600 && c <= 0x06FF;
+}
+
+bool isAlphanumeric(UChar);
+
+CharCategory category(unsigned int);
+
+inline bool isSeparatorSpace(UChar c)
+{
+ return category(c) == Separator_Space;
+}
+
+bool isPrintableChar(UChar);
+
+bool isDigit(UChar);
+
+bool isPunct(UChar);
+
+inline bool hasLineBreakingPropertyComplexContext(UChar32)
+{
+ // FIXME: implement!
+ return false;
+}
+
+inline bool hasLineBreakingPropertyComplexContextOrIdeographic(UChar32 c)
+{
+ // FIXME
+ return false;
+}
+
+UChar mirroredChar(UChar32);
+
+Direction direction(UChar32);
+
+bool isLower(UChar);
+
+int digitValue(UChar);
+
+unsigned char combiningClass(UChar32);
+
+DecompositionType decompositionType(UChar32);
+
+inline int umemcasecmp(const UChar* a, const UChar* b, int len)
+{
+ for (int i = 0; i < len; ++i) {
+ UChar c1 = foldCase(a[i]);
+ UChar c2 = foldCase(b[i]);
+ if (c1 != c2)
+ return c1 - c2;
+ }
+ return 0;
+}
+
+bool isSpace(UChar);
+bool isLetter(UChar);
+
+} // namespace Unicode
+} // namespace WTF
+
+#endif
diff --git a/Source/JavaScriptCore/wtf/unicode/glib/UnicodeGLib.cpp b/Source/JavaScriptCore/wtf/unicode/glib/UnicodeGLib.cpp
new file mode 100644
index 0000000..a01c3ee
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/unicode/glib/UnicodeGLib.cpp
@@ -0,0 +1,192 @@
+/*
+ * Copyright (C) 2008 Jürg Billeter <j@bitron.ch>
+ * Copyright (C) 2008 Dominik Röttsches <dominik.roettsches@access-company.com>
+ * Copyright (C) 2010 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+#include "UnicodeGLib.h"
+
+#include <wtf/Vector.h>
+#include <wtf/unicode/UTF8.h>
+
+#define UTF8_IS_SURROGATE(character) (character >= 0x10000 && character <= 0x10FFFF)
+
+namespace WTF {
+namespace Unicode {
+
+UChar32 foldCase(UChar32 ch)
+{
+ GOwnPtr<GError> gerror;
+
+ GOwnPtr<char> utf8char;
+ utf8char.set(g_ucs4_to_utf8(reinterpret_cast<gunichar*>(&ch), 1, 0, 0, &gerror.outPtr()));
+ if (gerror)
+ return ch;
+
+ GOwnPtr<char> utf8caseFolded;
+ utf8caseFolded.set(g_utf8_casefold(utf8char.get(), -1));
+
+ GOwnPtr<gunichar> ucs4Result;
+ ucs4Result.set(g_utf8_to_ucs4_fast(utf8caseFolded.get(), -1, 0));
+
+ return *ucs4Result;
+}
+
+static int getUTF16LengthFromUTF8(const gchar* utf8String, int length)
+{
+ int utf16Length = 0;
+ const gchar* inputString = utf8String;
+
+ while ((utf8String + length - inputString > 0) && *inputString) {
+ gunichar character = g_utf8_get_char(inputString);
+
+ utf16Length += UTF8_IS_SURROGATE(character) ? 2 : 1;
+ inputString = g_utf8_next_char(inputString);
+ }
+
+ return utf16Length;
+}
+
+typedef gchar* (*UTF8CaseFunction)(const gchar*, gssize length);
+
+static int convertCase(UChar* result, int resultLength, const UChar* src, int srcLength, bool* error, UTF8CaseFunction caseFunction)
+{
+ *error = false;
+
+ // Allocate a buffer big enough to hold all the characters.
+ Vector<char> buffer(srcLength * 3);
+ char* utf8Target = buffer.data();
+ const UChar* utf16Source = src;
+ ConversionResult conversionResult = convertUTF16ToUTF8(&utf16Source, utf16Source + srcLength, &utf8Target, utf8Target + buffer.size(), true);
+ if (conversionResult != conversionOK) {
+ *error = true;
+ return -1;
+ }
+ buffer.shrink(utf8Target - buffer.data());
+
+ GOwnPtr<char> utf8Result(caseFunction(buffer.data(), buffer.size()));
+ long utf8ResultLength = strlen(utf8Result.get());
+
+ // Calculate the destination buffer size.
+ int realLength = getUTF16LengthFromUTF8(utf8Result.get(), utf8ResultLength);
+ if (realLength > resultLength) {
+ *error = true;
+ return realLength;
+ }
+
+ // Convert the result to UTF-16.
+ UChar* utf16Target = result;
+ const char* utf8Source = utf8Result.get();
+ conversionResult = convertUTF8ToUTF16(&utf8Source, utf8Source + utf8ResultLength, &utf16Target, utf16Target + resultLength, true);
+ long utf16ResultLength = utf16Target - result;
+ if (conversionResult != conversionOK)
+ *error = true;
+
+ return utf16ResultLength <= 0 ? -1 : utf16ResultLength;
+}
+int foldCase(UChar* result, int resultLength, const UChar* src, int srcLength, bool* error)
+{
+ return convertCase(result, resultLength, src, srcLength, error, g_utf8_casefold);
+}
+
+int toLower(UChar* result, int resultLength, const UChar* src, int srcLength, bool* error)
+{
+ return convertCase(result, resultLength, src, srcLength, error, g_utf8_strdown);
+}
+
+int toUpper(UChar* result, int resultLength, const UChar* src, int srcLength, bool* error)
+{
+ return convertCase(result, resultLength, src, srcLength, error, g_utf8_strup);
+}
+
+Direction direction(UChar32 c)
+{
+ PangoBidiType type = pango_bidi_type_for_unichar(c);
+ switch (type) {
+ case PANGO_BIDI_TYPE_L:
+ return LeftToRight;
+ case PANGO_BIDI_TYPE_R:
+ return RightToLeft;
+ case PANGO_BIDI_TYPE_AL:
+ return RightToLeftArabic;
+ case PANGO_BIDI_TYPE_LRE:
+ return LeftToRightEmbedding;
+ case PANGO_BIDI_TYPE_RLE:
+ return RightToLeftEmbedding;
+ case PANGO_BIDI_TYPE_LRO:
+ return LeftToRightOverride;
+ case PANGO_BIDI_TYPE_RLO:
+ return RightToLeftOverride;
+ case PANGO_BIDI_TYPE_PDF:
+ return PopDirectionalFormat;
+ case PANGO_BIDI_TYPE_EN:
+ return EuropeanNumber;
+ case PANGO_BIDI_TYPE_AN:
+ return ArabicNumber;
+ case PANGO_BIDI_TYPE_ES:
+ return EuropeanNumberSeparator;
+ case PANGO_BIDI_TYPE_ET:
+ return EuropeanNumberTerminator;
+ case PANGO_BIDI_TYPE_CS:
+ return CommonNumberSeparator;
+ case PANGO_BIDI_TYPE_NSM:
+ return NonSpacingMark;
+ case PANGO_BIDI_TYPE_BN:
+ return BoundaryNeutral;
+ case PANGO_BIDI_TYPE_B:
+ return BlockSeparator;
+ case PANGO_BIDI_TYPE_S:
+ return SegmentSeparator;
+ case PANGO_BIDI_TYPE_WS:
+ return WhiteSpaceNeutral;
+ default:
+ return OtherNeutral;
+ }
+}
+
+int umemcasecmp(const UChar* a, const UChar* b, int len)
+{
+ GOwnPtr<char> utf8a;
+ GOwnPtr<char> utf8b;
+
+ utf8a.set(g_utf16_to_utf8(a, len, 0, 0, 0));
+ utf8b.set(g_utf16_to_utf8(b, len, 0, 0, 0));
+
+ GOwnPtr<char> foldedA;
+ GOwnPtr<char> foldedB;
+
+ foldedA.set(g_utf8_casefold(utf8a.get(), -1));
+ foldedB.set(g_utf8_casefold(utf8b.get(), -1));
+
+ // FIXME: umemcasecmp needs to mimic u_memcasecmp of icu
+ // from the ICU docs:
+ // "Compare two strings case-insensitively using full case folding.
+ // his is equivalent to u_strcmp(u_strFoldCase(s1, n, options), u_strFoldCase(s2, n, options))."
+ //
+ // So it looks like we don't need the full g_utf8_collate here,
+ // but really a bitwise comparison of casefolded unicode chars (not utf-8 bytes).
+ // As there is no direct equivalent to this icu function in GLib, for now
+ // we'll use g_utf8_collate():
+
+ return g_utf8_collate(foldedA.get(), foldedB.get());
+}
+
+}
+}
diff --git a/Source/JavaScriptCore/wtf/unicode/glib/UnicodeGLib.h b/Source/JavaScriptCore/wtf/unicode/glib/UnicodeGLib.h
new file mode 100644
index 0000000..46b00ea
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/unicode/glib/UnicodeGLib.h
@@ -0,0 +1,243 @@
+/*
+ * Copyright (C) 2006 George Staikos <staikos@kde.org>
+ * Copyright (C) 2006 Alexey Proskuryakov <ap@nypop.com>
+ * Copyright (C) 2007 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2008 Jürg Billeter <j@bitron.ch>
+ * Copyright (C) 2008 Dominik Röttsches <dominik.roettsches@access-company.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef UnicodeGLib_h
+#define UnicodeGLib_h
+
+#include "UnicodeMacrosFromICU.h"
+#include "GOwnPtr.h"
+
+#include <glib.h>
+#include <pango/pango.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+
+typedef uint16_t UChar;
+typedef int32_t UChar32;
+
+namespace WTF {
+namespace Unicode {
+
+enum Direction {
+ LeftToRight,
+ RightToLeft,
+ EuropeanNumber,
+ EuropeanNumberSeparator,
+ EuropeanNumberTerminator,
+ ArabicNumber,
+ CommonNumberSeparator,
+ BlockSeparator,
+ SegmentSeparator,
+ WhiteSpaceNeutral,
+ OtherNeutral,
+ LeftToRightEmbedding,
+ LeftToRightOverride,
+ RightToLeftArabic,
+ RightToLeftEmbedding,
+ RightToLeftOverride,
+ PopDirectionalFormat,
+ NonSpacingMark,
+ BoundaryNeutral
+};
+
+enum DecompositionType {
+ DecompositionNone,
+ DecompositionCanonical,
+ DecompositionCompat,
+ DecompositionCircle,
+ DecompositionFinal,
+ DecompositionFont,
+ DecompositionFraction,
+ DecompositionInitial,
+ DecompositionIsolated,
+ DecompositionMedial,
+ DecompositionNarrow,
+ DecompositionNoBreak,
+ DecompositionSmall,
+ DecompositionSquare,
+ DecompositionSub,
+ DecompositionSuper,
+ DecompositionVertical,
+ DecompositionWide,
+};
+
+enum CharCategory {
+ NoCategory = 0,
+ Other_NotAssigned = U_MASK(G_UNICODE_UNASSIGNED),
+ Letter_Uppercase = U_MASK(G_UNICODE_UPPERCASE_LETTER),
+ Letter_Lowercase = U_MASK(G_UNICODE_LOWERCASE_LETTER),
+ Letter_Titlecase = U_MASK(G_UNICODE_TITLECASE_LETTER),
+ Letter_Modifier = U_MASK(G_UNICODE_MODIFIER_LETTER),
+ Letter_Other = U_MASK(G_UNICODE_OTHER_LETTER),
+
+ Mark_NonSpacing = U_MASK(G_UNICODE_NON_SPACING_MARK),
+ Mark_Enclosing = U_MASK(G_UNICODE_ENCLOSING_MARK),
+ Mark_SpacingCombining = U_MASK(G_UNICODE_COMBINING_MARK),
+
+ Number_DecimalDigit = U_MASK(G_UNICODE_DECIMAL_NUMBER),
+ Number_Letter = U_MASK(G_UNICODE_LETTER_NUMBER),
+ Number_Other = U_MASK(G_UNICODE_OTHER_NUMBER),
+
+ Separator_Space = U_MASK(G_UNICODE_SPACE_SEPARATOR),
+ Separator_Line = U_MASK(G_UNICODE_LINE_SEPARATOR),
+ Separator_Paragraph = U_MASK(G_UNICODE_PARAGRAPH_SEPARATOR),
+
+ Other_Control = U_MASK(G_UNICODE_CONTROL),
+ Other_Format = U_MASK(G_UNICODE_FORMAT),
+ Other_PrivateUse = U_MASK(G_UNICODE_PRIVATE_USE),
+ Other_Surrogate = U_MASK(G_UNICODE_SURROGATE),
+
+ Punctuation_Dash = U_MASK(G_UNICODE_DASH_PUNCTUATION),
+ Punctuation_Open = U_MASK(G_UNICODE_OPEN_PUNCTUATION),
+ Punctuation_Close = U_MASK(G_UNICODE_CLOSE_PUNCTUATION),
+ Punctuation_Connector = U_MASK(G_UNICODE_CONNECT_PUNCTUATION),
+ Punctuation_Other = U_MASK(G_UNICODE_OTHER_PUNCTUATION),
+
+ Symbol_Math = U_MASK(G_UNICODE_MATH_SYMBOL),
+ Symbol_Currency = U_MASK(G_UNICODE_CURRENCY_SYMBOL),
+ Symbol_Modifier = U_MASK(G_UNICODE_MODIFIER_SYMBOL),
+ Symbol_Other = U_MASK(G_UNICODE_OTHER_SYMBOL),
+
+ Punctuation_InitialQuote = U_MASK(G_UNICODE_INITIAL_PUNCTUATION),
+ Punctuation_FinalQuote = U_MASK(G_UNICODE_FINAL_PUNCTUATION)
+};
+
+UChar32 foldCase(UChar32);
+
+int foldCase(UChar* result, int resultLength, const UChar* src, int srcLength, bool* error);
+
+int toLower(UChar* result, int resultLength, const UChar* src, int srcLength, bool* error);
+
+inline UChar32 toLower(UChar32 c)
+{
+ return g_unichar_tolower(c);
+}
+
+inline UChar32 toUpper(UChar32 c)
+{
+ return g_unichar_toupper(c);
+}
+
+int toUpper(UChar* result, int resultLength, const UChar* src, int srcLength, bool* error);
+
+inline UChar32 toTitleCase(UChar32 c)
+{
+ return g_unichar_totitle(c);
+}
+
+inline bool isArabicChar(UChar32 c)
+{
+ return c >= 0x0600 && c <= 0x06FF;
+}
+
+inline bool isAlphanumeric(UChar32 c)
+{
+ return g_unichar_isalnum(c);
+}
+
+inline bool isFormatChar(UChar32 c)
+{
+ return g_unichar_type(c) == G_UNICODE_FORMAT;
+}
+
+inline bool isSeparatorSpace(UChar32 c)
+{
+ return g_unichar_type(c) == G_UNICODE_SPACE_SEPARATOR;
+}
+
+inline bool isPrintableChar(UChar32 c)
+{
+ return g_unichar_isprint(c);
+}
+
+inline bool isDigit(UChar32 c)
+{
+ return g_unichar_isdigit(c);
+}
+
+inline bool isPunct(UChar32 c)
+{
+ return g_unichar_ispunct(c);
+}
+
+inline bool hasLineBreakingPropertyComplexContext(UChar32 c)
+{
+ // FIXME
+ return false;
+}
+
+inline bool hasLineBreakingPropertyComplexContextOrIdeographic(UChar32 c)
+{
+ // FIXME
+ return false;
+}
+
+inline UChar32 mirroredChar(UChar32 c)
+{
+ gunichar mirror = 0;
+ g_unichar_get_mirror_char(c, &mirror);
+ return mirror;
+}
+
+inline CharCategory category(UChar32 c)
+{
+ if (c > 0xffff)
+ return NoCategory;
+
+ return (CharCategory) U_MASK(g_unichar_type(c));
+}
+
+Direction direction(UChar32);
+
+inline bool isLower(UChar32 c)
+{
+ return g_unichar_islower(c);
+}
+
+inline int digitValue(UChar32 c)
+{
+ return g_unichar_digit_value(c);
+}
+
+inline uint8_t combiningClass(UChar32 c)
+{
+ // FIXME
+ // return g_unichar_combining_class(c);
+ return 0;
+}
+
+inline DecompositionType decompositionType(UChar32 c)
+{
+ // FIXME
+ return DecompositionNone;
+}
+
+int umemcasecmp(const UChar*, const UChar*, int len);
+
+}
+}
+
+#endif
+
diff --git a/Source/JavaScriptCore/wtf/unicode/icu/CollatorICU.cpp b/Source/JavaScriptCore/wtf/unicode/icu/CollatorICU.cpp
new file mode 100644
index 0000000..805b114
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/unicode/icu/CollatorICU.cpp
@@ -0,0 +1,149 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "Collator.h"
+
+#if USE(ICU_UNICODE) && !UCONFIG_NO_COLLATION
+
+#include "Assertions.h"
+#include "Threading.h"
+#include <unicode/ucol.h>
+#include <string.h>
+
+#if OS(DARWIN)
+#include "RetainPtr.h"
+#include <CoreFoundation/CoreFoundation.h>
+#endif
+
+namespace WTF {
+
+static UCollator* cachedCollator;
+static Mutex& cachedCollatorMutex()
+{
+ AtomicallyInitializedStatic(Mutex&, mutex = *new Mutex);
+ return mutex;
+}
+
+Collator::Collator(const char* locale)
+ : m_collator(0)
+ , m_locale(locale ? strdup(locale) : 0)
+ , m_lowerFirst(false)
+{
+}
+
+PassOwnPtr<Collator> Collator::userDefault()
+{
+#if OS(DARWIN) && PLATFORM(CF)
+ // Mac OS X doesn't set UNIX locale to match user-selected one, so ICU default doesn't work.
+#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !OS(IOS)
+ RetainPtr<CFLocaleRef> currentLocale(AdoptCF, CFLocaleCopyCurrent());
+ CFStringRef collationOrder = (CFStringRef)CFLocaleGetValue(currentLocale.get(), kCFLocaleCollatorIdentifier);
+#else
+ RetainPtr<CFStringRef> collationOrderRetainer(AdoptCF, (CFStringRef)CFPreferencesCopyValue(CFSTR("AppleCollationOrder"), kCFPreferencesAnyApplication, kCFPreferencesCurrentUser, kCFPreferencesAnyHost));
+ CFStringRef collationOrder = collationOrderRetainer.get();
+#endif
+ char buf[256];
+ if (!collationOrder)
+ return adoptPtr(new Collator(""));
+ CFStringGetCString(collationOrder, buf, sizeof(buf), kCFStringEncodingASCII);
+ return adoptPtr(new Collator(buf));
+#else
+ return adoptPtr(new Collator(0));
+#endif
+}
+
+Collator::~Collator()
+{
+ releaseCollator();
+ free(m_locale);
+}
+
+void Collator::setOrderLowerFirst(bool lowerFirst)
+{
+ m_lowerFirst = lowerFirst;
+}
+
+Collator::Result Collator::collate(const UChar* lhs, size_t lhsLength, const UChar* rhs, size_t rhsLength) const
+{
+ if (!m_collator)
+ createCollator();
+
+ return static_cast<Result>(ucol_strcoll(m_collator, lhs, lhsLength, rhs, rhsLength));
+}
+
+void Collator::createCollator() const
+{
+ ASSERT(!m_collator);
+ UErrorCode status = U_ZERO_ERROR;
+
+ {
+ Locker<Mutex> lock(cachedCollatorMutex());
+ if (cachedCollator) {
+ const char* cachedCollatorLocale = ucol_getLocaleByType(cachedCollator, ULOC_REQUESTED_LOCALE, &status);
+ ASSERT(U_SUCCESS(status));
+ ASSERT(cachedCollatorLocale);
+
+ UColAttributeValue cachedCollatorLowerFirst = ucol_getAttribute(cachedCollator, UCOL_CASE_FIRST, &status);
+ ASSERT(U_SUCCESS(status));
+
+ // FIXME: default locale is never matched, because ucol_getLocaleByType returns the actual one used, not 0.
+ if (m_locale && 0 == strcmp(cachedCollatorLocale, m_locale)
+ && ((UCOL_LOWER_FIRST == cachedCollatorLowerFirst && m_lowerFirst) || (UCOL_UPPER_FIRST == cachedCollatorLowerFirst && !m_lowerFirst))) {
+ m_collator = cachedCollator;
+ cachedCollator = 0;
+ return;
+ }
+ }
+ }
+
+ m_collator = ucol_open(m_locale, &status);
+ if (U_FAILURE(status)) {
+ status = U_ZERO_ERROR;
+ m_collator = ucol_open("", &status); // Fallback to Unicode Collation Algorithm.
+ }
+ ASSERT(U_SUCCESS(status));
+
+ ucol_setAttribute(m_collator, UCOL_CASE_FIRST, m_lowerFirst ? UCOL_LOWER_FIRST : UCOL_UPPER_FIRST, &status);
+ ASSERT(U_SUCCESS(status));
+}
+
+void Collator::releaseCollator()
+{
+ {
+ Locker<Mutex> lock(cachedCollatorMutex());
+ if (cachedCollator)
+ ucol_close(cachedCollator);
+ cachedCollator = m_collator;
+ m_collator = 0;
+ }
+}
+
+}
+
+#endif
diff --git a/Source/JavaScriptCore/wtf/unicode/icu/UnicodeIcu.h b/Source/JavaScriptCore/wtf/unicode/icu/UnicodeIcu.h
new file mode 100644
index 0000000..a2a5c0a
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/unicode/icu/UnicodeIcu.h
@@ -0,0 +1,235 @@
+/*
+ * Copyright (C) 2006 George Staikos <staikos@kde.org>
+ * Copyright (C) 2006 Alexey Proskuryakov <ap@nypop.com>
+ * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef WTF_UNICODE_ICU_H
+#define WTF_UNICODE_ICU_H
+
+#include <stdlib.h>
+#include <unicode/uchar.h>
+#include <unicode/ustring.h>
+#include <unicode/utf16.h>
+
+namespace WTF {
+namespace Unicode {
+
+enum Direction {
+ LeftToRight = U_LEFT_TO_RIGHT,
+ RightToLeft = U_RIGHT_TO_LEFT,
+ EuropeanNumber = U_EUROPEAN_NUMBER,
+ EuropeanNumberSeparator = U_EUROPEAN_NUMBER_SEPARATOR,
+ EuropeanNumberTerminator = U_EUROPEAN_NUMBER_TERMINATOR,
+ ArabicNumber = U_ARABIC_NUMBER,
+ CommonNumberSeparator = U_COMMON_NUMBER_SEPARATOR,
+ BlockSeparator = U_BLOCK_SEPARATOR,
+ SegmentSeparator = U_SEGMENT_SEPARATOR,
+ WhiteSpaceNeutral = U_WHITE_SPACE_NEUTRAL,
+ OtherNeutral = U_OTHER_NEUTRAL,
+ LeftToRightEmbedding = U_LEFT_TO_RIGHT_EMBEDDING,
+ LeftToRightOverride = U_LEFT_TO_RIGHT_OVERRIDE,
+ RightToLeftArabic = U_RIGHT_TO_LEFT_ARABIC,
+ RightToLeftEmbedding = U_RIGHT_TO_LEFT_EMBEDDING,
+ RightToLeftOverride = U_RIGHT_TO_LEFT_OVERRIDE,
+ PopDirectionalFormat = U_POP_DIRECTIONAL_FORMAT,
+ NonSpacingMark = U_DIR_NON_SPACING_MARK,
+ BoundaryNeutral = U_BOUNDARY_NEUTRAL
+};
+
+enum DecompositionType {
+ DecompositionNone = U_DT_NONE,
+ DecompositionCanonical = U_DT_CANONICAL,
+ DecompositionCompat = U_DT_COMPAT,
+ DecompositionCircle = U_DT_CIRCLE,
+ DecompositionFinal = U_DT_FINAL,
+ DecompositionFont = U_DT_FONT,
+ DecompositionFraction = U_DT_FRACTION,
+ DecompositionInitial = U_DT_INITIAL,
+ DecompositionIsolated = U_DT_ISOLATED,
+ DecompositionMedial = U_DT_MEDIAL,
+ DecompositionNarrow = U_DT_NARROW,
+ DecompositionNoBreak = U_DT_NOBREAK,
+ DecompositionSmall = U_DT_SMALL,
+ DecompositionSquare = U_DT_SQUARE,
+ DecompositionSub = U_DT_SUB,
+ DecompositionSuper = U_DT_SUPER,
+ DecompositionVertical = U_DT_VERTICAL,
+ DecompositionWide = U_DT_WIDE,
+};
+
+enum CharCategory {
+ NoCategory = 0,
+ Other_NotAssigned = U_MASK(U_GENERAL_OTHER_TYPES),
+ Letter_Uppercase = U_MASK(U_UPPERCASE_LETTER),
+ Letter_Lowercase = U_MASK(U_LOWERCASE_LETTER),
+ Letter_Titlecase = U_MASK(U_TITLECASE_LETTER),
+ Letter_Modifier = U_MASK(U_MODIFIER_LETTER),
+ Letter_Other = U_MASK(U_OTHER_LETTER),
+
+ Mark_NonSpacing = U_MASK(U_NON_SPACING_MARK),
+ Mark_Enclosing = U_MASK(U_ENCLOSING_MARK),
+ Mark_SpacingCombining = U_MASK(U_COMBINING_SPACING_MARK),
+
+ Number_DecimalDigit = U_MASK(U_DECIMAL_DIGIT_NUMBER),
+ Number_Letter = U_MASK(U_LETTER_NUMBER),
+ Number_Other = U_MASK(U_OTHER_NUMBER),
+
+ Separator_Space = U_MASK(U_SPACE_SEPARATOR),
+ Separator_Line = U_MASK(U_LINE_SEPARATOR),
+ Separator_Paragraph = U_MASK(U_PARAGRAPH_SEPARATOR),
+
+ Other_Control = U_MASK(U_CONTROL_CHAR),
+ Other_Format = U_MASK(U_FORMAT_CHAR),
+ Other_PrivateUse = U_MASK(U_PRIVATE_USE_CHAR),
+ Other_Surrogate = U_MASK(U_SURROGATE),
+
+ Punctuation_Dash = U_MASK(U_DASH_PUNCTUATION),
+ Punctuation_Open = U_MASK(U_START_PUNCTUATION),
+ Punctuation_Close = U_MASK(U_END_PUNCTUATION),
+ Punctuation_Connector = U_MASK(U_CONNECTOR_PUNCTUATION),
+ Punctuation_Other = U_MASK(U_OTHER_PUNCTUATION),
+
+ Symbol_Math = U_MASK(U_MATH_SYMBOL),
+ Symbol_Currency = U_MASK(U_CURRENCY_SYMBOL),
+ Symbol_Modifier = U_MASK(U_MODIFIER_SYMBOL),
+ Symbol_Other = U_MASK(U_OTHER_SYMBOL),
+
+ Punctuation_InitialQuote = U_MASK(U_INITIAL_PUNCTUATION),
+ Punctuation_FinalQuote = U_MASK(U_FINAL_PUNCTUATION)
+};
+
+inline UChar32 foldCase(UChar32 c)
+{
+ return u_foldCase(c, U_FOLD_CASE_DEFAULT);
+}
+
+inline int foldCase(UChar* result, int resultLength, const UChar* src, int srcLength, bool* error)
+{
+ UErrorCode status = U_ZERO_ERROR;
+ int realLength = u_strFoldCase(result, resultLength, src, srcLength, U_FOLD_CASE_DEFAULT, &status);
+ *error = !U_SUCCESS(status);
+ return realLength;
+}
+
+inline int toLower(UChar* result, int resultLength, const UChar* src, int srcLength, bool* error)
+{
+ UErrorCode status = U_ZERO_ERROR;
+ int realLength = u_strToLower(result, resultLength, src, srcLength, "", &status);
+ *error = !!U_FAILURE(status);
+ return realLength;
+}
+
+inline UChar32 toLower(UChar32 c)
+{
+ return u_tolower(c);
+}
+
+inline UChar32 toUpper(UChar32 c)
+{
+ return u_toupper(c);
+}
+
+inline int toUpper(UChar* result, int resultLength, const UChar* src, int srcLength, bool* error)
+{
+ UErrorCode status = U_ZERO_ERROR;
+ int realLength = u_strToUpper(result, resultLength, src, srcLength, "", &status);
+ *error = !!U_FAILURE(status);
+ return realLength;
+}
+
+inline UChar32 toTitleCase(UChar32 c)
+{
+ return u_totitle(c);
+}
+
+inline bool isArabicChar(UChar32 c)
+{
+ return ublock_getCode(c) == UBLOCK_ARABIC;
+}
+
+inline bool isAlphanumeric(UChar32 c)
+{
+ return u_isalnum(c);
+}
+
+inline bool isSeparatorSpace(UChar32 c)
+{
+ return u_charType(c) == U_SPACE_SEPARATOR;
+}
+
+inline bool isPrintableChar(UChar32 c)
+{
+ return !!u_isprint(c);
+}
+
+inline bool isPunct(UChar32 c)
+{
+ return !!u_ispunct(c);
+}
+
+inline bool hasLineBreakingPropertyComplexContext(UChar32 c)
+{
+ return u_getIntPropertyValue(c, UCHAR_LINE_BREAK) == U_LB_COMPLEX_CONTEXT;
+}
+
+inline bool hasLineBreakingPropertyComplexContextOrIdeographic(UChar32 c)
+{
+ int32_t prop = u_getIntPropertyValue(c, UCHAR_LINE_BREAK);
+ return prop == U_LB_COMPLEX_CONTEXT || prop == U_LB_IDEOGRAPHIC;
+}
+
+inline UChar32 mirroredChar(UChar32 c)
+{
+ return u_charMirror(c);
+}
+
+inline CharCategory category(UChar32 c)
+{
+ return static_cast<CharCategory>(U_GET_GC_MASK(c));
+}
+
+inline Direction direction(UChar32 c)
+{
+ return static_cast<Direction>(u_charDirection(c));
+}
+
+inline bool isLower(UChar32 c)
+{
+ return !!u_islower(c);
+}
+
+inline uint8_t combiningClass(UChar32 c)
+{
+ return u_getCombiningClass(c);
+}
+
+inline DecompositionType decompositionType(UChar32 c)
+{
+ return static_cast<DecompositionType>(u_getIntPropertyValue(c, UCHAR_DECOMPOSITION_TYPE));
+}
+
+inline int umemcasecmp(const UChar* a, const UChar* b, int len)
+{
+ return u_memcasecmp(a, b, len, U_FOLD_CASE_DEFAULT);
+}
+
+} }
+
+#endif // WTF_UNICODE_ICU_H
diff --git a/Source/JavaScriptCore/wtf/unicode/qt4/UnicodeQt4.h b/Source/JavaScriptCore/wtf/unicode/qt4/UnicodeQt4.h
new file mode 100644
index 0000000..eaa7a07
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/unicode/qt4/UnicodeQt4.h
@@ -0,0 +1,375 @@
+/*
+ * Copyright (C) 2006 George Staikos <staikos@kde.org>
+ * Copyright (C) 2006 Alexey Proskuryakov <ap@nypop.com>
+ * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef WTF_UNICODE_QT4_H
+#define WTF_UNICODE_QT4_H
+
+#include "UnicodeMacrosFromICU.h"
+
+#include <QChar>
+#include <QString>
+
+#include <config.h>
+
+#include <stdint.h>
+#if USE(QT_ICU_TEXT_BREAKING)
+#include <unicode/ubrk.h>
+#endif
+
+QT_BEGIN_NAMESPACE
+namespace QUnicodeTables {
+ struct Properties {
+ ushort category : 8;
+ ushort line_break_class : 8;
+ ushort direction : 8;
+ ushort combiningClass :8;
+ ushort joining : 2;
+ signed short digitValue : 6; /* 5 needed */
+ ushort unicodeVersion : 4;
+ ushort lowerCaseSpecial : 1;
+ ushort upperCaseSpecial : 1;
+ ushort titleCaseSpecial : 1;
+ ushort caseFoldSpecial : 1; /* currently unused */
+ signed short mirrorDiff : 16;
+ signed short lowerCaseDiff : 16;
+ signed short upperCaseDiff : 16;
+ signed short titleCaseDiff : 16;
+ signed short caseFoldDiff : 16;
+ };
+ Q_CORE_EXPORT const Properties * QT_FASTCALL properties(uint ucs4);
+ Q_CORE_EXPORT const Properties * QT_FASTCALL properties(ushort ucs2);
+}
+QT_END_NAMESPACE
+
+// ugly hack to make UChar compatible with JSChar in API/JSStringRef.h
+#if defined(Q_OS_WIN) || COMPILER(WINSCW) || (COMPILER(RVCT) && !OS(LINUX))
+typedef wchar_t UChar;
+#else
+typedef uint16_t UChar;
+#endif
+
+#if !USE(QT_ICU_TEXT_BREAKING)
+typedef uint32_t UChar32;
+#endif
+
+namespace WTF {
+namespace Unicode {
+
+enum Direction {
+ LeftToRight = QChar::DirL,
+ RightToLeft = QChar::DirR,
+ EuropeanNumber = QChar::DirEN,
+ EuropeanNumberSeparator = QChar::DirES,
+ EuropeanNumberTerminator = QChar::DirET,
+ ArabicNumber = QChar::DirAN,
+ CommonNumberSeparator = QChar::DirCS,
+ BlockSeparator = QChar::DirB,
+ SegmentSeparator = QChar::DirS,
+ WhiteSpaceNeutral = QChar::DirWS,
+ OtherNeutral = QChar::DirON,
+ LeftToRightEmbedding = QChar::DirLRE,
+ LeftToRightOverride = QChar::DirLRO,
+ RightToLeftArabic = QChar::DirAL,
+ RightToLeftEmbedding = QChar::DirRLE,
+ RightToLeftOverride = QChar::DirRLO,
+ PopDirectionalFormat = QChar::DirPDF,
+ NonSpacingMark = QChar::DirNSM,
+ BoundaryNeutral = QChar::DirBN
+};
+
+enum DecompositionType {
+ DecompositionNone = QChar::NoDecomposition,
+ DecompositionCanonical = QChar::Canonical,
+ DecompositionCompat = QChar::Compat,
+ DecompositionCircle = QChar::Circle,
+ DecompositionFinal = QChar::Final,
+ DecompositionFont = QChar::Font,
+ DecompositionFraction = QChar::Fraction,
+ DecompositionInitial = QChar::Initial,
+ DecompositionIsolated = QChar::Isolated,
+ DecompositionMedial = QChar::Medial,
+ DecompositionNarrow = QChar::Narrow,
+ DecompositionNoBreak = QChar::NoBreak,
+ DecompositionSmall = QChar::Small,
+ DecompositionSquare = QChar::Square,
+ DecompositionSub = QChar::Sub,
+ DecompositionSuper = QChar::Super,
+ DecompositionVertical = QChar::Vertical,
+ DecompositionWide = QChar::Wide
+};
+
+enum CharCategory {
+ NoCategory = 0,
+ Mark_NonSpacing = U_MASK(QChar::Mark_NonSpacing),
+ Mark_SpacingCombining = U_MASK(QChar::Mark_SpacingCombining),
+ Mark_Enclosing = U_MASK(QChar::Mark_Enclosing),
+ Number_DecimalDigit = U_MASK(QChar::Number_DecimalDigit),
+ Number_Letter = U_MASK(QChar::Number_Letter),
+ Number_Other = U_MASK(QChar::Number_Other),
+ Separator_Space = U_MASK(QChar::Separator_Space),
+ Separator_Line = U_MASK(QChar::Separator_Line),
+ Separator_Paragraph = U_MASK(QChar::Separator_Paragraph),
+ Other_Control = U_MASK(QChar::Other_Control),
+ Other_Format = U_MASK(QChar::Other_Format),
+ Other_Surrogate = U_MASK(QChar::Other_Surrogate),
+ Other_PrivateUse = U_MASK(QChar::Other_PrivateUse),
+ Other_NotAssigned = U_MASK(QChar::Other_NotAssigned),
+ Letter_Uppercase = U_MASK(QChar::Letter_Uppercase),
+ Letter_Lowercase = U_MASK(QChar::Letter_Lowercase),
+ Letter_Titlecase = U_MASK(QChar::Letter_Titlecase),
+ Letter_Modifier = U_MASK(QChar::Letter_Modifier),
+ Letter_Other = U_MASK(QChar::Letter_Other),
+ Punctuation_Connector = U_MASK(QChar::Punctuation_Connector),
+ Punctuation_Dash = U_MASK(QChar::Punctuation_Dash),
+ Punctuation_Open = U_MASK(QChar::Punctuation_Open),
+ Punctuation_Close = U_MASK(QChar::Punctuation_Close),
+ Punctuation_InitialQuote = U_MASK(QChar::Punctuation_InitialQuote),
+ Punctuation_FinalQuote = U_MASK(QChar::Punctuation_FinalQuote),
+ Punctuation_Other = U_MASK(QChar::Punctuation_Other),
+ Symbol_Math = U_MASK(QChar::Symbol_Math),
+ Symbol_Currency = U_MASK(QChar::Symbol_Currency),
+ Symbol_Modifier = U_MASK(QChar::Symbol_Modifier),
+ Symbol_Other = U_MASK(QChar::Symbol_Other)
+};
+
+
+// FIXME: handle surrogates correctly in all methods
+
+inline UChar32 toLower(UChar32 ch)
+{
+ return QChar::toLower(uint32_t(ch));
+}
+
+inline int toLower(UChar* result, int resultLength, const UChar* src, int srcLength, bool* error)
+{
+ const UChar *e = src + srcLength;
+ const UChar *s = src;
+ UChar *r = result;
+ uint rindex = 0;
+
+ // this avoids one out of bounds check in the loop
+ if (s < e && QChar(*s).isLowSurrogate()) {
+ if (r)
+ r[rindex] = *s++;
+ ++rindex;
+ }
+
+ int needed = 0;
+ while (s < e && (rindex < uint(resultLength) || !r)) {
+ uint c = *s;
+ if (QChar(c).isLowSurrogate() && QChar(*(s - 1)).isHighSurrogate())
+ c = QChar::surrogateToUcs4(*(s - 1), c);
+ const QUnicodeTables::Properties *prop = QUnicodeTables::properties(c);
+ if (prop->lowerCaseSpecial) {
+ QString qstring;
+ if (c < 0x10000) {
+ qstring += QChar(c);
+ } else {
+ qstring += QChar(*(s-1));
+ qstring += QChar(*s);
+ }
+ qstring = qstring.toLower();
+ for (int i = 0; i < qstring.length(); ++i) {
+ if (rindex >= uint(resultLength)) {
+ needed += qstring.length() - i;
+ break;
+ }
+ if (r)
+ r[rindex] = qstring.at(i).unicode();
+ ++rindex;
+ }
+ } else {
+ if (r)
+ r[rindex] = *s + prop->lowerCaseDiff;
+ ++rindex;
+ }
+ ++s;
+ }
+ if (s < e)
+ needed += e - s;
+ *error = (needed != 0);
+ if (rindex < uint(resultLength))
+ r[rindex] = 0;
+ return rindex + needed;
+}
+
+inline UChar32 toUpper(UChar32 c)
+{
+ return QChar::toUpper(uint32_t(c));
+}
+
+inline int toUpper(UChar* result, int resultLength, const UChar* src, int srcLength, bool* error)
+{
+ const UChar *e = src + srcLength;
+ const UChar *s = src;
+ UChar *r = result;
+ int rindex = 0;
+
+ // this avoids one out of bounds check in the loop
+ if (s < e && QChar(*s).isLowSurrogate()) {
+ if (r)
+ r[rindex] = *s++;
+ ++rindex;
+ }
+
+ int needed = 0;
+ while (s < e && (rindex < resultLength || !r)) {
+ uint c = *s;
+ if (QChar(c).isLowSurrogate() && QChar(*(s - 1)).isHighSurrogate())
+ c = QChar::surrogateToUcs4(*(s - 1), c);
+ const QUnicodeTables::Properties *prop = QUnicodeTables::properties(c);
+ if (prop->upperCaseSpecial) {
+ QString qstring;
+ if (c < 0x10000) {
+ qstring += QChar(c);
+ } else {
+ qstring += QChar(*(s-1));
+ qstring += QChar(*s);
+ }
+ qstring = qstring.toUpper();
+ for (int i = 0; i < qstring.length(); ++i) {
+ if (rindex >= resultLength) {
+ needed += qstring.length() - i;
+ break;
+ }
+ if (r)
+ r[rindex] = qstring.at(i).unicode();
+ ++rindex;
+ }
+ } else {
+ if (r)
+ r[rindex] = *s + prop->upperCaseDiff;
+ ++rindex;
+ }
+ ++s;
+ }
+ if (s < e)
+ needed += e - s;
+ *error = (needed != 0);
+ if (rindex < resultLength)
+ r[rindex] = 0;
+ return rindex + needed;
+}
+
+inline int toTitleCase(UChar32 c)
+{
+ return QChar::toTitleCase(uint32_t(c));
+}
+
+inline UChar32 foldCase(UChar32 c)
+{
+ return QChar::toCaseFolded(uint32_t(c));
+}
+
+inline int foldCase(UChar* result, int resultLength, const UChar* src, int srcLength, bool* error)
+{
+ // FIXME: handle special casing. Easiest with some low level API in Qt
+ *error = false;
+ if (resultLength < srcLength) {
+ *error = true;
+ return srcLength;
+ }
+ for (int i = 0; i < srcLength; ++i)
+ result[i] = QChar::toCaseFolded(ushort(src[i]));
+ return srcLength;
+}
+
+inline bool isArabicChar(UChar32 c)
+{
+ return c >= 0x0600 && c <= 0x06FF;
+}
+
+inline bool isPrintableChar(UChar32 c)
+{
+ const uint test = U_MASK(QChar::Other_Control) |
+ U_MASK(QChar::Other_NotAssigned);
+ return !(U_MASK(QChar::category(uint32_t(c))) & test);
+}
+
+inline bool isSeparatorSpace(UChar32 c)
+{
+ return QChar::category(uint32_t(c)) == QChar::Separator_Space;
+}
+
+inline bool isPunct(UChar32 c)
+{
+ const uint test = U_MASK(QChar::Punctuation_Connector) |
+ U_MASK(QChar::Punctuation_Dash) |
+ U_MASK(QChar::Punctuation_Open) |
+ U_MASK(QChar::Punctuation_Close) |
+ U_MASK(QChar::Punctuation_InitialQuote) |
+ U_MASK(QChar::Punctuation_FinalQuote) |
+ U_MASK(QChar::Punctuation_Other);
+ return U_MASK(QChar::category(uint32_t(c))) & test;
+}
+
+inline bool isLower(UChar32 c)
+{
+ return QChar::category(uint32_t(c)) == QChar::Letter_Lowercase;
+}
+
+inline bool hasLineBreakingPropertyComplexContext(UChar32)
+{
+ // FIXME: Implement this to return whether the character has line breaking property SA (Complex Context).
+ return false;
+}
+
+inline UChar32 mirroredChar(UChar32 c)
+{
+ return QChar::mirroredChar(uint32_t(c));
+}
+
+inline uint8_t combiningClass(UChar32 c)
+{
+ return QChar::combiningClass(uint32_t(c));
+}
+
+inline DecompositionType decompositionType(UChar32 c)
+{
+ return (DecompositionType)QChar::decompositionTag(c);
+}
+
+inline int umemcasecmp(const UChar* a, const UChar* b, int len)
+{
+ // handle surrogates correctly
+ for (int i = 0; i < len; ++i) {
+ uint c1 = QChar::toCaseFolded(ushort(a[i]));
+ uint c2 = QChar::toCaseFolded(ushort(b[i]));
+ if (c1 != c2)
+ return c1 - c2;
+ }
+ return 0;
+}
+
+inline Direction direction(UChar32 c)
+{
+ return (Direction)QChar::direction(uint32_t(c));
+}
+
+inline CharCategory category(UChar32 c)
+{
+ return (CharCategory) U_MASK(QChar::category(uint32_t(c)));
+}
+
+} }
+
+#endif // WTF_UNICODE_QT4_H
diff --git a/Source/JavaScriptCore/wtf/unicode/wince/UnicodeWinCE.cpp b/Source/JavaScriptCore/wtf/unicode/wince/UnicodeWinCE.cpp
new file mode 100644
index 0000000..96dac7d
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/unicode/wince/UnicodeWinCE.cpp
@@ -0,0 +1,181 @@
+/*
+ * Copyright (C) 2006 George Staikos <staikos@kde.org>
+ * Copyright (C) 2006 Alexey Proskuryakov <ap@nypop.com>
+ * Copyright (C) 2007-2009 Torch Mobile, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "UnicodeWinCE.h"
+
+#include <wchar.h>
+
+namespace WTF {
+namespace Unicode {
+
+UChar toLower(UChar c)
+{
+ return towlower(c);
+}
+
+UChar toUpper(UChar c)
+{
+ return towupper(c);
+}
+
+UChar foldCase(UChar c)
+{
+ return towlower(c);
+}
+
+bool isPrintableChar(UChar c)
+{
+ return !!iswprint(c);
+}
+
+bool isSpace(UChar c)
+{
+ return !!iswspace(c);
+}
+
+bool isLetter(UChar c)
+{
+ return !!iswalpha(c);
+}
+
+bool isUpper(UChar c)
+{
+ return !!iswupper(c);
+}
+
+bool isLower(UChar c)
+{
+ return !!iswlower(c);
+}
+
+bool isDigit(UChar c)
+{
+ return !!iswdigit(c);
+}
+
+bool isPunct(UChar c)
+{
+ return !!iswpunct(c);
+}
+
+bool isAlphanumeric(UChar c)
+{
+ return !!iswalnum(c);
+}
+
+int toLower(UChar* result, int resultLength, const UChar* source, int sourceLength, bool* isError)
+{
+ const UChar* sourceIterator = source;
+ const UChar* sourceEnd = source + sourceLength;
+ UChar* resultIterator = result;
+ UChar* resultEnd = result + resultLength;
+
+ int remainingCharacters = 0;
+ if (sourceLength <= resultLength)
+ while (sourceIterator < sourceEnd)
+ *resultIterator++ = towlower(*sourceIterator++);
+ else
+ while (resultIterator < resultEnd)
+ *resultIterator++ = towlower(*sourceIterator++);
+
+ if (sourceIterator < sourceEnd)
+ remainingCharacters += sourceEnd - sourceIterator;
+ *isError = !!remainingCharacters;
+ if (resultIterator < resultEnd)
+ *resultIterator = 0;
+
+ return (resultIterator - result) + remainingCharacters;
+}
+
+int toUpper(UChar* result, int resultLength, const UChar* source, int sourceLength, bool* isError)
+{
+ const UChar* sourceIterator = source;
+ const UChar* sourceEnd = source + sourceLength;
+ UChar* resultIterator = result;
+ UChar* resultEnd = result + resultLength;
+
+ int remainingCharacters = 0;
+ if (sourceLength <= resultLength)
+ while (sourceIterator < sourceEnd)
+ *resultIterator++ = towupper(*sourceIterator++);
+ else
+ while (resultIterator < resultEnd)
+ *resultIterator++ = towupper(*sourceIterator++);
+
+ if (sourceIterator < sourceEnd)
+ remainingCharacters += sourceEnd - sourceIterator;
+ *isError = !!remainingCharacters;
+ if (resultIterator < resultEnd)
+ *resultIterator = 0;
+
+ return (resultIterator - result) + remainingCharacters;
+}
+
+int foldCase(UChar* result, int resultLength, const UChar* source, int sourceLength, bool* isError)
+{
+ *isError = false;
+ if (resultLength < sourceLength) {
+ *isError = true;
+ return sourceLength;
+ }
+ for (int i = 0; i < sourceLength; ++i)
+ result[i] = foldCase(source[i]);
+ return sourceLength;
+}
+
+UChar toTitleCase(UChar c)
+{
+ return towupper(c);
+}
+
+Direction direction(UChar32 c)
+{
+ return static_cast<Direction>(UnicodeCE::direction(c));
+}
+
+CharCategory category(unsigned int c)
+{
+ return static_cast<CharCategory>(TO_MASK((__int8) UnicodeCE::category(c)));
+}
+
+DecompositionType decompositionType(UChar32 c)
+{
+ return static_cast<DecompositionType>(UnicodeCE::decompositionType(c));
+}
+
+unsigned char combiningClass(UChar32 c)
+{
+ return UnicodeCE::combiningClass(c);
+}
+
+UChar mirroredChar(UChar32 c)
+{
+ return UnicodeCE::mirroredChar(c);
+}
+
+int digitValue(UChar c)
+{
+ return UnicodeCE::digitValue(c);
+}
+
+} // namespace Unicode
+} // namespace WTF
diff --git a/Source/JavaScriptCore/wtf/unicode/wince/UnicodeWinCE.h b/Source/JavaScriptCore/wtf/unicode/wince/UnicodeWinCE.h
new file mode 100644
index 0000000..2688aa9
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/unicode/wince/UnicodeWinCE.h
@@ -0,0 +1,177 @@
+/*
+ * Copyright (C) 2006 George Staikos <staikos@kde.org>
+ * Copyright (C) 2006 Alexey Proskuryakov <ap@nypop.com>
+ * Copyright (C) 2007 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2007-2009 Torch Mobile, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef WTF_UnicodeWinCE_h
+#define WTF_UnicodeWinCE_h
+
+#include "UnicodeMacrosFromICU.h"
+
+#include "ce_unicode.h"
+
+#define TO_MASK(x) (1 << (x))
+
+namespace WTF {
+namespace Unicode {
+
+enum Direction {
+ LeftToRight = UnicodeCE::U_LEFT_TO_RIGHT,
+ RightToLeft = UnicodeCE::U_RIGHT_TO_LEFT,
+ EuropeanNumber = UnicodeCE::U_EUROPEAN_NUMBER,
+ EuropeanNumberSeparator = UnicodeCE::U_EUROPEAN_NUMBER_SEPARATOR,
+ EuropeanNumberTerminator = UnicodeCE::U_EUROPEAN_NUMBER_TERMINATOR,
+ ArabicNumber = UnicodeCE::U_ARABIC_NUMBER,
+ CommonNumberSeparator = UnicodeCE::U_COMMON_NUMBER_SEPARATOR,
+ BlockSeparator = UnicodeCE::U_BLOCK_SEPARATOR,
+ SegmentSeparator = UnicodeCE::U_SEGMENT_SEPARATOR,
+ WhiteSpaceNeutral = UnicodeCE::U_WHITE_SPACE_NEUTRAL,
+ OtherNeutral = UnicodeCE::U_OTHER_NEUTRAL,
+ LeftToRightEmbedding = UnicodeCE::U_LEFT_TO_RIGHT_EMBEDDING,
+ LeftToRightOverride = UnicodeCE::U_LEFT_TO_RIGHT_OVERRIDE,
+ RightToLeftArabic = UnicodeCE::U_RIGHT_TO_LEFT_ARABIC,
+ RightToLeftEmbedding = UnicodeCE::U_RIGHT_TO_LEFT_EMBEDDING,
+ RightToLeftOverride = UnicodeCE::U_RIGHT_TO_LEFT_OVERRIDE,
+ PopDirectionalFormat = UnicodeCE::U_POP_DIRECTIONAL_FORMAT,
+ NonSpacingMark = UnicodeCE::U_DIR_NON_SPACING_MARK,
+ BoundaryNeutral = UnicodeCE::U_BOUNDARY_NEUTRAL
+};
+
+enum DecompositionType {
+ DecompositionNone = UnicodeCE::U_DT_NONE,
+ DecompositionCanonical = UnicodeCE::U_DT_CANONICAL,
+ DecompositionCompat = UnicodeCE::U_DT_COMPAT,
+ DecompositionCircle = UnicodeCE::U_DT_CIRCLE,
+ DecompositionFinal = UnicodeCE::U_DT_FINAL,
+ DecompositionFont = UnicodeCE::U_DT_FONT,
+ DecompositionFraction = UnicodeCE::U_DT_FRACTION,
+ DecompositionInitial = UnicodeCE::U_DT_INITIAL,
+ DecompositionIsolated = UnicodeCE::U_DT_ISOLATED,
+ DecompositionMedial = UnicodeCE::U_DT_MEDIAL,
+ DecompositionNarrow = UnicodeCE::U_DT_NARROW,
+ DecompositionNoBreak = UnicodeCE::U_DT_NOBREAK,
+ DecompositionSmall = UnicodeCE::U_DT_SMALL,
+ DecompositionSquare = UnicodeCE::U_DT_SQUARE,
+ DecompositionSub = UnicodeCE::U_DT_SUB,
+ DecompositionSuper = UnicodeCE::U_DT_SUPER,
+ DecompositionVertical = UnicodeCE::U_DT_VERTICAL,
+ DecompositionWide = UnicodeCE::U_DT_WIDE
+};
+
+enum CharCategory {
+ NoCategory = 0,
+ Other_NotAssigned = TO_MASK(UnicodeCE::U_GENERAL_OTHER_TYPES),
+ Letter_Uppercase = TO_MASK(UnicodeCE::U_UPPERCASE_LETTER),
+ Letter_Lowercase = TO_MASK(UnicodeCE::U_LOWERCASE_LETTER),
+ Letter_Titlecase = TO_MASK(UnicodeCE::U_TITLECASE_LETTER),
+ Letter_Modifier = TO_MASK(UnicodeCE::U_MODIFIER_LETTER),
+ Letter_Other = TO_MASK(UnicodeCE::U_OTHER_LETTER),
+
+ Mark_NonSpacing = TO_MASK(UnicodeCE::U_NON_SPACING_MARK),
+ Mark_Enclosing = TO_MASK(UnicodeCE::U_ENCLOSING_MARK),
+ Mark_SpacingCombining = TO_MASK(UnicodeCE::U_COMBINING_SPACING_MARK),
+
+ Number_DecimalDigit = TO_MASK(UnicodeCE::U_DECIMAL_DIGIT_NUMBER),
+ Number_Letter = TO_MASK(UnicodeCE::U_LETTER_NUMBER),
+ Number_Other = TO_MASK(UnicodeCE::U_OTHER_NUMBER),
+
+ Separator_Space = TO_MASK(UnicodeCE::U_SPACE_SEPARATOR),
+ Separator_Line = TO_MASK(UnicodeCE::U_LINE_SEPARATOR),
+ Separator_Paragraph = TO_MASK(UnicodeCE::U_PARAGRAPH_SEPARATOR),
+
+ Other_Control = TO_MASK(UnicodeCE::U_CONTROL_CHAR),
+ Other_Format = TO_MASK(UnicodeCE::U_FORMAT_CHAR),
+ Other_PrivateUse = TO_MASK(UnicodeCE::U_PRIVATE_USE_CHAR),
+ Other_Surrogate = TO_MASK(UnicodeCE::U_SURROGATE),
+
+ Punctuation_Dash = TO_MASK(UnicodeCE::U_DASH_PUNCTUATION),
+ Punctuation_Open = TO_MASK(UnicodeCE::U_START_PUNCTUATION),
+ Punctuation_Close = TO_MASK(UnicodeCE::U_END_PUNCTUATION),
+ Punctuation_Connector = TO_MASK(UnicodeCE::U_CONNECTOR_PUNCTUATION),
+ Punctuation_Other = TO_MASK(UnicodeCE::U_OTHER_PUNCTUATION),
+
+ Symbol_Math = TO_MASK(UnicodeCE::U_MATH_SYMBOL),
+ Symbol_Currency = TO_MASK(UnicodeCE::U_CURRENCY_SYMBOL),
+ Symbol_Modifier = TO_MASK(UnicodeCE::U_MODIFIER_SYMBOL),
+ Symbol_Other = TO_MASK(UnicodeCE::U_OTHER_SYMBOL),
+
+ Punctuation_InitialQuote = TO_MASK(UnicodeCE::U_INITIAL_PUNCTUATION),
+ Punctuation_FinalQuote = TO_MASK(UnicodeCE::U_FINAL_PUNCTUATION)
+};
+
+CharCategory category(unsigned int);
+
+bool isSpace(UChar);
+bool isLetter(UChar);
+bool isPrintableChar(UChar);
+bool isUpper(UChar);
+bool isLower(UChar);
+bool isPunct(UChar);
+bool isDigit(UChar);
+bool isAlphanumeric(UChar);
+inline bool isSeparatorSpace(UChar c) { return category(c) == Separator_Space; }
+inline bool isHighSurrogate(UChar c) { return (c & 0xfc00) == 0xd800; }
+inline bool isLowSurrogate(UChar c) { return (c & 0xfc00) == 0xdc00; }
+
+UChar toLower(UChar);
+UChar toUpper(UChar);
+UChar foldCase(UChar);
+UChar toTitleCase(UChar);
+int toLower(UChar* result, int resultLength, const UChar* source, int sourceLength, bool* isError);
+int toUpper(UChar* result, int resultLength, const UChar* source, int sourceLength, bool* isError);
+int foldCase(UChar* result, int resultLength, const UChar* source, int sourceLength, bool* isError);
+
+int digitValue(UChar);
+
+UChar mirroredChar(UChar32);
+unsigned char combiningClass(UChar32);
+DecompositionType decompositionType(UChar32);
+Direction direction(UChar32);
+inline bool isArabicChar(UChar32 c)
+{
+ return c >= 0x0600 && c <= 0x06FF;
+}
+
+inline bool hasLineBreakingPropertyComplexContext(UChar32)
+{
+ return false; // FIXME: implement!
+}
+
+inline int umemcasecmp(const UChar* a, const UChar* b, int len)
+{
+ for (int i = 0; i < len; ++i) {
+ UChar c1 = foldCase(a[i]);
+ UChar c2 = foldCase(b[i]);
+ if (c1 != c2)
+ return c1 - c2;
+ }
+ return 0;
+}
+
+inline UChar32 surrogateToUcs4(UChar high, UChar low)
+{
+ return (UChar32(high) << 10) + low - 0x35fdc00;
+}
+
+} // namespace Unicode
+} // namespace WTF
+
+#endif // WTF_UnicodeWinCE_h
diff --git a/Source/JavaScriptCore/wtf/url/api/ParsedURL.cpp b/Source/JavaScriptCore/wtf/url/api/ParsedURL.cpp
new file mode 100644
index 0000000..abe0061
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/url/api/ParsedURL.cpp
@@ -0,0 +1,90 @@
+/*
+ * Copyright (C) 2010 Google, Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "ParsedURL.h"
+
+#include "URLComponent.h"
+#include "URLParser.h"
+
+namespace WTF {
+
+ParsedURL::ParsedURL(const URLString& spec)
+ : m_spec(spec)
+{
+ // FIXME: Handle non-standard URLs.
+ if (spec.string().isEmpty())
+ return;
+ URLParser<UChar>::parseStandardURL(spec.string().characters(), spec.string().length(), m_segments);
+}
+
+String ParsedURL::scheme() const
+{
+ return segment(m_segments.scheme);
+}
+
+String ParsedURL::username() const
+{
+ return segment(m_segments.username);
+}
+
+String ParsedURL::password() const
+{
+ return segment(m_segments.password);
+}
+
+String ParsedURL::host() const
+{
+ return segment(m_segments.host);
+}
+
+String ParsedURL::port() const
+{
+ return segment(m_segments.port);
+}
+
+String ParsedURL::path() const
+{
+ return segment(m_segments.path);
+}
+
+String ParsedURL::query() const
+{
+ return segment(m_segments.query);
+}
+
+String ParsedURL::fragment() const
+{
+ return segment(m_segments.fragment);
+}
+
+String ParsedURL::segment(const URLComponent& component) const
+{
+ if (!component.isValid())
+ return String();
+ return m_spec.string().substring(component.begin(), component.length());
+}
+
+}
diff --git a/Source/JavaScriptCore/wtf/url/api/ParsedURL.h b/Source/JavaScriptCore/wtf/url/api/ParsedURL.h
new file mode 100644
index 0000000..ebc19b7
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/url/api/ParsedURL.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2010 Google, Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ParsedURL_h
+#define ParsedURL_h
+
+#include "URLSegments.h"
+#include "URLString.h"
+
+namespace WTF {
+
+class URLComponent;
+
+class ParsedURL {
+public:
+ explicit ParsedURL(const URLString&);
+
+ // FIXME: Add a method for parsing non-canonicalized URLs.
+
+ String scheme() const;
+ String username() const;
+ String password() const;
+ String host() const;
+ String port() const;
+ String path() const;
+ String query() const;
+ String fragment() const;
+
+ URLString spec() { return m_spec; }
+
+private:
+ inline String segment(const URLComponent&) const;
+
+ URLString m_spec;
+ URLSegments m_segments;
+};
+
+}
+
+#endif
diff --git a/Source/JavaScriptCore/wtf/url/api/URLString.h b/Source/JavaScriptCore/wtf/url/api/URLString.h
new file mode 100644
index 0000000..7395d49
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/url/api/URLString.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2010 Google, Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef URLString_h
+#define URLString_h
+
+#include "WTFString.h"
+
+namespace WTF {
+
+// URLString represents a string that's a canonicalized URL.
+class URLString {
+public:
+ URLString() { }
+
+ const String& string() const { return m_string;}
+
+private:
+ friend class ParsedURL;
+
+ // URLString can only be constructed by a ParsedURL.
+ explicit URLString(const String& string)
+ : m_string(string)
+ {
+ }
+
+ String m_string;
+};
+
+}
+
+#endif
+
diff --git a/Source/JavaScriptCore/wtf/url/src/RawURLBuffer.h b/Source/JavaScriptCore/wtf/url/src/RawURLBuffer.h
new file mode 100644
index 0000000..9bb2e8e
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/url/src/RawURLBuffer.h
@@ -0,0 +1,71 @@
+// Copyright 2010, Google Inc. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#ifndef RawURLBuffer_h
+#define RawURLBuffer_h
+
+#include "URLBuffer.h"
+#include <stdlib.h>
+
+namespace WTF {
+
+// Simple implementation of the URLBuffer using new[]. This class
+// also supports a static buffer so if it is allocated on the stack, most
+// URLs can be canonicalized with no heap allocations.
+template<typename CHAR, int inlineCapacity = 1024>
+class RawURLBuffer : public URLBuffer<CHAR> {
+public:
+ RawURLBuffer() : URLBuffer<CHAR>()
+ {
+ this->m_buffer = m_inlineBuffer;
+ this->m_capacity = inlineCapacity;
+ }
+
+ virtual ~RawURLBuffer()
+ {
+ if (this->m_buffer != m_inlineBuffer)
+ delete[] this->m_buffer;
+ }
+
+ virtual void resize(int size)
+ {
+ CHAR* newBuffer = new CHAR[size];
+ memcpy(newBuffer, this->m_buffer, sizeof(CHAR) * (this->m_length < size ? this->m_length : size));
+ if (this->m_buffer != m_inlineBuffer)
+ delete[] this->m_buffer;
+ this->m_buffer = newBuffer;
+ this->m_capacity = size;
+ }
+
+protected:
+ CHAR m_inlineBuffer[inlineCapacity];
+};
+
+} // namespace WTF
+
+#endif // RawURLBuffer_h
diff --git a/Source/JavaScriptCore/wtf/url/src/URLBuffer.h b/Source/JavaScriptCore/wtf/url/src/URLBuffer.h
new file mode 100644
index 0000000..e07402e
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/url/src/URLBuffer.h
@@ -0,0 +1,136 @@
+// Copyright 2010, Google Inc. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#ifndef URLBuffer_h
+#define URLBuffer_h
+
+namespace WTF {
+
+// Base class for the canonicalizer output, this maintains a buffer and
+// supports simple resizing and append operations on it.
+//
+// It is VERY IMPORTANT that no virtual function calls be made on the common
+// code path. We only have two virtual function calls, the destructor and a
+// resize function that is called when the existing buffer is not big enough.
+// The derived class is then in charge of setting up our buffer which we will
+// manage.
+template<typename CHAR>
+class URLBuffer {
+public:
+ URLBuffer() : m_buffer(0), m_capacity(0), m_length(0) { }
+ virtual ~URLBuffer() { }
+
+ // Implemented to resize the buffer. This function should update the buffer
+ // pointer to point to the new buffer, and any old data up to |m_length| in
+ // the buffer must be copied over.
+ //
+ // The new size must be larger than m_capacity.
+ virtual void resize(int) = 0;
+
+ inline char at(int offset) const { return m_buffer[offset]; }
+ inline void set(int offset, CHAR ch)
+ {
+ // FIXME: Add ASSERT(offset < length());
+ m_buffer[offset] = ch;
+ }
+
+ // Returns the current capacity of the buffer. The length() is the number of
+ // characters that have been declared to be written, but the capacity() is
+ // the number that can be written without reallocation. If the caller must
+ // write many characters at once, it can make sure there is enough capacity,
+ // write the data, then use setLength() to declare the new length().
+ int capacity() const { return m_capacity; }
+ int length() const { return m_length; }
+
+ // The output will NOT be 0-terminated. Call length() to get the length.
+ const CHAR* data() const { return m_buffer; }
+ CHAR* data() { return m_buffer; }
+
+ // Shortens the URL to the new length. Used for "backing up" when processing
+ // relative paths. This can also be used if an external function writes a lot
+ // of data to the buffer (when using the "Raw" version below) beyond the end,
+ // to declare the new length.
+ void setLength(int length)
+ {
+ // FIXME: Add ASSERT(length < capacity());
+ m_length = length;
+ }
+
+ // This is the most performance critical function, since it is called for
+ // every character.
+ void append(CHAR ch)
+ {
+ // In VC2005, putting this common case first speeds up execution
+ // dramatically because this branch is predicted as taken.
+ if (m_length < m_capacity) {
+ m_buffer[m_length] = ch;
+ ++m_length;
+ return;
+ }
+
+ if (!grow(1))
+ return;
+
+ m_buffer[m_length] = ch;
+ ++m_length;
+ }
+
+ void append(const CHAR* str, int strLength)
+ {
+ if (m_length + strLength > m_capacity) {
+ if (!grow(m_length + strLength - m_capacity))
+ return;
+ }
+ for (int i = 0; i < strLength; i++)
+ m_buffer[m_length + i] = str[i];
+ m_length += strLength;
+ }
+
+protected:
+ // Returns true if the buffer could be resized, false on OOM.
+ bool grow(int minimumAdditionalCapacity)
+ {
+ static const int minimumCapacity = 16;
+ int newCapacity = m_capacity ? m_capacity : minimumCapacity;
+ do {
+ if (newCapacity >= (1 << 30)) // Prevent overflow below.
+ return false;
+ newCapacity *= 2;
+ } while (newCapacity < m_capacity + minimumAdditionalCapacity);
+ resize(newCapacity);
+ return true;
+ }
+
+ CHAR* m_buffer;
+ int m_capacity;
+ int m_length; // Used characters in the buffer.
+};
+
+} // namespace WTF
+
+#endif // URLBuffer_h
diff --git a/Source/JavaScriptCore/wtf/url/src/URLCharacterTypes.cpp b/Source/JavaScriptCore/wtf/url/src/URLCharacterTypes.cpp
new file mode 100644
index 0000000..ee2014e
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/url/src/URLCharacterTypes.cpp
@@ -0,0 +1,173 @@
+// Copyright 2010, Google Inc. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#include "config.h"
+#include "URLCharacterTypes.h"
+
+namespace WTF {
+
+const unsigned char URLCharacterTypes::characterTypeTable[0x100] = {
+ InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter,
+ InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter,
+ InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter,
+ InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter, // 0x00 - 0x0f
+ InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter,
+ InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter,
+ InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter,
+ InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter, // 0x10 - 0x1f
+ InvalidCharacter, // 0x20 ' ' (escape spaces in queries)
+ QueryCharacter | UserInfoCharacter, // 0x21 !
+ InvalidCharacter, // 0x22 "
+ InvalidCharacter, // 0x23 # (invalid in query since it marks the ref)
+ QueryCharacter | UserInfoCharacter, // 0x24 $
+ QueryCharacter | UserInfoCharacter, // 0x25 %
+ QueryCharacter | UserInfoCharacter, // 0x26 &
+ QueryCharacter | UserInfoCharacter, // 0x27 '
+ QueryCharacter | UserInfoCharacter, // 0x28 (
+ QueryCharacter | UserInfoCharacter, // 0x29 )
+ QueryCharacter | UserInfoCharacter, // 0x2a *
+ QueryCharacter | UserInfoCharacter, // 0x2b +
+ QueryCharacter | UserInfoCharacter, // 0x2c ,
+ QueryCharacter | UserInfoCharacter, // 0x2d -
+ QueryCharacter | UserInfoCharacter | IPv4Character, // 0x2e .
+ QueryCharacter, // 0x2f /
+ QueryCharacter | UserInfoCharacter | IPv4Character | HexCharacter | DecimalCharacter | OctalCharacter, // 0x30 0
+ QueryCharacter | UserInfoCharacter | IPv4Character | HexCharacter | DecimalCharacter | OctalCharacter, // 0x31 1
+ QueryCharacter | UserInfoCharacter | IPv4Character | HexCharacter | DecimalCharacter | OctalCharacter, // 0x32 2
+ QueryCharacter | UserInfoCharacter | IPv4Character | HexCharacter | DecimalCharacter | OctalCharacter, // 0x33 3
+ QueryCharacter | UserInfoCharacter | IPv4Character | HexCharacter | DecimalCharacter | OctalCharacter, // 0x34 4
+ QueryCharacter | UserInfoCharacter | IPv4Character | HexCharacter | DecimalCharacter | OctalCharacter, // 0x35 5
+ QueryCharacter | UserInfoCharacter | IPv4Character | HexCharacter | DecimalCharacter | OctalCharacter, // 0x36 6
+ QueryCharacter | UserInfoCharacter | IPv4Character | HexCharacter | DecimalCharacter | OctalCharacter, // 0x37 7
+ QueryCharacter | UserInfoCharacter | IPv4Character | HexCharacter | DecimalCharacter, // 0x38 8
+ QueryCharacter | UserInfoCharacter | IPv4Character | HexCharacter | DecimalCharacter, // 0x39 9
+ QueryCharacter, // 0x3a :
+ QueryCharacter, // 0x3b ;
+ InvalidCharacter, // 0x3c <
+ QueryCharacter, // 0x3d =
+ InvalidCharacter, // 0x3e >
+ QueryCharacter, // 0x3f ?
+ QueryCharacter, // 0x40 @
+ QueryCharacter | UserInfoCharacter | IPv4Character | HexCharacter, // 0x41 A
+ QueryCharacter | UserInfoCharacter | IPv4Character | HexCharacter, // 0x42 B
+ QueryCharacter | UserInfoCharacter | IPv4Character | HexCharacter, // 0x43 C
+ QueryCharacter | UserInfoCharacter | IPv4Character | HexCharacter, // 0x44 D
+ QueryCharacter | UserInfoCharacter | IPv4Character | HexCharacter, // 0x45 E
+ QueryCharacter | UserInfoCharacter | IPv4Character | HexCharacter, // 0x46 F
+ QueryCharacter | UserInfoCharacter, // 0x47 G
+ QueryCharacter | UserInfoCharacter, // 0x48 H
+ QueryCharacter | UserInfoCharacter, // 0x49 I
+ QueryCharacter | UserInfoCharacter, // 0x4a J
+ QueryCharacter | UserInfoCharacter, // 0x4b K
+ QueryCharacter | UserInfoCharacter, // 0x4c L
+ QueryCharacter | UserInfoCharacter, // 0x4d M
+ QueryCharacter | UserInfoCharacter, // 0x4e N
+ QueryCharacter | UserInfoCharacter, // 0x4f O
+ QueryCharacter | UserInfoCharacter, // 0x50 P
+ QueryCharacter | UserInfoCharacter, // 0x51 Q
+ QueryCharacter | UserInfoCharacter, // 0x52 R
+ QueryCharacter | UserInfoCharacter, // 0x53 S
+ QueryCharacter | UserInfoCharacter, // 0x54 T
+ QueryCharacter | UserInfoCharacter, // 0x55 U
+ QueryCharacter | UserInfoCharacter, // 0x56 V
+ QueryCharacter | UserInfoCharacter, // 0x57 W
+ QueryCharacter | UserInfoCharacter | IPv4Character, // 0x58 X
+ QueryCharacter | UserInfoCharacter, // 0x59 Y
+ QueryCharacter | UserInfoCharacter, // 0x5a Z
+ QueryCharacter, // 0x5b [
+ QueryCharacter, // 0x5c '\'
+ QueryCharacter, // 0x5d ]
+ QueryCharacter, // 0x5e ^
+ QueryCharacter | UserInfoCharacter, // 0x5f _
+ QueryCharacter, // 0x60 `
+ QueryCharacter | UserInfoCharacter | IPv4Character | HexCharacter, // 0x61 a
+ QueryCharacter | UserInfoCharacter | IPv4Character | HexCharacter, // 0x62 b
+ QueryCharacter | UserInfoCharacter | IPv4Character | HexCharacter, // 0x63 c
+ QueryCharacter | UserInfoCharacter | IPv4Character | HexCharacter, // 0x64 d
+ QueryCharacter | UserInfoCharacter | IPv4Character | HexCharacter, // 0x65 e
+ QueryCharacter | UserInfoCharacter | IPv4Character | HexCharacter, // 0x66 f
+ QueryCharacter | UserInfoCharacter, // 0x67 g
+ QueryCharacter | UserInfoCharacter, // 0x68 h
+ QueryCharacter | UserInfoCharacter, // 0x69 i
+ QueryCharacter | UserInfoCharacter, // 0x6a j
+ QueryCharacter | UserInfoCharacter, // 0x6b k
+ QueryCharacter | UserInfoCharacter, // 0x6c l
+ QueryCharacter | UserInfoCharacter, // 0x6d m
+ QueryCharacter | UserInfoCharacter, // 0x6e n
+ QueryCharacter | UserInfoCharacter, // 0x6f o
+ QueryCharacter | UserInfoCharacter, // 0x70 p
+ QueryCharacter | UserInfoCharacter, // 0x71 q
+ QueryCharacter | UserInfoCharacter, // 0x72 r
+ QueryCharacter | UserInfoCharacter, // 0x73 s
+ QueryCharacter | UserInfoCharacter, // 0x74 t
+ QueryCharacter | UserInfoCharacter, // 0x75 u
+ QueryCharacter | UserInfoCharacter, // 0x76 v
+ QueryCharacter | UserInfoCharacter, // 0x77 w
+ QueryCharacter | UserInfoCharacter | IPv4Character, // 0x78 x
+ QueryCharacter | UserInfoCharacter, // 0x79 y
+ QueryCharacter | UserInfoCharacter, // 0x7a z
+ QueryCharacter, // 0x7b {
+ QueryCharacter, // 0x7c |
+ QueryCharacter, // 0x7d }
+ QueryCharacter | UserInfoCharacter, // 0x7e ~
+ InvalidCharacter, // 0x7f
+ InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter,
+ InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter,
+ InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter,
+ InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter, // 0x80 - 0x8f
+ InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter,
+ InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter,
+ InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter,
+ InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter, // 0x90 - 0x9f
+ InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter,
+ InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter,
+ InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter,
+ InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter, // 0xa0 - 0xaf
+ InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter,
+ InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter,
+ InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter,
+ InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter, // 0xb0 - 0xbf
+ InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter,
+ InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter,
+ InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter,
+ InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter, // 0xc0 - 0xcf
+ InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter,
+ InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter,
+ InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter,
+ InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter, // 0xd0 - 0xdf
+ InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter,
+ InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter,
+ InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter,
+ InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter, // 0xe0 - 0xef
+ InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter,
+ InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter,
+ InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter,
+ InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter, // 0xf0 - 0xff
+};
+
+}
diff --git a/Source/JavaScriptCore/wtf/url/src/URLCharacterTypes.h b/Source/JavaScriptCore/wtf/url/src/URLCharacterTypes.h
new file mode 100644
index 0000000..194f6b0
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/url/src/URLCharacterTypes.h
@@ -0,0 +1,61 @@
+// Copyright 2010, Google Inc. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#ifndef URLCharacterTypes_h
+#define URLCharacterTypes_h
+
+namespace WTF {
+
+class URLCharacterTypes {
+public:
+ static inline bool isQueryChar(unsigned char c) { return isCharOfType(c, QueryCharacter); }
+ static inline bool isIPv4Char(unsigned char c) { return isCharOfType(c, IPv4Character); }
+ static inline bool isHexChar(unsigned char c) { return isCharOfType(c, HexCharacter); }
+
+private:
+ enum CharTypes {
+ InvalidCharacter = 0,
+ QueryCharacter = 1 << 0,
+ UserInfoCharacter = 1 << 1,
+ IPv4Character = 1 << 2,
+ HexCharacter = 1 << 3,
+ DecimalCharacter = 1 << 4,
+ OctalCharacter = 1 << 5,
+ };
+
+ static const unsigned char characterTypeTable[0x100];
+
+ static inline bool isCharOfType(unsigned char c, CharTypes type)
+ {
+ return !!(characterTypeTable[c] & type);
+ }
+};
+
+}
+
+#endif
diff --git a/Source/JavaScriptCore/wtf/url/src/URLComponent.h b/Source/JavaScriptCore/wtf/url/src/URLComponent.h
new file mode 100644
index 0000000..1b7976e
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/url/src/URLComponent.h
@@ -0,0 +1,77 @@
+// Copyright 2010, Google Inc. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#ifndef URLComponent_h
+#define URLComponent_h
+
+namespace WTF {
+
+// Represents a substring for URL parsing.
+class URLComponent {
+public:
+ URLComponent() : m_begin(0), m_length(-1) { }
+ URLComponent(int begin, int length) : m_begin(begin), m_length(length) { }
+
+ // Helper that returns a component created with the given begin and ending
+ // points. The ending point is non-inclusive.
+ static inline URLComponent fromRange(int begin, int end)
+ {
+ return URLComponent(begin, end - begin);
+ }
+
+ // Returns true if this component is valid, meaning the length is given. Even
+ // valid components may be empty to record the fact that they exist.
+ bool isValid() const { return m_length != -1; }
+
+ bool isNonEmpty() const { return m_length > 0; }
+ bool isEmptyOrInvalid() const { return m_length <= 0; }
+
+ void reset()
+ {
+ m_begin = 0;
+ m_length = -1;
+ }
+
+ bool operator==(const URLComponent& other) const { return m_begin == other.m_begin && m_length == other.m_length; }
+
+ int begin() const { return m_begin; }
+ void setBegin(int begin) { m_begin = begin; }
+
+ int length() const { return m_length; }
+ void setLength(int length) { m_length = length; }
+
+ int end() const { return m_begin + m_length; }
+
+private:
+ int m_begin; // Byte offset in the string of this component.
+ int m_length; // Will be -1 if the component is unspecified.
+};
+
+} // namespace WTF
+
+#endif // URLComponent_h
diff --git a/Source/JavaScriptCore/wtf/url/src/URLEscape.cpp b/Source/JavaScriptCore/wtf/url/src/URLEscape.cpp
new file mode 100644
index 0000000..2987343
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/url/src/URLEscape.cpp
@@ -0,0 +1,39 @@
+// Copyright 2010, Google Inc. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#include "config.h"
+#include "URLEscape.h"
+
+namespace WTF {
+
+const char hexCharacterTable[16] = {
+ '0', '1', '2', '3', '4', '5', '6', '7',
+ '8', '9', 'A', 'B', 'C', 'D', 'E', 'F',
+};
+
+}
diff --git a/Source/JavaScriptCore/wtf/url/src/URLEscape.h b/Source/JavaScriptCore/wtf/url/src/URLEscape.h
new file mode 100644
index 0000000..cc2b77f
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/url/src/URLEscape.h
@@ -0,0 +1,49 @@
+// Copyright 2010, Google Inc. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+#ifndef URLEscape_h
+#define URLEscape_h
+
+#include "URLBuffer.h"
+
+namespace WTF {
+
+extern const char hexCharacterTable[16];
+
+template<typename InChar, typename OutChar>
+inline void appendURLEscapedCharacter(InChar ch, URLBuffer<OutChar>& buffer)
+{
+ buffer.append('%');
+ buffer.append(hexCharacterTable[ch >> 4]);
+ buffer.append(hexCharacterTable[ch & 0xf]);
+}
+
+}
+
+#endif
diff --git a/Source/JavaScriptCore/wtf/url/src/URLParser.h b/Source/JavaScriptCore/wtf/url/src/URLParser.h
new file mode 100644
index 0000000..4d5ca51
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/url/src/URLParser.h
@@ -0,0 +1,575 @@
+/* Based on nsURLParsers.cc from Mozilla
+ * -------------------------------------
+ * Copyright (C) 1998 Netscape Communications Corporation.
+ *
+ * Other contributors:
+ * Darin Fisher (original author)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Alternatively, the contents of this file may be used under the terms
+ * of either the Mozilla Public License Version 1.1, found at
+ * http://www.mozilla.org/MPL/ (the "MPL") or the GNU General Public
+ * License Version 2.0, found at http://www.fsf.org/copyleft/gpl.html
+ * (the "GPL"), in which case the provisions of the MPL or the GPL are
+ * applicable instead of those above. If you wish to allow use of your
+ * version of this file only under the terms of one of those two
+ * licenses (the MPL or the GPL) and not to allow others to use your
+ * version of this file under the LGPL, indicate your decision by
+ * deletingthe provisions above and replace them with the notice and
+ * other provisions required by the MPL or the GPL, as the case may be.
+ * If you do not delete the provisions above, a recipient may use your
+ * version of this file under any of the LGPL, the MPL or the GPL.
+ */
+
+#ifndef URLParser_h
+#define URLParser_h
+
+#include "URLComponent.h"
+#include "URLSegments.h"
+
+namespace WTF {
+
+template<typename CHAR>
+class URLParser {
+public:
+ enum SpecialPort {
+ UnspecifiedPort = -1,
+ InvalidPort = -2,
+ };
+
+ // This handles everything that may be an authority terminator, including
+ // backslash. For special backslash handling see parseAfterScheme.
+ static bool isPossibleAuthorityTerminator(CHAR ch)
+ {
+ return isURLSlash(ch) || ch == '?' || ch == '#' || ch == ';';
+ }
+
+ // Given an already-identified auth section, breaks it into its constituent
+ // parts. The port number will be parsed and the resulting integer will be
+ // filled into the given *port variable, or -1 if there is no port number
+ // or it is invalid.
+ static void parseAuthority(const CHAR* spec, const URLComponent& auth, URLComponent& username, URLComponent& password, URLComponent& host, URLComponent& port)
+ {
+ // FIXME: add ASSERT(auth.isValid()); // We should always get an authority.
+ if (!auth.length()) {
+ username.reset();
+ password.reset();
+ host.reset();
+ port.reset();
+ return;
+ }
+
+ // Search backwards for @, which is the separator between the user info
+ // and the server info. RFC 3986 forbids @ from occuring in auth, but
+ // someone might include it in a password unescaped.
+ int i = auth.begin() + auth.length() - 1;
+ while (i > auth.begin() && spec[i] != '@')
+ --i;
+
+ if (spec[i] == '@') {
+ // Found user info: <user-info>@<server-info>
+ parseUserInfo(spec, URLComponent(auth.begin(), i - auth.begin()), username, password);
+ parseServerInfo(spec, URLComponent::fromRange(i + 1, auth.begin() + auth.length()), host, port);
+ } else {
+ // No user info, everything is server info.
+ username.reset();
+ password.reset();
+ parseServerInfo(spec, auth, host, port);
+ }
+ }
+
+ static bool extractScheme(const CHAR* spec, int specLength, URLComponent& scheme)
+ {
+ // Skip leading whitespace and control characters.
+ int begin = 0;
+ while (begin < specLength && shouldTrimFromURL(spec[begin]))
+ begin++;
+ if (begin == specLength)
+ return false; // Input is empty or all whitespace.
+
+ // Find the first colon character.
+ for (int i = begin; i < specLength; i++) {
+ if (spec[i] == ':') {
+ scheme = URLComponent::fromRange(begin, i);
+ return true;
+ }
+ }
+ return false; // No colon found: no scheme
+ }
+
+ // Fills in all members of the URLSegments structure (except for the
+ // scheme) for standard URLs.
+ //
+ // |spec| is the full spec being parsed, of length |specLength|.
+ // |afterScheme| is the character immediately following the scheme (after
+ // the colon) where we'll begin parsing.
+ static void parseAfterScheme(const CHAR* spec, int specLength, int afterScheme, URLSegments& parsed)
+ {
+ int numberOfSlashes = consecutiveSlashes(spec, afterScheme, specLength);
+ int afterSlashes = afterScheme + numberOfSlashes;
+
+ // First split into two main parts, the authority (username, password,
+ // host, and port) and the full path (path, query, and reference).
+ URLComponent authority;
+ URLComponent fullPath;
+
+ // Found "//<some data>", looks like an authority section. Treat
+ // everything from there to the next slash (or end of spec) to be the
+ // authority. Note that we ignore the number of slashes and treat it as
+ // the authority.
+ int authEnd = nextAuthorityTerminator(spec, afterSlashes, specLength);
+ authority = URLComponent(afterSlashes, authEnd - afterSlashes);
+
+ if (authEnd == specLength) // No beginning of path found.
+ fullPath = URLComponent();
+ else // Everything starting from the slash to the end is the path.
+ fullPath = URLComponent(authEnd, specLength - authEnd);
+
+ // Now parse those two sub-parts.
+ parseAuthority(spec, authority, parsed.username, parsed.password, parsed.host, parsed.port);
+ parsePath(spec, fullPath, parsed.path, parsed.query, parsed.fragment);
+ }
+
+ // The main parsing function for standard URLs. Standard URLs have a scheme,
+ // host, path, etc.
+ static void parseStandardURL(const CHAR* spec, int specLength, URLSegments& parsed)
+ {
+ // FIXME: add ASSERT(specLength >= 0);
+
+ // Strip leading & trailing spaces and control characters.
+ int begin = 0;
+ trimURL(spec, begin, specLength);
+
+ int afterScheme;
+ if (extractScheme(spec, specLength, parsed.scheme))
+ afterScheme = parsed.scheme.end() + 1; // Skip past the colon.
+ else {
+ // Say there's no scheme when there is a colon. We could also say
+ // that everything is the scheme. Both would produce an invalid
+ // URL, but this way seems less wrong in more cases.
+ parsed.scheme.reset();
+ afterScheme = begin;
+ }
+ parseAfterScheme(spec, specLength, afterScheme, parsed);
+ }
+
+ static void parsePath(const CHAR* spec, const URLComponent& path, URLComponent& filepath, URLComponent& query, URLComponent& fragment)
+ {
+ // path = [/]<segment1>/<segment2>/<...>/<segmentN>;<param>?<query>#<fragment>
+
+ // Special case when there is no path.
+ if (!path.isValid()) {
+ filepath.reset();
+ query.reset();
+ fragment.reset();
+ return;
+ }
+ // FIXME: add ASSERT(path.length() > 0); // We should never have 0 length paths.
+
+ // Search for first occurrence of either ? or #.
+ int pathEnd = path.begin() + path.length();
+
+ int querySeparator = -1; // Index of the '?'
+ int refSeparator = -1; // Index of the '#'
+ for (int i = path.begin(); i < pathEnd; i++) {
+ switch (spec[i]) {
+ case '?':
+ if (querySeparator < 0)
+ querySeparator = i;
+ break;
+ case '#':
+ refSeparator = i;
+ i = pathEnd; // Break out of the loop.
+ break;
+ default:
+ break;
+ }
+ }
+
+ // Markers pointing to the character after each of these corresponding
+ // components. The code below works from the end back to the beginning,
+ // and will update these indices as it finds components that exist.
+ int fileEnd, queryEnd;
+
+ // Fragment: from the # to the end of the path.
+ if (refSeparator >= 0) {
+ fileEnd = refSeparator;
+ queryEnd = refSeparator;
+ fragment = URLComponent::fromRange(refSeparator + 1, pathEnd);
+ } else {
+ fileEnd = pathEnd;
+ queryEnd = pathEnd;
+ fragment.reset();
+ }
+
+ // Query fragment: everything from the ? to the next boundary (either
+ // the end of the path or the fragment fragment).
+ if (querySeparator >= 0) {
+ fileEnd = querySeparator;
+ query = URLComponent::fromRange(querySeparator + 1, queryEnd);
+ } else
+ query.reset();
+
+ // File path: treat an empty file path as no file path.
+ if (fileEnd != path.begin())
+ filepath = URLComponent::fromRange(path.begin(), fileEnd);
+ else
+ filepath.reset();
+ }
+
+ // Initializes a path URL which is merely a scheme followed by a path.
+ // Examples include "about:foo" and "javascript:alert('bar');"
+ static void parsePathURL(const CHAR* spec, int specLength, URLSegments& parsed)
+ {
+ // Get the non-path and non-scheme parts of the URL out of the way, we
+ // never use them.
+ parsed.username.reset();
+ parsed.password.reset();
+ parsed.host.reset();
+ parsed.port.reset();
+ parsed.query.reset();
+ parsed.fragment.reset();
+
+ // Strip leading & trailing spaces and control characters.
+ // FIXME: Perhaps this is unnecessary?
+ int begin = 0;
+ trimURL(spec, begin, specLength);
+
+ // Handle empty specs or ones that contain only whitespace or control
+ // chars.
+ if (begin == specLength) {
+ parsed.scheme.reset();
+ parsed.path.reset();
+ return;
+ }
+
+ // Extract the scheme, with the path being everything following. We also
+ // handle the case where there is no scheme.
+ if (extractScheme(&spec[begin], specLength - begin, parsed.scheme)) {
+ // Offset the results since we gave extractScheme a substring.
+ parsed.scheme.setBegin(parsed.scheme.begin() + begin);
+
+ // For compatibility with the standard URL parser, we treat no path
+ // as -1, rather than having a length of 0 (we normally wouldn't
+ // care so much for these non-standard URLs).
+ if (parsed.scheme.end() == specLength - 1)
+ parsed.path.reset();
+ else
+ parsed.path = URLComponent::fromRange(parsed.scheme.end() + 1, specLength);
+ } else {
+ // No scheme found, just path.
+ parsed.scheme.reset();
+ parsed.path = URLComponent::fromRange(begin, specLength);
+ }
+ }
+
+ static void parseMailtoURL(const CHAR* spec, int specLength, URLSegments& parsed)
+ {
+ // FIXME: add ASSERT(specLength >= 0);
+
+ // Get the non-path and non-scheme parts of the URL out of the way, we
+ // never use them.
+ parsed.username.reset();
+ parsed.password.reset();
+ parsed.host.reset();
+ parsed.port.reset();
+ parsed.fragment.reset();
+ parsed.query.reset(); // May use this; reset for convenience.
+
+ // Strip leading & trailing spaces and control characters.
+ int begin = 0;
+ trimURL(spec, begin, specLength);
+
+ // Handle empty specs or ones that contain only whitespace or control
+ // chars.
+ if (begin == specLength) {
+ parsed.scheme.reset();
+ parsed.path.reset();
+ return;
+ }
+
+ int pathBegin = -1;
+ int pathEnd = -1;
+
+ // Extract the scheme, with the path being everything following. We also
+ // handle the case where there is no scheme.
+ if (extractScheme(&spec[begin], specLength - begin, parsed.scheme)) {
+ // Offset the results since we gave extractScheme a substring.
+ parsed.scheme.setBegin(parsed.scheme.begin() + begin);
+
+ if (parsed.scheme.end() != specLength - 1) {
+ pathBegin = parsed.scheme.end() + 1;
+ pathEnd = specLength;
+ }
+ } else {
+ // No scheme found, just path.
+ parsed.scheme.reset();
+ pathBegin = begin;
+ pathEnd = specLength;
+ }
+
+ // Split [pathBegin, pathEnd) into a path + query.
+ for (int i = pathBegin; i < pathEnd; ++i) {
+ if (spec[i] == '?') {
+ parsed.query = URLComponent::fromRange(i + 1, pathEnd);
+ pathEnd = i;
+ break;
+ }
+ }
+
+ // For compatibility with the standard URL parser, treat no path as
+ // -1, rather than having a length of 0
+ if (pathBegin == pathEnd)
+ parsed.path.reset();
+ else
+ parsed.path = URLComponent::fromRange(pathBegin, pathEnd);
+ }
+
+ static int parsePort(const CHAR* spec, const URLComponent& component)
+ {
+ // Easy success case when there is no port.
+ const int maxDigits = 5;
+ if (component.isEmptyOrInvalid())
+ return UnspecifiedPort;
+
+ URLComponent nonZeroDigits(component.end(), 0);
+ for (int i = 0; i < component.length(); ++i) {
+ if (spec[component.begin() + i] != '0') {
+ nonZeroDigits = URLComponent::fromRange(component.begin() + i, component.end());
+ break;
+ }
+ }
+ if (!nonZeroDigits.length())
+ return 0; // All digits were 0.
+
+ if (nonZeroDigits.length() > maxDigits)
+ return InvalidPort;
+
+ int port = 0;
+ for (int i = 0; i < nonZeroDigits.length(); ++i) {
+ CHAR ch = spec[nonZeroDigits.begin() + i];
+ if (!isPortDigit(ch))
+ return InvalidPort;
+ port *= 10;
+ port += static_cast<char>(ch) - '0';
+ }
+ if (port > 65535)
+ return InvalidPort;
+ return port;
+ }
+
+ static void extractFileName(const CHAR* spec, const URLComponent& path, URLComponent& fileName)
+ {
+ // Handle empty paths: they have no file names.
+ if (path.isEmptyOrInvalid()) {
+ fileName.reset();
+ return;
+ }
+
+ // Search backwards for a parameter, which is a normally unused field
+ // in a URL delimited by a semicolon. We parse the parameter as part of
+ // the path, but here, we don't want to count it. The last semicolon is
+ // the parameter.
+ int fileEnd = path.end();
+ for (int i = path.end() - 1; i > path.begin(); --i) {
+ if (spec[i] == ';') {
+ fileEnd = i;
+ break;
+ }
+ }
+
+ // Now search backwards from the filename end to the previous slash
+ // to find the beginning of the filename.
+ for (int i = fileEnd - 1; i >= path.begin(); --i) {
+ if (isURLSlash(spec[i])) {
+ // File name is everything following this character to the end
+ fileName = URLComponent::fromRange(i + 1, fileEnd);
+ return;
+ }
+ }
+
+ // No slash found, this means the input was degenerate (generally paths
+ // will start with a slash). Let's call everything the file name.
+ fileName = URLComponent::fromRange(path.begin(), fileEnd);
+ }
+
+ static bool extractQueryKeyValue(const CHAR* spec, URLComponent& query, URLComponent& key, URLComponent& value)
+ {
+ if (query.isEmptyOrInvalid())
+ return false;
+
+ int start = query.begin();
+ int current = start;
+ int end = query.end();
+
+ // We assume the beginning of the input is the beginning of the "key"
+ // and we skip to the end of it.
+ key.setBegin(current);
+ while (current < end && spec[current] != '&' && spec[current] != '=')
+ ++current;
+ key.setLength(current - key.begin());
+
+ // Skip the separator after the key (if any).
+ if (current < end && spec[current] == '=')
+ ++current;
+
+ // Find the value part.
+ value.setBegin(current);
+ while (current < end && spec[current] != '&')
+ ++current;
+ value.setLength(current - value.begin());
+
+ // Finally skip the next separator if any
+ if (current < end && spec[current] == '&')
+ ++current;
+
+ // Save the new query
+ query = URLComponent::fromRange(current, end);
+ return true;
+ }
+
+// FIXME: This should be protected or private.
+public:
+ // We treat slashes and backslashes the same for IE compatibility.
+ static inline bool isURLSlash(CHAR ch)
+ {
+ return ch == '/' || ch == '\\';
+ }
+
+ // Returns true if we should trim this character from the URL because it is
+ // a space or a control character.
+ static inline bool shouldTrimFromURL(CHAR ch)
+ {
+ return ch <= ' ';
+ }
+
+ // Given an already-initialized begin index and end index (the index after
+ // the last CHAR in spec), this shrinks the range to eliminate
+ // "should-be-trimmed" characters.
+ static inline void trimURL(const CHAR* spec, int& begin, int& end)
+ {
+ // Strip leading whitespace and control characters.
+ while (begin < end && shouldTrimFromURL(spec[begin]))
+ ++begin;
+
+ // Strip trailing whitespace and control characters. We need the >i
+ // test for when the input string is all blanks; we don't want to back
+ // past the input.
+ while (end > begin && shouldTrimFromURL(spec[end - 1]))
+ --end;
+ }
+
+ // Counts the number of consecutive slashes starting at the given offset
+ // in the given string of the given length.
+ static inline int consecutiveSlashes(const CHAR *string, int beginOffset, int stringLength)
+ {
+ int count = 0;
+ while (beginOffset + count < stringLength && isURLSlash(string[beginOffset + count]))
+ ++count;
+ return count;
+ }
+
+private:
+ // URLParser cannot be constructed.
+ URLParser();
+
+ // Returns true if the given character is a valid digit to use in a port.
+ static inline bool isPortDigit(CHAR ch)
+ {
+ return ch >= '0' && ch <= '9';
+ }
+
+ // Returns the offset of the next authority terminator in the input starting
+ // from startOffset. If no terminator is found, the return value will be equal
+ // to specLength.
+ static int nextAuthorityTerminator(const CHAR* spec, int startOffset, int specLength)
+ {
+ for (int i = startOffset; i < specLength; i++) {
+ if (isPossibleAuthorityTerminator(spec[i]))
+ return i;
+ }
+ return specLength; // Not found.
+ }
+
+ static void parseUserInfo(const CHAR* spec, const URLComponent& user, URLComponent& username, URLComponent& password)
+ {
+ // Find the first colon in the user section, which separates the
+ // username and password.
+ int colonOffset = 0;
+ while (colonOffset < user.length() && spec[user.begin() + colonOffset] != ':')
+ ++colonOffset;
+
+ if (colonOffset < user.length()) {
+ // Found separator: <username>:<password>
+ username = URLComponent(user.begin(), colonOffset);
+ password = URLComponent::fromRange(user.begin() + colonOffset + 1, user.begin() + user.length());
+ } else {
+ // No separator, treat everything as the username
+ username = user;
+ password = URLComponent();
+ }
+ }
+
+ static void parseServerInfo(const CHAR* spec, const URLComponent& serverInfo, URLComponent& host, URLComponent& port)
+ {
+ if (!serverInfo.length()) {
+ // No server info, host name is empty.
+ host.reset();
+ port.reset();
+ return;
+ }
+
+ // If the host starts with a left-bracket, assume the entire host is an
+ // IPv6 literal. Otherwise, assume none of the host is an IPv6 literal.
+ // This assumption will be overridden if we find a right-bracket.
+ //
+ // Our IPv6 address canonicalization code requires both brackets to
+ // exist, but the ability to locate an incomplete address can still be
+ // useful.
+ int ipv6Terminator = spec[serverInfo.begin()] == '[' ? serverInfo.end() : -1;
+ int colon = -1;
+
+ // Find the last right-bracket, and the last colon.
+ for (int i = serverInfo.begin(); i < serverInfo.end(); i++) {
+ switch (spec[i]) {
+ case ']':
+ ipv6Terminator = i;
+ break;
+ case ':':
+ colon = i;
+ break;
+ default:
+ break;
+ }
+ }
+
+ if (colon > ipv6Terminator) {
+ // Found a port number: <hostname>:<port>
+ host = URLComponent::fromRange(serverInfo.begin(), colon);
+ if (!host.length())
+ host.reset();
+ port = URLComponent::fromRange(colon + 1, serverInfo.end());
+ } else {
+ // No port: <hostname>
+ host = serverInfo;
+ port.reset();
+ }
+ }
+};
+
+} // namespace WTF
+
+#endif // URLParser_h
diff --git a/Source/JavaScriptCore/wtf/url/src/URLQueryCanonicalizer.h b/Source/JavaScriptCore/wtf/url/src/URLQueryCanonicalizer.h
new file mode 100644
index 0000000..7740200
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/url/src/URLQueryCanonicalizer.h
@@ -0,0 +1,107 @@
+// Copyright 2010, Google Inc. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+#ifndef URLQueryCanonicalizer_h
+#define URLQueryCanonicalizer_h
+
+#include "RawURLBuffer.h"
+#include "URLBuffer.h"
+#include "URLCharacterTypes.h"
+#include "URLComponent.h"
+#include "URLEscape.h"
+
+namespace WTF {
+
+template<typename InChar, typename OutChar, void convertCharset(const InChar*, int length, URLBuffer<char>&)>
+class URLQueryCanonicalizer {
+public:
+ static void canonicalize(const InChar* spec, const URLComponent& query, URLBuffer<OutChar>& buffer, URLComponent& resultQuery)
+ {
+ if (query.length() < 0) {
+ resultQuery = URLComponent();
+ return;
+ }
+
+ buffer->append('?');
+ resultQuery.setBegin(buffer->length());
+ convertToQueryEncoding(spec, query, buffer);
+ resultQuery.setLength(buffer->length() - resultQuery.begin());
+ }
+
+private:
+ static bool isAllASCII(const InChar* spec, const URLComponent& query)
+ {
+ int end = query.end();
+ for (int i = query.begin(); i < end; ++i) {
+ if (static_cast<unsigned>(spec[i]) >= 0x80)
+ return false;
+ }
+ return true;
+ }
+
+#ifndef NDEBUG
+ static bool isRaw8Bit(const InChar* source, int length)
+ {
+ for (int i = source; i < length; ++i) {
+ if (source[i] & 0xFF != source[i])
+ return false;
+ }
+ return true;
+ }
+#endif
+
+ static void appendRaw8BitQueryString(const InChar* source, int length, URLBuffer<OutChar>* buffer)
+ {
+ ASSERT(isRaw8Bit(source, length));
+ for (int i = 0; i < length; ++i) {
+ if (!URLCharacterTypes::isQueryChar(source[i]))
+ appendURLEscapedCharacter(static_cast<unsigned char>(source[i]), buffer);
+ else
+ buffer->append(static_cast<char>(source[i]));
+ }
+ }
+
+ static void convertToQueryEncoding(const InChar* spec, const URLComponent& query, URLBuffer<OutChar>& buffer)
+ {
+ if (isAllASCII(spec, query)) {
+ appendRaw8BitQueryString(&spec[query.begin()], query.length(), buffer);
+ return;
+ }
+
+ RawURLBuffer<char, 1024> convertedQuery;
+ convertCharset(spec, query, convertedQuery);
+ appendRaw8BitQueryString(convertedQuery.data(), convertedQuery.length(), buffer);
+ }
+};
+
+}
+
+#endif
+
+
diff --git a/Source/JavaScriptCore/wtf/url/src/URLSegments.cpp b/Source/JavaScriptCore/wtf/url/src/URLSegments.cpp
new file mode 100644
index 0000000..bb9542f
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/url/src/URLSegments.cpp
@@ -0,0 +1,110 @@
+/* Based on nsURLParsers.cc from Mozilla
+ * -------------------------------------
+ * Copyright (C) 1998 Netscape Communications Corporation.
+ *
+ * Other contributors:
+ * Darin Fisher (original author)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Alternatively, the contents of this file may be used under the terms
+ * of either the Mozilla Public License Version 1.1, found at
+ * http://www.mozilla.org/MPL/ (the "MPL") or the GNU General Public
+ * License Version 2.0, found at http://www.fsf.org/copyleft/gpl.html
+ * (the "GPL"), in which case the provisions of the MPL or the GPL are
+ * applicable instead of those above. If you wish to allow use of your
+ * version of this file only under the terms of one of those two
+ * licenses (the MPL or the GPL) and not to allow others to use your
+ * version of this file under the LGPL, indicate your decision by
+ * deletingthe provisions above and replace them with the notice and
+ * other provisions required by the MPL or the GPL, as the case may be.
+ * If you do not delete the provisions above, a recipient may use your
+ * version of this file under any of the LGPL, the MPL or the GPL.
+ */
+
+#include "config.h"
+#include "URLSegments.h"
+
+namespace WTF {
+
+int URLSegments::length() const
+{
+ if (fragment.isValid())
+ return fragment.end();
+ return charactersBefore(Fragment, false);
+}
+
+int URLSegments::charactersBefore(ComponentType type, bool includeDelimiter) const
+{
+ if (type == Scheme)
+ return scheme.begin();
+
+ int current = 0;
+ if (scheme.isValid())
+ current = scheme.end() + 1; // Advance over the ':' at the end of the scheme.
+
+ if (username.isValid()) {
+ if (type <= Username)
+ return username.begin();
+ current = username.end() + 1; // Advance over the '@' or ':' at the end.
+ }
+
+ if (password.isValid()) {
+ if (type <= Password)
+ return password.begin();
+ current = password.end() + 1; // Advance over the '@' at the end.
+ }
+
+ if (host.isValid()) {
+ if (type <= Host)
+ return host.begin();
+ current = host.end();
+ }
+
+ if (port.isValid()) {
+ if (type < Port || (type == Port && includeDelimiter))
+ return port.begin() - 1; // Back over delimiter.
+ if (type == Port)
+ return port.begin(); // Don't want delimiter counted.
+ current = port.end();
+ }
+
+ if (path.isValid()) {
+ if (type <= Path)
+ return path.begin();
+ current = path.end();
+ }
+
+ if (query.isValid()) {
+ if (type < Query || (type == Query && includeDelimiter))
+ return query.begin() - 1; // Back over delimiter.
+ if (type == Query)
+ return query.begin(); // Don't want delimiter counted.
+ current = query.end();
+ }
+
+ if (fragment.isValid()) {
+ if (type == Fragment && !includeDelimiter)
+ return fragment.begin(); // Back over delimiter.
+
+ // When there is a fragment and we get here, the component we wanted was before
+ // this and not found, so we always know the beginning of the fragment is right.
+ return fragment.begin() - 1; // Don't want delimiter counted.
+ }
+
+ return current;
+}
+
+} // namespace WTF
diff --git a/Source/JavaScriptCore/wtf/url/src/URLSegments.h b/Source/JavaScriptCore/wtf/url/src/URLSegments.h
new file mode 100644
index 0000000..436c7fe
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/url/src/URLSegments.h
@@ -0,0 +1,105 @@
+// Copyright 2007, Google Inc. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#ifndef URLSegments_h
+#define URLSegments_h
+
+#include "URLComponent.h"
+
+namespace WTF {
+
+// A structure that holds the identified parts of an input URL. This structure
+// does NOT store the URL itself. The caller will have to store the URL text
+// and its corresponding Parsed structure separately.
+class URLSegments {
+public:
+ // Identifies different components.
+ enum ComponentType {
+ Scheme,
+ Username,
+ Password,
+ Host,
+ Port,
+ Path,
+ Query,
+ Fragment,
+ };
+
+ URLSegments() { }
+
+ // Returns the length of the URL (the end of the last component).
+ //
+ // Note that for some invalid, non-canonical URLs, this may not be the length
+ // of the string. For example "http://": the parsed structure will only
+ // contain an entry for the four-character scheme, and it doesn't know about
+ // the "://". For all other last-components, it will return the real length.
+ int length() const;
+
+ // Returns the number of characters before the given component if it exists,
+ // or where the component would be if it did exist. This will return the
+ // string length if the component would be appended to the end.
+ //
+ // Note that this can get a little funny for the port, query, and fragment
+ // components which have a delimiter that is not counted as part of the
+ // component. The |includeDelimiter| flag controls if you want this counted
+ // as part of the component or not when the component exists.
+ //
+ // This example shows the difference between the two flags for two of these
+ // delimited components that is present (the port and query) and one that
+ // isn't (the reference). The components that this flag affects are marked
+ // with a *.
+ // 0 1 2
+ // 012345678901234567890
+ // Example input: http://foo:80/?query
+ // include_delim=true, ...=false ("<-" indicates different)
+ // Scheme: 0 0
+ // Username: 5 5
+ // Password: 5 5
+ // Host: 7 7
+ // *Port: 10 11 <-
+ // Path: 13 13
+ // *Query: 14 15 <-
+ // *Fragment: 20 20
+ //
+ int charactersBefore(ComponentType, bool includeDelimiter) const;
+
+ // Each component excludes the related delimiters and has a length of -1
+ // if that component is absent but 0 if the component exists but is empty.
+ URLComponent scheme;
+ URLComponent username;
+ URLComponent password;
+ URLComponent host;
+ URLComponent port;
+ URLComponent path;
+ URLComponent query;
+ URLComponent fragment;
+};
+
+} // namespace WTF
+
+#endif // URLSegments_h
diff --git a/Source/JavaScriptCore/wtf/url/wtfurl.gyp b/Source/JavaScriptCore/wtf/url/wtfurl.gyp
new file mode 100644
index 0000000..f254ae4
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/url/wtfurl.gyp
@@ -0,0 +1,58 @@
+# Copyright (C) 2009 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+{
+ 'variables': {
+ 'chromium_code': 1,
+ },
+ 'targets': [
+ {
+ 'target_name': 'wtfurl',
+ 'type': '<(library)',
+ 'msvs_guid': 'EF5E94AB-B646-4E5B-A058-52EF07B8351C',
+ 'dependencies': [
+ ],
+ 'sources': [
+ 'src/URLComponent.h',
+ 'src/URLSegments.cpp',
+ 'src/URLSegments.h',
+ ],
+ 'direct_dependent_settings': {
+ 'include_dirs': [
+ 'src',
+ ],
+ },
+ },
+ ],
+}
+
+# Local Variables:
+# tab-width:2
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=2 shiftwidth=2:
diff --git a/Source/JavaScriptCore/wtf/win/MainThreadWin.cpp b/Source/JavaScriptCore/wtf/win/MainThreadWin.cpp
new file mode 100644
index 0000000..ee3a273
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/win/MainThreadWin.cpp
@@ -0,0 +1,90 @@
+/*
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2009 Torch Mobile Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "MainThread.h"
+
+#include "Assertions.h"
+#include "Threading.h"
+#if !OS(WINCE)
+#include <windows.h>
+#endif
+
+namespace WTF {
+
+static HWND threadingWindowHandle;
+static UINT threadingFiredMessage;
+const LPCWSTR kThreadingWindowClassName = L"ThreadingWindowClass";
+
+LRESULT CALLBACK ThreadingWindowWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
+{
+ if (message == threadingFiredMessage)
+ dispatchFunctionsFromMainThread();
+ else
+ return DefWindowProc(hWnd, message, wParam, lParam);
+ return 0;
+}
+
+void initializeMainThreadPlatform()
+{
+ if (threadingWindowHandle)
+ return;
+
+ HWND hWndParent = 0;
+#if OS(WINCE)
+ WNDCLASS wcex;
+ memset(&wcex, 0, sizeof(WNDCLASS));
+#else
+ WNDCLASSEX wcex;
+ memset(&wcex, 0, sizeof(WNDCLASSEX));
+ wcex.cbSize = sizeof(WNDCLASSEX);
+#endif
+ wcex.lpfnWndProc = ThreadingWindowWndProc;
+ wcex.lpszClassName = kThreadingWindowClassName;
+#if OS(WINCE)
+ RegisterClass(&wcex);
+#else
+ RegisterClassEx(&wcex);
+ hWndParent = HWND_MESSAGE;
+#endif
+
+ threadingWindowHandle = CreateWindow(kThreadingWindowClassName, 0, 0,
+ CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, hWndParent, 0, 0, 0);
+ threadingFiredMessage = RegisterWindowMessage(L"com.apple.WebKit.MainThreadFired");
+
+ initializeCurrentThreadInternal("Main Thread");
+}
+
+void scheduleDispatchFunctionsOnMainThread()
+{
+ ASSERT(threadingWindowHandle);
+ PostMessage(threadingWindowHandle, threadingFiredMessage, 0, 0);
+}
+
+} // namespace WTF
diff --git a/Source/JavaScriptCore/wtf/win/OwnPtrWin.cpp b/Source/JavaScriptCore/wtf/win/OwnPtrWin.cpp
new file mode 100644
index 0000000..67a32ff
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/win/OwnPtrWin.cpp
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2008, 2009 Torch Mobile, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "OwnPtr.h"
+
+#include <windows.h>
+
+namespace WTF {
+
+void deleteOwnedPtr(HBITMAP ptr)
+{
+ if (ptr)
+ DeleteObject(ptr);
+}
+
+void deleteOwnedPtr(HBRUSH ptr)
+{
+ if (ptr)
+ DeleteObject(ptr);
+}
+
+void deleteOwnedPtr(HDC ptr)
+{
+ if (ptr)
+ DeleteDC(ptr);
+}
+
+void deleteOwnedPtr(HFONT ptr)
+{
+ if (ptr)
+ DeleteObject(ptr);
+}
+
+void deleteOwnedPtr(HPALETTE ptr)
+{
+ if (ptr)
+ DeleteObject(ptr);
+}
+
+void deleteOwnedPtr(HPEN ptr)
+{
+ if (ptr)
+ DeleteObject(ptr);
+}
+
+void deleteOwnedPtr(HRGN ptr)
+{
+ if (ptr)
+ DeleteObject(ptr);
+}
+
+}
diff --git a/Source/JavaScriptCore/wtf/wince/FastMallocWinCE.h b/Source/JavaScriptCore/wtf/wince/FastMallocWinCE.h
new file mode 100644
index 0000000..d91a5f2
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/wince/FastMallocWinCE.h
@@ -0,0 +1,175 @@
+/*
+ * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2007-2009 Torch Mobile, Inc. All rights reserved
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef WTF_FastMallocWinCE_h
+#define WTF_FastMallocWinCE_h
+
+#include <new.h>
+
+#ifdef __cplusplus
+#include <new>
+#include "MemoryManager.h"
+extern "C" {
+#endif
+
+void* fastMalloc(size_t n);
+void* fastCalloc(size_t n_elements, size_t element_size);
+void fastFree(void* p);
+void* fastRealloc(void* p, size_t n);
+void* fastZeroedMalloc(size_t n);
+// These functions return 0 if an allocation fails.
+void* tryFastMalloc(size_t n);
+void* tryFastZeroedMalloc(size_t n);
+void* tryFastCalloc(size_t n_elements, size_t element_size);
+void* tryFastRealloc(void* p, size_t n);
+char* fastStrDup(const char*);
+
+#ifndef NDEBUG
+void fastMallocForbid();
+void fastMallocAllow();
+#endif
+
+#if !defined(USE_SYSTEM_MALLOC) || !USE_SYSTEM_MALLOC
+
+#define malloc(n) fastMalloc(n)
+#define calloc(n_elements, element_size) fastCalloc(n_elements, element_size)
+#define realloc(p, n) fastRealloc(p, n)
+#define free(p) fastFree(p)
+#define strdup(p) fastStrDup(p)
+
+#else
+
+#define strdup(p) _strdup(p)
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#ifdef __cplusplus
+#if !defined(USE_SYSTEM_MALLOC) || !USE_SYSTEM_MALLOC
+static inline void* __cdecl operator new(size_t s) { return fastMalloc(s); }
+static inline void __cdecl operator delete(void* p) { fastFree(p); }
+static inline void* __cdecl operator new[](size_t s) { return fastMalloc(s); }
+static inline void __cdecl operator delete[](void* p) { fastFree(p); }
+static inline void* operator new(size_t s, const std::nothrow_t&) throw() { return fastMalloc(s); }
+static inline void operator delete(void* p, const std::nothrow_t&) throw() { fastFree(p); }
+static inline void* operator new[](size_t s, const std::nothrow_t&) throw() { return fastMalloc(s); }
+static inline void operator delete[](void* p, const std::nothrow_t&) throw() { fastFree(p); }
+#endif
+
+namespace WTF {
+ // This defines a type which holds an unsigned integer and is the same
+ // size as the minimally aligned memory allocation.
+ typedef unsigned long long AllocAlignmentInteger;
+
+ namespace Internal {
+ enum AllocType { // Start with an unusual number instead of zero, because zero is common.
+ AllocTypeMalloc = 0x375d6750, // Encompasses fastMalloc, fastZeroedMalloc, fastCalloc, fastRealloc.
+ AllocTypeClassNew, // Encompasses class operator new from FastAllocBase.
+ AllocTypeClassNewArray, // Encompasses class operator new[] from FastAllocBase.
+ AllocTypeFastNew, // Encompasses fastNew.
+ AllocTypeFastNewArray, // Encompasses fastNewArray.
+ AllocTypeNew, // Encompasses global operator new.
+ AllocTypeNewArray // Encompasses global operator new[].
+ };
+ }
+
+
+#if ENABLE(FAST_MALLOC_MATCH_VALIDATION)
+
+ // Malloc validation is a scheme whereby a tag is attached to an
+ // allocation which identifies how it was originally allocated.
+ // This allows us to verify that the freeing operation matches the
+ // allocation operation. If memory is allocated with operator new[]
+ // but freed with free or delete, this system would detect that.
+ // In the implementation here, the tag is an integer prepended to
+ // the allocation memory which is assigned one of the AllocType
+ // enumeration values. An alternative implementation of this
+ // scheme could store the tag somewhere else or ignore it.
+ // Users of FastMalloc don't need to know or care how this tagging
+ // is implemented.
+
+ namespace Internal {
+
+ // Return the AllocType tag associated with the allocated block p.
+ inline AllocType fastMallocMatchValidationType(const void* p)
+ {
+ const AllocAlignmentInteger* type = static_cast<const AllocAlignmentInteger*>(p) - 1;
+ return static_cast<AllocType>(*type);
+ }
+
+ // Return the address of the AllocType tag associated with the allocated block p.
+ inline AllocAlignmentInteger* fastMallocMatchValidationValue(void* p)
+ {
+ return reinterpret_cast<AllocAlignmentInteger*>(static_cast<char*>(p) - sizeof(AllocAlignmentInteger));
+ }
+
+ // Set the AllocType tag to be associaged with the allocated block p.
+ inline void setFastMallocMatchValidationType(void* p, AllocType allocType)
+ {
+ AllocAlignmentInteger* type = static_cast<AllocAlignmentInteger*>(p) - 1;
+ *type = static_cast<AllocAlignmentInteger>(allocType);
+ }
+
+ // Handle a detected alloc/free mismatch. By default this calls CRASH().
+ void fastMallocMatchFailed(void* p);
+
+ } // namespace Internal
+
+ // This is a higher level function which is used by FastMalloc-using code.
+ inline void fastMallocMatchValidateMalloc(void* p, Internal::AllocType allocType)
+ {
+ if (!p)
+ return;
+
+ Internal::setFastMallocMatchValidationType(p, allocType);
+ }
+
+ // This is a higher level function which is used by FastMalloc-using code.
+ inline void fastMallocMatchValidateFree(void* p, Internal::AllocType allocType)
+ {
+ if (!p)
+ return;
+
+ if (Internal::fastMallocMatchValidationType(p) != allocType)
+ Internal::fastMallocMatchFailed(p);
+ Internal::setFastMallocMatchValidationType(p, Internal::AllocTypeMalloc); // Set it to this so that fastFree thinks it's OK.
+ }
+
+#else
+
+ inline void fastMallocMatchValidateMalloc(void*, Internal::AllocType)
+ {
+ }
+
+ inline void fastMallocMatchValidateFree(void*, Internal::AllocType)
+ {
+ }
+
+#endif
+
+} // namespace WTF
+
+#endif
+
+#endif // WTF_FastMallocWinCE_h
diff --git a/Source/JavaScriptCore/wtf/wince/MemoryManager.cpp b/Source/JavaScriptCore/wtf/wince/MemoryManager.cpp
new file mode 100644
index 0000000..81d4f80
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/wince/MemoryManager.cpp
@@ -0,0 +1,171 @@
+/*
+ * Copyright (C) 2008-2009 Torch Mobile Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "MemoryManager.h"
+
+#undef malloc
+#undef calloc
+#undef realloc
+#undef free
+#undef strdup
+#undef _strdup
+#undef VirtualAlloc
+#undef VirtualFree
+
+#include <malloc.h>
+#include <windows.h>
+
+namespace WTF {
+
+MemoryManager* memoryManager()
+{
+ static MemoryManager mm;
+ return &mm;
+}
+
+MemoryManager::MemoryManager()
+: m_allocationCanFail(false)
+{
+}
+
+MemoryManager::~MemoryManager()
+{
+}
+
+HBITMAP MemoryManager::createCompatibleBitmap(HDC hdc, int width, int height)
+{
+ return ::CreateCompatibleBitmap(hdc, width, height);
+}
+
+HBITMAP MemoryManager::createDIBSection(const BITMAPINFO* pbmi, void** ppvBits)
+{
+ return ::CreateDIBSection(0, pbmi, DIB_RGB_COLORS, ppvBits, 0, 0);
+}
+
+void* MemoryManager::m_malloc(size_t size)
+{
+ return malloc(size);
+}
+
+void* MemoryManager::m_calloc(size_t num, size_t size)
+{
+ return calloc(num, size);
+}
+
+void* MemoryManager::m_realloc(void* p, size_t size)
+{
+ return realloc(p, size);
+}
+
+void MemoryManager::m_free(void* p)
+{
+ return free(p);
+}
+
+bool MemoryManager::resizeMemory(void*, size_t)
+{
+ return false;
+}
+
+void* MemoryManager::allocate64kBlock()
+{
+ return VirtualAlloc(0, 65536, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
+}
+
+void MemoryManager::free64kBlock(void* p)
+{
+ VirtualFree(p, 65536, MEM_RELEASE);
+}
+
+bool MemoryManager::onIdle(DWORD& timeLimitMs)
+{
+ return false;
+}
+
+LPVOID MemoryManager::virtualAlloc(LPVOID lpAddress, DWORD dwSize, DWORD flAllocationType, DWORD flProtect)
+{
+ return ::VirtualAlloc(lpAddress, dwSize, flAllocationType, flProtect);
+}
+
+BOOL MemoryManager::virtualFree(LPVOID lpAddress, DWORD dwSize, DWORD dwFreeType)
+{
+ return ::VirtualFree(lpAddress, dwSize, dwFreeType);
+}
+
+
+#if defined(USE_SYSTEM_MALLOC) && USE_SYSTEM_MALLOC
+
+void *fastMalloc(size_t n) { return malloc(n); }
+void *fastCalloc(size_t n_elements, size_t element_size) { return calloc(n_elements, element_size); }
+void fastFree(void* p) { return free(p); }
+void *fastRealloc(void* p, size_t n) { return realloc(p, n); }
+
+#else
+
+void *fastMalloc(size_t n) { return MemoryManager::m_malloc(n); }
+void *fastCalloc(size_t n_elements, size_t element_size) { return MemoryManager::m_calloc(n_elements, element_size); }
+void fastFree(void* p) { return MemoryManager::m_free(p); }
+void *fastRealloc(void* p, size_t n) { return MemoryManager::m_realloc(p, n); }
+
+#endif
+
+#ifndef NDEBUG
+void fastMallocForbid() {}
+void fastMallocAllow() {}
+#endif
+
+void* fastZeroedMalloc(size_t n)
+{
+ void* p = fastMalloc(n);
+ if (p)
+ memset(p, 0, n);
+ return p;
+}
+
+TryMallocReturnValue tryFastMalloc(size_t n)
+{
+ MemoryAllocationCanFail canFail;
+ return fastMalloc(n);
+}
+
+TryMallocReturnValue tryFastZeroedMalloc(size_t n)
+{
+ MemoryAllocationCanFail canFail;
+ return fastZeroedMalloc(n);
+}
+
+TryMallocReturnValue tryFastCalloc(size_t n_elements, size_t element_size)
+{
+ MemoryAllocationCanFail canFail;
+ return fastCalloc(n_elements, element_size);
+}
+
+TryMallocReturnValue tryFastRealloc(void* p, size_t n)
+{
+ MemoryAllocationCanFail canFail;
+ return fastRealloc(p, n);
+}
+
+char* fastStrDup(const char* str)
+{
+ return _strdup(str);
+}
+
+} \ No newline at end of file
diff --git a/Source/JavaScriptCore/wtf/wince/MemoryManager.h b/Source/JavaScriptCore/wtf/wince/MemoryManager.h
new file mode 100644
index 0000000..f405612
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/wince/MemoryManager.h
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2008-2009 Torch Mobile Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#pragma once
+
+#include <winbase.h>
+
+typedef struct HBITMAP__* HBITMAP;
+typedef struct HDC__* HDC;
+typedef void *HANDLE;
+typedef struct tagBITMAPINFO BITMAPINFO;
+
+namespace WTF {
+
+ class MemoryManager {
+ public:
+ MemoryManager();
+ ~MemoryManager();
+
+ bool allocationCanFail() const { return m_allocationCanFail; }
+ void setAllocationCanFail(bool c) { m_allocationCanFail = c; }
+
+ static HBITMAP createCompatibleBitmap(HDC hdc, int width, int height);
+ static HBITMAP createDIBSection(const BITMAPINFO* pbmi, void** ppvBits);
+ static void* m_malloc(size_t size);
+ static void* m_calloc(size_t num, size_t size);
+ static void* m_realloc(void* p, size_t size);
+ static void m_free(void*);
+ static bool resizeMemory(void* p, size_t newSize);
+ static void* allocate64kBlock();
+ static void free64kBlock(void*);
+ static bool onIdle(DWORD& timeLimitMs);
+ static LPVOID virtualAlloc(LPVOID lpAddress, DWORD dwSize, DWORD flAllocationType, DWORD flProtect);
+ static BOOL virtualFree(LPVOID lpAddress, DWORD dwSize, DWORD dwFreeType);
+
+ private:
+ friend MemoryManager* memoryManager();
+
+ bool m_allocationCanFail;
+ };
+
+ MemoryManager* memoryManager();
+
+ class MemoryAllocationCanFail {
+ public:
+ MemoryAllocationCanFail() : m_old(memoryManager()->allocationCanFail()) { memoryManager()->setAllocationCanFail(true); }
+ ~MemoryAllocationCanFail() { memoryManager()->setAllocationCanFail(m_old); }
+ private:
+ bool m_old;
+ };
+
+ class MemoryAllocationCannotFail {
+ public:
+ MemoryAllocationCannotFail() : m_old(memoryManager()->allocationCanFail()) { memoryManager()->setAllocationCanFail(false); }
+ ~MemoryAllocationCannotFail() { memoryManager()->setAllocationCanFail(m_old); }
+ private:
+ bool m_old;
+ };
+}
+
+using WTF::MemoryManager;
+using WTF::memoryManager;
+using WTF::MemoryAllocationCanFail;
+using WTF::MemoryAllocationCannotFail;
diff --git a/Source/JavaScriptCore/wtf/wince/mt19937ar.c b/Source/JavaScriptCore/wtf/wince/mt19937ar.c
new file mode 100644
index 0000000..4715958
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/wince/mt19937ar.c
@@ -0,0 +1,170 @@
+/*
+ A C-program for MT19937, with initialization improved 2002/1/26.
+ Coded by Takuji Nishimura and Makoto Matsumoto.
+
+ Before using, initialize the state by using init_genrand(seed)
+ or init_by_array(init_key, key_length).
+
+ Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ 3. The names of its contributors may not be used to endorse or promote
+ products derived from this software without specific prior written
+ permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ Any feedback is very welcome.
+ http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html
+ email: m-mat @ math.sci.hiroshima-u.ac.jp (remove space)
+*/
+
+#include <stdio.h>
+
+/* Period parameters */
+#define N 624
+#define M 397
+#define MATRIX_A 0x9908b0dfUL /* constant vector a */
+#define UPPER_MASK 0x80000000UL /* most significant w-r bits */
+#define LOWER_MASK 0x7fffffffUL /* least significant r bits */
+
+static unsigned long mt[N]; /* the array for the state vector */
+static int mti=N+1; /* mti==N+1 means mt[N] is not initialized */
+
+/* initializes mt[N] with a seed */
+void init_genrand(unsigned long s)
+{
+ mt[0]= s & 0xffffffffUL;
+ for (mti=1; mti<N; mti++) {
+ mt[mti] = (1812433253UL * (mt[mti-1] ^ (mt[mti-1] >> 30)) + mti);
+ /* See Knuth TAOCP Vol2. 3rd Ed. P.106 for multiplier. */
+ /* In the previous versions, MSBs of the seed affect */
+ /* only MSBs of the array mt[]. */
+ /* 2002/01/09 modified by Makoto Matsumoto */
+ mt[mti] &= 0xffffffffUL;
+ /* for >32 bit machines */
+ }
+}
+
+/* initialize by an array with array-length */
+/* init_key is the array for initializing keys */
+/* key_length is its length */
+/* slight change for C++, 2004/2/26 */
+void init_by_array(unsigned long init_key[],int key_length)
+{
+ int i, j, k;
+ init_genrand(19650218UL);
+ i=1; j=0;
+ k = (N>key_length ? N : key_length);
+ for (; k; k--) {
+ mt[i] = (mt[i] ^ ((mt[i-1] ^ (mt[i-1] >> 30)) * 1664525UL))
+ + init_key[j] + j; /* non linear */
+ mt[i] &= 0xffffffffUL; /* for WORDSIZE > 32 machines */
+ i++; j++;
+ if (i>=N) { mt[0] = mt[N-1]; i=1; }
+ if (j>=key_length) j=0;
+ }
+ for (k=N-1; k; k--) {
+ mt[i] = (mt[i] ^ ((mt[i-1] ^ (mt[i-1] >> 30)) * 1566083941UL))
+ - i; /* non linear */
+ mt[i] &= 0xffffffffUL; /* for WORDSIZE > 32 machines */
+ i++;
+ if (i>=N) { mt[0] = mt[N-1]; i=1; }
+ }
+
+ mt[0] = 0x80000000UL; /* MSB is 1; assuring non-zero initial array */
+}
+
+/* generates a random number on [0,0xffffffff]-interval */
+unsigned long genrand_int32(void)
+{
+ unsigned long y;
+ static unsigned long mag01[2]={0x0UL, MATRIX_A};
+ /* mag01[x] = x * MATRIX_A for x=0,1 */
+
+ if (mti >= N) { /* generate N words at one time */
+ int kk;
+
+ if (mti == N+1) /* if init_genrand() has not been called, */
+ init_genrand(5489UL); /* a default initial seed is used */
+
+ for (kk=0;kk<N-M;kk++) {
+ y = (mt[kk]&UPPER_MASK)|(mt[kk+1]&LOWER_MASK);
+ mt[kk] = mt[kk+M] ^ (y >> 1) ^ mag01[y & 0x1UL];
+ }
+ for (;kk<N-1;kk++) {
+ y = (mt[kk]&UPPER_MASK)|(mt[kk+1]&LOWER_MASK);
+ mt[kk] = mt[kk+(M-N)] ^ (y >> 1) ^ mag01[y & 0x1UL];
+ }
+ y = (mt[N-1]&UPPER_MASK)|(mt[0]&LOWER_MASK);
+ mt[N-1] = mt[M-1] ^ (y >> 1) ^ mag01[y & 0x1UL];
+
+ mti = 0;
+ }
+
+ y = mt[mti++];
+
+ /* Tempering */
+ y ^= (y >> 11);
+ y ^= (y << 7) & 0x9d2c5680UL;
+ y ^= (y << 15) & 0xefc60000UL;
+ y ^= (y >> 18);
+
+ return y;
+}
+
+/* generates a random number on [0,0x7fffffff]-interval */
+long genrand_int31(void)
+{
+ return (long)(genrand_int32()>>1);
+}
+
+/* generates a random number on [0,1]-real-interval */
+double genrand_real1(void)
+{
+ return genrand_int32()*(1.0/4294967295.0);
+ /* divided by 2^32-1 */
+}
+
+/* generates a random number on [0,1)-real-interval */
+double genrand_real2(void)
+{
+ return genrand_int32()*(1.0/4294967296.0);
+ /* divided by 2^32 */
+}
+
+/* generates a random number on (0,1)-real-interval */
+double genrand_real3(void)
+{
+ return (((double)genrand_int32()) + 0.5)*(1.0/4294967296.0);
+ /* divided by 2^32 */
+}
+
+/* generates a random number on [0,1) with 53-bit resolution*/
+double genrand_res53(void)
+{
+ unsigned long a=genrand_int32()>>5, b=genrand_int32()>>6;
+ return(a*67108864.0+b)*(1.0/9007199254740992.0);
+}
diff --git a/Source/JavaScriptCore/wtf/wtf.pri b/Source/JavaScriptCore/wtf/wtf.pri
new file mode 100644
index 0000000..8535ef3
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/wtf.pri
@@ -0,0 +1,51 @@
+# wtf - qmake build info
+
+SOURCES += \
+ wtf/Assertions.cpp \
+ wtf/ByteArray.cpp \
+ wtf/CurrentTime.cpp \
+ wtf/DateMath.cpp \
+ wtf/dtoa.cpp \
+ wtf/DecimalNumber.cpp \
+ wtf/FastMalloc.cpp \
+ wtf/gobject/GOwnPtr.cpp \
+ wtf/gobject/GRefPtr.cpp \
+ wtf/HashTable.cpp \
+ wtf/MD5.cpp \
+ wtf/MainThread.cpp \
+ wtf/NullPtr.cpp \
+ wtf/qt/MainThreadQt.cpp \
+ wtf/qt/StringQt.cpp \
+ wtf/qt/ThreadingQt.cpp \
+ wtf/PageAllocationAligned.cpp \
+ wtf/PageBlock.cpp \
+ wtf/RandomNumber.cpp \
+ wtf/RefCountedLeakCounter.cpp \
+ wtf/StackBounds.cpp \
+ wtf/ThreadingNone.cpp \
+ wtf/Threading.cpp \
+ wtf/TypeTraits.cpp \
+ wtf/WTFThreadData.cpp \
+ wtf/text/AtomicString.cpp \
+ wtf/text/CString.cpp \
+ wtf/text/StringBuilder.cpp \
+ wtf/text/StringImpl.cpp \
+ wtf/text/StringStatics.cpp \
+ wtf/text/WTFString.cpp \
+ wtf/unicode/CollatorDefault.cpp \
+ wtf/unicode/icu/CollatorICU.cpp \
+ wtf/unicode/UTF8.cpp
+
+contains(DEFINES, USE_GSTREAMER=1) {
+ DEFINES += ENABLE_GLIB_SUPPORT=1
+ PKGCONFIG += glib-2.0 gio-2.0
+ CONFIG += link_pkgconfig
+}
+
+!contains(DEFINES, USE_SYSTEM_MALLOC=1) {
+ SOURCES += wtf/TCSystemAlloc.cpp
+}
+
+unix:!symbian: SOURCES += wtf/OSAllocatorPosix.cpp
+symbian: SOURCES += wtf/OSAllocatorSymbian.cpp
+win*|wince*: SOURCES += wtf/OSAllocatorWin.cpp
diff --git a/Source/JavaScriptCore/wtf/wx/MainThreadWx.cpp b/Source/JavaScriptCore/wtf/wx/MainThreadWx.cpp
new file mode 100644
index 0000000..e1d15c9
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/wx/MainThreadWx.cpp
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2007 Kevin Ollivier
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "MainThread.h"
+
+#include <wx/defs.h>
+#include <wx/app.h>
+#include <wx/event.h>
+
+const wxEventType wxEVT_CALL_AFTER = wxNewEventType();
+
+class wxCallAfter : public wxEvtHandler
+{
+public:
+ wxCallAfter()
+ : wxEvtHandler()
+ {
+ wxTheApp->Connect(-1, -1, wxEVT_CALL_AFTER, wxCommandEventHandler(wxCallAfter::OnCallback));
+ wxCommandEvent event(wxEVT_CALL_AFTER);
+ wxPostEvent(wxTheApp, event);
+ }
+
+ void OnCallback(wxCommandEvent& event)
+ {
+ WTF::dispatchFunctionsFromMainThread();
+ }
+};
+
+namespace WTF {
+
+void initializeMainThreadPlatform()
+{
+}
+
+void scheduleDispatchFunctionsOnMainThread()
+{
+ wxCallAfter();
+}
+
+} // namespace WTF
diff --git a/Source/JavaScriptCore/wtf/wx/StringWx.cpp b/Source/JavaScriptCore/wtf/wx/StringWx.cpp
new file mode 100644
index 0000000..59d500b
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/wx/StringWx.cpp
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2007 Vaclav Slavik, Kevin Ollivier <kevino@theolliviers.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "PlatformString.h"
+
+#include <unicode/ustring.h>
+#include <wtf/text/CString.h>
+#include <wx/defs.h>
+#include <wx/string.h>
+
+namespace WTF {
+
+String::String(const wxString& wxstr)
+{
+#if !wxUSE_UNICODE
+ #error "This code only works in Unicode build of wxWidgets"
+#endif
+
+#if SIZEOF_WCHAR_T == sizeof(UChar)
+
+ m_impl = StringImpl::create(wxstr.wc_str(), wxstr.length());
+
+#else // SIZEOF_WCHAR_T == 4
+
+ // NB: we can't simply use wxstr.mb_str(wxMBConvUTF16()) here because
+ // the number of characters in UTF-16 encoding of the string may differ
+ // from the number of UTF-32 values and we can't get the length from
+ // returned buffer:
+
+#if defined(wxUSE_UNICODE_UTF8) && wxUSE_UNICODE_UTF8
+ // in wx3's UTF8 mode, wc_str() returns a buffer, not raw pointer
+ wxWCharBuffer wideString(wxstr.wc_str());
+#else
+ const wxChar *wideString = wxstr.wc_str();
+#endif
+ size_t wideLength = wxstr.length();
+
+ UChar* data;
+ wxMBConvUTF16 conv;
+ unsigned utf16Length = conv.FromWChar(0, 0, wideString, wideLength);
+ m_impl = StringImpl::createUninitialized(utf16Length, data)
+ conv.FromWChar(data, utf16Length, wideString, wideLength);
+
+#endif // SIZEOF_WCHAR_T == 4
+}
+
+String::operator wxString() const
+{
+ return wxString(utf8().data(), wxConvUTF8);
+}
+
+} // namespace WTF
diff --git a/Source/JavaScriptCore/yarr/RegexInterpreter.cpp b/Source/JavaScriptCore/yarr/RegexInterpreter.cpp
new file mode 100644
index 0000000..7769922
--- /dev/null
+++ b/Source/JavaScriptCore/yarr/RegexInterpreter.cpp
@@ -0,0 +1,1891 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2010 Peter Varga (pvarga@inf.u-szeged.hu), University of Szeged
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "RegexInterpreter.h"
+
+#include "RegexPattern.h"
+#include <wtf/BumpPointerAllocator.h>
+
+#ifndef NDEBUG
+#include <stdio.h>
+#endif
+
+using namespace WTF;
+
+namespace JSC { namespace Yarr {
+
+class Interpreter {
+public:
+ struct ParenthesesDisjunctionContext;
+
+ struct BackTrackInfoPatternCharacter {
+ uintptr_t matchAmount;
+ };
+ struct BackTrackInfoCharacterClass {
+ uintptr_t matchAmount;
+ };
+ struct BackTrackInfoBackReference {
+ uintptr_t begin; // Not really needed for greedy quantifiers.
+ uintptr_t matchAmount; // Not really needed for fixed quantifiers.
+ };
+ struct BackTrackInfoAlternative {
+ uintptr_t offset;
+ };
+ struct BackTrackInfoParentheticalAssertion {
+ uintptr_t begin;
+ };
+ struct BackTrackInfoParenthesesOnce {
+ uintptr_t begin;
+ };
+ struct BackTrackInfoParenthesesTerminal {
+ uintptr_t begin;
+ };
+ struct BackTrackInfoParentheses {
+ uintptr_t matchAmount;
+ ParenthesesDisjunctionContext* lastContext;
+ };
+
+ static inline void appendParenthesesDisjunctionContext(BackTrackInfoParentheses* backTrack, ParenthesesDisjunctionContext* context)
+ {
+ context->next = backTrack->lastContext;
+ backTrack->lastContext = context;
+ ++backTrack->matchAmount;
+ }
+
+ static inline void popParenthesesDisjunctionContext(BackTrackInfoParentheses* backTrack)
+ {
+ ASSERT(backTrack->matchAmount);
+ ASSERT(backTrack->lastContext);
+ backTrack->lastContext = backTrack->lastContext->next;
+ --backTrack->matchAmount;
+ }
+
+ struct DisjunctionContext
+ {
+ DisjunctionContext()
+ : term(0)
+ {
+ }
+
+ void* operator new(size_t, void* where)
+ {
+ return where;
+ }
+
+ int term;
+ unsigned matchBegin;
+ unsigned matchEnd;
+ uintptr_t frame[1];
+ };
+
+ DisjunctionContext* allocDisjunctionContext(ByteDisjunction* disjunction)
+ {
+ size_t size = sizeof(DisjunctionContext) - sizeof(uintptr_t) + disjunction->m_frameSize * sizeof(uintptr_t);
+ allocatorPool = allocatorPool->ensureCapacity(size);
+ if (!allocatorPool)
+ CRASH();
+ return new(allocatorPool->alloc(size)) DisjunctionContext();
+ }
+
+ void freeDisjunctionContext(DisjunctionContext* context)
+ {
+ allocatorPool = allocatorPool->dealloc(context);
+ }
+
+ struct ParenthesesDisjunctionContext
+ {
+ ParenthesesDisjunctionContext(int* output, ByteTerm& term)
+ : next(0)
+ {
+ unsigned firstSubpatternId = term.atom.subpatternId;
+ unsigned numNestedSubpatterns = term.atom.parenthesesDisjunction->m_numSubpatterns;
+
+ for (unsigned i = 0; i < (numNestedSubpatterns << 1); ++i) {
+ subpatternBackup[i] = output[(firstSubpatternId << 1) + i];
+ output[(firstSubpatternId << 1) + i] = -1;
+ }
+
+ new(getDisjunctionContext(term)) DisjunctionContext();
+ }
+
+ void* operator new(size_t, void* where)
+ {
+ return where;
+ }
+
+ void restoreOutput(int* output, unsigned firstSubpatternId, unsigned numNestedSubpatterns)
+ {
+ for (unsigned i = 0; i < (numNestedSubpatterns << 1); ++i)
+ output[(firstSubpatternId << 1) + i] = subpatternBackup[i];
+ }
+
+ DisjunctionContext* getDisjunctionContext(ByteTerm& term)
+ {
+ return reinterpret_cast<DisjunctionContext*>(&(subpatternBackup[term.atom.parenthesesDisjunction->m_numSubpatterns << 1]));
+ }
+
+ ParenthesesDisjunctionContext* next;
+ int subpatternBackup[1];
+ };
+
+ ParenthesesDisjunctionContext* allocParenthesesDisjunctionContext(ByteDisjunction* disjunction, int* output, ByteTerm& term)
+ {
+ size_t size = sizeof(ParenthesesDisjunctionContext) - sizeof(int) + (term.atom.parenthesesDisjunction->m_numSubpatterns << 1) * sizeof(int) + sizeof(DisjunctionContext) - sizeof(uintptr_t) + disjunction->m_frameSize * sizeof(uintptr_t);
+ allocatorPool = allocatorPool->ensureCapacity(size);
+ if (!allocatorPool)
+ CRASH();
+ return new(allocatorPool->alloc(size)) ParenthesesDisjunctionContext(output, term);
+ }
+
+ void freeParenthesesDisjunctionContext(ParenthesesDisjunctionContext* context)
+ {
+ allocatorPool = allocatorPool->dealloc(context);
+ }
+
+ class InputStream {
+ public:
+ InputStream(const UChar* input, unsigned start, unsigned length)
+ : input(input)
+ , pos(start)
+ , length(length)
+ {
+ }
+
+ void next()
+ {
+ ++pos;
+ }
+
+ void rewind(unsigned amount)
+ {
+ ASSERT(pos >= amount);
+ pos -= amount;
+ }
+
+ int read()
+ {
+ ASSERT(pos < length);
+ if (pos < length)
+ return input[pos];
+ return -1;
+ }
+
+ int readPair()
+ {
+ ASSERT(pos + 1 < length);
+ return input[pos] | input[pos + 1] << 16;
+ }
+
+ int readChecked(int position)
+ {
+ ASSERT(position < 0);
+ ASSERT((unsigned)-position <= pos);
+ unsigned p = pos + position;
+ ASSERT(p < length);
+ return input[p];
+ }
+
+ int reread(unsigned from)
+ {
+ ASSERT(from < length);
+ return input[from];
+ }
+
+ int prev()
+ {
+ ASSERT(!(pos > length));
+ if (pos && length)
+ return input[pos - 1];
+ return -1;
+ }
+
+ unsigned getPos()
+ {
+ return pos;
+ }
+
+ void setPos(unsigned p)
+ {
+ pos = p;
+ }
+
+ bool atStart()
+ {
+ return pos == 0;
+ }
+
+ bool atEnd()
+ {
+ return pos == length;
+ }
+
+ bool checkInput(int count)
+ {
+ if ((pos + count) <= length) {
+ pos += count;
+ return true;
+ } else
+ return false;
+ }
+
+ void uncheckInput(int count)
+ {
+ pos -= count;
+ }
+
+ bool atStart(int position)
+ {
+ return (pos + position) == 0;
+ }
+
+ bool atEnd(int position)
+ {
+ return (pos + position) == length;
+ }
+
+ bool isNotAvailableInput(int position)
+ {
+ return (pos + position) > length;
+ }
+
+ private:
+ const UChar* input;
+ unsigned pos;
+ unsigned length;
+ };
+
+ bool testCharacterClass(CharacterClass* characterClass, int ch)
+ {
+ if (ch & 0xFF80) {
+ for (unsigned i = 0; i < characterClass->m_matchesUnicode.size(); ++i)
+ if (ch == characterClass->m_matchesUnicode[i])
+ return true;
+ for (unsigned i = 0; i < characterClass->m_rangesUnicode.size(); ++i)
+ if ((ch >= characterClass->m_rangesUnicode[i].begin) && (ch <= characterClass->m_rangesUnicode[i].end))
+ return true;
+ } else {
+ for (unsigned i = 0; i < characterClass->m_matches.size(); ++i)
+ if (ch == characterClass->m_matches[i])
+ return true;
+ for (unsigned i = 0; i < characterClass->m_ranges.size(); ++i)
+ if ((ch >= characterClass->m_ranges[i].begin) && (ch <= characterClass->m_ranges[i].end))
+ return true;
+ }
+
+ return false;
+ }
+
+ bool checkCharacter(int testChar, int inputPosition)
+ {
+ return testChar == input.readChecked(inputPosition);
+ }
+
+ bool checkCasedCharacter(int loChar, int hiChar, int inputPosition)
+ {
+ int ch = input.readChecked(inputPosition);
+ return (loChar == ch) || (hiChar == ch);
+ }
+
+ bool checkCharacterClass(CharacterClass* characterClass, bool invert, int inputPosition)
+ {
+ bool match = testCharacterClass(characterClass, input.readChecked(inputPosition));
+ return invert ? !match : match;
+ }
+
+ bool tryConsumeBackReference(int matchBegin, int matchEnd, int inputOffset)
+ {
+ int matchSize = matchEnd - matchBegin;
+
+ if (!input.checkInput(matchSize))
+ return false;
+
+ if (pattern->m_ignoreCase) {
+ for (int i = 0; i < matchSize; ++i) {
+ int ch = input.reread(matchBegin + i);
+
+ int lo = Unicode::toLower(ch);
+ int hi = Unicode::toUpper(ch);
+
+ if ((lo != hi) ? (!checkCasedCharacter(lo, hi, inputOffset - matchSize + i)) : (!checkCharacter(ch, inputOffset - matchSize + i))) {
+ input.uncheckInput(matchSize);
+ return false;
+ }
+ }
+ } else {
+ for (int i = 0; i < matchSize; ++i) {
+ if (!checkCharacter(input.reread(matchBegin + i), inputOffset - matchSize + i)) {
+ input.uncheckInput(matchSize);
+ return false;
+ }
+ }
+ }
+
+ return true;
+ }
+
+ bool matchAssertionBOL(ByteTerm& term)
+ {
+ return (input.atStart(term.inputPosition)) || (pattern->m_multiline && testCharacterClass(pattern->newlineCharacterClass, input.readChecked(term.inputPosition - 1)));
+ }
+
+ bool matchAssertionEOL(ByteTerm& term)
+ {
+ if (term.inputPosition)
+ return (input.atEnd(term.inputPosition)) || (pattern->m_multiline && testCharacterClass(pattern->newlineCharacterClass, input.readChecked(term.inputPosition)));
+ else
+ return (input.atEnd()) || (pattern->m_multiline && testCharacterClass(pattern->newlineCharacterClass, input.read()));
+ }
+
+ bool matchAssertionWordBoundary(ByteTerm& term)
+ {
+ bool prevIsWordchar = !input.atStart(term.inputPosition) && testCharacterClass(pattern->wordcharCharacterClass, input.readChecked(term.inputPosition - 1));
+ bool readIsWordchar;
+ if (term.inputPosition)
+ readIsWordchar = !input.atEnd(term.inputPosition) && testCharacterClass(pattern->wordcharCharacterClass, input.readChecked(term.inputPosition));
+ else
+ readIsWordchar = !input.atEnd() && testCharacterClass(pattern->wordcharCharacterClass, input.read());
+
+ bool wordBoundary = prevIsWordchar != readIsWordchar;
+ return term.invert() ? !wordBoundary : wordBoundary;
+ }
+
+ bool backtrackPatternCharacter(ByteTerm& term, DisjunctionContext* context)
+ {
+ BackTrackInfoPatternCharacter* backTrack = reinterpret_cast<BackTrackInfoPatternCharacter*>(context->frame + term.frameLocation);
+
+ switch (term.atom.quantityType) {
+ case QuantifierFixedCount:
+ break;
+
+ case QuantifierGreedy:
+ if (backTrack->matchAmount) {
+ --backTrack->matchAmount;
+ input.uncheckInput(1);
+ return true;
+ }
+ break;
+
+ case QuantifierNonGreedy:
+ if ((backTrack->matchAmount < term.atom.quantityCount) && input.checkInput(1)) {
+ ++backTrack->matchAmount;
+ if (checkCharacter(term.atom.patternCharacter, term.inputPosition - 1))
+ return true;
+ }
+ input.uncheckInput(backTrack->matchAmount);
+ break;
+ }
+
+ return false;
+ }
+
+ bool backtrackPatternCasedCharacter(ByteTerm& term, DisjunctionContext* context)
+ {
+ BackTrackInfoPatternCharacter* backTrack = reinterpret_cast<BackTrackInfoPatternCharacter*>(context->frame + term.frameLocation);
+
+ switch (term.atom.quantityType) {
+ case QuantifierFixedCount:
+ break;
+
+ case QuantifierGreedy:
+ if (backTrack->matchAmount) {
+ --backTrack->matchAmount;
+ input.uncheckInput(1);
+ return true;
+ }
+ break;
+
+ case QuantifierNonGreedy:
+ if ((backTrack->matchAmount < term.atom.quantityCount) && input.checkInput(1)) {
+ ++backTrack->matchAmount;
+ if (checkCasedCharacter(term.atom.casedCharacter.lo, term.atom.casedCharacter.hi, term.inputPosition - 1))
+ return true;
+ }
+ input.uncheckInput(backTrack->matchAmount);
+ break;
+ }
+
+ return false;
+ }
+
+ bool matchCharacterClass(ByteTerm& term, DisjunctionContext* context)
+ {
+ ASSERT(term.type == ByteTerm::TypeCharacterClass);
+ BackTrackInfoPatternCharacter* backTrack = reinterpret_cast<BackTrackInfoPatternCharacter*>(context->frame + term.frameLocation);
+
+ switch (term.atom.quantityType) {
+ case QuantifierFixedCount: {
+ for (unsigned matchAmount = 0; matchAmount < term.atom.quantityCount; ++matchAmount) {
+ if (!checkCharacterClass(term.atom.characterClass, term.invert(), term.inputPosition + matchAmount))
+ return false;
+ }
+ return true;
+ }
+
+ case QuantifierGreedy: {
+ unsigned matchAmount = 0;
+ while ((matchAmount < term.atom.quantityCount) && input.checkInput(1)) {
+ if (!checkCharacterClass(term.atom.characterClass, term.invert(), term.inputPosition - 1)) {
+ input.uncheckInput(1);
+ break;
+ }
+ ++matchAmount;
+ }
+ backTrack->matchAmount = matchAmount;
+
+ return true;
+ }
+
+ case QuantifierNonGreedy:
+ backTrack->matchAmount = 0;
+ return true;
+ }
+
+ ASSERT_NOT_REACHED();
+ return false;
+ }
+
+ bool backtrackCharacterClass(ByteTerm& term, DisjunctionContext* context)
+ {
+ ASSERT(term.type == ByteTerm::TypeCharacterClass);
+ BackTrackInfoPatternCharacter* backTrack = reinterpret_cast<BackTrackInfoPatternCharacter*>(context->frame + term.frameLocation);
+
+ switch (term.atom.quantityType) {
+ case QuantifierFixedCount:
+ break;
+
+ case QuantifierGreedy:
+ if (backTrack->matchAmount) {
+ --backTrack->matchAmount;
+ input.uncheckInput(1);
+ return true;
+ }
+ break;
+
+ case QuantifierNonGreedy:
+ if ((backTrack->matchAmount < term.atom.quantityCount) && input.checkInput(1)) {
+ ++backTrack->matchAmount;
+ if (checkCharacterClass(term.atom.characterClass, term.invert(), term.inputPosition - 1))
+ return true;
+ }
+ input.uncheckInput(backTrack->matchAmount);
+ break;
+ }
+
+ return false;
+ }
+
+ bool matchBackReference(ByteTerm& term, DisjunctionContext* context)
+ {
+ ASSERT(term.type == ByteTerm::TypeBackReference);
+ BackTrackInfoBackReference* backTrack = reinterpret_cast<BackTrackInfoBackReference*>(context->frame + term.frameLocation);
+
+ int matchBegin = output[(term.atom.subpatternId << 1)];
+ int matchEnd = output[(term.atom.subpatternId << 1) + 1];
+
+ // If the end position of the referenced match hasn't set yet then the backreference in the same parentheses where it references to that.
+ // In this case the result of match is empty string like when it references to a parentheses with zero-width match.
+ // Eg.: /(a\1)/
+ if (matchEnd == -1)
+ return true;
+
+ ASSERT((matchBegin == -1) || (matchBegin <= matchEnd));
+
+ if (matchBegin == matchEnd)
+ return true;
+
+ switch (term.atom.quantityType) {
+ case QuantifierFixedCount: {
+ backTrack->begin = input.getPos();
+ for (unsigned matchAmount = 0; matchAmount < term.atom.quantityCount; ++matchAmount) {
+ if (!tryConsumeBackReference(matchBegin, matchEnd, term.inputPosition)) {
+ input.setPos(backTrack->begin);
+ return false;
+ }
+ }
+ return true;
+ }
+
+ case QuantifierGreedy: {
+ unsigned matchAmount = 0;
+ while ((matchAmount < term.atom.quantityCount) && tryConsumeBackReference(matchBegin, matchEnd, term.inputPosition))
+ ++matchAmount;
+ backTrack->matchAmount = matchAmount;
+ return true;
+ }
+
+ case QuantifierNonGreedy:
+ backTrack->begin = input.getPos();
+ backTrack->matchAmount = 0;
+ return true;
+ }
+
+ ASSERT_NOT_REACHED();
+ return false;
+ }
+
+ bool backtrackBackReference(ByteTerm& term, DisjunctionContext* context)
+ {
+ ASSERT(term.type == ByteTerm::TypeBackReference);
+ BackTrackInfoBackReference* backTrack = reinterpret_cast<BackTrackInfoBackReference*>(context->frame + term.frameLocation);
+
+ int matchBegin = output[(term.atom.subpatternId << 1)];
+ int matchEnd = output[(term.atom.subpatternId << 1) + 1];
+ ASSERT((matchBegin == -1) || (matchBegin <= matchEnd));
+
+ if (matchBegin == matchEnd)
+ return false;
+
+ switch (term.atom.quantityType) {
+ case QuantifierFixedCount:
+ // for quantityCount == 1, could rewind.
+ input.setPos(backTrack->begin);
+ break;
+
+ case QuantifierGreedy:
+ if (backTrack->matchAmount) {
+ --backTrack->matchAmount;
+ input.rewind(matchEnd - matchBegin);
+ return true;
+ }
+ break;
+
+ case QuantifierNonGreedy:
+ if ((backTrack->matchAmount < term.atom.quantityCount) && tryConsumeBackReference(matchBegin, matchEnd, term.inputPosition)) {
+ ++backTrack->matchAmount;
+ return true;
+ } else
+ input.setPos(backTrack->begin);
+ break;
+ }
+
+ return false;
+ }
+
+ void recordParenthesesMatch(ByteTerm& term, ParenthesesDisjunctionContext* context)
+ {
+ if (term.capture()) {
+ unsigned subpatternId = term.atom.subpatternId;
+ output[(subpatternId << 1)] = context->getDisjunctionContext(term)->matchBegin + term.inputPosition;
+ output[(subpatternId << 1) + 1] = context->getDisjunctionContext(term)->matchEnd + term.inputPosition;
+ }
+ }
+ void resetMatches(ByteTerm& term, ParenthesesDisjunctionContext* context)
+ {
+ unsigned firstSubpatternId = term.atom.subpatternId;
+ unsigned count = term.atom.parenthesesDisjunction->m_numSubpatterns;
+ context->restoreOutput(output, firstSubpatternId, count);
+ }
+ JSRegExpResult parenthesesDoBacktrack(ByteTerm& term, BackTrackInfoParentheses* backTrack)
+ {
+ while (backTrack->matchAmount) {
+ ParenthesesDisjunctionContext* context = backTrack->lastContext;
+
+ JSRegExpResult result = matchDisjunction(term.atom.parenthesesDisjunction, context->getDisjunctionContext(term), true);
+ if (result == JSRegExpMatch)
+ return JSRegExpMatch;
+
+ resetMatches(term, context);
+ popParenthesesDisjunctionContext(backTrack);
+ freeParenthesesDisjunctionContext(context);
+
+ if (result != JSRegExpNoMatch)
+ return result;
+ }
+
+ return JSRegExpNoMatch;
+ }
+
+ bool matchParenthesesOnceBegin(ByteTerm& term, DisjunctionContext* context)
+ {
+ ASSERT(term.type == ByteTerm::TypeParenthesesSubpatternOnceBegin);
+ ASSERT(term.atom.quantityCount == 1);
+
+ BackTrackInfoParenthesesOnce* backTrack = reinterpret_cast<BackTrackInfoParenthesesOnce*>(context->frame + term.frameLocation);
+
+ switch (term.atom.quantityType) {
+ case QuantifierGreedy: {
+ // set this speculatively; if we get to the parens end this will be true.
+ backTrack->begin = input.getPos();
+ break;
+ }
+ case QuantifierNonGreedy: {
+ backTrack->begin = notFound;
+ context->term += term.atom.parenthesesWidth;
+ return true;
+ }
+ case QuantifierFixedCount:
+ break;
+ }
+
+ if (term.capture()) {
+ unsigned subpatternId = term.atom.subpatternId;
+ output[(subpatternId << 1)] = input.getPos() + term.inputPosition;
+ }
+
+ return true;
+ }
+
+ bool matchParenthesesOnceEnd(ByteTerm& term, DisjunctionContext* context)
+ {
+ ASSERT(term.type == ByteTerm::TypeParenthesesSubpatternOnceEnd);
+ ASSERT(term.atom.quantityCount == 1);
+
+ if (term.capture()) {
+ unsigned subpatternId = term.atom.subpatternId;
+ output[(subpatternId << 1) + 1] = input.getPos() + term.inputPosition;
+ }
+
+ if (term.atom.quantityType == QuantifierFixedCount)
+ return true;
+
+ BackTrackInfoParenthesesOnce* backTrack = reinterpret_cast<BackTrackInfoParenthesesOnce*>(context->frame + term.frameLocation);
+ return backTrack->begin != input.getPos();
+ }
+
+ bool backtrackParenthesesOnceBegin(ByteTerm& term, DisjunctionContext* context)
+ {
+ ASSERT(term.type == ByteTerm::TypeParenthesesSubpatternOnceBegin);
+ ASSERT(term.atom.quantityCount == 1);
+
+ BackTrackInfoParenthesesOnce* backTrack = reinterpret_cast<BackTrackInfoParenthesesOnce*>(context->frame + term.frameLocation);
+
+ if (term.capture()) {
+ unsigned subpatternId = term.atom.subpatternId;
+ output[(subpatternId << 1)] = -1;
+ output[(subpatternId << 1) + 1] = -1;
+ }
+
+ switch (term.atom.quantityType) {
+ case QuantifierGreedy:
+ // if we backtrack to this point, there is another chance - try matching nothing.
+ ASSERT(backTrack->begin != notFound);
+ backTrack->begin = notFound;
+ context->term += term.atom.parenthesesWidth;
+ return true;
+ case QuantifierNonGreedy:
+ ASSERT(backTrack->begin != notFound);
+ case QuantifierFixedCount:
+ break;
+ }
+
+ return false;
+ }
+
+ bool backtrackParenthesesOnceEnd(ByteTerm& term, DisjunctionContext* context)
+ {
+ ASSERT(term.type == ByteTerm::TypeParenthesesSubpatternOnceEnd);
+ ASSERT(term.atom.quantityCount == 1);
+
+ BackTrackInfoParenthesesOnce* backTrack = reinterpret_cast<BackTrackInfoParenthesesOnce*>(context->frame + term.frameLocation);
+
+ switch (term.atom.quantityType) {
+ case QuantifierGreedy:
+ if (backTrack->begin == notFound) {
+ context->term -= term.atom.parenthesesWidth;
+ return false;
+ }
+ case QuantifierNonGreedy:
+ if (backTrack->begin == notFound) {
+ backTrack->begin = input.getPos();
+ if (term.capture()) {
+ // Technically this access to inputPosition should be accessing the begin term's
+ // inputPosition, but for repeats other than fixed these values should be
+ // the same anyway! (We don't pre-check for greedy or non-greedy matches.)
+ ASSERT((&term - term.atom.parenthesesWidth)->type == ByteTerm::TypeParenthesesSubpatternOnceBegin);
+ ASSERT((&term - term.atom.parenthesesWidth)->inputPosition == term.inputPosition);
+ unsigned subpatternId = term.atom.subpatternId;
+ output[subpatternId << 1] = input.getPos() + term.inputPosition;
+ }
+ context->term -= term.atom.parenthesesWidth;
+ return true;
+ }
+ case QuantifierFixedCount:
+ break;
+ }
+
+ return false;
+ }
+
+ bool matchParenthesesTerminalBegin(ByteTerm& term, DisjunctionContext* context)
+ {
+ ASSERT(term.type == ByteTerm::TypeParenthesesSubpatternTerminalBegin);
+ ASSERT(term.atom.quantityType == QuantifierGreedy);
+ ASSERT(term.atom.quantityCount == quantifyInfinite);
+ ASSERT(!term.capture());
+
+ BackTrackInfoParenthesesTerminal* backTrack = reinterpret_cast<BackTrackInfoParenthesesTerminal*>(context->frame + term.frameLocation);
+ backTrack->begin = input.getPos();
+ return true;
+ }
+
+ bool matchParenthesesTerminalEnd(ByteTerm& term, DisjunctionContext* context)
+ {
+ ASSERT(term.type == ByteTerm::TypeParenthesesSubpatternTerminalEnd);
+
+ BackTrackInfoParenthesesTerminal* backTrack = reinterpret_cast<BackTrackInfoParenthesesTerminal*>(context->frame + term.frameLocation);
+ // Empty match is a failed match.
+ if (backTrack->begin == input.getPos())
+ return false;
+
+ // Successful match! Okay, what's next? - loop around and try to match moar!
+ context->term -= (term.atom.parenthesesWidth + 1);
+ return true;
+ }
+
+ bool backtrackParenthesesTerminalBegin(ByteTerm& term, DisjunctionContext* context)
+ {
+ ASSERT(term.type == ByteTerm::TypeParenthesesSubpatternTerminalBegin);
+ ASSERT(term.atom.quantityType == QuantifierGreedy);
+ ASSERT(term.atom.quantityCount == quantifyInfinite);
+ ASSERT(!term.capture());
+
+ // If we backtrack to this point, we have failed to match this iteration of the parens.
+ // Since this is greedy / zero minimum a failed is also accepted as a match!
+ context->term += term.atom.parenthesesWidth;
+ return true;
+ }
+
+ bool backtrackParenthesesTerminalEnd(ByteTerm&, DisjunctionContext*)
+ {
+ // 'Terminal' parentheses are at the end of the regex, and as such a match past end
+ // should always be returned as a successful match - we should never backtrack to here.
+ ASSERT_NOT_REACHED();
+ return false;
+ }
+
+ bool matchParentheticalAssertionBegin(ByteTerm& term, DisjunctionContext* context)
+ {
+ ASSERT(term.type == ByteTerm::TypeParentheticalAssertionBegin);
+ ASSERT(term.atom.quantityCount == 1);
+
+ BackTrackInfoParentheticalAssertion* backTrack = reinterpret_cast<BackTrackInfoParentheticalAssertion*>(context->frame + term.frameLocation);
+
+ backTrack->begin = input.getPos();
+ return true;
+ }
+
+ bool matchParentheticalAssertionEnd(ByteTerm& term, DisjunctionContext* context)
+ {
+ ASSERT(term.type == ByteTerm::TypeParentheticalAssertionEnd);
+ ASSERT(term.atom.quantityCount == 1);
+
+ BackTrackInfoParentheticalAssertion* backTrack = reinterpret_cast<BackTrackInfoParentheticalAssertion*>(context->frame + term.frameLocation);
+
+ input.setPos(backTrack->begin);
+
+ // We've reached the end of the parens; if they are inverted, this is failure.
+ if (term.invert()) {
+ context->term -= term.atom.parenthesesWidth;
+ return false;
+ }
+
+ return true;
+ }
+
+ bool backtrackParentheticalAssertionBegin(ByteTerm& term, DisjunctionContext* context)
+ {
+ ASSERT(term.type == ByteTerm::TypeParentheticalAssertionBegin);
+ ASSERT(term.atom.quantityCount == 1);
+
+ // We've failed to match parens; if they are inverted, this is win!
+ if (term.invert()) {
+ context->term += term.atom.parenthesesWidth;
+ return true;
+ }
+
+ return false;
+ }
+
+ bool backtrackParentheticalAssertionEnd(ByteTerm& term, DisjunctionContext* context)
+ {
+ ASSERT(term.type == ByteTerm::TypeParentheticalAssertionEnd);
+ ASSERT(term.atom.quantityCount == 1);
+
+ BackTrackInfoParentheticalAssertion* backTrack = reinterpret_cast<BackTrackInfoParentheticalAssertion*>(context->frame + term.frameLocation);
+
+ input.setPos(backTrack->begin);
+
+ context->term -= term.atom.parenthesesWidth;
+ return false;
+ }
+
+ JSRegExpResult matchParentheses(ByteTerm& term, DisjunctionContext* context)
+ {
+ ASSERT(term.type == ByteTerm::TypeParenthesesSubpattern);
+
+ BackTrackInfoParentheses* backTrack = reinterpret_cast<BackTrackInfoParentheses*>(context->frame + term.frameLocation);
+ ByteDisjunction* disjunctionBody = term.atom.parenthesesDisjunction;
+
+ backTrack->matchAmount = 0;
+ backTrack->lastContext = 0;
+
+ switch (term.atom.quantityType) {
+ case QuantifierFixedCount: {
+ // While we haven't yet reached our fixed limit,
+ while (backTrack->matchAmount < term.atom.quantityCount) {
+ // Try to do a match, and it it succeeds, add it to the list.
+ ParenthesesDisjunctionContext* context = allocParenthesesDisjunctionContext(disjunctionBody, output, term);
+ JSRegExpResult result = matchDisjunction(disjunctionBody, context->getDisjunctionContext(term));
+ if (result == JSRegExpMatch)
+ appendParenthesesDisjunctionContext(backTrack, context);
+ else {
+ // The match failed; try to find an alternate point to carry on from.
+ resetMatches(term, context);
+ freeParenthesesDisjunctionContext(context);
+
+ if (result == JSRegExpNoMatch) {
+ JSRegExpResult backtrackResult = parenthesesDoBacktrack(term, backTrack);
+ if (backtrackResult != JSRegExpMatch)
+ return backtrackResult;
+ } else
+ return result;
+ }
+ }
+
+ ASSERT(backTrack->matchAmount == term.atom.quantityCount);
+ ParenthesesDisjunctionContext* context = backTrack->lastContext;
+ recordParenthesesMatch(term, context);
+ return JSRegExpMatch;
+ }
+
+ case QuantifierGreedy: {
+ while (backTrack->matchAmount < term.atom.quantityCount) {
+ ParenthesesDisjunctionContext* context = allocParenthesesDisjunctionContext(disjunctionBody, output, term);
+ JSRegExpResult result = matchNonZeroDisjunction(disjunctionBody, context->getDisjunctionContext(term));
+ if (result == JSRegExpMatch)
+ appendParenthesesDisjunctionContext(backTrack, context);
+ else {
+ resetMatches(term, context);
+ freeParenthesesDisjunctionContext(context);
+
+ if (result != JSRegExpNoMatch)
+ return result;
+
+ break;
+ }
+ }
+
+ if (backTrack->matchAmount) {
+ ParenthesesDisjunctionContext* context = backTrack->lastContext;
+ recordParenthesesMatch(term, context);
+ }
+ return JSRegExpMatch;
+ }
+
+ case QuantifierNonGreedy:
+ return JSRegExpMatch;
+ }
+
+ ASSERT_NOT_REACHED();
+ return JSRegExpErrorNoMatch;
+ }
+
+ // Rules for backtracking differ depending on whether this is greedy or non-greedy.
+ //
+ // Greedy matches never should try just adding more - you should already have done
+ // the 'more' cases. Always backtrack, at least a leetle bit. However cases where
+ // you backtrack an item off the list needs checking, since we'll never have matched
+ // the one less case. Tracking forwards, still add as much as possible.
+ //
+ // Non-greedy, we've already done the one less case, so don't match on popping.
+ // We haven't done the one more case, so always try to add that.
+ //
+ JSRegExpResult backtrackParentheses(ByteTerm& term, DisjunctionContext* context)
+ {
+ ASSERT(term.type == ByteTerm::TypeParenthesesSubpattern);
+
+ BackTrackInfoParentheses* backTrack = reinterpret_cast<BackTrackInfoParentheses*>(context->frame + term.frameLocation);
+ ByteDisjunction* disjunctionBody = term.atom.parenthesesDisjunction;
+
+ switch (term.atom.quantityType) {
+ case QuantifierFixedCount: {
+ ASSERT(backTrack->matchAmount == term.atom.quantityCount);
+
+ ParenthesesDisjunctionContext* context = 0;
+ JSRegExpResult result = parenthesesDoBacktrack(term, backTrack);
+
+ if (result != JSRegExpMatch)
+ return result;
+
+ // While we haven't yet reached our fixed limit,
+ while (backTrack->matchAmount < term.atom.quantityCount) {
+ // Try to do a match, and it it succeeds, add it to the list.
+ context = allocParenthesesDisjunctionContext(disjunctionBody, output, term);
+ result = matchDisjunction(disjunctionBody, context->getDisjunctionContext(term));
+
+ if (result == JSRegExpMatch)
+ appendParenthesesDisjunctionContext(backTrack, context);
+ else {
+ // The match failed; try to find an alternate point to carry on from.
+ resetMatches(term, context);
+ freeParenthesesDisjunctionContext(context);
+
+ if (result == JSRegExpNoMatch) {
+ JSRegExpResult backtrackResult = parenthesesDoBacktrack(term, backTrack);
+ if (backtrackResult != JSRegExpMatch)
+ return backtrackResult;
+ } else
+ return result;
+ }
+ }
+
+ ASSERT(backTrack->matchAmount == term.atom.quantityCount);
+ context = backTrack->lastContext;
+ recordParenthesesMatch(term, context);
+ return JSRegExpMatch;
+ }
+
+ case QuantifierGreedy: {
+ if (!backTrack->matchAmount)
+ return JSRegExpNoMatch;
+
+ ParenthesesDisjunctionContext* context = backTrack->lastContext;
+ JSRegExpResult result = matchNonZeroDisjunction(disjunctionBody, context->getDisjunctionContext(term), true);
+ if (result == JSRegExpMatch) {
+ while (backTrack->matchAmount < term.atom.quantityCount) {
+ ParenthesesDisjunctionContext* context = allocParenthesesDisjunctionContext(disjunctionBody, output, term);
+ JSRegExpResult parenthesesResult = matchNonZeroDisjunction(disjunctionBody, context->getDisjunctionContext(term));
+ if (parenthesesResult == JSRegExpMatch)
+ appendParenthesesDisjunctionContext(backTrack, context);
+ else {
+ resetMatches(term, context);
+ freeParenthesesDisjunctionContext(context);
+
+ if (parenthesesResult != JSRegExpNoMatch)
+ return parenthesesResult;
+
+ break;
+ }
+ }
+ } else {
+ resetMatches(term, context);
+ popParenthesesDisjunctionContext(backTrack);
+ freeParenthesesDisjunctionContext(context);
+
+ if (result != JSRegExpNoMatch)
+ return result;
+ }
+
+ if (backTrack->matchAmount) {
+ ParenthesesDisjunctionContext* context = backTrack->lastContext;
+ recordParenthesesMatch(term, context);
+ }
+ return JSRegExpMatch;
+ }
+
+ case QuantifierNonGreedy: {
+ // If we've not reached the limit, try to add one more match.
+ if (backTrack->matchAmount < term.atom.quantityCount) {
+ ParenthesesDisjunctionContext* context = allocParenthesesDisjunctionContext(disjunctionBody, output, term);
+ JSRegExpResult result = matchNonZeroDisjunction(disjunctionBody, context->getDisjunctionContext(term));
+ if (result == JSRegExpMatch) {
+ appendParenthesesDisjunctionContext(backTrack, context);
+ recordParenthesesMatch(term, context);
+ return JSRegExpMatch;
+ }
+
+ resetMatches(term, context);
+ freeParenthesesDisjunctionContext(context);
+
+ if (result != JSRegExpNoMatch)
+ return result;
+ }
+
+ // Nope - okay backtrack looking for an alternative.
+ while (backTrack->matchAmount) {
+ ParenthesesDisjunctionContext* context = backTrack->lastContext;
+ JSRegExpResult result = matchNonZeroDisjunction(disjunctionBody, context->getDisjunctionContext(term), true);
+ if (result == JSRegExpMatch) {
+ // successful backtrack! we're back in the game!
+ if (backTrack->matchAmount) {
+ context = backTrack->lastContext;
+ recordParenthesesMatch(term, context);
+ }
+ return JSRegExpMatch;
+ }
+
+ // pop a match off the stack
+ resetMatches(term, context);
+ popParenthesesDisjunctionContext(backTrack);
+ freeParenthesesDisjunctionContext(context);
+
+ return result;
+ }
+
+ return JSRegExpNoMatch;
+ }
+ }
+
+ ASSERT_NOT_REACHED();
+ return JSRegExpErrorNoMatch;
+ }
+
+ void lookupForBeginChars()
+ {
+ int character;
+ bool firstSingleCharFound;
+
+ while (true) {
+ if (input.isNotAvailableInput(2))
+ return;
+
+ firstSingleCharFound = false;
+
+ character = input.readPair();
+
+ for (unsigned i = 0; i < pattern->m_beginChars.size(); ++i) {
+ BeginChar bc = pattern->m_beginChars[i];
+
+ if (!firstSingleCharFound && bc.value <= 0xFFFF) {
+ firstSingleCharFound = true;
+ character &= 0xFFFF;
+ }
+
+ if ((character | bc.mask) == bc.value)
+ return;
+ }
+
+ input.next();
+ }
+ }
+
+#define MATCH_NEXT() { ++context->term; goto matchAgain; }
+#define BACKTRACK() { --context->term; goto backtrack; }
+#define currentTerm() (disjunction->terms[context->term])
+ JSRegExpResult matchDisjunction(ByteDisjunction* disjunction, DisjunctionContext* context, bool btrack = false, bool isBody = false)
+ {
+ if (!--remainingMatchCount)
+ return JSRegExpErrorHitLimit;
+
+ if (btrack)
+ BACKTRACK();
+
+ if (pattern->m_containsBeginChars && isBody)
+ lookupForBeginChars();
+
+ context->matchBegin = input.getPos();
+ context->term = 0;
+
+ matchAgain:
+ ASSERT(context->term < static_cast<int>(disjunction->terms.size()));
+
+ switch (currentTerm().type) {
+ case ByteTerm::TypeSubpatternBegin:
+ MATCH_NEXT();
+ case ByteTerm::TypeSubpatternEnd:
+ context->matchEnd = input.getPos();
+ return JSRegExpMatch;
+
+ case ByteTerm::TypeBodyAlternativeBegin:
+ MATCH_NEXT();
+ case ByteTerm::TypeBodyAlternativeDisjunction:
+ case ByteTerm::TypeBodyAlternativeEnd:
+ context->matchEnd = input.getPos();
+ return JSRegExpMatch;
+
+ case ByteTerm::TypeAlternativeBegin:
+ MATCH_NEXT();
+ case ByteTerm::TypeAlternativeDisjunction:
+ case ByteTerm::TypeAlternativeEnd: {
+ int offset = currentTerm().alternative.end;
+ BackTrackInfoAlternative* backTrack = reinterpret_cast<BackTrackInfoAlternative*>(context->frame + currentTerm().frameLocation);
+ backTrack->offset = offset;
+ context->term += offset;
+ MATCH_NEXT();
+ }
+
+ case ByteTerm::TypeAssertionBOL:
+ if (matchAssertionBOL(currentTerm()))
+ MATCH_NEXT();
+ BACKTRACK();
+ case ByteTerm::TypeAssertionEOL:
+ if (matchAssertionEOL(currentTerm()))
+ MATCH_NEXT();
+ BACKTRACK();
+ case ByteTerm::TypeAssertionWordBoundary:
+ if (matchAssertionWordBoundary(currentTerm()))
+ MATCH_NEXT();
+ BACKTRACK();
+
+ case ByteTerm::TypePatternCharacterOnce:
+ case ByteTerm::TypePatternCharacterFixed: {
+ for (unsigned matchAmount = 0; matchAmount < currentTerm().atom.quantityCount; ++matchAmount) {
+ if (!checkCharacter(currentTerm().atom.patternCharacter, currentTerm().inputPosition + matchAmount))
+ BACKTRACK();
+ }
+ MATCH_NEXT();
+ }
+ case ByteTerm::TypePatternCharacterGreedy: {
+ BackTrackInfoPatternCharacter* backTrack = reinterpret_cast<BackTrackInfoPatternCharacter*>(context->frame + currentTerm().frameLocation);
+ unsigned matchAmount = 0;
+ while ((matchAmount < currentTerm().atom.quantityCount) && input.checkInput(1)) {
+ if (!checkCharacter(currentTerm().atom.patternCharacter, currentTerm().inputPosition - 1)) {
+ input.uncheckInput(1);
+ break;
+ }
+ ++matchAmount;
+ }
+ backTrack->matchAmount = matchAmount;
+
+ MATCH_NEXT();
+ }
+ case ByteTerm::TypePatternCharacterNonGreedy: {
+ BackTrackInfoPatternCharacter* backTrack = reinterpret_cast<BackTrackInfoPatternCharacter*>(context->frame + currentTerm().frameLocation);
+ backTrack->matchAmount = 0;
+ MATCH_NEXT();
+ }
+
+ case ByteTerm::TypePatternCasedCharacterOnce:
+ case ByteTerm::TypePatternCasedCharacterFixed: {
+ for (unsigned matchAmount = 0; matchAmount < currentTerm().atom.quantityCount; ++matchAmount) {
+ if (!checkCasedCharacter(currentTerm().atom.casedCharacter.lo, currentTerm().atom.casedCharacter.hi, currentTerm().inputPosition + matchAmount))
+ BACKTRACK();
+ }
+ MATCH_NEXT();
+ }
+ case ByteTerm::TypePatternCasedCharacterGreedy: {
+ BackTrackInfoPatternCharacter* backTrack = reinterpret_cast<BackTrackInfoPatternCharacter*>(context->frame + currentTerm().frameLocation);
+ unsigned matchAmount = 0;
+ while ((matchAmount < currentTerm().atom.quantityCount) && input.checkInput(1)) {
+ if (!checkCasedCharacter(currentTerm().atom.casedCharacter.lo, currentTerm().atom.casedCharacter.hi, currentTerm().inputPosition - 1)) {
+ input.uncheckInput(1);
+ break;
+ }
+ ++matchAmount;
+ }
+ backTrack->matchAmount = matchAmount;
+
+ MATCH_NEXT();
+ }
+ case ByteTerm::TypePatternCasedCharacterNonGreedy: {
+ BackTrackInfoPatternCharacter* backTrack = reinterpret_cast<BackTrackInfoPatternCharacter*>(context->frame + currentTerm().frameLocation);
+ backTrack->matchAmount = 0;
+ MATCH_NEXT();
+ }
+
+ case ByteTerm::TypeCharacterClass:
+ if (matchCharacterClass(currentTerm(), context))
+ MATCH_NEXT();
+ BACKTRACK();
+ case ByteTerm::TypeBackReference:
+ if (matchBackReference(currentTerm(), context))
+ MATCH_NEXT();
+ BACKTRACK();
+ case ByteTerm::TypeParenthesesSubpattern: {
+ JSRegExpResult result = matchParentheses(currentTerm(), context);
+
+ if (result == JSRegExpMatch) {
+ MATCH_NEXT();
+ } else if (result != JSRegExpNoMatch)
+ return result;
+
+ BACKTRACK();
+ }
+ case ByteTerm::TypeParenthesesSubpatternOnceBegin:
+ if (matchParenthesesOnceBegin(currentTerm(), context))
+ MATCH_NEXT();
+ BACKTRACK();
+ case ByteTerm::TypeParenthesesSubpatternOnceEnd:
+ if (matchParenthesesOnceEnd(currentTerm(), context))
+ MATCH_NEXT();
+ BACKTRACK();
+ case ByteTerm::TypeParenthesesSubpatternTerminalBegin:
+ if (matchParenthesesTerminalBegin(currentTerm(), context))
+ MATCH_NEXT();
+ BACKTRACK();
+ case ByteTerm::TypeParenthesesSubpatternTerminalEnd:
+ if (matchParenthesesTerminalEnd(currentTerm(), context))
+ MATCH_NEXT();
+ BACKTRACK();
+ case ByteTerm::TypeParentheticalAssertionBegin:
+ if (matchParentheticalAssertionBegin(currentTerm(), context))
+ MATCH_NEXT();
+ BACKTRACK();
+ case ByteTerm::TypeParentheticalAssertionEnd:
+ if (matchParentheticalAssertionEnd(currentTerm(), context))
+ MATCH_NEXT();
+ BACKTRACK();
+
+ case ByteTerm::TypeCheckInput:
+ if (input.checkInput(currentTerm().checkInputCount))
+ MATCH_NEXT();
+ BACKTRACK();
+ }
+
+ // We should never fall-through to here.
+ ASSERT_NOT_REACHED();
+
+ backtrack:
+ ASSERT(context->term < static_cast<int>(disjunction->terms.size()));
+
+ switch (currentTerm().type) {
+ case ByteTerm::TypeSubpatternBegin:
+ return JSRegExpNoMatch;
+ case ByteTerm::TypeSubpatternEnd:
+ ASSERT_NOT_REACHED();
+
+ case ByteTerm::TypeBodyAlternativeBegin:
+ case ByteTerm::TypeBodyAlternativeDisjunction: {
+ int offset = currentTerm().alternative.next;
+ context->term += offset;
+ if (offset > 0)
+ MATCH_NEXT();
+
+ if (input.atEnd())
+ return JSRegExpNoMatch;
+
+ input.next();
+
+ if (pattern->m_containsBeginChars && isBody)
+ lookupForBeginChars();
+
+ context->matchBegin = input.getPos();
+
+ if (currentTerm().alternative.onceThrough)
+ context->term += currentTerm().alternative.next;
+
+ MATCH_NEXT();
+ }
+ case ByteTerm::TypeBodyAlternativeEnd:
+ ASSERT_NOT_REACHED();
+
+ case ByteTerm::TypeAlternativeBegin:
+ case ByteTerm::TypeAlternativeDisjunction: {
+ int offset = currentTerm().alternative.next;
+ context->term += offset;
+ if (offset > 0)
+ MATCH_NEXT();
+ BACKTRACK();
+ }
+ case ByteTerm::TypeAlternativeEnd: {
+ // We should never backtrack back into an alternative of the main body of the regex.
+ BackTrackInfoAlternative* backTrack = reinterpret_cast<BackTrackInfoAlternative*>(context->frame + currentTerm().frameLocation);
+ unsigned offset = backTrack->offset;
+ context->term -= offset;
+ BACKTRACK();
+ }
+
+ case ByteTerm::TypeAssertionBOL:
+ case ByteTerm::TypeAssertionEOL:
+ case ByteTerm::TypeAssertionWordBoundary:
+ BACKTRACK();
+
+ case ByteTerm::TypePatternCharacterOnce:
+ case ByteTerm::TypePatternCharacterFixed:
+ case ByteTerm::TypePatternCharacterGreedy:
+ case ByteTerm::TypePatternCharacterNonGreedy:
+ if (backtrackPatternCharacter(currentTerm(), context))
+ MATCH_NEXT();
+ BACKTRACK();
+ case ByteTerm::TypePatternCasedCharacterOnce:
+ case ByteTerm::TypePatternCasedCharacterFixed:
+ case ByteTerm::TypePatternCasedCharacterGreedy:
+ case ByteTerm::TypePatternCasedCharacterNonGreedy:
+ if (backtrackPatternCasedCharacter(currentTerm(), context))
+ MATCH_NEXT();
+ BACKTRACK();
+ case ByteTerm::TypeCharacterClass:
+ if (backtrackCharacterClass(currentTerm(), context))
+ MATCH_NEXT();
+ BACKTRACK();
+ case ByteTerm::TypeBackReference:
+ if (backtrackBackReference(currentTerm(), context))
+ MATCH_NEXT();
+ BACKTRACK();
+ case ByteTerm::TypeParenthesesSubpattern: {
+ JSRegExpResult result = backtrackParentheses(currentTerm(), context);
+
+ if (result == JSRegExpMatch) {
+ MATCH_NEXT();
+ } else if (result != JSRegExpNoMatch)
+ return result;
+
+ BACKTRACK();
+ }
+ case ByteTerm::TypeParenthesesSubpatternOnceBegin:
+ if (backtrackParenthesesOnceBegin(currentTerm(), context))
+ MATCH_NEXT();
+ BACKTRACK();
+ case ByteTerm::TypeParenthesesSubpatternOnceEnd:
+ if (backtrackParenthesesOnceEnd(currentTerm(), context))
+ MATCH_NEXT();
+ BACKTRACK();
+ case ByteTerm::TypeParenthesesSubpatternTerminalBegin:
+ if (backtrackParenthesesTerminalBegin(currentTerm(), context))
+ MATCH_NEXT();
+ BACKTRACK();
+ case ByteTerm::TypeParenthesesSubpatternTerminalEnd:
+ if (backtrackParenthesesTerminalEnd(currentTerm(), context))
+ MATCH_NEXT();
+ BACKTRACK();
+ case ByteTerm::TypeParentheticalAssertionBegin:
+ if (backtrackParentheticalAssertionBegin(currentTerm(), context))
+ MATCH_NEXT();
+ BACKTRACK();
+ case ByteTerm::TypeParentheticalAssertionEnd:
+ if (backtrackParentheticalAssertionEnd(currentTerm(), context))
+ MATCH_NEXT();
+ BACKTRACK();
+
+ case ByteTerm::TypeCheckInput:
+ input.uncheckInput(currentTerm().checkInputCount);
+ BACKTRACK();
+ }
+
+ ASSERT_NOT_REACHED();
+ return JSRegExpErrorNoMatch;
+ }
+
+ JSRegExpResult matchNonZeroDisjunction(ByteDisjunction* disjunction, DisjunctionContext* context, bool btrack = false)
+ {
+ JSRegExpResult result = matchDisjunction(disjunction, context, btrack);
+
+ if (result == JSRegExpMatch) {
+ while (context->matchBegin == context->matchEnd) {
+ result = matchDisjunction(disjunction, context, true);
+ if (result != JSRegExpMatch)
+ return result;
+ }
+ return JSRegExpMatch;
+ }
+
+ return result;
+ }
+
+ int interpret()
+ {
+ allocatorPool = pattern->m_allocator->startAllocator();
+ if (!allocatorPool)
+ CRASH();
+
+ for (unsigned i = 0; i < ((pattern->m_body->m_numSubpatterns + 1) << 1); ++i)
+ output[i] = -1;
+
+ DisjunctionContext* context = allocDisjunctionContext(pattern->m_body.get());
+
+ JSRegExpResult result = matchDisjunction(pattern->m_body.get(), context, false, true);
+ if (result == JSRegExpMatch) {
+ output[0] = context->matchBegin;
+ output[1] = context->matchEnd;
+ }
+
+ freeDisjunctionContext(context);
+
+ pattern->m_allocator->stopAllocator();
+
+ // RegExp.cpp currently expects all error to be converted to -1.
+ ASSERT((result == JSRegExpMatch) == (output[0] != -1));
+ return output[0];
+ }
+
+ Interpreter(BytecodePattern* pattern, int* output, const UChar* inputChar, unsigned start, unsigned length)
+ : pattern(pattern)
+ , output(output)
+ , input(inputChar, start, length)
+ , allocatorPool(0)
+ , remainingMatchCount(matchLimit)
+ {
+ }
+
+private:
+ BytecodePattern *pattern;
+ int* output;
+ InputStream input;
+ BumpPointerPool* allocatorPool;
+ unsigned remainingMatchCount;
+};
+
+
+
+class ByteCompiler {
+ struct ParenthesesStackEntry {
+ unsigned beginTerm;
+ unsigned savedAlternativeIndex;
+ ParenthesesStackEntry(unsigned beginTerm, unsigned savedAlternativeIndex/*, unsigned subpatternId, bool capture = false*/)
+ : beginTerm(beginTerm)
+ , savedAlternativeIndex(savedAlternativeIndex)
+ {
+ }
+ };
+
+public:
+ ByteCompiler(RegexPattern& pattern)
+ : m_pattern(pattern)
+ {
+ m_currentAlternativeIndex = 0;
+ }
+
+ PassOwnPtr<BytecodePattern> compile(BumpPointerAllocator* allocator)
+ {
+ regexBegin(m_pattern.m_numSubpatterns, m_pattern.m_body->m_callFrameSize, m_pattern.m_body->m_alternatives[0]->onceThrough());
+ emitDisjunction(m_pattern.m_body);
+ regexEnd();
+
+ return adoptPtr(new BytecodePattern(m_bodyDisjunction.release(), m_allParenthesesInfo, m_pattern, allocator));
+ }
+
+ void checkInput(unsigned count)
+ {
+ m_bodyDisjunction->terms.append(ByteTerm::CheckInput(count));
+ }
+
+ void assertionBOL(int inputPosition)
+ {
+ m_bodyDisjunction->terms.append(ByteTerm::BOL(inputPosition));
+ }
+
+ void assertionEOL(int inputPosition)
+ {
+ m_bodyDisjunction->terms.append(ByteTerm::EOL(inputPosition));
+ }
+
+ void assertionWordBoundary(bool invert, int inputPosition)
+ {
+ m_bodyDisjunction->terms.append(ByteTerm::WordBoundary(invert, inputPosition));
+ }
+
+ void atomPatternCharacter(UChar ch, int inputPosition, unsigned frameLocation, unsigned quantityCount, QuantifierType quantityType)
+ {
+ if (m_pattern.m_ignoreCase) {
+ UChar lo = Unicode::toLower(ch);
+ UChar hi = Unicode::toUpper(ch);
+
+ if (lo != hi) {
+ m_bodyDisjunction->terms.append(ByteTerm(lo, hi, inputPosition, frameLocation, quantityCount, quantityType));
+ return;
+ }
+ }
+
+ m_bodyDisjunction->terms.append(ByteTerm(ch, inputPosition, frameLocation, quantityCount, quantityType));
+ }
+
+ void atomCharacterClass(CharacterClass* characterClass, bool invert, int inputPosition, unsigned frameLocation, unsigned quantityCount, QuantifierType quantityType)
+ {
+ m_bodyDisjunction->terms.append(ByteTerm(characterClass, invert, inputPosition));
+
+ m_bodyDisjunction->terms[m_bodyDisjunction->terms.size() - 1].atom.quantityCount = quantityCount;
+ m_bodyDisjunction->terms[m_bodyDisjunction->terms.size() - 1].atom.quantityType = quantityType;
+ m_bodyDisjunction->terms[m_bodyDisjunction->terms.size() - 1].frameLocation = frameLocation;
+ }
+
+ void atomBackReference(unsigned subpatternId, int inputPosition, unsigned frameLocation, unsigned quantityCount, QuantifierType quantityType)
+ {
+ ASSERT(subpatternId);
+
+ m_bodyDisjunction->terms.append(ByteTerm::BackReference(subpatternId, inputPosition));
+
+ m_bodyDisjunction->terms[m_bodyDisjunction->terms.size() - 1].atom.quantityCount = quantityCount;
+ m_bodyDisjunction->terms[m_bodyDisjunction->terms.size() - 1].atom.quantityType = quantityType;
+ m_bodyDisjunction->terms[m_bodyDisjunction->terms.size() - 1].frameLocation = frameLocation;
+ }
+
+ void atomParenthesesOnceBegin(unsigned subpatternId, bool capture, int inputPosition, unsigned frameLocation, unsigned alternativeFrameLocation)
+ {
+ int beginTerm = m_bodyDisjunction->terms.size();
+
+ m_bodyDisjunction->terms.append(ByteTerm(ByteTerm::TypeParenthesesSubpatternOnceBegin, subpatternId, capture, false, inputPosition));
+ m_bodyDisjunction->terms[m_bodyDisjunction->terms.size() - 1].frameLocation = frameLocation;
+ m_bodyDisjunction->terms.append(ByteTerm::AlternativeBegin());
+ m_bodyDisjunction->terms[m_bodyDisjunction->terms.size() - 1].frameLocation = alternativeFrameLocation;
+
+ m_parenthesesStack.append(ParenthesesStackEntry(beginTerm, m_currentAlternativeIndex));
+ m_currentAlternativeIndex = beginTerm + 1;
+ }
+
+ void atomParenthesesTerminalBegin(unsigned subpatternId, bool capture, int inputPosition, unsigned frameLocation, unsigned alternativeFrameLocation)
+ {
+ int beginTerm = m_bodyDisjunction->terms.size();
+
+ m_bodyDisjunction->terms.append(ByteTerm(ByteTerm::TypeParenthesesSubpatternTerminalBegin, subpatternId, capture, false, inputPosition));
+ m_bodyDisjunction->terms[m_bodyDisjunction->terms.size() - 1].frameLocation = frameLocation;
+ m_bodyDisjunction->terms.append(ByteTerm::AlternativeBegin());
+ m_bodyDisjunction->terms[m_bodyDisjunction->terms.size() - 1].frameLocation = alternativeFrameLocation;
+
+ m_parenthesesStack.append(ParenthesesStackEntry(beginTerm, m_currentAlternativeIndex));
+ m_currentAlternativeIndex = beginTerm + 1;
+ }
+
+ void atomParenthesesSubpatternBegin(unsigned subpatternId, bool capture, int inputPosition, unsigned frameLocation, unsigned alternativeFrameLocation)
+ {
+ // Errrk! - this is a little crazy, we initially generate as a TypeParenthesesSubpatternOnceBegin,
+ // then fix this up at the end! - simplifying this should make it much clearer.
+ // https://bugs.webkit.org/show_bug.cgi?id=50136
+
+ int beginTerm = m_bodyDisjunction->terms.size();
+
+ m_bodyDisjunction->terms.append(ByteTerm(ByteTerm::TypeParenthesesSubpatternOnceBegin, subpatternId, capture, false, inputPosition));
+ m_bodyDisjunction->terms[m_bodyDisjunction->terms.size() - 1].frameLocation = frameLocation;
+ m_bodyDisjunction->terms.append(ByteTerm::AlternativeBegin());
+ m_bodyDisjunction->terms[m_bodyDisjunction->terms.size() - 1].frameLocation = alternativeFrameLocation;
+
+ m_parenthesesStack.append(ParenthesesStackEntry(beginTerm, m_currentAlternativeIndex));
+ m_currentAlternativeIndex = beginTerm + 1;
+ }
+
+ void atomParentheticalAssertionBegin(unsigned subpatternId, bool invert, unsigned frameLocation, unsigned alternativeFrameLocation)
+ {
+ int beginTerm = m_bodyDisjunction->terms.size();
+
+ m_bodyDisjunction->terms.append(ByteTerm(ByteTerm::TypeParentheticalAssertionBegin, subpatternId, false, invert, 0));
+ m_bodyDisjunction->terms[m_bodyDisjunction->terms.size() - 1].frameLocation = frameLocation;
+ m_bodyDisjunction->terms.append(ByteTerm::AlternativeBegin());
+ m_bodyDisjunction->terms[m_bodyDisjunction->terms.size() - 1].frameLocation = alternativeFrameLocation;
+
+ m_parenthesesStack.append(ParenthesesStackEntry(beginTerm, m_currentAlternativeIndex));
+ m_currentAlternativeIndex = beginTerm + 1;
+ }
+
+ void atomParentheticalAssertionEnd(int inputPosition, unsigned frameLocation, unsigned quantityCount, QuantifierType quantityType)
+ {
+ unsigned beginTerm = popParenthesesStack();
+ closeAlternative(beginTerm + 1);
+ unsigned endTerm = m_bodyDisjunction->terms.size();
+
+ ASSERT(m_bodyDisjunction->terms[beginTerm].type == ByteTerm::TypeParentheticalAssertionBegin);
+
+ bool invert = m_bodyDisjunction->terms[beginTerm].invert();
+ unsigned subpatternId = m_bodyDisjunction->terms[beginTerm].atom.subpatternId;
+
+ m_bodyDisjunction->terms.append(ByteTerm(ByteTerm::TypeParentheticalAssertionEnd, subpatternId, false, invert, inputPosition));
+ m_bodyDisjunction->terms[beginTerm].atom.parenthesesWidth = endTerm - beginTerm;
+ m_bodyDisjunction->terms[endTerm].atom.parenthesesWidth = endTerm - beginTerm;
+ m_bodyDisjunction->terms[endTerm].frameLocation = frameLocation;
+
+ m_bodyDisjunction->terms[beginTerm].atom.quantityCount = quantityCount;
+ m_bodyDisjunction->terms[beginTerm].atom.quantityType = quantityType;
+ m_bodyDisjunction->terms[endTerm].atom.quantityCount = quantityCount;
+ m_bodyDisjunction->terms[endTerm].atom.quantityType = quantityType;
+ }
+
+ unsigned popParenthesesStack()
+ {
+ ASSERT(m_parenthesesStack.size());
+ int stackEnd = m_parenthesesStack.size() - 1;
+ unsigned beginTerm = m_parenthesesStack[stackEnd].beginTerm;
+ m_currentAlternativeIndex = m_parenthesesStack[stackEnd].savedAlternativeIndex;
+ m_parenthesesStack.shrink(stackEnd);
+
+ ASSERT(beginTerm < m_bodyDisjunction->terms.size());
+ ASSERT(m_currentAlternativeIndex < m_bodyDisjunction->terms.size());
+
+ return beginTerm;
+ }
+
+#ifndef NDEBUG
+ void dumpDisjunction(ByteDisjunction* disjunction)
+ {
+ printf("ByteDisjunction(%p):\n\t", disjunction);
+ for (unsigned i = 0; i < disjunction->terms.size(); ++i)
+ printf("{ %d } ", disjunction->terms[i].type);
+ printf("\n");
+ }
+#endif
+
+ void closeAlternative(int beginTerm)
+ {
+ int origBeginTerm = beginTerm;
+ ASSERT(m_bodyDisjunction->terms[beginTerm].type == ByteTerm::TypeAlternativeBegin);
+ int endIndex = m_bodyDisjunction->terms.size();
+
+ unsigned frameLocation = m_bodyDisjunction->terms[beginTerm].frameLocation;
+
+ if (!m_bodyDisjunction->terms[beginTerm].alternative.next)
+ m_bodyDisjunction->terms.remove(beginTerm);
+ else {
+ while (m_bodyDisjunction->terms[beginTerm].alternative.next) {
+ beginTerm += m_bodyDisjunction->terms[beginTerm].alternative.next;
+ ASSERT(m_bodyDisjunction->terms[beginTerm].type == ByteTerm::TypeAlternativeDisjunction);
+ m_bodyDisjunction->terms[beginTerm].alternative.end = endIndex - beginTerm;
+ m_bodyDisjunction->terms[beginTerm].frameLocation = frameLocation;
+ }
+
+ m_bodyDisjunction->terms[beginTerm].alternative.next = origBeginTerm - beginTerm;
+
+ m_bodyDisjunction->terms.append(ByteTerm::AlternativeEnd());
+ m_bodyDisjunction->terms[endIndex].frameLocation = frameLocation;
+ }
+ }
+
+ void closeBodyAlternative()
+ {
+ int beginTerm = 0;
+ int origBeginTerm = 0;
+ ASSERT(m_bodyDisjunction->terms[beginTerm].type == ByteTerm::TypeBodyAlternativeBegin);
+ int endIndex = m_bodyDisjunction->terms.size();
+
+ unsigned frameLocation = m_bodyDisjunction->terms[beginTerm].frameLocation;
+
+ while (m_bodyDisjunction->terms[beginTerm].alternative.next) {
+ beginTerm += m_bodyDisjunction->terms[beginTerm].alternative.next;
+ ASSERT(m_bodyDisjunction->terms[beginTerm].type == ByteTerm::TypeBodyAlternativeDisjunction);
+ m_bodyDisjunction->terms[beginTerm].alternative.end = endIndex - beginTerm;
+ m_bodyDisjunction->terms[beginTerm].frameLocation = frameLocation;
+ }
+
+ m_bodyDisjunction->terms[beginTerm].alternative.next = origBeginTerm - beginTerm;
+
+ m_bodyDisjunction->terms.append(ByteTerm::BodyAlternativeEnd());
+ m_bodyDisjunction->terms[endIndex].frameLocation = frameLocation;
+ }
+
+ void atomParenthesesSubpatternEnd(unsigned lastSubpatternId, int inputPosition, unsigned frameLocation, unsigned quantityCount, QuantifierType quantityType, unsigned callFrameSize = 0)
+ {
+ unsigned beginTerm = popParenthesesStack();
+ closeAlternative(beginTerm + 1);
+ unsigned endTerm = m_bodyDisjunction->terms.size();
+
+ ASSERT(m_bodyDisjunction->terms[beginTerm].type == ByteTerm::TypeParenthesesSubpatternOnceBegin);
+
+ ByteTerm& parenthesesBegin = m_bodyDisjunction->terms[beginTerm];
+
+ bool capture = parenthesesBegin.capture();
+ unsigned subpatternId = parenthesesBegin.atom.subpatternId;
+
+ unsigned numSubpatterns = lastSubpatternId - subpatternId + 1;
+ ByteDisjunction* parenthesesDisjunction = new ByteDisjunction(numSubpatterns, callFrameSize);
+
+ parenthesesDisjunction->terms.append(ByteTerm::SubpatternBegin());
+ for (unsigned termInParentheses = beginTerm + 1; termInParentheses < endTerm; ++termInParentheses)
+ parenthesesDisjunction->terms.append(m_bodyDisjunction->terms[termInParentheses]);
+ parenthesesDisjunction->terms.append(ByteTerm::SubpatternEnd());
+
+ m_bodyDisjunction->terms.shrink(beginTerm);
+
+ m_allParenthesesInfo.append(parenthesesDisjunction);
+ m_bodyDisjunction->terms.append(ByteTerm(ByteTerm::TypeParenthesesSubpattern, subpatternId, parenthesesDisjunction, capture, inputPosition));
+
+ m_bodyDisjunction->terms[beginTerm].atom.quantityCount = quantityCount;
+ m_bodyDisjunction->terms[beginTerm].atom.quantityType = quantityType;
+ m_bodyDisjunction->terms[beginTerm].frameLocation = frameLocation;
+ }
+
+ void atomParenthesesOnceEnd(int inputPosition, unsigned frameLocation, unsigned quantityCount, QuantifierType quantityType)
+ {
+ unsigned beginTerm = popParenthesesStack();
+ closeAlternative(beginTerm + 1);
+ unsigned endTerm = m_bodyDisjunction->terms.size();
+
+ ASSERT(m_bodyDisjunction->terms[beginTerm].type == ByteTerm::TypeParenthesesSubpatternOnceBegin);
+
+ bool capture = m_bodyDisjunction->terms[beginTerm].capture();
+ unsigned subpatternId = m_bodyDisjunction->terms[beginTerm].atom.subpatternId;
+
+ m_bodyDisjunction->terms.append(ByteTerm(ByteTerm::TypeParenthesesSubpatternOnceEnd, subpatternId, capture, false, inputPosition));
+ m_bodyDisjunction->terms[beginTerm].atom.parenthesesWidth = endTerm - beginTerm;
+ m_bodyDisjunction->terms[endTerm].atom.parenthesesWidth = endTerm - beginTerm;
+ m_bodyDisjunction->terms[endTerm].frameLocation = frameLocation;
+
+ m_bodyDisjunction->terms[beginTerm].atom.quantityCount = quantityCount;
+ m_bodyDisjunction->terms[beginTerm].atom.quantityType = quantityType;
+ m_bodyDisjunction->terms[endTerm].atom.quantityCount = quantityCount;
+ m_bodyDisjunction->terms[endTerm].atom.quantityType = quantityType;
+ }
+
+ void atomParenthesesTerminalEnd(int inputPosition, unsigned frameLocation, unsigned quantityCount, QuantifierType quantityType)
+ {
+ unsigned beginTerm = popParenthesesStack();
+ closeAlternative(beginTerm + 1);
+ unsigned endTerm = m_bodyDisjunction->terms.size();
+
+ ASSERT(m_bodyDisjunction->terms[beginTerm].type == ByteTerm::TypeParenthesesSubpatternTerminalBegin);
+
+ bool capture = m_bodyDisjunction->terms[beginTerm].capture();
+ unsigned subpatternId = m_bodyDisjunction->terms[beginTerm].atom.subpatternId;
+
+ m_bodyDisjunction->terms.append(ByteTerm(ByteTerm::TypeParenthesesSubpatternTerminalEnd, subpatternId, capture, false, inputPosition));
+ m_bodyDisjunction->terms[beginTerm].atom.parenthesesWidth = endTerm - beginTerm;
+ m_bodyDisjunction->terms[endTerm].atom.parenthesesWidth = endTerm - beginTerm;
+ m_bodyDisjunction->terms[endTerm].frameLocation = frameLocation;
+
+ m_bodyDisjunction->terms[beginTerm].atom.quantityCount = quantityCount;
+ m_bodyDisjunction->terms[beginTerm].atom.quantityType = quantityType;
+ m_bodyDisjunction->terms[endTerm].atom.quantityCount = quantityCount;
+ m_bodyDisjunction->terms[endTerm].atom.quantityType = quantityType;
+ }
+
+ void regexBegin(unsigned numSubpatterns, unsigned callFrameSize, bool onceThrough)
+ {
+ m_bodyDisjunction = adoptPtr(new ByteDisjunction(numSubpatterns, callFrameSize));
+ m_bodyDisjunction->terms.append(ByteTerm::BodyAlternativeBegin(onceThrough));
+ m_bodyDisjunction->terms[0].frameLocation = 0;
+ m_currentAlternativeIndex = 0;
+ }
+
+ void regexEnd()
+ {
+ closeBodyAlternative();
+ }
+
+ void alternativeBodyDisjunction(bool onceThrough)
+ {
+ int newAlternativeIndex = m_bodyDisjunction->terms.size();
+ m_bodyDisjunction->terms[m_currentAlternativeIndex].alternative.next = newAlternativeIndex - m_currentAlternativeIndex;
+ m_bodyDisjunction->terms.append(ByteTerm::BodyAlternativeDisjunction(onceThrough));
+
+ m_currentAlternativeIndex = newAlternativeIndex;
+ }
+
+ void alternativeDisjunction()
+ {
+ int newAlternativeIndex = m_bodyDisjunction->terms.size();
+ m_bodyDisjunction->terms[m_currentAlternativeIndex].alternative.next = newAlternativeIndex - m_currentAlternativeIndex;
+ m_bodyDisjunction->terms.append(ByteTerm::AlternativeDisjunction());
+
+ m_currentAlternativeIndex = newAlternativeIndex;
+ }
+
+ void emitDisjunction(PatternDisjunction* disjunction, unsigned inputCountAlreadyChecked = 0, unsigned parenthesesInputCountAlreadyChecked = 0, bool isParentheticalAssertion = false)
+ {
+ for (unsigned alt = 0; alt < disjunction->m_alternatives.size(); ++alt) {
+ unsigned currentCountAlreadyChecked = inputCountAlreadyChecked;
+
+ PatternAlternative* alternative = disjunction->m_alternatives[alt];
+
+ if (alt) {
+ if (disjunction == m_pattern.m_body)
+ alternativeBodyDisjunction(alternative->onceThrough());
+ else
+ alternativeDisjunction();
+ }
+
+ unsigned minimumSize = alternative->m_minimumSize;
+ int countToCheck;
+
+ if (isParentheticalAssertion && parenthesesInputCountAlreadyChecked > minimumSize)
+ countToCheck = 0;
+ else
+ countToCheck = minimumSize - parenthesesInputCountAlreadyChecked;
+
+ ASSERT(countToCheck >= 0);
+ if (countToCheck) {
+ checkInput(countToCheck);
+ currentCountAlreadyChecked += countToCheck;
+ }
+
+ for (unsigned i = 0; i < alternative->m_terms.size(); ++i) {
+ PatternTerm& term = alternative->m_terms[i];
+
+ switch (term.type) {
+ case PatternTerm::TypeAssertionBOL:
+ assertionBOL(term.inputPosition - currentCountAlreadyChecked);
+ break;
+
+ case PatternTerm::TypeAssertionEOL:
+ assertionEOL(term.inputPosition - currentCountAlreadyChecked);
+ break;
+
+ case PatternTerm::TypeAssertionWordBoundary:
+ assertionWordBoundary(term.invert(), term.inputPosition - currentCountAlreadyChecked);
+ break;
+
+ case PatternTerm::TypePatternCharacter:
+ atomPatternCharacter(term.patternCharacter, term.inputPosition - currentCountAlreadyChecked, term.frameLocation, term.quantityCount, term.quantityType);
+ break;
+
+ case PatternTerm::TypeCharacterClass:
+ atomCharacterClass(term.characterClass, term.invert(), term.inputPosition - currentCountAlreadyChecked, term.frameLocation, term.quantityCount, term.quantityType);
+ break;
+
+ case PatternTerm::TypeBackReference:
+ atomBackReference(term.backReferenceSubpatternId, term.inputPosition - currentCountAlreadyChecked, term.frameLocation, term.quantityCount, term.quantityType);
+ break;
+
+ case PatternTerm::TypeForwardReference:
+ break;
+
+ case PatternTerm::TypeParenthesesSubpattern: {
+ unsigned disjunctionAlreadyCheckedCount = 0;
+ if (term.quantityCount == 1 && !term.parentheses.isCopy) {
+ unsigned alternativeFrameLocation = term.frameLocation;
+ // For QuantifierFixedCount we pre-check the minimum size; for greedy/non-greedy we reserve a slot in the frame.
+ if (term.quantityType == QuantifierFixedCount)
+ disjunctionAlreadyCheckedCount = term.parentheses.disjunction->m_minimumSize;
+ else
+ alternativeFrameLocation += RegexStackSpaceForBackTrackInfoParenthesesOnce;
+ unsigned delegateEndInputOffset = term.inputPosition - currentCountAlreadyChecked;
+ atomParenthesesOnceBegin(term.parentheses.subpatternId, term.capture(), delegateEndInputOffset - disjunctionAlreadyCheckedCount, term.frameLocation, alternativeFrameLocation);
+ emitDisjunction(term.parentheses.disjunction, currentCountAlreadyChecked, disjunctionAlreadyCheckedCount);
+ atomParenthesesOnceEnd(delegateEndInputOffset, term.frameLocation, term.quantityCount, term.quantityType);
+ } else if (term.parentheses.isTerminal) {
+ unsigned delegateEndInputOffset = term.inputPosition - currentCountAlreadyChecked;
+ atomParenthesesTerminalBegin(term.parentheses.subpatternId, term.capture(), delegateEndInputOffset - disjunctionAlreadyCheckedCount, term.frameLocation, term.frameLocation + RegexStackSpaceForBackTrackInfoParenthesesOnce);
+ emitDisjunction(term.parentheses.disjunction, currentCountAlreadyChecked, disjunctionAlreadyCheckedCount);
+ atomParenthesesTerminalEnd(delegateEndInputOffset, term.frameLocation, term.quantityCount, term.quantityType);
+ } else {
+ unsigned delegateEndInputOffset = term.inputPosition - currentCountAlreadyChecked;
+ atomParenthesesSubpatternBegin(term.parentheses.subpatternId, term.capture(), delegateEndInputOffset - disjunctionAlreadyCheckedCount, term.frameLocation, 0);
+ emitDisjunction(term.parentheses.disjunction, currentCountAlreadyChecked, 0);
+ atomParenthesesSubpatternEnd(term.parentheses.lastSubpatternId, delegateEndInputOffset, term.frameLocation, term.quantityCount, term.quantityType, term.parentheses.disjunction->m_callFrameSize);
+ }
+ break;
+ }
+
+ case PatternTerm::TypeParentheticalAssertion: {
+ unsigned alternativeFrameLocation = term.frameLocation + RegexStackSpaceForBackTrackInfoParentheticalAssertion;
+
+ ASSERT(currentCountAlreadyChecked >= (unsigned)term.inputPosition);
+ int positiveInputOffset = currentCountAlreadyChecked - term.inputPosition;
+
+ atomParentheticalAssertionBegin(term.parentheses.subpatternId, term.invert(), term.frameLocation, alternativeFrameLocation);
+ emitDisjunction(term.parentheses.disjunction, currentCountAlreadyChecked, positiveInputOffset, true);
+ atomParentheticalAssertionEnd(0, term.frameLocation, term.quantityCount, term.quantityType);
+ break;
+ }
+ }
+ }
+ }
+ }
+
+private:
+ RegexPattern& m_pattern;
+ OwnPtr<ByteDisjunction> m_bodyDisjunction;
+ unsigned m_currentAlternativeIndex;
+ Vector<ParenthesesStackEntry> m_parenthesesStack;
+ Vector<ByteDisjunction*> m_allParenthesesInfo;
+};
+
+PassOwnPtr<BytecodePattern> byteCompileRegex(RegexPattern& pattern, BumpPointerAllocator* allocator)
+{
+ return ByteCompiler(pattern).compile(allocator);
+}
+
+int interpretRegex(BytecodePattern* regex, const UChar* input, unsigned start, unsigned length, int* output)
+{
+ return Interpreter(regex, output, input, start, length).interpret();
+}
+
+
+COMPILE_ASSERT(sizeof(Interpreter::BackTrackInfoPatternCharacter) == (RegexStackSpaceForBackTrackInfoPatternCharacter * sizeof(uintptr_t)), CheckRegexStackSpaceForBackTrackInfoPatternCharacter);
+COMPILE_ASSERT(sizeof(Interpreter::BackTrackInfoCharacterClass) == (RegexStackSpaceForBackTrackInfoCharacterClass * sizeof(uintptr_t)), CheckRegexStackSpaceForBackTrackInfoCharacterClass);
+COMPILE_ASSERT(sizeof(Interpreter::BackTrackInfoBackReference) == (RegexStackSpaceForBackTrackInfoBackReference * sizeof(uintptr_t)), CheckRegexStackSpaceForBackTrackInfoBackReference);
+COMPILE_ASSERT(sizeof(Interpreter::BackTrackInfoAlternative) == (RegexStackSpaceForBackTrackInfoAlternative * sizeof(uintptr_t)), CheckRegexStackSpaceForBackTrackInfoAlternative);
+COMPILE_ASSERT(sizeof(Interpreter::BackTrackInfoParentheticalAssertion) == (RegexStackSpaceForBackTrackInfoParentheticalAssertion * sizeof(uintptr_t)), CheckRegexStackSpaceForBackTrackInfoParentheticalAssertion);
+COMPILE_ASSERT(sizeof(Interpreter::BackTrackInfoParenthesesOnce) == (RegexStackSpaceForBackTrackInfoParenthesesOnce * sizeof(uintptr_t)), CheckRegexStackSpaceForBackTrackInfoParenthesesOnce);
+COMPILE_ASSERT(sizeof(Interpreter::BackTrackInfoParentheses) == (RegexStackSpaceForBackTrackInfoParentheses * sizeof(uintptr_t)), CheckRegexStackSpaceForBackTrackInfoParentheses);
+
+
+} }
diff --git a/Source/JavaScriptCore/yarr/RegexInterpreter.h b/Source/JavaScriptCore/yarr/RegexInterpreter.h
new file mode 100644
index 0000000..0fd8a57
--- /dev/null
+++ b/Source/JavaScriptCore/yarr/RegexInterpreter.h
@@ -0,0 +1,381 @@
+/*
+ * Copyright (C) 2009, 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef RegexInterpreter_h
+#define RegexInterpreter_h
+
+#include "RegexParser.h"
+#include "RegexPattern.h"
+#include <wtf/PassOwnPtr.h>
+#include <wtf/unicode/Unicode.h>
+
+namespace WTF {
+class BumpPointerAllocator;
+}
+using WTF::BumpPointerAllocator;
+
+namespace JSC { namespace Yarr {
+
+// TODO move the matchLimit constant and the JSRegExpResult enum to the JSRegExp.h when pcre is removed.
+
+// The below limit restricts the number of "recursive" match calls in order to
+// avoid spending exponential time on complex regular expressions.
+static const unsigned matchLimit = 1000000;
+
+enum JSRegExpResult {
+ JSRegExpMatch = 1,
+ JSRegExpNoMatch = 0,
+ JSRegExpErrorNoMatch = -1,
+ JSRegExpErrorHitLimit = -2,
+ JSRegExpErrorNoMemory = -3,
+ JSRegExpErrorInternal = -4
+};
+
+class ByteDisjunction;
+
+struct ByteTerm {
+ enum Type {
+ TypeBodyAlternativeBegin,
+ TypeBodyAlternativeDisjunction,
+ TypeBodyAlternativeEnd,
+ TypeAlternativeBegin,
+ TypeAlternativeDisjunction,
+ TypeAlternativeEnd,
+ TypeSubpatternBegin,
+ TypeSubpatternEnd,
+ TypeAssertionBOL,
+ TypeAssertionEOL,
+ TypeAssertionWordBoundary,
+ TypePatternCharacterOnce,
+ TypePatternCharacterFixed,
+ TypePatternCharacterGreedy,
+ TypePatternCharacterNonGreedy,
+ TypePatternCasedCharacterOnce,
+ TypePatternCasedCharacterFixed,
+ TypePatternCasedCharacterGreedy,
+ TypePatternCasedCharacterNonGreedy,
+ TypeCharacterClass,
+ TypeBackReference,
+ TypeParenthesesSubpattern,
+ TypeParenthesesSubpatternOnceBegin,
+ TypeParenthesesSubpatternOnceEnd,
+ TypeParenthesesSubpatternTerminalBegin,
+ TypeParenthesesSubpatternTerminalEnd,
+ TypeParentheticalAssertionBegin,
+ TypeParentheticalAssertionEnd,
+ TypeCheckInput,
+ } type;
+ union {
+ struct {
+ union {
+ UChar patternCharacter;
+ struct {
+ UChar lo;
+ UChar hi;
+ } casedCharacter;
+ CharacterClass* characterClass;
+ unsigned subpatternId;
+ };
+ union {
+ ByteDisjunction* parenthesesDisjunction;
+ unsigned parenthesesWidth;
+ };
+ QuantifierType quantityType;
+ unsigned quantityCount;
+ } atom;
+ struct {
+ int next;
+ int end;
+ bool onceThrough;
+ } alternative;
+ unsigned checkInputCount;
+ };
+ unsigned frameLocation;
+ bool m_capture : 1;
+ bool m_invert : 1;
+ int inputPosition;
+
+ ByteTerm(UChar ch, int inputPos, unsigned frameLocation, unsigned quantityCount, QuantifierType quantityType)
+ : frameLocation(frameLocation)
+ , m_capture(false)
+ , m_invert(false)
+ {
+ switch (quantityType) {
+ case QuantifierFixedCount:
+ type = (quantityCount == 1) ? ByteTerm::TypePatternCharacterOnce : ByteTerm::TypePatternCharacterFixed;
+ break;
+ case QuantifierGreedy:
+ type = ByteTerm::TypePatternCharacterGreedy;
+ break;
+ case QuantifierNonGreedy:
+ type = ByteTerm::TypePatternCharacterNonGreedy;
+ break;
+ }
+
+ atom.patternCharacter = ch;
+ atom.quantityType = quantityType;
+ atom.quantityCount = quantityCount;
+ inputPosition = inputPos;
+ }
+
+ ByteTerm(UChar lo, UChar hi, int inputPos, unsigned frameLocation, unsigned quantityCount, QuantifierType quantityType)
+ : frameLocation(frameLocation)
+ , m_capture(false)
+ , m_invert(false)
+ {
+ switch (quantityType) {
+ case QuantifierFixedCount:
+ type = (quantityCount == 1) ? ByteTerm::TypePatternCasedCharacterOnce : ByteTerm::TypePatternCasedCharacterFixed;
+ break;
+ case QuantifierGreedy:
+ type = ByteTerm::TypePatternCasedCharacterGreedy;
+ break;
+ case QuantifierNonGreedy:
+ type = ByteTerm::TypePatternCasedCharacterNonGreedy;
+ break;
+ }
+
+ atom.casedCharacter.lo = lo;
+ atom.casedCharacter.hi = hi;
+ atom.quantityType = quantityType;
+ atom.quantityCount = quantityCount;
+ inputPosition = inputPos;
+ }
+
+ ByteTerm(CharacterClass* characterClass, bool invert, int inputPos)
+ : type(ByteTerm::TypeCharacterClass)
+ , m_capture(false)
+ , m_invert(invert)
+ {
+ atom.characterClass = characterClass;
+ atom.quantityType = QuantifierFixedCount;
+ atom.quantityCount = 1;
+ inputPosition = inputPos;
+ }
+
+ ByteTerm(Type type, unsigned subpatternId, ByteDisjunction* parenthesesInfo, bool capture, int inputPos)
+ : type(type)
+ , m_capture(capture)
+ , m_invert(false)
+ {
+ atom.subpatternId = subpatternId;
+ atom.parenthesesDisjunction = parenthesesInfo;
+ atom.quantityType = QuantifierFixedCount;
+ atom.quantityCount = 1;
+ inputPosition = inputPos;
+ }
+
+ ByteTerm(Type type, bool invert = false)
+ : type(type)
+ , m_capture(false)
+ , m_invert(invert)
+ {
+ atom.quantityType = QuantifierFixedCount;
+ atom.quantityCount = 1;
+ }
+
+ ByteTerm(Type type, unsigned subpatternId, bool capture, bool invert, int inputPos)
+ : type(type)
+ , m_capture(capture)
+ , m_invert(invert)
+ {
+ atom.subpatternId = subpatternId;
+ atom.quantityType = QuantifierFixedCount;
+ atom.quantityCount = 1;
+ inputPosition = inputPos;
+ }
+
+ static ByteTerm BOL(int inputPos)
+ {
+ ByteTerm term(TypeAssertionBOL);
+ term.inputPosition = inputPos;
+ return term;
+ }
+
+ static ByteTerm CheckInput(unsigned count)
+ {
+ ByteTerm term(TypeCheckInput);
+ term.checkInputCount = count;
+ return term;
+ }
+
+ static ByteTerm EOL(int inputPos)
+ {
+ ByteTerm term(TypeAssertionEOL);
+ term.inputPosition = inputPos;
+ return term;
+ }
+
+ static ByteTerm WordBoundary(bool invert, int inputPos)
+ {
+ ByteTerm term(TypeAssertionWordBoundary, invert);
+ term.inputPosition = inputPos;
+ return term;
+ }
+
+ static ByteTerm BackReference(unsigned subpatternId, int inputPos)
+ {
+ return ByteTerm(TypeBackReference, subpatternId, false, false, inputPos);
+ }
+
+ static ByteTerm BodyAlternativeBegin(bool onceThrough)
+ {
+ ByteTerm term(TypeBodyAlternativeBegin);
+ term.alternative.next = 0;
+ term.alternative.end = 0;
+ term.alternative.onceThrough = onceThrough;
+ return term;
+ }
+
+ static ByteTerm BodyAlternativeDisjunction(bool onceThrough)
+ {
+ ByteTerm term(TypeBodyAlternativeDisjunction);
+ term.alternative.next = 0;
+ term.alternative.end = 0;
+ term.alternative.onceThrough = onceThrough;
+ return term;
+ }
+
+ static ByteTerm BodyAlternativeEnd()
+ {
+ ByteTerm term(TypeBodyAlternativeEnd);
+ term.alternative.next = 0;
+ term.alternative.end = 0;
+ term.alternative.onceThrough = false;
+ return term;
+ }
+
+ static ByteTerm AlternativeBegin()
+ {
+ ByteTerm term(TypeAlternativeBegin);
+ term.alternative.next = 0;
+ term.alternative.end = 0;
+ term.alternative.onceThrough = false;
+ return term;
+ }
+
+ static ByteTerm AlternativeDisjunction()
+ {
+ ByteTerm term(TypeAlternativeDisjunction);
+ term.alternative.next = 0;
+ term.alternative.end = 0;
+ term.alternative.onceThrough = false;
+ return term;
+ }
+
+ static ByteTerm AlternativeEnd()
+ {
+ ByteTerm term(TypeAlternativeEnd);
+ term.alternative.next = 0;
+ term.alternative.end = 0;
+ term.alternative.onceThrough = false;
+ return term;
+ }
+
+ static ByteTerm SubpatternBegin()
+ {
+ return ByteTerm(TypeSubpatternBegin);
+ }
+
+ static ByteTerm SubpatternEnd()
+ {
+ return ByteTerm(TypeSubpatternEnd);
+ }
+
+ bool invert()
+ {
+ return m_invert;
+ }
+
+ bool capture()
+ {
+ return m_capture;
+ }
+};
+
+class ByteDisjunction : public FastAllocBase {
+public:
+ ByteDisjunction(unsigned numSubpatterns, unsigned frameSize)
+ : m_numSubpatterns(numSubpatterns)
+ , m_frameSize(frameSize)
+ {
+ }
+
+ Vector<ByteTerm> terms;
+ unsigned m_numSubpatterns;
+ unsigned m_frameSize;
+};
+
+struct BytecodePattern : FastAllocBase {
+ BytecodePattern(PassOwnPtr<ByteDisjunction> body, Vector<ByteDisjunction*> allParenthesesInfo, RegexPattern& pattern, BumpPointerAllocator* allocator)
+ : m_body(body)
+ , m_ignoreCase(pattern.m_ignoreCase)
+ , m_multiline(pattern.m_multiline)
+ , m_containsBeginChars(pattern.m_containsBeginChars)
+ , m_allocator(allocator)
+ {
+ newlineCharacterClass = pattern.newlineCharacterClass();
+ wordcharCharacterClass = pattern.wordcharCharacterClass();
+
+ m_allParenthesesInfo.append(allParenthesesInfo);
+ m_userCharacterClasses.append(pattern.m_userCharacterClasses);
+ // 'Steal' the RegexPattern's CharacterClasses! We clear its
+ // array, so that it won't delete them on destruction. We'll
+ // take responsibility for that.
+ pattern.m_userCharacterClasses.clear();
+
+ m_beginChars.append(pattern.m_beginChars);
+ }
+
+ ~BytecodePattern()
+ {
+ deleteAllValues(m_allParenthesesInfo);
+ deleteAllValues(m_userCharacterClasses);
+ }
+
+ OwnPtr<ByteDisjunction> m_body;
+ bool m_ignoreCase;
+ bool m_multiline;
+ bool m_containsBeginChars;
+ // Each BytecodePattern is associated with a RegExp, each RegExp is associated
+ // with a JSGlobalData. Cache a pointer to out JSGlobalData's m_regexAllocator.
+ BumpPointerAllocator* m_allocator;
+
+ CharacterClass* newlineCharacterClass;
+ CharacterClass* wordcharCharacterClass;
+
+ Vector<BeginChar> m_beginChars;
+
+private:
+ Vector<ByteDisjunction*> m_allParenthesesInfo;
+ Vector<CharacterClass*> m_userCharacterClasses;
+};
+
+PassOwnPtr<BytecodePattern> byteCompileRegex(RegexPattern& pattern, BumpPointerAllocator*);
+int interpretRegex(BytecodePattern* v_regex, const UChar* input, unsigned start, unsigned length, int* output);
+
+} } // namespace JSC::Yarr
+
+#endif // RegexInterpreter_h
diff --git a/Source/JavaScriptCore/yarr/RegexJIT.cpp b/Source/JavaScriptCore/yarr/RegexJIT.cpp
new file mode 100644
index 0000000..50fe6db
--- /dev/null
+++ b/Source/JavaScriptCore/yarr/RegexJIT.cpp
@@ -0,0 +1,2213 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "RegexJIT.h"
+
+#include "ASCIICType.h"
+#include "JSGlobalData.h"
+#include "LinkBuffer.h"
+#include "MacroAssembler.h"
+#include "RegexParser.h"
+
+#if ENABLE(YARR_JIT)
+
+using namespace WTF;
+
+namespace JSC { namespace Yarr {
+
+class RegexGenerator : private MacroAssembler {
+ friend void jitCompileRegex(JSGlobalData* globalData, RegexCodeBlock& jitObject, const UString& pattern, unsigned& numSubpatterns, const char*& error, bool ignoreCase, bool multiline);
+
+#if CPU(ARM)
+ static const RegisterID input = ARMRegisters::r0;
+ static const RegisterID index = ARMRegisters::r1;
+ static const RegisterID length = ARMRegisters::r2;
+ static const RegisterID output = ARMRegisters::r4;
+
+ static const RegisterID regT0 = ARMRegisters::r5;
+ static const RegisterID regT1 = ARMRegisters::r6;
+
+ static const RegisterID returnRegister = ARMRegisters::r0;
+#elif CPU(MIPS)
+ static const RegisterID input = MIPSRegisters::a0;
+ static const RegisterID index = MIPSRegisters::a1;
+ static const RegisterID length = MIPSRegisters::a2;
+ static const RegisterID output = MIPSRegisters::a3;
+
+ static const RegisterID regT0 = MIPSRegisters::t4;
+ static const RegisterID regT1 = MIPSRegisters::t5;
+
+ static const RegisterID returnRegister = MIPSRegisters::v0;
+#elif CPU(X86)
+ static const RegisterID input = X86Registers::eax;
+ static const RegisterID index = X86Registers::edx;
+ static const RegisterID length = X86Registers::ecx;
+ static const RegisterID output = X86Registers::edi;
+
+ static const RegisterID regT0 = X86Registers::ebx;
+ static const RegisterID regT1 = X86Registers::esi;
+
+ static const RegisterID returnRegister = X86Registers::eax;
+#elif CPU(X86_64)
+ static const RegisterID input = X86Registers::edi;
+ static const RegisterID index = X86Registers::esi;
+ static const RegisterID length = X86Registers::edx;
+ static const RegisterID output = X86Registers::ecx;
+
+ static const RegisterID regT0 = X86Registers::eax;
+ static const RegisterID regT1 = X86Registers::ebx;
+
+ static const RegisterID returnRegister = X86Registers::eax;
+#endif
+
+ void optimizeAlternative(PatternAlternative* alternative)
+ {
+ if (!alternative->m_terms.size())
+ return;
+
+ for (unsigned i = 0; i < alternative->m_terms.size() - 1; ++i) {
+ PatternTerm& term = alternative->m_terms[i];
+ PatternTerm& nextTerm = alternative->m_terms[i + 1];
+
+ if ((term.type == PatternTerm::TypeCharacterClass)
+ && (term.quantityType == QuantifierFixedCount)
+ && (nextTerm.type == PatternTerm::TypePatternCharacter)
+ && (nextTerm.quantityType == QuantifierFixedCount)) {
+ PatternTerm termCopy = term;
+ alternative->m_terms[i] = nextTerm;
+ alternative->m_terms[i + 1] = termCopy;
+ }
+ }
+ }
+
+ void matchCharacterClassRange(RegisterID character, JumpList& failures, JumpList& matchDest, const CharacterRange* ranges, unsigned count, unsigned* matchIndex, const UChar* matches, unsigned matchCount)
+ {
+ do {
+ // pick which range we're going to generate
+ int which = count >> 1;
+ char lo = ranges[which].begin;
+ char hi = ranges[which].end;
+
+ // check if there are any ranges or matches below lo. If not, just jl to failure -
+ // if there is anything else to check, check that first, if it falls through jmp to failure.
+ if ((*matchIndex < matchCount) && (matches[*matchIndex] < lo)) {
+ Jump loOrAbove = branch32(GreaterThanOrEqual, character, Imm32((unsigned short)lo));
+
+ // generate code for all ranges before this one
+ if (which)
+ matchCharacterClassRange(character, failures, matchDest, ranges, which, matchIndex, matches, matchCount);
+
+ while ((*matchIndex < matchCount) && (matches[*matchIndex] < lo)) {
+ matchDest.append(branch32(Equal, character, Imm32((unsigned short)matches[*matchIndex])));
+ ++*matchIndex;
+ }
+ failures.append(jump());
+
+ loOrAbove.link(this);
+ } else if (which) {
+ Jump loOrAbove = branch32(GreaterThanOrEqual, character, Imm32((unsigned short)lo));
+
+ matchCharacterClassRange(character, failures, matchDest, ranges, which, matchIndex, matches, matchCount);
+ failures.append(jump());
+
+ loOrAbove.link(this);
+ } else
+ failures.append(branch32(LessThan, character, Imm32((unsigned short)lo)));
+
+ while ((*matchIndex < matchCount) && (matches[*matchIndex] <= hi))
+ ++*matchIndex;
+
+ matchDest.append(branch32(LessThanOrEqual, character, Imm32((unsigned short)hi)));
+ // fall through to here, the value is above hi.
+
+ // shuffle along & loop around if there are any more matches to handle.
+ unsigned next = which + 1;
+ ranges += next;
+ count -= next;
+ } while (count);
+ }
+
+ void matchCharacterClass(RegisterID character, JumpList& matchDest, const CharacterClass* charClass)
+ {
+ if (charClass->m_table) {
+ ExtendedAddress tableEntry(character, reinterpret_cast<intptr_t>(charClass->m_table->m_table));
+ matchDest.append(branchTest8(charClass->m_table->m_inverted ? Zero : NonZero, tableEntry));
+ return;
+ }
+ Jump unicodeFail;
+ if (charClass->m_matchesUnicode.size() || charClass->m_rangesUnicode.size()) {
+ Jump isAscii = branch32(LessThanOrEqual, character, Imm32(0x7f));
+
+ if (charClass->m_matchesUnicode.size()) {
+ for (unsigned i = 0; i < charClass->m_matchesUnicode.size(); ++i) {
+ UChar ch = charClass->m_matchesUnicode[i];
+ matchDest.append(branch32(Equal, character, Imm32(ch)));
+ }
+ }
+
+ if (charClass->m_rangesUnicode.size()) {
+ for (unsigned i = 0; i < charClass->m_rangesUnicode.size(); ++i) {
+ UChar lo = charClass->m_rangesUnicode[i].begin;
+ UChar hi = charClass->m_rangesUnicode[i].end;
+
+ Jump below = branch32(LessThan, character, Imm32(lo));
+ matchDest.append(branch32(LessThanOrEqual, character, Imm32(hi)));
+ below.link(this);
+ }
+ }
+
+ unicodeFail = jump();
+ isAscii.link(this);
+ }
+
+ if (charClass->m_ranges.size()) {
+ unsigned matchIndex = 0;
+ JumpList failures;
+ matchCharacterClassRange(character, failures, matchDest, charClass->m_ranges.begin(), charClass->m_ranges.size(), &matchIndex, charClass->m_matches.begin(), charClass->m_matches.size());
+ while (matchIndex < charClass->m_matches.size())
+ matchDest.append(branch32(Equal, character, Imm32((unsigned short)charClass->m_matches[matchIndex++])));
+
+ failures.link(this);
+ } else if (charClass->m_matches.size()) {
+ // optimization: gather 'a','A' etc back together, can mask & test once.
+ Vector<char> matchesAZaz;
+
+ for (unsigned i = 0; i < charClass->m_matches.size(); ++i) {
+ char ch = charClass->m_matches[i];
+ if (m_pattern.m_ignoreCase) {
+ if (isASCIILower(ch)) {
+ matchesAZaz.append(ch);
+ continue;
+ }
+ if (isASCIIUpper(ch))
+ continue;
+ }
+ matchDest.append(branch32(Equal, character, Imm32((unsigned short)ch)));
+ }
+
+ if (unsigned countAZaz = matchesAZaz.size()) {
+ or32(Imm32(32), character);
+ for (unsigned i = 0; i < countAZaz; ++i)
+ matchDest.append(branch32(Equal, character, Imm32(matchesAZaz[i])));
+ }
+ }
+
+ if (charClass->m_matchesUnicode.size() || charClass->m_rangesUnicode.size())
+ unicodeFail.link(this);
+ }
+
+ // Jumps if input not available; will have (incorrectly) incremented already!
+ Jump jumpIfNoAvailableInput(unsigned countToCheck)
+ {
+ add32(Imm32(countToCheck), index);
+ return branch32(Above, index, length);
+ }
+
+ Jump jumpIfAvailableInput(unsigned countToCheck)
+ {
+ add32(Imm32(countToCheck), index);
+ return branch32(BelowOrEqual, index, length);
+ }
+
+ Jump checkInput()
+ {
+ return branch32(BelowOrEqual, index, length);
+ }
+
+ Jump atEndOfInput()
+ {
+ return branch32(Equal, index, length);
+ }
+
+ Jump notAtEndOfInput()
+ {
+ return branch32(NotEqual, index, length);
+ }
+
+ Jump jumpIfCharEquals(UChar ch, int inputPosition)
+ {
+ return branch16(Equal, BaseIndex(input, index, TimesTwo, inputPosition * sizeof(UChar)), Imm32(ch));
+ }
+
+ Jump jumpIfCharNotEquals(UChar ch, int inputPosition)
+ {
+ return branch16(NotEqual, BaseIndex(input, index, TimesTwo, inputPosition * sizeof(UChar)), Imm32(ch));
+ }
+
+ void readCharacter(int inputPosition, RegisterID reg)
+ {
+ load16(BaseIndex(input, index, TimesTwo, inputPosition * sizeof(UChar)), reg);
+ }
+
+ void storeToFrame(RegisterID reg, unsigned frameLocation)
+ {
+ poke(reg, frameLocation);
+ }
+
+ void storeToFrame(Imm32 imm, unsigned frameLocation)
+ {
+ poke(imm, frameLocation);
+ }
+
+ DataLabelPtr storeToFrameWithPatch(unsigned frameLocation)
+ {
+ return storePtrWithPatch(ImmPtr(0), Address(stackPointerRegister, frameLocation * sizeof(void*)));
+ }
+
+ void loadFromFrame(unsigned frameLocation, RegisterID reg)
+ {
+ peek(reg, frameLocation);
+ }
+
+ void loadFromFrameAndJump(unsigned frameLocation)
+ {
+ jump(Address(stackPointerRegister, frameLocation * sizeof(void*)));
+ }
+
+ struct IndirectJumpEntry {
+ IndirectJumpEntry(int32_t stackOffset)
+ : m_stackOffset(stackOffset)
+ {
+ }
+
+ IndirectJumpEntry(int32_t stackOffset, Jump jump)
+ : m_stackOffset(stackOffset)
+ {
+ addJump(jump);
+ }
+
+ void addJump(Jump jump)
+ {
+ m_relJumps.append(jump);
+ }
+
+ int32_t m_stackOffset;
+ JumpList m_relJumps;
+ };
+
+ struct AlternativeBacktrackRecord {
+ DataLabelPtr dataLabel;
+ Label backtrackLocation;
+
+ AlternativeBacktrackRecord(DataLabelPtr dataLabel, Label backtrackLocation)
+ : dataLabel(dataLabel)
+ , backtrackLocation(backtrackLocation)
+ {
+ }
+ };
+
+ struct ParenthesesTail;
+ struct TermGenerationState;
+
+ struct GenerationState {
+ typedef HashMap<int, IndirectJumpEntry*, WTF::IntHash<uint32_t>, UnsignedWithZeroKeyHashTraits<uint32_t> > IndirectJumpHashMap;
+
+ GenerationState()
+ : m_parenNestingLevel(0)
+ {
+ }
+
+ void addIndirectJumpEntry(int32_t stackOffset, Jump jump)
+ {
+ IndirectJumpHashMap::iterator result = m_indirectJumpMap.find(stackOffset);
+
+ ASSERT(stackOffset >= 0);
+
+ uint32_t offset = static_cast<uint32_t>(stackOffset);
+
+ if (result == m_indirectJumpMap.end())
+ m_indirectJumpMap.add(offset, new IndirectJumpEntry(stackOffset, jump));
+ else
+ result->second->addJump(jump);
+ }
+
+ void addIndirectJumpEntry(int32_t stackOffset, JumpList jumps)
+ {
+ JumpList::JumpVector jumpVector = jumps.jumps();
+ size_t size = jumpVector.size();
+ for (size_t i = 0; i < size; ++i)
+ addIndirectJumpEntry(stackOffset, jumpVector[i]);
+
+ jumps.empty();
+ }
+
+ void emitIndirectJumpTable(MacroAssembler* masm)
+ {
+ for (IndirectJumpHashMap::iterator iter = m_indirectJumpMap.begin(); iter != m_indirectJumpMap.end(); ++iter) {
+ IndirectJumpEntry* indJumpEntry = iter->second;
+ indJumpEntry->m_relJumps.link(masm);
+ masm->jump(Address(stackPointerRegister, indJumpEntry->m_stackOffset));
+ delete indJumpEntry;
+ }
+ }
+
+ void incrementParenNestingLevel()
+ {
+ ++m_parenNestingLevel;
+ }
+
+ void decrementParenNestingLevel()
+ {
+ --m_parenNestingLevel;
+ }
+
+ ParenthesesTail* addParenthesesTail(PatternTerm& term, ParenthesesTail* nextOuterParenTail)
+ {
+ ParenthesesTail* parenthesesTail = new ParenthesesTail(term, m_parenNestingLevel, nextOuterParenTail);
+ m_parenTails.append(parenthesesTail);
+ m_parenTailsForIteration.append(parenthesesTail);
+
+ return parenthesesTail;
+ }
+
+ void emitParenthesesTail(RegexGenerator* generator)
+ {
+ unsigned vectorSize = m_parenTails.size();
+ bool priorBacktrackFallThrough = false;
+
+ // Emit in reverse order so parentTail N can fall through to N-1
+ for (unsigned index = vectorSize; index > 0; --index) {
+ JumpList jumpsToNext;
+ priorBacktrackFallThrough = m_parenTails[index-1].get()->generateCode(generator, jumpsToNext, priorBacktrackFallThrough, index > 1);
+ if (index > 1)
+ jumpsToNext.linkTo(generator->label(), generator);
+ else
+ addJumpsToNextInteration(jumpsToNext);
+ }
+ m_parenTails.clear();
+ }
+
+ void addJumpToNextInteration(Jump jump)
+ {
+ m_jumpsToNextInteration.append(jump);
+ }
+
+ void addJumpsToNextInteration(JumpList jumps)
+ {
+ m_jumpsToNextInteration.append(jumps);
+ }
+
+ void addDataLabelToNextIteration(DataLabelPtr dataLabel)
+ {
+ m_dataPtrsToNextIteration.append(dataLabel);
+ }
+
+ void linkToNextIteration(Label label)
+ {
+ m_nextIteration = label;
+
+ for (unsigned i = 0; i < m_dataPtrsToNextIteration.size(); ++i)
+ m_backtrackRecords.append(AlternativeBacktrackRecord(m_dataPtrsToNextIteration[i], m_nextIteration));
+
+ m_dataPtrsToNextIteration.clear();
+
+ for (unsigned i = 0; i < m_parenTailsForIteration.size(); ++i)
+ m_parenTailsForIteration[i]->setNextIteration(m_nextIteration);
+
+ m_parenTailsForIteration.clear();
+ }
+
+ void linkToNextIteration(RegexGenerator* generator)
+ {
+ m_jumpsToNextInteration.linkTo(m_nextIteration, generator);
+ }
+
+ int m_parenNestingLevel;
+ Vector<AlternativeBacktrackRecord> m_backtrackRecords;
+ IndirectJumpHashMap m_indirectJumpMap;
+ Label m_nextIteration;
+ Vector<OwnPtr<ParenthesesTail> > m_parenTails;
+ JumpList m_jumpsToNextInteration;
+ Vector<DataLabelPtr> m_dataPtrsToNextIteration;
+ Vector<ParenthesesTail*> m_parenTailsForIteration;
+ };
+
+ struct BacktrackDestination {
+ typedef enum {
+ NoBacktrack,
+ BacktrackLabel,
+ BacktrackStackOffset,
+ BacktrackJumpList,
+ BacktrackLinked
+ } BacktrackType;
+
+ BacktrackDestination()
+ : m_backtrackType(NoBacktrack)
+ , m_backtrackToLabel(0)
+ , m_subDataLabelPtr(0)
+ , m_nextBacktrack(0)
+ , m_backtrackSourceLabel(0)
+ , m_backtrackSourceJumps(0)
+ {
+ }
+
+ BacktrackDestination(int32_t stackOffset)
+ : m_backtrackType(BacktrackStackOffset)
+ , m_backtrackStackOffset(stackOffset)
+ , m_backtrackToLabel(0)
+ , m_subDataLabelPtr(0)
+ , m_nextBacktrack(0)
+ , m_backtrackSourceLabel(0)
+ , m_backtrackSourceJumps(0)
+ {
+ }
+
+ BacktrackDestination(Label label)
+ : m_backtrackType(BacktrackLabel)
+ , m_backtrackLabel(label)
+ , m_backtrackToLabel(0)
+ , m_subDataLabelPtr(0)
+ , m_nextBacktrack(0)
+ , m_backtrackSourceLabel(0)
+ , m_backtrackSourceJumps(0)
+ {
+ }
+
+ void clear(bool doDataLabelClear = true)
+ {
+ m_backtrackType = NoBacktrack;
+ if (doDataLabelClear)
+ clearDataLabel();
+ m_nextBacktrack = 0;
+ }
+
+ void clearDataLabel()
+ {
+ m_dataLabelPtr = DataLabelPtr();
+ }
+
+ bool hasDestination()
+ {
+ return (m_backtrackType != NoBacktrack);
+ }
+
+ bool isStackOffset()
+ {
+ return (m_backtrackType == BacktrackStackOffset);
+ }
+
+ bool isLabel()
+ {
+ return (m_backtrackType == BacktrackLabel);
+ }
+
+ bool isJumpList()
+ {
+ return (m_backtrackType == BacktrackJumpList);
+ }
+
+ bool hasDataLabel()
+ {
+ return m_dataLabelPtr.isSet();
+ }
+
+ void copyTarget(BacktrackDestination& rhs, bool copyDataLabel = true)
+ {
+ m_backtrackType = rhs.m_backtrackType;
+ if (m_backtrackType == BacktrackStackOffset)
+ m_backtrackStackOffset = rhs.m_backtrackStackOffset;
+ else if (m_backtrackType == BacktrackLabel)
+ m_backtrackLabel = rhs.m_backtrackLabel;
+ if (copyDataLabel)
+ m_dataLabelPtr = rhs.m_dataLabelPtr;
+ m_backtrackSourceJumps = rhs.m_backtrackSourceJumps;
+ m_backtrackSourceLabel = rhs.m_backtrackSourceLabel;
+ }
+
+ void copyTo(BacktrackDestination& lhs)
+ {
+ lhs.m_backtrackType = m_backtrackType;
+ if (m_backtrackType == BacktrackStackOffset)
+ lhs.m_backtrackStackOffset = m_backtrackStackOffset;
+ else if (m_backtrackType == BacktrackLabel)
+ lhs.m_backtrackLabel = m_backtrackLabel;
+ lhs.m_backtrackSourceJumps = m_backtrackSourceJumps;
+ lhs.m_backtrackSourceLabel = m_backtrackSourceLabel;
+ lhs.m_dataLabelPtr = m_dataLabelPtr;
+ lhs.m_backTrackJumps = m_backTrackJumps;
+ }
+
+ void addBacktrackJump(Jump jump)
+ {
+ m_backTrackJumps.append(jump);
+ }
+
+ void setStackOffset(int32_t stackOffset)
+ {
+ m_backtrackType = BacktrackStackOffset;
+ m_backtrackStackOffset = stackOffset;
+ }
+
+ void setLabel(Label label)
+ {
+ m_backtrackType = BacktrackLabel;
+ m_backtrackLabel = label;
+ }
+
+ void setNextBacktrackLabel(Label label)
+ {
+ if (m_nextBacktrack)
+ m_nextBacktrack->setLabel(label);
+ }
+
+ void copyBacktrackToLabel(BacktrackDestination& rhs)
+ {
+ if (rhs.m_backtrackToLabel)
+ m_backtrackToLabel = rhs.m_backtrackToLabel;
+ }
+
+ void setBacktrackToLabel(Label* backtrackToLabel)
+ {
+ if (!m_backtrackToLabel)
+ m_backtrackToLabel = backtrackToLabel;
+ }
+
+ void setBacktrackJumpList(JumpList* jumpList)
+ {
+ m_backtrackType = BacktrackJumpList;
+ m_backtrackSourceJumps = jumpList;
+ }
+
+ void setBacktrackSourceLabel(Label* backtrackSourceLabel)
+ {
+ m_backtrackSourceLabel = backtrackSourceLabel;
+ }
+
+ void setDataLabel(DataLabelPtr dp)
+ {
+ if (m_subDataLabelPtr) {
+ *m_subDataLabelPtr = dp;
+ m_subDataLabelPtr = 0;
+ } else
+ m_dataLabelPtr = dp;
+ }
+
+ void setSubDataLabelPtr(DataLabelPtr* subDataLabelPtr)
+ {
+ m_subDataLabelPtr = subDataLabelPtr;
+ }
+
+ void linkToNextBacktrack(BacktrackDestination* nextBacktrack)
+ {
+ m_nextBacktrack = nextBacktrack;
+ }
+
+ int32_t getStackOffset()
+ {
+ ASSERT(m_backtrackType == BacktrackStackOffset);
+ return m_backtrackStackOffset;
+ }
+
+ Label getLabel()
+ {
+ ASSERT(m_backtrackType == BacktrackLabel);
+ return m_backtrackLabel;
+ }
+
+ JumpList& getBacktrackJumps()
+ {
+ return m_backTrackJumps;
+ }
+
+ DataLabelPtr& getDataLabel()
+ {
+ return m_dataLabelPtr;
+ }
+
+ void jumpToBacktrack(MacroAssembler* masm)
+ {
+ if (isJumpList()) {
+ if (m_backtrackSourceLabel && (m_backtrackSourceLabel->isSet()))
+ masm->jump().linkTo(*m_backtrackSourceLabel, masm);
+ else
+ m_backtrackSourceJumps->append(masm->jump());
+ } else if (isStackOffset())
+ masm->jump(Address(stackPointerRegister, m_backtrackStackOffset));
+ else if (isLabel())
+ masm->jump().linkTo(m_backtrackLabel, masm);
+ else
+ m_backTrackJumps.append(masm->jump());
+ }
+
+ void jumpToBacktrack(RegexGenerator* generator, Jump jump)
+ {
+ if (isJumpList()) {
+ if (m_backtrackSourceLabel && (m_backtrackSourceLabel->isSet()))
+ jump.linkTo(*m_backtrackSourceLabel, generator);
+ else
+ m_backtrackSourceJumps->append(jump);
+ } else if (isStackOffset())
+ generator->m_expressionState.addIndirectJumpEntry(getStackOffset(), jump);
+ else if (isLabel())
+ jump.linkTo(getLabel(), generator);
+ else
+ m_backTrackJumps.append(jump);
+ }
+
+ void jumpToBacktrack(RegexGenerator* generator, JumpList& jumps)
+ {
+ if (isJumpList()) {
+ if (m_backtrackSourceLabel && (m_backtrackSourceLabel->isSet()))
+ jumps.linkTo(*m_backtrackSourceLabel, generator);
+ else
+ m_backtrackSourceJumps->append(jumps);
+ } else if (isStackOffset())
+ generator->m_expressionState.addIndirectJumpEntry(getStackOffset(), jumps);
+ else if (isLabel())
+ jumps.linkTo(getLabel(), generator);
+ else
+ m_backTrackJumps.append(jumps);
+ }
+
+ bool linkDataLabelToHereIfExists(RegexGenerator* generator)
+ {
+ if (hasDataLabel()) {
+ generator->m_expressionState.m_backtrackRecords.append(AlternativeBacktrackRecord(getDataLabel(), generator->label()));
+ clearDataLabel();
+ return true;
+ }
+
+ return false;
+ }
+
+ bool plantJumpToBacktrackIfExists(RegexGenerator* generator)
+ {
+ if (isJumpList()) {
+ if (m_backtrackSourceLabel && (m_backtrackSourceLabel->isSet()))
+ generator->jump(*m_backtrackSourceLabel);
+ else
+ m_backtrackSourceJumps->append(generator->jump());
+
+ return true;
+ }
+
+ if (isStackOffset()) {
+ generator->jump(Address(stackPointerRegister, getStackOffset()));
+ return true;
+ }
+
+ if (isLabel()) {
+ generator->jump(getLabel());
+ if (hasDataLabel()) {
+ generator->m_expressionState.m_backtrackRecords.append(AlternativeBacktrackRecord(getDataLabel(), getLabel()));
+ clearDataLabel();
+ }
+ return true;
+ }
+
+ return false;
+ }
+
+ void linkAlternativeBacktracks(RegexGenerator* generator, bool nextIteration = false)
+ {
+ Label hereLabel = generator->label();
+
+ if (m_backtrackToLabel) {
+ *m_backtrackToLabel = hereLabel;
+ m_backtrackToLabel = 0;
+ }
+
+ m_backTrackJumps.link(generator);
+
+ if (nextIteration)
+ generator->m_expressionState.linkToNextIteration(hereLabel);
+
+ if (hasDataLabel()) {
+ generator->m_expressionState.m_backtrackRecords.append(AlternativeBacktrackRecord(getDataLabel(), hereLabel));
+ // data label cleared as a result of the clear() below
+ }
+
+ clear();
+ }
+
+ void linkAlternativeBacktracksTo(RegexGenerator* generator, Label label, bool nextIteration = false)
+ {
+ m_backTrackJumps.linkTo(label, generator);
+
+ if (nextIteration)
+ generator->m_expressionState.linkToNextIteration(label);
+
+ if (hasDataLabel()) {
+ generator->m_expressionState.m_backtrackRecords.append(AlternativeBacktrackRecord(getDataLabel(), label));
+ clearDataLabel();
+ }
+ }
+
+ private:
+ BacktrackType m_backtrackType;
+ int32_t m_backtrackStackOffset;
+ Label m_backtrackLabel;
+ DataLabelPtr m_dataLabelPtr;
+ Label* m_backtrackToLabel;
+ DataLabelPtr* m_subDataLabelPtr;
+ BacktrackDestination* m_nextBacktrack;
+ Label* m_backtrackSourceLabel;
+ JumpList* m_backtrackSourceJumps;
+ JumpList m_backTrackJumps;
+ };
+
+ struct TermGenerationState {
+ TermGenerationState(PatternDisjunction* disjunction, unsigned checkedTotal)
+ : disjunction(disjunction)
+ , checkedTotal(checkedTotal)
+ , m_subParenNum(0)
+ , m_linkedBacktrack(0)
+ , m_parenthesesTail(0)
+ {
+ }
+
+ void resetAlternative()
+ {
+ m_backtrack.clear();
+ alt = 0;
+ }
+ bool alternativeValid()
+ {
+ return alt < disjunction->m_alternatives.size();
+ }
+ void nextAlternative()
+ {
+ ++alt;
+ }
+ PatternAlternative* alternative()
+ {
+ return disjunction->m_alternatives[alt];
+ }
+ bool isLastAlternative()
+ {
+ return (alt + 1) == disjunction->m_alternatives.size();
+ }
+
+ void resetTerm()
+ {
+ ASSERT(alternativeValid());
+ t = 0;
+ m_subParenNum = 0;
+ }
+ bool termValid()
+ {
+ ASSERT(alternativeValid());
+ return t < alternative()->m_terms.size();
+ }
+ void nextTerm()
+ {
+ ASSERT(alternativeValid());
+ ++t;
+ }
+ PatternTerm& term()
+ {
+ ASSERT(alternativeValid());
+ return alternative()->m_terms[t];
+ }
+ bool isLastTerm()
+ {
+ ASSERT(alternativeValid());
+ return (t + 1) == alternative()->m_terms.size();
+ }
+ unsigned getSubParenNum()
+ {
+ return m_subParenNum++;
+ }
+ bool isMainDisjunction()
+ {
+ return !disjunction->m_parent;
+ }
+
+ void setParenthesesTail(ParenthesesTail* parenthesesTail)
+ {
+ m_parenthesesTail = parenthesesTail;
+ }
+
+ ParenthesesTail* getParenthesesTail()
+ {
+ return m_parenthesesTail;
+ }
+
+ PatternTerm& lookaheadTerm()
+ {
+ ASSERT(alternativeValid());
+ ASSERT((t + 1) < alternative()->m_terms.size());
+ return alternative()->m_terms[t + 1];
+ }
+ bool isSinglePatternCharacterLookaheadTerm()
+ {
+ ASSERT(alternativeValid());
+ return ((t + 1) < alternative()->m_terms.size())
+ && (lookaheadTerm().type == PatternTerm::TypePatternCharacter)
+ && (lookaheadTerm().quantityType == QuantifierFixedCount)
+ && (lookaheadTerm().quantityCount == 1);
+ }
+
+ int inputOffset()
+ {
+ return term().inputPosition - checkedTotal;
+ }
+
+ void clearBacktrack()
+ {
+ m_backtrack.clear(false);
+ m_linkedBacktrack = 0;
+ }
+
+ void jumpToBacktrack(MacroAssembler* masm)
+ {
+ m_backtrack.jumpToBacktrack(masm);
+ }
+
+ void jumpToBacktrack(RegexGenerator* generator, Jump jump)
+ {
+ m_backtrack.jumpToBacktrack(generator, jump);
+ }
+
+ void jumpToBacktrack(RegexGenerator* generator, JumpList& jumps)
+ {
+ m_backtrack.jumpToBacktrack(generator, jumps);
+ }
+
+ bool plantJumpToBacktrackIfExists(RegexGenerator* generator)
+ {
+ return m_backtrack.plantJumpToBacktrackIfExists(generator);
+ }
+
+ bool linkDataLabelToBacktrackIfExists(RegexGenerator* generator)
+ {
+ if ((m_backtrack.isLabel()) && (m_backtrack.hasDataLabel())) {
+ generator->m_expressionState.m_backtrackRecords.append(AlternativeBacktrackRecord(m_backtrack.getDataLabel(), m_backtrack.getLabel()));
+ m_backtrack.clearDataLabel();
+ return true;
+ }
+
+ return false;
+ }
+
+ void addBacktrackJump(Jump jump)
+ {
+ m_backtrack.addBacktrackJump(jump);
+ }
+
+ void setBacktrackDataLabel(DataLabelPtr dp)
+ {
+ m_backtrack.setDataLabel(dp);
+ }
+
+ void setBackTrackStackOffset(int32_t stackOffset)
+ {
+ m_backtrack.setStackOffset(stackOffset);
+ }
+
+ void setBacktrackLabel(Label label)
+ {
+ m_backtrack.setLabel(label);
+ }
+
+ void linkAlternativeBacktracks(RegexGenerator* generator, bool nextIteration = false)
+ {
+ m_backtrack.linkAlternativeBacktracks(generator, nextIteration);
+ m_linkedBacktrack = 0;
+ }
+
+ void linkAlternativeBacktracksTo(RegexGenerator* generator, Label label, bool nextIteration = false)
+ {
+ m_backtrack.linkAlternativeBacktracksTo(generator, label, nextIteration);
+ }
+
+ void setBacktrackLink(BacktrackDestination* linkedBacktrack)
+ {
+ m_linkedBacktrack = linkedBacktrack;
+ }
+
+ void chainBacktracks(BacktrackDestination* followonBacktrack)
+ {
+ if (m_linkedBacktrack)
+ m_linkedBacktrack->linkToNextBacktrack(followonBacktrack);
+ }
+
+ void chainBacktrackJumps(JumpList* jumpList)
+ {
+ if (m_linkedBacktrack && !(m_linkedBacktrack->hasDestination()))
+ m_linkedBacktrack->setBacktrackJumpList(jumpList);
+ }
+
+ BacktrackDestination& getBacktrackDestination()
+ {
+ return m_backtrack;
+ }
+
+ void propagateBacktrackingFrom(RegexGenerator* generator, BacktrackDestination& backtrack, bool doJump = true)
+ {
+ if (doJump)
+ m_backtrack.jumpToBacktrack(generator, backtrack.getBacktrackJumps());
+ if (backtrack.hasDestination()) {
+ if (m_backtrack.hasDataLabel())
+ generator->m_expressionState.addDataLabelToNextIteration(m_backtrack.getDataLabel());
+
+ m_backtrack.copyTarget(backtrack, doJump);
+ }
+ }
+
+ PatternDisjunction* disjunction;
+ int checkedTotal;
+ private:
+ unsigned alt;
+ unsigned t;
+ unsigned m_subParenNum;
+ BacktrackDestination m_backtrack;
+ BacktrackDestination* m_linkedBacktrack;
+ ParenthesesTail* m_parenthesesTail;
+
+ };
+
+ struct ParenthesesTail {
+ ParenthesesTail(PatternTerm& term, int nestingLevel, ParenthesesTail* nextOuterParenTail)
+ : m_term(term)
+ , m_nestingLevel(nestingLevel)
+ , m_subParenIndex(0)
+ , m_nextOuterParenTail(nextOuterParenTail)
+ {
+ }
+
+ void processBacktracks(RegexGenerator* generator, TermGenerationState& state, TermGenerationState& parenthesesState, Label nonGreedyTryParentheses, Label fallThrough)
+ {
+ m_nonGreedyTryParentheses = nonGreedyTryParentheses;
+ m_fallThrough = fallThrough;
+
+ m_subParenIndex = state.getSubParenNum();
+ parenthesesState.getBacktrackDestination().copyTo(m_parenBacktrack);
+ state.chainBacktracks(&m_backtrack);
+ BacktrackDestination& stateBacktrack = state.getBacktrackDestination();
+ stateBacktrack.copyTo(m_backtrack);
+ stateBacktrack.setBacktrackToLabel(&m_backtrackToLabel);
+ state.setBacktrackLink(&m_backtrack);
+ stateBacktrack.setSubDataLabelPtr(&m_dataAfterLabelPtr);
+
+ m_doDirectBacktrack = m_parenBacktrack.hasDestination();
+
+ if ((m_term.quantityType == QuantifierGreedy) || (m_term.quantityType == QuantifierNonGreedy))
+ m_doDirectBacktrack = false;
+
+ if (m_doDirectBacktrack)
+ state.propagateBacktrackingFrom(generator, m_parenBacktrack, false);
+ else {
+ stateBacktrack.setBacktrackJumpList(&m_pattBacktrackJumps);
+ stateBacktrack.setBacktrackSourceLabel(&m_backtrackFromAfterParens);
+ }
+
+ parenthesesState.chainBacktrackJumps(&m_pattBacktrackJumps);
+ }
+
+ void setNextIteration(Label nextIteration)
+ {
+ if (!m_nestingLevel && !m_backtrackToLabel.isSet())
+ m_backtrackToLabel = nextIteration;
+ }
+
+ void addAfterParenJump(Jump jump)
+ {
+ m_pattBacktrackJumps.append(jump);
+ }
+
+ bool generateCode(RegexGenerator* generator, JumpList& jumpsToNext, bool priorBackTrackFallThrough, bool nextBacktrackFallThrough)
+ {
+ const RegisterID indexTemporary = regT0;
+ unsigned parenthesesFrameLocation = m_term.frameLocation;
+ Jump fromPriorBacktrack;
+ bool needJumpForPriorParenTail = false;
+
+ if (priorBackTrackFallThrough
+ && ((m_term.quantityType == QuantifierGreedy)
+ || (m_term.quantityType == QuantifierNonGreedy)
+ || (!m_doDirectBacktrack && m_parenBacktrack.hasDestination()))) {
+ // If the prior paren tail code assumed that it could fall through,
+ // but we need to generate after paren backtrack code, then provide
+ // a jump around that code for the prior paren tail code.
+ // A regular expressing like ((xxx)...)? needs this.
+ fromPriorBacktrack = generator->jump();
+ needJumpForPriorParenTail = true;
+ }
+
+ if (!m_backtrack.hasDestination()) {
+ if (m_backtrackToLabel.isSet()) {
+ m_backtrack.setLabel(m_backtrackToLabel);
+ nextBacktrackFallThrough = false;
+ } else if (!m_subParenIndex && m_nextOuterParenTail) {
+ // If we don't have a destination and we are the first term of a nested paren, go
+ // back to the outer paren.
+ // There is an optimization if the next outer paren is the next paren to be emitted.
+ // In that case we really want the else clause.
+ m_backtrack.setBacktrackJumpList(&m_nextOuterParenTail->m_withinBacktrackJumps);
+ nextBacktrackFallThrough = false;
+ } else
+ m_backtrack.setBacktrackJumpList(&jumpsToNext);
+ } else
+ nextBacktrackFallThrough = false;
+
+ // A failure AFTER the parens jumps here - Backtrack to this paren
+ m_backtrackFromAfterParens = generator->label();
+
+ if (m_dataAfterLabelPtr.isSet())
+ generator->m_expressionState.m_backtrackRecords.append(AlternativeBacktrackRecord(m_dataAfterLabelPtr, m_backtrackFromAfterParens));
+
+ m_pattBacktrackJumps.link(generator);
+
+ if (m_term.quantityType == QuantifierGreedy) {
+ // If this is -1 we have now tested with both with and without the parens.
+ generator->loadFromFrame(parenthesesFrameLocation, indexTemporary);
+ m_backtrack.jumpToBacktrack(generator, generator->branch32(Equal, indexTemporary, Imm32(-1)));
+ } else if (m_term.quantityType == QuantifierNonGreedy) {
+ // If this is -1 we have now tested with both with and without the parens.
+ generator->loadFromFrame(parenthesesFrameLocation, indexTemporary);
+ generator->branch32(Equal, indexTemporary, Imm32(-1)).linkTo(m_nonGreedyTryParentheses, generator);
+ }
+
+ if (!m_doDirectBacktrack)
+ m_parenBacktrack.plantJumpToBacktrackIfExists(generator);
+
+ // A failure WITHIN the parens jumps here
+ if (needJumpForPriorParenTail)
+ fromPriorBacktrack.link(generator);
+ m_parenBacktrack.linkAlternativeBacktracks(generator);
+ m_withinBacktrackJumps.link(generator);
+
+ if (m_term.capture())
+ generator->store32(Imm32(-1), Address(output, (m_term.parentheses.subpatternId << 1) * sizeof(int)));
+
+ if (m_term.quantityType == QuantifierGreedy) {
+ generator->storeToFrame(Imm32(-1), parenthesesFrameLocation);
+ generator->jump().linkTo(m_fallThrough, generator);
+ nextBacktrackFallThrough = false;
+ } else if (!nextBacktrackFallThrough)
+ m_backtrack.jumpToBacktrack(generator);
+
+ if (!m_doDirectBacktrack)
+ m_backtrack.setNextBacktrackLabel(m_backtrackFromAfterParens);
+
+ return nextBacktrackFallThrough;
+ }
+
+ PatternTerm& m_term;
+ int m_nestingLevel;
+ unsigned m_subParenIndex;
+ ParenthesesTail* m_nextOuterParenTail;
+ Label m_nonGreedyTryParentheses;
+ Label m_fallThrough;
+ Label m_backtrackToLabel;
+ Label m_backtrackFromAfterParens;
+ DataLabelPtr m_dataAfterLabelPtr;
+ JumpList m_pattBacktrackJumps;
+ JumpList m_withinBacktrackJumps;
+ BacktrackDestination m_parenBacktrack;
+ BacktrackDestination m_backtrack;
+ bool m_doDirectBacktrack;
+ };
+
+ void generateAssertionBOL(TermGenerationState& state)
+ {
+ PatternTerm& term = state.term();
+
+ if (m_pattern.m_multiline) {
+ const RegisterID character = regT0;
+
+ JumpList matchDest;
+ if (!term.inputPosition)
+ matchDest.append(branch32(Equal, index, Imm32(state.checkedTotal)));
+
+ readCharacter(state.inputOffset() - 1, character);
+ matchCharacterClass(character, matchDest, m_pattern.newlineCharacterClass());
+ state.jumpToBacktrack(this);
+
+ matchDest.link(this);
+ } else {
+ // Erk, really should poison out these alternatives early. :-/
+ if (term.inputPosition)
+ state.jumpToBacktrack(this);
+ else
+ state.jumpToBacktrack(this, branch32(NotEqual, index, Imm32(state.checkedTotal)));
+ }
+ }
+
+ void generateAssertionEOL(TermGenerationState& state)
+ {
+ PatternTerm& term = state.term();
+
+ if (m_pattern.m_multiline) {
+ const RegisterID character = regT0;
+
+ JumpList matchDest;
+ if (term.inputPosition == state.checkedTotal)
+ matchDest.append(atEndOfInput());
+
+ readCharacter(state.inputOffset(), character);
+ matchCharacterClass(character, matchDest, m_pattern.newlineCharacterClass());
+ state.jumpToBacktrack(this);
+
+ matchDest.link(this);
+ } else {
+ if (term.inputPosition == state.checkedTotal)
+ state.jumpToBacktrack(this, notAtEndOfInput());
+ // Erk, really should poison out these alternatives early. :-/
+ else
+ state.jumpToBacktrack(this);
+ }
+ }
+
+ // Also falls though on nextIsNotWordChar.
+ void matchAssertionWordchar(TermGenerationState& state, JumpList& nextIsWordChar, JumpList& nextIsNotWordChar)
+ {
+ const RegisterID character = regT0;
+ PatternTerm& term = state.term();
+
+ if (term.inputPosition == state.checkedTotal)
+ nextIsNotWordChar.append(atEndOfInput());
+
+ readCharacter(state.inputOffset(), character);
+ matchCharacterClass(character, nextIsWordChar, m_pattern.wordcharCharacterClass());
+ }
+
+ void generateAssertionWordBoundary(TermGenerationState& state)
+ {
+ const RegisterID character = regT0;
+ PatternTerm& term = state.term();
+
+ Jump atBegin;
+ JumpList matchDest;
+ if (!term.inputPosition)
+ atBegin = branch32(Equal, index, Imm32(state.checkedTotal));
+ readCharacter(state.inputOffset() - 1, character);
+ matchCharacterClass(character, matchDest, m_pattern.wordcharCharacterClass());
+ if (!term.inputPosition)
+ atBegin.link(this);
+
+ // We fall through to here if the last character was not a wordchar.
+ JumpList nonWordCharThenWordChar;
+ JumpList nonWordCharThenNonWordChar;
+ if (term.invert()) {
+ matchAssertionWordchar(state, nonWordCharThenNonWordChar, nonWordCharThenWordChar);
+ nonWordCharThenWordChar.append(jump());
+ } else {
+ matchAssertionWordchar(state, nonWordCharThenWordChar, nonWordCharThenNonWordChar);
+ nonWordCharThenNonWordChar.append(jump());
+ }
+ state.jumpToBacktrack(this, nonWordCharThenNonWordChar);
+
+ // We jump here if the last character was a wordchar.
+ matchDest.link(this);
+ JumpList wordCharThenWordChar;
+ JumpList wordCharThenNonWordChar;
+ if (term.invert()) {
+ matchAssertionWordchar(state, wordCharThenNonWordChar, wordCharThenWordChar);
+ wordCharThenWordChar.append(jump());
+ } else {
+ matchAssertionWordchar(state, wordCharThenWordChar, wordCharThenNonWordChar);
+ // This can fall-though!
+ }
+
+ state.jumpToBacktrack(this, wordCharThenWordChar);
+
+ nonWordCharThenWordChar.link(this);
+ wordCharThenNonWordChar.link(this);
+ }
+
+ void generatePatternCharacterSingle(TermGenerationState& state)
+ {
+ const RegisterID character = regT0;
+ UChar ch = state.term().patternCharacter;
+
+ if (m_pattern.m_ignoreCase && isASCIIAlpha(ch)) {
+ readCharacter(state.inputOffset(), character);
+ or32(Imm32(32), character);
+ state.jumpToBacktrack(this, branch32(NotEqual, character, Imm32(Unicode::toLower(ch))));
+ } else {
+ ASSERT(!m_pattern.m_ignoreCase || (Unicode::toLower(ch) == Unicode::toUpper(ch)));
+ state.jumpToBacktrack(this, jumpIfCharNotEquals(ch, state.inputOffset()));
+ }
+ }
+
+ void generatePatternCharacterPair(TermGenerationState& state)
+ {
+ const RegisterID character = regT0;
+ UChar ch1 = state.term().patternCharacter;
+ UChar ch2 = state.lookaheadTerm().patternCharacter;
+
+ int mask = 0;
+ int chPair = ch1 | (ch2 << 16);
+
+ if (m_pattern.m_ignoreCase) {
+ if (isASCIIAlpha(ch1))
+ mask |= 32;
+ if (isASCIIAlpha(ch2))
+ mask |= 32 << 16;
+ }
+
+ if (mask) {
+ load32WithUnalignedHalfWords(BaseIndex(input, index, TimesTwo, state.inputOffset() * sizeof(UChar)), character);
+ or32(Imm32(mask), character);
+ state.jumpToBacktrack(this, branch32(NotEqual, character, Imm32(chPair | mask)));
+ } else
+ state.jumpToBacktrack(this, branch32WithUnalignedHalfWords(NotEqual, BaseIndex(input, index, TimesTwo, state.inputOffset() * sizeof(UChar)), Imm32(chPair)));
+ }
+
+ void generatePatternCharacterFixed(TermGenerationState& state)
+ {
+ const RegisterID character = regT0;
+ const RegisterID countRegister = regT1;
+ PatternTerm& term = state.term();
+ UChar ch = term.patternCharacter;
+
+ move(index, countRegister);
+ sub32(Imm32(term.quantityCount), countRegister);
+
+ Label loop(this);
+ if (m_pattern.m_ignoreCase && isASCIIAlpha(ch)) {
+ load16(BaseIndex(input, countRegister, TimesTwo, (state.inputOffset() + term.quantityCount) * sizeof(UChar)), character);
+ or32(Imm32(32), character);
+ state.jumpToBacktrack(this, branch32(NotEqual, character, Imm32(Unicode::toLower(ch))));
+ } else {
+ ASSERT(!m_pattern.m_ignoreCase || (Unicode::toLower(ch) == Unicode::toUpper(ch)));
+ state.jumpToBacktrack(this, branch16(NotEqual, BaseIndex(input, countRegister, TimesTwo, (state.inputOffset() + term.quantityCount) * sizeof(UChar)), Imm32(ch)));
+ }
+ add32(Imm32(1), countRegister);
+ branch32(NotEqual, countRegister, index).linkTo(loop, this);
+ }
+
+ void generatePatternCharacterGreedy(TermGenerationState& state)
+ {
+ const RegisterID character = regT0;
+ const RegisterID countRegister = regT1;
+ PatternTerm& term = state.term();
+ UChar ch = term.patternCharacter;
+
+ move(Imm32(0), countRegister);
+
+ JumpList failures;
+ Label loop(this);
+ failures.append(atEndOfInput());
+ if (m_pattern.m_ignoreCase && isASCIIAlpha(ch)) {
+ readCharacter(state.inputOffset(), character);
+ or32(Imm32(32), character);
+ failures.append(branch32(NotEqual, character, Imm32(Unicode::toLower(ch))));
+ } else {
+ ASSERT(!m_pattern.m_ignoreCase || (Unicode::toLower(ch) == Unicode::toUpper(ch)));
+ failures.append(jumpIfCharNotEquals(ch, state.inputOffset()));
+ }
+
+ add32(Imm32(1), countRegister);
+ add32(Imm32(1), index);
+ if (term.quantityCount != quantifyInfinite) {
+ branch32(NotEqual, countRegister, Imm32(term.quantityCount)).linkTo(loop, this);
+ failures.append(jump());
+ } else
+ jump(loop);
+
+ Label backtrackBegin(this);
+ loadFromFrame(term.frameLocation, countRegister);
+ state.jumpToBacktrack(this, branchTest32(Zero, countRegister));
+ sub32(Imm32(1), countRegister);
+ sub32(Imm32(1), index);
+
+ failures.link(this);
+
+ storeToFrame(countRegister, term.frameLocation);
+
+ state.setBacktrackLabel(backtrackBegin);
+ }
+
+ void generatePatternCharacterNonGreedy(TermGenerationState& state)
+ {
+ const RegisterID character = regT0;
+ const RegisterID countRegister = regT1;
+ PatternTerm& term = state.term();
+ UChar ch = term.patternCharacter;
+
+ move(Imm32(0), countRegister);
+
+ Jump firstTimeDoNothing = jump();
+
+ Label hardFail(this);
+ sub32(countRegister, index);
+ state.jumpToBacktrack(this);
+
+ Label backtrackBegin(this);
+ loadFromFrame(term.frameLocation, countRegister);
+
+ atEndOfInput().linkTo(hardFail, this);
+ if (term.quantityCount != quantifyInfinite)
+ branch32(Equal, countRegister, Imm32(term.quantityCount), hardFail);
+ if (m_pattern.m_ignoreCase && isASCIIAlpha(ch)) {
+ readCharacter(state.inputOffset(), character);
+ or32(Imm32(32), character);
+ branch32(NotEqual, character, Imm32(Unicode::toLower(ch))).linkTo(hardFail, this);
+ } else {
+ ASSERT(!m_pattern.m_ignoreCase || (Unicode::toLower(ch) == Unicode::toUpper(ch)));
+ jumpIfCharNotEquals(ch, state.inputOffset()).linkTo(hardFail, this);
+ }
+
+ add32(Imm32(1), countRegister);
+ add32(Imm32(1), index);
+
+ firstTimeDoNothing.link(this);
+ storeToFrame(countRegister, term.frameLocation);
+
+ state.setBacktrackLabel(backtrackBegin);
+ }
+
+ void generateCharacterClassSingle(TermGenerationState& state)
+ {
+ const RegisterID character = regT0;
+ PatternTerm& term = state.term();
+
+ JumpList matchDest;
+ readCharacter(state.inputOffset(), character);
+ matchCharacterClass(character, matchDest, term.characterClass);
+
+ if (term.invert())
+ state.jumpToBacktrack(this, matchDest);
+ else {
+ state.jumpToBacktrack(this);
+ matchDest.link(this);
+ }
+ }
+
+ void generateCharacterClassFixed(TermGenerationState& state)
+ {
+ const RegisterID character = regT0;
+ const RegisterID countRegister = regT1;
+ PatternTerm& term = state.term();
+
+ move(index, countRegister);
+ sub32(Imm32(term.quantityCount), countRegister);
+
+ Label loop(this);
+ JumpList matchDest;
+ load16(BaseIndex(input, countRegister, TimesTwo, (state.inputOffset() + term.quantityCount) * sizeof(UChar)), character);
+ matchCharacterClass(character, matchDest, term.characterClass);
+
+ if (term.invert())
+ state.jumpToBacktrack(this, matchDest);
+ else {
+ state.jumpToBacktrack(this);
+ matchDest.link(this);
+ }
+
+ add32(Imm32(1), countRegister);
+ branch32(NotEqual, countRegister, index).linkTo(loop, this);
+ }
+
+ void generateCharacterClassGreedy(TermGenerationState& state)
+ {
+ const RegisterID character = regT0;
+ const RegisterID countRegister = regT1;
+ PatternTerm& term = state.term();
+
+ move(Imm32(0), countRegister);
+
+ JumpList failures;
+ Label loop(this);
+ failures.append(atEndOfInput());
+
+ if (term.invert()) {
+ readCharacter(state.inputOffset(), character);
+ matchCharacterClass(character, failures, term.characterClass);
+ } else {
+ JumpList matchDest;
+ readCharacter(state.inputOffset(), character);
+ matchCharacterClass(character, matchDest, term.characterClass);
+ failures.append(jump());
+ matchDest.link(this);
+ }
+
+ add32(Imm32(1), countRegister);
+ add32(Imm32(1), index);
+ if (term.quantityCount != quantifyInfinite) {
+ branch32(NotEqual, countRegister, Imm32(term.quantityCount)).linkTo(loop, this);
+ failures.append(jump());
+ } else
+ jump(loop);
+
+ Label backtrackBegin(this);
+ loadFromFrame(term.frameLocation, countRegister);
+ state.jumpToBacktrack(this, branchTest32(Zero, countRegister));
+ sub32(Imm32(1), countRegister);
+ sub32(Imm32(1), index);
+
+ failures.link(this);
+
+ storeToFrame(countRegister, term.frameLocation);
+
+ state.setBacktrackLabel(backtrackBegin);
+ }
+
+ void generateCharacterClassNonGreedy(TermGenerationState& state)
+ {
+ const RegisterID character = regT0;
+ const RegisterID countRegister = regT1;
+ PatternTerm& term = state.term();
+
+ move(Imm32(0), countRegister);
+
+ Jump firstTimeDoNothing = jump();
+
+ Label hardFail(this);
+ sub32(countRegister, index);
+ state.jumpToBacktrack(this);
+
+ Label backtrackBegin(this);
+ loadFromFrame(term.frameLocation, countRegister);
+
+ atEndOfInput().linkTo(hardFail, this);
+ branch32(Equal, countRegister, Imm32(term.quantityCount), hardFail);
+
+ JumpList matchDest;
+ readCharacter(state.inputOffset(), character);
+ matchCharacterClass(character, matchDest, term.characterClass);
+
+ if (term.invert())
+ matchDest.linkTo(hardFail, this);
+ else {
+ jump(hardFail);
+ matchDest.link(this);
+ }
+
+ add32(Imm32(1), countRegister);
+ add32(Imm32(1), index);
+
+ firstTimeDoNothing.link(this);
+ storeToFrame(countRegister, term.frameLocation);
+
+ state.setBacktrackLabel(backtrackBegin);
+ }
+
+ void generateParenthesesDisjunction(PatternTerm& parenthesesTerm, TermGenerationState& state, unsigned alternativeFrameLocation)
+ {
+ ASSERT((parenthesesTerm.type == PatternTerm::TypeParenthesesSubpattern) || (parenthesesTerm.type == PatternTerm::TypeParentheticalAssertion));
+ ASSERT(parenthesesTerm.quantityCount == 1);
+
+ PatternDisjunction* disjunction = parenthesesTerm.parentheses.disjunction;
+ unsigned preCheckedCount = ((parenthesesTerm.quantityType == QuantifierFixedCount) && (parenthesesTerm.type != PatternTerm::TypeParentheticalAssertion)) ? disjunction->m_minimumSize : 0;
+
+ if (disjunction->m_alternatives.size() == 1) {
+ state.resetAlternative();
+ ASSERT(state.alternativeValid());
+ PatternAlternative* alternative = state.alternative();
+ optimizeAlternative(alternative);
+
+ int countToCheck = alternative->m_minimumSize - preCheckedCount;
+ if (countToCheck) {
+ ASSERT((parenthesesTerm.type == PatternTerm::TypeParentheticalAssertion) || (parenthesesTerm.quantityType != QuantifierFixedCount));
+
+ // FIXME: This is quite horrible. The call to 'plantJumpToBacktrackIfExists'
+ // will be forced to always trampoline into here, just to decrement the index.
+ // Ick.
+ Jump skip = jump();
+
+ Label backtrackBegin(this);
+ sub32(Imm32(countToCheck), index);
+ state.addBacktrackJump(jump());
+
+ skip.link(this);
+
+ state.setBacktrackLabel(backtrackBegin);
+
+ state.jumpToBacktrack(this, jumpIfNoAvailableInput(countToCheck));
+ state.checkedTotal += countToCheck;
+ }
+
+ for (state.resetTerm(); state.termValid(); state.nextTerm())
+ generateTerm(state);
+
+ state.checkedTotal -= countToCheck;
+ } else {
+ JumpList successes;
+ bool propogateBacktrack = false;
+
+ for (state.resetAlternative(); state.alternativeValid(); state.nextAlternative()) {
+
+ PatternAlternative* alternative = state.alternative();
+ optimizeAlternative(alternative);
+
+ ASSERT(alternative->m_minimumSize >= preCheckedCount);
+ int countToCheck = alternative->m_minimumSize - preCheckedCount;
+ if (countToCheck) {
+ state.addBacktrackJump(jumpIfNoAvailableInput(countToCheck));
+ state.checkedTotal += countToCheck;
+ }
+
+ for (state.resetTerm(); state.termValid(); state.nextTerm())
+ generateTerm(state);
+
+ // Matched an alternative.
+ DataLabelPtr dataLabel = storeToFrameWithPatch(alternativeFrameLocation);
+
+ if (!state.isLastAlternative() || countToCheck)
+ successes.append(jump());
+
+ // Alternative did not match.
+
+ state.setBacktrackDataLabel(dataLabel);
+
+ // Do we have a backtrack destination?
+ // if so, link the data label to it.
+ state.linkDataLabelToBacktrackIfExists(this);
+
+ if (!state.isLastAlternative() || countToCheck)
+ state.linkAlternativeBacktracks(this);
+
+ if (countToCheck) {
+ sub32(Imm32(countToCheck), index);
+ state.checkedTotal -= countToCheck;
+ } else if (state.isLastAlternative())
+ propogateBacktrack = true;
+ }
+ // We fall through to here when the last alternative fails.
+ // Add a backtrack out of here for the parenthese handling code to link up.
+ if (!propogateBacktrack)
+ state.addBacktrackJump(jump());
+
+ // Save address on stack for the parens code to backtrack to, to retry the
+ // next alternative.
+ state.setBackTrackStackOffset(alternativeFrameLocation * sizeof(void*));
+
+ successes.link(this);
+ }
+ }
+
+ void generateParenthesesSingle(TermGenerationState& state)
+ {
+ const RegisterID indexTemporary = regT0;
+ PatternTerm& term = state.term();
+ PatternDisjunction* disjunction = term.parentheses.disjunction;
+ ASSERT(term.quantityCount == 1);
+
+ unsigned preCheckedCount = (term.quantityType == QuantifierFixedCount) ? disjunction->m_minimumSize : 0;
+
+ unsigned parenthesesFrameLocation = term.frameLocation;
+ unsigned alternativeFrameLocation = parenthesesFrameLocation;
+ if (term.quantityType != QuantifierFixedCount)
+ alternativeFrameLocation += RegexStackSpaceForBackTrackInfoParenthesesOnce;
+
+ // optimized case - no capture & no quantifier can be handled in a light-weight manner.
+ if (!term.capture() && (term.quantityType == QuantifierFixedCount)) {
+ m_expressionState.incrementParenNestingLevel();
+
+ TermGenerationState parenthesesState(disjunction, state.checkedTotal);
+ generateParenthesesDisjunction(state.term(), parenthesesState, alternativeFrameLocation);
+ // this expects that any backtracks back out of the parentheses will be in the
+ // parenthesesState's m_backTrackJumps vector, and that if they need backtracking
+ // they will have set an entry point on the parenthesesState's m_backtrackLabel.
+ BacktrackDestination& parenthesesBacktrack = parenthesesState.getBacktrackDestination();
+ state.propagateBacktrackingFrom(this, parenthesesBacktrack);
+ state.getBacktrackDestination().copyBacktrackToLabel(parenthesesBacktrack);
+
+ m_expressionState.decrementParenNestingLevel();
+ } else {
+ Jump nonGreedySkipParentheses;
+ Label nonGreedyTryParentheses;
+ if (term.quantityType == QuantifierGreedy)
+ storeToFrame(index, parenthesesFrameLocation);
+ else if (term.quantityType == QuantifierNonGreedy) {
+ storeToFrame(Imm32(-1), parenthesesFrameLocation);
+ nonGreedySkipParentheses = jump();
+ nonGreedyTryParentheses = label();
+ storeToFrame(index, parenthesesFrameLocation);
+ }
+
+ // store the match start index
+ if (term.capture()) {
+ int inputOffset = state.inputOffset() - preCheckedCount;
+ if (inputOffset) {
+ move(index, indexTemporary);
+ add32(Imm32(inputOffset), indexTemporary);
+ store32(indexTemporary, Address(output, (term.parentheses.subpatternId << 1) * sizeof(int)));
+ } else
+ store32(index, Address(output, (term.parentheses.subpatternId << 1) * sizeof(int)));
+ }
+
+ ParenthesesTail* parenthesesTail = m_expressionState.addParenthesesTail(term, state.getParenthesesTail());
+
+ m_expressionState.incrementParenNestingLevel();
+
+ TermGenerationState parenthesesState(disjunction, state.checkedTotal);
+
+ // Save the parenthesesTail for backtracking from nested parens to this one.
+ parenthesesState.setParenthesesTail(parenthesesTail);
+
+ // generate the body of the parentheses
+ generateParenthesesDisjunction(state.term(), parenthesesState, alternativeFrameLocation);
+
+ // For non-fixed counts, backtrack if we didn't match anything.
+ if (term.quantityType != QuantifierFixedCount)
+ parenthesesTail->addAfterParenJump(branch32(Equal, index, Address(stackPointerRegister, (parenthesesFrameLocation * sizeof(void*)))));
+
+ // store the match end index
+ if (term.capture()) {
+ int inputOffset = state.inputOffset();
+ if (inputOffset) {
+ move(index, indexTemporary);
+ add32(Imm32(state.inputOffset()), indexTemporary);
+ store32(indexTemporary, Address(output, ((term.parentheses.subpatternId << 1) + 1) * sizeof(int)));
+ } else
+ store32(index, Address(output, ((term.parentheses.subpatternId << 1) + 1) * sizeof(int)));
+ }
+
+ m_expressionState.decrementParenNestingLevel();
+
+ parenthesesTail->processBacktracks(this, state, parenthesesState, nonGreedyTryParentheses, label());
+
+ parenthesesState.getBacktrackDestination().clear();
+
+ if (term.quantityType == QuantifierNonGreedy)
+ nonGreedySkipParentheses.link(this);
+ }
+ }
+
+ void generateParenthesesGreedyNoBacktrack(TermGenerationState& state)
+ {
+ PatternTerm& parenthesesTerm = state.term();
+ PatternDisjunction* disjunction = parenthesesTerm.parentheses.disjunction;
+ ASSERT(parenthesesTerm.type == PatternTerm::TypeParenthesesSubpattern);
+ ASSERT(parenthesesTerm.quantityCount != 1); // Handled by generateParenthesesSingle.
+
+ TermGenerationState parenthesesState(disjunction, state.checkedTotal);
+
+ Label matchAgain(this);
+
+ storeToFrame(index, parenthesesTerm.frameLocation); // Save the current index to check for zero len matches later.
+
+ for (parenthesesState.resetAlternative(); parenthesesState.alternativeValid(); parenthesesState.nextAlternative()) {
+
+ PatternAlternative* alternative = parenthesesState.alternative();
+ optimizeAlternative(alternative);
+
+ int countToCheck = alternative->m_minimumSize;
+ if (countToCheck) {
+ parenthesesState.addBacktrackJump(jumpIfNoAvailableInput(countToCheck));
+ parenthesesState.checkedTotal += countToCheck;
+ }
+
+ for (parenthesesState.resetTerm(); parenthesesState.termValid(); parenthesesState.nextTerm())
+ generateTerm(parenthesesState);
+
+ // If we get here, we matched! If the index advanced then try to match more since limit isn't supported yet.
+ branch32(NotEqual, index, Address(stackPointerRegister, (parenthesesTerm.frameLocation * sizeof(void*))), matchAgain);
+
+ // If we get here we matched, but we matched "" - cannot accept this alternative as is, so either backtrack,
+ // or fall through to try the next alternative if no backtrack is available.
+ parenthesesState.plantJumpToBacktrackIfExists(this);
+
+ parenthesesState.linkAlternativeBacktracks(this);
+
+ // We get here if the alternative fails to match - fall through to the next iteration, or out of the loop.
+
+ if (countToCheck) {
+ sub32(Imm32(countToCheck), index);
+ parenthesesState.checkedTotal -= countToCheck;
+ }
+ }
+
+ // If the last alternative falls through to here, we have a failed match...
+ // Which means that we match whatever we have matched up to this point (even if nothing).
+ }
+
+ void generateParentheticalAssertion(TermGenerationState& state)
+ {
+ PatternTerm& term = state.term();
+ PatternDisjunction* disjunction = term.parentheses.disjunction;
+ ASSERT(term.quantityCount == 1);
+ ASSERT(term.quantityType == QuantifierFixedCount);
+
+ unsigned parenthesesFrameLocation = term.frameLocation;
+ unsigned alternativeFrameLocation = parenthesesFrameLocation + RegexStackSpaceForBackTrackInfoParentheticalAssertion;
+
+ int countCheckedAfterAssertion = state.checkedTotal - term.inputPosition;
+
+ if (term.invert()) {
+ // Inverted case
+ storeToFrame(index, parenthesesFrameLocation);
+
+ state.checkedTotal -= countCheckedAfterAssertion;
+ if (countCheckedAfterAssertion)
+ sub32(Imm32(countCheckedAfterAssertion), index);
+
+ TermGenerationState parenthesesState(disjunction, state.checkedTotal);
+ generateParenthesesDisjunction(state.term(), parenthesesState, alternativeFrameLocation);
+ // Success! - which means - Fail!
+ loadFromFrame(parenthesesFrameLocation, index);
+ state.jumpToBacktrack(this);
+
+ // And fail means success.
+ parenthesesState.linkAlternativeBacktracks(this);
+
+ loadFromFrame(parenthesesFrameLocation, index);
+
+ state.checkedTotal += countCheckedAfterAssertion;
+ } else {
+ // Normal case
+ storeToFrame(index, parenthesesFrameLocation);
+
+ state.checkedTotal -= countCheckedAfterAssertion;
+ if (countCheckedAfterAssertion)
+ sub32(Imm32(countCheckedAfterAssertion), index);
+
+ TermGenerationState parenthesesState(disjunction, state.checkedTotal);
+ generateParenthesesDisjunction(state.term(), parenthesesState, alternativeFrameLocation);
+ // Success! - which means - Success!
+ loadFromFrame(parenthesesFrameLocation, index);
+ Jump success = jump();
+
+ parenthesesState.linkAlternativeBacktracks(this);
+
+ loadFromFrame(parenthesesFrameLocation, index);
+ state.jumpToBacktrack(this);
+
+ success.link(this);
+
+ state.checkedTotal += countCheckedAfterAssertion;
+ }
+ }
+
+ void generateTerm(TermGenerationState& state)
+ {
+ PatternTerm& term = state.term();
+
+ switch (term.type) {
+ case PatternTerm::TypeAssertionBOL:
+ generateAssertionBOL(state);
+ break;
+
+ case PatternTerm::TypeAssertionEOL:
+ generateAssertionEOL(state);
+ break;
+
+ case PatternTerm::TypeAssertionWordBoundary:
+ generateAssertionWordBoundary(state);
+ break;
+
+ case PatternTerm::TypePatternCharacter:
+ switch (term.quantityType) {
+ case QuantifierFixedCount:
+ if (term.quantityCount == 1) {
+ if (state.isSinglePatternCharacterLookaheadTerm() && (state.lookaheadTerm().inputPosition == (term.inputPosition + 1))) {
+ generatePatternCharacterPair(state);
+ state.nextTerm();
+ } else
+ generatePatternCharacterSingle(state);
+ } else
+ generatePatternCharacterFixed(state);
+ break;
+ case QuantifierGreedy:
+ generatePatternCharacterGreedy(state);
+ break;
+ case QuantifierNonGreedy:
+ generatePatternCharacterNonGreedy(state);
+ break;
+ }
+ break;
+
+ case PatternTerm::TypeCharacterClass:
+ switch (term.quantityType) {
+ case QuantifierFixedCount:
+ if (term.quantityCount == 1)
+ generateCharacterClassSingle(state);
+ else
+ generateCharacterClassFixed(state);
+ break;
+ case QuantifierGreedy:
+ generateCharacterClassGreedy(state);
+ break;
+ case QuantifierNonGreedy:
+ generateCharacterClassNonGreedy(state);
+ break;
+ }
+ break;
+
+ case PatternTerm::TypeBackReference:
+ m_shouldFallBack = true;
+ break;
+
+ case PatternTerm::TypeForwardReference:
+ break;
+
+ case PatternTerm::TypeParenthesesSubpattern:
+ if (term.quantityCount == 1 && !term.parentheses.isCopy)
+ generateParenthesesSingle(state);
+ else if (term.parentheses.isTerminal)
+ generateParenthesesGreedyNoBacktrack(state);
+ else
+ m_shouldFallBack = true;
+ break;
+
+ case PatternTerm::TypeParentheticalAssertion:
+ generateParentheticalAssertion(state);
+ break;
+ }
+ }
+
+ void generateDisjunction(PatternDisjunction* disjunction)
+ {
+ TermGenerationState state(disjunction, 0);
+ state.resetAlternative();
+
+ // check availability for the next alternative
+ int countCheckedForCurrentAlternative = 0;
+ int countToCheckForFirstAlternative = 0;
+ bool hasShorterAlternatives = false;
+ bool setRepeatAlternativeLabels = false;
+ JumpList notEnoughInputForPreviousAlternative;
+ Label firstAlternative;
+ Label firstAlternativeInputChecked;
+
+ // The label 'firstAlternative' is used to plant a check to see if there is
+ // sufficient input available to run the first repeating alternative.
+ // The label 'firstAlternativeInputChecked' will jump directly to matching
+ // the first repeating alternative having skipped this check.
+
+ if (state.alternativeValid()) {
+ PatternAlternative* alternative = state.alternative();
+ if (!alternative->onceThrough()) {
+ firstAlternative = Label(this);
+ setRepeatAlternativeLabels = true;
+ }
+ countToCheckForFirstAlternative = alternative->m_minimumSize;
+ state.checkedTotal += countToCheckForFirstAlternative;
+ if (countToCheckForFirstAlternative)
+ notEnoughInputForPreviousAlternative.append(jumpIfNoAvailableInput(countToCheckForFirstAlternative));
+ countCheckedForCurrentAlternative = countToCheckForFirstAlternative;
+ }
+
+ if (setRepeatAlternativeLabels)
+ firstAlternativeInputChecked = Label(this);
+
+ while (state.alternativeValid()) {
+ PatternAlternative* alternative = state.alternative();
+ optimizeAlternative(alternative);
+
+ // Track whether any alternatives are shorter than the first one.
+ if (!alternative->onceThrough())
+ hasShorterAlternatives = hasShorterAlternatives || (countCheckedForCurrentAlternative < countToCheckForFirstAlternative);
+
+ for (state.resetTerm(); state.termValid(); state.nextTerm())
+ generateTerm(state);
+
+ // If we get here, the alternative matched.
+ if (m_pattern.m_body->m_callFrameSize)
+ addPtr(Imm32(m_pattern.m_body->m_callFrameSize * sizeof(void*)), stackPointerRegister);
+
+ ASSERT(index != returnRegister);
+ if (m_pattern.m_body->m_hasFixedSize) {
+ move(index, returnRegister);
+ if (alternative->m_minimumSize)
+ sub32(Imm32(alternative->m_minimumSize), returnRegister);
+
+ store32(returnRegister, output);
+ } else
+ load32(Address(output), returnRegister);
+
+ store32(index, Address(output, 4));
+
+ generateReturn();
+
+ state.nextAlternative();
+ if (alternative->onceThrough() && state.alternativeValid())
+ state.clearBacktrack();
+
+ // if there are any more alternatives, plant the check for input before looping.
+ if (state.alternativeValid()) {
+ PatternAlternative* nextAlternative = state.alternative();
+ if (!setRepeatAlternativeLabels && !nextAlternative->onceThrough()) {
+ // We have handled non-repeating alternatives, jump to next iteration
+ // and loop over repeating alternatives.
+ state.jumpToBacktrack(this);
+
+ countToCheckForFirstAlternative = nextAlternative->m_minimumSize;
+
+ // If we get here, there the last input checked failed.
+ notEnoughInputForPreviousAlternative.link(this);
+
+ state.linkAlternativeBacktracks(this);
+
+ // Back up to start the looping alternatives.
+ if (countCheckedForCurrentAlternative)
+ sub32(Imm32(countCheckedForCurrentAlternative), index);
+
+ firstAlternative = Label(this);
+
+ state.checkedTotal = countToCheckForFirstAlternative;
+ if (countToCheckForFirstAlternative)
+ notEnoughInputForPreviousAlternative.append(jumpIfNoAvailableInput(countToCheckForFirstAlternative));
+
+ countCheckedForCurrentAlternative = countToCheckForFirstAlternative;
+
+ firstAlternativeInputChecked = Label(this);
+
+ setRepeatAlternativeLabels = true;
+ } else {
+ int countToCheckForNextAlternative = nextAlternative->m_minimumSize;
+
+ if (countCheckedForCurrentAlternative > countToCheckForNextAlternative) { // CASE 1: current alternative was longer than the next one.
+ // If we get here, then the last input checked failed.
+ notEnoughInputForPreviousAlternative.link(this);
+
+ // Check if sufficent input available to run the next alternative
+ notEnoughInputForPreviousAlternative.append(jumpIfNoAvailableInput(countToCheckForNextAlternative - countCheckedForCurrentAlternative));
+ // We are now in the correct state to enter the next alternative; this add is only required
+ // to mirror and revert operation of the sub32, just below.
+ add32(Imm32(countCheckedForCurrentAlternative - countToCheckForNextAlternative), index);
+
+ // If we get here, then the last input checked passed.
+ state.linkAlternativeBacktracks(this);
+
+ // No need to check if we can run the next alternative, since it is shorter -
+ // just update index.
+ sub32(Imm32(countCheckedForCurrentAlternative - countToCheckForNextAlternative), index);
+ } else if (countCheckedForCurrentAlternative < countToCheckForNextAlternative) { // CASE 2: next alternative is longer than the current one.
+ // If we get here, then the last input checked failed.
+ // If there is insufficient input to run the current alternative, and the next alternative is longer,
+ // then there is definitely not enough input to run it - don't even check. Just adjust index, as if
+ // we had checked.
+ notEnoughInputForPreviousAlternative.link(this);
+ add32(Imm32(countToCheckForNextAlternative - countCheckedForCurrentAlternative), index);
+ notEnoughInputForPreviousAlternative.append(jump());
+
+ // The next alternative is longer than the current one; check the difference.
+ state.linkAlternativeBacktracks(this);
+
+ notEnoughInputForPreviousAlternative.append(jumpIfNoAvailableInput(countToCheckForNextAlternative - countCheckedForCurrentAlternative));
+ } else { // CASE 3: Both alternatives are the same length.
+ ASSERT(countCheckedForCurrentAlternative == countToCheckForNextAlternative);
+
+ // If the next alterative is the same length as this one, then no need to check the input -
+ // if there was sufficent input to run the current alternative then there is sufficient
+ // input to run the next one; if not, there isn't.
+ state.linkAlternativeBacktracks(this);
+ }
+ state.checkedTotal -= countCheckedForCurrentAlternative;
+ countCheckedForCurrentAlternative = countToCheckForNextAlternative;
+ state.checkedTotal += countCheckedForCurrentAlternative;
+ }
+ }
+ }
+
+ // If we get here, all Alternatives failed...
+
+ state.checkedTotal -= countCheckedForCurrentAlternative;
+
+ if (!setRepeatAlternativeLabels) {
+ // If there are no alternatives that need repeating (all are marked 'onceThrough') then just link
+ // the match failures to this point, and fall through to the return below.
+ state.linkAlternativeBacktracks(this, true);
+
+ notEnoughInputForPreviousAlternative.link(this);
+ } else {
+ // How much more input need there be to be able to retry from the first alternative?
+ // examples:
+ // /yarr_jit/ or /wrec|pcre/
+ // In these examples we need check for one more input before looping.
+ // /yarr_jit|pcre/
+ // In this case we need check for 5 more input to loop (+4 to allow for the first alterative
+ // being four longer than the last alternative checked, and another +1 to effectively move
+ // the start position along by one).
+ // /yarr|rules/ or /wrec|notsomuch/
+ // In these examples, provided that there was sufficient input to have just been matching for
+ // the second alternative we can loop without checking for available input (since the second
+ // alternative is longer than the first). In the latter example we need to decrement index
+ // (by 4) so the start position is only progressed by 1 from the last iteration.
+ int incrementForNextIter = (countToCheckForFirstAlternative - countCheckedForCurrentAlternative) + 1;
+
+ // First, deal with the cases where there was sufficient input to try the last alternative.
+ if (incrementForNextIter > 0) // We need to check for more input anyway, fall through to the checking below.
+ state.linkAlternativeBacktracks(this, true);
+ else if (m_pattern.m_body->m_hasFixedSize && !incrementForNextIter) // No need to update anything, link these backtracks straight to the to pof the loop!
+ state.linkAlternativeBacktracksTo(this, firstAlternativeInputChecked, true);
+ else { // no need to check the input, but we do have some bookkeeping to do first.
+ state.linkAlternativeBacktracks(this, true);
+
+ // Where necessary update our preserved start position.
+ if (!m_pattern.m_body->m_hasFixedSize) {
+ move(index, regT0);
+ sub32(Imm32(countCheckedForCurrentAlternative - 1), regT0);
+ store32(regT0, Address(output));
+ }
+
+ // Update index if necessary, and loop (without checking).
+ if (incrementForNextIter)
+ add32(Imm32(incrementForNextIter), index);
+ jump().linkTo(firstAlternativeInputChecked, this);
+ }
+
+ notEnoughInputForPreviousAlternative.link(this);
+ // Update our idea of the start position, if we're tracking this.
+ if (!m_pattern.m_body->m_hasFixedSize) {
+ if (countCheckedForCurrentAlternative - 1) {
+ move(index, regT0);
+ sub32(Imm32(countCheckedForCurrentAlternative - 1), regT0);
+ store32(regT0, Address(output));
+ } else
+ store32(index, Address(output));
+ }
+
+ // Check if there is sufficent input to run the first alternative again.
+ jumpIfAvailableInput(incrementForNextIter).linkTo(firstAlternativeInputChecked, this);
+ // No - insufficent input to run the first alteranative, are there any other alternatives we
+ // might need to check? If so, the last check will have left the index incremented by
+ // (countToCheckForFirstAlternative + 1), so we need test whether countToCheckForFirstAlternative
+ // LESS input is available, to have the effect of just progressing the start position by 1
+ // from the last iteration. If this check passes we can just jump up to the check associated
+ // with the first alternative in the loop. This is a bit sad, since we'll end up trying the
+ // first alternative again, and this check will fail (otherwise the check planted just above
+ // here would have passed). This is a bit sad, however it saves trying to do something more
+ // complex here in compilation, and in the common case we should end up coallescing the checks.
+ //
+ // FIXME: a nice improvement here may be to stop trying to match sooner, based on the least
+ // of the minimum-alternative-lengths. E.g. if I have two alternatives of length 200 and 150,
+ // and a string of length 100, we'll end up looping index from 0 to 100, checking whether there
+ // is sufficient input to run either alternative (constantly failing). If there had been only
+ // one alternative, or if the shorter alternative had come first, we would have terminated
+ // immediately. :-/
+ if (hasShorterAlternatives)
+ jumpIfAvailableInput(-countToCheckForFirstAlternative).linkTo(firstAlternative, this);
+ // index will now be a bit garbled (depending on whether 'hasShorterAlternatives' is true,
+ // it has either been incremented by 1 or by (countToCheckForFirstAlternative + 1) ...
+ // but since we're about to return a failure this doesn't really matter!)
+ }
+
+ if (m_pattern.m_body->m_callFrameSize)
+ addPtr(Imm32(m_pattern.m_body->m_callFrameSize * sizeof(void*)), stackPointerRegister);
+
+ move(Imm32(-1), returnRegister);
+
+ generateReturn();
+
+ m_expressionState.emitParenthesesTail(this);
+ m_expressionState.emitIndirectJumpTable(this);
+ m_expressionState.linkToNextIteration(this);
+ }
+
+ void generateEnter()
+ {
+#if CPU(X86_64)
+ push(X86Registers::ebp);
+ move(stackPointerRegister, X86Registers::ebp);
+ push(X86Registers::ebx);
+#elif CPU(X86)
+ push(X86Registers::ebp);
+ move(stackPointerRegister, X86Registers::ebp);
+ // TODO: do we need spill registers to fill the output pointer if there are no sub captures?
+ push(X86Registers::ebx);
+ push(X86Registers::edi);
+ push(X86Registers::esi);
+ // load output into edi (2 = saved ebp + return address).
+ #if COMPILER(MSVC)
+ loadPtr(Address(X86Registers::ebp, 2 * sizeof(void*)), input);
+ loadPtr(Address(X86Registers::ebp, 3 * sizeof(void*)), index);
+ loadPtr(Address(X86Registers::ebp, 4 * sizeof(void*)), length);
+ loadPtr(Address(X86Registers::ebp, 5 * sizeof(void*)), output);
+ #else
+ loadPtr(Address(X86Registers::ebp, 2 * sizeof(void*)), output);
+ #endif
+#elif CPU(ARM)
+ push(ARMRegisters::r4);
+ push(ARMRegisters::r5);
+ push(ARMRegisters::r6);
+#if CPU(ARM_TRADITIONAL)
+ push(ARMRegisters::r8); // scratch register
+#endif
+ move(ARMRegisters::r3, output);
+#elif CPU(MIPS)
+ // Do nothing.
+#endif
+ }
+
+ void generateReturn()
+ {
+#if CPU(X86_64)
+ pop(X86Registers::ebx);
+ pop(X86Registers::ebp);
+#elif CPU(X86)
+ pop(X86Registers::esi);
+ pop(X86Registers::edi);
+ pop(X86Registers::ebx);
+ pop(X86Registers::ebp);
+#elif CPU(ARM)
+#if CPU(ARM_TRADITIONAL)
+ pop(ARMRegisters::r8); // scratch register
+#endif
+ pop(ARMRegisters::r6);
+ pop(ARMRegisters::r5);
+ pop(ARMRegisters::r4);
+#elif CPU(MIPS)
+ // Do nothing
+#endif
+ ret();
+ }
+
+public:
+ RegexGenerator(RegexPattern& pattern)
+ : m_pattern(pattern)
+ , m_shouldFallBack(false)
+ {
+ }
+
+ void generate()
+ {
+ generateEnter();
+
+ if (!m_pattern.m_body->m_hasFixedSize)
+ store32(index, Address(output));
+
+ if (m_pattern.m_body->m_callFrameSize)
+ subPtr(Imm32(m_pattern.m_body->m_callFrameSize * sizeof(void*)), stackPointerRegister);
+
+ generateDisjunction(m_pattern.m_body);
+ }
+
+ void compile(JSGlobalData* globalData, RegexCodeBlock& jitObject)
+ {
+ generate();
+
+ LinkBuffer patchBuffer(this, globalData->regexAllocator.poolForSize(size()), 0);
+
+ for (unsigned i = 0; i < m_expressionState.m_backtrackRecords.size(); ++i)
+ patchBuffer.patch(m_expressionState.m_backtrackRecords[i].dataLabel, patchBuffer.locationOf(m_expressionState.m_backtrackRecords[i].backtrackLocation));
+
+ jitObject.set(patchBuffer.finalizeCode());
+ jitObject.setFallBack(m_shouldFallBack);
+ }
+
+private:
+ RegexPattern& m_pattern;
+ bool m_shouldFallBack;
+ GenerationState m_expressionState;
+};
+
+void jitCompileRegex(RegexPattern& pattern, JSGlobalData* globalData, RegexCodeBlock& jitObject)
+{
+ RegexGenerator generator(pattern);
+ generator.compile(globalData, jitObject);
+}
+
+
+}}
+
+#endif
diff --git a/Source/JavaScriptCore/yarr/RegexJIT.h b/Source/JavaScriptCore/yarr/RegexJIT.h
new file mode 100644
index 0000000..5e3dca1
--- /dev/null
+++ b/Source/JavaScriptCore/yarr/RegexJIT.h
@@ -0,0 +1,90 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef RegexJIT_h
+#define RegexJIT_h
+
+#if ENABLE(YARR_JIT)
+
+#include "MacroAssembler.h"
+#include "RegexPattern.h"
+#include "UString.h"
+
+#if CPU(X86) && !COMPILER(MSVC)
+#define YARR_CALL __attribute__ ((regparm (3)))
+#else
+#define YARR_CALL
+#endif
+
+namespace JSC {
+
+class JSGlobalData;
+class ExecutablePool;
+
+namespace Yarr {
+
+class RegexCodeBlock {
+ typedef int (*RegexJITCode)(const UChar* input, unsigned start, unsigned length, int* output) YARR_CALL;
+
+public:
+ RegexCodeBlock()
+ : m_needFallBack(false)
+ {
+ }
+
+ ~RegexCodeBlock()
+ {
+ }
+
+ void setFallBack(bool fallback) { m_needFallBack = fallback; }
+ bool isFallBack() { return m_needFallBack; }
+ void set(MacroAssembler::CodeRef ref) { m_ref = ref; }
+
+ int execute(const UChar* input, unsigned start, unsigned length, int* output)
+ {
+ return reinterpret_cast<RegexJITCode>(m_ref.m_code.executableAddress())(input, start, length, output);
+ }
+
+#if ENABLE(REGEXP_TRACING)
+ void *getAddr() { return m_ref.m_code.executableAddress(); }
+#endif
+
+private:
+ MacroAssembler::CodeRef m_ref;
+ bool m_needFallBack;
+};
+
+void jitCompileRegex(RegexPattern& pattern, JSGlobalData* globalData, RegexCodeBlock& jitObject);
+
+inline int executeRegex(RegexCodeBlock& jitObject, const UChar* input, unsigned start, unsigned length, int* output)
+{
+ return jitObject.execute(input, start, length, output);
+}
+
+} } // namespace JSC::Yarr
+
+#endif
+
+#endif // RegexJIT_h
diff --git a/Source/JavaScriptCore/yarr/RegexParser.h b/Source/JavaScriptCore/yarr/RegexParser.h
new file mode 100644
index 0000000..ec5f589
--- /dev/null
+++ b/Source/JavaScriptCore/yarr/RegexParser.h
@@ -0,0 +1,887 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef RegexParser_h
+#define RegexParser_h
+
+#include "UString.h"
+#include <limits.h>
+#include <wtf/ASCIICType.h>
+#include <wtf/unicode/Unicode.h>
+
+namespace JSC { namespace Yarr {
+
+static const unsigned quantifyInfinite = UINT_MAX;
+
+enum BuiltInCharacterClassID {
+ DigitClassID,
+ SpaceClassID,
+ WordClassID,
+ NewlineClassID,
+};
+
+// The Parser class should not be used directly - only via the Yarr::parse() method.
+template<class Delegate>
+class Parser {
+private:
+ template<class FriendDelegate>
+ friend const char* parse(FriendDelegate& delegate, const UString& pattern, unsigned backReferenceLimit);
+
+ enum ErrorCode {
+ NoError,
+ PatternTooLarge,
+ QuantifierOutOfOrder,
+ QuantifierWithoutAtom,
+ MissingParentheses,
+ ParenthesesUnmatched,
+ ParenthesesTypeInvalid,
+ CharacterClassUnmatched,
+ CharacterClassOutOfOrder,
+ EscapeUnterminated,
+ NumberOfErrorCodes
+ };
+
+ /*
+ * CharacterClassParserDelegate:
+ *
+ * The class CharacterClassParserDelegate is used in the parsing of character
+ * classes. This class handles detection of character ranges. This class
+ * implements enough of the delegate interface such that it can be passed to
+ * parseEscape() as an EscapeDelegate. This allows parseEscape() to be reused
+ * to perform the parsing of escape characters in character sets.
+ */
+ class CharacterClassParserDelegate {
+ public:
+ CharacterClassParserDelegate(Delegate& delegate, ErrorCode& err)
+ : m_delegate(delegate)
+ , m_err(err)
+ , m_state(Empty)
+ {
+ }
+
+ /*
+ * begin():
+ *
+ * Called at beginning of construction.
+ */
+ void begin(bool invert)
+ {
+ m_delegate.atomCharacterClassBegin(invert);
+ }
+
+ /*
+ * atomPatternCharacter():
+ *
+ * This method is called either from parseCharacterClass() (for an unescaped
+ * character in a character class), or from parseEscape(). In the former case
+ * the value true will be passed for the argument 'hyphenIsRange', and in this
+ * mode we will allow a hypen to be treated as indicating a range (i.e. /[a-z]/
+ * is different to /[a\-z]/).
+ */
+ void atomPatternCharacter(UChar ch, bool hyphenIsRange = false)
+ {
+ switch (m_state) {
+ case AfterCharacterClass:
+ // Following a builtin character class we need look out for a hyphen.
+ // We're looking for invalid ranges, such as /[\d-x]/ or /[\d-\d]/.
+ // If we see a hyphen following a charater class then unlike usual
+ // we'll report it to the delegate immediately, and put ourself into
+ // a poisoned state. Any following calls to add another character or
+ // character class will result in an error. (A hypen following a
+ // character-class is itself valid, but only at the end of a regex).
+ if (hyphenIsRange && ch == '-') {
+ m_delegate.atomCharacterClassAtom('-');
+ m_state = AfterCharacterClassHyphen;
+ return;
+ }
+ // Otherwise just fall through - cached character so treat this as Empty.
+
+ case Empty:
+ m_character = ch;
+ m_state = CachedCharacter;
+ return;
+
+ case CachedCharacter:
+ if (hyphenIsRange && ch == '-')
+ m_state = CachedCharacterHyphen;
+ else {
+ m_delegate.atomCharacterClassAtom(m_character);
+ m_character = ch;
+ }
+ return;
+
+ case CachedCharacterHyphen:
+ if (ch < m_character) {
+ m_err = CharacterClassOutOfOrder;
+ return;
+ }
+ m_delegate.atomCharacterClassRange(m_character, ch);
+ m_state = Empty;
+ return;
+
+ // See coment in atomBuiltInCharacterClass below.
+ // This too is technically an error, per ECMA-262, and again we
+ // we chose to allow this. Note a subtlely here that while we
+ // diverge from the spec's definition of CharacterRange we do
+ // remain in compliance with the grammar. For example, consider
+ // the expression /[\d-a-z]/. We comply with the grammar in
+ // this case by not allowing a-z to be matched as a range.
+ case AfterCharacterClassHyphen:
+ m_delegate.atomCharacterClassAtom(ch);
+ m_state = Empty;
+ return;
+ }
+ }
+
+ /*
+ * atomBuiltInCharacterClass():
+ *
+ * Adds a built-in character class, called by parseEscape().
+ */
+ void atomBuiltInCharacterClass(BuiltInCharacterClassID classID, bool invert)
+ {
+ switch (m_state) {
+ case CachedCharacter:
+ // Flush the currently cached character, then fall through.
+ m_delegate.atomCharacterClassAtom(m_character);
+
+ case Empty:
+ case AfterCharacterClass:
+ m_state = AfterCharacterClass;
+ m_delegate.atomCharacterClassBuiltIn(classID, invert);
+ return;
+
+ // If we hit either of these cases, we have an invalid range that
+ // looks something like /[x-\d]/ or /[\d-\d]/.
+ // According to ECMA-262 this should be a syntax error, but
+ // empirical testing shows this to break teh webz. Instead we
+ // comply with to the ECMA-262 grammar, and assume the grammar to
+ // have matched the range correctly, but tweak our interpretation
+ // of CharacterRange. Effectively we implicitly handle the hyphen
+ // as if it were escaped, e.g. /[\w-_]/ is treated as /[\w\-_]/.
+ case CachedCharacterHyphen:
+ m_delegate.atomCharacterClassAtom(m_character);
+ m_delegate.atomCharacterClassAtom('-');
+ // fall through
+ case AfterCharacterClassHyphen:
+ m_delegate.atomCharacterClassBuiltIn(classID, invert);
+ m_state = Empty;
+ return;
+ }
+ }
+
+ /*
+ * end():
+ *
+ * Called at end of construction.
+ */
+ void end()
+ {
+ if (m_state == CachedCharacter)
+ m_delegate.atomCharacterClassAtom(m_character);
+ else if (m_state == CachedCharacterHyphen) {
+ m_delegate.atomCharacterClassAtom(m_character);
+ m_delegate.atomCharacterClassAtom('-');
+ }
+ m_delegate.atomCharacterClassEnd();
+ }
+
+ // parseEscape() should never call these delegate methods when
+ // invoked with inCharacterClass set.
+ void assertionWordBoundary(bool) { ASSERT_NOT_REACHED(); }
+ void atomBackReference(unsigned) { ASSERT_NOT_REACHED(); }
+
+ private:
+ Delegate& m_delegate;
+ ErrorCode& m_err;
+ enum CharacterClassConstructionState {
+ Empty,
+ CachedCharacter,
+ CachedCharacterHyphen,
+ AfterCharacterClass,
+ AfterCharacterClassHyphen,
+ } m_state;
+ UChar m_character;
+ };
+
+ Parser(Delegate& delegate, const UString& pattern, unsigned backReferenceLimit)
+ : m_delegate(delegate)
+ , m_backReferenceLimit(backReferenceLimit)
+ , m_err(NoError)
+ , m_data(pattern.characters())
+ , m_size(pattern.length())
+ , m_index(0)
+ , m_parenthesesNestingDepth(0)
+ {
+ }
+
+ /*
+ * parseEscape():
+ *
+ * Helper for parseTokens() AND parseCharacterClass().
+ * Unlike the other parser methods, this function does not report tokens
+ * directly to the member delegate (m_delegate), instead tokens are
+ * emitted to the delegate provided as an argument. In the case of atom
+ * escapes, parseTokens() will call parseEscape() passing m_delegate as
+ * an argument, and as such the escape will be reported to the delegate.
+ *
+ * However this method may also be used by parseCharacterClass(), in which
+ * case a CharacterClassParserDelegate will be passed as the delegate that
+ * tokens should be added to. A boolean flag is also provided to indicate
+ * whether that an escape in a CharacterClass is being parsed (some parsing
+ * rules change in this context).
+ *
+ * The boolean value returned by this method indicates whether the token
+ * parsed was an atom (outside of a characted class \b and \B will be
+ * interpreted as assertions).
+ */
+ template<bool inCharacterClass, class EscapeDelegate>
+ bool parseEscape(EscapeDelegate& delegate)
+ {
+ ASSERT(!m_err);
+ ASSERT(peek() == '\\');
+ consume();
+
+ if (atEndOfPattern()) {
+ m_err = EscapeUnterminated;
+ return false;
+ }
+
+ switch (peek()) {
+ // Assertions
+ case 'b':
+ consume();
+ if (inCharacterClass)
+ delegate.atomPatternCharacter('\b');
+ else {
+ delegate.assertionWordBoundary(false);
+ return false;
+ }
+ break;
+ case 'B':
+ consume();
+ if (inCharacterClass)
+ delegate.atomPatternCharacter('B');
+ else {
+ delegate.assertionWordBoundary(true);
+ return false;
+ }
+ break;
+
+ // CharacterClassEscape
+ case 'd':
+ consume();
+ delegate.atomBuiltInCharacterClass(DigitClassID, false);
+ break;
+ case 's':
+ consume();
+ delegate.atomBuiltInCharacterClass(SpaceClassID, false);
+ break;
+ case 'w':
+ consume();
+ delegate.atomBuiltInCharacterClass(WordClassID, false);
+ break;
+ case 'D':
+ consume();
+ delegate.atomBuiltInCharacterClass(DigitClassID, true);
+ break;
+ case 'S':
+ consume();
+ delegate.atomBuiltInCharacterClass(SpaceClassID, true);
+ break;
+ case 'W':
+ consume();
+ delegate.atomBuiltInCharacterClass(WordClassID, true);
+ break;
+
+ // DecimalEscape
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9': {
+ // To match Firefox, we parse an invalid backreference in the range [1-7] as an octal escape.
+ // First, try to parse this as backreference.
+ if (!inCharacterClass) {
+ ParseState state = saveState();
+
+ unsigned backReference = consumeNumber();
+ if (backReference <= m_backReferenceLimit) {
+ delegate.atomBackReference(backReference);
+ break;
+ }
+
+ restoreState(state);
+ }
+
+ // Not a backreference, and not octal.
+ if (peek() >= '8') {
+ delegate.atomPatternCharacter('\\');
+ break;
+ }
+
+ // Fall-through to handle this as an octal escape.
+ }
+
+ // Octal escape
+ case '0':
+ delegate.atomPatternCharacter(consumeOctal());
+ break;
+
+ // ControlEscape
+ case 'f':
+ consume();
+ delegate.atomPatternCharacter('\f');
+ break;
+ case 'n':
+ consume();
+ delegate.atomPatternCharacter('\n');
+ break;
+ case 'r':
+ consume();
+ delegate.atomPatternCharacter('\r');
+ break;
+ case 't':
+ consume();
+ delegate.atomPatternCharacter('\t');
+ break;
+ case 'v':
+ consume();
+ delegate.atomPatternCharacter('\v');
+ break;
+
+ // ControlLetter
+ case 'c': {
+ ParseState state = saveState();
+ consume();
+ if (!atEndOfPattern()) {
+ int control = consume();
+
+ // To match Firefox, inside a character class, we also accept numbers and '_' as control characters.
+ if (inCharacterClass ? WTF::isASCIIAlphanumeric(control) || (control == '_') : WTF::isASCIIAlpha(control)) {
+ delegate.atomPatternCharacter(control & 0x1f);
+ break;
+ }
+ }
+ restoreState(state);
+ delegate.atomPatternCharacter('\\');
+ break;
+ }
+
+ // HexEscape
+ case 'x': {
+ consume();
+ int x = tryConsumeHex(2);
+ if (x == -1)
+ delegate.atomPatternCharacter('x');
+ else
+ delegate.atomPatternCharacter(x);
+ break;
+ }
+
+ // UnicodeEscape
+ case 'u': {
+ consume();
+ int u = tryConsumeHex(4);
+ if (u == -1)
+ delegate.atomPatternCharacter('u');
+ else
+ delegate.atomPatternCharacter(u);
+ break;
+ }
+
+ // IdentityEscape
+ default:
+ delegate.atomPatternCharacter(consume());
+ }
+
+ return true;
+ }
+
+ /*
+ * parseAtomEscape(), parseCharacterClassEscape():
+ *
+ * These methods alias to parseEscape().
+ */
+ bool parseAtomEscape()
+ {
+ return parseEscape<false>(m_delegate);
+ }
+ void parseCharacterClassEscape(CharacterClassParserDelegate& delegate)
+ {
+ parseEscape<true>(delegate);
+ }
+
+ /*
+ * parseCharacterClass():
+ *
+ * Helper for parseTokens(); calls dirctly and indirectly (via parseCharacterClassEscape)
+ * to an instance of CharacterClassParserDelegate, to describe the character class to the
+ * delegate.
+ */
+ void parseCharacterClass()
+ {
+ ASSERT(!m_err);
+ ASSERT(peek() == '[');
+ consume();
+
+ CharacterClassParserDelegate characterClassConstructor(m_delegate, m_err);
+
+ characterClassConstructor.begin(tryConsume('^'));
+
+ while (!atEndOfPattern()) {
+ switch (peek()) {
+ case ']':
+ consume();
+ characterClassConstructor.end();
+ return;
+
+ case '\\':
+ parseCharacterClassEscape(characterClassConstructor);
+ break;
+
+ default:
+ characterClassConstructor.atomPatternCharacter(consume(), true);
+ }
+
+ if (m_err)
+ return;
+ }
+
+ m_err = CharacterClassUnmatched;
+ }
+
+ /*
+ * parseParenthesesBegin():
+ *
+ * Helper for parseTokens(); checks for parentheses types other than regular capturing subpatterns.
+ */
+ void parseParenthesesBegin()
+ {
+ ASSERT(!m_err);
+ ASSERT(peek() == '(');
+ consume();
+
+ if (tryConsume('?')) {
+ if (atEndOfPattern()) {
+ m_err = ParenthesesTypeInvalid;
+ return;
+ }
+
+ switch (consume()) {
+ case ':':
+ m_delegate.atomParenthesesSubpatternBegin(false);
+ break;
+
+ case '=':
+ m_delegate.atomParentheticalAssertionBegin();
+ break;
+
+ case '!':
+ m_delegate.atomParentheticalAssertionBegin(true);
+ break;
+
+ default:
+ m_err = ParenthesesTypeInvalid;
+ }
+ } else
+ m_delegate.atomParenthesesSubpatternBegin();
+
+ ++m_parenthesesNestingDepth;
+ }
+
+ /*
+ * parseParenthesesEnd():
+ *
+ * Helper for parseTokens(); checks for parse errors (due to unmatched parentheses).
+ */
+ void parseParenthesesEnd()
+ {
+ ASSERT(!m_err);
+ ASSERT(peek() == ')');
+ consume();
+
+ if (m_parenthesesNestingDepth > 0)
+ m_delegate.atomParenthesesEnd();
+ else
+ m_err = ParenthesesUnmatched;
+
+ --m_parenthesesNestingDepth;
+ }
+
+ /*
+ * parseQuantifier():
+ *
+ * Helper for parseTokens(); checks for parse errors and non-greedy quantifiers.
+ */
+ void parseQuantifier(bool lastTokenWasAnAtom, unsigned min, unsigned max)
+ {
+ ASSERT(!m_err);
+ ASSERT(min <= max);
+
+ if (lastTokenWasAnAtom)
+ m_delegate.quantifyAtom(min, max, !tryConsume('?'));
+ else
+ m_err = QuantifierWithoutAtom;
+ }
+
+ /*
+ * parseTokens():
+ *
+ * This method loops over the input pattern reporting tokens to the delegate.
+ * The method returns when a parse error is detected, or the end of the pattern
+ * is reached. One piece of state is tracked around the loop, which is whether
+ * the last token passed to the delegate was an atom (this is necessary to detect
+ * a parse error when a quantifier provided without an atom to quantify).
+ */
+ void parseTokens()
+ {
+ bool lastTokenWasAnAtom = false;
+
+ while (!atEndOfPattern()) {
+ switch (peek()) {
+ case '|':
+ consume();
+ m_delegate.disjunction();
+ lastTokenWasAnAtom = false;
+ break;
+
+ case '(':
+ parseParenthesesBegin();
+ lastTokenWasAnAtom = false;
+ break;
+
+ case ')':
+ parseParenthesesEnd();
+ lastTokenWasAnAtom = true;
+ break;
+
+ case '^':
+ consume();
+ m_delegate.assertionBOL();
+ lastTokenWasAnAtom = false;
+ break;
+
+ case '$':
+ consume();
+ m_delegate.assertionEOL();
+ lastTokenWasAnAtom = false;
+ break;
+
+ case '.':
+ consume();
+ m_delegate.atomBuiltInCharacterClass(NewlineClassID, true);
+ lastTokenWasAnAtom = true;
+ break;
+
+ case '[':
+ parseCharacterClass();
+ lastTokenWasAnAtom = true;
+ break;
+
+ case '\\':
+ lastTokenWasAnAtom = parseAtomEscape();
+ break;
+
+ case '*':
+ consume();
+ parseQuantifier(lastTokenWasAnAtom, 0, quantifyInfinite);
+ lastTokenWasAnAtom = false;
+ break;
+
+ case '+':
+ consume();
+ parseQuantifier(lastTokenWasAnAtom, 1, quantifyInfinite);
+ lastTokenWasAnAtom = false;
+ break;
+
+ case '?':
+ consume();
+ parseQuantifier(lastTokenWasAnAtom, 0, 1);
+ lastTokenWasAnAtom = false;
+ break;
+
+ case '{': {
+ ParseState state = saveState();
+
+ consume();
+ if (peekIsDigit()) {
+ unsigned min = consumeNumber();
+ unsigned max = min;
+
+ if (tryConsume(','))
+ max = peekIsDigit() ? consumeNumber() : quantifyInfinite;
+
+ if (tryConsume('}')) {
+ if (min <= max)
+ parseQuantifier(lastTokenWasAnAtom, min, max);
+ else
+ m_err = QuantifierOutOfOrder;
+ lastTokenWasAnAtom = false;
+ break;
+ }
+ }
+
+ restoreState(state);
+ } // if we did not find a complete quantifer, fall through to the default case.
+
+ default:
+ m_delegate.atomPatternCharacter(consume());
+ lastTokenWasAnAtom = true;
+ }
+
+ if (m_err)
+ return;
+ }
+
+ if (m_parenthesesNestingDepth > 0)
+ m_err = MissingParentheses;
+ }
+
+ /*
+ * parse():
+ *
+ * This method calls regexBegin(), calls parseTokens() to parse over the input
+ * patterns, calls regexEnd() or regexError() as appropriate, and converts any
+ * error code to a const char* for a result.
+ */
+ const char* parse()
+ {
+ m_delegate.regexBegin();
+
+ if (m_size > MAX_PATTERN_SIZE)
+ m_err = PatternTooLarge;
+ else
+ parseTokens();
+ ASSERT(atEndOfPattern() || m_err);
+
+ if (m_err)
+ m_delegate.regexError();
+ else
+ m_delegate.regexEnd();
+
+ // The order of this array must match the ErrorCode enum.
+ static const char* errorMessages[NumberOfErrorCodes] = {
+ 0, // NoError
+ "regular expression too large",
+ "numbers out of order in {} quantifier",
+ "nothing to repeat",
+ "missing )",
+ "unmatched parentheses",
+ "unrecognized character after (?",
+ "missing terminating ] for character class",
+ "range out of order in character class",
+ "\\ at end of pattern"
+ };
+
+ return errorMessages[m_err];
+ }
+
+
+ // Misc helper functions:
+
+ typedef unsigned ParseState;
+
+ ParseState saveState()
+ {
+ return m_index;
+ }
+
+ void restoreState(ParseState state)
+ {
+ m_index = state;
+ }
+
+ bool atEndOfPattern()
+ {
+ ASSERT(m_index <= m_size);
+ return m_index == m_size;
+ }
+
+ int peek()
+ {
+ ASSERT(m_index < m_size);
+ return m_data[m_index];
+ }
+
+ bool peekIsDigit()
+ {
+ return !atEndOfPattern() && WTF::isASCIIDigit(peek());
+ }
+
+ unsigned peekDigit()
+ {
+ ASSERT(peekIsDigit());
+ return peek() - '0';
+ }
+
+ int consume()
+ {
+ ASSERT(m_index < m_size);
+ return m_data[m_index++];
+ }
+
+ unsigned consumeDigit()
+ {
+ ASSERT(peekIsDigit());
+ return consume() - '0';
+ }
+
+ unsigned consumeNumber()
+ {
+ unsigned n = consumeDigit();
+ // check for overflow.
+ for (unsigned newValue; peekIsDigit() && ((newValue = n * 10 + peekDigit()) >= n); ) {
+ n = newValue;
+ consume();
+ }
+ return n;
+ }
+
+ unsigned consumeOctal()
+ {
+ ASSERT(WTF::isASCIIOctalDigit(peek()));
+
+ unsigned n = consumeDigit();
+ while (n < 32 && !atEndOfPattern() && WTF::isASCIIOctalDigit(peek()))
+ n = n * 8 + consumeDigit();
+ return n;
+ }
+
+ bool tryConsume(UChar ch)
+ {
+ if (atEndOfPattern() || (m_data[m_index] != ch))
+ return false;
+ ++m_index;
+ return true;
+ }
+
+ int tryConsumeHex(int count)
+ {
+ ParseState state = saveState();
+
+ int n = 0;
+ while (count--) {
+ if (atEndOfPattern() || !WTF::isASCIIHexDigit(peek())) {
+ restoreState(state);
+ return -1;
+ }
+ n = (n << 4) | WTF::toASCIIHexValue(consume());
+ }
+ return n;
+ }
+
+ Delegate& m_delegate;
+ unsigned m_backReferenceLimit;
+ ErrorCode m_err;
+ const UChar* m_data;
+ unsigned m_size;
+ unsigned m_index;
+ unsigned m_parenthesesNestingDepth;
+
+ // Derived by empirical testing of compile time in PCRE and WREC.
+ static const unsigned MAX_PATTERN_SIZE = 1024 * 1024;
+};
+
+/*
+ * Yarr::parse():
+ *
+ * The parse method is passed a pattern to be parsed and a delegate upon which
+ * callbacks will be made to record the parsed tokens forming the regex.
+ * Yarr::parse() returns null on success, or a const C string providing an error
+ * message where a parse error occurs.
+ *
+ * The Delegate must implement the following interface:
+ *
+ * void assertionBOL();
+ * void assertionEOL();
+ * void assertionWordBoundary(bool invert);
+ *
+ * void atomPatternCharacter(UChar ch);
+ * void atomBuiltInCharacterClass(BuiltInCharacterClassID classID, bool invert);
+ * void atomCharacterClassBegin(bool invert)
+ * void atomCharacterClassAtom(UChar ch)
+ * void atomCharacterClassRange(UChar begin, UChar end)
+ * void atomCharacterClassBuiltIn(BuiltInCharacterClassID classID, bool invert)
+ * void atomCharacterClassEnd()
+ * void atomParenthesesSubpatternBegin(bool capture = true);
+ * void atomParentheticalAssertionBegin(bool invert = false);
+ * void atomParenthesesEnd();
+ * void atomBackReference(unsigned subpatternId);
+ *
+ * void quantifyAtom(unsigned min, unsigned max, bool greedy);
+ *
+ * void disjunction();
+ *
+ * void regexBegin();
+ * void regexEnd();
+ * void regexError();
+ *
+ * Before any call recording tokens are made, regexBegin() will be called on the
+ * delegate once. Once parsing is complete either regexEnd() or regexError() will
+ * be called, as appropriate.
+ *
+ * The regular expression is described by a sequence of assertion*() and atom*()
+ * callbacks to the delegate, describing the terms in the regular expression.
+ * Following an atom a quantifyAtom() call may occur to indicate that the previous
+ * atom should be quantified. In the case of atoms described across multiple
+ * calls (parentheses and character classes) the call to quantifyAtom() will come
+ * after the call to the atom*End() method, never after atom*Begin().
+ *
+ * Character classes may either be described by a single call to
+ * atomBuiltInCharacterClass(), or by a sequence of atomCharacterClass*() calls.
+ * In the latter case, ...Begin() will be called, followed by a sequence of
+ * calls to ...Atom(), ...Range(), and ...BuiltIn(), followed by a call to ...End().
+ *
+ * Sequences of atoms and assertions are broken into alternatives via calls to
+ * disjunction(). Assertions, atoms, and disjunctions emitted between calls to
+ * atomParenthesesBegin() and atomParenthesesEnd() form the body of a subpattern.
+ * atomParenthesesBegin() is passed a subpatternId. In the case of a regular
+ * capturing subpattern, this will be the subpatternId associated with these
+ * parentheses, and will also by definition be the lowest subpatternId of these
+ * parentheses and of any nested paretheses. The atomParenthesesEnd() method
+ * is passed the subpatternId of the last capturing subexpression nested within
+ * these paretheses. In the case of a capturing subpattern with no nested
+ * capturing subpatterns, the same subpatternId will be passed to the begin and
+ * end functions. In the case of non-capturing subpatterns the subpatternId
+ * passed to the begin method is also the first possible subpatternId that might
+ * be nested within these paretheses. If a set of non-capturing parentheses does
+ * not contain any capturing subpatterns, then the subpatternId passed to begin
+ * will be greater than the subpatternId passed to end.
+ */
+
+template<class Delegate>
+const char* parse(Delegate& delegate, const UString& pattern, unsigned backReferenceLimit = quantifyInfinite)
+{
+ return Parser<Delegate>(delegate, pattern, backReferenceLimit).parse();
+}
+
+} } // namespace JSC::Yarr
+
+#endif // RegexParser_h
diff --git a/Source/JavaScriptCore/yarr/RegexPattern.cpp b/Source/JavaScriptCore/yarr/RegexPattern.cpp
new file mode 100644
index 0000000..e737d0e
--- /dev/null
+++ b/Source/JavaScriptCore/yarr/RegexPattern.cpp
@@ -0,0 +1,991 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2010 Peter Varga (pvarga@inf.u-szeged.hu), University of Szeged
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#include "RegexInterpreter.h"
+#include "RegexPattern.h"
+#include <wtf/Vector.h>
+
+using namespace WTF;
+
+namespace JSC { namespace Yarr {
+
+#include "RegExpJitTables.h"
+
+class CharacterClassConstructor {
+public:
+ CharacterClassConstructor(bool isCaseInsensitive = false)
+ : m_isCaseInsensitive(isCaseInsensitive)
+ {
+ }
+
+ void reset()
+ {
+ m_matches.clear();
+ m_ranges.clear();
+ m_matchesUnicode.clear();
+ m_rangesUnicode.clear();
+ }
+
+ void append(const CharacterClass* other)
+ {
+ for (size_t i = 0; i < other->m_matches.size(); ++i)
+ addSorted(m_matches, other->m_matches[i]);
+ for (size_t i = 0; i < other->m_ranges.size(); ++i)
+ addSortedRange(m_ranges, other->m_ranges[i].begin, other->m_ranges[i].end);
+ for (size_t i = 0; i < other->m_matchesUnicode.size(); ++i)
+ addSorted(m_matchesUnicode, other->m_matchesUnicode[i]);
+ for (size_t i = 0; i < other->m_rangesUnicode.size(); ++i)
+ addSortedRange(m_rangesUnicode, other->m_rangesUnicode[i].begin, other->m_rangesUnicode[i].end);
+ }
+
+ void putChar(UChar ch)
+ {
+ if (ch <= 0x7f) {
+ if (m_isCaseInsensitive && isASCIIAlpha(ch)) {
+ addSorted(m_matches, toASCIIUpper(ch));
+ addSorted(m_matches, toASCIILower(ch));
+ } else
+ addSorted(m_matches, ch);
+ } else {
+ UChar upper, lower;
+ if (m_isCaseInsensitive && ((upper = Unicode::toUpper(ch)) != (lower = Unicode::toLower(ch)))) {
+ addSorted(m_matchesUnicode, upper);
+ addSorted(m_matchesUnicode, lower);
+ } else
+ addSorted(m_matchesUnicode, ch);
+ }
+ }
+
+ // returns true if this character has another case, and 'ch' is the upper case form.
+ static inline bool isUnicodeUpper(UChar ch)
+ {
+ return ch != Unicode::toLower(ch);
+ }
+
+ // returns true if this character has another case, and 'ch' is the lower case form.
+ static inline bool isUnicodeLower(UChar ch)
+ {
+ return ch != Unicode::toUpper(ch);
+ }
+
+ void putRange(UChar lo, UChar hi)
+ {
+ if (lo <= 0x7f) {
+ char asciiLo = lo;
+ char asciiHi = std::min(hi, (UChar)0x7f);
+ addSortedRange(m_ranges, lo, asciiHi);
+
+ if (m_isCaseInsensitive) {
+ if ((asciiLo <= 'Z') && (asciiHi >= 'A'))
+ addSortedRange(m_ranges, std::max(asciiLo, 'A')+('a'-'A'), std::min(asciiHi, 'Z')+('a'-'A'));
+ if ((asciiLo <= 'z') && (asciiHi >= 'a'))
+ addSortedRange(m_ranges, std::max(asciiLo, 'a')+('A'-'a'), std::min(asciiHi, 'z')+('A'-'a'));
+ }
+ }
+ if (hi >= 0x80) {
+ uint32_t unicodeCurr = std::max(lo, (UChar)0x80);
+ addSortedRange(m_rangesUnicode, unicodeCurr, hi);
+
+ if (m_isCaseInsensitive) {
+ while (unicodeCurr <= hi) {
+ // If the upper bound of the range (hi) is 0xffff, the increments to
+ // unicodeCurr in this loop may take it to 0x10000. This is fine
+ // (if so we won't re-enter the loop, since the loop condition above
+ // will definitely fail) - but this does mean we cannot use a UChar
+ // to represent unicodeCurr, we must use a 32-bit value instead.
+ ASSERT(unicodeCurr <= 0xffff);
+
+ if (isUnicodeUpper(unicodeCurr)) {
+ UChar lowerCaseRangeBegin = Unicode::toLower(unicodeCurr);
+ UChar lowerCaseRangeEnd = lowerCaseRangeBegin;
+ while ((++unicodeCurr <= hi) && isUnicodeUpper(unicodeCurr) && (Unicode::toLower(unicodeCurr) == (lowerCaseRangeEnd + 1)))
+ lowerCaseRangeEnd++;
+ addSortedRange(m_rangesUnicode, lowerCaseRangeBegin, lowerCaseRangeEnd);
+ } else if (isUnicodeLower(unicodeCurr)) {
+ UChar upperCaseRangeBegin = Unicode::toUpper(unicodeCurr);
+ UChar upperCaseRangeEnd = upperCaseRangeBegin;
+ while ((++unicodeCurr <= hi) && isUnicodeLower(unicodeCurr) && (Unicode::toUpper(unicodeCurr) == (upperCaseRangeEnd + 1)))
+ upperCaseRangeEnd++;
+ addSortedRange(m_rangesUnicode, upperCaseRangeBegin, upperCaseRangeEnd);
+ } else
+ ++unicodeCurr;
+ }
+ }
+ }
+ }
+
+ CharacterClass* charClass()
+ {
+ CharacterClass* characterClass = new CharacterClass(0);
+
+ characterClass->m_matches.append(m_matches);
+ characterClass->m_ranges.append(m_ranges);
+ characterClass->m_matchesUnicode.append(m_matchesUnicode);
+ characterClass->m_rangesUnicode.append(m_rangesUnicode);
+
+ reset();
+
+ return characterClass;
+ }
+
+private:
+ void addSorted(Vector<UChar>& matches, UChar ch)
+ {
+ unsigned pos = 0;
+ unsigned range = matches.size();
+
+ // binary chop, find position to insert char.
+ while (range) {
+ unsigned index = range >> 1;
+
+ int val = matches[pos+index] - ch;
+ if (!val)
+ return;
+ else if (val > 0)
+ range = index;
+ else {
+ pos += (index+1);
+ range -= (index+1);
+ }
+ }
+
+ if (pos == matches.size())
+ matches.append(ch);
+ else
+ matches.insert(pos, ch);
+ }
+
+ void addSortedRange(Vector<CharacterRange>& ranges, UChar lo, UChar hi)
+ {
+ unsigned end = ranges.size();
+
+ // Simple linear scan - I doubt there are that many ranges anyway...
+ // feel free to fix this with something faster (eg binary chop).
+ for (unsigned i = 0; i < end; ++i) {
+ // does the new range fall before the current position in the array
+ if (hi < ranges[i].begin) {
+ // optional optimization: concatenate appending ranges? - may not be worthwhile.
+ if (hi == (ranges[i].begin - 1)) {
+ ranges[i].begin = lo;
+ return;
+ }
+ ranges.insert(i, CharacterRange(lo, hi));
+ return;
+ }
+ // Okay, since we didn't hit the last case, the end of the new range is definitely at or after the begining
+ // If the new range start at or before the end of the last range, then the overlap (if it starts one after the
+ // end of the last range they concatenate, which is just as good.
+ if (lo <= (ranges[i].end + 1)) {
+ // found an intersect! we'll replace this entry in the array.
+ ranges[i].begin = std::min(ranges[i].begin, lo);
+ ranges[i].end = std::max(ranges[i].end, hi);
+
+ // now check if the new range can subsume any subsequent ranges.
+ unsigned next = i+1;
+ // each iteration of the loop we will either remove something from the list, or break the loop.
+ while (next < ranges.size()) {
+ if (ranges[next].begin <= (ranges[i].end + 1)) {
+ // the next entry now overlaps / concatenates this one.
+ ranges[i].end = std::max(ranges[i].end, ranges[next].end);
+ ranges.remove(next);
+ } else
+ break;
+ }
+
+ return;
+ }
+ }
+
+ // CharacterRange comes after all existing ranges.
+ ranges.append(CharacterRange(lo, hi));
+ }
+
+ bool m_isCaseInsensitive;
+
+ Vector<UChar> m_matches;
+ Vector<CharacterRange> m_ranges;
+ Vector<UChar> m_matchesUnicode;
+ Vector<CharacterRange> m_rangesUnicode;
+};
+
+struct BeginCharHelper {
+ BeginCharHelper(Vector<BeginChar>* beginChars, bool isCaseInsensitive = false)
+ : m_beginChars(beginChars)
+ , m_isCaseInsensitive(isCaseInsensitive)
+ {}
+
+ void addBeginChar(BeginChar beginChar, Vector<TermChain>* hotTerms, QuantifierType quantityType, unsigned quantityCount)
+ {
+ if (quantityType == QuantifierFixedCount && quantityCount > 1) {
+ // We duplicate the first found character if the quantity of the term is more than one. eg.: /a{3}/
+ beginChar.value |= beginChar.value << 16;
+ beginChar.mask |= beginChar.mask << 16;
+ addCharacter(beginChar);
+ } else if (quantityType == QuantifierFixedCount && quantityCount == 1 && hotTerms->size())
+ // In case of characters with fixed quantifier we should check the next character as well.
+ linkHotTerms(beginChar, hotTerms);
+ else
+ // In case of greedy matching the next character checking is unnecessary therefore we just store
+ // the first character.
+ addCharacter(beginChar);
+ }
+
+ // Merge two following BeginChars in the vector to reduce the number of character checks.
+ void merge(unsigned size)
+ {
+ for (unsigned i = 0; i < size; i++) {
+ BeginChar* curr = &m_beginChars->at(i);
+ BeginChar* next = &m_beginChars->at(i + 1);
+
+ // If the current and the next size of value is different we should skip the merge process
+ // because the 16bit and 32bit values are unmergable.
+ if (curr->value <= 0xFFFF && next->value > 0xFFFF)
+ continue;
+
+ unsigned diff = curr->value ^ next->value;
+
+ curr->mask |= diff;
+ curr->value |= curr->mask;
+
+ m_beginChars->remove(i + 1);
+ size--;
+ }
+ }
+
+private:
+ void addCharacter(BeginChar beginChar)
+ {
+ unsigned pos = 0;
+ unsigned range = m_beginChars->size();
+
+ // binary chop, find position to insert char.
+ while (range) {
+ unsigned index = range >> 1;
+
+ int val = m_beginChars->at(pos+index).value - beginChar.value;
+ if (!val)
+ return;
+ if (val < 0)
+ range = index;
+ else {
+ pos += (index+1);
+ range -= (index+1);
+ }
+ }
+
+ if (pos == m_beginChars->size())
+ m_beginChars->append(beginChar);
+ else
+ m_beginChars->insert(pos, beginChar);
+ }
+
+ // Create BeginChar objects by appending each terms from a hotTerms vector to an existing BeginChar object.
+ void linkHotTerms(BeginChar beginChar, Vector<TermChain>* hotTerms)
+ {
+ for (unsigned i = 0; i < hotTerms->size(); i++) {
+ PatternTerm hotTerm = hotTerms->at(i).term;
+ ASSERT(hotTerm.type == PatternTerm::TypePatternCharacter);
+
+ UChar characterNext = hotTerm.patternCharacter;
+
+ // Append a character to an existing BeginChar object.
+ if (characterNext <= 0x7f) {
+ unsigned mask = 0;
+
+ if (m_isCaseInsensitive && isASCIIAlpha(characterNext)) {
+ mask = 32;
+ characterNext = toASCIILower(characterNext);
+ }
+
+ addCharacter(BeginChar(beginChar.value | (characterNext << 16), beginChar.mask | (mask << 16)));
+ } else {
+ UChar upper, lower;
+ if (m_isCaseInsensitive && ((upper = Unicode::toUpper(characterNext)) != (lower = Unicode::toLower(characterNext)))) {
+ addCharacter(BeginChar(beginChar.value | (upper << 16), beginChar.mask));
+ addCharacter(BeginChar(beginChar.value | (lower << 16), beginChar.mask));
+ } else
+ addCharacter(BeginChar(beginChar.value | (characterNext << 16), beginChar.mask));
+ }
+ }
+ }
+
+ Vector<BeginChar>* m_beginChars;
+ bool m_isCaseInsensitive;
+};
+
+class RegexPatternConstructor {
+public:
+ RegexPatternConstructor(RegexPattern& pattern)
+ : m_pattern(pattern)
+ , m_characterClassConstructor(pattern.m_ignoreCase)
+ , m_beginCharHelper(&pattern.m_beginChars, pattern.m_ignoreCase)
+ , m_invertParentheticalAssertion(false)
+ {
+ }
+
+ ~RegexPatternConstructor()
+ {
+ }
+
+ void reset()
+ {
+ m_pattern.reset();
+ m_characterClassConstructor.reset();
+ }
+
+ void assertionBOL()
+ {
+ if (!m_alternative->m_terms.size() & !m_invertParentheticalAssertion) {
+ m_alternative->m_startsWithBOL = true;
+ m_alternative->m_containsBOL = true;
+ m_pattern.m_containsBOL = true;
+ }
+ m_alternative->m_terms.append(PatternTerm::BOL());
+ }
+ void assertionEOL()
+ {
+ m_alternative->m_terms.append(PatternTerm::EOL());
+ }
+ void assertionWordBoundary(bool invert)
+ {
+ m_alternative->m_terms.append(PatternTerm::WordBoundary(invert));
+ }
+
+ void atomPatternCharacter(UChar ch)
+ {
+ // We handle case-insensitive checking of unicode characters which do have both
+ // cases by handling them as if they were defined using a CharacterClass.
+ if (m_pattern.m_ignoreCase && !isASCII(ch) && (Unicode::toUpper(ch) != Unicode::toLower(ch))) {
+ atomCharacterClassBegin();
+ atomCharacterClassAtom(ch);
+ atomCharacterClassEnd();
+ } else
+ m_alternative->m_terms.append(PatternTerm(ch));
+ }
+
+ void atomBuiltInCharacterClass(BuiltInCharacterClassID classID, bool invert)
+ {
+ switch (classID) {
+ case DigitClassID:
+ m_alternative->m_terms.append(PatternTerm(m_pattern.digitsCharacterClass(), invert));
+ break;
+ case SpaceClassID:
+ m_alternative->m_terms.append(PatternTerm(m_pattern.spacesCharacterClass(), invert));
+ break;
+ case WordClassID:
+ m_alternative->m_terms.append(PatternTerm(m_pattern.wordcharCharacterClass(), invert));
+ break;
+ case NewlineClassID:
+ m_alternative->m_terms.append(PatternTerm(m_pattern.newlineCharacterClass(), invert));
+ break;
+ }
+ }
+
+ void atomCharacterClassBegin(bool invert = false)
+ {
+ m_invertCharacterClass = invert;
+ }
+
+ void atomCharacterClassAtom(UChar ch)
+ {
+ m_characterClassConstructor.putChar(ch);
+ }
+
+ void atomCharacterClassRange(UChar begin, UChar end)
+ {
+ m_characterClassConstructor.putRange(begin, end);
+ }
+
+ void atomCharacterClassBuiltIn(BuiltInCharacterClassID classID, bool invert)
+ {
+ ASSERT(classID != NewlineClassID);
+
+ switch (classID) {
+ case DigitClassID:
+ m_characterClassConstructor.append(invert ? m_pattern.nondigitsCharacterClass() : m_pattern.digitsCharacterClass());
+ break;
+
+ case SpaceClassID:
+ m_characterClassConstructor.append(invert ? m_pattern.nonspacesCharacterClass() : m_pattern.spacesCharacterClass());
+ break;
+
+ case WordClassID:
+ m_characterClassConstructor.append(invert ? m_pattern.nonwordcharCharacterClass() : m_pattern.wordcharCharacterClass());
+ break;
+
+ default:
+ ASSERT_NOT_REACHED();
+ }
+ }
+
+ void atomCharacterClassEnd()
+ {
+ CharacterClass* newCharacterClass = m_characterClassConstructor.charClass();
+ m_pattern.m_userCharacterClasses.append(newCharacterClass);
+ m_alternative->m_terms.append(PatternTerm(newCharacterClass, m_invertCharacterClass));
+ }
+
+ void atomParenthesesSubpatternBegin(bool capture = true)
+ {
+ unsigned subpatternId = m_pattern.m_numSubpatterns + 1;
+ if (capture)
+ m_pattern.m_numSubpatterns++;
+
+ PatternDisjunction* parenthesesDisjunction = new PatternDisjunction(m_alternative);
+ m_pattern.m_disjunctions.append(parenthesesDisjunction);
+ m_alternative->m_terms.append(PatternTerm(PatternTerm::TypeParenthesesSubpattern, subpatternId, parenthesesDisjunction, capture, false));
+ m_alternative = parenthesesDisjunction->addNewAlternative();
+ }
+
+ void atomParentheticalAssertionBegin(bool invert = false)
+ {
+ PatternDisjunction* parenthesesDisjunction = new PatternDisjunction(m_alternative);
+ m_pattern.m_disjunctions.append(parenthesesDisjunction);
+ m_alternative->m_terms.append(PatternTerm(PatternTerm::TypeParentheticalAssertion, m_pattern.m_numSubpatterns + 1, parenthesesDisjunction, false, invert));
+ m_alternative = parenthesesDisjunction->addNewAlternative();
+ m_invertParentheticalAssertion = invert;
+ }
+
+ void atomParenthesesEnd()
+ {
+ ASSERT(m_alternative->m_parent);
+ ASSERT(m_alternative->m_parent->m_parent);
+
+ PatternDisjunction* parenthesesDisjunction = m_alternative->m_parent;
+ m_alternative = m_alternative->m_parent->m_parent;
+
+ PatternTerm& lastTerm = m_alternative->lastTerm();
+
+ unsigned numParenAlternatives = parenthesesDisjunction->m_alternatives.size();
+ unsigned numBOLAnchoredAlts = 0;
+ // Bubble up BOL flags
+ for (unsigned i = 0; i < numParenAlternatives; i++) {
+ if (parenthesesDisjunction->m_alternatives[i]->m_startsWithBOL)
+ numBOLAnchoredAlts++;
+ }
+
+ if (numBOLAnchoredAlts) {
+ m_alternative->m_containsBOL = true;
+ // If all the alternatives in parens start with BOL, then so does this one
+ if (numBOLAnchoredAlts == numParenAlternatives)
+ m_alternative->m_startsWithBOL = true;
+ }
+
+ lastTerm.parentheses.lastSubpatternId = m_pattern.m_numSubpatterns;
+ m_invertParentheticalAssertion = false;
+ }
+
+ void atomBackReference(unsigned subpatternId)
+ {
+ ASSERT(subpatternId);
+ m_pattern.m_containsBackreferences = true;
+ m_pattern.m_maxBackReference = std::max(m_pattern.m_maxBackReference, subpatternId);
+
+ if (subpatternId > m_pattern.m_numSubpatterns) {
+ m_alternative->m_terms.append(PatternTerm::ForwardReference());
+ return;
+ }
+
+ PatternAlternative* currentAlternative = m_alternative;
+ ASSERT(currentAlternative);
+
+ // Note to self: if we waited until the AST was baked, we could also remove forwards refs
+ while ((currentAlternative = currentAlternative->m_parent->m_parent)) {
+ PatternTerm& term = currentAlternative->lastTerm();
+ ASSERT((term.type == PatternTerm::TypeParenthesesSubpattern) || (term.type == PatternTerm::TypeParentheticalAssertion));
+
+ if ((term.type == PatternTerm::TypeParenthesesSubpattern) && term.capture() && (subpatternId == term.parentheses.subpatternId)) {
+ m_alternative->m_terms.append(PatternTerm::ForwardReference());
+ return;
+ }
+ }
+
+ m_alternative->m_terms.append(PatternTerm(subpatternId));
+ }
+
+ // deep copy the argument disjunction. If filterStartsWithBOL is true,
+ // skip alternatives with m_startsWithBOL set true.
+ PatternDisjunction* copyDisjunction(PatternDisjunction* disjunction, bool filterStartsWithBOL = false)
+ {
+ PatternDisjunction* newDisjunction = 0;
+ for (unsigned alt = 0; alt < disjunction->m_alternatives.size(); ++alt) {
+ PatternAlternative* alternative = disjunction->m_alternatives[alt];
+ if (!filterStartsWithBOL || !alternative->m_startsWithBOL) {
+ if (!newDisjunction) {
+ newDisjunction = new PatternDisjunction();
+ newDisjunction->m_parent = disjunction->m_parent;
+ }
+ PatternAlternative* newAlternative = newDisjunction->addNewAlternative();
+ for (unsigned i = 0; i < alternative->m_terms.size(); ++i)
+ newAlternative->m_terms.append(copyTerm(alternative->m_terms[i], filterStartsWithBOL));
+ }
+ }
+
+ if (newDisjunction)
+ m_pattern.m_disjunctions.append(newDisjunction);
+ return newDisjunction;
+ }
+
+ PatternTerm copyTerm(PatternTerm& term, bool filterStartsWithBOL = false)
+ {
+ if ((term.type != PatternTerm::TypeParenthesesSubpattern) && (term.type != PatternTerm::TypeParentheticalAssertion))
+ return PatternTerm(term);
+
+ PatternTerm termCopy = term;
+ termCopy.parentheses.disjunction = copyDisjunction(termCopy.parentheses.disjunction, filterStartsWithBOL);
+ return termCopy;
+ }
+
+ void quantifyAtom(unsigned min, unsigned max, bool greedy)
+ {
+ ASSERT(min <= max);
+ ASSERT(m_alternative->m_terms.size());
+
+ if (!max) {
+ m_alternative->removeLastTerm();
+ return;
+ }
+
+ PatternTerm& term = m_alternative->lastTerm();
+ ASSERT(term.type > PatternTerm::TypeAssertionWordBoundary);
+ ASSERT((term.quantityCount == 1) && (term.quantityType == QuantifierFixedCount));
+
+ // For any assertion with a zero minimum, not matching is valid and has no effect,
+ // remove it. Otherwise, we need to match as least once, but there is no point
+ // matching more than once, so remove the quantifier. It is not entirely clear
+ // from the spec whether or not this behavior is correct, but I believe this
+ // matches Firefox. :-/
+ if (term.type == PatternTerm::TypeParentheticalAssertion) {
+ if (!min)
+ m_alternative->removeLastTerm();
+ return;
+ }
+
+ if (min == 0)
+ term.quantify(max, greedy ? QuantifierGreedy : QuantifierNonGreedy);
+ else if (min == max)
+ term.quantify(min, QuantifierFixedCount);
+ else {
+ term.quantify(min, QuantifierFixedCount);
+ m_alternative->m_terms.append(copyTerm(term));
+ // NOTE: this term is interesting from an analysis perspective, in that it can be ignored.....
+ m_alternative->lastTerm().quantify((max == quantifyInfinite) ? max : max - min, greedy ? QuantifierGreedy : QuantifierNonGreedy);
+ if (m_alternative->lastTerm().type == PatternTerm::TypeParenthesesSubpattern)
+ m_alternative->lastTerm().parentheses.isCopy = true;
+ }
+ }
+
+ void disjunction()
+ {
+ m_alternative = m_alternative->m_parent->addNewAlternative();
+ }
+
+ void regexBegin()
+ {
+ m_pattern.m_body = new PatternDisjunction();
+ m_alternative = m_pattern.m_body->addNewAlternative();
+ m_pattern.m_disjunctions.append(m_pattern.m_body);
+ }
+ void regexEnd()
+ {
+ }
+ void regexError()
+ {
+ }
+
+ unsigned setupAlternativeOffsets(PatternAlternative* alternative, unsigned currentCallFrameSize, unsigned initialInputPosition)
+ {
+ alternative->m_hasFixedSize = true;
+ unsigned currentInputPosition = initialInputPosition;
+
+ for (unsigned i = 0; i < alternative->m_terms.size(); ++i) {
+ PatternTerm& term = alternative->m_terms[i];
+
+ switch (term.type) {
+ case PatternTerm::TypeAssertionBOL:
+ case PatternTerm::TypeAssertionEOL:
+ case PatternTerm::TypeAssertionWordBoundary:
+ term.inputPosition = currentInputPosition;
+ break;
+
+ case PatternTerm::TypeBackReference:
+ term.inputPosition = currentInputPosition;
+ term.frameLocation = currentCallFrameSize;
+ currentCallFrameSize += RegexStackSpaceForBackTrackInfoBackReference;
+ alternative->m_hasFixedSize = false;
+ break;
+
+ case PatternTerm::TypeForwardReference:
+ break;
+
+ case PatternTerm::TypePatternCharacter:
+ term.inputPosition = currentInputPosition;
+ if (term.quantityType != QuantifierFixedCount) {
+ term.frameLocation = currentCallFrameSize;
+ currentCallFrameSize += RegexStackSpaceForBackTrackInfoPatternCharacter;
+ alternative->m_hasFixedSize = false;
+ } else
+ currentInputPosition += term.quantityCount;
+ break;
+
+ case PatternTerm::TypeCharacterClass:
+ term.inputPosition = currentInputPosition;
+ if (term.quantityType != QuantifierFixedCount) {
+ term.frameLocation = currentCallFrameSize;
+ currentCallFrameSize += RegexStackSpaceForBackTrackInfoCharacterClass;
+ alternative->m_hasFixedSize = false;
+ } else
+ currentInputPosition += term.quantityCount;
+ break;
+
+ case PatternTerm::TypeParenthesesSubpattern:
+ // Note: for fixed once parentheses we will ensure at least the minimum is available; others are on their own.
+ term.frameLocation = currentCallFrameSize;
+ if (term.quantityCount == 1 && !term.parentheses.isCopy) {
+ if (term.quantityType != QuantifierFixedCount)
+ currentCallFrameSize += RegexStackSpaceForBackTrackInfoParenthesesOnce;
+ currentCallFrameSize = setupDisjunctionOffsets(term.parentheses.disjunction, currentCallFrameSize, currentInputPosition);
+ // If quantity is fixed, then pre-check its minimum size.
+ if (term.quantityType == QuantifierFixedCount)
+ currentInputPosition += term.parentheses.disjunction->m_minimumSize;
+ term.inputPosition = currentInputPosition;
+ } else if (term.parentheses.isTerminal) {
+ currentCallFrameSize += RegexStackSpaceForBackTrackInfoParenthesesTerminal;
+ currentCallFrameSize = setupDisjunctionOffsets(term.parentheses.disjunction, currentCallFrameSize, currentInputPosition);
+ term.inputPosition = currentInputPosition;
+ } else {
+ term.inputPosition = currentInputPosition;
+ setupDisjunctionOffsets(term.parentheses.disjunction, 0, currentInputPosition);
+ currentCallFrameSize += RegexStackSpaceForBackTrackInfoParentheses;
+ }
+ // Fixed count of 1 could be accepted, if they have a fixed size *AND* if all alternatives are of the same length.
+ alternative->m_hasFixedSize = false;
+ break;
+
+ case PatternTerm::TypeParentheticalAssertion:
+ term.inputPosition = currentInputPosition;
+ term.frameLocation = currentCallFrameSize;
+ currentCallFrameSize = setupDisjunctionOffsets(term.parentheses.disjunction, currentCallFrameSize + RegexStackSpaceForBackTrackInfoParentheticalAssertion, currentInputPosition);
+ break;
+ }
+ }
+
+ alternative->m_minimumSize = currentInputPosition - initialInputPosition;
+ return currentCallFrameSize;
+ }
+
+ unsigned setupDisjunctionOffsets(PatternDisjunction* disjunction, unsigned initialCallFrameSize, unsigned initialInputPosition)
+ {
+ if ((disjunction != m_pattern.m_body) && (disjunction->m_alternatives.size() > 1))
+ initialCallFrameSize += RegexStackSpaceForBackTrackInfoAlternative;
+
+ unsigned minimumInputSize = UINT_MAX;
+ unsigned maximumCallFrameSize = 0;
+ bool hasFixedSize = true;
+
+ for (unsigned alt = 0; alt < disjunction->m_alternatives.size(); ++alt) {
+ PatternAlternative* alternative = disjunction->m_alternatives[alt];
+ unsigned currentAlternativeCallFrameSize = setupAlternativeOffsets(alternative, initialCallFrameSize, initialInputPosition);
+ minimumInputSize = min(minimumInputSize, alternative->m_minimumSize);
+ maximumCallFrameSize = max(maximumCallFrameSize, currentAlternativeCallFrameSize);
+ hasFixedSize &= alternative->m_hasFixedSize;
+ }
+
+ ASSERT(minimumInputSize != UINT_MAX);
+ ASSERT(maximumCallFrameSize >= initialCallFrameSize);
+
+ disjunction->m_hasFixedSize = hasFixedSize;
+ disjunction->m_minimumSize = minimumInputSize;
+ disjunction->m_callFrameSize = maximumCallFrameSize;
+ return maximumCallFrameSize;
+ }
+
+ void setupOffsets()
+ {
+ setupDisjunctionOffsets(m_pattern.m_body, 0, 0);
+ }
+
+ // This optimization identifies sets of parentheses that we will never need to backtrack.
+ // In these cases we do not need to store state from prior iterations.
+ // We can presently avoid backtracking for:
+ // * where the parens are at the end of the regular expression (last term in any of the
+ // alternatives of the main body disjunction).
+ // * where the parens are non-capturing, and quantified unbounded greedy (*).
+ // * where the parens do not contain any capturing subpatterns.
+ void checkForTerminalParentheses()
+ {
+ // This check is much too crude; should be just checking whether the candidate
+ // node contains nested capturing subpatterns, not the whole expression!
+ if (m_pattern.m_numSubpatterns)
+ return;
+
+ Vector<PatternAlternative*>& alternatives = m_pattern.m_body->m_alternatives;
+ for (size_t i = 0; i < alternatives.size(); ++i) {
+ Vector<PatternTerm>& terms = alternatives[i]->m_terms;
+ if (terms.size()) {
+ PatternTerm& term = terms.last();
+ if (term.type == PatternTerm::TypeParenthesesSubpattern
+ && term.quantityType == QuantifierGreedy
+ && term.quantityCount == quantifyInfinite
+ && !term.capture())
+ term.parentheses.isTerminal = true;
+ }
+ }
+ }
+
+ void optimizeBOL()
+ {
+ // Look for expressions containing beginning of line (^) anchoring and unroll them.
+ // e.g. /^a|^b|c/ becomes /^a|^b|c/ which is executed once followed by /c/ which loops
+ // This code relies on the parsing code tagging alternatives with m_containsBOL and
+ // m_startsWithBOL and rolling those up to containing alternatives.
+ // At this point, this is only valid for non-multiline expressions.
+ PatternDisjunction* disjunction = m_pattern.m_body;
+
+ if (!m_pattern.m_containsBOL || m_pattern.m_multiline)
+ return;
+
+ PatternDisjunction* loopDisjunction = copyDisjunction(disjunction, true);
+
+ // Set alternatives in disjunction to "onceThrough"
+ for (unsigned alt = 0; alt < disjunction->m_alternatives.size(); ++alt)
+ disjunction->m_alternatives[alt]->setOnceThrough();
+
+ if (loopDisjunction) {
+ // Move alternatives from loopDisjunction to disjunction
+ for (unsigned alt = 0; alt < loopDisjunction->m_alternatives.size(); ++alt)
+ disjunction->m_alternatives.append(loopDisjunction->m_alternatives[alt]);
+
+ loopDisjunction->m_alternatives.clear();
+ }
+ }
+
+ bool addBeginTerm(PatternTerm term, Vector<TermChain>* beginTerms, PatternAlternative* alternative, unsigned numTerms, unsigned termIndex, unsigned depth)
+ {
+ if (term.quantityType == QuantifierFixedCount) {
+ beginTerms->append(TermChain(term));
+ if (depth < 2 && termIndex < numTerms - 1 && term.quantityCount == 1)
+ setupAlternativeBeginTerms(alternative, &beginTerms->last().hotTerms, termIndex + 1, depth + 1);
+ } else if (termIndex != numTerms - 1) {
+ beginTerms->append(TermChain(term));
+ return true;
+ }
+
+ return false;
+ }
+
+ // This function collects the terms which are potentially matching the first number of depth characters in the result.
+ // If this function returns false then it found at least one term which makes the beginning character
+ // look-up optimization inefficient.
+ bool setupDisjunctionBeginTerms(PatternDisjunction* disjunction, Vector<TermChain>* beginTerms, unsigned depth)
+ {
+ for (unsigned alt = 0; alt < disjunction->m_alternatives.size(); ++alt) {
+ PatternAlternative* alternative = disjunction->m_alternatives[alt];
+
+ if (!setupAlternativeBeginTerms(alternative, beginTerms, 0, depth))
+ return false;
+ }
+
+ return true;
+ }
+
+ bool setupAlternativeBeginTerms(PatternAlternative* alternative, Vector<TermChain>* beginTerms, unsigned termIndex, unsigned depth)
+ {
+ bool checkNext = true;
+ unsigned numTerms = alternative->m_terms.size();
+
+ while (checkNext && termIndex < numTerms) {
+ PatternTerm term = alternative->m_terms[termIndex];
+ checkNext = false;
+
+ switch (term.type) {
+ case PatternTerm::TypeAssertionBOL:
+ case PatternTerm::TypeAssertionEOL:
+ case PatternTerm::TypeAssertionWordBoundary:
+ return false;
+
+ case PatternTerm::TypeBackReference:
+ case PatternTerm::TypeForwardReference:
+ return false;
+
+ case PatternTerm::TypePatternCharacter:
+ if (addBeginTerm(term, beginTerms, alternative, numTerms, termIndex, depth)) {
+ termIndex++;
+ checkNext = true;
+ }
+ break;
+
+ case PatternTerm::TypeCharacterClass:
+ return false;
+
+ case PatternTerm::TypeParentheticalAssertion:
+ if (term.invert())
+ return false;
+
+ case PatternTerm::TypeParenthesesSubpattern:
+ if (term.quantityType != QuantifierFixedCount) {
+ if (termIndex == numTerms - 1)
+ break;
+
+ termIndex++;
+ checkNext = true;
+
+ }
+
+ if (!setupDisjunctionBeginTerms(term.parentheses.disjunction, beginTerms, depth))
+ return false;
+
+ break;
+ }
+ }
+
+ return true;
+ }
+
+ void setupBeginChars()
+ {
+ Vector<TermChain> beginTerms;
+ bool containsFixedCharacter = false;
+
+ if ((!m_pattern.m_body->m_hasFixedSize || m_pattern.m_body->m_alternatives.size() > 1)
+ && setupDisjunctionBeginTerms(m_pattern.m_body, &beginTerms, 0)) {
+ unsigned size = beginTerms.size();
+
+ // If we haven't collected any terms we should abort the preparation of beginning character look-up optimization.
+ if (!size)
+ return;
+
+ m_pattern.m_containsBeginChars = true;
+
+ for (unsigned i = 0; i < size; i++) {
+ PatternTerm term = beginTerms[i].term;
+
+ // We have just collected PatternCharacter terms, other terms are not allowed.
+ ASSERT(term.type == PatternTerm::TypePatternCharacter);
+
+ if (term.quantityType == QuantifierFixedCount)
+ containsFixedCharacter = true;
+
+ UChar character = term.patternCharacter;
+ unsigned mask = 0;
+
+ if (character <= 0x7f) {
+ if (m_pattern.m_ignoreCase && isASCIIAlpha(character)) {
+ mask = 32;
+ character = toASCIILower(character);
+ }
+
+ m_beginCharHelper.addBeginChar(BeginChar(character, mask), &beginTerms[i].hotTerms, term.quantityType, term.quantityCount);
+ } else {
+ UChar upper, lower;
+ if (m_pattern.m_ignoreCase && ((upper = Unicode::toUpper(character)) != (lower = Unicode::toLower(character)))) {
+ m_beginCharHelper.addBeginChar(BeginChar(upper, mask), &beginTerms[i].hotTerms, term.quantityType, term.quantityCount);
+ m_beginCharHelper.addBeginChar(BeginChar(lower, mask), &beginTerms[i].hotTerms, term.quantityType, term.quantityCount);
+ } else
+ m_beginCharHelper.addBeginChar(BeginChar(character, mask), &beginTerms[i].hotTerms, term.quantityType, term.quantityCount);
+ }
+ }
+
+ // If the pattern doesn't contain terms with fixed quantifiers then the beginning character look-up optimization is inefficient.
+ if (!containsFixedCharacter) {
+ m_pattern.m_containsBeginChars = false;
+ return;
+ }
+
+ size = m_pattern.m_beginChars.size();
+
+ if (size > 2)
+ m_beginCharHelper.merge(size - 1);
+ else if (size <= 1)
+ m_pattern.m_containsBeginChars = false;
+ }
+ }
+
+private:
+ RegexPattern& m_pattern;
+ PatternAlternative* m_alternative;
+ CharacterClassConstructor m_characterClassConstructor;
+ BeginCharHelper m_beginCharHelper;
+ bool m_invertCharacterClass;
+ bool m_invertParentheticalAssertion;
+};
+
+
+static const char* compileRegex(const UString& patternString, RegexPattern& pattern)
+{
+ RegexPatternConstructor constructor(pattern);
+
+ if (const char* error = parse(constructor, patternString))
+ return error;
+
+ // If the pattern contains illegal backreferences reset & reparse.
+ // Quoting Netscape's "What's new in JavaScript 1.2",
+ // "Note: if the number of left parentheses is less than the number specified
+ // in \#, the \# is taken as an octal escape as described in the next row."
+ if (pattern.containsIllegalBackReference()) {
+ unsigned numSubpatterns = pattern.m_numSubpatterns;
+
+ constructor.reset();
+#if !ASSERT_DISABLED
+ const char* error =
+#endif
+ parse(constructor, patternString, numSubpatterns);
+
+ ASSERT(!error);
+ ASSERT(numSubpatterns == pattern.m_numSubpatterns);
+ }
+
+ constructor.checkForTerminalParentheses();
+ constructor.optimizeBOL();
+
+ constructor.setupOffsets();
+ constructor.setupBeginChars();
+
+ return 0;
+};
+
+RegexPattern::RegexPattern(const UString& pattern, bool ignoreCase, bool multiline, const char** error)
+ : m_ignoreCase(ignoreCase)
+ , m_multiline(multiline)
+ , m_containsBackreferences(false)
+ , m_containsBeginChars(false)
+ , m_containsBOL(false)
+ , m_numSubpatterns(0)
+ , m_maxBackReference(0)
+ , newlineCached(0)
+ , digitsCached(0)
+ , spacesCached(0)
+ , wordcharCached(0)
+ , nondigitsCached(0)
+ , nonspacesCached(0)
+ , nonwordcharCached(0)
+{
+ *error = compileRegex(pattern, *this);
+}
+
+} }
diff --git a/Source/JavaScriptCore/yarr/RegexPattern.h b/Source/JavaScriptCore/yarr/RegexPattern.h
new file mode 100644
index 0000000..6833dd6
--- /dev/null
+++ b/Source/JavaScriptCore/yarr/RegexPattern.h
@@ -0,0 +1,424 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2010 Peter Varga (pvarga@inf.u-szeged.hu), University of Szeged
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef RegexPattern_h
+#define RegexPattern_h
+
+#include <wtf/Vector.h>
+#include <wtf/unicode/Unicode.h>
+
+#include <UString.h>
+
+namespace JSC { namespace Yarr {
+
+#define RegexStackSpaceForBackTrackInfoPatternCharacter 1 // Only for !fixed quantifiers.
+#define RegexStackSpaceForBackTrackInfoCharacterClass 1 // Only for !fixed quantifiers.
+#define RegexStackSpaceForBackTrackInfoBackReference 2
+#define RegexStackSpaceForBackTrackInfoAlternative 1 // One per alternative.
+#define RegexStackSpaceForBackTrackInfoParentheticalAssertion 1
+#define RegexStackSpaceForBackTrackInfoParenthesesOnce 1 // Only for !fixed quantifiers.
+#define RegexStackSpaceForBackTrackInfoParenthesesTerminal 1
+#define RegexStackSpaceForBackTrackInfoParentheses 2
+
+struct PatternDisjunction;
+
+struct CharacterRange {
+ UChar begin;
+ UChar end;
+
+ CharacterRange(UChar begin, UChar end)
+ : begin(begin)
+ , end(end)
+ {
+ }
+};
+
+struct CharacterClassTable : RefCounted<CharacterClassTable> {
+ const char* m_table;
+ bool m_inverted;
+ static PassRefPtr<CharacterClassTable> create(const char* table, bool inverted)
+ {
+ return adoptRef(new CharacterClassTable(table, inverted));
+ }
+
+private:
+ CharacterClassTable(const char* table, bool inverted)
+ : m_table(table)
+ , m_inverted(inverted)
+ {
+ }
+};
+
+struct CharacterClass : FastAllocBase {
+ // All CharacterClass instances have to have the full set of matches and ranges,
+ // they may have an optional table for faster lookups (which must match the
+ // specified matches and ranges)
+ CharacterClass(PassRefPtr<CharacterClassTable> table)
+ : m_table(table)
+ {
+ }
+ Vector<UChar> m_matches;
+ Vector<CharacterRange> m_ranges;
+ Vector<UChar> m_matchesUnicode;
+ Vector<CharacterRange> m_rangesUnicode;
+ RefPtr<CharacterClassTable> m_table;
+};
+
+enum QuantifierType {
+ QuantifierFixedCount,
+ QuantifierGreedy,
+ QuantifierNonGreedy,
+};
+
+struct PatternTerm {
+ enum Type {
+ TypeAssertionBOL,
+ TypeAssertionEOL,
+ TypeAssertionWordBoundary,
+ TypePatternCharacter,
+ TypeCharacterClass,
+ TypeBackReference,
+ TypeForwardReference,
+ TypeParenthesesSubpattern,
+ TypeParentheticalAssertion,
+ } type;
+ bool m_capture :1;
+ bool m_invert :1;
+ union {
+ UChar patternCharacter;
+ CharacterClass* characterClass;
+ unsigned backReferenceSubpatternId;
+ struct {
+ PatternDisjunction* disjunction;
+ unsigned subpatternId;
+ unsigned lastSubpatternId;
+ bool isCopy;
+ bool isTerminal;
+ } parentheses;
+ };
+ QuantifierType quantityType;
+ unsigned quantityCount;
+ int inputPosition;
+ unsigned frameLocation;
+
+ PatternTerm(UChar ch)
+ : type(PatternTerm::TypePatternCharacter)
+ , m_capture(false)
+ , m_invert(false)
+ {
+ patternCharacter = ch;
+ quantityType = QuantifierFixedCount;
+ quantityCount = 1;
+ }
+
+ PatternTerm(CharacterClass* charClass, bool invert)
+ : type(PatternTerm::TypeCharacterClass)
+ , m_capture(false)
+ , m_invert(invert)
+ {
+ characterClass = charClass;
+ quantityType = QuantifierFixedCount;
+ quantityCount = 1;
+ }
+
+ PatternTerm(Type type, unsigned subpatternId, PatternDisjunction* disjunction, bool capture = false, bool invert = false)
+ : type(type)
+ , m_capture(capture)
+ , m_invert(invert)
+ {
+ parentheses.disjunction = disjunction;
+ parentheses.subpatternId = subpatternId;
+ parentheses.isCopy = false;
+ parentheses.isTerminal = false;
+ quantityType = QuantifierFixedCount;
+ quantityCount = 1;
+ }
+
+ PatternTerm(Type type, bool invert = false)
+ : type(type)
+ , m_capture(false)
+ , m_invert(invert)
+ {
+ quantityType = QuantifierFixedCount;
+ quantityCount = 1;
+ }
+
+ PatternTerm(unsigned spatternId)
+ : type(TypeBackReference)
+ , m_capture(false)
+ , m_invert(false)
+ {
+ backReferenceSubpatternId = spatternId;
+ quantityType = QuantifierFixedCount;
+ quantityCount = 1;
+ }
+
+ static PatternTerm ForwardReference()
+ {
+ return PatternTerm(TypeForwardReference);
+ }
+
+ static PatternTerm BOL()
+ {
+ return PatternTerm(TypeAssertionBOL);
+ }
+
+ static PatternTerm EOL()
+ {
+ return PatternTerm(TypeAssertionEOL);
+ }
+
+ static PatternTerm WordBoundary(bool invert)
+ {
+ return PatternTerm(TypeAssertionWordBoundary, invert);
+ }
+
+ bool invert()
+ {
+ return m_invert;
+ }
+
+ bool capture()
+ {
+ return m_capture;
+ }
+
+ void quantify(unsigned count, QuantifierType type)
+ {
+ quantityCount = count;
+ quantityType = type;
+ }
+};
+
+struct PatternAlternative : FastAllocBase {
+ PatternAlternative(PatternDisjunction* disjunction)
+ : m_parent(disjunction)
+ , m_onceThrough(false)
+ , m_hasFixedSize(false)
+ , m_startsWithBOL(false)
+ , m_containsBOL(false)
+ {
+ }
+
+ PatternTerm& lastTerm()
+ {
+ ASSERT(m_terms.size());
+ return m_terms[m_terms.size() - 1];
+ }
+
+ void removeLastTerm()
+ {
+ ASSERT(m_terms.size());
+ m_terms.shrink(m_terms.size() - 1);
+ }
+
+ void setOnceThrough()
+ {
+ m_onceThrough = true;
+ }
+
+ bool onceThrough()
+ {
+ return m_onceThrough;
+ }
+
+ Vector<PatternTerm> m_terms;
+ PatternDisjunction* m_parent;
+ unsigned m_minimumSize;
+ bool m_onceThrough : 1;
+ bool m_hasFixedSize : 1;
+ bool m_startsWithBOL : 1;
+ bool m_containsBOL : 1;
+};
+
+struct PatternDisjunction : FastAllocBase {
+ PatternDisjunction(PatternAlternative* parent = 0)
+ : m_parent(parent)
+ , m_hasFixedSize(false)
+ {
+ }
+
+ ~PatternDisjunction()
+ {
+ deleteAllValues(m_alternatives);
+ }
+
+ PatternAlternative* addNewAlternative()
+ {
+ PatternAlternative* alternative = new PatternAlternative(this);
+ m_alternatives.append(alternative);
+ return alternative;
+ }
+
+ Vector<PatternAlternative*> m_alternatives;
+ PatternAlternative* m_parent;
+ unsigned m_minimumSize;
+ unsigned m_callFrameSize;
+ bool m_hasFixedSize;
+};
+
+// You probably don't want to be calling these functions directly
+// (please to be calling newlineCharacterClass() et al on your
+// friendly neighborhood RegexPattern instance to get nicely
+// cached copies).
+CharacterClass* newlineCreate();
+CharacterClass* digitsCreate();
+CharacterClass* spacesCreate();
+CharacterClass* wordcharCreate();
+CharacterClass* nondigitsCreate();
+CharacterClass* nonspacesCreate();
+CharacterClass* nonwordcharCreate();
+
+struct TermChain {
+ TermChain(PatternTerm term)
+ : term(term)
+ {}
+
+ PatternTerm term;
+ Vector<TermChain> hotTerms;
+};
+
+struct BeginChar {
+ BeginChar()
+ : value(0)
+ , mask(0)
+ {}
+
+ BeginChar(unsigned value, unsigned mask)
+ : value(value)
+ , mask(mask)
+ {}
+
+ unsigned value;
+ unsigned mask;
+};
+
+struct RegexPattern {
+ RegexPattern(const UString& pattern, bool ignoreCase, bool multiline, const char** error);
+
+ ~RegexPattern()
+ {
+ deleteAllValues(m_disjunctions);
+ deleteAllValues(m_userCharacterClasses);
+ }
+
+ void reset()
+ {
+ m_numSubpatterns = 0;
+ m_maxBackReference = 0;
+
+ m_containsBackreferences = false;
+ m_containsBeginChars = false;
+ m_containsBOL = false;
+
+ newlineCached = 0;
+ digitsCached = 0;
+ spacesCached = 0;
+ wordcharCached = 0;
+ nondigitsCached = 0;
+ nonspacesCached = 0;
+ nonwordcharCached = 0;
+
+ deleteAllValues(m_disjunctions);
+ m_disjunctions.clear();
+ deleteAllValues(m_userCharacterClasses);
+ m_userCharacterClasses.clear();
+ m_beginChars.clear();
+ }
+
+ bool containsIllegalBackReference()
+ {
+ return m_maxBackReference > m_numSubpatterns;
+ }
+
+ CharacterClass* newlineCharacterClass()
+ {
+ if (!newlineCached)
+ m_userCharacterClasses.append(newlineCached = newlineCreate());
+ return newlineCached;
+ }
+ CharacterClass* digitsCharacterClass()
+ {
+ if (!digitsCached)
+ m_userCharacterClasses.append(digitsCached = digitsCreate());
+ return digitsCached;
+ }
+ CharacterClass* spacesCharacterClass()
+ {
+ if (!spacesCached)
+ m_userCharacterClasses.append(spacesCached = spacesCreate());
+ return spacesCached;
+ }
+ CharacterClass* wordcharCharacterClass()
+ {
+ if (!wordcharCached)
+ m_userCharacterClasses.append(wordcharCached = wordcharCreate());
+ return wordcharCached;
+ }
+ CharacterClass* nondigitsCharacterClass()
+ {
+ if (!nondigitsCached)
+ m_userCharacterClasses.append(nondigitsCached = nondigitsCreate());
+ return nondigitsCached;
+ }
+ CharacterClass* nonspacesCharacterClass()
+ {
+ if (!nonspacesCached)
+ m_userCharacterClasses.append(nonspacesCached = nonspacesCreate());
+ return nonspacesCached;
+ }
+ CharacterClass* nonwordcharCharacterClass()
+ {
+ if (!nonwordcharCached)
+ m_userCharacterClasses.append(nonwordcharCached = nonwordcharCreate());
+ return nonwordcharCached;
+ }
+
+ bool m_ignoreCase : 1;
+ bool m_multiline : 1;
+ bool m_containsBackreferences : 1;
+ bool m_containsBeginChars : 1;
+ bool m_containsBOL : 1;
+ unsigned m_numSubpatterns;
+ unsigned m_maxBackReference;
+ PatternDisjunction* m_body;
+ Vector<PatternDisjunction*, 4> m_disjunctions;
+ Vector<CharacterClass*> m_userCharacterClasses;
+ Vector<BeginChar> m_beginChars;
+
+private:
+ CharacterClass* newlineCached;
+ CharacterClass* digitsCached;
+ CharacterClass* spacesCached;
+ CharacterClass* wordcharCached;
+ CharacterClass* nondigitsCached;
+ CharacterClass* nonspacesCached;
+ CharacterClass* nonwordcharCached;
+};
+
+} } // namespace JSC::Yarr
+
+#endif // RegexPattern_h